@stacksjs/stx 0.2.645 → 0.2.647

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 (263) hide show
  1. package/dist/builtins/attrs.js +6 -6
  2. package/dist/builtins/escape.d.ts +0 -11
  3. package/dist/builtins/escape.js +2 -1
  4. package/dist/builtins/safe-image.js +1 -3
  5. package/dist/builtins/stx-image.js +1 -3
  6. package/dist/builtins/stx-link.d.ts +3 -0
  7. package/dist/builtins/stx-link.js +1 -3
  8. package/dist/{chunk-apeyn69a.js → chunk-04kg16qs.js} +4 -4
  9. package/dist/chunk-0jq3w712.js +65 -0
  10. package/dist/chunk-0ky1j84b.js +2 -0
  11. package/dist/chunk-0m08316b.js +2 -0
  12. package/dist/{chunk-c96f3eq5.js → chunk-0z5cc7qn.js} +8 -8
  13. package/dist/{chunk-hpggz2t4.js → chunk-120ze5ms.js} +3 -3
  14. package/dist/chunk-1c5p7ede.js +2 -0
  15. package/dist/chunk-1q6yvbdx.js +2 -0
  16. package/dist/chunk-1x4qn6fy.js +2 -0
  17. package/dist/chunk-20f1veqy.js +3 -0
  18. package/dist/chunk-2a4szpje.js +3 -0
  19. package/dist/chunk-2c3w367n.js +2 -0
  20. package/dist/chunk-2cxav9xe.js +2 -0
  21. package/dist/chunk-2f17h17f.js +2 -0
  22. package/dist/{chunk-ktvr45qg.js → chunk-2qbvsvwc.js} +2 -2
  23. package/dist/chunk-2v4s7xtx.js +2 -0
  24. package/dist/chunk-31714f76.js +2 -0
  25. package/dist/chunk-354jmw2k.js +3 -0
  26. package/dist/chunk-3e7haxwt.js +2 -0
  27. package/dist/{chunk-ph8dqgr5.js → chunk-3ghbxena.js} +14 -14
  28. package/dist/chunk-40y6mb8t.js +2 -0
  29. package/dist/chunk-42rghbqe.js +12 -0
  30. package/dist/chunk-4fz2eq7g.js +2 -0
  31. package/dist/{chunk-1t0m4pwg.js → chunk-4yf1w261.js} +2 -2
  32. package/dist/chunk-4yt8tg4j.js +2 -0
  33. package/dist/chunk-52gp2xxk.js +2 -0
  34. package/dist/chunk-55x799st.js +49 -0
  35. package/dist/chunk-5e20mvke.js +2 -0
  36. package/dist/chunk-5fzh8n52.js +2 -0
  37. package/dist/chunk-5gtpswnm.js +2 -0
  38. package/dist/{chunk-a0ygyftk.js → chunk-5t4qtxgr.js} +2 -2
  39. package/dist/chunk-5yg3tkth.js +2 -0
  40. package/dist/chunk-67kj14at.js +2 -0
  41. package/dist/{chunk-me1tdtzz.js → chunk-6ajahb2x.js} +3 -3
  42. package/dist/chunk-6vzktvyw.js +2 -0
  43. package/dist/chunk-70pmthc3.js +2 -0
  44. package/dist/chunk-74pej67a.js +18 -0
  45. package/dist/{chunk-r2seygb5.js → chunk-7rta163c.js} +2 -2
  46. package/dist/chunk-7s32fe6k.js +3 -0
  47. package/dist/chunk-84djpte6.js +3 -0
  48. package/dist/chunk-864qtx7y.js +2 -0
  49. package/dist/chunk-8ttg2d3m.js +2 -0
  50. package/dist/{chunk-9yk5rasj.js → chunk-9am6dsb1.js} +3 -3
  51. package/dist/{chunk-rmj0n3ss.js → chunk-9p6efb17.js} +1 -1
  52. package/dist/chunk-9qeg5trh.js +2 -0
  53. package/dist/chunk-9szxxgv5.js +2 -0
  54. package/dist/{chunk-bsts9pr5.js → chunk-9y2ncrnq.js} +2 -2
  55. package/dist/chunk-9z9jtwct.js +33 -0
  56. package/dist/{chunk-gvr10eqb.js → chunk-a3d0g4mr.js} +2 -2
  57. package/dist/{chunk-wpc04ygt.js → chunk-a8j91pqz.js} +11 -11
  58. package/dist/{chunk-mfd3fca7.js → chunk-aah6csjm.js} +11 -11
  59. package/dist/{chunk-dmg8dpah.js → chunk-ajv5xmjx.js} +169 -169
  60. package/dist/chunk-apgb7r22.js +2 -0
  61. package/dist/{chunk-v1mvbf82.js → chunk-aprhqxky.js} +5 -5
  62. package/dist/{chunk-kfq594fh.js → chunk-ar22s1e1.js} +2 -2
  63. package/dist/chunk-asqnaddf.js +3 -0
  64. package/dist/chunk-aze7k3a5.js +2 -0
  65. package/dist/chunk-b07djygp.js +18 -0
  66. package/dist/chunk-b0vhe6d4.js +4 -0
  67. package/dist/chunk-b4fd2dtk.js +2 -0
  68. package/dist/chunk-bk96wjaz.js +61 -0
  69. package/dist/chunk-c7fs96n6.js +4 -0
  70. package/dist/chunk-c9k40352.js +2 -0
  71. package/dist/{chunk-ahyq08mp.js → chunk-ce6zddpf.js} +3 -3
  72. package/dist/{chunk-392pj66x.js → chunk-cj2xj1v6.js} +29 -29
  73. package/dist/chunk-cs0dd5w8.js +2 -0
  74. package/dist/chunk-cwd65649.js +2 -0
  75. package/dist/{chunk-w9zxb26s.js → chunk-da7x7y7j.js} +1 -1
  76. package/dist/{chunk-9wbtj6tj.js → chunk-dgb4z4kw.js} +2 -2
  77. package/dist/chunk-dpjnjs09.js +888 -0
  78. package/dist/chunk-e7sg0fa0.js +2 -0
  79. package/dist/chunk-edz1h5f9.js +2 -0
  80. package/dist/chunk-egg54kd0.js +12 -0
  81. package/dist/chunk-ek2adv0n.js +2 -0
  82. package/dist/chunk-emaexvgz.js +2 -0
  83. package/dist/{chunk-pp6ycfay.js → chunk-ewcrsyr7.js} +2 -2
  84. package/dist/chunk-fcn71bq1.js +2 -0
  85. package/dist/{chunk-38ngmh6h.js → chunk-fg3jw17w.js} +48 -48
  86. package/dist/chunk-fygp3cs9.js +2 -0
  87. package/dist/chunk-g2jmwh7p.js +2 -0
  88. package/dist/chunk-g8r0km7g.js +106 -0
  89. package/dist/{chunk-kchphxkm.js → chunk-gc9ftf7r.js} +3 -3
  90. package/dist/chunk-ggwm8w5m.js +2 -0
  91. package/dist/chunk-h5zr710w.js +2 -0
  92. package/dist/chunk-hgy4c6mm.js +11 -0
  93. package/dist/chunk-hvtzw1jh.js +2 -0
  94. package/dist/{chunk-4n24jbfs.js → chunk-hvzzhkhr.js} +2 -2
  95. package/dist/chunk-j0v970k3.js +2 -0
  96. package/dist/chunk-jk41jwsc.js +2 -0
  97. package/dist/{chunk-6mnwvn9v.js → chunk-jkvr7e91.js} +2 -2
  98. package/dist/{chunk-3ns5k9nf.js → chunk-jsb4pvj1.js} +2 -2
  99. package/dist/{chunk-pf5s5gjp.js → chunk-jx3wpgv0.js} +2 -2
  100. package/dist/{chunk-2zcbx82x.js → chunk-jxda11cg.js} +2 -2
  101. package/dist/chunk-jyth1zjy.js +127 -0
  102. package/dist/chunk-k2pa44rf.js +2 -0
  103. package/dist/{chunk-kad2cp0z.js → chunk-k79x96ra.js} +37 -37
  104. package/dist/{chunk-75c46b62.js → chunk-kgfgb971.js} +4 -4
  105. package/dist/chunk-ma7d95f0.js +31 -0
  106. package/dist/chunk-mmm6mm16.js +3 -0
  107. package/dist/{chunk-r7haw6r7.js → chunk-mmwedr93.js} +5 -5
  108. package/dist/{chunk-dyg6sadv.js → chunk-mrrrngzd.js} +1 -1
  109. package/dist/{chunk-kvn23sz5.js → chunk-msr25dhc.js} +4 -4
  110. package/dist/chunk-myq3hrww.js +6 -0
  111. package/dist/{chunk-fk1rs7jb.js → chunk-n38yb274.js} +6 -6
  112. package/dist/chunk-n4cvg2sw.js +2 -0
  113. package/dist/chunk-nph4d1ff.js +42 -0
  114. package/dist/{chunk-7jgtphhg.js → chunk-nrvwejdw.js} +5 -5
  115. package/dist/{chunk-3cqxtkqv.js → chunk-p08x0z86.js} +7 -7
  116. package/dist/chunk-p22w6mwr.js +2 -0
  117. package/dist/{chunk-fb17t651.js → chunk-pdc9s7bg.js} +2 -2
  118. package/dist/chunk-pfk9ffbz.js +3 -0
  119. package/dist/{chunk-pvfx0dgz.js → chunk-prf164ct.js} +2 -2
  120. package/dist/chunk-pw9bhdaz.js +4 -0
  121. package/dist/chunk-qn63btbf.js +2 -0
  122. package/dist/{chunk-2bsrmqr8.js → chunk-qv6axke4.js} +2 -2
  123. package/dist/{chunk-n54c06wt.js → chunk-r3e6x87d.js} +3 -3
  124. package/dist/chunk-rb5xdcen.js +25 -0
  125. package/dist/{chunk-zm4s3n4p.js → chunk-rcadtv3x.js} +1 -1
  126. package/dist/{chunk-vbqts5sf.js → chunk-rjh2jwxx.js} +9 -9
  127. package/dist/chunk-rwrbdpdk.js +2 -0
  128. package/dist/chunk-sf0wsq74.js +2 -0
  129. package/dist/chunk-shkysa02.js +20 -0
  130. package/dist/chunk-shpc1ttk.js +2 -0
  131. package/dist/{chunk-22hdbqad.js → chunk-t2pzy3x1.js} +3 -3
  132. package/dist/chunk-t6yjxhn8.js +2 -0
  133. package/dist/chunk-tkkvvt26.js +2 -0
  134. package/dist/{chunk-g06qzkmp.js → chunk-tre98h62.js} +2 -2
  135. package/dist/chunk-vac56rgd.js +12 -0
  136. package/dist/chunk-vdxjy7j2.js +4 -0
  137. package/dist/{chunk-qa625vwc.js → chunk-vgt9f7ac.js} +4 -4
  138. package/dist/{chunk-xbdbn3bf.js → chunk-vmwdt8fr.js} +5 -5
  139. package/dist/chunk-vn3yx05b.js +2 -0
  140. package/dist/{chunk-fqg0espy.js → chunk-vqc4h16r.js} +2 -2
  141. package/dist/chunk-w1v1d7rq.js +406 -0
  142. package/dist/chunk-w2q32x72.js +2 -0
  143. package/dist/chunk-weqc0ssb.js +2 -0
  144. package/dist/{chunk-0zr1zxar.js → chunk-wpmrz872.js} +2 -2
  145. package/dist/chunk-wq712sw1.js +2 -0
  146. package/dist/chunk-wzgn9fv7.js +20 -0
  147. package/dist/{chunk-g2mcw1r4.js → chunk-x8k64g1e.js} +2 -2
  148. package/dist/chunk-xaa36b0x.js +3 -0
  149. package/dist/chunk-xnjf1zbn.js +21 -0
  150. package/dist/chunk-xyjn0rvj.js +3 -0
  151. package/dist/chunk-y3vget29.js +2 -0
  152. package/dist/chunk-y9x4pyp2.js +2 -0
  153. package/dist/chunk-yfrvbnc6.js +1312 -0
  154. package/dist/{chunk-febtq3xj.js → chunk-ym41ybz2.js} +6 -6
  155. package/dist/chunk-z8p6tk5z.js +2 -0
  156. package/dist/{chunk-4g8zase6.js → chunk-zevx9866.js} +2 -2
  157. package/dist/chunk-zhf01af3.js +3 -0
  158. package/dist/{chunk-jtvcxbwd.js → chunk-zqtbtqbq.js} +2 -2
  159. package/dist/chunk-ztbzktzg.js +2 -0
  160. package/dist/cli.js +62 -62
  161. package/dist/craft-entry.js +2 -2
  162. package/dist/craft.js +2 -2
  163. package/dist/expressions.d.ts +6 -21
  164. package/dist/expressions.js +12 -41
  165. package/dist/forms-validation.d.ts +0 -16
  166. package/dist/forms-validation.js +4 -2
  167. package/dist/forms.js +8 -6
  168. package/dist/i18n.js +6 -4
  169. package/dist/interpolation-context.js +69 -28
  170. package/dist/loops.js +70 -90
  171. package/dist/mustache-span.d.ts +21 -0
  172. package/dist/mustache-span.js +35 -0
  173. package/dist/process.js +4 -3
  174. package/dist/pwa.js +3 -3
  175. package/dist/server-bindings.js +12 -6
  176. package/dist/ssg.js +28 -28
  177. package/dist/utils.js +1 -2
  178. package/package.json +5 -5
  179. package/dist/chunk-1jgsst0v.js +0 -2
  180. package/dist/chunk-1vrqmdfe.js +0 -2
  181. package/dist/chunk-1vx1ha9v.js +0 -2
  182. package/dist/chunk-1y9jphbg.js +0 -2
  183. package/dist/chunk-22kgdhxy.js +0 -2
  184. package/dist/chunk-2etamr31.js +0 -4
  185. package/dist/chunk-2s49ggrz.js +0 -12
  186. package/dist/chunk-2zbnc6jq.js +0 -2
  187. package/dist/chunk-39beqd1g.js +0 -2
  188. package/dist/chunk-3q5yn5r0.js +0 -6
  189. package/dist/chunk-3tcy2hdt.js +0 -2
  190. package/dist/chunk-3ycbhpa2.js +0 -2
  191. package/dist/chunk-3yqs2ekt.js +0 -2
  192. package/dist/chunk-4mm9ttc7.js +0 -2
  193. package/dist/chunk-4q4vy4g6.js +0 -2
  194. package/dist/chunk-4zapx8zt.js +0 -20
  195. package/dist/chunk-5zkwems4.js +0 -2
  196. package/dist/chunk-6e4es31t.js +0 -3
  197. package/dist/chunk-6hmbzqt8.js +0 -2
  198. package/dist/chunk-7a3kffqy.js +0 -2
  199. package/dist/chunk-7mkw98cr.js +0 -3
  200. package/dist/chunk-7xks65hg.js +0 -3
  201. package/dist/chunk-8k38mddf.js +0 -2
  202. package/dist/chunk-8q05cxzd.js +0 -2
  203. package/dist/chunk-a7y0fk20.js +0 -12
  204. package/dist/chunk-abwxa3tj.js +0 -2
  205. package/dist/chunk-ayjje1hk.js +0 -2
  206. package/dist/chunk-c93291jk.js +0 -2
  207. package/dist/chunk-cf6d5kgb.js +0 -65
  208. package/dist/chunk-crahn5xa.js +0 -4
  209. package/dist/chunk-d1jyxxcm.js +0 -3
  210. package/dist/chunk-d365tseq.js +0 -20
  211. package/dist/chunk-d67qvrzc.js +0 -24
  212. package/dist/chunk-dwnvqy3f.js +0 -4
  213. package/dist/chunk-dxb7jw7g.js +0 -2
  214. package/dist/chunk-e8483tnk.js +0 -2
  215. package/dist/chunk-eaphbqqx.js +0 -2
  216. package/dist/chunk-em0chjea.js +0 -18
  217. package/dist/chunk-ercd4pqc.js +0 -2
  218. package/dist/chunk-ewj4gqwe.js +0 -31
  219. package/dist/chunk-f7bgg2e4.js +0 -2
  220. package/dist/chunk-g6s0xdgb.js +0 -4
  221. package/dist/chunk-jxsgky4v.js +0 -2
  222. package/dist/chunk-k90yzxwp.js +0 -2
  223. package/dist/chunk-kfx4cte8.js +0 -127
  224. package/dist/chunk-kxbw0e2f.js +0 -3
  225. package/dist/chunk-ky043mkv.js +0 -2
  226. package/dist/chunk-mbqqc20a.js +0 -2
  227. package/dist/chunk-mq2kpg6w.js +0 -2
  228. package/dist/chunk-n58ky78d.js +0 -2
  229. package/dist/chunk-n80wh9b5.js +0 -2
  230. package/dist/chunk-p7sfjgtm.js +0 -2
  231. package/dist/chunk-ps9htxmp.js +0 -2
  232. package/dist/chunk-qhaw7f32.js +0 -2
  233. package/dist/chunk-rh33ra9e.js +0 -2
  234. package/dist/chunk-rzs2hpqa.js +0 -2
  235. package/dist/chunk-s3sckkvv.js +0 -2
  236. package/dist/chunk-s89pq4v1.js +0 -2
  237. package/dist/chunk-sdqgmcbk.js +0 -2
  238. package/dist/chunk-srmm69d4.js +0 -2852
  239. package/dist/chunk-t00y30w3.js +0 -2
  240. package/dist/chunk-t1a39rpd.js +0 -2
  241. package/dist/chunk-tj4rzy69.js +0 -2
  242. package/dist/chunk-tme51pg1.js +0 -2
  243. package/dist/chunk-tv1qtqab.js +0 -3
  244. package/dist/chunk-twh5ck5w.js +0 -2
  245. package/dist/chunk-v4tt3t1y.js +0 -2
  246. package/dist/chunk-v5ekdsw0.js +0 -2
  247. package/dist/chunk-vdsrae92.js +0 -2
  248. package/dist/chunk-w88mpbxk.js +0 -11
  249. package/dist/chunk-wg6n7txf.js +0 -2
  250. package/dist/chunk-wj4rf7sb.js +0 -2
  251. package/dist/chunk-wrd5me1w.js +0 -33
  252. package/dist/chunk-xbevgwks.js +0 -2
  253. package/dist/chunk-y2k3ynr2.js +0 -2
  254. package/dist/chunk-y51ndrdb.js +0 -2
  255. package/dist/chunk-y9wqzvxt.js +0 -2
  256. package/dist/chunk-yn2d8x8m.js +0 -3
  257. package/dist/chunk-ysmt4jpn.js +0 -2
  258. package/dist/chunk-zmccfvbf.js +0 -2
  259. package/dist/chunk-ztpqxs72.js +0 -2
  260. package/dist/chunk-ztwnn466.js +0 -2
  261. package/dist/chunk-zx7v6a4g.js +0 -40
  262. package/dist/chunk-zx94g4pg.js +0 -2
  263. package/dist/chunk-zze1ez1c.js +0 -2
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{rd,Li,il,sd,od,id,ad,cd,al,cl,ld,ud,dd,pd}from"./chunk-aah6csjm.js";import"./chunk-dpjnjs09.js";import"./chunk-74pej67a.js";import"./chunk-prf164ct.js";import"./chunk-rb5xdcen.js";import"./chunk-55x799st.js";import"./chunk-nph4d1ff.js";import"./chunk-asqnaddf.js";import"./chunk-xnjf1zbn.js";import"./chunk-vac56rgd.js";import"./chunk-3e7haxwt.js";import"./chunk-xyjn0rvj.js";import"./chunk-yfrvbnc6.js";import"./chunk-pw9bhdaz.js";import"./chunk-a3d0g4mr.js";import"./chunk-04kg16qs.js";import"./chunk-0jq3w712.js";import"./chunk-vgt9f7ac.js";import"./chunk-w1v1d7rq.js";import"./chunk-pdc9s7bg.js";import"./chunk-5t4qtxgr.js";import"./chunk-bk96wjaz.js";import"./chunk-ce6zddpf.js";import"./chunk-7rta163c.js";export{il as SUSPENSE_RESOLVER_RUNTIME,Li as buildSuspenseResolveScript,cd as createStreamRenderer,id as extractStreamBoundaries,pd as generateHydrationRuntime,cl as islandDirective,ud as processSectionDirectives,od as processStreamDirectives,ld as registerStreamingDirectives,sd as renderStreamingPage,rd as streamTemplate,ad as streamTemplateSimple,dd as streamToResponse,al as streamingSuspenseDirective};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- var c=0;function l(){return`suspense-${++c}-${Date.now().toString(36)}`}function bu(s,n={},t){let e=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return s.replace(e,(r,i,o,d)=>{let u=l(),a=p(i||"");return f(u,o.trim(),d.trim(),a)})}function p(s){let n={},t=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,e;while((e=t.exec(s))!==null){let r=e[1],i=e[2]||e[3],o=e[4];switch(r){case"id":n.id=i;break;case"timeout":n.timeout=o?parseInt(o,10):void 0;break}}return n}function f(s,n,t,e){let r=e.timeout||30000,i=e.id||s;return`
2
+ var c=0;function l(){return`suspense-${++c}-${Date.now().toString(36)}`}function Sd(s,n={},t){let e=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return s.replace(e,(r,i,o,d)=>{let u=l(),a=p(i||"");return f(u,o.trim(),d.trim(),a)})}function p(s){let n={},t=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,e;while((e=t.exec(s))!==null){let r=e[1],i=e[2]||e[3],o=e[4];switch(r){case"id":n.id=i;break;case"timeout":n.timeout=o?parseInt(o,10):void 0;break}}return n}function f(s,n,t,e){let r=e.timeout||30000,i=e.id||s;return`
3
3
  <div class="stx-suspense" data-suspense-id="${s}" data-custom-id="${i}" data-status="pending">
4
4
  <div class="stx-suspense-fallback" data-suspense-fallback="${s}">
5
5
  ${t}
@@ -189,7 +189,7 @@ else {
189
189
  }, 0);
