zen-code 4.8.5 → 4.8.6

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 (417) hide show
  1. package/dist/app.js +150 -162
  2. package/dist/{chunk-pbe0n109.js → chunk-02vv5584.js} +1 -1
  3. package/dist/{chunk-3fp2k4jh.js → chunk-0a26n1zy.js} +2 -2
  4. package/dist/{chunk-hbhwzk5x.js → chunk-0f022x9v.js} +1 -1
  5. package/dist/{chunk-ya599ak5.js → chunk-0kqqh5rr.js} +2 -2
  6. package/dist/{chunk-hps6tv25.js → chunk-141pasd6.js} +2 -2
  7. package/dist/{chunk-gs9s59d4.js → chunk-1rnd4taj.js} +1 -1
  8. package/dist/chunk-2e7zh8he.js +1 -0
  9. package/dist/chunk-2y73pxem.js +1 -0
  10. package/dist/{chunk-j7f3n1aj.js → chunk-4fwb6qr1.js} +1 -1
  11. package/dist/{chunk-xf4jswm4.js → chunk-5kmnxyd8.js} +1 -1
  12. package/dist/chunk-6hpehtte.js +2 -0
  13. package/dist/chunk-6yeg1jc7.js +1 -0
  14. package/dist/{chunk-m0e2jefq.js → chunk-8vkm1ts6.js} +2 -2
  15. package/dist/{chunk-v5mgjgc4.js → chunk-8ypsygqy.js} +2 -2
  16. package/dist/chunk-903s8sk9.js +1 -0
  17. package/dist/{chunk-pp1gnpdp.js → chunk-aeambwc5.js} +3 -3
  18. package/dist/{chunk-7en8vahs.js → chunk-bzgj8aae.js} +1 -1
  19. package/dist/{chunk-45bkb77s.js → chunk-c6nzmyns.js} +2 -2
  20. package/dist/chunk-cqrb18vt.js +1 -0
  21. package/dist/chunk-czbkc7pc.js +1 -0
  22. package/dist/{chunk-558jjzha.js → chunk-ed6aprzz.js} +1 -1
  23. package/dist/chunk-ema4rc9d.js +2 -0
  24. package/dist/{chunk-zssv316b.js → chunk-emv4z7ck.js} +66 -66
  25. package/dist/chunk-f4tc5awt.js +1 -0
  26. package/dist/chunk-f7d0m4h3.js +1 -0
  27. package/dist/chunk-favbv2tp.js +1 -0
  28. package/dist/{chunk-dv9rvc0a.js → chunk-fbg1z6br.js} +1 -1
  29. package/dist/{chunk-jfecjzq0.js → chunk-fnrbq03p.js} +2 -2
  30. package/dist/{chunk-nr26055z.js → chunk-fzn8xq6f.js} +1 -1
  31. package/dist/{chunk-7khrhe0x.js → chunk-g1bcpymb.js} +2 -2
  32. package/dist/chunk-gar31nyn.js +1 -0
  33. package/dist/{chunk-a36ttbrq.js → chunk-hqyfg97v.js} +2 -2
  34. package/dist/chunk-jn4j9rm3.js +1 -0
  35. package/dist/{chunk-cpvvtyt1.js → chunk-jsagr88c.js} +2 -2
  36. package/dist/{chunk-ydkkycp3.js → chunk-jwzkek1t.js} +2 -2
  37. package/dist/chunk-mdkwbajq.js +2 -0
  38. package/dist/{chunk-j3tfxj8n.js → chunk-mfjc63aw.js} +1 -1
  39. package/dist/{chunk-8cbtae81.js → chunk-mhfjwkg9.js} +1 -1
  40. package/dist/chunk-mqbn36h4.js +1 -0
  41. package/dist/chunk-p1bn8p65.js +1 -0
  42. package/dist/{chunk-7wxg0yef.js → chunk-p8fbtgk3.js} +1 -1
  43. package/dist/{chunk-6mcx89fj.js → chunk-ph818by4.js} +1 -1
  44. package/dist/{chunk-mrapdjm5.js → chunk-pw18cs39.js} +2 -2
  45. package/dist/{chunk-a51szmhp.js → chunk-pww7x4hb.js} +1 -1
  46. package/dist/{chunk-k4ftjnx7.js → chunk-py5g6yc2.js} +1 -1
  47. package/dist/{chunk-eemwtwb1.js → chunk-pyw1vxnf.js} +1 -1
  48. package/dist/{chunk-rayth86k.js → chunk-q87zdrxp.js} +1 -1
  49. package/dist/{chunk-3acyh64g.js → chunk-s6gzrjxk.js} +1 -1
  50. package/dist/chunk-scddrzwd.js +1 -0
  51. package/dist/{chunk-aekjcqbv.js → chunk-spvbvpx5.js} +1 -1
  52. package/dist/chunk-t15ptqbm.js +1 -0
  53. package/dist/{chunk-3j3wmx6g.js → chunk-tvqxepjm.js} +1 -1
  54. package/dist/{chunk-k8ygzjvv.js → chunk-vyejbw66.js} +1 -1
  55. package/dist/{chunk-crrspdy9.js → chunk-xemvstcq.js} +2 -2
  56. package/dist/cli.js +1 -1
  57. package/dist/nonInteractive.js +1 -1
  58. package/dist/zen-keyboard.js +1 -1
  59. package/package.json +2 -2
  60. package/dist/chunk-06dj0dnz.js +0 -1
  61. package/dist/chunk-0cbmnyee.js +0 -1
  62. package/dist/chunk-0cknr23d.js +0 -1
  63. package/dist/chunk-0jtrg9s1.js +0 -1
  64. package/dist/chunk-0k9tc7ys.js +0 -1
  65. package/dist/chunk-0kan91hr.js +0 -1
  66. package/dist/chunk-0kvk3r1g.js +0 -1
  67. package/dist/chunk-0teh8cbt.js +0 -2
  68. package/dist/chunk-0x0r76m6.js +0 -1
  69. package/dist/chunk-11ctp51v.js +0 -2
  70. package/dist/chunk-154dd94d.js +0 -2
  71. package/dist/chunk-17g5e3tb.js +0 -1
  72. package/dist/chunk-1b02dwxw.js +0 -1
  73. package/dist/chunk-1ck3yagm.js +0 -1
  74. package/dist/chunk-1fmdjx58.js +0 -1
  75. package/dist/chunk-1m8bmdzc.js +0 -1
  76. package/dist/chunk-1tj3j2rd.js +0 -1
  77. package/dist/chunk-1xdz3wdt.js +0 -1
  78. package/dist/chunk-1xjj19pz.js +0 -1
  79. package/dist/chunk-1z3yy9vz.js +0 -1
  80. package/dist/chunk-1zbnmy0p.js +0 -1
  81. package/dist/chunk-21gm4tm7.js +0 -1
  82. package/dist/chunk-2215g4qb.js +0 -2
  83. package/dist/chunk-250846sw.js +0 -1
  84. package/dist/chunk-2a6kan82.js +0 -1
  85. package/dist/chunk-2cfemb9q.js +0 -1
  86. package/dist/chunk-2evyqqz7.js +0 -2
  87. package/dist/chunk-2f9mf6mw.js +0 -2
  88. package/dist/chunk-2mrbrsta.js +0 -1
  89. package/dist/chunk-2tg0fzzw.js +0 -2
  90. package/dist/chunk-2yk5xgha.js +0 -1
  91. package/dist/chunk-2z60cf4h.js +0 -1
  92. package/dist/chunk-2zqq58q6.js +0 -2
  93. package/dist/chunk-3009w43m.js +0 -1
  94. package/dist/chunk-3b8scss4.js +0 -1
  95. package/dist/chunk-3d8rzv4d.js +0 -1
  96. package/dist/chunk-3emyjvqg.js +0 -1
  97. package/dist/chunk-3rew4tyk.js +0 -1
  98. package/dist/chunk-3s3b7nzy.js +0 -1
  99. package/dist/chunk-3w98g1h4.js +0 -1
  100. package/dist/chunk-3x564va6.js +0 -2
  101. package/dist/chunk-4agrg21g.js +0 -1
  102. package/dist/chunk-4asb3qnd.js +0 -1
  103. package/dist/chunk-4k15drqf.js +0 -1
  104. package/dist/chunk-4vhwsrc0.js +0 -1
  105. package/dist/chunk-4yddzp8e.js +0 -1
  106. package/dist/chunk-53agfxhn.js +0 -1
  107. package/dist/chunk-54kyvbh7.js +0 -1
  108. package/dist/chunk-56q8b04m.js +0 -1
  109. package/dist/chunk-59vj8mx3.js +0 -1
  110. package/dist/chunk-5bvkhjg1.js +0 -1
  111. package/dist/chunk-5m8gh94n.js +0 -1
  112. package/dist/chunk-5n57csbz.js +0 -1
  113. package/dist/chunk-5n6g25gc.js +0 -1
  114. package/dist/chunk-5rmyjm7a.js +0 -1
  115. package/dist/chunk-5wkah698.js +0 -1
  116. package/dist/chunk-6180vb4q.js +0 -2
  117. package/dist/chunk-63ncy5kr.js +0 -1
  118. package/dist/chunk-66sfgeag.js +0 -1
  119. package/dist/chunk-6ag9x0z1.js +0 -1
  120. package/dist/chunk-6bhkrdb2.js +0 -1
  121. package/dist/chunk-6cs4tf5a.js +0 -1
  122. package/dist/chunk-6czm9v10.js +0 -1
  123. package/dist/chunk-6dm27qn5.js +0 -1
  124. package/dist/chunk-6eyx9kb0.js +0 -1
  125. package/dist/chunk-6fsb1bxc.js +0 -1
  126. package/dist/chunk-6qbdcv3t.js +0 -1
  127. package/dist/chunk-6qyeer8n.js +0 -1
  128. package/dist/chunk-6r5npryc.js +0 -1
  129. package/dist/chunk-6rhb6xym.js +0 -1
  130. package/dist/chunk-6vhg46d2.js +0 -1
  131. package/dist/chunk-6yb36qx6.js +0 -1
  132. package/dist/chunk-72cdrnwv.js +0 -1
  133. package/dist/chunk-731nq1br.js +0 -1
  134. package/dist/chunk-748hk53z.js +0 -1
  135. package/dist/chunk-774cjjgt.js +0 -1
  136. package/dist/chunk-77chzpqs.js +0 -1
  137. package/dist/chunk-77qt7n70.js +0 -1
  138. package/dist/chunk-7cenjy4r.js +0 -2
  139. package/dist/chunk-7d4h6qkf.js +0 -1
  140. package/dist/chunk-7k80bxbe.js +0 -1
  141. package/dist/chunk-7khjf5c1.js +0 -1
  142. package/dist/chunk-7m0c57rj.js +0 -1
  143. package/dist/chunk-7n5b43s8.js +0 -1
  144. package/dist/chunk-7pwrx1pp.js +0 -1
  145. package/dist/chunk-7v4352jx.js +0 -1
  146. package/dist/chunk-7w75nxwb.js +0 -1
  147. package/dist/chunk-7wa89vcy.js +0 -1
  148. package/dist/chunk-7yf45m28.js +0 -1
  149. package/dist/chunk-7z7g35xf.js +0 -1
  150. package/dist/chunk-82xzyhyv.js +0 -1
  151. package/dist/chunk-87w9rexn.js +0 -1
  152. package/dist/chunk-8arg48f8.js +0 -1
  153. package/dist/chunk-8ee7jvcr.js +0 -1
  154. package/dist/chunk-8gm5e25z.js +0 -1
  155. package/dist/chunk-8jhmnz2v.js +0 -1
  156. package/dist/chunk-8qh81vdm.js +0 -1
  157. package/dist/chunk-8vr1wy0r.js +0 -1
  158. package/dist/chunk-917pj3vx.js +0 -1
  159. package/dist/chunk-91gd665t.js +0 -1
  160. package/dist/chunk-92pjraxh.js +0 -2
  161. package/dist/chunk-9ft87v6s.js +0 -2
  162. package/dist/chunk-9h0v5e0k.js +0 -2
  163. package/dist/chunk-9hnbyswz.js +0 -1
  164. package/dist/chunk-9hznfyjs.js +0 -1
  165. package/dist/chunk-9mjq1xxc.js +0 -1
  166. package/dist/chunk-9nb6v3q0.js +0 -2
  167. package/dist/chunk-9phx46cq.js +0 -2
  168. package/dist/chunk-9rmve4r4.js +0 -1
  169. package/dist/chunk-9xaygaay.js +0 -2
  170. package/dist/chunk-a4vdvjsr.js +0 -1
  171. package/dist/chunk-ae57mcvq.js +0 -1
  172. package/dist/chunk-aeajq5ft.js +0 -1
  173. package/dist/chunk-ah557n6f.js +0 -1
  174. package/dist/chunk-am5r5ynh.js +0 -1
  175. package/dist/chunk-asdze5kz.js +0 -1
  176. package/dist/chunk-av215sh3.js +0 -1
  177. package/dist/chunk-b1czvr4n.js +0 -1
  178. package/dist/chunk-b3g51e2m.js +0 -1
  179. package/dist/chunk-b4qvb571.js +0 -1
  180. package/dist/chunk-bba2g9qj.js +0 -1
  181. package/dist/chunk-be8bz8xh.js +0 -1
  182. package/dist/chunk-bh05aqrf.js +0 -2
  183. package/dist/chunk-bjctrgpr.js +0 -1
  184. package/dist/chunk-bjqn0pzz.js +0 -1
  185. package/dist/chunk-bnrv5f66.js +0 -2
  186. package/dist/chunk-bqzvv2dy.js +0 -1
  187. package/dist/chunk-bs9fj12n.js +0 -1
  188. package/dist/chunk-bwcdkk1e.js +0 -2
  189. package/dist/chunk-bz79zq7h.js +0 -1
  190. package/dist/chunk-bzanqq7a.js +0 -1
  191. package/dist/chunk-cayjw3gk.js +0 -1
  192. package/dist/chunk-ceb97hw6.js +0 -1
  193. package/dist/chunk-ctet86gc.js +0 -1
  194. package/dist/chunk-ctp90f8y.js +0 -1
  195. package/dist/chunk-cv5akzkw.js +0 -1
  196. package/dist/chunk-d9hpz80s.js +0 -2
  197. package/dist/chunk-denz6x2z.js +0 -1
  198. package/dist/chunk-dnpybaez.js +0 -1
  199. package/dist/chunk-dp2418kp.js +0 -1
  200. package/dist/chunk-dpa9tgf6.js +0 -2
  201. package/dist/chunk-dxg8cctv.js +0 -2
  202. package/dist/chunk-dz0229fs.js +0 -1
  203. package/dist/chunk-e8pjcdmj.js +0 -1
  204. package/dist/chunk-edkft0pe.js +0 -1
  205. package/dist/chunk-ejh8spnd.js +0 -1
  206. package/dist/chunk-emjqnzzj.js +0 -1
  207. package/dist/chunk-er06b5kx.js +0 -2
  208. package/dist/chunk-esskh0ge.js +0 -1
  209. package/dist/chunk-ewx6fr7a.js +0 -1
  210. package/dist/chunk-ewxacd5v.js +0 -1
  211. package/dist/chunk-ez2xn1tq.js +0 -1
  212. package/dist/chunk-ezh4rq18.js +0 -1
  213. package/dist/chunk-f1gz54zs.js +0 -1
  214. package/dist/chunk-f2p8rps5.js +0 -1
  215. package/dist/chunk-f3mf8qk2.js +0 -1
  216. package/dist/chunk-f51sey9j.js +0 -1
  217. package/dist/chunk-f8c6jyrc.js +0 -1
  218. package/dist/chunk-fb70a9sy.js +0 -1
  219. package/dist/chunk-fd4dk58v.js +0 -1
  220. package/dist/chunk-fdhzjb42.js +0 -1
  221. package/dist/chunk-fftvnc8t.js +0 -1
  222. package/dist/chunk-ffzytaw1.js +0 -1
  223. package/dist/chunk-fm3k6prw.js +0 -1
  224. package/dist/chunk-fs5s90mk.js +0 -1
  225. package/dist/chunk-fvhtfw18.js +0 -1
  226. package/dist/chunk-g3p0vcay.js +0 -2
  227. package/dist/chunk-gaw2bhff.js +0 -1
  228. package/dist/chunk-gbrg4c7y.js +0 -1
  229. package/dist/chunk-gkhxerej.js +0 -1
  230. package/dist/chunk-gps0pyf7.js +0 -1
  231. package/dist/chunk-gsnrqmzp.js +0 -1
  232. package/dist/chunk-gvjvbwk6.js +0 -1
  233. package/dist/chunk-gxc7a8cz.js +0 -1
  234. package/dist/chunk-h06hyckd.js +0 -1
  235. package/dist/chunk-h0b5na4r.js +0 -1
  236. package/dist/chunk-h1bjeyn7.js +0 -1
  237. package/dist/chunk-h5y1vfrx.js +0 -1
  238. package/dist/chunk-hgkaxnh7.js +0 -1
  239. package/dist/chunk-hgs9vzm2.js +0 -1
  240. package/dist/chunk-hjs9ffqg.js +0 -1
  241. package/dist/chunk-hmtm22t7.js +0 -1
  242. package/dist/chunk-hraqhe5e.js +0 -1
  243. package/dist/chunk-hsq3vxna.js +0 -2
  244. package/dist/chunk-htns6qnb.js +0 -1
  245. package/dist/chunk-hv4arqm5.js +0 -1
  246. package/dist/chunk-hzqb4sy6.js +0 -1
  247. package/dist/chunk-j0szwqey.js +0 -1
  248. package/dist/chunk-j6s60n91.js +0 -1
  249. package/dist/chunk-j9za9ext.js +0 -1
  250. package/dist/chunk-ja5m6q40.js +0 -1
  251. package/dist/chunk-jdvv96q7.js +0 -1
  252. package/dist/chunk-jsqwhbbt.js +0 -1
  253. package/dist/chunk-jyrs3ysr.js +0 -1
  254. package/dist/chunk-jz8tmenz.js +0 -1
  255. package/dist/chunk-k17n7dpm.js +0 -1
  256. package/dist/chunk-k1yv7tpj.js +0 -1
  257. package/dist/chunk-k626mmdc.js +0 -1
  258. package/dist/chunk-ka0pqrag.js +0 -1
  259. package/dist/chunk-kbgd9vsz.js +0 -1
  260. package/dist/chunk-kc6rwv2m.js +0 -1
  261. package/dist/chunk-kc8375a8.js +0 -1
  262. package/dist/chunk-kgj1ssyj.js +0 -1
  263. package/dist/chunk-kk4w0prd.js +0 -1
  264. package/dist/chunk-kkks4cbp.js +0 -1
  265. package/dist/chunk-kq7y5ybe.js +0 -1
  266. package/dist/chunk-kqemj8nq.js +0 -1
  267. package/dist/chunk-kr6cv1mp.js +0 -1
  268. package/dist/chunk-kvb035wf.js +0 -2
  269. package/dist/chunk-kx3dsqc5.js +0 -1
  270. package/dist/chunk-kys8sc0j.js +0 -1
  271. package/dist/chunk-m0vtra47.js +0 -1
  272. package/dist/chunk-m9xdbw2j.js +0 -1
  273. package/dist/chunk-mft6e1b3.js +0 -1
  274. package/dist/chunk-mfyvxat8.js +0 -1
  275. package/dist/chunk-mjfe9s8t.js +0 -1
  276. package/dist/chunk-mns6edxc.js +0 -1
  277. package/dist/chunk-mp159559.js +0 -2
  278. package/dist/chunk-mrbn4knm.js +0 -1
  279. package/dist/chunk-ms3sqsez.js +0 -1
  280. package/dist/chunk-mtyqtnv0.js +0 -1
  281. package/dist/chunk-mvb82v3n.js +0 -1
  282. package/dist/chunk-n08dw2ke.js +0 -1
  283. package/dist/chunk-n0sxg10w.js +0 -1
  284. package/dist/chunk-n3xjke41.js +0 -1
  285. package/dist/chunk-n6v7menj.js +0 -1
  286. package/dist/chunk-n8apqh5d.js +0 -1
  287. package/dist/chunk-n8f65qbg.js +0 -1
  288. package/dist/chunk-n92ey5c2.js +0 -1
  289. package/dist/chunk-na5z94zg.js +0 -2
  290. package/dist/chunk-nbkkf36e.js +0 -1
  291. package/dist/chunk-ndk5mkc1.js +0 -1
  292. package/dist/chunk-nks89eba.js +0 -1
  293. package/dist/chunk-nrkhbe10.js +0 -1
  294. package/dist/chunk-nvnw7mcb.js +0 -1
  295. package/dist/chunk-nwx5cbjc.js +0 -1
  296. package/dist/chunk-ny61b4ve.js +0 -1
  297. package/dist/chunk-p7ha3t1f.js +0 -1
  298. package/dist/chunk-pc3w4gkp.js +0 -1
  299. package/dist/chunk-pcwsyc9b.js +0 -1
  300. package/dist/chunk-pj843s6s.js +0 -1
  301. package/dist/chunk-pm5gceg0.js +0 -1
  302. package/dist/chunk-pqq81gzv.js +0 -1
  303. package/dist/chunk-pt1m6xh9.js +0 -1
  304. package/dist/chunk-pvzfgkkq.js +0 -1
  305. package/dist/chunk-pz4hhw24.js +0 -1
  306. package/dist/chunk-pz5xskrk.js +0 -1
  307. package/dist/chunk-q0z3nkep.js +0 -1
  308. package/dist/chunk-q6m1k4fq.js +0 -1
  309. package/dist/chunk-q9w8vj93.js +0 -2
  310. package/dist/chunk-qd2hkayk.js +0 -1
  311. package/dist/chunk-qf60gd6x.js +0 -1
  312. package/dist/chunk-qpwtcr53.js +0 -1
  313. package/dist/chunk-qrr2ytkg.js +0 -2
  314. package/dist/chunk-qzy0w65x.js +0 -1
  315. package/dist/chunk-r5crgj5q.js +0 -1
  316. package/dist/chunk-r5psjv6v.js +0 -1
  317. package/dist/chunk-r9dm0gyn.js +0 -1
  318. package/dist/chunk-r9qyzgns.js +0 -1
  319. package/dist/chunk-raq8eqd9.js +0 -1
  320. package/dist/chunk-rbebjqfq.js +0 -1
  321. package/dist/chunk-rc81vkve.js +0 -1
  322. package/dist/chunk-rg8hdkt2.js +0 -1
  323. package/dist/chunk-rgc9k4rf.js +0 -2
  324. package/dist/chunk-rqvxk3e5.js +0 -2
  325. package/dist/chunk-rsb82wcd.js +0 -1
  326. package/dist/chunk-rt7af3wp.js +0 -1
  327. package/dist/chunk-rx707y69.js +0 -1
  328. package/dist/chunk-s22hm2jp.js +0 -1
  329. package/dist/chunk-s2wchktz.js +0 -1
  330. package/dist/chunk-s5yace4y.js +0 -1
  331. package/dist/chunk-sd65hz9x.js +0 -1
  332. package/dist/chunk-sdhd2kpk.js +0 -1
  333. package/dist/chunk-sepabvgd.js +0 -1
  334. package/dist/chunk-sk4n2anv.js +0 -1
  335. package/dist/chunk-sq9spyfd.js +0 -1
  336. package/dist/chunk-sv97fsr8.js +0 -1
  337. package/dist/chunk-sw6b067z.js +0 -1
  338. package/dist/chunk-sz3tq28n.js +0 -2
  339. package/dist/chunk-t07nqvz2.js +0 -1
  340. package/dist/chunk-t4vfr2g0.js +0 -1
  341. package/dist/chunk-t6x8a62a.js +0 -1
  342. package/dist/chunk-t8djp78p.js +0 -1
  343. package/dist/chunk-tj729ry3.js +0 -1
  344. package/dist/chunk-tjj6zd94.js +0 -2
  345. package/dist/chunk-tkp1zzgb.js +0 -1
  346. package/dist/chunk-tq142qfa.js +0 -1
  347. package/dist/chunk-tq7jpqr7.js +0 -1
  348. package/dist/chunk-tqh0rjpp.js +0 -1
  349. package/dist/chunk-tx117rah.js +0 -1
  350. package/dist/chunk-v3t7hcht.js +0 -1
  351. package/dist/chunk-v9qb0fer.js +0 -1
  352. package/dist/chunk-vcsqkf9c.js +0 -1
  353. package/dist/chunk-vd8byz1r.js +0 -2
  354. package/dist/chunk-vg853h8j.js +0 -1
  355. package/dist/chunk-vgeyt962.js +0 -1
  356. package/dist/chunk-vkfgx6sa.js +0 -2
  357. package/dist/chunk-vqpam6p8.js +0 -1
  358. package/dist/chunk-vrv07424.js +0 -1
  359. package/dist/chunk-vsydmxfh.js +0 -1
  360. package/dist/chunk-vtxyeepe.js +0 -2
  361. package/dist/chunk-vwhxfs9r.js +0 -1
  362. package/dist/chunk-vy4ecvry.js +0 -1
  363. package/dist/chunk-w46ermgd.js +0 -1
  364. package/dist/chunk-w5qvj179.js +0 -1
  365. package/dist/chunk-w93s735t.js +0 -1
  366. package/dist/chunk-wb08g5z8.js +0 -1
  367. package/dist/chunk-wb43p5km.js +0 -1
  368. package/dist/chunk-wb6xn1kx.js +0 -1
  369. package/dist/chunk-wbg38h5j.js +0 -1
  370. package/dist/chunk-wcyrmfpn.js +0 -1
  371. package/dist/chunk-wd17hcv5.js +0 -1
  372. package/dist/chunk-wdm62dbr.js +0 -1
  373. package/dist/chunk-we3jwpsb.js +0 -2
  374. package/dist/chunk-wgamcpyt.js +0 -1
  375. package/dist/chunk-whdmep96.js +0 -1
  376. package/dist/chunk-wkc7w10f.js +0 -1
  377. package/dist/chunk-wkf1j21b.js +0 -1
  378. package/dist/chunk-wm3z6khn.js +0 -1
  379. package/dist/chunk-wqvqvv9e.js +0 -1
  380. package/dist/chunk-wvmnb75v.js +0 -1
  381. package/dist/chunk-wy3eznsy.js +0 -2
  382. package/dist/chunk-wznpd7sd.js +0 -1
  383. package/dist/chunk-x01t9e3q.js +0 -1
  384. package/dist/chunk-x8z2fzz8.js +0 -1
  385. package/dist/chunk-xa4apmpd.js +0 -1
  386. package/dist/chunk-xcea0hn5.js +0 -2
  387. package/dist/chunk-xf7ypd1b.js +0 -1
  388. package/dist/chunk-xhjrdhgk.js +0 -1
  389. package/dist/chunk-xjgnj3p0.js +0 -1
  390. package/dist/chunk-xjwkmvfz.js +0 -1
  391. package/dist/chunk-xkc2ktrh.js +0 -1
  392. package/dist/chunk-xm9015v4.js +0 -1
  393. package/dist/chunk-xnx0j1hw.js +0 -1
  394. package/dist/chunk-y0e2ymas.js +0 -1
  395. package/dist/chunk-y3c3xgca.js +0 -1
  396. package/dist/chunk-y6mvs6yw.js +0 -1
  397. package/dist/chunk-y6z502pz.js +0 -1
  398. package/dist/chunk-ycthcn27.js +0 -1
  399. package/dist/chunk-ydc7pd3b.js +0 -1
  400. package/dist/chunk-yhxvqyz4.js +0 -1
  401. package/dist/chunk-ymmavdfp.js +0 -2
  402. package/dist/chunk-ynnaxz2z.js +0 -1
  403. package/dist/chunk-ywa5z7d9.js +0 -1
  404. package/dist/chunk-ywbbf9eh.js +0 -1
  405. package/dist/chunk-yzk3bfzn.js +0 -1
  406. package/dist/chunk-z0wdan61.js +0 -1
  407. package/dist/chunk-z5z774pp.js +0 -1
  408. package/dist/chunk-z88rcc8t.js +0 -1
  409. package/dist/chunk-zag96nyc.js +0 -2
  410. package/dist/chunk-zh77yp9z.js +0 -1
  411. package/dist/chunk-zjemnf8v.js +0 -1
  412. package/dist/chunk-zmsq5xc7.js +0 -1
  413. package/dist/chunk-zqxrtejz.js +0 -1
  414. package/dist/chunk-zt78xjtr.js +0 -2
  415. package/dist/chunk-zv9ac3c0.js +0 -2
  416. package/dist/chunk-zx19re81.js +0 -2
  417. package/dist/chunk-zytr7a4n.js +0 -1
package/dist/app.js CHANGED
@@ -1,52 +1,52 @@
1
- import{Y as _5,Z as A5}from"./chunk-rqvxk3e5.js";import{$ as V1,_ as r}from"./chunk-v5mgjgc4.js";import{aa as eY,ba as t,ca as ZZ,da as FZ,ea as PJ,fa as WZ,ga as b1}from"./chunk-45bkb77s.js";import{ha as a8,ia as Z5,ja as VJ,ka as c4,la as t0,ma as T1,na as z1,oa as uY,pa as xZ,qa as l0}from"./chunk-6czm9v10.js";import{ra as g8,sa as J8,ta as r8,va as U1,wa as Q1,xa as TZ}from"./chunk-m0e2jefq.js";import{ya as UZ,za as f1}from"./chunk-ymmavdfp.js";import{Aa as U8,Ba as RW,Da as z8,Ea as xY,Ga as gY}from"./chunk-7khrhe0x.js";import{Ia as d0,Ja as lY,Ka as cZ,Ma as dZ,Na as iY,Oa as F4}from"./chunk-154dd94d.js";import"./chunk-mrapdjm5.js";import"./chunk-ydkkycp3.js";import{Ya as N4,Za as U4}from"./chunk-pbe0n109.js";import{$a as _,_a as g,ab as O,bb as K8,cb as yY,eb as d8,fb as W4,gb as uZ,hb as I,ib as iZ,kb as u4,mb as D1,nb as BJ}from"./chunk-zssv316b.js";import{ub as R8}from"./chunk-hps6tv25.js";import{vb as J5}from"./chunk-pp1gnpdp.js";import{Ab as Y5,xb as G5,yb as W5,zb as $5}from"./chunk-xf4jswm4.js";import"./chunk-3fp2k4jh.js";import"./chunk-k8ygzjvv.js";import"./chunk-j7f3n1aj.js";import"./chunk-crrspdy9.js";import"./chunk-7wxg0yef.js";import"./chunk-dv9rvc0a.js";import"./chunk-3j3wmx6g.js";import{lc as P,nc as B7,oc as q$,pc as q}from"./chunk-nr26055z.js";class x8{renderers=new Map;register(Z,Y){this.renderers.set(Z,Y)}get(Z){return this.renderers.get(Z)}has(Z){return this.renderers.has(Z)}list(){return Array.from(this.renderers.keys())}unregister(Z){this.renderers.delete(Z)}clear(){this.renderers.clear()}}var D4;var n0=q$(()=>{D4=new x8});var G8=P(I(),1),j1=new U8({defaultOptions:{queries:{retry:(Z,Y)=>{if(Y instanceof TypeError&&Y.message.includes("fetch"))return Z<2;return!1},refetchOnWindowFocus:!1,refetchOnMount:!0,refetchOnReconnect:!1,staleTime:300000,gcTime:600000,networkMode:"online"},mutations:{retry:1,networkMode:"online"}}});function H8({children:Z}){return G8.jsxDEV(z8,{client:j1,children:Z},void 0,!1,void 0,this)}var O8={async search(Z){let Y=Object.entries(d0).map(([$,K])=>({assistant_id:$,graph_id:$,config:{},metadata:{},version:1,name:$,description:"",created_at:new Date().toISOString(),updated_at:new Date().toISOString()}));if(Z?.graphId)Y=Y.filter(($)=>$.graph_id===Z.graphId);if(Z?.metadata&&Object.keys(Z.metadata).length>0)Y=Y.filter(($)=>{return Object.entries(Z.metadata).every(([K,U])=>{return $.metadata&&$.metadata[K]===U})});if(Z?.sortBy)Y.sort(($,K)=>{let U=$[Z.sortBy],W=K[Z.sortBy],z=U<W?-1:U>W?1:0;return Z.sortOrder==="desc"?-z:z});let X=Z?.offset??0,J=Z?.limit;return J?Y.slice(X,X+J):Y.slice(X)},async count(Z){return(await this.search(Z)).length},async get(Z){if(!Object.entries(d0).find(([X,J])=>X===Z))throw Error(`Assistant not found: ${Z}`);return{assistant_id:Z,graph_id:Z,config:{},created_at:new Date().toISOString(),updated_at:new Date().toISOString(),metadata:{},version:1,name:Z,description:""}},async delete(Z){throw Error("Deleting assistants is not supported. Assistants are generated from registered graphs.")},async update(Z,Y){throw Error("Updating assistants is not supported. Assistants are generated from registered graphs.")},async getGraph(Z,Y){let X={};return(await(await cZ(Z,X)).getGraphAsync({...X,xray:Y?.xray??void 0})).toJSON()},async getSchemas(Z){let X=(await cZ(Z,{})).builder;return console.log(X),{graph_id:Z,state_schema:X._inputDefinition,input_schema:X._inputDefinition,output_schema:X._outputDefinition,config_schema:X._configSchema,context_schema:X._configSchema}},async getVersions(Z,Y){let X=await this.get(Z),J=Y?.offset??0,Q=Y?.limit;return Q?[X].slice(J,J+Q):[X].slice(J)},async setLatest(Z,Y){let X=await this.get(Z);return X.version=Y,X},async create(Z){if(console.warn("⚠️ Creating assistants is not supported. Assistants are generated from registered graphs. Returning mock data."),!Object.keys(d0).includes(Z.graphId)){if(Z.ifExists==="raise")throw Error(`Graph not found: ${Z.graphId}`)}return{assistant_id:Z.assistantId||Z.graphId,graph_id:Z.graphId,name:Z.name||Z.graphId,description:Z.description||"",metadata:Z.metadata||{},config:Z.config||{},version:1,created_at:new Date().toISOString(),updated_at:new Date().toISOString()}}},cY=()=>{let Z=()=>{return dZ.globalThreadsManager};return{assistants:O8,get threads(){return dZ.globalThreadsManager},runs:{list(Y,X){return Z().listRuns(Y,X)},async cancel(Y,X,J,Q){return await dZ.globalMessageQueue.cancelQueue(X)},async*stream(Y,X,J){J.config={...J.config??{},configurable:{...J.config?.configurable??{},graph_id:X,thread_id:Y}};let Q=Z();for await(let $ of F4(Q,Q.createRun(Y,X,J),J,{attempt:0,getGraph:cZ}))yield $},async*joinStream(Y,X,J){let Q=J&&typeof J==="object"&&"signal"in J?J:{},$=(J instanceof AbortSignal?J:Q.signal)||new AbortController().signal,K=null,U=null;try{K=await dZ.globalMessageQueue.getQueue(X);let W=await K.getAll();for(let z of W){if($.aborted)return;if(yield{id:z.id,event:z.event,data:z.data},z.event==="__stream_end__"||z.event==="__stream_error__"||z.event==="__stream_cancel__")return}U=K.onDataReceive();for await(let z of U){if($.aborted)break;let{event:H,data:G}=z;if(yield{id:z.id,event:H,data:G},z.event==="__stream_end__"||z.event==="__stream_error__"||z.event==="__stream_cancel__")break}}catch(W){if(!(W instanceof Error)||!W.message.includes("does not exist"))console.warn("Join stream failed:",W)}finally{if(U)try{await U.return(void 0)}catch(W){}}}}}};import{entrypoint as p2,getPreviousState as d2,getConfig as c2,Command as l2}from"@langchain/langgraph";import{schemaMetaRegistry as r2}from"@langchain/langgraph/zod";import{z as QZ}from"zod";var x4=(Z,Y)=>Z.constructor.name===Y.name,BZ=new Map;BZ.set(QZ.ZodBoolean.name,()=>!1),BZ.set(QZ.ZodNumber.name,()=>0),BZ.set(QZ.ZodString.name,()=>""),BZ.set(QZ.ZodArray.name,()=>[]),BZ.set(QZ.ZodRecord.name,()=>({})),BZ.set(QZ.ZodDefault.name,(Z)=>Z.def.defaultValue),BZ.set(QZ.ZodPipe.name,(Z)=>N0(Z.def.in)),BZ.set(QZ.ZodOptional.name,(Z)=>x4(Z.def.innerType,QZ.ZodDefault)?Z.def.innerType.def.defaultValue:void 0),BZ.set(QZ.ZodTuple.name,(Z)=>{let Y=[];for(let X of Z.def.items)Y.push(N0(X));return Y}),BZ.set(QZ.ZodPipe.name,(Z)=>N0(Z.def.in)),BZ.set(QZ.ZodUnion.name,(Z)=>N0(Z.def.options[0])),BZ.set(QZ.ZodObject.name,(Z)=>g4(Z)),BZ.set(QZ.ZodRecord.name,(Z)=>g4(Z)),BZ.set(QZ.ZodIntersection.name,(Z)=>g4(Z));function N0(Z){let Y=Z.constructor.name;if(!BZ.has(Y)){console.warn("getSchemaDefaultForField: Unhandled type",Z.constructor.name);return}return BZ.get(Y)(Z)}function g4(Z){if(x4(Z,QZ.ZodRecord))return{};if(x4(Z,QZ.ZodPipe))return g4(Z.def.in);if(x4(Z,QZ.ZodIntersection))return{...g4(Z.def.left),...g4(Z.def.right)};if(x4(Z,QZ.ZodUnion)){for(let Y of Z.def.options)if(x4(Y,QZ.ZodObject))return g4(Y);return console.warn("getSchemaDefaultObject: No object found in union, returning empty object"),{}}return x4(Z,QZ.ZodObject)?Object.fromEntries(Object.entries(Z.shape).map(([Y,X])=>[Y,N0(X)]).filter((Y)=>Y[1]!==void 0)):(console.warn(`getSchemaDefaultObject: Expected object schema, got ${Z.constructor.name}`),{})}import{tool as a2,HumanMessage as s2}from"langchain";import{z as M4}from"zod";var e2=M4.object({task_store:M4.record(M4.string(),M4.any()).default({})}),ZU=M4.object({task_id:M4.string().optional().describe("The task id to ask the subagent, if not provided, will use the tool call id"),subagent_id:M4.string(),task_description:M4.string().describe("Describe the user state and what you want the subagent to do."),data_transfer:M4.any().optional().describe("Data to transfer to the subagent.")});import A from"zod";var x=cY(),S1=A.object({thread_id:A.string().optional(),thread_ts:A.string().optional()}).catchall(A.unknown()),Y0=A.object({tags:A.array(A.string()).optional(),recursion_limit:A.number().int().optional(),configurable:S1.optional()}).catchall(A.unknown()).describe("The configuration of an assistant.");A.object({assistant_id:A.string(),graph_id:A.string(),config:Y0,created_at:A.string(),updated_at:A.string(),metadata:A.object({}).catchall(A.any())});var K4=A.object({source:A.union([A.literal("input"),A.literal("loop"),A.literal("update"),A.string()]).optional(),step:A.number().optional(),writes:A.any().nullable().optional(),parents:A.any().optional()}).catchall(A.unknown()),q8=A.object({node:A.string(),input:A.unknown().optional()}),rY=A.object({update:A.union([A.any(),A.array(A.tuple([A.string(),A.any()]))]).nullable().optional(),resume:A.unknown().optional(),goto:A.union([q8,A.array(q8),A.string(),A.array(A.string())]).optional()});A.object({limit:A.number().int().optional(),offset:A.number().int().optional()});var DZ=A.object({thread_id:A.string()}),_0=A.object({thread_id:A.string(),run_id:A.string()}),y1=A.object({graph_id:A.string().optional(),metadata:K4.optional(),limit:A.number().int().optional(),offset:A.number().int().optional(),sort_by:A.enum(["assistant_id","graph_id","name","created_at","updated_at"]).optional(),sort_order:A.enum(["asc","desc"]).optional()}),k1=A.object({graph_id:A.string().optional(),metadata:K4.optional()}),h1=A.object({xray:A.union([A.string(),A.boolean(),A.number()]).optional()}),F8=A.object({name:A.string().optional(),description:A.string().optional(),metadata:K4.optional(),config:Y0.optional()}).optional(),x1=A.object({assistant_id:A.string().optional(),graph_id:A.string().describe("The ID of graph to create an assistant from."),name:A.string().optional(),description:A.string().optional(),metadata:K4.optional(),config:Y0.optional(),if_exists:A.enum(["raise","do_nothing"]).optional()}),g1=A.object({assistant_id:A.union([A.string(),A.string()]),checkpoint_id:A.string().optional(),input:A.any().optional(),command:rY.optional(),metadata:K4.optional(),config:Y0.optional(),webhook:A.string().optional(),interrupt_before:A.union([A.literal("*"),A.array(A.string())]).optional(),interrupt_after:A.union([A.literal("*"),A.array(A.string())]).optional(),on_disconnect:A.enum(["cancel","continue"]).optional().default("continue"),multitask_strategy:A.enum(["reject","rollback","interrupt","enqueue"]).optional(),stream_mode:A.array(A.enum(["values","messages","messages-tuple","updates","events","debug","custom"])).optional(),stream_subgraphs:A.boolean().optional(),stream_resumable:A.boolean().optional(),after_seconds:A.number().optional(),if_not_exists:A.enum(["create","reject"]).optional(),on_completion:A.enum(["complete","continue"]).optional(),feedback_keys:A.array(A.string()).optional(),langsmith_tracer:A.unknown().optional()}).describe("Payload for creating a stateful run."),u1=A.object({limit:A.coerce.number().int().optional().default(10),offset:A.coerce.number().int().optional().default(0),status:A.enum(["pending","running","error","success","timeout","interrupted"]).optional()}),m1=A.object({wait:A.coerce.boolean().optional().default(!1),action:A.enum(["interrupt","rollback"]).optional().default("interrupt")}),p1=A.object({cancel_on_disconnect:A.coerce.boolean().optional().default(!1),last_event_id:A.string().optional(),stream_mode:A.enum(["values","messages","messages-tuple","updates","events","debug","custom"]).optional()}),d1=A.object({thread_id:A.string().describe("The ID of thread. If not provided, an ID is generated.").optional(),metadata:K4.optional(),if_exists:A.union([A.literal("raise"),A.literal("do_nothing")]).optional()}).describe("Payload for creating a thread."),M8=A.object({ids:A.array(A.string()).describe("List of thread IDs to include. Others are excluded.").optional(),metadata:K4.describe("Metadata to search for.").optional(),status:A.enum(["idle","busy","interrupted","error"]).describe("Filter by thread status.").optional(),values:A.any().describe("Filter by thread values.").optional(),limit:A.number().int().gte(1).lte(1000).describe("Maximum number to return.").optional(),offset:A.number().int().gte(0).describe("Offset to start from.").optional(),sort_by:A.enum(["thread_id","status","created_at","updated_at"]).describe("Sort by field.").optional(),sort_order:A.enum(["asc","desc"]).describe("Sort order.").optional(),select:A.array(A.enum(["thread_id","created_at","updated_at","metadata","config","context","status","values","interrupts"])).describe("Specify which fields to return. If not provided, all fields are returned.").optional(),without_details:A.boolean().describe("Whether to return values.").optional()}).describe("Payload for listing threads.");A.object({values:A.union([A.record(A.string(),A.unknown()),A.array(A.record(A.string(),A.unknown()))]).nullish()}).describe("Payload for adding state to a thread.");var c1=A.object({metadata:K4.optional(),status:A.enum(["idle","busy","interrupted","error"]).optional(),values:A.any().optional()}).describe("Payload for patching a thread."),N8=A.object({assistant_id:A.string(),input:A.any().optional(),command:rY.optional(),metadata:K4.optional(),config:Y0.optional(),webhook:A.string().optional(),interrupt_before:A.union([A.literal("*"),A.array(A.string())]).optional(),interrupt_after:A.union([A.literal("*"),A.array(A.string())]).optional(),on_disconnect:A.enum(["cancel","continue"]).optional().default("continue"),multitask_strategy:A.enum(["reject","rollback","interrupt","enqueue"]).optional(),stream_mode:A.array(A.enum(["values","messages","messages-tuple","updates","events","debug","custom"])).optional(),stream_subgraphs:A.boolean().optional(),stream_resumable:A.boolean().optional(),after_seconds:A.number().optional(),if_not_exists:A.enum(["create","reject"]).optional(),on_completion:A.enum(["complete","continue"]).optional(),feedback_keys:A.array(A.string()).optional(),langsmith_tracer:A.unknown().optional()}).describe("Payload for creating a run (background/wait)."),l1=A.object({cancel_on_disconnect:A.coerce.boolean().optional().default(!1)}),i1=A.object({cancel_on_disconnect:A.coerce.boolean().optional().default(!1)}),c0=A.object({assistant_id:A.string().describe("The assistant ID or graph name to run."),input:A.any().optional().describe("The input to the graph."),command:rY.optional(),metadata:K4.optional().describe("Metadata to assign to the run."),config:Y0.optional(),context:A.object({}).catchall(A.any()).optional().describe("Static context added to the assistant."),webhook:A.string().optional(),interrupt_before:A.union([A.literal("*"),A.array(A.string())]).optional(),interrupt_after:A.union([A.literal("*"),A.array(A.string())]).optional(),stream_mode:A.union([A.enum(["values","messages","messages-tuple","tasks","checkpoints","updates","events","debug","custom"]),A.array(A.enum(["values","messages","messages-tuple","tasks","checkpoints","updates","events","debug","custom"]))]).optional().default(["values"]),feedback_keys:A.array(A.string()).optional(),stream_subgraphs:A.boolean().optional().default(!1),stream_resumable:A.boolean().optional().default(!1)}).describe("Payload for creating a stateless run."),r1=A.array(c0).min(1).describe("Payload for creating a batch of stateless runs."),o1=A.object({action:A.enum(["interrupt","rollback"]).optional().default("interrupt").describe("Action to take when cancelling the run."),wait:A.coerce.boolean().optional().default(!1)}),n1=A.union([A.object({status:A.enum(["pending","running","all"]).describe("Filter runs by status to cancel.")}),A.object({thread_id:A.string().describe("The ID of the thread containing runs to cancel.")}),A.object({run_ids:A.array(A.string()).min(1).describe("List of run IDs to cancel.")})]);function KZ(Z,Y){let X=Y.split("/").filter(($)=>$),J=new URL(Z).pathname.split("/").filter(($)=>$),Q={};return X.forEach(($,K)=>{if($.startsWith(":")){let U=$.slice(1);Q[U]=J[K]}}),Q}function lZ(Z){let Y=new URL(Z).searchParams,X={};return Y.forEach((J,Q)=>{if(!isNaN(Number(J))&&J!=="")X[Q]=Number(J);else if(J==="true"||J==="false")X[Q]=J==="true";else X[Q]=J}),X}function S(Z,Y){let X=Z.safeParse(Y);if(!X.success)throw new oY(X.error.issues);return X.data}class oY extends Error{errors;constructor(Z){super("Validation failed");this.name="ValidationError",this.errors=Z}}function m(Z,Y=200,X){return new Response(JSON.stringify(Z),{status:Y,headers:{"Content-Type":"application/json",...X}})}function k(Z,Y=500){if(Z instanceof oY)return m({error:"Validation Error",details:Z.errors},400);return m({error:Z instanceof Error?Z.message:"Unknown error"},Y)}function nY(Z){let Y,X=!1,J=new AbortController,Q=new ReadableStream({async start($){Y=$;let K=new TextEncoder,U={signal:J.signal,writeSSE:async({data:W,event:z,id:H})=>{if(X||J.signal.aborted)return;try{let G="";if(H)G+=`id: ${H}
2
- `;if(z)G+=`event: ${z}
3
- `;G+=`data: ${W}
1
+ import{d as m,e as UY}from"./chunk-8ypsygqy.js";import{g as KZ,h as DZ,i as v1,k as I1,l as VZ,m as a1}from"./chunk-mdkwbajq.js";import{n as uZ,o as i,p as n,q as K1,r as K4,s as $1,t as NY}from"./chunk-c6nzmyns.js";import"./chunk-pw18cs39.js";import{A as i4,B as vZ,C as P1,D as QZ,v as z2,w as U4,x as P$,y as HZ,z as HY}from"./chunk-mqbn36h4.js";import{E as v2,F as k2}from"./chunk-6hpehtte.js";import{G as s0,H as H0,I as K2,K as l4,L as c4,M as M1}from"./chunk-8vkm1ts6.js";import{N as Z1,O as FY}from"./chunk-ema4rc9d.js";import{P as q0,Q as L5,S as b0,T as SZ,V as IZ}from"./chunk-g1bcpymb.js";import"./chunk-jwzkek1t.js";import{ca as t1,da as d1}from"./chunk-02vv5584.js";import{ea as h,fa as U,ga as Q,ha as A0,ia as fZ,ka as _2,la as Z2,ma as x1,na as S1,oa as q,pa as T1,ra as b$,ta as GY,ua as X4}from"./chunk-emv4z7ck.js";import{Ba as V0}from"./chunk-141pasd6.js";import{Ca as F2}from"./chunk-aeambwc5.js";import{Ea as B2,Fa as M2,Ga as A2,Ha as N2}from"./chunk-5kmnxyd8.js";import"./chunk-0a26n1zy.js";import"./chunk-vyejbw66.js";import"./chunk-4fwb6qr1.js";import"./chunk-xemvstcq.js";import"./chunk-p8fbtgk3.js";import"./chunk-fbg1z6br.js";import"./chunk-tvqxepjm.js";import{sb as A,vb as a3,wb as Z$}from"./chunk-fzn8xq6f.js";class a0{renderers=new Map;register($,Z){this.renderers.set($,Z)}get($){return this.renderers.get($)}has($){return this.renderers.has($)}list(){return Array.from(this.renderers.keys())}unregister($){this.renderers.delete($)}clear(){this.renderers.clear()}}var G$;var UZ=a3(()=>{G$=new a0});var B0=A(q(),1),LY=new q0({defaultOptions:{queries:{retry:($,Z)=>{if(Z instanceof TypeError&&Z.message.includes("fetch"))return $<2;return!1},refetchOnWindowFocus:!1,refetchOnMount:!0,refetchOnReconnect:!1,staleTime:300000,gcTime:600000,networkMode:"online"},mutations:{retry:1,networkMode:"online"}}});function R0({children:$}){return B0.jsxDEV(b0,{client:LY,children:$},void 0,!1,void 0,this)}var f0={async search($){let Z=Object.entries(KZ).map(([K,W])=>({assistant_id:K,graph_id:K,config:{},metadata:{},version:1,name:K,description:"",created_at:new Date().toISOString(),updated_at:new Date().toISOString()}));if($?.graphId)Z=Z.filter((K)=>K.graph_id===$.graphId);if($?.metadata&&Object.keys($.metadata).length>0)Z=Z.filter((K)=>{return Object.entries($.metadata).every(([W,O])=>{return K.metadata&&K.metadata[W]===O})});if($?.sortBy)Z.sort((K,W)=>{let O=K[$.sortBy],_=W[$.sortBy],G=O<_?-1:O>_?1:0;return $.sortOrder==="desc"?-G:G});let Y=$?.offset??0,J=$?.limit;return J?Z.slice(Y,Y+J):Z.slice(Y)},async count($){return(await this.search($)).length},async get($){if(!Object.entries(KZ).find(([Y,J])=>Y===$))throw Error(`Assistant not found: ${$}`);return{assistant_id:$,graph_id:$,config:{},created_at:new Date().toISOString(),updated_at:new Date().toISOString(),metadata:{},version:1,name:$,description:""}},async delete($){throw Error("Deleting assistants is not supported. Assistants are generated from registered graphs.")},async update($,Z){throw Error("Updating assistants is not supported. Assistants are generated from registered graphs.")},async getGraph($,Z){let Y={};return(await(await v1($,Y)).getGraphAsync({...Y,xray:Z?.xray??void 0})).toJSON()},async getSchemas($){let Y=(await v1($,{})).builder;return console.log(Y),{graph_id:$,state_schema:Y._inputDefinition,input_schema:Y._inputDefinition,output_schema:Y._outputDefinition,config_schema:Y._configSchema,context_schema:Y._configSchema}},async getVersions($,Z){let Y=await this.get($),J=Z?.offset??0,X=Z?.limit;return X?[Y].slice(J,J+X):[Y].slice(J)},async setLatest($,Z){let Y=await this.get($);return Y.version=Z,Y},async create($){if(console.warn("⚠️ Creating assistants is not supported. Assistants are generated from registered graphs. Returning mock data."),!Object.keys(KZ).includes($.graphId)){if($.ifExists==="raise")throw Error(`Graph not found: ${$.graphId}`)}return{assistant_id:$.assistantId||$.graphId,graph_id:$.graphId,name:$.name||$.graphId,description:$.description||"",metadata:$.metadata||{},config:$.config||{},version:1,created_at:new Date().toISOString(),updated_at:new Date().toISOString()}}},hZ=()=>{let $=()=>{return I1.globalThreadsManager};return{assistants:f0,get threads(){return I1.globalThreadsManager},runs:{list(Z,Y){return $().listRuns(Z,Y)},async cancel(Z,Y,J,X){return await I1.globalMessageQueue.cancelQueue(Y)},async*stream(Z,Y,J){J.config={...J.config??{},configurable:{...J.config?.configurable??{},graph_id:Y,thread_id:Z}};let X=$();for await(let K of a1(X,X.createRun(Z,Y,J),J,{attempt:0,getGraph:v1}))yield K},async*joinStream(Z,Y,J){let X=J&&typeof J==="object"&&"signal"in J?J:{},K=(J instanceof AbortSignal?J:X.signal)||new AbortController().signal,W=null,O=null;try{W=await I1.globalMessageQueue.getQueue(Y);let _=await W.getAll();for(let G of _){if(K.aborted)return;if(yield{id:G.id,event:G.event,data:G.data},G.event==="__stream_end__"||G.event==="__stream_error__"||G.event==="__stream_cancel__")return}O=W.onDataReceive();for await(let G of O){if(K.aborted)break;let{event:N,data:z}=G;if(yield{id:G.id,event:N,data:z},G.event==="__stream_end__"||G.event==="__stream_error__"||G.event==="__stream_cancel__")break}}catch(_){if(!(_ instanceof Error)||!_.message.includes("does not exist"))console.warn("Join stream failed:",_)}finally{if(O)try{await O.return(void 0)}catch(_){}}}}}};import{entrypoint as V8,getPreviousState as j8,getConfig as E8,Command as g8}from"@langchain/langgraph";import{schemaMetaRegistry as m8}from"@langchain/langgraph/zod";import{z as s}from"zod";var M$=($,Z)=>$.constructor.name===Z.name,O1=new Map;O1.set(s.ZodBoolean.name,()=>!1),O1.set(s.ZodNumber.name,()=>0),O1.set(s.ZodString.name,()=>""),O1.set(s.ZodArray.name,()=>[]),O1.set(s.ZodRecord.name,()=>({})),O1.set(s.ZodDefault.name,($)=>$.def.defaultValue),O1.set(s.ZodPipe.name,($)=>l$($.def.in)),O1.set(s.ZodOptional.name,($)=>M$($.def.innerType,s.ZodDefault)?$.def.innerType.def.defaultValue:void 0),O1.set(s.ZodTuple.name,($)=>{let Z=[];for(let Y of $.def.items)Z.push(l$(Y));return Z}),O1.set(s.ZodPipe.name,($)=>l$($.def.in)),O1.set(s.ZodUnion.name,($)=>l$($.def.options[0])),O1.set(s.ZodObject.name,($)=>q$($)),O1.set(s.ZodRecord.name,($)=>q$($)),O1.set(s.ZodIntersection.name,($)=>q$($));function l$($){let Z=$.constructor.name;if(!O1.has(Z)){console.warn("getSchemaDefaultForField: Unhandled type",$.constructor.name);return}return O1.get(Z)($)}function q$($){if(M$($,s.ZodRecord))return{};if(M$($,s.ZodPipe))return q$($.def.in);if(M$($,s.ZodIntersection))return{...q$($.def.left),...q$($.def.right)};if(M$($,s.ZodUnion)){for(let Z of $.def.options)if(M$(Z,s.ZodObject))return q$(Z);return console.warn("getSchemaDefaultObject: No object found in union, returning empty object"),{}}return M$($,s.ZodObject)?Object.fromEntries(Object.entries($.shape).map(([Z,Y])=>[Z,l$(Y)]).filter((Z)=>Z[1]!==void 0)):(console.warn(`getSchemaDefaultObject: Expected object schema, got ${$.constructor.name}`),{})}import{tool as x8,HumanMessage as d8}from"langchain";import{z as s1}from"zod";var i8=s1.object({task_store:s1.record(s1.string(),s1.any()).default({})}),o8=s1.object({task_id:s1.string().optional().describe("The task id to ask the subagent, if not provided, will use the tool call id"),subagent_id:s1.string(),task_description:s1.string().describe("Describe the user state and what you want the subagent to do."),data_transfer:s1.any().optional().describe("Data to transfer to the subagent.")});import H from"zod";var y=hZ(),AY=H.object({thread_id:H.string().optional(),thread_ts:H.string().optional()}).catchall(H.unknown()),y$=H.object({tags:H.array(H.string()).optional(),recursion_limit:H.number().int().optional(),configurable:AY.optional()}).catchall(H.unknown()).describe("The configuration of an assistant.");H.object({assistant_id:H.string(),graph_id:H.string(),config:y$,created_at:H.string(),updated_at:H.string(),metadata:H.object({}).catchall(H.any())});var u1=H.object({source:H.union([H.literal("input"),H.literal("loop"),H.literal("update"),H.string()]).optional(),step:H.number().optional(),writes:H.any().nullable().optional(),parents:H.any().optional()}).catchall(H.unknown()),P0=H.object({node:H.string(),input:H.unknown().optional()}),jZ=H.object({update:H.union([H.any(),H.array(H.tuple([H.string(),H.any()]))]).nullable().optional(),resume:H.unknown().optional(),goto:H.union([P0,H.array(P0),H.string(),H.array(H.string())]).optional()});H.object({limit:H.number().int().optional(),offset:H.number().int().optional()});var F1=H.object({thread_id:H.string()}),i$=H.object({thread_id:H.string(),run_id:H.string()}),wY=H.object({graph_id:H.string().optional(),metadata:u1.optional(),limit:H.number().int().optional(),offset:H.number().int().optional(),sort_by:H.enum(["assistant_id","graph_id","name","created_at","updated_at"]).optional(),sort_order:H.enum(["asc","desc"]).optional()}),MY=H.object({graph_id:H.string().optional(),metadata:u1.optional()}),qY=H.object({xray:H.union([H.string(),H.boolean(),H.number()]).optional()}),C0=H.object({name:H.string().optional(),description:H.string().optional(),metadata:u1.optional(),config:y$.optional()}).optional(),bY=H.object({assistant_id:H.string().optional(),graph_id:H.string().describe("The ID of graph to create an assistant from."),name:H.string().optional(),description:H.string().optional(),metadata:u1.optional(),config:y$.optional(),if_exists:H.enum(["raise","do_nothing"]).optional()}),RY=H.object({assistant_id:H.union([H.string(),H.string()]),checkpoint_id:H.string().optional(),input:H.any().optional(),command:jZ.optional(),metadata:u1.optional(),config:y$.optional(),webhook:H.string().optional(),interrupt_before:H.union([H.literal("*"),H.array(H.string())]).optional(),interrupt_after:H.union([H.literal("*"),H.array(H.string())]).optional(),on_disconnect:H.enum(["cancel","continue"]).optional().default("continue"),multitask_strategy:H.enum(["reject","rollback","interrupt","enqueue"]).optional(),stream_mode:H.array(H.enum(["values","messages","messages-tuple","updates","events","debug","custom"])).optional(),stream_subgraphs:H.boolean().optional(),stream_resumable:H.boolean().optional(),after_seconds:H.number().optional(),if_not_exists:H.enum(["create","reject"]).optional(),on_completion:H.enum(["complete","continue"]).optional(),feedback_keys:H.array(H.string()).optional(),langsmith_tracer:H.unknown().optional()}).describe("Payload for creating a stateful run."),BY=H.object({limit:H.coerce.number().int().optional().default(10),offset:H.coerce.number().int().optional().default(0),status:H.enum(["pending","running","error","success","timeout","interrupted"]).optional()}),fY=H.object({wait:H.coerce.boolean().optional().default(!1),action:H.enum(["interrupt","rollback"]).optional().default("interrupt")}),PY=H.object({cancel_on_disconnect:H.coerce.boolean().optional().default(!1),last_event_id:H.string().optional(),stream_mode:H.enum(["values","messages","messages-tuple","updates","events","debug","custom"]).optional()}),CY=H.object({thread_id:H.string().describe("The ID of thread. If not provided, an ID is generated.").optional(),metadata:u1.optional(),if_exists:H.union([H.literal("raise"),H.literal("do_nothing")]).optional()}).describe("Payload for creating a thread."),S0=H.object({ids:H.array(H.string()).describe("List of thread IDs to include. Others are excluded.").optional(),metadata:u1.describe("Metadata to search for.").optional(),status:H.enum(["idle","busy","interrupted","error"]).describe("Filter by thread status.").optional(),values:H.any().describe("Filter by thread values.").optional(),limit:H.number().int().gte(1).lte(1000).describe("Maximum number to return.").optional(),offset:H.number().int().gte(0).describe("Offset to start from.").optional(),sort_by:H.enum(["thread_id","status","created_at","updated_at"]).describe("Sort by field.").optional(),sort_order:H.enum(["asc","desc"]).describe("Sort order.").optional(),select:H.array(H.enum(["thread_id","created_at","updated_at","metadata","config","context","status","values","interrupts"])).describe("Specify which fields to return. If not provided, all fields are returned.").optional(),without_details:H.boolean().describe("Whether to return values.").optional()}).describe("Payload for listing threads.");H.object({values:H.union([H.record(H.string(),H.unknown()),H.array(H.record(H.string(),H.unknown()))]).nullish()}).describe("Payload for adding state to a thread.");var SY=H.object({metadata:u1.optional(),status:H.enum(["idle","busy","interrupted","error"]).optional(),values:H.any().optional()}).describe("Payload for patching a thread."),I0=H.object({assistant_id:H.string(),input:H.any().optional(),command:jZ.optional(),metadata:u1.optional(),config:y$.optional(),webhook:H.string().optional(),interrupt_before:H.union([H.literal("*"),H.array(H.string())]).optional(),interrupt_after:H.union([H.literal("*"),H.array(H.string())]).optional(),on_disconnect:H.enum(["cancel","continue"]).optional().default("continue"),multitask_strategy:H.enum(["reject","rollback","interrupt","enqueue"]).optional(),stream_mode:H.array(H.enum(["values","messages","messages-tuple","updates","events","debug","custom"])).optional(),stream_subgraphs:H.boolean().optional(),stream_resumable:H.boolean().optional(),after_seconds:H.number().optional(),if_not_exists:H.enum(["create","reject"]).optional(),on_completion:H.enum(["complete","continue"]).optional(),feedback_keys:H.array(H.string()).optional(),langsmith_tracer:H.unknown().optional()}).describe("Payload for creating a run (background/wait)."),IY=H.object({cancel_on_disconnect:H.coerce.boolean().optional().default(!1)}),vY=H.object({cancel_on_disconnect:H.coerce.boolean().optional().default(!1)}),WZ=H.object({assistant_id:H.string().describe("The assistant ID or graph name to run."),input:H.any().optional().describe("The input to the graph."),command:jZ.optional(),metadata:u1.optional().describe("Metadata to assign to the run."),config:y$.optional(),context:H.object({}).catchall(H.any()).optional().describe("Static context added to the assistant."),webhook:H.string().optional(),interrupt_before:H.union([H.literal("*"),H.array(H.string())]).optional(),interrupt_after:H.union([H.literal("*"),H.array(H.string())]).optional(),stream_mode:H.union([H.enum(["values","messages","messages-tuple","tasks","checkpoints","updates","events","debug","custom"]),H.array(H.enum(["values","messages","messages-tuple","tasks","checkpoints","updates","events","debug","custom"]))]).optional().default(["values"]),feedback_keys:H.array(H.string()).optional(),stream_subgraphs:H.boolean().optional().default(!1),stream_resumable:H.boolean().optional().default(!1)}).describe("Payload for creating a stateless run."),kY=H.array(WZ).min(1).describe("Payload for creating a batch of stateless runs."),TY=H.object({action:H.enum(["interrupt","rollback"]).optional().default("interrupt").describe("Action to take when cancelling the run."),wait:H.coerce.boolean().optional().default(!1)}),yY=H.union([H.object({status:H.enum(["pending","running","all"]).describe("Filter runs by status to cancel.")}),H.object({thread_id:H.string().describe("The ID of the thread containing runs to cancel.")}),H.object({run_ids:H.array(H.string()).min(1).describe("List of run IDs to cancel.")})]);function e($,Z){let Y=Z.split("/").filter((K)=>K),J=new URL($).pathname.split("/").filter((K)=>K),X={};return Y.forEach((K,W)=>{if(K.startsWith(":")){let O=K.slice(1);X[O]=J[W]}}),X}function k1($){let Z=new URL($).searchParams,Y={};return Z.forEach((J,X)=>{if(!isNaN(Number(J))&&J!=="")Y[X]=Number(J);else if(J==="true"||J==="false")Y[X]=J==="true";else Y[X]=J}),Y}function I($,Z){let Y=$.safeParse(Z);if(!Y.success)throw new EZ(Y.error.issues);return Y.data}class EZ extends Error{errors;constructor($){super("Validation failed");this.name="ValidationError",this.errors=$}}function V($,Z=200,Y){return new Response(JSON.stringify($),{status:Z,headers:{"Content-Type":"application/json",...Y}})}function v($,Z=500){if($ instanceof EZ)return V({error:"Validation Error",details:$.errors},400);return V({error:$ instanceof Error?$.message:"Unknown error"},Z)}function gZ($){let Z,Y=!1,J=new AbortController,X=new ReadableStream({async start(K){Z=K;let W=new TextEncoder,O={signal:J.signal,writeSSE:async({data:_,event:G,id:N})=>{if(Y||J.signal.aborted)return;try{let z="";if(N)z+=`id: ${N}
2
+ `;if(G)z+=`event: ${G}
3
+ `;z+=`data: ${_}
4
4
 
5
- `,Y.enqueue(K.encode(G))}catch(G){if(!X&&!J.signal.aborted)throw G}},close:()=>{if(!X){X=!0;try{Y.close()}catch(W){}}}};try{await Z(U)}catch(W){if(!J.signal.aborted)console.error("SSE stream error:",W)}finally{if(!X){X=!0;try{Y.close()}catch(W){}}}},cancel(){if(X=!0,!J.signal.aborted)J.abort("Client disconnected")}});return new Response(Q,{headers:{"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"}})}function aY(Z,Y=process.env.HEARTBEAT_INTERVAL?parseInt(process.env.HEARTBEAT_INTERVAL):1500){return async(X)=>{let J=null,Q=!1,$=()=>{if(J)clearInterval(J),J=null},K=()=>{$(),J=setInterval(async()=>{if(X.signal.aborted||Q){$();return}try{await X.writeSSE({event:"ping",data:"{}"})}catch(z){$()}},Y)},U=()=>{$()};X.signal.addEventListener("abort",U);let W={signal:X.signal,writeSSE:async(z)=>{if(X.signal.aborted)return;if($(),await X.writeSSE(z),!X.signal.aborted)K()},close:()=>{$(),X.close()}};K();try{await Z(W)}finally{Q=!0,$(),X.signal.removeEventListener("abort",U)}}}async function a1(Z,Y){try{let X=await Z.json(),J=S(y1,X),Q=await x.assistants.search(FZ(J));return m(Q,200,{"X-Pagination-Total":"0"})}catch(X){return k(X)}}async function s1(Z,Y){try{let X=await Z.json(),J=S(k1,X),Q=await x.assistants.count(FZ(J));return m(Q)}catch(X){return k(X)}}async function t1(Z,Y){try{let Q=new URL(Z.url).pathname.split("/").filter((K)=>K)[1],$=await x.assistants.get(Q);return m($)}catch(X){return k(X)}}async function e1(Z,Y){try{let Q=new URL(Z.url).pathname.split("/").filter(($)=>$)[1];return await x.assistants.delete(Q),m({})}catch(X){return k(X)}}async function ZQ(Z,Y){try{let Q=new URL(Z.url).pathname.split("/").filter((W)=>W)[1],$=await Z.json(),K=S(F8,$),U=await x.assistants.update(Q,FZ(K));return m(U)}catch(X){return k(X)}}async function YQ(Z,Y){try{let Q=new URL(Z.url).pathname.split("/").filter((W)=>W)[1],$=lZ(Z.url),{xray:K}=S(h1,$),U=await x.assistants.getGraph(Q,{xray:K!==void 0?K==="true":void 0});return m(U)}catch(X){return k(X)}}async function XQ(Z,Y){return k({},501)}async function JQ(Z,Y){return k({},501)}async function QQ(Z,Y){try{let Q=new URL(Z.url).pathname.split("/").filter((K)=>K)[1],$=await x.assistants.getSchemas(Q);return m($)}catch(X){return k(X)}}async function $Q(Z,Y){try{let Q=new URL(Z.url).pathname.split("/").filter((W)=>W)[1],$=await Z.json(),K=S(F8,$),U=await x.assistants.getVersions(Q,FZ(K));return m(U)}catch(X){return k(X)}}async function KQ(Z,Y){try{let Q=new URL(Z.url).pathname.split("/").filter((W)=>W)[1],$=lZ(Z.url),K=$.version?parseInt($.version):1,U=await x.assistants.setLatest(Q,K);return m(U)}catch(X){return k(X)}}async function WQ(Z,Y){try{let X=await Z.json(),J=S(x1,X),Q=await x.assistants.create(FZ(J));return m(Q)}catch(X){return k(X)}}async function UQ(Z,Y){try{let X=await Z.json(),J=S(d1,X),Q=await x.threads.create(FZ(J));return m(Q)}catch(X){return k(X)}}async function zQ(Z,Y){try{let X=await Z.json(),J=S(M8,X),Q=await x.threads.search(FZ(J));return m(Q,200,{"X-Pagination-Total":Q.length.toString()})}catch(X){return k(X)}}async function HQ(Z,Y){try{let X=await Z.json(),J=S(M8.partial(),X),Q=await x.threads.count(FZ(J));return m(Q)}catch(X){return k(X)}}async function GQ(Z,Y){try{let X=KZ(Z.url,"/threads/:thread_id"),{thread_id:J}=S(DZ,X),Q=await x.threads.get(J);return m(Q)}catch(X){return k(X)}}async function OQ(Z,Y){try{let X=KZ(Z.url,"/threads/:thread_id"),{thread_id:J}=S(DZ,X),Q=await Z.json(),$=S(c1,Q),K=await x.threads.patch(J,FZ($));return m(K)}catch(X){return k(X)}}async function qQ(Z,Y){try{let X=KZ(Z.url,"/threads/:thread_id"),{thread_id:J}=S(DZ,X);return await x.threads.delete(J),new Response(null,{status:204})}catch(X){return k(X)}}async function FQ(Z,Y){try{let X=KZ(Z.url,"/threads/:thread_id/state"),{thread_id:J}=S(DZ,X),Q=lZ(Z.url),$={subgraphs:Q.subgraphs==="true"||Q.subgraphs===!0},K=await x.threads.getState(J,$);return m(K)}catch(X){return k(X)}}async function MQ(Z,Y){try{let X=KZ(Z.url,"/threads/:thread_id/state"),{thread_id:J}=S(DZ,X),Q=await Z.json(),$=await x.threads.updateState(J,FZ(Q));return m($)}catch(X){return k(X)}}async function NQ(Z,Y){try{let X=KZ(Z.url,"/threads/:thread_id/state/checkpoint"),{thread_id:J}=S(DZ,X),Q=await Z.json(),$=lZ(Z.url),K={subgraphs:$.subgraphs==="true"||$.subgraphs===!0,...Q},U=await x.threads.getState(J,K);return m(U)}catch(X){return k(X)}}async function _Q(Z,Y){try{let X=KZ(Z.url,"/threads/:thread_id/history"),{thread_id:J}=S(DZ,X),Q=lZ(Z.url),$={limit:Q.limit?parseInt(Q.limit,10):void 0,before:Q.before},K=await x.threads.getStateHistory(J,$);return m(K)}catch(X){return k(X)}}async function AQ(Z,Y){try{let X=KZ(Z.url,"/threads/:thread_id/history"),{thread_id:J}=S(DZ,X),Q=await Z.json(),$={limit:Q.limit,before:Q.before},K=await x.threads.getStateHistory(J,$);return m(K)}catch(X){return k(X)}}async function wQ(Z,Y){try{let X=KZ(Z.url,"/threads/:thread_id/copy"),{thread_id:J}=S(DZ,X),Q=await x.threads.copy(J);return m(Q)}catch(X){return k(X)}}async function BQ(Z,Y){try{let X=KZ(Z.url,"/threads/:thread_id/stream"),{thread_id:J}=S(DZ,X),Q=lZ(Z.url),$={lastEventId:Z.headers.get("Last-Event-ID")||Q.last_event_id,streamModes:Q.stream_modes?Array.isArray(Q.stream_modes)?Q.stream_modes:[Q.stream_modes]:void 0};return new Response(`data: {"status": "stream_ready"}
5
+ `,Z.enqueue(W.encode(z))}catch(z){if(!Y&&!J.signal.aborted)throw z}},close:()=>{if(!Y){Y=!0;try{Z.close()}catch(_){}}}};try{await $(O)}catch(_){if(!J.signal.aborted)console.error("SSE stream error:",_)}finally{if(!Y){Y=!0;try{Z.close()}catch(_){}}}},cancel(){if(Y=!0,!J.signal.aborted)J.abort("Client disconnected")}});return new Response(X,{headers:{"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"}})}function pZ($,Z=process.env.HEARTBEAT_INTERVAL?parseInt(process.env.HEARTBEAT_INTERVAL):1500){return async(Y)=>{let J=null,X=!1,K=()=>{if(J)clearInterval(J),J=null},W=()=>{K(),J=setInterval(async()=>{if(Y.signal.aborted||X){K();return}try{await Y.writeSSE({event:"ping",data:"{}"})}catch(G){K()}},Z)},O=()=>{K()};Y.signal.addEventListener("abort",O);let _={signal:Y.signal,writeSSE:async(G)=>{if(Y.signal.aborted)return;if(K(),await Y.writeSSE(G),!Y.signal.aborted)W()},close:()=>{K(),Y.close()}};W();try{await $(_)}finally{X=!0,K(),Y.signal.removeEventListener("abort",O)}}}async function hY($,Z){try{let Y=await $.json(),J=I(wY,Y),X=await y.assistants.search(K1(J));return V(X,200,{"X-Pagination-Total":"0"})}catch(Y){return v(Y)}}async function DY($,Z){try{let Y=await $.json(),J=I(MY,Y),X=await y.assistants.count(K1(J));return V(X)}catch(Y){return v(Y)}}async function VY($,Z){try{let X=new URL($.url).pathname.split("/").filter((W)=>W)[1],K=await y.assistants.get(X);return V(K)}catch(Y){return v(Y)}}async function jY($,Z){try{let X=new URL($.url).pathname.split("/").filter((K)=>K)[1];return await y.assistants.delete(X),V({})}catch(Y){return v(Y)}}async function EY($,Z){try{let X=new URL($.url).pathname.split("/").filter((_)=>_)[1],K=await $.json(),W=I(C0,K),O=await y.assistants.update(X,K1(W));return V(O)}catch(Y){return v(Y)}}async function gY($,Z){try{let X=new URL($.url).pathname.split("/").filter((_)=>_)[1],K=k1($.url),{xray:W}=I(qY,K),O=await y.assistants.getGraph(X,{xray:W!==void 0?W==="true":void 0});return V(O)}catch(Y){return v(Y)}}async function pY($,Z){return v({},501)}async function mY($,Z){return v({},501)}async function cY($,Z){try{let X=new URL($.url).pathname.split("/").filter((W)=>W)[1],K=await y.assistants.getSchemas(X);return V(K)}catch(Y){return v(Y)}}async function uY($,Z){try{let X=new URL($.url).pathname.split("/").filter((_)=>_)[1],K=await $.json(),W=I(C0,K),O=await y.assistants.getVersions(X,K1(W));return V(O)}catch(Y){return v(Y)}}async function xY($,Z){try{let X=new URL($.url).pathname.split("/").filter((_)=>_)[1],K=k1($.url),W=K.version?parseInt(K.version):1,O=await y.assistants.setLatest(X,W);return V(O)}catch(Y){return v(Y)}}async function dY($,Z){try{let Y=await $.json(),J=I(bY,Y),X=await y.assistants.create(K1(J));return V(X)}catch(Y){return v(Y)}}async function lY($,Z){try{let Y=await $.json(),J=I(CY,Y),X=await y.threads.create(K1(J));return V(X)}catch(Y){return v(Y)}}async function iY($,Z){try{let Y=await $.json(),J=I(S0,Y),X=await y.threads.search(K1(J));return V(X,200,{"X-Pagination-Total":X.length.toString()})}catch(Y){return v(Y)}}async function oY($,Z){try{let Y=await $.json(),J=I(S0.partial(),Y),X=await y.threads.count(K1(J));return V(X)}catch(Y){return v(Y)}}async function rY($,Z){try{let Y=e($.url,"/threads/:thread_id"),{thread_id:J}=I(F1,Y),X=await y.threads.get(J);return V(X)}catch(Y){return v(Y)}}async function nY($,Z){try{let Y=e($.url,"/threads/:thread_id"),{thread_id:J}=I(F1,Y),X=await $.json(),K=I(SY,X),W=await y.threads.patch(J,K1(K));return V(W)}catch(Y){return v(Y)}}async function aY($,Z){try{let Y=e($.url,"/threads/:thread_id"),{thread_id:J}=I(F1,Y);return await y.threads.delete(J),new Response(null,{status:204})}catch(Y){return v(Y)}}async function sY($,Z){try{let Y=e($.url,"/threads/:thread_id/state"),{thread_id:J}=I(F1,Y),X=k1($.url),K={subgraphs:X.subgraphs==="true"||X.subgraphs===!0},W=await y.threads.getState(J,K);return V(W)}catch(Y){return v(Y)}}async function tY($,Z){try{let Y=e($.url,"/threads/:thread_id/state"),{thread_id:J}=I(F1,Y),X=await $.json(),K=await y.threads.updateState(J,K1(X));return V(K)}catch(Y){return v(Y)}}async function eY($,Z){try{let Y=e($.url,"/threads/:thread_id/state/checkpoint"),{thread_id:J}=I(F1,Y),X=await $.json(),K=k1($.url),W={subgraphs:K.subgraphs==="true"||K.subgraphs===!0,...X},O=await y.threads.getState(J,W);return V(O)}catch(Y){return v(Y)}}async function $3($,Z){try{let Y=e($.url,"/threads/:thread_id/history"),{thread_id:J}=I(F1,Y),X=k1($.url),K={limit:X.limit?parseInt(X.limit,10):void 0,before:X.before},W=await y.threads.getStateHistory(J,K);return V(W)}catch(Y){return v(Y)}}async function Z3($,Z){try{let Y=e($.url,"/threads/:thread_id/history"),{thread_id:J}=I(F1,Y),X=await $.json(),K={limit:X.limit,before:X.before},W=await y.threads.getStateHistory(J,K);return V(W)}catch(Y){return v(Y)}}async function Y3($,Z){try{let Y=e($.url,"/threads/:thread_id/copy"),{thread_id:J}=I(F1,Y),X=await y.threads.copy(J);return V(X)}catch(Y){return v(Y)}}async function X3($,Z){try{let Y=e($.url,"/threads/:thread_id/stream"),{thread_id:J}=I(F1,Y),X=k1($.url),K={lastEventId:$.headers.get("Last-Event-ID")||X.last_event_id,streamModes:X.stream_modes?Array.isArray(X.stream_modes)?X.stream_modes:[X.stream_modes]:void 0};return new Response(`data: {"status": "stream_ready"}
6
6
 
7
- `,{headers:{"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"}})}catch(X){return k(X)}}async function LQ(Z,Y){try{let X=KZ(Z.url,"/threads/:thread_id/runs/stream"),{thread_id:J}=S(DZ,X),Q=await Z.json(),$=S(g1,Q);return nY(aY(async(K)=>{$.config=$.config||{},$.config.configurable=$.config.configurable||{};let U=Y?.langgraph_context;if(U)Object.assign($.config.configurable,U);let W=null,z=!1,H=()=>{z=!0};K.signal.addEventListener("abort",H);try{W=x.runs.stream(J,$.assistant_id,FZ($));for await(let{event:G,data:F}of W){if(z||K.signal.aborted)break;await K.writeSSE({data:iY(F)??"",event:G})}}catch(G){if(!K.signal.aborted&&!z)throw G}finally{if(K.signal.removeEventListener("abort",H),W){try{await W.return(void 0)}catch(G){}W=null}}}))}catch(X){return k(X)}}async function PQ(Z,Y){try{let X=KZ(Z.url,"/threads/:thread_id/runs/:run_id/stream"),{thread_id:J,run_id:Q}=S(_0,X),$=lZ(Z.url),{cancel_on_disconnect:K,last_event_id:U,stream_mode:W}=S(p1,$);return nY(aY(async(z)=>{let H=new AbortController,G=null,F=!1,M=[],N=()=>{H.abort("Client disconnected")};if(Z.signal)Z.signal.addEventListener("abort",N),M.push({signal:Z.signal,handler:N});let w=()=>{F=!0,H.abort("SSE stream closed")};z.signal.addEventListener("abort",w),M.push({signal:z.signal,handler:w});try{G=x.runs.joinStream(J,Q,{signal:H.signal,cancelOnDisconnect:K,lastEventId:U,streamMode:W?[W]:void 0});for await(let{event:L,data:B,id:C}of G){if(F||z.signal.aborted||H.signal.aborted)break;await z.writeSSE({data:iY(B)??"",event:L,id:C})}}catch(L){if(!(H.signal.aborted||z.signal.aborted)&&!(L instanceof Error&&L.message.includes("user cancel")))console.error("Join stream error:",L),await z.writeSSE({event:"error",data:JSON.stringify({error:L instanceof Error?L.message:"Unknown error"})})}finally{for(let{signal:L,handler:B}of M)try{L.removeEventListener("abort",B)}catch(C){}if(G){try{await G.return(void 0)}catch(L){}G=null}}}))}catch(X){return k(X)}}async function RQ(Z,Y){try{let X=KZ(Z.url,"/threads/:thread_id/runs"),{thread_id:J}=S(DZ,X),Q=lZ(Z.url),{limit:$,offset:K,status:U}=S(u1,Q),W=await x.runs.list(J,{limit:$,offset:K,status:U});return m(W)}catch(X){return k(X)}}async function CQ(Z,Y){try{let X=KZ(Z.url,"/threads/:thread_id/runs/:run_id/cancel"),{thread_id:J,run_id:Q}=S(_0,X),$=lZ(Z.url),{wait:K,action:U}=S(m1,$),W=x.runs.cancel(J,Q,K,U);if(K)await W;return new Response(null,{status:K?204:202})}catch(X){return k(X)}}async function IQ(Z,Y){try{let X=KZ(Z.url,"/threads/:thread_id/runs"),{thread_id:J}=S(DZ,X),Q=await Z.json(),$=S(N8,Q),K=FZ($);K.config=K.config||{},K.config.configurable=K.config.configurable||{};let U=Y?.langgraph_context;if(U)Object.assign(K.config.configurable,U);K.config.configurable.graph_id=$.assistant_id,K.config.configurable.thread_id=J;let W=x.threads,z=await W.createRun(J,$.assistant_id,K);return(async()=>{let H=!1;try{for await(let G of F4(W,z,K,{attempt:0,getGraph:cZ}));}catch(G){console.error("Background run error:",G)}finally{if(!H){H=!0;try{await dZ.globalMessageQueue.removeQueue(z.run_id)}catch(G){}}}})(),m(z,200,{"Content-Location":`/threads/${J}/runs/${z.run_id}`})}catch(X){return k(X)}}async function vQ(Z,Y){try{let X=KZ(Z.url,"/threads/:thread_id/runs/wait"),{thread_id:J}=S(DZ,X),Q=await Z.json(),$=S(N8,Q),K=lZ(Z.url),{cancel_on_disconnect:U}=S(l1,K),W=FZ($);W.config=W.config||{},W.config.configurable=W.config.configurable||{};let z=Y?.langgraph_context;if(z)Object.assign(W.config.configurable,z);W.config.configurable.graph_id=$.assistant_id,W.config.configurable.thread_id=J;let H=x.threads,G=await H.createRun(J,$.assistant_id,W),F={};for await(let{event:M,data:N}of F4(H,G,W,{attempt:0,getGraph:cZ}))if(M==="end"||M==="writes/value"){if(N&&typeof N==="object")Object.assign(F,N)}return m(F,200,{"Content-Location":`/threads/${J}/runs/${G.run_id}`})}catch(X){return k(X)}}async function DQ(Z,Y){try{let X=KZ(Z.url,"/threads/:thread_id/runs/:run_id"),{thread_id:J,run_id:Q}=S(_0,X),K=(await x.runs.list(J,{limit:1000})).find((U)=>U.run_id===Q);if(!K)return k(Error("Run not found"),404);return m(K)}catch(X){return k(X)}}async function VQ(Z,Y){try{let X=KZ(Z.url,"/threads/:thread_id/runs/:run_id"),{thread_id:J,run_id:Q}=S(_0,X);return await x.threads.updateRun(Q,{status:"deleted"}),new Response(null,{status:204})}catch(X){return k(X)}}async function EQ(Z,Y){try{let X=KZ(Z.url,"/threads/:thread_id/runs/:run_id/join"),{thread_id:J,run_id:Q}=S(_0,X),$=lZ(Z.url),{cancel_on_disconnect:K}=S(i1,$),W=(await x.runs.list(J,{limit:1000})).find((G)=>G.run_id===Q);if(!W)return k(Error("Run not found"),404);if(W.status==="success"||W.status==="error")return m({});let z=new AbortController;if(K){let G=()=>{z.abort("Client disconnected")};Z.signal?.addEventListener("abort",G)}let H={};for await(let{event:G,data:F}of x.runs.joinStream(J,Q,{signal:z.signal,cancelOnDisconnect:K}))if(G.event==="end"||G.event==="writes/value"){if(F&&typeof F==="object")Object.assign(H,F)}return m(H)}catch(X){return k(X)}}async function bQ(Z,Y){try{let X=await Z.json(),J=S(c0,X),Q=FZ(J);Q.config=Q.config||{},Q.config.configurable=Q.config.configurable||{};let $=Y?.langgraph_context;if($)Object.assign(Q.config.configurable,$);let K=x.threads,U=await K.create({metadata:{...Q.metadata,temporary:!0}});Q.config.configurable.graph_id=J.assistant_id,Q.config.configurable.thread_id=U.thread_id,Q.temporary=!0;let W=await K.createRun(U.thread_id,J.assistant_id,Q);return(async()=>{let z=!1;try{for await(let H of F4(K,W,Q,{attempt:0,getGraph:cZ}));}catch(H){console.error("Stateless run error:",H)}finally{try{await K.delete(U.thread_id)}catch(H){console.error("Error cleaning up temporary thread:",H)}if(!z){z=!0;try{await dZ.globalMessageQueue.removeQueue(W.run_id)}catch(H){}}}})(),m(W,200,{"Content-Location":`/threads/${U.thread_id}/runs/${W.run_id}`})}catch(X){return k(X)}}async function TQ(Z,Y){try{let X=await Z.json(),J=S(c0,X),Q=FZ(J);Q.config=Q.config||{},Q.config.configurable=Q.config.configurable||{};let $=Y?.langgraph_context;if($)Object.assign(Q.config.configurable,$);let K=x.threads,U=await K.create({metadata:{...Q.metadata,temporary:!0}});Q.config.configurable.graph_id=J.assistant_id,Q.config.configurable.thread_id=U.thread_id,Q.temporary=!0;let W=await K.createRun(U.thread_id,J.assistant_id,Q);return nY(aY(async(z)=>{try{for await(let H of F4(K,W,Q,{attempt:0,getGraph:cZ}))await z.writeSSE({data:JSON.stringify(H),event:"data"})}catch(H){if(H instanceof Error&&H.name!=="AbortError")throw console.error("Stream error:",H),H}finally{try{await K.delete(U.thread_id)}catch(H){console.error("Error cleaning up temporary thread:",H)}}}))}catch(X){return k(X)}}async function fQ(Z,Y){try{let X=await Z.json(),J=S(c0,X),Q=FZ(J);Q.config=Q.config||{},Q.config.configurable=Q.config.configurable||{};let $=Y?.langgraph_context;if($)Object.assign(Q.config.configurable,$);let K=x.threads,U=await K.create({metadata:{...Q.metadata,temporary:!0}});Q.config.configurable.graph_id=J.assistant_id,Q.config.configurable.thread_id=U.thread_id,Q.temporary=!0;let W=await K.createRun(U.thread_id,J.assistant_id,Q),z={};try{for await(let{event:H,data:G}of F4(K,W,Q,{attempt:0,getGraph:cZ}))if(H==="end"||H==="writes/value"){if(G&&typeof G==="object")Object.assign(z,G)}}finally{try{await K.delete(U.thread_id)}catch(H){console.error("Error cleaning up temporary thread:",H)}}return m(z,200,{"Content-Location":`/threads/${U.thread_id}/runs/${W.run_id}`})}catch(X){return k(X)}}async function jQ(Z,Y){try{let X=await Z.json(),J=S(r1,X),Q=x.threads,$=[],K=J.map(async(W)=>{try{let z=FZ(W);z.config=z.config||{},z.config.configurable=z.config.configurable||{};let H=Y?.langgraph_context;if(H)Object.assign(z.config.configurable,H);let G=await Q.create({metadata:{...z.metadata,temporary:!0}});z.config.configurable.graph_id=W.assistant_id,z.config.configurable.thread_id=G.thread_id,z.temporary=!0;let F=await Q.createRun(G.thread_id,W.assistant_id,z);return(async()=>{let M=!1;try{for await(let N of F4(Q,F,z,{attempt:0,getGraph:cZ}));}catch(N){console.error("Batch run error:",N)}finally{try{await Q.delete(G.thread_id)}catch(N){console.error("Error cleaning up temporary thread:",N)}if(!M){M=!0;try{await dZ.globalMessageQueue.removeQueue(F.run_id)}catch(N){}}}})(),{thread_id:G.thread_id,run_id:F.run_id}}catch(z){return console.error("Batch run creation error:",z),{error:(z instanceof Error?z.message:"Unknown error")||"Unknown error"}}}),U=await Promise.all(K);return $.push(...U),m($,200)}catch(X){return k(X)}}async function SQ(Z,Y){try{let X=await Z.json(),J=S(n1,X),Q=new URL(Z.url),$=S(o1,{action:Q.searchParams.get("action")||"interrupt"}),K=x.threads,U=[];if("run_ids"in J&&J.run_ids)for(let W of J.run_ids)try{console.warn(`Cancel by run_id ${W} not fully implemented yet`)}catch(z){console.error(`Error cancelling run ${W}:`,z)}else if("thread_id"in J&&J.thread_id){let W=J.thread_id;try{let z=await K.listRuns(W,{limit:1000,offset:0});for(let H of z)try{x.runs.cancel(W,H.run_id,$.wait,$.action),U.push(H.run_id)}catch(G){console.error(`Error cancelling run ${H.run_id}:`,G)}}catch(z){console.error(`Error listing runs for thread ${W}:`,z)}}else if("status"in J&&J.status)console.warn(`Cancel by status ${J.status} not fully implemented yet`);return new Response(null,{status:204})}catch(X){return k(X)}}var yQ=[{method:"POST",pattern:/^\/assistants\/search$/,handler:a1},{method:"POST",pattern:/^\/assistants\/count$/,handler:s1},{method:"GET",pattern:/^\/assistants\/[^/]+$/,handler:t1},{method:"DELETE",pattern:/^\/assistants\/[^/]+$/,handler:e1},{method:"PATCH",pattern:/^\/assistants\/[^/]+$/,handler:ZQ},{method:"GET",pattern:/^\/assistants\/[^/]+\/graph$/,handler:YQ},{method:"GET",pattern:/^\/assistants\/[^/]+\/subgraphs$/,handler:XQ},{method:"GET",pattern:/^\/assistants\/[^/]+\/subgraphs\/[^/]+$/,handler:JQ},{method:"GET",pattern:/^\/assistants\/[^/]+\/schemas$/,handler:QQ},{method:"POST",pattern:/^\/assistants\/[^/]+\/versions$/,handler:$Q},{method:"POST",pattern:/^\/assistants\/[^/]+\/latest$/,handler:KQ},{method:"POST",pattern:/^\/assistants$/,handler:WQ},{method:"POST",pattern:/^\/threads$/,handler:UQ},{method:"POST",pattern:/^\/threads\/search$/,handler:zQ},{method:"POST",pattern:/^\/threads\/count$/,handler:HQ},{method:"GET",pattern:/^\/threads\/[^/]+$/,handler:GQ},{method:"PATCH",pattern:/^\/threads\/[^/]+$/,handler:OQ},{method:"DELETE",pattern:/^\/threads\/[^/]+$/,handler:qQ},{method:"GET",pattern:/^\/threads\/[^/]+\/state$/,handler:FQ},{method:"POST",pattern:/^\/threads\/[^/]+\/state$/,handler:MQ},{method:"POST",pattern:/^\/threads\/[^/]+\/state\/checkpoint$/,handler:NQ},{method:"GET",pattern:/^\/threads\/[^/]+\/history$/,handler:_Q},{method:"POST",pattern:/^\/threads\/[^/]+\/history$/,handler:AQ},{method:"POST",pattern:/^\/threads\/[^/]+\/copy$/,handler:wQ},{method:"GET",pattern:/^\/threads\/[^/]+\/stream$/,handler:BQ},{method:"POST",pattern:/^\/threads\/[^/]+\/runs$/,handler:IQ},{method:"POST",pattern:/^\/threads\/[^/]+\/runs\/stream$/,handler:LQ},{method:"POST",pattern:/^\/threads\/[^/]+\/runs\/wait$/,handler:vQ},{method:"POST",pattern:/^\/threads\/[^/]+\/runs\/[^/]+\/cancel$/,handler:CQ},{method:"GET",pattern:/^\/threads\/[^/]+\/runs$/,handler:RQ},{method:"GET",pattern:/^\/threads\/[^/]+\/runs\/[^/]+$/,handler:DQ},{method:"DELETE",pattern:/^\/threads\/[^/]+\/runs\/[^/]+$/,handler:VQ},{method:"GET",pattern:/^\/threads\/[^/]+\/runs\/[^/]+\/join$/,handler:EQ},{method:"GET",pattern:/^\/threads\/[^/]+\/runs\/[^/]+\/stream$/,handler:PQ},{method:"POST",pattern:/^\/runs$/,handler:bQ},{method:"POST",pattern:/^\/runs\/stream$/,handler:TQ},{method:"POST",pattern:/^\/runs\/wait$/,handler:fQ},{method:"POST",pattern:/^\/runs\/batch$/,handler:jQ},{method:"POST",pattern:/^\/runs\/cancel$/,handler:SQ}],kQ=(Z)=>{let Y=new URL(Z.url).pathname.toString(),X="";if(Y.includes("/threads"))X=Y.split("/threads")[0];else if(Y.includes("/assistants"))X=Y.split("/assistants")[0];return new Request(Z.url.replace(X,""),{method:Z.method,headers:Z.headers,body:Z.body,duplex:Z.duplex})};async function _8(Z,Y={}){Z=kQ(Z);try{await dZ.initGlobal();let J=new URL(Z.url).pathname,Q=Z.method;for(let $ of yQ)if($.method===Q&&$.pattern.test(J))return await $.handler(Z,Y);return new Response("Not Found",{status:404})}catch(X){return console.error("Request error:",X),k(X)}}import{execa as w8}from"execa";import hQ from"extract-zip";import xQ from"fs-extra";import*as A0 from"node:os";import{dirname as B8,join as gQ}from"node:path";import{pipeline as uQ}from"node:stream/promises";import{fileURLToPath as mQ}from"node:url";import{pathExists as A8}from"path-exists";import{temporaryFile as pQ}from"tempy";import{xdgCache as dQ}from"xdg-basedir";var{mkdir:tY,createWriteStream:cQ,move:lQ}=xQ,L8=B8(mQ(import.meta.url)),iQ="microsoft/ripgrep-prebuilt",sY=process.env.RIPGREP_VERSION||"v15.0.0",rQ=()=>{let Z=process.env.npm_config_arch||A0.arch(),Y=process.env.platform||A0.platform();switch(Y){case"darwin":switch(Z){case"arm64":return"aarch64-apple-darwin.tar.gz";default:return"x86_64-apple-darwin.tar.gz"}case"win32":switch(Z){case"x64":return"x86_64-pc-windows-msvc.zip";case"arm":return"aarch64-pc-windows-msvc.zip";default:return"i686-pc-windows-msvc.zip"}case"linux":switch(Z){case"x64":return"x86_64-unknown-linux-musl.tar.gz";case"arm":case"armv7l":return"arm-unknown-linux-gnueabihf.tar.gz";case"arm64":return"aarch64-unknown-linux-gnu.tar.gz";case"ppc64":return"powerpc64le-unknown-linux-gnu.tar.gz";case"s390x":return"s390x-unknown-linux-gnu.tar.gz";default:return"i686-unknown-linux-musl.tar.gz"}default:throw Error("Unknown platform: "+Y)}},oQ=async(Z,Y)=>{try{let X=pQ(),J=await fetch(Z);if(!J.ok)throw Error(`HTTP ${J.status}: ${J.statusText}`);await uQ(J.body,cQ(X)),await tY(B8(Y),{recursive:!0}),await lQ(X,Y)}catch(X){throw console.error(`Failed to download "${Z}"`),X}},nQ=async(Z,Y)=>{try{await tY(Y,{recursive:!0}),await hQ(Z,{dir:Y})}catch(X){throw console.error(`Failed to unzip "${Z}"`),X}},aQ=async(Z,Y)=>{try{await tY(Y,{recursive:!0}),await w8("tar",["xvf",Z,"-C",Y])}catch(X){throw console.error(`Failed to extract "${Z}"`),X}},sQ=async(Z)=>{if(Z==="android")try{return await w8("pkg",["install","ripgrep","-y"]),!0}catch(Y){return console.info("Could not install ripgrep via pkg. Falling back to download."),!1}return!1},tQ=gQ(L8,`rg${process.platform==="win32"?".exe":""}`),P8=async(Z)=>{if(await A8(tQ)){console.log("rg cached");return}let Y=process.env.platform||A0.platform();if(Y==="android"){if(await sQ(Y))return}let X=rQ(),Q=`${process.env.RIPGREP_PREBUILT_BINARIES_MIRROR||`https://v6.gh-proxy.org/https://github.com/${iQ}/releases/download`}/${sY}/ripgrep-${sY}-${X}`,$=`${dQ}/vscode-ripgrep/ripgrep-${sY}-${X}`,K=Z??L8;if(!await A8($))await oQ(Q,$);else console.info(`File ${$} has been cached`);if($.endsWith(".tar.gz"))await aQ($,K);else if($.endsWith(".zip"))await nQ($,K);else throw Error(`Invalid downloadPath ${$}`)};await P8();lY("code",R8);var C8=(Z,Y={})=>{return _8(new Request(Z,Y),{})};import eQ from"openai";import Z$ from"@anthropic-ai/sdk";import{GoogleGenerativeAI as Y$}from"@google/generative-ai";var X$=async()=>{if(!process.env.ANTHROPIC_API_KEY)return[];let Z=[];try{for await(let Y of new Z$().beta.models.list())Z.push({id:Y.id,name:Y.display_name,provider:"anthropic"})}catch(Y){console.error("Failed to fetch Anthropic models:",Y)}return Z},J$=async()=>{if(!process.env.OPENAI_API_KEY)return[];try{return await new eQ().models.list().then((Z)=>Z.data.map((Y)=>{return{id:Y.id,name:Y.id,provider:"openai"}}).sort((Y,X)=>Y.id.localeCompare(X.id)))}catch(Z){return console.error("Failed to fetch OpenAI models:",Z),[]}},Q$=async()=>{let Z=process.env.GEMINI_API_KEY;if(!Z)return[];let Y=[{id:"gemini-2.5-flash-preview-06-17",name:"Gemini 2.5 Flash Preview (06-17)",provider:"gemini"},{id:"gemini-2.5-pro-preview-06-05",name:"Gemini 2.5 Pro Preview (06-05)",provider:"gemini"},{id:"gemini-2.0-flash",name:"Gemini 2.0 Flash",provider:"gemini"},{id:"gemini-2.0-flash-lite",name:"Gemini 2.0 Flash Lite",provider:"gemini"},{id:"gemini-1.5-flash",name:"Gemini 1.5 Flash",provider:"gemini"},{id:"gemini-1.5-flash-8b",name:"Gemini 1.5 Flash 8B",provider:"gemini"},{id:"gemini-1.5-pro",name:"Gemini 1.5 Pro",provider:"gemini"},{id:"gemini-1.0-pro",name:"Gemini 1.0 Pro",provider:"gemini"},{id:"gemini-2.0-flash-exp",name:"Gemini 2.0 Flash Experimental",provider:"gemini"},{id:"gemini-exp-1206",name:"Gemini Experimental 1206",provider:"gemini"},{id:"gemini-2.5-pro-exp-03-25",name:"Gemini 2.5 Pro Experimental (03-25)",provider:"gemini"},{id:"gemini-2.5-flash-preview-05-20",name:"Gemini 2.5 Flash Preview (05-20)",provider:"gemini"}];try{return await new Y$(Z).getGenerativeModel({model:"gemini-1.5-flash"}),Y}catch(X){return console.error("Failed to verify Gemini API key:",X),[]}},I8=async()=>{return(await Promise.all([X$().catch(()=>[]),J$().catch(()=>[]),Q$().catch(()=>[])])).flat()};var i0=P(g(),1);function v8({tools:Z,setTools:Y}){let X=i0.useRef(!1);i0.useEffect(()=>{if(!X.current)Y(Z),X.current=!0},[Z,Y])}var V8=P(g(),1);function D8(Z){if(!Z)return{isValid:!1,needsSetup:!0,reason:"未找到配置文件"};if(!Z.providers||Z.providers.length===0)return{isValid:!1,needsSetup:!0,reason:"未配置任何 Provider"};let Y=Z.providers.find((X)=>X.id===Z.provider_id);if(!Y)return{isValid:!1,needsSetup:!0,reason:`Provider "${Z.provider_id}" 不存在`,invalidProviderRef:!0};if(!Y.apiKey||Y.apiKey.trim()==="")return{isValid:!1,needsSetup:!0,reason:`Provider "${Z.provider_id}" 未配置 API Key`,missingApiKey:!0};return{isValid:!0,needsSetup:!1}}function E8({config:Z}){return V8.useMemo(()=>{if(!Z)return{validation:null,needsSetup:!0,isValid:!1};let Y=D8(Z);return{validation:Y,needsSetup:Y.needsSetup,isValid:!Y.needsSetup}},[Z])}var b8=P(g(),1);function T8({shouldFocus:Z}){let Y=W4();b8.useEffect(()=>{if(Z)Y.focus("global-input")},[Z,Y])}var gZ=P(g(),1);function f8(){let[Z,Y]=gZ.useState("chat"),X=W4(),J=gZ.useCallback(()=>{Y("history")},[]),Q=gZ.useCallback(()=>{Y("knowledge")},[]),$=gZ.useCallback(()=>{Y("settings")},[]),K=gZ.useCallback(()=>{Y("model-provider")},[]),U=gZ.useCallback(()=>{Y("agent")},[]),W=gZ.useCallback(()=>{Y("task")},[]),z=gZ.useCallback(()=>{Y("mcp")},[]),H=gZ.useCallback(()=>{Y("process")},[]),G=gZ.useCallback(()=>{Y("chat"),X.focus("global-input")},[X]);return{activeView:Z,isChatView:Z==="chat",switchToHistory:J,switchToKnowledge:Q,switchToSettings:$,switchToModelProvider:K,switchToAgent:U,switchToTask:W,switchToMcp:z,switchToProcess:H,closePanel:G}}var r0=P(g(),1);function $$(Z){let Y=`# 任务:${Z.title}
7
+ `,{headers:{"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"}})}catch(Y){return v(Y)}}async function J3($,Z){try{let Y=e($.url,"/threads/:thread_id/runs/stream"),{thread_id:J}=I(F1,Y),X=await $.json(),K=I(RY,X);return gZ(pZ(async(W)=>{K.config=K.config||{},K.config.configurable=K.config.configurable||{};let O=Z?.langgraph_context;if(O)Object.assign(K.config.configurable,O);let _=null,G=!1,N=()=>{G=!0};W.signal.addEventListener("abort",N);try{_=y.runs.stream(J,K.assistant_id,K1(K));for await(let{event:z,data:F}of _){if(G||W.signal.aborted)break;await W.writeSSE({data:VZ(F)??"",event:z})}}catch(z){if(!W.signal.aborted&&!G)throw z}finally{if(W.signal.removeEventListener("abort",N),_){try{await _.return(void 0)}catch(z){}_=null}}}))}catch(Y){return v(Y)}}async function K3($,Z){try{let Y=e($.url,"/threads/:thread_id/runs/:run_id/stream"),{thread_id:J,run_id:X}=I(i$,Y),K=k1($.url),{cancel_on_disconnect:W,last_event_id:O,stream_mode:_}=I(PY,K);return gZ(pZ(async(G)=>{let N=new AbortController,z=null,F=!1,L=[],w=()=>{N.abort("Client disconnected")};if($.signal)$.signal.addEventListener("abort",w),L.push({signal:$.signal,handler:w});let M=()=>{F=!0,N.abort("SSE stream closed")};G.signal.addEventListener("abort",M),L.push({signal:G.signal,handler:M});try{z=y.runs.joinStream(J,X,{signal:N.signal,cancelOnDisconnect:W,lastEventId:O,streamMode:_?[_]:void 0});for await(let{event:b,data:f,id:k}of z){if(F||G.signal.aborted||N.signal.aborted)break;await G.writeSSE({data:VZ(f)??"",event:b,id:k})}}catch(b){if(!(N.signal.aborted||G.signal.aborted)&&!(b instanceof Error&&b.message.includes("user cancel")))console.error("Join stream error:",b),await G.writeSSE({event:"error",data:JSON.stringify({error:b instanceof Error?b.message:"Unknown error"})})}finally{for(let{signal:b,handler:f}of L)try{b.removeEventListener("abort",f)}catch(k){}if(z){try{await z.return(void 0)}catch(b){}z=null}}}))}catch(Y){return v(Y)}}async function W3($,Z){try{let Y=e($.url,"/threads/:thread_id/runs"),{thread_id:J}=I(F1,Y),X=k1($.url),{limit:K,offset:W,status:O}=I(BY,X),_=await y.runs.list(J,{limit:K,offset:W,status:O});return V(_)}catch(Y){return v(Y)}}async function Q3($,Z){try{let Y=e($.url,"/threads/:thread_id/runs/:run_id/cancel"),{thread_id:J,run_id:X}=I(i$,Y),K=k1($.url),{wait:W,action:O}=I(fY,K),_=y.runs.cancel(J,X,W,O);if(W)await _;return new Response(null,{status:W?204:202})}catch(Y){return v(Y)}}async function _3($,Z){try{let Y=e($.url,"/threads/:thread_id/runs"),{thread_id:J}=I(F1,Y),X=await $.json(),K=I(I0,X),W=K1(K);W.config=W.config||{},W.config.configurable=W.config.configurable||{};let O=Z?.langgraph_context;if(O)Object.assign(W.config.configurable,O);W.config.configurable.graph_id=K.assistant_id,W.config.configurable.thread_id=J;let _=y.threads,G=await _.createRun(J,K.assistant_id,W);return(async()=>{let N=!1;try{for await(let z of a1(_,G,W,{attempt:0,getGraph:v1}));}catch(z){console.error("Background run error:",z)}finally{if(!N){N=!0;try{await I1.globalMessageQueue.removeQueue(G.run_id)}catch(z){}}}})(),V(G,200,{"Content-Location":`/threads/${J}/runs/${G.run_id}`})}catch(Y){return v(Y)}}async function O3($,Z){try{let Y=e($.url,"/threads/:thread_id/runs/wait"),{thread_id:J}=I(F1,Y),X=await $.json(),K=I(I0,X),W=k1($.url),{cancel_on_disconnect:O}=I(IY,W),_=K1(K);_.config=_.config||{},_.config.configurable=_.config.configurable||{};let G=Z?.langgraph_context;if(G)Object.assign(_.config.configurable,G);_.config.configurable.graph_id=K.assistant_id,_.config.configurable.thread_id=J;let N=y.threads,z=await N.createRun(J,K.assistant_id,_),F={};for await(let{event:L,data:w}of a1(N,z,_,{attempt:0,getGraph:v1}))if(L==="end"||L==="writes/value"){if(w&&typeof w==="object")Object.assign(F,w)}return V(F,200,{"Content-Location":`/threads/${J}/runs/${z.run_id}`})}catch(Y){return v(Y)}}async function G3($,Z){try{let Y=e($.url,"/threads/:thread_id/runs/:run_id"),{thread_id:J,run_id:X}=I(i$,Y),W=(await y.runs.list(J,{limit:1000})).find((O)=>O.run_id===X);if(!W)return v(Error("Run not found"),404);return V(W)}catch(Y){return v(Y)}}async function U3($,Z){try{let Y=e($.url,"/threads/:thread_id/runs/:run_id"),{thread_id:J,run_id:X}=I(i$,Y);return await y.threads.updateRun(X,{status:"deleted"}),new Response(null,{status:204})}catch(Y){return v(Y)}}async function z3($,Z){try{let Y=e($.url,"/threads/:thread_id/runs/:run_id/join"),{thread_id:J,run_id:X}=I(i$,Y),K=k1($.url),{cancel_on_disconnect:W}=I(vY,K),_=(await y.runs.list(J,{limit:1000})).find((z)=>z.run_id===X);if(!_)return v(Error("Run not found"),404);if(_.status==="success"||_.status==="error")return V({});let G=new AbortController;if(W){let z=()=>{G.abort("Client disconnected")};$.signal?.addEventListener("abort",z)}let N={};for await(let{event:z,data:F}of y.runs.joinStream(J,X,{signal:G.signal,cancelOnDisconnect:W}))if(z.event==="end"||z.event==="writes/value"){if(F&&typeof F==="object")Object.assign(N,F)}return V(N)}catch(Y){return v(Y)}}async function N3($,Z){try{let Y=await $.json(),J=I(WZ,Y),X=K1(J);X.config=X.config||{},X.config.configurable=X.config.configurable||{};let K=Z?.langgraph_context;if(K)Object.assign(X.config.configurable,K);let W=y.threads,O=await W.create({metadata:{...X.metadata,temporary:!0}});X.config.configurable.graph_id=J.assistant_id,X.config.configurable.thread_id=O.thread_id,X.temporary=!0;let _=await W.createRun(O.thread_id,J.assistant_id,X);return(async()=>{let G=!1;try{for await(let N of a1(W,_,X,{attempt:0,getGraph:v1}));}catch(N){console.error("Stateless run error:",N)}finally{try{await W.delete(O.thread_id)}catch(N){console.error("Error cleaning up temporary thread:",N)}if(!G){G=!0;try{await I1.globalMessageQueue.removeQueue(_.run_id)}catch(N){}}}})(),V(_,200,{"Content-Location":`/threads/${O.thread_id}/runs/${_.run_id}`})}catch(Y){return v(Y)}}async function H3($,Z){try{let Y=await $.json(),J=I(WZ,Y),X=K1(J);X.config=X.config||{},X.config.configurable=X.config.configurable||{};let K=Z?.langgraph_context;if(K)Object.assign(X.config.configurable,K);let W=y.threads,O=await W.create({metadata:{...X.metadata,temporary:!0}});X.config.configurable.graph_id=J.assistant_id,X.config.configurable.thread_id=O.thread_id,X.temporary=!0;let _=await W.createRun(O.thread_id,J.assistant_id,X);return gZ(pZ(async(G)=>{try{for await(let N of a1(W,_,X,{attempt:0,getGraph:v1}))await G.writeSSE({data:JSON.stringify(N),event:"data"})}catch(N){if(N instanceof Error&&N.name!=="AbortError")throw console.error("Stream error:",N),N}finally{try{await W.delete(O.thread_id)}catch(N){console.error("Error cleaning up temporary thread:",N)}}}))}catch(Y){return v(Y)}}async function F3($,Z){try{let Y=await $.json(),J=I(WZ,Y),X=K1(J);X.config=X.config||{},X.config.configurable=X.config.configurable||{};let K=Z?.langgraph_context;if(K)Object.assign(X.config.configurable,K);let W=y.threads,O=await W.create({metadata:{...X.metadata,temporary:!0}});X.config.configurable.graph_id=J.assistant_id,X.config.configurable.thread_id=O.thread_id,X.temporary=!0;let _=await W.createRun(O.thread_id,J.assistant_id,X),G={};try{for await(let{event:N,data:z}of a1(W,_,X,{attempt:0,getGraph:v1}))if(N==="end"||N==="writes/value"){if(z&&typeof z==="object")Object.assign(G,z)}}finally{try{await W.delete(O.thread_id)}catch(N){console.error("Error cleaning up temporary thread:",N)}}return V(G,200,{"Content-Location":`/threads/${O.thread_id}/runs/${_.run_id}`})}catch(Y){return v(Y)}}async function L3($,Z){try{let Y=await $.json(),J=I(kY,Y),X=y.threads,K=[],W=J.map(async(_)=>{try{let G=K1(_);G.config=G.config||{},G.config.configurable=G.config.configurable||{};let N=Z?.langgraph_context;if(N)Object.assign(G.config.configurable,N);let z=await X.create({metadata:{...G.metadata,temporary:!0}});G.config.configurable.graph_id=_.assistant_id,G.config.configurable.thread_id=z.thread_id,G.temporary=!0;let F=await X.createRun(z.thread_id,_.assistant_id,G);return(async()=>{let L=!1;try{for await(let w of a1(X,F,G,{attempt:0,getGraph:v1}));}catch(w){console.error("Batch run error:",w)}finally{try{await X.delete(z.thread_id)}catch(w){console.error("Error cleaning up temporary thread:",w)}if(!L){L=!0;try{await I1.globalMessageQueue.removeQueue(F.run_id)}catch(w){}}}})(),{thread_id:z.thread_id,run_id:F.run_id}}catch(G){return console.error("Batch run creation error:",G),{error:(G instanceof Error?G.message:"Unknown error")||"Unknown error"}}}),O=await Promise.all(W);return K.push(...O),V(K,200)}catch(Y){return v(Y)}}async function A3($,Z){try{let Y=await $.json(),J=I(yY,Y),X=new URL($.url),K=I(TY,{action:X.searchParams.get("action")||"interrupt"}),W=y.threads,O=[];if("run_ids"in J&&J.run_ids)for(let _ of J.run_ids)try{console.warn(`Cancel by run_id ${_} not fully implemented yet`)}catch(G){console.error(`Error cancelling run ${_}:`,G)}else if("thread_id"in J&&J.thread_id){let _=J.thread_id;try{let G=await W.listRuns(_,{limit:1000,offset:0});for(let N of G)try{y.runs.cancel(_,N.run_id,K.wait,K.action),O.push(N.run_id)}catch(z){console.error(`Error cancelling run ${N.run_id}:`,z)}}catch(G){console.error(`Error listing runs for thread ${_}:`,G)}}else if("status"in J&&J.status)console.warn(`Cancel by status ${J.status} not fully implemented yet`);return new Response(null,{status:204})}catch(Y){return v(Y)}}var w3=[{method:"POST",pattern:/^\/assistants\/search$/,handler:hY},{method:"POST",pattern:/^\/assistants\/count$/,handler:DY},{method:"GET",pattern:/^\/assistants\/[^/]+$/,handler:VY},{method:"DELETE",pattern:/^\/assistants\/[^/]+$/,handler:jY},{method:"PATCH",pattern:/^\/assistants\/[^/]+$/,handler:EY},{method:"GET",pattern:/^\/assistants\/[^/]+\/graph$/,handler:gY},{method:"GET",pattern:/^\/assistants\/[^/]+\/subgraphs$/,handler:pY},{method:"GET",pattern:/^\/assistants\/[^/]+\/subgraphs\/[^/]+$/,handler:mY},{method:"GET",pattern:/^\/assistants\/[^/]+\/schemas$/,handler:cY},{method:"POST",pattern:/^\/assistants\/[^/]+\/versions$/,handler:uY},{method:"POST",pattern:/^\/assistants\/[^/]+\/latest$/,handler:xY},{method:"POST",pattern:/^\/assistants$/,handler:dY},{method:"POST",pattern:/^\/threads$/,handler:lY},{method:"POST",pattern:/^\/threads\/search$/,handler:iY},{method:"POST",pattern:/^\/threads\/count$/,handler:oY},{method:"GET",pattern:/^\/threads\/[^/]+$/,handler:rY},{method:"PATCH",pattern:/^\/threads\/[^/]+$/,handler:nY},{method:"DELETE",pattern:/^\/threads\/[^/]+$/,handler:aY},{method:"GET",pattern:/^\/threads\/[^/]+\/state$/,handler:sY},{method:"POST",pattern:/^\/threads\/[^/]+\/state$/,handler:tY},{method:"POST",pattern:/^\/threads\/[^/]+\/state\/checkpoint$/,handler:eY},{method:"GET",pattern:/^\/threads\/[^/]+\/history$/,handler:$3},{method:"POST",pattern:/^\/threads\/[^/]+\/history$/,handler:Z3},{method:"POST",pattern:/^\/threads\/[^/]+\/copy$/,handler:Y3},{method:"GET",pattern:/^\/threads\/[^/]+\/stream$/,handler:X3},{method:"POST",pattern:/^\/threads\/[^/]+\/runs$/,handler:_3},{method:"POST",pattern:/^\/threads\/[^/]+\/runs\/stream$/,handler:J3},{method:"POST",pattern:/^\/threads\/[^/]+\/runs\/wait$/,handler:O3},{method:"POST",pattern:/^\/threads\/[^/]+\/runs\/[^/]+\/cancel$/,handler:Q3},{method:"GET",pattern:/^\/threads\/[^/]+\/runs$/,handler:W3},{method:"GET",pattern:/^\/threads\/[^/]+\/runs\/[^/]+$/,handler:G3},{method:"DELETE",pattern:/^\/threads\/[^/]+\/runs\/[^/]+$/,handler:U3},{method:"GET",pattern:/^\/threads\/[^/]+\/runs\/[^/]+\/join$/,handler:z3},{method:"GET",pattern:/^\/threads\/[^/]+\/runs\/[^/]+\/stream$/,handler:K3},{method:"POST",pattern:/^\/runs$/,handler:N3},{method:"POST",pattern:/^\/runs\/stream$/,handler:H3},{method:"POST",pattern:/^\/runs\/wait$/,handler:F3},{method:"POST",pattern:/^\/runs\/batch$/,handler:L3},{method:"POST",pattern:/^\/runs\/cancel$/,handler:A3}],M3=($)=>{let Z=new URL($.url).pathname.toString(),Y="";if(Z.includes("/threads"))Y=Z.split("/threads")[0];else if(Z.includes("/assistants"))Y=Z.split("/assistants")[0];return new Request($.url.replace(Y,""),{method:$.method,headers:$.headers,body:$.body,duplex:$.duplex})};async function v0($,Z={}){$=M3($);try{await I1.initGlobal();let J=new URL($.url).pathname,X=$.method;for(let K of w3)if(K.method===X&&K.pattern.test(J))return await K.handler($,Z);return new Response("Not Found",{status:404})}catch(Y){return console.error("Request error:",Y),v(Y)}}import{execa as T0}from"execa";import q3 from"extract-zip";import b3 from"fs-extra";import*as o$ from"node:os";import{dirname as y0,join as R3}from"node:path";import{pipeline as B3}from"node:stream/promises";import{fileURLToPath as f3}from"node:url";import{pathExists as k0}from"path-exists";import{temporaryFile as P3}from"tempy";import{xdgCache as C3}from"xdg-basedir";var{mkdir:cZ,createWriteStream:S3,move:I3}=b3,h0=y0(f3(import.meta.url)),v3="microsoft/ripgrep-prebuilt",mZ=process.env.RIPGREP_VERSION||"v15.0.0",k3=()=>{let $=process.env.npm_config_arch||o$.arch(),Z=process.env.platform||o$.platform();switch(Z){case"darwin":switch($){case"arm64":return"aarch64-apple-darwin.tar.gz";default:return"x86_64-apple-darwin.tar.gz"}case"win32":switch($){case"x64":return"x86_64-pc-windows-msvc.zip";case"arm":return"aarch64-pc-windows-msvc.zip";default:return"i686-pc-windows-msvc.zip"}case"linux":switch($){case"x64":return"x86_64-unknown-linux-musl.tar.gz";case"arm":case"armv7l":return"arm-unknown-linux-gnueabihf.tar.gz";case"arm64":return"aarch64-unknown-linux-gnu.tar.gz";case"ppc64":return"powerpc64le-unknown-linux-gnu.tar.gz";case"s390x":return"s390x-unknown-linux-gnu.tar.gz";default:return"i686-unknown-linux-musl.tar.gz"}default:throw Error("Unknown platform: "+Z)}},T3=async($,Z)=>{try{let Y=P3(),J=await fetch($);if(!J.ok)throw Error(`HTTP ${J.status}: ${J.statusText}`);await B3(J.body,S3(Y)),await cZ(y0(Z),{recursive:!0}),await I3(Y,Z)}catch(Y){throw console.error(`Failed to download "${$}"`),Y}},y3=async($,Z)=>{try{await cZ(Z,{recursive:!0}),await q3($,{dir:Z})}catch(Y){throw console.error(`Failed to unzip "${$}"`),Y}},h3=async($,Z)=>{try{await cZ(Z,{recursive:!0}),await T0("tar",["xvf",$,"-C",Z])}catch(Y){throw console.error(`Failed to extract "${$}"`),Y}},D3=async($)=>{if($==="android")try{return await T0("pkg",["install","ripgrep","-y"]),!0}catch(Z){return console.info("Could not install ripgrep via pkg. Falling back to download."),!1}return!1},V3=R3(h0,`rg${process.platform==="win32"?".exe":""}`),D0=async($)=>{if(await k0(V3)){console.log("rg cached");return}let Z=process.env.platform||o$.platform();if(Z==="android"){if(await D3(Z))return}let Y=k3(),X=`${process.env.RIPGREP_PREBUILT_BINARIES_MIRROR||`https://v6.gh-proxy.org/https://github.com/${v3}/releases/download`}/${mZ}/ripgrep-${mZ}-${Y}`,K=`${C3}/vscode-ripgrep/ripgrep-${mZ}-${Y}`,W=$??h0;if(!await k0(K))await T3(X,K);else console.info(`File ${K} has been cached`);if(K.endsWith(".tar.gz"))await h3(K,W);else if(K.endsWith(".zip"))await y3(K,W);else throw Error(`Invalid downloadPath ${K}`)};await D0();DZ("code",V0);var j0=($,Z={})=>{return v0(new Request($,Z),{})};import j3 from"openai";import E3 from"@anthropic-ai/sdk";import{GoogleGenerativeAI as g3}from"@google/generative-ai";var p3=async()=>{if(!process.env.ANTHROPIC_API_KEY)return[];let $=[];try{for await(let Z of new E3().beta.models.list())$.push({id:Z.id,name:Z.display_name,provider:"anthropic"})}catch(Z){console.error("Failed to fetch Anthropic models:",Z)}return $},m3=async()=>{if(!process.env.OPENAI_API_KEY)return[];try{return await new j3().models.list().then(($)=>$.data.map((Z)=>{return{id:Z.id,name:Z.id,provider:"openai"}}).sort((Z,Y)=>Z.id.localeCompare(Y.id)))}catch($){return console.error("Failed to fetch OpenAI models:",$),[]}},c3=async()=>{let $=process.env.GEMINI_API_KEY;if(!$)return[];let Z=[{id:"gemini-2.5-flash-preview-06-17",name:"Gemini 2.5 Flash Preview (06-17)",provider:"gemini"},{id:"gemini-2.5-pro-preview-06-05",name:"Gemini 2.5 Pro Preview (06-05)",provider:"gemini"},{id:"gemini-2.0-flash",name:"Gemini 2.0 Flash",provider:"gemini"},{id:"gemini-2.0-flash-lite",name:"Gemini 2.0 Flash Lite",provider:"gemini"},{id:"gemini-1.5-flash",name:"Gemini 1.5 Flash",provider:"gemini"},{id:"gemini-1.5-flash-8b",name:"Gemini 1.5 Flash 8B",provider:"gemini"},{id:"gemini-1.5-pro",name:"Gemini 1.5 Pro",provider:"gemini"},{id:"gemini-1.0-pro",name:"Gemini 1.0 Pro",provider:"gemini"},{id:"gemini-2.0-flash-exp",name:"Gemini 2.0 Flash Experimental",provider:"gemini"},{id:"gemini-exp-1206",name:"Gemini Experimental 1206",provider:"gemini"},{id:"gemini-2.5-pro-exp-03-25",name:"Gemini 2.5 Pro Experimental (03-25)",provider:"gemini"},{id:"gemini-2.5-flash-preview-05-20",name:"Gemini 2.5 Flash Preview (05-20)",provider:"gemini"}];try{return await new g3($).getGenerativeModel({model:"gemini-1.5-flash"}),Z}catch(Y){return console.error("Failed to verify Gemini API key:",Y),[]}},E0=async()=>{return(await Promise.all([p3().catch(()=>[]),m3().catch(()=>[]),c3().catch(()=>[])])).flat()};var _Z=A(h(),1);function g0({tools:$,setTools:Z}){let Y=_Z.useRef(!1);_Z.useEffect(()=>{if(!Y.current)Z($),Y.current=!0},[$,Z])}var m0=A(h(),1);function p0($){if(!$)return{isValid:!1,needsSetup:!0,reason:"未找到配置文件"};if(!$.providers||$.providers.length===0)return{isValid:!1,needsSetup:!0,reason:"未配置任何 Provider"};let Z=$.providers.find((Y)=>Y.id===$.provider_id);if(!Z)return{isValid:!1,needsSetup:!0,reason:`Provider "${$.provider_id}" 不存在`,invalidProviderRef:!0};if(!Z.apiKey||Z.apiKey.trim()==="")return{isValid:!1,needsSetup:!0,reason:`Provider "${$.provider_id}" 未配置 API Key`,missingApiKey:!0};return{isValid:!0,needsSetup:!1}}function c0({config:$}){return m0.useMemo(()=>{if(!$)return{validation:null,needsSetup:!0,isValid:!1};let Z=p0($);return{validation:Z,needsSetup:Z.needsSetup,isValid:!Z.needsSetup}},[$])}var u0=A(h(),1);function x0({shouldFocus:$}){let Z=x1();u0.useEffect(()=>{if($)Z.focus("global-input")},[$,Z])}var C1=A(h(),1);function d0(){let[$,Z]=C1.useState("chat"),Y=x1(),J=C1.useCallback(()=>{Z("history")},[]),X=C1.useCallback(()=>{Z("knowledge")},[]),K=C1.useCallback(()=>{Z("settings")},[]),W=C1.useCallback(()=>{Z("model-provider")},[]),O=C1.useCallback(()=>{Z("agent")},[]),_=C1.useCallback(()=>{Z("task")},[]),G=C1.useCallback(()=>{Z("mcp")},[]),N=C1.useCallback(()=>{Z("process")},[]),z=C1.useCallback(()=>{Z("chat"),Y.focus("global-input")},[Y]);return{activeView:$,isChatView:$==="chat",switchToHistory:J,switchToKnowledge:X,switchToSettings:K,switchToModelProvider:W,switchToAgent:O,switchToTask:_,switchToMcp:G,switchToProcess:N,closePanel:z}}var OZ=A(h(),1);function u3($){let Z=`# 任务:${$.title}
8
8
 
9
- `;if(Y+=`**描述:**
10
- ${Z.description}
9
+ `;if(Z+=`**描述:**
10
+ ${$.description}
11
11
 
12
- `,Z.agentType)Y+=`**建议 Agent 类型:** ${Z.agentType}
12
+ `,$.agentType)Z+=`**建议 Agent 类型:** ${$.agentType}
13
13
 
14
- `;if(Z.estimatedTime)Y+=`**预估时间:** ${Z.estimatedTime}
14
+ `;if($.estimatedTime)Z+=`**预估时间:** ${$.estimatedTime}
15
15
 
16
- `;if(Z.complexity)Y+=`**复杂度:** ${Z.complexity}
16
+ `;if($.complexity)Z+=`**复杂度:** ${$.complexity}
17
17
 
18
- `;if(Z.dependencies&&Z.dependencies.length>0)Y+=`**依赖任务:**
19
- ${Z.dependencies.map((X)=>`- ${X}`).join(`
18
+ `;if($.dependencies&&$.dependencies.length>0)Z+=`**依赖任务:**
19
+ ${$.dependencies.map((Y)=>`- ${Y}`).join(`
20
20
  `)}
21
21
 
22
- `;if(Z.acceptanceCriteria&&Z.acceptanceCriteria.length>0)Y+=`**验收标准:**
23
- ${Z.acceptanceCriteria.map((X,J)=>`${J+1}. ${X}`).join(`
22
+ `;if($.acceptanceCriteria&&$.acceptanceCriteria.length>0)Z+=`**验收标准:**
23
+ ${$.acceptanceCriteria.map((Y,J)=>`${J+1}. ${Y}`).join(`
24
24
  `)}
25
25
 
26
- `;if(Z.children&&Z.children.length>0)Y+=`**子任务:**
27
- `,Z.children.forEach((X,J)=>{if(Y+=`
28
- ### 子任务 ${J+1}: ${X.title}
29
- `,Y+=`${X.description}
30
- `,X.acceptanceCriteria&&X.acceptanceCriteria.length>0)Y+=`验收标准:
31
- ${X.acceptanceCriteria.map((Q)=>`- ${Q}`).join(`
26
+ `;if($.children&&$.children.length>0)Z+=`**子任务:**
27
+ `,$.children.forEach((Y,J)=>{if(Z+=`
28
+ ### 子任务 ${J+1}: ${Y.title}
29
+ `,Z+=`${Y.description}
30
+ `,Y.acceptanceCriteria&&Y.acceptanceCriteria.length>0)Z+=`验收标准:
31
+ ${Y.acceptanceCriteria.map((X)=>`- ${X}`).join(`
32
32
  `)}
33
- `}),Y+=`
34
- `;return Y.trim()}function j8(Z){let{sendMessage:Y,createNewChat:X}=WZ(),{extraParams:J}=UZ(),{closePanel:Q}=Z,$=r0.useMemo(()=>{return{...J,is_in_task:!0}},[J]);return{handleExecuteTask:r0.useCallback((U)=>{let z=[{type:"human",content:`${$$(U)}
33
+ `}),Z+=`
34
+ `;return Z.trim()}function l0($){let{sendMessage:Z,createNewChat:Y}=$1(),{extraParams:J}=Z1(),{closePanel:X}=$,K=OZ.useMemo(()=>{return{...J,is_in_task:!0}},[J]);return{handleExecuteTask:OZ.useCallback((O)=>{let G=[{type:"human",content:`${u3(O)}
35
35
 
36
- 请你先写一个 TODO LIST 然后开始这个任务,最后完成任务的时候,使用 commit_task`}];X(U4).then(()=>{return Y(z,{extraParams:$,metadata:U4})}).then(()=>{N4("任务已发送给 Agent"),Q()}).catch((H)=>{console.error("Task execution failed:",H),N4("任务执行失败")})},[Y,X,$,Q])}}var o0=P(g(),1),k8=P(I(),1),S8=o0.createContext(void 0),X0=()=>{let Z=o0.useContext(S8);if(Z===void 0)throw Error("useChatPanel must be used within ChatPanelProvider. Make sure your component is a child of ChatController.");return Z},y8=({children:Z,value:Y})=>{return k8.jsxDEV(S8.Provider,{value:Y,children:Z},void 0,!1,void 0,this)};var p4=P(g(),1);var h8=(Z)=>{return Z.additional_kwargs?.reasoning_content||Array.isArray(Z.content)&&Z.content.find((Y)=>Y.type==="thinking")?.thinking},J0=(Z)=>{return typeof Z.content==="string"?Z.content:Z.content?.filter((Y)=>{return Y.type==="text"}).map((Y)=>Y.text).join("")};n0();var ZX=P(g(),1),s=P(I(),1),F$={approve:"green",reject:"red",edit:"yellow",modify:"cyan"},M$=(Z)=>{return F$[Z.toLowerCase()]||"white"},u8=({request:Z,allowedDecisions:Y=["approve","edit","reject"],onApprove:X,onEdit:J,onReject:Q,autoFocus:$=!0})=>{let[K,U]=ZX.useState("approve"),{value:W,setTrue:z,setFalse:H}=g8(!1),[G,F]=ZX.useState(""),M=W4(),N=Z.messageIndex,w=Z.description;uZ((V,d)=>{if(W&&d.escape)B()},{isActive:W});let L=()=>{if(!G.trim())return;if(K==="edit")try{let V=JSON.parse(G);J(V)}catch(V){console.error("Invalid JSON:",V);return}else{let V=`User rejected to run this tool, reason: ${G}`;Q(V)}H(),F("")},B=()=>{H(),F("")},C=([V])=>{if(V==="approve"){X(),M.focus("global-input");return}if(U(V),z(),V==="edit")F(JSON.stringify(Z.toolCall.args,null,2));else F("")},R=Y.map((V)=>({label:V,value:V}));return W?(()=>{let V=M$(K),d=K==="edit";return s.jsxDEV(_,{flexDirection:"column",paddingX:1,marginTop:0,children:[s.jsxDEV(_,{flexDirection:"column",marginBottom:1,children:[s.jsxDEV(O,{color:V,bold:!0,children:[K.toUpperCase()," MODE - ",Z.toolCall.name]},void 0,!0,void 0,this),N!==void 0&&s.jsxDEV(O,{color:"gray",dimColor:!0,children:["Message Index: ",N]},void 0,!0,void 0,this),w&&s.jsxDEV(O,{color:"gray",dimColor:!0,children:["Description: ",w]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),d?s.jsxDEV(_,{flexDirection:"column",marginTop:0,children:[s.jsxDEV(O,{color:"yellow",dimColor:!0,children:"Editing action arguments (JSON format):"},void 0,!1,void 0,this),s.jsxDEV(_,{paddingX:1,children:s.jsxDEV(iZ,{value:G,onChange:F,onSubmit:L,placeholder:"Enter JSON...",autoFocus:!0},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):s.jsxDEV(_,{flexDirection:"column",marginTop:0,children:[s.jsxDEV(O,{color:"cyan",dimColor:!0,children:"Enter additional message for this action:"},void 0,!1,void 0,this),s.jsxDEV(_,{padding:1,children:s.jsxDEV(iZ,{value:G,onChange:F,onSubmit:L,placeholder:"Enter message...",autoFocus:!0},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),s.jsxDEV(_,{marginTop:0,children:s.jsxDEV(O,{color:"gray",children:[s.jsxDEV(O,{color:V,bold:!0,children:"↵"},void 0,!1,void 0,this)," ","Submit |",s.jsxDEV(O,{color:"red",bold:!0,children:[" ","Esc"]},void 0,!0,void 0,this)," ","Cancel"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)})():(()=>s.jsxDEV(_,{flexDirection:"column",paddingX:1,children:[s.jsxDEV(_,{flexDirection:"column",marginBottom:1,children:[s.jsxDEV(O,{color:"cyan",bold:!0,children:Z.toolCall.name},void 0,!1,void 0,this),N!==void 0&&s.jsxDEV(O,{color:"gray",dimColor:!0,children:["Message Index: ",N]},void 0,!0,void 0,this),w&&s.jsxDEV(O,{color:"gray",dimColor:!0,children:["Description: ",w]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),s.jsxDEV(_,{children:s.jsxDEV(u4,{singleSelect:!0,options:R,onSubmit:C,autoFocus:$},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this))()};var a0=P(g(),1),m8=P(I(),1),YX={type:"approval",render(Z,Y){let{content:X,metadata:J}=Z,Q=W4(),$=a0.useCallback(()=>{Y({state:"submitted",result:{status:"approved"}}),Q.focus("global-input")},[Y,Q]),K=a0.useCallback((z)=>{Y({state:"edited",result:{status:"edited",editedArgs:z}}),Q.focus("global-input")},[Y,Q]),U=a0.useCallback((z)=>{Y({state:"cancelled",result:{status:"rejected",message:z}}),Q.focus("global-input")},[Y,Q]),W={id:Z.id,toolCall:X.toolCall,status:Z.state==="submitted"?"approved":Z.state==="edited"?"edited":Z.state==="cancelled"?"rejected":"pending",createdAt:Z.createdAt,messageIndex:J.messageIndex,description:J.description};return m8.jsxDEV(u8,{request:W,allowedDecisions:["approve","edit","reject"],onApprove:$,onEdit:K,onReject:U,autoFocus:!0},Z.id,!1,void 0,this)},defaultConfig:{layout:{border:!1,padding:0},interaction:{autoSubmit:!1,allowSkip:!1}}};var XX=P(g(),1);var N$={title:{maxWidth:60,ellipsis:"…"},description:{maxWidth:80,ellipsis:"…"},optionLabel:{maxWidth:50,ellipsis:"…"},tabLabel:{maxWidth:30,ellipsis:"…"},fullTitle:{maxWidth:80,ellipsis:"…"}},_$=(Z,Y=20,X="…")=>{if(!Z)return"";if(Z.length<=Y)return Z;return Z.substring(0,Y-X.length)+X},Q0=(Z,Y)=>{let X=N$[Y];return _$(Z,X.maxWidth,X.ellipsis)};var _4=P(I(),1),A$=(Z)=>{return Q0(Z,"optionLabel")},JX={type:"selection",render(Z,Y){let{content:X,metadata:J,result:Q}=Z,[$,K]=XX.useState(Q?.selected||[]),[U,W]=XX.useState(Q?.customInput||""),z=X.options.map((L)=>({label:A$(L.label),value:L.value})),H=(L,B)=>{Y({result:{selected:L??$,customInput:B??U}})},G=(L)=>{K(L),H(L,void 0)},F=(L)=>{W(L),H(void 0,L)},M=()=>{Y({state:"submitted",result:{selected:$,customInput:U}})},N=J?.title?Q0(J.title,"title"):null,w=J?.description?Q0(J.description,"description"):null;return _4.jsxDEV(_,{flexDirection:"column",paddingX:1,children:[N&&_4.jsxDEV(_,{marginBottom:1,children:_4.jsxDEV(O,{color:"cyan",bold:!0,children:N},void 0,!1,void 0,this)},void 0,!1,void 0,this),w&&_4.jsxDEV(_,{marginBottom:1,children:_4.jsxDEV(O,{dimColor:!0,children:w},void 0,!1,void 0,this)},void 0,!1,void 0,this),_4.jsxDEV(u4,{options:z,singleSelect:X.singleSelect,values:$,onChange:G,onSubmit:M,autoFocus:!0},void 0,!1,void 0,this),X.allowCustomInput&&_4.jsxDEV(_,{marginTop:1,flexDirection:"column",children:_4.jsxDEV(iZ,{value:U,onChange:F,onSubmit:M,placeholder:X.placeholder||"Type custom option...",autoFocus:!1},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},validate(Z){if(Z.options.length===0)return"At least one option is required";if(Z.singleSelect&&Z.maxSelections&&Z.maxSelections>1)return"Single select cannot have maxSelections > 1";return},defaultConfig:{layout:{border:!0,padding:1},interaction:{autoSubmit:!1}}};var p8=P(g(),1);var z4=P(I(),1),QX={type:"input",render(Z,Y){let{content:X,metadata:J}=Z,[Q,$]=p8.useState(X.defaultValue||""),K=()=>{Y({state:"submitted",result:{value:Q}})};return z4.jsxDEV(_,{flexDirection:"column",paddingX:1,children:[J?.title&&z4.jsxDEV(_,{marginBottom:1,children:z4.jsxDEV(O,{color:"cyan",bold:!0,children:J.title},void 0,!1,void 0,this)},void 0,!1,void 0,this),J?.description&&z4.jsxDEV(_,{marginBottom:1,children:z4.jsxDEV(O,{dimColor:!0,children:J.description},void 0,!1,void 0,this)},void 0,!1,void 0,this),z4.jsxDEV(_,{children:[z4.jsxDEV(iZ,{value:Q,onChange:$,onSubmit:K,placeholder:X.placeholder,autoFocus:!0},void 0,!1,void 0,this),")"]},void 0,!0,void 0,this),X.maxLength&&z4.jsxDEV(_,{marginTop:1,children:z4.jsxDEV(O,{dimColor:!0,children:["Max length: ",X.maxLength]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},validate(Z){if(Z.validation?.pattern&&Z.defaultValue){if(!Z.validation.pattern.test(Z.defaultValue))return"Input does not match required pattern"}if(Z.validation?.minLength&&Z.defaultValue&&Z.defaultValue.length<Z.validation.minLength)return`Input must be at least ${Z.validation.minLength} characters`;return},defaultConfig:{layout:{border:!0,padding:1},interaction:{autoSubmit:!1}}};var m4=P(I(),1),$X={type:"confirm",render(Z,Y){let{content:X,metadata:J}=Z,Q=()=>{Y({state:"submitted",result:{confirmed:!0}})},$=()=>{Y({state:"cancelled",result:{confirmed:!1}})},K=[{label:X.confirmLabel||"Confirm",value:"confirm"},{label:X.cancelLabel||"Cancel",value:"cancel"}],U=([W])=>{if(W==="confirm")Q();else $()};return m4.jsxDEV(_,{flexDirection:"column",paddingX:1,children:[J?.title&&m4.jsxDEV(_,{marginBottom:1,children:m4.jsxDEV(O,{color:X.danger?"red":"cyan",bold:!0,children:J.title},void 0,!1,void 0,this)},void 0,!1,void 0,this),m4.jsxDEV(_,{marginBottom:1,children:m4.jsxDEV(O,{children:X.message},void 0,!1,void 0,this)},void 0,!1,void 0,this),m4.jsxDEV(u4,{options:K,singleSelect:!0,onSubmit:U,autoFocus:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},defaultConfig:{layout:{border:!0,padding:1},interaction:{autoSubmit:!1}}};var w$=P(g(),1);var B$=P(I(),1);var H4=P(g(),1);var $0=P(g(),1);var zZ=P(I(),1),c8=({items:Z,defaultIndex:Y=0,onChange:X,disabled:J=!1,autoFocus:Q=!0,variant:$="line"})=>{let{isFocused:K}=d8({autoFocus:Q}),[U,W]=$0.useState(Y),z=$0.default.useMemo(()=>`tabs-${Math.random().toString(36).substring(2,9)}`,[]),H=$0.useCallback((M)=>{if(M<0||M>=Z.length||Z[M].disabled)return;W(M),X?.(M,Z[M])},[Z,X]);uZ((M,N)=>{if(J)return;if(N.leftArrow)H(U-1);else if(N.rightArrow)H(U+1)},{isActive:!J});let G=()=>{return Z.map((M,N)=>{let w=N===U,L=K&&!J,B;if($==="line")B=zZ.jsxDEV(_,{marginRight:1,children:[zZ.jsxDEV(O,{color:M.disabled?"gray":w?L?"green":"cyan":"gray",bold:w&&L,children:M.label},void 0,!1,void 0,this),w&&zZ.jsxDEV(O,{color:L?"green":"cyan",children:"_"},void 0,!1,void 0,this)]},`${z}-${M.id}`,!0,void 0,this);else if($==="enclosed"){let C=N===0||w?"┌":"─",R=N===Z.length-1||w?"┐":"─",D=N===0||w?"│":" ",f=N===Z.length-1||w?"│":" ",V=w?"─":" ",d=w?" ":"",l=M.disabled?"gray":w?L?"green":"cyan":"gray";B=zZ.jsxDEV(_,{children:zZ.jsxDEV(_,{flexDirection:"column",children:[zZ.jsxDEV(_,{children:[zZ.jsxDEV(O,{color:l,children:C},void 0,!1,void 0,this),zZ.jsxDEV(O,{color:l,bold:w&&L,children:[d,M.label,d]},void 0,!0,void 0,this),zZ.jsxDEV(O,{color:l,children:R},void 0,!1,void 0,this)]},void 0,!0,void 0,this),w&&zZ.jsxDEV(_,{children:[zZ.jsxDEV(O,{color:l,children:D},void 0,!1,void 0,this),zZ.jsxDEV(O,{color:l,children:V.repeat(M.label.length+2)},void 0,!1,void 0,this),zZ.jsxDEV(O,{color:l,children:f},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},`${z}-${M.id}`,!1,void 0,this)}else{let C=w?"●":"○";B=zZ.jsxDEV(_,{marginRight:2,children:zZ.jsxDEV(O,{color:M.disabled?"gray":w?L?"green":"cyan":"gray",bold:w&&L,children:[C," ",M.label]},void 0,!0,void 0,this)},`${z}-${M.id}`,!1,void 0,this)}return B})},F=()=>{let M=Z[U];if(!M?.content)return null;return zZ.jsxDEV(_,{marginTop:1,paddingX:2,paddingY:1,flexDirection:"column",children:M.content},void 0,!1,void 0,this)};return zZ.jsxDEV(_,{flexDirection:"column",flexGrow:1,children:[zZ.jsxDEV(_,{children:G()},void 0,!1,void 0,this),Z.some((M)=>M.content)&&F()]},void 0,!0,void 0,this)};var l8=P(g(),1);var i8=P(I(),1),KX=({interaction:Z,renderer:Y,onChange:X})=>{let J=l8.useMemo(()=>{return{layout:{border:!1,padding:0,...Y.defaultConfig?.layout,...Z.config.layout},interaction:{autoSubmit:!1,allowSkip:!1,showPreview:!0,...Y.defaultConfig?.interaction,...Z.config.interaction},style:{...Y.defaultConfig?.style,...Z.config.style}}},[Z.config,Y.defaultConfig]),Q=J.style.backgroundColor;return i8.jsxDEV(_,{backgroundColor:Q,paddingX:J.layout.padding,marginBottom:1,flexDirection:"column",children:Y.render({...Z,config:J},X)},void 0,!1,void 0,this)};n0();var A4=P(I(),1),L$=(Z)=>{return Q0(Z,"fullTitle")},WX=()=>{let Z=xZ(),[Y,X]=H4.useState(null),{focusNext:J,focus:Q}=W4(),$=H4.useMemo(()=>{return Z.getInteractions()},[Z.getInteractions()]);H4.useEffect(()=>{if($.length>0&&!Y)X($[0].id)},[$,Y]);let K=H4.useMemo(()=>{return $.map((G)=>{let F={idle:"\uD83D\uDD04",active:"\uD83D\uDD04",submitted:"✅",edited:"⛔",cancelled:"\uD83D\uDEAB"}[G.state]||"",M=L$(G.metadata.title||G.content.type);return{id:G.id,label:`${F} ${M}`,content:null}})},[$]),U=H4.useCallback((G,F)=>{X(F.id)},[]),W=H4.useCallback((G)=>{if($.every((w)=>w.state==="submitted"||w.state==="edited"||w.state==="cancelled")){Q("global-input");return}let N=($.findIndex((w)=>w.id===G)+1)%$.length;X($[N].id)},[$,Q]),z=r8(()=>{J()});TZ(z,Y?100:null);let H=()=>{if(!Y)return null;let G=$.find((M)=>M.id===Y);if(!G)return null;let F=D4.get(G.content.type);if(!F)return A4.jsxDEV(_,{paddingX:1,children:A4.jsxDEV(O,{color:"red",children:["Unknown renderer: ",G.content.type]},void 0,!0,void 0,this)},void 0,!1,void 0,this);return A4.jsxDEV(KX,{interaction:G,renderer:F,onChange:(M)=>{if(Z.updateInteraction(G.id,M),M.state==="submitted"||M.state==="edited"||M.state==="cancelled")W(G.id)}},G.id,!1,void 0,this)};if($.length===0)return null;return A4.jsxDEV(_,{flexDirection:"column",borderColor:"cyan",borderStyle:"single",width:"100%",children:[A4.jsxDEV(_,{justifyContent:"space-between",paddingX:1,marginBottom:1,children:A4.jsxDEV(O,{color:"cyan",bold:!0,children:["Interactions (",$.length,")"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),A4.jsxDEV(_,{paddingX:1,marginBottom:1,children:A4.jsxDEV(c8,{items:K,defaultIndex:K.findIndex((G)=>G.id===Y),onChange:U,autoFocus:!0,variant:"line"},Y,!1,void 0,this)},void 0,!1,void 0,this),H()]},void 0,!0,void 0,this)};n0();function o8(){D4.register("approval",YX),D4.register("selection",JX),D4.register("input",QX),D4.register("confirm",$X)}o8();var K0=P(I(),1);import{z as V4}from"zod";var P$=V4.object({label:V4.string().min(1).max(50).describe("选项显示文本,简洁明了(1-50 字符)")}),R$=V4.object({description:V4.string().min(1).describe("向用户提出的问题,清晰具体,包含必要的上下文"),type:V4.enum(["single_select","multi_select"]).describe("选择类型:single_select(单选)或 multi_select(多选)"),options:V4.array(P$).min(2).max(6).describe("选项列表,至少 2 个,最多 6 个"),allow_custom_input:V4.boolean().default(!0).describe("是否允许用户输入自定义文本,默认 true"),placeholder:V4.string().optional().describe("自定义输入框的占位符文本")}),C$=({tool:Z})=>{let{addInteraction:Y,getInteractions:X,updateInteraction:J}=xZ(),[Q,$]=p4.useState(null),K=p4.useRef(!1),U=Z.getInputRepaired();if(p4.useEffect(()=>{if(Z.state==="interrupted"&&!Q&&!K.current){let z={type:"selection",options:U.options?.map((G,F)=>({label:G.label,value:G.label}))||[],singleSelect:U.type==="single_select",allowCustomInput:U.allow_custom_input??!0,placeholder:U.placeholder},H=Y(z,{tool:Z,metadata:{title:U.description||"请选择一个选项",groupKey:"user-input"}});$(H.id)}},[Z,Q,Y,U]),p4.useEffect(()=>{if(!Q||K.current)return;let W=()=>{let G=X().find((F)=>F.id===Q);if(G&&(G.state==="submitted"||G.state==="edited"||G.state==="cancelled")&&!G.resultSent){K.current=!0;let F=G.result,M="";if(F){if(F.selected&&F.selected.length>0)M+=`User selected:
36
+ 请你先写一个 TODO LIST 然后开始这个任务,最后完成任务的时候,使用 commit_task`}];Y(d1).then(()=>{return Z(G,{extraParams:K,metadata:d1})}).then(()=>{t1("任务已发送给 Agent"),X()}).catch((N)=>{console.error("Task execution failed:",N),t1("任务执行失败")})},[Z,Y,K,X])}}var GZ=A(h(),1),r0=A(q(),1),i0=GZ.createContext(void 0),h$=()=>{let $=GZ.useContext(i0);if($===void 0)throw Error("useChatPanel must be used within ChatPanelProvider. Make sure your component is a child of ChatController.");return $},o0=({children:$,value:Z})=>{return r0.jsxDEV(i0.Provider,{value:Z,children:$},void 0,!1,void 0,this)};var B$=A(h(),1);var n0=($)=>{return $.additional_kwargs?.reasoning_content||Array.isArray($.content)&&$.content.find((Z)=>Z.type==="thinking")?.thinking},D$=($)=>{return typeof $.content==="string"?$.content:$.content?.filter((Z)=>{return Z.type==="text"}).map((Z)=>Z.text).join("")};UZ();var xZ=A(h(),1),d=A(q(),1),s3={approve:"green",reject:"red",edit:"yellow",modify:"cyan"},t3=($)=>{return s3[$.toLowerCase()]||"white"},t0=({request:$,allowedDecisions:Z=["approve","edit","reject"],onApprove:Y,onEdit:J,onReject:X,autoFocus:K=!0})=>{let[W,O]=xZ.useState("approve"),{value:_,setTrue:G,setFalse:N}=s0(!1),[z,F]=xZ.useState(""),L=x1(),w=$.messageIndex,M=$.description;S1((S,t)=>{if(_&&t.escape)f()},{isActive:_});let b=()=>{if(!z.trim())return;if(W==="edit")try{let S=JSON.parse(z);J(S)}catch(S){console.error("Invalid JSON:",S);return}else{let S=`User rejected to run this tool, reason: ${z}`;X(S)}N(),F("")},f=()=>{N(),F("")},k=([S])=>{if(S==="approve"){Y(),L.focus("global-input");return}if(O(S),G(),S==="edit")F(JSON.stringify($.toolCall.args,null,2));else F("")},g=Z.map((S)=>({label:S,value:S}));return _?(()=>{let S=t3(W),t=W==="edit";return d.jsxDEV(U,{flexDirection:"column",paddingX:1,marginTop:0,children:[d.jsxDEV(U,{flexDirection:"column",marginBottom:1,children:[d.jsxDEV(Q,{color:S,bold:!0,children:[W.toUpperCase()," MODE - ",$.toolCall.name]},void 0,!0,void 0,this),w!==void 0&&d.jsxDEV(Q,{color:"gray",dimColor:!0,children:["Message Index: ",w]},void 0,!0,void 0,this),M&&d.jsxDEV(Q,{color:"gray",dimColor:!0,children:["Description: ",M]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),t?d.jsxDEV(U,{flexDirection:"column",marginTop:0,children:[d.jsxDEV(Q,{color:"yellow",dimColor:!0,children:"Editing action arguments (JSON format):"},void 0,!1,void 0,this),d.jsxDEV(U,{paddingX:1,children:d.jsxDEV(T1,{value:z,onChange:F,onSubmit:b,placeholder:"Enter JSON...",autoFocus:!0},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):d.jsxDEV(U,{flexDirection:"column",marginTop:0,children:[d.jsxDEV(Q,{color:"cyan",dimColor:!0,children:"Enter additional message for this action:"},void 0,!1,void 0,this),d.jsxDEV(U,{padding:1,children:d.jsxDEV(T1,{value:z,onChange:F,onSubmit:b,placeholder:"Enter message...",autoFocus:!0},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),d.jsxDEV(U,{marginTop:0,children:d.jsxDEV(Q,{color:"gray",children:[d.jsxDEV(Q,{color:S,bold:!0,children:"↵"},void 0,!1,void 0,this)," ","Submit |",d.jsxDEV(Q,{color:"red",bold:!0,children:[" ","Esc"]},void 0,!0,void 0,this)," ","Cancel"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)})():(()=>d.jsxDEV(U,{flexDirection:"column",paddingX:1,children:[d.jsxDEV(U,{flexDirection:"column",marginBottom:1,children:[d.jsxDEV(Q,{color:"cyan",bold:!0,children:$.toolCall.name},void 0,!1,void 0,this),w!==void 0&&d.jsxDEV(Q,{color:"gray",dimColor:!0,children:["Message Index: ",w]},void 0,!0,void 0,this),M&&d.jsxDEV(Q,{color:"gray",dimColor:!0,children:["Description: ",M]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),d.jsxDEV(U,{children:d.jsxDEV(b$,{singleSelect:!0,options:g,onSubmit:k,autoFocus:K},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this))()};var zZ=A(h(),1),e0=A(q(),1),dZ={type:"approval",render($,Z){let{content:Y,metadata:J}=$,X=x1(),K=zZ.useCallback(()=>{Z({state:"submitted",result:{status:"approved"}}),X.focus("global-input")},[Z,X]),W=zZ.useCallback((G)=>{Z({state:"edited",result:{status:"edited",editedArgs:G}}),X.focus("global-input")},[Z,X]),O=zZ.useCallback((G)=>{Z({state:"cancelled",result:{status:"rejected",message:G}}),X.focus("global-input")},[Z,X]),_={id:$.id,toolCall:Y.toolCall,status:$.state==="submitted"?"approved":$.state==="edited"?"edited":$.state==="cancelled"?"rejected":"pending",createdAt:$.createdAt,messageIndex:J.messageIndex,description:J.description};return e0.jsxDEV(t0,{request:_,allowedDecisions:["approve","edit","reject"],onApprove:K,onEdit:W,onReject:O,autoFocus:!0},$.id,!1,void 0,this)},defaultConfig:{layout:{border:!1,padding:0},interaction:{autoSubmit:!1,allowSkip:!1}}};var lZ=A(h(),1);var e3={title:{maxWidth:60,ellipsis:"…"},description:{maxWidth:80,ellipsis:"…"},optionLabel:{maxWidth:50,ellipsis:"…"},tabLabel:{maxWidth:30,ellipsis:"…"},fullTitle:{maxWidth:80,ellipsis:"…"}},$X=($,Z=20,Y="…")=>{if(!$)return"";if($.length<=Z)return $;return $.substring(0,Z-Y.length)+Y},V$=($,Z)=>{let Y=e3[Z];return $X($,Y.maxWidth,Y.ellipsis)};var e1=A(q(),1),ZX=($)=>{return V$($,"optionLabel")},iZ={type:"selection",render($,Z){let{content:Y,metadata:J,result:X}=$,[K,W]=lZ.useState(X?.selected||[]),[O,_]=lZ.useState(X?.customInput||""),G=Y.options.map((b)=>({label:ZX(b.label),value:b.value})),N=(b,f)=>{Z({result:{selected:b??K,customInput:f??O}})},z=(b)=>{W(b),N(b,void 0)},F=(b)=>{_(b),N(void 0,b)},L=()=>{Z({state:"submitted",result:{selected:K,customInput:O}})},w=J?.title?V$(J.title,"title"):null,M=J?.description?V$(J.description,"description"):null;return e1.jsxDEV(U,{flexDirection:"column",paddingX:1,children:[w&&e1.jsxDEV(U,{marginBottom:1,children:e1.jsxDEV(Q,{color:"cyan",bold:!0,children:w},void 0,!1,void 0,this)},void 0,!1,void 0,this),M&&e1.jsxDEV(U,{marginBottom:1,children:e1.jsxDEV(Q,{dimColor:!0,children:M},void 0,!1,void 0,this)},void 0,!1,void 0,this),e1.jsxDEV(b$,{options:G,singleSelect:Y.singleSelect,values:K,onChange:z,onSubmit:L,autoFocus:!0},void 0,!1,void 0,this),Y.allowCustomInput&&e1.jsxDEV(U,{marginTop:1,flexDirection:"column",children:e1.jsxDEV(T1,{value:O,onChange:F,onSubmit:L,placeholder:Y.placeholder||"Type custom option...",autoFocus:!1},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},validate($){if($.options.length===0)return"At least one option is required";if($.singleSelect&&$.maxSelections&&$.maxSelections>1)return"Single select cannot have maxSelections > 1";return},defaultConfig:{layout:{border:!1,padding:1},interaction:{autoSubmit:!1}}};var $2=A(h(),1);var l1=A(q(),1),oZ={type:"input",render($,Z){let{content:Y,metadata:J}=$,[X,K]=$2.useState(Y.defaultValue||""),W=()=>{Z({state:"submitted",result:{value:X}})};return l1.jsxDEV(U,{flexDirection:"column",paddingX:1,children:[J?.title&&l1.jsxDEV(U,{marginBottom:1,children:l1.jsxDEV(Q,{color:"cyan",bold:!0,children:J.title},void 0,!1,void 0,this)},void 0,!1,void 0,this),J?.description&&l1.jsxDEV(U,{marginBottom:1,children:l1.jsxDEV(Q,{dimColor:!0,children:J.description},void 0,!1,void 0,this)},void 0,!1,void 0,this),l1.jsxDEV(U,{children:[l1.jsxDEV(T1,{value:X,onChange:K,onSubmit:W,placeholder:Y.placeholder,autoFocus:!0},void 0,!1,void 0,this),")"]},void 0,!0,void 0,this),Y.maxLength&&l1.jsxDEV(U,{marginTop:1,children:l1.jsxDEV(Q,{dimColor:!0,children:["Max length: ",Y.maxLength]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},validate($){if($.validation?.pattern&&$.defaultValue){if(!$.validation.pattern.test($.defaultValue))return"Input does not match required pattern"}if($.validation?.minLength&&$.defaultValue&&$.defaultValue.length<$.validation.minLength)return`Input must be at least ${$.validation.minLength} characters`;return},defaultConfig:{layout:{border:!1,padding:1},interaction:{autoSubmit:!1}}};var R$=A(q(),1),rZ={type:"confirm",render($,Z){let{content:Y,metadata:J}=$,X=()=>{Z({state:"submitted",result:{confirmed:!0}})},K=()=>{Z({state:"cancelled",result:{confirmed:!1}})},W=[{label:Y.confirmLabel||"Confirm",value:"confirm"},{label:Y.cancelLabel||"Cancel",value:"cancel"}],O=([_])=>{if(_==="confirm")X();else K()};return R$.jsxDEV(U,{flexDirection:"column",paddingX:1,children:[J?.title&&R$.jsxDEV(U,{marginBottom:1,children:R$.jsxDEV(Q,{color:Y.danger?"red":"cyan",bold:!0,children:J.title},void 0,!1,void 0,this)},void 0,!1,void 0,this),R$.jsxDEV(U,{marginBottom:1,children:R$.jsxDEV(Q,{children:Y.message},void 0,!1,void 0,this)},void 0,!1,void 0,this),R$.jsxDEV(b$,{options:W,singleSelect:!0,onSubmit:O,autoFocus:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},defaultConfig:{layout:{border:!1,padding:1},interaction:{autoSubmit:!1}}};var YX=A(h(),1);var XX=A(q(),1);var i1=A(h(),1);var j$=A(h(),1);var Y1=A(q(),1),Y2=({items:$,defaultIndex:Z=0,onChange:Y,disabled:J=!1,autoFocus:X=!0,variant:K="line"})=>{let{isFocused:W}=Z2({autoFocus:X}),[O,_]=j$.useState(Z),G=j$.default.useMemo(()=>`tabs-${Math.random().toString(36).substring(2,9)}`,[]),N=j$.useCallback((L)=>{if(L<0||L>=$.length||$[L].disabled)return;_(L),Y?.(L,$[L])},[$,Y]);S1((L,w)=>{if(J)return;if(w.leftArrow)N(O-1);else if(w.rightArrow)N(O+1)},{isActive:!J});let z=()=>{return $.map((L,w)=>{let M=w===O,b=W&&!J,f;if(K==="line")f=Y1.jsxDEV(U,{marginRight:1,children:[Y1.jsxDEV(Q,{color:L.disabled?"gray":M?b?"green":"cyan":"gray",bold:M&&b,children:L.label},void 0,!1,void 0,this),M&&Y1.jsxDEV(Q,{color:b?"green":"cyan",children:"_"},void 0,!1,void 0,this)]},`${G}-${L.id}`,!0,void 0,this);else if(K==="enclosed"){let k=w===0||M?"┌":"─",g=w===$.length-1||M?"┐":"─",p=w===0||M?"│":" ",o=w===$.length-1||M?"│":" ",S=M?"─":" ",t=M?" ":"",c=L.disabled?"gray":M?b?"green":"cyan":"gray";f=Y1.jsxDEV(U,{children:Y1.jsxDEV(U,{flexDirection:"column",children:[Y1.jsxDEV(U,{children:[Y1.jsxDEV(Q,{color:c,children:k},void 0,!1,void 0,this),Y1.jsxDEV(Q,{color:c,bold:M&&b,children:[t,L.label,t]},void 0,!0,void 0,this),Y1.jsxDEV(Q,{color:c,children:g},void 0,!1,void 0,this)]},void 0,!0,void 0,this),M&&Y1.jsxDEV(U,{children:[Y1.jsxDEV(Q,{color:c,children:p},void 0,!1,void 0,this),Y1.jsxDEV(Q,{color:c,children:S.repeat(L.label.length+2)},void 0,!1,void 0,this),Y1.jsxDEV(Q,{color:c,children:o},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},`${G}-${L.id}`,!1,void 0,this)}else{let k=M?"●":"○";f=Y1.jsxDEV(U,{marginRight:2,children:Y1.jsxDEV(Q,{color:L.disabled?"gray":M?b?"green":"cyan":"gray",bold:M&&b,children:[k," ",L.label]},void 0,!0,void 0,this)},`${G}-${L.id}`,!1,void 0,this)}return f})},F=()=>{let L=$[O];if(!L?.content)return null;return Y1.jsxDEV(U,{marginTop:1,paddingX:2,paddingY:1,flexDirection:"column",children:L.content},void 0,!1,void 0,this)};return Y1.jsxDEV(U,{flexDirection:"column",flexGrow:1,children:[Y1.jsxDEV(U,{children:z()},void 0,!1,void 0,this),$.some((L)=>L.content)&&F()]},void 0,!0,void 0,this)};var X2=A(h(),1);var J2=A(q(),1),nZ=({interaction:$,renderer:Z,onChange:Y})=>{let J=X2.useMemo(()=>{return{layout:{border:!1,padding:0,...Z.defaultConfig?.layout,...$.config.layout},interaction:{autoSubmit:!1,allowSkip:!1,showPreview:!0,...Z.defaultConfig?.interaction,...$.config.interaction},style:{...Z.defaultConfig?.style,...$.config.style}}},[$.config,Z.defaultConfig]),X=J.style.backgroundColor;return J2.jsxDEV(U,{backgroundColor:X,paddingX:J.layout.padding,marginBottom:1,flexDirection:"column",children:Z.render({...$,config:J},Y)},void 0,!1,void 0,this)};UZ();var $$=A(q(),1),JX=($)=>{return V$($,"fullTitle")},aZ=()=>{let $=P1(),[Z,Y]=i1.useState(null),{focusNext:J,focus:X}=x1(),K=i1.useMemo(()=>{return $.getInteractions()},[$.getInteractions()]);i1.useEffect(()=>{if(K.length>0&&!Z)Y(K[0].id)},[K,Z]);let W=i1.useMemo(()=>{return K.map((z)=>{let F={idle:"\uD83D\uDD04",active:"\uD83D\uDD04",submitted:"✅",edited:"⛔",cancelled:"\uD83D\uDEAB"}[z.state]||"",L=JX(z.metadata.title||z.content.type);return{id:z.id,label:`${F} ${L}`,content:null}})},[K]),O=i1.useCallback((z,F)=>{Y(F.id)},[]),_=i1.useCallback((z)=>{if(K.every((M)=>M.state==="submitted"||M.state==="edited"||M.state==="cancelled")){X("global-input");return}let w=(K.findIndex((M)=>M.id===z)+1)%K.length;Y(K[w].id)},[K,X]),G=K2(()=>{J()});M1(G,Z?100:null);let N=()=>{if(!Z)return null;let z=K.find((L)=>L.id===Z);if(!z)return null;let F=G$.get(z.content.type);if(!F)return $$.jsxDEV(U,{paddingX:1,children:$$.jsxDEV(Q,{color:"red",children:["Unknown renderer: ",z.content.type]},void 0,!0,void 0,this)},void 0,!1,void 0,this);return $$.jsxDEV(nZ,{interaction:z,renderer:F,onChange:(L)=>{if($.updateInteraction(z.id,L),L.state==="submitted"||L.state==="edited"||L.state==="cancelled")_(z.id)}},z.id,!1,void 0,this)};if(K.length===0)return null;return $$.jsxDEV(U,{flexDirection:"column",width:"100%",children:[$$.jsxDEV(U,{justifyContent:"space-between",paddingX:1,marginBottom:1,children:$$.jsxDEV(Q,{color:"cyan",bold:!0,children:["Interactions (",K.length,")"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$$.jsxDEV(U,{paddingX:1,marginBottom:1,children:$$.jsxDEV(Y2,{items:W,defaultIndex:W.findIndex((z)=>z.id===Z),onChange:O,autoFocus:!0,variant:"line"},Z,!1,void 0,this)},void 0,!1,void 0,this),N()]},void 0,!0,void 0,this)};UZ();function W2(){G$.register("approval",dZ),G$.register("selection",iZ),G$.register("input",oZ),G$.register("confirm",rZ)}W2();var E$=A(q(),1);import{z as U$}from"zod";var KX=U$.object({label:U$.string().min(1).max(50).describe("选项显示文本,简洁明了(1-50 字符)")}),WX=U$.object({description:U$.string().min(1).describe("向用户提出的问题,清晰具体,包含必要的上下文"),type:U$.enum(["single_select","multi_select"]).describe("选择类型:single_select(单选)或 multi_select(多选)"),options:U$.array(KX).min(2).max(6).describe("选项列表,至少 2 个,最多 6 个"),allow_custom_input:U$.boolean().default(!0).describe("是否允许用户输入自定义文本,默认 true"),placeholder:U$.string().optional().describe("自定义输入框的占位符文本")}),QX=({tool:$})=>{let{addInteraction:Z,getInteractions:Y,updateInteraction:J}=P1(),[X,K]=B$.useState(null),W=B$.useRef(!1),O=$.getInputRepaired();if(B$.useEffect(()=>{if($.state==="interrupted"&&!X&&!W.current){let G={type:"selection",options:O.options?.map((z,F)=>({label:z.label,value:z.label}))||[],singleSelect:O.type==="single_select",allowCustomInput:O.allow_custom_input??!0,placeholder:O.placeholder},N=Z(G,{tool:$,metadata:{title:O.description||"请选择一个选项",groupKey:"user-input"}});K(N.id)}},[$,X,Z,O]),B$.useEffect(()=>{if(!X||W.current)return;let _=()=>{let z=Y().find((F)=>F.id===X);if(z&&(z.state==="submitted"||z.state==="edited"||z.state==="cancelled")&&!z.resultSent){W.current=!0;let F=z.result,L="";if(F){if(F.selected&&F.selected.length>0)L+=`User selected:
37
37
  ${F.selected.join(`
38
- - `)}`;if(F.customInput&&F.customInput.trim())M+=(M?`
39
- `:"")+`User Custom Input: ${F.customInput}`}Z.sendResumeData({type:"respond",message:M||"User made a selection"}),J(Q,{resultSent:!0})}};W();let z=setInterval(W,100);return()=>clearInterval(z)},[Q,X,J,Z]),Z.state==="interrupted"&&!Z.output)return K0.jsxDEV(_,{flexDirection:"column",children:K0.jsxDEV(_,{paddingX:1,children:K0.jsxDEV(O,{color:"yellow",children:"⏳ 等待用户选择..."},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(Z.output)return K0.jsxDEV(O,{color:"yellow",children:Z.output},void 0,!1,void 0,this);return null},n8=t({name:"ask_user_questions",description:"Ask the user a question with selectable options",parameters:R$,handler:ZZ.waitForUIDone,render(Z){return K0.jsxDEV(C$,{tool:Z},void 0,!1,void 0,this)}});var d4=P(g(),1);var w0=P(I(),1),W0=({content:Z,maxLines:Y=10,borderColor:X="cyan",borderStyle:J="single",marginTop:Q=0,paddingX:$=0,showOmittedInfo:K=!0})=>{if(!Z)return null;let{width:U}=a8(),W=Z.split(`
40
- `).map((G)=>G.slice(0,U-10)),z=Math.max(0,W.length-Y),H=W.slice(-Y).join(`
41
- `);return w0.jsxDEV(_,{flexDirection:"column",width:U-5,children:w0.jsxDEV(_,{borderStyle:J,borderColor:X,borderLeft:!1,borderRight:!1,flexDirection:"column",paddingX:$,marginTop:Q,children:[K&&z>0&&w0.jsxDEV(O,{color:"gray",dimColor:!0,children:["... ",z," lines omitted ..."]},void 0,!0,void 0,this),w0.jsxDEV(O,{dimColor:!0,children:H},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)};var VZ=P(I(),1),I$=({tool:Z})=>{let{addInteraction:Y,getInteractions:X,updateInteraction:J}=xZ(),[Q,$]=d4.useState(null),K=d4.useRef(!1),U=Z.getHumanInTheLoopData();if(d4.useEffect(()=>{if(U?.reviewConfig&&Z.state==="interrupted"&&!Q&&!K.current){let z=Z.getInputRepaired()?.description,H={type:"approval",toolCall:{name:Z.message.name,args:Z.getInputRepaired()},editableFields:["args"]},G=Y(H,{tool:Z,metadata:{title:`Approve ${Z.message.name}`,description:z,groupKey:"approvals"}});$(G.id)}},[U,Z,Q,Y]),d4.useEffect(()=>{if(!Q||K.current)return;let z=()=>{let F=X().find((M)=>M.id===Q);if(F&&(F.state==="submitted"||F.state==="edited"||F.state==="cancelled")&&!F.resultSent){K.current=!0;let M=F.result;if(M){if(M.status==="approved")Z.sendResumeData({type:"approve"});else if(M.status==="edited"){let N={name:Z.message.name,args:M.editedArgs};Z.sendResumeData({type:"edit",edited_action:N})}else if(M.status==="rejected"){let N=M.message||"User rejected to run this tool";Z.sendResumeData({type:"reject",message:N})}}J(Q,{resultSent:!0})}};z();let H=setInterval(z,100);return()=>clearInterval(H)},[Q,X,J,Z]),U?.reviewConfig&&Q&&!Z.output)return VZ.jsxDEV(_,{flexDirection:"column",children:VZ.jsxDEV(_,{paddingX:1,paddingY:1,children:VZ.jsxDEV(O,{color:"yellow",children:"⏳ Wait for Approval"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this);return VZ.jsxDEV(_,{flexDirection:"column",children:(()=>{if(!Z.output)return null;return VZ.jsxDEV(W0,{content:Z.output,maxLines:5,borderColor:"cyan"},void 0,!1,void 0,this)})()},void 0,!1,void 0,this)},v$=({tool:Z})=>{let X=Z.getInputRepaired()?.command||"",J=X.length>50?X.substring(0,50)+"...":X;return VZ.jsxDEV(_,{paddingX:1,children:[VZ.jsxDEV(O,{color:"magenta",children:"Run "},void 0,!1,void 0,this),VZ.jsxDEV(O,{dimColor:!0,children:"("},void 0,!1,void 0,this),VZ.jsxDEV(O,{color:"magenta",children:J},void 0,!1,void 0,this),VZ.jsxDEV(O,{dimColor:!0,children:")"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},s8=t({name:"terminal",description:"",parameters:{},handler:ZZ.waitForUIDone,render(Z){return VZ.jsxDEV(_,{flexDirection:"column",children:[VZ.jsxDEV(v$,{tool:Z},void 0,!1,void 0,this),VZ.jsxDEV(I$,{tool:Z},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}});import{diff_match_patch as D$}from"diff-match-patch";function V$(Z,Y,X){if(Z===Y)return[{type:"unchanged",content:Z,lineNumbers:{old:1,new:1}}];let J=new D$,Q=J.diff_main(Z,Y);J.diff_cleanupSemantic(Q);let $=[],K=1,U=1,W=[];for(let[L,B]of Q){if(B==="")continue;let C=B.split(`
42
- `),R=B.endsWith(`
43
- `);for(let D=0;D<C.length;D++){let f=C[D];if(f===""&&(D<C.length-1||!R))continue;let V={type:L===0?"unchanged":L===-1?"added":"removed",content:f};if(L===0)V.lineNumbers={old:K,new:U},K++,U++;else if(L===-1)V.lineNumbers={new:U},U++;else if(L===1)V.lineNumbers={old:K},K++;W.push(V)}}if(!X?.maxLines)return W;let z=X.maxLines,H=X.contextLines||3,G=W.map((L,B)=>L.type!=="unchanged"?B:-1).filter((L)=>L!==-1);if(G.length===0||W.length<=z)return W;let F=[],M=0,N=[],w=[];for(let L=0;L<G.length;L++)if(w.length===0)w.push(G[L]);else{let B=w[w.length-1];if(G[L]-B<=1)w.push(G[L]);else N.push([...w]),w=[G[L]]}if(w.length>0)N.push(w);for(let L of N){if(M>=z)break;let B=L[0],C=L[L.length-1],R=Math.max(0,B-H),D=Math.min(W.length-1,C+H),f=D-R+1;if(M+f>z&&M>0){F.push({type:"unchanged",content:"..."});break}for(let V=R;V<=D;V++){if(M>=z){if(V<D)F.push({type:"unchanged",content:"..."});break}F.push(W[V]),M++}if(L===N[N.length-1]&&M<W.length){let V=W.length-D-1;if(V>0)F.push({type:"unchanged",content:`... (${V} more lines)`})}}return F}function t8(Z,Y=1000){return Z=Z||"",Z.length>Y||Z.split(`
44
- `).length>50}function e8(Z,Y,X){let J=t8(Z)||t8(Y),$=X!==void 0&&"maxLines"in X?X.maxLines:J?10:20,K=X?.contextLines??(J?1:3);return V$(Z,Y,{maxLines:$,contextLines:K})}var U0=P(I(),1),E$=["sky","primary"];function b$(Z){let Y=Z%2;return c4(E$[Y])}function T$(Z){let Y=[];if(Z.startsWith("/"))Y.push({type:"separator",value:"/"}),Z=Z.slice(1);let X=Z.split("/");return X.forEach((J,Q)=>{if(J)Y.push({type:"segment",value:J});if(Q<X.length-1)Y.push({type:"separator",value:"/"})}),Y}var f$=({path:Z,color:Y="cyan",line:X,rainbow:J=!1})=>{let Q=Z5(Z)??"",$=X!==void 0?`:${X}`:"";if(!J)return U0.jsxDEV(O,{color:c4(Y),children:[Q,$]},void 0,!0,void 0,this);let K=T$(Q),U=-1;for(let z=K.length-1;z>=0;z--)if(K[z].type==="segment"){U=z;break}let W=0;return U0.jsxDEV(O,{children:[K.map((z,H)=>{if(z.type==="separator")return U0.jsxDEV(O,{dimColor:!0,color:"gray",children:z.value},`sep-${H}`,!1,void 0,this);let G=H===U,F=b$(W);return W++,U0.jsxDEV(O,{color:F,dimColor:!G,children:z.value},`seg-${H}`,!1,void 0,this)}),$&&U0.jsxDEV(O,{color:"gray",children:$},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},fZ=f$;var HZ=P(I(),1),j$=Y5.schema,X5=t({name:"edit_file",description:"Performs exact string replacements in files with diff visualization",parameters:j$.shape,handler:ZZ.waitForUIDone,render(Z){let Y=Z.getInputRepaired(),X=Z.output,J=Y.old_string&&Y.new_string&&Y.old_string!==Y.new_string,Q=0,$=0;if(J){let K=e8(Y.old_string,Y.new_string,{maxLines:void 0});for(let U of K){if(U.type==="removed")Q++;if(U.type==="added")$++}}return HZ.jsxDEV(_,{flexDirection:"column",paddingX:1,children:[HZ.jsxDEV(_,{children:[HZ.jsxDEV(O,{color:"yellow",children:"Edit "},void 0,!1,void 0,this),HZ.jsxDEV(O,{dimColor:!0,children:"("},void 0,!1,void 0,this),HZ.jsxDEV(fZ,{path:Y.file_path,rainbow:!0},void 0,!1,void 0,this),HZ.jsxDEV(O,{dimColor:!0,children:")"},void 0,!1,void 0,this),J&&HZ.jsxDEV(HZ.Fragment,{children:[HZ.jsxDEV(O,{color:"gray",children:" ("},void 0,!1,void 0,this),HZ.jsxDEV(O,{color:"red",children:["-",Q]},void 0,!0,void 0,this),HZ.jsxDEV(O,{color:"gray",children:"/"},void 0,!1,void 0,this),HZ.jsxDEV(O,{color:"green",children:["+",$]},void 0,!0,void 0,this),HZ.jsxDEV(O,{color:"gray",children:")"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),X&&X.startsWith("Error:")&&HZ.jsxDEV(_,{marginTop:0,marginLeft:1,marginBottom:1,children:HZ.jsxDEV(O,{color:"red",children:X},void 0,!1,void 0,this)},void 0,!1,void 0,this),!X&&HZ.jsxDEV(_,{marginTop:0,children:HZ.jsxDEV(O,{color:"gray",children:"Press Enter to confirm, Ctrl+C to cancel"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}});var rZ=P(I(),1),S$={pending:"gray",in_progress:"yellow",completed:"green"},y$={pending:"○",in_progress:"◐",completed:"✓"},Q5=t({name:"todo_write",description:"Use this tool to create and manage a structured task list",parameters:J5.shape,handler:ZZ.waitForUIDone,render(Z){let Y=Z.getInputRepaired();if(!Y||!Y.todos||!Array.isArray(Y.todos))return rZ.jsxDEV(_,{flexDirection:"column",borderStyle:"round",borderColor:"red",children:rZ.jsxDEV(O,{color:"red",children:"Error: Invalid todo data structure"},void 0,!1,void 0,this)},void 0,!1,void 0,this);let X=Y.todos;return rZ.jsxDEV(_,{flexDirection:"column",paddingY:1,children:rZ.jsxDEV(_,{flexDirection:"column",marginTop:0,children:(()=>{if(X.length===0)return rZ.jsxDEV(_,{paddingX:1,children:rZ.jsxDEV(O,{color:"gray",children:"No tasks in todo list"},void 0,!1,void 0,this)},void 0,!1,void 0,this);return rZ.jsxDEV(_,{flexDirection:"column",marginTop:0,children:X.map((Q,$)=>rZ.jsxDEV(_,{paddingX:1,paddingY:0,children:[rZ.jsxDEV(O,{color:S$[Q.status],bold:!0,children:[y$[Q.status]," "]},void 0,!0,void 0,this),rZ.jsxDEV(O,{color:Q.status==="in_progress"?"white":"gray",children:[$+1,". ",Q.content]},void 0,!0,void 0,this)]},Q.id,!0,void 0,this))},void 0,!1,void 0,this)})()},void 0,!1,void 0,this)},void 0,!1,void 0,this)}});var oZ=P(I(),1),k$=$5.schema,K5=t({name:"read_file",description:"Reads a file from the local filesystem",parameters:k$.shape,handler:ZZ.waitForUIDone,render(Z){let Y=Z.getInputRepaired(),X=Z.output;if(!X)return oZ.jsxDEV(oZ.Fragment,{},void 0,!1,void 0,this);let Q=X.split(`
45
- `).length;return oZ.jsxDEV(_,{flexDirection:"column",paddingX:1,children:oZ.jsxDEV(_,{children:[oZ.jsxDEV(O,{color:"blue",children:"Read "},void 0,!1,void 0,this),oZ.jsxDEV(O,{dimColor:!0,children:"("},void 0,!1,void 0,this),oZ.jsxDEV(fZ,{path:Y.file_path,rainbow:!0},void 0,!1,void 0,this),oZ.jsxDEV(O,{dimColor:!0,children:")"},void 0,!1,void 0,this),oZ.jsxDEV(O,{color:"gray",dimColor:!0,children:[" ","(",Q," lines)"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}});var nZ=P(I(),1),h$=W5.schema,U5=t({name:"glob_files",description:"Find files by name patterns",parameters:h$.shape,handler:ZZ.waitForUIDone,render(Z){let Y=Z.getInputRepaired(),X=Z.output;if(!X)return nZ.jsxDEV(nZ.Fragment,{},void 0,!1,void 0,this);let Q=X.split(`
46
- `).filter(Boolean).length;return nZ.jsxDEV(_,{flexDirection:"column",paddingX:1,children:nZ.jsxDEV(O,{children:[nZ.jsxDEV(O,{color:"cyan",children:"Glob "},void 0,!1,void 0,this),nZ.jsxDEV(O,{dimColor:!0,children:"("},void 0,!1,void 0,this),nZ.jsxDEV(fZ,{path:Y.pattern,rainbow:!0},void 0,!1,void 0,this),nZ.jsxDEV(O,{dimColor:!0,children:")"},void 0,!1,void 0,this),nZ.jsxDEV(O,{color:"gray",dimColor:!0,children:[" ","(",Q," files)"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}});var _Z=P(I(),1),z5=t({name:"search_files_rg",description:"Ripgrep - fast text search tool",parameters:{},handler:ZZ.waitForUIDone,render(Z){let Y=Z.getInputRepaired(),X=Z.output;if(!X)return _Z.jsxDEV(_Z.Fragment,{},void 0,!1,void 0,this);let Q=X.split(`
47
- `).filter(Boolean).length,$=Y.pattern,K=Y.path;if(!$){let W=(Y.args||[]).filter((z)=>!z.startsWith("-"));if(W.length>0){if(K=W[W.length-1],W.length>1)$=W[W.length-2]}}return _Z.jsxDEV(_,{flexDirection:"column",paddingX:1,children:_Z.jsxDEV(O,{children:[_Z.jsxDEV(O,{color:"magenta",children:"Ripgrep "},void 0,!1,void 0,this),$&&_Z.jsxDEV(_Z.Fragment,{children:[_Z.jsxDEV(O,{dimColor:!0,children:"("},void 0,!1,void 0,this),_Z.jsxDEV(fZ,{path:$,color:"magenta"},void 0,!1,void 0,this),_Z.jsxDEV(O,{dimColor:!0,children:")"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K&&K!=="./"&&_Z.jsxDEV(_Z.Fragment,{children:[_Z.jsxDEV(O,{dimColor:!0,children:" in "},void 0,!1,void 0,this),_Z.jsxDEV(fZ,{path:K,rainbow:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),_Z.jsxDEV(O,{color:"gray",dimColor:!0,children:[" ","(",Q," matches)"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}});import{z as s0}from"zod";var G4=P(I(),1),x$=s0.object({description:s0.string().optional(),file_path:s0.string(),content:s0.string()}),H5=t({name:"write_file",description:"Writes a file to the local filesystem",parameters:x$.shape,handler:ZZ.waitForUIDone,render(Z){let Y=Z.getInputRepaired(),X=Z.output,J=Y.content?.split(`
48
- `)?.length;return G4.jsxDEV(_,{flexDirection:"column",paddingX:1,children:[G4.jsxDEV(_,{children:[G4.jsxDEV(O,{color:"green",children:"Write "},void 0,!1,void 0,this),G4.jsxDEV(O,{dimColor:!0,children:"("},void 0,!1,void 0,this),G4.jsxDEV(fZ,{path:Y.file_path,rainbow:!0},void 0,!1,void 0,this),G4.jsxDEV(O,{dimColor:!0,children:")"},void 0,!1,void 0,this),G4.jsxDEV(O,{dimColor:!0,children:[" (",J," lines)"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),X&&X.startsWith("Error:")&&G4.jsxDEV(_,{marginTop:0,marginLeft:1,marginBottom:1,children:G4.jsxDEV(O,{color:"red",children:X},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}});var PZ=P(I(),1),g$=G5.schema,O5=t({name:"folder_operations",description:"Unified folder operations tool supporting create, list, delete, and existence check",parameters:g$.shape,render(Z){let Y=Z.getInputRepaired(),X=Z.output;if(!X)return PZ.jsxDEV(PZ.Fragment,{},void 0,!1,void 0,this);let Q={create:"green",list:"blue",exists:"yellow",delete:"red"}[Y?.operation]||"cyan",K=X.split(`
49
- `).map((U,W)=>{if(U.match(/\d+ \w+|[\d-]+ [\d:]+/))return PZ.jsxDEV(O,{dimColor:!0,children:U},W,!1,void 0,this);if(U.includes("✓")||U.includes("successfully")||U.includes("created")||U.includes("deleted"))return PZ.jsxDEV(O,{color:"green",children:U},W,!1,void 0,this);if(U.includes("✗")||U.includes("Error")||U.includes("not found")||U.includes("failed"))return PZ.jsxDEV(O,{color:"red",children:U},W,!1,void 0,this);if(U.startsWith("/")||U.includes("/:"))return PZ.jsxDEV(O,{color:"cyan",children:U},W,!1,void 0,this);return PZ.jsxDEV(O,{children:U},W,!1,void 0,this)});return PZ.jsxDEV(_,{flexDirection:"column",paddingX:1,children:PZ.jsxDEV(_,{children:[PZ.jsxDEV(O,{bold:!0,color:Q,children:[Y.operation,"Folder"]},void 0,!0,void 0,this),PZ.jsxDEV(O,{dimColor:!0,children:" ("},void 0,!1,void 0,this),PZ.jsxDEV(fZ,{path:Y.folder_path,rainbow:!0},void 0,!1,void 0,this),PZ.jsxDEV(O,{dimColor:!0,children:")"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}});import{z as u$}from"zod";var MZ=P(I(),1),m$=u$.object({}),q5=t({name:"load_mcp_tools",description:`加载并查询所有可用的 MCP 工具列表。
38
+ - `)}`;if(F.customInput&&F.customInput.trim())L+=(L?`
39
+ `:"")+`User Custom Input: ${F.customInput}`}$.sendResumeData({type:"respond",message:L||"User made a selection"}),J(X,{resultSent:!0})}};_();let G=setInterval(_,100);return()=>clearInterval(G)},[X,Y,J,$]),$.state==="interrupted"&&!$.output)return E$.jsxDEV(U,{flexDirection:"column",children:E$.jsxDEV(U,{paddingX:1,children:E$.jsxDEV(Q,{color:"yellow",children:"⏳ 等待用户选择..."},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this);if($.output)return E$.jsxDEV(Q,{color:"yellow",children:$.output},void 0,!1,void 0,this);return null},Q2=i({name:"ask_user_questions",description:"Ask the user a question with selectable options",parameters:WX,handler:n.waitForUIDone,render($){return E$.jsxDEV(QX,{tool:$},void 0,!1,void 0,this)}});var f$=A(h(),1);var r$=A(q(),1),g$=({content:$,maxLines:Z=10,borderColor:Y="cyan",borderStyle:J="single",marginTop:X=0,paddingX:K=0,showOmittedInfo:W=!0})=>{let{stdout:O}=_2();if(!$)return null;let _=O.columns,G=$.split(`
40
+ `).map((F)=>F.slice(0,_-10)),N=Math.max(0,G.length-Z),z=G.slice(-Z).join(`
41
+ `);return r$.jsxDEV(U,{flexDirection:"column",width:_-5,children:r$.jsxDEV(U,{borderStyle:J,borderColor:Y,borderLeft:!1,borderRight:!1,flexDirection:"column",paddingX:K,marginTop:X,children:[W&&N>0&&r$.jsxDEV(Q,{color:"gray",dimColor:!0,children:["... ",N," lines omitted ..."]},void 0,!0,void 0,this),r$.jsxDEV(Q,{dimColor:!0,children:z},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)};var L1=A(q(),1),_X=({tool:$})=>{let{addInteraction:Z,getInteractions:Y,updateInteraction:J}=P1(),[X,K]=f$.useState(null),W=f$.useRef(!1),O=$.getHumanInTheLoopData();if(f$.useEffect(()=>{if(O?.reviewConfig&&$.state==="interrupted"&&!X&&!W.current){let G=$.getInputRepaired()?.description,N={type:"approval",toolCall:{name:$.message.name,args:$.getInputRepaired()},editableFields:["args"]},z=Z(N,{tool:$,metadata:{title:`Approve ${$.message.name}`,description:G,groupKey:"approvals"}});K(z.id)}},[O,$,X,Z]),f$.useEffect(()=>{if(!X||W.current)return;let G=()=>{let F=Y().find((L)=>L.id===X);if(F&&(F.state==="submitted"||F.state==="edited"||F.state==="cancelled")&&!F.resultSent){W.current=!0;let L=F.result;if(L){if(L.status==="approved")$.sendResumeData({type:"approve"});else if(L.status==="edited"){let w={name:$.message.name,args:L.editedArgs};$.sendResumeData({type:"edit",edited_action:w})}else if(L.status==="rejected"){let w=L.message||"User rejected to run this tool";$.sendResumeData({type:"reject",message:w})}}J(X,{resultSent:!0})}};G();let N=setInterval(G,100);return()=>clearInterval(N)},[X,Y,J,$]),O?.reviewConfig&&X&&!$.output)return L1.jsxDEV(U,{flexDirection:"column",children:L1.jsxDEV(U,{paddingX:1,paddingY:1,children:L1.jsxDEV(Q,{color:"yellow",children:"⏳ Wait for Approval"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this);return L1.jsxDEV(U,{flexDirection:"column",children:(()=>{if(!$.output)return null;return L1.jsxDEV(g$,{content:$.output,maxLines:5,borderColor:"cyan"},void 0,!1,void 0,this)})()},void 0,!1,void 0,this)},OX=({tool:$})=>{let Y=$.getInputRepaired()?.command||"",J=Y.length>50?Y.substring(0,50)+"...":Y;return L1.jsxDEV(U,{paddingX:1,children:[L1.jsxDEV(Q,{color:"magenta",children:"Run "},void 0,!1,void 0,this),L1.jsxDEV(Q,{dimColor:!0,children:"("},void 0,!1,void 0,this),L1.jsxDEV(Q,{color:"magenta",children:J},void 0,!1,void 0,this),L1.jsxDEV(Q,{dimColor:!0,children:")"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},O2=i({name:"terminal",description:"",parameters:{},handler:n.waitForUIDone,render($){return L1.jsxDEV(U,{flexDirection:"column",children:[L1.jsxDEV(OX,{tool:$},void 0,!1,void 0,this),L1.jsxDEV(_X,{tool:$},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}});import{diff_match_patch as GX}from"diff-match-patch";function UX($,Z,Y){if($===Z)return[{type:"unchanged",content:$,lineNumbers:{old:1,new:1}}];let J=new GX,X=J.diff_main($,Z);J.diff_cleanupSemantic(X);let K=[],W=1,O=1,_=[];for(let[b,f]of X){if(f==="")continue;let k=f.split(`
42
+ `),g=f.endsWith(`
43
+ `);for(let p=0;p<k.length;p++){let o=k[p];if(o===""&&(p<k.length-1||!g))continue;let S={type:b===0?"unchanged":b===-1?"added":"removed",content:o};if(b===0)S.lineNumbers={old:W,new:O},W++,O++;else if(b===-1)S.lineNumbers={new:O},O++;else if(b===1)S.lineNumbers={old:W},W++;_.push(S)}}if(!Y?.maxLines)return _;let G=Y.maxLines,N=Y.contextLines||3,z=_.map((b,f)=>b.type!=="unchanged"?f:-1).filter((b)=>b!==-1);if(z.length===0||_.length<=G)return _;let F=[],L=0,w=[],M=[];for(let b=0;b<z.length;b++)if(M.length===0)M.push(z[b]);else{let f=M[M.length-1];if(z[b]-f<=1)M.push(z[b]);else w.push([...M]),M=[z[b]]}if(M.length>0)w.push(M);for(let b of w){if(L>=G)break;let f=b[0],k=b[b.length-1],g=Math.max(0,f-N),p=Math.min(_.length-1,k+N),o=p-g+1;if(L+o>G&&L>0){F.push({type:"unchanged",content:"..."});break}for(let S=g;S<=p;S++){if(L>=G){if(S<p)F.push({type:"unchanged",content:"..."});break}F.push(_[S]),L++}if(b===w[w.length-1]&&L<_.length){let S=_.length-p-1;if(S>0)F.push({type:"unchanged",content:`... (${S} more lines)`})}}return F}function G2($,Z=1000){return $=$||"",$.length>Z||$.split(`
44
+ `).length>50}function U2($,Z,Y){let J=G2($)||G2(Z),K=Y!==void 0&&"maxLines"in Y?Y.maxLines:J?10:20,W=Y?.contextLines??(J?1:3);return UX($,Z,{maxLines:K,contextLines:W})}var p$=A(q(),1),zX=["sky","primary"];function NX($){let Z=$%2;return P$(zX[Z])}function HX($){let Z=[];if($.startsWith("/"))Z.push({type:"separator",value:"/"}),$=$.slice(1);let Y=$.split("/");return Y.forEach((J,X)=>{if(J)Z.push({type:"segment",value:J});if(X<Y.length-1)Z.push({type:"separator",value:"/"})}),Z}var FX=({path:$,color:Z="cyan",line:Y,rainbow:J=!1})=>{let X=z2($)??"",K=Y!==void 0?`:${Y}`:"";if(!J)return p$.jsxDEV(Q,{color:P$(Z),children:[X,K]},void 0,!0,void 0,this);let W=HX(X),O=-1;for(let G=W.length-1;G>=0;G--)if(W[G].type==="segment"){O=G;break}let _=0;return p$.jsxDEV(Q,{children:[W.map((G,N)=>{if(G.type==="separator")return p$.jsxDEV(Q,{dimColor:!0,color:"gray",children:G.value},`sep-${N}`,!1,void 0,this);let z=N===O,F=NX(_);return _++,p$.jsxDEV(Q,{color:F,dimColor:!z,children:G.value},`seg-${N}`,!1,void 0,this)}),K&&p$.jsxDEV(Q,{color:"gray",children:K},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},q1=FX;var X1=A(q(),1),LX=N2.schema,H2=i({name:"edit_file",description:"Performs exact string replacements in files with diff visualization",parameters:LX.shape,handler:n.waitForUIDone,render($){let Z=$.getInputRepaired(),Y=$.output,J=Z.old_string&&Z.new_string&&Z.old_string!==Z.new_string,X=0,K=0;if(J){let W=U2(Z.old_string,Z.new_string,{maxLines:void 0});for(let O of W){if(O.type==="removed")X++;if(O.type==="added")K++}}return X1.jsxDEV(U,{flexDirection:"column",paddingX:1,children:[X1.jsxDEV(U,{children:[X1.jsxDEV(Q,{color:"yellow",children:"Edit "},void 0,!1,void 0,this),X1.jsxDEV(Q,{dimColor:!0,children:"("},void 0,!1,void 0,this),X1.jsxDEV(q1,{path:Z.file_path,rainbow:!0},void 0,!1,void 0,this),X1.jsxDEV(Q,{dimColor:!0,children:")"},void 0,!1,void 0,this),J&&X1.jsxDEV(X1.Fragment,{children:[X1.jsxDEV(Q,{color:"gray",children:" ("},void 0,!1,void 0,this),X1.jsxDEV(Q,{color:"red",children:["-",X]},void 0,!0,void 0,this),X1.jsxDEV(Q,{color:"gray",children:"/"},void 0,!1,void 0,this),X1.jsxDEV(Q,{color:"green",children:["+",K]},void 0,!0,void 0,this),X1.jsxDEV(Q,{color:"gray",children:")"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Y&&Y.startsWith("Error:")&&X1.jsxDEV(U,{marginTop:0,marginLeft:1,marginBottom:1,children:X1.jsxDEV(Q,{color:"red",children:Y},void 0,!1,void 0,this)},void 0,!1,void 0,this),!Y&&X1.jsxDEV(U,{marginTop:0,children:X1.jsxDEV(Q,{color:"gray",children:"Press Enter to confirm, Ctrl+C to cancel"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}});var y1=A(q(),1),AX={pending:"gray",in_progress:"yellow",completed:"green"},wX={pending:"○",in_progress:"◐",completed:"✓"},L2=i({name:"todo_write",description:"Use this tool to create and manage a structured task list",parameters:F2.shape,handler:n.waitForUIDone,render($){let Z=$.getInputRepaired();if(!Z||!Z.todos||!Array.isArray(Z.todos))return y1.jsxDEV(U,{flexDirection:"column",borderStyle:"round",borderColor:"red",children:y1.jsxDEV(Q,{color:"red",children:"Error: Invalid todo data structure"},void 0,!1,void 0,this)},void 0,!1,void 0,this);let Y=Z.todos;return y1.jsxDEV(U,{flexDirection:"column",paddingY:1,children:y1.jsxDEV(U,{flexDirection:"column",marginTop:0,children:(()=>{if(Y.length===0)return y1.jsxDEV(U,{paddingX:1,children:y1.jsxDEV(Q,{color:"gray",children:"No tasks in todo list"},void 0,!1,void 0,this)},void 0,!1,void 0,this);return y1.jsxDEV(U,{flexDirection:"column",marginTop:0,children:Y.map((X,K)=>y1.jsxDEV(U,{paddingX:1,paddingY:0,children:[y1.jsxDEV(Q,{color:AX[X.status],bold:!0,children:[wX[X.status]," "]},void 0,!0,void 0,this),y1.jsxDEV(Q,{color:X.status==="in_progress"?"white":"gray",children:[K+1,". ",X.content]},void 0,!0,void 0,this)]},X.id,!0,void 0,this))},void 0,!1,void 0,this)})()},void 0,!1,void 0,this)},void 0,!1,void 0,this)}});var h1=A(q(),1),MX=A2.schema,w2=i({name:"read_file",description:"Reads a file from the local filesystem",parameters:MX.shape,handler:n.waitForUIDone,render($){let Z=$.getInputRepaired(),Y=$.output;if(!Y)return h1.jsxDEV(h1.Fragment,{},void 0,!1,void 0,this);let X=Y.split(`
45
+ `).length;return h1.jsxDEV(U,{flexDirection:"column",paddingX:1,children:h1.jsxDEV(U,{children:[h1.jsxDEV(Q,{color:"blue",children:"Read "},void 0,!1,void 0,this),h1.jsxDEV(Q,{dimColor:!0,children:"("},void 0,!1,void 0,this),h1.jsxDEV(q1,{path:Z.file_path,rainbow:!0},void 0,!1,void 0,this),h1.jsxDEV(Q,{dimColor:!0,children:")"},void 0,!1,void 0,this),h1.jsxDEV(Q,{color:"gray",dimColor:!0,children:[" ","(",X," lines)"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}});var D1=A(q(),1),qX=M2.schema,q2=i({name:"glob_files",description:"Find files by name patterns",parameters:qX.shape,handler:n.waitForUIDone,render($){let Z=$.getInputRepaired(),Y=$.output;if(!Y)return D1.jsxDEV(D1.Fragment,{},void 0,!1,void 0,this);let X=Y.split(`
46
+ `).filter(Boolean).length;return D1.jsxDEV(U,{flexDirection:"column",paddingX:1,children:D1.jsxDEV(Q,{children:[D1.jsxDEV(Q,{color:"cyan",children:"Glob "},void 0,!1,void 0,this),D1.jsxDEV(Q,{dimColor:!0,children:"("},void 0,!1,void 0,this),D1.jsxDEV(q1,{path:Z.pattern,rainbow:!0},void 0,!1,void 0,this),D1.jsxDEV(Q,{dimColor:!0,children:")"},void 0,!1,void 0,this),D1.jsxDEV(Q,{color:"gray",dimColor:!0,children:[" ","(",X," files)"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}});var Q1=A(q(),1),b2=i({name:"search_files_rg",description:"Ripgrep - fast text search tool",parameters:{},handler:n.waitForUIDone,render($){let Z=$.getInputRepaired(),Y=$.output;if(!Y)return Q1.jsxDEV(Q1.Fragment,{},void 0,!1,void 0,this);let X=Y.split(`
47
+ `).filter(Boolean).length,K=Z.pattern,W=Z.path;if(!K){let _=(Z.args||[]).filter((G)=>!G.startsWith("-"));if(_.length>0){if(W=_[_.length-1],_.length>1)K=_[_.length-2]}}return Q1.jsxDEV(U,{flexDirection:"column",paddingX:1,children:Q1.jsxDEV(Q,{children:[Q1.jsxDEV(Q,{color:"magenta",children:"Ripgrep "},void 0,!1,void 0,this),K&&Q1.jsxDEV(Q1.Fragment,{children:[Q1.jsxDEV(Q,{dimColor:!0,children:"("},void 0,!1,void 0,this),Q1.jsxDEV(q1,{path:K,color:"magenta"},void 0,!1,void 0,this),Q1.jsxDEV(Q,{dimColor:!0,children:")"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W&&W!=="./"&&Q1.jsxDEV(Q1.Fragment,{children:[Q1.jsxDEV(Q,{dimColor:!0,children:" in "},void 0,!1,void 0,this),Q1.jsxDEV(q1,{path:W,rainbow:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Q1.jsxDEV(Q,{color:"gray",dimColor:!0,children:[" ","(",X," matches)"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}});import{z as NZ}from"zod";var o1=A(q(),1),bX=NZ.object({description:NZ.string().optional(),file_path:NZ.string(),content:NZ.string()}),R2=i({name:"write_file",description:"Writes a file to the local filesystem",parameters:bX.shape,handler:n.waitForUIDone,render($){let Z=$.getInputRepaired(),Y=$.output,J=Z.content?.split(`
48
+ `)?.length;return o1.jsxDEV(U,{flexDirection:"column",paddingX:1,children:[o1.jsxDEV(U,{children:[o1.jsxDEV(Q,{color:"green",children:"Write "},void 0,!1,void 0,this),o1.jsxDEV(Q,{dimColor:!0,children:"("},void 0,!1,void 0,this),o1.jsxDEV(q1,{path:Z.file_path,rainbow:!0},void 0,!1,void 0,this),o1.jsxDEV(Q,{dimColor:!0,children:")"},void 0,!1,void 0,this),o1.jsxDEV(Q,{dimColor:!0,children:[" (",J," lines)"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Y&&Y.startsWith("Error:")&&o1.jsxDEV(U,{marginTop:0,marginLeft:1,marginBottom:1,children:o1.jsxDEV(Q,{color:"red",children:Y},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}});var G1=A(q(),1),RX=B2.schema,f2=i({name:"folder_operations",description:"Unified folder operations tool supporting create, list, delete, and existence check",parameters:RX.shape,render($){let Z=$.getInputRepaired(),Y=$.output;if(!Y)return G1.jsxDEV(G1.Fragment,{},void 0,!1,void 0,this);let X={create:"green",list:"blue",exists:"yellow",delete:"red"}[Z?.operation]||"cyan",W=Y.split(`
49
+ `).map((O,_)=>{if(O.match(/\d+ \w+|[\d-]+ [\d:]+/))return G1.jsxDEV(Q,{dimColor:!0,children:O},_,!1,void 0,this);if(O.includes("✓")||O.includes("successfully")||O.includes("created")||O.includes("deleted"))return G1.jsxDEV(Q,{color:"green",children:O},_,!1,void 0,this);if(O.includes("✗")||O.includes("Error")||O.includes("not found")||O.includes("failed"))return G1.jsxDEV(Q,{color:"red",children:O},_,!1,void 0,this);if(O.startsWith("/")||O.includes("/:"))return G1.jsxDEV(Q,{color:"cyan",children:O},_,!1,void 0,this);return G1.jsxDEV(Q,{children:O},_,!1,void 0,this)});return G1.jsxDEV(U,{flexDirection:"column",paddingX:1,children:G1.jsxDEV(U,{children:[G1.jsxDEV(Q,{bold:!0,color:X,children:[Z.operation,"Folder"]},void 0,!0,void 0,this),G1.jsxDEV(Q,{dimColor:!0,children:" ("},void 0,!1,void 0,this),G1.jsxDEV(q1,{path:Z.folder_path,rainbow:!0},void 0,!1,void 0,this),G1.jsxDEV(Q,{dimColor:!0,children:")"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}});import{z as BX}from"zod";var W1=A(q(),1),fX=BX.object({}),P2=i({name:"load_mcp_tools",description:`加载并查询所有可用的 MCP 工具列表。
50
50
 
51
51
  返回:
52
52
  - tools: MCP 工具列表,每个工具包含 name, description, schema
@@ -57,7 +57,7 @@ ${F.selected.join(`
57
57
  - 获取工具的参数格式
58
58
  - 检查 MCP 连接状态
59
59
 
60
- 重要:工具列表是动态的,建议在需要时调用此命令获取最新信息。`,parameters:m$.shape,handler:ZZ.waitForUIDone,render(Z){let Y=Z.output,X=null;try{X=JSON.parse(Y)}catch(J){}return MZ.jsxDEV(_,{flexDirection:"column",children:[MZ.jsxDEV(_,{children:MZ.jsxDEV(O,{color:"blue",bold:!0,children:"load_mcp_tools"},void 0,!1,void 0,this)},void 0,!1,void 0,this),X?.status&&MZ.jsxDEV(_,{flexDirection:"column",marginTop:1,children:[MZ.jsxDEV(O,{color:"green",children:"✓ MCP 已连接"},void 0,!1,void 0,this),X.status.servers&&X.status.servers.length>0&&MZ.jsxDEV(_,{marginLeft:2,children:MZ.jsxDEV(O,{color:"gray",children:["服务器: ",X.status.servers.join(", ")]},void 0,!0,void 0,this)},void 0,!1,void 0,this),X.status.toolCount!==void 0&&MZ.jsxDEV(_,{marginLeft:2,children:MZ.jsxDEV(O,{color:"gray",children:["工具数量: ",X.status.toolCount]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),X?.tools&&X.tools.length>0&&MZ.jsxDEV(_,{flexDirection:"column",marginTop:1,children:[MZ.jsxDEV(O,{color:"gray",dimColor:!0,children:["可用工具 (",X.tools.length,"):"]},void 0,!0,void 0,this),X.tools.slice(0,5).map((J,Q)=>MZ.jsxDEV(_,{marginLeft:2,children:[MZ.jsxDEV(O,{color:"cyan",children:J.name},void 0,!1,void 0,this),J.description&&MZ.jsxDEV(O,{color:"gray",dimColor:!0,children:[" ","- ",J.description.slice(0,50),J.description.length>50?"...":""]},void 0,!0,void 0,this)]},Q,!0,void 0,this)),X.tools.length>5&&MZ.jsxDEV(_,{marginLeft:2,children:MZ.jsxDEV(O,{color:"gray",dimColor:!0,children:["... 还有 ",X.tools.length-5," 个工具"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y&&MZ.jsxDEV(W0,{content:Y,maxLines:10,borderColor:"gray"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}});import{z as l4}from"zod";var EZ=P(I(),1),p$=l4.object({commands:l4.array(l4.object({name:l4.string().describe("MCP 工具名称"),args:l4.record(l4.string(),l4.any()).describe("工具参数,JSON 对象格式")})).describe("要执行的 MCP 工具列表")}),F5=t({name:"execute_mcp_tool",description:`执行一个或多个 MCP 工具。
60
+ 重要:工具列表是动态的,建议在需要时调用此命令获取最新信息。`,parameters:fX.shape,handler:n.waitForUIDone,render($){let Z=$.output,Y=null;try{Y=JSON.parse(Z)}catch(J){}return W1.jsxDEV(U,{flexDirection:"column",children:[W1.jsxDEV(U,{children:W1.jsxDEV(Q,{color:"blue",bold:!0,children:"load_mcp_tools"},void 0,!1,void 0,this)},void 0,!1,void 0,this),Y?.status&&W1.jsxDEV(U,{flexDirection:"column",marginTop:1,children:[W1.jsxDEV(Q,{color:"green",children:"✓ MCP 已连接"},void 0,!1,void 0,this),Y.status.servers&&Y.status.servers.length>0&&W1.jsxDEV(U,{marginLeft:2,children:W1.jsxDEV(Q,{color:"gray",children:["服务器: ",Y.status.servers.join(", ")]},void 0,!0,void 0,this)},void 0,!1,void 0,this),Y.status.toolCount!==void 0&&W1.jsxDEV(U,{marginLeft:2,children:W1.jsxDEV(Q,{color:"gray",children:["工具数量: ",Y.status.toolCount]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y?.tools&&Y.tools.length>0&&W1.jsxDEV(U,{flexDirection:"column",marginTop:1,children:[W1.jsxDEV(Q,{color:"gray",dimColor:!0,children:["可用工具 (",Y.tools.length,"):"]},void 0,!0,void 0,this),Y.tools.slice(0,5).map((J,X)=>W1.jsxDEV(U,{marginLeft:2,children:[W1.jsxDEV(Q,{color:"cyan",children:J.name},void 0,!1,void 0,this),J.description&&W1.jsxDEV(Q,{color:"gray",dimColor:!0,children:[" ","- ",J.description.slice(0,50),J.description.length>50?"...":""]},void 0,!0,void 0,this)]},X,!0,void 0,this)),Y.tools.length>5&&W1.jsxDEV(U,{marginLeft:2,children:W1.jsxDEV(Q,{color:"gray",dimColor:!0,children:["... 还有 ",Y.tools.length-5," 个工具"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Z&&W1.jsxDEV(g$,{content:Z,maxLines:10,borderColor:"gray"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}});import{z as C$}from"zod";var A1=A(q(),1),PX=C$.object({commands:C$.array(C$.object({name:C$.string().describe("MCP 工具名称"),args:C$.record(C$.string(),C$.any()).describe("工具参数,JSON 对象格式")})).describe("要执行的 MCP 工具列表")}),C2=i({name:"execute_mcp_tool",description:`执行一个或多个 MCP 工具。
61
61
 
62
62
  使用格式:
63
63
  - commands: MCP 工具数组,每个工具包含 name 和 args
@@ -69,124 +69,112 @@ ${F.selected.join(`
69
69
  重要:
70
70
  - 所有工具独立执行,失败不影响其他工具
71
71
  - 返回结果按命令顺序排列
72
- - 适合批量执行 MCP 相关操作`,parameters:p$.shape,handler:ZZ.waitForUIDone,render(Z){let Y=Z.getInputRepaired(),X=Z.output,J=null;try{J=JSON.parse(X)}catch(Q){}return EZ.jsxDEV(_,{flexDirection:"column",children:[EZ.jsxDEV(_,{children:EZ.jsxDEV(O,{color:"blue",bold:!0,children:"execute_mcp_tool"},void 0,!1,void 0,this)},void 0,!1,void 0,this),Y?.commands&&Y.commands.length>0&&EZ.jsxDEV(_,{flexDirection:"column",marginTop:1,children:[EZ.jsxDEV(O,{color:"gray",dimColor:!0,children:["执行 ",Y.commands.length," 个 MCP 工具:"]},void 0,!0,void 0,this),Y.commands.map((Q,$)=>EZ.jsxDEV(_,{marginLeft:2,children:[EZ.jsxDEV(O,{color:"yellow",children:[$+1,"."]},void 0,!0,void 0,this),EZ.jsxDEV(O,{color:"cyan",children:Q.name},void 0,!1,void 0,this)]},$,!0,void 0,this))]},void 0,!0,void 0,this),J?.results&&EZ.jsxDEV(_,{flexDirection:"column",marginTop:1,children:J.results.map((Q,$)=>EZ.jsxDEV(_,{marginLeft:2,children:Q.error?EZ.jsxDEV(O,{color:"red",children:["✗ ",Q.tool]},void 0,!0,void 0,this):EZ.jsxDEV(O,{color:"green",children:["✓ ",Q.tool]},void 0,!0,void 0,this)},$,!1,void 0,this))},void 0,!1,void 0,this),X&&EZ.jsxDEV(W0,{content:X,maxLines:10,borderColor:"gray"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}});var O4=P(I(),1);import{z as z0}from"zod";var d$=z0.object({task_id:z0.string().optional().describe("The task id to ask the subagent"),subagent_id:z0.string().describe("The id of subagent to use"),subagent_type:z0.string().describe("The type of subagent to use (general-purpose, statusline-setup, output-style-setup)"),task_description:z0.string().describe("Describe what you want the subagent to do"),data_transfer:z0.any().optional().describe("Data to transfer to the subagent")}),c$=({tool:Z})=>{let Y=Z.getInputRepaired();return O4.jsxDEV(_,{paddingX:1,flexDirection:"column",children:O4.jsxDEV(_,{children:[O4.jsxDEV(O,{color:"yellow",children:"Task "},void 0,!1,void 0,this),O4.jsxDEV(O,{dimColor:!0,children:"("},void 0,!1,void 0,this),O4.jsxDEV(O,{color:"cyan",children:Y.subagent_id},void 0,!1,void 0,this),O4.jsxDEV(O,{dimColor:!0,children:")"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},l$=({tool:Z})=>{let Y=Z.getInputRepaired(),X=Z.output;return O4.jsxDEV(_,{flexDirection:"column",children:O4.jsxDEV(c$,{tool:Z},void 0,!1,void 0,this)},void 0,!1,void 0,this)},M5=t({name:"task",description:"Launch a subagent to handle complex tasks autonomously",parameters:d$.shape,handler:ZZ.waitForUIDone,render(Z){return O4.jsxDEV(l$,{tool:Z},void 0,!1,void 0,this)}});var N5=[s8,n8,X5,Q5,K5,U5,z5,H5,O5,q5,F5,M5];var e=P(g(),1);var b=P(I(),1),i$=({validation:Z,onComplete:Y})=>{let{config:X,updateConfig:J}=UZ(),[Q,$]=e.useState("welcome"),[K,U]=e.useState(!1),[W,z]=e.useState(null),[H,G]=e.useState(0),[F,M]=e.useState(null),N=e.useRef(!0),w=e.useRef([]),L=e.useRef(H),B=X?.providers||[];e.useEffect(()=>{w.current=B},[B]),e.useEffect(()=>{L.current=H},[H]);let C=B[H],R=e.useCallback(()=>M(null),[]);TZ(R,F?3000:null);let D=e.useCallback(()=>{N.current=!0,z(null),U(!0),M(null)},[]),f=e.useCallback(()=>{let u=w.current,n=L.current,i=u[n];if(!i)return;N.current=!1,z(i),U(!0),M(null)},[]),V=e.useCallback(()=>{U(!1),z(null),M(null)},[]),d=e.useCallback(async(u)=>{let n=w.current,i=N.current,Q4=i?[...n,u]:n.map(($4)=>$4.id===u.id?u:$4);if(await J({providers:Q4}),M(i?`已添加 Provider: ${u.id}`:`已更新 Provider: ${u.id}`),i){let $4=Q4.findIndex((hZ)=>hZ.id===u.id);G($4>=0?$4:0)}V()},[J,V]),l=e.useCallback(()=>{if(!C||!C.apiKey){M("请先配置 Provider 的 API Key");return}J({provider_id:C.id,provider_type:C.type}).then(()=>{$("model")})},[C,J]);if(uZ((u,n)=>{if(n.return||u===" ")$("provider")},{isActive:Q==="welcome"}),uZ((u,n)=>{if(K)return;if(n.upArrow)G((i)=>i>0?i-1:B.length-1);else if(n.downArrow)G((i)=>i<B.length-1?i+1:0);else if(u==="n"||u==="N")D();else if((u==="e"||u==="E"||n.return)&&C)f();else if(u==="s"||u==="S")l()},{isActive:Q==="provider"}),Q==="welcome")return b.jsxDEV(_,{flexDirection:"column",paddingX:2,paddingY:1,width:"100%",children:[b.jsxDEV(_,{marginBottom:1,children:b.jsxDEV(O,{bold:!0,color:"cyan",children:"欢迎使用 Zen Code"},void 0,!1,void 0,this)},void 0,!1,void 0,this),b.jsxDEV(_,{marginBottom:1,children:b.jsxDEV(O,{color:"yellow",children:Z.reason||"需要进行初始配置"},void 0,!1,void 0,this)},void 0,!1,void 0,this),b.jsxDEV(_,{flexDirection:"column",marginBottom:1,children:[b.jsxDEV(O,{dimColor:!0,children:"接下来将引导你完成:"},void 0,!1,void 0,this),b.jsxDEV(O,{dimColor:!0,children:" 1. 配置 Provider(API 服务提供商)"},void 0,!1,void 0,this),b.jsxDEV(O,{dimColor:!0,children:" 2. 选择 Model(AI 模型)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),b.jsxDEV(_,{children:b.jsxDEV(O,{color:"green",bold:!0,children:"按 Enter 开始配置"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(Q==="provider")return b.jsxDEV(_,{flexDirection:"column",width:"100%",children:[b.jsxDEV(_,{paddingX:2,paddingY:1,children:b.jsxDEV(O,{bold:!0,color:"cyan",children:"步骤 1/2: Provider 配置"},void 0,!1,void 0,this)},void 0,!1,void 0,this),K?b.jsxDEV(A5,{provider:W||void 0,onCancel:V,onSave:d},void 0,!1,void 0,this):b.jsxDEV(b.Fragment,{children:b.jsxDEV(_,{flexDirection:"column",paddingX:2,gap:1,children:[B.length===0?b.jsxDEV(_,{paddingY:1,children:b.jsxDEV(O,{color:"yellow",children:"未配置任何 Provider,请按 'n' 新增"},void 0,!1,void 0,this)},void 0,!1,void 0,this):B.map((u,n)=>{let i=!!u.apiKey,Q4=i?"green":"yellow";return b.jsxDEV(_,{marginBottom:0,gap:1,children:[b.jsxDEV(O,{color:n===H?"cyan":"gray",bold:n===H,children:n===H?">":" "},void 0,!1,void 0,this),b.jsxDEV(O,{bold:n===H,color:n===H?"cyan":void 0,children:u.id},void 0,!1,void 0,this),b.jsxDEV(O,{color:"gray",dimColor:n!==H,children:[" ",u.type]},void 0,!0,void 0,this),b.jsxDEV(O,{color:Q4,dimColor:n!==H,children:[" ","[",i?"已配置":"未配置","]"]},void 0,!0,void 0,this)]},u.id,!0,void 0,this)}),b.jsxDEV(_,{marginTop:1,children:[b.jsxDEV(O,{color:"gray",dimColor:!0,children:[b.jsxDEV(O,{color:"cyan",children:"↑↓"},void 0,!1,void 0,this)," 导航 ",b.jsxDEV(O,{color:"cyan",children:"n"},void 0,!1,void 0,this)," 新增"," ",b.jsxDEV(O,{color:"cyan",children:"e/Enter"},void 0,!1,void 0,this)," 编辑"," "]},void 0,!0,void 0,this),B.some((u)=>u.apiKey)&&b.jsxDEV(O,{children:[b.jsxDEV(O,{color:"green",children:"s"},void 0,!1,void 0,this)," 下一步"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),F&&b.jsxDEV(_,{paddingX:2,paddingY:0,children:b.jsxDEV(O,{color:"green",children:F},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(Q==="model")return b.jsxDEV(r$,{onComplete:Y,onBack:()=>$("provider")},void 0,!1,void 0,this);return null},r$=({onComplete:Z,onBack:Y})=>{let{config:X,updateConfig:J}=UZ(),[Q,$]=e.useState(0),K=e.useMemo(()=>{return X?.providers.find((G)=>G.id===X.provider_id)||null},[X?.providers,X?.provider_id]),{data:U=[],isLoading:W,error:z}=_5({provider:K,enabled:!!K?.apiKey}),H=U[Q];if(uZ((G,F)=>{if(F.upArrow)$((M)=>M>0?M-1:U.length-1);else if(F.downArrow)$((M)=>M<U.length-1?M+1:0);else if(F.escape||G==="b"||G==="B")Y();else if((F.return||G===" ")&&H)J({model_id:H.id}).then(()=>{Z()})},{isActive:!W&&!z&&X!==null}),W)return b.jsxDEV(_,{flexDirection:"column",paddingX:2,paddingY:1,children:[b.jsxDEV(O,{bold:!0,color:"cyan",children:"步骤 2/2: Model 选择"},void 0,!1,void 0,this),b.jsxDEV(_,{marginTop:1,children:b.jsxDEV(O,{color:"gray",children:"加载模型列表中..."},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(z)return b.jsxDEV(_,{flexDirection:"column",paddingX:2,paddingY:1,children:[b.jsxDEV(O,{bold:!0,color:"cyan",children:"步骤 2/2: Model 选择"},void 0,!1,void 0,this),b.jsxDEV(_,{marginTop:1,children:b.jsxDEV(O,{color:"red",children:["加载失败: ",z.message]},void 0,!0,void 0,this)},void 0,!1,void 0,this),b.jsxDEV(_,{marginTop:1,children:b.jsxDEV(O,{color:"gray",dimColor:!0,children:["按 ",b.jsxDEV(O,{color:"cyan",children:"Esc"},void 0,!1,void 0,this)," 返回上一步"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return b.jsxDEV(_,{flexDirection:"column",width:"100%",children:[b.jsxDEV(_,{paddingX:2,paddingY:1,children:[b.jsxDEV(O,{bold:!0,color:"cyan",children:"步骤 2/2: Model 选择"},void 0,!1,void 0,this),K&&b.jsxDEV(O,{dimColor:!0,children:[" ","- ",K.id," (",K.type,")"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),b.jsxDEV(_,{flexDirection:"column",paddingX:2,gap:0,children:U.map((G,F)=>b.jsxDEV(_,{marginBottom:0,gap:1,children:[b.jsxDEV(O,{color:F===Q?"cyan":"gray",bold:F===Q,children:F===Q?">":" "},void 0,!1,void 0,this),b.jsxDEV(O,{bold:F===Q,color:F===Q?"cyan":void 0,children:G.id},void 0,!1,void 0,this),G.name!==G.id&&b.jsxDEV(O,{dimColor:F!==Q,children:["(",G.name,")"]},void 0,!0,void 0,this)]},G.id,!0,void 0,this))},void 0,!1,void 0,this),b.jsxDEV(_,{marginTop:1,paddingX:2,children:b.jsxDEV(O,{color:"gray",dimColor:!0,children:[b.jsxDEV(O,{color:"cyan",children:"↑↓"},void 0,!1,void 0,this)," 导航 ",b.jsxDEV(O,{color:"cyan",children:"Enter/Space"},void 0,!1,void 0,this)," 确认"," ",b.jsxDEV(O,{color:"cyan",children:"Esc/B"},void 0,!1,void 0,this)," 返回"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},w5=i$;var H0=P(I(),1),o$=({children:Z})=>{let{extraParams:Y,toggleCompactMode:X,config:J}=UZ(),{setTools:Q,loading:$}=WZ(),{hasPendingInteractions:K}=xZ();v8({tools:N5,setTools:Q});let{needsSetup:U,validation:W}=E8({config:J});T8({shouldFocus:!$});let z=f8(),{isChatView:H}=z,{handleExecuteTask:G}=j8({closePanel:z.closePanel});if(uZ((M,N)=>{if(N.ctrl&&M==="o"&&H&&!$)X();else if(N.ctrl&&M==="z"&&globalThis.Bun)import("v8").then((w)=>{w.writeHeapSnapshot("my-application.heapsnapshot")})},{isActive:H}),U&&W)return H0.jsxDEV(r,{name:"SetupWizard",fallback:null,children:H0.jsxDEV(w5,{validation:W,onComplete:z.closePanel},void 0,!1,void 0,this)},void 0,!1,void 0,this);let F={activeView:z.activeView,isChatView:z.isChatView,switchToHistory:z.switchToHistory,switchToKnowledge:z.switchToKnowledge,switchToSettings:z.switchToSettings,switchToModelProvider:z.switchToModelProvider,switchToAgent:z.switchToAgent,switchToTask:z.switchToTask,switchToMcp:z.switchToMcp,switchToProcess:z.switchToProcess,closePanel:z.closePanel,handleExecuteTask:G,hasPendingInteractions:K};return H0.jsxDEV(r,{name:"ChatPanelContext",fallback:null,children:H0.jsxDEV(y8,{value:F,children:Z},void 0,!1,void 0,this)},void 0,!1,void 0,this)},B5=({children:Z})=>{return H0.jsxDEV(o$,{children:Z},void 0,!1,void 0,this)};var H1=P(g(),1);var kY=P(g(),1);var w4=P(I(),1),n$=({content:Z,messageNumber:Y})=>{let X=t0(),J=()=>{if(typeof Z==="string")return w4.jsxDEV(O,{color:"white",children:Z},void 0,!1,void 0,this);if(Array.isArray(Z))return Z.filter((Q)=>Q.type==="text").map((Q,$)=>w4.jsxDEV(O,{color:"white",children:Q.text},void 0,!1,void 0,this));return w4.jsxDEV(O,{color:"white",children:JSON.stringify(Z)},void 0,!1,void 0,this)};return w4.jsxDEV(_,{flexDirection:"column",children:[w4.jsxDEV(_,{children:w4.jsxDEV(O,{color:c4("amber"),children:[Y," ",X]},void 0,!0,void 0,this)},void 0,!1,void 0,this),w4.jsxDEV(_,{children:w4.jsxDEV(O,{color:"gray",children:["└─ ",J()]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},e0=n$;var E=P(RW(),1);function zX(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var r4=zX();function D5(Z){r4=Z}var R0={exec:()=>null};function p(Z,Y=""){let X=typeof Z=="string"?Z:Z.source,J={replace:(Q,$)=>{let K=typeof $=="string"?$:$.source;return K=K.replace(RZ.caret,"$1"),X=X.replace(Q,K),J},getRegex:()=>new RegExp(X,Y)};return J}var a$=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),RZ={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:(Z)=>new RegExp(`^( {0,3}${Z})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:(Z)=>new RegExp(`^ {0,${Math.min(3,Z-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:(Z)=>new RegExp(`^ {0,${Math.min(3,Z-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:(Z)=>new RegExp(`^ {0,${Math.min(3,Z-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:(Z)=>new RegExp(`^ {0,${Math.min(3,Z-1)}}#`),htmlBeginRegex:(Z)=>new RegExp(`^ {0,${Math.min(3,Z-1)}}<(?:[a-z].*>|!--)`,"i")},s$=/^(?:[ \t]*(?:\n|$))+/,t$=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,e$=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,C0=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,ZK=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,HX=/(?:[*+-]|\d{1,9}[.)])/,V5=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,E5=p(V5).replace(/bull/g,HX).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),YK=p(V5).replace(/bull/g,HX).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),GX=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,XK=/^[^\n]+/,OX=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,JK=p(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",OX).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),QK=p(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,HX).getRegex(),QY="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",qX=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,$K=p("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$))","i").replace("comment",qX).replace("tag",QY).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),b5=p(GX).replace("hr",C0).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",QY).getRegex(),KK=p(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",b5).getRegex(),FX={blockquote:KK,code:t$,def:JK,fences:e$,heading:ZK,hr:C0,html:$K,lheading:E5,list:QK,newline:s$,paragraph:b5,table:R0,text:XK},L5=p("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",C0).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3}\t)[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",QY).getRegex(),WK={...FX,lheading:YK,table:L5,paragraph:p(GX).replace("hr",C0).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",L5).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",QY).getRegex()},UK={...FX,html:p(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",qX).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:R0,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:p(GX).replace("hr",C0).replace("heading",` *#{1,6} *[^
73
- ]`).replace("lheading",E5).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},zK=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,HK=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,T5=/^( {2,}|\\)\n(?!\s*$)/,GK=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,$Y=/[\p{P}\p{S}]/u,MX=/[\s\p{P}\p{S}]/u,f5=/[^\s\p{P}\p{S}]/u,OK=p(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,MX).getRegex(),j5=/(?!~)[\p{P}\p{S}]/u,qK=/(?!~)[\s\p{P}\p{S}]/u,FK=/(?:[^\s\p{P}\p{S}]|~)/u,MK=p(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",a$?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),S5=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,NK=p(S5,"u").replace(/punct/g,$Y).getRegex(),_K=p(S5,"u").replace(/punct/g,j5).getRegex(),y5="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",AK=p(y5,"gu").replace(/notPunctSpace/g,f5).replace(/punctSpace/g,MX).replace(/punct/g,$Y).getRegex(),wK=p(y5,"gu").replace(/notPunctSpace/g,FK).replace(/punctSpace/g,qK).replace(/punct/g,j5).getRegex(),BK=p("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,f5).replace(/punctSpace/g,MX).replace(/punct/g,$Y).getRegex(),LK=p(/\\(punct)/,"gu").replace(/punct/g,$Y).getRegex(),PK=p(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),RK=p(qX).replace("(?:-->|$)","-->").getRegex(),CK=p("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",RK).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),YY=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,IK=p(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",YY).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),k5=p(/^!?\[(label)\]\[(ref)\]/).replace("label",YY).replace("ref",OX).getRegex(),h5=p(/^!?\[(ref)\](?:\[\])?/).replace("ref",OX).getRegex(),vK=p("reflink|nolink(?!\\()","g").replace("reflink",k5).replace("nolink",h5).getRegex(),P5=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,NX={_backpedal:R0,anyPunctuation:LK,autolink:PK,blockSkip:MK,br:T5,code:HK,del:R0,emStrongLDelim:NK,emStrongRDelimAst:AK,emStrongRDelimUnd:BK,escape:zK,link:IK,nolink:h5,punctuation:OK,reflink:k5,reflinkSearch:vK,tag:CK,text:GK,url:R0},DK={...NX,link:p(/^!?\[(label)\]\((.*?)\)/).replace("label",YY).getRegex(),reflink:p(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",YY).getRegex()},UX={...NX,emStrongRDelimAst:wK,emStrongLDelim:_K,url:p(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",P5).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:p(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",P5).getRegex()},VK={...UX,br:p(T5).replace("{2,}","*").getRegex(),text:p(UX.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ZY={normal:FX,gfm:WK,pedantic:UK},B0={normal:NX,gfm:UX,breaks:VK,pedantic:DK},EK={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},R5=(Z)=>EK[Z];function q4(Z,Y){if(Y){if(RZ.escapeTest.test(Z))return Z.replace(RZ.escapeReplace,R5)}else if(RZ.escapeTestNoEncode.test(Z))return Z.replace(RZ.escapeReplaceNoEncode,R5);return Z}function C5(Z){try{Z=encodeURI(Z).replace(RZ.percentDecode,"%")}catch{return null}return Z}function I5(Z,Y){let X=Z.replace(RZ.findPipe,($,K,U)=>{let W=!1,z=K;for(;--z>=0&&U[z]==="\\";)W=!W;return W?"|":" |"}),J=X.split(RZ.splitPipe),Q=0;if(J[0].trim()||J.shift(),J.length>0&&!J.at(-1)?.trim()&&J.pop(),Y)if(J.length>Y)J.splice(Y);else for(;J.length<Y;)J.push("");for(;Q<J.length;Q++)J[Q]=J[Q].trim().replace(RZ.slashPipe,"|");return J}function L0(Z,Y,X){let J=Z.length;if(J===0)return"";let Q=0;for(;Q<J;){let $=Z.charAt(J-Q-1);if($===Y&&!X)Q++;else if($!==Y&&X)Q++;else break}return Z.slice(0,J-Q)}function bK(Z,Y){if(Z.indexOf(Y[1])===-1)return-1;let X=0;for(let J=0;J<Z.length;J++)if(Z[J]==="\\")J++;else if(Z[J]===Y[0])X++;else if(Z[J]===Y[1]&&(X--,X<0))return J;return X>0?-2:-1}function v5(Z,Y,X,J,Q){let $=Y.href,K=Y.title||null,U=Z[1].replace(Q.other.outputLinkReplace,"$1");J.state.inLink=!0;let W={type:Z[0].charAt(0)==="!"?"image":"link",raw:X,href:$,title:K,text:U,tokens:J.inlineTokens(U)};return J.state.inLink=!1,W}function TK(Z,Y,X){let J=Z.match(X.other.indentCodeCompensation);if(J===null)return Y;let Q=J[1];return Y.split(`
74
- `).map(($)=>{let K=$.match(X.other.beginningSpace);if(K===null)return $;let[U]=K;return U.length>=Q.length?$.slice(Q.length):$}).join(`
75
- `)}var XY=class{options;rules;lexer;constructor(Z){this.options=Z||r4}space(Z){let Y=this.rules.block.newline.exec(Z);if(Y&&Y[0].length>0)return{type:"space",raw:Y[0]}}code(Z){let Y=this.rules.block.code.exec(Z);if(Y){let X=Y[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:Y[0],codeBlockStyle:"indented",text:this.options.pedantic?X:L0(X,`
76
- `)}}}fences(Z){let Y=this.rules.block.fences.exec(Z);if(Y){let X=Y[0],J=TK(X,Y[3]||"",this.rules);return{type:"code",raw:X,lang:Y[2]?Y[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):Y[2],text:J}}}heading(Z){let Y=this.rules.block.heading.exec(Z);if(Y){let X=Y[2].trim();if(this.rules.other.endingHash.test(X)){let J=L0(X,"#");(this.options.pedantic||!J||this.rules.other.endingSpaceChar.test(J))&&(X=J.trim())}return{type:"heading",raw:Y[0],depth:Y[1].length,text:X,tokens:this.lexer.inline(X)}}}hr(Z){let Y=this.rules.block.hr.exec(Z);if(Y)return{type:"hr",raw:L0(Y[0],`
77
- `)}}blockquote(Z){let Y=this.rules.block.blockquote.exec(Z);if(Y){let X=L0(Y[0],`
72
+ - 适合批量执行 MCP 相关操作`,parameters:PX.shape,handler:n.waitForUIDone,render($){let Z=$.getInputRepaired(),Y=$.output,J=null;try{J=JSON.parse(Y)}catch(X){}return A1.jsxDEV(U,{flexDirection:"column",children:[A1.jsxDEV(U,{children:A1.jsxDEV(Q,{color:"blue",bold:!0,children:"execute_mcp_tool"},void 0,!1,void 0,this)},void 0,!1,void 0,this),Z?.commands&&Z.commands.length>0&&A1.jsxDEV(U,{flexDirection:"column",marginTop:1,children:[A1.jsxDEV(Q,{color:"gray",dimColor:!0,children:["执行 ",Z.commands.length," 个 MCP 工具:"]},void 0,!0,void 0,this),Z.commands.map((X,K)=>A1.jsxDEV(U,{marginLeft:2,children:[A1.jsxDEV(Q,{color:"yellow",children:[K+1,"."]},void 0,!0,void 0,this),A1.jsxDEV(Q,{color:"cyan",children:X.name},void 0,!1,void 0,this)]},K,!0,void 0,this))]},void 0,!0,void 0,this),J?.results&&A1.jsxDEV(U,{flexDirection:"column",marginTop:1,children:J.results.map((X,K)=>A1.jsxDEV(U,{marginLeft:2,children:X.error?A1.jsxDEV(Q,{color:"red",children:["✗ ",X.tool]},void 0,!0,void 0,this):A1.jsxDEV(Q,{color:"green",children:["✓ ",X.tool]},void 0,!0,void 0,this)},K,!1,void 0,this))},void 0,!1,void 0,this),Y&&A1.jsxDEV(g$,{content:Y,maxLines:10,borderColor:"gray"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}});var r1=A(q(),1);import{z as m$}from"zod";var CX=m$.object({task_id:m$.string().optional().describe("The task id to ask the subagent"),subagent_id:m$.string().describe("The id of subagent to use"),subagent_type:m$.string().describe("The type of subagent to use (general-purpose, statusline-setup, output-style-setup)"),task_description:m$.string().describe("Describe what you want the subagent to do"),data_transfer:m$.any().optional().describe("Data to transfer to the subagent")}),SX=({tool:$})=>{let Z=$.getInputRepaired();return r1.jsxDEV(U,{paddingX:1,flexDirection:"column",children:r1.jsxDEV(U,{children:[r1.jsxDEV(Q,{color:"yellow",children:"Task "},void 0,!1,void 0,this),r1.jsxDEV(Q,{dimColor:!0,children:"("},void 0,!1,void 0,this),r1.jsxDEV(Q,{color:"cyan",children:Z.subagent_id},void 0,!1,void 0,this),r1.jsxDEV(Q,{dimColor:!0,children:")"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},IX=({tool:$})=>{let Z=$.getInputRepaired(),Y=$.output;return r1.jsxDEV(U,{flexDirection:"column",children:r1.jsxDEV(SX,{tool:$},void 0,!1,void 0,this)},void 0,!1,void 0,this)},S2=i({name:"task",description:"Launch a subagent to handle complex tasks autonomously",parameters:CX.shape,handler:n.waitForUIDone,render($){return r1.jsxDEV(IX,{tool:$},void 0,!1,void 0,this)}});var I2=[O2,Q2,H2,L2,w2,q2,b2,R2,f2,P2,C2,S2];var r=A(h(),1);var R=A(q(),1),vX=({validation:$,onComplete:Z})=>{let{config:Y,updateConfig:J}=Z1(),[X,K]=r.useState("welcome"),[W,O]=r.useState(!1),[_,G]=r.useState(null),[N,z]=r.useState(0),[F,L]=r.useState(null),w=r.useRef(!0),M=r.useRef([]),b=r.useRef(N),f=Y?.providers||[];r.useEffect(()=>{M.current=f},[f]),r.useEffect(()=>{b.current=N},[N]);let k=f[N],g=r.useCallback(()=>L(null),[]);M1(g,F?3000:null);let p=r.useCallback(()=>{w.current=!0,G(null),O(!0),L(null)},[]),o=r.useCallback(()=>{let D=M.current,l=b.current,x=D[l];if(!x)return;w.current=!1,G(x),O(!0),L(null)},[]),S=r.useCallback(()=>{O(!1),G(null),L(null)},[]),t=r.useCallback(async(D)=>{let l=M.current,x=w.current,A$=x?[...l,D]:l.map((w$)=>w$.id===D.id?D:w$);if(await J({providers:A$}),L(x?`已添加 Provider: ${D.id}`:`已更新 Provider: ${D.id}`),x){let w$=A$.findIndex((w0)=>w0.id===D.id);z(w$>=0?w$:0)}S()},[J,S]),c=r.useCallback(()=>{if(!k||!k.apiKey){L("请先配置 Provider 的 API Key");return}J({provider_id:k.id,provider_type:k.type}).then(()=>{K("model")})},[k,J]);if(S1((D,l)=>{if(l.return||D===" ")K("provider")},{isActive:X==="welcome"}),S1((D,l)=>{if(W)return;if(l.upArrow)z((x)=>x>0?x-1:f.length-1);else if(l.downArrow)z((x)=>x<f.length-1?x+1:0);else if(D==="n"||D==="N")p();else if((D==="e"||D==="E"||l.return)&&k)o();else if(D==="s"||D==="S")c()},{isActive:X==="provider"}),X==="welcome")return R.jsxDEV(U,{flexDirection:"column",paddingX:2,paddingY:1,width:"100%",children:[R.jsxDEV(U,{marginBottom:1,children:R.jsxDEV(Q,{bold:!0,color:"cyan",children:"欢迎使用 Zen Code"},void 0,!1,void 0,this)},void 0,!1,void 0,this),R.jsxDEV(U,{marginBottom:1,children:R.jsxDEV(Q,{color:"yellow",children:$.reason||"需要进行初始配置"},void 0,!1,void 0,this)},void 0,!1,void 0,this),R.jsxDEV(U,{flexDirection:"column",marginBottom:1,children:[R.jsxDEV(Q,{dimColor:!0,children:"接下来将引导你完成:"},void 0,!1,void 0,this),R.jsxDEV(Q,{dimColor:!0,children:" 1. 配置 Provider(API 服务提供商)"},void 0,!1,void 0,this),R.jsxDEV(Q,{dimColor:!0,children:" 2. 选择 Model(AI 模型)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),R.jsxDEV(U,{children:R.jsxDEV(Q,{color:"green",bold:!0,children:"按 Enter 开始配置"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(X==="provider")return R.jsxDEV(U,{flexDirection:"column",width:"100%",children:[R.jsxDEV(U,{paddingX:2,paddingY:1,children:R.jsxDEV(Q,{bold:!0,color:"cyan",children:"步骤 1/2: Provider 配置"},void 0,!1,void 0,this)},void 0,!1,void 0,this),W?R.jsxDEV(k2,{provider:_||void 0,onCancel:S,onSave:t},void 0,!1,void 0,this):R.jsxDEV(R.Fragment,{children:R.jsxDEV(U,{flexDirection:"column",paddingX:2,gap:1,children:[f.length===0?R.jsxDEV(U,{paddingY:1,children:R.jsxDEV(Q,{color:"yellow",children:"未配置任何 Provider,请按 'n' 新增"},void 0,!1,void 0,this)},void 0,!1,void 0,this):f.map((D,l)=>{let x=!!D.apiKey,A$=x?"green":"yellow";return R.jsxDEV(U,{marginBottom:0,gap:1,children:[R.jsxDEV(Q,{color:l===N?"cyan":"gray",bold:l===N,children:l===N?">":" "},void 0,!1,void 0,this),R.jsxDEV(Q,{bold:l===N,color:l===N?"cyan":void 0,children:D.id},void 0,!1,void 0,this),R.jsxDEV(Q,{color:"gray",dimColor:l!==N,children:[" ",D.type]},void 0,!0,void 0,this),R.jsxDEV(Q,{color:A$,dimColor:l!==N,children:[" ","[",x?"已配置":"未配置","]"]},void 0,!0,void 0,this)]},D.id,!0,void 0,this)}),R.jsxDEV(U,{marginTop:1,children:[R.jsxDEV(Q,{color:"gray",dimColor:!0,children:[R.jsxDEV(Q,{color:"cyan",children:"↑↓"},void 0,!1,void 0,this)," 导航 ",R.jsxDEV(Q,{color:"cyan",children:"n"},void 0,!1,void 0,this)," 新增"," ",R.jsxDEV(Q,{color:"cyan",children:"e/Enter"},void 0,!1,void 0,this)," 编辑"," "]},void 0,!0,void 0,this),f.some((D)=>D.apiKey)&&R.jsxDEV(Q,{children:[R.jsxDEV(Q,{color:"green",children:"s"},void 0,!1,void 0,this)," 下一步"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),F&&R.jsxDEV(U,{paddingX:2,paddingY:0,children:R.jsxDEV(Q,{color:"green",children:F},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(X==="model")return R.jsxDEV(kX,{onComplete:Z,onBack:()=>K("provider")},void 0,!1,void 0,this);return null},kX=({onComplete:$,onBack:Z})=>{let{config:Y,updateConfig:J}=Z1(),[X,K]=r.useState(0),W=r.useMemo(()=>{return Y?.providers.find((z)=>z.id===Y.provider_id)||null},[Y?.providers,Y?.provider_id]),{data:O=[],isLoading:_,error:G}=v2({provider:W,enabled:!!W?.apiKey}),N=O[X];if(S1((z,F)=>{if(F.upArrow)K((L)=>L>0?L-1:O.length-1);else if(F.downArrow)K((L)=>L<O.length-1?L+1:0);else if(F.escape||z==="b"||z==="B")Z();else if((F.return||z===" ")&&N)J({model_id:N.id}).then(()=>{$()})},{isActive:!_&&!G&&Y!==null}),_)return R.jsxDEV(U,{flexDirection:"column",paddingX:2,paddingY:1,children:[R.jsxDEV(Q,{bold:!0,color:"cyan",children:"步骤 2/2: Model 选择"},void 0,!1,void 0,this),R.jsxDEV(U,{marginTop:1,children:R.jsxDEV(Q,{color:"gray",children:"加载模型列表中..."},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(G)return R.jsxDEV(U,{flexDirection:"column",paddingX:2,paddingY:1,children:[R.jsxDEV(Q,{bold:!0,color:"cyan",children:"步骤 2/2: Model 选择"},void 0,!1,void 0,this),R.jsxDEV(U,{marginTop:1,children:R.jsxDEV(Q,{color:"red",children:["加载失败: ",G.message]},void 0,!0,void 0,this)},void 0,!1,void 0,this),R.jsxDEV(U,{marginTop:1,children:R.jsxDEV(Q,{color:"gray",dimColor:!0,children:["按 ",R.jsxDEV(Q,{color:"cyan",children:"Esc"},void 0,!1,void 0,this)," 返回上一步"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return R.jsxDEV(U,{flexDirection:"column",width:"100%",children:[R.jsxDEV(U,{paddingX:2,paddingY:1,children:[R.jsxDEV(Q,{bold:!0,color:"cyan",children:"步骤 2/2: Model 选择"},void 0,!1,void 0,this),W&&R.jsxDEV(Q,{dimColor:!0,children:[" ","- ",W.id," (",W.type,")"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),R.jsxDEV(U,{flexDirection:"column",paddingX:2,gap:0,children:O.map((z,F)=>R.jsxDEV(U,{marginBottom:0,gap:1,children:[R.jsxDEV(Q,{color:F===X?"cyan":"gray",bold:F===X,children:F===X?">":" "},void 0,!1,void 0,this),R.jsxDEV(Q,{bold:F===X,color:F===X?"cyan":void 0,children:z.id},void 0,!1,void 0,this),z.name!==z.id&&R.jsxDEV(Q,{dimColor:F!==X,children:["(",z.name,")"]},void 0,!0,void 0,this)]},z.id,!0,void 0,this))},void 0,!1,void 0,this),R.jsxDEV(U,{marginTop:1,paddingX:2,children:R.jsxDEV(Q,{color:"gray",dimColor:!0,children:[R.jsxDEV(Q,{color:"cyan",children:"↑↓"},void 0,!1,void 0,this)," 导航 ",R.jsxDEV(Q,{color:"cyan",children:"Enter/Space"},void 0,!1,void 0,this)," 确认"," ",R.jsxDEV(Q,{color:"cyan",children:"Esc/B"},void 0,!1,void 0,this)," 返回"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},T2=vX;var c$=A(q(),1),TX=({children:$})=>{let{extraParams:Z,toggleCompactMode:Y,config:J}=Z1(),{setTools:X,loading:K}=$1(),{hasPendingInteractions:W}=P1();g0({tools:I2,setTools:X});let{needsSetup:O,validation:_}=c0({config:J});x0({shouldFocus:!K});let G=d0(),{isChatView:N}=G,{handleExecuteTask:z}=l0({closePanel:G.closePanel});if(S1((L,w)=>{if(w.ctrl&&L==="o"&&N&&!K)Y();else if(w.ctrl&&L==="z"&&globalThis.Bun)import("v8").then((M)=>{M.writeHeapSnapshot("my-application.heapsnapshot")})},{isActive:N}),O&&_)return c$.jsxDEV(m,{name:"SetupWizard",fallback:null,children:c$.jsxDEV(T2,{validation:_,onComplete:G.closePanel},void 0,!1,void 0,this)},void 0,!1,void 0,this);let F={activeView:G.activeView,isChatView:G.isChatView,switchToHistory:G.switchToHistory,switchToKnowledge:G.switchToKnowledge,switchToSettings:G.switchToSettings,switchToModelProvider:G.switchToModelProvider,switchToAgent:G.switchToAgent,switchToTask:G.switchToTask,switchToMcp:G.switchToMcp,switchToProcess:G.switchToProcess,closePanel:G.closePanel,handleExecuteTask:z,hasPendingInteractions:W};return c$.jsxDEV(m,{name:"ChatPanelContext",fallback:null,children:c$.jsxDEV(o0,{value:F,children:$},void 0,!1,void 0,this)},void 0,!1,void 0,this)},y2=({children:$})=>{return c$.jsxDEV(TX,{children:$},void 0,!1,void 0,this)};var o4=A(h(),1);var PZ=A(h(),1);var Y$=A(q(),1),yX=({content:$,messageNumber:Z})=>{let Y=HZ(),J=()=>{if(typeof $==="string")return Y$.jsxDEV(Q,{color:"white",children:$},void 0,!1,void 0,this);if(Array.isArray($))return $.filter((X)=>X.type==="text").map((X,K)=>Y$.jsxDEV(Q,{color:"white",children:X.text},void 0,!1,void 0,this));return Y$.jsxDEV(Q,{color:"white",children:JSON.stringify($)},void 0,!1,void 0,this)};return Y$.jsxDEV(U,{flexDirection:"column",children:[Y$.jsxDEV(U,{children:Y$.jsxDEV(Q,{color:P$("amber"),children:[Z," ",Y]},void 0,!0,void 0,this)},void 0,!1,void 0,this),Y$.jsxDEV(U,{children:Y$.jsxDEV(Q,{color:"gray",children:["└─ ",J()]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},FZ=yX;var B=A(L5(),1);function tZ(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var I$=tZ();function p2($){I$=$}var t$={exec:()=>null};function j($,Z=""){let Y=typeof $=="string"?$:$.source,J={replace:(X,K)=>{let W=typeof K=="string"?K:K.source;return W=W.replace(U1.caret,"$1"),Y=Y.replace(X,W),J},getRegex:()=>new RegExp(Y,Z)};return J}var hX=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),U1={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:($)=>new RegExp(`^( {0,3}${$})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:($)=>new RegExp(`^ {0,${Math.min(3,$-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:($)=>new RegExp(`^ {0,${Math.min(3,$-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:($)=>new RegExp(`^ {0,${Math.min(3,$-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:($)=>new RegExp(`^ {0,${Math.min(3,$-1)}}#`),htmlBeginRegex:($)=>new RegExp(`^ {0,${Math.min(3,$-1)}}<(?:[a-z].*>|!--)`,"i")},DX=/^(?:[ \t]*(?:\n|$))+/,VX=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,jX=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,e$=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,EX=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,eZ=/(?:[*+-]|\d{1,9}[.)])/,m2=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,c2=j(m2).replace(/bull/g,eZ).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),gX=j(m2).replace(/bull/g,eZ).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),$0=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,pX=/^[^\n]+/,Z0=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,mX=j(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Z0).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),cX=j(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,eZ).getRegex(),qZ="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Y0=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,uX=j("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$))","i").replace("comment",Y0).replace("tag",qZ).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),u2=j($0).replace("hr",e$).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",qZ).getRegex(),xX=j(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",u2).getRegex(),X0={blockquote:xX,code:VX,def:mX,fences:jX,heading:EX,hr:e$,html:uX,lheading:c2,list:cX,newline:DX,paragraph:u2,table:t$,text:pX},h2=j("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",e$).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3}\t)[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",qZ).getRegex(),dX={...X0,lheading:gX,table:h2,paragraph:j($0).replace("hr",e$).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",h2).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",qZ).getRegex()},lX={...X0,html:j(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Y0).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:t$,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:j($0).replace("hr",e$).replace("heading",` *#{1,6} *[^
73
+ ]`).replace("lheading",c2).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},iX=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,oX=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,x2=/^( {2,}|\\)\n(?!\s*$)/,rX=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,bZ=/[\p{P}\p{S}]/u,J0=/[\s\p{P}\p{S}]/u,d2=/[^\s\p{P}\p{S}]/u,nX=j(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,J0).getRegex(),l2=/(?!~)[\p{P}\p{S}]/u,aX=/(?!~)[\s\p{P}\p{S}]/u,sX=/(?:[^\s\p{P}\p{S}]|~)/u,tX=j(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",hX?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),i2=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,eX=j(i2,"u").replace(/punct/g,bZ).getRegex(),$5=j(i2,"u").replace(/punct/g,l2).getRegex(),o2="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Z5=j(o2,"gu").replace(/notPunctSpace/g,d2).replace(/punctSpace/g,J0).replace(/punct/g,bZ).getRegex(),Y5=j(o2,"gu").replace(/notPunctSpace/g,sX).replace(/punctSpace/g,aX).replace(/punct/g,l2).getRegex(),X5=j("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,d2).replace(/punctSpace/g,J0).replace(/punct/g,bZ).getRegex(),J5=j(/\\(punct)/,"gu").replace(/punct/g,bZ).getRegex(),K5=j(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),W5=j(Y0).replace("(?:-->|$)","-->").getRegex(),Q5=j("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",W5).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),AZ=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,_5=j(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",AZ).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),r2=j(/^!?\[(label)\]\[(ref)\]/).replace("label",AZ).replace("ref",Z0).getRegex(),n2=j(/^!?\[(ref)\](?:\[\])?/).replace("ref",Z0).getRegex(),O5=j("reflink|nolink(?!\\()","g").replace("reflink",r2).replace("nolink",n2).getRegex(),D2=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,K0={_backpedal:t$,anyPunctuation:J5,autolink:K5,blockSkip:tX,br:x2,code:oX,del:t$,emStrongLDelim:eX,emStrongRDelimAst:Z5,emStrongRDelimUnd:X5,escape:iX,link:_5,nolink:n2,punctuation:nX,reflink:r2,reflinkSearch:O5,tag:Q5,text:rX,url:t$},G5={...K0,link:j(/^!?\[(label)\]\((.*?)\)/).replace("label",AZ).getRegex(),reflink:j(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",AZ).getRegex()},sZ={...K0,emStrongRDelimAst:Y5,emStrongLDelim:$5,url:j(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",D2).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:j(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",D2).getRegex()},U5={...sZ,br:j(x2).replace("{2,}","*").getRegex(),text:j(sZ.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},LZ={normal:X0,gfm:dX,pedantic:lX},n$={normal:K0,gfm:sZ,breaks:U5,pedantic:G5},z5={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},V2=($)=>z5[$];function n1($,Z){if(Z){if(U1.escapeTest.test($))return $.replace(U1.escapeReplace,V2)}else if(U1.escapeTestNoEncode.test($))return $.replace(U1.escapeReplaceNoEncode,V2);return $}function j2($){try{$=encodeURI($).replace(U1.percentDecode,"%")}catch{return null}return $}function E2($,Z){let Y=$.replace(U1.findPipe,(K,W,O)=>{let _=!1,G=W;for(;--G>=0&&O[G]==="\\";)_=!_;return _?"|":" |"}),J=Y.split(U1.splitPipe),X=0;if(J[0].trim()||J.shift(),J.length>0&&!J.at(-1)?.trim()&&J.pop(),Z)if(J.length>Z)J.splice(Z);else for(;J.length<Z;)J.push("");for(;X<J.length;X++)J[X]=J[X].trim().replace(U1.slashPipe,"|");return J}function a$($,Z,Y){let J=$.length;if(J===0)return"";let X=0;for(;X<J;){let K=$.charAt(J-X-1);if(K===Z&&!Y)X++;else if(K!==Z&&Y)X++;else break}return $.slice(0,J-X)}function N5($,Z){if($.indexOf(Z[1])===-1)return-1;let Y=0;for(let J=0;J<$.length;J++)if($[J]==="\\")J++;else if($[J]===Z[0])Y++;else if($[J]===Z[1]&&(Y--,Y<0))return J;return Y>0?-2:-1}function g2($,Z,Y,J,X){let K=Z.href,W=Z.title||null,O=$[1].replace(X.other.outputLinkReplace,"$1");J.state.inLink=!0;let _={type:$[0].charAt(0)==="!"?"image":"link",raw:Y,href:K,title:W,text:O,tokens:J.inlineTokens(O)};return J.state.inLink=!1,_}function H5($,Z,Y){let J=$.match(Y.other.indentCodeCompensation);if(J===null)return Z;let X=J[1];return Z.split(`
74
+ `).map((K)=>{let W=K.match(Y.other.beginningSpace);if(W===null)return K;let[O]=W;return O.length>=X.length?K.slice(X.length):K}).join(`
75
+ `)}var wZ=class{options;rules;lexer;constructor($){this.options=$||I$}space($){let Z=this.rules.block.newline.exec($);if(Z&&Z[0].length>0)return{type:"space",raw:Z[0]}}code($){let Z=this.rules.block.code.exec($);if(Z){let Y=Z[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:Z[0],codeBlockStyle:"indented",text:this.options.pedantic?Y:a$(Y,`
76
+ `)}}}fences($){let Z=this.rules.block.fences.exec($);if(Z){let Y=Z[0],J=H5(Y,Z[3]||"",this.rules);return{type:"code",raw:Y,lang:Z[2]?Z[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):Z[2],text:J}}}heading($){let Z=this.rules.block.heading.exec($);if(Z){let Y=Z[2].trim();if(this.rules.other.endingHash.test(Y)){let J=a$(Y,"#");(this.options.pedantic||!J||this.rules.other.endingSpaceChar.test(J))&&(Y=J.trim())}return{type:"heading",raw:Z[0],depth:Z[1].length,text:Y,tokens:this.lexer.inline(Y)}}}hr($){let Z=this.rules.block.hr.exec($);if(Z)return{type:"hr",raw:a$(Z[0],`
77
+ `)}}blockquote($){let Z=this.rules.block.blockquote.exec($);if(Z){let Y=a$(Z[0],`
78
78
  `).split(`
79
- `),J="",Q="",$=[];for(;X.length>0;){let K=!1,U=[],W;for(W=0;W<X.length;W++)if(this.rules.other.blockquoteStart.test(X[W]))U.push(X[W]),K=!0;else if(!K)U.push(X[W]);else break;X=X.slice(W);let z=U.join(`
80
- `),H=z.replace(this.rules.other.blockquoteSetextReplace,`
79
+ `),J="",X="",K=[];for(;Y.length>0;){let W=!1,O=[],_;for(_=0;_<Y.length;_++)if(this.rules.other.blockquoteStart.test(Y[_]))O.push(Y[_]),W=!0;else if(!W)O.push(Y[_]);else break;Y=Y.slice(_);let G=O.join(`
80
+ `),N=G.replace(this.rules.other.blockquoteSetextReplace,`
81
81
  $1`).replace(this.rules.other.blockquoteSetextReplace2,"");J=J?`${J}
82
- ${z}`:z,Q=Q?`${Q}
83
- ${H}`:H;let G=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(H,$,!0),this.lexer.state.top=G,X.length===0)break;let F=$.at(-1);if(F?.type==="code")break;if(F?.type==="blockquote"){let M=F,N=M.raw+`
84
- `+X.join(`
85
- `),w=this.blockquote(N);$[$.length-1]=w,J=J.substring(0,J.length-M.raw.length)+w.raw,Q=Q.substring(0,Q.length-M.text.length)+w.text;break}else if(F?.type==="list"){let M=F,N=M.raw+`
86
- `+X.join(`
87
- `),w=this.list(N);$[$.length-1]=w,J=J.substring(0,J.length-F.raw.length)+w.raw,Q=Q.substring(0,Q.length-M.raw.length)+w.raw,X=N.substring($.at(-1).raw.length).split(`
88
- `);continue}}return{type:"blockquote",raw:J,tokens:$,text:Q}}}list(Z){let Y=this.rules.block.list.exec(Z);if(Y){let X=Y[1].trim(),J=X.length>1,Q={type:"list",raw:"",ordered:J,start:J?+X.slice(0,-1):"",loose:!1,items:[]};X=J?`\\d{1,9}\\${X.slice(-1)}`:`\\${X}`,this.options.pedantic&&(X=J?X:"[*+-]");let $=this.rules.other.listItemRegex(X),K=!1;for(;Z;){let W=!1,z="",H="";if(!(Y=$.exec(Z))||this.rules.block.hr.test(Z))break;z=Y[0],Z=Z.substring(z.length);let G=Y[2].split(`
89
- `,1)[0].replace(this.rules.other.listReplaceTabs,(B)=>" ".repeat(3*B.length)),F=Z.split(`
90
- `,1)[0],M=!G.trim(),N=0;if(this.options.pedantic?(N=2,H=G.trimStart()):M?N=Y[1].length+1:(N=Y[2].search(this.rules.other.nonSpaceChar),N=N>4?1:N,H=G.slice(N),N+=Y[1].length),M&&this.rules.other.blankLine.test(F)&&(z+=F+`
91
- `,Z=Z.substring(F.length+1),W=!0),!W){let B=this.rules.other.nextBulletRegex(N),C=this.rules.other.hrRegex(N),R=this.rules.other.fencesBeginRegex(N),D=this.rules.other.headingBeginRegex(N),f=this.rules.other.htmlBeginRegex(N);for(;Z;){let V=Z.split(`
92
- `,1)[0],d;if(F=V,this.options.pedantic?(F=F.replace(this.rules.other.listReplaceNesting," "),d=F):d=F.replace(this.rules.other.tabCharGlobal," "),R.test(F)||D.test(F)||f.test(F)||B.test(F)||C.test(F))break;if(d.search(this.rules.other.nonSpaceChar)>=N||!F.trim())H+=`
93
- `+d.slice(N);else{if(M||G.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||R.test(G)||D.test(G)||C.test(G))break;H+=`
94
- `+F}!M&&!F.trim()&&(M=!0),z+=V+`
95
- `,Z=Z.substring(V.length+1),G=d.slice(N)}}Q.loose||(K?Q.loose=!0:this.rules.other.doubleBlankLine.test(z)&&(K=!0));let w=null,L;this.options.gfm&&(w=this.rules.other.listIsTask.exec(H),w&&(L=w[0]!=="[ ] ",H=H.replace(this.rules.other.listReplaceTask,""))),Q.items.push({type:"list_item",raw:z,task:!!w,checked:L,loose:!1,text:H,tokens:[]}),Q.raw+=z}let U=Q.items.at(-1);if(U)U.raw=U.raw.trimEnd(),U.text=U.text.trimEnd();else return;Q.raw=Q.raw.trimEnd();for(let W=0;W<Q.items.length;W++)if(this.lexer.state.top=!1,Q.items[W].tokens=this.lexer.blockTokens(Q.items[W].text,[]),!Q.loose){let z=Q.items[W].tokens.filter((G)=>G.type==="space"),H=z.length>0&&z.some((G)=>this.rules.other.anyLine.test(G.raw));Q.loose=H}if(Q.loose)for(let W=0;W<Q.items.length;W++)Q.items[W].loose=!0;return Q}}html(Z){let Y=this.rules.block.html.exec(Z);if(Y)return{type:"html",block:!0,raw:Y[0],pre:Y[1]==="pre"||Y[1]==="script"||Y[1]==="style",text:Y[0]}}def(Z){let Y=this.rules.block.def.exec(Z);if(Y){let X=Y[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),J=Y[2]?Y[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",Q=Y[3]?Y[3].substring(1,Y[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):Y[3];return{type:"def",tag:X,raw:Y[0],href:J,title:Q}}}table(Z){let Y=this.rules.block.table.exec(Z);if(!Y||!this.rules.other.tableDelimiter.test(Y[2]))return;let X=I5(Y[1]),J=Y[2].replace(this.rules.other.tableAlignChars,"").split("|"),Q=Y[3]?.trim()?Y[3].replace(this.rules.other.tableRowBlankLine,"").split(`
96
- `):[],$={type:"table",raw:Y[0],header:[],align:[],rows:[]};if(X.length===J.length){for(let K of J)this.rules.other.tableAlignRight.test(K)?$.align.push("right"):this.rules.other.tableAlignCenter.test(K)?$.align.push("center"):this.rules.other.tableAlignLeft.test(K)?$.align.push("left"):$.align.push(null);for(let K=0;K<X.length;K++)$.header.push({text:X[K],tokens:this.lexer.inline(X[K]),header:!0,align:$.align[K]});for(let K of Q)$.rows.push(I5(K,$.header.length).map((U,W)=>({text:U,tokens:this.lexer.inline(U),header:!1,align:$.align[W]})));return $}}lheading(Z){let Y=this.rules.block.lheading.exec(Z);if(Y)return{type:"heading",raw:Y[0],depth:Y[2].charAt(0)==="="?1:2,text:Y[1],tokens:this.lexer.inline(Y[1])}}paragraph(Z){let Y=this.rules.block.paragraph.exec(Z);if(Y){let X=Y[1].charAt(Y[1].length-1)===`
97
- `?Y[1].slice(0,-1):Y[1];return{type:"paragraph",raw:Y[0],text:X,tokens:this.lexer.inline(X)}}}text(Z){let Y=this.rules.block.text.exec(Z);if(Y)return{type:"text",raw:Y[0],text:Y[0],tokens:this.lexer.inline(Y[0])}}escape(Z){let Y=this.rules.inline.escape.exec(Z);if(Y)return{type:"escape",raw:Y[0],text:Y[1]}}tag(Z){let Y=this.rules.inline.tag.exec(Z);if(Y)return!this.lexer.state.inLink&&this.rules.other.startATag.test(Y[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(Y[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(Y[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(Y[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:Y[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:Y[0]}}link(Z){let Y=this.rules.inline.link.exec(Z);if(Y){let X=Y[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(X)){if(!this.rules.other.endAngleBracket.test(X))return;let $=L0(X.slice(0,-1),"\\");if((X.length-$.length)%2===0)return}else{let $=bK(Y[2],"()");if($===-2)return;if($>-1){let K=(Y[0].indexOf("!")===0?5:4)+Y[1].length+$;Y[2]=Y[2].substring(0,$),Y[0]=Y[0].substring(0,K).trim(),Y[3]=""}}let J=Y[2],Q="";if(this.options.pedantic){let $=this.rules.other.pedanticHrefTitle.exec(J);$&&(J=$[1],Q=$[3])}else Q=Y[3]?Y[3].slice(1,-1):"";return J=J.trim(),this.rules.other.startAngleBracket.test(J)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(X)?J=J.slice(1):J=J.slice(1,-1)),v5(Y,{href:J&&J.replace(this.rules.inline.anyPunctuation,"$1"),title:Q&&Q.replace(this.rules.inline.anyPunctuation,"$1")},Y[0],this.lexer,this.rules)}}reflink(Z,Y){let X;if((X=this.rules.inline.reflink.exec(Z))||(X=this.rules.inline.nolink.exec(Z))){let J=(X[2]||X[1]).replace(this.rules.other.multipleSpaceGlobal," "),Q=Y[J.toLowerCase()];if(!Q){let $=X[0].charAt(0);return{type:"text",raw:$,text:$}}return v5(X,Q,X[0],this.lexer,this.rules)}}emStrong(Z,Y,X=""){let J=this.rules.inline.emStrongLDelim.exec(Z);if(!J||J[3]&&X.match(this.rules.other.unicodeAlphaNumeric))return;if(!(J[1]||J[2])||!X||this.rules.inline.punctuation.exec(X)){let Q=[...J[0]].length-1,$,K,U=Q,W=0,z=J[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(z.lastIndex=0,Y=Y.slice(-1*Z.length+Q);(J=z.exec(Y))!=null;){if($=J[1]||J[2]||J[3]||J[4]||J[5]||J[6],!$)continue;if(K=[...$].length,J[3]||J[4]){U+=K;continue}else if((J[5]||J[6])&&Q%3&&!((Q+K)%3)){W+=K;continue}if(U-=K,U>0)continue;K=Math.min(K,K+U+W);let H=[...J[0]][0].length,G=Z.slice(0,Q+J.index+H+K);if(Math.min(Q,K)%2){let M=G.slice(1,-1);return{type:"em",raw:G,text:M,tokens:this.lexer.inlineTokens(M)}}let F=G.slice(2,-2);return{type:"strong",raw:G,text:F,tokens:this.lexer.inlineTokens(F)}}}}codespan(Z){let Y=this.rules.inline.code.exec(Z);if(Y){let X=Y[2].replace(this.rules.other.newLineCharGlobal," "),J=this.rules.other.nonSpaceChar.test(X),Q=this.rules.other.startingSpaceChar.test(X)&&this.rules.other.endingSpaceChar.test(X);return J&&Q&&(X=X.substring(1,X.length-1)),{type:"codespan",raw:Y[0],text:X}}}br(Z){let Y=this.rules.inline.br.exec(Z);if(Y)return{type:"br",raw:Y[0]}}del(Z){let Y=this.rules.inline.del.exec(Z);if(Y)return{type:"del",raw:Y[0],text:Y[2],tokens:this.lexer.inlineTokens(Y[2])}}autolink(Z){let Y=this.rules.inline.autolink.exec(Z);if(Y){let X,J;return Y[2]==="@"?(X=Y[1],J="mailto:"+X):(X=Y[1],J=X),{type:"link",raw:Y[0],text:X,href:J,tokens:[{type:"text",raw:X,text:X}]}}}url(Z){let Y;if(Y=this.rules.inline.url.exec(Z)){let X,J;if(Y[2]==="@")X=Y[0],J="mailto:"+X;else{let Q;do Q=Y[0],Y[0]=this.rules.inline._backpedal.exec(Y[0])?.[0]??"";while(Q!==Y[0]);X=Y[0],Y[1]==="www."?J="http://"+Y[0]:J=Y[0]}return{type:"link",raw:Y[0],text:X,href:J,tokens:[{type:"text",raw:X,text:X}]}}}inlineText(Z){let Y=this.rules.inline.text.exec(Z);if(Y){let X=this.lexer.state.inRawBlock;return{type:"text",raw:Y[0],text:Y[0],escaped:X}}}},aZ=class Z{tokens;options;state;tokenizer;inlineQueue;constructor(Y){this.tokens=[],this.tokens.links=Object.create(null),this.options=Y||r4,this.options.tokenizer=this.options.tokenizer||new XY,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let X={other:RZ,block:ZY.normal,inline:B0.normal};this.options.pedantic?(X.block=ZY.pedantic,X.inline=B0.pedantic):this.options.gfm&&(X.block=ZY.gfm,this.options.breaks?X.inline=B0.breaks:X.inline=B0.gfm),this.tokenizer.rules=X}static get rules(){return{block:ZY,inline:B0}}static lex(Y,X){return new Z(X).lex(Y)}static lexInline(Y,X){return new Z(X).inlineTokens(Y)}lex(Y){Y=Y.replace(RZ.carriageReturn,`
98
- `),this.blockTokens(Y,this.tokens);for(let X=0;X<this.inlineQueue.length;X++){let J=this.inlineQueue[X];this.inlineTokens(J.src,J.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(Y,X=[],J=!1){for(this.options.pedantic&&(Y=Y.replace(RZ.tabCharGlobal," ").replace(RZ.spaceLine,""));Y;){let Q;if(this.options.extensions?.block?.some((K)=>(Q=K.call({lexer:this},Y,X))?(Y=Y.substring(Q.raw.length),X.push(Q),!0):!1))continue;if(Q=this.tokenizer.space(Y)){Y=Y.substring(Q.raw.length);let K=X.at(-1);Q.raw.length===1&&K!==void 0?K.raw+=`
99
- `:X.push(Q);continue}if(Q=this.tokenizer.code(Y)){Y=Y.substring(Q.raw.length);let K=X.at(-1);K?.type==="paragraph"||K?.type==="text"?(K.raw+=(K.raw.endsWith(`
82
+ ${G}`:G,X=X?`${X}
83
+ ${N}`:N;let z=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(N,K,!0),this.lexer.state.top=z,Y.length===0)break;let F=K.at(-1);if(F?.type==="code")break;if(F?.type==="blockquote"){let L=F,w=L.raw+`
84
+ `+Y.join(`
85
+ `),M=this.blockquote(w);K[K.length-1]=M,J=J.substring(0,J.length-L.raw.length)+M.raw,X=X.substring(0,X.length-L.text.length)+M.text;break}else if(F?.type==="list"){let L=F,w=L.raw+`
86
+ `+Y.join(`
87
+ `),M=this.list(w);K[K.length-1]=M,J=J.substring(0,J.length-F.raw.length)+M.raw,X=X.substring(0,X.length-L.raw.length)+M.raw,Y=w.substring(K.at(-1).raw.length).split(`
88
+ `);continue}}return{type:"blockquote",raw:J,tokens:K,text:X}}}list($){let Z=this.rules.block.list.exec($);if(Z){let Y=Z[1].trim(),J=Y.length>1,X={type:"list",raw:"",ordered:J,start:J?+Y.slice(0,-1):"",loose:!1,items:[]};Y=J?`\\d{1,9}\\${Y.slice(-1)}`:`\\${Y}`,this.options.pedantic&&(Y=J?Y:"[*+-]");let K=this.rules.other.listItemRegex(Y),W=!1;for(;$;){let _=!1,G="",N="";if(!(Z=K.exec($))||this.rules.block.hr.test($))break;G=Z[0],$=$.substring(G.length);let z=Z[2].split(`
89
+ `,1)[0].replace(this.rules.other.listReplaceTabs,(f)=>" ".repeat(3*f.length)),F=$.split(`
90
+ `,1)[0],L=!z.trim(),w=0;if(this.options.pedantic?(w=2,N=z.trimStart()):L?w=Z[1].length+1:(w=Z[2].search(this.rules.other.nonSpaceChar),w=w>4?1:w,N=z.slice(w),w+=Z[1].length),L&&this.rules.other.blankLine.test(F)&&(G+=F+`
91
+ `,$=$.substring(F.length+1),_=!0),!_){let f=this.rules.other.nextBulletRegex(w),k=this.rules.other.hrRegex(w),g=this.rules.other.fencesBeginRegex(w),p=this.rules.other.headingBeginRegex(w),o=this.rules.other.htmlBeginRegex(w);for(;$;){let S=$.split(`
92
+ `,1)[0],t;if(F=S,this.options.pedantic?(F=F.replace(this.rules.other.listReplaceNesting," "),t=F):t=F.replace(this.rules.other.tabCharGlobal," "),g.test(F)||p.test(F)||o.test(F)||f.test(F)||k.test(F))break;if(t.search(this.rules.other.nonSpaceChar)>=w||!F.trim())N+=`
93
+ `+t.slice(w);else{if(L||z.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||g.test(z)||p.test(z)||k.test(z))break;N+=`
94
+ `+F}!L&&!F.trim()&&(L=!0),G+=S+`
95
+ `,$=$.substring(S.length+1),z=t.slice(w)}}X.loose||(W?X.loose=!0:this.rules.other.doubleBlankLine.test(G)&&(W=!0));let M=null,b;this.options.gfm&&(M=this.rules.other.listIsTask.exec(N),M&&(b=M[0]!=="[ ] ",N=N.replace(this.rules.other.listReplaceTask,""))),X.items.push({type:"list_item",raw:G,task:!!M,checked:b,loose:!1,text:N,tokens:[]}),X.raw+=G}let O=X.items.at(-1);if(O)O.raw=O.raw.trimEnd(),O.text=O.text.trimEnd();else return;X.raw=X.raw.trimEnd();for(let _=0;_<X.items.length;_++)if(this.lexer.state.top=!1,X.items[_].tokens=this.lexer.blockTokens(X.items[_].text,[]),!X.loose){let G=X.items[_].tokens.filter((z)=>z.type==="space"),N=G.length>0&&G.some((z)=>this.rules.other.anyLine.test(z.raw));X.loose=N}if(X.loose)for(let _=0;_<X.items.length;_++)X.items[_].loose=!0;return X}}html($){let Z=this.rules.block.html.exec($);if(Z)return{type:"html",block:!0,raw:Z[0],pre:Z[1]==="pre"||Z[1]==="script"||Z[1]==="style",text:Z[0]}}def($){let Z=this.rules.block.def.exec($);if(Z){let Y=Z[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),J=Z[2]?Z[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",X=Z[3]?Z[3].substring(1,Z[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):Z[3];return{type:"def",tag:Y,raw:Z[0],href:J,title:X}}}table($){let Z=this.rules.block.table.exec($);if(!Z||!this.rules.other.tableDelimiter.test(Z[2]))return;let Y=E2(Z[1]),J=Z[2].replace(this.rules.other.tableAlignChars,"").split("|"),X=Z[3]?.trim()?Z[3].replace(this.rules.other.tableRowBlankLine,"").split(`
96
+ `):[],K={type:"table",raw:Z[0],header:[],align:[],rows:[]};if(Y.length===J.length){for(let W of J)this.rules.other.tableAlignRight.test(W)?K.align.push("right"):this.rules.other.tableAlignCenter.test(W)?K.align.push("center"):this.rules.other.tableAlignLeft.test(W)?K.align.push("left"):K.align.push(null);for(let W=0;W<Y.length;W++)K.header.push({text:Y[W],tokens:this.lexer.inline(Y[W]),header:!0,align:K.align[W]});for(let W of X)K.rows.push(E2(W,K.header.length).map((O,_)=>({text:O,tokens:this.lexer.inline(O),header:!1,align:K.align[_]})));return K}}lheading($){let Z=this.rules.block.lheading.exec($);if(Z)return{type:"heading",raw:Z[0],depth:Z[2].charAt(0)==="="?1:2,text:Z[1],tokens:this.lexer.inline(Z[1])}}paragraph($){let Z=this.rules.block.paragraph.exec($);if(Z){let Y=Z[1].charAt(Z[1].length-1)===`
97
+ `?Z[1].slice(0,-1):Z[1];return{type:"paragraph",raw:Z[0],text:Y,tokens:this.lexer.inline(Y)}}}text($){let Z=this.rules.block.text.exec($);if(Z)return{type:"text",raw:Z[0],text:Z[0],tokens:this.lexer.inline(Z[0])}}escape($){let Z=this.rules.inline.escape.exec($);if(Z)return{type:"escape",raw:Z[0],text:Z[1]}}tag($){let Z=this.rules.inline.tag.exec($);if(Z)return!this.lexer.state.inLink&&this.rules.other.startATag.test(Z[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(Z[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(Z[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(Z[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:Z[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:Z[0]}}link($){let Z=this.rules.inline.link.exec($);if(Z){let Y=Z[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(Y)){if(!this.rules.other.endAngleBracket.test(Y))return;let K=a$(Y.slice(0,-1),"\\");if((Y.length-K.length)%2===0)return}else{let K=N5(Z[2],"()");if(K===-2)return;if(K>-1){let W=(Z[0].indexOf("!")===0?5:4)+Z[1].length+K;Z[2]=Z[2].substring(0,K),Z[0]=Z[0].substring(0,W).trim(),Z[3]=""}}let J=Z[2],X="";if(this.options.pedantic){let K=this.rules.other.pedanticHrefTitle.exec(J);K&&(J=K[1],X=K[3])}else X=Z[3]?Z[3].slice(1,-1):"";return J=J.trim(),this.rules.other.startAngleBracket.test(J)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(Y)?J=J.slice(1):J=J.slice(1,-1)),g2(Z,{href:J&&J.replace(this.rules.inline.anyPunctuation,"$1"),title:X&&X.replace(this.rules.inline.anyPunctuation,"$1")},Z[0],this.lexer,this.rules)}}reflink($,Z){let Y;if((Y=this.rules.inline.reflink.exec($))||(Y=this.rules.inline.nolink.exec($))){let J=(Y[2]||Y[1]).replace(this.rules.other.multipleSpaceGlobal," "),X=Z[J.toLowerCase()];if(!X){let K=Y[0].charAt(0);return{type:"text",raw:K,text:K}}return g2(Y,X,Y[0],this.lexer,this.rules)}}emStrong($,Z,Y=""){let J=this.rules.inline.emStrongLDelim.exec($);if(!J||J[3]&&Y.match(this.rules.other.unicodeAlphaNumeric))return;if(!(J[1]||J[2])||!Y||this.rules.inline.punctuation.exec(Y)){let X=[...J[0]].length-1,K,W,O=X,_=0,G=J[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(G.lastIndex=0,Z=Z.slice(-1*$.length+X);(J=G.exec(Z))!=null;){if(K=J[1]||J[2]||J[3]||J[4]||J[5]||J[6],!K)continue;if(W=[...K].length,J[3]||J[4]){O+=W;continue}else if((J[5]||J[6])&&X%3&&!((X+W)%3)){_+=W;continue}if(O-=W,O>0)continue;W=Math.min(W,W+O+_);let N=[...J[0]][0].length,z=$.slice(0,X+J.index+N+W);if(Math.min(X,W)%2){let L=z.slice(1,-1);return{type:"em",raw:z,text:L,tokens:this.lexer.inlineTokens(L)}}let F=z.slice(2,-2);return{type:"strong",raw:z,text:F,tokens:this.lexer.inlineTokens(F)}}}}codespan($){let Z=this.rules.inline.code.exec($);if(Z){let Y=Z[2].replace(this.rules.other.newLineCharGlobal," "),J=this.rules.other.nonSpaceChar.test(Y),X=this.rules.other.startingSpaceChar.test(Y)&&this.rules.other.endingSpaceChar.test(Y);return J&&X&&(Y=Y.substring(1,Y.length-1)),{type:"codespan",raw:Z[0],text:Y}}}br($){let Z=this.rules.inline.br.exec($);if(Z)return{type:"br",raw:Z[0]}}del($){let Z=this.rules.inline.del.exec($);if(Z)return{type:"del",raw:Z[0],text:Z[2],tokens:this.lexer.inlineTokens(Z[2])}}autolink($){let Z=this.rules.inline.autolink.exec($);if(Z){let Y,J;return Z[2]==="@"?(Y=Z[1],J="mailto:"+Y):(Y=Z[1],J=Y),{type:"link",raw:Z[0],text:Y,href:J,tokens:[{type:"text",raw:Y,text:Y}]}}}url($){let Z;if(Z=this.rules.inline.url.exec($)){let Y,J;if(Z[2]==="@")Y=Z[0],J="mailto:"+Y;else{let X;do X=Z[0],Z[0]=this.rules.inline._backpedal.exec(Z[0])?.[0]??"";while(X!==Z[0]);Y=Z[0],Z[1]==="www."?J="http://"+Z[0]:J=Z[0]}return{type:"link",raw:Z[0],text:Y,href:J,tokens:[{type:"text",raw:Y,text:Y}]}}}inlineText($){let Z=this.rules.inline.text.exec($);if(Z){let Y=this.lexer.state.inRawBlock;return{type:"text",raw:Z[0],text:Z[0],escaped:Y}}}},V1=class ${tokens;options;state;tokenizer;inlineQueue;constructor(Z){this.tokens=[],this.tokens.links=Object.create(null),this.options=Z||I$,this.options.tokenizer=this.options.tokenizer||new wZ,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let Y={other:U1,block:LZ.normal,inline:n$.normal};this.options.pedantic?(Y.block=LZ.pedantic,Y.inline=n$.pedantic):this.options.gfm&&(Y.block=LZ.gfm,this.options.breaks?Y.inline=n$.breaks:Y.inline=n$.gfm),this.tokenizer.rules=Y}static get rules(){return{block:LZ,inline:n$}}static lex(Z,Y){return new $(Y).lex(Z)}static lexInline(Z,Y){return new $(Y).inlineTokens(Z)}lex(Z){Z=Z.replace(U1.carriageReturn,`
98
+ `),this.blockTokens(Z,this.tokens);for(let Y=0;Y<this.inlineQueue.length;Y++){let J=this.inlineQueue[Y];this.inlineTokens(J.src,J.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(Z,Y=[],J=!1){for(this.options.pedantic&&(Z=Z.replace(U1.tabCharGlobal," ").replace(U1.spaceLine,""));Z;){let X;if(this.options.extensions?.block?.some((W)=>(X=W.call({lexer:this},Z,Y))?(Z=Z.substring(X.raw.length),Y.push(X),!0):!1))continue;if(X=this.tokenizer.space(Z)){Z=Z.substring(X.raw.length);let W=Y.at(-1);X.raw.length===1&&W!==void 0?W.raw+=`
99
+ `:Y.push(X);continue}if(X=this.tokenizer.code(Z)){Z=Z.substring(X.raw.length);let W=Y.at(-1);W?.type==="paragraph"||W?.type==="text"?(W.raw+=(W.raw.endsWith(`
100
100
  `)?"":`
101
- `)+Q.raw,K.text+=`
102
- `+Q.text,this.inlineQueue.at(-1).src=K.text):X.push(Q);continue}if(Q=this.tokenizer.fences(Y)){Y=Y.substring(Q.raw.length),X.push(Q);continue}if(Q=this.tokenizer.heading(Y)){Y=Y.substring(Q.raw.length),X.push(Q);continue}if(Q=this.tokenizer.hr(Y)){Y=Y.substring(Q.raw.length),X.push(Q);continue}if(Q=this.tokenizer.blockquote(Y)){Y=Y.substring(Q.raw.length),X.push(Q);continue}if(Q=this.tokenizer.list(Y)){Y=Y.substring(Q.raw.length),X.push(Q);continue}if(Q=this.tokenizer.html(Y)){Y=Y.substring(Q.raw.length),X.push(Q);continue}if(Q=this.tokenizer.def(Y)){Y=Y.substring(Q.raw.length);let K=X.at(-1);K?.type==="paragraph"||K?.type==="text"?(K.raw+=(K.raw.endsWith(`
101
+ `)+X.raw,W.text+=`
102
+ `+X.text,this.inlineQueue.at(-1).src=W.text):Y.push(X);continue}if(X=this.tokenizer.fences(Z)){Z=Z.substring(X.raw.length),Y.push(X);continue}if(X=this.tokenizer.heading(Z)){Z=Z.substring(X.raw.length),Y.push(X);continue}if(X=this.tokenizer.hr(Z)){Z=Z.substring(X.raw.length),Y.push(X);continue}if(X=this.tokenizer.blockquote(Z)){Z=Z.substring(X.raw.length),Y.push(X);continue}if(X=this.tokenizer.list(Z)){Z=Z.substring(X.raw.length),Y.push(X);continue}if(X=this.tokenizer.html(Z)){Z=Z.substring(X.raw.length),Y.push(X);continue}if(X=this.tokenizer.def(Z)){Z=Z.substring(X.raw.length);let W=Y.at(-1);W?.type==="paragraph"||W?.type==="text"?(W.raw+=(W.raw.endsWith(`
103
103
  `)?"":`
104
- `)+Q.raw,K.text+=`
105
- `+Q.raw,this.inlineQueue.at(-1).src=K.text):this.tokens.links[Q.tag]||(this.tokens.links[Q.tag]={href:Q.href,title:Q.title},X.push(Q));continue}if(Q=this.tokenizer.table(Y)){Y=Y.substring(Q.raw.length),X.push(Q);continue}if(Q=this.tokenizer.lheading(Y)){Y=Y.substring(Q.raw.length),X.push(Q);continue}let $=Y;if(this.options.extensions?.startBlock){let K=1/0,U=Y.slice(1),W;this.options.extensions.startBlock.forEach((z)=>{W=z.call({lexer:this},U),typeof W=="number"&&W>=0&&(K=Math.min(K,W))}),K<1/0&&K>=0&&($=Y.substring(0,K+1))}if(this.state.top&&(Q=this.tokenizer.paragraph($))){let K=X.at(-1);J&&K?.type==="paragraph"?(K.raw+=(K.raw.endsWith(`
104
+ `)+X.raw,W.text+=`
105
+ `+X.raw,this.inlineQueue.at(-1).src=W.text):this.tokens.links[X.tag]||(this.tokens.links[X.tag]={href:X.href,title:X.title},Y.push(X));continue}if(X=this.tokenizer.table(Z)){Z=Z.substring(X.raw.length),Y.push(X);continue}if(X=this.tokenizer.lheading(Z)){Z=Z.substring(X.raw.length),Y.push(X);continue}let K=Z;if(this.options.extensions?.startBlock){let W=1/0,O=Z.slice(1),_;this.options.extensions.startBlock.forEach((G)=>{_=G.call({lexer:this},O),typeof _=="number"&&_>=0&&(W=Math.min(W,_))}),W<1/0&&W>=0&&(K=Z.substring(0,W+1))}if(this.state.top&&(X=this.tokenizer.paragraph(K))){let W=Y.at(-1);J&&W?.type==="paragraph"?(W.raw+=(W.raw.endsWith(`
106
106
  `)?"":`
107
- `)+Q.raw,K.text+=`
108
- `+Q.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=K.text):X.push(Q),J=$.length!==Y.length,Y=Y.substring(Q.raw.length);continue}if(Q=this.tokenizer.text(Y)){Y=Y.substring(Q.raw.length);let K=X.at(-1);K?.type==="text"?(K.raw+=(K.raw.endsWith(`
107
+ `)+X.raw,W.text+=`
108
+ `+X.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=W.text):Y.push(X),J=K.length!==Z.length,Z=Z.substring(X.raw.length);continue}if(X=this.tokenizer.text(Z)){Z=Z.substring(X.raw.length);let W=Y.at(-1);W?.type==="text"?(W.raw+=(W.raw.endsWith(`
109
109
  `)?"":`
110
- `)+Q.raw,K.text+=`
111
- `+Q.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=K.text):X.push(Q);continue}if(Y){let K="Infinite loop on byte: "+Y.charCodeAt(0);if(this.options.silent){console.error(K);break}else throw Error(K)}}return this.state.top=!0,X}inline(Y,X=[]){return this.inlineQueue.push({src:Y,tokens:X}),X}inlineTokens(Y,X=[]){let J=Y,Q=null;if(this.tokens.links){let W=Object.keys(this.tokens.links);if(W.length>0)for(;(Q=this.tokenizer.rules.inline.reflinkSearch.exec(J))!=null;)W.includes(Q[0].slice(Q[0].lastIndexOf("[")+1,-1))&&(J=J.slice(0,Q.index)+"["+"a".repeat(Q[0].length-2)+"]"+J.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Q=this.tokenizer.rules.inline.anyPunctuation.exec(J))!=null;)J=J.slice(0,Q.index)+"++"+J.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let $;for(;(Q=this.tokenizer.rules.inline.blockSkip.exec(J))!=null;)$=Q[2]?Q[2].length:0,J=J.slice(0,Q.index+$)+"["+"a".repeat(Q[0].length-$-2)+"]"+J.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);J=this.options.hooks?.emStrongMask?.call({lexer:this},J)??J;let K=!1,U="";for(;Y;){K||(U=""),K=!1;let W;if(this.options.extensions?.inline?.some((H)=>(W=H.call({lexer:this},Y,X))?(Y=Y.substring(W.raw.length),X.push(W),!0):!1))continue;if(W=this.tokenizer.escape(Y)){Y=Y.substring(W.raw.length),X.push(W);continue}if(W=this.tokenizer.tag(Y)){Y=Y.substring(W.raw.length),X.push(W);continue}if(W=this.tokenizer.link(Y)){Y=Y.substring(W.raw.length),X.push(W);continue}if(W=this.tokenizer.reflink(Y,this.tokens.links)){Y=Y.substring(W.raw.length);let H=X.at(-1);W.type==="text"&&H?.type==="text"?(H.raw+=W.raw,H.text+=W.text):X.push(W);continue}if(W=this.tokenizer.emStrong(Y,J,U)){Y=Y.substring(W.raw.length),X.push(W);continue}if(W=this.tokenizer.codespan(Y)){Y=Y.substring(W.raw.length),X.push(W);continue}if(W=this.tokenizer.br(Y)){Y=Y.substring(W.raw.length),X.push(W);continue}if(W=this.tokenizer.del(Y)){Y=Y.substring(W.raw.length),X.push(W);continue}if(W=this.tokenizer.autolink(Y)){Y=Y.substring(W.raw.length),X.push(W);continue}if(!this.state.inLink&&(W=this.tokenizer.url(Y))){Y=Y.substring(W.raw.length),X.push(W);continue}let z=Y;if(this.options.extensions?.startInline){let H=1/0,G=Y.slice(1),F;this.options.extensions.startInline.forEach((M)=>{F=M.call({lexer:this},G),typeof F=="number"&&F>=0&&(H=Math.min(H,F))}),H<1/0&&H>=0&&(z=Y.substring(0,H+1))}if(W=this.tokenizer.inlineText(z)){Y=Y.substring(W.raw.length),W.raw.slice(-1)!=="_"&&(U=W.raw.slice(-1)),K=!0;let H=X.at(-1);H?.type==="text"?(H.raw+=W.raw,H.text+=W.text):X.push(W);continue}if(Y){let H="Infinite loop on byte: "+Y.charCodeAt(0);if(this.options.silent){console.error(H);break}else throw Error(H)}}return X}},JY=class{options;parser;constructor(Z){this.options=Z||r4}space(Z){return""}code({text:Z,lang:Y,escaped:X}){let J=(Y||"").match(RZ.notSpaceStart)?.[0],Q=Z.replace(RZ.endingNewline,"")+`
112
- `;return J?'<pre><code class="language-'+q4(J)+'">'+(X?Q:q4(Q,!0))+`</code></pre>
113
- `:"<pre><code>"+(X?Q:q4(Q,!0))+`</code></pre>
114
- `}blockquote({tokens:Z}){return`<blockquote>
115
- ${this.parser.parse(Z)}</blockquote>
116
- `}html({text:Z}){return Z}def(Z){return""}heading({tokens:Z,depth:Y}){return`<h${Y}>${this.parser.parseInline(Z)}</h${Y}>
117
- `}hr(Z){return`<hr>
118
- `}list(Z){let{ordered:Y,start:X}=Z,J="";for(let K=0;K<Z.items.length;K++){let U=Z.items[K];J+=this.listitem(U)}let Q=Y?"ol":"ul",$=Y&&X!==1?' start="'+X+'"':"";return"<"+Q+$+`>
119
- `+J+"</"+Q+`>
120
- `}listitem(Z){let Y="";if(Z.task){let X=this.checkbox({checked:!!Z.checked});Z.loose?Z.tokens[0]?.type==="paragraph"?(Z.tokens[0].text=X+" "+Z.tokens[0].text,Z.tokens[0].tokens&&Z.tokens[0].tokens.length>0&&Z.tokens[0].tokens[0].type==="text"&&(Z.tokens[0].tokens[0].text=X+" "+q4(Z.tokens[0].tokens[0].text),Z.tokens[0].tokens[0].escaped=!0)):Z.tokens.unshift({type:"text",raw:X+" ",text:X+" ",escaped:!0}):Y+=X+" "}return Y+=this.parser.parse(Z.tokens,!!Z.loose),`<li>${Y}</li>
121
- `}checkbox({checked:Z}){return"<input "+(Z?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:Z}){return`<p>${this.parser.parseInline(Z)}</p>
122
- `}table(Z){let Y="",X="";for(let Q=0;Q<Z.header.length;Q++)X+=this.tablecell(Z.header[Q]);Y+=this.tablerow({text:X});let J="";for(let Q=0;Q<Z.rows.length;Q++){let $=Z.rows[Q];X="";for(let K=0;K<$.length;K++)X+=this.tablecell($[K]);J+=this.tablerow({text:X})}return J&&(J=`<tbody>${J}</tbody>`),`<table>
110
+ `)+X.raw,W.text+=`
111
+ `+X.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=W.text):Y.push(X);continue}if(Z){let W="Infinite loop on byte: "+Z.charCodeAt(0);if(this.options.silent){console.error(W);break}else throw Error(W)}}return this.state.top=!0,Y}inline(Z,Y=[]){return this.inlineQueue.push({src:Z,tokens:Y}),Y}inlineTokens(Z,Y=[]){let J=Z,X=null;if(this.tokens.links){let _=Object.keys(this.tokens.links);if(_.length>0)for(;(X=this.tokenizer.rules.inline.reflinkSearch.exec(J))!=null;)_.includes(X[0].slice(X[0].lastIndexOf("[")+1,-1))&&(J=J.slice(0,X.index)+"["+"a".repeat(X[0].length-2)+"]"+J.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(X=this.tokenizer.rules.inline.anyPunctuation.exec(J))!=null;)J=J.slice(0,X.index)+"++"+J.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let K;for(;(X=this.tokenizer.rules.inline.blockSkip.exec(J))!=null;)K=X[2]?X[2].length:0,J=J.slice(0,X.index+K)+"["+"a".repeat(X[0].length-K-2)+"]"+J.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);J=this.options.hooks?.emStrongMask?.call({lexer:this},J)??J;let W=!1,O="";for(;Z;){W||(O=""),W=!1;let _;if(this.options.extensions?.inline?.some((N)=>(_=N.call({lexer:this},Z,Y))?(Z=Z.substring(_.raw.length),Y.push(_),!0):!1))continue;if(_=this.tokenizer.escape(Z)){Z=Z.substring(_.raw.length),Y.push(_);continue}if(_=this.tokenizer.tag(Z)){Z=Z.substring(_.raw.length),Y.push(_);continue}if(_=this.tokenizer.link(Z)){Z=Z.substring(_.raw.length),Y.push(_);continue}if(_=this.tokenizer.reflink(Z,this.tokens.links)){Z=Z.substring(_.raw.length);let N=Y.at(-1);_.type==="text"&&N?.type==="text"?(N.raw+=_.raw,N.text+=_.text):Y.push(_);continue}if(_=this.tokenizer.emStrong(Z,J,O)){Z=Z.substring(_.raw.length),Y.push(_);continue}if(_=this.tokenizer.codespan(Z)){Z=Z.substring(_.raw.length),Y.push(_);continue}if(_=this.tokenizer.br(Z)){Z=Z.substring(_.raw.length),Y.push(_);continue}if(_=this.tokenizer.del(Z)){Z=Z.substring(_.raw.length),Y.push(_);continue}if(_=this.tokenizer.autolink(Z)){Z=Z.substring(_.raw.length),Y.push(_);continue}if(!this.state.inLink&&(_=this.tokenizer.url(Z))){Z=Z.substring(_.raw.length),Y.push(_);continue}let G=Z;if(this.options.extensions?.startInline){let N=1/0,z=Z.slice(1),F;this.options.extensions.startInline.forEach((L)=>{F=L.call({lexer:this},z),typeof F=="number"&&F>=0&&(N=Math.min(N,F))}),N<1/0&&N>=0&&(G=Z.substring(0,N+1))}if(_=this.tokenizer.inlineText(G)){Z=Z.substring(_.raw.length),_.raw.slice(-1)!=="_"&&(O=_.raw.slice(-1)),W=!0;let N=Y.at(-1);N?.type==="text"?(N.raw+=_.raw,N.text+=_.text):Y.push(_);continue}if(Z){let N="Infinite loop on byte: "+Z.charCodeAt(0);if(this.options.silent){console.error(N);break}else throw Error(N)}}return Y}},MZ=class{options;parser;constructor($){this.options=$||I$}space($){return""}code({text:$,lang:Z,escaped:Y}){let J=(Z||"").match(U1.notSpaceStart)?.[0],X=$.replace(U1.endingNewline,"")+`
112
+ `;return J?'<pre><code class="language-'+n1(J)+'">'+(Y?X:n1(X,!0))+`</code></pre>
113
+ `:"<pre><code>"+(Y?X:n1(X,!0))+`</code></pre>
114
+ `}blockquote({tokens:$}){return`<blockquote>
115
+ ${this.parser.parse($)}</blockquote>
116
+ `}html({text:$}){return $}def($){return""}heading({tokens:$,depth:Z}){return`<h${Z}>${this.parser.parseInline($)}</h${Z}>
117
+ `}hr($){return`<hr>
118
+ `}list($){let{ordered:Z,start:Y}=$,J="";for(let W=0;W<$.items.length;W++){let O=$.items[W];J+=this.listitem(O)}let X=Z?"ol":"ul",K=Z&&Y!==1?' start="'+Y+'"':"";return"<"+X+K+`>
119
+ `+J+"</"+X+`>
120
+ `}listitem($){let Z="";if($.task){let Y=this.checkbox({checked:!!$.checked});$.loose?$.tokens[0]?.type==="paragraph"?($.tokens[0].text=Y+" "+$.tokens[0].text,$.tokens[0].tokens&&$.tokens[0].tokens.length>0&&$.tokens[0].tokens[0].type==="text"&&($.tokens[0].tokens[0].text=Y+" "+n1($.tokens[0].tokens[0].text),$.tokens[0].tokens[0].escaped=!0)):$.tokens.unshift({type:"text",raw:Y+" ",text:Y+" ",escaped:!0}):Z+=Y+" "}return Z+=this.parser.parse($.tokens,!!$.loose),`<li>${Z}</li>
121
+ `}checkbox({checked:$}){return"<input "+($?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:$}){return`<p>${this.parser.parseInline($)}</p>
122
+ `}table($){let Z="",Y="";for(let X=0;X<$.header.length;X++)Y+=this.tablecell($.header[X]);Z+=this.tablerow({text:Y});let J="";for(let X=0;X<$.rows.length;X++){let K=$.rows[X];Y="";for(let W=0;W<K.length;W++)Y+=this.tablecell(K[W]);J+=this.tablerow({text:Y})}return J&&(J=`<tbody>${J}</tbody>`),`<table>
123
123
  <thead>
124
- `+Y+`</thead>
124
+ `+Z+`</thead>
125
125
  `+J+`</table>
126
- `}tablerow({text:Z}){return`<tr>
127
- ${Z}</tr>
128
- `}tablecell(Z){let Y=this.parser.parseInline(Z.tokens),X=Z.header?"th":"td";return(Z.align?`<${X} align="${Z.align}">`:`<${X}>`)+Y+`</${X}>
129
- `}strong({tokens:Z}){return`<strong>${this.parser.parseInline(Z)}</strong>`}em({tokens:Z}){return`<em>${this.parser.parseInline(Z)}</em>`}codespan({text:Z}){return`<code>${q4(Z,!0)}</code>`}br(Z){return"<br>"}del({tokens:Z}){return`<del>${this.parser.parseInline(Z)}</del>`}link({href:Z,title:Y,tokens:X}){let J=this.parser.parseInline(X),Q=C5(Z);if(Q===null)return J;Z=Q;let $='<a href="'+Z+'"';return Y&&($+=' title="'+q4(Y)+'"'),$+=">"+J+"</a>",$}image({href:Z,title:Y,text:X,tokens:J}){J&&(X=this.parser.parseInline(J,this.parser.textRenderer));let Q=C5(Z);if(Q===null)return q4(X);Z=Q;let $=`<img src="${Z}" alt="${X}"`;return Y&&($+=` title="${q4(Y)}"`),$+=">",$}text(Z){return"tokens"in Z&&Z.tokens?this.parser.parseInline(Z.tokens):("escaped"in Z)&&Z.escaped?Z.text:q4(Z.text)}},_X=class{strong({text:Z}){return Z}em({text:Z}){return Z}codespan({text:Z}){return Z}del({text:Z}){return Z}html({text:Z}){return Z}text({text:Z}){return Z}link({text:Z}){return""+Z}image({text:Z}){return""+Z}br(){return""}},sZ=class Z{options;renderer;textRenderer;constructor(Y){this.options=Y||r4,this.options.renderer=this.options.renderer||new JY,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new _X}static parse(Y,X){return new Z(X).parse(Y)}static parseInline(Y,X){return new Z(X).parseInline(Y)}parse(Y,X=!0){let J="";for(let Q=0;Q<Y.length;Q++){let $=Y[Q];if(this.options.extensions?.renderers?.[$.type]){let U=$,W=this.options.extensions.renderers[U.type].call({parser:this},U);if(W!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(U.type)){J+=W||"";continue}}let K=$;switch(K.type){case"space":{J+=this.renderer.space(K);continue}case"hr":{J+=this.renderer.hr(K);continue}case"heading":{J+=this.renderer.heading(K);continue}case"code":{J+=this.renderer.code(K);continue}case"table":{J+=this.renderer.table(K);continue}case"blockquote":{J+=this.renderer.blockquote(K);continue}case"list":{J+=this.renderer.list(K);continue}case"html":{J+=this.renderer.html(K);continue}case"def":{J+=this.renderer.def(K);continue}case"paragraph":{J+=this.renderer.paragraph(K);continue}case"text":{let U=K,W=this.renderer.text(U);for(;Q+1<Y.length&&Y[Q+1].type==="text";)U=Y[++Q],W+=`
130
- `+this.renderer.text(U);X?J+=this.renderer.paragraph({type:"paragraph",raw:W,text:W,tokens:[{type:"text",raw:W,text:W,escaped:!0}]}):J+=W;continue}default:{let U='Token with "'+K.type+'" type was not found.';if(this.options.silent)return console.error(U),"";throw Error(U)}}}return J}parseInline(Y,X=this.renderer){let J="";for(let Q=0;Q<Y.length;Q++){let $=Y[Q];if(this.options.extensions?.renderers?.[$.type]){let U=this.options.extensions.renderers[$.type].call({parser:this},$);if(U!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes($.type)){J+=U||"";continue}}let K=$;switch(K.type){case"escape":{J+=X.text(K);break}case"html":{J+=X.html(K);break}case"link":{J+=X.link(K);break}case"image":{J+=X.image(K);break}case"strong":{J+=X.strong(K);break}case"em":{J+=X.em(K);break}case"codespan":{J+=X.codespan(K);break}case"br":{J+=X.br(K);break}case"del":{J+=X.del(K);break}case"text":{J+=X.text(K);break}default:{let U='Token with "'+K.type+'" type was not found.';if(this.options.silent)return console.error(U),"";throw Error(U)}}}return J}},P0=class{options;block;constructor(Z){this.options=Z||r4}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(Z){return Z}postprocess(Z){return Z}processAllTokens(Z){return Z}emStrongMask(Z){return Z}provideLexer(){return this.block?aZ.lex:aZ.lexInline}provideParser(){return this.block?sZ.parse:sZ.parseInline}},fK=class{defaults=zX();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=sZ;Renderer=JY;TextRenderer=_X;Lexer=aZ;Tokenizer=XY;Hooks=P0;constructor(...Z){this.use(...Z)}walkTokens(Z,Y){let X=[];for(let J of Z)switch(X=X.concat(Y.call(this,J)),J.type){case"table":{let Q=J;for(let $ of Q.header)X=X.concat(this.walkTokens($.tokens,Y));for(let $ of Q.rows)for(let K of $)X=X.concat(this.walkTokens(K.tokens,Y));break}case"list":{let Q=J;X=X.concat(this.walkTokens(Q.items,Y));break}default:{let Q=J;this.defaults.extensions?.childTokens?.[Q.type]?this.defaults.extensions.childTokens[Q.type].forEach(($)=>{let K=Q[$].flat(1/0);X=X.concat(this.walkTokens(K,Y))}):Q.tokens&&(X=X.concat(this.walkTokens(Q.tokens,Y)))}}return X}use(...Z){let Y=this.defaults.extensions||{renderers:{},childTokens:{}};return Z.forEach((X)=>{let J={...X};if(J.async=this.defaults.async||J.async||!1,X.extensions&&(X.extensions.forEach((Q)=>{if(!Q.name)throw Error("extension name required");if("renderer"in Q){let $=Y.renderers[Q.name];$?Y.renderers[Q.name]=function(...K){let U=Q.renderer.apply(this,K);return U===!1&&(U=$.apply(this,K)),U}:Y.renderers[Q.name]=Q.renderer}if("tokenizer"in Q){if(!Q.level||Q.level!=="block"&&Q.level!=="inline")throw Error("extension level must be 'block' or 'inline'");let $=Y[Q.level];$?$.unshift(Q.tokenizer):Y[Q.level]=[Q.tokenizer],Q.start&&(Q.level==="block"?Y.startBlock?Y.startBlock.push(Q.start):Y.startBlock=[Q.start]:Q.level==="inline"&&(Y.startInline?Y.startInline.push(Q.start):Y.startInline=[Q.start]))}"childTokens"in Q&&Q.childTokens&&(Y.childTokens[Q.name]=Q.childTokens)}),J.extensions=Y),X.renderer){let Q=this.defaults.renderer||new JY(this.defaults);for(let $ in X.renderer){if(!($ in Q))throw Error(`renderer '${$}' does not exist`);if(["options","parser"].includes($))continue;let K=$,U=X.renderer[K],W=Q[K];Q[K]=(...z)=>{let H=U.apply(Q,z);return H===!1&&(H=W.apply(Q,z)),H||""}}J.renderer=Q}if(X.tokenizer){let Q=this.defaults.tokenizer||new XY(this.defaults);for(let $ in X.tokenizer){if(!($ in Q))throw Error(`tokenizer '${$}' does not exist`);if(["options","rules","lexer"].includes($))continue;let K=$,U=X.tokenizer[K],W=Q[K];Q[K]=(...z)=>{let H=U.apply(Q,z);return H===!1&&(H=W.apply(Q,z)),H}}J.tokenizer=Q}if(X.hooks){let Q=this.defaults.hooks||new P0;for(let $ in X.hooks){if(!($ in Q))throw Error(`hook '${$}' does not exist`);if(["options","block"].includes($))continue;let K=$,U=X.hooks[K],W=Q[K];P0.passThroughHooks.has($)?Q[K]=(z)=>{if(this.defaults.async&&P0.passThroughHooksRespectAsync.has($))return(async()=>{let G=await U.call(Q,z);return W.call(Q,G)})();let H=U.call(Q,z);return W.call(Q,H)}:Q[K]=(...z)=>{if(this.defaults.async)return(async()=>{let G=await U.apply(Q,z);return G===!1&&(G=await W.apply(Q,z)),G})();let H=U.apply(Q,z);return H===!1&&(H=W.apply(Q,z)),H}}J.hooks=Q}if(X.walkTokens){let Q=this.defaults.walkTokens,$=X.walkTokens;J.walkTokens=function(K){let U=[];return U.push($.call(this,K)),Q&&(U=U.concat(Q.call(this,K))),U}}this.defaults={...this.defaults,...J}}),this}setOptions(Z){return this.defaults={...this.defaults,...Z},this}lexer(Z,Y){return aZ.lex(Z,Y??this.defaults)}parser(Z,Y){return sZ.parse(Z,Y??this.defaults)}parseMarkdown(Z){return(Y,X)=>{let J={...X},Q={...this.defaults,...J},$=this.onError(!!Q.silent,!!Q.async);if(this.defaults.async===!0&&J.async===!1)return $(Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof Y>"u"||Y===null)return $(Error("marked(): input parameter is undefined or null"));if(typeof Y!="string")return $(Error("marked(): input parameter is of type "+Object.prototype.toString.call(Y)+", string expected"));if(Q.hooks&&(Q.hooks.options=Q,Q.hooks.block=Z),Q.async)return(async()=>{let K=Q.hooks?await Q.hooks.preprocess(Y):Y,U=await(Q.hooks?await Q.hooks.provideLexer():Z?aZ.lex:aZ.lexInline)(K,Q),W=Q.hooks?await Q.hooks.processAllTokens(U):U;Q.walkTokens&&await Promise.all(this.walkTokens(W,Q.walkTokens));let z=await(Q.hooks?await Q.hooks.provideParser():Z?sZ.parse:sZ.parseInline)(W,Q);return Q.hooks?await Q.hooks.postprocess(z):z})().catch($);try{Q.hooks&&(Y=Q.hooks.preprocess(Y));let K=(Q.hooks?Q.hooks.provideLexer():Z?aZ.lex:aZ.lexInline)(Y,Q);Q.hooks&&(K=Q.hooks.processAllTokens(K)),Q.walkTokens&&this.walkTokens(K,Q.walkTokens);let U=(Q.hooks?Q.hooks.provideParser():Z?sZ.parse:sZ.parseInline)(K,Q);return Q.hooks&&(U=Q.hooks.postprocess(U)),U}catch(K){return $(K)}}}onError(Z,Y){return(X)=>{if(X.message+=`
131
- Please report this to https://github.com/markedjs/marked.`,Z){let J="<p>An error occurred:</p><pre>"+q4(X.message+"",!0)+"</pre>";return Y?Promise.resolve(J):J}if(Y)return Promise.reject(X);throw X}}},i4=new fK;function c(Z,Y){return i4.parse(Z,Y)}c.options=c.setOptions=function(Z){return i4.setOptions(Z),c.defaults=i4.defaults,D5(c.defaults),c};c.getDefaults=zX;c.defaults=r4;c.use=function(...Z){return i4.use(...Z),c.defaults=i4.defaults,D5(c.defaults),c};c.walkTokens=function(Z,Y){return i4.walkTokens(Z,Y)};c.parseInline=i4.parseInline;c.Parser=sZ;c.parser=sZ.parse;c.Renderer=JY;c.TextRenderer=_X;c.Lexer=aZ;c.lexer=aZ.lex;c.Tokenizer=XY;c.Hooks=P0;c.parse=c;var{options:lG,setOptions:iG,use:rG,walkTokens:oG,parseInline:nG}=c;var aG=sZ.parse,sG=aZ.lex;var pZ=P(g(),1);class YZ extends Error{constructor(Z){super(Z);this.name="ShikiError"}}function jK(Z){return IX(Z)}function IX(Z){if(Array.isArray(Z))return SK(Z);if(Z instanceof RegExp)return Z;if(typeof Z==="object")return yK(Z);return Z}function SK(Z){let Y=[];for(let X=0,J=Z.length;X<J;X++)Y[X]=IX(Z[X]);return Y}function yK(Z){let Y={};for(let X in Z)Y[X]=IX(Z[X]);return Y}function i5(Z,...Y){return Y.forEach((X)=>{for(let J in X)Z[J]=X[J]}),Z}function r5(Z){let Y=~Z.lastIndexOf("/")||~Z.lastIndexOf("\\");if(Y===0)return Z;else if(~Y===Z.length-1)return r5(Z.substring(0,Z.length-1));else return Z.substr(~Y+1)}var AX=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,KY=class{static hasCaptures(Z){if(Z===null)return!1;return AX.lastIndex=0,AX.test(Z)}static replaceCaptures(Z,Y,X){return Z.replace(AX,(J,Q,$,K)=>{let U=X[parseInt(Q||$,10)];if(U){let W=Y.substring(U.start,U.end);while(W[0]===".")W=W.substring(1);switch(K){case"downcase":return W.toLowerCase();case"upcase":return W.toUpperCase();default:return W}}else return J})}};function o5(Z,Y){if(Z<Y)return-1;if(Z>Y)return 1;return 0}function n5(Z,Y){if(Z===null&&Y===null)return 0;if(!Z)return-1;if(!Y)return 1;let X=Z.length,J=Y.length;if(X===J){for(let Q=0;Q<X;Q++){let $=o5(Z[Q],Y[Q]);if($!==0)return $}return 0}return X-J}function x5(Z){if(/^#[0-9a-f]{6}$/i.test(Z))return!0;if(/^#[0-9a-f]{8}$/i.test(Z))return!0;if(/^#[0-9a-f]{3}$/i.test(Z))return!0;if(/^#[0-9a-f]{4}$/i.test(Z))return!0;return!1}function a5(Z){return Z.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var s5=class{constructor(Z){this.fn=Z}cache=new Map;get(Z){if(this.cache.has(Z))return this.cache.get(Z);let Y=this.fn(Z);return this.cache.set(Z,Y),Y}},D0=class{constructor(Z,Y,X){this._colorMap=Z,this._defaults=Y,this._root=X}static createFromRawTheme(Z,Y){return this.createFromParsedTheme(xK(Z),Y)}static createFromParsedTheme(Z,Y){return uK(Z,Y)}_cachedMatchRoot=new s5((Z)=>this._root.match(Z));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(Z){if(Z===null)return this._defaults;let Y=Z.scopeName,J=this._cachedMatchRoot.get(Y).find((Q)=>kK(Z.parent,Q.parentScopes));if(!J)return null;return new t5(J.fontStyle,J.foreground,J.background)}},wX=class Z{constructor(Y,X){this.parent=Y,this.scopeName=X}static push(Y,X){for(let J of X)Y=new Z(Y,J);return Y}static from(...Y){let X=null;for(let J=0;J<Y.length;J++)X=new Z(X,Y[J]);return X}push(Y){return new Z(this,Y)}getSegments(){let Y=this,X=[];while(Y)X.push(Y.scopeName),Y=Y.parent;return X.reverse(),X}toString(){return this.getSegments().join(" ")}extends(Y){if(this===Y)return!0;if(this.parent===null)return!1;return this.parent.extends(Y)}getExtensionIfDefined(Y){let X=[],J=this;while(J&&J!==Y)X.push(J.scopeName),J=J.parent;return J===Y?X.reverse():void 0}};function kK(Z,Y){if(Y.length===0)return!0;for(let X=0;X<Y.length;X++){let J=Y[X],Q=!1;if(J===">"){if(X===Y.length-1)return!1;J=Y[++X],Q=!0}while(Z){if(hK(Z.scopeName,J))break;if(Q)return!1;Z=Z.parent}if(!Z)return!1;Z=Z.parent}return!0}function hK(Z,Y){return Y===Z||Z.startsWith(Y)&&Z[Y.length]==="."}var t5=class{constructor(Z,Y,X){this.fontStyle=Z,this.foregroundId=Y,this.backgroundId=X}};function xK(Z){if(!Z)return[];if(!Z.settings||!Array.isArray(Z.settings))return[];let Y=Z.settings,X=[],J=0;for(let Q=0,$=Y.length;Q<$;Q++){let K=Y[Q];if(!K.settings)continue;let U;if(typeof K.scope==="string"){let G=K.scope;G=G.replace(/^[,]+/,""),G=G.replace(/[,]+$/,""),U=G.split(",")}else if(Array.isArray(K.scope))U=K.scope;else U=[""];let W=-1;if(typeof K.settings.fontStyle==="string"){W=0;let G=K.settings.fontStyle.split(" ");for(let F=0,M=G.length;F<M;F++)switch(G[F]){case"italic":W=W|1;break;case"bold":W=W|2;break;case"underline":W=W|4;break;case"strikethrough":W=W|8;break}}let z=null;if(typeof K.settings.foreground==="string"&&x5(K.settings.foreground))z=K.settings.foreground;let H=null;if(typeof K.settings.background==="string"&&x5(K.settings.background))H=K.settings.background;for(let G=0,F=U.length;G<F;G++){let N=U[G].trim().split(" "),w=N[N.length-1],L=null;if(N.length>1)L=N.slice(0,N.length-1),L.reverse();X[J++]=new gK(w,L,Q,W,z,H)}}return X}var gK=class{constructor(Z,Y,X,J,Q,$){this.scope=Z,this.parentScopes=Y,this.index=X,this.fontStyle=J,this.foreground=Q,this.background=$}},GZ=((Z)=>{return Z[Z.NotSet=-1]="NotSet",Z[Z.None=0]="None",Z[Z.Italic=1]="Italic",Z[Z.Bold=2]="Bold",Z[Z.Underline=4]="Underline",Z[Z.Strikethrough=8]="Strikethrough",Z})(GZ||{});function uK(Z,Y){Z.sort((W,z)=>{let H=o5(W.scope,z.scope);if(H!==0)return H;if(H=n5(W.parentScopes,z.parentScopes),H!==0)return H;return W.index-z.index});let X=0,J="#000000",Q="#ffffff";while(Z.length>=1&&Z[0].scope===""){let W=Z.shift();if(W.fontStyle!==-1)X=W.fontStyle;if(W.foreground!==null)J=W.foreground;if(W.background!==null)Q=W.background}let $=new mK(Y),K=new t5(X,$.getId(J),$.getId(Q)),U=new dK(new LX(0,null,-1,0,0),[]);for(let W=0,z=Z.length;W<z;W++){let H=Z[W];U.insert(0,H.scope,H.parentScopes,H.fontStyle,$.getId(H.foreground),$.getId(H.background))}return new D0($,K,U)}var mK=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(Z){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(Z)){this._isFrozen=!0;for(let Y=0,X=Z.length;Y<X;Y++)this._color2id[Z[Y]]=Y,this._id2color[Y]=Z[Y]}else this._isFrozen=!1}getId(Z){if(Z===null)return 0;Z=Z.toUpperCase();let Y=this._color2id[Z];if(Y)return Y;if(this._isFrozen)throw Error(`Missing color in color map - ${Z}`);return Y=++this._lastColorId,this._color2id[Z]=Y,this._id2color[Y]=Z,Y}getColorMap(){return this._id2color.slice(0)}},pK=Object.freeze([]),LX=class Z{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(Y,X,J,Q,$){this.scopeDepth=Y,this.parentScopes=X||pK,this.fontStyle=J,this.foreground=Q,this.background=$}clone(){return new Z(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(Y){let X=[];for(let J=0,Q=Y.length;J<Q;J++)X[J]=Y[J].clone();return X}acceptOverwrite(Y,X,J,Q){if(this.scopeDepth>Y)console.log("how did this happen?");else this.scopeDepth=Y;if(X!==-1)this.fontStyle=X;if(J!==0)this.foreground=J;if(Q!==0)this.background=Q}},dK=class Z{constructor(Y,X=[],J={}){this._mainRule=Y,this._children=J,this._rulesWithParentScopes=X}_rulesWithParentScopes;static _cmpBySpecificity(Y,X){if(Y.scopeDepth!==X.scopeDepth)return X.scopeDepth-Y.scopeDepth;let J=0,Q=0;while(!0){if(Y.parentScopes[J]===">")J++;if(X.parentScopes[Q]===">")Q++;if(J>=Y.parentScopes.length||Q>=X.parentScopes.length)break;let $=X.parentScopes[Q].length-Y.parentScopes[J].length;if($!==0)return $;J++,Q++}return X.parentScopes.length-Y.parentScopes.length}match(Y){if(Y!==""){let J=Y.indexOf("."),Q,$;if(J===-1)Q=Y,$="";else Q=Y.substring(0,J),$=Y.substring(J+1);if(this._children.hasOwnProperty(Q))return this._children[Q].match($)}let X=this._rulesWithParentScopes.concat(this._mainRule);return X.sort(Z._cmpBySpecificity),X}insert(Y,X,J,Q,$,K){if(X===""){this._doInsertHere(Y,J,Q,$,K);return}let U=X.indexOf("."),W,z;if(U===-1)W=X,z="";else W=X.substring(0,U),z=X.substring(U+1);let H;if(this._children.hasOwnProperty(W))H=this._children[W];else H=new Z(this._mainRule.clone(),LX.cloneArr(this._rulesWithParentScopes)),this._children[W]=H;H.insert(Y+1,z,J,Q,$,K)}_doInsertHere(Y,X,J,Q,$){if(X===null){this._mainRule.acceptOverwrite(Y,J,Q,$);return}for(let K=0,U=this._rulesWithParentScopes.length;K<U;K++){let W=this._rulesWithParentScopes[K];if(n5(W.parentScopes,X)===0){W.acceptOverwrite(Y,J,Q,$);return}}if(J===-1)J=this._mainRule.fontStyle;if(Q===0)Q=this._mainRule.foreground;if($===0)$=this._mainRule.background;this._rulesWithParentScopes.push(new LX(Y,X,J,Q,$))}},o4=class Z{static toBinaryStr(Y){return Y.toString(2).padStart(32,"0")}static print(Y){let X=Z.getLanguageId(Y),J=Z.getTokenType(Y),Q=Z.getFontStyle(Y),$=Z.getForeground(Y),K=Z.getBackground(Y);console.log({languageId:X,tokenType:J,fontStyle:Q,foreground:$,background:K})}static getLanguageId(Y){return(Y&255)>>>0}static getTokenType(Y){return(Y&768)>>>8}static containsBalancedBrackets(Y){return(Y&1024)!==0}static getFontStyle(Y){return(Y&30720)>>>11}static getForeground(Y){return(Y&16744448)>>>15}static getBackground(Y){return(Y&4278190080)>>>24}static set(Y,X,J,Q,$,K,U){let W=Z.getLanguageId(Y),z=Z.getTokenType(Y),H=Z.containsBalancedBrackets(Y)?1:0,G=Z.getFontStyle(Y),F=Z.getForeground(Y),M=Z.getBackground(Y);if(X!==0)W=X;if(J!==8)z=lK(J);if(Q!==null)H=Q?1:0;if($!==-1)G=$;if(K!==0)F=K;if(U!==0)M=U;return(W<<0|z<<8|H<<10|G<<11|F<<15|M<<24)>>>0}};function cK(Z){return Z}function lK(Z){return Z}function UY(Z,Y){let X=[],J=iK(Z),Q=J.next();while(Q!==null){let W=0;if(Q.length===2&&Q.charAt(1)===":"){switch(Q.charAt(0)){case"R":W=1;break;case"L":W=-1;break;default:console.log(`Unknown priority ${Q} in scope selector`)}Q=J.next()}let z=K();if(X.push({matcher:z,priority:W}),Q!==",")break;Q=J.next()}return X;function $(){if(Q==="-"){Q=J.next();let W=$();return(z)=>!!W&&!W(z)}if(Q==="("){Q=J.next();let W=U();if(Q===")")Q=J.next();return W}if(g5(Q)){let W=[];do W.push(Q),Q=J.next();while(g5(Q));return(z)=>Y(W,z)}return null}function K(){let W=[],z=$();while(z)W.push(z),z=$();return(H)=>W.every((G)=>G(H))}function U(){let W=[],z=K();while(z){if(W.push(z),Q==="|"||Q===",")do Q=J.next();while(Q==="|"||Q===",");else break;z=K()}return(H)=>W.some((G)=>G(H))}}function g5(Z){return!!Z&&!!Z.match(/[\w\.:]+/)}function iK(Z){let Y=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,X=Y.exec(Z);return{next:()=>{if(!X)return null;let J=X[0];return X=Y.exec(Z),J}}}function e5(Z){if(typeof Z.dispose==="function")Z.dispose()}var V0=class{constructor(Z){this.scopeName=Z}toKey(){return this.scopeName}},rK=class{constructor(Z,Y){this.scopeName=Z,this.ruleName=Y}toKey(){return`${this.scopeName}#${this.ruleName}`}},oK=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(Z){let Y=Z.toKey();if(this._seenReferenceKeys.has(Y))return;this._seenReferenceKeys.add(Y),this._references.push(Z)}},nK=class{constructor(Z,Y){this.repo=Z,this.initialScopeName=Y,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new V0(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let Z=this.Q;this.Q=[];let Y=new oK;for(let X of Z)aK(X,this.initialScopeName,this.repo,Y);for(let X of Y.references)if(X instanceof V0){if(this.seenFullScopeRequests.has(X.scopeName))continue;this.seenFullScopeRequests.add(X.scopeName),this.Q.push(X)}else{if(this.seenFullScopeRequests.has(X.scopeName))continue;if(this.seenPartialScopeRequests.has(X.toKey()))continue;this.seenPartialScopeRequests.add(X.toKey()),this.Q.push(X)}}};function aK(Z,Y,X,J){let Q=X.lookup(Z.scopeName);if(!Q){if(Z.scopeName===Y)throw Error(`No grammar provided for <${Y}>`);return}let $=X.lookup(Y);if(Z instanceof V0)WY({baseGrammar:$,selfGrammar:Q},J);else PX(Z.ruleName,{baseGrammar:$,selfGrammar:Q,repository:Q.repository},J);let K=X.injections(Z.scopeName);if(K)for(let U of K)J.add(new V0(U))}function PX(Z,Y,X){if(Y.repository&&Y.repository[Z]){let J=Y.repository[Z];zY([J],Y,X)}}function WY(Z,Y){if(Z.selfGrammar.patterns&&Array.isArray(Z.selfGrammar.patterns))zY(Z.selfGrammar.patterns,{...Z,repository:Z.selfGrammar.repository},Y);if(Z.selfGrammar.injections)zY(Object.values(Z.selfGrammar.injections),{...Z,repository:Z.selfGrammar.repository},Y)}function zY(Z,Y,X){for(let J of Z){if(X.visitedRule.has(J))continue;X.visitedRule.add(J);let Q=J.repository?i5({},Y.repository,J.repository):Y.repository;if(Array.isArray(J.patterns))zY(J.patterns,{...Y,repository:Q},X);let $=J.include;if(!$)continue;let K=Z6($);switch(K.kind){case 0:WY({...Y,selfGrammar:Y.baseGrammar},X);break;case 1:WY(Y,X);break;case 2:PX(K.ruleName,{...Y,repository:Q},X);break;case 3:case 4:let U=K.scopeName===Y.selfGrammar.scopeName?Y.selfGrammar:K.scopeName===Y.baseGrammar.scopeName?Y.baseGrammar:void 0;if(U){let W={baseGrammar:Y.baseGrammar,selfGrammar:U,repository:Q};if(K.kind===4)PX(K.ruleName,W,X);else WY(W,X)}else if(K.kind===4)X.add(new rK(K.scopeName,K.ruleName));else X.add(new V0(K.scopeName));break}}}var sK=class{kind=0},tK=class{kind=1},eK=class{constructor(Z){this.ruleName=Z}kind=2},Z7=class{constructor(Z){this.scopeName=Z}kind=3},Y7=class{constructor(Z,Y){this.scopeName=Z,this.ruleName=Y}kind=4};function Z6(Z){if(Z==="$base")return new sK;else if(Z==="$self")return new tK;let Y=Z.indexOf("#");if(Y===-1)return new Z7(Z);else if(Y===0)return new eK(Z.substring(1));else{let X=Z.substring(0,Y),J=Z.substring(Y+1);return new Y7(X,J)}}var X7=/\\(\d+)/,u5=/\\(\d+)/g,$O=Symbol("RuleId"),J7=-1,Y6=-2;function X6(Z){return Z}function J6(Z){return Z}var T0=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(Z,Y,X,J){this.$location=Z,this.id=Y,this._name=X||null,this._nameIsCapturing=KY.hasCaptures(this._name),this._contentName=J||null,this._contentNameIsCapturing=KY.hasCaptures(this._contentName)}get debugName(){let Z=this.$location?`${r5(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${Z}`}getName(Z,Y){if(!this._nameIsCapturing||this._name===null||Z===null||Y===null)return this._name;return KY.replaceCaptures(this._name,Z,Y)}getContentName(Z,Y){if(!this._contentNameIsCapturing||this._contentName===null)return this._contentName;return KY.replaceCaptures(this._contentName,Z,Y)}},Q7=class extends T0{retokenizeCapturedWithRuleId;constructor(Z,Y,X,J,Q){super(Z,Y,X,J);this.retokenizeCapturedWithRuleId=Q}dispose(){}collectPatterns(Z,Y){throw Error("Not supported!")}compile(Z,Y){throw Error("Not supported!")}compileAG(Z,Y,X,J){throw Error("Not supported!")}},$7=class extends T0{_match;captures;_cachedCompiledPatterns;constructor(Z,Y,X,J,Q){super(Z,Y,X,null);this._match=new E0(J,this.id),this.captures=Q,this._cachedCompiledPatterns=null}dispose(){if(this._cachedCompiledPatterns)this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(Z,Y){Y.push(this._match)}compile(Z,Y){return this._getCachedCompiledPatterns(Z).compile(Z)}compileAG(Z,Y,X,J){return this._getCachedCompiledPatterns(Z).compileAG(Z,X,J)}_getCachedCompiledPatterns(Z){if(!this._cachedCompiledPatterns)this._cachedCompiledPatterns=new b0,this.collectPatterns(Z,this._cachedCompiledPatterns);return this._cachedCompiledPatterns}},m5=class extends T0{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(Z,Y,X,J,Q){super(Z,Y,X,J);this.patterns=Q.patterns,this.hasMissingPatterns=Q.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){if(this._cachedCompiledPatterns)this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null}collectPatterns(Z,Y){for(let X of this.patterns)Z.getRule(X).collectPatterns(Z,Y)}compile(Z,Y){return this._getCachedCompiledPatterns(Z).compile(Z)}compileAG(Z,Y,X,J){return this._getCachedCompiledPatterns(Z).compileAG(Z,X,J)}_getCachedCompiledPatterns(Z){if(!this._cachedCompiledPatterns)this._cachedCompiledPatterns=new b0,this.collectPatterns(Z,this._cachedCompiledPatterns);return this._cachedCompiledPatterns}},RX=class extends T0{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(Z,Y,X,J,Q,$,K,U,W,z){super(Z,Y,X,J);this._begin=new E0(Q,this.id),this.beginCaptures=$,this._end=new E0(K?K:"￿",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=U,this.applyEndPatternLast=W||!1,this.patterns=z.patterns,this.hasMissingPatterns=z.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){if(this._cachedCompiledPatterns)this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(Z,Y){return this._end.resolveBackReferences(Z,Y)}collectPatterns(Z,Y){Y.push(this._begin)}compile(Z,Y){return this._getCachedCompiledPatterns(Z,Y).compile(Z)}compileAG(Z,Y,X,J){return this._getCachedCompiledPatterns(Z,Y).compileAG(Z,X,J)}_getCachedCompiledPatterns(Z,Y){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new b0;for(let X of this.patterns)Z.getRule(X).collectPatterns(Z,this._cachedCompiledPatterns);if(this.applyEndPatternLast)this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end);else this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}if(this._end.hasBackReferences)if(this.applyEndPatternLast)this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,Y);else this._cachedCompiledPatterns.setSource(0,Y);return this._cachedCompiledPatterns}},HY=class extends T0{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(Z,Y,X,J,Q,$,K,U,W){super(Z,Y,X,J);this._begin=new E0(Q,this.id),this.beginCaptures=$,this.whileCaptures=U,this._while=new E0(K,Y6),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=W.patterns,this.hasMissingPatterns=W.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){if(this._cachedCompiledPatterns)this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null;if(this._cachedCompiledWhilePatterns)this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(Z,Y){return this._while.resolveBackReferences(Z,Y)}collectPatterns(Z,Y){Y.push(this._begin)}compile(Z,Y){return this._getCachedCompiledPatterns(Z).compile(Z)}compileAG(Z,Y,X,J){return this._getCachedCompiledPatterns(Z).compileAG(Z,X,J)}_getCachedCompiledPatterns(Z){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new b0;for(let Y of this.patterns)Z.getRule(Y).collectPatterns(Z,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(Z,Y){return this._getCachedCompiledWhilePatterns(Z,Y).compile(Z)}compileWhileAG(Z,Y,X,J){return this._getCachedCompiledWhilePatterns(Z,Y).compileAG(Z,X,J)}_getCachedCompiledWhilePatterns(Z,Y){if(!this._cachedCompiledWhilePatterns)this._cachedCompiledWhilePatterns=new b0,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while);if(this._while.hasBackReferences)this._cachedCompiledWhilePatterns.setSource(0,Y?Y:"￿");return this._cachedCompiledWhilePatterns}},Q6=class Z{static createCaptureRule(Y,X,J,Q,$){return Y.registerRule((K)=>{return new Q7(X,K,J,Q,$)})}static getCompiledRuleId(Y,X,J){if(!Y.id)X.registerRule((Q)=>{if(Y.id=Q,Y.match)return new $7(Y.$vscodeTextmateLocation,Y.id,Y.name,Y.match,Z._compileCaptures(Y.captures,X,J));if(typeof Y.begin>"u"){if(Y.repository)J=i5({},J,Y.repository);let $=Y.patterns;if(typeof $>"u"&&Y.include)$=[{include:Y.include}];return new m5(Y.$vscodeTextmateLocation,Y.id,Y.name,Y.contentName,Z._compilePatterns($,X,J))}if(Y.while)return new HY(Y.$vscodeTextmateLocation,Y.id,Y.name,Y.contentName,Y.begin,Z._compileCaptures(Y.beginCaptures||Y.captures,X,J),Y.while,Z._compileCaptures(Y.whileCaptures||Y.captures,X,J),Z._compilePatterns(Y.patterns,X,J));return new RX(Y.$vscodeTextmateLocation,Y.id,Y.name,Y.contentName,Y.begin,Z._compileCaptures(Y.beginCaptures||Y.captures,X,J),Y.end,Z._compileCaptures(Y.endCaptures||Y.captures,X,J),Y.applyEndPatternLast,Z._compilePatterns(Y.patterns,X,J))});return Y.id}static _compileCaptures(Y,X,J){let Q=[];if(Y){let $=0;for(let K in Y){if(K==="$vscodeTextmateLocation")continue;let U=parseInt(K,10);if(U>$)$=U}for(let K=0;K<=$;K++)Q[K]=null;for(let K in Y){if(K==="$vscodeTextmateLocation")continue;let U=parseInt(K,10),W=0;if(Y[K].patterns)W=Z.getCompiledRuleId(Y[K],X,J);Q[U]=Z.createCaptureRule(X,Y[K].$vscodeTextmateLocation,Y[K].name,Y[K].contentName,W)}}return Q}static _compilePatterns(Y,X,J){let Q=[];if(Y)for(let $=0,K=Y.length;$<K;$++){let U=Y[$],W=-1;if(U.include){let z=Z6(U.include);switch(z.kind){case 0:case 1:W=Z.getCompiledRuleId(J[U.include],X,J);break;case 2:let H=J[z.ruleName];if(H)W=Z.getCompiledRuleId(H,X,J);break;case 3:case 4:let G=z.scopeName,F=z.kind===4?z.ruleName:null,M=X.getExternalGrammar(G,J);if(M)if(F){let N=M.repository[F];if(N)W=Z.getCompiledRuleId(N,X,M.repository)}else W=Z.getCompiledRuleId(M.repository.$self,X,M.repository);break}}else W=Z.getCompiledRuleId(U,X,J);if(W!==-1){let z=X.getRule(W),H=!1;if(z instanceof m5||z instanceof RX||z instanceof HY){if(z.hasMissingPatterns&&z.patterns.length===0)H=!0}if(H)continue;Q.push(W)}}return{patterns:Q,hasMissingPatterns:(Y?Y.length:0)!==Q.length}}},E0=class Z{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(Y,X){if(Y&&typeof Y==="string"){let J=Y.length,Q=0,$=[],K=!1;for(let U=0;U<J;U++)if(Y.charAt(U)==="\\"){if(U+1<J){let z=Y.charAt(U+1);if(z==="z")$.push(Y.substring(Q,U)),$.push("$(?!\\n)(?<!\\n)"),Q=U+2;else if(z==="A"||z==="G")K=!0;U++}}if(this.hasAnchor=K,Q===0)this.source=Y;else $.push(Y.substring(Q,J)),this.source=$.join("")}else this.hasAnchor=!1,this.source=Y;if(this.hasAnchor)this._anchorCache=this._buildAnchorCache();else this._anchorCache=null;if(this.ruleId=X,typeof this.source==="string")this.hasBackReferences=X7.test(this.source);else this.hasBackReferences=!1}clone(){return new Z(this.source,this.ruleId)}setSource(Y){if(this.source===Y)return;if(this.source=Y,this.hasAnchor)this._anchorCache=this._buildAnchorCache()}resolveBackReferences(Y,X){if(typeof this.source!=="string")throw Error("This method should only be called if the source is a string");let J=X.map((Q)=>{return Y.substring(Q.start,Q.end)});return u5.lastIndex=0,this.source.replace(u5,(Q,$)=>{return a5(J[parseInt($,10)]||"")})}_buildAnchorCache(){if(typeof this.source!=="string")throw Error("This method should only be called if the source is a string");let Y=[],X=[],J=[],Q=[],$,K,U,W;for($=0,K=this.source.length;$<K;$++)if(U=this.source.charAt($),Y[$]=U,X[$]=U,J[$]=U,Q[$]=U,U==="\\"){if($+1<K){if(W=this.source.charAt($+1),W==="A")Y[$+1]="￿",X[$+1]="￿",J[$+1]="A",Q[$+1]="A";else if(W==="G")Y[$+1]="￿",X[$+1]="G",J[$+1]="￿",Q[$+1]="G";else Y[$+1]=W,X[$+1]=W,J[$+1]=W,Q[$+1]=W;$++}}return{A0_G0:Y.join(""),A0_G1:X.join(""),A1_G0:J.join(""),A1_G1:Q.join("")}}resolveAnchors(Y,X){if(!this.hasAnchor||!this._anchorCache||typeof this.source!=="string")return this.source;if(Y)if(X)return this._anchorCache.A1_G1;else return this._anchorCache.A1_G0;else if(X)return this._anchorCache.A0_G1;else return this._anchorCache.A0_G0}},b0=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){if(this._cached)this._cached.dispose(),this._cached=null;if(this._anchorCache.A0_G0)this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null;if(this._anchorCache.A0_G1)this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null;if(this._anchorCache.A1_G0)this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null;if(this._anchorCache.A1_G1)this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null}push(Z){this._items.push(Z),this._hasAnchors=this._hasAnchors||Z.hasAnchor}unshift(Z){this._items.unshift(Z),this._hasAnchors=this._hasAnchors||Z.hasAnchor}length(){return this._items.length}setSource(Z,Y){if(this._items[Z].source!==Y)this._disposeCaches(),this._items[Z].setSource(Y)}compile(Z){if(!this._cached){let Y=this._items.map((X)=>X.source);this._cached=new p5(Z,Y,this._items.map((X)=>X.ruleId))}return this._cached}compileAG(Z,Y,X){if(!this._hasAnchors)return this.compile(Z);else if(Y)if(X){if(!this._anchorCache.A1_G1)this._anchorCache.A1_G1=this._resolveAnchors(Z,Y,X);return this._anchorCache.A1_G1}else{if(!this._anchorCache.A1_G0)this._anchorCache.A1_G0=this._resolveAnchors(Z,Y,X);return this._anchorCache.A1_G0}else if(X){if(!this._anchorCache.A0_G1)this._anchorCache.A0_G1=this._resolveAnchors(Z,Y,X);return this._anchorCache.A0_G1}else{if(!this._anchorCache.A0_G0)this._anchorCache.A0_G0=this._resolveAnchors(Z,Y,X);return this._anchorCache.A0_G0}}_resolveAnchors(Z,Y,X){let J=this._items.map((Q)=>Q.resolveAnchors(Y,X));return new p5(Z,J,this._items.map((Q)=>Q.ruleId))}},p5=class{constructor(Z,Y,X){this.regExps=Y,this.rules=X,this.scanner=Z.createOnigScanner(Y)}scanner;dispose(){if(typeof this.scanner.dispose==="function")this.scanner.dispose()}toString(){let Z=[];for(let Y=0,X=this.rules.length;Y<X;Y++)Z.push(" - "+this.rules[Y]+": "+this.regExps[Y]);return Z.join(`
132
- `)}findNextMatchSync(Z,Y,X){let J=this.scanner.findNextMatchSync(Z,Y,X);if(!J)return null;return{ruleId:this.rules[J.index],captureIndices:J.captureIndices}}},BX=class{constructor(Z,Y){this.languageId=Z,this.tokenType=Y}},K7=class Z{_defaultAttributes;_embeddedLanguagesMatcher;constructor(Y,X){this._defaultAttributes=new BX(Y,8),this._embeddedLanguagesMatcher=new W7(Object.entries(X||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(Y){if(Y===null)return Z._NULL_SCOPE_METADATA;return this._getBasicScopeAttributes.get(Y)}static _NULL_SCOPE_METADATA=new BX(0,0);_getBasicScopeAttributes=new s5((Y)=>{let X=this._scopeToLanguage(Y),J=this._toStandardTokenType(Y);return new BX(X,J)});_scopeToLanguage(Y){return this._embeddedLanguagesMatcher.match(Y)||0}_toStandardTokenType(Y){let X=Y.match(Z.STANDARD_TOKEN_TYPE_REGEXP);if(!X)return 8;switch(X[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw Error("Unexpected match for standard token type!")}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},W7=class{values;scopesRegExp;constructor(Z){if(Z.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(Z);let Y=Z.map(([X,J])=>a5(X));Y.sort(),Y.reverse(),this.scopesRegExp=new RegExp(`^((${Y.join(")|(")}))($|\\.)`,"")}}match(Z){if(!this.scopesRegExp)return;let Y=Z.match(this.scopesRegExp);if(!Y)return;return this.values.get(Y[1])}},KO={InDebugMode:typeof process<"u"&&!!process.env.VSCODE_TEXTMATE_DEBUG},$6=!1,d5=class{constructor(Z,Y){this.stack=Z,this.stoppedEarly=Y}};function K6(Z,Y,X,J,Q,$,K,U){let W=Y.content.length,z=!1,H=-1;if(K){let M=U7(Z,Y,X,J,Q,$);Q=M.stack,J=M.linePos,X=M.isFirstLine,H=M.anchorPosition}let G=Date.now();while(!z){if(U!==0){if(Date.now()-G>U)return new d5(Q,!0)}F()}return new d5(Q,!1);function F(){let M=z7(Z,Y,X,J,Q,H);if(!M){$.produce(Q,W),z=!0;return}let{captureIndices:N,matchedRuleId:w}=M,L=N&&N.length>0?N[0].end>J:!1;if(w===J7){let B=Q.getRule(Z);$.produce(Q,N[0].start),Q=Q.withContentNameScopesList(Q.nameScopesList),I0(Z,Y,X,Q,$,B.endCaptures,N),$.produce(Q,N[0].end);let C=Q;if(Q=Q.parent,H=C.getAnchorPos(),!L&&C.getEnterPos()===J){Q=C,$.produce(Q,W),z=!0;return}}else{let B=Z.getRule(w);$.produce(Q,N[0].start);let C=Q,R=B.getName(Y.content,N),D=Q.contentNameScopesList.pushAttributed(R,Z);if(Q=Q.push(w,J,H,N[0].end===W,null,D,D),B instanceof RX){let f=B;I0(Z,Y,X,Q,$,f.beginCaptures,N),$.produce(Q,N[0].end),H=N[0].end;let V=f.getContentName(Y.content,N),d=D.pushAttributed(V,Z);if(Q=Q.withContentNameScopesList(d),f.endHasBackReferences)Q=Q.withEndRule(f.getEndWithResolvedBackReferences(Y.content,N));if(!L&&C.hasSameRuleAs(Q)){Q=Q.pop(),$.produce(Q,W),z=!0;return}}else if(B instanceof HY){let f=B;I0(Z,Y,X,Q,$,f.beginCaptures,N),$.produce(Q,N[0].end),H=N[0].end;let V=f.getContentName(Y.content,N),d=D.pushAttributed(V,Z);if(Q=Q.withContentNameScopesList(d),f.whileHasBackReferences)Q=Q.withEndRule(f.getWhileWithResolvedBackReferences(Y.content,N));if(!L&&C.hasSameRuleAs(Q)){Q=Q.pop(),$.produce(Q,W),z=!0;return}}else if(I0(Z,Y,X,Q,$,B.captures,N),$.produce(Q,N[0].end),Q=Q.pop(),!L){Q=Q.safePop(),$.produce(Q,W),z=!0;return}}if(N[0].end>J)J=N[0].end,X=!1}}function U7(Z,Y,X,J,Q,$){let K=Q.beginRuleCapturedEOL?0:-1,U=[];for(let W=Q;W;W=W.pop()){let z=W.getRule(Z);if(z instanceof HY)U.push({rule:z,stack:W})}for(let W=U.pop();W;W=U.pop()){let{ruleScanner:z,findOptions:H}=O7(W.rule,Z,W.stack.endRule,X,J===K),G=z.findNextMatchSync(Y,J,H);if(G){if(G.ruleId!==Y6){Q=W.stack.pop();break}if(G.captureIndices&&G.captureIndices.length){if($.produce(W.stack,G.captureIndices[0].start),I0(Z,Y,X,W.stack,$,W.rule.whileCaptures,G.captureIndices),$.produce(W.stack,G.captureIndices[0].end),K=G.captureIndices[0].end,G.captureIndices[0].end>J)J=G.captureIndices[0].end,X=!1}}else{Q=W.stack.pop();break}}return{stack:Q,linePos:J,anchorPosition:K,isFirstLine:X}}function z7(Z,Y,X,J,Q,$){let K=H7(Z,Y,X,J,Q,$),U=Z.getInjections();if(U.length===0)return K;let W=G7(U,Z,Y,X,J,Q,$);if(!W)return K;if(!K)return W;let z=K.captureIndices[0].start,H=W.captureIndices[0].start;if(H<z||W.priorityMatch&&H===z)return W;return K}function H7(Z,Y,X,J,Q,$){let K=Q.getRule(Z),{ruleScanner:U,findOptions:W}=W6(K,Z,Q.endRule,X,J===$),z=U.findNextMatchSync(Y,J,W);if(z)return{captureIndices:z.captureIndices,matchedRuleId:z.ruleId};return null}function G7(Z,Y,X,J,Q,$,K){let U=Number.MAX_VALUE,W=null,z,H=0,G=$.contentNameScopesList.getScopeNames();for(let F=0,M=Z.length;F<M;F++){let N=Z[F];if(!N.matcher(G))continue;let w=Y.getRule(N.ruleId),{ruleScanner:L,findOptions:B}=W6(w,Y,null,J,Q===K),C=L.findNextMatchSync(X,Q,B);if(!C)continue;let R=C.captureIndices[0].start;if(R>=U)continue;if(U=R,W=C.captureIndices,z=C.ruleId,H=N.priority,U===Q)break}if(W)return{priorityMatch:H===-1,captureIndices:W,matchedRuleId:z};return null}function W6(Z,Y,X,J,Q){if($6){let K=Z.compile(Y,X),U=U6(J,Q);return{ruleScanner:K,findOptions:U}}return{ruleScanner:Z.compileAG(Y,X,J,Q),findOptions:0}}function O7(Z,Y,X,J,Q){if($6){let K=Z.compileWhile(Y,X),U=U6(J,Q);return{ruleScanner:K,findOptions:U}}return{ruleScanner:Z.compileWhileAG(Y,X,J,Q),findOptions:0}}function U6(Z,Y){let X=0;if(!Z)X|=1;if(!Y)X|=4;return X}function I0(Z,Y,X,J,Q,$,K){if($.length===0)return;let U=Y.content,W=Math.min($.length,K.length),z=[],H=K[0].end;for(let G=0;G<W;G++){let F=$[G];if(F===null)continue;let M=K[G];if(M.length===0)continue;if(M.start>H)break;while(z.length>0&&z[z.length-1].endPos<=M.start)Q.produceFromScopes(z[z.length-1].scopes,z[z.length-1].endPos),z.pop();if(z.length>0)Q.produceFromScopes(z[z.length-1].scopes,M.start);else Q.produce(J,M.start);if(F.retokenizeCapturedWithRuleId){let w=F.getName(U,K),L=J.contentNameScopesList.pushAttributed(w,Z),B=F.getContentName(U,K),C=L.pushAttributed(B,Z),R=J.push(F.retokenizeCapturedWithRuleId,M.start,-1,!1,null,L,C),D=Z.createOnigString(U.substring(0,M.end));K6(Z,D,X&&M.start===0,M.start,R,Q,!1,0),e5(D);continue}let N=F.getName(U,K);if(N!==null){let L=(z.length>0?z[z.length-1].scopes:J.contentNameScopesList).pushAttributed(N,Z);z.push(new q7(L,M.end))}}while(z.length>0)Q.produceFromScopes(z[z.length-1].scopes,z[z.length-1].endPos),z.pop()}var q7=class{scopes;endPos;constructor(Z,Y){this.scopes=Z,this.endPos=Y}};function F7(Z,Y,X,J,Q,$,K,U){return new N7(Z,Y,X,J,Q,$,K,U)}function c5(Z,Y,X,J,Q){let $=UY(Y,GY),K=Q6.getCompiledRuleId(X,J,Q.repository);for(let U of $)Z.push({debugSelector:Y,matcher:U.matcher,ruleId:K,grammar:Q,priority:U.priority})}function GY(Z,Y){if(Y.length<Z.length)return!1;let X=0;return Z.every((J)=>{for(let Q=X;Q<Y.length;Q++)if(M7(Y[Q],J))return X=Q+1,!0;return!1})}function M7(Z,Y){if(!Z)return!1;if(Z===Y)return!0;let X=Y.length;return Z.length>X&&Z.substr(0,X)===Y&&Z[X]==="."}var N7=class{constructor(Z,Y,X,J,Q,$,K,U){if(this._rootScopeName=Z,this.balancedBracketSelectors=$,this._onigLib=U,this._basicScopeAttributesProvider=new K7(X,J),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=K,this._grammar=l5(Y,null),this._injections=null,this._tokenTypeMatchers=[],Q)for(let W of Object.keys(Q)){let z=UY(W,GY);for(let H of z)this._tokenTypeMatchers.push({matcher:H.matcher,type:Q[W]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(let Z of this._ruleId2desc)if(Z)Z.dispose()}createOnigScanner(Z){return this._onigLib.createOnigScanner(Z)}createOnigString(Z){return this._onigLib.createOnigString(Z)}getMetadataForScope(Z){return this._basicScopeAttributesProvider.getBasicScopeAttributes(Z)}_collectInjections(){let Z={lookup:(Q)=>{if(Q===this._rootScopeName)return this._grammar;return this.getExternalGrammar(Q)},injections:(Q)=>{return this._grammarRepository.injections(Q)}},Y=[],X=this._rootScopeName,J=Z.lookup(X);if(J){let Q=J.injections;if(Q)for(let K in Q)c5(Y,K,Q[K],this,J);let $=this._grammarRepository.injections(X);if($)$.forEach((K)=>{let U=this.getExternalGrammar(K);if(U){let W=U.injectionSelector;if(W)c5(Y,W,U,this,U)}})}return Y.sort((Q,$)=>Q.priority-$.priority),Y}getInjections(){if(this._injections===null)this._injections=this._collectInjections();return this._injections}registerRule(Z){let Y=++this._lastRuleId,X=Z(X6(Y));return this._ruleId2desc[Y]=X,X}getRule(Z){return this._ruleId2desc[J6(Z)]}getExternalGrammar(Z,Y){if(this._includedGrammars[Z])return this._includedGrammars[Z];else if(this._grammarRepository){let X=this._grammarRepository.lookup(Z);if(X)return this._includedGrammars[Z]=l5(X,Y&&Y.$base),this._includedGrammars[Z]}return}tokenizeLine(Z,Y,X=0){let J=this._tokenize(Z,Y,!1,X);return{tokens:J.lineTokens.getResult(J.ruleStack,J.lineLength),ruleStack:J.ruleStack,stoppedEarly:J.stoppedEarly}}tokenizeLine2(Z,Y,X=0){let J=this._tokenize(Z,Y,!0,X);return{tokens:J.lineTokens.getBinaryResult(J.ruleStack,J.lineLength),ruleStack:J.ruleStack,stoppedEarly:J.stoppedEarly}}_tokenize(Z,Y,X,J){if(this._rootId===-1)this._rootId=Q6.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections();let Q;if(!Y||Y===CX.NULL){Q=!0;let z=this._basicScopeAttributesProvider.getDefaultAttributes(),H=this.themeProvider.getDefaults(),G=o4.set(0,z.languageId,z.tokenType,null,H.fontStyle,H.foregroundId,H.backgroundId),F=this.getRule(this._rootId).getName(null,null),M;if(F)M=v0.createRootAndLookUpScopeName(F,G,this);else M=v0.createRoot("unknown",G);Y=new CX(null,this._rootId,-1,-1,!1,null,M,M)}else Q=!1,Y.reset();Z=Z+`
133
- `;let $=this.createOnigString(Z),K=$.content.length,U=new A7(X,Z,this._tokenTypeMatchers,this.balancedBracketSelectors),W=K6(this,$,Q,0,Y,U,!0,J);return e5($),{lineLength:K,lineTokens:U,ruleStack:W.stack,stoppedEarly:W.stoppedEarly}}};function l5(Z,Y){return Z=jK(Z),Z.repository=Z.repository||{},Z.repository.$self={$vscodeTextmateLocation:Z.$vscodeTextmateLocation,patterns:Z.patterns,name:Z.scopeName},Z.repository.$base=Y||Z.repository.$self,Z}var v0=class Z{constructor(Y,X,J){this.parent=Y,this.scopePath=X,this.tokenAttributes=J}static fromExtension(Y,X){let J=Y,Q=Y?.scopePath??null;for(let $ of X)Q=wX.push(Q,$.scopeNames),J=new Z(J,Q,$.encodedTokenAttributes);return J}static createRoot(Y,X){return new Z(null,new wX(null,Y),X)}static createRootAndLookUpScopeName(Y,X,J){let Q=J.getMetadataForScope(Y),$=new wX(null,Y),K=J.themeProvider.themeMatch($),U=Z.mergeAttributes(X,Q,K);return new Z(null,$,U)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(Y){return Z.equals(this,Y)}static equals(Y,X){do{if(Y===X)return!0;if(!Y&&!X)return!0;if(!Y||!X)return!1;if(Y.scopeName!==X.scopeName||Y.tokenAttributes!==X.tokenAttributes)return!1;Y=Y.parent,X=X.parent}while(!0)}static mergeAttributes(Y,X,J){let Q=-1,$=0,K=0;if(J!==null)Q=J.fontStyle,$=J.foregroundId,K=J.backgroundId;return o4.set(Y,X.languageId,X.tokenType,null,Q,$,K)}pushAttributed(Y,X){if(Y===null)return this;if(Y.indexOf(" ")===-1)return Z._pushAttributed(this,Y,X);let J=Y.split(/ /g),Q=this;for(let $ of J)Q=Z._pushAttributed(Q,$,X);return Q}static _pushAttributed(Y,X,J){let Q=J.getMetadataForScope(X),$=Y.scopePath.push(X),K=J.themeProvider.themeMatch($),U=Z.mergeAttributes(Y.tokenAttributes,Q,K);return new Z(Y,$,U)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(Y){let X=[],J=this;while(J&&J!==Y)X.push({encodedTokenAttributes:J.tokenAttributes,scopeNames:J.scopePath.getExtensionIfDefined(J.parent?.scopePath??null)}),J=J.parent;return J===Y?X.reverse():void 0}},CX=class Z{constructor(Y,X,J,Q,$,K,U,W){this.parent=Y,this.ruleId=X,this.beginRuleCapturedEOL=$,this.endRule=K,this.nameScopesList=U,this.contentNameScopesList=W,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=J,this._anchorPos=Q}_stackElementBrand=void 0;static NULL=new Z(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(Y){if(Y===null)return!1;return Z._equals(this,Y)}static _equals(Y,X){if(Y===X)return!0;if(!this._structuralEquals(Y,X))return!1;return v0.equals(Y.contentNameScopesList,X.contentNameScopesList)}static _structuralEquals(Y,X){do{if(Y===X)return!0;if(!Y&&!X)return!0;if(!Y||!X)return!1;if(Y.depth!==X.depth||Y.ruleId!==X.ruleId||Y.endRule!==X.endRule)return!1;Y=Y.parent,X=X.parent}while(!0)}clone(){return this}static _reset(Y){while(Y)Y._enterPos=-1,Y._anchorPos=-1,Y=Y.parent}reset(){Z._reset(this)}pop(){return this.parent}safePop(){if(this.parent)return this.parent;return this}push(Y,X,J,Q,$,K,U){return new Z(this,Y,X,J,Q,$,K,U)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(Y){return Y.getRule(this.ruleId)}toString(){let Y=[];return this._writeString(Y,0),"["+Y.join(",")+"]"}_writeString(Y,X){if(this.parent)X=this.parent._writeString(Y,X);return Y[X++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,X}withContentNameScopesList(Y){if(this.contentNameScopesList===Y)return this;return this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,Y)}withEndRule(Y){if(this.endRule===Y)return this;return new Z(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,Y,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(Y){let X=this;while(X&&X._enterPos===Y._enterPos){if(X.ruleId===Y.ruleId)return!0;X=X.parent}return!1}toStateStackFrame(){return{ruleId:J6(this.ruleId),beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(Y,X){let J=v0.fromExtension(Y?.nameScopesList??null,X.nameScopesList);return new Z(Y,X6(X.ruleId),X.enterPos??-1,X.anchorPos??-1,X.beginRuleCapturedEOL,X.endRule,J,v0.fromExtension(J,X.contentNameScopesList))}},_7=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(Z,Y){this.balancedBracketScopes=Z.flatMap((X)=>{if(X==="*")return this.allowAny=!0,[];return UY(X,GY).map((J)=>J.matcher)}),this.unbalancedBracketScopes=Y.flatMap((X)=>UY(X,GY).map((J)=>J.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(Z){for(let Y of this.unbalancedBracketScopes)if(Y(Z))return!1;for(let Y of this.balancedBracketScopes)if(Y(Z))return!0;return this.allowAny}},A7=class{constructor(Z,Y,X,J){this.balancedBracketSelectors=J,this._emitBinaryTokens=Z,this._tokenTypeOverrides=X,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(Z,Y){this.produceFromScopes(Z.contentNameScopesList,Y)}produceFromScopes(Z,Y){if(this._lastTokenEndIndex>=Y)return;if(this._emitBinaryTokens){let J=Z?.tokenAttributes??0,Q=!1;if(this.balancedBracketSelectors?.matchesAlways)Q=!0;if(this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){let $=Z?.getScopeNames()??[];for(let K of this._tokenTypeOverrides)if(K.matcher($))J=o4.set(J,0,cK(K.type),null,-1,0,0);if(this.balancedBracketSelectors)Q=this.balancedBracketSelectors.match($)}if(Q)J=o4.set(J,0,8,Q,-1,0,0);if(this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===J){this._lastTokenEndIndex=Y;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(J),this._lastTokenEndIndex=Y;return}let X=Z?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:Y,scopes:X}),this._lastTokenEndIndex=Y}getResult(Z,Y){if(this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===Y-1)this._tokens.pop();if(this._tokens.length===0)this._lastTokenEndIndex=-1,this.produce(Z,Y),this._tokens[this._tokens.length-1].startIndex=0;return this._tokens}getBinaryResult(Z,Y){if(this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===Y-1)this._binaryTokens.pop(),this._binaryTokens.pop();if(this._binaryTokens.length===0)this._lastTokenEndIndex=-1,this.produce(Z,Y),this._binaryTokens[this._binaryTokens.length-2]=0;let X=new Uint32Array(this._binaryTokens.length);for(let J=0,Q=this._binaryTokens.length;J<Q;J++)X[J]=this._binaryTokens[J];return X}},w7=class{constructor(Z,Y){this._onigLib=Y,this._theme=Z}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(let Z of this._grammars.values())Z.dispose()}setTheme(Z){this._theme=Z}getColorMap(){return this._theme.getColorMap()}addGrammar(Z,Y){if(this._rawGrammars.set(Z.scopeName,Z),Y)this._injectionGrammars.set(Z.scopeName,Y)}lookup(Z){return this._rawGrammars.get(Z)}injections(Z){return this._injectionGrammars.get(Z)}getDefaults(){return this._theme.getDefaults()}themeMatch(Z){return this._theme.match(Z)}grammarForScopeName(Z,Y,X,J,Q){if(!this._grammars.has(Z)){let $=this._rawGrammars.get(Z);if(!$)return null;this._grammars.set(Z,F7(Z,$,Y,X,J,Q,this,this._onigLib))}return this._grammars.get(Z)}},z6=class{_options;_syncRegistry;_ensureGrammarCache;constructor(Z){this._options=Z,this._syncRegistry=new w7(D0.createFromRawTheme(Z.theme,Z.colorMap),Z.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(Z,Y){this._syncRegistry.setTheme(D0.createFromRawTheme(Z,Y))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(Z,Y,X){return this.loadGrammarWithConfiguration(Z,Y,{embeddedLanguages:X})}loadGrammarWithConfiguration(Z,Y,X){return this._loadGrammar(Z,Y,X.embeddedLanguages,X.tokenTypes,new _7(X.balancedBracketSelectors||[],X.unbalancedBracketSelectors||[]))}loadGrammar(Z){return this._loadGrammar(Z,0,null,null,null)}_loadGrammar(Z,Y,X,J,Q){let $=new nK(this._syncRegistry,Z);while($.Q.length>0)$.Q.map((K)=>this._loadSingleGrammar(K.scopeName)),$.processQueue();return this._grammarForScopeName(Z,Y,X,J,Q)}_loadSingleGrammar(Z){if(!this._ensureGrammarCache.has(Z))this._doLoadSingleGrammar(Z),this._ensureGrammarCache.set(Z,!0)}_doLoadSingleGrammar(Z){let Y=this._options.loadGrammar(Z);if(Y){let X=typeof this._options.getInjections==="function"?this._options.getInjections(Z):void 0;this._syncRegistry.addGrammar(Y,X)}}addGrammar(Z,Y=[],X=0,J=null){return this._syncRegistry.addGrammar(Z,Y),this._grammarForScopeName(Z.scopeName,X,J)}_grammarForScopeName(Z,Y=0,X=null,J=null,Q=null){return this._syncRegistry.grammarForScopeName(Z,Y,X,J,Q)}},OY=CX.NULL;var H6=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class E4{constructor(Z,Y,X){if(this.normal=Y,this.property=Z,X)this.space=X}}E4.prototype.normal={};E4.prototype.property={};E4.prototype.space=void 0;function vX(Z,Y){let X={},J={};for(let Q of Z)Object.assign(X,Q.property),Object.assign(J,Q.normal);return new E4(X,J,Y)}function f0(Z){return Z.toLowerCase()}class AZ{constructor(Z,Y){this.attribute=Y,this.property=Z}}AZ.prototype.attribute="";AZ.prototype.booleanish=!1;AZ.prototype.boolean=!1;AZ.prototype.commaOrSpaceSeparated=!1;AZ.prototype.commaSeparated=!1;AZ.prototype.defined=!1;AZ.prototype.mustUseProperty=!1;AZ.prototype.number=!1;AZ.prototype.overloadedBoolean=!1;AZ.prototype.property="";AZ.prototype.spaceSeparated=!1;AZ.prototype.space=void 0;var j0={};B7(j0,{spaceSeparated:()=>o,overloadedBoolean:()=>qY,number:()=>v,commaSeparated:()=>b4,commaOrSpaceSeparated:()=>bZ,booleanish:()=>XZ,boolean:()=>y});var L7=0,y=n4(),XZ=n4(),qY=n4(),v=n4(),o=n4(),b4=n4(),bZ=n4();function n4(){return 2**++L7}var DX=Object.keys(j0);class G0 extends AZ{constructor(Z,Y,X,J){let Q=-1;super(Z,Y);if(G6(this,"space",J),typeof X==="number")while(++Q<DX.length){let $=DX[Q];G6(this,DX[Q],(X&j0[$])===j0[$])}}}G0.prototype.defined=!0;function G6(Z,Y,X){if(X)Z[Y]=X}function mZ(Z){let Y={},X={};for(let[J,Q]of Object.entries(Z.properties)){let $=new G0(J,Z.transform(Z.attributes||{},J),Q,Z.space);if(Z.mustUseProperty&&Z.mustUseProperty.includes(J))$.mustUseProperty=!0;Y[J]=$,X[f0(J)]=J,X[f0($.attribute)]=J}return new E4(Y,X,Z.space)}var VX=mZ({properties:{ariaActiveDescendant:null,ariaAtomic:XZ,ariaAutoComplete:null,ariaBusy:XZ,ariaChecked:XZ,ariaColCount:v,ariaColIndex:v,ariaColSpan:v,ariaControls:o,ariaCurrent:null,ariaDescribedBy:o,ariaDetails:null,ariaDisabled:XZ,ariaDropEffect:o,ariaErrorMessage:null,ariaExpanded:XZ,ariaFlowTo:o,ariaGrabbed:XZ,ariaHasPopup:null,ariaHidden:XZ,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:o,ariaLevel:v,ariaLive:null,ariaModal:XZ,ariaMultiLine:XZ,ariaMultiSelectable:XZ,ariaOrientation:null,ariaOwns:o,ariaPlaceholder:null,ariaPosInSet:v,ariaPressed:XZ,ariaReadOnly:XZ,ariaRelevant:null,ariaRequired:XZ,ariaRoleDescription:o,ariaRowCount:v,ariaRowIndex:v,ariaRowSpan:v,ariaSelected:XZ,ariaSetSize:v,ariaSort:null,ariaValueMax:v,ariaValueMin:v,ariaValueNow:v,ariaValueText:null,role:null},transform(Z,Y){return Y==="role"?Y:"aria-"+Y.slice(4).toLowerCase()}});function FY(Z,Y){return Y in Z?Z[Y]:Y}function MY(Z,Y){return FY(Z,Y.toLowerCase())}var O6=mZ({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:b4,acceptCharset:o,accessKey:o,action:null,allow:null,allowFullScreen:y,allowPaymentRequest:y,allowUserMedia:y,alt:null,as:null,async:y,autoCapitalize:null,autoComplete:o,autoFocus:y,autoPlay:y,blocking:o,capture:null,charSet:null,checked:y,cite:null,className:o,cols:v,colSpan:null,content:null,contentEditable:XZ,controls:y,controlsList:o,coords:v|b4,crossOrigin:null,data:null,dateTime:null,decoding:null,default:y,defer:y,dir:null,dirName:null,disabled:y,download:qY,draggable:XZ,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:y,formTarget:null,headers:o,height:v,hidden:qY,high:v,href:null,hrefLang:null,htmlFor:o,httpEquiv:o,id:null,imageSizes:null,imageSrcSet:null,inert:y,inputMode:null,integrity:null,is:null,isMap:y,itemId:null,itemProp:o,itemRef:o,itemScope:y,itemType:o,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:y,low:v,manifest:null,max:null,maxLength:v,media:null,method:null,min:null,minLength:v,multiple:y,muted:y,name:null,nonce:null,noModule:y,noValidate:y,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:y,optimum:v,pattern:null,ping:o,placeholder:null,playsInline:y,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:y,referrerPolicy:null,rel:o,required:y,reversed:y,rows:v,rowSpan:v,sandbox:o,scope:null,scoped:y,seamless:y,selected:y,shadowRootClonable:y,shadowRootDelegatesFocus:y,shadowRootMode:null,shape:null,size:v,sizes:null,slot:null,span:v,spellCheck:XZ,src:null,srcDoc:null,srcLang:null,srcSet:null,start:v,step:null,style:null,tabIndex:v,target:null,title:null,translate:null,type:null,typeMustMatch:y,useMap:null,value:XZ,width:v,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:o,axis:null,background:null,bgColor:null,border:v,borderColor:null,bottomMargin:v,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:y,declare:y,event:null,face:null,frame:null,frameBorder:null,hSpace:v,leftMargin:v,link:null,longDesc:null,lowSrc:null,marginHeight:v,marginWidth:v,noResize:y,noHref:y,noShade:y,noWrap:y,object:null,profile:null,prompt:null,rev:null,rightMargin:v,rules:null,scheme:null,scrolling:XZ,standby:null,summary:null,text:null,topMargin:v,valueType:null,version:null,vAlign:null,vLink:null,vSpace:v,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:y,disableRemotePlayback:y,prefix:null,property:null,results:v,security:null,unselectable:null},space:"html",transform:MY});var q6=mZ({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:bZ,accentHeight:v,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:v,amplitude:v,arabicForm:null,ascent:v,attributeName:null,attributeType:null,azimuth:v,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:v,by:null,calcMode:null,capHeight:v,className:o,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:v,diffuseConstant:v,direction:null,display:null,dur:null,divisor:v,dominantBaseline:null,download:y,dx:null,dy:null,edgeMode:null,editable:null,elevation:v,enableBackground:null,end:null,event:null,exponent:v,externalResourcesRequired:null,fill:null,fillOpacity:v,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:b4,g2:b4,glyphName:b4,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:v,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:v,horizOriginX:v,horizOriginY:v,id:null,ideographic:v,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:v,k:v,k1:v,k2:v,k3:v,k4:v,kernelMatrix:bZ,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:v,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:v,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:v,overlineThickness:v,paintOrder:null,panose1:null,path:null,pathLength:v,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:o,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:v,pointsAtY:v,pointsAtZ:v,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:bZ,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:bZ,rev:bZ,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:bZ,requiredFeatures:bZ,requiredFonts:bZ,requiredFormats:bZ,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:v,specularExponent:v,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:v,strikethroughThickness:v,string:null,stroke:null,strokeDashArray:bZ,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:v,strokeOpacity:v,strokeWidth:null,style:null,surfaceScale:v,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:bZ,tabIndex:v,tableValues:null,target:null,targetX:v,targetY:v,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:bZ,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:v,underlineThickness:v,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:v,values:null,vAlphabetic:v,vMathematical:v,vectorEffect:null,vHanging:v,vIdeographic:v,version:null,vertAdvY:v,vertOriginX:v,vertOriginY:v,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:v,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:FY});var EX=mZ({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(Z,Y){return"xlink:"+Y.slice(5).toLowerCase()}});var bX=mZ({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:MY});var TX=mZ({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(Z,Y){return"xml:"+Y.slice(3).toLowerCase()}});var P7=/[A-Z]/g,F6=/-[a-z]/g,R7=/^data[-\w.:]+$/i;function fX(Z,Y){let X=f0(Y),J=Y,Q=AZ;if(X in Z.normal)return Z.property[Z.normal[X]];if(X.length>4&&X.slice(0,4)==="data"&&R7.test(Y)){if(Y.charAt(4)==="-"){let $=Y.slice(5).replace(F6,I7);J="data"+$.charAt(0).toUpperCase()+$.slice(1)}else{let $=Y.slice(4);if(!F6.test($)){let K=$.replace(P7,C7);if(K.charAt(0)!=="-")K="-"+K;Y="data"+K}}Q=G0}return new Q(J,Y)}function C7(Z){return"-"+Z.toLowerCase()}function I7(Z){return Z.charAt(1).toUpperCase()}var M6=vX([VX,O6,EX,bX,TX],"html"),NY=vX([VX,q6,EX,bX,TX],"svg");var N6={}.hasOwnProperty;function _6(Z,Y){let X=Y||{};function J(Q,...$){let{invalid:K,handlers:U}=J;if(Q&&N6.call(Q,Z)){let W=String(Q[Z]);K=N6.call(U,W)?U[W]:J.unknown}if(K)return K.call(this,Q,...$)}return J.handlers=X.handlers||{},J.invalid=X.invalid,J.unknown=X.unknown,J}var v7=/["&'<>`]/g,D7=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,V7=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,E7=/[|\\{}()[\]^$+*?.]/g,A6=new WeakMap;function w6(Z,Y){if(Z=Z.replace(Y.subset?b7(Y.subset):v7,J),Y.subset||Y.escapeOnly)return Z;return Z.replace(D7,X).replace(V7,J);function X(Q,$,K){return Y.format((Q.charCodeAt(0)-55296)*1024+Q.charCodeAt(1)-56320+65536,K.charCodeAt($+2),Y)}function J(Q,$,K){return Y.format(Q.charCodeAt(0),K.charCodeAt($+1),Y)}}function b7(Z){let Y=A6.get(Z);if(!Y)Y=T7(Z),A6.set(Z,Y);return Y}function T7(Z){let Y=[],X=-1;while(++X<Z.length)Y.push(Z[X].replace(E7,"\\$&"));return new RegExp("(?:"+Y.join("|")+")","g")}var f7=/[\dA-Fa-f]/;function B6(Z,Y,X){let J="&#x"+Z.toString(16).toUpperCase();return X&&Y&&!f7.test(String.fromCharCode(Y))?J:J+";"}var j7=/\d/;function L6(Z,Y,X){let J="&#"+String(Z);return X&&Y&&!j7.test(String.fromCharCode(Y))?J:J+";"}var P6=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"];var _Y={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"};var R6=["cent","copy","divide","gt","lt","not","para","times"];var C6={}.hasOwnProperty,jX={},AY;for(AY in _Y)if(C6.call(_Y,AY))jX[_Y[AY]]=AY;var S7=/[^\dA-Za-z]/;function I6(Z,Y,X,J){let Q=String.fromCharCode(Z);if(C6.call(jX,Q)){let $=jX[Q],K="&"+$;if(X&&P6.includes($)&&!R6.includes($)&&(!J||Y&&Y!==61&&S7.test(String.fromCharCode(Y))))return K;return K+";"}return""}function v6(Z,Y,X){let J=B6(Z,Y,X.omitOptionalSemicolons),Q;if(X.useNamedReferences||X.useShortestReferences)Q=I6(Z,Y,X.omitOptionalSemicolons,X.attribute);if((X.useShortestReferences||!Q)&&X.useShortestReferences){let $=L6(Z,Y,X.omitOptionalSemicolons);if($.length<J.length)J=$}return Q&&(!X.useShortestReferences||Q.length<J.length)?Q:J}function B4(Z,Y){return w6(Z,Object.assign({format:v6},Y))}var y7=/^>|^->|<!--|-->|--!>|<!-$/g,k7=[">"],h7=["<",">"];function D6(Z,Y,X,J){return J.settings.bogusComments?"<?"+B4(Z.value,Object.assign({},J.settings.characterReferences,{subset:k7}))+">":"<!--"+Z.value.replace(y7,Q)+"-->";function Q($){return B4($,Object.assign({},J.settings.characterReferences,{subset:h7}))}}function V6(Z,Y,X,J){return"<!"+(J.settings.upperDoctype?"DOCTYPE":"doctype")+(J.settings.tightDoctype?"":" ")+"html>"}function SX(Z,Y){let X=String(Z);if(typeof Y!=="string")throw TypeError("Expected character");let J=0,Q=X.indexOf(Y);while(Q!==-1)J++,Q=X.indexOf(Y,Q+Y.length);return J}function E6(Z,Y){let X=Y||{};return(Z[Z.length-1]===""?[...Z,""]:Z).join((X.padRight?" ":"")+","+(X.padLeft===!1?"":" ")).trim()}function b6(Z){return Z.join(" ").trim()}var x7=/[ \t\n\f\r]/g;function a4(Z){return typeof Z==="object"?Z.type==="text"?T6(Z.value):!1:T6(Z)}function T6(Z){return Z.replace(x7,"")===""}var $Z=f6(1),yX=f6(-1),g7=[];function f6(Z){return Y;function Y(X,J,Q){let $=X?X.children:g7,K=(J||0)+Z,U=$[K];if(!Q)while(U&&a4(U))K+=Z,U=$[K];return U}}var u7={}.hasOwnProperty;function wY(Z){return Y;function Y(X,J,Q){return u7.call(Z,X.tagName)&&Z[X.tagName](X,J,Q)}}var S0=wY({body:p7,caption:kX,colgroup:kX,dd:i7,dt:l7,head:kX,html:m7,li:c7,optgroup:r7,option:o7,p:d7,rp:j6,rt:j6,tbody:a7,td:S6,tfoot:s7,th:S6,thead:n7,tr:t7});function kX(Z,Y,X){let J=$Z(X,Y,!0);return!J||J.type!=="comment"&&!(J.type==="text"&&a4(J.value.charAt(0)))}function m7(Z,Y,X){let J=$Z(X,Y);return!J||J.type!=="comment"}function p7(Z,Y,X){let J=$Z(X,Y);return!J||J.type!=="comment"}function d7(Z,Y,X){let J=$Z(X,Y);return J?J.type==="element"&&(J.tagName==="address"||J.tagName==="article"||J.tagName==="aside"||J.tagName==="blockquote"||J.tagName==="details"||J.tagName==="div"||J.tagName==="dl"||J.tagName==="fieldset"||J.tagName==="figcaption"||J.tagName==="figure"||J.tagName==="footer"||J.tagName==="form"||J.tagName==="h1"||J.tagName==="h2"||J.tagName==="h3"||J.tagName==="h4"||J.tagName==="h5"||J.tagName==="h6"||J.tagName==="header"||J.tagName==="hgroup"||J.tagName==="hr"||J.tagName==="main"||J.tagName==="menu"||J.tagName==="nav"||J.tagName==="ol"||J.tagName==="p"||J.tagName==="pre"||J.tagName==="section"||J.tagName==="table"||J.tagName==="ul"):!X||!(X.type==="element"&&(X.tagName==="a"||X.tagName==="audio"||X.tagName==="del"||X.tagName==="ins"||X.tagName==="map"||X.tagName==="noscript"||X.tagName==="video"))}function c7(Z,Y,X){let J=$Z(X,Y);return!J||J.type==="element"&&J.tagName==="li"}function l7(Z,Y,X){let J=$Z(X,Y);return Boolean(J&&J.type==="element"&&(J.tagName==="dt"||J.tagName==="dd"))}function i7(Z,Y,X){let J=$Z(X,Y);return!J||J.type==="element"&&(J.tagName==="dt"||J.tagName==="dd")}function j6(Z,Y,X){let J=$Z(X,Y);return!J||J.type==="element"&&(J.tagName==="rp"||J.tagName==="rt")}function r7(Z,Y,X){let J=$Z(X,Y);return!J||J.type==="element"&&J.tagName==="optgroup"}function o7(Z,Y,X){let J=$Z(X,Y);return!J||J.type==="element"&&(J.tagName==="option"||J.tagName==="optgroup")}function n7(Z,Y,X){let J=$Z(X,Y);return Boolean(J&&J.type==="element"&&(J.tagName==="tbody"||J.tagName==="tfoot"))}function a7(Z,Y,X){let J=$Z(X,Y);return!J||J.type==="element"&&(J.tagName==="tbody"||J.tagName==="tfoot")}function s7(Z,Y,X){return!$Z(X,Y)}function t7(Z,Y,X){let J=$Z(X,Y);return!J||J.type==="element"&&J.tagName==="tr"}function S6(Z,Y,X){let J=$Z(X,Y);return!J||J.type==="element"&&(J.tagName==="td"||J.tagName==="th")}var y6=wY({body:Y9,colgroup:X9,head:Z9,html:e7,tbody:J9});function e7(Z){let Y=$Z(Z,-1);return!Y||Y.type!=="comment"}function Z9(Z){let Y=new Set;for(let J of Z.children)if(J.type==="element"&&(J.tagName==="base"||J.tagName==="title")){if(Y.has(J.tagName))return!1;Y.add(J.tagName)}let X=Z.children[0];return!X||X.type==="element"}function Y9(Z){let Y=$Z(Z,-1,!0);return!Y||Y.type!=="comment"&&!(Y.type==="text"&&a4(Y.value.charAt(0)))&&!(Y.type==="element"&&(Y.tagName==="meta"||Y.tagName==="link"||Y.tagName==="script"||Y.tagName==="style"||Y.tagName==="template"))}function X9(Z,Y,X){let J=yX(X,Y),Q=$Z(Z,-1,!0);if(X&&J&&J.type==="element"&&J.tagName==="colgroup"&&S0(J,X.children.indexOf(J),X))return!1;return Boolean(Q&&Q.type==="element"&&Q.tagName==="col")}function J9(Z,Y,X){let J=yX(X,Y),Q=$Z(Z,-1);if(X&&J&&J.type==="element"&&(J.tagName==="thead"||J.tagName==="tbody")&&S0(J,X.children.indexOf(J),X))return!1;return Boolean(Q&&Q.type==="element"&&Q.tagName==="tr")}var BY={name:[[`
134
- \f\r &/=>`.split(""),`
135
- \f\r "&'/=>\``.split("")],[`\x00
136
- \f\r "&'/<=>`.split(""),`\x00
137
- \f\r "&'/<=>\``.split("")]],unquoted:[[`
138
- \f\r &>`.split(""),`\x00
139
- \f\r "&'<=>\``.split("")],[`\x00
140
- \f\r "&'<=>\``.split(""),`\x00
141
- \f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\x00&'".split(""),"\x00\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\x00"&'.split(""),"\x00\"&'`".split("")]]};function k6(Z,Y,X,J){let Q=J.schema,$=Q.space==="svg"?!1:J.settings.omitOptionalTags,K=Q.space==="svg"?J.settings.closeEmptyElements:J.settings.voids.includes(Z.tagName.toLowerCase()),U=[],W;if(Q.space==="html"&&Z.tagName==="svg")J.schema=NY;let z=Q9(J,Z.properties),H=J.all(Q.space==="html"&&Z.tagName==="template"?Z.content:Z);if(J.schema=Q,H)K=!1;if(z||!$||!y6(Z,Y,X)){if(U.push("<",Z.tagName,z?" "+z:""),K&&(Q.space==="svg"||J.settings.closeSelfClosing)){if(W=z.charAt(z.length-1),!J.settings.tightSelfClosing||W==="/"||W&&W!=='"'&&W!=="'")U.push(" ");U.push("/")}U.push(">")}if(U.push(H),!K&&(!$||!S0(Z,Y,X)))U.push("</"+Z.tagName+">");return U.join("")}function Q9(Z,Y){let X=[],J=-1,Q;if(Y){for(Q in Y)if(Y[Q]!==null&&Y[Q]!==void 0){let $=$9(Z,Q,Y[Q]);if($)X.push($)}}while(++J<X.length){let $=Z.settings.tightAttributes?X[J].charAt(X[J].length-1):void 0;if(J!==X.length-1&&$!=='"'&&$!=="'")X[J]+=" "}return X.join("")}function $9(Z,Y,X){let J=fX(Z.schema,Y),Q=Z.settings.allowParseErrors&&Z.schema.space==="html"?0:1,$=Z.settings.allowDangerousCharacters?0:1,K=Z.quote,U;if(J.overloadedBoolean&&(X===J.attribute||X===""))X=!0;else if((J.boolean||J.overloadedBoolean)&&(typeof X!=="string"||X===J.attribute||X===""))X=Boolean(X);if(X===null||X===void 0||X===!1||typeof X==="number"&&Number.isNaN(X))return"";let W=B4(J.attribute,Object.assign({},Z.settings.characterReferences,{subset:BY.name[Q][$]}));if(X===!0)return W;if(X=Array.isArray(X)?(J.commaSeparated?E6:b6)(X,{padLeft:!Z.settings.tightCommaSeparatedLists}):String(X),Z.settings.collapseEmptyAttributes&&!X)return W;if(Z.settings.preferUnquoted)U=B4(X,Object.assign({},Z.settings.characterReferences,{attribute:!0,subset:BY.unquoted[Q][$]}));if(U!==X){if(Z.settings.quoteSmart&&SX(X,K)>SX(X,Z.alternative))K=Z.alternative;U=K+B4(X,Object.assign({},Z.settings.characterReferences,{subset:(K==="'"?BY.single:BY.double)[Q][$],attribute:!0}))+K}return W+(U?"="+U:U)}var K9=["<","&"];function LY(Z,Y,X,J){return X&&X.type==="element"&&(X.tagName==="script"||X.tagName==="style")?Z.value:B4(Z.value,Object.assign({},J.settings.characterReferences,{subset:K9}))}function h6(Z,Y,X,J){return J.settings.allowDangerousHtml?Z.value:LY(Z,Y,X,J)}function x6(Z,Y,X,J){return J.all(Z)}var g6=_6("type",{invalid:W9,unknown:U9,handlers:{comment:D6,doctype:V6,element:k6,raw:h6,root:x6,text:LY}});function W9(Z){throw Error("Expected node, not `"+Z+"`")}function U9(Z){throw Error("Cannot compile unknown node `"+Z.type+"`")}var z9={},H9={},G9=[];function hX(Z,Y){let X=Y||z9,J=X.quote||'"',Q=J==='"'?"'":'"';if(J!=='"'&&J!=="'")throw Error("Invalid quote `"+J+"`, expected `'` or `\"`");return{one:O9,all:q9,settings:{omitOptionalTags:X.omitOptionalTags||!1,allowParseErrors:X.allowParseErrors||!1,allowDangerousCharacters:X.allowDangerousCharacters||!1,quoteSmart:X.quoteSmart||!1,preferUnquoted:X.preferUnquoted||!1,tightAttributes:X.tightAttributes||!1,upperDoctype:X.upperDoctype||!1,tightDoctype:X.tightDoctype||!1,bogusComments:X.bogusComments||!1,tightCommaSeparatedLists:X.tightCommaSeparatedLists||!1,tightSelfClosing:X.tightSelfClosing||!1,collapseEmptyAttributes:X.collapseEmptyAttributes||!1,allowDangerousHtml:X.allowDangerousHtml||!1,voids:X.voids||H6,characterReferences:X.characterReferences||H9,closeSelfClosing:X.closeSelfClosing||!1,closeEmptyElements:X.closeEmptyElements||!1},schema:X.space==="svg"?NY:M6,quote:J,alternative:Q}.one(Array.isArray(Z)?{type:"root",children:Z}:Z,void 0,void 0)}function O9(Z,Y,X){return g6(Z,Y,X,this)}function q9(Z){let Y=[],X=Z&&Z.children||G9,J=-1;while(++J<X.length)Y[J]=this.one(X[J],J,Z);return Y.join("")}function PY(Z,Y){let X=typeof Z==="string"?{}:{...Z.colorReplacements},J=typeof Z==="string"?Z:Z.name;for(let[Q,$]of Object.entries(Y?.colorReplacements||{}))if(typeof $==="string")X[Q]=$;else if(Q===J)Object.assign(X,$);return X}function T4(Z,Y){if(!Z)return Z;return Y?.[Z?.toLowerCase()]||Z}function F9(Z){return Array.isArray(Z)?Z:[Z]}async function i6(Z){return Promise.resolve(typeof Z==="function"?Z():Z).then((Y)=>Y.default||Y)}function mX(Z){return!Z||["plaintext","txt","text","plain"].includes(Z)}function r6(Z){return Z==="ansi"||mX(Z)}function pX(Z){return Z==="none"}function o6(Z){return pX(Z)}function n6(Z,Y){if(!Y)return Z;if(Z.properties||={},Z.properties.class||=[],typeof Z.properties.class==="string")Z.properties.class=Z.properties.class.split(/\s+/g);if(!Array.isArray(Z.properties.class))Z.properties.class=[];let X=Array.isArray(Y)?Y:Y.split(/\s+/g);for(let J of X)if(J&&!Z.properties.class.includes(J))Z.properties.class.push(J);return Z}function DY(Z,Y=!1){if(Z.length===0)return[["",0]];let X=Z.split(/(\r?\n)/g),J=0,Q=[];for(let $=0;$<X.length;$+=2){let K=Y?X[$]+(X[$+1]||""):X[$];Q.push([K,J]),J+=X[$].length,J+=X[$+1]?.length||0}return Q}function M9(Z){let Y=DY(Z,!0).map(([Q])=>Q);function X(Q){if(Q===Z.length)return{line:Y.length-1,character:Y[Y.length-1].length};let $=Q,K=0;for(let U of Y){if($<U.length)break;$-=U.length,K++}return{line:K,character:$}}function J(Q,$){let K=0;for(let U=0;U<Q;U++)K+=Y[U].length;return K+=$,K}return{lines:Y,indexToPos:X,posToIndex:J}}function a6(Z,Y,X){let J=new Set;for(let $ of Z.matchAll(/:?lang=["']([^"']+)["']/g)){let K=$[1].toLowerCase().trim();if(K)J.add(K)}for(let $ of Z.matchAll(/(?:```|~~~)([\w-]+)/g)){let K=$[1].toLowerCase().trim();if(K)J.add(K)}for(let $ of Z.matchAll(/\\begin\{([\w-]+)\}/g)){let K=$[1].toLowerCase().trim();if(K)J.add(K)}for(let $ of Z.matchAll(/<script\s+(?:type|lang)=["']([^"']+)["']/gi)){let K=$[1].toLowerCase().trim(),U=K.includes("/")?K.split("/").pop():K;if(U)J.add(U)}if(!X)return Array.from(J);let Q=X.getBundledLanguages();return Array.from(J).filter(($)=>$&&Q[$])}var dX="light-dark()",N9=["color","background-color"];function _9(Z,Y){let X=0,J=[];for(let Q of Y){if(Q>X)J.push({...Z,content:Z.content.slice(X,Q),offset:Z.offset+X});X=Q}if(X<Z.content.length)J.push({...Z,content:Z.content.slice(X),offset:Z.offset+X});return J}function A9(Z,Y){let X=Array.from(Y instanceof Set?Y:new Set(Y)).sort((J,Q)=>J-Q);if(!X.length)return Z;return Z.map((J)=>{return J.flatMap((Q)=>{let $=X.filter((K)=>Q.offset<K&&K<Q.offset+Q.content.length).map((K)=>K-Q.offset).sort((K,U)=>K-U);if(!$.length)return Q;return _9(Q,$)})})}function w9(Z,Y,X,J,Q="css-vars"){let $={content:Z.content,explanation:Z.explanation,offset:Z.offset},K=Y.map((H)=>RY(Z.variants[H])),U=new Set(K.flatMap((H)=>Object.keys(H))),W={},z=(H,G)=>{let F=G==="color"?"":G==="background-color"?"-bg":`-${G}`;return X+Y[H]+(G==="color"?"":F)};return K.forEach((H,G)=>{for(let F of U){let M=H[F]||"inherit";if(G===0&&J&&N9.includes(F))if(J===dX&&K.length>1){let N=Y.findIndex((C)=>C==="light"),w=Y.findIndex((C)=>C==="dark");if(N===-1||w===-1)throw new YZ('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');let L=K[N][F]||"inherit",B=K[w][F]||"inherit";if(W[F]=`light-dark(${L}, ${B})`,Q==="css-vars")W[z(G,F)]=M}else W[F]=M;else if(Q==="css-vars")W[z(G,F)]=M}}),$.htmlStyle=W,$}function RY(Z){let Y={};if(Z.color)Y.color=Z.color;if(Z.bgColor)Y["background-color"]=Z.bgColor;if(Z.fontStyle){if(Z.fontStyle&GZ.Italic)Y["font-style"]="italic";if(Z.fontStyle&GZ.Bold)Y["font-weight"]="bold";let X=[];if(Z.fontStyle&GZ.Underline)X.push("underline");if(Z.fontStyle&GZ.Strikethrough)X.push("line-through");if(X.length)Y["text-decoration"]=X.join(" ")}return Y}function uX(Z){if(typeof Z==="string")return Z;return Object.entries(Z).map(([Y,X])=>`${Y}:${X}`).join(";")}var s6=new WeakMap;function VY(Z,Y){s6.set(Z,Y)}function k0(Z){return s6.get(Z)}class O0{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(Z,Y){return new O0(Object.fromEntries(F9(Y).map((X)=>[X,OY])),Z)}constructor(...Z){if(Z.length===2){let[Y,X]=Z;this.lang=X,this._stacks=Y}else{let[Y,X,J]=Z;this.lang=X,this._stacks={[J]:Y}}}getInternalStack(Z=this.theme){return this._stacks[Z]}getScopes(Z=this.theme){return B9(this._stacks[Z])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}}function B9(Z){let Y=[],X=new Set;function J(Q){if(X.has(Q))return;X.add(Q);let $=Q?.nameScopesList?.scopeName;if($)Y.push($);if(Q.parent)J(Q.parent)}return J(Z),Y}function L9(Z,Y){if(!(Z instanceof O0))throw new YZ("Invalid grammar state");return Z.getInternalStack(Y)}function P9(){let Z=new WeakMap;function Y(X){if(!Z.has(X.meta)){let J=function(K){if(typeof K==="number"){if(K<0||K>X.source.length)throw new YZ(`Invalid decoration offset: ${K}. Code length: ${X.source.length}`);return{...Q.indexToPos(K),offset:K}}else{let U=Q.lines[K.line];if(U===void 0)throw new YZ(`Invalid decoration position ${JSON.stringify(K)}. Lines length: ${Q.lines.length}`);let W=K.character;if(W<0)W=U.length+W;if(W<0||W>U.length)throw new YZ(`Invalid decoration position ${JSON.stringify(K)}. Line ${K.line} length: ${U.length}`);return{...K,character:W,offset:Q.posToIndex(K.line,W)}}},Q=M9(X.source),$=(X.options.decorations||[]).map((K)=>({...K,start:J(K.start),end:J(K.end)}));R9($),Z.set(X.meta,{decorations:$,converter:Q,source:X.source})}return Z.get(X.meta)}return{name:"shiki:decorations",tokens(X){if(!this.options.decorations?.length)return;let Q=Y(this).decorations.flatMap((K)=>[K.start.offset,K.end.offset]);return A9(X,Q)},code(X){if(!this.options.decorations?.length)return;let J=Y(this),Q=Array.from(X.children).filter((H)=>H.type==="element"&&H.tagName==="span");if(Q.length!==J.converter.lines.length)throw new YZ(`Number of lines in code element (${Q.length}) does not match the number of lines in the source (${J.converter.lines.length}). Failed to apply decorations.`);function $(H,G,F,M){let N=Q[H],w="",L=-1,B=-1;if(G===0)L=0;if(F===0)B=0;if(F===Number.POSITIVE_INFINITY)B=N.children.length;if(L===-1||B===-1)for(let R=0;R<N.children.length;R++){if(w+=t6(N.children[R]),L===-1&&w.length===G)L=R+1;if(B===-1&&w.length===F)B=R+1}if(L===-1)throw new YZ(`Failed to find start index for decoration ${JSON.stringify(M.start)}`);if(B===-1)throw new YZ(`Failed to find end index for decoration ${JSON.stringify(M.end)}`);let C=N.children.slice(L,B);if(!M.alwaysWrap&&C.length===N.children.length)U(N,M,"line");else if(!M.alwaysWrap&&C.length===1&&C[0].type==="element")U(C[0],M,"token");else{let R={type:"element",tagName:"span",properties:{},children:C};U(R,M,"wrapper"),N.children.splice(L,C.length,R)}}function K(H,G){Q[H]=U(Q[H],G,"line")}function U(H,G,F){let M=G.properties||{},N=G.transform||((w)=>w);if(H.tagName=G.tagName||"span",H.properties={...H.properties,...M,class:H.properties.class},G.properties?.class)n6(H,G.properties.class);return H=N(H,F)||H,H}let W=[],z=J.decorations.sort((H,G)=>G.start.offset-H.start.offset||H.end.offset-G.end.offset);for(let H of z){let{start:G,end:F}=H;if(G.line===F.line)$(G.line,G.character,F.character,H);else if(G.line<F.line){$(G.line,G.character,Number.POSITIVE_INFINITY,H);for(let M=G.line+1;M<F.line;M++)W.unshift(()=>K(M,H));$(F.line,0,F.character,H)}}W.forEach((H)=>H())}}}function R9(Z){for(let Y=0;Y<Z.length;Y++){let X=Z[Y];if(X.start.offset>X.end.offset)throw new YZ(`Invalid decoration range: ${JSON.stringify(X.start)} - ${JSON.stringify(X.end)}`);for(let J=Y+1;J<Z.length;J++){let Q=Z[J],$=X.start.offset<=Q.start.offset&&Q.start.offset<X.end.offset,K=X.start.offset<Q.end.offset&&Q.end.offset<=X.end.offset,U=Q.start.offset<=X.start.offset&&X.start.offset<Q.end.offset,W=Q.start.offset<X.end.offset&&X.end.offset<=Q.end.offset;if($||K||U||W){if($&&K)continue;if(U&&W)continue;if(U&&X.start.offset===X.end.offset)continue;if(K&&Q.start.offset===Q.end.offset)continue;throw new YZ(`Decorations ${JSON.stringify(X.start)} and ${JSON.stringify(Q.start)} intersect.`)}}}}function t6(Z){if(Z.type==="text")return Z.value;if(Z.type==="element")return Z.children.map(t6).join("");return""}var C9=[P9()];function CY(Z){let Y=I9(Z.transformers||[]);return[...Y.pre,...Y.normal,...Y.post,...C9]}function I9(Z){let Y=[],X=[],J=[];for(let Q of Z)switch(Q.enforce){case"pre":Y.push(Q);break;case"post":X.push(Q);break;default:J.push(Q)}return{pre:Y,post:X,normal:J}}var s4=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],xX={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function v9(Z,Y){let X=Z.indexOf("\x1B",Y);if(X!==-1){if(Z[X+1]==="["){let J=Z.indexOf("m",X);if(J!==-1)return{sequence:Z.substring(X+2,J).split(";"),startPosition:X,position:J+1}}}return{position:Z.length}}function u6(Z){let Y=Z.shift();if(Y==="2"){let X=Z.splice(0,3).map((J)=>Number.parseInt(J));if(X.length!==3||X.some((J)=>Number.isNaN(J)))return;return{type:"rgb",rgb:X}}else if(Y==="5"){let X=Z.shift();if(X)return{type:"table",index:Number(X)}}}function D9(Z){let Y=[];while(Z.length>0){let X=Z.shift();if(!X)continue;let J=Number.parseInt(X);if(Number.isNaN(J))continue;if(J===0)Y.push({type:"resetAll"});else if(J<=9){if(xX[J])Y.push({type:"setDecoration",value:xX[J]})}else if(J<=29){let Q=xX[J-20];if(Q){if(Y.push({type:"resetDecoration",value:Q}),Q==="dim")Y.push({type:"resetDecoration",value:"bold"})}}else if(J<=37)Y.push({type:"setForegroundColor",value:{type:"named",name:s4[J-30]}});else if(J===38){let Q=u6(Z);if(Q)Y.push({type:"setForegroundColor",value:Q})}else if(J===39)Y.push({type:"resetForegroundColor"});else if(J<=47)Y.push({type:"setBackgroundColor",value:{type:"named",name:s4[J-40]}});else if(J===48){let Q=u6(Z);if(Q)Y.push({type:"setBackgroundColor",value:Q})}else if(J===49)Y.push({type:"resetBackgroundColor"});else if(J===53)Y.push({type:"setDecoration",value:"overline"});else if(J===55)Y.push({type:"resetDecoration",value:"overline"});else if(J>=90&&J<=97)Y.push({type:"setForegroundColor",value:{type:"named",name:s4[J-90+8]}});else if(J>=100&&J<=107)Y.push({type:"setBackgroundColor",value:{type:"named",name:s4[J-100+8]}})}return Y}function V9(){let Z=null,Y=null,X=new Set;return{parse(J){let Q=[],$=0;do{let K=v9(J,$),U=K.sequence?J.substring($,K.startPosition):J.substring($);if(U.length>0)Q.push({value:U,foreground:Z,background:Y,decorations:new Set(X)});if(K.sequence){let W=D9(K.sequence);for(let z of W)if(z.type==="resetAll")Z=null,Y=null,X.clear();else if(z.type==="resetForegroundColor")Z=null;else if(z.type==="resetBackgroundColor")Y=null;else if(z.type==="resetDecoration")X.delete(z.value);for(let z of W)if(z.type==="setForegroundColor")Z=z.value;else if(z.type==="setBackgroundColor")Y=z.value;else if(z.type==="setDecoration")X.add(z.value)}$=K.position}while($<J.length);return Q}}}var E9={black:"#000000",red:"#bb0000",green:"#00bb00",yellow:"#bbbb00",blue:"#0000bb",magenta:"#ff00ff",cyan:"#00bbbb",white:"#eeeeee",brightBlack:"#555555",brightRed:"#ff5555",brightGreen:"#00ff00",brightYellow:"#ffff55",brightBlue:"#5555ff",brightMagenta:"#ff55ff",brightCyan:"#55ffff",brightWhite:"#ffffff"};function b9(Z=E9){function Y(U){return Z[U]}function X(U){return`#${U.map((W)=>Math.max(0,Math.min(W,255)).toString(16).padStart(2,"0")).join("")}`}let J;function Q(){if(J)return J;J=[];for(let z=0;z<s4.length;z++)J.push(Y(s4[z]));let U=[0,95,135,175,215,255];for(let z=0;z<6;z++)for(let H=0;H<6;H++)for(let G=0;G<6;G++)J.push(X([U[z],U[H],U[G]]));let W=8;for(let z=0;z<24;z++,W+=10)J.push(X([W,W,W]));return J}function $(U){return Q()[U]}function K(U){switch(U.type){case"named":return Y(U.name);case"rgb":return X(U.rgb);case"table":return $(U.index)}}return{value:K}}var T9={black:"#000000",red:"#cd3131",green:"#0DBC79",yellow:"#E5E510",blue:"#2472C8",magenta:"#BC3FBC",cyan:"#11A8CD",white:"#E5E5E5",brightBlack:"#666666",brightRed:"#F14C4C",brightGreen:"#23D18B",brightYellow:"#F5F543",brightBlue:"#3B8EEA",brightMagenta:"#D670D6",brightCyan:"#29B8DB",brightWhite:"#FFFFFF"};function f9(Z,Y,X){let J=PY(Z,X),Q=DY(Y),$=Object.fromEntries(s4.map((W)=>{let z=`terminal.ansi${W[0].toUpperCase()}${W.substring(1)}`,H=Z.colors?.[z];return[W,H||T9[W]]})),K=b9($),U=V9();return Q.map((W)=>U.parse(W[0]).map((z)=>{let H,G;if(z.decorations.has("reverse"))H=z.background?K.value(z.background):Z.bg,G=z.foreground?K.value(z.foreground):Z.fg;else H=z.foreground?K.value(z.foreground):Z.fg,G=z.background?K.value(z.background):void 0;if(H=T4(H,J),G=T4(G,J),z.decorations.has("dim"))H=j9(H);let F=GZ.None;if(z.decorations.has("bold"))F|=GZ.Bold;if(z.decorations.has("italic"))F|=GZ.Italic;if(z.decorations.has("underline"))F|=GZ.Underline;if(z.decorations.has("strikethrough"))F|=GZ.Strikethrough;return{content:z.value,offset:W[1],color:H,bgColor:G,fontStyle:F}}))}function j9(Z){let Y=Z.match(/#([0-9a-f]{3,8})/i);if(Y){let J=Y[1];if(J.length===8){let Q=Math.round(Number.parseInt(J.slice(6,8),16)/2).toString(16).padStart(2,"0");return`#${J.slice(0,6)}${Q}`}else if(J.length===6)return`#${J}80`;else if(J.length===4){let Q=J[0],$=J[1],K=J[2],U=J[3],W=Math.round(Number.parseInt(`${U}${U}`,16)/2).toString(16).padStart(2,"0");return`#${Q}${Q}${$}${$}${K}${K}${W}`}else if(J.length===3){let Q=J[0],$=J[1],K=J[2];return`#${Q}${Q}${$}${$}${K}${K}80`}}let X=Z.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);if(X)return`var(${X[1]}-dim)`;return Z}function cX(Z,Y,X={}){let{theme:J=Z.getLoadedThemes()[0]}=X,Q=Z.resolveLangAlias(X.lang||"text");if(mX(Q)||pX(J))return DY(Y).map((W)=>[{content:W[0],offset:W[1]}]);let{theme:$,colorMap:K}=Z.setTheme(J);if(Q==="ansi")return f9($,Y,X);let U=Z.getLanguage(X.lang||"text");if(X.grammarState){if(X.grammarState.lang!==U.name)throw new YZ(`Grammar state language "${X.grammarState.lang}" does not match highlight language "${U.name}"`);if(!X.grammarState.themes.includes($.name))throw new YZ(`Grammar state themes "${X.grammarState.themes}" do not contain highlight theme "${$.name}"`)}return y9(Y,U,$,K,X)}function S9(...Z){if(Z.length===2)return k0(Z[1]);let[Y,X,J={}]=Z,{lang:Q="text",theme:$=Y.getLoadedThemes()[0]}=J;if(mX(Q)||pX($))throw new YZ("Plain language does not have grammar state");if(Q==="ansi")throw new YZ("ANSI language does not have grammar state");let{theme:K,colorMap:U}=Y.setTheme($),W=Y.getLanguage(Q);return new O0(lX(X,W,K,U,J).stateStack,W.name,K.name)}function y9(Z,Y,X,J,Q){let $=lX(Z,Y,X,J,Q),K=new O0($.stateStack,Y.name,X.name);return VY($.tokens,K),$.tokens}function lX(Z,Y,X,J,Q){let $=PY(X,Q),{tokenizeMaxLineLength:K=0,tokenizeTimeLimit:U=500}=Q,W=DY(Z),z=Q.grammarState?L9(Q.grammarState,X.name)??OY:Q.grammarContextCode!=null?lX(Q.grammarContextCode,Y,X,J,{...Q,grammarState:void 0,grammarContextCode:void 0}).stateStack:OY,H=[],G=[];for(let F=0,M=W.length;F<M;F++){let[N,w]=W[F];if(N===""){H=[],G.push([]);continue}if(K>0&&N.length>=K){H=[],G.push([{content:N,offset:w,color:"",fontStyle:0}]);continue}let L,B,C;if(Q.includeExplanation)L=Y.tokenizeLine(N,z,U),B=L.tokens,C=0;let R=Y.tokenizeLine2(N,z,U),D=R.tokens.length/2;for(let f=0;f<D;f++){let V=R.tokens[2*f],d=f+1<D?R.tokens[2*f+2]:N.length;if(V===d)continue;let l=R.tokens[2*f+1],u=T4(J[o4.getForeground(l)],$),n=o4.getFontStyle(l),i={content:N.substring(V,d),offset:w+V,color:u,fontStyle:n};if(Q.includeExplanation){let Q4=[];if(Q.includeExplanation!=="scopeName")for(let hZ of X.settings){let h4;switch(typeof hZ.scope){case"string":h4=hZ.scope.split(/,/).map((m0)=>m0.trim());break;case"object":h4=hZ.scope;break;default:continue}Q4.push({settings:hZ,selectors:h4.map((m0)=>m0.split(/ /))})}i.explanation=[];let $4=0;while(V+$4<d){let hZ=B[C],h4=N.substring(hZ.startIndex,hZ.endIndex);$4+=h4.length,i.explanation.push({content:h4,scopes:Q.includeExplanation==="scopeName"?k9(hZ.scopes):h9(Q4,hZ.scopes)}),C+=1}}H.push(i)}G.push(H),H=[],z=R.ruleStack}return{tokens:G,stateStack:z}}function k9(Z){return Z.map((Y)=>({scopeName:Y}))}function h9(Z,Y){let X=[];for(let J=0,Q=Y.length;J<Q;J++){let $=Y[J];X[J]={scopeName:$,themeMatches:g9(Z,$,Y.slice(0,J))}}return X}function m6(Z,Y){return Z===Y||Y.substring(0,Z.length)===Z&&Y[Z.length]==="."}function x9(Z,Y,X){if(!m6(Z[Z.length-1],Y))return!1;let J=Z.length-2,Q=X.length-1;while(J>=0&&Q>=0){if(m6(Z[J],X[Q]))J-=1;Q-=1}if(J===-1)return!0;return!1}function g9(Z,Y,X){let J=[];for(let{selectors:Q,settings:$}of Z)for(let K of Q)if(x9(K,Y,X)){J.push($);break}return J}function e6(Z,Y,X){let J=Object.entries(X.themes).filter((W)=>W[1]).map((W)=>({color:W[0],theme:W[1]})),Q=J.map((W)=>{let z=cX(Z,Y,{...X,theme:W.theme}),H=k0(z),G=typeof W.theme==="string"?W.theme:W.theme.name;return{tokens:z,state:H,theme:G}}),$=u9(...Q.map((W)=>W.tokens)),K=$[0].map((W,z)=>W.map((H,G)=>{let F={content:H.content,variants:{},offset:H.offset};if("includeExplanation"in X&&X.includeExplanation)F.explanation=H.explanation;return $.forEach((M,N)=>{let{content:w,explanation:L,offset:B,...C}=M[z][G];F.variants[J[N].color]=C}),F})),U=Q[0].state?new O0(Object.fromEntries(Q.map((W)=>[W.theme,W.state?.getInternalStack(W.theme)])),Q[0].state.lang):void 0;if(U)VY(K,U);return K}function u9(...Z){let Y=Z.map(()=>[]),X=Z.length;for(let J=0;J<Z[0].length;J++){let Q=Z.map((W)=>W[J]),$=Y.map(()=>[]);Y.forEach((W,z)=>W.push($[z]));let K=Q.map(()=>0),U=Q.map((W)=>W[0]);while(U.every((W)=>W)){let W=Math.min(...U.map((z)=>z.content.length));for(let z=0;z<X;z++){let H=U[z];if(H.content.length===W)$[z].push(H),K[z]+=1,U[z]=Q[z][K[z]];else $[z].push({...H,content:H.content.slice(0,W)}),U[z]={...H,content:H.content.slice(W),offset:H.offset+W}}}}return Y}function IY(Z,Y,X){let J,Q,$,K,U,W;if("themes"in X){let{defaultColor:z="light",cssVariablePrefix:H="--shiki-",colorsRendering:G="css-vars"}=X,F=Object.entries(X.themes).filter((B)=>B[1]).map((B)=>({color:B[0],theme:B[1]})).sort((B,C)=>B.color===z?-1:C.color===z?1:0);if(F.length===0)throw new YZ("`themes` option must not be empty");let M=e6(Z,Y,X);if(W=k0(M),z&&dX!==z&&!F.find((B)=>B.color===z))throw new YZ(`\`themes\` option must contain the defaultColor key \`${z}\``);let N=F.map((B)=>Z.getTheme(B.theme)),w=F.map((B)=>B.color);if($=M.map((B)=>B.map((C)=>w9(C,w,H,z,G))),W)VY($,W);let L=F.map((B)=>PY(B.theme,X));Q=p6(F,N,L,H,z,"fg",G),J=p6(F,N,L,H,z,"bg",G),K=`shiki-themes ${N.map((B)=>B.name).join(" ")}`,U=z?void 0:[Q,J].join(";")}else if("theme"in X){let z=PY(X.theme,X);$=cX(Z,Y,X);let H=Z.getTheme(X.theme);J=T4(H.bg,z),Q=T4(H.fg,z),K=H.name,W=k0($)}else throw new YZ("Invalid options, either `theme` or `themes` must be provided");return{tokens:$,fg:Q,bg:J,themeName:K,rootStyle:U,grammarState:W}}function p6(Z,Y,X,J,Q,$,K){return Z.map((U,W)=>{let z=T4(Y[W][$],X[W])||"inherit",H=`${J+U.color}${$==="bg"?"-bg":""}:${z}`;if(W===0&&Q){if(Q===dX&&Z.length>1){let G=Z.findIndex((w)=>w.color==="light"),F=Z.findIndex((w)=>w.color==="dark");if(G===-1||F===-1)throw new YZ('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');let M=T4(Y[G][$],X[G])||"inherit",N=T4(Y[F][$],X[F])||"inherit";return`light-dark(${M}, ${N});${H}`}return z}if(K==="css-vars")return H;return null}).filter((U)=>!!U).join(";")}function vY(Z,Y,X,J={meta:{},options:X,codeToHast:(Q,$)=>vY(Z,Q,$),codeToTokens:(Q,$)=>IY(Z,Q,$)}){let Q=Y;for(let N of CY(X))Q=N.preprocess?.call(J,Q,X)||Q;let{tokens:$,fg:K,bg:U,themeName:W,rootStyle:z,grammarState:H}=IY(Z,Q,X),{mergeWhitespaces:G=!0,mergeSameStyleTokens:F=!1}=X;if(G===!0)$=p9($);else if(G==="never")$=d9($);if(F)$=c9($);let M={...J,get source(){return Q}};for(let N of CY(X))$=N.tokens?.call(M,$)||$;return m9($,{...X,fg:K,bg:U,themeName:W,rootStyle:X.rootStyle===!1?!1:X.rootStyle??z},M,H)}function m9(Z,Y,X,J=k0(Z)){let Q=CY(Y),$=[],K={type:"root",children:[]},{structure:U="classic",tabindex:W="0"}=Y,z={class:`shiki ${Y.themeName||""}`};if(Y.rootStyle!==!1)if(Y.rootStyle!=null)z.style=Y.rootStyle;else z.style=`background-color:${Y.bg};color:${Y.fg}`;if(W!==!1&&W!=null)z.tabindex=W.toString();for(let[w,L]of Object.entries(Y.meta||{}))if(!w.startsWith("_"))z[w]=L;let H={type:"element",tagName:"pre",properties:z,children:[],data:Y.data},G={type:"element",tagName:"code",properties:{},children:$},F=[],M={...X,structure:U,addClassToHast:n6,get source(){return X.source},get tokens(){return Z},get options(){return Y},get root(){return K},get pre(){return H},get code(){return G},get lines(){return F}};if(Z.forEach((w,L)=>{if(L){if(U==="inline")K.children.push({type:"element",tagName:"br",properties:{},children:[]});else if(U==="classic")$.push({type:"text",value:`
142
- `})}let B={type:"element",tagName:"span",properties:{class:"line"},children:[]},C=0;for(let R of w){let D={type:"element",tagName:"span",properties:{...R.htmlAttrs},children:[{type:"text",value:R.content}]},f=uX(R.htmlStyle||RY(R));if(f)D.properties.style=f;for(let V of Q)D=V?.span?.call(M,D,L+1,C,B,R)||D;if(U==="inline")K.children.push(D);else if(U==="classic")B.children.push(D);C+=R.content.length}if(U==="classic"){for(let R of Q)B=R?.line?.call(M,B,L+1)||B;F.push(B),$.push(B)}else if(U==="inline")F.push(B)}),U==="classic"){for(let w of Q)G=w?.code?.call(M,G)||G;H.children.push(G);for(let w of Q)H=w?.pre?.call(M,H)||H;K.children.push(H)}else if(U==="inline"){let w=[],L={type:"element",tagName:"span",properties:{class:"line"},children:[]};for(let R of K.children)if(R.type==="element"&&R.tagName==="br")w.push(L),L={type:"element",tagName:"span",properties:{class:"line"},children:[]};else if(R.type==="element"||R.type==="text")L.children.push(R);w.push(L);let C={type:"element",tagName:"code",properties:{},children:w};for(let R of Q)C=R?.code?.call(M,C)||C;K.children=[];for(let R=0;R<C.children.length;R++){if(R>0)K.children.push({type:"element",tagName:"br",properties:{},children:[]});let D=C.children[R];if(D.type==="element")K.children.push(...D.children)}}let N=K;for(let w of Q)N=w?.root?.call(M,N)||N;if(J)VY(N,J);return N}function p9(Z){return Z.map((Y)=>{let X=[],J="",Q;return Y.forEach(($,K)=>{let W=!($.fontStyle&&($.fontStyle&GZ.Underline||$.fontStyle&GZ.Strikethrough));if(W&&$.content.match(/^\s+$/)&&Y[K+1]){if(Q===void 0)Q=$.offset;J+=$.content}else if(J){if(W)X.push({...$,offset:Q,content:J+$.content});else X.push({content:J,offset:Q},$);Q=void 0,J=""}else X.push($)}),X})}function d9(Z){return Z.map((Y)=>{return Y.flatMap((X)=>{if(X.content.match(/^\s+$/))return X;let J=X.content.match(/^(\s*)(.*?)(\s*)$/);if(!J)return X;let[,Q,$,K]=J;if(!Q&&!K)return X;let U=[{...X,offset:X.offset+Q.length,content:$}];if(Q)U.unshift({content:Q,offset:X.offset});if(K)U.push({content:K,offset:X.offset+Q.length+$.length});return U})})}function c9(Z){return Z.map((Y)=>{let X=[];for(let J of Y){if(X.length===0){X.push({...J});continue}let Q=X[X.length-1],$=uX(Q.htmlStyle||RY(Q)),K=uX(J.htmlStyle||RY(J)),U=Q.fontStyle&&(Q.fontStyle&GZ.Underline||Q.fontStyle&GZ.Strikethrough),W=J.fontStyle&&(J.fontStyle&GZ.Underline||J.fontStyle&GZ.Strikethrough);if(!U&&!W&&$===K)Q.content+=J.content;else X.push({...J})}return X})}var l9=hX;function i9(Z,Y,X){let J={meta:{},options:X,codeToHast:($,K)=>vY(Z,$,K),codeToTokens:($,K)=>IY(Z,$,K)},Q=l9(vY(Z,Y,X,J));for(let $ of CY(X))Q=$.postprocess?.call(J,Q,X)||Q;return Q}var d6={light:"#333333",dark:"#bbbbbb"},c6={light:"#fffffe",dark:"#1e1e1e"},l6="__shiki_resolved";function iX(Z){if(Z?.[l6])return Z;let Y={...Z};if(Y.tokenColors&&!Y.settings)Y.settings=Y.tokenColors,delete Y.tokenColors;Y.type||="dark",Y.colorReplacements={...Y.colorReplacements},Y.settings||=[];let{bg:X,fg:J}=Y;if(!X||!J){let U=Y.settings?Y.settings.find((W)=>!W.name&&!W.scope):void 0;if(U?.settings?.foreground)J=U.settings.foreground;if(U?.settings?.background)X=U.settings.background;if(!J&&Y?.colors?.["editor.foreground"])J=Y.colors["editor.foreground"];if(!X&&Y?.colors?.["editor.background"])X=Y.colors["editor.background"];if(!J)J=Y.type==="light"?d6.light:d6.dark;if(!X)X=Y.type==="light"?c6.light:c6.dark;Y.fg=J,Y.bg=X}if(!(Y.settings[0]&&Y.settings[0].settings&&!Y.settings[0].scope))Y.settings.unshift({settings:{foreground:Y.fg,background:Y.bg}});let Q=0,$=new Map;function K(U){if($.has(U))return $.get(U);Q+=1;let W=`#${Q.toString(16).padStart(8,"0").toLowerCase()}`;if(Y.colorReplacements?.[`#${W}`])return K(U);return $.set(U,W),W}Y.settings=Y.settings.map((U)=>{let W=U.settings?.foreground&&!U.settings.foreground.startsWith("#"),z=U.settings?.background&&!U.settings.background.startsWith("#");if(!W&&!z)return U;let H={...U,settings:{...U.settings}};if(W){let G=K(U.settings.foreground);Y.colorReplacements[G]=U.settings.foreground,H.settings.foreground=G}if(z){let G=K(U.settings.background);Y.colorReplacements[G]=U.settings.background,H.settings.background=G}return H});for(let U of Object.keys(Y.colors||{}))if(U==="editor.foreground"||U==="editor.background"||U.startsWith("terminal.ansi")){if(!Y.colors[U]?.startsWith("#")){let W=K(Y.colors[U]);Y.colorReplacements[W]=Y.colors[U],Y.colors[U]=W}}return Object.defineProperty(Y,l6,{enumerable:!1,writable:!1,value:!0}),Y}async function ZJ(Z){return Array.from(new Set((await Promise.all(Z.filter((Y)=>!r6(Y)).map(async(Y)=>await i6(Y).then((X)=>Array.isArray(X)?X:[X])))).flat()))}async function YJ(Z){return(await Promise.all(Z.map(async(X)=>o6(X)?null:iX(await i6(X))))).filter((X)=>!!X)}var gX=3,r9=!1;function o9(Z,Y=3){if(!gX)return;if(typeof gX==="number"&&Y>gX)return;if(r9)throw Error(`[SHIKI DEPRECATE]: ${Z}`);else console.trace(`[SHIKI DEPRECATE]: ${Z}`)}class t4 extends Error{constructor(Z){super(Z);this.name="ShikiError"}}function XJ(Z,Y){if(!Y)return Z;if(Y[Z]){let X=new Set([Z]);while(Y[Z]){if(Z=Y[Z],X.has(Z))throw new t4(`Circular alias \`${Array.from(X).join(" -> ")} -> ${Z}\``);X.add(Z)}}return Z}class JJ extends z6{constructor(Z,Y,X,J={}){super(Z);this._resolver=Z,this._themes=Y,this._langs=X,this._alias=J,this._themes.map((Q)=>this.loadTheme(Q)),this.loadLanguages(this._langs)}_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;getTheme(Z){if(typeof Z==="string")return this._resolvedThemes.get(Z);else return this.loadTheme(Z)}loadTheme(Z){let Y=iX(Z);if(Y.name)this._resolvedThemes.set(Y.name,Y),this._loadedThemesCache=null;return Y}getLoadedThemes(){if(!this._loadedThemesCache)this._loadedThemesCache=[...this._resolvedThemes.keys()];return this._loadedThemesCache}setTheme(Z){let Y=this._textmateThemeCache.get(Z);if(!Y)Y=D0.createFromRawTheme(Z),this._textmateThemeCache.set(Z,Y);this._syncRegistry.setTheme(Y)}getGrammar(Z){return Z=XJ(Z,this._alias),this._resolvedGrammars.get(Z)}loadLanguage(Z){if(this.getGrammar(Z.name))return;let Y=new Set([...this._langMap.values()].filter((Q)=>Q.embeddedLangsLazy?.includes(Z.name)));this._resolver.addLanguage(Z);let X={balancedBracketSelectors:Z.balancedBracketSelectors||["*"],unbalancedBracketSelectors:Z.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(Z.scopeName,Z);let J=this.loadGrammarWithConfiguration(Z.scopeName,1,X);if(J.name=Z.name,this._resolvedGrammars.set(Z.name,J),Z.aliases)Z.aliases.forEach((Q)=>{this._alias[Q]=Z.name});if(this._loadedLanguagesCache=null,Y.size)for(let Q of Y)this._resolvedGrammars.delete(Q.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(Q.scopeName),this._syncRegistry?._grammars?.delete(Q.scopeName),this.loadLanguage(this._langMap.get(Q.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(Z){for(let J of Z)this.resolveEmbeddedLanguages(J);let Y=Array.from(this._langGraph.entries()),X=Y.filter(([J,Q])=>!Q);if(X.length){let J=Y.filter(([Q,$])=>{if(!$)return!1;return($.embeddedLanguages||$.embeddedLangs)?.some((U)=>X.map(([W])=>W).includes(U))}).filter((Q)=>!X.includes(Q));throw new t4(`Missing languages ${X.map(([Q])=>`\`${Q}\``).join(", ")}, required by ${J.map(([Q])=>`\`${Q}\``).join(", ")}`)}for(let[J,Q]of Y)this._resolver.addLanguage(Q);for(let[J,Q]of Y)this.loadLanguage(Q)}getLoadedLanguages(){if(!this._loadedLanguagesCache)this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])];return this._loadedLanguagesCache}resolveEmbeddedLanguages(Z){this._langMap.set(Z.name,Z),this._langGraph.set(Z.name,Z);let Y=Z.embeddedLanguages??Z.embeddedLangs;if(Y)for(let X of Y)this._langGraph.set(X,this._langMap.get(X))}}class QJ{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(Z,Y){this._onigLib={createOnigScanner:(X)=>Z.createScanner(X),createOnigString:(X)=>Z.createString(X)},Y.forEach((X)=>this.addLanguage(X))}get onigLib(){return this._onigLib}getLangRegistration(Z){return this._langs.get(Z)}loadGrammar(Z){return this._scopeToLang.get(Z)}addLanguage(Z){if(this._langs.set(Z.name,Z),Z.aliases)Z.aliases.forEach((Y)=>{this._langs.set(Y,Z)});if(this._scopeToLang.set(Z.scopeName,Z),Z.injectTo)Z.injectTo.forEach((Y)=>{if(!this._injections.get(Y))this._injections.set(Y,[]);this._injections.get(Y).push(Z.scopeName)})}getInjections(Z){let Y=Z.split("."),X=[];for(let J=1;J<=Y.length;J++){let Q=Y.slice(0,J).join(".");X=[...X,...this._injections.get(Q)||[]]}return X}}var y0=0;function n9(Z){if(y0+=1,Z.warnings!==!1&&y0>=10&&y0%10===0)console.warn(`[Shiki] ${y0} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let Y=!1;if(!Z.engine)throw new t4("`engine` option is required for synchronous mode");let X=(Z.langs||[]).flat(1),J=(Z.themes||[]).flat(1).map(iX),Q=new QJ(Z.engine,X),$=new JJ(Q,J,X,Z.langAlias),K;function U(R){return XJ(R,Z.langAlias)}function W(R){B();let D=$.getGrammar(typeof R==="string"?R:R.name);if(!D)throw new t4(`Language \`${R}\` not found, you may need to load it first`);return D}function z(R){if(R==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};B();let D=$.getTheme(R);if(!D)throw new t4(`Theme \`${R}\` not found, you may need to load it first`);return D}function H(R){B();let D=z(R);if(K!==R)$.setTheme(D),K=R;let f=$.getColorMap();return{theme:D,colorMap:f}}function G(){return B(),$.getLoadedThemes()}function F(){return B(),$.getLoadedLanguages()}function M(...R){B(),$.loadLanguages(R.flat(1))}async function N(...R){return M(await ZJ(R))}function w(...R){B();for(let D of R.flat(1))$.loadTheme(D)}async function L(...R){return B(),w(await YJ(R))}function B(){if(Y)throw new t4("Shiki instance has been disposed")}function C(){if(Y)return;Y=!0,$.dispose(),y0-=1}return{setTheme:H,getTheme:z,getLanguage:W,getLoadedThemes:G,getLoadedLanguages:F,resolveLangAlias:U,loadLanguage:N,loadLanguageSync:M,loadTheme:L,loadThemeSync:w,dispose:C,[Symbol.dispose]:C}}async function a9(Z){if(!Z.engine)o9("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");let[Y,X,J]=await Promise.all([YJ(Z.themes||[]),ZJ(Z.langs||[]),Z.engine]);return n9({...Z,themes:Y,langs:X,engine:J})}async function s9(Z){let Y=await a9(Z);return{getLastGrammarState:(...X)=>S9(Y,...X),codeToTokensBase:(X,J)=>cX(Y,X,J),codeToTokensWithThemes:(X,J)=>e6(Y,X,J),codeToTokens:(X,J)=>IY(Y,X,J),codeToHast:(X,J)=>vY(Y,X,J),codeToHtml:(X,J)=>i9(Y,X,J),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...Y,getInternalContext:()=>Y}}function $J(Z){let{langs:Y,themes:X,engine:J}=Z;async function Q($){function K(G){if(typeof G==="string"){if(G=$.langAlias?.[G]||G,r6(G))return[];let F=Y[G];if(!F)throw new YZ(`Language \`${G}\` is not included in this bundle. You may want to load it from external source.`);return F}return G}function U(G){if(o6(G))return"none";if(typeof G==="string"){let F=X[G];if(!F)throw new YZ(`Theme \`${G}\` is not included in this bundle. You may want to load it from external source.`);return F}return G}let W=($.themes??[]).map((G)=>U(G)),z=($.langs??[]).map((G)=>K(G)),H=await s9({engine:$.engine??J(),...$,themes:W,langs:z});return{...H,loadLanguage(...G){return H.loadLanguage(...G.map(K))},loadTheme(...G){return H.loadTheme(...G.map(U))},getBundledLanguages(){return Y},getBundledThemes(){return X}}}return Q}function t9(Z){let Y;async function X(J={}){if(!Y){Y=Z({...J,themes:[],langs:[]});let Q=await Y;return await Promise.all([Q.loadTheme(...J.themes||[]),Q.loadLanguage(...J.langs||[])]),Q}else{let Q=await Y;return await Promise.all([Q.loadTheme(...J.themes||[]),Q.loadLanguage(...J.langs||[])]),Q}}return X}function KJ(Z,Y){let X=t9(Z);async function J(Q,$){let K=await X({langs:[$.lang],themes:"theme"in $?[$.theme]:Object.values($.themes)}),U=await Y?.guessEmbeddedLanguages?.(Q,$.lang,K);if(U)await K.loadLanguage(...U);return K}return{getSingletonHighlighter(Q){return X(Q)},async codeToHtml(Q,$){return(await J(Q,$)).codeToHtml(Q,$)},async codeToHast(Q,$){return(await J(Q,$)).codeToHast(Q,$)},async codeToTokens(Q,$){return(await J(Q,$)).codeToTokens(Q,$)},async codeToTokensBase(Q,$){return(await J(Q,$)).codeToTokensBase(Q,$)},async codeToTokensWithThemes(Q,$){return(await J(Q,$)).codeToTokensWithThemes(Q,$)},async getLastGrammarState(Q,$){return(await X({langs:[$.lang],themes:[$.theme]})).getLastGrammarState(Q,$)}}}var WJ=[{id:"abap",name:"ABAP",import:()=>import("./chunk-qf60gd6x.js")},{id:"actionscript-3",name:"ActionScript",import:()=>import("./chunk-1ck3yagm.js")},{id:"ada",name:"Ada",import:()=>import("./chunk-xm9015v4.js")},{id:"angular-html",name:"Angular HTML",import:()=>import("./chunk-k17n7dpm.js")},{id:"angular-ts",name:"Angular TypeScript",import:()=>import("./chunk-ah557n6f.js")},{id:"apache",name:"Apache Conf",import:()=>import("./chunk-n08dw2ke.js")},{id:"apex",name:"Apex",import:()=>import("./chunk-2z60cf4h.js")},{id:"apl",name:"APL",import:()=>import("./chunk-fs5s90mk.js")},{id:"applescript",name:"AppleScript",import:()=>import("./chunk-5n6g25gc.js")},{id:"ara",name:"Ara",import:()=>import("./chunk-zytr7a4n.js")},{id:"asciidoc",name:"AsciiDoc",aliases:["adoc"],import:()=>import("./chunk-gaw2bhff.js")},{id:"asm",name:"Assembly",import:()=>import("./chunk-f1gz54zs.js")},{id:"astro",name:"Astro",import:()=>import("./chunk-raq8eqd9.js")},{id:"awk",name:"AWK",import:()=>import("./chunk-y0e2ymas.js")},{id:"ballerina",name:"Ballerina",import:()=>import("./chunk-gsnrqmzp.js")},{id:"bat",name:"Batch File",aliases:["batch"],import:()=>import("./chunk-17g5e3tb.js")},{id:"beancount",name:"Beancount",import:()=>import("./chunk-mvb82v3n.js")},{id:"berry",name:"Berry",aliases:["be"],import:()=>import("./chunk-fftvnc8t.js")},{id:"bibtex",name:"BibTeX",import:()=>import("./chunk-6qyeer8n.js")},{id:"bicep",name:"Bicep",import:()=>import("./chunk-xkc2ktrh.js")},{id:"blade",name:"Blade",import:()=>import("./chunk-n6v7menj.js")},{id:"bsl",name:"1C (Enterprise)",aliases:["1c"],import:()=>import("./chunk-j6s60n91.js")},{id:"c",name:"C",import:()=>import("./chunk-sq9spyfd.js")},{id:"c3",name:"C3",import:()=>import("./chunk-wd17hcv5.js")},{id:"cadence",name:"Cadence",aliases:["cdc"],import:()=>import("./chunk-8vr1wy0r.js")},{id:"cairo",name:"Cairo",import:()=>import("./chunk-wbg38h5j.js")},{id:"clarity",name:"Clarity",import:()=>import("./chunk-pc3w4gkp.js")},{id:"clojure",name:"Clojure",aliases:["clj"],import:()=>import("./chunk-hgkaxnh7.js")},{id:"cmake",name:"CMake",import:()=>import("./chunk-ewx6fr7a.js")},{id:"cobol",name:"COBOL",import:()=>import("./chunk-1m8bmdzc.js")},{id:"codeowners",name:"CODEOWNERS",import:()=>import("./chunk-56q8b04m.js")},{id:"codeql",name:"CodeQL",aliases:["ql"],import:()=>import("./chunk-h06hyckd.js")},{id:"coffee",name:"CoffeeScript",aliases:["coffeescript"],import:()=>import("./chunk-fd4dk58v.js")},{id:"common-lisp",name:"Common Lisp",aliases:["lisp"],import:()=>import("./chunk-tkp1zzgb.js")},{id:"coq",name:"Coq",import:()=>import("./chunk-kkks4cbp.js")},{id:"cpp",name:"C++",aliases:["c++"],import:()=>import("./chunk-731nq1br.js")},{id:"crystal",name:"Crystal",import:()=>import("./chunk-r5crgj5q.js")},{id:"csharp",name:"C#",aliases:["c#","cs"],import:()=>import("./chunk-2yk5xgha.js")},{id:"css",name:"CSS",import:()=>import("./chunk-7w75nxwb.js")},{id:"csv",name:"CSV",import:()=>import("./chunk-f2p8rps5.js")},{id:"cue",name:"CUE",import:()=>import("./chunk-jyrs3ysr.js")},{id:"cypher",name:"Cypher",aliases:["cql"],import:()=>import("./chunk-w93s735t.js")},{id:"d",name:"D",import:()=>import("./chunk-sk4n2anv.js")},{id:"dart",name:"Dart",import:()=>import("./chunk-ctet86gc.js")},{id:"dax",name:"DAX",import:()=>import("./chunk-zh77yp9z.js")},{id:"desktop",name:"Desktop",import:()=>import("./chunk-77chzpqs.js")},{id:"diff",name:"Diff",import:()=>import("./chunk-vrv07424.js")},{id:"docker",name:"Dockerfile",aliases:["dockerfile"],import:()=>import("./chunk-pqq81gzv.js")},{id:"dotenv",name:"dotEnv",import:()=>import("./chunk-f3mf8qk2.js")},{id:"dream-maker",name:"Dream Maker",import:()=>import("./chunk-rbebjqfq.js")},{id:"edge",name:"Edge",import:()=>import("./chunk-z88rcc8t.js")},{id:"elixir",name:"Elixir",import:()=>import("./chunk-s5yace4y.js")},{id:"elm",name:"Elm",import:()=>import("./chunk-0kvk3r1g.js")},{id:"emacs-lisp",name:"Emacs Lisp",aliases:["elisp"],import:()=>import("./chunk-kgj1ssyj.js")},{id:"erb",name:"ERB",import:()=>import("./chunk-y6mvs6yw.js")},{id:"erlang",name:"Erlang",aliases:["erl"],import:()=>import("./chunk-21gm4tm7.js")},{id:"fennel",name:"Fennel",import:()=>import("./chunk-1tj3j2rd.js")},{id:"fish",name:"Fish",import:()=>import("./chunk-6vhg46d2.js")},{id:"fluent",name:"Fluent",aliases:["ftl"],import:()=>import("./chunk-x8z2fzz8.js")},{id:"fortran-fixed-form",name:"Fortran (Fixed Form)",aliases:["f","for","f77"],import:()=>import("./chunk-yhxvqyz4.js")},{id:"fortran-free-form",name:"Fortran (Free Form)",aliases:["f90","f95","f03","f08","f18"],import:()=>import("./chunk-vqpam6p8.js")},{id:"fsharp",name:"F#",aliases:["f#","fs"],import:()=>import("./chunk-t6x8a62a.js")},{id:"gdresource",name:"GDResource",aliases:["tscn","tres"],import:()=>import("./chunk-f8c6jyrc.js")},{id:"gdscript",name:"GDScript",aliases:["gd"],import:()=>import("./chunk-82xzyhyv.js")},{id:"gdshader",name:"GDShader",import:()=>import("./chunk-wcyrmfpn.js")},{id:"genie",name:"Genie",import:()=>import("./chunk-gbrg4c7y.js")},{id:"gherkin",name:"Gherkin",import:()=>import("./chunk-ywbbf9eh.js")},{id:"git-commit",name:"Git Commit Message",import:()=>import("./chunk-hv4arqm5.js")},{id:"git-rebase",name:"Git Rebase Message",import:()=>import("./chunk-nks89eba.js")},{id:"gleam",name:"Gleam",import:()=>import("./chunk-3s3b7nzy.js")},{id:"glimmer-js",name:"Glimmer JS",aliases:["gjs"],import:()=>import("./chunk-wkc7w10f.js")},{id:"glimmer-ts",name:"Glimmer TS",aliases:["gts"],import:()=>import("./chunk-wznpd7sd.js")},{id:"glsl",name:"GLSL",import:()=>import("./chunk-p7ha3t1f.js")},{id:"gn",name:"GN",import:()=>import("./chunk-nwx5cbjc.js")},{id:"gnuplot",name:"Gnuplot",import:()=>import("./chunk-bz79zq7h.js")},{id:"go",name:"Go",import:()=>import("./chunk-pm5gceg0.js")},{id:"graphql",name:"GraphQL",aliases:["gql"],import:()=>import("./chunk-mns6edxc.js")},{id:"groovy",name:"Groovy",import:()=>import("./chunk-hzqb4sy6.js")},{id:"hack",name:"Hack",import:()=>import("./chunk-wb43p5km.js")},{id:"haml",name:"Ruby Haml",import:()=>import("./chunk-ez2xn1tq.js")},{id:"handlebars",name:"Handlebars",aliases:["hbs"],import:()=>import("./chunk-2a6kan82.js")},{id:"haskell",name:"Haskell",aliases:["hs"],import:()=>import("./chunk-tx117rah.js")},{id:"haxe",name:"Haxe",import:()=>import("./chunk-0cbmnyee.js")},{id:"hcl",name:"HashiCorp HCL",import:()=>import("./chunk-wvmnb75v.js")},{id:"hjson",name:"Hjson",import:()=>import("./chunk-1xjj19pz.js")},{id:"hlsl",name:"HLSL",import:()=>import("./chunk-rx707y69.js")},{id:"html",name:"HTML",import:()=>import("./chunk-1fmdjx58.js")},{id:"html-derivative",name:"HTML (Derivative)",import:()=>import("./chunk-bqzvv2dy.js")},{id:"http",name:"HTTP",import:()=>import("./chunk-1zbnmy0p.js")},{id:"hurl",name:"Hurl",import:()=>import("./chunk-k1yv7tpj.js")},{id:"hxml",name:"HXML",import:()=>import("./chunk-6eyx9kb0.js")},{id:"hy",name:"Hy",import:()=>import("./chunk-91gd665t.js")},{id:"imba",name:"Imba",import:()=>import("./chunk-m0vtra47.js")},{id:"ini",name:"INI",aliases:["properties"],import:()=>import("./chunk-zjemnf8v.js")},{id:"java",name:"Java",import:()=>import("./chunk-j0szwqey.js")},{id:"javascript",name:"JavaScript",aliases:["js","cjs","mjs"],import:()=>import("./chunk-rg8hdkt2.js")},{id:"jinja",name:"Jinja",import:()=>import("./chunk-ywa5z7d9.js")},{id:"jison",name:"Jison",import:()=>import("./chunk-5rmyjm7a.js")},{id:"json",name:"JSON",import:()=>import("./chunk-sw6b067z.js")},{id:"json5",name:"JSON5",import:()=>import("./chunk-8ee7jvcr.js")},{id:"jsonc",name:"JSON with Comments",import:()=>import("./chunk-b4qvb571.js")},{id:"jsonl",name:"JSON Lines",import:()=>import("./chunk-1xdz3wdt.js")},{id:"jsonnet",name:"Jsonnet",import:()=>import("./chunk-4agrg21g.js")},{id:"jssm",name:"JSSM",aliases:["fsl"],import:()=>import("./chunk-xa4apmpd.js")},{id:"jsx",name:"JSX",import:()=>import("./chunk-ndk5mkc1.js")},{id:"julia",name:"Julia",aliases:["jl"],import:()=>import("./chunk-kq7y5ybe.js")},{id:"kdl",name:"KDL",import:()=>import("./chunk-k626mmdc.js")},{id:"kotlin",name:"Kotlin",aliases:["kt","kts"],import:()=>import("./chunk-vsydmxfh.js")},{id:"kusto",name:"Kusto",aliases:["kql"],import:()=>import("./chunk-xhjrdhgk.js")},{id:"latex",name:"LaTeX",import:()=>import("./chunk-2cfemb9q.js")},{id:"lean",name:"Lean 4",aliases:["lean4"],import:()=>import("./chunk-ka0pqrag.js")},{id:"less",name:"Less",import:()=>import("./chunk-9mjq1xxc.js")},{id:"liquid",name:"Liquid",import:()=>import("./chunk-6yb36qx6.js")},{id:"llvm",name:"LLVM IR",import:()=>import("./chunk-vy4ecvry.js")},{id:"log",name:"Log file",import:()=>import("./chunk-917pj3vx.js")},{id:"logo",name:"Logo",import:()=>import("./chunk-1z3yy9vz.js")},{id:"lua",name:"Lua",import:()=>import("./chunk-esskh0ge.js")},{id:"luau",name:"Luau",import:()=>import("./chunk-jz8tmenz.js")},{id:"make",name:"Makefile",aliases:["makefile"],import:()=>import("./chunk-y6z502pz.js")},{id:"markdown",name:"Markdown",aliases:["md"],import:()=>import("./chunk-sepabvgd.js")},{id:"marko",name:"Marko",import:()=>import("./chunk-bzanqq7a.js")},{id:"matlab",name:"MATLAB",import:()=>import("./chunk-pz5xskrk.js")},{id:"mdc",name:"MDC",import:()=>import("./chunk-dz0229fs.js")},{id:"mdx",name:"MDX",import:()=>import("./chunk-xf7ypd1b.js")},{id:"mermaid",name:"Mermaid",aliases:["mmd"],import:()=>import("./chunk-t4vfr2g0.js")},{id:"mipsasm",name:"MIPS Assembly",aliases:["mips"],import:()=>import("./chunk-vwhxfs9r.js")},{id:"mojo",name:"Mojo",import:()=>import("./chunk-h1bjeyn7.js")},{id:"moonbit",name:"MoonBit",aliases:["mbt","mbti"],import:()=>import("./chunk-2mrbrsta.js")},{id:"move",name:"Move",import:()=>import("./chunk-7k80bxbe.js")},{id:"narrat",name:"Narrat Language",aliases:["nar"],import:()=>import("./chunk-av215sh3.js")},{id:"nextflow",name:"Nextflow",aliases:["nf"],import:()=>import("./chunk-6cs4tf5a.js")},{id:"nginx",name:"Nginx",import:()=>import("./chunk-wkf1j21b.js")},{id:"nim",name:"Nim",import:()=>import("./chunk-mrbn4knm.js")},{id:"nix",name:"Nix",import:()=>import("./chunk-ydc7pd3b.js")},{id:"nushell",name:"nushell",aliases:["nu"],import:()=>import("./chunk-kk4w0prd.js")},{id:"objective-c",name:"Objective-C",aliases:["objc"],import:()=>import("./chunk-kys8sc0j.js")},{id:"objective-cpp",name:"Objective-C++",import:()=>import("./chunk-s2wchktz.js")},{id:"ocaml",name:"OCaml",import:()=>import("./chunk-gxc7a8cz.js")},{id:"odin",name:"Odin",import:()=>import("./chunk-mfyvxat8.js")},{id:"openscad",name:"OpenSCAD",aliases:["scad"],import:()=>import("./chunk-kc8375a8.js")},{id:"pascal",name:"Pascal",import:()=>import("./chunk-htns6qnb.js")},{id:"perl",name:"Perl",import:()=>import("./chunk-z5z774pp.js")},{id:"php",name:"PHP",import:()=>import("./chunk-n8apqh5d.js")},{id:"pkl",name:"Pkl",import:()=>import("./chunk-fvhtfw18.js")},{id:"plsql",name:"PL/SQL",import:()=>import("./chunk-bs9fj12n.js")},{id:"po",name:"Gettext PO",aliases:["pot","potx"],import:()=>import("./chunk-06dj0dnz.js")},{id:"polar",name:"Polar",import:()=>import("./chunk-9hnbyswz.js")},{id:"postcss",name:"PostCSS",import:()=>import("./chunk-rc81vkve.js")},{id:"powerquery",name:"PowerQuery",import:()=>import("./chunk-3d8rzv4d.js")},{id:"powershell",name:"PowerShell",aliases:["ps","ps1"],import:()=>import("./chunk-hgs9vzm2.js")},{id:"prisma",name:"Prisma",import:()=>import("./chunk-vgeyt962.js")},{id:"prolog",name:"Prolog",import:()=>import("./chunk-ceb97hw6.js")},{id:"proto",name:"Protocol Buffer 3",aliases:["protobuf"],import:()=>import("./chunk-0jtrg9s1.js")},{id:"pug",name:"Pug",aliases:["jade"],import:()=>import("./chunk-ctp90f8y.js")},{id:"puppet",name:"Puppet",import:()=>import("./chunk-7v4352jx.js")},{id:"purescript",name:"PureScript",import:()=>import("./chunk-ny61b4ve.js")},{id:"python",name:"Python",aliases:["py"],import:()=>import("./chunk-mtyqtnv0.js")},{id:"qml",name:"QML",import:()=>import("./chunk-gps0pyf7.js")},{id:"qmldir",name:"QML Directory",import:()=>import("./chunk-4k15drqf.js")},{id:"qss",name:"Qt Style Sheets",import:()=>import("./chunk-66sfgeag.js")},{id:"r",name:"R",import:()=>import("./chunk-3rew4tyk.js")},{id:"racket",name:"Racket",import:()=>import("./chunk-sdhd2kpk.js")},{id:"raku",name:"Raku",aliases:["perl6"],import:()=>import("./chunk-tj729ry3.js")},{id:"razor",name:"ASP.NET Razor",import:()=>import("./chunk-ms3sqsez.js")},{id:"reg",name:"Windows Registry Script",import:()=>import("./chunk-87w9rexn.js")},{id:"regexp",name:"RegExp",aliases:["regex"],import:()=>import("./chunk-xnx0j1hw.js")},{id:"rel",name:"Rel",import:()=>import("./chunk-3w98g1h4.js")},{id:"riscv",name:"RISC-V",import:()=>import("./chunk-ynnaxz2z.js")},{id:"ron",name:"RON",import:()=>import("./chunk-v9qb0fer.js")},{id:"rosmsg",name:"ROS Interface",import:()=>import("./chunk-qpwtcr53.js")},{id:"rst",name:"reStructuredText",import:()=>import("./chunk-5n57csbz.js")},{id:"ruby",name:"Ruby",aliases:["rb"],import:()=>import("./chunk-zmsq5xc7.js")},{id:"rust",name:"Rust",aliases:["rs"],import:()=>import("./chunk-bjqn0pzz.js")},{id:"sas",name:"SAS",import:()=>import("./chunk-0x0r76m6.js")},{id:"sass",name:"Sass",import:()=>import("./chunk-x01t9e3q.js")},{id:"scala",name:"Scala",import:()=>import("./chunk-7pwrx1pp.js")},{id:"scheme",name:"Scheme",import:()=>import("./chunk-ejh8spnd.js")},{id:"scss",name:"SCSS",import:()=>import("./chunk-am5r5ynh.js")},{id:"sdbl",name:"1C (Query)",aliases:["1c-query"],import:()=>import("./chunk-5bvkhjg1.js")},{id:"shaderlab",name:"ShaderLab",aliases:["shader"],import:()=>import("./chunk-ezh4rq18.js")},{id:"shellscript",name:"Shell",aliases:["bash","sh","shell","zsh"],import:()=>import("./chunk-h5y1vfrx.js")},{id:"shellsession",name:"Shell Session",aliases:["console"],import:()=>import("./chunk-kx3dsqc5.js")},{id:"smalltalk",name:"Smalltalk",import:()=>import("./chunk-yzk3bfzn.js")},{id:"solidity",name:"Solidity",import:()=>import("./chunk-qd2hkayk.js")},{id:"soy",name:"Closure Templates",aliases:["closure-templates"],import:()=>import("./chunk-6qbdcv3t.js")},{id:"sparql",name:"SPARQL",import:()=>import("./chunk-wb08g5z8.js")},{id:"splunk",name:"Splunk Query Language",aliases:["spl"],import:()=>import("./chunk-0kan91hr.js")},{id:"sql",name:"SQL",import:()=>import("./chunk-nvnw7mcb.js")},{id:"ssh-config",name:"SSH Config",import:()=>import("./chunk-r5psjv6v.js")},{id:"stata",name:"Stata",import:()=>import("./chunk-cayjw3gk.js")},{id:"stylus",name:"Stylus",aliases:["styl"],import:()=>import("./chunk-pt1m6xh9.js")},{id:"surrealql",name:"SurrealQL",aliases:["surql"],import:()=>import("./chunk-tq7jpqr7.js")},{id:"svelte",name:"Svelte",import:()=>import("./chunk-emjqnzzj.js")},{id:"swift",name:"Swift",import:()=>import("./chunk-be8bz8xh.js")},{id:"system-verilog",name:"SystemVerilog",import:()=>import("./chunk-n92ey5c2.js")},{id:"systemd",name:"Systemd Units",import:()=>import("./chunk-rt7af3wp.js")},{id:"talonscript",name:"TalonScript",aliases:["talon"],import:()=>import("./chunk-pj843s6s.js")},{id:"tasl",name:"Tasl",import:()=>import("./chunk-dnpybaez.js")},{id:"tcl",name:"Tcl",import:()=>import("./chunk-zqxrtejz.js")},{id:"templ",name:"Templ",import:()=>import("./chunk-250846sw.js")},{id:"terraform",name:"Terraform",aliases:["tf","tfvars"],import:()=>import("./chunk-whdmep96.js")},{id:"tex",name:"TeX",import:()=>import("./chunk-7n5b43s8.js")},{id:"toml",name:"TOML",import:()=>import("./chunk-59vj8mx3.js")},{id:"ts-tags",name:"TypeScript with Tags",aliases:["lit"],import:()=>import("./chunk-asdze5kz.js")},{id:"tsv",name:"TSV",import:()=>import("./chunk-qzy0w65x.js")},{id:"tsx",name:"TSX",import:()=>import("./chunk-cv5akzkw.js")},{id:"turtle",name:"Turtle",import:()=>import("./chunk-kr6cv1mp.js")},{id:"twig",name:"Twig",import:()=>import("./chunk-mft6e1b3.js")},{id:"typescript",name:"TypeScript",aliases:["ts","cts","mts"],import:()=>import("./chunk-7yf45m28.js")},{id:"typespec",name:"TypeSpec",aliases:["tsp"],import:()=>import("./chunk-fm3k6prw.js")},{id:"typst",name:"Typst",aliases:["typ"],import:()=>import("./chunk-r9dm0gyn.js")},{id:"v",name:"V",import:()=>import("./chunk-dp2418kp.js")},{id:"vala",name:"Vala",import:()=>import("./chunk-fdhzjb42.js")},{id:"vb",name:"Visual Basic",aliases:["cmd"],import:()=>import("./chunk-wdm62dbr.js")},{id:"verilog",name:"Verilog",import:()=>import("./chunk-7wa89vcy.js")},{id:"vhdl",name:"VHDL",import:()=>import("./chunk-54kyvbh7.js")},{id:"viml",name:"Vim Script",aliases:["vim","vimscript"],import:()=>import("./chunk-gkhxerej.js")},{id:"vue",name:"Vue",import:()=>import("./chunk-3emyjvqg.js")},{id:"vue-html",name:"Vue HTML",import:()=>import("./chunk-q6m1k4fq.js")},{id:"vue-vine",name:"Vue Vine",import:()=>import("./chunk-z0wdan61.js")},{id:"vyper",name:"Vyper",aliases:["vy"],import:()=>import("./chunk-0k9tc7ys.js")},{id:"wasm",name:"WebAssembly",import:()=>import("./chunk-748hk53z.js")},{id:"wenyan",name:"Wenyan",aliases:["文言"],import:()=>import("./chunk-xjwkmvfz.js")},{id:"wgsl",name:"WGSL",import:()=>import("./chunk-0cknr23d.js")},{id:"wikitext",name:"Wikitext",aliases:["mediawiki","wiki"],import:()=>import("./chunk-kc6rwv2m.js")},{id:"wit",name:"WebAssembly Interface Types",import:()=>import("./chunk-w5qvj179.js")},{id:"wolfram",name:"Wolfram",aliases:["wl"],import:()=>import("./chunk-4asb3qnd.js")},{id:"xml",name:"XML",import:()=>import("./chunk-8arg48f8.js")},{id:"xsl",name:"XSL",import:()=>import("./chunk-ffzytaw1.js")},{id:"yaml",name:"YAML",aliases:["yml"],import:()=>import("./chunk-hmtm22t7.js")},{id:"zenscript",name:"ZenScript",import:()=>import("./chunk-ycthcn27.js")},{id:"zig",name:"Zig",import:()=>import("./chunk-8gm5e25z.js")}],e9=Object.fromEntries(WJ.map((Z)=>[Z.id,Z.import])),ZW=Object.fromEntries(WJ.flatMap((Z)=>Z.aliases?.map((Y)=>[Y,Z.import])||[])),UJ={...e9,...ZW};var YW=[{id:"andromeeda",displayName:"Andromeeda",type:"dark",import:()=>import("./chunk-h0b5na4r.js")},{id:"aurora-x",displayName:"Aurora X",type:"dark",import:()=>import("./chunk-53agfxhn.js")},{id:"ayu-dark",displayName:"Ayu Dark",type:"dark",import:()=>import("./chunk-8qh81vdm.js")},{id:"ayu-light",displayName:"Ayu Light",type:"light",import:()=>import("./chunk-6bhkrdb2.js")},{id:"ayu-mirage",displayName:"Ayu Mirage",type:"dark",import:()=>import("./chunk-4vhwsrc0.js")},{id:"catppuccin-frappe",displayName:"Catppuccin Frappé",type:"dark",import:()=>import("./chunk-6rhb6xym.js")},{id:"catppuccin-latte",displayName:"Catppuccin Latte",type:"light",import:()=>import("./chunk-8jhmnz2v.js")},{id:"catppuccin-macchiato",displayName:"Catppuccin Macchiato",type:"dark",import:()=>import("./chunk-ja5m6q40.js")},{id:"catppuccin-mocha",displayName:"Catppuccin Mocha",type:"dark",import:()=>import("./chunk-wqvqvv9e.js")},{id:"dark-plus",displayName:"Dark Plus",type:"dark",import:()=>import("./chunk-7khjf5c1.js")},{id:"dracula",displayName:"Dracula Theme",type:"dark",import:()=>import("./chunk-jsqwhbbt.js")},{id:"dracula-soft",displayName:"Dracula Theme Soft",type:"dark",import:()=>import("./chunk-ewxacd5v.js")},{id:"everforest-dark",displayName:"Everforest Dark",type:"dark",import:()=>import("./chunk-4yddzp8e.js")},{id:"everforest-light",displayName:"Everforest Light",type:"light",import:()=>import("./chunk-n8f65qbg.js")},{id:"github-dark",displayName:"GitHub Dark",type:"dark",import:()=>import("./chunk-63ncy5kr.js")},{id:"github-dark-default",displayName:"GitHub Dark Default",type:"dark",import:()=>import("./chunk-sd65hz9x.js")},{id:"github-dark-dimmed",displayName:"GitHub Dark Dimmed",type:"dark",import:()=>import("./chunk-pz4hhw24.js")},{id:"github-dark-high-contrast",displayName:"GitHub Dark High Contrast",type:"dark",import:()=>import("./chunk-f51sey9j.js")},{id:"github-light",displayName:"GitHub Light",type:"light",import:()=>import("./chunk-q0z3nkep.js")},{id:"github-light-default",displayName:"GitHub Light Default",type:"light",import:()=>import("./chunk-3009w43m.js")},{id:"github-light-high-contrast",displayName:"GitHub Light High Contrast",type:"light",import:()=>import("./chunk-vg853h8j.js")},{id:"gruvbox-dark-hard",displayName:"Gruvbox Dark Hard",type:"dark",import:()=>import("./chunk-6r5npryc.js")},{id:"gruvbox-dark-medium",displayName:"Gruvbox Dark Medium",type:"dark",import:()=>import("./chunk-9hznfyjs.js")},{id:"gruvbox-dark-soft",displayName:"Gruvbox Dark Soft",type:"dark",import:()=>import("./chunk-774cjjgt.js")},{id:"gruvbox-light-hard",displayName:"Gruvbox Light Hard",type:"light",import:()=>import("./chunk-aeajq5ft.js")},{id:"gruvbox-light-medium",displayName:"Gruvbox Light Medium",type:"light",import:()=>import("./chunk-pcwsyc9b.js")},{id:"gruvbox-light-soft",displayName:"Gruvbox Light Soft",type:"light",import:()=>import("./chunk-hraqhe5e.js")},{id:"horizon",displayName:"Horizon",type:"dark",import:()=>import("./chunk-gvjvbwk6.js")},{id:"houston",displayName:"Houston",type:"dark",import:()=>import("./chunk-b3g51e2m.js")},{id:"kanagawa-dragon",displayName:"Kanagawa Dragon",type:"dark",import:()=>import("./chunk-denz6x2z.js")},{id:"kanagawa-lotus",displayName:"Kanagawa Lotus",type:"light",import:()=>import("./chunk-s22hm2jp.js")},{id:"kanagawa-wave",displayName:"Kanagawa Wave",type:"dark",import:()=>import("./chunk-nrkhbe10.js")},{id:"laserwave",displayName:"LaserWave",type:"dark",import:()=>import("./chunk-5wkah698.js")},{id:"light-plus",displayName:"Light Plus",type:"light",import:()=>import("./chunk-rsb82wcd.js")},{id:"material-theme",displayName:"Material Theme",type:"dark",import:()=>import("./chunk-vcsqkf9c.js")},{id:"material-theme-darker",displayName:"Material Theme Darker",type:"dark",import:()=>import("./chunk-sv97fsr8.js")},{id:"material-theme-lighter",displayName:"Material Theme Lighter",type:"light",import:()=>import("./chunk-9rmve4r4.js")},{id:"material-theme-ocean",displayName:"Material Theme Ocean",type:"dark",import:()=>import("./chunk-6dm27qn5.js")},{id:"material-theme-palenight",displayName:"Material Theme Palenight",type:"dark",import:()=>import("./chunk-7z7g35xf.js")},{id:"min-dark",displayName:"Min Dark",type:"dark",import:()=>import("./chunk-bjctrgpr.js")},{id:"min-light",displayName:"Min Light",type:"light",import:()=>import("./chunk-fb70a9sy.js")},{id:"monokai",displayName:"Monokai",type:"dark",import:()=>import("./chunk-tq142qfa.js")},{id:"night-owl",displayName:"Night Owl",type:"dark",import:()=>import("./chunk-hjs9ffqg.js")},{id:"night-owl-light",displayName:"Night Owl Light",type:"light",import:()=>import("./chunk-bba2g9qj.js")},{id:"nord",displayName:"Nord",type:"dark",import:()=>import("./chunk-r9qyzgns.js")},{id:"one-dark-pro",displayName:"One Dark Pro",type:"dark",import:()=>import("./chunk-j9za9ext.js")},{id:"one-light",displayName:"One Light",type:"light",import:()=>import("./chunk-nbkkf36e.js")},{id:"plastic",displayName:"Plastic",type:"dark",import:()=>import("./chunk-6fsb1bxc.js")},{id:"poimandres",displayName:"Poimandres",type:"dark",import:()=>import("./chunk-m9xdbw2j.js")},{id:"red",displayName:"Red",type:"dark",import:()=>import("./chunk-w46ermgd.js")},{id:"rose-pine",displayName:"Rosé Pine",type:"dark",import:()=>import("./chunk-e8pjcdmj.js")},{id:"rose-pine-dawn",displayName:"Rosé Pine Dawn",type:"light",import:()=>import("./chunk-wm3z6khn.js")},{id:"rose-pine-moon",displayName:"Rosé Pine Moon",type:"dark",import:()=>import("./chunk-y3c3xgca.js")},{id:"slack-dark",displayName:"Slack Dark",type:"dark",import:()=>import("./chunk-6ag9x0z1.js")},{id:"slack-ochin",displayName:"Slack Ochin",type:"light",import:()=>import("./chunk-7m0c57rj.js")},{id:"snazzy-light",displayName:"Snazzy Light",type:"light",import:()=>import("./chunk-jdvv96q7.js")},{id:"solarized-dark",displayName:"Solarized Dark",type:"dark",import:()=>import("./chunk-3b8scss4.js")},{id:"solarized-light",displayName:"Solarized Light",type:"light",import:()=>import("./chunk-pvzfgkkq.js")},{id:"synthwave-84",displayName:"Synthwave '84",type:"dark",import:()=>import("./chunk-5m8gh94n.js")},{id:"tokyo-night",displayName:"Tokyo Night",type:"dark",import:()=>import("./chunk-xjgnj3p0.js")},{id:"vesper",displayName:"Vesper",type:"dark",import:()=>import("./chunk-mjfe9s8t.js")},{id:"vitesse-black",displayName:"Vitesse Black",type:"dark",import:()=>import("./chunk-wgamcpyt.js")},{id:"vitesse-dark",displayName:"Vitesse Dark",type:"dark",import:()=>import("./chunk-kqemj8nq.js")},{id:"vitesse-light",displayName:"Vitesse Light",type:"light",import:()=>import("./chunk-72cdrnwv.js")}],zJ=Object.fromEntries(YW.map((Z)=>[Z.id,Z.import]));class bY extends Error{constructor(Z){super(Z);this.name="ShikiError"}}function XW(){return 2147483648}function JW(){return typeof performance<"u"?performance.now():Date.now()}var QW=(Z,Y)=>Z+(Y-Z%Y)%Y;async function $W(Z){let Y,X,J={};function Q(M){X=M,J.HEAPU8=new Uint8Array(M),J.HEAPU32=new Uint32Array(M)}function $(M,N,w){J.HEAPU8.copyWithin(M,N,N+w)}function K(M){try{return Y.grow(M-X.byteLength+65535>>>16),Q(Y.buffer),1}catch{}}function U(M){let N=J.HEAPU8.length;M=M>>>0;let w=XW();if(M>w)return!1;for(let L=1;L<=4;L*=2){let B=N*(1+0.2/L);B=Math.min(B,M+100663296);let C=Math.min(w,QW(Math.max(M,B),65536));if(K(C))return!0}return!1}let W=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function z(M,N,w=1024){let L=N+w,B=N;while(M[B]&&!(B>=L))++B;if(B-N>16&&M.buffer&&W)return W.decode(M.subarray(N,B));let C="";while(N<B){let R=M[N++];if(!(R&128)){C+=String.fromCharCode(R);continue}let D=M[N++]&63;if((R&224)===192){C+=String.fromCharCode((R&31)<<6|D);continue}let f=M[N++]&63;if((R&240)===224)R=(R&15)<<12|D<<6|f;else R=(R&7)<<18|D<<12|f<<6|M[N++]&63;if(R<65536)C+=String.fromCharCode(R);else{let V=R-65536;C+=String.fromCharCode(55296|V>>10,56320|V&1023)}}return C}function H(M,N){return M?z(J.HEAPU8,M,N):""}let G={emscripten_get_now:JW,emscripten_memcpy_big:$,emscripten_resize_heap:U,fd_write:()=>0};async function F(){let N=await Z({env:G,wasi_snapshot_preview1:G});Y=N.memory,Q(Y.buffer),Object.assign(J,N),J.UTF8ToString=H}return await F(),J}var KW=Object.defineProperty,WW=(Z,Y,X)=>(Y in Z)?KW(Z,Y,{enumerable:!0,configurable:!0,writable:!0,value:X}):Z[Y]=X,OZ=(Z,Y,X)=>WW(Z,typeof Y!=="symbol"?Y+"":Y,X),NZ=null;function UW(Z){throw new bY(Z.UTF8ToString(Z.getLastOnigError()))}class TY{constructor(Z){OZ(this,"utf16Length"),OZ(this,"utf8Length"),OZ(this,"utf16Value"),OZ(this,"utf8Value"),OZ(this,"utf16OffsetToUtf8"),OZ(this,"utf8OffsetToUtf16");let Y=Z.length,X=TY._utf8ByteLength(Z),J=X!==Y,Q=J?new Uint32Array(Y+1):null;if(J)Q[Y]=X;let $=J?new Uint32Array(X+1):null;if(J)$[X]=Y;let K=new Uint8Array(X),U=0;for(let W=0;W<Y;W++){let z=Z.charCodeAt(W),H=z,G=!1;if(z>=55296&&z<=56319){if(W+1<Y){let F=Z.charCodeAt(W+1);if(F>=56320&&F<=57343)H=(z-55296<<10)+65536|F-56320,G=!0}}if(J){if(Q[W]=U,G)Q[W+1]=U;if(H<=127)$[U+0]=W;else if(H<=2047)$[U+0]=W,$[U+1]=W;else if(H<=65535)$[U+0]=W,$[U+1]=W,$[U+2]=W;else $[U+0]=W,$[U+1]=W,$[U+2]=W,$[U+3]=W}if(H<=127)K[U++]=H;else if(H<=2047)K[U++]=192|(H&1984)>>>6,K[U++]=128|(H&63)>>>0;else if(H<=65535)K[U++]=224|(H&61440)>>>12,K[U++]=128|(H&4032)>>>6,K[U++]=128|(H&63)>>>0;else K[U++]=240|(H&1835008)>>>18,K[U++]=128|(H&258048)>>>12,K[U++]=128|(H&4032)>>>6,K[U++]=128|(H&63)>>>0;if(G)W++}this.utf16Length=Y,this.utf8Length=X,this.utf16Value=Z,this.utf8Value=K,this.utf16OffsetToUtf8=Q,this.utf8OffsetToUtf16=$}static _utf8ByteLength(Z){let Y=0;for(let X=0,J=Z.length;X<J;X++){let Q=Z.charCodeAt(X),$=Q,K=!1;if(Q>=55296&&Q<=56319){if(X+1<J){let U=Z.charCodeAt(X+1);if(U>=56320&&U<=57343)$=(Q-55296<<10)+65536|U-56320,K=!0}}if($<=127)Y+=1;else if($<=2047)Y+=2;else if($<=65535)Y+=3;else Y+=4;if(K)X++}return Y}createString(Z){let Y=Z.omalloc(this.utf8Length);return Z.HEAPU8.set(this.utf8Value,Y),Y}}var fY=class Z{constructor(Y){if(OZ(this,"id",++Z.LAST_ID),OZ(this,"_onigBinding"),OZ(this,"content"),OZ(this,"utf16Length"),OZ(this,"utf8Length"),OZ(this,"utf16OffsetToUtf8"),OZ(this,"utf8OffsetToUtf16"),OZ(this,"ptr"),!NZ)throw new bY("Must invoke loadWasm first.");this._onigBinding=NZ,this.content=Y;let X=new TY(Y);if(this.utf16Length=X.utf16Length,this.utf8Length=X.utf8Length,this.utf16OffsetToUtf8=X.utf16OffsetToUtf8,this.utf8OffsetToUtf16=X.utf8OffsetToUtf16,this.utf8Length<1e4&&!Z._sharedPtrInUse){if(!Z._sharedPtr)Z._sharedPtr=NZ.omalloc(1e4);Z._sharedPtrInUse=!0,NZ.HEAPU8.set(X.utf8Value,Z._sharedPtr),this.ptr=Z._sharedPtr}else this.ptr=X.createString(NZ)}convertUtf8OffsetToUtf16(Y){if(this.utf8OffsetToUtf16){if(Y<0)return 0;if(Y>this.utf8Length)return this.utf16Length;return this.utf8OffsetToUtf16[Y]}return Y}convertUtf16OffsetToUtf8(Y){if(this.utf16OffsetToUtf8){if(Y<0)return 0;if(Y>this.utf16Length)return this.utf8Length;return this.utf16OffsetToUtf8[Y]}return Y}dispose(){if(this.ptr===Z._sharedPtr)Z._sharedPtrInUse=!1;else this._onigBinding.ofree(this.ptr)}};OZ(fY,"LAST_ID",0);OZ(fY,"_sharedPtr",0);OZ(fY,"_sharedPtrInUse",!1);var HJ=fY;class GJ{constructor(Z){if(OZ(this,"_onigBinding"),OZ(this,"_ptr"),!NZ)throw new bY("Must invoke loadWasm first.");let Y=[],X=[];for(let K=0,U=Z.length;K<U;K++){let W=new TY(Z[K]);Y[K]=W.createString(NZ),X[K]=W.utf8Length}let J=NZ.omalloc(4*Z.length);NZ.HEAPU32.set(Y,J/4);let Q=NZ.omalloc(4*Z.length);NZ.HEAPU32.set(X,Q/4);let $=NZ.createOnigScanner(J,Q,Z.length);for(let K=0,U=Z.length;K<U;K++)NZ.ofree(Y[K]);if(NZ.ofree(Q),NZ.ofree(J),$===0)UW(NZ);this._onigBinding=NZ,this._ptr=$}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(Z,Y,X){let J=0;if(typeof X==="number")J=X;if(typeof Z==="string"){Z=new HJ(Z);let Q=this._findNextMatchSync(Z,Y,!1,J);return Z.dispose(),Q}return this._findNextMatchSync(Z,Y,!1,J)}_findNextMatchSync(Z,Y,X,J){let Q=this._onigBinding,$=Q.findNextOnigScannerMatch(this._ptr,Z.id,Z.ptr,Z.utf8Length,Z.convertUtf16OffsetToUtf8(Y),J);if($===0)return null;let K=Q.HEAPU32,U=$/4,W=K[U++],z=K[U++],H=[];for(let G=0;G<z;G++){let F=Z.convertUtf8OffsetToUtf16(K[U++]),M=Z.convertUtf8OffsetToUtf16(K[U++]);H[G]={start:F,end:M,length:M-F}}return{index:W,captureIndices:H}}}function zW(Z){return typeof Z.instantiator==="function"}function HW(Z){return typeof Z.default==="function"}function GW(Z){return typeof Z.data<"u"}function OW(Z){return typeof Response<"u"&&Z instanceof Response}function qW(Z){return typeof ArrayBuffer<"u"&&(Z instanceof ArrayBuffer||ArrayBuffer.isView(Z))||typeof Buffer<"u"&&Buffer.isBuffer?.(Z)||typeof SharedArrayBuffer<"u"&&Z instanceof SharedArrayBuffer||typeof Uint32Array<"u"&&Z instanceof Uint32Array}var EY;function FW(Z){if(EY)return EY;async function Y(){NZ=await $W(async(X)=>{let J=Z;if(J=await J,typeof J==="function")J=await J(X);if(typeof J==="function")J=await J(X);if(zW(J))J=await J.instantiator(X);else if(HW(J))J=await J.default(X);else{if(GW(J))J=J.data;if(OW(J))if(typeof WebAssembly.instantiateStreaming==="function")J=await MW(J)(X);else J=await NW(J)(X);else if(qW(J))J=await rX(J)(X);else if(J instanceof WebAssembly.Module)J=await rX(J)(X);else if("default"in J&&J.default instanceof WebAssembly.Module)J=await rX(J.default)(X)}if("instance"in J)J=J.instance;if("exports"in J)J=J.exports;return J})}return EY=Y(),EY}function rX(Z){return(Y)=>WebAssembly.instantiate(Z,Y)}function MW(Z){return(Y)=>WebAssembly.instantiateStreaming(Z,Y)}function NW(Z){return async(Y)=>{let X=await Z.arrayBuffer();return WebAssembly.instantiate(X,Y)}}async function OJ(Z){if(Z)await FW(Z);return{createScanner(Y){return new GJ(Y.map((X)=>typeof X==="string"?X:X.source))},createString(Y){return new HJ(Y)}}}var qJ=$J({langs:UJ,themes:zJ,engine:()=>OJ(import("./chunk-v3t7hcht.js"))}),{codeToHtml:_W,codeToHast:AW,codeToTokens:oX,codeToTokensBase:wW,codeToTokensWithThemes:BW,getSingletonHighlighter:LW,getLastGrammarState:PW}=KJ(qJ,{guessEmbeddedLanguages:a6});var CZ={h1:{bold:!0,marginBottom:1,color:"#f74cc7ff"},h2:{bold:!0,marginBottom:1,color:"#326cfcff"},h3:{bold:!0,color:"#24ffedff"},h4:{bold:!0,color:"#e29418ff"},h5:{bold:!0,color:"#9fc214ff"},h6:{bold:!0,dimColor:!0,color:"#88eb2bff"},paragraph:{},blockquote:{paddingLeft:1,dimColor:!0,borderTop:!1,borderBottom:!1,borderRight:!1,borderStyle:"single",borderDimColor:!0},code:{marginTop:1},codespan:{dimColor:!0},list:{},listItem:{bullet:"●",paddingLeft:2},hr:{char:"─",width:40,dimColor:!0},link:{color:"#343afcff",underline:!0},strong:{bold:!0},em:{italic:!0},del:{strikethrough:!0,dimColor:!0},image:{color:"blue"},table:{},tableCell:{paddingRight:2}},CW=["color","backgroundColor","dimColor","bold","italic","underline","strikethrough","inverse","wrap"],IW=["paddingLeft","paddingRight","paddingTop","paddingBottom","padding","paddingX","paddingY","marginLeft","marginRight","marginTop","marginBottom","margin","marginX","marginY","borderStyle","borderColor","borderTop","borderBottom","borderLeft","borderRight","borderDimColor","borderTopColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopDimColor","borderBottomDimColor","borderLeftDimColor","borderRightDimColor"];async function vW(Z,Y,X="github-dark"){try{let J=await oX(Z,{lang:Y||"text",theme:X}),Q=[],$=0;for(let K=0;K<J.tokens.length;K++){let U=J.tokens[K];if(U){for(let W of U){let z=W.color||void 0;Q.push(E.jsx(O,{color:z,children:W.content},`token-${$}`)),$++}if(K<J.tokens.length-1)Q.push(E.jsx(O,{children:`
143
- `},`nl-${K}`))}}return Q}catch{return null}}function LZ(Z){if(!Z)return{};let Y={};for(let X of CW)if(X in Z)Y[X]=Z[X];return Y}function tZ(Z){if(!Z)return{};let Y={};for(let X of IW)if(X in Z)Y[X]=Z[X];return Y}function IZ(Z,Y){if(!Z&&!Y)return{};if(!Z)return Y;if(!Y)return Z;return{...Z,...Y}}function DW({code:Z,language:Y,style:X,theme:J}){let[Q,$]=pZ.useState(null),[K,U]=pZ.useState(!0);if(pZ.useEffect(()=>{let W=!1;async function z(){try{let H=await vW(Z,Y,J);if(!W)$(H),U(!1)}catch{if(!W)$(null),U(!1)}}return z(),()=>{W=!0}},[Z,Y,J]),K||!Q)return E.jsx(_,{...tZ(X),children:E.jsx(O,{...LZ(X),children:Z})});return E.jsx(_,{paddingX:2,paddingY:1,...tZ(X),children:E.jsx(O,{...LZ(X),children:Q})})}function jZ(Z,Y,X){if(!Z||Z.length===0)return null;return Z.map((J,Q)=>{let $=`inline-${Q}`;switch(J.type){case"text":case"escape":{let K=J;if("tokens"in K&&K.tokens)return E.jsx(O,{children:jZ(K.tokens,Y,X)},$);return E.jsx(O,{children:K.text},$)}case"strong":{let K=J,U=IZ(CZ.strong,Y.strong);if(X.strong)return E.jsx(O,{children:X.strong(jZ(K.tokens,Y,X),K)},$);return E.jsx(O,{...LZ(U),children:jZ(K.tokens,Y,X)},$)}case"em":{let K=J,U=IZ(CZ.em,Y.em);if(X.em)return E.jsx(O,{children:X.em(jZ(K.tokens,Y,X),K)},$);return E.jsx(O,{...LZ(U),children:jZ(K.tokens,Y,X)},$)}case"del":{let K=J,U=IZ(CZ.del,Y.del);if(X.del)return E.jsx(O,{children:X.del(jZ(K.tokens,Y,X),K)},$);return E.jsx(O,{...LZ(U),children:jZ(K.tokens,Y,X)},$)}case"codespan":{let K=J,U=IZ(CZ.codespan,Y.codespan);if(X.codespan)return E.jsx(O,{children:X.codespan(K.text,K)},$);return E.jsx(O,{...LZ(U),children:K.text},$)}case"link":{let K=J,U=IZ(CZ.link,Y.link);if(X.link)return E.jsx(O,{children:X.link(K.text,K.href,K.title,K)},$);return E.jsxs(O,{...LZ(U),children:[K.text,K.href&&` (${K.href})`]},$)}case"image":{let K=J,U=IZ(CZ.image,Y.image);if(X.image)return E.jsx(O,{children:X.image(K.text,K.href,K.title,K)},$);return E.jsxs(O,{...LZ(U),children:["[Image: ",K.text||K.href,"]"]},$)}case"br":return E.jsx(O,{children:`
144
- `},$);default:if("text"in J)return E.jsx(O,{children:J.text},$);return null}})}function nX(Z,Y,X,J,Q,$="github-dark"){switch(Z.type){case"heading":{let K=Z,U=`h${K.depth}`,W=`h${K.depth}`,z=X[U];if(z)return z(K.text,K);let H=IZ(CZ[W],Y[W]),G=typeof H.showSharp=="boolean"?H.showSharp:Boolean(J);return E.jsx(_,{...tZ(H),children:E.jsxs(O,{...LZ(H),children:[G&&`${"#".repeat(K.depth)} `,jZ(K.tokens,Y,X)]})})}case"paragraph":{let K=Z,U=IZ(CZ.paragraph,Y.paragraph),W=jZ(K.tokens,Y,X);if(X.paragraph)return X.paragraph(W,K);return E.jsx(_,{...tZ(U),children:E.jsx(O,{...LZ(U),children:W})})}case"code":{let K=Z,U=IZ(CZ.code,Y.code);if(X.code)return X.code(K.text,K.lang,K);if(Q)return E.jsx(DW,{code:K.text,language:K.lang,style:U,theme:$});return E.jsx(_,{...tZ(U),children:E.jsx(O,{...LZ(U),children:K.text})})}case"blockquote":{let K=Z,U=IZ(CZ.blockquote,Y.blockquote),W=K.tokens.map((z,H)=>E.jsx(_,{children:nX(z,Y,X,J,Q,$)},`bq-${H}`));if(X.blockquote)return X.blockquote(W,K);return E.jsx(_,{...tZ(U),children:E.jsx(_,{flexDirection:"column",children:K.tokens.map((z,H)=>{if(nX(z,Y,X,J,Q,$))return E.jsx(O,{...LZ(U),children:z.type==="paragraph"?jZ(z.tokens,Y,X):z.text||""},`bq-text-${H}`);return null})})})}case"list":{let K=Z,U=IZ(CZ.list,Y.list),W=IZ(CZ.listItem,Y.listItem),z=W.bullet||"●",H=K.items.map((G,F)=>{let M=typeof K.start=="number"?K.start:1,N=K.ordered?`${M+F}. `:`${z} `,w=jZ(G.tokens,Y,X);if(X.listItem)return E.jsx(_,{...tZ(W),children:X.listItem(w,G)},`li-${F}`);return E.jsx(_,{...tZ(W),children:E.jsxs(O,{...LZ(W),children:[N,w]})},`li-${F}`)});if(X.list)return X.list(H,K.ordered,K);return E.jsx(_,{flexDirection:"column",...tZ(U),children:H})}case"hr":{let K=Z,U=IZ(CZ.hr,Y.hr),W=U.char||"─",z=U.width||40;if(X.hr)return X.hr(K);return E.jsx(_,{...tZ(U),children:E.jsx(O,{...LZ(U),children:W.repeat(z)})})}case"table":{let K=Z,U=IZ(CZ.table,Y.table),W=IZ(CZ.tableCell,Y.tableCell),z=(B)=>B.map((C)=>{if("text"in C)return C.text;return""}).join(""),H=K.header.map((B,C)=>{let R=z(B.tokens).length,D=Math.max(...K.rows.map((f)=>{let V=f[C]?.tokens;return V?z(V).length:0}),0);return Math.max(R,D,3)}),G=E.jsxs(O,{dimColor:!0,children:["┌─",H.map((B)=>"─".repeat(B)).join("─┬─"),"─┐"]}),F=E.jsxs(O,{children:[E.jsx(O,{dimColor:!0,children:"│ "}),K.header.map((B,C)=>{let R=jZ(B.tokens,Y,X),D=z(B.tokens);return E.jsxs(O,{children:[E.jsxs(O,{bold:!0,...LZ(W),children:[R," ".repeat(Math.max(0,(H[C]||3)-D.length))]}),E.jsxs(O,{dimColor:!0,children:[" │",C<K.header.length-1?" ":""]})]},`th-${C}`)})]}),M=E.jsxs(O,{dimColor:!0,children:["├─",H.map((B)=>"─".repeat(B)).join("─┼─"),"─┤"]}),N=K.rows.map((B,C)=>E.jsxs(O,{children:[E.jsx(O,{dimColor:!0,children:"│ "}),B.map((R,D)=>{let f=jZ(R.tokens,Y,X),V=z(R.tokens),d=H[D]||3;return E.jsxs(O,{children:[E.jsxs(O,{...LZ(W),children:[f," ".repeat(Math.max(0,d-V.length))]}),E.jsxs(O,{dimColor:!0,children:[" │",D<B.length-1?" ":""]})]},`td-${C}-${D}`)})]},`tr-${C}`)),w=E.jsxs(O,{dimColor:!0,children:["└─",H.map((B)=>"─".repeat(B)).join("─┴─"),"─┘"]}),L=E.jsxs(E.Fragment,{children:[G,F,M,N,w]});if(X.table)return X.table(F,N,K);return E.jsx(_,{flexDirection:"column",...tZ(U),children:L})}case"space":return E.jsx(O,{children:`
145
- `});case"html":return E.jsx(O,{dimColor:!0,children:Z.text});default:if("text"in Z)return E.jsx(O,{children:Z.text});return null}}var FJ=pZ.memo(function({token:Z,styles:Y,renderers:X,showSharp:J,highlight:Q,theme:$}){return E.jsx(E.Fragment,{children:nX(Z,Y,X,J,Q,$)})},(Z,Y)=>Z.token===Y.token);FJ.displayName="MemoizedBlock";function VW({children:Z,id:Y,styles:X={},renderers:J={},showSharp:Q=!1,highlight:$=!0,theme:K="github-dark"}){let U=pZ.useId(),W=Y||U,z=pZ.useMemo(()=>c.lexer(Z,{silent:!0,gfm:!0}),[Z]);return E.jsx(_,{flexDirection:"column",children:z.map((H,G)=>E.jsx(FJ,{token:H,styles:X,renderers:J,showSharp:Q,highlight:$,theme:K},`${W}-block-${G}`))})}var MJ=pZ.memo(VW);MJ.displayName="Markdown";var EW=MJ,NJ=EW;var _J=P(g(),1);var h0=P(I(),1),AJ=({children:Z,color:Y,dim:X,bold:J,italic:Q})=>{let $=_J.useMemo(()=>{return Z.split(`
146
- `).map((K)=>K===""?`
147
- `:K)},[Z]);return h0.jsxDEV(h0.Fragment,{children:$.map((K,U)=>h0.jsxDEV(O,{color:Y,dimColor:X,bold:J,italic:Q,children:K},U,!1,void 0,this))},void 0,!1,void 0,this)};var jY=P(g(),1),aX=P(I(),1),bW=(Z,Y,X=5)=>{if(!Y||!Z||Z.trim()==="")return Z;let J=Z.split(`
148
- `);if(J.length<=X)return Z;let Q=J.length-X,$=J.slice(-X);return`\x1B[33m${Q} rows hidden...\x1B[0m
149
- ${$.join(`
150
- `)}`},TW=({children:Z,simple:Y,loading:X,maxRows:J=5})=>{let Q=jY.useMemo(()=>{return bW(Z,X,J)},[Z,X,J]);if(Y)return aX.jsxDEV(AJ,{children:Q},void 0,!1,void 0,this);return aX.jsxDEV(NJ,{children:Q},void 0,!1,void 0,this)},wJ=jY.memo(TW);var SZ=P(I(),1),fW=({message:Z,messageNumber:Y,loading:X})=>{let Q=h8(Z),$=J0(Z);if(!$)return SZ.jsxDEV(SZ.Fragment,{},void 0,!1,void 0,this);return SZ.jsxDEV(_,{flexDirection:"column",children:[SZ.jsxDEV(_,{paddingBottom:0,marginBottom:1,children:SZ.jsxDEV(O,{color:c4("teal"),children:[Y," ","Zen Code"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),Q&&SZ.jsxDEV(jW,{thinking:Q,visible:$.trim().length===0},void 0,!1,void 0,this),SZ.jsxDEV(wJ,{simple:!1,loading:X,children:$},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},jW=({thinking:Z,visible:Y})=>{let X=Z.split(`
151
- `);return SZ.jsxDEV(_,{flexDirection:"column",marginBottom:1,children:[SZ.jsxDEV(_,{paddingBottom:0,children:SZ.jsxDEV(O,{color:"gray",bold:!0,children:["Think ",X.length," rows"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),Y&&SZ.jsxDEV(BJ,{content:Z,maxLines:3},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},SY=fW;var j=P(I(),1),LJ=["yellow","magenta","blue"],SW=(Z)=>{let Y=0;for(let J=0;J<Z.length;J++)Y=Z.charCodeAt(J)+((Y<<5)-Y);let X=Math.abs(Y%LJ.length);return LJ[X]},yW=(Z)=>{return{success:"✓",completed:"✓",ok:"✓",error:"✗",failed:"✗",pending:"⏳",in_progress:"⏳",running:"⏳",cancelled:"⏹"}[Z]||"⏳"},kW=(Z,Y=4,X=100)=>{let J=Z.split(`
152
- `),Q=(U)=>{if(U.length<=X)return U;return U.substring(0,X)+`... (${U.length-X} more chars)`};if(J.length<=Y)return J.map(Q).join(`
153
- `);let $=J.slice(0,2).map(Q),K=J.slice(J.length-3).map(Q);return[...$,`... and more ${J.length-5} lines`,...K].join(`
154
- `)},hW=({content:Z})=>{let Y=(X,J=0,Q=0)=>{let K=" ".repeat(J);if(Q>=3)return j.jsxDEV(O,{dimColor:!0,children:"{...} (truncated)"},void 0,!1,void 0,this);if(X===null)return j.jsxDEV(O,{color:"gray",children:"null"},void 0,!1,void 0,this);if(typeof X!=="object"){let z=JSON.stringify(X);if(typeof X==="string"&&z.length>102){let H=z.substring(1,101);return j.jsxDEV(O,{children:[j.jsxDEV(O,{color:"cyan",children:['"',H,'..."']},void 0,!0,void 0,this)," ",j.jsxDEV(O,{dimColor:!0,children:["(truncated, ",z.length-2," chars)"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}if(typeof X==="string")return j.jsxDEV(O,{color:"cyan",children:z},void 0,!1,void 0,this);else if(typeof X==="number")return j.jsxDEV(O,{color:"yellow",children:X},void 0,!1,void 0,this);else if(typeof X==="boolean")return j.jsxDEV(O,{color:"magenta",children:X.toString()},void 0,!1,void 0,this);else return j.jsxDEV(O,{children:z},void 0,!1,void 0,this)}if(Array.isArray(X)){if(X.length===0)return j.jsxDEV(O,{color:"gray",children:"[]"},void 0,!1,void 0,this);let z=5;return j.jsxDEV(j.Fragment,{children:[`
155
- `,X.slice(0,z).map((H,G)=>j.jsxDEV(O,{children:[j.jsxDEV(O,{children:K},void 0,!1,void 0,this),j.jsxDEV(O,{color:"green",children:"- "},void 0,!1,void 0,this)," ",Y(H,J+1,Q+1),G<Math.min(X.length,z)-1?`
156
- `:""]},void 0,!0,void 0,this)),X.length>z&&j.jsxDEV(O,{children:[`
157
- `,j.jsxDEV(O,{children:K},void 0,!1,void 0,this),j.jsxDEV(O,{dimColor:!0,children:["... (",X.length-z," more)"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}let U=Object.keys(X);if(U.length===0)return j.jsxDEV(O,{color:"gray"},void 0,!1,void 0,this);let W=5;return j.jsxDEV(j.Fragment,{children:[U.slice(0,W).map((z,H)=>j.jsxDEV(O,{children:[j.jsxDEV(O,{children:K},void 0,!1,void 0,this),j.jsxDEV(O,{color:"blue",children:z},void 0,!1,void 0,this)," ",j.jsxDEV(O,{color:"gray",children:": "},void 0,!1,void 0,this)," ",Y(X[z],J+1,Q+1),H<Math.min(U.length,W)-1?`
158
- `:""]},void 0,!0,void 0,this)),U.length>W&&j.jsxDEV(O,{children:[`
159
- `,j.jsxDEV(O,{children:K},void 0,!1,void 0,this),j.jsxDEV(O,{dimColor:!0,children:["... (",U.length-W," more)"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)};return j.jsxDEV(O,{children:Y(Z)},void 0,!1,void 0,this)},xW=({message:Z,messageNumber:Y})=>{let{getToolUIRender:X,client:J}=WZ(),Q=new eY(Z,J),$=Q.getInputRepaired(),K=$?.title?`: ${$.title}`:$?.description?`: ${$.description}`:"",U=Z.name?X(Z.name):null,W=SW(Z.name||"");return W=Z.status==="error"?"red":"yellow",j.jsxDEV(r,{children:j.jsxDEV(_,{flexDirection:"column",children:[j.jsxDEV(_,{children:[j.jsxDEV(O,{color:W,children:[Y," ",Z.name,j.jsxDEV(O,{color:"gray",children:K},void 0,!1,void 0,this)]},void 0,!0,void 0,this),j.jsxDEV(O,{children:[" ",yW(Z?.status)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),U?j.jsxDEV(_,{children:[j.jsxDEV(O,{color:"gray",children:"└─ "},void 0,!1,void 0,this),j.jsxDEV(_,{flexDirection:"column",children:U(Z)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):j.jsxDEV(_,{flexDirection:"column",paddingTop:0,children:[j.jsxDEV(_,{children:[j.jsxDEV(O,{color:"gray",children:"└─ "},void 0,!1,void 0,this),j.jsxDEV(hW,{content:Q.getInputRepaired()},void 0,!1,void 0,this)]},void 0,!0,void 0,this),j.jsxDEV(_,{paddingTop:0,paddingBottom:0,children:[j.jsxDEV(O,{color:"gray",children:"└─ "},void 0,!1,void 0,this),j.jsxDEV(O,{dimColor:!0,italic:!0,children:kW(PJ(Z.content))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Z.sub_messages?.length?j.jsxDEV(_,{children:[j.jsxDEV(O,{color:"gray",children:"└─ "},void 0,!1,void 0,this),j.jsxDEV(O,{color:W,dimColor:!0,children:["(hidden ",Z.sub_messages.length," subagent messages)"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},RJ=xW;var f4=P(I(),1),CJ=kY.memo(function({renderMessages:Y,startIndex:X,staticKey:J,loading:Q}){let[$,K]=kY.useState(!1);TZ(()=>K(!0),$?null:0);let U=(G,F,M,N)=>f4.jsxDEV(_,{flexDirection:"column",paddingLeft:1,paddingBottom:1,children:G.type==="human"?f4.jsxDEV(e0,{content:G.content,messageNumber:F+1+X},void 0,!1,void 0,this):G.type==="tool"?f4.jsxDEV(RJ,{message:G,messageNumber:F+1+X},void 0,!1,void 0,this):f4.jsxDEV(SY,{message:G,messageNumber:F+1+X,loading:Q},void 0,!1,void 0,this)},G.id?`${N}-${G.id}`:`${N}-msg-${F}`,!1,void 0,this),W=Y.findIndex((G)=>{if(G.type==="tool"&&!G.done&&!["success","error"].includes(G.status))return!0;return!1});if(W===-1)W=Y.length-1;let z=Y.slice(0,W),H=Y.slice(W);if(!$)return f4.jsxDEV(_,{flexDirection:"column",children:Y.map((G,F)=>U(G,F,F===W,"init"))},void 0,!1,void 0,this);return f4.jsxDEV(_,{flexDirection:"column",children:[f4.jsxDEV(yY,{items:z,children:(G,F)=>U(G,F,!1,"hist")},J,!1,void 0,this),H.map((G,F)=>U(G,z.length+F,!0,"curr"))]},void 0,!0,void 0,this)});var j4=P(g(),1);var q0=P(g(),1);var hY=P(I(),1),gW=({staticKey:Z,children:Y,delay:X=1})=>{let[J,Q]=q0.useState(!0),$=q0.useRef(!0);return q0.useEffect(()=>{Q(!1),$.current=!0},[Z]),TZ(()=>{if($.current)console.clear(),Q(!0),$.current=!1},J?null:X),hY.jsxDEV(hY.Fragment,{children:J?Y():null},void 0,!1,void 0,this)},IJ=gW;var JZ=P(I(),1),uW=j4.memo(function({toolGroup:Y,groupId:X,getToolUIRender:J,depth:Q=0,loading:$}){if(Q>1)return null;return JZ.jsxDEV(_,{flexDirection:"column",children:Y.map((K,U)=>{let W=K.name?J(K.name):null;if(!W)return null;let z=K.sub_messages?.length||0,H=K.sub_messages?.slice(-4)||[],G=z-H.length;return JZ.jsxDEV(j4.Fragment,{children:[JZ.jsxDEV(()=>{return JZ.jsxDEV(r,{fallback:K.name+" is error",children:W(K)},void 0,!1,void 0,this)},{},void 0,!1,void 0,this),H.length?JZ.jsxDEV(JZ.Fragment,{children:[G>0&&JZ.jsxDEV(_,{paddingLeft:2,children:JZ.jsxDEV(O,{dimColor:!0,children:["... ",G," more submessage",G>1?"s":""]},void 0,!0,void 0,this)},void 0,!1,void 0,this),JZ.jsxDEV(sX,{renderMessages:H,startIndex:1,depth:Q+1,staticKey:`sub-d${Q}-i${U}`,getToolUIRender:J,loading:$},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},`${X}-${U}-${K.status}`,!0,void 0,this)})},void 0,!1,void 0,this)}),vJ=j4.memo(function({message:Y,displayIndex:X,isCurrent:J,startIndex:Q=0,getToolUIRender:$,depth:K=0,loading:U}){return JZ.jsxDEV(_,{flexDirection:"column",paddingBottom:1,children:[Y.type==="human"?JZ.jsxDEV(e0,{content:Y.content,messageNumber:X+1+Q},void 0,!1,void 0,this):null,Y.type==="ai"?JZ.jsxDEV(SY,{message:Y,messageNumber:X+1+Q,loading:U},void 0,!1,void 0,this):null,Y.type==="group"&&JZ.jsxDEV(JZ.Fragment,{children:JZ.jsxDEV(uW,{toolGroup:Y.toolGroup,groupId:Y.id,getToolUIRender:$,depth:K,loading:U},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}),DJ=(Z)=>{if(Z.type!=="ai")return!0;try{let Y=J0(Z);return!!(Y&&Y.trim().length>0)}catch{return!1}},sX=j4.memo(function({renderMessages:Y,startIndex:X,staticKey:J,depth:Q=0,getToolUIRender:$,loading:K}){let U=j4.useMemo(()=>{let G=0;return Y.filter((F)=>{if(F.type==="ai")return DJ(F);return!0}).reduce((F,M)=>{if(M.type==="tool"){let N=F[F.length-1];if(N&&N.type==="group"&&N.toolGroup.length<5)N.toolGroup.push(M);else F.push({id:`tool-group-${G++}`,type:"group",toolGroup:[M]})}else F.push(M);return F},[])},[Y,DJ]),W=U.length-1;if(W===-1)W=U.length-1;if(!K)W=U.length;let z=U.slice(0,W),H=U.slice(W);return JZ.jsxDEV(_,{flexDirection:"column",children:[JZ.jsxDEV(IJ,{staticKey:`${J} ${z.length}`,children:()=>JZ.jsxDEV(yY,{items:z,children:(G,F)=>JZ.jsxDEV(vJ,{message:G,displayIndex:F,isCurrent:!1,startIndex:X,getToolUIRender:$,depth:Q,loading:K},G.id?`hist-${G.id}`:`hist-msg-${Q}-${F}`,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),H.map((G,F)=>JZ.jsxDEV(vJ,{message:G,displayIndex:z.length+F,isCurrent:!0,startIndex:X,getToolUIRender:$,depth:Q,loading:K},G.id?`curr-${G.id}`:`curr-msg-${Q}-${z.length}-${F}`,!1,void 0,this))]},void 0,!0,void 0,this)});var T=P(I(),1),mW=()=>{let Z=t0(),Y=new Date().toLocaleDateString(),{extraParams:X,AVAILABLE_MODELS:J,config:Q}=UZ(),$=X.mcp_config||{},K=Object.keys($).length,U=VJ(),W=process.platform,z=W==="darwin"?"macOS":W==="win32"?"Windows":"Linux",H=process.cwd(),G=Q?.provider_id||process.env.MODEL_PROVIDER||"openai",M=!!Q?.providers?.find((L)=>L.id===G)?.apiKey,N=J.length>0,w=M&&N;return T.jsxDEV(_,{flexDirection:"column",borderStyle:"round",borderColor:"cyan",paddingX:1,marginBottom:1,children:[T.jsxDEV(_,{flexDirection:"row",justifyContent:"space-between",borderBottom:!1,children:[T.jsxDEV(O,{color:"cyan",bold:!0,children:"ZEN CODE"},void 0,!1,void 0,this),T.jsxDEV(O,{color:"gray",children:Y},void 0,!1,void 0,this)]},void 0,!0,void 0,this),T.jsxDEV(_,{flexDirection:"row",marginTop:1,gap:2,children:[T.jsxDEV(_,{flexDirection:"column",children:T.jsxDEV(O,{color:"cyan",children:`███████╗███████╗███╗ ██╗
126
+ `}tablerow({text:$}){return`<tr>
127
+ ${$}</tr>
128
+ `}tablecell($){let Z=this.parser.parseInline($.tokens),Y=$.header?"th":"td";return($.align?`<${Y} align="${$.align}">`:`<${Y}>`)+Z+`</${Y}>
129
+ `}strong({tokens:$}){return`<strong>${this.parser.parseInline($)}</strong>`}em({tokens:$}){return`<em>${this.parser.parseInline($)}</em>`}codespan({text:$}){return`<code>${n1($,!0)}</code>`}br($){return"<br>"}del({tokens:$}){return`<del>${this.parser.parseInline($)}</del>`}link({href:$,title:Z,tokens:Y}){let J=this.parser.parseInline(Y),X=j2($);if(X===null)return J;$=X;let K='<a href="'+$+'"';return Z&&(K+=' title="'+n1(Z)+'"'),K+=">"+J+"</a>",K}image({href:$,title:Z,text:Y,tokens:J}){J&&(Y=this.parser.parseInline(J,this.parser.textRenderer));let X=j2($);if(X===null)return n1(Y);$=X;let K=`<img src="${$}" alt="${Y}"`;return Z&&(K+=` title="${n1(Z)}"`),K+=">",K}text($){return"tokens"in $&&$.tokens?this.parser.parseInline($.tokens):("escaped"in $)&&$.escaped?$.text:n1($.text)}},W0=class{strong({text:$}){return $}em({text:$}){return $}codespan({text:$}){return $}del({text:$}){return $}html({text:$}){return $}text({text:$}){return $}link({text:$}){return""+$}image({text:$}){return""+$}br(){return""}},j1=class ${options;renderer;textRenderer;constructor(Z){this.options=Z||I$,this.options.renderer=this.options.renderer||new MZ,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new W0}static parse(Z,Y){return new $(Y).parse(Z)}static parseInline(Z,Y){return new $(Y).parseInline(Z)}parse(Z,Y=!0){let J="";for(let X=0;X<Z.length;X++){let K=Z[X];if(this.options.extensions?.renderers?.[K.type]){let O=K,_=this.options.extensions.renderers[O.type].call({parser:this},O);if(_!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(O.type)){J+=_||"";continue}}let W=K;switch(W.type){case"space":{J+=this.renderer.space(W);continue}case"hr":{J+=this.renderer.hr(W);continue}case"heading":{J+=this.renderer.heading(W);continue}case"code":{J+=this.renderer.code(W);continue}case"table":{J+=this.renderer.table(W);continue}case"blockquote":{J+=this.renderer.blockquote(W);continue}case"list":{J+=this.renderer.list(W);continue}case"html":{J+=this.renderer.html(W);continue}case"def":{J+=this.renderer.def(W);continue}case"paragraph":{J+=this.renderer.paragraph(W);continue}case"text":{let O=W,_=this.renderer.text(O);for(;X+1<Z.length&&Z[X+1].type==="text";)O=Z[++X],_+=`
130
+ `+this.renderer.text(O);Y?J+=this.renderer.paragraph({type:"paragraph",raw:_,text:_,tokens:[{type:"text",raw:_,text:_,escaped:!0}]}):J+=_;continue}default:{let O='Token with "'+W.type+'" type was not found.';if(this.options.silent)return console.error(O),"";throw Error(O)}}}return J}parseInline(Z,Y=this.renderer){let J="";for(let X=0;X<Z.length;X++){let K=Z[X];if(this.options.extensions?.renderers?.[K.type]){let O=this.options.extensions.renderers[K.type].call({parser:this},K);if(O!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(K.type)){J+=O||"";continue}}let W=K;switch(W.type){case"escape":{J+=Y.text(W);break}case"html":{J+=Y.html(W);break}case"link":{J+=Y.link(W);break}case"image":{J+=Y.image(W);break}case"strong":{J+=Y.strong(W);break}case"em":{J+=Y.em(W);break}case"codespan":{J+=Y.codespan(W);break}case"br":{J+=Y.br(W);break}case"del":{J+=Y.del(W);break}case"text":{J+=Y.text(W);break}default:{let O='Token with "'+W.type+'" type was not found.';if(this.options.silent)return console.error(O),"";throw Error(O)}}}return J}},s$=class{options;block;constructor($){this.options=$||I$}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess($){return $}postprocess($){return $}processAllTokens($){return $}emStrongMask($){return $}provideLexer(){return this.block?V1.lex:V1.lexInline}provideParser(){return this.block?j1.parse:j1.parseInline}},F5=class{defaults=tZ();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=j1;Renderer=MZ;TextRenderer=W0;Lexer=V1;Tokenizer=wZ;Hooks=s$;constructor(...$){this.use(...$)}walkTokens($,Z){let Y=[];for(let J of $)switch(Y=Y.concat(Z.call(this,J)),J.type){case"table":{let X=J;for(let K of X.header)Y=Y.concat(this.walkTokens(K.tokens,Z));for(let K of X.rows)for(let W of K)Y=Y.concat(this.walkTokens(W.tokens,Z));break}case"list":{let X=J;Y=Y.concat(this.walkTokens(X.items,Z));break}default:{let X=J;this.defaults.extensions?.childTokens?.[X.type]?this.defaults.extensions.childTokens[X.type].forEach((K)=>{let W=X[K].flat(1/0);Y=Y.concat(this.walkTokens(W,Z))}):X.tokens&&(Y=Y.concat(this.walkTokens(X.tokens,Z)))}}return Y}use(...$){let Z=this.defaults.extensions||{renderers:{},childTokens:{}};return $.forEach((Y)=>{let J={...Y};if(J.async=this.defaults.async||J.async||!1,Y.extensions&&(Y.extensions.forEach((X)=>{if(!X.name)throw Error("extension name required");if("renderer"in X){let K=Z.renderers[X.name];K?Z.renderers[X.name]=function(...W){let O=X.renderer.apply(this,W);return O===!1&&(O=K.apply(this,W)),O}:Z.renderers[X.name]=X.renderer}if("tokenizer"in X){if(!X.level||X.level!=="block"&&X.level!=="inline")throw Error("extension level must be 'block' or 'inline'");let K=Z[X.level];K?K.unshift(X.tokenizer):Z[X.level]=[X.tokenizer],X.start&&(X.level==="block"?Z.startBlock?Z.startBlock.push(X.start):Z.startBlock=[X.start]:X.level==="inline"&&(Z.startInline?Z.startInline.push(X.start):Z.startInline=[X.start]))}"childTokens"in X&&X.childTokens&&(Z.childTokens[X.name]=X.childTokens)}),J.extensions=Z),Y.renderer){let X=this.defaults.renderer||new MZ(this.defaults);for(let K in Y.renderer){if(!(K in X))throw Error(`renderer '${K}' does not exist`);if(["options","parser"].includes(K))continue;let W=K,O=Y.renderer[W],_=X[W];X[W]=(...G)=>{let N=O.apply(X,G);return N===!1&&(N=_.apply(X,G)),N||""}}J.renderer=X}if(Y.tokenizer){let X=this.defaults.tokenizer||new wZ(this.defaults);for(let K in Y.tokenizer){if(!(K in X))throw Error(`tokenizer '${K}' does not exist`);if(["options","rules","lexer"].includes(K))continue;let W=K,O=Y.tokenizer[W],_=X[W];X[W]=(...G)=>{let N=O.apply(X,G);return N===!1&&(N=_.apply(X,G)),N}}J.tokenizer=X}if(Y.hooks){let X=this.defaults.hooks||new s$;for(let K in Y.hooks){if(!(K in X))throw Error(`hook '${K}' does not exist`);if(["options","block"].includes(K))continue;let W=K,O=Y.hooks[W],_=X[W];s$.passThroughHooks.has(K)?X[W]=(G)=>{if(this.defaults.async&&s$.passThroughHooksRespectAsync.has(K))return(async()=>{let z=await O.call(X,G);return _.call(X,z)})();let N=O.call(X,G);return _.call(X,N)}:X[W]=(...G)=>{if(this.defaults.async)return(async()=>{let z=await O.apply(X,G);return z===!1&&(z=await _.apply(X,G)),z})();let N=O.apply(X,G);return N===!1&&(N=_.apply(X,G)),N}}J.hooks=X}if(Y.walkTokens){let X=this.defaults.walkTokens,K=Y.walkTokens;J.walkTokens=function(W){let O=[];return O.push(K.call(this,W)),X&&(O=O.concat(X.call(this,W))),O}}this.defaults={...this.defaults,...J}}),this}setOptions($){return this.defaults={...this.defaults,...$},this}lexer($,Z){return V1.lex($,Z??this.defaults)}parser($,Z){return j1.parse($,Z??this.defaults)}parseMarkdown($){return(Z,Y)=>{let J={...Y},X={...this.defaults,...J},K=this.onError(!!X.silent,!!X.async);if(this.defaults.async===!0&&J.async===!1)return K(Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof Z>"u"||Z===null)return K(Error("marked(): input parameter is undefined or null"));if(typeof Z!="string")return K(Error("marked(): input parameter is of type "+Object.prototype.toString.call(Z)+", string expected"));if(X.hooks&&(X.hooks.options=X,X.hooks.block=$),X.async)return(async()=>{let W=X.hooks?await X.hooks.preprocess(Z):Z,O=await(X.hooks?await X.hooks.provideLexer():$?V1.lex:V1.lexInline)(W,X),_=X.hooks?await X.hooks.processAllTokens(O):O;X.walkTokens&&await Promise.all(this.walkTokens(_,X.walkTokens));let G=await(X.hooks?await X.hooks.provideParser():$?j1.parse:j1.parseInline)(_,X);return X.hooks?await X.hooks.postprocess(G):G})().catch(K);try{X.hooks&&(Z=X.hooks.preprocess(Z));let W=(X.hooks?X.hooks.provideLexer():$?V1.lex:V1.lexInline)(Z,X);X.hooks&&(W=X.hooks.processAllTokens(W)),X.walkTokens&&this.walkTokens(W,X.walkTokens);let O=(X.hooks?X.hooks.provideParser():$?j1.parse:j1.parseInline)(W,X);return X.hooks&&(O=X.hooks.postprocess(O)),O}catch(W){return K(W)}}}onError($,Z){return(Y)=>{if(Y.message+=`
131
+ Please report this to https://github.com/markedjs/marked.`,$){let J="<p>An error occurred:</p><pre>"+n1(Y.message+"",!0)+"</pre>";return Z?Promise.resolve(J):J}if(Z)return Promise.reject(Y);throw Y}}},S$=new F5;function E($,Z){return S$.parse($,Z)}E.options=E.setOptions=function($){return S$.setOptions($),E.defaults=S$.defaults,p2(E.defaults),E};E.getDefaults=tZ;E.defaults=I$;E.use=function(...$){return S$.use(...$),E.defaults=S$.defaults,p2(E.defaults),E};E.walkTokens=function($,Z){return S$.walkTokens($,Z)};E.parseInline=S$.parseInline;E.Parser=j1;E.parser=j1.parse;E.Renderer=MZ;E.TextRenderer=W0;E.Lexer=V1;E.lexer=V1.lex;E.Tokenizer=wZ;E.Hooks=s$;E.parse=E;var{options:EK,setOptions:gK,use:pK,walkTokens:mK,parseInline:cK}=E;var uK=j1.parse,xK=V1.lex;var v$=A(h(),1),z1={h1:{bold:!0,marginBottom:1,color:"#f74cc7ff"},h2:{bold:!0,marginBottom:1,color:"#326cfcff"},h3:{bold:!0,color:"#24ffedff"},h4:{bold:!0,color:"#e29418ff"},h5:{bold:!0,color:"#9fc214ff"},h6:{bold:!0,dimColor:!0,color:"#88eb2bff"},paragraph:{},blockquote:{paddingLeft:1,dimColor:!0,borderTop:!1,borderBottom:!1,borderRight:!1,borderStyle:"single",borderDimColor:!0},code:{marginTop:1,paddingX:2},codespan:{dimColor:!0},list:{},listItem:{bullet:"●",paddingLeft:2},hr:{char:"─",width:40,dimColor:!0},link:{color:"#343afcff",underline:!0},strong:{bold:!0},em:{italic:!0},del:{strikethrough:!0,dimColor:!0},image:{color:"blue"},table:{},tableCell:{paddingRight:2}},A5=["color","backgroundColor","dimColor","bold","italic","underline","strikethrough","inverse","wrap"],w5=["paddingLeft","paddingRight","paddingTop","paddingBottom","padding","paddingX","paddingY","marginLeft","marginRight","marginTop","marginBottom","margin","marginX","marginY","borderStyle","borderColor","borderTop","borderBottom","borderLeft","borderRight","borderDimColor","borderTopColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopDimColor","borderBottomDimColor","borderLeftDimColor","borderRightDimColor"];function w1($){if(!$)return{};let Z={};for(let Y of A5)if(Y in $)Z[Y]=$[Y];return Z}function X$($){if(!$)return{};let Z={};for(let Y of w5)if(Y in $)Z[Y]=$[Y];return Z}function N1($,Z){if(!$&&!Z)return{};if(!$)return Z;if(!Z)return $;return{...$,...Z}}function b1($,Z,Y){if(!$||$.length===0)return null;return $.map((J,X)=>{let K=`inline-${X}`;switch(J.type){case"text":case"escape":{let W=J;if("tokens"in W&&W.tokens)return B.jsx(Q,{children:b1(W.tokens,Z,Y)},K);return B.jsx(Q,{children:W.text},K)}case"strong":{let W=J,O=N1(z1.strong,Z.strong);if(Y.strong)return B.jsx(Q,{children:Y.strong(b1(W.tokens,Z,Y),W)},K);return B.jsx(Q,{...w1(O),children:b1(W.tokens,Z,Y)},K)}case"em":{let W=J,O=N1(z1.em,Z.em);if(Y.em)return B.jsx(Q,{children:Y.em(b1(W.tokens,Z,Y),W)},K);return B.jsx(Q,{...w1(O),children:b1(W.tokens,Z,Y)},K)}case"del":{let W=J,O=N1(z1.del,Z.del);if(Y.del)return B.jsx(Q,{children:Y.del(b1(W.tokens,Z,Y),W)},K);return B.jsx(Q,{...w1(O),children:b1(W.tokens,Z,Y)},K)}case"codespan":{let W=J,O=N1(z1.codespan,Z.codespan);if(Y.codespan)return B.jsx(Q,{children:Y.codespan(W.text,W)},K);return B.jsx(Q,{...w1(O),children:W.text},K)}case"link":{let W=J,O=N1(z1.link,Z.link);if(Y.link)return B.jsx(Q,{children:Y.link(W.text,W.href,W.title,W)},K);return B.jsxs(Q,{...w1(O),children:[W.text,W.href&&` (${W.href})`]},K)}case"image":{let W=J,O=N1(z1.image,Z.image);if(Y.image)return B.jsx(Q,{children:Y.image(W.text,W.href,W.title,W)},K);return B.jsxs(Q,{...w1(O),children:["[Image: ",W.text||W.href,"]"]},K)}case"br":return B.jsx(Q,{children:`
132
+ `},K);default:if("text"in J)return B.jsx(Q,{children:J.text},K);return null}})}function a2($,Z,Y,J){switch($.type){case"heading":{let X=$,K=`h${X.depth}`,W=`h${X.depth}`,O=Y[K];if(O)return O(X.text,X);let _=N1(z1[W],Z[W]),G=typeof _.showSharp=="boolean"?_.showSharp:Boolean(J);return B.jsx(U,{...X$(_),children:B.jsxs(Q,{...w1(_),children:[G&&`${"#".repeat(X.depth)} `,b1(X.tokens,Z,Y)]})})}case"paragraph":{let X=$,K=N1(z1.paragraph,Z.paragraph),W=b1(X.tokens,Z,Y);if(Y.paragraph)return Y.paragraph(W,X);return B.jsx(U,{...X$(K),children:B.jsx(Q,{...w1(K),children:W})})}case"code":{let X=$,K=N1(z1.code,Z.code);if(Y.code)return Y.code(X.text,X.lang,X);return B.jsx(U,{...X$(K),children:B.jsx(Q,{...w1(K),children:X.text})})}case"blockquote":{let X=$,K=N1(z1.blockquote,Z.blockquote);if(Y.blockquote){let W=X.tokens.map((O,_)=>B.jsx(U,{children:a2(O,Z,Y,J)},`bq-${_}`));return Y.blockquote(W,X)}return B.jsx(U,{...X$(K),children:B.jsx(U,{flexDirection:"column",children:X.tokens.map((W,O)=>B.jsx(Q,{...w1(K),children:W.type==="paragraph"?b1(W.tokens,Z,Y):W.text||""},`bq-text-${O}`))})})}case"list":{let X=$,K=N1(z1.list,Z.list),W=N1(z1.listItem,Z.listItem),O=W.bullet||"●",_=X.items.map((G,N)=>{let z=typeof X.start=="number"?X.start:1,F=X.ordered?`${z+N}. `:`${O} `,L=b1(G.tokens,Z,Y);if(Y.listItem)return B.jsx(U,{...X$(W),children:Y.listItem(L,G)},`li-${N}`);return B.jsx(U,{...X$(W),children:B.jsxs(Q,{...w1(W),children:[F,L]})},`li-${N}`)});if(Y.list)return Y.list(_,X.ordered,X);return B.jsx(U,{flexDirection:"column",...X$(K),children:_})}case"hr":{let X=$,K=N1(z1.hr,Z.hr),W=K.char||"─",O=K.width||40;if(Y.hr)return Y.hr(X);return B.jsx(U,{...X$(K),children:B.jsx(Q,{...w1(K),children:W.repeat(O)})})}case"table":{let X=$,K=N1(z1.table,Z.table),W=N1(z1.tableCell,Z.tableCell),O=(M)=>M.map((b)=>{if("text"in b)return b.text;return""}).join(""),_=X.header.map((M,b)=>{let f=O(M.tokens).length,k=Math.max(...X.rows.map((g)=>{let p=g[b]?.tokens;return p?O(p).length:0}),0);return Math.max(f,k,3)}),G=B.jsxs(Q,{dimColor:!0,children:["┌─",_.map((M)=>"─".repeat(M)).join("─┬─"),"─┐"]}),N=B.jsxs(Q,{children:[B.jsx(Q,{dimColor:!0,children:"│ "}),X.header.map((M,b)=>{let f=b1(M.tokens,Z,Y),k=O(M.tokens);return B.jsxs(Q,{children:[B.jsxs(Q,{bold:!0,...w1(W),children:[f," ".repeat(Math.max(0,(_[b]||3)-k.length))]}),B.jsxs(Q,{dimColor:!0,children:[" ","│",b<X.header.length-1?" ":""]})]},`th-${b}`)})]}),z=B.jsxs(Q,{dimColor:!0,children:["├─",_.map((M)=>"─".repeat(M)).join("─┼─"),"─┤"]}),F=X.rows.map((M,b)=>B.jsxs(Q,{children:[B.jsx(Q,{dimColor:!0,children:"│ "}),M.map((f,k)=>{let g=b1(f.tokens,Z,Y),p=O(f.tokens),o=_[k]||3;return B.jsxs(Q,{children:[B.jsxs(Q,{...w1(W),children:[g," ".repeat(Math.max(0,o-p.length))]}),B.jsxs(Q,{dimColor:!0,children:[" │",k<M.length-1?" ":""]})]},`td-${b}-${k}`)})]},`tr-${b}`)),L=B.jsxs(Q,{dimColor:!0,children:["└─",_.map((M)=>"─".repeat(M)).join("─┴─"),"─┘"]}),w=B.jsxs(B.Fragment,{children:[G,N,z,F,L]});if(Y.table)return Y.table(N,F,X);return B.jsx(U,{flexDirection:"column",...X$(K),children:w})}case"space":return B.jsx(Q,{children:`
133
+ `});case"html":return B.jsx(Q,{dimColor:!0,children:$.text});default:if("text"in $)return B.jsx(Q,{children:$.text});return null}}var s2=v$.memo(function({token:$,styles:Z,renderers:Y,showSharp:J}){return B.jsx(B.Fragment,{children:a2($,Z,Y,J)})},($,Z)=>$.token===Z.token);s2.displayName="MemoizedBlock";function M5({children:$,id:Z,styles:Y={},renderers:J={},showSharp:X=!1}){let K=v$.useId(),W=Z||K,O=v$.useMemo(()=>E.lexer($,{silent:!0,gfm:!0}),[$]);return B.jsx(U,{flexDirection:"column",children:O.map((_,G)=>B.jsx(s2,{token:_,styles:Y,renderers:J,showSharp:X},`${W}-block-${G}`))})}var t2=v$.memo(M5);t2.displayName="Markdown";var q5=t2,e2=q5;var $4=A(h(),1);var $Z=A(q(),1),Z4=({children:$,color:Z,dim:Y,bold:J,italic:X})=>{let K=$4.useMemo(()=>{return $.split(`
134
+ `).map((W)=>W===""?`
135
+ `:W)},[$]);return $Z.jsxDEV($Z.Fragment,{children:K.map((W,O)=>$Z.jsxDEV(Q,{color:Z,dimColor:Y,bold:J,italic:X,children:W},O,!1,void 0,this))},void 0,!1,void 0,this)};var RZ=A(h(),1),Q0=A(q(),1),b5=($,Z,Y=5)=>{if(!Z||!$||$.trim()==="")return $;let J=$.split(`
136
+ `);if(J.length<=Y)return $;let X=J.length-Y,K=J.slice(-Y);return`\x1B[33m${X} rows hidden...\x1B[0m
137
+ ${K.join(`
138
+ `)}`},R5=({children:$,simple:Z,loading:Y,maxRows:J=5})=>{let X=RZ.useMemo(()=>{return b5($,Y,J)},[$,Y,J]);if(Z)return Q0.jsxDEV(Z4,{children:X},void 0,!1,void 0,this);return Q0.jsxDEV(e2,{children:X},void 0,!1,void 0,this)},Y4=RZ.memo(R5);var R1=A(q(),1),B5=({message:$,messageNumber:Z,loading:Y})=>{let X=n0($),K=D$($);if(!K)return R1.jsxDEV(R1.Fragment,{},void 0,!1,void 0,this);return R1.jsxDEV(U,{flexDirection:"column",children:[R1.jsxDEV(U,{paddingBottom:0,marginBottom:1,children:R1.jsxDEV(Q,{color:P$("teal"),children:[Z," ","Zen Code"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),X&&R1.jsxDEV(f5,{thinking:X,visible:K.trim().length===0},void 0,!1,void 0,this),R1.jsxDEV(Y4,{simple:!1,loading:Y,children:K},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},f5=({thinking:$,visible:Z})=>{let Y=$.split(`
139
+ `);return R1.jsxDEV(U,{flexDirection:"column",marginBottom:1,children:[R1.jsxDEV(U,{paddingBottom:0,children:R1.jsxDEV(Q,{color:"gray",bold:!0,children:["Think ",Y.length," rows"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),Z&&R1.jsxDEV(X4,{content:$,maxLines:3},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},BZ=B5;var C=A(q(),1),J4=["yellow","magenta","blue"],P5=($)=>{let Z=0;for(let J=0;J<$.length;J++)Z=$.charCodeAt(J)+((Z<<5)-Z);let Y=Math.abs(Z%J4.length);return J4[Y]},C5=($)=>{return{success:"✓",completed:"✓",ok:"✓",error:"✗",failed:"✗",pending:"⏳",in_progress:"⏳",running:"⏳",cancelled:"⏹"}[$]||"⏳"},S5=($,Z=4,Y=100)=>{let J=$.split(`
140
+ `),X=(O)=>{if(O.length<=Y)return O;return O.substring(0,Y)+`... (${O.length-Y} more chars)`};if(J.length<=Z)return J.map(X).join(`
141
+ `);let K=J.slice(0,2).map(X),W=J.slice(J.length-3).map(X);return[...K,`... and more ${J.length-5} lines`,...W].join(`
142
+ `)},I5=({content:$})=>{let Z=(Y,J=0,X=0)=>{let W=" ".repeat(J);if(X>=3)return C.jsxDEV(Q,{dimColor:!0,children:"{...} (truncated)"},void 0,!1,void 0,this);if(Y===null)return C.jsxDEV(Q,{color:"gray",children:"null"},void 0,!1,void 0,this);if(typeof Y!=="object"){let G=JSON.stringify(Y);if(typeof Y==="string"&&G.length>102){let N=G.substring(1,101);return C.jsxDEV(Q,{children:[C.jsxDEV(Q,{color:"cyan",children:['"',N,'..."']},void 0,!0,void 0,this)," ",C.jsxDEV(Q,{dimColor:!0,children:["(truncated, ",G.length-2," chars)"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}if(typeof Y==="string")return C.jsxDEV(Q,{color:"cyan",children:G},void 0,!1,void 0,this);else if(typeof Y==="number")return C.jsxDEV(Q,{color:"yellow",children:Y},void 0,!1,void 0,this);else if(typeof Y==="boolean")return C.jsxDEV(Q,{color:"magenta",children:Y.toString()},void 0,!1,void 0,this);else return C.jsxDEV(Q,{children:G},void 0,!1,void 0,this)}if(Array.isArray(Y)){if(Y.length===0)return C.jsxDEV(Q,{color:"gray",children:"[]"},void 0,!1,void 0,this);let G=5;return C.jsxDEV(C.Fragment,{children:[`
143
+ `,Y.slice(0,G).map((N,z)=>C.jsxDEV(Q,{children:[C.jsxDEV(Q,{children:W},void 0,!1,void 0,this),C.jsxDEV(Q,{color:"green",children:"- "},void 0,!1,void 0,this)," ",Z(N,J+1,X+1),z<Math.min(Y.length,G)-1?`
144
+ `:""]},void 0,!0,void 0,this)),Y.length>G&&C.jsxDEV(Q,{children:[`
145
+ `,C.jsxDEV(Q,{children:W},void 0,!1,void 0,this),C.jsxDEV(Q,{dimColor:!0,children:["... (",Y.length-G," more)"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}let O=Object.keys(Y);if(O.length===0)return C.jsxDEV(Q,{color:"gray"},void 0,!1,void 0,this);let _=5;return C.jsxDEV(C.Fragment,{children:[O.slice(0,_).map((G,N)=>C.jsxDEV(Q,{children:[C.jsxDEV(Q,{children:W},void 0,!1,void 0,this),C.jsxDEV(Q,{color:"blue",children:G},void 0,!1,void 0,this)," ",C.jsxDEV(Q,{color:"gray",children:": "},void 0,!1,void 0,this)," ",Z(Y[G],J+1,X+1),N<Math.min(O.length,_)-1?`
146
+ `:""]},void 0,!0,void 0,this)),O.length>_&&C.jsxDEV(Q,{children:[`
147
+ `,C.jsxDEV(Q,{children:W},void 0,!1,void 0,this),C.jsxDEV(Q,{dimColor:!0,children:["... (",O.length-_," more)"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)};return C.jsxDEV(Q,{children:Z($)},void 0,!1,void 0,this)},v5=({message:$,messageNumber:Z})=>{let{getToolUIRender:Y,client:J}=$1(),X=new uZ($,J),K=X.getInputRepaired(),W=K?.title?`: ${K.title}`:K?.description?`: ${K.description}`:"",O=$.name?Y($.name):null,_=P5($.name||"");return _=$.status==="error"?"red":"yellow",C.jsxDEV(m,{children:C.jsxDEV(U,{flexDirection:"column",children:[C.jsxDEV(U,{children:[C.jsxDEV(Q,{color:_,children:[Z," ",$.name,C.jsxDEV(Q,{color:"gray",children:W},void 0,!1,void 0,this)]},void 0,!0,void 0,this),C.jsxDEV(Q,{children:[" ",C5($?.status)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),O?C.jsxDEV(U,{children:[C.jsxDEV(Q,{color:"gray",children:"└─ "},void 0,!1,void 0,this),C.jsxDEV(U,{flexDirection:"column",children:O($)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):C.jsxDEV(U,{flexDirection:"column",paddingTop:0,children:[C.jsxDEV(U,{children:[C.jsxDEV(Q,{color:"gray",children:"└─ "},void 0,!1,void 0,this),C.jsxDEV(I5,{content:X.getInputRepaired()},void 0,!1,void 0,this)]},void 0,!0,void 0,this),C.jsxDEV(U,{paddingTop:0,paddingBottom:0,children:[C.jsxDEV(Q,{color:"gray",children:"└─ "},void 0,!1,void 0,this),C.jsxDEV(Q,{dimColor:!0,italic:!0,children:S5(K4($.content))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.sub_messages?.length?C.jsxDEV(U,{children:[C.jsxDEV(Q,{color:"gray",children:"└─ "},void 0,!1,void 0,this),C.jsxDEV(Q,{color:_,dimColor:!0,children:["(hidden ",$.sub_messages.length," subagent messages)"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},W4=v5;var z$=A(q(),1),Q4=PZ.memo(function({renderMessages:Z,startIndex:Y,staticKey:J,loading:X}){let[K,W]=PZ.useState(!1);M1(()=>W(!0),K?null:0);let O=(z,F,L,w)=>z$.jsxDEV(U,{flexDirection:"column",paddingLeft:1,paddingBottom:1,children:z.type==="human"?z$.jsxDEV(FZ,{content:z.content,messageNumber:F+1+Y},void 0,!1,void 0,this):z.type==="tool"?z$.jsxDEV(W4,{message:z,messageNumber:F+1+Y},void 0,!1,void 0,this):z$.jsxDEV(BZ,{message:z,messageNumber:F+1+Y,loading:X},void 0,!1,void 0,this)},z.id?`${w}-${z.id}`:`${w}-msg-${F}`,!1,void 0,this),_=Z.findIndex((z)=>{if(z.type==="tool"&&!z.done&&!["success","error"].includes(z.status))return!0;return!1});if(_===-1)_=Z.length-1;let G=Z.slice(0,_),N=Z.slice(_);if(!K)return z$.jsxDEV(U,{flexDirection:"column",children:Z.map((z,F)=>O(z,F,F===_,"init"))},void 0,!1,void 0,this);return z$.jsxDEV(U,{flexDirection:"column",children:[z$.jsxDEV(fZ,{items:G,children:(z,F)=>O(z,F,!1,"hist")},J,!1,void 0,this),N.map((z,F)=>O(z,G.length+F,!0,"curr"))]},void 0,!0,void 0,this)});var N$=A(h(),1);var u$=A(h(),1);var CZ=A(q(),1),k5=({staticKey:$,children:Z,delay:Y=1})=>{let[J,X]=u$.useState(!0),K=u$.useRef(!0);return u$.useEffect(()=>{X(!1),K.current=!0},[$]),M1(()=>{if(K.current)console.clear(),X(!0),K.current=!1},J?null:Y),CZ.jsxDEV(CZ.Fragment,{children:J?Z():null},void 0,!1,void 0,this)},_4=k5;var a=A(q(),1),T5=N$.memo(function({toolGroup:Z,groupId:Y,getToolUIRender:J,depth:X=0,loading:K}){if(X>1)return null;return a.jsxDEV(U,{flexDirection:"column",children:Z.map((W,O)=>{let _=W.name?J(W.name):null;if(!_)return null;let G=W.sub_messages?.length||0,N=W.sub_messages?.slice(-4)||[],z=G-N.length;return a.jsxDEV(N$.Fragment,{children:[a.jsxDEV(()=>{return a.jsxDEV(m,{fallback:W.name+" is error",children:_(W)},void 0,!1,void 0,this)},{},void 0,!1,void 0,this),N.length?a.jsxDEV(a.Fragment,{children:[z>0&&a.jsxDEV(U,{paddingLeft:2,children:a.jsxDEV(Q,{dimColor:!0,children:["... ",z," more submessage",z>1?"s":""]},void 0,!0,void 0,this)},void 0,!1,void 0,this),a.jsxDEV(_0,{renderMessages:N,startIndex:1,depth:X+1,staticKey:`sub-d${X}-i${O}`,getToolUIRender:J,loading:K},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},`${Y}-${O}-${W.status}`,!0,void 0,this)})},void 0,!1,void 0,this)}),O4=N$.memo(function({message:Z,displayIndex:Y,isCurrent:J,startIndex:X=0,getToolUIRender:K,depth:W=0,loading:O}){return a.jsxDEV(U,{flexDirection:"column",paddingBottom:1,children:[Z.type==="human"?a.jsxDEV(FZ,{content:Z.content,messageNumber:Y+1+X},void 0,!1,void 0,this):null,Z.type==="ai"?a.jsxDEV(BZ,{message:Z,messageNumber:Y+1+X,loading:O},void 0,!1,void 0,this):null,Z.type==="group"&&a.jsxDEV(a.Fragment,{children:a.jsxDEV(T5,{toolGroup:Z.toolGroup,groupId:Z.id,getToolUIRender:K,depth:W,loading:O},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}),G4=($)=>{if($.type!=="ai")return!0;try{let Z=D$($);return!!(Z&&Z.trim().length>0)}catch{return!1}},_0=N$.memo(function({renderMessages:Z,startIndex:Y,staticKey:J,depth:X=0,getToolUIRender:K,loading:W}){let O=N$.useMemo(()=>{let z=0;return Z.filter((F)=>{if(F.type==="ai")return G4(F);return!0}).reduce((F,L)=>{if(L.type==="tool"){let w=F[F.length-1];if(w&&w.type==="group"&&w.toolGroup.length<5)w.toolGroup.push(L);else F.push({id:`tool-group-${z++}`,type:"group",toolGroup:[L]})}else F.push(L);return F},[])},[Z,G4]),_=O.length-1;if(_===-1)_=O.length-1;if(!W)_=O.length;let G=O.slice(0,_),N=O.slice(_);return a.jsxDEV(U,{flexDirection:"column",children:[a.jsxDEV(_4,{staticKey:`${J} ${G.length}`,children:()=>a.jsxDEV(fZ,{items:G,children:(z,F)=>a.jsxDEV(O4,{message:z,displayIndex:F,isCurrent:!1,startIndex:Y,getToolUIRender:K,depth:X,loading:W},z.id?`hist-${z.id}`:`hist-msg-${X}-${F}`,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),N.map((z,F)=>a.jsxDEV(O4,{message:z,displayIndex:G.length+F,isCurrent:!0,startIndex:Y,getToolUIRender:K,depth:X,loading:W},z.id?`curr-${z.id}`:`curr-msg-${X}-${G.length}-${F}`,!1,void 0,this))]},void 0,!0,void 0,this)});var P=A(q(),1),y5=()=>{let $=HZ(),Z=new Date().toLocaleDateString(),{extraParams:Y,AVAILABLE_MODELS:J,config:X}=Z1(),K=Y.mcp_config||{},W=Object.keys(K).length,O=U4(),_=process.platform,G=_==="darwin"?"macOS":_==="win32"?"Windows":"Linux",N=process.cwd(),z=X?.provider_id||process.env.MODEL_PROVIDER||"openai",L=!!X?.providers?.find((b)=>b.id===z)?.apiKey,w=J.length>0,M=L&&w;return P.jsxDEV(U,{flexDirection:"column",borderStyle:"round",borderColor:"cyan",paddingX:1,marginBottom:1,children:[P.jsxDEV(U,{flexDirection:"row",justifyContent:"space-between",borderBottom:!1,children:[P.jsxDEV(Q,{color:"cyan",bold:!0,children:"ZEN CODE"},void 0,!1,void 0,this),P.jsxDEV(Q,{color:"gray",children:Z},void 0,!1,void 0,this)]},void 0,!0,void 0,this),P.jsxDEV(U,{flexDirection:"row",marginTop:1,gap:2,children:[P.jsxDEV(U,{flexDirection:"column",children:P.jsxDEV(Q,{color:"cyan",children:`███████╗███████╗███╗ ██╗
160
148
  ╚══███╔╝██╔════╝████╗ ██║
161
149
  ███╔╝ █████╗ ██╔██╗ ██║
162
150
  ███╔╝ ██╔══╝ ██║╚██╗██║
163
151
  ███████╗███████╗██║ ╚████║
164
- ╚══════╝╚══════╝╚═╝ ╚═══╝`},void 0,!1,void 0,this)},void 0,!1,void 0,this),T.jsxDEV(_,{flexDirection:"column",justifyContent:"center",flexGrow:1,children:[T.jsxDEV(_,{marginBottom:1,children:w?T.jsxDEV(O,{color:"green",bold:!0,children:[" ","[ SYSTEM ONLINE ]"]},void 0,!0,void 0,this):T.jsxDEV(O,{color:"red",bold:!0,children:[" ","[ CONFIG REQUIRED ]"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),T.jsxDEV(_,{flexDirection:"column",gap:0,children:[T.jsxDEV(_,{children:[T.jsxDEV(O,{color:"blue",children:"USER::"},void 0,!1,void 0,this),T.jsxDEV(O,{color:"white",children:Z},void 0,!1,void 0,this)]},void 0,!0,void 0,this),T.jsxDEV(_,{children:[T.jsxDEV(O,{color:"blue",children:"ARCH::"},void 0,!1,void 0,this),T.jsxDEV(O,{color:"white",children:process.arch},void 0,!1,void 0,this)]},void 0,!0,void 0,this),T.jsxDEV(_,{children:[T.jsxDEV(O,{color:"blue",children:"PLATFORM::"},void 0,!1,void 0,this),T.jsxDEV(O,{color:"white",children:z},void 0,!1,void 0,this)]},void 0,!0,void 0,this),T.jsxDEV(_,{children:[T.jsxDEV(O,{color:"blue",children:"NODE::"},void 0,!1,void 0,this),T.jsxDEV(O,{color:"white",children:process.version},void 0,!1,void 0,this)]},void 0,!0,void 0,this),T.jsxDEV(_,{children:[T.jsxDEV(O,{color:"blue",children:"TERM::"},void 0,!1,void 0,this),T.jsxDEV(O,{color:"white",children:U},void 0,!1,void 0,this)]},void 0,!0,void 0,this),T.jsxDEV(_,{children:[T.jsxDEV(O,{color:"blue",children:[G?.toUpperCase(),"::"]},void 0,!0,void 0,this),T.jsxDEV(O,{color:N?"white":"red",children:N?X.model_id:"无可用模型"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),T.jsxDEV(_,{marginTop:1,paddingX:1,flexDirection:"column",gap:0,children:[T.jsxDEV(_,{children:T.jsxDEV(O,{color:"blue",children:"WORKING_DIR ::"},void 0,!1,void 0,this)},void 0,!1,void 0,this),T.jsxDEV(_,{children:T.jsxDEV(O,{color:"gray",children:H},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),!w&&T.jsxDEV(_,{marginTop:1,paddingX:1,flexDirection:"column",gap:0,children:[T.jsxDEV(O,{color:"red",bold:!0,children:["⚠️ 需要配置 ",G==="anthropic"?"Anthropic":"OpenAI"," API:"]},void 0,!0,void 0,this),!M&&T.jsxDEV(O,{color:"yellow",children:" • 请使用 /m 进入模型配置面板"},void 0,!1,void 0,this),!N&&T.jsxDEV(O,{color:"yellow",children:" • 请确保网络连接正常以获取模型列表"},void 0,!1,void 0,this),T.jsxDEV(O,{color:"gray",children:" • 配置后使用 /m 查看可用模型"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),T.jsxDEV(_,{marginTop:1,paddingTop:1,borderTop:!1,flexDirection:"row",justifyContent:"space-between",children:[T.jsxDEV(_,{gap:3,children:[T.jsxDEV(_,{children:[T.jsxDEV(O,{color:"green",children:"●"},void 0,!1,void 0,this),T.jsxDEV(O,{color:"white",dimColor:!0,children:[" ","AGENTS"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),T.jsxDEV(_,{children:[T.jsxDEV(O,{color:K>0?"green":"gray",children:"●"},void 0,!1,void 0,this),T.jsxDEV(O,{color:"white",dimColor:!0,children:[" ","MCP (",K,")"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),T.jsxDEV(_,{children:[w?T.jsxDEV(O,{color:"yellow",bold:!0,children:">>> WAITING_FOR_INPUT"},void 0,!1,void 0,this):T.jsxDEV(O,{color:"red",bold:!0,children:">>> CONFIGURATION_NEEDED"},void 0,!1,void 0,this),T.jsxDEV(O,{color:"yellow",dimColor:!0,children:[" ","▌"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},EJ=mW;var mY=P(g(),1);var g0=P(g(),1);class bJ{commands=new Map;aliases=new Map;register(Z){if(this.commands.set(Z.name,Z),Z.aliases)Z.aliases.forEach((Y)=>{this.aliases.set(Y,Z.name)})}getCommand(Z){let Y=this.aliases.get(Z)||Z;return this.commands.get(Y)}getAllCommands(){return Array.from(this.commands.values())}isCommand(Z){return Z.trim().startsWith("/")}parseCommand(Z){if(!this.isCommand(Z))return null;let X=Z.trim().slice(1).split(/\s+/),J=X[0],Q=X.slice(1);return{command:J,args:Q}}async executeCommand(Z,Y){let X=this.parseCommand(Z);if(!X)return{success:!1,message:"无效的命令格式"};let{command:J,args:Q}=X,$=this.getCommand(J);if(!$)return{success:!1,message:`未知命令: /${J}`};if($.requiresArgs&&Q.length===0)return{success:!1,message:`命令 /${J} 需要参数。用法: ${$.usage||`/${J} <args>`}`};if($.validateArgs&&!$.validateArgs(Q))return{success:!1,message:`命令 /${J} 参数无效。用法: ${$.usage||`/${J} <args>`}`};try{return await $.execute(Q,Y)}catch(K){return{success:!1,message:`命令执行失败: ${K instanceof Error?K.message:String(K)}`}}}getSuggestions(Z){if(!Z.startsWith("/"))return[];let Y=Z.slice(1).toLowerCase(),X=[];if(Y===""){let U=["new","history","task","agent","model","settings","mcp","knowledge","summarize","template","plan","interview","help"];for(let W of U){let z=this.commands.get(W);if(z)X.push({command:W,displayText:`/${W}`,description:z.description})}return X.slice(0,10)}let J=new Set(["history","knowledge","help","init","model","config"]),Q=[],$=[];for(let[U,W]of this.commands){let z=U.toLowerCase();if(z.startsWith(Y))Q.push({command:U,displayText:`/${U}`,description:W.description});else if(z.includes(Y))$.push({command:U,displayText:`/${U}`,description:W.description});if(W.aliases)for(let H of W.aliases){let G=H.toLowerCase();if(G.startsWith(Y))Q.push({command:U,displayText:`/${H}`,description:`${W.description} (别名)`});else if(G.includes(Y))$.push({command:U,displayText:`/${H}`,description:`${W.description} (别名)`})}}let K=(U,W)=>{let z=J.has(U.command)?1:0,H=J.has(W.command)?1:0;if(z!==H)return H-z;return U.displayText.length-W.displayText.length};return Q.sort(K),$.sort(K),X.push(...Q,...$),X.slice(0,10)}getHelp(Z){if(Z){let X=this.getCommand(Z);if(!X)return`未找到命令: /${Z}`;let J=`命令: /${X.name}
165
- `;if(J+=`描述: ${X.description}
166
- `,X.usage)J+=`用法: ${X.usage}
167
- `;if(X.aliases&&X.aliases.length>0)J+=`别名: ${X.aliases.map((Q)=>`/${Q}`).join(", ")}
168
- `;return J}let Y=`可用命令:
169
- `;for(let X of this.getAllCommands())Y+=` /${X.name} - ${X.description}
170
- `;return Y+=`
171
- 使用 /help <命令名> 获取具体命令的帮助信息`,Y}}var L4=new bJ;var TJ={name:"settings",description:"打开 Settings 面板(Model 和 Provider 配置)",aliases:["s","model","settings","m"],usage:"/settings",execute:async(Z,Y)=>{return Y.switchToSettings?.(),{success:!0,message:"打开 Settings 面板",shouldClearInput:!0}}};var pW={name:"new",description:"初始化新的对话会话",aliases:["new","n"],usage:"/new [主题]",execute:async(Z,Y)=>{let X=Z.join(" ");if(await Y.createNewChat(),X){let J=`我想开始一个关于 "${X}" 的新对话。`;return Y.sendMessage([{type:"human",content:J}]),{success:!0,message:`已创建新对话,主题: ${X}`,shouldClearInput:!0}}return{success:!0,message:"已创建新对话",shouldClearInput:!0}}},dW={name:"help",description:"显示命令帮助信息",aliases:["h","?"],usage:"/help [命令名]",execute:async(Z,Y)=>{let X=Z[0];return{success:!0,message:L4.getHelp(X),shouldClearInput:!0}}},cW={name:"task",description:"打开任务看板面板",aliases:["tasks","kanban"],usage:"/task",execute:async(Z,Y)=>{return Y.switchToTask?.(),{success:!0,message:"打开任务看板",shouldClearInput:!0}}},lW={name:"process",description:"打开进程管理器面板",aliases:["ps","proc"],usage:"/process",execute:async(Z,Y)=>{return Y.switchToProcess?.(),{success:!0,message:"打开进程管理器",shouldClearInput:!0}}},fJ=[pW,dW,cW,TJ,lW];import{readFileSync as iW,readdirSync as rW}from"fs";import{join as jJ}from"path";var x0=null;function oW(Z){let Y=Z.split(`
172
- `);if(Y[0]!=="---")return{metadata:{},content:Z};let X=Y.indexOf("---",1);if(X===-1)return{metadata:{},content:Z};let J=Y.slice(1,X),Q={};for(let K of J){let U=K.match(/^(\w+):\s*(.+)$/);if(U){let[,W,z]=U;if(W==="name")Q.name=z.trim();if(W==="description")Q.description=z.trim()}}let $=Y.slice(X+1).join(`
173
- `).trim();return{metadata:Q,content:$}}function SJ(Z,Y){let X=new Map;try{let J=rW(Z,{withFileTypes:!0});for(let Q of J){let $=jJ(Z,Q.name);if(Q.isDirectory())SJ($,Y).forEach((U)=>X.set(U.name,U));else if(Q.name.endsWith(".md"))try{let K=iW($,"utf-8"),{metadata:U,content:W}=oW(K),z=U.name||Q.name.replace(/\.md$/,"");if(!U.name)console.warn(`Template missing "name" in frontmatter: ${$}`);X.set(z,{name:z,description:U.description||"No description",content:W,path:$})}catch(K){console.warn(`Failed to read template file: ${$}`,K)}}}catch(J){if(J.code!=="ENOENT")console.warn(`Error scanning templates directory: ${Z}`,J)}return X}function yJ(){x0=null}function kJ(Z="./.claude/templates"){if(x0)return Array.from(x0.values());let Y=Z.startsWith("/")?Z:jJ(process.cwd(),Z);return x0=SJ(Y,Y),Array.from(x0.values())}var nW={name:"status",description:"显示当前聊天状态信息",aliases:["stat","info"],execute:async(Z,Y)=>{return{success:!0,message:[`当前代理: ${Y.client?.availableAssistants.find((Q)=>Q.graph_id===Y.currentAgent)?.name||"未选择"} (${Y.currentAgent||"N/A"})`,`聊天ID: ${Y.client?.currentChatId?.slice(-8)||"N/A"}`,`可用代理数: ${Y.client?.availableAssistants?.length||0}`,`模型: ${Y.extraParams?.model_id||"N/A"}`].join(`
174
- `),shouldClearInput:!0}}},aW={name:"template",description:"插入预定义的消息模板",aliases:["tpl","t"],usage:"/template <模板名>",execute:async(Z,Y)=>{let X=Z[0];if(Z.includes("--refresh"))return yJ(),{success:!0,message:"模板缓存已清除",shouldClearInput:!0};let J=kJ();if(!X){if(J.length===0)return{success:!0,message:"当前没有可用的模板。可以在 ./.claude/templates/ 目录下创建 .md 模板文件。",shouldClearInput:!0};return{success:!0,message:`可用模板:
175
- ${J.map((K)=>` - ${K.name}: ${K.description}`).join(`
152
+ ╚══════╝╚══════╝╚═╝ ╚═══╝`},void 0,!1,void 0,this)},void 0,!1,void 0,this),P.jsxDEV(U,{flexDirection:"column",justifyContent:"center",flexGrow:1,children:[P.jsxDEV(U,{marginBottom:1,children:M?P.jsxDEV(Q,{color:"green",bold:!0,children:[" ","[ SYSTEM ONLINE ]"]},void 0,!0,void 0,this):P.jsxDEV(Q,{color:"red",bold:!0,children:[" ","[ CONFIG REQUIRED ]"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),P.jsxDEV(U,{flexDirection:"column",gap:0,children:[P.jsxDEV(U,{children:[P.jsxDEV(Q,{color:"blue",children:"USER::"},void 0,!1,void 0,this),P.jsxDEV(Q,{color:"white",children:$},void 0,!1,void 0,this)]},void 0,!0,void 0,this),P.jsxDEV(U,{children:[P.jsxDEV(Q,{color:"blue",children:"ARCH::"},void 0,!1,void 0,this),P.jsxDEV(Q,{color:"white",children:process.arch},void 0,!1,void 0,this)]},void 0,!0,void 0,this),P.jsxDEV(U,{children:[P.jsxDEV(Q,{color:"blue",children:"PLATFORM::"},void 0,!1,void 0,this),P.jsxDEV(Q,{color:"white",children:G},void 0,!1,void 0,this)]},void 0,!0,void 0,this),P.jsxDEV(U,{children:[P.jsxDEV(Q,{color:"blue",children:"NODE::"},void 0,!1,void 0,this),P.jsxDEV(Q,{color:"white",children:process.version},void 0,!1,void 0,this)]},void 0,!0,void 0,this),P.jsxDEV(U,{children:[P.jsxDEV(Q,{color:"blue",children:"TERM::"},void 0,!1,void 0,this),P.jsxDEV(Q,{color:"white",children:O},void 0,!1,void 0,this)]},void 0,!0,void 0,this),P.jsxDEV(U,{children:[P.jsxDEV(Q,{color:"blue",children:[z?.toUpperCase(),"::"]},void 0,!0,void 0,this),P.jsxDEV(Q,{color:w?"white":"red",children:w?Y.model_id:"无可用模型"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),P.jsxDEV(U,{marginTop:1,paddingX:1,flexDirection:"column",gap:0,children:[P.jsxDEV(U,{children:P.jsxDEV(Q,{color:"blue",children:"WORKING_DIR ::"},void 0,!1,void 0,this)},void 0,!1,void 0,this),P.jsxDEV(U,{children:P.jsxDEV(Q,{color:"gray",children:N},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),!M&&P.jsxDEV(U,{marginTop:1,paddingX:1,flexDirection:"column",gap:0,children:[P.jsxDEV(Q,{color:"red",bold:!0,children:["⚠️ 需要配置 ",z==="anthropic"?"Anthropic":"OpenAI"," API:"]},void 0,!0,void 0,this),!L&&P.jsxDEV(Q,{color:"yellow",children:" • 请使用 /m 进入模型配置面板"},void 0,!1,void 0,this),!w&&P.jsxDEV(Q,{color:"yellow",children:" • 请确保网络连接正常以获取模型列表"},void 0,!1,void 0,this),P.jsxDEV(Q,{color:"gray",children:" • 配置后使用 /m 查看可用模型"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),P.jsxDEV(U,{marginTop:1,paddingTop:1,borderTop:!1,flexDirection:"row",justifyContent:"space-between",children:[P.jsxDEV(U,{gap:3,children:[P.jsxDEV(U,{children:[P.jsxDEV(Q,{color:"green",children:"●"},void 0,!1,void 0,this),P.jsxDEV(Q,{color:"white",dimColor:!0,children:[" ","AGENTS"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),P.jsxDEV(U,{children:[P.jsxDEV(Q,{color:W>0?"green":"gray",children:"●"},void 0,!1,void 0,this),P.jsxDEV(Q,{color:"white",dimColor:!0,children:[" ","MCP (",W,")"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),P.jsxDEV(U,{children:[M?P.jsxDEV(Q,{color:"yellow",bold:!0,children:">>> WAITING_FOR_INPUT"},void 0,!1,void 0,this):P.jsxDEV(Q,{color:"red",bold:!0,children:">>> CONFIGURATION_NEEDED"},void 0,!1,void 0,this),P.jsxDEV(Q,{color:"yellow",dimColor:!0,children:[" ","▌"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},z4=y5;var kZ=A(h(),1);var YZ=A(h(),1);class N4{commands=new Map;aliases=new Map;register($){if(this.commands.set($.name,$),$.aliases)$.aliases.forEach((Z)=>{this.aliases.set(Z,$.name)})}getCommand($){let Z=this.aliases.get($)||$;return this.commands.get(Z)}getAllCommands(){return Array.from(this.commands.values())}isCommand($){return $.trim().startsWith("/")}parseCommand($){if(!this.isCommand($))return null;let Y=$.trim().slice(1).split(/\s+/),J=Y[0],X=Y.slice(1);return{command:J,args:X}}async executeCommand($,Z){let Y=this.parseCommand($);if(!Y)return{success:!1,message:"无效的命令格式"};let{command:J,args:X}=Y,K=this.getCommand(J);if(!K)return{success:!1,message:`未知命令: /${J}`};if(K.requiresArgs&&X.length===0)return{success:!1,message:`命令 /${J} 需要参数。用法: ${K.usage||`/${J} <args>`}`};if(K.validateArgs&&!K.validateArgs(X))return{success:!1,message:`命令 /${J} 参数无效。用法: ${K.usage||`/${J} <args>`}`};try{return await K.execute(X,Z)}catch(W){return{success:!1,message:`命令执行失败: ${W instanceof Error?W.message:String(W)}`}}}getSuggestions($){if(!$.startsWith("/"))return[];let Z=$.slice(1).toLowerCase(),Y=[];if(Z===""){let O=["new","history","task","agent","model","settings","mcp","knowledge","summarize","template","plan","interview","help"];for(let _ of O){let G=this.commands.get(_);if(G)Y.push({command:_,displayText:`/${_}`,description:G.description})}return Y.slice(0,10)}let J=new Set(["history","knowledge","help","init","model","config"]),X=[],K=[];for(let[O,_]of this.commands){let G=O.toLowerCase();if(G.startsWith(Z))X.push({command:O,displayText:`/${O}`,description:_.description});else if(G.includes(Z))K.push({command:O,displayText:`/${O}`,description:_.description});if(_.aliases)for(let N of _.aliases){let z=N.toLowerCase();if(z.startsWith(Z))X.push({command:O,displayText:`/${N}`,description:`${_.description} (别名)`});else if(z.includes(Z))K.push({command:O,displayText:`/${N}`,description:`${_.description} (别名)`})}}let W=(O,_)=>{let G=J.has(O.command)?1:0,N=J.has(_.command)?1:0;if(G!==N)return N-G;return O.displayText.length-_.displayText.length};return X.sort(W),K.sort(W),Y.push(...X,...K),Y.slice(0,10)}getHelp($){if($){let Y=this.getCommand($);if(!Y)return`未找到命令: /${$}`;let J=`命令: /${Y.name}
153
+ `;if(J+=`描述: ${Y.description}
154
+ `,Y.usage)J+=`用法: ${Y.usage}
155
+ `;if(Y.aliases&&Y.aliases.length>0)J+=`别名: ${Y.aliases.map((X)=>`/${X}`).join(", ")}
156
+ `;return J}let Z=`可用命令:
157
+ `;for(let Y of this.getAllCommands())Z+=` /${Y.name} - ${Y.description}
158
+ `;return Z+=`
159
+ 使用 /help <命令名> 获取具体命令的帮助信息`,Z}}var J$=new N4;var H4={name:"settings",description:"打开 Settings 面板(Model 和 Provider 配置)",aliases:["s","model","settings","m"],usage:"/settings",execute:async($,Z)=>{return Z.switchToSettings?.(),{success:!0,message:"打开 Settings 面板",shouldClearInput:!0}}};var h5={name:"new",description:"初始化新的对话会话",aliases:["new","n"],usage:"/new [主题]",execute:async($,Z)=>{let Y=$.join(" ");if(await Z.createNewChat(),Y){let J=`我想开始一个关于 "${Y}" 的新对话。`;return Z.sendMessage([{type:"human",content:J}]),{success:!0,message:`已创建新对话,主题: ${Y}`,shouldClearInput:!0}}return{success:!0,message:"已创建新对话",shouldClearInput:!0}}},D5={name:"help",description:"显示命令帮助信息",aliases:["h","?"],usage:"/help [命令名]",execute:async($,Z)=>{let Y=$[0];return{success:!0,message:J$.getHelp(Y),shouldClearInput:!0}}},V5={name:"task",description:"打开任务看板面板",aliases:["tasks","kanban"],usage:"/task",execute:async($,Z)=>{return Z.switchToTask?.(),{success:!0,message:"打开任务看板",shouldClearInput:!0}}},j5={name:"process",description:"打开进程管理器面板",aliases:["ps","proc"],usage:"/process",execute:async($,Z)=>{return Z.switchToProcess?.(),{success:!0,message:"打开进程管理器",shouldClearInput:!0}}},F4=[h5,D5,V5,H4,j5];import{readFileSync as E5,readdirSync as g5}from"fs";import{join as L4}from"path";var ZZ=null;function p5($){let Z=$.split(`
160
+ `);if(Z[0]!=="---")return{metadata:{},content:$};let Y=Z.indexOf("---",1);if(Y===-1)return{metadata:{},content:$};let J=Z.slice(1,Y),X={};for(let W of J){let O=W.match(/^(\w+):\s*(.+)$/);if(O){let[,_,G]=O;if(_==="name")X.name=G.trim();if(_==="description")X.description=G.trim()}}let K=Z.slice(Y+1).join(`
161
+ `).trim();return{metadata:X,content:K}}function A4($,Z){let Y=new Map;try{let J=g5($,{withFileTypes:!0});for(let X of J){let K=L4($,X.name);if(X.isDirectory())A4(K,Z).forEach((O)=>Y.set(O.name,O));else if(X.name.endsWith(".md"))try{let W=E5(K,"utf-8"),{metadata:O,content:_}=p5(W),G=O.name||X.name.replace(/\.md$/,"");if(!O.name)console.warn(`Template missing "name" in frontmatter: ${K}`);Y.set(G,{name:G,description:O.description||"No description",content:_,path:K})}catch(W){console.warn(`Failed to read template file: ${K}`,W)}}}catch(J){if(J.code!=="ENOENT")console.warn(`Error scanning templates directory: ${$}`,J)}return Y}function w4(){ZZ=null}function M4($="./.claude/templates"){if(ZZ)return Array.from(ZZ.values());let Z=$.startsWith("/")?$:L4(process.cwd(),$);return ZZ=A4(Z,Z),Array.from(ZZ.values())}var m5={name:"status",description:"显示当前聊天状态信息",aliases:["stat","info"],execute:async($,Z)=>{return{success:!0,message:[`当前代理: ${Z.client?.availableAssistants.find((X)=>X.graph_id===Z.currentAgent)?.name||"未选择"} (${Z.currentAgent||"N/A"})`,`聊天ID: ${Z.client?.currentChatId?.slice(-8)||"N/A"}`,`可用代理数: ${Z.client?.availableAssistants?.length||0}`,`模型: ${Z.extraParams?.model_id||"N/A"}`].join(`
162
+ `),shouldClearInput:!0}}},c5={name:"template",description:"插入预定义的消息模板",aliases:["tpl","t"],usage:"/template <模板名>",execute:async($,Z)=>{let Y=$[0];if($.includes("--refresh"))return w4(),{success:!0,message:"模板缓存已清除",shouldClearInput:!0};let J=M4();if(!Y){if(J.length===0)return{success:!0,message:"当前没有可用的模板。可以在 ./.claude/templates/ 目录下创建 .md 模板文件。",shouldClearInput:!0};return{success:!0,message:`可用模板:
163
+ ${J.map((W)=>` - ${W.name}: ${W.description}`).join(`
176
164
  `)}
177
165
 
178
- 使用 /template <name> 插入模板`,shouldClearInput:!0}}let Q=J.find(($)=>$.name===X);if(!Q){let $=J.map((K)=>K.name).join(", ");return{success:!1,message:`未找到模板 "${X}"。可用模板: ${$||"(无)"}`}}return Y.setUserInput(Q.content),{success:!0,message:`已插入模板: ${Q.name}
179
- ${Q.description}`,shouldClearInput:!1}}},sW={name:"config",description:"查看或设置配置项",aliases:["cfg"],usage:"/config [key] [value]",execute:async(Z,Y)=>{if(Z.length===0)return{success:!0,message:["当前配置:",` model_id: ${Y.extraParams?.model_id||"N/A"}`,` provider_id: ${Y.extraParams?.provider_id||"N/A"}`,` enable_thinking: ${Y.extraParams?.enable_thinking??!0}`,` compact_mode: ${Y.compactMode??!1}`,` stream_refresh_interval: ${Y.extraParams?.stream_refresh_interval}`,"","使用方法:"," /config <key> <value> - 设置配置项"," /config <key> - 查看配置项","","可用配置项:"," model_id - 当前使用的模型 ID"," provider_id - 当前使用的 Provider ID"," enable_thinking - 启用思考模式 (true, false)"," compact_mode - 紧凑模式 (true, false)"," stream_refresh_interval - 流刷新间隔"].join(`
180
- `),shouldClearInput:!0};let X=Z[0],J=["enable_thinking","stream_refresh_interval","provider_id","model_id","compact_mode"];if(!J.includes(X))return{success:!1,message:`无效的配置项: ${X}
181
- 可用配置项: ${J.join(", ")}`,shouldClearInput:!0};if(Z.length===1){let $;switch(X){case"model_id":$=Y.extraParams?.model_id;break;case"provider_id":$=Y.extraParams?.provider_id;break;case"enable_thinking":$=Y.extraParams?.enable_thinking??!0;break;case"compact_mode":$=Y.compactMode??!1;break;case"stream_refresh_interval":$=Y.extraParams?.stream_refresh_interval;break}return{success:!0,message:`${X}: ${$??"未设置"}`,shouldClearInput:!0}}let Q=Z.slice(1).join(" ");if(X==="enable_thinking"||X==="compact_mode"){if(Q==="true"||Q==="1"||Q==="yes")Q=!0;else if(Q==="false"||Q==="0"||Q==="no")Q=!1}if(X==="stream_refresh_interval"){let $=parseInt(Q,10);if(!isNaN($))Q=$}try{if(!Y.updateConfig)return{success:!1,message:"无法访问配置更新功能",shouldClearInput:!0};await Y.updateConfig({[X]:Q});let $=`配置已更新: ${X} = ${Q} 重启程序生效`;if(X==="model_id"||X==="provider_id")$+=`
182
-
183
- 提示: 更换模型或提供商后,请重启程序以确保完整生效`;return{success:!0,message:$,shouldClearInput:!0}}catch($){return{success:!1,message:`配置更新失败: ${$ instanceof Error?$.message:String($)}`,shouldClearInput:!0}}}},tW={name:"mcp",description:"管理 MCP 服务器配置",aliases:[],usage:"/mcp [list|add|remove|get] [args]",execute:async(Z,Y)=>{if(Z.length===0)return{success:!0,message:["MCP 配置管理命令:","","用法:"," /mcp list - 列出所有 MCP 服务器"," /mcp add <name> <json_string> - 添加 MCP 服务器 (传统格式)"," /mcp remove <name> - 移除 MCP 服务器"," /mcp get <name> - 查看 MCP 服务器详情","","示例 (JSON 格式):",' /mcp add context7 {"name":"context7","url":"https://mcp.context7.com/mcp"}',""].join(`
184
- `),shouldClearInput:!0};let X=Z[0];try{let Q=(Y.extraParams||{}).mcp_config||{};switch(X){case"list":{let $=Object.keys(Q);if($.length===0)return{success:!0,message:"当前未配置任何 MCP 服务器",shouldClearInput:!0};return{success:!0,message:`已配置的 MCP 服务器:
185
- ${$.map((U)=>{return` - ${U}`}).join(`
186
- `)}`,shouldClearInput:!0}}case"add":{if(Z.length<2)return{success:!1,message:"用法: /mcp add <name> <json_string>",shouldClearInput:!0};let[$,K,...U]=Z,W=U.join(""),z={...Q,[K]:JSON.parse(W)};if(!Y.updateConfig)return{success:!1,message:"无法访问配置更新功能",shouldClearInput:!0};return await Y.updateConfig({mcp_config:z}),{success:!0,message:`MCP 服务器 "${K}" 已添加`,shouldClearInput:!0}}case"remove":{if(Z.length<2)return{success:!1,message:"用法: /mcp remove <name>",shouldClearInput:!0};let $=Z[1];if(!Q[$])return{success:!1,message:`MCP 服务器 "${$}" 不存在`,shouldClearInput:!0};let K={...Q};if(delete K[$],!Y.updateConfig)return{success:!1,message:"无法访问配置更新功能",shouldClearInput:!0};return await Y.updateConfig({mcp_config:K}),{success:!0,message:`MCP 服务器 "${$}" 已移除
187
- 重启程序生效`,shouldClearInput:!0}}case"get":{if(Z.length<2)return{success:!1,message:"用法: /mcp get <name>",shouldClearInput:!0};let $=Z[1],K=Q[$];if(!K)return{success:!1,message:`MCP 服务器 "${$}" 不存在`,shouldClearInput:!0};return{success:!0,message:[`MCP 服务器: ${$}`,` URL: ${K.url}`,` Headers: ${JSON.stringify(K.headers||{},null,2)}`].join(`
188
- `),shouldClearInput:!0}}default:return{success:!1,message:`未知操作: ${X}
189
- 可用操作: list, add, remove, get`,shouldClearInput:!0}}}catch(J){return{success:!1,message:`MCP 操作失败: ${J instanceof Error?J.message:String(J)}`,shouldClearInput:!0}}}},eW={name:"summarize",description:"智能总结对话并提取有价值信息保存为记忆",aliases:["sum","summary","compact"],usage:"/sum",execute:async(Z,Y)=>{if(!Y.renderMessages||Y.renderMessages.length===0)return{success:!1,message:"当前会话没有消息可以总结",shouldClearInput:!0};let X=Y.renderMessages.length;try{let J={...Y.extraParams,switch_command:"smart_memory"};return await Y.sendMessage([],{extraParams:J}),{success:!0,message:`正在智能分析 ${X} 条消息并提取记忆...`,shouldClearInput:!0}}catch(J){return{success:!1,message:`总结失败: ${J instanceof Error?J.message:String(J)}`,shouldClearInput:!0}}}},Z2={name:"history",description:"打开历史面板",aliases:["h"],execute:async(Z,Y)=>{if(Y.switchToHistory)return Y.switchToHistory(),{success:!0,message:"已打开历史面板",shouldClearInput:!0};return{success:!1,message:"面板切换功能不可用",shouldClearInput:!0}}},Y2={name:"knowledge",description:"打开知识库面板",aliases:["k"],execute:async(Z,Y)=>{if(Y.switchToKnowledge)return Y.switchToKnowledge(),{success:!0,message:"已打开知识库面板",shouldClearInput:!0};return{success:!1,message:"面板切换功能不可用",shouldClearInput:!0}}},X2={name:"close",description:"关闭当前面板返回聊天",aliases:["c","q"],execute:async(Z,Y)=>{if(Y.closePanel)return Y.closePanel(),{success:!0,message:"已关闭面板",shouldClearInput:!0};return{success:!1,message:"面板关闭功能不可用",shouldClearInput:!0}}},J2={name:"model",description:"打开模型/Provider配置面板",aliases:["mp","m"],execute:async(Z,Y)=>{if(Y.switchToModelProvider)return Y.switchToModelProvider(),{success:!0,message:"已打开模型/Provider配置面板",shouldClearInput:!0};return{success:!1,message:"模型面板切换功能不可用",shouldClearInput:!0}}},Q2={name:"ralph",description:"进入循环模式,持续发送响应直到返回 <COMPLETE></COMPLETE>",aliases:[],usage:"/ralph <text>",requiresArgs:!0,execute:async(Z,Y)=>{let X=Z.join(" ");if(!X.trim())return{success:!1,message:"请提供要循环的文本内容",shouldClearInput:!0};if(Y.startRalphLoop)return Y.startRalphLoop(X),{success:!0,message:`进入 Ralph 循环模式: "${X}"`,shouldClearInput:!0};return{success:!1,message:"Ralph 循环功能不可用",shouldClearInput:!0}}},hJ=[nW,aW,sW,tW,eW,Z2,Y2,X2,J2,Q2];var $2={name:"agent",description:"打开 Agent 选择面板",aliases:["a"],usage:"/agent",execute:async(Z,Y)=>{if(Y.switchToAgent)Y.switchToAgent();return{success:!0,message:"打开 Agent 面板",shouldClearInput:!0}}},xJ=[$2];var K2=`
166
+ 使用 /template <name> 插入模板`,shouldClearInput:!0}}let X=J.find((K)=>K.name===Y);if(!X){let K=J.map((W)=>W.name).join(", ");return{success:!1,message:`未找到模板 "${Y}"。可用模板: ${K||"(无)"}`}}return Z.setUserInput(X.content),{success:!0,message:`已插入模板: ${X.name}
167
+ ${X.description}`,shouldClearInput:!1}}},u5={name:"config",description:"查看或设置配置项",aliases:["cfg"],usage:"/config [key] [value]",execute:async($,Z)=>{if($.length===0)return{success:!0,message:["当前配置:",` model_id: ${Z.extraParams?.model_id||"N/A"}`,` provider_id: ${Z.extraParams?.provider_id||"N/A"}`,` enable_thinking: ${Z.extraParams?.enable_thinking??!0}`,` compact_mode: ${Z.compactMode??!1}`,` stream_refresh_interval: ${Z.extraParams?.stream_refresh_interval}`,"","使用方法:"," /config <key> <value> - 设置配置项"," /config <key> - 查看配置项","","可用配置项:"," model_id - 当前使用的模型 ID"," provider_id - 当前使用的 Provider ID"," enable_thinking - 启用思考模式 (true, false)"," compact_mode - 紧凑模式 (true, false)"," stream_refresh_interval - 流刷新间隔"].join(`
168
+ `),shouldClearInput:!0};let Y=$[0],J=["enable_thinking","stream_refresh_interval","provider_id","model_id","compact_mode"];if(!J.includes(Y))return{success:!1,message:`无效的配置项: ${Y}
169
+ 可用配置项: ${J.join(", ")}`,shouldClearInput:!0};if($.length===1){let K;switch(Y){case"model_id":K=Z.extraParams?.model_id;break;case"provider_id":K=Z.extraParams?.provider_id;break;case"enable_thinking":K=Z.extraParams?.enable_thinking??!0;break;case"compact_mode":K=Z.compactMode??!1;break;case"stream_refresh_interval":K=Z.extraParams?.stream_refresh_interval;break}return{success:!0,message:`${Y}: ${K??"未设置"}`,shouldClearInput:!0}}let X=$.slice(1).join(" ");if(Y==="enable_thinking"||Y==="compact_mode"){if(X==="true"||X==="1"||X==="yes")X=!0;else if(X==="false"||X==="0"||X==="no")X=!1}if(Y==="stream_refresh_interval"){let K=parseInt(X,10);if(!isNaN(K))X=K}try{if(!Z.updateConfig)return{success:!1,message:"无法访问配置更新功能",shouldClearInput:!0};await Z.updateConfig({[Y]:X});let K=`配置已更新: ${Y} = ${X} 重启程序生效`;if(Y==="model_id"||Y==="provider_id")K+=`
170
+
171
+ 提示: 更换模型或提供商后,请重启程序以确保完整生效`;return{success:!0,message:K,shouldClearInput:!0}}catch(K){return{success:!1,message:`配置更新失败: ${K instanceof Error?K.message:String(K)}`,shouldClearInput:!0}}}},x5={name:"mcp",description:"管理 MCP 服务器配置",aliases:[],usage:"/mcp [list|add|remove|get] [args]",execute:async($,Z)=>{if($.length===0)return{success:!0,message:["MCP 配置管理命令:","","用法:"," /mcp list - 列出所有 MCP 服务器"," /mcp add <name> <json_string> - 添加 MCP 服务器 (传统格式)"," /mcp remove <name> - 移除 MCP 服务器"," /mcp get <name> - 查看 MCP 服务器详情","","示例 (JSON 格式):",' /mcp add context7 {"name":"context7","url":"https://mcp.context7.com/mcp"}',""].join(`
172
+ `),shouldClearInput:!0};let Y=$[0];try{let X=(Z.extraParams||{}).mcp_config||{};switch(Y){case"list":{let K=Object.keys(X);if(K.length===0)return{success:!0,message:"当前未配置任何 MCP 服务器",shouldClearInput:!0};return{success:!0,message:`已配置的 MCP 服务器:
173
+ ${K.map((O)=>{return` - ${O}`}).join(`
174
+ `)}`,shouldClearInput:!0}}case"add":{if($.length<2)return{success:!1,message:"用法: /mcp add <name> <json_string>",shouldClearInput:!0};let[K,W,...O]=$,_=O.join(""),G={...X,[W]:JSON.parse(_)};if(!Z.updateConfig)return{success:!1,message:"无法访问配置更新功能",shouldClearInput:!0};return await Z.updateConfig({mcp_config:G}),{success:!0,message:`MCP 服务器 "${W}" 已添加`,shouldClearInput:!0}}case"remove":{if($.length<2)return{success:!1,message:"用法: /mcp remove <name>",shouldClearInput:!0};let K=$[1];if(!X[K])return{success:!1,message:`MCP 服务器 "${K}" 不存在`,shouldClearInput:!0};let W={...X};if(delete W[K],!Z.updateConfig)return{success:!1,message:"无法访问配置更新功能",shouldClearInput:!0};return await Z.updateConfig({mcp_config:W}),{success:!0,message:`MCP 服务器 "${K}" 已移除
175
+ 重启程序生效`,shouldClearInput:!0}}case"get":{if($.length<2)return{success:!1,message:"用法: /mcp get <name>",shouldClearInput:!0};let K=$[1],W=X[K];if(!W)return{success:!1,message:`MCP 服务器 "${K}" 不存在`,shouldClearInput:!0};return{success:!0,message:[`MCP 服务器: ${K}`,` URL: ${W.url}`,` Headers: ${JSON.stringify(W.headers||{},null,2)}`].join(`
176
+ `),shouldClearInput:!0}}default:return{success:!1,message:`未知操作: ${Y}
177
+ 可用操作: list, add, remove, get`,shouldClearInput:!0}}}catch(J){return{success:!1,message:`MCP 操作失败: ${J instanceof Error?J.message:String(J)}`,shouldClearInput:!0}}}},d5={name:"summarize",description:"智能总结对话并提取有价值信息保存为记忆",aliases:["sum","summary","compact"],usage:"/sum",execute:async($,Z)=>{if(!Z.renderMessages||Z.renderMessages.length===0)return{success:!1,message:"当前会话没有消息可以总结",shouldClearInput:!0};let Y=Z.renderMessages.length;try{let J={...Z.extraParams,switch_command:"smart_memory"};return await Z.sendMessage([],{extraParams:J}),{success:!0,message:`正在智能分析 ${Y} 条消息并提取记忆...`,shouldClearInput:!0}}catch(J){return{success:!1,message:`总结失败: ${J instanceof Error?J.message:String(J)}`,shouldClearInput:!0}}}},l5={name:"history",description:"打开历史面板",aliases:["h"],execute:async($,Z)=>{if(Z.switchToHistory)return Z.switchToHistory(),{success:!0,message:"已打开历史面板",shouldClearInput:!0};return{success:!1,message:"面板切换功能不可用",shouldClearInput:!0}}},i5={name:"knowledge",description:"打开知识库面板",aliases:["k"],execute:async($,Z)=>{if(Z.switchToKnowledge)return Z.switchToKnowledge(),{success:!0,message:"已打开知识库面板",shouldClearInput:!0};return{success:!1,message:"面板切换功能不可用",shouldClearInput:!0}}},o5={name:"close",description:"关闭当前面板返回聊天",aliases:["c","q"],execute:async($,Z)=>{if(Z.closePanel)return Z.closePanel(),{success:!0,message:"已关闭面板",shouldClearInput:!0};return{success:!1,message:"面板关闭功能不可用",shouldClearInput:!0}}},r5={name:"model",description:"打开模型/Provider配置面板",aliases:["mp","m"],execute:async($,Z)=>{if(Z.switchToModelProvider)return Z.switchToModelProvider(),{success:!0,message:"已打开模型/Provider配置面板",shouldClearInput:!0};return{success:!1,message:"模型面板切换功能不可用",shouldClearInput:!0}}},n5={name:"ralph",description:"进入循环模式,持续发送响应直到返回 <COMPLETE></COMPLETE>",aliases:[],usage:"/ralph <text>",requiresArgs:!0,execute:async($,Z)=>{let Y=$.join(" ");if(!Y.trim())return{success:!1,message:"请提供要循环的文本内容",shouldClearInput:!0};if(Z.startRalphLoop)return Z.startRalphLoop(Y),{success:!0,message:`进入 Ralph 循环模式: "${Y}"`,shouldClearInput:!0};return{success:!1,message:"Ralph 循环功能不可用",shouldClearInput:!0}}},q4=[m5,c5,u5,x5,d5,l5,i5,o5,r5,n5];var a5={name:"agent",description:"打开 Agent 选择面板",aliases:["a"],usage:"/agent",execute:async($,Z)=>{if(Z.switchToAgent)Z.switchToAgent();return{success:!0,message:"打开 Agent 面板",shouldClearInput:!0}}},b4=[a5];var s5=`
190
178
  [Interview Mode Activated]
191
179
 
192
180
  I want to clarify requirements through guided questions.
@@ -205,8 +193,8 @@ After getting answers:
205
193
  ---
206
194
 
207
195
  User's original message:
208
- `,W2={name:"interview",description:"Start Interview mode to clarify requirements through questions",aliases:["i"],usage:"/interview [your request]",requiresArgs:!0,execute:async(Z,Y)=>{let X=Z.join(" ").trim();if(!X)return{success:!1,message:`❌ Interview 模式需要提供任务描述
209
- 用法: /interview [your request]`};let J=K2+X;return Y.sendMessage([{type:"human",content:J}],{extraParams:Y.extraParams}),{success:!0,message:"\uD83D\uDCCB Interview mode activated",shouldClearInput:!0}}},gJ=[W2];var U2=`
196
+ `,t5={name:"interview",description:"Start Interview mode to clarify requirements through questions",aliases:["i"],usage:"/interview [your request]",requiresArgs:!0,execute:async($,Z)=>{let Y=$.join(" ").trim();if(!Y)return{success:!1,message:`❌ Interview 模式需要提供任务描述
197
+ 用法: /interview [your request]`};let J=s5+Y;return Z.sendMessage([{type:"human",content:J}],{extraParams:Z.extraParams}),{success:!0,message:"\uD83D\uDCCB Interview mode activated",shouldClearInput:!0}}},R4=[t5];var e5=`
210
198
  [Plan Mode Activated]
211
199
 
212
200
  I want to create a comprehensive implementation plan for this task.
@@ -229,8 +217,8 @@ After the plan is created, ask if I want to execute it immediately or save for l
229
217
  ---
230
218
 
231
219
  User's original request:
232
- `,z2={name:"plan",description:"Enter Plan mode to create detailed implementation plans",aliases:["p"],usage:"/plan [your task description]",requiresArgs:!0,execute:async(Z,Y)=>{let X=Z.join(" ").trim();if(!X)return{success:!1,message:`❌ Plan 模式需要提供任务描述
233
- 用法: /plan [your task description]`};let J=U2+X;return Y.sendMessage([{type:"human",content:J}],{extraParams:Y.extraParams}),{success:!0,message:"\uD83D\uDCCB Plan mode activated",shouldClearInput:!0}}},uJ=[z2];var mJ=`
220
+ `,$8={name:"plan",description:"Enter Plan mode to create detailed implementation plans",aliases:["p"],usage:"/plan [your task description]",requiresArgs:!0,execute:async($,Z)=>{let Y=$.join(" ").trim();if(!Y)return{success:!1,message:`❌ Plan 模式需要提供任务描述
221
+ 用法: /plan [your task description]`};let J=e5+Y;return Z.sendMessage([{type:"human",content:J}],{extraParams:Z.extraParams}),{success:!0,message:"\uD83D\uDCCB Plan mode activated",shouldClearInput:!0}}},B4=[$8];var f4=`
234
222
  [Create AGENTS.md Mode Activated]
235
223
 
236
224
  I want to create or update the AGENTS.md file for this project.
@@ -262,7 +250,7 @@ After the AGENTS.md is created or updated, provide a summary of the changes made
262
250
  ---
263
251
 
264
252
  User's request:
265
- `,H2={name:"create-agent-md",description:"Create or update AGENTS.md file with project guidelines",aliases:["agentmd","am"],usage:"/create-agent-md [description or goal for AGENTS.md]",requiresArgs:!0,execute:async(Z,Y)=>{let X=Z.join(" ").trim();if(!X)return{success:!1,message:"❌ 需要提供描述或目标。例如: /create-agent-md 初始化项目指南文档",shouldClearInput:!1};let J=mJ+X;return Y.sendMessage([{type:"human",content:J}],{extraParams:Y.extraParams}),{success:!0,message:"\uD83D\uDCDD AGENTS.md creation mode activated",shouldClearInput:!0}}},G2={name:"init-agents-md",description:"快速初始化 AGENTS.md 项目指南文档",aliases:["iam","init-agents"],usage:"/init-agents-md",requiresArgs:!1,execute:async(Z,Y)=>{let J=mJ+"初始化项目 AGENTS.md 指南文档";return Y.sendMessage([{type:"human",content:J}],{extraParams:Y.extraParams}),{success:!0,message:"\uD83D\uDCDD 开始初始化 AGENTS.md...",shouldClearInput:!0}}},pJ=[H2,G2];var dJ={name:"compact-message",description:"切换紧凑消息显示模式 (紧凑模式显示简化的消息预览)",aliases:["cm"],usage:"/compact-message",requiresArgs:!1,execute:async(Z,Y)=>{try{let{updateConfig:X,compactMode:J}=Y;if(!X)return{success:!1,message:"配置更新功能不可用"};let Q=J??!1;return await X({compact_mode:!Q}),{success:!0,message:!Q?"紧凑模式已启用":"紧凑模式已关闭",shouldClearInput:!0}}catch(X){return{success:!1,message:`切换紧凑模式失败: ${X instanceof Error?X.message:String(X)}`}}}};var cJ={name:"mcp",description:"打开 MCP 服务器配置面板",aliases:[],usage:"/mcp",execute:async(Z,Y)=>{return Y.switchToMcp?.(),{success:!0,message:"打开 MCP 配置面板",shouldClearInput:!0}}};var lJ={name:"settings",description:"打开通用设置面板",aliases:["set"],usage:"/settings",execute:async(Z,Y)=>{if(Y.switchToSettings)return Y.switchToSettings(),{success:!0,message:"打开通用设置面板",shouldClearInput:!0};return{success:!1,message:"Settings 面板不可用",shouldClearInput:!0}}};var O2=`
253
+ `,Z8={name:"create-agent-md",description:"Create or update AGENTS.md file with project guidelines",aliases:["agentmd","am"],usage:"/create-agent-md [description or goal for AGENTS.md]",requiresArgs:!0,execute:async($,Z)=>{let Y=$.join(" ").trim();if(!Y)return{success:!1,message:"❌ 需要提供描述或目标。例如: /create-agent-md 初始化项目指南文档",shouldClearInput:!1};let J=f4+Y;return Z.sendMessage([{type:"human",content:J}],{extraParams:Z.extraParams}),{success:!0,message:"\uD83D\uDCDD AGENTS.md creation mode activated",shouldClearInput:!0}}},Y8={name:"init-agents-md",description:"快速初始化 AGENTS.md 项目指南文档",aliases:["iam","init-agents"],usage:"/init-agents-md",requiresArgs:!1,execute:async($,Z)=>{let J=f4+"初始化项目 AGENTS.md 指南文档";return Z.sendMessage([{type:"human",content:J}],{extraParams:Z.extraParams}),{success:!0,message:"\uD83D\uDCDD 开始初始化 AGENTS.md...",shouldClearInput:!0}}},P4=[Z8,Y8];var C4={name:"compact-message",description:"切换紧凑消息显示模式 (紧凑模式显示简化的消息预览)",aliases:["cm"],usage:"/compact-message",requiresArgs:!1,execute:async($,Z)=>{try{let{updateConfig:Y,compactMode:J}=Z;if(!Y)return{success:!1,message:"配置更新功能不可用"};let X=J??!1;return await Y({compact_mode:!X}),{success:!0,message:!X?"紧凑模式已启用":"紧凑模式已关闭",shouldClearInput:!0}}catch(Y){return{success:!1,message:`切换紧凑模式失败: ${Y instanceof Error?Y.message:String(Y)}`}}}};var S4={name:"mcp",description:"打开 MCP 服务器配置面板",aliases:[],usage:"/mcp",execute:async($,Z)=>{return Z.switchToMcp?.(),{success:!0,message:"打开 MCP 配置面板",shouldClearInput:!0}}};var I4={name:"settings",description:"打开通用设置面板",aliases:["set"],usage:"/settings",execute:async($,Z)=>{if(Z.switchToSettings)return Z.switchToSettings(),{success:!0,message:"打开通用设置面板",shouldClearInput:!0};return{success:!1,message:"Settings 面板不可用",shouldClearInput:!0}}};var X8=`
266
254
  [Memory Organization Mode Activated]
267
255
 
268
256
  I want to organize and manage the .claude/memories folder.
@@ -316,26 +304,26 @@ Provide a detailed report of:
316
304
 
317
305
  ---
318
306
 
319
- `,q2={name:"memory-clear",description:"整理 .claude/memories 文件夹,清理、合并和优化项目记忆",aliases:["mem-clean","clean-memory"],usage:"/memory-clear",execute:async(Z,Y)=>{let X=Z.join(" ").trim(),J=O2+(X?`Additional context: ${X}
307
+ `,J8={name:"memory-clear",description:"整理 .claude/memories 文件夹,清理、合并和优化项目记忆",aliases:["mem-clean","clean-memory"],usage:"/memory-clear",execute:async($,Z)=>{let Y=$.join(" ").trim(),J=X8+(Y?`Additional context: ${Y}
320
308
 
321
- ---`:"开始整理记忆文件夹。");return Y.sendMessage([{type:"human",content:J}],{extraParams:Y.extraParams}),{success:!0,message:"\uD83E\uDDE0 记忆整理模式已激活 - 正在分析 .claude/memories 文件夹...",shouldClearInput:!0}}},iJ=[q2];function eZ(Z){if(Z===0)return"0 B";let Y=1024,X=["B","KB","MB","GB"],J=Math.floor(Math.log(Z)/Math.log(Y));return parseFloat((Z/Math.pow(Y,J)).toFixed(2))+" "+X[J]}function tX(){let Z=process.memoryUsage();return{heapTotal:Z.heapTotal,heapUsed:Z.heapUsed,external:Z.external,rss:Z.rss,heapUsedMB:(Z.heapUsed/1024/1024).toFixed(2),heapTotalMB:(Z.heapTotal/1024/1024).toFixed(2)}}function rJ(){return typeof Bun<"u"}function F2(){let Z=tX();if(rJ()&&typeof Bun.gc==="function"){Bun.gc(!0);let Y=tX(),X=Z.heapUsed-Y.heapUsed;return{success:!0,before:Z,after:Y,freed:X,message:`GC 执行成功,释放了 ${eZ(Math.max(0,X))} 内存`}}if(globalThis.global&&typeof globalThis.global.gc==="function"){globalThis.global.gc();let Y=tX(),X=Z.heapUsed-Y.heapUsed;return{success:!0,before:Z,after:Y,freed:X,message:`GC 执行成功,释放了 ${eZ(Math.max(0,X))} 内存`}}return{success:!1,before:Z,message:`/gc 命令仅在 Bun 或者 node --expose-gc 可用
322
- `+"当前内存使用: "+eZ(Z.heapUsed)+" / "+eZ(Z.heapTotal)}}function M2(){let Z=[];if(!rJ())Z.push("/gc 命令仅支持 Bun 运行时,请使用 bun 启动应用");else Z.push("当前运行在 Bun 环境,/gc 命令已就绪");return Z.join(`
323
- `)}var oJ={name:"gc",description:"手动触发垃圾回收,减少内存占用",aliases:["garbage-collect","mem-opt","memory"],usage:"/gc",execute:async(Z,Y)=>{let X=Z.includes("-v")||Z.includes("--verbose"),J=F2(),Q=`\uD83D\uDDD1️ ${J.message}
324
- `;if(J.before&&J.after){if(Q+=`
309
+ ---`:"开始整理记忆文件夹。");return Z.sendMessage([{type:"human",content:J}],{extraParams:Z.extraParams}),{success:!0,message:"\uD83E\uDDE0 记忆整理模式已激活 - 正在分析 .claude/memories 文件夹...",shouldClearInput:!0}}},v4=[J8];function E1($){if($===0)return"0 B";let Z=1024,Y=["B","KB","MB","GB"],J=Math.floor(Math.log($)/Math.log(Z));return parseFloat(($/Math.pow(Z,J)).toFixed(2))+" "+Y[J]}function O0(){let $=process.memoryUsage();return{heapTotal:$.heapTotal,heapUsed:$.heapUsed,external:$.external,rss:$.rss,heapUsedMB:($.heapUsed/1024/1024).toFixed(2),heapTotalMB:($.heapTotal/1024/1024).toFixed(2)}}function k4(){return typeof Bun<"u"}function K8(){let $=O0();if(k4()&&typeof Bun.gc==="function"){Bun.gc(!0);let Z=O0(),Y=$.heapUsed-Z.heapUsed;return{success:!0,before:$,after:Z,freed:Y,message:`GC 执行成功,释放了 ${E1(Math.max(0,Y))} 内存`}}if(globalThis.global&&typeof globalThis.global.gc==="function"){globalThis.global.gc();let Z=O0(),Y=$.heapUsed-Z.heapUsed;return{success:!0,before:$,after:Z,freed:Y,message:`GC 执行成功,释放了 ${E1(Math.max(0,Y))} 内存`}}return{success:!1,before:$,message:`/gc 命令仅在 Bun 或者 node --expose-gc 可用
310
+ `+"当前内存使用: "+E1($.heapUsed)+" / "+E1($.heapTotal)}}function W8(){let $=[];if(!k4())$.push("/gc 命令仅支持 Bun 运行时,请使用 bun 启动应用");else $.push("当前运行在 Bun 环境,/gc 命令已就绪");return $.join(`
311
+ `)}var T4={name:"gc",description:"手动触发垃圾回收,减少内存占用",aliases:["garbage-collect","mem-opt","memory"],usage:"/gc",execute:async($,Z)=>{let Y=$.includes("-v")||$.includes("--verbose"),J=K8(),X=`\uD83D\uDDD1️ ${J.message}
312
+ `;if(J.before&&J.after){if(X+=`
325
313
  \uD83D\uDCCA 内存统计:
326
- `,Q+=` Before: ${eZ(J.before.heapUsed)} / ${eZ(J.before.heapTotal)}
327
- `,Q+=` After: ${eZ(J.after.heapUsed)} / ${eZ(J.after.heapTotal)}
328
- `,J.freed!==void 0&&J.freed>0)Q+=` Freed: ${eZ(J.freed)}
329
- `}else if(J.before)Q+=`
330
- \uD83D\uDCCA 当前内存使用: ${eZ(J.before.heapUsed)} / ${eZ(J.before.heapTotal)}
331
- `;if(!J.success||X)Q+=`
314
+ `,X+=` Before: ${E1(J.before.heapUsed)} / ${E1(J.before.heapTotal)}
315
+ `,X+=` After: ${E1(J.after.heapUsed)} / ${E1(J.after.heapTotal)}
316
+ `,J.freed!==void 0&&J.freed>0)X+=` Freed: ${E1(J.freed)}
317
+ `}else if(J.before)X+=`
318
+ \uD83D\uDCCA 当前内存使用: ${E1(J.before.heapUsed)} / ${E1(J.before.heapTotal)}
319
+ `;if(!J.success||Y)X+=`
332
320
  \uD83D\uDCA1 提示:
333
- `,Q+=` ${M2().replace(/\n/g,`
321
+ `,X+=` ${W8().replace(/\n/g,`
334
322
  `)}
335
- `;return{success:J.success,message:Q,shouldClearInput:!0}}};[...fJ,...hJ,...xJ,...gJ,...uJ,...pJ,...iJ,dJ,cJ,lJ,oJ].forEach((Z)=>{L4.register(Z)});var P4=P(I(),1),nJ=(Z)=>{let{onCommandExecuted:Y,switchToHistory:X,switchToKnowledge:J,switchToSettings:Q,switchToAgent:$,closePanel:K,switchToTask:U,switchToModelProvider:W,switchToMcp:z,switchToProcess:H}=Z,{userInput:G,setUserInput:F,sendMessage:M,currentAgent:N,client:w,createNewChat:L,renderMessages:B}=WZ(),{extraParams:C,updateConfig:R,AVAILABLE_MODELS:D,compactMode:f}=UZ(),[V,d]=g0.useState(null),[l,u]=g0.useState(null);TZ(()=>{d(null)},V?3000:null),TZ(()=>{u(null)},l?5000:null);let n=G.startsWith("/"),i=n?L4.getSuggestions(G):[],Q4=n,$4=g0.useCallback(async(p0)=>{let F0=p0||G;if(!L4.isCommand(F0))return!1;try{let M0={userInput:F0,setUserInput:F,sendMessage(dY,W8={}){return M(dY,{extraParams:{...C,...W8.extraParams},...W8,metadata:U4})},currentAgent:N,client:w,extraParams:C,createNewChat(){return L(U4)},updateConfig:R,AVAILABLE_MODELS:D,renderMessages:B,compactMode:f,switchToHistory:X,switchToKnowledge:J,switchToSettings:Q,switchToModelProvider:W,switchToAgent:$,switchToTask:U,switchToMcp:z,switchToProcess:H,closePanel:K,startRalphLoop:Z.startRalphLoop},v4=await L4.executeCommand(F0,M0);if(!v4.success)d(v4.message||"命令执行失败");else if(v4.message)u(v4.message);if(v4.shouldClearInput)F("");if(v4.shouldSendMessage&&v4.messageContent){let dY=[{type:"human",content:v4.messageContent}];M(dY,{extraParams:C})}return Y?.(),!0}catch(M0){return d(`命令执行错误: ${M0 instanceof Error?M0.message:String(M0)}`),!0}},[G,F,M,N,w,C,L,Y,D,f,X,J,Q,W,$,U,z,H,K,Z.startRalphLoop]);return{isCommandInput:n,commandSuggestions:i,showCommandHint:Q4,commandError:V,executeCommand:$4,CommandHintUI:()=>{if(!Q4||i.length===0)return null;return P4.jsxDEV(_,{marginBottom:1,flexDirection:"column",children:[P4.jsxDEV(O,{color:"yellow",bold:!0,children:"命令建议:"},void 0,!1,void 0,this),i.slice(0,5).map((p0,F0)=>P4.jsxDEV(O,{color:"cyan",children:[p0.displayText," - ",p0.description]},F0,!0,void 0,this)),i.length>5&&P4.jsxDEV(O,{color:"gray",children:["...还有 ",i.length-5," 个命令"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},CommandErrorUI:()=>{if(!V)return null;return P4.jsxDEV(_,{marginBottom:1,children:P4.jsxDEV(O,{color:"red",children:["❌ ",V]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},CommandSuccessUI:()=>{if(!l)return null;return P4.jsxDEV(_,{marginBottom:1,children:P4.jsxDEV(O,{color:"green",children:["✅ ",l]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}}};function aJ({manager:Z,enabled:Y=!0}){return xY({queryKey:gY.skills.list(),queryFn:async()=>{if(!Z)throw Error("ConfigManager not initialized");return await Z.listSkills()},enabled:Y&&!!Z,staleTime:120000})}var N2=[{id:"agents/default",name:"Jarvis",description:"代码实现助手"},{id:"agents/manager",name:"Manager",description:"任务管理员"}];function sJ({enabled:Z=!0}={}){return xY({queryKey:gY.agents.list(),queryFn:async()=>{return N2},enabled:Z,staleTime:300000})}var Z4=P(g(),1);function tJ({loading:Z,renderMessages:Y,sendMessage:X,setUserInput:J,extraParams:Q}){let[$,K]=Z4.useState(null),[U,W]=Z4.useState(!1),z=Z4.useRef(!1),H=Z4.useRef(0),G=Z4.useCallback(async(M)=>{if(!M)return;let N=z.current?`
323
+ `;return{success:J.success,message:X,shouldClearInput:!0}}};[...F4,...q4,...b4,...R4,...B4,...P4,...v4,C4,S4,I4,T4].forEach(($)=>{J$.register($)});var K$=A(q(),1),y4=($)=>{let{onCommandExecuted:Z,switchToHistory:Y,switchToKnowledge:J,switchToSettings:X,switchToAgent:K,closePanel:W,switchToTask:O,switchToModelProvider:_,switchToMcp:G,switchToProcess:N}=$,{userInput:z,setUserInput:F,sendMessage:L,currentAgent:w,client:M,createNewChat:b,renderMessages:f}=$1(),{extraParams:k,updateConfig:g,AVAILABLE_MODELS:p,compactMode:o}=Z1(),[S,t]=YZ.useState(null),[c,D]=YZ.useState(null);M1(()=>{t(null)},S?3000:null),M1(()=>{D(null)},c?5000:null);let l=z.startsWith("/"),x=l?J$.getSuggestions(z):[],A$=l,w$=YZ.useCallback(async(JZ)=>{let x$=JZ||z;if(!J$.isCommand(x$))return!1;try{let d$={userInput:x$,setUserInput:F,sendMessage(yZ,M0={}){return L(yZ,{extraParams:{...k,...M0.extraParams},...M0,metadata:d1})},currentAgent:w,client:M,extraParams:k,createNewChat(){return b(d1)},updateConfig:g,AVAILABLE_MODELS:p,renderMessages:f,compactMode:o,switchToHistory:Y,switchToKnowledge:J,switchToSettings:X,switchToModelProvider:_,switchToAgent:K,switchToTask:O,switchToMcp:G,switchToProcess:N,closePanel:W,startRalphLoop:$.startRalphLoop},O$=await J$.executeCommand(x$,d$);if(!O$.success)t(O$.message||"命令执行失败");else if(O$.message)D(O$.message);if(O$.shouldClearInput)F("");if(O$.shouldSendMessage&&O$.messageContent){let yZ=[{type:"human",content:O$.messageContent}];L(yZ,{extraParams:k})}return Z?.(),!0}catch(d$){return t(`命令执行错误: ${d$ instanceof Error?d$.message:String(d$)}`),!0}},[z,F,L,w,M,k,b,Z,p,o,Y,J,X,_,K,O,G,N,W,$.startRalphLoop]);return{isCommandInput:l,commandSuggestions:x,showCommandHint:A$,commandError:S,executeCommand:w$,CommandHintUI:()=>{if(!A$||x.length===0)return null;return K$.jsxDEV(U,{marginBottom:1,flexDirection:"column",children:[K$.jsxDEV(Q,{color:"yellow",bold:!0,children:"命令建议:"},void 0,!1,void 0,this),x.slice(0,5).map((JZ,x$)=>K$.jsxDEV(Q,{color:"cyan",children:[JZ.displayText," - ",JZ.description]},x$,!0,void 0,this)),x.length>5&&K$.jsxDEV(Q,{color:"gray",children:["...还有 ",x.length-5," 个命令"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},CommandErrorUI:()=>{if(!S)return null;return K$.jsxDEV(U,{marginBottom:1,children:K$.jsxDEV(Q,{color:"red",children:["❌ ",S]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},CommandSuccessUI:()=>{if(!c)return null;return K$.jsxDEV(U,{marginBottom:1,children:K$.jsxDEV(Q,{color:"green",children:["✅ ",c]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}}};function h4({manager:$,enabled:Z=!0}){return SZ({queryKey:IZ.skills.list(),queryFn:async()=>{if(!$)throw Error("ConfigManager not initialized");return await $.listSkills()},enabled:Z&&!!$,staleTime:120000})}var Q8=[{id:"agents/default",name:"Jarvis",description:"代码实现助手"},{id:"agents/manager",name:"Manager",description:"任务管理员"}];function D4({enabled:$=!0}={}){return SZ({queryKey:IZ.agents.list(),queryFn:async()=>{return Q8},enabled:$,staleTime:300000})}var g1=A(h(),1);function V4({loading:$,renderMessages:Z,sendMessage:Y,setUserInput:J,extraParams:X}){let[K,W]=g1.useState(null),[O,_]=g1.useState(!1),G=g1.useRef(!1),N=g1.useRef(0),z=g1.useCallback(async(L)=>{if(!L)return;let w=G.current?`
336
324
 
337
- [System Context: You are currently in Ralph loop mode. Continue executing the task based on previous context. Respond with <COMPLETE></COMPLETE> tag when the task is complete.]`:"",w=[{type:"human",content:M+N}];await X(w,{extraParams:Q,metadata:U4})},[X,Q]);TZ(()=>{if($)G($);W(!1)},U?100:null);let F=Z4.useCallback((M)=>{K(M),z.current=!0,H.current=0,W(!0)},[]);return Z4.useEffect(()=>{if(z.current&&$&&!Z){let M=Y.length;if(M>H.current){H.current=M;let N=Y[M-1],w=J0(N);if(typeof w==="string"&&w.includes("<COMPLETE></COMPLETE>"))z.current=!1,K(null),N4("Ralph 循环完成");else G($)}}},[Z,Y,$,G]),{ralphLoopText:$,startRalphLoop:F,sendTextMessage:G}}var wZ=P(g(),1);var e4=P(g(),1);import eX from"fuzzysort";function _2(Z,Y){if(Y===0)return!0;let X=Z[Y-1];return X===" "||X===`
338
- `||X==="\t"}function A2(Z,Y){let X=Y+1;while(X<Z.length&&!/[\s\n\t]/.test(Z[X]))X++;return Z.slice(Y+1,X)}function w2(Z,Y,X){if(!Y)return Z.slice(0,X).map((K)=>({skill:K,result:null}));let J=Z.map((K)=>({skill:K,name:eX.prepare(K.name.toLowerCase()),description:eX.prepare((K.description||"").toLowerCase())}));return eX.go(Y.toLowerCase(),J,{key:"name",limit:X,threshold:-1e4}).map((K)=>({skill:K.obj.skill,result:K}))}function eJ({skills:Z,maxSuggestions:Y=5}){let[X,J]=e4.useState({visible:!1,query:"",filteredSkills:[],triggerPosition:-1}),Q=e4.useCallback((z,H)=>{let G=z.lastIndexOf("#");if(G===-1){J((N)=>({...N,visible:!1,query:"",filteredSkills:[],triggerPosition:-1}));return}if(!_2(z,G)){J((N)=>({...N,visible:!1,query:"",filteredSkills:[],triggerPosition:-1}));return}let F=A2(z,G),M=w2(Z,F,Y);if(M.length===1&&M[0].skill.name.toLowerCase()===F.toLowerCase()){J((N)=>({...N,visible:!1,query:"",filteredSkills:[],triggerPosition:-1}));return}J((N)=>({...N,visible:!0,query:F,filteredSkills:M,triggerPosition:G}))},[Z.length,Y]),$=e4.useCallback(()=>{if(!X.visible||X.filteredSkills.length===0)return null;return X.filteredSkills[0]?.skill??null},[X.visible,X.filteredSkills]),K=e4.useCallback((z)=>{let H=$();if(!H)return z;let G=z.slice(0,X.triggerPosition),F=z.slice(X.triggerPosition+1+X.query.length);return`${G}#${H.name} ${F}`},[$,X.triggerPosition,X.query]),U=e4.useCallback(()=>{J((z)=>({...z,visible:!1,query:"",filteredSkills:[],triggerPosition:-1}))},[]),W=X.visible&&X.filteredSkills.length>0;return{state:X,checkTrigger:Q,getFirstSkill:$,complete:K,hide:U,isActive:W}}var Z0=P(g(),1);function B2(Z,Y){if(Y===0)return!0;let X=Z[Y-1];return X===" "||X===`
339
- `||X==="\t"}function L2(Z,Y){let X=Y+1;while(X<Z.length&&!/[\s\n\t]/.test(Z[X]))X++;return Z.slice(Y+1,X)}function P2(Z,Y,X){let J=Y.toLowerCase(),Q=Z.filter(($)=>{let K=$.name.toLowerCase(),U=$.id.toLowerCase();return K.startsWith(J)||U.includes(J)});return Q.sort(($,K)=>$.name.localeCompare(K.name)),Q.slice(0,X)}function Z1({agents:Z,maxSuggestions:Y=5}){let[X,J]=Z0.useState({visible:!1,query:"",filteredAgents:[],triggerPosition:-1}),Q=Z0.useCallback((z,H)=>{let G=z.lastIndexOf("@");if(G===-1){J((N)=>({...N,visible:!1,query:"",filteredAgents:[],triggerPosition:-1}));return}if(!B2(z,G)){J((N)=>({...N,visible:!1,query:"",filteredAgents:[],triggerPosition:-1}));return}let F=L2(z,G),M=P2(Z,F,Y);if(M.length===1&&M[0].name.toLowerCase()===F.toLowerCase()){J((N)=>({...N,visible:!1,query:"",filteredAgents:[],triggerPosition:-1}));return}J((N)=>({...N,visible:!0,query:F,filteredAgents:M,triggerPosition:G}))},[Z.length,Y]),$=Z0.useCallback(()=>{if(!X.visible||X.filteredAgents.length===0)return null;return X.filteredAgents[0]??null},[X.visible,X.filteredAgents]),K=Z0.useCallback((z)=>{let H=$();if(!H)return z;let G=z.slice(0,X.triggerPosition),F=z.slice(X.triggerPosition+1+X.query.length);return`${G}@${H.name} ${F}`},[$,X.triggerPosition,X.query]),U=Z0.useCallback(()=>{J((z)=>({...z,visible:!1,query:"",filteredAgents:[],triggerPosition:-1}))},[]),W=X.visible&&X.filteredAgents.length>0;return{state:X,checkTrigger:Q,getFirstAgent:$,complete:K,hide:U,isActive:W}}var Y1=P(g(),1);var yZ=P(I(),1);function R2({name:Z,result:Y}){if(!Y)return yZ.jsxDEV(O,{color:"cyan",children:Z},void 0,!1,void 0,this);let X=Y.highlight((J)=>yZ.jsxDEV(O,{color:"green",bold:!0,children:J},void 0,!1,void 0,this));if(Array.isArray(X))return yZ.jsxDEV(O,{color:"cyan",children:X.map((J,Q)=>{if(typeof J==="string")return yZ.jsxDEV(O,{children:J},`p-${Q}`,!1,void 0,this);return yZ.jsxDEV(Y1.default.Fragment,{children:J},`m-${Q}`,!1,void 0,this)})},void 0,!1,void 0,this);return yZ.jsxDEV(O,{color:"cyan",children:Z},void 0,!1,void 0,this)}var X1=({visible:Z,skills:Y,query:X,maxVisible:J=5})=>{if(!Z||Y.length===0)return null;let Q=Y.slice(0,J);return yZ.jsxDEV(_,{marginBottom:1,flexDirection:"column",children:[yZ.jsxDEV(O,{color:"yellow",bold:!0,children:"技能建议 (按 → 补全):"},void 0,!1,void 0,this),Q.map(({skill:$,result:K})=>yZ.jsxDEV(_,{children:[yZ.jsxDEV(O,{children:" #"},void 0,!1,void 0,this),yZ.jsxDEV(R2,{name:$.name,result:K},void 0,!1,void 0,this)]},$.name,!0,void 0,this)),Y.length>J&&yZ.jsxDEV(O,{color:"gray",children:["...还有 ",Y.length-J," 个技能"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)};var vZ=P(I(),1);function C2({name:Z,query:Y}){if(!Y)return vZ.jsxDEV(O,{color:"magenta",children:Z},void 0,!1,void 0,this);let X=Z.toLowerCase(),J=Y.toLowerCase();if(X.startsWith(J))return vZ.jsxDEV(vZ.Fragment,{children:[vZ.jsxDEV(O,{color:"green",bold:!0,children:Z.slice(0,Y.length)},void 0,!1,void 0,this),vZ.jsxDEV(O,{color:"magenta",children:Z.slice(Y.length)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return vZ.jsxDEV(O,{color:"magenta",children:Z},void 0,!1,void 0,this)}var J1=({visible:Z,agents:Y,query:X,maxVisible:J=5})=>{if(!Z||Y.length===0)return null;let Q=Y.slice(0,J);return vZ.jsxDEV(_,{marginBottom:1,flexDirection:"column",children:[vZ.jsxDEV(O,{color:"yellow",bold:!0,children:"Agent 建议 (按 → 补全):"},void 0,!1,void 0,this),Q.map(($)=>vZ.jsxDEV(_,{children:[vZ.jsxDEV(O,{children:" @"},void 0,!1,void 0,this),vZ.jsxDEV(C2,{name:$.name,query:X},void 0,!1,void 0,this),vZ.jsxDEV(O,{dimColor:!0,children:[" - ",$.description]},void 0,!0,void 0,this)]},$.id,!0,void 0,this)),Y.length>J&&vZ.jsxDEV(O,{color:"gray",children:["...还有 ",Y.length-J," 个 Agent"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)};var $1=P(g(),1);function K1(){let{extraParams:Z}=UZ(),{sendMessage:Y,loading:X}=WZ(),{bufferedMessage:J,clearBuffer:Q}=uY(),$=Q1();$1.useEffect(()=>{if(!X&&J.trim()){let K=[{type:"human",content:J}];Q(),Y(K,{extraParams:Z}).then(()=>{N4("Zen Code 完成任务")}).catch((U)=>{console.error("Failed to send buffered message:",U)})}},[X,J,Y,Z,Q,$])}var R4=P(I(),1),W1=({value:Z,onChange:Y,onSubmit:X,loading:J,placeholder:Q="输入消息...",commandHandler:$,skills:K=[],agents:U=[]})=>{K1();let{bufferedMessage:W,setBufferedMessage:z,clearBuffer:H}=uY(),[G,F]=wZ.useState(Z),M=wZ.useRef(!1),N=eJ({skills:K,maxSuggestions:5}),w=Z1({agents:U,maxSuggestions:5});wZ.useEffect(()=>{if(Z!==G)M.current=!0,F(Z)},[Z]);let L=wZ.useMemo(()=>G.startsWith("/"),[G]);wZ.useEffect(()=>{if(!L)N.checkTrigger(G),w.checkTrigger(G)},[G,L]);let B=wZ.useCallback((l)=>{if(M.current){M.current=!1;return}F(l),Y(l)},[Y]),C=wZ.useCallback((l)=>{if(!l.trim())return;if(N.hide(),w.hide(),L){X(l),F("");return}if(J)z(l),F("");else X(l),F("")},[L,J,X,z,N,w]),R=wZ.useCallback(()=>{if(w.isActive){w.hide();return}if(N.isActive){N.hide();return}if(W)H();else F("")},[W,H,N.isActive,w.isActive]),D=wZ.useCallback(()=>{if(!L||!$.commandSuggestions||$.commandSuggestions.length===0)return!1;let u=$.commandSuggestions[0],i=(u.displayText||u.command||"")+" ";return B(i),!0},[L,$.commandSuggestions,B]),f=wZ.useCallback(()=>{if(!N.isActive)return!1;let l=N.complete(G);return B(l),N.hide(),!0},[N.isActive,G,B]),V=wZ.useCallback(()=>{if(!w.isActive)return!1;let l=w.complete(G);return B(l),w.hide(),!0},[w.isActive,G,B]),d=wZ.useMemo(()=>{if(J)return W?"按 Esc 清空缓冲区":"AI 响应中,Enter 将消息加入缓冲区";if(L)return"输入命令... (试试 /help,按 → 补全第一个建议)";if(w.isActive)return"按 → 补全 Agent";if(N.isActive)return"按 → 补全技能";return Q},[J,W,L,w.isActive,N.isActive,Q]);return R4.jsxDEV(_,{flexDirection:"column",children:[W&&R4.jsxDEV(_,{padding:1,children:R4.jsxDEV(O,{color:"yellow",children:["\uD83D\uDCDD 缓冲区: ",W.slice(0,50),W.length>50?"...":""]},void 0,!0,void 0,this)},void 0,!1,void 0,this),R4.jsxDEV($.CommandHintUI,{},void 0,!1,void 0,this),R4.jsxDEV(J1,{visible:w.state.visible,agents:w.state.filteredAgents,query:w.state.query},void 0,!1,void 0,this),R4.jsxDEV(X1,{visible:N.state.visible,skills:N.state.filteredSkills,query:N.state.query},void 0,!1,void 0,this),R4.jsxDEV(_,{paddingY:1,children:R4.jsxDEV(iZ,{id:"global-input",value:G,onChange:B,onSubmit:C,onHotKey:(l,u)=>{if(u.escape)return R(),!1;if(u.rightArrow){if(w.isActive){if(V())return!1}if(N.isActive){if(f())return!1}if(D())return!1}return!0},placeholder:d},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)};var u0=P(I(),1),Z8=mY.memo(()=>{let{userInput:Z,setUserInput:Y,loading:X,renderMessages:J,sendMessage:Q}=WZ(),{extraParams:$,manager:K}=UZ(),{switchToHistory:U,switchToKnowledge:W,switchToSettings:z,switchToModelProvider:H,switchToAgent:G,switchToTask:F,switchToMcp:M,switchToProcess:N,closePanel:w}=X0(),{data:L=[]}=aJ({manager:K}),{data:B=[]}=sJ(),{startRalphLoop:C}=tJ({loading:X,renderMessages:J,sendMessage:Q,setUserInput:Y,extraParams:$}),R=nJ({extraParams:$,switchToHistory:U,switchToKnowledge:W,switchToSettings:z,switchToModelProvider:H,switchToAgent:G,switchToTask:F,switchToMcp:M,switchToProcess:N,closePanel:w,startRalphLoop:C}),D=mY.useCallback(async(f)=>{if(!f)return;if(f.startsWith("/")){if(await R.executeCommand(f)){Y("");return}}await Q([{type:"human",content:f}],{extraParams:$,metadata:U4}),N4("Zen Code 完成任务")},[R,Y]);return u0.jsxDEV(_,{flexDirection:"column",paddingX:0,paddingY:0,borderColor:"grey",borderTop:!0,borderStyle:"single",borderLeft:!1,borderBottom:!1,borderRight:!1,children:[u0.jsxDEV(R.CommandErrorUI,{},void 0,!1,void 0,this),u0.jsxDEV(R.CommandSuccessUI,{},void 0,!1,void 0,this),u0.jsxDEV(W1,{value:Z,onChange:Y,onSubmit:D,loading:X,commandHandler:{isCommandInput:R.isCommandInput,CommandHintUI:R.CommandHintUI,commandSuggestions:R.commandSuggestions},skills:L,agents:B},void 0,!1,void 0,this)]},void 0,!0,void 0,this)});Z8.displayName="ChatInput";var kZ=P(I(),1),I2=()=>{let{renderMessages:Z,currentChatId:Y,getToolUIRender:X,loading:J}=WZ(),{compactMode:Q}=UZ(),[$]=U1(Z,50),K=H1.useCallback((U)=>X(U),[X]);return kZ.jsxDEV(_,{flexDirection:"column",flexGrow:1,paddingX:0,paddingY:0,children:[$.length===0&&kZ.jsxDEV(EJ,{},void 0,!1,void 0,this),$.length?Q?kZ.jsxDEV(sX,{renderMessages:$,startIndex:0,staticKey:Y,getToolUIRender:K,loading:J},Y,!1,void 0,this):kZ.jsxDEV(CJ,{loading:J,renderMessages:$,startIndex:0,staticKey:Y},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},Y8=()=>{let{hasPendingInteractions:Z}=xZ();return kZ.jsxDEV(_,{flexDirection:"column",flexGrow:1,children:[kZ.jsxDEV(r,{name:"ChatMessages",fallback:null,children:kZ.jsxDEV(I2,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),kZ.jsxDEV(z1,{children:kZ.jsxDEV(r,{name:"InteractionArea",fallback:null,children:Z?kZ.jsxDEV(_,{paddingX:0,paddingY:0,children:kZ.jsxDEV(WX,{},void 0,!1,void 0,this)},void 0,!1,void 0,this):kZ.jsxDEV(Z8,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)};Y8.displayName="ChatMain";var Y4=P(g(),1);var C4=P(g(),1),G1=C4.lazy(()=>import("./chunk-a4vdvjsr.js").then((Z)=>({default:Z.default}))),O1=C4.lazy(()=>import("./chunk-tqh0rjpp.js").then((Z)=>({default:Z.default}))),q1=C4.lazy(()=>import("./chunk-wb6xn1kx.js").then((Z)=>({default:Z.default}))),F1=C4.lazy(()=>import("./chunk-n0sxg10w.js").then((Z)=>({default:Z.default}))),M1=C4.lazy(()=>import("./chunk-edkft0pe.js").then((Z)=>({default:Z.default}))),N1=C4.lazy(()=>import("./chunk-7d4h6qkf.js").then((Z)=>({default:Z.default}))),_1=C4.lazy(()=>import("./chunk-eemwtwb1.js").then((Z)=>({default:Z.default}))),A1=C4.lazy(()=>import("./chunk-6mcx89fj.js").then((Z)=>({default:Z.default})));var h=P(I(),1),S4=()=>h.jsxDEV(_,{paddingX:1,paddingY:1,children:h.jsxDEV(O,{color:"grey",children:"Loading..."},void 0,!1,void 0,this)},void 0,!1,void 0,this),y4=(Z)=>h.jsxDEV(_,{paddingX:1,paddingY:1,children:[h.jsxDEV(O,{color:"red",children:["✗ ",Z," panel error"]},void 0,!0,void 0,this),h.jsxDEV(_,{marginTop:1,children:h.jsxDEV(O,{color:"gray",children:"Try reopening or press ESC to return"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),X8=Y4.memo(()=>{let{activeView:Z,closePanel:Y,handleExecuteTask:X}=X0();return h.jsxDEV(_,{flexGrow:1,flexDirection:"row",children:[Z==="history"&&h.jsxDEV(Y4.Suspense,{fallback:h.jsxDEV(S4,{},void 0,!1,void 0,this),children:h.jsxDEV(r,{name:"HistoryPanel",fallback:y4("History"),children:h.jsxDEV(G1,{onClose:Y},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Z==="knowledge"&&h.jsxDEV(Y4.Suspense,{fallback:h.jsxDEV(S4,{},void 0,!1,void 0,this),children:h.jsxDEV(r,{name:"KnowledgePanel",fallback:y4("Knowledge"),children:h.jsxDEV(O1,{onClose:Y},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Z==="settings"&&h.jsxDEV(Y4.Suspense,{fallback:h.jsxDEV(S4,{},void 0,!1,void 0,this),children:h.jsxDEV(r,{name:"SettingsPanel",fallback:y4("Settings"),children:h.jsxDEV(q1,{onClose:Y},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Z==="model-provider"&&h.jsxDEV(Y4.Suspense,{fallback:h.jsxDEV(S4,{},void 0,!1,void 0,this),children:h.jsxDEV(r,{name:"ModelProviderPanel",fallback:y4("Model Provider"),children:h.jsxDEV(F1,{onClose:Y},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Z==="agent"&&h.jsxDEV(Y4.Suspense,{fallback:h.jsxDEV(S4,{},void 0,!1,void 0,this),children:h.jsxDEV(r,{name:"AgentPanel",fallback:y4("Agent"),children:h.jsxDEV(M1,{onClose:Y},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Z==="task"&&h.jsxDEV(Y4.Suspense,{fallback:h.jsxDEV(S4,{},void 0,!1,void 0,this),children:h.jsxDEV(r,{name:"TaskPanel",fallback:y4("Task"),children:h.jsxDEV(N1,{onClose:Y,onExecuteTask:X},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Z==="mcp"&&h.jsxDEV(Y4.Suspense,{fallback:h.jsxDEV(S4,{},void 0,!1,void 0,this),children:h.jsxDEV(r,{name:"McpPanel",fallback:y4("MCP"),children:h.jsxDEV(_1,{onClose:Y},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Z==="process"&&h.jsxDEV(Y4.Suspense,{fallback:h.jsxDEV(S4,{},void 0,!1,void 0,this),children:h.jsxDEV(r,{name:"ProcessPanel",fallback:y4("Process"),children:h.jsxDEV(A1,{onClose:Y},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)});X8.displayName="LazyChatViewManager";var k4=P(g(),1);var w1=P(g(),1);var pY=P(I(),1),B1=()=>{let{renderMessages:Z}=WZ(),Y=w1.default.useMemo(()=>{if(!Z)return null;for(let X=Z.length-1;X>=0;X--){let J=Z[X];if(J.role==="assistant"&&J.content)try{let $=(Array.isArray(J.content)?J.content:[{type:"text",text:J.content}]).find((K)=>K.type==="text")?.text||"";if($.includes("load_mcp_tools"))try{let K=JSON.parse($);if(K.status&&K.status.toolCount!==void 0)return K.status}catch(K){}}catch(Q){}}return null},[Z]);if(!Y||Y.toolCount===0)return null;return pY.jsxDEV(_,{paddingX:1,children:[pY.jsxDEV(O,{color:"green",bold:!0,children:"MCP"},void 0,!1,void 0,this),pY.jsxDEV(O,{color:"cyan",children:[" ",Y.toolCount]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)};var X4=P(g(),1);function Q8(Z){if(Z===0)return"0";if(Z<1024)return`${Z}`;if(Z<1048576)return`${(Z/1024).toFixed(0)}K`;if(Z<1073741824)return`${(Z/1048576).toFixed(0)}M`;return`${(Z/1073741824).toFixed(1)}G`}function L1(Z){let Y=Math.floor(Z/1000),X=Math.floor(Y/3600),J=Math.floor(Y%3600/60),Q=Y%60;if(X>0)return`${X}:${String(J).padStart(2,"0")}:${String(Q).padStart(2,"0")}`;return`${String(J).padStart(2,"0")}:${String(Q).padStart(2,"0")}`}function P1(Z){let[Y,X]=X4.useState(0),J=X4.useRef(null);return X4.useEffect(()=>{if(Z)J.current=Date.now(),X(0);else J.current=null,X(0)},[Z]),J8(()=>{if(J.current)X(Date.now()-J.current)},Z?1000:null),Y}function R1(){let[Z,Y]=X4.useState({cpuPercent:0,memoryRSS:0,memoryHeapUsed:0,memoryHeapTotal:0}),X=X4.useRef(process.cpuUsage()),J=X4.useRef(Date.now()),Q=()=>{let $=Date.now(),K=process.cpuUsage(),U=process.memoryUsage(),W=$-J.current,z=K.user-X.current.user,H=K.system-X.current.system,F=(z+H)/1000/W*100;Y({cpuPercent:Math.min(100,Math.max(0,F)),memoryRSS:U.rss,memoryHeapUsed:U.heapUsed,memoryHeapTotal:U.heapTotal}),X.current=K,J.current=$};return X4.useEffect(()=>{Q()},[]),J8(Q,2000),Z}function C1(Z){if(Z<50)return"green";if(Z<80)return"yellow";return"red"}function I1(Z,Y){if(Y===0)return"gray";let X=Z/Y*100;if(X<50)return"green";if(X<80)return"yellow";return"red"}var I4=P(I(),1),v2=()=>{let Z=R1(),Y=C1(Z.cpuPercent),X=I1(Z.memoryHeapUsed,Z.memoryHeapTotal);return I4.jsxDEV(_,{paddingX:1,width:"100%",children:I4.jsxDEV(_,{gap:2,children:[I4.jsxDEV(_,{children:[I4.jsxDEV(O,{dimColor:!0,children:"CPU:"},void 0,!1,void 0,this),I4.jsxDEV(O,{color:Y,children:[" ",Z.cpuPercent.toFixed(0),"%"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),I4.jsxDEV(_,{children:[I4.jsxDEV(O,{dimColor:!0,children:"MEM:"},void 0,!1,void 0,this),I4.jsxDEV(O,{color:X,children:[Q8(Z.memoryHeapUsed),"/",Q8(Z.memoryRSS)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},v1=v2;var qZ=P(I(),1);import D2 from"path";var V2=()=>{let{extraParams:Z,compactMode:Y,showDetailedInfo:X}=UZ(),{currentChatId:J,renderMessages:Q}=WZ(),{loading:$,stopGeneration:K}=WZ(),U=process.env.YOLO_MODE==="true",[W,z]=k4.useState(0);k4.useEffect(()=>{let w=async()=>{let B=await V1.getProcessList();z(B.length)};w();let L=setInterval(w,2000);return()=>clearInterval(L)},[]);let H=k4.useCallback((w,L)=>{if(L.ctrl&&w==="c")process.exit()},[$,K]);uZ(H);let G=P1($),F=k4.default.useMemo(()=>{return D2.basename(process.cwd())},[]),N=(Q?.length||0)>100;return qZ.jsxDEV(_,{flexDirection:"column",width:"100%",children:[qZ.jsxDEV(_,{paddingX:1,paddingY:0,justifyContent:"space-between",width:"100%",marginBottom:1,children:[qZ.jsxDEV(_,{gap:1,children:[$&&qZ.jsxDEV(O,{color:"yellow",bold:!0,children:qZ.jsxDEV(D1,{text:"LOADING"},void 0,!1,void 0,this)},void 0,!1,void 0,this),!$&&qZ.jsxDEV(O,{color:"magenta",bold:!0,children:"Zen Code"},void 0,!1,void 0,this),qZ.jsxDEV(O,{color:"cyan",bold:!0,children:[" ",Z.model_id]},void 0,!0,void 0,this),qZ.jsxDEV(O,{color:"yellow",bold:!0,children:[" ","@",Z.switch_command||"default"]},void 0,!0,void 0,this),!Y&&qZ.jsxDEV(O,{color:"blue",bold:!0,children:[" ","[FULL]"]},void 0,!0,void 0,this),U&&qZ.jsxDEV(O,{color:"red",bold:!0,children:[" ","YOLO"]},void 0,!0,void 0,this),qZ.jsxDEV(B1,{},void 0,!1,void 0,this),W>0&&qZ.jsxDEV(O,{color:"magenta",bold:!0,children:[" ","● BG (",W,")"]},void 0,!0,void 0,this),N&&qZ.jsxDEV(O,{color:"red",bold:!0,children:[" ","/summary"]},void 0,!0,void 0,this),qZ.jsxDEV(O,{color:"green",bold:!0,children:Q.length},void 0,!1,void 0,this),qZ.jsxDEV(O,{color:"blue",children:F},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$&&qZ.jsxDEV(_,{children:qZ.jsxDEV(O,{color:"yellow",children:L1(G)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),X&&qZ.jsxDEV(v1,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},E1=V2;var a=P(I(),1),E2=()=>{let{activeView:Z}=X0();return a.jsxDEV(_,{flexDirection:"column",width:"100%",children:[a.jsxDEV(_,{flexGrow:1,flexDirection:"row",children:[a.jsxDEV(r,{name:"ChatMain",fallback:a.jsxDEV(O,{color:"yellow",children:"Chat view unavailable"},void 0,!1,void 0,this),children:Z==="chat"?a.jsxDEV(Y8,{},void 0,!1,void 0,this):null},void 0,!1,void 0,this),a.jsxDEV(r,{name:"PanelView",fallback:a.jsxDEV(O,{color:"yellow",children:"Panel unavailable"},void 0,!1,void 0,this),children:Z!=="chat"?a.jsxDEV(X8,{},void 0,!1,void 0,this):null},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a.jsxDEV(r,{name:"StatusBar",fallback:null,children:a.jsxDEV(E1,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},b2=()=>{return a.jsxDEV(r,{name:"Chat",children:a.jsxDEV(B5,{children:a.jsxDEV(E2,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},T2=()=>{return a.jsxDEV(r,{name:"AppRoot",children:a.jsxDEV(b1,{apiUrl:"http://127.0.0.1:8123",defaultAgent:"code",defaultHeaders:{},withCredentials:!1,showHistory:!1,showGraph:!1,onInitError:(Z,Y)=>{console.error(Z,Y)},fetch:C8,autoRestoreLastSession:!0,historyFilter:{metadata:{path:process.cwd()}},children:a.jsxDEV(r,{name:"TanStackQueryProvider",children:a.jsxDEV(H8,{children:a.jsxDEV(r,{name:"SettingsProvider",children:a.jsxDEV(f1,{get_allowed_models:I8,children:a.jsxDEV(r,{name:"ApprovalProvider",children:a.jsxDEV(T1,{children:a.jsxDEV(r,{name:"InteractionProvider",children:a.jsxDEV(l0,{children:a.jsxDEV(b2,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},f2=()=>a.jsxDEV(T2,{},void 0,!1,void 0,this),$8=f2;var J4=P(I(),1),j2=({error:Z})=>J4.jsxDEV(_,{flexDirection:"column",padding:2,borderStyle:"double",borderColor:"red",children:[J4.jsxDEV(O,{color:"red",bold:!0,children:"✗ Application Crashed"},void 0,!1,void 0,this),J4.jsxDEV(_,{marginTop:1,children:J4.jsxDEV(O,{color:"red",children:Z.message},void 0,!1,void 0,this)},void 0,!1,void 0,this),J4.jsxDEV(_,{marginTop:1,children:J4.jsxDEV(O,{color:"gray",children:["Stack: ",Z.stack?.split(`
325
+ [System Context: You are currently in Ralph loop mode. Continue executing the task based on previous context. Respond with <COMPLETE></COMPLETE> tag when the task is complete.]`:"",M=[{type:"human",content:L+w}];await Y(M,{extraParams:X,metadata:d1})},[Y,X]);M1(()=>{if(K)z(K);_(!1)},O?100:null);let F=g1.useCallback((L)=>{W(L),G.current=!0,N.current=0,_(!0)},[]);return g1.useEffect(()=>{if(G.current&&K&&!$){let L=Z.length;if(L>N.current){N.current=L;let w=Z[L-1],M=D$(w);if(typeof M==="string"&&M.includes("<COMPLETE></COMPLETE>"))G.current=!1,W(null),t1("Ralph 循环完成");else z(K)}}},[$,Z,K,z]),{ralphLoopText:K,startRalphLoop:F,sendTextMessage:z}}var _1=A(h(),1);var k$=A(h(),1);import G0 from"fuzzysort";function _8($,Z){if(Z===0)return!0;let Y=$[Z-1];return Y===" "||Y===`
326
+ `||Y==="\t"}function O8($,Z){let Y=Z+1;while(Y<$.length&&!/[\s\n\t]/.test($[Y]))Y++;return $.slice(Z+1,Y)}function G8($,Z,Y){if(!Z)return $.slice(0,Y).map((W)=>({skill:W,result:null}));let J=$.map((W)=>({skill:W,name:G0.prepare(W.name.toLowerCase()),description:G0.prepare((W.description||"").toLowerCase())}));return G0.go(Z.toLowerCase(),J,{key:"name",limit:Y,threshold:-1e4}).map((W)=>({skill:W.obj.skill,result:W}))}function j4({skills:$,maxSuggestions:Z=5}){let[Y,J]=k$.useState({visible:!1,query:"",filteredSkills:[],triggerPosition:-1}),X=k$.useCallback((G,N)=>{let z=G.lastIndexOf("#");if(z===-1){J((w)=>({...w,visible:!1,query:"",filteredSkills:[],triggerPosition:-1}));return}if(!_8(G,z)){J((w)=>({...w,visible:!1,query:"",filteredSkills:[],triggerPosition:-1}));return}let F=O8(G,z),L=G8($,F,Z);if(L.length===1&&L[0].skill.name.toLowerCase()===F.toLowerCase()){J((w)=>({...w,visible:!1,query:"",filteredSkills:[],triggerPosition:-1}));return}J((w)=>({...w,visible:!0,query:F,filteredSkills:L,triggerPosition:z}))},[$.length,Z]),K=k$.useCallback(()=>{if(!Y.visible||Y.filteredSkills.length===0)return null;return Y.filteredSkills[0]?.skill??null},[Y.visible,Y.filteredSkills]),W=k$.useCallback((G)=>{let N=K();if(!N)return G;let z=G.slice(0,Y.triggerPosition),F=G.slice(Y.triggerPosition+1+Y.query.length);return`${z}#${N.name} ${F}`},[K,Y.triggerPosition,Y.query]),O=k$.useCallback(()=>{J((G)=>({...G,visible:!1,query:"",filteredSkills:[],triggerPosition:-1}))},[]),_=Y.visible&&Y.filteredSkills.length>0;return{state:Y,checkTrigger:X,getFirstSkill:K,complete:W,hide:O,isActive:_}}var T$=A(h(),1);function U8($,Z){if(Z===0)return!0;let Y=$[Z-1];return Y===" "||Y===`
327
+ `||Y==="\t"}function z8($,Z){let Y=Z+1;while(Y<$.length&&!/[\s\n\t]/.test($[Y]))Y++;return $.slice(Z+1,Y)}function N8($,Z,Y){let J=Z.toLowerCase(),X=$.filter((K)=>{let W=K.name.toLowerCase(),O=K.id.toLowerCase();return W.startsWith(J)||O.includes(J)});return X.sort((K,W)=>K.name.localeCompare(W.name)),X.slice(0,Y)}function E4({agents:$,maxSuggestions:Z=5}){let[Y,J]=T$.useState({visible:!1,query:"",filteredAgents:[],triggerPosition:-1}),X=T$.useCallback((G,N)=>{let z=G.lastIndexOf("@");if(z===-1){J((w)=>({...w,visible:!1,query:"",filteredAgents:[],triggerPosition:-1}));return}if(!U8(G,z)){J((w)=>({...w,visible:!1,query:"",filteredAgents:[],triggerPosition:-1}));return}let F=z8(G,z),L=N8($,F,Z);if(L.length===1&&L[0].name.toLowerCase()===F.toLowerCase()){J((w)=>({...w,visible:!1,query:"",filteredAgents:[],triggerPosition:-1}));return}J((w)=>({...w,visible:!0,query:F,filteredAgents:L,triggerPosition:z}))},[$.length,Z]),K=T$.useCallback(()=>{if(!Y.visible||Y.filteredAgents.length===0)return null;return Y.filteredAgents[0]??null},[Y.visible,Y.filteredAgents]),W=T$.useCallback((G)=>{let N=K();if(!N)return G;let z=G.slice(0,Y.triggerPosition),F=G.slice(Y.triggerPosition+1+Y.query.length);return`${z}@${N.name} ${F}`},[K,Y.triggerPosition,Y.query]),O=T$.useCallback(()=>{J((G)=>({...G,visible:!1,query:"",filteredAgents:[],triggerPosition:-1}))},[]),_=Y.visible&&Y.filteredAgents.length>0;return{state:Y,checkTrigger:X,getFirstAgent:K,complete:W,hide:O,isActive:_}}var g4=A(h(),1);var B1=A(q(),1);function H8({name:$,result:Z}){if(!Z)return B1.jsxDEV(Q,{color:"cyan",children:$},void 0,!1,void 0,this);let Y=Z.highlight((J)=>B1.jsxDEV(Q,{color:"green",bold:!0,children:J},void 0,!1,void 0,this));if(Array.isArray(Y))return B1.jsxDEV(Q,{color:"cyan",children:Y.map((J,X)=>{if(typeof J==="string")return B1.jsxDEV(Q,{children:J},`p-${X}`,!1,void 0,this);return B1.jsxDEV(g4.default.Fragment,{children:J},`m-${X}`,!1,void 0,this)})},void 0,!1,void 0,this);return B1.jsxDEV(Q,{color:"cyan",children:$},void 0,!1,void 0,this)}var p4=({visible:$,skills:Z,query:Y,maxVisible:J=5})=>{if(!$||Z.length===0)return null;let X=Z.slice(0,J);return B1.jsxDEV(U,{marginBottom:1,flexDirection:"column",children:[B1.jsxDEV(Q,{color:"yellow",bold:!0,children:"技能建议 (按 → 补全):"},void 0,!1,void 0,this),X.map(({skill:K,result:W})=>B1.jsxDEV(U,{children:[B1.jsxDEV(Q,{children:" #"},void 0,!1,void 0,this),B1.jsxDEV(H8,{name:K.name,result:W},void 0,!1,void 0,this)]},K.name,!0,void 0,this)),Z.length>J&&B1.jsxDEV(Q,{color:"gray",children:["...还有 ",Z.length-J," 个技能"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)};var H1=A(q(),1);function F8({name:$,query:Z}){if(!Z)return H1.jsxDEV(Q,{color:"magenta",children:$},void 0,!1,void 0,this);let Y=$.toLowerCase(),J=Z.toLowerCase();if(Y.startsWith(J))return H1.jsxDEV(H1.Fragment,{children:[H1.jsxDEV(Q,{color:"green",bold:!0,children:$.slice(0,Z.length)},void 0,!1,void 0,this),H1.jsxDEV(Q,{color:"magenta",children:$.slice(Z.length)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return H1.jsxDEV(Q,{color:"magenta",children:$},void 0,!1,void 0,this)}var m4=({visible:$,agents:Z,query:Y,maxVisible:J=5})=>{if(!$||Z.length===0)return null;let X=Z.slice(0,J);return H1.jsxDEV(U,{marginBottom:1,flexDirection:"column",children:[H1.jsxDEV(Q,{color:"yellow",bold:!0,children:"Agent 建议 (按 → 补全):"},void 0,!1,void 0,this),X.map((K)=>H1.jsxDEV(U,{children:[H1.jsxDEV(Q,{children:" @"},void 0,!1,void 0,this),H1.jsxDEV(F8,{name:K.name,query:Y},void 0,!1,void 0,this),H1.jsxDEV(Q,{dimColor:!0,children:[" - ",K.description]},void 0,!0,void 0,this)]},K.id,!0,void 0,this)),Z.length>J&&H1.jsxDEV(Q,{color:"gray",children:["...还有 ",Z.length-J," 个 Agent"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)};var u4=A(h(),1);function x4(){let{extraParams:$}=Z1(),{sendMessage:Z,loading:Y}=$1(),{bufferedMessage:J,clearBuffer:X}=vZ(),K=c4();u4.useEffect(()=>{if(!Y&&J.trim()){let W=[{type:"human",content:J}];X(),Z(W,{extraParams:$}).then(()=>{t1("Zen Code 完成任务")}).catch((O)=>{console.error("Failed to send buffered message:",O)})}},[Y,J,Z,$,X,K])}var W$=A(q(),1),d4=({value:$,onChange:Z,onSubmit:Y,loading:J,placeholder:X="输入消息...",commandHandler:K,skills:W=[],agents:O=[]})=>{x4();let{bufferedMessage:_,setBufferedMessage:G,clearBuffer:N}=vZ(),[z,F]=_1.useState($),L=_1.useRef(!1),w=j4({skills:W,maxSuggestions:5}),M=E4({agents:O,maxSuggestions:5});_1.useEffect(()=>{if($!==z)L.current=!0,F($)},[$]);let b=_1.useMemo(()=>z.startsWith("/"),[z]);_1.useEffect(()=>{if(!b)w.checkTrigger(z),M.checkTrigger(z)},[z,b]);let f=_1.useCallback((c)=>{if(L.current){L.current=!1;return}F(c),Z(c)},[Z]),k=_1.useCallback((c)=>{if(!c.trim())return;if(w.hide(),M.hide(),b){Y(c),F("");return}if(J)G(c),F("");else Y(c),F("")},[b,J,Y,G,w,M]),g=_1.useCallback(()=>{if(M.isActive){M.hide();return}if(w.isActive){w.hide();return}if(_)N();else F("")},[_,N,w.isActive,M.isActive]),p=_1.useCallback(()=>{if(!b||!K.commandSuggestions||K.commandSuggestions.length===0)return!1;let D=K.commandSuggestions[0],x=(D.displayText||D.command||"")+" ";return f(x),!0},[b,K.commandSuggestions,f]),o=_1.useCallback(()=>{if(!w.isActive)return!1;let c=w.complete(z);return f(c),w.hide(),!0},[w.isActive,z,f]),S=_1.useCallback(()=>{if(!M.isActive)return!1;let c=M.complete(z);return f(c),M.hide(),!0},[M.isActive,z,f]),t=_1.useMemo(()=>{if(J)return _?"按 Esc 清空缓冲区":"AI 响应中,Enter 将消息加入缓冲区";if(b)return"输入命令... (试试 /help,按 → 补全第一个建议)";if(M.isActive)return"按 → 补全 Agent";if(w.isActive)return"按 → 补全技能";return X},[J,_,b,M.isActive,w.isActive,X]);return W$.jsxDEV(U,{flexDirection:"column",children:[_&&W$.jsxDEV(U,{padding:1,children:W$.jsxDEV(Q,{color:"yellow",children:["\uD83D\uDCDD 缓冲区: ",_.slice(0,50),_.length>50?"...":""]},void 0,!0,void 0,this)},void 0,!1,void 0,this),W$.jsxDEV(K.CommandHintUI,{},void 0,!1,void 0,this),W$.jsxDEV(m4,{visible:M.state.visible,agents:M.state.filteredAgents,query:M.state.query},void 0,!1,void 0,this),W$.jsxDEV(p4,{visible:w.state.visible,skills:w.state.filteredSkills,query:w.state.query},void 0,!1,void 0,this),W$.jsxDEV(U,{paddingY:1,children:W$.jsxDEV(T1,{id:"global-input",value:z,onChange:f,onSubmit:k,onHotKey:(c,D)=>{if(D.escape)return g(),!1;if(D.rightArrow){if(M.isActive){if(S())return!1}if(w.isActive){if(o())return!1}if(p())return!1}return!0},placeholder:t},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)};var XZ=A(q(),1),U0=kZ.memo(()=>{let{userInput:$,setUserInput:Z,loading:Y,renderMessages:J,sendMessage:X}=$1(),{extraParams:K,manager:W}=Z1(),{switchToHistory:O,switchToKnowledge:_,switchToSettings:G,switchToModelProvider:N,switchToAgent:z,switchToTask:F,switchToMcp:L,switchToProcess:w,closePanel:M}=h$(),{data:b=[]}=h4({manager:W}),{data:f=[]}=D4(),{startRalphLoop:k}=V4({loading:Y,renderMessages:J,sendMessage:X,setUserInput:Z,extraParams:K}),g=y4({extraParams:K,switchToHistory:O,switchToKnowledge:_,switchToSettings:G,switchToModelProvider:N,switchToAgent:z,switchToTask:F,switchToMcp:L,switchToProcess:w,closePanel:M,startRalphLoop:k}),p=kZ.useCallback(async(o)=>{if(!o)return;if(o.startsWith("/")){if(await g.executeCommand(o)){Z("");return}}await X([{type:"human",content:o}],{extraParams:K,metadata:d1}),t1("Zen Code 完成任务")},[g,Z]);return XZ.jsxDEV(U,{flexDirection:"column",paddingX:0,paddingY:0,borderColor:"grey",borderTop:!0,borderStyle:"single",borderLeft:!1,borderBottom:!1,borderRight:!1,children:[XZ.jsxDEV(g.CommandErrorUI,{},void 0,!1,void 0,this),XZ.jsxDEV(g.CommandSuccessUI,{},void 0,!1,void 0,this),XZ.jsxDEV(d4,{value:$,onChange:Z,onSubmit:p,loading:Y,commandHandler:{isCommandInput:g.isCommandInput,CommandHintUI:g.CommandHintUI,commandSuggestions:g.commandSuggestions},skills:b,agents:f},void 0,!1,void 0,this)]},void 0,!0,void 0,this)});U0.displayName="ChatInput";var f1=A(q(),1),L8=()=>{let{renderMessages:$,currentChatId:Z,getToolUIRender:Y,loading:J}=$1(),{compactMode:X}=Z1(),[K]=l4($,50),W=o4.useCallback((O)=>Y(O),[Y]);return f1.jsxDEV(U,{flexDirection:"column",flexGrow:1,paddingX:0,paddingY:0,children:[K.length===0&&f1.jsxDEV(z4,{},void 0,!1,void 0,this),K.length?X?f1.jsxDEV(_0,{renderMessages:K,startIndex:0,staticKey:Z,getToolUIRender:W,loading:J},Z,!1,void 0,this):f1.jsxDEV(Q4,{loading:J,renderMessages:K,startIndex:0,staticKey:Z},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},z0=()=>{let{hasPendingInteractions:$}=P1();return f1.jsxDEV(U,{flexDirection:"column",flexGrow:1,children:[f1.jsxDEV(m,{name:"ChatMessages",fallback:null,children:f1.jsxDEV(L8,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),f1.jsxDEV(i4,{children:f1.jsxDEV(m,{name:"InteractionArea",fallback:null,children:$?f1.jsxDEV(U,{paddingX:0,paddingY:0,children:f1.jsxDEV(aZ,{},void 0,!1,void 0,this)},void 0,!1,void 0,this):f1.jsxDEV(U0,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)};z0.displayName="ChatMain";var p1=A(h(),1);var Q$=A(h(),1),r4=Q$.lazy(()=>import("./chunk-p1bn8p65.js").then(($)=>({default:$.default}))),n4=Q$.lazy(()=>import("./chunk-czbkc7pc.js").then(($)=>({default:$.default}))),a4=Q$.lazy(()=>import("./chunk-jn4j9rm3.js").then(($)=>({default:$.default}))),s4=Q$.lazy(()=>import("./chunk-f7d0m4h3.js").then(($)=>({default:$.default}))),t4=Q$.lazy(()=>import("./chunk-cqrb18vt.js").then(($)=>({default:$.default}))),e4=Q$.lazy(()=>import("./chunk-f4tc5awt.js").then(($)=>({default:$.default}))),$Y=Q$.lazy(()=>import("./chunk-pyw1vxnf.js").then(($)=>({default:$.default}))),ZY=Q$.lazy(()=>import("./chunk-ph818by4.js").then(($)=>({default:$.default})));var T=A(q(),1),H$=()=>T.jsxDEV(U,{paddingX:1,paddingY:1,children:T.jsxDEV(Q,{color:"grey",children:"Loading..."},void 0,!1,void 0,this)},void 0,!1,void 0,this),F$=($)=>T.jsxDEV(U,{paddingX:1,paddingY:1,children:[T.jsxDEV(Q,{color:"red",children:["✗ ",$," panel error"]},void 0,!0,void 0,this),T.jsxDEV(U,{marginTop:1,children:T.jsxDEV(Q,{color:"gray",children:"Try reopening or press ESC to return"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),N0=p1.memo(()=>{let{activeView:$,closePanel:Z,handleExecuteTask:Y}=h$();return T.jsxDEV(U,{flexGrow:1,flexDirection:"row",children:[$==="history"&&T.jsxDEV(p1.Suspense,{fallback:T.jsxDEV(H$,{},void 0,!1,void 0,this),children:T.jsxDEV(m,{name:"HistoryPanel",fallback:F$("History"),children:T.jsxDEV(r4,{onClose:Z},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),$==="knowledge"&&T.jsxDEV(p1.Suspense,{fallback:T.jsxDEV(H$,{},void 0,!1,void 0,this),children:T.jsxDEV(m,{name:"KnowledgePanel",fallback:F$("Knowledge"),children:T.jsxDEV(n4,{onClose:Z},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),$==="settings"&&T.jsxDEV(p1.Suspense,{fallback:T.jsxDEV(H$,{},void 0,!1,void 0,this),children:T.jsxDEV(m,{name:"SettingsPanel",fallback:F$("Settings"),children:T.jsxDEV(a4,{onClose:Z},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),$==="model-provider"&&T.jsxDEV(p1.Suspense,{fallback:T.jsxDEV(H$,{},void 0,!1,void 0,this),children:T.jsxDEV(m,{name:"ModelProviderPanel",fallback:F$("Model Provider"),children:T.jsxDEV(s4,{onClose:Z},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),$==="agent"&&T.jsxDEV(p1.Suspense,{fallback:T.jsxDEV(H$,{},void 0,!1,void 0,this),children:T.jsxDEV(m,{name:"AgentPanel",fallback:F$("Agent"),children:T.jsxDEV(t4,{onClose:Z},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),$==="task"&&T.jsxDEV(p1.Suspense,{fallback:T.jsxDEV(H$,{},void 0,!1,void 0,this),children:T.jsxDEV(m,{name:"TaskPanel",fallback:F$("Task"),children:T.jsxDEV(e4,{onClose:Z,onExecuteTask:Y},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),$==="mcp"&&T.jsxDEV(p1.Suspense,{fallback:T.jsxDEV(H$,{},void 0,!1,void 0,this),children:T.jsxDEV(m,{name:"McpPanel",fallback:F$("MCP"),children:T.jsxDEV($Y,{onClose:Z},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),$==="process"&&T.jsxDEV(p1.Suspense,{fallback:T.jsxDEV(H$,{},void 0,!1,void 0,this),children:T.jsxDEV(m,{name:"ProcessPanel",fallback:F$("Process"),children:T.jsxDEV(ZY,{onClose:Z},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)});N0.displayName="LazyChatViewManager";var L$=A(h(),1);var YY=A(h(),1);var TZ=A(q(),1),XY=()=>{let{renderMessages:$}=$1(),Z=YY.default.useMemo(()=>{if(!$)return null;for(let Y=$.length-1;Y>=0;Y--){let J=$[Y];if(J.role==="assistant"&&J.content)try{let K=(Array.isArray(J.content)?J.content:[{type:"text",text:J.content}]).find((W)=>W.type==="text")?.text||"";if(K.includes("load_mcp_tools"))try{let W=JSON.parse(K);if(W.status&&W.status.toolCount!==void 0)return W.status}catch(W){}}catch(X){}}return null},[$]);if(!Z||Z.toolCount===0)return null;return TZ.jsxDEV(U,{paddingX:1,children:[TZ.jsxDEV(Q,{color:"green",bold:!0,children:"MCP"},void 0,!1,void 0,this),TZ.jsxDEV(Q,{color:"cyan",children:[" ",Z.toolCount]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)};var m1=A(h(),1);function F0($){if($===0)return"0";if($<1024)return`${$}`;if($<1048576)return`${($/1024).toFixed(0)}K`;if($<1073741824)return`${($/1048576).toFixed(0)}M`;return`${($/1073741824).toFixed(1)}G`}function JY($){let Z=Math.floor($/1000),Y=Math.floor(Z/3600),J=Math.floor(Z%3600/60),X=Z%60;if(Y>0)return`${Y}:${String(J).padStart(2,"0")}:${String(X).padStart(2,"0")}`;return`${String(J).padStart(2,"0")}:${String(X).padStart(2,"0")}`}function KY($){let[Z,Y]=m1.useState(0),J=m1.useRef(null);return m1.useEffect(()=>{if($)J.current=Date.now(),Y(0);else J.current=null,Y(0)},[$]),H0(()=>{if(J.current)Y(Date.now()-J.current)},$?1000:null),Z}function WY(){let[$,Z]=m1.useState({cpuPercent:0,memoryRSS:0,memoryHeapUsed:0,memoryHeapTotal:0}),Y=m1.useRef(process.cpuUsage()),J=m1.useRef(Date.now()),X=()=>{let K=Date.now(),W=process.cpuUsage(),O=process.memoryUsage(),_=K-J.current,G=W.user-Y.current.user,N=W.system-Y.current.system,F=(G+N)/1000/_*100;Z({cpuPercent:Math.min(100,Math.max(0,F)),memoryRSS:O.rss,memoryHeapUsed:O.heapUsed,memoryHeapTotal:O.heapTotal}),Y.current=W,J.current=K};return m1.useEffect(()=>{X()},[]),H0(X,2000),$}function QY($){if($<50)return"green";if($<80)return"yellow";return"red"}function _Y($,Z){if(Z===0)return"gray";let Y=$/Z*100;if(Y<50)return"green";if(Y<80)return"yellow";return"red"}var _$=A(q(),1),A8=()=>{let $=WY(),Z=QY($.cpuPercent),Y=_Y($.memoryHeapUsed,$.memoryHeapTotal);return _$.jsxDEV(U,{paddingX:1,width:"100%",children:_$.jsxDEV(U,{gap:2,children:[_$.jsxDEV(U,{children:[_$.jsxDEV(Q,{dimColor:!0,children:"CPU:"},void 0,!1,void 0,this),_$.jsxDEV(Q,{color:Z,children:[" ",$.cpuPercent.toFixed(0),"%"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),_$.jsxDEV(U,{children:[_$.jsxDEV(Q,{dimColor:!0,children:"MEM:"},void 0,!1,void 0,this),_$.jsxDEV(Q,{color:Y,children:[F0($.memoryHeapUsed),"/",F0($.memoryRSS)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},OY=A8;var J1=A(q(),1);import w8 from"path";var M8=()=>{let{extraParams:$,compactMode:Z,showDetailedInfo:Y}=Z1(),{currentChatId:J,renderMessages:X}=$1(),{loading:K,stopGeneration:W}=$1(),O=process.env.YOLO_MODE==="true",[_,G]=L$.useState(0);L$.useEffect(()=>{let M=async()=>{let f=await UY.getProcessList();G(f.length)};M();let b=setInterval(M,2000);return()=>clearInterval(b)},[]);let N=L$.useCallback((M,b)=>{if(b.ctrl&&M==="c")process.exit()},[K,W]);S1(N);let z=KY(K),F=L$.default.useMemo(()=>{return w8.basename(process.cwd())},[]),w=(X?.length||0)>100;return J1.jsxDEV(U,{flexDirection:"column",width:"100%",children:[J1.jsxDEV(U,{paddingX:1,paddingY:0,justifyContent:"space-between",width:"100%",marginBottom:1,children:[J1.jsxDEV(U,{gap:1,children:[K&&J1.jsxDEV(Q,{color:"yellow",bold:!0,children:J1.jsxDEV(GY,{text:"LOADING"},void 0,!1,void 0,this)},void 0,!1,void 0,this),!K&&J1.jsxDEV(Q,{color:"magenta",bold:!0,children:"Zen Code"},void 0,!1,void 0,this),J1.jsxDEV(Q,{color:"cyan",bold:!0,children:[" ",$.model_id]},void 0,!0,void 0,this),J1.jsxDEV(Q,{color:"yellow",bold:!0,children:[" ","@",$.switch_command||"default"]},void 0,!0,void 0,this),!Z&&J1.jsxDEV(Q,{color:"blue",bold:!0,children:[" ","[FULL]"]},void 0,!0,void 0,this),O&&J1.jsxDEV(Q,{color:"red",bold:!0,children:[" ","YOLO"]},void 0,!0,void 0,this),J1.jsxDEV(XY,{},void 0,!1,void 0,this),_>0&&J1.jsxDEV(Q,{color:"magenta",bold:!0,children:[" ","● BG (",_,")"]},void 0,!0,void 0,this),w&&J1.jsxDEV(Q,{color:"red",bold:!0,children:[" ","/summary"]},void 0,!0,void 0,this),J1.jsxDEV(Q,{color:"green",bold:!0,children:X.length},void 0,!1,void 0,this),J1.jsxDEV(Q,{color:"blue",children:F},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K&&J1.jsxDEV(U,{children:J1.jsxDEV(Q,{color:"yellow",children:JY(z)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y&&J1.jsxDEV(OY,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},zY=M8;var u=A(q(),1),q8=()=>{let{activeView:$}=h$();return u.jsxDEV(U,{flexDirection:"column",width:"100%",children:[u.jsxDEV(U,{flexGrow:1,flexDirection:"row",children:[u.jsxDEV(m,{name:"ChatMain",fallback:u.jsxDEV(Q,{color:"yellow",children:"Chat view unavailable"},void 0,!1,void 0,this),children:$==="chat"?u.jsxDEV(z0,{},void 0,!1,void 0,this):null},void 0,!1,void 0,this),u.jsxDEV(m,{name:"PanelView",fallback:u.jsxDEV(Q,{color:"yellow",children:"Panel unavailable"},void 0,!1,void 0,this),children:$!=="chat"?u.jsxDEV(N0,{},void 0,!1,void 0,this):null},void 0,!1,void 0,this)]},void 0,!0,void 0,this),u.jsxDEV(m,{name:"StatusBar",fallback:null,children:u.jsxDEV(zY,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},b8=()=>{return u.jsxDEV(m,{name:"Chat",children:u.jsxDEV(y2,{children:u.jsxDEV(q8,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},R8=()=>{return u.jsxDEV(m,{name:"AppRoot",children:u.jsxDEV(NY,{apiUrl:"http://127.0.0.1:8123",defaultAgent:"code",defaultHeaders:{},withCredentials:!1,showHistory:!1,showGraph:!1,onInitError:($,Z)=>{console.error($,Z)},fetch:j0,autoRestoreLastSession:!0,historyFilter:{metadata:{path:process.cwd()}},children:u.jsxDEV(m,{name:"TanStackQueryProvider",children:u.jsxDEV(R0,{children:u.jsxDEV(m,{name:"SettingsProvider",children:u.jsxDEV(FY,{get_allowed_models:E0,children:u.jsxDEV(m,{name:"ApprovalProvider",children:u.jsxDEV(HY,{children:u.jsxDEV(m,{name:"InteractionProvider",children:u.jsxDEV(QZ,{children:u.jsxDEV(b8,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},B8=()=>u.jsxDEV(R8,{},void 0,!1,void 0,this),L0=B8;var c1=A(q(),1),f8=({error:$})=>c1.jsxDEV(U,{flexDirection:"column",padding:2,borderStyle:"double",borderColor:"red",children:[c1.jsxDEV(Q,{color:"red",bold:!0,children:"✗ Application Crashed"},void 0,!1,void 0,this),c1.jsxDEV(U,{marginTop:1,children:c1.jsxDEV(Q,{color:"red",children:$.message},void 0,!1,void 0,this)},void 0,!1,void 0,this),c1.jsxDEV(U,{marginTop:1,children:c1.jsxDEV(Q,{color:"gray",children:["Stack: ",$.stack?.split(`
340
328
  `).slice(0,3).join(`
341
- `)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),J4.jsxDEV(_,{marginTop:1,children:J4.jsxDEV(O,{color:"blue",children:"Press Ctrl+C to exit"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);try{K8(J4.jsxDEV($8,{},void 0,!1,void 0,this),{exitOnCtrlC:!1})}catch(Z){console.error("Critical rendering error:",Z),K8(J4.jsxDEV(j2,{error:Z},void 0,!1,void 0,this))}process.on("unhandledRejection",(Z,Y)=>{console.error("Unhandled Rejection at:",Y,"reason:",Z)});process.on("uncaughtException",(Z)=>{console.error("Uncaught Exception:",Z)});
329
+ `)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),c1.jsxDEV(U,{marginTop:1,children:c1.jsxDEV(Q,{color:"blue",children:"Press Ctrl+C to exit"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);try{A0(c1.jsxDEV(L0,{},void 0,!1,void 0,this),{exitOnCtrlC:!1})}catch($){console.error("Critical rendering error:",$),A0(c1.jsxDEV(f8,{error:$},void 0,!1,void 0,this))}process.on("unhandledRejection",($,Z)=>{console.error("Unhandled Rejection at:",Z,"reason:",$)});process.on("uncaughtException",($)=>{console.error("Uncaught Exception:",$)});