@kafca/agentdock 0.1.56 → 0.1.58

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 (200) hide show
  1. package/README.md +7 -0
  2. package/dist/renderer/assets/{Badge-DjcoXx2J.js → Badge-BfY1VaHS.js} +1 -1
  3. package/dist/renderer/assets/Card-DWA_Tww_.js +1 -0
  4. package/dist/renderer/assets/Config-nHj3g1U5.js +21 -0
  5. package/dist/renderer/assets/CronList-BwkA_I7v.js +1 -0
  6. package/dist/renderer/assets/Dashboard-D0_A7k02.js +41 -0
  7. package/dist/renderer/assets/{EmptyState-DIZLiccW.js → EmptyState-zatDjLj_.js} +1 -1
  8. package/dist/renderer/assets/HighlightedMarkdown-CsM5n70d.js +12 -0
  9. package/dist/renderer/assets/Input-R1XdFK1K.js +1 -0
  10. package/dist/renderer/assets/{KnowledgeDetail-CJ9IYOsa.js → KnowledgeDetail-Co5sxeGd.js} +2 -2
  11. package/dist/renderer/assets/{KnowledgeHome-BLGPwnBO.js → KnowledgeHome-DwziPw5m.js} +3 -3
  12. package/dist/renderer/assets/Logs-NwZUtR_G.js +6 -0
  13. package/dist/renderer/assets/{Modal-CQiUpfl4.js → Modal-CrcIwIFL.js} +3 -3
  14. package/dist/renderer/assets/MonitorList-CS1uLS5A.js +1 -0
  15. package/dist/renderer/assets/Page-Dp0obeSw.js +1 -0
  16. package/dist/renderer/assets/{Select-D6z65IT3.js → Select-6mVQaf84.js} +2 -2
  17. package/dist/renderer/assets/ThreadChat-BFzbn3L6.js +86 -0
  18. package/dist/renderer/assets/Workspace-DCmo8BMm.js +19 -0
  19. package/dist/renderer/assets/{arrow-left-CV5cL3f4.js → arrow-left-9rjg_Hp4.js} +1 -1
  20. package/dist/renderer/assets/{book-open-DThvB7pj.js → book-open-Bu8GCHnG.js} +1 -1
  21. package/dist/renderer/assets/channels-BxVbG-6j.js +6 -0
  22. package/dist/renderer/assets/chevron-down-BE8uQmWM.js +11 -0
  23. package/dist/renderer/assets/index-B7TeF6Es.js +41 -0
  24. package/dist/renderer/assets/index-BIKL3fTP.css +11 -0
  25. package/dist/renderer/assets/index-BkI9POxj.js +167 -0
  26. package/dist/renderer/assets/knowledge-Kl19SqGS.js +1 -0
  27. package/dist/renderer/assets/{pencil-Dv5WxhdC.js → pencil-CPB7SK1m.js} +1 -1
  28. package/dist/renderer/assets/{play-DnCnft83.js → play-DGAO4OCu.js} +1 -1
  29. package/dist/renderer/assets/{plus-DsxIagzS.js → plus-Bt26z-4q.js} +1 -1
  30. package/dist/renderer/assets/{save-CST01lIc.js → save-Une7GMxT.js} +1 -1
  31. package/dist/renderer/assets/{search-B_bqy6Wd.js → search-DE0agJjJ.js} +1 -1
  32. package/dist/renderer/assets/{shield-check-D6lG5Aoc.js → shield-check-De7xaXZh.js} +1 -1
  33. package/dist/renderer/assets/threads-BnsNL5ei.js +1 -0
  34. package/dist/renderer/assets/{trash-2-Cefngb6Q.js → trash-2-6iGF59Ac.js} +1 -1
  35. package/dist/renderer/index.html +2 -2
  36. package/dist-electron/packages/contracts/src/automation.js +2 -0
  37. package/dist-electron/packages/contracts/src/channels.js +2 -0
  38. package/dist-electron/packages/contracts/src/knowledge.js +2 -0
  39. package/dist-electron/packages/contracts/src/local-core.js +15 -0
  40. package/dist-electron/packages/contracts/src/runtime.js +2 -0
  41. package/dist-electron/packages/contracts/src/scheduler.js +2 -0
  42. package/dist-electron/packages/contracts/src/threads.js +2 -0
  43. package/dist-electron/packages/core-sdk/src/automation.js +32 -0
  44. package/dist-electron/packages/core-sdk/src/channels.js +121 -0
  45. package/dist-electron/packages/core-sdk/src/client.js +455 -0
  46. package/dist-electron/packages/core-sdk/src/index.js +43 -607
  47. package/dist-electron/packages/core-sdk/src/knowledge.js +85 -0
  48. package/dist-electron/packages/core-sdk/src/request.js +22 -0
  49. package/dist-electron/packages/core-sdk/src/runtime.js +214 -0
  50. package/dist-electron/packages/core-sdk/src/scheduler.js +32 -0
  51. package/dist-electron/packages/core-sdk/src/threads.js +67 -0
  52. package/dist-electron/packages/plugin-sdk/src/agents.js +2 -0
  53. package/dist-electron/packages/plugin-sdk/src/automation.js +2 -0
  54. package/dist-electron/packages/plugin-sdk/src/channels.js +2 -0
  55. package/dist-electron/packages/plugin-sdk/src/index.js +21 -0
  56. package/dist-electron/packages/plugin-sdk/src/knowledge.js +2 -0
  57. package/dist-electron/packages/plugin-sdk/src/runtime.js +2 -0
  58. package/dist-electron/packages/plugin-sdk/src/scheduler.js +2 -0
  59. package/dist-electron/packages/plugin-sdk/src/threads.js +2 -0
  60. package/dist-electron/services/local-ai-core/src/acp/local-core-acp-backend.js +5 -8
  61. package/dist-electron/services/local-ai-core/src/acp/local-core-acp-content.js +2 -2
  62. package/dist-electron/services/local-ai-core/src/acp/local-core-acp-turn-coordinator.js +3 -3
  63. package/dist-electron/services/local-ai-core/src/acp/store/agent-task-store.js +5 -5
  64. package/dist-electron/services/local-ai-core/src/acp/store/automation-monitor-store.js +12 -12
  65. package/dist-electron/services/local-ai-core/src/acp/store/local-core-acp-store.js +2 -2
  66. package/dist-electron/services/local-ai-core/src/acp/store/scheduler-store.js +11 -11
  67. package/dist-electron/services/local-ai-core/src/acp/store/security-store.js +3 -3
  68. package/dist-electron/services/local-ai-core/src/acp/store/thread-store.js +7 -7
  69. package/dist-electron/services/local-ai-core/src/acp/workspace-acp-permissions.js +2 -2
  70. package/dist-electron/services/local-ai-core/src/agents/claudecode/definition.js +3 -3
  71. package/dist-electron/services/local-ai-core/src/agents/codex/definition.js +3 -3
  72. package/dist-electron/services/local-ai-core/src/agents/localcore-acp/definition.js +2 -2
  73. package/dist-electron/services/local-ai-core/src/agents/localcore-acp/index.js +4 -4
  74. package/dist-electron/services/local-ai-core/src/agents/opencode/launch.js +2 -2
  75. package/dist-electron/services/local-ai-core/src/agents/pi/definition.js +2 -2
  76. package/dist-electron/services/local-ai-core/src/agents/pi/launch.js +3 -3
  77. package/dist-electron/services/local-ai-core/src/agents/pi/provider-materializer.js +1 -1
  78. package/dist-electron/services/local-ai-core/src/agents/shared/agent-plugin.js +4 -4
  79. package/dist-electron/services/local-ai-core/src/automation/automation-conversation-executor.js +6 -47
  80. package/dist-electron/services/local-ai-core/src/automation/automation-monitor-service.js +2 -5
  81. package/dist-electron/services/local-ai-core/src/channel/lark/cards.js +33 -18
  82. package/dist-electron/services/local-ai-core/src/channel/lark/config.js +2 -2
  83. package/dist-electron/services/local-ai-core/src/channel/lark/gateway-utils.js +91 -0
  84. package/dist-electron/services/local-ai-core/src/channel/lark/inbound-handler.js +180 -0
  85. package/dist-electron/services/local-ai-core/src/channel/lark/local-core-lark-gateway.js +58 -539
  86. package/dist-electron/services/local-ai-core/src/channel/lark/outbound-transport.js +112 -0
  87. package/dist-electron/services/local-ai-core/src/channel/lark/runtime-state.js +5 -20
  88. package/dist-electron/services/local-ai-core/src/channel/shared/base-channel-gateway.js +37 -0
  89. package/dist-electron/services/local-ai-core/src/channel/shared/bridge-event-helpers.js +23 -0
  90. package/dist-electron/services/local-ai-core/src/channel/shared/channel-keys.js +6 -0
  91. package/dist-electron/services/local-ai-core/src/channel/shared/inbound-authorization.js +54 -0
  92. package/dist-electron/services/local-ai-core/src/channel/weixin/config.js +2 -2
  93. package/dist-electron/services/local-ai-core/src/channel/weixin/inbound-media.js +21 -0
  94. package/dist-electron/services/local-ai-core/src/channel/weixin/inbound-poller.js +167 -0
  95. package/dist-electron/services/local-ai-core/src/channel/weixin/local-core-weixin-gateway.js +55 -512
  96. package/dist-electron/services/local-ai-core/src/channel/weixin/runtime-state.js +149 -0
  97. package/dist-electron/services/local-ai-core/src/channel/weixin/text-utils.js +92 -0
  98. package/dist-electron/services/local-ai-core/src/cli/lac.js +9 -11
  99. package/dist-electron/services/local-ai-core/src/cli/monitor-cli-parsers.js +2 -2
  100. package/dist-electron/services/local-ai-core/src/kernel/bootstrap.js +28 -70
  101. package/dist-electron/services/local-ai-core/src/kernel/local-core-errors.js +8 -0
  102. package/dist-electron/services/local-ai-core/src/plugins/builtin/knowledge-ai-vector-plugin.js +2 -2
  103. package/dist-electron/services/local-ai-core/src/plugins/builtin/knowledge-noop-plugin.js +2 -2
  104. package/dist-electron/services/local-ai-core/src/router/workspace-bridge-event-stream.js +29 -0
  105. package/dist-electron/services/local-ai-core/src/router/workspace-route-config.js +5 -5
  106. package/dist-electron/services/local-ai-core/src/router/workspace-router.js +47 -60
  107. package/dist-electron/services/local-ai-core/src/runtime/agent-runtime-detector.js +5 -5
  108. package/dist-electron/services/local-ai-core/src/runtime/config-migration.js +6 -6
  109. package/dist-electron/services/local-ai-core/src/runtime/deployment-diagnostics.js +3 -3
  110. package/dist-electron/services/local-ai-core/src/runtime/external-service.js +3 -1
  111. package/dist-electron/services/local-ai-core/src/runtime/handlers/automation-handler.js +11 -2
  112. package/dist-electron/services/local-ai-core/src/runtime/handlers/channel-handler.js +12 -6
  113. package/dist-electron/services/local-ai-core/src/runtime/handlers/external-handler.js +10 -2
  114. package/dist-electron/services/local-ai-core/src/runtime/handlers/knowledge-handler.js +18 -6
  115. package/dist-electron/services/local-ai-core/src/runtime/handlers/provider-handler.js +7 -2
  116. package/dist-electron/services/local-ai-core/src/runtime/handlers/runtime-handler.js +28 -3
  117. package/dist-electron/services/local-ai-core/src/runtime/handlers/scheduler-handler.js +10 -2
  118. package/dist-electron/services/local-ai-core/src/runtime/handlers/security-handler.js +18 -5
  119. package/dist-electron/services/local-ai-core/src/runtime/handlers/task-handler.js +14 -2
  120. package/dist-electron/services/local-ai-core/src/runtime/handlers/thread-handler.js +18 -15
  121. package/dist-electron/services/local-ai-core/src/runtime/handlers/workspace-handler.js +13 -2
  122. package/dist-electron/services/local-ai-core/src/runtime/local-core-controller.js +35 -8
  123. package/dist-electron/services/local-ai-core/src/runtime/request-validation.js +79 -0
  124. package/dist-electron/services/local-ai-core/src/runtime/runtime-detection-service.js +9 -9
  125. package/dist-electron/services/local-ai-core/src/runtime/server-helpers.js +10 -1
  126. package/dist-electron/services/local-ai-core/src/runtime/server.js +2 -1
  127. package/dist-electron/services/local-ai-core/src/runtime/workspace-project-registry.js +76 -0
  128. package/dist-electron/services/local-ai-core/src/sandbox/opensandbox-client.js +3 -2
  129. package/dist-electron/services/local-ai-core/src/sandbox/sandbox-config.js +8 -8
  130. package/dist-electron/services/local-ai-core/src/scheduler/base-channel-schedule-adapter.js +77 -0
  131. package/dist-electron/services/local-ai-core/src/scheduler/lark-schedule-adapter.js +13 -79
  132. package/dist-electron/services/local-ai-core/src/scheduler/local-schedule-adapter.js +2 -10
  133. package/dist-electron/services/local-ai-core/src/scheduler/run-polling.js +19 -0
  134. package/dist-electron/services/local-ai-core/src/scheduler/scheduled-conversation-executor.js +3 -37
  135. package/dist-electron/services/local-ai-core/src/scheduler/scheduled-job-route.js +20 -0
  136. package/dist-electron/services/local-ai-core/src/scheduler/scheduler-service.js +15 -28
  137. package/dist-electron/services/local-ai-core/src/scheduler/thread-resolution.js +12 -0
  138. package/dist-electron/services/local-ai-core/src/scheduler/weixin-schedule-adapter.js +13 -79
  139. package/dist-electron/services/local-ai-core/src/thread/agent-message-policy.js +75 -0
  140. package/dist-electron/shared/desktop.js +1 -64
  141. package/dist-electron/src/components/chat/chat-controller-state.js +60 -0
  142. package/dist-electron/src/components/chat/chat-event-gate.js +146 -0
  143. package/dist-electron/src/components/chat/markdown-code-block.js +8 -0
  144. package/dist-electron/src/pages/Desktop/workspace-model.js +212 -0
  145. package/dist-electron/src/pages/Threads/thread-chat-model.js +50 -51
  146. package/dist-electron/tests/contracts/agent-message-policy.test.js +21 -0
  147. package/dist-electron/tests/contracts/architecture-docs.test.js +56 -33
  148. package/dist-electron/tests/contracts/chat-event-gate.test.js +114 -0
  149. package/dist-electron/tests/contracts/chat-markdown.test.js +16 -0
  150. package/dist-electron/tests/contracts/thread-task-state.test.js +32 -0
  151. package/dist-electron/tests/contracts/workspace-identity.test.js +23 -0
  152. package/dist-electron/tests/electron/core-client.test.js +284 -0
  153. package/dist-electron/tests/electron/plugin-kernel.test.js +54 -0
  154. package/dist-electron/tests/electron/renderer-packaging.test.js +9 -0
  155. package/dist-electron/tests/electron/workspace-task-store.test.js +31 -0
  156. package/dist-electron/tests/integration/channel-inbound-authorization.test.js +80 -0
  157. package/dist-electron/tests/integration/lark-gateway-utils.test.js +13 -0
  158. package/dist-electron/tests/integration/lark-gateway.test.js +4 -4
  159. package/dist-electron/tests/integration/local-core-refactor.test.js +15 -8
  160. package/dist-electron/tests/integration/weixin-runtime-state.test.js +32 -0
  161. package/dist-electron/tests/integration/weixin-text-utils.test.js +15 -0
  162. package/package.json +9 -4
  163. package/dist/renderer/assets/Chat-C5Bkm9-M.js +0 -2
  164. package/dist/renderer/assets/ChatMarkdown-uc36EzyD.js +0 -45
  165. package/dist/renderer/assets/Config-DHtQuuLy.js +0 -21
  166. package/dist/renderer/assets/CronList-BYUnhzSC.js +0 -1
  167. package/dist/renderer/assets/Dashboard-BPnGMDg3.js +0 -26
  168. package/dist/renderer/assets/Logs-Dyd2Uwlt.js +0 -1
  169. package/dist/renderer/assets/MonitorList-Byg3E3Gt.js +0 -1
  170. package/dist/renderer/assets/Page-7DxXvTMm.js +0 -1
  171. package/dist/renderer/assets/ProjectDetail-Dfr5s0Ja.js +0 -11
  172. package/dist/renderer/assets/ProjectList-CDDQjAQ_.js +0 -1
  173. package/dist/renderer/assets/SessionChat-s7CAaCPL.js +0 -1
  174. package/dist/renderer/assets/SessionList-D-OycKKS.js +0 -1
  175. package/dist/renderer/assets/ThreadChat-CLdFynB5.js +0 -28
  176. package/dist/renderer/assets/Workspace-xfT5z4j_.js +0 -19
  177. package/dist/renderer/assets/bot-CWQ5-ovl.js +0 -6
  178. package/dist/renderer/assets/check-DKM7zfWG.js +0 -6
  179. package/dist/renderer/assets/chevron-down-Dfw2KU87.js +0 -6
  180. package/dist/renderer/assets/circle-CoP4RA4s.js +0 -6
  181. package/dist/renderer/assets/desktop-CsDYrOOU.js +0 -1
  182. package/dist/renderer/assets/desktop-JQkhNOF4.js +0 -5
  183. package/dist/renderer/assets/funnel-DpVLlG3g.js +0 -6
  184. package/dist/renderer/assets/heart-BMD36ejP.js +0 -6
  185. package/dist/renderer/assets/index-COxSYBjE.js +0 -182
  186. package/dist/renderer/assets/index-CTGTI-cm.js +0 -41
  187. package/dist/renderer/assets/index-CjCuR6DI.css +0 -11
  188. package/dist/renderer/assets/projects-DgjHcNgt.js +0 -1
  189. package/dist/renderer/assets/server-ecH4GNwa.js +0 -11
  190. package/dist/renderer/assets/session-utils-Dd_WKMYW.js +0 -6
  191. package/dist/renderer/assets/sessions-BQ33Mv4k.js +0 -1
  192. package/dist/renderer/assets/user-D_8RSH-T.js +0 -6
  193. package/dist/renderer/assets/wifi-off-DB9D-pOu.js +0 -11
  194. package/dist-electron/services/local-ai-core/src/scheduler/lark-execution-policies.js +0 -13
  195. package/dist-electron/services/local-ai-core/src/scheduler/weixin-execution-policies.js +0 -13
  196. package/dist-electron/src/api/client.js +0 -73
  197. package/dist-electron/src/api/sessions.js +0 -21
  198. package/dist-electron/src/lib/session-utils.js +0 -51
  199. package/dist-electron/src/pages/Projects/project-provider-config.js +0 -75
  200. package/dist-electron/tests/electron/project-provider-config.test.js +0 -71