190
190
  })();
191
191
  </script>
192
- `}function vu(s,n,t){return{id:s,fallback:t,content:n}}async function wu(s){let n=s.map((e)=>`
192
+ `}function kd(s,n,t){return{id:s,fallback:t,content:n}}async function _d(s){let n=s.map((e)=>`
193
193
  <div id="stx-ssr-suspense-${e.id}" class="stx-ssr-suspense">
194
194
  ${e.fallback}
195
195
  </div>
@@ -214,7 +214,7 @@ else {
214
214
  }
215
215
  })();
216
216
  </script>
217
- `}}return{initial:n,streaming:t()}}function xu(){return`
217
+ `}}return{initial:n,streaming:t()}}function Cd(){return`
218
218
  /* STX Suspense Styles */
219
219
  .stx-suspense {
220
220
  position: relative;
@@ -270,7 +270,7 @@ else {
270
270
  background-size: 200% 100%;
271
271
  }
272
272
  }
273
- `}function Su(){return`
273
+ `}function Ed(){return`
274
274
  // STX Suspense Runtime
275
275
  (function() {
276
276
  if (typeof window === 'undefined') return;
@@ -338,4 +338,4 @@ else {
338
338
  console.log('[stx] Suspense runtime initialized');
339
339
  })();
340
340
  `}
341
- export{bu,vu,wu,xu,Su};
341
+ export{Sd,kd,_d,Cd,Ed};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{p,c}from"./chunk-zx7v6a4g.js";import{re,b}from"./chunk-srmm69d4.js";function A(t,o){let i=1,r=o,n="<template",e="</template";while(r<t.length&&i>0){let s=t.indexOf("<",r);if(s===-1)break;if(r=s,t.startsWith(n,r)&&(r+n.length>=t.length||/[\s>\/]/.test(t[r+n.length]))){i++,r+=n.length;continue}if(t.startsWith(e,r)){let a=t.indexOf(">",r+e.length);if(a!==-1){if(i--,i===0)return a+1;r=a+1;continue}}r++}return i===0?r:-1}var w=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function x(t,o){let i=null;for(let r=o;r<t.length;r++){let n=t[r];if(i){if(n==="\\"){r++;continue}if(n===i)i=null;continue}if(n==='"'||n==="'"){i=n;continue}if(n===">")return r+1}return-1}function N(t,o,i){let r=o.toLowerCase(),n=1,e=i;while(e<t.length){let s=t.indexOf("<",e);if(s===-1)return-1;if(t.startsWith("<!--",s)){let g=t.indexOf("-->",s+4);e=g===-1?t.length:g+3;continue}let a=x(t,s+1);if(a===-1)return-1;let f=t.slice(s,a),u=f.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(u&&u[2].toLowerCase()===r){if(u[1]==="/"){if(n--,n===0)return a}else if(!/\/\s*>$/.test(f))n++}e=a}return-1}function R(t){let o=[],i=[],r=/\bslot\s*=\s*(?:"([^"]+)"|'([^']+)')/i,n=0;while(n<t.length){let e=t.indexOf("<",n);if(e===-1)break;if(t.startsWith("<!--",e)){let l=t.indexOf("-->",e+4);n=l===-1?t.length:l+3;continue}let s=x(t,e+1);if(s===-1)break;let a=t.slice(e,s),f=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!f){n=s;continue}let u=f[2].toLowerCase();if(f[1]==="/"){let l=i.lastIndexOf(u);if(l!==-1)i.splice(l);n=s;continue}let g=/\/\s*>$/.test(a),m=i.length===0?a.match(r):null;if(m){let l=m[1]||m[2],d=a.replace(r,"").replace(/\s+(?=\/?>$)/,"").replace(/\s{2,}/g," "),h=g||w.has(u)?-1:N(t,u,s);if(h===-1)o.push({start:e,end:s,slotName:l,element:d}),n=s;else o.push({start:e,end:h,slotName:l,element:d+t.slice(s,h)}),n=h;continue}if(!g&&!w.has(u)){if(i.push(u),u==="script"||u==="style"){let l=t.toLowerCase().indexOf(`</${u}>`,s);if(l!==-1){n=l;continue}}}n=s}return o}function O(t){let o=[],i=[],r=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,n=0;while(n<t.length){let e=t.indexOf("<",n);if(e===-1)break;if(t.startsWith("<!--",e)){let l=t.indexOf("-->",e+4);n=l===-1?t.length:l+3;continue}let s=x(t,e+1);if(s===-1)break;let a=t.slice(e,s),f=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!f){n=s;continue}let u=f[1]==="/",g=f[2].toLowerCase();if(u){let l=i.lastIndexOf(g);if(l!==-1)i.splice(l);n=s;continue}if(g==="template"&&i.length===0){let l=a.match(r);if(l){let d=A(t,s);if(d!==-1){let h=l[1]||l[2]||l[3];o.push({start:e,end:d,slotName:h,content:t.slice(s,d-11).trim(),propsBinding:l[4]||void 0}),n=d;continue}}}if(!/\/\s*>$/.test(a)&&!w.has(g)){if(i.push(g),g==="script"||g==="style"){let l=t.toLowerCase().indexOf(`</${g}>`,s);if(l!==-1){n=l;continue}}}n=s}return o}function Na(t){let o={default:"",named:new Map},i=t,r=O(t);for(let e of r)o.named.set(e.slotName,{name:e.slotName,content:e.content,propsBinding:e.propsBinding});r.sort((e,s)=>s.start-e.start);for(let e of r)i=i.slice(0,e.start)+i.slice(e.end);let n=R(i);for(let e of n){let s=o.named.get(e.slotName);if(s)s.content+=e.element;else o.named.set(e.slotName,{name:e.slotName,content:e.element})}for(let e=n.length-1;e>=0;e--){let s=n[e];i=i.slice(0,s.start)+i.slice(s.end)}return o.default=i.trim(),o}function Gl(t){let o=t.match(/name\s*=\s*["']([^"']+)["']/),i=o?o[1]:"",r={},n=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,e;while((e=n.exec(t))!==null)r[e[1]]=e[2];let s=t.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),a=s?s[1].trim():"";return{name:i,props:r,defaultContent:a}}async function Da(t,o,i,r){if(!t)return i;let n=t.content;if(t.propsBinding&&Object.keys(o).length>0){let e=t.propsBinding.trim(),s={...r},a=new Set,f=new Set;if(e.startsWith("{")&&e.endsWith("}")){let u=e.slice(1,-1).split(",").map((g)=>g.trim()).filter(Boolean);for(let g of u){let[m,l]=g.split(":").map((h)=>h.trim()),d=l||m;if(s[d]=o[m],o[m]!==void 0)f.add(d);else a.add(d)}}else if(s[e]=o,Object.values(o).some((u)=>u===void 0))a.add(e);else f.add(e);n=C(n,s,a,f)}return n}function C(t,o,i,r){return t.replace(/\{\{\s*([^}]+)\s*\}\}/g,(n,e)=>{try{let s=e.trim();if(re(s,i))return n;if(Array.isArray(o.__stx_preserved_client_expressions)&&o.__stx_preserved_client_expressions.includes(s)&&!re(s,r))return n;let a=k(s,o);if(a===void 0)return n;return b(String(a??""))}catch{return`{{ ${e} }}`}})}function k(t,o){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(t)){let r=t.split("."),n=o;for(let e of r)if(n&&typeof n==="object"&&e in n)n=n[e];else return;return n}let i=t.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(i){let[,r,n,e]=i,s=o[r],a=parseInt(e,10);if(typeof s==="number")switch(n){case"+":return s+a;case"-":return s-a;case"*":return s*a;case"/":return s/a}}try{if(!p(t))return;return c(t,Object.keys(o))(...Object.values(o))}catch{return}}async function Ma(t,o,i){let r=t;r=await M(r,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(s,a,f,u)=>{let g=o.named.get(a),m=u?.trim()||"",l=f||"",d={},h=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,S;while((S=h.exec(l))!==null){let y=S[1],E=S[2];d[y]=k(E,i)}return await Da(g,d,m,i)});let e=/<slot\b((?:"[^"]*"|'[^']*'|[^>"'])*?)\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return r=r.replace(e,(s,a,f)=>{if(/\bname\s*=/.test(a||""))return s;let u=f?.trim()||"";return o.default||u}),r}async function M(t,o,i){let r=[],n=[];t.replace(o,(a,...f)=>{let u=f[f.length-2];return n.push({match:a,index:u}),r.push(i(a,...f.slice(0,-2))),a});let e=await Promise.all(r),s=t;for(let a=n.length-1;a>=0;a--){let{match:f,index:u}=n[a];s=s.slice(0,u)+e[a]+s.slice(u+f.length)}return s}function Kl(t){let o=Na(t);return{defaultSlot:o.default,namedSlots:o.named}}async function Xl(t,o,i,r){return await Ma(t,{default:o,named:i},r)}
3
- export{Na,Gl,Da,Ma,Kl,Xl};
2
+ import{d,u}from"./chunk-bk96wjaz.js";import{ue,m}from"./chunk-w1v1d7rq.js";function A(t,o){let i=1,r=o,n="<template",e="</template";while(r<t.length&&i>0){let s=t.indexOf("<",r);if(s===-1)break;if(r=s,t.startsWith(n,r)&&(r+n.length>=t.length||/[\s>\/]/.test(t[r+n.length]))){i++,r+=n.length;continue}if(t.startsWith(e,r)){let a=t.indexOf(">",r+e.length);if(a!==-1){if(i--,i===0)return a+1;r=a+1;continue}}r++}return i===0?r:-1}var x=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function b(t,o){let i=null;for(let r=o;r<t.length;r++){let n=t[r];if(i){if(n==="\\"){r++;continue}if(n===i)i=null;continue}if(n==='"'||n==="'"){i=n;continue}if(n===">")return r+1}return-1}function N(t,o,i){let r=o.toLowerCase(),n=1,e=i;while(e<t.length){let s=t.indexOf("<",e);if(s===-1)return-1;if(t.startsWith("<!--",s)){let g=t.indexOf("-->",s+4);e=g===-1?t.length:g+3;continue}let a=b(t,s+1);if(a===-1)return-1;let f=t.slice(s,a),c=f.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(c&&c[2].toLowerCase()===r){if(c[1]==="/"){if(n--,n===0)return a}else if(!/\/\s*>$/.test(f))n++}e=a}return-1}function R(t){let o=[],i=[],r=/\bslot\s*=\s*(?:"([^"]+)"|'([^']+)')/i,n=0;while(n<t.length){let e=t.indexOf("<",n);if(e===-1)break;if(t.startsWith("<!--",e)){let l=t.indexOf("-->",e+4);n=l===-1?t.length:l+3;continue}let s=b(t,e+1);if(s===-1)break;let a=t.slice(e,s),f=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!f){n=s;continue}let c=f[2].toLowerCase();if(f[1]==="/"){let l=i.lastIndexOf(c);if(l!==-1)i.splice(l);n=s;continue}let g=/\/\s*>$/.test(a),h=i.length===0?a.match(r):null;if(h){let l=h[1]||h[2],p=a.replace(r,"").replace(/\s+(?=\/?>$)/,"").replace(/\s{2,}/g," "),S=g||x.has(c)?-1:N(t,c,s);if(S===-1)o.push({start:e,end:s,slotName:l,element:p}),n=s;else o.push({start:e,end:S,slotName:l,element:p+t.slice(s,S)}),n=S;continue}if(!g&&!x.has(c)){if(i.push(c),c==="script"||c==="style"){let l=t.toLowerCase().indexOf(`</${c}>`,s);if(l!==-1){n=l;continue}}}n=s}return o}function O(t){let o=[],i=[],r=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,n=0;while(n<t.length){let e=t.indexOf("<",n);if(e===-1)break;if(t.startsWith("<!--",e)){let l=t.indexOf("-->",e+4);n=l===-1?t.length:l+3;continue}let s=b(t,e+1);if(s===-1)break;let a=t.slice(e,s),f=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!f){n=s;continue}let c=f[1]==="/",g=f[2].toLowerCase();if(c){let l=i.lastIndexOf(g);if(l!==-1)i.splice(l);n=s;continue}if(g==="template"&&i.length===0){let l=a.match(r);if(l){let p=A(t,s);if(p!==-1){let S=l[1]||l[2]||l[3];o.push({start:e,end:p,slotName:S,content:t.slice(s,p-11).trim(),propsBinding:l[4]||void 0}),n=p;continue}}}if(!/\/\s*>$/.test(a)&&!x.has(g)){if(i.push(g),g==="script"||g==="style"){let l=t.toLowerCase().indexOf(`</${g}>`,s);if(l!==-1){n=l;continue}}}n=s}return o}function Lc(t){let o={default:"",named:new Map},i=t,r=O(t);for(let e of r)o.named.set(e.slotName,{name:e.slotName,content:e.content,propsBinding:e.propsBinding});r.sort((e,s)=>s.start-e.start);for(let e of r)i=i.slice(0,e.start)+i.slice(e.end);let n=R(i);for(let e of n){let s=o.named.get(e.slotName);if(s)s.content+=e.element;else o.named.set(e.slotName,{name:e.slotName,content:e.element})}for(let e=n.length-1;e>=0;e--){let s=n[e];i=i.slice(0,s.start)+i.slice(s.end)}return o.default=i.trim(),o}function Ju(t){let o=t.match(/name\s*=\s*["']([^"']+)["']/),i=o?o[1]:"",r={},n=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,e;while((e=n.exec(t))!==null)r[e[1]]=e[2];let s=t.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),a=s?s[1].trim():"";return{name:i,props:r,defaultContent:a}}async function jc(t,o,i,r){if(!t)return i;let n=t.content;if(t.propsBinding&&Object.keys(o).length>0){let e=t.propsBinding.trim(),s={...r},a=new Set,f=new Set;if(e.startsWith("{")&&e.endsWith("}")){let c=e.slice(1,-1).split(",").map((g)=>g.trim()).filter(Boolean);for(let g of c){let[h,l]=g.split(":").map((S)=>S.trim()),p=l||h;if(s[p]=o[h],o[h]!==void 0)f.add(p);else a.add(p)}}else if(s[e]=o,Object.values(o).some((c)=>c===void 0))a.add(e);else f.add(e);n=C(n,s,a,f)}return n}function C(t,o,i,r){return t.replace(/\{\{\s*([^}]+)\s*\}\}/g,(n,e)=>{try{let s=e.trim();if(ue(s,i))return n;if(Array.isArray(o.__stx_preserved_client_expressions)&&o.__stx_preserved_client_expressions.includes(s)&&!ue(s,r))return n;let a=k(s,o);if(a===void 0)return n;return m(String(a??""))}catch{return`{{ ${e} }}`}})}function k(t,o){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(t)){let r=t.split("."),n=o;for(let e of r)if(n&&typeof n==="object"&&e in n)n=n[e];else return;return n}let i=t.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(i){let[,r,n,e]=i,s=o[r],a=parseInt(e,10);if(typeof s==="number")switch(n){case"+":return s+a;case"-":return s-a;case"*":return s*a;case"/":return s/a}}try{if(!d(t))return;return u(t,Object.keys(o))(...Object.values(o))}catch{return}}async function Bc(t,o,i){let r=t;r=await M(r,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(s,a,f,c)=>{let g=o.named.get(a),h=c?.trim()||"",l=f||"",p={},S=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,w;while((w=S.exec(l))!==null){let y=w[1],E=w[2];p[y]=k(E,i)}return await jc(g,p,h,i)});let e=/<slot\b((?:"[^"]*"|'[^']*'|[^>"'])*?)\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return r=r.replace(e,(s,a,f)=>{if(/\bname\s*=/.test(a||""))return s;let c=f?.trim()||"";return o.default||c}),r}async function M(t,o,i){let r=[],n=[];t.replace(o,(a,...f)=>{let c=f[f.length-2];return n.push({match:a,index:c}),r.push(i(a,...f.slice(0,-2))),a});let e=await Promise.all(r),s=t;for(let a=n.length-1;a>=0;a--){let{match:f,index:c}=n[a];s=s.slice(0,c)+e[a]+s.slice(c+f.length)}return s}function Yu(t){let o=Lc(t);return{defaultSlot:o.default,namedSlots:o.named}}async function Zu(t,o,i,r){return await Bc(t,{default:o,named:i},r)}
3
+ export{Lc,Ju,jc,Bc,Yu,Zu};
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ import{l,d,Qa,u,t,a}from"./chunk-bk96wjaz.js";import{qe,ht,tn,lo}from"./chunk-3e7haxwt.js";function L(w,e){try{let h=w.trim();if(d(h))return u(h,Object.keys(e))(...Object.values(e));else return l(h,e)}catch{return!1}}function Q(w,e,h){let n=w,v=!0;while(v){v=!1;let p=n.match(/@switch\s*\(/);if(!p||p.index===void 0)break;let b=p.index,s=lo(n,b);if(!s)break;try{let o;if(d(s.expression))o=u(s.expression,Object.keys(e))(...Object.values(e));else o=l(s.expression,e);let r="",g=!1;for(let i of s.cases)if(i.type==="default"){if(!g)r=i.content.trim()}else try{let y;if(i.value&&d(i.value))y=u(i.value,Object.keys(e))(...Object.values(e));else if(i.value)y=l(i.value,e);if(o===y){r=i.content.trim(),g=!0;break}}catch{continue}n=n.substring(0,b)+r+n.substring(s.end),v=!0}catch(o){let r=o instanceof Error?o.message:String(o),g=a("Switch",`Error evaluating @switch expression: ${r}`,t.EVALUATION_ERROR);n=n.substring(0,b)+g+n.substring(s.end);break}}return n}function H(w){let e=[];return{masked:w.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(n)=>(e.push(n),`\x00stx-script-${e.length-1}\x00`)),scripts:e}}function J(w,e){if(e.length===0)return w;return w.replace(/\u0000stx-script-(\d+)\u0000/g,(h,n)=>e[Number(n)]??h)}function ee(w,e,h){let{masked:n,scripts:v}=H(w);return J(K(n,e,h),v)}function K(w,e,h){let n=w;n=Q(n,e,h);{let p=!0;while(p){p=!1;let b=n.match(/@unless\s*\(/);if(!b||b.index===void 0)break;let s=b.index,o=qe(n,s+7);if(!o)break;let r=o.endPos,g=ht(n,"unless","endunless",r);if(g===-1){console.warn(`[stx] @unless directive at position ${s} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let i=n.slice(r,g),y=o.expression,m=-1;{let x=0,k=/@(?:if|unless)\s*\(/g,f=/@(?:endif|endunless)(?![a-z])/g,E=/@else(?![a-z])/g,S=[],C;while((C=k.exec(i))!==null)S.push({pos:C.index,type:"open"});while((C=f.exec(i))!==null)S.push({pos:C.index,type:"close"});while((C=E.exec(i))!==null)S.push({pos:C.index,type:"else"});S.sort((P,R)=>P.pos-R.pos);for(let P of S)if(P.type==="open")x++;else if(P.type==="close")x--;else if(P.type==="else"&&x===0){m=P.pos;break}}let c;if(m!==-1){let x=i.slice(0,m),k=i.slice(m+5);c=`@if (${y})${k}@else ${x}@endif`}else c=`@if (!(${y}))${i}@endif`;n=n.substring(0,s)+c+n.substring(g+10),p=!0}}n=ro(n,e,h),n=so(n,e,h),n=no(n,e);let v=()=>{let p=tn(n);if(p.length===0)return!1;let b=Array(p.length);for(let r=p.length-1;r>=0;r--){let g=p[r];try{let i="",y=!1;for(let m of g.branches){if(y)break;if(m.type==="else")i=m.content,y=!0;else try{if(m.condition?Qa(m.condition,e):!1)i=m.content,y=!0}catch(c){i=a(m.type==="if"?"If":"Elseif",`Error in @${m.type}(${m.condition}): ${c instanceof Error?c.message:String(c)}`,t.EVALUATION_ERROR),y=!0}}b[r]=i}catch(i){let y=i instanceof Error?i.message:String(i);b[r]=a("If",`Error processing @if block: ${y}`,t.EVALUATION_ERROR)}}let s=Array(p.length*2+1),o=0;for(let r=0;r<p.length;r++){let g=p[r];s[r*2]=n.slice(o,g.start),s[r*2+1]=b[r],o=g.end}return s[p.length*2]=n.slice(o),n=s.join(""),!0};while(!0){let p=n;if(!v())break;if(n===p)break}return n}function q(w){let e=0;while(e<w.length&&/\s/.test(w[e]))e++;if(w[e]!=="(")return null;e++;while(e<w.length&&/\s/.test(w[e]))e++;let h=w[e];if(h!=="'"&&h!=='"')return null;e++;let n=[];while(e<w.length){let v=w[e];if(v==="\\"&&e+1<w.length){n.push(w[e+1]),e+=2;continue}if(v===h){e++;break}n.push(v),e++}while(e<w.length&&/\s/.test(w[e]))e++;if(w[e]!==")")return null;return e++,{value:n.join(""),consumed:e}}function no(w,e){let h=w;function n(s,o,r,g){let i=1,y=g,m=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),c=new RegExp(`@${r}(?![a-z])`,"g");while(y<s.length&&i>0){m.lastIndex=y,c.lastIndex=y;let x=m.exec(s),k=c.exec(s),f=x?x.index:1/0,E=k?k.index:1/0;if(f<E)i++,y=f+x[0].length;else if(E<1/0){if(i--,i===0)return E;y=E+k[0].length}else break}return-1}function v(s,o,r){let g=0,i=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),y=new RegExp(`@${r}(?![a-z])`,"g"),m=/@else(?![a-z])/g,c=[],x;while((x=i.exec(s))!==null)c.push({pos:x.index,type:"open"});while((x=y.exec(s))!==null)c.push({pos:x.index,type:"close"});while((x=m.exec(s))!==null)c.push({pos:x.index,type:"else"});c.sort((k,f)=>k.pos-f.pos);for(let k of c)if(k.type==="open")g++;else if(k.type==="close")g--;else if(k.type==="else"&&g===0)return k.pos;return-1}{let s=!0;while(s){s=!1;let o=h.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,g,i,y=h.slice(r+5),m=q(y);if(m)g=m.value,i=r+5+m.consumed;else i=r+5;let c=n(h,"auth","endauth",i);if(c===-1){console.warn(`[stx] @auth directive at position ${r} has no matching @endauth \u2014 the block was skipped.`);break}let x=h.slice(i,c),k=v(x,"auth","endauth"),f;if(!e.auth)f=!1;else f=g?L(`auth?.check && auth?.user?.[${g}]`,e):L("auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=f?S:C}else E=f?x:"";h=h.substring(0,r)+E+h.substring(c+8),s=!0}}{let s=!0;while(s){s=!1;let o=h.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,g,i,y=h.slice(r+6),m=q(y);if(m)g=m.value,i=r+6+m.consumed;else i=r+6;let c=n(h,"guest","endguest",i);if(c===-1){console.warn(`[stx] @guest directive at position ${r} has no matching @endguest \u2014 the block was skipped.`);break}let x=h.slice(i,c),k=v(x,"guest","endguest"),f;if(!e.auth)f=!0;else f=g?L(`!auth?.check || !auth?.user?.[${g}]`,e):L("!auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=f?S:C}else E=f?x:"";h=h.substring(0,r)+E+h.substring(c+9),s=!0}}function p(s,o,r){if(e.userCan&&typeof e.userCan[s]==="boolean")return e.userCan[s];if(e.permissions?.check&&typeof e.permissions.check==="function")try{let g=[s];if(o)g.push(o);if(r){let i=L(r,e);g.push(i)}return e.permissions.check(...g)}catch{return!1}return!1}function b(s){let o=s.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!o)return null;return{ability:o[1],type:o[2],id:o[3]?.trim(),paramsEnd:o[0].length}}for(let s of["can","cannot"]){let o=`end${s}`,r=s==="can"?"elsecan":"elsecannot",g=!0;while(g){g=!1;let i=h.match(new RegExp(`@${s}\\s*\\(`));if(!i||i.index===void 0)break;let y=i.index,m=h.slice(y+`@${s}`.length),c=b(m);if(!c)break;let x=y+`@${s}`.length+c.paramsEnd,k=n(h,s,o,x);if(k===-1){console.warn(`[stx] @${s} directive at position ${y} has no matching @${o} \u2014 the block was skipped.`);break}let f=h.slice(x,k),E=[],S=0,C=new RegExp(`@${s}\\s*\\(`,"g"),P=new RegExp(`@${o}(?![a-z])`,"g"),R=new RegExp(`@${r}\\s*\\(`,"g"),T=/@else(?![a-z])/g,_=[],M;while((M=C.exec(f))!==null)_.push({pos:M.index,type:"open"});while((M=P.exec(f))!==null)_.push({pos:M.index,type:"close"});while((M=R.exec(f))!==null)_.push({pos:M.index,type:"elseDirective"});while((M=T.exec(f))!==null)_.push({pos:M.index,type:"else"});_.sort((A,z)=>A.pos-z.pos);for(let A of _){if(A.type==="open"){S++;continue}if(A.type==="close"){S--;continue}if(S===0)E.push(A)}let I=[],F=0;for(let A=0;A<E.length;A++){let z=E[A];if(I.push({content:f.slice(F,z.pos),ability:void 0}),z.type==="elseDirective"){let D=f.slice(z.pos+`@${r}`.length),B=b(D);if(B){I[I.length-1]={content:f.slice(F,z.pos)},F=z.pos+`@${r}`.length+B.paramsEnd,I.push({content:"",ability:B.ability,type:B.type,id:B.id}),I.pop();let G=E[A+1],U=G?G.pos:f.length;I.push({content:f.slice(F,U),ability:B.ability,type:B.type,id:B.id}),F=U}}else F=z.pos+5}if(F<f.length){let A=I[I.length-1];if(E.length>0&&E[E.length-1].type==="else")I.push({content:f.slice(F),isFinalElse:!0});else if(I.length===0)I.push({content:f.slice(F)})}let O=p(c.ability,c.type,c.id),j=s==="can"?O:!O,V="";if(j)V=I[0]?.content||"";else{let A=!1;for(let z=1;z<I.length;z++){let D=I[z];if(D.isFinalElse){V=D.content,A=!0;break}if(D.ability){let B=p(D.ability,D.type,D.id);if(s==="can"?B:!B){V=D.content,A=!0;break}}}if(!A&&I.length>0){let z=I[I.length-1];if(z.isFinalElse)V=z.content}}h=h.substring(0,y)+V+h.substring(k+`@${o}`.length),g=!0}}return h}function ro(w,e,h){let n=w;function v(p,b,s,o,r){let g=!0;while(g){g=!1;let i=new RegExp(`@${b}\\s*\\(`),y=p.match(i);if(!y||y.index===void 0)break;let m=y.index,c=qe(p,m+`@${b}`.length);if(!c)break;let x=c.endPos,k=ht(p,b,s,x);if(k===-1){console.warn(`[stx] @${b} directive at position ${m} has no matching @${s} \u2014 the block was skipped.`);break}let f=p.slice(x,k),E=c.expression,S=-1,C=0,P=0;while(P<f.length){let R=f.indexOf("@",P);if(R===-1)break;let T=f.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(T)){C++,P=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(T)){C--,P=R+1;continue}if(C===0&&/^@else(?![a-z])/.test(T)){S=R;break}P=R+1}try{let R=o(E.trim()),T;if(S!==-1){let _=f.slice(0,S),M=f.slice(S+5);T=R?_:M}else T=R?f:"";p=p.substring(0,m)+T+p.substring(k+`@${s}`.length),g=!0}catch(R){let T=R instanceof Error?R.message:String(R),_=a(r,`Error processing @${b} directive: ${T}`,t.EVALUATION_ERROR);p=p.substring(0,m)+_+p.substring(k+`@${s}`.length);break}}return p}return n=v(n,"isset","endisset",(p)=>{let b=L(p,e);return b!==void 0&&b!==null},"Isset"),n=v(n,"empty","endempty",(p)=>{let b=L(p,e);return b===void 0||b===null||b===""||b===0||b===!1||Array.isArray(b)&&b.length===0||typeof b==="object"&&b!==null&&Object.keys(b).length===0},"Empty"),n}function so(w,e,h){let n=w,v="development";function p(b,s,o,r){let g=new RegExp(`@${s}(?![a-z])`,"g"),i=new RegExp(`@${o}(?![a-z])`,"g"),y=new RegExp(`^@${s}(?![a-z])`),m=new RegExp(`^@${o}(?![a-z])`),c=b,x=!0;while(x){x=!1,g.lastIndex=0;let k=g.exec(c);if(!k)break;let f=k.index,E=f+k[0].length;if(s==="env"){let O=c.substring(E).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!O)break;E+=O[0].length,r=v===O[2]}let S=1,C=E,P=-1;while(S>0&&C<c.length){g.lastIndex=C,i.lastIndex=C;let O=g.exec(c),j=i.exec(c),V=O?O.index:1/0,A=j?j.index:1/0;if(V<A)S++,C=V+O[0].length;else if(A<1/0){if(S--,S===0){P=A;break}C=A+j[0].length}else break}if(P===-1){console.warn(`[stx] @${s} directive at position ${f} has no matching @${o} \u2014 the block was skipped.`);break}let R=c.substring(E,P),T=-1,_=0,M=0;while(M<R.length){let O=R.indexOf("@",M);if(O===-1)break;let j=R.substring(O);if(y.test(j)){_++,M=O+1;continue}if(m.test(j)){_--,M=O+1;continue}if(_===0&&/^@else(?![a-z])/.test(j)){T=O;break}M=O+1}let I;if(T!==-1){let O=R.slice(0,T),j=R.slice(T+5);I=r?O:j}else I=r?R:"";let F=`@${o}`.length;c=c.substring(0,f)+I+c.substring(P+F),x=!0}return c}return n=p(n,"env","endenv",!1),n=p(n,"production","endproduction",v==="production"),n=p(n,"development","enddevelopment",v==="development"),n=p(n,"staging","endstaging",v==="staging"),n=p(n,"testing","endtesting",v==="testing"),n}
3
+ export{ee,no,ro,so};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Bd,Fd}from"./chunk-hgy4c6mm.js";import"./chunk-wzgn9fv7.js";import"./chunk-myq3hrww.js";import"./chunk-9y2ncrnq.js";import"./chunk-xnjf1zbn.js";import"./chunk-vac56rgd.js";import"./chunk-3e7haxwt.js";import"./chunk-yfrvbnc6.js";import"./chunk-pw9bhdaz.js";import"./chunk-a3d0g4mr.js";import"./chunk-04kg16qs.js";import"./chunk-0jq3w712.js";import"./chunk-vgt9f7ac.js";import"./chunk-w1v1d7rq.js";import"./chunk-pdc9s7bg.js";import"./chunk-5t4qtxgr.js";import"./chunk-bk96wjaz.js";import"./chunk-ce6zddpf.js";import"./chunk-7rta163c.js";export{Fd as clearStoreCache,Bd as getStoreScript};
@@ -0,0 +1,18 @@
1
+ // @bun
2
+ import{ie,Ma,ds,ln,f,Pe,Ie}from"./chunk-w1v1d7rq.js";import{Yn,Ge,N}from"./chunk-yfrvbnc6.js";import{Hn,s}from"./chunk-dpjnjs09.js";import{me}from"./chunk-vac56rgd.js";function b(o){return o.endsWith(".md")||o.endsWith(".markdown")}function C(o){let e=[];m(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let r=[...e];m(/<code\b[^>]*>[\s\S]*?<\/code>/gi,r);function m(n,p){let g;while((g=n.exec(o))!==null){let t=g.index,i=t+g[0].length;if(p?.some((l)=>t>=l.start&&i<=l.end))continue;e.push({start:t,end:i})}}if(e.length===0)return o;e.sort((n,p)=>n.start-p.start);let a="",c=0;for(let n of e){if(n.start<c)continue;a+=o.slice(c,n.start),a+=`@raw${o.slice(n.start,n.end)}@endraw`,c=n.end}return a+=o.slice(c),a}async function R(o,e={}){let{data:r,content:m}=Yn(o),c=await(e.renderer??((n)=>Ge(n)))(m);return{html:C(c),frontmatter:r??{}}}import{dirname as k,resolve as _}from"path";function v(o){let e=o,r=ie(o);if(r)e=r.content.trim();let m=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,a=[],c=[],n=[],p=(i)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(i),g;while((g=m.exec(o))!==null){let i=g[1],l=g[2],d=g[0],u=i.includes("server");if(p(l))n.push(d);else if(u)c.push(l);else a.push(d)}let t=e;{let i=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,l,d=[];while((l=i.exec(t))!==null){let u=l.index+l[0].length,w=t.indexOf("</script>",u);if(w===-1)continue;d.push({start:l.index,end:w+9}),i.lastIndex=w+9}for(let u=d.length-1;u>=0;u--)t=t.substring(0,d[u].start)+t.substring(d[u].end)}for(let i of a)t=t.replace(i,"");return{templateContent:t,serverScripts:c,clientScripts:a,signalsScripts:n}}function M(o,e){return`<!DOCTYPE html>
3
+ <html lang="en">
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <title>${(e||"stx").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}</title>
8
+ </head>
9
+ <body>
10
+ ${o}
11
+ </body>
12
+ </html>`}async function Ki(o,e={}){let r=_(o),m=Bun.file(r);if(!await m.exists())throw Error(`Template file not found: ${r}`);let a=await m.text(),c=null;if(b(r)){let n=await R(a,{renderer:e.markdownRenderer});a=n.html,c=n.frontmatter}if(c)e={...e,context:{...c,...e.context||{}}};if(e.layout){let n=_(e.layout),p=Bun.file(n);if(!await p.exists())throw Error(`Layout template not found: ${n}`);let{layout:g,injectCSS:t,...i}=e,l={...e.context||{}};ln(l);let d=await x(a,r,{...i,context:{...l,__stx_defer_server_data:!0},injectCSS:!1}),u=await p.text(),w={...l,content:d},S={...i,context:w,injectCSS:t};return x(u,n,S)}return x(a,r,e)}async function x(o,e,r={}){let{templateContent:m,serverScripts:a,clientScripts:c}=v(o),n={...N,...r.options},p={__filename:e,__dirname:k(e),__stx:{},__stx_options:n,__stx_sfc_mode:!0,__stx_inject_css:r.injectCSS===!0,__stxServeContext:void 0,...ds(r.context??{}),definePageMeta:()=>{},...r.context||{}};for(let i of a)await f(i,p,e);let g=new Set,t=m;if(t=await s(t,p,e,n,g),Ma(p,r.context),r.templateOnly){if(t=t.replace(/<script data-stx-scoped>[\s\S]*?<\/script>\s*/gi,""),t=t.replace(/<!-- stx SEO Tags -->[\s\S]*?(?=<)/i,""),c.length>0)t+=`
13
+ ${c.join(`
14
+ `)}`}else{if(r.processClientScripts!==!1&&c.length>0){let i=p.__stx_event_bindings||[],l=Pe(p),d=await Promise.all(c.map(async(y)=>{let h=y.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!h)return y;return await Ie(h[1],{eventBindings:i,templateContent:t,serverData:l,filePath:e})})),w=[await Hn(d,{...n,buildMode:"compile"}),...d].filter(Boolean).join(`
15
+ `);if(t.match(/(<\/body>)/i))t=t.replace(/(<\/body>)/i,`${w}
16
+ $1`);else t+=`
17
+ ${w}`}t=await me(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=M(t,r.title)}if(r.injectCSS)try{let{injectCss:i}=await import("./chunk-emaexvgz.js");t=await i(t)}catch{}return t}
18
+ export{Ki};
@@ -0,0 +1,4 @@
1
+ // @bun
2
+ import{k}from"./chunk-w1v1d7rq.js";import{se}from"./chunk-84djpte6.js";function g(e,t){let r={};for(let n of e)r[n]=se(t(n));return new Proxy({},{get:(n,a)=>r[a]?.(),set:(n,a,o)=>{if(r[a])r[a].set(o);else r[a]=se(o);return!0},has:(n,a)=>(a in r),deleteProperty:(n,a)=>(delete r[a],!0),ownKeys:()=>Reflect.ownKeys(r),getOwnPropertyDescriptor:(n,a)=>(a in r)?{enumerable:!0,configurable:!0,writable:!0,value:r[a]()}:void 0})}function v(e,t){let r={};for(let n of t)r[n]=e[n];return r}function Mi(e,t){let r=Object.keys(e),n=g(r,(i)=>t?.[i]??e[i].getDefaultValue()),a=g(r,()=>[]),o=g(r,()=>!1),c=g(r,()=>!1),f=g(r,()=>!1),s=se(!1);async function u(i){f[i]=!0;let d=await e[i].validate(n[i],n);return a[i]=d,f[i]=!1,d.length===0}async function l(){s.set(!0);let i=await Promise.all(r.map(u));return s.set(!1),i.every(Boolean)}function m(){for(let i of r)n[i]=t?.[i]??e[i].getDefaultValue(),a[i]=[],o[i]=!1,c[i]=!1}function h(i){for(let d of r)if(d in i)n[d]=i[d],c[d]=!0}function b(i,d){n[i]=d,c[i]=!0}function y(i,d=!0){if(o[i]=d,d)u(i)}function p(i){return{value:n[i],errors:a[i],touched:o[i],dirty:c[i],valid:a[i].length===0,validating:f[i]}}function V(i){return async(d)=>{d?.preventDefault?.();for(let w of r)o[w]=!0;if(await l())await i(v(n,r))}}return{values:n,errors:a,touched:o,dirty:c,get isValid(){return r.every((i)=>a[i].length===0)},get isValidating(){return s()||r.some((i)=>f[i])},get isDirty(){return r.some((i)=>c[i])},validate:l,validateField:u,reset:m,setValues:h,setFieldValue:b,setFieldTouched:y,getFieldState:p,handleSubmit:V}}var tl=Mi;class Pn{rules=[];defaultValue="";addRule(e){let t=new Pn;return t.rules=[...this.rules,e],t.defaultValue=this.defaultValue,t}required(e="This field is required"){return this.addRule({name:"required",message:e,validate:(t)=>{if(t===null||t===void 0)return e;if(typeof t==="string"&&t.trim()==="")return e;if(Array.isArray(t)&&t.length===0)return e;return!0}})}email(e="Please enter a valid email"){return this.addRule({name:"email",message:e,validate:(t)=>{if(!t)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(t))||e}})}url(e="Please enter a valid URL"){return this.addRule({name:"url",message:e,validate:(t)=>{if(!t)return!0;try{return new URL(String(t)),!0}catch{return e}}})}min(e,t){let r=t||`Must be at least ${e} characters`;return this.addRule({name:"min",message:r,validate:(n)=>{if(!n)return!0;return String(n).length>=e||r}})}max(e,t){let r=t||`Must be no more than ${e} characters`;return this.addRule({name:"max",message:r,validate:(n)=>{if(!n)return!0;return String(n).length<=e||r}})}length(e,t,r){let n=r||`Must be between ${e} and ${t} characters`;return this.addRule({name:"length",message:n,validate:(a)=>{if(!a)return!0;let o=String(a).length;return o>=e&&o<=t||n}})}pattern(e,t="Invalid format"){return this.addRule({name:"pattern",message:t,validate:(r)=>{if(!r)return!0;return e.test(String(r))||t}})}hasUppercase(e="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,e)}hasLowercase(e="Must contain a lowercase letter"){return this.pattern(/[a-z]/,e)}hasNumber(e="Must contain a number"){return this.pattern(/\d/,e)}hasSpecial(e="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,e)}alphanumeric(e="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,e)}startsWithLetter(e="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,e)}noSpaces(e="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:e,validate:(t)=>{if(!t)return!0;return!String(t).includes(" ")||e}})}number(e="Must be a number"){let t=this.addRule({name:"number",message:e,validate:(r)=>{if(!r&&r!==0)return!0;return!Number.isNaN(Number(r))||e}});return t.defaultValue=0,t}integer(e="Must be a whole number"){return this.addRule({name:"integer",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number.isInteger(Number(t))||e}})}positive(e="Must be a positive number"){return this.addRule({name:"positive",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)>0||e}})}negative(e="Must be a negative number"){return this.addRule({name:"negative",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)<0||e}})}minValue(e,t){let r=t||`Must be at least ${e}`;return this.addRule({name:"minValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)>=e||r}})}maxValue(e,t){let r=t||`Must be no more than ${e}`;return this.addRule({name:"maxValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)<=e||r}})}between(e,t,r){let n=r||`Must be between ${e} and ${t}`;return this.addRule({name:"between",message:n,validate:(a)=>{if(!a&&a!==0)return!0;let o=Number(a);return o>=e&&o<=t||n}})}matches(e,t){let r=t||`Must match ${e}`;return this.addRule({name:"matches",message:r,validate:(n,a)=>{if(!a)return!0;return n===a[e]||r}})}oneOf(e,t){let r=t||`Must be one of: ${e.join(", ")}`;return this.addRule({name:"oneOf",message:r,validate:(n)=>{if(!n)return!0;return e.includes(n)||r}})}notOneOf(e,t){let r=t||`Cannot be one of: ${e.join(", ")}`;return this.addRule({name:"notOneOf",message:r,validate:(n)=>{if(!n)return!0;return!e.includes(n)||r}})}date(e="Must be a valid date"){return this.addRule({name:"date",message:e,validate:(t)=>{if(!t)return!0;let r=new Date(String(t));return!Number.isNaN(r.getTime())||e}})}before(e,t){let r=new Date(e),n=t||`Must be before ${r.toLocaleDateString()}`;return this.addRule({name:"before",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))<r||n}})}after(e,t){let r=new Date(e),n=t||`Must be after ${r.toLocaleDateString()}`;return this.addRule({name:"after",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))>r||n}})}custom(e,t="Invalid value"){return this.addRule({name:"custom",message:t,validate:e})}async(e,t="Invalid value"){return this.addRule({name:"async",message:t,async:!0,validate:e})}when(e,t){let r=new Pn;r.rules=[...this.rules],r.defaultValue=this.defaultValue;for(let n of t.getRules())r.rules.push({...n,validate:(a,o)=>{if(!e(a,o||{}))return!0;return n.validate(a,o)}});return r}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default(e){let t=new Pn;return t.rules=[...this.rules],t.defaultValue=e,t}async validate(e,t){let r=[];for(let n of this.rules){let a=await n.validate(e,t);if(a!==!0)r.push(a)}return r}validateSync(e,t){let r=[];for(let n of this.rules){if(n.async)continue;let a=n.validate(e,t);if(a!==!0)r.push(a)}return r}}var td=new Pn;function nl(e,t,r){let n=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return u.map((l)=>k(c,{...t,message:l},r)).join(`
3
+ `)}catch{return""}})}function rl(e,t,r){let n=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return u.map((l)=>k(c,{...t,message:l},r)).join(`
4
+ `)}catch{return""}})}function sl(e,t,r){let n=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return c}catch{return""}})}function nd(e,t,r){let n=e;return n=nl(n,t,r),n=rl(n,t,r),n=sl(n,t,r),n}export{Mi,tl,Pn,td,nl,rl,sl,nd};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{ei,ti,ni,_u,ri,si,Cu,oi,ii,wc,Eu}from"./chunk-t2pzy3x1.js";export{ei as VideoProcessorCache,wc as analyzeVideo,_u as clearVideoCache,ii as generateDASHManifest,oi as generateHLSManifest,ri as generatePoster,Cu as generateSpriteSheet,si as generateThumbnails,ti as getCachedVideoResult,Eu as processVideo,ni as setCachedVideoResult};
@@ -0,0 +1,61 @@
1
+ // @bun
2
+ import{H}from"./chunk-354jmw2k.js";import Oe from"path";var t={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603};function G(e){for(let[n,r]of Object.entries(t))if(r===e)return n;return}import st from"path";var ot={showRelativePaths:!1,enableAutoRecovery:H(),logRecoveryWarnings:!0},Y={...ot};function N(){return{...Y}}function M(e){if(!Y.showRelativePaths||!e)return e;let n=Y.baseDir||process.cwd();try{let r=st.relative(n,e);return r.startsWith("..")?e:r}catch{return e}}class L extends Error{code;filePath;line;column;context;numericCode;constructor(e,n,r,i,s,o,c){super(e);this.code=n;this.filePath=r;this.line=i;this.column=s;this.context=o;if(this.name="StxError",this.numericCode=c||t.EVALUATION_ERROR,this.filePath)this.filePath=M(this.filePath)}}class ne extends L{constructor(e,n,r,i,s,o){super(e,"stx_RUNTIME_ERROR",n,r,i,s,o||t.EVALUATION_ERROR);this.name="StxRuntimeError"}}class ur extends L{constructor(e,n,r,i,s,o){super(e,"stx_FILE_ERROR",n,r,i,s,o||t.FILE_NOT_FOUND);this.name="StxFileError"}}class z extends L{isFatal=!0;constructor(e,n,r,i,s,o){super(e,"stx_VALIDATION_ERROR",n,r,i,s,o||t.DOM_API_VIOLATION);this.name="StxValidationError"}}function me(e){let{type:n,message:r,code:i,filePath:s,line:o,column:c,template:g,offset:f,snippet:p,suggestion:h,format:m="text"}=e,y=o,b=c;if(!y&&g&&f!==void 0){let K=pt(g,f);y=K.line,b=K.column}let S=s?M(s):void 0,x=i?G(i):void 0,R={type:n,code:i,codeName:x,message:r,filePath:S,line:y,column:b,snippet:p,suggestion:h,timestamp:new Date().toISOString()},T;switch(m){case"html":T=ct(R);break;case"json":T=JSON.stringify(R,null,2);break;case"console":T=lt(R,g,f);break;case"text":default:T=at(R,g,f);break}return{formatted:T,data:R}}function at(e,n,r){let i=[],s=e.code?` [${e.codeName||e.code}]`:"";if(i.push(`[${e.type} Error${s}]`),e.filePath){let o=e.filePath;if(e.line){if(o+=`:${e.line}`,e.column)o+=`:${e.column}`}i.push(`at ${o}`)}if(i.push(`
3
+ ${e.message}`),n&&e.line){let o=ut(n,e.line,2);if(o)i.push(`
4
+ ${o}`)}if(e.snippet)i.push(`
5
+ Snippet: ${e.snippet}`);if(e.suggestion)i.push(`
6
+ Suggestion: ${e.suggestion}`);return i.join(" ")}function ct(e){let n=e.code?` [${e.code}]`:"",r=e.filePath?` in ${e.filePath}${e.line?`:${e.line}`:""}`:"",i=`<!-- [${e.type} Error${n}]${r}: ${de(e.message)}`;if(e.suggestion)i+=` | Suggestion: ${de(e.suggestion)}`;return i+=" -->",i}function lt(e,n,r){let p=[],h=e.code?` [${e.codeName||e.code}]`:"";if(p.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${e.type} Error${h} \u2501\u2501\u2501${"\x1B[0m"}`),e.filePath){let m=`\x1B[36m${e.filePath}\x1B[0m`;if(e.line){if(m+=`\x1B[90m:${e.line}\x1B[0m`,e.column)m+=`\x1B[90m:${e.column}\x1B[0m`}p.push(`
7
+ \x1B[90mat\x1B[0m ${m}`)}if(p.push(`
8
+
9
+ ${e.message}`),n&&e.line){let m=gt(n,e.line,2);if(m)p.push(`
10
+
11
+ \x1B[90mContext:\x1B[0m
12
+ ${m}`)}if(e.suggestion)p.push(`
13
+
14
+ \x1B[33mSuggestion:\x1B[0m ${e.suggestion}`);return p.push(`
15
+ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),p.join("")}function ut(e,n,r){let i=e.split(`
16
+ `),s=Math.max(0,n-r-1),o=Math.min(i.length-1,n+r-1),c=[];for(let g=s;g<=o;g++){let f=(g+1).toString().padStart(4),p=g===n-1?">":" ";c.push(`${p}${f} | ${i[g]}`)}return c.join(`
17
+ `)}function gt(e,n,r){let i=e.split(`
18
+ `),s=Math.max(0,n-r-1),o=Math.min(i.length-1,n+r-1),c="\x1B[90m",g="\x1B[31m",f="\x1B[0m",p=[];for(let h=s;h<=o;h++){let m=(h+1).toString().padStart(4),y=h===n-1,b=y?"\x1B[31m>\x1B[0m":" ",S=y?`\x1B[31m${i[h]}\x1B[0m`:`\x1B[90m${i[h]}\x1B[0m`;p.push(`${b}\x1B[90m${m}\x1B[0m | ${S}`)}return p.join(`
19
+ `)}function de(e){return e.replace(/--/g,"- -").replace(/>/g,"&gt;")}function pt(e,n){let i=e.substring(0,n).split(`
20
+ `);return{line:i.length,column:i[i.length-1].length}}function a(e,n,r){return me({type:e,message:n,code:r,format:"html"}).formatted}async function be(e,n,r){try{return await e()}catch(i){if(r&&i instanceof Error)r(i);return n}}var zo={isEnabled(){return N().enableAutoRecovery},fixCommonSyntaxErrors(e){let n=N();if(!n.enableAutoRecovery)return{fixed:e,fixes:[]};let r=e,i=[],s=(r.match(/\{\{/g)||[]).length,o=(r.match(/\}\}/g)||[]).length;if(s>o){let g=s-o;r+="}}".repeat(g),i.push(`Added ${g} missing closing braces '}}'`)}let c=["if","foreach","for","switch","section"];for(let g of c){let f=(r.match(new RegExp(`@${g}\\b`,"g"))||[]).length,p=(r.match(new RegExp(`@end${g}\\b`,"g"))||[]).length;if(f>p){let h=f-p;for(let m=0;m<h;m++)r+=`
21
+ @end${g}`;i.push(`Added ${h} missing @end${g}`)}}if(i.length>0&&n.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),i.forEach((g)=>console.warn(` - ${g}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:r,fixes:i}},createFallbackContent(e,n){if(H())return`<!-- ${e} failed: ${n.message} -->`;return"<!-- stx rendering error -->"}};class J{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor(e={}){this.maxErrors=e.maxErrors??1000,this.enableFileLogging=e.enableFileLogging??!1,this.logFilePath=e.logFilePath??".stx/errors.log",this.logFormat=e.logFormat??"json",this.maxFileSize=e.maxFileSize??10485760,this.maxLogFiles=e.maxLogFiles??5,this.minLevel=e.minLevel??"all"}configure(e){if(e.maxErrors!==void 0)this.maxErrors=e.maxErrors;if(e.enableFileLogging!==void 0)this.enableFileLogging=e.enableFileLogging;if(e.logFilePath!==void 0)this.logFilePath=e.logFilePath;if(e.logFormat!==void 0)this.logFormat=e.logFormat;if(e.maxFileSize!==void 0)this.maxFileSize=e.maxFileSize;if(e.maxLogFiles!==void 0)this.maxLogFiles=e.maxLogFiles;if(e.minLevel!==void 0)this.minLevel=e.minLevel}log(e,n,r="error"){let i={timestamp:new Date,error:e,context:n,level:r};if(this.errors.push(i),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(r))this.writeToFile(i)}shouldLog(e){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return e==="error"||e==="warning";if(this.minLevel==="error")return e==="error";return!0}formatEntry(e){if(this.logFormat==="json")return JSON.stringify({timestamp:e.timestamp.toISOString(),level:e.level||"error",type:e.error.constructor.name,message:e.error.message,stack:e.error.stack,context:e.context});let n=[`[${e.timestamp.toISOString()}] [${(e.level||"error").toUpperCase()}] ${e.error.constructor.name}: ${e.error.message}`];if(e.error.stack)n.push(` Stack: ${e.error.stack.split(`
22
+ `).slice(1).join(`
23
+ `)}`);if(e.context)n.push(` Context: ${JSON.stringify(e.context)}`);return n.join(`
24
+ `)}writeToFile(e){this.writeQueue=this.writeQueue.then(async()=>{try{let n=await import("fs"),r=await import("path"),i=r.dirname(this.logFilePath);if(!n.existsSync(i))n.mkdirSync(i,{recursive:!0});await this.rotateIfNeeded(n);let s=`${this.formatEntry(e)}
25
+ `;n.appendFileSync(this.logFilePath,s,"utf-8")}catch(n){if(process.env.STX_DEBUG==="true")console.error("Failed to write to error log:",n)}})}async rotateIfNeeded(e){try{if(!e.existsSync(this.logFilePath))return;if(e.statSync(this.logFilePath).size<this.maxFileSize)return;for(let r=this.maxLogFiles-1;r>=1;r--){let i=`${this.logFilePath}.${r}`,s=`${this.logFilePath}.${r+1}`;if(e.existsSync(i))if(r>=this.maxLogFiles-1)e.unlinkSync(i);else e.renameSync(i,s)}if(this.maxLogFiles<=1)e.writeFileSync(this.logFilePath,"");else e.renameSync(this.logFilePath,`${this.logFilePath}.1`)}catch(n){if(process.env.STX_DEBUG==="true")console.error("Failed to rotate error logs:",n)}}getRecentErrors(e=10){return this.errors.slice(-e)}getErrorsByType(e){return this.errors.filter((n)=>n.error.constructor.name===e)}getErrorsByLevel(e){return this.errors.filter((n)=>n.level===e)}clear(){this.errors.length=0}async clearLogFile(){try{let e=await import("fs");if(e.existsSync(this.logFilePath))e.writeFileSync(this.logFilePath,"","utf-8")}catch(e){if(process.env.STX_DEBUG==="true")console.error("Failed to clear error log:",e)}}getStats(){let e={},n={error:0,warning:0,info:0};for(let r of this.errors){let i=r.error.constructor.name;e[i]=(e[i]||0)+1;let s=r.level||"error";n[s]=(n[s]||0)+1}return{total:this.errors.length,byType:e,byLevel:n}}async exportToFile(e,n="json"){let r=await import("fs"),i=await import("path"),s=i.dirname(e);if(!r.existsSync(s))r.mkdirSync(s,{recursive:!0});if(n==="json"){let o=this.errors.map((c)=>({timestamp:c.timestamp.toISOString(),level:c.level||"error",type:c.error.constructor.name,message:c.error.message,stack:c.error.stack,context:c.context}));r.writeFileSync(e,JSON.stringify(o,null,2),"utf-8")}else{let o=this.errors.map((c)=>this.formatEntry(c));r.writeFileSync(e,o.join(`
26
+
27
+ `),"utf-8")}}async flush(){await this.writeQueue}}var D=new J,hn={isDevelopment(){return H()},logDetailedError(e,n){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",e.message),console.error("Stack:",e.stack),n)console.error("Context:",n);console.error("========================")},createErrorReport(e,n){let r=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${e.message}`,`Type: ${e.constructor.name}`,`Stack: ${e.stack}`];if(n)r.push(`Context: ${JSON.stringify(n,null,2)}`);return r.push("========================"),r.join(`
28
+ `)}};function w(e,n,r,i=0){let s=0,o=i,c=null,g=0,f=!1;while(o<e.length){let p=e[o];if(c&&f){f=!1,o++;continue}if(c&&p==="\\"){f=!0,o++;continue}if(f=!1,(p==='"'||p==="'"||p==="`")&&!c){c=p,o++;continue}if(p===c&&c!=="`"){c=null,o++;continue}if(c==="`"&&p==="$"&&e[o+1]==="{"){g++,o+=2;continue}if(g>0&&p==="}"){g--,o++;continue}if(p==="`"&&c==="`"&&g===0){c=null,o++;continue}if(c){o++;continue}if(p===n)s++;else if(p===r){if(s--,s===0)return o}o++}return-1}var ft={maxSanitizeDepth:10,allowBracketNotation:!1},Se={...ft};var j=/\bnew\s+/,B="__stx_safe_ctors",ke=["Bun","Deno","Buffer","fetch","atob","btoa","console","Response","Request","Headers","WebAssembly","structuredClone","queueMicrotask","crypto","performance","navigator","Worker","WebSocket","BroadcastChannel","EventSource","XMLHttpRequest","localStorage","sessionStorage"],Z=[...ke,"Function","setTimeout","setInterval","setImmediate","process","require","exports","module","window","document","global","globalThis","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry"],he=Z.map(()=>{return}),Q=Object.freeze(Object.assign(Object.create(null),{keys:Object.keys,values:Object.values,entries:Object.entries,fromEntries:Object.fromEntries,assign:Object.assign,hasOwn:Object.hasOwn,is:Object.is})),te=[/\b(eval|Function|setTimeout|setInterval|setImmediate)\b/,/\b(process|require|import|exports|module)\b/,/\b(window|document|global|globalThis)\b/,/\b(constructor|prototype|__proto__)\b/,/\b(Reflect|Proxy)\b/,/\bSymbol\b/,/\b(WeakMap|WeakSet|WeakRef|FinalizationRegistry)\b/,/\b(Generator|AsyncGenerator)\b/,/__\w+__/,/\.(bind|call|apply)\s*\(/,j,/\bdelete\s+/,/\bthis\b/,/\\u(?:\{[\dA-Fa-f]+\}|[\dA-Fa-f]{4})/],re=new Set([...ke,"eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this",B]),ie=new Set(["__proto__","constructor","prototype"]);function $e(e){let n="",r=[],i=null,s=!1;for(let o=0;o<e.length;o++){let c=e[o];if(s){s=!1;continue}if(c==="\\"&&i){s=!0;continue}if(i){if(i==="`"&&c==="$"&&o+1<e.length&&e[o+1]==="{"){let g=1;o+=2;while(o<e.length&&g>0){if(e[o]==="{")g++;else if(e[o]==="}")g--;if(g>0)n+=e[o],r.push(o),o++}continue}if(c===i)i=null;continue}if(c==='"'||c==="'"||c==="`"){i=c;continue}n+=c,r.push(o)}return{text:n,map:r}}function Re(e){return $e(e).text}var Ce=["Collator","DateTimeFormat","DisplayNames","ListFormat","Locale","NumberFormat","PluralRules","RelativeTimeFormat","Segmenter"],Ae=(()=>{let e={Date,URL,URLSearchParams},n=Intl;for(let r of Ce)if(typeof n[r]==="function")e[`Intl_${r}`]=n[r];return Object.freeze(Object.assign(Object.create(null),e))})(),dt=/^new(\s+)(Date|URLSearchParams|URL|Intl\s*\.\s*([A-Z_a-z]\w*))\s*\(/,ye=/(?<![\w$])new(?![\w$])/g,Ee=`only new Date(), new URL(), new URLSearchParams() and new Intl.{${Ce.join(",")}}() are allowed`;function mt(e){let{text:n,map:r}=$e(e),i=[];ye.lastIndex=0;let s;while((s=ye.exec(n))!==null){let c=s.index;if(/(?<!\.)\.\s*$/.test(n.slice(0,c)))continue;let g=dt.exec(n.slice(c)),f=g?.[3],p=!g?null:f?`Intl_${f}`:g[2];if(!g||!p||!(p in Ae))throw new k(`matched /${j.source}/; ${Ee}`,e);let h=c+g[0].length,m=r[c],y=r[h-1]+1;if(e.slice(m,y)!==n.slice(c,h))throw new k(`matched /${j.source}/; ${Ee}`,e);let b=m+3+g[1].length;i.push({start:b,end:b+g[2].length,key:p})}let o=e;for(let c=i.length-1;c>=0;c--){let g=i[c];o=`${o.slice(0,g.start)}${B}.${g.key}${o.slice(g.end)}`}return{source:o,usesSafeConstructors:i.length>0}}class k extends Error{rule;expression;constructor(e,n,r){super(r??`Potentially unsafe expression (${e}): ${n}`);this.name="UnsafeExpressionError",this.rule=e,this.expression=n}}function bs(e){try{return se(e),null}catch(n){return n instanceof k?n.rule:n instanceof Error?n.message:String(n)}}function Te(e,n){let r=/[$A-Z_a-z][$\w]*/g,i;while((i=r.exec(e))!==null){let s=i[0],o=e[i.index-1];if(re.has(s))throw new k(`matched /\\b${s}\\b/; identifier ${s}`,n);if(o==="."&&ie.has(s))throw new k(`matched /.${s}/; property ${s}`,n)}}function _e(e,n=!0){let r=/(?:[$\w)\].]|\?\.)\s*\[([^\]]*)\]/g,i=new Set,s;while((s=r.exec(e))!==null){let o=s.index+s[0].indexOf("["),c=e.slice(0,o);if(/(?:^|[^$\w])(?:let|const|var)\s*$/.test(c))continue;let g=s[1].trim(),f=/^'(?:[^'\\]|\\.)*'$/.test(g),p=/^"(?:[^"\\]|\\.)*"$/.test(g);if(/^\d+$/.test(g))continue;if(f||p){let m=g.slice(1,-1);if(ie.has(m))throw new k(`bracket key ${m}`,e);if(!Se.allowBracketNotation)throw new k("bracket notation with a string key; enable with configureSafeEvaluator({ allowBracketNotation: true })",e,`Bracket notation with strings not allowed: ${e}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);continue}if(n&&/^[$A-Z_a-z][$\w]*$/.test(g)){i.add(g);continue}throw new k("dynamic bracket notation is not allowed",e)}return[...i]}function se(e){let n=e.trim(),r=Re(n);Te(r,n);let i=_e(n);for(let s of te){if(s===j)continue;if(s.test(r))throw new k(`matched /${s.source}/`,n)}return{...mt(n),dynamicKeys:i}}function Fo(e){return se(e),e.trim()}var vs=Symbol("stx.sanitizeCache");function U(e){let n={},r=e[vs];n.Math=Math,n.JSON=JSON,n.Date=Date,n.String=String,n.Number=Number,n.Boolean=Boolean,n.Array=Array,n.Object=Q,n.parseInt=Number.parseInt,n.parseFloat=Number.parseFloat,n.isNaN=Number.isNaN,n.isFinite=Number.isFinite,n.encodeURIComponent=encodeURIComponent,n.decodeURIComponent=decodeURIComponent;for(let[i,s]of Object.entries(e)){if(i.startsWith("__")||te.some((o)=>o.test(i)))continue;if(s&&typeof s==="object"&&!Array.isArray(s)){let o=r?.get(s);if(o===void 0)o=ee(s),r?.set(s,o);n[i]=o}else n[i]=s}return n}function ee(e,n=0){if(n>=Se.maxSanitizeDepth)return"[Object too deep]";if(e===null||typeof e!=="object")return e;if(Array.isArray(e))return e.map((i)=>ee(i,n+1));if(e instanceof Date||e instanceof RegExp||e instanceof Map||e instanceof Set||e instanceof Error)return e;let r={};for(let[i,s]of Object.entries(e)){if(i.startsWith("__")||i==="constructor"||i==="prototype")continue;if(s&&typeof s==="object")r[i]=ee(s,n+1);else r[i]=s}return r}function l(e,n){try{let r=U(n),i=Object.keys(r),s=Object.values(r);return u(e,i)(...s)}catch{return}}function d(e){try{return Fo(e),!0}catch{return!1}}function Qa(e,n){try{let r=U(n),i=Object.keys(r),s=Object.values(r),o=!1,g=u(e,i,()=>{o=!0})(...s);return!o&&Boolean(g)}catch{return!1}}function C(e,n){try{let r=l(e,n);if(r&&typeof r==="object"&&!Array.isArray(r))return r;return{}}catch{return{}}}var Ie=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield","let","static","implements","interface","package","private","protected","public","arguments","eval","await"]),ht=2000,F=new Map;function xe(e,n){let r=`${e.join(",")}\x00${n}`,i=F.get(r);if(i)return i;let s=Function(...e,n);if(F.size>=ht)F.clear();return F.set(r,s),s}function et(e){return e.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:)/g,"$1$2").match(/\b[a-zA-Z_$][\w$]*\b/g)||[]}var yt=/^[A-Za-z_$][\w$]*$/;function Nt(e){return yt.test(e)&&!Ie.has(e)}function u(e,n,r){let{source:i,usesSafeConstructors:s,dynamicKeys:o}=se(e),c=[];for(let m=0;m<n.length;m++){if(!Nt(n[m]))continue;if(n[m]===B||n[m]==="Object"||re.has(n[m]))continue;c.push({key:n[m],index:m})}c.sort((m,y)=>m.key.localeCompare(y.key));let g=c.map((m)=>m.key),f=c.map((m)=>m.index),p=`
29
+ 'use strict';
30
+ try {
31
+ return ${i};
32
+ }
33
+ catch (e) {
34
+ if (e instanceof TypeError) {
35
+ return undefined;
36
+ }
37
+ throw e;
38
+ }
39
+ `;return Et(bt(s?(m)=>{let y=xe([B,"Object",...Z,...g,...m],p);return(...b)=>y(Ae,Q,...he,...b)}:(m)=>{let y=xe(["Object",...Z,...g,...m],p);return(...b)=>y(Q,...he,...b)},g,n,c,f,r),n,o)}function Et(e,n,r){if(r.length===0)return e;let i=r.map((s)=>n.indexOf(s));return(...s)=>{for(let o of i){if(o<0)continue;let c=s[o];if(typeof c==="string"&&ie.has(c))return}return e(...s)}}function bt(e,n,r,i,s,o){let c=e([]),g=i.every((p,h)=>p.index===h);if(n.length===r.length&&g)return we(c,n,e,void 0,o);return we((...p)=>{let h=Array(s.length);for(let m=0;m<s.length;m++)h[m]=p[s[m]];return c(...h)},n,e,(p)=>{c=e(p)},o)}function we(e,n,r,i,s){let c=/^(\w+) is not defined$/,g=e,f=[],p=new Set(n);return(...h)=>{for(let m=0;m<=8;m++)try{return g(...h)}catch(y){let b=y instanceof Error?y.message:"",S=c.exec(b);if(!(y instanceof ReferenceError)||!S)return;let x=S[1];if(p.has(x)||Ie.has(x)||re.has(x))return;if(s?.(x),p.add(x),f.push(x),i)i(f);else g=r(f)}return}}function ws(e){let n=e.trim();try{let r=Re(n);if(/\b(?:eval|function|import|require|process|globalthis|window|document|fetch|bun|deno|buffer|console|reflect|proxy|prototype|constructor|this)\b/i.test(r))return!1;Te(r,n),_e(n);for(let i of te)if(i.test(r))return!1}catch{return!1}return!0}function Ho(e,n){let r=[];n.lastIndex=0;let i;while((i=n.exec(e))!==null){let s=i.index,o=s+i[0].length-1,c=w(e,"(",")",o);if(c===-1){r.push({start:s,end:-1,args:"",call:e.slice(s,Math.min(e.length,s+80))}),n.lastIndex=o+1;continue}r.push({start:s,end:c+1,args:e.slice(o+1,c),call:e.slice(s,c+1)}),n.lastIndex=c+1}return r}function Dt(e,n,r,i){let s="",o=0;for(let c of Ho(e,n)){if(s+=e.slice(o,c.start),c.end===-1){s+=i(c.call),o=c.start;continue}s+=r(c.args,c.call),o=c.end}return s+e.slice(o)}function Mt(e){let n=[],r=0,i=null,s="";for(let o=0;o<e.length;o++){let c=e[o];if(i){if(s+=c,c==="\\"&&o+1<e.length){s+=e[++o];continue}if(c===i)i=null;continue}if(c==="'"||c==='"'||c==="`")i=c;else if(c==="("||c==="["||c==="{")r++;else if(c===")"||c==="]"||c==="}")r--;else if(c===","&&r===0){n.push(s.trim()),s="";continue}s+=c}if(s.trim())n.push(s.trim());return n}function ae(e){let n=e.trim(),r=n[0];if(r!=="'"&&r!=='"'&&r!=="`"||n.length<2||n.at(-1)!==r)return null;let i="";for(let s=1;s<n.length-1;s++){let o=n[s];if(o==="\\"&&s+1<n.length-1){let c=n[++s];i+=c==="n"?`
40
+ `:c==="t"?"\t":c;continue}if(o===r)return null;if(r==="`"&&o==="$"&&n[s+1]==="{")return null;i+=o}return i}var xt=new Set(["true","false","null","undefined","typeof","void","new","in","of","instanceof","this","delete","await","async","function","return","NaN","Infinity"]);function Lt(e,n){let r=e.trim();if(!r)return{ok:!1,message:"the argument is empty",code:t.INVALID_DIRECTIVE_SYNTAX};let i=bs(r);if(i)return{ok:!1,message:`the expression is not allowed (${i})`,code:t.UNSAFE_EXPRESSION};let s=U(n),o;try{o=u(r,Object.keys(s))(...Object.values(s))}catch(g){return{ok:!1,message:`the expression could not be evaluated: ${g instanceof Error?g.message:String(g)}`,code:t.EVALUATION_ERROR}}if(o!==void 0&&o!==null)return{ok:!0,value:o};let c=[...new Set(et(r))].filter((g)=>!xt.has(g)&&!(g in s)&&!(g in globalThis));if(c.length>0)return{ok:!1,message:`${c.map((f)=>`"${f}"`).join(", ")} ${c.length===1?"is":"are"} not defined here. Values a directive reads must come from <script server> or the render context; a plain <script> runs in the browser. To pass literal text, quote it.`,code:t.UNDEFINED_VARIABLE};if(o===void 0&&(r.startsWith("{")||r.startsWith("[")))return{ok:!1,message:"the expression threw while it was evaluated",code:t.EVALUATION_ERROR};return{ok:!0,value:o}}function Le(e){if(e===null)return"null";if(Array.isArray(e))return"an array";if(typeof e==="object")return"an object";if(typeof e==="string")return`a string ("${e.length>40?`${e.slice(0,40)}...`:e}")`;return`${/^[aeiou]/.test(typeof e)?"an":"a"} ${typeof e}`}function tt(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Ne(e){if(!e)return"";return Oe.isAbsolute(e)?Oe.relative(process.cwd(),e)||e:e}function oe(e){let n=e.replace(/\s+/g," ").trim();return n.length>80?`${n.slice(0,77)}...`:n}function P(e,n,r,i,s=t.EVALUATION_ERROR){let o=i?` in ${Ne(i)}`:"";return console.warn(`[stx] ${oe(n)}${o}: ${r}`),a(e,`${oe(n)}: ${r}`,s)}function xs(e,n,r){let i=r?` in ${Ne(r)}`:"";console.warn(`[stx] ${oe(e)}${i}: ${n}`)}function Vo(){return{afterOpen:[],beforeClose:[]}}function wt(e){return e.afterOpen.length>0||e.beforeClose.length>0}function ec(e,n){if(!wt(n))return e;let r=n.afterOpen.join(""),i=n.beforeClose.join(""),s=e.lastIndexOf("</head>"),o=r?dr(e):null,c=i&&s!==-1?s:null;if(o===null&&c===null)return e;if(o!==null&&c!==null)return`${e.slice(0,o)}${r}${e.slice(o,c)}${i}${e.slice(c)}`;if(o!==null)return`${e.slice(0,o)}${r}${e.slice(o)}`;return`${e.slice(0,c)}${i}${e.slice(c)}`}var Me=/\s*<meta\b[^>]*\bcharset\b[^>]*>/iy;function dr(e){let n=/<head\b[^>]*>/i.exec(e);if(!n)return null;let r=n.index+n[0].length;Me.lastIndex=r;let i=Me.exec(e);return i?r+i[0].length:r}var le="data-stx-color-mode-boot",Pe="__STX_COLOR_MODE__",St=new Set(["light","dark","auto","system"]),kt=new Set(["auto","system"]),vt=/^[a-z][\w:-]*$/i,$t=/^[\w-]+$/;function Rt(e){let n=e.storageKey??"stx-color-mode",r=e.initialMode??"auto",i=e.darkClass===void 0?"dark":e.darkClass,s=e.attribute??null,o=e.autoValue??null,c=e.respectExisting===!0;if(typeof n!=="string"||n.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!St.has(r))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(r)}`);if(i!==null&&(typeof i!=="string"||!$t.test(i)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(i)}`);if(s!==null&&(typeof s!=="string"||!vt.test(s)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(s)}`);if(o!==null&&!kt.has(o))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(o)}`);if(i===null&&s===null)throw Error("colorMode needs at least one of darkClass or attribute \u2014 with both null nothing would mark the mode on <html>");if(c&&s===null)throw Error("colorMode.respectExisting needs an attribute to read \u2014 the dark class alone cannot say whether a mode was chosen");return{storageKey:n,initialMode:r==="system"?"auto":r,darkClass:i,attribute:s,autoValue:o,respectExisting:c}}function Ct(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function ue(e={}){let n=Rt(e),r=Ct(n),i=`(function(){"use strict";var o=window.${Pe};if(o&&typeof o.sync==="function"){o.sync();return}var c=${r};var r=document.documentElement;function read(){var p=c.initialMode,a=c.autoValue;try{var v=localStorage.getItem(c.storageKey);if(v==="light"||v==="dark"){p=v}else if(v==="auto"||v==="system"){p="auto";if(!a)a=v}}catch(e){}return{p:p,a:a}}function sys(){try{return matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){return"light"}}function stamp(m){if(c.attribute)r.setAttribute(c.attribute,m);if(c.darkClass){if(m==="dark")r.classList.add(c.darkClass);else r.classList.remove(c.darkClass)}}var s=read();var f=null;if(c.respectExisting&&c.attribute){var x=r.getAttribute(c.attribute);if(x==="light"||x==="dark")f=x}var m=f||(s.p==="auto"?sys():s.p);var p=s.p;stamp(m);var g=null;function sync(){var t=read(),n=f||(t.p==="auto"?sys():t.p);var moved=n!==m,chose=t.p!==p;if(moved){r.style.setProperty("transition","none","important");stamp(n);void r.offsetHeight;r.style.removeProperty("transition")}else stamp(n);m=n;p=t.p;if(g){g.mode=n;g.preference=t.p;if(t.a)g.autoValue=t.a}if(moved||chose){try{window.dispatchEvent(new CustomEvent("stx:color-mode",{detail:{mode:n,preference:t.p}}))}catch(e){}}}try{g=window.${Pe}={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:s.a||"auto",respectExisting:c.respectExisting,forced:f,preference:p,mode:m,watching:true,sync:sync}}catch(e){}try{var q=matchMedia("(prefers-color-scheme: dark)");if(q.addEventListener)q.addEventListener("change",sync);else if(q.addListener)q.addListener(sync)}catch(e){}try{addEventListener("pageshow",sync);addEventListener("storage",function(e){if(e.key===null||e.key===c.storageKey)sync()});document.addEventListener("visibilitychange",function(){if(document.visibilityState==="visible")sync()})}catch(e){}}());`;return`<script ${le}>${i}</script>`}function pr(e,n={}){if(e.includes(le))return e;let r=ce(e);if(r===null)return e;let i=ue(n);return`${e.slice(0,r)}
41
+ ${i}${e.slice(r)}`}var ce=dr,At=new RegExp(`<script\\b[^>]*\\b${le}\\b[^>]*>[\\s\\S]*?<\\/script>`,"i"),Fe=/<meta\b[^>]*\bcharset\b[^>]*>/gi,De=/<\/head>/gi;function Tt(e){let n=/<head\b[^>]*>/i.exec(e);if(!n)return e;let r=n.index+n[0].length;De.lastIndex=r;let i=De.exec(e),s=i?i.index:e.length;Fe.lastIndex=r;let o=Fe.exec(e);if(!o||o.index>=s)return e;if(e.slice(r,o.index).trim()==="")return e;let c=o.index+o[0].length;return`${e.slice(0,r)}
42
+ ${o[0]}${e.slice(r,o.index)}${e.slice(c,s)}${e.slice(s)}`}function tc(e){return _t(Tt(e))}function _t(e){let n=At.exec(e);if(!n)return e;let r=ce(e);if(r===null)return e;if(n.index<=r||e.slice(r,n.index).trim()==="")return e;let i=e.slice(0,n.index)+e.slice(n.index+n[0].length),s=ce(i);if(s===null)return e;return`${i.slice(0,s)}
43
+ ${n[0]}${i.slice(s)}`}var He="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",V="data-stx-html-attrs",W="data-stx-html-class",Ue=/^[A-Za-z_:][\w:.-]*$/;function v(e){return String(e).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function It(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function nt(e){if(e.name)return`name="${e.name}"`;if(e.property)return`property="${e.property}"`;if(e.charset!=null)return"charset=";if(e["http-equiv"])return`http-equiv="${e["http-equiv"]}"`;return""}function Ot(e){let n=/^\s*<meta\b([^>]*)>/i.exec(e);if(!n)return null;let r={};for(let i of n[1].matchAll(/([\w:-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g))r[i[1].toLowerCase()]=i[2]??i[3]??i[4]??"";return r}function _(e,n){return Object.entries(e).filter(([r])=>!n?.(r)).map(([r,i])=>`${r}="${v(String(i))}"`).join(" ")}function X(e){let n=String(e.content),r=typeof e.type==="string"?e.type.trim().toLowerCase():"";return/json$|^importmap$/.test(r)?n.replace(/<\//g,"<\\/"):n}function Ve(e){let n=_(e,(r)=>r==="content");return`<script${n?` ${n}`:""}>${X(e)}</script>`}function Pt(e={},n="en"){let r=[],i=[],s="",o=n;for(let[g,f]of Object.entries(e||{})){if(f==null)continue;let p=g.trim();if(!Ue.test(p))continue;let h=p.toLowerCase();if(h==="lang"){o=String(f);continue}if(h==="class"){s=String(f).trim();continue}r.push(` ${p}="${v(String(f))}"`),i.push(p)}let c=` lang="${v(o)}"`;if(s)c+=` class="${v(s)}"`;if(c+=r.join(""),s)c+=` ${W}="${v(s)}"`;if(i.length)c+=` ${V}="${v(i.join(" "))}"`;return c}function nc(e={},n={}){let r={...e,...n};if(e.class&&n.class){let i=e.class.split(/\s+/).filter(Boolean);for(let s of n.class.split(/\s+/).filter(Boolean))if(!i.includes(s))i.push(s);r.class=i.join(" ")}return r}function fr(e,n={}){if(!n||Object.keys(n).length===0)return e;let r=e.match(/<html\b([^>]*)>/i);if(!r)return e;let i={},s=[],o=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,c;while((c=o.exec(r[1]))!==null){let h=c[1];if(!(h in i))s.push(h);i[h]=c[2]??c[3]??c[4]??""}let g=[],f=[];for(let[h,m]of Object.entries(n)){if(m==null)continue;let y=h.trim();if(!Ue.test(y))continue;let b=y.toLowerCase();if(b==="class"){let S=(i.class||"").split(/\s+/).filter(Boolean);for(let x of String(m).split(/\s+/).filter(Boolean))if(!S.includes(x))S.push(x),g.push(x);if(!("class"in i))s.push("class");i.class=S.join(" ");continue}if(!(y in i))s.push(y);if(i[y]=String(m),b!=="lang")f.push(y)}if(g.length){if(!(W in i))s.push(W);i[W]=g.join(" ")}if(f.length){if(!(V in i))s.push(V);i[V]=f.join(" ")}let p=s.map((h)=>` ${h}="${v(i[h])}"`).join("");return e.replace(r[0],()=>`<html${p}>`)}function rc(e){if(e.includes("data-stx-cloak"))return null;if(e.lastIndexOf("</head>")===-1)return null;return`${He}
44
+ `}function Ft(e){let n=[],r=0;while(r<e.length){let o=e.slice(r),c=o.match(/^\s+/);if(c){r+=c[0].length;continue}if(o.startsWith("<!--")){let m=e.indexOf("-->",r);if(m===-1)break;r=m+3;continue}let g=o.match(/^<script\b[^>]*>/i);if(g){let m=e.toLowerCase().indexOf("</script>",r+g[0].length);if(m===-1)break;r=m+9;continue}let f=o.match(/^<link\b[^>]*>/i);if(f){n.push(f[0]),r+=f[0].length;continue}let p=o.match(/^<meta\b[^>]*>/i);if(p){n.push(p[0]),r+=p[0].length;continue}let h=o.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(h){n.push(h[0]),r+=h[0].length;continue}break}if(n.length===0)return{body:e,hoisted:n};let i="",s=0;while(s<e.length&&s<r){let o=e.slice(s),c=o.match(/^<link\b[^>]*>/i);if(c&&n.includes(c[0])){s+=c[0].length;continue}let g=o.match(/^<meta\b[^>]*>/i);if(g&&n.includes(g[0])){s+=g[0].length;continue}let f=o.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(f&&n.includes(f[0])){s+=f[0].length;continue}i+=e[s],s++}return i+=e.slice(r),{body:i,hoisted:n}}function jt(e,n={},r={}){let{title:i="stx App",lang:s="en",meta:o=[],link:c=[],script:g=[],headRaw:f="",htmlAttrs:p={},bodyClass:h="",bodyAttrs:m={}}=n,y=r.title||i,b=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],S=new Set(o.map(nt).filter(Boolean)),{body:x,hoisted:R}=Ft(e),T=new Set(R.flatMap((E)=>{let O=Ot(E);return O?[nt(O)].filter(Boolean):[]})),Ke=[...b.filter((E)=>!S.has(nt(E))),...o].filter((E)=>!T.has(nt(E))).map((E)=>` <meta ${_(E)}>`).join(`
45
+ `),Ge=c.map((E)=>` <link ${_(E)}>`).join(`
46
+ `),Ye=g.map((E)=>{if(E.src)return` <script ${_(E,(O)=>O==="content")}></script>`;if(E.content)return` ${Ve(E)}`;return""}).filter(Boolean).join(`
47
+ `),Je=Pt(p,s),Ze=Object.entries(m).map(([E,O])=>` ${E}="${v(String(O))}"`).join(""),Qe=h?` class="${v(h)}"`:"",rt=[Ke,r.colorMode?` ${ue(r.colorMode)}`:"",` <title>${r.titleIsHtml?y:It(y)}</title>`,` ${He}`,Ge,Ye,f?` ${f}`:"",...(r.styles||[]).map((E)=>` ${E}`),...R.map((E)=>` ${E}`),...(r.headScripts||[]).map((E)=>` ${E}`),r.headStack||""].filter(Boolean),it=[x,...(r.bodyScripts||[]).map((E)=>E),r.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
48
+ <html${Je}>
49
+ <head>
50
+ ${rt.join(`
51
+ `)}
52
+ </head>
53
+ <body${Qe}${Ze}>
54
+ ${it.join(`
55
+ `)}
56
+ </body>
57
+ </html>`}var ge=/\s+/y,pe=/<(script|style)\b[^>]*>/iy,zt=/<\/script>/gi,Bt=/<\/style>/gi,ze=/<!DOCTYPE\b/iy,Be=/<html[\s>]/iy;function yn(e){let n=0;while(n<e.length){if(ge.lastIndex=n,ge.exec(e)){n=ge.lastIndex;continue}if(e.startsWith("<!--",n)){let s=e.indexOf("-->",n);if(s===-1)return!1;n=s+3;continue}pe.lastIndex=n;let i=pe.exec(e);if(i){let s=i[1].toLowerCase()==="script"?zt:Bt;s.lastIndex=pe.lastIndex;let o=s.exec(e);if(o===null)return!1;n=o.index+o[0].length;continue}if(ze.lastIndex=n,ze.test(e))return!0;return Be.lastIndex=n,Be.test(e)}return!1}function Uo(e){return yn(e)}function sc(e,n={}){let r=e.lastIndexOf("</head>");if(r===-1)return e;let{meta:i=[],link:s=[],script:o=[],headRaw:c=""}=n,g=e.slice(0,r),f=[];for(let p of i){let h=nt(p);if(h&&g.includes(h))continue;f.push(` <meta ${_(p)}>`)}for(let p of s){if(p.href&&g.includes(`href="${p.href}"`))continue;f.push(` <link ${_(p)}>`)}for(let p of o)if(p.src){if(g.includes(`src="${p.src}"`))continue;f.push(` <script ${_(p,(h)=>h==="content")}></script>`)}else if(p.content){if(g.includes(X(p)))continue;f.push(` ${Ve(p)}`)}if(c&&!g.includes(c))f.push(` ${c}`);if(f.length===0)return e;return`${e.slice(0,r)}${f.join(`
58
+ `)}
59
+ ${e.slice(r)}`}function gr(e,n={},r={},i){if(i??Uo(e))return e;return jt(e,n,r)}var Ht=["og:","article:","book:","profile:","fb:","music:","video:"],Ut=/^[a-z][\w-]*(?::[\w:-]+)?$/i;function mr(e,n){if(e.length<1)return{kind:"error",message:"meta directive requires at least the meta name",code:t.INVALID_DIRECTIVE_SYNTAX};if(e.length>2)return{kind:"error",message:`@meta takes a name and a value, got ${e.length} arguments`,code:t.INVALID_DIRECTIVE_SYNTAX};let r=Vt(e[0],n);if(typeof r!=="string")return r;let i;if(e.length===2){let o=Wt(e[1],n);if(typeof o!=="string")return o;i=o}else{let o=r.includes(":")?r.slice(r.indexOf(":")+1):r,c=n.openGraph,g=n[o]??(tt(c)?c[o]:void 0);i=g===void 0||g===null||typeof g==="object"?"":String(g)}if(!i)return{kind:"empty"};return{kind:"tag",tag:Ht.some((o)=>r.startsWith(o))?{property:r,content:i}:{name:r,content:i}}}function Vt(e,n){let r=ae(e);if(r!==null)return r.trim()?r:{kind:"error",message:"the meta name is empty",code:t.INVALID_DIRECTIVE_SYNTAX};if(Ut.test(e.trim()))return e.trim();let i=Lt(e,n);if(!i.ok)return{kind:"error",message:`meta name: ${i.message}`,code:i.code};if(typeof i.value!=="string"||!i.value.trim())return{kind:"error",message:`the meta name must be a non-empty string, got ${Le(i.value)}`,code:t.TYPE_ERROR};return i.value}function Wt(e,n){let r=ae(e);if(r!==null)return r;let i=Lt(e,n);if(!i.ok)return{kind:"error",message:i.message,code:i.code};let s=i.value;if(s===void 0||s===null||s===!1)return"";if(Array.isArray(s))return s.filter((o)=>o!==void 0&&o!==null&&o!=="").map(String).join(", ");if(typeof s==="object"&&!(s instanceof Date))return{kind:"error",message:`the content must be text, got ${Le(s)}`,code:t.TYPE_ERROR};return String(s)}var hr=["title","lang","meta","link","script","headRaw","htmlAttrs","bodyClass","bodyAttrs"],Ss=["title","titleTemplate","base","meta","link","script","style","htmlAttrs","bodyAttrs"],qe={links:"link",metas:"meta",scripts:"script",styles:"style"},We=new Set,Xe=new WeakMap;function fe(e){if(We.has(e))return;We.add(e),console.warn(e)}function Xt(e,n){let r=Array.from({length:n.length+1},(i,s)=>s);for(let i=1;i<=e.length;i++){let s=r[0];r[0]=i;for(let o=1;o<=n.length;o++){let c=r[o];r[o]=Math.min(r[o]+1,r[o-1]+1,s+(e[i-1]===n[o-1]?0:1)),s=c}}return r[n.length]}function qt(e,n){let r=e.toLowerCase(),i=n.find((f)=>f.toLowerCase()===r);if(i)return i;let s=qe[r];if(s&&n.includes(s))return s;let o,c=1/0;for(let f of n){let p=Xt(r,f.toLowerCase());if(p<c)o=f,c=p}let g=Math.min(e.length,o?.length??0)<=4?1:2;return c<=g?o:void 0}function ve(e,n){if(!e||typeof e!=="object"||Array.isArray(e))return e||{};let r=Xe.get(e);if(r)return r;let{known:i,source:s}=n,o=e;for(let c of Object.keys(e)){if(i.includes(c))continue;let g=qe[c];if(g&&i.includes(g)&&Array.isArray(e[c])){if(o===e)o={...e};let p=Array.isArray(o[g])?o[g]:[];o[g]=[...p,...e[c]],delete o[c],fe(`[stx] ${s}.${c} is not a head key; reading it as ${s}.${g}. Rename it to \`${g}\`.`);continue}if(/^styles?$/.test(c)&&!i.includes("style")){fe(`[stx] ${s}.${c} is not a head key and is ignored. Use \`link\` with rel: 'stylesheet', or \`headRaw\` for an inline <style>.`);continue}let f=qt(c,i);fe(f?`[stx] ${s}.${c} is not a head key and is ignored. Did you mean \`${f}\`?`:`[stx] ${s}.${c} is not a head key and is ignored. Known keys: ${i.join(", ")}.`)}return Xe.set(e,o),o}var A={},Kt=[],q={};function Wo(){return A}function Dp(){return q}function Mp(){A={},Kt.length=0,q={}}function oc(e){A=je(A,ve(e,{known:Ss,source:"useHead()"}))}function je(e,n){return{title:n.title??e.title,titleTemplate:n.titleTemplate??e.titleTemplate,base:n.base??e.base,meta:[...e.meta||[],...n.meta||[]],link:[...e.link||[],...n.link||[]],script:[...e.script||[],...n.script||[]],style:[...e.style||[],...n.style||[]],htmlAttrs:{...e.htmlAttrs,...n.htmlAttrs},bodyAttrs:{...e.bodyAttrs,...n.bodyAttrs}}}function cu(e){oc(ks(e))}function ks(e){let n=[];if(e.description)n.push({name:"description",content:e.description});if(e.keywords){let f=Array.isArray(e.keywords)?e.keywords.join(", "):e.keywords;n.push({name:"keywords",content:f})}if(e.author)n.push({name:"author",content:e.author});if(e.robots)n.push({name:"robots",content:e.robots});let r=e.ogTitle??e.title,i=e.ogDescription??e.description;if(r)n.push({property:"og:title",content:r});if(i)n.push({property:"og:description",content:i});if(e.ogImage){if(n.push({property:"og:image",content:e.ogImage}),e.ogImageType)n.push({property:"og:image:type",content:e.ogImageType});if(e.ogImageWidth)n.push({property:"og:image:width",content:String(e.ogImageWidth)});if(e.ogImageHeight)n.push({property:"og:image:height",content:String(e.ogImageHeight)});if(e.ogImageAlt)n.push({property:"og:image:alt",content:e.ogImageAlt})}if(e.ogUrl)n.push({property:"og:url",content:e.ogUrl});if(e.ogType)n.push({property:"og:type",content:e.ogType});if(e.ogSiteName)n.push({property:"og:site_name",content:e.ogSiteName});if(e.ogLocale)n.push({property:"og:locale",content:e.ogLocale});if(e.profileFirstName)n.push({property:"profile:first_name",content:e.profileFirstName});if(e.profileLastName)n.push({property:"profile:last_name",content:e.profileLastName});if(e.profileUsername)n.push({property:"profile:username",content:e.profileUsername});let s=e.twitterTitle??e.title,o=e.twitterDescription??e.description,c=e.twitterImage??e.ogImage;if(e.twitterCard)n.push({name:"twitter:card",content:e.twitterCard});if(s)n.push({name:"twitter:title",content:s});if(o)n.push({name:"twitter:description",content:o});if(c){n.push({name:"twitter:image",content:c});let f=e.twitterImageAlt??(e.twitterImage?void 0:e.ogImageAlt);if(f)n.push({name:"twitter:image:alt",content:f})}if(e.twitterSite)n.push({name:"twitter:site",content:e.twitterSite});if(e.twitterCreator)n.push({name:"twitter:creator",content:e.twitterCreator});if(e.articleAuthor)n.push({property:"article:author",content:e.articleAuthor});if(e.articlePublishedTime)n.push({property:"article:published_time",content:e.articlePublishedTime});if(e.articleModifiedTime)n.push({property:"article:modified_time",content:e.articleModifiedTime});if(e.articleSection)n.push({property:"article:section",content:e.articleSection});if(e.articleTags)for(let f of e.articleTags)n.push({property:"article:tag",content:f});let g=[];if(e.canonical)g.push({rel:"canonical",href:e.canonical});return{title:e.title,titleTemplate:e.titleTemplate,meta:n,link:g}}function Lp(e){if(q={...q,...e},e.title||e.description)cu({title:e.title,description:e.description})}function jp(e){let n=typeof e==="function"?e():e;oc({title:n})}function Bp(e=A){let n=[];if(e.title){let r=e.title;if(e.titleTemplate)r=typeof e.titleTemplate==="function"?e.titleTemplate(r):e.titleTemplate.replace("%s",r);n.push(`<title>${I(r)}</title>`)}if(e.base){let r=Object.entries(e.base).map(([i,s])=>`${i}="${I(s)}"`).join(" ");n.push(`<base ${r}>`)}for(let r of e.meta||[]){let i=Object.entries(r).filter(([s,o])=>o!==void 0).map(([s,o])=>`${s==="httpEquiv"?"http-equiv":s}="${I(String(o))}"`).join(" ");n.push(`<meta ${i}>`)}for(let r of e.link||[]){let i=Object.entries(r).filter(([s,o])=>o!==void 0).map(([s,o])=>`${s}="${I(String(o))}"`).join(" ");n.push(`<link ${i}>`)}for(let r of e.script||[]){let{content:i,...s}=r,o=Object.entries(s).filter(([c,g])=>g!==void 0).map(([c,g])=>{if(typeof g==="boolean")return g?c:"";return`${c}="${I(String(g))}"`}).filter(Boolean).join(" ");if(i)n.push(`<script ${o}>${X(r)}</script>`);else n.push(`<script ${o}></script>`)}for(let r of e.style||[]){let i=r.type?` type="${r.type}"`:"";n.push(`<style${i}>${r.content}</style>`)}return n.join(`
60
+ `)}function Fp(e=A){if(!e.htmlAttrs)return"";return Object.entries(e.htmlAttrs).map(([n,r])=>`${n}="${I(r)}"`).join(" ")}function zp(e=A){if(!e.bodyAttrs)return"";return Object.entries(e.bodyAttrs).map(([n,r])=>`${n}="${I(r)}"`).join(" ")}function I(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function Hp(e=A){if(typeof document>"u")return;if(e.title){let n=e.title;if(e.titleTemplate)n=typeof e.titleTemplate==="function"?e.titleTemplate(n):e.titleTemplate.replace("%s",n);document.title=n}for(let n of e.meta||[]){let r=n.name?`meta[name="${n.name}"]`:n.property?`meta[property="${n.property}"]`:null;if(r){let i=document.querySelector(r);if(!i){if(i=document.createElement("meta"),n.name)i.setAttribute("name",n.name);if(n.property)i.setAttribute("property",n.property);document.head.appendChild(i)}i.setAttribute("content",n.content)}}for(let n of e.link||[]){let r=`link[rel="${n.rel}"]${n.href?`[href="${n.href}"]`:""}`,i=document.querySelector(r);if(!i)i=document.createElement("link"),document.head.appendChild(i);for(let[s,o]of Object.entries(n))if(o!==void 0)i.setAttribute(s,String(o))}if(e.htmlAttrs)for(let[n,r]of Object.entries(e.htmlAttrs))if(n==="class")for(let i of String(r).split(/\s+/).filter(Boolean))document.documentElement.classList.add(i);else document.documentElement.setAttribute(n,r);if(e.bodyAttrs)for(let[n,r]of Object.entries(e.bodyAttrs))document.body.setAttribute(n,r)}function Vp(e){let n="";return{content:e.replace(/@head\s*([\s\S]*?)@endhead/g,(i,s)=>(n+=s.trim()+`
61
+ `,"")),headContent:n.trim()}}function Up(e,n){return e.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(r,i,s,o)=>{let c=i?s:n[(o||"").trim()]??o,g=n.__stx_runtime_head??{};return n.__stx_runtime_head=je(g,{title:c}),""})}function Wp(e,n,r=""){if(!e.includes("@meta"))return e;return Dt(e,/(?<![\w$@])@meta\s*\(/g,(i,s)=>{let o=mr(Mt(i),n);if(o.kind==="error")return P("Meta",s,o.message,r,o.code);if(o.kind==="tag"){let c=n.__stx_runtime_head??{};n.__stx_runtime_head=je(c,{meta:[o.tag]})}return""},(i)=>P("Meta",i,"the call has no closing parenthesis",r,t.INVALID_DIRECTIVE_SYNTAX))}export{bs,Fo,vs,l,d,Qa,C,et,Nt,u,ws,t,ne,ur,z,a,be,zo,D,hn,w,Ho,Dt,Mt,Lt,Le,tt,P,xs,Vo,ec,dr,pr,tc,nt,nc,fr,rc,yn,Uo,sc,gr,mr,hr,Ss,ve,Wo,Dp,Mp,oc,je,cu,ks,Lp,jp,Bp,Fp,zp,Hp,Vp,Up,Wp};
@@ -0,0 +1,4 @@
1
+ // @bun
2
+ import{Xe}from"./chunk-vgt9f7ac.js";import{pt,On}from"./chunk-fg3jw17w.js";import{Ae,cn,Xa,Ja}from"./chunk-w1v1d7rq.js";import{pr,fr,gr,hr,ve}from"./chunk-bk96wjaz.js";import{A}from"./chunk-5t4qtxgr.js";import{jo}from"./chunk-pdc9s7bg.js";import{h}from"./chunk-74pej67a.js";import{s}from"./chunk-dpjnjs09.js";import{N,i}from"./chunk-yfrvbnc6.js";import{wa}from"./chunk-04kg16qs.js";import{Fe,xe,$i,Ri,kn}from"./chunk-ma7d95f0.js";import{Zt,Ks}from"./chunk-myq3hrww.js";import{_n}from"./chunk-vqc4h16r.js";import{qt,jn,Bn}from"./chunk-xaa36b0x.js";import{V}from"./chunk-vac56rgd.js";import m from"fs";import c from"path";import{createHash as Q}from"crypto";function W(o){return Q("sha256").update(o).digest("hex").slice(0,8)}function J(o=!1){let l=o?On():pt(),a=W(l);return{content:l,filename:`runtime.${a}.js`,hash:a}}function U(){let o=Xe(),l=W(o);return{content:o,filename:`router.${l}.js`,hash:l}}import q from"path";import{createHash as ee}from"crypto";function te(o={}){let l=new Set;return{context:new Proxy(o,{get(r,e){if(e in r)return r[e];if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return},has(r,e){if(e in r)return!0;if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return!1}}),accessedKeys:l}}async function X(o,l,a={}){let r=q.resolve(o),e=await Bun.file(r).text(),S=ee("sha256").update(e).digest("hex").slice(0,16);Xa();let _={};try{_=await i(a.configDir)}catch{}let y=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,f;while((f=d.exec(e))!==null){let R=f[1];if(/\bserver\b/.test(R))y.push(f[2])}let u=new Set(y.flatMap((R)=>Ae(R))),{context:D}=te({__filename:r,__dirname:q.dirname(r),__stx_serverDeclared:u}),w=new Set,j={...N,..._,...a,buildMode:"compile",strict:!1},b=await s(e,D,r,j,w),C=Fe(b),P=Ja();return{route:l,sourceFile:o,html:b,fragment:C,placeholders:P,hasServerScripts:y.length>0,serverScriptContent:y,dependencies:Array.from(w),contentHash:S,status:cn(e),streamTemplates:D.__streamTemplates}}var re=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function Z(o,l){let a=0,r=0;if(!m.existsSync(o))return{copied:a,bytes:r};m.mkdirSync(l,{recursive:!0});function e(S,_){let y=m.readdirSync(S,{withFileTypes:!0});for(let d of y){if(re.has(d.name))continue;let f=c.join(S,d.name),u=c.join(_,d.name);if(d.isDirectory())m.mkdirSync(u,{recursive:!0}),e(f,u);else if(d.isFile()){if(m.existsSync(u))continue;m.copyFileSync(f,u),a++,r+=m.statSync(u).size}}}return e(o,l),{copied:a,bytes:r}}async function Mu(o={}){let l=Date.now(),a=c.resolve(o.root||process.cwd()),r=c.resolve(a,o.outputDir||".output");console.log("[stx build] Starting production build...");let e=await i(a),S=c.resolve(a,o.componentsDir??e.componentsDir??"components"),_=c.resolve(a,o.partialsDir??e.partialsDir??"partials"),y=c.resolve(a,o.layoutsDir??e.layoutsDir??"layouts"),d=o.publicDir??e.publicDir??"public",f=ve(e.app?.head,{known:hr,source:"app.head"}),u=e.app?.colorMode,D=e.router?.container||"main",w=o.routeRules??e.routeRules??{},j=_n(w),b=o.serverApi??e.serverApi,C=typeof b==="object"?b:{};if(b)Zt(a,C);if(e.runtimeConfig)A(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let P=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let n of P)m.mkdirSync(n,{recursive:!0});console.log("[stx build] Discovering routes...");let R=V(a,{pagesDirs:e._layerPageDirs}),Y=["components","layouts","partials"],B=R.filter((n)=>!Y.some((g)=>n.pattern.startsWith(`/${g}/`)||n.pattern===`/${g}`));console.log(`[stx build] Found ${B.length} page routes (${R.length-B.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let v=J(o.debug),x=U();await Bun.write(c.join(r,"public","__stx",v.filename),v.content),await Bun.write(c.join(r,"public","__stx",x.filename),x.content),console.log(`[stx build] Runtime: ${v.filename} (${(v.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${x.filename} (${(x.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let M=[],k=[];for(let n of B){let g=j(n.pattern),O=g.rendering==="prerender";if(O&&(n.pattern.includes(":")||n.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${n.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await X(n.filePath,n.pattern,{configDir:a,componentsDir:S,partialsDir:_,layoutsDir:y,debug:o.debug});if(M.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,v.filename).replace(/router\.__STX_HASH__\.js/g,x.filename),t.html=gr(t.html,f,{bodyScripts:[`<script src="/__stx/${x.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=pr(t.html,u);if(f.htmlAttrs)t.html=fr(t.html,f.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(t.html)){let p=t.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(p&&p[1]){let I=p[1];t.html=t.html.replace(" "+I,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${I}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await h(t.html),O){let p=await kn(t,{params:{},request:new Request(`http://stx.build${n.pattern}`),method:"GET",__stx_strict_hydration:!0});if(p.redirect||p.cookies?.length||p.boundaries?.length||p.headers&&Object.keys(p.headers).length)throw Error(`Prerendered route ${n.pattern} cannot set response headers/cookies, redirect or stream`);t.html=p.html,t.status=p.status??t.status,t.hasServerScripts=!1,t.serverScriptContent=[],t.placeholders={}}t.fragment=xe(t.html,D);let L=n.pattern==="/"?"index":n.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),z=c.join("server","pages",`${L}.compiled.json`),G=c.join("server","fragments",`${L}.html`);await Bun.write(c.join(r,z),JSON.stringify(t,null,2)),await Bun.write(c.join(r,G),t.fragment),k.push({pattern:n.pattern,compiledPath:z,fragmentPath:G,isDynamic:t.hasServerScripts,hasParams:n.pattern.includes(":")||n.pattern.includes("["),prerendered:O}),console.log(`[stx build] \u2713 ${n.pattern}`)}catch(t){if(Object.keys(g).length)throw t;console.error(`[stx build] \u2717 ${n.pattern}:`,t instanceof Error?t.message:t)}}let E=c.resolve(a,d);if(m.existsSync(E)){let{copied:n,bytes:g}=Z(E,c.join(r,"public"));if(n>0)console.log(`[stx build] Copied ${n} public asset${n===1?"":"s"} (${(g/1024).toFixed(1)}KB) from ${d}/`)}let H=Bn(a);if(H){let{copied:n,bytes:g}=Z(H,c.join(r,"public",jn));if(n>0)console.log(`[stx build] Copied ${n} asset${n===1?"":"s"} (${(g/1024).toFixed(1)}KB) from ${qt}/`)}let F={runtime:v.filename,router:x.filename},T=$i(k,F,r);if(T.routeRules=w,T.routerContainer=D,b)T.apiRoutes=await Ks(a,r,C);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await jo(a,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(wa(e._layerGraph),null,2));Ri(T,r);let K=Date.now()-l;return console.log(`
3
+ [stx build] Done in ${K}ms \u2014 ${M.length} pages compiled`),{pageCount:M.length,assets:F,outputDir:r,duration:K}}
4
+ export{Mu};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Os,bi,Cr,Ns,Ds,Sn,Vt,vi,Er,Tr,Ms,Ls,Ru,Au,ct}from"./chunk-rjh2jwxx.js";export{ct as DeployError,bi as calculateSha1,Cr as collectDeployFiles,Tr as createDefaultNetlifyConfig,Ns as createFileManifest,Os as createNetlifyClient,Ru as deploy,Er as detectProjectConfig,Ds as filterRequiredFiles,Sn as formatSize,vi as generateNetlifyToml,Vt as getTotalSize,Ls as hasNetlifyConfig,Au as initNetlify,Ms as writeNetlifyConfig};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- function I(s){let o=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;s=s.replace(o,(e,t)=>`const { ${t.split(",").map((r)=>r.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
2
+ function T(s){let o=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;s=s.replace(o,(e,t)=>`const { ${t.split(",").map((r)=>r.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
3
3
  `);let n=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return s=s.replace(n,(e,t)=>`const { ${t.split(",").map((r)=>r.trim()).filter(Boolean).join(", ")} } = window.__composables
4
- `),s}function qt(s){return s.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}
5
- export{I,qt};
4
+ `),s}function vn(s){return s.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}
5
+ export{T,vn};