@stacksjs/stx 0.2.888 → 0.2.890

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 (260) hide show
  1. package/dist/{chunk-c0g30cjs.js → chunk-05x1rd86.js} +2 -2
  2. package/dist/{chunk-6qq3wy3m.js → chunk-062qfv99.js} +2 -2
  3. package/dist/{chunk-s29hp1qw.js → chunk-0jdz31q1.js} +3 -3
  4. package/dist/{chunk-1kc0jyhj.js → chunk-0jkj8thz.js} +1 -1
  5. package/dist/chunk-0k437z3q.js +2 -0
  6. package/dist/chunk-0q0nbq50.js +2 -0
  7. package/dist/{chunk-5ysv0499.js → chunk-0wp23n1d.js} +1 -1
  8. package/dist/{chunk-9f31gs4m.js → chunk-115bb91s.js} +2 -2
  9. package/dist/chunk-12cjs6vs.js +2 -0
  10. package/dist/chunk-1a7a8cjs.js +2 -0
  11. package/dist/{chunk-wpa3r3b9.js → chunk-1bft48gk.js} +2 -2
  12. package/dist/{chunk-9tecekzq.js → chunk-1jtsr42q.js} +18 -18
  13. package/dist/{chunk-vazk5qbh.js → chunk-1knk403z.js} +2 -2
  14. package/dist/chunk-1p4q6t48.js +2 -0
  15. package/dist/chunk-1ph2yhfn.js +3 -0
  16. package/dist/{chunk-c1b0fy70.js → chunk-1t15z230.js} +5 -5
  17. package/dist/{chunk-2assyczz.js → chunk-1w0bqqh5.js} +2 -2
  18. package/dist/chunk-1z6pqvmf.js +2 -0
  19. package/dist/chunk-2nqmw4dv.js +2 -0
  20. package/dist/{chunk-e9tjxnhn.js → chunk-2xnbdqy4.js} +5 -5
  21. package/dist/chunk-35j7gaj5.js +2 -0
  22. package/dist/chunk-3b3mkgpj.js +3 -0
  23. package/dist/{chunk-7mcs59pr.js → chunk-3bsz7zj3.js} +2 -2
  24. package/dist/{chunk-w624s5jf.js → chunk-3qk8vf9m.js} +3 -3
  25. package/dist/chunk-3yvmaphj.js +2 -0
  26. package/dist/{chunk-mk6thhwf.js → chunk-40k0r6z9.js} +2 -2
  27. package/dist/{chunk-6t04tqvh.js → chunk-41z7f41b.js} +2 -2
  28. package/dist/chunk-44teqn0b.js +2 -0
  29. package/dist/{chunk-372xh1g1.js → chunk-49xwf7dk.js} +6 -6
  30. package/dist/chunk-4akw3bym.js +2 -0
  31. package/dist/chunk-4d85str1.js +2 -0
  32. package/dist/{chunk-whsdyf4t.js → chunk-4eescf3s.js} +7 -7
  33. package/dist/chunk-4xbtxeak.js +2 -0
  34. package/dist/chunk-53kcqdjj.js +2 -0
  35. package/dist/{chunk-1xpq83mc.js → chunk-67j2m620.js} +4 -4
  36. package/dist/chunk-690518hw.js +2 -0
  37. package/dist/chunk-6s3jwysv.js +2 -0
  38. package/dist/{chunk-znnvq1jp.js → chunk-6svc4kb8.js} +65 -65
  39. package/dist/chunk-732gb689.js +2 -0
  40. package/dist/{chunk-ah6nc29h.js → chunk-80ky40mm.js} +2 -2
  41. package/dist/chunk-80xzjxah.js +2 -0
  42. package/dist/chunk-850tye3c.js +2 -0
  43. package/dist/{chunk-b8528fra.js → chunk-8ccgty8s.js} +4 -4
  44. package/dist/{chunk-btsgt6w3.js → chunk-8f8qgjjr.js} +2 -2
  45. package/dist/{chunk-ry6w43p6.js → chunk-8hwfdwgn.js} +6 -6
  46. package/dist/chunk-9344rq4r.js +38 -0
  47. package/dist/chunk-94j4p584.js +2 -0
  48. package/dist/{chunk-y76znqmh.js → chunk-97snfzsy.js} +54 -54
  49. package/dist/chunk-9a9cec4x.js +2 -0
  50. package/dist/chunk-9afkttvz.js +2 -0
  51. package/dist/{chunk-0hj5apb9.js → chunk-9rjgq8k4.js} +1 -1
  52. package/dist/chunk-a0aqs5a8.js +3 -0
  53. package/dist/{chunk-9qrgdekg.js → chunk-a3zrwky3.js} +16 -16
  54. package/dist/{chunk-care745q.js → chunk-a7bqrjm5.js} +2 -2
  55. package/dist/{chunk-pm4kn9h2.js → chunk-adsqckg4.js} +10 -10
  56. package/dist/chunk-ah8az9vv.js +2 -0
  57. package/dist/{chunk-605g9qhp.js → chunk-aj5tsksz.js} +9 -9
  58. package/dist/chunk-amb7e0fp.js +2 -0
  59. package/dist/chunk-arr79m90.js +2 -0
  60. package/dist/{chunk-55kwxxm5.js → chunk-b0hj8eg2.js} +2 -2
  61. package/dist/{chunk-r57jz09p.js → chunk-bgfs3mbg.js} +5 -5
  62. package/dist/chunk-bm0mzk3b.js +2 -0
  63. package/dist/{chunk-ymqm898x.js → chunk-bvqgq18r.js} +2 -2
  64. package/dist/{chunk-wbxmn5gk.js → chunk-bw2m1e7g.js} +5 -5
  65. package/dist/{chunk-wm287dz2.js → chunk-c25q87ys.js} +3 -3
  66. package/dist/{chunk-98mj0es1.js → chunk-ch9028z3.js} +1 -1
  67. package/dist/{chunk-sbwvvjkc.js → chunk-cmg9x1ka.js} +3 -3
  68. package/dist/{chunk-11fxbd71.js → chunk-cphc60zw.js} +2 -2
  69. package/dist/{chunk-dj9ztcth.js → chunk-dvjv4c3a.js} +1 -1
  70. package/dist/{chunk-v8e2c2r1.js → chunk-e16ef18k.js} +2 -2
  71. package/dist/chunk-e28czxw3.js +2 -0
  72. package/dist/chunk-e8szp5wa.js +2 -0
  73. package/dist/chunk-eq86wzhr.js +1314 -0
  74. package/dist/chunk-essd43ad.js +2 -0
  75. package/dist/chunk-f60k8j9m.js +2 -0
  76. package/dist/chunk-fsk3rk2x.js +2 -0
  77. package/dist/{chunk-fce8wj3t.js → chunk-g3vce7ka.js} +2 -2
  78. package/dist/{chunk-em6fqvjy.js → chunk-g5nfqzfh.js} +2 -2
  79. package/dist/chunk-gfea8a9y.js +2 -0
  80. package/dist/chunk-hda7t8g6.js +2 -0
  81. package/dist/chunk-hk241gt2.js +2 -0
  82. package/dist/{chunk-c3ca056p.js → chunk-htx5yezj.js} +2 -2
  83. package/dist/{chunk-b0jekg4c.js → chunk-hxws025y.js} +3 -3
  84. package/dist/chunk-hyyh7qxw.js +25 -0
  85. package/dist/chunk-j6fs31va.js +2 -0
  86. package/dist/chunk-j9kejcrx.js +2 -0
  87. package/dist/chunk-j9vfv53x.js +20 -0
  88. package/dist/chunk-jhbz5w30.js +2 -0
  89. package/dist/chunk-jvnsz2x9.js +2 -0
  90. package/dist/chunk-k4x680e3.js +2 -0
  91. package/dist/chunk-k8bk685s.js +2 -0
  92. package/dist/chunk-kexqmwx8.js +2 -0
  93. package/dist/chunk-kfdmm240.js +2 -0
  94. package/dist/{chunk-fepezvdq.js → chunk-kg7vby72.js} +8 -8
  95. package/dist/{chunk-wf8pdjq5.js → chunk-khm56bfm.js} +1 -1
  96. package/dist/{chunk-303vzq80.js → chunk-kk2p2tgv.js} +3 -3
  97. package/dist/chunk-kpjq135z.js +2 -0
  98. package/dist/chunk-kqsm7gf1.js +2 -0
  99. package/dist/{chunk-j51wss7s.js → chunk-kr2400c3.js} +4 -4
  100. package/dist/{chunk-r8xper92.js → chunk-ksmn19qw.js} +2 -2
  101. package/dist/{chunk-7hm1tpw0.js → chunk-mhrnjaka.js} +6 -6
  102. package/dist/chunk-mtfymhy1.js +2 -0
  103. package/dist/{chunk-52mhrbps.js → chunk-n6q1d66k.js} +1 -1
  104. package/dist/chunk-neg6ckjg.js +12 -0
  105. package/dist/{chunk-wscry63p.js → chunk-nhv81gp2.js} +2 -2
  106. package/dist/{chunk-c73c0wf9.js → chunk-nq60tjkz.js} +2 -2
  107. package/dist/{chunk-v47xc2fr.js → chunk-nzpb263k.js} +9 -9
  108. package/dist/{chunk-p33npqjt.js → chunk-p0bjbtdx.js} +33 -33
  109. package/dist/{chunk-gdtj5rfa.js → chunk-p3hbsrk9.js} +6 -6
  110. package/dist/chunk-p82fzxdg.js +2 -0
  111. package/dist/{chunk-0d7ypcjb.js → chunk-pjj54ddk.js} +3 -3
  112. package/dist/{chunk-qsnpqa8q.js → chunk-pnmafbv5.js} +1 -1
  113. package/dist/{chunk-vgsasnwm.js → chunk-pvm48tse.js} +3 -3
  114. package/dist/{chunk-zek9t5za.js → chunk-pwpge9bj.js} +2 -2
  115. package/dist/{chunk-6zq3eh7d.js → chunk-q0y8gv18.js} +2 -2
  116. package/dist/{chunk-7s3j8pqq.js → chunk-qnf7w4xw.js} +3 -3
  117. package/dist/chunk-qsv84cwm.js +2 -0
  118. package/dist/{chunk-xavx271y.js → chunk-r5ecgcx2.js} +5 -5
  119. package/dist/chunk-r7m60q1m.js +2 -0
  120. package/dist/chunk-r98pye4h.js +2 -0
  121. package/dist/{chunk-zf29ahhd.js → chunk-rb2zbdqd.js} +4 -4
  122. package/dist/{chunk-vjfp8n6p.js → chunk-rd663v1m.js} +3 -3
  123. package/dist/{chunk-4nnmrp7w.js → chunk-rf0smj4c.js} +2 -2
  124. package/dist/{chunk-0dq9svfb.js → chunk-sh7a0g09.js} +3 -3
  125. package/dist/chunk-snkbn5y8.js +2 -0
  126. package/dist/chunk-sztr4d5g.js +2 -0
  127. package/dist/{chunk-4c9p434g.js → chunk-t0ttxayz.js} +2 -2
  128. package/dist/{chunk-5ymf5c8m.js → chunk-t3zmfh8w.js} +7 -7
  129. package/dist/chunk-t4gcsbna.js +2 -0
  130. package/dist/chunk-tbh7r1wh.js +2 -0
  131. package/dist/chunk-tspqdt8e.js +2 -0
  132. package/dist/{chunk-6fsnnj5v.js → chunk-v1mwwben.js} +6 -6
  133. package/dist/chunk-v3jyb8k6.js +2 -0
  134. package/dist/chunk-v6gkjg5f.js +3 -0
  135. package/dist/chunk-v90nz5xm.js +54 -0
  136. package/dist/{chunk-7nhgpjjw.js → chunk-vf4ejngv.js} +6 -6
  137. package/dist/chunk-vfcbz0an.js +3 -0
  138. package/dist/{chunk-hxhmhw23.js → chunk-vk2jy6mn.js} +3 -3
  139. package/dist/{chunk-e1qcfesw.js → chunk-vkfw9k1n.js} +8 -8
  140. package/dist/{chunk-mm1eg2pg.js → chunk-vxbvrbqs.js} +10 -10
  141. package/dist/chunk-wedwczed.js +2 -0
  142. package/dist/chunk-wg6fmren.js +4 -0
  143. package/dist/{chunk-s7wp7a2x.js → chunk-whcrca58.js} +31 -31
  144. package/dist/chunk-wmvvrsn0.js +2 -0
  145. package/dist/chunk-wnrh62by.js +2 -0
  146. package/dist/{chunk-q3bkxg2n.js → chunk-wy6vjz1e.js} +21 -21
  147. package/dist/{chunk-mbm3ma63.js → chunk-x5bn2svk.js} +2 -2
  148. package/dist/chunk-x6565mhk.js +2 -0
  149. package/dist/{chunk-brzjass3.js → chunk-xc5esqcb.js} +2 -2
  150. package/dist/{chunk-e2ws79vt.js → chunk-xeyq6d0t.js} +8 -8
  151. package/dist/{chunk-xw291tn7.js → chunk-xmg6bmh6.js} +27 -22
  152. package/dist/{chunk-3fbgpv1d.js → chunk-xvncq3m5.js} +2 -2
  153. package/dist/chunk-xwgdcc7w.js +2 -0
  154. package/dist/chunk-xwrjre34.js +2 -0
  155. package/dist/{chunk-1wkp3pks.js → chunk-xy8smv5e.js} +2 -2
  156. package/dist/{chunk-y8p59h6c.js → chunk-y1d3j2j7.js} +4 -4
  157. package/dist/{chunk-zje94z0k.js → chunk-yesh4dfe.js} +61 -61
  158. package/dist/chunk-ymc1wgb3.js +2 -0
  159. package/dist/{chunk-xy4j8t7w.js → chunk-ytjn0gq2.js} +2 -2
  160. package/dist/chunk-z4tdnfxd.js +2 -0
  161. package/dist/{chunk-w1q86c89.js → chunk-zf68afyh.js} +3 -3
  162. package/dist/{chunk-6c1vm6bs.js → chunk-zkwkhesc.js} +2 -2
  163. package/dist/{chunk-2rmqmajd.js → chunk-zpqjsnz9.js} +3 -3
  164. package/dist/{chunk-vgr7gd8k.js → chunk-zwqkbk2m.js} +2 -2
  165. package/dist/chunk-zxjdfgdx.js +3 -0
  166. package/dist/cli.js +29 -29
  167. package/dist/component-contract.d.ts +1 -0
  168. package/dist/component-contract.js +6 -4
  169. package/dist/component-library.d.ts +2 -1
  170. package/dist/component-library.js +218 -348
  171. package/dist/composition-api.d.ts +7 -1
  172. package/dist/craft-entry.js +2 -2
  173. package/dist/craft.js +2 -2
  174. package/dist/directive-arguments.js +39 -6
  175. package/dist/emits-declaration.d.ts +9 -0
  176. package/dist/emits-declaration.js +64 -0
  177. package/dist/parser/tokenizer.d.ts +2 -1
  178. package/dist/parser/tokenizer.js +7 -5
  179. package/dist/props-declaration.d.ts +66 -0
  180. package/dist/props-declaration.js +379 -0
  181. package/dist/pwa.js +3 -3
  182. package/dist/ssg.js +28 -28
  183. package/dist/utils.js +20 -109
  184. package/package.json +5 -5
  185. package/dist/chunk-000mwmfq.js +0 -1203
  186. package/dist/chunk-043d0en0.js +0 -2
  187. package/dist/chunk-0w66z6eq.js +0 -2
  188. package/dist/chunk-13wd9gf0.js +0 -3
  189. package/dist/chunk-1znqedae.js +0 -2
  190. package/dist/chunk-2drzzjcm.js +0 -2
  191. package/dist/chunk-3c7nt5qp.js +0 -2
  192. package/dist/chunk-3ed2erm6.js +0 -12
  193. package/dist/chunk-3zyzhcd9.js +0 -2
  194. package/dist/chunk-44rb9fk0.js +0 -2
  195. package/dist/chunk-472j3bhp.js +0 -2
  196. package/dist/chunk-4acce1m8.js +0 -2
  197. package/dist/chunk-4kasmp98.js +0 -2
  198. package/dist/chunk-53kkjn23.js +0 -2
  199. package/dist/chunk-5gwvy612.js +0 -2
  200. package/dist/chunk-61vbqrde.js +0 -2
  201. package/dist/chunk-6fpzwryt.js +0 -2
  202. package/dist/chunk-7195598h.js +0 -2
  203. package/dist/chunk-7zvf79vb.js +0 -2
  204. package/dist/chunk-88a735jw.js +0 -2
  205. package/dist/chunk-8v7yjq3b.js +0 -2
  206. package/dist/chunk-94mpe1ny.js +0 -3
  207. package/dist/chunk-97kgrevs.js +0 -4
  208. package/dist/chunk-a8c9j9cj.js +0 -2
  209. package/dist/chunk-acw851e8.js +0 -2
  210. package/dist/chunk-andfvr3g.js +0 -2
  211. package/dist/chunk-aqxh80vh.js +0 -2
  212. package/dist/chunk-ay5zkfdg.js +0 -2
  213. package/dist/chunk-b4gptdtc.js +0 -2
  214. package/dist/chunk-baaw9w7y.js +0 -2
  215. package/dist/chunk-bw2p9h2g.js +0 -2
  216. package/dist/chunk-ce0vv7kz.js +0 -2
  217. package/dist/chunk-d1yj29g2.js +0 -2
  218. package/dist/chunk-dbhmbef1.js +0 -20
  219. package/dist/chunk-dfsykk1r.js +0 -2
  220. package/dist/chunk-e9p596bp.js +0 -2
  221. package/dist/chunk-edysherg.js +0 -25
  222. package/dist/chunk-ftecsa8e.js +0 -2
  223. package/dist/chunk-ge2h5v46.js +0 -2
  224. package/dist/chunk-gqvnz8a7.js +0 -2
  225. package/dist/chunk-j41gp8p3.js +0 -2
  226. package/dist/chunk-jxvccj30.js +0 -2
  227. package/dist/chunk-k5bbre7d.js +0 -2
  228. package/dist/chunk-kd47vgs8.js +0 -2
  229. package/dist/chunk-keqjafdz.js +0 -2
  230. package/dist/chunk-kvxdyg7e.js +0 -3
  231. package/dist/chunk-kz3mejc4.js +0 -2
  232. package/dist/chunk-ngkh0t5b.js +0 -2
  233. package/dist/chunk-nx9895m6.js +0 -2
  234. package/dist/chunk-nxgtt1t1.js +0 -2
  235. package/dist/chunk-nyw2ztar.js +0 -2
  236. package/dist/chunk-p5q27adr.js +0 -2
  237. package/dist/chunk-p6hcrg3r.js +0 -3
  238. package/dist/chunk-pa2vt2ej.js +0 -2
  239. package/dist/chunk-pczb7xav.js +0 -2
  240. package/dist/chunk-ps37r6hj.js +0 -2
  241. package/dist/chunk-pvbhk17r.js +0 -2
  242. package/dist/chunk-q252qvsy.js +0 -2
  243. package/dist/chunk-q5b0vpmm.js +0 -2
  244. package/dist/chunk-qg1kw5yf.js +0 -2
  245. package/dist/chunk-qjy5yq25.js +0 -54
  246. package/dist/chunk-r561zt9v.js +0 -38
  247. package/dist/chunk-sbr85vda.js +0 -2
  248. package/dist/chunk-tkab24xr.js +0 -2
  249. package/dist/chunk-vn59yrjh.js +0 -2
  250. package/dist/chunk-w50yggy3.js +0 -3
  251. package/dist/chunk-w5zzwe2f.js +0 -2
  252. package/dist/chunk-wa9q1gyv.js +0 -2
  253. package/dist/chunk-wbmx0rge.js +0 -2
  254. package/dist/chunk-wpgxhrd7.js +0 -2
  255. package/dist/chunk-x3azrbpr.js +0 -2
  256. package/dist/chunk-x50hk1hq.js +0 -2
  257. package/dist/chunk-xbkbvfcg.js +0 -2
  258. package/dist/chunk-z55rpt3s.js +0 -3
  259. package/dist/chunk-zwde52kw.js +0 -2
  260. package/dist/chunk-zxff7kq9.js +0 -2