@@ -0,0 +1,86 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./HighlightedMarkdown-CsM5n70d.js","./index-BkI9POxj.js","./index-BIKL3fTP.css","./chevron-down-BE8uQmWM.js","./channels-BxVbG-6j.js","./shield-check-De7xaXZh.js","./Input-R1XdFK1K.js","./Modal-CrcIwIFL.js","./index-B7TeF6Es.js","./search-DE0agJjJ.js","./pencil-CPB7SK1m.js","./trash-2-6iGF59Ac.js","./knowledge-Kl19SqGS.js","./threads-BnsNL5ei.js"])))=>i.map(i=>d[i]);
2
+ import{c as Ee,h as Or,j as g,g as pe,r as T,_ as gl,B as ce,W as xl,C as Bn,i as bl,t as kl,k as yl,o as wl,s as Sl,m as Cl}from"./index-BkI9POxj.js";import{n as vl,i as El,B as Il,a as $n,b as jl,s as Al,o as Nl}from"./channels-BxVbG-6j.js";import{C as Br,a as _l}from"./chevron-down-BE8uQmWM.js";import{S as Tl}from"./shield-check-De7xaXZh.js";import{I as xn,T as zl}from"./Input-R1XdFK1K.js";import{X as $r,M as Un}from"./Modal-CrcIwIFL.js";import{S as Pl}from"./search-DE0agJjJ.js";import{P as Ll}from"./pencil-CPB7SK1m.js";import{T as Dl}from"./trash-2-6iGF59Ac.js";import{l as Fl}from"./knowledge-Kl19SqGS.js";import{a as Ml,g as Rl,l as Ol,c as Ur,u as bn,b as kn,s as Hr,d as Bl,i as $l,r as Ul,e as Hl}from"./threads-BnsNL5ei.js";/**
3
+ * @license lucide-react v0.487.0 - ISC
4
+ *
5
+ * This source code is licensed under the ISC license.
6
+ * See the LICENSE file in the root directory of this source tree.
7
+ */const Kl=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Vl=Ee("arrow-up",Kl);/**
8
+ * @license lucide-react v0.487.0 - ISC
9
+ *
10
+ * This source code is licensed under the ISC license.
11
+ * See the LICENSE file in the root directory of this source tree.
12
+ */const ql=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],_t=Ee("circle",ql);/**
13
+ * @license lucide-react v0.487.0 - ISC
14
+ *
15
+ * This source code is licensed under the ISC license.
16
+ * See the LICENSE file in the root directory of this source tree.
17
+ */const Wl=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],Yl=Ee("database",Wl);/**
18
+ * @license lucide-react v0.487.0 - ISC
19
+ *
20
+ * This source code is licensed under the ISC license.
21
+ * See the LICENSE file in the root directory of this source tree.
22
+ */const Xl=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Bt=Ee("loader-circle",Xl);/**
23
+ * @license lucide-react v0.487.0 - ISC
24
+ *
25
+ * This source code is licensed under the ISC license.
26
+ * See the LICENSE file in the root directory of this source tree.
27
+ */const Ql=[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M9 10h6",key:"9gxzsh"}]],Kr=Ee("message-square-plus",Ql);/**
28
+ * @license lucide-react v0.487.0 - ISC
29
+ *
30
+ * This source code is licensed under the ISC license.
31
+ * See the LICENSE file in the root directory of this source tree.
32
+ */const Gl=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],Jl=Ee("panel-left",Gl);/**
33
+ * @license lucide-react v0.487.0 - ISC
34
+ *
35
+ * This source code is licensed under the ISC license.
36
+ * See the LICENSE file in the root directory of this source tree.
37
+ */const Zl=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],ea=Ee("rotate-cw",Zl);/**
38
+ * @license lucide-react v0.487.0 - ISC
39
+ *
40
+ * This source code is licensed under the ISC license.
41
+ * See the LICENSE file in the root directory of this source tree.
42
+ */const ta=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],na=Ee("shield",ta);/**
43
+ * @license lucide-react v0.487.0 - ISC
44
+ *
45
+ * This source code is licensed under the ISC license.
46
+ * See the LICENSE file in the root directory of this source tree.
47
+ */const ra=[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]],ia=Ee("terminal",ra);/**
48
+ * @license lucide-react v0.487.0 - ISC
49
+ *
50
+ * This source code is licensed under the ISC license.
51
+ * See the LICENSE file in the root directory of this source tree.
52
+ */const la=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],aa=Ee("user",la);/**
53
+ * @license lucide-react v0.487.0 - ISC
54
+ *
55
+ * This source code is licensed under the ISC license.
56
+ * See the LICENSE file in the root directory of this source tree.
57
+ */const oa=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],sa=Ee("wifi-off",oa),Hn=new Set(["buttons","reply","preview_start","status","update_message","typing_start"]),ua=new Set(["typing_start","status"]);function Kn(e){return ua.has(e)}function ca(e,t){const n=String(e.replyCtx||"").trim();if(!n)return!0;const r=String(t.activeRunId||"").trim(),i=t.pendingTurn;if(i&&i.sessionKey===e.sessionKey){const a=String(i.runId||"").trim();if(a)return n===a;const l=String(i.supersededRunId||"").trim();if(l&&n===l)return!1}return!r||n===r}function fa(e){return JSON.stringify([e.type,e.sessionKey||"",e.replyCtx||"",e.previewHandle||"",e.messageId||"",e.bridgeKind||"",e.bridgeStatus||"",e.content||"",e.toolCall||null,e.buttonRows||e.buttons||null])}function da(e){return JSON.stringify(e)}function pa(e){return"stream"in e?e.stream:void 0}function ha(e=256){const t=new Set,n=[],r=new Set,i=[],a=o=>{if(t.has(o))return!1;for(t.add(o),n.push(o);n.length>e;){const s=n.shift();s&&t.delete(s)}return!0},l=o=>{if(!r.has(o))for(r.add(o),i.push(o);i.length>e;){const s=i.shift();s&&r.delete(s)}};return{acceptBridgeEvent(o,s={}){if(!ca(o,s))return!1;const u=o.replyCtx?`${o.sessionKey||""}:${o.replyCtx}`:"";return u&&r.has(u)&&Hn.has(o.type)||!Kn(o.type)&&!a(`bridge:${fa(o)}`)?!1:(u&&(o.type==="typing_stop"||o.type==="card")&&l(u),!0)},acceptCoreEvent(o){const s=o.type==="run.updated"?`run:${o.run.id}`:"";if(o.type==="run.updated"&&r.has(s)&&(o.run.status==="queued"||o.run.status==="running"||o.run.status==="awaiting_input"))return!1;const u=pa(o),f=u!=null&&u.replyCtx?`${u.sessionKey||""}:${u.replyCtx}`:"";return f&&r.has(f)&&Hn.has(u.type)||!(u?Kn(u.type):!1)&&!a(`core:${da(o)}`)?!1:(f&&((u==null?void 0:u.type)==="typing_stop"||(u==null?void 0:u.type)==="card")&&l(f),s&&o.type==="run.updated"&&(o.run.status==="completed"||o.run.status==="failed"||o.run.status==="interrupted")&&l(s),!0)},reset(){t.clear(),n.length=0,r.clear(),i.length=0}}}const ma=9e4;function ga(e){switch(e){case"idle":return{type:"settled"};case"running":return{type:"stream_started"};case"awaiting_input":return{type:"input_requested"};case"awaiting_permission":return{type:"permission_requested"};case"permission_submitted":return{type:"permission_submitted"};case"stopping":return{type:"stop_started"};case"error":return{type:"failed"}}}function xa(e){switch(e){case"idle":case"running":case"awaiting_input":case"awaiting_permission":case"permission_submitted":case"error":case"stopping":return e;case"failed":case"timed_out":return"error";default:return"running"}}function ht(e){return e==="thought"||e==="plan"||e==="tool"||e==="status"||e==="permission"}function $t(e){return e==="awaiting_input"}function vt(e,t,n){if(t)return e.find(r=>r.id===t);if(n)return e.find(r=>r.preview&&r.turnKey===n)}function ba(e,t,n,r){return!e.preview||e.role!=="assistant"||!n||e.turnKey!==n||ht(r)||ht(e.bridgeKind)?!1:!!(t&&(e.content===t||!e.bridgeKind||e.bridgeKind==="assistant"))}function ka(e,t){let n=!1;const r=e.map(i=>!i.preview||t&&i.turnKey!==t?i:(n=!0,{...i,preview:!1,previewPlainText:!1}));return n?r:e}function ya(e,t){if(!t)return e;const n=e.filter(a=>a.turnKey===t&&!a.preview);if(n.length===0)return e;const r=[...n].reverse().find(a=>!ht(a.bridgeKind)),i=r==null?void 0:r.id;return e.map(a=>a.turnKey!==t||a.preview?a:{...a,kind:i&&a.id===i?"final":"progress"})}function Vr(e){if(!e)return"";const t=e.match(/\[User Message\]\s*([\s\S]*?)\s*\[\/User Message\]/);return t?t[1]||"":e}function wa(e){return e.map((t,n)=>({id:t.id||`${n}-${t.timestamp||t.role}`,role:t.role==="user"?"user":t.role==="system"?"system":"assistant",content:t.role==="user"?Vr(t.content):t.content,toolCall:t.toolCall,bridgeKind:t.bridgeKind,bridgeStatus:t.bridgeStatus,kind:t.kind==="progress"||t.kind==="system"?"progress":"final",order:n,timestamp:t.timestamp}))}function qr(e){return{id:e.id,project:e.workspaceId,name:e.title,live:e.live,createdAt:e.createdAt,updatedAt:e.updatedAt,excerpt:Vr(e.excerpt),agentType:e.agentType,agentMode:e.agentMode,bridgeSessionKey:e.bridgeSessionKey}}function Wr(e){return[...e].sort((t,n)=>t.live!==n.live?t.live?-1:1:(n.updatedAt||n.createdAt||"").localeCompare(t.updatedAt||t.createdAt||""))}function Sa(e,t){return t?[e.name,e.excerpt,e.bridgeSessionKey||""].join(" ").toLowerCase().includes(t):!0}function Vn(e){return[...e].sort((t,n)=>{if(t.order!==n.order)return t.order-n.order;const r=t.timestamp?new Date(t.timestamp).getTime():Number.NaN,i=n.timestamp?new Date(n.timestamp).getTime():Number.NaN,a=Number.isFinite(r),l=Number.isFinite(i);return a&&l&&r!==i?r-i:t.id.localeCompare(n.id)})}function qn(e){if(!e)return"";const t=new Date(e);return Number.isNaN(t.getTime())?"":new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(t)}function Ca(e){switch(e){case"starting":return"启动中";case"api_ready":return"服务就绪";case"error":return"运行异常";default:return"未启动"}}function va(e){if(!(e!=null&&e.startsWith("desktop:")))return"";const[,t=""]=e.split(":");return t}function Ea(e){return Array.isArray(e)?e.map(t=>Array.isArray(t)?t.map(n=>vl(n)).filter(n=>!!n):[]).filter(t=>t.length>0):[]}function Yr(e,t,n){const r=e.filter(i=>i.project!==t);return r.push({project:t,sessions:n}),r.sort((i,a)=>i.project.localeCompare(a.project))}function Ia(e,t,n){var a;const r=((a=e.find(l=>l.project===t))==null?void 0:a.sessions)||[],i=Wr([n,...r.filter(l=>l.id!==n.id)]);return Yr(e,t,i)}function ja(e){return e.some(t=>t.some(n=>El(n)))}function Aa(e,t){return e==="stopping"?"Stopping current task…":e==="error"?"":e==="awaiting_input"?"Agent is waiting for your reply.":e==="permission_submitted"?"Permission sent. Waiting for the agent to continue…":e==="awaiting_permission"?"Waiting for your permission response.":t?"Agent is typing…":e==="running"?"Task is running…":""}function Na(e){return e==="running"||e==="awaiting_permission"||e==="permission_submitted"||e==="stopping"}function _a(e){return e!=="idle"&&e!=="awaiting_input"&&e!=="error"}function Ta(e){return e!=="awaiting_input"&&e!=="awaiting_permission"&&e!=="permission_submitted"&&e!=="stopping"}const za="Permission sent. Waiting for the agent to continue…";function Pa(e){return!(e.actionMode==="permission"&&e.actionInteractive)}function La(e,t){return(t==null?void 0:t.id)===e.id?!0:e.role!=="user"&&e.actionMode==="permission"&&!!e.actionInteractive}function Da(e){var n;if(!e.id||e.role!=="assistant"||e.actionMode!=="permission"||!e.content)return null;const t=((n=e.actions)==null?void 0:n.filter(r=>r.length>0))||[];return t.length===0?null:{id:e.id,content:e.content,actions:t,actionReplyCtx:e.actionReplyCtx,actionPending:e.actionPending,actionStatus:e.actionStatus,actionMode:"permission",actionInteractive:!0}}function Fa(e){return{...e,actions:[],actionPending:!1,actionStatus:za}}function Ma(e,t){return e.role==="system"?!1:La({id:e.id,role:e.role,actionMode:e.actionMode,actionInteractive:e.actionInteractive},t)}function Ra(e){var n;if(!e)return null;const t=e.status.trim()||"running";return{title:e.name.trim()||"Tool call",status:t,output:e.output||"",label:e.label||(/^running$/i.test(t)?"工具调用":"工具结果"),subtitle:((n=e.detail)==null?void 0:n.trim())||Oa(e.input)}}function Oa(e){if(!e||typeof e!="object")return typeof e=="string"&&e.trim()?e.trim():void 0;const t=e;for(const r of["command","cmd","path","file","query"]){const i=t[r];if(typeof i=="string"&&i.trim())return i.trim()}const n=Object.entries(t).filter(([,r])=>r!=null&&r!=="").slice(0,2).map(([r,i])=>`${r}: ${typeof i=="string"?i:JSON.stringify(i)}`);return n.length>0?n.join(", "):void 0}function Ba(e){var t;return e.bridgeKind==="tool"&&((t=e.toolCall)==null?void 0:t.status.trim().toLowerCase())==="running"&&!e.toolCall.output.trim()}function $a(e){return e.label==="工具结果"&&!!e.output.trim()}function Ua(e){const t=e.split(`
58
+ `).map(l=>l.trim()).filter(Boolean),n=t.findIndex(l=>l.includes("若按钮没有显示")),r=n>=0?t.slice(0,n):t,i=r[0]||"等待工具确认",a=r.slice(1).filter(l=>!l.includes("请选择一个选项继续执行"));return{title:i,bodyLines:a}}function Xr(e,t){return e.map(n=>{const r=t.find(i=>i.id===n);return{id:n,name:(r==null?void 0:r.name)||n,fileCount:(r==null?void 0:r.fileCount)||0}})}function Ha(e,t){const n=t.trim().toLowerCase();return n?e.filter(r=>[r.name,r.description,r.id].join(" ").toLowerCase().includes(n)):e}function Ka(e,t){const n=new Set(t);return[...e].sort((r,i)=>{const a=n.has(r.id),l=n.has(i.id);return a!==l?a?-1:1:r.name.localeCompare(i.name,"zh-CN")})}function Va(e,t){return t?e.filter(n=>n.project===t):e}function qa(e,t){return t&&!e.includes(t)?[t,...e]:e}function Wa(e){return e.some(t=>t.sessions.length>0)}function Ya(e){return e?{id:e.id,content:e.content,actions:e.actions,actionReplyCtx:e.actionReplyCtx,actionPending:e.actionPending,actionStatus:e.actionStatus,actionMode:"permission",actionInteractive:!0}:null}function Xa(e,t){return e.kind==="progress"&&Ba(e)?!1:!Ma(e,t)}function Qa(e){return e.serviceRunning?e.transportReady?e.taskState==="awaiting_input"?"Agent 正在等待你的回复,可直接继续输入。":e.taskInputLocked?"任务正在运行,点击停止可中断当前执行。":e.sendPlaceholder:e.waitingRuntimePlaceholder:e.startFirstPlaceholder}function Ga(e){return!!(e.draft.trim()&&e.serviceRunning&&e.transportReady&&!e.sending&&e.selectedProject)}function Ja(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Za=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,eo=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,to={};function Wn(e,t){return(to.jsx?eo:Za).test(e)}const no=/[ \t\n\f\r]/g;function ro(e){return typeof e=="object"?e.type==="text"?Yn(e.value):!1:Yn(e)}function Yn(e){return e.replace(no,"")===""}class xt{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}xt.prototype.normal={};xt.prototype.property={};xt.prototype.space=void 0;function Qr(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new xt(n,r,t)}function an(e){return e.toLowerCase()}class be{constructor(t,n){this.attribute=n,this.property=t}}be.prototype.attribute="";be.prototype.booleanish=!1;be.prototype.boolean=!1;be.prototype.commaOrSpaceSeparated=!1;be.prototype.commaSeparated=!1;be.prototype.defined=!1;be.prototype.mustUseProperty=!1;be.prototype.number=!1;be.prototype.overloadedBoolean=!1;be.prototype.property="";be.prototype.spaceSeparated=!1;be.prototype.space=void 0;let io=0;const X=Xe(),oe=Xe(),on=Xe(),z=Xe(),le=Xe(),tt=Xe(),ye=Xe();function Xe(){return 2**++io}const sn=Object.freeze(Object.defineProperty({__proto__:null,boolean:X,booleanish:oe,commaOrSpaceSeparated:ye,commaSeparated:tt,number:z,overloadedBoolean:on,spaceSeparated:le},Symbol.toStringTag,{value:"Module"})),Ut=Object.keys(sn);class yn extends be{constructor(t,n,r,i){let a=-1;if(super(t,n),Xn(this,"space",i),typeof r=="number")for(;++a<Ut.length;){const l=Ut[a];Xn(this,Ut[a],(r&sn[l])===sn[l])}}}yn.prototype.defined=!0;function Xn(e,t,n){n&&(e[t]=n)}function rt(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const a=new yn(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[an(r)]=r,n[an(a.attribute)]=r}return new xt(t,n,e.space)}const Gr=rt({properties:{ariaActiveDescendant:null,ariaAtomic:oe,ariaAutoComplete:null,ariaBusy:oe,ariaChecked:oe,ariaColCount:z,ariaColIndex:z,ariaColSpan:z,ariaControls:le,ariaCurrent:null,ariaDescribedBy:le,ariaDetails:null,ariaDisabled:oe,ariaDropEffect:le,ariaErrorMessage:null,ariaExpanded:oe,ariaFlowTo:le,ariaGrabbed:oe,ariaHasPopup:null,ariaHidden:oe,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:le,ariaLevel:z,ariaLive:null,ariaModal:oe,ariaMultiLine:oe,ariaMultiSelectable:oe,ariaOrientation:null,ariaOwns:le,ariaPlaceholder:null,ariaPosInSet:z,ariaPressed:oe,ariaReadOnly:oe,ariaRelevant:null,ariaRequired:oe,ariaRoleDescription:le,ariaRowCount:z,ariaRowIndex:z,ariaRowSpan:z,ariaSelected:oe,ariaSetSize:z,ariaSort:null,ariaValueMax:z,ariaValueMin:z,ariaValueNow:z,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Jr(e,t){return t in e?e[t]:t}function Zr(e,t){return Jr(e,t.toLowerCase())}const lo=rt({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:tt,acceptCharset:le,accessKey:le,action:null,allow:null,allowFullScreen:X,allowPaymentRequest:X,allowUserMedia:X,alt:null,as:null,async:X,autoCapitalize:null,autoComplete:le,autoFocus:X,autoPlay:X,blocking:le,capture:null,charSet:null,checked:X,cite:null,className:le,cols:z,colSpan:null,content:null,contentEditable:oe,controls:X,controlsList:le,coords:z|tt,crossOrigin:null,data:null,dateTime:null,decoding:null,default:X,defer:X,dir:null,dirName:null,disabled:X,download:on,draggable:oe,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:X,formTarget:null,headers:le,height:z,hidden:on,high:z,href:null,hrefLang:null,htmlFor:le,httpEquiv:le,id:null,imageSizes:null,imageSrcSet:null,inert:X,inputMode:null,integrity:null,is:null,isMap:X,itemId:null,itemProp:le,itemRef:le,itemScope:X,itemType:le,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:X,low:z,manifest:null,max:null,maxLength:z,media:null,method:null,min:null,minLength:z,multiple:X,muted:X,name:null,nonce:null,noModule:X,noValidate:X,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:X,optimum:z,pattern:null,ping:le,placeholder:null,playsInline:X,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:X,referrerPolicy:null,rel:le,required:X,reversed:X,rows:z,rowSpan:z,sandbox:le,scope:null,scoped:X,seamless:X,selected:X,shadowRootClonable:X,shadowRootDelegatesFocus:X,shadowRootMode:null,shape:null,size:z,sizes:null,slot:null,span:z,spellCheck:oe,src:null,srcDoc:null,srcLang:null,srcSet:null,start:z,step:null,style:null,tabIndex:z,target:null,title:null,translate:null,type:null,typeMustMatch:X,useMap:null,value:oe,width:z,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:le,axis:null,background:null,bgColor:null,border:z,borderColor:null,bottomMargin:z,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:X,declare:X,event:null,face:null,frame:null,frameBorder:null,hSpace:z,leftMargin:z,link:null,longDesc:null,lowSrc:null,marginHeight:z,marginWidth:z,noResize:X,noHref:X,noShade:X,noWrap:X,object:null,profile:null,prompt:null,rev:null,rightMargin:z,rules:null,scheme:null,scrolling:oe,standby:null,summary:null,text:null,topMargin:z,valueType:null,version:null,vAlign:null,vLink:null,vSpace:z,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:X,disableRemotePlayback:X,prefix:null,property:null,results:z,security:null,unselectable:null},space:"html",transform:Zr}),ao=rt({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:ye,accentHeight:z,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:z,amplitude:z,arabicForm:null,ascent:z,attributeName:null,attributeType:null,azimuth:z,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:z,by:null,calcMode:null,capHeight:z,className:le,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:z,diffuseConstant:z,direction:null,display:null,dur:null,divisor:z,dominantBaseline:null,download:X,dx:null,dy:null,edgeMode:null,editable:null,elevation:z,enableBackground:null,end:null,event:null,exponent:z,externalResourcesRequired:null,fill:null,fillOpacity:z,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:tt,g2:tt,glyphName:tt,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:z,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:z,horizOriginX:z,horizOriginY:z,id:null,ideographic:z,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:z,k:z,k1:z,k2:z,k3:z,k4:z,kernelMatrix:ye,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:z,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:z,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:z,overlineThickness:z,paintOrder:null,panose1:null,path:null,pathLength:z,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:le,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:z,pointsAtY:z,pointsAtZ:z,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ye,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ye,rev:ye,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ye,requiredFeatures:ye,requiredFonts:ye,requiredFormats:ye,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:z,specularExponent:z,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:z,strikethroughThickness:z,string:null,stroke:null,strokeDashArray:ye,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:z,strokeOpacity:z,strokeWidth:null,style:null,surfaceScale:z,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ye,tabIndex:z,tableValues:null,target:null,targetX:z,targetY:z,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ye,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:z,underlineThickness:z,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:z,values:null,vAlphabetic:z,vMathematical:z,vectorEffect:null,vHanging:z,vIdeographic:z,version:null,vertAdvY:z,vertOriginX:z,vertOriginY:z,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:z,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Jr}),ei=rt({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),ti=rt({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Zr}),ni=rt({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),oo={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},so=/[A-Z]/g,Qn=/-[a-z]/g,uo=/^data[-\w.:]+$/i;function co(e,t){const n=an(t);let r=t,i=be;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&uo.test(t)){if(t.charAt(4)==="-"){const a=t.slice(5).replace(Qn,po);r="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{const a=t.slice(4);if(!Qn.test(a)){let l=a.replace(so,fo);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}i=yn}return new i(r,t)}function fo(e){return"-"+e.toLowerCase()}function po(e){return e.charAt(1).toUpperCase()}const ho=Qr([Gr,lo,ei,ti,ni],"html"),wn=Qr([Gr,ao,ei,ti,ni],"svg");function mo(e){return e.join(" ").trim()}var Je={},Ht,Gn;function go(){if(Gn)return Ht;Gn=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,a=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,o=/^\s+|\s+$/g,s=`
59
+ `,u="/",f="*",c="",p="comment",d="declaration";function x(C,b){if(typeof C!="string")throw new TypeError("First argument must be a string");if(!C)return[];b=b||{};var E=1,v=1;function O(F){var _=F.match(t);_&&(E+=_.length);var L=F.lastIndexOf(s);v=~L?F.length-L:v+F.length}function N(){var F={line:E,column:v};return function(_){return _.position=new y(F),B(),_}}function y(F){this.start=F,this.end={line:E,column:v},this.source=b.source}y.prototype.content=C;function k(F){var _=new Error(b.source+":"+E+":"+v+": "+F);if(_.reason=F,_.filename=b.source,_.line=E,_.column=v,_.source=C,!b.silent)throw _}function R(F){var _=F.exec(C);if(_){var L=_[0];return O(L),C=C.slice(L.length),_}}function B(){R(n)}function w(F){var _;for(F=F||[];_=j();)_!==!1&&F.push(_);return F}function j(){var F=N();if(!(u!=C.charAt(0)||f!=C.charAt(1))){for(var _=2;c!=C.charAt(_)&&(f!=C.charAt(_)||u!=C.charAt(_+1));)++_;if(_+=2,c===C.charAt(_-1))return k("End of comment missing");var L=C.slice(2,_-2);return v+=2,O(L),C=C.slice(_),v+=2,F({type:p,comment:L})}}function A(){var F=N(),_=R(r);if(_){if(j(),!R(i))return k("property missing ':'");var L=R(a),M=F({type:d,property:S(_[0].replace(e,c)),value:L?S(L[0].replace(e,c)):c});return R(l),M}}function $(){var F=[];w(F);for(var _;_=A();)_!==!1&&(F.push(_),w(F));return F}return B(),$()}function S(C){return C?C.replace(o,c):c}return Ht=x,Ht}var Jn;function xo(){if(Jn)return Je;Jn=1;var e=Je&&Je.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Je,"__esModule",{value:!0}),Je.default=n;const t=e(go());function n(r,i){let a=null;if(!r||typeof r!="string")return a;const l=(0,t.default)(r),o=typeof i=="function";return l.forEach(s=>{if(s.type!=="declaration")return;const{property:u,value:f}=s;o?i(u,f,s):f&&(a=a||{},a[u]=f)}),a}return Je}var ot={},Zn;function bo(){if(Zn)return ot;Zn=1,Object.defineProperty(ot,"__esModule",{value:!0}),ot.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,a=function(u){return!u||n.test(u)||e.test(u)},l=function(u,f){return f.toUpperCase()},o=function(u,f){return"".concat(f,"-")},s=function(u,f){return f===void 0&&(f={}),a(u)?u:(u=u.toLowerCase(),f.reactCompat?u=u.replace(i,o):u=u.replace(r,o),u.replace(t,l))};return ot.camelCase=s,ot}var st,er;function ko(){if(er)return st;er=1;var e=st&&st.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(xo()),n=bo();function r(i,a){var l={};return!i||typeof i!="string"||(0,t.default)(i,function(o,s){o&&s&&(l[(0,n.camelCase)(o,a)]=s)}),l}return r.default=r,st=r,st}var yo=ko();const wo=Or(yo),ri=ii("end"),Sn=ii("start");function ii(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function So(e){const t=Sn(e),n=ri(e);if(t&&n)return{start:t,end:n}}function ft(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?tr(e.position):"start"in e||"end"in e?tr(e):"line"in e||"column"in e?un(e):""}function un(e){return nr(e&&e.line)+":"+nr(e&&e.column)}function tr(e){return un(e&&e.start)+"-"+un(e&&e.end)}function nr(e){return e&&typeof e=="number"?e:1}class de extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",a={},l=!1;if(n&&("line"in n&&"column"in n?a={place:n}:"start"in n&&"end"in n?a={place:n}:"type"in n?a={ancestors:[n],place:n.position}:a={...n}),typeof t=="string"?i=t:!a.cause&&t&&(l=!0,i=t.message,a.cause=t),!a.ruleId&&!a.source&&typeof r=="string"){const s=r.indexOf(":");s===-1?a.ruleId=r:(a.source=r.slice(0,s),a.ruleId=r.slice(s+1))}if(!a.place&&a.ancestors&&a.ancestors){const s=a.ancestors[a.ancestors.length-1];s&&(a.place=s.position)}const o=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=o?o.line:void 0,this.name=ft(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=l&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}de.prototype.file="";de.prototype.name="";de.prototype.reason="";de.prototype.message="";de.prototype.stack="";de.prototype.column=void 0;de.prototype.line=void 0;de.prototype.ancestors=void 0;de.prototype.cause=void 0;de.prototype.fatal=void 0;de.prototype.place=void 0;de.prototype.ruleId=void 0;de.prototype.source=void 0;const Cn={}.hasOwnProperty,Co=new Map,vo=/[A-Z]/g,Eo=new Set(["table","tbody","thead","tfoot","tr"]),Io=new Set(["td","th"]),li="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function jo(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=Do(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=Lo(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?wn:ho,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=ai(i,e,void 0);return a&&typeof a!="string"?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function ai(e,t,n){if(t.type==="element")return Ao(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return No(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return To(e,t,n);if(t.type==="mdxjsEsm")return _o(e,t);if(t.type==="root")return zo(e,t,n);if(t.type==="text")return Po(e,t)}function Ao(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=wn,e.schema=i),e.ancestors.push(t);const a=si(e,t.tagName,!1),l=Fo(e,t);let o=En(e,t);return Eo.has(t.tagName)&&(o=o.filter(function(s){return typeof s=="string"?!ro(s):!0})),oi(e,l,a,t),vn(l,o),e.ancestors.pop(),e.schema=r,e.create(t,a,l,n)}function No(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}mt(e,t.position)}function _o(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);mt(e,t.position)}function To(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=wn,e.schema=i),e.ancestors.push(t);const a=t.name===null?e.Fragment:si(e,t.name,!0),l=Mo(e,t),o=En(e,t);return oi(e,l,a,t),vn(l,o),e.ancestors.pop(),e.schema=r,e.create(t,a,l,n)}function zo(e,t,n){const r={};return vn(r,En(e,t)),e.create(t,e.Fragment,r,n)}function Po(e,t){return t.value}function oi(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function vn(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function Lo(e,t,n){return r;function r(i,a,l,o){const u=Array.isArray(l.children)?n:t;return o?u(a,l,o):u(a,l)}}function Do(e,t){return n;function n(r,i,a,l){const o=Array.isArray(a.children),s=Sn(r);return t(i,a,l,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function Fo(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&Cn.call(t.properties,i)){const a=Ro(e,i,t.properties[i]);if(a){const[l,o]=a;e.tableCellAlignToStyle&&l==="align"&&typeof o=="string"&&Io.has(t.tagName)?r=o:n[l]=o}}if(r){const a=n.style||(n.style={});a[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function Mo(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const a=r.data.estree.body[0];a.type;const l=a.expression;l.type;const o=l.properties[0];o.type,Object.assign(n,e.evaluater.evaluateExpression(o.argument))}else mt(e,t.position);else{const i=r.name;let a;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const o=r.value.data.estree.body[0];o.type,a=e.evaluater.evaluateExpression(o.expression)}else mt(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function En(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:Co;for(;++r<t.children.length;){const a=t.children[r];let l;if(e.passKeys){const s=a.type==="element"?a.tagName:a.type==="mdxJsxFlowElement"||a.type==="mdxJsxTextElement"?a.name:void 0;if(s){const u=i.get(s)||0;l=s+"-"+u,i.set(s,u+1)}}const o=ai(e,a,l);o!==void 0&&n.push(o)}return n}function Ro(e,t,n){const r=co(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Ja(n):mo(n)),r.property==="style"){let i=typeof n=="object"?n:Oo(e,String(n));return e.stylePropertyNameCase==="css"&&(i=Bo(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?oo[r.property]||r.property:r.attribute,n]}}function Oo(e,t){try{return wo(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new de("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=li+"#cannot-parse-style-attribute",i}}function si(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let a=-1,l;for(;++a<i.length;){const o=Wn(i[a])?{type:"Identifier",name:i[a]}:{type:"Literal",value:i[a]};l=l?{type:"MemberExpression",object:l,property:o,computed:!!(a&&o.type==="Literal"),optional:!1}:o}r=l}else r=Wn(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return Cn.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);mt(e)}function mt(e,t){const n=new de("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=li+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Bo(e){const t={};let n;for(n in e)Cn.call(e,n)&&(t[$o(n)]=e[n]);return t}function $o(e){let t=e.replace(vo,Uo);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function Uo(e){return"-"+e.toLowerCase()}const Kt={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},Ho={};function In(e,t){const n=Ho,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return ui(e,r,i)}function ui(e,t,n){if(Ko(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return rr(e.children,t,n)}return Array.isArray(e)?rr(e,t,n):""}function rr(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=ui(e[i],t,n);return r.join("")}function Ko(e){return!!(e&&typeof e=="object")}const ir=document.createElement("i");function jn(e){const t="&"+e+";";ir.innerHTML=t;const n=ir.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function we(e,t,n,r){const i=e.length;let a=0,l;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)l=Array.from(r),l.unshift(t,n),e.splice(...l);else for(n&&e.splice(t,n);a<r.length;)l=r.slice(a,a+1e4),l.unshift(t,0),e.splice(...l),a+=1e4,t+=1e4}function Se(e,t){return e.length>0?(we(e,e.length,0,t),e):t}const lr={}.hasOwnProperty;function ci(e){const t={};let n=-1;for(;++n<e.length;)Vo(t,e[n]);return t}function Vo(e,t){let n;for(n in t){const i=(lr.call(e,n)?e[n]:void 0)||(e[n]={}),a=t[n];let l;if(a)for(l in a){lr.call(i,l)||(i[l]=[]);const o=a[l];qo(i[l],Array.isArray(o)?o:o?[o]:[])}}}function qo(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);we(e,0,0,r)}function fi(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function ve(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const he=Ue(/[A-Za-z]/),fe=Ue(/[\dA-Za-z]/),Wo=Ue(/[#-'*+\--9=?A-Z^-~]/);function Tt(e){return e!==null&&(e<32||e===127)}const cn=Ue(/\d/),Yo=Ue(/[\dA-Fa-f]/),Xo=Ue(/[!-/:-@[-`{-~]/);function q(e){return e!==null&&e<-2}function ie(e){return e!==null&&(e<0||e===32)}function J(e){return e===-2||e===-1||e===32}const Dt=Ue(new RegExp("\\p{P}|\\p{S}","u")),Ye=Ue(/\s/);function Ue(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function it(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const a=e.charCodeAt(n);let l="";if(a===37&&fe(e.charCodeAt(n+1))&&fe(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(l=String.fromCharCode(a));else if(a>55295&&a<57344){const o=e.charCodeAt(n+1);a<56320&&o>56319&&o<57344?(l=String.fromCharCode(a,o),i=1):l="�"}else l=String.fromCharCode(a);l&&(t.push(e.slice(r,n),encodeURIComponent(l)),r=n+i+1,l=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function te(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let a=0;return l;function l(s){return J(s)?(e.enter(n),o(s)):t(s)}function o(s){return J(s)&&a++<i?(e.consume(s),o):(e.exit(n),t(s))}}const Qo={tokenize:Go};function Go(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),te(e,t,"linePrefix")}function i(o){return e.enter("paragraph"),a(o)}function a(o){const s=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=s),n=s,l(o)}function l(o){if(o===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(o);return}return q(o)?(e.consume(o),e.exit("chunkText"),a):(e.consume(o),l)}}const Jo={tokenize:Zo},ar={tokenize:es};function Zo(e){const t=this,n=[];let r=0,i,a,l;return o;function o(v){if(r<n.length){const O=n[r];return t.containerState=O[1],e.attempt(O[0].continuation,s,u)(v)}return u(v)}function s(v){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&E();const O=t.events.length;let N=O,y;for(;N--;)if(t.events[N][0]==="exit"&&t.events[N][1].type==="chunkFlow"){y=t.events[N][1].end;break}b(r);let k=O;for(;k<t.events.length;)t.events[k][1].end={...y},k++;return we(t.events,N+1,0,t.events.slice(O)),t.events.length=k,u(v)}return o(v)}function u(v){if(r===n.length){if(!i)return p(v);if(i.currentConstruct&&i.currentConstruct.concrete)return x(v);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(ar,f,c)(v)}function f(v){return i&&E(),b(r),p(v)}function c(v){return t.parser.lazy[t.now().line]=r!==n.length,l=t.now().offset,x(v)}function p(v){return t.containerState={},e.attempt(ar,d,x)(v)}function d(v){return r++,n.push([t.currentConstruct,t.containerState]),p(v)}function x(v){if(v===null){i&&E(),b(0),e.consume(v);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:a}),S(v)}function S(v){if(v===null){C(e.exit("chunkFlow"),!0),b(0),e.consume(v);return}return q(v)?(e.consume(v),C(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(v),S)}function C(v,O){const N=t.sliceStream(v);if(O&&N.push(null),v.previous=a,a&&(a.next=v),a=v,i.defineSkip(v.start),i.write(N),t.parser.lazy[v.start.line]){let y=i.events.length;for(;y--;)if(i.events[y][1].start.offset<l&&(!i.events[y][1].end||i.events[y][1].end.offset>l))return;const k=t.events.length;let R=k,B,w;for(;R--;)if(t.events[R][0]==="exit"&&t.events[R][1].type==="chunkFlow"){if(B){w=t.events[R][1].end;break}B=!0}for(b(r),y=k;y<t.events.length;)t.events[y][1].end={...w},y++;we(t.events,R+1,0,t.events.slice(k)),t.events.length=y}}function b(v){let O=n.length;for(;O-- >v;){const N=n[O];t.containerState=N[1],N[0].exit.call(t,e)}n.length=v}function E(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function es(e,t,n){return te(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function nt(e){if(e===null||ie(e)||Ye(e))return 1;if(Dt(e))return 2}function Ft(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}const fn={name:"attention",resolveAll:ts,tokenize:ns};function ts(e,t){let n=-1,r,i,a,l,o,s,u,f;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;s=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const c={...e[r][1].end},p={...e[n][1].start};or(c,-s),or(p,s),l={type:s>1?"strongSequence":"emphasisSequence",start:c,end:{...e[r][1].end}},o={type:s>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:p},a={type:s>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:s>1?"strong":"emphasis",start:{...l.start},end:{...o.end}},e[r][1].end={...l.start},e[n][1].start={...o.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=Se(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=Se(u,[["enter",i,t],["enter",l,t],["exit",l,t],["enter",a,t]]),u=Se(u,Ft(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=Se(u,[["exit",a,t],["enter",o,t],["exit",o,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(f=2,u=Se(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):f=0,we(e,r-1,n-r+3,u),n=r+u.length-f-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function ns(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=nt(r);let a;return l;function l(s){return a=s,e.enter("attentionSequence"),o(s)}function o(s){if(s===a)return e.consume(s),o;const u=e.exit("attentionSequence"),f=nt(s),c=!f||f===2&&i||n.includes(s),p=!i||i===2&&f||n.includes(r);return u._open=!!(a===42?c:c&&(i||!p)),u._close=!!(a===42?p:p&&(f||!c)),t(s)}}function or(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const rs={name:"autolink",tokenize:is};function is(e,t,n){let r=0;return i;function i(d){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(d),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),a}function a(d){return he(d)?(e.consume(d),l):d===64?n(d):u(d)}function l(d){return d===43||d===45||d===46||fe(d)?(r=1,o(d)):u(d)}function o(d){return d===58?(e.consume(d),r=0,s):(d===43||d===45||d===46||fe(d))&&r++<32?(e.consume(d),o):(r=0,u(d))}function s(d){return d===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(d),e.exit("autolinkMarker"),e.exit("autolink"),t):d===null||d===32||d===60||Tt(d)?n(d):(e.consume(d),s)}function u(d){return d===64?(e.consume(d),f):Wo(d)?(e.consume(d),u):n(d)}function f(d){return fe(d)?c(d):n(d)}function c(d){return d===46?(e.consume(d),r=0,f):d===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(d),e.exit("autolinkMarker"),e.exit("autolink"),t):p(d)}function p(d){if((d===45||fe(d))&&r++<63){const x=d===45?p:c;return e.consume(d),x}return n(d)}}const bt={partial:!0,tokenize:ls};function ls(e,t,n){return r;function r(a){return J(a)?te(e,i,"linePrefix")(a):i(a)}function i(a){return a===null||q(a)?t(a):n(a)}}const di={continuation:{tokenize:os},exit:ss,name:"blockQuote",tokenize:as};function as(e,t,n){const r=this;return i;function i(l){if(l===62){const o=r.containerState;return o.open||(e.enter("blockQuote",{_container:!0}),o.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(l),e.exit("blockQuoteMarker"),a}return n(l)}function a(l){return J(l)?(e.enter("blockQuotePrefixWhitespace"),e.consume(l),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(l))}}function os(e,t,n){const r=this;return i;function i(l){return J(l)?te(e,a,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):a(l)}function a(l){return e.attempt(di,t,n)(l)}}function ss(e){e.exit("blockQuote")}const pi={name:"characterEscape",tokenize:us};function us(e,t,n){return r;function r(a){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(a),e.exit("escapeMarker"),i}function i(a){return Xo(a)?(e.enter("characterEscapeValue"),e.consume(a),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(a)}}const hi={name:"characterReference",tokenize:cs};function cs(e,t,n){const r=this;let i=0,a,l;return o;function o(c){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(c),e.exit("characterReferenceMarker"),s}function s(c){return c===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(c),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),a=31,l=fe,f(c))}function u(c){return c===88||c===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(c),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),a=6,l=Yo,f):(e.enter("characterReferenceValue"),a=7,l=cn,f(c))}function f(c){if(c===59&&i){const p=e.exit("characterReferenceValue");return l===fe&&!jn(r.sliceSerialize(p))?n(c):(e.enter("characterReferenceMarker"),e.consume(c),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return l(c)&&i++<a?(e.consume(c),f):n(c)}}const sr={partial:!0,tokenize:ds},ur={concrete:!0,name:"codeFenced",tokenize:fs};function fs(e,t,n){const r=this,i={partial:!0,tokenize:N};let a=0,l=0,o;return s;function s(y){return u(y)}function u(y){const k=r.events[r.events.length-1];return a=k&&k[1].type==="linePrefix"?k[2].sliceSerialize(k[1],!0).length:0,o=y,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),f(y)}function f(y){return y===o?(l++,e.consume(y),f):l<3?n(y):(e.exit("codeFencedFenceSequence"),J(y)?te(e,c,"whitespace")(y):c(y))}function c(y){return y===null||q(y)?(e.exit("codeFencedFence"),r.interrupt?t(y):e.check(sr,S,O)(y)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(y))}function p(y){return y===null||q(y)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),c(y)):J(y)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),te(e,d,"whitespace")(y)):y===96&&y===o?n(y):(e.consume(y),p)}function d(y){return y===null||q(y)?c(y):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),x(y))}function x(y){return y===null||q(y)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),c(y)):y===96&&y===o?n(y):(e.consume(y),x)}function S(y){return e.attempt(i,O,C)(y)}function C(y){return e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),b}function b(y){return a>0&&J(y)?te(e,E,"linePrefix",a+1)(y):E(y)}function E(y){return y===null||q(y)?e.check(sr,S,O)(y):(e.enter("codeFlowValue"),v(y))}function v(y){return y===null||q(y)?(e.exit("codeFlowValue"),E(y)):(e.consume(y),v)}function O(y){return e.exit("codeFenced"),t(y)}function N(y,k,R){let B=0;return w;function w(_){return y.enter("lineEnding"),y.consume(_),y.exit("lineEnding"),j}function j(_){return y.enter("codeFencedFence"),J(_)?te(y,A,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(_):A(_)}function A(_){return _===o?(y.enter("codeFencedFenceSequence"),$(_)):R(_)}function $(_){return _===o?(B++,y.consume(_),$):B>=l?(y.exit("codeFencedFenceSequence"),J(_)?te(y,F,"whitespace")(_):F(_)):R(_)}function F(_){return _===null||q(_)?(y.exit("codeFencedFence"),k(_)):R(_)}}}function ds(e,t,n){const r=this;return i;function i(l){return l===null?n(l):(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),a)}function a(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}const Vt={name:"codeIndented",tokenize:hs},ps={partial:!0,tokenize:ms};function hs(e,t,n){const r=this;return i;function i(u){return e.enter("codeIndented"),te(e,a,"linePrefix",5)(u)}function a(u){const f=r.events[r.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?l(u):n(u)}function l(u){return u===null?s(u):q(u)?e.attempt(ps,l,s)(u):(e.enter("codeFlowValue"),o(u))}function o(u){return u===null||q(u)?(e.exit("codeFlowValue"),l(u)):(e.consume(u),o)}function s(u){return e.exit("codeIndented"),t(u)}}function ms(e,t,n){const r=this;return i;function i(l){return r.parser.lazy[r.now().line]?n(l):q(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),i):te(e,a,"linePrefix",5)(l)}function a(l){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(l):q(l)?i(l):n(l)}}const gs={name:"codeText",previous:bs,resolve:xs,tokenize:ks};function xs(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function bs(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function ks(e,t,n){let r=0,i,a;return l;function l(c){return e.enter("codeText"),e.enter("codeTextSequence"),o(c)}function o(c){return c===96?(e.consume(c),r++,o):(e.exit("codeTextSequence"),s(c))}function s(c){return c===null?n(c):c===32?(e.enter("space"),e.consume(c),e.exit("space"),s):c===96?(a=e.enter("codeTextSequence"),i=0,f(c)):q(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),s):(e.enter("codeTextData"),u(c))}function u(c){return c===null||c===32||c===96||q(c)?(e.exit("codeTextData"),s(c)):(e.consume(c),u)}function f(c){return c===96?(e.consume(c),i++,f):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(c)):(a.type="codeTextData",u(c))}}class ys{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const a=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&ut(this.left,r),a.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),ut(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),ut(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);ut(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);ut(this.left,n.reverse())}}}function ut(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function mi(e){const t={};let n=-1,r,i,a,l,o,s,u;const f=new ys(e);for(;++n<f.length;){for(;n in t;)n=t[n];if(r=f.get(n),n&&r[1].type==="chunkFlow"&&f.get(n-1)[1].type==="listItemPrefix"&&(s=r[1]._tokenizer.events,a=0,a<s.length&&s[a][1].type==="lineEndingBlank"&&(a+=2),a<s.length&&s[a][1].type==="content"))for(;++a<s.length&&s[a][1].type!=="content";)s[a][1].type==="chunkText"&&(s[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,ws(f,n)),n=t[n],u=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(l=f.get(a),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(i&&(f.get(i)[1].type="lineEndingBlank"),l[1].type="lineEnding",i=a);else if(!(l[1].type==="linePrefix"||l[1].type==="listItemIndent"))break;i&&(r[1].end={...f.get(i)[1].start},o=f.slice(i,n),o.unshift(r),f.splice(i,n-i+1,o))}}return we(e,0,Number.POSITIVE_INFINITY,f.slice(0)),!u}function ws(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const a=[];let l=n._tokenizer;l||(l=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));const o=l.events,s=[],u={};let f,c,p=-1,d=n,x=0,S=0;const C=[S];for(;d;){for(;e.get(++i)[1]!==d;);a.push(i),d._tokenizer||(f=r.sliceStream(d),d.next||f.push(null),c&&l.defineSkip(d.start),d._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(f),d._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),c=d,d=d.next}for(d=n;++p<o.length;)o[p][0]==="exit"&&o[p-1][0]==="enter"&&o[p][1].type===o[p-1][1].type&&o[p][1].start.line!==o[p][1].end.line&&(S=p+1,C.push(S),d._tokenizer=void 0,d.previous=void 0,d=d.next);for(l.events=[],d?(d._tokenizer=void 0,d.previous=void 0):C.pop(),p=C.length;p--;){const b=o.slice(C[p],C[p+1]),E=a.pop();s.push([E,E+b.length-1]),e.splice(E,2,b)}for(s.reverse(),p=-1;++p<s.length;)u[x+s[p][0]]=x+s[p][1],x+=s[p][1]-s[p][0]-1;return u}const Ss={resolve:vs,tokenize:Es},Cs={partial:!0,tokenize:Is};function vs(e){return mi(e),e}function Es(e,t){let n;return r;function r(o){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(o)}function i(o){return o===null?a(o):q(o)?e.check(Cs,l,a)(o):(e.consume(o),i)}function a(o){return e.exit("chunkContent"),e.exit("content"),t(o)}function l(o){return e.consume(o),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function Is(e,t,n){const r=this;return i;function i(l){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),te(e,a,"linePrefix")}function a(l){if(l===null||q(l))return n(l);const o=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(l):e.interrupt(r.parser.constructs.flow,n,t)(l)}}function gi(e,t,n,r,i,a,l,o,s){const u=s||Number.POSITIVE_INFINITY;let f=0;return c;function c(b){return b===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(b),e.exit(a),p):b===null||b===32||b===41||Tt(b)?n(b):(e.enter(r),e.enter(l),e.enter(o),e.enter("chunkString",{contentType:"string"}),S(b))}function p(b){return b===62?(e.enter(a),e.consume(b),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),d(b))}function d(b){return b===62?(e.exit("chunkString"),e.exit(o),p(b)):b===null||b===60||q(b)?n(b):(e.consume(b),b===92?x:d)}function x(b){return b===60||b===62||b===92?(e.consume(b),d):d(b)}function S(b){return!f&&(b===null||b===41||ie(b))?(e.exit("chunkString"),e.exit(o),e.exit(l),e.exit(r),t(b)):f<u&&b===40?(e.consume(b),f++,S):b===41?(e.consume(b),f--,S):b===null||b===32||b===40||Tt(b)?n(b):(e.consume(b),b===92?C:S)}function C(b){return b===40||b===41||b===92?(e.consume(b),S):S(b)}}function xi(e,t,n,r,i,a){const l=this;let o=0,s;return u;function u(d){return e.enter(r),e.enter(i),e.consume(d),e.exit(i),e.enter(a),f}function f(d){return o>999||d===null||d===91||d===93&&!s||d===94&&!o&&"_hiddenFootnoteSupport"in l.parser.constructs?n(d):d===93?(e.exit(a),e.enter(i),e.consume(d),e.exit(i),e.exit(r),t):q(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),f):(e.enter("chunkString",{contentType:"string"}),c(d))}function c(d){return d===null||d===91||d===93||q(d)||o++>999?(e.exit("chunkString"),f(d)):(e.consume(d),s||(s=!J(d)),d===92?p:c)}function p(d){return d===91||d===92||d===93?(e.consume(d),o++,c):c(d)}}function bi(e,t,n,r,i,a){let l;return o;function o(p){return p===34||p===39||p===40?(e.enter(r),e.enter(i),e.consume(p),e.exit(i),l=p===40?41:p,s):n(p)}function s(p){return p===l?(e.enter(i),e.consume(p),e.exit(i),e.exit(r),t):(e.enter(a),u(p))}function u(p){return p===l?(e.exit(a),s(l)):p===null?n(p):q(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),te(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===l||p===null||q(p)?(e.exit("chunkString"),u(p)):(e.consume(p),p===92?c:f)}function c(p){return p===l||p===92?(e.consume(p),f):f(p)}}function dt(e,t){let n;return r;function r(i){return q(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):J(i)?te(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const js={name:"definition",tokenize:Ns},As={partial:!0,tokenize:_s};function Ns(e,t,n){const r=this;let i;return a;function a(d){return e.enter("definition"),l(d)}function l(d){return xi.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(d)}function o(d){return i=ve(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),d===58?(e.enter("definitionMarker"),e.consume(d),e.exit("definitionMarker"),s):n(d)}function s(d){return ie(d)?dt(e,u)(d):u(d)}function u(d){return gi(e,f,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(d)}function f(d){return e.attempt(As,c,c)(d)}function c(d){return J(d)?te(e,p,"whitespace")(d):p(d)}function p(d){return d===null||q(d)?(e.exit("definition"),r.parser.defined.push(i),t(d)):n(d)}}function _s(e,t,n){return r;function r(o){return ie(o)?dt(e,i)(o):n(o)}function i(o){return bi(e,a,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function a(o){return J(o)?te(e,l,"whitespace")(o):l(o)}function l(o){return o===null||q(o)?t(o):n(o)}}const Ts={name:"hardBreakEscape",tokenize:zs};function zs(e,t,n){return r;function r(a){return e.enter("hardBreakEscape"),e.consume(a),i}function i(a){return q(a)?(e.exit("hardBreakEscape"),t(a)):n(a)}}const Ps={name:"headingAtx",resolve:Ls,tokenize:Ds};function Ls(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},a={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},we(e,r,n-r+1,[["enter",i,t],["enter",a,t],["exit",a,t],["exit",i,t]])),e}function Ds(e,t,n){let r=0;return i;function i(f){return e.enter("atxHeading"),a(f)}function a(f){return e.enter("atxHeadingSequence"),l(f)}function l(f){return f===35&&r++<6?(e.consume(f),l):f===null||ie(f)?(e.exit("atxHeadingSequence"),o(f)):n(f)}function o(f){return f===35?(e.enter("atxHeadingSequence"),s(f)):f===null||q(f)?(e.exit("atxHeading"),t(f)):J(f)?te(e,o,"whitespace")(f):(e.enter("atxHeadingText"),u(f))}function s(f){return f===35?(e.consume(f),s):(e.exit("atxHeadingSequence"),o(f))}function u(f){return f===null||f===35||ie(f)?(e.exit("atxHeadingText"),o(f)):(e.consume(f),u)}}const Fs=["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","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],cr=["pre","script","style","textarea"],Ms={concrete:!0,name:"htmlFlow",resolveTo:Bs,tokenize:$s},Rs={partial:!0,tokenize:Hs},Os={partial:!0,tokenize:Us};function Bs(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function $s(e,t,n){const r=this;let i,a,l,o,s;return u;function u(m){return f(m)}function f(m){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(m),c}function c(m){return m===33?(e.consume(m),p):m===47?(e.consume(m),a=!0,S):m===63?(e.consume(m),i=3,r.interrupt?t:h):he(m)?(e.consume(m),l=String.fromCharCode(m),C):n(m)}function p(m){return m===45?(e.consume(m),i=2,d):m===91?(e.consume(m),i=5,o=0,x):he(m)?(e.consume(m),i=4,r.interrupt?t:h):n(m)}function d(m){return m===45?(e.consume(m),r.interrupt?t:h):n(m)}function x(m){const Y="CDATA[";return m===Y.charCodeAt(o++)?(e.consume(m),o===Y.length?r.interrupt?t:A:x):n(m)}function S(m){return he(m)?(e.consume(m),l=String.fromCharCode(m),C):n(m)}function C(m){if(m===null||m===47||m===62||ie(m)){const Y=m===47,Z=l.toLowerCase();return!Y&&!a&&cr.includes(Z)?(i=1,r.interrupt?t(m):A(m)):Fs.includes(l.toLowerCase())?(i=6,Y?(e.consume(m),b):r.interrupt?t(m):A(m)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(m):a?E(m):v(m))}return m===45||fe(m)?(e.consume(m),l+=String.fromCharCode(m),C):n(m)}function b(m){return m===62?(e.consume(m),r.interrupt?t:A):n(m)}function E(m){return J(m)?(e.consume(m),E):w(m)}function v(m){return m===47?(e.consume(m),w):m===58||m===95||he(m)?(e.consume(m),O):J(m)?(e.consume(m),v):w(m)}function O(m){return m===45||m===46||m===58||m===95||fe(m)?(e.consume(m),O):N(m)}function N(m){return m===61?(e.consume(m),y):J(m)?(e.consume(m),N):v(m)}function y(m){return m===null||m===60||m===61||m===62||m===96?n(m):m===34||m===39?(e.consume(m),s=m,k):J(m)?(e.consume(m),y):R(m)}function k(m){return m===s?(e.consume(m),s=null,B):m===null||q(m)?n(m):(e.consume(m),k)}function R(m){return m===null||m===34||m===39||m===47||m===60||m===61||m===62||m===96||ie(m)?N(m):(e.consume(m),R)}function B(m){return m===47||m===62||J(m)?v(m):n(m)}function w(m){return m===62?(e.consume(m),j):n(m)}function j(m){return m===null||q(m)?A(m):J(m)?(e.consume(m),j):n(m)}function A(m){return m===45&&i===2?(e.consume(m),L):m===60&&i===1?(e.consume(m),M):m===62&&i===4?(e.consume(m),U):m===63&&i===3?(e.consume(m),h):m===93&&i===5?(e.consume(m),P):q(m)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(Rs,K,$)(m)):m===null||q(m)?(e.exit("htmlFlowData"),$(m)):(e.consume(m),A)}function $(m){return e.check(Os,F,K)(m)}function F(m){return e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),_}function _(m){return m===null||q(m)?$(m):(e.enter("htmlFlowData"),A(m))}function L(m){return m===45?(e.consume(m),h):A(m)}function M(m){return m===47?(e.consume(m),l="",H):A(m)}function H(m){if(m===62){const Y=l.toLowerCase();return cr.includes(Y)?(e.consume(m),U):A(m)}return he(m)&&l.length<8?(e.consume(m),l+=String.fromCharCode(m),H):A(m)}function P(m){return m===93?(e.consume(m),h):A(m)}function h(m){return m===62?(e.consume(m),U):m===45&&i===2?(e.consume(m),h):A(m)}function U(m){return m===null||q(m)?(e.exit("htmlFlowData"),K(m)):(e.consume(m),U)}function K(m){return e.exit("htmlFlow"),t(m)}}function Us(e,t,n){const r=this;return i;function i(l){return q(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),a):n(l)}function a(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}function Hs(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(bt,t,n)}}const Ks={name:"htmlText",tokenize:Vs};function Vs(e,t,n){const r=this;let i,a,l;return o;function o(h){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(h),s}function s(h){return h===33?(e.consume(h),u):h===47?(e.consume(h),N):h===63?(e.consume(h),v):he(h)?(e.consume(h),R):n(h)}function u(h){return h===45?(e.consume(h),f):h===91?(e.consume(h),a=0,x):he(h)?(e.consume(h),E):n(h)}function f(h){return h===45?(e.consume(h),d):n(h)}function c(h){return h===null?n(h):h===45?(e.consume(h),p):q(h)?(l=c,M(h)):(e.consume(h),c)}function p(h){return h===45?(e.consume(h),d):c(h)}function d(h){return h===62?L(h):h===45?p(h):c(h)}function x(h){const U="CDATA[";return h===U.charCodeAt(a++)?(e.consume(h),a===U.length?S:x):n(h)}function S(h){return h===null?n(h):h===93?(e.consume(h),C):q(h)?(l=S,M(h)):(e.consume(h),S)}function C(h){return h===93?(e.consume(h),b):S(h)}function b(h){return h===62?L(h):h===93?(e.consume(h),b):S(h)}function E(h){return h===null||h===62?L(h):q(h)?(l=E,M(h)):(e.consume(h),E)}function v(h){return h===null?n(h):h===63?(e.consume(h),O):q(h)?(l=v,M(h)):(e.consume(h),v)}function O(h){return h===62?L(h):v(h)}function N(h){return he(h)?(e.consume(h),y):n(h)}function y(h){return h===45||fe(h)?(e.consume(h),y):k(h)}function k(h){return q(h)?(l=k,M(h)):J(h)?(e.consume(h),k):L(h)}function R(h){return h===45||fe(h)?(e.consume(h),R):h===47||h===62||ie(h)?B(h):n(h)}function B(h){return h===47?(e.consume(h),L):h===58||h===95||he(h)?(e.consume(h),w):q(h)?(l=B,M(h)):J(h)?(e.consume(h),B):L(h)}function w(h){return h===45||h===46||h===58||h===95||fe(h)?(e.consume(h),w):j(h)}function j(h){return h===61?(e.consume(h),A):q(h)?(l=j,M(h)):J(h)?(e.consume(h),j):B(h)}function A(h){return h===null||h===60||h===61||h===62||h===96?n(h):h===34||h===39?(e.consume(h),i=h,$):q(h)?(l=A,M(h)):J(h)?(e.consume(h),A):(e.consume(h),F)}function $(h){return h===i?(e.consume(h),i=void 0,_):h===null?n(h):q(h)?(l=$,M(h)):(e.consume(h),$)}function F(h){return h===null||h===34||h===39||h===60||h===61||h===96?n(h):h===47||h===62||ie(h)?B(h):(e.consume(h),F)}function _(h){return h===47||h===62||ie(h)?B(h):n(h)}function L(h){return h===62?(e.consume(h),e.exit("htmlTextData"),e.exit("htmlText"),t):n(h)}function M(h){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),H}function H(h){return J(h)?te(e,P,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(h):P(h)}function P(h){return e.enter("htmlTextData"),l(h)}}const An={name:"labelEnd",resolveAll:Xs,resolveTo:Qs,tokenize:Gs},qs={tokenize:Js},Ws={tokenize:Zs},Ys={tokenize:eu};function Xs(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&we(e,0,e.length,n),e}function Qs(e,t){let n=e.length,r=0,i,a,l,o;for(;n--;)if(i=e[n][1],a){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(l){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(a=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(l=n);const s={type:e[a][1].type==="labelLink"?"link":"image",start:{...e[a][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[a][1].start},end:{...e[l][1].end}},f={type:"labelText",start:{...e[a+r+2][1].end},end:{...e[l-2][1].start}};return o=[["enter",s,t],["enter",u,t]],o=Se(o,e.slice(a+1,a+r+3)),o=Se(o,[["enter",f,t]]),o=Se(o,Ft(t.parser.constructs.insideSpan.null,e.slice(a+r+4,l-3),t)),o=Se(o,[["exit",f,t],e[l-2],e[l-1],["exit",u,t]]),o=Se(o,e.slice(l+1)),o=Se(o,[["exit",s,t]]),we(e,a,e.length,o),e}function Gs(e,t,n){const r=this;let i=r.events.length,a,l;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){a=r.events[i][1];break}return o;function o(p){return a?a._inactive?c(p):(l=r.parser.defined.includes(ve(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelEnd"),s):n(p)}function s(p){return p===40?e.attempt(qs,f,l?f:c)(p):p===91?e.attempt(Ws,f,l?u:c)(p):l?f(p):c(p)}function u(p){return e.attempt(Ys,f,c)(p)}function f(p){return t(p)}function c(p){return a._balanced=!0,n(p)}}function Js(e,t,n){return r;function r(c){return e.enter("resource"),e.enter("resourceMarker"),e.consume(c),e.exit("resourceMarker"),i}function i(c){return ie(c)?dt(e,a)(c):a(c)}function a(c){return c===41?f(c):gi(e,l,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(c)}function l(c){return ie(c)?dt(e,s)(c):f(c)}function o(c){return n(c)}function s(c){return c===34||c===39||c===40?bi(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(c):f(c)}function u(c){return ie(c)?dt(e,f)(c):f(c)}function f(c){return c===41?(e.enter("resourceMarker"),e.consume(c),e.exit("resourceMarker"),e.exit("resource"),t):n(c)}}function Zs(e,t,n){const r=this;return i;function i(o){return xi.call(r,e,a,l,"reference","referenceMarker","referenceString")(o)}function a(o){return r.parser.defined.includes(ve(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function l(o){return n(o)}}function eu(e,t,n){return r;function r(a){return e.enter("reference"),e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),i}function i(a){return a===93?(e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),e.exit("reference"),t):n(a)}}const tu={name:"labelStartImage",resolveAll:An.resolveAll,tokenize:nu};function nu(e,t,n){const r=this;return i;function i(o){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(o),e.exit("labelImageMarker"),a}function a(o){return o===91?(e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelImage"),l):n(o)}function l(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const ru={name:"labelStartLink",resolveAll:An.resolveAll,tokenize:iu};function iu(e,t,n){const r=this;return i;function i(l){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelLink"),a}function a(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const qt={name:"lineEnding",tokenize:lu};function lu(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),te(e,t,"linePrefix")}}const Nt={name:"thematicBreak",tokenize:au};function au(e,t,n){let r=0,i;return a;function a(u){return e.enter("thematicBreak"),l(u)}function l(u){return i=u,o(u)}function o(u){return u===i?(e.enter("thematicBreakSequence"),s(u)):r>=3&&(u===null||q(u))?(e.exit("thematicBreak"),t(u)):n(u)}function s(u){return u===i?(e.consume(u),r++,s):(e.exit("thematicBreakSequence"),J(u)?te(e,o,"whitespace")(u):o(u))}}const xe={continuation:{tokenize:cu},exit:du,name:"list",tokenize:uu},ou={partial:!0,tokenize:pu},su={partial:!0,tokenize:fu};function uu(e,t,n){const r=this,i=r.events[r.events.length-1];let a=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,l=0;return o;function o(d){const x=r.containerState.type||(d===42||d===43||d===45?"listUnordered":"listOrdered");if(x==="listUnordered"?!r.containerState.marker||d===r.containerState.marker:cn(d)){if(r.containerState.type||(r.containerState.type=x,e.enter(x,{_container:!0})),x==="listUnordered")return e.enter("listItemPrefix"),d===42||d===45?e.check(Nt,n,u)(d):u(d);if(!r.interrupt||d===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),s(d)}return n(d)}function s(d){return cn(d)&&++l<10?(e.consume(d),s):(!r.interrupt||l<2)&&(r.containerState.marker?d===r.containerState.marker:d===41||d===46)?(e.exit("listItemValue"),u(d)):n(d)}function u(d){return e.enter("listItemMarker"),e.consume(d),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||d,e.check(bt,r.interrupt?n:f,e.attempt(ou,p,c))}function f(d){return r.containerState.initialBlankLine=!0,a++,p(d)}function c(d){return J(d)?(e.enter("listItemPrefixWhitespace"),e.consume(d),e.exit("listItemPrefixWhitespace"),p):n(d)}function p(d){return r.containerState.size=a+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(d)}}function cu(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(bt,i,a);function i(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,te(e,t,"listItemIndent",r.containerState.size+1)(o)}function a(o){return r.containerState.furtherBlankLines||!J(o)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,l(o)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(su,t,l)(o))}function l(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,te(e,e.attempt(xe,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function fu(e,t,n){const r=this;return te(e,i,"listItemIndent",r.containerState.size+1);function i(a){const l=r.events[r.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===r.containerState.size?t(a):n(a)}}function du(e){e.exit(this.containerState.type)}function pu(e,t,n){const r=this;return te(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(a){const l=r.events[r.events.length-1];return!J(a)&&l&&l[1].type==="listItemPrefixWhitespace"?t(a):n(a)}}const fr={name:"setextUnderline",resolveTo:hu,tokenize:mu};function hu(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!a&&e[n][1].type==="definition"&&(a=n);const l={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",a?(e.splice(i,0,["enter",l,t]),e.splice(a+1,0,["exit",e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=l,e.push(["exit",l,t]),e}function mu(e,t,n){const r=this;let i;return a;function a(u){let f=r.events.length,c;for(;f--;)if(r.events[f][1].type!=="lineEnding"&&r.events[f][1].type!=="linePrefix"&&r.events[f][1].type!=="content"){c=r.events[f][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||c)?(e.enter("setextHeadingLine"),i=u,l(u)):n(u)}function l(u){return e.enter("setextHeadingLineSequence"),o(u)}function o(u){return u===i?(e.consume(u),o):(e.exit("setextHeadingLineSequence"),J(u)?te(e,s,"lineSuffix")(u):s(u))}function s(u){return u===null||q(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const gu={tokenize:xu};function xu(e){const t=this,n=e.attempt(bt,r,e.attempt(this.parser.constructs.flowInitial,i,te(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Ss,i)),"linePrefix")));return n;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEndingBlank"),e.consume(a),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const bu={resolveAll:yi()},ku=ki("string"),yu=ki("text");function ki(e){return{resolveAll:yi(e==="text"?wu:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],a=n.attempt(i,l,o);return l;function l(f){return u(f)?a(f):o(f)}function o(f){if(f===null){n.consume(f);return}return n.enter("data"),n.consume(f),s}function s(f){return u(f)?(n.exit("data"),a(f)):(n.consume(f),s)}function u(f){if(f===null)return!0;const c=i[f];let p=-1;if(c)for(;++p<c.length;){const d=c[p];if(!d.previous||d.previous.call(r,r.previous))return!0}return!1}}}function yi(e){return t;function t(n,r){let i=-1,a;for(;++i<=n.length;)a===void 0?n[i]&&n[i][1].type==="data"&&(a=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==a+2&&(n[a][1].end=n[i-1][1].end,n.splice(a+2,i-a-2),i=a+2),a=void 0);return e?e(n,r):n}}function wu(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],i=t.sliceStream(r);let a=i.length,l=-1,o=0,s;for(;a--;){const u=i[a];if(typeof u=="string"){for(l=u.length;u.charCodeAt(l-1)===32;)o++,l--;if(l)break;l=-1}else if(u===-2)s=!0,o++;else if(u!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(o=0),o){const u={type:n===e.length||s||o<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:a?l:r.start._bufferIndex+l,_index:r.start._index+a,line:r.end.line,column:r.end.column-o,offset:r.end.offset-o},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const Su={42:xe,43:xe,45:xe,48:xe,49:xe,50:xe,51:xe,52:xe,53:xe,54:xe,55:xe,56:xe,57:xe,62:di},Cu={91:js},vu={[-2]:Vt,[-1]:Vt,32:Vt},Eu={35:Ps,42:Nt,45:[fr,Nt],60:Ms,61:fr,95:Nt,96:ur,126:ur},Iu={38:hi,92:pi},ju={[-5]:qt,[-4]:qt,[-3]:qt,33:tu,38:hi,42:fn,60:[rs,Ks],91:ru,92:[Ts,pi],93:An,95:fn,96:gs},Au={null:[fn,bu]},Nu={null:[42,95]},_u={null:[]},Tu=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Nu,contentInitial:Cu,disable:_u,document:Su,flow:Eu,flowInitial:vu,insideSpan:Au,string:Iu,text:ju},Symbol.toStringTag,{value:"Module"}));function zu(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},a=[];let l=[],o=[];const s={attempt:k(N),check:k(y),consume:E,enter:v,exit:O,interrupt:k(y,{interrupt:!0})},u={code:null,containerState:{},defineSkip:S,events:[],now:x,parser:e,previous:null,sliceSerialize:p,sliceStream:d,write:c};let f=t.tokenize.call(u,s);return t.resolveAll&&a.push(t),u;function c(j){return l=Se(l,j),C(),l[l.length-1]!==null?[]:(R(t,0),u.events=Ft(a,u.events,u),u.events)}function p(j,A){return Lu(d(j),A)}function d(j){return Pu(l,j)}function x(){const{_bufferIndex:j,_index:A,line:$,column:F,offset:_}=r;return{_bufferIndex:j,_index:A,line:$,column:F,offset:_}}function S(j){i[j.line]=j.column,w()}function C(){let j;for(;r._index<l.length;){const A=l[r._index];if(typeof A=="string")for(j=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===j&&r._bufferIndex<A.length;)b(A.charCodeAt(r._bufferIndex));else b(A)}}function b(j){f=f(j)}function E(j){q(j)?(r.line++,r.column=1,r.offset+=j===-3?2:1,w()):j!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===l[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=j}function v(j,A){const $=A||{};return $.type=j,$.start=x(),u.events.push(["enter",$,u]),o.push($),$}function O(j){const A=o.pop();return A.end=x(),u.events.push(["exit",A,u]),A}function N(j,A){R(j,A.from)}function y(j,A){A.restore()}function k(j,A){return $;function $(F,_,L){let M,H,P,h;return Array.isArray(F)?K(F):"tokenize"in F?K([F]):U(F);function U(G){return ae;function ae(V){const ee=V!==null&&G[V],re=V!==null&&G.null,me=[...Array.isArray(ee)?ee:ee?[ee]:[],...Array.isArray(re)?re:re?[re]:[]];return K(me)(V)}}function K(G){return M=G,H=0,G.length===0?L:m(G[H])}function m(G){return ae;function ae(V){return h=B(),P=G,G.partial||(u.currentConstruct=G),G.name&&u.parser.constructs.disable.null.includes(G.name)?Z():G.tokenize.call(A?Object.assign(Object.create(u),A):u,s,Y,Z)(V)}}function Y(G){return j(P,h),_}function Z(G){return h.restore(),++H<M.length?m(M[H]):L}}}function R(j,A){j.resolveAll&&!a.includes(j)&&a.push(j),j.resolve&&we(u.events,A,u.events.length-A,j.resolve(u.events.slice(A),u)),j.resolveTo&&(u.events=j.resolveTo(u.events,u))}function B(){const j=x(),A=u.previous,$=u.currentConstruct,F=u.events.length,_=Array.from(o);return{from:F,restore:L};function L(){r=j,u.previous=A,u.currentConstruct=$,u.events.length=F,o=_,w()}}function w(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Pu(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex;let l;if(n===i)l=[e[n].slice(r,a)];else{if(l=e.slice(n,i),r>-1){const o=l[0];typeof o=="string"?l[0]=o.slice(r):l.shift()}a>0&&l.push(e[i].slice(0,a))}return l}function Lu(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const a=e[n];let l;if(typeof a=="string")l=a;else switch(a){case-5:{l="\r";break}case-4:{l=`
60
+ `;break}case-3:{l=`\r
61
+ `;break}case-2:{l=t?" ":" ";break}case-1:{if(!t&&i)continue;l=" ";break}default:l=String.fromCharCode(a)}i=a===-2,r.push(l)}return r.join("")}function Du(e){const r={constructs:ci([Tu,...(e||{}).extensions||[]]),content:i(Qo),defined:[],document:i(Jo),flow:i(gu),lazy:{},string:i(ku),text:i(yu)};return r;function i(a){return l;function l(o){return zu(r,a,o)}}}function Fu(e){for(;!mi(e););return e}const dr=/[\0\t\n\r]/g;function Mu(){let e=1,t="",n=!0,r;return i;function i(a,l,o){const s=[];let u,f,c,p,d;for(a=t+(typeof a=="string"?a.toString():new TextDecoder(l||void 0).decode(a)),c=0,t="",n&&(a.charCodeAt(0)===65279&&c++,n=void 0);c<a.length;){if(dr.lastIndex=c,u=dr.exec(a),p=u&&u.index!==void 0?u.index:a.length,d=a.charCodeAt(p),!u){t=a.slice(c);break}if(d===10&&c===p&&r)s.push(-3),r=void 0;else switch(r&&(s.push(-5),r=void 0),c<p&&(s.push(a.slice(c,p)),e+=p-c),d){case 0:{s.push(65533),e++;break}case 9:{for(f=Math.ceil(e/4)*4,s.push(-2);e++<f;)s.push(-1);break}case 10:{s.push(-4),e=1;break}default:r=!0,e=1}c=p+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}const Ru=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Ou(e){return e.replace(Ru,Bu)}function Bu(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),a=i===120||i===88;return fi(n.slice(a?2:1),a?16:10)}return jn(n)||e}const wi={}.hasOwnProperty;function $u(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),Uu(n)(Fu(Du(n).document().write(Mu()(e,t,!0))))}function Uu(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(He),autolinkProtocol:B,autolinkEmail:B,atxHeading:a(Te),blockQuote:a(re),characterEscape:B,characterReference:B,codeFenced:a(me),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:a(me,l),codeText:a(_e,l),codeTextData:B,data:B,codeFlowValue:B,definition:a(Ie),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:a(De),hardBreakEscape:a(ke),hardBreakTrailing:a(ke),htmlFlow:a(Fe,l),htmlFlowData:B,htmlText:a(Fe,l),htmlTextData:B,image:a(Qe),label:l,link:a(He),listItem:a(lt),listItemValue:p,listOrdered:a(Me,c),listUnordered:a(Me),paragraph:a(je),reference:m,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:a(Te),strong:a(Ke),thematicBreak:a(yt)},exit:{atxHeading:s(),atxHeadingSequence:N,autolink:s(),autolinkEmail:ee,autolinkProtocol:V,blockQuote:s(),characterEscapeValue:w,characterReferenceMarkerHexadecimal:Z,characterReferenceMarkerNumeric:Z,characterReferenceValue:G,characterReference:ae,codeFenced:s(C),codeFencedFence:S,codeFencedFenceInfo:d,codeFencedFenceMeta:x,codeFlowValue:w,codeIndented:s(b),codeText:s(_),codeTextData:w,data:w,definition:s(),definitionDestinationString:O,definitionLabelString:E,definitionTitleString:v,emphasis:s(),hardBreakEscape:s(A),hardBreakTrailing:s(A),htmlFlow:s($),htmlFlowData:w,htmlText:s(F),htmlTextData:w,image:s(M),label:P,labelText:H,lineEnding:j,link:s(L),listItem:s(),listOrdered:s(),listUnordered:s(),paragraph:s(),referenceString:Y,resourceDestinationString:h,resourceTitleString:U,resource:K,setextHeading:s(R),setextHeadingLineSequence:k,setextHeadingText:y,strong:s(),thematicBreak:s()}};Si(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(I){let D={type:"root",children:[]};const W={stack:[D],tokenStack:[],config:t,enter:o,exit:u,buffer:l,resume:f,data:n},Q=[];let ne=-1;for(;++ne<I.length;)if(I[ne][1].type==="listOrdered"||I[ne][1].type==="listUnordered")if(I[ne][0]==="enter")Q.push(ne);else{const se=Q.pop();ne=i(I,se,ne)}for(ne=-1;++ne<I.length;){const se=t[I[ne][0]];wi.call(se,I[ne][1].type)&&se[I[ne][1].type].call(Object.assign({sliceSerialize:I[ne][2].sliceSerialize},W),I[ne][1])}if(W.tokenStack.length>0){const se=W.tokenStack[W.tokenStack.length-1];(se[1]||pr).call(W,void 0,se[0])}for(D.position={start:$e(I.length>0?I[0][1].start:{line:1,column:1,offset:0}),end:$e(I.length>0?I[I.length-2][1].end:{line:1,column:1,offset:0})},ne=-1;++ne<t.transforms.length;)D=t.transforms[ne](D)||D;return D}function i(I,D,W){let Q=D-1,ne=-1,se=!1,ze,Ce,qe,Re;for(;++Q<=W;){const ue=I[Q];switch(ue[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ue[0]==="enter"?ne++:ne--,Re=void 0;break}case"lineEndingBlank":{ue[0]==="enter"&&(ze&&!Re&&!ne&&!qe&&(qe=Q),Re=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Re=void 0}if(!ne&&ue[0]==="enter"&&ue[1].type==="listItemPrefix"||ne===-1&&ue[0]==="exit"&&(ue[1].type==="listUnordered"||ue[1].type==="listOrdered")){if(ze){let Oe=Q;for(Ce=void 0;Oe--;){const ge=I[Oe];if(ge[1].type==="lineEnding"||ge[1].type==="lineEndingBlank"){if(ge[0]==="exit")continue;Ce&&(I[Ce][1].type="lineEndingBlank",se=!0),ge[1].type="lineEnding",Ce=Oe}else if(!(ge[1].type==="linePrefix"||ge[1].type==="blockQuotePrefix"||ge[1].type==="blockQuotePrefixWhitespace"||ge[1].type==="blockQuoteMarker"||ge[1].type==="listItemIndent"))break}qe&&(!Ce||qe<Ce)&&(ze._spread=!0),ze.end=Object.assign({},Ce?I[Ce][1].start:ue[1].end),I.splice(Ce||Q,0,["exit",ze,ue[2]]),Q++,W++}if(ue[1].type==="listItemPrefix"){const Oe={type:"listItem",_spread:!1,start:Object.assign({},ue[1].start),end:void 0};ze=Oe,I.splice(Q,0,["enter",Oe,ue[2]]),Q++,W++,qe=void 0,Re=!0}}}return I[D][1]._spread=se,W}function a(I,D){return W;function W(Q){o.call(this,I(Q),Q),D&&D.call(this,Q)}}function l(){this.stack.push({type:"fragment",children:[]})}function o(I,D,W){this.stack[this.stack.length-1].children.push(I),this.stack.push(I),this.tokenStack.push([D,W||void 0]),I.position={start:$e(D.start),end:void 0}}function s(I){return D;function D(W){I&&I.call(this,W),u.call(this,W)}}function u(I,D){const W=this.stack.pop(),Q=this.tokenStack.pop();if(Q)Q[0].type!==I.type&&(D?D.call(this,I,Q[0]):(Q[1]||pr).call(this,I,Q[0]));else throw new Error("Cannot close `"+I.type+"` ("+ft({start:I.start,end:I.end})+"): it’s not open");W.position.end=$e(I.end)}function f(){return In(this.stack.pop())}function c(){this.data.expectingFirstListItemValue=!0}function p(I){if(this.data.expectingFirstListItemValue){const D=this.stack[this.stack.length-2];D.start=Number.parseInt(this.sliceSerialize(I),10),this.data.expectingFirstListItemValue=void 0}}function d(){const I=this.resume(),D=this.stack[this.stack.length-1];D.lang=I}function x(){const I=this.resume(),D=this.stack[this.stack.length-1];D.meta=I}function S(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function C(){const I=this.resume(),D=this.stack[this.stack.length-1];D.value=I.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function b(){const I=this.resume(),D=this.stack[this.stack.length-1];D.value=I.replace(/(\r?\n|\r)$/g,"")}function E(I){const D=this.resume(),W=this.stack[this.stack.length-1];W.label=D,W.identifier=ve(this.sliceSerialize(I)).toLowerCase()}function v(){const I=this.resume(),D=this.stack[this.stack.length-1];D.title=I}function O(){const I=this.resume(),D=this.stack[this.stack.length-1];D.url=I}function N(I){const D=this.stack[this.stack.length-1];if(!D.depth){const W=this.sliceSerialize(I).length;D.depth=W}}function y(){this.data.setextHeadingSlurpLineEnding=!0}function k(I){const D=this.stack[this.stack.length-1];D.depth=this.sliceSerialize(I).codePointAt(0)===61?1:2}function R(){this.data.setextHeadingSlurpLineEnding=void 0}function B(I){const W=this.stack[this.stack.length-1].children;let Q=W[W.length-1];(!Q||Q.type!=="text")&&(Q=Ve(),Q.position={start:$e(I.start),end:void 0},W.push(Q)),this.stack.push(Q)}function w(I){const D=this.stack.pop();D.value+=this.sliceSerialize(I),D.position.end=$e(I.end)}function j(I){const D=this.stack[this.stack.length-1];if(this.data.atHardBreak){const W=D.children[D.children.length-1];W.position.end=$e(I.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(D.type)&&(B.call(this,I),w.call(this,I))}function A(){this.data.atHardBreak=!0}function $(){const I=this.resume(),D=this.stack[this.stack.length-1];D.value=I}function F(){const I=this.resume(),D=this.stack[this.stack.length-1];D.value=I}function _(){const I=this.resume(),D=this.stack[this.stack.length-1];D.value=I}function L(){const I=this.stack[this.stack.length-1];if(this.data.inReference){const D=this.data.referenceType||"shortcut";I.type+="Reference",I.referenceType=D,delete I.url,delete I.title}else delete I.identifier,delete I.label;this.data.referenceType=void 0}function M(){const I=this.stack[this.stack.length-1];if(this.data.inReference){const D=this.data.referenceType||"shortcut";I.type+="Reference",I.referenceType=D,delete I.url,delete I.title}else delete I.identifier,delete I.label;this.data.referenceType=void 0}function H(I){const D=this.sliceSerialize(I),W=this.stack[this.stack.length-2];W.label=Ou(D),W.identifier=ve(D).toLowerCase()}function P(){const I=this.stack[this.stack.length-1],D=this.resume(),W=this.stack[this.stack.length-1];if(this.data.inReference=!0,W.type==="link"){const Q=I.children;W.children=Q}else W.alt=D}function h(){const I=this.resume(),D=this.stack[this.stack.length-1];D.url=I}function U(){const I=this.resume(),D=this.stack[this.stack.length-1];D.title=I}function K(){this.data.inReference=void 0}function m(){this.data.referenceType="collapsed"}function Y(I){const D=this.resume(),W=this.stack[this.stack.length-1];W.label=D,W.identifier=ve(this.sliceSerialize(I)).toLowerCase(),this.data.referenceType="full"}function Z(I){this.data.characterReferenceType=I.type}function G(I){const D=this.sliceSerialize(I),W=this.data.characterReferenceType;let Q;W?(Q=fi(D,W==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Q=jn(D);const ne=this.stack[this.stack.length-1];ne.value+=Q}function ae(I){const D=this.stack.pop();D.position.end=$e(I.end)}function V(I){w.call(this,I);const D=this.stack[this.stack.length-1];D.url=this.sliceSerialize(I)}function ee(I){w.call(this,I);const D=this.stack[this.stack.length-1];D.url="mailto:"+this.sliceSerialize(I)}function re(){return{type:"blockquote",children:[]}}function me(){return{type:"code",lang:null,meta:null,value:""}}function _e(){return{type:"inlineCode",value:""}}function Ie(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function De(){return{type:"emphasis",children:[]}}function Te(){return{type:"heading",depth:0,children:[]}}function ke(){return{type:"break"}}function Fe(){return{type:"html",value:""}}function Qe(){return{type:"image",title:null,url:"",alt:null}}function He(){return{type:"link",title:null,url:"",children:[]}}function Me(I){return{type:"list",ordered:I.type==="listOrdered",start:null,spread:I._spread,children:[]}}function lt(I){return{type:"listItem",spread:I._spread,checked:null,children:[]}}function je(){return{type:"paragraph",children:[]}}function Ke(){return{type:"strong",children:[]}}function Ve(){return{type:"text",value:""}}function yt(){return{type:"thematicBreak"}}}function $e(e){return{line:e.line,column:e.column,offset:e.offset}}function Si(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Si(e,r):Hu(e,r)}}function Hu(e,t){let n;for(n in t)if(wi.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function pr(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+ft({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+ft({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+ft({start:t.start,end:t.end})+") is still open")}function Ku(e){const t=this;t.parser=n;function n(r){return $u(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Vu(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function qu(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
62
+ `}]}function Wu(e,t){const n=t.value?t.value+`
63
+ `:"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let a={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:"element",tagName:"pre",properties:{},children:[a]},e.patch(t,a),a}function Yu(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Xu(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Qu(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=it(r.toLowerCase()),a=e.footnoteOrder.indexOf(r);let l,o=e.footnoteCounts.get(r);o===void 0?(o=0,e.footnoteOrder.push(r),l=e.footnoteOrder.length):l=a+1,o+=1,e.footnoteCounts.set(r,o);const s={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(o>1?"-"+o:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(l)}]};e.patch(t,s);const u={type:"element",tagName:"sup",properties:{},children:[s]};return e.patch(t,u),e.applyData(t,u)}function Gu(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Ju(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Ci(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const i=e.all(t),a=i[0];a&&a.type==="text"?a.value="["+a.value:i.unshift({type:"text",value:"["});const l=i[i.length-1];return l&&l.type==="text"?l.value+=r:i.push({type:"text",value:r}),i}function Zu(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Ci(e,t);const i={src:it(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const a={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function ec(e,t){const n={src:it(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function tc(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function nc(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Ci(e,t);const i={href:it(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const a={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function rc(e,t){const n={href:it(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function ic(e,t,n){const r=e.all(t),i=n?lc(n):vi(t),a={},l=[];if(typeof t.checked=="boolean"){const f=r[0];let c;f&&f.type==="element"&&f.tagName==="p"?c=f:(c={type:"element",tagName:"p",properties:{},children:[]},r.unshift(c)),c.children.length>0&&c.children.unshift({type:"text",value:" "}),c.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),a.className=["task-list-item"]}let o=-1;for(;++o<r.length;){const f=r[o];(i||o!==0||f.type!=="element"||f.tagName!=="p")&&l.push({type:"text",value:`
64
+ `}),f.type==="element"&&f.tagName==="p"&&!i?l.push(...f.children):l.push(f)}const s=r[r.length-1];s&&(i||s.type!=="element"||s.tagName!=="p")&&l.push({type:"text",value:`
65
+ `});const u={type:"element",tagName:"li",properties:a,children:l};return e.patch(t,u),e.applyData(t,u)}function lc(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=vi(n[r])}return t}function vi(e){const t=e.spread;return t??e.children.length>1}function ac(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i<r.length;){const l=r[i];if(l.type==="element"&&l.tagName==="li"&&l.properties&&Array.isArray(l.properties.className)&&l.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const a={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function oc(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function sc(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function uc(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function cc(e,t){const n=e.all(t),r=n.shift(),i=[];if(r){const l={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],l),i.push(l)}if(n.length>0){const l={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},o=Sn(t.children[1]),s=ri(t.children[t.children.length-1]);o&&s&&(l.position={start:o,end:s}),i.push(l)}const a={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function fc(e,t,n){const r=n?n.children:void 0,a=(r?r.indexOf(t):1)===0?"th":"td",l=n&&n.type==="table"?n.align:void 0,o=l?l.length:t.children.length;let s=-1;const u=[];for(;++s<o;){const c=t.children[s],p={},d=l?l[s]:void 0;d&&(p.align=d);let x={type:"element",tagName:a,properties:p,children:[]};c&&(x.children=e.all(c),e.patch(c,x),x=e.applyData(c,x)),u.push(x)}const f={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,f),e.applyData(t,f)}function dc(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const hr=9,mr=32;function pc(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const a=[];for(;r;)a.push(gr(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(gr(t.slice(i),i>0,!1)),a.join("")}function gr(e,t,n){let r=0,i=e.length;if(t){let a=e.codePointAt(r);for(;a===hr||a===mr;)r++,a=e.codePointAt(r)}if(n){let a=e.codePointAt(i-1);for(;a===hr||a===mr;)i--,a=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function hc(e,t){const n={type:"text",value:pc(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function mc(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const gc={blockquote:Vu,break:qu,code:Wu,delete:Yu,emphasis:Xu,footnoteReference:Qu,heading:Gu,html:Ju,imageReference:Zu,image:ec,inlineCode:tc,linkReference:nc,link:rc,listItem:ic,list:ac,paragraph:oc,root:sc,strong:uc,table:cc,tableCell:dc,tableRow:fc,text:hc,thematicBreak:mc,toml:Et,yaml:Et,definition:Et,footnoteDefinition:Et};function Et(){}const Ei=-1,Mt=0,pt=1,zt=2,Nn=3,_n=4,Tn=5,zn=6,Ii=7,ji=8,xr=typeof self=="object"?self:globalThis,xc=(e,t)=>{const n=(i,a)=>(e.set(a,i),i),r=i=>{if(e.has(i))return e.get(i);const[a,l]=t[i];switch(a){case Mt:case Ei:return n(l,i);case pt:{const o=n([],i);for(const s of l)o.push(r(s));return o}case zt:{const o=n({},i);for(const[s,u]of l)o[r(s)]=r(u);return o}case Nn:return n(new Date(l),i);case _n:{const{source:o,flags:s}=l;return n(new RegExp(o,s),i)}case Tn:{const o=n(new Map,i);for(const[s,u]of l)o.set(r(s),r(u));return o}case zn:{const o=n(new Set,i);for(const s of l)o.add(r(s));return o}case Ii:{const{name:o,message:s}=l;return n(new xr[o](s),i)}case ji:return n(BigInt(l),i);case"BigInt":return n(Object(BigInt(l)),i);case"ArrayBuffer":return n(new Uint8Array(l).buffer,l);case"DataView":{const{buffer:o}=new Uint8Array(l);return n(new DataView(o),l)}}return n(new xr[a](l),i)};return r},br=e=>xc(new Map,e)(0),Ze="",{toString:bc}={},{keys:kc}=Object,ct=e=>{const t=typeof e;if(t!=="object"||!e)return[Mt,t];const n=bc.call(e).slice(8,-1);switch(n){case"Array":return[pt,Ze];case"Object":return[zt,Ze];case"Date":return[Nn,Ze];case"RegExp":return[_n,Ze];case"Map":return[Tn,Ze];case"Set":return[zn,Ze];case"DataView":return[pt,n]}return n.includes("Array")?[pt,n]:n.includes("Error")?[Ii,n]:[zt,n]},It=([e,t])=>e===Mt&&(t==="function"||t==="symbol"),yc=(e,t,n,r)=>{const i=(l,o)=>{const s=r.push(l)-1;return n.set(o,s),s},a=l=>{if(n.has(l))return n.get(l);let[o,s]=ct(l);switch(o){case Mt:{let f=l;switch(s){case"bigint":o=ji,f=l.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+s);f=null;break;case"undefined":return i([Ei],l)}return i([o,f],l)}case pt:{if(s){let p=l;return s==="DataView"?p=new Uint8Array(l.buffer):s==="ArrayBuffer"&&(p=new Uint8Array(l)),i([s,[...p]],l)}const f=[],c=i([o,f],l);for(const p of l)f.push(a(p));return c}case zt:{if(s)switch(s){case"BigInt":return i([s,l.toString()],l);case"Boolean":case"Number":case"String":return i([s,l.valueOf()],l)}if(t&&"toJSON"in l)return a(l.toJSON());const f=[],c=i([o,f],l);for(const p of kc(l))(e||!It(ct(l[p])))&&f.push([a(p),a(l[p])]);return c}case Nn:return i([o,l.toISOString()],l);case _n:{const{source:f,flags:c}=l;return i([o,{source:f,flags:c}],l)}case Tn:{const f=[],c=i([o,f],l);for(const[p,d]of l)(e||!(It(ct(p))||It(ct(d))))&&f.push([a(p),a(d)]);return c}case zn:{const f=[],c=i([o,f],l);for(const p of l)(e||!It(ct(p)))&&f.push(a(p));return c}}const{message:u}=l;return i([o,{name:s,message:u}],l)};return a},kr=(e,{json:t,lossy:n}={})=>{const r=[];return yc(!(t||n),!!t,new Map,r)(e),r},Pt=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?br(kr(e,t)):structuredClone(e):(e,t)=>br(kr(e,t));function wc(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function Sc(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function Cc(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||wc,r=e.options.footnoteBackLabel||Sc,i=e.options.footnoteLabel||"Footnotes",a=e.options.footnoteLabelTagName||"h2",l=e.options.footnoteLabelProperties||{className:["sr-only"]},o=[];let s=-1;for(;++s<e.footnoteOrder.length;){const u=e.footnoteById.get(e.footnoteOrder[s]);if(!u)continue;const f=e.all(u),c=String(u.identifier).toUpperCase(),p=it(c.toLowerCase());let d=0;const x=[],S=e.footnoteCounts.get(c);for(;S!==void 0&&++d<=S;){x.length>0&&x.push({type:"text",value:" "});let E=typeof n=="string"?n:n(s,d);typeof E=="string"&&(E={type:"text",value:E}),x.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+p+(d>1?"-"+d:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(s,d),className:["data-footnote-backref"]},children:Array.isArray(E)?E:[E]})}const C=f[f.length-1];if(C&&C.type==="element"&&C.tagName==="p"){const E=C.children[C.children.length-1];E&&E.type==="text"?E.value+=" ":C.children.push({type:"text",value:" "}),C.children.push(...x)}else f.push(...x);const b={type:"element",tagName:"li",properties:{id:t+"fn-"+p},children:e.wrap(f,!0)};e.patch(u,b),o.push(b)}if(o.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:a,properties:{...Pt(l),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
66
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(o,!0)},{type:"text",value:`
67
+ `}]}}const Rt=(function(e){if(e==null)return jc;if(typeof e=="function")return Ot(e);if(typeof e=="object")return Array.isArray(e)?vc(e):Ec(e);if(typeof e=="string")return Ic(e);throw new Error("Expected function, string, or object as test")});function vc(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Rt(e[n]);return Ot(r);function r(...i){let a=-1;for(;++a<t.length;)if(t[a].apply(this,i))return!0;return!1}}function Ec(e){const t=e;return Ot(n);function n(r){const i=r;let a;for(a in e)if(i[a]!==t[a])return!1;return!0}}function Ic(e){return Ot(t);function t(n){return n&&n.type===e}}function Ot(e){return t;function t(n,r,i){return!!(Ac(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function jc(){return!0}function Ac(e){return e!==null&&typeof e=="object"&&"type"in e}const Ai=[],Nc=!0,dn=!1,_c="skip";function Ni(e,t,n,r){let i;typeof t=="function"&&typeof n!="function"?(r=n,n=t):i=t;const a=Rt(i),l=r?-1:1;o(e,void 0,[])();function o(s,u,f){const c=s&&typeof s=="object"?s:{};if(typeof c.type=="string"){const d=typeof c.tagName=="string"?c.tagName:typeof c.name=="string"?c.name:void 0;Object.defineProperty(p,"name",{value:"node ("+(s.type+(d?"<"+d+">":""))+")"})}return p;function p(){let d=Ai,x,S,C;if((!t||a(s,u,f[f.length-1]||void 0))&&(d=Tc(n(s,f)),d[0]===dn))return d;if("children"in s&&s.children){const b=s;if(b.children&&d[0]!==_c)for(S=(r?b.children.length:-1)+l,C=f.concat(b);S>-1&&S<b.children.length;){const E=b.children[S];if(x=o(E,S,C)(),x[0]===dn)return x;S=typeof x[1]=="number"?x[1]:S+l}}return d}}}function Tc(e){return Array.isArray(e)?e:typeof e=="number"?[Nc,e]:e==null?Ai:[e]}function Pn(e,t,n,r){let i,a,l;typeof t=="function"&&typeof n!="function"?(a=void 0,l=t,i=n):(a=t,l=n,i=r),Ni(e,a,o,i);function o(s,u){const f=u[u.length-1],c=f?f.children.indexOf(s):void 0;return l(s,c,f)}}const pn={}.hasOwnProperty,zc={};function Pc(e,t){const n=t||zc,r=new Map,i=new Map,a=new Map,l={...gc,...n.handlers},o={all:u,applyData:Dc,definitionById:r,footnoteById:i,footnoteCounts:a,footnoteOrder:[],handlers:l,one:s,options:n,patch:Lc,wrap:Mc};return Pn(e,function(f){if(f.type==="definition"||f.type==="footnoteDefinition"){const c=f.type==="definition"?r:i,p=String(f.identifier).toUpperCase();c.has(p)||c.set(p,f)}}),o;function s(f,c){const p=f.type,d=o.handlers[p];if(pn.call(o.handlers,p)&&d)return d(o,f,c);if(o.options.passThrough&&o.options.passThrough.includes(p)){if("children"in f){const{children:S,...C}=f,b=Pt(C);return b.children=o.all(f),b}return Pt(f)}return(o.options.unknownHandler||Fc)(o,f,c)}function u(f){const c=[];if("children"in f){const p=f.children;let d=-1;for(;++d<p.length;){const x=o.one(p[d],f);if(x){if(d&&p[d-1].type==="break"&&(!Array.isArray(x)&&x.type==="text"&&(x.value=yr(x.value)),!Array.isArray(x)&&x.type==="element")){const S=x.children[0];S&&S.type==="text"&&(S.value=yr(S.value))}Array.isArray(x)?c.push(...x):c.push(x)}}}return c}}function Lc(e,t){e.position&&(t.position=So(e))}function Dc(e,t){let n=t;if(e&&e.data){const r=e.data.hName,i=e.data.hChildren,a=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const l="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:l}}n.type==="element"&&a&&Object.assign(n.properties,Pt(a)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function Fc(e,t){const n=t.data||{},r="value"in t&&!(pn.call(n,"hProperties")||pn.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Mc(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
68
+ `});++r<e.length;)r&&n.push({type:"text",value:`
69
+ `}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
70
+ `}),n}function yr(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function wr(e,t){const n=Pc(e,t),r=n.one(e,void 0),i=Cc(n),a=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&a.children.push({type:"text",value:`
71
+ `},i),a}function Rc(e,t){return e&&"run"in e?async function(n,r){const i=wr(n,{file:r,...t});await e.run(i,r)}:function(n,r){return wr(n,{file:r,...e||t})}}function Sr(e){if(e)throw e}var Wt,Cr;function Oc(){if(Cr)return Wt;Cr=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(u){return typeof Array.isArray=="function"?Array.isArray(u):t.call(u)==="[object Array]"},a=function(u){if(!u||t.call(u)!=="[object Object]")return!1;var f=e.call(u,"constructor"),c=u.constructor&&u.constructor.prototype&&e.call(u.constructor.prototype,"isPrototypeOf");if(u.constructor&&!f&&!c)return!1;var p;for(p in u);return typeof p>"u"||e.call(u,p)},l=function(u,f){n&&f.name==="__proto__"?n(u,f.name,{enumerable:!0,configurable:!0,value:f.newValue,writable:!0}):u[f.name]=f.newValue},o=function(u,f){if(f==="__proto__")if(e.call(u,f)){if(r)return r(u,f).value}else return;return u[f]};return Wt=function s(){var u,f,c,p,d,x,S=arguments[0],C=1,b=arguments.length,E=!1;for(typeof S=="boolean"&&(E=S,S=arguments[1]||{},C=2),(S==null||typeof S!="object"&&typeof S!="function")&&(S={});C<b;++C)if(u=arguments[C],u!=null)for(f in u)c=o(S,f),p=o(u,f),S!==p&&(E&&p&&(a(p)||(d=i(p)))?(d?(d=!1,x=c&&i(c)?c:[]):x=c&&a(c)?c:{},l(S,{name:f,newValue:s(E,x,p)})):typeof p<"u"&&l(S,{name:f,newValue:p}));return S},Wt}var Bc=Oc();const Yt=Or(Bc);function hn(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function $c(){const e=[],t={run:n,use:r};return t;function n(...i){let a=-1;const l=i.pop();if(typeof l!="function")throw new TypeError("Expected function as last argument, not "+l);o(null,...i);function o(s,...u){const f=e[++a];let c=-1;if(s){l(s);return}for(;++c<i.length;)(u[c]===null||u[c]===void 0)&&(u[c]=i[c]);i=u,f?Uc(f,o)(...u):l(null,...u)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function Uc(e,t){let n;return r;function r(...l){const o=e.length>l.length;let s;o&&l.push(i);try{s=e.apply(this,l)}catch(u){const f=u;if(o&&n)throw f;return i(f)}o||(s&&s.then&&typeof s.then=="function"?s.then(a,i):s instanceof Error?i(s):a(s))}function i(l,...o){n||(n=!0,t(l,...o))}function a(l){i(null,l)}}const Ae={basename:Hc,dirname:Kc,extname:Vc,join:qc,sep:"/"};function Hc(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');kt(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let l=-1,o=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else l<0&&(a=!0,l=i+1),o>-1&&(e.codePointAt(i)===t.codePointAt(o--)?o<0&&(r=i):(o=-1,r=l));return n===r?r=l:r<0&&(r=e.length),e.slice(n,r)}function Kc(e){if(kt(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function Vc(e){kt(e);let t=e.length,n=-1,r=0,i=-1,a=0,l;for(;t--;){const o=e.codePointAt(t);if(o===47){if(l){r=t+1;break}continue}n<0&&(l=!0,n=t+1),o===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function qc(...e){let t=-1,n;for(;++t<e.length;)kt(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":Wc(n)}function Wc(e){kt(e);const t=e.codePointAt(0)===47;let n=Yc(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Yc(e,t){let n="",r=0,i=-1,a=0,l=-1,o,s;for(;++l<=e.length;){if(l<e.length)o=e.codePointAt(l);else{if(o===47)break;o=47}if(o===47){if(!(i===l-1||a===1))if(i!==l-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(s=n.lastIndexOf("/"),s!==n.length-1){s<0?(n="",r=0):(n=n.slice(0,s),r=n.length-1-n.lastIndexOf("/")),i=l,a=0;continue}}else if(n.length>0){n="",r=0,i=l,a=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,l):n=e.slice(i+1,l),r=l-i-1;i=l,a=0}else o===46&&a>-1?a++:a=-1}return n}function kt(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Xc={cwd:Qc};function Qc(){return"/"}function mn(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Gc(e){if(typeof e=="string")e=new URL(e);else if(!mn(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return Jc(e)}function Jc(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const Xt=["history","path","basename","stem","extname","dirname"];class _i{constructor(t){let n;t?mn(t)?n={path:t}:typeof t=="string"||Zc(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":Xc.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Xt.length;){const a=Xt[r];a in n&&n[a]!==void 0&&n[a]!==null&&(this[a]=a==="history"?[...n[a]]:n[a])}let i;for(i in n)Xt.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?Ae.basename(this.path):void 0}set basename(t){Gt(t,"basename"),Qt(t,"basename"),this.path=Ae.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Ae.dirname(this.path):void 0}set dirname(t){vr(this.basename,"dirname"),this.path=Ae.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Ae.extname(this.path):void 0}set extname(t){if(Qt(t,"extname"),vr(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Ae.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){mn(t)&&(t=Gc(t)),Gt(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Ae.basename(this.path,this.extname):void 0}set stem(t){Gt(t,"stem"),Qt(t,"stem"),this.path=Ae.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new de(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Qt(e,t){if(e&&e.includes(Ae.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ae.sep+"`")}function Gt(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function vr(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function Zc(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const ef=(function(e){const r=this.constructor.prototype,i=r[e],a=function(){return i.apply(a,arguments)};return Object.setPrototypeOf(a,r),a}),tf={}.hasOwnProperty;class Ln extends ef{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=$c()}copy(){const t=new Ln;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Yt(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(en("data",this.frozen),this.namespace[t]=n,this):tf.call(this.namespace,t)&&this.namespace[t]||void 0:t?(en("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=jt(t),r=this.parser||this.Parser;return Jt("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Jt("process",this.parser||this.Parser),Zt("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(a,l){const o=jt(t),s=r.parse(o);r.run(s,o,function(f,c,p){if(f||!c||!p)return u(f);const d=c,x=r.stringify(d,p);lf(x)?p.value=x:p.result=x,u(f,p)});function u(f,c){f||!c?l(f):a?a(c):n(void 0,c)}}}processSync(t){let n=!1,r;return this.freeze(),Jt("processSync",this.parser||this.Parser),Zt("processSync",this.compiler||this.Compiler),this.process(t,i),Ir("processSync","process",n),r;function i(a,l){n=!0,Sr(a),r=l}}run(t,n,r){Er(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?a(void 0,r):new Promise(a);function a(l,o){const s=jt(n);i.run(t,s,u);function u(f,c,p){const d=c||t;f?o(f):l?l(d):r(void 0,d,p)}}}runSync(t,n){let r=!1,i;return this.run(t,n,a),Ir("runSync","run",r),i;function a(l,o){Sr(l),i=o,r=!0}}stringify(t,n){this.freeze();const r=jt(n),i=this.compiler||this.Compiler;return Zt("stringify",i),Er(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(en("use",this.frozen),t!=null)if(typeof t=="function")s(t,n);else if(typeof t=="object")Array.isArray(t)?o(t):l(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function a(u){if(typeof u=="function")s(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[f,...c]=u;s(f,c)}else l(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function l(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(u.plugins),u.settings&&(i.settings=Yt(!0,i.settings,u.settings))}function o(u){let f=-1;if(u!=null)if(Array.isArray(u))for(;++f<u.length;){const c=u[f];a(c)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function s(u,f){let c=-1,p=-1;for(;++c<r.length;)if(r[c][0]===u){p=c;break}if(p===-1)r.push([u,...f]);else if(f.length>0){let[d,...x]=f;const S=r[p][1];hn(S)&&hn(d)&&(d=Yt(!0,S,d)),r[p]=[u,d,...x]}}}}const nf=new Ln().freeze();function Jt(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Zt(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function en(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Er(e){if(!hn(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Ir(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function jt(e){return rf(e)?e:new _i(e)}function rf(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function lf(e){return typeof e=="string"||af(e)}function af(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const of="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",jr=[],Ar={allowDangerousHtml:!0},sf=/^(https?|ircs?|mailto|xmpp)$/i,uf=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Nr(e){const t=cf(e),n=ff(e);return df(t.runSync(t.parse(n),n),e)}function cf(e){const t=e.rehypePlugins||jr,n=e.remarkPlugins||jr,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Ar}:Ar;return nf().use(Ku).use(n).use(Rc,r).use(t)}function ff(e){const t=e.children||"",n=new _i;return typeof t=="string"&&(n.value=t),n}function df(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,l=t.skipHtml,o=t.unwrapDisallowed,s=t.urlTransform||pf;for(const f of uf)Object.hasOwn(t,f.from)&&(""+f.from+(f.to?"use `"+f.to+"` instead":"remove it")+of+f.id,void 0);return Pn(e,u),jo(e,{Fragment:g.Fragment,components:i,ignoreInvalidStyle:!0,jsx:g.jsx,jsxs:g.jsxs,passKeys:!0,passNode:!0});function u(f,c,p){if(f.type==="raw"&&p&&typeof c=="number")return l?p.children.splice(c,1):p.children[c]={type:"text",value:f.value},c;if(f.type==="element"){let d;for(d in Kt)if(Object.hasOwn(Kt,d)&&Object.hasOwn(f.properties,d)){const x=f.properties[d],S=Kt[d];(S===null||S.includes(f.tagName))&&(f.properties[d]=s(String(x||""),d,f))}}if(f.type==="element"){let d=n?!n.includes(f.tagName):a?a.includes(f.tagName):!1;if(!d&&r&&typeof c=="number"&&(d=!r(f,c,p)),d&&p&&typeof c=="number")return o&&f.children?p.children.splice(c,1,...f.children):p.children.splice(c,1),c}}}function pf(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||sf.test(e.slice(0,t))?e:""}function _r(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function hf(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function mf(e,t,n){const i=Rt((n||{}).ignore||[]),a=gf(t);let l=-1;for(;++l<a.length;)Ni(e,"text",o);function o(u,f){let c=-1,p;for(;++c<f.length;){const d=f[c],x=p?p.children:void 0;if(i(d,x?x.indexOf(d):void 0,p))return;p=d}if(p)return s(u,f)}function s(u,f){const c=f[f.length-1],p=a[l][0],d=a[l][1];let x=0;const C=c.children.indexOf(u);let b=!1,E=[];p.lastIndex=0;let v=p.exec(u.value);for(;v;){const O=v.index,N={index:v.index,input:v.input,stack:[...f,u]};let y=d(...v,N);if(typeof y=="string"&&(y=y.length>0?{type:"text",value:y}:void 0),y===!1?p.lastIndex=O+1:(x!==O&&E.push({type:"text",value:u.value.slice(x,O)}),Array.isArray(y)?E.push(...y):y&&E.push(y),x=O+v[0].length,b=!0),!p.global)break;v=p.exec(u.value)}return b?(x<u.value.length&&E.push({type:"text",value:u.value.slice(x)}),c.children.splice(C,1,...E)):E=[u],C+E.length}}function gf(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const i=n[r];t.push([xf(i[0]),bf(i[1])])}return t}function xf(e){return typeof e=="string"?new RegExp(hf(e),"g"):e}function bf(e){return typeof e=="function"?e:function(){return e}}const tn="phrasing",nn=["autolink","link","image","label"];function kf(){return{transforms:[If],enter:{literalAutolink:wf,literalAutolinkEmail:rn,literalAutolinkHttp:rn,literalAutolinkWww:rn},exit:{literalAutolink:Ef,literalAutolinkEmail:vf,literalAutolinkHttp:Sf,literalAutolinkWww:Cf}}}function yf(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:tn,notInConstruct:nn},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:tn,notInConstruct:nn},{character:":",before:"[ps]",after:"\\/",inConstruct:tn,notInConstruct:nn}]}}function wf(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function rn(e){this.config.enter.autolinkProtocol.call(this,e)}function Sf(e){this.config.exit.autolinkProtocol.call(this,e)}function Cf(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function vf(e){this.config.exit.autolinkEmail.call(this,e)}function Ef(e){this.exit(e)}function If(e){mf(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,jf],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),Af]],{ignore:["link","linkReference"]})}function jf(e,t,n,r,i){let a="";if(!Ti(i)||(/^w/i.test(t)&&(n=t+n,t="",a="http://"),!Nf(n)))return!1;const l=_f(n+r);if(!l[0])return!1;const o={type:"link",title:null,url:a+t+l[0],children:[{type:"text",value:t+l[0]}]};return l[1]?[o,{type:"text",value:l[1]}]:o}function Af(e,t,n,r){return!Ti(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function Nf(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function _f(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const i=_r(e,"(");let a=_r(e,")");for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),a++;return[e,n]}function Ti(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Ye(n)||Dt(n))&&(!t||n!==47)}zi.peek=Of;function Tf(){this.buffer()}function zf(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function Pf(){this.buffer()}function Lf(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Df(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ve(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Ff(e){this.exit(e)}function Mf(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ve(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Rf(e){this.exit(e)}function Of(){return"["}function zi(e,t,n,r){const i=n.createTracker(r);let a=i.move("[^");const l=n.enter("footnoteReference"),o=n.enter("reference");return a+=i.move(n.safe(n.associationId(e),{after:"]",before:a})),o(),l(),a+=i.move("]"),a}function Bf(){return{enter:{gfmFootnoteCallString:Tf,gfmFootnoteCall:zf,gfmFootnoteDefinitionLabelString:Pf,gfmFootnoteDefinition:Lf},exit:{gfmFootnoteCallString:Df,gfmFootnoteCall:Ff,gfmFootnoteDefinitionLabelString:Mf,gfmFootnoteDefinition:Rf}}}function $f(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:zi},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,a,l){const o=a.createTracker(l);let s=o.move("[^");const u=a.enter("footnoteDefinition"),f=a.enter("label");return s+=o.move(a.safe(a.associationId(r),{before:s,after:"]"})),f(),s+=o.move("]:"),r.children&&r.children.length>0&&(o.shift(4),s+=o.move((t?`
72
+ `:" ")+a.indentLines(a.containerFlow(r,o.current()),t?Pi:Uf))),u(),s}}function Uf(e,t,n){return t===0?e:Pi(e,t,n)}function Pi(e,t,n){return(n?"":" ")+e}const Hf=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Li.peek=Yf;function Kf(){return{canContainEols:["delete"],enter:{strikethrough:qf},exit:{strikethrough:Wf}}}function Vf(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Hf}],handlers:{delete:Li}}}function qf(e){this.enter({type:"delete",children:[]},e)}function Wf(e){this.exit(e)}function Li(e,t,n,r){const i=n.createTracker(r),a=n.enter("strikethrough");let l=i.move("~~");return l+=n.containerPhrasing(e,{...i.current(),before:l,after:"~"}),l+=i.move("~~"),a(),l}function Yf(){return"~"}function Xf(e){return e.length}function Qf(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||Xf,a=[],l=[],o=[],s=[];let u=0,f=-1;for(;++f<e.length;){const S=[],C=[];let b=-1;for(e[f].length>u&&(u=e[f].length);++b<e[f].length;){const E=Gf(e[f][b]);if(n.alignDelimiters!==!1){const v=i(E);C[b]=v,(s[b]===void 0||v>s[b])&&(s[b]=v)}S.push(E)}l[f]=S,o[f]=C}let c=-1;if(typeof r=="object"&&"length"in r)for(;++c<u;)a[c]=Tr(r[c]);else{const S=Tr(r);for(;++c<u;)a[c]=S}c=-1;const p=[],d=[];for(;++c<u;){const S=a[c];let C="",b="";S===99?(C=":",b=":"):S===108?C=":":S===114&&(b=":");let E=n.alignDelimiters===!1?1:Math.max(1,s[c]-C.length-b.length);const v=C+"-".repeat(E)+b;n.alignDelimiters!==!1&&(E=C.length+E+b.length,E>s[c]&&(s[c]=E),d[c]=E),p[c]=v}l.splice(1,0,p),o.splice(1,0,d),f=-1;const x=[];for(;++f<l.length;){const S=l[f],C=o[f];c=-1;const b=[];for(;++c<u;){const E=S[c]||"";let v="",O="";if(n.alignDelimiters!==!1){const N=s[c]-(C[c]||0),y=a[c];y===114?v=" ".repeat(N):y===99?N%2?(v=" ".repeat(N/2+.5),O=" ".repeat(N/2-.5)):(v=" ".repeat(N/2),O=v):O=" ".repeat(N)}n.delimiterStart!==!1&&!c&&b.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&E==="")&&(n.delimiterStart!==!1||c)&&b.push(" "),n.alignDelimiters!==!1&&b.push(v),b.push(E),n.alignDelimiters!==!1&&b.push(O),n.padding!==!1&&b.push(" "),(n.delimiterEnd!==!1||c!==u-1)&&b.push("|")}x.push(n.delimiterEnd===!1?b.join("").replace(/ +$/,""):b.join(""))}return x.join(`
73
+ `)}function Gf(e){return e==null?"":String(e)}function Tr(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function Jf(e,t,n,r){const i=n.enter("blockquote"),a=n.createTracker(r);a.move("> "),a.shift(2);const l=n.indentLines(n.containerFlow(e,a.current()),Zf);return i(),l}function Zf(e,t,n){return">"+(n?"":" ")+e}function ed(e,t){return zr(e,t.inConstruct,!0)&&!zr(e,t.notInConstruct,!1)}function zr(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function Pr(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
74
+ `&&ed(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
75
+ `}function td(e,t){const n=String(e);let r=n.indexOf(t),i=r,a=0,l=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++a>l&&(l=a):a=1,i=r+t.length,r=n.indexOf(t,i);return l}function nd(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function rd(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function id(e,t,n,r){const i=rd(n),a=e.value||"",l=i==="`"?"GraveAccent":"Tilde";if(nd(e,n)){const c=n.enter("codeIndented"),p=n.indentLines(a,ld);return c(),p}const o=n.createTracker(r),s=i.repeat(Math.max(td(a,i)+1,3)),u=n.enter("codeFenced");let f=o.move(s);if(e.lang){const c=n.enter(`codeFencedLang${l}`);f+=o.move(n.safe(e.lang,{before:f,after:" ",encode:["`"],...o.current()})),c()}if(e.lang&&e.meta){const c=n.enter(`codeFencedMeta${l}`);f+=o.move(" "),f+=o.move(n.safe(e.meta,{before:f,after:`
76
+ `,encode:["`"],...o.current()})),c()}return f+=o.move(`
77
+ `),a&&(f+=o.move(a+`
78
+ `)),f+=o.move(s),u(),f}function ld(e,t,n){return(n?"":" ")+e}function Dn(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function ad(e,t,n,r){const i=Dn(n),a=i==='"'?"Quote":"Apostrophe",l=n.enter("definition");let o=n.enter("label");const s=n.createTracker(r);let u=s.move("[");return u+=s.move(n.safe(n.associationId(e),{before:u,after:"]",...s.current()})),u+=s.move("]: "),o(),!e.url||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),u+=s.move("<"),u+=s.move(n.safe(e.url,{before:u,after:">",...s.current()})),u+=s.move(">")):(o=n.enter("destinationRaw"),u+=s.move(n.safe(e.url,{before:u,after:e.title?" ":`
79
+ `,...s.current()}))),o(),e.title&&(o=n.enter(`title${a}`),u+=s.move(" "+i),u+=s.move(n.safe(e.title,{before:u,after:i,...s.current()})),u+=s.move(i),o()),l(),u}function od(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function gt(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Lt(e,t,n){const r=nt(e),i=nt(t);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Di.peek=sd;function Di(e,t,n,r){const i=od(n),a=n.enter("emphasis"),l=n.createTracker(r),o=l.move(i);let s=l.move(n.containerPhrasing(e,{after:i,before:o,...l.current()}));const u=s.charCodeAt(0),f=Lt(r.before.charCodeAt(r.before.length-1),u,i);f.inside&&(s=gt(u)+s.slice(1));const c=s.charCodeAt(s.length-1),p=Lt(r.after.charCodeAt(0),c,i);p.inside&&(s=s.slice(0,-1)+gt(c));const d=l.move(i);return a(),n.attentionEncodeSurroundingInfo={after:p.outside,before:f.outside},o+s+d}function sd(e,t,n){return n.options.emphasis||"*"}function ud(e,t){let n=!1;return Pn(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,dn}),!!((!e.depth||e.depth<3)&&In(e)&&(t.options.setext||n))}function cd(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(ud(e,n)){const f=n.enter("headingSetext"),c=n.enter("phrasing"),p=n.containerPhrasing(e,{...a.current(),before:`
80
+ `,after:`
81
+ `});return c(),f(),p+`
82
+ `+(i===1?"=":"-").repeat(p.length-(Math.max(p.lastIndexOf("\r"),p.lastIndexOf(`
83
+ `))+1))}const l="#".repeat(i),o=n.enter("headingAtx"),s=n.enter("phrasing");a.move(l+" ");let u=n.containerPhrasing(e,{before:"# ",after:`
84
+ `,...a.current()});return/^[\t ]/.test(u)&&(u=gt(u.charCodeAt(0))+u.slice(1)),u=u?l+" "+u:l,n.options.closeAtx&&(u+=" "+l),s(),o(),u}Fi.peek=fd;function Fi(e){return e.value||""}function fd(){return"<"}Mi.peek=dd;function Mi(e,t,n,r){const i=Dn(n),a=i==='"'?"Quote":"Apostrophe",l=n.enter("image");let o=n.enter("label");const s=n.createTracker(r);let u=s.move("![");return u+=s.move(n.safe(e.alt,{before:u,after:"]",...s.current()})),u+=s.move("]("),o(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),u+=s.move("<"),u+=s.move(n.safe(e.url,{before:u,after:">",...s.current()})),u+=s.move(">")):(o=n.enter("destinationRaw"),u+=s.move(n.safe(e.url,{before:u,after:e.title?" ":")",...s.current()}))),o(),e.title&&(o=n.enter(`title${a}`),u+=s.move(" "+i),u+=s.move(n.safe(e.title,{before:u,after:i,...s.current()})),u+=s.move(i),o()),u+=s.move(")"),l(),u}function dd(){return"!"}Ri.peek=pd;function Ri(e,t,n,r){const i=e.referenceType,a=n.enter("imageReference");let l=n.enter("label");const o=n.createTracker(r);let s=o.move("![");const u=n.safe(e.alt,{before:s,after:"]",...o.current()});s+=o.move(u+"]["),l();const f=n.stack;n.stack=[],l=n.enter("reference");const c=n.safe(n.associationId(e),{before:s,after:"]",...o.current()});return l(),n.stack=f,a(),i==="full"||!u||u!==c?s+=o.move(c+"]"):i==="shortcut"?s=s.slice(0,-1):s+=o.move("]"),s}function pd(){return"!"}Oi.peek=hd;function Oi(e,t,n){let r=e.value||"",i="`",a=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++a<n.unsafe.length;){const l=n.unsafe[a],o=n.compilePattern(l);let s;if(l.atBreak)for(;s=o.exec(r);){let u=s.index;r.charCodeAt(u)===10&&r.charCodeAt(u-1)===13&&u--,r=r.slice(0,u)+" "+r.slice(s.index+1)}}return i+r+i}function hd(){return"`"}function Bi(e,t){const n=In(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}$i.peek=md;function $i(e,t,n,r){const i=Dn(n),a=i==='"'?"Quote":"Apostrophe",l=n.createTracker(r);let o,s;if(Bi(e,n)){const f=n.stack;n.stack=[],o=n.enter("autolink");let c=l.move("<");return c+=l.move(n.containerPhrasing(e,{before:c,after:">",...l.current()})),c+=l.move(">"),o(),n.stack=f,c}o=n.enter("link"),s=n.enter("label");let u=l.move("[");return u+=l.move(n.containerPhrasing(e,{before:u,after:"](",...l.current()})),u+=l.move("]("),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(n.safe(e.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(s=n.enter("destinationRaw"),u+=l.move(n.safe(e.url,{before:u,after:e.title?" ":")",...l.current()}))),s(),e.title&&(s=n.enter(`title${a}`),u+=l.move(" "+i),u+=l.move(n.safe(e.title,{before:u,after:i,...l.current()})),u+=l.move(i),s()),u+=l.move(")"),o(),u}function md(e,t,n){return Bi(e,n)?"<":"["}Ui.peek=gd;function Ui(e,t,n,r){const i=e.referenceType,a=n.enter("linkReference");let l=n.enter("label");const o=n.createTracker(r);let s=o.move("[");const u=n.containerPhrasing(e,{before:s,after:"]",...o.current()});s+=o.move(u+"]["),l();const f=n.stack;n.stack=[],l=n.enter("reference");const c=n.safe(n.associationId(e),{before:s,after:"]",...o.current()});return l(),n.stack=f,a(),i==="full"||!u||u!==c?s+=o.move(c+"]"):i==="shortcut"?s=s.slice(0,-1):s+=o.move("]"),s}function gd(){return"["}function Fn(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function xd(e){const t=Fn(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function bd(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function Hi(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function kd(e,t,n,r){const i=n.enter("list"),a=n.bulletCurrent;let l=e.ordered?bd(n):Fn(n);const o=e.ordered?l==="."?")":".":xd(n);let s=t&&n.bulletLastUsed?l===n.bulletLastUsed:!1;if(!e.ordered){const f=e.children?e.children[0]:void 0;if((l==="*"||l==="-")&&f&&(!f.children||!f.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(s=!0),Hi(n)===l&&f){let c=-1;for(;++c<e.children.length;){const p=e.children[c];if(p&&p.type==="listItem"&&p.children&&p.children[0]&&p.children[0].type==="thematicBreak"){s=!0;break}}}}s&&(l=o),n.bulletCurrent=l;const u=n.containerFlow(e,r);return n.bulletLastUsed=l,n.bulletCurrent=a,i(),u}function yd(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function wd(e,t,n,r){const i=yd(n);let a=n.bulletCurrent||Fn(n);t&&t.type==="list"&&t.ordered&&(a=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let l=a.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(l=Math.ceil(l/4)*4);const o=n.createTracker(r);o.move(a+" ".repeat(l-a.length)),o.shift(l);const s=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,o.current()),f);return s(),u;function f(c,p,d){return p?(d?"":" ".repeat(l))+c:(d?a:a+" ".repeat(l-a.length))+c}}function Sd(e,t,n,r){const i=n.enter("paragraph"),a=n.enter("phrasing"),l=n.containerPhrasing(e,r);return a(),i(),l}const Cd=Rt(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function vd(e,t,n,r){return(e.children.some(function(l){return Cd(l)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function Ed(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Ki.peek=Id;function Ki(e,t,n,r){const i=Ed(n),a=n.enter("strong"),l=n.createTracker(r),o=l.move(i+i);let s=l.move(n.containerPhrasing(e,{after:i,before:o,...l.current()}));const u=s.charCodeAt(0),f=Lt(r.before.charCodeAt(r.before.length-1),u,i);f.inside&&(s=gt(u)+s.slice(1));const c=s.charCodeAt(s.length-1),p=Lt(r.after.charCodeAt(0),c,i);p.inside&&(s=s.slice(0,-1)+gt(c));const d=l.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:p.outside,before:f.outside},o+s+d}function Id(e,t,n){return n.options.strong||"*"}function jd(e,t,n,r){return n.safe(e.value,r)}function Ad(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function Nd(e,t,n){const r=(Hi(n)+(n.options.ruleSpaces?" ":"")).repeat(Ad(n));return n.options.ruleSpaces?r.slice(0,-1):r}const Vi={blockquote:Jf,break:Pr,code:id,definition:ad,emphasis:Di,hardBreak:Pr,heading:cd,html:Fi,image:Mi,imageReference:Ri,inlineCode:Oi,link:$i,linkReference:Ui,list:kd,listItem:wd,paragraph:Sd,root:vd,strong:Ki,text:jd,thematicBreak:Nd};function _d(){return{enter:{table:Td,tableData:Lr,tableHeader:Lr,tableRow:Pd},exit:{codeText:Ld,table:zd,tableData:ln,tableHeader:ln,tableRow:ln}}}function Td(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function zd(e){this.exit(e),this.data.inTable=void 0}function Pd(e){this.enter({type:"tableRow",children:[]},e)}function ln(e){this.exit(e)}function Lr(e){this.enter({type:"tableCell",children:[]},e)}function Ld(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Dd));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function Dd(e,t){return t==="|"?t:e}function Fd(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
85
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:p,table:l,tableCell:s,tableRow:o}};function l(d,x,S,C){return u(f(d,S,C),d.align)}function o(d,x,S,C){const b=c(d,S,C),E=u([b]);return E.slice(0,E.indexOf(`
86
+ `))}function s(d,x,S,C){const b=S.enter("tableCell"),E=S.enter("phrasing"),v=S.containerPhrasing(d,{...C,before:a,after:a});return E(),b(),v}function u(d,x){return Qf(d,{align:x,alignDelimiters:r,padding:n,stringLength:i})}function f(d,x,S){const C=d.children;let b=-1;const E=[],v=x.enter("table");for(;++b<C.length;)E[b]=c(C[b],x,S);return v(),E}function c(d,x,S){const C=d.children;let b=-1;const E=[],v=x.enter("tableRow");for(;++b<C.length;)E[b]=s(C[b],d,x,S);return v(),E}function p(d,x,S){let C=Vi.inlineCode(d,x,S);return S.stack.includes("tableCell")&&(C=C.replace(/\|/g,"\\$&")),C}}function Md(){return{exit:{taskListCheckValueChecked:Dr,taskListCheckValueUnchecked:Dr,paragraph:Od}}}function Rd(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Bd}}}function Dr(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function Od(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=t.children;let a=-1,l;for(;++a<i.length;){const o=i[a];if(o.type==="paragraph"){l=o;break}}l===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function Bd(e,t,n,r){const i=e.children[0],a=typeof e.checked=="boolean"&&i&&i.type==="paragraph",l="["+(e.checked?"x":" ")+"] ",o=n.createTracker(r);a&&o.move(l);let s=Vi.listItem(e,t,n,{...r,...o.current()});return a&&(s=s.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),s;function u(f){return f+l}}function $d(){return[kf(),Bf(),Kf(),_d(),Md()]}function Ud(e){return{extensions:[yf(),$f(e),Vf(),Fd(e),Rd()]}}const Hd={tokenize:Xd,partial:!0},qi={tokenize:Qd,partial:!0},Wi={tokenize:Gd,partial:!0},Yi={tokenize:Jd,partial:!0},Kd={tokenize:Zd,partial:!0},Xi={name:"wwwAutolink",tokenize:Wd,previous:Gi},Qi={name:"protocolAutolink",tokenize:Yd,previous:Ji},Le={name:"emailAutolink",tokenize:qd,previous:Zi},Ne={};function Vd(){return{text:Ne}}let We=48;for(;We<123;)Ne[We]=Le,We++,We===58?We=65:We===91&&(We=97);Ne[43]=Le;Ne[45]=Le;Ne[46]=Le;Ne[95]=Le;Ne[72]=[Le,Qi];Ne[104]=[Le,Qi];Ne[87]=[Le,Xi];Ne[119]=[Le,Xi];function qd(e,t,n){const r=this;let i,a;return l;function l(c){return!gn(c)||!Zi.call(r,r.previous)||Mn(r.events)?n(c):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),o(c))}function o(c){return gn(c)?(e.consume(c),o):c===64?(e.consume(c),s):n(c)}function s(c){return c===46?e.check(Kd,f,u)(c):c===45||c===95||fe(c)?(a=!0,e.consume(c),s):f(c)}function u(c){return e.consume(c),i=!0,s}function f(c){return a&&i&&he(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(c)):n(c)}}function Wd(e,t,n){const r=this;return i;function i(l){return l!==87&&l!==119||!Gi.call(r,r.previous)||Mn(r.events)?n(l):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Hd,e.attempt(qi,e.attempt(Wi,a),n),n)(l))}function a(l){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(l)}}function Yd(e,t,n){const r=this;let i="",a=!1;return l;function l(c){return(c===72||c===104)&&Ji.call(r,r.previous)&&!Mn(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(c),e.consume(c),o):n(c)}function o(c){if(he(c)&&i.length<5)return i+=String.fromCodePoint(c),e.consume(c),o;if(c===58){const p=i.toLowerCase();if(p==="http"||p==="https")return e.consume(c),s}return n(c)}function s(c){return c===47?(e.consume(c),a?u:(a=!0,s)):n(c)}function u(c){return c===null||Tt(c)||ie(c)||Ye(c)||Dt(c)?n(c):e.attempt(qi,e.attempt(Wi,f),n)(c)}function f(c){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(c)}}function Xd(e,t,n){let r=0;return i;function i(l){return(l===87||l===119)&&r<3?(r++,e.consume(l),i):l===46&&r===3?(e.consume(l),a):n(l)}function a(l){return l===null?n(l):t(l)}}function Qd(e,t,n){let r,i,a;return l;function l(u){return u===46||u===95?e.check(Yi,s,o)(u):u===null||ie(u)||Ye(u)||u!==45&&Dt(u)?s(u):(a=!0,e.consume(u),l)}function o(u){return u===95?r=!0:(i=r,r=void 0),e.consume(u),l}function s(u){return i||r||!a?n(u):t(u)}}function Gd(e,t){let n=0,r=0;return i;function i(l){return l===40?(n++,e.consume(l),i):l===41&&r<n?a(l):l===33||l===34||l===38||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===60||l===63||l===93||l===95||l===126?e.check(Yi,t,a)(l):l===null||ie(l)||Ye(l)?t(l):(e.consume(l),i)}function a(l){return l===41&&r++,e.consume(l),i}}function Jd(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||ie(o)||Ye(o)?t(o):n(o)}function i(o){return o===null||o===40||o===91||ie(o)||Ye(o)?t(o):r(o)}function a(o){return he(o)?l(o):n(o)}function l(o){return o===59?(e.consume(o),r):he(o)?(e.consume(o),l):n(o)}}function Zd(e,t,n){return r;function r(a){return e.consume(a),i}function i(a){return fe(a)?n(a):t(a)}}function Gi(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||ie(e)}function Ji(e){return!he(e)}function Zi(e){return!(e===47||gn(e))}function gn(e){return e===43||e===45||e===46||e===95||fe(e)}function Mn(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const ep={tokenize:sp,partial:!0};function tp(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:lp,continuation:{tokenize:ap},exit:op}},text:{91:{name:"gfmFootnoteCall",tokenize:ip},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:np,resolveTo:rp}}}}function np(e,t,n){const r=this;let i=r.events.length;const a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l;for(;i--;){const s=r.events[i][1];if(s.type==="labelImage"){l=s;break}if(s.type==="gfmFootnoteCall"||s.type==="labelLink"||s.type==="label"||s.type==="image"||s.type==="link")break}return o;function o(s){if(!l||!l._balanced)return n(s);const u=ve(r.sliceSerialize({start:l.end,end:r.now()}));return u.codePointAt(0)!==94||!a.includes(u.slice(1))?n(s):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(s),e.exit("gfmFootnoteCallLabelMarker"),t(s))}}function rp(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const a={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},l={type:"chunkString",contentType:"string",start:Object.assign({},a.start),end:Object.assign({},a.end)},o=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",a,t],["enter",l,t],["exit",l,t],["exit",a,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...o),e}function ip(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a=0,l;return o;function o(c){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),s}function s(c){return c!==94?n(c):(e.enter("gfmFootnoteCallMarker"),e.consume(c),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(c){if(a>999||c===93&&!l||c===null||c===91||ie(c))return n(c);if(c===93){e.exit("chunkString");const p=e.exit("gfmFootnoteCallString");return i.includes(ve(r.sliceSerialize(p)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(c)}return ie(c)||(l=!0),a++,e.consume(c),c===92?f:u}function f(c){return c===91||c===92||c===93?(e.consume(c),a++,u):u(c)}}function lp(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a,l=0,o;return s;function s(x){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(x){return x===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",f):n(x)}function f(x){if(l>999||x===93&&!o||x===null||x===91||ie(x))return n(x);if(x===93){e.exit("chunkString");const S=e.exit("gfmFootnoteDefinitionLabelString");return a=ve(r.sliceSerialize(S)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),p}return ie(x)||(o=!0),l++,e.consume(x),x===92?c:f}function c(x){return x===91||x===92||x===93?(e.consume(x),l++,f):f(x)}function p(x){return x===58?(e.enter("definitionMarker"),e.consume(x),e.exit("definitionMarker"),i.includes(a)||i.push(a),te(e,d,"gfmFootnoteDefinitionWhitespace")):n(x)}function d(x){return t(x)}}function ap(e,t,n){return e.check(bt,t,e.attempt(ep,t,n))}function op(e){e.exit("gfmFootnoteDefinition")}function sp(e,t,n){const r=this;return te(e,i,"gfmFootnoteDefinitionIndent",5);function i(a){const l=r.events[r.events.length-1];return l&&l[1].type==="gfmFootnoteDefinitionIndent"&&l[2].sliceSerialize(l[1],!0).length===4?t(a):n(a)}}function up(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:a,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(l,o){let s=-1;for(;++s<l.length;)if(l[s][0]==="enter"&&l[s][1].type==="strikethroughSequenceTemporary"&&l[s][1]._close){let u=s;for(;u--;)if(l[u][0]==="exit"&&l[u][1].type==="strikethroughSequenceTemporary"&&l[u][1]._open&&l[s][1].end.offset-l[s][1].start.offset===l[u][1].end.offset-l[u][1].start.offset){l[s][1].type="strikethroughSequence",l[u][1].type="strikethroughSequence";const f={type:"strikethrough",start:Object.assign({},l[u][1].start),end:Object.assign({},l[s][1].end)},c={type:"strikethroughText",start:Object.assign({},l[u][1].end),end:Object.assign({},l[s][1].start)},p=[["enter",f,o],["enter",l[u][1],o],["exit",l[u][1],o],["enter",c,o]],d=o.parser.constructs.insideSpan.null;d&&we(p,p.length,0,Ft(d,l.slice(u+1,s),o)),we(p,p.length,0,[["exit",c,o],["enter",l[s][1],o],["exit",l[s][1],o],["exit",f,o]]),we(l,u-1,s-u+3,p),s=u+p.length-2;break}}for(s=-1;++s<l.length;)l[s][1].type==="strikethroughSequenceTemporary"&&(l[s][1].type="data");return l}function a(l,o,s){const u=this.previous,f=this.events;let c=0;return p;function p(x){return u===126&&f[f.length-1][1].type!=="characterEscape"?s(x):(l.enter("strikethroughSequenceTemporary"),d(x))}function d(x){const S=nt(u);if(x===126)return c>1?s(x):(l.consume(x),c++,d);if(c<2&&!n)return s(x);const C=l.exit("strikethroughSequenceTemporary"),b=nt(x);return C._open=!b||b===2&&!!S,C._close=!S||S===2&&!!b,o(x)}}}class cp{constructor(){this.map=[]}add(t,n,r){fp(this,t,n,r)}consume(t){if(this.map.sort(function(a,l){return a[0]-l[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(const a of i)t.push(a);i=r.pop()}this.map.length=0}}function fp(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function dp(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const a=r.length-1;r[a]=r[a]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function pp(){return{flow:{null:{name:"table",tokenize:hp,resolveAll:mp}}}}function hp(e,t,n){const r=this;let i=0,a=0,l;return o;function o(w){let j=r.events.length-1;for(;j>-1;){const F=r.events[j][1].type;if(F==="lineEnding"||F==="linePrefix")j--;else break}const A=j>-1?r.events[j][1].type:null,$=A==="tableHead"||A==="tableRow"?y:s;return $===y&&r.parser.lazy[r.now().line]?n(w):$(w)}function s(w){return e.enter("tableHead"),e.enter("tableRow"),u(w)}function u(w){return w===124||(l=!0,a+=1),f(w)}function f(w){return w===null?n(w):q(w)?a>1?(a=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),d):n(w):J(w)?te(e,f,"whitespace")(w):(a+=1,l&&(l=!1,i+=1),w===124?(e.enter("tableCellDivider"),e.consume(w),e.exit("tableCellDivider"),l=!0,f):(e.enter("data"),c(w)))}function c(w){return w===null||w===124||ie(w)?(e.exit("data"),f(w)):(e.consume(w),w===92?p:c)}function p(w){return w===92||w===124?(e.consume(w),c):c(w)}function d(w){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(w):(e.enter("tableDelimiterRow"),l=!1,J(w)?te(e,x,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(w):x(w))}function x(w){return w===45||w===58?C(w):w===124?(l=!0,e.enter("tableCellDivider"),e.consume(w),e.exit("tableCellDivider"),S):N(w)}function S(w){return J(w)?te(e,C,"whitespace")(w):C(w)}function C(w){return w===58?(a+=1,l=!0,e.enter("tableDelimiterMarker"),e.consume(w),e.exit("tableDelimiterMarker"),b):w===45?(a+=1,b(w)):w===null||q(w)?O(w):N(w)}function b(w){return w===45?(e.enter("tableDelimiterFiller"),E(w)):N(w)}function E(w){return w===45?(e.consume(w),E):w===58?(l=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(w),e.exit("tableDelimiterMarker"),v):(e.exit("tableDelimiterFiller"),v(w))}function v(w){return J(w)?te(e,O,"whitespace")(w):O(w)}function O(w){return w===124?x(w):w===null||q(w)?!l||i!==a?N(w):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(w)):N(w)}function N(w){return n(w)}function y(w){return e.enter("tableRow"),k(w)}function k(w){return w===124?(e.enter("tableCellDivider"),e.consume(w),e.exit("tableCellDivider"),k):w===null||q(w)?(e.exit("tableRow"),t(w)):J(w)?te(e,k,"whitespace")(w):(e.enter("data"),R(w))}function R(w){return w===null||w===124||ie(w)?(e.exit("data"),k(w)):(e.consume(w),w===92?B:R)}function B(w){return w===92||w===124?(e.consume(w),R):R(w)}}function mp(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],l=[0,0,0,0],o=!1,s=0,u,f,c;const p=new cp;for(;++n<e.length;){const d=e[n],x=d[1];d[0]==="enter"?x.type==="tableHead"?(o=!1,s!==0&&(Fr(p,t,s,u,f),f=void 0,s=0),u={type:"table",start:Object.assign({},x.start),end:Object.assign({},x.end)},p.add(n,0,[["enter",u,t]])):x.type==="tableRow"||x.type==="tableDelimiterRow"?(r=!0,c=void 0,a=[0,0,0,0],l=[0,n+1,0,0],o&&(o=!1,f={type:"tableBody",start:Object.assign({},x.start),end:Object.assign({},x.end)},p.add(n,0,[["enter",f,t]])),i=x.type==="tableDelimiterRow"?2:f?3:1):i&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")?(r=!1,l[2]===0&&(a[1]!==0&&(l[0]=l[1],c=At(p,t,a,i,void 0,c),a=[0,0,0,0]),l[2]=n)):x.type==="tableCellDivider"&&(r?r=!1:(a[1]!==0&&(l[0]=l[1],c=At(p,t,a,i,void 0,c)),a=l,l=[a[1],n,0,0])):x.type==="tableHead"?(o=!0,s=n):x.type==="tableRow"||x.type==="tableDelimiterRow"?(s=n,a[1]!==0?(l[0]=l[1],c=At(p,t,a,i,n,c)):l[1]!==0&&(c=At(p,t,l,i,n,c)),i=0):i&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")&&(l[3]=n)}for(s!==0&&Fr(p,t,s,u,f),p.consume(t.events),n=-1;++n<t.events.length;){const d=t.events[n];d[0]==="enter"&&d[1].type==="table"&&(d[1]._align=dp(t.events,n))}return e}function At(e,t,n,r,i,a){const l=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",o="tableContent";n[0]!==0&&(a.end=Object.assign({},et(t.events,n[0])),e.add(n[0],0,[["exit",a,t]]));const s=et(t.events,n[1]);if(a={type:l,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[["enter",a,t]]),n[2]!==0){const u=et(t.events,n[2]),f=et(t.events,n[3]),c={type:o,start:Object.assign({},u),end:Object.assign({},f)};if(e.add(n[2],0,[["enter",c,t]]),r!==2){const p=t.events[n[2]],d=t.events[n[3]];if(p[1].end=Object.assign({},d[1].end),p[1].type="chunkText",p[1].contentType="text",n[3]>n[2]+1){const x=n[2]+1,S=n[3]-n[2]-1;e.add(x,S,[])}}e.add(n[3]+1,0,[["exit",c,t]])}return i!==void 0&&(a.end=Object.assign({},et(t.events,i)),e.add(i,0,[["exit",a,t]]),a=void 0),a}function Fr(e,t,n,r,i){const a=[],l=et(t.events,n);i&&(i.end=Object.assign({},l),a.push(["exit",i,t])),r.end=Object.assign({},l),a.push(["exit",r,t]),e.add(n+1,0,a)}function et(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const gp={name:"tasklistCheck",tokenize:bp};function xp(){return{text:{91:gp}}}function bp(e,t,n){const r=this;return i;function i(s){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(s):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(s),e.exit("taskListCheckMarker"),a)}function a(s){return ie(s)?(e.enter("taskListCheckValueUnchecked"),e.consume(s),e.exit("taskListCheckValueUnchecked"),l):s===88||s===120?(e.enter("taskListCheckValueChecked"),e.consume(s),e.exit("taskListCheckValueChecked"),l):n(s)}function l(s){return s===93?(e.enter("taskListCheckMarker"),e.consume(s),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):n(s)}function o(s){return q(s)?t(s):J(s)?e.check({tokenize:kp},t,n)(s):n(s)}}function kp(e,t,n){return te(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function yp(e){return ci([Vd(),tp(),up(e),pp(),xp()])}const wp={};function Mr(e){const t=this,n=e||wp,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),a=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),l=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(yp(n)),a.push($d()),l.push(Ud(n))}const Sp=/(^|\n) {0,3}(?:`{3,}|~{3,})[^\n]*(?:\n|$)/,Cp=/(^|\n)(?: {4}|\t)\S/;function vp(e){return Sp.test(e)||Cp.test(e)}const Ep=T.lazy(()=>gl(()=>import("./HighlightedMarkdown-CsM5n70d.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]),import.meta.url).then(e=>({default:e.HighlightedMarkdown})));function Ip({content:e,isUser:t}){const r=vp(e)?g.jsx(T.Suspense,{fallback:g.jsx(Nr,{remarkPlugins:[Mr],children:e}),children:g.jsx(Ep,{content:e})}):g.jsx(Nr,{remarkPlugins:[Mr],children:e});return t?g.jsx("div",{className:"prose prose-sm max-w-none text-inherit [&_*]:text-inherit [&_a]:underline [&_code]:border [&_code]:border-black/10 [&_code]:bg-black/10 [&_code]:text-inherit dark:[&_code]:border-white/10 dark:[&_code]:bg-white/12 [&>p]:my-0.5 [&_li]:my-0",children:r}):g.jsx("div",{className:pe("prose max-w-none dark:prose-invert","prose-headings:font-semibold prose-headings:tracking-tight","prose-h1:text-xl prose-h1:mt-5 prose-h1:mb-3 prose-h1:pb-1.5 prose-h1:border-b prose-h1:border-gray-200 dark:prose-h1:border-gray-700","prose-h2:text-lg prose-h2:mt-5 prose-h2:mb-2","prose-h3:text-base prose-h3:mt-4 prose-h3:mb-2","prose-p:my-2.5 prose-p:leading-relaxed","prose-li:my-0.5","prose-ul:my-2 prose-ol:my-2","prose-a:text-accent prose-a:no-underline hover:prose-a:underline","prose-strong:text-gray-900 dark:prose-strong:text-white prose-strong:font-semibold","prose-blockquote:border-l-[3px] prose-blockquote:border-accent/40 prose-blockquote:bg-accent/[0.03] prose-blockquote:rounded-r-lg prose-blockquote:py-0.5 prose-blockquote:px-4 prose-blockquote:my-3 prose-blockquote:not-italic prose-blockquote:text-gray-600 dark:prose-blockquote:text-gray-300","prose-hr:my-5 prose-hr:border-gray-200 dark:prose-hr:border-gray-700","prose-table:text-sm prose-th:bg-gray-50 dark:prose-th:bg-gray-800 prose-th:px-3 prose-th:py-2 prose-td:px-3 prose-td:py-2 prose-th:border-gray-200 dark:prose-th:border-gray-700 prose-td:border-gray-200 dark:prose-td:border-gray-700","prose-img:rounded-lg prose-img:shadow-sm"),children:r})}function jp({card:e}){const t=e.status.toLowerCase()==="completed",[n,r]=T.useState(()=>!$a(e)),i=!!e.output.trim();return g.jsxs("div",{className:"overflow-hidden rounded-[18px] border border-slate-200 bg-[#f5f5f7] dark:border-white/[0.08] dark:bg-[#111214]",children:[g.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-slate-200/80 px-4 py-3 dark:border-white/[0.06]",children:[g.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[g.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary dark:text-primary",children:g.jsx(xl,{size:14})}),g.jsxs("div",{className:"min-w-0",children:[g.jsx("p",{className:"truncate text-sm font-semibold text-slate-800 dark:text-slate-100",children:e.title}),g.jsxs("p",{className:"mt-0.5 flex items-center gap-1.5 text-[11px] text-slate-500 dark:text-slate-400",children:[g.jsx(ia,{size:12}),g.jsx("span",{className:"truncate",children:e.subtitle||e.label})]})]})]}),g.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[g.jsx("span",{className:pe("rounded-full px-2.5 py-1 text-[10px] font-medium uppercase tracking-[0.12em]",t?"bg-primary/10 text-primary dark:text-primary":"bg-amber-500/10 text-amber-700 dark:text-amber-300"),children:e.status}),i?g.jsx("button",{type:"button","aria-expanded":n,"aria-label":n?"折叠工具结果":"展开工具结果","data-testid":"desktop-tool-result-toggle",onClick:()=>r(a=>!a),className:"flex h-7 w-7 items-center justify-center rounded-full border border-slate-200 bg-white text-slate-500 transition hover:border-slate-300 hover:text-slate-700 dark:border-white/[0.08] dark:bg-white/[0.05] dark:text-slate-300 dark:hover:bg-white/[0.08]",children:n?g.jsx(_l,{size:14}):g.jsx(Bn,{size:14})}):null]})]}),n?g.jsx("pre",{className:"max-h-72 overflow-auto whitespace-pre-wrap break-words px-4 py-3 font-mono text-[12px] leading-5 text-slate-700 [scrollbar-gutter:stable] dark:text-slate-200",children:e.output||"无输出"}):g.jsxs("button",{type:"button",onClick:()=>r(!0),className:"flex w-full items-center gap-2 px-4 py-3 text-left text-xs text-slate-500 transition hover:bg-slate-100/70 dark:text-slate-400 dark:hover:bg-white/[0.04]",children:[g.jsx(Bn,{size:14}),g.jsx("span",{className:"truncate",children:"工具结果已折叠"})]})]})}function Ap({card:e,className:t,testId:n="desktop-chat-permission-card",loading:r,onAction:i}){const a=Ua(e.content);return g.jsxs("div",{"data-testid":n,className:pe("overflow-hidden rounded-[18px] border border-amber-200 bg-[#fff8eb] dark:border-amber-400/20 dark:bg-amber-500/10",t),children:[g.jsx("div",{className:"flex items-center justify-between gap-3 border-b border-amber-200/80 px-4 py-3 dark:border-amber-400/15",children:g.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[g.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-amber-100 text-amber-700 dark:bg-amber-400/15 dark:text-amber-200",children:g.jsx(Tl,{size:14})}),g.jsxs("div",{className:"min-w-0",children:[g.jsx("p",{className:"truncate text-sm font-semibold text-amber-950 dark:text-amber-50",children:a.title}),g.jsx("p",{className:"mt-0.5 text-[11px] text-amber-700/80 dark:text-amber-100/70",children:"权限响应"})]})]})}),a.bodyLines.length>0?g.jsx("div",{className:"space-y-2 px-4 py-3 text-sm leading-6 text-amber-950 dark:text-amber-50",children:a.bodyLines.map((l,o)=>g.jsx("p",{className:"break-words",children:l},`${e.id}-permission-line-${o}`))}):null,e.actionStatus?g.jsx("p",{className:"border-t border-amber-200/80 px-4 py-3 text-xs text-amber-700 dark:border-amber-400/15 dark:text-amber-100",children:e.actionStatus}):null,e.actions.length>0?g.jsx("div",{className:"flex flex-wrap gap-2 border-t border-amber-200/80 px-4 py-3 dark:border-amber-400/15",children:e.actions.flat().map(l=>g.jsx(ce,{size:"sm",variant:"secondary",onClick:()=>i(l),disabled:!!(e.actionPending||r),loading:r,className:"rounded-full border border-amber-300 bg-white text-amber-900 hover:bg-amber-100 dark:border-amber-400/30 dark:bg-white/[0.08] dark:text-amber-50 dark:hover:bg-white/[0.12]",children:l.text||l.data},`${e.id}-${l.data||l.text}`))}):null]})}function Np({message:e,pendingBridgeActionId:t,onAction:n}){const r=e.role==="user",i=e.role==="system",a=!r&&!i&&e.kind==="progress",l=r?null:Ra(e.toolCall),o=!!l;return g.jsxs("div",{className:pe("flex gap-3 sm:gap-4",r?"justify-end":"justify-start"),children:[r?null:g.jsx("div",{className:pe("mt-1 flex shrink-0 items-center justify-center rounded-full text-slate-400 dark:text-slate-500",i?"h-7 w-7 bg-amber-100 text-amber-600 dark:bg-amber-500/12 dark:text-amber-300":a?"h-6 w-6 bg-[#f0f0f0] dark:bg-white/[0.04]":"h-8 w-8 bg-[#f5f5f7] dark:bg-white/[0.06]"),children:i?g.jsx(Br,{size:14}):a?g.jsx(_t,{size:7,className:"fill-current"}):g.jsx(Il,{size:14})}),g.jsx("div",{"data-testid":"desktop-chat-message","data-role":e.role,"data-kind":e.kind||"final","data-order":String(e.order),"data-timestamp":e.timestamp||"",className:pe("transition-all",r?"max-w-[calc(100%-2.25rem)] sm:max-w-[70%]":o?"max-w-[calc(100%-2.25rem)] sm:max-w-[80%]":a?"max-w-[calc(100%-2.25rem)] sm:max-w-[72%]":"max-w-[calc(100%-2.25rem)] sm:max-w-[78%]"),children:g.jsxs("div",{className:pe("rounded-[20px] px-4 py-3 text-sm",r?"chat-user-glass rounded-br-sm text-slate-950 dark:text-slate-50":i?"rounded-bl-sm border border-amber-200/80 bg-[#fff8eb] text-amber-900 dark:border-amber-400/20 dark:bg-amber-500/10 dark:text-amber-100":a?"rounded-bl-lg bg-[#f5f5f7] text-[13px] leading-6 text-slate-500 dark:bg-white/[0.04] dark:text-slate-400":"rounded-bl-sm border border-slate-200 bg-[#fbfbfd] text-slate-800 dark:border-white/[0.06] dark:bg-white/[0.04] dark:text-slate-100",o&&"bg-transparent p-0 shadow-none dark:bg-transparent"),children:[g.jsxs("div",{className:pe("mb-2 flex items-center gap-2 text-[10px]",r?"justify-end text-slate-500 dark:text-white/55":"text-slate-400 dark:text-slate-500"),children:[i?g.jsx("span",{className:"tracking-[0.14em] text-amber-600 dark:text-amber-300",children:"系统"}):null,a?g.jsx("span",{className:"tracking-[0.14em] text-amber-500 dark:text-amber-300",children:o?"工具":"过程"}):null,qn(e.timestamp)?g.jsx("span",{"data-testid":"desktop-chat-message-timestamp",children:qn(e.timestamp)}):null]}),!r&&e.preview&&e.previewPlainText?g.jsx("div",{className:"whitespace-pre-wrap break-words text-[13px] leading-6 text-inherit",children:e.content}):l?g.jsx(jp,{card:l}):g.jsx(Ip,{content:e.content,isUser:r}),!r&&e.actions&&e.actions.length>0?g.jsx("div",{className:"mt-4 space-y-2",children:e.actions.map((s,u)=>g.jsx("div",{className:"flex flex-wrap gap-2",children:s.map(f=>g.jsx(ce,{size:"sm",variant:String(f.data||"").includes("deny")?"danger":"secondary",onClick:()=>n(e,f),disabled:!!(e.actionPending||t),loading:t===e.id,"data-testid":"desktop-chat-action-button",className:"rounded-full",children:f.text||f.data},`${e.id}-${f.data||f.text}`))},`${e.id}-actions-${u}`))}):null,!r&&e.actionStatus?g.jsx("p",{className:pe("mt-3 text-xs",e.actionInteractive?"text-slate-500 dark:text-slate-400":"text-amber-700 dark:text-amber-200"),"data-testid":"desktop-chat-action-status",children:e.actionStatus}):null,e.preview?g.jsx("p",{className:"mt-2 text-[10px] uppercase tracking-[0.18em] text-primary dark:text-primary",children:"实时预览"}):null]})}),r?g.jsx("div",{className:"mt-1 flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-[#f0f0f0] dark:bg-white/[0.08] sm:h-8 sm:w-8",children:g.jsx(aa,{size:14,className:"text-slate-500 dark:text-slate-300"})}):null]})}function _p({activeSessionId:e,branding:t,filteredSessionGroups:n,hasVisibleSessions:r,isRuntimeStarting:i,mobileSessionsOpen:a,projects:l,runtime:o,selectedProject:s,serviceRunning:u,sessionSearch:f,showSessionKey:c,visibleProjects:p,onCreateNew:d,onLoadActiveSession:x,onOpenRenameModal:S,onRefreshRuntime:C,setDeleteTarget:b,setMobileSessionsOpen:E,setSelectedProject:v,setSessionSearch:O}){return g.jsxs("aside",{className:pe("min-h-0 flex-col border-r border-slate-200/80 bg-[#fbfbfd] dark:border-white/[0.06] dark:bg-[#111214]",a?"flex":"hidden md:flex","absolute inset-0 z-30 md:static md:z-auto"),children:[g.jsxs("div",{className:"border-b border-slate-200/80 px-4 py-4 dark:border-white/[0.06]",children:[g.jsxs("div",{className:"flex items-start justify-between gap-3",children:[g.jsxs("div",{className:"min-w-0",children:[g.jsx("p",{className:"text-[11px] font-medium tracking-[0.18em] text-slate-400 dark:text-slate-500",children:"会话导航"}),g.jsx("h2",{className:"mt-2 text-[1.65rem] font-semibold leading-tight text-slate-900 dark:text-white",children:t.chatHeading})]}),g.jsx(ce,{size:"sm",variant:"ghost",onClick:()=>void C(),className:"rounded-full border border-slate-200 bg-white text-slate-500 hover:bg-slate-100 dark:border-white/[0.08] dark:bg-white/[0.04] dark:text-slate-300 dark:hover:bg-white/[0.08]",children:g.jsx(ea,{size:14})}),g.jsx(ce,{size:"sm",variant:"ghost",onClick:()=>E(!1),className:"rounded-full border border-slate-200 bg-white text-slate-500 hover:bg-slate-100 dark:border-white/[0.08] dark:bg-white/[0.04] dark:text-slate-300 dark:hover:bg-white/[0.08] md:hidden",children:g.jsx($r,{size:14})})]}),g.jsxs("div",{className:"mt-4 space-y-3",children:[g.jsxs("div",{className:"space-y-2",children:[g.jsx("label",{className:"block text-[11px] font-medium tracking-[0.18em] text-slate-400 dark:text-slate-500",children:t.scopeLabel}),g.jsxs("select",{value:s,onChange:N=>v(N.target.value),"data-testid":"desktop-chat-project-select","aria-label":t.scopeLabel,className:"w-full rounded-[18px] border border-slate-200 bg-white px-3 py-2.5 text-sm text-slate-900 outline-none transition focus:border-primary/40 focus:ring-2 focus:ring-primary/10 dark:border-white/[0.08] dark:bg-[#0b1016] dark:text-white",children:[g.jsx("option",{value:"",children:t.scopeSelectPlaceholder}),p.map(N=>g.jsx("option",{value:N,children:N},N))]})]}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsxs(ce,{size:"md",variant:"secondary",onClick:()=>void d(),"data-testid":"desktop-chat-new-chat",className:"h-11 flex-1 rounded-full border border-slate-200 bg-white text-slate-700 hover:bg-slate-100 dark:border-white/[0.08] dark:bg-white/[0.05] dark:text-slate-100 dark:hover:bg-white/[0.09]",children:[g.jsx(Kr,{size:15}),t.newThreadLabel]}),!u||i?g.jsx(ce,{size:"md",onClick:()=>void bl().then(C),disabled:i||u,"data-testid":"desktop-chat-start-service",className:"h-11 shrink-0 rounded-2xl px-3.5",children:i?t.startingRuntimeLabel:t.startRuntimeLabel}):null]}),g.jsxs("div",{className:"relative",children:[g.jsx(Pl,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-400 dark:text-slate-500"}),g.jsx(xn,{value:f,onChange:N=>O(N.target.value),placeholder:t.searchPlaceholder,"aria-label":t.searchPlaceholder,"data-testid":"desktop-chat-session-search",className:"h-11 rounded-[18px] border-slate-200 bg-white pl-9 text-slate-900 placeholder:text-slate-400 dark:border-white/[0.08] dark:bg-[#0b1016] dark:text-white dark:placeholder:text-slate-500"})]}),g.jsx("div",{className:"flex items-center justify-between gap-3 rounded-[18px] border border-slate-200/80 bg-white px-3 py-2 dark:border-white/[0.06] dark:bg-white/[0.03]",children:g.jsxs("span",{className:"inline-flex items-center gap-2 text-xs font-medium text-slate-600 dark:text-slate-300",children:[g.jsx(_t,{size:7,className:pe("fill-current",u?"text-primary":"text-slate-300 dark:text-slate-500")}),u?"服务在线":i?"服务启动中":"服务未启动"]})})]}),o!=null&&o.service.lastError?g.jsx("div",{className:"mt-3 rounded-2xl border border-red-500/20 bg-red-50 px-3 py-2 text-xs text-red-600 dark:bg-red-500/10 dark:text-red-200",children:o.service.lastError}):null,o!=null&&o.pendingRestart?g.jsx("div",{className:"mt-3 rounded-2xl border border-amber-500/20 bg-amber-50 px-3 py-2 text-xs text-amber-700 dark:bg-amber-500/10 dark:text-amber-200",children:t.pendingRestartLabel}):null]}),g.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 pb-24 pt-3 [scrollbar-gutter:stable] md:pb-3",children:!s&&!r?g.jsxs("div",{className:"rounded-2xl border border-dashed border-slate-200/80 bg-white/70 px-4 py-6 text-center dark:border-white/[0.07] dark:bg-white/[0.02]",children:[g.jsx("p",{className:"text-sm font-medium text-slate-700 dark:text-slate-200",children:"先选择一个项目"}),g.jsx("p",{className:"mt-2 text-xs leading-5 text-slate-500 dark:text-slate-400",children:"选择项目后展示对应会话列表。"})]}):r?g.jsx("div",{className:"space-y-4",children:n.map(N=>g.jsxs("section",{className:"space-y-2",children:[!s&&N.sessions.length>0?g.jsxs("div",{"data-testid":"desktop-chat-session-group","data-project":N.project,className:"flex items-center justify-between px-2 pt-1",children:[g.jsx("p",{className:"text-[11px] font-medium tracking-[0.08em] text-slate-400 dark:text-slate-500",children:N.project}),g.jsxs("p",{className:"text-[10px] text-slate-400 dark:text-slate-500",children:[N.sessions.length," ",t.collectionLabel]})]}):null,N.sessions.map(y=>g.jsx("div",{"data-testid":"desktop-chat-session-row","data-session-id":y.id,"data-project":N.project,role:"button",tabIndex:0,onClick:()=>{x(N.project,y.id),E(!1)},onKeyDown:k=>{(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),x(N.project,y.id),E(!1))},className:pe("group relative overflow-hidden rounded-[18px] border px-4 py-3 text-left transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-primary/15",y.id===e?"border-primary/20 bg-primary/5 shadow-[inset_2px_0_0_0_rgba(0,102,204,0.92)] dark:border-primary/25 dark:bg-primary/10":"border-transparent bg-white hover:border-slate-200 hover:bg-[#fcfcfd] dark:bg-white/[0.03] dark:hover:border-white/[0.08] dark:hover:bg-white/[0.05]"),children:g.jsxs("div",{className:"flex items-start justify-between gap-3",children:[g.jsxs("div",{"data-testid":"desktop-chat-session-open","data-session-id":y.id,"data-project":N.project,className:"min-w-0 flex-1",children:[g.jsx("div",{className:"flex items-center gap-2",children:g.jsx("span",{className:"truncate text-sm font-medium text-slate-900 dark:text-white",children:y.name})}),g.jsx("p",{className:"mt-1 text-[11px] text-slate-400 dark:text-slate-500",children:kl(y.updatedAt||y.createdAt)}),y.excerpt?g.jsx("p",{className:"mt-2 line-clamp-2 text-[11px] leading-5 text-slate-500 dark:text-slate-400",children:y.excerpt.replace(/\n/g," ")}):null,c&&y.bridgeSessionKey?g.jsx("p",{className:"mt-2 truncate text-[11px] text-slate-400 dark:text-slate-500",children:y.bridgeSessionKey}):null]}),g.jsxs("div",{className:"flex items-center gap-1 opacity-0 transition-opacity duration-200 group-hover:opacity-100 focus-within:opacity-100",children:[g.jsx(ce,{size:"sm",variant:"ghost",onClick:k=>{k.stopPropagation(),S(N.project,y)},"data-testid":"desktop-chat-session-rename","data-session-id":y.id,"data-project":N.project,className:"text-slate-400 hover:bg-slate-100 hover:text-slate-900 dark:hover:bg-white/[0.08] dark:hover:text-white",children:g.jsx(Ll,{size:14})}),g.jsx(ce,{size:"sm",variant:"ghost",className:"text-red-400 hover:bg-red-50 hover:text-red-600 dark:hover:bg-red-500/10 dark:hover:text-red-200","data-testid":"desktop-chat-session-delete","data-session-id":y.id,"data-project":N.project,onClick:k=>{k.stopPropagation(),b({project:N.project,id:y.id,name:y.name})},children:g.jsx(Dl,{size:14})})]})]})},y.id))]},N.project))}):g.jsxs("div",{className:"rounded-2xl border border-dashed border-slate-200/80 bg-white/70 px-4 py-6 text-center dark:border-white/[0.07] dark:bg-white/[0.02]",children:[g.jsx("p",{className:"text-sm font-medium text-slate-700 dark:text-slate-200",children:f.trim()?"没有匹配的会话":"当前还没有桌面会话"}),g.jsx("p",{className:"mt-2 text-xs leading-5 text-slate-500 dark:text-slate-400",children:f.trim()?"换个关键词试试。":"发送第一条消息后,这里会出现新的会话记录。"})]})})]})}const Rr=[{value:"default",label:"请求批准",tone:"safe"},{value:"bypassPermissions",label:"完全访问",tone:"open"}];function Tp({activeRunId:e,activeAgentMode:t,activeSessionKey:n,availableKnowledgeBases:r,branding:i,composerPermissionCard:a,draft:l,pendingBridgeActionId:o,permissionModeSaving:s,selectedKnowledgeBaseIds:u,selectedProject:f,sending:c,serviceRunning:p,taskInputLocked:d,taskRunning:x,taskState:S,transportReady:C,onBridgeAction:b,onSend:E,onStopTask:v,setActiveAgentMode:O,setDraft:N,setSelectedKnowledgeBaseIds:y}){const[k,R]=T.useState(!1),B=T.useRef(null),[w,j]=T.useState(""),A=Xr(u,r),$=Ha(r,w),F=Ka($,u),_=u.length,L=Rr.some(P=>P.value===t)?t:"default",M=Qa({serviceRunning:p,transportReady:C,taskState:S,taskInputLocked:d,startFirstPlaceholder:i.startFirstPlaceholder,waitingRuntimePlaceholder:i.waitingRuntimePlaceholder,sendPlaceholder:i.sendPlaceholder}),H=Ga({draft:l,serviceRunning:p,transportReady:C,sending:c,selectedProject:f});return T.useEffect(()=>{const P=h=>{var U;(U=B.current)!=null&&U.contains(h.target)||R(!1)};return k&&document.addEventListener("mousedown",P),()=>{document.removeEventListener("mousedown",P)}},[k]),T.useEffect(()=>{if(!k)return;const P=window.requestAnimationFrame(()=>{var U;const h=(U=B.current)==null?void 0:U.querySelector("input");h instanceof HTMLInputElement&&h.focus()});return()=>window.cancelAnimationFrame(P)},[k]),g.jsx("div",{className:"border-t border-slate-200/80 px-3 py-3 dark:border-white/[0.06] sm:px-6",children:g.jsx("div",{className:"mx-auto max-w-4xl rounded-[24px] border border-slate-200 bg-[#fbfbfd] p-2 dark:border-white/[0.08] dark:bg-[#111214] sm:p-2.5",children:a?g.jsx(Ap,{card:a,loading:o===a.id,onAction:P=>void b(a,P),testId:"desktop-chat-composer-permission-card",className:"border-primary/45 bg-white shadow-[0_14px_34px_rgba(0,122,255,0.12)] dark:border-primary/35 dark:bg-[#090d12]"}):g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"relative",children:[g.jsx(zl,{"data-testid":"desktop-chat-input",value:l,onChange:P=>N(P.target.value),onKeyDown:P=>{P.key==="Enter"&&!P.shiftKey&&!d&&(P.preventDefault(),E())},rows:3,placeholder:M,"aria-label":M,disabled:!p||!C||c||!f||d,className:"min-h-[104px] rounded-[22px] border-slate-200 bg-white px-4 pb-16 pt-3 text-[15px] leading-6 text-slate-900 placeholder:text-slate-400 focus-visible:ring-primary/15 dark:border-white/[0.08] dark:bg-[#090d12] dark:text-white dark:placeholder:text-slate-500 sm:min-h-[116px] sm:px-5 sm:pt-4"}),x?g.jsxs(ce,{variant:"danger",onClick:()=>void v(),disabled:!n&&!e||S==="stopping","data-testid":"desktop-chat-stop-task",className:"absolute bottom-3 right-3 h-11 min-w-11 rounded-full bg-red-50 px-3 text-red-600 shadow-none hover:bg-red-100 dark:bg-red-500/12 dark:text-red-200 dark:hover:bg-red-500/18 sm:h-12 sm:min-w-[118px] sm:px-5",children:[g.jsx(Bt,{size:16,className:"animate-spin"}),g.jsx("span",{className:"hidden sm:inline",children:S==="stopping"?"停止中":"停止任务"})]}):g.jsx(ce,{onClick:()=>void E(),disabled:!H,"data-testid":"desktop-chat-send",className:"absolute bottom-3 right-3 h-11 w-11 rounded-full bg-primary px-0 text-white shadow-none hover:bg-[#0071e3] disabled:bg-slate-300 disabled:text-white disabled:opacity-100 dark:bg-primary dark:text-white dark:hover:bg-[#2997ff] dark:disabled:bg-white/20 dark:disabled:text-white/55 sm:h-12 sm:w-12",children:c?g.jsx(Bt,{size:18,className:"animate-spin"}):g.jsx(Vl,{size:22,strokeWidth:2.2})})]}),g.jsxs("div",{className:"mt-2 flex flex-col gap-2 px-1 pr-0 text-[11px] text-slate-500 dark:text-slate-400 sm:flex-row sm:items-center sm:justify-between sm:pr-[4.5rem]",children:[g.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[g.jsxs("div",{className:"inline-flex h-8 shrink-0 items-center gap-1 rounded-full border border-slate-200 bg-white p-1 shadow-sm dark:border-white/[0.08] dark:bg-white/[0.05]",role:"group","aria-label":"权限模式","data-testid":"desktop-chat-permission-mode",children:[g.jsx(na,{size:13,className:"ml-1 text-amber-500"}),Rr.map(P=>{const h=L===P.value;return g.jsx("button",{type:"button",disabled:!f||s||x,onClick:()=>O(P.value),"data-testid":`desktop-chat-permission-mode-${P.value}`,className:pe("h-6 rounded-full px-2.5 text-xs font-medium transition-colors",h?P.tone==="open"?"bg-amber-100 text-amber-800 dark:bg-amber-500/18 dark:text-amber-100":"bg-slate-900 text-white dark:bg-white dark:text-slate-950":"text-slate-500 hover:bg-slate-100 hover:text-slate-900 dark:text-slate-300 dark:hover:bg-white/[0.08] dark:hover:text-white","disabled:cursor-not-allowed disabled:opacity-50"),children:P.label},P.value)}),s?g.jsx(Bt,{size:12,className:"mr-1 animate-spin text-slate-400"}):null]}),g.jsxs("div",{className:"relative",ref:B,children:[g.jsxs(ce,{size:"sm",variant:"secondary",disabled:!f,onClick:()=>R(P=>!P),"data-testid":"desktop-chat-knowledge-base-toggle",className:"h-8 rounded-full border border-slate-200 bg-white px-2.5 text-xs text-slate-700 shadow-sm hover:bg-slate-100 dark:border-white/[0.08] dark:bg-white/[0.05] dark:text-slate-100 dark:hover:bg-white/[0.1]",children:[g.jsx(Yl,{size:13}),_>0?"调整知识库":"选择知识库"]}),k?g.jsxs("div",{className:"animate-float-in absolute bottom-full left-0 z-20 mb-3 w-[min(34rem,calc(100vw-2rem))] max-h-[70dvh] overflow-hidden rounded-[22px] border border-slate-200 bg-white p-3 shadow-[0_18px_45px_rgba(15,23,42,0.12)] dark:border-white/[0.08] dark:bg-[#0c1117]",children:[g.jsxs("div",{className:"flex items-center justify-between gap-3",children:[g.jsxs("div",{children:[g.jsx("p",{className:"text-sm font-semibold text-slate-900 dark:text-white",children:"选择知识库"}),g.jsx("p",{className:"text-[11px] text-slate-400",children:"已选项排在前面,方便快速确认范围。"})]}),_>0?g.jsx("button",{type:"button",onClick:()=>void y([]),className:"text-xs text-slate-400 transition-colors hover:text-slate-900 dark:hover:text-white",children:"清空"}):null]}),g.jsx(xn,{value:w,onChange:P=>j(P.target.value),placeholder:"搜索知识库","aria-label":"搜索知识库",className:"mt-3 rounded-[18px] border-slate-200 bg-white text-slate-900 placeholder:text-slate-400 dark:border-white/[0.08] dark:bg-white/[0.04] dark:text-white dark:placeholder:text-slate-500"}),g.jsx("div",{className:"mt-3 max-h-64 space-y-2 overflow-y-auto pr-2 [scrollbar-gutter:stable]",children:F.length===0?g.jsx("div",{className:"rounded-xl border border-dashed border-slate-200 px-3 py-4 text-center text-xs text-slate-500 dark:border-white/[0.08]",children:"没有匹配的知识库"}):F.map(P=>{const h=u.includes(P.id);return g.jsxs("button",{type:"button",onClick:()=>void y(h?u.filter(U=>U!==P.id):[...u,P.id]),"data-testid":"desktop-chat-knowledge-base-select",className:pe("flex w-full items-start gap-3 rounded-[16px] border px-3 py-3 text-left transition-all duration-200",h?"border-primary/25 bg-primary/5 dark:border-primary/30 dark:bg-primary/10":"border-slate-200 bg-white hover:border-slate-300 hover:bg-[#fafafa] dark:border-white/[0.06] dark:bg-white/[0.03] dark:hover:border-white/[0.12] dark:hover:bg-white/[0.05]"),children:[g.jsx("span",{className:pe("mt-0.5 inline-flex h-5 w-5 items-center justify-center rounded-full border text-[10px]",h?"border-primary bg-primary text-white":"border-slate-300 text-transparent dark:border-white/[0.12]"),children:g.jsx(Br,{size:12})}),g.jsxs("span",{className:"min-w-0 flex-1",children:[g.jsx("span",{className:"block truncate text-sm font-medium text-slate-900 dark:text-white",children:P.name}),g.jsxs("span",{className:"mt-1 block text-[11px] text-slate-400",children:[P.fileCount," 文件",P.description?` · ${P.description}`:""]})]})]},P.id)})})]}):null]}),g.jsx("div",{className:"flex min-w-0 items-center gap-2 overflow-x-auto whitespace-nowrap [scrollbar-gutter:stable]",children:A.length===0?g.jsx("span",{className:"text-xs text-slate-400",children:f?"当前未限制知识库范围":"选择项目后可设置知识库范围"}):A.map(P=>g.jsxs("span",{className:"inline-flex shrink-0 items-center gap-2 rounded-full border border-slate-200 bg-white px-2.5 py-1 text-xs text-slate-700 shadow-sm dark:border-white/[0.08] dark:bg-white/[0.05] dark:text-slate-100",children:[g.jsx("span",{className:"max-w-[10rem] truncate",children:P.name}),P.fileCount>0?g.jsxs("span",{className:"text-[10px] text-slate-500",children:[P.fileCount," 文件"]}):null,g.jsx("button",{type:"button",onClick:()=>void y(u.filter(h=>h!==P.id)),className:"text-slate-500 transition-colors hover:text-slate-900 dark:hover:text-white","data-testid":"desktop-chat-knowledge-base-remove","aria-label":`移除 ${P.name}`,children:g.jsx($r,{size:12})})]},P.id))})]}),g.jsxs("div",{className:"hidden shrink-0 items-center gap-3 sm:flex",children:[g.jsx("span",{children:"Enter 发送,Shift + Enter 换行"}),g.jsx("span",{children:f?"范围会随当前线程保存":"请先选择项目"})]})]})]})})})}function zp({deleteTarget:e,pendingSessionAction:t,renameDraft:n,renameTarget:r,onDeleteSession:i,onRenameSession:a,setDeleteTarget:l,setRenameDraft:o,setRenameTarget:s}){return g.jsxs(g.Fragment,{children:[g.jsx(Un,{open:!!r,onClose:()=>s(null),title:"重命名会话",children:g.jsxs("div",{className:"space-y-4",children:[g.jsx(xn,{value:n,onChange:u=>o(u.target.value),onInput:u=>o(u.target.value),placeholder:"输入会话名称","data-testid":"desktop-chat-rename-input"}),g.jsxs("div",{className:"flex justify-end gap-2",children:[g.jsx(ce,{variant:"secondary",onClick:()=>s(null),"data-testid":"desktop-chat-rename-cancel",children:"取消"}),g.jsx(ce,{onClick:()=>void a(),loading:t==="rename",disabled:!n.trim(),"data-testid":"desktop-chat-rename-save",children:"保存名称"})]})]})}),g.jsx(Un,{open:!!e,onClose:()=>l(null),title:"删除会话",children:g.jsxs("div",{className:"space-y-4",children:[g.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:["确定删除 ",g.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:e==null?void 0:e.name})," 吗?这会移除该会话的本地保存记录。"]}),g.jsxs("div",{className:"flex justify-end gap-2",children:[g.jsx(ce,{variant:"secondary",onClick:()=>l(null),"data-testid":"desktop-chat-delete-cancel",children:"取消"}),g.jsx(ce,{variant:"danger",onClick:()=>void i(),loading:t==="delete","data-testid":"desktop-chat-delete-confirm",children:"删除会话"})]})]})})]})}function el(){return{chatTitle:"本地对话",chatHeading:"本地对话",chatDescription:"浏览线程、切换工作区,并与本地 AI Core 保持同步。",scopeLabel:"当前工作区",scopeSelectPlaceholder:"选择工作区",searchPlaceholder:"搜索线程、联系人或消息摘要",startRuntimeLabel:"启动运行时",startingRuntimeLabel:"启动中…",newThreadLabel:"新建线程",pendingRestartLabel:"最新配置已经保存,但当前对话仍在使用旧运行时状态。请重启运行时以应用配置。",emptySelectionLabel:"选择工作区后即可开始对话。",emptyThreadsLabel:"当前还没有线程。",emptySearchLabel:"没有匹配的线程。",collectionLabel:"线程",activeScopeLabel:"当前工作区",activeConversationFallback:"新对话",startConversationLabel:"选择工作区后即可开始聊天。",runtimeOnlineLabel:"运行时在线",runtimeOfflineLabel:"运行时离线",emptyConversationLabel:"发送一条消息,即可在当前工作区创建新线程。",startFirstPlaceholder:"请先启动运行时",waitingRuntimePlaceholder:"正在等待运行时通道连接",sendPlaceholder:"输入一条发给当前线程的消息",permissionUnsupportedLabel:"当前代理无法在此对话中继续交互式审批。请切换到支持的代理,或调整运行时权限后重试。",replyTimeoutLabel:"审批回复已发送,但代理没有继续执行。该请求可能暂不支持本地运行时继续处理。"}}function Pp({requestedProject:e,selectedProject:t,setSelectedProject:n,clearReplyTimeout:r,updateTaskState:i,setTyping:a}){const[l,o]=T.useState(null),[s,u]=T.useState(!0),f=!1,c=(l==null?void 0:l.phase)==="api_ready",p=c,d=T.useCallback(async()=>{const x=await yl();o(x),!x.roles.conversation.lastError&&!t&&!e&&x.settings.defaultProject&&n(x.settings.defaultProject)},[e,t,n]);return T.useEffect(()=>{d().finally(()=>u(!1));const x=wl(S=>{o(S),(S.phase==="stopped"||S.phase==="error")&&(a(!1),r(),i("idle"))});return()=>{r(),x()}},[r,d,a,i]),T.useMemo(()=>({loading:s,refreshRuntime:d,runtime:l,serviceRunning:c,showSessionKey:f,transportReady:p}),[s,d,l,c,f,p])}function Lp({current:e,requested:t,runtimeDefault:n,workspaceIds:r}){return e&&r.includes(e)?e:t&&r.includes(t)?t:n&&r.includes(n)?n:r[0]||""}function Dp({activeThreadId:e,requestedWorkspaceId:t,requestedThreadId:n,runtimeDefaultWorkspaceId:r,searchParams:i,serviceRunning:a,selectedWorkspaceId:l,workspaceIds:o,threadGroups:s,threadSearch:u,setSelectedKnowledgeBaseIds:f,setActiveRunId:c,setActiveSessionAgentType:p,setActiveAgentMode:d,setActiveSessionId:x,setActiveSessionKey:S,setActiveSessionName:C,setBridgeError:b,setMessages:E,setPendingPermissionRequest:v,setProjects:O,setSearchParams:N,setSelectedProject:y,setThreadGroups:k,setTyping:R,applyLocalCoreThreadDetail:B,clearReplyTimeout:w,updateTaskState:j,holdBlankComposerRef:A,lastSessionByProjectRef:$,nextMessageOrderRef:F,pendingTurnRef:_,progressSequenceByTurnRef:L}){const M=T.useMemo(()=>{var K;return((K=s.find(m=>m.project===l))==null?void 0:K.sessions)||[]},[l,s]),H=T.useMemo(()=>{const K=u.trim().toLowerCase();return o.map(m=>{var Z;const Y=(((Z=s.find(G=>G.project===m))==null?void 0:Z.sessions)||[]).filter(G=>Sa(G,K));return{project:m,sessions:Y}}).filter(m=>m.sessions.length>0||!K&&m.project===l)},[l,s,u,o]),P=T.useCallback(async K=>{if(!K||!a)return[];const m=Wr((await Ml(K)).threads.map(Z=>qr(Z))),Y=m.find(Z=>Z.id===e);return Y!=null&&Y.agentType&&p(Y.agentType),Y!=null&&Y.agentMode&&d(Y.agentMode),k(Z=>Yr(Z,K,m)),m},[e,a,d,p,k]),h=T.useCallback(async(K,m)=>{if(!K||!m||!a)return;A.current=!1,j("idle"),v(null),R(!1);const Y=await Rl(m);B(Y)},[B,A,F,_,L,a,c,d,p,x,S,C,f,E,v,y,k,R,j]),U=T.useCallback(async()=>{if(!a)return O([]),k([]),f([]),[];const K=(await Ol()).workspaces.map(Z=>Z.id);O(K);const m=Lp({current:l,requested:t,runtimeDefault:r,workspaceIds:K}),Y=(await Promise.all(K.map(async Z=>({project:Z,sessions:await P(Z)})))).sort((Z,G)=>Z.project.localeCompare(G.project));return k(Y),y(m),Y},[P,t,r,l,a,O,f,y,k]);return T.useEffect(()=>{if(a)return Sl(K=>{K.type==="thread.session.activated"&&K.threadId!==e&&P(K.workspaceId).then(()=>h(K.workspaceId,K.threadId))})},[e,h,P,a]),T.useEffect(()=>{if(!a){k([]),E([]),v(null),f([]),p(""),c(""),b(""),_.current=null,F.current=0,L.current={},j("idle"),R(!1),w();return}U()},[w,F,_,L,U,a,c,p,b,E,v,f,k,R,j]),T.useEffect(()=>{if(!l||!a||M.find(G=>G.id===e))return;const m=t===l?n:"",Y=$.current[l];if(!e&&A.current)return;const Z=M.find(G=>G.id===m)||M.find(G=>G.id===Y)||M[0];if(Z){R(!1),j("idle"),b(""),w(),h(l,Z.id);return}R(!1),j("idle"),b(""),w(),x(""),S(""),C(""),p(""),c(""),E([]),_.current=null,F.current=0,L.current={}},[e,w,A,$,h,F,_,L,n,t,l,a,c,p,x,S,C,b,E,R,M,j]),T.useEffect(()=>{if(!l&&!e)return;const K=new URLSearchParams(i);l?K.set("project",l):K.delete("project"),e?K.set("session",e):K.delete("session"),K.toString()!==i.toString()&&N(K,{replace:!0})},[e,i,l,N]),{filteredThreadGroups:H,loadActiveThread:h,refreshThreadsForWorkspace:P,refreshWorkspacesAndThreads:U}}function Fp({activeAgentType:e,activeThreadId:t,armReplyTimeout:n,clearActionStatuses:r,clearReplyTimeout:i,reserveNextMessageOrder:a,selectedWorkspaceId:l,sendAction:o,settlePreviewMessages:s,setActiveRunId:u,setBridgeError:f,setMessages:c,setPendingPermissionRequest:p,setPendingBridgeActionId:d,setTyping:x,updateTaskState:S}){return{handleBridgeAction:T.useCallback(async(b,E)=>{if(!t)return;const v=$n(E.data)||E.data,O=$n(E.data)||E.text||E.data,N=Pa(b),y=!N,k=y?-1:a(),R=`${crypto.randomUUID()}-user-action`;let B=!1,w=!1;d(b.id),c(j=>j.map(A=>A.id===b.id?{...A,actionPending:!0}:A)),p(j=>j&&j.id===b.id?{...j,actionPending:!0}:j);try{N&&(w=!0,c(A=>[...A,{id:R,role:"user",content:O,order:k,timestamp:new Date().toISOString()}]));const j=await o(t,v);u(j.runId),B=!0,f(""),s(b.actionReplyCtx),x(!0),i(),r(),y?(S("permission_submitted","bridge-permission-submitted"),n("permission_continue"),p(null),c(A=>A.map($=>$.id===b.id?Fa($):$))):(S("running","bridge-action-submitted"),n())}catch(j){f(j instanceof Error?j.message:"Failed to send permission response."),w&&c(A=>A.filter($=>$.id!==R)),S(y?"awaiting_permission":"error",y?"bridge-permission-submit-failed":"bridge-action-submit-failed"),x(!1),p(A=>A&&A.id===b.id?{...A,actionPending:!1}:A)}finally{d(null),c(j=>j.map(A=>A.id===b.id?{...A,actionPending:!1,actions:B?A.actions||[]:A.actions}:A))}},[t,n,r,i,a,o,s,u,f,c,p,d,x,S])}}function Mp(e){return e==="awaiting_permission"?"awaiting_permission":"idle"}function Rp(e,t){return t?"awaiting_permission":e?"awaiting_input":"idle"}function Op(e,t){return t?"bridge-buttons-awaiting-permission":e?"bridge-buttons-awaiting-input":"bridge-buttons-idle"}function Bp(e){const t=e||"This agent",n=el();return n.permissionUnsupportedLabel.startsWith("This agent")?n.permissionUnsupportedLabel:`${t} ${n.permissionUnsupportedLabel.replace(/^This agent\s+/i,"")}`}function $p(e){return e.type==="typing_stop"||e.type==="buttons"||e.type==="card"?!0:e.type==="reply"&&!ht(e.bridgeKind)}function Up({activeAgentType:e,activeBridgeSessionKey:t,activeRunId:n,armReplyTimeout:r,clearActionStatuses:i,clearReplyTimeout:a,finalizeTurnMessages:l,nextProgressMessageId:o,pendingTurnRef:s,progressSequenceByTurnRef:u,refreshThreadsForWorkspace:f,reserveAssistantMessageOrder:c,settlePreviewMessages:p,setBridgeError:d,setMessages:x,setPendingPermissionRequest:S,setTyping:C,taskStateRef:b,updateTaskState:E}){const v=jl(e),O=T.useRef(ha());T.useEffect(()=>{O.current.reset()},[t]);const N=T.useCallback(k=>{Ta(b.current)&&E("running",k)},[b,E]),y=T.useCallback(k=>{const R=va(k.sessionKey);if(R&&$p(k)&&f(R),!(!k.sessionKey||k.sessionKey!==t)&&O.current.acceptBridgeEvent(k,{activeRunId:n,pendingTurn:s.current}))switch(k.type){case"preview_start":if($t(k.bridgeStatus)){a(),C(!1),s.current=null,i(),E("awaiting_input","bridge-preview-awaiting-input"),S(null),d(""),x(L=>{const M=vt(L,k.previewHandle,k.replyCtx),H=(M==null?void 0:M.id)||k.previewHandle||`${k.replyCtx||crypto.randomUUID()}-preview`,P=L.filter(h=>h.id!==H);return P.push({id:H,role:"assistant",content:k.content||"",kind:"progress",bridgeKind:k.bridgeKind,bridgeStatus:k.bridgeStatus,order:(M==null?void 0:M.order)??c(k.sessionKey),timestamp:(M==null?void 0:M.timestamp)||new Date().toISOString(),turnKey:k.replyCtx,preview:!0,previewPlainText:v}),P});break}i(),C(!0),N("bridge-preview-start"),S(null),r(),d(""),x(L=>{const M=vt(L,k.previewHandle,k.replyCtx),H=(M==null?void 0:M.id)||k.previewHandle||`${k.replyCtx||crypto.randomUUID()}-preview`,P=L.filter(h=>h.id!==H);return P.push({id:H,role:"assistant",content:k.content||"",kind:"progress",bridgeKind:k.bridgeKind,bridgeStatus:k.bridgeStatus,order:(M==null?void 0:M.order)??c(k.sessionKey),timestamp:(M==null?void 0:M.timestamp)||new Date().toISOString(),turnKey:k.replyCtx,preview:!0,previewPlainText:v}),P});break;case"update_message":if($t(k.bridgeStatus)){a(),C(!1),s.current=null,i(),E("awaiting_input","bridge-update-awaiting-input"),S(null),d(""),x(L=>{const M=vt(L,k.previewHandle,k.replyCtx);return M?L.map(H=>H.id===M.id?{...H,content:k.content||"",bridgeKind:k.bridgeKind,bridgeStatus:k.bridgeStatus,preview:!0,previewPlainText:v}:H):[...L,{id:k.previewHandle||`${k.replyCtx||crypto.randomUUID()}-preview`,role:"assistant",content:k.content||"",kind:"progress",bridgeKind:k.bridgeKind,bridgeStatus:k.bridgeStatus,order:c(k.sessionKey),timestamp:new Date().toISOString(),turnKey:k.replyCtx,preview:!0,previewPlainText:v}]});break}i(),C(!0),N("bridge-update-message"),S(null),r(),d(""),x(L=>{const M=vt(L,k.previewHandle,k.replyCtx);return M?L.map(H=>H.id===M.id?{...H,content:k.content||"",bridgeKind:k.bridgeKind,bridgeStatus:k.bridgeStatus,preview:!0,previewPlainText:v}:H):[...L,{id:k.previewHandle||`${k.replyCtx||crypto.randomUUID()}-preview`,role:"assistant",content:k.content||"",kind:"progress",bridgeKind:k.bridgeKind,bridgeStatus:k.bridgeStatus,order:c(k.sessionKey),timestamp:new Date().toISOString(),turnKey:k.replyCtx,preview:!0,previewPlainText:v}]});break;case"delete_message":x(L=>L.filter(M=>M.id!==k.previewHandle));break;case"typing_start":i(),C(!0),N("bridge-typing-start"),S(null),d(""),r();break;case"typing_stop":C(!1),a(),s.current=null,i(),E(Mp(b.current),b.current==="awaiting_permission"?"bridge-typing-stop-preserve-permission":"bridge-typing-stop"),p(k.replyCtx),l(k.replyCtx);break;case"reply":{const L=$t(k.bridgeStatus);i(),C(!L),L?(a(),s.current=null,E("awaiting_input","bridge-reply-awaiting-input")):(N("bridge-reply"),r()),S(null),d("");const M=k.messageId||o(k.replyCtx);!ht(k.bridgeKind)&&k.replyCtx&&delete u.current[k.replyCtx],d(""),x(H=>{const P=H.find(U=>U.id===M),h=new Date().toISOString();return P?H.map(U=>U.id===M?{...U,content:k.content||"",toolCall:k.toolCall,bridgeKind:k.bridgeKind,bridgeStatus:k.bridgeStatus,kind:"progress",timestamp:h,turnKey:k.replyCtx}:U):[...H.filter(U=>!ba(U,k.content,k.replyCtx,k.bridgeKind)),{id:M,role:"assistant",content:k.content||"",toolCall:k.toolCall,bridgeKind:k.bridgeKind,bridgeStatus:k.bridgeStatus,kind:"progress",order:c(k.sessionKey),timestamp:h,turnKey:k.replyCtx}]});break}case"buttons":a(),C(!1),s.current=null,d(""),i(),p(k.replyCtx);const B=`${k.replyCtx||crypto.randomUUID()}-buttons`,w=Ea(k.buttonRows||k.buttons),j=ja(w),A=j&&Al(e),$=j&&!A?[]:w,F=$,_=j&&!A?Bp(e):void 0;x(L=>L.find(H=>H.id===B)?L.map(H=>H.id===B?{...H,content:k.content||H.content,actions:F,actionReplyCtx:k.replyCtx,actionPending:!1,actionMode:j?"permission":"generic",actionInteractive:A,bridgeKind:k.bridgeKind,bridgeStatus:k.bridgeStatus,actionStatus:_}:H):[...L,{id:B,role:"assistant",content:k.content||"Permission required before continuing.",kind:"progress",bridgeKind:k.bridgeKind,bridgeStatus:k.bridgeStatus,order:c(k.sessionKey),timestamp:new Date().toISOString(),turnKey:k.replyCtx,actions:F,actionReplyCtx:k.replyCtx,actionPending:!1,actionMode:j?"permission":"generic",actionInteractive:A,actionStatus:_}]),S(L=>{if(!j||!A)return null;const M={id:B,role:"assistant",content:k.content||"Permission required before continuing.",actions:$,actionReplyCtx:k.replyCtx,actionPending:!1,actionMode:"permission",actionStatus:_};return Da(M)||L}),E(Rp(w.length>0,A),Op(w.length>0,A));break;case"card":a(),C(!1),s.current=null,i(),E("idle","bridge-card"),S(null),p(k.replyCtx),l(k.replyCtx),d(""),x(L=>[...L,{id:`${k.replyCtx||crypto.randomUUID()}-card`,role:"assistant",content:"Interactive card received. Open the session in the standard Sessions view for full controls.",order:c(k.sessionKey),timestamp:new Date().toISOString()}]);break}},[v,e,t,n,r,i,a,l,o,s,u,f,c,p,d,x,S,C,N,E]);T.useEffect(()=>{const k=Nl(R=>{y(R)});return()=>{a(),k()}},[a,y])}function Hp(e){Up({activeAgentType:e.activeAgentType,activeBridgeSessionKey:e.activeBridgeSessionKey,activeRunId:e.activeRunId,armReplyTimeout:e.armReplyTimeout,clearActionStatuses:e.clearActionStatuses,clearReplyTimeout:e.clearReplyTimeout,finalizeTurnMessages:e.finalizeTurnMessages,nextProgressMessageId:e.nextProgressMessageId,pendingTurnRef:e.pendingTurnRef,progressSequenceByTurnRef:e.progressSequenceByTurnRef,refreshThreadsForWorkspace:e.refreshThreadsForWorkspace,reserveAssistantMessageOrder:e.reserveAssistantMessageOrder,settlePreviewMessages:e.settlePreviewMessages,setBridgeError:e.setBridgeError,setMessages:e.setMessages,setPendingPermissionRequest:e.setPendingPermissionRequest,setTyping:e.setTyping,taskStateRef:e.taskStateRef,updateTaskState:e.updateTaskState});const{handleBridgeAction:t}=Fp({activeAgentType:e.activeAgentType,activeBridgeSessionKey:e.activeBridgeSessionKey,activeRunId:e.activeRunId,activeThreadId:e.activeThreadId,armReplyTimeout:e.armReplyTimeout,clearActionStatuses:e.clearActionStatuses,clearReplyTimeout:e.clearReplyTimeout,reserveNextMessageOrder:e.reserveNextMessageOrder,selectedWorkspaceId:e.selectedWorkspaceId,sendAction:e.sendAction,settlePreviewMessages:e.settlePreviewMessages,setActiveRunId:e.setActiveRunId,setBridgeError:e.setBridgeError,setMessages:e.setMessages,setPendingPermissionRequest:e.setPendingPermissionRequest,setPendingBridgeActionId:e.setPendingBridgeActionId,setTyping:e.setTyping,updateTaskState:e.updateTaskState,taskStateRef:e.taskStateRef});return{handleBridgeAction:t}}function Kp({activeRunId:e,activeThreadId:t,activeBridgeSessionKey:n,activeAgentMode:r,brandingNewThreadLabel:i,draft:a,loadActiveThread:l,selectedKnowledgeBaseIds:o,selectedProject:s,taskState:u,updateTaskState:f,applyLocalCoreThreadDetail:c,armReplyTimeout:p,clearReplyTimeout:d,refreshSessionsForProject:x,reserveNextMessageOrder:S,settlePreviewMessages:C,setActiveRunId:b,setActiveSessionId:E,setActiveSessionKey:v,setActiveSessionName:O,setBridgeError:N,setDraft:y,setMessages:k,setPendingPermissionRequest:R,setSending:B,setTyping:w,holdBlankComposerRef:j,nextMessageOrderRef:A,pendingTurnRef:$,progressSequenceByTurnRef:F,taskStateRef:_}){const L=T.useCallback(async()=>{if(!s)throw new Error("Choose a project first");if(t)return{id:t,sessionKey:n};let P=await Ur(s,`${i} ${new Date().toLocaleTimeString()}`);return r&&r!=="default"&&(P=await bn(P.id,r)),c(P),await x(s),{id:P.id,sessionKey:P.bridgeSessionKey||""}},[n,r,t,c,i,x,s]),M=T.useCallback(async()=>{if(!a.trim()||!s)return;const P=a.trim(),h=u==="awaiting_input",U=P,K=S();y(""),B(!0);try{const m=await L();if($.current={sessionKey:m.sessionKey,userOrder:K,runId:h?e:void 0,supersededRunId:h?void 0:e},R(null),k(Y=>[...Y,{id:`${crypto.randomUUID()}-user`,role:"user",content:P,order:K,timestamp:new Date().toISOString()}]),f("running","send-started"),w(!0),N(""),m.id&&await kn(m.id,o),p(),m.id){const Y=h?await Hr(m.id,U):await Bl(m.id,U);b(Y.runId),$.current&&$.current.sessionKey===m.sessionKey&&$.current.userOrder===K&&($.current={...$.current,runId:Y.runId})}}catch(m){d(),$.current=null,C(),R(null),w(!1),f("error","send-failed"),N(m instanceof Error?m.message:"Failed to send the message.")}finally{B(!1)}},[e,p,d,a,L,u,$,S,o,s,b,N,y,k,R,B,C,w,f]),H=T.useCallback(async()=>{if(!(!s||u==="stopping")){N(""),d(),C(),R(null),w(!1),f("stopping","stop-requested");try{if(e)await $l(e);else throw new Error("No active run to stop.");window.setTimeout(()=>{_.current==="stopping"&&f("idle","stop-timeout-complete")},1500)}catch(P){f("error","stop-failed"),N(P instanceof Error?P.message:"Failed to stop the current task.")}}},[e,d,N,R,C,w,s,u,_,f]);return{handleSend:M,handleStopTask:H}}function Vp({activeThreadId:e,brandingNewThreadLabel:t,deleteTarget:n,renameDraft:r,renameTarget:i,searchParams:a,selectedKnowledgeBaseIds:l,activeAgentMode:o,selectedProject:s,updateTaskState:u,applyLocalCoreThreadDetail:f,clearReplyTimeout:c,refreshSessionsForProject:p,setActiveRunId:d,setActiveSessionAgentType:x,setActiveSessionId:S,setActiveSessionKey:C,setActiveSessionName:b,setBridgeError:E,setDeleteTarget:v,setMessages:O,setPendingPermissionRequest:N,setPendingSessionAction:y,setRenameDraft:k,setRenameTarget:R,setSearchParams:B,setTyping:w,holdBlankComposerRef:j,nextMessageOrderRef:A,pendingTurnRef:$,progressSequenceByTurnRef:F}){const _=T.useCallback(()=>{j.current=!0,S(""),C(""),b(""),x(""),d(""),O([]),N(null),w(!1),u("idle"),E(""),$.current=null,A.current=0,F.current={},c()},[c,j,A,$,F,d,x,S,C,b,E,O,N,w,u]),L=T.useCallback(async()=>{if(s){y("rename");try{let h=await Ur(s,`${t} ${new Date().toLocaleTimeString()}`);if(o&&o!=="default"&&(h=await bn(h.id,o)),l.length>0){const K=(await kn(h.id,l)).knowledgeBaseIds;h.selectedKnowledgeBaseIds=K}else h.selectedKnowledgeBaseIds=[];await p(s),f(h);const U=new URLSearchParams(a);U.set("project",s),U.set("session",h.id),B(U,{replace:!0})}finally{y(null)}}},[f,o,t,p,a,l,s,y,B]),M=T.useCallback((h,U)=>{R({project:h,id:U.id,name:U.name}),k(U.name)},[k,R]),H=T.useCallback(async()=>{if(i){y("rename");try{const h=r.trim();await Ul(i.id,h),i.id===e&&b(h),await p(i.project),R(null),k("")}finally{y(null)}}},[e,p,r,i,b,y,k,R]),P=T.useCallback(async()=>{if(n){y("delete");try{await Hl(n.id),n.id===e&&_(),await p(n.project),v(null)}finally{y(null)}}},[e,n,p,_,v,y]);return{handleCreateNew:L,handleDeleteSession:P,handleRenameSession:H,openRenameModal:M}}function qp({activeRunId:e,activeThreadId:t,activeBridgeSessionKey:n,brandingNewThreadLabel:r,deleteTarget:i,draft:a,loadActiveThread:l,renameDraft:o,renameTarget:s,searchParams:u,selectedKnowledgeBaseIds:f,activeAgentMode:c,selectedWorkspaceId:p,taskState:d,updateTaskState:x,applyLocalCoreThreadDetail:S,armReplyTimeout:C,clearReplyTimeout:b,refreshSessionsForProject:E,reserveNextMessageOrder:v,settlePreviewMessages:O,setActiveRunId:N,setActiveSessionAgentType:y,setActiveAgentMode:k,setActiveSessionId:R,setActiveSessionKey:B,setActiveSessionName:w,setBridgeError:j,setDeleteTarget:A,setDraft:$,setMessages:F,setPendingPermissionRequest:_,setPendingSessionAction:L,setRenameDraft:M,setRenameTarget:H,setSearchParams:P,setSending:h,setTyping:U,holdBlankComposerRef:K,nextMessageOrderRef:m,pendingTurnRef:Y,progressSequenceByTurnRef:Z,taskStateRef:G}){const ae={selectedProject:p,updateTaskState:x,applyLocalCoreThreadDetail:S,clearReplyTimeout:b,refreshSessionsForProject:E,setBridgeError:j,setMessages:F,setPendingPermissionRequest:_,setTyping:U,holdBlankComposerRef:K,nextMessageOrderRef:m,pendingTurnRef:Y,progressSequenceByTurnRef:Z,taskStateRef:G},V={setActiveRunId:N,setActiveSessionAgentType:y,setActiveAgentMode:k,setActiveSessionId:R,setActiveSessionKey:B,setActiveSessionName:w},ee={setDeleteTarget:A,setPendingSessionAction:L,setRenameDraft:M,setRenameTarget:H},re={holdBlankComposerRef:K,nextMessageOrderRef:m,pendingTurnRef:Y,progressSequenceByTurnRef:Z,taskStateRef:G},me={setBridgeError:j,setMessages:F,setPendingPermissionRequest:_,setTyping:U},{handleSend:_e,handleStopTask:Ie}=Kp({activeRunId:e,activeThreadId:t,activeBridgeSessionKey:n,brandingNewThreadLabel:r,draft:a,loadActiveThread:l,selectedKnowledgeBaseIds:f,activeAgentMode:c,taskState:d,armReplyTimeout:C,reserveNextMessageOrder:v,settlePreviewMessages:O,setDraft:$,setSending:h,...ae,...V,...me,...re}),{handleCreateNew:De,handleDeleteSession:Te,handleRenameSession:ke,openRenameModal:Fe}=Vp({activeThreadId:t,brandingNewThreadLabel:r,deleteTarget:i,renameDraft:o,renameTarget:s,searchParams:u,selectedKnowledgeBaseIds:f,activeAgentMode:c,setSearchParams:P,...ae,...V,...ee,...me});return{handleCreateNew:De,handleDeleteSession:Te,handleRenameSession:ke,handleSend:_e,handleStopTask:Ie,openRenameModal:Fe}}const tl={status:"idle"};function Wp(e,t){switch(t.type){case"activate_started":return{status:"activating"};case"send_started":return{status:"sending"};case"send_accepted":return e.status==="sending"?{status:"waiting"}:e;case"stream_started":return{status:"running"};case"input_requested":return{status:"awaiting_input"};case"permission_requested":return{status:"awaiting_permission"};case"permission_submitted":return{status:"permission_submitted"};case"stop_started":return{status:"stopping"};case"failed":return{status:"failed",error:t.error};case"timed_out":return{status:"timed_out",error:t.error};case"settled":return tl;case"transition":return{status:t.status,error:t.error};default:return e}}function Yp({activeThreadId:e,brandingReplyTimeoutLabel:t,setSelectedKnowledgeBaseIds:n,setActiveRunId:r,setActiveSessionAgentType:i,setActiveAgentMode:a,setActiveSessionId:l,setActiveSessionKey:o,setActiveSessionName:s,setBridgeError:u,setSelectedProject:f,setThreadGroups:c}){const[p,d]=T.useState([]),[x,S]=T.useState(null),[C,b]=T.useState(!1),[E,v]=T.useReducer(Wp,tl),O=xa(E.status),N=T.useRef(null),y=T.useRef("reply"),k=T.useRef({}),R=T.useRef(0),B=T.useRef(null),w=T.useRef(!1),j=T.useRef({}),A=T.useRef("idle"),$=T.useRef(""),F=T.useMemo(()=>Vn(p),[p]),_=Na(O),L=_a(O),M=Aa(O,C);T.useEffect(()=>{$.current=e},[e]);const H=T.useCallback((V,ee="unspecified")=>{const re=A.current;A.current=V,v(ga(V)),re!==V&&console.info("[desktop-chat] task_state",{from:re,to:V,reason:ee,threadId:$.current})},[]),P=T.useCallback(()=>{N.current&&(window.clearTimeout(N.current),N.current=null)},[]),h=T.useCallback((V="reply")=>{P(),y.current=V,N.current=window.setTimeout(()=>{b(!1),B.current=null,S(null),H("idle","reply-timeout"),u(V==="permission_continue"?t:"Agent did not respond in time. Check AgentDock runtime logs or adjust the model/provider.")},ma)},[t,P,u,H]),U=T.useCallback(()=>{d(V=>V.map(ee=>ee.actionStatus||ee.actionPending?{...ee,actionPending:!1,actionStatus:void 0}:ee))},[]),K=T.useCallback(V=>{d(ee=>ka(ee,V))},[]),m=T.useCallback(()=>{const V=R.current;return R.current+=1,V},[]),Y=T.useCallback(V=>{const ee=B.current;if(ee&&V&&ee.sessionKey===V){const re=ee.userOrder+1;R.current<re&&(R.current=re)}return m()},[m]),Z=T.useCallback(V=>{const ee=V||crypto.randomUUID(),re=(j.current[ee]||0)+1;return j.current[ee]=re,`${ee}-progress-${re}`},[]),G=T.useCallback(V=>{d(ee=>ya(ee,V))},[]);return{applyLocalCoreThreadDetail:T.useCallback(V=>{k.current[V.workspaceId]=V.id,f(V.workspaceId),l(V.id),o(V.bridgeSessionKey||""),s(V.title),i(V.agentType||""),a(V.agentMode||"default"),r(V.runId||""),n(V.selectedKnowledgeBaseIds||[]),S(V.pendingPermissionRequest||null),c(re=>Ia(re,V.workspaceId,qr(V))),w.current=!1,j.current={};const ee=wa(V.messages||[]);B.current=null,R.current=ee.reduce((re,me)=>Math.max(re,me.order+1),0),d(Vn(ee))},[r,a,i,l,o,s,n,f,c,S]),armReplyTimeout:h,clearActionStatuses:U,clearReplyTimeout:P,holdBlankComposerRef:w,lastSessionByProjectRef:k,messages:p,nextMessageOrderRef:R,pendingPermissionRequest:x,finalizeTurnMessages:G,nextProgressMessageId:Z,pendingTurnRef:B,progressSequenceByTurnRef:j,renderedMessages:F,reserveAssistantMessageOrder:Y,reserveNextMessageOrder:m,setMessages:d,setPendingPermissionRequest:S,settlePreviewMessages:K,setTyping:b,taskHint:M,taskInputLocked:L,taskRunning:_,taskState:O,taskStateRef:A,typing:C,updateTaskState:H}}function Xp(){const[e,t]=Cl(),[n,r]=T.useState([]),[i,a]=T.useState(""),[l,o]=T.useState([]),[s,u]=T.useState(""),[f,c]=T.useState(""),[p,d]=T.useState(""),[x,S]=T.useState(""),[C,b]=T.useState("default"),[E,v]=T.useState(""),[O,N]=T.useState(""),[y,k]=T.useState(""),[R,B]=T.useState([]),[w,j]=T.useState([]),[A,$]=T.useState(null),[F,_]=T.useState(""),[L,M]=T.useState(null),[H,P]=T.useState(null),[h,U]=T.useState(null),[K,m]=T.useState(!1),[Y,Z]=T.useState(!1),[G,ae]=T.useState(""),V=T.useRef(0),ee=T.useRef(null),re=e.get("project")||"",me=e.get("session")||"",_e=el(),{applyLocalCoreThreadDetail:Ie,armReplyTimeout:De,clearActionStatuses:Te,clearReplyTimeout:ke,finalizeTurnMessages:Fe,holdBlankComposerRef:Qe,lastSessionByProjectRef:He,nextMessageOrderRef:Me,nextProgressMessageId:lt,pendingPermissionRequest:je,pendingTurnRef:Ke,progressSequenceByTurnRef:Ve,renderedMessages:yt,reserveAssistantMessageOrder:I,reserveNextMessageOrder:D,setMessages:W,setPendingPermissionRequest:Q,settlePreviewMessages:ne,setTyping:se,taskHint:ze,taskInputLocked:Ce,taskRunning:qe,taskState:Re,taskStateRef:ue,typing:Oe,updateTaskState:ge}=Yp({activeThreadId:s,brandingReplyTimeoutLabel:_e.replyTimeoutLabel,setSelectedKnowledgeBaseIds:j,setActiveRunId:v,setActiveSessionAgentType:S,setActiveAgentMode:b,setActiveSessionId:u,setActiveSessionKey:c,setActiveSessionName:d,setBridgeError:ae,setSelectedProject:a,setThreadGroups:o}),{loading:nl,refreshRuntime:rl,runtime:wt,serviceRunning:Rn,showSessionKey:il,transportReady:ll}=Pp({requestedProject:re,selectedProject:i,setSelectedProject:a,clearReplyTimeout:ke,updateTaskState:ge,setTyping:se}),{filteredThreadGroups:al,loadActiveThread:St,refreshThreadsForWorkspace:Ct}=Dp({activeThreadId:s,requestedWorkspaceId:re,requestedThreadId:me,runtimeDefaultWorkspaceId:wt==null?void 0:wt.settings.defaultProject,searchParams:e,selectedWorkspaceId:i,serviceRunning:Rn,workspaceIds:n,threadGroups:l,threadSearch:y,setSelectedKnowledgeBaseIds:j,setActiveRunId:v,setActiveSessionAgentType:S,setActiveAgentMode:b,setActiveSessionId:u,setActiveSessionKey:c,setActiveSessionName:d,setBridgeError:ae,setMessages:W,setPendingPermissionRequest:Q,setProjects:r,setSearchParams:t,setSelectedProject:a,setThreadGroups:o,setTyping:se,applyLocalCoreThreadDetail:Ie,clearReplyTimeout:ke,updateTaskState:ge,holdBlankComposerRef:Qe,lastSessionByProjectRef:He,nextMessageOrderRef:Me,pendingTurnRef:Ke,progressSequenceByTurnRef:Ve});T.useEffect(()=>{var Pe;(Pe=ee.current)==null||Pe.scrollIntoView({behavior:"smooth"})},[yt,Oe]);const On=T.useCallback(async()=>{try{const Pe=await Fl();B(Pe.bases||[])}catch{B([])}},[]);T.useEffect(()=>{On()},[On]);const ol=T.useCallback(async Pe=>{const at=Array.from(new Set(Pe.map(Ge=>String(Ge||"").trim()).filter(Boolean))),Be=V.current+1;if(V.current=Be,j(at),!(!i||!s))try{const Ge=(await kn(s,at)).knowledgeBaseIds;V.current===Be&&j(Ge)}catch(Ge){V.current===Be&&ae(Ge instanceof Error?Ge.message:"Failed to save selected knowledge bases.")}},[s,i,ae]),sl=T.useCallback(async Pe=>{const at=["default","bypassPermissions"].includes(Pe)?Pe:"default";if(b(at),!(!i||!s)){Z(!0),ae("");try{const Be=await bn(s,at);Ie(Be),await Ct(i)}catch(Be){ae(Be instanceof Error?Be.message:"Failed to save permission mode."),await St(i,s).catch(()=>null)}finally{Z(!1)}}},[s,Ie,St,Ct,i]),{handleBridgeAction:ul}=Hp({activeAgentType:x,activeThreadId:s,activeRunId:E,activeBridgeSessionKey:f,selectedWorkspaceId:i,clearActionStatuses:Te,clearReplyTimeout:ke,finalizeTurnMessages:Fe,nextProgressMessageId:lt,refreshThreadsForWorkspace:Ct,reserveAssistantMessageOrder:I,reserveNextMessageOrder:D,settlePreviewMessages:ne,setActiveRunId:v,setBridgeError:ae,setMessages:W,setPendingBridgeActionId:U,setTyping:se,setPendingPermissionRequest:Q,updateTaskState:ge,armReplyTimeout:De,pendingTurnRef:Ke,progressSequenceByTurnRef:Ve,sendAction:Hr,taskStateRef:ue}),{handleCreateNew:cl,handleDeleteSession:fl,handleRenameSession:dl,handleSend:pl,handleStopTask:hl,openRenameModal:ml}=qp({activeRunId:E,activeThreadId:s,activeBridgeSessionKey:f,activeAgentMode:C,brandingNewThreadLabel:_e.newThreadLabel,deleteTarget:L,draft:O,loadActiveThread:St,renameDraft:F,renameTarget:A,searchParams:e,selectedKnowledgeBaseIds:w,selectedWorkspaceId:i,taskState:Re,updateTaskState:ge,applyLocalCoreThreadDetail:Ie,armReplyTimeout:De,clearReplyTimeout:ke,refreshSessionsForProject:Ct,reserveNextMessageOrder:D,settlePreviewMessages:ne,setActiveRunId:v,setActiveSessionAgentType:S,setActiveAgentMode:b,setActiveSessionId:u,setActiveSessionKey:c,setActiveSessionName:d,setBridgeError:ae,setDeleteTarget:M,setDraft:N,setMessages:W,setPendingPermissionRequest:Q,setPendingSessionAction:P,setRenameDraft:_,setRenameTarget:$,setSearchParams:t,setSending:m,setTyping:se,holdBlankComposerRef:Qe,nextMessageOrderRef:Me,pendingTurnRef:Ke,progressSequenceByTurnRef:Ve,taskStateRef:ue});return{activeRunId:E,activeAgentMode:C,activeSessionId:s,activeSessionKey:f,activeSessionName:p,bridgeError:G,branding:_e,deleteTarget:L,draft:O,endRef:ee,filteredSessionGroups:al,handleBridgeAction:ul,handleCreateNew:cl,handleDeleteSession:fl,handleRenameSession:dl,handleSend:pl,handleStopTask:hl,availableKnowledgeBases:R,loadActiveSession:St,loading:nl,openRenameModal:ml,pendingBridgeActionId:h,permissionModeSaving:Y,pendingPermissionRequest:je,pendingSessionAction:H,projects:n,refreshRuntime:rl,renameDraft:F,renameTarget:A,renderedMessages:yt,runtime:wt,sending:K,selectedKnowledgeBaseIds:w,serviceRunning:Rn,sessionSearch:y,selectedProject:i,setDeleteTarget:M,setDraft:N,setSelectedKnowledgeBaseIds:ol,setActiveAgentMode:sl,setRenameDraft:_,setRenameTarget:$,setSelectedProject:a,setSessionSearch:k,showSessionKey:il,taskHint:ze,taskInputLocked:Ce,taskRunning:qe,taskState:Re,transportReady:ll}}function Qp(){const[e,t]=T.useState(!1),{activeRunId:n,activeAgentMode:r,activeSessionId:i,activeSessionKey:a,activeSessionName:l,bridgeError:o,branding:s,deleteTarget:u,draft:f,endRef:c,filteredSessionGroups:p,handleBridgeAction:d,handleCreateNew:x,handleDeleteSession:S,handleRenameSession:C,handleSend:b,handleStopTask:E,availableKnowledgeBases:v,loadActiveSession:O,loading:N,openRenameModal:y,pendingBridgeActionId:k,permissionModeSaving:R,pendingPermissionRequest:B,pendingSessionAction:w,projects:j,refreshRuntime:A,renameDraft:$,renameTarget:F,renderedMessages:_,runtime:L,sending:M,selectedKnowledgeBaseIds:H,serviceRunning:P,sessionSearch:h,selectedProject:U,setDeleteTarget:K,setDraft:m,setActiveAgentMode:Y,setSelectedKnowledgeBaseIds:Z,setRenameDraft:G,setRenameTarget:ae,setSelectedProject:V,setSessionSearch:ee,showSessionKey:re,taskHint:me,taskInputLocked:_e,taskRunning:Ie,taskState:De,transportReady:Te}=Xp(),ke=T.useMemo(()=>Va(p,U),[p,U]),Fe=T.useMemo(()=>qa(j,U),[j,U]),Qe=T.useMemo(()=>Wa(ke),[ke]),He=T.useMemo(()=>Xr(H,v),[v,H]),Me=Ya(B),lt=(L==null?void 0:L.phase)==="starting";return N?g.jsx("div",{className:"flex h-64 items-center justify-center text-sm text-slate-500 animate-pulse",children:"正在加载桌面对话…"}):g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"relative h-full min-h-0 overflow-hidden border-slate-200/80 bg-[#f5f5f7] animate-fade-in dark:border-white/[0.06] dark:bg-[#0b0d10] md:rounded-[24px] md:border",children:g.jsxs("div",{className:"grid h-full min-h-0 grid-cols-1 md:grid-cols-[288px_minmax(0,1fr)]",children:[g.jsx(_p,{activeSessionId:i,branding:s,filteredSessionGroups:ke,hasVisibleSessions:Qe,isRuntimeStarting:lt,loading:N,mobileSessionsOpen:e,projects:j,runtime:L,selectedProject:U,serviceRunning:P,sessionSearch:h,showSessionKey:re,visibleProjects:Fe,onCreateNew:()=>void x(),onLoadActiveSession:O,onOpenRenameModal:y,onRefreshRuntime:()=>void A(),setDeleteTarget:K,setMobileSessionsOpen:t,setSelectedProject:V,setSessionSearch:ee}),g.jsxs("section",{className:"flex min-h-0 flex-col bg-white dark:bg-[#0b0d10]",children:[g.jsxs("div",{className:"border-b border-slate-200/80 px-4 py-3 dark:border-white/[0.06] sm:px-6 sm:py-4",children:[g.jsxs("div",{className:"flex items-start gap-3",children:[g.jsx(ce,{size:"sm",variant:"secondary",onClick:()=>t(!0),className:"mt-0.5 h-9 w-9 shrink-0 rounded-xl px-0 md:hidden","aria-label":"Open sessions",children:g.jsx(Jl,{size:16})}),g.jsxs("div",{className:"min-w-0 flex-1",children:[g.jsx("p",{className:"text-[11px] font-medium tracking-[0.16em] text-slate-400 dark:text-slate-500",children:"当前会话"}),g.jsx("h2",{className:"mt-1 truncate text-[1.75rem] font-semibold leading-tight text-slate-900 dark:text-white sm:mt-2 sm:text-[1.95rem] sm:leading-none","data-testid":"desktop-chat-active-title",children:l||s.activeConversationFallback})]})]}),g.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2 text-xs text-slate-500 dark:text-slate-400",children:[U?g.jsx("span",{className:"inline-flex items-center rounded-full bg-slate-100 px-2.5 py-1 text-[11px] text-slate-600 dark:bg-white/[0.05] dark:text-slate-300",children:U}):null,g.jsx("span",{className:"inline-flex items-center gap-1 rounded-full bg-slate-100 px-2.5 py-1 text-[10px] uppercase tracking-[0.18em] text-slate-500 dark:bg-white/[0.05] dark:text-slate-400",children:Ca(L==null?void 0:L.phase)}),Te?g.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-primary/10 px-2.5 py-1 text-primary dark:text-primary",children:[g.jsx(_t,{size:6,className:"fill-current"})," ",s.runtimeOnlineLabel]}):g.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-slate-100 px-2.5 py-1 text-slate-500 dark:bg-white/[0.05] dark:text-slate-400",children:[g.jsx(sa,{size:12})," ",s.runtimeOfflineLabel]}),re&&a?g.jsx("span",{className:"truncate text-[11px] text-slate-400 dark:text-slate-500",children:a}):null]})]}),g.jsxs("div",{className:"flex-1 overflow-y-auto px-3 py-4 [scrollbar-gutter:stable] sm:px-6 sm:py-5",children:[_.length===0?g.jsx("div",{className:"flex h-full min-h-[18rem] items-center justify-center",children:g.jsxs("div",{className:"w-full max-w-2xl rounded-[24px] border border-slate-200 bg-[#fbfbfd] px-5 py-8 text-center dark:border-white/[0.06] dark:bg-white/[0.03] sm:px-8 sm:py-10",children:[g.jsx("div",{className:"mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-primary/10 text-primary",children:g.jsx(Kr,{size:22})}),g.jsx("h3",{className:"mt-4 text-lg font-semibold text-slate-900 dark:text-white sm:text-xl",children:"开始一段新的桌面对话"}),g.jsx("p",{className:"mx-auto mt-3 max-w-xl text-sm leading-6 text-slate-500 dark:text-slate-400",children:U?`当前项目是 ${U}。直接提问即可创建会话并开始对话。`:"先在左侧选择项目,然后直接输入你的问题。"}),g.jsx("div",{className:"mt-4 flex flex-wrap justify-center gap-2",children:He.length>0?He.map(je=>g.jsx("span",{className:"rounded-full bg-primary/10 px-3 py-1 text-xs text-primary dark:bg-primary/10 dark:text-primary",children:je.name},je.id)):g.jsx("span",{className:"rounded-full bg-slate-100 px-3 py-1 text-xs text-slate-500 dark:bg-white/[0.05] dark:text-slate-400",children:"当前未限制知识库范围"})})]})}):g.jsx("div",{className:"mx-auto w-full max-w-4xl space-y-5",children:_.map(je=>Xa(je,Me)?g.jsx(Np,{message:je,pendingBridgeActionId:k,onAction:(Ke,Ve)=>void d(Ke,Ve)},je.id):null)}),me?g.jsxs("div",{className:"mt-5 flex items-center gap-2 text-sm text-slate-400","data-testid":"desktop-chat-task-hint",children:[g.jsx(_t,{size:8,className:"fill-current animate-pulse"})," ",me]}):null,o?g.jsx("div",{className:"mt-4 rounded-2xl border border-amber-400/20 bg-amber-50 px-3 py-2 text-sm text-amber-800 dark:bg-amber-500/10 dark:text-amber-100","data-testid":"desktop-chat-bridge-error",children:o}):null,g.jsx("div",{ref:c})]}),g.jsx(Tp,{activeRunId:n,activeAgentMode:r,activeSessionKey:a,availableKnowledgeBases:v,branding:s,composerPermissionCard:Me,draft:f,pendingBridgeActionId:k,permissionModeSaving:R,selectedKnowledgeBaseIds:H,selectedProject:U,sending:M,serviceRunning:P,taskInputLocked:_e,taskRunning:Ie,taskState:De,transportReady:Te,onBridgeAction:d,onSend:b,onStopTask:E,setActiveAgentMode:Y,setDraft:m,setSelectedKnowledgeBaseIds:Z})]})]})}),g.jsx(zp,{deleteTarget:u,pendingSessionAction:w,renameDraft:$,renameTarget:F,onDeleteSession:S,onRenameSession:C,setDeleteTarget:K,setRenameDraft:G,setRenameTarget:ae})]})}const sh=Object.freeze(Object.defineProperty({__proto__:null,default:Qp},Symbol.toStringTag,{value:"Module"}));export{Nr as M,sh as T,Rt as c,Mr as r,Pn as v};