@stacksjs/stx 0.2.875 → 0.2.880

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 (276) hide show
  1. package/dist/{chunk-fdjx4vs3.js → chunk-00tq7ghn.js} +2 -2
  2. package/dist/{chunk-nv4c25zj.js → chunk-02qmvcmv.js} +3 -3
  3. package/dist/chunk-08cb7cyw.js +2 -0
  4. package/dist/chunk-0h1dyd38.js +2 -0
  5. package/dist/{chunk-4m11kcxz.js → chunk-0m4c42qt.js} +10 -10
  6. package/dist/{chunk-6ykfy7eh.js → chunk-19k15mfc.js} +2 -2
  7. package/dist/chunk-1avy0p8v.js +2 -0
  8. package/dist/chunk-1jk46ve0.js +2 -0
  9. package/dist/chunk-1r612xxs.js +2 -0
  10. package/dist/chunk-1z6rrqvm.js +2 -0
  11. package/dist/chunk-2d68p12e.js +2 -0
  12. package/dist/chunk-2haf7t5h.js +2 -0
  13. package/dist/{chunk-1q5w3xav.js → chunk-2r0nrvqe.js} +2 -2
  14. package/dist/chunk-3jp5z1qj.js +2 -0
  15. package/dist/{chunk-644ckv6e.js → chunk-3q0w0bzd.js} +10 -10
  16. package/dist/{chunk-eknm4jrm.js → chunk-3sema2js.js} +2 -2
  17. package/dist/{chunk-vznf808n.js → chunk-3wb82rxw.js} +5 -5
  18. package/dist/chunk-3zds0gmd.js +2 -0
  19. package/dist/{chunk-qnwd5bz4.js → chunk-463weehv.js} +1 -1
  20. package/dist/{chunk-wm029dh0.js → chunk-4fkcn6z5.js} +18 -12
  21. package/dist/{chunk-976kgb3r.js → chunk-4n45qa0b.js} +9 -9
  22. package/dist/chunk-4pjqj54a.js +2 -0
  23. package/dist/{chunk-9anqwafq.js → chunk-4r2rfdmr.js} +5 -5
  24. package/dist/{chunk-ft6em3wm.js → chunk-50cnypys.js} +6 -6
  25. package/dist/chunk-53cc06w7.js +2 -0
  26. package/dist/{chunk-y2e2zm6y.js → chunk-57q4nvs9.js} +3 -3
  27. package/dist/{chunk-3mz9bdf7.js → chunk-59er0fc7.js} +3 -3
  28. package/dist/{chunk-dw0ttj6p.js → chunk-5eftxrvv.js} +2 -2
  29. package/dist/chunk-5p3825qw.js +2 -0
  30. package/dist/chunk-5rd0an89.js +2 -0
  31. package/dist/{chunk-pk714ynv.js → chunk-69ezjc8k.js} +4 -4
  32. package/dist/{chunk-75v0yxeh.js → chunk-6c1vm6bs.js} +2 -2
  33. package/dist/{chunk-d3q0cg47.js → chunk-6df3j3qq.js} +3 -3
  34. package/dist/{chunk-kzc2tqzr.js → chunk-6t04tqvh.js} +2 -2
  35. package/dist/chunk-78zgmqhd.js +2 -0
  36. package/dist/chunk-7bsrnpmh.js +33 -0
  37. package/dist/chunk-7dq6ebvp.js +2 -0
  38. package/dist/chunk-7kqgp3p7.js +2 -0
  39. package/dist/{chunk-wzvdr4ta.js → chunk-7mcs59pr.js} +2 -2
  40. package/dist/chunk-83b9k17j.js +2 -0
  41. package/dist/chunk-86nsbxep.js +61 -0
  42. package/dist/{chunk-0g2mg8cw.js → chunk-8e1cv1hh.js} +3 -3
  43. package/dist/chunk-8h5nje66.js +2 -0
  44. package/dist/{chunk-ae8q4gze.js → chunk-8va3fs07.js} +5 -5
  45. package/dist/{chunk-fnjm3xbf.js → chunk-93jhfbeg.js} +6 -6
  46. package/dist/{chunk-xmws1gaf.js → chunk-94ctmp0j.js} +2 -2
  47. package/dist/chunk-97kgrevs.js +4 -0
  48. package/dist/{chunk-qvrew79n.js → chunk-9cbf0seq.js} +2 -2
  49. package/dist/{chunk-mce3g2wb.js → chunk-9f31gs4m.js} +2 -2
  50. package/dist/chunk-9kza7gxd.js +2 -0
  51. package/dist/{chunk-b4d4tjvx.js → chunk-a0q0kb0s.js} +5 -5
  52. package/dist/chunk-a5gnxdfe.js +2 -0
  53. package/dist/chunk-a60ztvnp.js +3 -0
  54. package/dist/{chunk-s7fhpkvf.js → chunk-a7ryj8z8.js} +6 -6
  55. package/dist/{chunk-gqtb53s8.js → chunk-aaea157p.js} +2 -2
  56. package/dist/{chunk-wp0qpa50.js → chunk-agd2b928.js} +59 -27
  57. package/dist/chunk-aqxh80vh.js +2 -0
  58. package/dist/{chunk-az5rh7fs.js → chunk-awp8a3t4.js} +2 -2
  59. package/dist/chunk-axra1yas.js +2 -0
  60. package/dist/chunk-az8b0726.js +21 -0
  61. package/dist/chunk-b7d3n4aw.js +2 -0
  62. package/dist/{chunk-r2bxjna3.js → chunk-c0g30cjs.js} +2 -2
  63. package/dist/{chunk-jt5tzddc.js → chunk-c73c0wf9.js} +2 -2
  64. package/dist/{chunk-88xayf21.js → chunk-cad7e5q1.js} +9 -9
  65. package/dist/{chunk-bjjfr7qt.js → chunk-care745q.js} +2 -2
  66. package/dist/chunk-ce0zbpr5.js +2 -0
  67. package/dist/chunk-cjv89tnb.js +20 -0
  68. package/dist/chunk-cv1vm1w0.js +2 -0
  69. package/dist/{chunk-mw0rb1sf.js → chunk-czcx3nbx.js} +6 -6
  70. package/dist/chunk-d7b30bg6.js +2 -0
  71. package/dist/{chunk-stn7p7f1.js → chunk-dwyhpbpx.js} +2 -2
  72. package/dist/{chunk-y75bds1g.js → chunk-e362e615.js} +30 -30
  73. package/dist/{chunk-ydppkb8y.js → chunk-e41pgmgk.js} +2 -2
  74. package/dist/{chunk-6az66mrc.js → chunk-ec5q4nnw.js} +66 -66
  75. package/dist/{chunk-0h6r7nvn.js → chunk-egjmb32c.js} +126 -71
  76. package/dist/{chunk-q7zc78az.js → chunk-ew3vs3jq.js} +8 -8
  77. package/dist/{chunk-jqxerj6k.js → chunk-ezna4dhj.js} +2 -2
  78. package/dist/chunk-f3j1h3ch.js +2 -0
  79. package/dist/{chunk-vmssv78v.js → chunk-f7znj9xg.js} +3 -3
  80. package/dist/chunk-fz4c5e9m.js +2 -0
  81. package/dist/{chunk-esjr9qhe.js → chunk-g2xy0z0e.js} +2 -2
  82. package/dist/{chunk-fy6ts0n4.js → chunk-g83ph305.js} +2 -2
  83. package/dist/{chunk-kywe0f1v.js → chunk-gbncp2gp.js} +2 -2
  84. package/dist/chunk-gm67jt8p.js +2 -0
  85. package/dist/chunk-gmp10259.js +2 -0
  86. package/dist/{chunk-0sa9gqmc.js → chunk-h2tq6cbr.js} +11 -11
  87. package/dist/chunk-h3fv0q25.js +2 -0
  88. package/dist/{chunk-r09kz9bf.js → chunk-h63ma36g.js} +2 -2
  89. package/dist/chunk-hkx51atf.js +2 -0
  90. package/dist/{chunk-95hbmv7k.js → chunk-hmntqqyd.js} +7 -7
  91. package/dist/{chunk-3w7gacva.js → chunk-hxhmhw23.js} +3 -3
  92. package/dist/chunk-jghpzx5m.js +2 -0
  93. package/dist/chunk-k206d3pn.js +2 -0
  94. package/dist/chunk-k40e0ete.js +4 -0
  95. package/dist/chunk-k6c5t9we.js +38 -0
  96. package/dist/{chunk-f4vgagjb.js → chunk-kee5a3ce.js} +3 -3
  97. package/dist/chunk-kn9tqjgv.js +25 -0
  98. package/dist/chunk-kna1bdm2.js +54 -0
  99. package/dist/{chunk-a5yb8w7s.js → chunk-mygsektn.js} +3 -3
  100. package/dist/chunk-nb6erf75.js +9 -0
  101. package/dist/chunk-ngzyzcrp.js +2 -0
  102. package/dist/{chunk-3f9wctns.js → chunk-nysbdr4r.js} +2 -2
  103. package/dist/chunk-p55a910x.js +1198 -0
  104. package/dist/chunk-p6hcrg3r.js +3 -0
  105. package/dist/chunk-p746twww.js +2 -0
  106. package/dist/chunk-pa2vt2ej.js +2 -0
  107. package/dist/chunk-pa6kgbmw.js +2 -0
  108. package/dist/{chunk-saqzk45g.js → chunk-pdprhg5k.js} +1 -1
  109. package/dist/chunk-pjjrx9pk.js +2 -0
  110. package/dist/{chunk-g7qpnmbm.js → chunk-pm4rpc4a.js} +23 -23
  111. package/dist/chunk-pt3rp3zg.js +2 -0
  112. package/dist/{chunk-4517hny7.js → chunk-q1mb0fbt.js} +2 -2
  113. package/dist/{chunk-k1ew643q.js → chunk-q74affc4.js} +2 -2
  114. package/dist/chunk-qd9v1v8z.js +2 -0
  115. package/dist/chunk-qfwk93fk.js +2 -0
  116. package/dist/chunk-qg1kw5yf.js +2 -0
  117. package/dist/chunk-qn6y5ttj.js +2 -0
  118. package/dist/chunk-qxcc0aar.js +2 -0
  119. package/dist/{chunk-rzd9hyhv.js → chunk-ram5944w.js} +2 -2
  120. package/dist/{chunk-p5m1z6e1.js → chunk-rcxer2km.js} +4 -4
  121. package/dist/chunk-rdxph1tp.js +2 -0
  122. package/dist/chunk-rnrdngnn.js +2 -0
  123. package/dist/{chunk-x2ftkaz3.js → chunk-rsxxajv6.js} +2 -2
  124. package/dist/chunk-rw5sxr5a.js +2 -0
  125. package/dist/chunk-rzcdwybt.js +26 -0
  126. package/dist/chunk-s29hp1qw.js +14 -0
  127. package/dist/chunk-s7xywsqd.js +3 -0
  128. package/dist/{chunk-d6gqh2wv.js → chunk-satrf398.js} +1 -1
  129. package/dist/{chunk-zn6n075d.js → chunk-shcnt6aa.js} +3 -3
  130. package/dist/{chunk-ysfgabpf.js → chunk-sn4ndpd7.js} +3 -3
  131. package/dist/{chunk-zc8a2erc.js → chunk-ssg6ne5b.js} +4 -4
  132. package/dist/{chunk-afxfkb60.js → chunk-sv7fdqmc.js} +6 -6
  133. package/dist/chunk-swz0xprw.js +2 -0
  134. package/dist/chunk-t8r40wgf.js +2 -0
  135. package/dist/{chunk-dbvsa5ya.js → chunk-t94y8g35.js} +2 -2
  136. package/dist/{chunk-g33ycxe3.js → chunk-t9hxyvvc.js} +5 -5
  137. package/dist/{chunk-cmh0bfkb.js → chunk-tgzs1kbj.js} +5 -5
  138. package/dist/chunk-tka73egx.js +2 -0
  139. package/dist/{chunk-xtaq95em.js → chunk-v1s838fe.js} +1 -1
  140. package/dist/chunk-v3747589.js +12 -0
  141. package/dist/chunk-v9h2bbhf.js +2 -0
  142. package/dist/chunk-v9mxhch2.js +2 -0
  143. package/dist/chunk-vm42j29z.js +2 -0
  144. package/dist/chunk-w2kdhm7k.js +2 -0
  145. package/dist/chunk-w5zzwe2f.js +2 -0
  146. package/dist/chunk-wbmx0rge.js +2 -0
  147. package/dist/chunk-wjafpvjv.js +2 -0
  148. package/dist/chunk-ws2h92mm.js +3 -0
  149. package/dist/chunk-ws9kr80x.js +2 -0
  150. package/dist/{chunk-45rzd16g.js → chunk-xf0xacc9.js} +44 -44
  151. package/dist/chunk-xhr35ctb.js +2 -0
  152. package/dist/chunk-xmmr0916.js +2 -0
  153. package/dist/{chunk-yxdhz4ps.js → chunk-xpbakn6t.js} +2 -2
  154. package/dist/chunk-xz4v9tg1.js +3 -0
  155. package/dist/chunk-y7e61pz3.js +3 -0
  156. package/dist/{chunk-v0tdg16k.js → chunk-ybjgnnyf.js} +5 -5
  157. package/dist/chunk-yh2hnt3m.js +12 -0
  158. package/dist/{chunk-w6pzkcjp.js → chunk-ymqm898x.js} +2 -2
  159. package/dist/{chunk-2zaatnnh.js → chunk-yp4tn4zn.js} +4 -4
  160. package/dist/chunk-z7k1xn6k.js +2 -0
  161. package/dist/{chunk-t4g3ka8c.js → chunk-z9ffr9gy.js} +7 -7
  162. package/dist/{chunk-nnp6rf4c.js → chunk-zch65qrd.js} +1 -1
  163. package/dist/{chunk-pbakxcv8.js → chunk-zek9t5za.js} +2 -2
  164. package/dist/cli.js +23 -23
  165. package/dist/client/signals-dom-ready-runtime.js +6 -0
  166. package/dist/client/signals-mount-runtime.js +1 -1
  167. package/dist/client-module-registry.js +10 -4
  168. package/dist/client-parameter-bindings.d.ts +5 -0
  169. package/dist/client-parameter-bindings.js +47 -6
  170. package/dist/client-script-bundler.js +4 -3
  171. package/dist/component-library.d.ts +1 -0
  172. package/dist/component-library.js +42 -14
  173. package/dist/composable-loader.js +19 -9
  174. package/dist/craft-entry.js +2 -2
  175. package/dist/craft.js +2 -2
  176. package/dist/html-masking.d.ts +2 -0
  177. package/dist/html-masking.js +10 -0
  178. package/dist/inherited-context.d.ts +1 -1
  179. package/dist/inherited-context.js +43 -14
  180. package/dist/module-syntax.d.ts +2 -0
  181. package/dist/module-syntax.js +21 -0
  182. package/dist/native-component-context.js +44 -17
  183. package/dist/page-module-order.d.ts +10 -0
  184. package/dist/page-module-order.js +139 -0
  185. package/dist/process.js +6 -4
  186. package/dist/pwa.js +3 -3
  187. package/dist/script-attributes.d.ts +4 -0
  188. package/dist/script-attributes.js +10 -0
  189. package/dist/ssg.js +39 -39
  190. package/dist/strip-literals.d.ts +2 -0
  191. package/dist/strip-literals.js +12 -6
  192. package/dist/stx-virtual-ts.d.ts +1 -0
  193. package/dist/stx-virtual-ts.js +21 -27
  194. package/dist/typecheck.js +8 -0
  195. package/package.json +5 -5
  196. package/dist/chunk-003ph86a.js +0 -2
  197. package/dist/chunk-027meh1k.js +0 -2
  198. package/dist/chunk-0bc3mwqd.js +0 -2
  199. package/dist/chunk-0gv2mmr0.js +0 -2
  200. package/dist/chunk-0j8zre1m.js +0 -2
  201. package/dist/chunk-0qwbhv3f.js +0 -33
  202. package/dist/chunk-1gfg6qmr.js +0 -2
  203. package/dist/chunk-1tqp2s13.js +0 -2
  204. package/dist/chunk-1y7kfp5d.js +0 -2
  205. package/dist/chunk-1ztp5vkh.js +0 -3
  206. package/dist/chunk-24e4dapm.js +0 -2
  207. package/dist/chunk-2qb9kp21.js +0 -25
  208. package/dist/chunk-32wvc376.js +0 -2
  209. package/dist/chunk-3te2y9qf.js +0 -2
  210. package/dist/chunk-447jc6zc.js +0 -2
  211. package/dist/chunk-51ymssz5.js +0 -2
  212. package/dist/chunk-6dz5za5z.js +0 -2
  213. package/dist/chunk-6ezt9kbe.js +0 -54
  214. package/dist/chunk-6grkdknk.js +0 -2
  215. package/dist/chunk-6q9a5bph.js +0 -2
  216. package/dist/chunk-6rqef7wp.js +0 -2
  217. package/dist/chunk-72p5annm.js +0 -33
  218. package/dist/chunk-74x6j229.js +0 -4
  219. package/dist/chunk-7j11vgm1.js +0 -3
  220. package/dist/chunk-7ngfcdv9.js +0 -2
  221. package/dist/chunk-7njy024g.js +0 -2
  222. package/dist/chunk-9e3ggwk7.js +0 -2
  223. package/dist/chunk-9mz2n39m.js +0 -2
  224. package/dist/chunk-a262spx7.js +0 -2
  225. package/dist/chunk-a8wn0snv.js +0 -2
  226. package/dist/chunk-af6m1s2b.js +0 -3
  227. package/dist/chunk-b1tcym2x.js +0 -2
  228. package/dist/chunk-b61dq7pz.js +0 -12
  229. package/dist/chunk-bdh73gxd.js +0 -4
  230. package/dist/chunk-bs7g6jtt.js +0 -2
  231. package/dist/chunk-bspj1rf1.js +0 -2
  232. package/dist/chunk-bx3hpsxn.js +0 -2
  233. package/dist/chunk-byq488g4.js +0 -2
  234. package/dist/chunk-c8pzj57b.js +0 -2
  235. package/dist/chunk-e2b2f502.js +0 -2
  236. package/dist/chunk-ec6mrad6.js +0 -2
  237. package/dist/chunk-eh2gec79.js +0 -2
  238. package/dist/chunk-em31p5pb.js +0 -2
  239. package/dist/chunk-eqfsw6x4.js +0 -2
  240. package/dist/chunk-ey1vwfpc.js +0 -24
  241. package/dist/chunk-fa57bncd.js +0 -2
  242. package/dist/chunk-fk79jbzn.js +0 -2
  243. package/dist/chunk-g97krv0d.js +0 -2
  244. package/dist/chunk-gn16yq49.js +0 -2
  245. package/dist/chunk-gvs61tqn.js +0 -2
  246. package/dist/chunk-h2928108.js +0 -2
  247. package/dist/chunk-hd5bny2c.js +0 -2
  248. package/dist/chunk-j1ytbd6r.js +0 -1184
  249. package/dist/chunk-jm7qa3v3.js +0 -2
  250. package/dist/chunk-jmjgj3nh.js +0 -2
  251. package/dist/chunk-jqtpzzz4.js +0 -12
  252. package/dist/chunk-kq8mffgf.js +0 -2
  253. package/dist/chunk-kx06jzdw.js +0 -2
  254. package/dist/chunk-n344ss97.js +0 -2
  255. package/dist/chunk-n5pvdrkb.js +0 -2
  256. package/dist/chunk-ne8q191s.js +0 -2
  257. package/dist/chunk-np8wgbsa.js +0 -3
  258. package/dist/chunk-p4e8myzj.js +0 -17
  259. package/dist/chunk-pp99rmjm.js +0 -72
  260. package/dist/chunk-pqmjeea6.js +0 -2
  261. package/dist/chunk-q0k2gmva.js +0 -2
  262. package/dist/chunk-qggwr60r.js +0 -2
  263. package/dist/chunk-qm3v4qb7.js +0 -2
  264. package/dist/chunk-qrn1nza9.js +0 -2
  265. package/dist/chunk-qty0t69x.js +0 -2
  266. package/dist/chunk-rzadf7vx.js +0 -20
  267. package/dist/chunk-snz2cxqv.js +0 -2
  268. package/dist/chunk-ts37jw3s.js +0 -2
  269. package/dist/chunk-vnrbjbrw.js +0 -3
  270. package/dist/chunk-wkb7dhp7.js +0 -2
  271. package/dist/chunk-wxyqp6g9.js +0 -2
  272. package/dist/chunk-x76qvq1n.js +0 -2
  273. package/dist/chunk-y4hn1qh0.js +0 -2
  274. package/dist/chunk-yc8ggeh2.js +0 -2
  275. package/dist/chunk-ydy0tfar.js +0 -2
  276. package/dist/chunk-yfed67yc.js +0 -2
@@ -0,0 +1,1198 @@
1
+ // @bun
2
+ import{Ye,Nn,ao,Ui,F}from"./chunk-6t04tqvh.js";import{On}from"./chunk-19k15mfc.js";import{Kr,E,Ll,wt,Qi,jl}from"./chunk-00tq7ghn.js";import{M}from"./chunk-hxhmhw23.js";import{T,R}from"./chunk-s29hp1qw.js";import{qr,mo,Zi,Nl,De}from"./chunk-a60ztvnp.js";import{co,d,m,Xt,p,ee,q,k,fo,Me,Qe,go}from"./chunk-86nsbxep.js";import{b}from"./chunk-94mpe1ny.js";import{te}from"./chunk-ws2h92mm.js";import{t,C}from"./chunk-yh2hnt3m.js";import{c}from"./chunk-xpbakn6t.js";import St from"path";import on from"process";import{AsyncLocalStorage as Ua}from"async_hooks";var Jr=new Ua;function $n(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function Xr(e,n){return Jr.run($n(e),n)}async function Gr(e,n){let r=Jr.getStore();if(!r)throw Error("useServerData must run inside a <script server> render");if(typeof e!=="string"||!e.trim())throw TypeError("useServerData requires a non-empty string key");let i=r.pending.get(e);if(i)return i;let a=Promise.resolve().then(n).then((l)=>{let u=JSON.stringify(l,(x,v)=>{if(v===void 0||typeof v==="function"||typeof v==="symbol"||typeof v==="bigint"||typeof v==="number"&&!Number.isFinite(v))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(v&&typeof v==="object"&&!Array.isArray(v)&&Object.getPrototypeOf(v)!==Object.prototype&&Object.getPrototypeOf(v)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return v}),f=JSON.parse(u);return r.values.set(e,f),f}).catch((l)=>{throw r.pending.delete(e),l});return r.pending.set(e,a),a}function Lr(e){let n=e.__stx_server_data;if(!n?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(n.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function G(e,n=!1){let r=t(e),i=[],a=new Set,l=0,u=0,f=r.length,x=()=>{if(l!==0)return;let v=r.slice(u).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(v){if(n&&v[1]==="const")return;let z=v[2];if(!a.has(z))i.push(z),a.add(z);return}let I=r.slice(u).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(I){if(n&&r.slice(u).startsWith("const"))return;I[1].split(",").forEach((z)=>{let N=z.trim();if(!N)return;let H=N.indexOf(":"),U=(H>=0?N.slice(H+1).trim():N).split(/[\s=]/)[0];if(U&&!a.has(U))i.push(U),a.add(U)});return}let D=r.slice(u).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(D){if(n&&r.slice(u).startsWith("const"))return;D[1].split(",").forEach((z)=>{let N=z.trim().replace(/^\.\.\./,"");if(!N)return;let H=N.split(/[\s=]/)[0];if(H&&!a.has(H))i.push(H),a.add(H)});return}if(n)return;let W=r.slice(u).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(W){let z=W[1];if(!a.has(z))i.push(z),a.add(z);return}let L=r.slice(u).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let z=L[1];if(!a.has(z))i.push(z),a.add(z)}};while(u<f){if(r[u]==="{"){l++,u++;continue}if(r[u]==="}"){l--,u++;continue}if(l===0&&/[a-z]/i.test(r[u])&&(u===0||/\s|[;{}()]/.test(r[u-1])))x();u++}return i.join(", ")}function Ws(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function Ha(e,n=G(e).split(",").map((r)=>r.trim()).filter(Boolean)){let r=new Set(G(e,!0).split(",").map((i)=>i.trim()));return n.map((i)=>r.has(i)?`get ${i}() { return ${i} }, set ${i}(__stxValue_${i}) { ${i} = __stxValue_${i} }`:i).join(", ")}function qs(e,n){let r=`{ ${Ha(e,n)} }`;return G(e).split(",").some((i)=>i.trim()==="__stxLiveBindings")?`Object.defineProperties(${r}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:r}import en from"fs";import ze from"path";function X(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var Yr=new Map;function Ar(e,n=!0){let r=Yr.get(e);if(n&&r)return r;let i=new Map,a=[ze.join(e,"src"),ze.join(e,"dist"),e];function l(u,f){if(f>6)return;let x;try{x=en.readdirSync(u,{withFileTypes:!0})}catch{return}for(let v of x){let I=ze.join(u,v.name);if(v.isDirectory()){if(v.name==="node_modules"||v.name.startsWith("."))continue;l(I,f+1)}else if(v.isFile()&&v.name.endsWith(".stx")){let D=v.name.slice(0,-4);if(!i.has(D))i.set(D,I);let W=D.toLowerCase();if(!i.has(W))i.set(W,I);let L=X(D);if(!i.has(L))i.set(L,I)}}}for(let u of a)if(l(u,0),i.size>0)break;if(n)Yr.set(e,i);return i}function Ks(e,n){if(e.startsWith(".")||e.startsWith("/"))return null;let r=n;while(!0){let i=ze.join(r,"node_modules",e);try{if(en.statSync(i).isDirectory())return i}catch{}let a=ze.dirname(r);if(a===r)return null;r=a}}function Gs(e,n,r={}){return[ze.resolve(ze.dirname(n),`${e}.stx`),ze.resolve(ze.dirname(n),e),ze.resolve(r.componentsDir||"components",`${e}.stx`),ze.resolve(r.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function Qr(e){let n=e.endsWith(".stx")?e.slice(0,-4):e,r=n.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),i=X(n);return[n,r,i]}function _i(e,n){let[r,i,a]=Qr(e);for(let l of[r,r.toLowerCase(),i,a]){let u=n?.__importedComponents?.get(l);if(u!==void 0)return u}}function Ci(e,n){let r=n?ze.resolve(n):void 0,i=ze.dirname(ze.resolve(e));for(;;){if(en.existsSync(ze.join(i,"package.json")))return r&&i===r?void 0:i;let a=ze.dirname(i);if(a===i)return;i=a}}var Ka=["src/ui","src/components","components","dist"];function Qn(e,n){let r=ze.resolve(e);if(!n&&!r.split(ze.sep).includes("node_modules"))return[];let i=Ci(r,n);if(!i)return[];let a=[];try{let f=JSON.parse(en.readFileSync(ze.join(i,"package.json"),"utf8")).stx?.components;if(Array.isArray(f))a=f.filter((x)=>typeof x==="string")}catch{}let l=a.length?a:Ka;return[ze.dirname(ze.resolve(e)),...l.map((u)=>ze.resolve(i,u))]}function*Ei(e,n,r={},i){let a=Qr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield ze.resolve(ze.dirname(n),`${a[0]}.stx`);return}let l=[...new Set(a.map((x)=>`${x}.stx`))],u=r.projectRoot||process.cwd(),f=[...Qn(n,r.projectRoot),...i?.__originalFilePath?[ze.join(ze.dirname(i.__originalFilePath),"components")]:[],...r.componentsDir?[r.componentsDir]:[],ze.join(ze.dirname(n),"components"),ze.resolve(u,"src/components"),ze.resolve(u,"components"),...import.meta.dir?[ze.resolve(import.meta.dir,"components")]:[]];for(let x of new Set(f)){for(let v of l)yield ze.join(x,v);try{for(let v of en.readdirSync(x,{withFileTypes:!0}))if(v.isDirectory())for(let I of l)yield ze.join(x,v.name,I)}catch{}}}function ei(e,n,r={},i){let a=_i(e,i);if(a!==void 0)return a;for(let l of Ei(e,n,r,i))try{if(en.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}function Xs(e,n=[],r={}){let i=new Set([...e].map((v)=>v.replace(/[-_]/g,"").toLowerCase()));if(!i.has("src")&&!i.has("source")||!i.has("alt")&&!i.has("decorative"))return!1;let a=new Map(Object.entries(r).map(([v,I])=>[v.replace(/[-_]/g,"").toLowerCase(),I])),l=a.get("alt"),u=a.get("decorative"),f=typeof l==="string"&&!!l.trim(),x=typeof u==="string"?!["false","0","off","no"].includes(u.trim().toLowerCase()):Boolean(u);if(!f&&!x)return!1;if(["defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((v)=>i.has(v)))return!1;if([...n].some((v)=>!["load","error"].includes(v.replace(/^@/,"").split(".")[0].toLowerCase())))return!1;if(i.has("resizemode")&&(i.has("fit")||i.has("objectfit")))return!1;if(i.has("src")&&i.has("source"))return!1;return["fit","objectfit","resizemode","position","objectposition","rounded","aspectratio","zoomonhover","sources","webpsrc","webpsrcset"].some((v)=>i.has(v))}import Ss from"fs";import fe from"path";import Dt from"path";import hn from"fs";var qa=new Set(["touchstart","touchmove","wheel","mousewheel"]);function Ms(e,n){if(n.passive)return!0;if(n.prevent||n.nonpassive)return!1;return qa.has(e.toLowerCase())}var ti=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","wheel","keydown","keyup","keypress","submit","reset","change","input","focus","blur","focusin","focusout","select","invalid","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","resize","load","error","abort","animationstart","animationend","animationiteration","transitionstart","transitionend","transitionrun","transitioncancel","mounted","unmounted"]),ni={enter:"Enter",tab:"Tab",delete:"Delete",backspace:"Backspace",esc:"Escape",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"},Za=new Set(["ctrl","alt","shift","meta"]),ii={left:0,middle:1,right:2};function si(e){let n={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let r of e){let i=r.toLowerCase();if(i==="prevent")n.prevent=!0;else if(i==="stop")n.stop=!0;else if(i==="once")n.once=!0;else if(i==="capture")n.capture=!0;else if(i==="self")n.self=!0;else if(i==="passive")n.passive=!0;else if(i==="nonpassive")n.nonpassive=!0;else if(Za.has(i))n.systemKeys.push(i);else if(i in ii)n.mouse=i;else if(i in ni||/^[a-z]$/.test(i))n.keys.push(ni[i]||i.toUpperCase());else if(i.startsWith("debounce")){let a=i.match(/debounce(?:\.(\d+))?/);n.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(i.startsWith("throttle")){let a=i.match(/throttle(?:\.(\d+))?/);n.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return n}function oi(e,n=""){let r=[],i=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,l;while((l=a.exec(e))!==null){let[u,f,x]=l,v=l.index,I=v+u.length,D=`__stx_evt_${n}${i++}`,W=[],L=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,z;while((z=L.exec(x))!==null){let[,H,Z]=z,U=H.split("."),V=U[0];if(!ti.has(V))continue;W.push({attribute:`@${H}`,event:V,handler:Z,modifiers:si(U.slice(1)),elementId:D})}let N=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((z=N.exec(x))!==null){let[,H,Z]=z,U=H.split("."),V=U[0];if(!ti.has(V))continue;W.push({attribute:`@${H}`,event:V,handler:Z,modifiers:si(U.slice(1)),elementId:D})}if(W.length>0)r.push({originalTag:u,elementId:D,events:W,startIndex:v,endIndex:I})}return r}function Ja(e){let n=[],{modifiers:r}=e;if(r.self)n.push("if ($event.target !== $el) return");for(let i of r.systemKeys)n.push(`if (!$event.${i}Key) return`);if(r.keys.length>0){let i=r.keys.map((a)=>`$event.key === '${a}'`).join(" || ");n.push(`if (!(${i})) return`)}if(r.mouse!==null){let i=ii[r.mouse];n.push(`if ($event.button !== ${i}) return`)}if(r.prevent)n.push("$event.preventDefault()");if(r.stop)n.push("$event.stopPropagation()");return n.join("; ")}function Xa(e,n){let r=e;if(n.debounce!==null)r=`__stx_debounce(() => { ${r} }, ${n.debounce})`;else if(n.throttle!==null)r=`__stx_throttle(() => { ${r} }, ${n.throttle})`;return r}function Ds(e){let n=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(n))return e;return`if (typeof ${n} === 'function' && !${n}._isSignal) ${n}($event);`}function Ga(e){let{modifiers:n}=e,r=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),i=Ja(e),a=Xa(Ds(e.handler),n),l=[];if(n.once)l.push("once: true");if(n.capture)l.push("capture: true");if(Ms(e.event,n))l.push("passive: true");let u=l.length>0?`, { ${l.join(", ")} }`:"",f=a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
3
+ (function() {
4
+ var $el = document.getElementById('${r}');
5
+ if (!$el) return;
6
+ // Run mounted handler immediately (DOM is ready)
7
+ var scope = $el.closest('[data-stx-scope]');
8
+ if (scope && scope.__stx_execute) {
9
+ scope.__stx_execute('${f}', null, $el);
10
+ }
11
+ else {
12
+ __stx_runHandler('${f}', null, $el);
13
+ }
14
+ })();`;if(e.event==="unmounted")return`
15
+ (function() {
16
+ var $el = document.getElementById('${r}');
17
+ if (!$el) return;
18
+ // Set up MutationObserver to detect removal
19
+ var observer = new MutationObserver(function(mutations) {
20
+ for (var m of mutations) {
21
+ for (var node of m.removedNodes) {
22
+ if (node === $el || (node.contains && node.contains($el))) {
23
+ observer.disconnect();
24
+ var scope = $el.closest('[data-stx-scope]');
25
+ if (scope && scope.__stx_execute) {
26
+ scope.__stx_execute('${f}', null, $el);
27
+ }
28
+ else {
29
+ __stx_runHandler('${f}', null, $el);
30
+ }
31
+ return;
32
+ }
33
+ }
34
+ }
35
+ });
36
+ observer.observe(document.body, { childList: true, subtree: true });
37
+ // Store observer for cleanup
38
+ $el.__stx_unmount_observer = observer;
39
+ })();`;return`
40
+ (function() {
41
+ var $el = document.getElementById('${r}');
42
+ if (!$el) return;
43
+ // eslint-disable-next-line pickier/no-unused-vars
44
+ $el.addEventListener('${e.event}', function($event) {
45
+ ${i?i+";":""}
46
+ // Find the closest reactive scope and execute within its context
47
+ var scope = $el.closest('[data-stx-scope]');
48
+ if (scope && scope.__stx_execute) {
49
+ scope.__stx_execute('${f}', $event, $el);
50
+ }
51
+ else {
52
+ // Fallback for non-reactive context (entity-safe; decoded + run in memory)
53
+ __stx_runHandler('${f}', $event, $el);
54
+ }
55
+ }${u});
56
+ })();`}function Ti(e){if(e.length===0)return"";return`
57
+ <script data-stx-events>
58
+ (function() {
59
+ 'use strict';
60
+
61
+ // Utility functions
62
+ function __stx_debounce(fn, delay) {
63
+ var timeout;
64
+ return function() {
65
+ var args = arguments;
66
+ var ctx = this;
67
+ clearTimeout(timeout);
68
+ timeout = setTimeout(function() { fn.apply(ctx, args); }, delay);
69
+ };
70
+ }
71
+
72
+ function __stx_throttle(fn, delay) {
73
+ var last = 0;
74
+ return function() {
75
+ var now = Date.now();
76
+ if (now - last >= delay) {
77
+ last = now;
78
+ fn.apply(this, arguments);
79
+ }
80
+ };
81
+ }
82
+
83
+ // Non-reactive fallback runner. The handler is embedded HTML-entity-encoded
84
+ // so the surrounding script element can never contain raw markup, including
85
+ // its own closing tag; we decode it to JS only in memory here, then run it
86
+ // with $event/$el in scope.
87
+ //
88
+ // This comment must not spell that closing tag out. It used to, as an
89
+ // example, and a browser ends the script element at the FIRST one it sees \u2014
90
+ // so everything below this line, __stx_runHandler included, was emitted as
91
+ // page text and no listener was ever bound. The comment about escaping was
92
+ // the thing that needed escaping.
93
+ function __stx_runHandler(h, $event, $el) {
94
+ var code = h
95
+ .replace(/&lt;/g, '<')
96
+ .replace(/&gt;/g, '>')
97
+ .replace(/&quot;/g, '"')
98
+ .replace(/&#39;/g, "'")
99
+ .replace(/&#x27;/g, "'")
100
+ .replace(/&amp;/g, '&');
101
+ try {
102
+ // eslint-disable-next-line no-new-func
103
+ (new Function('$event', '$el', code)).call($el, $event, $el);
104
+ }
105
+ catch (e) {
106
+ if (typeof console !== 'undefined') console.error('[stx] event handler error:', e);
107
+ }
108
+ }
109
+
110
+ // Event listeners
111
+ ${e.map(Ga).join(`
112
+ `)}
113
+ })();
114
+ </script>`}function Ya(e,n=""){let r=oi(e,n);if(r.length===0)return{template:e,bindings:[]};let i=e,a=[];for(let l=r.length-1;l>=0;l--){let u=r[l],f=u.originalTag;if(!f.includes(" id="))f=f.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${u.elementId}"`);else{let x=f.match(/id=["']([^"']+)["']/);if(x)for(let v of u.events)v.elementId=x[1]}for(let x of u.events){let v=x.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),I=new RegExp(`\\s*${v}\\s*=\\s*"[^"]*"`,"g"),D=new RegExp(`\\s*${v}\\s*=\\s*'[^']*'`,"g");f=f.replace(I,""),f=f.replace(D,"")}i=i.slice(0,u.startIndex)+f+i.slice(u.endIndex),a.push(...u.events)}return{template:i,bindings:a}}function ri(e){let n=e.$uid;return typeof n==="string"&&n?`${n}_`:""}function Qc(e,n,r){if(jl(e))return e;if(n.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:f,bindings:x}=Ya(e,ri(n)),v=n.__stx_event_bindings||[];return n.__stx_event_bindings=[...v,...x],f}let i=oi(e,ri(n));if(i.length===0)return e;let a=e;for(let f=i.length-1;f>=0;f--){let x=i[f],v=x.originalTag;if(!v.includes(" id="))v=v.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${x.elementId}"`);else{let I=v.match(/id=["']([^"']+)["']/);if(I)for(let D of x.events)D.elementId=I[1]}for(let I of x.events){let D=I.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),W=new RegExp(`\\s*${D}\\s*=\\s*"[^"]*"`,"g"),L=new RegExp(`\\s*${D}\\s*=\\s*'[^']*'`,"g");v=v.replace(W,""),v=v.replace(L,"")}a=a.slice(0,x.startIndex)+v+a.slice(x.endIndex)}let l=Ti(i.flatMap((f)=>f.events)),u=c(a);if(u!==-1)a=a.slice(0,u)+l+`
115
+ `+a.slice(u);else a+=l;return a}function ai(e,n){let r=new Set;for(let i of e.split(",")){let a=i.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(n){let l=a.lastIndexOf(":");if(l!==-1)a=a.slice(l+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))r.add(a)}return r}function zt(e,n){let r=t(e),{depths:i,balanced:a}=C(r),l=(f)=>!a||i[f]===0,u=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${n}\\b)`,"g");for(let f of r.matchAll(u)){let x=(f.index??0)+f[0].length-f[1].length;if(l(x))return!0}for(let f of r.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(f.index??0)&&ai(f[1],!0).has(n))return!0;for(let f of r.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(f.index??0)&&ai(f[1],!1).has(n))return!0;return!1}var Ve="0.2.880";var ci=Symbol.for(`stx.lazy-module-promises.${Ve}`);function ec(){let e=globalThis;return e[ci]??=new Map,e[ci]}function o(e,n){let r=ec(),i=`${import.meta.url}\x00${e}`,a=r.get(i);if(a)return a;let l=n();return r.set(i,l),l.catch(()=>{if(r.get(i)===l)r.delete(i)}),l}var tc=/<\/(script)/gi;function ge(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(tc,"<\\/$1")}import li from"fs";var ui=[];function S(e){let n=new T(e);return ui.push(n),n}function el(){for(let e of ui)e.clear()}function _(e,...n){return`${n.map((r)=>String(r??"")).join("\x00")}\x00${e.length}\x00${Bun.hash(e)}`}function Pr(e){let n=[];for(let r of new Set(e))try{n.push({path:r,mtimeMs:li.statSync(r).mtimeMs})}catch{}return n}function Js(e){for(let n of e)try{if(li.statSync(n.path).mtimeMs!==n.mtimeMs)return!1}catch{return!1}return!0}var Ae=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useIntervalFn","useObjectUrl"];var nc=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function sc(e){if(e.startsWith(".")||e.startsWith("/"))return null;if(e.startsWith("@")){let r=e.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!r)return null;return{pkg:r[1],subpath:r[2]||""}}let n=e.match(/^([^/]+)(\/.*)?$/);if(!n)return null;return{pkg:n[1],subpath:n[2]||""}}function rc(e,n){let r=n;while(!0){let i=Dt.join(r,"node_modules",e,"package.json");if(hn.existsSync(i))return Dt.dirname(i);let a=Dt.dirname(r);if(a===r)return null;r=a}}function ic(e,n){if(!e||typeof e!=="object")return null;let r=(a)=>{if(typeof a==="string")return a;if(a&&typeof a==="object"){if(typeof a.import==="string")return a.import;if(typeof a.default==="string")return a.default;if(typeof a.import==="object")return r(a.import);if(typeof a.default==="object")return r(a.default)}return null};if(Object.prototype.hasOwnProperty.call(e,n))return r(e[n]);let i=null;for(let a of Object.keys(e)){let l=a.indexOf("*");if(l===-1)continue;let u=a.slice(0,l),f=a.slice(l+1);if(!n.startsWith(u)||!n.endsWith(f))continue;if(n.length<u.length+f.length)continue;if(!i||u.length>i.prefix.length)i={pattern:a,prefix:u,suffix:f}}if(i){let a=n.slice(i.prefix.length,n.length-i.suffix.length),l=r(e[i.pattern]);if(l)return l.replace("*",a)}return null}function oc(e,n){let r=sc(e);if(!r||!r.subpath)return null;let i=rc(r.pkg,n);if(!i)return null;let a;try{a=JSON.parse(hn.readFileSync(Dt.join(i,"package.json"),"utf8"))}catch{return null}let l=`.${r.subpath}`,u=ic(a.exports,l);if(!u)return null;let f=Dt.resolve(i,u);return hn.existsSync(f)?f:null}function Li(e,n){let r=n.filePath?Dt.dirname(n.filePath):n.projectRoot||process.cwd(),i=n.projectRoot||process.cwd(),a=new Set,l=[],u=[];return{code:e.replace(nc,(x,v)=>{let I;try{if(v.startsWith("./")||v.startsWith("../")||v.startsWith("/")){if(I=v.startsWith("/")?v:Dt.resolve(r,v),!hn.existsSync(I))throw Error(`file not found: ${I}`)}else{let D=null;try{D=Bun.resolveSync(v,i)}catch{D=oc(v,i)}if(!D)throw Error(`could not resolve ${v} (Bun.resolveSync + exports fallback both failed)`);I=D}}catch(D){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(v)} (from ${n.filePath||"<unknown>"}): ${D?.message||D}`),u.push(v),""}if(a.has(I))return"";a.add(I);try{let D=hn.readFileSync(I,"utf8");l.push({source:v,resolvedPath:I,contents:D})}catch(D){console.warn(`[stx:vendor-css] could not read ${I}: ${D?.message||D}`),u.push(v)}return""}),styles:l,unresolved:u}}function ac(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ji(e){if(e.length===0)return"";return`${e.map((n)=>`<style data-stx-vendor="${ac(n.source)}" data-stx-layer="vendor">
116
+ @layer vendor {
117
+ ${n.contents}
118
+ }
119
+ </style>`).join(`
120
+ `)}
121
+ `}var Ng=E,pi=S(256);function Kt(e){let n=_(e),r=pi.get(n);if(!r)r=cc(e),pi.set(n,r);return{code:r.code,imports:[...r.imports],models:[...r.models]}}function cc(e){let n=t(e),r=new Set;for(let f of e.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let x of f[1].split(",")){let v=x.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(v)r.add(v)}let i=mo(n),a=Ae.filter((f)=>{if(r.has(f)||i.has(f))return!1;return Mg(n,f,!0)}),l=mi(n).filter((f)=>!r.has(f)&&!i.has(f));if(a.length===0&&l.length===0)return{code:e,imports:a,models:l};return{code:`${[a.length>0?`import { ${a.join(", ")} } from '@stacksjs/browser'`:"",l.length>0?"import '@stacksjs/browser'":"",l.length>0?`const { ${l.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
122
+ `)}
123
+ ${e}`,imports:a,models:l}}var lc=new Set(["Promise","Object","Array","Map","Set","Date","Error","JSON","Math","Number","String","RegExp","Symbol","WeakMap","WeakSet","Proxy","Reflect","Intl","URL","URLSearchParams","FormData","Headers","Request","Response","AbortController","EventTarget","Element","Document","Node","Window","Console","Storage","Navigator","Blob","File","FileReader","HTMLElement","SVGElement","Event","CustomEvent","DOMParser","XMLSerializer","WebSocket","Worker","SharedWorker","IntersectionObserver","MutationObserver","ResizeObserver","PerformanceObserver","Notification","Bun","Buffer","Process","Modal","Intl"]);function mi(e,n=qr(e)){let r=new Set,i=mo(e),a=/(?<![\w$.])([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g;for(let l of n.code.matchAll(a)){let u=l[1];if(lc.has(u)||i.has(u)||u.length<3)continue;if(n.shadows(u,l.index??0))continue;r.add(u)}return Array.from(r)}function uc(e){return mo(e)}var fi=S(128);function bl(e){let n=_(e),r=fi.get(n);if(!r)r=pc(e),fi.set(n,r);return{code:r.code,stxImports:[...r.stxImports],browserImports:[...r.browserImports]}}function pc(e){let n=new Set,r=new Set,i=e;i=i.replace(/^[ \t]*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"][ \t]*;?[ \t]*$/gm,"// [type import stripped]");let a=new Set,l=/^[ \t]*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"][ \t]*;?[ \t]*$/gm,u;while((u=l.exec(e))!==null){let L=u[1],z=u[2];if(u[0].includes("import type"))continue;let N=[];for(let Z of L.split(",")){let U=Z.trim();if(!U||U.startsWith("type "))continue;let V=U.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!V)continue;let K=V[1],ne=V[2]||K;if(a.add(K),a.add(ne),z==="stx"||z==="@stacksjs/stx")n.add(K);else r.add(K);if(ne!==K)N.push(`${ne} = ${K}`)}let H=N.length>0?`var ${N.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";i=i.replace(u[0],H)}let f=uc(i),x=qr(i);for(let L of Ng){if(a.has(L)||f.has(L))continue;if(Ns(x,L,!0))n.add(L)}let v=t(i),I=qr(v),D=new Set;for(let L of i.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let z of L[1].split(",")){let N=z.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let H of N){let Z=H.trim();if(Z)D.add(Z)}}for(let L of Ae){if(a.has(L)||f.has(L)||D.has(L))continue;if(Ns(I,L))r.add(L)}let W=mi(v,I);for(let L of W)if(!a.has(L)&&!f.has(L))r.add(L);return{code:i,stxImports:Array.from(n),browserImports:Array.from(r)}}function Mg(e,n,r=!1){return Ns(qr(e),n,r)}function Ns(e,n,r=!1){let i=e.code,a=new RegExp(`\\b${n.replace(/[$]/g,"\\$")}\\b`,"g");for(let l of i.matchAll(a)){let u=l.index??0;if(e.shadows(n,u))continue;let f=u+n.length,x=u-1;while(x>=0&&/\s/.test(i[x]))x--;if(i[x]==="."&&i.slice(Math.max(0,x-2),x+1)!=="...")continue;let v=f;while(v<i.length&&/\s/.test(i[v]))v++;if(i[v]===":"&&i[v+1]!==":"&&(i[x]==="{"||i[x]===","))continue;if(r&&!/^\s*(?:<[^>]*>)?\s*\(/.test(i.slice(f)))continue;if(fc(i,f))continue;return!0}return!1}function fc(e,n){let r=n;while(r<e.length&&(e[r]===" "||e[r]==="\t"))r++;if(e[r]!=="(")return!1;let i=0;for(;r<e.length;r++){let a=e[r];if(a==="(")i++;else if(a===")"){if(i--,i===0)break}}if(i!==0)return!1;r++;while(r<e.length&&(e[r]===" "||e[r]==="\t"))r++;return e[r]==="{"}function wl(e,n){let r=[];if(e.length>0)r.push(` var { ${e.join(", ")} } = window.stx || window;`);if(n.length>0)r.push(` var { ${n.join(", ")} } = window.StacksBrowser || {};`);if(r.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
124
+ ${r.join(`
125
+ `)}
126
+ ${dc(e,n)}`;return""}function Cy(e,n=[]){let{browserImports:r}=bl(e),i=new Set(n);return wl([],r.filter((a)=>!i.has(a)))}function dc(e,n){let r=[...e.map((i)=>`['${i}', typeof ${i}, 'stx']`),...n.map((i)=>`['${i}', typeof ${i}, '@stacksjs/browser']`)];if(r.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
127
+ [${r.join(", ")}].forEach(function (e) {
128
+ if (e[1] !== 'undefined') return;
129
+ console.error(
130
+ '[stx] "' + e[0] + '" is used in this client script and auto-imported from ' + e[2] + ', '
131
+ + 'but the client runtime does not provide it. Either it is not exported to the browser, '
132
+ + 'or it should be imported from a relative path so the bundler includes it.'
133
+ );
134
+ });
135
+ `}function qe(e){let n=e.__stxClientPayload;if(n&&typeof n==="object"){let i={};for(let a in n){let l=n[a];if(typeof l==="function")continue;i[a]=l}return i.__stxDeclaredPayload=!0,i}let r={};for(let i in e){if(i.startsWith("__")||i.startsWith("$"))continue;let a=e[i];if(typeof a==="function")continue;r[i]=a}return r}var gc=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,di=new Set;function mc(e,n){let r=gc.test(e),i=n.length>32768;if(!r&&!i)return;if(di.has(e))return;if(di.add(e),r)console.warn(`[stx] server\u2192client bridge is publishing "${e}" into the page body. If it holds a credential, rename it with a "__" prefix (never bridged) and pass only what the template needs. See stacksjs/stx#1831.`);if(i)console.warn(`[stx] server\u2192client bridge is publishing ${(n.length/1024).toFixed(1)}KB under "${e}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function Rn(e,n){if(!n)return"";let r=De(e,new Set(Object.keys(n))),i=n.__stxDeclaredPayload===!0,a=[],l=Object.entries(n).sort(([u],[f])=>u<f?-1:u>f?1:0);for(let[u,f]of l){if(!/^[A-Za-z_$][\w$]*$/.test(u))continue;if(u.startsWith("__")||u.startsWith("$"))continue;if(!i&&!r.has(u))continue;if(zt(e,u)){if(i)console.warn(`[stx] defineClientPayload declares "${u}", but this client block also declares "${u}" at the top level, so the server value is not published (emitting it would be a duplicate binding). Rename the local, or drop "${u}" from defineClientPayload.`);continue}let x;try{x=JSON.stringify(f)}catch{continue}if(x===void 0)continue;mc(u,x),a.push(` var ${u} = ${x.replace(/</g,"\\u003c")};`)}if(a.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
136
+ ${a.join(`
137
+ `)}
138
+ `}var hc={left:0,middle:1,right:2};function xc(e){let n=[];if(e.self)n.push("if ($event.target !== $el) return");for(let r of e.systemKeys)n.push(`if (!$event.${r}Key) return`);if(e.keys.length>0){let r=e.keys.map((i)=>`$event.key === '${i}'`).join(" || ");n.push(`if (!(${r})) return`)}if(e.mouse!==null){let r=hc[e.mouse];n.push(`if ($event.button !== ${r}) return`)}if(e.prevent)n.push("$event.preventDefault()");if(e.stop)n.push("$event.stopPropagation()");return n.join("; ")}function bc(e,n){let{elementId:r,event:i,modifiers:a}=e,l=Ds(e.handler),u=xc(a),f=[];if(a.once)f.push("once: true");if(a.capture)f.push("capture: true");if(Ms(i,a))f.push("passive: true");let x=f.length>0?`, { ${f.join(", ")} }`:"",v="";if(u)v+=`${u}; `;let I=l.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),D=`var $emit = function(name, detail) {
139
+ $el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
140
+ };`;function W(L){if(/\$emit\s*\(/.test(L))return`${D}
141
+ ${L}`;return`var scope = $el.closest('[data-stx-scope]');
142
+ if (scope && scope.__stx_execute) {
143
+ scope.__stx_execute('${I}', $event, $el);
144
+ }
145
+ else {
146
+ ${L}
147
+ }`}if(a.debounce!==null)return` ;(function() {
148
+ // eslint-disable-next-line pickier/no-unused-vars
149
+ var $el = document.getElementById('${r}')
150
+ if (!$el) return
151
+ var __timer
152
+ $el.addEventListener('${i}', function($event) {
153
+ ${u?u+"; ":""}clearTimeout(__timer)
154
+ __timer = setTimeout(function() { ${W(l)} }, ${a.debounce})
155
+ }${x})
156
+ })()`;if(a.throttle!==null)return` ;(function() {
157
+ // eslint-disable-next-line pickier/no-unused-vars
158
+ var $el = document.getElementById('${r}')
159
+ if (!$el) return
160
+ var __last = 0
161
+ $el.addEventListener('${i}', function($event) {
162
+ ${u?u+"; ":""}var __now = Date.now()
163
+ if (__now - __last >= ${a.throttle}) {
164
+ __last = __now
165
+ ${W(l)}
166
+ }
167
+ }${x})
168
+ })()`;if(/\$emit\s*\(/.test(l))return` var $el = document.getElementById('${r}')
169
+ if ($el) $el.addEventListener('${i}', function($event) {
170
+ ${v}${D}
171
+ ${l}
172
+ }${x})`;return` var $el = document.getElementById('${r}')
173
+ if ($el) $el.addEventListener('${i}', function($event) {
174
+ ${v}var scope = $el.closest('[data-stx-scope]');
175
+ if (scope && scope.__stx_execute) {
176
+ scope.__stx_execute('${I}', $event, $el);
177
+ }
178
+ else {
179
+ ${l}
180
+ }
181
+ }${x})`}function yc(e){if(e.length===0)return"";return`
182
+ // STX: auto-generated event bindings
183
+ ${e.map((r,i)=>bc(r,i)).join(`
184
+ `)}`}function gi(e){let n=[],r=new Set,i=e.replace(/^\s*import\s+.*$/gm,""),a=0,l=i.length,u=0;while(u<l){let f=i[u];if(f==="'"||f==='"'||f==="`"){let x=f;if(u++,x==="`"){let v=0;while(u<l){if(i[u]==="\\"){u+=2;continue}if(i[u]==="`"&&v===0){u++;break}if(i[u]==="$"&&i[u+1]==="{"){v++,u+=2;continue}if(i[u]==="}"&&v>0){v--,u++;continue}u++}}else while(u<l){if(i[u]==="\\"){u+=2;continue}if(i[u]===x){u++;break}u++}continue}if(f==="/"&&i[u+1]==="/"){while(u<l&&i[u]!==`
185
+ `)u++;continue}if(f==="/"&&i[u+1]==="*"){u+=2;while(u<l-1&&!(i[u]==="*"&&i[u+1]==="/"))u++;u+=2;continue}if(f==="{"){a++,u++;continue}if(f==="}"){a--,u++;continue}if(a===0){let x=i.slice(u),v=x.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(v){let W=v[1];if(!W.startsWith("_")&&!r.has(W))n.push(W),r.add(W);u+=v[0].length;continue}let I=x.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(I){I[1].split(",").forEach((W)=>{let L=W.trim(),z=L.indexOf(":"),N=z>=0?L.slice(z+1).trim().split(/[\s=]/)[0]:L.split(/[\s=]/)[0];if(N&&!N.startsWith("_")&&!r.has(N))n.push(N),r.add(N)}),u+=I[0].length;continue}let D=x.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(D){let W=D[1];if(!W.startsWith("_")&&!r.has(W))n.push(W),r.add(W);u+=D[0].length;continue}}u++}return n}var _c=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"]);function wc(e){let n=new Set,r=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function i(W){let L;while((L=r.exec(W))!==null){let z=L[0];if(!_c.has(z))n.add(z)}}let a=/\{\{([\s\S]*?)\}\}/g,l;while((l=a.exec(e))!==null)i(l[1]);let u=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((l=u.exec(e))!==null)i(l[1]);let f=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((l=f.exec(e))!==null)i(l[1]);let x=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((l=x.exec(e))!==null)i(l[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((l=v.exec(e))!==null)i(l[1]);let I=/@model\s*=\s*["']([^"']*)["']/gi;while((l=I.exec(e))!==null)i(l[1]);let D=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((l=D.exec(e))!==null)i(l[1]);return n}async function Ke(e,n={}){let r=e,i="",a=!1,l=[],u=Li(r,{filePath:n.filePath,projectRoot:n.projectRoot});r=u.code;let f=ji(u.styles),x=Kt(r);r=x.code,l=[...x.imports,...x.models];let{hasUserImports:v,bundleClientScript:I}=await o("stx/client-script-bundler",()=>import("./chunk-3zds0gmd.js"));if(v(r))r=await I(r,n.filePath||"",{projectRoot:n.projectRoot,minify:n.production}),a=!0;if(n.autoImports!==!1){let V=bl(r);r=V.code,i=wl(V.stxImports,V.browserImports.filter((K)=>!l.includes(K)))}if(i=`${Rn(r,n.serverData)}${i}`,r=M(r),!a&&Ge(n.attrs||""))r=Xe(r);let D=yc(n.eventBindings||[]),W=(n.attrs||"").trim(),L=/\btype\s*=\s*["']module["']/i.test(W),z=n.instanceId?` data-stx-instance="${n.instanceId}"`:"";if(L){let V=W.replace(/\btype\s*=\s*["']module["']/i,"").trim(),K=`type="module" data-stx-scoped${z}${V?` ${V}`:""}`;return`${f}<script ${K}>
186
+ ${ge(`${i}${r}
187
+ ${D}`)}
188
+ </script>`}let N=Qi(e),H=/function __stx_setup_/.test(r),Z=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function U(V){let K=V.length>0?`
189
+ return ${qs(r,V)};`:"",ne=JSON.stringify(`[stx] client block failed${n.filePath?` (${n.filePath})`:""}; this block will not hydrate`);return`${f}<script data-stx-scoped data-stx-run="always"${z}>
190
+ window.stx.mount(function() {
191
+ 'use strict';
192
+ try {
193
+ ${ge(`${i}${r}
194
+ ${D}${K}`)}
195
+ } catch (error) {
196
+ console.error(${ne}, error);
197
+ return {};
198
+ }
199
+ })</script>`}if(!Z&&!H){if(N)return U(gi(e));if(n.templateContent){let V=gi(e);if(V.length>0){let K=wc(n.templateContent);if(V.some((ae)=>K.has(ae)))return U(V)}}}return`${f}<script data-stx-scoped data-stx-run="always"${z}>
200
+ ;(function() {
201
+ 'use strict';
202
+ try {
203
+ ${ge(`${i}${r}
204
+ ${D}`)}
205
+ } catch (error) {
206
+ console.error(${JSON.stringify(`[stx] client block failed${n.filePath?` (${n.filePath})`:""}; this block will not hydrate`)}, error);
207
+ }
208
+ })()</script>`}import{createHash as Ac}from"crypto";var Ls=/\s*/y,zs=/\x00STX_HTML_COMMENT_\d+\x00/y;function Ht(e){let n=0;while(n<e.length){if(Ls.lastIndex=n,Ls.exec(e),n=Ls.lastIndex,e.startsWith("<!--",n)){let r=e.indexOf("-->",n+4);if(r===-1)return n;n=r+3;continue}if(zs.lastIndex=n,zs.test(e)){n=zs.lastIndex;continue}return n}return n}var Bs=/<(\/?)([a-zA-Z][a-zA-Z0-9-]*)\b/y,Sc=new Map(["textarea","title","xmp","iframe","noembed","noframes"].map((e)=>[e,new RegExp(`</${e}\\s*>`,"ig")]));function Pe(e){let n=[],r=0;while(r<e.length){let i=e.indexOf("<",r);if(i===-1)break;if(e.startsWith("<!--",i)){let W=e.indexOf("-->",i+4);if(W===-1)break;r=W+3;continue}Bs.lastIndex=i;let a=Bs.exec(e);if(!a){r=i+1;continue}let l=Bs.lastIndex,u=l,f=null;for(;u<e.length;u++){let W=e[u];if(f){if(W===f)f=null}else if(W==='"'||W==="'")f=W;else if(W===">")break}if(u===e.length)break;let x=a[1]==="/",v=e[u-1]==="/";n.push({start:i,end:u+1,name:a[2],attributes:e.slice(l,v?u-1:u),closing:x,selfClosing:v}),r=u+1;let I=a[2].toLowerCase();if(!x&&I==="plaintext")break;let D=Sc.get(I);if(!x&&(I==="script"||I==="style"||D)){let W=D??(I==="script"?ns:ss);W.lastIndex=r;let L=W.exec(e);if(!L)break;r=L.index}}return n}var es=/<script\b[^>]*>/iy,ns=/<\/script\s*>/ig,ts=/<style\b[^>]*>/iy,ss=/<\/style\s*>/ig;function hi(e,n,r,i){r.lastIndex=n;let a=r.exec(e);if(!a||a.index!==n)return-1;i.lastIndex=r.lastIndex;let l=i.exec(e);if(!l)return-1;return l.index+l[0].length}function Q(e,n){return hi(e,n,es,ns)}function _n(e,n){return hi(e,n,ts,ss)}function We(e,n){if(!e.startsWith("<!--",n))return-1;let r=e.indexOf("-->",n+4);if(r===-1)return-1;return r+3}function xi(e,n){if(e.startsWith("<!--",n)){let a=We(e,n);return a===-1?e.length:a}if(es.lastIndex=n,es.exec(e)?.index===n){ns.lastIndex=es.lastIndex;let a=ns.exec(e);return a?a.index+a[0].length:e.length}if(ts.lastIndex=n,ts.exec(e)?.index===n){ss.lastIndex=ts.lastIndex;let a=ss.exec(e);return a?a.index+a[0].length:e.length}return-1}function w(e,n){let r=[],i=0,a=e.length,l=!1,u=null;while(i<a){let f=e[i];if(l){if(u){if(f===u)u=null}else if(f==='"'||f==="'")u=f;else if(f===">")l=!1;i++;continue}if(f!=="<"){let D=e.indexOf("<",i+1);if(D===-1)break;i=D;continue}let x=n(e,i);if(x>i){r.push({start:i,end:x,token:e.slice(i,x)}),i=x;continue}let v=xi(e,i);if(v>i){i=v;continue}let I=e.charCodeAt(i+1);if(I>=65&&I<=90||I>=97&&I<=122)l=!0;i++}return r}function bi(e){let n=0,r=0,i=0,a=!1,l=null;while(i<e.length){if(a){let D=e[i];if(l){if(D===l)l=null}else if(D==='"'||D==="'")l=D;else if(D===">")a=!1;i++;continue}let u=e.indexOf("<",i),f=u===-1?e.length:u;while(i<f){let D=e[i++];if(D==="{")n++;else if(D==="}")r++;if(n>=2&&r>=2)return!0}if(u===-1)break;let x=xi(e,u);if(x>u){i=x;continue}let v=e.charCodeAt(u+1),I=v===47?e.charCodeAt(u+2):v;if(I>=65&&I<=90||I>=97&&I<=122)a=!0;i=u+1}return!1}function tl(e,n){while(e.size>=n){let r=e.keys().next();if(r.done)return;e.delete(r.value)}}var vc=1024,$c=16777216,tn=new Map,Fs=0;function Ec(e,n){tn.set(e,n),Fs+=e.length+n.output.length;for(let[r,i]of tn){if(Fs<=$c)break;tn.delete(r),Fs-=r.length+i.output.length}}function xe(e,n,r,i){let a=i!==void 0&&e.length>=vc,l=a?`${i}\x00${e}`:"";if(a){let I=tn.get(l);if(I)return tn.delete(l),tn.set(l,I),{output:I.output,tokens:I.tokens.slice()}}let u=w(e,n);if(u.length===0)return{output:e,tokens:[]};let f=u.map((I)=>I.token),x="",v=0;for(let I=0;I<u.length;I++){let D=u[I];x+=e.slice(v,D.start),x+=r(D.token,I),v=D.end}if(x+=e.slice(v),a)return Ec(l,{output:x,tokens:f}),{output:x,tokens:f.slice()};return{output:x,tokens:f}}var kc=1024,Cc=16777216,nn=new Map,Vs=0;function Rc(e,n){nn.set(e,n),Vs+=e.length+n.output.length;for(let[r,i]of nn){if(Vs<=Cc)break;nn.delete(r),Vs-=r.length+i.output.length}}function Us(e,n,r){return{output:n,scripts:r,restore:(i)=>i===n?e:Ir(i,r)}}function re(e){let n=e.length>=kc;if(n){let a=nn.get(e);if(a)return nn.delete(e),nn.set(e,a),Us(e,a.output,a.scripts.slice())}let{output:r,tokens:i}=xe(e,Q,(a,l)=>`\x00STX_SCRIPT_${l}\x00`);if(n)return Rc(e,{output:r,scripts:i}),Us(e,r,i.slice());return Us(e,r,i)}function Ir(e,n){if(n.length===0)return e;return e.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(r,i)=>n[+i]??"")}function Ie(e){let n=Pe(e),r=[];for(let i=0;i<n.length;i++){let a=n[i],l=n[i+1];if(a.name.toLowerCase()!=="script"||a.closing||l?.name.toLowerCase()!=="script"||!l.closing)continue;r.push({start:a.start,end:l.end,bodyStart:a.end,bodyEnd:l.start,attrs:a.attributes})}return r}var rs="__stx_component_client_factories";function is(e){let n=e[rs];return n instanceof Map?n:null}function gl(e){e[rs]=new Map}function Hs(e,n){let r=is(e);if(!r)return null;let i=Ac("sha256").update(n).digest("hex").slice(0,16),a=r.get(i);if(a)a.instances++;else r.set(i,{body:n,instances:1});return i}function ml(e,n){let r=is(n);if(!r?.size)return e;let i=new Map;for(let[I,D]of r)if(D.instances===1)i.set(I,D.body);let a=[];if(i.size>0){let I=[...i.keys()].map((L)=>JSON.stringify(L).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),D=new RegExp(`window\\.__stxComponentFactories\\[(${I})\\]\\(("[^"]+")\\);`,"g"),W=D.exec(e);while(W!==null){let L=i.get(JSON.parse(W[1]));if(L!==void 0)a.push({start:W.index,end:W.index+W[0].length,replacement:ge(`(${L})(${W[2]});`)});W=D.exec(e)}}let l=[...r].filter(([,I])=>I.instances>1);if(l.length===0)return yi(e,a);let u=l.map(([I,D])=>` try { factories[${JSON.stringify(I)}] = factories[${JSON.stringify(I)}] || ${D.body}; }
209
+ catch (e) { console.error('[stx] component factory ' + ${JSON.stringify(I)} + ' failed to register; instances of it will not hydrate.', e); }`).join(`
210
+ `),f=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
211
+ (function() {
212
+ const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
213
+ ${ge(u)}
214
+ })();
215
+ </script>`,x,v=/<(?:template\b|script\b(?=[^>]*\bdata-stx-scoped\b))/iy;return w(e,(I,D)=>{if(x===void 0){if(v.lastIndex=D,v.test(I))x=D}return-1}),a.push({start:x??0,end:x??0,replacement:`${f}
216
+ `}),yi(e,a)}function yi(e,n){if(n.length===0)return e;n.sort((l,u)=>l.start-u.start||l.end-u.end);let r=Array(n.length*2+1),i=0,a=0;for(let l of n)r[a++]=e.slice(i,l.start),r[a++]=l.replacement,i=l.end;return r[a]=e.slice(i),r.join("")}function wi(e){let n=is(e),r=new Map;if(n)for(let[i,a]of n)r.set(i,a.instances);return r}function Si(e,n){let r=is(e);if(!r)return[];let i=[];for(let[a,l]of r){let u=l.instances-(n.get(a)??0);if(u>0)i.push({body:l.body,count:u})}return i}function vi(e,n){for(let{body:r,count:i}of n)for(let a=0;a<i;a++)Hs(e,r)}function Re(e,n,r=2){let i=0,a=null;for(let l=n+r;l<e.length;l++){let u=e[l];if(a){if(u==="\\"){l++;continue}if(u===a)a=null;continue}if(u==='"'||u==="'"||u==="`"){a=u;continue}if(u==="{"){i++;continue}if(u==="}"){if(i>0){i--;continue}let f=0;while(e[l+f]==="}")f++;if(f>=r)return l}}return-1}import Gi from"fs";var ki=0,er=new Map;function kl(){ki=0,er.clear()}function os(e,n){let r=ki++,i=`<!--__STX_${e.toUpperCase()}_${r}__-->`;return er.set(i,{type:e,expression:n}),i}function _l(){let e={};for(let[n,r]of er)e[n]={type:r.type,expression:r.expression};return e}function Cl(e,n){let r=e;for(let[i,a]of n)r=r.split(i).join(a);return r}function Fi(e){return e.includes("<!--__STX_")}var Tc=/@(?=[a-zA-Z_]\w*\s*\(|end[a-zA-Z]*\b|else(?:if)?\b|empty\b|case\b|default\b|break\b|continue\b|fallback\b)/g;function Ic(e){return Array.from({length:e},()=>"&#123;").join("&#8288;")}function Wi(e){return e.replace(/\{{2,}/g,(n)=>Ic(n.length)).replace(/\{(?=!)/g,"&#123;&#8288;").replace(Tc,"&#64;")}function Nr(e,n,r=!1){let{openTag:i,tail:a}=r?Pc(e,n):Oc(e).at(n);return Mc(a,i,r)}function Pc(e,n){let r="",i=0;for(let u=0;u<n;u++){if(!e.startsWith("{{",u))continue;let f=Re(e,u);if(f<0||f+2>n)break;r+=e.slice(i,u)+"x",u=f+1,i=f+2}r+=e.slice(i,n);let a=-1,l=null;for(let u=0;u<r.length;u++){let f=r[u];if(l){if(f===l)l=null;continue}if(f==='"'||f==="'"){l=f;continue}if(f===">"){a=-1;continue}if(f==="<")a=u}return{openTag:a,tail:a>=0?r.slice(a+1):r}}var as=null;function Oc(e){if(as&&as.source===e)return as.scanner;let n=jc(e);return as={source:e,scanner:n},n}function jc(e){let n=0,r=-1,i=null,a=-1,l=(f,x)=>{let v=e[f];if(x.quote){if(v===x.quote)x.quote=null;return}if(x.openTag>=0){if(v==='"'||v==="'"){x.quote=v;return}if(v===">"){x.openTag=-1;return}}if(v==="<")x.openTag=f},u=(f,x)=>{if(x.openTag>=0||!e.startsWith("<!--",f))return-1;let v=e.indexOf("-->",f+4);return v<0?e.length:v+3};return{at(f){if(f<n)n=0,r=-1,i=null,a=-1;let x={openTag:r,quote:i},v=!1;while(n<f){if(a<0&&e.startsWith("{{",n)){let N=Re(e,n);if(N<0)a=n;else if(N+2<=f){n=N+2;continue}else break}let z=u(n,x);if(z>=0){if(z>f){v=!0;break}n=z;continue}l(n,x),n++}if(r=x.openTag,i=x.quote,v)return{openTag:-1,tail:""};let I=a>=0?a:n,D={openTag:r,quote:i};for(let z=n;z<f;z++){let N=u(z,D);if(N>=0){if(N>f)return{openTag:-1,tail:""};z=N-1;continue}l(z,D)}if(D.openTag<0)return{openTag:-1,tail:""};let W="",L=D.openTag+1;for(let z=L;z<Math.min(f,I);z++){if(!e.startsWith("{{",z))continue;let N=Re(e,z);W+=e.slice(L,z)+"x",z=N+1,L=N+2}return W+=e.slice(L,f),{openTag:D.openTag,tail:W}}}}function Mc(e,n,r){if(n<0&&!r)return null;if(n>=0&&/^\s*[!/?]/.test(e))return/^\s*\/?\s*$/.test(e)?{kind:"tag-name"}:null;if(n>=0&&/^\s*$/.test(e))return{kind:"tag-name"};let i=0;if(n>=0)while(i<e.length&&!/\s/.test(e[i]))i++;while(i<e.length){while(/\s/.test(e[i]??"")&&i<e.length)i++;let a=i;while(i<e.length&&!/[\s=/>]/.test(e[i]))i++;let l=e.slice(a,i);if(!l)break;while(i<e.length&&/\s/.test(e[i]))i++;if(e[i]!=="=")continue;i++;while(i<e.length&&/\s/.test(e[i]))i++;let u=e[i];if(u==='"'||u==="'"){let f=++i,x=e.indexOf(u,i);if(x===-1)return{kind:"attribute",name:l,quote:u,valuePrefix:e.slice(f)};i=x+1}else{let f=i;while(i<e.length&&!/\s/.test(e[i]))i++;if(i===e.length)return{kind:"attribute",name:l,quote:null,valuePrefix:e.slice(f)}}}return{kind:"tag"}}class me extends Error{attribute;near;constructor(e,n){super(`Unsafe interpolation in ${e}: ${n}`);this.name="UnsafeInterpolationContextError",this.attribute=e}locate(e,n){if(this.near===void 0)this.near=e.slice(Math.max(0,n-160),n).replace(/\s+/g," ").trim(),this.message+=` (after: ${JSON.stringify(this.near)})`;return this}}var Vi="unsafe:";var Dc=/^(?:javascript|vbscript|livescript|mocha|view-source):/,Nc=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,Lc=/^data:(?:text\/html|application\/xhtml\+xml)/,zc=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function Bc(e){return e.replace(zc,"").toLowerCase()}function tr(e){let n=e.toLowerCase();if(new RegExp("^(?:href|xlink:href|action|formaction|ping|cite|manifest|data|to)$").test(n))return"navigable";if(new RegExp("^(?:src|srcset|poster|background)$").test(n))return"fetched";return null}function cs(e,n="navigable"){let r=Bc(e);if(Dc.test(r))return!0;return n==="navigable"?Nc.test(r):Lc.test(r)}function Or(e,n="navigable"){return cs(e,n)?"unsafe:"+e:e}function Wc(e){let n=e.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!n)return null;if(n[3].trim()!=="")return null;return tr(n[1])}function Ki(e,n,r=256){if(n<=r)return e.slice(0,n);let i=e.slice(n-r,n),a=i.search(/[\s"'`/]/);return a===-1?"":i.slice(a)}function qi(e,n,r=n){let i=Wc(e);return i&&cs(n,i)?"unsafe:"+r:r}function Vt(e){let n=e.indexOf(" as ");if(n!==-1){let l=e.slice(0,n).trim(),u=e.slice(n+4).trim();return l&&u?{arrayExpr:l,itemVar:u}:null}let r=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(e);if(!r)return null;let i=r[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),a=r[2].trim();return i&&a?{arrayExpr:a,itemVar:i}:null}function ls(e){let n=[],r=0,i="",a=0;for(let l=0;l<e.length;l++){let u=e[l];if(i){if(u==="\\")l++;else if(u===i)i="";continue}if(u==="'"||u==='"'||u==="`")i=u;else if(u==="("||u==="["||u==="{")r++;else if(u===")"||u==="]"||u==="}")r--;else if(u===","&&r===0)n.push(e.slice(a,l)),a=l+1}return n.push(e.slice(a)),n}function Ji(e,n){let r=0;for(let i=0;i<e.length;i++){let a=e[i];if(a==="("||a==="["||a==="{")r++;else if(a===")"||a==="]"||a==="}")r--;else if(a===n&&r===0)return i}return-1}function Xi(e){let n=0;for(let r=0;r<e.length;r++){let i=e[r];if(i==="("||i==="["||i==="{")n++;else if((i===")"||i==="]"||i==="}")&&--n===0)return r}return-1}function Nt(e,n){let r=e.trim().replace(/^\.\.\./,"").trim(),i=Ji(r,"=");if(i!==-1&&r[i+1]!==">")r=r.slice(0,i).trim();if(!r)return;if(r.startsWith("{")&&r.endsWith("}")){for(let a of ls(r.slice(1,-1))){let l=a.trim();if(!l)continue;if(l.startsWith("...")){Nt(l,n);continue}let u=Ji(l,":");Nt(u===-1?l:l.slice(u+1),n)}return}if(r.startsWith("[")&&r.endsWith("]")){for(let a of ls(r.slice(1,-1)))Nt(a,n);return}if(/^[A-Z_$][\w$]*$/i.test(r))n.push(r)}function se(e){let n=e.trim(),r=[],i=0;for(let l=0;l<n.length;l++){let u=n[l];if(u==="("||u==="["||u==="{")i++;else if(u===")"||u==="]"||u==="}")i--;else if(i===0&&/\s/.test(u)){if(!/^\s+(?:in|of)\s/.exec(n.slice(l)))continue;let x=n.slice(0,l).trim();if(x.startsWith("(")&&Xi(x)===x.length-1)x=x.slice(1,-1);for(let v of ls(x))Nt(v,r);if(r.length>0)return r;break}}let a=/^[\s\S]+?\s+as\s+([\s\S]+)$/.exec(n);if(a){let l=a[1].trim();if(l.startsWith("(")&&Xi(l)===l.length-1)l=l.slice(1,-1);let u=/^([\w$]+)\s*=>\s*([\s\S]+)$/.exec(l);if(u)Nt(u[2],r),Nt(u[1],r);else for(let f of ls(l))Nt(f,r)}return r}function B(e,n){let r=n instanceof Set?n:new Set(n);if(r.size===0)return!1;let u=e.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"/g," ").replace(/`(?:[^`\\$]|\\.|\$(?!\{))*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:(?!:))/g,"$1$2");for(let f of u.match(/[a-zA-Z_$][\w$]*/g)||[])if(r.has(f))return!0;return!1}var us="__stx_client_loop_names";function gt(e){let n=e?.[us];return Array.isArray(n)?n:[]}function ps(e){if(!e.includes("#")&&!e.includes("v-slot:")&&!e.includes("data-stx-slot-binding"))return[];let n=[],r=[],i=/<!--[\s\S]*?-->|<script\b(?:"[^"]*"|'[^']*'|[^'">])*>[\s\S]*?<\/script\s*>|<style\b(?:"[^"]*"|'[^']*'|[^'">])*>[\s\S]*?<\/style\s*>|<\/?[a-z][\w:-]*\b(?:"[^"]*"|'[^']*'|[^'">])*>/gi;for(let a of e.matchAll(i)){let l=a[0];if(/^<\/template\s*>$/i.test(l)){let u=r.pop();if(u)u.end=a.index}else if(/^<template\b/i.test(l)&&!/\/\s*>$/.test(l)){let f=[...l.slice(9).matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g)].find((I)=>/^(?:#[\w-]+|v-slot:[\w-]+|data-stx-slot-binding)$/i.test(I[1])),x=(f?.[2]??f?.[3])?.trim();if(x&&f?.[1]==="data-stx-slot-binding")try{x=decodeURIComponent(x)}catch{x=void 0}let v=x?{start:a.index+l.length,end:e.length,binding:x}:void 0;if(r.push(v),v)n.push(v)}}return n}var bn={},Yi=new Map;function Fc(e){let n=Yi.get(e);if(!n){let r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");n=new RegExp(`:${r}(?!\\w)`,"g"),Yi.set(e,n)}return n.lastIndex=0,n}var io={uppercase:(e,n)=>e!==void 0&&e!==null?String(e).toUpperCase():"",lowercase:(e,n)=>e!==void 0&&e!==null?String(e).toLowerCase():"",capitalize:(e,n)=>{if(e===void 0||e===null)return"";let r=String(e);return r.charAt(0).toUpperCase()+r.slice(1)},number:(e,n,r=0)=>{if(e===void 0||e===null)return"";try{let i=Number(e);return Number.isNaN(i)?"":i.toFixed(Number.parseInt(String(r),10))}catch{return""}},fmt:(e,n,r="en-US")=>{if(e===void 0||e===null)return"";try{let i=Number(e);if(Number.isNaN(i))return String(e);return i.toLocaleString(r)}catch{return String(e)}},join:(e,n,r=",")=>{if(!Array.isArray(e))return"";return e.join(String(r))},escape:(e,n)=>{if(e===void 0||e===null)return"";return Y(String(e))},translate:(e,n,r={})=>{if(!n||!n.__translations)return e;let i=n.__translations,a=n.__i18nConfig?.fallbackToKey??!0,l=String(e).split("."),u=i;for(let x of l){if(u===void 0||u===null)break;u=u[x]}if(u===void 0||u===null)return a?e:"";let f=String(u);return Object.entries(r).forEach(([x,v])=>{f=f.replace(Fc(x),()=>String(v))}),f},t:(e,n,r={})=>io.translate(e,n,r),truncate:(e,n,r=50,i="...")=>{if(e===void 0||e===null)return"";let a=String(e);if(a.length<=r)return a;if(r<=i.length)return i.substring(0,r);return a.substring(0,r-i.length)+i},date:(e,n,r="short",i="en-US")=>{if(e===void 0||e===null)return"";try{let a=e instanceof Date?e:new Date(e);if(Number.isNaN(a.getTime()))return String(e);let l={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(r==="iso")return a.toISOString();return new Intl.DateTimeFormat(i,l[r]||l.short).format(a)}catch{return String(e)}},currency:(e,n,r="USD",i="en-US")=>{if(e===void 0||e===null)return"";try{let a=Number(e);if(Number.isNaN(a))return String(e);return new Intl.NumberFormat(i,{style:"currency",currency:r}).format(a)}catch{return String(e)}},pluralize:(e,n,r,i)=>{let a=Number(e);if(Number.isNaN(a))return r;let l=i||`${r}s`;return a===1?r:l},first:(e,n)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[0];return String(e).charAt(0)},last:(e,n)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[e.length-1];let r=String(e);return r.charAt(r.length-1)},length:(e,n)=>{if(e===void 0||e===null)return 0;if(Array.isArray(e)||typeof e==="string")return e.length;if(e instanceof Map||e instanceof Set)return e.size;if(typeof e==="object")return Object.keys(e).length;return 0},json:(e,n,r=!1)=>{if(e===void 0)return"undefined";if(e===null)return"null";try{return r?JSON.stringify(e,null,2):JSON.stringify(e)}catch{return String(e)}},default:(e,n,r="")=>e===void 0||e===null||e===""?r:e,reverse:(e,n)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return[...e].reverse();return String(e).split("").reverse().join("")},slice:(e,n,r=0,i)=>{if(e===void 0||e===null)return"";if(Array.isArray(e)||typeof e==="string")return e.slice(r,i);return e},replace:(e,n,r,i="")=>{if(e===void 0||e===null)return"";let a=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(e).replace(new RegExp(a,"g"),()=>i)},stripTags:(e,n)=>{if(e===void 0||e===null)return"";return String(e).replace(/<[^>]*>/g,"")},urlencode:(e,n)=>{if(e===void 0||e===null)return"";return encodeURIComponent(String(e))},abs:(e,n)=>{let r=Number(e);return Number.isNaN(r)?0:Math.abs(r)},round:(e,n,r=0)=>{let i=Number(e);if(Number.isNaN(i))return 0;let a=10**r;return Math.round(i*a)/a}};function Ug(e,n){if(e in io)console.warn(`Filter "${e}" already exists as a built-in filter. Custom filter will take precedence.`);bn[e]=n}function Ty(e){for(let[n,r]of Object.entries(e))Ug(n,r)}function Wg(){return{...io,...bn}}function $y(){for(let e of Object.keys(bn))delete bn[e]}function bo(e){let n=e.next();while(!n.done)n=e.next();return n.value}function*yo(e,n,r,i){let a="{".repeat(r);if(!e.includes(a))return e;let l="",u=0,f=0,x=i===Number.POSITIVE_INFINITY?0:performance.now();for(;;){let v=e.indexOf(a,u);if(v===-1)break;let I=Re(e,v,r);if(I===-1)break;if(l+=e.slice(u,v)+n(e.slice(v,I+r),e.slice(v+r,I),v),u=I+r,++f>=64){f=0;let D=performance.now();if(D-x>=i)x=D,yield}}return u===0?e:l+e.slice(u)}function Pn(e,n,r=2){return bo(yo(e,n,r,Number.POSITIVE_INFINITY))}function Vc(e,n,r){let i=r[0];if(i!=="'"&&i!=='"'&&i!=="`")return!1;let a=Nr(e,n);if(!a||a.kind!=="attribute"||a.quote===i)return!1;if(!/^(?::|@|x-|v-)/.test(a.name))return!1;let l=0;for(let u=0;u<a.valuePrefix.length;u++)if(a.valuePrefix[u]==="\\")u++;else if(a.valuePrefix[u]===i)l++;return l%2===1}function g(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Y(e){return Wi(g(e))}function Uc(e){return e.replace(/ /g,"&#32;").replace(/\t/g,"&#9;").replace(/\n/g,"&#10;").replace(/\r/g,"&#13;").replace(/\f/g,"&#12;").replace(/=/g,"&#61;").replace(/`/g,"&#96;")}function Hc(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\([\dA-Fa-f]{1,6})\s?/g,(n,r)=>String.fromCodePoint(Number.parseInt(r,16))).replace(/\\([^\r\n])/g,"$1").replace(/[\u0000-\u0020]+/g,"").toLowerCase()}function Kc(e,n){let r=Hc(e);if(/@import|expression\(|behavior:|-moz-binding|(?:image-set|cross-fade)\(/.test(r))throw new me(n,"network-capable or executable CSS is not allowed in an escaped interpolation");let i=/url\(([^)]*)\)/g,a;while((a=i.exec(r))!==null){let l=a[1].replace(/^["']|["']$/g,""),u=l.startsWith("/")&&!l.startsWith("//")||l.startsWith("./")||l.startsWith("../")||l.startsWith("#"),f=/^data:image\/(?:avif|bmp|gif|jpeg|jpg|png|webp);base64,[a-z\d+/=]+$/i.test(l);if(!u&&!f)throw new me(n,"CSS URLs must be local paths or base64 raster images")}}function ie(e,n,r,i=!1,a=0){try{return qc(e,n,r,i,a)}catch(l){if(l instanceof me)l.locate(e,n);throw l}}function qc(e,n,r,i,a){let l=Nr(e,n,i),u=Y(r);if(!l)return u;if(l.kind==="tag-name"){if(!/^[A-Za-z][A-Za-z0-9:-]*$/.test(r))throw new me("tag name","dynamic tag names may contain only letters, digits, colons, and hyphens");return r}if(l.kind==="tag"){let v=e.slice(n+a).trimStart(),I=r.trim();if(!v.startsWith("=")&&(I===""||I.split(/\s+/).every((D)=>/^(?!on)[A-Za-z_:][\w:.-]*$/.test(D))))return I;throw new me("tag structure","only standalone boolean attributes may be interpolated into tag structure")}let f=l.name.toLowerCase();if(/^on[a-z]/.test(f))throw new me(l.name,"native event-handler attributes execute JavaScript; use an @event binding instead");if(f==="srcdoc")u=Y(u);if(f==="style")Kc(r,l.name);if(l.quote===null)u=Uc(u);let x=tr(f);if(x&&l.valuePrefix.trim()===""&&cs(r,x))return Vi+u;return qi(Ki(e,n),r,u)}function In(e,n){let r=` ${e}="`;return ie(r,r.length,n,!0)}function _o(e){return e.flatMap((n)=>{let r=n.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);return!r||/\bserver\b|\bsrc\s*=/.test(r[1])?[]:[r[2]]})}function Oe(e,n){let{scripts:r}=re(e);for(let i of _o(r)){if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(i)||xl.test(i))return!0;if(Kr(i,n))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test(e))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test(e))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test(e))return!0;return!1}function qg(e){let n=[],r=/<([a-zA-Z][\w-]*)\b[^>]*?\s(?::for|x-for|@for)\s*=\s*(["'])([\s\S]*?)\2[^>]*>/g;for(let i=r.exec(e);i;i=r.exec(e)){let a=i[1].toLowerCase(),l=new Set(se(i[3]));if(l.size===0)continue;let u=i.index+i[0].length;if(i[0].endsWith("/>")){n.push({start:i.index,end:u,names:l});continue}let f=new RegExp(`<(/?)${a}\\b[^>]*?(/?)>`,"gi");f.lastIndex=u;let x=1,v=e.length;for(let I=f.exec(e);I;I=f.exec(e)){if(I[2]==="/")continue;if(x+=I[1]==="/"?-1:1,x===0){v=I.index+I[0].length;break}}n.push({start:i.index,end:v,names:l})}return n}function lo(e,n,r){let i=t(r);for(let a of e){if(n<a.start||n>=a.end)continue;for(let l of a.names)if(new RegExp(`(?<![.#\\w$])${l.replace(/\$/g,"\\$")}(?![\\w$])`).test(i))return!0}return!1}function uo(e,n){let r=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","URL","URLSearchParams","Intl","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console","new","typeof","instanceof","in","void"],i=e.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),a="",l=!1,u=0;for(let v=0;v<i.length;v++){let I=i[v];if(!l&&I==="`"){l=!0,u=0;continue}if(l){if(I==="`"&&u===0){l=!1;continue}if(I==="$"&&i[v+1]==="{"){u++,v++,a+=" ";continue}if(I==="}"&&u>0){u--;continue}if(u>0){a+=I;continue}continue}a+=I}i=a;let f=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,x;while((x=f.exec(i))!==null){let v=x[1];if(!i.substring(0,x.index).trimEnd().endsWith(".")){if(!r.includes(v)&&!(v in n))return!1}}return!0}function Zc(e,n){let r=t(e);for(let i of r.matchAll(/(?<![.\w$])([A-Z_$][\w$]*)\s*\(/gi))if(typeof n[i[1]]==="function")return!0;return!1}function Jc(e,n){let r=n.__stx_serverDeclared;if(!r||r.size===0)return!1;let i=t(e);for(let a of r)if(new RegExp(`(?<![.#\\w$])${a}(?![\\w$])`).test(i))return!0;return!1}var po=new Set;function ho(e){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(e.trim())}function Xc(e,n,r){let i=r[0];if(i!=="'"&&i!=='"'&&i!=="`")return!1;let a=0;for(let l=e.lastIndexOf(`
217
+ `,n-1)+1;l<n;l++)if(e[l]==="\\")l++;else if(e[l]===i)a++;return a%2===1}function xo(e,n){let r=`${n??"<unknown>"}\x00${e}`;if(process.env.STX_DEBUG||!po.has(r))po.add(r),console.warn(`[stx] {{ ${e} }} in a <script> in ${n??"<unknown>"} has no server value, so it was emitted as undefined. A mustache left in JavaScript is a SyntaxError that takes the whole script down, so give the value a default in <script server>.`);return"undefined"}function zi(e,n,r){let i=e;return i=i.replace(/\{!!([\s\S]*?)!!\}/g,(a,l)=>{try{let u=O(l,n);if(u===void 0)return ho(l)?xo(l.trim(),r):a;return u===null?"":String(u)}catch{return a}}),i=Pn(i,(a,l,u)=>{let f=l.trim();if(Xc(i,u,l))return a;if(/^__[A-Z_]+__$/.test(f))return a;try{let x=O(l,n);if(x===void 0)return ho(f)?xo(f,r):a;return JSON.stringify(x).replace(/</g,"\\u003c").replace(/@/g,"\\u0040").replace(/\{{2,}/g,(v)=>"\\u007b".repeat(v.length)).replace(/\{(?=!)/g,"\\u007b")}catch{return a}}),i}function Kg(e,n){if(!e.includes("{"))return e;let r=e;return r=r.replace(/\{!!([\s\S]*?)!!\}/g,(i,a)=>{try{let l=O(a,n);if(l===void 0)return i;return l===null?"":String(l)}catch{return i}}),r=Pn(r,(i,a,l)=>{let u=a.trim();if(/^__[A-Z_]+__$/.test(u))return i;try{let f=O(a,n);if(f===void 0)return i;if(f===null)return"";let x=String(f);return ie(r,l,x,!0,i.length)}catch(f){if(f instanceof me)throw f;return i}}),r}function Ry(e,n,r={}){let{output:i,scripts:a}=re(e),l=a.map((u)=>{let f=u.match(/^<script\b((?:[^>\"']|\"[^\"]*\"|'[^']*')*)>/i),x=u.search(/<\/script\s*>$/i);if(!f||x===-1)return u;let v=f[1],I=u.slice(f[0].length,x);if(/\bdata-raw\b/.test(v))return u;if(r.skipServer&&/\bserver\b/.test(v))return u;let W=`<script${Kg(v,n)}>`;if(/\bsrc\s*=/.test(v)||/\btype\s*=\s*["']application\/json["']/.test(v))return W+I+u.slice(x);return W+zi(I,n)+u.slice(x)});return Ir(i,l)}function*wo(e,n,r,i){let a=e,l=(N,H)=>{let Z=_n(N,H);if(Z===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(N.slice(H,Z))?-1:Z},u=(N,H,Z,U)=>{let V=Z.length,{output:K,tokens:ne}=xe(N,H,(ae,de)=>U(V+de));return Z.push(...ne),K},f=[];a=u(a,l,f,(N)=>`<!--__STX_STYLE_${N}__-->`);let x=[];a=u(a,Q,x,(N)=>`<!--__STX_SCRIPT_EXPR_${N}__-->`);let v=n?.__stx_signals_gate===!0||Oe(e),I=new Set([...Array.isArray(n?.__stx_client_signal_names)?n.__stx_client_signal_names:[],...Bi(_o(x))]),D=new Set(Array.isArray(n?.__stx_preserved_client_expressions)?n.__stx_preserved_client_expressions:[]);a=Pn(a,(N,H,Z)=>{if(B(H,I))return N;try{let U=O(H,n,!1,(V)=>nr(V,N,r,e));return U!==void 0&&U!==null?String(U):""}catch(U){let V=U instanceof Error?U.message:String(U);return y("Expression",`Error evaluating: {{{ ${H.trim()}}}}: ${V}`,r,e,Z,N)}},3),a=a.replace(/\{!!([\s\S]*?)!!\}/g,(N,H,Z)=>{if(B(H,I))return N;try{let U=O(H,n,!1,(V)=>nr(V,N,r,e));if(U===void 0&&n.__stx_buildMode==="compile")return os("raw",H.trim());return U!==void 0&&U!==null?String(U):""}catch(U){if(n.__stx_buildMode==="compile")return os("raw",H.trim());let V=U instanceof Error?U.message:String(U);return y("Expression",`Error evaluating: {!! ${H.trim()} !!}: ${V}`,r,e,Z,N)}}),a=u(a,Q,x,(N)=>`<!--__STX_SCRIPT_EXPR_${N}__-->`),a=u(a,l,f,(N)=>`<!--__STX_STYLE_${N}__-->`);let W=v?qg(a):[],L=ps(a).map((N)=>({...N,names:new Set(se(`${N.binding} in __slot`))})),z=new Set(gt(n));if(a=yield*yo(a,(N,H,Z)=>{let U=H.trim();if(Vc(a,Z,H))return N;if(lo(L,Z,U))return N;if(B(U,z))return N;if(W.length>0&&lo(W,Z,U))return N;if(D.has(U))return N;let V=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],K=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,ae=U.match(K)?.[1],de=ae&&((ae in n)||V.includes(ae)),pe=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,Ee=U.match(pe),Ce=Ee&&!V.includes(Ee[1])&&!(Ee[1]in n);if(/^__[A-Z_]+__$/.test(U))return"";if(B(U,I))return N;if(n.__stx_native_screen===!0&&Zc(U,n))return N;let $e;try{let ye=O(H,n,!1,(tt)=>{$e=tt});if(v&&!uo(U,n))return N;if($e)nr($e,N,r,e);if(n.__stx_buildMode==="compile"&&!v&&(ye===void 0||Jc(U,n)))return os("expr",U);if(ye===void 0||ye===null)return"";let He=String(ye);return ie(a,Z,He,!1,N.length)}catch(ye){if(ye instanceof me)throw ye;if(v&&!uo(U,n))return N;if(Ce)return N;let He=ye instanceof Error?ye.message:String(ye);return y("Expression",`Error evaluating: {{ ${U} }}: ${He}`,r,e,Z,N)}},2,i),x.length>0)a=a.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(N,H)=>x[Number(H)]??N);if(f.length>0)a=a.replace(/<!--__STX_STYLE_(\d+)__-->/g,(N,H)=>f[Number(H)]??N);return a}function P(e,n,r){return bo(wo(e,n,r,Number.POSITIVE_INFINITY))}var Gc=100;async function Hi(e,n,r,i=Gc){let a=wo(e,n,r,i),l=a.next();while(!l.done)await R(),l=a.next();return l.value}function Gg(e,n,r){if(!n.trim())return e;let i=e,a=n.trim();while(a.length>0){let l=a.match(/^(\w+)/);if(!l)break;let u=l[1];a=a.substring(u.length).trim();let f=bn[u]||io[u];if(!f)throw Error(`Filter not found: ${u}. Available filters: ${Object.keys(Wg()).join(", ")}`);let x=[];if(a.startsWith(":")){let v=a.match(/^:([^|\s]+)/);if(v){let I=v[1].trim();try{let D=Number(I);x=[Number.isNaN(D)?I:D]}catch{x=[I]}a=a.substring(v[0].length).trim()}}else if(a.startsWith("(")){let v=1,I=1;while(v>0&&I<a.length){if(a[I]==="(")v++;if(a[I]===")")v--;I++}if(v===0){let D=a.substring(1,I-1).trim();if(D)try{if(D.startsWith("{")&&D.endsWith("}"))x=[O(`(${D})`,r,!0)];else{let W=[],L="",z=null,N=0,H=0,Z=0,U=!1;for(let V=0;V<D.length;V++){let K=D[V];if(U){L+=K,U=!1;continue}if(K==="\\"){L+=K,U=!0;continue}if(z){if(L+=K,K===z)z=null;continue}if(K==='"'||K==="'"||K==="`"){z=K,L+=K;continue}if(K==="(")N++;else if(K===")")N--;else if(K==="[")H++;else if(K==="]")H--;else if(K==="{")Z++;else if(K==="}")Z--;if(K===","&&N===0&&H===0&&Z===0){W.push(L),L="";continue}L+=K}if(L)W.push(L);x=W.map((V)=>{let K=V.trim();return O(K,r,!0)})}}catch{x=[D]}a=a.substring(I).trim()}}try{i=f(i,r,...x)}catch(v){let I=v instanceof Error?v.message:String(v);throw Error(`Error applying filter '${u}': ${I}`)}if(a.startsWith("|"))a=a.substring(1).trim();else break}return i}function Yc(e){let n=!1,r="",i=0,a=0,l=0,u=!1;for(let f=0;f<e.length;f++){let x=e[f],v=e[f+1];if(n&&u){u=!1;continue}if(n&&x==="\\"){u=!0;continue}if(u=!1,(x==='"'||x==="'"||x==="`")&&!u){if(!n)n=!0,r=x;else if(x===r)n=!1,r="";continue}if(n&&r==="`"&&x==="$"&&v==="{"){let I=1;f+=2;while(f<e.length&&I>0){if(e[f]==="{")I++;else if(e[f]==="}")I--;if(I>0)f++}continue}if(n)continue;if(x==="(")i++;else if(x===")")i--;else if(x==="[")a++;else if(x==="]")a--;else if(x==="{")l++;else if(x==="}")l--;if(x==="|"&&i===0&&a===0&&l===0){if(v==="|"){f++;continue}if(v==="="){f++;continue}return f}}return-1}var xn=new Set,$l=1000;function Ay(){xn.clear()}function nr(e,n,r,i){if(!te())return;let a=`${r}\x00${e.expression}`;if(xn.has(a))return;if(xn.size>=$l)xn.clear();xn.add(a);let l=r,u=i;try{if(r&&Gi.existsSync(r))u=Gi.readFileSync(r,"utf8")}catch{}let f=u.indexOf(n);if(f>=0)l=`${r}:${u.slice(0,f).split(`
218
+ `).length}`;console.warn(`${l}: stx warning: ${n} rendered as an empty string. The safe evaluator rejected \`${e.expression}\` (${e.rule}). Compute the value in <script server> and interpolate the variable instead.`)}function O(e,n,r=!1,i){try{let a=e.trim(),l=Yc(a);if(l>0){let f=a.substring(0,l).trim(),x=a.substring(l+1).trim(),v=O(f,n,!0,i);return Gg(v,x,n)}let u=co(a);if(u!==null){i?.({expression:a,rule:u});return}try{let f=Object.keys(n),x=Object.values(n);return p(a,f)(...x)}catch{return d(a,n)}}catch(a){if(a instanceof ReferenceError){let l=/(\b\w+)\s+is not defined/.exec(a.message);if(l){let u=l[1],f=El(u,Object.keys(n));if(f&&f!==u)a.message=`${a.message} \u2014 did you mean '${f}'?`}}if(!r)console.error(`Error evaluating expression: ${e}`,a);throw a}}function El(e,n){let r=null;for(let a of n){if(a===e)continue;let l=Rl(e,a);if(r===null||l<r.dist)r={key:a,dist:l}}if(!r)return null;let i=Math.max(e.length,r.key.length);if(r.dist<=2||r.dist/i<=0.35)return r.key;return null}function Rl(e,n){if(e===n)return 0;if(e.length===0)return n.length;if(n.length===0)return e.length;let[r,i]=e.length<n.length?[e,n]:[n,e],a=Array(r.length+1),l=Array(r.length+1);for(let u=0;u<=r.length;u++)a[u]=u;for(let u=1;u<=i.length;u++){l[0]=u;for(let f=1;f<=r.length;f++){let x=r[f-1]===i[u-1]?0:1;l[f]=Math.min(l[f-1]+1,a[f]+1,a[f-1]+x)}for(let f=0;f<=r.length;f++)a[f]=l[f]}return a[r.length]}function Py(e){if(!e)return"";return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}import Al from"process";function A(e="STX_PUBLIC_"){let n={},r={};for(let[i,a]of Object.entries(Al.env)){if(!i.startsWith(e)||a===void 0)continue;n[`import.meta.env.${i}`]=JSON.stringify(a),r[i]=a}return n["import.meta.env"]=JSON.stringify(r),n}function So(e,n=""){let r=`${e}${n}`,i=0;for(let a=0;a<r.length;a++){let l=r.charCodeAt(a);i=(i<<5)-i+l,i=i&i}return`stx-${Math.abs(i).toString(36)}`}function vo(e,n,r={}){let{prefix:i="",preserveHost:a=!0,scopeKeyframes:l=!0,scopeCustomProperties:u=!1}=r;if(!e.trim())return"";let f=sr(e),x=[],v=new Map;if(l)for(let I of f){let D=I.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(D){let W=D[1],L=`${n}_${W}`;v.set(W,L)}}for(let I of f){let D=$o(I,n,i,a,v,u);x.push(D)}return x.join(`
219
+
220
+ `)}function sr(e){let n=[],r=e.replace(/\/\*[\s\S]*?\*\//g,""),i=0,a="",l=!1,u="";for(let f=0;f<r.length;f++){let x=r[f];if(x==="@"&&i===0)l=!0;if(x==="{")i++;else if(x==="}"){if(i--,i===0){if(l){u+=x;let v=u.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(v){let[,I,D,W]=v;if(I==="keyframes")n.push({selector:`@keyframes ${D.trim()}`,declarations:W.trim()});else if(I==="media"||I==="supports"||I==="container"){let L=sr(W);n.push({selector:`@${I} ${D.trim()}`,declarations:L.map((z)=>`${z.selector} { ${z.declarations} }`).join(`
221
+ `)})}else n.push({selector:`@${I} ${D.trim()}`,declarations:W.trim()})}u="",l=!1}else if(a.trim()){a+=x;let v=a.match(/([^{]+)\{([^}]*)\}/);if(v)n.push({selector:v[1].trim(),declarations:v[2].trim()});a=""}continue}}if(l)u+=x;else a+=x}return n}function $o(e,n,r,i,a,l){let{selector:u,declarations:f}=e;if(u.startsWith("@")){if(u.startsWith("@keyframes")){let I=u.replace("@keyframes ","").trim();return`@keyframes ${a.get(I)||I} { ${f} }`}if(u.startsWith("@media")||u.startsWith("@supports")||u.startsWith("@container")){let D=sr(`x { ${f} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((W)=>$o(W,n,r,i,a,l)).join(`
222
+ `);return`${u} {
223
+ ${D}
224
+ }`}return`${u} { ${f} }`}let x=Tl(u,n,r,i),v=f;for(let[I,D]of a)v=v.replace(new RegExp(`\\b${I}\\b`,"g"),D);if(l)v=v.replace(/--([a-z-]+)/gi,`--${n}-$1`);return`${x} { ${v} }`}function Tl(e,n,r,i){let a=e.split(",").map((u)=>u.trim()),l=[];for(let u of a){if(u.startsWith(":host")){if(i)l.push(u);else{let v=u.replace(/:host(\([^)]*\))?/,`.${n}$1`);l.push(v)}continue}if(u.includes("::slotted")){l.push(u);continue}if(u===":root"){l.push(`:root .${n}`);continue}let f=r?`${r} .${n}`:`.${n}`;l.push(`${f} ${u}`);let x=Il(u,n);if(x)l.push(r?`${r} ${x}`:x)}return l.join(", ")}function Il(e,n){let r=0,i=e.length;for(let x=0;x<e.length;x++){let v=e[x];if(v==="["||v==="(")r++;else if(v==="]"||v===")")r--;else if(r===0&&(v===" "||v===">"||v==="+"||v==="~")){i=x;break}}let a=e.slice(0,i),l=e.slice(i);if(!a)return"";let u=a.length,f=0;for(let x=0;x<a.length;x++){let v=a[x];if(v==="["||v==="(")f++;else if(v==="]"||v===")")f--;else if(r===0&&f===0&&v===":"){u=x;break}}return`${a.slice(0,u)}.${n}${a.slice(u)}${l}`}var Co=String.raw`(?<![\w-])scoped(?![\w-])`,rr=/<style\s+([^>]*)>/gi,Eo=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,Ro=new RegExp(Co,"i"),Pl=new RegExp(Co,"gi"),ir=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function Ol(e){rr.lastIndex=0;let n=rr.exec(e);while(n!==null){if(Ro.test(n[1]))return!0;n=rr.exec(e)}return!1}function Ni(e){let n=new Set,r=[];ir.lastIndex=0;let i=ir.exec(e);while(i!==null){let a=i[0].trim();if(n.has(a))r.push({start:i.index,end:i.index+i[0].length});else n.add(a);i=ir.exec(e)}return r}function En(e){let n=Ni(e);if(n.length===0)return e;let r=Array(n.length+1),i=0;for(let a=0;a<n.length;a++){let l=n[a];r[a]=e.slice(i,l.start),i=l.end}return r[n.length]=e.slice(i),r.join("")}function to(e,n){if(!Ol(e))return{html:e,hasScoped:!1};let r=So(n),i=`data-v-${r}`,a=e,l=!1;if(Eo.lastIndex=0,a=a.replace(Eo,(u,f,x)=>{if(!Ro.test(f))return u;l=!0;let v=Ml(x,i),I=f.replace(Pl,"").trim(),D=I?` ${I}`:"";return`<style data-stx-scoped="${r}"${D}>${v}</style>`}),!l)return{html:e,hasScoped:!1};return a=zl(a,i),{html:a,hasScoped:!0}}function Ml(e,n){return vo(e,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${n}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${n}]`)}var Dl=(e)=>`\x00stx-scope-mask-${e}\x00`,ko=/\u0000stx-scope-mask-(\d+)\u0000/g;function zl(e,n){let r=xe(e,(a,l)=>{let u=Q(a,l);return u>l?u:_n(a,l)},(a,l)=>Dl(l)),i=Bl(r.output,n);return ko.lastIndex=0,i.replace(ko,(a,l)=>r.tokens[Number(l)])}function Bl(e,n){let r=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return e.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(i,a,l)=>{if(r.has(a.toLowerCase()))return i;if(i.includes(n))return i;if(a.toLowerCase()==="style"||a.toLowerCase()==="script")return i;if(l)return i.replace(`<${a}${l}`,`<${a} ${n}${l}`);if(i.endsWith("/>"))return`<${a} ${n} />`;return`<${a} ${n}>`})}var yn=/<\/?template\b[^>]*>/gi,Wl=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function Fl(e){let n=e.replace(/^<template\b/i,"").replace(/>$/,"");return Wl.test(n)}function j(e){yn.lastIndex=0;let n;while((n=yn.exec(e))!==null){if(n[0].startsWith("</")||Fl(n[0]))continue;let r=n.index,i=yn.lastIndex,a=1,l;while((l=yn.exec(e))!==null)if(l[0].startsWith("</")){if(a--,a===0){let u=l.index;return{start:r,openEnd:i,closeStart:u,end:yn.lastIndex,content:e.slice(i,u)}}}else a++;return null}return null}var Vl=0,Ul=0;function fs(e,n){let r=/(?:^|\s)([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g;for(let i of e.matchAll(r))if(i[1].toLowerCase()===n.toLowerCase())return i[2]??i[3]??i[4]??null;return null}function To(e){let n=[],r=/<([a-z][a-z0-9-]*)\b((?:"[^"]*"|'[^']*'|[^>"'])*)>/iy;return w(e,(i,a)=>{r.lastIndex=a;let l=r.exec(i);if(!l||!fs(l[2],"x-data"))return-1;return n.push({fullMatch:l[0],tagName:l[1],attributes:l[2],startIndex:a,endIndex:r.lastIndex}),r.lastIndex}),n}function Hl(e){let n=[];for(let{fullMatch:r,tagName:i,attributes:a,startIndex:l}of To(e)){let u=fs(a,"x-data");if(!u)continue;let f=`__stx_scope_${Vl++}`,x=fs(a,"x-init"),v=Kl(e,i,l+r.length),I=e.slice(l,v.endIndex),D=ql(I);n.push({id:f,selector:`[data-stx-scope="${f}"]`,stateExpr:u,initExpr:x,bindings:[],refs:D})}return n}function Kl(e,n,r){let i=1,a=r,l=new RegExp(`<${n}(?:\\s|>)`,"gi"),u=new RegExp(`</${n}>`,"gi"),f=new RegExp(`<${n}[^>]*/\\s*>`,"gi");while(i>0&&a<e.length){l.lastIndex=a,u.lastIndex=a,f.lastIndex=a;let x=l.exec(e),v=u.exec(e),I=f.exec(e);if(I&&I.index<(x?.index??1/0)){a=I.index+I[0].length;continue}if(!v)return{endIndex:e.length};if(x&&x.index<v.index)i++,a=x.index+x[0].length;else{if(i--,i===0)return{endIndex:v.index+v[0].length};a=v.index+v[0].length}}return{endIndex:e.length}}function ql(e){let n=new Map,r=e.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),i=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,a;while((a=i.exec(r))!==null){let[,l,u]=a,f=Zl(l);n.set(u,f)}return n}function Zl(e){let n=e.match(/\bid\s*=\s*["']([^"']*)["']/);if(n)return n[1];return`__stx_el_${Ul++}`}function Jl(){return`
225
+ // STX Reactive Runtime - x-cloak and transition CSS
226
+ (function() {
227
+ var style = document.createElement('style');
228
+ style.textContent = [
229
+ '[x-cloak] { display: none !important; }',
230
+ // Default transition classes
231
+ '.stx-enter { opacity: 0; transform: scale(0.95); }',
232
+ '.stx-enter-start { opacity: 0; transform: scale(0.95); }',
233
+ '.stx-enter-active { transition: opacity 150ms ease-out, transform 150ms ease-out; }',
234
+ '.stx-enter-to { opacity: 1; transform: scale(1); }',
235
+ '.stx-leave { opacity: 1; transform: scale(1); }',
236
+ '.stx-leave-start { opacity: 1; transform: scale(1); }',
237
+ '.stx-leave-active { transition: opacity 100ms ease-in, transform 100ms ease-in; }',
238
+ '.stx-leave-to { opacity: 0; transform: scale(0.95); }'
239
+ ].join('\\n');
240
+ document.head.appendChild(style);
241
+ })();
242
+
243
+ // STX Reactive Runtime
244
+ /* eslint-disable pickier/no-unused-vars, no-console, prefer-const */
245
+ window.__stx_reactive = (function() {
246
+ 'use strict';
247
+
248
+ // Deep reactive proxy that triggers onChange for any mutation
249
+ function reactive(obj, onChange) {
250
+ if (!obj || typeof obj !== 'object') return obj;
251
+ return new Proxy(obj, {
252
+ get(target, prop) {
253
+ const value = target[prop];
254
+ if (value && typeof value === 'object' && !Array.isArray(value) && !(value instanceof Promise)) {
255
+ return reactive(value, onChange);
256
+ }
257
+ return value;
258
+ },
259
+ set(target, prop, value) {
260
+ target[prop] = value;
261
+ onChange(prop, value);
262
+ return true;
263
+ }
264
+ });
265
+ }
266
+
267
+ // Initialize an x-data scope: parse state, run init(), register into window.stx._scopes,
268
+ // then let the signals runtime handle all directive processing (x-for, x-text, :bind, etc.)
269
+ function initScope(scopeEl, initialState, bindings, refs, initExpr, deferInit) {
270
+ // Parse initial state (may contain methods including async init())
271
+ var state;
272
+ try {
273
+ state = new Function('return (' + initialState + ')')();
274
+ } catch (e) {
275
+ console.error('[stx-reactive] Invalid x-data:', initialState, e);
276
+ return;
277
+ }
278
+
279
+ // Build $refs object
280
+ var $refs = {};
281
+ for (var name in refs) {
282
+ if (Object.prototype.hasOwnProperty.call(refs, name)) {
283
+ (function(refName, refId) {
284
+ Object.defineProperty($refs, refName, {
285
+ get: function() { return document.getElementById(refId); }
286
+ });
287
+ })(name, refs[name]);
288
+ }
289
+ }
290
+
291
+ // Extract init method from state if present (Alpine.js convention)
292
+ var initMethod = state.init;
293
+ if (typeof initMethod === 'function') {
294
+ delete state.init;
295
+ }
296
+
297
+ // Make state reactive \u2014 mutations trigger re-render via signals
298
+ var scopeId = scopeEl.getAttribute('data-stx-scope');
299
+ var stx = window.stx;
300
+
301
+ // Create signals for each state property so the signals runtime can track dependencies
302
+ var signalState = {};
303
+ var rawState = {};
304
+ var derivedState = {};
305
+ var accessors = {};
306
+ // A getter must NOT be read here. Reading one calls it, and the old loop did
307
+ // exactly that: the returned value is not a function, so it was wrapped as a
308
+ // plain state() -- a snapshot of the answer at construction time, frozen
309
+ // forever while plain properties beside it updated (#2053). A getter is a
310
+ // derived value, so it is registered as one below, once ctxProxy exists for
311
+ // it to read through.
312
+ var ownDescriptors = Object.getOwnPropertyDescriptors ? Object.getOwnPropertyDescriptors(state) : {};
313
+ for (var key in state) {
314
+ if (Object.prototype.hasOwnProperty.call(state, key)) {
315
+ var descriptor = ownDescriptors[key];
316
+ if (descriptor && typeof descriptor.get === 'function') {
317
+ accessors[key] = descriptor;
318
+ continue;
319
+ }
320
+ if (typeof state[key] === 'function') {
321
+ // Methods \u2014 bind to a proxy so 'this.prop = val' triggers signal updates
322
+ signalState[key] = state[key];
323
+ } else {
324
+ // Data properties \u2014 wrap in signals for reactivity
325
+ signalState[key] = stx.state(state[key]);
326
+ rawState[key] = true;
327
+ }
328
+ }
329
+ }
330
+
331
+ // Create a proxy context that auto-unwraps signals and writes back through them.
332
+ // Methods get 'this' bound to this proxy so this.foo = bar triggers reactivity.
333
+ var ctx = {};
334
+ var ctxProxy = new Proxy(ctx, {
335
+ get: function(target, prop) {
336
+ if (prop === '$refs') return $refs;
337
+ if (prop === '$el') return scopeEl;
338
+ if (prop === '$nextTick') return function(fn) { requestAnimationFrame(fn); };
339
+ if (prop === Symbol.unscopables) return undefined;
340
+ if (!(prop in signalState)) {
341
+ var owner = stx._scopeForBinding(scopeEl, prop);
342
+ return owner ? owner[prop] : undefined;
343
+ }
344
+ var s = signalState[prop];
345
+ if (!s) return undefined;
346
+ if (rawState[prop] && s && typeof s === 'function' && typeof s.value !== 'undefined') {
347
+ return s.value; // unwrap signal
348
+ }
349
+ if (typeof s === 'function' && !rawState[prop]) {
350
+ return s.bind(ctxProxy); // bind methods to proxy
351
+ }
352
+ return s;
353
+ },
354
+ set: function(target, prop, value) {
355
+ var accessor = derivedState[prop];
356
+ if (accessor) {
357
+ // A getter/setter pair writes through its setter. A getter alone has
358
+ // nowhere to put the value: a derived has no .value setter, so the
359
+ // assignment would be a silent no-op, which is the same class of
360
+ // failure as the stale read this replaces.
361
+ if (typeof accessor.set === 'function') {
362
+ accessor.set.call(ctxProxy, value);
363
+ return true;
364
+ }
365
+ console.warn('[stx-reactive] cannot assign to ' + String(prop) + ': it is a getter in x-data, so its value comes from what it reads. Give it a setter, or make it a plain property.');
366
+ return true;
367
+ }
368
+ var s = signalState[prop];
369
+ if (rawState[prop] && s && typeof s === 'function') {
370
+ s.value = value; // write through signal \u2014 triggers effects
371
+ } else {
372
+ signalState[prop] = value;
373
+ }
374
+ return true;
375
+ },
376
+ has: function(target, prop) {
377
+ return prop in signalState || prop === '$refs' || prop === '$el' || prop === '$nextTick' || !!stx._scopeForBinding(scopeEl, prop);
378
+ },
379
+ ownKeys: function() {
380
+ return Object.keys(signalState).concat(['$refs', '$el', '$nextTick']);
381
+ },
382
+ getOwnPropertyDescriptor: function(target, prop) {
383
+ if (prop in signalState || prop === '$refs' || prop === '$el' || prop === '$nextTick') {
384
+ return { configurable: true, enumerable: true, writable: true, value: ctxProxy[prop] };
385
+ }
386
+ return undefined;
387
+ }
388
+ });
389
+
390
+ // Now that ctxProxy exists, a getter becomes a derived that reads through it,
391
+ // so it tracks whatever it touches and recomputes when that changes. derived()
392
+ // is lazy, so nothing is evaluated until a binding actually reads it.
393
+ //
394
+ // Marked rawState as well: that is what makes the proxy unwrap it and what
395
+ // exposes the signal itself to the runtime below, which is where dependency
396
+ // tracking comes from. A getter needs both, exactly like a data property.
397
+ for (var accessorKey in accessors) {
398
+ if (Object.prototype.hasOwnProperty.call(accessors, accessorKey)) {
399
+ (function(name, descriptor) {
400
+ signalState[name] = stx.derived(function() {
401
+ return descriptor.get.call(ctxProxy);
402
+ });
403
+ rawState[name] = true;
404
+ derivedState[name] = descriptor;
405
+ })(accessorKey, accessors[accessorKey]);
406
+ }
407
+ }
408
+
409
+ // Build scope vars for the signals runtime \u2014 it reads these for expression evaluation.
410
+ // We need to provide getter/setter descriptors so signals track properly.
411
+ var scopeVars = {};
412
+ for (var k in signalState) {
413
+ if (Object.prototype.hasOwnProperty.call(signalState, k)) {
414
+ if (rawState[k]) {
415
+ // Data: expose the signal directly so expressions trigger dependency tracking
416
+ scopeVars[k] = signalState[k];
417
+ } else {
418
+ // Method: bind to ctxProxy so 'this' works
419
+ scopeVars[k] = (typeof signalState[k] === 'function') ? signalState[k].bind(ctxProxy) : signalState[k];
420
+ }
421
+ }
422
+ }
423
+ scopeVars.$refs = $refs;
424
+ scopeVars.$el = scopeEl;
425
+ scopeVars.$nextTick = function(fn) { requestAnimationFrame(fn); };
426
+
427
+ // Register scope \u2014 merge with any existing vars from partial signal scripts
428
+ if (!stx._scopes) stx._scopes = {};
429
+ var registered = stx._scopes[scopeId] = Object.assign(stx._scopes[scopeId] || {}, scopeVars);
430
+ registered.__el = scopeEl;
431
+
432
+ // Store on element for findElementScope
433
+ scopeEl.__stx_scope = scopeVars;
434
+
435
+ // Run init() if present (supports async)
436
+ function runInit() {
437
+ var maybePromise;
438
+ if (initMethod) {
439
+ maybePromise = initMethod.call(ctxProxy);
440
+ }
441
+ if (initExpr) {
442
+ try {
443
+ var fn = new Function('with(this){' + initExpr + ';}');
444
+ var result = fn.call(ctxProxy);
445
+ if (result && typeof result.then === 'function') maybePromise = result;
446
+ } catch (e) {
447
+ console.warn('[stx-reactive] init expression error:', e);
448
+ }
449
+ }
450
+ // If init is async, signal updates will trigger effects automatically
451
+ // when init() resolves and sets this.prop = value (writes through signal)
452
+ if (maybePromise && typeof maybePromise.then === 'function') {
453
+ maybePromise.catch(function(e) {
454
+ console.error('[stx-reactive] async init() error:', e);
455
+ });
456
+ }
457
+ }
458
+
459
+ // A component's helper setup follows its markup. Its own mount queue
460
+ // starts the initializer after all component factories have registered.
461
+ // Standalone x-data retains synchronous initialization.
462
+ if (deferInit) {
463
+ registered.__mountCallbacks = registered.__mountCallbacks || [];
464
+ registered.__mountCallbacks.push(runInit);
465
+ } else {
466
+ runInit();
467
+ }
468
+ var destroyExpr = scopeEl.getAttribute('data-stx-xdestroy') || scopeEl.getAttribute('x-destroy');
469
+ if (destroyExpr) {
470
+ registered.__destroyCallbacks = registered.__destroyCallbacks || [];
471
+ var teardown = function() { scopeEl.__stx_execute(destroyExpr); };
472
+ registered.__destroyCallbacks.push(teardown);
473
+ registered.__destroyHooks = registered.__destroyHooks || [];
474
+ registered.__destroyHooks.push(teardown);
475
+ }
476
+
477
+ // Expose for debugging
478
+ scopeEl.__stx_state = ctxProxy;
479
+ scopeEl.__stx_execute = function(stmt, $event, $el) {
480
+ try {
481
+ // Run the statement with the reactive proxy as the lexical scope.
482
+ // Wrapping in a with-block on the proxy makes bare reads/writes go
483
+ // through it (so foo = bar triggers signal.set()) instead of treating
484
+ // each state key as a local function parameter \u2014 bare assignments
485
+ // would otherwise just rebind the local and never reach the signal.
486
+ var fn = new Function('$event', '$el', 'with(this){' + stmt + ';}');
487
+ fn.call(ctxProxy, $event, $el);
488
+ } catch (e) {
489
+ console.warn('[stx-reactive] execute error:', e);
490
+ }
491
+ };
492
+ }
493
+
494
+ return { initScope: initScope, reactive: reactive };
495
+ })();
496
+ `}function Ao(e,n){let r=e.replace(/\{!!([\s\S]*?)!!\}/g,(f,x)=>{try{let v=O(x,n,!0);if(v===void 0)return f;return String(v)}catch{return f}}),i="",a=0,l=null;while(a<r.length){let f=r[a];if(l&&f==="\\"){i+=f+(r[a+1]??""),a+=2;continue}if(f==="{"&&r[a+1]==="{"){let x=r.indexOf("}}",a+2);if(x!==-1){let v=r.slice(a,x+2);i+=u(r.slice(a+2,x),v,l),a=x+2;continue}}if(l){if(f===l)l=null}else if(f==="'"||f==='"'||f==="`")l=f;i+=f,a++}return i;function u(f,x,v){let I;try{I=O(f,n,!0)}catch{return x}if(I===void 0)return x;if(v){let D=String(I).replace(/\\/g,"\\\\").replace(new RegExp(v==="`"?"`":v,"g"),`\\${v}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return v==="`"?D.replace(/\$\{/g,"\\${"):D}if(typeof I==="string"){let D=I.trim();if(D.startsWith("{")&&D.endsWith("}")||D.startsWith("[")&&D.endsWith("]"))try{return JSON.parse(D),D}catch{}}return JSON.stringify(I)}}function Xl(e,n,r){if(e.length===0)return"";let i=e.map((a)=>{let l=JSON.stringify(Object.fromEntries(a.refs)),u=Ao(a.stateExpr,n),f=a.initExpr?Ao(a.initExpr,n):null,x=JSON.stringify(u),v=f?JSON.stringify(f):"null";return`
497
+ (function() {
498
+ var scopeEl = document.querySelector('${a.selector}');
499
+ if (!scopeEl) return;
500
+ var refs = ${l};
501
+ window.__stx_reactive.initScope(scopeEl, ${x}, [], refs, ${v}${r?", true":""});
502
+ })();`}).join(`
503
+ `);return`
504
+ <script data-stx-scoped data-stx-reactive data-stx-run="always">
505
+ ${Jl()}
506
+ ${i}
507
+ </script>`}function ul(e,n,r,i=!1){if(!or(e))return e;let a=Hl(e);if(a.length===0)return e;let l=Gl(e,a),u=Xl(a,n,i),f=c(l);if(f!==-1)l=l.slice(0,f)+u+`
508
+ `+l.slice(f);else l+=u;return l}function Gl(e,n){let r=[],i=0;for(let[l,u]of To(e).entries()){let f=n[l];if(!f)break;r.push(e.slice(i,u.startIndex));let x=fs(u.attributes,"data-stx-scope");if(x)f.id=x,f.selector=`[data-stx-scope="${f.id}"]`,r.push(u.fullMatch);else r.push(`<${u.tagName} data-stx-scope="${f.id}"${u.attributes}>`);i=u.endIndex}r.push(e.slice(i));let a=r.join("");return a=a.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),a=a.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),a=a.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),a=a.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),a=a.replace(/\s*x-destroy\s*=\s*"([^"]*)"/g,' data-stx-xdestroy="$1"'),a=a.replace(/\s*x-destroy\s*=\s*'([^']*)'/g," data-stx-xdestroy='$1'"),a}function or(e){return/x-data\s*=\s*["']/.test(e)}function ro(e,n){let r=e,i=/@json\s*\(/g,a;while((a=i.exec(r))!==null){let l=a.index,u=l+a[0].length-1,f=1,x=u+1,v=null,I=!1;while(x<r.length&&f>0){let V=r[x];if(I){I=!1,x++;continue}if(V==="\\"&&v){I=!0,x++;continue}if(v){if(V===v)v=null;x++;continue}if(V==='"'||V==="'"||V==="`"){v=V,x++;continue}if(V==="(")f++;else if(V===")"){if(f--,f===0)break}x++}if(f!==0)break;let D=r.substring(u+1,x).trim(),W=r.substring(l,x+1),L=-1,z=0,N=null,H=!1;for(let V=0;V<D.length;V++){let K=D[V];if(H){H=!1;continue}if(K==="\\"&&N){H=!0;continue}if(N){if(K===N)N=null;continue}if(K==='"'||K==="'"||K==="`"){N=K;continue}if(K==="("||K==="["||K==="{")z++;else if(K===")"||K==="]"||K==="}")z--;if(K===","&&z===0){L=V;break}}let Z=L>=0?D.substring(0,L).trim():D,U=L>=0?D.substring(L+1).trim():void 0;try{let V=Z.trim(),K;if(m(V))K=p(V,Object.keys(n))(...Object.values(n));else K=void 0;let ne;if(U==="true")ne=JSON.stringify(K,null,2);else ne=JSON.stringify(K);let ae=ne.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");r=r.substring(0,l)+ae+r.substring(x+1),i.lastIndex=l+ae.length}catch(V){q.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),i.lastIndex=l+W.length}}return r}function so(e){return e.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function dl(e){let n=e,r=/@memo\s*\(/g,i,a=[];while((i=r.exec(n))!==null){let l=i.index,u=l+i[0].length,f=1,x=u;while(x<n.length&&f>0){if(n[x]==="(")f++;else if(n[x]===")")f--;x++}if(f!==0)continue;let v=n.slice(u,x-1).trim(),I=x,D=n.slice(I),W=D.indexOf("@endmemo");if(W===-1)continue;let L=D.slice(0,W),z=I+W+8,N=Ht(L),H=L.slice(N),Z=L.match(/(\s*)$/),U=Z?Z[0].length:0,V=H.slice(0,H.length-U),K=V.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),ne;if(K){let[ae,de,pe="",Ee]=K,Ce=`<${de}${pe} data-stx-memo="${v}"${Ee}>`;ne=L.slice(0,N)+Ce+V.slice(ae.length)+L.slice(N+V.length)}else ne=`${L.slice(0,N)}<div data-stx-memo="${v}">${V}</div>${L.slice(N+V.length)}`;a.push({start:l,end:z,replacement:ne}),r.lastIndex=z}for(let l=a.length-1;l>=0;l--){let u=a[l];n=n.slice(0,u.start)+u.replacement+n.slice(u.end)}return n.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function Mi(e){let n=e.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return n=n.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),n}function jo(e,n){let r=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,i=w(e,(f,x)=>{r.lastIndex=x;let v=r.exec(f);if(!v||/^(?:script|style)$/i.test(v[1]))return-1;return r.lastIndex}),a=[],l=0,u=[];for(let{start:f,end:x,token:v}of i){let I=/^<\/?([\w-]+)/.exec(v)[1].toLowerCase();if(v.startsWith("</")){while(a.length&&a.pop()!==I);continue}if(!a.length&&!/\sdata-stx-slot-owner\s*=/.test(v))u.push(e.slice(l,f),v.replace(/\s*\/?>$/,(D)=>` data-stx-slot-owner="${n}"${D}`)),l=x;if(!ar.has(I)&&!/\/>$/.test(v))a.push(I)}return u.push(e.slice(l)),u.join("")}function Mo(e,n){if(!/\bref\s*=/.test(e))return e;let r=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,i=w(e,(x,v)=>{r.lastIndex=v;let I=r.exec(x);if(!I||/^(?:script|style)$/i.test(I[1]))return-1;return r.lastIndex}),a=[],l=0,u=0,f=[];for(let{start:x,end:v,token:I}of i){let D=/^<\/?([\w-]+)/.exec(I)[1].toLowerCase();if(I.startsWith("</")){let N;while(N=a.pop()){if(N.scoped)l--;if(N.name===D)break}continue}let W=/\sdata-stx-scope\s*=/.test(I),L=/\sdata-stx-ref-caller\s*=\s*(["'])(.*?)\1/.exec(I),z=a.find((N)=>N.scoped)?.scopeId;if(L&&z&&L[2]===z)f.push(e.slice(u,x),I.replace(L[0],` data-stx-ref-caller="${n}"`)),u=v;else if(!l&&!W&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(I)&&!/\sdata-stx-ref-caller\s*=/.test(I))f.push(e.slice(u,x),I.replace(/\s*\/?>$/,(N)=>` data-stx-ref-caller="${n}"${N}`)),u=v;if(!ar.has(D)&&!/\/>$/.test(I)){let N=/\sdata-stx-scope\s*=\s*(?:"([^"]*)"|'([^']*)')/.exec(I);if(a.push({name:D,scoped:W,scopeId:N?.[1]??N?.[2]}),W)l++}}return f.push(e.slice(u)),f.join("")}var ar=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Do=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,Io=/<\/?\s*([a-z][\w-]*)/iy,Yl=/\s/;function Ql(e,n){let r=n-1;while(r>=0&&Yl.test(e[r]))r--;return r>=0&&e[r]==="/"}function eu(e,n){let r=!1,i=!1;for(let a=n;a<e.length;a++){let l=e[a];if(r){if(l==="'")r=!1}else if(i){if(l==='"')i=!1}else if(l==="'")r=!0;else if(l==='"')i=!0;else if(l===">")return a}return-1}function tu(e,n){if(e.indexOf("{",n)===-1||e.indexOf("}",n)===-1)return!1;let r=0,i=n,a=!1,l=!1,u=!1;while(i<e.length){let f=e.indexOf("<",i),x=f===-1?e.length:f;if(x>i){if(r===0)while(i<x){let D=e.indexOf(l?"}":"{",i);if(D===-1||D>=x){if(l)u=!1;else a=!1;break}if(D>i)if(l)u=!1;else a=!1;if(l){if(u)return!0;u=!0}else if(a)l=!0,u=!1;else a=!0;i=D+1}i=x;continue}if(e.startsWith("<!--",i)){let D=e.indexOf("-->",i);i=D===-1?e.length:D+3;continue}let v=eu(e,i);if(v===-1)break;Io.lastIndex=i;let I=Io.exec(e)?.[1]?.toLowerCase()??"";if(e[i+1]==="/"){if(r===0)break;r--}else if(!Ql(e,v)&&!ar.has(I))r++;i=v+1}return!1}var Po=S(256);function pl(e){if(e.length<1024)return Oo(e);let n=_(e),r=Po.get(n);if(r!==void 0)return r;let i=Oo(e);return Po.set(n,i),i}function Oo(e){if(e.length>=32768&&!bi(e))return e;let r=new RegExp(`<(${"div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i"})\\b`,"gi"),i="",a=0,l;while((l=r.exec(e))!==null){let u=l.index,f=u+l[0].length,x=!1,v=!1,I=-1;while(f<e.length){let W=e[f];if(x){if(W==="'")x=!1}else if(v){if(W==='"')v=!1}else if(W==="'")x=!0;else if(W==='"')v=!0;else if(W===">"){I=f;break}f++}if(I===-1)continue;let D=e.slice(u,I+1);if(Do.test(D))continue;if(D.includes("x-cloak"))continue;if(tu(e,I+1))i+=e.slice(a,I)+" x-cloak>",a=I+1}return i+=e.slice(a),i}var nu=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,su=/<\/script>/gi,ru=/<\/style>/gi;function fl(e){let n=/<[a-z][\w-]*/gi,r="",i=0,a;while((a=n.exec(e))!==null){let l=a.index,u=a[0].slice(1).toLowerCase();if(u==="script"||u==="style"){let z=u==="script"?su:ru;z.lastIndex=l;let N=z.exec(e);if(N!==null)n.lastIndex=N.index+N[0].length;continue}let f=l+a[0].length,x=!1,v=!1,I=-1;while(f<e.length){let z=e[f];if(x){if(z==="'")x=!1}else if(v){if(z==='"')v=!1}else if(z==="'")x=!0;else if(z==='"')v=!0;else if(z===">"){I=f;break}f++}if(I===-1)continue;let D=e.slice(l+a[0].length,I);if(Do.test(D))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(D))continue;if(!nu.test(D))continue;let W=e[I-1]==="/",L=W?I-1:I;r+=`${e.slice(i,L)} x-cloak${W?" ":""}`,i=L}return r+=e.slice(i),r}function J(e){let n=new Map;for(let r of e.matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g))n.set(r[1].toLowerCase(),r[2]??r[3]??r[4]??!0);return n}function Lt(e){let n=e.get("type");return typeof n!=="string"||!n.trim()||/^(?:module|(?:text|application)\/(?:javascript|typescript|ecmascript))$/i.test(n.trim())}import ra from"path";import lr from"fs";import wn from"path";function No(e,n,r,i){let a=0;for(let l=n;l<e.length;l++)if(e[l]===r)a++;else if(e[l]===i&&!(i===">"&&e[l-1]==="=")){if(--a===0)return l}return-1}function iu(e){let n=t(e),r=0,i=0,a=[];for(let l=0;l<n.length;l++)if("([{".includes(n[l]))r++;else if(")]}".includes(n[l]))r--;else if(n[l]===","&&r===0)a.push(e.slice(i,l).trim()),i=l+1;return a.push(e.slice(i).trim()),a}function cr(e,n){let r=t(e),i=new RegExp(`\\b(?:${n.map((a)=>a.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let a of r.matchAll(i)){let l=a.index+a[0].length,u="";if(r[l]==="<"){let x=No(r,l,"<",">");if(x<0)continue;u=e.slice(l+1,x),l=x+1;while(/\s/.test(r[l]||"")&&l<r.length)l++}if(r[l]!=="(")continue;let f=No(r,l,"(",")");if(f>=0)return{type:u,args:iu(e.slice(l+1,f))}}return null}var ds=`
509
+ type __StxCtor<T> = T extends StringConstructor ? string : T extends NumberConstructor ? number : T extends BooleanConstructor ? boolean : T extends ArrayConstructor ? unknown[] : T extends ObjectConstructor ? object : T extends readonly unknown[] ? __StxCtor<T[number]> : T extends abstract new (...args: any[]) => infer V ? V : unknown;
510
+ type __StxWiden<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T;
511
+ type __StxOption<T> = T extends { type: infer C } ? __StxCtor<C> : T extends { default: infer D } ? D extends (...args: any[]) => infer V ? V : __StxWiden<D> : __StxCtor<T>;
512
+ type __StxRequired<O> = { [K in keyof O]-?: O[K] extends { required: true } ? K : never }[keyof O];
513
+ type __StxDefaulted<O> = { [K in keyof O]-?: O[K] extends { default: unknown } ? K : never }[keyof O];
514
+ type __StxOptions<O> = { [K in Exclude<__StxRequired<O>, __StxDefaulted<O>>]: __StxOption<O[K]> } & { [K in Exclude<keyof O, Exclude<__StxRequired<O>, __StxDefaulted<O>>>]?: __StxOption<O[K]> };
515
+ type __StxDefaults<P, K> = Omit<P, Extract<keyof P, K>> & Partial<Pick<P, Extract<keyof P, K>>>;
516
+ `;function gs(e,n){let r=[],i={defineProps:["defineProps"],defineEmits:["defineEmits"],withDefaults:["withDefaults"]},a=t(e),l=e.replace(/\bimport\s+(?:type\s+)?(\{[^}]*\}|\*\s+as\s+[\w$]+|[\w$]+)\s+from\s*(['"])([^'"]+)\2\s*;?/g,(W,L,z,N,H)=>{if(a.slice(H,H+6)!=="import")return W;if(N.endsWith(".stx"))return"";let Z=`${n}Import${r.length}`;if(r.push(`import * as ${Z} from ${JSON.stringify(N)};`),L.startsWith("*"))return`import ${L.replace(/^\*\s+as\s+/,"")} = ${Z};`;if(!L.startsWith("{"))return`import ${L} = ${Z}.default;`;return L.slice(1,-1).split(",").map((U)=>{let[V,K=V]=U.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(!V)return"";if(/^(?:stx|@stacksjs\/stx)(?:\/|$)/.test(N)&&V in i)i[V].push(K);return`import ${K} = ${Z}.${V};`}).join(`
517
+ `)}),u=cr(e,i.defineProps),f=cr(e,i.defineEmits),x=cr(e,i.withDefaults);if(!u&&!f)return{declarations:"",props:null,events:null};let v=[],I=null,D=null;if(u){v.push(`const __options = (${u.args[0]||"{}"}) as const;`),v.push(`const __defaults = (${x?.args[1]||"{}"});`);let W=u.type||"__StxOptions<typeof __options>";v.push(`export type __StxProps = __StxDefaults<${W}, keyof typeof __defaults | __StxDefaulted<typeof __options>>;`),I=`${n}.__StxProps`}if(f)v.push(`const __events = (${f.args[0]||"[]"}) as const;`),v.push(`export type __StxEvents = ${f.type||"Record<(typeof __events)[number], any[]>"};`),D=`${n}.__StxEvents`;return{declarations:`${r.join(`
518
+ `)}
519
+ namespace ${n} {
520
+ ${l}
521
+ ${v.join(`
522
+ `)}
523
+ }`,props:I,events:D}}var Mr=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);function Dr(e){if(e.includes("-")||e==="component")return!1;if(/^[A-Z]/.test(e))return!/[a-z]/.test(e)&&[...Mr].some((n)=>n.toLowerCase()===e.toLowerCase());return Mr.has(e)||/[A-Z]/.test(e)}function*ou(e){let n=/<([A-Za-z][\w.-]*)(?=[\s/>])/g,r;while(r=n.exec(e)){let i=n.lastIndex,a=[];while(i<e.length){while(/\s/.test(e[i]||""))i++;if(e[i]===">"||e.slice(i,i+2)==="/>"){i+=e[i]===">"?1:2;break}let l=/^[^\s=/>]+/.exec(e.slice(i))?.[0];if(!l){i++;continue}let u=i;i+=l.length;while(/\s/.test(e[i]||""))i++;if(e[i]!=="="){a.push({name:l,value:!0,offset:u,braced:!1});continue}i++;while(/\s/.test(e[i]||""))i++;let f=e[i],x=f==="{",v=f==='"'||f==="'";if(v||x)i++;let I=i;if(x){let D=t(e.slice(i)),W=1,L=0;for(;L<D.length;L++){if(D[L]==="{")W++;if(D[L]==="}"&&--W===0)break}i+=L}else if(v)while(i<e.length&&e[i]!==f)i++;else while(i<e.length&&!/[\s/>]/.test(e[i]))i++;if(a.push({name:l,value:e.slice(I,i),offset:I,braced:x}),v||x)i++}n.lastIndex=i,yield{name:r[1],offset:r.index,attributes:a}}}function Lo(e,n,r){let i=[],a=[ds,"type __StxAssignedValue<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? T extends () => infer V ? V : T : T;","type __StxProp<P, K> = K extends keyof P ? P[K] : unknown;",'type __StxStaticProp<P, K> = __StxProp<P, K> extends infer T ? boolean extends T ? T | "true" | "false" : T : never;','type __StxEvent<E, K> = K extends keyof E ? E[K] extends readonly unknown[] ? number extends E[K]["length"] ? E[K][0] : Exclude<E[K]["length"], 0 | 1> extends never ? E[K][0] : E[K] : E[K] : any;'],l=new Map,u=new Map,f=new Map,x=r.scriptCode(e,r.filePath),v=t(x);for(let z of x.matchAll(/\bimport\s+(\{[^}]+\}|[\w$]+)\s+from\s*['"]([^'"]+)['"]/g)){if(v.slice(z.index,z.index+6)!=="import")continue;let N=z[2],H=wn.isAbsolute(N)||N.startsWith(".")?wn.resolve(wn.dirname(r.filePath),N):Ks(N,wn.dirname(r.filePath));if(!H)continue;let Z=H.endsWith(".stx")?H:lr.existsSync(`${H}.stx`)?`${H}.stx`:void 0,U=Z?null:Ar(H,!1),V=z[1].startsWith("{")?z[1].slice(1,-1).split(","):[z[1]];for(let K of V){let[ne,ae=ne]=K.trim().split(/\s+as\s+/),de=Z||U?.get(ne)||U?.get(ne.toLowerCase());if(de)f.set(ae,de),f.set(ae.toLowerCase(),de),f.set(ae.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),de)}}for(let z of n.matchAll(/@import\s*\(([^)]+)\)/g))for(let N of z[1].matchAll(/['"]([^'"]+)['"]/g)){let H=Gs(N[1],r.filePath,r).find((Z)=>lr.statSync(Z,{throwIfNoEntry:!1})?.isFile());if(H)f.set(wn.basename(N[1]).replace(/\.stx$/,""),H)}let I={__importedComponents:f},D=new Map,W=(z,N,H)=>{let Z=e.slice(0,z);return{code:N,offset:z,attribute:H,anchor:!0,kind:"directive",line:Z.split(`
524
+ `).length,column:z-Z.lastIndexOf(`
525
+ `)}},L=(z,N,H)=>i.push({expression:z,statement:{text:N+z.code+H,prefixLength:N.length}});for(let z of ou(n)){if(Dr(z.name)||z.name==="component")continue;let N=ei(z.name,r.filePath,r,I);if(!N)continue;let H=D.get(N);if(!H){let U;try{U=r.readComponent?r.readComponent(N):lr.readFileSync(N,"utf8")}catch{continue}if(U===void 0)continue;u.set(N,U),H=gs(r.scriptCode(U,N),`__StxComponent${D.size}`),D.set(N,H),a.push(H.declarations)}let Z=[];for(let U of z.attributes){let{name:V,offset:K}=U,ne=U.value===!0?"true":U.value;if(V.startsWith("@")||V.startsWith("v-on:")){if(H.events&&U.value!==!0)l.set(K,`__StxEvent<${H.events}, ${JSON.stringify(V.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let ae=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(V);if(V.startsWith("v-")&&!V.startsWith("v-bind:")&&!ae)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(V))continue;let de=(ae?ae[1]||"modelValue":V.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,($e,ye)=>ye.toUpperCase());if(Z.push(de),!H.props)continue;let pe=V.startsWith(":")||V.startsWith("v-bind:")||!!ae||U.braced,Ee=pe?ne:U.value!==!0?JSON.stringify(ne):"true",Ce=!pe&&U.value!==!0&&(ne==="true"||ne==="false");L(W(K,Ee,V),";void ((",`) satisfies ${Ce?"__StxStaticProp":"__StxProp"}<${H.props}, ${JSON.stringify(de)}>);`)}if(H.props){let U=[...new Set(Z)].map((K)=>`${JSON.stringify(K)}: undefined as any`).join(", "),V=W(z.offset,`<${z.name}>`);i.push({expression:V,statement:{text:`;void ({ ${U} } satisfies ${H.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:D.size?a.join(`
526
+ `):"",checks:i,events:l,dependencies:u}}import qo from"fs";import dt from"path";var mt=["module","exports","require","props","$props","$bool","$num","defineProps","withDefaults","defineClientPayload","useServerData","useRuntimeConfig","useServerRuntimeConfig","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","setResponseStatus","setResponseHeader","notFound","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params"];import{mkdir as au,readFile as cu,readdir as lu,stat as zo,writeFile as uu}from"fs/promises";import at from"path";function Ho(e){if(e==="connectedCallback")return`method "${e}" is reserved; define "onConnect" instead, which the element calls once it is connected, rendered and bound`;if(e==="disconnectedCallback")return`method "${e}" is reserved; define "onDisconnect" instead, which the element calls as it leaves the DOM, before it releases its own listeners`;return`method "${e}" is reserved`}var Ko=new Set(["constructor","connectedCallback","disconnectedCallback","attributeChangedCallback","adoptedCallback"]);function pu(e){return e.replace(/\.stx$/i,"").split(/[^a-z0-9]+/i).filter(Boolean).map((n)=>n.charAt(0).toUpperCase()+n.slice(1)).join("")}function pr(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[^a-z0-9]+/gi,"-").replace(/^-+|-+$/g,"").toLowerCase()}function fu(e){return/^[a-z][.0-9_a-z-]*-[.0-9_a-z-]*$/.test(e)&&!e.startsWith("xml")&&!/[A-Z]/.test(e)}function du(e){if(e===!0)return"open";if(e==="open"||e==="closed")return e;return!1}async function gu(e){let n=[];async function r(i){let a=await lu(i,{withFileTypes:!0});a.sort((l,u)=>l.name.localeCompare(u.name));for(let l of a){let u=at.join(i,l.name);if(l.isDirectory()){if(!l.name.startsWith(".")&&l.name!=="node_modules")await r(u)}else if(l.isFile()&&l.name.endsWith(".stx")&&!/\.(?:test|spec)\.stx$/i.test(l.name))n.push(u)}}return await r(e),n}function vn(e){return e.replace(/<!--[\s\S]*?-->|\{\{--[\s\S]*?--\}\}/g,(n)=>n.replace(/[^\n]/g," "))}function fr(e){for(let n of Ie(vn(e))){let r=J(n.attrs);if(!r.has("component")&&!r.has("stx:component"))continue;return{code:e.slice(n.bodyStart,n.bodyEnd),start:n.bodyStart,open:n.start}}}function dr(e,n){let r=fr(e);if(!r)return{};let i=r.code.trim();if(!i)return{};try{let a=JSON.parse(i);if(!a||typeof a!=="object"||Array.isArray(a))throw Error("expected a JSON object");return a}catch(a){throw Error(`${n}: <script component> must contain JSON metadata (${a.message})`)}}function ms(e,n){let r=t(e),i=new Set(Zi(e).map((x)=>x.start)),a=/(?:export\s+)?(?:async\s+)?function\s+([A-Za-z_$][\w$]*)/g,l=[],u=n?void 0:new Bun.Transpiler({loader:"ts"}),f;while(f=a.exec(r)){if(!i.has(f.index+f[0].indexOf("function")))continue;let x=a.lastIndex;while(/\s/.test(r[x]||""))x++;let v=x;if(r[x]==="<")x=Pt(r,x,"<",">");if(x<0)continue;let I=e.slice(v,x).trim();while(/\s/.test(r[x]||""))x++;if(r[x]!=="(")continue;let D=x,W=Pt(r,x,"(",")");if(W<0)continue;for(x=W;x<e.length;x++){let L=r[x];if(L!=="{"&&L!==";")continue;let z=e.slice(f.index,x).trim();if(n){if(!n(z,L,f[1]))continue}else{let H;try{H=u.transformSync(z+(L==="{"?"{}":";"))}catch{continue}if(L==="{"&&!H.includes(`function ${f[1]}(`))continue;if(L===";"&&H.trim())continue}let N=L==="{"?Pt(r,x,"{","}"):x+1;if(N<0)break;l.push({name:f[1],header:z,generic:I,parameterOffset:D+1,parameters:e.slice(D+1,W-1),returns:e.slice(W,x).trim().replace(/^:\s*/,""),async:/\basync\s+function/.test(f[0]),...L==="{"?{source:e.slice(f.index,N)}:{}}),a.lastIndex=N;break}}return l}function mu(e){let n=Sn(e.parameters,",",!0).flatMap((r,i)=>{let a=t(r),l=0,u=-1;for(let N=0;N<a.length;N++){let H=a[N];if("([{<".includes(H))l++;else if(")]}>".includes(H)&&!(H===">"&&a[N-1]==="="))l--;if(H==="="&&l===0&&a[N+1]!==">"){u=N;break}}let f=(u<0?r:r.slice(0,u)).trim(),x=Sn(f,":",!0),v=x.shift().trim();if(v==="this")return[];let I=/^[A-Za-z_$]|^\.\.\./.test(v)?v:`argument${i}`,D=u<0?"":r.slice(u+1).trim(),W=D==="true"||D==="false"?"boolean":/^-?\d+(?:\.\d+)?$/.test(D)?"number":/^['"`]/.test(D)?"string":I.startsWith("...")?"unknown[]":"unknown",L=x.join(":").trim()||W,z=u>=0&&!I.endsWith("?")&&!I.startsWith("...")?"?":"";return[`${I}${z}: ${L}`]}).join(", ");return`${e.name}${e.generic}(${n}): ${e.returns||(e.async?"Promise<unknown>":"unknown")}`}function hu(e,n){let r={},i={},a=[],l=[],u=Ie(vn(e));for(let I of u){let D=e.slice(I.bodyStart,I.bodyEnd),W=J(I.attrs);if(W.has("src")||W.has("server")||W.has("component")||W.has("stx:component")||!Lt(W))continue;try{new Bun.Transpiler({loader:"ts"}).transformSync(D)}catch(V){throw Error(`${n}: failed to transpile <script client> (${V.message})`)}let L=W.has("client")?ms(D):[],z=new Set(L.filter((V)=>!V.source).map((V)=>V.name));for(let V of L){if(Ko.has(V.name))throw Error(`${n}: client ${Ho(V.name)}`);if(V.source)r[V.name]=new Bun.Transpiler({loader:"ts"}).transformSync(V.source).trim().replace(/^(?:export\s+)?(async\s+)?function\s+/,"$1");if(!V.source||!z.has(V.name))(i[V.name]??=[]).push(mu(V))}for(let V of D.matchAll(/^\s*import\s+(?:type\s+)?([\s\S]*?)\s+from\s*(['"])([^'"]+)\2\s*;?/gm))l.push({binding:V[1].trim(),module:V[3]});let N=t(D),H=C(N).depths,Z=/(?:export\s+)?(interface|type)\s+[A-Za-z_$][\w$]*/g,U;while(U=Z.exec(N)){if(H[U.index]!==0)continue;let V=Z.lastIndex,K=0;for(;V<N.length;V++){let ne=N[V];if(ne==="{"){let ae=Pt(N,V,"{","}");if(ae<0)break;if(V=ae-1,U[1]==="interface"&&K===0){V++;break}continue}if("([<".includes(ne))K++;else if(")]>".includes(ne)&&!(ne===">"&&N[V-1]==="="))K--;if(U[1]==="type"&&K===0&&(ne===";"||ne===`
527
+ `)){if(ne===`
528
+ `&&/^[\s]*[|&]/.test(N.slice(V+1)))continue;try{new Bun.Transpiler({loader:"ts"}).transformSync(D.slice(U.index,V));break}catch{}}}a.push(D.slice(U.index,V).replace(/^export\s+/,"").trim()),Z.lastIndex=V+1}}let f=Object.values(i).flat().join(`
529
+ `)+`
530
+ `+a.join(`
531
+ `),x=l.filter((I)=>(I.binding.match(/[A-Za-z_$][\w$]*/g)||[]).filter((D)=>!["type","as"].includes(D)).some((D)=>new RegExp(`\\b${D}\\b`).test(f)));for(let I of x)if(I.module.startsWith(".")||at.isAbsolute(I.module))throw Error(`${n}: public method types import ${JSON.stringify(I.module)} outside the generated package; declare these types in the component or import them from a published dependency`);let v=[...new Set(x.map((I)=>`import type ${I.binding.replace(/\btype\s+/g,"")} from ${JSON.stringify(I.module)}`))];return{methods:r,declarations:i,types:[...v,...a].join(`
532
+
533
+ `)}}function xu(e){let n=e.match(/<template\b(?![^>]*\bshadowrootmode\b)[^>]*>([\s\S]*?)<\/template>/i);return(n?n[1]:e).replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"").trim()}function Bo(e){return[...e.matchAll(/<style\b[^>]*>([\s\S]*?)<\/style>/gi)].map((n)=>n[1].trim()).filter(Boolean).join(`
534
+
535
+ `)}function bu(e){if(!e)return null;let n=e.replace(/\s*\|\s*(?:undefined|null)\b/g,"").trim();if(/^string$/.test(n))return"string";if(/^number$/.test(n))return"number";if(/^boolean$/.test(n))return"boolean";if(/^(?:'[^']*'|"[^"]*")(?:\s*\|\s*(?:'[^']*'|"[^"]*"))*$/.test(n))return"string";return"object"}function yu(e){if(e===void 0)return"object";if(e==="true"||e==="false")return"boolean";if(/^-?\d+(?:\.\d+)?$/.test(e))return"number";if(/^['"`]/.test(e))return"string";return"object"}function _u(e){if(e==="true")return!0;if(e==="false")return!1;if(/^-?\d+(?:\.\d+)?$/.test(e))return Number(e);if(/^['"`]/.test(e))return e.slice(1,-1);try{return JSON.parse(e)}catch{return}}function kn(e,n){if(e[n]!=="(")return null;let r=0,i="";for(let a=n;a<e.length;a++){let l=e[a];if(i!==""){if(l==="\\")a++;else if(l===i)i="";continue}if(l==="'"||l==='"'||l==="`"){i=l;continue}if(l==="(")r++;else if(l===")"){if(r--,r===0)return{expression:e.slice(n+1,a),end:a+1}}}return null}function gr(e){let n=/^([\s\S]+?)\s+as\s+(?:([A-Za-z_$][\w$]*)\s*=>\s*)?([A-Za-z_$][\w$]*)$/.exec(e.trim());return n?{iterable:n[1],key:n[2],value:n[3]}:void 0}function wu(e){let n=[],r=0,i=e.replace(/\{\{--[\s\S]*?--\}\}/g,""),a=/@(if|elseif|else|endif|foreach|endforeach)\s*/g,l,u=(f)=>{if(f==="")return;let x=0,v=/\{!!\s*([\s\S]*?)\s*!!\}|\{\{\s*([\s\S]*?)\s*\}\}/g,I;while(I=v.exec(f)){if(I.index>x)n.push(`out += ${JSON.stringify(f.slice(x,I.index))};`);n.push(I[1]!==void 0?`out += __raw(${I[1]});`:`out += __escape(${I[2]});`),x=I.index+I[0].length}if(x<f.length)n.push(`out += ${JSON.stringify(f.slice(x))};`)};while(l=a.exec(i)){u(i.slice(r,l.index)),r=l.index+l[0].length;let x=l[1]==="if"||l[1]==="elseif"||l[1]==="foreach"?kn(i,r):null;if(x)r=x.end,a.lastIndex=x.end;let v=x?.expression;switch(l[1]){case"if":n.push(`if (${v}) {`);break;case"elseif":n.push(`} else if (${v}) {`);break;case"else":n.push("} else {");break;case"endif":case"endforeach":n.push("}");break;case"foreach":{let I=gr(v||"");if(!I){n.push(`out += ${JSON.stringify(l[0]+(x?`(${v})`:""))};`);break}let{iterable:D,key:W,value:L}=I;n.push(W?`for (const [${W}, ${L}] of __entries(${D})) {`:`for (const ${L} of __values(${D})) {`);break}}}return u(i.slice(r)),n.join(`
536
+ `)}function Pt(e,n,r,i){if(e[n]!==r)return-1;let a=0,l=null;for(let u=n;u<e.length;u++){let f=e[u];if(l){if(f==="\\"){u++;continue}if(f===l)l=null;continue}if(f==="'"||f==='"'||f==="`"){l=f;continue}if(f===r)a++;else if(f===i){if(i===">"&&e[u-1]==="=")continue;if(a--,a===0)return u+1}}return-1}function Sn(e,n,r){let i=r?"([{<":"([{",a=r?")]}>":")]}",l=[],u=0,f=null,x="";for(let v=0;v<e.length;v++){let I=e[v];if(f){if(x+=I,I==="\\"){x+=e[++v]??"";continue}if(I===f)f=null;continue}if(I==="'"||I==='"'||I==="`"){f=I,x+=I;continue}if(i.includes(I))u++;else if(a.includes(I)&&!(r&&I===">"&&e[v-1]==="="))u--;if(u===0&&n.includes(I)){l.push(x),x="";continue}x+=I}return l.push(x),l.map((v)=>v.trim()).filter(Boolean)}function Su(e){let n=0,r=null;for(let i=0;i<e.length;i++){let a=e[i];if(r){if(a==="\\"){i++;continue}if(a===r)r=null;continue}if(a==="'"||a==='"'||a==="`"){r=a;continue}if("([{".includes(a))n++;else if(")]}".includes(a))n--;if(n!==0||a!=="=")continue;let l=e[i-1];if(e[i+1]==="="||l==="="||l==="!"||l==="<"||l===">")continue;return i}return-1}function Wo(e){switch(e.trim()){case"String":return"string";case"Number":return"number";case"Boolean":return"boolean";case"Array":return"unknown[]";case"Object":return"Record<string, unknown>";default:return}}function vu(e){let n=/\bdefineProps\b/.exec(e);if(!n)return null;let r=/(?:^|[\s;{}()])(const|let|var)\s+/g,i=-1;for(let U=r.exec(e);U&&U.index<n.index;U=r.exec(e))i=U.index+U[0].indexOf(U[1]);if(i===-1)return null;let a={},l={},u=[],f={},x=i+(/^(?:const|let|var)\s+/.exec(e.slice(i))?.[0].length??0),v=()=>{while(x<e.length&&/\s/.test(e[x]))x++},I;if(e[x]==="{"){let U=Pt(e,x,"{","}");if(U===-1)return null;I=e.slice(x,U),x=U}else{let U=/^[A-Za-z_$][\w$]*/.exec(e.slice(x));if(!U)return null;I=U[0],x+=U[0].length}if(v(),e[x]!=="=")return null;x++,v();let D=/^withDefaults\s*\(\s*/.exec(e.slice(x)),W=Boolean(D);if(D)x+=D[0].length;let L=/^defineProps\b/.exec(e.slice(x));if(!L)return null;x+=L[0].length;let z="";if(v(),e[x]==="<"){let U=Pt(e,x,"<",">");if(U===-1)return null;z=e.slice(x+1,U-1).trim(),x=U}if(v(),e[x]!=="(")return null;let N=Pt(e,x,"(",")");if(N===-1)return null;let H=e.slice(x+1,N-1).trim();if(x=N,W){if(v(),e[x]===",")x++,v();if(e[x]==="{"){let U=Pt(e,x,"{","}");if(U===-1)return null;for(let[V,K]of ur(e.slice(x,U)))l[V]=K;x=U}if(v(),e[x]===",")x++,v();if(e[x]===")")x++}if(e[x]===";")x++;let Z=/^[A-Za-z_$][\w$]*$/.test(z)?z:void 0;if(z.startsWith("{"))for(let U of Sn(z.replace(/^\{/,"").replace(/\}$/,""),",;",!0)){let V=/^(?:readonly\s+)?([A-Za-z_$][\w$]*)\s*\??\s*:\s*([\s\S]+)$/.exec(U);if(V)a[V[1]]=V[2].trim()}if(H.startsWith("{"))for(let[U,V]of ur(H)){if(u.push(U),!V.startsWith("{")){let K=Wo(V);if(K)a[U]=K;continue}for(let[K,ne]of ur(V))if(K==="default")l[U]=ne;else if(K==="type"){let ae=Wo(ne);if(ae)a[U]=ae}}else if(H.startsWith("["))for(let U of Sn(H.slice(1,-1),",",!1))u.push(U.replace(/^['"`]/,"").replace(/['"`]$/,""));if(I.startsWith("{")){u.length=0;for(let U of Sn(I.replace(/^\{/,"").replace(/\}$/,""),",",!1)){let V=Su(U),K=V===-1?U:U.slice(0,V),ne=K.split(":")[0].trim().replace(/^\.\.\./,"");if(!ne)continue;if(u.push(ne),f[ne]=K.trim(),V!==-1)l[ne]=U.slice(V+1).trim()}}else if(u.length===0)u.push(...Object.keys(a));return{text:e.slice(i,x),propNames:u,propBindings:f,defaults:l,declared:a,typeName:Z}}function ur(e){let n=e.trim().replace(/^\{/,"").replace(/\}$/,""),r=[],i=0;while(i<n.length){let a=/\s*([A-Za-z_$][\w$]*)\s*:/y;a.lastIndex=i;let l=a.exec(n);if(!l)break;i=a.lastIndex;let u=0,f="",x=i;while(i<n.length){let I=n[i];if(f){if(I==="\\")i++;else if(I===f)f=""}else if(I==="'"||I==='"'||I==="`")f=I;else if(I==="{"||I==="["||I==="(")u++;else if(I==="}"||I==="]"||I===")")u--;else if(I===","&&u===0)break;i++}let v=n.slice(x,i).trim();if(v)r.push([l[1],v]);i++}return r}function $u(e,n,r){let a=Ie(vn(e)).find((L)=>{let z=J(L.attrs);return Lt(z)&&!["component","stx:component","client","src"].some((N)=>z.has(N))});if(!a)return{imports:[],body:"",propNames:[],propBindings:{},defaults:{},declared:{}};let l=e.slice(a.bodyStart,a.bodyEnd),u=[],f=[],x={},v={},I={};l=l.replace(/^\s*import\s+[\s\S]*?from\s*['"][^'"]+['"];?\s*$/gm,(L)=>{if(/from\s*['"]stx['"]/.test(L))return"";return u.push(L.trim().replace(/(from\s*['"])(\.[^'"]*)(['"])/,(z,N,H,Z)=>{let U=at.resolve(at.dirname(n),H),V=at.relative(r,U);return`${N}${V.startsWith(".")?V:`./${V}`}${Z}`})),""});let D=vu(l);if(D)f.push(...D.propNames),Object.assign(x,D.propBindings),Object.assign(v,D.defaults),Object.assign(I,D.declared),l=l.replace(D.text,"");let W={};for(let L of l.matchAll(/(?:export\s+)?interface\s+([A-Za-z_$][\w$]*)\s*\{([\s\S]*?)\n\}/g)){let z=[];for(let N of L[2].matchAll(/^\s*(?:\/\*\*[\s\S]*?\*\/\s*)?([A-Za-z_$][\w$]*)\??\s*:\s*([^\n;]+)/gm))I[N[1]]=N[2].trim(),z.push(N[1]);W[L[1]]=z}if(D&&D.propNames.length===0&&D.typeName){for(let L of W[D.typeName]??[])if(!f.includes(L))f.push(L)}return l=l.replace(/(?:export\s+)?interface\s+[A-Za-z_$][\w$]*\s*\{[\s\S]*?\n\}/g,""),{imports:u,body:l.trim(),propNames:f,propBindings:x,defaults:v,declared:I}}function Eu(e){let n=new Set;return{template:e.replace(/\s@([a-z][\w:-]*)(\.[\w.-]+)?\s*=\s*(["'])([A-Za-z_$][\w$]*)\3/gi,(i,a,l,u,f)=>{let x=a.toLowerCase();n.add(x);let v=(l||"").split(".").filter(Boolean).join(" ");return` data-stx-on-${x}="${f}"${v?` data-stx-mod-${x}="${v}"`:""}`}),eventTypes:[...n].sort()}}function ku(e){let n=[];return{template:e.replace(/\s:([a-z][\w:-]*)\s*=\s*(["'])([\w$.]+)\2/gi,(i,a,l,u)=>{let f=n.length;return n.push({id:f,name:a,expression:u}),` data-stx-bind-${f}=""`}),bindings:n}}function Cu(e){let n=new Set;for(let r of e.matchAll(/<slot\b([^>]*)>/gi))n.add(r[1].match(/\bname\s*=\s*["']([^"']+)["']/i)?.[1]||"");return[...n].map((r)=>({name:r}))}function Ru(e){return[...new Set([...e.matchAll(/(--[a-z0-9_-]+)\s*:/gi)].map((n)=>n[1]))].sort().map((n)=>({name:n}))}function Fo(e,n){if(!n||!new Set(["string","number","boolean","object","array"]).has(n.type))throw Error(`Property "${e}" must declare one of: string, number, boolean, object, array`);return{...n,reflect:n.reflect??n.attribute!==!1}}async function Au(e,n,r){let i=at.isAbsolute(n.file)?n.file:at.resolve(e,n.file),a=await cu(i,"utf8"),l=dr(a,i),u=at.basename(i,".stx"),f=n.name||l.name||pu(u),x=`${pr(r.prefix||"stx")}-${pr(u)}`,v=n.tag||l.tag||x;if(!f||!/^[A-Za-z_$][\w$]*$/.test(f))throw Error(`${i}: invalid component class name "${f}"`);if(!fu(v))throw Error(`${i}: invalid custom-element tag "${v}"; tags must be lowercase and contain a hyphen`);let I=n.properties||l.properties||l.props||{},D=Object.fromEntries(Object.entries(I).map(([V,K])=>[V,Fo(V,K)])),W=Eu(xu(a)),L=ku(W.template),z=$u(a,i,at.resolve(r.outputDir)),N=wu(L.template);for(let V of z.propNames){if(D[V])continue;let K=z.defaults[V];D[V]=Fo(V,{type:bu(z.declared[V])??yu(K),...K===void 0?{}:{default:_u(K)}})}let H=l.methods||{},Z=n.methods||{},U=hu(a,i);return{file:at.relative(e,i),sourcePath:i,name:f,tag:v,description:n.description||l.description||"",template:L.template,styles:Bo(a),shadowMode:du(n.shadowDOM??l.shadowDOM??r.shadowDOM),progressive:n.progressive??l.progressive??r.progressive??!0,properties:D,events:n.events||l.events||{},methods:{...H,...Z,...U.methods},methodDeclarations:U.declarations,declarationTypes:U.types,eventTypes:W.eventTypes,bindings:L.bindings,slots:Cu(L.template),cssProperties:Ru(Bo(a)),scope:z,render:N}}function Tu(){let e=JSON.stringify("\\{!!\\s*([\\w$.]+)\\s*!!\\}"),n=JSON.stringify("\\{\\{\\s*([\\w$.]+)\\s*\\}\\}");return`const HTMLElementBase = globalThis.HTMLElement || class {};
537
+
538
+ const escapeHTML = (value) => String(value ?? '')
539
+ .replaceAll('&', '&amp;').replaceAll('<', '&lt;').replaceAll('>', '&gt;')
540
+ .replaceAll('"', '&quot;').replaceAll("'", '&#039;');
541
+
542
+ const valueAt = (host, path) => {
543
+ const parts = path.trim().split('.');
544
+ if (parts[0] === 'this') parts.shift();
545
+ if (!parts.length) return host;
546
+ const first = parts.shift();
547
+ // Render bindings read declared props, including attributes whose names
548
+ // also belong to the native DOM API. The public element keeps that API.
549
+ let value = host._values && Object.prototype.hasOwnProperty.call(host._values, first)
550
+ ? host._values[first]
551
+ : host[first];
552
+ for (const part of parts) value = value?.[part];
553
+ return typeof value === 'function' ? value.call(host) : value;
554
+ };
555
+
556
+ const deserialize = (value, type, fallback) => {
557
+ if (value === null) return type === 'boolean' ? false : fallback;
558
+ if (type === 'boolean') return value !== 'false' && value !== '0';
559
+ if (type === 'number') return Number(value);
560
+ if (type === 'object' || type === 'array') {
561
+ try { return JSON.parse(value); }
562
+ catch { return fallback; }
563
+ }
564
+ return value;
565
+ };
566
+
567
+ const serialize = (value, type) => {
568
+ if (value == null || value === false) return null;
569
+ if (type === 'boolean') return '';
570
+ if (type === 'object' || type === 'array') return JSON.stringify(value);
571
+ return String(value);
572
+ };
573
+
574
+ const cloneDefault = (value, type) => {
575
+ if (value == null || (type !== 'object' && type !== 'array')) return value;
576
+ if (typeof structuredClone === 'function') return structuredClone(value);
577
+ return JSON.parse(JSON.stringify(value));
578
+ };
579
+
580
+ const defaultFor = property => cloneDefault(
581
+ property.default ?? ({ string: '', number: 0, boolean: false, object: {}, array: [] })[property.type],
582
+ property.type,
583
+ );
584
+
585
+ export class StxElement extends HTMLElementBase {
586
+ static definition = {};
587
+ static get observedAttributes() { return this.definition.observedAttributes || []; }
588
+
589
+ constructor() {
590
+ super();
591
+ this._values = Object.create(null);
592
+ this._reflecting = false;
593
+ this._connected = false;
594
+ this._hasConnected = false;
595
+ this._initializing = false;
596
+ this._updatePending = false;
597
+ this._listeners = new Map();
598
+ const definition = this.constructor.definition;
599
+ for (const [name, property] of Object.entries(definition.properties || {})) {
600
+ this._values[name] = defaultFor(property);
601
+ }
602
+ if (definition.shadowMode && this.attachShadow && !this.shadowRoot) {
603
+ this._closedRoot = this.attachShadow({ mode: definition.shadowMode });
604
+ }
605
+ }
606
+
607
+ get updateComplete() { return this._updateComplete || Promise.resolve(); }
608
+ get renderRoot() { return this._closedRoot || this.shadowRoot || this; }
609
+
610
+ connectedCallback() {
611
+ if (this._connected) return;
612
+ this._connected = true;
613
+ this._initializing = true;
614
+ const definition = this.constructor.definition;
615
+ for (const [name, property] of Object.entries(definition.properties || {})) {
616
+ const attribute = property.attribute === false ? null : (property.attribute || name.replace(/[A-Z]/g, letter => '-' + letter.toLowerCase()));
617
+ if (attribute && this.hasAttribute?.(attribute)) this._values[name] = deserialize(this.getAttribute(attribute), property.type, defaultFor(property));
618
+ }
619
+ // Properties assigned before customElements.define() become own properties.
620
+ // Upgrade them after attributes so imperative state wins, matching the
621
+ // platform's property-first custom-element initialization convention.
622
+ for (const name of Object.keys(definition.properties || {})) this._upgradeProperty(name);
623
+ this._initializing = false;
624
+ const root = this.renderRoot;
625
+ const hasMarkup = [...(root.childNodes || [])].some(node => node.nodeType !== 3 || node.textContent.trim());
626
+ const firstConnection = !this._hasConnected;
627
+ if (!(firstConnection && definition.progressive && hasMarkup)) this._render();
628
+ else this._upgradeDeclarativeEvents();
629
+ this._bindEvents();
630
+ if (firstConnection) {
631
+ this._hasConnected = true;
632
+ this.setAttribute?.('hydrated', '');
633
+ this.dispatchEvent?.(new CustomEvent('stx:hydrated', { bubbles: true, composed: true }));
634
+ }
635
+ // Called last, so a component that acquires something sees its own rendered
636
+ // markup and its events already bound. Reported rather than rethrown: a
637
+ // component that fails to set up must not take the element down with it.
638
+ try { this.onConnect?.(); }
639
+ catch (error) { console.error('[stx] onConnect failed', error); }
640
+ }
641
+
642
+ disconnectedCallback() {
643
+ this._connected = false;
644
+ // Called before the framework releases anything, so the element is still
645
+ // intact for a component that needs to read it on the way out, and inside
646
+ // try/finally so a throwing hook cannot leak the framework's own listeners.
647
+ try { this.onDisconnect?.(); }
648
+ catch (error) { console.error('[stx] onDisconnect failed', error); }
649
+ finally {
650
+ for (const [event, listener] of this._listeners) this.renderRoot.removeEventListener(event, listener);
651
+ this._listeners.clear();
652
+ }
653
+ }
654
+
655
+ attributeChangedCallback(attribute, oldValue, newValue) {
656
+ if (oldValue === newValue || this._reflecting) return;
657
+ const definition = this.constructor.definition;
658
+ const name = definition.attributeToProperty?.[attribute];
659
+ if (!name) return;
660
+ const property = definition.properties[name];
661
+ const value = deserialize(newValue, property.type, defaultFor(property));
662
+ if (!Object.is(this._values[name], value)) {
663
+ this._values[name] = value;
664
+ this.requestUpdate();
665
+ }
666
+ }
667
+
668
+ /**
669
+ * The props a compiled render reads.
670
+ *
671
+ * Its own method rather than _values directly, so a component that sets a
672
+ * property before upgrade still sees it, and so the generated code has one
673
+ * name to depend on rather than a private field's shape.
674
+ */
675
+ _props() {
676
+ return this._values;
677
+ }
678
+
679
+ requestUpdate() {
680
+ if (!this._connected || this._initializing || this._updatePending) return this.updateComplete;
681
+ this._updatePending = true;
682
+ this._updateComplete = new Promise((resolve) => {
683
+ queueMicrotask(() => {
684
+ this._updatePending = false;
685
+ if (this._connected) this._render();
686
+ resolve();
687
+ });
688
+ });
689
+ return this._updateComplete;
690
+ }
691
+
692
+ emit(name, detail, options = {}) {
693
+ return this.dispatchEvent(new CustomEvent(name, {
694
+ detail, bubbles: true, composed: true, ...options,
695
+ }));
696
+ }
697
+
698
+ _upgradeProperty(name) {
699
+ if (!Object.prototype.hasOwnProperty.call(this, name)) return;
700
+ const value = this[name];
701
+ delete this[name];
702
+ this[name] = value;
703
+ }
704
+
705
+ _upgradeDeclarativeEvents() {
706
+ for (const element of this.renderRoot.querySelectorAll?.('*') || []) {
707
+ const names = element.getAttributeNames?.() || [...(element.attributes || [])].filter(Boolean).map(attribute => attribute.name);
708
+ for (const attributeName of names) {
709
+ if (!attributeName?.startsWith('@')) continue;
710
+ const [event, ...modifiers] = attributeName.slice(1).split('.');
711
+ element.setAttribute('data-stx-on-' + event, element.getAttribute(attributeName));
712
+ if (modifiers.length) element.setAttribute('data-stx-mod-' + event, modifiers.join(' '));
713
+ element.removeAttribute(attributeName);
714
+ }
715
+ }
716
+ }
717
+
718
+ _bindEvents() {
719
+ for (const event of this.constructor.definition.eventTypes || []) {
720
+ if (this._listeners.has(event)) continue;
721
+ const listener = ($event) => {
722
+ const selector = '[data-stx-on-' + event + ']';
723
+ const target = $event.target?.closest?.(selector);
724
+ if (!target || !this.renderRoot.contains(target)) return;
725
+ const modifiers = (target.getAttribute('data-stx-mod-' + event) || '').split(' ');
726
+ if (modifiers.includes('prevent')) $event.preventDefault();
727
+ if (modifiers.includes('stop')) $event.stopPropagation();
728
+ const method = target.getAttribute('data-stx-on-' + event);
729
+ if (typeof this[method] === 'function') this[method]($event);
730
+ };
731
+ this.renderRoot.addEventListener(event, listener);
732
+ this._listeners.set(event, listener);
733
+ }
734
+ }
735
+
736
+ _render() {
737
+ const definition = this.constructor.definition;
738
+ const root = this.renderRoot;
739
+ const active = root.activeElement || (root.contains?.(globalThis.document?.activeElement) ? globalThis.document.activeElement : null);
740
+ const focusAttribute = active?.getAttribute?.('data-key') ? 'data-key' : active?.id ? 'id' : 'name';
741
+ const focusKey = active?.getAttribute?.(focusAttribute);
742
+ const focusValue = focusAttribute === 'name' && active?.type === 'radio' ? active.value : null;
743
+ const selectionStart = active?.selectionStart, selectionEnd = active?.selectionEnd;
744
+ const selection = Number.isInteger(selectionStart) && Number.isInteger(selectionEnd)
745
+ ? [selectionStart, selectionEnd, active.selectionDirection] : null;
746
+ // A compiled component renders itself: the control flow and the derived
747
+ // values were turned into JavaScript at build time, so there is nothing to
748
+ // interpret here and nothing that needs an eval the page's CSP forbids.
749
+ // The string template remains for components that carry no logic.
750
+ let html = typeof this.render === 'function'
751
+ ? this.render(RENDER_HELPERS)
752
+ : definition.template
753
+ .replace(new RegExp(${e}, 'g'), (_match, expression) => String(valueAt(this, expression) ?? ''))
754
+ .replace(new RegExp(${n}, 'g'), (_match, expression) => escapeHTML(valueAt(this, expression)));
755
+ if (definition.shadowMode && definition.styles) html = '<style>' + definition.styles + '</style>' + html;
756
+ root.innerHTML = html;
757
+ this._applyBindings();
758
+ this._bindEvents();
759
+ if (focusKey) {
760
+ const escaped = globalThis.CSS?.escape ? globalThis.CSS.escape(focusKey) : focusKey.replace(/["\\\\]/g, '\\$&');
761
+ const selector = '[' + focusAttribute + '="' + escaped + '"]';
762
+ // Name-only radio groups share a name, but their chosen member must stay focused.
763
+ const next = focusValue === null ? root.querySelector(selector)
764
+ : [...root.querySelectorAll(selector)].find(element => element.type === 'radio' && element.value === focusValue);
765
+ next?.focus?.();
766
+ // Several input types expose this method but reject text selection. A
767
+ // rerender can also change a text input into one of those types.
768
+ if (selection && Number.isInteger(next?.selectionStart) && Number.isInteger(next?.selectionEnd) && typeof next?.setSelectionRange === 'function')
769
+ next.setSelectionRange(selection[0], selection[1], selection[2] || 'none');
770
+ }
771
+ this.dispatchEvent?.(new CustomEvent('stx:updated', { bubbles: false }));
772
+ }
773
+
774
+ _applyBindings() {
775
+ for (const binding of this.constructor.definition.bindings || []) {
776
+ const element = this.renderRoot.querySelector('[data-stx-bind-' + binding.id + ']');
777
+ if (!element) continue;
778
+ const value = valueAt(this, binding.expression);
779
+ if (binding.name === 'class') element.className = value || '';
780
+ else if (binding.name === 'style' && typeof value === 'object') {
781
+ Object.assign(element.style, value);
782
+ }
783
+ else if (typeof value === 'boolean') {
784
+ element.toggleAttribute(binding.name, value);
785
+ if (binding.name in element) element[binding.name] = value;
786
+ }
787
+ else if (value == null || value === false) element.removeAttribute(binding.name);
788
+ else element.setAttribute(binding.name, String(value));
789
+ }
790
+ }
791
+ }
792
+
793
+ /**
794
+ * What a compiled render is handed.
795
+ *
796
+ * Passed in rather than closed over so the generated code names no globals, and
797
+ * a component module stays readable on its own: __escape is visibly a
798
+ * parameter, not something the bundler happened to leave in scope.
799
+ */
800
+ const RENDER_HELPERS = {
801
+ escape: escapeHTML,
802
+ // The raw form is the author declaring the value is markup. Null becomes an
803
+ // empty string rather than the word "null", which is the only sensible
804
+ // reading of a missing fragment.
805
+ raw: (value) => String(value ?? ''),
806
+ // A loop over something absent runs zero times. Throwing here would fail a
807
+ // whole page over one empty list, which is never what the author meant.
808
+ values: (value) => value == null ? [] : (value[Symbol.iterator] ? value : Object.values(value)),
809
+ entries: (value) => value == null ? [] : (Array.isArray(value) ? value.entries() : Object.entries(value)),
810
+ };
811
+
812
+ export function defineComponent(Component, definition) {
813
+ const properties = definition.properties || {};
814
+ const attributeToProperty = {};
815
+ const observedAttributes = [];
816
+ for (const [name, property] of Object.entries(properties)) {
817
+ const attribute = property.attribute === false ? null : (property.attribute || name.replace(/[A-Z]/g, letter => '-' + letter.toLowerCase()));
818
+ if (attribute) {
819
+ attributeToProperty[attribute] = name;
820
+ observedAttributes.push(attribute);
821
+ }
822
+ // A style prop is an attribute value, not a replacement for the browser's
823
+ // CSSStyleDeclaration. Native event handler accessors must survive too.
824
+ if (name in HTMLElementBase.prototype) {
825
+ if (!attribute) throw new TypeError('STX prop "' + name + '" overlaps the native DOM API and needs an attribute binding');
826
+ continue;
827
+ }
828
+ Object.defineProperty(Component.prototype, name, {
829
+ configurable: true,
830
+ enumerable: true,
831
+ get() { return this._values[name]; },
832
+ set(value) {
833
+ const oldValue = this._values[name];
834
+ if (Object.is(oldValue, value)) return;
835
+ this._values[name] = value;
836
+ if (property.reflect && attribute && !this._reflecting) {
837
+ const serialized = serialize(value, property.type);
838
+ this._reflecting = true;
839
+ if (serialized === null) this.removeAttribute(attribute);
840
+ else this.setAttribute(attribute, serialized);
841
+ this._reflecting = false;
842
+ }
843
+ this.requestUpdate();
844
+ this.dispatchEvent?.(new CustomEvent(name + '-changed', {
845
+ detail: { value, oldValue }, bubbles: true, composed: true,
846
+ }));
847
+ },
848
+ });
849
+ }
850
+ Component.definition = { ...definition, attributeToProperty, observedAttributes };
851
+ const registry = globalThis.customElements || globalThis.window?.customElements;
852
+ if (registry && !registry.get(definition.tag)) {
853
+ registry.define(definition.tag, Component);
854
+ }
855
+ return Component;
856
+ }
857
+ `}function Iu(e){let n=JSON.stringify({tag:e.tag,template:e.template,styles:e.styles,shadowMode:e.shadowMode,progressive:e.progressive,properties:e.properties,eventTypes:e.eventTypes,bindings:e.bindings},null,2),r=Object.entries(e.methods).map(([f,x])=>{if(Ko.has(f))throw Error(`${e.sourcePath}: ${Ho(f)}`);if(/^(?:async\s+)?[A-Za-z_$][\w$]*\s*\(/.test(x.trim()))return` ${x.trim()}`;return` ${f}($event) {
858
+ ${x}
859
+ }`}).join(`
860
+
861
+ `),i=e.scope,a=[...new Set([...Object.keys(e.properties),...i.propNames])].map((f)=>{let x=i.propBindings[f]||f;return i.defaults[f]===void 0?x:`${x} = ${i.defaults[f]}`}).join(", "),l=(f)=>f.split(`
862
+ `).map((x)=>x.trim()===""?x:` ${x}`).join(`
863
+ `),u="";if(e.render.trim()!==""||i.body!==""||a!==""){let f=[a?`const { ${a} } = this._props();`:"",i.body,"let out = '';",e.render,"return out;"].filter(Boolean).join(`
864
+ `),x;try{let v=new Bun.Transpiler({loader:"ts"}).transformSync(`export function __render(__helpers) {
865
+ ${f}
866
+ }`),I=v.indexOf("{"),D=v.lastIndexOf("}");x=v.slice(I+1,D).trim()}catch(v){throw Error(`${e.sourcePath}: failed to compile render (${v.message})`)}u=`
867
+ render(__helpers) {
868
+ const { escape: __escape, raw: __raw, values: __values, entries: __entries } = __helpers;
869
+ ${l(x.trim())}
870
+ }
871
+ `}return`import { StxElement, defineComponent } from './runtime.js';
872
+ ${i.imports.length?`${i.imports.join(`
873
+ `)}
874
+ `:""}
875
+ /** ${e.description||`${e.name} web component generated from ${e.file}.`} */
876
+ export class ${e.name} extends StxElement {
877
+ ${r}${u}
878
+ }
879
+
880
+ defineComponent(${e.name}, ${n});
881
+ export default ${e.name};
882
+ `}function sn(e){if(!e||typeof e!=="object")return"unknown";switch(e.type){case"boolean":return"boolean";case"number":return"number";case"array":return"unknown[]";case"object":return"Record<string, unknown>";default:return"string"}}function Pu(e){let n=Object.entries(e.properties).map(([a,l])=>` ${a}${l.required?"":"?"}: ${sn(l)}`).join(`
883
+ `),r=Object.entries(e.events).map(([a,l])=>` ${JSON.stringify(a)}: CustomEvent<${l.detailType||"unknown"}>`).join(`
884
+ `),i=Object.keys(e.methods).flatMap((a)=>e.methodDeclarations[a]||[`${a}($event?: Event): unknown`]).map((a)=>` ${a}`).join(`
885
+ `);return`${e.declarationTypes?`${e.declarationTypes}
886
+
887
+ `:""}export interface ${e.name}Props {
888
+ ${n}
889
+ }
890
+
891
+ export interface ${e.name}EventMap {
892
+ ${r}
893
+ }
894
+
895
+ export interface ${e.name} extends Required<Pick<${e.name}Props, Exclude<keyof ${e.name}Props, keyof HTMLElement>>> {}
896
+
897
+ export declare class ${e.name} extends HTMLElement {
898
+ ${i}
899
+ readonly updateComplete: Promise<void>
900
+ requestUpdate(): Promise<void>
901
+ emit<T = unknown>(name: string, detail?: T, options?: CustomEventInit<T>): boolean
902
+ }
903
+
904
+ declare global {
905
+ interface HTMLElementTagNameMap {
906
+ ${JSON.stringify(e.tag)}: ${e.name}
907
+ }
908
+ }
909
+
910
+ export default ${e.name}
911
+ `}function Ou(e){return`declare global {
912
+ namespace JSX {
913
+ interface IntrinsicElements {
914
+ ${e.map((r)=>{let i=Object.entries(r.properties).map(([l,u])=>` ${JSON.stringify(l)}?: ${sn(u)}`).join(`
915
+ `),a=Object.keys(r.events).map((l)=>` ${`on${l.split(/[-:]/).map((f)=>f.charAt(0).toUpperCase()+f.slice(1)).join("")}`}?: (event: CustomEvent<${r.events[l].detailType||"unknown"}>) => void`).join(`
916
+ `);return` ${JSON.stringify(r.tag)}: {
917
+ ${i}
918
+ ${a}
919
+ children?: unknown
920
+ slot?: string
921
+ class?: string
922
+ className?: string
923
+ }`}).join(`
924
+ `)}
925
+ }
926
+ }
927
+ }
928
+
929
+ export {}
930
+ `}function ju(e){return{schemaVersion:"1.0.0",modules:e.map((n)=>({kind:"javascript-module",path:`./${n.tag}.js`,declarations:[{kind:"class",name:n.name,description:n.description||void 0,customElement:!0,tagName:n.tag,members:Object.entries(n.properties).map(([r,i])=>({kind:"field",name:r,description:i.description,type:{text:sn(i)},default:i.default===void 0?void 0:JSON.stringify(i.default),attribute:i.attribute===!1?void 0:i.attribute||pr(r),reflects:i.reflect})),events:Object.entries(n.events).map(([r,i])=>({name:r,description:i.description,type:{text:`CustomEvent<${i.detailType||"unknown"}>`}})),slots:n.slots,cssProperties:n.cssProperties}],exports:[{kind:"js",name:n.name,declaration:{name:n.name,module:`./${n.tag}.js`}}]}))}}function Vo(e){if(!e.styles)return"";let n=e.styles.replace(/:host\b/g,":scope");if(/\@scope\s*\(/.test(n))return n;return`@scope (${e.tag}) {
931
+ ${n}
932
+ }`}function Uo(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\s+/g," ").replace(/\s*([{}:;,])\s*/g,"$1").replace(/;}/g,"}").trim()}function Mu(e){let n=JSON.stringify("\\{!!\\s*([\\w$.]+)\\s*!!\\}"),r=JSON.stringify("\\{\\{\\s*([\\w$.]+)\\s*\\}\\}"),i=JSON.stringify('<slot(?:\\s+name=["\\\']([^"\\\']+)["\\\'])?\\s*\\/?>(?:<\\/slot>)?'),a=Object.fromEntries(e.map((u)=>[u.tag,{template:u.template,styles:u.styles,shadowMode:u.shadowMode,properties:u.properties}])),l=e.map((u)=>`export const render${u.name} = (props = {}, slots = {}) => renderComponent('${u.tag}', props, slots);`).join(`
933
+ `);return`const definitions = ${JSON.stringify(a,null,2)};
934
+ const escapeHTML = (value) => String(value ?? '')
935
+ .replaceAll('&', '&amp;').replaceAll('<', '&lt;').replaceAll('>', '&gt;')
936
+ .replaceAll('"', '&quot;').replaceAll("'", '&#039;');
937
+ const valueAt = (values, path) => path.trim().split('.').reduce((value, part) => value?.[part], values);
938
+
939
+ export function renderComponent(tag, props = {}, slots = {}) {
940
+ const definition = definitions[tag];
941
+ if (!definition) throw new Error('Unknown STX component: ' + tag);
942
+ const values = Object.fromEntries(Object.entries(definition.properties).map(([name, property]) => [name, property.default]));
943
+ Object.assign(values, props);
944
+ let template = definition.template
945
+ .replace(new RegExp(${n}, 'g'), (_match, expression) => String(valueAt(values, expression) ?? ''))
946
+ .replace(new RegExp(${r}, 'g'), (_match, expression) => escapeHTML(valueAt(values, expression)))
947
+ .replace(new RegExp(${i}, 'gi'), (_match, name) => String(slots[name || 'default'] ?? ''));
948
+ const attributes = Object.entries(definition.properties).flatMap(([name, property]) => {
949
+ if (property.attribute === false || !(name in props)) return [];
950
+ const attribute = property.attribute || name.replace(/[A-Z]/g, letter => '-' + letter.toLowerCase());
951
+ const value = props[name];
952
+ if (value == null || value === false) return [];
953
+ if (value === true) return [attribute];
954
+ const serialized = typeof value === 'object' ? JSON.stringify(value) : value;
955
+ return [attribute + '=\\"' + escapeHTML(serialized) + '\\"'];
956
+ }).join(' ');
957
+ if (definition.shadowMode) {
958
+ template = '<template shadowrootmode="' + definition.shadowMode + '">' +
959
+ (definition.styles ? '<style>' + definition.styles + '</style>' : '') + template + '</template>' +
960
+ String(slots.default ?? '');
961
+ }
962
+ return '<' + tag + (attributes ? ' ' + attributes : '') + '>' + template + '</' + tag + '>';
963
+ }
964
+
965
+ ${l}
966
+ `}async function nl(e){let n=at.resolve(e.inputDir),r=at.resolve(e.outputDir);if(!(await zo(n).catch(()=>null))?.isDirectory())throw Error(`Component-library input directory does not exist: ${n}`);let a=e.components?.length?e.components:(await gu(n)).map((N)=>({file:N}));if(!a.length)throw Error(`No .stx components found in ${n}`);let l=await Promise.all(a.map((N)=>Au(n,N,e)));l.sort((N,H)=>N.tag.localeCompare(H.tag));let u=l.filter((N,H)=>l.findIndex((Z)=>Z.tag===N.tag)!==H);if(u.length)throw Error(`Duplicate custom-element tag: ${u[0].tag}`);let f=l.filter((N,H)=>l.findIndex((Z)=>Z.name===N.name)!==H);if(f.length)throw Error(`Duplicate component class name: ${f[0].name}`);await au(r,{recursive:!0});let x=[],v=async(N,H)=>{let Z=at.join(r,N);return await uu(Z,H.endsWith(`
967
+ `)?H:`${H}
968
+ `,"utf8"),x.push(Z),Z};await v("runtime.js",Tu());for(let N of l){if(await v(`${N.tag}.js`,Iu(N)),e.declarations!==!1)await v(`${N.tag}.d.ts`,Pu(N));if(e.css!==!1&&N.styles){let H=N.shadowMode?N.styles:Vo(N);await v(`${N.tag}.css`,e.minify?Uo(H):H)}}let I=l.map((N)=>`export { ${N.name}, default as ${N.name}Element } from './${N.tag}.js';`).join(`
969
+ `);if(await v("index.js",I),await v("ssr.js",Mu(l)),e.declarations!==!1)await v("index.d.ts",l.map((N)=>`export * from './${N.tag}.js'`).join(`
970
+ `)),await v("custom-elements.d.ts",Ou(l)),await v("ssr.d.ts",`${l.map((N)=>`export declare const render${N.name}: (props?: ${N.name}Props, slots?: Record<string, string>) => string`).join(`
971
+ `)}
972
+ export declare function renderComponent(tag: string, props?: Record<string, unknown>, slots?: Record<string, string>): string
973
+ ${l.map((N)=>`import type { ${N.name}Props } from './${N.tag}.js'`).join(`
974
+ `)}`);let D;if(e.manifest!==!1)D=await v("custom-elements.json",JSON.stringify(ju(l),null,2));let W;if(e.css!==!1){let N=l.filter((H)=>!H.shadowMode&&H.styles).map(Vo).join(`
975
+
976
+ `);if(N)W=await v("bundle.css",e.minify?Uo(N):N)}let L;if(e.bundle!==!1){L=at.join(r,"bundle.js");let N;try{N=await Bun.build({entrypoints:[at.join(r,"index.js")],outdir:r,naming:"bundle.js",target:"browser",format:"esm",minify:e.minify??!0,sourcemap:e.sourcemap||"none"})}catch(H){let Z=H instanceof AggregateError?H.errors:[H],U=Z.map((V)=>String(V).trim()).filter(Boolean).join(`
977
+ `);throw AggregateError(Z,`Failed to bundle component library${U?`
978
+ ${U}`:""}`)}if(!N.success){let H=N.logs.map((Z)=>String(Z).trim()).filter(Boolean).join(`
979
+ `);throw AggregateError(N.logs,`Failed to bundle component library${H?`
980
+ ${H}`:""}`)}if(x.push(L),e.sourcemap==="external")x.push(`${L}.map`)}let z=await Promise.all(x.map(async(N)=>(await zo(N)).size));return{components:l.map((N)=>({name:N.name,tag:N.tag,source:N.sourcePath,module:at.join(r,`${N.tag}.js`)})),files:x,manifest:D,bundle:L,cssBundle:W,totalBytes:z.reduce((N,H)=>N+H,0)}}var Du=new Set(mt);function Ut(e){let n=Bt(e),r=n.find((D)=>D.name==="InheritedContext");if(!r)return;let i=/^(?:interface\s+InheritedContext|type\s+InheritedContext\s*=)\s*\{/.test(t(r.text).trim()),a=t(e),l=C(a).depths,u=[...a.matchAll(/\b(?:interface|type)\s+InheritedContext\b/g)].find((D)=>l[D.index]===0)?.index??0,f=r.text.slice(r.text.indexOf("{")+1,r.text.lastIndexOf("}")),x=t(f),v=C(x).depths,I=[...x.matchAll(/(?:^|[;,\n])\s*(?:readonly\s+)?([A-Za-z_$][\w$]*)\??\s*:/g)].filter((D)=>v[D.index]===0).map((D)=>D[1]);return{keys:i?I:[],types:n.map((D)=>D.text).join(`
981
+ `),offset:Math.max(0,u),...!i?{unsupported:"InheritedContext requires a local non-generic object interface or object type alias with named properties"}:{}}}function Nu(e){let n=[],r=t(e);for(let i of e.matchAll(/\bimport\s+(type\s+)?([\w$*{}\s,]+?)\s+from\s*(['"])([^'"]+)\3/g)){if(i[1]||r.slice(i.index,i.index+6)!=="import")continue;let a=i[2].trim(),l=["stx","@stacksjs/stx"].includes(i[4]);if(/^[A-Za-z_$][\w$]*$/.test(a)){n.push(a);continue}if(!a.startsWith("{")||!a.endsWith("}"))continue;for(let u of a.slice(1,-1).split(",")){if(/^\s*type\s+/.test(u))continue;let[f,x=f]=u.trim().split(/\s+as\s+/);if(x&&!(l&&Du.has(f)))n.push(x)}}return n}function Ys(e){let n=Ut(e);if(!n||n.unsupported)return"";let r=new Set(he(e));return n.keys.filter((i)=>!r.has(i)).map((i)=>`declare const ${i}: InheritedContext[${JSON.stringify(i)}];`).join(`
982
+ `)}function Zo(e,n){let r=[ds],i=[],a=new Map,l=dt.resolve(n.filePath),u=l.split(dt.sep).lastIndexOf("views"),f=u>=0?l.split(dt.sep).slice(0,u).join(dt.sep):dt.dirname(l),x=dt.resolve(n.partialsDir||dt.join(f,"partials")),v=dt.resolve(n.layoutsDir||dt.join(f,"views/layouts"));if([x,v].some((H)=>l===H||l.startsWith(H+dt.sep)))return{declarations:"",checks:i,dependencies:a};let I=(H)=>n.readTemplate?.(H)??(qo.existsSync(H)?qo.readFileSync(H,"utf8"):void 0),D=0,W=!1,L=[];function z(H,Z){let U=e.slice(0,H).split(`
983
+ `).length,V=H-e.lastIndexOf(`
984
+ `,H-1),K={code:e.slice(H,e.indexOf(`
985
+ `,H)<0?e.length:e.indexOf(`
986
+ `,H)),line:U,column:V,kind:"directive",offset:H,anchor:!0};i.push({expression:K,statement:{text:`;${Z}`,prefixLength:1}})}function N(H,Z,U,V,K,ne){let ae=`__StxInherited${D++}`;while((e+H+[...a.values()].join("")).includes(ae))ae+="_";let de=Se(H).filter((je)=>je.kind==="server").map((je)=>je.code).join(`
987
+ `),pe=`${ae}ParentValue`,Ee=`${ae}ParentType`;r.push(`type ${Ee} = ${U};`);let Ce=mr(hs(de,dt.dirname(Z)),ae);r.push(...Ce.imports);let $e=Ut(de);if($e&&K!==void 0){W=!0;let je=Ce.imports.length?Ce.aliases.join(`
988
+ `):"",Te=gs(`${je}
989
+ ${$e.types}
990
+ const __contract = defineProps<InheritedContext>();`,`${ae}Contract`);r.push(Te.declarations),r.push(`declare const ${ae}Input: ${Ee};`),z(K,$e.unsupported?`({})[${JSON.stringify($e.unsupported)}];`:`${ae}Input satisfies ${Te.props};`)}let ye=[...new Set([...he(de),...Nu(de)])],He=[...new Set([...V,...$e?.keys||[]])].filter((je)=>!ye.includes(je)),tt=$e?`${Ee} & ${ae}Contract.__StxProps`:Ee,ct=Cn(Ce.body).replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class|interface|type)\b)/gm,""),nt=[],ht=rn(H),ut=/@(include|extends|layout)\s*\(/g,st;while(st=ut.exec(ht)){let je=kn(ht,ut.lastIndex-1);if(!je)continue;ut.lastIndex=je.end;let Te=/^\s*(['"])(.*?)\1\s*(?:,\s*([\s\S]*))?$/.exec(je.expression);if(!Te){L.push({offset:K??st.index,message:`Inherited context cannot be checked across dynamic @${st[1]}`});continue}let pt=Te[2],et=st[1];if(et!=="include"&&Te[3])L.push({offset:K??st.index,message:`Inherited context cannot be checked for unsupported @${et} data arguments`});let an=et==="include"?x:v,At=dt.resolve(pt.startsWith(".")?dt.dirname(Z):an,pt.endsWith(".stx")?pt:pt+".stx");if(I(At)===void 0){L.push({offset:K??st.index,message:`Inherited context target cannot be resolved: ${pt}`});continue}nt.push({name:`edge${nt.length}`,target:At,kind:et,args:et==="include"?Te[3]||"{}":"{}",offset:K??st.index})}let Ot=`{ ...${pe}${ye.length?", "+ye.join(", "):""} }`;r.push(`namespace ${ae} {
991
+ ${Ce.aliases.join(`
992
+ `)}
993
+ export async function read(${pe}: ${K===void 0?"{}":tt}) {
994
+ ${He.length?`const { ${He.join(", ")} } = ${pe};`:""}
995
+ ${ct}
996
+ return { context: ${Ot}${nt.map((je)=>`, ${je.name}: { ...${Ot}, ...(${je.args}) }`).join("")} };
997
+ }
998
+ }`);for(let je of nt){if(ne.includes(je.target)||ne.length>=32){L.push({offset:je.offset,message:"Inherited context cannot be checked across a cyclic or overly deep template graph"});continue}let Te=I(je.target);a.set(je.target,Te),N(Te,je.target,`Awaited<ReturnType<typeof ${ae}.read>>[${JSON.stringify(je.name)}]`,[...new Set([...V,...ye])],je.offset,[...ne,je.target])}return ae}if(N(e,l,"{}",[],void 0,[l]),W||n.contractsKnown)for(let H of L)z(H.offset,`({})[${JSON.stringify(H.message)}];`);return{declarations:W?r.join(`
999
+ `):"",checks:i,dependencies:a}}function Zs(e,n){let r=vn(e),i=fr(e);if(!i)return;let a;try{a=dr(e,"component")}catch(K){let ne=i.open,ae=K instanceof Error?K.message:"Invalid component metadata";return{declarations:"",checks:[{text:`({})[${JSON.stringify(ae)}];`,line:e.slice(0,ne).split(`
1000
+ `).length,column:ne-e.lastIndexOf(`
1001
+ `,ne-1),origin:"component"}],project:(de)=>({code:de,columns:new Map})}}let l=Ie(r).filter((K)=>{let ne=J(K.attrs);return Lt(ne)&&ne.has("client")&&!ne.has("server")&&!ne.has("component")&&!ne.has("stx:component")&&!ne.has("src")}),u=l.map((K)=>e.slice(K.bodyStart,K.bodyEnd)).join(`
1002
+ `),f=ms(u,n),x=Bt(u).some((K)=>K.name==="ComponentState")||xs(u).includes("ComponentState"),v=Object.entries(a.properties||a.props||{}).map(([K,ne])=>`${JSON.stringify(K)}: ${sn(ne)}`).join("; "),I=[...new Set(f.map((K)=>K.name))],D=[`interface __StxMetadataProperties { ${v} }`,"type __StxNativeProperties = Omit<__StxMetadataProperties, keyof HTMLElement> & Pick<HTMLElement, Extract<keyof __StxMetadataProperties, keyof HTMLElement>>;","type __StxAny<T> = 0 extends (1 & T) ? true : false;","type __StxAnyFields<T> = { [K in keyof T]-?: __StxAny<T[K]> extends true ? K : never }[keyof T];","type __StxSpecific<T> = __StxAny<T> extends true ? false : T extends object ? string extends keyof T ? false : number extends keyof T ? false : symbol extends keyof T ? false : __StxAnyFields<T> extends never ? true : false : false;",x?"type __StxState = __StxSpecific<ComponentState> extends true ? ComponentState : {};":"type __StxState = {};",x?'declare function __stxSpecificState(value: __StxSpecific<ComponentState> extends true ? true : "ComponentState requires named explicit fields without any or index signatures"): void;':"",x?"declare const __stxStateProperties: Pick<ComponentState, Extract<keyof ComponentState, keyof __StxInstanceProperties>>;":"",x?'declare function __stxStateMethods(value: Extract<keyof ComponentState, __StxMethodNames | "emit" | "requestUpdate" | "updateComplete" | "renderRoot"> extends never ? true : "ComponentState cannot redeclare component methods"): void;':"",`type __StxMethodNames = ${I.map((K)=>JSON.stringify(K)).join(" | ")||"never"};`,"type __StxInstanceProperties = Omit<HTMLElement, __StxMethodNames | keyof __StxNativeProperties> & __StxNativeProperties;",'type __StxPrivateKeys<T> = Exclude<keyof T, keyof HTMLElement | keyof __StxNativeProperties | __StxMethodNames | "emit" | "updateComplete" | "requestUpdate" | "renderRoot">;',x?'declare function __stxOptionalPrivate(value: { [K in __StxPrivateKeys<ComponentState>]-?: {} extends Pick<ComponentState, K> ? never : K }[__StxPrivateKeys<ComponentState>] extends never ? true : "Private ComponentState fields must be optional until initialized"): void;':"","type __StxRefinedProperties = { [K in keyof __StxNativeProperties]: K extends keyof __StxState ? __StxAny<__StxState[K]> extends true ? __StxNativeProperties[K] : __StxState[K] extends __StxNativeProperties[K] ? __StxState[K] : __StxNativeProperties[K] : __StxNativeProperties[K] };","type __StxNativeComponent = Omit<HTMLElement, keyof __StxNativeProperties | __StxMethodNames> & __StxRefinedProperties & Partial<Pick<__StxState, __StxPrivateKeys<__StxState>>> & {","readonly updateComplete: Promise<void>; requestUpdate(): Promise<void>; readonly renderRoot: HTMLElement | ShadowRoot;","emit<T = unknown>(name: string, detail?: T, options?: CustomEventInit<T>): boolean;",...I.map((K)=>`${JSON.stringify(K)}: typeof ${K};`),"}"].filter(Boolean).join(`
1003
+ `),W=-1;for(let K of l){let ne=K.bodyStart,ae=e.slice(ne,K.bodyEnd),de=t(ae),pe=C(de).depths,Ee=[...de.matchAll(/\b(?:interface|type)\s+ComponentState\b/g)].find((Ce)=>pe[Ce.index]===0)??(xs(ae).includes("ComponentState")?/\bComponentState\b/.exec(de):void 0);if(Ee){W=ne+Ee.index;break}}let L=x&&W>=0?[{origin:"client",text:"__stxSpecificState(true); __stxStateMethods(true); __stxOptionalPrivate(true); __stxStateProperties satisfies Pick<__StxInstanceProperties, Extract<keyof ComponentState, keyof __StxInstanceProperties>>;",line:e.slice(0,W).split(`
1004
+ `).length,column:W-e.lastIndexOf(`
1005
+ `,W-1)}]:[],{start:z,code:N}=i,H=t(N),Z=C(H).depths,U=new Map,V=!1;for(let K of N.matchAll(/"(?:\\.|[^"\\])*"\s*:/g)){let ne=JSON.parse(K[0].slice(0,K[0].lastIndexOf(":")).trim());if(Z[K.index]===1&&["properties","props"].includes(ne)){V=!0;continue}if(V&&Z[K.index]===1)V=!1;if(V&&Z[K.index]===2&&!U.has(ne))U.set(ne,z+K.index)}for(let[K,ne]of Object.entries(a.properties||a.props||{})){let ae=U.get(K)??z,de=e.slice(0,ae).split(`
1006
+ `).length,pe=ae-e.lastIndexOf(`
1007
+ `,ae-1);if(!ne||typeof ne!=="object"||!["string","number","boolean","object","array"].includes(ne.type))L.push({text:`({})[${JSON.stringify(`Property ${K} must declare string, number, boolean, object or array`)}];`,line:de,column:pe,origin:"component"});if(ne&&ne.default!==void 0)L.push({text:`const __stxDefault${L.length}: ${sn(ne)} = ${JSON.stringify(ne.default)};`,line:de,column:pe,origin:"component"})}return{declarations:D,checks:L,project(K){let ne=new Map,ae=[],de=0;for(let pe of ms(K,n)){if(/^\s*this\s*:/.test(pe.parameters))continue;let Ee=pe.parameterOffset,Ce=`this: __StxNativeComponent${pe.parameters.trim()?", ":""}`;ae.push(K.slice(de,Ee),Ce);let $e=K.slice(0,Ee).split(`
1008
+ `).length,ye=Ee-K.lastIndexOf(`
1009
+ `,Ee-1),He=ne.get($e)||[],tt=He.at(-1),ct=ye+(tt?tt.generatedEnd-tt.sourceEnd:0);He.push({sourceStart:ye,sourceEnd:ye,generatedStart:ct,generatedEnd:ct+Ce.length}),ne.set($e,He),de=Ee}return ae.push(K.slice(de)),{code:ae.join(""),columns:ne}}}}function Jo(e){let n=[],r=[],i=/@foreach\s*\(|@endforeach\b/g,a;while(a=i.exec(e)){if(a[0].startsWith("@endforeach")){let x=r.pop();if(x)x.end=a.index,n.push(x);continue}let l=kn(e,i.lastIndex-1);if(!l)continue;let u=gr(l.expression),f=l.end;if(u)r.push({start:f,end:e.length,iterable:u.iterable,binding:u.key?`${u.value}, ${u.key}`:u.value});i.lastIndex=f}return n.sort((l,u)=>l.start-u.start)}function Lu(e){let n=(r)=>r.replace(/[^\n]/g," ");return e.replace(/<!--[\s\S]*?-->/g,n).replace(/\{\{--[\s\S]*?--\}\}/g,n)}function Se(e){let n=[],r=Lu(e);for(let i of Ie(r)){let a=i.attrs.trim(),l=J(a),{bodyStart:u,bodyEnd:f}=i,x=e.slice(u,f);if(l.has("src")||l.has("component")||l.has("stx:component"))continue;if(!Lt(l))continue;let v=l.has("server")?"server":l.has("client")?"client":"plain",I=jn(e,u);n.push({kind:v,code:x,startLine:I,startColumn:Mn(e,u),offset:u,attrs:a})}return n}function jn(e,n){let r=1;for(let i=0;i<n&&i<e.length;i++)if(e.charCodeAt(i)===10)r++;return r}function Mn(e,n){let r=e.lastIndexOf(`
1010
+ `,n-1)+1;return n-r+1}function rn(e){let n=e.split(""),r=(a,l)=>{for(let u=a;u<l&&u<n.length;u++)if(n[u]!==`
1011
+ `)n[u]=" "},i=[/<script(?:\s[^>]*)?>[\s\S]*?<\/script>/gi,/<style(?:\s[^>]*)?>[\s\S]*?<\/style>/gi,/<!--[\s\S]*?-->/g,/\{\{--[\s\S]*?--\}\}/g,/@verbatim\b[\s\S]*?@endverbatim\b/g];for(let a of i){a.lastIndex=0;let l;while((l=a.exec(e))!==null)r(l.index,l.index+l[0].length)}return n.join("")}function ia(e){let n=0,r="";for(let i=0;i<e.length;i++){let a=e[i];if(r){if(a==="\\"){i++;continue}if(a===r)r="";continue}if(a==='"'||a==="'"||a==="`"){r=a;continue}if(a==="("||a==="["||a==="{"){n++;continue}if(a===")"||a==="]"||a==="}"){n--;continue}if(a==="|"&&n===0){if(e[i+1]==="|"){i++;continue}if(e[i-1]==="|")continue;return e.slice(0,i)}}return e}var oa=new Set([":for","x-for","v-for"]),bs=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,xr="__stx_interpolated",Xo="__StxElement",aa="__StxTemplateValue",zu=`type ${aa}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function Go(e){return e.replace(/\{\{[\s\S]*?\}\}/g,xr).replace(/\{!![\s\S]*?!!\}/g,xr)}function Bu(e,n,r){let i=0;for(let a=n;a<e.length;a++){let l=e[a];if(l==="{"){i++;continue}if(l!=="}"&&l!=="!")continue;if(e.startsWith(r,a)&&i===0)return a;if(l==="}"&&i>0)i--}return-1}function $i(e,n,r="0"){let i=`__stxScript${r}`;while((e+n).includes(i))i+="_";let a=new Map,l=[],u=[],f=t(e),x=ga(e),v=[],I=0;for(let N=0;N<f.length;N++){let H=f.startsWith("{{",N);if(!H&&!f.startsWith("{!!",N))continue;let Z=H?2:3,U=H?"}}":"!!}",V=Bu(f,N+Z,U);if(V<0)continue;let K=N,ne=e.slice(K,V+U.length),ae=ne.slice(Z,-U.length);N=V+U.length-1;let de=u.length,pe=yr(x,K),Ee=yr(x,K+(H?2:3));u.push({code:ia(ae),...Ee});let Ce=`${i}_${de}`,$e=ne.split(`
1012
+ `),ye=$e[0].length;$e[0]=Ce+" ".repeat(Math.max(0,ye-Ce.length));for(let nt=1;nt<$e.length;nt++)$e[nt]=$e[nt].replace(/[^\r]/g," ");let He=a.get(pe.line)??[],tt=He.at(-1),ct=pe.column+(tt?tt.generatedEnd-tt.sourceEnd:0);He.push({sourceStart:pe.column,sourceEnd:pe.column+ye,generatedStart:ct,generatedEnd:ct+$e[0].length}),a.set(pe.line,He),v.push(e.slice(I,K),$e.join(`
1013
+ `)),I=K+ne.length}v.push(e.slice(I));let D=v.join("");if(!u.length)return{code:D,columns:a,declarations:l};let{imports:W,aliases:L,body:z}=mr(n,i);for(let N of W)l.push({text:N});l.push({text:`namespace ${i}Scope {
1014
+ ${L.join(`
1015
+ `)}
1016
+ export async function read() {
1017
+ ${Cn(z).replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class|interface|type)\b)/gm,"")}
1018
+ return {`});for(let[N,H]of u.entries())l.push({text:`value${N}: (`}),l.push({text:H.code,origin:{line:H.line,column:H.column}}),l.push({text:"),"});l.push({text:`}
1019
+ }
1020
+ }`});for(let N=0;N<u.length;N++)l.push({text:`declare var ${i}_${N}: Awaited<ReturnType<typeof ${i}Scope.read>>['value${N}']`});return{code:D,columns:a,declarations:l}}function mr(e,n){let r=[],{imports:i,body:a}=la(e),l=[],u=0;for(let f of i.split(/\n(?=import\b)/)){if(!f.trim())continue;let x=/^import\s+(?:type\s+)?([\s\S]+?)\s+from\s*(['"][^'"]+['"])/.exec(f);if(!x){r.push(f);continue}let v=`${n}Module${u++}`;r.push(`import * as ${v} from ${x[2]}`);let I=x[1],D=/\{([\s\S]*?)\}/.exec(I);for(let N of D?.[1].split(",")??[]){let[H,Z=H]=N.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(H==="default")l.push(`const ${Z} = ${v}.default; type ${Z} = import(${x[2]}).default`);else if(H)l.push(`import ${Z} = ${v}.${H}`)}let W=I.replace(/\{[\s\S]*?\}/,""),L=/\*\s+as\s+(\w+)/.exec(W);if(L)l.push(`import ${L[1]} = ${v}`);let z=/^\s*([\w$]+)/.exec(W)?.[1];if(z)l.push(`const ${z} = ${v}.default; type ${z} = import(${x[2]}).default`)}return{imports:r,aliases:l,body:a}}function hr(e,n){let r=0;for(let i of e){if(n<i.generatedStart)break;if(n<i.generatedEnd)return i.sourceStart+Math.min(n-i.generatedStart,i.sourceEnd-i.sourceStart);r=i.sourceEnd-i.generatedEnd}return n+r}var Wu=["foreach","endforeach","forelse","endforelse","for","endfor","while","endwhile","empty","if","elseif","else","endif","unless","endunless","isset","endisset","switch","case","default","endswitch","auth","endauth","guest","endguest","env","endenv","once","endonce","break","continue"],Fu=new RegExp(String.raw`^[ \t]*@(?:${Wu.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function Cn(e){return e.replace(Fu,(n)=>n.replace(/[^\n]/g," "))}var Yo=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function Qs(e){let n=rn(e),r=[],i=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,a;while((a=i.exec(n))!==null){if(a[1]||a[3])continue;let f=a[2]??a[4]??"",x=a[2]!==void 0?2:3,v=ia(f);if(!v.trim())continue;let I=a.index+x+(v.length-v.trimStart().length);r.push({code:v.trim(),line:jn(n,I),column:Mn(n,I),offset:I,kind:"interpolation"})}let l=/@(if|elseif|else\s+if|unless)\b\s*\(/g;while((a=l.exec(n))!==null){let u=a.index+a[0].length-1,f=0,x=u;for(;x<n.length;x++){let W=n[x];if(W==="(")f++;else if(W===")"){if(f--,f===0)break}}if(f!==0)continue;let v=n.slice(u+1,x),I=v.trim();if(l.lastIndex=x+1,!I)continue;let D=u+1+(v.length-v.trimStart().length);r.push({code:I,line:jn(n,D),column:Mn(n,D),offset:a.index,kind:"condition"})}bs.lastIndex=0;while((a=bs.exec(n))!==null){let u=a[1],f=a[3]??"",x=u.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(Yo.has(x)||Yo.has(u))continue;if(!f.trim())continue;let v=a.index+a[0].indexOf(a[2],a[0].indexOf(u)+u.length)+1;if(oa.has(x)){let D=f.match(/\s+(?:in|of)\s+/);if(!D||D.index===void 0)continue;let W=f.slice(D.index+D[0].length),L=D.index+D[0].length+(W.length-W.trimStart().length);r.push({code:Go(W.trim()),line:jn(n,v+L),column:Mn(n,v+L),offset:v+L,kind:"directive",attribute:x});continue}let I=f.length-f.trimStart().length;r.push({code:Go(f.trim()),line:jn(n,v+I),column:Mn(n,v+I),offset:v+I,kind:"directive",attribute:x})}return r.sort((u,f)=>u.line-f.line||u.column-f.column),r}var Vu=2000;function Uu(e,n){let r=0,i=Math.min(e.length,n+Vu);for(let a=n;a<i;a++){let l=e[a];if(l==="(")r++;else if(l===")"){if(r--,r===0)return e.slice(n+1,a)}}return null}function Hu(e){let n=new Map,r=(f,x)=>{let v=f.split(/[,[\]{}()\s]+/).filter(Boolean);for(let I of v){let D=I.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(D))continue;let W=v.length===1?x:void 0,L=n.get(D);if(!L)n.set(D,{name:D,iterable:W});else if(L.iterable!==W)L.iterable=void 0}},i=/^\$?[A-Z_$][\w$]*$/i,a=(f)=>{let x=f.trim();return i.test(x)?x:void 0};for(let f of e.matchAll(/@for(?:each|else)\s*\(/g)){let x=Uu(e,f.index+f[0].length-1);if(x===null)continue;let v=Vt(x);if(!v)continue;r(v.itemVar.replace(/=>/g," "),a(v.arrayExpr))}for(let f of e.matchAll(/@for\s*\(\s*(?:(?:let|const|var)\s+)?([\w$]+|\[[^\]]*\]|\{[^}]*\})\s+(of|in)\s+([^)]*)/g))r(f[1],f[2]==="of"?a(f[3]):void 0);for(let f of e.matchAll(/@for\s*\(\s*(?:let|const|var)\s+([\w$]+)\s*[=;]/g))r(f[1]);let l=rn(e);bs.lastIndex=0;let u;while((u=bs.exec(l))!==null){let f=u[1].replace(/\..*$/,"");if(!oa.has(f))continue;let x=u[3].match(/\s+(?:in|of)\s+/);if(!x||x.index===void 0)continue;r(u[3].slice(0,x.index),a(u[3].slice(x.index+x[0].length)))}for(let f of e.matchAll(/@(?:php|js|ts)\b([\s\S]*?)@end(?:php|js|ts)\b/g))for(let x of f[1].matchAll(/\b(?:const|let|var|function|class)\s+([\w$]+)/g))r(x[1]);return[...n.values()].sort((f,x)=>f.name.localeCompare(x.name))}function he(e){return Nl(e)}var br=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"],Ku={$bool:"declare function $bool(value: unknown, fallback?: boolean): boolean",$num:"declare function $num(value: unknown, fallback?: number): number",$uid:"declare var $uid: string",$native:"declare var $native: boolean"};function rl(e=new Set){return[...br.filter((n)=>!e.has(n)).map((n)=>`declare var ${n}: any`),...Object.entries(Ku).filter(([n])=>!e.has(n)).map(([,n])=>n)].join(`
1021
+ `)}function sl(e){return new Set([...e.matchAll(/^declare (?:function|const|let|var)\s+([A-Za-z_$][\w$]*)/gm)].map((n)=>n[1]))}function ca(e){let n=/\bdefineClientPayload\s*\(\s*\{([\s\S]*?)\}\s*\)/g,r,i=!1,a=new Set,l=t(e);while((r=n.exec(l))!==null){i=!0;for(let u of qu(r[1])){let f=u.split(":")[0].trim();if(/^[A-Za-z_$][\w$]*$/.test(f))a.add(f)}}return i?[...a]:null}function qu(e){let n=[],r=0,i="";for(let a of e){if(a===","&&r===0){n.push(i),i="";continue}if(a==="("||a==="["||a==="{")r++;else if(a===")"||a==="]"||a==="}")r--;i+=a}return n.push(i),n.filter((a)=>a.trim().length>0)}function la(e){let n=/^[ \t]*import\b[\s\S]*?(?:from\s*['"][^'"]*['"]|['"][^'"]*['"])[ \t]*;?[ \t]*$/gm,r=[],i=e.replace(n,(a)=>(r.push(a.trim()),a.split(`
1022
+ `).map(()=>"").join(`
1023
+ `)));return{imports:r.join(`
1024
+ `),body:i}}function Bt(e){let n=t(e),r=Array(n.length),i=0;for(let f=0;f<n.length;f++){let x=n[f];if(x==="}"||x===")"||x==="]")i=Math.max(0,i-1);if(r[f]=i,x==="{"||x==="("||x==="[")i++}let a=[],l=/^[ \t]*(?:export[ \t]+)?(interface|type)[ \t]+([A-Za-z_$][\w$]*)/gm,u;while((u=l.exec(n))!==null){if(r[u.index]!==0)continue;let f=u[1],x=u[2],v;if(f==="interface"){let I=n.indexOf("{",u.index);if(I===-1)continue;let D=0;v=-1;for(let W=I;W<n.length;W++)if(n[W]==="{")D++;else if(n[W]==="}"&&--D===0){v=W+1;break}if(v===-1)continue}else{let I=0;v=n.length;for(let D=n.indexOf("=",u.index)+1;D<n.length;D++){let W=n[D];if(W==="{"||W==="["||W==="("||W==="<")I++;else if(W==="}"||W==="]"||W===")"||W===">")I--;else if(I<=0&&(W===";"||W===`
1025
+ `&&!/[=|&,<([{]\s*$/.test(n.slice(Math.max(0,D-40),D)))){v=W===";"?D+1:D;break}}}a.push({name:x,text:e.slice(u.index,v).replace(/^[ \t]*export[ \t]+/,"")}),l.lastIndex=v}return a}function Zu(e){let n=t(e),r=[],i=/^[ \t]*(?:export[ \t]+)?(?:const|let|var)[ \t]+/gm,a,l=0,u=0;while((a=i.exec(n))!==null){for(;u<a.index;u++){let v=n[u];if(v==="{"||v==="("||v==="[")l++;else if(v==="}"||v===")"||v==="]")l=Math.max(0,l-1)}if(l!==0)continue;let f=0,x=n.length;for(let v=a.index+a[0].length;v<n.length;v++){let I=n[v];if(I==="{"||I==="("||I==="[")f++;else if(I==="}"||I===")"||I==="]")f--;else if(f<=0&&(I===";"||I===`
1026
+ `)){x=I===";"?v+1:v;break}}if(/\bdefineProps\s*(?:<|\()/.test(n.slice(a.index,x)))r.push(e.slice(a.index,x).replace(/^[ \t]*export[ \t]+/,"").trim())}return r}function Ri(e){let n=e.filter((a)=>a.kind==="server").map((a)=>a.code).join(`
1027
+ `);if(/\bdefineProps\s*(?:<|\()/.test(t(n)))return n;let r=ua(n),i=e.filter((a)=>a.kind!=="server").flatMap((a)=>{let l=Zu(a.code);if(!l.length)return[];return[...Bt(a.code).filter((u)=>!r.has(u.name)).map((u)=>u.text),...l]});return[n,...i].filter(Boolean).join(`
1028
+ `)}function ua(e){return new Set(Bt(e).map((n)=>n.name))}function ol(e,n=""){let r=ca(e),i=ua(n),a=Bt(e).filter((v)=>!i.has(v.name)).map((v)=>v.text);if(!r){let v=he(e).filter((I)=>!zt(n,I));if(v.length===0&&a.length===0)return"";return["",`// ${Gu}`,...a,...v.map((I)=>`declare var ${I}: any`)].join(`
1029
+ `)}if(r.length===0)return a.length>0?["",`// ${ea}`,...a].join(`
1030
+ `):"";let{imports:l,body:u}=la(e),f=u.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),x=["",`// ${ea}`];if(l)x.push(l);return x.push(...a),x.push(`async function ${ta}() {`,f,` return { ${r.join(", ")} }`,"}",`type ${na} = Awaited<ReturnType<typeof ${ta}>>`,...r.map((v)=>`declare var ${v}: ${na}[${JSON.stringify(v)}]`)),x.join(`
1031
+ `)}function Ai(e){let n=t(e),r=n.split(""),i=[],a=0,l=0;for(let f=0;f<r.length;f++){let x=r[f];if(x===`
1032
+ `)l=f+1;if(x==="{"||x==="("||x==="["){if(a===0&&x!=="("&&Ju.test(n.slice(l,f))){let v=pa(n,f);if(v!==-1)i.push(...fa(n.slice(f,v+1)))}a++;continue}if(x==="}"||x===")"||x==="]"){a=Math.max(0,a-1);continue}if(a>0&&x!==`
1033
+ `)r[f]=" "}let u=he(r.join(""));return i.length===0?u:[...new Set([...u,...i])].sort()}var Ju=/^\s*(?:export\s+)?(?:const|let|var)\s*$/;function pa(e,n){let r=0;for(let i=n;i<e.length;i++){let a=e[i];if(a==="{"||a==="("||a==="[")r++;else if(a==="}"||a===")"||a==="]")r--;if(r===0)return i}return-1}function Xu(e){let n=[],r=0,i=0;for(let a=0;a<e.length;a++){let l=e[a];if(l==="{"||l==="("||l==="[")r++;else if(l==="}"||l===")"||l==="]")r--;else if(l===","&&r===0)n.push(e.slice(i,a)),i=a+1}return n.push(e.slice(i)),n}function Qo(e){let n=0;for(let r=0;r<e.length;r++){let i=e[r];if(i==="{"||i==="("||i==="[")n++;else if(i==="}"||i===")"||i==="]")n--;else if(n===0&&(i===":"||i==="="))return{index:r,char:i}}return null}function fa(e){let n=[],r=(a)=>{let l=a.trim().replace(/^\.\.\./,"").trim();if(l.startsWith("{")||l.startsWith("[")){let f=pa(l,0);if(f!==-1)n.push(...fa(l.slice(0,f+1)));return}let u=Qo(l);if(u)l=l.slice(0,u.index).trim();if(/^[A-Z_$][\w$]*$/i.test(l))n.push(l)},i=e.slice(1,-1);for(let a of Xu(i)){if(!a.trim())continue;if(e[0]==="["){r(a);continue}let l=Qo(a);r(l?.char===":"?a.slice(l.index+1):a)}return n}function il(e,n){if(ca(e)!==null)return[];let r=Ai(e),i=De(n,new Set(r)),a=new Set(E);return r.filter((l)=>{if(a.has(l))return!1;if(zt(n,l))return!1;return i.has(l)})}var ea="stx: types for the declared client payload (#1868)",Gu="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",ta="__stxServerScope",na="__StxClientPayload";var sa=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","$native","props","slot"];var Yu=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function Qu(e){let n=new Map,r=/!|===|!==|==|!=|&&|\|\||<|>|\btypeof\b|\binstanceof\b|\bin\b/;for(let i of e){let a=t(i),{depths:l,balanced:u}=C(a);if(!u)continue;let f=/^([ \t]*(?:export[ \t]+)?const[ \t]+)([A-Za-z_$][\w$]*)[ \t]*(?::[^=\n]+)?=[ \t]*([^\n]+)$/gm;for(let x of a.matchAll(f)){let v=x.index??0;if(l[v+x[1].length]!==0)continue;let I=x[2],D=v+x[0].length-x[3].length,W=i.slice(D,v+x[0].length).trim().replace(/;$/,"").trim(),L=x[3],z=r.test(L)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(L)&&!/[,+\-*/%&|?:=]$/.test(W)&&C(L).balanced;n.set(I,n.has(I)||!z?null:W)}}return new Map([...n].filter((i)=>i[1]!==null))}function da(e,n,r=0,i=new Set){if(n.size===0||r>=5)return e;let a=t(e),l="",u=0;for(let f of a.matchAll(/[A-Za-z_$][\w$]*/g)){let x=f.index??0,v=f[0],I=n.get(v);if(!I||i.has(v))continue;let D=a.slice(0,x).trimEnd(),W=a.slice(x+v.length).trimStart();if(D.endsWith(".")||/^:(?!:)/.test(W)&&/[{,]$/.test(D))continue;if(x>0&&/[\w$]/.test(a[x-1]))continue;l+=`${e.slice(u,x)}(${da(I,n,r+1,new Set([...i,v]))})`,u=x+v.length}return l+e.slice(u)}function ep(e,n){let r=/@(if|unless|elseif|else|endif|endunless)\b\s*(\()?/g,i=[],a;while((a=r.exec(e))!==null){if(a.index>n)break;let l=a[1];if(a.index===n){if(l==="elseif"){let f=i[i.length-1];if(f?.current)f.seen.push(f.current);if(f)f.current=null}break}if(l==="endif"||l==="endunless"){i.pop();continue}let u="";if(a[2]==="("){let f=0,x=a.index+a[0].length-1,v=x+1;for(;x<e.length;x++){let I=e[x];if(I==="(")f++;else if(I===")"){if(f--,f===0)break}}u=e.slice(v,x).trim(),r.lastIndex=x+1}if(l==="if")i.push({seen:[],current:u});else if(l==="unless")i.push({seen:[],current:`!(${u})`});else if(l==="elseif"||l==="else"){let f=i[i.length-1];if(!f)continue;if(f.current)f.seen.push(f.current);f.current=l==="elseif"?u:null}}return i.flatMap((l)=>[...l.seen.map((u)=>`!(${u})`),...l.current?[l.current]:[]]).filter(Boolean)}function tp(e){let n=e.code.trim();if(!n)return null;if(e.attribute?.startsWith("@")){if(Yu.test(n))return null;let i=";(($event: any): void => { ";return{text:`${i}${n} });`,prefixLength:i.length}}let r=";void ((";return{text:`${r}${n}));`,prefixLength:r.length}}var np=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function hs(e,n){return eo(e,n).code}function eo(e,n){let r=new Map;if(!n)return{code:e,columns:r};let i=ga(e),a=[],l=0;for(let u of e.matchAll(np)){let f=u.index,[x,v,I,D]=u,W=ra.resolve(n,D).replace(/\\/g,"/"),L=`${v}${I}${W}${I}`;if(a.push(e.slice(l,f),L),l=f+x.length,x.includes(`
1034
+ `))continue;let z=yr(i,f),N=r.get(z.line)??[],H=N.at(-1),Z=z.column+(H?H.generatedEnd-H.sourceEnd:0);N.push({sourceStart:z.column,sourceEnd:z.column+x.length,generatedStart:Z,generatedEnd:Z+L.length}),r.set(z.line,N)}return a.push(e.slice(l)),{code:a.join(""),columns:r}}function sp(e,n,r){let i=hr(e.importColumns?.get(n)??[],r);return hr(e.scriptColumns?.get(n)??[],hr(e.componentColumns?.get(n)??[],i))}function Pi(e){return" ".repeat(Math.max(0,(e.startColumn??1)-1))}function xs(e){let n=new Set,r=t(e);for(let i of r.matchAll(/\bimport\s+(?:type\s+)?([\w$*{}\s,]+?)\s+from\b/g)){let a=i[1],l=/\{([^}]*)\}/.exec(a);for(let v of l?.[1].split(",")??[]){let I=v.trim().replace(/^type\s+/,"").split(/\s+as\s+/).pop()?.trim();if(I&&/^[A-Z_$][\w$]*$/i.test(I))n.add(I)}let u=a.replace(/\{[^}]*\}/,""),f=/\*\s*as\s+([A-Z_$][\w$]*)/i.exec(u);if(f)n.add(f[1]);let x=/^\s*([A-Z_$][\w$]*)/i.exec(u);if(x&&x[1]!=="type")n.add(x[1])}return[...n].sort()}function Ii(e,n={}){let r=Se(e),i=n.scriptKinds?r.filter((K)=>n.scriptKinds.includes(K.kind)):r,a=Zs(e,n.componentMethodValidator),l=n.filePath&&n.templateExpressions!==!1?Zo(e,{filePath:n.filePath,partialsDir:n.partialsDir,layoutsDir:n.layoutsDir,contractsKnown:n.inheritedContractsKnown,readTemplate:n.readComponent}):void 0,u=new Map,f=e.split(`
1035
+ `),x=Array.from({length:f.length},()=>""),v=new Map,I=new Map,D=new Map,W=[],L=Ri(r),z=n.filePath&&n.templateExpressions!==!1?Lo(e,rn(e),{filePath:n.filePath,componentsDir:n.componentsDir,projectRoot:n.projectRoot,readComponent:n.readComponent,scriptCode:(K,ne)=>Se(K).map((ae)=>hs(ae.code,ra.dirname(ne))).join(`
1036
+ `)}):void 0,N=new Set,H=[];for(let[K,ne]of i.entries()){let ae=$i(Pi(ne)+ne.code,L,String(K));for(let[$e,ye]of ae.columns)I.set(ne.startLine+$e-1,ye);for(let $e of ae.declarations)W.push({text:hs($e.text,n.originDir??""),origin:$e.origin?{...$e.origin,line:$e.origin.line+ne.startLine-1}:void 0});let de=ne.kind==="client"&&a?a.project(ae.code):void 0;for(let[$e,ye]of de?.columns??[])u.set(ne.startLine+$e-1,ye);let pe=Cn(de?.code??ae.code),Ee=eo(pe,n.originDir??"");for(let[$e,ye]of Ee.columns)D.set(ne.startLine+$e-1,ye);let Ce=Ee.code.split(`
1037
+ `);Ce.forEach(($e,ye)=>{let He=ne.startLine-1+ye;if(He<x.length)x[He]=$e,N.add(He)}),H.push(ne.startLine-1+Ce.length-1)}for(let K of H){let ne=x[K]?.trim()===""?K:K+1;if(ne<x.length&&x[ne].trim()===""&&(ne===K||!N.has(ne)))x[ne]=";"}let Z=(K,ne)=>{for(let[ae,de]of K.split(`
1038
+ `).entries())if(x.push(de),ne)v.set(x.length,ae===0?ne:{...ne,line:ne.line+ae,column:1,prefixLength:0})},U=Ys(i.filter((K)=>K.kind==="server").map((K)=>K.code).join(`
1039
+ `));if(U)Z(U);for(let K of i.filter((ne)=>ne.kind==="server")){let ne=Ut(K.code);if(!ne?.unsupported)continue;let ae=K.code.slice(0,ne.offset),de=K.startLine+ae.split(`
1040
+ `).length-1,pe=ne.offset-K.code.lastIndexOf(`
1041
+ `,ne.offset-1)+(de===K.startLine?(K.startColumn??1)-1:0);Z(`;({})[${JSON.stringify(ne.unsupported)}];`,{line:de,column:pe,anchor:!0})}if(l?.declarations)Z(l.declarations);for(let K of W)Z(K.text,K.origin);if(a){if(Z(a.declarations),n.nativeChecks!==!1)for(let K of a.checks)Z(K.text,{line:K.line,column:K.column,diagnosticOrigin:K.origin,anchor:!0})}if(n.globals!==!1){Z("");let K=new Set([...i.flatMap((pe)=>he(pe.code)),...i.flatMap((pe)=>xs(pe.code))]),ne=(pe)=>{if(!K.has(pe)&&!n.declaredGlobals?.includes(pe))Z(`declare var ${pe}: any`)};if(n.runtimeGlobals!==!1){if(!K.has("window"))Z("declare var window: any");for(let pe of E)ne(pe)}let ae=[...new Set([...br,...Ae,...sa])].filter((pe)=>!n.declaredGlobals?.includes(pe)&&(n.runtimeGlobals!==!1||!E.includes(pe)));if(n.contextScope==="global"){Z("declare global {");for(let pe of ae)Z(` var ${pe}: any`);Z("}")}else{for(let pe of br)ne(pe);for(let pe of Ae)ne(pe);for(let pe of sa)ne(pe)}Z(`declare var ${xr}: any`);let de=new Set(i.flatMap((pe)=>he(pe.code)));Z(`type ${Xo}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let pe of a?[]:Hu(e)){if(de.has(pe.name))continue;let Ee=pe.iterable&&de.has(pe.iterable)?`${Xo}<typeof ${pe.iterable}>`:"any";Z(`declare var ${pe.name}: ${Ee}`)}}if(n.templateExpressions!==!1){if(z?.declarations)for(let ne of z.declarations.split(`
1042
+ `))Z(ne);let K=Qs(e).map((ne)=>{let ae=z?.events.get(ne.offset??-1);if(ae){ne.anchor=!0;let de=ne.code.trim(),pe=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(de),Ee=pe?`void ((${pe[2]}) satisfies __StxAssignedValue<typeof ${pe[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(de)?`${de} satisfies (($event: ${ae}) => unknown)`:de,Ce=`;(($event: ${ae}): void => { `;return{expression:ne,statement:{text:`${Ce}${Ee} });`,prefixLength:Ce.length}}}return{expression:ne,statement:tp(ne)}}).filter((ne)=>ne.statement!==null);if(K.push(...z?.checks||[],...l?.checks||[]),K.length>0){let ne=rn(e),ae=ps(ne),de=a?Jo(ne):[];if(a)Z("type __StxNativeValue<T> = T extends readonly (infer E)[] ? E : T extends object ? T[keyof T] : never; declare function __stxEach<T>(items: T, callback: (item: __StxNativeValue<T>, key: string) => void): void;");let pe=Qu(i.map((ye)=>ye.code)),Ce=[...new Set(i.flatMap((ye)=>he(ye.code)))].filter((ye)=>/^[A-Z_$][\w$]*$/i.test(ye)),$e=0;if(a)Z("function __stxNativeTemplate(this: __StxNativeComponent) {");if(Ce.length>0){Z(zu);for(let ye of Ce)Z(`function __StxRead_${ye}() { return ${ye} }`),Z(`type __StxT_${ye} = ${aa}<ReturnType<typeof __StxRead_${ye}>>`);Z(`;((${Ce.map((ye)=>`${ye}: __StxT_${ye}`).join(", ")}) => {`),$e=1}for(let{expression:ye,statement:He}of K){let tt=" ".repeat($e),ct=ye.offset===void 0?[]:ae.filter((et)=>ye.offset>=et.start&&ye.offset<et.end),nt=ye.offset===void 0?[]:de.filter((et)=>ye.offset>=et.start&&ye.offset<et.end),ht=nt.map((et)=>`;__stxEach(${et.iterable}, (${et.binding}) => { `).join(""),ut=" });".repeat(nt.length),st=ht+ct.map((et)=>`;((${et.binding.replace(/[\r\n]/g," ")}: any) => { `).join(""),Ot=" });".repeat(ct.length)+ut,je=ye.offset===void 0?[]:ep(ne,ye.offset),Te=je.length>0?`${je.map((et)=>`if (${da(et,pe)}) `).join("")}{ `:"",pt=je.length>0?" }":"";Z(tt+st+Te+He.text+pt+Ot,{line:ye.line,column:ye.column,expression:ye,prefixLength:He.prefixLength+tt.length+st.length+Te.length,guardPrefixLength:tt.length+st.length+Te.length})}if($e>0)Z("});");if(a)Z("}")}}let V=!1;if(n.reference&&x[0]!==void 0&&x[0].trim()==="")x[0]=`/// <reference path=${JSON.stringify(n.reference.replace(/\\/g,"/"))} />`,V=!0;return Z("export {}"),{text:x.join(`
1043
+ `),lineMap:v,sourceLineCount:f.length,componentDependencies:new Map([...z?.dependencies??[],...l?.dependencies??[]]),referenced:V,scriptColumns:I,importColumns:D,componentColumns:u}}function ga(e){let n=[0];for(let r=0;r<e.length;r++)if(e.charCodeAt(r)===10)n.push(r+1);return n}function yr(e,n){let r=0,i=e.length-1;while(r<i){let a=Math.ceil((r+i)/2);if(e[a]<=n)r=a;else i=a-1}return{line:r+1,column:n-e[r]+1}}function al(e,n){if(!e.expression)return!1;return e.inGuard===!0||n===2774}function Oi(e,n,r){let i=e.lineMap.get(n);if(!i)return n<=e.sourceLineCount?{line:n,column:sp(e,n,r)}:null;let a=i.anchor||i.expression?.anchor||i.diagnosticOrigin==="component"?0:Math.max(0,r-1-(i.prefixLength??0));return{line:i.line,column:i.column+a,expression:i.expression,diagnosticOrigin:i.diagnosticOrigin,inGuard:r<=(i.guardPrefixLength??0)}}var _r=S(256),rp=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/(?:\bwindow\.)?localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables \u2014 or, where this must run before first paint and the runtime does not exist yet, the colorMode config for a light/dark theme, or @appearanceBootstrap when there is a second appearance axis"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}],ma=/(?:\/\/|\/\*|\{\{--)\s*stx-strict-ignore(-next-line)?([^\n*}]*)/g;function ip(e){let n=Array.from(e,(a)=>a===`
1044
+ `?`
1045
+ `:" "),r=0,i="";while(r<e.length){let a=e[r],l=e[r+1];if(i){if(a==="\\"){r+=2;continue}if(a===i)i="";r++;continue}if(a==='"'||a==="'"||a==="`"){i=a,r++;continue}if(a==="/"&&l==="/"){while(r<e.length&&e[r]!==`
1046
+ `)n[r]=e[r],r++;continue}if(a==="/"&&l==="*"){let u=e.indexOf("*/",r+2),f=u===-1?e.length:u+2;for(;r<f;r++)n[r]=e[r];continue}if(a==="{"&&l==="{"&&e.slice(r,r+4)==="{{--"){let u=e.indexOf("--}}",r+4),f=u===-1?e.length:u+4;for(;r<f;r++)n[r]=e[r];continue}r++}return n.join("")}function op(e){let n=new Map,r=ip(e).split(`
1047
+ `),i=e.split(`
1048
+ `);return r.forEach((a,l)=>{ma.lastIndex=0;for(let u of a.matchAll(ma)){let f=u[1]==="-next-line",x=(i[l]??"").slice(0,u.index).trim(),v=f||x===""?l+2:l+1,D=(u[2]??"").split("--")[0].split(/[\s,]+/).filter(Boolean),W=D.filter((z)=>/\w/.test(z));if(D.length>0&&W.length===0)continue;let L=n.get(v);if(L&&L.size===0)continue;if(W.length===0){n.set(v,new Set);continue}if(L)W.forEach((z)=>L.add(z));else n.set(v,new Set(W))}}),n}function ap(e,n,r){let i=e.get(n);if(!i)return!1;if(i.size===0)return!0;return[...i].some((a)=>r.includes(a))}function Ue(e,n,r,i){let a=typeof r==="boolean"?{enabled:r,failOnViolation:r}:r??{enabled:!1};if(!a.enabled)return;let l=_(e,n,i,JSON.stringify(a)),u=_r.get(l);if(u!==void 0){if(u&&a.failOnViolation)throw new ee(u,i??n);return}let f=a.allowPatterns??[],x=op(e),v=[],I=t(e.replace(/\{\{--[\s\S]*?--\}\}/g,(z)=>z.replace(/[^\n]/g," ")));for(let{pattern:z,message:N,suggestion:H}of rp){if(f.some((U)=>/\w/.test(U)&&N.includes(U)))continue;z.lastIndex=0;let Z=I.match(z);if(Z&&Z.length>0){let U=I.split(`
1049
+ `),V=e.split(`
1050
+ `),K=[];if(U.forEach((pe,Ee)=>{if(z.lastIndex=0,z.test(pe)&&!ap(x,Ee+1,N))K.push(Ee+1)}),K.length===0&&U.some((pe)=>(z.lastIndex=0,z.test(pe))))continue;let ne=K.length>0?` (script line${K.length>1?"s":""} ${K.join(", ")})`:"",ae=K.slice(0,3).map((pe)=>` ${pe} | ${(V[pe-1]??"").trim().slice(0,100)}`).join(`
1051
+ `),de=ae?`
1052
+ ${ae}`:"";v.push(` \u2717 ${N}${ne}
1053
+ \u2192 ${H}${de}`)}}if(v.length===0){_r.set(l,"");return}let D=(z)=>{let N=`${process.cwd()}/`;return z.startsWith(N)?z.slice(N.length):z},L=`[STX] DOM API violation in ${i&&i!==n?`${D(i)} (composed into ${D(n)})`:D(n)}:
1054
+ ${v.join(`
1055
+ `)}
1056
+ Tip: prefer useRef(), navigate(), and composables for component code`;if(_r.set(l,L),console.warn(L),a.failOnViolation)throw new ee(L,i??n)}var cp=[{open:"@if",close:"@endif",name:"if"},{open:"@unless",close:"@endunless",name:"unless"},{open:"@foreach",close:"@endforeach",name:"foreach"},{open:"@for",close:"@endfor",name:"for"},{open:"@while",close:"@endwhile",name:"while"},{open:"@forelse",close:"@endforelse",name:"forelse"},{open:"@switch",close:"@endswitch",name:"switch"},{open:"@isset",close:"@endisset",name:"isset"},{open:"@empty",close:"@endempty",name:"empty"},{open:"@auth",close:"@endauth",name:"auth"},{open:"@guest",close:"@endguest",name:"guest"},{open:"@can",close:"@endcan",name:"can"},{open:"@cannot",close:"@endcannot",name:"cannot"},{open:"@section",close:"@endsection",name:"section",altClose:"@show"},{open:"@push",close:"@endpush",name:"push"},{open:"@prepend",close:"@endprepend",name:"prepend"},{open:"@once",close:"@endonce",name:"once"},{open:"@markdown",close:"@endmarkdown",name:"markdown"},{open:"@component",close:"@endcomponent",name:"component"}],lp=[{pattern:/@if\s*[^(]/,message:"@if directive missing parentheses",suggestion:"Use @if(condition)"},{pattern:/@foreach\s*[^(]/,message:"@foreach directive missing parentheses",suggestion:"Use @foreach(items as item)"},{pattern:/@foreach\([^)]*\)\s*[^@\n<]/,message:"@foreach may have content on same line",suggestion:"Put content on new line after @foreach()"},{pattern:/@include\s*[^(]/,message:"@include directive missing parentheses",suggestion:"Use @include('partial-name')"},{pattern:/@extends\s*[^(]/,message:"@extends directive missing parentheses",suggestion:"Use @extends('layout-name') or @layout('layout-name')"},{pattern:/@layout\s*[^(]/,message:"@layout directive missing parentheses",suggestion:"Use @layout('layout-name')"}],up=[{pattern:/\{\{\s*constructor\s*\}\}/,message:"Attempting to access constructor property"},{pattern:/\{\{\s*__proto__\s*\}\}/,message:"Attempting to access __proto__ property"},{pattern:/\{\{\s*eval\s*\(/,message:"Attempting to use eval in expression"}];function Dg(e){let n=[],r=[];return pp(e,n),fp(e,n,r),dp(e,r),gp(e,n),{valid:n.length===0,errors:n,warnings:r}}function pp(e,n){let r=(e.match(/\{\{/g)||[]).length,i=(e.match(/\}\}/g)||[]).length;if(r!==i)n.push({type:"expression",message:`Unclosed expression brackets: found ${r} opening '{{' and ${i} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function fp(e,n,r){for(let i of cp){let a=new RegExp(`${i.open}(?:\\s|\\()`,"g"),l=new RegExp(i.close,"g"),u=(e.match(a)||[]).length,f=(e.match(l)||[]).length;if(i.altClose){let x=new RegExp(i.altClose,"g");f+=(e.match(x)||[]).length}if(u>f)n.push({type:"directive",message:`Unclosed @${i.name} directive: found ${u} opening and ${f} closing`,suggestion:`Add ${u-f} missing ${i.close} tag(s)`});else if(f>u)r.push({type:"directive",message:`Extra ${i.close} found: ${f-u} more closing than opening`,suggestion:`Check for orphaned ${i.close} tags`})}}function dp(e,n){for(let r of lp)if(r.pattern.test(e))n.push({type:"syntax",message:r.message,suggestion:r.suggestion})}function gp(e,n){for(let r of up)if(r.pattern.test(e))n.push({type:"expression",message:`Security warning: ${r.message}`,suggestion:"Remove dangerous code from template expressions"})}function Lg(e,n){let r=e.slice(0,n).split(`
1057
+ `);return{line:r.length,column:r[r.length-1].length+1}}function jg(e,n,r){let i=[];switch(e){case"if":case"elseif":case"unless":if(r.length===0)i.push({type:"syntax",message:`@${e} requires a condition`,suggestion:`Use @${e}(condition)`});break;case"foreach":if(r.length===0||!r[0].includes(" as "))i.push({type:"syntax",message:'@foreach requires "items as item" syntax',suggestion:"Use @foreach(items as item) or @foreach(items as key => value)"});break;case"for":if(r.length===0)i.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(r.length===0)i.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(r.length===0)i.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(r.length===0)i.push({type:"syntax",message:`@${e} requires a path`,suggestion:`Use @${e}('path/to/template')`});break}return i}function Bg(e){return/@[a-z]+/i.test(e)||/\{\{/.test(e)}function Fg(e){let n=e.matchAll(/@([a-z]+)/gi),r=new Set;for(let i of n){let a=i[1].toLowerCase();if(!a.startsWith("end"))r.add(a)}return Array.from(r)}function ha(e,n,r){let i=/^<script\b([^>]*)>/i.exec(e);if(!i||!/(?:^|\s)src\s*=/i.test(i[1]??""))return null;return P(i[0],n,r)+e.slice(i[0].length)}var Dn=new T(500),vr=new Map;function xa(e){try{let n=Ss.statSync(e);return`${n.size}:${n.mtimeMs}`}catch{return""}}var _s=new T(1000),$r=new Map,Er=new T(2000),kr=new T(500),ka=33554432,Cr=ka;function mp(e){let n=e.componentRenderCacheBytes;if(typeof n!=="number"||n<0||n===Cr)return;Cr=n,ws.setMaxBytes(n)}var ws=new T(2000,{maxBytes:ka,sizeOf:(e)=>e.output.length});function hp(e){let n=new WeakSet;try{let r=(i)=>{if(i===void 0)return{__stxType:"undefined"};if(typeof i==="bigint")return{__stxType:"bigint",value:i.toString()};if(typeof i==="function"||typeof i==="symbol")throw TypeError("Non-serializable component input");if(i===null||typeof i!=="object")return i;if(n.has(i))throw TypeError("Circular component input");n.add(i);try{if(i instanceof Date)return{__stxType:"date",value:i.toISOString()};if(Array.isArray(i))return i.map(r);let a=Object.getPrototypeOf(i);if(a!==Object.prototype&&a!==null)throw TypeError("Non-plain component input");let l={};for(let u of Object.keys(i).sort())l[u]=r(i[u]);return l}finally{n.delete(i)}};return JSON.stringify(r(e))}catch{return null}}function xp(e){let n={};for(let[r,i]of Object.entries(e))if(!r.startsWith("__")||r==="__stxServeContext")n[r]=i;return n}function wr(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function oo(e){let n=process.cwd(),r=`${n}\x00${e}`,i=ba.get(r);if(i===void 0)i=Bun.hash(Ca(e,n).split(fe.sep).join("/")).toString(36).slice(0,6),ba.set(r,i);return i}var ba=new Map;function Ca(e,n){if(!fe.isAbsolute(e))return e;let r=(i)=>{try{return Ss.realpathSync(i)}catch{return i}};return fe.relative(r(n),r(e))}function zg(e){return/\bjs\b/.test(e)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(e)}function Ge(e){return!zg(e)}var ys=new Map;function oe(e){let n;try{n=JSON.stringify(e)}catch{return new Bun.Transpiler(e)}let r=ys.get(n);if(r)return r;if(ys.size>=16)ys.clear();let i=new Bun.Transpiler(e);return ys.set(n,i),i}var ya=new WeakMap,bp=256;function Xe(e){try{let n=oe({loader:"ts",target:"browser",define:A()}),r=ya.get(n);if(!r)r=new Map,ya.set(n,r);let i=r.get(e);if(i!==void 0)return i;let a=e.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");a=a.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let l=[];a=a.replace(/\{!![\s\S]*?!!\}/g,(f)=>{let x=l.length;return l.push(f),`"__STX_EXPR_${x}__"`}),a=a.replace(/\{\{\{[\s\S]*?\}\}\}/g,(f)=>{let x=l.length;return l.push(f),`"__STX_EXPR_${x}__"`}),a=a.replace(/\{\{[\s\S]*?\}\}/g,(f)=>{let x=l.length;return l.push(f),`"__STX_EXPR_${x}__"`});let u=n.transformSync(a);for(let f=0;f<l.length;f++)u=u.replace(`"__STX_EXPR_${f}__"`,l[f]),u=u.replace(`'__STX_EXPR_${f}__'`,l[f]);if(r.size>=bp){let f=r.keys().next();if(!f.done)r.delete(f.value)}return r.set(e,u),u}catch(n){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",n);return e}}function yp(e){let n=[],r=new Set,i=0,a=0,l=e.length,u=(L)=>{a++;while(a<l){if(e[a]==="\\"){a+=2;continue}if(e[a]===L){a++;return}a++}},f=()=>{a++;while(a<l){if(e[a]==="\\"){a+=2;continue}if(e[a]==="`"){a++;return}if(e[a]==="$"&&e[a+1]==="{"){a+=2;let L=1;while(a<l&&L>0)if(e[a]==="{")L++,a++;else if(e[a]==="}")L--,a++;else if(e[a]==="'"||e[a]==='"')u(e[a]);else if(e[a]==="`")f();else a++;continue}a++}},x=()=>{if(e[a]==="/"&&e[a+1]==="/"){while(a<l&&e[a]!==`
1058
+ `)a++;return!0}if(e[a]==="/"&&e[a+1]==="*"){a+=2;while(a<l-1&&!(e[a]==="*"&&e[a+1]==="/"))a++;return a+=2,!0}return!1},v=new Set(["return","typeof","instanceof","in","of","new","delete","void","throw","case","do","else","yield","await"]),I=()=>{let L=a-1;while(L>=0&&/\s/.test(e[L]))L--;if(L<0)return!0;let z=e[L];if("(,=:[!&|?{};+-*%<>~^".includes(z))return!0;if(!/[\w$]/.test(z))return!1;let N=L;while(N>0&&/[\w$]/.test(e[N-1]))N--;return v.has(e.slice(N,L+1))},D=()=>{a++;let L=!1;while(a<l&&e[a]!==`
1059
+ `){let z=e[a];if(z==="\\"){a+=2;continue}if(z==="[")L=!0;else if(z==="]")L=!1;else if(z==="/"&&!L){a++;while(a<l&&/[a-z]/i.test(e[a]))a++;return}a++}},W=()=>{if(i!==0)return;let L=e.slice(a).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(L){let Z=L[2].split(",").map((U)=>{let V=U.trim().split(":");return V[V.length-1].trim()});for(let U of Z)if(U&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(U)&&!r.has(U))n.push(U),r.add(U);return}let z=e.slice(a).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let Z=z[2];if(!r.has(Z))n.push(Z),r.add(Z);return}let N=e.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(N){let Z=N[1];if(!r.has(Z))n.push(Z),r.add(Z);return}let H=e.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let Z=H[1];if(!r.has(Z))n.push(Z),r.add(Z)}};while(a<l){if(x())continue;if(e[a]==="'"||e[a]==='"'){u(e[a]);continue}if(e[a]==="`"){f();continue}if(e[a]==="/"&&I()){D();continue}if(e[a]==="{"){i++,a++;continue}if(e[a]==="}"){i--,a++;continue}if(i===0&&/[a-z]/i.test(e[a])&&(a===0||/\s|[;{}()]/.test(e[a-1])))W();a++}return n}function _p(e){let n=[],r=0,i=0,a=null;for(let l=0;l<e.length;l++){let u=e[l];if(a){if(u==="\\"){l++;continue}if(u===a)a=null;continue}if(u==='"'||u==="'"||u==="`"){a=u;continue}if(u==="("||u==="["||u==="{")r++;else if(u===")"||u==="]"||u==="}")r--;else if(u===","&&r===0)n.push(e.slice(i,l)),i=l+1}if(i<e.length)n.push(e.slice(i));return n}function wp(e){let n=0,r=null;for(let i=0;i<e.length;i++){let a=e[i];if(r){if(a==="\\"){i++;continue}if(a===r)r=null;continue}if(a==='"'||a==="'"||a==="`"){r=a;continue}if(a==="("||a==="["||a==="{")n++;else if(a===")"||a==="]"||a==="}")n--;else if(a==="="&&n===0){let l=e[i-1],u=e[i+1];if(l==="!"||l==="<"||l===">"||l==="=")continue;if(u==="="||u===">")continue;return i}}return-1}function Sp(e,n){try{let r=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(e);if(!r)return;let i=r.index-1;while(i>=0&&/\s/.test(e[i]))i--;if(e[i]!=="}")return;let a=i,l=0,u=-1;for(;i>=0;i--){let x=e[i];if(x==="}")l++;else if(x==="{"){if(l--,l===0){u=i;break}}}if(u===-1)return;let f=e.slice(u+1,a);for(let x of _p(f)){let v=x.trim();if(!v||v.startsWith("..."))continue;let I=wp(v);if(I===-1)continue;let D=v.slice(0,I).trim();if(!/^[A-Z_$][\w$]*$/i.test(D))continue;if(n[D]!==void 0)continue;let W=v.slice(I+1).trim();if(!W)continue;try{let L=Object.keys(n).filter(Xt),z=Function(...L,`"use strict"; return (${W});`);n[D]=z(...L.map((N)=>n[N]))}catch{}}}catch{}}var vp=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function Hg(e,n){let r=Ht(e),i=e.slice(r).match(/^<([a-zA-Z][a-zA-Z0-9-]*)/);if(!i)return null;let a=i[1].toLowerCase();if(!vp.has(a))return null;let l=new RegExp(`<\\/?${a}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),u=w(e,(I,D)=>(l.lastIndex=D,l.exec(I)?.index===D?l.lastIndex:-1));if(a==="span"&&/\sdata-stx-scope\s*=/.test(u[0]?.token||""))return null;let f=0,x=!1;for(let I of u){if(f+=I.token.startsWith("</")?-1:1,f<0)return null;if(f===0){if(e.slice(I.end).trim())return null;x=!0;break}}if(!x)return null;let v=r+i[0].length;return e.slice(0,v)+n+e.slice(v)}function Ra(e,n){if(!e)return!1;return[...n.additionalComponentsDirs??[],...n.fallbackComponentsDir?[n.fallbackComponentsDir]:[]].some((i)=>{let a=fe.relative(fe.resolve(i),fe.resolve(e));return!a.startsWith("..")&&!fe.isAbsolute(a)})}async function jr(e,n,r,i,a){let l=e.endsWith(".stx")?e.slice(0,-4):e,u=(ae)=>ae.split("-").map((de)=>de.charAt(0).toUpperCase()+de.slice(1)).join(""),f=r.__importedComponents;if(f){for(let ae of[l,l.toLowerCase(),u(l),X(l)])if(f.has(ae))return!0}let x=[...new Set([`${l}.stx`,`${u(l)}.stx`,`${X(l)}.stx`])],v=typeof a.root==="string"?fe.resolve(a.root):void 0,I=v??fe.dirname(i),D=[],W=(ae)=>{if(ae&&!D.includes(ae))D.push(ae)};for(let ae of Qn(i,v))W(ae);let L=r.__originalFilePath;if(L)W(fe.join(fe.dirname(L),"components"));if(Ra(n,a))W(a._rootComponentsDir);W(n),W(a._rootComponentsDir),W(fe.join(fe.dirname(i),"components")),W(a.componentsDir);for(let ae of a.additionalComponentsDirs??[])W(ae);let z=a._targetComponentFallbackNames?.some((ae)=>ae.toLowerCase()===l.toLowerCase());if(!z)for(let ae of a._targetComponentDirs??[])W(ae);if(v)W(fe.resolve(v,"resources/views/components")),W(fe.resolve(v,"resources/components")),W(fe.resolve(v,"src/components")),W(fe.resolve(v,"components"));for(let ae of a._layerComponentDirs??[])W(ae);let N=a._pluginComponentDirs;if(Array.isArray(N))for(let ae of N)W(typeof ae==="string"?ae:null);if(W(a.fallbackComponentsDir),z)for(let ae of a._targetComponentDirs??[])W(ae);let H=a._nativePrimitivesFallback;if(H&&!H.except.some((ae)=>ae.toLowerCase()===l.toLowerCase()))W(H.dir);if(l.startsWith("./")||l.startsWith("../"))return s(fe.resolve(fe.dirname(i),`${l}.stx`));let Z=_a(fe.resolve(import.meta.dir,"components")),U=D.map((ae)=>fe.isAbsolute(ae)?ae:fe.resolve(I,ae)),V=`${x.join("\x00")}\x00\x00${U.join("\x00")}`,K=Er.get(V);if(K!==void 0)return K;let ne=!1;e:for(let ae of U){if(_a(ae)===Z)continue;for(let de of x)if(await s(fe.join(ae,de))){ne=!0;break e}}return Er.set(V,ne),ne}function _a(e){let n=kr.get(e);if(n!==void 0)return n;let r=e;try{r=Ss.realpathSync(e)}catch{}return kr.set(e,r),r}function Vg(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function vl(e){if(!e)return!1;let n=e.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(n)}function $p(e,n,r){if(!e.includes("{{")&&!e.includes("{!!"))return e;let i=(a,l)=>{let u;try{u=O(a,n)}catch{return l}if(u===void 0||u===null)return"";let f=String(u);if(/<\/style/i.test(f))return console.warn(`[stx] a <style> expression in ${r??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return f};return e.replace(/\{!!([\s\S]*?)!!\}/g,(a,l)=>i(l,a)).replace(/\{\{([\s\S]*?)\}\}/g,(a,l)=>i(l,a))}var wa=new Set;function Sa(e,n,r,i){let a=`${e}\x00${n}\x00${i??""}`;if(!process.env.STX_DEBUG&&wa.has(a))return;wa.add(a);let l=n?` used in ${n}`:"",u=i?` Cause: ${i}.`:"",f=r.length>0?`
1060
+ searched:
1061
+ ${r.map((x)=>` - ${x}`).join(`
1062
+ `)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${u}${f}`)}function va(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var Ep=new Set(["for","if","show","key","ref","class","className","style"]),$a=new Set,Aa="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",xl=new RegExp(`\\b(?:${Aa})\\s*(?:<[^>]*>)?\\s*\\(`);function Bi(e){let n=new Set,r=new RegExp(`\\b(?:const|let|var)\\s+([a-zA-Z_$][\\w$]*)\\s*=\\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue|${Aa})\\s*(?:<[^>]*>)?\\s*\\(`,"g");for(let i of e){let a;while((a=r.exec(i))!==null)n.add(a[1]);r.lastIndex=0}return[...n]}async function Je(e,n,r,i,a,l,u,f=new Set,x,v=gt(a),I,D=e){let{extractVariables:W}=await o("stx/variable-extractor",()=>import("./chunk-vm42j29z.js")),L=f??new Set;if(L.has(e))return`[Circular component reference: ${e}]`;let z=new Set(L);z.add(e);let N=typeof n.client==="string"?n.client.trim():"";if("client"in n)delete n.client;let H=N&&N!=="load"&&Vg(N)?N:"";try{let Z=(le)=>le.split("-").map((be)=>be.charAt(0).toUpperCase()+be.slice(1)).join(""),U=D.endsWith(".stx")?D.slice(0,-4):D,V=null,K=a.__importedComponents;if(K){let le=[U,U.toLowerCase(),Z(U),X(U)];for(let be of le)if(K.has(be)){V=K.get(be);break}}let ne=[];if(!V){let le=[`${U}.stx`,`${Z(U)}.stx`,`${X(U)}.stx`],be=[...new Set(le)],Ne=a.__originalFilePath,we=[];for(let ve of Qn(l))if(!we.includes(ve))we.push(ve);let ot=we.length;for(let ve of u._layerComponentDirs??[])if(!we.includes(ve))we.push(ve);if(Ne){let ve=fe.join(fe.dirname(Ne),"components");we.push(ve)}let Fe=u._rootComponentsDir;if(typeof Fe==="string"&&Ra(i,u)&&!we.includes(Fe))we.push(Fe);if(i&&!we.includes(i))we.push(i);if(typeof Fe==="string"&&!we.includes(Fe))we.push(Fe);let Ct=fe.join(fe.dirname(l),"components");if(!we.includes(Ct))we.push(Ct);if(u.componentsDir&&u.componentsDir!==i&&!we.includes(u.componentsDir))we.push(u.componentsDir);for(let ve of u.additionalComponentsDirs??[])if(ve&&!we.includes(ve))we.push(ve);let Zt=u._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(U),It=(I?.events??[]).map((ve)=>ve.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),Vn=Object.hasOwn(n,"checked")||Boolean(I?.reactiveProps?.includes("checked")),Rs=Object.hasOwn(n,"value")||Boolean(I?.reactiveProps?.includes("value")),As=!It.includes("valuechange")&&(Vn||It.includes("change")&&!Rs),jt=u._nativeHostAttrs&&/^textinput$/i.test(U),Jt=It.includes("update:value")&&!It.includes("input"),mn=u._nativeHostAttrs&&/^video$/i.test(U),Ts=u._nativeHostAttrs&&/^image$/i.test(U),Un=Xs([...Object.keys(n),...I?.reactiveProps??[]],I?.events,n),Gt=Object.hasOwn(n,"src")||Boolean(I?.reactiveProps?.includes("src")),Hn=Object.hasOwn(n,"source")||Boolean(I?.reactiveProps?.includes("source")),Kn=mn&&(Gt||Hn)&&(I?.events??[]).every((ve)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(ve.replace(/^@/,"").split(".")[0])),qn=new Set(["","primary","secondary","outline","ghost","danger"]),Zn=typeof n.variant==="string"?n.variant.trim().toLowerCase():"",Jn=u._nativeHostAttrs&&/^button$/i.test(U)&&!qn.has(Zn),Fr=u._targetComponentFallbackNames?.some((ve)=>ve.toLowerCase()===U.toLowerCase())??!1,Is=Fr&&(!Zt||As)&&(!jt||Jt)&&(!mn||Kn)&&(!Ts||Un)&&!Jn;for(let ve of Is?[]:u._targetComponentDirs??[])if(ve&&!we.includes(ve))we.push(ve);let Yt=typeof u.root==="string"?fe.resolve(u.root):void 0,Vr=Yt??fe.dirname(l),Qt=[];if(Yt)Qt.push(fe.resolve(Yt,"resources/views/components")),Qt.push(fe.resolve(Yt,"resources/components")),Qt.push(fe.resolve(Yt,"src/components")),Qt.push(fe.resolve(Yt,"components"));Qt.push(fe.resolve(import.meta.dir,"components"));for(let ve of Qt)if(!we.includes(ve))we.push(ve);if(Fr){let ve=(u._componentPackageDirs??[]).filter((ft)=>typeof ft==="string"&&ft.length>0),Rt=(Is?ve.length?ve:u._pluginComponentDirs??[]:u._targetComponentDirs??[]).filter((ft)=>typeof ft==="string"&&ft.length>0);if(Rt.length){let ft=we.slice(ot).map((lt)=>fe.isAbsolute(lt)?lt:fe.resolve(Vr,lt)).filter((lt)=>!Rt.includes(lt)),Gn=`${U}\x00${ft.join("\x00")}`,_t=$r.get(Gn);if(_t===void 0){_t=!1;for(let lt of ft){for(let Mt of be)if(await s(fe.join(lt,Mt))){_t=!0;break}if(_t)break}$r.set(Gn,_t)}if(!_t){for(let lt of Rt){let Mt=we.indexOf(lt);if(Mt>=0)we.splice(Mt,1)}we.splice(ot,0,...Rt)}}}let Ur=u._pluginComponentDirs;if(Array.isArray(Ur)){for(let ve of Ur)if(typeof ve==="string"&&!we.includes(ve))we.push(ve)}if(u.fallbackComponentsDir&&!we.includes(u.fallbackComponentsDir))we.push(u.fallbackComponentsDir);if(Is){for(let ve of u._targetComponentDirs??[])if(ve&&!we.includes(ve))we.push(ve)}let Xn=u._nativePrimitivesFallback;if(Xn&&!Xn.except.some((ve)=>ve.toLowerCase()===U.toLowerCase())&&!we.includes(Xn.dir))we.push(Xn.dir);let Hr=[...new Set(we.map((ve)=>{if(!ve)return ve;return fe.isAbsolute(ve)?ve:fe.resolve(Vr,ve)}))];we.length=0,we.push(...Hr);let Ps=`${U}\x00${l}\x00${Hr.join("\x00")}`,Os=_s.get(Ps);if(Os)if(await s(Os))V=Os;else _s.delete(Ps);if(!V&&(U.startsWith("./")||U.startsWith("../")))V=fe.resolve(fe.dirname(l),`${U}.stx`),ne.push(V);else if(!V)for(let ve of we){if(!ve)continue;for(let Rt of be){let ft=fe.join(ve,Rt);if(ne.push(ft),await s(ft)){V=ft;break}}if(V)break;if(!V)try{let Rt=await import("fs");if(!Rt.statSync(ve,{throwIfNoEntry:!1})?.isDirectory())continue;let Gn=8,_t=[{path:ve,depth:0}];while(_t.length>0&&!V){let lt=_t.pop();if(lt.depth>=Gn)continue;let Mt;try{Mt=Rt.readdirSync(lt.path,{withFileTypes:!0})}catch{continue}for(let Yn of Mt){if(!Yn.isDirectory())continue;if(Yn.name==="node_modules"||Yn.name.startsWith("."))continue;let Zr=fe.join(lt.path,Yn.name);for(let Va of be){let js=fe.join(Zr,Va);if(ne.push(js),await s(js)){V=js;break}}if(V)break;_t.push({path:Zr,depth:lt.depth+1})}}}catch{}if(V)break}if(V)_s.set(Ps,V)}if(!V||!await s(V))return Sa(e,l,ne),va(e);x.add(V);let ae;if(Dn.has(V)&&vr.get(V)===xa(V))ae=Dn.get(V);else try{let le=xa(V);ae=await Bun.file(V).text(),Dn.set(V,ae),vr.set(V,le)}catch(le){let be=le instanceof Error?le.message:String(le);return Sa(e,l,[V],be),va(e)}if(I)for(let le of new Set([...Object.keys(n),...I.reactiveProps??[]])){let be=le.toLowerCase();if(be.startsWith("aria-")||be.startsWith("data-"))continue;let Ne=le.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${Ne}\\b`).test(ae))I.declaredProps.add(le);if(new RegExp(`\\$props\\s*(?:\\.\\s*${Ne}\\b|\\[\\s*['"]${Ne}['"]\\s*\\])`).test(ae)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${Ne}['"]`).test(ae))I.consumedProps?.add(le)}if(I?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(ae))for(let le of I.reactiveProps){if(Ep.has(le)||I.consumedProps?.has(le))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${le.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(ae))continue;let be=`${V}\x00${le}`;if($a.has(be))continue;$a.add(be),console.warn(`[stx] ${fe.basename(V)} reads \`${le}\` with defineProps(), which is not live, but ${fe.basename(l)} binds it (:${le}): the value can arrive empty or stale (on a native screen, and for a :for's rows, it does not arrive at all). Read it with useReactiveProp('${le}').`)}let de=new Set(["__originalFilePath","__importedComponents",rs,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),pe={};for(let[le,be]of Object.entries(a))if(!le.startsWith("__")||de.has(le))pe[le]=be;let Ee=v.length>0?{[us]:[...v]}:{},Ce=r;if(r.includes("@include")){let{processIncludes:le}=await o("stx/includes",()=>import("./chunk-2haf7t5h.js"));Ce=await le(r,a,l,u,x)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ce)){let{processComponents:le}=await o("stx/component-renderer",()=>import("./chunk-1r612xxs.js")),be={...a,__processedComponents:L,...Ee};Ce=await le(Ce,be,l,u,x);let Ne=be.__stx_preserved_client_expressions;if(Array.isArray(Ne)&&Ne.length>0)a.__stx_preserved_client_expressions=[...new Set([...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Ne])]}let $e=[];if(vl(Ce)){let{processExpressions:le}=await o("stx/expressions",()=>import("./chunk-qxcc0aar.js")),be=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...Ee}:v.length>0?{...a,...Ee}:a;Ce=le(Ce,be,l);for(let Ne of Ce.matchAll(/\{\{([\s\S]*?)\}\}/g))$e.push(Ne[1].trim())}let ye=re(Ce),He=[],tt=ye.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(le,be)=>{let Ne=ye.scripts[Number(be)]||"",we=Ne.match(/^<script\b([^>]*)>/i)?.[1]||"",ot=we.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Fe=!ot||["module","text/javascript","application/javascript"].includes(ot),Ct=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${we}`);if(!/\bserver\b/i.test(we)&&Fe&&!Ct)return He.push(Ne),"";return Ne}),{extractSlotContent:ct}=await o("stx/slots",()=>import("./chunk-a5gnxdfe.js")),nt=ct(tt),ht={};if(nt.defaultSlot?.trim())ht.default=nt.defaultSlot;for(let[le,be]of nt.namedSlots)ht[le]=be.content;let ut=a.__stx_scope_seq??={n:0,key:oo(String(a.__filename??l))},st=Ca(e,process.cwd()),je=`stx_${(st.endsWith(".stx")?st.slice(0,-4):st).replace(/[^a-zA-Z0-9]/g,"_")}_${++ut.n}_${ut.key}`,Te={...pe,$uid:je,$native:u._nativeHostAttrs===!0,...n,props:n,slot:tt,$slots:ht,__processedComponents:z,__sections:{},__stx_signals_gate:Oe(ae)||vl(r),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...$e]};if(/import\s/.test(ae)){Te.__importedComponents=new Map(Te.__importedComponents);let{processESImports:le}=await o("stx/component-renderer",()=>import("./chunk-1r612xxs.js"));ae=await le(ae,Te,V,u,x)}Sp(ae,Te);let pt=ae,et=j(pt);if(et)pt=et.content.trim();let an=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,At=[...ae.matchAll(an)];for(let[,le,be]of At)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(le))Ue(be,V,u.strict);let xt=[],cn=null,$s=At.some((le)=>/\bserver\b/.test(le[1]||"")&&/\bcache\b/.test(le[1]||"")),Ft=null,vt=null,ln=null,zn=0,un=null;if(mp(u),$s&&Cr>0){let le=hp({props:n,slot:Ce,slotContext:r.trim()?xp(pe):void 0,buildMode:u.buildMode??"",skipEventDirectives:u.skipEventDirectives===!0,native:u._nativeHostAttrs===!0,clientLoopNames:[...v].sort(),layers:u._layerGraph?.layers.map((be)=>be.configFile),uid:je});if(le!==null){Ft=`${V}\x00${_(ae)}\x00${le}`;let be=ws.get(Ft);if(be){for(let Ne of be.dependencies)x.add(Ne);if(vi(a,be.clientFactories),ut.n+=be.uidsConsumed,be.preservedClientExpressions.length>0){let Ne=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let we of be.preservedClientExpressions)Ne.add(we);a.__stx_preserved_client_expressions=[...Ne]}return be.output}vt=new Set(x),ln=wi(a),zn=ut.n,un=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let pn=new Set;for(let le of At){let be=le[1]||"",Ne=le[2]||"",we=be.includes("server");if(Ge(be)&&Ne.trim())Ne=Xe(Ne);if(we&&Ne){for(let Fe of he(Ne))pn.add(Fe);try{await W(Ne,Te,V,{onFailure:(Fe)=>{if(Fe.kind!=="unknown")cn=Fe.kind}})}catch(Fe){}}if(!we){let Fe=Ne.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),Ct=Fe.includes("{{")&&Fe.includes("}}"),Zt=Fe.includes("{!!")&&Fe.includes("!!}");if(Ct||Zt)Fe=zi(Fe,Te,V);let It=be.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");xt.push(`<script${It}>${Fe}</script>`)}}let bt=re(ae).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),fn=bt?bt[1]:"",Es=bt?bt[2]:"",$t="",ce=fn&&/\bscoped\b/i.test(fn);if(bt)$t=`<style${fn}>${$p(Es,Te,V)}</style>`;let ue=pt;if(ue=ue.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),bt)ue=ue.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let le=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,be=[];if(ue=ue.replace(le,(Ne,we)=>{let ot=we.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(ot)be.push(`<style${ot[1]}>${ot[2]}</style>`);return""}),ue=ue.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),be.length>0)$t=`${$t}${be.join(`
1063
+ `)}`}if(r&&ue.includes("{{ text || slot }}"))ue=ue.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>r);let{applySlots:_e}=await o("stx/slots",()=>import("./chunk-a5gnxdfe.js")),{defaultSlot:Le,namedSlots:Ze}=nt,rt=a.__stx_signals_gate===!0&&/\s(?:@[\w:.-]+|x-on:[\w:.-]+)\s*=/.test(tt),yt=xt.length>0&&or(ue)||u._nativeHostAttrs===!0&&xt.length>0||rt&&xt.length>0||xt.some((le)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(le)),ks=(le)=>yt?Mo(le,je):le,Cs=new Map([...Ze].map(([le,be])=>[le,{...be,content:ks(be.content)}]));ue=await _e(ue,yt?jo(ks(Le),je):Le,Cs,Te,yt?je:"");let Bn=Bi(xt),dn=(Array.isArray(Te.__stx_client_signal_names)?Te.__stx_client_signal_names:[]).filter((le)=>!pn.has(le));if(Bn.length>0||dn.length>0)Te.__stx_client_signal_names=[...new Set([...dn,...Bn])];else delete Te.__stx_client_signal_names;let gn=v.filter((le)=>!pn.has(le)&&!(le in n));if(gn.length>0)Te[us]=gn;let Wn={...u,_rootComponentsDir:u._rootComponentsDir||u.componentsDir,componentsDir:fe.dirname(V),skipSignalsRuntime:!0,skipEventDirectives:u._nativeHostAttrs===!0||yt||xt.length===0,defaultLayout:void 0};Te.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:Fn}=await o("stx/process",()=>import("./chunk-rnrdngnn.js")),Et=await Fn(ue,Te,V,Wn,x),Tt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let le of Et.matchAll(/\{\{([\s\S]*?)\}\}/g))Tt.add(le[1].trim());if(Tt.size>0)a.__stx_preserved_client_expressions=[...Tt];let kt=je,it=Et;if(yt){let le="";if(Object.keys(n).length>0)try{le=` data-stx-props="${wr(JSON.stringify(n))}"`}catch{}let be=H?` stx-hydrate="${wr(H)}"`:"",Ne=Object.fromEntries(Object.entries(ht).map(([jt,Jt])=>[jt,Boolean(Jt)])),we=Object.keys(Ne).length>0?` data-stx-slots="${wr(JSON.stringify(Ne))}"`:"",ot=` data-stx-scope="${kt}"${le}${we}${be}`,Fe=Et.slice(Ht(Et)),Ct=/^<span(?=[\s/>])/i.test(Fe),Zt=/^<[^>]+\bdata-stx-layout-root(?:\s|=|>)/i.test(Fe),It=/^<[^>]+\bdata-stx-fill-root(?:\s|=|>)/i.test(Fe),Vn=Ct?"span":"div",Rs=Zt&&u._nativeHostAttrs?' style="display:flex;flex-direction:column;flex:1;min-height:0;min-width:0"':It&&u._nativeHostAttrs?' style="width:100%;height:100%"':Ct||Zt?' style="display:contents"':"";it=Hg(Et,ot)??`<${Vn}${ot} data-stx-component-wrapper${Rs}>${Et}</${Vn}>`;let As=await Promise.all(xt.map(async(jt)=>{let Jt=jt.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!Jt)return jt;let[,mn,Ts]=Jt,Un=ha(jt,Te,V);if(Un!==null)return Un;let Gt=await Cp(Ts,V,u.buildMode==="compile"),Hn=Rn(Gt.clientCode,qe(Te)),{vendorStyleTags:Kn}=Gt,qn=Hn?`function(__scopeId) {
1064
+ ${Hn}
1065
+ return (${Gt.factoryBody})(__scopeId);
1066
+ }`:Gt.factoryBody,Zn=H?null:Hs(a,qn),Jn=Zn?`window.__stxComponentFactories[${JSON.stringify(Zn)}](${JSON.stringify(kt)});`:`(${qn})(${JSON.stringify(kt)});`;if(H)return`${Kn}<script type="stx/island" data-stx-island="${kt}" data-stx-scoped data-stx-owner="${kt}"${mn}>${ge(Jn)}</script>`;return`${Kn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${kt}"${mn}>${ge(Jn)}</script>`}));if(it=it+`
1067
+ `+As.join(`
1068
+ `),$t)it+=`
1069
+ `+$t}else{if($t)it+=`
1070
+ `+$t;if(xt.length>0){let le=Te.__stx_event_bindings||[],be=qe(Te),Ne=await Promise.all(xt.map(async(we)=>{let ot=ha(we,Te,V);if(ot!==null)return ot;let Fe=we.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!Fe)return we;return await Ke(Fe[1],{eventBindings:le,templateContent:it,filePath:V,projectRoot:process.cwd(),serverData:be,instanceId:je})}));it+=`
1071
+ `+Ne.join(`
1072
+ `),Te.__stx_event_bindings=[]}}if(ce){let le=to(it,V);if(le.hasScoped)it=le.html}if(Ft&&vt){let le=Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[];ws.set(Ft,{output:it,dependencies:[...x].filter((be)=>!vt.has(be)),clientFactories:ln?Si(a,ln):[],uidsConsumed:ut.n-zn,preservedClientExpressions:un?le.filter((be)=>!un.has(be)):[]})}if(cn)it=`<!--stx-render-failed:${cn}-->${it}`;return He.length>0?`${it}
1073
+ ${He.join(`
1074
+ `)}`:it}catch(Z){if(Z instanceof ee)throw Z;return`[Error processing component: ${Z instanceof Error?Z.message:String(Z)}]`}finally{L.delete(e)}}async function s(e){return Bun.file(e).exists()}function Rr(e,n){let r=fe.resolve(n),i=fe.resolve(e),a=r.endsWith(fe.sep)?r:r+fe.sep;if(i===r||i.startsWith(a))return i;return null}async function Ea(e,n,r,i){let a=n.startsWith("layouts/")?n.slice(8):n,l=fe.join(e,a);for(let u of l.endsWith(".stx")?[l]:[l,`${l}.stx`])if(await s(u)){if(i)console.log(`Found layout in ${e}: ${u}`);return r?.add(u),u}return null}async function An(e,n,r,i){let a=await kp(e,n,r,i);if(a===null)return null;let l=Rr(a,process.cwd());if(l)return l;let u=[r.root,r.layoutsDir,r.fallbackLayoutsDir,r.componentsDir,r.partialsDir,r.pagesDir,...r._layerLayoutDirs??[]].filter((f)=>typeof f==="string"&&f.length>0);for(let f of u){let x=fe.isAbsolute(f)?f:fe.resolve(process.cwd(),f);if(Rr(a,x))return fe.resolve(a)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${a} (template: ${e}, from: ${n})`),null}async function kp(e,n,r,i){if(r.debug)console.log(`Resolving template path: ${e} from ${n}`);let a=fe.dirname(n),l=process.cwd();if(e.startsWith("/")){let L=fe.join(l,e),z=Rr(L,l);if(!z)return console.warn(`[stx] rejected template path that escapes project root: ${e} (from ${n})`),null;if(r.debug)console.log(`Checking absolute path: ${z}`);if(await s(z)&&i)i.add(z);return z}let u=async(L)=>{if(!r.layoutsDir||!r.fallbackLayoutsDir)return L;let z=fe.relative(fe.resolve(l,r.fallbackLayoutsDir),L);if(z.startsWith("..")||fe.isAbsolute(z))return L;return await Ea(fe.resolve(l,r.layoutsDir),e,i,r.debug)??L},f=fe.join(a,e);if(await s(f)){if(r.debug)console.log(`Found direct path: ${f}`);let L=await u(f);if(i)i.add(L);return L}if(!e.endsWith(".stx")&&!e.endsWith(".jsx")&&!e.endsWith(".tsx"))for(let L of[".stx",".tsx",".jsx"]){let z=`${f}${L}`;if(await s(z)){if(r.debug)console.log(`Found direct path with extension: ${z}`);let N=await u(z);if(i)i.add(N);return N}}let x=[];if(x.push(...r._layerLayoutDirs??[]),r.layoutsDir)x.push(fe.isAbsolute(r.layoutsDir)?r.layoutsDir:fe.resolve(process.cwd(),r.layoutsDir));let v=fe.resolve(a),I=process.cwd();for(let L=0;L<10;L++){let z=fe.join(v,"layouts"),N=!1;try{N=Ss.statSync(z,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(N){x.push(z);break}let H=fe.dirname(v);if(H===v||H.length<I.length)break;v=H}for(let L of x){let z=await Ea(L,e,i,r.debug);if(z)return z}if(r.fallbackLayoutsDir){let L=fe.isAbsolute(r.fallbackLayoutsDir)?r.fallbackLayoutsDir:fe.resolve(process.cwd(),r.fallbackLayoutsDir),z=e.startsWith("layouts/")?e.slice(8):e,N=[fe.join(L,z)];if(!e.endsWith(".stx"))N.push(`${N[0]}.stx`);for(let H of N)if(await s(H)){if(r.debug)console.log(`Found in options.fallbackLayoutsDir: ${H}`);if(i)i.add(H);return H}}if(e.startsWith("layouts/")||e.includes("/layouts/")){let L=e.split("layouts/"),z=fe.join(r.partialsDir||a,"layouts",L[1]);if(await s(z)){if(r.debug)console.log(`Found in layouts path: ${z}`);if(i)i.add(z);return z}if(!z.endsWith(".stx")){let N=`${z}.stx`;if(await s(N)){if(r.debug)console.log(`Found in layouts path with extension: ${N}`);if(i)i.add(N);return N}}}if(r.partialsDir){let L=fe.join(r.partialsDir,"layouts");if(await s(L)){let z=fe.join(L,e);if(await s(z)){if(r.debug)console.log(`Found in partials layouts dir: ${z}`);if(i)i.add(z);return z}if(!e.endsWith(".stx")){let N=`${z}.stx`;if(await s(N)){if(r.debug)console.log(`Found in partials layouts dir with extension: ${N}`);if(i)i.add(N);return N}}}}let D=r.partialsDir||fe.join(process.cwd(),"views"),W=fe.join(D,e);if(await s(W)){if(r.debug)console.log(`Found in views path: ${W}`);if(i)i.add(W);return W}if(!e.endsWith(".stx")){let L=`${W}.stx`;if(await s(L)){if(r.debug)console.log(`Found in views path with extension: ${L}`);if(i)i.add(L);return L}}if(a.includes("temp")){let L=fe.join(fe.dirname(a),"layouts",e);if(await s(L)){if(r.debug)console.log(`Found in temp layouts dir: ${L}`);if(i)i.add(L);return L}if(!e.endsWith(".stx")){let z=`${L}.stx`;if(await s(z)){if(r.debug)console.log(`Found in temp layouts dir with extension: ${z}`);if(i)i.add(z);return z}}}if(r.debug)console.warn(`Template not found after trying all paths: ${e} (referenced from ${n})`);else console.warn(`Template not found: ${e} (referenced from ${n})`);return null}function Sl(e,n,r){let i=0,a="",l="";try{if(typeof n==="number"&&n>=0){let u=e.split(`
1075
+ `),f=0;for(let x=0;x<u.length;x++)if(f+=u[x].length+1,f>=n){i=x+1,a=u[x].trim();let v=Math.max(0,x-2),I=Math.min(u.length,x+3);l=u.slice(v,I).map((D,W)=>{let L=v+W+1;return`${L===i?"> ":" "}${L}: ${D}`}).join(`
1076
+ `);break}}else if(r){let u=e.indexOf(r);if(u>=0)return Sl(e,u)}}catch{}return{lineNumber:i,lineContent:a,context:l}}var Be={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgYellow:"\x1B[43m"};function y(e,n,r,i,a,l){let{lineNumber:u,context:f}=Sl(i,a,l),x=r.split("/").pop(),v=0;if(typeof a==="number"&&a>=0&&i){let D=i.lastIndexOf(`
1077
+ `,Math.max(0,a-1));v=a-(D+1)+1}let I="";if(u>0)I+=`
1078
+ ${r}:${u}${v>0?`:${v}`:""}: ${e.toLowerCase()} error: ${n}
1079
+ `;if(I+=`
1080
+ ${Be.bold}${Be.red}\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E${Be.reset}
1081
+ `,I+=`${Be.bold}${Be.red}\u2502${Be.reset} ${Be.bold}${Be.bgRed} ERROR ${Be.reset} ${Be.red}${e} Error${Be.reset}${" ".repeat(Math.max(0,43-e.length))}${Be.bold}${Be.red}\u2502${Be.reset}
1082
+ `,I+=`${Be.bold}${Be.red}\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F${Be.reset}
1083
+ `,I+=`
1084
+ ${Be.cyan}${Be.bold}File:${Be.reset} ${Be.dim}${x}${Be.reset}`,u>0)I+=` ${Be.gray}(line ${u}${v>0?`, col ${v}`:""})${Be.reset}`;if(I+=`
1085
+ ${Be.yellow}${Be.bold}Message:${Be.reset} ${n}
1086
+ `,f)I+=`
1087
+ ${Be.blue}${Be.bold}Context:${Be.reset}
1088
+ ${Be.dim}${f}${Be.reset}
1089
+ `;return I}function ke(){Dn.clear(),vr.clear(),_s.clear(),$r.clear(),Er.clear(),kr.clear(),ws.clear()}function Ey(){return{size:Dn.size,maxSize:500}}var Sr=S(128);async function Cp(e,n,r){let i=_(e,n,r),a=Sr.get(i);if(a){if(Js(a.deps))return a;Sr.delete(i)}let l=Li(e,{filePath:n,projectRoot:process.cwd()}),u=l.code,f=ji(l.styles);u=Kt(u).code;let{hasUserImports:x,bundleClientScript:v}=await o("stx/client-script-bundler",()=>import("./chunk-3zds0gmd.js")),I=[],D=!1;if(x(u)){let U=u;u=await v(U,n,{projectRoot:process.cwd(),minify:r,collectInputs:I}),D=u===U}let{stripStxRuntimeImports:W}=await o("stx/signal-processing",()=>import("./chunk-5p3825qw.js"));u=W(u);let L=M(u),z=yp(L),N=new Set(G(L,!0).split(",").map((U)=>U.trim())),H=`function(__scopeId) {
1090
+ ${wt("const",[...Ll,...z],L)}
1091
+ const __scope = window.stx._scopes = window.stx._scopes || {};
1092
+ const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
1093
+ __scopeVars.$refs = __scopeVars.$refs || {};
1094
+ const __previousCurrentElement = window.__STX_CURRENT_ELEMENT__;
1095
+ const __previousCurrentProps = window.__STX_CURRENT_PROPS__;
1096
+ // A clone the runtime is setting up may not be in the document yet (rows
1097
+ // a loop builds inside a closed :if), where a lookup cannot see it, so the
1098
+ // runtime hands its root over in __STX_SETUP_ROOT__ (signals.ts).
1099
+ const __setupRoot = window.__STX_SETUP_ROOT__;
1100
+ const __componentElement = (__setupRoot && __setupRoot.getAttribute('data-stx-scope') === __scopeId && __setupRoot) || document.querySelector('[data-stx-scope="' + __scopeId + '"]');
1101
+ __scopeVars.$slots = Object.create(null);
1102
+ if (__componentElement) {
1103
+ try { Object.assign(__scopeVars.$slots, JSON.parse(__componentElement.getAttribute('data-stx-slots') || '{}')); }
1104
+ catch {}
1105
+ }
1106
+ window.__STX_CURRENT_ELEMENT__ = __componentElement;
1107
+ let __componentProps = __componentElement && __componentElement.__stx_props;
1108
+ if (!__componentProps && __componentElement) {
1109
+ try { __componentProps = JSON.parse(__componentElement.getAttribute('data-stx-props') || '{}'); }
1110
+ catch { __componentProps = {}; }
1111
+ }
1112
+ window.__STX_CURRENT_PROPS__ = __componentProps && typeof __componentProps === 'object' && !Array.isArray(__componentProps) ? __componentProps : {};
1113
+ const __scopeProps = window.__STX_CURRENT_PROPS__;
1114
+ Object.defineProperty(__scopeVars, '$props', { configurable: true, enumerable: true, get: function() {
1115
+ return (__componentElement && __componentElement.__stx_props) || __scopeProps;
1116
+ } });
1117
+
1118
+ // Scope-specific lifecycle callbacks. The queues drain as they run; the
1119
+ // hook lists keep what setup registered, because a component behind an :if
1120
+ // unmounts at each hide and mounts again at each show (signals.ts,
1121
+ // suspendSubtreeScopes).
1122
+ if (__scopeVars.__suspended && !__scopeVars.__mounted) {
1123
+ // Set up again after an :if hid it -- a <template :if> clones the
1124
+ // component afresh on every show, and the clone's script runs. This run's
1125
+ // hooks close over this run's state, so they replace the ones the hide
1126
+ // kept for a re-show rather than queueing beside them.
1127
+ __scopeVars.__mountCallbacks = [];
1128
+ __scopeVars.__destroyCallbacks = [];
1129
+ __scopeVars.__mountHooks = [];
1130
+ __scopeVars.__destroyHooks = [];
1131
+ // So do its effects: the last run's watched a clone that is gone.
1132
+ if (typeof __scopeVars.__disposeEffects === 'function') __scopeVars.__disposeEffects();
1133
+ __scopeVars.__disposeEffects = null;
1134
+ }
1135
+ __scopeVars.__mountCallbacks = __scopeVars.__mountCallbacks || [];
1136
+ __scopeVars.__destroyCallbacks = __scopeVars.__destroyCallbacks || [];
1137
+ __scopeVars.__mountHooks = __scopeVars.__mountHooks || [];
1138
+ __scopeVars.__destroyHooks = __scopeVars.__destroyHooks || [];
1139
+ let __registeringSetupHooks = true;
1140
+ const onMount = (fn) => { __scopeVars.__mountCallbacks.push(fn); __scopeVars.__mountHooks.push(fn); };
1141
+ const onDestroy = (fn) => {
1142
+ __scopeVars.__destroyCallbacks.push(fn);
1143
+ // A teardown registered inside onMount belongs to this mount alone.
1144
+ // Replaying it AND registering the next mount's teardown doubles cleanup.
1145
+ if (__registeringSetupHooks) __scopeVars.__destroyHooks.push(fn);
1146
+ };
1147
+ // The effects this setup makes (effect, watch) belong to the scope and are
1148
+ // disposed with it (disposeSubtreeScopes in the runtime), as its bindings
1149
+ // are. Untracked, one reading a store kept running for a component the
1150
+ // router had long swapped out.
1151
+ const __endEffects = window.stx._beginEffects ? window.stx._beginEffects() : null;
1152
+
1153
+ try {
1154
+ ${L}
1155
+
1156
+ // Register all defined signals and functions in this scope
1157
+ const __localVars = {};
1158
+ try {
1159
+ ${z.map((U)=>N.has(U)?`Object.defineProperty(__localVars, '${U}', ${Ws(U)});`:`if (typeof ${U} !== 'undefined') __localVars['${U}'] = ${U};`).join(`
1160
+ `)}
1161
+ }
1162
+ catch (e) {}
1163
+ Object.defineProperties(__scopeVars, Object.getOwnPropertyDescriptors(__localVars));
1164
+ if (typeof __stxLiveBindings !== 'undefined') Object.defineProperties(__scopeVars, Object.getOwnPropertyDescriptors(__stxLiveBindings));
1165
+ }
1166
+ finally {
1167
+ __registeringSetupHooks = false;
1168
+ if (__endEffects) {
1169
+ const __previousDispose = __scopeVars.__disposeEffects;
1170
+ const __disposeSetup = __endEffects();
1171
+ __scopeVars.__disposeEffects = typeof __previousDispose === 'function'
1172
+ ? function() { __previousDispose(); __disposeSetup(); }
1173
+ : __disposeSetup;
1174
+ }
1175
+ window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
1176
+ window.__STX_CURRENT_PROPS__ = __previousCurrentProps;
1177
+ }
1178
+ }`,Z={vendorStyleTags:f,factoryBody:H,clientCode:L,deps:Pr([...I,...l.styles.map((U)=>U.resolvedPath)])};if(!D&&l.unresolved.length===0)Sr.set(i,Z);return Z}var Rp=100,Ap=599,zr="__stxResponseStatus",Ln="__stxResponseHeaders";function vs(e){return typeof e==="number"&&Number.isInteger(e)&&e>=Rp&&e<=Ap}function Tn(e){for(let n of e.matchAll(/\bdefinePageMeta\s*\(\s*\{([\s\S]*?)\}\s*\)/g)){let r=n[1].match(/(?:^|,)\s*status\s*:\s*(\d{3})(?=\s*(?:,|$))/);if(!r)continue;let i=Number(r[1]);if(vs(i))return i}return}function Tr(e,n){if(!e||typeof e!=="object")return!1;let r=typeof n==="string"&&/^\d+$/.test(n.trim())?Number(n.trim()):n;if(!vs(r))return!1;return e[zr]=r,!0}function Tp(e,n,r){if(!e||typeof e!=="object")return;let i=String(n??"").trim();if(!i)return;e[Ln]={...e[Ln],[i]:String(r)}}function Wt(e){let n=e?.[zr];return vs(n)?n:void 0}function qt(e){let n=e?.[Ln];if(!n||typeof n!=="object")return;let r=Object.entries(n).map(([i,a])=>[i,String(a)]);return r.length>0?Object.fromEntries(r):void 0}function cl(e,n){if(!e||!n||e===n||typeof n!=="object")return;let r=Wt(e);if(r!==void 0)n[zr]=r;let i=qt(e);if(i)n[Ln]={...n[Ln],...i}}function no(e){return{setResponseStatus:(n)=>{Tr(e,n)},notFound:(n=404)=>{let r=vs(n)&&n>=400?n:404;Tr(e,r)},setResponseHeader:(n,r)=>{Tp(e,n,r)}}}function ll(e,n,r={}){if(!e.includes("@status"))return e;let{filePath:i,buildMode:a}=r,l=a==="compile",u="",f=0,x=/@status\s*\(/g,v;while((v=x.exec(e))!==null){let I=Ip(e,v.index+v[0].length-1);if(I<0)break;let D=e.slice(v.index+v[0].length,I).trim(),W=/^\d+$/.test(D)?Number(D):d(D,n),L=i?` in ${i}`:"";if(l)console.warn(`[stx] @status(${D})${L} is skipped when precompiling: the build has no request, so the branch it sits in is not the one a visitor will get. Call notFound() or setResponseStatus(${D}) from <script server> instead \u2014 that runs per request.`);else if(!Tr(n,W))console.warn(`[stx] @status(${D})${L} is not an HTTP status (100-599) \u2014 ignoring it.`);u+=e.slice(f,v.index),f=I+1+(e.slice(I+1).match(/^[^\S\n]*\n?/)?.[0].length??0),x.lastIndex=f}return f===0?e:u+e.slice(f)}function Ip(e,n){let r=1,i=null,a=!1;for(let l=n+1;l<e.length;l++){let u=e[l];if(a){a=!1;continue}if(i){if(u==="\\")a=!0;else if(u===i)i=null;continue}if(u==='"'||u==="'"||u==="`"){i=u;continue}if(u==="(")r++;else if(u===")"&&--r===0)return l}return-1}var Ta=new Set(mt),Pp=new Set(["props","$props","defineProps"]),Op=new Set(["stx","@stacksjs/stx"]),Ia=S(128),Pa=S(64);function jp(e){let n=[],r=0,i=e.split(`
1179
+ `);for(let a of i){let l=r,u=null,f=!1;for(let x=0;x<a.length;x++){let v=a[x];if(f){f=!1;continue}if(v==="\\"){f=!0;continue}if(u){if(v===u)u=null;continue}if(v==="'"||v==='"'||v==="`"){u=v;continue}if(v==="/"&&x+1<a.length&&a[x+1]==="/")break;if(v==="{")r++;else if(v==="}")r--}if(l===0){let x=a.match(/(?:const|let|var)\s+(\w+)\s*=/);if(x)n.push(x[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(a)){let v=a.match(/(?:const|let|var)\s+(\w+)/);if(v)n.push(v[1])}else{let v=a.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(v){let D=v[1].slice(1,-1).split(",").map((W)=>{let L=W.split(":");return(L.length>1?L[1]:L[0]).trim()}).filter((W)=>/^\w+$/.test(W));n.push(...D)}}}}return[...new Set(n)]}function Tg(e){let n=e;n=n.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),n=n.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),n=n.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),n=n.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),n=n.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function r(i){if(!i.includes(":"))return i;let a=[],l="",u=0,f=0,x=null;for(let v=0;v<i.length;v++){let I=i[v];if(x){if(l+=I,I===x)x=null;continue}if(I==='"'||I==="'"||I==="`"){x=I,l+=I;continue}if(I==="<")u++;else if(I===">"&&u>0)u--;else if(I==="(")f++;else if(I===")")f--;if(I===","&&u===0&&f===0){a.push(l),l="";continue}l+=I}if(l)a.push(l);return a.map((v)=>{let I=v.trim(),D=I.startsWith("..."),W=D?I.slice(3):I,L=-1,z=0;for(let ne=0;ne<W.length;ne++)if(W[ne]==="<")z++;else if(W[ne]===">")z--;else if(W[ne]===":"&&z===0){L=ne;break}if(L===-1)return v;let H=W.substring(0,L).trim().replace(/\?$/,""),Z=W.substring(L+1),U=-1,V=0;for(let ne=0;ne<Z.length;ne++)if(Z[ne]==="<")V++;else if(Z[ne]===">")V--;else if(Z[ne]==="="&&V===0){U=ne;break}let K=D?"...":"";if(U!==-1)return`${K}${H} = ${Z.substring(U+1).trim()}`;return`${K}${H}`}).join(", ")}n=n.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(i,a,l)=>{if(!l.includes(":"))return i;return`${a}(${r(l)})`});{let i=/\b(function\s+\w*\s*)\(/g,a,l=[];while((a=i.exec(n))!==null){let u=a.index+a[0].length-1,f=1,x=u+1,v=0,I=null;while(x<n.length&&f>0){let L=n[x];if(I){if(L===I)I=null;x++;continue}if(L==='"'||L==="'"||L==="`"){I=L,x++;continue}if(L==="<")v++;else if(L===">"&&v>0)v--;else if(v===0){if(L==="(")f++;else if(L===")")f--}if(f>0)x++}if(f!==0)continue;let D=n.substring(u+1,x);if(!D.includes(":"))continue;let W=r(D);l.push({start:u+1,end:x,replacement:W})}for(let u=l.length-1;u>=0;u--){let{start:f,end:x,replacement:v}=l[u];n=n.substring(0,f)+v+n.substring(x)}}return n=n.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(i,a)=>{if(!a.includes(":"))return i;if(a.includes("{")||a.includes("}"))return i;return`(${a.split(",").map((u)=>{let[f,...x]=u.split("="),v=f.split(":")[0].trim();if(x.length>0)return`${v} = ${x.join("=").trim()}`;return v}).join(", ")}) =>`}),n=n.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),n=n.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),n=n.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),n=n.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),n=n.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),n=n.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),n=n.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),n=n.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),n=n.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),n=n.replace(/\n\s*\n\s*\n/g,`
1180
+
1181
+ `),n}function $g(e){return e.replace(/\s*(?:imported from|from)\s+(?:(['"])([^'"\r\n]+)\1|(\S+))/g,(n,...r)=>{let[,i,a]=r,l=i??a;return/(?:[/\\]packages[/\\]stx[/\\]|@stacksjs[/\\]stx[/\\])/.test(l)?"":n})}function Rg(e){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(e)}function Ag(e){if(e instanceof SyntaxError)return!0;let n=e instanceof Error?e.message:String(e);return/SyntaxError|Unexpected (token|identifier|string|number|keyword|end of)|Unterminated|Expected .+ but found/i.test(n)}function Pg(e){if(!/is not defined|can't find variable/i.test(e))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test(e)}var Oa=new Set;async function h(e,n,r,i={}){if(!e.trim())return;let a=A(),l=_(e,JSON.stringify(a)),u=Ia.get(l);if(u===void 0){try{let ce=oe({loader:"ts",target:"browser",define:a}),ue=e.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");ue=ue.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),u=ce.transformSync(ue)}catch{u=Tg(e)}Ia.set(l,u)}let f={exports:{}},x=f.exports,v=on.cwd(),I={},D=[...u.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((ce)=>ce[1]).filter((ce)=>!ce.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(ce)),W=new Map;for(let ce of D)try{if(ce.startsWith(".")){I[ce]=await import(St.resolve(St.dirname(r),ce));continue}let ue=St.resolve(v,"node_modules",ce),_e=St.join(ue,"package.json"),Le=JSON.parse(b("fs").readFileSync(_e,"utf8")),Ze=Le.main||"index.js";if(Le.exports){let rt=typeof Le.exports==="string"?Le.exports:Le.exports["."];if(typeof rt==="string")Ze=rt;else if(rt?.bun)Ze=rt.bun;else if(rt?.import)Ze=rt.import;else if(rt?.default)Ze=rt.default}I[ce]=await import(St.resolve(ue,Ze))}catch(ue){if(ce.startsWith("."))W.set(ce,ue instanceof Error?ue.message:String(ue))}let L=(ce)=>{if(I[ce])return I[ce];let ue=W.get(ce);if(ue!==void 0)throw Error(`Cannot require '${ce}' from ${r}: ${ue}`);return b(ce)},z=n.props||{},N=(ce)=>{if(!ce)return z;let ue={};for(let[_e,Le]of Object.entries(ce)){let Ze=z[_e];if(Ze!==void 0)ue[_e]=Ze;else if(typeof Le==="function")ue[_e]=Le();else ue[_e]=Le}return ue};for(let[ce,ue]of Object.entries(z))Object.defineProperty(N,ce,{value:ue,enumerable:!0,configurable:!0,writable:!0});let H=(ce,ue=!1)=>{if(ce===void 0||ce===null)return ue;if(typeof ce==="string"){let _e=ce.trim().toLowerCase();if(_e===""||_e==="true"||_e==="1"||_e==="on"||_e==="yes")return!0;if(_e==="false"||_e==="0"||_e==="off"||_e==="no")return!1;return!0}return Boolean(ce)},Z=(ce,ue=0)=>{if(ce===void 0||ce===null)return ue;if(typeof ce==="string"){let Le=ce.trim();if(Le==="")return ue;let Ze=Number(Le);return Number.isFinite(Ze)?Ze:ue}let _e=Number(ce);return Number.isFinite(_e)?_e:ue};for(let ce of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(z,ce))continue;try{Object.defineProperty(N,ce,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let U=(ce)=>{if(!ce)return z;let ue={...z};for(let[_e,Le]of Object.entries(ce)){let Ze=Le&&typeof Le==="object"&&!Array.isArray(Le)?Le:{type:Le};if(ue[_e]===void 0&&Ze.default!==void 0)ue[_e]=typeof Ze.default==="function"?Ze.default():Ze.default}return ue},V=()=>n.slots||{},K=(ce,ue)=>{let _e={...ce};for(let[Le,Ze]of Object.entries(ue))if(_e[Le]===void 0)if(typeof Ze==="function")_e[Le]=Ze();else _e[Le]=Ze;return _e},ne=(ce)=>{let ue=()=>ce;return ue.set=(_e)=>{},ue.update=(_e)=>{},ue},ae=(ce)=>{let ue,_e=!1;return()=>{if(!_e)try{ue=ce(),_e=!0}catch{ue=void 0}return ue}},de=(ce)=>{},pe=(ce)=>ce(),Ee=(ce)=>{},Ce=(ce)=>{},$e=no(n);function ye(ce){let ue=ce||{};if(ue.title!==void 0||ue.description!==void 0)ht({title:ue.title,description:ue.description})}function He(ce){if(!ce||typeof ce!=="object")return;let ue=n.__stxClientPayload??{};Object.assign(ue,ce),n.__stxClientPayload=ue}let tt=()=>{let ce=n.__stxServeContext,ue=n.__stxServeSearch??ce?.search??"",_e=ce?.path??"",Le=Object.fromEntries(new URLSearchParams(ue)),Ze=n.query,rt=Object.keys(Le).length>0?Le:Ze??{},yt=ue||(Object.keys(rt).length>0?`?${new URLSearchParams(rt).toString()}`:"");return{params:n.params??{},query:rt,path:_e,name:"",fullPath:_e+yt,hash:"",matched:[]}},ct=()=>({push:(ce)=>{},replace:(ce)=>{},back:()=>{},forward:()=>{},go:(ce)=>{}}),nt=(ce)=>{let ue=n.__stx_runtime_head||{};n.__stx_runtime_head=Qe(ue,Me(ce||{},{known:fo,source:"useHead()"}))},ht=(ce)=>{nt(go(ce||{}))},ut=(ce)=>({value:ce}),st=(ce)=>ce,Ot=(ce)=>({value:typeof ce==="function"?ce():ce}),je=(ce,ue)=>{},Te=(ce)=>{},pt=(ce)=>{},et=(ce)=>ce?ce():Promise.resolve(),an=(ce)=>(ue,..._e)=>{},At=(ce)=>{},xt=(ce,ue)=>{},cn=(ce,ue)=>ue,$s=()=>({value:"light"}),Ft=()=>ne(!1),vt=(ce)=>ne(!1),ln=()=>ne(!1),zn=()=>vt("(prefers-color-scheme: dark)"),un=()=>vt("(prefers-color-scheme: light)"),pn=()=>vt("(prefers-reduced-motion: reduce)"),Wr=()=>vt("(prefers-contrast: more)"),bt={siteId:void 0,API_ENDPOINT:"",ANALYTICS_SITE_ID:void 0,location:{href:"",pathname:"",search:"",hash:"",origin:"",host:"",hostname:"",protocol:"https:",assign:()=>{},replace:()=>{},reload:()=>{}},localStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},sessionStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},fetch:globalThis.fetch,addEventListener:()=>{},removeEventListener:()=>{},setTimeout:()=>0,clearTimeout:()=>{},setInterval:()=>0,clearInterval:()=>{},requestAnimationFrame:()=>0,cancelAnimationFrame:()=>{},alert:()=>{},confirm:()=>!1,prompt:()=>null,getComputedStyle:()=>({}),matchMedia:()=>({matches:!1,addListener:()=>{},removeListener:()=>{}}),getDateRangeParams:()=>"",stx:{}},fn=new Proxy(bt,{get(ce,ue){if(ue in ce)return ce[ue];return},set(ce,ue,_e){return ce[ue]=_e,!0}}),Es={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},$t=console;try{let ce=Di(u,r),ue=new Set(Object.keys(z)),_e=Object.keys(n).filter((le)=>!ue.has(le)&&!Pp.has(le)&&Xt(le)),Le=_e.map((le)=>n[le]);if(!_e.includes("__stxServeContext"))_e.push("__stxServeContext"),Le.push(void 0);if(!ue.has("cookies")){let le=n.cookies??n.__stxServeContext?.cookies??{},be=_e.indexOf("cookies");if(be<0)_e.push("cookies"),Le.push(le);else Le[be]=le}let Ze=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),rt=[],yt=[];for(let[le,be]of Object.entries(z)){if(!Xt(le))continue;if(Ze.has(le))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${le}\\b`).test(ce))continue;rt.push(le),yt.push(be)}let Cs=jp(ce).map((le)=>`module.exports.${le} = typeof ${le} !== 'undefined' ? ${le} : module.exports.${le};`).join(`
1182
+ `),Bn=n.params??{},dn=[],gn=[];for(let le=0;le<_e.length;le++){if(_e[le]==="params")continue;dn.push(_e[le]),gn.push(Le[le])}let Wn=[...mt,...rt,...dn],Fn=`return (async () => {
1183
+ ${ce}
1184
+ ${Cs}
1185
+ return module.exports
1186
+ })()`,Et=_(Fn,Wn.join("\x00")),Tt=Pa.get(Et);if(!Tt)Tt=Function(...Wn,Fn),Pa.set(Et,Tt);let kt=n.__stx_options?.runtimeConfig;if(kt||/\buse(?:Server)?RuntimeConfig\b/.test(u))await On(n,r,kt);let it=await Ye(n.__stx_runtime_config??Nn()??F(),()=>Xr(n,()=>Tt(f,x,L,z,N,H,Z,U,K,He,Gr,Ui,ao,ne,ae,de,pe,Ee,Ce,ye,tt,ct,nt,ht,$e.setResponseStatus,$e.setResponseHeader,$e.notFound,ut,st,Ot,je,Te,pt,et,an,At,V,xt,cn,$s,Ft,vt,ln,zn,un,pn,Wr,fn,Es,$t,bt.confirm,bt.alert,bt.fetch,Bn,...yt,...gn)));if(i.preserveExisting){for(let[le,be]of Object.entries(it))if(!(le in n)||n[le]===void 0)n[le]=be}else Object.assign(n,it);for(let[le,be]of Object.entries(z))if(!(le in n))n[le]=be}catch(ce){if(n.__stx_strict_hydration)throw ce;let ue=$g(ce instanceof Error?ce.message:String(ce));if(Rg(ue))console.warn(`[stx] server <script> in ${r??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${ue}`),i.onFailure?.({kind:"module-resolution",message:ue,error:ce});else if(Ag(ce))console.warn(`[stx] server <script> in ${r??"<unknown>"} does not parse, so every variable in that script is undefined. Cause: ${ue}`),i.onFailure?.({kind:"syntax",message:ue,error:ce});else if(Pg(ue))console.warn(`[stx] server <script> in ${r??"<unknown>"} names something that does not exist, so every variable in that script is undefined. Optional chaining does not help here: an undefined identifier throws before the chain is reached. Cause: ${ue}`),i.onFailure?.({kind:"missing-binding",message:ue,error:ce});else{let _e=`${r??"<unknown>"}\x00${ue}`;if(on.env.STX_DEBUG||!Oa.has(_e))Oa.add(_e),console.warn(`[stx] server <script> in ${r??"<unknown>"} threw, so every variable in that script is undefined and anything that reads one renders empty. Cause: ${ue}`);i.onFailure?.({kind:"unknown",message:ue,error:ce})}try{await Bp(u,n,r)}catch(_e){if(on.env.STX_DEBUG){let Le=_e instanceof Error?_e.message:String(_e);console.warn(`[stx] fallback extraction also failed in ${r??"<unknown>"}: ${Le}`)}}}}function Ig(e){let n=0,r=null,i=!1,a=!1;for(let l=0;l<e.length;l++){let u=e[l];if(r){if(u===r){if(r=null,i||n===0)a=!0}continue}if(u==="'"||u==='"'||u==="`"){r=u;continue}if(u==="{")n++;else if(u==="}")n--;else if(e.startsWith("from",l)&&n===0)i=!0}return r===null&&n===0&&a}var Mp=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function Di(e,n){let r=n?St.dirname(n):on.cwd(),i=on.cwd(),a=e.split(`
1187
+ `),l=[],u=0;while(u<a.length){let f=a[u].trim();if(f.startsWith("interface ")||f.startsWith("export interface ")||f.startsWith("type ")||f.startsWith("export type ")){if(f.includes("{")&&!f.includes("}")){let x=0;for(;u<a.length;u++){for(let v of a[u])if(v==="{")x++;else if(v==="}")x--;if(x<=0)break}}u++;continue}if(f.startsWith("definePageMeta(")){let x=0,v=!1,I=u;for(let L=u;L<a.length&&!v;L++){let z=null,N=!1,H=a[L];for(let Z=0;Z<H.length;Z++){let U=H[Z];if(N){N=!1;continue}if(U==="\\"){N=!0;continue}if(z){if(U===z)z=null;continue}if(U==='"'||U==="'"||U==="`"){z=U;continue}if(U==="(")x++;else if(U===")"){if(x--,x===0){u=L+1,v=!0;break}}}}if(!v)u=a.length;let D=a.slice(I,u).join(`
1188
+ `),W=[];for(let L of["title","description"]){let z=new RegExp(`\\b${L}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(D);if(z)W.push(`${L}: ${JSON.stringify(z[2])}`)}if(W.length>0)l.push(`useSeoMeta({ ${W.join(", ")} });`);continue}if(f.startsWith("import ")||f==="import"||f.startsWith("import{")||/^import['"]/.test(f)){let x=f,v=0;while(!Ig(x)&&u+v+1<a.length)v++,x=`${x} ${a[u+v].trim()}`;u+=v;let I=x.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),D=x.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),W=x.match(/^import\s*['"](.+?)['"]/),L=x,z=(N)=>{if(N.startsWith("."))return St.resolve(r,N);if(N.startsWith("~/")||N.startsWith("@/"))return St.resolve(i,N.slice(2));try{return Bun.resolveSync(N,r)}catch{return N}};if(I){let[,N,H]=I,Z=z(H);l.push(`const ${N} = (await import('${Z}')).default`),l.push(`module.exports.${N} = ${N};`)}else if(D){let[,N,H]=D,Z=z(H),U=[],V=[],K=Op.has(H);for(let ne of N.split(",")){let ae=ne.trim();if(!ae)continue;let de=ae.split(/\s+as\s+/);if(de.length===2){let[pe,Ee]=[de[0].trim(),de[1].trim()];if(K&&Ta.has(pe)){l.push(`const ${Ee} = ${pe};`);continue}U.push(`${pe}: ${Ee}`),V.push(Ee)}else{if(K&&Ta.has(ae))continue;U.push(ae),V.push(ae)}}if(U.length>0)l.push(`const { ${U.join(", ")} } = await import('${Z}')`);for(let ne of V)l.push(`module.exports.${ne} = ${ne};`)}else if(W){let N=z(W[1]);l.push(`await import('${N}')`)}else l.push(L);u++;continue}if(Mp.test(f))l.push(a[u]),u++;else if(f.startsWith("export const ")||f.startsWith("export let ")||f.startsWith("export var ")){let x=Ma(a,u),{type:v,name:I,value:D}=x;l.push(`${v} ${I} = ${D};`),l.push(`module.exports.${I} = ${I};`),u=x.nextIndex}else if(f.startsWith("export function ")||f.startsWith("export async function ")){let x=Br(a,u);l.push(x.functionCode),l.push(`module.exports.${x.name} = ${x.name};`),u=x.nextIndex}else if(f.startsWith("const ")||f.startsWith("let ")||f.startsWith("var ")){let x=Ma(a,u),{type:v,name:I,value:D}=x;l.push(`${v} ${I} = ${D};`),l.push(`module.exports.${I} = ${I};`),u=x.nextIndex}else if(f.startsWith("function ")||f.startsWith("async function ")){let x=Br(a,u);l.push(x.functionCode),l.push(`module.exports.${x.name} = ${x.name};`),u=x.nextIndex}else if(f.startsWith("export default function ")||f.startsWith("export default async function ")){let x=a[u].replace(/^(\s*)export\s+default\s+/,"$1"),v=[...a];v[u]=x;let I=Br(v,u);if(l.push(I.functionCode),I.name)l.push(`module.exports.default = ${I.name};`);u=I.nextIndex}else if(f.startsWith("export default ")){let x=f.replace(/^export\s+default\s+/,"").replace(/;$/,"");l.push(`module.exports.default = ${x};`),u++}else if(f.startsWith("class ")||f.startsWith("export class ")){let x=f.match(/(?:export\s+)?class\s+(\w+)/);if(x){let v=x[1],I=a[u].replace(/^export\s+/,""),D=0,W=u;for(;W<a.length;W++){let L=a[W];for(let z of L)if(z==="{")D++;else if(z==="}")D--;if(W>u)I+=`
1189
+ `+L;if(D<=0&&W>=u)break}l.push(I),l.push(`module.exports.${v} = ${v};`),u=W+1}else l.push(f),u++}else if(f.includes("module.exports"))l.push(f),u++;else if(f.trim()&&!f.startsWith("//"))l.push(f),u++;else u++}return Dp(l.join(`
1190
+ `),r,i)}function Dp(e,n,r){let i=e.length,a="",l=0,u=null,f=!1,x=!1,v=0;while(l<i){let I=e[l],D=e[l+1];if(f){if(a+=I,I===`
1191
+ `)f=!1;l++;continue}if(x){if(a+=I,I==="*"&&D==="/"){a+=D,l+=2,x=!1;continue}l++;continue}if(!u&&I==="/"&&D==="/"){f=!0,a+=I,l++;continue}if(!u&&I==="/"&&D==="*"){x=!0,a+=I,l++;continue}if(u){if(a+=I,I==="\\"){a+=D,l+=2;continue}if(I===u&&u!=="`"){u=null,l++;continue}if(u==="`"){if(I==="$"&&D==="{"){v++,a+=D,l+=2;continue}if(I==="`"){u=null,l++;continue}}l++;continue}if(v>0){if(I==="{")v++;else if(I==="}")v--}if(I==='"'||I==="'"||I==="`"){u=I,a+=I,l++;continue}if(I==="a"&&e.startsWith("await",l)){let W=Np(e,l);if(W){let{quote:L,path:z,end:N}=W;if(z.startsWith(".")||z.startsWith("~/")||z.startsWith("@/")){let H=z.startsWith(".")?St.resolve(n,z):St.resolve(r,z.slice(2));a+=`await import(${L}${H}${L})`,l=N;continue}}}a+=I,l++}return a}function Np(e,n){let r=n+5;if(r>=e.length)return null;if(!/\s/.test(e[r]))return null;while(r<e.length&&/\s/.test(e[r]))r++;if(!e.startsWith("import",r))return null;r+=6;while(r<e.length&&/\s/.test(e[r]))r++;if(e[r]!=="(")return null;r++;while(r<e.length&&/\s/.test(e[r]))r++;let i=e[r];if(i!=="'"&&i!=='"')return null;r++;let a=r;while(r<e.length&&e[r]!==i)if(e[r]==="\\")r+=2;else r++;if(r>=e.length)return null;let l=e.slice(a,r);r++;while(r<e.length&&/\s/.test(e[r]))r++;if(e[r]!==")")return null;return{quote:i,path:l,end:r+1}}function za(e,n){let r=e[n];if(r!=="{"&&r!=="[")return null;let a=k(e,r,r==="{"?"}":"]",n);if(a===-1)return null;return{pattern:e.slice(n,a+1),endPos:a+1}}function Ba(e){let n=[],r=e.slice(1,-1).trim();if(!r)return n;let i=0,a=0,l="";while(i<r.length){let u=r[i];if(u==="{"||u==="["){let f=a===0?za(r,i):null;if(f){n.push(...Ba(f.pattern)),i=f.endPos,l="";continue}a++}else if(u==="}"||u==="]")a--;if(a>0){i++;continue}if(u===","){if(l.trim())n.push(l.trim());l="",i++;continue}if(u===":"){l="",i++;continue}if(u==="="){if(l.trim())n.push(l.trim());l="",i++;while(i<r.length&&r[i]!==","&&a===0){if(r[i]==="{"||r[i]==="[")a++;else if(r[i]==="}"||r[i]==="]")a--;i++}continue}if(/[\w$]/.test(u))l+=u;i++}if(l.trim())n.push(l.trim());return n}function Og(e){let n=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec(e);if(!n)return null;let r=n[0].length,i=(a)=>a===" "||a==="\t";while(r<e.length&&i(e[r]))r++;if(e[r]===":"){let a=0,l=null;r++;for(;r<e.length;r++){let u=e[r];if(l){if(u==="\\"){r++;continue}if(u===l)l=null;continue}if(u==="'"||u==='"'||u==="`"){l=u;continue}if(u==="("||u==="["||u==="{"||u==="<"){a++;continue}if(u===")"||u==="]"||u==="}"||u===">"){a--;continue}if(u==="="&&a<=0){let f=e[r+1],x=e[r-1];if(f!=="="&&f!==">"&&x!=="="&&x!=="!"&&x!=="<"&&x!==">")break}}if(e[r]!=="=")return null}while(r<e.length&&i(e[r]))r++;if(e[r]!=="=")return null;return{type:n[1],name:n[2],value:e.slice(r+1).trim()}}function ja(e,n,r,i){let a=null,l=!1;for(let u of e){if(l){l=!1;continue}if(u==="\\"){l=!0;continue}if(a){if(u===a)a=null;continue}if(u==="'"||u==='"'||u==="`"){a=u;continue}if(u===n)i++;else if(u===r)i--}return i}function Ma(e,n){let r=e[n].trim(),i=Og(r),a=i?[r,i.type,i.name,i.value]:null;if(!a){let I=r.match(/^(?:export\s+)?(const|let|var)\s+/);if(I){let D=r.slice(I[0].length),W=n;if(D.startsWith("{")||D.startsWith("[")){let z=D[0],N=z==="{"?"}":"]",H=ja(D,z,N,0),Z=D;for(let U=n+1;U<e.length&&H>0;U++)Z+=` ${e[U].trim()}`,W=U,H=ja(e[U],z,N,H);if(H>0)Z=D,W=n;D=Z}let L=za(D,0);if(L){let z=I[1],N=L.pattern,H=D.slice(L.endPos).trim();if(H.startsWith("=")){let Z=H.slice(1).trim(),U=Z,V=Math.max(W,n);if(Da(Z)){let de=Na(e,V,Z);U=de.value,V=de.nextIndex}else V=V+1;U=U.trim().replace(/;$/,"");let K=Ba(N),ne=`__stx_src_${n}`,ae=K.map((de)=>`module.exports.${de} = ${de};`).join(`
1192
+ `);return{type:z,name:ne,value:`${U}; ${z} ${N} = ${ne};
1193
+ ${ae}`,nextIndex:V}}}}throw Error(`Failed to parse variable declaration: ${r}`)}let[,l,u,f]=a,x=f,v=n;if(Da(f)){let I=Na(e,n,f);x=I.value,v=I.nextIndex}else v=n+1;while(v<e.length){let I=e[v].trim();if(I.startsWith(".")||I.startsWith("?."))x+=`
1194
+ ${e[v]}`,v++;else break}return x=x.trim().replace(/;$/,""),{type:l,name:u,value:x,nextIndex:v}}function Br(e,n){let r=e[n].trim(),i=r.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!i)throw Error(`Failed to parse function declaration: ${r}`);let[,a]=i,l=r.replace(/^export\s+/,""),u=n;if(Lp(r)){let f=zp(e,n,l);l=f.functionCode,u=f.nextIndex}else u=n+1;return{name:a,functionCode:l,nextIndex:u}}function Da(e){let n=e.trim();if(n.startsWith("{"))return k(n,"{","}",0)===-1;if(n.startsWith("["))return k(n,"[","]",0)===-1;return!Wa(n)}function Wa(e){let n={paren:0,bracket:0,brace:0},r=null,i=0;for(let a=0;a<e.length;a++){let l=e[a];if((a>0?e[a-1]:"")==="\\"&&r)continue;if((l==='"'||l==="'")&&!r){r=l;continue}if(l===r&&r!=="`"){r=null;continue}if(l==="`"&&!r){r="`";continue}if(l==="`"&&r==="`"&&i===0){r=null;continue}if(r==="`"&&l==="$"&&e[a+1]==="{"){i++,a++;continue}if(i>0&&l==="{"){i++;continue}if(i>0&&l==="}"){i--;continue}if(r)continue;if(l==="(")n.paren++;else if(l===")")n.paren--;else if(l==="[")n.bracket++;else if(l==="]")n.bracket--;else if(l==="{")n.brace++;else if(l==="}")n.brace--}return n.paren===0&&n.bracket===0&&n.brace===0&&r===null}function Fa(e){let n=e.indexOf("(");if(n===-1)return e.indexOf("{");let r=k(e,"(",")",n);if(r===-1)return-1;return e.indexOf("{",r)}function Lp(e){let n=Fa(e);if(n===-1)return!0;return k(e,"{","}",n)===-1}function Na(e,n,r){let i=r,a=n+1;while(a<e.length&&!Wa(i)){let l=e[a];i+=`
1195
+ ${l}`,a++}while(a<e.length){let l=e[a].trim();if(l.startsWith(".")||l.startsWith("?."))i+=`
1196
+ ${e[a]}`,a++;else break}return{value:i,nextIndex:a}}function zp(e,n,r){let i=r,a=n+1;while(a<e.length){let l=Fa(i);if(l!==-1){if(k(i,"{","}",l)!==-1)break}let u=e[a];i+=`
1197
+ ${u}`,a++}return{functionCode:i,nextIndex:a}}function La(e,n){let r=d(e,n)??d(`(${e})`,n);if(r!==void 0)return r;if(!/\bprocess\b/.test(e))return;let i={...n,process:Object.freeze({env:{...on.env}})},a=Object.keys(i).filter(Xt),l=a.map((u)=>i[u]);try{return Function(...a,`'use strict'; return (${e});`)(...l)}catch{try{return Function(...a,`'use strict'; return ${e};`)(...l)}catch{return}}}async function Bp(e,n,r){let i=e.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let l of i){let[,,u,f]=l;try{let x=f.trim().replace(/;$/,""),v=La(x,n);if(v!==void 0)n[u]=v}catch(x){console.warn(`Failed to parse export ${u} in fallback:`,x)}}let a=e.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let l of a){let[,,u,f]=l;if(!(u in n))try{let x=f.trim().replace(/;$/,""),v=La(x,n);if(v!==void 0)n[u]=v}catch{}}}function hl(e){let n=e.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),r=n?n[1]:"",i=n?e.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):e;return{scriptContent:r,templateWithoutScript:i}}function yl(e){let n=e.trim();if(!n)return!1;return/(?:const|let|var|function)\s+\w+/.test(n)}
1198
+ export{Ve,Re,G,Ws,qs,X,Ar,Ks,Gs,_i,Ci,Ei,Xs,Ti,Qc,zt,o,ge,S,el,_,Pr,Js,Ae,A,Ue,j,Ht,Pe,Q,_n,We,w,tl,xe,re,Ir,Ie,Or,Nr,me,Vt,se,B,gt,J,Mr,Dr,mt,nl,Ut,Ys,Zs,Se,$i,Cn,Qs,he,rl,sl,Ri,ol,Ai,il,eo,Pi,Ii,al,Oi,Ni,En,to,Tn,Wt,qt,cl,no,ll,ul,$n,Lr,ro,so,dl,Mi,pl,fl,gl,ml,Tg,$g,Rg,Ag,Pg,h,Ig,Di,Og,hl,yl,Li,ji,Ng,Kt,bl,Mg,wl,Cy,qe,Rn,Ke,Dg,Lg,jg,Bg,Fg,oo,zg,Ge,oe,Xe,Hg,jr,Vg,vl,xl,Bi,Je,s,An,Sl,y,ke,Ey,kl,_l,Cl,Fi,io,Ug,Ty,Wg,$y,Pn,g,Y,ie,In,Oe,qg,zi,Kg,Ry,P,Hi,Gg,Ay,O,Py};