@@ -1,1203 +0,0 @@
1
- // @bun
2
- import{Ye,Nn,ao,Ui,F}from"./chunk-6t04tqvh.js";import{On}from"./chunk-fce8wj3t.js";import{Kr,_,jl,wt,ea,Bl}from"./chunk-11fxbd71.js";import{M}from"./chunk-hxhmhw23.js";import{T,R}from"./chunk-s29hp1qw.js";import{qr,mo,Qi,Ml,De}from"./chunk-kvxdyg7e.js";import{co,d,m,Xt,p,ee,K,Ki,k,fo,Me,Qe,go}from"./chunk-xw291tn7.js";import{b}from"./chunk-94mpe1ny.js";import{te}from"./chunk-w50yggy3.js";import{t,E}from"./chunk-3ed2erm6.js";import{c}from"./chunk-b0jekg4c.js";import St from"path";import an from"process";import{AsyncLocalStorage as Za}from"async_hooks";var Xr=new Za;function $n(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function Gr(e,n){return Xr.run($n(e),n)}async function Yr(e,n){let r=Xr.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,(f,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}),x=JSON.parse(u);return r.values.set(e,x),x}).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 X(e,n=!1){let r=t(e),i=[],a=new Set,l=0,u=0,x=r.length,f=()=>{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 L=v[2];if(!a.has(L))i.push(L),a.add(L);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((L)=>{let W=L.trim();if(!W)return;let V=W.indexOf(":"),U=(V>=0?W.slice(V+1).trim():W).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((L)=>{let W=L.trim().replace(/^\.\.\./,"");if(!W)return;let V=W.split(/[\s=]/)[0];if(V&&!a.has(V))i.push(V),a.add(V)});return}if(n)return;let z=r.slice(u).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(z){let L=z[1];if(!a.has(L))i.push(L),a.add(L);return}let N=r.slice(u).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(N){let L=N[1];if(!a.has(L))i.push(L),a.add(L)}};while(u<x){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])))f();u++}return i.join(", ")}function Ws(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function Ja(e,n=X(e).split(",").map((r)=>r.trim()).filter(Boolean)){let r=new Set(X(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=`{ ${Ja(e,n)} }`;return X(e).split(",").some((i)=>i.trim()==="__stxLiveBindings")?`Object.defineProperties(${r}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:r}import en from"fs";import ze from"path";function J(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var Qr=new Map;function Ar(e,n=!0){let r=Qr.get(e);if(n&&r)return r;let i=new Map,a=[ze.join(e,"src"),ze.join(e,"dist"),e];function l(u,x){if(x>6)return;let f;try{f=en.readdirSync(u,{withFileTypes:!0})}catch{return}for(let v of f){let I=ze.join(u,v.name);if(v.isDirectory()){if(v.name==="node_modules"||v.name.startsWith("."))continue;l(I,x+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 z=D.toLowerCase();if(!i.has(z))i.set(z,I);let N=J(D);if(!i.has(N))i.set(N,I)}}}for(let u of a)if(l(u,0),i.size>0)break;if(n)Qr.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 ei(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=J(n);return[n,r,i]}function _i(e,n){let[r,i,a]=ei(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 Xa=["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 x=JSON.parse(en.readFileSync(ze.join(i,"package.json"),"utf8")).stx?.components;if(Array.isArray(x))a=x.filter((f)=>typeof f==="string")}catch{}let l=a.length?a:Xa;return[ze.dirname(ze.resolve(e)),...l.map((u)=>ze.resolve(i,u))]}function*Ei(e,n,r={},i){let a=ei(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield ze.resolve(ze.dirname(n),`${a[0]}.stx`);return}let l=[...new Set(a.map((f)=>`${f}.stx`))],u=r.projectRoot||process.cwd(),x=[...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 f of new Set(x)){for(let v of l)yield ze.join(f,v);try{for(let v of en.readdirSync(f,{withFileTypes:!0}))if(v.isDirectory())for(let I of l)yield ze.join(f,v.name,I)}catch{}}}function ti(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"),x=typeof l==="string"&&!!l.trim(),f=typeof u==="string"?!["false","0","off","no"].includes(u.trim().toLowerCase()):Boolean(u);if(!x&&!f)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 de from"path";import Nt from"path";import xn from"fs";var Ga=new Set(["touchstart","touchmove","wheel","mousewheel"]);function Ms(e,n){if(n.passive)return!0;if(n.prevent||n.nonpassive)return!1;return Ga.has(e.toLowerCase())}var ni=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"]),si={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"},Ya=new Set(["ctrl","alt","shift","meta"]),oi={left:0,middle:1,right:2};function ri(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(Ya.has(i))n.systemKeys.push(i);else if(i in oi)n.mouse=i;else if(i in si||/^[a-z]$/.test(i))n.keys.push(si[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 ai(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,x,f]=l,v=l.index,I=v+u.length,D=`__stx_evt_${n}${i++}`,z=[],N=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,L;while((L=N.exec(f))!==null){let[,V,G]=L,U=V.split("."),H=U[0];if(!ni.has(H))continue;z.push({attribute:`@${V}`,event:H,handler:G,modifiers:ri(U.slice(1)),elementId:D})}let W=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((L=W.exec(f))!==null){let[,V,G]=L,U=V.split("."),H=U[0];if(!ni.has(H))continue;z.push({attribute:`@${V}`,event:H,handler:G,modifiers:ri(U.slice(1)),elementId:D})}if(z.length>0)r.push({originalTag:u,elementId:D,events:z,startIndex:v,endIndex:I})}return r}function Qa(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=oi[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 ec(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 tc(e){let{modifiers:n}=e,r=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),i=Qa(e),a=ec(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(", ")} }`:"",x=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('${x}', null, $el);
10
- }
11
- else {
12
- __stx_runHandler('${x}', 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('${x}', null, $el);
27
- }
28
- else {
29
- __stx_runHandler('${x}', 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('${x}', $event, $el);
50
- }
51
- else {
52
- // Fallback for non-reactive context (entity-safe; decoded + run in memory)
53
- __stx_runHandler('${x}', $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(tc).join(`
112
- `)}
113
- })();
114
- </script>`}function nc(e,n=""){let r=ai(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],x=u.originalTag;if(!x.includes(" id="))x=x.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${u.elementId}"`);else{let f=x.match(/id=["']([^"']+)["']/);if(f)for(let v of u.events)v.elementId=f[1]}for(let f of u.events){let v=f.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),I=new RegExp(`\\s*${v}\\s*=\\s*"[^"]*"`,"g"),D=new RegExp(`\\s*${v}\\s*=\\s*'[^']*'`,"g");x=x.replace(I,""),x=x.replace(D,"")}i=i.slice(0,u.startIndex)+x+i.slice(u.endIndex),a.push(...u.events)}return{template:i,bindings:a}}function ii(e){let n=e.$uid;return typeof n==="string"&&n?`${n}_`:""}function el(e,n,r){if(Bl(e))return e;if(n.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:x,bindings:f}=nc(e,ii(n)),v=n.__stx_event_bindings||[];return n.__stx_event_bindings=[...v,...f],x}let i=ai(e,ii(n));if(i.length===0)return e;let a=e;for(let x=i.length-1;x>=0;x--){let f=i[x],v=f.originalTag;if(!v.includes(" id="))v=v.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${f.elementId}"`);else{let I=v.match(/id=["']([^"']+)["']/);if(I)for(let D of f.events)D.elementId=I[1]}for(let I of f.events){let D=I.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),z=new RegExp(`\\s*${D}\\s*=\\s*"[^"]*"`,"g"),N=new RegExp(`\\s*${D}\\s*=\\s*'[^']*'`,"g");v=v.replace(z,""),v=v.replace(N,"")}a=a.slice(0,f.startIndex)+v+a.slice(f.endIndex)}let l=Ti(i.flatMap((x)=>x.events)),u=c(a);if(u!==-1)a=a.slice(0,u)+l+`
115
- `+a.slice(u);else a+=l;return a}function ci(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}=E(r),l=(x)=>!a||i[x]===0,u=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${n}\\b)`,"g");for(let x of r.matchAll(u)){let f=(x.index??0)+x[0].length-x[1].length;if(l(f))return!0}for(let x of r.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(x.index??0)&&ci(x[1],!0).has(n))return!0;for(let x of r.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(x.index??0)&&ci(x[1],!1).has(n))return!0;return!1}var Ve="0.2.888";var li=Symbol.for(`stx.lazy-module-promises.${Ve}`);function rc(){let e=globalThis;return e[li]??=new Map,e[li]}function o(e,n){let r=rc(),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 ic=/<\/(script)/gi;function ge(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(ic,"<\\/$1")}import ui from"fs";var pi=[];function S(e){let n=new T(e);return pi.push(n),n}function tl(){for(let e of pi)e.clear()}function C(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:ui.statSync(r).mtimeMs})}catch{}return n}function Js(e){for(let n of e)try{if(ui.statSync(n.path).mtimeMs!==n.mtimeMs)return!1}catch{return!1}return!0}var Pe=["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 oc=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function ac(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 cc(e,n){let r=n;while(!0){let i=Nt.join(r,"node_modules",e,"package.json");if(xn.existsSync(i))return Nt.dirname(i);let a=Nt.dirname(r);if(a===r)return null;r=a}}function lc(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),x=a.slice(l+1);if(!n.startsWith(u)||!n.endsWith(x))continue;if(n.length<u.length+x.length)continue;if(!i||u.length>i.prefix.length)i={pattern:a,prefix:u,suffix:x}}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 uc(e,n){let r=ac(e);if(!r||!r.subpath)return null;let i=cc(r.pkg,n);if(!i)return null;let a;try{a=JSON.parse(xn.readFileSync(Nt.join(i,"package.json"),"utf8"))}catch{return null}let l=`.${r.subpath}`,u=lc(a.exports,l);if(!u)return null;let x=Nt.resolve(i,u);return xn.existsSync(x)?x:null}function Li(e,n){let r=n.filePath?Nt.dirname(n.filePath):n.projectRoot||process.cwd(),i=n.projectRoot||process.cwd(),a=new Set,l=[],u=[];return{code:e.replace(oc,(f,v)=>{let I;try{if(v.startsWith("./")||v.startsWith("../")||v.startsWith("/")){if(I=v.startsWith("/")?v:Nt.resolve(r,v),!xn.existsSync(I))throw Error(`file not found: ${I}`)}else{let D=null;try{D=Bun.resolveSync(v,i)}catch{D=uc(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=xn.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 pc(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="${pc(n.source)}" data-stx-layer="vendor">
116
- @layer vendor {
117
- ${n.contents}
118
- }
119
- </style>`).join(`
120
- `)}
121
- `}var Mg=_,fi=S(256);function Kt(e){let n=C(e),r=fi.get(n);if(!r)r=fc(e),fi.set(n,r);return{code:r.code,imports:[...r.imports],models:[...r.models]}}function fc(e){let n=t(e),r=new Set;for(let x of e.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let f of x[1].split(",")){let v=f.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(v)r.add(v)}let i=mo(n),a=Pe.filter((x)=>{if(r.has(x)||i.has(x))return!1;return Dg(n,x,!0)}),l=hi(n).filter((x)=>!r.has(x)&&!i.has(x));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 dc=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 hi(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(dc.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 gc(e){return mo(e)}var di=S(128);function wl(e){let n=C(e),r=di.get(n);if(!r)r=mc(e),di.set(n,r);return{code:r.code,stxImports:[...r.stxImports],browserImports:[...r.browserImports]}}function mc(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 N=u[1],L=u[2];if(u[0].includes("import type"))continue;let W=[];for(let G of N.split(",")){let U=G.trim();if(!U||U.startsWith("type "))continue;let H=U.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!H)continue;let Z=H[1],ne=H[2]||Z;if(a.add(Z),a.add(ne),L==="stx"||L==="@stacksjs/stx")n.add(Z);else r.add(Z);if(ne!==Z)W.push(`${ne} = ${Z}`)}let V=W.length>0?`var ${W.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";i=i.replace(u[0],V)}let x=gc(i),f=qr(i);for(let N of Mg){if(a.has(N)||x.has(N))continue;if(Ns(f,N,!0))n.add(N)}let v=t(i),I=qr(v),D=new Set;for(let N of i.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let L of N[1].split(",")){let W=L.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let V of W){let G=V.trim();if(G)D.add(G)}}for(let N of Pe){if(a.has(N)||x.has(N)||D.has(N))continue;if(Ns(I,N))r.add(N)}let z=hi(v,I);for(let N of z)if(!a.has(N)&&!x.has(N))r.add(N);return{code:i,stxImports:Array.from(n),browserImports:Array.from(r)}}function Dg(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 x=u+n.length,f=u-1;while(f>=0&&/\s/.test(i[f]))f--;if(i[f]==="."&&i.slice(Math.max(0,f-2),f+1)!=="...")continue;let v=x;while(v<i.length&&/\s/.test(i[v]))v++;if(i[v]===":"&&i[v+1]!==":"&&(i[f]==="{"||i[f]===","))continue;if(r&&!/^\s*(?:<[^>]*>)?\s*\(/.test(i.slice(x)))continue;if(hc(i,x))continue;return!0}return!1}function hc(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 vl(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
- ${xc(e,n)}`;return""}function Ey(e,n=[]){let{browserImports:r}=wl(e),i=new Set(n);return vl([],r.filter((a)=>!i.has(a)))}function xc(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 bc=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,gi=new Set;function yc(e,n){let r=bc.test(e),i=n.length>32768;if(!r&&!i)return;if(gi.has(e))return;if(gi.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],[x])=>u<x?-1:u>x?1:0);for(let[u,x]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 f;try{f=JSON.stringify(x)}catch{continue}if(f===void 0)continue;yc(u,f),a.push(` var ${u} = ${f.replace(/</g,"\\u003c")};`)}if(a.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
136
- ${a.join(`
137
- `)}
138
- `}var _c={left:0,middle:1,right:2};function wc(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=_c[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 Sc(e,n){let{elementId:r,event:i,modifiers:a}=e,l=Ds(e.handler),u=wc(a),x=[];if(a.once)x.push("once: true");if(a.capture)x.push("capture: true");if(Ms(i,a))x.push("passive: true");let f=x.length>0?`, { ${x.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 z(N){if(/\$emit\s*\(/.test(N))return`${D}
141
- ${N}`;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
- ${N}
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() { ${z(l)} }, ${a.debounce})
155
- }${f})
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
- ${z(l)}
166
- }
167
- }${f})
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
- }${f})`;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
- }${f})`}function vc(e){if(e.length===0)return"";return`
182
- // STX: auto-generated event bindings
183
- ${e.map((r,i)=>Sc(r,i)).join(`
184
- `)}`}function mi(e){let n=[],r=new Set,i=e.replace(/^\s*import\s+.*$/gm,""),a=0,l=i.length,u=0;while(u<l){let x=i[u];if(x==="'"||x==='"'||x==="`"){let f=x;if(u++,f==="`"){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]===f){u++;break}u++}continue}if(x==="/"&&i[u+1]==="/"){while(u<l&&i[u]!==`
185
- `)u++;continue}if(x==="/"&&i[u+1]==="*"){u+=2;while(u<l-1&&!(i[u]==="*"&&i[u+1]==="/"))u++;u+=2;continue}if(x==="{"){a++,u++;continue}if(x==="}"){a--,u++;continue}if(a===0){let f=i.slice(u),v=f.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(v){let z=v[1];if(!z.startsWith("_")&&!r.has(z))n.push(z),r.add(z);u+=v[0].length;continue}let I=f.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(I){I[1].split(",").forEach((z)=>{let N=z.trim(),L=N.indexOf(":"),W=L>=0?N.slice(L+1).trim().split(/[\s=]/)[0]:N.split(/[\s=]/)[0];if(W&&!W.startsWith("_")&&!r.has(W))n.push(W),r.add(W)}),u+=I[0].length;continue}let D=f.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(D){let z=D[1];if(!z.startsWith("_")&&!r.has(z))n.push(z),r.add(z);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 Ec(e){let n=new Set,r=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function i(z){let N;while((N=r.exec(z))!==null){let L=N[0];if(!$c.has(L))n.add(L)}}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 x=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((l=x.exec(e))!==null)i(l[1]);let f=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((l=f.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 x=ji(u.styles),f=Kt(r);r=f.code,l=[...f.imports,...f.models];let{hasUserImports:v,bundleClientScript:I}=await o("stx/client-script-bundler",()=>import("./chunk-k5bbre7d.js"));if(v(r))r=await I(r,n.filePath||"",{projectRoot:n.projectRoot,minify:n.production}),a=!0;if(n.autoImports!==!1){let H=wl(r);r=H.code,i=vl(H.stxImports,H.browserImports.filter((Z)=>!l.includes(Z)))}if(i=`${Rn(r,n.serverData)}${i}`,r=M(r),!a&&Ge(n.attrs||""))r=Xe(r);let D=vc(n.eventBindings||[]),z=(n.attrs||"").trim(),N=/\btype\s*=\s*["']module["']/i.test(z),L=n.instanceId?` data-stx-instance="${n.instanceId}"`:"";if(N){let H=z.replace(/\btype\s*=\s*["']module["']/i,"").trim(),Z=`type="module" data-stx-scoped${L}${H?` ${H}`:""}`;return`${x}<script ${Z}>
186
- ${ge(`${i}${r}
187
- ${D}`)}
188
- </script>`}let W=ea(e),V=/function __stx_setup_/.test(r),G=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function U(H){let Z=H.length>0?`
189
- return ${qs(r,H)};`:"",ne=JSON.stringify(`[stx] client block failed${n.filePath?` (${n.filePath})`:""}; this block will not hydrate`);return`${x}<script data-stx-scoped data-stx-run="always"${L}>
190
- window.stx.mount(function() {
191
- 'use strict';
192
- try {
193
- ${ge(`${i}${r}
194
- ${D}${Z}`)}
195
- } catch (error) {
196
- console.error(${ne}, error);
197
- return {};
198
- }
199
- })</script>`}if(!G&&!V){if(W)return U(mi(e));if(n.templateContent){let H=mi(e);if(H.length>0){let Z=Ec(n.templateContent);if(H.some((ae)=>Z.has(ae)))return U(H)}}}return`${x}<script data-stx-scoped data-stx-run="always"${L}>
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 Oc}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,kc=new Map(["textarea","title","xmp","iframe","noembed","noframes"].map((e)=>[e,new RegExp(`</${e}\\s*>`,"ig")]));function Ie(e){let n=[],r=0;while(r<e.length){let i=e.indexOf("<",r);if(i===-1)break;if(e.startsWith("<!--",i)){let z=e.indexOf("-->",i+4);if(z===-1)break;r=z+3;continue}Bs.lastIndex=i;let a=Bs.exec(e);if(!a){r=i+1;continue}let l=Bs.lastIndex,u=l,x=null;for(;u<e.length;u++){let z=e[u];if(x){if(z===x)x=null}else if(z==='"'||z==="'")x=z;else if(z===">")break}if(u===e.length)break;let f=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:f,selfClosing:v}),r=u+1;let I=a[2].toLowerCase();if(!f&&I==="plaintext")break;let D=kc.get(I);if(!f&&(I==="script"||I==="style"||D)){let z=D??(I==="script"?ns:ss);z.lastIndex=r;let N=z.exec(e);if(!N)break;r=N.index}}return n}var es=/<script\b[^>]*>/iy,ns=/<\/script\s*>/ig,ts=/<style\b[^>]*>/iy,ss=/<\/style\s*>/ig;function xi(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 xi(e,n,es,ns)}function _n(e,n){return xi(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 bi(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 x=e[i];if(l){if(u){if(x===u)u=null}else if(x==='"'||x==="'")u=x;else if(x===">")l=!1;i++;continue}if(x!=="<"){let D=e.indexOf("<",i+1);if(D===-1)break;i=D;continue}let f=n(e,i);if(f>i){r.push({start:i,end:f,token:e.slice(i,f)}),i=f;continue}let v=bi(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 yi(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),x=u===-1?e.length:u;while(i<x){let D=e[i++];if(D==="{")n++;else if(D==="}")r++;if(n>=2&&r>=2)return!0}if(u===-1)break;let f=bi(e,u);if(f>u){i=f;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 nl(e,n){while(e.size>=n){let r=e.keys().next();if(r.done)return;e.delete(r.value)}}var Cc=1024,Rc=16777216,tn=new Map,Fs=0;function Ac(e,n){tn.set(e,n),Fs+=e.length+n.output.length;for(let[r,i]of tn){if(Fs<=Rc)break;tn.delete(r),Fs-=r.length+i.output.length}}function xe(e,n,r,i){let a=i!==void 0&&e.length>=Cc,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 x=u.map((I)=>I.token),f="",v=0;for(let I=0;I<u.length;I++){let D=u[I];f+=e.slice(v,D.start),f+=r(D.token,I),v=D.end}if(f+=e.slice(v),a)return Ac(l,{output:f,tokens:x}),{output:f,tokens:x.slice()};return{output:f,tokens:x}}var Tc=1024,Ic=16777216,nn=new Map,Vs=0;function Pc(e,n){nn.set(e,n),Vs+=e.length+n.output.length;for(let[r,i]of nn){if(Vs<=Ic)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>=Tc;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 Pc(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 Se(e){let n=Ie(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 ml(e){e[rs]=new Map}function Hs(e,n){let r=is(e);if(!r)return null;let i=Oc("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 hl(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((N)=>JSON.stringify(N).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),D=new RegExp(`window\\.__stxComponentFactories\\[(${I})\\]\\(("[^"]+")\\);`,"g"),z=D.exec(e);while(z!==null){let N=i.get(JSON.parse(z[1]));if(N!==void 0)a.push({start:z.index,end:z.index+z[0].length,replacement:ge(`(${N})(${z[2]});`)});z=D.exec(e)}}let l=[...r].filter(([,I])=>I.instances>1);if(l.length===0)return wi(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
- `),x=`<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>`,f,v=/<(?:template\b|script\b(?=[^>]*\bdata-stx-scoped\b))/iy;return w(e,(I,D)=>{if(f===void 0){if(v.lastIndex=D,v.test(I))f=D}return-1}),a.push({start:f??0,end:f??0,replacement:`${x}
216
- `}),wi(e,a)}function wi(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 Si(e){let n=is(e),r=new Map;if(n)for(let[i,a]of n)r.set(i,a.instances);return r}function vi(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 ki(e,n){for(let{body:r,count:i}of n)for(let a=0;a<i;a++)Hs(e,r)}function Ae(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 x=0;while(e[l+x]==="}")x++;if(x>=r)return l}}return-1}import Yi from"fs";var Wi=0,er=new Map;function _l(){Wi=0,er.clear()}function os(e,n){let r=Wi++,i=`<!--__STX_${e.toUpperCase()}_${r}__-->`;return er.set(i,{type:e,expression:n}),i}function Cl(){let e={};for(let[n,r]of er)e[n]={type:r.type,expression:r.expression};return e}function El(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 jc=/@(?=[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 Mc(e){return Array.from({length:e},()=>"&#123;").join("&#8288;")}function Vi(e){return e.replace(/\{{2,}/g,(n)=>Mc(n.length)).replace(/\{(?=!)/g,"&#123;&#8288;").replace(jc,"&#64;")}function Nr(e,n,r=!1){let{openTag:i,tail:a}=r?Dc(e,n):Nc(e).at(n);return zc(a,i,r)}function Dc(e,n){let r="",i=0;for(let u=0;u<n;u++){if(!e.startsWith("{{",u))continue;let x=Ae(e,u);if(x<0||x+2>n)break;r+=e.slice(i,u)+"x",u=x+1,i=x+2}r+=e.slice(i,n);let a=-1,l=null;for(let u=0;u<r.length;u++){let x=r[u];if(l){if(x===l)l=null;continue}if(x==='"'||x==="'"){l=x;continue}if(x===">"){a=-1;continue}if(x==="<")a=u}return{openTag:a,tail:a>=0?r.slice(a+1):r}}var as=null;function Nc(e){if(as&&as.source===e)return as.scanner;let n=Lc(e);return as={source:e,scanner:n},n}function Lc(e){let n=0,r=-1,i=null,a=-1,l=(x,f)=>{let v=e[x];if(f.quote){if(v===f.quote)f.quote=null;return}if(f.openTag>=0){if(v==='"'||v==="'"){f.quote=v;return}if(v===">"){f.openTag=-1;return}}if(v==="<")f.openTag=x},u=(x,f)=>{if(f.openTag>=0||!e.startsWith("<!--",x))return-1;let v=e.indexOf("-->",x+4);return v<0?e.length:v+3};return{at(x){if(x<n)n=0,r=-1,i=null,a=-1;let f={openTag:r,quote:i},v=!1;while(n<x){if(a<0&&e.startsWith("{{",n)){let W=Ae(e,n);if(W<0)a=n;else if(W+2<=x){n=W+2;continue}else break}let L=u(n,f);if(L>=0){if(L>x){v=!0;break}n=L;continue}l(n,f),n++}if(r=f.openTag,i=f.quote,v)return{openTag:-1,tail:""};let I=a>=0?a:n,D={openTag:r,quote:i};for(let L=n;L<x;L++){let W=u(L,D);if(W>=0){if(W>x)return{openTag:-1,tail:""};L=W-1;continue}l(L,D)}if(D.openTag<0)return{openTag:-1,tail:""};let z="",N=D.openTag+1;for(let L=N;L<Math.min(x,I);L++){if(!e.startsWith("{{",L))continue;let W=Ae(e,L);z+=e.slice(N,L)+"x",L=W+1,N=W+2}return z+=e.slice(N,x),{openTag:D.openTag,tail:z}}}}function zc(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 x=++i,f=e.indexOf(u,i);if(f===-1)return{kind:"attribute",name:l,quote:u,valuePrefix:e.slice(x)};i=f+1}else{let x=i;while(i<e.length&&!/\s/.test(e[i]))i++;if(i===e.length)return{kind:"attribute",name:l,quote:null,valuePrefix:e.slice(x)}}}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 qi="unsafe:";var Bc=/^(?:javascript|vbscript|livescript|mocha|view-source):/,Wc=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,Fc=/^data:(?:text\/html|application\/xhtml\+xml)/,Vc=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function Uc(e){return e.replace(Vc,"").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=Uc(e);if(Bc.test(r))return!0;return n==="navigable"?Wc.test(r):Fc.test(r)}function Or(e,n="navigable"){return cs(e,n)?"unsafe:"+e:e}function Hc(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 Zi(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 Ji(e,n,r=n){let i=Hc(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 Xi(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 Gi(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 Lt(e,n){let r=e.trim().replace(/^\.\.\./,"").trim(),i=Xi(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("...")){Lt(l,n);continue}let u=Xi(l,":");Lt(u===-1?l:l.slice(u+1),n)}return}if(r.startsWith("[")&&r.endsWith("]")){for(let a of ls(r.slice(1,-1)))Lt(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 f=n.slice(0,l).trim();if(f.startsWith("(")&&Gi(f)===f.length-1)f=f.slice(1,-1);for(let v of ls(f))Lt(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("(")&&Gi(l)===l.length-1)l=l.slice(1,-1);let u=/^([\w$]+)\s*=>\s*([\s\S]+)$/.exec(l);if(u)Lt(u[2],r),Lt(u[1],r);else for(let x of ls(l))Lt(x,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 x of u.match(/[a-zA-Z_$][\w$]*/g)||[])if(r.has(x))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 x=[...l.slice(9).matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g)].find((I)=>/^(?:#[\w-]+|v-slot:[\w-]+|data-stx-slot-binding)$/i.test(I[1])),f=(x?.[2]??x?.[3])?.trim();if(f&&x?.[1]==="data-stx-slot-binding")try{f=decodeURIComponent(f)}catch{f=void 0}let v=f?{start:a.index+l.length,end:e.length,binding:f}:void 0;if(r.push(v),v)n.push(v)}}return n}var yn={},lo=new Map;function Kc(e){let n=lo.get(e);if(!n){let r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");n=new RegExp(`:${r}(?!\\w)`,"g"),lo.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 f of l){if(u===void 0||u===null)break;u=u[f]}if(u===void 0||u===null)return a?e:"";let x=String(u);return Object.entries(r).forEach(([f,v])=>{x=x.replace(Kc(f),()=>String(v))}),x},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 Wg(e,n){if(e in io)console.warn(`Filter "${e}" already exists as a built-in filter. Custom filter will take precedence.`);yn[e]=n}function $y(e){for(let[n,r]of Object.entries(e))Wg(n,r)}function qg(){return{...io,...yn}}function Ry(){for(let e of Object.keys(yn))delete yn[e]}function yo(e){let n=e.next();while(!n.done)n=e.next();return n.value}function*_o(e,n,r,i){let a="{".repeat(r);if(!e.includes(a))return e;let l="",u=0,x=0,f=i===Number.POSITIVE_INFINITY?0:performance.now();for(;;){let v=e.indexOf(a,u);if(v===-1)break;let I=Ae(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,++x>=64){x=0;let D=performance.now();if(D-f>=i)f=D,yield}}return u===0?e:l+e.slice(u)}function Pn(e,n,r=2){return yo(_o(e,n,r,Number.POSITIVE_INFINITY))}function qc(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 Vi(g(e))}function Zc(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 Jc(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 Xc(e,n){let r=Jc(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("#"),x=/^data:image\/(?:avif|bmp|gif|jpeg|jpg|png|webp);base64,[a-z\d+/=]+$/i.test(l);if(!u&&!x)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 Gc(e,n,r,i,a)}catch(l){if(l instanceof me)l.locate(e,n);throw l}}function Gc(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 x=l.name.toLowerCase();if(/^on[a-z]/.test(x))throw new me(l.name,"native event-handler attributes execute JavaScript; use an @event binding instead");if(x==="srcdoc")u=Y(u);if(x==="style")Xc(r,l.name);if(l.quote===null)u=Zc(u);let f=tr(x);if(f&&l.valuePrefix.trim()===""&&cs(r,f))return qi+u;return Ji(Zi(e,n),r,u)}function In(e,n){let r=` ${e}="`;return ie(r,r.length,n,!0)}function wo(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 wo(r)){if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(i)||Sl.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 Kg(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 x=new RegExp(`<(/?)${a}\\b[^>]*?(/?)>`,"gi");x.lastIndex=u;let f=1,v=e.length;for(let I=x.exec(e);I;I=x.exec(e)){if(I[2]==="/")continue;if(f+=I[1]==="/"?-1:1,f===0){v=I.index+I[0].length;break}}n.push({start:i.index,end:v,names:l})}return n}function uo(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 po(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 x=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,f;while((f=x.exec(i))!==null){let v=f[1];if(!i.substring(0,f.index).trimEnd().endsWith(".")){if(!r.includes(v)&&!(v in n))return!1}}return!0}function Yc(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 Qc(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 ho=new Set;function xo(e){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(e.trim())}function $l(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 bo(e,n){let r=`${n??"<unknown>"}\x00${e}`;if(process.env.STX_DEBUG||!ho.has(r))ho.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 xo(l)?bo(l.trim(),r):a;return u===null?"":String(u)}catch{return a}}),i=Pn(i,(a,l,u)=>{let x=l.trim();if($l(i,u,l))return a;if(/^__[A-Z_]+__$/.test(x))return a;try{let f=O(l,n);if(f===void 0)return xo(x)?bo(x,r):a;return JSON.stringify(f).replace(/</g,"\\u003c").replace(/@/g,"\\u0040").replace(/\{{2,}/g,(v)=>"\\u007b".repeat(v.length)).replace(/\{(?=!)/g,"\\u007b")}catch{return a}}),i}function Gg(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 x=O(a,n);if(x===void 0)return i;if(x===null)return"";let f=String(x);return ie(r,l,f,!0,i.length)}catch(x){if(x instanceof me)throw x;return i}}),r}function Ay(e,n,r={}){let{output:i,scripts:a}=re(e),l=a.map((u)=>{let x=u.match(/^<script\b((?:[^>\"']|\"[^\"]*\"|'[^']*')*)>/i),f=u.search(/<\/script\s*>$/i);if(!x||f===-1)return u;let v=x[1],I=u.slice(x[0].length,f);if(/\bdata-raw\b/.test(v))return u;if(r.skipServer&&/\bserver\b/.test(v))return u;let z=`<script${Gg(v,n)}>`;if(/\bsrc\s*=/.test(v)||/\btype\s*=\s*["']application\/json["']/.test(v))return z+I+u.slice(f);return z+zi(I,n)+u.slice(f)});return Ir(i,l)}function*So(e,n,r,i){let a=e,l=(W,V)=>{let G=_n(W,V);if(G===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(W.slice(V,G))?-1:G},u=(W,V,G,U)=>{let H=G.length,{output:Z,tokens:ne}=xe(W,V,(ae,fe)=>U(H+fe));return G.push(...ne),Z},x=[];a=u(a,l,x,(W)=>`<!--__STX_STYLE_${W}__-->`);let f=[];a=u(a,Q,f,(W)=>`<!--__STX_SCRIPT_EXPR_${W}__-->`);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(wo(f))]),D=new Set(Array.isArray(n?.__stx_preserved_client_expressions)?n.__stx_preserved_client_expressions:[]);a=Pn(a,(W,V,G)=>{if(B(V,I))return W;try{let U=O(V,n,!1,(H)=>nr(H,W,r,e));return U!==void 0&&U!==null?String(U):""}catch(U){let H=U instanceof Error?U.message:String(U);return y("Expression",`Error evaluating: {{{ ${V.trim()}}}}: ${H}`,r,e,G,W)}},3),a=a.replace(/\{!!([\s\S]*?)!!\}/g,(W,V,G)=>{if(B(V,I))return W;try{let U=O(V,n,!1,(H)=>nr(H,W,r,e));if(U===void 0&&n.__stx_buildMode==="compile")return os("raw",V.trim());return U!==void 0&&U!==null?String(U):""}catch(U){if(n.__stx_buildMode==="compile")return os("raw",V.trim());let H=U instanceof Error?U.message:String(U);return y("Expression",`Error evaluating: {!! ${V.trim()} !!}: ${H}`,r,e,G,W)}}),a=u(a,Q,f,(W)=>`<!--__STX_SCRIPT_EXPR_${W}__-->`),a=u(a,l,x,(W)=>`<!--__STX_STYLE_${W}__-->`);let z=v?Kg(a):[],N=ps(a).map((W)=>({...W,names:new Set(se(`${W.binding} in __slot`))})),L=new Set(gt(n));if(a=yield*_o(a,(W,V,G)=>{let U=V.trim();if(qc(a,G,V))return W;if(uo(N,G,U))return W;if(B(U,L))return W;if(z.length>0&&uo(z,G,U))return W;if(D.has(U))return W;let H=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],Z=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,ae=U.match(Z)?.[1],fe=ae&&((ae in n)||H.includes(ae)),pe=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,Ce=U.match(pe),Re=Ce&&!H.includes(Ce[1])&&!(Ce[1]in n);if(/^__[A-Z_]+__$/.test(U))return"";if(B(U,I))return W;if(n.__stx_native_screen===!0&&Yc(U,n))return W;let Ee;try{let ye=O(V,n,!1,(tt)=>{Ee=tt});if(v&&!po(U,n))return W;if(Ee)nr(Ee,W,r,e);if(n.__stx_buildMode==="compile"&&!v&&(ye===void 0||Qc(U,n)))return os("expr",U);if(ye===void 0||ye===null)return"";let He=String(ye);return ie(a,G,He,!1,W.length)}catch(ye){if(ye instanceof me)throw ye;if(v&&!po(U,n))return W;if(Re)return W;let He=ye instanceof Error?ye.message:String(ye);return y("Expression",`Error evaluating: {{ ${U} }}: ${He}`,r,e,G,W)}},2,i),f.length>0)a=a.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(W,V)=>f[Number(V)]??W);if(x.length>0)a=a.replace(/<!--__STX_STYLE_(\d+)__-->/g,(W,V)=>x[Number(V)]??W);return a}function P(e,n,r){return yo(So(e,n,r,Number.POSITIVE_INFINITY))}var Rl=100;async function Hi(e,n,r,i=Rl){let a=So(e,n,r,i),l=a.next();while(!l.done)await R(),l=a.next();return l.value}function Xg(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 x=yn[u]||io[u];if(!x)throw Error(`Filter not found: ${u}. Available filters: ${Object.keys(qg()).join(", ")}`);let f=[];if(a.startsWith(":")){let v=a.match(/^:([^|\s]+)/);if(v){let I=v[1].trim();try{let D=Number(I);f=[Number.isNaN(D)?I:D]}catch{f=[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("}"))f=[O(`(${D})`,r,!0)];else{let z=[],N="",L=null,W=0,V=0,G=0,U=!1;for(let H=0;H<D.length;H++){let Z=D[H];if(U){N+=Z,U=!1;continue}if(Z==="\\"){N+=Z,U=!0;continue}if(L){if(N+=Z,Z===L)L=null;continue}if(Z==='"'||Z==="'"||Z==="`"){L=Z,N+=Z;continue}if(Z==="(")W++;else if(Z===")")W--;else if(Z==="[")V++;else if(Z==="]")V--;else if(Z==="{")G++;else if(Z==="}")G--;if(Z===","&&W===0&&V===0&&G===0){z.push(N),N="";continue}N+=Z}if(N)z.push(N);f=z.map((H)=>{let Z=H.trim();return O(Z,r,!0)})}}catch{f=[D]}a=a.substring(I).trim()}}try{i=x(i,r,...f)}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 Al(e){let n=!1,r="",i=0,a=0,l=0,u=!1;for(let x=0;x<e.length;x++){let f=e[x],v=e[x+1];if(n&&u){u=!1;continue}if(n&&f==="\\"){u=!0;continue}if(u=!1,(f==='"'||f==="'"||f==="`")&&!u){if(!n)n=!0,r=f;else if(f===r)n=!1,r="";continue}if(n&&r==="`"&&f==="$"&&v==="{"){let I=1;x+=2;while(x<e.length&&I>0){if(e[x]==="{")I++;else if(e[x]==="}")I--;if(I>0)x++}continue}if(n)continue;if(f==="(")i++;else if(f===")")i--;else if(f==="[")a++;else if(f==="]")a--;else if(f==="{")l++;else if(f==="}")l--;if(f==="|"&&i===0&&a===0&&l===0){if(v==="|"){x++;continue}if(v==="="){x++;continue}return x}}return-1}var bn=new Set,Tl=1000;function Py(){bn.clear()}function nr(e,n,r,i){if(!te())return;let a=`${r}\x00${e.expression}`;if(bn.has(a))return;if(bn.size>=Tl)bn.clear();bn.add(a);let l=r,u=i;try{if(r&&Yi.existsSync(r))u=Yi.readFileSync(r,"utf8")}catch{}let x=u.indexOf(n);if(x>=0)l=`${r}:${u.slice(0,x).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=Al(a);if(l>0){let x=a.substring(0,l).trim(),f=a.substring(l+1).trim(),v=O(x,n,!0,i);return Xg(v,f,n)}let u=co(a);if(u!==null){i?.({expression:a,rule:u});return}try{let x=Object.keys(n),f=Object.values(n);return p(a,x)(...f)}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],x=Il(u,Object.keys(n));if(x&&x!==u)a.message=`${a.message} \u2014 did you mean '${x}'?`}}if(!r)console.error(`Error evaluating expression: ${e}`,a);throw a}}function Il(e,n){let r=null;for(let a of n){if(a===e)continue;let l=Pl(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 Pl(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 x=1;x<=r.length;x++){let f=r[x-1]===i[u-1]?0:1;l[x]=Math.min(l[x-1]+1,a[x]+1,a[x-1]+f)}for(let x=0;x<=r.length;x++)a[x]=l[x]}return a[r.length]}function Iy(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 Ol from"process";function A(e="STX_PUBLIC_"){let n={},r={};for(let[i,a]of Object.entries(Ol.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 vo(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 $o(e,n,r={}){let{prefix:i="",preserveHost:a=!0,scopeKeyframes:l=!0,scopeCustomProperties:u=!1}=r;if(!e.trim())return"";let x=sr(e),f=[],v=new Map;if(l)for(let I of x){let D=I.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(D){let z=D[1],N=`${n}_${z}`;v.set(z,N)}}for(let I of x){let D=Eo(I,n,i,a,v,u);f.push(D)}return f.join(`
219
-
220
- `)}function sr(e){let n=[],r=e.replace(/\/\*[\s\S]*?\*\//g,""),i=0,a="",l=!1,u="";for(let x=0;x<r.length;x++){let f=r[x];if(f==="@"&&i===0)l=!0;if(f==="{")i++;else if(f==="}"){if(i--,i===0){if(l){u+=f;let v=u.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(v){let[,I,D,z]=v;if(I==="keyframes")n.push({selector:`@keyframes ${D.trim()}`,declarations:z.trim()});else if(I==="media"||I==="supports"||I==="container"){let N=sr(z);n.push({selector:`@${I} ${D.trim()}`,declarations:N.map((L)=>`${L.selector} { ${L.declarations} }`).join(`
221
- `)})}else n.push({selector:`@${I} ${D.trim()}`,declarations:z.trim()})}u="",l=!1}else if(a.trim()){a+=f;let v=a.match(/([^{]+)\{([^}]*)\}/);if(v)n.push({selector:v[1].trim(),declarations:v[2].trim()});a=""}continue}}if(l)u+=f;else a+=f}return n}function Eo(e,n,r,i,a,l){let{selector:u,declarations:x}=e;if(u.startsWith("@")){if(u.startsWith("@keyframes")){let I=u.replace("@keyframes ","").trim();return`@keyframes ${a.get(I)||I} { ${x} }`}if(u.startsWith("@media")||u.startsWith("@supports")||u.startsWith("@container")){let D=sr(`x { ${x} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((z)=>Eo(z,n,r,i,a,l)).join(`
222
- `);return`${u} {
223
- ${D}
224
- }`}return`${u} { ${x} }`}let f=Dl(u,n,r,i),v=x;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`${f} { ${v} }`}function Dl(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 x=r?`${r} .${n}`:`.${n}`;l.push(`${x} ${u}`);let f=Nl(u,n);if(f)l.push(r?`${r} ${f}`:f)}return l.join(", ")}function Nl(e,n){let r=0,i=e.length;for(let f=0;f<e.length;f++){let v=e[f];if(v==="["||v==="(")r++;else if(v==="]"||v===")")r--;else if(r===0&&(v===" "||v===">"||v==="+"||v==="~")){i=f;break}}let a=e.slice(0,i),l=e.slice(i);if(!a)return"";let u=a.length,x=0;for(let f=0;f<a.length;f++){let v=a[f];if(v==="["||v==="(")x++;else if(v==="]"||v===")")x--;else if(r===0&&x===0&&v===":"){u=f;break}}return`${a.slice(0,u)}.${n}${a.slice(u)}${l}`}var Ro=String.raw`(?<![\w-])scoped(?![\w-])`,rr=/<style\s+([^>]*)>/gi,ko=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,Ao=new RegExp(Ro,"i"),Ll=new RegExp(Ro,"gi"),ir=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function zl(e){rr.lastIndex=0;let n=rr.exec(e);while(n!==null){if(Ao.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(!zl(e))return{html:e,hasScoped:!1};let r=vo(n),i=`data-v-${r}`,a=e,l=!1;if(ko.lastIndex=0,a=a.replace(ko,(u,x,f)=>{if(!Ao.test(x))return u;l=!0;let v=Wl(f,i),I=x.replace(Ll,"").trim(),D=I?` ${I}`:"";return`<style data-stx-scoped="${r}"${D}>${v}</style>`}),!l)return{html:e,hasScoped:!1};return a=Vl(a,i),{html:a,hasScoped:!0}}function Wl(e,n){return $o(e,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${n}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${n}]`)}var Fl=(e)=>`\x00stx-scope-mask-${e}\x00`,Co=/\u0000stx-scope-mask-(\d+)\u0000/g;function Vl(e,n){let r=xe(e,(a,l)=>{let u=Q(a,l);return u>l?u:_n(a,l)},(a,l)=>Fl(l)),i=Ul(r.output,n);return Co.lastIndex=0,i.replace(Co,(a,l)=>r.tokens[Number(l)])}function Ul(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 wn=/<\/?template\b[^>]*>/gi,Hl=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function Kl(e){let n=e.replace(/^<template\b/i,"").replace(/>$/,"");return Hl.test(n)}function j(e){wn.lastIndex=0;let n;while((n=wn.exec(e))!==null){if(n[0].startsWith("</")||Kl(n[0]))continue;let r=n.index,i=wn.lastIndex,a=1,l;while((l=wn.exec(e))!==null)if(l[0].startsWith("</")){if(a--,a===0){let u=l.index;return{start:r,openEnd:i,closeStart:u,end:wn.lastIndex,content:e.slice(i,u)}}}else a++;return null}return null}var ql=0,Zl=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 Io(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 Jl(e){let n=[];for(let{fullMatch:r,tagName:i,attributes:a,startIndex:l}of Io(e)){let u=fs(a,"x-data");if(!u)continue;let x=`__stx_scope_${ql++}`,f=fs(a,"x-init"),v=Xl(e,i,l+r.length),I=e.slice(l,v.endIndex),D=Gl(I);n.push({id:x,selector:`[data-stx-scope="${x}"]`,stateExpr:u,initExpr:f,bindings:[],refs:D})}return n}function Xl(e,n,r){let i=1,a=r,l=new RegExp(`<${n}(?:\\s|>)`,"gi"),u=new RegExp(`</${n}>`,"gi"),x=new RegExp(`<${n}[^>]*/\\s*>`,"gi");while(i>0&&a<e.length){l.lastIndex=a,u.lastIndex=a,x.lastIndex=a;let f=l.exec(e),v=u.exec(e),I=x.exec(e);if(I&&I.index<(f?.index??1/0)){a=I.index+I[0].length;continue}if(!v)return{endIndex:e.length};if(f&&f.index<v.index)i++,a=f.index+f[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 Gl(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,x=Yl(l);n.set(u,x)}return n}function Yl(e){let n=e.match(/\bid\s*=\s*["']([^"']*)["']/);if(n)return n[1];return`__stx_el_${Zl++}`}function Ql(){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 To(e,n){let r=e.replace(/\{!!([\s\S]*?)!!\}/g,(x,f)=>{try{let v=O(f,n,!0);if(v===void 0)return x;return String(v)}catch{return x}}),i="",a=0,l=null;while(a<r.length){let x=r[a];if(l&&x==="\\"){i+=x+(r[a+1]??""),a+=2;continue}if(x==="{"&&r[a+1]==="{"){let f=r.indexOf("}}",a+2);if(f!==-1){let v=r.slice(a,f+2);i+=u(r.slice(a+2,f),v,l),a=f+2;continue}}if(l){if(x===l)l=null}else if(x==="'"||x==='"'||x==="`")l=x;i+=x,a++}return i;function u(x,f,v){let I;try{I=O(x,n,!0)}catch{return f}if(I===void 0)return f;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 eu(e,n,r){if(e.length===0)return"";let i=e.map((a)=>{let l=JSON.stringify(Object.fromEntries(a.refs)),u=To(a.stateExpr,n),x=a.initExpr?To(a.initExpr,n):null,f=JSON.stringify(u),v=x?JSON.stringify(x):"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, ${f}, [], refs, ${v}${r?", true":""});
502
- })();`}).join(`
503
- `);return`
504
- <script data-stx-scoped data-stx-reactive data-stx-run="always">
505
- ${Ql()}
506
- ${i}
507
- </script>`}function dl(e,n,r,i=!1){if(!or(e))return e;let a=Jl(e);if(a.length===0)return e;let l=tu(e,a),u=eu(a,n,i),x=c(l);if(x!==-1)l=l.slice(0,x)+u+`
508
- `+l.slice(x);else l+=u;return l}function tu(e,n){let r=[],i=0;for(let[l,u]of Io(e).entries()){let x=n[l];if(!x)break;r.push(e.slice(i,u.startIndex));let f=fs(u.attributes,"data-stx-scope");if(f)x.id=f,x.selector=`[data-stx-scope="${x.id}"]`,r.push(u.fullMatch);else r.push(`<${u.tagName} data-stx-scope="${x.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,x=1,f=u+1,v=null,I=!1;while(f<r.length&&x>0){let H=r[f];if(I){I=!1,f++;continue}if(H==="\\"&&v){I=!0,f++;continue}if(v){if(H===v)v=null;f++;continue}if(H==='"'||H==="'"||H==="`"){v=H,f++;continue}if(H==="(")x++;else if(H===")"){if(x--,x===0)break}f++}if(x!==0)break;let D=r.substring(u+1,f).trim(),z=r.substring(l,f+1),N=-1,L=0,W=null,V=!1;for(let H=0;H<D.length;H++){let Z=D[H];if(V){V=!1;continue}if(Z==="\\"&&W){V=!0;continue}if(W){if(Z===W)W=null;continue}if(Z==='"'||Z==="'"||Z==="`"){W=Z;continue}if(Z==="("||Z==="["||Z==="{")L++;else if(Z===")"||Z==="]"||Z==="}")L--;if(Z===","&&L===0){N=H;break}}let G=N>=0?D.substring(0,N).trim():D,U=N>=0?D.substring(N+1).trim():void 0;try{let H=G.trim(),Z;if(m(H))Z=p(H,Object.keys(n))(...Object.values(n));else Z=void 0;let ne;if(U==="true")ne=JSON.stringify(Z,null,2);else ne=JSON.stringify(Z);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(f+1),i.lastIndex=l+ae.length}catch(H){K.log(H instanceof Error?H:Error(String(H)),{directive:"@json"},"error"),i.lastIndex=l+z.length}}return r}function so(e){return e.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function pl(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,x=1,f=u;while(f<n.length&&x>0){if(n[f]==="(")x++;else if(n[f]===")")x--;f++}if(x!==0)continue;let v=n.slice(u,f-1).trim(),I=f,D=n.slice(I),z=D.indexOf("@endmemo");if(z===-1)continue;let N=D.slice(0,z),L=I+z+8,W=Ht(N),V=N.slice(W),G=N.match(/(\s*)$/),U=G?G[0].length:0,H=V.slice(0,V.length-U),Z=H.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),ne;if(Z){let[ae,fe,pe="",Ce]=Z,Re=`<${fe}${pe} data-stx-memo="${v}"${Ce}>`;ne=N.slice(0,W)+Re+H.slice(ae.length)+N.slice(W+H.length)}else ne=`${N.slice(0,W)}<div data-stx-memo="${v}">${H}</div>${N.slice(W+H.length)}`;a.push({start:l,end:L,replacement:ne}),r.lastIndex=L}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 Mo(e,n){let r=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,i=w(e,(x,f)=>{r.lastIndex=f;let v=r.exec(x);if(!v||/^(?:script|style)$/i.test(v[1]))return-1;return r.lastIndex}),a=[],l=0,u=[];for(let{start:x,end:f,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,x),v.replace(/\s*\/?>$/,(D)=>` data-stx-slot-owner="${n}"${D}`)),l=f;if(!ar.has(I)&&!/\/>$/.test(v))a.push(I)}return u.push(e.slice(l)),u.join("")}function Do(e,n){if(!/\bref\s*=/.test(e))return e;let r=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,i=w(e,(f,v)=>{r.lastIndex=v;let I=r.exec(f);if(!I||/^(?:script|style)$/i.test(I[1]))return-1;return r.lastIndex}),a=[],l=0,u=0,x=[];for(let{start:f,end:v,token:I}of i){let D=/^<\/?([\w-]+)/.exec(I)[1].toLowerCase();if(I.startsWith("</")){let W;while(W=a.pop()){if(W.scoped)l--;if(W.name===D)break}continue}let z=/\sdata-stx-scope\s*=/.test(I),N=/\sdata-stx-ref-caller\s*=\s*(["'])(.*?)\1/.exec(I),L=a.find((W)=>W.scoped)?.scopeId;if(N&&L&&N[2]===L)x.push(e.slice(u,f),I.replace(N[0],` data-stx-ref-caller="${n}"`)),u=v;else if(!l&&!z&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(I)&&!/\sdata-stx-ref-caller\s*=/.test(I))x.push(e.slice(u,f),I.replace(/\s*\/?>$/,(W)=>` data-stx-ref-caller="${n}"${W}`)),u=v;if(!ar.has(D)&&!/\/>$/.test(I)){let W=/\sdata-stx-scope\s*=\s*(?:"([^"]*)"|'([^']*)')/.exec(I);if(a.push({name:D,scoped:z,scopeId:W?.[1]??W?.[2]}),z)l++}}return x.push(e.slice(u)),x.join("")}var ar=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),No=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,Po=/<\/?\s*([a-z][\w-]*)/iy,nu=/\s/;function su(e,n){let r=n-1;while(r>=0&&nu.test(e[r]))r--;return r>=0&&e[r]==="/"}function ru(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 iu(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 x=e.indexOf("<",i),f=x===-1?e.length:x;if(f>i){if(r===0)while(i<f){let D=e.indexOf(l?"}":"{",i);if(D===-1||D>=f){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=f;continue}if(e.startsWith("<!--",i)){let D=e.indexOf("-->",i);i=D===-1?e.length:D+3;continue}let v=ru(e,i);if(v===-1)break;Po.lastIndex=i;let I=Po.exec(e)?.[1]?.toLowerCase()??"";if(e[i+1]==="/"){if(r===0)break;r--}else if(!su(e,v)&&!ar.has(I))r++;i=v+1}return!1}var Oo=S(256);function fl(e){if(e.length<1024)return jo(e);let n=C(e),r=Oo.get(n);if(r!==void 0)return r;let i=jo(e);return Oo.set(n,i),i}function jo(e){if(e.length>=32768&&!yi(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,x=u+l[0].length,f=!1,v=!1,I=-1;while(x<e.length){let z=e[x];if(f){if(z==="'")f=!1}else if(v){if(z==='"')v=!1}else if(z==="'")f=!0;else if(z==='"')v=!0;else if(z===">"){I=x;break}x++}if(I===-1)continue;let D=e.slice(u,I+1);if(No.test(D))continue;if(D.includes("x-cloak"))continue;if(iu(e,I+1))i+=e.slice(a,I)+" x-cloak>",a=I+1}return i+=e.slice(a),i}var ou=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,au=/<\/script>/gi,cu=/<\/style>/gi;function gl(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 L=u==="script"?au:cu;L.lastIndex=l;let W=L.exec(e);if(W!==null)n.lastIndex=W.index+W[0].length;continue}let x=l+a[0].length,f=!1,v=!1,I=-1;while(x<e.length){let L=e[x];if(f){if(L==="'")f=!1}else if(v){if(L==='"')v=!1}else if(L==="'")f=!0;else if(L==='"')v=!0;else if(L===">"){I=x;break}x++}if(I===-1)continue;let D=e.slice(l+a[0].length,I);if(No.test(D))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(D))continue;if(!ou.test(D))continue;let z=e[I-1]==="/",N=z?I-1:I;r+=`${e.slice(i,N)} x-cloak${z?" ":""}`,i=N}return r+=e.slice(i),r}function q(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 Pt(e){let n=e.get("type");return typeof n!=="string"||!n.trim()||/^(?:module|(?:text|application)\/(?:javascript|typescript|ecmascript))$/i.test(n.trim())}import ca from"path";import lr from"fs";import Sn from"path";function Lo(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 lu(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 f=Lo(r,l,"<",">");if(f<0)continue;u=e.slice(l+1,f),l=f+1;while(/\s/.test(r[l]||"")&&l<r.length)l++}if(r[l]!=="(")continue;let x=Lo(r,l,"(",")");if(x>=0)return{type:u,args:lu(e.slice(l+1,x))}}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,(z,N,L,W,V)=>{if(a.slice(V,V+6)!=="import")return z;if(W.endsWith(".stx"))return"";let G=`${n}Import${r.length}`;if(r.push(`import * as ${G} from ${JSON.stringify(W)};`),N.startsWith("*"))return`import ${N.replace(/^\*\s+as\s+/,"")} = ${G};`;if(!N.startsWith("{"))return`import ${N} = ${G}.default;`;return N.slice(1,-1).split(",").map((U)=>{let[H,Z=H]=U.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(!H)return"";if(/^(?:stx|@stacksjs\/stx)(?:\/|$)/.test(W)&&H in i)i[H].push(Z);return`import ${Z} = ${G}.${H};`}).join(`
517
- `)}),u=cr(e,i.defineProps),x=cr(e,i.defineEmits),f=cr(e,i.withDefaults);if(!u&&!x)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 = (${f?.args[1]||"{}"});`);let z=u.type||"__StxOptions<typeof __options>";v.push(`export type __StxProps = __StxDefaults<${z}, keyof typeof __defaults | __StxDefaulted<typeof __options>>;`),I=`${n}.__StxProps`}if(x)v.push(`const __events = (${x.args[0]||"[]"}) as const;`),v.push(`export type __StxEvents = ${x.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*uu(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 x=e[i],f=x==="{",v=x==='"'||x==="'";if(v||f)i++;let I=i;if(f){let D=t(e.slice(i)),z=1,N=0;for(;N<D.length;N++){if(D[N]==="{")z++;if(D[N]==="}"&&--z===0)break}i+=N}else if(v)while(i<e.length&&e[i]!==x)i++;else while(i<e.length&&!/[\s/>]/.test(e[i]))i++;if(a.push({name:l,value:e.slice(I,i),offset:I,braced:f}),v||f)i++}n.lastIndex=i,yield{name:r[1],offset:r.index,attributes:a}}}function zo(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,x=new Map,f=r.scriptCode(e,r.filePath),v=t(f);for(let L of f.matchAll(/\bimport\s+(\{[^}]+\}|[\w$]+)\s+from\s*['"]([^'"]+)['"]/g)){if(v.slice(L.index,L.index+6)!=="import")continue;let W=L[2],V=Sn.isAbsolute(W)||W.startsWith(".")?Sn.resolve(Sn.dirname(r.filePath),W):Ks(W,Sn.dirname(r.filePath));if(!V)continue;let G=V.endsWith(".stx")?V:lr.existsSync(`${V}.stx`)?`${V}.stx`:void 0,U=G?null:Ar(V,!1),H=L[1].startsWith("{")?L[1].slice(1,-1).split(","):[L[1]];for(let Z of H){let[ne,ae=ne]=Z.trim().split(/\s+as\s+/),fe=G||U?.get(ne)||U?.get(ne.toLowerCase());if(fe)x.set(ae,fe),x.set(ae.toLowerCase(),fe),x.set(ae.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),fe)}}for(let L of n.matchAll(/@import\s*\(([^)]+)\)/g))for(let W of L[1].matchAll(/['"]([^'"]+)['"]/g)){let V=Gs(W[1],r.filePath,r).find((G)=>lr.statSync(G,{throwIfNoEntry:!1})?.isFile());if(V)x.set(Sn.basename(W[1]).replace(/\.stx$/,""),V)}let I={__importedComponents:x},D=new Map,z=(L,W,V)=>{let G=e.slice(0,L);return{code:W,offset:L,attribute:V,anchor:!0,kind:"directive",line:G.split(`
524
- `).length,column:L-G.lastIndexOf(`
525
- `)}},N=(L,W,V)=>i.push({expression:L,statement:{text:W+L.code+V,prefixLength:W.length}});for(let L of uu(n)){if(Dr(L.name)||L.name==="component")continue;let W=ti(L.name,r.filePath,r,I);if(!W)continue;let V=D.get(W);if(!V){let U;try{U=r.readComponent?r.readComponent(W):lr.readFileSync(W,"utf8")}catch{continue}if(U===void 0)continue;u.set(W,U),V=gs(r.scriptCode(U,W),`__StxComponent${D.size}`),D.set(W,V),a.push(V.declarations)}let G=[];for(let U of L.attributes){let{name:H,offset:Z}=U,ne=U.value===!0?"true":U.value;if(H.startsWith("@")||H.startsWith("v-on:")){if(V.events&&U.value!==!0)l.set(Z,`__StxEvent<${V.events}, ${JSON.stringify(H.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let ae=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(H);if(H.startsWith("v-")&&!H.startsWith("v-bind:")&&!ae)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(H))continue;let fe=(ae?ae[1]||"modelValue":H.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(Ee,ye)=>ye.toUpperCase());if(G.push(fe),!V.props)continue;let pe=H.startsWith(":")||H.startsWith("v-bind:")||!!ae||U.braced,Ce=pe?ne:U.value!==!0?JSON.stringify(ne):"true",Re=!pe&&U.value!==!0&&(ne==="true"||ne==="false");N(z(Z,Ce,H),";void ((",`) satisfies ${Re?"__StxStaticProp":"__StxProp"}<${V.props}, ${JSON.stringify(fe)}>);`)}if(V.props){let U=[...new Set(G)].map((Z)=>`${JSON.stringify(Z)}: undefined as any`).join(", "),H=z(L.offset,`<${L.name}>`);i.push({expression:H,statement:{text:`;void ({ ${U} } satisfies ${V.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:D.size?a.join(`
526
- `):"",checks:i,events:l,dependencies:u}}import Xo 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 Bo,readFile as pu,readdir as fu,realpath as du,stat as Wo,writeFile as gu}from"fs/promises";import st from"path";import{builtinModules as mu}from"module";function qo(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 Zo=new Set(["constructor","connectedCallback","disconnectedCallback","attributeChangedCallback","adoptedCallback"]),hu=new Set(mu);function xu(e){return e.replace(/\.stx$/i,"").split(/[^a-z0-9]+/i).filter(Boolean).map((n)=>n.charAt(0).toUpperCase()+n.slice(1)).join("")}function fr(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[^a-z0-9]+/gi,"-").replace(/^-+|-+$/g,"").toLowerCase()}function bu(e){return/^[a-z][.0-9_a-z-]*-[.0-9_a-z-]*$/.test(e)&&!e.startsWith("xml")&&!/[A-Z]/.test(e)}function yu(e){if(e===!0)return"open";if(e==="open"||e==="closed")return e;return!1}async function _u(e){let n=[];async function r(i){let a=await fu(i,{withFileTypes:!0});a.sort((l,u)=>l.name.localeCompare(u.name));for(let l of a){let u=st.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 sn(e){return e.replace(/<!--[\s\S]*?-->|\{\{--[\s\S]*?--\}\}/g,(n)=>n.replace(/[^\n]/g," "))}function dr(e){for(let n of Se(sn(e))){let r=q(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 gr(e,n){let r=dr(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(Qi(e).map((f)=>f.start)),a=/(?:export\s+)?(?:async\s+)?function\s+([A-Za-z_$][\w$]*)/g,l=[],u=n?void 0:new Bun.Transpiler({loader:"ts"}),x;while(x=a.exec(r)){if(!i.has(x.index+x[0].indexOf("function")))continue;let f=a.lastIndex;while(/\s/.test(r[f]||""))f++;let v=f;if(r[f]==="<")f=Ot(r,f,"<",">");if(f<0)continue;let I=e.slice(v,f).trim();while(/\s/.test(r[f]||""))f++;if(r[f]!=="(")continue;let D=f,z=Ot(r,f,"(",")");if(z<0)continue;for(f=z;f<e.length;f++){let N=r[f];if(N!=="{"&&N!==";")continue;let L=e.slice(x.index,f).trim();if(n){if(!n(L,N,x[1]))continue}else{let V;try{V=u.transformSync(L+(N==="{"?"{}":";"))}catch{continue}if(N==="{"&&!V.includes(`function ${x[1]}(`))continue;if(N===";"&&V.trim())continue}let W=N==="{"?Ot(r,f,"{","}"):f+1;if(W<0)break;l.push({name:x[1],header:L,generic:I,parameterOffset:D+1,parameters:e.slice(D+1,z-1),returns:e.slice(z,f).trim().replace(/^:\s*/,""),async:/\basync\s+function/.test(x[0]),...N==="{"?{source:e.slice(x.index,W)}:{}}),a.lastIndex=W;break}}return l}function wu(e){let n=vn(e.parameters,",",!0).flatMap((r,i)=>{let a=t(r),l=0,u=-1;for(let W=0;W<a.length;W++){let V=a[W];if("([{<".includes(V))l++;else if(")]}>".includes(V)&&!(V===">"&&a[W-1]==="="))l--;if(V==="="&&l===0&&a[W+1]!==">"){u=W;break}}let x=(u<0?r:r.slice(0,u)).trim(),f=vn(x,":",!0),v=f.shift().trim();if(v==="this")return[];let I=/^[A-Za-z_$]|^\.\.\./.test(v)?v:`argument${i}`,D=u<0?"":r.slice(u+1).trim(),z=D==="true"||D==="false"?"boolean":/^-?\d+(?:\.\d+)?$/.test(D)?"number":/^['"`]/.test(D)?"string":I.startsWith("...")?"unknown[]":"unknown",N=f.join(":").trim()||z,L=u>=0&&!I.endsWith("?")&&!I.startsWith("...")?"?":"";return[`${I}${L}: ${N}`]}).join(", ");return`${e.name}${e.generic}(${n}): ${e.returns||(e.async?"Promise<unknown>":"unknown")}`}function Su(e,n){let r={},i={},a=[],l=[],u=Se(sn(e));for(let I of u){let D=e.slice(I.bodyStart,I.bodyEnd),z=q(I.attrs);if(z.has("src")||z.has("server")||z.has("component")||z.has("stx:component")||!Pt(z))continue;try{new Bun.Transpiler({loader:"ts"}).transformSync(D)}catch(H){throw Error(`${n}: failed to transpile <script client> (${H.message})`)}let N=z.has("client")?ms(D):[],L=new Set(N.filter((H)=>!H.source).map((H)=>H.name));for(let H of N){if(Zo.has(H.name))throw Error(`${n}: client ${qo(H.name)}`);if(H.source)r[H.name]=new Bun.Transpiler({loader:"ts"}).transformSync(H.source).trim().replace(/^(?:export\s+)?(async\s+)?function\s+/,"$1");if(!H.source||!L.has(H.name))(i[H.name]??=[]).push(wu(H))}for(let H of D.matchAll(/^\s*import\s+(?:type\s+)?([\s\S]*?)\s+from\s*(['"])([^'"]+)\2\s*;?/gm))l.push({binding:H[1].trim(),module:H[3]});let W=t(D),V=E(W).depths,G=/(?:export\s+)?(interface|type)\s+[A-Za-z_$][\w$]*/g,U;while(U=G.exec(W)){if(V[U.index]!==0)continue;let H=G.lastIndex,Z=0;for(;H<W.length;H++){let ne=W[H];if(ne==="{"){let ae=Ot(W,H,"{","}");if(ae<0)break;if(H=ae-1,U[1]==="interface"&&Z===0){H++;break}continue}if("([<".includes(ne))Z++;else if(")]>".includes(ne)&&!(ne===">"&&W[H-1]==="="))Z--;if(U[1]==="type"&&Z===0&&(ne===";"||ne===`
527
- `)){if(ne===`
528
- `&&/^[\s]*[|&]/.test(W.slice(H+1)))continue;try{new Bun.Transpiler({loader:"ts"}).transformSync(D.slice(U.index,H));break}catch{}}}a.push(D.slice(U.index,H).replace(/^export\s+/,"").trim()),G.lastIndex=H+1}}let x=Object.values(i).flat().join(`
529
- `)+`
530
- `+a.join(`
531
- `),f=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(x)));for(let I of f)if(I.module.startsWith(".")||st.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(f.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 vu(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 Fo(e){return[...e.matchAll(/<style\b[^>]*>([\s\S]*?)<\/style>/gi)].map((n)=>n[1].replace(/\r\n?/g,`
534
- `).replaceAll("\x00","\uFFFD").trim()).filter(Boolean).join(`
535
-
536
- `)}function $u(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 Eu(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 ku(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 mr(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 Cu(e){let n=[],r=0,i=e.replace(/\{\{--[\s\S]*?--\}\}/g,""),a=/@(if|elseif|else|endif|foreach|endforeach)\s*/g,l,u=(x)=>{if(x==="")return;let f=0,v=/\{!!\s*([\s\S]*?)\s*!!\}|\{\{\s*([\s\S]*?)\s*\}\}/g,I;while(I=v.exec(x)){if(I.index>f)n.push(`out += ${JSON.stringify(x.slice(f,I.index))};`);n.push(I[1]!==void 0?`out += __raw(${I[1]});`:`out += __escape(${I[2]});`),f=I.index+I[0].length}if(f<x.length)n.push(`out += ${JSON.stringify(x.slice(f))};`)};while(l=a.exec(i)){u(i.slice(r,l.index)),r=l.index+l[0].length;let f=l[1]==="if"||l[1]==="elseif"||l[1]==="foreach"?kn(i,r):null;if(f)r=f.end,a.lastIndex=f.end;let v=f?.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=mr(v||"");if(!I){n.push(`out += ${JSON.stringify(l[0]+(f?`(${v})`:""))};`);break}let{iterable:D,key:z,value:N}=I;n.push(z?`for (const [${z}, ${N}] of __entries(${D})) {`:`for (const ${N} of __values(${D})) {`);break}}}return u(i.slice(r)),n.join(`
537
- `)}function Ot(e,n,r,i){if(e[n]!==r)return-1;let a=0,l=null;for(let u=n;u<e.length;u++){let x=e[u];if(l){if(x==="\\"){u++;continue}if(x===l)l=null;continue}if(x==="'"||x==='"'||x==="`"){l=x;continue}if(x===r)a++;else if(x===i){if(i===">"&&e[u-1]==="=")continue;if(a--,a===0)return u+1}}return-1}function vn(e,n,r){let i=r?"([{<":"([{",a=r?")]}>":")]}",l=[],u=0,x=null,f="";for(let v=0;v<e.length;v++){let I=e[v];if(x){if(f+=I,I==="\\"){f+=e[++v]??"";continue}if(I===x)x=null;continue}if(I==="'"||I==='"'||I==="`"){x=I,f+=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(f),f="";continue}f+=I}return l.push(f),l.map((v)=>v.trim()).filter(Boolean)}function Ru(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 Vo(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 Au(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=[],x={},f=i+(/^(?:const|let|var)\s+/.exec(e.slice(i))?.[0].length??0),v=()=>{while(f<e.length&&/\s/.test(e[f]))f++},I;if(e[f]==="{"){let U=Ot(e,f,"{","}");if(U===-1)return null;I=e.slice(f,U),f=U}else{let U=/^[A-Za-z_$][\w$]*/.exec(e.slice(f));if(!U)return null;I=U[0],f+=U[0].length}if(v(),e[f]!=="=")return null;f++,v();let D=/^withDefaults\s*\(\s*/.exec(e.slice(f)),z=Boolean(D);if(D)f+=D[0].length;let N=/^defineProps\b/.exec(e.slice(f));if(!N)return null;f+=N[0].length;let L="";if(v(),e[f]==="<"){let U=Ot(e,f,"<",">");if(U===-1)return null;L=e.slice(f+1,U-1).trim(),f=U}if(v(),e[f]!=="(")return null;let W=Ot(e,f,"(",")");if(W===-1)return null;let V=e.slice(f+1,W-1).trim();if(f=W,z){if(v(),e[f]===",")f++,v();if(e[f]==="{"){let U=Ot(e,f,"{","}");if(U===-1)return null;for(let[H,Z]of ur(e.slice(f,U)))l[H]=Z;f=U}if(v(),e[f]===",")f++,v();if(e[f]===")")f++}if(e[f]===";")f++;let G=/^[A-Za-z_$][\w$]*$/.test(L)?L:void 0;if(L.startsWith("{"))for(let U of vn(L.replace(/^\{/,"").replace(/\}$/,""),",;",!0)){let H=/^(?:readonly\s+)?([A-Za-z_$][\w$]*)\s*\??\s*:\s*([\s\S]+)$/.exec(U);if(H)a[H[1]]=H[2].trim()}if(V.startsWith("{"))for(let[U,H]of ur(V)){if(u.push(U),!H.startsWith("{")){let Z=Vo(H);if(Z)a[U]=Z;continue}for(let[Z,ne]of ur(H))if(Z==="default")l[U]=ne;else if(Z==="type"){let ae=Vo(ne);if(ae)a[U]=ae}}else if(V.startsWith("["))for(let U of vn(V.slice(1,-1),",",!1))u.push(U.replace(/^['"`]/,"").replace(/['"`]$/,""));if(I.startsWith("{")){u.length=0;for(let U of vn(I.replace(/^\{/,"").replace(/\}$/,""),",",!1)){let H=Ru(U),Z=H===-1?U:U.slice(0,H),ne=Z.split(":")[0].trim().replace(/^\.\.\./,"");if(!ne)continue;if(u.push(ne),x[ne]=Z.trim(),H!==-1)l[ne]=U.slice(H+1).trim()}}else if(u.length===0)u.push(...Object.keys(a));return{text:e.slice(i,f),propNames:u,propBindings:x,defaults:l,declared:a,typeName:G}}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,x="",f=i;while(i<n.length){let I=n[i];if(x){if(I==="\\")i++;else if(I===x)x=""}else if(I==="'"||I==='"'||I==="`")x=I;else if(I==="{"||I==="["||I==="(")u++;else if(I==="}"||I==="]"||I===")")u--;else if(I===","&&u===0)break;i++}let v=n.slice(f,i).trim();if(v)r.push([l[1],v]);i++}return r}function Jo(e){let n=t(e),r=E(n).depths,i=[],a=[];for(let u of n.matchAll(/\bimport\b/g)){let x=u.index;if(r[x]!==0)continue;let f=new Ki(e.slice(x)).tokenize().filter((L)=>!["COMMENT","WHITESPACE"].includes(L.type));if(f[1]?.value==="("||f[1]?.value===".")continue;let v=f[1]?.type==="STRING"?1:-1,I=0;for(let L=1;v===-1&&L<f.length;L++){let W=f[L];if(W.value===";"||W.type==="EOF")break;if(W.value==="{")I++;else if(W.value==="}")I--;else if(I===0&&W.value==="from"&&f[L+1]?.type==="STRING")v=L+1}if(v===-1)continue;let D=f[v],z=v;if(f[z+1]?.value==="with"&&f[z+2]?.value==="{"){z+=2;let L=1;while(L&&f[z+1]?.type!=="EOF")if(z++,f[z]?.value==="{")L++;else if(f[z]?.value==="}")L--}if(f[z+1]?.value===";")z++;let N=x+f[z].end;if(a.push({start:x,end:N}),D.value.slice(1,-1)!=="stx")i.push(e.slice(x,N))}let l=e;for(let u of a.reverse())l=l.slice(0,u.start)+l.slice(u.end);return{imports:i,body:l}}function Tu(e){let r=Se(sn(e)).find((z)=>{let N=q(z.attrs);return Pt(N)&&!["component","stx:component","client","server","src"].some((L)=>N.has(L))});if(!r)return{imports:[],body:"",propNames:[],propBindings:{},defaults:{},declared:{}};let i=e.slice(r.bodyStart,r.bodyEnd),a=[],l=[],u={},x={},f={},v=Jo(i);a.push(...v.imports),i=v.body;let I=Au(i);if(I)l.push(...I.propNames),Object.assign(u,I.propBindings),Object.assign(x,I.defaults),Object.assign(f,I.declared),i=i.replace(I.text,"");let D={};for(let z of i.matchAll(/(?:export\s+)?interface\s+([A-Za-z_$][\w$]*)\s*\{([\s\S]*?)\n\}/g)){let N=[];for(let L of z[2].matchAll(/^\s*(?:\/\*\*[\s\S]*?\*\/\s*)?([A-Za-z_$][\w$]*)\??\s*:\s*([^\n;]+)/gm))f[L[1]]=L[2].trim(),N.push(L[1]);D[z[1]]=N}if(I&&I.propNames.length===0&&I.typeName){for(let z of D[I.typeName]??[])if(!l.includes(z))l.push(z)}return i=i.replace(/(?:export\s+)?interface\s+[A-Za-z_$][\w$]*\s*\{[\s\S]*?\n\}/g,""),{imports:a,body:i.trim(),propNames:l,propBindings:u,defaults:x,declared:f}}function Iu(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,x)=>{let f=a.toLowerCase();n.add(f);let v=(l||"").split(".").filter(Boolean).join(" ");return` data-stx-on-${f}="${x}"${v?` data-stx-mod-${f}="${v}"`:""}`}),eventTypes:[...n].sort()}}function Pu(e){let n=[];return{template:e.replace(/\s:([a-z][\w:-]*)\s*=\s*(["'])([\w$.]+)\2/gi,(i,a,l,u)=>{let x=n.length;return n.push({id:x,name:a,expression:u}),` data-stx-bind-${x}=""`}),bindings:n}}function Ou(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 ju(e){return[...new Set([...e.matchAll(/(--[a-z0-9_-]+)\s*:/gi)].map((n)=>n[1]))].sort().map((n)=>({name:n}))}function Uo(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 Mu(e,n,r){let i=st.isAbsolute(n.file)?n.file:st.resolve(e,n.file),a=await pu(i,"utf8"),l=gr(a,i),u=st.basename(i,".stx"),x=n.name||l.name||xu(u),f=`${fr(r.prefix||"stx")}-${fr(u)}`,v=n.tag||l.tag||f;if(!x||!/^[A-Za-z_$][\w$]*$/.test(x))throw Error(`${i}: invalid component class name "${x}"`);if(!bu(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(([H,Z])=>[H,Uo(H,Z)])),z=Iu(vu(a)),N=Pu(z.template),L=Tu(a);for(let H of Se(sn(a))){let Z=q(H.attrs);if(!Z.has("client")||["server","component","stx:component","src"].some((ne)=>Z.has(ne))||!Pt(Z))continue;L.imports.push(...Jo(a.slice(H.bodyStart,H.bodyEnd)).imports)}L.imports=[...new Set(L.imports)];let W=Cu(N.template);for(let H of L.propNames){if(D[H])continue;let Z=L.defaults[H];D[H]=Uo(H,{type:$u(L.declared[H])??Eu(Z),...Z===void 0?{}:{default:ku(Z)}})}let V=l.methods||{},G=n.methods||{},U=Su(a,i);return{file:st.relative(e,i),sourcePath:i,name:x,tag:v,description:n.description||l.description||"",template:N.template,styles:Fo(a),shadowMode:yu(n.shadowDOM??l.shadowDOM??r.shadowDOM),progressive:n.progressive??l.progressive??r.progressive??!0,properties:D,events:n.events||l.events||{},methods:{...V,...G,...U.methods},methodDeclarations:U.declarations,declarationTypes:U.types,eventTypes:z.eventTypes,bindings:N.bindings,slots:Ou(N.template),cssProperties:ju(Fo(a)),scope:L,render:W}}function Du(){let e=JSON.stringify("\\{!!\\s*([\\w$.]+)\\s*!!\\}"),n=JSON.stringify("\\{\\{\\s*([\\w$.]+)\\s*\\}\\}");return`const HTMLElementBase = globalThis.HTMLElement || class {};
538
-
539
- const escapeHTML = (value) => String(value ?? '')
540
- .replaceAll('&', '&amp;').replaceAll('<', '&lt;').replaceAll('>', '&gt;')
541
- .replaceAll('"', '&quot;').replaceAll("'", '&#039;');
542
-
543
- const valueAt = (host, path) => {
544
- const parts = path.trim().split('.');
545
- if (parts[0] === 'this') parts.shift();
546
- if (!parts.length) return host;
547
- const first = parts.shift();
548
- // Render bindings read declared props, including attributes whose names
549
- // also belong to the native DOM API. The public element keeps that API.
550
- let value = host._values && Object.prototype.hasOwnProperty.call(host._values, first)
551
- ? host._values[first]
552
- : host[first];
553
- for (const part of parts) value = value?.[part];
554
- return typeof value === 'function' ? value.call(host) : value;
555
- };
556
-
557
- const deserialize = (value, type, fallback) => {
558
- if (value === null) return type === 'boolean' ? false : fallback;
559
- if (type === 'boolean') return value !== 'false' && value !== '0';
560
- if (type === 'number') return Number(value);
561
- if (type === 'object' || type === 'array') {
562
- try { return JSON.parse(value); }
563
- catch { return fallback; }
564
- }
565
- return value;
566
- };
567
-
568
- const serialize = (value, type) => {
569
- if (value == null || value === false) return null;
570
- if (type === 'boolean') return '';
571
- if (type === 'object' || type === 'array') return JSON.stringify(value);
572
- return String(value);
573
- };
574
-
575
- const cloneDefault = (value, type) => {
576
- if (value == null || (type !== 'object' && type !== 'array')) return value;
577
- if (typeof structuredClone === 'function') return structuredClone(value);
578
- return JSON.parse(JSON.stringify(value));
579
- };
580
-
581
- const defaultFor = property => cloneDefault(
582
- property.default ?? ({ string: '', number: 0, boolean: false, object: {}, array: [] })[property.type],
583
- property.type,
584
- );
585
-
586
- export class StxElement extends HTMLElementBase {
587
- static definition = {};
588
- static get observedAttributes() { return this.definition.observedAttributes || []; }
589
-
590
- constructor() {
591
- super();
592
- this._values = Object.create(null);
593
- this._reflecting = false;
594
- this._connected = false;
595
- this._hasConnected = false;
596
- this._initializing = false;
597
- this._updatePending = false;
598
- this._listeners = new Map();
599
- const definition = this.constructor.definition;
600
- for (const [name, property] of Object.entries(definition.properties || {})) {
601
- this._values[name] = defaultFor(property);
602
- }
603
- if (definition.shadowMode && this.attachShadow && !this.shadowRoot) {
604
- this._closedRoot = this.attachShadow({ mode: definition.shadowMode });
605
- }
606
- }
607
-
608
- get updateComplete() { return this._updateComplete || Promise.resolve(); }
609
- get renderRoot() { return this._closedRoot || this.shadowRoot || this; }
610
-
611
- connectedCallback() {
612
- if (this._connected) return;
613
- this._connected = true;
614
- this._initializing = true;
615
- const definition = this.constructor.definition;
616
- for (const [name, property] of Object.entries(definition.properties || {})) {
617
- const attribute = property.attribute === false ? null : (property.attribute || name.replace(/[A-Z]/g, letter => '-' + letter.toLowerCase()));
618
- if (attribute && this.hasAttribute?.(attribute)) this._values[name] = deserialize(this.getAttribute(attribute), property.type, defaultFor(property));
619
- }
620
- // Properties assigned before customElements.define() become own properties.
621
- // Upgrade them after attributes so imperative state wins, matching the
622
- // platform's property-first custom-element initialization convention.
623
- for (const name of Object.keys(definition.properties || {})) this._upgradeProperty(name);
624
- this._initializing = false;
625
- const root = this.renderRoot;
626
- const hasMarkup = [...(root.childNodes || [])].some(node => node.nodeType !== 3 || node.textContent.trim());
627
- const firstConnection = !this._hasConnected;
628
- if (!(firstConnection && definition.progressive && hasMarkup)) this._render();
629
- else this._upgradeDeclarativeEvents();
630
- this._bindEvents();
631
- if (firstConnection) {
632
- this._hasConnected = true;
633
- this.setAttribute?.('hydrated', '');
634
- this.dispatchEvent?.(new CustomEvent('stx:hydrated', { bubbles: true, composed: true }));
635
- }
636
- // Called last, so a component that acquires something sees its own rendered
637
- // markup and its events already bound. Reported rather than rethrown: a
638
- // component that fails to set up must not take the element down with it.
639
- try { this.onConnect?.(); }
640
- catch (error) { console.error('[stx] onConnect failed', error); }
641
- }
642
-
643
- disconnectedCallback() {
644
- this._connected = false;
645
- // Called before the framework releases anything, so the element is still
646
- // intact for a component that needs to read it on the way out, and inside
647
- // try/finally so a throwing hook cannot leak the framework's own listeners.
648
- try { this.onDisconnect?.(); }
649
- catch (error) { console.error('[stx] onDisconnect failed', error); }
650
- finally {
651
- for (const [event, listener] of this._listeners) this.renderRoot.removeEventListener(event, listener);
652
- this._listeners.clear();
653
- }
654
- }
655
-
656
- attributeChangedCallback(attribute, oldValue, newValue) {
657
- if (oldValue === newValue || this._reflecting) return;
658
- const definition = this.constructor.definition;
659
- const name = definition.attributeToProperty?.[attribute];
660
- if (!name) return;
661
- const property = definition.properties[name];
662
- const value = deserialize(newValue, property.type, defaultFor(property));
663
- if (!Object.is(this._values[name], value)) {
664
- this._values[name] = value;
665
- this.requestUpdate();
666
- }
667
- }
668
-
669
- /**
670
- * The props a compiled render reads.
671
- *
672
- * Its own method rather than _values directly, so a component that sets a
673
- * property before upgrade still sees it, and so the generated code has one
674
- * name to depend on rather than a private field's shape.
675
- */
676
- _props() {
677
- return this._values;
678
- }
679
-
680
- requestUpdate() {
681
- if (!this._connected || this._initializing || this._updatePending) return this.updateComplete;
682
- this._updatePending = true;
683
- this._updateComplete = new Promise((resolve) => {
684
- queueMicrotask(() => {
685
- this._updatePending = false;
686
- if (this._connected) this._render();
687
- resolve();
688
- });
689
- });
690
- return this._updateComplete;
691
- }
692
-
693
- emit(name, detail, options = {}) {
694
- return this.dispatchEvent(new CustomEvent(name, {
695
- detail, bubbles: true, composed: true, ...options,
696
- }));
697
- }
698
-
699
- _upgradeProperty(name) {
700
- if (!Object.prototype.hasOwnProperty.call(this, name)) return;
701
- const value = this[name];
702
- delete this[name];
703
- this[name] = value;
704
- }
705
-
706
- _upgradeDeclarativeEvents() {
707
- for (const element of this.renderRoot.querySelectorAll?.('*') || []) {
708
- const names = element.getAttributeNames?.() || [...(element.attributes || [])].filter(Boolean).map(attribute => attribute.name);
709
- for (const attributeName of names) {
710
- if (!attributeName?.startsWith('@')) continue;
711
- const [event, ...modifiers] = attributeName.slice(1).split('.');
712
- element.setAttribute('data-stx-on-' + event, element.getAttribute(attributeName));
713
- if (modifiers.length) element.setAttribute('data-stx-mod-' + event, modifiers.join(' '));
714
- element.removeAttribute(attributeName);
715
- }
716
- }
717
- }
718
-
719
- _bindEvents() {
720
- for (const event of this.constructor.definition.eventTypes || []) {
721
- if (this._listeners.has(event)) continue;
722
- const listener = ($event) => {
723
- const selector = '[data-stx-on-' + event + ']';
724
- const target = $event.target?.closest?.(selector);
725
- if (!target || !this.renderRoot.contains(target)) return;
726
- const modifiers = (target.getAttribute('data-stx-mod-' + event) || '').split(' ');
727
- if (modifiers.includes('prevent')) $event.preventDefault();
728
- if (modifiers.includes('stop')) $event.stopPropagation();
729
- const method = target.getAttribute('data-stx-on-' + event);
730
- if (typeof this[method] === 'function') this[method]($event);
731
- };
732
- this.renderRoot.addEventListener(event, listener);
733
- this._listeners.set(event, listener);
734
- }
735
- }
736
-
737
- _render() {
738
- const definition = this.constructor.definition;
739
- const root = this.renderRoot;
740
- const active = root.activeElement || (root.contains?.(globalThis.document?.activeElement) ? globalThis.document.activeElement : null);
741
- const focusAttribute = active?.getAttribute?.('data-key') ? 'data-key' : active?.id ? 'id' : 'name';
742
- const focusKey = active?.getAttribute?.(focusAttribute);
743
- const focusValue = focusAttribute === 'name' && active?.type === 'radio' ? active.value : null;
744
- const selectionStart = active?.selectionStart, selectionEnd = active?.selectionEnd;
745
- const selection = Number.isInteger(selectionStart) && Number.isInteger(selectionEnd)
746
- ? [selectionStart, selectionEnd, active.selectionDirection] : null;
747
- // A compiled component renders itself: the control flow and the derived
748
- // values were turned into JavaScript at build time, so there is nothing to
749
- // interpret here and nothing that needs an eval the page's CSP forbids.
750
- // The string template remains for components that carry no logic.
751
- let html = typeof this.render === 'function'
752
- ? this.render(RENDER_HELPERS)
753
- : definition.template
754
- .replace(new RegExp(${e}, 'g'), (_match, expression) => String(valueAt(this, expression) ?? ''))
755
- .replace(new RegExp(${n}, 'g'), (_match, expression) => escapeHTML(valueAt(this, expression)));
756
- if (definition.shadowMode && definition.styles) html = '<style>' + definition.styles + '</style>' + html;
757
- root.innerHTML = html;
758
- this._applyBindings();
759
- this._bindEvents();
760
- if (focusKey) {
761
- const escaped = globalThis.CSS?.escape ? globalThis.CSS.escape(focusKey) : focusKey.replace(/["\\\\]/g, '\\$&');
762
- const selector = '[' + focusAttribute + '="' + escaped + '"]';
763
- // Name-only radio groups share a name, but their chosen member must stay focused.
764
- const next = focusValue === null ? root.querySelector(selector)
765
- : [...root.querySelectorAll(selector)].find(element => element.type === 'radio' && element.value === focusValue);
766
- next?.focus?.();
767
- // Several input types expose this method but reject text selection. A
768
- // rerender can also change a text input into one of those types.
769
- if (selection && Number.isInteger(next?.selectionStart) && Number.isInteger(next?.selectionEnd) && typeof next?.setSelectionRange === 'function')
770
- next.setSelectionRange(selection[0], selection[1], selection[2] || 'none');
771
- }
772
- this.dispatchEvent?.(new CustomEvent('stx:updated', { bubbles: false }));
773
- }
774
-
775
- _applyBindings() {
776
- for (const binding of this.constructor.definition.bindings || []) {
777
- const element = this.renderRoot.querySelector('[data-stx-bind-' + binding.id + ']');
778
- if (!element) continue;
779
- const value = valueAt(this, binding.expression);
780
- if (binding.name === 'class') element.className = value || '';
781
- else if (binding.name === 'style' && typeof value === 'object') {
782
- Object.assign(element.style, value);
783
- }
784
- else if (typeof value === 'boolean') {
785
- element.toggleAttribute(binding.name, value);
786
- if (binding.name in element) element[binding.name] = value;
787
- }
788
- else if (value == null || value === false) element.removeAttribute(binding.name);
789
- else element.setAttribute(binding.name, String(value));
790
- }
791
- }
792
- }
793
-
794
- /**
795
- * What a compiled render is handed.
796
- *
797
- * Passed in rather than closed over so the generated code names no globals, and
798
- * a component module stays readable on its own: __escape is visibly a
799
- * parameter, not something the bundler happened to leave in scope.
800
- */
801
- const RENDER_HELPERS = {
802
- escape: escapeHTML,
803
- // The raw form is the author declaring the value is markup. Null becomes an
804
- // empty string rather than the word "null", which is the only sensible
805
- // reading of a missing fragment.
806
- raw: (value) => String(value ?? ''),
807
- // A loop over something absent runs zero times. Throwing here would fail a
808
- // whole page over one empty list, which is never what the author meant.
809
- values: (value) => value == null ? [] : (value[Symbol.iterator] ? value : Object.values(value)),
810
- entries: (value) => value == null ? [] : (Array.isArray(value) ? value.entries() : Object.entries(value)),
811
- };
812
-
813
- export function defineComponent(Component, definition) {
814
- const properties = definition.properties || {};
815
- const attributeToProperty = {};
816
- const observedAttributes = [];
817
- for (const [name, property] of Object.entries(properties)) {
818
- const attribute = property.attribute === false ? null : (property.attribute || name.replace(/[A-Z]/g, letter => '-' + letter.toLowerCase()));
819
- if (attribute) {
820
- attributeToProperty[attribute] = name;
821
- observedAttributes.push(attribute);
822
- }
823
- // A style prop is an attribute value, not a replacement for the browser's
824
- // CSSStyleDeclaration. Native event handler accessors must survive too.
825
- if (name in HTMLElementBase.prototype) {
826
- if (!attribute) throw new TypeError('STX prop "' + name + '" overlaps the native DOM API and needs an attribute binding');
827
- continue;
828
- }
829
- Object.defineProperty(Component.prototype, name, {
830
- configurable: true,
831
- enumerable: true,
832
- get() { return this._values[name]; },
833
- set(value) {
834
- const oldValue = this._values[name];
835
- if (Object.is(oldValue, value)) return;
836
- this._values[name] = value;
837
- if (property.reflect && attribute && !this._reflecting) {
838
- const serialized = serialize(value, property.type);
839
- this._reflecting = true;
840
- if (serialized === null) this.removeAttribute(attribute);
841
- else this.setAttribute(attribute, serialized);
842
- this._reflecting = false;
843
- }
844
- this.requestUpdate();
845
- this.dispatchEvent?.(new CustomEvent(name + '-changed', {
846
- detail: { value, oldValue }, bubbles: true, composed: true,
847
- }));
848
- },
849
- });
850
- }
851
- Component.definition = { ...definition, attributeToProperty, observedAttributes };
852
- const registry = globalThis.customElements || globalThis.window?.customElements;
853
- if (registry && !registry.get(definition.tag)) {
854
- registry.define(definition.tag, Component);
855
- }
856
- return Component;
857
- }
858
- `}function pr(e,n="./runtime.js"){let r=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),i=Object.entries(e.methods).map(([f,v])=>{if(Zo.has(f))throw Error(`${e.sourcePath}: ${qo(f)}`);if(/^(?:async\s+)?[A-Za-z_$][\w$]*\s*\(/.test(v.trim()))return` ${v.trim()}`;return` ${f}($event) {
859
- ${v}
860
- }`}).join(`
861
-
862
- `),a=e.scope,l=[...new Set([...Object.keys(e.properties),...a.propNames])].map((f)=>{let v=a.propBindings[f]||f;return a.defaults[f]===void 0?v:`${v} = ${a.defaults[f]}`}).join(", "),u=(f)=>f.split(`
863
- `).map((v)=>v.trim()===""?v:` ${v}`).join(`
864
- `),x="";if(e.render.trim()!==""||a.body!==""||l!==""){let f=[l?`const { ${l} } = this._props();`:"",a.body,"let out = '';",e.render,"return out;"].filter(Boolean).join(`
865
- `),v;try{let I=new Bun.Transpiler({loader:"ts"}).transformSync(`export function __render(__helpers) {
866
- ${f}
867
- }`),D=I.indexOf("{"),z=I.lastIndexOf("}");v=I.slice(D+1,z).trim()}catch(I){throw Error(`${e.sourcePath}: failed to compile render (${I.message})`)}x=`
868
- render(__helpers) {
869
- const { escape: __escape, raw: __raw, values: __values, entries: __entries } = __helpers;
870
- ${u(v.trim())}
871
- }
872
- `}return`import { StxElement, defineComponent } from ${n==="./runtime.js"?"'./runtime.js'":JSON.stringify(n)};
873
- ${a.imports.length?`${a.imports.join(`
874
- `)}
875
- `:""}
876
- /** ${e.description||`${e.name} web component generated from ${e.file}.`} */
877
- export class ${e.name} extends StxElement {
878
- ${i}${x}
879
- }
880
-
881
- defineComponent(${e.name}, ${r});
882
- export default ${e.name};
883
- `}function rn(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 Nu(e){let n=Object.entries(e.properties).map(([a,l])=>` ${a}${l.required?"":"?"}: ${rn(l)}`).join(`
884
- `),r=Object.entries(e.events).map(([a,l])=>` ${JSON.stringify(a)}: CustomEvent<${l.detailType||"unknown"}>`).join(`
885
- `),i=Object.keys(e.methods).flatMap((a)=>e.methodDeclarations[a]||[`${a}($event?: Event): unknown`]).map((a)=>` ${a}`).join(`
886
- `);return`${e.declarationTypes?`${e.declarationTypes}
887
-
888
- `:""}export interface ${e.name}Props {
889
- ${n}
890
- }
891
-
892
- export interface ${e.name}EventMap {
893
- ${r}
894
- }
895
-
896
- export interface ${e.name} extends Required<Pick<${e.name}Props, Exclude<keyof ${e.name}Props, keyof HTMLElement>>> {}
897
-
898
- export declare class ${e.name} extends HTMLElement {
899
- ${i}
900
- readonly updateComplete: Promise<void>
901
- requestUpdate(): Promise<void>
902
- emit<T = unknown>(name: string, detail?: T, options?: CustomEventInit<T>): boolean
903
- }
904
-
905
- declare global {
906
- interface HTMLElementTagNameMap {
907
- ${JSON.stringify(e.tag)}: ${e.name}
908
- }
909
- }
910
-
911
- export default ${e.name}
912
- `}function Lu(e){return`declare global {
913
- namespace JSX {
914
- interface IntrinsicElements {
915
- ${e.map((r)=>{let i=Object.entries(r.properties).map(([l,u])=>` ${JSON.stringify(l)}?: ${rn(u)}`).join(`
916
- `),a=Object.keys(r.events).map((l)=>` ${`on${l.split(/[-:]/).map((x)=>x.charAt(0).toUpperCase()+x.slice(1)).join("")}`}?: (event: CustomEvent<${r.events[l].detailType||"unknown"}>) => void`).join(`
917
- `);return` ${JSON.stringify(r.tag)}: {
918
- ${i}
919
- ${a}
920
- children?: unknown
921
- slot?: string
922
- class?: string
923
- className?: string
924
- }`}).join(`
925
- `)}
926
- }
927
- }
928
- }
929
-
930
- export {}
931
- `}function zu(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:rn(i)},default:i.default===void 0?void 0:JSON.stringify(i.default),attribute:i.attribute===!1?void 0:i.attribute||fr(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 Ho(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}) {
932
- ${n}
933
- }`}function Ko(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\s+/g," ").replace(/\s*([{}:;,])\s*/g,"$1").replace(/;}/g,"}").trim()}function Bu(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(`
934
- `);return`const definitions = ${JSON.stringify(a,null,2)};
935
- const escapeHTML = (value) => String(value ?? '')
936
- .replaceAll('&', '&amp;').replaceAll('<', '&lt;').replaceAll('>', '&gt;')
937
- .replaceAll('"', '&quot;').replaceAll("'", '&#039;');
938
- const valueAt = (values, path) => path.trim().split('.').reduce((value, part) => value?.[part], values);
939
-
940
- export function renderComponent(tag, props = {}, slots = {}) {
941
- const definition = definitions[tag];
942
- if (!definition) throw new Error('Unknown STX component: ' + tag);
943
- const values = Object.fromEntries(Object.entries(definition.properties).map(([name, property]) => [name, property.default]));
944
- Object.assign(values, props);
945
- let template = definition.template
946
- .replace(new RegExp(${n}, 'g'), (_match, expression) => String(valueAt(values, expression) ?? ''))
947
- .replace(new RegExp(${r}, 'g'), (_match, expression) => escapeHTML(valueAt(values, expression)))
948
- .replace(new RegExp(${i}, 'gi'), (_match, name) => String(slots[name || 'default'] ?? ''));
949
- const attributes = Object.entries(definition.properties).flatMap(([name, property]) => {
950
- if (property.attribute === false || !(name in props)) return [];
951
- const attribute = property.attribute || name.replace(/[A-Z]/g, letter => '-' + letter.toLowerCase());
952
- const value = props[name];
953
- if (value == null || value === false) return [];
954
- if (value === true) return [attribute];
955
- const serialized = typeof value === 'object' ? JSON.stringify(value) : value;
956
- return [attribute + '=\\"' + escapeHTML(serialized) + '\\"'];
957
- }).join(' ');
958
- if (definition.shadowMode) {
959
- template = '<template shadowrootmode="' + definition.shadowMode + '">' +
960
- (definition.styles ? '<style>' + definition.styles + '</style>' : '') + template + '</template>' +
961
- String(slots.default ?? '');
962
- }
963
- return '<' + tag + (attributes ? ' ' + attributes : '') + '>' + template + '</' + tag + '>';
964
- }
965
-
966
- ${l}
967
- `}async function rl(e){let n=st.resolve(e.inputDir),r=st.resolve(e.outputDir);if(!(await Wo(n).catch(()=>null))?.isDirectory())throw Error(`Component-library input directory does not exist: ${n}`);let a=e.components?.length?e.components:(await _u(n)).map((V)=>({file:V}));if(!a.length)throw Error(`No .stx components found in ${n}`);let l=await Promise.all(a.map((V)=>Mu(n,V,e)));l.sort((V,G)=>V.tag.localeCompare(G.tag));let u=l.filter((V,G)=>l.findIndex((U)=>U.tag===V.tag)!==G);if(u.length)throw Error(`Duplicate custom-element tag: ${u[0].tag}`);let x=l.filter((V,G)=>l.findIndex((U)=>U.name===V.name)!==G);if(x.length)throw Error(`Duplicate component class name: ${x[0].name}`);await Bo(r,{recursive:!0});let f=[],v=async(V,G)=>{let U=st.join(r,V);if(await Bo(st.dirname(U),{recursive:!0}),await gu(U,typeof G==="string"&&!G.endsWith(`
968
- `)?`${G}
969
- `:G),!f.includes(U))f.push(U);return U};await v("runtime.js",Du());for(let V of l){if(await v(`${V.tag}.js`,pr(V)),e.declarations!==!1)await v(`${V.tag}.d.ts`,Nu(V));if(e.css!==!1&&V.styles){let G=V.shadowMode?V.styles:Ho(V);await v(`${V.tag}.css`,e.minify?Ko(G):G)}}let I=new Bun.Transpiler({loader:"ts"});if(l.some((V)=>V.scope.imports.length||I.scanImports(pr(V)).some((G)=>G.kind==="dynamic-import"))){let V=l.map((ne)=>st.join(r,`${ne.tag}.js`)),G=new Map(await Promise.all(V.map(async(ne,ae)=>[await du(ne),l[ae]])));for(let[ne,ae]of V.entries())G.set(ae,l[ne]);let U=new Map(l.map((ne)=>[st.join(st.dirname(ne.sourcePath),`.stx-library-${ne.tag}.ts`),ne])),H=st.join(r,"runtime.js"),Z=await Bun.build({entrypoints:V,outdir:r,root:r,target:"browser",format:"esm",splitting:!0,naming:{entry:"[name].js",chunk:"chunks/[name]-[hash].js"},minify:!1,loader:{".js":"ts"},plugins:[{name:"stx-element-runtime",setup(ne){ne.onResolve({filter:/.*/},(ae)=>{if(ae.path==="bun"||ae.path.startsWith("bun:")||ae.path.startsWith("node:")||hu.has(ae.path))throw Error(`Server-only import ${JSON.stringify(ae.path)} is not available in a browser component (${ae.importer})`);let fe=G.get(ae.path);if(!ae.importer&&fe)return{path:st.join(st.dirname(fe.sourcePath),`.stx-library-${fe.tag}.ts`)};if(ae.path===H&&U.has(ae.importer))return{path:"./runtime.js",external:!0}}),ne.onLoad({filter:/\.ts$/},(ae)=>{let fe=U.get(ae.path);if(fe)return{contents:pr(fe,H),loader:"ts"}})}}]}).catch((ne)=>{let ae=(ne instanceof AggregateError?ne.errors:[ne]).map(String).join(`
970
- `);throw Error(`Failed to bundle browser component imports
971
- ${ae}`)});if(!Z.success)throw Error(`Failed to bundle component imports
972
- ${Z.logs.map(String).join(`
973
- `)}`);for(let ne of Z.outputs)await v(st.relative(r,ne.path),new Uint8Array(await ne.arrayBuffer()))}let D=l.map((V)=>`export { ${V.name}, default as ${V.name}Element } from './${V.tag}.js';`).join(`
974
- `);if(await v("index.js",D),await v("ssr.js",Bu(l)),e.declarations!==!1)await v("index.d.ts",l.map((V)=>`export * from './${V.tag}.js'`).join(`
975
- `)),await v("custom-elements.d.ts",Lu(l)),await v("ssr.d.ts",`${l.map((V)=>`export declare const render${V.name}: (props?: ${V.name}Props, slots?: Record<string, string>) => string`).join(`
976
- `)}
977
- export declare function renderComponent(tag: string, props?: Record<string, unknown>, slots?: Record<string, string>): string
978
- ${l.map((V)=>`import type { ${V.name}Props } from './${V.tag}.js'`).join(`
979
- `)}`);let z;if(e.manifest!==!1)z=await v("custom-elements.json",JSON.stringify(zu(l),null,2));let N;if(e.css!==!1){let V=l.filter((G)=>!G.shadowMode&&G.styles).map(Ho).join(`
980
-
981
- `);if(V)N=await v("bundle.css",e.minify?Ko(V):V)}let L;if(e.bundle!==!1){L=st.join(r,"bundle.js");let V;try{V=await Bun.build({entrypoints:[st.join(r,"index.js")],outdir:r,naming:"bundle.js",target:"browser",format:"esm",minify:e.minify??!0,sourcemap:e.sourcemap||"none"})}catch(G){let U=G instanceof AggregateError?G.errors:[G],H=U.map((Z)=>String(Z).trim()).filter(Boolean).join(`
982
- `);throw AggregateError(U,`Failed to bundle component library${H?`
983
- ${H}`:""}`)}if(!V.success){let G=V.logs.map((U)=>String(U).trim()).filter(Boolean).join(`
984
- `);throw AggregateError(V.logs,`Failed to bundle component library${G?`
985
- ${G}`:""}`)}if(f.push(L),e.sourcemap==="external")f.push(`${L}.map`)}let W=await Promise.all(f.map(async(V)=>(await Wo(V)).size));return{components:l.map((V)=>({name:V.name,tag:V.tag,source:V.sourcePath,module:st.join(r,`${V.tag}.js`),styles:V.styles,shadowMode:V.shadowMode})),files:f,manifest:z,bundle:L,cssBundle:N,totalBytes:W.reduce((V,G)=>V+G,0)}}var Wu=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=E(a).depths,u=[...a.matchAll(/\b(?:interface|type)\s+InheritedContext\b/g)].find((D)=>l[D.index]===0)?.index??0,x=r.text.slice(r.text.indexOf("{")+1,r.text.lastIndexOf("}")),f=t(x),v=E(f).depths,I=[...f.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(`
986
- `),offset:Math.max(0,u),...!i?{unsupported:"InheritedContext requires a local non-generic object interface or object type alias with named properties"}:{}}}function Fu(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[x,f=x]=u.trim().split(/\s+as\s+/);if(f&&!(l&&Wu.has(x)))n.push(f)}}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(`
987
- `)}function Go(e,n){let r=[ds],i=[],a=new Map,l=dt.resolve(n.filePath),u=l.split(dt.sep).lastIndexOf("views"),x=u>=0?l.split(dt.sep).slice(0,u).join(dt.sep):dt.dirname(l),f=dt.resolve(n.partialsDir||dt.join(x,"partials")),v=dt.resolve(n.layoutsDir||dt.join(x,"views/layouts"));if([f,v].some((V)=>l===V||l.startsWith(V+dt.sep)))return{declarations:"",checks:i,dependencies:a};let I=(V)=>n.readTemplate?.(V)??(Xo.existsSync(V)?Xo.readFileSync(V,"utf8"):void 0),D=0,z=!1,N=[];function L(V,G){let U=e.slice(0,V).split(`
988
- `).length,H=V-e.lastIndexOf(`
989
- `,V-1),Z={code:e.slice(V,e.indexOf(`
990
- `,V)<0?e.length:e.indexOf(`
991
- `,V)),line:U,column:H,kind:"directive",offset:V,anchor:!0};i.push({expression:Z,statement:{text:`;${G}`,prefixLength:1}})}function W(V,G,U,H,Z,ne){let ae=`__StxInherited${D++}`;while((e+V+[...a.values()].join("")).includes(ae))ae+="_";let fe=ke(V).filter((je)=>je.kind==="server").map((je)=>je.code).join(`
992
- `),pe=`${ae}ParentValue`,Ce=`${ae}ParentType`;r.push(`type ${Ce} = ${U};`);let Re=hr(hs(fe,dt.dirname(G)),ae);r.push(...Re.imports);let Ee=Ut(fe);if(Ee&&Z!==void 0){z=!0;let je=Re.imports.length?Re.aliases.join(`
993
- `):"",Te=gs(`${je}
994
- ${Ee.types}
995
- const __contract = defineProps<InheritedContext>();`,`${ae}Contract`);r.push(Te.declarations),r.push(`declare const ${ae}Input: ${Ce};`),L(Z,Ee.unsupported?`({})[${JSON.stringify(Ee.unsupported)}];`:`${ae}Input satisfies ${Te.props};`)}let ye=[...new Set([...he(fe),...Fu(fe)])],He=[...new Set([...H,...Ee?.keys||[]])].filter((je)=>!ye.includes(je)),tt=Ee?`${Ce} & ${ae}Contract.__StxProps`:Ce,ct=Cn(Re.body).replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class|interface|type)\b)/gm,""),nt=[],ht=on(V),ut=/@(include|extends|layout)\s*\(/g,rt;while(rt=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){N.push({offset:Z??rt.index,message:`Inherited context cannot be checked across dynamic @${rt[1]}`});continue}let pt=Te[2],et=rt[1];if(et!=="include"&&Te[3])N.push({offset:Z??rt.index,message:`Inherited context cannot be checked for unsupported @${et} data arguments`});let cn=et==="include"?f:v,At=dt.resolve(pt.startsWith(".")?dt.dirname(G):cn,pt.endsWith(".stx")?pt:pt+".stx");if(I(At)===void 0){N.push({offset:Z??rt.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:Z??rt.index})}let jt=`{ ...${pe}${ye.length?", "+ye.join(", "):""} }`;r.push(`namespace ${ae} {
996
- ${Re.aliases.join(`
997
- `)}
998
- export async function read(${pe}: ${Z===void 0?"{}":tt}) {
999
- ${He.length?`const { ${He.join(", ")} } = ${pe};`:""}
1000
- ${ct}
1001
- return { context: ${jt}${nt.map((je)=>`, ${je.name}: { ...${jt}, ...(${je.args}) }`).join("")} };
1002
- }
1003
- }`);for(let je of nt){if(ne.includes(je.target)||ne.length>=32){N.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),W(Te,je.target,`Awaited<ReturnType<typeof ${ae}.read>>[${JSON.stringify(je.name)}]`,[...new Set([...H,...ye])],je.offset,[...ne,je.target])}return ae}if(W(e,l,"{}",[],void 0,[l]),z||n.contractsKnown)for(let V of N)L(V.offset,`({})[${JSON.stringify(V.message)}];`);return{declarations:z?r.join(`
1004
- `):"",checks:i,dependencies:a}}function Zs(e,n){let r=sn(e),i=dr(e);if(!i)return;let a;try{a=gr(e,"component")}catch(Z){let ne=i.open,ae=Z instanceof Error?Z.message:"Invalid component metadata";return{declarations:"",checks:[{text:`({})[${JSON.stringify(ae)}];`,line:e.slice(0,ne).split(`
1005
- `).length,column:ne-e.lastIndexOf(`
1006
- `,ne-1),origin:"component"}],project:(fe)=>({code:fe,columns:new Map})}}let l=Se(r).filter((Z)=>{let ne=q(Z.attrs);return Pt(ne)&&ne.has("client")&&!ne.has("server")&&!ne.has("component")&&!ne.has("stx:component")&&!ne.has("src")}),u=l.map((Z)=>e.slice(Z.bodyStart,Z.bodyEnd)).join(`
1007
- `),x=ms(u,n),f=Bt(u).some((Z)=>Z.name==="ComponentState")||xs(u).includes("ComponentState"),v=Object.entries(a.properties||a.props||{}).map(([Z,ne])=>`${JSON.stringify(Z)}: ${rn(ne)}`).join("; "),I=[...new Set(x.map((Z)=>Z.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;",f?"type __StxState = __StxSpecific<ComponentState> extends true ? ComponentState : {};":"type __StxState = {};",f?'declare function __stxSpecificState(value: __StxSpecific<ComponentState> extends true ? true : "ComponentState requires named explicit fields without any or index signatures"): void;':"",f?"declare const __stxStateProperties: Pick<ComponentState, Extract<keyof ComponentState, keyof __StxInstanceProperties>>;":"",f?'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((Z)=>JSON.stringify(Z)).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">;',f?'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((Z)=>`${JSON.stringify(Z)}: typeof ${Z};`),"}"].filter(Boolean).join(`
1008
- `),z=-1;for(let Z of l){let ne=Z.bodyStart,ae=e.slice(ne,Z.bodyEnd),fe=t(ae),pe=E(fe).depths,Ce=[...fe.matchAll(/\b(?:interface|type)\s+ComponentState\b/g)].find((Re)=>pe[Re.index]===0)??(xs(ae).includes("ComponentState")?/\bComponentState\b/.exec(fe):void 0);if(Ce){z=ne+Ce.index;break}}let N=f&&z>=0?[{origin:"client",text:"__stxSpecificState(true); __stxStateMethods(true); __stxOptionalPrivate(true); __stxStateProperties satisfies Pick<__StxInstanceProperties, Extract<keyof ComponentState, keyof __StxInstanceProperties>>;",line:e.slice(0,z).split(`
1009
- `).length,column:z-e.lastIndexOf(`
1010
- `,z-1)}]:[],{start:L,code:W}=i,V=t(W),G=E(V).depths,U=new Map,H=!1;for(let Z of W.matchAll(/"(?:\\.|[^"\\])*"\s*:/g)){let ne=JSON.parse(Z[0].slice(0,Z[0].lastIndexOf(":")).trim());if(G[Z.index]===1&&["properties","props"].includes(ne)){H=!0;continue}if(H&&G[Z.index]===1)H=!1;if(H&&G[Z.index]===2&&!U.has(ne))U.set(ne,L+Z.index)}for(let[Z,ne]of Object.entries(a.properties||a.props||{})){let ae=U.get(Z)??L,fe=e.slice(0,ae).split(`
1011
- `).length,pe=ae-e.lastIndexOf(`
1012
- `,ae-1);if(!ne||typeof ne!=="object"||!["string","number","boolean","object","array"].includes(ne.type))N.push({text:`({})[${JSON.stringify(`Property ${Z} must declare string, number, boolean, object or array`)}];`,line:fe,column:pe,origin:"component"});if(ne&&ne.default!==void 0)N.push({text:`const __stxDefault${N.length}: ${rn(ne)} = ${JSON.stringify(ne.default)};`,line:fe,column:pe,origin:"component"})}return{declarations:D,checks:N,project(Z){let ne=new Map,ae=[],fe=0;for(let pe of ms(Z,n)){if(/^\s*this\s*:/.test(pe.parameters))continue;let Ce=pe.parameterOffset,Re=`this: __StxNativeComponent${pe.parameters.trim()?", ":""}`;ae.push(Z.slice(fe,Ce),Re);let Ee=Z.slice(0,Ce).split(`
1013
- `).length,ye=Ce-Z.lastIndexOf(`
1014
- `,Ce-1),He=ne.get(Ee)||[],tt=He.at(-1),ct=ye+(tt?tt.generatedEnd-tt.sourceEnd:0);He.push({sourceStart:ye,sourceEnd:ye,generatedStart:ct,generatedEnd:ct+Re.length}),ne.set(Ee,He),fe=Ce}return ae.push(Z.slice(fe)),{code:ae.join(""),columns:ne}}}}function Yo(e){let n=[],r=[],i=/@foreach\s*\(|@endforeach\b/g,a;while(a=i.exec(e)){if(a[0].startsWith("@endforeach")){let f=r.pop();if(f)f.end=a.index,n.push(f);continue}let l=kn(e,i.lastIndex-1);if(!l)continue;let u=mr(l.expression),x=l.end;if(u)r.push({start:x,end:e.length,iterable:u.iterable,binding:u.key?`${u.value}, ${u.key}`:u.value});i.lastIndex=x}return n.sort((l,u)=>l.start-u.start)}function Vu(e){let n=(r)=>r.replace(/[^\n]/g," ");return e.replace(/<!--[\s\S]*?-->/g,n).replace(/\{\{--[\s\S]*?--\}\}/g,n)}function ke(e){let n=[],r=Vu(e);for(let i of Se(r)){let a=i.attrs.trim(),l=q(a),{bodyStart:u,bodyEnd:x}=i,f=e.slice(u,x);if(l.has("src")||l.has("component")||l.has("stx:component"))continue;if(!Pt(l))continue;let v=l.has("server")?"server":l.has("client")?"client":"plain",I=jn(e,u);n.push({kind:v,code:f,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(`
1015
- `,n-1)+1;return n-r+1}function on(e){let n=e.split(""),r=(a,l)=>{for(let u=a;u<l&&u<n.length;u++)if(n[u]!==`
1016
- `)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 la(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 ua=new Set([":for","x-for","v-for"]),bs=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,br="__stx_interpolated",Qo="__StxElement",pa="__StxTemplateValue",Uu=`type ${pa}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function ta(e){return e.replace(/\{\{[\s\S]*?\}\}/g,br).replace(/\{!![\s\S]*?!!\}/g,br)}function Hu(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=[],x=t(e),f=ba(e),v=[],I=0;for(let W=0;W<x.length;W++){let V=x.startsWith("{{",W);if(!V&&!x.startsWith("{!!",W))continue;let G=V?2:3,U=V?"}}":"!!}",H=Hu(x,W+G,U);if(H<0)continue;let Z=W,ne=e.slice(Z,H+U.length),ae=ne.slice(G,-U.length);W=H+U.length-1;let fe=u.length,pe=_r(f,Z),Ce=_r(f,Z+(V?2:3));u.push({code:la(ae),...Ce});let Re=`${i}_${fe}`,Ee=ne.split(`
1017
- `),ye=Ee[0].length;Ee[0]=Re+" ".repeat(Math.max(0,ye-Re.length));for(let nt=1;nt<Ee.length;nt++)Ee[nt]=Ee[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+Ee[0].length}),a.set(pe.line,He),v.push(e.slice(I,Z),Ee.join(`
1018
- `)),I=Z+ne.length}v.push(e.slice(I));let D=v.join("");if(!u.length)return{code:D,columns:a,declarations:l};let{imports:z,aliases:N,body:L}=hr(n,i);for(let W of z)l.push({text:W});l.push({text:`namespace ${i}Scope {
1019
- ${N.join(`
1020
- `)}
1021
- export async function read() {
1022
- ${Cn(L).replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class|interface|type)\b)/gm,"")}
1023
- return {`});for(let[W,V]of u.entries())l.push({text:`value${W}: (`}),l.push({text:V.code,origin:{line:V.line,column:V.column}}),l.push({text:"),"});l.push({text:`}
1024
- }
1025
- }`});for(let W=0;W<u.length;W++)l.push({text:`declare var ${i}_${W}: Awaited<ReturnType<typeof ${i}Scope.read>>['value${W}']`});return{code:D,columns:a,declarations:l}}function hr(e,n){let r=[],{imports:i,body:a}=da(e),l=[],u=0;for(let x of i.split(/\n(?=import\b)/)){if(!x.trim())continue;let f=/^import\s+(?:type\s+)?([\s\S]+?)\s+from\s*(['"][^'"]+['"])/.exec(x);if(!f){r.push(x);continue}let v=`${n}Module${u++}`;r.push(`import * as ${v} from ${f[2]}`);let I=f[1],D=/\{([\s\S]*?)\}/.exec(I);for(let W of D?.[1].split(",")??[]){let[V,G=V]=W.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(V==="default")l.push(`const ${G} = ${v}.default; type ${G} = import(${f[2]}).default`);else if(V)l.push(`import ${G} = ${v}.${V}`)}let z=I.replace(/\{[\s\S]*?\}/,""),N=/\*\s+as\s+(\w+)/.exec(z);if(N)l.push(`import ${N[1]} = ${v}`);let L=/^\s*([\w$]+)/.exec(z)?.[1];if(L)l.push(`const ${L} = ${v}.default; type ${L} = import(${f[2]}).default`)}return{imports:r,aliases:l,body:a}}function xr(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 Ku=["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"],qu=new RegExp(String.raw`^[ \t]*@(?:${Ku.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function Cn(e){return e.replace(qu,(n)=>n.replace(/[^\n]/g," "))}var na=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=on(e),r=[],i=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,a;while((a=i.exec(n))!==null){if(a[1]||a[3])continue;let x=a[2]??a[4]??"",f=a[2]!==void 0?2:3,v=la(x);if(!v.trim())continue;let I=a.index+f+(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,x=0,f=u;for(;f<n.length;f++){let z=n[f];if(z==="(")x++;else if(z===")"){if(x--,x===0)break}}if(x!==0)continue;let v=n.slice(u+1,f),I=v.trim();if(l.lastIndex=f+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],x=a[3]??"",f=u.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(na.has(f)||na.has(u))continue;if(!x.trim())continue;let v=a.index+a[0].indexOf(a[2],a[0].indexOf(u)+u.length)+1;if(ua.has(f)){let D=x.match(/\s+(?:in|of)\s+/);if(!D||D.index===void 0)continue;let z=x.slice(D.index+D[0].length),N=D.index+D[0].length+(z.length-z.trimStart().length);r.push({code:ta(z.trim()),line:jn(n,v+N),column:Mn(n,v+N),offset:v+N,kind:"directive",attribute:f});continue}let I=x.length-x.trimStart().length;r.push({code:ta(x.trim()),line:jn(n,v+I),column:Mn(n,v+I),offset:v+I,kind:"directive",attribute:f})}return r.sort((u,x)=>u.line-x.line||u.column-x.column),r}var Zu=2000;function Ju(e,n){let r=0,i=Math.min(e.length,n+Zu);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 Xu(e){let n=new Map,r=(x,f)=>{let v=x.split(/[,[\]{}()\s]+/).filter(Boolean);for(let I of v){let D=I.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(D))continue;let z=v.length===1?f:void 0,N=n.get(D);if(!N)n.set(D,{name:D,iterable:z});else if(N.iterable!==z)N.iterable=void 0}},i=/^\$?[A-Z_$][\w$]*$/i,a=(x)=>{let f=x.trim();return i.test(f)?f:void 0};for(let x of e.matchAll(/@for(?:each|else)\s*\(/g)){let f=Ju(e,x.index+x[0].length-1);if(f===null)continue;let v=Vt(f);if(!v)continue;r(v.itemVar.replace(/=>/g," "),a(v.arrayExpr))}for(let x of e.matchAll(/@for\s*\(\s*(?:(?:let|const|var)\s+)?([\w$]+|\[[^\]]*\]|\{[^}]*\})\s+(of|in)\s+([^)]*)/g))r(x[1],x[2]==="of"?a(x[3]):void 0);for(let x of e.matchAll(/@for\s*\(\s*(?:let|const|var)\s+([\w$]+)\s*[=;]/g))r(x[1]);let l=on(e);bs.lastIndex=0;let u;while((u=bs.exec(l))!==null){let x=u[1].replace(/\..*$/,"");if(!ua.has(x))continue;let f=u[3].match(/\s+(?:in|of)\s+/);if(!f||f.index===void 0)continue;r(u[3].slice(0,f.index),a(u[3].slice(f.index+f[0].length)))}for(let x of e.matchAll(/@(?:php|js|ts)\b([\s\S]*?)@end(?:php|js|ts)\b/g))for(let f of x[1].matchAll(/\b(?:const|let|var|function|class)\s+([\w$]+)/g))r(f[1]);return[...n.values()].sort((x,f)=>x.name.localeCompare(f.name))}function he(e){return Ml(e)}var yr=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"],Gu={$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 sl(e=new Set){return[...yr.filter((n)=>!e.has(n)).map((n)=>`declare var ${n}: any`),...Object.entries(Gu).filter(([n])=>!e.has(n)).map(([,n])=>n)].join(`
1026
- `)}function ol(e){return new Set([...e.matchAll(/^declare (?:function|const|let|var)\s+([A-Za-z_$][\w$]*)/gm)].map((n)=>n[1]))}function fa(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 Yu(r[1])){let x=u.split(":")[0].trim();if(/^[A-Za-z_$][\w$]*$/.test(x))a.add(x)}}return i?[...a]:null}function Yu(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 da(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(`
1027
- `).map(()=>"").join(`
1028
- `)));return{imports:r.join(`
1029
- `),body:i}}function Bt(e){let n=t(e),r=Array(n.length),i=0;for(let x=0;x<n.length;x++){let f=n[x];if(f==="}"||f===")"||f==="]")i=Math.max(0,i-1);if(r[x]=i,f==="{"||f==="("||f==="[")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 x=u[1],f=u[2],v;if(x==="interface"){let I=n.indexOf("{",u.index);if(I===-1)continue;let D=0;v=-1;for(let z=I;z<n.length;z++)if(n[z]==="{")D++;else if(n[z]==="}"&&--D===0){v=z+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 z=n[D];if(z==="{"||z==="["||z==="("||z==="<")I++;else if(z==="}"||z==="]"||z===")"||z===">")I--;else if(I<=0&&(z===";"||z===`
1030
- `&&!/[=|&,<([{]\s*$/.test(n.slice(Math.max(0,D-40),D)))){v=z===";"?D+1:D;break}}}a.push({name:f,text:e.slice(u.index,v).replace(/^[ \t]*export[ \t]+/,"")}),l.lastIndex=v}return a}function Qu(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 x=0,f=n.length;for(let v=a.index+a[0].length;v<n.length;v++){let I=n[v];if(I==="{"||I==="("||I==="[")x++;else if(I==="}"||I===")"||I==="]")x--;else if(x<=0&&(I===";"||I===`
1031
- `)){f=I===";"?v+1:v;break}}if(/\bdefineProps\s*(?:<|\()/.test(n.slice(a.index,f)))r.push(e.slice(a.index,f).replace(/^[ \t]*export[ \t]+/,"").trim())}return r}function Ri(e){let n=e.filter((a)=>a.kind==="server").map((a)=>a.code).join(`
1032
- `);if(/\bdefineProps\s*(?:<|\()/.test(t(n)))return n;let r=ga(n),i=e.filter((a)=>a.kind!=="server").flatMap((a)=>{let l=Qu(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(`
1033
- `)}function ga(e){return new Set(Bt(e).map((n)=>n.name))}function il(e,n=""){let r=fa(e),i=ga(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["",`// ${np}`,...a,...v.map((I)=>`declare var ${I}: any`)].join(`
1034
- `)}if(r.length===0)return a.length>0?["",`// ${ra}`,...a].join(`
1035
- `):"";let{imports:l,body:u}=da(e),x=u.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),f=["",`// ${ra}`];if(l)f.push(l);return f.push(...a),f.push(`async function ${ia}() {`,x,` return { ${r.join(", ")} }`,"}",`type ${oa} = Awaited<ReturnType<typeof ${ia}>>`,...r.map((v)=>`declare var ${v}: ${oa}[${JSON.stringify(v)}]`)),f.join(`
1036
- `)}function Ai(e){let n=t(e),r=n.split(""),i=[],a=0,l=0;for(let x=0;x<r.length;x++){let f=r[x];if(f===`
1037
- `)l=x+1;if(f==="{"||f==="("||f==="["){if(a===0&&f!=="("&&ep.test(n.slice(l,x))){let v=ma(n,x);if(v!==-1)i.push(...ha(n.slice(x,v+1)))}a++;continue}if(f==="}"||f===")"||f==="]"){a=Math.max(0,a-1);continue}if(a>0&&f!==`
1038
- `)r[x]=" "}let u=he(r.join(""));return i.length===0?u:[...new Set([...u,...i])].sort()}var ep=/^\s*(?:export\s+)?(?:const|let|var)\s*$/;function ma(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 tp(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 sa(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 ha(e){let n=[],r=(a)=>{let l=a.trim().replace(/^\.\.\./,"").trim();if(l.startsWith("{")||l.startsWith("[")){let x=ma(l,0);if(x!==-1)n.push(...ha(l.slice(0,x+1)));return}let u=sa(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 tp(i)){if(!a.trim())continue;if(e[0]==="["){r(a);continue}let l=sa(a);r(l?.char===":"?a.slice(l.index+1):a)}return n}function al(e,n){if(fa(e)!==null)return[];let r=Ai(e),i=De(n,new Set(r)),a=new Set(_);return r.filter((l)=>{if(a.has(l))return!1;if(zt(n,l))return!1;return i.has(l)})}var ra="stx: types for the declared client payload (#1868)",np="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",ia="__stxServerScope",oa="__StxClientPayload";var aa=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","$native","props","slot"];var sp=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function rp(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}=E(a);if(!u)continue;let x=/^([ \t]*(?:export[ \t]+)?const[ \t]+)([A-Za-z_$][\w$]*)[ \t]*(?::[^=\n]+)?=[ \t]*([^\n]+)$/gm;for(let f of a.matchAll(x)){let v=f.index??0;if(l[v+f[1].length]!==0)continue;let I=f[2],D=v+f[0].length-f[3].length,z=i.slice(D,v+f[0].length).trim().replace(/;$/,"").trim(),N=f[3],L=r.test(N)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(N)&&!/[,+\-*/%&|?:=]$/.test(z)&&E(N).balanced;n.set(I,n.has(I)||!L?null:z)}}return new Map([...n].filter((i)=>i[1]!==null))}function xa(e,n,r=0,i=new Set){if(n.size===0||r>=5)return e;let a=t(e),l="",u=0;for(let x of a.matchAll(/[A-Za-z_$][\w$]*/g)){let f=x.index??0,v=x[0],I=n.get(v);if(!I||i.has(v))continue;let D=a.slice(0,f).trimEnd(),z=a.slice(f+v.length).trimStart();if(D.endsWith(".")||/^:(?!:)/.test(z)&&/[{,]$/.test(D))continue;if(f>0&&/[\w$]/.test(a[f-1]))continue;l+=`${e.slice(u,f)}(${xa(I,n,r+1,new Set([...i,v]))})`,u=f+v.length}return l+e.slice(u)}function ip(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 x=i[i.length-1];if(x?.current)x.seen.push(x.current);if(x)x.current=null}break}if(l==="endif"||l==="endunless"){i.pop();continue}let u="";if(a[2]==="("){let x=0,f=a.index+a[0].length-1,v=f+1;for(;f<e.length;f++){let I=e[f];if(I==="(")x++;else if(I===")"){if(x--,x===0)break}}u=e.slice(v,f).trim(),r.lastIndex=f+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 x=i[i.length-1];if(!x)continue;if(x.current)x.seen.push(x.current);x.current=l==="elseif"?u:null}}return i.flatMap((l)=>[...l.seen.map((u)=>`!(${u})`),...l.current?[l.current]:[]]).filter(Boolean)}function op(e){let n=e.code.trim();if(!n)return null;if(e.attribute?.startsWith("@")){if(sp.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 ap=/(\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=ba(e),a=[],l=0;for(let u of e.matchAll(ap)){let x=u.index,[f,v,I,D]=u,z=ca.resolve(n,D).replace(/\\/g,"/"),N=`${v}${I}${z}${I}`;if(a.push(e.slice(l,x),N),l=x+f.length,f.includes(`
1039
- `))continue;let L=_r(i,x),W=r.get(L.line)??[],V=W.at(-1),G=L.column+(V?V.generatedEnd-V.sourceEnd:0);W.push({sourceStart:L.column,sourceEnd:L.column+f.length,generatedStart:G,generatedEnd:G+N.length}),r.set(L.line,W)}return a.push(e.slice(l)),{code:a.join(""),columns:r}}function cp(e,n,r){let i=xr(e.importColumns?.get(n)??[],r);return xr(e.scriptColumns?.get(n)??[],xr(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(/\{[^}]*\}/,""),x=/\*\s*as\s+([A-Z_$][\w$]*)/i.exec(u);if(x)n.add(x[1]);let f=/^\s*([A-Z_$][\w$]*)/i.exec(u);if(f&&f[1]!=="type")n.add(f[1])}return[...n].sort()}function Ii(e,n={}){let r=ke(e),i=n.scriptKinds?r.filter((Z)=>n.scriptKinds.includes(Z.kind)):r,a=Zs(e,n.componentMethodValidator),l=n.filePath&&n.templateExpressions!==!1?Go(e,{filePath:n.filePath,partialsDir:n.partialsDir,layoutsDir:n.layoutsDir,contractsKnown:n.inheritedContractsKnown,readTemplate:n.readComponent}):void 0,u=new Map,x=e.split(`
1040
- `),f=Array.from({length:x.length},()=>""),v=new Map,I=new Map,D=new Map,z=[],N=Ri(r),L=n.filePath&&n.templateExpressions!==!1?zo(e,on(e),{filePath:n.filePath,componentsDir:n.componentsDir,projectRoot:n.projectRoot,readComponent:n.readComponent,scriptCode:(Z,ne)=>ke(Z).map((ae)=>hs(ae.code,ca.dirname(ne))).join(`
1041
- `)}):void 0,W=new Set,V=[];for(let[Z,ne]of i.entries()){let ae=$i(Pi(ne)+ne.code,N,String(Z));for(let[Ee,ye]of ae.columns)I.set(ne.startLine+Ee-1,ye);for(let Ee of ae.declarations)z.push({text:hs(Ee.text,n.originDir??""),origin:Ee.origin?{...Ee.origin,line:Ee.origin.line+ne.startLine-1}:void 0});let fe=ne.kind==="client"&&a?a.project(ae.code):void 0;for(let[Ee,ye]of fe?.columns??[])u.set(ne.startLine+Ee-1,ye);let pe=Cn(fe?.code??ae.code),Ce=eo(pe,n.originDir??"");for(let[Ee,ye]of Ce.columns)D.set(ne.startLine+Ee-1,ye);let Re=Ce.code.split(`
1042
- `);Re.forEach((Ee,ye)=>{let He=ne.startLine-1+ye;if(He<f.length)f[He]=Ee,W.add(He)}),V.push(ne.startLine-1+Re.length-1)}for(let Z of V){let ne=f[Z]?.trim()===""?Z:Z+1;if(ne<f.length&&f[ne].trim()===""&&(ne===Z||!W.has(ne)))f[ne]=";"}let G=(Z,ne)=>{for(let[ae,fe]of Z.split(`
1043
- `).entries())if(f.push(fe),ne)v.set(f.length,ae===0?ne:{...ne,line:ne.line+ae,column:1,prefixLength:0})},U=Ys(i.filter((Z)=>Z.kind==="server").map((Z)=>Z.code).join(`
1044
- `));if(U)G(U);for(let Z of i.filter((ne)=>ne.kind==="server")){let ne=Ut(Z.code);if(!ne?.unsupported)continue;let ae=Z.code.slice(0,ne.offset),fe=Z.startLine+ae.split(`
1045
- `).length-1,pe=ne.offset-Z.code.lastIndexOf(`
1046
- `,ne.offset-1)+(fe===Z.startLine?(Z.startColumn??1)-1:0);G(`;({})[${JSON.stringify(ne.unsupported)}];`,{line:fe,column:pe,anchor:!0})}if(l?.declarations)G(l.declarations);for(let Z of z)G(Z.text,Z.origin);if(a){if(G(a.declarations),n.nativeChecks!==!1)for(let Z of a.checks)G(Z.text,{line:Z.line,column:Z.column,diagnosticOrigin:Z.origin,anchor:!0})}if(n.globals!==!1){G("");let Z=new Set([...i.flatMap((pe)=>he(pe.code)),...i.flatMap((pe)=>xs(pe.code))]),ne=(pe)=>{if(!Z.has(pe)&&!n.declaredGlobals?.includes(pe))G(`declare var ${pe}: any`)};if(n.runtimeGlobals!==!1){if(!Z.has("window"))G("declare var window: any");for(let pe of _)ne(pe)}let ae=[...new Set([...yr,...Pe,...aa])].filter((pe)=>!n.declaredGlobals?.includes(pe)&&(n.runtimeGlobals!==!1||!_.includes(pe)));if(n.contextScope==="global"){G("declare global {");for(let pe of ae)G(` var ${pe}: any`);G("}")}else{for(let pe of yr)ne(pe);for(let pe of Pe)ne(pe);for(let pe of aa)ne(pe)}G(`declare var ${br}: any`);let fe=new Set(i.flatMap((pe)=>he(pe.code)));G(`type ${Qo}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let pe of a?[]:Xu(e)){if(fe.has(pe.name))continue;let Ce=pe.iterable&&fe.has(pe.iterable)?`${Qo}<typeof ${pe.iterable}>`:"any";G(`declare var ${pe.name}: ${Ce}`)}}if(n.templateExpressions!==!1){if(L?.declarations)for(let ne of L.declarations.split(`
1047
- `))G(ne);let Z=Qs(e).map((ne)=>{let ae=L?.events.get(ne.offset??-1);if(ae){ne.anchor=!0;let fe=ne.code.trim(),pe=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(fe),Ce=pe?`void ((${pe[2]}) satisfies __StxAssignedValue<typeof ${pe[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(fe)?`${fe} satisfies (($event: ${ae}) => unknown)`:fe,Re=`;(($event: ${ae}): void => { `;return{expression:ne,statement:{text:`${Re}${Ce} });`,prefixLength:Re.length}}}return{expression:ne,statement:op(ne)}}).filter((ne)=>ne.statement!==null);if(Z.push(...L?.checks||[],...l?.checks||[]),Z.length>0){let ne=on(e),ae=ps(ne),fe=a?Yo(ne):[];if(a)G("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=rp(i.map((ye)=>ye.code)),Re=[...new Set(i.flatMap((ye)=>he(ye.code)))].filter((ye)=>/^[A-Z_$][\w$]*$/i.test(ye)),Ee=0;if(a)G("function __stxNativeTemplate(this: __StxNativeComponent) {");if(Re.length>0){G(Uu);for(let ye of Re)G(`function __StxRead_${ye}() { return ${ye} }`),G(`type __StxT_${ye} = ${pa}<ReturnType<typeof __StxRead_${ye}>>`);G(`;((${Re.map((ye)=>`${ye}: __StxT_${ye}`).join(", ")}) => {`),Ee=1}for(let{expression:ye,statement:He}of Z){let tt=" ".repeat(Ee),ct=ye.offset===void 0?[]:ae.filter((et)=>ye.offset>=et.start&&ye.offset<et.end),nt=ye.offset===void 0?[]:fe.filter((et)=>ye.offset>=et.start&&ye.offset<et.end),ht=nt.map((et)=>`;__stxEach(${et.iterable}, (${et.binding}) => { `).join(""),ut=" });".repeat(nt.length),rt=ht+ct.map((et)=>`;((${et.binding.replace(/[\r\n]/g," ")}: any) => { `).join(""),jt=" });".repeat(ct.length)+ut,je=ye.offset===void 0?[]:ip(ne,ye.offset),Te=je.length>0?`${je.map((et)=>`if (${xa(et,pe)}) `).join("")}{ `:"",pt=je.length>0?" }":"";G(tt+rt+Te+He.text+pt+jt,{line:ye.line,column:ye.column,expression:ye,prefixLength:He.prefixLength+tt.length+rt.length+Te.length,guardPrefixLength:tt.length+rt.length+Te.length})}if(Ee>0)G("});");if(a)G("}")}}let H=!1;if(n.reference&&f[0]!==void 0&&f[0].trim()==="")f[0]=`/// <reference path=${JSON.stringify(n.reference.replace(/\\/g,"/"))} />`,H=!0;return G("export {}"),{text:f.join(`
1048
- `),lineMap:v,sourceLineCount:x.length,componentDependencies:new Map([...L?.dependencies??[],...l?.dependencies??[]]),referenced:H,scriptColumns:I,importColumns:D,componentColumns:u}}function ba(e){let n=[0];for(let r=0;r<e.length;r++)if(e.charCodeAt(r)===10)n.push(r+1);return n}function _r(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 cl(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:cp(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 wr=S(256),lp=[{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"}],ya=/(?:\/\/|\/\*|\{\{--)\s*stx-strict-ignore(-next-line)?([^\n*}]*)/g;function up(e){let n=Array.from(e,(a)=>a===`
1049
- `?`
1050
- `:" "),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]!==`
1051
- `)n[r]=e[r],r++;continue}if(a==="/"&&l==="*"){let u=e.indexOf("*/",r+2),x=u===-1?e.length:u+2;for(;r<x;r++)n[r]=e[r];continue}if(a==="{"&&l==="{"&&e.slice(r,r+4)==="{{--"){let u=e.indexOf("--}}",r+4),x=u===-1?e.length:u+4;for(;r<x;r++)n[r]=e[r];continue}r++}return n.join("")}function pp(e){let n=new Map,r=up(e).split(`
1052
- `),i=e.split(`
1053
- `);return r.forEach((a,l)=>{ya.lastIndex=0;for(let u of a.matchAll(ya)){let x=u[1]==="-next-line",f=(i[l]??"").slice(0,u.index).trim(),v=x||f===""?l+2:l+1,D=(u[2]??"").split("--")[0].split(/[\s,]+/).filter(Boolean),z=D.filter((L)=>/\w/.test(L));if(D.length>0&&z.length===0)continue;let N=n.get(v);if(N&&N.size===0)continue;if(z.length===0){n.set(v,new Set);continue}if(N)z.forEach((L)=>N.add(L));else n.set(v,new Set(z))}}),n}function fp(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=C(e,n,i,JSON.stringify(a)),u=wr.get(l);if(u!==void 0){if(u&&a.failOnViolation)throw new ee(u,i??n);return}let x=a.allowPatterns??[],f=pp(e),v=[],I=t(e.replace(/\{\{--[\s\S]*?--\}\}/g,(L)=>L.replace(/[^\n]/g," ")));for(let{pattern:L,message:W,suggestion:V}of lp){if(x.some((U)=>/\w/.test(U)&&W.includes(U)))continue;L.lastIndex=0;let G=I.match(L);if(G&&G.length>0){let U=I.split(`
1054
- `),H=e.split(`
1055
- `),Z=[];if(U.forEach((pe,Ce)=>{if(L.lastIndex=0,L.test(pe)&&!fp(f,Ce+1,W))Z.push(Ce+1)}),Z.length===0&&U.some((pe)=>(L.lastIndex=0,L.test(pe))))continue;let ne=Z.length>0?` (script line${Z.length>1?"s":""} ${Z.join(", ")})`:"",ae=Z.slice(0,3).map((pe)=>` ${pe} | ${(H[pe-1]??"").trim().slice(0,100)}`).join(`
1056
- `),fe=ae?`
1057
- ${ae}`:"";v.push(` \u2717 ${W}${ne}
1058
- \u2192 ${V}${fe}`)}}if(v.length===0){wr.set(l,"");return}let D=(L)=>{let W=`${process.cwd()}/`;return L.startsWith(W)?L.slice(W.length):L},N=`[STX] DOM API violation in ${i&&i!==n?`${D(i)} (composed into ${D(n)})`:D(n)}:
1059
- ${v.join(`
1060
- `)}
1061
- Tip: prefer useRef(), navigate(), and composables for component code`;if(wr.set(l,N),console.warn(N),a.failOnViolation)throw new ee(N,i??n)}var dp=[{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"}],gp=[{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')"}],mp=[{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 Lg(e){let n=[],r=[];return hp(e,n),xp(e,n,r),bp(e,r),yp(e,n),{valid:n.length===0,errors:n,warnings:r}}function hp(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 xp(e,n,r){for(let i of dp){let a=new RegExp(`${i.open}(?:\\s|\\()`,"g"),l=new RegExp(i.close,"g"),u=(e.match(a)||[]).length,x=(e.match(l)||[]).length;if(i.altClose){let f=new RegExp(i.altClose,"g");x+=(e.match(f)||[]).length}if(u>x)n.push({type:"directive",message:`Unclosed @${i.name} directive: found ${u} opening and ${x} closing`,suggestion:`Add ${u-x} missing ${i.close} tag(s)`});else if(x>u)r.push({type:"directive",message:`Extra ${i.close} found: ${x-u} more closing than opening`,suggestion:`Check for orphaned ${i.close} tags`})}}function bp(e,n){for(let r of gp)if(r.pattern.test(e))n.push({type:"syntax",message:r.message,suggestion:r.suggestion})}function yp(e,n){for(let r of mp)if(r.pattern.test(e))n.push({type:"expression",message:`Security warning: ${r.message}`,suggestion:"Remove dangerous code from template expressions"})}function jg(e,n){let r=e.slice(0,n).split(`
1062
- `);return{line:r.length,column:r[r.length-1].length+1}}function Bg(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 Fg(e){return/@[a-z]+/i.test(e)||/\{\{/.test(e)}function zg(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 _a(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),$r=new Map;function wa(e){try{let n=Ss.statSync(e);return`${n.size}:${n.mtimeMs}`}catch{return""}}var _s=new T(1000),Er=new Map,kr=new T(2000),Cr=new T(500),Ta=33554432,Rr=Ta;function _p(e){let n=e.componentRenderCacheBytes;if(typeof n!=="number"||n<0||n===Rr)return;Rr=n,ws.setMaxBytes(n)}var ws=new T(2000,{maxBytes:Ta,sizeOf:(e)=>e.output.length});function wp(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 Sp(e){let n={};for(let[r,i]of Object.entries(e))if(!r.startsWith("__")||r==="__stxServeContext")n[r]=i;return n}function Sr(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=Sa.get(r);if(i===void 0)i=Bun.hash(Ia(e,n).split(de.sep).join("/")).toString(36).slice(0,6),Sa.set(r,i);return i}var Sa=new Map;function Ia(e,n){if(!de.isAbsolute(e))return e;let r=(i)=>{try{return Ss.realpathSync(i)}catch{return i}};return de.relative(r(n),r(e))}function Hg(e){return/\bjs\b/.test(e)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(e)}function Ge(e){return!Hg(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 va=new WeakMap,vp=256;function Xe(e){try{let n=oe({loader:"ts",target:"browser",define:A()}),r=va.get(n);if(!r)r=new Map,va.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,(x)=>{let f=l.length;return l.push(x),`"__STX_EXPR_${f}__"`}),a=a.replace(/\{\{\{[\s\S]*?\}\}\}/g,(x)=>{let f=l.length;return l.push(x),`"__STX_EXPR_${f}__"`}),a=a.replace(/\{\{[\s\S]*?\}\}/g,(x)=>{let f=l.length;return l.push(x),`"__STX_EXPR_${f}__"`});let u=n.transformSync(a);for(let x=0;x<l.length;x++)u=u.replace(`"__STX_EXPR_${x}__"`,l[x]),u=u.replace(`'__STX_EXPR_${x}__'`,l[x]);if(r.size>=vp){let x=r.keys().next();if(!x.done)r.delete(x.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 $p(e){let n=[],r=new Set,i=0,a=0,l=e.length,u=(N)=>{a++;while(a<l){if(e[a]==="\\"){a+=2;continue}if(e[a]===N){a++;return}a++}},x=()=>{a++;while(a<l){if(e[a]==="\\"){a+=2;continue}if(e[a]==="`"){a++;return}if(e[a]==="$"&&e[a+1]==="{"){a+=2;let N=1;while(a<l&&N>0)if(e[a]==="{")N++,a++;else if(e[a]==="}")N--,a++;else if(e[a]==="'"||e[a]==='"')u(e[a]);else if(e[a]==="`")x();else a++;continue}a++}},f=()=>{if(e[a]==="/"&&e[a+1]==="/"){while(a<l&&e[a]!==`
1063
- `)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 N=a-1;while(N>=0&&/\s/.test(e[N]))N--;if(N<0)return!0;let L=e[N];if("(,=:[!&|?{};+-*%<>~^".includes(L))return!0;if(!/[\w$]/.test(L))return!1;let W=N;while(W>0&&/[\w$]/.test(e[W-1]))W--;return v.has(e.slice(W,N+1))},D=()=>{a++;let N=!1;while(a<l&&e[a]!==`
1064
- `){let L=e[a];if(L==="\\"){a+=2;continue}if(L==="[")N=!0;else if(L==="]")N=!1;else if(L==="/"&&!N){a++;while(a<l&&/[a-z]/i.test(e[a]))a++;return}a++}},z=()=>{if(i!==0)return;let N=e.slice(a).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(N){let G=N[2].split(",").map((U)=>{let H=U.trim().split(":");return H[H.length-1].trim()});for(let U of G)if(U&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(U)&&!r.has(U))n.push(U),r.add(U);return}let L=e.slice(a).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(L){let G=L[2];if(!r.has(G))n.push(G),r.add(G);return}let W=e.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(W){let G=W[1];if(!r.has(G))n.push(G),r.add(G);return}let V=e.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(V){let G=V[1];if(!r.has(G))n.push(G),r.add(G)}};while(a<l){if(f())continue;if(e[a]==="'"||e[a]==='"'){u(e[a]);continue}if(e[a]==="`"){x();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])))z();a++}return n}function Ep(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 kp(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 Cp(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 f=e[i];if(f==="}")l++;else if(f==="{"){if(l--,l===0){u=i;break}}}if(u===-1)return;let x=e.slice(u+1,a);for(let f of Ep(x)){let v=f.trim();if(!v||v.startsWith("..."))continue;let I=kp(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 z=v.slice(I+1).trim();if(!z)continue;try{let N=Object.keys(n).filter(Xt),L=Function(...N,`"use strict"; return (${z});`);n[D]=L(...N.map((W)=>n[W]))}catch{}}}catch{}}var Rp=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function Vg(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(!Rp.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 x=0,f=!1;for(let I of u){if(x+=I.token.startsWith("</")?-1:1,x<0)return null;if(x===0){if(e.slice(I.end).trim())return null;f=!0;break}}if(!f)return null;let v=r+i[0].length;return e.slice(0,v)+n+e.slice(v)}function Pa(e,n){if(!e)return!1;return[...n.additionalComponentsDirs??[],...n.fallbackComponentsDir?[n.fallbackComponentsDir]:[]].some((i)=>{let a=de.relative(de.resolve(i),de.resolve(e));return!a.startsWith("..")&&!de.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((fe)=>fe.charAt(0).toUpperCase()+fe.slice(1)).join(""),x=r.__importedComponents;if(x){for(let ae of[l,l.toLowerCase(),u(l),J(l)])if(x.has(ae))return!0}let f=[...new Set([`${l}.stx`,`${u(l)}.stx`,`${J(l)}.stx`])],v=typeof a.root==="string"?de.resolve(a.root):void 0,I=v??de.dirname(i),D=[],z=(ae)=>{if(ae&&!D.includes(ae))D.push(ae)};for(let ae of Qn(i,v))z(ae);let N=r.__originalFilePath;if(N)z(de.join(de.dirname(N),"components"));if(Pa(n,a))z(a._rootComponentsDir);z(n),z(a._rootComponentsDir),z(de.join(de.dirname(i),"components")),z(a.componentsDir);for(let ae of a.additionalComponentsDirs??[])z(ae);let L=a._targetComponentFallbackNames?.some((ae)=>ae.toLowerCase()===l.toLowerCase());if(!L)for(let ae of a._targetComponentDirs??[])z(ae);if(v)z(de.resolve(v,"resources/views/components")),z(de.resolve(v,"resources/components")),z(de.resolve(v,"src/components")),z(de.resolve(v,"components"));for(let ae of a._layerComponentDirs??[])z(ae);let W=a._pluginComponentDirs;if(Array.isArray(W))for(let ae of W)z(typeof ae==="string"?ae:null);if(z(a.fallbackComponentsDir),L)for(let ae of a._targetComponentDirs??[])z(ae);let V=a._nativePrimitivesFallback;if(V&&!V.except.some((ae)=>ae.toLowerCase()===l.toLowerCase()))z(V.dir);if(l.startsWith("./")||l.startsWith("../"))return s(de.resolve(de.dirname(i),`${l}.stx`));let G=$a(de.resolve(import.meta.dir,"components")),U=D.map((ae)=>de.isAbsolute(ae)?ae:de.resolve(I,ae)),H=`${f.join("\x00")}\x00\x00${U.join("\x00")}`,Z=kr.get(H);if(Z!==void 0)return Z;let ne=!1;e:for(let ae of U){if($a(ae)===G)continue;for(let fe of f)if(await s(de.join(ae,fe))){ne=!0;break e}}return kr.set(H,ne),ne}function $a(e){let n=Cr.get(e);if(n!==void 0)return n;let r=e;try{r=Ss.realpathSync(e)}catch{}return Cr.set(e,r),r}function Ug(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function xl(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 Ap(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 x=String(u);if(/<\/style/i.test(x))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 x};return e.replace(/\{!!([\s\S]*?)!!\}/g,(a,l)=>i(l,a)).replace(/\{\{([\s\S]*?)\}\}/g,(a,l)=>i(l,a))}var Ea=new Set;function ka(e,n,r,i){let a=`${e}\x00${n}\x00${i??""}`;if(!process.env.STX_DEBUG&&Ea.has(a))return;Ea.add(a);let l=n?` used in ${n}`:"",u=i?` Cause: ${i}.`:"",x=r.length>0?`
1065
- searched:
1066
- ${r.map((f)=>` - ${f}`).join(`
1067
- `)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${u}${x}`)}function Ca(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var Tp=new Set(["for","if","show","key","ref","class","className","style"]),Ra=new Set,Oa="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",Sl=new RegExp(`\\b(?:${Oa})\\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|${Oa})\\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,x=new Set,f,v=gt(a),I,D=e){let{extractVariables:z}=await o("stx/variable-extractor",()=>import("./chunk-b4gptdtc.js")),N=x??new Set;if(N.has(e))return`[Circular component reference: ${e}]`;let L=new Set(N);L.add(e);let W=typeof n.client==="string"?n.client.trim():"";if("client"in n)delete n.client;let V=W&&W!=="load"&&Ug(W)?W:"";try{let G=(le)=>le.split("-").map((be)=>be.charAt(0).toUpperCase()+be.slice(1)).join(""),U=D.endsWith(".stx")?D.slice(0,-4):D,H=null,Z=a.__importedComponents;if(Z){let le=[U,U.toLowerCase(),G(U),J(U)];for(let be of le)if(Z.has(be)){H=Z.get(be);break}}let ne=[];if(!H){let le=[`${U}.stx`,`${G(U)}.stx`,`${J(U)}.stx`],be=[...new Set(le)],Ne=a.__originalFilePath,ve=[];for(let $e of Qn(l))if(!ve.includes($e))ve.push($e);let at=ve.length;for(let $e of u._layerComponentDirs??[])if(!ve.includes($e))ve.push($e);if(Ne){let $e=de.join(de.dirname(Ne),"components");ve.push($e)}let Fe=u._rootComponentsDir;if(typeof Fe==="string"&&Pa(i,u)&&!ve.includes(Fe))ve.push(Fe);if(i&&!ve.includes(i))ve.push(i);if(typeof Fe==="string"&&!ve.includes(Fe))ve.push(Fe);let Ct=de.join(de.dirname(l),"components");if(!ve.includes(Ct))ve.push(Ct);if(u.componentsDir&&u.componentsDir!==i&&!ve.includes(u.componentsDir))ve.push(u.componentsDir);for(let $e of u.additionalComponentsDirs??[])if($e&&!ve.includes($e))ve.push($e);let Zt=u._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(U),It=(I?.events??[]).map(($e)=>$e.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),Mt=u._nativeHostAttrs&&/^textinput$/i.test(U),Jt=It.includes("update:value")&&!It.includes("input"),hn=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=hn&&(Gt||Hn)&&(I?.events??[]).every(($e)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test($e.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),Vr=u._targetComponentFallbackNames?.some(($e)=>$e.toLowerCase()===U.toLowerCase())??!1,Is=Vr&&(!Zt||As)&&(!Mt||Jt)&&(!hn||Kn)&&(!Ts||Un)&&!Jn;for(let $e of Is?[]:u._targetComponentDirs??[])if($e&&!ve.includes($e))ve.push($e);let Yt=typeof u.root==="string"?de.resolve(u.root):void 0,Ur=Yt??de.dirname(l),Qt=[];if(Yt)Qt.push(de.resolve(Yt,"resources/views/components")),Qt.push(de.resolve(Yt,"resources/components")),Qt.push(de.resolve(Yt,"src/components")),Qt.push(de.resolve(Yt,"components"));Qt.push(de.resolve(import.meta.dir,"components"));for(let $e of Qt)if(!ve.includes($e))ve.push($e);if(Vr){let $e=(u._componentPackageDirs??[]).filter((ft)=>typeof ft==="string"&&ft.length>0),Rt=(Is?$e.length?$e:u._pluginComponentDirs??[]:u._targetComponentDirs??[]).filter((ft)=>typeof ft==="string"&&ft.length>0);if(Rt.length){let ft=ve.slice(at).map((lt)=>de.isAbsolute(lt)?lt:de.resolve(Ur,lt)).filter((lt)=>!Rt.includes(lt)),Gn=`${U}\x00${ft.join("\x00")}`,_t=Er.get(Gn);if(_t===void 0){_t=!1;for(let lt of ft){for(let Dt of be)if(await s(de.join(lt,Dt))){_t=!0;break}if(_t)break}Er.set(Gn,_t)}if(!_t){for(let lt of Rt){let Dt=ve.indexOf(lt);if(Dt>=0)ve.splice(Dt,1)}ve.splice(at,0,...Rt)}}}let Hr=u._pluginComponentDirs;if(Array.isArray(Hr)){for(let $e of Hr)if(typeof $e==="string"&&!ve.includes($e))ve.push($e)}if(u.fallbackComponentsDir&&!ve.includes(u.fallbackComponentsDir))ve.push(u.fallbackComponentsDir);if(Is){for(let $e of u._targetComponentDirs??[])if($e&&!ve.includes($e))ve.push($e)}let Xn=u._nativePrimitivesFallback;if(Xn&&!Xn.except.some(($e)=>$e.toLowerCase()===U.toLowerCase())&&!ve.includes(Xn.dir))ve.push(Xn.dir);let Zr=[...new Set(ve.map(($e)=>{if(!$e)return $e;return de.isAbsolute($e)?$e:de.resolve(Ur,$e)}))];ve.length=0,ve.push(...Zr);let Ps=`${U}\x00${l}\x00${Zr.join("\x00")}`,Os=_s.get(Ps);if(Os)if(await s(Os))H=Os;else _s.delete(Ps);if(!H&&(U.startsWith("./")||U.startsWith("../")))H=de.resolve(de.dirname(l),`${U}.stx`),ne.push(H);else if(!H)for(let $e of ve){if(!$e)continue;for(let Rt of be){let ft=de.join($e,Rt);if(ne.push(ft),await s(ft)){H=ft;break}}if(H)break;if(!H)try{let Rt=await import("fs");if(!Rt.statSync($e,{throwIfNoEntry:!1})?.isDirectory())continue;let Gn=8,_t=[{path:$e,depth:0}];while(_t.length>0&&!H){let lt=_t.pop();if(lt.depth>=Gn)continue;let Dt;try{Dt=Rt.readdirSync(lt.path,{withFileTypes:!0})}catch{continue}for(let Yn of Dt){if(!Yn.isDirectory())continue;if(Yn.name==="node_modules"||Yn.name.startsWith("."))continue;let Jr=de.join(lt.path,Yn.name);for(let qa of be){let js=de.join(Jr,qa);if(ne.push(js),await s(js)){H=js;break}}if(H)break;_t.push({path:Jr,depth:lt.depth+1})}}}catch{}if(H)break}if(H)_s.set(Ps,H)}if(!H||!await s(H))return ka(e,l,ne),Ca(e);f.add(H);let ae;if(Dn.has(H)&&$r.get(H)===wa(H))ae=Dn.get(H);else try{let le=wa(H);ae=await Bun.file(H).text(),Dn.set(H,ae),$r.set(H,le)}catch(le){let be=le instanceof Error?le.message:String(le);return ka(e,l,[H],be),Ca(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(Tp.has(le)||I.consumedProps?.has(le))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${le.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(ae))continue;let be=`${H}\x00${le}`;if(Ra.has(be))continue;Ra.add(be),console.warn(`[stx] ${de.basename(H)} reads \`${le}\` with defineProps(), which is not live, but ${de.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 fe=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("__")||fe.has(le))pe[le]=be;let Ce=v.length>0?{[us]:[...v]}:{},Re=r;if(r.includes("@include")){let{processIncludes:le}=await o("stx/includes",()=>import("./chunk-88a735jw.js"));Re=await le(r,a,l,u,f)}if(/<[A-Z][\w.-]*[\s/>]/.test(Re)){let{processComponents:le}=await o("stx/component-renderer",()=>import("./chunk-ce0vv7kz.js")),be={...a,__processedComponents:N,...Ce};Re=await le(Re,be,l,u,f);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 Ee=[];if(xl(Re)){let{processExpressions:le}=await o("stx/expressions",()=>import("./chunk-dfsykk1r.js")),be=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...Ce}:v.length>0?{...a,...Ce}:a;Re=le(Re,be,l);for(let Ne of Re.matchAll(/\{\{([\s\S]*?)\}\}/g))Ee.push(Ne[1].trim())}let ye=re(Re),He=[],tt=ye.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(le,be)=>{let Ne=ye.scripts[Number(be)]||"",ve=Ne.match(/^<script\b([^>]*)>/i)?.[1]||"",at=ve.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Fe=!at||["module","text/javascript","application/javascript"].includes(at),Ct=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${ve}`);if(!/\bserver\b/i.test(ve)&&Fe&&!Ct)return He.push(Ne),"";return Ne}),{extractSlotContent:ct}=await o("stx/slots",()=>import("./chunk-q5b0vpmm.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))},rt=Ia(e,process.cwd()),je=`stx_${(rt.endsWith(".stx")?rt.slice(0,-4):rt).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:L,__sections:{},__stx_signals_gate:Oe(ae)||xl(r),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Ee]};if(/import\s/.test(ae)){Te.__importedComponents=new Map(Te.__importedComponents);let{processESImports:le}=await o("stx/component-renderer",()=>import("./chunk-ce0vv7kz.js"));ae=await le(ae,Te,H,u,f)}Cp(ae,Te);let pt=ae,et=j(pt);if(et)pt=et.content.trim();let cn=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,At=[...ae.matchAll(cn)];for(let[,le,be]of At)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(le))Ue(be,H,u.strict);let xt=[],ln=null,$s=At.some((le)=>/\bserver\b/.test(le[1]||"")&&/\bcache\b/.test(le[1]||"")),Ft=null,vt=null,un=null,zn=0,pn=null;if(_p(u),$s&&Rr>0){let le=wp({props:n,slot:Re,slotContext:r.trim()?Sp(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=`${H}\x00${C(ae)}\x00${le}`;let be=ws.get(Ft);if(be){for(let Ne of be.dependencies)f.add(Ne);if(ki(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 ve of be.preservedClientExpressions)Ne.add(ve);a.__stx_preserved_client_expressions=[...Ne]}return be.output}vt=new Set(f),un=Si(a),zn=ut.n,pn=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let fn=new Set;for(let le of At){let be=le[1]||"",Ne=le[2]||"",ve=be.includes("server");if(Ge(be)&&Ne.trim())Ne=Xe(Ne);if(ve&&Ne){for(let Fe of he(Ne))fn.add(Fe);try{await z(Ne,Te,H,{onFailure:(Fe)=>{if(Fe.kind!=="unknown")ln=Fe.kind}})}catch(Fe){}}if(!ve){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,H);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),dn=bt?bt[1]:"",Es=bt?bt[2]:"",$t="",ce=dn&&/\bscoped\b/i.test(dn);if(bt)$t=`<style${dn}>${Ap(Es,Te,H)}</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,ve)=>{let at=ve.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(at)be.push(`<style${at[1]}>${at[2]}</style>`);return""}),ue=ue.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),be.length>0)$t=`${$t}${be.join(`
1068
- `)}`}if(r&&ue.includes("{{ text || slot }}"))ue=ue.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>r);let{applySlots:we}=await o("stx/slots",()=>import("./chunk-q5b0vpmm.js")),{defaultSlot:Le,namedSlots:Ze}=nt,it=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||it&&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?Do(le,je):le,Cs=new Map([...Ze].map(([le,be])=>[le,{...be,content:ks(be.content)}]));ue=await we(ue,yt?Mo(ks(Le),je):Le,Cs,Te,yt?je:"");let Bn=Bi(xt),gn=(Array.isArray(Te.__stx_client_signal_names)?Te.__stx_client_signal_names:[]).filter((le)=>!fn.has(le));if(Bn.length>0||gn.length>0)Te.__stx_client_signal_names=[...new Set([...gn,...Bn])];else delete Te.__stx_client_signal_names;let mn=v.filter((le)=>!fn.has(le)&&!(le in n));if(mn.length>0)Te[us]=mn;let Wn={...u,_rootComponentsDir:u._rootComponentsDir||u.componentsDir,componentsDir:de.dirname(H),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-pczb7xav.js")),Et=await Fn(ue,Te,H,Wn,f),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,ot=Et;if(yt){let le="";if(Object.keys(n).length>0)try{le=` data-stx-props="${Sr(JSON.stringify(n))}"`}catch{}let be=V?` stx-hydrate="${Sr(V)}"`:"",Ne=Object.fromEntries(Object.entries(ht).map(([Mt,Jt])=>[Mt,Boolean(Jt)])),ve=Object.keys(Ne).length>0?` data-stx-slots="${Sr(JSON.stringify(Ne))}"`:"",at=` data-stx-scope="${kt}"${le}${ve}${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"':"";ot=Vg(Et,at)??`<${Vn}${at} data-stx-component-wrapper${Rs}>${Et}</${Vn}>`;let As=await Promise.all(xt.map(async(Mt)=>{let Jt=Mt.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!Jt)return Mt;let[,hn,Ts]=Jt,Un=_a(Mt,Te,H);if(Un!==null)return Un;let Gt=await Pp(Ts,H,u.buildMode==="compile"),Hn=Rn(Gt.clientCode,qe(Te)),{vendorStyleTags:Kn}=Gt,qn=Hn?`function(__scopeId) {
1069
- ${Hn}
1070
- return (${Gt.factoryBody})(__scopeId);
1071
- }`:Gt.factoryBody,Zn=V?null:Hs(a,qn),Jn=Zn?`window.__stxComponentFactories[${JSON.stringify(Zn)}](${JSON.stringify(kt)});`:`(${qn})(${JSON.stringify(kt)});`;if(V)return`${Kn}<script type="stx/island" data-stx-island="${kt}" data-stx-scoped data-stx-owner="${kt}"${hn}>${ge(Jn)}</script>`;return`${Kn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${kt}"${hn}>${ge(Jn)}</script>`}));if(ot=ot+`
1072
- `+As.join(`
1073
- `),$t)ot+=`
1074
- `+$t}else{if($t)ot+=`
1075
- `+$t;if(xt.length>0){let le=Te.__stx_event_bindings||[],be=qe(Te),Ne=await Promise.all(xt.map(async(ve)=>{let at=_a(ve,Te,H);if(at!==null)return at;let Fe=ve.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!Fe)return ve;return await Ke(Fe[1],{eventBindings:le,templateContent:ot,filePath:H,projectRoot:process.cwd(),serverData:be,instanceId:je})}));ot+=`
1076
- `+Ne.join(`
1077
- `),Te.__stx_event_bindings=[]}}if(ce){let le=to(ot,H);if(le.hasScoped)ot=le.html}if(Ft&&vt){let le=Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[];ws.set(Ft,{output:ot,dependencies:[...f].filter((be)=>!vt.has(be)),clientFactories:un?vi(a,un):[],uidsConsumed:ut.n-zn,preservedClientExpressions:pn?le.filter((be)=>!pn.has(be)):[]})}if(ln)ot=`<!--stx-render-failed:${ln}-->${ot}`;return He.length>0?`${ot}
1078
- ${He.join(`
1079
- `)}`:ot}catch(G){if(G instanceof ee)throw G;return`[Error processing component: ${G instanceof Error?G.message:String(G)}]`}finally{N.delete(e)}}async function s(e){return Bun.file(e).exists()}function Tr(e,n){let r=de.resolve(n),i=de.resolve(e),a=r.endsWith(de.sep)?r:r+de.sep;if(i===r||i.startsWith(a))return i;return null}async function Aa(e,n,r,i){let a=n.startsWith("layouts/")?n.slice(8):n,l=de.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 Ip(e,n,r,i);if(a===null)return null;let l=Tr(a,process.cwd());if(l)return l;let u=[r.root,r.layoutsDir,r.fallbackLayoutsDir,r.componentsDir,r.partialsDir,r.pagesDir,...r._layerLayoutDirs??[]].filter((x)=>typeof x==="string"&&x.length>0);for(let x of u){let f=de.isAbsolute(x)?x:de.resolve(process.cwd(),x);if(Tr(a,f))return de.resolve(a)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${a} (template: ${e}, from: ${n})`),null}async function Ip(e,n,r,i){if(r.debug)console.log(`Resolving template path: ${e} from ${n}`);let a=de.dirname(n),l=process.cwd();if(e.startsWith("/")){let N=de.join(l,e),L=Tr(N,l);if(!L)return console.warn(`[stx] rejected template path that escapes project root: ${e} (from ${n})`),null;if(r.debug)console.log(`Checking absolute path: ${L}`);if(await s(L)&&i)i.add(L);return L}let u=async(N)=>{if(!r.layoutsDir||!r.fallbackLayoutsDir)return N;let L=de.relative(de.resolve(l,r.fallbackLayoutsDir),N);if(L.startsWith("..")||de.isAbsolute(L))return N;return await Aa(de.resolve(l,r.layoutsDir),e,i,r.debug)??N},x=de.join(a,e);if(await s(x)){if(r.debug)console.log(`Found direct path: ${x}`);let N=await u(x);if(i)i.add(N);return N}if(!e.endsWith(".stx")&&!e.endsWith(".jsx")&&!e.endsWith(".tsx"))for(let N of[".stx",".tsx",".jsx"]){let L=`${x}${N}`;if(await s(L)){if(r.debug)console.log(`Found direct path with extension: ${L}`);let W=await u(L);if(i)i.add(W);return W}}let f=[];if(f.push(...r._layerLayoutDirs??[]),r.layoutsDir)f.push(de.isAbsolute(r.layoutsDir)?r.layoutsDir:de.resolve(process.cwd(),r.layoutsDir));let v=de.resolve(a),I=process.cwd();for(let N=0;N<10;N++){let L=de.join(v,"layouts"),W=!1;try{W=Ss.statSync(L,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(W){f.push(L);break}let V=de.dirname(v);if(V===v||V.length<I.length)break;v=V}for(let N of f){let L=await Aa(N,e,i,r.debug);if(L)return L}if(r.fallbackLayoutsDir){let N=de.isAbsolute(r.fallbackLayoutsDir)?r.fallbackLayoutsDir:de.resolve(process.cwd(),r.fallbackLayoutsDir),L=e.startsWith("layouts/")?e.slice(8):e,W=[de.join(N,L)];if(!e.endsWith(".stx"))W.push(`${W[0]}.stx`);for(let V of W)if(await s(V)){if(r.debug)console.log(`Found in options.fallbackLayoutsDir: ${V}`);if(i)i.add(V);return V}}if(e.startsWith("layouts/")||e.includes("/layouts/")){let N=e.split("layouts/"),L=de.join(r.partialsDir||a,"layouts",N[1]);if(await s(L)){if(r.debug)console.log(`Found in layouts path: ${L}`);if(i)i.add(L);return L}if(!L.endsWith(".stx")){let W=`${L}.stx`;if(await s(W)){if(r.debug)console.log(`Found in layouts path with extension: ${W}`);if(i)i.add(W);return W}}}if(r.partialsDir){let N=de.join(r.partialsDir,"layouts");if(await s(N)){let L=de.join(N,e);if(await s(L)){if(r.debug)console.log(`Found in partials layouts dir: ${L}`);if(i)i.add(L);return L}if(!e.endsWith(".stx")){let W=`${L}.stx`;if(await s(W)){if(r.debug)console.log(`Found in partials layouts dir with extension: ${W}`);if(i)i.add(W);return W}}}}let D=r.partialsDir||de.join(process.cwd(),"views"),z=de.join(D,e);if(await s(z)){if(r.debug)console.log(`Found in views path: ${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 views path with extension: ${N}`);if(i)i.add(N);return N}}if(a.includes("temp")){let N=de.join(de.dirname(a),"layouts",e);if(await s(N)){if(r.debug)console.log(`Found in temp layouts dir: ${N}`);if(i)i.add(N);return N}if(!e.endsWith(".stx")){let L=`${N}.stx`;if(await s(L)){if(r.debug)console.log(`Found in temp layouts dir with extension: ${L}`);if(i)i.add(L);return L}}}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 kl(e,n,r){let i=0,a="",l="";try{if(typeof n==="number"&&n>=0){let u=e.split(`
1080
- `),x=0;for(let f=0;f<u.length;f++)if(x+=u[f].length+1,x>=n){i=f+1,a=u[f].trim();let v=Math.max(0,f-2),I=Math.min(u.length,f+3);l=u.slice(v,I).map((D,z)=>{let N=v+z+1;return`${N===i?"> ":" "}${N}: ${D}`}).join(`
1081
- `);break}}else if(r){let u=e.indexOf(r);if(u>=0)return kl(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:x}=kl(i,a,l),f=r.split("/").pop(),v=0;if(typeof a==="number"&&a>=0&&i){let D=i.lastIndexOf(`
1082
- `,Math.max(0,a-1));v=a-(D+1)+1}let I="";if(u>0)I+=`
1083
- ${r}:${u}${v>0?`:${v}`:""}: ${e.toLowerCase()} error: ${n}
1084
- `;if(I+=`
1085
- ${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}
1086
- `,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}
1087
- `,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}
1088
- `,I+=`
1089
- ${Be.cyan}${Be.bold}File:${Be.reset} ${Be.dim}${f}${Be.reset}`,u>0)I+=` ${Be.gray}(line ${u}${v>0?`, col ${v}`:""})${Be.reset}`;if(I+=`
1090
- ${Be.yellow}${Be.bold}Message:${Be.reset} ${n}
1091
- `,x)I+=`
1092
- ${Be.blue}${Be.bold}Context:${Be.reset}
1093
- ${Be.dim}${x}${Be.reset}
1094
- `;return I}function _e(){Dn.clear(),$r.clear(),_s.clear(),Er.clear(),kr.clear(),Cr.clear(),ws.clear()}function Ty(){return{size:Dn.size,maxSize:500}}var vr=S(128);async function Pp(e,n,r){let i=C(e,n,r),a=vr.get(i);if(a){if(Js(a.deps))return a;vr.delete(i)}let l=Li(e,{filePath:n,projectRoot:process.cwd()}),u=l.code,x=ji(l.styles);u=Kt(u).code;let{hasUserImports:f,bundleClientScript:v}=await o("stx/client-script-bundler",()=>import("./chunk-k5bbre7d.js")),I=[],D=!1;if(f(u)){let U=u;u=await v(U,n,{projectRoot:process.cwd(),minify:r,collectInputs:I}),D=u===U}let{stripStxRuntimeImports:z}=await o("stx/signal-processing",()=>import("./chunk-ps37r6hj.js"));u=z(u);let N=M(u),L=$p(N),W=new Set(X(N,!0).split(",").map((U)=>U.trim())),V=`function(__scopeId) {
1095
- ${wt("const",[...jl,...L],N)}
1096
- const __scope = window.stx._scopes = window.stx._scopes || {};
1097
- const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
1098
- __scopeVars.$refs = __scopeVars.$refs || {};
1099
- const __previousCurrentElement = window.__STX_CURRENT_ELEMENT__;
1100
- const __previousCurrentProps = window.__STX_CURRENT_PROPS__;
1101
- // A clone the runtime is setting up may not be in the document yet (rows
1102
- // a loop builds inside a closed :if), where a lookup cannot see it, so the
1103
- // runtime hands its root over in __STX_SETUP_ROOT__ (signals.ts).
1104
- const __setupRoot = window.__STX_SETUP_ROOT__;
1105
- const __componentElement = (__setupRoot && __setupRoot.getAttribute('data-stx-scope') === __scopeId && __setupRoot) || document.querySelector('[data-stx-scope="' + __scopeId + '"]');
1106
- __scopeVars.$slots = Object.create(null);
1107
- if (__componentElement) {
1108
- try { Object.assign(__scopeVars.$slots, JSON.parse(__componentElement.getAttribute('data-stx-slots') || '{}')); }
1109
- catch {}
1110
- }
1111
- window.__STX_CURRENT_ELEMENT__ = __componentElement;
1112
- let __componentProps = __componentElement && __componentElement.__stx_props;
1113
- if (!__componentProps && __componentElement) {
1114
- try { __componentProps = JSON.parse(__componentElement.getAttribute('data-stx-props') || '{}'); }
1115
- catch { __componentProps = {}; }
1116
- }
1117
- window.__STX_CURRENT_PROPS__ = __componentProps && typeof __componentProps === 'object' && !Array.isArray(__componentProps) ? __componentProps : {};
1118
- const __scopeProps = window.__STX_CURRENT_PROPS__;
1119
- Object.defineProperty(__scopeVars, '$props', { configurable: true, enumerable: true, get: function() {
1120
- return (__componentElement && __componentElement.__stx_props) || __scopeProps;
1121
- } });
1122
-
1123
- // Scope-specific lifecycle callbacks. The queues drain as they run; the
1124
- // hook lists keep what setup registered, because a component behind an :if
1125
- // unmounts at each hide and mounts again at each show (signals.ts,
1126
- // suspendSubtreeScopes).
1127
- if (__scopeVars.__suspended && !__scopeVars.__mounted) {
1128
- // Set up again after an :if hid it -- a <template :if> clones the
1129
- // component afresh on every show, and the clone's script runs. This run's
1130
- // hooks close over this run's state, so they replace the ones the hide
1131
- // kept for a re-show rather than queueing beside them.
1132
- __scopeVars.__mountCallbacks = [];
1133
- __scopeVars.__destroyCallbacks = [];
1134
- __scopeVars.__mountHooks = [];
1135
- __scopeVars.__destroyHooks = [];
1136
- // So do its effects: the last run's watched a clone that is gone.
1137
- if (typeof __scopeVars.__disposeEffects === 'function') __scopeVars.__disposeEffects();
1138
- __scopeVars.__disposeEffects = null;
1139
- }
1140
- __scopeVars.__mountCallbacks = __scopeVars.__mountCallbacks || [];
1141
- __scopeVars.__destroyCallbacks = __scopeVars.__destroyCallbacks || [];
1142
- __scopeVars.__mountHooks = __scopeVars.__mountHooks || [];
1143
- __scopeVars.__destroyHooks = __scopeVars.__destroyHooks || [];
1144
- let __registeringSetupHooks = true;
1145
- const onMount = (fn) => { __scopeVars.__mountCallbacks.push(fn); __scopeVars.__mountHooks.push(fn); };
1146
- const onDestroy = (fn) => {
1147
- __scopeVars.__destroyCallbacks.push(fn);
1148
- // A teardown registered inside onMount belongs to this mount alone.
1149
- // Replaying it AND registering the next mount's teardown doubles cleanup.
1150
- if (__registeringSetupHooks) __scopeVars.__destroyHooks.push(fn);
1151
- };
1152
- // The effects this setup makes (effect, watch) belong to the scope and are
1153
- // disposed with it (disposeSubtreeScopes in the runtime), as its bindings
1154
- // are. Untracked, one reading a store kept running for a component the
1155
- // router had long swapped out.
1156
- const __endEffects = window.stx._beginEffects ? window.stx._beginEffects() : null;
1157
-
1158
- try {
1159
- ${N}
1160
-
1161
- // Register all defined signals and functions in this scope
1162
- const __localVars = {};
1163
- try {
1164
- ${L.map((U)=>W.has(U)?`Object.defineProperty(__localVars, '${U}', ${Ws(U)});`:`if (typeof ${U} !== 'undefined') __localVars['${U}'] = ${U};`).join(`
1165
- `)}
1166
- }
1167
- catch (e) {}
1168
- Object.defineProperties(__scopeVars, Object.getOwnPropertyDescriptors(__localVars));
1169
- if (typeof __stxLiveBindings !== 'undefined') Object.defineProperties(__scopeVars, Object.getOwnPropertyDescriptors(__stxLiveBindings));
1170
- }
1171
- finally {
1172
- __registeringSetupHooks = false;
1173
- if (__endEffects) {
1174
- const __previousDispose = __scopeVars.__disposeEffects;
1175
- const __disposeSetup = __endEffects();
1176
- __scopeVars.__disposeEffects = typeof __previousDispose === 'function'
1177
- ? function() { __previousDispose(); __disposeSetup(); }
1178
- : __disposeSetup;
1179
- }
1180
- window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
1181
- window.__STX_CURRENT_PROPS__ = __previousCurrentProps;
1182
- }
1183
- }`,G={vendorStyleTags:x,factoryBody:V,clientCode:N,deps:Pr([...I,...l.styles.map((U)=>U.resolvedPath)])};if(!D&&l.unresolved.length===0)vr.set(i,G);return G}var Op=100,jp=599,Br="__stxResponseStatus",Ln="__stxResponseHeaders";function vs(e){return typeof e==="number"&&Number.isInteger(e)&&e>=Op&&e<=jp}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 zr(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[Br]=r,!0}function Mp(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?.[Br];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 ll(e,n){if(!e||!n||e===n||typeof n!=="object")return;let r=Wt(e);if(r!==void 0)n[Br]=r;let i=qt(e);if(i)n[Ln]={...n[Ln],...i}}function no(e){return{setResponseStatus:(n)=>{zr(e,n)},notFound:(n=404)=>{let r=vs(n)&&n>=400?n:404;zr(e,r)},setResponseHeader:(n,r)=>{Mp(e,n,r)}}}function ul(e,n,r={}){if(!e.includes("@status"))return e;let{filePath:i,buildMode:a}=r,l=a==="compile",u="",x=0,f=/@status\s*\(/g,v;while((v=f.exec(e))!==null){let I=Dp(e,v.index+v[0].length-1);if(I<0)break;let D=e.slice(v.index+v[0].length,I).trim(),z=/^\d+$/.test(D)?Number(D):d(D,n),N=i?` in ${i}`:"";if(l)console.warn(`[stx] @status(${D})${N} 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(!zr(n,z))console.warn(`[stx] @status(${D})${N} is not an HTTP status (100-599) \u2014 ignoring it.`);u+=e.slice(x,v.index),x=I+1+(e.slice(I+1).match(/^[^\S\n]*\n?/)?.[0].length??0),f.lastIndex=x}return x===0?e:u+e.slice(x)}function Dp(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 ja=new Set(mt),Np=new Set(["props","$props","defineProps"]),Lp=new Set(["stx","@stacksjs/stx"]),Ma=S(128),Da=S(64);function zp(e){let n=[],r=0,i=e.split(`
1184
- `);for(let a of i){let l=r,u=null,x=!1;for(let f=0;f<a.length;f++){let v=a[f];if(x){x=!1;continue}if(v==="\\"){x=!0;continue}if(u){if(v===u)u=null;continue}if(v==="'"||v==='"'||v==="`"){u=v;continue}if(v==="/"&&f+1<a.length&&a[f+1]==="/")break;if(v==="{")r++;else if(v==="}")r--}if(l===0){let f=a.match(/(?:const|let|var)\s+(\w+)\s*=/);if(f)n.push(f[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((z)=>{let N=z.split(":");return(N.length>1?N[1]:N[0]).trim()}).filter((z)=>/^\w+$/.test(z));n.push(...D)}}}}return[...new Set(n)]}function $g(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,x=0,f=null;for(let v=0;v<i.length;v++){let I=i[v];if(f){if(l+=I,I===f)f=null;continue}if(I==='"'||I==="'"||I==="`"){f=I,l+=I;continue}if(I==="<")u++;else if(I===">"&&u>0)u--;else if(I==="(")x++;else if(I===")")x--;if(I===","&&u===0&&x===0){a.push(l),l="";continue}l+=I}if(l)a.push(l);return a.map((v)=>{let I=v.trim(),D=I.startsWith("..."),z=D?I.slice(3):I,N=-1,L=0;for(let ne=0;ne<z.length;ne++)if(z[ne]==="<")L++;else if(z[ne]===">")L--;else if(z[ne]===":"&&L===0){N=ne;break}if(N===-1)return v;let V=z.substring(0,N).trim().replace(/\?$/,""),G=z.substring(N+1),U=-1,H=0;for(let ne=0;ne<G.length;ne++)if(G[ne]==="<")H++;else if(G[ne]===">")H--;else if(G[ne]==="="&&H===0){U=ne;break}let Z=D?"...":"";if(U!==-1)return`${Z}${V} = ${G.substring(U+1).trim()}`;return`${Z}${V}`}).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,x=1,f=u+1,v=0,I=null;while(f<n.length&&x>0){let N=n[f];if(I){if(N===I)I=null;f++;continue}if(N==='"'||N==="'"||N==="`"){I=N,f++;continue}if(N==="<")v++;else if(N===">"&&v>0)v--;else if(v===0){if(N==="(")x++;else if(N===")")x--}if(x>0)f++}if(x!==0)continue;let D=n.substring(u+1,f);if(!D.includes(":"))continue;let z=r(D);l.push({start:u+1,end:f,replacement:z})}for(let u=l.length-1;u>=0;u--){let{start:x,end:f,replacement:v}=l[u];n=n.substring(0,x)+v+n.substring(f)}}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[x,...f]=u.split("="),v=x.split(":")[0].trim();if(f.length>0)return`${v} = ${f.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,`
1185
-
1186
- `),n}function Rg(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 Ag(e){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(e)}function Pg(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 Ig(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 Na=new Set;async function h(e,n,r,i={}){if(!e.trim())return;let a=A(),l=C(e,JSON.stringify(a)),u=Ma.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=$g(e)}Ma.set(l,u)}let x={exports:{}},f=x.exports,v=an.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)),z=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),we=St.join(ue,"package.json"),Le=JSON.parse(b("fs").readFileSync(we,"utf8")),Ze=Le.main||"index.js";if(Le.exports){let it=typeof Le.exports==="string"?Le.exports:Le.exports["."];if(typeof it==="string")Ze=it;else if(it?.bun)Ze=it.bun;else if(it?.import)Ze=it.import;else if(it?.default)Ze=it.default}I[ce]=await import(St.resolve(ue,Ze))}catch(ue){if(ce.startsWith("."))z.set(ce,ue instanceof Error?ue.message:String(ue))}let N=(ce)=>{if(I[ce])return I[ce];let ue=z.get(ce);if(ue!==void 0)throw Error(`Cannot require '${ce}' from ${r}: ${ue}`);return b(ce)},L=n.props||{},W=(ce)=>{if(!ce)return L;let ue={};for(let[we,Le]of Object.entries(ce)){let Ze=L[we];if(Ze!==void 0)ue[we]=Ze;else if(typeof Le==="function")ue[we]=Le();else ue[we]=Le}return ue};for(let[ce,ue]of Object.entries(L))Object.defineProperty(W,ce,{value:ue,enumerable:!0,configurable:!0,writable:!0});let V=(ce,ue=!1)=>{if(ce===void 0||ce===null)return ue;if(typeof ce==="string"){let we=ce.trim().toLowerCase();if(we===""||we==="true"||we==="1"||we==="on"||we==="yes")return!0;if(we==="false"||we==="0"||we==="off"||we==="no")return!1;return!0}return Boolean(ce)},G=(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 we=Number(ce);return Number.isFinite(we)?we:ue};for(let ce of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(L,ce))continue;try{Object.defineProperty(W,ce,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let U=(ce)=>{if(!ce)return L;let ue={...L};for(let[we,Le]of Object.entries(ce)){let Ze=Le&&typeof Le==="object"&&!Array.isArray(Le)?Le:{type:Le};if(ue[we]===void 0&&Ze.default!==void 0)ue[we]=typeof Ze.default==="function"?Ze.default():Ze.default}return ue},H=()=>n.slots||{},Z=(ce,ue)=>{let we={...ce};for(let[Le,Ze]of Object.entries(ue))if(we[Le]===void 0)if(typeof Ze==="function")we[Le]=Ze();else we[Le]=Ze;return we},ne=(ce)=>{let ue=()=>ce;return ue.set=(we)=>{},ue.update=(we)=>{},ue},ae=(ce)=>{let ue,we=!1;return()=>{if(!we)try{ue=ce(),we=!0}catch{ue=void 0}return ue}},fe=(ce)=>{},pe=(ce)=>ce(),Ce=(ce)=>{},Re=(ce)=>{},Ee=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??"",we=ce?.path??"",Le=Object.fromEntries(new URLSearchParams(ue)),Ze=n.query,it=Object.keys(Le).length>0?Le:Ze??{},yt=ue||(Object.keys(it).length>0?`?${new URLSearchParams(it).toString()}`:"");return{params:n.params??{},query:it,path:we,name:"",fullPath:we+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}),rt=(ce)=>ce,jt=(ce)=>({value:typeof ce==="function"?ce():ce}),je=(ce,ue)=>{},Te=(ce)=>{},pt=(ce)=>{},et=(ce)=>ce?ce():Promise.resolve(),cn=(ce)=>(ue,...we)=>{},At=(ce)=>{},xt=(ce,ue)=>{},ln=(ce,ue)=>ue,$s=()=>({value:"light"}),Ft=()=>ne(!1),vt=(ce)=>ne(!1),un=()=>ne(!1),zn=()=>vt("(prefers-color-scheme: dark)"),pn=()=>vt("(prefers-color-scheme: light)"),fn=()=>vt("(prefers-reduced-motion: reduce)"),Fr=()=>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:{}},dn=new Proxy(bt,{get(ce,ue){if(ue in ce)return ce[ue];return},set(ce,ue,we){return ce[ue]=we,!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(L)),we=Object.keys(n).filter((le)=>!ue.has(le)&&!Np.has(le)&&Xt(le)),Le=we.map((le)=>n[le]);if(!we.includes("__stxServeContext"))we.push("__stxServeContext"),Le.push(void 0);if(!ue.has("cookies")){let le=n.cookies??n.__stxServeContext?.cookies??{},be=we.indexOf("cookies");if(be<0)we.push("cookies"),Le.push(le);else Le[be]=le}let Ze=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),it=[],yt=[];for(let[le,be]of Object.entries(L)){if(!Xt(le))continue;if(Ze.has(le))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${le}\\b`).test(ce))continue;it.push(le),yt.push(be)}let Cs=zp(ce).map((le)=>`module.exports.${le} = typeof ${le} !== 'undefined' ? ${le} : module.exports.${le};`).join(`
1187
- `),Bn=n.params??{},gn=[],mn=[];for(let le=0;le<we.length;le++){if(we[le]==="params")continue;gn.push(we[le]),mn.push(Le[le])}let Wn=[...mt,...it,...gn],Fn=`return (async () => {
1188
- ${ce}
1189
- ${Cs}
1190
- return module.exports
1191
- })()`,Et=C(Fn,Wn.join("\x00")),Tt=Da.get(Et);if(!Tt)Tt=Function(...Wn,Fn),Da.set(Et,Tt);let kt=n.__stx_options?.runtimeConfig;if(kt||/\buse(?:Server)?RuntimeConfig\b/.test(u))await On(n,r,kt);let ot=await Ye(n.__stx_runtime_config??Nn()??F(),()=>Gr(n,()=>Tt(x,f,N,L,W,V,G,U,Z,He,Yr,Ui,ao,ne,ae,fe,pe,Ce,Re,ye,tt,ct,nt,ht,Ee.setResponseStatus,Ee.setResponseHeader,Ee.notFound,ut,rt,jt,je,Te,pt,et,cn,At,H,xt,ln,$s,Ft,vt,un,zn,pn,fn,Fr,dn,Es,$t,bt.confirm,bt.alert,bt.fetch,Bn,...yt,...mn)));if(i.preserveExisting){for(let[le,be]of Object.entries(ot))if(!(le in n)||n[le]===void 0)n[le]=be}else Object.assign(n,ot);for(let[le,be]of Object.entries(L))if(!(le in n))n[le]=be}catch(ce){if(n.__stx_strict_hydration)throw ce;let ue=Rg(ce instanceof Error?ce.message:String(ce));if(Ag(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(Pg(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(Ig(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 we=`${r??"<unknown>"}\x00${ue}`;if(an.env.STX_DEBUG||!Na.has(we))Na.add(we),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 Hp(u,n,r)}catch(we){if(an.env.STX_DEBUG){let Le=we instanceof Error?we.message:String(we);console.warn(`[stx] fallback extraction also failed in ${r??"<unknown>"}: ${Le}`)}}}}function Og(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 Bp=/^(?: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):an.cwd(),i=an.cwd(),a=e.split(`
1192
- `),l=[],u=0;while(u<a.length){let x=a[u].trim();if(x.startsWith("interface ")||x.startsWith("export interface ")||x.startsWith("type ")||x.startsWith("export type ")){if(x.includes("{")&&!x.includes("}")){let f=0;for(;u<a.length;u++){for(let v of a[u])if(v==="{")f++;else if(v==="}")f--;if(f<=0)break}}u++;continue}if(x.startsWith("definePageMeta(")){let f=0,v=!1,I=u;for(let N=u;N<a.length&&!v;N++){let L=null,W=!1,V=a[N];for(let G=0;G<V.length;G++){let U=V[G];if(W){W=!1;continue}if(U==="\\"){W=!0;continue}if(L){if(U===L)L=null;continue}if(U==='"'||U==="'"||U==="`"){L=U;continue}if(U==="(")f++;else if(U===")"){if(f--,f===0){u=N+1,v=!0;break}}}}if(!v)u=a.length;let D=a.slice(I,u).join(`
1193
- `),z=[];for(let N of["title","description"]){let L=new RegExp(`\\b${N}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(D);if(L)z.push(`${N}: ${JSON.stringify(L[2])}`)}if(z.length>0)l.push(`useSeoMeta({ ${z.join(", ")} });`);continue}if(x.startsWith("import ")||x==="import"||x.startsWith("import{")||/^import['"]/.test(x)){let f=x,v=0;while(!Og(f)&&u+v+1<a.length)v++,f=`${f} ${a[u+v].trim()}`;u+=v;let I=f.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),D=f.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),z=f.match(/^import\s*['"](.+?)['"]/),N=f,L=(W)=>{if(W.startsWith("."))return St.resolve(r,W);if(W.startsWith("~/")||W.startsWith("@/"))return St.resolve(i,W.slice(2));try{return Bun.resolveSync(W,r)}catch{return W}};if(I){let[,W,V]=I,G=L(V);l.push(`const ${W} = (await import('${G}')).default`),l.push(`module.exports.${W} = ${W};`)}else if(D){let[,W,V]=D,G=L(V),U=[],H=[],Z=Lp.has(V);for(let ne of W.split(",")){let ae=ne.trim();if(!ae)continue;let fe=ae.split(/\s+as\s+/);if(fe.length===2){let[pe,Ce]=[fe[0].trim(),fe[1].trim()];if(Z&&ja.has(pe)){l.push(`const ${Ce} = ${pe};`);continue}U.push(`${pe}: ${Ce}`),H.push(Ce)}else{if(Z&&ja.has(ae))continue;U.push(ae),H.push(ae)}}if(U.length>0)l.push(`const { ${U.join(", ")} } = await import('${G}')`);for(let ne of H)l.push(`module.exports.${ne} = ${ne};`)}else if(z){let W=L(z[1]);l.push(`await import('${W}')`)}else l.push(N);u++;continue}if(Bp.test(x))l.push(a[u]),u++;else if(x.startsWith("export const ")||x.startsWith("export let ")||x.startsWith("export var ")){let f=za(a,u),{type:v,name:I,value:D}=f;l.push(`${v} ${I} = ${D};`),l.push(`module.exports.${I} = ${I};`),u=f.nextIndex}else if(x.startsWith("export function ")||x.startsWith("export async function ")){let f=Wr(a,u);l.push(f.functionCode),l.push(`module.exports.${f.name} = ${f.name};`),u=f.nextIndex}else if(x.startsWith("const ")||x.startsWith("let ")||x.startsWith("var ")){let f=za(a,u),{type:v,name:I,value:D}=f;l.push(`${v} ${I} = ${D};`),l.push(`module.exports.${I} = ${I};`),u=f.nextIndex}else if(x.startsWith("function ")||x.startsWith("async function ")){let f=Wr(a,u);l.push(f.functionCode),l.push(`module.exports.${f.name} = ${f.name};`),u=f.nextIndex}else if(x.startsWith("export default function ")||x.startsWith("export default async function ")){let f=a[u].replace(/^(\s*)export\s+default\s+/,"$1"),v=[...a];v[u]=f;let I=Wr(v,u);if(l.push(I.functionCode),I.name)l.push(`module.exports.default = ${I.name};`);u=I.nextIndex}else if(x.startsWith("export default ")){let f=x.replace(/^export\s+default\s+/,"").replace(/;$/,"");l.push(`module.exports.default = ${f};`),u++}else if(x.startsWith("class ")||x.startsWith("export class ")){let f=x.match(/(?:export\s+)?class\s+(\w+)/);if(f){let v=f[1],I=a[u].replace(/^export\s+/,""),D=0,z=u;for(;z<a.length;z++){let N=a[z];for(let L of N)if(L==="{")D++;else if(L==="}")D--;if(z>u)I+=`
1194
- `+N;if(D<=0&&z>=u)break}l.push(I),l.push(`module.exports.${v} = ${v};`),u=z+1}else l.push(x),u++}else if(x.includes("module.exports"))l.push(x),u++;else if(x.trim()&&!x.startsWith("//"))l.push(x),u++;else u++}return Wp(l.join(`
1195
- `),r,i)}function Wp(e,n,r){let i=e.length,a="",l=0,u=null,x=!1,f=!1,v=0;while(l<i){let I=e[l],D=e[l+1];if(x){if(a+=I,I===`
1196
- `)x=!1;l++;continue}if(f){if(a+=I,I==="*"&&D==="/"){a+=D,l+=2,f=!1;continue}l++;continue}if(!u&&I==="/"&&D==="/"){x=!0,a+=I,l++;continue}if(!u&&I==="/"&&D==="*"){f=!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 z=Fp(e,l);if(z){let{quote:N,path:L,end:W}=z;if(L.startsWith(".")||L.startsWith("~/")||L.startsWith("@/")){let V=L.startsWith(".")?St.resolve(n,L):St.resolve(r,L.slice(2));a+=`await import(${N}${V}${N})`,l=W;continue}}}a+=I,l++}return a}function Fp(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 Va(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 Ua(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 x=a===0?Va(r,i):null;if(x){n.push(...Ua(x.pattern)),i=x.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 Ng(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 x=e[r+1],f=e[r-1];if(x!=="="&&x!==">"&&f!=="="&&f!=="!"&&f!=="<"&&f!==">")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 La(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 za(e,n){let r=e[n].trim(),i=Ng(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),z=n;if(D.startsWith("{")||D.startsWith("[")){let L=D[0],W=L==="{"?"}":"]",V=La(D,L,W,0),G=D;for(let U=n+1;U<e.length&&V>0;U++)G+=` ${e[U].trim()}`,z=U,V=La(e[U],L,W,V);if(V>0)G=D,z=n;D=G}let N=Va(D,0);if(N){let L=I[1],W=N.pattern,V=D.slice(N.endPos).trim();if(V.startsWith("=")){let G=V.slice(1).trim(),U=G,H=Math.max(z,n);if(Ba(G)){let fe=Wa(e,H,G);U=fe.value,H=fe.nextIndex}else H=H+1;U=U.trim().replace(/;$/,"");let Z=Ua(W),ne=`__stx_src_${n}`,ae=Z.map((fe)=>`module.exports.${fe} = ${fe};`).join(`
1197
- `);return{type:L,name:ne,value:`${U}; ${L} ${W} = ${ne};
1198
- ${ae}`,nextIndex:H}}}}throw Error(`Failed to parse variable declaration: ${r}`)}let[,l,u,x]=a,f=x,v=n;if(Ba(x)){let I=Wa(e,n,x);f=I.value,v=I.nextIndex}else v=n+1;while(v<e.length){let I=e[v].trim();if(I.startsWith(".")||I.startsWith("?."))f+=`
1199
- ${e[v]}`,v++;else break}return f=f.trim().replace(/;$/,""),{type:l,name:u,value:f,nextIndex:v}}function Wr(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(Vp(r)){let x=Up(e,n,l);l=x.functionCode,u=x.nextIndex}else u=n+1;return{name:a,functionCode:l,nextIndex:u}}function Ba(e){let n=e.trim();if(n.startsWith("{"))return k(n,"{","}",0)===-1;if(n.startsWith("["))return k(n,"[","]",0)===-1;return!Ha(n)}function Ha(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 Ka(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 Vp(e){let n=Ka(e);if(n===-1)return!0;return k(e,"{","}",n)===-1}function Wa(e,n,r){let i=r,a=n+1;while(a<e.length&&!Ha(i)){let l=e[a];i+=`
1200
- ${l}`,a++}while(a<e.length){let l=e[a].trim();if(l.startsWith(".")||l.startsWith("?."))i+=`
1201
- ${e[a]}`,a++;else break}return{value:i,nextIndex:a}}function Up(e,n,r){let i=r,a=n+1;while(a<e.length){let l=Ka(i);if(l!==-1){if(k(i,"{","}",l)!==-1)break}let u=e[a];i+=`
1202
- ${u}`,a++}return{functionCode:i,nextIndex:a}}function Fa(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:{...an.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 Hp(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,x]=l;try{let f=x.trim().replace(/;$/,""),v=Fa(f,n);if(v!==void 0)n[u]=v}catch(f){console.warn(`Failed to parse export ${u} in fallback:`,f)}}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,x]=l;if(!(u in n))try{let f=x.trim().replace(/;$/,""),v=Fa(f,n);if(v!==void 0)n[u]=v}catch{}}}function yl(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 bl(e){let n=e.trim();if(!n)return!1;return/(?:const|let|var|function)\s+\w+/.test(n)}
1203
- export{Ve,Ae,X,Ws,qs,J,Ar,Ks,Gs,_i,Ci,Ei,Xs,Ti,el,zt,o,ge,S,tl,C,Pr,Js,Pe,A,Ue,j,Ht,Ie,Q,_n,We,w,nl,xe,re,Ir,Se,Or,Nr,me,Vt,se,B,gt,q,Mr,Dr,mt,rl,Ut,Ys,Zs,ke,$i,Cn,Qs,he,sl,ol,Ri,il,Ai,al,eo,Pi,Ii,cl,Oi,Ni,En,to,Tn,Wt,qt,ll,no,ul,dl,$n,Lr,ro,so,pl,Mi,fl,gl,ml,hl,$g,Rg,Ag,Pg,Ig,h,Og,Di,Ng,yl,bl,Li,ji,Mg,Kt,wl,Dg,vl,Ey,qe,Rn,Ke,Lg,jg,Bg,Fg,zg,oo,Hg,Ge,oe,Xe,Vg,jr,Ug,xl,Sl,Bi,Je,s,An,kl,y,_e,Ty,_l,Cl,El,Fi,io,Wg,$y,qg,Ry,Pn,g,Y,ie,In,Oe,Kg,zi,Gg,Ay,P,Hi,Xg,Py,O,Iy};