agentstudio 0.4.2 → 0.4.3

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 (280) hide show
  1. package/config/engineConfig.d.ts +15 -0
  2. package/config/engineConfig.d.ts.map +1 -1
  3. package/config/engineConfig.js +30 -0
  4. package/config/engineConfig.js.map +1 -1
  5. package/config/index.d.ts.map +1 -1
  6. package/config/index.js +14 -0
  7. package/config/index.js.map +1 -1
  8. package/config/paths.d.ts +5 -0
  9. package/config/paths.d.ts.map +1 -1
  10. package/config/paths.js +6 -1
  11. package/config/paths.js.map +1 -1
  12. package/engines/claude/__tests__/supportedModels.test.d.ts +6 -4
  13. package/engines/claude/__tests__/supportedModels.test.d.ts.map +1 -1
  14. package/engines/claude/__tests__/supportedModels.test.js +55 -13
  15. package/engines/claude/__tests__/supportedModels.test.js.map +1 -1
  16. package/engines/claude/aguiAdapter.d.ts.map +1 -1
  17. package/engines/claude/aguiAdapter.js +8 -0
  18. package/engines/claude/aguiAdapter.js.map +1 -1
  19. package/engines/claude/claudeEngine.d.ts +36 -3
  20. package/engines/claude/claudeEngine.d.ts.map +1 -1
  21. package/engines/claude/claudeEngine.js +132 -13
  22. package/engines/claude/claudeEngine.js.map +1 -1
  23. package/index.d.ts.map +1 -1
  24. package/index.js +29 -2
  25. package/index.js.map +1 -1
  26. package/middleware/callChain.d.ts +10 -0
  27. package/middleware/callChain.d.ts.map +1 -0
  28. package/middleware/callChain.js +24 -0
  29. package/middleware/callChain.js.map +1 -0
  30. package/middleware/requestId.d.ts +8 -0
  31. package/middleware/requestId.d.ts.map +1 -0
  32. package/middleware/requestId.js +18 -0
  33. package/middleware/requestId.js.map +1 -0
  34. package/package.json +1 -1
  35. package/prompts/gameDevSystemPrompt.d.ts +15 -0
  36. package/prompts/gameDevSystemPrompt.d.ts.map +1 -0
  37. package/prompts/gameDevSystemPrompt.js +37 -0
  38. package/prompts/gameDevSystemPrompt.js.map +1 -0
  39. package/prompts/vibeGamingPrompt.d.ts +13 -0
  40. package/prompts/vibeGamingPrompt.d.ts.map +1 -0
  41. package/prompts/vibeGamingPrompt.js +125 -0
  42. package/prompts/vibeGamingPrompt.js.map +1 -0
  43. package/public/assets/{AgentsPage-BsZdkqzM.js → AgentsPage-CHee5mUh.js} +1 -1
  44. package/public/assets/{Button-CMTSYiKV.js → Button-D5qiS7CR.js} +1 -1
  45. package/public/assets/ChatPage-B7-rn9mH.js +478 -0
  46. package/public/assets/{CommandForm-DwGvE9A_.js → CommandForm-CMfgHNm5.js} +1 -1
  47. package/public/assets/{CommandsPage-qDWzq8xp.js → CommandsPage-B4rjtVWk.js} +1 -1
  48. package/public/assets/{CursorConfigPage-DpUdJzRi.js → CursorConfigPage-DQ-3b3ti.js} +1 -1
  49. package/public/assets/{DashboardPage-BhqKOzob.js → DashboardPage-BowdW2Xj.js} +1 -1
  50. package/public/assets/{EngineGate-BjHJu955.js → EngineGate-DYNvEEbW.js} +1 -1
  51. package/public/assets/{FileBrowser-DboOOM_v.js → FileBrowser-DHyCacM6.js} +1 -1
  52. package/public/assets/{FileExplorer-x5R0Tcmk.js → FileExplorer-BprfeAH_.js} +1 -1
  53. package/public/assets/GeneralSettingsPage-C6hJ_zTw.js +1 -0
  54. package/public/assets/{HooksPage-DDGc0GGV.js → HooksPage-BwE2Zm3X.js} +1 -1
  55. package/public/assets/{LandingPage-CvY4n9Rh.js → LandingPage-DKvwbGX1.js} +1 -1
  56. package/public/assets/{LoginPage-C-PZfjYC.js → LoginPage-BpZhqRAN.js} +1 -1
  57. package/public/assets/{McpAdminSettingsPage-CIILVzB8.js → McpAdminSettingsPage-DuvsM5TX.js} +1 -1
  58. package/public/assets/{McpPage-B4nQUJag.js → McpPage-Hu8vyMhX.js} +1 -1
  59. package/public/assets/{MemorySettingsPage-eu6tsuUh.js → MemorySettingsPage-gIWSsrES.js} +1 -1
  60. package/public/assets/{ModelsPage-Bb5vSsuc.js → ModelsPage-Cosb3hHI.js} +1 -1
  61. package/public/assets/PluginsPage-CuNui9NV.js +12 -0
  62. package/public/assets/{ProjectSelector-CybrDbBY.js → ProjectSelector-CyBlHb2H.js} +1 -1
  63. package/public/assets/{ProjectsPage-DRl-0B4G.js → ProjectsPage-DYhCvH07.js} +1 -1
  64. package/public/assets/{RulesPage-DUt33RkX.js → RulesPage-C32P_Aqz.js} +1 -1
  65. package/public/assets/{ScheduledTasksPage-CTDYYRIN.js → ScheduledTasksPage-ixn5qoiD.js} +1 -1
  66. package/public/assets/SettingsLayout-C_7jR0Te.js +1 -0
  67. package/public/assets/{SkillsPage-Lzw8I9vR.js → SkillsPage-C-WS4N1Y.js} +1 -1
  68. package/public/assets/{SubagentForm-BzzeWg0W.js → SubagentForm-BbxljQUp.js} +1 -1
  69. package/public/assets/{SubagentsPage-bX2XWdJ0.js → SubagentsPage-D66TBaeN.js} +1 -1
  70. package/public/assets/{SystemInfoPage-nEIQbtwG.js → SystemInfoPage-DXVUncTe.js} +1 -1
  71. package/public/assets/{TelemetrySettingsPage-q167I4G9.js → TelemetrySettingsPage-Cp3vOu7X.js} +1 -1
  72. package/public/assets/{ToastTestPage-j224d3QR.js → ToastTestPage-03up9yZR.js} +1 -1
  73. package/public/assets/{ToolsList-CTsQr53G.js → ToolsList-BZFBEuvQ.js} +1 -1
  74. package/public/assets/UnifiedToolSelector-DJN7ASu1.js +1 -0
  75. package/public/assets/{VersionSettingsPage-BwpwiLyl.js → VersionSettingsPage-DppWaX--.js} +1 -1
  76. package/public/assets/{VoiceSettingsPage-d3l9AWBn.js → VoiceSettingsPage-BWJLeedX.js} +1 -1
  77. package/public/assets/{WebSocketTunnelPage-BqEUE7mr.js → WebSocketTunnelPage-BPeSTgEZ.js} +1 -1
  78. package/public/assets/{_basePickBy-DHabY031.js → _basePickBy-0UeYrifO.js} +1 -1
  79. package/public/assets/{_baseUniq-B1lmu3qr.js → _baseUniq-Q0NUbuSr.js} +1 -1
  80. package/public/assets/{agents-KlPdWQ8K.js → agents-DR9EZMs5.js} +1 -1
  81. package/public/assets/{arc-6sRLTBcr.js → arc-BV8erW1-.js} +1 -1
  82. package/public/assets/{architectureDiagram-VXUJARFQ-kwdTmjuB.js → architectureDiagram-VXUJARFQ-BIodTu6s.js} +1 -1
  83. package/public/assets/{blockDiagram-VD42YOAC-CYO9EYkJ.js → blockDiagram-VD42YOAC-4H3KjsGf.js} +1 -1
  84. package/public/assets/{c4Diagram-YG6GDRKO-gAp3--Ee.js → c4Diagram-YG6GDRKO-J2ovCYEr.js} +1 -1
  85. package/public/assets/channel-gveiJv4S.js +1 -0
  86. package/public/assets/{chunk-4BX2VUAB-DQVsL-J6.js → chunk-4BX2VUAB-D7Mc44O6.js} +1 -1
  87. package/public/assets/{chunk-55IACEB6-DVsfnY5X.js → chunk-55IACEB6-CMASo37Z.js} +1 -1
  88. package/public/assets/{chunk-B4BG7PRW-BNmOvuIn.js → chunk-B4BG7PRW-2T3W2IB6.js} +1 -1
  89. package/public/assets/{chunk-DI55MBZ5-BkucWe8Y.js → chunk-DI55MBZ5-FR9qswmO.js} +1 -1
  90. package/public/assets/{chunk-FMBD7UC4-BsvfEdnB.js → chunk-FMBD7UC4-Bz2LO9q3.js} +1 -1
  91. package/public/assets/{chunk-QN33PNHL-DSecsNtM.js → chunk-QN33PNHL-D7mfK9Pm.js} +1 -1
  92. package/public/assets/{chunk-QZHKN3VN-DhvrZSqy.js → chunk-QZHKN3VN-AkuNbqQU.js} +1 -1
  93. package/public/assets/{chunk-TZMSLE5B-BqQ674GC.js → chunk-TZMSLE5B-DtY3rhWy.js} +1 -1
  94. package/public/assets/classDiagram-2ON5EDUG-f-lJUj27.js +1 -0
  95. package/public/assets/classDiagram-v2-WZHVMYZB-f-lJUj27.js +1 -0
  96. package/public/assets/clone-D5-Tsf9e.js +1 -0
  97. package/public/assets/{cose-bilkent-S5V4N54A-D9ZC6LmB.js → cose-bilkent-S5V4N54A-BuEw-qDX.js} +1 -1
  98. package/public/assets/{dagre-6UL2VRFP-s7YD2ZcY.js → dagre-6UL2VRFP-D-NrLBGh.js} +1 -1
  99. package/public/assets/{diagram-PSM6KHXK-C7jhP5tx.js → diagram-PSM6KHXK-BFjWOHNz.js} +1 -1
  100. package/public/assets/{diagram-QEK2KX5R-B348GmS1.js → diagram-QEK2KX5R-C0YlDb8t.js} +1 -1
  101. package/public/assets/{diagram-S2PKOQOG-Cu-zjwc9.js → diagram-S2PKOQOG-BLKbR12g.js} +1 -1
  102. package/public/assets/{erDiagram-Q2GNP2WA-tM4HKBpy.js → erDiagram-Q2GNP2WA-Cov6xnUk.js} +1 -1
  103. package/public/assets/{flowDiagram-NV44I4VS-DjCIshpi.js → flowDiagram-NV44I4VS-DTMKSJI1.js} +1 -1
  104. package/public/assets/{ganttDiagram-LVOFAZNH-Q6plkI5G.js → ganttDiagram-LVOFAZNH-DR0bcfHY.js} +1 -1
  105. package/public/assets/{gitGraphDiagram-NY62KEGX-B3Uw90Yt.js → gitGraphDiagram-NY62KEGX-CvxYSabY.js} +1 -1
  106. package/public/assets/{graph-Bp0jlxBT.js → graph-BYXvelIL.js} +1 -1
  107. package/public/assets/{index-f67nhEoX.js → index-BIGPvi1D.js} +44 -44
  108. package/public/assets/infoDiagram-F6ZHWCRC-CL9g-UgS.js +2 -0
  109. package/public/assets/{journeyDiagram-XKPGCS4Q-CgQogtHU.js → journeyDiagram-XKPGCS4Q-Df8G0pW8.js} +1 -1
  110. package/public/assets/{kanban-definition-3W4ZIXB7-Cv7kVxyy.js → kanban-definition-3W4ZIXB7-DhoP7TG_.js} +1 -1
  111. package/public/assets/{layout-6bkH32V1.js → layout-CgO4Vp_y.js} +1 -1
  112. package/public/assets/{linear-DWoZ6Tbm.js → linear-CaY74pOB.js} +1 -1
  113. package/public/assets/{mindmap-definition-VGOIOE7T-D5wd9HsH.js → mindmap-definition-VGOIOE7T-CVK2y0WQ.js} +1 -1
  114. package/public/assets/{pieDiagram-ADFJNKIX-8vPxErLm.js → pieDiagram-ADFJNKIX-BQt_waQk.js} +1 -1
  115. package/public/assets/{quadrantDiagram-AYHSOK5B-Pn0NZ9k7.js → quadrantDiagram-AYHSOK5B-DvLFoDeH.js} +1 -1
  116. package/public/assets/{requirementDiagram-UZGBJVZJ-C7u8MiN1.js → requirementDiagram-UZGBJVZJ-C4lqjEUP.js} +1 -1
  117. package/public/assets/{sankeyDiagram-TZEHDZUN-C660O4mw.js → sankeyDiagram-TZEHDZUN-BKIDyl6M.js} +1 -1
  118. package/public/assets/{sequenceDiagram-WL72ISMW-pXBA2_3B.js → sequenceDiagram-WL72ISMW-BeyhJ61U.js} +1 -1
  119. package/public/assets/{stateDiagram-FKZM4ZOC-CxZMM1Lf.js → stateDiagram-FKZM4ZOC-CKyn6eKl.js} +1 -1
  120. package/public/assets/stateDiagram-v2-4FDKWEC3-DogBVcJE.js +1 -0
  121. package/public/assets/{table-Clz57edU.js → table-BgVewkB5.js} +1 -1
  122. package/public/assets/{timeline-definition-IT6M3QCI-Crg44TaP.js → timeline-definition-IT6M3QCI-Cm5SIAmT.js} +1 -1
  123. package/public/assets/tools-crrPnehB.js +1 -0
  124. package/public/assets/{treemap-KMMF4GRG-bFxwBWXw.js → treemap-KMMF4GRG-CUMeoVWM.js} +1 -1
  125. package/public/assets/{ui-components-DjgDPiqV.js → ui-components-D1pZO0y-.js} +1 -1
  126. package/public/assets/{useAgents-8KXN6U61.js → useAgents-M4lcWvy0.js} +1 -1
  127. package/public/assets/{useClaudeVersions-DicHLV6A.js → useClaudeVersions-CKT_fq1t.js} +1 -1
  128. package/public/assets/{useCommands-DbSH48ba.js → useCommands-vaoVPEDI.js} +1 -1
  129. package/public/assets/{useProjects-Bbh6hJMM.js → useProjects-D1ElB-WS.js} +1 -1
  130. package/public/assets/{useSessions-DOa4-xiB.js → useSessions-Dp1kUl43.js} +1 -1
  131. package/public/assets/{xychartDiagram-PRI3JC2R-DG3KmjD-.js → xychartDiagram-PRI3JC2R-Cy-SHDyX.js} +1 -1
  132. package/public/index.html +4 -4
  133. package/routes/a2a.d.ts.map +1 -1
  134. package/routes/a2a.js +27 -7
  135. package/routes/a2a.js.map +1 -1
  136. package/routes/agents.d.ts.map +1 -1
  137. package/routes/agents.js +234 -38
  138. package/routes/agents.js.map +1 -1
  139. package/routes/agui.d.ts.map +1 -1
  140. package/routes/agui.js +44 -1
  141. package/routes/agui.js.map +1 -1
  142. package/routes/gitVersions.d.ts.map +1 -1
  143. package/routes/gitVersions.js +80 -1
  144. package/routes/gitVersions.js.map +1 -1
  145. package/routes/marketplaceSkills.d.ts +18 -0
  146. package/routes/marketplaceSkills.d.ts.map +1 -0
  147. package/routes/marketplaceSkills.js +190 -0
  148. package/routes/marketplaceSkills.js.map +1 -0
  149. package/routes/plugins.d.ts.map +1 -1
  150. package/routes/plugins.js +48 -7
  151. package/routes/plugins.js.map +1 -1
  152. package/routes/projects.d.ts.map +1 -1
  153. package/routes/projects.js +34 -0
  154. package/routes/projects.js.map +1 -1
  155. package/schemas/a2a.d.ts +35 -4
  156. package/schemas/a2a.d.ts.map +1 -1
  157. package/schemas/a2a.js +9 -1
  158. package/schemas/a2a.js.map +1 -1
  159. package/services/__tests__/agentImporter.test.js +197 -0
  160. package/services/__tests__/agentImporter.test.js.map +1 -1
  161. package/services/__tests__/pluginInstaller.test.js +2 -1
  162. package/services/__tests__/pluginInstaller.test.js.map +1 -1
  163. package/services/agentImporter.d.ts +7 -0
  164. package/services/agentImporter.d.ts.map +1 -1
  165. package/services/agentImporter.js +57 -4
  166. package/services/agentImporter.js.map +1 -1
  167. package/services/builtinMarketplaceService.d.ts +56 -0
  168. package/services/builtinMarketplaceService.d.ts.map +1 -0
  169. package/services/builtinMarketplaceService.js +328 -0
  170. package/services/builtinMarketplaceService.js.map +1 -0
  171. package/services/claudeSession.d.ts.map +1 -1
  172. package/services/claudeSession.js +15 -4
  173. package/services/claudeSession.js.map +1 -1
  174. package/services/claudeVersionStorage.js +6 -6
  175. package/services/claudeVersionStorage.js.map +1 -1
  176. package/services/gitVersionService.d.ts +22 -0
  177. package/services/gitVersionService.d.ts.map +1 -1
  178. package/services/gitVersionService.js +117 -19
  179. package/services/gitVersionService.js.map +1 -1
  180. package/services/marketplaceSkillService.d.ts +129 -0
  181. package/services/marketplaceSkillService.d.ts.map +1 -0
  182. package/services/marketplaceSkillService.js +358 -0
  183. package/services/marketplaceSkillService.js.map +1 -0
  184. package/services/marketplaceUpdateService.d.ts.map +1 -1
  185. package/services/marketplaceUpdateService.js +29 -2
  186. package/services/marketplaceUpdateService.js.map +1 -1
  187. package/services/pluginCopyInstall.d.ts +60 -0
  188. package/services/pluginCopyInstall.d.ts.map +1 -0
  189. package/services/pluginCopyInstall.js +290 -0
  190. package/services/pluginCopyInstall.js.map +1 -0
  191. package/services/pluginInstallStrategy.d.ts +39 -0
  192. package/services/pluginInstallStrategy.d.ts.map +1 -0
  193. package/services/pluginInstallStrategy.js +50 -0
  194. package/services/pluginInstallStrategy.js.map +1 -0
  195. package/services/pluginInstaller.d.ts +10 -0
  196. package/services/pluginInstaller.d.ts.map +1 -1
  197. package/services/pluginInstaller.js +70 -20
  198. package/services/pluginInstaller.js.map +1 -1
  199. package/services/pluginParser.d.ts +17 -1
  200. package/services/pluginParser.d.ts.map +1 -1
  201. package/services/pluginParser.js +161 -84
  202. package/services/pluginParser.js.map +1 -1
  203. package/services/pluginPaths.d.ts +3 -3
  204. package/services/pluginPaths.d.ts.map +1 -1
  205. package/services/pluginPaths.js +33 -14
  206. package/services/pluginPaths.js.map +1 -1
  207. package/services/pluginScanner.js +2 -2
  208. package/services/pluginScanner.js.map +1 -1
  209. package/services/pluginSymlink.d.ts +10 -0
  210. package/services/pluginSymlink.d.ts.map +1 -1
  211. package/services/pluginSymlink.js +117 -1
  212. package/services/pluginSymlink.js.map +1 -1
  213. package/services/preSendGuard/__tests__/preSendGuard.test.d.ts +2 -0
  214. package/services/preSendGuard/__tests__/preSendGuard.test.d.ts.map +1 -0
  215. package/services/preSendGuard/__tests__/preSendGuard.test.js +102 -0
  216. package/services/preSendGuard/__tests__/preSendGuard.test.js.map +1 -0
  217. package/services/preSendGuard/configResolver.d.ts +8 -0
  218. package/services/preSendGuard/configResolver.d.ts.map +1 -0
  219. package/services/preSendGuard/configResolver.js +181 -0
  220. package/services/preSendGuard/configResolver.js.map +1 -0
  221. package/services/preSendGuard/index.d.ts +9 -0
  222. package/services/preSendGuard/index.d.ts.map +1 -0
  223. package/services/preSendGuard/index.js +165 -0
  224. package/services/preSendGuard/index.js.map +1 -0
  225. package/services/preSendGuard/providers/httpAuditProvider.d.ts +3 -0
  226. package/services/preSendGuard/providers/httpAuditProvider.d.ts.map +1 -0
  227. package/services/preSendGuard/providers/httpAuditProvider.js +98 -0
  228. package/services/preSendGuard/providers/httpAuditProvider.js.map +1 -0
  229. package/services/preSendGuard/providers/noopProvider.d.ts +3 -0
  230. package/services/preSendGuard/providers/noopProvider.d.ts.map +1 -0
  231. package/services/preSendGuard/providers/noopProvider.js +13 -0
  232. package/services/preSendGuard/providers/noopProvider.js.map +1 -0
  233. package/services/runFinishedHooks.d.ts +29 -0
  234. package/services/runFinishedHooks.d.ts.map +1 -0
  235. package/services/runFinishedHooks.js +57 -0
  236. package/services/runFinishedHooks.js.map +1 -0
  237. package/testing/index.d.ts +18 -0
  238. package/testing/index.d.ts.map +1 -0
  239. package/testing/index.js +25 -0
  240. package/testing/index.js.map +1 -0
  241. package/testing/mockSdkQuery.d.ts +49 -0
  242. package/testing/mockSdkQuery.d.ts.map +1 -0
  243. package/testing/mockSdkQuery.js +209 -0
  244. package/testing/mockSdkQuery.js.map +1 -0
  245. package/testing/scenarioLoader.d.ts +71 -0
  246. package/testing/scenarioLoader.d.ts.map +1 -0
  247. package/testing/scenarioLoader.js +224 -0
  248. package/testing/scenarioLoader.js.map +1 -0
  249. package/types/a2a.d.ts +5 -0
  250. package/types/a2a.d.ts.map +1 -1
  251. package/types/agents.d.ts +32 -0
  252. package/types/agents.d.ts.map +1 -1
  253. package/types/agents.js +1 -0
  254. package/types/agents.js.map +1 -1
  255. package/types/engine.d.ts +6 -0
  256. package/types/engine.d.ts.map +1 -1
  257. package/types/plugins.d.ts +12 -2
  258. package/types/plugins.d.ts.map +1 -1
  259. package/types/preSendGuard.d.ts +51 -0
  260. package/types/preSendGuard.d.ts.map +1 -0
  261. package/types/preSendGuard.js +3 -0
  262. package/types/preSendGuard.js.map +1 -0
  263. package/utils/__tests__/claudeUtils.test.js +89 -1
  264. package/utils/__tests__/claudeUtils.test.js.map +1 -1
  265. package/utils/claudeUtils.d.ts +1 -1
  266. package/utils/claudeUtils.d.ts.map +1 -1
  267. package/utils/claudeUtils.js +92 -37
  268. package/utils/claudeUtils.js.map +1 -1
  269. package/public/assets/ChatPage-D8buVhfb.js +0 -478
  270. package/public/assets/GeneralSettingsPage-DYdwai51.js +0 -1
  271. package/public/assets/PluginsPage-DD92Xk6X.js +0 -12
  272. package/public/assets/SettingsLayout-LGC-0pQl.js +0 -1
  273. package/public/assets/UnifiedToolSelector-BP6fuyzG.js +0 -1
  274. package/public/assets/channel-D9wyZF1L.js +0 -1
  275. package/public/assets/classDiagram-2ON5EDUG-DwEqkkEb.js +0 -1
  276. package/public/assets/classDiagram-v2-WZHVMYZB-DwEqkkEb.js +0 -1
  277. package/public/assets/clone-3wFPaI2j.js +0 -1
  278. package/public/assets/infoDiagram-F6ZHWCRC-HUfwv_JT.js +0 -2
  279. package/public/assets/stateDiagram-v2-4FDKWEC3-CmurzrWf.js +0 -1
  280. package/public/assets/tools-BZTR2NP1.js +0 -1
@@ -0,0 +1,478 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dagre-6UL2VRFP-D-NrLBGh.js","assets/graph-BYXvelIL.js","assets/_baseUniq-Q0NUbuSr.js","assets/layout-CgO4Vp_y.js","assets/_basePickBy-0UeYrifO.js","assets/clone-D5-Tsf9e.js","assets/data-structures-ChC1tqVg.js","assets/monaco-editor-BWfQfpij.js","assets/syntax-highlighting-DGbNjS3S.js","assets/agents-DR9EZMs5.js","assets/tools-crrPnehB.js","assets/ui-components-D1pZO0y-.js","assets/agents-DwCY2K8p.css","assets/useAgents-M4lcWvy0.js","assets/useSessions-Dp1kUl43.js","assets/index-BIGPvi1D.js","assets/index-gbHlIp96.css","assets/useCommands-vaoVPEDI.js","assets/useClaudeVersions-CKT_fq1t.js","assets/FileExplorer-BprfeAH_.js","assets/UnifiedToolSelector-DJN7ASu1.js","assets/FileBrowser-DHyCacM6.js","assets/ProjectSelector-CyBlHb2H.js","assets/cose-bilkent-S5V4N54A-BuEw-qDX.js","assets/cytoscape.esm-DtBltrT8.js","assets/c4Diagram-YG6GDRKO-J2ovCYEr.js","assets/chunk-TZMSLE5B-DtY3rhWy.js","assets/flowDiagram-NV44I4VS-DTMKSJI1.js","assets/chunk-FMBD7UC4-Bz2LO9q3.js","assets/chunk-55IACEB6-CMASo37Z.js","assets/chunk-QN33PNHL-D7mfK9Pm.js","assets/channel-gveiJv4S.js","assets/erDiagram-Q2GNP2WA-Cov6xnUk.js","assets/gitGraphDiagram-NY62KEGX-CvxYSabY.js","assets/chunk-4BX2VUAB-D7Mc44O6.js","assets/chunk-QZHKN3VN-AkuNbqQU.js","assets/treemap-KMMF4GRG-CUMeoVWM.js","assets/ganttDiagram-LVOFAZNH-DR0bcfHY.js","assets/linear-CaY74pOB.js","assets/init-Gi6I4Gst.js","assets/defaultLocale-C4B-KCzX.js","assets/infoDiagram-F6ZHWCRC-CL9g-UgS.js","assets/pieDiagram-ADFJNKIX-BQt_waQk.js","assets/arc-BV8erW1-.js","assets/ordinal-Cboi1Yqb.js","assets/quadrantDiagram-AYHSOK5B-DvLFoDeH.js","assets/xychartDiagram-PRI3JC2R-Cy-SHDyX.js","assets/requirementDiagram-UZGBJVZJ-C4lqjEUP.js","assets/sequenceDiagram-WL72ISMW-BeyhJ61U.js","assets/classDiagram-2ON5EDUG-f-lJUj27.js","assets/chunk-B4BG7PRW-2T3W2IB6.js","assets/classDiagram-v2-WZHVMYZB-f-lJUj27.js","assets/stateDiagram-FKZM4ZOC-CKyn6eKl.js","assets/chunk-DI55MBZ5-FR9qswmO.js","assets/stateDiagram-v2-4FDKWEC3-DogBVcJE.js","assets/journeyDiagram-XKPGCS4Q-Df8G0pW8.js","assets/timeline-definition-IT6M3QCI-Cm5SIAmT.js","assets/mindmap-definition-VGOIOE7T-CVK2y0WQ.js","assets/kanban-definition-3W4ZIXB7-DhoP7TG_.js","assets/sankeyDiagram-TZEHDZUN-BKIDyl6M.js","assets/diagram-S2PKOQOG-BLKbR12g.js","assets/diagram-QEK2KX5R-C0YlDb8t.js","assets/blockDiagram-VD42YOAC-4H3KjsGf.js","assets/architectureDiagram-VXUJARFQ-BIodTu6s.js","assets/diagram-PSM6KHXK-BFjWOHNz.js"])))=>i.map(i=>d[i]);
2
+ import{j as d}from"./data-structures-ChC1tqVg.js";import{r as M,g as bh,W as Rr}from"./monaco-editor-BWfQfpij.js";import{A as or,a as mr,p as qp,u as kh,h as sv,l as Up,d as Vp,q as iv,S as av}from"./agents-DR9EZMs5.js";import{g as ov,h as Gp,i as Yp,j as Xp,k as lv}from"./useAgents-M4lcWvy0.js";import{u as Kp}from"./useSessions-Dp1kUl43.js";import{u as de,B as $e,T as je,b as cv,K as uv,c as hv}from"./tools-crrPnehB.js";import{m as Ar,S as Yc,aB as dv,o as fv,_ as Qp,I as Xc,b3 as Zp,b4 as Jp,X as ts,k as At,l as qt,R as ro,L as Tn,C as sn,n as zi,j as rs,Z as no,aV as gv,$ as oc,b5 as pv,b6 as Pa,b7 as em,E as mv,az as tm,aI as xv,aF as yv,V as wh,b8 as Kc,c as Gd,w as vh,Y as bv,d as Ch,as as Yd,f as Xd,u as rm,aE as cl,v as ul,au as kv,ae as nm,y as sm,P as im,G as wv,b9 as Us,ba as vv,aA as am,bb as Cv,r as om,an as Sv,bc as _v,ah as Kd,ac as lm,b as cm,z as Qd,af as Tv,ad as Zd}from"./ui-components-D1pZO0y-.js";import{d as Nv,o as um,m as Ev,e as Sh,b as _h,p as Av,u as Mv}from"./index-BIGPvi1D.js";import{u as Qc,f as Zc}from"./useCommands-vaoVPEDI.js";import{u as jv}from"./useClaudeVersions-CKT_fq1t.js";import{e as Jc,E as eu,F as Jd}from"./FileExplorer-BprfeAH_.js";import{c as Ue,h as hm}from"./syntax-highlighting-DGbNjS3S.js";import{U as Th}from"./UnifiedToolSelector-DJN7ASu1.js";import{F as Iv}from"./FileBrowser-DHyCacM6.js";import{P as Lv}from"./ProjectSelector-CyBlHb2H.js";const $v={showMcpToolSelector:!0,showImageUpload:!0,showPermissionSelector:!0,showProviderSelector:!0,showModelSelector:!0,showEnvVars:!0},Dv={showMcpToolSelector:!1,showImageUpload:!0,showPermissionSelector:!1,showProviderSelector:!1,showModelSelector:!0,showEnvVars:!1};function Wi(e){return e==="cursor"?Dv:$v}async function Bv(e){try{const t=await mr(`${or}/agui/engines/${e}`);return t.ok?await t.json():(console.warn(`[AGUI] Failed to fetch engine info: ${t.status}`),null)}catch(t){return console.warn("[AGUI] Error fetching engine info:",t),null}}const Rv=()=>{const e=M.useCallback(async n=>{const{message:s,engineType:i="claude",workspace:a,sessionId:o,model:l,providerId:c,permissionMode:u,mcpTools:h,envVars:f,timeout:g,onAguiEvent:p,onError:m,abortController:y,agentId:x="claude-code",images:k,channel:C="web"}=n;try{console.log(`🚀 [AGUI] Starting ${i} chat request`);let T,S;i==="cursor"?(T=`${or}/agui/chat`,S={message:s,engineType:"cursor",workspace:a,timeout:g},o&&(S.sessionId=o),l&&(S.model=l,console.log(`🎯 [AGUI] Cursor model: ${l}`)),k&&k.length>0&&(S.images=k,console.log(`🖼️ [AGUI] Cursor images: ${k.length} image(s)`))):(T=`${or}/agents/chat`,S={message:s,agentId:x,sessionId:o,projectPath:a,mcpTools:h,permissionMode:u,model:l,claudeVersion:c,envVars:f,images:k,channel:C,outputFormat:"agui"}),console.log(`🚀 [AGUI] Endpoint: ${T}`);const w=await mr(T,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(S),signal:y?.signal});if(!w.ok)throw new Error(`AGUI chat request failed: ${w.status} ${w.statusText}`);const _=w.body?.getReader(),O=new TextDecoder;let P="",v=o||"";if(!_)throw new Error("No response body");for(;;){if(y?.signal.aborted)throw _.cancel(),new DOMException("Request aborted","AbortError");const{done:L,value:N}=await _.read();if(L)break;const R=O.decode(N,{stream:!0});P+=R;const j=P.split(`
3
+ `);P=j.pop()||"";for(const B of j)if(!(!B.trim()||B.startsWith(":"))&&!B.startsWith("event:")&&B.startsWith("data:")){const I=B.slice(5).trim();if(!I)continue;try{const F=JSON.parse(I);F.type==="RUN_STARTED"&&F.threadId&&(v=F.threadId),p&&p(F)}catch{console.warn("[AGUI] Failed to parse event:",I.substring(0,100))}}}return console.log(`✅ [AGUI] Chat completed, sessionId: ${v}`),{sessionId:v,success:!0}}catch(T){return console.error("[AGUI] Chat error:",T),m&&T instanceof Error&&m(T),{sessionId:o||"",success:!1,error:T instanceof Error?T.message:String(T)}}},[]),t=M.useCallback(async()=>{try{const n=await mr(`${or}/agui/engines`);if(!n.ok)throw new Error(`Failed to get engines: ${n.status}`);return(await n.json()).engines||[]}catch(n){return console.error("[AGUI] Failed to get engines:",n),[]}},[]),r=M.useCallback(async(n,s="claude")=>{try{return(await mr(`${or}/agui/sessions/${n}/interrupt`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({engineType:s})})).ok}catch(i){return console.error("[AGUI] Failed to interrupt session:",i),!1}},[]);return{sendMessage:e,getEngines:t,interruptSession:r}},dm="agentstudio:engine-type";function ef(){try{const e=localStorage.getItem(dm);if(e==="claude"||e==="cursor")return e}catch{}return"claude"}function Pv(e){try{localStorage.setItem(dm,e)}catch{}}const Fe=qp((e,t)=>({currentAgent:null,selectedEngine:ef(),engineUICapabilities:Wi(ef()),engineModels:[],messages:[],isAiTyping:!1,currentSessionId:null,mcpStatus:{hasError:!1,connectedServers:[],connectionErrors:[],lastError:null,lastErrorDetails:void 0,lastUpdated:void 0},pendingUserQuestion:null,activeA2AStreams:{},sidebarCollapsed:!1,setCurrentAgent:r=>e(n=>({currentAgent:r,...n.currentAgent?.id!==r?.id?{messages:[],isAiTyping:!1,currentSessionId:null}:{}})),setSelectedEngine:r=>e(n=>({selectedEngine:r,engineUICapabilities:Wi(r),...n.selectedEngine!==r?{messages:[],isAiTyping:!1,currentSessionId:null}:{}})),setEngineUICapabilities:r=>e({engineUICapabilities:r}),setEngineModels:r=>e({engineModels:r}),addMessage:r=>e(n=>({messages:[...n.messages,{...r,id:`${Date.now()}_${Math.random().toString(36).substr(2,9)}`,timestamp:Date.now(),agentId:n.currentAgent?.id||"unknown",messageParts:[]}]})),updateMessage:(r,n)=>e(s=>({messages:s.messages.map(i=>i.id===r?{...i,...n}:i)})),addTextPartToMessage:(r,n)=>e(s=>({messages:s.messages.map(i=>i.id===r?{...i,messageParts:[...i.messageParts||[],{id:`${Date.now()}_${Math.random().toString(36).substr(2,9)}`,type:"text",content:n,order:(i.messageParts||[]).length}]}:i)})),addThinkingPartToMessage:(r,n)=>e(s=>({messages:s.messages.map(i=>i.id===r?{...i,messageParts:[...i.messageParts||[],{id:`${Date.now()}_${Math.random().toString(36).substr(2,9)}`,type:"thinking",content:n,order:(i.messageParts||[]).length}]}:i)})),updateTextPartInMessage:(r,n,s)=>e(i=>({messages:i.messages.map(a=>a.id===r?{...a,messageParts:a.messageParts?.map(o=>o.type==="text"&&o.id===n?{...o,content:s}:o)}:a)})),updateThinkingPartInMessage:(r,n,s)=>e(i=>({messages:i.messages.map(a=>a.id===r?{...a,messageParts:a.messageParts?.map(o=>o.type==="thinking"&&o.id===n?{...o,content:s}:o)}:a)})),addCompactSummaryPartToMessage:(r,n)=>e(s=>({messages:s.messages.map(i=>i.id===r?{...i,messageParts:[...i.messageParts||[],{id:`${Date.now()}_${Math.random().toString(36).substr(2,9)}`,type:"compactSummary",content:n,order:(i.messageParts||[]).length}]}:i)})),addCommandPartToMessage:(r,n)=>e(s=>({messages:s.messages.map(i=>i.id===r?{...i,messageParts:[...i.messageParts||[],{id:`${Date.now()}_${Math.random().toString(36).substr(2,9)}`,type:"command",content:n,order:(i.messageParts||[]).length}]}:i)})),addToolPartToMessage:(r,n)=>e(s=>({messages:s.messages.map(i=>i.id===r?{...i,messageParts:[...i.messageParts||[],{id:`${Date.now()}_${Math.random().toString(36).substr(2,9)}`,type:"tool",toolData:{...n,id:`${Date.now()}_${Math.random().toString(36).substr(2,9)}`,isExecuting:n.isExecuting??!1},order:(i.messageParts||[]).length}]}:i)})),updateToolPartInMessage:(r,n,s)=>e(i=>({messages:i.messages.map(a=>a.id===r?{...a,messageParts:a.messageParts?.map(o=>o.type==="tool"&&(o.toolData?.id===n||o.toolData?.claudeId===n)?{...o,toolData:o.toolData?{...o.toolData,...s}:void 0}:o)}:a)})),interruptAllExecutingTools:()=>e(r=>({messages:r.messages.map(n=>({...n,messageParts:n.messageParts?.map(s=>s.type==="tool"&&s.toolData?.isExecuting?{...s,toolData:{...s.toolData,isExecuting:!1,isInterrupted:!0}}:s)}))})),setAiTyping:r=>e({isAiTyping:r}),setCurrentSessionId:r=>e({currentSessionId:r}),clearMessages:()=>e({messages:[]}),loadSessionMessages:r=>e({messages:r}),updateMcpStatus:r=>e(n=>({mcpStatus:{...n.mcpStatus,...r,lastUpdated:Date.now()}})),clearMcpStatus:()=>e({mcpStatus:{hasError:!1,connectedServers:[],connectionErrors:[],lastError:null,lastErrorDetails:void 0,lastUpdated:void 0}}),setPendingUserQuestion:r=>e({pendingUserQuestion:r}),setA2AStreamStart:(r,n,s)=>e(i=>({activeA2AStreams:{...i.activeA2AStreams,[r]:{sessionId:n,agentUrl:r,message:s,startedAt:Date.now(),isStreaming:!0,events:[]}}})),setA2AStreamEnd:r=>e(n=>{const s=n.activeA2AStreams[r];return s?{activeA2AStreams:{...n.activeA2AStreams,[r]:{...s,isStreaming:!1}}}:n}),addA2AStreamEvent:(r,n)=>e(s=>{const i=s.activeA2AStreams[r];return i?{activeA2AStreams:{...s.activeA2AStreams,[r]:{...i,events:[...i.events,n]}}}:{activeA2AStreams:{...s.activeA2AStreams,[r]:{sessionId:n.sessionId||"",agentUrl:r,message:"",startedAt:Date.now(),isStreaming:!0,events:[n]}}}}),getA2AStreamByUrl:r=>t().activeA2AStreams[r],setSidebarCollapsed:r=>e({sidebarCollapsed:r})}));class gt{static instance;static STORAGE_KEY="active_chat_tabs";static WAKEUP_SIGNAL_KEY="tab_wakeup_signal";static WAKEUP_RESPONSE_KEY="tab_wakeup_response";static TAB_TIMEOUT=300*1e3;currentTabId;cleanupInterval;lastKnownSession=null;sessionResumeHistory=[];constructor(){this.currentTabId=this.generateTabId(),this.startCleanupTimer(),this.setupBeforeUnloadHandler(),console.log(`📱 TabManager initialized with ID: ${this.currentTabId}`)}static getInstance(){return gt.instance||(gt.instance=new gt),gt.instance}registerCurrentTab(t,r){const n=this.getActiveTabs(),s=this.getTabKey(t,r),i={agentId:t,sessionId:r,url:window.location.href,lastSeen:Date.now(),tabId:this.currentTabId,title:document.title};n[s]=i,this.saveActiveTabs(n),console.log(`📱 Tab registered: ${this.currentTabId} for session ${r}`),this.lastKnownSession={agentId:t,sessionId:r}}updateCurrentTabActivity(t,r){const n=this.getActiveTabs(),s=this.getTabKey(t,r);n[s]&&n[s].tabId===this.currentTabId&&(n[s].lastSeen=Date.now(),n[s].url=window.location.href,n[s].title=document.title,this.saveActiveTabs(n),this.lastKnownSession={agentId:t,sessionId:r})}hasActiveTab(t,r){return this.findActiveTabForSession(t,r)!==null}findActiveTabForSession(t,r){const n=this.getActiveTabs(),s=this.getTabKey(t,r);if(n[s]&&Date.now()-n[s].lastSeen<gt.TAB_TIMEOUT)return n[s];for(const[i,a]of Object.entries(n))if(a.agentId===t&&a.sessionId===r){if(Date.now()-a.lastSeen<gt.TAB_TIMEOUT)return a;delete n[i],this.saveActiveTabs(n),console.log(`🗑️ Cleaned up expired tab: ${r}`)}return null}async wakeupExistingTab(t,r,n){if(!this.findActiveTabForSession(t,r))return!1;const i={type:"WAKEUP",agentId:t,sessionId:r,requestId:this.generateRequestId(),timestamp:Date.now(),sourceUrl:n||window.location.href};return console.log(`🔔 Sending wakeup signal for session: ${r}`),localStorage.setItem(gt.WAKEUP_SIGNAL_KEY,JSON.stringify(i)),new Promise(a=>{const o=setTimeout(()=>{console.log(`⏰ Wakeup timeout for session ${r}`),a(!1)},2e3),c=setInterval(()=>{const u=localStorage.getItem(gt.WAKEUP_RESPONSE_KEY);if(u)try{const h=JSON.parse(u);if(h.requestId===i.requestId){clearTimeout(o),localStorage.removeItem(gt.WAKEUP_RESPONSE_KEY),console.log(`✅ Tab awakened successfully: ${r}`),a(h.success);return}}catch(h){console.error("Error parsing wakeup response:",h)}},100);setTimeout(()=>clearInterval(c),2e3)})}setupWakeupListener(t,r){const n=i=>{if(i.key===gt.WAKEUP_SIGNAL_KEY&&i.newValue)try{const a=JSON.parse(i.newValue);a.type==="WAKEUP"&&a.agentId===t&&a.sessionId===r&&this.handleWakeupSignal(a)}catch(a){console.error("Error handling wakeup signal:",a)}};window.addEventListener("storage",n);const s=setInterval(()=>{const i=localStorage.getItem(gt.WAKEUP_SIGNAL_KEY);if(i)try{const a=JSON.parse(i);a.type==="WAKEUP"&&a.agentId===t&&a.sessionId===r&&Date.now()-a.timestamp<5e3&&this.handleWakeupSignal(a)}catch(a){console.error("Error polling wakeup signal:",a)}},500);return console.log(`🎯 Wakeup listener setup for session: ${r}`),()=>{window.removeEventListener("storage",n),clearInterval(s),console.log(`🎯 Wakeup listener cleaned up for session: ${r}`)}}updateCurrentTabSession(t,r,n,s){const i=this.getActiveTabs(),a=this.getTabKey(t,r);i[a]&&i[a].tabId===this.currentTabId&&delete i[a];const o=this.getTabKey(n,s);i[o]={agentId:n,sessionId:s,url:window.location.href,lastSeen:Date.now(),tabId:this.currentTabId,title:document.title},this.saveActiveTabs(i),console.log(`🔄 Tab session updated: ${r} → ${s}`),this.lastKnownSession={agentId:n,sessionId:s}}unregisterCurrentTabSession(t,r){const n=this.getActiveTabs(),s=this.getTabKey(t,r);n[s]&&n[s].tabId===this.currentTabId&&(delete n[s],this.saveActiveTabs(n),console.log(`📤 Unregistered current tab from session: ${r}`)),this.lastKnownSession&&this.lastKnownSession.agentId===t&&this.lastKnownSession.sessionId===r&&(this.lastKnownSession=null)}handleSessionResume(t,r,n){const s=this.getActiveTabs(),i=this.getTabKey(t,r),a=this.getTabKey(t,n);s[i]&&s[i].tabId===this.currentTabId?(delete s[i],s[a]={agentId:t,sessionId:n,url:window.location.href,lastSeen:Date.now(),tabId:this.currentTabId,title:document.title},this.saveActiveTabs(s),console.log(`🔄 Session resumed: ${r} → ${n}`),this.lastKnownSession={agentId:t,sessionId:n}):(this.registerCurrentTab(t,n),console.log(`🆕 Resumed session registered: ${n}`))}recordSessionResume(t,r,n){this.sessionResumeHistory.push({originalSessionId:r,newSessionId:n,timestamp:Date.now(),agentId:t}),this.sessionResumeHistory.length>100&&(this.sessionResumeHistory=this.sessionResumeHistory.slice(-100)),console.log(`📝 Recorded session resume: ${r} → ${n}`)}smartUpdateCurrentTab(){const t=window.location.href,r=this.parseSessionFromUrl(t);if(!r){this.lastKnownSession&&(this.unregisterCurrentTabSession(this.lastKnownSession.agentId,this.lastKnownSession.sessionId),this.lastKnownSession=null);return}const{agentId:n,sessionId:s}=r;if(this.lastKnownSession){const{agentId:i,sessionId:a}=this.lastKnownSession;a!==s||i!==n?this.sessionResumeHistory.find(l=>l.originalSessionId===a&&l.newSessionId===s&&l.agentId===n&&Date.now()-l.timestamp<3e4)?(this.handleSessionResume(n,a,s),console.log(`🔄 Detected session resume via URL: ${a} → ${s}`)):(this.updateCurrentTabSession(i,a,n,s),console.log(`🎯 Regular session switch: ${a} → ${s}`)):this.updateCurrentTabActivity(n,s)}else this.registerCurrentTab(n,s),console.log(`🎯 Initial session register: ${s}`);this.lastKnownSession={agentId:n,sessionId:s}}startSmartMonitoring(){this.smartUpdateCurrentTab();const t=()=>{setTimeout(()=>this.smartUpdateCurrentTab(),100)};window.addEventListener("popstate",t);const r=history.pushState,n=history.replaceState;return history.pushState=function(...s){r.apply(this,s),t()},history.replaceState=function(...s){n.apply(this,s),t()},console.log(`🎯 Smart monitoring started for tab: ${this.currentTabId}`),()=>{window.removeEventListener("popstate",t),history.pushState=r,history.replaceState=n,console.log(`🛑 Smart monitoring stopped for tab: ${this.currentTabId}`)}}handleWakeupSignal(t){console.log(`🔔 Received wakeup signal for session: ${t.sessionId}`);try{if(window.focus(),window.parent&&window.parent!==window&&window.parent.focus(),document.hidden){const n=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0});document.dispatchEvent(n)}}catch(n){console.log("Focus attempt failed:",n)}this.flashPageTitle(),this.playNotificationSound(),t.sourceUrl&&t.sourceUrl!==window.location.href?this.isSameSession(t.sourceUrl,window.location.href)?(console.log("🎯 URLs point to same session, forcing visibility"),this.makePageVisible()):(console.log(`🔄 Navigating to: ${t.sourceUrl}`),window.history.replaceState(null,"",t.sourceUrl),window.location.reload()):this.makePageVisible();const r={requestId:t.requestId,agentId:t.agentId,sessionId:t.sessionId,success:!0,timestamp:Date.now()};localStorage.setItem(gt.WAKEUP_RESPONSE_KEY,JSON.stringify(r)),localStorage.removeItem(gt.WAKEUP_SIGNAL_KEY),this.updateCurrentTabActivity(t.agentId,t.sessionId),console.log(`✅ Wakeup signal processed successfully for session: ${t.sessionId}`)}flashPageTitle(){const t=document.title;let r=0;const n=setInterval(()=>{document.title=r%2===0?"🔔 会话已唤起":t,r++,r>6&&(clearInterval(n),document.title=t)},500),s=()=>{clearInterval(n),document.title=t,window.removeEventListener("focus",s)};window.addEventListener("focus",s)}playNotificationSound(){try{const t=new(window.AudioContext||window.webkitAudioContext),r=t.createOscillator(),n=t.createGain();r.connect(n),n.connect(t.destination),r.frequency.setValueAtTime(800,t.currentTime),r.frequency.setValueAtTime(600,t.currentTime+.1),n.gain.setValueAtTime(.1,t.currentTime),n.gain.exponentialRampToValueAtTime(.01,t.currentTime+.2),r.start(t.currentTime),r.stop(t.currentTime+.2)}catch(t){console.log("Audio notification not supported:",t)}}makePageVisible(){try{window.scrollTo(0,0),document.fullscreenEnabled&&document.documentElement.requestFullscreen?.()?.then(()=>{setTimeout(()=>{document.exitFullscreen?.()},100)}).catch(n=>console.log("Fullscreen toggle failed:",n));const t=document.createElement("div");t.style.cssText=`
4
+ position: fixed;
5
+ top: 50%;
6
+ left: 50%;
7
+ transform: translate(-50%, -50%);
8
+ background: rgba(59, 130, 246, 0.9);
9
+ color: white;
10
+ padding: 20px 40px;
11
+ border-radius: 12px;
12
+ font-size: 18px;
13
+ font-weight: bold;
14
+ z-index: 999999;
15
+ box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
16
+ animation: bounce 0.6s ease-in-out;
17
+ `;const r=document.createElement("style");r.textContent=`
18
+ @keyframes bounce {
19
+ 0%, 20%, 53%, 80%, 100% {
20
+ transform: translate(-50%, -50%) translateY(0);
21
+ }
22
+ 40%, 43% {
23
+ transform: translate(-50%, -50%) translateY(-20px);
24
+ }
25
+ 70% {
26
+ transform: translate(-50%, -50%) translateY(-10px);
27
+ }
28
+ 90% {
29
+ transform: translate(-50%, -50%) translateY(-5px);
30
+ }
31
+ }
32
+ `,document.head.appendChild(r),t.textContent="🎯 会话已激活",document.body.appendChild(t),setTimeout(()=>{document.body.contains(t)&&document.body.removeChild(t),document.head.contains(r)&&document.head.removeChild(r)},2e3),console.log("🎯 Made page more visible")}catch(t){console.log("Make page visible failed:",t)}}parseSessionFromUrl(t){try{const r=new URL(t),n=r.pathname.split("/"),s=n.indexOf("chat");if(s!==-1&&n[s+1]){const i=n[s+1],a=r.searchParams.get("session");if(i&&a)return{agentId:i,sessionId:a}}return null}catch(r){return console.error("Error parsing session from URL:",r),null}}isSameSession(t,r){try{const n=this.parseSessionFromUrl(t),s=this.parseSessionFromUrl(r);return!n||!s?!1:n.agentId===s.agentId&&n.sessionId===s.sessionId}catch(n){return console.error("Error comparing session URLs:",n),!1}}getActiveTabs(){try{const t=localStorage.getItem(gt.STORAGE_KEY);return t?JSON.parse(t):{}}catch(t){return console.error("Error reading active tabs:",t),{}}}saveActiveTabs(t){try{localStorage.setItem(gt.STORAGE_KEY,JSON.stringify(t))}catch(r){console.error("Error saving active tabs:",r)}}getTabKey(t,r){return`${t}_${r}`}generateTabId(){return`tab_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}generateRequestId(){return`req_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}startCleanupTimer(){this.cleanupInterval=window.setInterval(()=>{this.cleanupExpiredTabs()},6e4)}cleanupExpiredTabs(){const t=this.getActiveTabs(),r=Date.now();let n=0;Object.keys(t).forEach(s=>{r-t[s].lastSeen>gt.TAB_TIMEOUT&&(delete t[s],n++)}),n>0&&(this.saveActiveTabs(t),console.log(`🗑️ Cleaned up ${n} expired tabs`))}setupBeforeUnloadHandler(){window.addEventListener("beforeunload",()=>{const t=this.getActiveTabs();Object.keys(t).forEach(r=>{t[r].tabId===this.currentTabId&&delete t[r]}),this.saveActiveTabs(t)})}getDebugInfo(){return{tabs:this.getActiveTabs(),currentTabId:this.currentTabId,lastKnownSession:this.lastKnownSession,resumeHistory:this.sessionResumeHistory}}clearAllTabs(){localStorage.removeItem(gt.STORAGE_KEY),localStorage.removeItem(gt.WAKEUP_SIGNAL_KEY),localStorage.removeItem(gt.WAKEUP_RESPONSE_KEY),this.sessionResumeHistory=[],this.lastKnownSession=null,console.log("🗑️ All tab records cleared")}stopCleanupTimer(){this.cleanupInterval&&(clearInterval(this.cleanupInterval),this.cleanupInterval=void 0,console.log("🛑 Cleanup timer stopped"))}}const Wr=gt.getInstance();window.tabManagerDebug={showTabs:()=>console.table(Wr.getDebugInfo().tabs),clearAll:()=>Wr.clearAllTabs(),testWakeup:(e,t)=>Wr.wakeupExistingTab(e,t),getCurrentTabId:()=>Wr.getDebugInfo().currentTabId,getDebugInfo:()=>Wr.getDebugInfo()};const Fv=({agentId:e,sessionId:t,projectPath:r,enabled:n=!0,interval:s=3e4,shouldCheckExistence:i=!1})=>{const a=M.useRef(null),o=M.useRef(0),l=M.useRef(!0),c=M.useRef(!1),u=M.useCallback(async()=>{if(!e||!t)return!1;try{const m=`${or}/sessions/${e}/${t}/check`,y=await mr(m);if(y.ok){const x=await y.json();return console.log(`🔍 Session existence check: ${t} - ${x.exists?"exists":"not found"}`),x.exists}return!1}catch(m){return console.error("❌ Error checking session existence:",m),!1}},[e,t]),h=M.useCallback(async()=>{if(!(!e||!t||!n))try{const m=`${or}/sessions/${e}/${t}/heartbeat`,y=await mr(m,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectPath:r,timestamp:Date.now()})});if(y.ok){const x=await y.json();o.current=x.timestamp,console.log(`💓 Session heartbeat sent successfully: ${t}`),Wr.updateCurrentTabActivity(e,t)}else console.warn(`⚠️ Failed to send heartbeat for session ${t}:`,y.status)}catch(m){console.error("💔 Error sending session heartbeat:",m)}},[e,t,r,n]),f=M.useCallback(()=>{l.current=!document.hidden,l.current&&n&&t&&h()},[h,n,t]),g=M.useCallback(async()=>{if(!(!n||!t||a.current)){if(i&&!c.current){const m=await u();if(c.current=!0,!m){console.log(`⏸️ Session ${t} not found in SessionManager, heartbeat not started`);return}}console.log(`💓 Starting heartbeat for session: ${t}`),h(),a.current=setInterval(()=>{h()},s)}},[n,t,h,s,i,u]),p=M.useCallback(()=>{a.current&&(console.log(`💔 Stopping heartbeat for session: ${t}`),clearInterval(a.current),a.current=null)},[t]);return M.useEffect(()=>(c.current=!1,t&&n?g():p(),()=>{p()}),[t,n,g,p]),M.useEffect(()=>(document.addEventListener("visibilitychange",f),()=>{document.removeEventListener("visibilitychange",f)}),[f]),M.useEffect(()=>()=>{p()},[p]),{sendHeartbeat:h,startHeartbeat:g,stopHeartbeat:p,checkSessionExists:u,lastHeartbeat:o.current}},fm=({agentId:e,sessionId:t,projectPath:r,enabled:n=!0,interval:s=3e4,isNewSession:i=!1,hasSuccessfulResponse:a=!1})=>{const o=M.useRef(null),l=M.useRef(!1),c=!t||!n?!1:i?a:!0,h=Fv({agentId:e,sessionId:t,projectPath:r,enabled:c,interval:s,shouldCheckExistence:!i&&!!t});return M.useEffect(()=>{o.current!==t&&(l.current=!1,o.current=t)},[t]),M.useEffect(()=>{c&&t&&!l.current&&(l.current=!0,console.log(`🚀 Heartbeat enabled for session: ${t} (new: ${i}, hasResponse: ${a})`))},[c,t,i,a]),{...h,isHeartbeatActive:c&&l.current}},gm=()=>{const[e,t]=M.useState(!1);return M.useEffect(()=>{const r=()=>{t(window.innerWidth<640)};return r(),window.addEventListener("resize",r),()=>window.removeEventListener("resize",r)},[]),{isCompactMode:e}},pm=({isOpen:e,onToggle:t,sessions:r,currentSessionId:n,onSwitchSession:s,isLoading:i=!1,searchTerm:a,onSearchChange:o})=>{const{t:l}=de("components"),c=M.useRef(null),u=M.useRef(null);M.useEffect(()=>{console.log("🎯 [DROPDOWN DEBUG] SessionsDropdown sessions updated:",{sessionCount:r.length,currentSessionId:n,searchTerm:a,sessions:r.map((f,g)=>({index:g+1,id:f.id,title:f.title,lastUpdated:f.lastUpdated,messageCount:f.messageCount,isCurrent:f.id===n}))})},[r,n,a]),M.useEffect(()=>{const f=g=>{c.current&&!c.current.contains(g.target)&&t()};return e&&document.addEventListener("mousedown",f),()=>{document.removeEventListener("mousedown",f)}},[e,t]),M.useEffect(()=>{e&&u.current&&setTimeout(()=>u.current?.focus(),100)},[e]);const h=r;return e?d.jsxs("div",{ref:c,className:"absolute top-full right-0 mt-1 w-80 bg-white rounded-lg shadow-lg border border-gray-200 z-50",children:[d.jsx("div",{className:"flex items-center justify-between p-3 border-b border-gray-100",children:d.jsxs("div",{className:"flex items-center space-x-2",children:[d.jsx(Ar,{className:"w-4 h-4 text-gray-600"}),d.jsx("span",{className:"text-sm font-medium text-gray-900",children:l("sessionDropdown.sessionHistory")})]})}),d.jsx("div",{className:"p-3 border-b border-gray-100",children:d.jsxs("div",{className:"relative",children:[d.jsx(Yc,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4"}),d.jsx("input",{ref:u,type:"text",value:a,onChange:f=>o(f.target.value),placeholder:l("sessionDropdown.searchPlaceholder"),className:"w-full pl-9 pr-3 py-2 text-sm text-gray-900 border border-gray-200 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent placeholder-gray-500"})]})}),d.jsx("div",{className:"max-h-80 overflow-y-auto",children:i?d.jsx("div",{className:"flex items-center justify-center py-8",children:d.jsx("div",{className:"animate-spin rounded-full h-5 w-5 border-b-2 border-blue-600"})}):h.length>0?d.jsx("div",{className:"py-2",children:h.map((f,g)=>d.jsxs("div",{onClick:()=>{console.log(`🖱️ [DROPDOWN DEBUG] Clicking session ${g+1}:`,{id:f.id,title:f.title,isCurrent:f.id===n}),s(f.id)},className:`mx-2 px-3 py-2 rounded cursor-pointer hover:bg-gray-50 transition-colors ${n===f.id?"bg-blue-50 border border-blue-200":"border border-transparent"}`,children:[d.jsxs("div",{className:"text-sm font-medium text-gray-900 truncate",title:`ID: ${f.id}`,children:[g+1,". ",f.title]}),d.jsxs("div",{className:"text-xs text-gray-500 mt-0.5",children:[l("sessionDropdown.messageCount",{count:f.messageCount})," • ",new Date(f.lastUpdated).toLocaleString("zh-CN",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})]})]},f.id))}):d.jsx("div",{className:"text-center py-8",children:a?d.jsxs("div",{children:[d.jsx(Yc,{className:"w-8 h-8 text-gray-300 mx-auto mb-2"}),d.jsx("p",{className:"text-sm text-gray-500",children:l("sessionDropdown.noMatchingSessions")})]}):d.jsxs("div",{children:[d.jsx(Ar,{className:"w-8 h-8 text-gray-300 mx-auto mb-2"}),d.jsx("p",{className:"text-sm text-gray-500",children:l("sessionDropdown.noSessionHistory")}),d.jsx("p",{className:"text-xs text-gray-400 mt-1",children:l("sessionDropdown.sessionWillAppear")})]})})})]}):null};function Ov(e,t){return t?e.replace(/@([\w.-]+(?:\/[\w.-]+)*(?:\.\w+)?)/g,(r,n)=>n.startsWith("/")?n:t+"/"+n):e}function zv(e,t,r){let n=e.content;return t&&(n=n.replace(/\$ARGUMENTS/g,t)),n=Ov(n,r),`<command-message>${t?`${e.description} (参数: ${t})`:e.description}</command-message><command-name>${n}</command-name>`}function Hi(e){return e.startsWith("/")}function Wv(e){return e.startsWith("/")?e.slice(1):""}const mm=({textareaRef:e,inputMessage:t,setInputMessage:r})=>{const[n,s]=M.useState([]),[i,a]=M.useState(null),[o,l]=M.useState(!1),c=M.useCallback(T=>{if(!e.current)return;const S=e.current,w=S.selectionStart||0,_=S.selectionEnd||0,O=t,P=O.substring(0,w)+T+O.substring(_);r(P),setTimeout(()=>{S.selectionStart=S.selectionEnd=w+T.length,S.focus()},0)},[t,r,e]),u=M.useCallback(T=>{const S=Date.now().toString()+Math.random().toString(36).substr(2,9),w=new FileReader;w.onload=_=>{_.target?.result&&s(O=>{const P=[...O,{id:S,file:T,preview:_.target.result}],L=`[image${P.length}]`;return c(L),P})},w.readAsDataURL(T)},[c]),h=M.useCallback(T=>{const S=T.target.files;if(!S)return;Array.from(S).filter(_=>_.type.startsWith("image/")&&["image/jpeg","image/png","image/gif","image/webp"].includes(_.type)).forEach(u),T.target&&(T.target.value="")},[u]),f=M.useCallback(T=>{s(S=>S.filter(w=>w.id!==T))},[]),g=M.useCallback(T=>{a(T)},[]),p=M.useCallback(T=>{const S=T.clipboardData?.items;if(!S)return;let w=!1;for(let _=0;_<S.length;_++){const O=S[_];if(O.type.startsWith("image/")){w=!0;const P=O.getAsFile();P&&u(P)}}w&&T.preventDefault()},[u]),m=M.useCallback(T=>{T.preventDefault(),l(!0)},[]),y=M.useCallback(T=>{T.preventDefault(),l(!1)},[]),x=M.useCallback(T=>{T.preventDefault(),l(!1);const S=T.dataTransfer?.files;if(!S)return;Array.from(S).filter(_=>_.type.startsWith("image/")&&["image/jpeg","image/png","image/gif","image/webp"].includes(_.type)).forEach(u)},[u]),k=M.useCallback(()=>{s([])},[]),C=M.useCallback(()=>n.map(T=>({id:T.id,data:T.preview.split(",")[1],mediaType:T.file.type,name:T.file.name})),[n]);return{selectedImages:n,previewImage:i,isDragOver:o,handleImageSelect:h,handleImageRemove:f,handleImagePreview:g,handlePaste:p,handleDragOver:m,handleDragLeave:y,handleDrop:x,clearImages:k,getImagesForBackend:C,setPreviewImage:a}},xm=({messagesContainerRef:e,messagesEndRef:t,messages:r,isAiTyping:n})=>{const[s,i]=M.useState(!1),[a,o]=M.useState(0),l=M.useCallback((h=100)=>{if(!e.current)return!1;const{scrollTop:f,scrollHeight:g,clientHeight:p}=e.current;return g-f-p<h},[e]),c=M.useCallback((h="smooth")=>{t.current?.scrollIntoView({behavior:h})},[t]),u=M.useCallback(()=>{const h=l();i(!h),h&&o(0)},[l]);return M.useEffect(()=>{const h=e.current;if(h)return h.addEventListener("scroll",u),()=>h.removeEventListener("scroll",u)},[u,e]),M.useEffect(()=>{s?o(h=>h+1):c()},[r,n,s,c]),{isUserScrolling:s,newMessagesCount:a,scrollToBottom:c,setNewMessagesCount:o,setIsUserScrolling:i}},ym=({projectPath:e,textareaRef:t})=>{const{t:r}=de("components"),[n,s]=M.useState(!1),[i,a]=M.useState(""),[o,l]=M.useState(null),[c,u]=M.useState(0),[h,f]=M.useState(null),[g,p]=M.useState(!1),[m,y]=M.useState(null),x=[{id:"init",name:"init",description:r("systemCommands.init.description"),content:"/init",scope:"system",isSystem:!0},{id:"clear",name:"clear",description:r("systemCommands.clear.description"),content:"/clear",scope:"system",isSystem:!0},{id:"compact",name:"compact",description:r("systemCommands.compact.description"),content:"/compact",scope:"system",isSystem:!0},{id:"agents",name:"agents",description:r("systemCommands.agents.description"),content:"/agents",scope:"system",isSystem:!0},{id:"settings",name:"settings",description:r("systemCommands.settings.description"),content:"/settings",scope:"system",isSystem:!0},{id:"help",name:"help",description:r("systemCommands.help.description"),content:"/help",scope:"system",isSystem:!0}],{data:k,error:C}=Qc({scope:"user",search:i}),{data:T,error:S}=Zc({projectId:e||"",search:i}),{data:w}=Qc({scope:"user"}),{data:_}=Zc({projectId:e||""}),O=Array.isArray(k?.commands)?k.commands:[],P=Array.isArray(T?.commands)?T.commands:[],v=Array.isArray(w?.commands)?w.commands:[],L=Array.isArray(_?.commands)?_.commands:[],N=M.useCallback(G=>{const $=x.find(D=>D.name===G),E=L.find(D=>D.name===G),Z=v.find(D=>D.name===G);return!!($||E||Z)},[x,L,v]),R=M.useCallback(()=>{const G=x.map(Z=>Z.content),$=L.map(Z=>`/${Z.name}`),E=v.map(Z=>`/${Z.name}`);return[...G,...$,...E].join(", ")},[x,L,v]),j=C||S,B=M.useMemo(()=>[...x.filter($=>$.name.toLowerCase().includes(i.toLowerCase())||$.description.toLowerCase().includes(i.toLowerCase())),...P,...O],[O,P,i,x]);M.useEffect(()=>{u(G=>B.length>0&&G>=B.length?0:G)},[B.length]);const I=M.useCallback(G=>{if(h&&f(null),G.length>0&&G[G.length-1]==="@"){const $=G.substring(0,G.length-1);if($.length===0||/\s$/.test($)){y(G.length-1),p(!0),t.current?.blur();return}}},[h,t]),F=M.useCallback(G=>(l(G),s(!1),`/${G.name}`),[]),W=M.useCallback(()=>{s(!1)},[]),ee=M.useCallback((G,$)=>{if(!t.current||m===null)return $;let E=G;e&&G.startsWith(e)&&(E=G.slice(e.length),E.startsWith("/")&&(E=E.slice(1)));const Z=$.substring(0,m),D=$.substring(m+1),X=Z+"@"+E+" "+D;return p(!1),y(null),setTimeout(()=>{if(t.current){const V=m+1+E.length+1;t.current.selectionStart=t.current.selectionEnd=V,t.current.focus()}},0),X},[m,e,t]),A=M.useCallback(()=>{p(!1),y(null),setTimeout(()=>{t.current?.focus()},0)},[t]);return{showCommandSelector:n,commandSearch:i,selectedCommand:o,selectedCommandIndex:c,commandWarning:h,showFileBrowser:g,atSymbolPosition:m,allCommands:B,SYSTEM_COMMANDS:x,userCommands:v,projectCommands:L,hasCommandsLoadError:j,userCommandsError:C,projectCommandsError:S,setSelectedCommand:l,setSelectedCommandIndex:u,setCommandWarning:f,setShowCommandSelector:s,setShowFileBrowser:p,setAtSymbolPosition:y,setCommandSearch:a,handleInputChange:I,handleCommandSelect:F,handleCommandSelectorClose:W,handleFileSelect:ee,handleFileBrowserClose:A,isCommandDefined:N,getAllAvailableCommands:R}},bm=({agent:e})=>{const[t,r]=M.useState(!1),[n,s]=M.useState([]),[i,a]=M.useState([]),[o,l]=M.useState(!1),[c,u]=M.useState("bypassPermissions"),[h,f]=M.useState("sonnet"),[g,p]=M.useState(!1),[m,y]=M.useState(!1),[x,k]=M.useState(void 0),[C,T]=M.useState(!1),[S,w]=M.useState(!1),[_,O]=M.useState({});return M.useEffect(()=>{if(e?.allowedTools?.length>0){const P=e.allowedTools.filter(N=>N.enabled),v=[],L=[];P.forEach(N=>{if(N.name.includes(".")&&!N.name.startsWith("mcp__")){const[R,j]=N.name.split("."),B=`mcp__${R}__${j}`;L.push(B)}else N.name.startsWith("mcp__")?L.push(N.name):v.push(N.name)}),s(v),a(L),l(L.length>0)}},[e?.allowedTools]),{showToolSelector:t,selectedRegularTools:n,selectedMcpTools:i,mcpToolsEnabled:o,permissionMode:c,selectedModel:h,showPermissionDropdown:g,showModelDropdown:m,selectedClaudeVersion:x,showVersionDropdown:C,isVersionLocked:S,setShowToolSelector:r,setSelectedRegularTools:s,setSelectedMcpTools:a,setMcpToolsEnabled:l,setPermissionMode:u,setSelectedModel:f,setShowPermissionDropdown:p,setShowModelDropdown:y,setSelectedClaudeVersion:k,setShowVersionDropdown:T,setIsVersionLocked:w,envVars:_,setEnvVars:O}},km=({initialModel:e="sonnet",initialVersion:t,skipModelValidation:r=!1})=>{const{data:n}=jv(),[s,i]=M.useState(e),[a,o]=M.useState(t),[l,c]=M.useState(!1),u=M.useMemo(()=>{if(!n?.versions)return[];if(a){const y=n.versions.find(k=>k.id===a),x=y?.models||[];return console.log(`📦 availableModels computed: selectedClaudeVersion=${a}, found version=${y?.name}, models=`,x.map(k=>k.id)),x}const p=n.versions.find(y=>y.id===n.defaultVersionId)||n.versions[0],m=p?.models||[];return console.log(`📦 availableModels computed (using default): defaultVersion=${p?.name}, models=`,m.map(y=>y.id)),m},[n,a]);return M.useEffect(()=>{r||u.length>0&&(u.some(m=>m.id===s)||(console.log(`🔄 Model validation: selectedModel=${s} is not in availableModels:`,u.map(m=>m.id),`selectedClaudeVersion=${a}, resetting to ${u[0].id}`),i(u[0].id)))},[u,s,a,r]),{claudeVersionsData:n,availableModels:u,selectedModel:s,selectedClaudeVersion:a,isVersionLocked:l,setSelectedModel:i,setSelectedClaudeVersion:o,setIsVersionLocked:c,handleVersionChange:p=>{o(p);const m=n?.versions.find(y=>y.id===p);m&&m.models&&m.models.length>0&&i(m.models[0].id)},handleModelChange:p=>{i(p)},resetToDefaults:()=>{o(void 0),i(e),c(!1)}}},Hv={activeTasks:new Map},tu=qp((e,t)=>({...Hv,registerTaskTool:(r,n)=>{console.log("📋 [SubAgentStore] Registering Task tool:",r,"sessionId:",n),e(s=>{const i=new Map(s.activeTasks);return i.has(r)||i.set(r,{parentToolUseId:r,sessionId:n,messageFlow:[],startedAt:Date.now(),lastUpdatedAt:Date.now()}),{activeTasks:i}})},activateSubAgent:(r,n)=>{if(t().activeTasks.has(r)){console.log("📋 [SubAgentStore] SubAgent already active for:",r);return}console.log("📋 [SubAgentStore] Activating SubAgent for parentToolUseId:",r),e(i=>{const a=new Map(i.activeTasks);return a.set(r,{parentToolUseId:r,sessionId:n,messageFlow:[],startedAt:Date.now(),lastUpdatedAt:Date.now()}),{activeTasks:a}})},addSubAgentMessagePart:(r,n)=>{e(s=>{if(!s.activeTasks.get(r)){console.log("📋 [SubAgentStore] Creating new task for parentToolUseId:",r);const u=new Map(s.activeTasks);return u.set(r,{parentToolUseId:r,sessionId:"",messageFlow:[{id:`msg_${r}_${Date.now()}`,role:"assistant",timestamp:new Date().toISOString(),messageParts:[n]}],startedAt:Date.now(),lastUpdatedAt:Date.now()}),{activeTasks:u}}const a=new Map(s.activeTasks),o=a.get(r),l=o.messageFlow.findIndex(u=>u.messageParts.some(h=>h.id===n.id));let c;if(l>=0)c=o.messageFlow.map((u,h)=>h===l?{...u,messageParts:u.messageParts.map(f=>f.id===n.id?n:f)}:u);else{const u=o.messageFlow[o.messageFlow.length-1];u&&u.role==="assistant"?c=[...o.messageFlow.slice(0,-1),{...u,messageParts:[...u.messageParts,n]}]:c=[...o.messageFlow,{id:`msg_${r}_${Date.now()}`,role:"assistant",timestamp:new Date().toISOString(),messageParts:[n]}]}return a.set(r,{...o,messageFlow:c,lastUpdatedAt:Date.now()}),console.log("📋 [SubAgentStore] Added message part to",r,"type:",n.type,"total parts:",c.reduce((u,h)=>u+h.messageParts.length,0)),{activeTasks:a}})},getSubAgentMessageFlow:r=>t().activeTasks.get(r)?.messageFlow||[],clearSubAgentTask:r=>{console.log("📋 [SubAgentStore] Clearing SubAgent task:",r),e(n=>{const s=new Map(n.activeTasks);return s.delete(r),{activeTasks:s}})},reset:()=>{console.log("📋 [SubAgentStore] Resetting state"),e({activeTasks:new Map})}})),qv=({agentId:e,currentSessionId:t,projectPath:r,isCompactCommand:n=!1,abortControllerRef:s,onSessionChange:i,setIsInitializingSession:a,setCurrentSessionId:o,setIsNewSession:l,setAiTyping:c,setHasSuccessfulResponse:u})=>{const{t:h}=de("components"),f=kh(),{addMessage:g,addTextPartToMessage:p,addThinkingPartToMessage:m,updateTextPartInMessage:y,updateThinkingPartInMessage:x,addCompactSummaryPartToMessage:k,addToolPartToMessage:C,updateToolPartInMessage:T,updateMcpStatus:S,setPendingUserQuestion:w,setA2AStreamStart:_,setA2AStreamEnd:O,addA2AStreamEvent:P}=Fe(),v=M.useRef(null),L=M.useRef(new Map),N=M.useRef({activeBlocks:new Map,currentMessageId:null,isStreaming:!1,wasStreamProcessed:!1,pendingUpdate:null,rafId:null}),R=M.useCallback((G,$,E)=>{const Z=N.current;Z.pendingUpdate={blockId:G,content:$,type:E},Z.rafId===null&&(Z.rafId=requestAnimationFrame(()=>{const D=Z.pendingUpdate,X=v.current;if(!D||!X){Z.rafId=null;return}const V=Z.activeBlocks.get(D.blockId);if(!V||!V.partId){console.warn("🌊 [STREAMING] No partId found for block:",D.blockId),Z.rafId=null;return}D.type==="text"?y(X,V.partId,D.content):D.type==="thinking"&&x(X,V.partId,D.content),Z.pendingUpdate=null,Z.rafId=null}))},[y,x]),j=M.useCallback((G,$)=>`${G}-${Date.now()}-${$}`,[]),{registerTaskTool:B,activateSubAgent:I,addSubAgentMessagePart:F}=tu.getState(),W=M.useCallback(G=>{try{const $=G;$.type==="system"&&$.subtype==="init"&&console.log("📋 [INIT] Received system init message, not intercepting");const E=$.isSidechain===!0,Z=$.parentToolUseId;if(E&&Z){console.log("🎯 [SIDECHAIN] Intercepted sub-agent message, parentToolUseId:",Z,"type:",$.type);const D=Z,X=$.sessionId||$.session_id;if(X&&I(D,X),$.type==="stream_event"&&$.event){const V=$.event;if(V.type==="content_block_start"&&V.content_block){const H=V.index,Y=V.content_block;if(Y.type==="text"){const Q=`part_${D}_text_${H}_${Date.now()}`;F(D,{id:Q,type:"text",content:"",order:H}),L.current.set(`${D}-${H}`,Q),console.log("🎯 [SIDECHAIN] Started text block:",Q)}else if(Y.type==="thinking"){const Q=`part_${D}_thinking_${H}_${Date.now()}`;F(D,{id:Q,type:"thinking",content:"",order:H}),L.current.set(`${D}-${H}`,Q)}else if(Y.type==="tool_use"){const Q=`part_${D}_tool_${H}_${Date.now()}`;F(D,{id:Q,type:"tool",toolData:{id:Y.id,toolName:Y.name,toolInput:{},isError:!1},order:H}),L.current.set(`${D}-${H}`,Q),console.log("🎯 [SIDECHAIN] Added tool_use to sub-agent:",Y.name)}}if(V.type==="content_block_delta"&&V.delta){const H=V.index,Y=V.delta,Q=L.current.get(`${D}-${H}`);if(Q){const _e=tu.getState().activeTasks.get(D);if(_e)for(const Te of _e.messageFlow){const Me=Te.messageParts.find(Ae=>Ae.id===Q);if(Me){if(Y.type==="text_delta"&&Y.text){const Ae=(Me.content||"")+Y.text;F(D,{...Me,content:Ae}),Ae.length%100<10&&console.log("🎯 [SIDECHAIN] Text accumulated:",Ae.length,"chars")}else if(Y.type==="thinking_delta"&&Y.thinking){const Ae=(Me.content||"")+Y.thinking;F(D,{...Me,content:Ae})}break}}}}}if($.type==="assistant"&&$.message){const V=$.message;if(console.log("🎯 [SIDECHAIN] Processing assistant message, blocks:",V.content?.length||0),V.content&&Array.isArray(V.content))for(let H=0;H<V.content.length;H++){const Y=V.content[H];Y.type==="text"&&Y.text?(console.log("🎯 [SIDECHAIN] Adding text from assistant:",Y.text.substring(0,50)),F(D,{id:`part_${D}_text_${H}_${Date.now()}`,type:"text",content:Y.text,order:H})):Y.type==="thinking"&&Y.thinking?F(D,{id:`part_${D}_thinking_${H}_${Date.now()}`,type:"thinking",content:Y.thinking,order:H}):Y.type==="tool_use"&&(F(D,{id:`part_${D}_tool_${H}_${Date.now()}`,type:"tool",toolData:{id:Y.id,toolName:Y.name,toolInput:Y.input||{},isError:!1},order:H}),console.log("🎯 [SIDECHAIN] Added tool_use from assistant:",Y.name))}}if($.type==="user"&&$.message){const V=$.message;if(V.content&&Array.isArray(V.content))for(const H of V.content){const Y=H;if(Y.type==="text"){console.log("🎯 [SIDECHAIN] Skipping user text (task prompt already shown)");continue}Y.type==="tool_result"&&Y.tool_use_id&&console.log("🎯 [SIDECHAIN] Tool result for:",Y.tool_use_id,"error:",Y.is_error)}}return}if($.type==="stream_event"&&$.event){const D=$.event;if(console.log("🌊 [STREAMING] Detected stream_event:",D.type,"Full event:",JSON.stringify($).substring(0,200)),N.current.wasStreamProcessed=!0,D.type==="message_start"){if(v.current)console.log("🌊 [STREAMING] message_start: AI message already exists, skipping:",v.current);else{g({content:"",role:"assistant"});const V=Fe.getState();v.current=V.messages[V.messages.length-1].id,N.current.currentMessageId=v.current,N.current.isStreaming=!0,console.log("🌊 [STREAMING] message_start: Created new AI message with ID:",v.current)}return}if(D.type==="content_block_start"){const X=D.index,V=D.content_block;if(!v.current){g({content:"",role:"assistant"});const se=Fe.getState();v.current=se.messages[se.messages.length-1].id,N.current.currentMessageId=v.current,N.current.isStreaming=!0}const H=`block-${v.current}-${X}`,Y=Date.now();if(N.current.activeBlocks.has(H)){console.warn("🌊 [STREAMING] content_block_start: Block already exists, skipping:",H);return}if(V.type==="text"){p(v.current,"");const se=Fe.getState().messages.find(Ae=>Ae.id===v.current),Te=se?.messageParts?.[se.messageParts.length-1]?.id,Me={blockId:H,type:"text",content:"",isComplete:!1,messageId:v.current,partId:Te,startedAt:Y,lastUpdatedAt:Y};N.current.activeBlocks.set(H,Me),console.log("🌊 [STREAMING] content_block_start: Initialized text block",H,"partId:",Te)}else if(V.type==="thinking"){m(v.current,"");const se=Fe.getState().messages.find(Ae=>Ae.id===v.current),Te=se?.messageParts?.[se.messageParts.length-1]?.id,Me={blockId:H,type:"thinking",content:"",isComplete:!1,messageId:v.current,partId:Te,startedAt:Y,lastUpdatedAt:Y};N.current.activeBlocks.set(H,Me),console.log("🤔 [STREAMING] content_block_start: Initialized thinking block",H,"partId:",Te)}else if(V.type==="tool_use"){if(console.log("🔧 [STREAMING] content_block_start: Processing tool_use",{toolName:V.name,claudeId:V.id,blockId:H,messageId:v.current}),V.name==="Task"){const se=t||$.sessionId||$.session_id;se&&V.id&&(console.log("🎯 [TASK] Registering Task tool for sub-agent tracking:",V.id),B(V.id,se))}const Q={toolName:V.name,toolInput:{},isExecuting:!0,claudeId:V.id};try{C(v.current,Q),console.log("🔧 [STREAMING] content_block_start: addToolPartToMessage completed");const se=Fe.getState();console.log("🔧 [STREAMING] content_block_start: Got store state, messages count:",se.messages.length);const _e=se.messages.find(ut=>ut.id===v.current);console.log("🔧 [STREAMING] content_block_start: Found current message:",!!_e,"parts count:",_e?.messageParts?.length);const Te=_e?.messageParts?.[_e.messageParts.length-1];console.log("🔧 [STREAMING] content_block_start: Latest part:",{exists:!!Te,type:Te?.type,hasToolData:!!Te?.toolData,toolDataId:Te?.toolData?.id});const Me=Te?.toolData?.id;Me||console.error("🔧 [STREAMING] content_block_start: ⚠️ partId is undefined! Latest part:",Te);const Ae={blockId:H,type:"tool_use",content:"",isComplete:!1,messageId:v.current,partId:Me,startedAt:Y,lastUpdatedAt:Y};N.current.activeBlocks.set(H,Ae),console.log("🔧 [STREAMING] content_block_start: ✅ Initialized tool_use block",V.name,"blockId:",H,"partId:",Me,"claudeId:",V.id)}catch(se){throw console.error("🔧 [STREAMING] content_block_start: ❌ Error processing tool_use:",se),se}}return}if(D.type==="content_block_delta"&&v.current){const X=D.index,V=D.delta,H=`block-${v.current}-${X}`,Y=Date.now();if(V.type==="text_delta"&&V.text!==void 0){let Q=N.current.activeBlocks.get(H);if(Q)Q.content+=V.text,Q.lastUpdatedAt=Y,console.log(`🌊 [STREAMING] content_block_delta: Accumulated text delta "${V.text}" to block ${H}, total: "${Q.content.substring(0,50)}..."`);else{console.warn("🌊 [STREAMING] content_block_delta: Missing content_block_start for text block, creating fallback"),p(v.current,"");const _e=Fe.getState().messages.find(Ae=>Ae.id===v.current),Me=_e?.messageParts?.[_e.messageParts.length-1]?.id;Q={blockId:H,type:"text",content:V.text,isComplete:!1,messageId:v.current,partId:Me,startedAt:Y,lastUpdatedAt:Y},N.current.activeBlocks.set(H,Q),console.log(`🌊 [STREAMING] content_block_delta: Created text block ${H} (fallback) with partId: ${Me}, content: "${V.text}"`)}R(H,Q.content,"text")}else if(V.type==="thinking_delta"&&V.thinking!==void 0){let Q=N.current.activeBlocks.get(H);if(Q)Q.content+=V.thinking,Q.lastUpdatedAt=Y,console.log(`🤔 [STREAMING] content_block_delta: Accumulated thinking delta "${V.thinking}" to block ${H}, total: "${Q.content.substring(0,50)}..."`);else{console.warn("🤔 [STREAMING] content_block_delta: Missing content_block_start for thinking block, creating fallback"),m(v.current,"");const _e=Fe.getState().messages.find(Ae=>Ae.id===v.current),Me=_e?.messageParts?.[_e.messageParts.length-1]?.id;Q={blockId:H,type:"thinking",content:V.thinking,isComplete:!1,messageId:v.current,partId:Me,startedAt:Y,lastUpdatedAt:Y},N.current.activeBlocks.set(H,Q),console.log(`🤔 [STREAMING] content_block_delta: Created thinking block ${H} (fallback) with partId: ${Me}, content: "${V.thinking}"`)}R(H,Q.content,"thinking")}else if(V.type==="input_json_delta"){const Q=V.partial_json||"";let se=N.current.activeBlocks.get(H);if(se){se.content+=Q,se.lastUpdatedAt=Y;const _e=se.content,Te=_e.trim();if(se.partId&&Te.endsWith("}"))try{const Me=JSON.parse(_e);T(v.current,se.partId,{toolInput:Me}),console.log(`🔧 [STREAMING] content_block_delta: Updated tool_use block ${H}, parsed complete JSON`)}catch{console.log(`🔧 [STREAMING] content_block_delta: JSON not yet complete for ${H}, length: ${_e.length}`)}}else{if(console.warn("🔧 [STREAMING] content_block_delta: Missing content_block_start for tool block, creating fallback"),!D.content_block||D.content_block.type!=="tool_use"){console.error("🔧 [STREAMING] content_block_delta: Missing content_block info for tool, cannot create fallback");return}const _e=D.content_block.name,Te=D.content_block.id;C(v.current,{toolName:_e,toolInput:{},isExecuting:!0,claudeId:Te});const Ae=Fe.getState().messages.find(ht=>ht.id===v.current),Xe=Ae?.messageParts?.[Ae.messageParts.length-1]?.toolData?.id;se={blockId:H,type:"tool_use",content:Q,isComplete:!1,messageId:v.current,partId:Xe,startedAt:Y,lastUpdatedAt:Y},N.current.activeBlocks.set(H,se),console.log("🔧 [STREAMING] content_block_delta: Created tool_use block (fallback)",_e,"blockId:",H,"partId:",Xe,"initial fragment:",Q)}}return}if(D.type==="content_block_stop"&&v.current){const X=D.index,V=`block-${v.current}-${X}`,H=N.current.activeBlocks.get(V);if(H){H.isComplete=!0,console.log(`🌊 [STREAMING] content_block_stop: Block ${V} complete, type: ${H.type}, content length: ${H.content.length}`);const Y=N.current;if(Y.pendingUpdate?.blockId===V){console.log(`🌊 [STREAMING] content_block_stop: Flushing pending RAF for ${V} immediately`),Y.rafId!==null&&(cancelAnimationFrame(Y.rafId),Y.rafId=null);const Q=Y.pendingUpdate;H.partId&&(Q.type==="text"?y(v.current,H.partId,Q.content):Q.type==="thinking"&&x(v.current,H.partId,Q.content),console.log(`🌊 [STREAMING] content_block_stop: Flushed ${Q.type} content for ${V}, length: ${Q.content.length}`)),Y.pendingUpdate=null}else if((H.type==="text"||H.type==="thinking")&&H.partId)console.log(`🌊 [STREAMING] content_block_stop: Final check - ensuring ${H.type} content saved, length: ${H.content.length}`),H.type==="text"?y(v.current,H.partId,H.content):H.type==="thinking"&&x(v.current,H.partId,H.content);else if(H.type==="tool_use"&&H.partId&&H.content){console.log(`🔧 [STREAMING] content_block_stop: Finalizing tool_use block ${V}, accumulated JSON length: ${H.content.length}`);try{const Q=JSON.parse(H.content);T(v.current,H.partId,{toolInput:Q}),console.log(`🔧 [STREAMING] content_block_stop: Successfully parsed final tool input for ${V}`)}catch(Q){console.error(`🔧 [STREAMING] content_block_stop: Failed to parse final tool JSON for ${V}:`,Q,"content:",H.content.substring(0,200))}}N.current.activeBlocks.delete(V),console.log(`🌊 [STREAMING] content_block_stop: Cleaned up block ${V}`)}return}if(D.type==="message_delta"){console.log("🌊 [STREAMING] message_delta:",D.delta);return}if(D.type==="message_stop"){if(N.current.isStreaming){console.log("🌊 [STREAMING] message_stop: Finalizing all streaming blocks, count:",N.current.activeBlocks.size);const X=v.current,V=N.current;if(V.pendingUpdate&&V.rafId!==null){console.log(`🌊 [STREAMING] message_stop: Flushing pending RAF for ${V.pendingUpdate.blockId}`),cancelAnimationFrame(V.rafId),V.rafId=null;const H=V.pendingUpdate,Y=V.activeBlocks.get(H.blockId);Y&&Y.partId&&X&&(H.type==="text"?y(X,Y.partId,H.content):H.type==="thinking"&&x(X,Y.partId,H.content),console.log(`🌊 [STREAMING] message_stop: Flushed ${H.type} content, length: ${H.content.length}`)),V.pendingUpdate=null}X&&V.activeBlocks.forEach(H=>{H.isComplete=!0,(H.type==="text"||H.type==="thinking")&&H.partId?(console.log(`🌊 [STREAMING] message_stop: Final check for ${H.type} block ${H.blockId}, length: ${H.content.length}`),H.type==="text"?y(X,H.partId,H.content):H.type==="thinking"&&x(X,H.partId,H.content)):H.partId||console.error(`❌ [STREAMING] message_stop: Missing partId for block ${H.blockId}, content LOST:`,H.content.substring(0,100))}),V.isStreaming=!1,V.currentMessageId=null,V.activeBlocks.clear(),console.log("🌊 [STREAMING] message_stop: All blocks finalized and cleared")}return}console.warn("🌊 [STREAMING] Unknown stream_event type:",D.type);return}if($.type==="error"){console.error("Claude Code SDK error:",$),c(!1),a(!1),s.current=null;let D="";$.subtype&&$.message?(console.log("📋 Processing structured error with subtype:",$.subtype),D=`❌ **${{error_during_execution:h("agentChat.executionError"),error_max_turns:h("agentChat.maxTurnsReached"),error_max_budget_usd:h("agentChat.maxBudgetReached"),error_max_structured_output_retries:h("agentChat.maxRetriesReached")}[$.subtype]||h("agentChat.processingError")}**
33
+
34
+ ${$.message}`,D+=`
35
+
36
+ **${h("agentChatPanel.errors.suggestedActions")}**
37
+ `,$.subtype==="error_max_budget_usd"?D+=`- ${h("agentChatPanel.errors.checkBudget")}
38
+ `:$.subtype==="error_max_turns"&&(D+=`- ${h("agentChatPanel.errors.increaseMaxTurns")}
39
+ `),D+=`- ${h("agentChatPanel.errors.resendMessage")}
40
+ `,D+=`- ${h("agentChatPanel.errors.refreshPage")}`):$.error==="Claude Code SDK failed"&&$.message&&typeof $.message=="string"?(D=`${h("agentChat.errorMessages.claudeCodeSDKError")}
41
+
42
+ `,$.message.includes("not valid JSON")?D+=h("agentChatPanel.errors.jsonParseError"):$.message.includes("timeout")?D+=h("agentChatPanel.errors.timeoutError"):$.message.includes("context window")||$.message.includes("context_window")?D+=h("agentChatPanel.errors.contextWindowError"):D+=`${$.message}
43
+
44
+ **${h("agentChatPanel.errors.suggestedActions")}**
45
+ - ${h("agentChatPanel.errors.resendMessage")}
46
+ - ${h("agentChatPanel.errors.refreshPage")}`):(D=`${h("agentChat.errorMessages.claudeCodeSDKError")}
47
+
48
+ `,D+=`${$.message||$.error||h("agentChatPanel.errors.unknownError")}
49
+
50
+ **${h("agentChatPanel.errors.suggestedActions")}**
51
+ - ${h("agentChatPanel.errors.resendMessage")}
52
+ - ${h("agentChatPanel.errors.refreshPage")}`),v.current?p(v.current,`
53
+
54
+ `+D):g({content:D,role:"assistant"});return}if($.type==="system"&&$.subtype==="init"&&($.sessionId||$.session_id)){const D=$.sessionId||$.session_id;console.log("Setting session ID from AI response:",D),a(!1),!t&&D&&(o(D),l(!0),i&&i(D),f.invalidateQueries({queryKey:["agent-sessions",e]}));return}if($.type==="mcp_status"){if(console.log("📡 MCP Status Event:",$),$.subtype==="connection_failed"){const D=$.failedServers||[];console.warn("🚨 MCP服务器连接失败:",D),S({hasError:!0,connectionErrors:D,lastError:`连接失败: ${D.map(X=>X.name).join(", ")}`})}else if($.subtype==="connection_success"){const D=$.connectedServers||[];console.log("✅ MCP服务器连接成功:",D.map(X=>X.name)),S({hasError:!1,connectedServers:D,connectionErrors:[],lastError:null})}return}if($.type==="mcp_error"){if(console.log("❌ MCP Error Event:",$),$.subtype==="execution_failed"){const D=$,X=D.tool||"未知工具",V=D.error||"执行失败",H=D.details||"";console.error("❌ MCP工具执行失败:",{tool:X,error:V,details:H}),S({hasError:!0,lastError:`工具执行失败: ${X} - ${V}`,lastErrorDetails:H})}return}if($.type==="auto_compact"){const D=$,X=D.preTokens||0,V=D.trigger||"auto";if(console.log("🔄 [AUTO-COMPACT] Context window auto-compacted:",{trigger:V,preTokens:X}),!v.current){g({content:"",role:"assistant"});const Q=Fe.getState();v.current=Q.messages[Q.messages.length-1].id,console.log("🔄 [AUTO-COMPACT] Created new AI message with ID:",v.current)}const H=X>0?h("compactSummary.autoCompactWithTokens",{tokens:X.toLocaleString()}):h("compactSummary.autoCompact");k(v.current,H);return}if($.type==="awaiting_user_input"){console.log("🎤 [AskUserQuestion] Received awaiting_user_input event:",$);const D=$;w({toolUseId:D.toolUseId,toolName:D.toolName,questions:D.toolInput?.questions||[],timestamp:Date.now()}),console.log("🎤 [AskUserQuestion] Set pending question, MCP tool is waiting for user response");return}if($.type==="a2a_stream_start"){const D=$;_(D.agentUrl,D.sessionId,D.message);return}if($.type==="a2a_stream_data"){const D=$;D.agentUrl&&P(D.agentUrl,{type:D.event?.type||"unknown",sessionId:D.event?.sessionId,message:D.event?.message,timestamp:D.timestamp});return}if($.type==="a2a_stream_end"){const D=$,X=Fe.getState();for(const[V,H]of Object.entries(X.activeA2AStreams))if(H.sessionId===D.sessionId){O(V);break}return}if($.type==="session_resumed"&&$.subtype==="new_branch"){const D=$;console.log("🔄 Session resumed with new branch:",D),console.log("🔄 Updating session ID from",t,"to",D.newSessionId),a(!1),o(D.newSessionId),l(!0),i&&(console.log("🔄 Updating URL with new session ID:",D.newSessionId),i(D.newSessionId)),g({content:`${h("agentChat.sessionResumed")}
55
+
56
+ ${D.message}
57
+
58
+ ${h("agentChat.sessionIdUpdated")}`,role:"assistant"}),f.invalidateQueries({queryKey:["agent-sessions",e]}),t&&D.originalSessionId&&D.newSessionId&&(Wr.handleSessionResume(e,D.originalSessionId,D.newSessionId),Wr.recordSessionResume(e,D.originalSessionId,D.newSessionId),console.log(`🎯 TabManager updated for session resume: ${D.originalSessionId} → ${D.newSessionId}`)),console.log("✅ Session resume handling complete");return}if($.type==="system"&&$.subtype==="init")return;if($.type==="assistant"){if(N.current.wasStreamProcessed){console.log("📝 [ASSISTANT] Skipping assistant message - already processed via stream_event (prevents duplicates)");return}if(!v.current){g({content:"",role:"assistant"});const X=Fe.getState();v.current=X.messages[X.messages.length-1].id,console.log("📝 Created new AI message with ID:",v.current)}if($.message&&typeof $.message=="object"&&"content"in $.message&&$.message.content&&v.current){console.log("📝 Processing assistant message content blocks:",$.message.content.length,"aiMessageId:",v.current);for(const D of $.message.content)if(console.log("📝 Processing block:",{type:D.type,hasText:!!D.text,hasThinking:!!D.thinking,textLength:D.text?.length,thinkingLength:D.thinking?.length,toolName:D.name}),D.type==="text")D.text?(console.log("📝 Adding text part:",D.text.substring(0,100)+(D.text.length>100?"...":"")),n&&console.log("📦 Detected /compact command response, adding as compactSummary"),p(v.current,D.text)):console.warn("📝 Text block has no text content");else if(D.type==="thinking")D.thinking?(console.log("🤔 Adding thinking part:",D.thinking.substring(0,100)+(D.thinking.length>100?"...":"")),m(v.current,D.thinking)):console.warn("🤔 Thinking block has no thinking content");else if(D.type==="tool_use"){if(D.name){console.log("📝 Adding tool part:",D.name,"id:",D.id),D.name==="BashOutput"&&console.log("🐚 [BashOutput] Tool use detected, claudeId:",D.id,"input:",D.input);const X={toolName:D.name,toolInput:D.input||{},isExecuting:!0,claudeId:D.id};C(v.current,X)}}else console.log("📝 Unknown block type:",D.type)}else console.warn("📝 No content or aiMessageId for assistant message:",{hasMessage:!!$.message,hasContent:!!$.message?.content,aiMessageId:v.current});return}if($.type==="user"){if($.message&&typeof $.message=="object"&&"content"in $.message&&$.message.content&&v.current){for(const D of $.message.content)if(D.type==="tool_result"&&D.tool_use_id){console.log("🔧 Processing tool_result for tool_use_id:",D.tool_use_id,"content:",D.content,"is_error:",D.is_error);const X=Fe.getState();let V=null,H=null;for(const Y of X.messages)if(Y.messageParts){const Q=Y.messageParts.find(se=>se.type==="tool"&&se.toolData?.claudeId===D.tool_use_id);if(Q){V=Q,H=Y.id;break}}if(console.log("🔧 Found target tool:",{toolData:V?.toolData,messageId:H,currentMessageId:v.current}),V?.toolData&&H){const Y=typeof D.content=="string"?D.content:Array.isArray(D.content)?D.content.map(Q=>Q.text||String(Q)).join(""):JSON.stringify(D.content);if(console.log("🔧 Updating tool with result, setting isExecuting: false"),V.toolData.toolName==="Task"&&V.toolData.claudeId){const Q=V.toolData.claudeId;console.log("🎯 [TASK] Task tool completed, appending result to sub-agent flow:",Q),Y&&typeof Y=="string"&&Y.trim()&&(F(Q,{id:`part_${Q}_result_${Date.now()}`,type:"text",content:Y,order:9999}),console.log("🎯 [TASK] Appended result text to sub-agent flow, length:",Y.length))}V.toolData.toolName==="BashOutput"&&console.log("🐚 [BashOutput] Updating tool result:",{toolId:V.toolData.id,messageId:H,toolResult:Y?.substring(0,200),rawContent:D.content}),T(H,V.toolData.id,{toolResult:Y,isError:D.is_error||!1,isExecuting:!1})}else{console.warn("🔧 No target tool found for tool_use_id:",D.tool_use_id);const Y=X.messages.flatMap(Q=>(Q.messageParts||[]).filter(se=>se.type==="tool").map(se=>({claudeId:se.toolData?.claudeId,toolName:se.toolData?.toolName,isExecuting:se.toolData?.isExecuting})));console.warn("🔧 Available tools:",Y)}}}return}if($.type==="assistant"&&$.message&&typeof $.message=="object"&&"content"in $.message&&$.message.content&&v.current){for(const D of $.message.content)if(D.type==="tool_result"&&D.tool_use_id){console.log("🔧 Processing tool_result in assistant message for tool_use_id:",D.tool_use_id);const X=Fe.getState();let V=null,H=null;for(const Y of X.messages)if(Y.messageParts){const Q=Y.messageParts.find(se=>se.type==="tool"&&se.toolData?.claudeId===D.tool_use_id);if(Q){V=Q,H=Y.id;break}}if(console.log("🔧 Found target tool in assistant message:",{toolData:V?.toolData,messageId:H,currentMessageId:v.current}),V?.toolData&&H){const Y=typeof D.content=="string"?D.content:Array.isArray(D.content)?D.content.map(Q=>Q.text||String(Q)).join(""):JSON.stringify(D.content);console.log("🔧 Updating tool with result in assistant message, setting isExecuting: false"),T(H,V.toolData.id,{toolResult:Y,isError:D.is_error||!1,isExecuting:!1})}else console.warn("🔧 No target tool found for tool_use_id in assistant message:",D.tool_use_id)}return}if($.type==="result"){console.log("Received result event:",{subtype:$.subtype,isSideChain:$.isSideChain});const D=$.isSideChain;if(D?console.log("Side chain result received, continuing main task..."):(console.log("Main task result received, stopping AI typing..."),N.current.isStreaming&&(console.log("🌊 [STREAMING] Finalizing all streaming blocks"),N.current.activeBlocks.forEach(X=>{X.isComplete=!0,console.log(`🌊 [STREAMING] Marked block ${X.blockId} as complete`)}),N.current.isStreaming=!1,N.current.currentMessageId=null,N.current.rafId!==null&&(cancelAnimationFrame(N.current.rafId),N.current.rafId=null),N.current.activeBlocks.clear()),s.current=null,c(!1),$.subtype==="success"&&(u(!0),console.log("✅ Marked session as having successful response for heartbeat"),Jc.emit(eu.AI_RESPONSE_COMPLETE,{agentId:e,sessionId:t,projectPath:r}),console.log("📡 Emitted AI_RESPONSE_COMPLETE event"))),!D){if(!v.current&&$.subtype==="success"){console.log("📝 Creating AI message from result event - no assistant messages received");const V=$.result;if(V&&typeof V=="string"){g({content:"",role:"assistant"});const Y=Fe.getState();v.current=Y.messages[Y.messages.length-1].id,v.current&&p(v.current,V),console.log("📝 Added result content to new AI message:",V.substring(0,100))}else{console.warn("📝 Result event with no content - creating empty success message");const H={content:h("agentChat.taskComplete"),role:"assistant"};g(H);const Y=Fe.getState();v.current=Y.messages[Y.messages.length-1].id}}if(v.current){const H=Fe.getState().messages.find(Y=>Y.id===v.current);H?.messageParts&&H.messageParts.forEach(Y=>{Y.type==="tool"&&Y.toolData?.isExecuting&&(console.log("Force completing tool:",Y.toolData.toolName,"claudeId:",Y.toolData.claudeId),T(v.current,Y.toolData.id,{isExecuting:!1,toolResult:Y.toolData.toolResult||h("agentChat.executionCompleted")}))})}let X="";$.subtype==="success"?X="":$.subtype==="error_max_turns"?(X=`
59
+
60
+ ${h("agentChat.maxTurnsReached")}`,$.permission_denials&&$.permission_denials.length>0&&(X+=`
61
+
62
+ ${h("agentChat.permissionDenials")}`,$.permission_denials.forEach((V,H)=>{X+=`
63
+ ${H+1}. ${V.tool_name}: \`${V.tool_input.command||V.tool_input.description||JSON.stringify(V.tool_input)}\``}),X+=`
64
+
65
+ ${h("agentChat.permissionNote")}`)):$.subtype==="error_during_execution"?(X=`
66
+
67
+ ${h("agentChat.executionError")}`,$.errors&&Array.isArray($.errors)&&(X+=`
68
+
69
+ ${$.errors.join(`
70
+ `)}`)):$.subtype==="error_max_budget_usd"?(X=`
71
+
72
+ ${h("agentChat.maxBudgetReached")}`,$.errors&&Array.isArray($.errors)&&(X+=`
73
+
74
+ ${$.errors.join(`
75
+ `)}`)):$.subtype==="error_max_structured_output_retries"?(X=`
76
+
77
+ ${h("agentChat.maxRetriesReached")}`,$.errors&&Array.isArray($.errors)&&(X+=`
78
+
79
+ ${$.errors.join(`
80
+ `)}`)):$.subtype==="error"?(X=`
81
+
82
+ ${h("agentChat.processingError")}`,$.errors&&Array.isArray($.errors)&&(X+=`
83
+
84
+ ${$.errors.join(`
85
+ `)}`)):X=`
86
+
87
+ ${h("agentChat.processingComplete")}`,v.current&&X&&p(v.current,X),t&&f.invalidateQueries({queryKey:["agent-sessions",e]})}return}}catch($){console.error("❌ [STREAMING] Error in handleStreamMessage:",$),console.error("❌ [STREAMING] Error stack:",$ instanceof Error?$.stack:"No stack trace"),console.error("❌ [STREAMING] Event data:",JSON.stringify(G).substring(0,500));try{v.current?p(v.current,`
88
+
89
+ ❌ **Streaming Error**: ${$ instanceof Error?$.message:String($)}
90
+
91
+ Please refresh the page and try again.`):g({content:`❌ **Streaming Error**: ${$ instanceof Error?$.message:String($)}
92
+
93
+ Please refresh the page and try again.`,role:"assistant"})}catch(E){console.error("❌ [STREAMING] Failed to display error message:",E)}c(!1)}},[e,t,r,n,s,i,a,o,l,c,u,h,f,g,p,m,y,x,k,C,T,S,w,_,O,P,R,j]),ee=M.useCallback(G=>{if(console.error("SSE error:",G),c(!1),a(!1),s.current=null,G instanceof DOMException&&G.name==="AbortError"){console.log("Request was aborted by user");return}let $=h("agentChat.genericError");G instanceof Error&&(G.message.includes("network")||G.message.includes("fetch")?$=h("agentChatPanel.errors.networkError"):G.message.includes("timeout")?$=h("agentChatPanel.errors.requestTimeout"):G.message.includes("rate limit")||G.message.includes("429")?$=h("agentChatPanel.errors.rateLimit"):G.message.includes("unauthorized")||G.message.includes("401")?$=h("agentChatPanel.errors.unauthorized"):G.message.includes("forbidden")||G.message.includes("403")?$=h("agentChatPanel.errors.forbidden"):G.message.includes("500")||G.message.includes("internal server")?$=h("agentChatPanel.errors.internalServerError"):$=`❌ **${h("agentChatPanel.errors.processingError")}**
94
+
95
+ ${G.message||h("agentChatPanel.errors.unknownErrorRetry")}`),v.current?p(v.current,`
96
+
97
+ `+$):g({content:$,role:"assistant"})},[s,c,a,h,g,p]),A=M.useCallback(()=>{v.current=null,N.current.wasStreamProcessed=!1,N.current.isStreaming=!1,N.current.currentMessageId=null},[]);return{handleStreamMessage:W,handleStreamError:ee,resetMessageId:A}};class Uv{agentStore;onNewSession;onNavigate;onConfirm;constructor(t){this.agentStore=t.agentStore,this.onNewSession=t.onNewSession,this.onNavigate=t.onNavigate,this.onConfirm=t.onConfirm}async executeCommand(t,r){switch(t.name.toLowerCase()){case"clear":return this.handleClearCommand();case"init":return this.handleInitCommand();case"compact":return this.handleCompactCommand();case"agents":return this.handleAgentsCommand();case"settings":return this.handleSettingsCommand();case"help":return this.handleHelpCommand();default:return this.handleCustomCommand(t,r)}}handleClearCommand(){return this.onNewSession?(this.onNewSession(),{shouldSendToBackend:!1,message:"已清空对话,开始新会话",action:"newSession"}):(this.agentStore.clearMessages(),{shouldSendToBackend:!1,message:"已清空对话历史",action:"none"})}handleInitCommand(){return{shouldSendToBackend:!0}}handleCompactCommand(){return{shouldSendToBackend:!0}}handleAgentsCommand(){const t="是否要跳转到代理管理页面?";return this.onConfirm&&this.onConfirm(t,()=>{this.onNavigate&&this.onNavigate("/agents")}),{shouldSendToBackend:!1,message:t,action:"confirm",actionData:{path:"/agents"}}}handleSettingsCommand(){const t="是否要跳转到设置页面?";return this.onConfirm&&this.onConfirm(t,()=>{this.onNavigate&&this.onNavigate("/settings")}),{shouldSendToBackend:!1,message:t,action:"confirm",actionData:{path:"/settings"}}}handleHelpCommand(){return{shouldSendToBackend:!1,message:`
98
+ 可用命令:
99
+ • /clear - 清空对话历史
100
+ • /init - 初始化项目或重置对话上下文
101
+ • /compact - 压缩对话历史
102
+ • /agents - 管理AI代理
103
+ • /settings - 打开设置页面
104
+ • /help - 显示帮助信息
105
+ `.trim(),action:"none"}}handleCustomCommand(t,r){return t.name.includes("nav")||t.name.includes("goto")||"namespace"in t&&t.namespace==="nav"?{shouldSendToBackend:!1,message:`导航命令 ${t.name} 需要前端处理`,action:"confirm"}:t.name.includes("ui")||t.name.includes("show")||"namespace"in t&&t.namespace==="ui"?{shouldSendToBackend:!1,message:`UI命令 ${t.name} 在前端执行`,action:"none"}:{shouldSendToBackend:!0}}}function Vv(e){return new Uv(e)}const wm=e=>{const{agent:t,projectPath:r,inputMessage:n,selectedImages:s,isAiTyping:i,currentSessionId:a,hasCommandsLoadError:o,userCommandsError:l,projectCommandsError:c,SYSTEM_COMMANDS:u,userCommands:h,projectCommands:f,selectedCommand:g,selectedRegularTools:p,selectedMcpTools:m,mcpToolsEnabled:y,permissionMode:x,selectedModel:k,selectedClaudeVersion:C,abortControllerRef:T,onSessionChange:S,setInputMessage:w,clearImages:_,setSelectedCommand:O,setShowCommandSelector:P,setCommandWarning:v,setIsInitializingSession:L,setCurrentSessionId:N,setIsNewSession:R,setAiTyping:j,setHasSuccessfulResponse:B,setConfirmMessage:I,setConfirmAction:F,setShowConfirmDialog:W,handleNewSession:ee,isCommandDefined:A,getAllAvailableCommands:G,envVars:$}=e,{t:E}=de("components"),{addMessage:Z,addCommandPartToMessage:D,addTextPartToMessage:X,addCompactSummaryPartToMessage:V,selectedEngine:H,updateMessage:Y,addToolPartToMessage:Q,updateToolPartInMessage:se}=Fe(),_e=ov(),Te=Rv(),Me=M.useRef(!1),Ae={agentId:t.id,currentSessionId:a,projectPath:r,isCompactCommand:Me.current,abortControllerRef:T,onSessionChange:S,setIsInitializingSession:L,setCurrentSessionId:N,setIsNewSession:R,setAiTyping:j,setHasSuccessfulResponse:B},{handleStreamMessage:ut,handleStreamError:Xe,resetMessageId:ht}=qv(Ae),Mt=M.useCallback(()=>{if(i||!n.trim()&&s.length===0)return!0;if(Hi(n)){const ot=n.slice(1).split(" ")[0].toLowerCase();return!A(ot)}return!1},[n,i,s,A]),tt=M.useCallback(async()=>{if(!n.trim()&&s.length===0||i)return;let ot=n.trim();const mt=[...s].map(U=>({id:U.id,data:U.preview.split(",")[1],mediaType:U.file.type,name:U.file.name}));if(Hi(n)){const U=n.slice(1).split(" ")[0].toLowerCase();if(!A(U)){v(o?E("agentChat.commandsLoadErrorWarning",{command:U,commands:u.map(ae=>ae.content).join(", "),errorMessage:l?.message||c?.message||"Unknown error"}):E("agentChat.unknownCommandWarning",{command:U,commands:G()}));return}v(null);const J=Vv({agentStore:Fe.getState(),onNewSession:ee,onNavigate:ae=>{Nv(E("agentChat.navigateToAlert",{path:ae}))},onConfirm:(ae,Ee)=>{I(ae),F(()=>Ee),W(!0)}});let le=g;if(le||(le=u.find(ae=>ae.name===U)||f.find(ae=>ae.name===U)||h.find(ae=>ae.name===U)||null),le){const ae=await J.executeCommand(le);if(ae.shouldSendToBackend){ot=n.trim(),Z({content:"",role:"user",images:mt});const xe=Fe.getState(),rt=xe.messages[xe.messages.length-1].id;D(rt,ot)}else{const Ee=n.slice(le.content.length).trim()||void 0,xe=zv(le,Ee,r);Z({content:xe,role:"user",images:mt}),w(""),_(),O(null),P(!1),ae.message&&ae.action!=="confirm"&&Z({content:ae.message,role:"assistant"});return}}}else v(null);w(""),_(),O(null),P(!1),Hi(n.trim())||Z({content:ot||E("agentChat.sendImage"),role:"user",images:mt});const Yt={};j(!0),a||(console.log("🆕 No current session, will create new session"),L(!0));const kt=new AbortController;T.current=kt,Me.current=ot.trim()==="/compact",ht();try{const U=[...p,...y&&m.length>0?m:[]];if(H==="cursor"){console.log("🚀 [MessageSender] Using Cursor Engine");let J=null,le="";const ae=new Map,Ee=xe=>{switch(console.log(`📨 [AGUI] Event: ${xe.type}`,xe),xe.type){case"RUN_STARTED":L(!1),xe.threadId&&xe.threadId!==a&&(N(xe.threadId),R(!0),S?.(xe.threadId));break;case"RUN_FINISHED":j(!1),B(!0);break;case"RUN_ERROR":console.error("[AGUI] Run error:",xe.error),Z({role:"assistant",content:`❌ **Error**: ${xe.error}`}),j(!1);break;case"TEXT_MESSAGE_START":J=xe.messageId,le="",Z({role:"assistant",content:""});break;case"TEXT_MESSAGE_CONTENT":if(J){le+=xe.content;const Le=Fe.getState(),Ge=Le.messages[Le.messages.length-1];Ge&&Ge.role==="assistant"&&Y(Ge.id,{content:le})}break;case"TEXT_MESSAGE_END":break;case"TOOL_CALL_START":ae.set(xe.toolCallId,{name:xe.toolName,args:""});let rt=Fe.getState(),Ke=rt.messages[rt.messages.length-1];(!Ke||Ke.role!=="assistant")&&(Z({role:"assistant",content:""}),rt=Fe.getState(),Ke=rt.messages[rt.messages.length-1]),Ke&&Ke.role==="assistant"&&Q(Ke.id,{toolName:xe.toolName,toolInput:{},isExecuting:!0,claudeId:xe.toolCallId});break;case"TOOL_CALL_ARGS":const xt=ae.get(xe.toolCallId);if(xt){xt.args+=xe.args;try{const Le=JSON.parse(xt.args),Ge=Fe.getState(),wt=Ge.messages[Ge.messages.length-1];wt&&wt.role==="assistant"&&se(wt.id,xe.toolCallId,{toolInput:Le})}catch{}}break;case"TOOL_CALL_END":const nt=ae.get(xe.toolCallId);if(nt)try{const Le=JSON.parse(nt.args),Ge=Fe.getState(),wt=Ge.messages[Ge.messages.length-1];wt&&wt.role==="assistant"&&se(wt.id,xe.toolCallId,{toolInput:Le,isExecuting:!1})}catch{const Le=Fe.getState(),Ge=Le.messages[Le.messages.length-1];Ge&&Ge.role==="assistant"&&se(Ge.id,xe.toolCallId,{isExecuting:!1})}break;case"TOOL_CALL_RESULT":const Se=Fe.getState(),Ve=Se.messages[Se.messages.length-1];Ve&&Ve.role==="assistant"&&se(Ve.id,xe.toolCallId,{toolResult:xe.result,isError:xe.isError||!1,isExecuting:!1});break;case"CUSTOM":{const Le=xe;if(Le.name==="session_id_updated"&&Le.data?.sessionId){const Ge=Le.data.sessionId;console.log(`🔄 [AGUI] Session ID updated from CLI: ${Ge}`),N(Ge),S?.(Ge)}if(Le.name==="auto_compact"){const Ge=Le.data?.preTokens||0;console.log("🔄 [AGUI] Auto-compact event received:",{preTokens:Ge});const wt=Fe.getState(),hr=wt.messages[wt.messages.length-1];if(hr&&hr.role==="assistant"){const Rn=Ge>0?E("compactSummary.autoCompactWithTokens",{tokens:Ge.toLocaleString()}):E("compactSummary.autoCompact");V(hr.id,Rn)}}break}}};await Te.sendMessage({message:ot,engineType:"cursor",workspace:r||".",sessionId:a||void 0,model:k,images:mt.length>0?mt:void 0,abortController:kt,onAguiEvent:Ee,onError:xe=>{console.error("[AGUI] Error:",xe),Z({role:"assistant",content:`❌ **Error**: ${xe.message}`}),j(!1)}})}else console.log("🚀 [MessageSender] Using Claude Engine"),await _e.mutateAsync({agentId:t.id,message:ot,images:mt.length>0?mt:void 0,context:Yt,sessionId:a,projectPath:r,mcpTools:U.length>0?U:void 0,permissionMode:x,model:k,claudeVersion:C,envVars:$,channel:"web",abortController:kt,onMessage:ut,onError:Xe})}catch(U){if(console.error("Chat error:",U),j(!1),L(!1),T.current=null,U instanceof DOMException&&U.name==="AbortError"){console.log("Request was aborted by user");return}let J=E("agentChatPanel.errors.connectionFailed");U instanceof Error&&(U.message.includes("Failed to fetch")||U.message.includes("NetworkError")?J=E("agentChatPanel.errors.networkConnectionFailed"):U.message.includes("timeout")?J=E("agentChatPanel.errors.connectionTimeout"):J=`❌ **${E("agentChatPanel.errors.connectionError")}**
106
+
107
+ ${U.message||E("agentChatPanel.errors.cannotConnectRetry")}`),Z({content:J,role:"assistant"})}},[t,r,n,s,i,a,o,l,c,u,h,f,g,p,m,y,x,k,C,H,T,S,w,_,O,P,v,L,N,R,j,B,ee,A,G,E,Z,D,X,V,Y,Q,se,_e,Te,ut,Xe,ht,I,F,W]);return{isSendDisabled:Mt,handleSendMessage:tt,handleStreamMessage:ut,handleStreamError:Xe,resetMessageId:ht}},vm=({agentId:e,currentSessionId:t,onSessionChange:r,textareaRef:n})=>{const s=kh(),{setCurrentSessionId:i,clearMessages:a}=Fe(),[o,l]=M.useState(!1),[c,u]=M.useState(!1),[h,f]=M.useState(!1),g=M.useCallback(y=>{console.log(`[SessionManager] Switching to session ${y}`),i(y),l(!0),u(!1),f(!1),r&&r(y),a(),s.invalidateQueries({queryKey:["agent-session-messages",e,y]})},[e,r,i,a,s]),p=M.useCallback(()=>{i(null),a(),u(!0),f(!1),r&&r(null),setTimeout(()=>{n?.current?.focus()},0)},[r,i,a,n]),m=M.useCallback(()=>{t&&(l(!0),a(),s.invalidateQueries({queryKey:["agent-session-messages",e,t]}))},[e,t,a,s]);return{isLoadingMessages:o,isNewSession:c,hasSuccessfulResponse:h,setIsLoadingMessages:l,setIsNewSession:u,setHasSuccessfulResponse:f,setCurrentSessionId:i,handleSwitchSession:g,handleNewSession:p,handleRefreshMessages:m}},Cm=()=>{const[e,t]=M.useState(!1),[r,n]=M.useState(!1),[s,i]=M.useState(!1),[a,o]=M.useState(!1),[l,c]=M.useState(""),[u,h]=M.useState(null),[f,g]=M.useState(""),[p,m]=M.useState(!1),[y,x]=M.useState(!1),k=M.useCallback(()=>{u&&u(),n(!1),c(""),h(null)},[u]),C=M.useCallback(()=>{n(!1),c(""),h(null)},[]);return{showSessions:e,showConfirmDialog:r,showMobileSettings:s,showMcpStatusModal:a,confirmMessage:l,confirmAction:u,searchTerm:f,isStopping:p,isInitializingSession:y,setShowSessions:t,setShowConfirmDialog:n,setShowMobileSettings:i,setShowMcpStatusModal:o,setConfirmMessage:c,setConfirmAction:h,setSearchTerm:g,setIsStopping:m,setIsInitializingSession:x,handleConfirmDialog:k,handleCancelDialog:C}};function Gv(e,t){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const Yv=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Xv=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Kv={};function tf(e,t){return(Kv.jsx?Xv:Yv).test(e)}const Qv=/[ \t\n\f\r]/g;function Zv(e){return typeof e=="object"?e.type==="text"?rf(e.value):!1:rf(e)}function rf(e){return e.replace(Qv,"")===""}class ma{constructor(t,r,n){this.normal=r,this.property=t,n&&(this.space=n)}}ma.prototype.normal={};ma.prototype.property={};ma.prototype.space=void 0;function Sm(e,t){const r={},n={};for(const s of e)Object.assign(r,s.property),Object.assign(n,s.normal);return new ma(r,n,t)}function ru(e){return e.toLowerCase()}class sr{constructor(t,r){this.attribute=r,this.property=t}}sr.prototype.attribute="";sr.prototype.booleanish=!1;sr.prototype.boolean=!1;sr.prototype.commaOrSpaceSeparated=!1;sr.prototype.commaSeparated=!1;sr.prototype.defined=!1;sr.prototype.mustUseProperty=!1;sr.prototype.number=!1;sr.prototype.overloadedBoolean=!1;sr.prototype.property="";sr.prototype.spaceSeparated=!1;sr.prototype.space=void 0;let Jv=0;const Ie=hs(),yt=hs(),nu=hs(),re=hs(),et=hs(),Ls=hs(),ar=hs();function hs(){return 2**++Jv}const su=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ie,booleanish:yt,commaOrSpaceSeparated:ar,commaSeparated:Ls,number:re,overloadedBoolean:nu,spaceSeparated:et},Symbol.toStringTag,{value:"Module"})),lc=Object.keys(su);class Nh extends sr{constructor(t,r,n,s){let i=-1;if(super(t,r),nf(this,"space",s),typeof n=="number")for(;++i<lc.length;){const a=lc[i];nf(this,lc[i],(n&su[a])===su[a])}}}Nh.prototype.defined=!0;function nf(e,t,r){r&&(e[t]=r)}function ri(e){const t={},r={};for(const[n,s]of Object.entries(e.properties)){const i=new Nh(n,e.transform(e.attributes||{},n),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(n)&&(i.mustUseProperty=!0),t[n]=i,r[ru(n)]=n,r[ru(i.attribute)]=n}return new ma(t,r,e.space)}const _m=ri({properties:{ariaActiveDescendant:null,ariaAtomic:yt,ariaAutoComplete:null,ariaBusy:yt,ariaChecked:yt,ariaColCount:re,ariaColIndex:re,ariaColSpan:re,ariaControls:et,ariaCurrent:null,ariaDescribedBy:et,ariaDetails:null,ariaDisabled:yt,ariaDropEffect:et,ariaErrorMessage:null,ariaExpanded:yt,ariaFlowTo:et,ariaGrabbed:yt,ariaHasPopup:null,ariaHidden:yt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:et,ariaLevel:re,ariaLive:null,ariaModal:yt,ariaMultiLine:yt,ariaMultiSelectable:yt,ariaOrientation:null,ariaOwns:et,ariaPlaceholder:null,ariaPosInSet:re,ariaPressed:yt,ariaReadOnly:yt,ariaRelevant:null,ariaRequired:yt,ariaRoleDescription:et,ariaRowCount:re,ariaRowIndex:re,ariaRowSpan:re,ariaSelected:yt,ariaSetSize:re,ariaSort:null,ariaValueMax:re,ariaValueMin:re,ariaValueNow:re,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Tm(e,t){return t in e?e[t]:t}function Nm(e,t){return Tm(e,t.toLowerCase())}const eC=ri({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ls,acceptCharset:et,accessKey:et,action:null,allow:null,allowFullScreen:Ie,allowPaymentRequest:Ie,allowUserMedia:Ie,alt:null,as:null,async:Ie,autoCapitalize:null,autoComplete:et,autoFocus:Ie,autoPlay:Ie,blocking:et,capture:null,charSet:null,checked:Ie,cite:null,className:et,cols:re,colSpan:null,content:null,contentEditable:yt,controls:Ie,controlsList:et,coords:re|Ls,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ie,defer:Ie,dir:null,dirName:null,disabled:Ie,download:nu,draggable:yt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ie,formTarget:null,headers:et,height:re,hidden:nu,high:re,href:null,hrefLang:null,htmlFor:et,httpEquiv:et,id:null,imageSizes:null,imageSrcSet:null,inert:Ie,inputMode:null,integrity:null,is:null,isMap:Ie,itemId:null,itemProp:et,itemRef:et,itemScope:Ie,itemType:et,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ie,low:re,manifest:null,max:null,maxLength:re,media:null,method:null,min:null,minLength:re,multiple:Ie,muted:Ie,name:null,nonce:null,noModule:Ie,noValidate:Ie,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:Ie,optimum:re,pattern:null,ping:et,placeholder:null,playsInline:Ie,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ie,referrerPolicy:null,rel:et,required:Ie,reversed:Ie,rows:re,rowSpan:re,sandbox:et,scope:null,scoped:Ie,seamless:Ie,selected:Ie,shadowRootClonable:Ie,shadowRootDelegatesFocus:Ie,shadowRootMode:null,shape:null,size:re,sizes:null,slot:null,span:re,spellCheck:yt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:re,step:null,style:null,tabIndex:re,target:null,title:null,translate:null,type:null,typeMustMatch:Ie,useMap:null,value:yt,width:re,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:et,axis:null,background:null,bgColor:null,border:re,borderColor:null,bottomMargin:re,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ie,declare:Ie,event:null,face:null,frame:null,frameBorder:null,hSpace:re,leftMargin:re,link:null,longDesc:null,lowSrc:null,marginHeight:re,marginWidth:re,noResize:Ie,noHref:Ie,noShade:Ie,noWrap:Ie,object:null,profile:null,prompt:null,rev:null,rightMargin:re,rules:null,scheme:null,scrolling:yt,standby:null,summary:null,text:null,topMargin:re,valueType:null,version:null,vAlign:null,vLink:null,vSpace:re,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ie,disableRemotePlayback:Ie,prefix:null,property:null,results:re,security:null,unselectable:null},space:"html",transform:Nm}),tC=ri({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:ar,accentHeight:re,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:re,amplitude:re,arabicForm:null,ascent:re,attributeName:null,attributeType:null,azimuth:re,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:re,by:null,calcMode:null,capHeight:re,className:et,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:re,diffuseConstant:re,direction:null,display:null,dur:null,divisor:re,dominantBaseline:null,download:Ie,dx:null,dy:null,edgeMode:null,editable:null,elevation:re,enableBackground:null,end:null,event:null,exponent:re,externalResourcesRequired:null,fill:null,fillOpacity:re,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:Ls,g2:Ls,glyphName:Ls,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:re,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:re,horizOriginX:re,horizOriginY:re,id:null,ideographic:re,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:re,k:re,k1:re,k2:re,k3:re,k4:re,kernelMatrix:ar,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:re,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:re,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:re,overlineThickness:re,paintOrder:null,panose1:null,path:null,pathLength:re,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:et,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:re,pointsAtY:re,pointsAtZ:re,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ar,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ar,rev:ar,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ar,requiredFeatures:ar,requiredFonts:ar,requiredFormats:ar,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:re,specularExponent:re,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:re,strikethroughThickness:re,string:null,stroke:null,strokeDashArray:ar,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:re,strokeOpacity:re,strokeWidth:null,style:null,surfaceScale:re,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ar,tabIndex:re,tableValues:null,target:null,targetX:re,targetY:re,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ar,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:re,underlineThickness:re,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:re,values:null,vAlphabetic:re,vMathematical:re,vectorEffect:null,vHanging:re,vIdeographic:re,version:null,vertAdvY:re,vertOriginX:re,vertOriginY:re,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:re,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Tm}),Em=ri({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()}}),Am=ri({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Nm}),Mm=ri({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),rC={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"},nC=/[A-Z]/g,sf=/-[a-z]/g,sC=/^data[-\w.:]+$/i;function iC(e,t){const r=ru(t);let n=t,s=sr;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&sC.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(sf,oC);n="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!sf.test(i)){let a=i.replace(nC,aC);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}s=Nh}return new s(n,t)}function aC(e){return"-"+e.toLowerCase()}function oC(e){return e.charAt(1).toUpperCase()}const lC=Sm([_m,eC,Em,Am,Mm],"html"),Eh=Sm([_m,tC,Em,Am,Mm],"svg");function cC(e){return e.join(" ").trim()}var _s={},cc,af;function uC(){if(af)return cc;af=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,r=/^\s*/,n=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,o=/^\s+|\s+$/g,l=`
108
+ `,c="/",u="*",h="",f="comment",g="declaration";cc=function(m,y){if(typeof m!="string")throw new TypeError("First argument must be a string");if(!m)return[];y=y||{};var x=1,k=1;function C(R){var j=R.match(t);j&&(x+=j.length);var B=R.lastIndexOf(l);k=~B?R.length-B:k+R.length}function T(){var R={line:x,column:k};return function(j){return j.position=new S(R),O(),j}}function S(R){this.start=R,this.end={line:x,column:k},this.source=y.source}S.prototype.content=m;function w(R){var j=new Error(y.source+":"+x+":"+k+": "+R);if(j.reason=R,j.filename=y.source,j.line=x,j.column=k,j.source=m,!y.silent)throw j}function _(R){var j=R.exec(m);if(j){var B=j[0];return C(B),m=m.slice(B.length),j}}function O(){_(r)}function P(R){var j;for(R=R||[];j=v();)j!==!1&&R.push(j);return R}function v(){var R=T();if(!(c!=m.charAt(0)||u!=m.charAt(1))){for(var j=2;h!=m.charAt(j)&&(u!=m.charAt(j)||c!=m.charAt(j+1));)++j;if(j+=2,h===m.charAt(j-1))return w("End of comment missing");var B=m.slice(2,j-2);return k+=2,C(B),m=m.slice(j),k+=2,R({type:f,comment:B})}}function L(){var R=T(),j=_(n);if(j){if(v(),!_(s))return w("property missing ':'");var B=_(i),I=R({type:g,property:p(j[0].replace(e,h)),value:B?p(B[0].replace(e,h)):h});return _(a),I}}function N(){var R=[];P(R);for(var j;j=L();)j!==!1&&(R.push(j),P(R));return R}return O(),N()};function p(m){return m?m.replace(o,h):h}return cc}var of;function hC(){if(of)return _s;of=1;var e=_s&&_s.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(_s,"__esModule",{value:!0}),_s.default=r;const t=e(uC());function r(n,s){let i=null;if(!n||typeof n!="string")return i;const a=(0,t.default)(n),o=typeof s=="function";return a.forEach(l=>{if(l.type!=="declaration")return;const{property:c,value:u}=l;o?s(c,u,l):u&&(i=i||{},i[c]=u)}),i}return _s}var pi={},lf;function dC(){if(lf)return pi;lf=1,Object.defineProperty(pi,"__esModule",{value:!0}),pi.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,r=/^[^-]+$/,n=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,i=function(c){return!c||r.test(c)||e.test(c)},a=function(c,u){return u.toUpperCase()},o=function(c,u){return"".concat(u,"-")},l=function(c,u){return u===void 0&&(u={}),i(c)?c:(c=c.toLowerCase(),u.reactCompat?c=c.replace(s,o):c=c.replace(n,o),c.replace(t,a))};return pi.camelCase=l,pi}var mi,cf;function fC(){if(cf)return mi;cf=1;var e=mi&&mi.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},t=e(hC()),r=dC();function n(s,i){var a={};return!s||typeof s!="string"||(0,t.default)(s,function(o,l){o&&l&&(a[(0,r.camelCase)(o,i)]=l)}),a}return n.default=n,mi=n,mi}var gC=fC();const pC=bh(gC),jm=Im("end"),Ah=Im("start");function Im(e){return t;function t(r){const n=r&&r.position&&r.position[e]||{};if(typeof n.line=="number"&&n.line>0&&typeof n.column=="number"&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset=="number"&&n.offset>-1?n.offset:void 0}}}function mC(e){const t=Ah(e),r=jm(e);if(t&&r)return{start:t,end:r}}function qi(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?uf(e.position):"start"in e||"end"in e?uf(e):"line"in e||"column"in e?iu(e):""}function iu(e){return hf(e&&e.line)+":"+hf(e&&e.column)}function uf(e){return iu(e&&e.start)+"-"+iu(e&&e.end)}function hf(e){return e&&typeof e=="number"?e:1}class Rt extends Error{constructor(t,r,n){super(),typeof r=="string"&&(n=r,r=void 0);let s="",i={},a=!1;if(r&&("line"in r&&"column"in r?i={place:r}:"start"in r&&"end"in r?i={place:r}:"type"in r?i={ancestors:[r],place:r.position}:i={...r}),typeof t=="string"?s=t:!i.cause&&t&&(a=!0,s=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof n=="string"){const l=n.indexOf(":");l===-1?i.ruleId=n:(i.source=n.slice(0,l),i.ruleId=n.slice(l+1))}if(!i.place&&i.ancestors&&i.ancestors){const l=i.ancestors[i.ancestors.length-1];l&&(i.place=l.position)}const o=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=o?o.line:void 0,this.name=qi(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Rt.prototype.file="";Rt.prototype.name="";Rt.prototype.reason="";Rt.prototype.message="";Rt.prototype.stack="";Rt.prototype.column=void 0;Rt.prototype.line=void 0;Rt.prototype.ancestors=void 0;Rt.prototype.cause=void 0;Rt.prototype.fatal=void 0;Rt.prototype.place=void 0;Rt.prototype.ruleId=void 0;Rt.prototype.source=void 0;const Mh={}.hasOwnProperty,xC=new Map,yC=/[A-Z]/g,bC=new Set(["table","tbody","thead","tfoot","tr"]),kC=new Set(["td","th"]),Lm="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function wC(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=t.filePath||void 0;let n;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");n=AC(r,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");n=EC(r,t.jsx,t.jsxs)}const s={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:n,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Eh:lC,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=$m(s,e,void 0);return i&&typeof i!="string"?i:s.create(e,s.Fragment,{children:i||void 0},void 0)}function $m(e,t,r){if(t.type==="element")return vC(e,t,r);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return CC(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return _C(e,t,r);if(t.type==="mdxjsEsm")return SC(e,t);if(t.type==="root")return TC(e,t,r);if(t.type==="text")return NC(e,t)}function vC(e,t,r){const n=e.schema;let s=n;t.tagName.toLowerCase()==="svg"&&n.space==="html"&&(s=Eh,e.schema=s),e.ancestors.push(t);const i=Bm(e,t.tagName,!1),a=MC(e,t);let o=Ih(e,t);return bC.has(t.tagName)&&(o=o.filter(function(l){return typeof l=="string"?!Zv(l):!0})),Dm(e,a,i,t),jh(a,o),e.ancestors.pop(),e.schema=n,e.create(t,i,a,r)}function CC(e,t){if(t.data&&t.data.estree&&e.evaluater){const n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}ea(e,t.position)}function SC(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ea(e,t.position)}function _C(e,t,r){const n=e.schema;let s=n;t.name==="svg"&&n.space==="html"&&(s=Eh,e.schema=s),e.ancestors.push(t);const i=t.name===null?e.Fragment:Bm(e,t.name,!0),a=jC(e,t),o=Ih(e,t);return Dm(e,a,i,t),jh(a,o),e.ancestors.pop(),e.schema=n,e.create(t,i,a,r)}function TC(e,t,r){const n={};return jh(n,Ih(e,t)),e.create(t,e.Fragment,n,r)}function NC(e,t){return t.value}function Dm(e,t,r,n){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(t.node=n)}function jh(e,t){if(t.length>0){const r=t.length>1?t:t[0];r&&(e.children=r)}}function EC(e,t,r){return n;function n(s,i,a,o){const c=Array.isArray(a.children)?r:t;return o?c(i,a,o):c(i,a)}}function AC(e,t){return r;function r(n,s,i,a){const o=Array.isArray(i.children),l=Ah(n);return t(s,i,a,o,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function MC(e,t){const r={};let n,s;for(s in t.properties)if(s!=="children"&&Mh.call(t.properties,s)){const i=IC(e,s,t.properties[s]);if(i){const[a,o]=i;e.tableCellAlignToStyle&&a==="align"&&typeof o=="string"&&kC.has(t.tagName)?n=o:r[a]=o}}if(n){const i=r.style||(r.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=n}return r}function jC(e,t){const r={};for(const n of t.attributes)if(n.type==="mdxJsxExpressionAttribute")if(n.data&&n.data.estree&&e.evaluater){const i=n.data.estree.body[0];i.type;const a=i.expression;a.type;const o=a.properties[0];o.type,Object.assign(r,e.evaluater.evaluateExpression(o.argument))}else ea(e,t.position);else{const s=n.name;let i;if(n.value&&typeof n.value=="object")if(n.value.data&&n.value.data.estree&&e.evaluater){const o=n.value.data.estree.body[0];o.type,i=e.evaluater.evaluateExpression(o.expression)}else ea(e,t.position);else i=n.value===null?!0:n.value;r[s]=i}return r}function Ih(e,t){const r=[];let n=-1;const s=e.passKeys?new Map:xC;for(;++n<t.children.length;){const i=t.children[n];let a;if(e.passKeys){const l=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(l){const c=s.get(l)||0;a=l+"-"+c,s.set(l,c+1)}}const o=$m(e,i,a);o!==void 0&&r.push(o)}return r}function IC(e,t,r){const n=iC(e.schema,t);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=n.commaSeparated?Gv(r):cC(r)),n.property==="style"){let s=typeof r=="object"?r:LC(e,String(r));return e.stylePropertyNameCase==="css"&&(s=$C(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&n.space?rC[n.property]||n.property:n.attribute,r]}}function LC(e,t){try{return pC(t,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const n=r,s=new Rt("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=Lm+"#cannot-parse-style-attribute",s}}function Bm(e,t,r){let n;if(!r)n={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let i=-1,a;for(;++i<s.length;){const o=tf(s[i])?{type:"Identifier",name:s[i]}:{type:"Literal",value:s[i]};a=a?{type:"MemberExpression",object:a,property:o,computed:!!(i&&o.type==="Literal"),optional:!1}:o}n=a}else n=tf(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(n.type==="Literal"){const s=n.value;return Mh.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(n);ea(e)}function ea(e,t){const r=new Rt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=Lm+"#cannot-handle-mdx-estrees-without-createevaluater",r}function $C(e){const t={};let r;for(r in e)Mh.call(e,r)&&(t[DC(r)]=e[r]);return t}function DC(e){let t=e.replace(yC,BC);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function BC(e){return"-"+e.toLowerCase()}const uc={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"]},RC={};function Lh(e,t){const r=RC,n=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,s=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return Rm(e,n,s)}function Rm(e,t,r){if(PC(e)){if("value"in e)return e.type==="html"&&!r?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return df(e.children,t,r)}return Array.isArray(e)?df(e,t,r):""}function df(e,t,r){const n=[];let s=-1;for(;++s<e.length;)n[s]=Rm(e[s],t,r);return n.join("")}function PC(e){return!!(e&&typeof e=="object")}const ff=document.createElement("i");function $h(e){const t="&"+e+";";ff.innerHTML=t;const r=ff.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===t?!1:r}function lr(e,t,r,n){const s=e.length;let i=0,a;if(t<0?t=-t>s?0:s+t:t=t>s?s:t,r=r>0?r:0,n.length<1e4)a=Array.from(n),a.unshift(t,r),e.splice(...a);else for(r&&e.splice(t,r);i<n.length;)a=n.slice(i,i+1e4),a.unshift(t,0),e.splice(...a),i+=1e4,t+=1e4}function pr(e,t){return e.length>0?(lr(e,e.length,0,t),e):t}const gf={}.hasOwnProperty;function Pm(e){const t={};let r=-1;for(;++r<e.length;)FC(t,e[r]);return t}function FC(e,t){let r;for(r in t){const s=(gf.call(e,r)?e[r]:void 0)||(e[r]={}),i=t[r];let a;if(i)for(a in i){gf.call(s,a)||(s[a]=[]);const o=i[a];OC(s[a],Array.isArray(o)?o:o?[o]:[])}}}function OC(e,t){let r=-1;const n=[];for(;++r<t.length;)(t[r].add==="after"?e:n).push(t[r]);lr(e,0,0,n)}function Fm(e,t){const r=Number.parseInt(e,t);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function Mr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ot=In(/[A-Za-z]/),Lt=In(/[\dA-Za-z]/),zC=In(/[#-'*+\--9=?A-Z^-~]/);function wo(e){return e!==null&&(e<32||e===127)}const au=In(/\d/),WC=In(/[\dA-Fa-f]/),HC=In(/[!-/:-@[-`{-~]/);function we(e){return e!==null&&e<-2}function Ze(e){return e!==null&&(e<0||e===32)}function Re(e){return e===-2||e===-1||e===32}const hl=In(new RegExp("\\p{P}|\\p{S}","u")),ns=In(/\s/);function In(e){return t;function t(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function ni(e){const t=[];let r=-1,n=0,s=0;for(;++r<e.length;){const i=e.charCodeAt(r);let a="";if(i===37&&Lt(e.charCodeAt(r+1))&&Lt(e.charCodeAt(r+2)))s=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(a=String.fromCharCode(i));else if(i>55295&&i<57344){const o=e.charCodeAt(r+1);i<56320&&o>56319&&o<57344?(a=String.fromCharCode(i,o),s=1):a="�"}else a=String.fromCharCode(i);a&&(t.push(e.slice(n,r),encodeURIComponent(a)),n=r+s+1,a=""),s&&(r+=s,s=0)}return t.join("")+e.slice(n)}function ze(e,t,r,n){const s=n?n-1:Number.POSITIVE_INFINITY;let i=0;return a;function a(l){return Re(l)?(e.enter(r),o(l)):t(l)}function o(l){return Re(l)&&i++<s?(e.consume(l),o):(e.exit(r),t(l))}}const qC={tokenize:UC};function UC(e){const t=e.attempt(this.parser.constructs.contentInitial,n,s);let r;return t;function n(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),ze(e,t,"linePrefix")}function s(o){return e.enter("paragraph"),i(o)}function i(o){const l=e.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=l),r=l,a(o)}function a(o){if(o===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(o);return}return we(o)?(e.consume(o),e.exit("chunkText"),i):(e.consume(o),a)}}const VC={tokenize:GC},pf={tokenize:YC};function GC(e){const t=this,r=[];let n=0,s,i,a;return o;function o(C){if(n<r.length){const T=r[n];return t.containerState=T[1],e.attempt(T[0].continuation,l,c)(C)}return c(C)}function l(C){if(n++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&k();const T=t.events.length;let S=T,w;for(;S--;)if(t.events[S][0]==="exit"&&t.events[S][1].type==="chunkFlow"){w=t.events[S][1].end;break}x(n);let _=T;for(;_<t.events.length;)t.events[_][1].end={...w},_++;return lr(t.events,S+1,0,t.events.slice(T)),t.events.length=_,c(C)}return o(C)}function c(C){if(n===r.length){if(!s)return f(C);if(s.currentConstruct&&s.currentConstruct.concrete)return p(C);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(pf,u,h)(C)}function u(C){return s&&k(),x(n),f(C)}function h(C){return t.parser.lazy[t.now().line]=n!==r.length,a=t.now().offset,p(C)}function f(C){return t.containerState={},e.attempt(pf,g,p)(C)}function g(C){return n++,r.push([t.currentConstruct,t.containerState]),f(C)}function p(C){if(C===null){s&&k(),x(0),e.consume(C);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:i}),m(C)}function m(C){if(C===null){y(e.exit("chunkFlow"),!0),x(0),e.consume(C);return}return we(C)?(e.consume(C),y(e.exit("chunkFlow")),n=0,t.interrupt=void 0,o):(e.consume(C),m)}function y(C,T){const S=t.sliceStream(C);if(T&&S.push(null),C.previous=i,i&&(i.next=C),i=C,s.defineSkip(C.start),s.write(S),t.parser.lazy[C.start.line]){let w=s.events.length;for(;w--;)if(s.events[w][1].start.offset<a&&(!s.events[w][1].end||s.events[w][1].end.offset>a))return;const _=t.events.length;let O=_,P,v;for(;O--;)if(t.events[O][0]==="exit"&&t.events[O][1].type==="chunkFlow"){if(P){v=t.events[O][1].end;break}P=!0}for(x(n),w=_;w<t.events.length;)t.events[w][1].end={...v},w++;lr(t.events,O+1,0,t.events.slice(_)),t.events.length=w}}function x(C){let T=r.length;for(;T-- >C;){const S=r[T];t.containerState=S[1],S[0].exit.call(t,e)}r.length=C}function k(){s.write([null]),i=void 0,s=void 0,t.containerState._closeFlow=void 0}}function YC(e,t,r){return ze(e,e.attempt(this.parser.constructs.document,t,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Vs(e){if(e===null||Ze(e)||ns(e))return 1;if(hl(e))return 2}function dl(e,t,r){const n=[];let s=-1;for(;++s<e.length;){const i=e[s].resolveAll;i&&!n.includes(i)&&(t=i(t,r),n.push(i))}return t}const ou={name:"attention",resolveAll:XC,tokenize:KC};function XC(e,t){let r=-1,n,s,i,a,o,l,c,u;for(;++r<e.length;)if(e[r][0]==="enter"&&e[r][1].type==="attentionSequence"&&e[r][1]._close){for(n=r;n--;)if(e[n][0]==="exit"&&e[n][1].type==="attentionSequence"&&e[n][1]._open&&t.sliceSerialize(e[n][1]).charCodeAt(0)===t.sliceSerialize(e[r][1]).charCodeAt(0)){if((e[n][1]._close||e[r][1]._open)&&(e[r][1].end.offset-e[r][1].start.offset)%3&&!((e[n][1].end.offset-e[n][1].start.offset+e[r][1].end.offset-e[r][1].start.offset)%3))continue;l=e[n][1].end.offset-e[n][1].start.offset>1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const h={...e[n][1].end},f={...e[r][1].start};mf(h,-l),mf(f,l),a={type:l>1?"strongSequence":"emphasisSequence",start:h,end:{...e[n][1].end}},o={type:l>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:f},i={type:l>1?"strongText":"emphasisText",start:{...e[n][1].end},end:{...e[r][1].start}},s={type:l>1?"strong":"emphasis",start:{...a.start},end:{...o.end}},e[n][1].end={...a.start},e[r][1].start={...o.end},c=[],e[n][1].end.offset-e[n][1].start.offset&&(c=pr(c,[["enter",e[n][1],t],["exit",e[n][1],t]])),c=pr(c,[["enter",s,t],["enter",a,t],["exit",a,t],["enter",i,t]]),c=pr(c,dl(t.parser.constructs.insideSpan.null,e.slice(n+1,r),t)),c=pr(c,[["exit",i,t],["enter",o,t],["exit",o,t],["exit",s,t]]),e[r][1].end.offset-e[r][1].start.offset?(u=2,c=pr(c,[["enter",e[r][1],t],["exit",e[r][1],t]])):u=0,lr(e,n-1,r-n+3,c),r=n+c.length-u-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function KC(e,t){const r=this.parser.constructs.attentionMarkers.null,n=this.previous,s=Vs(n);let i;return a;function a(l){return i=l,e.enter("attentionSequence"),o(l)}function o(l){if(l===i)return e.consume(l),o;const c=e.exit("attentionSequence"),u=Vs(l),h=!u||u===2&&s||r.includes(l),f=!s||s===2&&u||r.includes(n);return c._open=!!(i===42?h:h&&(s||!f)),c._close=!!(i===42?f:f&&(u||!h)),t(l)}}function mf(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const QC={name:"autolink",tokenize:ZC};function ZC(e,t,r){let n=0;return s;function s(g){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(g),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(g){return Ot(g)?(e.consume(g),a):g===64?r(g):c(g)}function a(g){return g===43||g===45||g===46||Lt(g)?(n=1,o(g)):c(g)}function o(g){return g===58?(e.consume(g),n=0,l):(g===43||g===45||g===46||Lt(g))&&n++<32?(e.consume(g),o):(n=0,c(g))}function l(g){return g===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(g),e.exit("autolinkMarker"),e.exit("autolink"),t):g===null||g===32||g===60||wo(g)?r(g):(e.consume(g),l)}function c(g){return g===64?(e.consume(g),u):zC(g)?(e.consume(g),c):r(g)}function u(g){return Lt(g)?h(g):r(g)}function h(g){return g===46?(e.consume(g),n=0,u):g===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(g),e.exit("autolinkMarker"),e.exit("autolink"),t):f(g)}function f(g){if((g===45||Lt(g))&&n++<63){const p=g===45?f:h;return e.consume(g),p}return r(g)}}const xa={partial:!0,tokenize:JC};function JC(e,t,r){return n;function n(i){return Re(i)?ze(e,s,"linePrefix")(i):s(i)}function s(i){return i===null||we(i)?t(i):r(i)}}const Om={continuation:{tokenize:tS},exit:rS,name:"blockQuote",tokenize:eS};function eS(e,t,r){const n=this;return s;function s(a){if(a===62){const o=n.containerState;return o.open||(e.enter("blockQuote",{_container:!0}),o.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(a),e.exit("blockQuoteMarker"),i}return r(a)}function i(a){return Re(a)?(e.enter("blockQuotePrefixWhitespace"),e.consume(a),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(a))}}function tS(e,t,r){const n=this;return s;function s(a){return Re(a)?ze(e,i,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):i(a)}function i(a){return e.attempt(Om,t,r)(a)}}function rS(e){e.exit("blockQuote")}const zm={name:"characterEscape",tokenize:nS};function nS(e,t,r){return n;function n(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),s}function s(i){return HC(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):r(i)}}const Wm={name:"characterReference",tokenize:sS};function sS(e,t,r){const n=this;let s=0,i,a;return o;function o(h){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),l}function l(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),i=31,a=Lt,u(h))}function c(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,a=WC,u):(e.enter("characterReferenceValue"),i=7,a=au,u(h))}function u(h){if(h===59&&s){const f=e.exit("characterReferenceValue");return a===Lt&&!$h(n.sliceSerialize(f))?r(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return a(h)&&s++<i?(e.consume(h),u):r(h)}}const xf={partial:!0,tokenize:aS},yf={concrete:!0,name:"codeFenced",tokenize:iS};function iS(e,t,r){const n=this,s={partial:!0,tokenize:S};let i=0,a=0,o;return l;function l(w){return c(w)}function c(w){const _=n.events[n.events.length-1];return i=_&&_[1].type==="linePrefix"?_[2].sliceSerialize(_[1],!0).length:0,o=w,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),u(w)}function u(w){return w===o?(a++,e.consume(w),u):a<3?r(w):(e.exit("codeFencedFenceSequence"),Re(w)?ze(e,h,"whitespace")(w):h(w))}function h(w){return w===null||we(w)?(e.exit("codeFencedFence"),n.interrupt?t(w):e.check(xf,m,T)(w)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(w))}function f(w){return w===null||we(w)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(w)):Re(w)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ze(e,g,"whitespace")(w)):w===96&&w===o?r(w):(e.consume(w),f)}function g(w){return w===null||we(w)?h(w):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),p(w))}function p(w){return w===null||we(w)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(w)):w===96&&w===o?r(w):(e.consume(w),p)}function m(w){return e.attempt(s,T,y)(w)}function y(w){return e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),x}function x(w){return i>0&&Re(w)?ze(e,k,"linePrefix",i+1)(w):k(w)}function k(w){return w===null||we(w)?e.check(xf,m,T)(w):(e.enter("codeFlowValue"),C(w))}function C(w){return w===null||we(w)?(e.exit("codeFlowValue"),k(w)):(e.consume(w),C)}function T(w){return e.exit("codeFenced"),t(w)}function S(w,_,O){let P=0;return v;function v(B){return w.enter("lineEnding"),w.consume(B),w.exit("lineEnding"),L}function L(B){return w.enter("codeFencedFence"),Re(B)?ze(w,N,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):N(B)}function N(B){return B===o?(w.enter("codeFencedFenceSequence"),R(B)):O(B)}function R(B){return B===o?(P++,w.consume(B),R):P>=a?(w.exit("codeFencedFenceSequence"),Re(B)?ze(w,j,"whitespace")(B):j(B)):O(B)}function j(B){return B===null||we(B)?(w.exit("codeFencedFence"),_(B)):O(B)}}}function aS(e,t,r){const n=this;return s;function s(a){return a===null?r(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i)}function i(a){return n.parser.lazy[n.now().line]?r(a):t(a)}}const hc={name:"codeIndented",tokenize:lS},oS={partial:!0,tokenize:cS};function lS(e,t,r){const n=this;return s;function s(c){return e.enter("codeIndented"),ze(e,i,"linePrefix",5)(c)}function i(c){const u=n.events[n.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?a(c):r(c)}function a(c){return c===null?l(c):we(c)?e.attempt(oS,a,l)(c):(e.enter("codeFlowValue"),o(c))}function o(c){return c===null||we(c)?(e.exit("codeFlowValue"),a(c)):(e.consume(c),o)}function l(c){return e.exit("codeIndented"),t(c)}}function cS(e,t,r){const n=this;return s;function s(a){return n.parser.lazy[n.now().line]?r(a):we(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s):ze(e,i,"linePrefix",5)(a)}function i(a){const o=n.events[n.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(a):we(a)?s(a):r(a)}}const uS={name:"codeText",previous:dS,resolve:hS,tokenize:fS};function hS(e){let t=e.length-4,r=3,n,s;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(n=r;++n<t;)if(e[n][1].type==="codeTextData"){e[r][1].type="codeTextPadding",e[t][1].type="codeTextPadding",r+=2,t-=2;break}}for(n=r-1,t++;++n<=t;)s===void 0?n!==t&&e[n][1].type!=="lineEnding"&&(s=n):(n===t||e[n][1].type==="lineEnding")&&(e[s][1].type="codeTextData",n!==s+2&&(e[s][1].end=e[n-1][1].end,e.splice(s+2,n-s-2),t-=n-s-2,n=s+2),s=void 0);return e}function dS(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function fS(e,t,r){let n=0,s,i;return a;function a(h){return e.enter("codeText"),e.enter("codeTextSequence"),o(h)}function o(h){return h===96?(e.consume(h),n++,o):(e.exit("codeTextSequence"),l(h))}function l(h){return h===null?r(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),l):h===96?(i=e.enter("codeTextSequence"),s=0,u(h)):we(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),l):(e.enter("codeTextData"),c(h))}function c(h){return h===null||h===32||h===96||we(h)?(e.exit("codeTextData"),l(h)):(e.consume(h),c)}function u(h){return h===96?(e.consume(h),s++,u):s===n?(e.exit("codeTextSequence"),e.exit("codeText"),t(h)):(i.type="codeTextData",c(h))}}class gS{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,r){const n=r??Number.POSITIVE_INFINITY;return n<this.left.length?this.left.slice(t,n):t>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(t,r,n){const s=r||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return n&&xi(this.left,n),i.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),xi(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),xi(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 r=this.left.splice(t,Number.POSITIVE_INFINITY);xi(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);xi(this.left,r.reverse())}}}function xi(e,t){let r=0;if(t.length<1e4)e.push(...t);else for(;r<t.length;)e.push(...t.slice(r,r+1e4)),r+=1e4}function Hm(e){const t={};let r=-1,n,s,i,a,o,l,c;const u=new gS(e);for(;++r<u.length;){for(;r in t;)r=t[r];if(n=u.get(r),r&&n[1].type==="chunkFlow"&&u.get(r-1)[1].type==="listItemPrefix"&&(l=n[1]._tokenizer.events,i=0,i<l.length&&l[i][1].type==="lineEndingBlank"&&(i+=2),i<l.length&&l[i][1].type==="content"))for(;++i<l.length&&l[i][1].type!=="content";)l[i][1].type==="chunkText"&&(l[i][1]._isInFirstContentOfListItem=!0,i++);if(n[0]==="enter")n[1].contentType&&(Object.assign(t,pS(u,r)),r=t[r],c=!0);else if(n[1]._container){for(i=r,s=void 0;i--;)if(a=u.get(i),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(s&&(u.get(s)[1].type="lineEndingBlank"),a[1].type="lineEnding",s=i);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;s&&(n[1].end={...u.get(s)[1].start},o=u.slice(s,r),o.unshift(n),u.splice(s,r-s+1,o))}}return lr(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function pS(e,t){const r=e.get(t)[1],n=e.get(t)[2];let s=t-1;const i=[];let a=r._tokenizer;a||(a=n.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const o=a.events,l=[],c={};let u,h,f=-1,g=r,p=0,m=0;const y=[m];for(;g;){for(;e.get(++s)[1]!==g;);i.push(s),g._tokenizer||(u=n.sliceStream(g),g.next||u.push(null),h&&a.defineSkip(g.start),g._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(u),g._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),h=g,g=g.next}for(g=r;++f<o.length;)o[f][0]==="exit"&&o[f-1][0]==="enter"&&o[f][1].type===o[f-1][1].type&&o[f][1].start.line!==o[f][1].end.line&&(m=f+1,y.push(m),g._tokenizer=void 0,g.previous=void 0,g=g.next);for(a.events=[],g?(g._tokenizer=void 0,g.previous=void 0):y.pop(),f=y.length;f--;){const x=o.slice(y[f],y[f+1]),k=i.pop();l.push([k,k+x.length-1]),e.splice(k,2,x)}for(l.reverse(),f=-1;++f<l.length;)c[p+l[f][0]]=p+l[f][1],p+=l[f][1]-l[f][0]-1;return c}const mS={resolve:yS,tokenize:bS},xS={partial:!0,tokenize:kS};function yS(e){return Hm(e),e}function bS(e,t){let r;return n;function n(o){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),s(o)}function s(o){return o===null?i(o):we(o)?e.check(xS,a,i)(o):(e.consume(o),s)}function i(o){return e.exit("chunkContent"),e.exit("content"),t(o)}function a(o){return e.consume(o),e.exit("chunkContent"),r.next=e.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,s}}function kS(e,t,r){const n=this;return s;function s(a){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),ze(e,i,"linePrefix")}function i(a){if(a===null||we(a))return r(a);const o=n.events[n.events.length-1];return!n.parser.constructs.disable.null.includes("codeIndented")&&o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(a):e.interrupt(n.parser.constructs.flow,r,t)(a)}}function qm(e,t,r,n,s,i,a,o,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return h;function h(x){return x===60?(e.enter(n),e.enter(s),e.enter(i),e.consume(x),e.exit(i),f):x===null||x===32||x===41||wo(x)?r(x):(e.enter(n),e.enter(a),e.enter(o),e.enter("chunkString",{contentType:"string"}),m(x))}function f(x){return x===62?(e.enter(i),e.consume(x),e.exit(i),e.exit(s),e.exit(n),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),g(x))}function g(x){return x===62?(e.exit("chunkString"),e.exit(o),f(x)):x===null||x===60||we(x)?r(x):(e.consume(x),x===92?p:g)}function p(x){return x===60||x===62||x===92?(e.consume(x),g):g(x)}function m(x){return!u&&(x===null||x===41||Ze(x))?(e.exit("chunkString"),e.exit(o),e.exit(a),e.exit(n),t(x)):u<c&&x===40?(e.consume(x),u++,m):x===41?(e.consume(x),u--,m):x===null||x===32||x===40||wo(x)?r(x):(e.consume(x),x===92?y:m)}function y(x){return x===40||x===41||x===92?(e.consume(x),m):m(x)}}function Um(e,t,r,n,s,i){const a=this;let o=0,l;return c;function c(g){return e.enter(n),e.enter(s),e.consume(g),e.exit(s),e.enter(i),u}function u(g){return o>999||g===null||g===91||g===93&&!l||g===94&&!o&&"_hiddenFootnoteSupport"in a.parser.constructs?r(g):g===93?(e.exit(i),e.enter(s),e.consume(g),e.exit(s),e.exit(n),t):we(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),h(g))}function h(g){return g===null||g===91||g===93||we(g)||o++>999?(e.exit("chunkString"),u(g)):(e.consume(g),l||(l=!Re(g)),g===92?f:h)}function f(g){return g===91||g===92||g===93?(e.consume(g),o++,h):h(g)}}function Vm(e,t,r,n,s,i){let a;return o;function o(f){return f===34||f===39||f===40?(e.enter(n),e.enter(s),e.consume(f),e.exit(s),a=f===40?41:f,l):r(f)}function l(f){return f===a?(e.enter(s),e.consume(f),e.exit(s),e.exit(n),t):(e.enter(i),c(f))}function c(f){return f===a?(e.exit(i),l(a)):f===null?r(f):we(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),ze(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(f))}function u(f){return f===a||f===null||we(f)?(e.exit("chunkString"),c(f)):(e.consume(f),f===92?h:u)}function h(f){return f===a||f===92?(e.consume(f),u):u(f)}}function Ui(e,t){let r;return n;function n(s){return we(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),r=!0,n):Re(s)?ze(e,n,r?"linePrefix":"lineSuffix")(s):t(s)}}const wS={name:"definition",tokenize:CS},vS={partial:!0,tokenize:SS};function CS(e,t,r){const n=this;let s;return i;function i(g){return e.enter("definition"),a(g)}function a(g){return Um.call(n,e,o,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(g)}function o(g){return s=Mr(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),g===58?(e.enter("definitionMarker"),e.consume(g),e.exit("definitionMarker"),l):r(g)}function l(g){return Ze(g)?Ui(e,c)(g):c(g)}function c(g){return qm(e,u,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(g)}function u(g){return e.attempt(vS,h,h)(g)}function h(g){return Re(g)?ze(e,f,"whitespace")(g):f(g)}function f(g){return g===null||we(g)?(e.exit("definition"),n.parser.defined.push(s),t(g)):r(g)}}function SS(e,t,r){return n;function n(o){return Ze(o)?Ui(e,s)(o):r(o)}function s(o){return Vm(e,i,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return Re(o)?ze(e,a,"whitespace")(o):a(o)}function a(o){return o===null||we(o)?t(o):r(o)}}const _S={name:"hardBreakEscape",tokenize:TS};function TS(e,t,r){return n;function n(i){return e.enter("hardBreakEscape"),e.consume(i),s}function s(i){return we(i)?(e.exit("hardBreakEscape"),t(i)):r(i)}}const NS={name:"headingAtx",resolve:ES,tokenize:AS};function ES(e,t){let r=e.length-2,n=3,s,i;return e[n][1].type==="whitespace"&&(n+=2),r-2>n&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(n===r-1||r-4>n&&e[r-2][1].type==="whitespace")&&(r-=n+1===r?2:4),r>n&&(s={type:"atxHeadingText",start:e[n][1].start,end:e[r][1].end},i={type:"chunkText",start:e[n][1].start,end:e[r][1].end,contentType:"text"},lr(e,n,r-n+1,[["enter",s,t],["enter",i,t],["exit",i,t],["exit",s,t]])),e}function AS(e,t,r){let n=0;return s;function s(u){return e.enter("atxHeading"),i(u)}function i(u){return e.enter("atxHeadingSequence"),a(u)}function a(u){return u===35&&n++<6?(e.consume(u),a):u===null||Ze(u)?(e.exit("atxHeadingSequence"),o(u)):r(u)}function o(u){return u===35?(e.enter("atxHeadingSequence"),l(u)):u===null||we(u)?(e.exit("atxHeading"),t(u)):Re(u)?ze(e,o,"whitespace")(u):(e.enter("atxHeadingText"),c(u))}function l(u){return u===35?(e.consume(u),l):(e.exit("atxHeadingSequence"),o(u))}function c(u){return u===null||u===35||Ze(u)?(e.exit("atxHeadingText"),o(u)):(e.consume(u),c)}}const MS=["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"],bf=["pre","script","style","textarea"],jS={concrete:!0,name:"htmlFlow",resolveTo:$S,tokenize:DS},IS={partial:!0,tokenize:RS},LS={partial:!0,tokenize:BS};function $S(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 DS(e,t,r){const n=this;let s,i,a,o,l;return c;function c(E){return u(E)}function u(E){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(E),h}function h(E){return E===33?(e.consume(E),f):E===47?(e.consume(E),i=!0,m):E===63?(e.consume(E),s=3,n.interrupt?t:A):Ot(E)?(e.consume(E),a=String.fromCharCode(E),y):r(E)}function f(E){return E===45?(e.consume(E),s=2,g):E===91?(e.consume(E),s=5,o=0,p):Ot(E)?(e.consume(E),s=4,n.interrupt?t:A):r(E)}function g(E){return E===45?(e.consume(E),n.interrupt?t:A):r(E)}function p(E){const Z="CDATA[";return E===Z.charCodeAt(o++)?(e.consume(E),o===Z.length?n.interrupt?t:N:p):r(E)}function m(E){return Ot(E)?(e.consume(E),a=String.fromCharCode(E),y):r(E)}function y(E){if(E===null||E===47||E===62||Ze(E)){const Z=E===47,D=a.toLowerCase();return!Z&&!i&&bf.includes(D)?(s=1,n.interrupt?t(E):N(E)):MS.includes(a.toLowerCase())?(s=6,Z?(e.consume(E),x):n.interrupt?t(E):N(E)):(s=7,n.interrupt&&!n.parser.lazy[n.now().line]?r(E):i?k(E):C(E))}return E===45||Lt(E)?(e.consume(E),a+=String.fromCharCode(E),y):r(E)}function x(E){return E===62?(e.consume(E),n.interrupt?t:N):r(E)}function k(E){return Re(E)?(e.consume(E),k):v(E)}function C(E){return E===47?(e.consume(E),v):E===58||E===95||Ot(E)?(e.consume(E),T):Re(E)?(e.consume(E),C):v(E)}function T(E){return E===45||E===46||E===58||E===95||Lt(E)?(e.consume(E),T):S(E)}function S(E){return E===61?(e.consume(E),w):Re(E)?(e.consume(E),S):C(E)}function w(E){return E===null||E===60||E===61||E===62||E===96?r(E):E===34||E===39?(e.consume(E),l=E,_):Re(E)?(e.consume(E),w):O(E)}function _(E){return E===l?(e.consume(E),l=null,P):E===null||we(E)?r(E):(e.consume(E),_)}function O(E){return E===null||E===34||E===39||E===47||E===60||E===61||E===62||E===96||Ze(E)?S(E):(e.consume(E),O)}function P(E){return E===47||E===62||Re(E)?C(E):r(E)}function v(E){return E===62?(e.consume(E),L):r(E)}function L(E){return E===null||we(E)?N(E):Re(E)?(e.consume(E),L):r(E)}function N(E){return E===45&&s===2?(e.consume(E),I):E===60&&s===1?(e.consume(E),F):E===62&&s===4?(e.consume(E),G):E===63&&s===3?(e.consume(E),A):E===93&&s===5?(e.consume(E),ee):we(E)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(IS,$,R)(E)):E===null||we(E)?(e.exit("htmlFlowData"),R(E)):(e.consume(E),N)}function R(E){return e.check(LS,j,$)(E)}function j(E){return e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),B}function B(E){return E===null||we(E)?R(E):(e.enter("htmlFlowData"),N(E))}function I(E){return E===45?(e.consume(E),A):N(E)}function F(E){return E===47?(e.consume(E),a="",W):N(E)}function W(E){if(E===62){const Z=a.toLowerCase();return bf.includes(Z)?(e.consume(E),G):N(E)}return Ot(E)&&a.length<8?(e.consume(E),a+=String.fromCharCode(E),W):N(E)}function ee(E){return E===93?(e.consume(E),A):N(E)}function A(E){return E===62?(e.consume(E),G):E===45&&s===2?(e.consume(E),A):N(E)}function G(E){return E===null||we(E)?(e.exit("htmlFlowData"),$(E)):(e.consume(E),G)}function $(E){return e.exit("htmlFlow"),t(E)}}function BS(e,t,r){const n=this;return s;function s(a){return we(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):r(a)}function i(a){return n.parser.lazy[n.now().line]?r(a):t(a)}}function RS(e,t,r){return n;function n(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(xa,t,r)}}const PS={name:"htmlText",tokenize:FS};function FS(e,t,r){const n=this;let s,i,a;return o;function o(A){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(A),l}function l(A){return A===33?(e.consume(A),c):A===47?(e.consume(A),S):A===63?(e.consume(A),C):Ot(A)?(e.consume(A),O):r(A)}function c(A){return A===45?(e.consume(A),u):A===91?(e.consume(A),i=0,p):Ot(A)?(e.consume(A),k):r(A)}function u(A){return A===45?(e.consume(A),g):r(A)}function h(A){return A===null?r(A):A===45?(e.consume(A),f):we(A)?(a=h,F(A)):(e.consume(A),h)}function f(A){return A===45?(e.consume(A),g):h(A)}function g(A){return A===62?I(A):A===45?f(A):h(A)}function p(A){const G="CDATA[";return A===G.charCodeAt(i++)?(e.consume(A),i===G.length?m:p):r(A)}function m(A){return A===null?r(A):A===93?(e.consume(A),y):we(A)?(a=m,F(A)):(e.consume(A),m)}function y(A){return A===93?(e.consume(A),x):m(A)}function x(A){return A===62?I(A):A===93?(e.consume(A),x):m(A)}function k(A){return A===null||A===62?I(A):we(A)?(a=k,F(A)):(e.consume(A),k)}function C(A){return A===null?r(A):A===63?(e.consume(A),T):we(A)?(a=C,F(A)):(e.consume(A),C)}function T(A){return A===62?I(A):C(A)}function S(A){return Ot(A)?(e.consume(A),w):r(A)}function w(A){return A===45||Lt(A)?(e.consume(A),w):_(A)}function _(A){return we(A)?(a=_,F(A)):Re(A)?(e.consume(A),_):I(A)}function O(A){return A===45||Lt(A)?(e.consume(A),O):A===47||A===62||Ze(A)?P(A):r(A)}function P(A){return A===47?(e.consume(A),I):A===58||A===95||Ot(A)?(e.consume(A),v):we(A)?(a=P,F(A)):Re(A)?(e.consume(A),P):I(A)}function v(A){return A===45||A===46||A===58||A===95||Lt(A)?(e.consume(A),v):L(A)}function L(A){return A===61?(e.consume(A),N):we(A)?(a=L,F(A)):Re(A)?(e.consume(A),L):P(A)}function N(A){return A===null||A===60||A===61||A===62||A===96?r(A):A===34||A===39?(e.consume(A),s=A,R):we(A)?(a=N,F(A)):Re(A)?(e.consume(A),N):(e.consume(A),j)}function R(A){return A===s?(e.consume(A),s=void 0,B):A===null?r(A):we(A)?(a=R,F(A)):(e.consume(A),R)}function j(A){return A===null||A===34||A===39||A===60||A===61||A===96?r(A):A===47||A===62||Ze(A)?P(A):(e.consume(A),j)}function B(A){return A===47||A===62||Ze(A)?P(A):r(A)}function I(A){return A===62?(e.consume(A),e.exit("htmlTextData"),e.exit("htmlText"),t):r(A)}function F(A){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),W}function W(A){return Re(A)?ze(e,ee,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(A):ee(A)}function ee(A){return e.enter("htmlTextData"),a(A)}}const Dh={name:"labelEnd",resolveAll:HS,resolveTo:qS,tokenize:US},OS={tokenize:VS},zS={tokenize:GS},WS={tokenize:YS};function HS(e){let t=-1;const r=[];for(;++t<e.length;){const n=e[t][1];if(r.push(e[t]),n.type==="labelImage"||n.type==="labelLink"||n.type==="labelEnd"){const s=n.type==="labelImage"?4:2;n.type="data",t+=s}}return e.length!==r.length&&lr(e,0,e.length,r),e}function qS(e,t){let r=e.length,n=0,s,i,a,o;for(;r--;)if(s=e[r][1],i){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[r][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(a){if(e[r][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(i=r,s.type!=="labelLink")){n=2;break}}else s.type==="labelEnd"&&(a=r);const l={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[i][1].start},end:{...e[a][1].end}},u={type:"labelText",start:{...e[i+n+2][1].end},end:{...e[a-2][1].start}};return o=[["enter",l,t],["enter",c,t]],o=pr(o,e.slice(i+1,i+n+3)),o=pr(o,[["enter",u,t]]),o=pr(o,dl(t.parser.constructs.insideSpan.null,e.slice(i+n+4,a-3),t)),o=pr(o,[["exit",u,t],e[a-2],e[a-1],["exit",c,t]]),o=pr(o,e.slice(a+1)),o=pr(o,[["exit",l,t]]),lr(e,i,e.length,o),e}function US(e,t,r){const n=this;let s=n.events.length,i,a;for(;s--;)if((n.events[s][1].type==="labelImage"||n.events[s][1].type==="labelLink")&&!n.events[s][1]._balanced){i=n.events[s][1];break}return o;function o(f){return i?i._inactive?h(f):(a=n.parser.defined.includes(Mr(n.sliceSerialize({start:i.end,end:n.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelEnd"),l):r(f)}function l(f){return f===40?e.attempt(OS,u,a?u:h)(f):f===91?e.attempt(zS,u,a?c:h)(f):a?u(f):h(f)}function c(f){return e.attempt(WS,u,h)(f)}function u(f){return t(f)}function h(f){return i._balanced=!0,r(f)}}function VS(e,t,r){return n;function n(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),s}function s(h){return Ze(h)?Ui(e,i)(h):i(h)}function i(h){return h===41?u(h):qm(e,a,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function a(h){return Ze(h)?Ui(e,l)(h):u(h)}function o(h){return r(h)}function l(h){return h===34||h===39||h===40?Vm(e,c,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):u(h)}function c(h){return Ze(h)?Ui(e,u)(h):u(h)}function u(h){return h===41?(e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),e.exit("resource"),t):r(h)}}function GS(e,t,r){const n=this;return s;function s(o){return Um.call(n,e,i,a,"reference","referenceMarker","referenceString")(o)}function i(o){return n.parser.defined.includes(Mr(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)))?t(o):r(o)}function a(o){return r(o)}}function YS(e,t,r){return n;function n(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),s}function s(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):r(i)}}const XS={name:"labelStartImage",resolveAll:Dh.resolveAll,tokenize:KS};function KS(e,t,r){const n=this;return s;function s(o){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(o),e.exit("labelImageMarker"),i}function i(o){return o===91?(e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelImage"),a):r(o)}function a(o){return o===94&&"_hiddenFootnoteSupport"in n.parser.constructs?r(o):t(o)}}const QS={name:"labelStartLink",resolveAll:Dh.resolveAll,tokenize:ZS};function ZS(e,t,r){const n=this;return s;function s(a){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelLink"),i}function i(a){return a===94&&"_hiddenFootnoteSupport"in n.parser.constructs?r(a):t(a)}}const dc={name:"lineEnding",tokenize:JS};function JS(e,t){return r;function r(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),ze(e,t,"linePrefix")}}const so={name:"thematicBreak",tokenize:e2};function e2(e,t,r){let n=0,s;return i;function i(c){return e.enter("thematicBreak"),a(c)}function a(c){return s=c,o(c)}function o(c){return c===s?(e.enter("thematicBreakSequence"),l(c)):n>=3&&(c===null||we(c))?(e.exit("thematicBreak"),t(c)):r(c)}function l(c){return c===s?(e.consume(c),n++,l):(e.exit("thematicBreakSequence"),Re(c)?ze(e,o,"whitespace")(c):o(c))}}const er={continuation:{tokenize:s2},exit:a2,name:"list",tokenize:n2},t2={partial:!0,tokenize:o2},r2={partial:!0,tokenize:i2};function n2(e,t,r){const n=this,s=n.events[n.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,a=0;return o;function o(g){const p=n.containerState.type||(g===42||g===43||g===45?"listUnordered":"listOrdered");if(p==="listUnordered"?!n.containerState.marker||g===n.containerState.marker:au(g)){if(n.containerState.type||(n.containerState.type=p,e.enter(p,{_container:!0})),p==="listUnordered")return e.enter("listItemPrefix"),g===42||g===45?e.check(so,r,c)(g):c(g);if(!n.interrupt||g===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(g)}return r(g)}function l(g){return au(g)&&++a<10?(e.consume(g),l):(!n.interrupt||a<2)&&(n.containerState.marker?g===n.containerState.marker:g===41||g===46)?(e.exit("listItemValue"),c(g)):r(g)}function c(g){return e.enter("listItemMarker"),e.consume(g),e.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||g,e.check(xa,n.interrupt?r:u,e.attempt(t2,f,h))}function u(g){return n.containerState.initialBlankLine=!0,i++,f(g)}function h(g){return Re(g)?(e.enter("listItemPrefixWhitespace"),e.consume(g),e.exit("listItemPrefixWhitespace"),f):r(g)}function f(g){return n.containerState.size=i+n.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(g)}}function s2(e,t,r){const n=this;return n.containerState._closeFlow=void 0,e.check(xa,s,i);function s(o){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,ze(e,t,"listItemIndent",n.containerState.size+1)(o)}function i(o){return n.containerState.furtherBlankLines||!Re(o)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,a(o)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,e.attempt(r2,t,a)(o))}function a(o){return n.containerState._closeFlow=!0,n.interrupt=void 0,ze(e,e.attempt(er,t,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function i2(e,t,r){const n=this;return ze(e,s,"listItemIndent",n.containerState.size+1);function s(i){const a=n.events[n.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===n.containerState.size?t(i):r(i)}}function a2(e){e.exit(this.containerState.type)}function o2(e,t,r){const n=this;return ze(e,s,"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const a=n.events[n.events.length-1];return!Re(i)&&a&&a[1].type==="listItemPrefixWhitespace"?t(i):r(i)}}const kf={name:"setextUnderline",resolveTo:l2,tokenize:c2};function l2(e,t){let r=e.length,n,s,i;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){n=r;break}e[r][1].type==="paragraph"&&(s=r)}else e[r][1].type==="content"&&e.splice(r,1),!i&&e[r][1].type==="definition"&&(i=r);const a={type:"setextHeading",start:{...e[n][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",i?(e.splice(s,0,["enter",a,t]),e.splice(i+1,0,["exit",e[n][1],t]),e[n][1].end={...e[i][1].end}):e[n][1]=a,e.push(["exit",a,t]),e}function c2(e,t,r){const n=this;let s;return i;function i(c){let u=n.events.length,h;for(;u--;)if(n.events[u][1].type!=="lineEnding"&&n.events[u][1].type!=="linePrefix"&&n.events[u][1].type!=="content"){h=n.events[u][1].type==="paragraph";break}return!n.parser.lazy[n.now().line]&&(n.interrupt||h)?(e.enter("setextHeadingLine"),s=c,a(c)):r(c)}function a(c){return e.enter("setextHeadingLineSequence"),o(c)}function o(c){return c===s?(e.consume(c),o):(e.exit("setextHeadingLineSequence"),Re(c)?ze(e,l,"lineSuffix")(c):l(c))}function l(c){return c===null||we(c)?(e.exit("setextHeadingLine"),t(c)):r(c)}}const u2={tokenize:h2};function h2(e){const t=this,r=e.attempt(xa,n,e.attempt(this.parser.constructs.flowInitial,s,ze(e,e.attempt(this.parser.constructs.flow,s,e.attempt(mS,s)),"linePrefix")));return r;function n(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,r}function s(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,r}}const d2={resolveAll:Ym()},f2=Gm("string"),g2=Gm("text");function Gm(e){return{resolveAll:Ym(e==="text"?p2:void 0),tokenize:t};function t(r){const n=this,s=this.parser.constructs[e],i=r.attempt(s,a,o);return a;function a(u){return c(u)?i(u):o(u)}function o(u){if(u===null){r.consume(u);return}return r.enter("data"),r.consume(u),l}function l(u){return c(u)?(r.exit("data"),i(u)):(r.consume(u),l)}function c(u){if(u===null)return!0;const h=s[u];let f=-1;if(h)for(;++f<h.length;){const g=h[f];if(!g.previous||g.previous.call(n,n.previous))return!0}return!1}}}function Ym(e){return t;function t(r,n){let s=-1,i;for(;++s<=r.length;)i===void 0?r[s]&&r[s][1].type==="data"&&(i=s,s++):(!r[s]||r[s][1].type!=="data")&&(s!==i+2&&(r[i][1].end=r[s-1][1].end,r.splice(i+2,s-i-2),s=i+2),i=void 0);return e?e(r,n):r}}function p2(e,t){let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const n=e[r-1][1],s=t.sliceStream(n);let i=s.length,a=-1,o=0,l;for(;i--;){const c=s[i];if(typeof c=="string"){for(a=c.length;c.charCodeAt(a-1)===32;)o++,a--;if(a)break;a=-1}else if(c===-2)l=!0,o++;else if(c!==-1){i++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(o=0),o){const c={type:r===e.length||l||o<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?a:n.start._bufferIndex+a,_index:n.start._index+i,line:n.end.line,column:n.end.column-o,offset:n.end.offset-o},end:{...n.end}};n.end={...c.start},n.start.offset===n.end.offset?Object.assign(n,c):(e.splice(r,0,["enter",c,t],["exit",c,t]),r+=2)}r++}return e}const m2={42:er,43:er,45:er,48:er,49:er,50:er,51:er,52:er,53:er,54:er,55:er,56:er,57:er,62:Om},x2={91:wS},y2={[-2]:hc,[-1]:hc,32:hc},b2={35:NS,42:so,45:[kf,so],60:jS,61:kf,95:so,96:yf,126:yf},k2={38:Wm,92:zm},w2={[-5]:dc,[-4]:dc,[-3]:dc,33:XS,38:Wm,42:ou,60:[QC,PS],91:QS,92:[_S,zm],93:Dh,95:ou,96:uS},v2={null:[ou,d2]},C2={null:[42,95]},S2={null:[]},_2=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:C2,contentInitial:x2,disable:S2,document:m2,flow:b2,flowInitial:y2,insideSpan:v2,string:k2,text:w2},Symbol.toStringTag,{value:"Module"}));function T2(e,t,r){let n={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const s={},i=[];let a=[],o=[];const l={attempt:_(S),check:_(w),consume:k,enter:C,exit:T,interrupt:_(w,{interrupt:!0})},c={code:null,containerState:{},defineSkip:m,events:[],now:p,parser:e,previous:null,sliceSerialize:f,sliceStream:g,write:h};let u=t.tokenize.call(c,l);return t.resolveAll&&i.push(t),c;function h(L){return a=pr(a,L),y(),a[a.length-1]!==null?[]:(O(t,0),c.events=dl(i,c.events,c),c.events)}function f(L,N){return E2(g(L),N)}function g(L){return N2(a,L)}function p(){const{_bufferIndex:L,_index:N,line:R,column:j,offset:B}=n;return{_bufferIndex:L,_index:N,line:R,column:j,offset:B}}function m(L){s[L.line]=L.column,v()}function y(){let L;for(;n._index<a.length;){const N=a[n._index];if(typeof N=="string")for(L=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===L&&n._bufferIndex<N.length;)x(N.charCodeAt(n._bufferIndex));else x(N)}}function x(L){u=u(L)}function k(L){we(L)?(n.line++,n.column=1,n.offset+=L===-3?2:1,v()):L!==-1&&(n.column++,n.offset++),n._bufferIndex<0?n._index++:(n._bufferIndex++,n._bufferIndex===a[n._index].length&&(n._bufferIndex=-1,n._index++)),c.previous=L}function C(L,N){const R=N||{};return R.type=L,R.start=p(),c.events.push(["enter",R,c]),o.push(R),R}function T(L){const N=o.pop();return N.end=p(),c.events.push(["exit",N,c]),N}function S(L,N){O(L,N.from)}function w(L,N){N.restore()}function _(L,N){return R;function R(j,B,I){let F,W,ee,A;return Array.isArray(j)?$(j):"tokenize"in j?$([j]):G(j);function G(X){return V;function V(H){const Y=H!==null&&X[H],Q=H!==null&&X.null,se=[...Array.isArray(Y)?Y:Y?[Y]:[],...Array.isArray(Q)?Q:Q?[Q]:[]];return $(se)(H)}}function $(X){return F=X,W=0,X.length===0?I:E(X[W])}function E(X){return V;function V(H){return A=P(),ee=X,X.partial||(c.currentConstruct=X),X.name&&c.parser.constructs.disable.null.includes(X.name)?D():X.tokenize.call(N?Object.assign(Object.create(c),N):c,l,Z,D)(H)}}function Z(X){return L(ee,A),B}function D(X){return A.restore(),++W<F.length?E(F[W]):I}}}function O(L,N){L.resolveAll&&!i.includes(L)&&i.push(L),L.resolve&&lr(c.events,N,c.events.length-N,L.resolve(c.events.slice(N),c)),L.resolveTo&&(c.events=L.resolveTo(c.events,c))}function P(){const L=p(),N=c.previous,R=c.currentConstruct,j=c.events.length,B=Array.from(o);return{from:j,restore:I};function I(){n=L,c.previous=N,c.currentConstruct=R,c.events.length=j,o=B,v()}}function v(){n.line in s&&n.column<2&&(n.column=s[n.line],n.offset+=s[n.line]-1)}}function N2(e,t){const r=t.start._index,n=t.start._bufferIndex,s=t.end._index,i=t.end._bufferIndex;let a;if(r===s)a=[e[r].slice(n,i)];else{if(a=e.slice(r,s),n>-1){const o=a[0];typeof o=="string"?a[0]=o.slice(n):a.shift()}i>0&&a.push(e[s].slice(0,i))}return a}function E2(e,t){let r=-1;const n=[];let s;for(;++r<e.length;){const i=e[r];let a;if(typeof i=="string")a=i;else switch(i){case-5:{a="\r";break}case-4:{a=`
109
+ `;break}case-3:{a=`\r
110
+ `;break}case-2:{a=t?" ":" ";break}case-1:{if(!t&&s)continue;a=" ";break}default:a=String.fromCharCode(i)}s=i===-2,n.push(a)}return n.join("")}function A2(e){const n={constructs:Pm([_2,...(e||{}).extensions||[]]),content:s(qC),defined:[],document:s(VC),flow:s(u2),lazy:{},string:s(f2),text:s(g2)};return n;function s(i){return a;function a(o){return T2(n,i,o)}}}function M2(e){for(;!Hm(e););return e}const wf=/[\0\t\n\r]/g;function j2(){let e=1,t="",r=!0,n;return s;function s(i,a,o){const l=[];let c,u,h,f,g;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(a||void 0).decode(i)),h=0,t="",r&&(i.charCodeAt(0)===65279&&h++,r=void 0);h<i.length;){if(wf.lastIndex=h,c=wf.exec(i),f=c&&c.index!==void 0?c.index:i.length,g=i.charCodeAt(f),!c){t=i.slice(h);break}if(g===10&&h===f&&n)l.push(-3),n=void 0;else switch(n&&(l.push(-5),n=void 0),h<f&&(l.push(i.slice(h,f)),e+=f-h),g){case 0:{l.push(65533),e++;break}case 9:{for(u=Math.ceil(e/4)*4,l.push(-2);e++<u;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:n=!0,e=1}h=f+1}return o&&(n&&l.push(-5),t&&l.push(t),l.push(null)),l}}const I2=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function L2(e){return e.replace(I2,$2)}function $2(e,t,r){if(t)return t;if(r.charCodeAt(0)===35){const s=r.charCodeAt(1),i=s===120||s===88;return Fm(r.slice(i?2:1),i?16:10)}return $h(r)||e}const Xm={}.hasOwnProperty;function D2(e,t,r){return typeof t!="string"&&(r=t,t=void 0),B2(r)(M2(A2(r).document().write(j2()(e,t,!0))))}function B2(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Mt),autolinkProtocol:P,autolinkEmail:P,atxHeading:i(Ae),blockQuote:i(Q),characterEscape:P,characterReference:P,codeFenced:i(se),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:i(se,a),codeText:i(_e,a),codeTextData:P,data:P,codeFlowValue:P,definition:i(Te),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:i(Me),hardBreakEscape:i(ut),hardBreakTrailing:i(ut),htmlFlow:i(Xe,a),htmlFlowData:P,htmlText:i(Xe,a),htmlTextData:P,image:i(ht),label:a,link:i(Mt),listItem:i(ot),listItemValue:f,listOrdered:i(tt,h),listUnordered:i(tt),paragraph:i(Gt),reference:E,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:i(Ae),strong:i(mt),thematicBreak:i(kt)},exit:{atxHeading:l(),atxHeadingSequence:S,autolink:l(),autolinkEmail:Y,autolinkProtocol:H,blockQuote:l(),characterEscapeValue:v,characterReferenceMarkerHexadecimal:D,characterReferenceMarkerNumeric:D,characterReferenceValue:X,characterReference:V,codeFenced:l(y),codeFencedFence:m,codeFencedFenceInfo:g,codeFencedFenceMeta:p,codeFlowValue:v,codeIndented:l(x),codeText:l(B),codeTextData:v,data:v,definition:l(),definitionDestinationString:T,definitionLabelString:k,definitionTitleString:C,emphasis:l(),hardBreakEscape:l(N),hardBreakTrailing:l(N),htmlFlow:l(R),htmlFlowData:v,htmlText:l(j),htmlTextData:v,image:l(F),label:ee,labelText:W,lineEnding:L,link:l(I),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:Z,resourceDestinationString:A,resourceTitleString:G,resource:$,setextHeading:l(O),setextHeadingLineSequence:_,setextHeadingText:w,strong:l(),thematicBreak:l()}};Km(t,(e||{}).mdastExtensions||[]);const r={};return n;function n(U){let J={type:"root",children:[]};const le={stack:[J],tokenStack:[],config:t,enter:o,exit:c,buffer:a,resume:u,data:r},ae=[];let Ee=-1;for(;++Ee<U.length;)if(U[Ee][1].type==="listOrdered"||U[Ee][1].type==="listUnordered")if(U[Ee][0]==="enter")ae.push(Ee);else{const xe=ae.pop();Ee=s(U,xe,Ee)}for(Ee=-1;++Ee<U.length;){const xe=t[U[Ee][0]];Xm.call(xe,U[Ee][1].type)&&xe[U[Ee][1].type].call(Object.assign({sliceSerialize:U[Ee][2].sliceSerialize},le),U[Ee][1])}if(le.tokenStack.length>0){const xe=le.tokenStack[le.tokenStack.length-1];(xe[1]||vf).call(le,void 0,xe[0])}for(J.position={start:vn(U.length>0?U[0][1].start:{line:1,column:1,offset:0}),end:vn(U.length>0?U[U.length-2][1].end:{line:1,column:1,offset:0})},Ee=-1;++Ee<t.transforms.length;)J=t.transforms[Ee](J)||J;return J}function s(U,J,le){let ae=J-1,Ee=-1,xe=!1,rt,Ke,xt,nt;for(;++ae<=le;){const Se=U[ae];switch(Se[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Se[0]==="enter"?Ee++:Ee--,nt=void 0;break}case"lineEndingBlank":{Se[0]==="enter"&&(rt&&!nt&&!Ee&&!xt&&(xt=ae),nt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:nt=void 0}if(!Ee&&Se[0]==="enter"&&Se[1].type==="listItemPrefix"||Ee===-1&&Se[0]==="exit"&&(Se[1].type==="listUnordered"||Se[1].type==="listOrdered")){if(rt){let Ve=ae;for(Ke=void 0;Ve--;){const Le=U[Ve];if(Le[1].type==="lineEnding"||Le[1].type==="lineEndingBlank"){if(Le[0]==="exit")continue;Ke&&(U[Ke][1].type="lineEndingBlank",xe=!0),Le[1].type="lineEnding",Ke=Ve}else if(!(Le[1].type==="linePrefix"||Le[1].type==="blockQuotePrefix"||Le[1].type==="blockQuotePrefixWhitespace"||Le[1].type==="blockQuoteMarker"||Le[1].type==="listItemIndent"))break}xt&&(!Ke||xt<Ke)&&(rt._spread=!0),rt.end=Object.assign({},Ke?U[Ke][1].start:Se[1].end),U.splice(Ke||ae,0,["exit",rt,Se[2]]),ae++,le++}if(Se[1].type==="listItemPrefix"){const Ve={type:"listItem",_spread:!1,start:Object.assign({},Se[1].start),end:void 0};rt=Ve,U.splice(ae,0,["enter",Ve,Se[2]]),ae++,le++,xt=void 0,nt=!0}}}return U[J][1]._spread=xe,le}function i(U,J){return le;function le(ae){o.call(this,U(ae),ae),J&&J.call(this,ae)}}function a(){this.stack.push({type:"fragment",children:[]})}function o(U,J,le){this.stack[this.stack.length-1].children.push(U),this.stack.push(U),this.tokenStack.push([J,le||void 0]),U.position={start:vn(J.start),end:void 0}}function l(U){return J;function J(le){U&&U.call(this,le),c.call(this,le)}}function c(U,J){const le=this.stack.pop(),ae=this.tokenStack.pop();if(ae)ae[0].type!==U.type&&(J?J.call(this,U,ae[0]):(ae[1]||vf).call(this,U,ae[0]));else throw new Error("Cannot close `"+U.type+"` ("+qi({start:U.start,end:U.end})+"): it’s not open");le.position.end=vn(U.end)}function u(){return Lh(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function f(U){if(this.data.expectingFirstListItemValue){const J=this.stack[this.stack.length-2];J.start=Number.parseInt(this.sliceSerialize(U),10),this.data.expectingFirstListItemValue=void 0}}function g(){const U=this.resume(),J=this.stack[this.stack.length-1];J.lang=U}function p(){const U=this.resume(),J=this.stack[this.stack.length-1];J.meta=U}function m(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function y(){const U=this.resume(),J=this.stack[this.stack.length-1];J.value=U.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function x(){const U=this.resume(),J=this.stack[this.stack.length-1];J.value=U.replace(/(\r?\n|\r)$/g,"")}function k(U){const J=this.resume(),le=this.stack[this.stack.length-1];le.label=J,le.identifier=Mr(this.sliceSerialize(U)).toLowerCase()}function C(){const U=this.resume(),J=this.stack[this.stack.length-1];J.title=U}function T(){const U=this.resume(),J=this.stack[this.stack.length-1];J.url=U}function S(U){const J=this.stack[this.stack.length-1];if(!J.depth){const le=this.sliceSerialize(U).length;J.depth=le}}function w(){this.data.setextHeadingSlurpLineEnding=!0}function _(U){const J=this.stack[this.stack.length-1];J.depth=this.sliceSerialize(U).codePointAt(0)===61?1:2}function O(){this.data.setextHeadingSlurpLineEnding=void 0}function P(U){const le=this.stack[this.stack.length-1].children;let ae=le[le.length-1];(!ae||ae.type!=="text")&&(ae=Yt(),ae.position={start:vn(U.start),end:void 0},le.push(ae)),this.stack.push(ae)}function v(U){const J=this.stack.pop();J.value+=this.sliceSerialize(U),J.position.end=vn(U.end)}function L(U){const J=this.stack[this.stack.length-1];if(this.data.atHardBreak){const le=J.children[J.children.length-1];le.position.end=vn(U.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(J.type)&&(P.call(this,U),v.call(this,U))}function N(){this.data.atHardBreak=!0}function R(){const U=this.resume(),J=this.stack[this.stack.length-1];J.value=U}function j(){const U=this.resume(),J=this.stack[this.stack.length-1];J.value=U}function B(){const U=this.resume(),J=this.stack[this.stack.length-1];J.value=U}function I(){const U=this.stack[this.stack.length-1];if(this.data.inReference){const J=this.data.referenceType||"shortcut";U.type+="Reference",U.referenceType=J,delete U.url,delete U.title}else delete U.identifier,delete U.label;this.data.referenceType=void 0}function F(){const U=this.stack[this.stack.length-1];if(this.data.inReference){const J=this.data.referenceType||"shortcut";U.type+="Reference",U.referenceType=J,delete U.url,delete U.title}else delete U.identifier,delete U.label;this.data.referenceType=void 0}function W(U){const J=this.sliceSerialize(U),le=this.stack[this.stack.length-2];le.label=L2(J),le.identifier=Mr(J).toLowerCase()}function ee(){const U=this.stack[this.stack.length-1],J=this.resume(),le=this.stack[this.stack.length-1];if(this.data.inReference=!0,le.type==="link"){const ae=U.children;le.children=ae}else le.alt=J}function A(){const U=this.resume(),J=this.stack[this.stack.length-1];J.url=U}function G(){const U=this.resume(),J=this.stack[this.stack.length-1];J.title=U}function $(){this.data.inReference=void 0}function E(){this.data.referenceType="collapsed"}function Z(U){const J=this.resume(),le=this.stack[this.stack.length-1];le.label=J,le.identifier=Mr(this.sliceSerialize(U)).toLowerCase(),this.data.referenceType="full"}function D(U){this.data.characterReferenceType=U.type}function X(U){const J=this.sliceSerialize(U),le=this.data.characterReferenceType;let ae;le?(ae=Fm(J,le==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ae=$h(J);const Ee=this.stack[this.stack.length-1];Ee.value+=ae}function V(U){const J=this.stack.pop();J.position.end=vn(U.end)}function H(U){v.call(this,U);const J=this.stack[this.stack.length-1];J.url=this.sliceSerialize(U)}function Y(U){v.call(this,U);const J=this.stack[this.stack.length-1];J.url="mailto:"+this.sliceSerialize(U)}function Q(){return{type:"blockquote",children:[]}}function se(){return{type:"code",lang:null,meta:null,value:""}}function _e(){return{type:"inlineCode",value:""}}function Te(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Me(){return{type:"emphasis",children:[]}}function Ae(){return{type:"heading",depth:0,children:[]}}function ut(){return{type:"break"}}function Xe(){return{type:"html",value:""}}function ht(){return{type:"image",title:null,url:"",alt:null}}function Mt(){return{type:"link",title:null,url:"",children:[]}}function tt(U){return{type:"list",ordered:U.type==="listOrdered",start:null,spread:U._spread,children:[]}}function ot(U){return{type:"listItem",spread:U._spread,checked:null,children:[]}}function Gt(){return{type:"paragraph",children:[]}}function mt(){return{type:"strong",children:[]}}function Yt(){return{type:"text",value:""}}function kt(){return{type:"thematicBreak"}}}function vn(e){return{line:e.line,column:e.column,offset:e.offset}}function Km(e,t){let r=-1;for(;++r<t.length;){const n=t[r];Array.isArray(n)?Km(e,n):R2(e,n)}}function R2(e,t){let r;for(r in t)if(Xm.call(t,r))switch(r){case"canContainEols":{const n=t[r];n&&e[r].push(...n);break}case"transforms":{const n=t[r];n&&e[r].push(...n);break}case"enter":case"exit":{const n=t[r];n&&Object.assign(e[r],n);break}}}function vf(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+qi({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+qi({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+qi({start:t.start,end:t.end})+") is still open")}function P2(e){const t=this;t.parser=r;function r(n){return D2(n,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function F2(e,t){const r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,r),e.applyData(t,r)}function O2(e,t){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,r),[e.applyData(t,r),{type:"text",value:`
111
+ `}]}function z2(e,t){const r=t.value?t.value+`
112
+ `:"",n={};t.lang&&(n.className=["language-"+t.lang]);let s={type:"element",tagName:"code",properties:n,children:[{type:"text",value:r}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s=e.applyData(t,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(t,s),s}function W2(e,t){const r={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function H2(e,t){const r={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function q2(e,t){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=String(t.identifier).toUpperCase(),s=ni(n.toLowerCase()),i=e.footnoteOrder.indexOf(n);let a,o=e.footnoteCounts.get(n);o===void 0?(o=0,e.footnoteOrder.push(n),a=e.footnoteOrder.length):a=i+1,o+=1,e.footnoteCounts.set(n,o);const l={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+s,id:r+"fnref-"+s+(o>1?"-"+o:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};e.patch(t,l);const c={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,c),e.applyData(t,c)}function U2(e,t){const r={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function V2(e,t){if(e.options.allowDangerousHtml){const r={type:"raw",value:t.value};return e.patch(t,r),e.applyData(t,r)}}function Qm(e,t){const r=t.referenceType;let n="]";if(r==="collapsed"?n+="[]":r==="full"&&(n+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+n}];const s=e.all(t),i=s[0];i&&i.type==="text"?i.value="["+i.value:s.unshift({type:"text",value:"["});const a=s[s.length-1];return a&&a.type==="text"?a.value+=n:s.push({type:"text",value:n}),s}function G2(e,t){const r=String(t.identifier).toUpperCase(),n=e.definitionById.get(r);if(!n)return Qm(e,t);const s={src:ni(n.url||""),alt:t.alt};n.title!==null&&n.title!==void 0&&(s.title=n.title);const i={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,i),e.applyData(t,i)}function Y2(e,t){const r={src:ni(t.url)};t.alt!==null&&t.alt!==void 0&&(r.alt=t.alt),t.title!==null&&t.title!==void 0&&(r.title=t.title);const n={type:"element",tagName:"img",properties:r,children:[]};return e.patch(t,n),e.applyData(t,n)}function X2(e,t){const r={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,r);const n={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(t,n),e.applyData(t,n)}function K2(e,t){const r=String(t.identifier).toUpperCase(),n=e.definitionById.get(r);if(!n)return Qm(e,t);const s={href:ni(n.url||"")};n.title!==null&&n.title!==void 0&&(s.title=n.title);const i={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function Q2(e,t){const r={href:ni(t.url)};t.title!==null&&t.title!==void 0&&(r.title=t.title);const n={type:"element",tagName:"a",properties:r,children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Z2(e,t,r){const n=e.all(t),s=r?J2(r):Zm(t),i={},a=[];if(typeof t.checked=="boolean"){const u=n[0];let h;u&&u.type==="element"&&u.tagName==="p"?h=u:(h={type:"element",tagName:"p",properties:{},children:[]},n.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let o=-1;for(;++o<n.length;){const u=n[o];(s||o!==0||u.type!=="element"||u.tagName!=="p")&&a.push({type:"text",value:`
113
+ `}),u.type==="element"&&u.tagName==="p"&&!s?a.push(...u.children):a.push(u)}const l=n[n.length-1];l&&(s||l.type!=="element"||l.tagName!=="p")&&a.push({type:"text",value:`
114
+ `});const c={type:"element",tagName:"li",properties:i,children:a};return e.patch(t,c),e.applyData(t,c)}function J2(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const r=e.children;let n=-1;for(;!t&&++n<r.length;)t=Zm(r[n])}return t}function Zm(e){const t=e.spread;return t??e.children.length>1}function e_(e,t){const r={},n=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(r.start=t.start);++s<n.length;){const a=n[s];if(a.type==="element"&&a.tagName==="li"&&a.properties&&Array.isArray(a.properties.className)&&a.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const i={type:"element",tagName:t.ordered?"ol":"ul",properties:r,children:e.wrap(n,!0)};return e.patch(t,i),e.applyData(t,i)}function t_(e,t){const r={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function r_(e,t){const r={type:"root",children:e.wrap(e.all(t))};return e.patch(t,r),e.applyData(t,r)}function n_(e,t){const r={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function s_(e,t){const r=e.all(t),n=r.shift(),s=[];if(n){const a={type:"element",tagName:"thead",properties:{},children:e.wrap([n],!0)};e.patch(t.children[0],a),s.push(a)}if(r.length>0){const a={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},o=Ah(t.children[1]),l=jm(t.children[t.children.length-1]);o&&l&&(a.position={start:o,end:l}),s.push(a)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,i),e.applyData(t,i)}function i_(e,t,r){const n=r?r.children:void 0,i=(n?n.indexOf(t):1)===0?"th":"td",a=r&&r.type==="table"?r.align:void 0,o=a?a.length:t.children.length;let l=-1;const c=[];for(;++l<o;){const h=t.children[l],f={},g=a?a[l]:void 0;g&&(f.align=g);let p={type:"element",tagName:i,properties:f,children:[]};h&&(p.children=e.all(h),e.patch(h,p),p=e.applyData(h,p)),c.push(p)}const u={type:"element",tagName:"tr",properties:{},children:e.wrap(c,!0)};return e.patch(t,u),e.applyData(t,u)}function a_(e,t){const r={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}const Cf=9,Sf=32;function o_(e){const t=String(e),r=/\r?\n|\r/g;let n=r.exec(t),s=0;const i=[];for(;n;)i.push(_f(t.slice(s,n.index),s>0,!0),n[0]),s=n.index+n[0].length,n=r.exec(t);return i.push(_f(t.slice(s),s>0,!1)),i.join("")}function _f(e,t,r){let n=0,s=e.length;if(t){let i=e.codePointAt(n);for(;i===Cf||i===Sf;)n++,i=e.codePointAt(n)}if(r){let i=e.codePointAt(s-1);for(;i===Cf||i===Sf;)s--,i=e.codePointAt(s-1)}return s>n?e.slice(n,s):""}function l_(e,t){const r={type:"text",value:o_(String(t.value))};return e.patch(t,r),e.applyData(t,r)}function c_(e,t){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,r),e.applyData(t,r)}const u_={blockquote:F2,break:O2,code:z2,delete:W2,emphasis:H2,footnoteReference:q2,heading:U2,html:V2,imageReference:G2,image:Y2,inlineCode:X2,linkReference:K2,link:Q2,listItem:Z2,list:e_,paragraph:t_,root:r_,strong:n_,table:s_,tableCell:a_,tableRow:i_,text:l_,thematicBreak:c_,toml:Fa,yaml:Fa,definition:Fa,footnoteDefinition:Fa};function Fa(){}const Jm=-1,fl=0,Vi=1,vo=2,Bh=3,Rh=4,Ph=5,Fh=6,e0=7,t0=8,Tf=typeof self=="object"?self:globalThis,h_=(e,t)=>{const r=(s,i)=>(e.set(i,s),s),n=s=>{if(e.has(s))return e.get(s);const[i,a]=t[s];switch(i){case fl:case Jm:return r(a,s);case Vi:{const o=r([],s);for(const l of a)o.push(n(l));return o}case vo:{const o=r({},s);for(const[l,c]of a)o[n(l)]=n(c);return o}case Bh:return r(new Date(a),s);case Rh:{const{source:o,flags:l}=a;return r(new RegExp(o,l),s)}case Ph:{const o=r(new Map,s);for(const[l,c]of a)o.set(n(l),n(c));return o}case Fh:{const o=r(new Set,s);for(const l of a)o.add(n(l));return o}case e0:{const{name:o,message:l}=a;return r(new Tf[o](l),s)}case t0:return r(BigInt(a),s);case"BigInt":return r(Object(BigInt(a)),s);case"ArrayBuffer":return r(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:o}=new Uint8Array(a);return r(new DataView(o),a)}}return r(new Tf[i](a),s)};return n},Nf=e=>h_(new Map,e)(0),Ts="",{toString:d_}={},{keys:f_}=Object,yi=e=>{const t=typeof e;if(t!=="object"||!e)return[fl,t];const r=d_.call(e).slice(8,-1);switch(r){case"Array":return[Vi,Ts];case"Object":return[vo,Ts];case"Date":return[Bh,Ts];case"RegExp":return[Rh,Ts];case"Map":return[Ph,Ts];case"Set":return[Fh,Ts];case"DataView":return[Vi,r]}return r.includes("Array")?[Vi,r]:r.includes("Error")?[e0,r]:[vo,r]},Oa=([e,t])=>e===fl&&(t==="function"||t==="symbol"),g_=(e,t,r,n)=>{const s=(a,o)=>{const l=n.push(a)-1;return r.set(o,l),l},i=a=>{if(r.has(a))return r.get(a);let[o,l]=yi(a);switch(o){case fl:{let u=a;switch(l){case"bigint":o=t0,u=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);u=null;break;case"undefined":return s([Jm],a)}return s([o,u],a)}case Vi:{if(l){let f=a;return l==="DataView"?f=new Uint8Array(a.buffer):l==="ArrayBuffer"&&(f=new Uint8Array(a)),s([l,[...f]],a)}const u=[],h=s([o,u],a);for(const f of a)u.push(i(f));return h}case vo:{if(l)switch(l){case"BigInt":return s([l,a.toString()],a);case"Boolean":case"Number":case"String":return s([l,a.valueOf()],a)}if(t&&"toJSON"in a)return i(a.toJSON());const u=[],h=s([o,u],a);for(const f of f_(a))(e||!Oa(yi(a[f])))&&u.push([i(f),i(a[f])]);return h}case Bh:return s([o,a.toISOString()],a);case Rh:{const{source:u,flags:h}=a;return s([o,{source:u,flags:h}],a)}case Ph:{const u=[],h=s([o,u],a);for(const[f,g]of a)(e||!(Oa(yi(f))||Oa(yi(g))))&&u.push([i(f),i(g)]);return h}case Fh:{const u=[],h=s([o,u],a);for(const f of a)(e||!Oa(yi(f)))&&u.push(i(f));return h}}const{message:c}=a;return s([o,{name:l,message:c}],a)};return i},Ef=(e,{json:t,lossy:r}={})=>{const n=[];return g_(!(t||r),!!t,new Map,n)(e),n},Co=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Nf(Ef(e,t)):structuredClone(e):(e,t)=>Nf(Ef(e,t));function p_(e,t){const r=[{type:"text",value:"↩"}];return t>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),r}function m_(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function x_(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||p_,n=e.options.footnoteBackLabel||m_,s=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",a=e.options.footnoteLabelProperties||{className:["sr-only"]},o=[];let l=-1;for(;++l<e.footnoteOrder.length;){const c=e.footnoteById.get(e.footnoteOrder[l]);if(!c)continue;const u=e.all(c),h=String(c.identifier).toUpperCase(),f=ni(h.toLowerCase());let g=0;const p=[],m=e.footnoteCounts.get(h);for(;m!==void 0&&++g<=m;){p.length>0&&p.push({type:"text",value:" "});let k=typeof r=="string"?r:r(l,g);typeof k=="string"&&(k={type:"text",value:k}),p.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+f+(g>1?"-"+g:""),dataFootnoteBackref:"",ariaLabel:typeof n=="string"?n:n(l,g),className:["data-footnote-backref"]},children:Array.isArray(k)?k:[k]})}const y=u[u.length-1];if(y&&y.type==="element"&&y.tagName==="p"){const k=y.children[y.children.length-1];k&&k.type==="text"?k.value+=" ":y.children.push({type:"text",value:" "}),y.children.push(...p)}else u.push(...p);const x={type:"element",tagName:"li",properties:{id:t+"fn-"+f},children:e.wrap(u,!0)};e.patch(c,x),o.push(x)}if(o.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...Co(a),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
115
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(o,!0)},{type:"text",value:`
116
+ `}]}}const gl=(function(e){if(e==null)return w_;if(typeof e=="function")return pl(e);if(typeof e=="object")return Array.isArray(e)?y_(e):b_(e);if(typeof e=="string")return k_(e);throw new Error("Expected function, string, or object as test")});function y_(e){const t=[];let r=-1;for(;++r<e.length;)t[r]=gl(e[r]);return pl(n);function n(...s){let i=-1;for(;++i<t.length;)if(t[i].apply(this,s))return!0;return!1}}function b_(e){const t=e;return pl(r);function r(n){const s=n;let i;for(i in e)if(s[i]!==t[i])return!1;return!0}}function k_(e){return pl(t);function t(r){return r&&r.type===e}}function pl(e){return t;function t(r,n,s){return!!(v_(r)&&e.call(this,r,typeof n=="number"?n:void 0,s||void 0))}}function w_(){return!0}function v_(e){return e!==null&&typeof e=="object"&&"type"in e}const r0=[],C_=!0,lu=!1,S_="skip";function n0(e,t,r,n){let s;typeof t=="function"&&typeof r!="function"?(n=r,r=t):s=t;const i=gl(s),a=n?-1:1;o(e,void 0,[])();function o(l,c,u){const h=l&&typeof l=="object"?l:{};if(typeof h.type=="string"){const g=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(l.type+(g?"<"+g+">":""))+")"})}return f;function f(){let g=r0,p,m,y;if((!t||i(l,c,u[u.length-1]||void 0))&&(g=__(r(l,u)),g[0]===lu))return g;if("children"in l&&l.children){const x=l;if(x.children&&g[0]!==S_)for(m=(n?x.children.length:-1)+a,y=u.concat(x);m>-1&&m<x.children.length;){const k=x.children[m];if(p=o(k,m,y)(),p[0]===lu)return p;m=typeof p[1]=="number"?p[1]:m+a}}return g}}}function __(e){return Array.isArray(e)?e:typeof e=="number"?[C_,e]:e==null?r0:[e]}function Oh(e,t,r,n){let s,i,a;typeof t=="function"&&typeof r!="function"?(i=void 0,a=t,s=r):(i=t,a=r,s=n),n0(e,i,o,s);function o(l,c){const u=c[c.length-1],h=u?u.children.indexOf(l):void 0;return a(l,h,u)}}const cu={}.hasOwnProperty,T_={};function N_(e,t){const r=t||T_,n=new Map,s=new Map,i=new Map,a={...u_,...r.handlers},o={all:c,applyData:A_,definitionById:n,footnoteById:s,footnoteCounts:i,footnoteOrder:[],handlers:a,one:l,options:r,patch:E_,wrap:j_};return Oh(e,function(u){if(u.type==="definition"||u.type==="footnoteDefinition"){const h=u.type==="definition"?n:s,f=String(u.identifier).toUpperCase();h.has(f)||h.set(f,u)}}),o;function l(u,h){const f=u.type,g=o.handlers[f];if(cu.call(o.handlers,f)&&g)return g(o,u,h);if(o.options.passThrough&&o.options.passThrough.includes(f)){if("children"in u){const{children:m,...y}=u,x=Co(y);return x.children=o.all(u),x}return Co(u)}return(o.options.unknownHandler||M_)(o,u,h)}function c(u){const h=[];if("children"in u){const f=u.children;let g=-1;for(;++g<f.length;){const p=o.one(f[g],u);if(p){if(g&&f[g-1].type==="break"&&(!Array.isArray(p)&&p.type==="text"&&(p.value=Af(p.value)),!Array.isArray(p)&&p.type==="element")){const m=p.children[0];m&&m.type==="text"&&(m.value=Af(m.value))}Array.isArray(p)?h.push(...p):h.push(p)}}}return h}}function E_(e,t){e.position&&(t.position=mC(e))}function A_(e,t){let r=t;if(e&&e.data){const n=e.data.hName,s=e.data.hChildren,i=e.data.hProperties;if(typeof n=="string")if(r.type==="element")r.tagName=n;else{const a="children"in r?r.children:[r];r={type:"element",tagName:n,properties:{},children:a}}r.type==="element"&&i&&Object.assign(r.properties,Co(i)),"children"in r&&r.children&&s!==null&&s!==void 0&&(r.children=s)}return r}function M_(e,t){const r=t.data||{},n="value"in t&&!(cu.call(r,"hProperties")||cu.call(r,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function j_(e,t){const r=[];let n=-1;for(t&&r.push({type:"text",value:`
117
+ `});++n<e.length;)n&&r.push({type:"text",value:`
118
+ `}),r.push(e[n]);return t&&e.length>0&&r.push({type:"text",value:`
119
+ `}),r}function Af(e){let t=0,r=e.charCodeAt(t);for(;r===9||r===32;)t++,r=e.charCodeAt(t);return e.slice(t)}function Mf(e,t){const r=N_(e,t),n=r.one(e,void 0),s=x_(r),i=Array.isArray(n)?{type:"root",children:n}:n||{type:"root",children:[]};return s&&i.children.push({type:"text",value:`
120
+ `},s),i}function I_(e,t){return e&&"run"in e?async function(r,n){const s=Mf(r,{file:n,...t});await e.run(s,n)}:function(r,n){return Mf(r,{file:n,...e||t})}}function jf(e){if(e)throw e}var fc,If;function L_(){if(If)return fc;If=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,r=Object.defineProperty,n=Object.getOwnPropertyDescriptor,s=function(c){return typeof Array.isArray=="function"?Array.isArray(c):t.call(c)==="[object Array]"},i=function(c){if(!c||t.call(c)!=="[object Object]")return!1;var u=e.call(c,"constructor"),h=c.constructor&&c.constructor.prototype&&e.call(c.constructor.prototype,"isPrototypeOf");if(c.constructor&&!u&&!h)return!1;var f;for(f in c);return typeof f>"u"||e.call(c,f)},a=function(c,u){r&&u.name==="__proto__"?r(c,u.name,{enumerable:!0,configurable:!0,value:u.newValue,writable:!0}):c[u.name]=u.newValue},o=function(c,u){if(u==="__proto__")if(e.call(c,u)){if(n)return n(c,u).value}else return;return c[u]};return fc=function l(){var c,u,h,f,g,p,m=arguments[0],y=1,x=arguments.length,k=!1;for(typeof m=="boolean"&&(k=m,m=arguments[1]||{},y=2),(m==null||typeof m!="object"&&typeof m!="function")&&(m={});y<x;++y)if(c=arguments[y],c!=null)for(u in c)h=o(m,u),f=o(c,u),m!==f&&(k&&f&&(i(f)||(g=s(f)))?(g?(g=!1,p=h&&s(h)?h:[]):p=h&&i(h)?h:{},a(m,{name:u,newValue:l(k,p,f)})):typeof f<"u"&&a(m,{name:u,newValue:f}));return m},fc}var $_=L_();const gc=bh($_);function uu(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 D_(){const e=[],t={run:r,use:n};return t;function r(...s){let i=-1;const a=s.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);o(null,...s);function o(l,...c){const u=e[++i];let h=-1;if(l){a(l);return}for(;++h<s.length;)(c[h]===null||c[h]===void 0)&&(c[h]=s[h]);s=c,u?B_(u,o)(...c):a(null,...c)}}function n(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function B_(e,t){let r;return n;function n(...a){const o=e.length>a.length;let l;o&&a.push(s);try{l=e.apply(this,a)}catch(c){const u=c;if(o&&r)throw u;return s(u)}o||(l&&l.then&&typeof l.then=="function"?l.then(i,s):l instanceof Error?s(l):i(l))}function s(a,...o){r||(r=!0,t(a,...o))}function i(a){s(null,a)}}const Or={basename:R_,dirname:P_,extname:F_,join:O_,sep:"/"};function R_(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');ya(e);let r=0,n=-1,s=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(i){r=s+1;break}}else n<0&&(i=!0,n=s+1);return n<0?"":e.slice(r,n)}if(t===e)return"";let a=-1,o=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(i){r=s+1;break}}else a<0&&(i=!0,a=s+1),o>-1&&(e.codePointAt(s)===t.codePointAt(o--)?o<0&&(n=s):(o=-1,n=a));return r===n?n=a:n<0&&(n=e.length),e.slice(r,n)}function P_(e){if(ya(e),e.length===0)return".";let t=-1,r=e.length,n;for(;--r;)if(e.codePointAt(r)===47){if(n){t=r;break}}else n||(n=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function F_(e){ya(e);let t=e.length,r=-1,n=0,s=-1,i=0,a;for(;t--;){const o=e.codePointAt(t);if(o===47){if(a){n=t+1;break}continue}r<0&&(a=!0,r=t+1),o===46?s<0?s=t:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||r<0||i===0||i===1&&s===r-1&&s===n+1?"":e.slice(s,r)}function O_(...e){let t=-1,r;for(;++t<e.length;)ya(e[t]),e[t]&&(r=r===void 0?e[t]:r+"/"+e[t]);return r===void 0?".":z_(r)}function z_(e){ya(e);const t=e.codePointAt(0)===47;let r=W_(e,!t);return r.length===0&&!t&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),t?"/"+r:r}function W_(e,t){let r="",n=0,s=-1,i=0,a=-1,o,l;for(;++a<=e.length;){if(a<e.length)o=e.codePointAt(a);else{if(o===47)break;o=47}if(o===47){if(!(s===a-1||i===1))if(s!==a-1&&i===2){if(r.length<2||n!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(l=r.lastIndexOf("/"),l!==r.length-1){l<0?(r="",n=0):(r=r.slice(0,l),n=r.length-1-r.lastIndexOf("/")),s=a,i=0;continue}}else if(r.length>0){r="",n=0,s=a,i=0;continue}}t&&(r=r.length>0?r+"/..":"..",n=2)}else r.length>0?r+="/"+e.slice(s+1,a):r=e.slice(s+1,a),n=a-s-1;s=a,i=0}else o===46&&i>-1?i++:i=-1}return r}function ya(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const H_={cwd:q_};function q_(){return"/"}function hu(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function U_(e){if(typeof e=="string")e=new URL(e);else if(!hu(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 V_(e)}function V_(e){if(e.hostname!==""){const n=new TypeError('File URL host must be "localhost" or empty on darwin');throw n.code="ERR_INVALID_FILE_URL_HOST",n}const t=e.pathname;let r=-1;for(;++r<t.length;)if(t.codePointAt(r)===37&&t.codePointAt(r+1)===50){const n=t.codePointAt(r+2);if(n===70||n===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(t)}const pc=["history","path","basename","stem","extname","dirname"];class s0{constructor(t){let r;t?hu(t)?r={path:t}:typeof t=="string"||G_(t)?r={value:t}:r=t:r={},this.cwd="cwd"in r?"":H_.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<pc.length;){const i=pc[n];i in r&&r[i]!==void 0&&r[i]!==null&&(this[i]=i==="history"?[...r[i]]:r[i])}let s;for(s in r)pc.includes(s)||(this[s]=r[s])}get basename(){return typeof this.path=="string"?Or.basename(this.path):void 0}set basename(t){xc(t,"basename"),mc(t,"basename"),this.path=Or.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Or.dirname(this.path):void 0}set dirname(t){Lf(this.basename,"dirname"),this.path=Or.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Or.extname(this.path):void 0}set extname(t){if(mc(t,"extname"),Lf(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=Or.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){hu(t)&&(t=U_(t)),xc(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Or.basename(this.path,this.extname):void 0}set stem(t){xc(t,"stem"),mc(t,"stem"),this.path=Or.join(this.dirname||"",t+(this.extname||""))}fail(t,r,n){const s=this.message(t,r,n);throw s.fatal=!0,s}info(t,r,n){const s=this.message(t,r,n);return s.fatal=void 0,s}message(t,r,n){const s=new Rt(t,r,n);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function mc(e,t){if(e&&e.includes(Or.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Or.sep+"`")}function xc(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Lf(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function G_(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Y_=(function(e){const n=this.constructor.prototype,s=n[e],i=function(){return s.apply(i,arguments)};return Object.setPrototypeOf(i,n),i}),X_={}.hasOwnProperty;class zh extends Y_{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=D_()}copy(){const t=new zh;let r=-1;for(;++r<this.attachers.length;){const n=this.attachers[r];t.use(...n)}return t.data(gc(!0,{},this.namespace)),t}data(t,r){return typeof t=="string"?arguments.length===2?(kc("data",this.frozen),this.namespace[t]=r,this):X_.call(this.namespace,t)&&this.namespace[t]||void 0:t?(kc("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[r,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);const s=r.call(t,...n);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const r=za(t),n=this.parser||this.Parser;return yc("parse",n),n(String(r),r)}process(t,r){const n=this;return this.freeze(),yc("process",this.parser||this.Parser),bc("process",this.compiler||this.Compiler),r?s(void 0,r):new Promise(s);function s(i,a){const o=za(t),l=n.parse(o);n.run(l,o,function(u,h,f){if(u||!h||!f)return c(u);const g=h,p=n.stringify(g,f);Z_(p)?f.value=p:f.result=p,c(u,f)});function c(u,h){u||!h?a(u):i?i(h):r(void 0,h)}}}processSync(t){let r=!1,n;return this.freeze(),yc("processSync",this.parser||this.Parser),bc("processSync",this.compiler||this.Compiler),this.process(t,s),Df("processSync","process",r),n;function s(i,a){r=!0,jf(i),n=a}}run(t,r,n){$f(t),this.freeze();const s=this.transformers;return!n&&typeof r=="function"&&(n=r,r=void 0),n?i(void 0,n):new Promise(i);function i(a,o){const l=za(r);s.run(t,l,c);function c(u,h,f){const g=h||t;u?o(u):a?a(g):n(void 0,g,f)}}}runSync(t,r){let n=!1,s;return this.run(t,r,i),Df("runSync","run",n),s;function i(a,o){jf(a),s=o,n=!0}}stringify(t,r){this.freeze();const n=za(r),s=this.compiler||this.Compiler;return bc("stringify",s),$f(t),s(t,n)}use(t,...r){const n=this.attachers,s=this.namespace;if(kc("use",this.frozen),t!=null)if(typeof t=="function")l(t,r);else if(typeof t=="object")Array.isArray(t)?o(t):a(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(c){if(typeof c=="function")l(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[u,...h]=c;l(u,h)}else a(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function a(c){if(!("plugins"in c)&&!("settings"in c))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(c.plugins),c.settings&&(s.settings=gc(!0,s.settings,c.settings))}function o(c){let u=-1;if(c!=null)if(Array.isArray(c))for(;++u<c.length;){const h=c[u];i(h)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,u){let h=-1,f=-1;for(;++h<n.length;)if(n[h][0]===c){f=h;break}if(f===-1)n.push([c,...u]);else if(u.length>0){let[g,...p]=u;const m=n[f][1];uu(m)&&uu(g)&&(g=gc(!0,m,g)),n[f]=[c,g,...p]}}}}const K_=new zh().freeze();function yc(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function bc(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function kc(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 $f(e){if(!uu(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Df(e,t,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function za(e){return Q_(e)?e:new s0(e)}function Q_(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Z_(e){return typeof e=="string"||J_(e)}function J_(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const eT="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Bf=[],Rf={allowDangerousHtml:!0},tT=/^(https?|ircs?|mailto|xmpp)$/i,rT=[{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 nT(e){const t=sT(e),r=iT(e);return aT(t.runSync(t.parse(r),r),e)}function sT(e){const t=e.rehypePlugins||Bf,r=e.remarkPlugins||Bf,n=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Rf}:Rf;return K_().use(P2).use(r).use(I_,n).use(t)}function iT(e){const t=e.children||"",r=new s0;return typeof t=="string"&&(r.value=t),r}function aT(e,t){const r=t.allowedElements,n=t.allowElement,s=t.components,i=t.disallowedElements,a=t.skipHtml,o=t.unwrapDisallowed,l=t.urlTransform||oT;for(const u of rT)Object.hasOwn(t,u.from)&&(""+u.from+(u.to?"use `"+u.to+"` instead":"remove it")+eT+u.id,void 0);return Oh(e,c),wC(e,{Fragment:d.Fragment,components:s,ignoreInvalidStyle:!0,jsx:d.jsx,jsxs:d.jsxs,passKeys:!0,passNode:!0});function c(u,h,f){if(u.type==="raw"&&f&&typeof h=="number")return a?f.children.splice(h,1):f.children[h]={type:"text",value:u.value},h;if(u.type==="element"){let g;for(g in uc)if(Object.hasOwn(uc,g)&&Object.hasOwn(u.properties,g)){const p=u.properties[g],m=uc[g];(m===null||m.includes(u.tagName))&&(u.properties[g]=l(String(p||""),g,u))}}if(u.type==="element"){let g=r?!r.includes(u.tagName):i?i.includes(u.tagName):!1;if(!g&&n&&typeof h=="number"&&(g=!n(u,h,f)),g&&f&&typeof h=="number")return o&&u.children?f.children.splice(h,1,...u.children):f.children.splice(h,1),h}}}function oT(e){const t=e.indexOf(":"),r=e.indexOf("?"),n=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||r!==-1&&t>r||n!==-1&&t>n||tT.test(e.slice(0,t))?e:""}function Pf(e,t){const r=String(e);if(typeof t!="string")throw new TypeError("Expected character");let n=0,s=r.indexOf(t);for(;s!==-1;)n++,s=r.indexOf(t,s+t.length);return n}function lT(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function cT(e,t,r){const s=gl((r||{}).ignore||[]),i=uT(t);let a=-1;for(;++a<i.length;)n0(e,"text",o);function o(c,u){let h=-1,f;for(;++h<u.length;){const g=u[h],p=f?f.children:void 0;if(s(g,p?p.indexOf(g):void 0,f))return;f=g}if(f)return l(c,u)}function l(c,u){const h=u[u.length-1],f=i[a][0],g=i[a][1];let p=0;const y=h.children.indexOf(c);let x=!1,k=[];f.lastIndex=0;let C=f.exec(c.value);for(;C;){const T=C.index,S={index:C.index,input:C.input,stack:[...u,c]};let w=g(...C,S);if(typeof w=="string"&&(w=w.length>0?{type:"text",value:w}:void 0),w===!1?f.lastIndex=T+1:(p!==T&&k.push({type:"text",value:c.value.slice(p,T)}),Array.isArray(w)?k.push(...w):w&&k.push(w),p=T+C[0].length,x=!0),!f.global)break;C=f.exec(c.value)}return x?(p<c.value.length&&k.push({type:"text",value:c.value.slice(p)}),h.children.splice(y,1,...k)):k=[c],y+k.length}}function uT(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const r=!e[0]||Array.isArray(e[0])?e:[e];let n=-1;for(;++n<r.length;){const s=r[n];t.push([hT(s[0]),dT(s[1])])}return t}function hT(e){return typeof e=="string"?new RegExp(lT(e),"g"):e}function dT(e){return typeof e=="function"?e:function(){return e}}const wc="phrasing",vc=["autolink","link","image","label"];function fT(){return{transforms:[kT],enter:{literalAutolink:pT,literalAutolinkEmail:Cc,literalAutolinkHttp:Cc,literalAutolinkWww:Cc},exit:{literalAutolink:bT,literalAutolinkEmail:yT,literalAutolinkHttp:mT,literalAutolinkWww:xT}}}function gT(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:wc,notInConstruct:vc},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:wc,notInConstruct:vc},{character:":",before:"[ps]",after:"\\/",inConstruct:wc,notInConstruct:vc}]}}function pT(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Cc(e){this.config.enter.autolinkProtocol.call(this,e)}function mT(e){this.config.exit.autolinkProtocol.call(this,e)}function xT(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 yT(e){this.config.exit.autolinkEmail.call(this,e)}function bT(e){this.exit(e)}function kT(e){cT(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,wT],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),vT]],{ignore:["link","linkReference"]})}function wT(e,t,r,n,s){let i="";if(!i0(s)||(/^w/i.test(t)&&(r=t+r,t="",i="http://"),!CT(r)))return!1;const a=ST(r+n);if(!a[0])return!1;const o={type:"link",title:null,url:i+t+a[0],children:[{type:"text",value:t+a[0]}]};return a[1]?[o,{type:"text",value:a[1]}]:o}function vT(e,t,r,n){return!i0(n,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+r,children:[{type:"text",value:t+"@"+r}]}}function CT(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 ST(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let r=t[0],n=r.indexOf(")");const s=Pf(e,"(");let i=Pf(e,")");for(;n!==-1&&s>i;)e+=r.slice(0,n+1),r=r.slice(n+1),n=r.indexOf(")"),i++;return[e,r]}function i0(e,t){const r=e.input.charCodeAt(e.index-1);return(e.index===0||ns(r)||hl(r))&&(!t||r!==47)}a0.peek=LT;function _T(){this.buffer()}function TT(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function NT(){this.buffer()}function ET(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function AT(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Mr(this.sliceSerialize(e)).toLowerCase(),r.label=t}function MT(e){this.exit(e)}function jT(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Mr(this.sliceSerialize(e)).toLowerCase(),r.label=t}function IT(e){this.exit(e)}function LT(){return"["}function a0(e,t,r,n){const s=r.createTracker(n);let i=s.move("[^");const a=r.enter("footnoteReference"),o=r.enter("reference");return i+=s.move(r.safe(r.associationId(e),{after:"]",before:i})),o(),a(),i+=s.move("]"),i}function $T(){return{enter:{gfmFootnoteCallString:_T,gfmFootnoteCall:TT,gfmFootnoteDefinitionLabelString:NT,gfmFootnoteDefinition:ET},exit:{gfmFootnoteCallString:AT,gfmFootnoteCall:MT,gfmFootnoteDefinitionLabelString:jT,gfmFootnoteDefinition:IT}}}function DT(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:r,footnoteReference:a0},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(n,s,i,a){const o=i.createTracker(a);let l=o.move("[^");const c=i.enter("footnoteDefinition"),u=i.enter("label");return l+=o.move(i.safe(i.associationId(n),{before:l,after:"]"})),u(),l+=o.move("]:"),n.children&&n.children.length>0&&(o.shift(4),l+=o.move((t?`
121
+ `:" ")+i.indentLines(i.containerFlow(n,o.current()),t?o0:BT))),c(),l}}function BT(e,t,r){return t===0?e:o0(e,t,r)}function o0(e,t,r){return(r?"":" ")+e}const RT=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];l0.peek=WT;function PT(){return{canContainEols:["delete"],enter:{strikethrough:OT},exit:{strikethrough:zT}}}function FT(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:RT}],handlers:{delete:l0}}}function OT(e){this.enter({type:"delete",children:[]},e)}function zT(e){this.exit(e)}function l0(e,t,r,n){const s=r.createTracker(n),i=r.enter("strikethrough");let a=s.move("~~");return a+=r.containerPhrasing(e,{...s.current(),before:a,after:"~"}),a+=s.move("~~"),i(),a}function WT(){return"~"}function HT(e){return e.length}function qT(e,t){const r=t||{},n=(r.align||[]).concat(),s=r.stringLength||HT,i=[],a=[],o=[],l=[];let c=0,u=-1;for(;++u<e.length;){const m=[],y=[];let x=-1;for(e[u].length>c&&(c=e[u].length);++x<e[u].length;){const k=UT(e[u][x]);if(r.alignDelimiters!==!1){const C=s(k);y[x]=C,(l[x]===void 0||C>l[x])&&(l[x]=C)}m.push(k)}a[u]=m,o[u]=y}let h=-1;if(typeof n=="object"&&"length"in n)for(;++h<c;)i[h]=Ff(n[h]);else{const m=Ff(n);for(;++h<c;)i[h]=m}h=-1;const f=[],g=[];for(;++h<c;){const m=i[h];let y="",x="";m===99?(y=":",x=":"):m===108?y=":":m===114&&(x=":");let k=r.alignDelimiters===!1?1:Math.max(1,l[h]-y.length-x.length);const C=y+"-".repeat(k)+x;r.alignDelimiters!==!1&&(k=y.length+k+x.length,k>l[h]&&(l[h]=k),g[h]=k),f[h]=C}a.splice(1,0,f),o.splice(1,0,g),u=-1;const p=[];for(;++u<a.length;){const m=a[u],y=o[u];h=-1;const x=[];for(;++h<c;){const k=m[h]||"";let C="",T="";if(r.alignDelimiters!==!1){const S=l[h]-(y[h]||0),w=i[h];w===114?C=" ".repeat(S):w===99?S%2?(C=" ".repeat(S/2+.5),T=" ".repeat(S/2-.5)):(C=" ".repeat(S/2),T=C):T=" ".repeat(S)}r.delimiterStart!==!1&&!h&&x.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&k==="")&&(r.delimiterStart!==!1||h)&&x.push(" "),r.alignDelimiters!==!1&&x.push(C),x.push(k),r.alignDelimiters!==!1&&x.push(T),r.padding!==!1&&x.push(" "),(r.delimiterEnd!==!1||h!==c-1)&&x.push("|")}p.push(r.delimiterEnd===!1?x.join("").replace(/ +$/,""):x.join(""))}return p.join(`
122
+ `)}function UT(e){return e==null?"":String(e)}function Ff(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 VT(e,t,r,n){const s=r.enter("blockquote"),i=r.createTracker(n);i.move("> "),i.shift(2);const a=r.indentLines(r.containerFlow(e,i.current()),GT);return s(),a}function GT(e,t,r){return">"+(r?"":" ")+e}function YT(e,t){return Of(e,t.inConstruct,!0)&&!Of(e,t.notInConstruct,!1)}function Of(e,t,r){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return r;let n=-1;for(;++n<t.length;)if(e.includes(t[n]))return!0;return!1}function zf(e,t,r,n){let s=-1;for(;++s<r.unsafe.length;)if(r.unsafe[s].character===`
123
+ `&&YT(r.stack,r.unsafe[s]))return/[ \t]/.test(n.before)?"":" ";return`\\
124
+ `}function XT(e,t){const r=String(e);let n=r.indexOf(t),s=n,i=0,a=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;n!==-1;)n===s?++i>a&&(a=i):i=1,s=n+t.length,n=r.indexOf(t,s);return a}function KT(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 QT(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 ZT(e,t,r,n){const s=QT(r),i=e.value||"",a=s==="`"?"GraveAccent":"Tilde";if(KT(e,r)){const h=r.enter("codeIndented"),f=r.indentLines(i,JT);return h(),f}const o=r.createTracker(n),l=s.repeat(Math.max(XT(i,s)+1,3)),c=r.enter("codeFenced");let u=o.move(l);if(e.lang){const h=r.enter(`codeFencedLang${a}`);u+=o.move(r.safe(e.lang,{before:u,after:" ",encode:["`"],...o.current()})),h()}if(e.lang&&e.meta){const h=r.enter(`codeFencedMeta${a}`);u+=o.move(" "),u+=o.move(r.safe(e.meta,{before:u,after:`
125
+ `,encode:["`"],...o.current()})),h()}return u+=o.move(`
126
+ `),i&&(u+=o.move(i+`
127
+ `)),u+=o.move(l),c(),u}function JT(e,t,r){return(r?"":" ")+e}function Wh(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 eN(e,t,r,n){const s=Wh(r),i=s==='"'?"Quote":"Apostrophe",a=r.enter("definition");let o=r.enter("label");const l=r.createTracker(n);let c=l.move("[");return c+=l.move(r.safe(r.associationId(e),{before:c,after:"]",...l.current()})),c+=l.move("]: "),o(),!e.url||/[\0- \u007F]/.test(e.url)?(o=r.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(r.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(o=r.enter("destinationRaw"),c+=l.move(r.safe(e.url,{before:c,after:e.title?" ":`
128
+ `,...l.current()}))),o(),e.title&&(o=r.enter(`title${i}`),c+=l.move(" "+s),c+=l.move(r.safe(e.title,{before:c,after:s,...l.current()})),c+=l.move(s),o()),a(),c}function tN(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 ta(e){return"&#x"+e.toString(16).toUpperCase()+";"}function So(e,t,r){const n=Vs(e),s=Vs(t);return n===void 0?s===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:n===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}c0.peek=rN;function c0(e,t,r,n){const s=tN(r),i=r.enter("emphasis"),a=r.createTracker(n),o=a.move(s);let l=a.move(r.containerPhrasing(e,{after:s,before:o,...a.current()}));const c=l.charCodeAt(0),u=So(n.before.charCodeAt(n.before.length-1),c,s);u.inside&&(l=ta(c)+l.slice(1));const h=l.charCodeAt(l.length-1),f=So(n.after.charCodeAt(0),h,s);f.inside&&(l=l.slice(0,-1)+ta(h));const g=a.move(s);return i(),r.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},o+l+g}function rN(e,t,r){return r.options.emphasis||"*"}function nN(e,t){let r=!1;return Oh(e,function(n){if("value"in n&&/\r?\n|\r/.test(n.value)||n.type==="break")return r=!0,lu}),!!((!e.depth||e.depth<3)&&Lh(e)&&(t.options.setext||r))}function sN(e,t,r,n){const s=Math.max(Math.min(6,e.depth||1),1),i=r.createTracker(n);if(nN(e,r)){const u=r.enter("headingSetext"),h=r.enter("phrasing"),f=r.containerPhrasing(e,{...i.current(),before:`
129
+ `,after:`
130
+ `});return h(),u(),f+`
131
+ `+(s===1?"=":"-").repeat(f.length-(Math.max(f.lastIndexOf("\r"),f.lastIndexOf(`
132
+ `))+1))}const a="#".repeat(s),o=r.enter("headingAtx"),l=r.enter("phrasing");i.move(a+" ");let c=r.containerPhrasing(e,{before:"# ",after:`
133
+ `,...i.current()});return/^[\t ]/.test(c)&&(c=ta(c.charCodeAt(0))+c.slice(1)),c=c?a+" "+c:a,r.options.closeAtx&&(c+=" "+a),l(),o(),c}u0.peek=iN;function u0(e){return e.value||""}function iN(){return"<"}h0.peek=aN;function h0(e,t,r,n){const s=Wh(r),i=s==='"'?"Quote":"Apostrophe",a=r.enter("image");let o=r.enter("label");const l=r.createTracker(n);let c=l.move("![");return c+=l.move(r.safe(e.alt,{before:c,after:"]",...l.current()})),c+=l.move("]("),o(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(o=r.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(r.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(o=r.enter("destinationRaw"),c+=l.move(r.safe(e.url,{before:c,after:e.title?" ":")",...l.current()}))),o(),e.title&&(o=r.enter(`title${i}`),c+=l.move(" "+s),c+=l.move(r.safe(e.title,{before:c,after:s,...l.current()})),c+=l.move(s),o()),c+=l.move(")"),a(),c}function aN(){return"!"}d0.peek=oN;function d0(e,t,r,n){const s=e.referenceType,i=r.enter("imageReference");let a=r.enter("label");const o=r.createTracker(n);let l=o.move("![");const c=r.safe(e.alt,{before:l,after:"]",...o.current()});l+=o.move(c+"]["),a();const u=r.stack;r.stack=[],a=r.enter("reference");const h=r.safe(r.associationId(e),{before:l,after:"]",...o.current()});return a(),r.stack=u,i(),s==="full"||!c||c!==h?l+=o.move(h+"]"):s==="shortcut"?l=l.slice(0,-1):l+=o.move("]"),l}function oN(){return"!"}f0.peek=lN;function f0(e,t,r){let n=e.value||"",s="`",i=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(n);)s+="`";for(/[^ \r\n]/.test(n)&&(/^[ \r\n]/.test(n)&&/[ \r\n]$/.test(n)||/^`|`$/.test(n))&&(n=" "+n+" ");++i<r.unsafe.length;){const a=r.unsafe[i],o=r.compilePattern(a);let l;if(a.atBreak)for(;l=o.exec(n);){let c=l.index;n.charCodeAt(c)===10&&n.charCodeAt(c-1)===13&&c--,n=n.slice(0,c)+" "+n.slice(l.index+1)}}return s+n+s}function lN(){return"`"}function g0(e,t){const r=Lh(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(r===e.url||"mailto:"+r===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}p0.peek=cN;function p0(e,t,r,n){const s=Wh(r),i=s==='"'?"Quote":"Apostrophe",a=r.createTracker(n);let o,l;if(g0(e,r)){const u=r.stack;r.stack=[],o=r.enter("autolink");let h=a.move("<");return h+=a.move(r.containerPhrasing(e,{before:h,after:">",...a.current()})),h+=a.move(">"),o(),r.stack=u,h}o=r.enter("link"),l=r.enter("label");let c=a.move("[");return c+=a.move(r.containerPhrasing(e,{before:c,after:"](",...a.current()})),c+=a.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=r.enter("destinationLiteral"),c+=a.move("<"),c+=a.move(r.safe(e.url,{before:c,after:">",...a.current()})),c+=a.move(">")):(l=r.enter("destinationRaw"),c+=a.move(r.safe(e.url,{before:c,after:e.title?" ":")",...a.current()}))),l(),e.title&&(l=r.enter(`title${i}`),c+=a.move(" "+s),c+=a.move(r.safe(e.title,{before:c,after:s,...a.current()})),c+=a.move(s),l()),c+=a.move(")"),o(),c}function cN(e,t,r){return g0(e,r)?"<":"["}m0.peek=uN;function m0(e,t,r,n){const s=e.referenceType,i=r.enter("linkReference");let a=r.enter("label");const o=r.createTracker(n);let l=o.move("[");const c=r.containerPhrasing(e,{before:l,after:"]",...o.current()});l+=o.move(c+"]["),a();const u=r.stack;r.stack=[],a=r.enter("reference");const h=r.safe(r.associationId(e),{before:l,after:"]",...o.current()});return a(),r.stack=u,i(),s==="full"||!c||c!==h?l+=o.move(h+"]"):s==="shortcut"?l=l.slice(0,-1):l+=o.move("]"),l}function uN(){return"["}function Hh(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 hN(e){const t=Hh(e),r=e.options.bulletOther;if(!r)return t==="*"?"-":"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(r===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+r+"`) to be different");return r}function dN(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 x0(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 fN(e,t,r,n){const s=r.enter("list"),i=r.bulletCurrent;let a=e.ordered?dN(r):Hh(r);const o=e.ordered?a==="."?")":".":hN(r);let l=t&&r.bulletLastUsed?a===r.bulletLastUsed:!1;if(!e.ordered){const u=e.children?e.children[0]:void 0;if((a==="*"||a==="-")&&u&&(!u.children||!u.children[0])&&r.stack[r.stack.length-1]==="list"&&r.stack[r.stack.length-2]==="listItem"&&r.stack[r.stack.length-3]==="list"&&r.stack[r.stack.length-4]==="listItem"&&r.indexStack[r.indexStack.length-1]===0&&r.indexStack[r.indexStack.length-2]===0&&r.indexStack[r.indexStack.length-3]===0&&(l=!0),x0(r)===a&&u){let h=-1;for(;++h<e.children.length;){const f=e.children[h];if(f&&f.type==="listItem"&&f.children&&f.children[0]&&f.children[0].type==="thematicBreak"){l=!0;break}}}}l&&(a=o),r.bulletCurrent=a;const c=r.containerFlow(e,n);return r.bulletLastUsed=a,r.bulletCurrent=i,s(),c}function gN(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 pN(e,t,r,n){const s=gN(r);let i=r.bulletCurrent||Hh(r);t&&t.type==="list"&&t.ordered&&(i=(typeof t.start=="number"&&t.start>-1?t.start:1)+(r.options.incrementListMarker===!1?0:t.children.indexOf(e))+i);let a=i.length+1;(s==="tab"||s==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(a=Math.ceil(a/4)*4);const o=r.createTracker(n);o.move(i+" ".repeat(a-i.length)),o.shift(a);const l=r.enter("listItem"),c=r.indentLines(r.containerFlow(e,o.current()),u);return l(),c;function u(h,f,g){return f?(g?"":" ".repeat(a))+h:(g?i:i+" ".repeat(a-i.length))+h}}function mN(e,t,r,n){const s=r.enter("paragraph"),i=r.enter("phrasing"),a=r.containerPhrasing(e,n);return i(),s(),a}const xN=gl(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function yN(e,t,r,n){return(e.children.some(function(a){return xN(a)})?r.containerPhrasing:r.containerFlow).call(r,e,n)}function bN(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}y0.peek=kN;function y0(e,t,r,n){const s=bN(r),i=r.enter("strong"),a=r.createTracker(n),o=a.move(s+s);let l=a.move(r.containerPhrasing(e,{after:s,before:o,...a.current()}));const c=l.charCodeAt(0),u=So(n.before.charCodeAt(n.before.length-1),c,s);u.inside&&(l=ta(c)+l.slice(1));const h=l.charCodeAt(l.length-1),f=So(n.after.charCodeAt(0),h,s);f.inside&&(l=l.slice(0,-1)+ta(h));const g=a.move(s+s);return i(),r.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},o+l+g}function kN(e,t,r){return r.options.strong||"*"}function wN(e,t,r,n){return r.safe(e.value,n)}function vN(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 CN(e,t,r){const n=(x0(r)+(r.options.ruleSpaces?" ":"")).repeat(vN(r));return r.options.ruleSpaces?n.slice(0,-1):n}const b0={blockquote:VT,break:zf,code:ZT,definition:eN,emphasis:c0,hardBreak:zf,heading:sN,html:u0,image:h0,imageReference:d0,inlineCode:f0,link:p0,linkReference:m0,list:fN,listItem:pN,paragraph:mN,root:yN,strong:y0,text:wN,thematicBreak:CN};function SN(){return{enter:{table:_N,tableData:Wf,tableHeader:Wf,tableRow:NN},exit:{codeText:EN,table:TN,tableData:Sc,tableHeader:Sc,tableRow:Sc}}}function _N(e){const t=e._align;this.enter({type:"table",align:t.map(function(r){return r==="none"?null:r}),children:[]},e),this.data.inTable=!0}function TN(e){this.exit(e),this.data.inTable=void 0}function NN(e){this.enter({type:"tableRow",children:[]},e)}function Sc(e){this.exit(e)}function Wf(e){this.enter({type:"tableCell",children:[]},e)}function EN(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,AN));const r=this.stack[this.stack.length-1];r.type,r.value=t,this.exit(e)}function AN(e,t){return t==="|"?t:e}function MN(e){const t=e||{},r=t.tableCellPadding,n=t.tablePipeAlign,s=t.stringLength,i=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
134
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:f,table:a,tableCell:l,tableRow:o}};function a(g,p,m,y){return c(u(g,m,y),g.align)}function o(g,p,m,y){const x=h(g,m,y),k=c([x]);return k.slice(0,k.indexOf(`
135
+ `))}function l(g,p,m,y){const x=m.enter("tableCell"),k=m.enter("phrasing"),C=m.containerPhrasing(g,{...y,before:i,after:i});return k(),x(),C}function c(g,p){return qT(g,{align:p,alignDelimiters:n,padding:r,stringLength:s})}function u(g,p,m){const y=g.children;let x=-1;const k=[],C=p.enter("table");for(;++x<y.length;)k[x]=h(y[x],p,m);return C(),k}function h(g,p,m){const y=g.children;let x=-1;const k=[],C=p.enter("tableRow");for(;++x<y.length;)k[x]=l(y[x],g,p,m);return C(),k}function f(g,p,m){let y=b0.inlineCode(g,p,m);return m.stack.includes("tableCell")&&(y=y.replace(/\|/g,"\\$&")),y}}function jN(){return{exit:{taskListCheckValueChecked:Hf,taskListCheckValueUnchecked:Hf,paragraph:LN}}}function IN(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:$N}}}function Hf(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function LN(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const r=this.stack[this.stack.length-1];r.type;const n=r.children[0];if(n&&n.type==="text"){const s=t.children;let i=-1,a;for(;++i<s.length;){const o=s[i];if(o.type==="paragraph"){a=o;break}}a===r&&(n.value=n.value.slice(1),n.value.length===0?r.children.shift():r.position&&n.position&&typeof n.position.start.offset=="number"&&(n.position.start.column++,n.position.start.offset++,r.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function $N(e,t,r,n){const s=e.children[0],i=typeof e.checked=="boolean"&&s&&s.type==="paragraph",a="["+(e.checked?"x":" ")+"] ",o=r.createTracker(n);i&&o.move(a);let l=b0.listItem(e,t,r,{...n,...o.current()});return i&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,c)),l;function c(u){return u+a}}function DN(){return[fT(),$T(),PT(),SN(),jN()]}function BN(e){return{extensions:[gT(),DT(e),FT(),MN(e),IN()]}}const RN={tokenize:HN,partial:!0},k0={tokenize:qN,partial:!0},w0={tokenize:UN,partial:!0},v0={tokenize:VN,partial:!0},PN={tokenize:GN,partial:!0},C0={name:"wwwAutolink",tokenize:zN,previous:_0},S0={name:"protocolAutolink",tokenize:WN,previous:T0},hn={name:"emailAutolink",tokenize:ON,previous:N0},Vr={};function FN(){return{text:Vr}}let Hn=48;for(;Hn<123;)Vr[Hn]=hn,Hn++,Hn===58?Hn=65:Hn===91&&(Hn=97);Vr[43]=hn;Vr[45]=hn;Vr[46]=hn;Vr[95]=hn;Vr[72]=[hn,S0];Vr[104]=[hn,S0];Vr[87]=[hn,C0];Vr[119]=[hn,C0];function ON(e,t,r){const n=this;let s,i;return a;function a(h){return!du(h)||!N0.call(n,n.previous)||qh(n.events)?r(h):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),o(h))}function o(h){return du(h)?(e.consume(h),o):h===64?(e.consume(h),l):r(h)}function l(h){return h===46?e.check(PN,u,c)(h):h===45||h===95||Lt(h)?(i=!0,e.consume(h),l):u(h)}function c(h){return e.consume(h),s=!0,l}function u(h){return i&&s&&Ot(n.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(h)):r(h)}}function zN(e,t,r){const n=this;return s;function s(a){return a!==87&&a!==119||!_0.call(n,n.previous)||qh(n.events)?r(a):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(RN,e.attempt(k0,e.attempt(w0,i),r),r)(a))}function i(a){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(a)}}function WN(e,t,r){const n=this;let s="",i=!1;return a;function a(h){return(h===72||h===104)&&T0.call(n,n.previous)&&!qh(n.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(h),e.consume(h),o):r(h)}function o(h){if(Ot(h)&&s.length<5)return s+=String.fromCodePoint(h),e.consume(h),o;if(h===58){const f=s.toLowerCase();if(f==="http"||f==="https")return e.consume(h),l}return r(h)}function l(h){return h===47?(e.consume(h),i?c:(i=!0,l)):r(h)}function c(h){return h===null||wo(h)||Ze(h)||ns(h)||hl(h)?r(h):e.attempt(k0,e.attempt(w0,u),r)(h)}function u(h){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(h)}}function HN(e,t,r){let n=0;return s;function s(a){return(a===87||a===119)&&n<3?(n++,e.consume(a),s):a===46&&n===3?(e.consume(a),i):r(a)}function i(a){return a===null?r(a):t(a)}}function qN(e,t,r){let n,s,i;return a;function a(c){return c===46||c===95?e.check(v0,l,o)(c):c===null||Ze(c)||ns(c)||c!==45&&hl(c)?l(c):(i=!0,e.consume(c),a)}function o(c){return c===95?n=!0:(s=n,n=void 0),e.consume(c),a}function l(c){return s||n||!i?r(c):t(c)}}function UN(e,t){let r=0,n=0;return s;function s(a){return a===40?(r++,e.consume(a),s):a===41&&n<r?i(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?e.check(v0,t,i)(a):a===null||Ze(a)||ns(a)?t(a):(e.consume(a),s)}function i(a){return a===41&&n++,e.consume(a),s}}function VN(e,t,r){return n;function n(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),n):o===38?(e.consume(o),i):o===93?(e.consume(o),s):o===60||o===null||Ze(o)||ns(o)?t(o):r(o)}function s(o){return o===null||o===40||o===91||Ze(o)||ns(o)?t(o):n(o)}function i(o){return Ot(o)?a(o):r(o)}function a(o){return o===59?(e.consume(o),n):Ot(o)?(e.consume(o),a):r(o)}}function GN(e,t,r){return n;function n(i){return e.consume(i),s}function s(i){return Lt(i)?r(i):t(i)}}function _0(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Ze(e)}function T0(e){return!Ot(e)}function N0(e){return!(e===47||du(e))}function du(e){return e===43||e===45||e===46||e===95||Lt(e)}function qh(e){let t=e.length,r=!1;for(;t--;){const n=e[t][1];if((n.type==="labelLink"||n.type==="labelImage")&&!n._balanced){r=!0;break}if(n._gfmAutolinkLiteralWalkedInto){r=!1;break}}return e.length>0&&!r&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const YN={tokenize:rE,partial:!0};function XN(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:JN,continuation:{tokenize:eE},exit:tE}},text:{91:{name:"gfmFootnoteCall",tokenize:ZN},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:KN,resolveTo:QN}}}}function KN(e,t,r){const n=this;let s=n.events.length;const i=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let a;for(;s--;){const l=n.events[s][1];if(l.type==="labelImage"){a=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return o;function o(l){if(!a||!a._balanced)return r(l);const c=Mr(n.sliceSerialize({start:a.end,end:n.now()}));return c.codePointAt(0)!==94||!i.includes(c.slice(1))?r(l):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),t(l))}}function QN(e,t){let r=e.length;for(;r--;)if(e[r][1].type==="labelImage"&&e[r][0]==="enter"){e[r][1];break}e[r+1][1].type="data",e[r+3][1].type="gfmFootnoteCallLabelMarker";const n={type:"gfmFootnoteCall",start:Object.assign({},e[r+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[r+3][1].end),end:Object.assign({},e[r+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},o=[e[r+1],e[r+2],["enter",n,t],e[r+3],e[r+4],["enter",s,t],["exit",s,t],["enter",i,t],["enter",a,t],["exit",a,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",n,t]];return e.splice(r,e.length-r+1,...o),e}function ZN(e,t,r){const n=this,s=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let i=0,a;return o;function o(h){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),l}function l(h){return h!==94?r(h):(e.enter("gfmFootnoteCallMarker"),e.consume(h),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",c)}function c(h){if(i>999||h===93&&!a||h===null||h===91||Ze(h))return r(h);if(h===93){e.exit("chunkString");const f=e.exit("gfmFootnoteCallString");return s.includes(Mr(n.sliceSerialize(f)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):r(h)}return Ze(h)||(a=!0),i++,e.consume(h),h===92?u:c}function u(h){return h===91||h===92||h===93?(e.consume(h),i++,c):c(h)}}function JN(e,t,r){const n=this,s=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let i,a=0,o;return l;function l(p){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(p),e.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(p){return p===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(p),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",u):r(p)}function u(p){if(a>999||p===93&&!o||p===null||p===91||Ze(p))return r(p);if(p===93){e.exit("chunkString");const m=e.exit("gfmFootnoteDefinitionLabelString");return i=Mr(n.sliceSerialize(m)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(p),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),f}return Ze(p)||(o=!0),a++,e.consume(p),p===92?h:u}function h(p){return p===91||p===92||p===93?(e.consume(p),a++,u):u(p)}function f(p){return p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),s.includes(i)||s.push(i),ze(e,g,"gfmFootnoteDefinitionWhitespace")):r(p)}function g(p){return t(p)}}function eE(e,t,r){return e.check(xa,t,e.attempt(YN,t,r))}function tE(e){e.exit("gfmFootnoteDefinition")}function rE(e,t,r){const n=this;return ze(e,s,"gfmFootnoteDefinitionIndent",5);function s(i){const a=n.events[n.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?t(i):r(i)}}function nE(e){let r=(e||{}).singleTilde;const n={name:"strikethrough",tokenize:i,resolveAll:s};return r==null&&(r=!0),{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function s(a,o){let l=-1;for(;++l<a.length;)if(a[l][0]==="enter"&&a[l][1].type==="strikethroughSequenceTemporary"&&a[l][1]._close){let c=l;for(;c--;)if(a[c][0]==="exit"&&a[c][1].type==="strikethroughSequenceTemporary"&&a[c][1]._open&&a[l][1].end.offset-a[l][1].start.offset===a[c][1].end.offset-a[c][1].start.offset){a[l][1].type="strikethroughSequence",a[c][1].type="strikethroughSequence";const u={type:"strikethrough",start:Object.assign({},a[c][1].start),end:Object.assign({},a[l][1].end)},h={type:"strikethroughText",start:Object.assign({},a[c][1].end),end:Object.assign({},a[l][1].start)},f=[["enter",u,o],["enter",a[c][1],o],["exit",a[c][1],o],["enter",h,o]],g=o.parser.constructs.insideSpan.null;g&&lr(f,f.length,0,dl(g,a.slice(c+1,l),o)),lr(f,f.length,0,[["exit",h,o],["enter",a[l][1],o],["exit",a[l][1],o],["exit",u,o]]),lr(a,c-1,l-c+3,f),l=c+f.length-2;break}}for(l=-1;++l<a.length;)a[l][1].type==="strikethroughSequenceTemporary"&&(a[l][1].type="data");return a}function i(a,o,l){const c=this.previous,u=this.events;let h=0;return f;function f(p){return c===126&&u[u.length-1][1].type!=="characterEscape"?l(p):(a.enter("strikethroughSequenceTemporary"),g(p))}function g(p){const m=Vs(c);if(p===126)return h>1?l(p):(a.consume(p),h++,g);if(h<2&&!r)return l(p);const y=a.exit("strikethroughSequenceTemporary"),x=Vs(p);return y._open=!x||x===2&&!!m,y._close=!m||m===2&&!!x,o(p)}}}class sE{constructor(){this.map=[]}add(t,r,n){iE(this,t,r,n)}consume(t){if(this.map.sort(function(i,a){return i[0]-a[0]}),this.map.length===0)return;let r=this.map.length;const n=[];for(;r>0;)r-=1,n.push(t.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),t.length=this.map[r][0];n.push(t.slice()),t.length=0;let s=n.pop();for(;s;){for(const i of s)t.push(i);s=n.pop()}this.map.length=0}}function iE(e,t,r,n){let s=0;if(!(r===0&&n.length===0)){for(;s<e.map.length;){if(e.map[s][0]===t){e.map[s][1]+=r,e.map[s][2].push(...n);return}s+=1}e.map.push([t,r,n])}}function aE(e,t){let r=!1;const n=[];for(;t<e.length;){const s=e[t];if(r){if(s[0]==="enter")s[1].type==="tableContent"&&n.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(s[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const i=n.length-1;n[i]=n[i]==="left"?"center":"right"}}else if(s[1].type==="tableDelimiterRow")break}else s[0]==="enter"&&s[1].type==="tableDelimiterRow"&&(r=!0);t+=1}return n}function oE(){return{flow:{null:{name:"table",tokenize:lE,resolveAll:cE}}}}function lE(e,t,r){const n=this;let s=0,i=0,a;return o;function o(v){let L=n.events.length-1;for(;L>-1;){const j=n.events[L][1].type;if(j==="lineEnding"||j==="linePrefix")L--;else break}const N=L>-1?n.events[L][1].type:null,R=N==="tableHead"||N==="tableRow"?w:l;return R===w&&n.parser.lazy[n.now().line]?r(v):R(v)}function l(v){return e.enter("tableHead"),e.enter("tableRow"),c(v)}function c(v){return v===124||(a=!0,i+=1),u(v)}function u(v){return v===null?r(v):we(v)?i>1?(i=0,n.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),g):r(v):Re(v)?ze(e,u,"whitespace")(v):(i+=1,a&&(a=!1,s+=1),v===124?(e.enter("tableCellDivider"),e.consume(v),e.exit("tableCellDivider"),a=!0,u):(e.enter("data"),h(v)))}function h(v){return v===null||v===124||Ze(v)?(e.exit("data"),u(v)):(e.consume(v),v===92?f:h)}function f(v){return v===92||v===124?(e.consume(v),h):h(v)}function g(v){return n.interrupt=!1,n.parser.lazy[n.now().line]?r(v):(e.enter("tableDelimiterRow"),a=!1,Re(v)?ze(e,p,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(v):p(v))}function p(v){return v===45||v===58?y(v):v===124?(a=!0,e.enter("tableCellDivider"),e.consume(v),e.exit("tableCellDivider"),m):S(v)}function m(v){return Re(v)?ze(e,y,"whitespace")(v):y(v)}function y(v){return v===58?(i+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(v),e.exit("tableDelimiterMarker"),x):v===45?(i+=1,x(v)):v===null||we(v)?T(v):S(v)}function x(v){return v===45?(e.enter("tableDelimiterFiller"),k(v)):S(v)}function k(v){return v===45?(e.consume(v),k):v===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(v),e.exit("tableDelimiterMarker"),C):(e.exit("tableDelimiterFiller"),C(v))}function C(v){return Re(v)?ze(e,T,"whitespace")(v):T(v)}function T(v){return v===124?p(v):v===null||we(v)?!a||s!==i?S(v):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(v)):S(v)}function S(v){return r(v)}function w(v){return e.enter("tableRow"),_(v)}function _(v){return v===124?(e.enter("tableCellDivider"),e.consume(v),e.exit("tableCellDivider"),_):v===null||we(v)?(e.exit("tableRow"),t(v)):Re(v)?ze(e,_,"whitespace")(v):(e.enter("data"),O(v))}function O(v){return v===null||v===124||Ze(v)?(e.exit("data"),_(v)):(e.consume(v),v===92?P:O)}function P(v){return v===92||v===124?(e.consume(v),O):O(v)}}function cE(e,t){let r=-1,n=!0,s=0,i=[0,0,0,0],a=[0,0,0,0],o=!1,l=0,c,u,h;const f=new sE;for(;++r<e.length;){const g=e[r],p=g[1];g[0]==="enter"?p.type==="tableHead"?(o=!1,l!==0&&(qf(f,t,l,c,u),u=void 0,l=0),c={type:"table",start:Object.assign({},p.start),end:Object.assign({},p.end)},f.add(r,0,[["enter",c,t]])):p.type==="tableRow"||p.type==="tableDelimiterRow"?(n=!0,h=void 0,i=[0,0,0,0],a=[0,r+1,0,0],o&&(o=!1,u={type:"tableBody",start:Object.assign({},p.start),end:Object.assign({},p.end)},f.add(r,0,[["enter",u,t]])),s=p.type==="tableDelimiterRow"?2:u?3:1):s&&(p.type==="data"||p.type==="tableDelimiterMarker"||p.type==="tableDelimiterFiller")?(n=!1,a[2]===0&&(i[1]!==0&&(a[0]=a[1],h=Wa(f,t,i,s,void 0,h),i=[0,0,0,0]),a[2]=r)):p.type==="tableCellDivider"&&(n?n=!1:(i[1]!==0&&(a[0]=a[1],h=Wa(f,t,i,s,void 0,h)),i=a,a=[i[1],r,0,0])):p.type==="tableHead"?(o=!0,l=r):p.type==="tableRow"||p.type==="tableDelimiterRow"?(l=r,i[1]!==0?(a[0]=a[1],h=Wa(f,t,i,s,r,h)):a[1]!==0&&(h=Wa(f,t,a,s,r,h)),s=0):s&&(p.type==="data"||p.type==="tableDelimiterMarker"||p.type==="tableDelimiterFiller")&&(a[3]=r)}for(l!==0&&qf(f,t,l,c,u),f.consume(t.events),r=-1;++r<t.events.length;){const g=t.events[r];g[0]==="enter"&&g[1].type==="table"&&(g[1]._align=aE(t.events,r))}return e}function Wa(e,t,r,n,s,i){const a=n===1?"tableHeader":n===2?"tableDelimiter":"tableData",o="tableContent";r[0]!==0&&(i.end=Object.assign({},As(t.events,r[0])),e.add(r[0],0,[["exit",i,t]]));const l=As(t.events,r[1]);if(i={type:a,start:Object.assign({},l),end:Object.assign({},l)},e.add(r[1],0,[["enter",i,t]]),r[2]!==0){const c=As(t.events,r[2]),u=As(t.events,r[3]),h={type:o,start:Object.assign({},c),end:Object.assign({},u)};if(e.add(r[2],0,[["enter",h,t]]),n!==2){const f=t.events[r[2]],g=t.events[r[3]];if(f[1].end=Object.assign({},g[1].end),f[1].type="chunkText",f[1].contentType="text",r[3]>r[2]+1){const p=r[2]+1,m=r[3]-r[2]-1;e.add(p,m,[])}}e.add(r[3]+1,0,[["exit",h,t]])}return s!==void 0&&(i.end=Object.assign({},As(t.events,s)),e.add(s,0,[["exit",i,t]]),i=void 0),i}function qf(e,t,r,n,s){const i=[],a=As(t.events,r);s&&(s.end=Object.assign({},a),i.push(["exit",s,t])),n.end=Object.assign({},a),i.push(["exit",n,t]),e.add(r+1,0,i)}function As(e,t){const r=e[t],n=r[0]==="enter"?"start":"end";return r[1][n]}const uE={name:"tasklistCheck",tokenize:dE};function hE(){return{text:{91:uE}}}function dE(e,t,r){const n=this;return s;function s(l){return n.previous!==null||!n._gfmTasklistFirstContentOfListItem?r(l):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),i)}function i(l){return Ze(l)?(e.enter("taskListCheckValueUnchecked"),e.consume(l),e.exit("taskListCheckValueUnchecked"),a):l===88||l===120?(e.enter("taskListCheckValueChecked"),e.consume(l),e.exit("taskListCheckValueChecked"),a):r(l)}function a(l){return l===93?(e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):r(l)}function o(l){return we(l)?t(l):Re(l)?e.check({tokenize:fE},t,r)(l):r(l)}}function fE(e,t,r){return ze(e,n,"whitespace");function n(s){return s===null?r(s):t(s)}}function gE(e){return Pm([FN(),XN(),nE(e),oE(),hE()])}const pE={};function mE(e){const t=this,r=e||pE,n=t.data(),s=n.micromarkExtensions||(n.micromarkExtensions=[]),i=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),a=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);s.push(gE(r)),i.push(DN()),a.push(BN(r))}const E0={'code[class*="language-"]':{color:"#ccc",background:"none",fontFamily:"Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace",fontSize:"1em",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",wordWrap:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]':{color:"#ccc",background:"#2d2d2d",fontFamily:"Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace",fontSize:"1em",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",wordWrap:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:".5em 0",overflow:"auto"},':not(pre) > code[class*="language-"]':{background:"#2d2d2d",padding:".1em",borderRadius:".3em",whiteSpace:"normal"},comment:{color:"#999"},"block-comment":{color:"#999"},prolog:{color:"#999"},doctype:{color:"#999"},cdata:{color:"#999"},punctuation:{color:"#ccc"},tag:{color:"#e2777a"},"attr-name":{color:"#e2777a"},namespace:{color:"#e2777a"},deleted:{color:"#e2777a"},"function-name":{color:"#6196cc"},boolean:{color:"#f08d49"},number:{color:"#f08d49"},function:{color:"#f08d49"},property:{color:"#f8c555"},"class-name":{color:"#f8c555"},constant:{color:"#f8c555"},symbol:{color:"#f8c555"},selector:{color:"#cc99cd"},important:{color:"#cc99cd",fontWeight:"bold"},atrule:{color:"#cc99cd"},keyword:{color:"#cc99cd"},builtin:{color:"#cc99cd"},string:{color:"#7ec699"},char:{color:"#7ec699"},"attr-value":{color:"#7ec699"},regex:{color:"#7ec699"},variable:{color:"#7ec699"},operator:{color:"#67cdcc"},entity:{color:"#67cdcc",cursor:"help"},url:{color:"#67cdcc"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"},inserted:{color:"green"}},xE={'pre[class*="language-"]':{color:"#d4d4d4",fontSize:"13px",textShadow:"none",fontFamily:'Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:".5em 0",overflow:"auto",background:"#1e1e1e"},'code[class*="language-"]':{color:"#d4d4d4",fontSize:"13px",textShadow:"none",fontFamily:'Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]::selection':{textShadow:"none",background:"#264F78"},'code[class*="language-"]::selection':{textShadow:"none",background:"#264F78"},'pre[class*="language-"] *::selection':{textShadow:"none",background:"#264F78"},'code[class*="language-"] *::selection':{textShadow:"none",background:"#264F78"},':not(pre) > code[class*="language-"]':{padding:".1em .3em",borderRadius:".3em",color:"#db4c69",background:"#1e1e1e"},".namespace":{Opacity:".7"},"doctype.doctype-tag":{color:"#569CD6"},"doctype.name":{color:"#9cdcfe"},comment:{color:"#6a9955"},prolog:{color:"#6a9955"},punctuation:{color:"#d4d4d4"},".language-html .language-css .token.punctuation":{color:"#d4d4d4"},".language-html .language-javascript .token.punctuation":{color:"#d4d4d4"},property:{color:"#9cdcfe"},tag:{color:"#569cd6"},boolean:{color:"#569cd6"},number:{color:"#b5cea8"},constant:{color:"#9cdcfe"},symbol:{color:"#b5cea8"},inserted:{color:"#b5cea8"},unit:{color:"#b5cea8"},selector:{color:"#d7ba7d"},"attr-name":{color:"#9cdcfe"},string:{color:"#ce9178"},char:{color:"#ce9178"},builtin:{color:"#ce9178"},deleted:{color:"#ce9178"},".language-css .token.string.url":{textDecoration:"underline"},operator:{color:"#d4d4d4"},entity:{color:"#569cd6"},"operator.arrow":{color:"#569CD6"},atrule:{color:"#ce9178"},"atrule.rule":{color:"#c586c0"},"atrule.url":{color:"#9cdcfe"},"atrule.url.function":{color:"#dcdcaa"},"atrule.url.punctuation":{color:"#d4d4d4"},keyword:{color:"#569CD6"},"keyword.module":{color:"#c586c0"},"keyword.control-flow":{color:"#c586c0"},function:{color:"#dcdcaa"},"function.maybe-class-name":{color:"#dcdcaa"},regex:{color:"#d16969"},important:{color:"#569cd6"},italic:{fontStyle:"italic"},"class-name":{color:"#4ec9b0"},"maybe-class-name":{color:"#4ec9b0"},console:{color:"#9cdcfe"},parameter:{color:"#9cdcfe"},interpolation:{color:"#9cdcfe"},"punctuation.interpolation-punctuation":{color:"#569cd6"},variable:{color:"#9cdcfe"},"imports.maybe-class-name":{color:"#9cdcfe"},"exports.maybe-class-name":{color:"#9cdcfe"},escape:{color:"#d7ba7d"},"tag.punctuation":{color:"#808080"},cdata:{color:"#808080"},"attr-value":{color:"#ce9178"},"attr-value.punctuation":{color:"#ce9178"},"attr-value.punctuation.attr-equals":{color:"#d4d4d4"},namespace:{color:"#4ec9b0"},'pre[class*="language-javascript"]':{color:"#9cdcfe"},'code[class*="language-javascript"]':{color:"#9cdcfe"},'pre[class*="language-jsx"]':{color:"#9cdcfe"},'code[class*="language-jsx"]':{color:"#9cdcfe"},'pre[class*="language-typescript"]':{color:"#9cdcfe"},'code[class*="language-typescript"]':{color:"#9cdcfe"},'pre[class*="language-tsx"]':{color:"#9cdcfe"},'code[class*="language-tsx"]':{color:"#9cdcfe"},'pre[class*="language-css"]':{color:"#ce9178"},'code[class*="language-css"]':{color:"#ce9178"},'pre[class*="language-html"]':{color:"#d4d4d4"},'code[class*="language-html"]':{color:"#d4d4d4"},".language-regex .token.anchor":{color:"#dcdcaa"},".language-html .token.punctuation":{color:"#808080"},'pre[class*="language-"] > code[class*="language-"]':{position:"relative",zIndex:"1"},".line-highlight.line-highlight":{background:"#f7ebc6",boxShadow:"inset 5px 0 0 #f7d87c",zIndex:"0"}};var Uf={name:"mermaid",version:"11.12.0",description:"Markdown-ish syntax for generating flowcharts, mindmaps, sequence diagrams, class diagrams, gantt charts, git graphs and more.",type:"module",module:"./dist/mermaid.core.mjs",types:"./dist/mermaid.d.ts",exports:{".":{types:"./dist/mermaid.d.ts",import:"./dist/mermaid.core.mjs",default:"./dist/mermaid.core.mjs"},"./*":"./*"},keywords:["diagram","markdown","flowchart","sequence diagram","gantt","class diagram","git graph","mindmap","packet diagram","c4 diagram","er diagram","pie chart","pie diagram","quadrant chart","requirement diagram","graph"],scripts:{clean:"rimraf dist",dev:"pnpm -w dev","docs:code":"typedoc src/defaultConfig.ts src/config.ts src/mermaid.ts && prettier --write ./src/docs/config/setup","docs:build":"rimraf ../../docs && pnpm docs:code && pnpm docs:spellcheck && tsx scripts/docs.cli.mts","docs:verify":"pnpm docs:code && pnpm docs:spellcheck && tsx scripts/docs.cli.mts --verify","docs:pre:vitepress":"pnpm --filter ./src/docs prefetch && rimraf src/vitepress && pnpm docs:code && tsx scripts/docs.cli.mts --vitepress && pnpm --filter ./src/vitepress install --no-frozen-lockfile --ignore-scripts","docs:build:vitepress":"pnpm docs:pre:vitepress && (cd src/vitepress && pnpm run build) && cpy --flat src/docs/landing/ ./src/vitepress/.vitepress/dist/landing","docs:dev":'pnpm docs:pre:vitepress && concurrently "pnpm --filter ./src/vitepress dev" "tsx scripts/docs.cli.mts --watch --vitepress"',"docs:dev:docker":'pnpm docs:pre:vitepress && concurrently "pnpm --filter ./src/vitepress dev:docker" "tsx scripts/docs.cli.mts --watch --vitepress"',"docs:serve":"pnpm docs:build:vitepress && vitepress serve src/vitepress","docs:spellcheck":'cspell "src/docs/**/*.md"',"docs:release-version":"tsx scripts/update-release-version.mts","docs:verify-version":"tsx scripts/update-release-version.mts --verify","types:build-config":"tsx scripts/create-types-from-json-schema.mts","types:verify-config":"tsx scripts/create-types-from-json-schema.mts --verify",checkCircle:"npx madge --circular ./src",prepublishOnly:"pnpm docs:verify-version"},repository:{type:"git",url:"https://github.com/mermaid-js/mermaid"},author:"Knut Sveidqvist",license:"MIT",standard:{ignore:["**/parser/*.js","dist/**/*.js","cypress/**/*.js"],globals:["page"]},dependencies:{"@braintree/sanitize-url":"^7.1.1","@iconify/utils":"^3.0.1","@mermaid-js/parser":"workspace:^","@types/d3":"^7.4.3",cytoscape:"^3.29.3","cytoscape-cose-bilkent":"^4.1.0","cytoscape-fcose":"^2.2.0",d3:"^7.9.0","d3-sankey":"^0.12.3","dagre-d3-es":"7.0.11",dayjs:"^1.11.18",dompurify:"^3.2.5",katex:"^0.16.22",khroma:"^2.1.0","lodash-es":"^4.17.21",marked:"^16.2.1",roughjs:"^4.6.6",stylis:"^4.3.6","ts-dedent":"^2.2.0",uuid:"^11.1.0"},devDependencies:{"@adobe/jsonschema2md":"^8.0.5","@iconify/types":"^2.0.0","@types/cytoscape":"^3.21.9","@types/cytoscape-fcose":"^2.2.4","@types/d3-sankey":"^0.12.4","@types/d3-scale":"^4.0.9","@types/d3-scale-chromatic":"^3.1.0","@types/d3-selection":"^3.0.11","@types/d3-shape":"^3.1.7","@types/jsdom":"^21.1.7","@types/katex":"^0.16.7","@types/lodash-es":"^4.17.12","@types/micromatch":"^4.0.9","@types/stylis":"^4.2.7","@types/uuid":"^10.0.0",ajv:"^8.17.1",canvas:"^3.1.2",chokidar:"3.6.0",concurrently:"^9.1.2","csstree-validator":"^4.0.1",globby:"^14.1.0",jison:"^0.4.18","js-base64":"^3.7.8",jsdom:"^26.1.0","json-schema-to-typescript":"^15.0.4",micromatch:"^4.0.8","path-browserify":"^1.0.1",prettier:"^3.5.3",remark:"^15.0.1","remark-frontmatter":"^5.0.0","remark-gfm":"^4.0.1",rimraf:"^6.0.1","start-server-and-test":"^2.0.13","type-fest":"^4.35.0",typedoc:"^0.28.12","typedoc-plugin-markdown":"^4.8.1",typescript:"~5.7.3","unist-util-flatmap":"^1.0.0","unist-util-visit":"^5.0.0",vitepress:"^1.6.4","vitepress-plugin-search":"1.0.4-alpha.22"},files:["dist/","README.md"],publishConfig:{access:"public"}},io={exports:{}},yE=io.exports,Vf;function bE(){return Vf||(Vf=1,(function(e,t){(function(r,n){e.exports=n()})(yE,(function(){var r=1e3,n=6e4,s=36e5,i="millisecond",a="second",o="minute",l="hour",c="day",u="week",h="month",f="quarter",g="year",p="date",m="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,x=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,k={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(j){var B=["th","st","nd","rd"],I=j%100;return"["+j+(B[(I-20)%10]||B[I]||B[0])+"]"}},C=function(j,B,I){var F=String(j);return!F||F.length>=B?j:""+Array(B+1-F.length).join(I)+j},T={s:C,z:function(j){var B=-j.utcOffset(),I=Math.abs(B),F=Math.floor(I/60),W=I%60;return(B<=0?"+":"-")+C(F,2,"0")+":"+C(W,2,"0")},m:function j(B,I){if(B.date()<I.date())return-j(I,B);var F=12*(I.year()-B.year())+(I.month()-B.month()),W=B.clone().add(F,h),ee=I-W<0,A=B.clone().add(F+(ee?-1:1),h);return+(-(F+(I-W)/(ee?W-A:A-W))||0)},a:function(j){return j<0?Math.ceil(j)||0:Math.floor(j)},p:function(j){return{M:h,y:g,w:u,d:c,D:p,h:l,m:o,s:a,ms:i,Q:f}[j]||String(j||"").toLowerCase().replace(/s$/,"")},u:function(j){return j===void 0}},S="en",w={};w[S]=k;var _="$isDayjsObject",O=function(j){return j instanceof N||!(!j||!j[_])},P=function j(B,I,F){var W;if(!B)return S;if(typeof B=="string"){var ee=B.toLowerCase();w[ee]&&(W=ee),I&&(w[ee]=I,W=ee);var A=B.split("-");if(!W&&A.length>1)return j(A[0])}else{var G=B.name;w[G]=B,W=G}return!F&&W&&(S=W),W||!F&&S},v=function(j,B){if(O(j))return j.clone();var I=typeof B=="object"?B:{};return I.date=j,I.args=arguments,new N(I)},L=T;L.l=P,L.i=O,L.w=function(j,B){return v(j,{locale:B.$L,utc:B.$u,x:B.$x,$offset:B.$offset})};var N=(function(){function j(I){this.$L=P(I.locale,null,!0),this.parse(I),this.$x=this.$x||I.x||{},this[_]=!0}var B=j.prototype;return B.parse=function(I){this.$d=(function(F){var W=F.date,ee=F.utc;if(W===null)return new Date(NaN);if(L.u(W))return new Date;if(W instanceof Date)return new Date(W);if(typeof W=="string"&&!/Z$/i.test(W)){var A=W.match(y);if(A){var G=A[2]-1||0,$=(A[7]||"0").substring(0,3);return ee?new Date(Date.UTC(A[1],G,A[3]||1,A[4]||0,A[5]||0,A[6]||0,$)):new Date(A[1],G,A[3]||1,A[4]||0,A[5]||0,A[6]||0,$)}}return new Date(W)})(I),this.init()},B.init=function(){var I=this.$d;this.$y=I.getFullYear(),this.$M=I.getMonth(),this.$D=I.getDate(),this.$W=I.getDay(),this.$H=I.getHours(),this.$m=I.getMinutes(),this.$s=I.getSeconds(),this.$ms=I.getMilliseconds()},B.$utils=function(){return L},B.isValid=function(){return this.$d.toString()!==m},B.isSame=function(I,F){var W=v(I);return this.startOf(F)<=W&&W<=this.endOf(F)},B.isAfter=function(I,F){return v(I)<this.startOf(F)},B.isBefore=function(I,F){return this.endOf(F)<v(I)},B.$g=function(I,F,W){return L.u(I)?this[F]:this.set(W,I)},B.unix=function(){return Math.floor(this.valueOf()/1e3)},B.valueOf=function(){return this.$d.getTime()},B.startOf=function(I,F){var W=this,ee=!!L.u(F)||F,A=L.p(I),G=function(Y,Q){var se=L.w(W.$u?Date.UTC(W.$y,Q,Y):new Date(W.$y,Q,Y),W);return ee?se:se.endOf(c)},$=function(Y,Q){return L.w(W.toDate()[Y].apply(W.toDate("s"),(ee?[0,0,0,0]:[23,59,59,999]).slice(Q)),W)},E=this.$W,Z=this.$M,D=this.$D,X="set"+(this.$u?"UTC":"");switch(A){case g:return ee?G(1,0):G(31,11);case h:return ee?G(1,Z):G(0,Z+1);case u:var V=this.$locale().weekStart||0,H=(E<V?E+7:E)-V;return G(ee?D-H:D+(6-H),Z);case c:case p:return $(X+"Hours",0);case l:return $(X+"Minutes",1);case o:return $(X+"Seconds",2);case a:return $(X+"Milliseconds",3);default:return this.clone()}},B.endOf=function(I){return this.startOf(I,!1)},B.$set=function(I,F){var W,ee=L.p(I),A="set"+(this.$u?"UTC":""),G=(W={},W[c]=A+"Date",W[p]=A+"Date",W[h]=A+"Month",W[g]=A+"FullYear",W[l]=A+"Hours",W[o]=A+"Minutes",W[a]=A+"Seconds",W[i]=A+"Milliseconds",W)[ee],$=ee===c?this.$D+(F-this.$W):F;if(ee===h||ee===g){var E=this.clone().set(p,1);E.$d[G]($),E.init(),this.$d=E.set(p,Math.min(this.$D,E.daysInMonth())).$d}else G&&this.$d[G]($);return this.init(),this},B.set=function(I,F){return this.clone().$set(I,F)},B.get=function(I){return this[L.p(I)]()},B.add=function(I,F){var W,ee=this;I=Number(I);var A=L.p(F),G=function(Z){var D=v(ee);return L.w(D.date(D.date()+Math.round(Z*I)),ee)};if(A===h)return this.set(h,this.$M+I);if(A===g)return this.set(g,this.$y+I);if(A===c)return G(1);if(A===u)return G(7);var $=(W={},W[o]=n,W[l]=s,W[a]=r,W)[A]||1,E=this.$d.getTime()+I*$;return L.w(E,this)},B.subtract=function(I,F){return this.add(-1*I,F)},B.format=function(I){var F=this,W=this.$locale();if(!this.isValid())return W.invalidDate||m;var ee=I||"YYYY-MM-DDTHH:mm:ssZ",A=L.z(this),G=this.$H,$=this.$m,E=this.$M,Z=W.weekdays,D=W.months,X=W.meridiem,V=function(Q,se,_e,Te){return Q&&(Q[se]||Q(F,ee))||_e[se].slice(0,Te)},H=function(Q){return L.s(G%12||12,Q,"0")},Y=X||function(Q,se,_e){var Te=Q<12?"AM":"PM";return _e?Te.toLowerCase():Te};return ee.replace(x,(function(Q,se){return se||(function(_e){switch(_e){case"YY":return String(F.$y).slice(-2);case"YYYY":return L.s(F.$y,4,"0");case"M":return E+1;case"MM":return L.s(E+1,2,"0");case"MMM":return V(W.monthsShort,E,D,3);case"MMMM":return V(D,E);case"D":return F.$D;case"DD":return L.s(F.$D,2,"0");case"d":return String(F.$W);case"dd":return V(W.weekdaysMin,F.$W,Z,2);case"ddd":return V(W.weekdaysShort,F.$W,Z,3);case"dddd":return Z[F.$W];case"H":return String(G);case"HH":return L.s(G,2,"0");case"h":return H(1);case"hh":return H(2);case"a":return Y(G,$,!0);case"A":return Y(G,$,!1);case"m":return String($);case"mm":return L.s($,2,"0");case"s":return String(F.$s);case"ss":return L.s(F.$s,2,"0");case"SSS":return L.s(F.$ms,3,"0");case"Z":return A}return null})(Q)||A.replace(":","")}))},B.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},B.diff=function(I,F,W){var ee,A=this,G=L.p(F),$=v(I),E=($.utcOffset()-this.utcOffset())*n,Z=this-$,D=function(){return L.m(A,$)};switch(G){case g:ee=D()/12;break;case h:ee=D();break;case f:ee=D()/3;break;case u:ee=(Z-E)/6048e5;break;case c:ee=(Z-E)/864e5;break;case l:ee=Z/s;break;case o:ee=Z/n;break;case a:ee=Z/r;break;default:ee=Z}return W?ee:L.a(ee)},B.daysInMonth=function(){return this.endOf(h).$D},B.$locale=function(){return w[this.$L]},B.locale=function(I,F){if(!I)return this.$L;var W=this.clone(),ee=P(I,F,!0);return ee&&(W.$L=ee),W},B.clone=function(){return L.w(this.$d,this)},B.toDate=function(){return new Date(this.valueOf())},B.toJSON=function(){return this.isValid()?this.toISOString():null},B.toISOString=function(){return this.$d.toISOString()},B.toString=function(){return this.$d.toUTCString()},j})(),R=N.prototype;return v.prototype=R,[["$ms",i],["$s",a],["$m",o],["$H",l],["$W",c],["$M",h],["$y",g],["$D",p]].forEach((function(j){R[j[1]]=function(B){return this.$g(B,j[0],j[1])}})),v.extend=function(j,B){return j.$i||(j(B,N,v),j.$i=!0),v},v.locale=P,v.isDayjs=O,v.unix=function(j){return v(1e3*j)},v.en=w[S],v.Ls=w,v.p={},v}))})(io)),io.exports}var kE=bE();const wE=bh(kE);var A0=Object.defineProperty,b=(e,t)=>A0(e,"name",{value:t,configurable:!0}),vE=(e,t)=>{for(var r in t)A0(e,r,{get:t[r],enumerable:!0})},Zr={trace:0,debug:1,info:2,warn:3,error:4,fatal:5},K={trace:b((...e)=>{},"trace"),debug:b((...e)=>{},"debug"),info:b((...e)=>{},"info"),warn:b((...e)=>{},"warn"),error:b((...e)=>{},"error"),fatal:b((...e)=>{},"fatal")},Uh=b(function(e="fatal"){let t=Zr.fatal;typeof e=="string"?e.toLowerCase()in Zr&&(t=Zr[e]):typeof e=="number"&&(t=e),K.trace=()=>{},K.debug=()=>{},K.info=()=>{},K.warn=()=>{},K.error=()=>{},K.fatal=()=>{},t<=Zr.fatal&&(K.fatal=console.error?console.error.bind(console,gr("FATAL"),"color: orange"):console.log.bind(console,"\x1B[35m",gr("FATAL"))),t<=Zr.error&&(K.error=console.error?console.error.bind(console,gr("ERROR"),"color: orange"):console.log.bind(console,"\x1B[31m",gr("ERROR"))),t<=Zr.warn&&(K.warn=console.warn?console.warn.bind(console,gr("WARN"),"color: orange"):console.log.bind(console,"\x1B[33m",gr("WARN"))),t<=Zr.info&&(K.info=console.info?console.info.bind(console,gr("INFO"),"color: lightblue"):console.log.bind(console,"\x1B[34m",gr("INFO"))),t<=Zr.debug&&(K.debug=console.debug?console.debug.bind(console,gr("DEBUG"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",gr("DEBUG"))),t<=Zr.trace&&(K.trace=console.debug?console.debug.bind(console,gr("TRACE"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",gr("TRACE")))},"setLogLevel"),gr=b(e=>`%c${wE().format("ss.SSS")} : ${e} : `,"format");const ao={min:{r:0,g:0,b:0,s:0,l:0,a:0},max:{r:255,g:255,b:255,h:360,s:100,l:100,a:1},clamp:{r:e=>e>=255?255:e<0?0:e,g:e=>e>=255?255:e<0?0:e,b:e=>e>=255?255:e<0?0:e,h:e=>e%360,s:e=>e>=100?100:e<0?0:e,l:e=>e>=100?100:e<0?0:e,a:e=>e>=1?1:e<0?0:e},toLinear:e=>{const t=e/255;return e>.03928?Math.pow((t+.055)/1.055,2.4):t/12.92},hue2rgb:(e,t,r)=>(r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e),hsl2rgb:({h:e,s:t,l:r},n)=>{if(!t)return r*2.55;e/=360,t/=100,r/=100;const s=r<.5?r*(1+t):r+t-r*t,i=2*r-s;switch(n){case"r":return ao.hue2rgb(i,s,e+1/3)*255;case"g":return ao.hue2rgb(i,s,e)*255;case"b":return ao.hue2rgb(i,s,e-1/3)*255}},rgb2hsl:({r:e,g:t,b:r},n)=>{e/=255,t/=255,r/=255;const s=Math.max(e,t,r),i=Math.min(e,t,r),a=(s+i)/2;if(n==="l")return a*100;if(s===i)return 0;const o=s-i,l=a>.5?o/(2-s-i):o/(s+i);if(n==="s")return l*100;switch(s){case e:return((t-r)/o+(t<r?6:0))*60;case t:return((r-e)/o+2)*60;case r:return((e-t)/o+4)*60;default:return-1}}},CE={clamp:(e,t,r)=>t>r?Math.min(t,Math.max(r,e)):Math.min(r,Math.max(t,e)),round:e=>Math.round(e*1e10)/1e10},SE={dec2hex:e=>{const t=Math.round(e).toString(16);return t.length>1?t:`0${t}`}},Ne={channel:ao,lang:CE,unit:SE},Cn={};for(let e=0;e<=255;e++)Cn[e]=Ne.unit.dec2hex(e);const jt={ALL:0,RGB:1,HSL:2};class _E{constructor(){this.type=jt.ALL}get(){return this.type}set(t){if(this.type&&this.type!==t)throw new Error("Cannot change both RGB and HSL channels at the same time");this.type=t}reset(){this.type=jt.ALL}is(t){return this.type===t}}class TE{constructor(t,r){this.color=r,this.changed=!1,this.data=t,this.type=new _E}set(t,r){return this.color=r,this.changed=!1,this.data=t,this.type.type=jt.ALL,this}_ensureHSL(){const t=this.data,{h:r,s:n,l:s}=t;r===void 0&&(t.h=Ne.channel.rgb2hsl(t,"h")),n===void 0&&(t.s=Ne.channel.rgb2hsl(t,"s")),s===void 0&&(t.l=Ne.channel.rgb2hsl(t,"l"))}_ensureRGB(){const t=this.data,{r,g:n,b:s}=t;r===void 0&&(t.r=Ne.channel.hsl2rgb(t,"r")),n===void 0&&(t.g=Ne.channel.hsl2rgb(t,"g")),s===void 0&&(t.b=Ne.channel.hsl2rgb(t,"b"))}get r(){const t=this.data,r=t.r;return!this.type.is(jt.HSL)&&r!==void 0?r:(this._ensureHSL(),Ne.channel.hsl2rgb(t,"r"))}get g(){const t=this.data,r=t.g;return!this.type.is(jt.HSL)&&r!==void 0?r:(this._ensureHSL(),Ne.channel.hsl2rgb(t,"g"))}get b(){const t=this.data,r=t.b;return!this.type.is(jt.HSL)&&r!==void 0?r:(this._ensureHSL(),Ne.channel.hsl2rgb(t,"b"))}get h(){const t=this.data,r=t.h;return!this.type.is(jt.RGB)&&r!==void 0?r:(this._ensureRGB(),Ne.channel.rgb2hsl(t,"h"))}get s(){const t=this.data,r=t.s;return!this.type.is(jt.RGB)&&r!==void 0?r:(this._ensureRGB(),Ne.channel.rgb2hsl(t,"s"))}get l(){const t=this.data,r=t.l;return!this.type.is(jt.RGB)&&r!==void 0?r:(this._ensureRGB(),Ne.channel.rgb2hsl(t,"l"))}get a(){return this.data.a}set r(t){this.type.set(jt.RGB),this.changed=!0,this.data.r=t}set g(t){this.type.set(jt.RGB),this.changed=!0,this.data.g=t}set b(t){this.type.set(jt.RGB),this.changed=!0,this.data.b=t}set h(t){this.type.set(jt.HSL),this.changed=!0,this.data.h=t}set s(t){this.type.set(jt.HSL),this.changed=!0,this.data.s=t}set l(t){this.type.set(jt.HSL),this.changed=!0,this.data.l=t}set a(t){this.changed=!0,this.data.a=t}}const ml=new TE({r:0,g:0,b:0,a:0},"transparent"),$s={re:/^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,parse:e=>{if(e.charCodeAt(0)!==35)return;const t=e.match($s.re);if(!t)return;const r=t[1],n=parseInt(r,16),s=r.length,i=s%4===0,a=s>4,o=a?1:17,l=a?8:4,c=i?0:-1,u=a?255:15;return ml.set({r:(n>>l*(c+3)&u)*o,g:(n>>l*(c+2)&u)*o,b:(n>>l*(c+1)&u)*o,a:i?(n&u)*o/255:1},e)},stringify:e=>{const{r:t,g:r,b:n,a:s}=e;return s<1?`#${Cn[Math.round(t)]}${Cn[Math.round(r)]}${Cn[Math.round(n)]}${Cn[Math.round(s*255)]}`:`#${Cn[Math.round(t)]}${Cn[Math.round(r)]}${Cn[Math.round(n)]}`}},Yn={re:/^hsla?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(?:deg|grad|rad|turn)?)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(%)?))?\s*?\)$/i,hueRe:/^(.+?)(deg|grad|rad|turn)$/i,_hue2deg:e=>{const t=e.match(Yn.hueRe);if(t){const[,r,n]=t;switch(n){case"grad":return Ne.channel.clamp.h(parseFloat(r)*.9);case"rad":return Ne.channel.clamp.h(parseFloat(r)*180/Math.PI);case"turn":return Ne.channel.clamp.h(parseFloat(r)*360)}}return Ne.channel.clamp.h(parseFloat(e))},parse:e=>{const t=e.charCodeAt(0);if(t!==104&&t!==72)return;const r=e.match(Yn.re);if(!r)return;const[,n,s,i,a,o]=r;return ml.set({h:Yn._hue2deg(n),s:Ne.channel.clamp.s(parseFloat(s)),l:Ne.channel.clamp.l(parseFloat(i)),a:a?Ne.channel.clamp.a(o?parseFloat(a)/100:parseFloat(a)):1},e)},stringify:e=>{const{h:t,s:r,l:n,a:s}=e;return s<1?`hsla(${Ne.lang.round(t)}, ${Ne.lang.round(r)}%, ${Ne.lang.round(n)}%, ${s})`:`hsl(${Ne.lang.round(t)}, ${Ne.lang.round(r)}%, ${Ne.lang.round(n)}%)`}},Gi={colors:{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyanaqua:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",transparent:"#00000000",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},parse:e=>{e=e.toLowerCase();const t=Gi.colors[e];if(t)return $s.parse(t)},stringify:e=>{const t=$s.stringify(e);for(const r in Gi.colors)if(Gi.colors[r]===t)return r}},Ii={re:/^rgba?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?)))?\s*?\)$/i,parse:e=>{const t=e.charCodeAt(0);if(t!==114&&t!==82)return;const r=e.match(Ii.re);if(!r)return;const[,n,s,i,a,o,l,c,u]=r;return ml.set({r:Ne.channel.clamp.r(s?parseFloat(n)*2.55:parseFloat(n)),g:Ne.channel.clamp.g(a?parseFloat(i)*2.55:parseFloat(i)),b:Ne.channel.clamp.b(l?parseFloat(o)*2.55:parseFloat(o)),a:c?Ne.channel.clamp.a(u?parseFloat(c)/100:parseFloat(c)):1},e)},stringify:e=>{const{r:t,g:r,b:n,a:s}=e;return s<1?`rgba(${Ne.lang.round(t)}, ${Ne.lang.round(r)}, ${Ne.lang.round(n)}, ${Ne.lang.round(s)})`:`rgb(${Ne.lang.round(t)}, ${Ne.lang.round(r)}, ${Ne.lang.round(n)})`}},qr={format:{keyword:Gi,hex:$s,rgb:Ii,rgba:Ii,hsl:Yn,hsla:Yn},parse:e=>{if(typeof e!="string")return e;const t=$s.parse(e)||Ii.parse(e)||Yn.parse(e)||Gi.parse(e);if(t)return t;throw new Error(`Unsupported color format: "${e}"`)},stringify:e=>!e.changed&&e.color?e.color:e.type.is(jt.HSL)||e.data.r===void 0?Yn.stringify(e):e.a<1||!Number.isInteger(e.r)||!Number.isInteger(e.g)||!Number.isInteger(e.b)?Ii.stringify(e):$s.stringify(e)},M0=(e,t)=>{const r=qr.parse(e);for(const n in t)r[n]=Ne.channel.clamp[n](t[n]);return qr.stringify(r)},Yi=(e,t,r=0,n=1)=>{if(typeof e!="number")return M0(e,{a:t});const s=ml.set({r:Ne.channel.clamp.r(e),g:Ne.channel.clamp.g(t),b:Ne.channel.clamp.b(r),a:Ne.channel.clamp.a(n)});return qr.stringify(s)},NE=e=>{const{r:t,g:r,b:n}=qr.parse(e),s=.2126*Ne.channel.toLinear(t)+.7152*Ne.channel.toLinear(r)+.0722*Ne.channel.toLinear(n);return Ne.lang.round(s)},EE=e=>NE(e)>=.5,ba=e=>!EE(e),j0=(e,t,r)=>{const n=qr.parse(e),s=n[t],i=Ne.channel.clamp[t](s+r);return s!==i&&(n[t]=i),qr.stringify(n)},ue=(e,t)=>j0(e,"l",t),be=(e,t)=>j0(e,"l",-t),q=(e,t)=>{const r=qr.parse(e),n={};for(const s in t)t[s]&&(n[s]=r[s]+t[s]);return M0(e,n)},AE=(e,t,r=50)=>{const{r:n,g:s,b:i,a}=qr.parse(e),{r:o,g:l,b:c,a:u}=qr.parse(t),h=r/100,f=h*2-1,g=a-u,m=((f*g===-1?f:(f+g)/(1+f*g))+1)/2,y=1-m,x=n*m+o*y,k=s*m+l*y,C=i*m+c*y,T=a*h+u*(1-h);return Yi(x,k,C,T)},ne=(e,t=100)=>{const r=qr.parse(e);return r.r=255-r.r,r.g=255-r.g,r.b=255-r.b,AE(r,e,t)};/*! @license DOMPurify 3.3.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.0/LICENSE */const{entries:I0,setPrototypeOf:Gf,isFrozen:ME,getPrototypeOf:jE,getOwnPropertyDescriptor:IE}=Object;let{freeze:Ut,seal:xr,create:fu}=Object,{apply:gu,construct:pu}=typeof Reflect<"u"&&Reflect;Ut||(Ut=function(t){return t});xr||(xr=function(t){return t});gu||(gu=function(t,r){for(var n=arguments.length,s=new Array(n>2?n-2:0),i=2;i<n;i++)s[i-2]=arguments[i];return t.apply(r,s)});pu||(pu=function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),s=1;s<r;s++)n[s-1]=arguments[s];return new t(...n)});const Ha=Vt(Array.prototype.forEach),LE=Vt(Array.prototype.lastIndexOf),Yf=Vt(Array.prototype.pop),bi=Vt(Array.prototype.push),$E=Vt(Array.prototype.splice),oo=Vt(String.prototype.toLowerCase),_c=Vt(String.prototype.toString),Tc=Vt(String.prototype.match),ki=Vt(String.prototype.replace),DE=Vt(String.prototype.indexOf),BE=Vt(String.prototype.trim),Sr=Vt(Object.prototype.hasOwnProperty),Ft=Vt(RegExp.prototype.test),wi=RE(TypeError);function Vt(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var r=arguments.length,n=new Array(r>1?r-1:0),s=1;s<r;s++)n[s-1]=arguments[s];return gu(e,t,n)}}function RE(e){return function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return pu(e,r)}}function Be(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:oo;Gf&&Gf(e,null);let n=t.length;for(;n--;){let s=t[n];if(typeof s=="string"){const i=r(s);i!==s&&(ME(t)||(t[n]=i),s=i)}e[s]=!0}return e}function PE(e){for(let t=0;t<e.length;t++)Sr(e,t)||(e[t]=null);return e}function tn(e){const t=fu(null);for(const[r,n]of I0(e))Sr(e,r)&&(Array.isArray(n)?t[r]=PE(n):n&&typeof n=="object"&&n.constructor===Object?t[r]=tn(n):t[r]=n);return t}function vi(e,t){for(;e!==null;){const n=IE(e,t);if(n){if(n.get)return Vt(n.get);if(typeof n.value=="function")return Vt(n.value)}e=jE(e)}function r(){return null}return r}const Xf=Ut(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Nc=Ut(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Ec=Ut(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),FE=Ut(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Ac=Ut(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),OE=Ut(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Kf=Ut(["#text"]),Qf=Ut(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Mc=Ut(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Zf=Ut(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),qa=Ut(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),zE=xr(/\{\{[\w\W]*|[\w\W]*\}\}/gm),WE=xr(/<%[\w\W]*|[\w\W]*%>/gm),HE=xr(/\$\{[\w\W]*/gm),qE=xr(/^data-[\-\w.\u00B7-\uFFFF]+$/),UE=xr(/^aria-[\-\w]+$/),L0=xr(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),VE=xr(/^(?:\w+script|data):/i),GE=xr(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),$0=xr(/^html$/i),YE=xr(/^[a-z][.\w]*(-[.\w]+)+$/i);var Jf=Object.freeze({__proto__:null,ARIA_ATTR:UE,ATTR_WHITESPACE:GE,CUSTOM_ELEMENT:YE,DATA_ATTR:qE,DOCTYPE_NAME:$0,ERB_EXPR:WE,IS_ALLOWED_URI:L0,IS_SCRIPT_OR_DATA:VE,MUSTACHE_EXPR:zE,TMPLIT_EXPR:HE});const Ci={element:1,text:3,progressingInstruction:7,comment:8,document:9},XE=function(){return typeof window>"u"?null:window},KE=function(t,r){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let n=null;const s="data-tt-policy-suffix";r&&r.hasAttribute(s)&&(n=r.getAttribute(s));const i="dompurify"+(n?"#"+n:"");try{return t.createPolicy(i,{createHTML(a){return a},createScriptURL(a){return a}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},eg=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function D0(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:XE();const t=ce=>D0(ce);if(t.version="3.3.0",t.removed=[],!e||!e.document||e.document.nodeType!==Ci.document||!e.Element)return t.isSupported=!1,t;let{document:r}=e;const n=r,s=n.currentScript,{DocumentFragment:i,HTMLTemplateElement:a,Node:o,Element:l,NodeFilter:c,NamedNodeMap:u=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:h,DOMParser:f,trustedTypes:g}=e,p=l.prototype,m=vi(p,"cloneNode"),y=vi(p,"remove"),x=vi(p,"nextSibling"),k=vi(p,"childNodes"),C=vi(p,"parentNode");if(typeof a=="function"){const ce=r.createElement("template");ce.content&&ce.content.ownerDocument&&(r=ce.content.ownerDocument)}let T,S="";const{implementation:w,createNodeIterator:_,createDocumentFragment:O,getElementsByTagName:P}=r,{importNode:v}=n;let L=eg();t.isSupported=typeof I0=="function"&&typeof C=="function"&&w&&w.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:N,ERB_EXPR:R,TMPLIT_EXPR:j,DATA_ATTR:B,ARIA_ATTR:I,IS_SCRIPT_OR_DATA:F,ATTR_WHITESPACE:W,CUSTOM_ELEMENT:ee}=Jf;let{IS_ALLOWED_URI:A}=Jf,G=null;const $=Be({},[...Xf,...Nc,...Ec,...Ac,...Kf]);let E=null;const Z=Be({},[...Qf,...Mc,...Zf,...qa]);let D=Object.seal(fu(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),X=null,V=null;const H=Object.seal(fu(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Y=!0,Q=!0,se=!1,_e=!0,Te=!1,Me=!0,Ae=!1,ut=!1,Xe=!1,ht=!1,Mt=!1,tt=!1,ot=!0,Gt=!1;const mt="user-content-";let Yt=!0,kt=!1,U={},J=null;const le=Be({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let ae=null;const Ee=Be({},["audio","video","img","source","image","track"]);let xe=null;const rt=Be({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ke="http://www.w3.org/1998/Math/MathML",xt="http://www.w3.org/2000/svg",nt="http://www.w3.org/1999/xhtml";let Se=nt,Ve=!1,Le=null;const Ge=Be({},[Ke,xt,nt],_c);let wt=Be({},["mi","mo","mn","ms","mtext"]),hr=Be({},["annotation-xml"]);const Rn=Be({},["title","style","font","a","script"]);let $r=null;const Pn=["application/xhtml+xml","text/html"],xs="text/html";let ct=null,wr=null;const ys=r.createElement("form"),fn=function(z){return z instanceof RegExp||z instanceof Function},dr=function(){let z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(wr&&wr===z)){if((!z||typeof z!="object")&&(z={}),z=tn(z),$r=Pn.indexOf(z.PARSER_MEDIA_TYPE)===-1?xs:z.PARSER_MEDIA_TYPE,ct=$r==="application/xhtml+xml"?_c:oo,G=Sr(z,"ALLOWED_TAGS")?Be({},z.ALLOWED_TAGS,ct):$,E=Sr(z,"ALLOWED_ATTR")?Be({},z.ALLOWED_ATTR,ct):Z,Le=Sr(z,"ALLOWED_NAMESPACES")?Be({},z.ALLOWED_NAMESPACES,_c):Ge,xe=Sr(z,"ADD_URI_SAFE_ATTR")?Be(tn(rt),z.ADD_URI_SAFE_ATTR,ct):rt,ae=Sr(z,"ADD_DATA_URI_TAGS")?Be(tn(Ee),z.ADD_DATA_URI_TAGS,ct):Ee,J=Sr(z,"FORBID_CONTENTS")?Be({},z.FORBID_CONTENTS,ct):le,X=Sr(z,"FORBID_TAGS")?Be({},z.FORBID_TAGS,ct):tn({}),V=Sr(z,"FORBID_ATTR")?Be({},z.FORBID_ATTR,ct):tn({}),U=Sr(z,"USE_PROFILES")?z.USE_PROFILES:!1,Y=z.ALLOW_ARIA_ATTR!==!1,Q=z.ALLOW_DATA_ATTR!==!1,se=z.ALLOW_UNKNOWN_PROTOCOLS||!1,_e=z.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Te=z.SAFE_FOR_TEMPLATES||!1,Me=z.SAFE_FOR_XML!==!1,Ae=z.WHOLE_DOCUMENT||!1,ht=z.RETURN_DOM||!1,Mt=z.RETURN_DOM_FRAGMENT||!1,tt=z.RETURN_TRUSTED_TYPE||!1,Xe=z.FORCE_BODY||!1,ot=z.SANITIZE_DOM!==!1,Gt=z.SANITIZE_NAMED_PROPS||!1,Yt=z.KEEP_CONTENT!==!1,kt=z.IN_PLACE||!1,A=z.ALLOWED_URI_REGEXP||L0,Se=z.NAMESPACE||nt,wt=z.MATHML_TEXT_INTEGRATION_POINTS||wt,hr=z.HTML_INTEGRATION_POINTS||hr,D=z.CUSTOM_ELEMENT_HANDLING||{},z.CUSTOM_ELEMENT_HANDLING&&fn(z.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(D.tagNameCheck=z.CUSTOM_ELEMENT_HANDLING.tagNameCheck),z.CUSTOM_ELEMENT_HANDLING&&fn(z.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(D.attributeNameCheck=z.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),z.CUSTOM_ELEMENT_HANDLING&&typeof z.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(D.allowCustomizedBuiltInElements=z.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Te&&(Q=!1),Mt&&(ht=!0),U&&(G=Be({},Kf),E=[],U.html===!0&&(Be(G,Xf),Be(E,Qf)),U.svg===!0&&(Be(G,Nc),Be(E,Mc),Be(E,qa)),U.svgFilters===!0&&(Be(G,Ec),Be(E,Mc),Be(E,qa)),U.mathMl===!0&&(Be(G,Ac),Be(E,Zf),Be(E,qa))),z.ADD_TAGS&&(typeof z.ADD_TAGS=="function"?H.tagCheck=z.ADD_TAGS:(G===$&&(G=tn(G)),Be(G,z.ADD_TAGS,ct))),z.ADD_ATTR&&(typeof z.ADD_ATTR=="function"?H.attributeCheck=z.ADD_ATTR:(E===Z&&(E=tn(E)),Be(E,z.ADD_ATTR,ct))),z.ADD_URI_SAFE_ATTR&&Be(xe,z.ADD_URI_SAFE_ATTR,ct),z.FORBID_CONTENTS&&(J===le&&(J=tn(J)),Be(J,z.FORBID_CONTENTS,ct)),Yt&&(G["#text"]=!0),Ae&&Be(G,["html","head","body"]),G.table&&(Be(G,["tbody"]),delete X.tbody),z.TRUSTED_TYPES_POLICY){if(typeof z.TRUSTED_TYPES_POLICY.createHTML!="function")throw wi('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof z.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw wi('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');T=z.TRUSTED_TYPES_POLICY,S=T.createHTML("")}else T===void 0&&(T=KE(g,s)),T!==null&&typeof S=="string"&&(S=T.createHTML(""));Ut&&Ut(z),wr=z}},gn=Be({},[...Nc,...Ec,...FE]),bs=Be({},[...Ac,...OE]),ks=function(z){let te=C(z);(!te||!te.tagName)&&(te={namespaceURI:Se,tagName:"template"});const oe=oo(z.tagName),Ye=oo(te.tagName);return Le[z.namespaceURI]?z.namespaceURI===xt?te.namespaceURI===nt?oe==="svg":te.namespaceURI===Ke?oe==="svg"&&(Ye==="annotation-xml"||wt[Ye]):!!gn[oe]:z.namespaceURI===Ke?te.namespaceURI===nt?oe==="math":te.namespaceURI===xt?oe==="math"&&hr[Ye]:!!bs[oe]:z.namespaceURI===nt?te.namespaceURI===xt&&!hr[Ye]||te.namespaceURI===Ke&&!wt[Ye]?!1:!bs[oe]&&(Rn[oe]||!gn[oe]):!!($r==="application/xhtml+xml"&&Le[z.namespaceURI]):!1},Tt=function(z){bi(t.removed,{element:z});try{C(z).removeChild(z)}catch{y(z)}},Xt=function(z,te){try{bi(t.removed,{attribute:te.getAttributeNode(z),from:te})}catch{bi(t.removed,{attribute:null,from:te})}if(te.removeAttribute(z),z==="is")if(ht||Mt)try{Tt(te)}catch{}else try{te.setAttribute(z,"")}catch{}},ws=function(z){let te=null,oe=null;if(Xe)z="<remove></remove>"+z;else{const Qe=Tc(z,/^[\r\n\t ]+/);oe=Qe&&Qe[0]}$r==="application/xhtml+xml"&&Se===nt&&(z='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+z+"</body></html>");const Ye=T?T.createHTML(z):z;if(Se===nt)try{te=new f().parseFromString(Ye,$r)}catch{}if(!te||!te.documentElement){te=w.createDocument(Se,"template",null);try{te.documentElement.innerHTML=Ve?S:Ye}catch{}}const it=te.body||te.documentElement;return z&&oe&&it.insertBefore(r.createTextNode(oe),it.childNodes[0]||null),Se===nt?P.call(te,Ae?"html":"body")[0]:Ae?te.documentElement:it},pn=function(z){return _.call(z.ownerDocument||z,z,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Dr=function(z){return z instanceof h&&(typeof z.nodeName!="string"||typeof z.textContent!="string"||typeof z.removeChild!="function"||!(z.attributes instanceof u)||typeof z.removeAttribute!="function"||typeof z.setAttribute!="function"||typeof z.namespaceURI!="string"||typeof z.insertBefore!="function"||typeof z.hasChildNodes!="function")},mn=function(z){return typeof o=="function"&&z instanceof o};function Kt(ce,z,te){Ha(ce,oe=>{oe.call(t,z,te,wr)})}const Fn=function(z){let te=null;if(Kt(L.beforeSanitizeElements,z,null),Dr(z))return Tt(z),!0;const oe=ct(z.nodeName);if(Kt(L.uponSanitizeElement,z,{tagName:oe,allowedTags:G}),Me&&z.hasChildNodes()&&!mn(z.firstElementChild)&&Ft(/<[/\w!]/g,z.innerHTML)&&Ft(/<[/\w!]/g,z.textContent)||z.nodeType===Ci.progressingInstruction||Me&&z.nodeType===Ci.comment&&Ft(/<[/\w]/g,z.data))return Tt(z),!0;if(!(H.tagCheck instanceof Function&&H.tagCheck(oe))&&(!G[oe]||X[oe])){if(!X[oe]&&xn(oe)&&(D.tagNameCheck instanceof RegExp&&Ft(D.tagNameCheck,oe)||D.tagNameCheck instanceof Function&&D.tagNameCheck(oe)))return!1;if(Yt&&!J[oe]){const Ye=C(z)||z.parentNode,it=k(z)||z.childNodes;if(it&&Ye){const Qe=it.length;for(let dt=Qe-1;dt>=0;--dt){const Qt=m(it[dt],!0);Qt.__removalCount=(z.__removalCount||0)+1,Ye.insertBefore(Qt,x(z))}}}return Tt(z),!0}return z instanceof l&&!ks(z)||(oe==="noscript"||oe==="noembed"||oe==="noframes")&&Ft(/<\/no(script|embed|frames)/i,z.innerHTML)?(Tt(z),!0):(Te&&z.nodeType===Ci.text&&(te=z.textContent,Ha([N,R,j],Ye=>{te=ki(te,Ye," ")}),z.textContent!==te&&(bi(t.removed,{element:z.cloneNode()}),z.textContent=te)),Kt(L.afterSanitizeElements,z,null),!1)},vs=function(z,te,oe){if(ot&&(te==="id"||te==="name")&&(oe in r||oe in ys))return!1;if(!(Q&&!V[te]&&Ft(B,te))){if(!(Y&&Ft(I,te))){if(!(H.attributeCheck instanceof Function&&H.attributeCheck(te,z))){if(!E[te]||V[te]){if(!(xn(z)&&(D.tagNameCheck instanceof RegExp&&Ft(D.tagNameCheck,z)||D.tagNameCheck instanceof Function&&D.tagNameCheck(z))&&(D.attributeNameCheck instanceof RegExp&&Ft(D.attributeNameCheck,te)||D.attributeNameCheck instanceof Function&&D.attributeNameCheck(te,z))||te==="is"&&D.allowCustomizedBuiltInElements&&(D.tagNameCheck instanceof RegExp&&Ft(D.tagNameCheck,oe)||D.tagNameCheck instanceof Function&&D.tagNameCheck(oe))))return!1}else if(!xe[te]){if(!Ft(A,ki(oe,W,""))){if(!((te==="src"||te==="xlink:href"||te==="href")&&z!=="script"&&DE(oe,"data:")===0&&ae[z])){if(!(se&&!Ft(F,ki(oe,W,"")))){if(oe)return!1}}}}}}}return!0},xn=function(z){return z!=="annotation-xml"&&Tc(z,ee)},yn=function(z){Kt(L.beforeSanitizeAttributes,z,null);const{attributes:te}=z;if(!te||Dr(z))return;const oe={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:E,forceKeepAttr:void 0};let Ye=te.length;for(;Ye--;){const it=te[Ye],{name:Qe,namespaceURI:dt,value:Qt}=it,fr=ct(Qe),Kr=Qt;let lt=Qe==="value"?Kr:BE(Kr);if(oe.attrName=fr,oe.attrValue=lt,oe.keepAttr=!0,oe.forceKeepAttr=void 0,Kt(L.uponSanitizeAttribute,z,oe),lt=oe.attrValue,Gt&&(fr==="id"||fr==="name")&&(Xt(Qe,z),lt=mt+lt),Me&&Ft(/((--!?|])>)|<\/(style|title|textarea)/i,lt)){Xt(Qe,z);continue}if(fr==="attributename"&&Tc(lt,"href")){Xt(Qe,z);continue}if(oe.forceKeepAttr)continue;if(!oe.keepAttr){Xt(Qe,z);continue}if(!_e&&Ft(/\/>/i,lt)){Xt(Qe,z);continue}Te&&Ha([N,R,j],Cs=>{lt=ki(lt,Cs," ")});const On=ct(z.nodeName);if(!vs(On,fr,lt)){Xt(Qe,z);continue}if(T&&typeof g=="object"&&typeof g.getAttributeType=="function"&&!dt)switch(g.getAttributeType(On,fr)){case"TrustedHTML":{lt=T.createHTML(lt);break}case"TrustedScriptURL":{lt=T.createScriptURL(lt);break}}if(lt!==Kr)try{dt?z.setAttributeNS(dt,Qe,lt):z.setAttribute(Qe,lt),Dr(z)?Tt(z):Yf(t.removed)}catch{Xt(Qe,z)}}Kt(L.afterSanitizeAttributes,z,null)},bn=function ce(z){let te=null;const oe=pn(z);for(Kt(L.beforeSanitizeShadowDOM,z,null);te=oe.nextNode();)Kt(L.uponSanitizeShadowNode,te,null),Fn(te),yn(te),te.content instanceof i&&ce(te.content);Kt(L.afterSanitizeShadowDOM,z,null)};return t.sanitize=function(ce){let z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},te=null,oe=null,Ye=null,it=null;if(Ve=!ce,Ve&&(ce="<!-->"),typeof ce!="string"&&!mn(ce))if(typeof ce.toString=="function"){if(ce=ce.toString(),typeof ce!="string")throw wi("dirty is not a string, aborting")}else throw wi("toString is not a function");if(!t.isSupported)return ce;if(ut||dr(z),t.removed=[],typeof ce=="string"&&(kt=!1),kt){if(ce.nodeName){const Qt=ct(ce.nodeName);if(!G[Qt]||X[Qt])throw wi("root node is forbidden and cannot be sanitized in-place")}}else if(ce instanceof o)te=ws("<!---->"),oe=te.ownerDocument.importNode(ce,!0),oe.nodeType===Ci.element&&oe.nodeName==="BODY"||oe.nodeName==="HTML"?te=oe:te.appendChild(oe);else{if(!ht&&!Te&&!Ae&&ce.indexOf("<")===-1)return T&&tt?T.createHTML(ce):ce;if(te=ws(ce),!te)return ht?null:tt?S:""}te&&Xe&&Tt(te.firstChild);const Qe=pn(kt?ce:te);for(;Ye=Qe.nextNode();)Fn(Ye),yn(Ye),Ye.content instanceof i&&bn(Ye.content);if(kt)return ce;if(ht){if(Mt)for(it=O.call(te.ownerDocument);te.firstChild;)it.appendChild(te.firstChild);else it=te;return(E.shadowroot||E.shadowrootmode)&&(it=v.call(n,it,!0)),it}let dt=Ae?te.outerHTML:te.innerHTML;return Ae&&G["!doctype"]&&te.ownerDocument&&te.ownerDocument.doctype&&te.ownerDocument.doctype.name&&Ft($0,te.ownerDocument.doctype.name)&&(dt="<!DOCTYPE "+te.ownerDocument.doctype.name+`>
136
+ `+dt),Te&&Ha([N,R,j],Qt=>{dt=ki(dt,Qt," ")}),T&&tt?T.createHTML(dt):dt},t.setConfig=function(){let ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};dr(ce),ut=!0},t.clearConfig=function(){wr=null,ut=!1},t.isValidAttribute=function(ce,z,te){wr||dr({});const oe=ct(ce),Ye=ct(z);return vs(oe,Ye,te)},t.addHook=function(ce,z){typeof z=="function"&&bi(L[ce],z)},t.removeHook=function(ce,z){if(z!==void 0){const te=LE(L[ce],z);return te===-1?void 0:$E(L[ce],te,1)[0]}return Yf(L[ce])},t.removeHooks=function(ce){L[ce]=[]},t.removeAllHooks=function(){L=eg()},t}var Gs=D0(),B0=/^-{3}\s*[\n\r](.*?)[\n\r]-{3}\s*[\n\r]+/s,Xi=/%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,QE=/\s*%%.*\n/gm,Rs,R0=(Rs=class extends Error{constructor(t){super(t),this.name="UnknownDiagramError"}},b(Rs,"UnknownDiagramError"),Rs),ss={},Vh=b(function(e,t){e=e.replace(B0,"").replace(Xi,"").replace(QE,`
137
+ `);for(const[r,{detector:n}]of Object.entries(ss))if(n(e,t))return r;throw new R0(`No diagram type detected matching given configuration for text: ${e}`)},"detectType"),mu=b((...e)=>{for(const{id:t,detector:r,loader:n}of e)P0(t,r,n)},"registerLazyLoadedDiagrams"),P0=b((e,t,r)=>{ss[e]&&K.warn(`Detector with key ${e} already exists. Overwriting.`),ss[e]={detector:t,loader:r},K.debug(`Detector with key ${e} added${r?" with loader":""}`)},"addDetector"),ZE=b(e=>ss[e].loader,"getDiagramLoader"),xu=b((e,t,{depth:r=2,clobber:n=!1}={})=>{const s={depth:r,clobber:n};return Array.isArray(t)&&!Array.isArray(e)?(t.forEach(i=>xu(e,i,s)),e):Array.isArray(t)&&Array.isArray(e)?(t.forEach(i=>{e.includes(i)||e.push(i)}),e):e===void 0||r<=0?e!=null&&typeof e=="object"&&typeof t=="object"?Object.assign(e,t):t:(t!==void 0&&typeof e=="object"&&typeof t=="object"&&Object.keys(t).forEach(i=>{typeof t[i]=="object"&&(e[i]===void 0||typeof e[i]=="object")?(e[i]===void 0&&(e[i]=Array.isArray(t[i])?[]:{}),e[i]=xu(e[i],t[i],{depth:r-1,clobber:n})):(n||typeof e[i]!="object"&&typeof t[i]!="object")&&(e[i]=t[i])}),e)},"assignWithDepth"),Ct=xu,xl="#ffffff",yl="#f2f2f2",zt=b((e,t)=>t?q(e,{s:-40,l:10}):q(e,{s:-40,l:-10}),"mkBorder"),Ps,JE=(Ps=class{constructor(){this.background="#f4f4f4",this.primaryColor="#fff4dd",this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px"}updateColors(){if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||q(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||q(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||zt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||zt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||zt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||zt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||ne(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||ne(this.tertiaryColor),this.lineColor=this.lineColor||ne(this.background),this.arrowheadColor=this.arrowheadColor||ne(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?be(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||be(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||ne(this.lineColor),this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||ue(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.vertLineColor=this.vertLineColor||"navy",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.darkMode?(this.rowOdd=this.rowOdd||be(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||be(this.mainBkg,10)):(this.rowOdd=this.rowOdd||ue(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||ue(this.mainBkg,5)),this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||this.tertiaryColor,this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||q(this.primaryColor,{h:30}),this.cScale4=this.cScale4||q(this.primaryColor,{h:60}),this.cScale5=this.cScale5||q(this.primaryColor,{h:90}),this.cScale6=this.cScale6||q(this.primaryColor,{h:120}),this.cScale7=this.cScale7||q(this.primaryColor,{h:150}),this.cScale8=this.cScale8||q(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||q(this.primaryColor,{h:270}),this.cScale10=this.cScale10||q(this.primaryColor,{h:300}),this.cScale11=this.cScale11||q(this.primaryColor,{h:330}),this.darkMode)for(let r=0;r<this.THEME_COLOR_LIMIT;r++)this["cScale"+r]=be(this["cScale"+r],75);else for(let r=0;r<this.THEME_COLOR_LIMIT;r++)this["cScale"+r]=be(this["cScale"+r],25);for(let r=0;r<this.THEME_COLOR_LIMIT;r++)this["cScaleInv"+r]=this["cScaleInv"+r]||ne(this["cScale"+r]);for(let r=0;r<this.THEME_COLOR_LIMIT;r++)this.darkMode?this["cScalePeer"+r]=this["cScalePeer"+r]||ue(this["cScale"+r],10):this["cScalePeer"+r]=this["cScalePeer"+r]||be(this["cScale"+r],10);this.scaleLabelColor=this.scaleLabelColor||this.labelTextColor;for(let r=0;r<this.THEME_COLOR_LIMIT;r++)this["cScaleLabel"+r]=this["cScaleLabel"+r]||this.scaleLabelColor;const t=this.darkMode?-4:-1;for(let r=0;r<5;r++)this["surface"+r]=this["surface"+r]||q(this.mainBkg,{h:180,s:-15,l:t*(5+r*3)}),this["surfacePeer"+r]=this["surfacePeer"+r]||q(this.mainBkg,{h:180,s:-15,l:t*(8+r*3)});this.classText=this.classText||this.textColor,this.fillType0=this.fillType0||this.primaryColor,this.fillType1=this.fillType1||this.secondaryColor,this.fillType2=this.fillType2||q(this.primaryColor,{h:64}),this.fillType3=this.fillType3||q(this.secondaryColor,{h:64}),this.fillType4=this.fillType4||q(this.primaryColor,{h:-64}),this.fillType5=this.fillType5||q(this.secondaryColor,{h:-64}),this.fillType6=this.fillType6||q(this.primaryColor,{h:128}),this.fillType7=this.fillType7||q(this.secondaryColor,{h:128}),this.pie1=this.pie1||this.primaryColor,this.pie2=this.pie2||this.secondaryColor,this.pie3=this.pie3||this.tertiaryColor,this.pie4=this.pie4||q(this.primaryColor,{l:-10}),this.pie5=this.pie5||q(this.secondaryColor,{l:-10}),this.pie6=this.pie6||q(this.tertiaryColor,{l:-10}),this.pie7=this.pie7||q(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||q(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||q(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||q(this.primaryColor,{h:60,l:-20}),this.pie11=this.pie11||q(this.primaryColor,{h:-60,l:-20}),this.pie12=this.pie12||q(this.primaryColor,{h:120,l:-10}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.radar={axisColor:this.radar?.axisColor||this.lineColor,axisStrokeWidth:this.radar?.axisStrokeWidth||2,axisLabelFontSize:this.radar?.axisLabelFontSize||12,curveOpacity:this.radar?.curveOpacity||.5,curveStrokeWidth:this.radar?.curveStrokeWidth||2,graticuleColor:this.radar?.graticuleColor||"#DEDEDE",graticuleStrokeWidth:this.radar?.graticuleStrokeWidth||1,graticuleOpacity:this.radar?.graticuleOpacity||.3,legendBoxSize:this.radar?.legendBoxSize||12,legendFontSize:this.radar?.legendFontSize||12},this.archEdgeColor=this.archEdgeColor||"#777",this.archEdgeArrowColor=this.archEdgeArrowColor||"#777",this.archEdgeWidth=this.archEdgeWidth||"3",this.archGroupBorderColor=this.archGroupBorderColor||"#000",this.archGroupBorderWidth=this.archGroupBorderWidth||"2px",this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||q(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||q(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||q(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||q(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||q(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||q(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||ba(this.quadrant1Fill)?ue(this.quadrant1Fill):be(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.xyChart={backgroundColor:this.xyChart?.backgroundColor||this.background,titleColor:this.xyChart?.titleColor||this.primaryTextColor,xAxisTitleColor:this.xyChart?.xAxisTitleColor||this.primaryTextColor,xAxisLabelColor:this.xyChart?.xAxisLabelColor||this.primaryTextColor,xAxisTickColor:this.xyChart?.xAxisTickColor||this.primaryTextColor,xAxisLineColor:this.xyChart?.xAxisLineColor||this.primaryTextColor,yAxisTitleColor:this.xyChart?.yAxisTitleColor||this.primaryTextColor,yAxisLabelColor:this.xyChart?.yAxisLabelColor||this.primaryTextColor,yAxisTickColor:this.xyChart?.yAxisTickColor||this.primaryTextColor,yAxisLineColor:this.xyChart?.yAxisLineColor||this.primaryTextColor,plotColorPalette:this.xyChart?.plotColorPalette||"#FFF4DD,#FFD8B1,#FFA07A,#ECEFF1,#D6DBDF,#C3E0A8,#FFB6A4,#FFD74D,#738FA7,#FFFFF0"},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||(this.darkMode?be(this.secondaryColor,30):this.secondaryColor),this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=this.git0||this.primaryColor,this.git1=this.git1||this.secondaryColor,this.git2=this.git2||this.tertiaryColor,this.git3=this.git3||q(this.primaryColor,{h:-30}),this.git4=this.git4||q(this.primaryColor,{h:-60}),this.git5=this.git5||q(this.primaryColor,{h:-90}),this.git6=this.git6||q(this.primaryColor,{h:60}),this.git7=this.git7||q(this.primaryColor,{h:120}),this.darkMode?(this.git0=ue(this.git0,25),this.git1=ue(this.git1,25),this.git2=ue(this.git2,25),this.git3=ue(this.git3,25),this.git4=ue(this.git4,25),this.git5=ue(this.git5,25),this.git6=ue(this.git6,25),this.git7=ue(this.git7,25)):(this.git0=be(this.git0,25),this.git1=be(this.git1,25),this.git2=be(this.git2,25),this.git3=be(this.git3,25),this.git4=be(this.git4,25),this.git5=be(this.git5,25),this.git6=be(this.git6,25),this.git7=be(this.git7,25)),this.gitInv0=this.gitInv0||ne(this.git0),this.gitInv1=this.gitInv1||ne(this.git1),this.gitInv2=this.gitInv2||ne(this.git2),this.gitInv3=this.gitInv3||ne(this.git3),this.gitInv4=this.gitInv4||ne(this.git4),this.gitInv5=this.gitInv5||ne(this.git5),this.gitInv6=this.gitInv6||ne(this.git6),this.gitInv7=this.gitInv7||ne(this.git7),this.branchLabelColor=this.branchLabelColor||(this.darkMode?"black":this.labelTextColor),this.gitBranchLabel0=this.gitBranchLabel0||this.branchLabelColor,this.gitBranchLabel1=this.gitBranchLabel1||this.branchLabelColor,this.gitBranchLabel2=this.gitBranchLabel2||this.branchLabelColor,this.gitBranchLabel3=this.gitBranchLabel3||this.branchLabelColor,this.gitBranchLabel4=this.gitBranchLabel4||this.branchLabelColor,this.gitBranchLabel5=this.gitBranchLabel5||this.branchLabelColor,this.gitBranchLabel6=this.gitBranchLabel6||this.branchLabelColor,this.gitBranchLabel7=this.gitBranchLabel7||this.branchLabelColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||xl,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||yl}calculate(t){if(typeof t!="object"){this.updateColors();return}const r=Object.keys(t);r.forEach(n=>{this[n]=t[n]}),this.updateColors(),r.forEach(n=>{this[n]=t[n]})}},b(Ps,"Theme"),Ps),eA=b(e=>{const t=new JE;return t.calculate(e),t},"getThemeVariables"),Fs,tA=(Fs=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=ue(this.primaryColor,16),this.tertiaryColor=q(this.primaryColor,{h:-160}),this.primaryBorderColor=ne(this.background),this.secondaryBorderColor=zt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=zt(this.tertiaryColor,this.darkMode),this.primaryTextColor=ne(this.primaryColor),this.secondaryTextColor=ne(this.secondaryColor),this.tertiaryTextColor=ne(this.tertiaryColor),this.lineColor=ne(this.background),this.textColor=ne(this.background),this.mainBkg="#1f2020",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=ue(ne("#323D47"),10),this.lineColor="calculated",this.border1="#ccc",this.border2=Yi(255,255,255,.25),this.arrowheadColor="calculated",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.labelBackground="#181818",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="#F9FFFE",this.edgeLabelBackground="calculated",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="calculated",this.actorLineColor="calculated",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="calculated",this.activationBkgColor="calculated",this.sequenceNumberColor="black",this.sectionBkgColor=be("#EAE8D9",30),this.altSectionBkgColor="calculated",this.sectionBkgColor2="#EAE8D9",this.excludeBkgColor=be(this.sectionBkgColor,10),this.taskBorderColor=Yi(255,255,255,70),this.taskBkgColor="calculated",this.taskTextColor="calculated",this.taskTextLightColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor=Yi(255,255,255,50),this.activeTaskBkgColor="#81B1DB",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="grey",this.critBorderColor="#E83737",this.critBkgColor="#E83737",this.taskTextDarkColor="calculated",this.todayLineColor="#DB5757",this.vertLineColor="#00BFFF",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd=this.rowOdd||ue(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||be(this.mainBkg,10),this.labelColor="calculated",this.errorBkgColor="#a44141",this.errorTextColor="#ddd"}updateColors(){this.secondBkg=ue(this.mainBkg,16),this.lineColor=this.mainContrastColor,this.arrowheadColor=this.mainContrastColor,this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.edgeLabelBackground=ue(this.labelBackground,25),this.actorBorder=this.border1,this.actorBkg=this.mainBkg,this.actorTextColor=this.mainContrastColor,this.actorLineColor=this.actorBorder,this.signalColor=this.mainContrastColor,this.signalTextColor=this.mainContrastColor,this.labelBoxBkgColor=this.actorBkg,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.mainContrastColor,this.loopTextColor=this.mainContrastColor,this.noteBorderColor=this.secondaryBorderColor,this.noteBkgColor=this.secondBkg,this.noteTextColor=this.secondaryTextColor,this.activationBorderColor=this.border1,this.activationBkgColor=this.secondBkg,this.altSectionBkgColor=this.background,this.taskBkgColor=ue(this.mainBkg,23),this.taskTextColor=this.darkTextColor,this.taskTextLightColor=this.mainContrastColor,this.taskTextOutsideColor=this.taskTextLightColor,this.gridColor=this.mainContrastColor,this.doneTaskBkgColor=this.mainContrastColor,this.taskTextDarkColor=this.darkTextColor,this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#555",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.primaryBorderColor,this.specialStateColor="#f4f4f4",this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=q(this.primaryColor,{h:64}),this.fillType3=q(this.secondaryColor,{h:64}),this.fillType4=q(this.primaryColor,{h:-64}),this.fillType5=q(this.secondaryColor,{h:-64}),this.fillType6=q(this.primaryColor,{h:128}),this.fillType7=q(this.secondaryColor,{h:128}),this.cScale1=this.cScale1||"#0b0000",this.cScale2=this.cScale2||"#4d1037",this.cScale3=this.cScale3||"#3f5258",this.cScale4=this.cScale4||"#4f2f1b",this.cScale5=this.cScale5||"#6e0a0a",this.cScale6=this.cScale6||"#3b0048",this.cScale7=this.cScale7||"#995a01",this.cScale8=this.cScale8||"#154706",this.cScale9=this.cScale9||"#161722",this.cScale10=this.cScale10||"#00296f",this.cScale11=this.cScale11||"#01629c",this.cScale12=this.cScale12||"#010029",this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||q(this.primaryColor,{h:30}),this.cScale4=this.cScale4||q(this.primaryColor,{h:60}),this.cScale5=this.cScale5||q(this.primaryColor,{h:90}),this.cScale6=this.cScale6||q(this.primaryColor,{h:120}),this.cScale7=this.cScale7||q(this.primaryColor,{h:150}),this.cScale8=this.cScale8||q(this.primaryColor,{h:210}),this.cScale9=this.cScale9||q(this.primaryColor,{h:270}),this.cScale10=this.cScale10||q(this.primaryColor,{h:300}),this.cScale11=this.cScale11||q(this.primaryColor,{h:330});for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["cScaleInv"+t]=this["cScaleInv"+t]||ne(this["cScale"+t]);for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["cScalePeer"+t]=this["cScalePeer"+t]||ue(this["cScale"+t],10);for(let t=0;t<5;t++)this["surface"+t]=this["surface"+t]||q(this.mainBkg,{h:30,s:-30,l:-(-10+t*4)}),this["surfacePeer"+t]=this["surfacePeer"+t]||q(this.mainBkg,{h:30,s:-30,l:-(-7+t*4)});this.scaleLabelColor=this.scaleLabelColor||(this.darkMode?"black":this.labelTextColor);for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["cScaleLabel"+t]=this["cScaleLabel"+t]||this.scaleLabelColor;for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["pie"+t]=this["cScale"+t];this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||q(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||q(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||q(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||q(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||q(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||q(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||ba(this.quadrant1Fill)?ue(this.quadrant1Fill):be(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.xyChart={backgroundColor:this.xyChart?.backgroundColor||this.background,titleColor:this.xyChart?.titleColor||this.primaryTextColor,xAxisTitleColor:this.xyChart?.xAxisTitleColor||this.primaryTextColor,xAxisLabelColor:this.xyChart?.xAxisLabelColor||this.primaryTextColor,xAxisTickColor:this.xyChart?.xAxisTickColor||this.primaryTextColor,xAxisLineColor:this.xyChart?.xAxisLineColor||this.primaryTextColor,yAxisTitleColor:this.xyChart?.yAxisTitleColor||this.primaryTextColor,yAxisLabelColor:this.xyChart?.yAxisLabelColor||this.primaryTextColor,yAxisTickColor:this.xyChart?.yAxisTickColor||this.primaryTextColor,yAxisLineColor:this.xyChart?.yAxisLineColor||this.primaryTextColor,plotColorPalette:this.xyChart?.plotColorPalette||"#3498db,#2ecc71,#e74c3c,#f1c40f,#bdc3c7,#ffffff,#34495e,#9b59b6,#1abc9c,#e67e22"},this.packet={startByteColor:this.primaryTextColor,endByteColor:this.primaryTextColor,labelColor:this.primaryTextColor,titleColor:this.primaryTextColor,blockStrokeColor:this.primaryTextColor,blockFillColor:this.background},this.radar={axisColor:this.radar?.axisColor||this.lineColor,axisStrokeWidth:this.radar?.axisStrokeWidth||2,axisLabelFontSize:this.radar?.axisLabelFontSize||12,curveOpacity:this.radar?.curveOpacity||.5,curveStrokeWidth:this.radar?.curveStrokeWidth||2,graticuleColor:this.radar?.graticuleColor||"#DEDEDE",graticuleStrokeWidth:this.radar?.graticuleStrokeWidth||1,graticuleOpacity:this.radar?.graticuleOpacity||.3,legendBoxSize:this.radar?.legendBoxSize||12,legendFontSize:this.radar?.legendFontSize||12},this.classText=this.primaryTextColor,this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||(this.darkMode?be(this.secondaryColor,30):this.secondaryColor),this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=ue(this.secondaryColor,20),this.git1=ue(this.pie2||this.secondaryColor,20),this.git2=ue(this.pie3||this.tertiaryColor,20),this.git3=ue(this.pie4||q(this.primaryColor,{h:-30}),20),this.git4=ue(this.pie5||q(this.primaryColor,{h:-60}),20),this.git5=ue(this.pie6||q(this.primaryColor,{h:-90}),10),this.git6=ue(this.pie7||q(this.primaryColor,{h:60}),10),this.git7=ue(this.pie8||q(this.primaryColor,{h:120}),20),this.gitInv0=this.gitInv0||ne(this.git0),this.gitInv1=this.gitInv1||ne(this.git1),this.gitInv2=this.gitInv2||ne(this.git2),this.gitInv3=this.gitInv3||ne(this.git3),this.gitInv4=this.gitInv4||ne(this.git4),this.gitInv5=this.gitInv5||ne(this.git5),this.gitInv6=this.gitInv6||ne(this.git6),this.gitInv7=this.gitInv7||ne(this.git7),this.gitBranchLabel0=this.gitBranchLabel0||ne(this.labelTextColor),this.gitBranchLabel1=this.gitBranchLabel1||this.labelTextColor,this.gitBranchLabel2=this.gitBranchLabel2||this.labelTextColor,this.gitBranchLabel3=this.gitBranchLabel3||ne(this.labelTextColor),this.gitBranchLabel4=this.gitBranchLabel4||this.labelTextColor,this.gitBranchLabel5=this.gitBranchLabel5||this.labelTextColor,this.gitBranchLabel6=this.gitBranchLabel6||this.labelTextColor,this.gitBranchLabel7=this.gitBranchLabel7||this.labelTextColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||ue(this.background,12),this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||ue(this.background,2),this.nodeBorder=this.nodeBorder||"#999"}calculate(t){if(typeof t!="object"){this.updateColors();return}const r=Object.keys(t);r.forEach(n=>{this[n]=t[n]}),this.updateColors(),r.forEach(n=>{this[n]=t[n]})}},b(Fs,"Theme"),Fs),rA=b(e=>{const t=new tA;return t.calculate(e),t},"getThemeVariables"),Os,nA=(Os=class{constructor(){this.background="#f4f4f4",this.primaryColor="#ECECFF",this.secondaryColor=q(this.primaryColor,{h:120}),this.secondaryColor="#ffffde",this.tertiaryColor=q(this.primaryColor,{h:-160}),this.primaryBorderColor=zt(this.primaryColor,this.darkMode),this.secondaryBorderColor=zt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=zt(this.tertiaryColor,this.darkMode),this.primaryTextColor=ne(this.primaryColor),this.secondaryTextColor=ne(this.secondaryColor),this.tertiaryTextColor=ne(this.tertiaryColor),this.lineColor=ne(this.background),this.textColor=ne(this.background),this.background="white",this.mainBkg="#ECECFF",this.secondBkg="#ffffde",this.lineColor="#333333",this.border1="#9370DB",this.border2="#aaaa33",this.arrowheadColor="#333333",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.labelBackground="rgba(232,232,232, 0.8)",this.textColor="#333",this.THEME_COLOR_LIMIT=12,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="calculated",this.edgeLabelBackground="calculated",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="black",this.actorLineColor="calculated",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="calculated",this.altSectionBkgColor="calculated",this.sectionBkgColor2="calculated",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="calculated",this.taskTextLightColor="calculated",this.taskTextColor=this.taskTextLightColor,this.taskTextDarkColor="calculated",this.taskTextOutsideColor=this.taskTextDarkColor,this.taskTextClickableColor="calculated",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="calculated",this.critBorderColor="calculated",this.critBkgColor="calculated",this.todayLineColor="calculated",this.vertLineColor="calculated",this.sectionBkgColor=Yi(102,102,255,.49),this.altSectionBkgColor="white",this.sectionBkgColor2="#fff400",this.taskBorderColor="#534fbc",this.taskBkgColor="#8a90dd",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="black",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="#534fbc",this.activeTaskBkgColor="#bfc7ff",this.gridColor="lightgrey",this.doneTaskBkgColor="lightgrey",this.doneTaskBorderColor="grey",this.critBorderColor="#ff8888",this.critBkgColor="red",this.todayLineColor="red",this.vertLineColor="navy",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd="calculated",this.rowEven="calculated",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.updateColors()}updateColors(){this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||q(this.primaryColor,{h:30}),this.cScale4=this.cScale4||q(this.primaryColor,{h:60}),this.cScale5=this.cScale5||q(this.primaryColor,{h:90}),this.cScale6=this.cScale6||q(this.primaryColor,{h:120}),this.cScale7=this.cScale7||q(this.primaryColor,{h:150}),this.cScale8=this.cScale8||q(this.primaryColor,{h:210}),this.cScale9=this.cScale9||q(this.primaryColor,{h:270}),this.cScale10=this.cScale10||q(this.primaryColor,{h:300}),this.cScale11=this.cScale11||q(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||be(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||be(this.tertiaryColor,40);for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["cScale"+t]=be(this["cScale"+t],10),this["cScalePeer"+t]=this["cScalePeer"+t]||be(this["cScale"+t],25);for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["cScaleInv"+t]=this["cScaleInv"+t]||q(this["cScale"+t],{h:180});for(let t=0;t<5;t++)this["surface"+t]=this["surface"+t]||q(this.mainBkg,{h:30,l:-(5+t*5)}),this["surfacePeer"+t]=this["surfacePeer"+t]||q(this.mainBkg,{h:30,l:-(7+t*5)});if(this.scaleLabelColor=this.scaleLabelColor!=="calculated"&&this.scaleLabelColor?this.scaleLabelColor:this.labelTextColor,this.labelTextColor!=="calculated"){this.cScaleLabel0=this.cScaleLabel0||ne(this.labelTextColor),this.cScaleLabel3=this.cScaleLabel3||ne(this.labelTextColor);for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["cScaleLabel"+t]=this["cScaleLabel"+t]||this.labelTextColor}this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.titleColor=this.textColor,this.edgeLabelBackground=this.labelBackground,this.actorBorder=ue(this.border1,23),this.actorBkg=this.mainBkg,this.labelBoxBkgColor=this.actorBkg,this.signalColor=this.textColor,this.signalTextColor=this.textColor,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.actorTextColor,this.loopTextColor=this.actorTextColor,this.noteBorderColor=this.border2,this.noteTextColor=this.actorTextColor,this.actorLineColor=this.actorBorder,this.taskTextColor=this.taskTextLightColor,this.taskTextOutsideColor=this.taskTextDarkColor,this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.rowOdd=this.rowOdd||ue(this.primaryColor,75)||"#ffffff",this.rowEven=this.rowEven||ue(this.primaryColor,1),this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.specialStateColor=this.lineColor,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.classText=this.primaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=q(this.primaryColor,{h:64}),this.fillType3=q(this.secondaryColor,{h:64}),this.fillType4=q(this.primaryColor,{h:-64}),this.fillType5=q(this.secondaryColor,{h:-64}),this.fillType6=q(this.primaryColor,{h:128}),this.fillType7=q(this.secondaryColor,{h:128}),this.pie1=this.pie1||this.primaryColor,this.pie2=this.pie2||this.secondaryColor,this.pie3=this.pie3||q(this.tertiaryColor,{l:-40}),this.pie4=this.pie4||q(this.primaryColor,{l:-10}),this.pie5=this.pie5||q(this.secondaryColor,{l:-30}),this.pie6=this.pie6||q(this.tertiaryColor,{l:-20}),this.pie7=this.pie7||q(this.primaryColor,{h:60,l:-20}),this.pie8=this.pie8||q(this.primaryColor,{h:-60,l:-40}),this.pie9=this.pie9||q(this.primaryColor,{h:120,l:-40}),this.pie10=this.pie10||q(this.primaryColor,{h:60,l:-40}),this.pie11=this.pie11||q(this.primaryColor,{h:-90,l:-40}),this.pie12=this.pie12||q(this.primaryColor,{h:120,l:-30}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||q(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||q(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||q(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||q(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||q(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||q(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||ba(this.quadrant1Fill)?ue(this.quadrant1Fill):be(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.radar={axisColor:this.radar?.axisColor||this.lineColor,axisStrokeWidth:this.radar?.axisStrokeWidth||2,axisLabelFontSize:this.radar?.axisLabelFontSize||12,curveOpacity:this.radar?.curveOpacity||.5,curveStrokeWidth:this.radar?.curveStrokeWidth||2,graticuleColor:this.radar?.graticuleColor||"#DEDEDE",graticuleStrokeWidth:this.radar?.graticuleStrokeWidth||1,graticuleOpacity:this.radar?.graticuleOpacity||.3,legendBoxSize:this.radar?.legendBoxSize||12,legendFontSize:this.radar?.legendFontSize||12},this.xyChart={backgroundColor:this.xyChart?.backgroundColor||this.background,titleColor:this.xyChart?.titleColor||this.primaryTextColor,xAxisTitleColor:this.xyChart?.xAxisTitleColor||this.primaryTextColor,xAxisLabelColor:this.xyChart?.xAxisLabelColor||this.primaryTextColor,xAxisTickColor:this.xyChart?.xAxisTickColor||this.primaryTextColor,xAxisLineColor:this.xyChart?.xAxisLineColor||this.primaryTextColor,yAxisTitleColor:this.xyChart?.yAxisTitleColor||this.primaryTextColor,yAxisLabelColor:this.xyChart?.yAxisLabelColor||this.primaryTextColor,yAxisTickColor:this.xyChart?.yAxisTickColor||this.primaryTextColor,yAxisLineColor:this.xyChart?.yAxisLineColor||this.primaryTextColor,plotColorPalette:this.xyChart?.plotColorPalette||"#ECECFF,#8493A6,#FFC3A0,#DCDDE1,#B8E994,#D1A36F,#C3CDE6,#FFB6C1,#496078,#F8F3E3"},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||this.labelBackground,this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=this.git0||this.primaryColor,this.git1=this.git1||this.secondaryColor,this.git2=this.git2||this.tertiaryColor,this.git3=this.git3||q(this.primaryColor,{h:-30}),this.git4=this.git4||q(this.primaryColor,{h:-60}),this.git5=this.git5||q(this.primaryColor,{h:-90}),this.git6=this.git6||q(this.primaryColor,{h:60}),this.git7=this.git7||q(this.primaryColor,{h:120}),this.darkMode?(this.git0=ue(this.git0,25),this.git1=ue(this.git1,25),this.git2=ue(this.git2,25),this.git3=ue(this.git3,25),this.git4=ue(this.git4,25),this.git5=ue(this.git5,25),this.git6=ue(this.git6,25),this.git7=ue(this.git7,25)):(this.git0=be(this.git0,25),this.git1=be(this.git1,25),this.git2=be(this.git2,25),this.git3=be(this.git3,25),this.git4=be(this.git4,25),this.git5=be(this.git5,25),this.git6=be(this.git6,25),this.git7=be(this.git7,25)),this.gitInv0=this.gitInv0||be(ne(this.git0),25),this.gitInv1=this.gitInv1||ne(this.git1),this.gitInv2=this.gitInv2||ne(this.git2),this.gitInv3=this.gitInv3||ne(this.git3),this.gitInv4=this.gitInv4||ne(this.git4),this.gitInv5=this.gitInv5||ne(this.git5),this.gitInv6=this.gitInv6||ne(this.git6),this.gitInv7=this.gitInv7||ne(this.git7),this.gitBranchLabel0=this.gitBranchLabel0||ne(this.labelTextColor),this.gitBranchLabel1=this.gitBranchLabel1||this.labelTextColor,this.gitBranchLabel2=this.gitBranchLabel2||this.labelTextColor,this.gitBranchLabel3=this.gitBranchLabel3||ne(this.labelTextColor),this.gitBranchLabel4=this.gitBranchLabel4||this.labelTextColor,this.gitBranchLabel5=this.gitBranchLabel5||this.labelTextColor,this.gitBranchLabel6=this.gitBranchLabel6||this.labelTextColor,this.gitBranchLabel7=this.gitBranchLabel7||this.labelTextColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||xl,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||yl}calculate(t){if(Object.keys(this).forEach(n=>{this[n]==="calculated"&&(this[n]=void 0)}),typeof t!="object"){this.updateColors();return}const r=Object.keys(t);r.forEach(n=>{this[n]=t[n]}),this.updateColors(),r.forEach(n=>{this[n]=t[n]})}},b(Os,"Theme"),Os),sA=b(e=>{const t=new nA;return t.calculate(e),t},"getThemeVariables"),zs,iA=(zs=class{constructor(){this.background="#f4f4f4",this.primaryColor="#cde498",this.secondaryColor="#cdffb2",this.background="white",this.mainBkg="#cde498",this.secondBkg="#cdffb2",this.lineColor="green",this.border1="#13540c",this.border2="#6eaa49",this.arrowheadColor="green",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.tertiaryColor=ue("#cde498",10),this.primaryBorderColor=zt(this.primaryColor,this.darkMode),this.secondaryBorderColor=zt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=zt(this.tertiaryColor,this.darkMode),this.primaryTextColor=ne(this.primaryColor),this.secondaryTextColor=ne(this.secondaryColor),this.tertiaryTextColor=ne(this.primaryColor),this.lineColor=ne(this.background),this.textColor=ne(this.background),this.THEME_COLOR_LIMIT=12,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="#333",this.edgeLabelBackground="#e8e8e8",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="black",this.actorLineColor="calculated",this.signalColor="#333",this.signalTextColor="#333",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="#326932",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="#6eaa49",this.altSectionBkgColor="white",this.sectionBkgColor2="#6eaa49",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="#487e3a",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="black",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="lightgrey",this.doneTaskBkgColor="lightgrey",this.doneTaskBorderColor="grey",this.critBorderColor="#ff8888",this.critBkgColor="red",this.todayLineColor="red",this.vertLineColor="#00BFFF",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222"}updateColors(){this.actorBorder=be(this.mainBkg,20),this.actorBkg=this.mainBkg,this.labelBoxBkgColor=this.actorBkg,this.labelTextColor=this.actorTextColor,this.loopTextColor=this.actorTextColor,this.noteBorderColor=this.border2,this.noteTextColor=this.actorTextColor,this.actorLineColor=this.actorBorder,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||q(this.primaryColor,{h:30}),this.cScale4=this.cScale4||q(this.primaryColor,{h:60}),this.cScale5=this.cScale5||q(this.primaryColor,{h:90}),this.cScale6=this.cScale6||q(this.primaryColor,{h:120}),this.cScale7=this.cScale7||q(this.primaryColor,{h:150}),this.cScale8=this.cScale8||q(this.primaryColor,{h:210}),this.cScale9=this.cScale9||q(this.primaryColor,{h:270}),this.cScale10=this.cScale10||q(this.primaryColor,{h:300}),this.cScale11=this.cScale11||q(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||be(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||be(this.tertiaryColor,40);for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["cScale"+t]=be(this["cScale"+t],10),this["cScalePeer"+t]=this["cScalePeer"+t]||be(this["cScale"+t],25);for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["cScaleInv"+t]=this["cScaleInv"+t]||q(this["cScale"+t],{h:180});this.scaleLabelColor=this.scaleLabelColor!=="calculated"&&this.scaleLabelColor?this.scaleLabelColor:this.labelTextColor;for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["cScaleLabel"+t]=this["cScaleLabel"+t]||this.scaleLabelColor;for(let t=0;t<5;t++)this["surface"+t]=this["surface"+t]||q(this.mainBkg,{h:30,s:-30,l:-(5+t*5)}),this["surfacePeer"+t]=this["surfacePeer"+t]||q(this.mainBkg,{h:30,s:-30,l:-(8+t*5)});this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.taskBorderColor=this.border1,this.taskTextColor=this.taskTextLightColor,this.taskTextOutsideColor=this.taskTextDarkColor,this.activeTaskBorderColor=this.taskBorderColor,this.activeTaskBkgColor=this.mainBkg,this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.rowOdd=this.rowOdd||ue(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||ue(this.mainBkg,20),this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.primaryBorderColor,this.specialStateColor=this.lineColor,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.classText=this.primaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=q(this.primaryColor,{h:64}),this.fillType3=q(this.secondaryColor,{h:64}),this.fillType4=q(this.primaryColor,{h:-64}),this.fillType5=q(this.secondaryColor,{h:-64}),this.fillType6=q(this.primaryColor,{h:128}),this.fillType7=q(this.secondaryColor,{h:128}),this.pie1=this.pie1||this.primaryColor,this.pie2=this.pie2||this.secondaryColor,this.pie3=this.pie3||this.tertiaryColor,this.pie4=this.pie4||q(this.primaryColor,{l:-30}),this.pie5=this.pie5||q(this.secondaryColor,{l:-30}),this.pie6=this.pie6||q(this.tertiaryColor,{h:40,l:-40}),this.pie7=this.pie7||q(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||q(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||q(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||q(this.primaryColor,{h:60,l:-50}),this.pie11=this.pie11||q(this.primaryColor,{h:-60,l:-50}),this.pie12=this.pie12||q(this.primaryColor,{h:120,l:-50}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||q(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||q(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||q(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||q(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||q(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||q(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||ba(this.quadrant1Fill)?ue(this.quadrant1Fill):be(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.packet={startByteColor:this.primaryTextColor,endByteColor:this.primaryTextColor,labelColor:this.primaryTextColor,titleColor:this.primaryTextColor,blockStrokeColor:this.primaryTextColor,blockFillColor:this.mainBkg},this.radar={axisColor:this.radar?.axisColor||this.lineColor,axisStrokeWidth:this.radar?.axisStrokeWidth||2,axisLabelFontSize:this.radar?.axisLabelFontSize||12,curveOpacity:this.radar?.curveOpacity||.5,curveStrokeWidth:this.radar?.curveStrokeWidth||2,graticuleColor:this.radar?.graticuleColor||"#DEDEDE",graticuleStrokeWidth:this.radar?.graticuleStrokeWidth||1,graticuleOpacity:this.radar?.graticuleOpacity||.3,legendBoxSize:this.radar?.legendBoxSize||12,legendFontSize:this.radar?.legendFontSize||12},this.xyChart={backgroundColor:this.xyChart?.backgroundColor||this.background,titleColor:this.xyChart?.titleColor||this.primaryTextColor,xAxisTitleColor:this.xyChart?.xAxisTitleColor||this.primaryTextColor,xAxisLabelColor:this.xyChart?.xAxisLabelColor||this.primaryTextColor,xAxisTickColor:this.xyChart?.xAxisTickColor||this.primaryTextColor,xAxisLineColor:this.xyChart?.xAxisLineColor||this.primaryTextColor,yAxisTitleColor:this.xyChart?.yAxisTitleColor||this.primaryTextColor,yAxisLabelColor:this.xyChart?.yAxisLabelColor||this.primaryTextColor,yAxisTickColor:this.xyChart?.yAxisTickColor||this.primaryTextColor,yAxisLineColor:this.xyChart?.yAxisLineColor||this.primaryTextColor,plotColorPalette:this.xyChart?.plotColorPalette||"#CDE498,#FF6B6B,#A0D2DB,#D7BDE2,#F0F0F0,#FFC3A0,#7FD8BE,#FF9A8B,#FAF3E0,#FFF176"},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||this.edgeLabelBackground,this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=this.git0||this.primaryColor,this.git1=this.git1||this.secondaryColor,this.git2=this.git2||this.tertiaryColor,this.git3=this.git3||q(this.primaryColor,{h:-30}),this.git4=this.git4||q(this.primaryColor,{h:-60}),this.git5=this.git5||q(this.primaryColor,{h:-90}),this.git6=this.git6||q(this.primaryColor,{h:60}),this.git7=this.git7||q(this.primaryColor,{h:120}),this.darkMode?(this.git0=ue(this.git0,25),this.git1=ue(this.git1,25),this.git2=ue(this.git2,25),this.git3=ue(this.git3,25),this.git4=ue(this.git4,25),this.git5=ue(this.git5,25),this.git6=ue(this.git6,25),this.git7=ue(this.git7,25)):(this.git0=be(this.git0,25),this.git1=be(this.git1,25),this.git2=be(this.git2,25),this.git3=be(this.git3,25),this.git4=be(this.git4,25),this.git5=be(this.git5,25),this.git6=be(this.git6,25),this.git7=be(this.git7,25)),this.gitInv0=this.gitInv0||ne(this.git0),this.gitInv1=this.gitInv1||ne(this.git1),this.gitInv2=this.gitInv2||ne(this.git2),this.gitInv3=this.gitInv3||ne(this.git3),this.gitInv4=this.gitInv4||ne(this.git4),this.gitInv5=this.gitInv5||ne(this.git5),this.gitInv6=this.gitInv6||ne(this.git6),this.gitInv7=this.gitInv7||ne(this.git7),this.gitBranchLabel0=this.gitBranchLabel0||ne(this.labelTextColor),this.gitBranchLabel1=this.gitBranchLabel1||this.labelTextColor,this.gitBranchLabel2=this.gitBranchLabel2||this.labelTextColor,this.gitBranchLabel3=this.gitBranchLabel3||ne(this.labelTextColor),this.gitBranchLabel4=this.gitBranchLabel4||this.labelTextColor,this.gitBranchLabel5=this.gitBranchLabel5||this.labelTextColor,this.gitBranchLabel6=this.gitBranchLabel6||this.labelTextColor,this.gitBranchLabel7=this.gitBranchLabel7||this.labelTextColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||xl,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||yl}calculate(t){if(typeof t!="object"){this.updateColors();return}const r=Object.keys(t);r.forEach(n=>{this[n]=t[n]}),this.updateColors(),r.forEach(n=>{this[n]=t[n]})}},b(zs,"Theme"),zs),aA=b(e=>{const t=new iA;return t.calculate(e),t},"getThemeVariables"),Ws,oA=(Ws=class{constructor(){this.primaryColor="#eee",this.contrast="#707070",this.secondaryColor=ue(this.contrast,55),this.background="#ffffff",this.tertiaryColor=q(this.primaryColor,{h:-160}),this.primaryBorderColor=zt(this.primaryColor,this.darkMode),this.secondaryBorderColor=zt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=zt(this.tertiaryColor,this.darkMode),this.primaryTextColor=ne(this.primaryColor),this.secondaryTextColor=ne(this.secondaryColor),this.tertiaryTextColor=ne(this.tertiaryColor),this.lineColor=ne(this.background),this.textColor=ne(this.background),this.mainBkg="#eee",this.secondBkg="calculated",this.lineColor="#666",this.border1="#999",this.border2="calculated",this.note="#ffa",this.text="#333",this.critical="#d42",this.done="#bbb",this.arrowheadColor="#333333",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.THEME_COLOR_LIMIT=12,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="calculated",this.edgeLabelBackground="white",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="calculated",this.actorLineColor=this.actorBorder,this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="calculated",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="calculated",this.altSectionBkgColor="white",this.sectionBkgColor2="calculated",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="calculated",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="calculated",this.critBkgColor="calculated",this.critBorderColor="calculated",this.todayLineColor="calculated",this.vertLineColor="calculated",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd=this.rowOdd||ue(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||"#f4f4f4",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222"}updateColors(){this.secondBkg=ue(this.contrast,55),this.border2=this.contrast,this.actorBorder=ue(this.border1,23),this.actorBkg=this.mainBkg,this.actorTextColor=this.text,this.actorLineColor=this.actorBorder,this.signalColor=this.text,this.signalTextColor=this.text,this.labelBoxBkgColor=this.actorBkg,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.text,this.loopTextColor=this.text,this.noteBorderColor="#999",this.noteBkgColor="#666",this.noteTextColor="#fff",this.cScale0=this.cScale0||"#555",this.cScale1=this.cScale1||"#F4F4F4",this.cScale2=this.cScale2||"#555",this.cScale3=this.cScale3||"#BBB",this.cScale4=this.cScale4||"#777",this.cScale5=this.cScale5||"#999",this.cScale6=this.cScale6||"#DDD",this.cScale7=this.cScale7||"#FFF",this.cScale8=this.cScale8||"#DDD",this.cScale9=this.cScale9||"#BBB",this.cScale10=this.cScale10||"#999",this.cScale11=this.cScale11||"#777";for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["cScaleInv"+t]=this["cScaleInv"+t]||ne(this["cScale"+t]);for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this.darkMode?this["cScalePeer"+t]=this["cScalePeer"+t]||ue(this["cScale"+t],10):this["cScalePeer"+t]=this["cScalePeer"+t]||be(this["cScale"+t],10);this.scaleLabelColor=this.scaleLabelColor||(this.darkMode?"black":this.labelTextColor),this.cScaleLabel0=this.cScaleLabel0||this.cScale1,this.cScaleLabel2=this.cScaleLabel2||this.cScale1;for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["cScaleLabel"+t]=this["cScaleLabel"+t]||this.scaleLabelColor;for(let t=0;t<5;t++)this["surface"+t]=this["surface"+t]||q(this.mainBkg,{l:-(5+t*5)}),this["surfacePeer"+t]=this["surfacePeer"+t]||q(this.mainBkg,{l:-(8+t*5)});this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.titleColor=this.text,this.sectionBkgColor=ue(this.contrast,30),this.sectionBkgColor2=ue(this.contrast,30),this.taskBorderColor=be(this.contrast,10),this.taskBkgColor=this.contrast,this.taskTextColor=this.taskTextLightColor,this.taskTextDarkColor=this.text,this.taskTextOutsideColor=this.taskTextDarkColor,this.activeTaskBorderColor=this.taskBorderColor,this.activeTaskBkgColor=this.mainBkg,this.gridColor=ue(this.border1,30),this.doneTaskBkgColor=this.done,this.doneTaskBorderColor=this.lineColor,this.critBkgColor=this.critical,this.critBorderColor=be(this.critBkgColor,10),this.todayLineColor=this.critBkgColor,this.vertLineColor=this.critBkgColor,this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.transitionColor=this.transitionColor||"#000",this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f4f4f4",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.stateBorder=this.stateBorder||"#000",this.innerEndBackground=this.primaryBorderColor,this.specialStateColor="#222",this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.classText=this.primaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=q(this.primaryColor,{h:64}),this.fillType3=q(this.secondaryColor,{h:64}),this.fillType4=q(this.primaryColor,{h:-64}),this.fillType5=q(this.secondaryColor,{h:-64}),this.fillType6=q(this.primaryColor,{h:128}),this.fillType7=q(this.secondaryColor,{h:128});for(let t=0;t<this.THEME_COLOR_LIMIT;t++)this["pie"+t]=this["cScale"+t];this.pie12=this.pie0,this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||q(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||q(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||q(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||q(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||q(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||q(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||ba(this.quadrant1Fill)?ue(this.quadrant1Fill):be(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.xyChart={backgroundColor:this.xyChart?.backgroundColor||this.background,titleColor:this.xyChart?.titleColor||this.primaryTextColor,xAxisTitleColor:this.xyChart?.xAxisTitleColor||this.primaryTextColor,xAxisLabelColor:this.xyChart?.xAxisLabelColor||this.primaryTextColor,xAxisTickColor:this.xyChart?.xAxisTickColor||this.primaryTextColor,xAxisLineColor:this.xyChart?.xAxisLineColor||this.primaryTextColor,yAxisTitleColor:this.xyChart?.yAxisTitleColor||this.primaryTextColor,yAxisLabelColor:this.xyChart?.yAxisLabelColor||this.primaryTextColor,yAxisTickColor:this.xyChart?.yAxisTickColor||this.primaryTextColor,yAxisLineColor:this.xyChart?.yAxisLineColor||this.primaryTextColor,plotColorPalette:this.xyChart?.plotColorPalette||"#EEE,#6BB8E4,#8ACB88,#C7ACD6,#E8DCC2,#FFB2A8,#FFF380,#7E8D91,#FFD8B1,#FAF3E0"},this.radar={axisColor:this.radar?.axisColor||this.lineColor,axisStrokeWidth:this.radar?.axisStrokeWidth||2,axisLabelFontSize:this.radar?.axisLabelFontSize||12,curveOpacity:this.radar?.curveOpacity||.5,curveStrokeWidth:this.radar?.curveStrokeWidth||2,graticuleColor:this.radar?.graticuleColor||"#DEDEDE",graticuleStrokeWidth:this.radar?.graticuleStrokeWidth||1,graticuleOpacity:this.radar?.graticuleOpacity||.3,legendBoxSize:this.radar?.legendBoxSize||12,legendFontSize:this.radar?.legendFontSize||12},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||this.edgeLabelBackground,this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=be(this.pie1,25)||this.primaryColor,this.git1=this.pie2||this.secondaryColor,this.git2=this.pie3||this.tertiaryColor,this.git3=this.pie4||q(this.primaryColor,{h:-30}),this.git4=this.pie5||q(this.primaryColor,{h:-60}),this.git5=this.pie6||q(this.primaryColor,{h:-90}),this.git6=this.pie7||q(this.primaryColor,{h:60}),this.git7=this.pie8||q(this.primaryColor,{h:120}),this.gitInv0=this.gitInv0||ne(this.git0),this.gitInv1=this.gitInv1||ne(this.git1),this.gitInv2=this.gitInv2||ne(this.git2),this.gitInv3=this.gitInv3||ne(this.git3),this.gitInv4=this.gitInv4||ne(this.git4),this.gitInv5=this.gitInv5||ne(this.git5),this.gitInv6=this.gitInv6||ne(this.git6),this.gitInv7=this.gitInv7||ne(this.git7),this.branchLabelColor=this.branchLabelColor||this.labelTextColor,this.gitBranchLabel0=this.branchLabelColor,this.gitBranchLabel1="white",this.gitBranchLabel2=this.branchLabelColor,this.gitBranchLabel3="white",this.gitBranchLabel4=this.branchLabelColor,this.gitBranchLabel5=this.branchLabelColor,this.gitBranchLabel6=this.branchLabelColor,this.gitBranchLabel7=this.branchLabelColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||xl,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||yl}calculate(t){if(typeof t!="object"){this.updateColors();return}const r=Object.keys(t);r.forEach(n=>{this[n]=t[n]}),this.updateColors(),r.forEach(n=>{this[n]=t[n]})}},b(Ws,"Theme"),Ws),lA=b(e=>{const t=new oA;return t.calculate(e),t},"getThemeVariables"),an={base:{getThemeVariables:eA},dark:{getThemeVariables:rA},default:{getThemeVariables:sA},forest:{getThemeVariables:aA},neutral:{getThemeVariables:lA}},Br={flowchart:{useMaxWidth:!0,titleTopMargin:25,subGraphTitleMargin:{top:0,bottom:0},diagramPadding:8,htmlLabels:!0,nodeSpacing:50,rankSpacing:50,curve:"basis",padding:15,defaultRenderer:"dagre-wrapper",wrappingWidth:200,inheritDir:!1},sequence:{useMaxWidth:!0,hideUnusedParticipants:!1,activationWidth:10,diagramMarginX:50,diagramMarginY:10,actorMargin:50,width:150,height:65,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",mirrorActors:!0,forceMenus:!1,bottomMarginAdj:1,rightAngles:!1,showSequenceNumbers:!1,actorFontSize:14,actorFontFamily:'"Open Sans", sans-serif',actorFontWeight:400,noteFontSize:14,noteFontFamily:'"trebuchet ms", verdana, arial, sans-serif',noteFontWeight:400,noteAlign:"center",messageFontSize:16,messageFontFamily:'"trebuchet ms", verdana, arial, sans-serif',messageFontWeight:400,wrap:!1,wrapPadding:10,labelBoxWidth:50,labelBoxHeight:20},gantt:{useMaxWidth:!0,titleTopMargin:25,barHeight:20,barGap:4,topPadding:50,rightPadding:75,leftPadding:75,gridLineStartPadding:35,fontSize:11,sectionFontSize:11,numberSectionStyles:4,axisFormat:"%Y-%m-%d",topAxis:!1,displayMode:"",weekday:"sunday"},journey:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,leftMargin:150,maxLabelWidth:360,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"],titleColor:"",titleFontFamily:'"trebuchet ms", verdana, arial, sans-serif',titleFontSize:"4ex"},class:{useMaxWidth:!0,titleTopMargin:25,arrowMarkerAbsolute:!1,dividerMargin:10,padding:5,textHeight:10,defaultRenderer:"dagre-wrapper",htmlLabels:!1,hideEmptyMembersBox:!1},state:{useMaxWidth:!0,titleTopMargin:25,dividerMargin:10,sizeUnit:5,padding:8,textHeight:10,titleShift:-15,noteMargin:10,forkWidth:70,forkHeight:7,miniPadding:2,fontSizeFactor:5.02,fontSize:24,labelHeight:16,edgeLengthFactor:"20",compositTitleSize:35,radius:5,defaultRenderer:"dagre-wrapper"},er:{useMaxWidth:!0,titleTopMargin:25,diagramPadding:20,layoutDirection:"TB",minEntityWidth:100,minEntityHeight:75,entityPadding:15,nodeSpacing:140,rankSpacing:80,stroke:"gray",fill:"honeydew",fontSize:12},pie:{useMaxWidth:!0,textPosition:.75},quadrantChart:{useMaxWidth:!0,chartWidth:500,chartHeight:500,titleFontSize:20,titlePadding:10,quadrantPadding:5,xAxisLabelPadding:5,yAxisLabelPadding:5,xAxisLabelFontSize:16,yAxisLabelFontSize:16,quadrantLabelFontSize:16,quadrantTextTopPadding:5,pointTextPadding:5,pointLabelFontSize:12,pointRadius:5,xAxisPosition:"top",yAxisPosition:"left",quadrantInternalBorderStrokeWidth:1,quadrantExternalBorderStrokeWidth:2},xyChart:{useMaxWidth:!0,width:700,height:500,titleFontSize:20,titlePadding:10,showDataLabel:!1,showTitle:!0,xAxis:{$ref:"#/$defs/XYChartAxisConfig",showLabel:!0,labelFontSize:14,labelPadding:5,showTitle:!0,titleFontSize:16,titlePadding:5,showTick:!0,tickLength:5,tickWidth:2,showAxisLine:!0,axisLineWidth:2},yAxis:{$ref:"#/$defs/XYChartAxisConfig",showLabel:!0,labelFontSize:14,labelPadding:5,showTitle:!0,titleFontSize:16,titlePadding:5,showTick:!0,tickLength:5,tickWidth:2,showAxisLine:!0,axisLineWidth:2},chartOrientation:"vertical",plotReservedSpacePercent:50},requirement:{useMaxWidth:!0,rect_fill:"#f9f9f9",text_color:"#333",rect_border_size:"0.5px",rect_border_color:"#bbb",rect_min_width:200,rect_min_height:200,fontSize:14,rect_padding:10,line_height:20},mindmap:{useMaxWidth:!0,padding:10,maxNodeWidth:200,layoutAlgorithm:"cose-bilkent"},kanban:{useMaxWidth:!0,padding:8,sectionWidth:200,ticketBaseUrl:""},timeline:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,leftMargin:150,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"],disableMulticolor:!1},gitGraph:{useMaxWidth:!0,titleTopMargin:25,diagramPadding:8,nodeLabel:{width:75,height:100,x:-25,y:0},mainBranchName:"main",mainBranchOrder:0,showCommitLabel:!0,showBranches:!0,rotateCommitLabel:!0,parallelCommits:!1,arrowMarkerAbsolute:!1},c4:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,c4ShapeMargin:50,c4ShapePadding:20,width:216,height:60,boxMargin:10,c4ShapeInRow:4,nextLinePaddingX:0,c4BoundaryInRow:2,personFontSize:14,personFontFamily:'"Open Sans", sans-serif',personFontWeight:"normal",external_personFontSize:14,external_personFontFamily:'"Open Sans", sans-serif',external_personFontWeight:"normal",systemFontSize:14,systemFontFamily:'"Open Sans", sans-serif',systemFontWeight:"normal",external_systemFontSize:14,external_systemFontFamily:'"Open Sans", sans-serif',external_systemFontWeight:"normal",system_dbFontSize:14,system_dbFontFamily:'"Open Sans", sans-serif',system_dbFontWeight:"normal",external_system_dbFontSize:14,external_system_dbFontFamily:'"Open Sans", sans-serif',external_system_dbFontWeight:"normal",system_queueFontSize:14,system_queueFontFamily:'"Open Sans", sans-serif',system_queueFontWeight:"normal",external_system_queueFontSize:14,external_system_queueFontFamily:'"Open Sans", sans-serif',external_system_queueFontWeight:"normal",boundaryFontSize:14,boundaryFontFamily:'"Open Sans", sans-serif',boundaryFontWeight:"normal",messageFontSize:12,messageFontFamily:'"Open Sans", sans-serif',messageFontWeight:"normal",containerFontSize:14,containerFontFamily:'"Open Sans", sans-serif',containerFontWeight:"normal",external_containerFontSize:14,external_containerFontFamily:'"Open Sans", sans-serif',external_containerFontWeight:"normal",container_dbFontSize:14,container_dbFontFamily:'"Open Sans", sans-serif',container_dbFontWeight:"normal",external_container_dbFontSize:14,external_container_dbFontFamily:'"Open Sans", sans-serif',external_container_dbFontWeight:"normal",container_queueFontSize:14,container_queueFontFamily:'"Open Sans", sans-serif',container_queueFontWeight:"normal",external_container_queueFontSize:14,external_container_queueFontFamily:'"Open Sans", sans-serif',external_container_queueFontWeight:"normal",componentFontSize:14,componentFontFamily:'"Open Sans", sans-serif',componentFontWeight:"normal",external_componentFontSize:14,external_componentFontFamily:'"Open Sans", sans-serif',external_componentFontWeight:"normal",component_dbFontSize:14,component_dbFontFamily:'"Open Sans", sans-serif',component_dbFontWeight:"normal",external_component_dbFontSize:14,external_component_dbFontFamily:'"Open Sans", sans-serif',external_component_dbFontWeight:"normal",component_queueFontSize:14,component_queueFontFamily:'"Open Sans", sans-serif',component_queueFontWeight:"normal",external_component_queueFontSize:14,external_component_queueFontFamily:'"Open Sans", sans-serif',external_component_queueFontWeight:"normal",wrap:!0,wrapPadding:10,person_bg_color:"#08427B",person_border_color:"#073B6F",external_person_bg_color:"#686868",external_person_border_color:"#8A8A8A",system_bg_color:"#1168BD",system_border_color:"#3C7FC0",system_db_bg_color:"#1168BD",system_db_border_color:"#3C7FC0",system_queue_bg_color:"#1168BD",system_queue_border_color:"#3C7FC0",external_system_bg_color:"#999999",external_system_border_color:"#8A8A8A",external_system_db_bg_color:"#999999",external_system_db_border_color:"#8A8A8A",external_system_queue_bg_color:"#999999",external_system_queue_border_color:"#8A8A8A",container_bg_color:"#438DD5",container_border_color:"#3C7FC0",container_db_bg_color:"#438DD5",container_db_border_color:"#3C7FC0",container_queue_bg_color:"#438DD5",container_queue_border_color:"#3C7FC0",external_container_bg_color:"#B3B3B3",external_container_border_color:"#A6A6A6",external_container_db_bg_color:"#B3B3B3",external_container_db_border_color:"#A6A6A6",external_container_queue_bg_color:"#B3B3B3",external_container_queue_border_color:"#A6A6A6",component_bg_color:"#85BBF0",component_border_color:"#78A8D8",component_db_bg_color:"#85BBF0",component_db_border_color:"#78A8D8",component_queue_bg_color:"#85BBF0",component_queue_border_color:"#78A8D8",external_component_bg_color:"#CCCCCC",external_component_border_color:"#BFBFBF",external_component_db_bg_color:"#CCCCCC",external_component_db_border_color:"#BFBFBF",external_component_queue_bg_color:"#CCCCCC",external_component_queue_border_color:"#BFBFBF"},sankey:{useMaxWidth:!0,width:600,height:400,linkColor:"gradient",nodeAlignment:"justify",showValues:!0,prefix:"",suffix:""},block:{useMaxWidth:!0,padding:8},packet:{useMaxWidth:!0,rowHeight:32,bitWidth:32,bitsPerRow:32,showBits:!0,paddingX:5,paddingY:5},architecture:{useMaxWidth:!0,padding:40,iconSize:80,fontSize:16},radar:{useMaxWidth:!0,width:600,height:600,marginTop:50,marginRight:50,marginBottom:50,marginLeft:50,axisScaleFactor:1,axisLabelFactor:1.05,curveTension:.17},theme:"default",look:"classic",handDrawnSeed:0,layout:"dagre",maxTextSize:5e4,maxEdges:500,darkMode:!1,fontFamily:'"trebuchet ms", verdana, arial, sans-serif;',logLevel:5,securityLevel:"strict",startOnLoad:!0,arrowMarkerAbsolute:!1,secure:["secure","securityLevel","startOnLoad","maxTextSize","suppressErrorRendering","maxEdges"],legacyMathML:!1,forceLegacyMathML:!1,deterministicIds:!1,fontSize:16,markdownAutoWrap:!0,suppressErrorRendering:!1},F0={...Br,deterministicIDSeed:void 0,elk:{mergeEdges:!1,nodePlacementStrategy:"BRANDES_KOEPF",forceNodeModelOrder:!1,considerModelOrder:"NODES_AND_EDGES"},themeCSS:void 0,themeVariables:an.default.getThemeVariables(),sequence:{...Br.sequence,messageFont:b(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont"),noteFont:b(function(){return{fontFamily:this.noteFontFamily,fontSize:this.noteFontSize,fontWeight:this.noteFontWeight}},"noteFont"),actorFont:b(function(){return{fontFamily:this.actorFontFamily,fontSize:this.actorFontSize,fontWeight:this.actorFontWeight}},"actorFont")},class:{hideEmptyMembersBox:!1},gantt:{...Br.gantt,tickInterval:void 0,useWidth:void 0},c4:{...Br.c4,useWidth:void 0,personFont:b(function(){return{fontFamily:this.personFontFamily,fontSize:this.personFontSize,fontWeight:this.personFontWeight}},"personFont"),flowchart:{...Br.flowchart,inheritDir:!1},external_personFont:b(function(){return{fontFamily:this.external_personFontFamily,fontSize:this.external_personFontSize,fontWeight:this.external_personFontWeight}},"external_personFont"),systemFont:b(function(){return{fontFamily:this.systemFontFamily,fontSize:this.systemFontSize,fontWeight:this.systemFontWeight}},"systemFont"),external_systemFont:b(function(){return{fontFamily:this.external_systemFontFamily,fontSize:this.external_systemFontSize,fontWeight:this.external_systemFontWeight}},"external_systemFont"),system_dbFont:b(function(){return{fontFamily:this.system_dbFontFamily,fontSize:this.system_dbFontSize,fontWeight:this.system_dbFontWeight}},"system_dbFont"),external_system_dbFont:b(function(){return{fontFamily:this.external_system_dbFontFamily,fontSize:this.external_system_dbFontSize,fontWeight:this.external_system_dbFontWeight}},"external_system_dbFont"),system_queueFont:b(function(){return{fontFamily:this.system_queueFontFamily,fontSize:this.system_queueFontSize,fontWeight:this.system_queueFontWeight}},"system_queueFont"),external_system_queueFont:b(function(){return{fontFamily:this.external_system_queueFontFamily,fontSize:this.external_system_queueFontSize,fontWeight:this.external_system_queueFontWeight}},"external_system_queueFont"),containerFont:b(function(){return{fontFamily:this.containerFontFamily,fontSize:this.containerFontSize,fontWeight:this.containerFontWeight}},"containerFont"),external_containerFont:b(function(){return{fontFamily:this.external_containerFontFamily,fontSize:this.external_containerFontSize,fontWeight:this.external_containerFontWeight}},"external_containerFont"),container_dbFont:b(function(){return{fontFamily:this.container_dbFontFamily,fontSize:this.container_dbFontSize,fontWeight:this.container_dbFontWeight}},"container_dbFont"),external_container_dbFont:b(function(){return{fontFamily:this.external_container_dbFontFamily,fontSize:this.external_container_dbFontSize,fontWeight:this.external_container_dbFontWeight}},"external_container_dbFont"),container_queueFont:b(function(){return{fontFamily:this.container_queueFontFamily,fontSize:this.container_queueFontSize,fontWeight:this.container_queueFontWeight}},"container_queueFont"),external_container_queueFont:b(function(){return{fontFamily:this.external_container_queueFontFamily,fontSize:this.external_container_queueFontSize,fontWeight:this.external_container_queueFontWeight}},"external_container_queueFont"),componentFont:b(function(){return{fontFamily:this.componentFontFamily,fontSize:this.componentFontSize,fontWeight:this.componentFontWeight}},"componentFont"),external_componentFont:b(function(){return{fontFamily:this.external_componentFontFamily,fontSize:this.external_componentFontSize,fontWeight:this.external_componentFontWeight}},"external_componentFont"),component_dbFont:b(function(){return{fontFamily:this.component_dbFontFamily,fontSize:this.component_dbFontSize,fontWeight:this.component_dbFontWeight}},"component_dbFont"),external_component_dbFont:b(function(){return{fontFamily:this.external_component_dbFontFamily,fontSize:this.external_component_dbFontSize,fontWeight:this.external_component_dbFontWeight}},"external_component_dbFont"),component_queueFont:b(function(){return{fontFamily:this.component_queueFontFamily,fontSize:this.component_queueFontSize,fontWeight:this.component_queueFontWeight}},"component_queueFont"),external_component_queueFont:b(function(){return{fontFamily:this.external_component_queueFontFamily,fontSize:this.external_component_queueFontSize,fontWeight:this.external_component_queueFontWeight}},"external_component_queueFont"),boundaryFont:b(function(){return{fontFamily:this.boundaryFontFamily,fontSize:this.boundaryFontSize,fontWeight:this.boundaryFontWeight}},"boundaryFont"),messageFont:b(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont")},pie:{...Br.pie,useWidth:984},xyChart:{...Br.xyChart,useWidth:void 0},requirement:{...Br.requirement,useWidth:void 0},packet:{...Br.packet},radar:{...Br.radar},treemap:{useMaxWidth:!0,padding:10,diagramPadding:8,showValues:!0,nodeWidth:100,nodeHeight:40,borderWidth:1,valueFontSize:12,labelFontSize:14,valueFormat:","}},O0=b((e,t="")=>Object.keys(e).reduce((r,n)=>Array.isArray(e[n])?r:typeof e[n]=="object"&&e[n]!==null?[...r,t+n,...O0(e[n],"")]:[...r,t+n],[]),"keyify"),cA=new Set(O0(F0,"")),z0=F0,_o=b(e=>{if(K.debug("sanitizeDirective called with",e),!(typeof e!="object"||e==null)){if(Array.isArray(e)){e.forEach(t=>_o(t));return}for(const t of Object.keys(e)){if(K.debug("Checking key",t),t.startsWith("__")||t.includes("proto")||t.includes("constr")||!cA.has(t)||e[t]==null){K.debug("sanitize deleting key: ",t),delete e[t];continue}if(typeof e[t]=="object"){K.debug("sanitizing object",t),_o(e[t]);continue}const r=["themeCSS","fontFamily","altFontFamily"];for(const n of r)t.includes(n)&&(K.debug("sanitizing css option",t),e[t]=uA(e[t]))}if(e.themeVariables)for(const t of Object.keys(e.themeVariables)){const r=e.themeVariables[t];r?.match&&!r.match(/^[\d "#%(),.;A-Za-z]+$/)&&(e.themeVariables[t]="")}K.debug("After sanitization",e)}},"sanitizeDirective"),uA=b(e=>{let t=0,r=0;for(const n of e){if(t<r)return"{ /* ERROR: Unbalanced CSS */ }";n==="{"?t++:n==="}"&&r++}return t!==r?"{ /* ERROR: Unbalanced CSS */ }":e},"sanitizeCss"),Ys=Object.freeze(z0),tr=Ct({},Ys),To,is=[],Ki=Ct({},Ys),bl=b((e,t)=>{let r=Ct({},e),n={};for(const s of t)q0(s),n=Ct(n,s);if(r=Ct(r,n),n.theme&&n.theme in an){const s=Ct({},To),i=Ct(s.themeVariables||{},n.themeVariables);r.theme&&r.theme in an&&(r.themeVariables=an[r.theme].getThemeVariables(i))}return Ki=r,U0(Ki),Ki},"updateCurrentConfig"),hA=b(e=>(tr=Ct({},Ys),tr=Ct(tr,e),e.theme&&an[e.theme]&&(tr.themeVariables=an[e.theme].getThemeVariables(e.themeVariables)),bl(tr,is),tr),"setSiteConfig"),dA=b(e=>{To=Ct({},e)},"saveConfigFromInitialize"),fA=b(e=>(tr=Ct(tr,e),bl(tr,is),tr),"updateSiteConfig"),W0=b(()=>Ct({},tr),"getSiteConfig"),H0=b(e=>(U0(e),Ct(Ki,e),$t()),"setConfig"),$t=b(()=>Ct({},Ki),"getConfig"),q0=b(e=>{e&&(["secure",...tr.secure??[]].forEach(t=>{Object.hasOwn(e,t)&&(K.debug(`Denied attempt to modify a secure key ${t}`,e[t]),delete e[t])}),Object.keys(e).forEach(t=>{t.startsWith("__")&&delete e[t]}),Object.keys(e).forEach(t=>{typeof e[t]=="string"&&(e[t].includes("<")||e[t].includes(">")||e[t].includes("url(data:"))&&delete e[t],typeof e[t]=="object"&&q0(e[t])}))},"sanitize"),gA=b(e=>{_o(e),e.fontFamily&&!e.themeVariables?.fontFamily&&(e.themeVariables={...e.themeVariables,fontFamily:e.fontFamily}),is.push(e),bl(tr,is)},"addDirective"),No=b((e=tr)=>{is=[],bl(e,is)},"reset"),pA={LAZY_LOAD_DEPRECATED:"The configuration options lazyLoadedDiagrams and loadExternalDiagramsAtStartup are deprecated. Please use registerExternalDiagrams instead."},tg={},mA=b(e=>{tg[e]||(K.warn(pA[e]),tg[e]=!0)},"issueWarning"),U0=b(e=>{e&&(e.lazyLoadedDiagrams||e.loadExternalDiagramsAtStartup)&&mA("LAZY_LOAD_DEPRECATED")},"checkConfig"),w9=b(()=>{let e={};To&&(e=Ct(e,To));for(const t of is)e=Ct(e,t);return e},"getUserDefinedConfig"),ka=/<br\s*\/?>/gi,xA=b(e=>e?Y0(e).replace(/\\n/g,"#br#").split("#br#"):[""],"getRows"),yA=(()=>{let e=!1;return()=>{e||(V0(),e=!0)}})();function V0(){const e="data-temp-href-target";Gs.addHook("beforeSanitizeAttributes",t=>{t.tagName==="A"&&t.hasAttribute("target")&&t.setAttribute(e,t.getAttribute("target")??"")}),Gs.addHook("afterSanitizeAttributes",t=>{t.tagName==="A"&&t.hasAttribute(e)&&(t.setAttribute("target",t.getAttribute(e)??""),t.removeAttribute(e),t.getAttribute("target")==="_blank"&&t.setAttribute("rel","noopener"))})}b(V0,"setupDompurifyHooks");var G0=b(e=>(yA(),Gs.sanitize(e)),"removeScript"),rg=b((e,t)=>{if(t.flowchart?.htmlLabels!==!1){const r=t.securityLevel;r==="antiscript"||r==="strict"?e=G0(e):r!=="loose"&&(e=Y0(e),e=e.replace(/</g,"&lt;").replace(/>/g,"&gt;"),e=e.replace(/=/g,"&equals;"),e=vA(e))}return e},"sanitizeMore"),yr=b((e,t)=>e&&(t.dompurifyConfig?e=Gs.sanitize(rg(e,t),t.dompurifyConfig).toString():e=Gs.sanitize(rg(e,t),{FORBID_TAGS:["style"]}).toString(),e),"sanitizeText"),bA=b((e,t)=>typeof e=="string"?yr(e,t):e.flat().map(r=>yr(r,t)),"sanitizeTextOrArray"),kA=b(e=>ka.test(e),"hasBreaks"),wA=b(e=>e.split(ka),"splitBreaks"),vA=b(e=>e.replace(/#br#/g,"<br/>"),"placeholderToBreak"),Y0=b(e=>e.replace(ka,"#br#"),"breakToPlaceholder"),CA=b(e=>{let t="";return e&&(t=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,t=CSS.escape(t)),t},"getUrl"),_t=b(e=>!(e===!1||["false","null","0"].includes(String(e).trim().toLowerCase())),"evaluate"),SA=b(function(...e){const t=e.filter(r=>!isNaN(r));return Math.max(...t)},"getMax"),_A=b(function(...e){const t=e.filter(r=>!isNaN(r));return Math.min(...t)},"getMin"),ng=b(function(e){const t=e.split(/(,)/),r=[];for(let n=0;n<t.length;n++){let s=t[n];if(s===","&&n>0&&n+1<t.length){const i=t[n-1],a=t[n+1];TA(i,a)&&(s=i+","+a,n++,r.pop())}r.push(NA(s))}return r.join("")},"parseGenericTypes"),yu=b((e,t)=>Math.max(0,e.split(t).length-1),"countOccurrence"),TA=b((e,t)=>{const r=yu(e,"~"),n=yu(t,"~");return r===1&&n===1},"shouldCombineSets"),NA=b(e=>{const t=yu(e,"~");let r=!1;if(t<=1)return e;t%2!==0&&e.startsWith("~")&&(e=e.substring(1),r=!0);const n=[...e];let s=n.indexOf("~"),i=n.lastIndexOf("~");for(;s!==-1&&i!==-1&&s!==i;)n[s]="<",n[i]=">",s=n.indexOf("~"),i=n.lastIndexOf("~");return r&&n.unshift("~"),n.join("")},"processSet"),sg=b(()=>window.MathMLElement!==void 0,"isMathMLSupported"),bu=/\$\$(.*)\$\$/g,Xs=b(e=>(e.match(bu)?.length??0)>0,"hasKatex"),v9=b(async(e,t)=>{const r=document.createElement("div");r.innerHTML=await Gh(e,t),r.id="katex-temp",r.style.visibility="hidden",r.style.position="absolute",r.style.top="0",document.querySelector("body")?.insertAdjacentElement("beforeend",r);const s={width:r.clientWidth,height:r.clientHeight};return r.remove(),s},"calculateMathMLDimensions"),EA=b(async(e,t)=>{if(!Xs(e))return e;if(!(sg()||t.legacyMathML||t.forceLegacyMathML))return e.replace(bu,"MathML is unsupported in this environment.");{const{default:r}=await Ue(async()=>{const{default:s}=await import("./katex-qrhCpa0F.js");return{default:s}},[]),n=t.forceLegacyMathML||!sg()&&t.legacyMathML?"htmlAndMathml":"mathml";return e.split(ka).map(s=>Xs(s)?`<div style="display: flex; align-items: center; justify-content: center; white-space: nowrap;">${s}</div>`:`<div>${s}</div>`).join("").replace(bu,(s,i)=>r.renderToString(i,{throwOnError:!0,displayMode:!0,output:n}).replace(/\n/g," ").replace(/<annotation.*<\/annotation>/g,""))}},"renderKatexUnsanitized"),Gh=b(async(e,t)=>yr(await EA(e,t),t),"renderKatexSanitized"),si={getRows:xA,sanitizeText:yr,sanitizeTextOrArray:bA,hasBreaks:kA,splitBreaks:wA,lineBreakRegex:ka,removeScript:G0,getUrl:CA,evaluate:_t,getMax:SA,getMin:_A},AA=b(function(e,t){for(let r of t)e.attr(r[0],r[1])},"d3Attrs"),MA=b(function(e,t,r){let n=new Map;return r?(n.set("width","100%"),n.set("style",`max-width: ${t}px;`)):(n.set("height",e),n.set("width",t)),n},"calculateSvgSizeAttrs"),X0=b(function(e,t,r,n){const s=MA(t,r,n);AA(e,s)},"configureSvgSize"),jA=b(function(e,t,r,n){const s=t.node().getBBox(),i=s.width,a=s.height;K.info(`SVG bounds: ${i}x${a}`,s);let o=0,l=0;K.info(`Graph bounds: ${o}x${l}`,e),o=i+r*2,l=a+r*2,K.info(`Calculated bounds: ${o}x${l}`),X0(t,l,o,n);const c=`${s.x-r} ${s.y-r} ${s.width+2*r} ${s.height+2*r}`;t.attr("viewBox",c)},"setupGraphViewbox"),lo={},IA=b((e,t,r)=>{let n="";return e in lo&&lo[e]?n=lo[e](r):K.warn(`No theme found for ${e}`),` & {
138
+ font-family: ${r.fontFamily};
139
+ font-size: ${r.fontSize};
140
+ fill: ${r.textColor}
141
+ }
142
+ @keyframes edge-animation-frame {
143
+ from {
144
+ stroke-dashoffset: 0;
145
+ }
146
+ }
147
+ @keyframes dash {
148
+ to {
149
+ stroke-dashoffset: 0;
150
+ }
151
+ }
152
+ & .edge-animation-slow {
153
+ stroke-dasharray: 9,5 !important;
154
+ stroke-dashoffset: 900;
155
+ animation: dash 50s linear infinite;
156
+ stroke-linecap: round;
157
+ }
158
+ & .edge-animation-fast {
159
+ stroke-dasharray: 9,5 !important;
160
+ stroke-dashoffset: 900;
161
+ animation: dash 20s linear infinite;
162
+ stroke-linecap: round;
163
+ }
164
+ /* Classes common for multiple diagrams */
165
+
166
+ & .error-icon {
167
+ fill: ${r.errorBkgColor};
168
+ }
169
+ & .error-text {
170
+ fill: ${r.errorTextColor};
171
+ stroke: ${r.errorTextColor};
172
+ }
173
+
174
+ & .edge-thickness-normal {
175
+ stroke-width: 1px;
176
+ }
177
+ & .edge-thickness-thick {
178
+ stroke-width: 3.5px
179
+ }
180
+ & .edge-pattern-solid {
181
+ stroke-dasharray: 0;
182
+ }
183
+ & .edge-thickness-invisible {
184
+ stroke-width: 0;
185
+ fill: none;
186
+ }
187
+ & .edge-pattern-dashed{
188
+ stroke-dasharray: 3;
189
+ }
190
+ .edge-pattern-dotted {
191
+ stroke-dasharray: 2;
192
+ }
193
+
194
+ & .marker {
195
+ fill: ${r.lineColor};
196
+ stroke: ${r.lineColor};
197
+ }
198
+ & .marker.cross {
199
+ stroke: ${r.lineColor};
200
+ }
201
+
202
+ & svg {
203
+ font-family: ${r.fontFamily};
204
+ font-size: ${r.fontSize};
205
+ }
206
+ & p {
207
+ margin: 0
208
+ }
209
+
210
+ ${n}
211
+
212
+ ${t}
213
+ `},"getStyles"),LA=b((e,t)=>{t!==void 0&&(lo[e]=t)},"addStylesForDiagram"),$A=IA,K0={};vE(K0,{clear:()=>DA,getAccDescription:()=>FA,getAccTitle:()=>RA,getDiagramTitle:()=>zA,setAccDescription:()=>PA,setAccTitle:()=>BA,setDiagramTitle:()=>OA});var Yh="",Xh="",Kh="",Qh=b(e=>yr(e,$t()),"sanitizeText"),DA=b(()=>{Yh="",Kh="",Xh=""},"clear"),BA=b(e=>{Yh=Qh(e).replace(/^\s+/g,"")},"setAccTitle"),RA=b(()=>Yh,"getAccTitle"),PA=b(e=>{Kh=Qh(e).replace(/\n\s+/g,`
214
+ `)},"setAccDescription"),FA=b(()=>Kh,"getAccDescription"),OA=b(e=>{Xh=Qh(e)},"setDiagramTitle"),zA=b(()=>Xh,"getDiagramTitle"),ig=K,WA=Uh,He=$t,C9=H0,S9=Ys,Zh=b(e=>yr(e,He()),"sanitizeText"),HA=jA,qA=b(()=>K0,"getCommonDb"),Eo={},Ao=b((e,t,r)=>{Eo[e]&&ig.warn(`Diagram with id ${e} already registered. Overwriting.`),Eo[e]=t,r&&P0(e,r),LA(e,t.styles),t.injectUtils?.(ig,WA,He,Zh,HA,qA(),()=>{})},"registerDiagram"),ku=b(e=>{if(e in Eo)return Eo[e];throw new UA(e)},"getDiagram"),Hs,UA=(Hs=class extends Error{constructor(t){super(`Diagram ${t} not found.`)}},b(Hs,"DiagramNotFoundError"),Hs),VA={value:()=>{}};function Q0(){for(var e=0,t=arguments.length,r={},n;e<t;++e){if(!(n=arguments[e]+"")||n in r||/[\s.]/.test(n))throw new Error("illegal type: "+n);r[n]=[]}return new co(r)}function co(e){this._=e}function GA(e,t){return e.trim().split(/^|\s+/).map(function(r){var n="",s=r.indexOf(".");if(s>=0&&(n=r.slice(s+1),r=r.slice(0,s)),r&&!t.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:n}})}co.prototype=Q0.prototype={constructor:co,on:function(e,t){var r=this._,n=GA(e+"",r),s,i=-1,a=n.length;if(arguments.length<2){for(;++i<a;)if((s=(e=n[i]).type)&&(s=YA(r[s],e.name)))return s;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<a;)if(s=(e=n[i]).type)r[s]=ag(r[s],e.name,t);else if(t==null)for(s in r)r[s]=ag(r[s],e.name,null);return this},copy:function(){var e={},t=this._;for(var r in t)e[r]=t[r].slice();return new co(e)},call:function(e,t){if((s=arguments.length-2)>0)for(var r=new Array(s),n=0,s,i;n<s;++n)r[n]=arguments[n+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],n=0,s=i.length;n<s;++n)i[n].value.apply(t,r)},apply:function(e,t,r){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var n=this._[e],s=0,i=n.length;s<i;++s)n[s].value.apply(t,r)}};function YA(e,t){for(var r=0,n=e.length,s;r<n;++r)if((s=e[r]).name===t)return s.value}function ag(e,t,r){for(var n=0,s=e.length;n<s;++n)if(e[n].name===t){e[n]=VA,e=e.slice(0,n).concat(e.slice(n+1));break}return r!=null&&e.push({name:t,value:r}),e}var wu="http://www.w3.org/1999/xhtml";const og={svg:"http://www.w3.org/2000/svg",xhtml:wu,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function kl(e){var t=e+="",r=t.indexOf(":");return r>=0&&(t=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),og.hasOwnProperty(t)?{space:og[t],local:e}:e}function XA(e){return function(){var t=this.ownerDocument,r=this.namespaceURI;return r===wu&&t.documentElement.namespaceURI===wu?t.createElement(e):t.createElementNS(r,e)}}function KA(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Z0(e){var t=kl(e);return(t.local?KA:XA)(t)}function QA(){}function Jh(e){return e==null?QA:function(){return this.querySelector(e)}}function ZA(e){typeof e!="function"&&(e=Jh(e));for(var t=this._groups,r=t.length,n=new Array(r),s=0;s<r;++s)for(var i=t[s],a=i.length,o=n[s]=new Array(a),l,c,u=0;u<a;++u)(l=i[u])&&(c=e.call(l,l.__data__,u,i))&&("__data__"in l&&(c.__data__=l.__data__),o[u]=c);return new cr(n,this._parents)}function JA(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function eM(){return[]}function J0(e){return e==null?eM:function(){return this.querySelectorAll(e)}}function tM(e){return function(){return JA(e.apply(this,arguments))}}function rM(e){typeof e=="function"?e=tM(e):e=J0(e);for(var t=this._groups,r=t.length,n=[],s=[],i=0;i<r;++i)for(var a=t[i],o=a.length,l,c=0;c<o;++c)(l=a[c])&&(n.push(e.call(l,l.__data__,c,a)),s.push(l));return new cr(n,s)}function ex(e){return function(){return this.matches(e)}}function tx(e){return function(t){return t.matches(e)}}var nM=Array.prototype.find;function sM(e){return function(){return nM.call(this.children,e)}}function iM(){return this.firstElementChild}function aM(e){return this.select(e==null?iM:sM(typeof e=="function"?e:tx(e)))}var oM=Array.prototype.filter;function lM(){return Array.from(this.children)}function cM(e){return function(){return oM.call(this.children,e)}}function uM(e){return this.selectAll(e==null?lM:cM(typeof e=="function"?e:tx(e)))}function hM(e){typeof e!="function"&&(e=ex(e));for(var t=this._groups,r=t.length,n=new Array(r),s=0;s<r;++s)for(var i=t[s],a=i.length,o=n[s]=[],l,c=0;c<a;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&o.push(l);return new cr(n,this._parents)}function rx(e){return new Array(e.length)}function dM(){return new cr(this._enter||this._groups.map(rx),this._parents)}function Mo(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Mo.prototype={constructor:Mo,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function fM(e){return function(){return e}}function gM(e,t,r,n,s,i){for(var a=0,o,l=t.length,c=i.length;a<c;++a)(o=t[a])?(o.__data__=i[a],n[a]=o):r[a]=new Mo(e,i[a]);for(;a<l;++a)(o=t[a])&&(s[a]=o)}function pM(e,t,r,n,s,i,a){var o,l,c=new Map,u=t.length,h=i.length,f=new Array(u),g;for(o=0;o<u;++o)(l=t[o])&&(f[o]=g=a.call(l,l.__data__,o,t)+"",c.has(g)?s[o]=l:c.set(g,l));for(o=0;o<h;++o)g=a.call(e,i[o],o,i)+"",(l=c.get(g))?(n[o]=l,l.__data__=i[o],c.delete(g)):r[o]=new Mo(e,i[o]);for(o=0;o<u;++o)(l=t[o])&&c.get(f[o])===l&&(s[o]=l)}function mM(e){return e.__data__}function xM(e,t){if(!arguments.length)return Array.from(this,mM);var r=t?pM:gM,n=this._parents,s=this._groups;typeof e!="function"&&(e=fM(e));for(var i=s.length,a=new Array(i),o=new Array(i),l=new Array(i),c=0;c<i;++c){var u=n[c],h=s[c],f=h.length,g=yM(e.call(u,u&&u.__data__,c,n)),p=g.length,m=o[c]=new Array(p),y=a[c]=new Array(p),x=l[c]=new Array(f);r(u,h,m,y,x,g,t);for(var k=0,C=0,T,S;k<p;++k)if(T=m[k]){for(k>=C&&(C=k+1);!(S=y[C])&&++C<p;);T._next=S||null}}return a=new cr(a,n),a._enter=o,a._exit=l,a}function yM(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function bM(){return new cr(this._exit||this._groups.map(rx),this._parents)}function kM(e,t,r){var n=this.enter(),s=this,i=this.exit();return typeof e=="function"?(n=e(n),n&&(n=n.selection())):n=n.append(e+""),t!=null&&(s=t(s),s&&(s=s.selection())),r==null?i.remove():r(i),n&&s?n.merge(s).order():s}function wM(e){for(var t=e.selection?e.selection():e,r=this._groups,n=t._groups,s=r.length,i=n.length,a=Math.min(s,i),o=new Array(s),l=0;l<a;++l)for(var c=r[l],u=n[l],h=c.length,f=o[l]=new Array(h),g,p=0;p<h;++p)(g=c[p]||u[p])&&(f[p]=g);for(;l<s;++l)o[l]=r[l];return new cr(o,this._parents)}function vM(){for(var e=this._groups,t=-1,r=e.length;++t<r;)for(var n=e[t],s=n.length-1,i=n[s],a;--s>=0;)(a=n[s])&&(i&&a.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(a,i),i=a);return this}function CM(e){e||(e=SM);function t(h,f){return h&&f?e(h.__data__,f.__data__):!h-!f}for(var r=this._groups,n=r.length,s=new Array(n),i=0;i<n;++i){for(var a=r[i],o=a.length,l=s[i]=new Array(o),c,u=0;u<o;++u)(c=a[u])&&(l[u]=c);l.sort(t)}return new cr(s,this._parents).order()}function SM(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function _M(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function TM(){return Array.from(this)}function NM(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var n=e[t],s=0,i=n.length;s<i;++s){var a=n[s];if(a)return a}return null}function EM(){let e=0;for(const t of this)++e;return e}function AM(){return!this.node()}function MM(e){for(var t=this._groups,r=0,n=t.length;r<n;++r)for(var s=t[r],i=0,a=s.length,o;i<a;++i)(o=s[i])&&e.call(o,o.__data__,i,s);return this}function jM(e){return function(){this.removeAttribute(e)}}function IM(e){return function(){this.removeAttributeNS(e.space,e.local)}}function LM(e,t){return function(){this.setAttribute(e,t)}}function $M(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function DM(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttribute(e):this.setAttribute(e,r)}}function BM(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,r)}}function RM(e,t){var r=kl(e);if(arguments.length<2){var n=this.node();return r.local?n.getAttributeNS(r.space,r.local):n.getAttribute(r)}return this.each((t==null?r.local?IM:jM:typeof t=="function"?r.local?BM:DM:r.local?$M:LM)(r,t))}function nx(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function PM(e){return function(){this.style.removeProperty(e)}}function FM(e,t,r){return function(){this.style.setProperty(e,t,r)}}function OM(e,t,r){return function(){var n=t.apply(this,arguments);n==null?this.style.removeProperty(e):this.style.setProperty(e,n,r)}}function zM(e,t,r){return arguments.length>1?this.each((t==null?PM:typeof t=="function"?OM:FM)(e,t,r??"")):Ks(this.node(),e)}function Ks(e,t){return e.style.getPropertyValue(t)||nx(e).getComputedStyle(e,null).getPropertyValue(t)}function WM(e){return function(){delete this[e]}}function HM(e,t){return function(){this[e]=t}}function qM(e,t){return function(){var r=t.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function UM(e,t){return arguments.length>1?this.each((t==null?WM:typeof t=="function"?qM:HM)(e,t)):this.node()[e]}function sx(e){return e.trim().split(/^|\s+/)}function ed(e){return e.classList||new ix(e)}function ix(e){this._node=e,this._names=sx(e.getAttribute("class")||"")}ix.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function ax(e,t){for(var r=ed(e),n=-1,s=t.length;++n<s;)r.add(t[n])}function ox(e,t){for(var r=ed(e),n=-1,s=t.length;++n<s;)r.remove(t[n])}function VM(e){return function(){ax(this,e)}}function GM(e){return function(){ox(this,e)}}function YM(e,t){return function(){(t.apply(this,arguments)?ax:ox)(this,e)}}function XM(e,t){var r=sx(e+"");if(arguments.length<2){for(var n=ed(this.node()),s=-1,i=r.length;++s<i;)if(!n.contains(r[s]))return!1;return!0}return this.each((typeof t=="function"?YM:t?VM:GM)(r,t))}function KM(){this.textContent=""}function QM(e){return function(){this.textContent=e}}function ZM(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function JM(e){return arguments.length?this.each(e==null?KM:(typeof e=="function"?ZM:QM)(e)):this.node().textContent}function ej(){this.innerHTML=""}function tj(e){return function(){this.innerHTML=e}}function rj(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function nj(e){return arguments.length?this.each(e==null?ej:(typeof e=="function"?rj:tj)(e)):this.node().innerHTML}function sj(){this.nextSibling&&this.parentNode.appendChild(this)}function ij(){return this.each(sj)}function aj(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function oj(){return this.each(aj)}function lj(e){var t=typeof e=="function"?e:Z0(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function cj(){return null}function uj(e,t){var r=typeof e=="function"?e:Z0(e),n=t==null?cj:typeof t=="function"?t:Jh(t);return this.select(function(){return this.insertBefore(r.apply(this,arguments),n.apply(this,arguments)||null)})}function hj(){var e=this.parentNode;e&&e.removeChild(this)}function dj(){return this.each(hj)}function fj(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function gj(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function pj(e){return this.select(e?gj:fj)}function mj(e){return arguments.length?this.property("__data__",e):this.node().__data__}function xj(e){return function(t){e.call(this,t,this.__data__)}}function yj(e){return e.trim().split(/^|\s+/).map(function(t){var r="",n=t.indexOf(".");return n>=0&&(r=t.slice(n+1),t=t.slice(0,n)),{type:t,name:r}})}function bj(e){return function(){var t=this.__on;if(t){for(var r=0,n=-1,s=t.length,i;r<s;++r)i=t[r],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++n]=i;++n?t.length=n:delete this.__on}}}function kj(e,t,r){return function(){var n=this.__on,s,i=xj(t);if(n){for(var a=0,o=n.length;a<o;++a)if((s=n[a]).type===e.type&&s.name===e.name){this.removeEventListener(s.type,s.listener,s.options),this.addEventListener(s.type,s.listener=i,s.options=r),s.value=t;return}}this.addEventListener(e.type,i,r),s={type:e.type,name:e.name,value:t,listener:i,options:r},n?n.push(s):this.__on=[s]}}function wj(e,t,r){var n=yj(e+""),s,i=n.length,a;if(arguments.length<2){var o=this.node().__on;if(o){for(var l=0,c=o.length,u;l<c;++l)for(s=0,u=o[l];s<i;++s)if((a=n[s]).type===u.type&&a.name===u.name)return u.value}return}for(o=t?kj:bj,s=0;s<i;++s)this.each(o(n[s],t,r));return this}function lx(e,t,r){var n=nx(e),s=n.CustomEvent;typeof s=="function"?s=new s(t,r):(s=n.document.createEvent("Event"),r?(s.initEvent(t,r.bubbles,r.cancelable),s.detail=r.detail):s.initEvent(t,!1,!1)),e.dispatchEvent(s)}function vj(e,t){return function(){return lx(this,e,t)}}function Cj(e,t){return function(){return lx(this,e,t.apply(this,arguments))}}function Sj(e,t){return this.each((typeof t=="function"?Cj:vj)(e,t))}function*_j(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var n=e[t],s=0,i=n.length,a;s<i;++s)(a=n[s])&&(yield a)}var cx=[null];function cr(e,t){this._groups=e,this._parents=t}function wa(){return new cr([[document.documentElement]],cx)}function Tj(){return this}cr.prototype=wa.prototype={constructor:cr,select:ZA,selectAll:rM,selectChild:aM,selectChildren:uM,filter:hM,data:xM,enter:dM,exit:bM,join:kM,merge:wM,selection:Tj,order:vM,sort:CM,call:_M,nodes:TM,node:NM,size:EM,empty:AM,each:MM,attr:RM,style:zM,property:UM,classed:XM,text:JM,html:nj,raise:ij,lower:oj,append:lj,insert:uj,remove:dj,clone:pj,datum:mj,on:wj,dispatch:Sj,[Symbol.iterator]:_j};function Oe(e){return typeof e=="string"?new cr([[document.querySelector(e)]],[document.documentElement]):new cr([[e]],cx)}function td(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function ux(e,t){var r=Object.create(e.prototype);for(var n in t)r[n]=t[n];return r}function va(){}var ra=.7,jo=1/ra,Ds="\\s*([+-]?\\d+)\\s*",na="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Hr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Nj=/^#([0-9a-f]{3,8})$/,Ej=new RegExp(`^rgb\\(${Ds},${Ds},${Ds}\\)$`),Aj=new RegExp(`^rgb\\(${Hr},${Hr},${Hr}\\)$`),Mj=new RegExp(`^rgba\\(${Ds},${Ds},${Ds},${na}\\)$`),jj=new RegExp(`^rgba\\(${Hr},${Hr},${Hr},${na}\\)$`),Ij=new RegExp(`^hsl\\(${na},${Hr},${Hr}\\)$`),Lj=new RegExp(`^hsla\\(${na},${Hr},${Hr},${na}\\)$`),lg={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};td(va,sa,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:cg,formatHex:cg,formatHex8:$j,formatHsl:Dj,formatRgb:ug,toString:ug});function cg(){return this.rgb().formatHex()}function $j(){return this.rgb().formatHex8()}function Dj(){return hx(this).formatHsl()}function ug(){return this.rgb().formatRgb()}function sa(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=Nj.exec(e))?(r=t[1].length,t=parseInt(t[1],16),r===6?hg(t):r===3?new nr(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?Ua(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?Ua(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Ej.exec(e))?new nr(t[1],t[2],t[3],1):(t=Aj.exec(e))?new nr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Mj.exec(e))?Ua(t[1],t[2],t[3],t[4]):(t=jj.exec(e))?Ua(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Ij.exec(e))?gg(t[1],t[2]/100,t[3]/100,1):(t=Lj.exec(e))?gg(t[1],t[2]/100,t[3]/100,t[4]):lg.hasOwnProperty(e)?hg(lg[e]):e==="transparent"?new nr(NaN,NaN,NaN,0):null}function hg(e){return new nr(e>>16&255,e>>8&255,e&255,1)}function Ua(e,t,r,n){return n<=0&&(e=t=r=NaN),new nr(e,t,r,n)}function Bj(e){return e instanceof va||(e=sa(e)),e?(e=e.rgb(),new nr(e.r,e.g,e.b,e.opacity)):new nr}function vu(e,t,r,n){return arguments.length===1?Bj(e):new nr(e,t,r,n??1)}function nr(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}td(nr,vu,ux(va,{brighter(e){return e=e==null?jo:Math.pow(jo,e),new nr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ra:Math.pow(ra,e),new nr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new nr(Jn(this.r),Jn(this.g),Jn(this.b),Io(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:dg,formatHex:dg,formatHex8:Rj,formatRgb:fg,toString:fg}));function dg(){return`#${Xn(this.r)}${Xn(this.g)}${Xn(this.b)}`}function Rj(){return`#${Xn(this.r)}${Xn(this.g)}${Xn(this.b)}${Xn((isNaN(this.opacity)?1:this.opacity)*255)}`}function fg(){const e=Io(this.opacity);return`${e===1?"rgb(":"rgba("}${Jn(this.r)}, ${Jn(this.g)}, ${Jn(this.b)}${e===1?")":`, ${e})`}`}function Io(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Jn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Xn(e){return e=Jn(e),(e<16?"0":"")+e.toString(16)}function gg(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new Nr(e,t,r,n)}function hx(e){if(e instanceof Nr)return new Nr(e.h,e.s,e.l,e.opacity);if(e instanceof va||(e=sa(e)),!e)return new Nr;if(e instanceof Nr)return e;e=e.rgb();var t=e.r/255,r=e.g/255,n=e.b/255,s=Math.min(t,r,n),i=Math.max(t,r,n),a=NaN,o=i-s,l=(i+s)/2;return o?(t===i?a=(r-n)/o+(r<n)*6:r===i?a=(n-t)/o+2:a=(t-r)/o+4,o/=l<.5?i+s:2-i-s,a*=60):o=l>0&&l<1?0:a,new Nr(a,o,l,e.opacity)}function Pj(e,t,r,n){return arguments.length===1?hx(e):new Nr(e,t,r,n??1)}function Nr(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}td(Nr,Pj,ux(va,{brighter(e){return e=e==null?jo:Math.pow(jo,e),new Nr(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ra:Math.pow(ra,e),new Nr(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,s=2*r-n;return new nr(jc(e>=240?e-240:e+120,s,n),jc(e,s,n),jc(e<120?e+240:e-120,s,n),this.opacity)},clamp(){return new Nr(pg(this.h),Va(this.s),Va(this.l),Io(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Io(this.opacity);return`${e===1?"hsl(":"hsla("}${pg(this.h)}, ${Va(this.s)*100}%, ${Va(this.l)*100}%${e===1?")":`, ${e})`}`}}));function pg(e){return e=(e||0)%360,e<0?e+360:e}function Va(e){return Math.max(0,Math.min(1,e||0))}function jc(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}const rd=e=>()=>e;function dx(e,t){return function(r){return e+r*t}}function Fj(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(n){return Math.pow(e+n*t,r)}}function _9(e,t){var r=t-e;return r?dx(e,r>180||r<-180?r-360*Math.round(r/360):r):rd(isNaN(e)?t:e)}function Oj(e){return(e=+e)==1?fx:function(t,r){return r-t?Fj(t,r,e):rd(isNaN(t)?r:t)}}function fx(e,t){var r=t-e;return r?dx(e,r):rd(isNaN(e)?t:e)}const mg=(function e(t){var r=Oj(t);function n(s,i){var a=r((s=vu(s)).r,(i=vu(i)).r),o=r(s.g,i.g),l=r(s.b,i.b),c=fx(s.opacity,i.opacity);return function(u){return s.r=a(u),s.g=o(u),s.b=l(u),s.opacity=c(u),s+""}}return n.gamma=e,n})(1);function Sn(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}}var Cu=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ic=new RegExp(Cu.source,"g");function zj(e){return function(){return e}}function Wj(e){return function(t){return e(t)+""}}function Hj(e,t){var r=Cu.lastIndex=Ic.lastIndex=0,n,s,i,a=-1,o=[],l=[];for(e=e+"",t=t+"";(n=Cu.exec(e))&&(s=Ic.exec(t));)(i=s.index)>r&&(i=t.slice(r,i),o[a]?o[a]+=i:o[++a]=i),(n=n[0])===(s=s[0])?o[a]?o[a]+=s:o[++a]=s:(o[++a]=null,l.push({i:a,x:Sn(n,s)})),r=Ic.lastIndex;return r<t.length&&(i=t.slice(r),o[a]?o[a]+=i:o[++a]=i),o.length<2?l[0]?Wj(l[0].x):zj(t):(t=l.length,function(c){for(var u=0,h;u<t;++u)o[(h=l[u]).i]=h.x(c);return o.join("")})}var xg=180/Math.PI,Su={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function gx(e,t,r,n,s,i){var a,o,l;return(a=Math.sqrt(e*e+t*t))&&(e/=a,t/=a),(l=e*r+t*n)&&(r-=e*l,n-=t*l),(o=Math.sqrt(r*r+n*n))&&(r/=o,n/=o,l/=o),e*n<t*r&&(e=-e,t=-t,l=-l,a=-a),{translateX:s,translateY:i,rotate:Math.atan2(t,e)*xg,skewX:Math.atan(l)*xg,scaleX:a,scaleY:o}}var Ga;function qj(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Su:gx(t.a,t.b,t.c,t.d,t.e,t.f)}function Uj(e){return e==null||(Ga||(Ga=document.createElementNS("http://www.w3.org/2000/svg","g")),Ga.setAttribute("transform",e),!(e=Ga.transform.baseVal.consolidate()))?Su:(e=e.matrix,gx(e.a,e.b,e.c,e.d,e.e,e.f))}function px(e,t,r,n){function s(c){return c.length?c.pop()+" ":""}function i(c,u,h,f,g,p){if(c!==h||u!==f){var m=g.push("translate(",null,t,null,r);p.push({i:m-4,x:Sn(c,h)},{i:m-2,x:Sn(u,f)})}else(h||f)&&g.push("translate("+h+t+f+r)}function a(c,u,h,f){c!==u?(c-u>180?u+=360:u-c>180&&(c+=360),f.push({i:h.push(s(h)+"rotate(",null,n)-2,x:Sn(c,u)})):u&&h.push(s(h)+"rotate("+u+n)}function o(c,u,h,f){c!==u?f.push({i:h.push(s(h)+"skewX(",null,n)-2,x:Sn(c,u)}):u&&h.push(s(h)+"skewX("+u+n)}function l(c,u,h,f,g,p){if(c!==h||u!==f){var m=g.push(s(g)+"scale(",null,",",null,")");p.push({i:m-4,x:Sn(c,h)},{i:m-2,x:Sn(u,f)})}else(h!==1||f!==1)&&g.push(s(g)+"scale("+h+","+f+")")}return function(c,u){var h=[],f=[];return c=e(c),u=e(u),i(c.translateX,c.translateY,u.translateX,u.translateY,h,f),a(c.rotate,u.rotate,h,f),o(c.skewX,u.skewX,h,f),l(c.scaleX,c.scaleY,u.scaleX,u.scaleY,h,f),c=u=null,function(g){for(var p=-1,m=f.length,y;++p<m;)h[(y=f[p]).i]=y.x(g);return h.join("")}}}var Vj=px(qj,"px, ","px)","deg)"),Gj=px(Uj,", ",")",")"),Qs=0,Li=0,Si=0,mx=1e3,Lo,$i,$o=0,as=0,wl=0,ia=typeof performance=="object"&&performance.now?performance:Date,xx=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function nd(){return as||(xx(Yj),as=ia.now()+wl)}function Yj(){as=0}function Do(){this._call=this._time=this._next=null}Do.prototype=yx.prototype={constructor:Do,restart:function(e,t,r){if(typeof e!="function")throw new TypeError("callback is not a function");r=(r==null?nd():+r)+(t==null?0:+t),!this._next&&$i!==this&&($i?$i._next=this:Lo=this,$i=this),this._call=e,this._time=r,_u()},stop:function(){this._call&&(this._call=null,this._time=1/0,_u())}};function yx(e,t,r){var n=new Do;return n.restart(e,t,r),n}function Xj(){nd(),++Qs;for(var e=Lo,t;e;)(t=as-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Qs}function yg(){as=($o=ia.now())+wl,Qs=Li=0;try{Xj()}finally{Qs=0,Qj(),as=0}}function Kj(){var e=ia.now(),t=e-$o;t>mx&&(wl-=t,$o=e)}function Qj(){for(var e,t=Lo,r,n=1/0;t;)t._call?(n>t._time&&(n=t._time),e=t,t=t._next):(r=t._next,t._next=null,t=e?e._next=r:Lo=r);$i=e,_u(n)}function _u(e){if(!Qs){Li&&(Li=clearTimeout(Li));var t=e-as;t>24?(e<1/0&&(Li=setTimeout(yg,e-ia.now()-wl)),Si&&(Si=clearInterval(Si))):(Si||($o=ia.now(),Si=setInterval(Kj,mx)),Qs=1,xx(yg))}}function bg(e,t,r){var n=new Do;return t=t==null?0:+t,n.restart(s=>{n.stop(),e(s+t)},t,r),n}var Zj=Q0("start","end","cancel","interrupt"),Jj=[],bx=0,kg=1,Tu=2,uo=3,wg=4,Nu=5,ho=6;function vl(e,t,r,n,s,i){var a=e.__transition;if(!a)e.__transition={};else if(r in a)return;eI(e,r,{name:t,index:n,group:s,on:Zj,tween:Jj,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:bx})}function sd(e,t){var r=Lr(e,t);if(r.state>bx)throw new Error("too late; already scheduled");return r}function Gr(e,t){var r=Lr(e,t);if(r.state>uo)throw new Error("too late; already running");return r}function Lr(e,t){var r=e.__transition;if(!r||!(r=r[t]))throw new Error("transition not found");return r}function eI(e,t,r){var n=e.__transition,s;n[t]=r,r.timer=yx(i,0,r.time);function i(c){r.state=kg,r.timer.restart(a,r.delay,r.time),r.delay<=c&&a(c-r.delay)}function a(c){var u,h,f,g;if(r.state!==kg)return l();for(u in n)if(g=n[u],g.name===r.name){if(g.state===uo)return bg(a);g.state===wg?(g.state=ho,g.timer.stop(),g.on.call("interrupt",e,e.__data__,g.index,g.group),delete n[u]):+u<t&&(g.state=ho,g.timer.stop(),g.on.call("cancel",e,e.__data__,g.index,g.group),delete n[u])}if(bg(function(){r.state===uo&&(r.state=wg,r.timer.restart(o,r.delay,r.time),o(c))}),r.state=Tu,r.on.call("start",e,e.__data__,r.index,r.group),r.state===Tu){for(r.state=uo,s=new Array(f=r.tween.length),u=0,h=-1;u<f;++u)(g=r.tween[u].value.call(e,e.__data__,r.index,r.group))&&(s[++h]=g);s.length=h+1}}function o(c){for(var u=c<r.duration?r.ease.call(null,c/r.duration):(r.timer.restart(l),r.state=Nu,1),h=-1,f=s.length;++h<f;)s[h].call(e,u);r.state===Nu&&(r.on.call("end",e,e.__data__,r.index,r.group),l())}function l(){r.state=ho,r.timer.stop(),delete n[t];for(var c in n)return;delete e.__transition}}function tI(e,t){var r=e.__transition,n,s,i=!0,a;if(r){t=t==null?null:t+"";for(a in r){if((n=r[a]).name!==t){i=!1;continue}s=n.state>Tu&&n.state<Nu,n.state=ho,n.timer.stop(),n.on.call(s?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete r[a]}i&&delete e.__transition}}function rI(e){return this.each(function(){tI(this,e)})}function nI(e,t){var r,n;return function(){var s=Gr(this,e),i=s.tween;if(i!==r){n=r=i;for(var a=0,o=n.length;a<o;++a)if(n[a].name===t){n=n.slice(),n.splice(a,1);break}}s.tween=n}}function sI(e,t,r){var n,s;if(typeof r!="function")throw new Error;return function(){var i=Gr(this,e),a=i.tween;if(a!==n){s=(n=a).slice();for(var o={name:t,value:r},l=0,c=s.length;l<c;++l)if(s[l].name===t){s[l]=o;break}l===c&&s.push(o)}i.tween=s}}function iI(e,t){var r=this._id;if(e+="",arguments.length<2){for(var n=Lr(this.node(),r).tween,s=0,i=n.length,a;s<i;++s)if((a=n[s]).name===e)return a.value;return null}return this.each((t==null?nI:sI)(r,e,t))}function id(e,t,r){var n=e._id;return e.each(function(){var s=Gr(this,n);(s.value||(s.value={}))[t]=r.apply(this,arguments)}),function(s){return Lr(s,n).value[t]}}function kx(e,t){var r;return(typeof t=="number"?Sn:t instanceof sa?mg:(r=sa(t))?(t=r,mg):Hj)(e,t)}function aI(e){return function(){this.removeAttribute(e)}}function oI(e){return function(){this.removeAttributeNS(e.space,e.local)}}function lI(e,t,r){var n,s=r+"",i;return function(){var a=this.getAttribute(e);return a===s?null:a===n?i:i=t(n=a,r)}}function cI(e,t,r){var n,s=r+"",i;return function(){var a=this.getAttributeNS(e.space,e.local);return a===s?null:a===n?i:i=t(n=a,r)}}function uI(e,t,r){var n,s,i;return function(){var a,o=r(this),l;return o==null?void this.removeAttribute(e):(a=this.getAttribute(e),l=o+"",a===l?null:a===n&&l===s?i:(s=l,i=t(n=a,o)))}}function hI(e,t,r){var n,s,i;return function(){var a,o=r(this),l;return o==null?void this.removeAttributeNS(e.space,e.local):(a=this.getAttributeNS(e.space,e.local),l=o+"",a===l?null:a===n&&l===s?i:(s=l,i=t(n=a,o)))}}function dI(e,t){var r=kl(e),n=r==="transform"?Gj:kx;return this.attrTween(e,typeof t=="function"?(r.local?hI:uI)(r,n,id(this,"attr."+e,t)):t==null?(r.local?oI:aI)(r):(r.local?cI:lI)(r,n,t))}function fI(e,t){return function(r){this.setAttribute(e,t.call(this,r))}}function gI(e,t){return function(r){this.setAttributeNS(e.space,e.local,t.call(this,r))}}function pI(e,t){var r,n;function s(){var i=t.apply(this,arguments);return i!==n&&(r=(n=i)&&gI(e,i)),r}return s._value=t,s}function mI(e,t){var r,n;function s(){var i=t.apply(this,arguments);return i!==n&&(r=(n=i)&&fI(e,i)),r}return s._value=t,s}function xI(e,t){var r="attr."+e;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;var n=kl(e);return this.tween(r,(n.local?pI:mI)(n,t))}function yI(e,t){return function(){sd(this,e).delay=+t.apply(this,arguments)}}function bI(e,t){return t=+t,function(){sd(this,e).delay=t}}function kI(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?yI:bI)(t,e)):Lr(this.node(),t).delay}function wI(e,t){return function(){Gr(this,e).duration=+t.apply(this,arguments)}}function vI(e,t){return t=+t,function(){Gr(this,e).duration=t}}function CI(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?wI:vI)(t,e)):Lr(this.node(),t).duration}function SI(e,t){if(typeof t!="function")throw new Error;return function(){Gr(this,e).ease=t}}function _I(e){var t=this._id;return arguments.length?this.each(SI(t,e)):Lr(this.node(),t).ease}function TI(e,t){return function(){var r=t.apply(this,arguments);if(typeof r!="function")throw new Error;Gr(this,e).ease=r}}function NI(e){if(typeof e!="function")throw new Error;return this.each(TI(this._id,e))}function EI(e){typeof e!="function"&&(e=ex(e));for(var t=this._groups,r=t.length,n=new Array(r),s=0;s<r;++s)for(var i=t[s],a=i.length,o=n[s]=[],l,c=0;c<a;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&o.push(l);return new ln(n,this._parents,this._name,this._id)}function AI(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,r=e._groups,n=t.length,s=r.length,i=Math.min(n,s),a=new Array(n),o=0;o<i;++o)for(var l=t[o],c=r[o],u=l.length,h=a[o]=new Array(u),f,g=0;g<u;++g)(f=l[g]||c[g])&&(h[g]=f);for(;o<n;++o)a[o]=t[o];return new ln(a,this._parents,this._name,this._id)}function MI(e){return(e+"").trim().split(/^|\s+/).every(function(t){var r=t.indexOf(".");return r>=0&&(t=t.slice(0,r)),!t||t==="start"})}function jI(e,t,r){var n,s,i=MI(t)?sd:Gr;return function(){var a=i(this,e),o=a.on;o!==n&&(s=(n=o).copy()).on(t,r),a.on=s}}function II(e,t){var r=this._id;return arguments.length<2?Lr(this.node(),r).on.on(e):this.each(jI(r,e,t))}function LI(e){return function(){var t=this.parentNode;for(var r in this.__transition)if(+r!==e)return;t&&t.removeChild(this)}}function $I(){return this.on("end.remove",LI(this._id))}function DI(e){var t=this._name,r=this._id;typeof e!="function"&&(e=Jh(e));for(var n=this._groups,s=n.length,i=new Array(s),a=0;a<s;++a)for(var o=n[a],l=o.length,c=i[a]=new Array(l),u,h,f=0;f<l;++f)(u=o[f])&&(h=e.call(u,u.__data__,f,o))&&("__data__"in u&&(h.__data__=u.__data__),c[f]=h,vl(c[f],t,r,f,c,Lr(u,r)));return new ln(i,this._parents,t,r)}function BI(e){var t=this._name,r=this._id;typeof e!="function"&&(e=J0(e));for(var n=this._groups,s=n.length,i=[],a=[],o=0;o<s;++o)for(var l=n[o],c=l.length,u,h=0;h<c;++h)if(u=l[h]){for(var f=e.call(u,u.__data__,h,l),g,p=Lr(u,r),m=0,y=f.length;m<y;++m)(g=f[m])&&vl(g,t,r,m,f,p);i.push(f),a.push(u)}return new ln(i,a,t,r)}var RI=wa.prototype.constructor;function PI(){return new RI(this._groups,this._parents)}function FI(e,t){var r,n,s;return function(){var i=Ks(this,e),a=(this.style.removeProperty(e),Ks(this,e));return i===a?null:i===r&&a===n?s:s=t(r=i,n=a)}}function wx(e){return function(){this.style.removeProperty(e)}}function OI(e,t,r){var n,s=r+"",i;return function(){var a=Ks(this,e);return a===s?null:a===n?i:i=t(n=a,r)}}function zI(e,t,r){var n,s,i;return function(){var a=Ks(this,e),o=r(this),l=o+"";return o==null&&(l=o=(this.style.removeProperty(e),Ks(this,e))),a===l?null:a===n&&l===s?i:(s=l,i=t(n=a,o))}}function WI(e,t){var r,n,s,i="style."+t,a="end."+i,o;return function(){var l=Gr(this,e),c=l.on,u=l.value[i]==null?o||(o=wx(t)):void 0;(c!==r||s!==u)&&(n=(r=c).copy()).on(a,s=u),l.on=n}}function HI(e,t,r){var n=(e+="")=="transform"?Vj:kx;return t==null?this.styleTween(e,FI(e,n)).on("end.style."+e,wx(e)):typeof t=="function"?this.styleTween(e,zI(e,n,id(this,"style."+e,t))).each(WI(this._id,e)):this.styleTween(e,OI(e,n,t),r).on("end.style."+e,null)}function qI(e,t,r){return function(n){this.style.setProperty(e,t.call(this,n),r)}}function UI(e,t,r){var n,s;function i(){var a=t.apply(this,arguments);return a!==s&&(n=(s=a)&&qI(e,a,r)),n}return i._value=t,i}function VI(e,t,r){var n="style."+(e+="");if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;return this.tween(n,UI(e,t,r??""))}function GI(e){return function(){this.textContent=e}}function YI(e){return function(){var t=e(this);this.textContent=t??""}}function XI(e){return this.tween("text",typeof e=="function"?YI(id(this,"text",e)):GI(e==null?"":e+""))}function KI(e){return function(t){this.textContent=e.call(this,t)}}function QI(e){var t,r;function n(){var s=e.apply(this,arguments);return s!==r&&(t=(r=s)&&KI(s)),t}return n._value=e,n}function ZI(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,QI(e))}function JI(){for(var e=this._name,t=this._id,r=vx(),n=this._groups,s=n.length,i=0;i<s;++i)for(var a=n[i],o=a.length,l,c=0;c<o;++c)if(l=a[c]){var u=Lr(l,t);vl(l,e,r,c,a,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new ln(n,this._parents,e,r)}function eL(){var e,t,r=this,n=r._id,s=r.size();return new Promise(function(i,a){var o={value:a},l={value:function(){--s===0&&i()}};r.each(function(){var c=Gr(this,n),u=c.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(o),t._.interrupt.push(o),t._.end.push(l)),c.on=t}),s===0&&i()})}var tL=0;function ln(e,t,r,n){this._groups=e,this._parents=t,this._name=r,this._id=n}function vx(){return++tL}var Jr=wa.prototype;ln.prototype={constructor:ln,select:DI,selectAll:BI,selectChild:Jr.selectChild,selectChildren:Jr.selectChildren,filter:EI,merge:AI,selection:PI,transition:JI,call:Jr.call,nodes:Jr.nodes,node:Jr.node,size:Jr.size,empty:Jr.empty,each:Jr.each,on:II,attr:dI,attrTween:xI,style:HI,styleTween:VI,text:XI,textTween:ZI,remove:$I,tween:iI,delay:kI,duration:CI,ease:_I,easeVarying:NI,end:eL,[Symbol.iterator]:Jr[Symbol.iterator]};function rL(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var nL={time:null,delay:0,duration:250,ease:rL};function sL(e,t){for(var r;!(r=e.__transition)||!(r=r[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return r}function iL(e){var t,r;e instanceof ln?(t=e._id,e=e._name):(t=vx(),(r=nL).time=nd(),e=e==null?null:e+"");for(var n=this._groups,s=n.length,i=0;i<s;++i)for(var a=n[i],o=a.length,l,c=0;c<o;++c)(l=a[c])&&vl(l,e,t,c,a,r||sL(l,t));return new ln(n,this._parents,e,t)}wa.prototype.interrupt=rI;wa.prototype.transition=iL;const Eu=Math.PI,Au=2*Eu,Un=1e-6,aL=Au-Un;function Cx(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=arguments[t]+e[t]}function oL(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return Cx;const r=10**t;return function(n){this._+=n[0];for(let s=1,i=n.length;s<i;++s)this._+=Math.round(arguments[s]*r)/r+n[s]}}class lL{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?Cx:oL(t)}moveTo(t,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,r){this._append`L${this._x1=+t},${this._y1=+r}`}quadraticCurveTo(t,r,n,s){this._append`Q${+t},${+r},${this._x1=+n},${this._y1=+s}`}bezierCurveTo(t,r,n,s,i,a){this._append`C${+t},${+r},${+n},${+s},${this._x1=+i},${this._y1=+a}`}arcTo(t,r,n,s,i){if(t=+t,r=+r,n=+n,s=+s,i=+i,i<0)throw new Error(`negative radius: ${i}`);let a=this._x1,o=this._y1,l=n-t,c=s-r,u=a-t,h=o-r,f=u*u+h*h;if(this._x1===null)this._append`M${this._x1=t},${this._y1=r}`;else if(f>Un)if(!(Math.abs(h*l-c*u)>Un)||!i)this._append`L${this._x1=t},${this._y1=r}`;else{let g=n-a,p=s-o,m=l*l+c*c,y=g*g+p*p,x=Math.sqrt(m),k=Math.sqrt(f),C=i*Math.tan((Eu-Math.acos((m+f-y)/(2*x*k)))/2),T=C/k,S=C/x;Math.abs(T-1)>Un&&this._append`L${t+T*u},${r+T*h}`,this._append`A${i},${i},0,0,${+(h*g>u*p)},${this._x1=t+S*l},${this._y1=r+S*c}`}}arc(t,r,n,s,i,a){if(t=+t,r=+r,n=+n,a=!!a,n<0)throw new Error(`negative radius: ${n}`);let o=n*Math.cos(s),l=n*Math.sin(s),c=t+o,u=r+l,h=1^a,f=a?s-i:i-s;this._x1===null?this._append`M${c},${u}`:(Math.abs(this._x1-c)>Un||Math.abs(this._y1-u)>Un)&&this._append`L${c},${u}`,n&&(f<0&&(f=f%Au+Au),f>aL?this._append`A${n},${n},0,1,${h},${t-o},${r-l}A${n},${n},0,1,${h},${this._x1=c},${this._y1=u}`:f>Un&&this._append`A${n},${n},0,${+(f>=Eu)},${h},${this._x1=t+n*Math.cos(i)},${this._y1=r+n*Math.sin(i)}`)}rect(t,r,n,s){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+s}h${-n}Z`}toString(){return this._}}function Ns(e){return function(){return e}}const T9=Math.abs,N9=Math.atan2,E9=Math.cos,A9=Math.max,M9=Math.min,j9=Math.sin,I9=Math.sqrt,vg=1e-12,ad=Math.PI,Cg=ad/2,L9=2*ad;function $9(e){return e>1?0:e<-1?ad:Math.acos(e)}function D9(e){return e>=1?Cg:e<=-1?-Cg:Math.asin(e)}function cL(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new lL(t)}function uL(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Sx(e){this._context=e}Sx.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function Bo(e){return new Sx(e)}function hL(e){return e[0]}function dL(e){return e[1]}function fL(e,t){var r=Ns(!0),n=null,s=Bo,i=null,a=cL(o);e=typeof e=="function"?e:e===void 0?hL:Ns(e),t=typeof t=="function"?t:t===void 0?dL:Ns(t);function o(l){var c,u=(l=uL(l)).length,h,f=!1,g;for(n==null&&(i=s(g=a())),c=0;c<=u;++c)!(c<u&&r(h=l[c],c,l))===f&&((f=!f)?i.lineStart():i.lineEnd()),f&&i.point(+e(h,c,l),+t(h,c,l));if(g)return i=null,g+""||null}return o.x=function(l){return arguments.length?(e=typeof l=="function"?l:Ns(+l),o):e},o.y=function(l){return arguments.length?(t=typeof l=="function"?l:Ns(+l),o):t},o.defined=function(l){return arguments.length?(r=typeof l=="function"?l:Ns(!!l),o):r},o.curve=function(l){return arguments.length?(s=l,n!=null&&(i=s(n)),o):s},o.context=function(l){return arguments.length?(l==null?n=i=null:i=s(n=l),o):n},o}class _x{constructor(t,r){this._context=t,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}}function Tx(e){return new _x(e,!0)}function Nx(e){return new _x(e,!1)}function En(){}function Ro(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function Cl(e){this._context=e}Cl.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Ro(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Ro(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function fo(e){return new Cl(e)}function Ex(e){this._context=e}Ex.prototype={areaStart:En,areaEnd:En,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Ro(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function gL(e){return new Ex(e)}function Ax(e){this._context=e}Ax.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:Ro(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function pL(e){return new Ax(e)}function Mx(e,t){this._basis=new Cl(e),this._beta=t}Mx.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,r=e.length-1;if(r>0)for(var n=e[0],s=t[0],i=e[r]-n,a=t[r]-s,o=-1,l;++o<=r;)l=o/r,this._basis.point(this._beta*e[o]+(1-this._beta)*(n+l*i),this._beta*t[o]+(1-this._beta)*(s+l*a));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}};const mL=(function e(t){function r(n){return t===1?new Cl(n):new Mx(n,t)}return r.beta=function(n){return e(+n)},r})(.85);function Po(e,t,r){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-r),e._x2,e._y2)}function od(e,t){this._context=e,this._k=(1-t)/6}od.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:Po(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:Po(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const jx=(function e(t){function r(n){return new od(n,t)}return r.tension=function(n){return e(+n)},r})(0);function ld(e,t){this._context=e,this._k=(1-t)/6}ld.prototype={areaStart:En,areaEnd:En,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:Po(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const xL=(function e(t){function r(n){return new ld(n,t)}return r.tension=function(n){return e(+n)},r})(0);function cd(e,t){this._context=e,this._k=(1-t)/6}cd.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Po(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const yL=(function e(t){function r(n){return new cd(n,t)}return r.tension=function(n){return e(+n)},r})(0);function ud(e,t,r){var n=e._x1,s=e._y1,i=e._x2,a=e._y2;if(e._l01_a>vg){var o=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,l=3*e._l01_a*(e._l01_a+e._l12_a);n=(n*o-e._x0*e._l12_2a+e._x2*e._l01_2a)/l,s=(s*o-e._y0*e._l12_2a+e._y2*e._l01_2a)/l}if(e._l23_a>vg){var c=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,u=3*e._l23_a*(e._l23_a+e._l12_a);i=(i*c+e._x1*e._l23_2a-t*e._l12_2a)/u,a=(a*c+e._y1*e._l23_2a-r*e._l12_2a)/u}e._context.bezierCurveTo(n,s,i,a,e._x2,e._y2)}function Ix(e,t){this._context=e,this._alpha=t}Ix.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var r=this._x2-e,n=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:ud(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const Lx=(function e(t){function r(n){return t?new Ix(n,t):new od(n,0)}return r.alpha=function(n){return e(+n)},r})(.5);function $x(e,t){this._context=e,this._alpha=t}$x.prototype={areaStart:En,areaEnd:En,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(e,t){if(e=+e,t=+t,this._point){var r=this._x2-e,n=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:ud(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const bL=(function e(t){function r(n){return t?new $x(n,t):new ld(n,0)}return r.alpha=function(n){return e(+n)},r})(.5);function Dx(e,t){this._context=e,this._alpha=t}Dx.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var r=this._x2-e,n=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:ud(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const kL=(function e(t){function r(n){return t?new Dx(n,t):new cd(n,0)}return r.alpha=function(n){return e(+n)},r})(.5);function Bx(e){this._context=e}Bx.prototype={areaStart:En,areaEnd:En,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function wL(e){return new Bx(e)}function Sg(e){return e<0?-1:1}function _g(e,t,r){var n=e._x1-e._x0,s=t-e._x1,i=(e._y1-e._y0)/(n||s<0&&-0),a=(r-e._y1)/(s||n<0&&-0),o=(i*s+a*n)/(n+s);return(Sg(i)+Sg(a))*Math.min(Math.abs(i),Math.abs(a),.5*Math.abs(o))||0}function Tg(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function Lc(e,t,r){var n=e._x0,s=e._y0,i=e._x1,a=e._y1,o=(i-n)/3;e._context.bezierCurveTo(n+o,s+o*t,i-o,a-o*r,i,a)}function Fo(e){this._context=e}Fo.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Lc(this,this._t0,Tg(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var r=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,Lc(this,Tg(this,r=_g(this,e,t)),r);break;default:Lc(this,this._t0,r=_g(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function Rx(e){this._context=new Px(e)}(Rx.prototype=Object.create(Fo.prototype)).point=function(e,t){Fo.prototype.point.call(this,t,e)};function Px(e){this._context=e}Px.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,r,n,s,i){this._context.bezierCurveTo(t,e,n,r,i,s)}};function Fx(e){return new Fo(e)}function Ox(e){return new Rx(e)}function zx(e){this._context=e}zx.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=Ng(e),s=Ng(t),i=0,a=1;a<r;++i,++a)this._context.bezierCurveTo(n[0][i],s[0][i],n[1][i],s[1][i],e[a],t[a]);(this._line||this._line!==0&&r===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function Ng(e){var t,r=e.length-1,n,s=new Array(r),i=new Array(r),a=new Array(r);for(s[0]=0,i[0]=2,a[0]=e[0]+2*e[1],t=1;t<r-1;++t)s[t]=1,i[t]=4,a[t]=4*e[t]+2*e[t+1];for(s[r-1]=2,i[r-1]=7,a[r-1]=8*e[r-1]+e[r],t=1;t<r;++t)n=s[t]/i[t-1],i[t]-=n,a[t]-=n*a[t-1];for(s[r-1]=a[r-1]/i[r-1],t=r-2;t>=0;--t)s[t]=(a[t]-s[t+1])/i[t];for(i[r-1]=(e[r]+s[r-1])/2,t=0;t<r-1;++t)i[t]=2*e[t+1]-s[t+1];return[s,i]}function Wx(e){return new zx(e)}function Sl(e,t){this._context=e,this._t=t}Sl.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function Hx(e){return new Sl(e,.5)}function qx(e){return new Sl(e,0)}function Ux(e){return new Sl(e,1)}function Di(e,t,r){this.k=e,this.x=t,this.y=r}Di.prototype={constructor:Di,scale:function(e){return e===1?this:new Di(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Di(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};Di.prototype;var vL=b(e=>{const{securityLevel:t}=He();let r=Oe("body");if(t==="sandbox"){const i=Oe(`#i${e}`).node()?.contentDocument??document;r=Oe(i.body)}return r.select(`#${e}`)},"selectSvgElement");function hd(e){return typeof e>"u"||e===null}b(hd,"isNothing");function Vx(e){return typeof e=="object"&&e!==null}b(Vx,"isObject");function Gx(e){return Array.isArray(e)?e:hd(e)?[]:[e]}b(Gx,"toArray");function Yx(e,t){var r,n,s,i;if(t)for(i=Object.keys(t),r=0,n=i.length;r<n;r+=1)s=i[r],e[s]=t[s];return e}b(Yx,"extend");function Xx(e,t){var r="",n;for(n=0;n<t;n+=1)r+=e;return r}b(Xx,"repeat");function Kx(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}b(Kx,"isNegativeZero");var CL=hd,SL=Vx,_L=Gx,TL=Xx,NL=Kx,EL=Yx,St={isNothing:CL,isObject:SL,toArray:_L,repeat:TL,isNegativeZero:NL,extend:EL};function dd(e,t){var r="",n=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(r+='in "'+e.mark.name+'" '),r+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!t&&e.mark.snippet&&(r+=`
215
+
216
+ `+e.mark.snippet),n+" "+r):n}b(dd,"formatError");function Zs(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=dd(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}b(Zs,"YAMLException$1");Zs.prototype=Object.create(Error.prototype);Zs.prototype.constructor=Zs;Zs.prototype.toString=b(function(t){return this.name+": "+dd(this,t)},"toString");var rr=Zs;function go(e,t,r,n,s){var i="",a="",o=Math.floor(s/2)-1;return n-t>o&&(i=" ... ",t=n-o+i.length),r-n>o&&(a=" ...",r=n+o-a.length),{str:i+e.slice(t,r).replace(/\t/g,"→")+a,pos:n-t+i.length}}b(go,"getLine");function po(e,t){return St.repeat(" ",t-e.length)+e}b(po,"padStart");function Qx(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),typeof t.indent!="number"&&(t.indent=1),typeof t.linesBefore!="number"&&(t.linesBefore=3),typeof t.linesAfter!="number"&&(t.linesAfter=2);for(var r=/\r?\n|\r|\0/g,n=[0],s=[],i,a=-1;i=r.exec(e.buffer);)s.push(i.index),n.push(i.index+i[0].length),e.position<=i.index&&a<0&&(a=n.length-2);a<0&&(a=n.length-1);var o="",l,c,u=Math.min(e.line+t.linesAfter,s.length).toString().length,h=t.maxLength-(t.indent+u+3);for(l=1;l<=t.linesBefore&&!(a-l<0);l++)c=go(e.buffer,n[a-l],s[a-l],e.position-(n[a]-n[a-l]),h),o=St.repeat(" ",t.indent)+po((e.line-l+1).toString(),u)+" | "+c.str+`
217
+ `+o;for(c=go(e.buffer,n[a],s[a],e.position,h),o+=St.repeat(" ",t.indent)+po((e.line+1).toString(),u)+" | "+c.str+`
218
+ `,o+=St.repeat("-",t.indent+u+3+c.pos)+`^
219
+ `,l=1;l<=t.linesAfter&&!(a+l>=s.length);l++)c=go(e.buffer,n[a+l],s[a+l],e.position-(n[a]-n[a+l]),h),o+=St.repeat(" ",t.indent)+po((e.line+l+1).toString(),u)+" | "+c.str+`
220
+ `;return o.replace(/\n$/,"")}b(Qx,"makeSnippet");var AL=Qx,ML=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],jL=["scalar","sequence","mapping"];function Zx(e){var t={};return e!==null&&Object.keys(e).forEach(function(r){e[r].forEach(function(n){t[String(n)]=r})}),t}b(Zx,"compileStyleAliases");function Jx(e,t){if(t=t||{},Object.keys(t).forEach(function(r){if(ML.indexOf(r)===-1)throw new rr('Unknown option "'+r+'" is met in definition of "'+e+'" YAML type.')}),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(r){return r},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=Zx(t.styleAliases||null),jL.indexOf(this.kind)===-1)throw new rr('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}b(Jx,"Type$1");var Dt=Jx;function Mu(e,t){var r=[];return e[t].forEach(function(n){var s=r.length;r.forEach(function(i,a){i.tag===n.tag&&i.kind===n.kind&&i.multi===n.multi&&(s=a)}),r[s]=n}),r}b(Mu,"compileList");function ey(){var e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},t,r;function n(s){s.multi?(e.multi[s.kind].push(s),e.multi.fallback.push(s)):e[s.kind][s.tag]=e.fallback[s.tag]=s}for(b(n,"collectType"),t=0,r=arguments.length;t<r;t+=1)arguments[t].forEach(n);return e}b(ey,"compileMap");function Oo(e){return this.extend(e)}b(Oo,"Schema$1");Oo.prototype.extend=b(function(t){var r=[],n=[];if(t instanceof Dt)n.push(t);else if(Array.isArray(t))n=n.concat(t);else if(t&&(Array.isArray(t.implicit)||Array.isArray(t.explicit)))t.implicit&&(r=r.concat(t.implicit)),t.explicit&&(n=n.concat(t.explicit));else throw new rr("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");r.forEach(function(i){if(!(i instanceof Dt))throw new rr("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(i.loadKind&&i.loadKind!=="scalar")throw new rr("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(i.multi)throw new rr("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),n.forEach(function(i){if(!(i instanceof Dt))throw new rr("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var s=Object.create(Oo.prototype);return s.implicit=(this.implicit||[]).concat(r),s.explicit=(this.explicit||[]).concat(n),s.compiledImplicit=Mu(s,"implicit"),s.compiledExplicit=Mu(s,"explicit"),s.compiledTypeMap=ey(s.compiledImplicit,s.compiledExplicit),s},"extend");var IL=Oo,LL=new Dt("tag:yaml.org,2002:str",{kind:"scalar",construct:b(function(e){return e!==null?e:""},"construct")}),$L=new Dt("tag:yaml.org,2002:seq",{kind:"sequence",construct:b(function(e){return e!==null?e:[]},"construct")}),DL=new Dt("tag:yaml.org,2002:map",{kind:"mapping",construct:b(function(e){return e!==null?e:{}},"construct")}),BL=new IL({explicit:[LL,$L,DL]});function ty(e){if(e===null)return!0;var t=e.length;return t===1&&e==="~"||t===4&&(e==="null"||e==="Null"||e==="NULL")}b(ty,"resolveYamlNull");function ry(){return null}b(ry,"constructYamlNull");function ny(e){return e===null}b(ny,"isNull");var RL=new Dt("tag:yaml.org,2002:null",{kind:"scalar",resolve:ty,construct:ry,predicate:ny,represent:{canonical:b(function(){return"~"},"canonical"),lowercase:b(function(){return"null"},"lowercase"),uppercase:b(function(){return"NULL"},"uppercase"),camelcase:b(function(){return"Null"},"camelcase"),empty:b(function(){return""},"empty")},defaultStyle:"lowercase"});function sy(e){if(e===null)return!1;var t=e.length;return t===4&&(e==="true"||e==="True"||e==="TRUE")||t===5&&(e==="false"||e==="False"||e==="FALSE")}b(sy,"resolveYamlBoolean");function iy(e){return e==="true"||e==="True"||e==="TRUE"}b(iy,"constructYamlBoolean");function ay(e){return Object.prototype.toString.call(e)==="[object Boolean]"}b(ay,"isBoolean");var PL=new Dt("tag:yaml.org,2002:bool",{kind:"scalar",resolve:sy,construct:iy,predicate:ay,represent:{lowercase:b(function(e){return e?"true":"false"},"lowercase"),uppercase:b(function(e){return e?"TRUE":"FALSE"},"uppercase"),camelcase:b(function(e){return e?"True":"False"},"camelcase")},defaultStyle:"lowercase"});function oy(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}b(oy,"isHexCode");function ly(e){return 48<=e&&e<=55}b(ly,"isOctCode");function cy(e){return 48<=e&&e<=57}b(cy,"isDecCode");function uy(e){if(e===null)return!1;var t=e.length,r=0,n=!1,s;if(!t)return!1;if(s=e[r],(s==="-"||s==="+")&&(s=e[++r]),s==="0"){if(r+1===t)return!0;if(s=e[++r],s==="b"){for(r++;r<t;r++)if(s=e[r],s!=="_"){if(s!=="0"&&s!=="1")return!1;n=!0}return n&&s!=="_"}if(s==="x"){for(r++;r<t;r++)if(s=e[r],s!=="_"){if(!oy(e.charCodeAt(r)))return!1;n=!0}return n&&s!=="_"}if(s==="o"){for(r++;r<t;r++)if(s=e[r],s!=="_"){if(!ly(e.charCodeAt(r)))return!1;n=!0}return n&&s!=="_"}}if(s==="_")return!1;for(;r<t;r++)if(s=e[r],s!=="_"){if(!cy(e.charCodeAt(r)))return!1;n=!0}return!(!n||s==="_")}b(uy,"resolveYamlInteger");function hy(e){var t=e,r=1,n;if(t.indexOf("_")!==-1&&(t=t.replace(/_/g,"")),n=t[0],(n==="-"||n==="+")&&(n==="-"&&(r=-1),t=t.slice(1),n=t[0]),t==="0")return 0;if(n==="0"){if(t[1]==="b")return r*parseInt(t.slice(2),2);if(t[1]==="x")return r*parseInt(t.slice(2),16);if(t[1]==="o")return r*parseInt(t.slice(2),8)}return r*parseInt(t,10)}b(hy,"constructYamlInteger");function dy(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!St.isNegativeZero(e)}b(dy,"isInteger");var FL=new Dt("tag:yaml.org,2002:int",{kind:"scalar",resolve:uy,construct:hy,predicate:dy,represent:{binary:b(function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},"binary"),octal:b(function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},"octal"),decimal:b(function(e){return e.toString(10)},"decimal"),hexadecimal:b(function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)},"hexadecimal")},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),OL=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function fy(e){return!(e===null||!OL.test(e)||e[e.length-1]==="_")}b(fy,"resolveYamlFloat");function gy(e){var t,r;return t=e.replace(/_/g,"").toLowerCase(),r=t[0]==="-"?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),t===".inf"?r===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:t===".nan"?NaN:r*parseFloat(t,10)}b(gy,"constructYamlFloat");var zL=/^[-+]?[0-9]+e/;function py(e,t){var r;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(St.isNegativeZero(e))return"-0.0";return r=e.toString(10),zL.test(r)?r.replace("e",".e"):r}b(py,"representYamlFloat");function my(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||St.isNegativeZero(e))}b(my,"isFloat");var WL=new Dt("tag:yaml.org,2002:float",{kind:"scalar",resolve:fy,construct:gy,predicate:my,represent:py,defaultStyle:"lowercase"}),xy=BL.extend({implicit:[RL,PL,FL,WL]}),HL=xy,yy=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),by=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function ky(e){return e===null?!1:yy.exec(e)!==null||by.exec(e)!==null}b(ky,"resolveYamlTimestamp");function wy(e){var t,r,n,s,i,a,o,l=0,c=null,u,h,f;if(t=yy.exec(e),t===null&&(t=by.exec(e)),t===null)throw new Error("Date resolve error");if(r=+t[1],n=+t[2]-1,s=+t[3],!t[4])return new Date(Date.UTC(r,n,s));if(i=+t[4],a=+t[5],o=+t[6],t[7]){for(l=t[7].slice(0,3);l.length<3;)l+="0";l=+l}return t[9]&&(u=+t[10],h=+(t[11]||0),c=(u*60+h)*6e4,t[9]==="-"&&(c=-c)),f=new Date(Date.UTC(r,n,s,i,a,o,l)),c&&f.setTime(f.getTime()-c),f}b(wy,"constructYamlTimestamp");function vy(e){return e.toISOString()}b(vy,"representYamlTimestamp");var qL=new Dt("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:ky,construct:wy,instanceOf:Date,represent:vy});function Cy(e){return e==="<<"||e===null}b(Cy,"resolveYamlMerge");var UL=new Dt("tag:yaml.org,2002:merge",{kind:"scalar",resolve:Cy}),fd=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
221
+ \r`;function Sy(e){if(e===null)return!1;var t,r,n=0,s=e.length,i=fd;for(r=0;r<s;r++)if(t=i.indexOf(e.charAt(r)),!(t>64)){if(t<0)return!1;n+=6}return n%8===0}b(Sy,"resolveYamlBinary");function _y(e){var t,r,n=e.replace(/[\r\n=]/g,""),s=n.length,i=fd,a=0,o=[];for(t=0;t<s;t++)t%4===0&&t&&(o.push(a>>16&255),o.push(a>>8&255),o.push(a&255)),a=a<<6|i.indexOf(n.charAt(t));return r=s%4*6,r===0?(o.push(a>>16&255),o.push(a>>8&255),o.push(a&255)):r===18?(o.push(a>>10&255),o.push(a>>2&255)):r===12&&o.push(a>>4&255),new Uint8Array(o)}b(_y,"constructYamlBinary");function Ty(e){var t="",r=0,n,s,i=e.length,a=fd;for(n=0;n<i;n++)n%3===0&&n&&(t+=a[r>>18&63],t+=a[r>>12&63],t+=a[r>>6&63],t+=a[r&63]),r=(r<<8)+e[n];return s=i%3,s===0?(t+=a[r>>18&63],t+=a[r>>12&63],t+=a[r>>6&63],t+=a[r&63]):s===2?(t+=a[r>>10&63],t+=a[r>>4&63],t+=a[r<<2&63],t+=a[64]):s===1&&(t+=a[r>>2&63],t+=a[r<<4&63],t+=a[64],t+=a[64]),t}b(Ty,"representYamlBinary");function Ny(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}b(Ny,"isBinary");var VL=new Dt("tag:yaml.org,2002:binary",{kind:"scalar",resolve:Sy,construct:_y,predicate:Ny,represent:Ty}),GL=Object.prototype.hasOwnProperty,YL=Object.prototype.toString;function Ey(e){if(e===null)return!0;var t=[],r,n,s,i,a,o=e;for(r=0,n=o.length;r<n;r+=1){if(s=o[r],a=!1,YL.call(s)!=="[object Object]")return!1;for(i in s)if(GL.call(s,i))if(!a)a=!0;else return!1;if(!a)return!1;if(t.indexOf(i)===-1)t.push(i);else return!1}return!0}b(Ey,"resolveYamlOmap");function Ay(e){return e!==null?e:[]}b(Ay,"constructYamlOmap");var XL=new Dt("tag:yaml.org,2002:omap",{kind:"sequence",resolve:Ey,construct:Ay}),KL=Object.prototype.toString;function My(e){if(e===null)return!0;var t,r,n,s,i,a=e;for(i=new Array(a.length),t=0,r=a.length;t<r;t+=1){if(n=a[t],KL.call(n)!=="[object Object]"||(s=Object.keys(n),s.length!==1))return!1;i[t]=[s[0],n[s[0]]]}return!0}b(My,"resolveYamlPairs");function jy(e){if(e===null)return[];var t,r,n,s,i,a=e;for(i=new Array(a.length),t=0,r=a.length;t<r;t+=1)n=a[t],s=Object.keys(n),i[t]=[s[0],n[s[0]]];return i}b(jy,"constructYamlPairs");var QL=new Dt("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:My,construct:jy}),ZL=Object.prototype.hasOwnProperty;function Iy(e){if(e===null)return!0;var t,r=e;for(t in r)if(ZL.call(r,t)&&r[t]!==null)return!1;return!0}b(Iy,"resolveYamlSet");function Ly(e){return e!==null?e:{}}b(Ly,"constructYamlSet");var JL=new Dt("tag:yaml.org,2002:set",{kind:"mapping",resolve:Iy,construct:Ly}),$y=HL.extend({implicit:[qL,UL],explicit:[VL,XL,QL,JL]}),An=Object.prototype.hasOwnProperty,zo=1,Dy=2,By=3,Wo=4,$c=1,e$=2,Eg=3,t$=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,r$=/[\x85\u2028\u2029]/,n$=/[,\[\]\{\}]/,Ry=/^(?:!|!!|![a-z\-]+!)$/i,Py=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function ju(e){return Object.prototype.toString.call(e)}b(ju,"_class");function jr(e){return e===10||e===13}b(jr,"is_EOL");function Nn(e){return e===9||e===32}b(Nn,"is_WHITE_SPACE");function Wt(e){return e===9||e===32||e===10||e===13}b(Wt,"is_WS_OR_EOL");function Kn(e){return e===44||e===91||e===93||e===123||e===125}b(Kn,"is_FLOW_INDICATOR");function Fy(e){var t;return 48<=e&&e<=57?e-48:(t=e|32,97<=t&&t<=102?t-97+10:-1)}b(Fy,"fromHexCode");function Oy(e){return e===120?2:e===117?4:e===85?8:0}b(Oy,"escapedHexLen");function zy(e){return 48<=e&&e<=57?e-48:-1}b(zy,"fromDecimalCode");function Iu(e){return e===48?"\0":e===97?"\x07":e===98?"\b":e===116||e===9?" ":e===110?`
222
+ `:e===118?"\v":e===102?"\f":e===114?"\r":e===101?"\x1B":e===32?" ":e===34?'"':e===47?"/":e===92?"\\":e===78?"…":e===95?" ":e===76?"\u2028":e===80?"\u2029":""}b(Iu,"simpleEscapeSequence");function Wy(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}b(Wy,"charFromCodepoint");var Hy=new Array(256),qy=new Array(256);for(qn=0;qn<256;qn++)Hy[qn]=Iu(qn)?1:0,qy[qn]=Iu(qn);var qn;function Uy(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||$y,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}b(Uy,"State$1");function gd(e,t){var r={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return r.snippet=AL(r),new rr(t,r)}b(gd,"generateError");function me(e,t){throw gd(e,t)}b(me,"throwError");function aa(e,t){e.onWarning&&e.onWarning.call(null,gd(e,t))}b(aa,"throwWarning");var Ag={YAML:b(function(t,r,n){var s,i,a;t.version!==null&&me(t,"duplication of %YAML directive"),n.length!==1&&me(t,"YAML directive accepts exactly one argument"),s=/^([0-9]+)\.([0-9]+)$/.exec(n[0]),s===null&&me(t,"ill-formed argument of the YAML directive"),i=parseInt(s[1],10),a=parseInt(s[2],10),i!==1&&me(t,"unacceptable YAML version of the document"),t.version=n[0],t.checkLineBreaks=a<2,a!==1&&a!==2&&aa(t,"unsupported YAML version of the document")},"handleYamlDirective"),TAG:b(function(t,r,n){var s,i;n.length!==2&&me(t,"TAG directive accepts exactly two arguments"),s=n[0],i=n[1],Ry.test(s)||me(t,"ill-formed tag handle (first argument) of the TAG directive"),An.call(t.tagMap,s)&&me(t,'there is a previously declared suffix for "'+s+'" tag handle'),Py.test(i)||me(t,"ill-formed tag prefix (second argument) of the TAG directive");try{i=decodeURIComponent(i)}catch{me(t,"tag prefix is malformed: "+i)}t.tagMap[s]=i},"handleTagDirective")};function on(e,t,r,n){var s,i,a,o;if(t<r){if(o=e.input.slice(t,r),n)for(s=0,i=o.length;s<i;s+=1)a=o.charCodeAt(s),a===9||32<=a&&a<=1114111||me(e,"expected valid JSON character");else t$.test(o)&&me(e,"the stream contains non-printable characters");e.result+=o}}b(on,"captureSegment");function Lu(e,t,r,n){var s,i,a,o;for(St.isObject(r)||me(e,"cannot merge mappings; the provided source object is unacceptable"),s=Object.keys(r),a=0,o=s.length;a<o;a+=1)i=s[a],An.call(t,i)||(t[i]=r[i],n[i]=!0)}b(Lu,"mergeMappings");function Qn(e,t,r,n,s,i,a,o,l){var c,u;if(Array.isArray(s))for(s=Array.prototype.slice.call(s),c=0,u=s.length;c<u;c+=1)Array.isArray(s[c])&&me(e,"nested arrays are not supported inside keys"),typeof s=="object"&&ju(s[c])==="[object Object]"&&(s[c]="[object Object]");if(typeof s=="object"&&ju(s)==="[object Object]"&&(s="[object Object]"),s=String(s),t===null&&(t={}),n==="tag:yaml.org,2002:merge")if(Array.isArray(i))for(c=0,u=i.length;c<u;c+=1)Lu(e,t,i[c],r);else Lu(e,t,i,r);else!e.json&&!An.call(r,s)&&An.call(t,s)&&(e.line=a||e.line,e.lineStart=o||e.lineStart,e.position=l||e.position,me(e,"duplicated mapping key")),s==="__proto__"?Object.defineProperty(t,s,{configurable:!0,enumerable:!0,writable:!0,value:i}):t[s]=i,delete r[s];return t}b(Qn,"storeMappingPair");function _l(e){var t;t=e.input.charCodeAt(e.position),t===10?e.position++:t===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):me(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}b(_l,"readLineBreak");function pt(e,t,r){for(var n=0,s=e.input.charCodeAt(e.position);s!==0;){for(;Nn(s);)s===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),s=e.input.charCodeAt(++e.position);if(t&&s===35)do s=e.input.charCodeAt(++e.position);while(s!==10&&s!==13&&s!==0);if(jr(s))for(_l(e),s=e.input.charCodeAt(e.position),n++,e.lineIndent=0;s===32;)e.lineIndent++,s=e.input.charCodeAt(++e.position);else break}return r!==-1&&n!==0&&e.lineIndent<r&&aa(e,"deficient indentation"),n}b(pt,"skipSeparationSpace");function Ca(e){var t=e.position,r;return r=e.input.charCodeAt(t),!!((r===45||r===46)&&r===e.input.charCodeAt(t+1)&&r===e.input.charCodeAt(t+2)&&(t+=3,r=e.input.charCodeAt(t),r===0||Wt(r)))}b(Ca,"testDocumentSeparator");function Tl(e,t){t===1?e.result+=" ":t>1&&(e.result+=St.repeat(`
223
+ `,t-1))}b(Tl,"writeFoldedLines");function Vy(e,t,r){var n,s,i,a,o,l,c,u,h=e.kind,f=e.result,g;if(g=e.input.charCodeAt(e.position),Wt(g)||Kn(g)||g===35||g===38||g===42||g===33||g===124||g===62||g===39||g===34||g===37||g===64||g===96||(g===63||g===45)&&(s=e.input.charCodeAt(e.position+1),Wt(s)||r&&Kn(s)))return!1;for(e.kind="scalar",e.result="",i=a=e.position,o=!1;g!==0;){if(g===58){if(s=e.input.charCodeAt(e.position+1),Wt(s)||r&&Kn(s))break}else if(g===35){if(n=e.input.charCodeAt(e.position-1),Wt(n))break}else{if(e.position===e.lineStart&&Ca(e)||r&&Kn(g))break;if(jr(g))if(l=e.line,c=e.lineStart,u=e.lineIndent,pt(e,!1,-1),e.lineIndent>=t){o=!0,g=e.input.charCodeAt(e.position);continue}else{e.position=a,e.line=l,e.lineStart=c,e.lineIndent=u;break}}o&&(on(e,i,a,!1),Tl(e,e.line-l),i=a=e.position,o=!1),Nn(g)||(a=e.position+1),g=e.input.charCodeAt(++e.position)}return on(e,i,a,!1),e.result?!0:(e.kind=h,e.result=f,!1)}b(Vy,"readPlainScalar");function Gy(e,t){var r,n,s;if(r=e.input.charCodeAt(e.position),r!==39)return!1;for(e.kind="scalar",e.result="",e.position++,n=s=e.position;(r=e.input.charCodeAt(e.position))!==0;)if(r===39)if(on(e,n,e.position,!0),r=e.input.charCodeAt(++e.position),r===39)n=e.position,e.position++,s=e.position;else return!0;else jr(r)?(on(e,n,s,!0),Tl(e,pt(e,!1,t)),n=s=e.position):e.position===e.lineStart&&Ca(e)?me(e,"unexpected end of the document within a single quoted scalar"):(e.position++,s=e.position);me(e,"unexpected end of the stream within a single quoted scalar")}b(Gy,"readSingleQuotedScalar");function Yy(e,t){var r,n,s,i,a,o;if(o=e.input.charCodeAt(e.position),o!==34)return!1;for(e.kind="scalar",e.result="",e.position++,r=n=e.position;(o=e.input.charCodeAt(e.position))!==0;){if(o===34)return on(e,r,e.position,!0),e.position++,!0;if(o===92){if(on(e,r,e.position,!0),o=e.input.charCodeAt(++e.position),jr(o))pt(e,!1,t);else if(o<256&&Hy[o])e.result+=qy[o],e.position++;else if((a=Oy(o))>0){for(s=a,i=0;s>0;s--)o=e.input.charCodeAt(++e.position),(a=Fy(o))>=0?i=(i<<4)+a:me(e,"expected hexadecimal character");e.result+=Wy(i),e.position++}else me(e,"unknown escape sequence");r=n=e.position}else jr(o)?(on(e,r,n,!0),Tl(e,pt(e,!1,t)),r=n=e.position):e.position===e.lineStart&&Ca(e)?me(e,"unexpected end of the document within a double quoted scalar"):(e.position++,n=e.position)}me(e,"unexpected end of the stream within a double quoted scalar")}b(Yy,"readDoubleQuotedScalar");function Xy(e,t){var r=!0,n,s,i,a=e.tag,o,l=e.anchor,c,u,h,f,g,p=Object.create(null),m,y,x,k;if(k=e.input.charCodeAt(e.position),k===91)u=93,g=!1,o=[];else if(k===123)u=125,g=!0,o={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=o),k=e.input.charCodeAt(++e.position);k!==0;){if(pt(e,!0,t),k=e.input.charCodeAt(e.position),k===u)return e.position++,e.tag=a,e.anchor=l,e.kind=g?"mapping":"sequence",e.result=o,!0;r?k===44&&me(e,"expected the node content, but found ','"):me(e,"missed comma between flow collection entries"),y=m=x=null,h=f=!1,k===63&&(c=e.input.charCodeAt(e.position+1),Wt(c)&&(h=f=!0,e.position++,pt(e,!0,t))),n=e.line,s=e.lineStart,i=e.position,os(e,t,zo,!1,!0),y=e.tag,m=e.result,pt(e,!0,t),k=e.input.charCodeAt(e.position),(f||e.line===n)&&k===58&&(h=!0,k=e.input.charCodeAt(++e.position),pt(e,!0,t),os(e,t,zo,!1,!0),x=e.result),g?Qn(e,o,p,y,m,x,n,s,i):h?o.push(Qn(e,null,p,y,m,x,n,s,i)):o.push(m),pt(e,!0,t),k=e.input.charCodeAt(e.position),k===44?(r=!0,k=e.input.charCodeAt(++e.position)):r=!1}me(e,"unexpected end of the stream within a flow collection")}b(Xy,"readFlowCollection");function Ky(e,t){var r,n,s=$c,i=!1,a=!1,o=t,l=0,c=!1,u,h;if(h=e.input.charCodeAt(e.position),h===124)n=!1;else if(h===62)n=!0;else return!1;for(e.kind="scalar",e.result="";h!==0;)if(h=e.input.charCodeAt(++e.position),h===43||h===45)$c===s?s=h===43?Eg:e$:me(e,"repeat of a chomping mode identifier");else if((u=zy(h))>=0)u===0?me(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):a?me(e,"repeat of an indentation width identifier"):(o=t+u-1,a=!0);else break;if(Nn(h)){do h=e.input.charCodeAt(++e.position);while(Nn(h));if(h===35)do h=e.input.charCodeAt(++e.position);while(!jr(h)&&h!==0)}for(;h!==0;){for(_l(e),e.lineIndent=0,h=e.input.charCodeAt(e.position);(!a||e.lineIndent<o)&&h===32;)e.lineIndent++,h=e.input.charCodeAt(++e.position);if(!a&&e.lineIndent>o&&(o=e.lineIndent),jr(h)){l++;continue}if(e.lineIndent<o){s===Eg?e.result+=St.repeat(`
224
+ `,i?1+l:l):s===$c&&i&&(e.result+=`
225
+ `);break}for(n?Nn(h)?(c=!0,e.result+=St.repeat(`
226
+ `,i?1+l:l)):c?(c=!1,e.result+=St.repeat(`
227
+ `,l+1)):l===0?i&&(e.result+=" "):e.result+=St.repeat(`
228
+ `,l):e.result+=St.repeat(`
229
+ `,i?1+l:l),i=!0,a=!0,l=0,r=e.position;!jr(h)&&h!==0;)h=e.input.charCodeAt(++e.position);on(e,r,e.position,!1)}return!0}b(Ky,"readBlockScalar");function $u(e,t){var r,n=e.tag,s=e.anchor,i=[],a,o=!1,l;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=i),l=e.input.charCodeAt(e.position);l!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,me(e,"tab characters must not be used in indentation")),!(l!==45||(a=e.input.charCodeAt(e.position+1),!Wt(a))));){if(o=!0,e.position++,pt(e,!0,-1)&&e.lineIndent<=t){i.push(null),l=e.input.charCodeAt(e.position);continue}if(r=e.line,os(e,t,By,!1,!0),i.push(e.result),pt(e,!0,-1),l=e.input.charCodeAt(e.position),(e.line===r||e.lineIndent>t)&&l!==0)me(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break}return o?(e.tag=n,e.anchor=s,e.kind="sequence",e.result=i,!0):!1}b($u,"readBlockSequence");function Qy(e,t,r){var n,s,i,a,o,l,c=e.tag,u=e.anchor,h={},f=Object.create(null),g=null,p=null,m=null,y=!1,x=!1,k;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=h),k=e.input.charCodeAt(e.position);k!==0;){if(!y&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,me(e,"tab characters must not be used in indentation")),n=e.input.charCodeAt(e.position+1),i=e.line,(k===63||k===58)&&Wt(n))k===63?(y&&(Qn(e,h,f,g,p,null,a,o,l),g=p=m=null),x=!0,y=!0,s=!0):y?(y=!1,s=!0):me(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,k=n;else{if(a=e.line,o=e.lineStart,l=e.position,!os(e,r,Dy,!1,!0))break;if(e.line===i){for(k=e.input.charCodeAt(e.position);Nn(k);)k=e.input.charCodeAt(++e.position);if(k===58)k=e.input.charCodeAt(++e.position),Wt(k)||me(e,"a whitespace character is expected after the key-value separator within a block mapping"),y&&(Qn(e,h,f,g,p,null,a,o,l),g=p=m=null),x=!0,y=!1,s=!1,g=e.tag,p=e.result;else if(x)me(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=c,e.anchor=u,!0}else if(x)me(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=c,e.anchor=u,!0}if((e.line===i||e.lineIndent>t)&&(y&&(a=e.line,o=e.lineStart,l=e.position),os(e,t,Wo,!0,s)&&(y?p=e.result:m=e.result),y||(Qn(e,h,f,g,p,m,a,o,l),g=p=m=null),pt(e,!0,-1),k=e.input.charCodeAt(e.position)),(e.line===i||e.lineIndent>t)&&k!==0)me(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return y&&Qn(e,h,f,g,p,null,a,o,l),x&&(e.tag=c,e.anchor=u,e.kind="mapping",e.result=h),x}b(Qy,"readBlockMapping");function Zy(e){var t,r=!1,n=!1,s,i,a;if(a=e.input.charCodeAt(e.position),a!==33)return!1;if(e.tag!==null&&me(e,"duplication of a tag property"),a=e.input.charCodeAt(++e.position),a===60?(r=!0,a=e.input.charCodeAt(++e.position)):a===33?(n=!0,s="!!",a=e.input.charCodeAt(++e.position)):s="!",t=e.position,r){do a=e.input.charCodeAt(++e.position);while(a!==0&&a!==62);e.position<e.length?(i=e.input.slice(t,e.position),a=e.input.charCodeAt(++e.position)):me(e,"unexpected end of the stream within a verbatim tag")}else{for(;a!==0&&!Wt(a);)a===33&&(n?me(e,"tag suffix cannot contain exclamation marks"):(s=e.input.slice(t-1,e.position+1),Ry.test(s)||me(e,"named tag handle cannot contain such characters"),n=!0,t=e.position+1)),a=e.input.charCodeAt(++e.position);i=e.input.slice(t,e.position),n$.test(i)&&me(e,"tag suffix cannot contain flow indicator characters")}i&&!Py.test(i)&&me(e,"tag name cannot contain such characters: "+i);try{i=decodeURIComponent(i)}catch{me(e,"tag name is malformed: "+i)}return r?e.tag=i:An.call(e.tagMap,s)?e.tag=e.tagMap[s]+i:s==="!"?e.tag="!"+i:s==="!!"?e.tag="tag:yaml.org,2002:"+i:me(e,'undeclared tag handle "'+s+'"'),!0}b(Zy,"readTagProperty");function Jy(e){var t,r;if(r=e.input.charCodeAt(e.position),r!==38)return!1;for(e.anchor!==null&&me(e,"duplication of an anchor property"),r=e.input.charCodeAt(++e.position),t=e.position;r!==0&&!Wt(r)&&!Kn(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&me(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}b(Jy,"readAnchorProperty");function eb(e){var t,r,n;if(n=e.input.charCodeAt(e.position),n!==42)return!1;for(n=e.input.charCodeAt(++e.position),t=e.position;n!==0&&!Wt(n)&&!Kn(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&me(e,"name of an alias node must contain at least one character"),r=e.input.slice(t,e.position),An.call(e.anchorMap,r)||me(e,'unidentified alias "'+r+'"'),e.result=e.anchorMap[r],pt(e,!0,-1),!0}b(eb,"readAlias");function os(e,t,r,n,s){var i,a,o,l=1,c=!1,u=!1,h,f,g,p,m,y;if(e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,i=a=o=Wo===r||By===r,n&&pt(e,!0,-1)&&(c=!0,e.lineIndent>t?l=1:e.lineIndent===t?l=0:e.lineIndent<t&&(l=-1)),l===1)for(;Zy(e)||Jy(e);)pt(e,!0,-1)?(c=!0,o=i,e.lineIndent>t?l=1:e.lineIndent===t?l=0:e.lineIndent<t&&(l=-1)):o=!1;if(o&&(o=c||s),(l===1||Wo===r)&&(zo===r||Dy===r?m=t:m=t+1,y=e.position-e.lineStart,l===1?o&&($u(e,y)||Qy(e,y,m))||Xy(e,m)?u=!0:(a&&Ky(e,m)||Gy(e,m)||Yy(e,m)?u=!0:eb(e)?(u=!0,(e.tag!==null||e.anchor!==null)&&me(e,"alias node should not have any properties")):Vy(e,m,zo===r)&&(u=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):l===0&&(u=o&&$u(e,y))),e.tag===null)e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);else if(e.tag==="?"){for(e.result!==null&&e.kind!=="scalar"&&me(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),h=0,f=e.implicitTypes.length;h<f;h+=1)if(p=e.implicitTypes[h],p.resolve(e.result)){e.result=p.construct(e.result),e.tag=p.tag,e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);break}}else if(e.tag!=="!"){if(An.call(e.typeMap[e.kind||"fallback"],e.tag))p=e.typeMap[e.kind||"fallback"][e.tag];else for(p=null,g=e.typeMap.multi[e.kind||"fallback"],h=0,f=g.length;h<f;h+=1)if(e.tag.slice(0,g[h].tag.length)===g[h].tag){p=g[h];break}p||me(e,"unknown tag !<"+e.tag+">"),e.result!==null&&p.kind!==e.kind&&me(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+p.kind+'", not "'+e.kind+'"'),p.resolve(e.result,e.tag)?(e.result=p.construct(e.result,e.tag),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):me(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||u}b(os,"composeNode");function tb(e){var t=e.position,r,n,s,i=!1,a;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(a=e.input.charCodeAt(e.position))!==0&&(pt(e,!0,-1),a=e.input.charCodeAt(e.position),!(e.lineIndent>0||a!==37));){for(i=!0,a=e.input.charCodeAt(++e.position),r=e.position;a!==0&&!Wt(a);)a=e.input.charCodeAt(++e.position);for(n=e.input.slice(r,e.position),s=[],n.length<1&&me(e,"directive name must not be less than one character in length");a!==0;){for(;Nn(a);)a=e.input.charCodeAt(++e.position);if(a===35){do a=e.input.charCodeAt(++e.position);while(a!==0&&!jr(a));break}if(jr(a))break;for(r=e.position;a!==0&&!Wt(a);)a=e.input.charCodeAt(++e.position);s.push(e.input.slice(r,e.position))}a!==0&&_l(e),An.call(Ag,n)?Ag[n](e,n,s):aa(e,'unknown document directive "'+n+'"')}if(pt(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,pt(e,!0,-1)):i&&me(e,"directives end mark is expected"),os(e,e.lineIndent-1,Wo,!1,!0),pt(e,!0,-1),e.checkLineBreaks&&r$.test(e.input.slice(t,e.position))&&aa(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&Ca(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,pt(e,!0,-1));return}if(e.position<e.length-1)me(e,"end of the stream or a document separator is expected");else return}b(tb,"readDocument");function pd(e,t){e=String(e),t=t||{},e.length!==0&&(e.charCodeAt(e.length-1)!==10&&e.charCodeAt(e.length-1)!==13&&(e+=`
230
+ `),e.charCodeAt(0)===65279&&(e=e.slice(1)));var r=new Uy(e,t),n=e.indexOf("\0");for(n!==-1&&(r.position=n,me(r,"null byte is not allowed in input")),r.input+="\0";r.input.charCodeAt(r.position)===32;)r.lineIndent+=1,r.position+=1;for(;r.position<r.length-1;)tb(r);return r.documents}b(pd,"loadDocuments");function s$(e,t,r){t!==null&&typeof t=="object"&&typeof r>"u"&&(r=t,t=null);var n=pd(e,r);if(typeof t!="function")return n;for(var s=0,i=n.length;s<i;s+=1)t(n[s])}b(s$,"loadAll$1");function rb(e,t){var r=pd(e,t);if(r.length!==0){if(r.length===1)return r[0];throw new rr("expected a single document in the stream, but found more")}}b(rb,"load$1");var i$=rb,a$={load:i$},nb=Object.prototype.toString,sb=Object.prototype.hasOwnProperty,md=65279,o$=9,oa=10,l$=13,c$=32,u$=33,h$=34,Du=35,d$=37,f$=38,g$=39,p$=42,ib=44,m$=45,Ho=58,x$=61,y$=62,b$=63,k$=64,ab=91,ob=93,w$=96,lb=123,v$=124,cb=125,Pt={};Pt[0]="\\0";Pt[7]="\\a";Pt[8]="\\b";Pt[9]="\\t";Pt[10]="\\n";Pt[11]="\\v";Pt[12]="\\f";Pt[13]="\\r";Pt[27]="\\e";Pt[34]='\\"';Pt[92]="\\\\";Pt[133]="\\N";Pt[160]="\\_";Pt[8232]="\\L";Pt[8233]="\\P";var C$=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],S$=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function ub(e,t){var r,n,s,i,a,o,l;if(t===null)return{};for(r={},n=Object.keys(t),s=0,i=n.length;s<i;s+=1)a=n[s],o=String(t[a]),a.slice(0,2)==="!!"&&(a="tag:yaml.org,2002:"+a.slice(2)),l=e.compiledTypeMap.fallback[a],l&&sb.call(l.styleAliases,o)&&(o=l.styleAliases[o]),r[a]=o;return r}b(ub,"compileStyleMap");function hb(e){var t,r,n;if(t=e.toString(16).toUpperCase(),e<=255)r="x",n=2;else if(e<=65535)r="u",n=4;else if(e<=4294967295)r="U",n=8;else throw new rr("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+r+St.repeat("0",n-t.length)+t}b(hb,"encodeHex");var _$=1,la=2;function db(e){this.schema=e.schema||$y,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=St.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=ub(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.quotingType=e.quotingType==='"'?la:_$,this.forceQuotes=e.forceQuotes||!1,this.replacer=typeof e.replacer=="function"?e.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}b(db,"State");function Bu(e,t){for(var r=St.repeat(" ",t),n=0,s=-1,i="",a,o=e.length;n<o;)s=e.indexOf(`
231
+ `,n),s===-1?(a=e.slice(n),n=o):(a=e.slice(n,s+1),n=s+1),a.length&&a!==`
232
+ `&&(i+=r),i+=a;return i}b(Bu,"indentString");function qo(e,t){return`
233
+ `+St.repeat(" ",e.indent*t)}b(qo,"generateNextLine");function fb(e,t){var r,n,s;for(r=0,n=e.implicitTypes.length;r<n;r+=1)if(s=e.implicitTypes[r],s.resolve(t))return!0;return!1}b(fb,"testImplicitResolving");function ca(e){return e===c$||e===o$}b(ca,"isWhitespace");function Js(e){return 32<=e&&e<=126||161<=e&&e<=55295&&e!==8232&&e!==8233||57344<=e&&e<=65533&&e!==md||65536<=e&&e<=1114111}b(Js,"isPrintable");function Ru(e){return Js(e)&&e!==md&&e!==l$&&e!==oa}b(Ru,"isNsCharOrWhitespace");function Pu(e,t,r){var n=Ru(e),s=n&&!ca(e);return(r?n:n&&e!==ib&&e!==ab&&e!==ob&&e!==lb&&e!==cb)&&e!==Du&&!(t===Ho&&!s)||Ru(t)&&!ca(t)&&e===Du||t===Ho&&s}b(Pu,"isPlainSafe");function gb(e){return Js(e)&&e!==md&&!ca(e)&&e!==m$&&e!==b$&&e!==Ho&&e!==ib&&e!==ab&&e!==ob&&e!==lb&&e!==cb&&e!==Du&&e!==f$&&e!==p$&&e!==u$&&e!==v$&&e!==x$&&e!==y$&&e!==g$&&e!==h$&&e!==d$&&e!==k$&&e!==w$}b(gb,"isPlainSafeFirst");function pb(e){return!ca(e)&&e!==Ho}b(pb,"isPlainSafeLast");function Is(e,t){var r=e.charCodeAt(t),n;return r>=55296&&r<=56319&&t+1<e.length&&(n=e.charCodeAt(t+1),n>=56320&&n<=57343)?(r-55296)*1024+n-56320+65536:r}b(Is,"codePointAt");function xd(e){var t=/^\n* /;return t.test(e)}b(xd,"needIndentIndicator");var mb=1,Fu=2,xb=3,yb=4,Ms=5;function bb(e,t,r,n,s,i,a,o){var l,c=0,u=null,h=!1,f=!1,g=n!==-1,p=-1,m=gb(Is(e,0))&&pb(Is(e,e.length-1));if(t||a)for(l=0;l<e.length;c>=65536?l+=2:l++){if(c=Is(e,l),!Js(c))return Ms;m=m&&Pu(c,u,o),u=c}else{for(l=0;l<e.length;c>=65536?l+=2:l++){if(c=Is(e,l),c===oa)h=!0,g&&(f=f||l-p-1>n&&e[p+1]!==" ",p=l);else if(!Js(c))return Ms;m=m&&Pu(c,u,o),u=c}f=f||g&&l-p-1>n&&e[p+1]!==" "}return!h&&!f?m&&!a&&!s(e)?mb:i===la?Ms:Fu:r>9&&xd(e)?Ms:a?i===la?Ms:Fu:f?yb:xb}b(bb,"chooseScalarStyle");function kb(e,t,r,n,s){e.dump=(function(){if(t.length===0)return e.quotingType===la?'""':"''";if(!e.noCompatMode&&(C$.indexOf(t)!==-1||S$.test(t)))return e.quotingType===la?'"'+t+'"':"'"+t+"'";var i=e.indent*Math.max(1,r),a=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-i),o=n||e.flowLevel>-1&&r>=e.flowLevel;function l(c){return fb(e,c)}switch(b(l,"testAmbiguity"),bb(t,o,e.indent,a,l,e.quotingType,e.forceQuotes&&!n,s)){case mb:return t;case Fu:return"'"+t.replace(/'/g,"''")+"'";case xb:return"|"+Ou(t,e.indent)+zu(Bu(t,i));case yb:return">"+Ou(t,e.indent)+zu(Bu(wb(t,a),i));case Ms:return'"'+vb(t)+'"';default:throw new rr("impossible error: invalid scalar style")}})()}b(kb,"writeScalar");function Ou(e,t){var r=xd(e)?String(t):"",n=e[e.length-1]===`
234
+ `,s=n&&(e[e.length-2]===`
235
+ `||e===`
236
+ `),i=s?"+":n?"":"-";return r+i+`
237
+ `}b(Ou,"blockHeader");function zu(e){return e[e.length-1]===`
238
+ `?e.slice(0,-1):e}b(zu,"dropEndingNewline");function wb(e,t){for(var r=/(\n+)([^\n]*)/g,n=(function(){var c=e.indexOf(`
239
+ `);return c=c!==-1?c:e.length,r.lastIndex=c,Wu(e.slice(0,c),t)})(),s=e[0]===`
240
+ `||e[0]===" ",i,a;a=r.exec(e);){var o=a[1],l=a[2];i=l[0]===" ",n+=o+(!s&&!i&&l!==""?`
241
+ `:"")+Wu(l,t),s=i}return n}b(wb,"foldString");function Wu(e,t){if(e===""||e[0]===" ")return e;for(var r=/ [^ ]/g,n,s=0,i,a=0,o=0,l="";n=r.exec(e);)o=n.index,o-s>t&&(i=a>s?a:o,l+=`
242
+ `+e.slice(s,i),s=i+1),a=o;return l+=`
243
+ `,e.length-s>t&&a>s?l+=e.slice(s,a)+`
244
+ `+e.slice(a+1):l+=e.slice(s),l.slice(1)}b(Wu,"foldLine");function vb(e){for(var t="",r=0,n,s=0;s<e.length;r>=65536?s+=2:s++)r=Is(e,s),n=Pt[r],!n&&Js(r)?(t+=e[s],r>=65536&&(t+=e[s+1])):t+=n||hb(r);return t}b(vb,"escapeString");function Cb(e,t,r){var n="",s=e.tag,i,a,o;for(i=0,a=r.length;i<a;i+=1)o=r[i],e.replacer&&(o=e.replacer.call(r,String(i),o)),(Ur(e,t,o,!1,!1)||typeof o>"u"&&Ur(e,t,null,!1,!1))&&(n!==""&&(n+=","+(e.condenseFlow?"":" ")),n+=e.dump);e.tag=s,e.dump="["+n+"]"}b(Cb,"writeFlowSequence");function Hu(e,t,r,n){var s="",i=e.tag,a,o,l;for(a=0,o=r.length;a<o;a+=1)l=r[a],e.replacer&&(l=e.replacer.call(r,String(a),l)),(Ur(e,t+1,l,!0,!0,!1,!0)||typeof l>"u"&&Ur(e,t+1,null,!0,!0,!1,!0))&&((!n||s!=="")&&(s+=qo(e,t)),e.dump&&oa===e.dump.charCodeAt(0)?s+="-":s+="- ",s+=e.dump);e.tag=i,e.dump=s||"[]"}b(Hu,"writeBlockSequence");function Sb(e,t,r){var n="",s=e.tag,i=Object.keys(r),a,o,l,c,u;for(a=0,o=i.length;a<o;a+=1)u="",n!==""&&(u+=", "),e.condenseFlow&&(u+='"'),l=i[a],c=r[l],e.replacer&&(c=e.replacer.call(r,l,c)),Ur(e,t,l,!1,!1)&&(e.dump.length>1024&&(u+="? "),u+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),Ur(e,t,c,!1,!1)&&(u+=e.dump,n+=u));e.tag=s,e.dump="{"+n+"}"}b(Sb,"writeFlowMapping");function _b(e,t,r,n){var s="",i=e.tag,a=Object.keys(r),o,l,c,u,h,f;if(e.sortKeys===!0)a.sort();else if(typeof e.sortKeys=="function")a.sort(e.sortKeys);else if(e.sortKeys)throw new rr("sortKeys must be a boolean or a function");for(o=0,l=a.length;o<l;o+=1)f="",(!n||s!=="")&&(f+=qo(e,t)),c=a[o],u=r[c],e.replacer&&(u=e.replacer.call(r,c,u)),Ur(e,t+1,c,!0,!0,!0)&&(h=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,h&&(e.dump&&oa===e.dump.charCodeAt(0)?f+="?":f+="? "),f+=e.dump,h&&(f+=qo(e,t)),Ur(e,t+1,u,!0,h)&&(e.dump&&oa===e.dump.charCodeAt(0)?f+=":":f+=": ",f+=e.dump,s+=f));e.tag=i,e.dump=s||"{}"}b(_b,"writeBlockMapping");function qu(e,t,r){var n,s,i,a,o,l;for(s=r?e.explicitTypes:e.implicitTypes,i=0,a=s.length;i<a;i+=1)if(o=s[i],(o.instanceOf||o.predicate)&&(!o.instanceOf||typeof t=="object"&&t instanceof o.instanceOf)&&(!o.predicate||o.predicate(t))){if(r?o.multi&&o.representName?e.tag=o.representName(t):e.tag=o.tag:e.tag="?",o.represent){if(l=e.styleMap[o.tag]||o.defaultStyle,nb.call(o.represent)==="[object Function]")n=o.represent(t,l);else if(sb.call(o.represent,l))n=o.represent[l](t,l);else throw new rr("!<"+o.tag+'> tag resolver accepts not "'+l+'" style');e.dump=n}return!0}return!1}b(qu,"detectType");function Ur(e,t,r,n,s,i,a){e.tag=null,e.dump=r,qu(e,r,!1)||qu(e,r,!0);var o=nb.call(e.dump),l=n,c;n&&(n=e.flowLevel<0||e.flowLevel>t);var u=o==="[object Object]"||o==="[object Array]",h,f;if(u&&(h=e.duplicates.indexOf(r),f=h!==-1),(e.tag!==null&&e.tag!=="?"||f||e.indent!==2&&t>0)&&(s=!1),f&&e.usedDuplicates[h])e.dump="*ref_"+h;else{if(u&&f&&!e.usedDuplicates[h]&&(e.usedDuplicates[h]=!0),o==="[object Object]")n&&Object.keys(e.dump).length!==0?(_b(e,t,e.dump,s),f&&(e.dump="&ref_"+h+e.dump)):(Sb(e,t,e.dump),f&&(e.dump="&ref_"+h+" "+e.dump));else if(o==="[object Array]")n&&e.dump.length!==0?(e.noArrayIndent&&!a&&t>0?Hu(e,t-1,e.dump,s):Hu(e,t,e.dump,s),f&&(e.dump="&ref_"+h+e.dump)):(Cb(e,t,e.dump),f&&(e.dump="&ref_"+h+" "+e.dump));else if(o==="[object String]")e.tag!=="?"&&kb(e,e.dump,t,i,l);else{if(o==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new rr("unacceptable kind of an object to dump "+o)}e.tag!==null&&e.tag!=="?"&&(c=encodeURI(e.tag[0]==="!"?e.tag.slice(1):e.tag).replace(/!/g,"%21"),e.tag[0]==="!"?c="!"+c:c.slice(0,18)==="tag:yaml.org,2002:"?c="!!"+c.slice(18):c="!<"+c+">",e.dump=c+" "+e.dump)}return!0}b(Ur,"writeNode");function Tb(e,t){var r=[],n=[],s,i;for(Uo(e,r,n),s=0,i=n.length;s<i;s+=1)t.duplicates.push(r[n[s]]);t.usedDuplicates=new Array(i)}b(Tb,"getDuplicateReferences");function Uo(e,t,r){var n,s,i;if(e!==null&&typeof e=="object")if(s=t.indexOf(e),s!==-1)r.indexOf(s)===-1&&r.push(s);else if(t.push(e),Array.isArray(e))for(s=0,i=e.length;s<i;s+=1)Uo(e[s],t,r);else for(n=Object.keys(e),s=0,i=n.length;s<i;s+=1)Uo(e[n[s]],t,r)}b(Uo,"inspectNode");function T$(e,t){t=t||{};var r=new db(t);r.noRefs||Tb(e,r);var n=e;return r.replacer&&(n=r.replacer.call({"":n},"",n)),Ur(r,0,n,!0,!0)?r.dump+`
245
+ `:""}b(T$,"dump$1");function N$(e,t){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+t+" instead, which is now safe by default.")}}b(N$,"renamed");var E$=xy,A$=a$.load;/*! Bundled license information:
246
+
247
+ js-yaml/dist/js-yaml.mjs:
248
+ (*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT *)
249
+ */var It={aggregation:17.25,extension:17.25,composition:17.25,dependency:6,lollipop:13.5,arrow_point:4},Mg={arrow_point:9,arrow_cross:12.5,arrow_circle:12.5};function Bi(e,t){if(e===void 0||t===void 0)return{angle:0,deltaX:0,deltaY:0};e=at(e),t=at(t);const[r,n]=[e.x,e.y],[s,i]=[t.x,t.y],a=s-r,o=i-n;return{angle:Math.atan(o/a),deltaX:a,deltaY:o}}b(Bi,"calculateDeltaAndAngle");var at=b(e=>Array.isArray(e)?{x:e[0],y:e[1]}:e,"pointTransformer"),M$=b(e=>({x:b(function(t,r,n){let s=0;const i=at(n[0]).x<at(n[n.length-1]).x?"left":"right";if(r===0&&Object.hasOwn(It,e.arrowTypeStart)){const{angle:g,deltaX:p}=Bi(n[0],n[1]);s=It[e.arrowTypeStart]*Math.cos(g)*(p>=0?1:-1)}else if(r===n.length-1&&Object.hasOwn(It,e.arrowTypeEnd)){const{angle:g,deltaX:p}=Bi(n[n.length-1],n[n.length-2]);s=It[e.arrowTypeEnd]*Math.cos(g)*(p>=0?1:-1)}const a=Math.abs(at(t).x-at(n[n.length-1]).x),o=Math.abs(at(t).y-at(n[n.length-1]).y),l=Math.abs(at(t).x-at(n[0]).x),c=Math.abs(at(t).y-at(n[0]).y),u=It[e.arrowTypeStart],h=It[e.arrowTypeEnd],f=1;if(a<h&&a>0&&o<h){let g=h+f-a;g*=i==="right"?-1:1,s-=g}if(l<u&&l>0&&c<u){let g=u+f-l;g*=i==="right"?-1:1,s+=g}return at(t).x+s},"x"),y:b(function(t,r,n){let s=0;const i=at(n[0]).y<at(n[n.length-1]).y?"down":"up";if(r===0&&Object.hasOwn(It,e.arrowTypeStart)){const{angle:g,deltaY:p}=Bi(n[0],n[1]);s=It[e.arrowTypeStart]*Math.abs(Math.sin(g))*(p>=0?1:-1)}else if(r===n.length-1&&Object.hasOwn(It,e.arrowTypeEnd)){const{angle:g,deltaY:p}=Bi(n[n.length-1],n[n.length-2]);s=It[e.arrowTypeEnd]*Math.abs(Math.sin(g))*(p>=0?1:-1)}const a=Math.abs(at(t).y-at(n[n.length-1]).y),o=Math.abs(at(t).x-at(n[n.length-1]).x),l=Math.abs(at(t).y-at(n[0]).y),c=Math.abs(at(t).x-at(n[0]).x),u=It[e.arrowTypeStart],h=It[e.arrowTypeEnd],f=1;if(a<h&&a>0&&o<h){let g=h+f-a;g*=i==="up"?-1:1,s-=g}if(l<u&&l>0&&c<u){let g=u+f-l;g*=i==="up"?-1:1,s+=g}return at(t).y+s},"y")}),"getLineFunctionsWithOffset"),yd=b(({flowchart:e})=>{const t=e?.subGraphTitleMargin?.top??0,r=e?.subGraphTitleMargin?.bottom??0,n=t+r;return{subGraphTitleTopMargin:t,subGraphTitleBottomMargin:r,subGraphTitleTotalMargin:n}},"getSubGraphTitleMargins"),j$=b(e=>{const{handDrawnSeed:t}=He();return{fill:e,hachureAngle:120,hachureGap:4,fillWeight:2,roughness:.7,stroke:e,seed:t}},"solidStateFill"),ii=b(e=>{const t=I$([...e.cssCompiledStyles||[],...e.cssStyles||[],...e.labelStyle||[]]);return{stylesMap:t,stylesArray:[...t]}},"compileStyles"),I$=b(e=>{const t=new Map;return e.forEach(r=>{const[n,s]=r.split(":");t.set(n.trim(),s?.trim())}),t},"styles2Map"),Nb=b(e=>e==="color"||e==="font-size"||e==="font-family"||e==="font-weight"||e==="font-style"||e==="text-decoration"||e==="text-align"||e==="text-transform"||e==="line-height"||e==="letter-spacing"||e==="word-spacing"||e==="text-shadow"||e==="text-overflow"||e==="white-space"||e==="word-wrap"||e==="word-break"||e==="overflow-wrap"||e==="hyphens","isLabelStyle"),ge=b(e=>{const{stylesArray:t}=ii(e),r=[],n=[],s=[],i=[];return t.forEach(a=>{const o=a[0];Nb(o)?r.push(a.join(":")+" !important"):(n.push(a.join(":")+" !important"),o.includes("stroke")&&s.push(a.join(":")+" !important"),o==="fill"&&i.push(a.join(":")+" !important"))}),{labelStyles:r.join(";"),nodeStyles:n.join(";"),stylesArray:t,borderStyles:s,backgroundStyles:i}},"styles2String"),fe=b((e,t)=>{const{themeVariables:r,handDrawnSeed:n}=He(),{nodeBorder:s,mainBkg:i}=r,{stylesMap:a}=ii(e);return Object.assign({roughness:.7,fill:a.get("fill")||i,fillStyle:"hachure",fillWeight:4,hachureGap:5.2,stroke:a.get("stroke")||s,seed:n,strokeWidth:a.get("stroke-width")?.replace("px","")||1.3,fillLineDash:[0,0],strokeLineDash:L$(a.get("stroke-dasharray"))},t)},"userNodeOverrides"),L$=b(e=>{if(!e)return[0,0];const t=e.trim().split(/\s+/).map(Number);if(t.length===1){const s=isNaN(t[0])?0:t[0];return[s,s]}const r=isNaN(t[0])?0:t[0],n=isNaN(t[1])?0:t[1];return[r,n]},"getStrokeDashArray"),_i={},vt={},jg;function $$(){return jg||(jg=1,Object.defineProperty(vt,"__esModule",{value:!0}),vt.BLANK_URL=vt.relativeFirstCharacters=vt.whitespaceEscapeCharsRegex=vt.urlSchemeRegex=vt.ctrlCharactersRegex=vt.htmlCtrlEntityRegex=vt.htmlEntitiesRegex=vt.invalidProtocolRegex=void 0,vt.invalidProtocolRegex=/^([^\w]*)(javascript|data|vbscript)/im,vt.htmlEntitiesRegex=/&#(\w+)(^\w|;)?/g,vt.htmlCtrlEntityRegex=/&(newline|tab);/gi,vt.ctrlCharactersRegex=/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim,vt.urlSchemeRegex=/^.+(:|&colon;)/gim,vt.whitespaceEscapeCharsRegex=/(\\|%5[cC])((%(6[eE]|72|74))|[nrt])/g,vt.relativeFirstCharacters=[".","/"],vt.BLANK_URL="about:blank"),vt}var Ig;function D$(){if(Ig)return _i;Ig=1,Object.defineProperty(_i,"__esModule",{value:!0}),_i.sanitizeUrl=void 0;var e=$$();function t(a){return e.relativeFirstCharacters.indexOf(a[0])>-1}function r(a){var o=a.replace(e.ctrlCharactersRegex,"");return o.replace(e.htmlEntitiesRegex,function(l,c){return String.fromCharCode(c)})}function n(a){return URL.canParse(a)}function s(a){try{return decodeURIComponent(a)}catch{return a}}function i(a){if(!a)return e.BLANK_URL;var o,l=s(a.trim());do l=r(l).replace(e.htmlCtrlEntityRegex,"").replace(e.ctrlCharactersRegex,"").replace(e.whitespaceEscapeCharsRegex,"").trim(),l=s(l),o=l.match(e.ctrlCharactersRegex)||l.match(e.htmlEntitiesRegex)||l.match(e.htmlCtrlEntityRegex)||l.match(e.whitespaceEscapeCharsRegex);while(o&&o.length>0);var c=l;if(!c)return e.BLANK_URL;if(t(c))return c;var u=c.trimStart(),h=u.match(e.urlSchemeRegex);if(!h)return c;var f=h[0].toLowerCase().trim();if(e.invalidProtocolRegex.test(f))return e.BLANK_URL;var g=u.replace(/\\/g,"/");if(f==="mailto:"||f.includes("://"))return g;if(f==="http:"||f==="https:"){if(!n(g))return e.BLANK_URL;var p=new URL(g);return p.protocol=p.protocol.toLowerCase(),p.hostname=p.hostname.toLowerCase(),p.toString()}return g}return _i.sanitizeUrl=i,_i}var B$=D$(),Eb=typeof global=="object"&&global&&global.Object===Object&&global,R$=typeof self=="object"&&self&&self.Object===Object&&self,Yr=Eb||R$||Function("return this")(),Vo=Yr.Symbol,Ab=Object.prototype,P$=Ab.hasOwnProperty,F$=Ab.toString,Ti=Vo?Vo.toStringTag:void 0;function O$(e){var t=P$.call(e,Ti),r=e[Ti];try{e[Ti]=void 0;var n=!0}catch{}var s=F$.call(e);return n&&(t?e[Ti]=r:delete e[Ti]),s}var z$=Object.prototype,W$=z$.toString;function H$(e){return W$.call(e)}var q$="[object Null]",U$="[object Undefined]",Lg=Vo?Vo.toStringTag:void 0;function ai(e){return e==null?e===void 0?U$:q$:Lg&&Lg in Object(e)?O$(e):H$(e)}function ds(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var V$="[object AsyncFunction]",G$="[object Function]",Y$="[object GeneratorFunction]",X$="[object Proxy]";function bd(e){if(!ds(e))return!1;var t=ai(e);return t==G$||t==Y$||t==V$||t==X$}var Dc=Yr["__core-js_shared__"],$g=(function(){var e=/[^.]+$/.exec(Dc&&Dc.keys&&Dc.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function K$(e){return!!$g&&$g in e}var Q$=Function.prototype,Z$=Q$.toString;function fs(e){if(e!=null){try{return Z$.call(e)}catch{}try{return e+""}catch{}}return""}var J$=/[\\^$.*+?()[\]{}|]/g,e4=/^\[object .+?Constructor\]$/,t4=Function.prototype,r4=Object.prototype,n4=t4.toString,s4=r4.hasOwnProperty,i4=RegExp("^"+n4.call(s4).replace(J$,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function a4(e){if(!ds(e)||K$(e))return!1;var t=bd(e)?i4:e4;return t.test(fs(e))}function o4(e,t){return e?.[t]}function gs(e,t){var r=o4(e,t);return a4(r)?r:void 0}var ua=gs(Object,"create");function l4(){this.__data__=ua?ua(null):{},this.size=0}function c4(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var u4="__lodash_hash_undefined__",h4=Object.prototype,d4=h4.hasOwnProperty;function f4(e){var t=this.__data__;if(ua){var r=t[e];return r===u4?void 0:r}return d4.call(t,e)?t[e]:void 0}var g4=Object.prototype,p4=g4.hasOwnProperty;function m4(e){var t=this.__data__;return ua?t[e]!==void 0:p4.call(t,e)}var x4="__lodash_hash_undefined__";function y4(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=ua&&t===void 0?x4:t,this}function ls(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}ls.prototype.clear=l4;ls.prototype.delete=c4;ls.prototype.get=f4;ls.prototype.has=m4;ls.prototype.set=y4;function b4(){this.__data__=[],this.size=0}function Nl(e,t){return e===t||e!==e&&t!==t}function El(e,t){for(var r=e.length;r--;)if(Nl(e[r][0],t))return r;return-1}var k4=Array.prototype,w4=k4.splice;function v4(e){var t=this.__data__,r=El(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():w4.call(t,r,1),--this.size,!0}function C4(e){var t=this.__data__,r=El(t,e);return r<0?void 0:t[r][1]}function S4(e){return El(this.__data__,e)>-1}function _4(e,t){var r=this.__data__,n=El(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}function dn(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}dn.prototype.clear=b4;dn.prototype.delete=v4;dn.prototype.get=C4;dn.prototype.has=S4;dn.prototype.set=_4;var ha=gs(Yr,"Map");function T4(){this.size=0,this.__data__={hash:new ls,map:new(ha||dn),string:new ls}}function N4(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Al(e,t){var r=e.__data__;return N4(t)?r[typeof t=="string"?"string":"hash"]:r.map}function E4(e){var t=Al(this,e).delete(e);return this.size-=t?1:0,t}function A4(e){return Al(this,e).get(e)}function M4(e){return Al(this,e).has(e)}function j4(e,t){var r=Al(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}function Ln(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Ln.prototype.clear=T4;Ln.prototype.delete=E4;Ln.prototype.get=A4;Ln.prototype.has=M4;Ln.prototype.set=j4;var I4="Expected a function";function Sa(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(I4);var r=function(){var n=arguments,s=t?t.apply(this,n):n[0],i=r.cache;if(i.has(s))return i.get(s);var a=e.apply(this,n);return r.cache=i.set(s,a)||i,a};return r.cache=new(Sa.Cache||Ln),r}Sa.Cache=Ln;function L4(){this.__data__=new dn,this.size=0}function $4(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}function D4(e){return this.__data__.get(e)}function B4(e){return this.__data__.has(e)}var R4=200;function P4(e,t){var r=this.__data__;if(r instanceof dn){var n=r.__data__;if(!ha||n.length<R4-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Ln(n)}return r.set(e,t),this.size=r.size,this}function oi(e){var t=this.__data__=new dn(e);this.size=t.size}oi.prototype.clear=L4;oi.prototype.delete=$4;oi.prototype.get=D4;oi.prototype.has=B4;oi.prototype.set=P4;var Go=(function(){try{var e=gs(Object,"defineProperty");return e({},"",{}),e}catch{}})();function kd(e,t,r){t=="__proto__"&&Go?Go(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function Uu(e,t,r){(r!==void 0&&!Nl(e[t],r)||r===void 0&&!(t in e))&&kd(e,t,r)}function F4(e){return function(t,r,n){for(var s=-1,i=Object(t),a=n(t),o=a.length;o--;){var l=a[++s];if(r(i[l],l,i)===!1)break}return t}}var O4=F4(),Mb=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Dg=Mb&&typeof module=="object"&&module&&!module.nodeType&&module,z4=Dg&&Dg.exports===Mb,Bg=z4?Yr.Buffer:void 0,Rg=Bg?Bg.allocUnsafe:void 0;function W4(e,t){if(t)return e.slice();var r=e.length,n=Rg?Rg(r):new e.constructor(r);return e.copy(n),n}var Pg=Yr.Uint8Array;function H4(e){var t=new e.constructor(e.byteLength);return new Pg(t).set(new Pg(e)),t}function q4(e,t){var r=t?H4(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function U4(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}var Fg=Object.create,V4=(function(){function e(){}return function(t){if(!ds(t))return{};if(Fg)return Fg(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}})();function jb(e,t){return function(r){return e(t(r))}}var Ib=jb(Object.getPrototypeOf,Object),G4=Object.prototype;function Ml(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||G4;return e===r}function Y4(e){return typeof e.constructor=="function"&&!Ml(e)?V4(Ib(e)):{}}function _a(e){return e!=null&&typeof e=="object"}var X4="[object Arguments]";function Og(e){return _a(e)&&ai(e)==X4}var Lb=Object.prototype,K4=Lb.hasOwnProperty,Q4=Lb.propertyIsEnumerable,Yo=Og((function(){return arguments})())?Og:function(e){return _a(e)&&K4.call(e,"callee")&&!Q4.call(e,"callee")},Xo=Array.isArray,Z4=9007199254740991;function $b(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Z4}function jl(e){return e!=null&&$b(e.length)&&!bd(e)}function J4(e){return _a(e)&&jl(e)}function e5(){return!1}var Db=typeof exports=="object"&&exports&&!exports.nodeType&&exports,zg=Db&&typeof module=="object"&&module&&!module.nodeType&&module,t5=zg&&zg.exports===Db,Wg=t5?Yr.Buffer:void 0,r5=Wg?Wg.isBuffer:void 0,wd=r5||e5,n5="[object Object]",s5=Function.prototype,i5=Object.prototype,Bb=s5.toString,a5=i5.hasOwnProperty,o5=Bb.call(Object);function l5(e){if(!_a(e)||ai(e)!=n5)return!1;var t=Ib(e);if(t===null)return!0;var r=a5.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&Bb.call(r)==o5}var c5="[object Arguments]",u5="[object Array]",h5="[object Boolean]",d5="[object Date]",f5="[object Error]",g5="[object Function]",p5="[object Map]",m5="[object Number]",x5="[object Object]",y5="[object RegExp]",b5="[object Set]",k5="[object String]",w5="[object WeakMap]",v5="[object ArrayBuffer]",C5="[object DataView]",S5="[object Float32Array]",_5="[object Float64Array]",T5="[object Int8Array]",N5="[object Int16Array]",E5="[object Int32Array]",A5="[object Uint8Array]",M5="[object Uint8ClampedArray]",j5="[object Uint16Array]",I5="[object Uint32Array]",st={};st[S5]=st[_5]=st[T5]=st[N5]=st[E5]=st[A5]=st[M5]=st[j5]=st[I5]=!0;st[c5]=st[u5]=st[v5]=st[h5]=st[C5]=st[d5]=st[f5]=st[g5]=st[p5]=st[m5]=st[x5]=st[y5]=st[b5]=st[k5]=st[w5]=!1;function L5(e){return _a(e)&&$b(e.length)&&!!st[ai(e)]}function $5(e){return function(t){return e(t)}}var Rb=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Qi=Rb&&typeof module=="object"&&module&&!module.nodeType&&module,D5=Qi&&Qi.exports===Rb,Bc=D5&&Eb.process,Hg=(function(){try{var e=Qi&&Qi.require&&Qi.require("util").types;return e||Bc&&Bc.binding&&Bc.binding("util")}catch{}})(),qg=Hg&&Hg.isTypedArray,vd=qg?$5(qg):L5;function Vu(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}var B5=Object.prototype,R5=B5.hasOwnProperty;function P5(e,t,r){var n=e[t];(!(R5.call(e,t)&&Nl(n,r))||r===void 0&&!(t in e))&&kd(e,t,r)}function F5(e,t,r,n){var s=!r;r||(r={});for(var i=-1,a=t.length;++i<a;){var o=t[i],l=void 0;l===void 0&&(l=e[o]),s?kd(r,o,l):P5(r,o,l)}return r}function O5(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var z5=9007199254740991,W5=/^(?:0|[1-9]\d*)$/;function Pb(e,t){var r=typeof e;return t=t??z5,!!t&&(r=="number"||r!="symbol"&&W5.test(e))&&e>-1&&e%1==0&&e<t}var H5=Object.prototype,q5=H5.hasOwnProperty;function U5(e,t){var r=Xo(e),n=!r&&Yo(e),s=!r&&!n&&wd(e),i=!r&&!n&&!s&&vd(e),a=r||n||s||i,o=a?O5(e.length,String):[],l=o.length;for(var c in e)(t||q5.call(e,c))&&!(a&&(c=="length"||s&&(c=="offset"||c=="parent")||i&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||Pb(c,l)))&&o.push(c);return o}function V5(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}var G5=Object.prototype,Y5=G5.hasOwnProperty;function X5(e){if(!ds(e))return V5(e);var t=Ml(e),r=[];for(var n in e)n=="constructor"&&(t||!Y5.call(e,n))||r.push(n);return r}function Fb(e){return jl(e)?U5(e,!0):X5(e)}function K5(e){return F5(e,Fb(e))}function Q5(e,t,r,n,s,i,a){var o=Vu(e,r),l=Vu(t,r),c=a.get(l);if(c){Uu(e,r,c);return}var u=i?i(o,l,r+"",e,t,a):void 0,h=u===void 0;if(h){var f=Xo(l),g=!f&&wd(l),p=!f&&!g&&vd(l);u=l,f||g||p?Xo(o)?u=o:J4(o)?u=U4(o):g?(h=!1,u=W4(l,!0)):p?(h=!1,u=q4(l,!0)):u=[]:l5(l)||Yo(l)?(u=o,Yo(o)?u=K5(o):(!ds(o)||bd(o))&&(u=Y4(l))):h=!1}h&&(a.set(l,u),s(u,l,n,i,a),a.delete(l)),Uu(e,r,u)}function Ob(e,t,r,n,s){e!==t&&O4(t,function(i,a){if(s||(s=new oi),ds(i))Q5(e,t,a,r,Ob,n,s);else{var o=n?n(Vu(e,a),i,a+"",e,t,s):void 0;o===void 0&&(o=i),Uu(e,a,o)}},Fb)}function zb(e){return e}function Z5(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}var Ug=Math.max;function J5(e,t,r){return t=Ug(t===void 0?e.length-1:t,0),function(){for(var n=arguments,s=-1,i=Ug(n.length-t,0),a=Array(i);++s<i;)a[s]=n[t+s];s=-1;for(var o=Array(t+1);++s<t;)o[s]=n[s];return o[t]=r(a),Z5(e,this,o)}}function eD(e){return function(){return e}}var tD=Go?function(e,t){return Go(e,"toString",{configurable:!0,enumerable:!1,value:eD(t),writable:!0})}:zb,rD=800,nD=16,sD=Date.now;function iD(e){var t=0,r=0;return function(){var n=sD(),s=nD-(n-r);if(r=n,s>0){if(++t>=rD)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var aD=iD(tD);function oD(e,t){return aD(J5(e,t,zb),e+"")}function lD(e,t,r){if(!ds(r))return!1;var n=typeof t;return(n=="number"?jl(r)&&Pb(t,r.length):n=="string"&&t in r)?Nl(r[t],e):!1}function cD(e){return oD(function(t,r){var n=-1,s=r.length,i=s>1?r[s-1]:void 0,a=s>2?r[2]:void 0;for(i=e.length>3&&typeof i=="function"?(s--,i):void 0,a&&lD(r[0],r[1],a)&&(i=s<3?void 0:i,s=1),t=Object(t);++n<s;){var o=r[n];o&&e(t,o,n,i)}return t})}var uD=cD(function(e,t,r){Ob(e,t,r)}),hD="​",dD={curveBasis:fo,curveBasisClosed:gL,curveBasisOpen:pL,curveBumpX:Tx,curveBumpY:Nx,curveBundle:mL,curveCardinalClosed:xL,curveCardinalOpen:yL,curveCardinal:jx,curveCatmullRomClosed:bL,curveCatmullRomOpen:kL,curveCatmullRom:Lx,curveLinear:Bo,curveLinearClosed:wL,curveMonotoneX:Fx,curveMonotoneY:Ox,curveNatural:Wx,curveStep:Hx,curveStepAfter:Ux,curveStepBefore:qx},fD=/\s*(?:(\w+)(?=:):|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,gD=b(function(e,t){const r=Wb(e,/(?:init\b)|(?:initialize\b)/);let n={};if(Array.isArray(r)){const a=r.map(o=>o.args);_o(a),n=Ct(n,[...a])}else n=r.args;if(!n)return;let s=Vh(e,t);const i="config";return n[i]!==void 0&&(s==="flowchart-v2"&&(s="flowchart"),n[s]=n[i],delete n[i]),n},"detectInit"),Wb=b(function(e,t=null){try{const r=new RegExp(`[%]{2}(?![{]${fD.source})(?=[}][%]{2}).*
250
+ `,"ig");e=e.trim().replace(r,"").replace(/'/gm,'"'),K.debug(`Detecting diagram directive${t!==null?" type:"+t:""} based on the text:${e}`);let n;const s=[];for(;(n=Xi.exec(e))!==null;)if(n.index===Xi.lastIndex&&Xi.lastIndex++,n&&!t||t&&n[1]?.match(t)||t&&n[2]?.match(t)){const i=n[1]?n[1]:n[2],a=n[3]?n[3].trim():n[4]?JSON.parse(n[4].trim()):null;s.push({type:i,args:a})}return s.length===0?{type:e,args:null}:s.length===1?s[0]:s}catch(r){return K.error(`ERROR: ${r.message} - Unable to parse directive type: '${t}' based on the text: '${e}'`),{type:void 0,args:null}}},"detectDirective"),pD=b(function(e){return e.replace(Xi,"")},"removeDirectives"),mD=b(function(e,t){for(const[r,n]of t.entries())if(n.match(e))return r;return-1},"isSubstringInArray");function Cd(e,t){if(!e)return t;const r=`curve${e.charAt(0).toUpperCase()+e.slice(1)}`;return dD[r]??t}b(Cd,"interpolateToCurve");function Hb(e,t){const r=e.trim();if(r)return t.securityLevel!=="loose"?B$.sanitizeUrl(r):r}b(Hb,"formatUrl");var xD=b((e,...t)=>{const r=e.split("."),n=r.length-1,s=r[n];let i=window;for(let a=0;a<n;a++)if(i=i[r[a]],!i){K.error(`Function name: ${e} not found in window`);return}i[s](...t)},"runFunc");function Sd(e,t){return!e||!t?0:Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}b(Sd,"distance");function qb(e){let t,r=0;e.forEach(s=>{r+=Sd(s,t),t=s});const n=r/2;return _d(e,n)}b(qb,"traverseEdge");function Ub(e){return e.length===1?e[0]:qb(e)}b(Ub,"calcLabelPosition");var Vg=b((e,t=2)=>{const r=Math.pow(10,t);return Math.round(e*r)/r},"roundNumber"),_d=b((e,t)=>{let r,n=t;for(const s of e){if(r){const i=Sd(s,r);if(i===0)return r;if(i<n)n-=i;else{const a=n/i;if(a<=0)return r;if(a>=1)return{x:s.x,y:s.y};if(a>0&&a<1)return{x:Vg((1-a)*r.x+a*s.x,5),y:Vg((1-a)*r.y+a*s.y,5)}}}r=s}throw new Error("Could not find a suitable point for the given distance")},"calculatePoint"),yD=b((e,t,r)=>{K.info(`our points ${JSON.stringify(t)}`),t[0]!==r&&(t=t.reverse());const s=_d(t,25),i=e?10:5,a=Math.atan2(t[0].y-s.y,t[0].x-s.x),o={x:0,y:0};return o.x=Math.sin(a)*i+(t[0].x+s.x)/2,o.y=-Math.cos(a)*i+(t[0].y+s.y)/2,o},"calcCardinalityPosition");function Vb(e,t,r){const n=structuredClone(r);K.info("our points",n),t!=="start_left"&&t!=="start_right"&&n.reverse();const s=25+e,i=_d(n,s),a=10+e*.5,o=Math.atan2(n[0].y-i.y,n[0].x-i.x),l={x:0,y:0};return t==="start_left"?(l.x=Math.sin(o+Math.PI)*a+(n[0].x+i.x)/2,l.y=-Math.cos(o+Math.PI)*a+(n[0].y+i.y)/2):t==="end_right"?(l.x=Math.sin(o-Math.PI)*a+(n[0].x+i.x)/2-5,l.y=-Math.cos(o-Math.PI)*a+(n[0].y+i.y)/2-5):t==="end_left"?(l.x=Math.sin(o)*a+(n[0].x+i.x)/2-5,l.y=-Math.cos(o)*a+(n[0].y+i.y)/2-5):(l.x=Math.sin(o)*a+(n[0].x+i.x)/2,l.y=-Math.cos(o)*a+(n[0].y+i.y)/2),l}b(Vb,"calcTerminalLabelPosition");function Gb(e){let t="",r="";for(const n of e)n!==void 0&&(n.startsWith("color:")||n.startsWith("text-align:")?r=r+n+";":t=t+n+";");return{style:t,labelStyle:r}}b(Gb,"getStylesFromArray");var Gg=0,bD=b(()=>(Gg++,"id-"+Math.random().toString(36).substr(2,12)+"-"+Gg),"generateId");function Yb(e){let t="";const r="0123456789abcdef",n=r.length;for(let s=0;s<e;s++)t+=r.charAt(Math.floor(Math.random()*n));return t}b(Yb,"makeRandomHex");var kD=b(e=>Yb(e.length),"random"),wD=b(function(){return{x:0,y:0,fill:void 0,anchor:"start",style:"#666",width:100,height:100,textMargin:0,rx:0,ry:0,valign:void 0,text:""}},"getTextObj"),vD=b(function(e,t){const r=t.text.replace(si.lineBreakRegex," "),[,n]=Il(t.fontSize),s=e.append("text");s.attr("x",t.x),s.attr("y",t.y),s.style("text-anchor",t.anchor),s.style("font-family",t.fontFamily),s.style("font-size",n),s.style("font-weight",t.fontWeight),s.attr("fill",t.fill),t.class!==void 0&&s.attr("class",t.class);const i=s.append("tspan");return i.attr("x",t.x+t.textMargin*2),i.attr("fill",t.fill),i.text(r),s},"drawSimpleText"),CD=Sa((e,t,r)=>{if(!e||(r=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",joinWith:"<br/>"},r),si.lineBreakRegex.test(e)))return e;const n=e.split(" ").filter(Boolean),s=[];let i="";return n.forEach((a,o)=>{const l=cn(`${a} `,r),c=cn(i,r);if(l>t){const{hyphenatedStrings:f,remainingWord:g}=SD(a,t,"-",r);s.push(i,...f),i=g}else c+l>=t?(s.push(i),i=a):i=[i,a].filter(Boolean).join(" ");o+1===n.length&&s.push(i)}),s.filter(a=>a!=="").join(r.joinWith)},(e,t,r)=>`${e}${t}${r.fontSize}${r.fontWeight}${r.fontFamily}${r.joinWith}`),SD=Sa((e,t,r="-",n)=>{n=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",margin:0},n);const s=[...e],i=[];let a="";return s.forEach((o,l)=>{const c=`${a}${o}`;if(cn(c,n)>=t){const h=l+1,f=s.length===h,g=`${c}${r}`;i.push(f?c:g),a=""}else a=c}),{hyphenatedStrings:i,remainingWord:a}},(e,t,r="-",n)=>`${e}${t}${r}${n.fontSize}${n.fontWeight}${n.fontFamily}`);function Xb(e,t){return Td(e,t).height}b(Xb,"calculateTextHeight");function cn(e,t){return Td(e,t).width}b(cn,"calculateTextWidth");var Td=Sa((e,t)=>{const{fontSize:r=12,fontFamily:n="Arial",fontWeight:s=400}=t;if(!e)return{width:0,height:0};const[,i]=Il(r),a=["sans-serif",n],o=e.split(si.lineBreakRegex),l=[],c=Oe("body");if(!c.remove)return{width:0,height:0,lineHeight:0};const u=c.append("svg");for(const f of a){let g=0;const p={width:0,height:0,lineHeight:0};for(const m of o){const y=wD();y.text=m||hD;const x=vD(u,y).style("font-size",i).style("font-weight",s).style("font-family",f),k=(x._groups||x)[0][0].getBBox();if(k.width===0&&k.height===0)throw new Error("svg element not in render tree");p.width=Math.round(Math.max(p.width,k.width)),g=Math.round(k.height),p.height+=g,p.lineHeight=Math.round(Math.max(p.lineHeight,g))}l.push(p)}u.remove();const h=isNaN(l[1].height)||isNaN(l[1].width)||isNaN(l[1].lineHeight)||l[0].height>l[1].height&&l[0].width>l[1].width&&l[0].lineHeight>l[1].lineHeight?0:1;return l[h]},(e,t)=>`${e}${t.fontSize}${t.fontWeight}${t.fontFamily}`),qs,_D=(qs=class{constructor(t=!1,r){this.count=0,this.count=r?r.length:0,this.next=t?()=>this.count++:()=>Date.now()}},b(qs,"InitIDGenerator"),qs),Ya,TD=b(function(e){return Ya=Ya||document.createElement("div"),e=escape(e).replace(/%26/g,"&").replace(/%23/g,"#").replace(/%3B/g,";"),Ya.innerHTML=e,unescape(Ya.textContent)},"entityDecode");function Nd(e){return"str"in e}b(Nd,"isDetailedError");var ND=b((e,t,r,n)=>{if(!n)return;const s=e.node()?.getBBox();s&&e.append("text").text(n).attr("text-anchor","middle").attr("x",s.x+s.width/2).attr("y",-r).attr("class",t)},"insertTitle"),Il=b(e=>{if(typeof e=="number")return[e,e+"px"];const t=parseInt(e??"",10);return Number.isNaN(t)?[void 0,void 0]:e===String(t)?[t,e+"px"]:[t,e]},"parseFontSize");function Ed(e,t){return uD({},e,t)}b(Ed,"cleanAndMerge");var Er={assignWithDepth:Ct,wrapLabel:CD,calculateTextHeight:Xb,calculateTextWidth:cn,calculateTextDimensions:Td,cleanAndMerge:Ed,detectInit:gD,detectDirective:Wb,isSubstringInArray:mD,interpolateToCurve:Cd,calcLabelPosition:Ub,calcCardinalityPosition:yD,calcTerminalLabelPosition:Vb,formatUrl:Hb,getStylesFromArray:Gb,generateId:bD,random:kD,runFunc:xD,entityDecode:TD,insertTitle:ND,isLabelCoordinateInPath:Kb,parseFontSize:Il,InitIDGenerator:_D},ED=b(function(e){let t=e;return t=t.replace(/style.*:\S*#.*;/g,function(r){return r.substring(0,r.length-1)}),t=t.replace(/classDef.*:\S*#.*;/g,function(r){return r.substring(0,r.length-1)}),t=t.replace(/#\w+;/g,function(r){const n=r.substring(1,r.length-1);return/^\+?\d+$/.test(n)?"fl°°"+n+"¶ß":"fl°"+n+"¶ß"}),t},"encodeEntities"),ps=b(function(e){return e.replace(/fl°°/g,"&#").replace(/fl°/g,"&").replace(/¶ß/g,";")},"decodeEntities"),B9=b((e,t,{counter:r=0,prefix:n,suffix:s},i)=>i||`${n?`${n}_`:""}${e}_${t}_${r}${s?`_${s}`:""}`,"getEdgeId");function Bt(e){return e??null}b(Bt,"handleUndefinedAttr");function Kb(e,t){const r=Math.round(e.x),n=Math.round(e.y),s=t.replace(/(\d+\.\d+)/g,i=>Math.round(parseFloat(i)).toString());return s.includes(r.toString())||s.includes(n.toString())}b(Kb,"isLabelCoordinateInPath");const AD=Object.freeze({left:0,top:0,width:16,height:16}),Ko=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Qb=Object.freeze({...AD,...Ko}),MD=Object.freeze({...Qb,body:"",hidden:!1}),jD=Object.freeze({width:null,height:null}),ID=Object.freeze({...jD,...Ko}),LD=(e,t,r,n="")=>{const s=e.split(":");if(e.slice(0,1)==="@"){if(s.length<2||s.length>3)return null;n=s.shift().slice(1)}if(s.length>3||!s.length)return null;if(s.length>1){const o=s.pop(),l=s.pop(),c={provider:s.length>0?s[0]:n,prefix:l,name:o};return Rc(c)?c:null}const i=s[0],a=i.split("-");if(a.length>1){const o={provider:n,prefix:a.shift(),name:a.join("-")};return Rc(o)?o:null}if(r&&n===""){const o={provider:n,prefix:"",name:i};return Rc(o,r)?o:null}return null},Rc=(e,t)=>e?!!((t&&e.prefix===""||e.prefix)&&e.name):!1;function $D(e,t){const r={};!e.hFlip!=!t.hFlip&&(r.hFlip=!0),!e.vFlip!=!t.vFlip&&(r.vFlip=!0);const n=((e.rotate||0)+(t.rotate||0))%4;return n&&(r.rotate=n),r}function Yg(e,t){const r=$D(e,t);for(const n in MD)n in Ko?n in e&&!(n in r)&&(r[n]=Ko[n]):n in t?r[n]=t[n]:n in e&&(r[n]=e[n]);return r}function DD(e,t){const r=e.icons,n=e.aliases||Object.create(null),s=Object.create(null);function i(a){if(r[a])return s[a]=[];if(!(a in s)){s[a]=null;const o=n[a]&&n[a].parent,l=o&&i(o);l&&(s[a]=[o].concat(l))}return s[a]}return(t||Object.keys(r).concat(Object.keys(n))).forEach(i),s}function Xg(e,t,r){const n=e.icons,s=e.aliases||Object.create(null);let i={};function a(o){i=Yg(n[o]||s[o],i)}return a(t),r.forEach(a),Yg(e,i)}function BD(e,t){if(e.icons[t])return Xg(e,t,[]);const r=DD(e,[t])[t];return r?Xg(e,t,r):null}const RD=/(-?[0-9.]*[0-9]+[0-9.]*)/g,PD=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Kg(e,t,r){if(t===1)return e;if(r=r||100,typeof e=="number")return Math.ceil(e*t*r)/r;if(typeof e!="string")return e;const n=e.split(RD);if(n===null||!n.length)return e;const s=[];let i=n.shift(),a=PD.test(i);for(;;){if(a){const o=parseFloat(i);isNaN(o)?s.push(i):s.push(Math.ceil(o*t*r)/r)}else s.push(i);if(i=n.shift(),i===void 0)return s.join("");a=!a}}function FD(e,t="defs"){let r="";const n=e.indexOf("<"+t);for(;n>=0;){const s=e.indexOf(">",n),i=e.indexOf("</"+t);if(s===-1||i===-1)break;const a=e.indexOf(">",i);if(a===-1)break;r+=e.slice(s+1,i).trim(),e=e.slice(0,n).trim()+e.slice(a+1)}return{defs:r,content:e}}function OD(e,t){return e?"<defs>"+e+"</defs>"+t:t}function zD(e,t,r){const n=FD(e);return OD(n.defs,t+n.content+r)}const WD=e=>e==="unset"||e==="undefined"||e==="none";function HD(e,t){const r={...Qb,...e},n={...ID,...t},s={left:r.left,top:r.top,width:r.width,height:r.height};let i=r.body;[r,n].forEach(m=>{const y=[],x=m.hFlip,k=m.vFlip;let C=m.rotate;x?k?C+=2:(y.push("translate("+(s.width+s.left).toString()+" "+(0-s.top).toString()+")"),y.push("scale(-1 1)"),s.top=s.left=0):k&&(y.push("translate("+(0-s.left).toString()+" "+(s.height+s.top).toString()+")"),y.push("scale(1 -1)"),s.top=s.left=0);let T;switch(C<0&&(C-=Math.floor(C/4)*4),C=C%4,C){case 1:T=s.height/2+s.top,y.unshift("rotate(90 "+T.toString()+" "+T.toString()+")");break;case 2:y.unshift("rotate(180 "+(s.width/2+s.left).toString()+" "+(s.height/2+s.top).toString()+")");break;case 3:T=s.width/2+s.left,y.unshift("rotate(-90 "+T.toString()+" "+T.toString()+")");break}C%2===1&&(s.left!==s.top&&(T=s.left,s.left=s.top,s.top=T),s.width!==s.height&&(T=s.width,s.width=s.height,s.height=T)),y.length&&(i=zD(i,'<g transform="'+y.join(" ")+'">',"</g>"))});const a=n.width,o=n.height,l=s.width,c=s.height;let u,h;a===null?(h=o===null?"1em":o==="auto"?c:o,u=Kg(h,l/c)):(u=a==="auto"?l:a,h=o===null?Kg(u,c/l):o==="auto"?c:o);const f={},g=(m,y)=>{WD(y)||(f[m]=y.toString())};g("width",u),g("height",h);const p=[s.left,s.top,l,c];return f.viewBox=p.join(" "),{attributes:f,viewBox:p,body:i}}const qD=/\sid="(\S+)"/g,UD="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let VD=0;function GD(e,t=UD){const r=[];let n;for(;n=qD.exec(e);)r.push(n[1]);if(!r.length)return e;const s="suffix"+(Math.random()*16777216|Date.now()).toString(16);return r.forEach(i=>{const a=typeof t=="function"?t(i):t+(VD++).toString(),o=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e=e.replace(new RegExp('([#;"])('+o+')([")]|\\.[a-z])',"g"),"$1"+a+s+"$3")}),e=e.replace(new RegExp(s,"g"),""),e}function YD(e,t){let r=e.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const n in t)r+=" "+n+'="'+t[n]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+r+">"+e+"</svg>"}function Ad(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var ms=Ad();function Zb(e){ms=e}var Zi={exec:()=>null};function We(e,t=""){let r=typeof e=="string"?e:e.source,n={replace:(s,i)=>{let a=typeof i=="string"?i:i.source;return a=a.replace(Ht.caret,"$1"),r=r.replace(s,a),n},getRegex:()=>new RegExp(r,t)};return n}var Ht={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},XD=/^(?:[ \t]*(?:\n|$))+/,KD=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,QD=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Ta=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,ZD=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Md=/(?:[*+-]|\d{1,9}[.)])/,Jb=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ek=We(Jb).replace(/bull/g,Md).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),JD=We(Jb).replace(/bull/g,Md).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),jd=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,e3=/^[^\n]+/,Id=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,t3=We(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Id).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),r3=We(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Md).getRegex(),Ll="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Ld=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,n3=We("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Ld).replace("tag",Ll).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),tk=We(jd).replace("hr",Ta).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ll).getRegex(),s3=We(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",tk).getRegex(),$d={blockquote:s3,code:KD,def:t3,fences:QD,heading:ZD,hr:Ta,html:n3,lheading:ek,list:r3,newline:XD,paragraph:tk,table:Zi,text:e3},Qg=We("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Ta).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ll).getRegex(),i3={...$d,lheading:JD,table:Qg,paragraph:We(jd).replace("hr",Ta).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Qg).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ll).getRegex()},a3={...$d,html:We(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ld).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Zi,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:We(jd).replace("hr",Ta).replace("heading",` *#{1,6} *[^
251
+ ]`).replace("lheading",ek).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},o3=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,l3=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,rk=/^( {2,}|\\)\n(?!\s*$)/,c3=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,$l=/[\p{P}\p{S}]/u,Dd=/[\s\p{P}\p{S}]/u,nk=/[^\s\p{P}\p{S}]/u,u3=We(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Dd).getRegex(),sk=/(?!~)[\p{P}\p{S}]/u,h3=/(?!~)[\s\p{P}\p{S}]/u,d3=/(?:[^\s\p{P}\p{S}]|~)/u,f3=/\[(?:[^\[\]`]|`[^`]*?`)*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)|`[^`]*?`|<(?! )[^<>]*?>/g,ik=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,g3=We(ik,"u").replace(/punct/g,$l).getRegex(),p3=We(ik,"u").replace(/punct/g,sk).getRegex(),ak="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",m3=We(ak,"gu").replace(/notPunctSpace/g,nk).replace(/punctSpace/g,Dd).replace(/punct/g,$l).getRegex(),x3=We(ak,"gu").replace(/notPunctSpace/g,d3).replace(/punctSpace/g,h3).replace(/punct/g,sk).getRegex(),y3=We("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,nk).replace(/punctSpace/g,Dd).replace(/punct/g,$l).getRegex(),b3=We(/\\(punct)/,"gu").replace(/punct/g,$l).getRegex(),k3=We(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),w3=We(Ld).replace("(?:-->|$)","-->").getRegex(),v3=We("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",w3).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Qo=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,C3=We(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Qo).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ok=We(/^!?\[(label)\]\[(ref)\]/).replace("label",Qo).replace("ref",Id).getRegex(),lk=We(/^!?\[(ref)\](?:\[\])?/).replace("ref",Id).getRegex(),S3=We("reflink|nolink(?!\\()","g").replace("reflink",ok).replace("nolink",lk).getRegex(),Zg=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Bd={_backpedal:Zi,anyPunctuation:b3,autolink:k3,blockSkip:f3,br:rk,code:l3,del:Zi,emStrongLDelim:g3,emStrongRDelimAst:m3,emStrongRDelimUnd:y3,escape:o3,link:C3,nolink:lk,punctuation:u3,reflink:ok,reflinkSearch:S3,tag:v3,text:c3,url:Zi},_3={...Bd,link:We(/^!?\[(label)\]\((.*?)\)/).replace("label",Qo).getRegex(),reflink:We(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Qo).getRegex()},Gu={...Bd,emStrongRDelimAst:x3,emStrongLDelim:p3,url:We(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Zg).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:We(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Zg).getRegex()},T3={...Gu,br:We(rk).replace("{2,}","*").getRegex(),text:We(Gu.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Xa={normal:$d,gfm:i3,pedantic:a3},Ni={normal:Bd,gfm:Gu,breaks:T3,pedantic:_3},N3={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Jg=e=>N3[e];function Pr(e,t){if(t){if(Ht.escapeTest.test(e))return e.replace(Ht.escapeReplace,Jg)}else if(Ht.escapeTestNoEncode.test(e))return e.replace(Ht.escapeReplaceNoEncode,Jg);return e}function ep(e){try{e=encodeURI(e).replace(Ht.percentDecode,"%")}catch{return null}return e}function tp(e,t){let r=e.replace(Ht.findPipe,(i,a,o)=>{let l=!1,c=a;for(;--c>=0&&o[c]==="\\";)l=!l;return l?"|":" |"}),n=r.split(Ht.splitPipe),s=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push("");for(;s<n.length;s++)n[s]=n[s].trim().replace(Ht.slashPipe,"|");return n}function Ei(e,t,r){let n=e.length;if(n===0)return"";let s=0;for(;s<n&&e.charAt(n-s-1)===t;)s++;return e.slice(0,n-s)}function E3(e,t){if(e.indexOf(t[1])===-1)return-1;let r=0;for(let n=0;n<e.length;n++)if(e[n]==="\\")n++;else if(e[n]===t[0])r++;else if(e[n]===t[1]&&(r--,r<0))return n;return r>0?-2:-1}function rp(e,t,r,n,s){let i=t.href,a=t.title||null,o=e[1].replace(s.other.outputLinkReplace,"$1");n.state.inLink=!0;let l={type:e[0].charAt(0)==="!"?"image":"link",raw:r,href:i,title:a,text:o,tokens:n.inlineTokens(o)};return n.state.inLink=!1,l}function A3(e,t,r){let n=e.match(r.other.indentCodeCompensation);if(n===null)return t;let s=n[1];return t.split(`
252
+ `).map(i=>{let a=i.match(r.other.beginningSpace);if(a===null)return i;let[o]=a;return o.length>=s.length?i.slice(s.length):i}).join(`
253
+ `)}var Zo=class{options;rules;lexer;constructor(t){this.options=t||ms}space(t){let r=this.rules.block.newline.exec(t);if(r&&r[0].length>0)return{type:"space",raw:r[0]}}code(t){let r=this.rules.block.code.exec(t);if(r){let n=r[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:r[0],codeBlockStyle:"indented",text:this.options.pedantic?n:Ei(n,`
254
+ `)}}}fences(t){let r=this.rules.block.fences.exec(t);if(r){let n=r[0],s=A3(n,r[3]||"",this.rules);return{type:"code",raw:n,lang:r[2]?r[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):r[2],text:s}}}heading(t){let r=this.rules.block.heading.exec(t);if(r){let n=r[2].trim();if(this.rules.other.endingHash.test(n)){let s=Ei(n,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(n=s.trim())}return{type:"heading",raw:r[0],depth:r[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(t){let r=this.rules.block.hr.exec(t);if(r)return{type:"hr",raw:Ei(r[0],`
255
+ `)}}blockquote(t){let r=this.rules.block.blockquote.exec(t);if(r){let n=Ei(r[0],`
256
+ `).split(`
257
+ `),s="",i="",a=[];for(;n.length>0;){let o=!1,l=[],c;for(c=0;c<n.length;c++)if(this.rules.other.blockquoteStart.test(n[c]))l.push(n[c]),o=!0;else if(!o)l.push(n[c]);else break;n=n.slice(c);let u=l.join(`
258
+ `),h=u.replace(this.rules.other.blockquoteSetextReplace,`
259
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
260
+ ${u}`:u,i=i?`${i}
261
+ ${h}`:h;let f=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(h,a,!0),this.lexer.state.top=f,n.length===0)break;let g=a.at(-1);if(g?.type==="code")break;if(g?.type==="blockquote"){let p=g,m=p.raw+`
262
+ `+n.join(`
263
+ `),y=this.blockquote(m);a[a.length-1]=y,s=s.substring(0,s.length-p.raw.length)+y.raw,i=i.substring(0,i.length-p.text.length)+y.text;break}else if(g?.type==="list"){let p=g,m=p.raw+`
264
+ `+n.join(`
265
+ `),y=this.list(m);a[a.length-1]=y,s=s.substring(0,s.length-g.raw.length)+y.raw,i=i.substring(0,i.length-p.raw.length)+y.raw,n=m.substring(a.at(-1).raw.length).split(`
266
+ `);continue}}return{type:"blockquote",raw:s,tokens:a,text:i}}}list(t){let r=this.rules.block.list.exec(t);if(r){let n=r[1].trim(),s=n.length>1,i={type:"list",raw:"",ordered:s,start:s?+n.slice(0,-1):"",loose:!1,items:[]};n=s?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=s?n:"[*+-]");let a=this.rules.other.listItemRegex(n),o=!1;for(;t;){let c=!1,u="",h="";if(!(r=a.exec(t))||this.rules.block.hr.test(t))break;u=r[0],t=t.substring(u.length);let f=r[2].split(`
267
+ `,1)[0].replace(this.rules.other.listReplaceTabs,k=>" ".repeat(3*k.length)),g=t.split(`
268
+ `,1)[0],p=!f.trim(),m=0;if(this.options.pedantic?(m=2,h=f.trimStart()):p?m=r[1].length+1:(m=r[2].search(this.rules.other.nonSpaceChar),m=m>4?1:m,h=f.slice(m),m+=r[1].length),p&&this.rules.other.blankLine.test(g)&&(u+=g+`
269
+ `,t=t.substring(g.length+1),c=!0),!c){let k=this.rules.other.nextBulletRegex(m),C=this.rules.other.hrRegex(m),T=this.rules.other.fencesBeginRegex(m),S=this.rules.other.headingBeginRegex(m),w=this.rules.other.htmlBeginRegex(m);for(;t;){let _=t.split(`
270
+ `,1)[0],O;if(g=_,this.options.pedantic?(g=g.replace(this.rules.other.listReplaceNesting," "),O=g):O=g.replace(this.rules.other.tabCharGlobal," "),T.test(g)||S.test(g)||w.test(g)||k.test(g)||C.test(g))break;if(O.search(this.rules.other.nonSpaceChar)>=m||!g.trim())h+=`
271
+ `+O.slice(m);else{if(p||f.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||T.test(f)||S.test(f)||C.test(f))break;h+=`
272
+ `+g}!p&&!g.trim()&&(p=!0),u+=_+`
273
+ `,t=t.substring(_.length+1),f=O.slice(m)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(u)&&(o=!0));let y=null,x;this.options.gfm&&(y=this.rules.other.listIsTask.exec(h),y&&(x=y[0]!=="[ ] ",h=h.replace(this.rules.other.listReplaceTask,""))),i.items.push({type:"list_item",raw:u,task:!!y,checked:x,loose:!1,text:h,tokens:[]}),i.raw+=u}let l=i.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let c=0;c<i.items.length;c++)if(this.lexer.state.top=!1,i.items[c].tokens=this.lexer.blockTokens(i.items[c].text,[]),!i.loose){let u=i.items[c].tokens.filter(f=>f.type==="space"),h=u.length>0&&u.some(f=>this.rules.other.anyLine.test(f.raw));i.loose=h}if(i.loose)for(let c=0;c<i.items.length;c++)i.items[c].loose=!0;return i}}html(t){let r=this.rules.block.html.exec(t);if(r)return{type:"html",block:!0,raw:r[0],pre:r[1]==="pre"||r[1]==="script"||r[1]==="style",text:r[0]}}def(t){let r=this.rules.block.def.exec(t);if(r){let n=r[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=r[2]?r[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=r[3]?r[3].substring(1,r[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):r[3];return{type:"def",tag:n,raw:r[0],href:s,title:i}}}table(t){let r=this.rules.block.table.exec(t);if(!r||!this.rules.other.tableDelimiter.test(r[2]))return;let n=tp(r[1]),s=r[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=r[3]?.trim()?r[3].replace(this.rules.other.tableRowBlankLine,"").split(`
274
+ `):[],a={type:"table",raw:r[0],header:[],align:[],rows:[]};if(n.length===s.length){for(let o of s)this.rules.other.tableAlignRight.test(o)?a.align.push("right"):this.rules.other.tableAlignCenter.test(o)?a.align.push("center"):this.rules.other.tableAlignLeft.test(o)?a.align.push("left"):a.align.push(null);for(let o=0;o<n.length;o++)a.header.push({text:n[o],tokens:this.lexer.inline(n[o]),header:!0,align:a.align[o]});for(let o of i)a.rows.push(tp(o,a.header.length).map((l,c)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:a.align[c]})));return a}}lheading(t){let r=this.rules.block.lheading.exec(t);if(r)return{type:"heading",raw:r[0],depth:r[2].charAt(0)==="="?1:2,text:r[1],tokens:this.lexer.inline(r[1])}}paragraph(t){let r=this.rules.block.paragraph.exec(t);if(r){let n=r[1].charAt(r[1].length-1)===`
275
+ `?r[1].slice(0,-1):r[1];return{type:"paragraph",raw:r[0],text:n,tokens:this.lexer.inline(n)}}}text(t){let r=this.rules.block.text.exec(t);if(r)return{type:"text",raw:r[0],text:r[0],tokens:this.lexer.inline(r[0])}}escape(t){let r=this.rules.inline.escape.exec(t);if(r)return{type:"escape",raw:r[0],text:r[1]}}tag(t){let r=this.rules.inline.tag.exec(t);if(r)return!this.lexer.state.inLink&&this.rules.other.startATag.test(r[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(r[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(r[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(r[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:r[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:r[0]}}link(t){let r=this.rules.inline.link.exec(t);if(r){let n=r[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let a=Ei(n.slice(0,-1),"\\");if((n.length-a.length)%2===0)return}else{let a=E3(r[2],"()");if(a===-2)return;if(a>-1){let o=(r[0].indexOf("!")===0?5:4)+r[1].length+a;r[2]=r[2].substring(0,a),r[0]=r[0].substring(0,o).trim(),r[3]=""}}let s=r[2],i="";if(this.options.pedantic){let a=this.rules.other.pedanticHrefTitle.exec(s);a&&(s=a[1],i=a[3])}else i=r[3]?r[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?s=s.slice(1):s=s.slice(1,-1)),rp(r,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},r[0],this.lexer,this.rules)}}reflink(t,r){let n;if((n=this.rules.inline.reflink.exec(t))||(n=this.rules.inline.nolink.exec(t))){let s=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=r[s.toLowerCase()];if(!i){let a=n[0].charAt(0);return{type:"text",raw:a,text:a}}return rp(n,i,n[0],this.lexer,this.rules)}}emStrong(t,r,n=""){let s=this.rules.inline.emStrongLDelim.exec(t);if(!(!s||s[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[2])||!n||this.rules.inline.punctuation.exec(n))){let i=[...s[0]].length-1,a,o,l=i,c=0,u=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,r=r.slice(-1*t.length+i);(s=u.exec(r))!=null;){if(a=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!a)continue;if(o=[...a].length,s[3]||s[4]){l+=o;continue}else if((s[5]||s[6])&&i%3&&!((i+o)%3)){c+=o;continue}if(l-=o,l>0)continue;o=Math.min(o,o+l+c);let h=[...s[0]][0].length,f=t.slice(0,i+s.index+h+o);if(Math.min(i,o)%2){let p=f.slice(1,-1);return{type:"em",raw:f,text:p,tokens:this.lexer.inlineTokens(p)}}let g=f.slice(2,-2);return{type:"strong",raw:f,text:g,tokens:this.lexer.inlineTokens(g)}}}}codespan(t){let r=this.rules.inline.code.exec(t);if(r){let n=r[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(n),i=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return s&&i&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:r[0],text:n}}}br(t){let r=this.rules.inline.br.exec(t);if(r)return{type:"br",raw:r[0]}}del(t){let r=this.rules.inline.del.exec(t);if(r)return{type:"del",raw:r[0],text:r[2],tokens:this.lexer.inlineTokens(r[2])}}autolink(t){let r=this.rules.inline.autolink.exec(t);if(r){let n,s;return r[2]==="@"?(n=r[1],s="mailto:"+n):(n=r[1],s=n),{type:"link",raw:r[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}url(t){let r;if(r=this.rules.inline.url.exec(t)){let n,s;if(r[2]==="@")n=r[0],s="mailto:"+n;else{let i;do i=r[0],r[0]=this.rules.inline._backpedal.exec(r[0])?.[0]??"";while(i!==r[0]);n=r[0],r[1]==="www."?s="http://"+r[0]:s=r[0]}return{type:"link",raw:r[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(t){let r=this.rules.inline.text.exec(t);if(r){let n=this.lexer.state.inRawBlock;return{type:"text",raw:r[0],text:r[0],escaped:n}}}},_r=class Yu{tokens;options;state;tokenizer;inlineQueue;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||ms,this.options.tokenizer=this.options.tokenizer||new Zo,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let r={other:Ht,block:Xa.normal,inline:Ni.normal};this.options.pedantic?(r.block=Xa.pedantic,r.inline=Ni.pedantic):this.options.gfm&&(r.block=Xa.gfm,this.options.breaks?r.inline=Ni.breaks:r.inline=Ni.gfm),this.tokenizer.rules=r}static get rules(){return{block:Xa,inline:Ni}}static lex(t,r){return new Yu(r).lex(t)}static lexInline(t,r){return new Yu(r).inlineTokens(t)}lex(t){t=t.replace(Ht.carriageReturn,`
276
+ `),this.blockTokens(t,this.tokens);for(let r=0;r<this.inlineQueue.length;r++){let n=this.inlineQueue[r];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,r=[],n=!1){for(this.options.pedantic&&(t=t.replace(Ht.tabCharGlobal," ").replace(Ht.spaceLine,""));t;){let s;if(this.options.extensions?.block?.some(a=>(s=a.call({lexer:this},t,r))?(t=t.substring(s.raw.length),r.push(s),!0):!1))continue;if(s=this.tokenizer.space(t)){t=t.substring(s.raw.length);let a=r.at(-1);s.raw.length===1&&a!==void 0?a.raw+=`
277
+ `:r.push(s);continue}if(s=this.tokenizer.code(t)){t=t.substring(s.raw.length);let a=r.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(`
278
+ `)?"":`
279
+ `)+s.raw,a.text+=`
280
+ `+s.text,this.inlineQueue.at(-1).src=a.text):r.push(s);continue}if(s=this.tokenizer.fences(t)){t=t.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.heading(t)){t=t.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.hr(t)){t=t.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.blockquote(t)){t=t.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.list(t)){t=t.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.html(t)){t=t.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.def(t)){t=t.substring(s.raw.length);let a=r.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(`
281
+ `)?"":`
282
+ `)+s.raw,a.text+=`
283
+ `+s.raw,this.inlineQueue.at(-1).src=a.text):this.tokens.links[s.tag]||(this.tokens.links[s.tag]={href:s.href,title:s.title},r.push(s));continue}if(s=this.tokenizer.table(t)){t=t.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.lheading(t)){t=t.substring(s.raw.length),r.push(s);continue}let i=t;if(this.options.extensions?.startBlock){let a=1/0,o=t.slice(1),l;this.options.extensions.startBlock.forEach(c=>{l=c.call({lexer:this},o),typeof l=="number"&&l>=0&&(a=Math.min(a,l))}),a<1/0&&a>=0&&(i=t.substring(0,a+1))}if(this.state.top&&(s=this.tokenizer.paragraph(i))){let a=r.at(-1);n&&a?.type==="paragraph"?(a.raw+=(a.raw.endsWith(`
284
+ `)?"":`
285
+ `)+s.raw,a.text+=`
286
+ `+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):r.push(s),n=i.length!==t.length,t=t.substring(s.raw.length);continue}if(s=this.tokenizer.text(t)){t=t.substring(s.raw.length);let a=r.at(-1);a?.type==="text"?(a.raw+=(a.raw.endsWith(`
287
+ `)?"":`
288
+ `)+s.raw,a.text+=`
289
+ `+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):r.push(s);continue}if(t){let a="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(a);break}else throw new Error(a)}}return this.state.top=!0,r}inline(t,r=[]){return this.inlineQueue.push({src:t,tokens:r}),r}inlineTokens(t,r=[]){let n=t,s=null;if(this.tokens.links){let o=Object.keys(this.tokens.links);if(o.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)o.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,s.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(s=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)n=n.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let i=!1,a="";for(;t;){i||(a=""),i=!1;let o;if(this.options.extensions?.inline?.some(c=>(o=c.call({lexer:this},t,r))?(t=t.substring(o.raw.length),r.push(o),!0):!1))continue;if(o=this.tokenizer.escape(t)){t=t.substring(o.raw.length),r.push(o);continue}if(o=this.tokenizer.tag(t)){t=t.substring(o.raw.length),r.push(o);continue}if(o=this.tokenizer.link(t)){t=t.substring(o.raw.length),r.push(o);continue}if(o=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(o.raw.length);let c=r.at(-1);o.type==="text"&&c?.type==="text"?(c.raw+=o.raw,c.text+=o.text):r.push(o);continue}if(o=this.tokenizer.emStrong(t,n,a)){t=t.substring(o.raw.length),r.push(o);continue}if(o=this.tokenizer.codespan(t)){t=t.substring(o.raw.length),r.push(o);continue}if(o=this.tokenizer.br(t)){t=t.substring(o.raw.length),r.push(o);continue}if(o=this.tokenizer.del(t)){t=t.substring(o.raw.length),r.push(o);continue}if(o=this.tokenizer.autolink(t)){t=t.substring(o.raw.length),r.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(t))){t=t.substring(o.raw.length),r.push(o);continue}let l=t;if(this.options.extensions?.startInline){let c=1/0,u=t.slice(1),h;this.options.extensions.startInline.forEach(f=>{h=f.call({lexer:this},u),typeof h=="number"&&h>=0&&(c=Math.min(c,h))}),c<1/0&&c>=0&&(l=t.substring(0,c+1))}if(o=this.tokenizer.inlineText(l)){t=t.substring(o.raw.length),o.raw.slice(-1)!=="_"&&(a=o.raw.slice(-1)),i=!0;let c=r.at(-1);c?.type==="text"?(c.raw+=o.raw,c.text+=o.text):r.push(o);continue}if(t){let c="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return r}},Jo=class{options;parser;constructor(t){this.options=t||ms}space(t){return""}code({text:t,lang:r,escaped:n}){let s=(r||"").match(Ht.notSpaceStart)?.[0],i=t.replace(Ht.endingNewline,"")+`
290
+ `;return s?'<pre><code class="language-'+Pr(s)+'">'+(n?i:Pr(i,!0))+`</code></pre>
291
+ `:"<pre><code>"+(n?i:Pr(i,!0))+`</code></pre>
292
+ `}blockquote({tokens:t}){return`<blockquote>
293
+ ${this.parser.parse(t)}</blockquote>
294
+ `}html({text:t}){return t}def(t){return""}heading({tokens:t,depth:r}){return`<h${r}>${this.parser.parseInline(t)}</h${r}>
295
+ `}hr(t){return`<hr>
296
+ `}list(t){let r=t.ordered,n=t.start,s="";for(let o=0;o<t.items.length;o++){let l=t.items[o];s+=this.listitem(l)}let i=r?"ol":"ul",a=r&&n!==1?' start="'+n+'"':"";return"<"+i+a+`>
297
+ `+s+"</"+i+`>
298
+ `}listitem(t){let r="";if(t.task){let n=this.checkbox({checked:!!t.checked});t.loose?t.tokens[0]?.type==="paragraph"?(t.tokens[0].text=n+" "+t.tokens[0].text,t.tokens[0].tokens&&t.tokens[0].tokens.length>0&&t.tokens[0].tokens[0].type==="text"&&(t.tokens[0].tokens[0].text=n+" "+Pr(t.tokens[0].tokens[0].text),t.tokens[0].tokens[0].escaped=!0)):t.tokens.unshift({type:"text",raw:n+" ",text:n+" ",escaped:!0}):r+=n+" "}return r+=this.parser.parse(t.tokens,!!t.loose),`<li>${r}</li>
299
+ `}checkbox({checked:t}){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:t}){return`<p>${this.parser.parseInline(t)}</p>
300
+ `}table(t){let r="",n="";for(let i=0;i<t.header.length;i++)n+=this.tablecell(t.header[i]);r+=this.tablerow({text:n});let s="";for(let i=0;i<t.rows.length;i++){let a=t.rows[i];n="";for(let o=0;o<a.length;o++)n+=this.tablecell(a[o]);s+=this.tablerow({text:n})}return s&&(s=`<tbody>${s}</tbody>`),`<table>
301
+ <thead>
302
+ `+r+`</thead>
303
+ `+s+`</table>
304
+ `}tablerow({text:t}){return`<tr>
305
+ ${t}</tr>
306
+ `}tablecell(t){let r=this.parser.parseInline(t.tokens),n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+r+`</${n}>
307
+ `}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${Pr(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:r,tokens:n}){let s=this.parser.parseInline(n),i=ep(t);if(i===null)return s;t=i;let a='<a href="'+t+'"';return r&&(a+=' title="'+Pr(r)+'"'),a+=">"+s+"</a>",a}image({href:t,title:r,text:n,tokens:s}){s&&(n=this.parser.parseInline(s,this.parser.textRenderer));let i=ep(t);if(i===null)return Pr(n);t=i;let a=`<img src="${t}" alt="${n}"`;return r&&(a+=` title="${Pr(r)}"`),a+=">",a}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:Pr(t.text)}},Rd=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}},Tr=class Xu{options;renderer;textRenderer;constructor(t){this.options=t||ms,this.options.renderer=this.options.renderer||new Jo,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Rd}static parse(t,r){return new Xu(r).parse(t)}static parseInline(t,r){return new Xu(r).parseInline(t)}parse(t,r=!0){let n="";for(let s=0;s<t.length;s++){let i=t[s];if(this.options.extensions?.renderers?.[i.type]){let o=i,l=this.options.extensions.renderers[o.type].call({parser:this},o);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(o.type)){n+=l||"";continue}}let a=i;switch(a.type){case"space":{n+=this.renderer.space(a);continue}case"hr":{n+=this.renderer.hr(a);continue}case"heading":{n+=this.renderer.heading(a);continue}case"code":{n+=this.renderer.code(a);continue}case"table":{n+=this.renderer.table(a);continue}case"blockquote":{n+=this.renderer.blockquote(a);continue}case"list":{n+=this.renderer.list(a);continue}case"html":{n+=this.renderer.html(a);continue}case"def":{n+=this.renderer.def(a);continue}case"paragraph":{n+=this.renderer.paragraph(a);continue}case"text":{let o=a,l=this.renderer.text(o);for(;s+1<t.length&&t[s+1].type==="text";)o=t[++s],l+=`
308
+ `+this.renderer.text(o);r?n+=this.renderer.paragraph({type:"paragraph",raw:l,text:l,tokens:[{type:"text",raw:l,text:l,escaped:!0}]}):n+=l;continue}default:{let o='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return n}parseInline(t,r=this.renderer){let n="";for(let s=0;s<t.length;s++){let i=t[s];if(this.options.extensions?.renderers?.[i.type]){let o=this.options.extensions.renderers[i.type].call({parser:this},i);if(o!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){n+=o||"";continue}}let a=i;switch(a.type){case"escape":{n+=r.text(a);break}case"html":{n+=r.html(a);break}case"link":{n+=r.link(a);break}case"image":{n+=r.image(a);break}case"strong":{n+=r.strong(a);break}case"em":{n+=r.em(a);break}case"codespan":{n+=r.codespan(a);break}case"br":{n+=r.br(a);break}case"del":{n+=r.del(a);break}case"text":{n+=r.text(a);break}default:{let o='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return n}},Ri=class{options;block;constructor(t){this.options=t||ms}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}emStrongMask(t){return t}provideLexer(){return this.block?_r.lex:_r.lexInline}provideParser(){return this.block?Tr.parse:Tr.parseInline}},M3=class{defaults=Ad();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Tr;Renderer=Jo;TextRenderer=Rd;Lexer=_r;Tokenizer=Zo;Hooks=Ri;constructor(...t){this.use(...t)}walkTokens(t,r){let n=[];for(let s of t)switch(n=n.concat(r.call(this,s)),s.type){case"table":{let i=s;for(let a of i.header)n=n.concat(this.walkTokens(a.tokens,r));for(let a of i.rows)for(let o of a)n=n.concat(this.walkTokens(o.tokens,r));break}case"list":{let i=s;n=n.concat(this.walkTokens(i.items,r));break}default:{let i=s;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(a=>{let o=i[a].flat(1/0);n=n.concat(this.walkTokens(o,r))}):i.tokens&&(n=n.concat(this.walkTokens(i.tokens,r)))}}return n}use(...t){let r=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(n=>{let s={...n};if(s.async=this.defaults.async||s.async||!1,n.extensions&&(n.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let a=r.renderers[i.name];a?r.renderers[i.name]=function(...o){let l=i.renderer.apply(this,o);return l===!1&&(l=a.apply(this,o)),l}:r.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let a=r[i.level];a?a.unshift(i.tokenizer):r[i.level]=[i.tokenizer],i.start&&(i.level==="block"?r.startBlock?r.startBlock.push(i.start):r.startBlock=[i.start]:i.level==="inline"&&(r.startInline?r.startInline.push(i.start):r.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(r.childTokens[i.name]=i.childTokens)}),s.extensions=r),n.renderer){let i=this.defaults.renderer||new Jo(this.defaults);for(let a in n.renderer){if(!(a in i))throw new Error(`renderer '${a}' does not exist`);if(["options","parser"].includes(a))continue;let o=a,l=n.renderer[o],c=i[o];i[o]=(...u)=>{let h=l.apply(i,u);return h===!1&&(h=c.apply(i,u)),h||""}}s.renderer=i}if(n.tokenizer){let i=this.defaults.tokenizer||new Zo(this.defaults);for(let a in n.tokenizer){if(!(a in i))throw new Error(`tokenizer '${a}' does not exist`);if(["options","rules","lexer"].includes(a))continue;let o=a,l=n.tokenizer[o],c=i[o];i[o]=(...u)=>{let h=l.apply(i,u);return h===!1&&(h=c.apply(i,u)),h}}s.tokenizer=i}if(n.hooks){let i=this.defaults.hooks||new Ri;for(let a in n.hooks){if(!(a in i))throw new Error(`hook '${a}' does not exist`);if(["options","block"].includes(a))continue;let o=a,l=n.hooks[o],c=i[o];Ri.passThroughHooks.has(a)?i[o]=u=>{if(this.defaults.async&&Ri.passThroughHooksRespectAsync.has(a))return(async()=>{let f=await l.call(i,u);return c.call(i,f)})();let h=l.call(i,u);return c.call(i,h)}:i[o]=(...u)=>{if(this.defaults.async)return(async()=>{let f=await l.apply(i,u);return f===!1&&(f=await c.apply(i,u)),f})();let h=l.apply(i,u);return h===!1&&(h=c.apply(i,u)),h}}s.hooks=i}if(n.walkTokens){let i=this.defaults.walkTokens,a=n.walkTokens;s.walkTokens=function(o){let l=[];return l.push(a.call(this,o)),i&&(l=l.concat(i.call(this,o))),l}}this.defaults={...this.defaults,...s}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,r){return _r.lex(t,r??this.defaults)}parser(t,r){return Tr.parse(t,r??this.defaults)}parseMarkdown(t){return(r,n)=>{let s={...n},i={...this.defaults,...s},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&s.async===!1)return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof r>"u"||r===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof r!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(r)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=t),i.async)return(async()=>{let o=i.hooks?await i.hooks.preprocess(r):r,l=await(i.hooks?await i.hooks.provideLexer():t?_r.lex:_r.lexInline)(o,i),c=i.hooks?await i.hooks.processAllTokens(l):l;i.walkTokens&&await Promise.all(this.walkTokens(c,i.walkTokens));let u=await(i.hooks?await i.hooks.provideParser():t?Tr.parse:Tr.parseInline)(c,i);return i.hooks?await i.hooks.postprocess(u):u})().catch(a);try{i.hooks&&(r=i.hooks.preprocess(r));let o=(i.hooks?i.hooks.provideLexer():t?_r.lex:_r.lexInline)(r,i);i.hooks&&(o=i.hooks.processAllTokens(o)),i.walkTokens&&this.walkTokens(o,i.walkTokens);let l=(i.hooks?i.hooks.provideParser():t?Tr.parse:Tr.parseInline)(o,i);return i.hooks&&(l=i.hooks.postprocess(l)),l}catch(o){return a(o)}}}onError(t,r){return n=>{if(n.message+=`
309
+ Please report this to https://github.com/markedjs/marked.`,t){let s="<p>An error occurred:</p><pre>"+Pr(n.message+"",!0)+"</pre>";return r?Promise.resolve(s):s}if(r)return Promise.reject(n);throw n}}},cs=new M3;function qe(e,t){return cs.parse(e,t)}qe.options=qe.setOptions=function(e){return cs.setOptions(e),qe.defaults=cs.defaults,Zb(qe.defaults),qe};qe.getDefaults=Ad;qe.defaults=ms;qe.use=function(...e){return cs.use(...e),qe.defaults=cs.defaults,Zb(qe.defaults),qe};qe.walkTokens=function(e,t){return cs.walkTokens(e,t)};qe.parseInline=cs.parseInline;qe.Parser=Tr;qe.parser=Tr.parse;qe.Renderer=Jo;qe.TextRenderer=Rd;qe.Lexer=_r;qe.lexer=_r.lex;qe.Tokenizer=Zo;qe.Hooks=Ri;qe.parse=qe;qe.options;qe.setOptions;qe.use;qe.walkTokens;qe.parseInline;Tr.parse;_r.lex;function ck(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];var n=Array.from(typeof e=="string"?[e]:e);n[n.length-1]=n[n.length-1].replace(/\r?\n([\t ]*)$/,"");var s=n.reduce(function(o,l){var c=l.match(/\n([\t ]+|(?!\s).)/g);return c?o.concat(c.map(function(u){var h,f;return(f=(h=u.match(/[\t ]/g))===null||h===void 0?void 0:h.length)!==null&&f!==void 0?f:0})):o},[]);if(s.length){var i=new RegExp(`
310
+ [ ]{`+Math.min.apply(Math,s)+"}","g");n=n.map(function(o){return o.replace(i,`
311
+ `)})}n[0]=n[0].replace(/^\r?\n/,"");var a=n[0];return t.forEach(function(o,l){var c=a.match(/(?:^|\n)( *)$/),u=c?c[1]:"",h=o;typeof o=="string"&&o.includes(`
312
+ `)&&(h=String(o).split(`
313
+ `).map(function(f,g){return g===0?f:""+u+f}).join(`
314
+ `)),a+=h+n[l+1]}),a}var j3={body:'<g><rect width="80" height="80" style="fill: #087ebf; stroke-width: 0px;"/><text transform="translate(21.16 64.67)" style="fill: #fff; font-family: ArialMT, Arial; font-size: 67.75px;"><tspan x="0" y="0">?</tspan></text></g>',height:80,width:80},Ku=new Map,uk=new Map,I3=b(e=>{for(const t of e){if(!t.name)throw new Error('Invalid icon loader. Must have a "name" property with non-empty string value.');if(K.debug("Registering icon pack:",t.name),"loader"in t)uk.set(t.name,t.loader);else if("icons"in t)Ku.set(t.name,t.icons);else throw K.error("Invalid icon loader:",t),new Error('Invalid icon loader. Must have either "icons" or "loader" property.')}},"registerIconPacks"),hk=b(async(e,t)=>{const r=LD(e,!0,t!==void 0);if(!r)throw new Error(`Invalid icon name: ${e}`);const n=r.prefix||t;if(!n)throw new Error(`Icon name must contain a prefix: ${e}`);let s=Ku.get(n);if(!s){const a=uk.get(n);if(!a)throw new Error(`Icon set not found: ${r.prefix}`);try{s={...await a(),prefix:n},Ku.set(n,s)}catch(o){throw K.error(o),new Error(`Failed to load icon set: ${r.prefix}`)}}const i=BD(s,r.name);if(!i)throw new Error(`Icon not found: ${e}`);return i},"getRegisteredIconData"),L3=b(async e=>{try{return await hk(e),!0}catch{return!1}},"isIconAvailable"),Na=b(async(e,t,r)=>{let n;try{n=await hk(e,t?.fallbackPrefix)}catch(a){K.error(a),n=j3}const s=HD(n,t),i=YD(GD(s.body),{...s.attributes,...r});return yr(i,$t())},"getIconSVG");function dk(e,{markdownAutoWrap:t}){const n=e.replace(/<br\/>/g,`
315
+ `).replace(/\n{2,}/g,`
316
+ `),s=ck(n);return t===!1?s.replace(/ /g,"&nbsp;"):s}b(dk,"preprocessMarkdown");function fk(e,t={}){const r=dk(e,t),n=qe.lexer(r),s=[[]];let i=0;function a(o,l="normal"){o.type==="text"?o.text.split(`
317
+ `).forEach((u,h)=>{h!==0&&(i++,s.push([])),u.split(" ").forEach(f=>{f=f.replace(/&#39;/g,"'"),f&&s[i].push({content:f,type:l})})}):o.type==="strong"||o.type==="em"?o.tokens.forEach(c=>{a(c,o.type)}):o.type==="html"&&s[i].push({content:o.text,type:"normal"})}return b(a,"processNode"),n.forEach(o=>{o.type==="paragraph"?o.tokens?.forEach(l=>{a(l)}):o.type==="html"?s[i].push({content:o.text,type:"normal"}):s[i].push({content:o.raw,type:"normal"})}),s}b(fk,"markdownToLines");function gk(e,{markdownAutoWrap:t}={}){const r=qe.lexer(e);function n(s){return s.type==="text"?t===!1?s.text.replace(/\n */g,"<br/>").replace(/ /g,"&nbsp;"):s.text.replace(/\n */g,"<br/>"):s.type==="strong"?`<strong>${s.tokens?.map(n).join("")}</strong>`:s.type==="em"?`<em>${s.tokens?.map(n).join("")}</em>`:s.type==="paragraph"?`<p>${s.tokens?.map(n).join("")}</p>`:s.type==="space"?"":s.type==="html"?`${s.text}`:s.type==="escape"?s.text:(K.warn(`Unsupported markdown: ${s.type}`),s.raw)}return b(n,"output"),r.map(n).join("")}b(gk,"markdownToHTML");function pk(e){return Intl.Segmenter?[...new Intl.Segmenter().segment(e)].map(t=>t.segment):[...e]}b(pk,"splitTextToChars");function mk(e,t){const r=pk(t.content);return Pd(e,[],r,t.type)}b(mk,"splitWordToFitWidth");function Pd(e,t,r,n){if(r.length===0)return[{content:t.join(""),type:n},{content:"",type:n}];const[s,...i]=r,a=[...t,s];return e([{content:a.join(""),type:n}])?Pd(e,a,i,n):(t.length===0&&s&&(t.push(s),r.shift()),[{content:t.join(""),type:n},{content:r.join(""),type:n}])}b(Pd,"splitWordToFitWidthRecursion");function xk(e,t){if(e.some(({content:r})=>r.includes(`
318
+ `)))throw new Error("splitLineToFitWidth does not support newlines in the line");return el(e,t)}b(xk,"splitLineToFitWidth");function el(e,t,r=[],n=[]){if(e.length===0)return n.length>0&&r.push(n),r.length>0?r:[];let s="";e[0].content===" "&&(s=" ",e.shift());const i=e.shift()??{content:" ",type:"normal"},a=[...n];if(s!==""&&a.push({content:s,type:"normal"}),a.push(i),t(a))return el(e,t,r,a);if(n.length>0)r.push(n),e.unshift(i);else if(i.content){const[o,l]=mk(t,i);r.push([o]),l.content&&e.unshift(l)}return el(e,t,r)}b(el,"splitLineToFitWidthRecursion");function Qu(e,t){t&&e.attr("style",t)}b(Qu,"applyStyle");async function yk(e,t,r,n,s=!1,i=$t()){const a=e.append("foreignObject");a.attr("width",`${10*r}px`),a.attr("height",`${10*r}px`);const o=a.append("xhtml:div"),l=Xs(t.label)?await Gh(t.label.replace(si.lineBreakRegex,`
319
+ `),i):yr(t.label,i),c=t.isNode?"nodeLabel":"edgeLabel",u=o.append("span");u.html(l),Qu(u,t.labelStyle),u.attr("class",`${c} ${n}`),Qu(o,t.labelStyle),o.style("display","table-cell"),o.style("white-space","nowrap"),o.style("line-height","1.5"),o.style("max-width",r+"px"),o.style("text-align","center"),o.attr("xmlns","http://www.w3.org/1999/xhtml"),s&&o.attr("class","labelBkg");let h=o.node().getBoundingClientRect();return h.width===r&&(o.style("display","table"),o.style("white-space","break-spaces"),o.style("width",r+"px"),h=o.node().getBoundingClientRect()),a.node()}b(yk,"addHtmlSpan");function Dl(e,t,r){return e.append("tspan").attr("class","text-outer-tspan").attr("x",0).attr("y",t*r-.1+"em").attr("dy",r+"em")}b(Dl,"createTspan");function bk(e,t,r){const n=e.append("text"),s=Dl(n,1,t);Bl(s,r);const i=s.node().getComputedTextLength();return n.remove(),i}b(bk,"computeWidthOfText");function $3(e,t,r){const n=e.append("text"),s=Dl(n,1,t);Bl(s,[{content:r,type:"normal"}]);const i=s.node()?.getBoundingClientRect();return i&&n.remove(),i}b($3,"computeDimensionOfText");function kk(e,t,r,n=!1){const i=t.append("g"),a=i.insert("rect").attr("class","background").attr("style","stroke: none"),o=i.append("text").attr("y","-10.1");let l=0;for(const c of r){const u=b(f=>bk(i,1.1,f)<=e,"checkWidth"),h=u(c)?[c]:xk(c,u);for(const f of h){const g=Dl(o,l,1.1);Bl(g,f),l++}}if(n){const c=o.node().getBBox(),u=2;return a.attr("x",c.x-u).attr("y",c.y-u).attr("width",c.width+2*u).attr("height",c.height+2*u),i.node()}else return o.node()}b(kk,"createFormattedText");function Bl(e,t){e.text(""),t.forEach((r,n)=>{const s=e.append("tspan").attr("font-style",r.type==="em"?"italic":"normal").attr("class","text-inner-tspan").attr("font-weight",r.type==="strong"?"bold":"normal");n===0?s.text(r.content):s.text(" "+r.content)})}b(Bl,"updateTextContentAndStyles");async function wk(e,t={}){const r=[];e.replace(/(fa[bklrs]?):fa-([\w-]+)/g,(s,i,a)=>(r.push((async()=>{const o=`${i}:${a}`;return await L3(o)?await Na(o,void 0,{class:"label-icon"}):`<i class='${yr(s,t).replace(":"," ")}'></i>`})()),s));const n=await Promise.all(r);return e.replace(/(fa[bklrs]?):fa-([\w-]+)/g,()=>n.shift()??"")}b(wk,"replaceIconSubstring");var $n=b(async(e,t="",{style:r="",isTitle:n=!1,classes:s="",useHtmlLabels:i=!0,isNode:a=!0,width:o=200,addSvgBackground:l=!1}={},c)=>{if(K.debug("XYZ createText",t,r,n,s,i,a,"addSvgBackground: ",l),i){const u=gk(t,c),h=await wk(ps(u),c),f=t.replace(/\\\\/g,"\\"),g={isNode:a,label:Xs(t)?f:h,labelStyle:r.replace("fill:","color:")};return await yk(e,g,o,s,l,c)}else{const u=t.replace(/<br\s*\/?>/g,"<br/>"),h=fk(u.replace("<br>","<br/>"),c),f=kk(o,e,h,t?l:!1);if(a){/stroke:/.exec(r)&&(r=r.replace("stroke:","lineColor:"));const g=r.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/color:/g,"fill:");Oe(f).attr("style",g)}else{const g=r.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/background:/g,"fill:");Oe(f).select("rect").attr("style",g.replace(/background:/g,"fill:"));const p=r.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/color:/g,"fill:");Oe(f).select("text").attr("style",p)}return f}},"createText");function Pc(e,t,r){if(e&&e.length){const[n,s]=t,i=Math.PI/180*r,a=Math.cos(i),o=Math.sin(i);for(const l of e){const[c,u]=l;l[0]=(c-n)*a-(u-s)*o+n,l[1]=(c-n)*o+(u-s)*a+s}}}function D3(e,t){return e[0]===t[0]&&e[1]===t[1]}function B3(e,t,r,n=1){const s=r,i=Math.max(t,.1),a=e[0]&&e[0][0]&&typeof e[0][0]=="number"?[e]:e,o=[0,0];if(s)for(const c of a)Pc(c,o,s);const l=(function(c,u,h){const f=[];for(const k of c){const C=[...k];D3(C[0],C[C.length-1])||C.push([C[0][0],C[0][1]]),C.length>2&&f.push(C)}const g=[];u=Math.max(u,.1);const p=[];for(const k of f)for(let C=0;C<k.length-1;C++){const T=k[C],S=k[C+1];if(T[1]!==S[1]){const w=Math.min(T[1],S[1]);p.push({ymin:w,ymax:Math.max(T[1],S[1]),x:w===T[1]?T[0]:S[0],islope:(S[0]-T[0])/(S[1]-T[1])})}}if(p.sort(((k,C)=>k.ymin<C.ymin?-1:k.ymin>C.ymin?1:k.x<C.x?-1:k.x>C.x?1:k.ymax===C.ymax?0:(k.ymax-C.ymax)/Math.abs(k.ymax-C.ymax))),!p.length)return g;let m=[],y=p[0].ymin,x=0;for(;m.length||p.length;){if(p.length){let k=-1;for(let C=0;C<p.length&&!(p[C].ymin>y);C++)k=C;p.splice(0,k+1).forEach((C=>{m.push({s:y,edge:C})}))}if(m=m.filter((k=>!(k.edge.ymax<=y))),m.sort(((k,C)=>k.edge.x===C.edge.x?0:(k.edge.x-C.edge.x)/Math.abs(k.edge.x-C.edge.x))),(h!==1||x%u==0)&&m.length>1)for(let k=0;k<m.length;k+=2){const C=k+1;if(C>=m.length)break;const T=m[k].edge,S=m[C].edge;g.push([[Math.round(T.x),y],[Math.round(S.x),y]])}y+=h,m.forEach((k=>{k.edge.x=k.edge.x+h*k.edge.islope})),x++}return g})(a,i,n);if(s){for(const c of a)Pc(c,o,-s);(function(c,u,h){const f=[];c.forEach((g=>f.push(...g))),Pc(f,u,h)})(l,o,-s)}return l}function Ea(e,t){var r;const n=t.hachureAngle+90;let s=t.hachureGap;s<0&&(s=4*t.strokeWidth),s=Math.round(Math.max(s,.1));let i=1;return t.roughness>=1&&(((r=t.randomizer)===null||r===void 0?void 0:r.next())||Math.random())>.7&&(i=s),B3(e,s,n,i||1)}class Fd{constructor(t){this.helper=t}fillPolygons(t,r){return this._fillPolygons(t,r)}_fillPolygons(t,r){const n=Ea(t,r);return{type:"fillSketch",ops:this.renderLines(n,r)}}renderLines(t,r){const n=[];for(const s of t)n.push(...this.helper.doubleLineOps(s[0][0],s[0][1],s[1][0],s[1][1],r));return n}}function Rl(e){const t=e[0],r=e[1];return Math.sqrt(Math.pow(t[0]-r[0],2)+Math.pow(t[1]-r[1],2))}class R3 extends Fd{fillPolygons(t,r){let n=r.hachureGap;n<0&&(n=4*r.strokeWidth),n=Math.max(n,.1);const s=Ea(t,Object.assign({},r,{hachureGap:n})),i=Math.PI/180*r.hachureAngle,a=[],o=.5*n*Math.cos(i),l=.5*n*Math.sin(i);for(const[c,u]of s)Rl([c,u])&&a.push([[c[0]-o,c[1]+l],[...u]],[[c[0]+o,c[1]-l],[...u]]);return{type:"fillSketch",ops:this.renderLines(a,r)}}}class P3 extends Fd{fillPolygons(t,r){const n=this._fillPolygons(t,r),s=Object.assign({},r,{hachureAngle:r.hachureAngle+90}),i=this._fillPolygons(t,s);return n.ops=n.ops.concat(i.ops),n}}class F3{constructor(t){this.helper=t}fillPolygons(t,r){const n=Ea(t,r=Object.assign({},r,{hachureAngle:0}));return this.dotsOnLines(n,r)}dotsOnLines(t,r){const n=[];let s=r.hachureGap;s<0&&(s=4*r.strokeWidth),s=Math.max(s,.1);let i=r.fillWeight;i<0&&(i=r.strokeWidth/2);const a=s/4;for(const o of t){const l=Rl(o),c=l/s,u=Math.ceil(c)-1,h=l-u*s,f=(o[0][0]+o[1][0])/2-s/4,g=Math.min(o[0][1],o[1][1]);for(let p=0;p<u;p++){const m=g+h+p*s,y=f-a+2*Math.random()*a,x=m-a+2*Math.random()*a,k=this.helper.ellipse(y,x,i,i,r);n.push(...k.ops)}}return{type:"fillSketch",ops:n}}}class O3{constructor(t){this.helper=t}fillPolygons(t,r){const n=Ea(t,r);return{type:"fillSketch",ops:this.dashedLine(n,r)}}dashedLine(t,r){const n=r.dashOffset<0?r.hachureGap<0?4*r.strokeWidth:r.hachureGap:r.dashOffset,s=r.dashGap<0?r.hachureGap<0?4*r.strokeWidth:r.hachureGap:r.dashGap,i=[];return t.forEach((a=>{const o=Rl(a),l=Math.floor(o/(n+s)),c=(o+s-l*(n+s))/2;let u=a[0],h=a[1];u[0]>h[0]&&(u=a[1],h=a[0]);const f=Math.atan((h[1]-u[1])/(h[0]-u[0]));for(let g=0;g<l;g++){const p=g*(n+s),m=p+n,y=[u[0]+p*Math.cos(f)+c*Math.cos(f),u[1]+p*Math.sin(f)+c*Math.sin(f)],x=[u[0]+m*Math.cos(f)+c*Math.cos(f),u[1]+m*Math.sin(f)+c*Math.sin(f)];i.push(...this.helper.doubleLineOps(y[0],y[1],x[0],x[1],r))}})),i}}class z3{constructor(t){this.helper=t}fillPolygons(t,r){const n=r.hachureGap<0?4*r.strokeWidth:r.hachureGap,s=r.zigzagOffset<0?n:r.zigzagOffset,i=Ea(t,r=Object.assign({},r,{hachureGap:n+s}));return{type:"fillSketch",ops:this.zigzagLines(i,s,r)}}zigzagLines(t,r,n){const s=[];return t.forEach((i=>{const a=Rl(i),o=Math.round(a/(2*r));let l=i[0],c=i[1];l[0]>c[0]&&(l=i[1],c=i[0]);const u=Math.atan((c[1]-l[1])/(c[0]-l[0]));for(let h=0;h<o;h++){const f=2*h*r,g=2*(h+1)*r,p=Math.sqrt(2*Math.pow(r,2)),m=[l[0]+f*Math.cos(u),l[1]+f*Math.sin(u)],y=[l[0]+g*Math.cos(u),l[1]+g*Math.sin(u)],x=[m[0]+p*Math.cos(u+Math.PI/4),m[1]+p*Math.sin(u+Math.PI/4)];s.push(...this.helper.doubleLineOps(m[0],m[1],x[0],x[1],n),...this.helper.doubleLineOps(x[0],x[1],y[0],y[1],n))}})),s}}const Jt={};class W3{constructor(t){this.seed=t}next(){return this.seed?(2**31-1&(this.seed=Math.imul(48271,this.seed)))/2**31:Math.random()}}const H3=0,Fc=1,np=2,Ka={A:7,a:7,C:6,c:6,H:1,h:1,L:2,l:2,M:2,m:2,Q:4,q:4,S:4,s:4,T:2,t:2,V:1,v:1,Z:0,z:0};function Oc(e,t){return e.type===t}function Od(e){const t=[],r=(function(a){const o=new Array;for(;a!=="";)if(a.match(/^([ \t\r\n,]+)/))a=a.substr(RegExp.$1.length);else if(a.match(/^([aAcChHlLmMqQsStTvVzZ])/))o[o.length]={type:H3,text:RegExp.$1},a=a.substr(RegExp.$1.length);else{if(!a.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/))return[];o[o.length]={type:Fc,text:`${parseFloat(RegExp.$1)}`},a=a.substr(RegExp.$1.length)}return o[o.length]={type:np,text:""},o})(e);let n="BOD",s=0,i=r[s];for(;!Oc(i,np);){let a=0;const o=[];if(n==="BOD"){if(i.text!=="M"&&i.text!=="m")return Od("M0,0"+e);s++,a=Ka[i.text],n=i.text}else Oc(i,Fc)?a=Ka[n]:(s++,a=Ka[i.text],n=i.text);if(!(s+a<r.length))throw new Error("Path data ended short");for(let l=s;l<s+a;l++){const c=r[l];if(!Oc(c,Fc))throw new Error("Param not a number: "+n+","+c.text);o[o.length]=+c.text}if(typeof Ka[n]!="number")throw new Error("Bad segment: "+n);{const l={key:n,data:o};t.push(l),s+=a,i=r[s],n==="M"&&(n="L"),n==="m"&&(n="l")}}return t}function vk(e){let t=0,r=0,n=0,s=0;const i=[];for(const{key:a,data:o}of e)switch(a){case"M":i.push({key:"M",data:[...o]}),[t,r]=o,[n,s]=o;break;case"m":t+=o[0],r+=o[1],i.push({key:"M",data:[t,r]}),n=t,s=r;break;case"L":i.push({key:"L",data:[...o]}),[t,r]=o;break;case"l":t+=o[0],r+=o[1],i.push({key:"L",data:[t,r]});break;case"C":i.push({key:"C",data:[...o]}),t=o[4],r=o[5];break;case"c":{const l=o.map(((c,u)=>u%2?c+r:c+t));i.push({key:"C",data:l}),t=l[4],r=l[5];break}case"Q":i.push({key:"Q",data:[...o]}),t=o[2],r=o[3];break;case"q":{const l=o.map(((c,u)=>u%2?c+r:c+t));i.push({key:"Q",data:l}),t=l[2],r=l[3];break}case"A":i.push({key:"A",data:[...o]}),t=o[5],r=o[6];break;case"a":t+=o[5],r+=o[6],i.push({key:"A",data:[o[0],o[1],o[2],o[3],o[4],t,r]});break;case"H":i.push({key:"H",data:[...o]}),t=o[0];break;case"h":t+=o[0],i.push({key:"H",data:[t]});break;case"V":i.push({key:"V",data:[...o]}),r=o[0];break;case"v":r+=o[0],i.push({key:"V",data:[r]});break;case"S":i.push({key:"S",data:[...o]}),t=o[2],r=o[3];break;case"s":{const l=o.map(((c,u)=>u%2?c+r:c+t));i.push({key:"S",data:l}),t=l[2],r=l[3];break}case"T":i.push({key:"T",data:[...o]}),t=o[0],r=o[1];break;case"t":t+=o[0],r+=o[1],i.push({key:"T",data:[t,r]});break;case"Z":case"z":i.push({key:"Z",data:[]}),t=n,r=s}return i}function Ck(e){const t=[];let r="",n=0,s=0,i=0,a=0,o=0,l=0;for(const{key:c,data:u}of e){switch(c){case"M":t.push({key:"M",data:[...u]}),[n,s]=u,[i,a]=u;break;case"C":t.push({key:"C",data:[...u]}),n=u[4],s=u[5],o=u[2],l=u[3];break;case"L":t.push({key:"L",data:[...u]}),[n,s]=u;break;case"H":n=u[0],t.push({key:"L",data:[n,s]});break;case"V":s=u[0],t.push({key:"L",data:[n,s]});break;case"S":{let h=0,f=0;r==="C"||r==="S"?(h=n+(n-o),f=s+(s-l)):(h=n,f=s),t.push({key:"C",data:[h,f,...u]}),o=u[0],l=u[1],n=u[2],s=u[3];break}case"T":{const[h,f]=u;let g=0,p=0;r==="Q"||r==="T"?(g=n+(n-o),p=s+(s-l)):(g=n,p=s);const m=n+2*(g-n)/3,y=s+2*(p-s)/3,x=h+2*(g-h)/3,k=f+2*(p-f)/3;t.push({key:"C",data:[m,y,x,k,h,f]}),o=g,l=p,n=h,s=f;break}case"Q":{const[h,f,g,p]=u,m=n+2*(h-n)/3,y=s+2*(f-s)/3,x=g+2*(h-g)/3,k=p+2*(f-p)/3;t.push({key:"C",data:[m,y,x,k,g,p]}),o=h,l=f,n=g,s=p;break}case"A":{const h=Math.abs(u[0]),f=Math.abs(u[1]),g=u[2],p=u[3],m=u[4],y=u[5],x=u[6];h===0||f===0?(t.push({key:"C",data:[n,s,y,x,y,x]}),n=y,s=x):(n!==y||s!==x)&&(Sk(n,s,y,x,h,f,g,p,m).forEach((function(k){t.push({key:"C",data:k})})),n=y,s=x);break}case"Z":t.push({key:"Z",data:[]}),n=i,s=a}r=c}return t}function Ai(e,t,r){return[e*Math.cos(r)-t*Math.sin(r),e*Math.sin(r)+t*Math.cos(r)]}function Sk(e,t,r,n,s,i,a,o,l,c){const u=(h=a,Math.PI*h/180);var h;let f=[],g=0,p=0,m=0,y=0;if(c)[g,p,m,y]=c;else{[e,t]=Ai(e,t,-u),[r,n]=Ai(r,n,-u);const R=(e-r)/2,j=(t-n)/2;let B=R*R/(s*s)+j*j/(i*i);B>1&&(B=Math.sqrt(B),s*=B,i*=B);const I=s*s,F=i*i,W=I*F-I*j*j-F*R*R,ee=I*j*j+F*R*R,A=(o===l?-1:1)*Math.sqrt(Math.abs(W/ee));m=A*s*j/i+(e+r)/2,y=A*-i*R/s+(t+n)/2,g=Math.asin(parseFloat(((t-y)/i).toFixed(9))),p=Math.asin(parseFloat(((n-y)/i).toFixed(9))),e<m&&(g=Math.PI-g),r<m&&(p=Math.PI-p),g<0&&(g=2*Math.PI+g),p<0&&(p=2*Math.PI+p),l&&g>p&&(g-=2*Math.PI),!l&&p>g&&(p-=2*Math.PI)}let x=p-g;if(Math.abs(x)>120*Math.PI/180){const R=p,j=r,B=n;p=l&&p>g?g+120*Math.PI/180*1:g+120*Math.PI/180*-1,f=Sk(r=m+s*Math.cos(p),n=y+i*Math.sin(p),j,B,s,i,a,0,l,[p,R,m,y])}x=p-g;const k=Math.cos(g),C=Math.sin(g),T=Math.cos(p),S=Math.sin(p),w=Math.tan(x/4),_=4/3*s*w,O=4/3*i*w,P=[e,t],v=[e+_*C,t-O*k],L=[r+_*S,n-O*T],N=[r,n];if(v[0]=2*P[0]-v[0],v[1]=2*P[1]-v[1],c)return[v,L,N].concat(f);{f=[v,L,N].concat(f);const R=[];for(let j=0;j<f.length;j+=3){const B=Ai(f[j][0],f[j][1],u),I=Ai(f[j+1][0],f[j+1][1],u),F=Ai(f[j+2][0],f[j+2][1],u);R.push([B[0],B[1],I[0],I[1],F[0],F[1]])}return R}}const q3={randOffset:function(e,t){return Ce(e,t)},randOffsetWithRange:function(e,t,r){return tl(e,t,r)},ellipse:function(e,t,r,n,s){const i=Tk(r,n,s);return Zu(e,t,s,i).opset},doubleLineOps:function(e,t,r,n,s){return Mn(e,t,r,n,s,!0)}};function _k(e,t,r,n,s){return{type:"path",ops:Mn(e,t,r,n,s)}}function mo(e,t,r){const n=(e||[]).length;if(n>2){const s=[];for(let i=0;i<n-1;i++)s.push(...Mn(e[i][0],e[i][1],e[i+1][0],e[i+1][1],r));return t&&s.push(...Mn(e[n-1][0],e[n-1][1],e[0][0],e[0][1],r)),{type:"path",ops:s}}return n===2?_k(e[0][0],e[0][1],e[1][0],e[1][1],r):{type:"path",ops:[]}}function U3(e,t,r,n,s){return(function(i,a){return mo(i,!0,a)})([[e,t],[e+r,t],[e+r,t+n],[e,t+n]],s)}function sp(e,t){if(e.length){const r=typeof e[0][0]=="number"?[e]:e,n=Qa(r[0],1*(1+.2*t.roughness),t),s=t.disableMultiStroke?[]:Qa(r[0],1.5*(1+.22*t.roughness),op(t));for(let i=1;i<r.length;i++){const a=r[i];if(a.length){const o=Qa(a,1*(1+.2*t.roughness),t),l=t.disableMultiStroke?[]:Qa(a,1.5*(1+.22*t.roughness),op(t));for(const c of o)c.op!=="move"&&n.push(c);for(const c of l)c.op!=="move"&&s.push(c)}}return{type:"path",ops:n.concat(s)}}return{type:"path",ops:[]}}function Tk(e,t,r){const n=Math.sqrt(2*Math.PI*Math.sqrt((Math.pow(e/2,2)+Math.pow(t/2,2))/2)),s=Math.ceil(Math.max(r.curveStepCount,r.curveStepCount/Math.sqrt(200)*n)),i=2*Math.PI/s;let a=Math.abs(e/2),o=Math.abs(t/2);const l=1-r.curveFitting;return a+=Ce(a*l,r),o+=Ce(o*l,r),{increment:i,rx:a,ry:o}}function Zu(e,t,r,n){const[s,i]=lp(n.increment,e,t,n.rx,n.ry,1,n.increment*tl(.1,tl(.4,1,r),r),r);let a=rl(s,null,r);if(!r.disableMultiStroke&&r.roughness!==0){const[o]=lp(n.increment,e,t,n.rx,n.ry,1.5,0,r),l=rl(o,null,r);a=a.concat(l)}return{estimatedPoints:i,opset:{type:"path",ops:a}}}function ip(e,t,r,n,s,i,a,o,l){const c=e,u=t;let h=Math.abs(r/2),f=Math.abs(n/2);h+=Ce(.01*h,l),f+=Ce(.01*f,l);let g=s,p=i;for(;g<0;)g+=2*Math.PI,p+=2*Math.PI;p-g>2*Math.PI&&(g=0,p=2*Math.PI);const m=2*Math.PI/l.curveStepCount,y=Math.min(m/2,(p-g)/2),x=cp(y,c,u,h,f,g,p,1,l);if(!l.disableMultiStroke){const k=cp(y,c,u,h,f,g,p,1.5,l);x.push(...k)}return a&&(o?x.push(...Mn(c,u,c+h*Math.cos(g),u+f*Math.sin(g),l),...Mn(c,u,c+h*Math.cos(p),u+f*Math.sin(p),l)):x.push({op:"lineTo",data:[c,u]},{op:"lineTo",data:[c+h*Math.cos(g),u+f*Math.sin(g)]})),{type:"path",ops:x}}function ap(e,t){const r=Ck(vk(Od(e))),n=[];let s=[0,0],i=[0,0];for(const{key:a,data:o}of r)switch(a){case"M":i=[o[0],o[1]],s=[o[0],o[1]];break;case"L":n.push(...Mn(i[0],i[1],o[0],o[1],t)),i=[o[0],o[1]];break;case"C":{const[l,c,u,h,f,g]=o;n.push(...V3(l,c,u,h,f,g,i,t)),i=[f,g];break}case"Z":n.push(...Mn(i[0],i[1],s[0],s[1],t)),i=[s[0],s[1]]}return{type:"path",ops:n}}function zc(e,t){const r=[];for(const n of e)if(n.length){const s=t.maxRandomnessOffset||0,i=n.length;if(i>2){r.push({op:"move",data:[n[0][0]+Ce(s,t),n[0][1]+Ce(s,t)]});for(let a=1;a<i;a++)r.push({op:"lineTo",data:[n[a][0]+Ce(s,t),n[a][1]+Ce(s,t)]})}}return{type:"fillPath",ops:r}}function Es(e,t){return(function(r,n){let s=r.fillStyle||"hachure";if(!Jt[s])switch(s){case"zigzag":Jt[s]||(Jt[s]=new R3(n));break;case"cross-hatch":Jt[s]||(Jt[s]=new P3(n));break;case"dots":Jt[s]||(Jt[s]=new F3(n));break;case"dashed":Jt[s]||(Jt[s]=new O3(n));break;case"zigzag-line":Jt[s]||(Jt[s]=new z3(n));break;default:s="hachure",Jt[s]||(Jt[s]=new Fd(n))}return Jt[s]})(t,q3).fillPolygons(e,t)}function op(e){const t=Object.assign({},e);return t.randomizer=void 0,e.seed&&(t.seed=e.seed+1),t}function Nk(e){return e.randomizer||(e.randomizer=new W3(e.seed||0)),e.randomizer.next()}function tl(e,t,r,n=1){return r.roughness*n*(Nk(r)*(t-e)+e)}function Ce(e,t,r=1){return tl(-e,e,t,r)}function Mn(e,t,r,n,s,i=!1){const a=i?s.disableMultiStrokeFill:s.disableMultiStroke,o=Ju(e,t,r,n,s,!0,!1);if(a)return o;const l=Ju(e,t,r,n,s,!0,!0);return o.concat(l)}function Ju(e,t,r,n,s,i,a){const o=Math.pow(e-r,2)+Math.pow(t-n,2),l=Math.sqrt(o);let c=1;c=l<200?1:l>500?.4:-.0016668*l+1.233334;let u=s.maxRandomnessOffset||0;u*u*100>o&&(u=l/10);const h=u/2,f=.2+.2*Nk(s);let g=s.bowing*s.maxRandomnessOffset*(n-t)/200,p=s.bowing*s.maxRandomnessOffset*(e-r)/200;g=Ce(g,s,c),p=Ce(p,s,c);const m=[],y=()=>Ce(h,s,c),x=()=>Ce(u,s,c),k=s.preserveVertices;return a?m.push({op:"move",data:[e+(k?0:y()),t+(k?0:y())]}):m.push({op:"move",data:[e+(k?0:Ce(u,s,c)),t+(k?0:Ce(u,s,c))]}),a?m.push({op:"bcurveTo",data:[g+e+(r-e)*f+y(),p+t+(n-t)*f+y(),g+e+2*(r-e)*f+y(),p+t+2*(n-t)*f+y(),r+(k?0:y()),n+(k?0:y())]}):m.push({op:"bcurveTo",data:[g+e+(r-e)*f+x(),p+t+(n-t)*f+x(),g+e+2*(r-e)*f+x(),p+t+2*(n-t)*f+x(),r+(k?0:x()),n+(k?0:x())]}),m}function Qa(e,t,r){if(!e.length)return[];const n=[];n.push([e[0][0]+Ce(t,r),e[0][1]+Ce(t,r)]),n.push([e[0][0]+Ce(t,r),e[0][1]+Ce(t,r)]);for(let s=1;s<e.length;s++)n.push([e[s][0]+Ce(t,r),e[s][1]+Ce(t,r)]),s===e.length-1&&n.push([e[s][0]+Ce(t,r),e[s][1]+Ce(t,r)]);return rl(n,null,r)}function rl(e,t,r){const n=e.length,s=[];if(n>3){const i=[],a=1-r.curveTightness;s.push({op:"move",data:[e[1][0],e[1][1]]});for(let o=1;o+2<n;o++){const l=e[o];i[0]=[l[0],l[1]],i[1]=[l[0]+(a*e[o+1][0]-a*e[o-1][0])/6,l[1]+(a*e[o+1][1]-a*e[o-1][1])/6],i[2]=[e[o+1][0]+(a*e[o][0]-a*e[o+2][0])/6,e[o+1][1]+(a*e[o][1]-a*e[o+2][1])/6],i[3]=[e[o+1][0],e[o+1][1]],s.push({op:"bcurveTo",data:[i[1][0],i[1][1],i[2][0],i[2][1],i[3][0],i[3][1]]})}}else n===3?(s.push({op:"move",data:[e[1][0],e[1][1]]}),s.push({op:"bcurveTo",data:[e[1][0],e[1][1],e[2][0],e[2][1],e[2][0],e[2][1]]})):n===2&&s.push(...Ju(e[0][0],e[0][1],e[1][0],e[1][1],r,!0,!0));return s}function lp(e,t,r,n,s,i,a,o){const l=[],c=[];if(o.roughness===0){e/=4,c.push([t+n*Math.cos(-e),r+s*Math.sin(-e)]);for(let u=0;u<=2*Math.PI;u+=e){const h=[t+n*Math.cos(u),r+s*Math.sin(u)];l.push(h),c.push(h)}c.push([t+n*Math.cos(0),r+s*Math.sin(0)]),c.push([t+n*Math.cos(e),r+s*Math.sin(e)])}else{const u=Ce(.5,o)-Math.PI/2;c.push([Ce(i,o)+t+.9*n*Math.cos(u-e),Ce(i,o)+r+.9*s*Math.sin(u-e)]);const h=2*Math.PI+u-.01;for(let f=u;f<h;f+=e){const g=[Ce(i,o)+t+n*Math.cos(f),Ce(i,o)+r+s*Math.sin(f)];l.push(g),c.push(g)}c.push([Ce(i,o)+t+n*Math.cos(u+2*Math.PI+.5*a),Ce(i,o)+r+s*Math.sin(u+2*Math.PI+.5*a)]),c.push([Ce(i,o)+t+.98*n*Math.cos(u+a),Ce(i,o)+r+.98*s*Math.sin(u+a)]),c.push([Ce(i,o)+t+.9*n*Math.cos(u+.5*a),Ce(i,o)+r+.9*s*Math.sin(u+.5*a)])}return[c,l]}function cp(e,t,r,n,s,i,a,o,l){const c=i+Ce(.1,l),u=[];u.push([Ce(o,l)+t+.9*n*Math.cos(c-e),Ce(o,l)+r+.9*s*Math.sin(c-e)]);for(let h=c;h<=a;h+=e)u.push([Ce(o,l)+t+n*Math.cos(h),Ce(o,l)+r+s*Math.sin(h)]);return u.push([t+n*Math.cos(a),r+s*Math.sin(a)]),u.push([t+n*Math.cos(a),r+s*Math.sin(a)]),rl(u,null,l)}function V3(e,t,r,n,s,i,a,o){const l=[],c=[o.maxRandomnessOffset||1,(o.maxRandomnessOffset||1)+.3];let u=[0,0];const h=o.disableMultiStroke?1:2,f=o.preserveVertices;for(let g=0;g<h;g++)g===0?l.push({op:"move",data:[a[0],a[1]]}):l.push({op:"move",data:[a[0]+(f?0:Ce(c[0],o)),a[1]+(f?0:Ce(c[0],o))]}),u=f?[s,i]:[s+Ce(c[g],o),i+Ce(c[g],o)],l.push({op:"bcurveTo",data:[e+Ce(c[g],o),t+Ce(c[g],o),r+Ce(c[g],o),n+Ce(c[g],o),u[0],u[1]]});return l}function Mi(e){return[...e]}function up(e,t=0){const r=e.length;if(r<3)throw new Error("A curve must have at least three points.");const n=[];if(r===3)n.push(Mi(e[0]),Mi(e[1]),Mi(e[2]),Mi(e[2]));else{const s=[];s.push(e[0],e[0]);for(let o=1;o<e.length;o++)s.push(e[o]),o===e.length-1&&s.push(e[o]);const i=[],a=1-t;n.push(Mi(s[0]));for(let o=1;o+2<s.length;o++){const l=s[o];i[0]=[l[0],l[1]],i[1]=[l[0]+(a*s[o+1][0]-a*s[o-1][0])/6,l[1]+(a*s[o+1][1]-a*s[o-1][1])/6],i[2]=[s[o+1][0]+(a*s[o][0]-a*s[o+2][0])/6,s[o+1][1]+(a*s[o][1]-a*s[o+2][1])/6],i[3]=[s[o+1][0],s[o+1][1]],n.push(i[1],i[2],i[3])}}return n}function xo(e,t){return Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)}function G3(e,t,r){const n=xo(t,r);if(n===0)return xo(e,t);let s=((e[0]-t[0])*(r[0]-t[0])+(e[1]-t[1])*(r[1]-t[1]))/n;return s=Math.max(0,Math.min(1,s)),xo(e,Vn(t,r,s))}function Vn(e,t,r){return[e[0]+(t[0]-e[0])*r,e[1]+(t[1]-e[1])*r]}function eh(e,t,r,n){const s=n||[];if((function(o,l){const c=o[l+0],u=o[l+1],h=o[l+2],f=o[l+3];let g=3*u[0]-2*c[0]-f[0];g*=g;let p=3*u[1]-2*c[1]-f[1];p*=p;let m=3*h[0]-2*f[0]-c[0];m*=m;let y=3*h[1]-2*f[1]-c[1];return y*=y,g<m&&(g=m),p<y&&(p=y),g+p})(e,t)<r){const o=e[t+0];s.length?(i=s[s.length-1],a=o,Math.sqrt(xo(i,a))>1&&s.push(o)):s.push(o),s.push(e[t+3])}else{const l=e[t+0],c=e[t+1],u=e[t+2],h=e[t+3],f=Vn(l,c,.5),g=Vn(c,u,.5),p=Vn(u,h,.5),m=Vn(f,g,.5),y=Vn(g,p,.5),x=Vn(m,y,.5);eh([l,f,m,x],0,r,s),eh([x,y,p,h],0,r,s)}var i,a;return s}function Y3(e,t){return nl(e,0,e.length,t)}function nl(e,t,r,n,s){const i=s||[],a=e[t],o=e[r-1];let l=0,c=1;for(let u=t+1;u<r-1;++u){const h=G3(e[u],a,o);h>l&&(l=h,c=u)}return Math.sqrt(l)>n?(nl(e,t,c+1,n,i),nl(e,c,r,n,i)):(i.length||i.push(a),i.push(o)),i}function Wc(e,t=.15,r){const n=[],s=(e.length-1)/3;for(let i=0;i<s;i++)eh(e,3*i,t,n);return r&&r>0?nl(n,0,n.length,r):n}const ir="none";class sl{constructor(t){this.defaultOptions={maxRandomnessOffset:2,roughness:1,bowing:1,stroke:"#000",strokeWidth:1,curveTightness:0,curveFitting:.95,curveStepCount:9,fillStyle:"hachure",fillWeight:-1,hachureAngle:-41,hachureGap:-1,dashOffset:-1,dashGap:-1,zigzagOffset:-1,seed:0,disableMultiStroke:!1,disableMultiStrokeFill:!1,preserveVertices:!1,fillShapeRoughnessGain:.8},this.config=t||{},this.config.options&&(this.defaultOptions=this._o(this.config.options))}static newSeed(){return Math.floor(Math.random()*2**31)}_o(t){return t?Object.assign({},this.defaultOptions,t):this.defaultOptions}_d(t,r,n){return{shape:t,sets:r||[],options:n||this.defaultOptions}}line(t,r,n,s,i){const a=this._o(i);return this._d("line",[_k(t,r,n,s,a)],a)}rectangle(t,r,n,s,i){const a=this._o(i),o=[],l=U3(t,r,n,s,a);if(a.fill){const c=[[t,r],[t+n,r],[t+n,r+s],[t,r+s]];a.fillStyle==="solid"?o.push(zc([c],a)):o.push(Es([c],a))}return a.stroke!==ir&&o.push(l),this._d("rectangle",o,a)}ellipse(t,r,n,s,i){const a=this._o(i),o=[],l=Tk(n,s,a),c=Zu(t,r,a,l);if(a.fill)if(a.fillStyle==="solid"){const u=Zu(t,r,a,l).opset;u.type="fillPath",o.push(u)}else o.push(Es([c.estimatedPoints],a));return a.stroke!==ir&&o.push(c.opset),this._d("ellipse",o,a)}circle(t,r,n,s){const i=this.ellipse(t,r,n,n,s);return i.shape="circle",i}linearPath(t,r){const n=this._o(r);return this._d("linearPath",[mo(t,!1,n)],n)}arc(t,r,n,s,i,a,o=!1,l){const c=this._o(l),u=[],h=ip(t,r,n,s,i,a,o,!0,c);if(o&&c.fill)if(c.fillStyle==="solid"){const f=Object.assign({},c);f.disableMultiStroke=!0;const g=ip(t,r,n,s,i,a,!0,!1,f);g.type="fillPath",u.push(g)}else u.push((function(f,g,p,m,y,x,k){const C=f,T=g;let S=Math.abs(p/2),w=Math.abs(m/2);S+=Ce(.01*S,k),w+=Ce(.01*w,k);let _=y,O=x;for(;_<0;)_+=2*Math.PI,O+=2*Math.PI;O-_>2*Math.PI&&(_=0,O=2*Math.PI);const P=(O-_)/k.curveStepCount,v=[];for(let L=_;L<=O;L+=P)v.push([C+S*Math.cos(L),T+w*Math.sin(L)]);return v.push([C+S*Math.cos(O),T+w*Math.sin(O)]),v.push([C,T]),Es([v],k)})(t,r,n,s,i,a,c));return c.stroke!==ir&&u.push(h),this._d("arc",u,c)}curve(t,r){const n=this._o(r),s=[],i=sp(t,n);if(n.fill&&n.fill!==ir)if(n.fillStyle==="solid"){const a=sp(t,Object.assign(Object.assign({},n),{disableMultiStroke:!0,roughness:n.roughness?n.roughness+n.fillShapeRoughnessGain:0}));s.push({type:"fillPath",ops:this._mergedShape(a.ops)})}else{const a=[],o=t;if(o.length){const l=typeof o[0][0]=="number"?[o]:o;for(const c of l)c.length<3?a.push(...c):c.length===3?a.push(...Wc(up([c[0],c[0],c[1],c[2]]),10,(1+n.roughness)/2)):a.push(...Wc(up(c),10,(1+n.roughness)/2))}a.length&&s.push(Es([a],n))}return n.stroke!==ir&&s.push(i),this._d("curve",s,n)}polygon(t,r){const n=this._o(r),s=[],i=mo(t,!0,n);return n.fill&&(n.fillStyle==="solid"?s.push(zc([t],n)):s.push(Es([t],n))),n.stroke!==ir&&s.push(i),this._d("polygon",s,n)}path(t,r){const n=this._o(r),s=[];if(!t)return this._d("path",s,n);t=(t||"").replace(/\n/g," ").replace(/(-\s)/g,"-").replace("/(ss)/g"," ");const i=n.fill&&n.fill!=="transparent"&&n.fill!==ir,a=n.stroke!==ir,o=!!(n.simplification&&n.simplification<1),l=(function(u,h,f){const g=Ck(vk(Od(u))),p=[];let m=[],y=[0,0],x=[];const k=()=>{x.length>=4&&m.push(...Wc(x,h)),x=[]},C=()=>{k(),m.length&&(p.push(m),m=[])};for(const{key:S,data:w}of g)switch(S){case"M":C(),y=[w[0],w[1]],m.push(y);break;case"L":k(),m.push([w[0],w[1]]);break;case"C":if(!x.length){const _=m.length?m[m.length-1]:y;x.push([_[0],_[1]])}x.push([w[0],w[1]]),x.push([w[2],w[3]]),x.push([w[4],w[5]]);break;case"Z":k(),m.push([y[0],y[1]])}if(C(),!f)return p;const T=[];for(const S of p){const w=Y3(S,f);w.length&&T.push(w)}return T})(t,1,o?4-4*(n.simplification||1):(1+n.roughness)/2),c=ap(t,n);if(i)if(n.fillStyle==="solid")if(l.length===1){const u=ap(t,Object.assign(Object.assign({},n),{disableMultiStroke:!0,roughness:n.roughness?n.roughness+n.fillShapeRoughnessGain:0}));s.push({type:"fillPath",ops:this._mergedShape(u.ops)})}else s.push(zc(l,n));else s.push(Es(l,n));return a&&(o?l.forEach((u=>{s.push(mo(u,!1,n))})):s.push(c)),this._d("path",s,n)}opsToPath(t,r){let n="";for(const s of t.ops){const i=typeof r=="number"&&r>=0?s.data.map((a=>+a.toFixed(r))):s.data;switch(s.op){case"move":n+=`M${i[0]} ${i[1]} `;break;case"bcurveTo":n+=`C${i[0]} ${i[1]}, ${i[2]} ${i[3]}, ${i[4]} ${i[5]} `;break;case"lineTo":n+=`L${i[0]} ${i[1]} `}}return n.trim()}toPaths(t){const r=t.sets||[],n=t.options||this.defaultOptions,s=[];for(const i of r){let a=null;switch(i.type){case"path":a={d:this.opsToPath(i),stroke:n.stroke,strokeWidth:n.strokeWidth,fill:ir};break;case"fillPath":a={d:this.opsToPath(i),stroke:ir,strokeWidth:0,fill:n.fill||ir};break;case"fillSketch":a=this.fillSketch(i,n)}a&&s.push(a)}return s}fillSketch(t,r){let n=r.fillWeight;return n<0&&(n=r.strokeWidth/2),{d:this.opsToPath(t),stroke:r.fill||ir,strokeWidth:n,fill:ir}}_mergedShape(t){return t.filter(((r,n)=>n===0||r.op!=="move"))}}class X3{constructor(t,r){this.canvas=t,this.ctx=this.canvas.getContext("2d"),this.gen=new sl(r)}draw(t){const r=t.sets||[],n=t.options||this.getDefaultOptions(),s=this.ctx,i=t.options.fixedDecimalPlaceDigits;for(const a of r)switch(a.type){case"path":s.save(),s.strokeStyle=n.stroke==="none"?"transparent":n.stroke,s.lineWidth=n.strokeWidth,n.strokeLineDash&&s.setLineDash(n.strokeLineDash),n.strokeLineDashOffset&&(s.lineDashOffset=n.strokeLineDashOffset),this._drawToContext(s,a,i),s.restore();break;case"fillPath":{s.save(),s.fillStyle=n.fill||"";const o=t.shape==="curve"||t.shape==="polygon"||t.shape==="path"?"evenodd":"nonzero";this._drawToContext(s,a,i,o),s.restore();break}case"fillSketch":this.fillSketch(s,a,n)}}fillSketch(t,r,n){let s=n.fillWeight;s<0&&(s=n.strokeWidth/2),t.save(),n.fillLineDash&&t.setLineDash(n.fillLineDash),n.fillLineDashOffset&&(t.lineDashOffset=n.fillLineDashOffset),t.strokeStyle=n.fill||"",t.lineWidth=s,this._drawToContext(t,r,n.fixedDecimalPlaceDigits),t.restore()}_drawToContext(t,r,n,s="nonzero"){t.beginPath();for(const i of r.ops){const a=typeof n=="number"&&n>=0?i.data.map((o=>+o.toFixed(n))):i.data;switch(i.op){case"move":t.moveTo(a[0],a[1]);break;case"bcurveTo":t.bezierCurveTo(a[0],a[1],a[2],a[3],a[4],a[5]);break;case"lineTo":t.lineTo(a[0],a[1])}}r.type==="fillPath"?t.fill(s):t.stroke()}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}line(t,r,n,s,i){const a=this.gen.line(t,r,n,s,i);return this.draw(a),a}rectangle(t,r,n,s,i){const a=this.gen.rectangle(t,r,n,s,i);return this.draw(a),a}ellipse(t,r,n,s,i){const a=this.gen.ellipse(t,r,n,s,i);return this.draw(a),a}circle(t,r,n,s){const i=this.gen.circle(t,r,n,s);return this.draw(i),i}linearPath(t,r){const n=this.gen.linearPath(t,r);return this.draw(n),n}polygon(t,r){const n=this.gen.polygon(t,r);return this.draw(n),n}arc(t,r,n,s,i,a,o=!1,l){const c=this.gen.arc(t,r,n,s,i,a,o,l);return this.draw(c),c}curve(t,r){const n=this.gen.curve(t,r);return this.draw(n),n}path(t,r){const n=this.gen.path(t,r);return this.draw(n),n}}const Za="http://www.w3.org/2000/svg";class K3{constructor(t,r){this.svg=t,this.gen=new sl(r)}draw(t){const r=t.sets||[],n=t.options||this.getDefaultOptions(),s=this.svg.ownerDocument||window.document,i=s.createElementNS(Za,"g"),a=t.options.fixedDecimalPlaceDigits;for(const o of r){let l=null;switch(o.type){case"path":l=s.createElementNS(Za,"path"),l.setAttribute("d",this.opsToPath(o,a)),l.setAttribute("stroke",n.stroke),l.setAttribute("stroke-width",n.strokeWidth+""),l.setAttribute("fill","none"),n.strokeLineDash&&l.setAttribute("stroke-dasharray",n.strokeLineDash.join(" ").trim()),n.strokeLineDashOffset&&l.setAttribute("stroke-dashoffset",`${n.strokeLineDashOffset}`);break;case"fillPath":l=s.createElementNS(Za,"path"),l.setAttribute("d",this.opsToPath(o,a)),l.setAttribute("stroke","none"),l.setAttribute("stroke-width","0"),l.setAttribute("fill",n.fill||""),t.shape!=="curve"&&t.shape!=="polygon"||l.setAttribute("fill-rule","evenodd");break;case"fillSketch":l=this.fillSketch(s,o,n)}l&&i.appendChild(l)}return i}fillSketch(t,r,n){let s=n.fillWeight;s<0&&(s=n.strokeWidth/2);const i=t.createElementNS(Za,"path");return i.setAttribute("d",this.opsToPath(r,n.fixedDecimalPlaceDigits)),i.setAttribute("stroke",n.fill||""),i.setAttribute("stroke-width",s+""),i.setAttribute("fill","none"),n.fillLineDash&&i.setAttribute("stroke-dasharray",n.fillLineDash.join(" ").trim()),n.fillLineDashOffset&&i.setAttribute("stroke-dashoffset",`${n.fillLineDashOffset}`),i}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}opsToPath(t,r){return this.gen.opsToPath(t,r)}line(t,r,n,s,i){const a=this.gen.line(t,r,n,s,i);return this.draw(a)}rectangle(t,r,n,s,i){const a=this.gen.rectangle(t,r,n,s,i);return this.draw(a)}ellipse(t,r,n,s,i){const a=this.gen.ellipse(t,r,n,s,i);return this.draw(a)}circle(t,r,n,s){const i=this.gen.circle(t,r,n,s);return this.draw(i)}linearPath(t,r){const n=this.gen.linearPath(t,r);return this.draw(n)}polygon(t,r){const n=this.gen.polygon(t,r);return this.draw(n)}arc(t,r,n,s,i,a,o=!1,l){const c=this.gen.arc(t,r,n,s,i,a,o,l);return this.draw(c)}curve(t,r){const n=this.gen.curve(t,r);return this.draw(n)}path(t,r){const n=this.gen.path(t,r);return this.draw(n)}}var he={canvas:(e,t)=>new X3(e,t),svg:(e,t)=>new K3(e,t),generator:e=>new sl(e),newSeed:()=>sl.newSeed()},ve=b(async(e,t,r)=>{let n;const s=t.useHtmlLabels||_t(He()?.htmlLabels);r?n=r:n="node default";const i=e.insert("g").attr("class",n).attr("id",t.domId||t.id),a=i.insert("g").attr("class","label").attr("style",Bt(t.labelStyle));let o;t.label===void 0?o="":o=typeof t.label=="string"?t.label:t.label[0];const l=await $n(a,yr(ps(o),He()),{useHtmlLabels:s,width:t.width||He().flowchart?.wrappingWidth,cssClasses:"markdown-node-label",style:t.labelStyle,addSvgBackground:!!t.icon||!!t.img});let c=l.getBBox();const u=(t?.padding??0)/2;if(s){const h=l.children[0],f=Oe(l),g=h.getElementsByTagName("img");if(g){const p=o.replace(/<img[^>]*>/g,"").trim()==="";await Promise.all([...g].map(m=>new Promise(y=>{function x(){if(m.style.display="flex",m.style.flexDirection="column",p){const k=He().fontSize?He().fontSize:window.getComputedStyle(document.body).fontSize,C=5,[T=z0.fontSize]=Il(k),S=T*C+"px";m.style.minWidth=S,m.style.maxWidth=S}else m.style.width="100%";y(m)}b(x,"setupImage"),setTimeout(()=>{m.complete&&x()}),m.addEventListener("error",x),m.addEventListener("load",x)})))}c=h.getBoundingClientRect(),f.attr("width",c.width),f.attr("height",c.height)}return s?a.attr("transform","translate("+-c.width/2+", "+-c.height/2+")"):a.attr("transform","translate(0, "+-c.height/2+")"),t.centerLabel&&a.attr("transform","translate("+-c.width/2+", "+-c.height/2+")"),a.insert("rect",":first-child"),{shapeSvg:i,bbox:c,halfPadding:u,label:a}},"labelHelper"),Hc=b(async(e,t,r)=>{const n=r.useHtmlLabels||_t(He()?.flowchart?.htmlLabels),s=e.insert("g").attr("class","label").attr("style",r.labelStyle||""),i=await $n(s,yr(ps(t),He()),{useHtmlLabels:n,width:r.width||He()?.flowchart?.wrappingWidth,style:r.labelStyle,addSvgBackground:!!r.icon||!!r.img});let a=i.getBBox();const o=r.padding/2;if(_t(He()?.flowchart?.htmlLabels)){const l=i.children[0],c=Oe(i);a=l.getBoundingClientRect(),c.attr("width",a.width),c.attr("height",a.height)}return n?s.attr("transform","translate("+-a.width/2+", "+-a.height/2+")"):s.attr("transform","translate(0, "+-a.height/2+")"),r.centerLabel&&s.attr("transform","translate("+-a.width/2+", "+-a.height/2+")"),s.insert("rect",":first-child"),{shapeSvg:e,bbox:a,halfPadding:o,label:s}},"insertLabel"),pe=b((e,t)=>{const r=t.node().getBBox();e.width=r.width,e.height=r.height},"updateNodeBounds"),ke=b((e,t)=>(e.look==="handDrawn"?"rough-node":"node")+" "+e.cssClasses+" "+(t||""),"getNodeClasses");function Pe(e){const t=e.map((r,n)=>`${n===0?"M":"L"}${r.x},${r.y}`);return t.push("Z"),t.join(" ")}b(Pe,"createPathFromPoints");function jn(e,t,r,n,s,i){const a=[],l=r-e,c=n-t,u=l/i,h=2*Math.PI/u,f=t+c/2;for(let g=0;g<=50;g++){const p=g/50,m=e+p*l,y=f+s*Math.sin(h*(m-e));a.push({x:m,y})}return a}b(jn,"generateFullSineWavePoints");function da(e,t,r,n,s,i){const a=[],o=s*Math.PI/180,u=(i*Math.PI/180-o)/(n-1);for(let h=0;h<n;h++){const f=o+h*u,g=e+r*Math.cos(f),p=t+r*Math.sin(f);a.push({x:-g,y:-p})}return a}b(da,"generateCirclePoints");var Q3=b((e,t)=>{var r=e.x,n=e.y,s=t.x-r,i=t.y-n,a=e.width/2,o=e.height/2,l,c;return Math.abs(i)*a>Math.abs(s)*o?(i<0&&(o=-o),l=i===0?0:o*s/i,c=o):(s<0&&(a=-a),l=a,c=s===0?0:a*i/s),{x:r+l,y:n+c}},"intersectRect"),li=Q3;function Ek(e,t){t&&e.attr("style",t)}b(Ek,"applyStyle");async function Ak(e){const t=Oe(document.createElementNS("http://www.w3.org/2000/svg","foreignObject")),r=t.append("xhtml:div"),n=He();let s=e.label;e.label&&Xs(e.label)&&(s=await Gh(e.label.replace(si.lineBreakRegex,`
320
+ `),n));const a='<span class="'+(e.isNode?"nodeLabel":"edgeLabel")+'" '+(e.labelStyle?'style="'+e.labelStyle+'"':"")+">"+s+"</span>";return r.html(yr(a,n)),Ek(r,e.labelStyle),r.style("display","inline-block"),r.style("padding-right","1px"),r.style("white-space","nowrap"),r.attr("xmlns","http://www.w3.org/1999/xhtml"),t.node()}b(Ak,"addHtmlLabel");var Z3=b(async(e,t,r,n)=>{let s=e||"";if(typeof s=="object"&&(s=s[0]),_t(He().flowchart.htmlLabels)){s=s.replace(/\\n|\n/g,"<br />"),K.info("vertexText"+s);const i={isNode:n,label:ps(s).replace(/fa[blrs]?:fa-[\w-]+/g,o=>`<i class='${o.replace(":"," ")}'></i>`),labelStyle:t&&t.replace("fill:","color:")};return await Ak(i)}else{const i=document.createElementNS("http://www.w3.org/2000/svg","text");i.setAttribute("style",t.replace("color:","fill:"));let a=[];typeof s=="string"?a=s.split(/\\n|\n|<br\s*\/?>/gi):Array.isArray(s)?a=s:a=[];for(const o of a){const l=document.createElementNS("http://www.w3.org/2000/svg","tspan");l.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),l.setAttribute("dy","1em"),l.setAttribute("x","0"),r?l.setAttribute("class","title-row"):l.setAttribute("class","row"),l.textContent=o.trim(),i.appendChild(l)}return i}},"createLabel"),Zn=Z3,Dn=b((e,t,r,n,s)=>["M",e+s,t,"H",e+r-s,"A",s,s,0,0,1,e+r,t+s,"V",t+n-s,"A",s,s,0,0,1,e+r-s,t+n,"H",e+s,"A",s,s,0,0,1,e,t+n-s,"V",t+s,"A",s,s,0,0,1,e+s,t,"Z"].join(" "),"createRoundedRectPathD"),Mk=b(async(e,t)=>{K.info("Creating subgraph rect for ",t.id,t);const r=He(),{themeVariables:n,handDrawnSeed:s}=r,{clusterBkg:i,clusterBorder:a}=n,{labelStyles:o,nodeStyles:l,borderStyles:c,backgroundStyles:u}=ge(t),h=e.insert("g").attr("class","cluster "+t.cssClasses).attr("id",t.id).attr("data-look",t.look),f=_t(r.flowchart.htmlLabels),g=h.insert("g").attr("class","cluster-label "),p=await $n(g,t.label,{style:t.labelStyle,useHtmlLabels:f,isNode:!0});let m=p.getBBox();if(_t(r.flowchart.htmlLabels)){const _=p.children[0],O=Oe(p);m=_.getBoundingClientRect(),O.attr("width",m.width),O.attr("height",m.height)}const y=t.width<=m.width+t.padding?m.width+t.padding:t.width;t.width<=m.width+t.padding?t.diff=(y-t.width)/2-t.padding:t.diff=-t.padding;const x=t.height,k=t.x-y/2,C=t.y-x/2;K.trace("Data ",t,JSON.stringify(t));let T;if(t.look==="handDrawn"){const _=he.svg(h),O=fe(t,{roughness:.7,fill:i,stroke:a,fillWeight:3,seed:s}),P=_.path(Dn(k,C,y,x,0),O);T=h.insert(()=>(K.debug("Rough node insert CXC",P),P),":first-child"),T.select("path:nth-child(2)").attr("style",c.join(";")),T.select("path").attr("style",u.join(";").replace("fill","stroke"))}else T=h.insert("rect",":first-child"),T.attr("style",l).attr("rx",t.rx).attr("ry",t.ry).attr("x",k).attr("y",C).attr("width",y).attr("height",x);const{subGraphTitleTopMargin:S}=yd(r);if(g.attr("transform",`translate(${t.x-m.width/2}, ${t.y-t.height/2+S})`),o){const _=g.select("span");_&&_.attr("style",o)}const w=T.node().getBBox();return t.offsetX=0,t.width=w.width,t.height=w.height,t.offsetY=m.height-t.padding/2,t.intersect=function(_){return li(t,_)},{cluster:h,labelBBox:m}},"rect"),J3=b((e,t)=>{const r=e.insert("g").attr("class","note-cluster").attr("id",t.id),n=r.insert("rect",":first-child"),s=0*t.padding,i=s/2;n.attr("rx",t.rx).attr("ry",t.ry).attr("x",t.x-t.width/2-i).attr("y",t.y-t.height/2-i).attr("width",t.width+s).attr("height",t.height+s).attr("fill","none");const a=n.node().getBBox();return t.width=a.width,t.height=a.height,t.intersect=function(o){return li(t,o)},{cluster:r,labelBBox:{width:0,height:0}}},"noteGroup"),eB=b(async(e,t)=>{const r=He(),{themeVariables:n,handDrawnSeed:s}=r,{altBackground:i,compositeBackground:a,compositeTitleBackground:o,nodeBorder:l}=n,c=e.insert("g").attr("class",t.cssClasses).attr("id",t.id).attr("data-id",t.id).attr("data-look",t.look),u=c.insert("g",":first-child"),h=c.insert("g").attr("class","cluster-label");let f=c.append("rect");const g=h.node().appendChild(await Zn(t.label,t.labelStyle,void 0,!0));let p=g.getBBox();if(_t(r.flowchart.htmlLabels)){const P=g.children[0],v=Oe(g);p=P.getBoundingClientRect(),v.attr("width",p.width),v.attr("height",p.height)}const m=0*t.padding,y=m/2,x=(t.width<=p.width+t.padding?p.width+t.padding:t.width)+m;t.width<=p.width+t.padding?t.diff=(x-t.width)/2-t.padding:t.diff=-t.padding;const k=t.height+m,C=t.height+m-p.height-6,T=t.x-x/2,S=t.y-k/2;t.width=x;const w=t.y-t.height/2-y+p.height+2;let _;if(t.look==="handDrawn"){const P=t.cssClasses.includes("statediagram-cluster-alt"),v=he.svg(c),L=t.rx||t.ry?v.path(Dn(T,S,x,k,10),{roughness:.7,fill:o,fillStyle:"solid",stroke:l,seed:s}):v.rectangle(T,S,x,k,{seed:s});_=c.insert(()=>L,":first-child");const N=v.rectangle(T,w,x,C,{fill:P?i:a,fillStyle:P?"hachure":"solid",stroke:l,seed:s});_=c.insert(()=>L,":first-child"),f=c.insert(()=>N)}else _=u.insert("rect",":first-child"),_.attr("class","outer").attr("x",T).attr("y",S).attr("width",x).attr("height",k).attr("data-look",t.look),f.attr("class","inner").attr("x",T).attr("y",w).attr("width",x).attr("height",C);h.attr("transform",`translate(${t.x-p.width/2}, ${S+1-(_t(r.flowchart.htmlLabels)?0:3)})`);const O=_.node().getBBox();return t.height=O.height,t.offsetX=0,t.offsetY=p.height-t.padding/2,t.labelBBox=p,t.intersect=function(P){return li(t,P)},{cluster:c,labelBBox:p}},"roundedWithTitle"),tB=b(async(e,t)=>{K.info("Creating subgraph rect for ",t.id,t);const r=He(),{themeVariables:n,handDrawnSeed:s}=r,{clusterBkg:i,clusterBorder:a}=n,{labelStyles:o,nodeStyles:l,borderStyles:c,backgroundStyles:u}=ge(t),h=e.insert("g").attr("class","cluster "+t.cssClasses).attr("id",t.id).attr("data-look",t.look),f=_t(r.flowchart.htmlLabels),g=h.insert("g").attr("class","cluster-label "),p=await $n(g,t.label,{style:t.labelStyle,useHtmlLabels:f,isNode:!0,width:t.width});let m=p.getBBox();if(_t(r.flowchart.htmlLabels)){const _=p.children[0],O=Oe(p);m=_.getBoundingClientRect(),O.attr("width",m.width),O.attr("height",m.height)}const y=t.width<=m.width+t.padding?m.width+t.padding:t.width;t.width<=m.width+t.padding?t.diff=(y-t.width)/2-t.padding:t.diff=-t.padding;const x=t.height,k=t.x-y/2,C=t.y-x/2;K.trace("Data ",t,JSON.stringify(t));let T;if(t.look==="handDrawn"){const _=he.svg(h),O=fe(t,{roughness:.7,fill:i,stroke:a,fillWeight:4,seed:s}),P=_.path(Dn(k,C,y,x,t.rx),O);T=h.insert(()=>(K.debug("Rough node insert CXC",P),P),":first-child"),T.select("path:nth-child(2)").attr("style",c.join(";")),T.select("path").attr("style",u.join(";").replace("fill","stroke"))}else T=h.insert("rect",":first-child"),T.attr("style",l).attr("rx",t.rx).attr("ry",t.ry).attr("x",k).attr("y",C).attr("width",y).attr("height",x);const{subGraphTitleTopMargin:S}=yd(r);if(g.attr("transform",`translate(${t.x-m.width/2}, ${t.y-t.height/2+S})`),o){const _=g.select("span");_&&_.attr("style",o)}const w=T.node().getBBox();return t.offsetX=0,t.width=w.width,t.height=w.height,t.offsetY=m.height-t.padding/2,t.intersect=function(_){return li(t,_)},{cluster:h,labelBBox:m}},"kanbanSection"),rB=b((e,t)=>{const r=He(),{themeVariables:n,handDrawnSeed:s}=r,{nodeBorder:i}=n,a=e.insert("g").attr("class",t.cssClasses).attr("id",t.id).attr("data-look",t.look),o=a.insert("g",":first-child"),l=0*t.padding,c=t.width+l;t.diff=-t.padding;const u=t.height+l,h=t.x-c/2,f=t.y-u/2;t.width=c;let g;if(t.look==="handDrawn"){const y=he.svg(a).rectangle(h,f,c,u,{fill:"lightgrey",roughness:.5,strokeLineDash:[5],stroke:i,seed:s});g=a.insert(()=>y,":first-child")}else g=o.insert("rect",":first-child"),g.attr("class","divider").attr("x",h).attr("y",f).attr("width",c).attr("height",u).attr("data-look",t.look);const p=g.node().getBBox();return t.height=p.height,t.offsetX=0,t.offsetY=0,t.intersect=function(m){return li(t,m)},{cluster:a,labelBBox:{}}},"divider"),nB=Mk,sB={rect:Mk,squareRect:nB,roundedWithTitle:eB,noteGroup:J3,divider:rB,kanbanSection:tB},jk=new Map,iB=b(async(e,t)=>{const r=t.shape||"rect",n=await sB[r](e,t);return jk.set(t.id,n),n},"insertCluster"),W9=b(()=>{jk=new Map},"clear");function Ik(e,t){return e.intersect(t)}b(Ik,"intersectNode");var aB=Ik;function Lk(e,t,r,n){var s=e.x,i=e.y,a=s-n.x,o=i-n.y,l=Math.sqrt(t*t*o*o+r*r*a*a),c=Math.abs(t*r*a/l);n.x<s&&(c=-c);var u=Math.abs(t*r*o/l);return n.y<i&&(u=-u),{x:s+c,y:i+u}}b(Lk,"intersectEllipse");var $k=Lk;function Dk(e,t,r){return $k(e,t,t,r)}b(Dk,"intersectCircle");var oB=Dk;function Bk(e,t,r,n){{const s=t.y-e.y,i=e.x-t.x,a=t.x*e.y-e.x*t.y,o=s*r.x+i*r.y+a,l=s*n.x+i*n.y+a,c=1e-6;if(o!==0&&l!==0&&th(o,l))return;const u=n.y-r.y,h=r.x-n.x,f=n.x*r.y-r.x*n.y,g=u*e.x+h*e.y+f,p=u*t.x+h*t.y+f;if(Math.abs(g)<c&&Math.abs(p)<c&&th(g,p))return;const m=s*h-u*i;if(m===0)return;const y=Math.abs(m/2);let x=i*f-h*a;const k=x<0?(x-y)/m:(x+y)/m;x=u*a-s*f;const C=x<0?(x-y)/m:(x+y)/m;return{x:k,y:C}}}b(Bk,"intersectLine");function th(e,t){return e*t>0}b(th,"sameSign");var lB=Bk;function Rk(e,t,r){let n=e.x,s=e.y,i=[],a=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY;typeof t.forEach=="function"?t.forEach(function(u){a=Math.min(a,u.x),o=Math.min(o,u.y)}):(a=Math.min(a,t.x),o=Math.min(o,t.y));let l=n-e.width/2-a,c=s-e.height/2-o;for(let u=0;u<t.length;u++){let h=t[u],f=t[u<t.length-1?u+1:0],g=lB(e,r,{x:l+h.x,y:c+h.y},{x:l+f.x,y:c+f.y});g&&i.push(g)}return i.length?(i.length>1&&i.sort(function(u,h){let f=u.x-r.x,g=u.y-r.y,p=Math.sqrt(f*f+g*g),m=h.x-r.x,y=h.y-r.y,x=Math.sqrt(m*m+y*y);return p<x?-1:p===x?0:1}),i[0]):e}b(Rk,"intersectPolygon");var cB=Rk,ie={node:aB,circle:oB,ellipse:$k,polygon:cB,rect:li};function Pk(e,t){const{labelStyles:r}=ge(t);t.labelStyle=r;const n=ke(t);let s=n;n||(s="anchor");const i=e.insert("g").attr("class",s).attr("id",t.domId||t.id),a=1,{cssStyles:o}=t,l=he.svg(i),c=fe(t,{fill:"black",stroke:"none",fillStyle:"solid"});t.look!=="handDrawn"&&(c.roughness=0);const u=l.circle(0,0,a*2,c),h=i.insert(()=>u,":first-child");return h.attr("class","anchor").attr("style",Bt(o)),pe(t,h),t.intersect=function(f){return K.info("Circle intersect",t,a,f),ie.circle(t,a,f)},i}b(Pk,"anchor");function rh(e,t,r,n,s,i,a){const l=(e+r)/2,c=(t+n)/2,u=Math.atan2(n-t,r-e),h=(r-e)/2,f=(n-t)/2,g=h/s,p=f/i,m=Math.sqrt(g**2+p**2);if(m>1)throw new Error("The given radii are too small to create an arc between the points.");const y=Math.sqrt(1-m**2),x=l+y*i*Math.sin(u)*(a?-1:1),k=c-y*s*Math.cos(u)*(a?-1:1),C=Math.atan2((t-k)/i,(e-x)/s);let S=Math.atan2((n-k)/i,(r-x)/s)-C;a&&S<0&&(S+=2*Math.PI),!a&&S>0&&(S-=2*Math.PI);const w=[];for(let _=0;_<20;_++){const O=_/19,P=C+O*S,v=x+s*Math.cos(P),L=k+i*Math.sin(P);w.push({x:v,y:L})}return w}b(rh,"generateArcPoints");async function Fk(e,t){const{labelStyles:r,nodeStyles:n}=ge(t);t.labelStyle=r;const{shapeSvg:s,bbox:i}=await ve(e,t,ke(t)),a=i.width+t.padding+20,o=i.height+t.padding,l=o/2,c=l/(2.5+o/50),{cssStyles:u}=t,h=[{x:a/2,y:-o/2},{x:-a/2,y:-o/2},...rh(-a/2,-o/2,-a/2,o/2,c,l,!1),{x:a/2,y:o/2},...rh(a/2,o/2,a/2,-o/2,c,l,!0)],f=he.svg(s),g=fe(t,{});t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const p=Pe(h),m=f.path(p,g),y=s.insert(()=>m,":first-child");return y.attr("class","basic label-container"),u&&t.look!=="handDrawn"&&y.selectAll("path").attr("style",u),n&&t.look!=="handDrawn"&&y.selectAll("path").attr("style",n),y.attr("transform",`translate(${c/2}, 0)`),pe(t,y),t.intersect=function(x){return ie.polygon(t,h,x)},s}b(Fk,"bowTieRect");function Bn(e,t,r,n){return e.insert("polygon",":first-child").attr("points",n.map(function(s){return s.x+","+s.y}).join(" ")).attr("class","label-container").attr("transform","translate("+-t/2+","+r/2+")")}b(Bn,"insertPolygonShape");async function Ok(e,t){const{labelStyles:r,nodeStyles:n}=ge(t);t.labelStyle=r;const{shapeSvg:s,bbox:i}=await ve(e,t,ke(t)),a=i.height+t.padding,o=12,l=i.width+t.padding+o,c=0,u=l,h=-a,f=0,g=[{x:c+o,y:h},{x:u,y:h},{x:u,y:f},{x:c,y:f},{x:c,y:h+o},{x:c+o,y:h}];let p;const{cssStyles:m}=t;if(t.look==="handDrawn"){const y=he.svg(s),x=fe(t,{}),k=Pe(g),C=y.path(k,x);p=s.insert(()=>C,":first-child").attr("transform",`translate(${-l/2}, ${a/2})`),m&&p.attr("style",m)}else p=Bn(s,l,a,g);return n&&p.attr("style",n),pe(t,p),t.intersect=function(y){return ie.polygon(t,g,y)},s}b(Ok,"card");function zk(e,t){const{nodeStyles:r}=ge(t);t.label="";const n=e.insert("g").attr("class",ke(t)).attr("id",t.domId??t.id),{cssStyles:s}=t,i=Math.max(28,t.width??0),a=[{x:0,y:i/2},{x:i/2,y:0},{x:0,y:-i/2},{x:-i/2,y:0}],o=he.svg(n),l=fe(t,{});t.look!=="handDrawn"&&(l.roughness=0,l.fillStyle="solid");const c=Pe(a),u=o.path(c,l),h=n.insert(()=>u,":first-child");return s&&t.look!=="handDrawn"&&h.selectAll("path").attr("style",s),r&&t.look!=="handDrawn"&&h.selectAll("path").attr("style",r),t.width=28,t.height=28,t.intersect=function(f){return ie.polygon(t,a,f)},n}b(zk,"choice");async function zd(e,t,r){const{labelStyles:n,nodeStyles:s}=ge(t);t.labelStyle=n;const{shapeSvg:i,bbox:a,halfPadding:o}=await ve(e,t,ke(t)),l=r?.padding??o,c=a.width/2+l;let u;const{cssStyles:h}=t;if(t.look==="handDrawn"){const f=he.svg(i),g=fe(t,{}),p=f.circle(0,0,c*2,g);u=i.insert(()=>p,":first-child"),u.attr("class","basic label-container").attr("style",Bt(h))}else u=i.insert("circle",":first-child").attr("class","basic label-container").attr("style",s).attr("r",c).attr("cx",0).attr("cy",0);return pe(t,u),t.calcIntersect=function(f,g){const p=f.width/2;return ie.circle(f,p,g)},t.intersect=function(f){return K.info("Circle intersect",t,c,f),ie.circle(t,c,f)},i}b(zd,"circle");function Wk(e){const t=Math.cos(Math.PI/4),r=Math.sin(Math.PI/4),n=e*2,s={x:n/2*t,y:n/2*r},i={x:-(n/2)*t,y:n/2*r},a={x:-(n/2)*t,y:-(n/2)*r},o={x:n/2*t,y:-(n/2)*r};return`M ${i.x},${i.y} L ${o.x},${o.y}
321
+ M ${s.x},${s.y} L ${a.x},${a.y}`}b(Wk,"createLine");function Hk(e,t){const{labelStyles:r,nodeStyles:n}=ge(t);t.labelStyle=r,t.label="";const s=e.insert("g").attr("class",ke(t)).attr("id",t.domId??t.id),i=Math.max(30,t?.width??0),{cssStyles:a}=t,o=he.svg(s),l=fe(t,{});t.look!=="handDrawn"&&(l.roughness=0,l.fillStyle="solid");const c=o.circle(0,0,i*2,l),u=Wk(i),h=o.path(u,l),f=s.insert(()=>c,":first-child");return f.insert(()=>h),a&&t.look!=="handDrawn"&&f.selectAll("path").attr("style",a),n&&t.look!=="handDrawn"&&f.selectAll("path").attr("style",n),pe(t,f),t.intersect=function(g){return K.info("crossedCircle intersect",t,{radius:i,point:g}),ie.circle(t,i,g)},s}b(Hk,"crossedCircle");function rn(e,t,r,n=100,s=0,i=180){const a=[],o=s*Math.PI/180,u=(i*Math.PI/180-o)/(n-1);for(let h=0;h<n;h++){const f=o+h*u,g=e+r*Math.cos(f),p=t+r*Math.sin(f);a.push({x:-g,y:-p})}return a}b(rn,"generateCirclePoints");async function qk(e,t){const{labelStyles:r,nodeStyles:n}=ge(t);t.labelStyle=r;const{shapeSvg:s,bbox:i,label:a}=await ve(e,t,ke(t)),o=i.width+(t.padding??0),l=i.height+(t.padding??0),c=Math.max(5,l*.1),{cssStyles:u}=t,h=[...rn(o/2,-l/2,c,30,-90,0),{x:-o/2-c,y:c},...rn(o/2+c*2,-c,c,20,-180,-270),...rn(o/2+c*2,c,c,20,-90,-180),{x:-o/2-c,y:-l/2},...rn(o/2,l/2,c,20,0,90)],f=[{x:o/2,y:-l/2-c},{x:-o/2,y:-l/2-c},...rn(o/2,-l/2,c,20,-90,0),{x:-o/2-c,y:-c},...rn(o/2+o*.1,-c,c,20,-180,-270),...rn(o/2+o*.1,c,c,20,-90,-180),{x:-o/2-c,y:l/2},...rn(o/2,l/2,c,20,0,90),{x:-o/2,y:l/2+c},{x:o/2,y:l/2+c}],g=he.svg(s),p=fe(t,{fill:"none"});t.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");const y=Pe(h).replace("Z",""),x=g.path(y,p),k=Pe(f),C=g.path(k,{...p}),T=s.insert("g",":first-child");return T.insert(()=>C,":first-child").attr("stroke-opacity",0),T.insert(()=>x,":first-child"),T.attr("class","text"),u&&t.look!=="handDrawn"&&T.selectAll("path").attr("style",u),n&&t.look!=="handDrawn"&&T.selectAll("path").attr("style",n),T.attr("transform",`translate(${c}, 0)`),a.attr("transform",`translate(${-o/2+c-(i.x-(i.left??0))},${-l/2+(t.padding??0)/2-(i.y-(i.top??0))})`),pe(t,T),t.intersect=function(S){return ie.polygon(t,f,S)},s}b(qk,"curlyBraceLeft");function nn(e,t,r,n=100,s=0,i=180){const a=[],o=s*Math.PI/180,u=(i*Math.PI/180-o)/(n-1);for(let h=0;h<n;h++){const f=o+h*u,g=e+r*Math.cos(f),p=t+r*Math.sin(f);a.push({x:g,y:p})}return a}b(nn,"generateCirclePoints");async function Uk(e,t){const{labelStyles:r,nodeStyles:n}=ge(t);t.labelStyle=r;const{shapeSvg:s,bbox:i,label:a}=await ve(e,t,ke(t)),o=i.width+(t.padding??0),l=i.height+(t.padding??0),c=Math.max(5,l*.1),{cssStyles:u}=t,h=[...nn(o/2,-l/2,c,20,-90,0),{x:o/2+c,y:-c},...nn(o/2+c*2,-c,c,20,-180,-270),...nn(o/2+c*2,c,c,20,-90,-180),{x:o/2+c,y:l/2},...nn(o/2,l/2,c,20,0,90)],f=[{x:-o/2,y:-l/2-c},{x:o/2,y:-l/2-c},...nn(o/2,-l/2,c,20,-90,0),{x:o/2+c,y:-c},...nn(o/2+c*2,-c,c,20,-180,-270),...nn(o/2+c*2,c,c,20,-90,-180),{x:o/2+c,y:l/2},...nn(o/2,l/2,c,20,0,90),{x:o/2,y:l/2+c},{x:-o/2,y:l/2+c}],g=he.svg(s),p=fe(t,{fill:"none"});t.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");const y=Pe(h).replace("Z",""),x=g.path(y,p),k=Pe(f),C=g.path(k,{...p}),T=s.insert("g",":first-child");return T.insert(()=>C,":first-child").attr("stroke-opacity",0),T.insert(()=>x,":first-child"),T.attr("class","text"),u&&t.look!=="handDrawn"&&T.selectAll("path").attr("style",u),n&&t.look!=="handDrawn"&&T.selectAll("path").attr("style",n),T.attr("transform",`translate(${-c}, 0)`),a.attr("transform",`translate(${-o/2+(t.padding??0)/2-(i.x-(i.left??0))},${-l/2+(t.padding??0)/2-(i.y-(i.top??0))})`),pe(t,T),t.intersect=function(S){return ie.polygon(t,f,S)},s}b(Uk,"curlyBraceRight");function Nt(e,t,r,n=100,s=0,i=180){const a=[],o=s*Math.PI/180,u=(i*Math.PI/180-o)/(n-1);for(let h=0;h<n;h++){const f=o+h*u,g=e+r*Math.cos(f),p=t+r*Math.sin(f);a.push({x:-g,y:-p})}return a}b(Nt,"generateCirclePoints");async function Vk(e,t){const{labelStyles:r,nodeStyles:n}=ge(t);t.labelStyle=r;const{shapeSvg:s,bbox:i,label:a}=await ve(e,t,ke(t)),o=i.width+(t.padding??0),l=i.height+(t.padding??0),c=Math.max(5,l*.1),{cssStyles:u}=t,h=[...Nt(o/2,-l/2,c,30,-90,0),{x:-o/2-c,y:c},...Nt(o/2+c*2,-c,c,20,-180,-270),...Nt(o/2+c*2,c,c,20,-90,-180),{x:-o/2-c,y:-l/2},...Nt(o/2,l/2,c,20,0,90)],f=[...Nt(-o/2+c+c/2,-l/2,c,20,-90,-180),{x:o/2-c/2,y:c},...Nt(-o/2-c/2,-c,c,20,0,90),...Nt(-o/2-c/2,c,c,20,-90,0),{x:o/2-c/2,y:-c},...Nt(-o/2+c+c/2,l/2,c,30,-180,-270)],g=[{x:o/2,y:-l/2-c},{x:-o/2,y:-l/2-c},...Nt(o/2,-l/2,c,20,-90,0),{x:-o/2-c,y:-c},...Nt(o/2+c*2,-c,c,20,-180,-270),...Nt(o/2+c*2,c,c,20,-90,-180),{x:-o/2-c,y:l/2},...Nt(o/2,l/2,c,20,0,90),{x:-o/2,y:l/2+c},{x:o/2-c-c/2,y:l/2+c},...Nt(-o/2+c+c/2,-l/2,c,20,-90,-180),{x:o/2-c/2,y:c},...Nt(-o/2-c/2,-c,c,20,0,90),...Nt(-o/2-c/2,c,c,20,-90,0),{x:o/2-c/2,y:-c},...Nt(-o/2+c+c/2,l/2,c,30,-180,-270)],p=he.svg(s),m=fe(t,{fill:"none"});t.look!=="handDrawn"&&(m.roughness=0,m.fillStyle="solid");const x=Pe(h).replace("Z",""),k=p.path(x,m),T=Pe(f).replace("Z",""),S=p.path(T,m),w=Pe(g),_=p.path(w,{...m}),O=s.insert("g",":first-child");return O.insert(()=>_,":first-child").attr("stroke-opacity",0),O.insert(()=>k,":first-child"),O.insert(()=>S,":first-child"),O.attr("class","text"),u&&t.look!=="handDrawn"&&O.selectAll("path").attr("style",u),n&&t.look!=="handDrawn"&&O.selectAll("path").attr("style",n),O.attr("transform",`translate(${c-c/4}, 0)`),a.attr("transform",`translate(${-o/2+(t.padding??0)/2-(i.x-(i.left??0))},${-l/2+(t.padding??0)/2-(i.y-(i.top??0))})`),pe(t,O),t.intersect=function(P){return ie.polygon(t,g,P)},s}b(Vk,"curlyBraces");async function Gk(e,t){const{labelStyles:r,nodeStyles:n}=ge(t);t.labelStyle=r;const{shapeSvg:s,bbox:i}=await ve(e,t,ke(t)),a=80,o=20,l=Math.max(a,(i.width+(t.padding??0)*2)*1.25,t?.width??0),c=Math.max(o,i.height+(t.padding??0)*2,t?.height??0),u=c/2,{cssStyles:h}=t,f=he.svg(s),g=fe(t,{});t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const p=l,m=c,y=p-u,x=m/4,k=[{x:y,y:0},{x,y:0},{x:0,y:m/2},{x,y:m},{x:y,y:m},...da(-y,-m/2,u,50,270,90)],C=Pe(k),T=f.path(C,g),S=s.insert(()=>T,":first-child");return S.attr("class","basic label-container"),h&&t.look!=="handDrawn"&&S.selectChildren("path").attr("style",h),n&&t.look!=="handDrawn"&&S.selectChildren("path").attr("style",n),S.attr("transform",`translate(${-l/2}, ${-c/2})`),pe(t,S),t.intersect=function(w){return ie.polygon(t,k,w)},s}b(Gk,"curvedTrapezoid");var uB=b((e,t,r,n,s,i)=>[`M${e},${t+i}`,`a${s},${i} 0,0,0 ${r},0`,`a${s},${i} 0,0,0 ${-r},0`,`l0,${n}`,`a${s},${i} 0,0,0 ${r},0`,`l0,${-n}`].join(" "),"createCylinderPathD"),hB=b((e,t,r,n,s,i)=>[`M${e},${t+i}`,`M${e+r},${t+i}`,`a${s},${i} 0,0,0 ${-r},0`,`l0,${n}`,`a${s},${i} 0,0,0 ${r},0`,`l0,${-n}`].join(" "),"createOuterCylinderPathD"),dB=b((e,t,r,n,s,i)=>[`M${e-r/2},${-n/2}`,`a${s},${i} 0,0,0 ${r},0`].join(" "),"createInnerCylinderPathD");async function Yk(e,t){const{labelStyles:r,nodeStyles:n}=ge(t);t.labelStyle=r;const{shapeSvg:s,bbox:i,label:a}=await ve(e,t,ke(t)),o=Math.max(i.width+t.padding,t.width??0),l=o/2,c=l/(2.5+o/50),u=Math.max(i.height+c+t.padding,t.height??0);let h;const{cssStyles:f}=t;if(t.look==="handDrawn"){const g=he.svg(s),p=hB(0,0,o,u,l,c),m=dB(0,c,o,u,l,c),y=g.path(p,fe(t,{})),x=g.path(m,fe(t,{fill:"none"}));h=s.insert(()=>x,":first-child"),h=s.insert(()=>y,":first-child"),h.attr("class","basic label-container"),f&&h.attr("style",f)}else{const g=uB(0,0,o,u,l,c);h=s.insert("path",":first-child").attr("d",g).attr("class","basic label-container").attr("style",Bt(f)).attr("style",n)}return h.attr("label-offset-y",c),h.attr("transform",`translate(${-o/2}, ${-(u/2+c)})`),pe(t,h),a.attr("transform",`translate(${-(i.width/2)-(i.x-(i.left??0))}, ${-(i.height/2)+(t.padding??0)/1.5-(i.y-(i.top??0))})`),t.intersect=function(g){const p=ie.rect(t,g),m=p.x-(t.x??0);if(l!=0&&(Math.abs(m)<(t.width??0)/2||Math.abs(m)==(t.width??0)/2&&Math.abs(p.y-(t.y??0))>(t.height??0)/2-c)){let y=c*c*(1-m*m/(l*l));y>0&&(y=Math.sqrt(y)),y=c-y,g.y-(t.y??0)>0&&(y=-y),p.y+=y}return p},s}b(Yk,"cylinder");async function Xk(e,t){const{labelStyles:r,nodeStyles:n}=ge(t);t.labelStyle=r;const{shapeSvg:s,bbox:i,label:a}=await ve(e,t,ke(t)),o=i.width+t.padding,l=i.height+t.padding,c=l*.2,u=-o/2,h=-l/2-c/2,{cssStyles:f}=t,g=he.svg(s),p=fe(t,{});t.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");const m=[{x:u,y:h+c},{x:-u,y:h+c},{x:-u,y:-h},{x:u,y:-h},{x:u,y:h},{x:-u,y:h},{x:-u,y:h+c}],y=g.polygon(m.map(k=>[k.x,k.y]),p),x=s.insert(()=>y,":first-child");return x.attr("class","basic label-container"),f&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",f),n&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",n),a.attr("transform",`translate(${u+(t.padding??0)/2-(i.x-(i.left??0))}, ${h+c+(t.padding??0)/2-(i.y-(i.top??0))})`),pe(t,x),t.intersect=function(k){return ie.rect(t,k)},s}b(Xk,"dividedRectangle");async function Kk(e,t){const{labelStyles:r,nodeStyles:n}=ge(t);t.labelStyle=r;const{shapeSvg:s,bbox:i,halfPadding:a}=await ve(e,t,ke(t)),l=i.width/2+a+5,c=i.width/2+a;let u;const{cssStyles:h}=t;if(t.look==="handDrawn"){const f=he.svg(s),g=fe(t,{roughness:.2,strokeWidth:2.5}),p=fe(t,{roughness:.2,strokeWidth:1.5}),m=f.circle(0,0,l*2,g),y=f.circle(0,0,c*2,p);u=s.insert("g",":first-child"),u.attr("class",Bt(t.cssClasses)).attr("style",Bt(h)),u.node()?.appendChild(m),u.node()?.appendChild(y)}else{u=s.insert("g",":first-child");const f=u.insert("circle",":first-child"),g=u.insert("circle");u.attr("class","basic label-container").attr("style",n),f.attr("class","outer-circle").attr("style",n).attr("r",l).attr("cx",0).attr("cy",0),g.attr("class","inner-circle").attr("style",n).attr("r",c).attr("cx",0).attr("cy",0)}return pe(t,u),t.intersect=function(f){return K.info("DoubleCircle intersect",t,l,f),ie.circle(t,l,f)},s}b(Kk,"doublecircle");function Qk(e,t,{config:{themeVariables:r}}){const{labelStyles:n,nodeStyles:s}=ge(t);t.label="",t.labelStyle=n;const i=e.insert("g").attr("class",ke(t)).attr("id",t.domId??t.id),a=7,{cssStyles:o}=t,l=he.svg(i),{nodeBorder:c}=r,u=fe(t,{fillStyle:"solid"});t.look!=="handDrawn"&&(u.roughness=0);const h=l.circle(0,0,a*2,u),f=i.insert(()=>h,":first-child");return f.selectAll("path").attr("style",`fill: ${c} !important;`),o&&o.length>0&&t.look!=="handDrawn"&&f.selectAll("path").attr("style",o),s&&t.look!=="handDrawn"&&f.selectAll("path").attr("style",s),pe(t,f),t.intersect=function(g){return K.info("filledCircle intersect",t,{radius:a,point:g}),ie.circle(t,a,g)},i}b(Qk,"filledCircle");async function Zk(e,t){const{labelStyles:r,nodeStyles:n}=ge(t);t.labelStyle=r;const{shapeSvg:s,bbox:i,label:a}=await ve(e,t,ke(t)),o=i.width+(t.padding??0),l=o+i.height,c=o+i.height,u=[{x:0,y:-l},{x:c,y:-l},{x:c/2,y:0}],{cssStyles:h}=t,f=he.svg(s),g=fe(t,{});t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const p=Pe(u),m=f.path(p,g),y=s.insert(()=>m,":first-child").attr("transform",`translate(${-l/2}, ${l/2})`);return h&&t.look!=="handDrawn"&&y.selectChildren("path").attr("style",h),n&&t.look!=="handDrawn"&&y.selectChildren("path").attr("style",n),t.width=o,t.height=l,pe(t,y),a.attr("transform",`translate(${-i.width/2-(i.x-(i.left??0))}, ${-l/2+(t.padding??0)/2+(i.y-(i.top??0))})`),t.intersect=function(x){return K.info("Triangle intersect",t,u,x),ie.polygon(t,u,x)},s}b(Zk,"flippedTriangle");function Jk(e,t,{dir:r,config:{state:n,themeVariables:s}}){const{nodeStyles:i}=ge(t);t.label="";const a=e.insert("g").attr("class",ke(t)).attr("id",t.domId??t.id),{cssStyles:o}=t;let l=Math.max(70,t?.width??0),c=Math.max(10,t?.height??0);r==="LR"&&(l=Math.max(10,t?.width??0),c=Math.max(70,t?.height??0));const u=-1*l/2,h=-1*c/2,f=he.svg(a),g=fe(t,{stroke:s.lineColor,fill:s.lineColor});t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const p=f.rectangle(u,h,l,c,g),m=a.insert(()=>p,":first-child");o&&t.look!=="handDrawn"&&m.selectAll("path").attr("style",o),i&&t.look!=="handDrawn"&&m.selectAll("path").attr("style",i),pe(t,m);const y=n?.padding??0;return t.width&&t.height&&(t.width+=y/2||0,t.height+=y/2||0),t.intersect=function(x){return ie.rect(t,x)},a}b(Jk,"forkJoin");async function ew(e,t){const{labelStyles:r,nodeStyles:n}=ge(t);t.labelStyle=r;const s=80,i=50,{shapeSvg:a,bbox:o}=await ve(e,t,ke(t)),l=Math.max(s,o.width+(t.padding??0)*2,t?.width??0),c=Math.max(i,o.height+(t.padding??0)*2,t?.height??0),u=c/2,{cssStyles:h}=t,f=he.svg(a),g=fe(t,{});t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const p=[{x:-l/2,y:-c/2},{x:l/2-u,y:-c/2},...da(-l/2+u,0,u,50,90,270),{x:l/2-u,y:c/2},{x:-l/2,y:c/2}],m=Pe(p),y=f.path(m,g),x=a.insert(()=>y,":first-child");return x.attr("class","basic label-container"),h&&t.look!=="handDrawn"&&x.selectChildren("path").attr("style",h),n&&t.look!=="handDrawn"&&x.selectChildren("path").attr("style",n),pe(t,x),t.intersect=function(k){return K.info("Pill intersect",t,{radius:u,point:k}),ie.polygon(t,p,k)},a}b(ew,"halfRoundedRectangle");async function tw(e,t){const{labelStyles:r,nodeStyles:n}=ge(t);t.labelStyle=r;const{shapeSvg:s,bbox:i}=await ve(e,t,ke(t)),a=i.height+(t.padding??0),o=i.width+(t.padding??0)*2.5,{cssStyles:l}=t,c=he.svg(s),u=fe(t,{});t.look!=="handDrawn"&&(u.roughness=0,u.fillStyle="solid");let h=o/2;const f=h/6;h=h+f;const g=a/2,p=g/2,m=h-p,y=[{x:-m,y:-g},{x:0,y:-g},{x:m,y:-g},{x:h,y:0},{x:m,y:g},{x:0,y:g},{x:-m,y:g},{x:-h,y:0}],x=Pe(y),k=c.path(x,u),C=s.insert(()=>k,":first-child");return C.attr("class","basic label-container"),l&&t.look!=="handDrawn"&&C.selectChildren("path").attr("style",l),n&&t.look!=="handDrawn"&&C.selectChildren("path").attr("style",n),t.width=o,t.height=a,pe(t,C),t.intersect=function(T){return ie.polygon(t,y,T)},s}b(tw,"hexagon");async function rw(e,t){const{labelStyles:r,nodeStyles:n}=ge(t);t.label="",t.labelStyle=r;const{shapeSvg:s}=await ve(e,t,ke(t)),i=Math.max(30,t?.width??0),a=Math.max(30,t?.height??0),{cssStyles:o}=t,l=he.svg(s),c=fe(t,{});t.look!=="handDrawn"&&(c.roughness=0,c.fillStyle="solid");const u=[{x:0,y:0},{x:i,y:0},{x:0,y:a},{x:i,y:a}],h=Pe(u),f=l.path(h,c),g=s.insert(()=>f,":first-child");return g.attr("class","basic label-container"),o&&t.look!=="handDrawn"&&g.selectChildren("path").attr("style",o),n&&t.look!=="handDrawn"&&g.selectChildren("path").attr("style",n),g.attr("transform",`translate(${-i/2}, ${-a/2})`),pe(t,g),t.intersect=function(p){return K.info("Pill intersect",t,{points:u}),ie.polygon(t,u,p)},s}b(rw,"hourglass");async function nw(e,t,{config:{themeVariables:r,flowchart:n}}){const{labelStyles:s}=ge(t);t.labelStyle=s;const i=t.assetHeight??48,a=t.assetWidth??48,o=Math.max(i,a),l=n?.wrappingWidth;t.width=Math.max(o,l??0);const{shapeSvg:c,bbox:u,label:h}=await ve(e,t,"icon-shape default"),f=t.pos==="t",g=o,p=o,{nodeBorder:m}=r,{stylesMap:y}=ii(t),x=-p/2,k=-g/2,C=t.label?8:0,T=he.svg(c),S=fe(t,{stroke:"none",fill:"none"});t.look!=="handDrawn"&&(S.roughness=0,S.fillStyle="solid");const w=T.rectangle(x,k,p,g,S),_=Math.max(p,u.width),O=g+u.height+C,P=T.rectangle(-_/2,-O/2,_,O,{...S,fill:"transparent",stroke:"none"}),v=c.insert(()=>w,":first-child"),L=c.insert(()=>P);if(t.icon){const N=c.append("g");N.html(`<g>${await Na(t.icon,{height:o,width:o,fallbackPrefix:""})}</g>`);const R=N.node().getBBox(),j=R.width,B=R.height,I=R.x,F=R.y;N.attr("transform",`translate(${-j/2-I},${f?u.height/2+C/2-B/2-F:-u.height/2-C/2-B/2-F})`),N.attr("style",`color: ${y.get("stroke")??m};`)}return h.attr("transform",`translate(${-u.width/2-(u.x-(u.left??0))},${f?-O/2:O/2-u.height})`),v.attr("transform",`translate(0,${f?u.height/2+C/2:-u.height/2-C/2})`),pe(t,L),t.intersect=function(N){if(K.info("iconSquare intersect",t,N),!t.label)return ie.rect(t,N);const R=t.x??0,j=t.y??0,B=t.height??0;let I=[];return f?I=[{x:R-u.width/2,y:j-B/2},{x:R+u.width/2,y:j-B/2},{x:R+u.width/2,y:j-B/2+u.height+C},{x:R+p/2,y:j-B/2+u.height+C},{x:R+p/2,y:j+B/2},{x:R-p/2,y:j+B/2},{x:R-p/2,y:j-B/2+u.height+C},{x:R-u.width/2,y:j-B/2+u.height+C}]:I=[{x:R-p/2,y:j-B/2},{x:R+p/2,y:j-B/2},{x:R+p/2,y:j-B/2+g},{x:R+u.width/2,y:j-B/2+g},{x:R+u.width/2/2,y:j+B/2},{x:R-u.width/2,y:j+B/2},{x:R-u.width/2,y:j-B/2+g},{x:R-p/2,y:j-B/2+g}],ie.polygon(t,I,N)},c}b(nw,"icon");async function sw(e,t,{config:{themeVariables:r,flowchart:n}}){const{labelStyles:s}=ge(t);t.labelStyle=s;const i=t.assetHeight??48,a=t.assetWidth??48,o=Math.max(i,a),l=n?.wrappingWidth;t.width=Math.max(o,l??0);const{shapeSvg:c,bbox:u,label:h}=await ve(e,t,"icon-shape default"),f=20,g=t.label?8:0,p=t.pos==="t",{nodeBorder:m,mainBkg:y}=r,{stylesMap:x}=ii(t),k=he.svg(c),C=fe(t,{});t.look!=="handDrawn"&&(C.roughness=0,C.fillStyle="solid");const T=x.get("fill");C.stroke=T??y;const S=c.append("g");t.icon&&S.html(`<g>${await Na(t.icon,{height:o,width:o,fallbackPrefix:""})}</g>`);const w=S.node().getBBox(),_=w.width,O=w.height,P=w.x,v=w.y,L=Math.max(_,O)*Math.SQRT2+f*2,N=k.circle(0,0,L,C),R=Math.max(L,u.width),j=L+u.height+g,B=k.rectangle(-R/2,-j/2,R,j,{...C,fill:"transparent",stroke:"none"}),I=c.insert(()=>N,":first-child"),F=c.insert(()=>B);return S.attr("transform",`translate(${-_/2-P},${p?u.height/2+g/2-O/2-v:-u.height/2-g/2-O/2-v})`),S.attr("style",`color: ${x.get("stroke")??m};`),h.attr("transform",`translate(${-u.width/2-(u.x-(u.left??0))},${p?-j/2:j/2-u.height})`),I.attr("transform",`translate(0,${p?u.height/2+g/2:-u.height/2-g/2})`),pe(t,F),t.intersect=function(W){return K.info("iconSquare intersect",t,W),ie.rect(t,W)},c}b(sw,"iconCircle");async function iw(e,t,{config:{themeVariables:r,flowchart:n}}){const{labelStyles:s}=ge(t);t.labelStyle=s;const i=t.assetHeight??48,a=t.assetWidth??48,o=Math.max(i,a),l=n?.wrappingWidth;t.width=Math.max(o,l??0);const{shapeSvg:c,bbox:u,halfPadding:h,label:f}=await ve(e,t,"icon-shape default"),g=t.pos==="t",p=o+h*2,m=o+h*2,{nodeBorder:y,mainBkg:x}=r,{stylesMap:k}=ii(t),C=-m/2,T=-p/2,S=t.label?8:0,w=he.svg(c),_=fe(t,{});t.look!=="handDrawn"&&(_.roughness=0,_.fillStyle="solid");const O=k.get("fill");_.stroke=O??x;const P=w.path(Dn(C,T,m,p,5),_),v=Math.max(m,u.width),L=p+u.height+S,N=w.rectangle(-v/2,-L/2,v,L,{..._,fill:"transparent",stroke:"none"}),R=c.insert(()=>P,":first-child").attr("class","icon-shape2"),j=c.insert(()=>N);if(t.icon){const B=c.append("g");B.html(`<g>${await Na(t.icon,{height:o,width:o,fallbackPrefix:""})}</g>`);const I=B.node().getBBox(),F=I.width,W=I.height,ee=I.x,A=I.y;B.attr("transform",`translate(${-F/2-ee},${g?u.height/2+S/2-W/2-A:-u.height/2-S/2-W/2-A})`),B.attr("style",`color: ${k.get("stroke")??y};`)}return f.attr("transform",`translate(${-u.width/2-(u.x-(u.left??0))},${g?-L/2:L/2-u.height})`),R.attr("transform",`translate(0,${g?u.height/2+S/2:-u.height/2-S/2})`),pe(t,j),t.intersect=function(B){if(K.info("iconSquare intersect",t,B),!t.label)return ie.rect(t,B);const I=t.x??0,F=t.y??0,W=t.height??0;let ee=[];return g?ee=[{x:I-u.width/2,y:F-W/2},{x:I+u.width/2,y:F-W/2},{x:I+u.width/2,y:F-W/2+u.height+S},{x:I+m/2,y:F-W/2+u.height+S},{x:I+m/2,y:F+W/2},{x:I-m/2,y:F+W/2},{x:I-m/2,y:F-W/2+u.height+S},{x:I-u.width/2,y:F-W/2+u.height+S}]:ee=[{x:I-m/2,y:F-W/2},{x:I+m/2,y:F-W/2},{x:I+m/2,y:F-W/2+p},{x:I+u.width/2,y:F-W/2+p},{x:I+u.width/2/2,y:F+W/2},{x:I-u.width/2,y:F+W/2},{x:I-u.width/2,y:F-W/2+p},{x:I-m/2,y:F-W/2+p}],ie.polygon(t,ee,B)},c}b(iw,"iconRounded");async function aw(e,t,{config:{themeVariables:r,flowchart:n}}){const{labelStyles:s}=ge(t);t.labelStyle=s;const i=t.assetHeight??48,a=t.assetWidth??48,o=Math.max(i,a),l=n?.wrappingWidth;t.width=Math.max(o,l??0);const{shapeSvg:c,bbox:u,halfPadding:h,label:f}=await ve(e,t,"icon-shape default"),g=t.pos==="t",p=o+h*2,m=o+h*2,{nodeBorder:y,mainBkg:x}=r,{stylesMap:k}=ii(t),C=-m/2,T=-p/2,S=t.label?8:0,w=he.svg(c),_=fe(t,{});t.look!=="handDrawn"&&(_.roughness=0,_.fillStyle="solid");const O=k.get("fill");_.stroke=O??x;const P=w.path(Dn(C,T,m,p,.1),_),v=Math.max(m,u.width),L=p+u.height+S,N=w.rectangle(-v/2,-L/2,v,L,{..._,fill:"transparent",stroke:"none"}),R=c.insert(()=>P,":first-child"),j=c.insert(()=>N);if(t.icon){const B=c.append("g");B.html(`<g>${await Na(t.icon,{height:o,width:o,fallbackPrefix:""})}</g>`);const I=B.node().getBBox(),F=I.width,W=I.height,ee=I.x,A=I.y;B.attr("transform",`translate(${-F/2-ee},${g?u.height/2+S/2-W/2-A:-u.height/2-S/2-W/2-A})`),B.attr("style",`color: ${k.get("stroke")??y};`)}return f.attr("transform",`translate(${-u.width/2-(u.x-(u.left??0))},${g?-L/2:L/2-u.height})`),R.attr("transform",`translate(0,${g?u.height/2+S/2:-u.height/2-S/2})`),pe(t,j),t.intersect=function(B){if(K.info("iconSquare intersect",t,B),!t.label)return ie.rect(t,B);const I=t.x??0,F=t.y??0,W=t.height??0;let ee=[];return g?ee=[{x:I-u.width/2,y:F-W/2},{x:I+u.width/2,y:F-W/2},{x:I+u.width/2,y:F-W/2+u.height+S},{x:I+m/2,y:F-W/2+u.height+S},{x:I+m/2,y:F+W/2},{x:I-m/2,y:F+W/2},{x:I-m/2,y:F-W/2+u.height+S},{x:I-u.width/2,y:F-W/2+u.height+S}]:ee=[{x:I-m/2,y:F-W/2},{x:I+m/2,y:F-W/2},{x:I+m/2,y:F-W/2+p},{x:I+u.width/2,y:F-W/2+p},{x:I+u.width/2/2,y:F+W/2},{x:I-u.width/2,y:F+W/2},{x:I-u.width/2,y:F-W/2+p},{x:I-m/2,y:F-W/2+p}],ie.polygon(t,ee,B)},c}b(aw,"iconSquare");async function ow(e,t,{config:{flowchart:r}}){const n=new Image;n.src=t?.img??"",await n.decode();const s=Number(n.naturalWidth.toString().replace("px","")),i=Number(n.naturalHeight.toString().replace("px",""));t.imageAspectRatio=s/i;const{labelStyles:a}=ge(t);t.labelStyle=a;const o=r?.wrappingWidth;t.defaultWidth=r?.wrappingWidth;const l=Math.max(t.label?o??0:0,t?.assetWidth??s),c=t.constraint==="on"&&t?.assetHeight?t.assetHeight*t.imageAspectRatio:l,u=t.constraint==="on"?c/t.imageAspectRatio:t?.assetHeight??i;t.width=Math.max(c,o??0);const{shapeSvg:h,bbox:f,label:g}=await ve(e,t,"image-shape default"),p=t.pos==="t",m=-c/2,y=-u/2,x=t.label?8:0,k=he.svg(h),C=fe(t,{});t.look!=="handDrawn"&&(C.roughness=0,C.fillStyle="solid");const T=k.rectangle(m,y,c,u,C),S=Math.max(c,f.width),w=u+f.height+x,_=k.rectangle(-S/2,-w/2,S,w,{...C,fill:"none",stroke:"none"}),O=h.insert(()=>T,":first-child"),P=h.insert(()=>_);if(t.img){const v=h.append("image");v.attr("href",t.img),v.attr("width",c),v.attr("height",u),v.attr("preserveAspectRatio","none"),v.attr("transform",`translate(${-c/2},${p?w/2-u:-w/2})`)}return g.attr("transform",`translate(${-f.width/2-(f.x-(f.left??0))},${p?-u/2-f.height/2-x/2:u/2-f.height/2+x/2})`),O.attr("transform",`translate(0,${p?f.height/2+x/2:-f.height/2-x/2})`),pe(t,P),t.intersect=function(v){if(K.info("iconSquare intersect",t,v),!t.label)return ie.rect(t,v);const L=t.x??0,N=t.y??0,R=t.height??0;let j=[];return p?j=[{x:L-f.width/2,y:N-R/2},{x:L+f.width/2,y:N-R/2},{x:L+f.width/2,y:N-R/2+f.height+x},{x:L+c/2,y:N-R/2+f.height+x},{x:L+c/2,y:N+R/2},{x:L-c/2,y:N+R/2},{x:L-c/2,y:N-R/2+f.height+x},{x:L-f.width/2,y:N-R/2+f.height+x}]:j=[{x:L-c/2,y:N-R/2},{x:L+c/2,y:N-R/2},{x:L+c/2,y:N-R/2+u},{x:L+f.width/2,y:N-R/2+u},{x:L+f.width/2/2,y:N+R/2},{x:L-f.width/2,y:N+R/2},{x:L-f.width/2,y:N-R/2+u},{x:L-c/2,y:N-R/2+u}],ie.polygon(t,j,v)},h}b(ow,"imageSquare");async function lw(e,t){const{labelStyles:r,nodeStyles:n}=ge(t);t.labelStyle=r;const{shapeSvg:s,bbox:i}=await ve(e,t,ke(t)),a=Math.max(i.width+(t.padding??0)*2,t?.width??0),o=Math.max(i.height+(t.padding??0)*2,t?.height??0),l=[{x:0,y:0},{x:a,y:0},{x:a+3*o/6,y:-o},{x:-3*o/6,y:-o}];let c;const{cssStyles:u}=t;if(t.look==="handDrawn"){const h=he.svg(s),f=fe(t,{}),g=Pe(l),p=h.path(g,f);c=s.insert(()=>p,":first-child").attr("transform",`translate(${-a/2}, ${o/2})`),u&&c.attr("style",u)}else c=Bn(s,a,o,l);return n&&c.attr("style",n),t.width=a,t.height=o,pe(t,c),t.intersect=function(h){return ie.polygon(t,l,h)},s}b(lw,"inv_trapezoid");async function Pl(e,t,r){const{labelStyles:n,nodeStyles:s}=ge(t);t.labelStyle=n;const{shapeSvg:i,bbox:a}=await ve(e,t,ke(t)),o=Math.max(a.width+r.labelPaddingX*2,t?.width||0),l=Math.max(a.height+r.labelPaddingY*2,t?.height||0),c=-o/2,u=-l/2;let h,{rx:f,ry:g}=t;const{cssStyles:p}=t;if(r?.rx&&r.ry&&(f=r.rx,g=r.ry),t.look==="handDrawn"){const m=he.svg(i),y=fe(t,{}),x=f||g?m.path(Dn(c,u,o,l,f||0),y):m.rectangle(c,u,o,l,y);h=i.insert(()=>x,":first-child"),h.attr("class","basic label-container").attr("style",Bt(p))}else h=i.insert("rect",":first-child"),h.attr("class","basic label-container").attr("style",s).attr("rx",Bt(f)).attr("ry",Bt(g)).attr("x",c).attr("y",u).attr("width",o).attr("height",l);return pe(t,h),t.calcIntersect=function(m,y){return ie.rect(m,y)},t.intersect=function(m){return ie.rect(t,m)},i}b(Pl,"drawRect");async function cw(e,t){const{shapeSvg:r,bbox:n,label:s}=await ve(e,t,"label"),i=r.insert("rect",":first-child");return i.attr("width",.1).attr("height",.1),r.attr("class","label edgeLabel"),s.attr("transform",`translate(${-(n.width/2)-(n.x-(n.left??0))}, ${-(n.height/2)-(n.y-(n.top??0))})`),pe(t,i),t.intersect=function(l){return ie.rect(t,l)},r}b(cw,"labelRect");async function uw(e,t){const{labelStyles:r,nodeStyles:n}=ge(t);t.labelStyle=r;const{shapeSvg:s,bbox:i}=await ve(e,t,ke(t)),a=Math.max(i.width+(t.padding??0),t?.width??0),o=Math.max(i.height+(t.padding??0),t?.height??0),l=[{x:0,y:0},{x:a+3*o/6,y:0},{x:a,y:-o},{x:-(3*o)/6,y:-o}];let c;const{cssStyles:u}=t;if(t.look==="handDrawn"){const h=he.svg(s),f=fe(t,{}),g=Pe(l),p=h.path(g,f);c=s.insert(()=>p,":first-child").attr("transform",`translate(${-a/2}, ${o/2})`),u&&c.attr("style",u)}else c=Bn(s,a,o,l);return n&&c.attr("style",n),t.width=a,t.height=o,pe(t,c),t.intersect=function(h){return ie.polygon(t,l,h)},s}b(uw,"lean_left");async function hw(e,t){const{labelStyles:r,nodeStyles:n}=ge(t);t.labelStyle=r;const{shapeSvg:s,bbox:i}=await ve(e,t,ke(t)),a=Math.max(i.width+(t.padding??0),t?.width??0),o=Math.max(i.height+(t.padding??0),t?.height??0),l=[{x:-3*o/6,y:0},{x:a,y:0},{x:a+3*o/6,y:-o},{x:0,y:-o}];let c;const{cssStyles:u}=t;if(t.look==="handDrawn"){const h=he.svg(s),f=fe(t,{}),g=Pe(l),p=h.path(g,f);c=s.insert(()=>p,":first-child").attr("transform",`translate(${-a/2}, ${o/2})`),u&&c.attr("style",u)}else c=Bn(s,a,o,l);return n&&c.attr("style",n),t.width=a,t.height=o,pe(t,c),t.intersect=function(h){return ie.polygon(t,l,h)},s}b(hw,"lean_right");function dw(e,t){const{labelStyles:r,nodeStyles:n}=ge(t);t.label="",t.labelStyle=r;const s=e.insert("g").attr("class",ke(t)).attr("id",t.domId??t.id),{cssStyles:i}=t,a=Math.max(35,t?.width??0),o=Math.max(35,t?.height??0),l=7,c=[{x:a,y:0},{x:0,y:o+l/2},{x:a-2*l,y:o+l/2},{x:0,y:2*o},{x:a,y:o-l/2},{x:2*l,y:o-l/2}],u=he.svg(s),h=fe(t,{});t.look!=="handDrawn"&&(h.roughness=0,h.fillStyle="solid");const f=Pe(c),g=u.path(f,h),p=s.insert(()=>g,":first-child");return i&&t.look!=="handDrawn"&&p.selectAll("path").attr("style",i),n&&t.look!=="handDrawn"&&p.selectAll("path").attr("style",n),p.attr("transform",`translate(-${a/2},${-o})`),pe(t,p),t.intersect=function(m){return K.info("lightningBolt intersect",t,m),ie.polygon(t,c,m)},s}b(dw,"lightningBolt");var fB=b((e,t,r,n,s,i,a)=>[`M${e},${t+i}`,`a${s},${i} 0,0,0 ${r},0`,`a${s},${i} 0,0,0 ${-r},0`,`l0,${n}`,`a${s},${i} 0,0,0 ${r},0`,`l0,${-n}`,`M${e},${t+i+a}`,`a${s},${i} 0,0,0 ${r},0`].join(" "),"createCylinderPathD"),gB=b((e,t,r,n,s,i,a)=>[`M${e},${t+i}`,`M${e+r},${t+i}`,`a${s},${i} 0,0,0 ${-r},0`,`l0,${n}`,`a${s},${i} 0,0,0 ${r},0`,`l0,${-n}`,`M${e},${t+i+a}`,`a${s},${i} 0,0,0 ${r},0`].join(" "),"createOuterCylinderPathD"),pB=b((e,t,r,n,s,i)=>[`M${e-r/2},${-n/2}`,`a${s},${i} 0,0,0 ${r},0`].join(" "),"createInnerCylinderPathD");async function fw(e,t){const{labelStyles:r,nodeStyles:n}=ge(t);t.labelStyle=r;const{shapeSvg:s,bbox:i,label:a}=await ve(e,t,ke(t)),o=Math.max(i.width+(t.padding??0),t.width??0),l=o/2,c=l/(2.5+o/50),u=Math.max(i.height+c+(t.padding??0),t.height??0),h=u*.1;let f;const{cssStyles:g}=t;if(t.look==="handDrawn"){const p=he.svg(s),m=gB(0,0,o,u,l,c,h),y=pB(0,c,o,u,l,c),x=fe(t,{}),k=p.path(m,x),C=p.path(y,x);s.insert(()=>C,":first-child").attr("class","line"),f=s.insert(()=>k,":first-child"),f.attr("class","basic label-container"),g&&f.attr("style",g)}else{const p=fB(0,0,o,u,l,c,h);f=s.insert("path",":first-child").attr("d",p).attr("class","basic label-container").attr("style",Bt(g)).attr("style",n)}return f.attr("label-offset-y",c),f.attr("transform",`translate(${-o/2}, ${-(u/2+c)})`),pe(t,f),a.attr("transform",`translate(${-(i.width/2)-(i.x-(i.left??0))}, ${-(i.height/2)+c-(i.y-(i.top??0))})`),t.intersect=function(p){const m=ie.rect(t,p),y=m.x-(t.x??0);if(l!=0&&(Math.abs(y)<(t.width??0)/2||Math.abs(y)==(t.width??0)/2&&Math.abs(m.y-(t.y??0))>(t.height??0)/2-c)){let x=c*c*(1-y*y/(l*l));x>0&&(x=Math.sqrt(x)),x=c-x,p.y-(t.y??0)>0&&(x=-x),m.y+=x}return m},s}b(fw,"linedCylinder");async function gw(e,t){const{labelStyles:r,nodeStyles:n}=ge(t);t.labelStyle=r;const{shapeSvg:s,bbox:i,label:a}=await ve(e,t,ke(t)),o=Math.max(i.width+(t.padding??0)*2,t?.width??0),l=Math.max(i.height+(t.padding??0)*2,t?.height??0),c=l/4,u=l+c,{cssStyles:h}=t,f=he.svg(s),g=fe(t,{});t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const p=[{x:-o/2-o/2*.1,y:-u/2},{x:-o/2-o/2*.1,y:u/2},...jn(-o/2-o/2*.1,u/2,o/2+o/2*.1,u/2,c,.8),{x:o/2+o/2*.1,y:-u/2},{x:-o/2-o/2*.1,y:-u/2},{x:-o/2,y:-u/2},{x:-o/2,y:u/2*1.1},{x:-o/2,y:-u/2}],m=f.polygon(p.map(x=>[x.x,x.y]),g),y=s.insert(()=>m,":first-child");return y.attr("class","basic label-container"),h&&t.look!=="handDrawn"&&y.selectAll("path").attr("style",h),n&&t.look!=="handDrawn"&&y.selectAll("path").attr("style",n),y.attr("transform",`translate(0,${-c/2})`),a.attr("transform",`translate(${-o/2+(t.padding??0)+o/2*.1/2-(i.x-(i.left??0))},${-l/2+(t.padding??0)-c/2-(i.y-(i.top??0))})`),pe(t,y),t.intersect=function(x){return ie.polygon(t,p,x)},s}b(gw,"linedWaveEdgedRect");async function pw(e,t){const{labelStyles:r,nodeStyles:n}=ge(t);t.labelStyle=r;const{shapeSvg:s,bbox:i,label:a}=await ve(e,t,ke(t)),o=Math.max(i.width+(t.padding??0)*2,t?.width??0),l=Math.max(i.height+(t.padding??0)*2,t?.height??0),c=5,u=-o/2,h=-l/2,{cssStyles:f}=t,g=he.svg(s),p=fe(t,{}),m=[{x:u-c,y:h+c},{x:u-c,y:h+l+c},{x:u+o-c,y:h+l+c},{x:u+o-c,y:h+l},{x:u+o,y:h+l},{x:u+o,y:h+l-c},{x:u+o+c,y:h+l-c},{x:u+o+c,y:h-c},{x:u+c,y:h-c},{x:u+c,y:h},{x:u,y:h},{x:u,y:h+c}],y=[{x:u,y:h+c},{x:u+o-c,y:h+c},{x:u+o-c,y:h+l},{x:u+o,y:h+l},{x:u+o,y:h},{x:u,y:h}];t.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");const x=Pe(m),k=g.path(x,p),C=Pe(y),T=g.path(C,{...p,fill:"none"}),S=s.insert(()=>T,":first-child");return S.insert(()=>k,":first-child"),S.attr("class","basic label-container"),f&&t.look!=="handDrawn"&&S.selectAll("path").attr("style",f),n&&t.look!=="handDrawn"&&S.selectAll("path").attr("style",n),a.attr("transform",`translate(${-(i.width/2)-c-(i.x-(i.left??0))}, ${-(i.height/2)+c-(i.y-(i.top??0))})`),pe(t,S),t.intersect=function(w){return ie.polygon(t,m,w)},s}b(pw,"multiRect");async function mw(e,t){const{labelStyles:r,nodeStyles:n}=ge(t);t.labelStyle=r;const{shapeSvg:s,bbox:i,label:a}=await ve(e,t,ke(t)),o=Math.max(i.width+(t.padding??0)*2,t?.width??0),l=Math.max(i.height+(t.padding??0)*2,t?.height??0),c=l/4,u=l+c,h=-o/2,f=-u/2,g=5,{cssStyles:p}=t,m=jn(h-g,f+u+g,h+o-g,f+u+g,c,.8),y=m?.[m.length-1],x=[{x:h-g,y:f+g},{x:h-g,y:f+u+g},...m,{x:h+o-g,y:y.y-g},{x:h+o,y:y.y-g},{x:h+o,y:y.y-2*g},{x:h+o+g,y:y.y-2*g},{x:h+o+g,y:f-g},{x:h+g,y:f-g},{x:h+g,y:f},{x:h,y:f},{x:h,y:f+g}],k=[{x:h,y:f+g},{x:h+o-g,y:f+g},{x:h+o-g,y:y.y-g},{x:h+o,y:y.y-g},{x:h+o,y:f},{x:h,y:f}],C=he.svg(s),T=fe(t,{});t.look!=="handDrawn"&&(T.roughness=0,T.fillStyle="solid");const S=Pe(x),w=C.path(S,T),_=Pe(k),O=C.path(_,T),P=s.insert(()=>w,":first-child");return P.insert(()=>O),P.attr("class","basic label-container"),p&&t.look!=="handDrawn"&&P.selectAll("path").attr("style",p),n&&t.look!=="handDrawn"&&P.selectAll("path").attr("style",n),P.attr("transform",`translate(0,${-c/2})`),a.attr("transform",`translate(${-(i.width/2)-g-(i.x-(i.left??0))}, ${-(i.height/2)+g-c/2-(i.y-(i.top??0))})`),pe(t,P),t.intersect=function(v){return ie.polygon(t,x,v)},s}b(mw,"multiWaveEdgedRectangle");async function xw(e,t,{config:{themeVariables:r}}){const{labelStyles:n,nodeStyles:s}=ge(t);t.labelStyle=n,t.useHtmlLabels||$t().flowchart?.htmlLabels!==!1||(t.centerLabel=!0);const{shapeSvg:a,bbox:o,label:l}=await ve(e,t,ke(t)),c=Math.max(o.width+(t.padding??0)*2,t?.width??0),u=Math.max(o.height+(t.padding??0)*2,t?.height??0),h=-c/2,f=-u/2,{cssStyles:g}=t,p=he.svg(a),m=fe(t,{fill:r.noteBkgColor,stroke:r.noteBorderColor});t.look!=="handDrawn"&&(m.roughness=0,m.fillStyle="solid");const y=p.rectangle(h,f,c,u,m),x=a.insert(()=>y,":first-child");return x.attr("class","basic label-container"),g&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",g),s&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",s),l.attr("transform",`translate(${-o.width/2-(o.x-(o.left??0))}, ${-(o.height/2)-(o.y-(o.top??0))})`),pe(t,x),t.intersect=function(k){return ie.rect(t,k)},a}b(xw,"note");var mB=b((e,t,r)=>[`M${e+r/2},${t}`,`L${e+r},${t-r/2}`,`L${e+r/2},${t-r}`,`L${e},${t-r/2}`,"Z"].join(" "),"createDecisionBoxPathD");async function yw(e,t){const{labelStyles:r,nodeStyles:n}=ge(t);t.labelStyle=r;const{shapeSvg:s,bbox:i}=await ve(e,t,ke(t)),a=i.width+t.padding,o=i.height+t.padding,l=a+o,c=.5,u=[{x:l/2,y:0},{x:l,y:-l/2},{x:l/2,y:-l},{x:0,y:-l/2}];let h;const{cssStyles:f}=t;if(t.look==="handDrawn"){const g=he.svg(s),p=fe(t,{}),m=mB(0,0,l),y=g.path(m,p);h=s.insert(()=>y,":first-child").attr("transform",`translate(${-l/2+c}, ${l/2})`),f&&h.attr("style",f)}else h=Bn(s,l,l,u),h.attr("transform",`translate(${-l/2+c}, ${l/2})`);return n&&h.attr("style",n),pe(t,h),t.calcIntersect=function(g,p){const m=g.width,y=[{x:m/2,y:0},{x:m,y:-m/2},{x:m/2,y:-m},{x:0,y:-m/2}],x=ie.polygon(g,y,p);return{x:x.x-.5,y:x.y-.5}},t.intersect=function(g){return this.calcIntersect(t,g)},s}b(yw,"question");async function bw(e,t){const{labelStyles:r,nodeStyles:n}=ge(t);t.labelStyle=r;const{shapeSvg:s,bbox:i,label:a}=await ve(e,t,ke(t)),o=Math.max(i.width+(t.padding??0),t?.width??0),l=Math.max(i.height+(t.padding??0),t?.height??0),c=-o/2,u=-l/2,h=u/2,f=[{x:c+h,y:u},{x:c,y:0},{x:c+h,y:-u},{x:-c,y:-u},{x:-c,y:u}],{cssStyles:g}=t,p=he.svg(s),m=fe(t,{});t.look!=="handDrawn"&&(m.roughness=0,m.fillStyle="solid");const y=Pe(f),x=p.path(y,m),k=s.insert(()=>x,":first-child");return k.attr("class","basic label-container"),g&&t.look!=="handDrawn"&&k.selectAll("path").attr("style",g),n&&t.look!=="handDrawn"&&k.selectAll("path").attr("style",n),k.attr("transform",`translate(${-h/2},0)`),a.attr("transform",`translate(${-h/2-i.width/2-(i.x-(i.left??0))}, ${-(i.height/2)-(i.y-(i.top??0))})`),pe(t,k),t.intersect=function(C){return ie.polygon(t,f,C)},s}b(bw,"rect_left_inv_arrow");async function kw(e,t){const{labelStyles:r,nodeStyles:n}=ge(t);t.labelStyle=r;let s;t.cssClasses?s="node "+t.cssClasses:s="node default";const i=e.insert("g").attr("class",s).attr("id",t.domId||t.id),a=i.insert("g"),o=i.insert("g").attr("class","label").attr("style",n),l=t.description,c=t.label,u=o.node().appendChild(await Zn(c,t.labelStyle,!0,!0));let h={width:0,height:0};if(_t(He()?.flowchart?.htmlLabels)){const O=u.children[0],P=Oe(u);h=O.getBoundingClientRect(),P.attr("width",h.width),P.attr("height",h.height)}K.info("Text 2",l);const f=l||[],g=u.getBBox(),p=o.node().appendChild(await Zn(f.join?f.join("<br/>"):f,t.labelStyle,!0,!0)),m=p.children[0],y=Oe(p);h=m.getBoundingClientRect(),y.attr("width",h.width),y.attr("height",h.height);const x=(t.padding||0)/2;Oe(p).attr("transform","translate( "+(h.width>g.width?0:(g.width-h.width)/2)+", "+(g.height+x+5)+")"),Oe(u).attr("transform","translate( "+(h.width<g.width?0:-(g.width-h.width)/2)+", 0)"),h=o.node().getBBox(),o.attr("transform","translate("+-h.width/2+", "+(-h.height/2-x+3)+")");const k=h.width+(t.padding||0),C=h.height+(t.padding||0),T=-h.width/2-x,S=-h.height/2-x;let w,_;if(t.look==="handDrawn"){const O=he.svg(i),P=fe(t,{}),v=O.path(Dn(T,S,k,C,t.rx||0),P),L=O.line(-h.width/2-x,-h.height/2-x+g.height+x,h.width/2+x,-h.height/2-x+g.height+x,P);_=i.insert(()=>(K.debug("Rough node insert CXC",v),L),":first-child"),w=i.insert(()=>(K.debug("Rough node insert CXC",v),v),":first-child")}else w=a.insert("rect",":first-child"),_=a.insert("line"),w.attr("class","outer title-state").attr("style",n).attr("x",-h.width/2-x).attr("y",-h.height/2-x).attr("width",h.width+(t.padding||0)).attr("height",h.height+(t.padding||0)),_.attr("class","divider").attr("x1",-h.width/2-x).attr("x2",h.width/2+x).attr("y1",-h.height/2-x+g.height+x).attr("y2",-h.height/2-x+g.height+x);return pe(t,w),t.intersect=function(O){return ie.rect(t,O)},i}b(kw,"rectWithTitle");function Pi(e,t,r,n,s,i,a){const l=(e+r)/2,c=(t+n)/2,u=Math.atan2(n-t,r-e),h=(r-e)/2,f=(n-t)/2,g=h/s,p=f/i,m=Math.sqrt(g**2+p**2);if(m>1)throw new Error("The given radii are too small to create an arc between the points.");const y=Math.sqrt(1-m**2),x=l+y*i*Math.sin(u)*(a?-1:1),k=c-y*s*Math.cos(u)*(a?-1:1),C=Math.atan2((t-k)/i,(e-x)/s);let S=Math.atan2((n-k)/i,(r-x)/s)-C;a&&S<0&&(S+=2*Math.PI),!a&&S>0&&(S-=2*Math.PI);const w=[];for(let _=0;_<20;_++){const O=_/19,P=C+O*S,v=x+s*Math.cos(P),L=k+i*Math.sin(P);w.push({x:v,y:L})}return w}b(Pi,"generateArcPoints");async function ww(e,t){const{labelStyles:r,nodeStyles:n}=ge(t);t.labelStyle=r;const{shapeSvg:s,bbox:i}=await ve(e,t,ke(t)),a=t?.padding??0,o=t?.padding??0,l=(t?.width?t?.width:i.width)+a*2,c=(t?.height?t?.height:i.height)+o*2,u=t.radius||5,h=t.taper||5,{cssStyles:f}=t,g=he.svg(s),p=fe(t,{});t.stroke&&(p.stroke=t.stroke),t.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");const m=[{x:-l/2+h,y:-c/2},{x:l/2-h,y:-c/2},...Pi(l/2-h,-c/2,l/2,-c/2+h,u,u,!0),{x:l/2,y:-c/2+h},{x:l/2,y:c/2-h},...Pi(l/2,c/2-h,l/2-h,c/2,u,u,!0),{x:l/2-h,y:c/2},{x:-l/2+h,y:c/2},...Pi(-l/2+h,c/2,-l/2,c/2-h,u,u,!0),{x:-l/2,y:c/2-h},{x:-l/2,y:-c/2+h},...Pi(-l/2,-c/2+h,-l/2+h,-c/2,u,u,!0)],y=Pe(m),x=g.path(y,p),k=s.insert(()=>x,":first-child");return k.attr("class","basic label-container outer-path"),f&&t.look!=="handDrawn"&&k.selectChildren("path").attr("style",f),n&&t.look!=="handDrawn"&&k.selectChildren("path").attr("style",n),pe(t,k),t.intersect=function(C){return ie.polygon(t,m,C)},s}b(ww,"roundedRect");async function vw(e,t){const{labelStyles:r,nodeStyles:n}=ge(t);t.labelStyle=r;const{shapeSvg:s,bbox:i,label:a}=await ve(e,t,ke(t)),o=t?.padding??0,l=Math.max(i.width+(t.padding??0)*2,t?.width??0),c=Math.max(i.height+(t.padding??0)*2,t?.height??0),u=-i.width/2-o,h=-i.height/2-o,{cssStyles:f}=t,g=he.svg(s),p=fe(t,{});t.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");const m=[{x:u,y:h},{x:u+l+8,y:h},{x:u+l+8,y:h+c},{x:u-8,y:h+c},{x:u-8,y:h},{x:u,y:h},{x:u,y:h+c}],y=g.polygon(m.map(k=>[k.x,k.y]),p),x=s.insert(()=>y,":first-child");return x.attr("class","basic label-container").attr("style",Bt(f)),n&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",n),f&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",n),a.attr("transform",`translate(${-l/2+4+(t.padding??0)-(i.x-(i.left??0))},${-c/2+(t.padding??0)-(i.y-(i.top??0))})`),pe(t,x),t.intersect=function(k){return ie.rect(t,k)},s}b(vw,"shadedProcess");async function Cw(e,t){const{labelStyles:r,nodeStyles:n}=ge(t);t.labelStyle=r;const{shapeSvg:s,bbox:i,label:a}=await ve(e,t,ke(t)),o=Math.max(i.width+(t.padding??0)*2,t?.width??0),l=Math.max(i.height+(t.padding??0)*2,t?.height??0),c=-o/2,u=-l/2,{cssStyles:h}=t,f=he.svg(s),g=fe(t,{});t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const p=[{x:c,y:u},{x:c,y:u+l},{x:c+o,y:u+l},{x:c+o,y:u-l/2}],m=Pe(p),y=f.path(m,g),x=s.insert(()=>y,":first-child");return x.attr("class","basic label-container"),h&&t.look!=="handDrawn"&&x.selectChildren("path").attr("style",h),n&&t.look!=="handDrawn"&&x.selectChildren("path").attr("style",n),x.attr("transform",`translate(0, ${l/4})`),a.attr("transform",`translate(${-o/2+(t.padding??0)-(i.x-(i.left??0))}, ${-l/4+(t.padding??0)-(i.y-(i.top??0))})`),pe(t,x),t.intersect=function(k){return ie.polygon(t,p,k)},s}b(Cw,"slopedRect");async function Sw(e,t){const r={rx:0,ry:0,labelPaddingX:t.labelPaddingX??(t?.padding||0)*2,labelPaddingY:(t?.padding||0)*1};return Pl(e,t,r)}b(Sw,"squareRect");async function _w(e,t){const{labelStyles:r,nodeStyles:n}=ge(t);t.labelStyle=r;const{shapeSvg:s,bbox:i}=await ve(e,t,ke(t)),a=i.height+t.padding,o=i.width+a/4+t.padding,l=a/2,{cssStyles:c}=t,u=he.svg(s),h=fe(t,{});t.look!=="handDrawn"&&(h.roughness=0,h.fillStyle="solid");const f=[{x:-o/2+l,y:-a/2},{x:o/2-l,y:-a/2},...da(-o/2+l,0,l,50,90,270),{x:o/2-l,y:a/2},...da(o/2-l,0,l,50,270,450)],g=Pe(f),p=u.path(g,h),m=s.insert(()=>p,":first-child");return m.attr("class","basic label-container outer-path"),c&&t.look!=="handDrawn"&&m.selectChildren("path").attr("style",c),n&&t.look!=="handDrawn"&&m.selectChildren("path").attr("style",n),pe(t,m),t.intersect=function(y){return ie.polygon(t,f,y)},s}b(_w,"stadium");async function Tw(e,t){return Pl(e,t,{rx:5,ry:5})}b(Tw,"state");function Nw(e,t,{config:{themeVariables:r}}){const{labelStyles:n,nodeStyles:s}=ge(t);t.labelStyle=n;const{cssStyles:i}=t,{lineColor:a,stateBorder:o,nodeBorder:l}=r,c=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),u=he.svg(c),h=fe(t,{});t.look!=="handDrawn"&&(h.roughness=0,h.fillStyle="solid");const f=u.circle(0,0,14,{...h,stroke:a,strokeWidth:2}),g=o??l,p=u.circle(0,0,5,{...h,fill:g,stroke:g,strokeWidth:2,fillStyle:"solid"}),m=c.insert(()=>f,":first-child");return m.insert(()=>p),i&&m.selectAll("path").attr("style",i),s&&m.selectAll("path").attr("style",s),pe(t,m),t.intersect=function(y){return ie.circle(t,7,y)},c}b(Nw,"stateEnd");function Ew(e,t,{config:{themeVariables:r}}){const{lineColor:n}=r,s=e.insert("g").attr("class","node default").attr("id",t.domId||t.id);let i;if(t.look==="handDrawn"){const o=he.svg(s).circle(0,0,14,j$(n));i=s.insert(()=>o),i.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14)}else i=s.insert("circle",":first-child"),i.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14);return pe(t,i),t.intersect=function(a){return ie.circle(t,7,a)},s}b(Ew,"stateStart");async function Aw(e,t){const{labelStyles:r,nodeStyles:n}=ge(t);t.labelStyle=r;const{shapeSvg:s,bbox:i}=await ve(e,t,ke(t)),a=(t?.padding||0)/2,o=i.width+t.padding,l=i.height+t.padding,c=-i.width/2-a,u=-i.height/2-a,h=[{x:0,y:0},{x:o,y:0},{x:o,y:-l},{x:0,y:-l},{x:0,y:0},{x:-8,y:0},{x:o+8,y:0},{x:o+8,y:-l},{x:-8,y:-l},{x:-8,y:0}];if(t.look==="handDrawn"){const f=he.svg(s),g=fe(t,{}),p=f.rectangle(c-8,u,o+16,l,g),m=f.line(c,u,c,u+l,g),y=f.line(c+o,u,c+o,u+l,g);s.insert(()=>m,":first-child"),s.insert(()=>y,":first-child");const x=s.insert(()=>p,":first-child"),{cssStyles:k}=t;x.attr("class","basic label-container").attr("style",Bt(k)),pe(t,x)}else{const f=Bn(s,o,l,h);n&&f.attr("style",n),pe(t,f)}return t.intersect=function(f){return ie.polygon(t,h,f)},s}b(Aw,"subroutine");async function Mw(e,t){const{labelStyles:r,nodeStyles:n}=ge(t);t.labelStyle=r;const{shapeSvg:s,bbox:i}=await ve(e,t,ke(t)),a=Math.max(i.width+(t.padding??0)*2,t?.width??0),o=Math.max(i.height+(t.padding??0)*2,t?.height??0),l=-a/2,c=-o/2,u=.2*o,h=.2*o,{cssStyles:f}=t,g=he.svg(s),p=fe(t,{}),m=[{x:l-u/2,y:c},{x:l+a+u/2,y:c},{x:l+a+u/2,y:c+o},{x:l-u/2,y:c+o}],y=[{x:l+a-u/2,y:c+o},{x:l+a+u/2,y:c+o},{x:l+a+u/2,y:c+o-h}];t.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");const x=Pe(m),k=g.path(x,p),C=Pe(y),T=g.path(C,{...p,fillStyle:"solid"}),S=s.insert(()=>T,":first-child");return S.insert(()=>k,":first-child"),S.attr("class","basic label-container"),f&&t.look!=="handDrawn"&&S.selectAll("path").attr("style",f),n&&t.look!=="handDrawn"&&S.selectAll("path").attr("style",n),pe(t,S),t.intersect=function(w){return ie.polygon(t,m,w)},s}b(Mw,"taggedRect");async function jw(e,t){const{labelStyles:r,nodeStyles:n}=ge(t);t.labelStyle=r;const{shapeSvg:s,bbox:i,label:a}=await ve(e,t,ke(t)),o=Math.max(i.width+(t.padding??0)*2,t?.width??0),l=Math.max(i.height+(t.padding??0)*2,t?.height??0),c=l/4,u=.2*o,h=.2*l,f=l+c,{cssStyles:g}=t,p=he.svg(s),m=fe(t,{});t.look!=="handDrawn"&&(m.roughness=0,m.fillStyle="solid");const y=[{x:-o/2-o/2*.1,y:f/2},...jn(-o/2-o/2*.1,f/2,o/2+o/2*.1,f/2,c,.8),{x:o/2+o/2*.1,y:-f/2},{x:-o/2-o/2*.1,y:-f/2}],x=-o/2+o/2*.1,k=-f/2-h*.4,C=[{x:x+o-u,y:(k+l)*1.4},{x:x+o,y:k+l-h},{x:x+o,y:(k+l)*.9},...jn(x+o,(k+l)*1.3,x+o-u,(k+l)*1.5,-l*.03,.5)],T=Pe(y),S=p.path(T,m),w=Pe(C),_=p.path(w,{...m,fillStyle:"solid"}),O=s.insert(()=>_,":first-child");return O.insert(()=>S,":first-child"),O.attr("class","basic label-container"),g&&t.look!=="handDrawn"&&O.selectAll("path").attr("style",g),n&&t.look!=="handDrawn"&&O.selectAll("path").attr("style",n),O.attr("transform",`translate(0,${-c/2})`),a.attr("transform",`translate(${-o/2+(t.padding??0)-(i.x-(i.left??0))},${-l/2+(t.padding??0)-c/2-(i.y-(i.top??0))})`),pe(t,O),t.intersect=function(P){return ie.polygon(t,y,P)},s}b(jw,"taggedWaveEdgedRectangle");async function Iw(e,t){const{labelStyles:r,nodeStyles:n}=ge(t);t.labelStyle=r;const{shapeSvg:s,bbox:i}=await ve(e,t,ke(t)),a=Math.max(i.width+t.padding,t?.width||0),o=Math.max(i.height+t.padding,t?.height||0),l=-a/2,c=-o/2,u=s.insert("rect",":first-child");return u.attr("class","text").attr("style",n).attr("rx",0).attr("ry",0).attr("x",l).attr("y",c).attr("width",a).attr("height",o),pe(t,u),t.intersect=function(h){return ie.rect(t,h)},s}b(Iw,"text");var xB=b((e,t,r,n,s,i)=>`M${e},${t}
322
+ a${s},${i} 0,0,1 0,${-n}
323
+ l${r},0
324
+ a${s},${i} 0,0,1 0,${n}
325
+ M${r},${-n}
326
+ a${s},${i} 0,0,0 0,${n}
327
+ l${-r},0`,"createCylinderPathD"),yB=b((e,t,r,n,s,i)=>[`M${e},${t}`,`M${e+r},${t}`,`a${s},${i} 0,0,0 0,${-n}`,`l${-r},0`,`a${s},${i} 0,0,0 0,${n}`,`l${r},0`].join(" "),"createOuterCylinderPathD"),bB=b((e,t,r,n,s,i)=>[`M${e+r/2},${-n/2}`,`a${s},${i} 0,0,0 0,${n}`].join(" "),"createInnerCylinderPathD");async function Lw(e,t){const{labelStyles:r,nodeStyles:n}=ge(t);t.labelStyle=r;const{shapeSvg:s,bbox:i,label:a,halfPadding:o}=await ve(e,t,ke(t)),l=t.look==="neo"?o*2:o,c=i.height+l,u=c/2,h=u/(2.5+c/50),f=i.width+h+l,{cssStyles:g}=t;let p;if(t.look==="handDrawn"){const m=he.svg(s),y=yB(0,0,f,c,h,u),x=bB(0,0,f,c,h,u),k=m.path(y,fe(t,{})),C=m.path(x,fe(t,{fill:"none"}));p=s.insert(()=>C,":first-child"),p=s.insert(()=>k,":first-child"),p.attr("class","basic label-container"),g&&p.attr("style",g)}else{const m=xB(0,0,f,c,h,u);p=s.insert("path",":first-child").attr("d",m).attr("class","basic label-container").attr("style",Bt(g)).attr("style",n),p.attr("class","basic label-container"),g&&p.selectAll("path").attr("style",g),n&&p.selectAll("path").attr("style",n)}return p.attr("label-offset-x",h),p.attr("transform",`translate(${-f/2}, ${c/2} )`),a.attr("transform",`translate(${-(i.width/2)-h-(i.x-(i.left??0))}, ${-(i.height/2)-(i.y-(i.top??0))})`),pe(t,p),t.intersect=function(m){const y=ie.rect(t,m),x=y.y-(t.y??0);if(u!=0&&(Math.abs(x)<(t.height??0)/2||Math.abs(x)==(t.height??0)/2&&Math.abs(y.x-(t.x??0))>(t.width??0)/2-h)){let k=h*h*(1-x*x/(u*u));k!=0&&(k=Math.sqrt(Math.abs(k))),k=h-k,m.x-(t.x??0)>0&&(k=-k),y.x+=k}return y},s}b(Lw,"tiltedCylinder");async function $w(e,t){const{labelStyles:r,nodeStyles:n}=ge(t);t.labelStyle=r;const{shapeSvg:s,bbox:i}=await ve(e,t,ke(t)),a=i.width+t.padding,o=i.height+t.padding,l=[{x:-3*o/6,y:0},{x:a+3*o/6,y:0},{x:a,y:-o},{x:0,y:-o}];let c;const{cssStyles:u}=t;if(t.look==="handDrawn"){const h=he.svg(s),f=fe(t,{}),g=Pe(l),p=h.path(g,f);c=s.insert(()=>p,":first-child").attr("transform",`translate(${-a/2}, ${o/2})`),u&&c.attr("style",u)}else c=Bn(s,a,o,l);return n&&c.attr("style",n),t.width=a,t.height=o,pe(t,c),t.intersect=function(h){return ie.polygon(t,l,h)},s}b($w,"trapezoid");async function Dw(e,t){const{labelStyles:r,nodeStyles:n}=ge(t);t.labelStyle=r;const{shapeSvg:s,bbox:i}=await ve(e,t,ke(t)),a=60,o=20,l=Math.max(a,i.width+(t.padding??0)*2,t?.width??0),c=Math.max(o,i.height+(t.padding??0)*2,t?.height??0),{cssStyles:u}=t,h=he.svg(s),f=fe(t,{});t.look!=="handDrawn"&&(f.roughness=0,f.fillStyle="solid");const g=[{x:-l/2*.8,y:-c/2},{x:l/2*.8,y:-c/2},{x:l/2,y:-c/2*.6},{x:l/2,y:c/2},{x:-l/2,y:c/2},{x:-l/2,y:-c/2*.6}],p=Pe(g),m=h.path(p,f),y=s.insert(()=>m,":first-child");return y.attr("class","basic label-container"),u&&t.look!=="handDrawn"&&y.selectChildren("path").attr("style",u),n&&t.look!=="handDrawn"&&y.selectChildren("path").attr("style",n),pe(t,y),t.intersect=function(x){return ie.polygon(t,g,x)},s}b(Dw,"trapezoidalPentagon");async function Bw(e,t){const{labelStyles:r,nodeStyles:n}=ge(t);t.labelStyle=r;const{shapeSvg:s,bbox:i,label:a}=await ve(e,t,ke(t)),o=_t(He().flowchart?.htmlLabels),l=i.width+(t.padding??0),c=l+i.height,u=l+i.height,h=[{x:0,y:0},{x:u,y:0},{x:u/2,y:-c}],{cssStyles:f}=t,g=he.svg(s),p=fe(t,{});t.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");const m=Pe(h),y=g.path(m,p),x=s.insert(()=>y,":first-child").attr("transform",`translate(${-c/2}, ${c/2})`);return f&&t.look!=="handDrawn"&&x.selectChildren("path").attr("style",f),n&&t.look!=="handDrawn"&&x.selectChildren("path").attr("style",n),t.width=l,t.height=c,pe(t,x),a.attr("transform",`translate(${-i.width/2-(i.x-(i.left??0))}, ${c/2-(i.height+(t.padding??0)/(o?2:1)-(i.y-(i.top??0)))})`),t.intersect=function(k){return K.info("Triangle intersect",t,h,k),ie.polygon(t,h,k)},s}b(Bw,"triangle");async function Rw(e,t){const{labelStyles:r,nodeStyles:n}=ge(t);t.labelStyle=r;const{shapeSvg:s,bbox:i,label:a}=await ve(e,t,ke(t)),o=Math.max(i.width+(t.padding??0)*2,t?.width??0),l=Math.max(i.height+(t.padding??0)*2,t?.height??0),c=l/8,u=l+c,{cssStyles:h}=t,g=70-o,p=g>0?g/2:0,m=he.svg(s),y=fe(t,{});t.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");const x=[{x:-o/2-p,y:u/2},...jn(-o/2-p,u/2,o/2+p,u/2,c,.8),{x:o/2+p,y:-u/2},{x:-o/2-p,y:-u/2}],k=Pe(x),C=m.path(k,y),T=s.insert(()=>C,":first-child");return T.attr("class","basic label-container"),h&&t.look!=="handDrawn"&&T.selectAll("path").attr("style",h),n&&t.look!=="handDrawn"&&T.selectAll("path").attr("style",n),T.attr("transform",`translate(0,${-c/2})`),a.attr("transform",`translate(${-o/2+(t.padding??0)-(i.x-(i.left??0))},${-l/2+(t.padding??0)-c-(i.y-(i.top??0))})`),pe(t,T),t.intersect=function(S){return ie.polygon(t,x,S)},s}b(Rw,"waveEdgedRectangle");async function Pw(e,t){const{labelStyles:r,nodeStyles:n}=ge(t);t.labelStyle=r;const{shapeSvg:s,bbox:i}=await ve(e,t,ke(t)),a=100,o=50,l=Math.max(i.width+(t.padding??0)*2,t?.width??0),c=Math.max(i.height+(t.padding??0)*2,t?.height??0),u=l/c;let h=l,f=c;h>f*u?f=h/u:h=f*u,h=Math.max(h,a),f=Math.max(f,o);const g=Math.min(f*.2,f/4),p=f+g*2,{cssStyles:m}=t,y=he.svg(s),x=fe(t,{});t.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const k=[{x:-h/2,y:p/2},...jn(-h/2,p/2,h/2,p/2,g,1),{x:h/2,y:-p/2},...jn(h/2,-p/2,-h/2,-p/2,g,-1)],C=Pe(k),T=y.path(C,x),S=s.insert(()=>T,":first-child");return S.attr("class","basic label-container"),m&&t.look!=="handDrawn"&&S.selectAll("path").attr("style",m),n&&t.look!=="handDrawn"&&S.selectAll("path").attr("style",n),pe(t,S),t.intersect=function(w){return ie.polygon(t,k,w)},s}b(Pw,"waveRectangle");async function Fw(e,t){const{labelStyles:r,nodeStyles:n}=ge(t);t.labelStyle=r;const{shapeSvg:s,bbox:i,label:a}=await ve(e,t,ke(t)),o=Math.max(i.width+(t.padding??0)*2,t?.width??0),l=Math.max(i.height+(t.padding??0)*2,t?.height??0),c=5,u=-o/2,h=-l/2,{cssStyles:f}=t,g=he.svg(s),p=fe(t,{}),m=[{x:u-c,y:h-c},{x:u-c,y:h+l},{x:u+o,y:h+l},{x:u+o,y:h-c}],y=`M${u-c},${h-c} L${u+o},${h-c} L${u+o},${h+l} L${u-c},${h+l} L${u-c},${h-c}
328
+ M${u-c},${h} L${u+o},${h}
329
+ M${u},${h-c} L${u},${h+l}`;t.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");const x=g.path(y,p),k=s.insert(()=>x,":first-child");return k.attr("transform",`translate(${c/2}, ${c/2})`),k.attr("class","basic label-container"),f&&t.look!=="handDrawn"&&k.selectAll("path").attr("style",f),n&&t.look!=="handDrawn"&&k.selectAll("path").attr("style",n),a.attr("transform",`translate(${-(i.width/2)+c/2-(i.x-(i.left??0))}, ${-(i.height/2)+c/2-(i.y-(i.top??0))})`),pe(t,k),t.intersect=function(C){return ie.polygon(t,m,C)},s}b(Fw,"windowPane");async function Wd(e,t){const r=t;if(r.alias&&(t.label=r.alias),t.look==="handDrawn"){const{themeVariables:$}=$t(),{background:E}=$,Z={...t,id:t.id+"-background",look:"default",cssStyles:["stroke: none",`fill: ${E}`]};await Wd(e,Z)}const n=$t();t.useHtmlLabels=n.htmlLabels;let s=n.er?.diagramPadding??10,i=n.er?.entityPadding??6;const{cssStyles:a}=t,{labelStyles:o,nodeStyles:l}=ge(t);if(r.attributes.length===0&&t.label){const $={rx:0,ry:0,labelPaddingX:s,labelPaddingY:s*1.5};cn(t.label,n)+$.labelPaddingX*2<n.er.minEntityWidth&&(t.width=n.er.minEntityWidth);const E=await Pl(e,t,$);if(!_t(n.htmlLabels)){const Z=E.select("text"),D=Z.node()?.getBBox();Z.attr("transform",`translate(${-D.width/2}, 0)`)}return E}n.htmlLabels||(s*=1.25,i*=1.25);let c=ke(t);c||(c="node default");const u=e.insert("g").attr("class",c).attr("id",t.domId||t.id),h=await js(u,t.label??"",n,0,0,["name"],o);h.height+=i;let f=0;const g=[],p=[];let m=0,y=0,x=0,k=0,C=!0,T=!0;for(const $ of r.attributes){const E=await js(u,$.type,n,0,f,["attribute-type"],o);m=Math.max(m,E.width+s);const Z=await js(u,$.name,n,0,f,["attribute-name"],o);y=Math.max(y,Z.width+s);const D=await js(u,$.keys.join(),n,0,f,["attribute-keys"],o);x=Math.max(x,D.width+s);const X=await js(u,$.comment,n,0,f,["attribute-comment"],o);k=Math.max(k,X.width+s);const V=Math.max(E.height,Z.height,D.height,X.height)+i;p.push({yOffset:f,rowHeight:V}),f+=V}let S=4;x<=s&&(C=!1,x=0,S--),k<=s&&(T=!1,k=0,S--);const w=u.node().getBBox();if(h.width+s*2-(m+y+x+k)>0){const $=h.width+s*2-(m+y+x+k);m+=$/S,y+=$/S,x>0&&(x+=$/S),k>0&&(k+=$/S)}const _=m+y+x+k,O=he.svg(u),P=fe(t,{});t.look!=="handDrawn"&&(P.roughness=0,P.fillStyle="solid");let v=0;p.length>0&&(v=p.reduce(($,E)=>$+(E?.rowHeight??0),0));const L=Math.max(w.width+s*2,t?.width||0,_),N=Math.max((v??0)+h.height,t?.height||0),R=-L/2,j=-N/2;u.selectAll("g:not(:first-child)").each(($,E,Z)=>{const D=Oe(Z[E]),X=D.attr("transform");let V=0,H=0;if(X){const Q=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(X);Q&&(V=parseFloat(Q[1]),H=parseFloat(Q[2]),D.attr("class").includes("attribute-name")?V+=m:D.attr("class").includes("attribute-keys")?V+=m+y:D.attr("class").includes("attribute-comment")&&(V+=m+y+x))}D.attr("transform",`translate(${R+s/2+V}, ${H+j+h.height+i/2})`)}),u.select(".name").attr("transform","translate("+-h.width/2+", "+(j+i/2)+")");const B=O.rectangle(R,j,L,N,P),I=u.insert(()=>B,":first-child").attr("style",a.join("")),{themeVariables:F}=$t(),{rowEven:W,rowOdd:ee,nodeBorder:A}=F;g.push(0);for(const[$,E]of p.entries()){const D=($+1)%2===0&&E.yOffset!==0,X=O.rectangle(R,h.height+j+E?.yOffset,L,E?.rowHeight,{...P,fill:D?W:ee,stroke:A});u.insert(()=>X,"g.label").attr("style",a.join("")).attr("class",`row-rect-${D?"even":"odd"}`)}let G=O.line(R,h.height+j,L+R,h.height+j,P);u.insert(()=>G).attr("class","divider"),G=O.line(m+R,h.height+j,m+R,N+j,P),u.insert(()=>G).attr("class","divider"),C&&(G=O.line(m+y+R,h.height+j,m+y+R,N+j,P),u.insert(()=>G).attr("class","divider")),T&&(G=O.line(m+y+x+R,h.height+j,m+y+x+R,N+j,P),u.insert(()=>G).attr("class","divider"));for(const $ of g)G=O.line(R,h.height+j+$,L+R,h.height+j+$,P),u.insert(()=>G).attr("class","divider");if(pe(t,I),l&&t.look!=="handDrawn"){const E=l.split(";")?.filter(Z=>Z.includes("stroke"))?.map(Z=>`${Z}`).join("; ");u.selectAll("path").attr("style",E??""),u.selectAll(".row-rect-even path").attr("style",l)}return t.intersect=function($){return ie.rect(t,$)},u}b(Wd,"erBox");async function js(e,t,r,n=0,s=0,i=[],a=""){const o=e.insert("g").attr("class",`label ${i.join(" ")}`).attr("transform",`translate(${n}, ${s})`).attr("style",a);t!==ng(t)&&(t=ng(t),t=t.replaceAll("<","&lt;").replaceAll(">","&gt;"));const l=o.node().appendChild(await $n(o,t,{width:cn(t,r)+100,style:a,useHtmlLabels:r.htmlLabels},r));if(t.includes("&lt;")||t.includes("&gt;")){let u=l.children[0];for(u.textContent=u.textContent.replaceAll("&lt;","<").replaceAll("&gt;",">");u.childNodes[0];)u=u.childNodes[0],u.textContent=u.textContent.replaceAll("&lt;","<").replaceAll("&gt;",">")}let c=l.getBBox();if(_t(r.htmlLabels)){const u=l.children[0];u.style.textAlign="start";const h=Oe(l);c=u.getBoundingClientRect(),h.attr("width",c.width),h.attr("height",c.height)}return c}b(js,"addText");async function Ow(e,t,r,n,s=r.class.padding??12){const i=n?0:3,a=e.insert("g").attr("class",ke(t)).attr("id",t.domId||t.id);let o=null,l=null,c=null,u=null,h=0,f=0,g=0;if(o=a.insert("g").attr("class","annotation-group text"),t.annotations.length>0){const k=t.annotations[0];await Fi(o,{text:`«${k}»`},0),h=o.node().getBBox().height}l=a.insert("g").attr("class","label-group text"),await Fi(l,t,0,["font-weight: bolder"]);const p=l.node().getBBox();f=p.height,c=a.insert("g").attr("class","members-group text");let m=0;for(const k of t.members){const C=await Fi(c,k,m,[k.parseClassifier()]);m+=C+i}g=c.node().getBBox().height,g<=0&&(g=s/2),u=a.insert("g").attr("class","methods-group text");let y=0;for(const k of t.methods){const C=await Fi(u,k,y,[k.parseClassifier()]);y+=C+i}let x=a.node().getBBox();if(o!==null){const k=o.node().getBBox();o.attr("transform",`translate(${-k.width/2})`)}return l.attr("transform",`translate(${-p.width/2}, ${h})`),x=a.node().getBBox(),c.attr("transform",`translate(0, ${h+f+s*2})`),x=a.node().getBBox(),u.attr("transform",`translate(0, ${h+f+(g?g+s*4:s*2)})`),x=a.node().getBBox(),{shapeSvg:a,bbox:x}}b(Ow,"textHelper");async function Fi(e,t,r,n=[]){const s=e.insert("g").attr("class","label").attr("style",n.join("; ")),i=$t();let a="useHtmlLabels"in t?t.useHtmlLabels:_t(i.htmlLabels)??!0,o="";"text"in t?o=t.text:o=t.label,!a&&o.startsWith("\\")&&(o=o.substring(1)),Xs(o)&&(a=!0);const l=await $n(s,Zh(ps(o)),{width:cn(o,i)+50,classes:"markdown-node-label",useHtmlLabels:a},i);let c,u=1;if(a){const h=l.children[0],f=Oe(l);u=h.innerHTML.split("<br>").length,h.innerHTML.includes("</math>")&&(u+=h.innerHTML.split("<mrow>").length-1);const g=h.getElementsByTagName("img");if(g){const p=o.replace(/<img[^>]*>/g,"").trim()==="";await Promise.all([...g].map(m=>new Promise(y=>{function x(){if(m.style.display="flex",m.style.flexDirection="column",p){const k=i.fontSize?.toString()??window.getComputedStyle(document.body).fontSize,T=parseInt(k,10)*5+"px";m.style.minWidth=T,m.style.maxWidth=T}else m.style.width="100%";y(m)}b(x,"setupImage"),setTimeout(()=>{m.complete&&x()}),m.addEventListener("error",x),m.addEventListener("load",x)})))}c=h.getBoundingClientRect(),f.attr("width",c.width),f.attr("height",c.height)}else{n.includes("font-weight: bolder")&&Oe(l).selectAll("tspan").attr("font-weight",""),u=l.children.length;const h=l.children[0];(l.textContent===""||l.textContent.includes("&gt"))&&(h.textContent=o[0]+o.substring(1).replaceAll("&gt;",">").replaceAll("&lt;","<").trim(),o[1]===" "&&(h.textContent=h.textContent[0]+" "+h.textContent.substring(1))),h.textContent==="undefined"&&(h.textContent=""),c=l.getBBox()}return s.attr("transform","translate(0,"+(-c.height/(2*u)+r)+")"),c.height}b(Fi,"addText");async function zw(e,t){const r=He(),n=r.class.padding??12,s=n,i=t.useHtmlLabels??_t(r.htmlLabels)??!0,a=t;a.annotations=a.annotations??[],a.members=a.members??[],a.methods=a.methods??[];const{shapeSvg:o,bbox:l}=await Ow(e,t,r,i,s),{labelStyles:c,nodeStyles:u}=ge(t);t.labelStyle=c,t.cssStyles=a.styles||"";const h=a.styles?.join(";")||u||"";t.cssStyles||(t.cssStyles=h.replaceAll("!important","").split(";"));const f=a.members.length===0&&a.methods.length===0&&!r.class?.hideEmptyMembersBox,g=he.svg(o),p=fe(t,{});t.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");const m=l.width;let y=l.height;a.members.length===0&&a.methods.length===0?y+=s:a.members.length>0&&a.methods.length===0&&(y+=s*2);const x=-m/2,k=-y/2,C=g.rectangle(x-n,k-n-(f?n:a.members.length===0&&a.methods.length===0?-n/2:0),m+2*n,y+2*n+(f?n*2:a.members.length===0&&a.methods.length===0?-n:0),p),T=o.insert(()=>C,":first-child");T.attr("class","basic label-container");const S=T.node().getBBox();o.selectAll(".text").each((P,v,L)=>{const N=Oe(L[v]),R=N.attr("transform");let j=0;if(R){const W=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(R);W&&(j=parseFloat(W[2]))}let B=j+k+n-(f?n:a.members.length===0&&a.methods.length===0?-n/2:0);i||(B-=4);let I=x;(N.attr("class").includes("label-group")||N.attr("class").includes("annotation-group"))&&(I=-N.node()?.getBBox().width/2||0,o.selectAll("text").each(function(F,W,ee){window.getComputedStyle(ee[W]).textAnchor==="middle"&&(I=0)})),N.attr("transform",`translate(${I}, ${B})`)});const w=o.select(".annotation-group").node().getBBox().height-(f?n/2:0)||0,_=o.select(".label-group").node().getBBox().height-(f?n/2:0)||0,O=o.select(".members-group").node().getBBox().height-(f?n/2:0)||0;if(a.members.length>0||a.methods.length>0||f){const P=g.line(S.x,w+_+k+n,S.x+S.width,w+_+k+n,p);o.insert(()=>P).attr("class","divider").attr("style",h)}if(f||a.members.length>0||a.methods.length>0){const P=g.line(S.x,w+_+O+k+s*2+n,S.x+S.width,w+_+O+k+n+s*2,p);o.insert(()=>P).attr("class","divider").attr("style",h)}if(a.look!=="handDrawn"&&o.selectAll("path").attr("style",h),T.select(":nth-child(2)").attr("style",h),o.selectAll(".divider").select("path").attr("style",h),t.labelStyle?o.selectAll("span").attr("style",t.labelStyle):o.selectAll("span").attr("style",h),!i){const P=RegExp(/color\s*:\s*([^;]*)/),v=P.exec(h);if(v){const L=v[0].replace("color","fill");o.selectAll("tspan").attr("style",L)}else if(c){const L=P.exec(c);if(L){const N=L[0].replace("color","fill");o.selectAll("tspan").attr("style",N)}}}return pe(t,T),t.intersect=function(P){return ie.rect(t,P)},o}b(zw,"classBox");async function Ww(e,t){const{labelStyles:r,nodeStyles:n}=ge(t);t.labelStyle=r;const s=t,i=t,a=20,o=20,l="verifyMethod"in t,c=ke(t),u=e.insert("g").attr("class",c).attr("id",t.domId??t.id);let h;l?h=await Fr(u,`&lt;&lt;${s.type}&gt;&gt;`,0,t.labelStyle):h=await Fr(u,"&lt;&lt;Element&gt;&gt;",0,t.labelStyle);let f=h;const g=await Fr(u,s.name,f,t.labelStyle+"; font-weight: bold;");if(f+=g+o,l){const w=await Fr(u,`${s.requirementId?`ID: ${s.requirementId}`:""}`,f,t.labelStyle);f+=w;const _=await Fr(u,`${s.text?`Text: ${s.text}`:""}`,f,t.labelStyle);f+=_;const O=await Fr(u,`${s.risk?`Risk: ${s.risk}`:""}`,f,t.labelStyle);f+=O,await Fr(u,`${s.verifyMethod?`Verification: ${s.verifyMethod}`:""}`,f,t.labelStyle)}else{const w=await Fr(u,`${i.type?`Type: ${i.type}`:""}`,f,t.labelStyle);f+=w,await Fr(u,`${i.docRef?`Doc Ref: ${i.docRef}`:""}`,f,t.labelStyle)}const p=(u.node()?.getBBox().width??200)+a,m=(u.node()?.getBBox().height??200)+a,y=-p/2,x=-m/2,k=he.svg(u),C=fe(t,{});t.look!=="handDrawn"&&(C.roughness=0,C.fillStyle="solid");const T=k.rectangle(y,x,p,m,C),S=u.insert(()=>T,":first-child");if(S.attr("class","basic label-container").attr("style",n),u.selectAll(".label").each((w,_,O)=>{const P=Oe(O[_]),v=P.attr("transform");let L=0,N=0;if(v){const I=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(v);I&&(L=parseFloat(I[1]),N=parseFloat(I[2]))}const R=N-m/2;let j=y+a/2;(_===0||_===1)&&(j=L),P.attr("transform",`translate(${j}, ${R+a})`)}),f>h+g+o){const w=k.line(y,x+h+g+o,y+p,x+h+g+o,C);u.insert(()=>w).attr("style",n)}return pe(t,S),t.intersect=function(w){return ie.rect(t,w)},u}b(Ww,"requirementBox");async function Fr(e,t,r,n=""){if(t==="")return 0;const s=e.insert("g").attr("class","label").attr("style",n),i=He(),a=i.htmlLabels??!0,o=await $n(s,Zh(ps(t)),{width:cn(t,i)+50,classes:"markdown-node-label",useHtmlLabels:a,style:n},i);let l;if(a){const c=o.children[0],u=Oe(o);l=c.getBoundingClientRect(),u.attr("width",l.width),u.attr("height",l.height)}else{const c=o.children[0];for(const u of c.children)u.textContent=u.textContent.replaceAll("&gt;",">").replaceAll("&lt;","<"),n&&u.setAttribute("style",n);l=o.getBBox(),l.height+=6}return s.attr("transform",`translate(${-l.width/2},${-l.height/2+r})`),l.height}b(Fr,"addText");var kB=b(e=>{switch(e){case"Very High":return"red";case"High":return"orange";case"Medium":return null;case"Low":return"blue";case"Very Low":return"lightblue"}},"colorFromPriority");async function Hw(e,t,{config:r}){const{labelStyles:n,nodeStyles:s}=ge(t);t.labelStyle=n||"";const i=10,a=t.width;t.width=(t.width??200)-10;const{shapeSvg:o,bbox:l,label:c}=await ve(e,t,ke(t)),u=t.padding||10;let h="",f;"ticket"in t&&t.ticket&&r?.kanban?.ticketBaseUrl&&(h=r?.kanban?.ticketBaseUrl.replace("#TICKET#",t.ticket),f=o.insert("svg:a",":first-child").attr("class","kanban-ticket-link").attr("xlink:href",h).attr("target","_blank"));const g={useHtmlLabels:t.useHtmlLabels,labelStyle:t.labelStyle||"",width:t.width,img:t.img,padding:t.padding||8,centerLabel:!1};let p,m;f?{label:p,bbox:m}=await Hc(f,"ticket"in t&&t.ticket||"",g):{label:p,bbox:m}=await Hc(o,"ticket"in t&&t.ticket||"",g);const{label:y,bbox:x}=await Hc(o,"assigned"in t&&t.assigned||"",g);t.width=a;const k=10,C=t?.width||0,T=Math.max(m.height,x.height)/2,S=Math.max(l.height+k*2,t?.height||0)+T,w=-C/2,_=-S/2;c.attr("transform","translate("+(u-C/2)+", "+(-T-l.height/2)+")"),p.attr("transform","translate("+(u-C/2)+", "+(-T+l.height/2)+")"),y.attr("transform","translate("+(u+C/2-x.width-2*i)+", "+(-T+l.height/2)+")");let O;const{rx:P,ry:v}=t,{cssStyles:L}=t;if(t.look==="handDrawn"){const N=he.svg(o),R=fe(t,{}),j=P||v?N.path(Dn(w,_,C,S,P||0),R):N.rectangle(w,_,C,S,R);O=o.insert(()=>j,":first-child"),O.attr("class","basic label-container").attr("style",L||null)}else{O=o.insert("rect",":first-child"),O.attr("class","basic label-container __APA__").attr("style",s).attr("rx",P??5).attr("ry",v??5).attr("x",w).attr("y",_).attr("width",C).attr("height",S);const N="priority"in t&&t.priority;if(N){const R=o.append("line"),j=w+2,B=_+Math.floor((P??0)/2),I=_+S-Math.floor((P??0)/2);R.attr("x1",j).attr("y1",B).attr("x2",j).attr("y2",I).attr("stroke-width","4").attr("stroke",kB(N))}}return pe(t,O),t.height=S,t.intersect=function(N){return ie.rect(t,N)},o}b(Hw,"kanbanItem");async function qw(e,t){const{labelStyles:r,nodeStyles:n}=ge(t);t.labelStyle=r;const{shapeSvg:s,bbox:i,halfPadding:a,label:o}=await ve(e,t,ke(t)),l=i.width+10*a,c=i.height+8*a,u=.15*l,{cssStyles:h}=t,f=i.width+20,g=i.height+20,p=Math.max(l,f),m=Math.max(c,g);o.attr("transform",`translate(${-i.width/2}, ${-i.height/2})`);let y;const x=`M0 0
330
+ a${u},${u} 1 0,0 ${p*.25},${-1*m*.1}
331
+ a${u},${u} 1 0,0 ${p*.25},0
332
+ a${u},${u} 1 0,0 ${p*.25},0
333
+ a${u},${u} 1 0,0 ${p*.25},${m*.1}
334
+
335
+ a${u},${u} 1 0,0 ${p*.15},${m*.33}
336
+ a${u*.8},${u*.8} 1 0,0 0,${m*.34}
337
+ a${u},${u} 1 0,0 ${-1*p*.15},${m*.33}
338
+
339
+ a${u},${u} 1 0,0 ${-1*p*.25},${m*.15}
340
+ a${u},${u} 1 0,0 ${-1*p*.25},0
341
+ a${u},${u} 1 0,0 ${-1*p*.25},0
342
+ a${u},${u} 1 0,0 ${-1*p*.25},${-1*m*.15}
343
+
344
+ a${u},${u} 1 0,0 ${-1*p*.1},${-1*m*.33}
345
+ a${u*.8},${u*.8} 1 0,0 0,${-1*m*.34}
346
+ a${u},${u} 1 0,0 ${p*.1},${-1*m*.33}
347
+ H0 V0 Z`;if(t.look==="handDrawn"){const k=he.svg(s),C=fe(t,{}),T=k.path(x,C);y=s.insert(()=>T,":first-child"),y.attr("class","basic label-container").attr("style",Bt(h))}else y=s.insert("path",":first-child").attr("class","basic label-container").attr("style",n).attr("d",x);return y.attr("transform",`translate(${-p/2}, ${-m/2})`),pe(t,y),t.calcIntersect=function(k,C){return ie.rect(k,C)},t.intersect=function(k){return K.info("Bang intersect",t,k),ie.rect(t,k)},s}b(qw,"bang");async function Uw(e,t){const{labelStyles:r,nodeStyles:n}=ge(t);t.labelStyle=r;const{shapeSvg:s,bbox:i,halfPadding:a,label:o}=await ve(e,t,ke(t)),l=i.width+2*a,c=i.height+2*a,u=.15*l,h=.25*l,f=.35*l,g=.2*l,{cssStyles:p}=t;let m;const y=`M0 0
348
+ a${u},${u} 0 0,1 ${l*.25},${-1*l*.1}
349
+ a${f},${f} 1 0,1 ${l*.4},${-1*l*.1}
350
+ a${h},${h} 1 0,1 ${l*.35},${l*.2}
351
+
352
+ a${u},${u} 1 0,1 ${l*.15},${c*.35}
353
+ a${g},${g} 1 0,1 ${-1*l*.15},${c*.65}
354
+
355
+ a${h},${u} 1 0,1 ${-1*l*.25},${l*.15}
356
+ a${f},${f} 1 0,1 ${-1*l*.5},0
357
+ a${u},${u} 1 0,1 ${-1*l*.25},${-1*l*.15}
358
+
359
+ a${u},${u} 1 0,1 ${-1*l*.1},${-1*c*.35}
360
+ a${g},${g} 1 0,1 ${l*.1},${-1*c*.65}
361
+ H0 V0 Z`;if(t.look==="handDrawn"){const x=he.svg(s),k=fe(t,{}),C=x.path(y,k);m=s.insert(()=>C,":first-child"),m.attr("class","basic label-container").attr("style",Bt(p))}else m=s.insert("path",":first-child").attr("class","basic label-container").attr("style",n).attr("d",y);return o.attr("transform",`translate(${-i.width/2}, ${-i.height/2})`),m.attr("transform",`translate(${-l/2}, ${-c/2})`),pe(t,m),t.calcIntersect=function(x,k){return ie.rect(x,k)},t.intersect=function(x){return K.info("Cloud intersect",t,x),ie.rect(t,x)},s}b(Uw,"cloud");async function Vw(e,t){const{labelStyles:r,nodeStyles:n}=ge(t);t.labelStyle=r;const{shapeSvg:s,bbox:i,halfPadding:a,label:o}=await ve(e,t,ke(t)),l=i.width+8*a,c=i.height+2*a,u=5,h=`
362
+ M${-l/2} ${c/2-u}
363
+ v${-c+2*u}
364
+ q0,-${u} ${u},-${u}
365
+ h${l-2*u}
366
+ q${u},0 ${u},${u}
367
+ v${c-2*u}
368
+ q0,${u} -${u},${u}
369
+ h${-l+2*u}
370
+ q-${u},0 -${u},-${u}
371
+ Z
372
+ `,f=s.append("path").attr("id","node-"+t.id).attr("class","node-bkg node-"+t.type).attr("style",n).attr("d",h);return s.append("line").attr("class","node-line-").attr("x1",-l/2).attr("y1",c/2).attr("x2",l/2).attr("y2",c/2),o.attr("transform",`translate(${-i.width/2}, ${-i.height/2})`),s.append(()=>o.node()),pe(t,f),t.calcIntersect=function(g,p){return ie.rect(g,p)},t.intersect=function(g){return ie.rect(t,g)},s}b(Vw,"defaultMindmapNode");async function Gw(e,t){const r={padding:t.padding??0};return zd(e,t,r)}b(Gw,"mindmapCircle");var wB=[{semanticName:"Process",name:"Rectangle",shortName:"rect",description:"Standard process shape",aliases:["proc","process","rectangle"],internalAliases:["squareRect"],handler:Sw},{semanticName:"Event",name:"Rounded Rectangle",shortName:"rounded",description:"Represents an event",aliases:["event"],internalAliases:["roundedRect"],handler:ww},{semanticName:"Terminal Point",name:"Stadium",shortName:"stadium",description:"Terminal point",aliases:["terminal","pill"],handler:_w},{semanticName:"Subprocess",name:"Framed Rectangle",shortName:"fr-rect",description:"Subprocess",aliases:["subprocess","subproc","framed-rectangle","subroutine"],handler:Aw},{semanticName:"Database",name:"Cylinder",shortName:"cyl",description:"Database storage",aliases:["db","database","cylinder"],handler:Yk},{semanticName:"Start",name:"Circle",shortName:"circle",description:"Starting point",aliases:["circ"],handler:zd},{semanticName:"Bang",name:"Bang",shortName:"bang",description:"Bang",aliases:["bang"],handler:qw},{semanticName:"Cloud",name:"Cloud",shortName:"cloud",description:"cloud",aliases:["cloud"],handler:Uw},{semanticName:"Decision",name:"Diamond",shortName:"diam",description:"Decision-making step",aliases:["decision","diamond","question"],handler:yw},{semanticName:"Prepare Conditional",name:"Hexagon",shortName:"hex",description:"Preparation or condition step",aliases:["hexagon","prepare"],handler:tw},{semanticName:"Data Input/Output",name:"Lean Right",shortName:"lean-r",description:"Represents input or output",aliases:["lean-right","in-out"],internalAliases:["lean_right"],handler:hw},{semanticName:"Data Input/Output",name:"Lean Left",shortName:"lean-l",description:"Represents output or input",aliases:["lean-left","out-in"],internalAliases:["lean_left"],handler:uw},{semanticName:"Priority Action",name:"Trapezoid Base Bottom",shortName:"trap-b",description:"Priority action",aliases:["priority","trapezoid-bottom","trapezoid"],handler:$w},{semanticName:"Manual Operation",name:"Trapezoid Base Top",shortName:"trap-t",description:"Represents a manual task",aliases:["manual","trapezoid-top","inv-trapezoid"],internalAliases:["inv_trapezoid"],handler:lw},{semanticName:"Stop",name:"Double Circle",shortName:"dbl-circ",description:"Represents a stop point",aliases:["double-circle"],internalAliases:["doublecircle"],handler:Kk},{semanticName:"Text Block",name:"Text Block",shortName:"text",description:"Text block",handler:Iw},{semanticName:"Card",name:"Notched Rectangle",shortName:"notch-rect",description:"Represents a card",aliases:["card","notched-rectangle"],handler:Ok},{semanticName:"Lined/Shaded Process",name:"Lined Rectangle",shortName:"lin-rect",description:"Lined process shape",aliases:["lined-rectangle","lined-process","lin-proc","shaded-process"],handler:vw},{semanticName:"Start",name:"Small Circle",shortName:"sm-circ",description:"Small starting point",aliases:["start","small-circle"],internalAliases:["stateStart"],handler:Ew},{semanticName:"Stop",name:"Framed Circle",shortName:"fr-circ",description:"Stop point",aliases:["stop","framed-circle"],internalAliases:["stateEnd"],handler:Nw},{semanticName:"Fork/Join",name:"Filled Rectangle",shortName:"fork",description:"Fork or join in process flow",aliases:["join"],internalAliases:["forkJoin"],handler:Jk},{semanticName:"Collate",name:"Hourglass",shortName:"hourglass",description:"Represents a collate operation",aliases:["hourglass","collate"],handler:rw},{semanticName:"Comment",name:"Curly Brace",shortName:"brace",description:"Adds a comment",aliases:["comment","brace-l"],handler:qk},{semanticName:"Comment Right",name:"Curly Brace",shortName:"brace-r",description:"Adds a comment",handler:Uk},{semanticName:"Comment with braces on both sides",name:"Curly Braces",shortName:"braces",description:"Adds a comment",handler:Vk},{semanticName:"Com Link",name:"Lightning Bolt",shortName:"bolt",description:"Communication link",aliases:["com-link","lightning-bolt"],handler:dw},{semanticName:"Document",name:"Document",shortName:"doc",description:"Represents a document",aliases:["doc","document"],handler:Rw},{semanticName:"Delay",name:"Half-Rounded Rectangle",shortName:"delay",description:"Represents a delay",aliases:["half-rounded-rectangle"],handler:ew},{semanticName:"Direct Access Storage",name:"Horizontal Cylinder",shortName:"h-cyl",description:"Direct access storage",aliases:["das","horizontal-cylinder"],handler:Lw},{semanticName:"Disk Storage",name:"Lined Cylinder",shortName:"lin-cyl",description:"Disk storage",aliases:["disk","lined-cylinder"],handler:fw},{semanticName:"Display",name:"Curved Trapezoid",shortName:"curv-trap",description:"Represents a display",aliases:["curved-trapezoid","display"],handler:Gk},{semanticName:"Divided Process",name:"Divided Rectangle",shortName:"div-rect",description:"Divided process shape",aliases:["div-proc","divided-rectangle","divided-process"],handler:Xk},{semanticName:"Extract",name:"Triangle",shortName:"tri",description:"Extraction process",aliases:["extract","triangle"],handler:Bw},{semanticName:"Internal Storage",name:"Window Pane",shortName:"win-pane",description:"Internal storage",aliases:["internal-storage","window-pane"],handler:Fw},{semanticName:"Junction",name:"Filled Circle",shortName:"f-circ",description:"Junction point",aliases:["junction","filled-circle"],handler:Qk},{semanticName:"Loop Limit",name:"Trapezoidal Pentagon",shortName:"notch-pent",description:"Loop limit step",aliases:["loop-limit","notched-pentagon"],handler:Dw},{semanticName:"Manual File",name:"Flipped Triangle",shortName:"flip-tri",description:"Manual file operation",aliases:["manual-file","flipped-triangle"],handler:Zk},{semanticName:"Manual Input",name:"Sloped Rectangle",shortName:"sl-rect",description:"Manual input step",aliases:["manual-input","sloped-rectangle"],handler:Cw},{semanticName:"Multi-Document",name:"Stacked Document",shortName:"docs",description:"Multiple documents",aliases:["documents","st-doc","stacked-document"],handler:mw},{semanticName:"Multi-Process",name:"Stacked Rectangle",shortName:"st-rect",description:"Multiple processes",aliases:["procs","processes","stacked-rectangle"],handler:pw},{semanticName:"Stored Data",name:"Bow Tie Rectangle",shortName:"bow-rect",description:"Stored data",aliases:["stored-data","bow-tie-rectangle"],handler:Fk},{semanticName:"Summary",name:"Crossed Circle",shortName:"cross-circ",description:"Summary",aliases:["summary","crossed-circle"],handler:Hk},{semanticName:"Tagged Document",name:"Tagged Document",shortName:"tag-doc",description:"Tagged document",aliases:["tag-doc","tagged-document"],handler:jw},{semanticName:"Tagged Process",name:"Tagged Rectangle",shortName:"tag-rect",description:"Tagged process",aliases:["tagged-rectangle","tag-proc","tagged-process"],handler:Mw},{semanticName:"Paper Tape",name:"Flag",shortName:"flag",description:"Paper tape",aliases:["paper-tape"],handler:Pw},{semanticName:"Odd",name:"Odd",shortName:"odd",description:"Odd shape",internalAliases:["rect_left_inv_arrow"],handler:bw},{semanticName:"Lined Document",name:"Lined Document",shortName:"lin-doc",description:"Lined document",aliases:["lined-document"],handler:gw}],vB=b(()=>{const t=[...Object.entries({state:Tw,choice:zk,note:xw,rectWithTitle:kw,labelRect:cw,iconSquare:aw,iconCircle:sw,icon:nw,iconRounded:iw,imageSquare:ow,anchor:Pk,kanbanItem:Hw,mindmapCircle:Gw,defaultMindmapNode:Vw,classBox:zw,erBox:Wd,requirementBox:Ww}),...wB.flatMap(r=>[r.shortName,..."aliases"in r?r.aliases:[],..."internalAliases"in r?r.internalAliases:[]].map(s=>[s,r.handler]))];return Object.fromEntries(t)},"generateShapeMap"),Yw=vB();function CB(e){return e in Yw}b(CB,"isValidShape");var Fl=new Map;async function Xw(e,t,r){let n,s;t.shape==="rect"&&(t.rx&&t.ry?t.shape="roundedRect":t.shape="squareRect");const i=t.shape?Yw[t.shape]:void 0;if(!i)throw new Error(`No such shape: ${t.shape}. Please check your syntax.`);if(t.link){let a;r.config.securityLevel==="sandbox"?a="_top":t.linkTarget&&(a=t.linkTarget||"_blank"),n=e.insert("svg:a").attr("xlink:href",t.link).attr("target",a??null),s=await i(n,t,r)}else s=await i(e,t,r),n=s;return t.tooltip&&s.attr("title",t.tooltip),Fl.set(t.id,n),t.haveCallback&&n.attr("class",n.attr("class")+" clickable"),n}b(Xw,"insertNode");var H9=b((e,t)=>{Fl.set(t.id,e)},"setNodeElem"),q9=b(()=>{Fl.clear()},"clear"),U9=b(e=>{const t=Fl.get(e.id);K.trace("Transforming node",e.diff,e,"translate("+(e.x-e.width/2-5)+", "+e.width/2+")");const r=8,n=e.diff||0;return e.clusterNode?t.attr("transform","translate("+(e.x+n-e.width/2)+", "+(e.y-e.height/2-r)+")"):t.attr("transform","translate("+e.x+", "+e.y+")"),n},"positionNode"),SB=b((e,t,r,n,s,i)=>{t.arrowTypeStart&&hp(e,"start",t.arrowTypeStart,r,n,s,i),t.arrowTypeEnd&&hp(e,"end",t.arrowTypeEnd,r,n,s,i)},"addEdgeMarkers"),_B={arrow_cross:{type:"cross",fill:!1},arrow_point:{type:"point",fill:!0},arrow_barb:{type:"barb",fill:!0},arrow_circle:{type:"circle",fill:!1},aggregation:{type:"aggregation",fill:!1},extension:{type:"extension",fill:!1},composition:{type:"composition",fill:!0},dependency:{type:"dependency",fill:!0},lollipop:{type:"lollipop",fill:!1},only_one:{type:"onlyOne",fill:!1},zero_or_one:{type:"zeroOrOne",fill:!1},one_or_more:{type:"oneOrMore",fill:!1},zero_or_more:{type:"zeroOrMore",fill:!1},requirement_arrow:{type:"requirement_arrow",fill:!1},requirement_contains:{type:"requirement_contains",fill:!1}},hp=b((e,t,r,n,s,i,a)=>{const o=_B[r];if(!o){K.warn(`Unknown arrow type: ${r}`);return}const l=o.type,u=`${s}_${i}-${l}${t==="start"?"Start":"End"}`;if(a&&a.trim()!==""){const h=a.replace(/[^\dA-Za-z]/g,"_"),f=`${u}_${h}`;if(!document.getElementById(f)){const g=document.getElementById(u);if(g){const p=g.cloneNode(!0);p.id=f,p.querySelectorAll("path, circle, line").forEach(y=>{y.setAttribute("stroke",a),o.fill&&y.setAttribute("fill",a)}),g.parentNode?.appendChild(p)}}e.attr(`marker-${t}`,`url(${n}#${f})`)}else e.attr(`marker-${t}`,`url(${n}#${u})`)},"addEdgeMarker"),il=new Map,Et=new Map,V9=b(()=>{il.clear(),Et.clear()},"clear"),Ja=b(e=>e?e.reduce((r,n)=>r+";"+n,""):"","getLabelStyles"),TB=b(async(e,t)=>{let r=_t(He().flowchart.htmlLabels);const{labelStyles:n}=ge(t);t.labelStyle=n;const s=await $n(e,t.label,{style:t.labelStyle,useHtmlLabels:r,addSvgBackground:!0,isNode:!1});K.info("abc82",t,t.labelType);const i=e.insert("g").attr("class","edgeLabel"),a=i.insert("g").attr("class","label").attr("data-id",t.id);a.node().appendChild(s);let o=s.getBBox();if(r){const c=s.children[0],u=Oe(s);o=c.getBoundingClientRect(),u.attr("width",o.width),u.attr("height",o.height)}a.attr("transform","translate("+-o.width/2+", "+-o.height/2+")"),il.set(t.id,i),t.width=o.width,t.height=o.height;let l;if(t.startLabelLeft){const c=await Zn(t.startLabelLeft,Ja(t.labelStyle)),u=e.insert("g").attr("class","edgeTerminals"),h=u.insert("g").attr("class","inner");l=h.node().appendChild(c);const f=c.getBBox();h.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"),Et.get(t.id)||Et.set(t.id,{}),Et.get(t.id).startLeft=u,Oi(l,t.startLabelLeft)}if(t.startLabelRight){const c=await Zn(t.startLabelRight,Ja(t.labelStyle)),u=e.insert("g").attr("class","edgeTerminals"),h=u.insert("g").attr("class","inner");l=u.node().appendChild(c),h.node().appendChild(c);const f=c.getBBox();h.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"),Et.get(t.id)||Et.set(t.id,{}),Et.get(t.id).startRight=u,Oi(l,t.startLabelRight)}if(t.endLabelLeft){const c=await Zn(t.endLabelLeft,Ja(t.labelStyle)),u=e.insert("g").attr("class","edgeTerminals"),h=u.insert("g").attr("class","inner");l=h.node().appendChild(c);const f=c.getBBox();h.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"),u.node().appendChild(c),Et.get(t.id)||Et.set(t.id,{}),Et.get(t.id).endLeft=u,Oi(l,t.endLabelLeft)}if(t.endLabelRight){const c=await Zn(t.endLabelRight,Ja(t.labelStyle)),u=e.insert("g").attr("class","edgeTerminals"),h=u.insert("g").attr("class","inner");l=h.node().appendChild(c);const f=c.getBBox();h.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"),u.node().appendChild(c),Et.get(t.id)||Et.set(t.id,{}),Et.get(t.id).endRight=u,Oi(l,t.endLabelRight)}return s},"insertEdgeLabel");function Oi(e,t){He().flowchart.htmlLabels&&e&&(e.style.width=t.length*9+"px",e.style.height="12px")}b(Oi,"setTerminalWidth");var NB=b((e,t)=>{K.debug("Moving label abc88 ",e.id,e.label,il.get(e.id),t);let r=t.updatedPath?t.updatedPath:t.originalPath;const n=He(),{subGraphTitleTotalMargin:s}=yd(n);if(e.label){const i=il.get(e.id);let a=e.x,o=e.y;if(r){const l=Er.calcLabelPosition(r);K.debug("Moving label "+e.label+" from (",a,",",o,") to (",l.x,",",l.y,") abc88"),t.updatedPath&&(a=l.x,o=l.y)}i.attr("transform",`translate(${a}, ${o+s/2})`)}if(e.startLabelLeft){const i=Et.get(e.id).startLeft;let a=e.x,o=e.y;if(r){const l=Er.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_left",r);a=l.x,o=l.y}i.attr("transform",`translate(${a}, ${o})`)}if(e.startLabelRight){const i=Et.get(e.id).startRight;let a=e.x,o=e.y;if(r){const l=Er.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_right",r);a=l.x,o=l.y}i.attr("transform",`translate(${a}, ${o})`)}if(e.endLabelLeft){const i=Et.get(e.id).endLeft;let a=e.x,o=e.y;if(r){const l=Er.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_left",r);a=l.x,o=l.y}i.attr("transform",`translate(${a}, ${o})`)}if(e.endLabelRight){const i=Et.get(e.id).endRight;let a=e.x,o=e.y;if(r){const l=Er.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_right",r);a=l.x,o=l.y}i.attr("transform",`translate(${a}, ${o})`)}},"positionEdgeLabel"),EB=b((e,t)=>{const r=e.x,n=e.y,s=Math.abs(t.x-r),i=Math.abs(t.y-n),a=e.width/2,o=e.height/2;return s>=a||i>=o},"outsideNode"),AB=b((e,t,r)=>{K.debug(`intersection calc abc89:
373
+ outsidePoint: ${JSON.stringify(t)}
374
+ insidePoint : ${JSON.stringify(r)}
375
+ node : x:${e.x} y:${e.y} w:${e.width} h:${e.height}`);const n=e.x,s=e.y,i=Math.abs(n-r.x),a=e.width/2;let o=r.x<t.x?a-i:a+i;const l=e.height/2,c=Math.abs(t.y-r.y),u=Math.abs(t.x-r.x);if(Math.abs(s-t.y)*a>Math.abs(n-t.x)*l){let h=r.y<t.y?t.y-l-s:s-l-t.y;o=u*h/c;const f={x:r.x<t.x?r.x+o:r.x-u+o,y:r.y<t.y?r.y+c-h:r.y-c+h};return o===0&&(f.x=t.x,f.y=t.y),u===0&&(f.x=t.x),c===0&&(f.y=t.y),K.debug(`abc89 top/bottom calc, Q ${c}, q ${h}, R ${u}, r ${o}`,f),f}else{r.x<t.x?o=t.x-a-n:o=n-a-t.x;let h=c*o/u,f=r.x<t.x?r.x+u-o:r.x-u+o,g=r.y<t.y?r.y+h:r.y-h;return K.debug(`sides calc abc89, Q ${c}, q ${h}, R ${u}, r ${o}`,{_x:f,_y:g}),o===0&&(f=t.x,g=t.y),u===0&&(f=t.x),c===0&&(g=t.y),{x:f,y:g}}},"intersection"),dp=b((e,t)=>{K.warn("abc88 cutPathAtIntersect",e,t);let r=[],n=e[0],s=!1;return e.forEach(i=>{if(K.info("abc88 checking point",i,t),!EB(t,i)&&!s){const a=AB(t,n,i);K.debug("abc88 inside",i,n,a),K.debug("abc88 intersection",a,t);let o=!1;r.forEach(l=>{o=o||l.x===a.x&&l.y===a.y}),r.some(l=>l.x===a.x&&l.y===a.y)?K.warn("abc88 no intersect",a,r):r.push(a),s=!0}else K.warn("abc88 outside",i,n),n=i,s||r.push(i)}),K.debug("returning points",r),r},"cutPathAtIntersect");function Kw(e){const t=[],r=[];for(let n=1;n<e.length-1;n++){const s=e[n-1],i=e[n],a=e[n+1];(s.x===i.x&&i.y===a.y&&Math.abs(i.x-a.x)>5&&Math.abs(i.y-s.y)>5||s.y===i.y&&i.x===a.x&&Math.abs(i.x-s.x)>5&&Math.abs(i.y-a.y)>5)&&(t.push(i),r.push(n))}return{cornerPoints:t,cornerPointPositions:r}}b(Kw,"extractCornerPoints");var fp=b(function(e,t,r){const n=t.x-e.x,s=t.y-e.y,i=Math.sqrt(n*n+s*s),a=r/i;return{x:t.x-a*n,y:t.y-a*s}},"findAdjacentPoint"),MB=b(function(e){const{cornerPointPositions:t}=Kw(e),r=[];for(let n=0;n<e.length;n++)if(t.includes(n)){const s=e[n-1],i=e[n+1],a=e[n],o=fp(s,a,5),l=fp(i,a,5),c=l.x-o.x,u=l.y-o.y;r.push(o);const h=Math.sqrt(2)*2;let f={x:a.x,y:a.y};if(Math.abs(i.x-s.x)>10&&Math.abs(i.y-s.y)>=10){K.debug("Corner point fixing",Math.abs(i.x-s.x),Math.abs(i.y-s.y));const g=5;a.x===o.x?f={x:c<0?o.x-g+h:o.x+g-h,y:u<0?o.y-h:o.y+h}:f={x:c<0?o.x-h:o.x+h,y:u<0?o.y-g+h:o.y+g-h}}else K.debug("Corner point skipping fixing",Math.abs(i.x-s.x),Math.abs(i.y-s.y));r.push(f,l)}else r.push(e[n]);return r},"fixCorners"),jB=b((e,t,r)=>{const n=e-t-r,s=2,i=2,a=s+i,o=Math.floor(n/a),l=Array(o).fill(`${s} ${i}`).join(" ");return`0 ${t} ${l} ${r}`},"generateDashArray"),IB=b(function(e,t,r,n,s,i,a,o=!1){const{handDrawnSeed:l}=He();let c=t.points,u=!1;const h=s;var f=i;const g=[];for(const j in t.cssCompiledStyles)Nb(j)||g.push(t.cssCompiledStyles[j]);K.debug("UIO intersect check",t.points,f.x,h.x),f.intersect&&h.intersect&&!o&&(c=c.slice(1,t.points.length-1),c.unshift(h.intersect(c[0])),K.debug("Last point UIO",t.start,"-->",t.end,c[c.length-1],f,f.intersect(c[c.length-1])),c.push(f.intersect(c[c.length-1])));const p=btoa(JSON.stringify(c));t.toCluster&&(K.info("to cluster abc88",r.get(t.toCluster)),c=dp(t.points,r.get(t.toCluster).node),u=!0),t.fromCluster&&(K.debug("from cluster abc88",r.get(t.fromCluster),JSON.stringify(c,null,2)),c=dp(c.reverse(),r.get(t.fromCluster).node).reverse(),u=!0);let m=c.filter(j=>!Number.isNaN(j.y));m=MB(m);let y=fo;switch(y=Bo,t.curve){case"linear":y=Bo;break;case"basis":y=fo;break;case"cardinal":y=jx;break;case"bumpX":y=Tx;break;case"bumpY":y=Nx;break;case"catmullRom":y=Lx;break;case"monotoneX":y=Fx;break;case"monotoneY":y=Ox;break;case"natural":y=Wx;break;case"step":y=Hx;break;case"stepAfter":y=Ux;break;case"stepBefore":y=qx;break;default:y=fo}const{x,y:k}=M$(t),C=fL().x(x).y(k).curve(y);let T;switch(t.thickness){case"normal":T="edge-thickness-normal";break;case"thick":T="edge-thickness-thick";break;case"invisible":T="edge-thickness-invisible";break;default:T="edge-thickness-normal"}switch(t.pattern){case"solid":T+=" edge-pattern-solid";break;case"dotted":T+=" edge-pattern-dotted";break;case"dashed":T+=" edge-pattern-dashed";break;default:T+=" edge-pattern-solid"}let S,w=t.curve==="rounded"?Qw(Zw(m,t),5):C(m);const _=Array.isArray(t.style)?t.style:[t.style];let O=_.find(j=>j?.startsWith("stroke:")),P=!1;if(t.look==="handDrawn"){const j=he.svg(e);Object.assign([],m);const B=j.path(w,{roughness:.3,seed:l});T+=" transition",S=Oe(B).select("path").attr("id",t.id).attr("class"," "+T+(t.classes?" "+t.classes:"")).attr("style",_?_.reduce((F,W)=>F+";"+W,""):"");let I=S.attr("d");S.attr("d",I),e.node().appendChild(S.node())}else{const j=g.join(";"),B=_?_.reduce(($,E)=>$+E+";",""):"";let I="";t.animate&&(I=" edge-animation-fast"),t.animation&&(I=" edge-animation-"+t.animation);const F=(j?j+";"+B+";":B)+";"+(_?_.reduce(($,E)=>$+";"+E,""):"");S=e.append("path").attr("d",w).attr("id",t.id).attr("class"," "+T+(t.classes?" "+t.classes:"")+(I??"")).attr("style",F),O=F.match(/stroke:([^;]+)/)?.[1],P=t.animate===!0||!!t.animation||j.includes("animation");const W=S.node(),ee=typeof W.getTotalLength=="function"?W.getTotalLength():0,A=Mg[t.arrowTypeStart]||0,G=Mg[t.arrowTypeEnd]||0;if(t.look==="neo"&&!P){const E=`stroke-dasharray: ${t.pattern==="dotted"||t.pattern==="dashed"?jB(ee,A,G):`0 ${A} ${ee-A-G} ${G}`}; stroke-dashoffset: 0;`;S.attr("style",E+S.attr("style"))}}S.attr("data-edge",!0),S.attr("data-et","edge"),S.attr("data-id",t.id),S.attr("data-points",p),t.showPoints&&m.forEach(j=>{e.append("circle").style("stroke","red").style("fill","red").attr("r",1).attr("cx",j.x).attr("cy",j.y)});let v="";(He().flowchart.arrowMarkerAbsolute||He().state.arrowMarkerAbsolute)&&(v=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,v=v.replace(/\(/g,"\\(").replace(/\)/g,"\\)")),K.info("arrowTypeStart",t.arrowTypeStart),K.info("arrowTypeEnd",t.arrowTypeEnd),SB(S,t,v,a,n,O);const L=Math.floor(c.length/2),N=c[L];Er.isLabelCoordinateInPath(N,S.attr("d"))||(u=!0);let R={};return u&&(R.updatedPath=c),R.originalPath=t.points,R},"insertEdge");function Qw(e,t){if(e.length<2)return"";let r="";const n=e.length,s=1e-5;for(let i=0;i<n;i++){const a=e[i],o=e[i-1],l=e[i+1];if(i===0)r+=`M${a.x},${a.y}`;else if(i===n-1)r+=`L${a.x},${a.y}`;else{const c=a.x-o.x,u=a.y-o.y,h=l.x-a.x,f=l.y-a.y,g=Math.hypot(c,u),p=Math.hypot(h,f);if(g<s||p<s){r+=`L${a.x},${a.y}`;continue}const m=c/g,y=u/g,x=h/p,k=f/p,C=m*x+y*k,T=Math.max(-1,Math.min(1,C)),S=Math.acos(T);if(S<s||Math.abs(Math.PI-S)<s){r+=`L${a.x},${a.y}`;continue}const w=Math.min(t/Math.sin(S/2),g/2,p/2),_=a.x-m*w,O=a.y-y*w,P=a.x+x*w,v=a.y+k*w;r+=`L${_},${O}`,r+=`Q${a.x},${a.y} ${P},${v}`}}return r}b(Qw,"generateRoundedPath");function nh(e,t){if(!e||!t)return{angle:0,deltaX:0,deltaY:0};const r=t.x-e.x,n=t.y-e.y;return{angle:Math.atan2(n,r),deltaX:r,deltaY:n}}b(nh,"calculateDeltaAndAngle");function Zw(e,t){const r=e.map(s=>({...s}));if(e.length>=2&&It[t.arrowTypeStart]){const s=It[t.arrowTypeStart],i=e[0],a=e[1],{angle:o}=nh(i,a),l=s*Math.cos(o),c=s*Math.sin(o);r[0].x=i.x+l,r[0].y=i.y+c}const n=e.length;if(n>=2&&It[t.arrowTypeEnd]){const s=It[t.arrowTypeEnd],i=e[n-1],a=e[n-2],{angle:o}=nh(a,i),l=s*Math.cos(o),c=s*Math.sin(o);r[n-1].x=i.x-l,r[n-1].y=i.y-c}return r}b(Zw,"applyMarkerOffsetsToPoints");var LB=b((e,t,r,n)=>{t.forEach(s=>{XB[s](e,r,n)})},"insertMarkers"),$B=b((e,t,r)=>{K.trace("Making markers for ",r),e.append("defs").append("marker").attr("id",r+"_"+t+"-extensionStart").attr("class","marker extension "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 1,7 L18,13 V 1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-extensionEnd").attr("class","marker extension "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 1,1 V 13 L18,7 Z")},"extension"),DB=b((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-compositionStart").attr("class","marker composition "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-compositionEnd").attr("class","marker composition "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"composition"),BB=b((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-aggregationStart").attr("class","marker aggregation "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-aggregationEnd").attr("class","marker aggregation "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"aggregation"),RB=b((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-dependencyStart").attr("class","marker dependency "+t).attr("refX",6).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 5,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-dependencyEnd").attr("class","marker dependency "+t).attr("refX",13).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"dependency"),PB=b((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-lollipopStart").attr("class","marker lollipop "+t).attr("refX",13).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6),e.append("defs").append("marker").attr("id",r+"_"+t+"-lollipopEnd").attr("class","marker lollipop "+t).attr("refX",1).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6)},"lollipop"),FB=b((e,t,r)=>{e.append("marker").attr("id",r+"_"+t+"-pointEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",8).attr("markerHeight",8).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-pointStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",4.5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",8).attr("markerHeight",8).attr("orient","auto").append("path").attr("d","M 0 5 L 10 10 L 10 0 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"point"),OB=b((e,t,r)=>{e.append("marker").attr("id",r+"_"+t+"-circleEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",11).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-circleStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",-1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"circle"),zB=b((e,t,r)=>{e.append("marker").attr("id",r+"_"+t+"-crossEnd").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",12).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-crossStart").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",-1).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0")},"cross"),WB=b((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-barbEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","userSpaceOnUse").attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"barb"),HB=b((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-onlyOneStart").attr("class","marker onlyOne "+t).attr("refX",0).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").append("path").attr("d","M9,0 L9,18 M15,0 L15,18"),e.append("defs").append("marker").attr("id",r+"_"+t+"-onlyOneEnd").attr("class","marker onlyOne "+t).attr("refX",18).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").append("path").attr("d","M3,0 L3,18 M9,0 L9,18")},"only_one"),qB=b((e,t,r)=>{const n=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrOneStart").attr("class","marker zeroOrOne "+t).attr("refX",0).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto");n.append("circle").attr("fill","white").attr("cx",21).attr("cy",9).attr("r",6),n.append("path").attr("d","M9,0 L9,18");const s=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrOneEnd").attr("class","marker zeroOrOne "+t).attr("refX",30).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto");s.append("circle").attr("fill","white").attr("cx",9).attr("cy",9).attr("r",6),s.append("path").attr("d","M21,0 L21,18")},"zero_or_one"),UB=b((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-oneOrMoreStart").attr("class","marker oneOrMore "+t).attr("refX",18).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").append("path").attr("d","M0,18 Q 18,0 36,18 Q 18,36 0,18 M42,9 L42,27"),e.append("defs").append("marker").attr("id",r+"_"+t+"-oneOrMoreEnd").attr("class","marker oneOrMore "+t).attr("refX",27).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").append("path").attr("d","M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18")},"one_or_more"),VB=b((e,t,r)=>{const n=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrMoreStart").attr("class","marker zeroOrMore "+t).attr("refX",18).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto");n.append("circle").attr("fill","white").attr("cx",48).attr("cy",18).attr("r",6),n.append("path").attr("d","M0,18 Q18,0 36,18 Q18,36 0,18");const s=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrMoreEnd").attr("class","marker zeroOrMore "+t).attr("refX",39).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto");s.append("circle").attr("fill","white").attr("cx",9).attr("cy",18).attr("r",6),s.append("path").attr("d","M21,18 Q39,0 57,18 Q39,36 21,18")},"zero_or_more"),GB=b((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_arrowEnd").attr("refX",20).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("path").attr("d",`M0,0
376
+ L20,10
377
+ M20,10
378
+ L0,20`)},"requirement_arrow"),YB=b((e,t,r)=>{const n=e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");n.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),n.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),n.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains"),XB={extension:$B,composition:DB,aggregation:BB,dependency:RB,lollipop:PB,point:FB,circle:OB,cross:zB,barb:WB,only_one:HB,zero_or_one:qB,one_or_more:UB,zero_or_more:VB,requirement_arrow:GB,requirement_contains:YB},KB=LB,QB={common:si,getConfig:$t,insertCluster:iB,insertEdge:IB,insertEdgeLabel:TB,insertMarkers:KB,insertNode:Xw,interpolateToCurve:Cd,labelHelper:ve,log:K,positionEdgeLabel:NB},fa={},Jw=b(e=>{for(const t of e)fa[t.name]=t},"registerLayoutLoaders"),ZB=b(()=>{Jw([{name:"dagre",loader:b(async()=>await Ue(()=>import("./dagre-6UL2VRFP-D-NrLBGh.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22])),"loader")},{name:"cose-bilkent",loader:b(async()=>await Ue(()=>import("./cose-bilkent-S5V4N54A-BuEw-qDX.js"),__vite__mapDeps([23,24,7,6,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22])),"loader")}])},"registerDefaultLayoutLoaders");ZB();var G9=b(async(e,t)=>{if(!(e.layoutAlgorithm in fa))throw new Error(`Unknown layout algorithm: ${e.layoutAlgorithm}`);const r=fa[e.layoutAlgorithm];return(await r.loader()).render(e,t,QB,{algorithm:r.algorithm})},"render"),Y9=b((e="",{fallback:t="dagre"}={})=>{if(e in fa)return e;if(t in fa)return K.warn(`Layout algorithm ${e} is not registered. Using ${t} as fallback.`),t;throw new Error(`Both layout algorithms ${e} and ${t} are not registered.`)},"getRegisteredLayoutAlgorithm"),e1="comm",t1="rule",r1="decl",JB="@import",eR="@namespace",tR="@keyframes",rR="@layer",n1=Math.abs,Hd=String.fromCharCode;function s1(e){return e.trim()}function yo(e,t,r){return e.replace(t,r)}function nR(e,t,r){return e.indexOf(t,r)}function Bs(e,t){return e.charCodeAt(t)|0}function ei(e,t,r){return e.slice(t,r)}function zr(e){return e.length}function sR(e){return e.length}function eo(e,t){return t.push(e),e}var Ol=1,ti=1,i1=0,br=0,bt=0,ci="";function qd(e,t,r,n,s,i,a,o){return{value:e,root:t,parent:r,type:n,props:s,children:i,line:Ol,column:ti,length:a,return:"",siblings:o}}function iR(){return bt}function aR(){return bt=br>0?Bs(ci,--br):0,ti--,bt===10&&(ti=1,Ol--),bt}function Ir(){return bt=br<i1?Bs(ci,br++):0,ti++,bt===10&&(ti=1,Ol++),bt}function _n(){return Bs(ci,br)}function bo(){return br}function zl(e,t){return ei(ci,e,t)}function ga(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function oR(e){return Ol=ti=1,i1=zr(ci=e),br=0,[]}function lR(e){return ci="",e}function qc(e){return s1(zl(br-1,sh(e===91?e+2:e===40?e+1:e)))}function cR(e){for(;(bt=_n())&&bt<33;)Ir();return ga(e)>2||ga(bt)>3?"":" "}function uR(e,t){for(;--t&&Ir()&&!(bt<48||bt>102||bt>57&&bt<65||bt>70&&bt<97););return zl(e,bo()+(t<6&&_n()==32&&Ir()==32))}function sh(e){for(;Ir();)switch(bt){case e:return br;case 34:case 39:e!==34&&e!==39&&sh(bt);break;case 40:e===41&&sh(e);break;case 92:Ir();break}return br}function hR(e,t){for(;Ir()&&e+bt!==57;)if(e+bt===84&&_n()===47)break;return"/*"+zl(t,br-1)+"*"+Hd(e===47?e:Ir())}function dR(e){for(;!ga(_n());)Ir();return zl(e,br)}function fR(e){return lR(ko("",null,null,null,[""],e=oR(e),0,[0],e))}function ko(e,t,r,n,s,i,a,o,l){for(var c=0,u=0,h=a,f=0,g=0,p=0,m=1,y=1,x=1,k=0,C="",T=s,S=i,w=n,_=C;y;)switch(p=k,k=Ir()){case 40:if(p!=108&&Bs(_,h-1)==58){nR(_+=yo(qc(k),"&","&\f"),"&\f",n1(c?o[c-1]:0))!=-1&&(x=-1);break}case 34:case 39:case 91:_+=qc(k);break;case 9:case 10:case 13:case 32:_+=cR(p);break;case 92:_+=uR(bo()-1,7);continue;case 47:switch(_n()){case 42:case 47:eo(gR(hR(Ir(),bo()),t,r,l),l),(ga(p||1)==5||ga(_n()||1)==5)&&zr(_)&&ei(_,-1,void 0)!==" "&&(_+=" ");break;default:_+="/"}break;case 123*m:o[c++]=zr(_)*x;case 125*m:case 59:case 0:switch(k){case 0:case 125:y=0;case 59+u:x==-1&&(_=yo(_,/\f/g,"")),g>0&&(zr(_)-h||m===0&&p===47)&&eo(g>32?pp(_+";",n,r,h-1,l):pp(yo(_," ","")+";",n,r,h-2,l),l);break;case 59:_+=";";default:if(eo(w=gp(_,t,r,c,u,s,o,C,T=[],S=[],h,i),i),k===123)if(u===0)ko(_,t,w,w,T,i,h,o,S);else{switch(f){case 99:if(Bs(_,3)===110)break;case 108:if(Bs(_,2)===97)break;default:u=0;case 100:case 109:case 115:}u?ko(e,w,w,n&&eo(gp(e,w,w,0,0,s,o,C,s,T=[],h,S),S),s,S,h,o,n?T:S):ko(_,w,w,w,[""],S,0,o,S)}}c=u=g=0,m=x=1,C=_="",h=a;break;case 58:h=1+zr(_),g=p;default:if(m<1){if(k==123)--m;else if(k==125&&m++==0&&aR()==125)continue}switch(_+=Hd(k),k*m){case 38:x=u>0?1:(_+="\f",-1);break;case 44:o[c++]=(zr(_)-1)*x,x=1;break;case 64:_n()===45&&(_+=qc(Ir())),f=_n(),u=h=zr(C=_+=dR(bo())),k++;break;case 45:p===45&&zr(_)==2&&(m=0)}}return i}function gp(e,t,r,n,s,i,a,o,l,c,u,h){for(var f=s-1,g=s===0?i:[""],p=sR(g),m=0,y=0,x=0;m<n;++m)for(var k=0,C=ei(e,f+1,f=n1(y=a[m])),T=e;k<p;++k)(T=s1(y>0?g[k]+" "+C:yo(C,/&\f/g,g[k])))&&(l[x++]=T);return qd(e,t,r,s===0?t1:o,l,c,u,h)}function gR(e,t,r,n){return qd(e,t,r,e1,Hd(iR()),ei(e,2,-2),0,n)}function pp(e,t,r,n,s){return qd(e,t,r,r1,ei(e,0,n),ei(e,n+1,-1),n,s)}function ih(e,t){for(var r="",n=0;n<e.length;n++)r+=t(e[n],n,e,t)||"";return r}function pR(e,t,r,n){switch(e.type){case rR:if(e.children.length)break;case JB:case eR:case r1:return e.return=e.return||e.value;case e1:return"";case tR:return e.return=e.value+"{"+ih(e.children,n)+"}";case t1:if(!zr(e.value=e.props.join(",")))return""}return zr(r=ih(e.children,n))?e.return=e.value+"{"+r+"}":""}var mR=jb(Object.keys,Object),xR=Object.prototype,yR=xR.hasOwnProperty;function bR(e){if(!Ml(e))return mR(e);var t=[];for(var r in Object(e))yR.call(e,r)&&r!="constructor"&&t.push(r);return t}var ah=gs(Yr,"DataView"),oh=gs(Yr,"Promise"),lh=gs(Yr,"Set"),ch=gs(Yr,"WeakMap"),mp="[object Map]",kR="[object Object]",xp="[object Promise]",yp="[object Set]",bp="[object WeakMap]",kp="[object DataView]",wR=fs(ah),vR=fs(ha),CR=fs(oh),SR=fs(lh),_R=fs(ch),Gn=ai;(ah&&Gn(new ah(new ArrayBuffer(1)))!=kp||ha&&Gn(new ha)!=mp||oh&&Gn(oh.resolve())!=xp||lh&&Gn(new lh)!=yp||ch&&Gn(new ch)!=bp)&&(Gn=function(e){var t=ai(e),r=t==kR?e.constructor:void 0,n=r?fs(r):"";if(n)switch(n){case wR:return kp;case vR:return mp;case CR:return xp;case SR:return yp;case _R:return bp}return t});var TR="[object Map]",NR="[object Set]",ER=Object.prototype,AR=ER.hasOwnProperty;function wp(e){if(e==null)return!0;if(jl(e)&&(Xo(e)||typeof e=="string"||typeof e.splice=="function"||wd(e)||vd(e)||Yo(e)))return!e.length;var t=Gn(e);if(t==TR||t==NR)return!e.size;if(Ml(e))return!bR(e).length;for(var r in e)if(AR.call(e,r))return!1;return!0}var a1="c4",MR=b(e=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),"detector"),jR=b(async()=>{const{diagram:e}=await Ue(async()=>{const{diagram:t}=await import("./c4Diagram-YG6GDRKO-J2ovCYEr.js");return{diagram:t}},__vite__mapDeps([25,26,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:a1,diagram:e}},"loader"),IR={id:a1,detector:MR,loader:jR},LR=IR,o1="flowchart",$R=b((e,t)=>t?.flowchart?.defaultRenderer==="dagre-wrapper"||t?.flowchart?.defaultRenderer==="elk"?!1:/^\s*graph/.test(e),"detector"),DR=b(async()=>{const{diagram:e}=await Ue(async()=>{const{diagram:t}=await import("./flowDiagram-NV44I4VS-DTMKSJI1.js");return{diagram:t}},__vite__mapDeps([27,28,29,30,31,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:o1,diagram:e}},"loader"),BR={id:o1,detector:$R,loader:DR},RR=BR,l1="flowchart-v2",PR=b((e,t)=>t?.flowchart?.defaultRenderer==="dagre-d3"?!1:(t?.flowchart?.defaultRenderer==="elk"&&(t.layout="elk"),/^\s*graph/.test(e)&&t?.flowchart?.defaultRenderer==="dagre-wrapper"?!0:/^\s*flowchart/.test(e)),"detector"),FR=b(async()=>{const{diagram:e}=await Ue(async()=>{const{diagram:t}=await import("./flowDiagram-NV44I4VS-DTMKSJI1.js");return{diagram:t}},__vite__mapDeps([27,28,29,30,31,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:l1,diagram:e}},"loader"),OR={id:l1,detector:PR,loader:FR},zR=OR,c1="er",WR=b(e=>/^\s*erDiagram/.test(e),"detector"),HR=b(async()=>{const{diagram:e}=await Ue(async()=>{const{diagram:t}=await import("./erDiagram-Q2GNP2WA-Cov6xnUk.js");return{diagram:t}},__vite__mapDeps([32,29,30,31,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:c1,diagram:e}},"loader"),qR={id:c1,detector:WR,loader:HR},UR=qR,u1="gitGraph",VR=b(e=>/^\s*gitGraph/.test(e),"detector"),GR=b(async()=>{const{diagram:e}=await Ue(async()=>{const{diagram:t}=await import("./gitGraphDiagram-NY62KEGX-CvxYSabY.js");return{diagram:t}},__vite__mapDeps([33,34,35,36,8,7,2,4,5,6,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:u1,diagram:e}},"loader"),YR={id:u1,detector:VR,loader:GR},XR=YR,h1="gantt",KR=b(e=>/^\s*gantt/.test(e),"detector"),QR=b(async()=>{const{diagram:e}=await Ue(async()=>{const{diagram:t}=await import("./ganttDiagram-LVOFAZNH-DR0bcfHY.js");return{diagram:t}},__vite__mapDeps([37,7,38,39,40,6,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:h1,diagram:e}},"loader"),ZR={id:h1,detector:KR,loader:QR},JR=ZR,d1="info",eP=b(e=>/^\s*info/.test(e),"detector"),tP=b(async()=>{const{diagram:e}=await Ue(async()=>{const{diagram:t}=await import("./infoDiagram-F6ZHWCRC-CL9g-UgS.js");return{diagram:t}},__vite__mapDeps([41,36,8,7,2,4,5,6,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:d1,diagram:e}},"loader"),rP={id:d1,detector:eP,loader:tP},f1="pie",nP=b(e=>/^\s*pie/.test(e),"detector"),sP=b(async()=>{const{diagram:e}=await Ue(async()=>{const{diagram:t}=await import("./pieDiagram-ADFJNKIX-BQt_waQk.js");return{diagram:t}},__vite__mapDeps([42,34,36,8,7,2,4,5,43,44,39,6,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:f1,diagram:e}},"loader"),iP={id:f1,detector:nP,loader:sP},g1="quadrantChart",aP=b(e=>/^\s*quadrantChart/.test(e),"detector"),oP=b(async()=>{const{diagram:e}=await Ue(async()=>{const{diagram:t}=await import("./quadrantDiagram-AYHSOK5B-DvLFoDeH.js");return{diagram:t}},__vite__mapDeps([45,38,39,40,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:g1,diagram:e}},"loader"),lP={id:g1,detector:aP,loader:oP},cP=lP,p1="xychart",uP=b(e=>/^\s*xychart(-beta)?/.test(e),"detector"),hP=b(async()=>{const{diagram:e}=await Ue(async()=>{const{diagram:t}=await import("./xychartDiagram-PRI3JC2R-Cy-SHDyX.js");return{diagram:t}},__vite__mapDeps([46,39,44,38,40,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:p1,diagram:e}},"loader"),dP={id:p1,detector:uP,loader:hP},fP=dP,m1="requirement",gP=b(e=>/^\s*requirement(Diagram)?/.test(e),"detector"),pP=b(async()=>{const{diagram:e}=await Ue(async()=>{const{diagram:t}=await import("./requirementDiagram-UZGBJVZJ-C4lqjEUP.js");return{diagram:t}},__vite__mapDeps([47,29,30,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:m1,diagram:e}},"loader"),mP={id:m1,detector:gP,loader:pP},xP=mP,x1="sequence",yP=b(e=>/^\s*sequenceDiagram/.test(e),"detector"),bP=b(async()=>{const{diagram:e}=await Ue(async()=>{const{diagram:t}=await import("./sequenceDiagram-WL72ISMW-BeyhJ61U.js");return{diagram:t}},__vite__mapDeps([48,26,35,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:x1,diagram:e}},"loader"),kP={id:x1,detector:yP,loader:bP},wP=kP,y1="class",vP=b((e,t)=>t?.class?.defaultRenderer==="dagre-wrapper"?!1:/^\s*classDiagram/.test(e),"detector"),CP=b(async()=>{const{diagram:e}=await Ue(async()=>{const{diagram:t}=await import("./classDiagram-2ON5EDUG-f-lJUj27.js");return{diagram:t}},__vite__mapDeps([49,50,28,29,30,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:y1,diagram:e}},"loader"),SP={id:y1,detector:vP,loader:CP},_P=SP,b1="classDiagram",TP=b((e,t)=>/^\s*classDiagram/.test(e)&&t?.class?.defaultRenderer==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(e),"detector"),NP=b(async()=>{const{diagram:e}=await Ue(async()=>{const{diagram:t}=await import("./classDiagram-v2-WZHVMYZB-f-lJUj27.js");return{diagram:t}},__vite__mapDeps([51,50,28,29,30,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:b1,diagram:e}},"loader"),EP={id:b1,detector:TP,loader:NP},AP=EP,k1="state",MP=b((e,t)=>t?.state?.defaultRenderer==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(e),"detector"),jP=b(async()=>{const{diagram:e}=await Ue(async()=>{const{diagram:t}=await import("./stateDiagram-FKZM4ZOC-CKyn6eKl.js");return{diagram:t}},__vite__mapDeps([52,53,29,30,1,2,3,4,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:k1,diagram:e}},"loader"),IP={id:k1,detector:MP,loader:jP},LP=IP,w1="stateDiagram",$P=b((e,t)=>!!(/^\s*stateDiagram-v2/.test(e)||/^\s*stateDiagram/.test(e)&&t?.state?.defaultRenderer==="dagre-wrapper"),"detector"),DP=b(async()=>{const{diagram:e}=await Ue(async()=>{const{diagram:t}=await import("./stateDiagram-v2-4FDKWEC3-DogBVcJE.js");return{diagram:t}},__vite__mapDeps([54,53,29,30,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:w1,diagram:e}},"loader"),BP={id:w1,detector:$P,loader:DP},RP=BP,v1="journey",PP=b(e=>/^\s*journey/.test(e),"detector"),FP=b(async()=>{const{diagram:e}=await Ue(async()=>{const{diagram:t}=await import("./journeyDiagram-XKPGCS4Q-Df8G0pW8.js");return{diagram:t}},__vite__mapDeps([55,26,28,43,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:v1,diagram:e}},"loader"),OP={id:v1,detector:PP,loader:FP},zP=OP,WP=b((e,t,r)=>{K.debug(`rendering svg for syntax error
379
+ `);const n=vL(t),s=n.append("g");n.attr("viewBox","0 0 2412 512"),X0(n,100,512,!0),s.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),s.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),s.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),s.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),s.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),s.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),s.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),s.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${r}`)},"draw"),C1={draw:WP},HP=C1,qP={db:{},renderer:C1,parser:{parse:b(()=>{},"parse")}},UP=qP,S1="flowchart-elk",VP=b((e,t={})=>/^\s*flowchart-elk/.test(e)||/^\s*(flowchart|graph)/.test(e)&&t?.flowchart?.defaultRenderer==="elk"?(t.layout="elk",!0):!1,"detector"),GP=b(async()=>{const{diagram:e}=await Ue(async()=>{const{diagram:t}=await import("./flowDiagram-NV44I4VS-DTMKSJI1.js");return{diagram:t}},__vite__mapDeps([27,28,29,30,31,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:S1,diagram:e}},"loader"),YP={id:S1,detector:VP,loader:GP},XP=YP,_1="timeline",KP=b(e=>/^\s*timeline/.test(e),"detector"),QP=b(async()=>{const{diagram:e}=await Ue(async()=>{const{diagram:t}=await import("./timeline-definition-IT6M3QCI-Cm5SIAmT.js");return{diagram:t}},__vite__mapDeps([56,43,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:_1,diagram:e}},"loader"),ZP={id:_1,detector:KP,loader:QP},JP=ZP,T1="mindmap",eF=b(e=>/^\s*mindmap/.test(e),"detector"),tF=b(async()=>{const{diagram:e}=await Ue(async()=>{const{diagram:t}=await import("./mindmap-definition-VGOIOE7T-CVK2y0WQ.js");return{diagram:t}},__vite__mapDeps([57,29,30,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:T1,diagram:e}},"loader"),rF={id:T1,detector:eF,loader:tF},nF=rF,N1="kanban",sF=b(e=>/^\s*kanban/.test(e),"detector"),iF=b(async()=>{const{diagram:e}=await Ue(async()=>{const{diagram:t}=await import("./kanban-definition-3W4ZIXB7-DhoP7TG_.js");return{diagram:t}},__vite__mapDeps([58,28,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:N1,diagram:e}},"loader"),aF={id:N1,detector:sF,loader:iF},oF=aF,E1="sankey",lF=b(e=>/^\s*sankey(-beta)?/.test(e),"detector"),cF=b(async()=>{const{diagram:e}=await Ue(async()=>{const{diagram:t}=await import("./sankeyDiagram-TZEHDZUN-BKIDyl6M.js");return{diagram:t}},__vite__mapDeps([59,44,39,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:E1,diagram:e}},"loader"),uF={id:E1,detector:lF,loader:cF},hF=uF,A1="packet",dF=b(e=>/^\s*packet(-beta)?/.test(e),"detector"),fF=b(async()=>{const{diagram:e}=await Ue(async()=>{const{diagram:t}=await import("./diagram-S2PKOQOG-BLKbR12g.js");return{diagram:t}},__vite__mapDeps([60,34,36,8,7,2,4,5,6,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:A1,diagram:e}},"loader"),gF={id:A1,detector:dF,loader:fF},M1="radar",pF=b(e=>/^\s*radar-beta/.test(e),"detector"),mF=b(async()=>{const{diagram:e}=await Ue(async()=>{const{diagram:t}=await import("./diagram-QEK2KX5R-C0YlDb8t.js");return{diagram:t}},__vite__mapDeps([61,34,36,8,7,2,4,5,6,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:M1,diagram:e}},"loader"),xF={id:M1,detector:pF,loader:mF},j1="block",yF=b(e=>/^\s*block(-beta)?/.test(e),"detector"),bF=b(async()=>{const{diagram:e}=await Ue(async()=>{const{diagram:t}=await import("./blockDiagram-VD42YOAC-4H3KjsGf.js");return{diagram:t}},__vite__mapDeps([62,28,5,2,1,31,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:j1,diagram:e}},"loader"),kF={id:j1,detector:yF,loader:bF},wF=kF,I1="architecture",vF=b(e=>/^\s*architecture/.test(e),"detector"),CF=b(async()=>{const{diagram:e}=await Ue(async()=>{const{diagram:t}=await import("./architectureDiagram-VXUJARFQ-BIodTu6s.js");return{diagram:t}},__vite__mapDeps([63,34,36,8,7,2,4,5,24,6,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:I1,diagram:e}},"loader"),SF={id:I1,detector:vF,loader:CF},_F=SF,L1="treemap",TF=b(e=>/^\s*treemap/.test(e),"detector"),NF=b(async()=>{const{diagram:e}=await Ue(async()=>{const{diagram:t}=await import("./diagram-PSM6KHXK-BFjWOHNz.js");return{diagram:t}},__vite__mapDeps([64,30,34,36,8,7,2,4,5,40,44,39,6,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:L1,diagram:e}},"loader"),EF={id:L1,detector:TF,loader:NF},vp=!1,Wl=b(()=>{vp||(vp=!0,Ao("error",UP,e=>e.toLowerCase().trim()==="error"),Ao("---",{db:{clear:b(()=>{},"clear")},styles:{},renderer:{draw:b(()=>{},"draw")},parser:{parse:b(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:b(()=>null,"init")},e=>e.toLowerCase().trimStart().startsWith("---")),mu(XP,nF,_F),mu(LR,oF,AP,_P,UR,JR,rP,iP,xP,wP,zR,RR,JP,XR,RP,LP,zP,cP,hF,gF,fP,wF,xF,EF))},"addDiagrams"),AF=b(async()=>{K.debug("Loading registered diagrams");const t=(await Promise.allSettled(Object.entries(ss).map(async([r,{detector:n,loader:s}])=>{if(s)try{ku(r)}catch{try{const{diagram:i,id:a}=await s();Ao(a,i,n)}catch(i){throw K.error(`Failed to load external diagram with key ${r}. Removing from detectors.`),delete ss[r],i}}}))).filter(r=>r.status==="rejected");if(t.length>0){K.error(`Failed to load ${t.length} external diagrams`);for(const r of t)K.error(r);throw new Error(`Failed to load ${t.length} external diagrams`)}},"loadRegisteredDiagrams"),MF="graphics-document document";function $1(e,t){e.attr("role",MF),t!==""&&e.attr("aria-roledescription",t)}b($1,"setA11yDiagramInfo");function D1(e,t,r,n){if(e.insert!==void 0){if(r){const s=`chart-desc-${n}`;e.attr("aria-describedby",s),e.insert("desc",":first-child").attr("id",s).text(r)}if(t){const s=`chart-title-${n}`;e.attr("aria-labelledby",s),e.insert("title",":first-child").attr("id",s).text(t)}}}b(D1,"addSVGa11yTitleDescription");var es,uh=(es=class{constructor(t,r,n,s,i){this.type=t,this.text=r,this.db=n,this.parser=s,this.renderer=i}static async fromText(t,r={}){const n=$t(),s=Vh(t,n);t=ED(t)+`
380
+ `;try{ku(s)}catch{const c=ZE(s);if(!c)throw new R0(`Diagram ${s} not found.`);const{id:u,diagram:h}=await c();Ao(u,h)}const{db:i,parser:a,renderer:o,init:l}=ku(s);return a.parser&&(a.parser.yy=i),i.clear?.(),l?.(n),r.title&&i.setDiagramTitle?.(r.title),await a.parse(t),new es(s,t,i,a,o)}async render(t,r){await this.renderer.draw(this.text,t,r,this)}getParser(){return this.parser}getType(){return this.type}},b(es,"Diagram"),es),Cp=[],jF=b(()=>{Cp.forEach(e=>{e()}),Cp=[]},"attachFunctions"),IF=b(e=>e.replace(/^\s*%%(?!{)[^\n]+\n?/gm,"").trimStart(),"cleanupComments");function B1(e){const t=e.match(B0);if(!t)return{text:e,metadata:{}};let r=A$(t[1],{schema:E$})??{};r=typeof r=="object"&&!Array.isArray(r)?r:{};const n={};return r.displayMode&&(n.displayMode=r.displayMode.toString()),r.title&&(n.title=r.title.toString()),r.config&&(n.config=r.config),{text:e.slice(t[0].length),metadata:n}}b(B1,"extractFrontMatter");var LF=b(e=>e.replace(/\r\n?/g,`
381
+ `).replace(/<(\w+)([^>]*)>/g,(t,r,n)=>"<"+r+n.replace(/="([^"]*)"/g,"='$1'")+">"),"cleanupText"),$F=b(e=>{const{text:t,metadata:r}=B1(e),{displayMode:n,title:s,config:i={}}=r;return n&&(i.gantt||(i.gantt={}),i.gantt.displayMode=n),{title:s,config:i,text:t}},"processFrontmatter"),DF=b(e=>{const t=Er.detectInit(e)??{},r=Er.detectDirective(e,"wrap");return Array.isArray(r)?t.wrap=r.some(({type:n})=>n==="wrap"):r?.type==="wrap"&&(t.wrap=!0),{text:pD(e),directive:t}},"processDirectives");function Ud(e){const t=LF(e),r=$F(t),n=DF(r.text),s=Ed(r.config,n.directive);return e=IF(n.text),{code:e,title:r.title,config:s}}b(Ud,"preprocessDiagram");function R1(e){const t=new TextEncoder().encode(e),r=Array.from(t,n=>String.fromCodePoint(n)).join("");return btoa(r)}b(R1,"toBase64");var BF=5e4,RF="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa",PF="sandbox",FF="loose",OF="http://www.w3.org/2000/svg",zF="http://www.w3.org/1999/xlink",WF="http://www.w3.org/1999/xhtml",HF="100%",qF="100%",UF="border:0;margin:0;",VF="margin:0",GF="allow-top-navigation-by-user-activation allow-popups",YF='The "iframe" tag is not supported by your browser.',XF=["foreignobject"],KF=["dominant-baseline"];function Vd(e){const t=Ud(e);return No(),gA(t.config??{}),t}b(Vd,"processAndSetConfigs");async function P1(e,t){Wl();try{const{code:r,config:n}=Vd(e);return{diagramType:(await O1(r)).type,config:n}}catch(r){if(t?.suppressErrors)return!1;throw r}}b(P1,"parse");var Sp=b((e,t,r=[])=>`
382
+ .${e} ${t} { ${r.join(" !important; ")} !important; }`,"cssImportantStyles"),QF=b((e,t=new Map)=>{let r="";if(e.themeCSS!==void 0&&(r+=`
383
+ ${e.themeCSS}`),e.fontFamily!==void 0&&(r+=`
384
+ :root { --mermaid-font-family: ${e.fontFamily}}`),e.altFontFamily!==void 0&&(r+=`
385
+ :root { --mermaid-alt-font-family: ${e.altFontFamily}}`),t instanceof Map){const a=e.htmlLabels??e.flowchart?.htmlLabels?["> *","span"]:["rect","polygon","ellipse","circle","path"];t.forEach(o=>{wp(o.styles)||a.forEach(l=>{r+=Sp(o.id,l,o.styles)}),wp(o.textStyles)||(r+=Sp(o.id,"tspan",(o?.textStyles||[]).map(l=>l.replace("color","fill"))))})}return r},"createCssStyles"),ZF=b((e,t,r,n)=>{const s=QF(e,r),i=$A(t,s,e.themeVariables);return ih(fR(`${n}{${i}}`),pR)},"createUserStyles"),JF=b((e="",t,r)=>{let n=e;return!r&&!t&&(n=n.replace(/marker-end="url\([\d+./:=?A-Za-z-]*?#/g,'marker-end="url(#')),n=ps(n),n=n.replace(/<br>/g,"<br/>"),n},"cleanUpSvgCode"),eO=b((e="",t)=>{const r=t?.viewBox?.baseVal?.height?t.viewBox.baseVal.height+"px":qF,n=R1(`<body style="${VF}">${e}</body>`);return`<iframe style="width:${HF};height:${r};${UF}" src="data:text/html;charset=UTF-8;base64,${n}" sandbox="${GF}">
386
+ ${YF}
387
+ </iframe>`},"putIntoIFrame"),_p=b((e,t,r,n,s)=>{const i=e.append("div");i.attr("id",r),n&&i.attr("style",n);const a=i.append("svg").attr("id",t).attr("width","100%").attr("xmlns",OF);return s&&a.attr("xmlns:xlink",s),a.append("g"),e},"appendDivSvgG");function hh(e,t){return e.append("iframe").attr("id",t).attr("style","width: 100%; height: 100%;").attr("sandbox","")}b(hh,"sandboxedIframe");var tO=b((e,t,r,n)=>{e.getElementById(t)?.remove(),e.getElementById(r)?.remove(),e.getElementById(n)?.remove()},"removeExistingElements"),rO=b(async function(e,t,r){Wl();const n=Vd(t);t=n.code;const s=$t();K.debug(s),t.length>(s?.maxTextSize??BF)&&(t=RF);const i="#"+e,a="i"+e,o="#"+a,l="d"+e,c="#"+l,u=b(()=>{const R=Oe(f?o:c).node();R&&"remove"in R&&R.remove()},"removeTempElements");let h=Oe("body");const f=s.securityLevel===PF,g=s.securityLevel===FF,p=s.fontFamily;if(r!==void 0){if(r&&(r.innerHTML=""),f){const N=hh(Oe(r),a);h=Oe(N.nodes()[0].contentDocument.body),h.node().style.margin=0}else h=Oe(r);_p(h,e,l,`font-family: ${p}`,zF)}else{if(tO(document,e,l,a),f){const N=hh(Oe("body"),a);h=Oe(N.nodes()[0].contentDocument.body),h.node().style.margin=0}else h=Oe("body");_p(h,e,l)}let m,y;try{m=await uh.fromText(t,{title:n.title})}catch(N){if(s.suppressErrorRendering)throw u(),N;m=await uh.fromText("error"),y=N}const x=h.select(c).node(),k=m.type,C=x.firstChild,T=C.firstChild,S=m.renderer.getClasses?.(t,m),w=ZF(s,k,S,i),_=document.createElement("style");_.innerHTML=w,C.insertBefore(_,T);try{await m.renderer.draw(t,e,Uf.version,m)}catch(N){throw s.suppressErrorRendering?u():HP.draw(t,e,Uf.version),N}const O=h.select(`${c} svg`),P=m.db.getAccTitle?.(),v=m.db.getAccDescription?.();z1(k,O,P,v),h.select(`[id="${e}"]`).selectAll("foreignobject > *").attr("xmlns",WF);let L=h.select(c).node().innerHTML;if(K.debug("config.arrowMarkerAbsolute",s.arrowMarkerAbsolute),L=JF(L,f,_t(s.arrowMarkerAbsolute)),f){const N=h.select(c+" svg").node();L=eO(L,N)}else g||(L=Gs.sanitize(L,{ADD_TAGS:XF,ADD_ATTR:KF,HTML_INTEGRATION_POINTS:{foreignobject:!0}}));if(jF(),y)throw y;return u(),{diagramType:k,svg:L,bindFunctions:m.db.bindFunctions}},"render");function F1(e={}){const t=Ct({},e);t?.fontFamily&&!t.themeVariables?.fontFamily&&(t.themeVariables||(t.themeVariables={}),t.themeVariables.fontFamily=t.fontFamily),dA(t),t?.theme&&t.theme in an?t.themeVariables=an[t.theme].getThemeVariables(t.themeVariables):t&&(t.themeVariables=an.default.getThemeVariables(t.themeVariables));const r=typeof t=="object"?hA(t):W0();Uh(r.logLevel),Wl()}b(F1,"initialize");var O1=b((e,t={})=>{const{code:r}=Ud(e);return uh.fromText(r,t)},"getDiagramFromText");function z1(e,t,r,n){$1(t,e),D1(t,r,n,t.attr("id"))}b(z1,"addA11yInfo");var us=Object.freeze({render:rO,parse:P1,getDiagramFromText:O1,initialize:F1,getConfig:$t,setConfig:H0,getSiteConfig:W0,updateSiteConfig:fA,reset:b(()=>{No()},"reset"),globalReset:b(()=>{No(Ys)},"globalReset"),defaultConfig:Ys});Uh($t().logLevel);No($t());var nO=b((e,t,r)=>{K.warn(e),Nd(e)?(r&&r(e.str,e.hash),t.push({...e,message:e.str,error:e})):(r&&r(e),e instanceof Error&&t.push({str:e.message,message:e.message,hash:e.name,error:e}))},"handleError"),W1=b(async function(e={querySelector:".mermaid"}){try{await sO(e)}catch(t){if(Nd(t)&&K.error(t.str),un.parseError&&un.parseError(t),!e.suppressErrors)throw K.error("Use the suppressErrors option to suppress these errors"),t}},"run"),sO=b(async function({postRenderCallback:e,querySelector:t,nodes:r}={querySelector:".mermaid"}){const n=us.getConfig();K.debug(`${e?"":"No "}Callback function found`);let s;if(r)s=r;else if(t)s=document.querySelectorAll(t);else throw new Error("Nodes and querySelector are both undefined");K.debug(`Found ${s.length} diagrams`),n?.startOnLoad!==void 0&&(K.debug("Start On Load: "+n?.startOnLoad),us.updateSiteConfig({startOnLoad:n?.startOnLoad}));const i=new Er.InitIDGenerator(n.deterministicIds,n.deterministicIDSeed);let a;const o=[];for(const l of Array.from(s)){if(K.info("Rendering diagram: "+l.id),l.getAttribute("data-processed"))continue;l.setAttribute("data-processed","true");const c=`mermaid-${i.next()}`;a=l.innerHTML,a=ck(Er.entityDecode(a)).trim().replace(/<br\s*\/?>/gi,"<br/>");const u=Er.detectInit(a);u&&K.debug("Detected early reinit: ",u);try{const{svg:h,bindFunctions:f}=await V1(c,a,l);l.innerHTML=h,e&&await e(c),f&&f(l)}catch(h){nO(h,o,un.parseError)}}if(o.length>0)throw o[0]},"runThrowsErrors"),H1=b(function(e){us.initialize(e)},"initialize"),iO=b(async function(e,t,r){K.warn("mermaid.init is deprecated. Please use run instead."),e&&H1(e);const n={postRenderCallback:r,querySelector:".mermaid"};typeof t=="string"?n.querySelector=t:t&&(t instanceof HTMLElement?n.nodes=[t]:n.nodes=t),await W1(n)},"init"),aO=b(async(e,{lazyLoad:t=!0}={})=>{Wl(),mu(...e),t===!1&&await AF()},"registerExternalDiagrams"),q1=b(function(){if(un.startOnLoad){const{startOnLoad:e}=us.getConfig();e&&un.run().catch(t=>K.error("Mermaid failed to initialize",t))}},"contentLoaded");typeof document<"u"&&window.addEventListener("load",q1,!1);var oO=b(function(e){un.parseError=e},"setParseErrorHandler"),al=[],Uc=!1,U1=b(async()=>{if(!Uc){for(Uc=!0;al.length>0;){const e=al.shift();if(e)try{await e()}catch(t){K.error("Error executing queue",t)}}Uc=!1}},"executeQueue"),lO=b(async(e,t)=>new Promise((r,n)=>{const s=b(()=>new Promise((i,a)=>{us.parse(e,t).then(o=>{i(o),r(o)},o=>{K.error("Error parsing",o),un.parseError?.(o),a(o),n(o)})}),"performCall");al.push(s),U1().catch(n)}),"parse"),V1=b((e,t,r)=>new Promise((n,s)=>{const i=b(()=>new Promise((a,o)=>{us.render(e,t,r).then(l=>{a(l),n(l)},l=>{K.error("Error parsing",l),un.parseError?.(l),o(l),s(l)})}),"performCall");al.push(i),U1().catch(s)}),"render"),cO=b(()=>Object.keys(ss).map(e=>({id:e})),"getRegisteredDiagramsMetadata"),un={startOnLoad:!0,mermaidAPI:us,parse:lO,render:V1,init:iO,run:W1,registerExternalDiagrams:aO,registerLayoutLoaders:Jw,initialize:H1,parseError:void 0,contentLoaded:q1,setParseErrorHandler:oO,detectType:Vh,registerIconPacks:I3,getRegisteredDiagramsMetadata:cO},Tp=un;/*! Check if previously processed *//*!
388
+ * Wait for document loaded before starting the execution
389
+ */let uO=0;const hO=({code:e,isDark:t=!1})=>{const r=M.useRef(null),n=M.useRef(null),s=M.useRef(null),[i,a]=M.useState(null),[o]=M.useState(()=>`mermaid-diagram-${++uO}`),[l,c]=M.useState(!1),[u,h]=M.useState(!1),[f,g]=M.useState(!1),[p,m]=M.useState(0),y=async()=>{try{await navigator.clipboard.writeText(e),h(!0),setTimeout(()=>h(!1),2e3)}catch(w){console.error("复制失败:",w)}},x=async(w,_,O=!1,P=!1)=>{try{Tp.initialize({startOnLoad:!1,theme:t?"dark":"default",securityLevel:"strict",fontFamily:"ui-sans-serif, system-ui, sans-serif",suppressErrorRendering:!0,themeVariables:{darkMode:t}}),w.innerHTML="";const{svg:v}=await Tp.render(_,e),L=document.createElement("div");L.className="flex justify-center items-start w-full h-full",L.innerHTML=v,w.innerHTML="",w.appendChild(L);const N=L.querySelector("svg");if(N){const R=N.getAttribute("viewBox"),j=N.getAttribute("width"),B=N.getAttribute("height");!R&&j&&B&&N.setAttribute("viewBox",`0 0 ${j} ${B}`);let I=0,F=0;const W=R||(j&&B?`0 0 ${j} ${B}`:null);if(W){const ee=W.split(/\s+/);ee.length===4&&(I=parseFloat(ee[2]),F=parseFloat(ee[3]))}N.removeAttribute("width"),N.removeAttribute("height"),P?(O?(N.style.maxWidth="100%",N.style.maxHeight="100%",N.style.width="auto",N.style.height="auto"):(N.style.maxWidth="100%",N.style.maxHeight="560px",N.style.width="auto",N.style.height="auto"),O&&I&&F&&console.log("适应模式:以当前显示为 100% 基准")):(N.style.maxWidth="none",N.style.maxHeight="none",N.style.width="auto",N.style.height="auto")}a(null)}catch(v){console.error("Mermaid 渲染错误:",v),a(v instanceof Error?v.message:"渲染图表时发生错误"),setTimeout(()=>{document.querySelectorAll('[id^="dmermaid"], .error-icon, .error-text').forEach(N=>N.remove())},100)}};M.useEffect(()=>{r.current&&x(r.current,o,!1,!0)},[e,t,o]),M.useEffect(()=>{if(f&&n.current){const w=s.current,_=w?{x:w.scrollLeft,y:w.scrollTop}:null,O=p===0;x(n.current,`${o}-fullscreen`,!0,O),_&&w&&p!==0&&setTimeout(()=>{w.scrollLeft=_.x,w.scrollTop=_.y},50)}},[f,e,t,o,p]);const k=w=>{m(w)},C=()=>p===0?100:p,T=()=>{const w=C(),_=Math.min(200,w+10);console.log("放大:",{baseZoom:w,newZoom:_,zoomLevel:p}),k(_)},S=()=>{const w=C(),_=Math.max(50,w-10);console.log("缩小:",{baseZoom:w,newZoom:_,zoomLevel:p}),k(_)};return i?d.jsx("div",{className:"my-2 border border-red-300 dark:border-red-700 rounded-lg overflow-hidden bg-white dark:bg-gray-800",children:d.jsxs("details",{className:"group",children:[d.jsxs("summary",{className:"flex items-center gap-2 px-3 py-2 cursor-pointer bg-red-50 dark:bg-red-900/20 hover:bg-red-100 dark:hover:bg-red-900/30 transition-colors list-none",children:[d.jsx("svg",{className:"w-4 h-4 text-red-500 dark:text-red-400 flex-shrink-0",viewBox:"0 0 20 20",fill:"currentColor",children:d.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})}),d.jsx("span",{className:"text-sm font-medium text-red-800 dark:text-red-200 flex-1",children:"Mermaid 图表语法错误"}),d.jsx("svg",{className:"w-4 h-4 text-red-600 dark:text-red-400 transition-transform group-open:rotate-180",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),d.jsx("div",{className:"border-t border-red-200 dark:border-red-800",children:d.jsxs("div",{className:"p-3 bg-red-50 dark:bg-red-900/10",children:[d.jsxs("div",{className:"mb-3",children:[d.jsx("div",{className:"text-xs font-medium text-red-700 dark:text-red-300 mb-1",children:"错误信息:"}),d.jsx("div",{className:"text-xs text-red-600 dark:text-red-400 bg-white dark:bg-gray-900 p-2 rounded border border-red-200 dark:border-red-800 font-mono",children:i})]}),d.jsxs("div",{children:[d.jsx("div",{className:"text-xs font-medium text-red-700 dark:text-red-300 mb-1",children:"原始代码:"}),d.jsx("pre",{className:"text-xs bg-white dark:bg-gray-900 p-2 rounded border border-red-200 dark:border-red-800 overflow-x-auto max-h-40 overflow-y-auto",children:d.jsx("code",{className:"text-red-800 dark:text-red-200 font-mono",children:e})})]})]})})]})}):d.jsxs("div",{className:"my-4 border border-gray-200 dark:border-gray-700 rounded-lg bg-white dark:bg-gray-800",children:[d.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-900/50",children:[d.jsx("div",{className:"flex items-center space-x-2",children:d.jsxs("div",{className:"flex items-center text-xs text-gray-500 dark:text-gray-400",children:[d.jsx("svg",{className:"w-4 h-4 mr-1.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"})}),d.jsx("span",{className:"font-medium",children:"Mermaid 图表"})]})}),d.jsxs("div",{className:"flex items-center space-x-1",children:[d.jsx("button",{onClick:()=>g(!0),className:"p-1.5 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-400 transition-colors",title:"全屏查看",children:d.jsx(dv,{className:"w-4 h-4"})}),d.jsx("button",{onClick:()=>c(!l),className:"p-1.5 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-400 transition-colors",title:l?"隐藏源码":"查看源码",children:d.jsx(fv,{className:"w-4 h-4"})}),d.jsx("button",{onClick:y,className:"p-1.5 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-400 transition-colors",title:"复制源码",children:u?d.jsx(Qp,{className:"w-4 h-4 text-green-600 dark:text-green-400"}):d.jsx(Xc,{className:"w-4 h-4"})})]})]}),d.jsx("div",{ref:r,className:"flex items-center justify-center py-3 px-4",style:{maxHeight:"600px",minHeight:"200px"}}),l&&d.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700",children:d.jsx("div",{className:"bg-gray-900 dark:bg-gray-950 p-4 rounded-b-lg overflow-x-auto",children:d.jsx("pre",{className:"text-sm text-gray-100 font-mono",children:d.jsx("code",{children:e})})})}),f&&d.jsx("div",{className:"fixed inset-0 z-50 bg-black/80 flex items-center justify-center p-4",children:d.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-lg shadow-2xl w-full h-full max-w-7xl max-h-[90vh] flex flex-col",children:[d.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800",children:[d.jsx("div",{className:"flex items-center space-x-2",children:d.jsxs("div",{className:"flex items-center text-sm text-gray-500 dark:text-gray-400",children:[d.jsx("svg",{className:"w-5 h-5 mr-2",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"})}),d.jsx("span",{className:"font-medium",children:"Mermaid 图表"})]})}),d.jsxs("div",{className:"flex items-center space-x-2",children:[d.jsxs("div",{className:"flex items-center space-x-1 border-r border-gray-300 dark:border-gray-600 pr-2 mr-2",children:[d.jsx("button",{onClick:S,className:"p-1.5 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-400 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",title:`缩小 (当前${C()}%)`,disabled:C()<=50,children:d.jsx(Zp,{className:"w-4 h-4"})}),d.jsx("span",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 min-w-[4rem] text-center",children:p===0?"适应":`${p}%`}),d.jsx("button",{onClick:T,className:"p-1.5 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-400 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",title:`放大 (当前${C()}%)`,disabled:C()>=200,children:d.jsx(Jp,{className:"w-4 h-4"})}),d.jsx("button",{onClick:()=>k(100),className:"px-2 py-1 text-xs rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-400 transition-colors",title:"100% 原始大小",children:"100%"}),d.jsx("button",{onClick:()=>k(0),className:`px-2 py-1 text-xs rounded transition-colors ${p===0?"bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300":"hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-400"}`,title:"适应窗口大小",children:"适应"})]}),d.jsx("button",{onClick:()=>{g(!1),m(0)},className:"p-1.5 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-400 transition-colors",title:"关闭",children:d.jsx(ts,{className:"w-5 h-5"})})]})]}),d.jsx("div",{ref:s,className:"flex-1 overflow-auto p-6 bg-gray-50 dark:bg-gray-900",children:d.jsx("div",{ref:n,className:p===0?"w-full h-full flex items-center justify-center":"flex items-center justify-center min-h-full",style:p===0?{}:(()=>{const w=p/100;return console.log("应用变换:",{zoomLevel:p,scale:w,message:"适应模式为100%基准,直接应用缩放"}),{transform:`scale(${w})`,transformOrigin:"center center",transition:"transform 0.2s ease-in-out"}})()})})]})})]})},Ji=({content:e,isUserMessage:t=!1})=>{const[r,n]=M.useState(!1),s=i=>t?"text-white":i;return M.useEffect(()=>{const i=()=>{n(document.documentElement.classList.contains("dark"))};i();const a=new MutationObserver(i);return a.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>a.disconnect()},[]),d.jsx("div",{className:"break-words overflow-wrap-anywhere word-break-break-all",children:d.jsx(nT,{remarkPlugins:[mE],components:{code({inline:i,className:a,children:o,...l}){const c=/language-(\w+)/.exec(a||""),u=c?c[1]:"";return!i&&u==="mermaid"?d.jsx(hO,{code:String(o).replace(/\n$/,""),isDark:r}):!i&&c?d.jsx(hm,{style:E0,language:u,PreTag:"div",className:"rounded-md text-sm overflow-auto",wrapLines:!0,wrapLongLines:!0,...l,children:String(o).replace(/\n$/,"")}):d.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 text-gray-800 dark:text-gray-200 px-1 py-0.5 rounded text-sm font-mono",...l,children:o})},h1:({children:i})=>d.jsx("h1",{className:`text-lg font-bold mt-4 mb-2 ${s("text-gray-900 dark:text-gray-100")}`,children:i}),h2:({children:i})=>d.jsx("h2",{className:`text-base font-bold mt-3 mb-2 ${s("text-gray-900 dark:text-gray-100")}`,children:i}),h3:({children:i})=>d.jsx("h3",{className:`text-sm font-bold mt-2 mb-1 ${s("text-gray-900 dark:text-gray-100")}`,children:i}),p:({children:i})=>d.jsx("p",{className:`mb-2 leading-relaxed break-words overflow-wrap-anywhere ${s("text-gray-800 dark:text-gray-200")}`,children:i}),ul:({children:i})=>d.jsx("ul",{className:"list-disc list-inside mb-2 space-y-1",children:i}),ol:({children:i})=>d.jsx("ol",{className:"list-decimal list-inside mb-2 space-y-1",children:i}),li:({children:i})=>d.jsx("li",{className:`leading-relaxed break-words overflow-wrap-anywhere ${s("text-gray-800 dark:text-gray-200")}`,children:i}),blockquote:({children:i})=>d.jsx("blockquote",{className:`border-l-4 border-gray-300 dark:border-gray-600 pl-3 italic mb-2 ${s("text-gray-600 dark:text-gray-400")}`,children:i}),strong:({children:i})=>d.jsx("strong",{className:`font-semibold ${s("text-gray-900 dark:text-gray-100")}`,children:i}),em:({children:i})=>d.jsx("em",{className:"italic",children:i}),a:({children:i,href:a})=>d.jsx("a",{href:a,className:"text-blue-600 hover:text-blue-800 underline",target:"_blank",rel:"noopener noreferrer",children:i}),table:({children:i})=>d.jsx("table",{className:"border-collapse border border-gray-300 dark:border-gray-600 mb-2 text-sm",children:i}),th:({children:i})=>d.jsx("th",{className:`border border-gray-300 dark:border-gray-600 px-2 py-1 bg-gray-100 dark:bg-gray-800 font-semibold text-left ${s("text-gray-900 dark:text-gray-100")}`,children:i}),td:({children:i})=>d.jsx("td",{className:`border border-gray-300 dark:border-gray-600 px-2 py-1 ${s("text-gray-800 dark:text-gray-200")}`,children:i})},children:e})})},dO=({text:e,maxLength:t=300})=>{const{t:r}=de("components"),[n,s]=M.useState(!1),i=e.length>t,a=n||!i?e:e.substring(0,t)+"...";return d.jsxs("div",{children:[d.jsx("div",{className:"text-sm text-gray-800 dark:text-gray-200 whitespace-pre-wrap",children:a}),i&&d.jsx("button",{onClick:()=>s(!n),className:"mt-2 text-xs text-blue-600 dark:text-blue-400 hover:text-blue-800 dark:hover:text-blue-300 transition-colors",children:r(n?"subAgentMessageFlow.collapse":"subAgentMessageFlow.expand")})]})},fO=e=>({id:e.toolData?.id||e.id,toolName:e.toolData?.toolName||"Unknown",toolInput:e.toolData?.toolInput||{},toolResult:e.toolData?.toolResult,isExecuting:!1,isError:e.toolData?.isError,timestamp:new Date}),gO=({content:e})=>{const{t}=de("components"),[r,n]=M.useState(!1);return d.jsxs("details",{className:"my-2",open:r,onToggle:s=>n(s.target.open),children:[d.jsxs("summary",{className:"cursor-pointer text-gray-500 dark:text-gray-400 text-sm hover:text-gray-700 dark:hover:text-gray-300 transition-colors select-none",children:["💭 ",t("subAgentMessageFlow.thinking")]}),d.jsx("div",{className:"mt-2 pl-4 border-l-2 border-gray-200 dark:border-gray-700",children:d.jsx("div",{className:"text-gray-600 dark:text-gray-300 text-sm whitespace-pre-wrap break-words leading-relaxed italic",children:e})})]})},pO=e=>e.flatMap(t=>t.messageParts).sort((t,r)=>t.order-r.order),G1=({taskPrompt:e,messageFlow:t,defaultExpanded:r=!1})=>{const{t:n}=de("components"),[s,i]=M.useState(r),a=t.reduce((l,c)=>l+c.messageParts.filter(u=>u.type==="tool").length,0),o=pO(t);return d.jsxs("div",{className:"mt-3 border-t border-gray-200 dark:border-gray-700 pt-3",children:[d.jsxs("button",{onClick:()=>i(!s),className:"flex items-center space-x-2 text-sm text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 transition-colors w-full",children:[s?d.jsx(At,{className:"w-4 h-4 flex-shrink-0"}):d.jsx(qt,{className:"w-4 h-4 flex-shrink-0"}),d.jsx("span",{className:"font-medium",children:n("subAgentMessageFlow.title")}),d.jsxs("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:["(",n("subAgentMessageFlow.messageCount",{count:t.length}),", ",n("subAgentMessageFlow.toolCount",{count:a}),")"]})]}),s&&d.jsxs("div",{className:"mt-3 pl-3 border-l-2 border-purple-200 dark:border-purple-800 space-y-3",children:[d.jsxs("div",{className:"bg-blue-50 dark:bg-blue-900/30 rounded-lg p-3 border border-blue-200 dark:border-blue-800",children:[d.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[d.jsx(ro,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"}),d.jsx("span",{className:"text-xs font-medium text-blue-700 dark:text-blue-400",children:n("subAgentMessageFlow.taskInput")})]}),d.jsx(dO,{text:e,maxLength:300})]}),o.map(l=>l.type==="text"&&l.content?d.jsx("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:d.jsx(Ji,{content:l.content,isUserMessage:!1})},l.id):l.type==="thinking"&&l.content?d.jsx(gO,{content:l.content},l.id):l.type==="tool"&&l.toolData?d.jsx("div",{children:d.jsx(Z1,{execution:fO(l)})},l.id):null)]})]})},mO=e=>{if(e<1e3)return`${e}ms`;if(e<6e4)return`${(e/1e3).toFixed(1)}s`;const t=Math.floor(e/6e4),r=Math.floor(e%6e4/1e3);return`${t}m ${r}s`},xO=({result:e})=>{const{t}=de("components");return d.jsxs("div",{className:"flex flex-wrap gap-3 mt-3 text-xs",children:[e.status&&d.jsxs("div",{className:`flex items-center space-x-1 px-2 py-1 rounded ${e.status==="completed"?"bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400":e.status==="failed"?"bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-400":"bg-yellow-100 dark:bg-yellow-900/30 text-yellow-700 dark:text-yellow-400"}`,children:[e.status==="completed"?d.jsx(sn,{className:"w-3 h-3"}):e.status==="failed"?d.jsx(zi,{className:"w-3 h-3"}):d.jsx(rs,{className:"w-3 h-3"}),d.jsx("span",{children:t(`taskTool.status.${e.status}`)})]}),e.totalDurationMs!==void 0&&d.jsxs("div",{className:"flex items-center space-x-1 px-2 py-1 bg-gray-100 dark:bg-gray-700 rounded text-gray-600 dark:text-gray-400",children:[d.jsx(Ar,{className:"w-3 h-3"}),d.jsx("span",{children:mO(e.totalDurationMs)})]}),e.totalToolUseCount!==void 0&&e.totalToolUseCount>0&&d.jsxs("div",{className:"flex items-center space-x-1 px-2 py-1 bg-blue-100 dark:bg-blue-900/30 rounded text-blue-600 dark:text-blue-400",children:[d.jsx(no,{className:"w-3 h-3"}),d.jsx("span",{children:t("taskTool.toolCallCount",{count:e.totalToolUseCount})})]}),e.totalTokens!==void 0&&d.jsxs("div",{className:"flex items-center space-x-1 px-2 py-1 bg-purple-100 dark:bg-purple-900/30 rounded text-purple-600 dark:text-purple-400",children:[d.jsx(gv,{className:"w-3 h-3"}),d.jsxs("span",{children:[e.totalTokens.toLocaleString()," tokens"]})]})]})},yO=({execution:e})=>{const{t}=de("components"),r=e.toolInput,n=e.toolUseResult,s=e.claudeId||e.toolData?.claudeId;console.log("🎯 [TaskTool] claudeId:",s,"isExecuting:",e.isExecuting);const i=tu(u=>u.activeTasks),a=s?i.get(s):void 0;s&&console.log("🎯 [TaskTool] activeTask:",a?`found with ${a.messageFlow.length} messages`:"not found");const o=M.useMemo(()=>!e.isExecuting&&n?.subAgentMessageFlow?n.subAgentMessageFlow:a?.messageFlow&&a.messageFlow.length>0?a.messageFlow:n?.subAgentMessageFlow||[],[e.isExecuting,n?.subAgentMessageFlow,a?.messageFlow]),l=()=>{if(r.description)return r.description.trim()},c=r.prompt||n?.prompt||"";return d.jsx($e,{execution:e,subtitle:l(),showResult:!1,hideToolName:!1,children:d.jsxs("div",{className:"space-y-3",children:[d.jsx(je,{label:t("taskTool.taskDescriptionLabel"),value:r.description}),d.jsxs("div",{children:[d.jsx("span",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 block mb-1",children:t("taskTool.agentType")}),d.jsx("span",{className:"text-sm px-2 py-1 bg-blue-100 dark:bg-blue-900/30 text-blue-800 dark:text-blue-300 rounded",children:r.subagent_type})]}),r.model&&d.jsxs("div",{children:[d.jsx("span",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 block mb-1",children:t("taskTool.model")}),d.jsx("span",{className:`text-sm px-2 py-1 rounded ${r.model==="sonnet"?"bg-orange-100 dark:bg-orange-900/30 text-orange-800 dark:text-orange-300":r.model==="opus"?"bg-purple-100 dark:bg-purple-900/30 text-purple-800 dark:text-purple-300":"bg-green-100 dark:bg-green-900/30 text-green-800 dark:text-green-300"}`,children:r.model.charAt(0).toUpperCase()+r.model.slice(1)})]}),r.resume&&d.jsxs("div",{children:[d.jsx("span",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 block mb-1",children:t("taskTool.resumeTask")}),d.jsx("span",{className:"text-sm px-2 py-1 bg-amber-100 dark:bg-amber-900/30 text-amber-800 dark:text-amber-300 rounded",children:t("taskTool.fromPreviousExecution")}),d.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1 font-mono",children:r.resume})]}),e.isExecuting&&d.jsxs("div",{className:"flex items-center space-x-2 text-blue-600 dark:text-blue-400",children:[d.jsx(Tn,{className:"w-4 h-4 animate-spin"}),d.jsx("span",{className:"text-sm",children:r.model?t("taskTool.executingWithModel",{model:r.model}):t("taskTool.executing")}),a&&d.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:["(",a.messageFlow.reduce((u,h)=>u+h.messageParts.length,0)," ",t("taskTool.partsReceived"),")"]})]}),!e.isExecuting&&n&&d.jsx(xO,{result:n}),o.length>0&&c&&d.jsx(G1,{taskPrompt:c,messageFlow:o,defaultExpanded:e.isExecuting})]})})},bO=({execution:e})=>{const{t}=de("components"),r=e.toolInput,n=()=>{if(r.command)return r.command.trim()},s=()=>e.isExecuting?t("bashTool.executing"):e.isError?e.toolResult||t("bashTool.executionError"):e.toolResult||"";return d.jsx($e,{execution:e,subtitle:n(),showResult:!1,hideToolName:!1,children:d.jsxs("div",{className:"space-y-3",children:[r.description&&d.jsx("div",{className:"text-sm text-gray-600 mb-2",children:r.description}),d.jsxs("div",{className:"bg-gray-900 rounded-lg p-4 font-mono text-sm",children:[d.jsxs("div",{className:"flex items-start",children:[d.jsx("span",{className:"text-green-400 mr-2 select-none",children:"$"}),d.jsx("span",{className:"text-white break-all flex-1",children:r.command})]}),!e.isExecuting&&e.toolResult&&d.jsx("div",{className:"mt-2",children:d.jsx("pre",{className:`whitespace-pre-wrap break-words ${e.isError?"text-red-400":"text-gray-300"}`,children:s()})}),e.isExecuting&&d.jsx("div",{className:"mt-2",children:d.jsx("span",{className:"text-yellow-400 animate-pulse",children:t("bashTool.executing")})})]}),r.timeout&&d.jsx("div",{className:"text-xs text-gray-500",children:t("bashTool.timeout",{timeout:r.timeout})})]})})},kO=({execution:e})=>{const{t}=de("components"),r=e.toolInput,n=()=>{if(r.pattern)return r.pattern},s=i=>!i||!i.trim()?t("globTool.noFilesFound"):(i.trim().split(`
390
+ `).filter(o=>o.trim()).length===0,i);return d.jsxs($e,{execution:e,subtitle:n(),hideToolName:!1,showResult:!1,children:[d.jsxs("div",{children:[d.jsx(je,{label:t("globTool.patternLabel"),value:r.pattern,isCode:!0}),r.path&&d.jsx(je,{label:t("globTool.pathLabel"),value:r.path})]}),e.toolResult&&!e.isError&&d.jsxs("div",{className:"mt-3",children:[d.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 mb-2",children:t("globTool.matchingResults")}),d.jsx("div",{className:"p-3 rounded-md border bg-blue-50 dark:bg-blue-900/20 border-blue-200 dark:border-blue-700 text-sm font-mono whitespace-pre-wrap break-words text-blue-700 dark:text-blue-300",children:s(e.toolResult)})]})]})},wO=({execution:e})=>{const{t}=de("components"),r=e.toolInput,n=()=>{if(r.pattern)return`"${r.pattern}"`},s=i=>{if(!i.trim())return t("grepTool.noMatchesFound");const a=r.output_mode||"files_with_matches";return a==="files_with_matches"?i:a==="count"?`${t("grepTool.matchStatistics")}:
391
+
392
+ ${i}`:i};return d.jsxs($e,{execution:e,subtitle:n(),showResult:!1,hideToolName:!1,children:[d.jsxs("div",{children:[d.jsx(je,{label:t("grepTool.patternLabel"),value:r.pattern,isCode:!0}),r.path&&d.jsx(je,{label:t("grepTool.pathLabel"),value:r.path}),r.glob&&d.jsx(je,{label:t("grepTool.globLabel"),value:r.glob}),r.type&&d.jsx(je,{label:t("grepTool.typeLabel"),value:r.type}),r.output_mode&&d.jsx(je,{label:t("grepTool.outputModeLabel"),value:r.output_mode}),d.jsxs("div",{className:"flex flex-wrap gap-2 mt-2",children:[r["-i"]&&d.jsx("span",{className:"px-2 py-1 bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 text-xs rounded",children:t("grepTool.ignoreCase")}),r["-n"]&&d.jsx("span",{className:"px-2 py-1 bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 text-xs rounded",children:t("grepTool.showLineNumbers")}),r["-A"]&&d.jsx("span",{className:"px-2 py-1 bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 text-xs rounded",children:t("grepTool.afterLines",{count:r["-A"]})}),r["-B"]&&d.jsx("span",{className:"px-2 py-1 bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 text-xs rounded",children:t("grepTool.beforeLines",{count:r["-B"]})}),r["-C"]&&d.jsx("span",{className:"px-2 py-1 bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 text-xs rounded",children:t("grepTool.contextLines",{count:r["-C"]})}),r.multiline&&d.jsx("span",{className:"px-2 py-1 bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 text-xs rounded",children:t("grepTool.multilineMode")})]})]}),e.toolResult&&!e.isError&&d.jsxs("div",{className:"mt-3",children:[d.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 mb-2",children:t("grepTool.searchResults")}),d.jsx("div",{className:"p-3 rounded-md border bg-green-50 dark:bg-green-900/20 border-green-200 dark:border-green-700 text-sm font-mono whitespace-pre-wrap break-words text-green-700 dark:text-green-300",children:s(e.toolResult)})]})]})},vO=({execution:e})=>{const{t}=de("components"),r=e.toolInput,n=()=>{if(!r.path)return;const s=r.path;return s.split("/").slice(-2).join("/")||s};return d.jsxs($e,{execution:e,subtitle:n(),hideToolName:!1,children:[d.jsxs("div",{children:[d.jsx(je,{label:t("lsTool.directoryPath"),value:r.path}),r.ignore&&r.ignore.length>0&&d.jsx(je,{label:t("lsTool.ignorePatterns"),value:r.ignore.join(", ")})]}),e.toolResult&&!e.isError&&d.jsxs("div",{className:"mt-3",children:[d.jsx("p",{className:"text-xs font-medium text-gray-600 mb-2",children:t("lsTool.directoryStructure")}),d.jsx("div",{className:"p-3 rounded-md border bg-yellow-50 border-yellow-200 text-sm font-mono whitespace-pre-wrap break-words text-yellow-800",children:e.toolResult})]})]})},CO=({execution:e})=>{const{t}=de("components"),r=e.toolInput;return d.jsx($e,{execution:e,hideToolName:!1,children:d.jsxs("div",{children:[d.jsxs("div",{className:"mb-3",children:[d.jsx("p",{className:"text-xs font-medium text-gray-600 mb-2",children:t("exitPlanModeTool.implementationPlan")}),d.jsx("div",{className:"p-3 rounded-md border bg-emerald-50 border-emerald-200",children:d.jsx("div",{className:"text-sm text-emerald-800 whitespace-pre-wrap break-words",children:r.plan})})]}),d.jsxs("div",{className:"text-xs text-emerald-600 bg-emerald-100 p-2 rounded",children:["📋 ",t("exitPlanModeTool.planModeExited")]})]})})},SO=({execution:e})=>{const{t}=de("components"),r=e.toolInput,n=()=>r.file_path?r.file_path.split("/").pop()||r.file_path:void 0;return d.jsx($e,{execution:e,subtitle:n(),showResult:!1,hideToolName:!1,children:d.jsxs("div",{children:[d.jsx(je,{label:t("readTool.readFile"),value:r.file_path}),r.offset&&d.jsx(je,{label:t("readTool.startLine"),value:r.offset}),r.limit&&d.jsx(je,{label:t("readTool.readLines"),value:r.limit})]})})};function Xr(){}Xr.prototype={diff:function(t,r){var n,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=s.callback;typeof s=="function"&&(i=s,s={});var a=this;function o(T){return T=a.postProcess(T,s),i?(setTimeout(function(){i(T)},0),!0):T}t=this.castInput(t,s),r=this.castInput(r,s),t=this.removeEmpty(this.tokenize(t,s)),r=this.removeEmpty(this.tokenize(r,s));var l=r.length,c=t.length,u=1,h=l+c;s.maxEditLength!=null&&(h=Math.min(h,s.maxEditLength));var f=(n=s.timeout)!==null&&n!==void 0?n:1/0,g=Date.now()+f,p=[{oldPos:-1,lastComponent:void 0}],m=this.extractCommon(p[0],r,t,0,s);if(p[0].oldPos+1>=c&&m+1>=l)return o(Np(a,p[0].lastComponent,r,t,a.useLongestToken));var y=-1/0,x=1/0;function k(){for(var T=Math.max(y,-u);T<=Math.min(x,u);T+=2){var S=void 0,w=p[T-1],_=p[T+1];w&&(p[T-1]=void 0);var O=!1;if(_){var P=_.oldPos-T;O=_&&0<=P&&P<l}var v=w&&w.oldPos+1<c;if(!O&&!v){p[T]=void 0;continue}if(!v||O&&w.oldPos<_.oldPos?S=a.addToPath(_,!0,!1,0,s):S=a.addToPath(w,!1,!0,1,s),m=a.extractCommon(S,r,t,T,s),S.oldPos+1>=c&&m+1>=l)return o(Np(a,S.lastComponent,r,t,a.useLongestToken));p[T]=S,S.oldPos+1>=c&&(x=Math.min(x,T-1)),m+1>=l&&(y=Math.max(y,T+1))}u++}if(i)(function T(){setTimeout(function(){if(u>h||Date.now()>g)return i();k()||T()},0)})();else for(;u<=h&&Date.now()<=g;){var C=k();if(C)return C}},addToPath:function(t,r,n,s,i){var a=t.lastComponent;return a&&!i.oneChangePerToken&&a.added===r&&a.removed===n?{oldPos:t.oldPos+s,lastComponent:{count:a.count+1,added:r,removed:n,previousComponent:a.previousComponent}}:{oldPos:t.oldPos+s,lastComponent:{count:1,added:r,removed:n,previousComponent:a}}},extractCommon:function(t,r,n,s,i){for(var a=r.length,o=n.length,l=t.oldPos,c=l-s,u=0;c+1<a&&l+1<o&&this.equals(n[l+1],r[c+1],i);)c++,l++,u++,i.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return u&&!i.oneChangePerToken&&(t.lastComponent={count:u,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=l,c},equals:function(t,r,n){return n.comparator?n.comparator(t,r):t===r||n.ignoreCase&&t.toLowerCase()===r.toLowerCase()},removeEmpty:function(t){for(var r=[],n=0;n<t.length;n++)t[n]&&r.push(t[n]);return r},castInput:function(t){return t},tokenize:function(t){return Array.from(t)},join:function(t){return t.join("")},postProcess:function(t){return t}};function Np(e,t,r,n,s){for(var i=[],a;t;)i.push(t),a=t.previousComponent,delete t.previousComponent,t=a;i.reverse();for(var o=0,l=i.length,c=0,u=0;o<l;o++){var h=i[o];if(h.removed)h.value=e.join(n.slice(u,u+h.count)),u+=h.count;else{if(!h.added&&s){var f=r.slice(c,c+h.count);f=f.map(function(g,p){var m=n[u+p];return m.length>g.length?m:g}),h.value=e.join(f)}else h.value=e.join(r.slice(c,c+h.count));c+=h.count,h.added||(u+=h.count)}}return i}function Ep(e,t){var r;for(r=0;r<e.length&&r<t.length;r++)if(e[r]!=t[r])return e.slice(0,r);return e.slice(0,r)}function Ap(e,t){var r;if(!e||!t||e[e.length-1]!=t[t.length-1])return"";for(r=0;r<e.length&&r<t.length;r++)if(e[e.length-(r+1)]!=t[t.length-(r+1)])return e.slice(-r);return e.slice(-r)}function dh(e,t,r){if(e.slice(0,t.length)!=t)throw Error("string ".concat(JSON.stringify(e)," doesn't start with prefix ").concat(JSON.stringify(t),"; this is a bug"));return r+e.slice(t.length)}function fh(e,t,r){if(!t)return e+r;if(e.slice(-t.length)!=t)throw Error("string ".concat(JSON.stringify(e)," doesn't end with suffix ").concat(JSON.stringify(t),"; this is a bug"));return e.slice(0,-t.length)+r}function ji(e,t){return dh(e,t,"")}function to(e,t){return fh(e,t,"")}function Mp(e,t){return t.slice(0,_O(e,t))}function _O(e,t){var r=0;e.length>t.length&&(r=e.length-t.length);var n=t.length;e.length<t.length&&(n=e.length);var s=Array(n),i=0;s[0]=0;for(var a=1;a<n;a++){for(t[a]==t[i]?s[a]=s[i]:s[a]=i;i>0&&t[a]!=t[i];)i=s[i];t[a]==t[i]&&i++}i=0;for(var o=r;o<e.length;o++){for(;i>0&&e[o]!=t[i];)i=s[i];e[o]==t[i]&&i++}return i}var ol="a-zA-Z0-9_\\u{C0}-\\u{FF}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",TO=new RegExp("[".concat(ol,"]+|\\s+|[^").concat(ol,"]"),"ug"),Hl=new Xr;Hl.equals=function(e,t,r){return r.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()};Hl.tokenize=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r;if(t.intlSegmenter){if(t.intlSegmenter.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');r=Array.from(t.intlSegmenter.segment(e),function(i){return i.segment})}else r=e.match(TO)||[];var n=[],s=null;return r.forEach(function(i){/\s/.test(i)?s==null?n.push(i):n.push(n.pop()+i):/\s/.test(s)?n[n.length-1]==s?n.push(n.pop()+i):n.push(s+i):n.push(i),s=i}),n};Hl.join=function(e){return e.map(function(t,r){return r==0?t:t.replace(/^\s+/,"")}).join("")};Hl.postProcess=function(e,t){if(!e||t.oneChangePerToken)return e;var r=null,n=null,s=null;return e.forEach(function(i){i.added?n=i:i.removed?s=i:((n||s)&&jp(r,s,n,i),r=i,n=null,s=null)}),(n||s)&&jp(r,s,n,null),e};function jp(e,t,r,n){if(t&&r){var s=t.value.match(/^\s*/)[0],i=t.value.match(/\s*$/)[0],a=r.value.match(/^\s*/)[0],o=r.value.match(/\s*$/)[0];if(e){var l=Ep(s,a);e.value=fh(e.value,a,l),t.value=ji(t.value,l),r.value=ji(r.value,l)}if(n){var c=Ap(i,o);n.value=dh(n.value,o,c),t.value=to(t.value,c),r.value=to(r.value,c)}}else if(r)e&&(r.value=r.value.replace(/^\s*/,"")),n&&(n.value=n.value.replace(/^\s*/,""));else if(e&&n){var u=n.value.match(/^\s*/)[0],h=t.value.match(/^\s*/)[0],f=t.value.match(/\s*$/)[0],g=Ep(u,h);t.value=ji(t.value,g);var p=Ap(ji(u,g),f);t.value=to(t.value,p),n.value=dh(n.value,u,p),e.value=fh(e.value,u,u.slice(0,u.length-p.length))}else if(n){var m=n.value.match(/^\s*/)[0],y=t.value.match(/\s*$/)[0],x=Mp(y,m);t.value=to(t.value,x)}else if(e){var k=e.value.match(/\s*$/)[0],C=t.value.match(/^\s*/)[0],T=Mp(k,C);t.value=ji(t.value,T)}}var NO=new Xr;NO.tokenize=function(e){var t=new RegExp("(\\r?\\n)|[".concat(ol,"]+|[^\\S\\n\\r]+|[^").concat(ol,"]"),"ug");return e.match(t)||[]};var ql=new Xr;ql.tokenize=function(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
393
+ `));var r=[],n=e.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(var s=0;s<n.length;s++){var i=n[s];s%2&&!t.newlineIsToken?r[r.length-1]+=i:r.push(i)}return r};ql.equals=function(e,t,r){return r.ignoreWhitespace?((!r.newlineIsToken||!e.includes(`
394
+ `))&&(e=e.trim()),(!r.newlineIsToken||!t.includes(`
395
+ `))&&(t=t.trim())):r.ignoreNewlineAtEof&&!r.newlineIsToken&&(e.endsWith(`
396
+ `)&&(e=e.slice(0,-1)),t.endsWith(`
397
+ `)&&(t=t.slice(0,-1))),Xr.prototype.equals.call(this,e,t,r)};function Ip(e,t,r){return ql.diff(e,t,r)}var EO=new Xr;EO.tokenize=function(e){return e.split(/(\S.+?[.!?])(?=\s+|$)/)};var AO=new Xr;AO.tokenize=function(e){return e.split(/([{}:;,]|\s+)/)};function Lp(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function $p(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Lp(Object(r),!0).forEach(function(n){IO(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Lp(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function MO(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function jO(e){var t=MO(e,"string");return typeof t=="symbol"?t:t+""}function gh(e){"@babel/helpers - typeof";return gh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gh(e)}function IO(e,t,r){return t=jO(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Vc(e){return LO(e)||$O(e)||DO(e)||BO()}function LO(e){if(Array.isArray(e))return ph(e)}function $O(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function DO(e,t){if(e){if(typeof e=="string")return ph(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ph(e,t)}}function ph(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function BO(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
398
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var pa=new Xr;pa.useLongestToken=!0;pa.tokenize=ql.tokenize;pa.castInput=function(e,t){var r=t.undefinedReplacement,n=t.stringifyReplacer,s=n===void 0?function(i,a){return typeof a>"u"?r:a}:n;return typeof e=="string"?e:JSON.stringify(mh(e,null,null,s),s," ")};pa.equals=function(e,t,r){return Xr.prototype.equals.call(pa,e.replace(/,([\r\n])/g,"$1"),t.replace(/,([\r\n])/g,"$1"),r)};function mh(e,t,r,n,s){t=t||[],r=r||[],n&&(e=n(s,e));var i;for(i=0;i<t.length;i+=1)if(t[i]===e)return r[i];var a;if(Object.prototype.toString.call(e)==="[object Array]"){for(t.push(e),a=new Array(e.length),r.push(a),i=0;i<e.length;i+=1)a[i]=mh(e[i],t,r,n,s);return t.pop(),r.pop(),a}if(e&&e.toJSON&&(e=e.toJSON()),gh(e)==="object"&&e!==null){t.push(e),a={},r.push(a);var o=[],l;for(l in e)Object.prototype.hasOwnProperty.call(e,l)&&o.push(l);for(o.sort(),i=0;i<o.length;i+=1)l=o[i],a[l]=mh(e[l],t,r,n,l);t.pop(),r.pop()}else a=e;return a}var xh=new Xr;xh.tokenize=function(e){return e.slice()};xh.join=xh.removeEmpty=function(e){return e};function RO(e,t,r,n,s,i,a){if(a||(a={}),typeof a=="function"&&(a={callback:a}),typeof a.context>"u"&&(a.context=4),a.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(a.callback){var o=a,l=o.callback;Ip(r,n,$p($p({},a),{},{callback:function(h){var f=c(h);l(f)}}))}else return c(Ip(r,n,a));function c(u){if(!u)return;u.push({value:"",lines:[]});function h(O){return O.map(function(P){return" "+P})}for(var f=[],g=0,p=0,m=[],y=1,x=1,k=function(){var P=u[C],v=P.lines||PO(P.value);if(P.lines=v,P.added||P.removed){var L;if(!g){var N=u[C-1];g=y,p=x,N&&(m=a.context>0?h(N.lines.slice(-a.context)):[],g-=m.length,p-=m.length)}(L=m).push.apply(L,Vc(v.map(function(F){return(P.added?"+":"-")+F}))),P.added?x+=v.length:y+=v.length}else{if(g)if(v.length<=a.context*2&&C<u.length-2){var R;(R=m).push.apply(R,Vc(h(v)))}else{var j,B=Math.min(v.length,a.context);(j=m).push.apply(j,Vc(h(v.slice(0,B))));var I={oldStart:g,oldLines:y-g+B,newStart:p,newLines:x-p+B,lines:m};f.push(I),g=0,p=0,m=[]}y+=v.length,x+=v.length}},C=0;C<u.length;C++)k();for(var T=0,S=f;T<S.length;T++)for(var w=S[T],_=0;_<w.lines.length;_++)w.lines[_].endsWith(`
399
+ `)?w.lines[_]=w.lines[_].slice(0,-1):(w.lines.splice(_+1,0,"\"),_++);return{oldFileName:e,newFileName:t,oldHeader:s,newHeader:i,hunks:f}}}function PO(e){var t=e.endsWith(`
400
+ `),r=e.split(`
401
+ `).map(function(n){return n+`
402
+ `});return t?r.pop():r.push(r.pop().slice(0,-1)),r}const Y1=({oldText:e,newText:t,oldStartLine:r=1,newStartLine:n=1})=>{const s=RO("old","new",e,t,"","",{context:3});return!s.hunks||s.hunks.length===0?d.jsx("pre",{className:"diff-container",children:d.jsx("code",{children:"No changes detected."})}):d.jsx("pre",{className:"diff-container",children:d.jsx("code",{children:s.hunks.map((i,a)=>{let o=i.oldStart+(r-1),l=i.newStart+(n-1);const c=i.oldStart+(r-1),u=i.newStart+(n-1);return d.jsxs("div",{className:"diff-hunk",children:[d.jsxs("div",{className:"hunk-header",children:[d.jsx("span",{className:"line-gutter",children:"..."}),d.jsx("span",{className:"line-content",children:`@@ -${c},${i.oldLines} +${u},${i.newLines} @@`})]}),i.lines.filter(h=>h.substring(1).trim()!=="No newline at end of file").map((h,f)=>{const g=h.startsWith("+")?"add":h.startsWith("-")?"del":"context";let p="diff-line",m="",y="";switch(g){case"add":p+=" diff-added",y=(l++).toString();break;case"del":p+=" diff-removed",m=(o++).toString();break;case"context":m=(o++).toString(),y=(l++).toString();break}return d.jsxs("div",{className:p,children:[d.jsxs("span",{className:"line-gutter",children:[m.padStart(4)," ",y.padStart(4)]}),d.jsx("span",{className:"line-prefix",children:h.charAt(0)}),d.jsx("span",{className:"line-content",children:h.substring(1)})]},f)})]},a)})})})},FO=({execution:e})=>{const{t}=de("components"),r=e.toolInput,n=e.toolUseResult,s=()=>r.file_path?r.file_path.split("/").pop()||r.file_path:void 0,i=()=>{if(n?.structuredPatch&&n.structuredPatch.length>0){const l=n.structuredPatch[0];return{oldStartLine:l.oldStart,newStartLine:l.newStart}}return{oldStartLine:1,newStartLine:1}},{oldStartLine:a,newStartLine:o}=i();return d.jsx($e,{execution:e,subtitle:s(),showResult:!1,hideToolName:!1,children:d.jsxs("div",{children:[d.jsx(je,{label:t("editTool.editFile"),value:r.file_path}),r.replace_all&&d.jsx(je,{label:t("editTool.replaceAll"),value:t("editTool.yes")}),d.jsx("div",{className:"mt-3",children:d.jsx(Y1,{oldText:r.old_string,newText:r.new_string,oldStartLine:a,newStartLine:o})})]})})},OO=({execution:e})=>{const{t}=de("components"),r=e.toolInput,n=Array.isArray(r?.edits)?r.edits:[],s=`${r.file_path} - ${t("multiEditTool.batchEdit",{count:n.length})}`;return d.jsx($e,{execution:e,showResult:!1,subtitle:s,hideToolName:!1,children:d.jsxs("div",{children:[d.jsx(je,{label:t("multiEditTool.filePath"),value:r.file_path}),d.jsxs("div",{className:"mt-3",children:[d.jsx("p",{className:"text-xs font-medium text-gray-600 mb-2",children:t("multiEditTool.batchEdit",{count:n.length})}),d.jsx("div",{className:"space-y-4 max-h-96 overflow-y-auto",children:n.map((i,a)=>d.jsxs("div",{className:"border border-gray-200 rounded-md bg-white",children:[d.jsx("div",{className:"px-3 py-2 bg-gray-50 border-b border-gray-200 rounded-t-md",children:d.jsxs("div",{className:"text-xs font-medium text-gray-600",children:[t("multiEditTool.operation",{number:a+1}),i.replace_all&&d.jsx("span",{className:"ml-2 px-2 py-1 bg-orange-200 text-orange-800 rounded text-xs",children:t("multiEditTool.replaceAll")})]})}),d.jsx("div",{className:"p-3",children:d.jsx(Y1,{oldText:i.old_string,newText:i.new_string})})]},a))})]})]})})},Dp={".js":"javascript",".jsx":"jsx",".ts":"typescript",".tsx":"tsx",".py":"python",".java":"java",".c":"c",".cpp":"cpp",".cc":"cpp",".cxx":"cpp",".h":"c",".hpp":"cpp",".cs":"csharp",".php":"php",".rb":"ruby",".go":"go",".rs":"rust",".swift":"swift",".kt":"kotlin",".scala":"scala",".sh":"bash",".bash":"bash",".zsh":"bash",".fish":"bash",".ps1":"powershell",".sql":"sql",".html":"html",".htm":"html",".xml":"xml",".css":"css",".scss":"scss",".sass":"sass",".less":"less",".json":"json",".yaml":"yaml",".yml":"yaml",".toml":"toml",".ini":"ini",".cfg":"ini",".conf":"ini",".dockerfile":"dockerfile",".docker":"dockerfile",".vim":"vim",".lua":"lua",".r":"r",".R":"r",".matlab":"matlab",".m":"matlab",".pl":"perl",".pm":"perl",".tex":"latex",".cls":"latex",".sty":"latex",".md":"markdown",".markdown":"markdown",".mdown":"markdown",".mkd":"markdown",".mdx":"markdown",".txt":"text",".log":"text",".gitignore":"text",".gitattributes":"text",".editorconfig":"text",".env":"bash",".env.example":"bash",".env.local":"bash",".env.production":"bash",".env.development":"bash",".csv":"csv"};function zO(e){if(!e)return"text";const t=e.toLowerCase().match(/\.[^.]*$/)?.[0];if(t&&Dp[t])return Dp[t];const r=e.toLowerCase().split("/").pop()||"";return r.startsWith(".env")?"bash":r==="dockerfile"||r==="dockerfile.dev"||r==="dockerfile.prod"?"dockerfile":r==="makefile"||r==="makefile.am"?"makefile":r==="package.json"||r==="tsconfig.json"||r==="tslint.json"?"json":"text"}const WO=({content:e,filePath:t="",className:r=""})=>{const n=zO(t),s=document.documentElement.classList.contains("dark");return d.jsxs("div",{className:`bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-md ${r}`,children:[d.jsx("div",{className:"px-4 py-2 bg-gray-50 dark:bg-gray-900 border-b border-gray-200 dark:border-gray-700 rounded-t-md",children:d.jsxs("div",{className:"text-xs font-medium text-gray-600 dark:text-gray-400",children:["文件内容 (",n,")"]})}),d.jsx("div",{className:"p-4",children:d.jsx(hm,{language:n,style:s?xE:E0,customStyle:{margin:0,background:"transparent",fontSize:"14px"},wrapLines:!0,wrapLongLines:!0,showLineNumbers:!0,lineNumberStyle:{minWidth:"3em",paddingRight:"1em",color:s?"#9ca3af":"#666",borderRight:s?"1px solid #4b5563":"1px solid #ddd",marginRight:"1em"},children:e})})]})},HO=({execution:e})=>{const{t}=de("components"),r=e.toolInput,n=()=>r.file_path?r.file_path.split("/").pop()||r.file_path:void 0;return d.jsx($e,{execution:e,subtitle:n(),showResult:!1,hideToolName:!1,children:d.jsxs("div",{children:[d.jsx(je,{label:t("writeTool.filePath"),value:r.file_path}),d.jsxs("div",{className:"mt-3",children:[d.jsx(WO,{content:r.content,filePath:r.file_path}),d.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mt-2",children:t("writeTool.fileSize",{size:r.content?.length||0})})]})]})})},qO=({execution:e})=>{const{t}=de("components"),r=e.toolInput;return d.jsx($e,{execution:e,hideToolName:!1,children:d.jsxs("div",{children:[d.jsx(je,{label:t("notebookReadTool.notebookPath"),value:r.notebook_path}),r.cell_id&&d.jsx(je,{label:t("notebookReadTool.cellId"),value:r.cell_id})]})})},UO=({execution:e})=>{const{t}=de("components"),r=e.toolInput;return d.jsx($e,{execution:e,hideToolName:!1,children:d.jsxs("div",{children:[d.jsx(je,{label:t("notebookEditTool.notebookPath"),value:r.notebook_path}),d.jsxs("div",{className:"flex flex-wrap gap-2 mt-2 mb-3",children:[r.edit_mode&&d.jsx("span",{className:`px-2 py-1 text-xs rounded ${r.edit_mode==="insert"?"bg-green-200 text-green-800":r.edit_mode==="delete"?"bg-red-200 text-red-800":"bg-blue-200 text-blue-800"}`,children:r.edit_mode==="insert"?t("notebookEditTool.insert"):r.edit_mode==="delete"?t("notebookEditTool.delete"):t("notebookEditTool.replace")}),r.cell_type&&d.jsx("span",{className:"px-2 py-1 bg-purple-200 text-purple-800 text-xs rounded",children:r.cell_type==="code"?t("notebookEditTool.code"):t("notebookEditTool.markdown")})]}),r.cell_id&&d.jsx(je,{label:t("notebookEditTool.cellId"),value:r.cell_id}),r.edit_mode!=="delete"&&d.jsx(je,{label:t("notebookEditTool.newContent"),value:r.new_source&&r.new_source.length>300?r.new_source.substring(0,300)+`
403
+ `+t("notebookEditTool.truncated"):r.new_source||"",isCode:!0})]})})},VO=({execution:e})=>{const{t}=de("components"),r=e.toolInput,n=()=>r.server?`${t("listMcpResourcesTool.server")}: ${r.server}`:t("listMcpResourcesTool.allServers");return d.jsx($e,{execution:e,subtitle:n(),hideToolName:!1,children:d.jsxs("div",{className:"space-y-3",children:[d.jsxs("div",{className:"flex items-center space-x-2",children:[d.jsx(oc,{className:"w-4 h-4 text-blue-500"}),d.jsx("h4",{className:"text-sm font-medium text-gray-700",children:t("listMcpResourcesTool.title")})]}),r.server&&d.jsx(je,{label:t("listMcpResourcesTool.serverName"),value:r.server}),e.toolResult&&d.jsxs("div",{className:"mt-3",children:[d.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[d.jsx(pv,{className:"w-4 h-4 text-green-500"}),d.jsx("span",{className:"text-sm font-medium text-gray-700",children:t("listMcpResourcesTool.resources")})]}),d.jsx("div",{className:"bg-gray-50 p-3 rounded-md border border-gray-200",children:d.jsx("pre",{className:"text-sm text-gray-600 whitespace-pre-wrap font-mono",children:e.toolResult})})]}),e.isExecuting&&d.jsxs("div",{className:"flex items-center space-x-2 text-blue-600",children:[d.jsx(oc,{className:"w-4 h-4 animate-pulse"}),d.jsx("span",{className:"text-sm",children:t("listMcpResourcesTool.loading")})]}),e.isError&&d.jsxs("div",{className:"flex items-center space-x-2 text-red-600",children:[d.jsx(oc,{className:"w-4 h-4"}),d.jsx("span",{className:"text-sm",children:t("listMcpResourcesTool.error")})]}),d.jsx("div",{className:"text-xs text-gray-500 mt-2 p-2 bg-blue-50 rounded",children:t("listMcpResourcesTool.description")})]})})},GO=({execution:e})=>{const{t}=de("components"),r=e.toolInput,n=()=>`${r.server}: ${r.uri.split("/").pop()||r.uri}`;return d.jsx($e,{execution:e,subtitle:n(),hideToolName:!1,children:d.jsxs("div",{className:"space-y-3",children:[d.jsxs("div",{className:"flex items-center space-x-2",children:[d.jsx(Pa,{className:"w-5 h-5 text-indigo-500"}),d.jsx("h4",{className:"text-sm font-medium text-gray-700",children:t("readMcpResourceTool.title")})]}),d.jsxs("div",{className:"flex items-center space-x-2 p-2 bg-indigo-50 rounded border border-indigo-200",children:[d.jsx(Pa,{className:"w-4 h-4 text-indigo-600"}),d.jsx("span",{className:"text-sm font-medium text-indigo-800",children:r.server})]}),d.jsxs("div",{children:[d.jsxs("div",{className:"flex items-center space-x-1 mb-1",children:[d.jsx(em,{className:"w-3 h-3 text-gray-500"}),d.jsx("span",{className:"text-xs font-medium text-gray-600",children:t("readMcpResourceTool.resourceUri")})]}),d.jsx("div",{className:"bg-gray-50 p-2 rounded border border-gray-200",children:d.jsx("code",{className:"text-xs text-gray-700 font-mono break-all",children:r.uri})})]}),e.toolResult&&d.jsxs("div",{className:"mt-4",children:[d.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[d.jsx(mv,{className:"w-4 h-4 text-green-500"}),d.jsx("span",{className:"text-sm font-medium text-gray-700",children:t("readMcpResourceTool.content")})]}),d.jsx("div",{className:"bg-white p-3 rounded-md border border-gray-200 max-h-96 overflow-y-auto",children:(()=>{try{const s=JSON.parse(e.toolResult);return d.jsx("pre",{className:"text-sm text-gray-700 whitespace-pre-wrap font-mono",children:JSON.stringify(s,null,2)})}catch{return d.jsx("pre",{className:"text-sm text-gray-700 whitespace-pre-wrap",children:e.toolResult})}})()})]}),e.isExecuting&&d.jsxs("div",{className:"flex items-center space-x-2 text-indigo-600",children:[d.jsx(tm,{className:"w-4 h-4 animate-bounce"}),d.jsx("span",{className:"text-sm",children:t("readMcpResourceTool.loading")})]}),e.isError&&d.jsxs("div",{className:"flex items-center space-x-2 text-red-600",children:[d.jsx(Pa,{className:"w-4 h-4"}),d.jsx("span",{className:"text-sm",children:t("readMcpResourceTool.error")})]}),d.jsx("div",{className:"text-xs text-gray-500 p-2 bg-gray-50 rounded",children:d.jsxs("div",{className:"flex items-start space-x-1",children:[d.jsx(Pa,{className:"w-3 h-3 mt-0.5 flex-shrink-0"}),d.jsx("span",{children:t("readMcpResourceTool.description")})]})}),e.toolResult&&d.jsx("div",{className:"text-xs text-gray-400 text-right",children:t("readMcpResourceTool.contentSize",{size:new Blob([e.toolResult]).size})})]})})},YO=({execution:e})=>{const{t}=de("components"),r=e.toolInput,n=()=>{const s=r.message_prefix;return s.length>30?`${s.substring(0,30)}...`:s};return d.jsx($e,{execution:e,subtitle:n(),hideToolName:!1,children:d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{className:"flex items-center space-x-2",children:[d.jsx(Ar,{className:"w-5 h-5 text-purple-500"}),d.jsx("h4",{className:"text-sm font-medium text-gray-700",children:t("timeMachineTool.title")})]}),d.jsx("div",{className:"text-xs text-purple-600 bg-purple-50 p-3 rounded-md border border-purple-200",children:d.jsxs("div",{className:"flex items-start space-x-1",children:[d.jsx(xv,{className:"w-3 h-3 mt-0.5 flex-shrink-0"}),d.jsx("span",{children:t("timeMachineTool.description")})]})}),d.jsxs("div",{children:[d.jsxs("div",{className:"flex items-center space-x-1 mb-1",children:[d.jsx(yv,{className:"w-3 h-3 text-gray-500"}),d.jsx("span",{className:"text-xs font-medium text-gray-600",children:t("timeMachineTool.targetMessage")})]}),d.jsx("div",{className:"bg-gray-50 p-2 rounded border border-gray-200",children:d.jsxs("p",{className:"text-sm text-gray-700 italic",children:['"',r.message_prefix,'"']})})]}),d.jsxs("div",{children:[d.jsxs("div",{className:"flex items-center space-x-1 mb-1",children:[d.jsx(wh,{className:"w-3 h-3 text-green-500"}),d.jsx("span",{className:"text-xs font-medium text-gray-600",children:t("timeMachineTool.correction")})]}),d.jsx("div",{className:"bg-green-50 p-2 rounded border border-green-200",children:d.jsxs("p",{className:"text-sm text-gray-700",children:['"',r.course_correction,'"']})})]}),r.restore_code!==void 0&&d.jsxs("div",{className:"flex items-center space-x-2",children:[d.jsxs("span",{className:"text-xs font-medium text-gray-600",children:[t("timeMachineTool.restoreCode"),":"]}),d.jsx("span",{className:`text-xs px-2 py-1 rounded-full ${r.restore_code?"bg-green-100 text-green-800":"bg-gray-100 text-gray-600"}`,children:r.restore_code?t("common.enabled"):t("common.disabled")})]}),e.toolResult&&d.jsxs("div",{className:"mt-3",children:[d.jsx("div",{className:"text-xs font-medium text-gray-600 mb-1",children:t("timeMachineTool.result")}),d.jsx("div",{className:"bg-purple-50 p-3 rounded-md border border-purple-200",children:d.jsx("pre",{className:"text-sm text-gray-700 whitespace-pre-wrap",children:e.toolResult})})]}),e.isExecuting&&d.jsxs("div",{className:"flex items-center space-x-2 text-purple-600",children:[d.jsx(Ar,{className:"w-4 h-4 animate-spin"}),d.jsx("span",{className:"text-sm",children:t("timeMachineTool.rewinding")})]}),e.isError&&d.jsxs("div",{className:"flex items-center space-x-2 text-red-600",children:[d.jsx(Ar,{className:"w-4 h-4"}),d.jsx("span",{className:"text-sm",children:t("timeMachineTool.error")})]})]})})},en="__TYPE_SOMETHING__",Bp=({execution:e,onSubmit:t})=>{const{t:r}=de("components"),n=e.toolInput,s=Fe(w=>w.pendingUserQuestion);if(!n||!n.questions||!Array.isArray(n.questions))return d.jsx($e,{execution:e,hideToolName:!1,overrideToolName:r("askUserQuestionTool.title"),children:d.jsx("div",{className:"text-red-600 text-sm",children:r("askUserQuestionTool.invalidInput","Invalid question input")})});const[i,a]=M.useState(new Map),[o,l]=M.useState(!1),[c,u]=M.useState(new Map),h=M.useRef(new Map),f=M.useMemo(()=>{if(!s||!e.toolInput)return!1;const w=e.toolInput.questions,_=s.questions;return!!(w&&_&&w.length===_.length&&w[0]?.question===_[0]?.question)},[s,e]),g=f&&!e.toolResult&&!o,p=M.useMemo(()=>{if(!e.toolResult)return null;const w=String(e.toolResult),_=w.match(/^User response:\s*(.+)$/s);return _?_[1].trim():w.trim()},[e.toolResult]),m=M.useCallback((w,_,O)=>{g&&(a(P=>{const v=new Map(P),L=v.get(w)||[];if(O)if(L.includes(_))v.set(w,L.filter(N=>N!==_));else{const N=L.filter(R=>R!==en);v.set(w,[...N,_])}else v.set(w,[_]);return v}),_!==en&&u(P=>{const v=new Map(P);return v.delete(w),v}))},[g]),y=M.useCallback((w,_)=>{g&&(a(O=>{const P=new Map(O),v=P.get(w)||[];return _?v.includes(en)?P.set(w,v.filter(L=>L!==en)):P.set(w,[...v,en]):P.set(w,[en]),P}),setTimeout(()=>{const O=h.current.get(w);O&&O.focus()},100))},[g]),x=M.useCallback((w,_)=>{u(O=>{const P=new Map(O);return P.set(w,_),P})},[]),k=M.useMemo(()=>{if(!g)return!1;for(let w=0;w<n.questions.length;w++){const _=i.get(w)||[];if(_.length===0)return!1;if(_.includes(en)){const O=c.get(w)||"";if(_.length===1&&!O.trim())return!1}}return!0},[g,n.questions.length,i,c]),C=M.useCallback(()=>{const w=[];return n.questions.forEach((_,O)=>{const P=i.get(O)||[];if(P.length>0){const v=[];P.forEach(L=>{if(L===en){const N=c.get(O)||"";N.trim()&&v.push(N.trim())}else v.push(L)}),v.length>0&&(n.questions.length===1?w.push(v.join(", ")):w.push(`Q${O+1}: ${v.join(", ")}`))}}),w.join(`
404
+ `)},[n.questions,i,c]),T=M.useCallback(async()=>{if(!(!k||!t||!s)){l(!0);try{const w=C();console.log("🎤 [AskUserQuestion] Submitting response:",w),await t(s.toolUseId,w)}catch(w){console.error("🎤 [AskUserQuestion] Failed to submit response:",w)}finally{l(!1)}}},[k,t,s,C]),S=()=>{const w=n.questions,_=w.length,O=w[0],P=O.header||(O.question.length>30?O.question.substring(0,30)+"...":O.question);return _===1?P:`${P} (+${_-1})`};return d.jsx($e,{execution:e,subtitle:S(),defaultExpanded:!0,showResult:!1,hideToolName:!1,overrideToolName:r("askUserQuestionTool.title"),customIcon:d.jsx(ro,{className:"w-4 h-4 text-blue-500"}),children:d.jsxs("div",{className:"space-y-4",children:[d.jsx("div",{className:"space-y-4",children:n.questions.map((w,_)=>{const O=i.get(_)||[];return d.jsxs("div",{className:"border border-gray-200 rounded-lg p-3 bg-white",children:[d.jsx("div",{className:"flex items-center justify-between mb-2",children:d.jsxs("div",{className:"flex items-center space-x-2",children:[d.jsxs("span",{className:"text-sm font-medium text-gray-700",children:["Q",_+1]}),w.header&&d.jsx("span",{className:"text-xs px-2 py-1 bg-blue-100 text-blue-800 rounded-full",children:w.header}),w.multiSelect&&d.jsx("span",{className:"text-xs px-2 py-1 bg-purple-100 text-purple-800 rounded-full",children:r("askUserQuestionTool.multiSelect")})]})}),d.jsx("div",{className:"mb-3",children:d.jsx("p",{className:"text-sm text-gray-800 font-medium",children:w.question})}),d.jsxs("div",{className:"space-y-2",children:[w.options.map((P,v)=>{const L=O.includes(P.label),N=g;return d.jsxs("div",{onClick:()=>m(_,P.label,w.multiSelect||!1),className:`
405
+ flex items-start space-x-2 p-2 rounded border transition-all
406
+ ${N?"cursor-pointer":"cursor-default"}
407
+ ${L?"border-blue-500 bg-blue-50 ring-1 ring-blue-500":"border-gray-100 hover:bg-gray-50"}
408
+ ${!N&&!L?"opacity-60":""}
409
+ `,children:[w.multiSelect?d.jsx(Rp,{className:`w-4 h-4 mt-0.5 ${L?"text-blue-500":"text-gray-400"}`,checked:L}):L?d.jsx(sn,{className:"w-4 h-4 mt-0.5 text-blue-500"}):d.jsx(Kc,{className:"w-4 h-4 mt-0.5 text-gray-400"}),d.jsxs("div",{className:"flex-1",children:[d.jsx("div",{className:`text-sm font-medium ${L?"text-blue-700":"text-gray-700"}`,children:P.label}),P.description&&d.jsx("div",{className:"text-xs text-gray-500 mt-1",children:P.description})]})]},v)}),(()=>{const P=O.includes(en),v=g,L=c.get(_)||"",N=p&&!w.options.some(R=>R.label===p);return e.toolResult&&N?d.jsxs("div",{className:"flex items-start space-x-2 p-2 rounded border border-green-500 bg-green-50 ring-1 ring-green-500",children:[d.jsx(sn,{className:"w-4 h-4 mt-0.5 text-green-500"}),d.jsxs("div",{className:"flex-1 flex items-center space-x-2",children:[d.jsx(Gd,{className:"w-4 h-4 text-green-600"}),d.jsxs("span",{className:"text-sm font-medium text-green-700",children:[r("askUserQuestionTool.typeSomething")," ",p]})]})]}):d.jsxs("div",{className:"space-y-2",children:[d.jsxs("div",{onClick:()=>y(_,w.multiSelect||!1),className:`
410
+ flex items-start space-x-2 p-2 rounded border transition-all
411
+ ${v?"cursor-pointer":"cursor-default"}
412
+ ${P?"border-blue-500 bg-blue-50 ring-1 ring-blue-500":"border-gray-100 border-dashed hover:bg-gray-50"}
413
+ ${!v&&!P?"opacity-60":""}
414
+ `,children:[w.multiSelect?d.jsx(Rp,{className:`w-4 h-4 mt-0.5 ${P?"text-blue-500":"text-gray-400"}`,checked:P}):P?d.jsx(sn,{className:"w-4 h-4 mt-0.5 text-blue-500"}):d.jsx(Kc,{className:"w-4 h-4 mt-0.5 text-gray-400"}),d.jsxs("div",{className:"flex-1 flex items-center space-x-2",children:[d.jsx(Gd,{className:`w-4 h-4 ${P?"text-blue-500":"text-gray-400"}`}),d.jsx("div",{className:`text-sm font-medium ${P?"text-blue-700":"text-gray-500"}`,children:r("askUserQuestionTool.typeSomething")})]})]}),P&&g&&d.jsx("div",{className:"ml-6",children:d.jsx("input",{ref:R=>{h.current.set(_,R)},type:"text",value:L,onChange:R=>x(_,R.target.value),placeholder:r("askUserQuestionTool.typeSomethingPlaceholder"),className:"w-full px-3 py-2 text-sm border border-blue-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent bg-white",onKeyDown:R=>{R.key==="Enter"&&k&&(R.preventDefault(),T())}})})]})})()]})]},_)})}),g&&d.jsx("div",{className:"flex justify-end pt-2",children:d.jsx("button",{onClick:T,disabled:!k||o,className:`
415
+ flex items-center space-x-2 px-4 py-2 rounded-lg text-sm font-medium transition-all
416
+ ${k&&!o?"bg-blue-500 text-white hover:bg-blue-600 shadow-sm":"bg-gray-200 text-gray-400 cursor-not-allowed"}
417
+ `,children:o?d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),d.jsx("span",{children:r("askUserQuestionTool.submitting")})]}):d.jsxs(d.Fragment,{children:[d.jsx(vh,{className:"w-4 h-4"}),d.jsx("span",{children:r("askUserQuestionTool.submit")})]})})}),e.toolResult&&d.jsxs("div",{className:"flex items-center space-x-2 text-green-600 py-2",children:[d.jsx(Qp,{className:"w-4 h-4"}),d.jsx("span",{className:"text-sm font-medium",children:r("askUserQuestionTool.completed")})]}),e.isExecuting&&!f&&d.jsxs("div",{className:"flex items-center space-x-2 text-blue-600 py-2",children:[d.jsx(ro,{className:"w-4 h-4 animate-pulse"}),d.jsx("span",{className:"text-sm",children:r("askUserQuestionTool.waitingForResponse")})]}),e.isError&&d.jsxs("div",{className:"flex items-center space-x-2 text-red-600 py-2",children:[d.jsx(ro,{className:"w-4 h-4"}),d.jsx("span",{className:"text-sm",children:r("askUserQuestionTool.error")})]})]})})},Rp=({className:e,checked:t})=>d.jsxs("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[d.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2",strokeWidth:"2"}),t&&d.jsx("path",{d:"M9 12l2 2 4-4",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),XO=({execution:e})=>{const{t}=de("components"),r=e.toolInput;return d.jsxs($e,{execution:e,hideToolName:!1,subtitle:r.url,children:[d.jsxs("div",{children:[d.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[d.jsx("span",{className:"text-xs font-medium text-gray-600",children:t("webFetchTool.urlLabel")}),d.jsx("a",{href:r.url,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 text-sm underline break-all",children:r.url})]}),d.jsx(je,{label:t("webFetchTool.analysisPromptLabel"),value:r.prompt&&r.prompt.length>200?r.prompt.substring(0,200)+`
418
+ `+t("webFetchTool.truncated"):r.prompt||"",isCode:!0})]}),e.toolResult&&!e.isError&&d.jsxs("div",{className:"mt-3",children:[d.jsx("p",{className:"text-xs font-medium text-gray-600 mb-2",children:t("webFetchTool.webAnalysisResult")}),d.jsx("div",{className:"p-3 rounded-md border bg-teal-50 border-teal-200 text-sm whitespace-pre-wrap break-words text-teal-800",children:e.toolResult})]})]})},KO=({execution:e})=>{const{t}=de("components"),r=e.toolInput,n=Array.isArray(r?.allowed_domains)?r.allowed_domains:[],s=Array.isArray(r?.blocked_domains)?r.blocked_domains:[],i=()=>{if(r.query)return`${r.query}`};return d.jsxs($e,{execution:e,subtitle:i(),showResult:!1,hideToolName:!1,children:[d.jsxs("div",{children:[d.jsx(je,{label:t("webSearchTool.searchQueryLabel"),value:r.query}),(n.length>0||s.length>0)&&d.jsxs("div",{className:"mt-2 space-y-1",children:[n.length>0&&d.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[d.jsx("span",{className:"text-xs font-medium text-green-600",children:t("webSearchTool.allowedDomains")}),n.map((a,o)=>d.jsx("span",{className:"px-2 py-1 bg-green-100 text-green-700 text-xs rounded",children:a},o))]}),s.length>0&&d.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[d.jsx("span",{className:"text-xs font-medium text-red-600",children:t("webSearchTool.blockedDomains")}),s.map((a,o)=>d.jsx("span",{className:"px-2 py-1 bg-red-100 text-red-700 text-xs rounded",children:a},o))]})]})]}),e.toolResult&&!e.isError&&d.jsxs("div",{className:"mt-3",children:[d.jsx("p",{className:"text-xs font-medium text-gray-600 mb-2",children:t("webSearchTool.searchResults")}),d.jsx("div",{className:"p-3 rounded-md border bg-sky-50 border-sky-200 text-sm whitespace-pre-wrap break-words text-sky-800",children:e.toolResult})]})]})};function X1(e){const t=e.split("__");return t.length!==3||t[0]!=="mcp"?null:{toolId:e,prefix:t[0],serverName:t[1],toolName:t[2]}}function QO(e){return e.split("_").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function ZO(e){try{const t=JSON.parse(e);return Array.isArray(t)?{content:t}:t&&typeof t=="object"&&("content"in t||"isError"in t)?t:{content:{type:"text",text:e}}}catch{return{content:{type:"text",text:e}}}}const JO=({content:e})=>{switch(e.type){case"text":return d.jsx("div",{className:"p-3 rounded-md border bg-green-50 border-green-200",children:d.jsx("pre",{className:"text-sm font-mono text-green-700 whitespace-pre-wrap break-words",children:e.text})});case"image":{const{t:r}=de("components"),n=e;return d.jsxs("div",{className:"p-3 rounded-md border bg-blue-50 border-blue-200",children:[d.jsx("div",{className:"text-xs font-medium text-blue-600 mb-2",children:r("mcpTool.image",{mimeType:n.mimeType})}),d.jsx("img",{src:`data:${n.mimeType};base64,${n.data}`,alt:"MCP Tool Result",className:"max-w-full h-auto rounded border shadow-sm",style:{maxHeight:"400px"}})]})}case"resource":{const{t:r}=de("components"),n=e;return d.jsxs("div",{className:"p-3 rounded-md border bg-purple-50 border-purple-200",children:[d.jsx("div",{className:"text-xs font-medium text-purple-600 mb-2",children:r("mcpTool.resource")}),d.jsxs("div",{className:"text-sm text-purple-700 space-y-1",children:[d.jsxs("div",{children:[d.jsxs("span",{className:"font-medium",children:[r("mcpTool.uri"),":"]})," ",n.resource.uri]}),n.resource.name&&d.jsxs("div",{children:[d.jsxs("span",{className:"font-medium",children:[r("mcpTool.name"),":"]})," ",n.resource.name]}),n.resource.description&&d.jsxs("div",{children:[d.jsxs("span",{className:"font-medium",children:[r("mcpTool.description"),":"]})," ",n.resource.description]}),n.resource.mimeType&&d.jsxs("div",{children:[d.jsxs("span",{className:"font-medium",children:[r("mcpTool.type"),":"]})," ",n.resource.mimeType]})]})]})}default:const{t}=de("components");return d.jsxs("div",{className:"p-3 rounded-md border bg-gray-50 border-gray-200",children:[d.jsx("div",{className:"text-xs font-medium text-gray-600 mb-2",children:t("mcpTool.unknownType",{type:e.type})}),d.jsx("pre",{className:"text-sm font-mono text-gray-700 whitespace-pre-wrap break-words",children:JSON.stringify(e,null,2)})]})}},e6=({result:e,isError:t})=>{const{t:r}=de("components");if(!e)return null;if(t)return d.jsxs("div",{className:"mt-3",children:[d.jsx("p",{className:"text-xs font-medium text-gray-600 mb-2",children:r("mcpTool.errorMessage")}),d.jsx("div",{className:"p-3 rounded-md border bg-red-50 border-red-200 text-red-700 text-sm font-mono whitespace-pre-wrap break-words",children:e})]});const n=ZO(e);if(!n||!n.content)return d.jsxs("div",{className:"mt-3",children:[d.jsx("p",{className:"text-xs font-medium text-gray-600 mb-2",children:r("mcpTool.executionResult")}),d.jsx("div",{className:"p-3 rounded-md border bg-green-50 border-green-200 text-green-700 text-sm font-mono whitespace-pre-wrap break-words",children:e})]});const s=Array.isArray(n.content)?n.content:[n.content];return d.jsxs("div",{className:"mt-3",children:[d.jsx("p",{className:"text-xs font-medium text-gray-600 mb-2",children:r("mcpTool.executionResult")}),n._meta?.progress!==void 0&&n._meta?.progressTotal&&d.jsxs("div",{className:"mb-3 p-2 bg-blue-50 border border-blue-200 rounded text-sm",children:[d.jsx("div",{className:"text-blue-700 mb-1",children:r("mcpTool.progress",{current:n._meta.progress,total:n._meta.progressTotal})}),d.jsx("div",{className:"w-full bg-blue-200 rounded-full h-2",children:d.jsx("div",{className:"bg-blue-600 h-2 rounded-full transition-all duration-300",style:{width:`${n._meta.progress/n._meta.progressTotal*100}%`}})})]}),d.jsx("div",{className:"space-y-3",children:s.map((i,a)=>d.jsx(JO,{content:i},a))})]})},t6=({execution:e})=>{const{t}=de("components"),r=X1(e.toolName);if(!r)return d.jsx($e,{execution:e});const{serverName:n,toolName:s}=r,i=QO(s),a={...e,toolName:i},o=t("mcpTool.subtitle",{toolName:s,serverName:n});return d.jsx($e,{execution:a,subtitle:o,showResult:!1,isMcpTool:!0,hideToolName:!1,children:d.jsxs("div",{className:"space-y-3",children:[d.jsx(je,{label:t("mcpTool.parameters"),value:e.toolInput,isCode:!0}),e.toolResult&&d.jsx(e6,{result:e.toolResult,isError:e.isError})]})})},r6=e=>e.filter(t=>t.kind==="text"&&!!t.text).map(t=>t.text).join(""),Pp=e=>{if(typeof e=="string")return e;if(typeof e=="object"&&e!==null)return e.response},n6=e=>{if(!e||typeof e!="string")return"Unknown Agent";try{const r=new URL(e).hostname;if(/^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$/.test(r))return r;const s=r.split(".");return s.length>=2?s[0]:r}catch{const t=e.match(/\/([^/]+)$/);return t?t[1]:e}},K1=({execution:e})=>{const{t}=de(),r=e.toolInput;let n;if(e.toolResult)if(e.isError===!0)n={success:!1,error:e.toolResult};else{const R=e.toolResult;let j;const B=R.match(/\[System\] Session ID: ([a-f0-9-]+)/);B&&(j=B[1]);try{const I=JSON.parse(R);typeof I=="object"&&I!==null?n={success:I.success!==!1,data:I.data||I.response||R,sessionId:I.sessionId||j,contextId:I.contextId,taskId:I.taskId,error:I.error}:n={success:!0,data:R,sessionId:j}}catch{n={success:!0,data:R,sessionId:j}}}const s=r.agentName||n6(r.agentUrl),i=!n&&!e.toolResult,a=n?.status==="running"||n?.status==="pending",o=n?.success===!0||!!n?.data&&!n?.error,l=n?.success===!1||!!n?.error,c=(N,R)=>N?R==="working"?{icon:d.jsx(Tn,{className:"w-4 h-4 animate-spin"}),className:"bg-blue-100 text-blue-800 border-blue-200 dark:bg-blue-900/30 dark:text-blue-300 dark:border-blue-800",text:t("tools.a2a.working","Working")}:R==="input-required"?{icon:d.jsx(rs,{className:"w-4 h-4"}),className:"bg-yellow-100 text-yellow-800 border-yellow-200 dark:bg-yellow-900/30 dark:text-yellow-300 dark:border-yellow-800",text:t("tools.a2a.inputRequired","Input Required")}:{icon:d.jsx(Tn,{className:"w-4 h-4 animate-spin"}),className:"bg-purple-100 text-purple-800 border-purple-200 dark:bg-purple-900/30 dark:text-purple-300 dark:border-purple-800",text:t("tools.a2a.streaming","Streaming...")}:i||a?{icon:d.jsx(Tn,{className:"w-4 h-4 animate-spin"}),className:"bg-blue-100 text-blue-800 border-blue-200 dark:bg-blue-900/30 dark:text-blue-300 dark:border-blue-800",text:a?t("tools.a2a.running","Running"):t("tools.a2a.calling","Calling")}:R==="completed"||o&&!l?{icon:d.jsx(sn,{className:"w-4 h-4"}),className:"bg-green-100 text-green-800 border-green-200 dark:bg-green-900/30 dark:text-green-300 dark:border-green-800",text:t("tools.a2a.success","Success")}:R==="failed"||R==="rejected"||l&&!o?{icon:d.jsx(zi,{className:"w-4 h-4"}),className:"bg-red-100 text-red-800 border-red-200 dark:bg-red-900/30 dark:text-red-300 dark:border-red-800",text:t("tools.a2a.error","Failed")}:R==="canceled"?{icon:d.jsx(zi,{className:"w-4 h-4"}),className:"bg-gray-100 text-gray-800 border-gray-200 dark:bg-gray-800/30 dark:text-gray-300 dark:border-gray-700",text:t("tools.a2a.canceled","Canceled")}:n?{icon:d.jsx(sn,{className:"w-4 h-4"}),className:"bg-green-100 text-green-800 border-green-200 dark:bg-green-900/30 dark:text-green-300 dark:border-green-800",text:t("tools.a2a.success","Success")}:{icon:d.jsx(zi,{className:"w-4 h-4"}),className:"bg-red-100 text-red-800 border-red-200 dark:bg-red-900/30 dark:text-red-300 dark:border-red-800",text:t("tools.a2a.error","Failed")},u=(N,R)=>{let j=s;return r.useTask&&(j+=` • ${t("tools.a2a.asyncTask","Async Task")}`),R?j+=` • ${R}`:N?j+=` • ${t("tools.a2a.streaming","Streaming...")}`:i?j+=` • ${t("tools.a2a.calling","Calling...")}`:a?j+=` • ${t("tools.a2a.running","Running...")}`:l&&!o?j+=` • ${t("tools.a2a.error","Failed")}`:(o||n)&&(j+=` • ${t("tools.a2a.success","Success")}`),j},[h]=um(),f=h.get("project"),[g,p]=Rr.useState([]),[m]=Rr.useState([]),[y,x]=Rr.useState(!1),[k,C]=Rr.useState(!1),[T]=Rr.useState(),S=Fe(N=>N.activeA2AStreams[r.agentUrl]),w=S?.sessionId||n?.sessionId||r.sessionId;Rr.useEffect(()=>{S?.isStreaming===!0?(C(!0),x(!0)):S&&S.isStreaming===!1&&C(!1)},[S?.isStreaming]),Rr.useEffect(()=>{(n?.error||e.isError)&&C(!1)},[n?.error,e.isError]),Rr.useEffect(()=>{if(!S?.events||S.events.length===0)return;const N=[];let R=null;const j=new Map;for(const B of S.events)if(B.type==="system")R={id:`sys-${Date.now()}-${Math.random()}`,role:"assistant",timestamp:new Date().toISOString(),messageParts:[{id:`sys-part-${Date.now()}`,type:"text",content:`[System] Session ID: ${B.sessionId||"N/A"}`,order:0}]},N.push(R);else if(B.type==="assistant"&&B.message?.content){R={id:`assistant-${Date.now()}-${Math.random()}`,role:"assistant",timestamp:new Date().toISOString(),messageParts:[]},N.push(R);for(const I of B.message.content)if(I.type==="text")R.messageParts.push({id:`text-${Date.now()}-${Math.random()}`,type:"text",content:I.text||"",order:R.messageParts.length});else if(I.type==="tool_use"){const F=I.id||`tool-${Date.now()}`,W={id:F,type:"tool",toolData:{id:F,toolName:I.name||"unknown",toolInput:I.input||{},toolResult:void 0,isError:!1},order:R.messageParts.length};R.messageParts.push(W),I.id&&j.set(I.id,W)}}else if(B.type==="user"&&B.message?.content){for(const I of B.message.content)if(I.type==="tool_result"&&I.tool_use_id){const F=j.get(I.tool_use_id);F&&F.toolData&&(F.toolData.toolResult=typeof I.content=="string"?I.content:JSON.stringify(I.content),F.toolData.isError=I.is_error||!1)}}N.length>0&&p(N)},[S?.events]);const{currentService:_}=Ev(),{getToken:O}=sv(),P=_?O(_.id)?.token:null;Rr.useEffect(()=>{if(!w||!f)return;(async()=>{try{const j=`/api/a2a/history/${encodeURIComponent(f)}/${w}`,B=await fetch(j,{headers:P?{Authorization:`Bearer ${P}`}:{}});if(!B.ok){console.error("Failed to fetch A2A history:",B.status);return}const{history:I}=await B.json();x(!0),I&&Array.isArray(I)&&v(I),C(!1)}catch(R){console.error("Error fetching A2A history:",R),x(!1),C(!1)}})()},[w,f,P]);const v=N=>{const R=[];let j=null;const B=new Map;for(const I of N)if(I.type==="system")(!j||j.role!=="assistant")&&(j={id:`sys-${Date.now()}`,role:"assistant",timestamp:new Date().toISOString(),messageParts:[]},R.push(j)),j.messageParts.push({id:`sys-part-${Date.now()}`,type:"text",content:`[System] Session ID: ${I.sessionId||"N/A"}`,order:j.messageParts.length});else if(I.type==="assistant"&&I.message?.content){(!j||j.role!=="assistant")&&(j={id:I.sessionId||`assistant-${Date.now()}`,role:"assistant",timestamp:new Date().toISOString(),messageParts:[]},R.push(j));for(const F of I.message.content)if(F.type==="text")j.messageParts.push({id:`text-${Date.now()}-${Math.random()}`,type:"text",content:F.text,order:j.messageParts.length});else if(F.type==="tool_use"){const W={id:F.id||`tool-${Date.now()}`,type:"tool",toolData:{id:F.id,toolName:F.name,toolInput:F.input,toolResult:void 0,isError:!1},order:j.messageParts.length};j.messageParts.push(W),F.id&&B.set(F.id,W)}}else if(I.type==="user"&&I.message?.content){for(const F of I.message.content)if(F.type==="tool_result"&&F.tool_use_id){const W=B.get(F.tool_use_id);W&&W.toolData&&(W.toolData.toolResult=typeof F.content=="string"?F.content:JSON.stringify(F.content),W.toolData.isError=F.is_error||!1)}}p(R)},L=c(k,T);return d.jsx($e,{execution:e,subtitle:u(k,T),showResult:!1,isMcpTool:!0,hideToolName:!1,customIcon:d.jsx(Yd,{className:"w-4 h-4 text-purple-600 dark:text-purple-400"}),overrideToolName:"call_external_agent",children:d.jsxs("div",{className:"space-y-3",children:[d.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800/50 rounded-lg p-4 space-y-3",children:[d.jsxs("div",{className:`inline-flex items-center gap-2 px-3 py-1 rounded-full border text-sm font-medium ${L.className}`,children:[L.icon,L.text]}),d.jsxs("div",{className:"bg-white dark:bg-gray-900 border dark:border-gray-700 rounded px-3 py-2 text-sm font-mono text-gray-800 dark:text-gray-200",children:[d.jsx("span",{className:"text-gray-500 dark:text-gray-400 mr-2",children:"Agent:"}),d.jsx("span",{className:"break-all",children:r.agentUrl})]}),d.jsxs("div",{className:"bg-white dark:bg-gray-900 border dark:border-gray-700 rounded px-3 py-2 text-sm text-gray-800 dark:text-gray-200",children:[d.jsx("span",{className:"text-gray-500 dark:text-gray-400 mr-2 block mb-1",children:"Message:"}),d.jsx("div",{className:"whitespace-pre-wrap",children:r.message})]})]}),y&&d.jsxs("div",{className:"flex items-center gap-2 text-sm text-purple-600 dark:text-purple-400",children:[d.jsxs("div",{className:"relative",children:[d.jsx("div",{className:"w-2 h-2 bg-purple-500 rounded-full animate-pulse"}),k&&d.jsx("div",{className:"absolute inset-0 w-2 h-2 bg-purple-500 rounded-full animate-ping"})]}),d.jsx("span",{children:k?T?`${t("tools.a2a.taskState","Task state")}: ${T}`:t("tools.a2a.liveStreaming","Live streaming from external agent..."):t("tools.a2a.connected","Connected to history stream")})]}),g.length>0&&d.jsx(G1,{taskPrompt:r.message,messageFlow:g,defaultExpanded:!0}),m.length>0&&d.jsxs("div",{className:"space-y-2",children:[d.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-gray-700 dark:text-gray-300",children:[d.jsx(bv,{className:"w-4 h-4"}),t("tools.a2a.artifacts","Artifacts")," (",m.length,")"]}),d.jsx("div",{className:"space-y-2",children:m.map(N=>d.jsxs("div",{className:"bg-white dark:bg-gray-900 border dark:border-gray-700 rounded-lg p-3",children:[d.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-gray-800 dark:text-gray-200 mb-2",children:[d.jsx(Ch,{className:"w-4 h-4 text-blue-500"}),N.name||N.artifactId]}),N.description&&d.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:N.description}),d.jsx("pre",{className:"text-xs bg-gray-50 dark:bg-gray-800 rounded p-2 overflow-x-auto",children:r6(N.parts)||JSON.stringify(N.parts,null,2)})]},N.artifactId))})]}),n&&!g.length&&d.jsxs(d.Fragment,{children:[Pp(n.data)&&d.jsxs("div",{children:[d.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[d.jsx(Yd,{className:"w-4 h-4"}),t("tools.a2a.response","Response")]}),d.jsx("pre",{className:"bg-gray-900 text-green-400 rounded-lg px-3 py-2 text-sm font-mono overflow-x-auto whitespace-pre-wrap border dark:border-gray-700",children:Pp(n.data)})]}),n.error&&d.jsxs("div",{children:[d.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-red-700 dark:text-red-400 mb-2",children:[d.jsx(rs,{className:"w-4 h-4"}),t("tools.a2a.error","Error")]}),d.jsx("pre",{className:"bg-red-50 dark:bg-red-900/20 text-red-800 dark:text-red-300 border border-red-200 dark:border-red-800 rounded-lg px-3 py-2 text-sm font-mono overflow-x-auto whitespace-pre-wrap",children:n.error})]}),(n.taskId||n.contextId||typeof n.data=="object"&&n.data?.metadata)&&d.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 pt-2 border-t border-gray-200 dark:border-gray-700 space-y-1",children:[n.taskId&&d.jsxs("div",{children:["Task ID: ",n.taskId]}),n.contextId&&d.jsxs("div",{children:["Context ID: ",n.contextId]}),typeof n.data=="object"&&n.data?.metadata&&d.jsxs("div",{children:["Metadata: ",JSON.stringify(n.data.metadata)]})]})]})]})})},s6=({execution:e})=>{const{t}=de("components"),n=e.toolInput?.skill||t("skillTool.unknownSkill"),s=e.toolUseResult,i=s?.commandName,a=()=>i&&i!==n?`${n} → ${i}`:n,o=d.jsx(Xd,{className:"w-4 h-4"});return d.jsx($e,{execution:e,subtitle:a(),customIcon:o,overrideToolName:t("skillTool.toolName"),hideToolName:!1,children:d.jsxs("div",{className:"space-y-3",children:[d.jsxs("div",{children:[d.jsx("span",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 block mb-1",children:t("skillTool.skillName")}),d.jsx("span",{className:"text-sm px-2 py-1 bg-gradient-to-r from-purple-100 to-pink-100 dark:from-purple-900/30 dark:to-pink-900/30 text-purple-800 dark:text-purple-300 rounded font-medium",children:n})]}),i&&i!==n&&d.jsxs("div",{children:[d.jsx("span",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 block mb-1",children:t("skillTool.commandName")}),d.jsx("span",{className:"text-sm px-2 py-1 bg-blue-100 dark:bg-blue-900/30 text-blue-800 dark:text-blue-300 rounded font-mono",children:i})]}),e.isExecuting&&d.jsxs("div",{className:"flex items-center space-x-2 text-purple-600 dark:text-purple-400",children:[d.jsx("div",{className:"w-4 h-4 border-2 border-purple-600 dark:border-purple-400 border-t-transparent rounded-full animate-spin"}),d.jsx("span",{className:"text-sm",children:t("skillTool.loading")})]}),!e.isExecuting&&s?.success&&d.jsxs("div",{className:"flex items-center space-x-2 text-green-600 dark:text-green-400",children:[d.jsx(Xd,{className:"w-4 h-4"}),d.jsx("span",{className:"text-sm",children:t("skillTool.launched")})]})]})})},i6=({execution:e})=>{const{t}=de("components"),r=e.toolInput,n=r.agentId||r.task_id||"",s=r.block??r.blocking??!1,i=r.wait_up_to??r.timeout,a=h=>{if(h==null)return null;const f=h>1e4?h:h*1e3;if(f<6e4)return`${(f/1e3).toFixed(0)}s`;const g=Math.floor(f/6e4),p=Math.floor(f%6e4/1e3);return p>0?`${g}m ${p}s`:`${g}m`},o=()=>{const h=[];if(n){const f=n.length>12?n.substring(0,12)+"...":n;h.push(`Agent ${f}`)}return s&&h.push(t("agentOutputTool.blocking")),h.length>0?h.join(" • "):void 0},c=(()=>{if(!e.toolUseResult&&!e.toolResult)return null;const h=e.toolUseResult||e.toolResult;return typeof h=="string"?{text:h,isError:!!e.isError}:typeof h=="object"?{text:JSON.stringify(h,null,2),isError:!!e.isError}:null})(),u=a(i);return d.jsx($e,{execution:e,subtitle:o(),showResult:!1,hideToolName:!1,children:d.jsxs("div",{className:"space-y-3",children:[n&&d.jsx(je,{label:t("agentOutputTool.agentId"),value:n,isCode:!0}),d.jsxs("div",{className:"flex flex-wrap gap-2",children:[d.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-1 rounded text-xs font-medium ${s?"bg-amber-100 dark:bg-amber-900/30 text-amber-800 dark:text-amber-300":"bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-400"}`,children:[s?d.jsx(Ar,{className:"w-3 h-3"}):null,t(s?"agentOutputTool.blockingMode":"agentOutputTool.nonBlockingMode")]}),u&&d.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded text-xs font-medium bg-blue-100 dark:bg-blue-900/30 text-blue-800 dark:text-blue-300",children:[d.jsx(Ar,{className:"w-3 h-3"}),t("agentOutputTool.timeout"),": ",u]})]}),e.isExecuting&&d.jsxs("div",{className:"flex items-center space-x-2 text-blue-600 dark:text-blue-400",children:[d.jsx(Tn,{className:"w-4 h-4 animate-spin"}),d.jsx("span",{className:"text-sm",children:t(s?"agentOutputTool.waitingForResult":"agentOutputTool.fetchingResult")})]}),!e.isExecuting&&c&&d.jsxs("div",{children:[d.jsx("div",{className:"flex items-center gap-2 text-sm font-medium mb-2",children:c.isError?d.jsxs(d.Fragment,{children:[d.jsx(zi,{className:"w-4 h-4 text-red-600 dark:text-red-400"}),d.jsx("span",{className:"text-red-700 dark:text-red-400",children:t("agentOutputTool.error")})]}):d.jsxs(d.Fragment,{children:[d.jsx(sn,{className:"w-4 h-4 text-green-600 dark:text-green-400"}),d.jsx("span",{className:"text-green-700 dark:text-green-400",children:t("agentOutputTool.completed")})]})}),d.jsx("pre",{className:`text-sm font-mono rounded-lg px-3 py-2 overflow-x-auto whitespace-pre-wrap break-words border ${c.isError?"bg-red-50 dark:bg-red-900/20 text-red-800 dark:text-red-300 border-red-200 dark:border-red-800":"bg-green-50 dark:bg-green-900/20 text-green-800 dark:text-green-300 border-green-200 dark:border-green-800"}`,children:c.text})]}),!e.isExecuting&&!c&&d.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:t("agentOutputTool.noResult")})]})})},a6={"a2a-client__call_external_agent":K1};function kr(e,t){return e.toolInput}function ur(e,t){return e.toolUseResult}function o6(e){return{lsToolCall:"LS",readToolCall:"Read",editToolCall:"Edit",writeToolCall:"Write",strReplaceToolCall:"StrReplace",deleteToolCall:"Delete",globToolCall:"Glob",grepToolCall:"Grep",shellToolCall:"Shell",updateTodosToolCall:"TodoWrite",listMcpResourcesToolCall:"ListMcpResources",webFetchToolCall:"WebFetch",semSearchToolCall:"SemanticSearch",mcpToolCall:"MCP"}[e]||e}function l6(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function c6(e){return e<1e3?`${e}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:`${Math.floor(e/6e4)}m ${(e%6e4/1e3).toFixed(0)}s`}function Ul(e){return e.split("/").pop()||e}function yh(e){const t=e.split("/");return t[t.length-1]||t[t.length-2]||e}const Q1=({node:e,depth:t,defaultExpanded:r=!1})=>{const[n,s]=M.useState(r||t===0),i=yh(e.absPath),a=e.childrenDirs.length>0||e.childrenFiles.length>0;return d.jsxs("div",{className:"select-none",children:[d.jsxs("div",{className:`flex items-center py-0.5 hover:bg-gray-100 dark:hover:bg-gray-700 rounded ${a?"cursor-pointer":""}`,style:{paddingLeft:`${t*16}px`},onClick:()=>a&&s(!n),children:[a?n?d.jsx(At,{className:"w-3 h-3 text-gray-400 mr-1 flex-shrink-0"}):d.jsx(qt,{className:"w-3 h-3 text-gray-400 mr-1 flex-shrink-0"}):d.jsx("span",{className:"w-4 mr-1"}),d.jsx(rm,{className:"w-4 h-4 text-yellow-500 dark:text-yellow-400 mr-1.5 flex-shrink-0"}),d.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300 truncate",children:i}),d.jsxs("span",{className:"ml-2 text-xs text-gray-400",children:["(",e.numFiles,")"]})]}),n&&d.jsxs("div",{children:[e.childrenDirs.map((o,l)=>d.jsx(Q1,{node:o,depth:t+1},`dir-${l}-${o.absPath}`)),e.childrenFiles.map((o,l)=>d.jsx(u6,{file:o,depth:t+1},`file-${l}-${o.name}`))]})]})},u6=({file:e,depth:t})=>d.jsxs("div",{className:"flex items-center py-0.5 hover:bg-gray-100 dark:hover:bg-gray-700 rounded",style:{paddingLeft:`${t*16+16}px`},children:[d.jsx(cl,{className:"w-4 h-4 text-gray-400 mr-1.5 flex-shrink-0"}),d.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400 truncate",children:e.name})]}),h6=({execution:e})=>{const{t}=de("components"),r=kr(e),n=ur(e),s=()=>{if(!r?.path)return;const i=n?.success?.directoryTreeRoot;return i?`${yh(r.path)} (${i.numFiles} files)`:yh(r.path)};return d.jsx($e,{execution:e,subtitle:s(),showResult:!1,hideToolName:!1,overrideToolName:"LS",children:d.jsxs("div",{className:"space-y-3",children:[d.jsx(je,{label:t("cursorLsTool.path"),value:r?.path}),r?.ignore&&r.ignore.length>0&&d.jsx(je,{label:t("cursorLsTool.ignore"),value:r.ignore.join(", ")}),n?.success?.directoryTreeRoot&&d.jsx("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-2 max-h-64 overflow-auto bg-gray-50 dark:bg-gray-800",children:d.jsx(Q1,{node:n.success.directoryTreeRoot,depth:0,defaultExpanded:!0})}),n?.success?.directoryTreeRoot?.fullSubtreeExtensionCounts&&d.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 border-t border-gray-200 dark:border-gray-700 pt-2",children:[d.jsxs("span",{className:"font-medium",children:[t("cursorLsTool.extensionStats"),":"]}),d.jsx("div",{className:"flex flex-wrap gap-2 mt-1",children:Object.entries(n.success.directoryTreeRoot.fullSubtreeExtensionCounts).sort(([,i],[,a])=>a-i).slice(0,10).map(([i,a])=>d.jsxs("span",{className:"bg-gray-200 dark:bg-gray-700 px-1.5 py-0.5 rounded",children:[i,": ",a]},i))})]})]})})},d6=({execution:e})=>{const{t}=de("components"),r=kr(e),n=ur(e),s=()=>{if(r?.path)return Ul(r.path)};return d.jsx($e,{execution:e,subtitle:s(),showResult:!1,hideToolName:!1,overrideToolName:"Read",children:d.jsxs("div",{className:"space-y-3",children:[d.jsx(je,{label:t("readTool.readFile"),value:r?.path}),r?.limit&&d.jsx(je,{label:t("readTool.readLines"),value:r.limit}),n?.success&&d.jsxs("div",{className:"flex flex-wrap gap-3 text-xs text-gray-500 dark:text-gray-400 border-t border-gray-200 dark:border-gray-700 pt-2",children:[d.jsx("span",{children:t("cursorReadTool.totalLines",{lines:n.success.totalLines})}),d.jsx("span",{children:t("cursorReadTool.fileSize",{size:l6(n.success.fileSize)})}),n.success.readRange&&d.jsx("span",{children:t("cursorReadTool.readRange",{start:n.success.readRange.startLine,end:n.success.readRange.endLine})}),n.success.exceededLimit&&d.jsx("span",{className:"text-yellow-500 dark:text-yellow-400",children:t("cursorReadTool.exceededLimit")}),n.success.isEmpty&&d.jsx("span",{className:"text-gray-400 dark:text-gray-500",children:t("cursorReadTool.isEmpty")})]})]})})};function f6(e){if(e)try{const t=JSON.parse(e);if(t.success)return t;if(t.diffString||t.linesAdded!==void 0)return{success:t}}catch{}}const g6=({execution:e})=>{const{t}=de("components"),[r,n]=M.useState(!1),[s,i]=M.useState(!1),a=kr(e),o=M.useMemo(()=>{const u=ur(e);return u?.success?u:f6(e.toolResult)},[e]),l=()=>{if(!a?.path)return;const u=Ul(a.path);if(o?.success){const{linesAdded:h,linesRemoved:f}=o.success;return`${u} (+${h} -${f})`}return u},c=u=>u.split(`
419
+ `).map((f,g)=>{let p="text-gray-600 dark:text-gray-400",m=null;return f.startsWith("+")?(p="text-green-600 dark:text-green-400 bg-green-50 dark:bg-green-900/20",m=ul):f.startsWith("-")&&(p="text-red-600 dark:text-red-400 bg-red-50 dark:bg-red-900/20",m=kv),d.jsxs("div",{className:`flex items-start ${p} px-2 py-0.5`,children:[m&&d.jsx(m,{className:"w-3 h-3 mr-1 mt-0.5 flex-shrink-0"}),d.jsx("span",{className:"font-mono text-xs whitespace-pre-wrap break-all",children:f.substring(1)||" "})]},g)});return d.jsx($e,{execution:e,subtitle:l(),showResult:!1,hideToolName:!1,overrideToolName:"Edit",children:d.jsxs("div",{className:"space-y-3",children:[d.jsx(je,{label:t("cursorEditTool.filePath"),value:a?.path}),o?.success&&d.jsxs("div",{className:"flex flex-wrap gap-3 text-xs",children:[d.jsxs("span",{className:"text-green-600 dark:text-green-400",children:["+",o.success.linesAdded," ",t("cursorEditTool.linesAdded")]}),d.jsxs("span",{className:"text-red-600 dark:text-red-400",children:["-",o.success.linesRemoved," ",t("cursorEditTool.linesRemoved")]})]}),o?.success?.message&&d.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:o.success.message}),o?.success?.diffString&&d.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[d.jsxs("div",{className:"flex items-center justify-between p-2 bg-gray-100 dark:bg-gray-700 cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",onClick:()=>n(!r),children:[d.jsx("span",{className:"text-xs font-medium text-gray-700 dark:text-gray-300",children:t("cursorEditTool.viewDiff")}),r?d.jsx(At,{className:"w-4 h-4 text-gray-500"}):d.jsx(qt,{className:"w-4 h-4 text-gray-500"})]}),r&&d.jsx("div",{className:"max-h-64 overflow-auto bg-gray-50 dark:bg-gray-800",children:c(o.success.diffString)})]}),!o?.success?.diffString&&e.toolResult&&d.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[d.jsxs("div",{className:"flex items-center justify-between p-2 bg-gray-100 dark:bg-gray-700 cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",onClick:()=>i(!s),children:[d.jsx("span",{className:"text-xs font-medium text-gray-700 dark:text-gray-300",children:t("cursorEditTool.viewResult","查看结果")}),s?d.jsx(At,{className:"w-4 h-4 text-gray-500"}):d.jsx(qt,{className:"w-4 h-4 text-gray-500"})]}),s&&d.jsx("div",{className:"max-h-64 overflow-auto bg-gray-50 dark:bg-gray-800 p-2",children:d.jsx("pre",{className:"font-mono text-xs text-gray-600 dark:text-gray-400 whitespace-pre-wrap break-all",children:e.toolResult})})]})]})})};function p6(e){if(e)try{const t=JSON.parse(e);if(t.success||t.error)return t;if(t.path&&t.message)return{success:t}}catch{}}const m6=({execution:e})=>{const{t}=de("components"),[r,n]=M.useState(!1),s=kr(e),i=M.useMemo(()=>{const l=ur(e);return l?.success||l?.error?l:p6(e.toolResult)},[e]),a=()=>{if(s?.path)return Ul(s.path)},o=()=>s?.contents?s.contents.split(`
420
+ `).length:0;return d.jsx($e,{execution:e,subtitle:a(),showResult:!1,hideToolName:!1,overrideToolName:"Write",children:d.jsxs("div",{className:"space-y-3",children:[d.jsx(je,{label:t("cursorWriteTool.filePath","文件路径"),value:s?.path}),s?.contents&&d.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-600 dark:text-gray-400",children:[d.jsx(Ch,{className:"w-3 h-3"}),d.jsxs("span",{children:[o()," ",t("cursorWriteTool.lines","行")]})]}),i?.success?.message&&d.jsx("div",{className:"text-sm text-green-600 dark:text-green-400",children:i.success.message}),i?.error&&d.jsx("div",{className:"text-sm text-red-600 dark:text-red-400",children:i.error.error}),s?.contents&&d.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[d.jsxs("div",{className:"flex items-center justify-between p-2 bg-gray-100 dark:bg-gray-700 cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",onClick:()=>n(!r),children:[d.jsx("span",{className:"text-xs font-medium text-gray-700 dark:text-gray-300",children:t("cursorWriteTool.viewContents","查看内容")}),r?d.jsx(At,{className:"w-4 h-4 text-gray-500"}):d.jsx(qt,{className:"w-4 h-4 text-gray-500"})]}),r&&d.jsx("div",{className:"max-h-64 overflow-auto bg-gray-50 dark:bg-gray-800 p-2",children:d.jsx("pre",{className:"font-mono text-xs text-gray-600 dark:text-gray-400 whitespace-pre-wrap break-all",children:s.contents})})]})]})})},x6=({execution:e})=>{const{t}=de("components"),r=kr(e),n=ur(e),s=()=>{if(r?.path)return Ul(r.path)},i=n?.error!==void 0,a=n?.success!==void 0;return d.jsx($e,{execution:e,subtitle:s(),showResult:!1,hideToolName:!1,overrideToolName:"Delete",customIcon:d.jsx(sm,{className:"w-4 h-4"}),children:d.jsxs("div",{className:"space-y-3",children:[d.jsx(je,{label:t("cursorDeleteTool.path"),value:r?.path}),a&&n.success&&d.jsxs("div",{className:"flex items-center p-3 bg-green-50 dark:bg-green-900/20 rounded-lg border border-green-200 dark:border-green-800",children:[d.jsx(nm,{className:"w-5 h-5 text-green-500 dark:text-green-400 mr-2 flex-shrink-0"}),d.jsx("span",{className:"text-sm text-green-700 dark:text-green-300",children:n.success.message||t("cursorDeleteTool.deleteSuccess")})]}),i&&n.error&&d.jsxs("div",{className:"flex items-start p-3 bg-red-50 dark:bg-red-900/20 rounded-lg border border-red-200 dark:border-red-800",children:[d.jsx(rs,{className:"w-5 h-5 text-red-500 dark:text-red-400 mr-2 flex-shrink-0 mt-0.5"}),d.jsxs("div",{children:[d.jsx("p",{className:"text-sm font-medium text-red-700 dark:text-red-300",children:t("cursorDeleteTool.deleteFailed")}),d.jsx("p",{className:"text-xs text-red-600 dark:text-red-400 mt-1",children:n.error.error})]})]})]})})},y6=({execution:e})=>{const{t}=de("components"),[r,n]=M.useState(!0),s=kr(e),i=ur(e),a=()=>{const o=s?.globPattern||"",l=i?.success?.totalFiles;return l!==void 0?`${o} (${l} files)`:o};return d.jsx($e,{execution:e,subtitle:a(),showResult:!1,hideToolName:!1,overrideToolName:"Glob",children:d.jsxs("div",{className:"space-y-3",children:[d.jsx(je,{label:t("cursorGlobTool.pattern"),value:s?.globPattern}),d.jsx(je,{label:t("cursorGlobTool.directory"),value:s?.targetDirectory}),i?.success&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex flex-wrap gap-3 text-xs text-gray-500 dark:text-gray-400",children:[d.jsx("span",{children:t("cursorGlobTool.totalFiles",{count:i.success.totalFiles})}),i.success.clientTruncated&&d.jsx("span",{className:"text-yellow-500 dark:text-yellow-400",children:t("cursorGlobTool.clientTruncated")}),i.success.ripgrepTruncated&&d.jsx("span",{className:"text-yellow-500 dark:text-yellow-400",children:t("cursorGlobTool.ripgrepTruncated")})]}),i.success.files.length>0&&d.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[d.jsxs("div",{className:"flex items-center justify-between p-2 bg-gray-100 dark:bg-gray-700 cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",onClick:()=>n(!r),children:[d.jsxs("span",{className:"text-xs font-medium text-gray-700 dark:text-gray-300",children:[t("cursorGlobTool.matchedFiles")," (",i.success.files.length,")"]}),r?d.jsx(At,{className:"w-4 h-4 text-gray-500"}):d.jsx(qt,{className:"w-4 h-4 text-gray-500"})]}),r&&d.jsx("div",{className:"max-h-48 overflow-auto bg-gray-50 dark:bg-gray-800",children:i.success.files.map((o,l)=>d.jsxs("div",{className:"flex items-center py-1 px-2 hover:bg-gray-100 dark:hover:bg-gray-700 border-b border-gray-100 dark:border-gray-700 last:border-b-0",children:[d.jsx(cl,{className:"w-4 h-4 text-gray-400 mr-2 flex-shrink-0"}),d.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400 truncate font-mono",children:o})]},l))})]}),i.success.files.length===0&&d.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 text-center py-4",children:t("cursorGlobTool.noFilesFound")})]})]})})},b6=({match:e,pattern:t})=>{const r=(n,s)=>{try{const i=new RegExp(`(${s})`,"gi");return n.split(i).map((o,l)=>i.test(o)?d.jsx("mark",{className:"bg-yellow-200 dark:bg-yellow-900 text-yellow-900 dark:text-yellow-200",children:o},l):d.jsx("span",{children:o},l))}catch{return n}};return d.jsxs("div",{className:`flex py-0.5 ${e.isContextLine?"text-gray-400 dark:text-gray-500":"text-gray-700 dark:text-gray-300"}`,children:[d.jsx("span",{className:"w-12 text-right pr-2 text-gray-400 dark:text-gray-500 flex-shrink-0 font-mono text-xs",children:e.lineNumber}),d.jsxs("span",{className:"font-mono text-xs whitespace-pre-wrap break-all",children:[e.isContextLine?e.content:r(e.content,t),e.contentTruncated&&d.jsx("span",{className:"text-gray-400 dark:text-gray-500",children:"..."})]})]})},k6=({fileMatch:e,pattern:t})=>{const[r,n]=M.useState(!0);return d.jsxs("div",{className:"border-b border-gray-200 dark:border-gray-700 last:border-b-0",children:[d.jsxs("div",{className:"flex items-center py-1.5 px-2 bg-gray-100 dark:bg-gray-700 cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600",onClick:()=>n(!r),children:[r?d.jsx(At,{className:"w-3 h-3 text-gray-400 mr-1"}):d.jsx(qt,{className:"w-3 h-3 text-gray-400 mr-1"}),d.jsx(cl,{className:"w-4 h-4 text-gray-400 mr-1.5"}),d.jsx("span",{className:"text-sm font-mono text-gray-700 dark:text-gray-300 truncate",children:e.file}),d.jsxs("span",{className:"ml-2 text-xs text-gray-400",children:["(",e.matches.length,")"]})]}),r&&d.jsx("div",{className:"bg-gray-50 dark:bg-gray-800 px-2 py-1",children:e.matches.map((s,i)=>d.jsx(b6,{match:s,pattern:t},i))})]})},w6=({execution:e})=>{const{t}=de("components"),r=kr(e),n=ur(e),s=()=>{if(!n?.success?.workspaceResults)return[];const u=[];return Object.values(n.success.workspaceResults).forEach(h=>{h.content?.matches&&u.push(...h.content.matches)}),u},i=()=>{if(!n?.success?.workspaceResults)return[];const u=[];return Object.values(n.success.workspaceResults).forEach(h=>{h.files?.files&&u.push(...h.files.files)}),u},a=s(),o=i(),l=a.reduce((u,h)=>u+h.matches.length,0),c=()=>{const u=r?.pattern||"";return n?.success?.outputMode==="files_with_matches"?`"${u}" (${o.length} files)`:`"${u}" (${l} matches)`};return d.jsx($e,{execution:e,subtitle:c(),showResult:!1,hideToolName:!1,overrideToolName:"Grep",children:d.jsxs("div",{className:"space-y-3",children:[d.jsx(je,{label:t("cursorGrepTool.pattern"),value:r?.pattern,isCode:!0}),d.jsx(je,{label:t("cursorGrepTool.path"),value:r?.path}),d.jsxs("div",{className:"flex flex-wrap gap-2 text-xs",children:[r?.glob&&d.jsxs("span",{className:"bg-gray-100 dark:bg-gray-700 px-2 py-0.5 rounded",children:["glob: ",r.glob]}),r?.caseInsensitive&&d.jsx("span",{className:"bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-400 px-2 py-0.5 rounded",children:t("cursorGrepTool.caseInsensitive")}),r?.multiline&&d.jsx("span",{className:"bg-purple-100 dark:bg-purple-900/30 text-purple-700 dark:text-purple-400 px-2 py-0.5 rounded",children:t("cursorGrepTool.multiline")})]}),n?.success&&d.jsxs(d.Fragment,{children:[n.success.outputMode==="content"&&a.length>0&&d.jsx("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden max-h-96 overflow-auto",children:a.map((u,h)=>d.jsx(k6,{fileMatch:u,pattern:r?.pattern||""},h))}),n.success.outputMode==="files_with_matches"&&o.length>0&&d.jsx("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden max-h-48 overflow-auto bg-gray-50 dark:bg-gray-800",children:o.map((u,h)=>d.jsxs("div",{className:"flex items-center py-1 px-2 hover:bg-gray-100 dark:hover:bg-gray-700 border-b border-gray-100 dark:border-gray-700 last:border-b-0",children:[d.jsx(cl,{className:"w-4 h-4 text-gray-400 mr-2 flex-shrink-0"}),d.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400 truncate font-mono",children:u})]},h))}),a.length===0&&o.length===0&&d.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 text-center py-4",children:t("cursorGrepTool.noMatchesFound")})]})]})})},v6=({execution:e})=>{const{t}=de("components"),r=kr(e),n=ur(e),s=()=>{if(!r?.command)return;const c=r.command.trim();return c.length>60?c.slice(0,60)+"...":c},a=n?.success?n.success.interleavedOutput||n.success.stdout+(n.success.stderr?`
421
+ `+n.success.stderr:""):null,o=n?.success?.exitCode,l=o!==void 0&&o!==0;return d.jsx($e,{execution:e,subtitle:s(),showResult:!1,hideToolName:!1,overrideToolName:"Shell",children:d.jsxs("div",{className:"space-y-3",children:[r?.workingDirectory&&d.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:[d.jsx("span",{className:"font-medium",children:"CWD:"})," ",r.workingDirectory]}),d.jsxs("div",{className:"bg-gray-900 rounded-lg p-4 font-mono text-sm",children:[d.jsxs("div",{className:"flex items-start",children:[d.jsx("span",{className:"text-green-400 mr-2 select-none",children:"$"}),d.jsx("span",{className:"text-white break-all flex-1",children:r?.command})]}),!e.isExecuting&&a&&d.jsx("div",{className:"mt-2",children:d.jsx("pre",{className:`whitespace-pre-wrap break-words ${l?"text-red-400":"text-gray-300"}`,children:a})}),e.isExecuting&&d.jsx("div",{className:"mt-2",children:d.jsx("span",{className:"text-yellow-400 animate-pulse",children:t("bashTool.executing")})})]}),n?.success&&d.jsxs("div",{className:"flex flex-wrap gap-3 text-xs text-gray-500 dark:text-gray-400",children:[d.jsx("span",{className:`${l?"text-red-500 dark:text-red-400":"text-green-500 dark:text-green-400"}`,children:t("cursorShellTool.exitCode",{code:o})}),n.success.executionTime!==void 0&&d.jsx("span",{children:t("cursorShellTool.executionTime",{time:c6(n.success.executionTime)})}),n.isBackground&&d.jsx("span",{className:"text-blue-500 dark:text-blue-400",children:t("cursorShellTool.background")})]})]})})},C6=({status:e})=>{switch(e){case"TODO_STATUS_COMPLETED":return d.jsx(nm,{className:"w-4 h-4 text-green-500 dark:text-green-400"});case"TODO_STATUS_IN_PROGRESS":return d.jsx(Tn,{className:"w-4 h-4 text-blue-500 dark:text-blue-400 animate-spin"});case"TODO_STATUS_PENDING":default:return d.jsx(Kc,{className:"w-4 h-4 text-gray-400 dark:text-gray-500"})}},S6=e=>{switch(e){case"TODO_STATUS_COMPLETED":return"text-green-700 dark:text-green-400 bg-green-50 dark:bg-green-900/20";case"TODO_STATUS_IN_PROGRESS":return"text-blue-700 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/20";case"TODO_STATUS_PENDING":default:return"text-gray-700 dark:text-gray-400 bg-gray-50 dark:bg-gray-800"}},_6=({todo:e})=>d.jsxs("div",{className:`flex items-start p-2 rounded-lg border ${S6(e.status)} border-gray-200 dark:border-gray-700`,children:[d.jsx("div",{className:"flex-shrink-0 mt-0.5",children:d.jsx(C6,{status:e.status})}),d.jsxs("div",{className:"ml-3 flex-1 min-w-0",children:[d.jsx("p",{className:`text-sm ${e.status==="TODO_STATUS_COMPLETED"?"line-through opacity-60":""}`,children:e.content}),e.dependencies.length>0&&d.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:["Dependencies: ",e.dependencies.join(", ")]})]})]}),T6=({execution:e})=>{const{t}=de("components"),r=kr(e),s=ur(e)?.success?.todos||r?.todos||[],i={completed:s.filter(o=>o.status==="TODO_STATUS_COMPLETED").length,inProgress:s.filter(o=>o.status==="TODO_STATUS_IN_PROGRESS").length,pending:s.filter(o=>o.status==="TODO_STATUS_PENDING").length},a=()=>`${i.completed}/${s.length} completed`;return d.jsx($e,{execution:e,subtitle:a(),showResult:!1,hideToolName:!1,overrideToolName:"TodoWrite",children:d.jsxs("div",{className:"space-y-3",children:[d.jsxs("div",{className:"flex flex-wrap gap-2 text-xs",children:[d.jsxs("span",{className:"bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400 px-2 py-0.5 rounded",children:[t("cursorTodoTool.completed"),": ",i.completed]}),d.jsxs("span",{className:"bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-400 px-2 py-0.5 rounded",children:[t("cursorTodoTool.inProgress"),": ",i.inProgress]}),d.jsxs("span",{className:"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-400 px-2 py-0.5 rounded",children:[t("cursorTodoTool.pending"),": ",i.pending]}),r?.merge!==void 0&&d.jsx("span",{className:`px-2 py-0.5 rounded ${r.merge?"bg-purple-100 dark:bg-purple-900/30 text-purple-700 dark:text-purple-400":"bg-orange-100 dark:bg-orange-900/30 text-orange-700 dark:text-orange-400"}`,children:r.merge?t("cursorTodoTool.merge"):t("cursorTodoTool.replace")})]}),s.length>0&&d.jsx("div",{className:"space-y-2 max-h-64 overflow-auto",children:s.map(o=>d.jsx(_6,{todo:o},o.id))}),s.length===0&&d.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 text-center py-4",children:t("cursorTodoTool.noTodos")})]})})},N6=({resource:e})=>d.jsxs("div",{className:"flex items-start p-2 border border-gray-200 dark:border-gray-700 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:[d.jsx(em,{className:"w-4 h-4 text-blue-500 dark:text-blue-400 mr-2 mt-0.5 flex-shrink-0"}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("p",{className:"text-sm font-medium text-gray-800 dark:text-gray-200 truncate",children:e.name}),e.description&&d.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:e.description}),d.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[d.jsx("code",{className:"text-xs text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/30 px-1.5 py-0.5 rounded truncate",children:e.uri}),e.mimeType&&d.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:e.mimeType})]})]})]}),E6=({execution:e})=>{const{t}=de("components"),n=ur(e)?.success?.resources||[],s=()=>`${n.length} resources`;return d.jsx($e,{execution:e,subtitle:s(),showResult:!1,hideToolName:!1,overrideToolName:"ListMcpResources",customIcon:d.jsx(im,{className:"w-4 h-4"}),children:d.jsxs("div",{className:"space-y-3",children:[n.length>0&&d.jsx("div",{className:"space-y-2 max-h-64 overflow-auto",children:n.map((i,a)=>d.jsx(N6,{resource:i},a))}),n.length===0&&d.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 text-center py-4",children:t("cursorMcpResourcesTool.noResources")})]})})},A6=({execution:e})=>{const{t}=de("components"),[r,n]=M.useState(!1),s=kr(e),i=ur(e),a=()=>{if(s?.url)try{return new URL(s.url).hostname}catch{return s.url.slice(0,40)}},o=i?.error!==void 0,l=i?.success!==void 0;return d.jsx($e,{execution:e,subtitle:a(),showResult:!1,hideToolName:!1,overrideToolName:"WebFetch",customIcon:d.jsx(wv,{className:"w-4 h-4"}),children:d.jsxs("div",{className:"space-y-3",children:[d.jsx(je,{label:t("cursorWebFetchTool.url"),value:s?.url}),l&&i.success&&d.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[d.jsxs("div",{className:"flex items-center justify-between p-2 bg-gray-100 dark:bg-gray-700 cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",onClick:()=>n(!r),children:[d.jsx("span",{className:"text-xs font-medium text-gray-700 dark:text-gray-300",children:t("cursorWebFetchTool.fetchedContent")}),r?d.jsx(At,{className:"w-4 h-4 text-gray-500"}):d.jsx(qt,{className:"w-4 h-4 text-gray-500"})]}),r&&d.jsx("div",{className:"max-h-64 overflow-auto p-3 bg-gray-50 dark:bg-gray-800",children:d.jsx("pre",{className:"text-sm text-gray-700 dark:text-gray-300 whitespace-pre-wrap break-words font-mono",children:i.success.markdown.length>2e3?i.success.markdown.slice(0,2e3)+`
422
+
423
+ ...(truncated)`:i.success.markdown})})]}),o&&i.error&&d.jsxs("div",{className:"flex items-start p-3 bg-red-50 dark:bg-red-900/20 rounded-lg border border-red-200 dark:border-red-800",children:[d.jsx(rs,{className:"w-5 h-5 text-red-500 dark:text-red-400 mr-2 flex-shrink-0 mt-0.5"}),d.jsxs("div",{children:[d.jsx("p",{className:"text-sm font-medium text-red-700 dark:text-red-300",children:t("cursorWebFetchTool.fetchFailed")}),d.jsx("p",{className:"text-xs text-red-600 dark:text-red-400 mt-1",children:i.error.error})]})]})]})})},M6=({execution:e})=>{const{t}=de("components"),[r,n]=M.useState(!0),s=kr(e),i=ur(e),a=()=>{if(!s?.query)return;const c=s.query.trim();return c.length>50?c.slice(0,50)+"...":c},o=c=>{const u=[],h=/<search_result\s+path="([^"]+)"\s+startLine="(\d+)"\s+endLine="(\d+)">([\s\S]*?)<\/search_result>/g;let f;for(;(f=h.exec(c))!==null;)u.push({path:f[1],startLine:f[2],endLine:f[3],content:f[4].trim()});return u},l=i?.success?.results?o(i.success.results):[];return d.jsx($e,{execution:e,subtitle:a(),showResult:!1,hideToolName:!1,overrideToolName:"SemanticSearch",customIcon:d.jsx(Yc,{className:"w-4 h-4"}),children:d.jsxs("div",{className:"space-y-3",children:[d.jsx(je,{label:t("cursorSemSearchTool.query"),value:s?.query}),s?.targetDirectories&&s.targetDirectories.length>0&&d.jsx(je,{label:t("cursorSemSearchTool.targetDirectories"),value:s.targetDirectories.join(", ")}),s?.explanation&&d.jsx(je,{label:t("cursorSemSearchTool.explanation"),value:s.explanation}),l.length>0&&d.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[d.jsxs("div",{className:"flex items-center justify-between p-2 bg-gray-100 dark:bg-gray-700 cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",onClick:()=>n(!r),children:[d.jsx("span",{className:"text-xs font-medium text-gray-700 dark:text-gray-300",children:t("cursorSemSearchTool.results",{count:l.length})}),r?d.jsx(At,{className:"w-4 h-4 text-gray-500"}):d.jsx(qt,{className:"w-4 h-4 text-gray-500"})]}),r&&d.jsx("div",{className:"max-h-96 overflow-auto",children:l.map((c,u)=>d.jsxs("div",{className:"border-b border-gray-200 dark:border-gray-700 last:border-b-0",children:[d.jsxs("div",{className:"flex items-center px-3 py-2 bg-gray-50 dark:bg-gray-800",children:[d.jsx("span",{className:"text-sm font-mono text-blue-600 dark:text-blue-400 truncate",children:c.path}),d.jsxs("span",{className:"ml-2 text-xs text-gray-400",children:["L",c.startLine,"-",c.endLine]})]}),d.jsx("div",{className:"p-2 bg-gray-900 dark:bg-gray-950",children:d.jsx("pre",{className:"text-xs text-gray-300 whitespace-pre-wrap break-words overflow-auto max-h-40",children:c.content.length>500?c.content.slice(0,500)+`
424
+ ...(truncated)`:c.content})})]},u))})]}),i?.success?.results&&l.length===0&&d.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[d.jsx("div",{className:"p-2 bg-gray-100 dark:bg-gray-700",children:d.jsx("span",{className:"text-xs font-medium text-gray-700 dark:text-gray-300",children:t("cursorSemSearchTool.rawResults")})}),d.jsx("div",{className:"p-2 bg-gray-50 dark:bg-gray-800 max-h-64 overflow-auto",children:d.jsx("pre",{className:"text-xs text-gray-600 dark:text-gray-400 whitespace-pre-wrap break-words",children:i.success.results})})]}),i?.success&&!i.success.results&&d.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 text-center py-4",children:t("cursorSemSearchTool.noResults")})]})})},j6=({content:e})=>{if(e.text?.text)try{const t=JSON.parse(e.text.text);return d.jsx("pre",{className:"text-xs text-gray-600 dark:text-gray-400 whitespace-pre-wrap break-words bg-gray-50 dark:bg-gray-800 p-2 rounded",children:JSON.stringify(t,null,2)})}catch{return d.jsx("pre",{className:"text-xs text-gray-600 dark:text-gray-400 whitespace-pre-wrap break-words",children:e.text.text})}return e.image?d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Us,{className:"w-4 h-4 text-gray-400"}),d.jsxs("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:["Image (",e.image.mimeType,")"]}),e.image.data&&d.jsx("img",{src:`data:${e.image.mimeType};base64,${e.image.data}`,alt:"MCP Result",className:"max-w-xs max-h-32 rounded border border-gray-200 dark:border-gray-700"})]}):e.resource?d.jsxs("div",{className:"text-sm",children:[d.jsx("div",{className:"text-blue-600 dark:text-blue-400 font-mono text-xs",children:e.resource.uri}),e.resource.text&&d.jsx("pre",{className:"text-xs text-gray-600 dark:text-gray-400 whitespace-pre-wrap break-words mt-1",children:e.resource.text})]}):null},I6=({execution:e})=>{const{t}=de("components"),[r,n]=M.useState(!1),[s,i]=M.useState(!0),a=kr(e),o=ur(e),l=()=>{if(a)return`${a.providerIdentifier}:${a.toolName}`},c=o?.success?.isError||o?.error!==void 0;return d.jsx($e,{execution:e,subtitle:l(),showResult:!1,hideToolName:!1,overrideToolName:"MCP",customIcon:d.jsx(im,{className:"w-4 h-4"}),isMcpTool:!0,children:d.jsxs("div",{className:"space-y-3",children:[d.jsxs("div",{className:"flex flex-wrap gap-2 text-xs",children:[d.jsxs("span",{className:"bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-400 px-2 py-0.5 rounded",children:[t("cursorMcpTool.server"),": ",a?.providerIdentifier]}),d.jsxs("span",{className:"bg-purple-100 dark:bg-purple-900/30 text-purple-700 dark:text-purple-400 px-2 py-0.5 rounded",children:[t("cursorMcpTool.tool"),": ",a?.toolName]})]}),a?.args&&Object.keys(a.args).length>0&&d.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[d.jsxs("div",{className:"flex items-center justify-between p-2 bg-gray-100 dark:bg-gray-700 cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",onClick:()=>n(!r),children:[d.jsx("span",{className:"text-xs font-medium text-gray-700 dark:text-gray-300",children:t("cursorMcpTool.parameters")}),r?d.jsx(At,{className:"w-4 h-4 text-gray-500"}):d.jsx(qt,{className:"w-4 h-4 text-gray-500"})]}),r&&d.jsx("div",{className:"p-2 bg-gray-50 dark:bg-gray-800",children:d.jsx("pre",{className:"text-xs text-gray-600 dark:text-gray-400 whitespace-pre-wrap break-words",children:JSON.stringify(a.args,null,2)})})]}),o&&d.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[d.jsxs("div",{className:`flex items-center justify-between p-2 cursor-pointer transition-colors ${c?"bg-red-50 dark:bg-red-900/20 hover:bg-red-100 dark:hover:bg-red-900/30":"bg-green-50 dark:bg-green-900/20 hover:bg-green-100 dark:hover:bg-green-900/30"}`,onClick:()=>i(!s),children:[d.jsxs("div",{className:"flex items-center gap-2",children:[c&&d.jsx(rs,{className:"w-4 h-4 text-red-500"}),d.jsx("span",{className:`text-xs font-medium ${c?"text-red-700 dark:text-red-400":"text-green-700 dark:text-green-400"}`,children:t(c?"cursorMcpTool.error":"cursorMcpTool.result")})]}),s?d.jsx(At,{className:"w-4 h-4 text-gray-500"}):d.jsx(qt,{className:"w-4 h-4 text-gray-500"})]}),s&&d.jsxs("div",{className:"p-2 bg-gray-50 dark:bg-gray-800 max-h-64 overflow-auto",children:[o.success?.content&&d.jsx("div",{className:"space-y-2",children:o.success.content.map((u,h)=>d.jsx(j6,{content:u},h))}),o.error&&d.jsx("div",{className:"text-sm text-red-600 dark:text-red-400",children:o.error.error})]})]})]})})},L6=({execution:e})=>{const{t}=de("components");switch(e.toolName){case"lsToolCall":return d.jsx(h6,{execution:e});case"readToolCall":return d.jsx(d6,{execution:e});case"editToolCall":case"strReplaceToolCall":return d.jsx(g6,{execution:e});case"writeToolCall":return d.jsx(m6,{execution:e});case"deleteToolCall":return d.jsx(x6,{execution:e});case"globToolCall":return d.jsx(y6,{execution:e});case"grepToolCall":return d.jsx(w6,{execution:e});case"shellToolCall":return d.jsx(v6,{execution:e});case"updateTodosToolCall":return d.jsx(T6,{execution:e});case"listMcpResourcesToolCall":return d.jsx(E6,{execution:e});case"webFetchToolCall":return d.jsx(A6,{execution:e});case"semSearchToolCall":return d.jsx(M6,{execution:e});case"mcpToolCall":return d.jsx(I6,{execution:e});default:return d.jsx($e,{execution:e,overrideToolName:o6(e.toolName),children:d.jsxs("div",{children:[d.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-2",children:t("cursorToolRenderer.unknownCursorTool",{toolName:e.toolName})}),d.jsx("div",{className:"text-xs text-gray-500 bg-gray-100 dark:bg-gray-700 p-2 rounded font-mono overflow-auto max-h-64",children:d.jsx("pre",{className:"whitespace-pre-wrap break-words",children:JSON.stringify(e.toolInput,null,2)})})]})})}};function $6(e){return["lsToolCall","readToolCall","editToolCall","writeToolCall","strReplaceToolCall","deleteToolCall","globToolCall","grepToolCall","shellToolCall","updateTodosToolCall","listMcpResourcesToolCall","webFetchToolCall","semSearchToolCall","mcpToolCall"].includes(e)}const Z1=({execution:e,onAskUserQuestionSubmit:t})=>{const{t:r}=de("components"),n=X1(e.toolName);if(n){if(n.serverName==="ask-user-question"&&n.toolName==="ask_user_question")return d.jsx(Bp,{execution:e,onSubmit:t});const s=`${n.serverName}__${n.toolName}`,i=a6[s];return i?d.jsx(i,{execution:e}):d.jsx(t6,{execution:e})}if($6(e.toolName))return d.jsx(L6,{execution:e});switch(e.toolName){case"Task":return d.jsx(yO,{execution:e});case"Bash":return d.jsx(bO,{execution:e});case"BashOutput":return d.jsx(hv,{execution:e});case"KillBash":return d.jsx(uv,{execution:e});case"Glob":return d.jsx(kO,{execution:e});case"Grep":return d.jsx(wO,{execution:e});case"LS":return d.jsx(vO,{execution:e});case"exit_plan_mode":return d.jsx(CO,{execution:e});case"Read":return d.jsx(SO,{execution:e});case"Edit":return d.jsx(FO,{execution:e});case"MultiEdit":return d.jsx(OO,{execution:e});case"Write":return d.jsx(HO,{execution:e});case"NotebookRead":return d.jsx(qO,{execution:e});case"NotebookEdit":return d.jsx(UO,{execution:e});case"ListMcpResources":return d.jsx(VO,{execution:e});case"ReadMcpResource":return d.jsx(GO,{execution:e});case"TimeMachine":return d.jsx(YO,{execution:e});case"AskUserQuestion":return d.jsx(Bp,{execution:e,onSubmit:t});case"WebFetch":return d.jsx(XO,{execution:e});case"TodoWrite":return d.jsx(cv,{execution:e});case"WebSearch":return d.jsx(KO,{execution:e});case"call_external_agent":return d.jsx(K1,{execution:e});case"Skill":return d.jsx(s6,{execution:e});case"AgentOutput":return d.jsx(i6,{execution:e});default:return d.jsx($e,{execution:e,children:d.jsxs("div",{children:[d.jsx("p",{className:"text-sm text-gray-600 mb-2",children:r("toolRenderer.unknownToolType")}),d.jsx("div",{className:"text-xs text-gray-500 bg-gray-100 p-2 rounded font-mono",children:JSON.stringify(e.toolInput,null,2)})]})})}},D6=e=>({id:`tool_${Date.now()}_${Math.random()}`,toolName:e.toolName,toolInput:e.toolInput,toolResult:e.toolResult,toolUseResult:e.toolUseResult,isExecuting:e.isExecuting||!1,isError:e.isError||!1,timestamp:new Date,claudeId:e.claudeId}),Fp=e=>{const t=D6(e);return d.jsx(Z1,{execution:t,onAskUserQuestionSubmit:e.onAskUserQuestionSubmit})},ll=({images:e,initialIndex:t=0,onClose:r})=>{const[n,s]=M.useState(()=>!e||e.length===0?0:Math.min(t,e.length-1)),[i,a]=M.useState(1),[o,l]=M.useState({x:0,y:0}),[c,u]=M.useState(!1),[h,f]=M.useState({x:0,y:0}),[g,p]=M.useState(0),[m,y]=M.useState(!1),x=M.useRef(null),k=M.useRef(null),C=()=>{if(!x.current||!k.current)return 1;const I=x.current,F=k.current,W=I.naturalWidth,ee=I.naturalHeight,A=F.clientWidth,G=F.clientHeight-120,$=A/W,E=G/ee;return Math.min($,E,1)},T=()=>{y(!0);const I=C();a(I),l({x:0,y:0})},S=e&&e.length>0?e[n]:"",w=()=>{e&&n>0&&s(n-1)},_=()=>{e&&n<e.length-1&&s(n+1)};M.useEffect(()=>{if(e&&e.length>0){const I=Math.min(t,e.length-1);s(I)}},[e,t]),M.useEffect(()=>{S&&(a(1),l({x:0,y:0}),p(0),u(!1),y(!1))},[S]),M.useEffect(()=>{if(!S)return;const I=F=>{switch(F.key){case"Escape":r();break;case"ArrowLeft":F.preventDefault(),w();break;case"ArrowRight":F.preventDefault(),_();break;case"ArrowUp":F.preventDefault(),w();break;case"ArrowDown":F.preventDefault(),_();break;case"=":case"+":(F.ctrlKey||F.metaKey)&&(F.preventDefault(),O("in"));break;case"-":(F.ctrlKey||F.metaKey)&&(F.preventDefault(),O("out"));break;case"0":(F.ctrlKey||F.metaKey)&&(F.preventDefault(),B());break;case"r":case"R":(F.ctrlKey||F.metaKey)&&(F.preventDefault(),P());break}};return window.addEventListener("keydown",I),()=>window.removeEventListener("keydown",I)},[S,n,e?.length]);const O=I=>{a(F=>{const W=I==="in"?F*1.2:F/1.2;return Math.max(.1,Math.min(5,W))})},P=()=>{p(I=>(I+90)%360)},v=I=>{I.target===x.current&&(u(!0),f({x:I.clientX-o.x,y:I.clientY-o.y}))},L=I=>{c&&l({x:I.clientX-h.x,y:I.clientY-h.y})},N=()=>{u(!1)},R=I=>{I.preventDefault();const F=I.deltaY>0?"out":"in";O(F)},j=()=>{if(S){const I=document.createElement("a");I.href=S,I.download=`image-${n+1}.jpg`,I.click()}},B=()=>{const I=C();a(I),l({x:0,y:0}),p(0)};return!e||e.length===0?null:d.jsxs("div",{ref:k,className:"fixed inset-0 bg-black bg-opacity-90 flex items-center justify-center z-50",onClick:I=>{I.target===k.current&&r()},onMouseMove:L,onMouseUp:N,onWheel:R,children:[d.jsxs("div",{className:"absolute top-4 left-1/2 transform -translate-x-1/2 flex items-center space-x-2 bg-black bg-opacity-50 rounded-lg px-4 py-2 z-10",children:[e.length>1&&d.jsxs(d.Fragment,{children:[d.jsxs("span",{className:"text-white text-sm",children:[n+1," / ",e.length]}),d.jsx("div",{className:"w-px h-6 bg-gray-500"})]}),d.jsx("button",{onClick:()=>O("out"),className:"text-white hover:text-gray-300 p-2 hover:bg-white hover:bg-opacity-20 rounded transition-colors",title:"缩小 (Ctrl + -)",children:d.jsx(Zp,{className:"w-5 h-5"})}),d.jsxs("span",{className:"text-white text-sm min-w-16 text-center",children:[Math.round(i*100),"%"]}),d.jsx("button",{onClick:()=>O("in"),className:"text-white hover:text-gray-300 p-2 hover:bg-white hover:bg-opacity-20 rounded transition-colors",title:"放大 (Ctrl + +)",children:d.jsx(Jp,{className:"w-5 h-5"})}),d.jsx("div",{className:"w-px h-6 bg-gray-500"}),d.jsx("button",{onClick:P,className:"text-white hover:text-gray-300 p-2 hover:bg-white hover:bg-opacity-20 rounded transition-colors",title:"旋转 90°",children:d.jsx(vv,{className:"w-5 h-5"})}),d.jsx("button",{onClick:B,className:"text-white hover:text-gray-300 p-2 hover:bg-white hover:bg-opacity-20 rounded transition-colors text-sm",title:"适应窗口大小",children:"适应"}),d.jsx("button",{onClick:()=>{a(1),l({x:0,y:0}),p(0)},className:"text-white hover:text-gray-300 p-2 hover:bg-white hover:bg-opacity-20 rounded transition-colors text-sm",title:"显示原始大小",children:"1:1"}),d.jsx("button",{onClick:j,className:"text-white hover:text-gray-300 p-2 hover:bg-white hover:bg-opacity-20 rounded transition-colors",title:"下载图片",children:d.jsx(tm,{className:"w-5 h-5"})})]}),e.length>1&&d.jsxs(d.Fragment,{children:[d.jsx("button",{onClick:w,disabled:n===0,className:`absolute left-4 top-1/2 transform -translate-y-1/2 text-white p-3 rounded-full transition-all z-10 ${n===0?"opacity-50 cursor-not-allowed":"hover:text-gray-300 hover:bg-white hover:bg-opacity-20"}`,title:"上一张 (←)",children:d.jsx(am,{className:"w-8 h-8"})}),d.jsx("button",{onClick:_,disabled:n===e.length-1,className:`absolute right-4 top-1/2 transform -translate-y-1/2 text-white p-3 rounded-full transition-all z-10 ${n===e.length-1?"opacity-50 cursor-not-allowed":"hover:text-gray-300 hover:bg-white hover:bg-opacity-20"}`,title:"下一张 (→)",children:d.jsx(qt,{className:"w-8 h-8"})})]}),d.jsx("button",{onClick:r,className:"absolute top-4 right-4 text-white hover:text-gray-300 p-2 hover:bg-white hover:bg-opacity-20 rounded-full transition-colors z-10",title:"关闭预览 (ESC)",children:d.jsx(ts,{className:"w-6 h-6"})}),d.jsx("img",{ref:x,src:S,alt:`图片预览 ${n+1}/${e.length}`,className:`max-w-none transition-transform ${c?"cursor-grabbing":"cursor-grab"}`,style:{transform:`translate(${o.x}px, ${o.y}px) scale(${i}) rotate(${g}deg)`,maxHeight:"none",maxWidth:"none",opacity:m?1:0},onLoad:T,onMouseDown:v,onDoubleClick:B,draggable:!1,onClick:I=>I.stopPropagation()}),d.jsx("div",{className:"absolute bottom-4 left-1/2 transform -translate-x-1/2 text-white text-sm bg-black bg-opacity-50 rounded px-3 py-1",children:e.length>1?"方向键切换 • 鼠标拖拽移动 • 滚轮缩放 • 双击适应窗口 • ESC关闭":"鼠标拖拽移动 • 滚轮缩放 • 双击适应窗口 • ESC关闭"})]})},B6=({content:e})=>{const{t}=de("components"),r=typeof e=="string"?e:Array.isArray(e)?e.map(i=>i.text||JSON.stringify(i)).join(""):String(e),[n,s]=M.useState(!1);return d.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg bg-gray-50 dark:bg-gray-800/50",children:[d.jsxs("button",{onClick:()=>s(!n),className:"w-full flex items-center justify-between p-3 text-left hover:bg-gray-100 dark:hover:bg-gray-700/50 transition-colors",children:[d.jsxs("div",{className:"flex items-center space-x-2",children:[d.jsx(Cv,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"}),d.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:t("compactSummary.title")})]}),d.jsxs("div",{className:"flex items-center space-x-1",children:[d.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:t(n?"compactSummary.collapse":"compactSummary.expand")}),n?d.jsx(At,{className:"w-4 h-4 text-gray-500 dark:text-gray-400"}):d.jsx(qt,{className:"w-4 h-4 text-gray-500 dark:text-gray-400"})]})]}),n&&d.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 p-4 bg-white dark:bg-gray-800",children:d.jsx("div",{className:"text-sm",children:d.jsx(Ji,{content:r})})})]})},R6=({message:e,onAskUserQuestionSubmit:t})=>{const[r,n]=M.useState([]),[s,i]=M.useState(0),a=()=>{const c=[];return e.messageParts&&e.messageParts.length>0&&e.messageParts.forEach(u=>{u.type==="image"&&u.imageData&&c.push(`data:${u.imageData.mediaType};base64,${u.imageData.data}`)}),e.images&&e.images.length>0&&e.images.forEach(u=>{c.push(`data:${u.mediaType};base64,${u.data}`)}),c},o=c=>{const u=a(),h=u.indexOf(c);n(u),i(h>=0?h:0)},l=()=>{n([]),i(0)};if(e.messageParts&&e.messageParts.length>0){const c=[...e.messageParts].sort((u,h)=>u.order-h.order);return d.jsxs("div",{className:"space-y-3",children:[e.images&&e.images.length>0&&d.jsx("div",{className:"flex flex-wrap gap-2",children:e.images.map(u=>{const h=`data:${u.mediaType};base64,${u.data}`;return d.jsx("img",{src:h,alt:u.filename||"Image",className:"max-w-32 max-h-32 object-cover rounded-lg border border-gray-200 dark:border-gray-700 cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>o(h),title:u.filename||"Click to preview"},u.id)})}),c.map(u=>{if(u.type==="command"&&u.content){const h=u.content.trim(),f=h.indexOf(" "),g=f>0?h.substring(0,f):h,p=f>0?h.substring(f+1).trim():"";return d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"inline-flex items-center px-2.5 py-1 bg-gray-800 dark:bg-gray-900 text-emerald-400 dark:text-emerald-300 rounded-md text-sm font-mono font-medium",children:g}),p&&d.jsx("span",{className:"text-gray-100 text-sm",children:p})]},u.id)}else{if(u.type==="compactSummary"&&u.content)return d.jsx("div",{children:d.jsx(B6,{content:u.content})},u.id);if(u.type==="text"&&u.content)return d.jsx("div",{children:d.jsx(Ji,{content:u.content,isUserMessage:e.role==="user"})},u.id);if(u.type==="thinking"&&u.content)return d.jsxs("details",{className:"my-2",children:[d.jsx("summary",{className:"cursor-pointer text-gray-500 dark:text-gray-400 text-sm hover:text-gray-700 dark:hover:text-gray-300 transition-colors select-none",children:"💭 思考过程..."}),d.jsx("div",{className:"mt-2 pl-4 border-l-2 border-gray-200 dark:border-gray-700",children:d.jsx("div",{className:"text-gray-600 dark:text-gray-300 text-sm whitespace-pre-wrap break-words leading-relaxed italic",children:u.content})})]},u.id);if(u.type==="tool"&&u.toolData)return d.jsx(Fp,{toolName:u.toolData.toolName,toolInput:u.toolData.toolInput,toolResult:u.toolData.toolResult,toolUseResult:u.toolData.toolUseResult,isError:u.toolData.isError,isExecuting:u.toolData.isExecuting,claudeId:u.toolData.claudeId,onAskUserQuestionSubmit:t},u.id);if(u.type==="image"&&u.imageData){const h=`data:${u.imageData.mediaType};base64,${u.imageData.data}`;return d.jsx("div",{className:"inline-block",children:d.jsx("img",{src:h,alt:u.imageData.filename||"Image",className:"max-w-32 max-h-32 object-cover rounded-lg border border-gray-200 dark:border-gray-700 cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>o(h),title:u.imageData.filename||"Click to preview"})},u.id)}else if(u.type==="text"&&u.content&&u.content.includes("unknown"))if(u.content.includes('"type":"thinking"')||u.content.includes('"thinking"')||u.content.includes("thinking")){let f=u.content;try{if(u.content.includes('"thinking":')){const g=u.content.match(/"thinking":"([^"]+)"/);g&&g[1]&&(f=g[1].replace(/\\n/g,`
425
+ `).replace(/\\"/g,'"'))}}catch(g){console.warn("Failed to parse thinking content:",g)}return d.jsxs("details",{className:"my-2",children:[d.jsx("summary",{className:"cursor-pointer text-gray-500 dark:text-gray-400 text-sm hover:text-gray-700 dark:hover:text-gray-300 transition-colors select-none",children:"💭 思考过程... (历史消息)"}),d.jsx("div",{className:"mt-2 pl-4 border-l-2 border-gray-200 dark:border-gray-700",children:d.jsx("div",{className:"text-gray-600 dark:text-gray-300 text-sm whitespace-pre-wrap break-words leading-relaxed italic",children:f})})]},u.id)}else return d.jsx("div",{children:d.jsx(Ji,{content:u.content,isUserMessage:e.role==="user"})},u.id)}return null}),d.jsx(ll,{images:r,initialIndex:s,onClose:l})]})}return d.jsxs("div",{className:"space-y-2",children:[e.images&&e.images.length>0&&d.jsx("div",{className:"flex flex-wrap gap-2",children:e.images.map(c=>{const u=`data:${c.mediaType};base64,${c.data}`;return d.jsx("img",{src:u,alt:c.filename||"Image",className:"max-w-32 max-h-32 object-cover rounded-lg border border-gray-200 dark:border-gray-700 cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>o(u),title:c.filename||"Click to preview"},c.id)})}),e.content&&d.jsx("div",{children:(()=>{const c=e.content.match(/<command-message>.*?<\/command-message>\s*<command-name>(.+?)<\/command-name>/);if(c){const u=c[1].trim(),h=u.indexOf(" "),f=h>0?u.substring(0,h):u,g=h>0?u.substring(h+1).trim():"";return d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"inline-flex items-center px-2.5 py-1 bg-gray-800 dark:bg-gray-900 text-emerald-400 dark:text-emerald-300 rounded-md text-sm font-mono font-medium",children:f}),g&&d.jsx("span",{className:"text-gray-100 text-sm",children:g})]})}else return d.jsx(Ji,{content:e.content,isUserMessage:e.role==="user"})})()}),e.toolUsage&&e.toolUsage.length>0&&d.jsx("div",{className:"space-y-2",children:e.toolUsage.map(c=>d.jsx(Fp,{toolName:c.toolName,toolInput:c.toolInput,toolResult:c.toolResult,toolUseResult:c.toolUseResult,isError:c.isError,isExecuting:c.isExecuting,claudeId:c.claudeId,onAskUserQuestionSubmit:t},c.id))}),d.jsx(ll,{images:r,initialIndex:s,onClose:l})]})},J1=M.memo(R6),P6=({messages:e,isLoadingMessages:t,isInitializingSession:r,isAiTyping:n,isStopping:s,messagesContainerRef:i,messagesEndRef:a,onAskUserQuestionSubmit:o})=>{const{t:l}=de("components"),c=M.useMemo(()=>e.map(u=>d.jsx("div",{className:"px-4",children:d.jsx("div",{className:`text-sm leading-relaxed break-words overflow-hidden ${u.role==="user"?"text-white p-3 rounded-lg":"text-gray-800 dark:text-gray-200"}`,style:u.role==="user"?{backgroundColor:"hsl(var(--primary))",color:"white"}:{},children:d.jsx(J1,{message:u,onAskUserQuestionSubmit:o})})},u.id)),[e,o]);return d.jsxs("div",{ref:i,className:"flex-1 overflow-y-auto space-y-4 py-4 relative",children:[t&&d.jsx("div",{className:"flex items-center justify-center py-8",children:d.jsxs("div",{className:"flex flex-col items-center space-y-2",children:[d.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900 dark:border-gray-100"}),d.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:l("agentChatPanel.loadingMessages")})]})}),!t&&e.length===0&&d.jsx("div",{className:"flex items-center justify-center h-full",children:d.jsx("div",{className:"text-center text-gray-500 dark:text-gray-400"})}),!t&&c,r&&d.jsx("div",{className:"px-4",children:d.jsxs("div",{className:"flex flex-col items-center space-y-2",children:[d.jsxs("div",{className:"flex space-x-1",children:[d.jsx("div",{className:"w-2 h-2 bg-gray-400 dark:bg-gray-500 rounded-full animate-bounce"}),d.jsx("div",{className:"w-2 h-2 bg-gray-400 dark:bg-gray-500 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),d.jsx("div",{className:"w-2 h-2 bg-gray-400 dark:bg-gray-500 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]}),d.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:l("agentChatPanel.initializingSession")})]})}),!r&&(n||s)&&d.jsx("div",{className:"px-4",children:d.jsxs("div",{className:"flex flex-col items-center space-y-2",children:[d.jsxs("div",{className:"flex space-x-1",children:[d.jsx("div",{className:"w-2 h-2 bg-gray-400 dark:bg-gray-500 rounded-full animate-bounce"}),d.jsx("div",{className:"w-2 h-2 bg-gray-400 dark:bg-gray-500 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),d.jsx("div",{className:"w-2 h-2 bg-gray-400 dark:bg-gray-500 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]}),s&&d.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:l("agentChat.stopping")})]})}),d.jsx("div",{ref:a})]})},F6=({envVars:e,onChange:t})=>{const{t:r}=de("components"),[n,s]=M.useState(""),[i,a]=M.useState(""),o=()=>{if(!n.trim())return;const u={...e,[n.trim()]:i};t(u),s(""),a("")},l=u=>{const h={...e};delete h[u],t(h)},c=(u,h,f)=>{if(u!==h){const g={...e};delete g[u],g[h]=f,t(g)}else{const g={...e,[u]:f};t(g)}};return d.jsxs("div",{className:"space-y-3",children:[d.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:r("agentChat.envVars.title","Environment Variables")}),d.jsxs("div",{className:"space-y-2",children:[Object.entries(e).length===0&&d.jsx("div",{className:"text-sm text-gray-400 italic px-2",children:r("agentChat.envVars.noVars","No environment variables set")}),Object.entries(e).map(([u,h])=>d.jsxs("div",{className:"flex items-center space-x-2",children:[d.jsx("input",{type:"text",value:u,onChange:f=>c(u,f.target.value,h),className:"flex-1 min-w-0 px-2 py-1 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-400 focus:outline-none focus:ring-1 focus:ring-blue-500",placeholder:r("agentChat.envVars.key","KEY")}),d.jsx("span",{className:"text-gray-400",children:"="}),d.jsx("input",{type:"text",value:h,onChange:f=>c(u,u,f.target.value),className:"flex-1 min-w-0 px-2 py-1 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-400 focus:outline-none focus:ring-1 focus:ring-blue-500",placeholder:r("agentChat.envVars.value","VALUE")}),d.jsx("button",{onClick:()=>l(u),className:"p-1 text-gray-400 hover:text-red-500 hover:bg-gray-100 dark:hover:bg-gray-700 rounded transition-colors",title:r("agentChat.envVars.delete","Remove"),children:d.jsx(sm,{className:"w-4 h-4"})})]},u))]}),d.jsxs("div",{className:"flex items-center space-x-2",children:[d.jsx("input",{type:"text",value:n,onChange:u=>s(u.target.value),onKeyDown:u=>u.key==="Enter"&&o(),className:"flex-1 min-w-0 px-2 py-1 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-400 focus:outline-none focus:ring-1 focus:ring-blue-500",placeholder:r("agentChat.envVars.key","NEW_KEY")}),d.jsx("span",{className:"text-gray-400",children:"="}),d.jsx("input",{type:"text",value:i,onChange:u=>a(u.target.value),onKeyDown:u=>u.key==="Enter"&&o(),className:"flex-1 min-w-0 px-2 py-1 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-400 focus:outline-none focus:ring-1 focus:ring-blue-500",placeholder:r("agentChat.envVars.value","VALUE")}),d.jsx("button",{onClick:o,disabled:!n.trim(),className:"p-1 text-blue-600 hover:bg-blue-50 dark:text-blue-400 dark:hover:bg-blue-900/30 rounded transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:r("agentChat.envVars.add","Add"),children:d.jsx(ul,{className:"w-4 h-4"})})]})]})},ev=({permissionMode:e,onPermissionModeChange:t,selectedClaudeVersion:r,onClaudeVersionChange:n,selectedModel:s,onModelChange:i,availableModels:a,claudeVersionsData:o,isVersionLocked:l,isAiTyping:c,envVars:u,onEnvVarsChange:h,className:f="",engineUICapabilities:g})=>{const{t:p}=de("components"),[m,y]=M.useState(!1),x=M.useRef(null),k=g||{showPermissionSelector:!0,showProviderSelector:!0,showModelSelector:!0,showEnvVars:!0};M.useEffect(()=>{const N=R=>{x.current&&!x.current.contains(R.target)&&y(!1)};return m&&document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[m]);const C=N=>{t(N)},T=N=>{n(N)},S=N=>{i(N)},w=o?.versions&&o.versions.length>1&&k.showProviderSelector,_=a.length>=2&&k.showModelSelector,O=k.showPermissionSelector,P=k.showEnvVars,v=a.find(N=>N.id===s)?.name||s,L={default:p("agentChat.permissionMode.default"),acceptEdits:p("agentChat.permissionMode.acceptEdits"),bypassPermissions:p("agentChat.permissionMode.bypassPermissions")}[e];return d.jsxs("div",{className:`relative ${f}`,ref:x,children:[d.jsxs("button",{onClick:()=>y(!m),className:`flex items-center space-x-2 px-3 py-2 text-sm rounded-lg transition-colors border ${m?"border-blue-500 bg-blue-50 dark:bg-blue-900/30":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-800"}`,disabled:c,title:p("agentChat.settings.title"),children:[d.jsxs("div",{className:"flex items-center space-x-2 text-gray-700 dark:text-gray-300",children:[k.showModelSelector&&d.jsx("span",{className:"font-medium",children:v}),k.showModelSelector&&k.showPermissionSelector&&d.jsx("span",{className:"text-gray-300 dark:text-gray-600",children:"|"}),k.showPermissionSelector&&d.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:L}),!k.showModelSelector&&!k.showPermissionSelector&&d.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:p("agentChat.settings.title","Settings")})]}),d.jsx(At,{className:`w-3 h-3 text-gray-400 transition-transform ${m?"transform rotate-180":""}`})]}),m&&d.jsxs("div",{className:"absolute bottom-full left-0 mb-2 w-[400px] bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl shadow-2xl z-50 flex flex-col max-h-[80vh]",children:[d.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-100 dark:border-gray-700",children:[d.jsxs("h3",{className:"font-semibold text-gray-900 dark:text-white flex items-center gap-2",children:[d.jsx(om,{className:"w-4 h-4"}),p("agentChat.settings.title","Chat Configuration")]}),d.jsx("button",{onClick:()=>y(!1),className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-200 p-1 rounded-md hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:d.jsx(ts,{className:"w-4 h-4"})})]}),d.jsxs("div",{className:"overflow-y-auto p-4 space-y-6",children:[(_||w)&&d.jsxs("div",{className:"space-y-3",children:[d.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:p("agentChat.settings.modelAndVersion","Supplier & Model")}),d.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[w&&d.jsxs("div",{className:"space-y-1.5",children:[d.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400 ml-1",children:p("agentChat.settings.claudeVersion")}),d.jsxs("div",{className:"relative",children:[d.jsxs("select",{value:r||"",onChange:N=>T(N.target.value||void 0),disabled:l,className:`w-full appearance-none px-3 py-2 text-sm rounded-lg border bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-blue-500 ${l?"opacity-50 cursor-not-allowed border-gray-200 dark:border-gray-700":"border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"}`,children:[d.jsx("option",{value:"",children:o?.defaultVersionId?`${p("agentChat.claudeVersion.default")} (${o.versions.find(N=>N.id===o.defaultVersionId)?.name})`:p("agentChat.claudeVersion.default")}),o.versions.filter(N=>o.defaultVersionId&&N.id!==o.defaultVersionId).map(N=>d.jsx("option",{value:N.id,children:N.name},N.id))]}),d.jsx("div",{className:"absolute inset-y-0 right-0 flex items-center px-2 pointer-events-none text-gray-500",children:d.jsx(At,{className:"w-4 h-4"})})]})]}),_&&d.jsxs("div",{className:"space-y-1.5",children:[d.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400 ml-1",children:p("agentChat.settings.model")}),d.jsx("div",{className:"grid grid-cols-1 gap-2 max-h-[200px] overflow-y-auto pr-1",children:a.map(N=>d.jsxs("button",{onClick:()=>S(N.id),className:`flex items-center justify-between px-3 py-2 text-sm rounded-lg border transition-all ${s===N.id?"border-purple-500 bg-purple-50 dark:bg-purple-900/20 text-purple-700 dark:text-purple-300 shadow-sm":"border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600 text-gray-700 dark:text-gray-300"}`,children:[d.jsxs("div",{className:"flex items-center space-x-2",children:[d.jsx(Sv,{className:"w-4 h-4 opacity-70"}),d.jsx("span",{className:"font-medium",children:N.name})]}),N.isVision&&d.jsx("span",{className:"text-xs bg-gray-100 dark:bg-gray-700 px-1.5 py-0.5 rounded text-gray-500",children:"Vision"})]},N.id))})]})]})]}),O&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"h-px bg-gray-100 dark:bg-gray-700"}),d.jsxs("div",{className:"space-y-3",children:[d.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:p("agentChat.settings.permissionMode")}),d.jsx("div",{className:"grid grid-cols-3 gap-2",children:[{value:"default",label:p("agentChat.permissionMode.default"),icon:no},{value:"acceptEdits",label:p("agentChat.permissionMode.acceptEdits"),icon:no},{value:"bypassPermissions",label:p("agentChat.permissionMode.bypassPermissions"),icon:no}].map(N=>d.jsxs("button",{onClick:()=>C(N.value),className:`flex flex-col items-center justify-center p-2 text-xs rounded-lg border transition-all text-center gap-1.5 h-full ${e===N.value?"border-blue-500 bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300 shadow-sm":"border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600 text-gray-600 dark:text-gray-400"}`,children:[d.jsx(N.icon,{className:`w-4 h-4 ${e===N.value?"text-blue-500":"text-gray-400"}`}),d.jsx("span",{className:"leading-tight",children:N.label})]},N.value))})]})]}),P&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"h-px bg-gray-100 dark:bg-gray-700"}),d.jsx("div",{children:d.jsx(F6,{envVars:u,onChange:h})})]})]})]})]})};function O6(e={}){const{maxDuration:t=6e4,language:r,provider:n}=e,[s,i]=M.useState("idle"),[a,o]=M.useState(null),[l,c]=M.useState(null),[u,h]=M.useState(!0),f=M.useRef(null),g=M.useRef([]),p=M.useRef(null),m=M.useRef(null),y=M.useCallback(async()=>{h(!0);try{const S=await mr(`${or}/speech-to-text/status`);if(S.ok){const w=await S.json();c(w)}else c({enabled:!1,availableProviders:[],defaultProvider:null})}catch(S){console.error("Failed to load voice service status:",S),c({enabled:!1,availableProviders:[],defaultProvider:null})}finally{h(!1)}},[]);M.useEffect(()=>{y()},[y]);const x=M.useCallback(()=>{p.current&&(p.current.getTracks().forEach(S=>S.stop()),p.current=null),m.current&&(clearTimeout(m.current),m.current=null),f.current=null,g.current=[]},[]),k=M.useCallback(async()=>{if(!l?.enabled){o("语音服务未启用,请先在设置中配置"),i("error");return}if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia){o("您的浏览器不支持录音功能"),i("error");return}x(),o(null),i("recording");try{const S=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,sampleRate:16e3}});p.current=S;const w=MediaRecorder.isTypeSupported("audio/webm;codecs=opus")?"audio/webm;codecs=opus":MediaRecorder.isTypeSupported("audio/webm")?"audio/webm":"audio/mp4",_=new MediaRecorder(S,{mimeType:w,audioBitsPerSecond:16e3});f.current=_,g.current=[],_.ondataavailable=O=>{O.data.size>0&&g.current.push(O.data)},_.start(100),t>0&&(m.current=setTimeout(()=>{f.current?.state==="recording"&&f.current.stop()},t))}catch(S){console.error("Failed to start recording:",S),x(),S instanceof DOMException?S.name==="NotAllowedError"?o("请允许使用麦克风"):S.name==="NotFoundError"?o("未找到麦克风设备"):o(`录音失败: ${S.message}`):o("开始录音失败"),i("error")}},[x,t,l?.enabled]),C=M.useCallback(async()=>!f.current||s!=="recording"?null:(i("processing"),new Promise(S=>{const w=f.current;w.onstop=async()=>{try{const _=new Blob(g.current,{type:w.mimeType});if(x(),_.size<1e3){o("录音时间太短"),i("error"),S(null);return}const O=await _.arrayBuffer(),P=btoa(new Uint8Array(O).reduce((R,j)=>R+String.fromCharCode(j),"")),v=w.mimeType.includes("webm")?"webm":w.mimeType.includes("mp4")?"m4a":"webm",L=await mr(`${or}/speech-to-text/transcribe`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({audioData:P,audioFormat:v,language:r,provider:n})});if(!L.ok){const R=await L.json();throw new Error(R.message||"转写失败")}const N=await L.json();i("idle"),S(N.text||"")}catch(_){console.error("Failed to transcribe audio:",_),o(_ instanceof Error?_.message:"语音转写失败"),i("error"),S(null)}},w.stop()})),[x,r,n,s]),T=M.useCallback(()=>{f.current&&f.current.stop(),x(),i("idle"),o(null)},[x]);return M.useEffect(()=>()=>{x()},[x]),{status:s,isRecording:s==="recording",isProcessing:s==="processing",error:a,serviceStatus:l,isServiceLoading:u,startRecording:k,stopRecording:C,cancelRecording:T,refreshServiceStatus:y}}const z6=({onTranscribed:e,disabled:t=!1,language:r,className:n="",onOpenSettings:s})=>{const{t:i}=de("components"),[a,o]=M.useState(!1),{isRecording:l,isProcessing:c,error:u,serviceStatus:h,isServiceLoading:f,startRecording:g,stopRecording:p,cancelRecording:m}=O6({language:r}),y=M.useCallback(async()=>{if(l){const S=await p();S&&e(S)}else c||await g()},[l,c,g,p,e]),x=M.useCallback(S=>{S.preventDefault(),l&&m()},[l,m]),C=f?{icon:d.jsx(Tn,{className:"w-4 h-4 animate-spin"}),title:i("voiceInput.loading","加载中..."),className:"text-gray-400 dark:text-gray-500 cursor-wait",disabled:!0}:h?.enabled?c?{icon:d.jsx(Tn,{className:"w-4 h-4 animate-spin"}),title:i("voiceInput.processing","转写中..."),className:"text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/30",disabled:!0}:l?{icon:d.jsx(Kd,{className:"w-4 h-4 animate-pulse"}),title:i("voiceInput.recording","录音中,点击停止"),className:"text-red-600 dark:text-red-400 bg-red-50 dark:bg-red-900/30 hover:bg-red-100 dark:hover:bg-red-900/50",disabled:!1}:u?{icon:d.jsx(rs,{className:"w-4 h-4"}),title:u,className:"text-yellow-600 dark:text-yellow-400 hover:text-yellow-700 dark:hover:text-yellow-300 hover:bg-yellow-50 dark:hover:bg-yellow-900/30",disabled:!1}:{icon:d.jsx(Kd,{className:"w-4 h-4"}),title:i("voiceInput.start","点击开始语音输入"),className:"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700",disabled:!1}:{icon:d.jsx(_v,{className:"w-4 h-4"}),title:i("voiceInput.notConfigured","语音服务未配置,点击配置"),className:"text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700",disabled:!1,showSettings:!0},T=M.useCallback(async()=>{if(C.showSettings&&s){s();return}await y()},[C.showSettings,s,y]);return d.jsxs("div",{className:"relative",children:[d.jsx("button",{onClick:T,onContextMenu:x,disabled:t||C.disabled,className:`p-2 transition-colors rounded-lg ${C.className} ${t?"opacity-50 cursor-not-allowed":""} ${n}`,title:C.title,onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),children:C.icon}),l&&d.jsxs("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-3 py-1.5 bg-red-500 text-white text-xs rounded-lg whitespace-nowrap shadow-lg z-50",children:[d.jsxs("div",{className:"flex items-center space-x-2",children:[d.jsx("span",{className:"w-2 h-2 bg-white rounded-full animate-pulse"}),d.jsx("span",{children:i("voiceInput.recordingHint","点击停止,右键取消")})]}),d.jsx("div",{className:"absolute top-full left-1/2 -translate-x-1/2 border-4 border-transparent border-t-red-500"})]}),u&&a&&d.jsxs("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-3 py-1.5 bg-yellow-500 text-white text-xs rounded-lg whitespace-nowrap shadow-lg z-50 max-w-[200px]",children:[u,d.jsx("div",{className:"absolute top-full left-1/2 -translate-x-1/2 border-4 border-transparent border-t-yellow-500"})]}),C.showSettings&&d.jsx("span",{className:"absolute -top-1 -right-1 w-3 h-3 flex items-center justify-center",children:d.jsx(om,{className:"w-3 h-3 text-gray-400"})})]})},W6=({inputMessage:e,setInputMessage:t,selectedImages:r,isDragOver:n,isAiTyping:s,isSendDisabled:i,showToolSelector:a,setShowToolSelector:o,selectedRegularTools:l,setSelectedRegularTools:c,selectedMcpTools:u,setSelectedMcpTools:h,mcpToolsEnabled:f,setMcpToolsEnabled:g,permissionMode:p,setPermissionMode:m,selectedModel:y,setSelectedModel:x,selectedClaudeVersion:k,setSelectedClaudeVersion:C,availableModels:T,claudeVersionsData:S,isVersionLocked:w,agent:_,textareaRef:O,fileInputRef:P,envVars:v,setEnvVars:L,onSend:N,onStopGeneration:R,onKeyDown:j,onImageSelect:B,onPaste:I,onDragOver:F,onDragLeave:W,onDrop:ee,engineUICapabilities:A,onVoiceTranscribed:G,onOpenVoiceSettings:$})=>{const E=A||{showMcpToolSelector:!0,showImageUpload:!0,showPermissionSelector:!0,showProviderSelector:!0,showModelSelector:!0,showEnvVars:!0},{t:Z}=de("components"),D=M.useCallback(X=>{G&&G(X)},[G]);return d.jsxs("div",{className:`flex-shrink-0 border-t border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 ${n?"bg-blue-50 dark:bg-blue-900/30 border-blue-300 dark:border-blue-700":""}`,onDragOver:F,onDragLeave:W,onDrop:ee,children:[n&&d.jsx("div",{className:"absolute inset-0 bg-blue-100 dark:bg-blue-900/50 bg-opacity-75 flex items-center justify-center z-10 pointer-events-none",children:d.jsxs("div",{className:"text-blue-600 dark:text-blue-300 text-lg font-medium flex items-center space-x-2",children:[d.jsx(Us,{className:"w-6 h-6"}),d.jsx("span",{children:Z("agentChat.dropImageHere")})]})}),d.jsx("div",{className:"p-4 pb-2",children:d.jsx("textarea",{ref:O,value:e,onChange:t,onKeyDown:j,onPaste:I,placeholder:r.length>0?Z("agentChat.addDescription"):Z("agentChat.inputPlaceholder"),rows:1,className:"w-full resize-none border border-gray-300 dark:border-gray-600 rounded-lg px-4 py-3 text-sm bg-white dark:bg-gray-800 text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none focus:ring-2 focus:border-transparent transition-all duration-200 disabled:bg-gray-50 dark:disabled:bg-gray-700 disabled:text-gray-500 dark:disabled:text-gray-400",style:{"--focus-ring-color":"hsl(var(--primary))",minHeight:"44px",maxHeight:"120px"},disabled:s})}),d.jsx("div",{className:"px-4 pb-4 pt-2 border-t border-gray-100 dark:border-gray-700",children:d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{className:"flex items-center space-x-1",children:[d.jsx("input",{ref:P,type:"file",accept:"image/jpeg,image/png,image/gif,image/webp",multiple:!0,onChange:B,className:"hidden"}),E.showMcpToolSelector&&d.jsxs("div",{className:"relative",children:[d.jsx("button",{onClick:()=>o(!a),className:`p-2 transition-colors rounded-lg ${a||l.length>0||f&&u.length>0?"text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/30 hover:bg-blue-100 dark:hover:bg-blue-900/50":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"}`,title:Z("agentChat.toolSelection"),disabled:s,children:d.jsx(lm,{className:"w-4 h-4"})}),(l.length>0||f&&u.length>0)&&d.jsx("span",{className:"absolute -top-1 -right-1 text-white text-xs rounded-full w-5 h-5 flex items-center justify-center bg-blue-600 dark:bg-blue-500",children:l.length+(f?u.filter(X=>X.startsWith("mcp__")&&X.split("__").length===3).length:0)}),d.jsx(Th,{isOpen:a,onClose:()=>o(!1),selectedRegularTools:l,onRegularToolsChange:c,selectedMcpTools:u,onMcpToolsChange:h,mcpToolsEnabled:f,onMcpEnabledChange:g,presetTools:_.allowedTools})]}),E.showImageUpload&&d.jsxs("div",{className:"relative",children:[d.jsx("button",{onClick:()=>P.current?.click(),className:`p-2 transition-colors rounded-lg ${r.length>0?"text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/30 hover:bg-blue-100 dark:hover:bg-blue-900/50":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"}`,title:r.length>0?Z("agentChat.imageSelection")+` (${Z("agentChat.selectedCount",{count:r.length})})`:Z("agentChat.imageSelection"),disabled:s,children:d.jsx(Us,{className:"w-4 h-4"})}),r.length>0&&d.jsx("span",{className:"absolute -top-1 -right-1 text-white text-xs rounded-full w-5 h-5 flex items-center justify-center bg-blue-600 dark:bg-blue-500",children:r.length})]}),d.jsx(z6,{onTranscribed:D,disabled:s,onOpenSettings:$})]}),d.jsxs("div",{className:"flex items-center space-x-2",children:[d.jsx(ev,{permissionMode:p,onPermissionModeChange:m,selectedClaudeVersion:k,onClaudeVersionChange:X=>C(X||""),selectedModel:y,onModelChange:x,availableModels:T,claudeVersionsData:S,isVersionLocked:w,isAiTyping:s,envVars:v,onEnvVarsChange:L,engineUICapabilities:E}),s?d.jsxs("button",{onClick:R,className:"flex items-center space-x-2 px-4 py-2 text-white rounded-lg transition-colors text-sm font-medium shadow-sm",style:{backgroundColor:"rgb(239, 68, 68)"},title:Z("agentChatPanel.stopGeneration"),children:[d.jsx(cm,{className:"w-4 h-4"}),d.jsx("span",{children:Z("agentChatPanel.stop")})]}):d.jsxs("button",{onClick:N,disabled:i,className:"flex items-center space-x-2 px-4 py-2 text-white rounded-lg hover:opacity-90 disabled:bg-gray-300 dark:disabled:bg-gray-700 dark:disabled:text-gray-500 disabled:cursor-not-allowed transition-all duration-200 text-sm font-medium shadow-sm",style:{backgroundColor:i?void 0:"hsl(var(--primary))"},title:s?Z("agentChatPanel.aiTyping"):!e.trim()&&r.length===0?Z("agentChatPanel.noContentToSend"):Z("agentChatPanel.sendMessage"),children:[d.jsx(vh,{className:"w-4 h-4"}),d.jsx("span",{children:Z("agentChatPanel.send")})]})]})]})})]})},H6=({inputMessage:e,setInputMessage:t,selectedImages:r,isDragOver:n,isAiTyping:s,isSendDisabled:i,showToolSelector:a,setShowToolSelector:o,selectedRegularTools:l,setSelectedRegularTools:c,selectedMcpTools:u,setSelectedMcpTools:h,mcpToolsEnabled:f,setMcpToolsEnabled:g,permissionMode:p,setPermissionMode:m,selectedModel:y,setSelectedModel:x,selectedClaudeVersion:k,setSelectedClaudeVersion:C,availableModels:T,claudeVersionsData:S,isVersionLocked:w,envVars:_,onEnvVarsChange:O,agent:P,textareaRef:v,fileInputRef:L,onSend:N,onStopGeneration:R,onKeyDown:j,onImageSelect:B,onPaste:I,onDragOver:F,onDragLeave:W,onDrop:ee})=>{const{t:A}=de("components");return d.jsxs("div",{className:`flex-shrink-0 border-t border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 ${n?"bg-blue-50 dark:bg-blue-900/30 border-blue-300 dark:border-blue-700":""}`,onDragOver:F,onDragLeave:W,onDrop:ee,children:[r.length>0&&d.jsx("div",{className:"p-3 pb-2 border-b border-gray-100 dark:border-gray-700",children:d.jsx("div",{className:"flex flex-wrap gap-2",children:r.map(G=>d.jsxs("div",{className:"relative group",children:[d.jsx("img",{src:G.preview,alt:A("agentChat.imagePreview"),className:"w-12 h-12 object-cover rounded-lg border border-gray-200 dark:border-gray-600 cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>{}}),d.jsx("button",{onClick:()=>{},className:"absolute -top-1 -right-1 w-4 h-4 bg-red-500 text-white rounded-full flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity text-xs hover:bg-red-600",title:A("agentChat.deleteImage"),children:"×"})]},G.id))})}),n&&d.jsx("div",{className:"absolute inset-0 bg-blue-100 dark:bg-blue-900/50 bg-opacity-75 flex items-center justify-center z-10 pointer-events-none",children:d.jsxs("div",{className:"text-blue-600 dark:text-blue-300 text-sm font-medium flex items-center space-x-2",children:[d.jsx(Us,{className:"w-5 h-5"}),d.jsx("span",{children:A("agentChat.dropImageHere")})]})}),d.jsxs("div",{className:"p-3",children:[d.jsxs("div",{className:"flex items-center justify-between mb-3",children:[d.jsxs("div",{className:"flex space-x-2",children:[d.jsxs("div",{className:"relative",children:[d.jsx("button",{onClick:()=>o(!a),className:`p-2 transition-colors rounded-lg ${l.length>0||f&&u.length>0?"text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/30 hover:bg-blue-100 dark:hover:bg-blue-900/50":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"}`,title:l.length>0||f&&u.length>0?A("agentChat.toolSelection")+` (${A("agentChat.selectedCount",{count:l.length+(f?u.length:0)})})`:A("agentChat.toolSelection"),disabled:s,children:d.jsx(lm,{className:"w-4 h-4"})}),(l.length>0||f&&u.length>0)&&d.jsx("span",{className:"absolute -top-1 -right-1 text-white text-xs rounded-full w-5 h-5 flex items-center justify-center bg-blue-600 dark:bg-blue-500",children:l.length+(f?u.filter(G=>G.startsWith("mcp__")&&G.split("__").length===3).length:0)}),d.jsx(Th,{isOpen:a,onClose:()=>o(!1),selectedRegularTools:l,onRegularToolsChange:c,selectedMcpTools:u,onMcpToolsChange:h,mcpToolsEnabled:f,onMcpEnabledChange:g,presetTools:P.allowedTools})]}),d.jsxs("div",{className:"relative",children:[d.jsx("button",{onClick:()=>L.current?.click(),className:`p-2 transition-colors rounded-lg ${r.length>0?"text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/30 hover:bg-blue-100 dark:hover:bg-blue-900/50":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"}`,title:r.length>0?A("agentChat.imageSelection")+` (${r.length})`:A("agentChat.imageSelection"),disabled:s,children:d.jsx(Us,{className:"w-4 h-4"})}),r.length>0&&d.jsx("span",{className:"absolute -top-1 -right-1 text-white text-xs rounded-full w-5 h-5 flex items-center justify-center bg-blue-600 dark:bg-blue-500",children:r.length})]})]}),d.jsx(ev,{permissionMode:p,onPermissionModeChange:m,selectedClaudeVersion:k,onClaudeVersionChange:G=>C(G||""),selectedModel:y,onModelChange:x,availableModels:T,claudeVersionsData:S,isVersionLocked:w,isAiTyping:s,envVars:_,onEnvVarsChange:O})]}),d.jsxs("div",{className:"flex items-end space-x-2",children:[d.jsx("div",{className:"flex-1 relative",children:d.jsx("textarea",{ref:v,value:e,onChange:t,onKeyDown:j,onPaste:I,placeholder:A("agentChat.inputPlaceholder"),className:"w-full px-3 py-2 rounded-lg border border-gray-200 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-500 dark:placeholder-gray-400 focus:ring-2 focus:ring-blue-500 focus:border-transparent resize-none text-sm",rows:e.split(`
426
+ `).length,style:{minHeight:"40px",maxHeight:"120px"},disabled:s})}),s?d.jsx("button",{onClick:R,className:"px-3 py-2 rounded-lg font-medium transition-all duration-200 bg-red-600 dark:bg-red-500 text-white hover:bg-red-700 dark:hover:bg-red-600 shadow-sm",title:A("agentChat.stop"),children:d.jsx(cm,{className:"w-4 h-4"})}):d.jsx("button",{onClick:N,disabled:i,className:`px-3 py-2 rounded-lg font-medium transition-all duration-200 ${i?"bg-gray-300 dark:bg-gray-600 text-gray-500 dark:text-gray-400 cursor-not-allowed":"bg-blue-600 dark:bg-blue-500 text-white hover:bg-blue-700 dark:hover:bg-blue-600 shadow-sm"}`,title:A("agentChat.send"),children:d.jsx(vh,{className:"w-4 h-4"})})]})]}),d.jsx("input",{ref:L,type:"file",accept:"image/*",multiple:!0,onChange:B,style:{display:"none"}})]})},q6=e=>[{id:"init",name:"init",description:e("commandSelector.systemCommands.init.description"),content:"/init",scope:"system",isSystem:!0},{id:"clear",name:"clear",description:e("commandSelector.systemCommands.clear.description"),content:"/clear",scope:"system",isSystem:!0},{id:"compact",name:"compact",description:e("commandSelector.systemCommands.compact.description"),content:"/compact",scope:"system",isSystem:!0},{id:"agents",name:"agents",description:e("commandSelector.systemCommands.agents.description"),content:"/agents",scope:"system",isSystem:!0},{id:"settings",name:"settings",description:e("commandSelector.systemCommands.settings.description"),content:"/settings",scope:"system",isSystem:!0},{id:"help",name:"help",description:e("commandSelector.systemCommands.help.description"),content:"/help",scope:"system",isSystem:!0}],U6=({isOpen:e,onSelect:t,onClose:r,searchTerm:n,position:s,projectId:i,selectedIndex:a=0,onSelectedIndexChange:o})=>{const{t:l}=de("components"),c=M.useRef(null);M.useEffect(()=>{const _=O=>{c.current&&!c.current.contains(O.target)&&r?.()};if(e)return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[e,r]);const{data:u}=Qc({scope:"user",search:n}),{data:h}=Zc({projectId:i||"",search:n}),f=u?.commands||[],g=h?.commands||[],y=[...q6(l).filter(_=>_.name.toLowerCase().includes(n.toLowerCase())||_.description.toLowerCase().includes(n.toLowerCase())),...g,...f];if(M.useEffect(()=>{y.length>0&&a>=y.length&&o?.(0)},[y.length,a,o]),M.useEffect(()=>{if(e&&c.current){const _=c.current.querySelector(`[data-index="${a}"]`);_&&_.scrollIntoView({block:"nearest",behavior:"smooth"})}},[a,e]),!e||y.length===0)return null;const x=65,k=20,C=4,T=s.top-k-C,S=y.length*x,w=Math.min(S,T);return d.jsx("div",{ref:c,className:"fixed z-50 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg min-w-72 max-w-96 overflow-hidden",style:{bottom:window.innerHeight-s.top+C,left:s.left,maxHeight:`${w}px`},children:d.jsx("div",{className:"overflow-y-auto",style:{maxHeight:`${w}px`},children:y.map((_,O)=>{const P="isSystem"in _,v=O===a,L=()=>P?_.name:_.namespace?`${_.namespace}:${_.name}`:_.name;return d.jsx("div",{"data-index":O,className:`px-4 py-3 cursor-pointer flex items-center border-b border-gray-100 dark:border-gray-700 last:border-b-0 ${v?"bg-blue-50 dark:bg-blue-900/30 border-blue-200 dark:border-blue-700":"hover:bg-gray-50 dark:hover:bg-gray-700"}`,onClick:()=>t(_),onMouseEnter:()=>o?.(O),children:d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("div",{className:`text-sm font-medium truncate ${v?"text-blue-900 dark:text-blue-300":"text-gray-900 dark:text-gray-100"}`,children:L()}),_.description&&d.jsx("div",{className:`text-xs truncate ${v?"text-blue-700 dark:text-blue-400":"text-gray-500 dark:text-gray-400"}`,children:_.description})]})},_.id)})})})},Op=({showCommandSelector:e,showFileBrowser:t,commandSearch:r,selectedCommandIndex:n,atSymbolPosition:s,projectPath:i,textareaRef:a,inputMessage:o,onCommandSelect:l,onSetInputMessage:c,onSetShowCommandSelector:u,onSetSelectedCommandIndex:h,onSetShowFileBrowser:f,onSetAtSymbolPosition:g})=>{const{t:p}=de("components"),m=T=>{l(T),c(`/${T.name}`),u(!1),a.current&&a.current.focus()},y=()=>{u(!1)},x=(T,S)=>{if(!a.current||s===null)return;let w=T.replace(/\\/g,"/");if(i){const v=i.replace(/\\/g,"/"),L=v.endsWith("/")?v.slice(0,-1):v;w.startsWith(L)&&(w=w.substring(L.length+1))}const _=o.substring(0,s),O=o.substring(s+1),P=_+"@"+w+" "+O;c(P),f(!1),g(null),setTimeout(()=>{if(a.current){const v=s+1+w.length+1;a.current.setSelectionRange(v,v),a.current.focus()}},0)},k=()=>{f(!1),g(null),setTimeout(()=>{a.current?.focus()},0)},C=()=>{if(!a.current)return{top:0,left:0};const T=a.current.getBoundingClientRect();return{top:T.top,left:T.left}};return d.jsxs(d.Fragment,{children:[d.jsx(U6,{isOpen:e,onSelect:m,onClose:y,searchTerm:r,position:C(),projectId:i,selectedIndex:n,onSelectedIndexChange:h}),t&&d.jsx(Iv,{title:p("agentChat.fileBrowser.title",{projectPath:i?i.split("/").pop():p("agentChat.fileBrowser.currentProject")}),initialPath:i,allowFiles:!0,allowDirectories:!1,restrictToProject:!0,onSelect:x,onClose:k})]})},tv=e=>t=>{if(t.key==="Escape"&&e.showFileBrowser){t.preventDefault(),e.onSetShowFileBrowser(!1),e.onSetAtSymbolPosition(null);return}if(t.key==="Enter"&&!t.shiftKey&&e.showCommandSelector&&e.allCommands.length>0){t.preventDefault();const r=e.allCommands[e.selectedCommandIndex];r&&(e.onCommandSelect(r),e.onSetInputMessage(`/${r.name}`),e.onSetShowCommandSelector(!1),setTimeout(()=>{e.textareaRef.current?.focus()},0));return}if(e.showCommandSelector&&e.allCommands.length>0){if(t.key==="ArrowUp"||t.ctrlKey&&t.key==="p"){t.preventDefault(),e.onSetSelectedCommandIndex(e.selectedCommandIndex>0?e.selectedCommandIndex-1:e.allCommands.length-1);return}if(t.key==="ArrowDown"||t.ctrlKey&&t.key==="n"){t.preventDefault(),e.onSetSelectedCommandIndex(e.selectedCommandIndex<e.allCommands.length-1?e.selectedCommandIndex+1:0);return}if(t.key==="Escape"){t.preventDefault(),e.onSetShowCommandSelector(!1);return}}e.onHandleKeyDown(t)},zp=({isOpen:e,message:t,onConfirm:r,onCancel:n,confirmText:s="确认",cancelText:i="取消"})=>e?d.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[d.jsx("div",{className:"absolute inset-0 bg-black bg-opacity-50",onClick:n}),d.jsxs("div",{className:"relative bg-white rounded-lg shadow-lg max-w-md w-full mx-4 p-6",children:[d.jsx("button",{onClick:n,className:"absolute top-4 right-4 text-gray-400 hover:text-gray-600 transition-colors",children:d.jsx(ts,{size:20})}),d.jsxs("div",{className:"pr-8",children:[d.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-4",children:"命令确认"}),d.jsx("p",{className:"text-gray-700 whitespace-pre-line mb-6",children:t})]}),d.jsxs("div",{className:"flex justify-end space-x-3",children:[d.jsx("button",{onClick:n,className:"px-4 py-2 text-gray-700 bg-gray-100 hover:bg-gray-200 rounded-lg transition-colors",children:i}),d.jsx("button",{onClick:r,className:"px-4 py-2 text-white bg-blue-600 hover:bg-blue-700 rounded-lg transition-colors",children:s})]})]})]}):null,Wp=({isOpen:e,onClose:t,mcpStatus:r})=>{const[n,s]=M.useState(new Set),[i,a]=M.useState(null);if(!e)return null;const o=h=>h?new Date(h).toLocaleString():"未知",l=(r.connectedServers?.length||0)>0||(r.connectionErrors?.length||0)>0,c=h=>{const f=new Set(n);f.has(h)?f.delete(h):f.add(h),s(f)},u=async(h,f)=>{try{await navigator.clipboard.writeText(h),a(f),setTimeout(()=>a(null),2e3)}catch(g){console.error("Failed to copy error text:",g)}};return d.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:d.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-2xl w-full mx-4 max-h-[90vh] overflow-hidden",children:[d.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",children:[d.jsxs("div",{className:"flex items-center space-x-2",children:[r.hasError?d.jsx(Qd,{className:"w-5 h-5 text-red-500"}):d.jsx(sn,{className:"w-5 h-5 text-green-500"}),d.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"MCP 工具状态"})]}),d.jsx("button",{onClick:t,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",children:d.jsx(ts,{className:"w-5 h-5"})})]}),d.jsxs("div",{className:"p-4 space-y-4 max-h-[calc(90vh-120px)] overflow-y-auto",children:[d.jsx("div",{className:`p-3 rounded-lg ${r.hasError?"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800":"bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800"}`,children:d.jsxs("div",{className:"flex items-center space-x-2",children:[r.hasError?d.jsx(Tv,{className:"w-4 h-4 text-red-500"}):d.jsx(Zd,{className:"w-4 h-4 text-green-500"}),d.jsx("span",{className:`font-medium ${r.hasError?"text-red-700 dark:text-red-300":"text-green-700 dark:text-green-300"}`,children:r.hasError?"MCP 工具存在问题":"MCP 工具运行正常"})]})}),r.lastUpdated&&d.jsxs("div",{className:"flex items-center space-x-2 text-sm text-gray-500 dark:text-gray-400",children:[d.jsx(Ar,{className:"w-4 h-4"}),d.jsxs("span",{children:["最后更新: ",o(r.lastUpdated)]})]}),r.connectedServers&&r.connectedServers.length>0&&d.jsxs("div",{children:[d.jsxs("h4",{className:"font-medium text-gray-900 dark:text-white mb-2",children:["✅ 已连接的服务器 (",r.connectedServers.length,")"]}),d.jsx("div",{className:"space-y-2",children:r.connectedServers.map((h,f)=>d.jsxs("div",{className:"flex items-center space-x-2 p-2 bg-green-50 dark:bg-green-900/20 rounded border border-green-200 dark:border-green-800",children:[d.jsx(sn,{className:"w-4 h-4 text-green-500 flex-shrink-0"}),d.jsx("span",{className:"text-sm text-green-700 dark:text-green-300 font-medium",children:h.name}),d.jsxs("span",{className:"text-xs text-green-600 dark:text-green-400",children:["(",h.status,")"]})]},f))})]}),r.connectionErrors&&r.connectionErrors.length>0&&d.jsxs("div",{children:[d.jsxs("h4",{className:"font-medium text-gray-900 dark:text-white mb-2",children:["❌ 连接失败的服务器 (",r.connectionErrors.length,")"]}),d.jsx("div",{className:"space-y-2",children:r.connectionErrors.map((h,f)=>{const g=n.has(f),p=h.error&&h.error.length>50,m=i===f;return d.jsxs("div",{className:"p-2 bg-red-50 dark:bg-red-900/20 rounded border border-red-200 dark:border-red-800",children:[d.jsxs("div",{className:"flex items-center space-x-2 mb-1",children:[d.jsx(Qd,{className:"w-4 h-4 text-red-500 flex-shrink-0"}),d.jsx("span",{className:"text-sm text-red-700 dark:text-red-300 font-medium",children:h.name}),d.jsxs("span",{className:"text-xs text-red-600 dark:text-red-400",children:["(",h.status,")"]}),p&&d.jsx("button",{onClick:()=>c(f),className:"ml-auto p-1 hover:bg-red-100 dark:hover:bg-red-800/30 rounded",title:g?"收起详细错误":"展开详细错误",children:g?d.jsx(At,{className:"w-3 h-3 text-red-500"}):d.jsx(qt,{className:"w-3 h-3 text-red-500"})})]}),h.error&&d.jsx("div",{className:"ml-6",children:p?d.jsxs("div",{children:[d.jsx("p",{className:"text-xs text-red-600 dark:text-red-400 mb-1",children:g?h.error:`${h.error.substring(0,50)}...`}),g&&d.jsx("div",{className:"flex items-center justify-between mt-2",children:d.jsxs("button",{onClick:()=>u(h.error,f),className:"flex items-center space-x-1 px-2 py-1 text-xs bg-red-100 dark:bg-red-800/30 hover:bg-red-200 dark:hover:bg-red-800/50 rounded transition-colors",title:"复制错误信息",children:[d.jsx(Xc,{className:"w-3 h-3"}),d.jsx("span",{children:m?"已复制":"复制错误"})]})})]}):d.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:h.error})})]},f)})})]}),r.lastError&&d.jsxs("div",{children:[d.jsxs("div",{className:"flex items-center justify-between mb-2",children:[d.jsx("h4",{className:"font-medium text-gray-900 dark:text-white",children:"🚨 最近的错误"}),d.jsxs("button",{onClick:()=>u(`${r.lastError}${r.lastErrorDetails?`
427
+ 详情: `+r.lastErrorDetails:""}`,-1),className:"flex items-center space-x-1 px-2 py-1 text-xs bg-red-100 dark:bg-red-800/30 hover:bg-red-200 dark:hover:bg-red-800/50 rounded transition-colors",title:"复制错误信息",children:[d.jsx(Xc,{className:"w-3 h-3"}),d.jsx("span",{children:i===-1?"已复制":"复制"})]})]}),d.jsxs("div",{className:"p-3 bg-red-50 dark:bg-red-900/20 rounded border border-red-200 dark:border-red-800",children:[d.jsx("p",{className:"text-sm text-red-700 dark:text-red-300 mb-1 font-mono",children:r.lastError}),r.lastErrorDetails&&d.jsx("div",{className:"mt-2 pt-2 border-t border-red-200 dark:border-red-700",children:d.jsxs("p",{className:"text-xs text-red-600 dark:text-red-400 font-mono whitespace-pre-wrap",children:[d.jsx("span",{className:"font-semibold",children:"详情:"}),d.jsx("br",{}),r.lastErrorDetails]})})]})]}),!l&&d.jsxs("div",{className:"text-center py-8",children:[d.jsx(Zd,{className:"w-12 h-12 text-gray-400 mx-auto mb-3"}),d.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"暂无 MCP 服务器信息"}),d.jsx("p",{className:"text-sm text-gray-400 dark:text-gray-500 mt-1",children:"当使用 MCP 工具时,状态信息将显示在这里"})]})]}),d.jsx("div",{className:"p-4 border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-750",children:d.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"MCP (Model Context Protocol) 工具允许 AI 与外部系统交互。 如果遇到连接问题,请检查 MCP 服务器配置。"})})]})})},rv=e=>{const{t}=de("components"),{inputMessage:r,selectedImages:n,isAiTyping:s,isMobile:i,showToolSelector:a,selectedRegularTools:o,selectedMcpTools:l,mcpToolsEnabled:c,showCommandSelector:u,showFileBrowser:h,commandSearch:f,selectedCommand:g,selectedCommandIndex:p,atSymbolPosition:m,commandWarning:y,permissionMode:x,selectedModel:k,selectedClaudeVersion:C,showMobileSettings:T,isVersionLocked:S,isDragOver:w,previewImage:_,showConfirmDialog:O,confirmMessage:P,showMcpStatusModal:v,availableModels:L,claudeVersionsData:N,agent:R,projectPath:j,mcpStatus:B,textareaRef:I,fileInputRef:F,onSend:W,handleKeyDown:ee,handleImageSelect:A,handleImageRemove:G,handleImagePreview:$,handlePaste:E,handleDragOver:Z,handleDragLeave:D,handleDrop:X,handleStopGeneration:V,onSetInputMessage:H,onSetShowToolSelector:Y,onSetSelectedRegularTools:Q,onSetSelectedMcpTools:se,onSetMcpToolsEnabled:_e,onSetPermissionMode:Te,onSetSelectedModel:Me,onSetSelectedClaudeVersion:Ae,onSetShowMobileSettings:ut,onSetPreviewImage:Xe,onSetShowMcpStatusModal:ht,onCommandSelect:Mt,onSetShowCommandSelector:tt,onSetSelectedCommandIndex:ot,onSetShowFileBrowser:Gt,onSetAtSymbolPosition:mt,onSetCommandWarning:Yt,onSetCommandSearch:kt,handleConfirmDialog:U,handleCancelDialog:J,isSendDisabled:le,envVars:ae,onSetEnvVars:Ee,engineUICapabilities:xe,onVoiceTranscribed:rt,onOpenVoiceSettings:Ke}=e,xt=xe||{showMcpToolSelector:!0,showImageUpload:!0,showPermissionSelector:!0,showProviderSelector:!0,showModelSelector:!0,showEnvVars:!0},nt=M.useCallback(Se=>{const Ve=Se.target.value;if(H(Ve),y&&Yt(null),Ve.length>0&&Ve[Ve.length-1]==="@"){const Le=Ve.substring(0,Ve.length-1);if(Le.length===0||/\s$/.test(Le)){mt(Ve.length-1),Gt(!0),I.current?.blur();return}}if(Hi(Ve)){const Le=Wv(Ve);Le!==f&&(kt(Le),ot(0)),u||tt(!0)}else u&&(tt(!1),ot(0))},[y,f,u,H,mt,Gt,tt,Yt,ot,kt,I]);return i?d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex-shrink-0 bg-white dark:bg-gray-800 border-t border-gray-200 dark:border-gray-700 p-3 space-y-3",children:[y&&d.jsxs("div",{className:"bg-red-50 dark:bg-red-900/30 border border-red-200 dark:border-red-800 rounded-lg p-2 flex items-start space-x-2",children:[d.jsx("div",{className:"flex-shrink-0",children:d.jsx("svg",{className:"w-4 h-4 text-red-600 dark:text-red-400 mt-0.5",fill:"currentColor",viewBox:"0 0 20 20",children:d.jsx("path",{fillRule:"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})})}),d.jsx("div",{className:"flex-1",children:d.jsx("p",{className:"text-xs text-red-800 dark:text-red-300",children:y})})]}),d.jsx(H6,{inputMessage:r,setInputMessage:nt,selectedImages:n,isDragOver:w,isAiTyping:s,isSendDisabled:le(),showToolSelector:a,setShowToolSelector:Y,selectedRegularTools:o,setSelectedRegularTools:Q,selectedMcpTools:l,setSelectedMcpTools:se,mcpToolsEnabled:c,setMcpToolsEnabled:_e,permissionMode:x,setPermissionMode:Te,selectedModel:k,setSelectedModel:Me,selectedClaudeVersion:C,setSelectedClaudeVersion:Ae,availableModels:L,claudeVersionsData:N,isVersionLocked:S,agent:R,textareaRef:I,fileInputRef:F,onSend:W,onStopGeneration:V,onKeyDown:ee,onImageSelect:A,onPaste:E,onDragOver:Z,onDragLeave:D,onDrop:X,envVars:ae,onEnvVarsChange:Ee}),d.jsx(Th,{isOpen:a,onClose:()=>Y(!1),selectedRegularTools:o,onRegularToolsChange:Q,selectedMcpTools:l,onMcpToolsChange:se,mcpToolsEnabled:c,onMcpEnabledChange:_e,presetTools:R.allowedTools})]}),T&&d.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:d.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 m-4 max-w-sm w-full",children:[d.jsxs("div",{className:"flex justify-between items-center mb-4",children:[d.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:t("agentChat.settings")}),d.jsx("button",{onClick:()=>ut(!1),className:"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200",children:d.jsx(ts,{className:"w-6 h-6"})})]}),d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{children:[d.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:t("agentChat.permissionMode")}),d.jsxs("select",{value:x,onChange:Se=>Te(Se.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[d.jsx("option",{value:"default",children:t("agentChat.default")}),d.jsx("option",{value:"acceptEdits",children:t("agentChat.acceptEdits")}),d.jsx("option",{value:"bypassPermissions",children:t("agentChat.bypassPermissions")})]})]}),d.jsxs("div",{children:[d.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:t("agentChat.model")}),d.jsx("select",{value:k,onChange:Se=>Me(Se.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:L.map(Se=>d.jsx("option",{value:Se.id,children:Se.name},Se.id))})]}),!S&&d.jsxs("div",{children:[d.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:t("agentChat.version")}),d.jsx("select",{value:C,onChange:Se=>Ae(Se.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:N?.availableVersions?.map(Se=>d.jsx("option",{value:Se.id,children:Se.name},Se.id))})]})]})]})}),d.jsx(Op,{showCommandSelector:u,showFileBrowser:h,commandSearch:f,selectedCommand:g,selectedCommandIndex:p,atSymbolPosition:m,projectPath:j,textareaRef:I,inputMessage:r,onCommandSelect:Mt,onSetInputMessage:H,onSetShowCommandSelector:tt,onSetSelectedCommandIndex:ot,onSetShowFileBrowser:Gt,onSetAtSymbolPosition:mt}),d.jsx(zp,{isOpen:O,message:P,onConfirm:U,onCancel:J}),d.jsx(ll,{images:_?[_]:[],onClose:()=>Xe(null)}),d.jsx(Wp,{isOpen:v,onClose:()=>ht(!1),mcpStatus:B})]}):d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:`flex-shrink-0 border-t border-gray-200 dark:border-gray-700 ${w?"bg-blue-50 dark:bg-blue-900/30 border-blue-300 dark:border-blue-700":""}`,onDragOver:Z,onDragLeave:D,onDrop:X,children:[n.length>0&&d.jsx("div",{className:"p-4 pb-2 border-b border-gray-100 dark:border-gray-700",children:d.jsx("div",{className:"flex flex-wrap gap-2",children:n.map(Se=>d.jsxs("div",{className:"relative group",children:[d.jsx("img",{src:Se.preview,alt:t("agentChat.imagePreview"),className:"w-16 h-16 object-cover rounded-lg border border-gray-200 dark:border-gray-600 cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>$(Se.preview)}),d.jsx("button",{onClick:()=>G(Se.id),className:"absolute -top-1 -right-1 w-5 h-5 bg-red-500 text-white rounded-full flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity text-xs hover:bg-red-600",title:t("agentChat.deleteImage"),children:d.jsx(ts,{className:"w-3 h-3"})})]},Se.id))})}),w&&d.jsx("div",{className:"absolute inset-0 bg-blue-100 dark:bg-blue-900/50 bg-opacity-75 flex items-center justify-center z-10 pointer-events-none",children:d.jsxs("div",{className:"text-blue-600 dark:text-blue-300 text-lg font-medium flex items-center space-x-2",children:[d.jsx(Us,{className:"w-6 h-6"}),d.jsx("span",{children:t("agentChat.dropImageHere")})]})}),y&&d.jsx("div",{className:"px-4 pt-3 pb-2",children:d.jsxs("div",{className:"bg-red-50 dark:bg-red-900/30 border border-red-200 dark:border-red-800 rounded-lg p-3 flex items-start space-x-2",children:[d.jsx("div",{className:"flex-shrink-0",children:d.jsx("svg",{className:"w-5 h-5 text-red-600 dark:text-red-400 mt-0.5",fill:"currentColor",viewBox:"0 0 20 20",children:d.jsx("path",{fillRule:"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})})}),d.jsx("div",{className:"flex-1",children:d.jsx("p",{className:"text-sm text-red-800 dark:text-red-300",children:y})})]})}),d.jsx(W6,{inputMessage:r,setInputMessage:nt,selectedImages:n,isDragOver:w,isAiTyping:s,isSendDisabled:le(),showToolSelector:a,setShowToolSelector:Y,selectedRegularTools:o,setSelectedRegularTools:Q,selectedMcpTools:l,setSelectedMcpTools:se,mcpToolsEnabled:c,setMcpToolsEnabled:_e,permissionMode:x,setPermissionMode:Te,selectedModel:k,setSelectedModel:Me,selectedClaudeVersion:C,setSelectedClaudeVersion:Ae,availableModels:L,claudeVersionsData:N,isVersionLocked:S,agent:R,textareaRef:I,fileInputRef:F,onSend:W,onStopGeneration:V,onKeyDown:ee,onImageSelect:A,onPaste:E,onDragOver:Z,onDragLeave:D,onDrop:X,envVars:ae,setEnvVars:Ee,engineUICapabilities:xt,onVoiceTranscribed:rt,onOpenVoiceSettings:Ke})]}),d.jsx(Op,{showCommandSelector:u,showFileBrowser:h,commandSearch:f,selectedCommand:g,selectedCommandIndex:p,atSymbolPosition:m,projectPath:j,textareaRef:I,inputMessage:r,onCommandSelect:Mt,onSetInputMessage:H,onSetShowCommandSelector:tt,onSetSelectedCommandIndex:ot,onSetShowFileBrowser:Gt,onSetAtSymbolPosition:mt}),d.jsx(zp,{isOpen:O,message:P,onConfirm:U,onCancel:J}),d.jsx(ll,{images:_?[_]:[],onClose:()=>Xe(null)}),d.jsx(Wp,{isOpen:v,onClose:()=>ht(!1),mcpStatus:B})]})},V6={"cursor-cli":"cursor","claude-sdk":"claude"},nv=({disabled:e=!1})=>{const{engineType:t}=Sh(),{selectedEngine:r,setSelectedEngine:n,setEngineUICapabilities:s,setEngineModels:i}=Fe();M.useEffect(()=>{if(t){const o=V6[t]||"claude";r!==o&&(console.log(`[EngineSync] Syncing engine from ${r} to ${o}`),n(o),Pv(o))}},[t,r,n]);const a=M.useCallback(async o=>{try{const l=await Bv(o);l?(l.capabilities?.ui?s(l.capabilities.ui):s(Wi(o)),l.models&&l.models.length>0&&(i(l.models),console.log(`[EngineSync] Loaded ${l.models.length} models for ${o}`))):s(Wi(o))}catch(l){console.warn("[EngineSync] Failed to load engine info:",l),s(Wi(o))}},[s,i]);return M.useEffect(()=>{a(r)},[r,a]),null},G6=({agent:e,projectPath:t,onSessionChange:r,initialMessage:n})=>{const{t:s}=de("components"),{isCompactMode:i}=gm(),{isMobile:a}=_h(),o=M.useRef(null),l=M.useRef(null),c=M.useRef(null),u=M.useRef(null),h=M.useRef(null),[f,g]=M.useState(""),[p,m]=M.useState(!1),[y,x]=M.useState(void 0),[k,C]=M.useState(void 0),{messages:T,isAiTyping:S,currentSessionId:w,mcpStatus:_,pendingUserQuestion:O,selectedEngine:P,addMessage:v,interruptAllExecutingTools:L,setAiTyping:N,loadSessionMessages:R,setPendingUserQuestion:j}=Fe(),B=M.useRef(!1);M.useEffect(()=>{n&&!p&&(g(n),m(!0),B.current=!0)},[n,p]);const I=Cm(),{showSessions:F,showConfirmDialog:W,showMobileSettings:ee,showMcpStatusModal:A,confirmMessage:G,searchTerm:$,isStopping:E,isInitializingSession:Z,setShowSessions:D,setShowConfirmDialog:X,setShowMobileSettings:V,setShowMcpStatusModal:H,setConfirmMessage:Y,setConfirmAction:Q,setSearchTerm:se,setIsStopping:_e,setIsInitializingSession:Te,handleConfirmDialog:Me,handleCancelDialog:Ae}=I,ut=vm({agentId:e.id,currentSessionId:w,onSessionChange:r,textareaRef:c}),{isLoadingMessages:Xe,isNewSession:ht,hasSuccessfulResponse:Mt,setIsLoadingMessages:tt,setIsNewSession:ot,setHasSuccessfulResponse:Gt,setCurrentSessionId:mt,handleSwitchSession:Yt,handleNewSession:kt,handleRefreshMessages:U}=ut,{selectedImages:J,previewImage:le,isDragOver:ae,handleImageSelect:Ee,handleImageRemove:xe,handleImagePreview:rt,handlePaste:Ke,handleDragOver:xt,handleDragLeave:nt,handleDrop:Se,clearImages:Ve,setPreviewImage:Le}=mm({textareaRef:c,inputMessage:f,setInputMessage:g}),Ge=xm({messagesContainerRef:o,messagesEndRef:l,messages:T,isAiTyping:S}),wt=ym({projectPath:t,textareaRef:c}),hr=bm({agent:e}),Rn=km({initialModel:k||"sonnet",initialVersion:y}),{commandSearch:$r,selectedCommand:Pn,selectedCommandIndex:xs,commandWarning:ct,showCommandSelector:wr,showFileBrowser:ys,atSymbolPosition:fn,allCommands:dr,SYSTEM_COMMANDS:gn,userCommands:bs,projectCommands:ks,userCommandsError:Tt,projectCommandsError:Xt,setSelectedCommand:ws,setSelectedCommandIndex:pn,setCommandWarning:Dr,setShowCommandSelector:mn,setShowFileBrowser:Kt,setAtSymbolPosition:Fn,setCommandSearch:vs,handleCommandSelect:xn,isCommandDefined:yn,getAllAvailableCommands:bn}=wt,{selectedModel:ce,selectedClaudeVersion:z,isVersionLocked:te,claudeVersionsData:oe,availableModels:Ye,setSelectedModel:it,setSelectedClaudeVersion:Qe,setIsVersionLocked:dt}=Rn;M.useEffect(()=>{t&&(async()=>{try{const Je=await mr(`${or}/projects/${encodeURIComponent(t)}`);if(Je.ok){const ft=await Je.json();console.log("🔧 Project settings loaded:",ft.project),ft.project.defaultProviderId&&(console.log("🔧 Setting provider to:",ft.project.defaultProviderId),x(ft.project.defaultProviderId),Qe(ft.project.defaultProviderId)),ft.project.defaultModel&&(console.log("🔧 Setting model to:",ft.project.defaultModel),C(ft.project.defaultModel),it(ft.project.defaultModel))}}catch(Je){console.error("Failed to fetch project settings:",Je)}})()},[t,Qe,it]);const{showToolSelector:Qt,selectedRegularTools:fr,selectedMcpTools:Kr,mcpToolsEnabled:lt,permissionMode:On,showPermissionDropdown:Cs,showModelDropdown:Vl,showVersionDropdown:Gl,setShowToolSelector:Yl,setSelectedRegularTools:Xl,setSelectedMcpTools:Kl,setMcpToolsEnabled:Ql,setPermissionMode:Zl,setShowPermissionDropdown:Aa,setShowModelDropdown:Ma,setShowVersionDropdown:ui,envVars:ja,setEnvVars:Jl}=hr,{isUserScrolling:kn,newMessagesCount:wn,scrollToBottom:Ia,setNewMessagesCount:ec,setIsUserScrolling:tc}=Ge,[Qr,zn]=M.useState("默认服务");M.useEffect(()=>{const ye=Up(),Je=Vp(ye);Je&&zn(Je.name)},[]);const Wn=Gp(),{data:La,refetch:$a}=Yp(e.id,$,t,P),{data:vr}=Xp(e.id,w,t,P),{data:Da}=Kp();M.useEffect(()=>{F&&(console.log("📋 [Sessions] Dropdown opened, refreshing sessions list..."),$a())},[F,$a]),fm({agentId:e.id,sessionId:w,projectPath:t,enabled:!!w,isNewSession:ht,hasSuccessfulResponse:Mt}),M.useEffect(()=>Wr.startSmartMonitoring(),[]),M.useEffect(()=>{if(w&&e.id)return console.log(`🎯 Setting up wakeup listener for session: ${w}`),Wr.setupWakeupListener(e.id,w)},[w,e.id]);const hi=Tt||Xt;M.useEffect(()=>{pn(ye=>dr.length>0&&ye>=dr.length?0:ye)},[dr.length]);const rc=ye=>{Yt(ye),D(!1)},nc=()=>{kt(),D(!1),se("")},Ba=async()=>{if(!(!h.current||!w))try{_e(!0),console.log("🛑 Stopping generation for session:",w);try{await Wn.mutateAsync(w),console.log("✅ Successfully interrupted session via API")}catch(ye){console.error("❌ Failed to interrupt session:",ye);const Je=ye instanceof Error?ye.message:"Unknown error";v({content:`${s("agentChat.stopFailed")}
428
+
429
+ ${Je}`,role:"assistant"}),_e(!1);return}L(),h.current.abort(),h.current=null,N(!1),_e(!1),Te(!1),v({content:s("agentChat.generationStopped"),role:"assistant"})}catch(ye){console.error("Error stopping generation:",ye),_e(!1),Te(!1)}},di=M.useCallback(ye=>{ye&&(g(Je=>Je.trim()?Je+" "+ye:ye),c.current?.focus())},[]),fi=M.useCallback(()=>{window.open("/settings/voice","_blank")},[]),{isSendDisabled:gi,handleSendMessage:Ss}=wm({agent:e,projectPath:t,inputMessage:f,selectedImages:J,isAiTyping:S,currentSessionId:w,hasCommandsLoadError:!!hi,userCommandsError:Tt||void 0,projectCommandsError:Xt||void 0,SYSTEM_COMMANDS:gn,userCommands:bs,projectCommands:ks,selectedCommand:Pn,selectedRegularTools:fr,selectedMcpTools:Kr,mcpToolsEnabled:lt,permissionMode:On,selectedModel:ce,selectedClaudeVersion:z,abortControllerRef:h,onSessionChange:r,setInputMessage:g,clearImages:Ve,setSelectedCommand:ws,setShowCommandSelector:mn,setCommandWarning:Dr,setIsInitializingSession:Te,setCurrentSessionId:mt,setIsNewSession:ot,setAiTyping:N,setHasSuccessfulResponse:Gt,setConfirmMessage:Y,setConfirmAction:Q,setShowConfirmDialog:X,handleNewSession:kt,isCommandDefined:yn,getAllAvailableCommands:bn,envVars:ja});M.useEffect(()=>{if(!B.current||!f)return;const ye=()=>!gi()&&!S?(B.current=!1,Ss(),!0):!1;if(ye())return;const Je=setTimeout(()=>{B.current&&ye()},500);return()=>clearTimeout(Je)},[f,gi,S,Ss]);const Ra=async(ye,Je)=>{console.log("🎤 [AskUserQuestion] Submitting response for tool:",ye);try{const ft=await mr(`${or}/agents/user-response`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({toolUseId:ye,response:Je,sessionId:w,agentId:e.id})});if(!ft.ok){const ac=await ft.json().catch(()=>({}));throw new Error(ac.error||`HTTP ${ft.status}`)}console.log("✅ [AskUserQuestion] Response submitted successfully"),j(null)}catch(ft){console.error("🎤 [AskUserQuestion] Submit failed:",ft)}},sc=tv({showCommandSelector:wr,showFileBrowser:ys,commandSearch:$r,selectedCommand:Pn,selectedCommandIndex:xs,atSymbolPosition:fn,projectPath:t,textareaRef:c,inputMessage:f,allCommands:dr,onCommandSelect:xn,onSetInputMessage:g,onSetShowCommandSelector:mn,onSetSelectedCommandIndex:pn,onSetShowFileBrowser:Kt,onSetAtSymbolPosition:Fn,onHandleKeyDown:ye=>{if(ye.key==="Enter"&&!ye.shiftKey){if(ye.preventDefault(),Hi(f)){const Je=f.slice(1).split(" ")[0].toLowerCase();if(!yn(Je)){Dr(hi?s("agentChat.commandsLoadErrorWarning",{command:Je,commands:gn.map(ft=>ft.content).join(", "),errorMessage:Tt?.message||Xt?.message||"Unknown error"}):s("agentChat.unknownCommandWarning",{command:Je,commands:bn()}));return}}Ss();return}}}),ic=()=>{const ye=c.current;ye&&(ye.style.height="auto",ye.style.height=Math.min(ye.scrollHeight,100)+"px")};return M.useEffect(()=>{ic()},[f]),M.useEffect(()=>{console.log("🔍 Session messages effect triggered:",{sessionMessagesData:vr?.messages?.length||0,currentSessionId:w,hasSessionMessagesData:!!vr,messagesLength:vr?.messages?.length,isLoadingMessages:Xe}),vr?.messages&&w?(console.log("✅ Loading session messages:",vr.messages.length),R(vr.messages),Xe&&setTimeout(()=>{tt(!1)},100)):w&&vr&&vr.messages?.length===0&&(console.log("🗑️ Loading empty session messages"),R([]),Xe&&setTimeout(()=>{tt(!1)},100))},[vr,w,R,Xe,s]),M.useEffect(()=>{const ye=Je=>{Je.target.closest(".dropdown-container")||(Aa(!1),Ma(!1),ui(!1))};return document.addEventListener("mousedown",ye),()=>document.removeEventListener("mousedown",ye)},[]),M.useEffect(()=>{if(!w||!Da?.sessions){dt(!1);return}const ye=Da.sessions.find(Je=>Je.sessionId===w);ye?(console.log(`🔒 Found active session: ${w}, version: ${ye.claudeVersionId}, model: ${ye.modelId}`),ye.claudeVersionId?(z!==ye.claudeVersionId&&(console.log(`🔄 Changing Claude version from ${z} to ${ye.claudeVersionId}`),Qe(ye.claudeVersionId)),ye.modelId&&ce!==ye.modelId&&(console.log(`🔄 Restoring model from ${ce} to ${ye.modelId}`),it(ye.modelId)),dt(!0),console.log(`🔒 Locked to Claude version: ${ye.claudeVersionId}, model: ${ye.modelId}`)):(dt(!1),console.log("🔓 Session has no specific version, unlocked but keeping user selection"))):(dt(!1),console.log(`🔓 Session ${w} not in active sessions, unlocked but keeping user selection`))},[w,Da,z,ce,it]),d.jsxs("div",{className:"flex flex-col h-full bg-white dark:bg-gray-900",children:[d.jsx("div",{className:"flex-shrink-0 h-12 px-4 border-b border-gray-200 dark:border-gray-700 bg-gray-100 dark:bg-gray-800 flex items-center",children:d.jsxs("div",{className:"flex items-center justify-between w-full",children:[d.jsx("div",{className:"flex-1 min-w-0",children:d.jsxs("h1",{className:"text-base font-semibold flex items-center space-x-2 text-gray-900 dark:text-white",children:[d.jsx("span",{className:"text-lg flex-shrink-0",children:e.ui.icon}),d.jsxs("span",{className:"truncate",children:["[",Qr,"]"]}),t&&d.jsx("span",{className:"text-sm opacity-75 font-normal truncate flex-shrink-0",title:t,children:t.split("/").pop()||t}),w&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"text-sm opacity-75",children:"-"}),d.jsx("span",{className:"text-sm opacity-75 truncate",children:La?.sessions?.find(ye=>ye.id===w)?.title||s("agentChat.currentSession")})]})]})}),d.jsxs("div",{className:"flex items-center space-x-2 flex-shrink-0 ml-2",children:[d.jsx(nv,{disabled:S}),d.jsxs("div",{className:"flex space-x-1",children:[d.jsx("button",{onClick:nc,className:"p-1.5 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-md transition-colors text-gray-600 dark:text-gray-300",title:s("agentChat.newSession"),children:d.jsx(ul,{className:"w-4 h-4"})}),d.jsxs("div",{className:"relative",children:[d.jsx("button",{onClick:()=>D(!F),className:"p-1.5 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-md transition-colors text-gray-600 dark:text-gray-300",title:s("agentChat.sessionHistory"),children:d.jsx(Ar,{className:"w-4 h-4"})}),d.jsx(pm,{isOpen:F,onToggle:()=>D(!F),sessions:La?.sessions||[],currentSessionId:w,onSwitchSession:rc,isLoading:!1,searchTerm:$,onSearchChange:se})]}),d.jsx("button",{onClick:U,disabled:!w||Xe,className:"p-1.5 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-md transition-colors text-gray-600 dark:text-gray-300 disabled:opacity-50 disabled:cursor-not-allowed",title:s("agentChat.refreshMessages"),children:d.jsx(wh,{className:`w-4 h-4 ${Xe?"animate-spin":""}`})})]})]})]})}),d.jsxs("div",{className:"flex-1 relative min-h-0",children:[d.jsxs("div",{ref:o,className:"absolute inset-0 px-5 py-5 overflow-y-auto space-y-4",children:[d.jsx("div",{className:"px-4",children:d.jsx("div",{className:"text-sm leading-relaxed break-words overflow-hidden text-gray-600 dark:text-gray-400",children:e.ui.welcomeMessage||e.description})}),Xe?d.jsxs("div",{className:"flex flex-col items-center justify-center py-12 space-y-3",children:[d.jsxs("div",{className:"flex space-x-2",children:[d.jsx("div",{className:"w-3 h-3 bg-gray-400 dark:bg-gray-500 rounded-full animate-bounce"}),d.jsx("div",{className:"w-3 h-3 bg-gray-400 dark:bg-gray-500 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),d.jsx("div",{className:"w-3 h-3 bg-gray-400 dark:bg-gray-500 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]}),d.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:s("agentChat.loadingMessages")})]}):d.jsx(P6,{messages:T,isLoadingMessages:Xe,isInitializingSession:Z,isAiTyping:S,isStopping:E,messagesContainerRef:o,messagesEndRef:l,isUserScrolling:kn,newMessagesCount:wn,onScrollToBottom:Ia,onAskUserQuestionSubmit:Ra}),d.jsx("div",{ref:l})]}),kn&&wn>0&&d.jsxs("button",{onClick:()=>{Ia(),tc(!1),ec(0)},className:"absolute bottom-4 left-1/2 transform -translate-x-1/2 bg-blue-500 hover:bg-blue-600 text-white rounded-full px-4 py-2 shadow-lg flex items-center space-x-2 transition-all duration-200 z-10",children:[d.jsx("span",{className:"text-sm font-medium",children:s("agentChat.scrollToLatest")}),d.jsx(At,{className:"w-4 h-4"})]})]}),d.jsx(rv,{inputMessage:f,selectedImages:J,isAiTyping:S,isStopping:E,isMobile:a,showToolSelector:Qt,selectedRegularTools:fr,selectedMcpTools:Kr,mcpToolsEnabled:lt,showCommandSelector:wr,showFileBrowser:ys,commandSearch:$r,selectedCommand:Pn,selectedCommandIndex:xs,atSymbolPosition:fn,commandWarning:ct||"",permissionMode:On,selectedModel:ce,selectedClaudeVersion:z||"",showPermissionDropdown:Cs,showModelDropdown:Vl,showVersionDropdown:Gl,showMobileSettings:ee,isCompactMode:i,isVersionLocked:te,isDragOver:ae,previewImage:le,showConfirmDialog:W,confirmMessage:G||"",showMcpStatusModal:A,availableModels:Ye,claudeVersionsData:oe,agent:e,projectPath:t,mcpStatus:_,textareaRef:c,fileInputRef:u,onSend:Ss,handleKeyDown:sc,handleImageSelect:Ee,handleImageRemove:xe,handleImagePreview:rt,handlePaste:Ke,handleDragOver:xt,handleDragLeave:nt,handleDrop:Se,handleStopGeneration:Ba,onSetInputMessage:g,onSetShowToolSelector:Yl,onSetSelectedRegularTools:Xl,onSetSelectedMcpTools:Kl,onSetMcpToolsEnabled:Ql,onSetPermissionMode:Zl,onSetSelectedModel:it,onSetSelectedClaudeVersion:Qe,onSetShowPermissionDropdown:Aa,onSetShowModelDropdown:Ma,onSetShowVersionDropdown:ui,onSetShowMobileSettings:V,onSetPreviewImage:Le,onSetShowConfirmDialog:X,onSetShowMcpStatusModal:H,onCommandSelect:xn,onSetShowCommandSelector:mn,onSetSelectedCommandIndex:pn,onSetShowFileBrowser:Kt,onSetAtSymbolPosition:Fn,onSetCommandWarning:Dr,onSetCommandSearch:vs,handleConfirmDialog:Me,handleCancelDialog:Ae,isSendDisabled:()=>gi()||!!O,envVars:ja,onSetEnvVars:Jl,onVoiceTranscribed:di,onOpenVoiceSettings:fi})]})},Y6=({agent:e,projectPath:t,onSessionChange:r,initialMessage:n})=>{const{t:s}=de("components"),{isCompactMode:i}=gm(),{isMobile:a}=_h(),{engineType:o}=Sh(),l=M.useRef(null),c=M.useRef(null),u=M.useRef(null),h=M.useRef(null),f=M.useRef(null),[g,p]=M.useState(""),[m,y]=M.useState(!1),[x,k]=M.useState(void 0),[C,T]=M.useState(void 0),{messages:S,isAiTyping:w,currentSessionId:_,mcpStatus:O,pendingUserQuestion:P,selectedEngine:v,engineUICapabilities:L,engineModels:N,addMessage:R,interruptAllExecutingTools:j,setAiTyping:B,loadSessionMessages:I,setPendingUserQuestion:F}=Fe(),W=M.useRef(!1);M.useEffect(()=>{n&&!m&&(p(n),y(!0),W.current=!0)},[n,m]);const ee=Cm(),{showSessions:A,showConfirmDialog:G,showMobileSettings:$,showMcpStatusModal:E,confirmMessage:Z,searchTerm:D,isStopping:X,isInitializingSession:V,setShowSessions:H,setShowConfirmDialog:Y,setShowMobileSettings:Q,setShowMcpStatusModal:se,setConfirmMessage:_e,setConfirmAction:Te,setSearchTerm:Me,setIsStopping:Ae,setIsInitializingSession:ut,handleConfirmDialog:Xe,handleCancelDialog:ht}=ee,Mt=vm({agentId:e.id,currentSessionId:_,onSessionChange:r,textareaRef:u}),{isLoadingMessages:tt,isNewSession:ot,hasSuccessfulResponse:Gt,setIsLoadingMessages:mt,setIsNewSession:Yt,setHasSuccessfulResponse:kt,setCurrentSessionId:U,handleSwitchSession:J,handleNewSession:le,handleRefreshMessages:ae}=Mt,{selectedImages:Ee,previewImage:xe,isDragOver:rt,handleImageSelect:Ke,handleImageRemove:xt,handleImagePreview:nt,handlePaste:Se,handleDragOver:Ve,handleDragLeave:Le,handleDrop:Ge,clearImages:wt,setPreviewImage:hr}=mm({textareaRef:u,inputMessage:g,setInputMessage:p}),Rn=xm({messagesContainerRef:l,messagesEndRef:c,messages:S,isAiTyping:w}),{scrollToBottom:$r,isUserScrolling:Pn,newMessagesCount:xs,setIsUserScrolling:ct,setNewMessagesCount:wr}=Rn,ys=ym({projectPath:t,textareaRef:u}),{commandSearch:fn,selectedCommand:dr,selectedCommandIndex:gn,commandWarning:bs,showCommandSelector:ks,showFileBrowser:Tt,atSymbolPosition:Xt,allCommands:ws,SYSTEM_COMMANDS:pn,userCommands:Dr,projectCommands:mn,userCommandsError:Kt,projectCommandsError:Fn,setSelectedCommand:vs,setSelectedCommandIndex:xn,setCommandWarning:yn,setShowCommandSelector:bn,setShowFileBrowser:ce,setAtSymbolPosition:z,setCommandSearch:te,handleCommandSelect:oe,isCommandDefined:Ye,getAllAvailableCommands:it}=ys,Qe=bm({agent:e}),{showToolSelector:dt,selectedRegularTools:Qt,selectedMcpTools:fr,mcpToolsEnabled:Kr,permissionMode:lt,showPermissionDropdown:On,showModelDropdown:Cs,showVersionDropdown:Vl,setShowToolSelector:Gl,setSelectedRegularTools:Yl,setSelectedMcpTools:Xl,setMcpToolsEnabled:Kl,setPermissionMode:Ql,setShowPermissionDropdown:Zl,setShowModelDropdown:Aa,setShowVersionDropdown:Ma,envVars:ui,setEnvVars:ja}=Qe,Jl=km({initialModel:C||"sonnet",initialVersion:x,skipModelValidation:v==="cursor"}),{selectedModel:kn,selectedClaudeVersion:wn,isVersionLocked:Ia,claudeVersionsData:ec,availableModels:tc,setSelectedModel:Qr,setSelectedClaudeVersion:zn,setIsVersionLocked:Wn}=Jl;M.useEffect(()=>{if(v==="cursor"&&N.length>0){const De=N[0]?.id||"auto";console.log(`[AGUIChatPanel] Switching to Cursor engine, resetting model to: ${De}`),Qr(De)}},[v,N,Qr]),M.useEffect(()=>{t&&(async()=>{try{const Cr=await mr(`${or}/projects/${encodeURIComponent(t)}`);if(Cr.ok){const Zt=await Cr.json();console.log("🔧 Project settings loaded:",Zt.project),Zt.project.defaultProviderId&&(console.log("🔧 Setting provider to:",Zt.project.defaultProviderId),k(Zt.project.defaultProviderId),zn(Zt.project.defaultProviderId)),Zt.project.defaultModel&&(console.log("🔧 Setting model to:",Zt.project.defaultModel),T(Zt.project.defaultModel),Qr(Zt.project.defaultModel))}}catch(Cr){console.error("Failed to fetch project settings:",Cr)}})()},[t,zn,Qr]);const[La,$a]=M.useState("默认服务");M.useEffect(()=>{const De=Up(),Cr=Vp(De);Cr&&$a(Cr.name)},[]);const vr=Gp(),hi=o?{"cursor-cli":"cursor","claude-sdk":"claude"}[o]:void 0,rc=!!hi&&v===hi,{data:nc,refetch:Ba}=Yp(e.id,D,t,v,rc),{data:di}=Xp(e.id,_,t,v),{data:fi}=Kp();M.useEffect(()=>{A&&Ba()},[A,Ba]),fm({agentId:e.id,sessionId:_,projectPath:t,enabled:!!_,isNewSession:ot,hasSuccessfulResponse:Gt}),M.useEffect(()=>{di?.messages&&_&&(I(di.messages),tt&&setTimeout(()=>mt(!1),100))},[di,_,I,tt]),M.useEffect(()=>{if(!_||!fi?.sessions){Wn(!1);return}const De=fi.sessions.find(Cr=>Cr.sessionId===_);De?(console.log(`🔒 Found active session: ${_}, version: ${De.claudeVersionId}, model: ${De.modelId}`),De.claudeVersionId?(wn!==De.claudeVersionId&&(console.log(`🔄 Changing Claude version from ${wn} to ${De.claudeVersionId}`),zn(De.claudeVersionId)),De.modelId&&kn!==De.modelId&&(console.log(`🔄 Restoring model from ${kn} to ${De.modelId}`),Qr(De.modelId)),Wn(!0),console.log(`🔒 Locked to Claude version: ${De.claudeVersionId}, model: ${De.modelId}`)):(Wn(!1),console.log("🔓 Session has no specific version, unlocked but keeping user selection"))):(Wn(!1),console.log(`🔓 Session ${_} not in active sessions, unlocked but keeping user selection`))},[_,fi,wn,kn,Qr,zn,Wn]);const gi=!!(Kt||Fn),{isSendDisabled:Ss,handleSendMessage:Ra}=wm({agent:e,projectPath:t,inputMessage:g,selectedImages:Ee,isAiTyping:w,currentSessionId:_,hasCommandsLoadError:gi,SYSTEM_COMMANDS:pn,userCommands:Dr,projectCommands:mn,selectedCommand:dr,selectedRegularTools:Qt,selectedMcpTools:fr,mcpToolsEnabled:Kr,permissionMode:lt,selectedModel:kn,selectedClaudeVersion:wn,abortControllerRef:f,onSessionChange:r,setInputMessage:p,clearImages:wt,setSelectedCommand:vs,setShowCommandSelector:bn,setCommandWarning:yn,setIsInitializingSession:ut,setCurrentSessionId:U,setIsNewSession:Yt,setAiTyping:B,setHasSuccessfulResponse:kt,setConfirmMessage:_e,setConfirmAction:Te,setShowConfirmDialog:Y,handleNewSession:le,isCommandDefined:Ye,getAllAvailableCommands:it,envVars:ui}),sc=tv({showCommandSelector:ks,showFileBrowser:Tt,commandSearch:fn,selectedCommand:dr,selectedCommandIndex:gn,atSymbolPosition:Xt,projectPath:t,textareaRef:u,inputMessage:g,allCommands:ws,onCommandSelect:oe,onSetInputMessage:p,onSetShowCommandSelector:bn,onSetSelectedCommandIndex:xn,onSetShowFileBrowser:ce,onSetAtSymbolPosition:z,onHandleKeyDown:De=>{if(De.key==="Enter"&&!De.shiftKey){De.preventDefault(),Ra();return}}}),ic=async()=>{if(!(!f.current||!_))try{Ae(!0),await vr.mutateAsync(_),j(),f.current.abort(),f.current=null,B(!1),Ae(!1),ut(!1),R({content:s("agentChat.generationStopped"),role:"assistant"})}catch(De){console.error("Error stopping generation:",De),Ae(!1),ut(!1)}};M.useEffect(()=>{const De=u.current;De&&(De.style.height="auto",De.style.height=Math.min(De.scrollHeight,150)+"px")},[g]);const ye=De=>{J(De),H(!1)},Je=()=>{le(),H(!1),Me("")},ft=async(De,Cr)=>{try{const Zt=await mr(`${or}/agents/user-response`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({toolUseId:De,response:Cr,sessionId:_,agentId:e.id})});if(!Zt.ok)throw new Error(`HTTP ${Zt.status}`);F(null)}catch(Zt){console.error("Submit failed:",Zt)}},ac=M.useMemo(()=>S.map(De=>d.jsx("div",{className:"px-4",children:d.jsx("div",{className:`text-sm leading-relaxed break-words overflow-hidden ${De.role==="user"?"text-white p-3 rounded-lg bg-gray-800 dark:bg-gray-700":"text-gray-800 dark:text-gray-200"}`,children:d.jsx(J1,{message:De,onAskUserQuestionSubmit:ft})})},De.id)),[S,ft]);return d.jsxs("div",{className:"flex flex-col h-full bg-white dark:bg-gray-900",children:[d.jsx("div",{className:"flex-shrink-0 h-12 px-4 border-b border-gray-200 dark:border-gray-700 bg-gradient-to-r from-blue-50 to-purple-50 dark:from-gray-800 dark:to-gray-800 flex items-center",children:d.jsxs("div",{className:"flex items-center justify-between w-full",children:[d.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:[d.jsx("span",{className:"text-lg",children:e.ui.icon}),d.jsxs("h1",{className:"text-base font-semibold text-gray-900 dark:text-white truncate",children:["[",La,"]"]}),d.jsx("span",{className:"px-2 py-0.5 text-xs font-medium bg-blue-100 text-blue-700 dark:bg-blue-900/50 dark:text-blue-300 rounded-full",children:"AGUI"}),t&&d.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-300 font-normal truncate",title:t,children:t.split("/").pop()||t})]}),d.jsxs("div",{className:"flex items-center space-x-2 flex-shrink-0 ml-2",children:[d.jsx(nv,{disabled:w}),d.jsxs("div",{className:"flex space-x-1",children:[d.jsx("button",{onClick:Je,className:"p-1.5 hover:bg-white/50 dark:hover:bg-gray-700 rounded-md transition-colors text-gray-600 dark:text-gray-300",title:s("agentChat.newSession"),children:d.jsx(ul,{className:"w-4 h-4"})}),d.jsxs("div",{className:"relative",children:[d.jsx("button",{onClick:()=>H(!A),className:"p-1.5 hover:bg-white/50 dark:hover:bg-gray-700 rounded-md transition-colors text-gray-600 dark:text-gray-300",title:s("agentChat.sessionHistory"),children:d.jsx(Ar,{className:"w-4 h-4"})}),d.jsx(pm,{isOpen:A,onToggle:()=>H(!A),sessions:nc?.sessions||[],currentSessionId:_,onSwitchSession:ye,isLoading:!1,searchTerm:D,onSearchChange:Me})]}),d.jsx("button",{onClick:ae,disabled:!_||tt,className:"p-1.5 hover:bg-white/50 dark:hover:bg-gray-700 rounded-md transition-colors text-gray-600 dark:text-gray-300 disabled:opacity-50",title:s("agentChat.refreshMessages"),children:d.jsx(wh,{className:`w-4 h-4 ${tt?"animate-spin":""}`})})]})]})]})}),d.jsxs("div",{className:"flex-1 relative min-h-0",children:[d.jsxs("div",{ref:l,className:"absolute inset-0 px-5 py-5 overflow-y-auto space-y-4",onDragOver:Ve,onDragLeave:Le,onDrop:Ge,children:[d.jsx("div",{className:"px-4",children:d.jsx("div",{className:"text-sm leading-relaxed break-words overflow-hidden text-gray-600 dark:text-gray-400",children:e.ui.welcomeMessage||e.description})}),tt&&d.jsxs("div",{className:"flex flex-col items-center justify-center py-12 space-y-3",children:[d.jsxs("div",{className:"flex space-x-2",children:[d.jsx("div",{className:"w-2 h-2 bg-blue-400 rounded-full animate-bounce"}),d.jsx("div",{className:"w-2 h-2 bg-blue-400 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),d.jsx("div",{className:"w-2 h-2 bg-blue-400 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]}),d.jsx("div",{className:"text-sm text-gray-500",children:s("agentChat.loadingMessages")})]}),!tt&&ac,(V||w||X)&&d.jsx("div",{className:"px-4 py-3",children:d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsxs("div",{className:"flex space-x-1",children:[d.jsx("div",{className:"w-2 h-2 bg-blue-400 rounded-full animate-bounce"}),d.jsx("div",{className:"w-2 h-2 bg-blue-400 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),d.jsx("div",{className:"w-2 h-2 bg-blue-400 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]}),V&&d.jsx("span",{className:"text-xs text-gray-500",children:s("agentChatPanel.initializingSession")}),X&&d.jsx("span",{className:"text-xs text-gray-500",children:s("agentChat.stopping")})]})}),d.jsx("div",{ref:c})]}),Pn&&xs>0&&d.jsxs("button",{onClick:()=>{$r(),ct(!1),wr(0)},className:"absolute bottom-4 left-1/2 transform -translate-x-1/2 bg-blue-500 hover:bg-blue-600 text-white rounded-full px-4 py-2 shadow-lg flex items-center gap-2",children:[d.jsx("span",{className:"text-sm",children:s("agentChat.scrollToLatest")}),d.jsx(At,{className:"w-4 h-4"})]}),rt&&d.jsx("div",{className:"absolute inset-0 bg-blue-500/10 border-2 border-dashed border-blue-500 rounded-lg flex items-center justify-center",children:d.jsx("div",{className:"text-blue-500 font-medium",children:s("agentChat.dropImageHere")})})]}),d.jsx(rv,{inputMessage:g,selectedImages:Ee,isAiTyping:w,isStopping:X,isMobile:a,showToolSelector:dt,selectedRegularTools:Qt,selectedMcpTools:fr,mcpToolsEnabled:Kr,showCommandSelector:ks,showFileBrowser:Tt,commandSearch:fn,selectedCommand:dr,selectedCommandIndex:gn,atSymbolPosition:Xt,commandWarning:bs||"",permissionMode:lt,selectedModel:kn,selectedClaudeVersion:wn||"",showPermissionDropdown:On,showModelDropdown:Cs,showVersionDropdown:Vl,showMobileSettings:$,isCompactMode:i,isVersionLocked:Ia,isDragOver:rt,previewImage:xe,showConfirmDialog:G,confirmMessage:Z||"",showMcpStatusModal:E,availableModels:v==="cursor"&&N.length>0?N:tc,claudeVersionsData:ec,agent:e,projectPath:t,mcpStatus:O,textareaRef:u,fileInputRef:h,onSend:Ra,handleKeyDown:sc,handleImageSelect:Ke,handleImageRemove:xt,handleImagePreview:nt,handlePaste:Se,handleDragOver:Ve,handleDragLeave:Le,handleDrop:Ge,handleStopGeneration:ic,onSetInputMessage:p,onSetShowToolSelector:Gl,onSetSelectedRegularTools:Yl,onSetSelectedMcpTools:Xl,onSetMcpToolsEnabled:Kl,onSetPermissionMode:Ql,onSetSelectedModel:Qr,onSetSelectedClaudeVersion:zn,onSetShowPermissionDropdown:Zl,onSetShowModelDropdown:Aa,onSetShowVersionDropdown:Ma,onSetShowMobileSettings:Q,onSetPreviewImage:hr,onSetShowConfirmDialog:Y,onSetShowMcpStatusModal:se,onCommandSelect:oe,onSetShowCommandSelector:bn,onSetSelectedCommandIndex:xn,onSetShowFileBrowser:ce,onSetAtSymbolPosition:z,onSetCommandWarning:yn,onSetCommandSearch:te,handleConfirmDialog:Xe,handleCancelDialog:ht,isSendDisabled:()=>Ss()||!!P,envVars:ui,onSetEnvVars:ja,engineUICapabilities:L})]})},Hp=({isPanelVisible:e,onToggle:t,position:r,className:n=""})=>{const a=(r==="left"?e?"left":"right":e?"right":"left")==="left"?am:qt,o=()=>{const l="fixed top-1/2 transform -translate-y-1/2 z-20";return r==="left"?`${l} left-2`:`${l} right-2`};return d.jsx("button",{onClick:t,className:`
430
+ ${o()}
431
+ w-8 h-8 rounded-full
432
+ bg-gray-500/10 dark:bg-gray-400/10
433
+ border border-gray-500/20 dark:border-gray-400/20
434
+ text-gray-600 dark:text-gray-300
435
+ hover:bg-gray-500/20 dark:hover:bg-gray-400/20
436
+ hover:scale-110 hover:border-gray-500/40 dark:hover:border-gray-400/40
437
+ hover:text-gray-800 dark:hover:text-white
438
+ transition-all duration-200 ease-in-out
439
+ flex items-center justify-center
440
+ backdrop-blur-sm
441
+ shadow-sm hover:shadow-md
442
+ ${n}
443
+ `,title:r==="left"?e?"隐藏聊天界面":"显示聊天界面":e?"隐藏可视化界面":"显示可视化界面",children:d.jsx(a,{className:"w-4 h-4"})})},X6=({children:e,defaultLeftWidth:t=35,minWidth:r=20,maxWidth:n=80,hideLeftPanel:s=!1,hideRightPanel:i=!1,onToggleLeftPanel:a,onToggleRightPanel:o,mobileLayout:l="stack"})=>{const{isMobile:c,rightPanelOpen:u,setRightPanelOpen:h}=_h(),[f,g]=M.useState(t),[p,m]=M.useState(!1),[y,x]=M.useState("left"),k=M.useRef(null),C=w=>{c||(w.preventDefault(),m(!0))},T=M.useCallback(w=>{if(!p||!k.current||c)return;const _=k.current.getBoundingClientRect(),O=(w.clientX-_.left)/_.width*100,P=Math.min(Math.max(O,r),n);g(P)},[p,r,n,c]),S=M.useCallback(()=>{m(!1)},[]);if(M.useEffect(()=>(p&&!c?(document.addEventListener("mousemove",T),document.addEventListener("mouseup",S),document.body.style.cursor="col-resize",document.body.style.userSelect="none"):(document.removeEventListener("mousemove",T),document.removeEventListener("mouseup",S),document.body.style.cursor="",document.body.style.userSelect=""),()=>{document.removeEventListener("mousemove",T),document.removeEventListener("mouseup",S),document.body.style.cursor="",document.body.style.userSelect=""}),[p,T,S,c]),c){if(l==="tabs"){const w=!i;return d.jsxs("div",{className:"flex flex-col h-full bg-gray-100",children:[w&&d.jsxs("div",{className:"flex-shrink-0 flex border-b border-gray-200 bg-white",children:[d.jsx("button",{onClick:()=>{x("left"),h(!1)},className:`flex-1 px-4 py-3 text-sm font-medium transition-colors ${y==="left"&&!u?"text-blue-600 border-b-2 border-blue-600 bg-blue-50":"text-gray-500 hover:text-gray-700 hover:bg-gray-50"}`,children:"Chat"}),d.jsx("button",{onClick:()=>{x("right"),h(!0)},className:`flex-1 px-4 py-3 text-sm font-medium transition-colors ${y==="right"||u?"text-blue-600 border-b-2 border-blue-600 bg-blue-50":"text-gray-500 hover:text-gray-700 hover:bg-gray-50"}`,children:"Preview"})]}),d.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:!i&&w&&(y==="right"||u)?d.jsx("div",{className:"h-full",children:e[1]}):d.jsx("div",{className:"h-full",children:e[0]})})]})}return d.jsxs("div",{className:"flex flex-col h-full bg-gray-100",children:[d.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:e[0]}),!i&&u&&d.jsxs("div",{className:"fixed inset-0 z-50 lg:hidden",children:[d.jsx("div",{className:"absolute inset-0 bg-black bg-opacity-50",onClick:()=>h(!1)}),d.jsxs("div",{className:"absolute inset-4 bg-white rounded-lg shadow-xl overflow-hidden",children:[d.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200",children:[d.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:"Preview"}),d.jsx("button",{onClick:()=>h(!1),className:"p-2 text-gray-500 hover:text-gray-700 rounded-md hover:bg-gray-100",children:d.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),d.jsx("div",{className:"h-[calc(100%-73px)]",children:e[1]})]})]}),!i&&!u&&o&&d.jsx("button",{onClick:()=>h(!0),className:"fixed bottom-6 right-6 z-40 bg-blue-600 text-white p-4 rounded-full shadow-lg hover:bg-blue-700 transition-colors lg:hidden",title:"Open Preview",children:d.jsxs("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]})})]})}return d.jsxs("div",{ref:k,className:"flex h-full bg-gray-100 relative",children:[d.jsx("div",{className:`
444
+ flex flex-col relative
445
+ ${s?"hidden":"block"}
446
+ `,style:{width:i?"100%":`${f}%`},children:e[0]}),!s&&!i&&d.jsx("div",{className:`
447
+ resize-separator relative z-10
448
+ ${p?"w-2 bg-blue-500":"w-1.5 bg-gray-300 hover:bg-blue-400"}
449
+ cursor-col-resize transition-all duration-200
450
+ flex items-center justify-center
451
+ group
452
+ `,onMouseDown:C,children:d.jsx("div",{className:"absolute inset-y-0 flex items-center justify-center",children:d.jsx("div",{className:"flex flex-col items-center justify-center gap-1 py-2",children:d.jsxs("div",{className:"flex gap-0.5 opacity-40 group-hover:opacity-70 transition-opacity",children:[d.jsx("div",{className:"w-0.5 h-4 bg-gray-600 dark:bg-gray-400 rounded-full"}),d.jsx("div",{className:"w-0.5 h-4 bg-gray-600 dark:bg-gray-400 rounded-full"})]})})})}),d.jsx("div",{className:`
453
+ flex flex-col border-l border-gray-200 relative
454
+ ${i?"hidden":"block"}
455
+ `,style:{width:s?"100%":`${100-f}%`},children:e[1]}),a&&d.jsx(Hp,{isPanelVisible:!s,onToggle:a,position:"left",className:"panel-toggle-left"}),o&&d.jsx(Hp,{isPanelVisible:!i,onToggle:o,position:"right",className:"panel-toggle-right"})]})},K6=({currentView:e,onViewChange:t,hasCustomComponent:r,className:n=""})=>{if(!r)return null;const s=()=>{t(e==="files"?"custom":"files")},i=e==="files"?rm:Ch,a=e==="files"?"Agent 界面":"文件浏览器";return d.jsxs("button",{onClick:s,className:`
456
+ fixed bottom-6 right-6 z-30
457
+ w-12 h-12 rounded-full
458
+ bg-white dark:bg-gray-800
459
+ border border-gray-200 dark:border-gray-600
460
+ shadow-lg hover:shadow-xl
461
+ text-gray-600 dark:text-gray-300
462
+ hover:text-blue-600 dark:hover:text-blue-400
463
+ hover:bg-blue-50 dark:hover:bg-blue-900/20
464
+ hover:border-blue-200 dark:hover:border-blue-700
465
+ transition-all duration-200 ease-in-out
466
+ flex items-center justify-center
467
+ group
468
+ backdrop-blur-sm
469
+ ${n}
470
+ `,title:`切换到${a}`,children:[d.jsx(i,{className:"w-5 h-5"}),d.jsx("div",{className:`
471
+ absolute bottom-full right-0 mb-2 px-2 py-1
472
+ bg-gray-900 dark:bg-gray-700
473
+ text-white text-xs rounded
474
+ opacity-0 group-hover:opacity-100
475
+ transition-opacity duration-200
476
+ pointer-events-none
477
+ whitespace-nowrap
478
+ `,children:a})]})},Q6=({agent:e,projectPath:t,CustomComponent:r})=>{const[n,s]=M.useState(r?"custom":"files"),i=!!r;return d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"h-full bg-white dark:bg-gray-900 overflow-hidden",children:i?d.jsxs(d.Fragment,{children:[d.jsx("div",{className:`h-full ${n==="custom"?"block":"hidden"}`,children:d.jsx(r,{agent:e,projectPath:t})}),d.jsx("div",{className:`h-full ${n==="files"?"block":"hidden"}`,children:d.jsx(Jd,{projectPath:t,onFileSelect:a=>{console.log("Selected file:",a)},className:"h-full"})})]}):d.jsx(Jd,{projectPath:t,onFileSelect:a=>{console.log("Selected file:",a)},className:"h-full"})}),d.jsx(K6,{currentView:n,onViewChange:s,hasCustomComponent:i,className:"floating-toggle"})]})},Z6=({projectPath:e})=>{const{t}=de("agents"),{data:r,isLoading:n,error:s}=iv(e),i=kh(),a=M.useRef({}),o=()=>{i.invalidateQueries({queryKey:["slides",e]}),i.invalidateQueries({queryKey:["slide-content"]}),Object.values(a.current).forEach(c=>{c?.refreshIframe&&c.refreshIframe()})};if(M.useEffect(()=>{const c=u=>{console.log("🔄 Received AI_RESPONSE_COMPLETE event in SlidePreviewPanel:",u),u.projectPath===e&&(console.log("🔄 Auto-refreshing slides after AI response completion"),o())};return Jc.on(eu.AI_RESPONSE_COMPLETE,c),()=>{Jc.off(eu.AI_RESPONSE_COMPLETE,c)}},[e,i]),n)return d.jsx("div",{className:"flex items-center justify-center h-full",children:d.jsx("div",{className:"text-gray-500",children:t("slidePreview.loading")})});if(s)return d.jsx("div",{className:"flex items-center justify-center h-full",children:d.jsx("div",{className:"text-red-500",children:t("slidePreview.loadError")})});const l=r?.slides||[];return d.jsxs("div",{className:"flex flex-col h-full bg-gray-50 dark:bg-gray-900",children:[d.jsx("div",{className:"h-12 px-5 bg-gray-100 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 flex items-center",children:d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{className:"flex items-center space-x-3",children:[d.jsx("h2",{className:"text-lg font-semibold text-gray-800 dark:text-white",children:t("slidePreview.title")}),d.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-700 px-2 py-0.5 rounded",children:r?.title||"Presentation"})]}),d.jsxs("button",{onClick:o,disabled:n,className:"flex items-center space-x-1 px-3 py-1.5 text-sm bg-blue-50 dark:bg-blue-900/30 hover:bg-blue-100 dark:hover:bg-blue-900/50 text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 rounded-md transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:t("slidePreview.refreshTitle"),children:[d.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),d.jsx("span",{children:t("slidePreview.refresh")})]})]})}),d.jsx("div",{className:"flex-1 overflow-y-auto",children:l.length===0?d.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-gray-500 dark:text-gray-400 p-5",children:[d.jsx("div",{className:"text-lg mb-2",children:t("slidePreview.noSlides")}),d.jsx("div",{className:"text-sm",children:t("slidePreview.createWithAI")})]}):d.jsx("div",{className:"space-y-4 p-5",children:l.map(c=>d.jsx(av,{ref:u=>{u?a.current[c.index]=u:delete a.current[c.index]},slide:c,totalSlides:l.length,projectPath:e},c.index))})})]})},J6={rightPanelComponent:Z6,onMount:e=>{console.log(`Slides agent ${e} mounted`)},onUnmount:e=>{console.log(`Slides agent ${e} unmounted`)}},e9={onMount:e=>{console.log(`Chat agent ${e} mounted`)},onUnmount:e=>{console.log(`Chat agent ${e} unmounted`)}},t9={slides:J6,chat:e9},r9=e=>t9[e];function n9({status:e,originalTitle:t=document.title,workingText:r="🤖 AI 正在工作",completedText:n="✅ 已完成",errorText:s="❌ 发生错误",marqueeSpeed:i=300,blinkInterval:a=800}){const o=M.useRef(null),l=M.useRef(!document.hidden),c=M.useRef(t),u=M.useRef("idle");M.useEffect(()=>{document.hidden||(c.current=t)},[t]);const h=()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},f=()=>{h(),document.title=c.current},g=m=>{h();let y=0;const x=`${m}... `,k=()=>{const C=x.slice(y)+x.slice(0,y);document.title=C,y=(y+1)%x.length};k(),o.current=window.setInterval(k,i)},p=m=>{h();let y=!0;const x=()=>{document.title=y?m:c.current,y=!y};x(),o.current=window.setInterval(x,a)};M.useEffect(()=>{const m=()=>{if(l.current=!document.hidden,!document.hidden)f();else{const y=u.current;y==="working"?g(r):y==="completed"?p(n):y==="error"&&p(s)}};return document.addEventListener("visibilitychange",m),()=>{document.removeEventListener("visibilitychange",m),h()}},[r,n,s,i,a]),M.useEffect(()=>{u.current=e,document.hidden&&(e==="working"?g(r):e==="completed"?p(n):e==="error"?p(s):e==="idle"&&f())},[e,r,n,s]),M.useEffect(()=>()=>{h(),document.title=c.current},[])}const Gc="agentstudio:chat-version";function s9(e){return e?"agui":"original"}const i9=()=>{const{t:e}=de("pages"),{agentId:t}=Av(),[r]=um(),n=Mv(),s=r.get("project"),i=r.get("session"),a=r.get("message"),{data:o,isLoading:l,error:c}=lv(t),{setCurrentAgent:u,setCurrentSessionId:h,isAiTyping:f}=Fe(),{isCursorEngine:g,isLoading:p}=Sh(),[m,y]=M.useState(!1),[x,k]=M.useState(!1),[C,T]=M.useState(!1),[S,w]=M.useState(null),[_,O]=M.useState(!1),P=Rr.useRef(!1),[v,L]=M.useState(()=>{const $=localStorage.getItem(Gc);return $==="agui"||$==="original"?$:localStorage.getItem("agentstudio:engine-type")==="cursor"||g?"agui":"original"});M.useEffect(()=>{if(!p&&!localStorage.getItem(Gc)){const E=s9(g);L(E)}},[p,g]),M.useEffect(()=>{const $=E=>{E.key===Gc&&E.newValue&&(E.newValue==="agui"||E.newValue==="original")&&L(E.newValue)};return window.addEventListener("storage",$),()=>window.removeEventListener("storage",$)},[]);const N=o?.agent;M.useEffect(()=>{f?(P.current=!0,O(!1)):P.current&&(document.hidden||(O(!0),P.current=!1))},[f]),M.useEffect(()=>{const $=()=>{!document.hidden&&!f&&P.current&&(O(!0),P.current=!1)};return document.addEventListener("visibilitychange",$),()=>document.removeEventListener("visibilitychange",$)},[f]);const R=M.useMemo(()=>S?"error":f?"working":!f&&P.current&&!_?"completed":"idle",[f,S,_]);n9({status:R,originalTitle:N?`${N.ui.icon} ${N.name} - AgentStudio`:"AgentStudio",workingText:e("chat.tabNotification.working"),completedText:e("chat.tabNotification.completed"),errorText:e("chat.tabNotification.error")}),M.useEffect(()=>{if(c){w(c);const $=setTimeout(()=>w(null),5e3);return()=>clearTimeout($)}},[c]),M.useEffect(()=>{console.log("🎯 ChatPage agent/session effect:",{hasAgent:!!N,agentId:N?.id,sessionId:i,urlSessionId:r.get("session")}),N&&(console.log("🎯 Setting current agent:",N.id),u(N),i&&(console.log("🎯 Setting session ID:",i),h(i)))},[N,i,u,h]),M.useEffect(()=>{N&&!s&&y(!0)},[N,s]);const j=$=>{const E=new URLSearchParams;E.set("project",$),i&&E.set("session",i),n(`/chat/${t}?${E.toString()}`,{replace:!0}),y(!1)},B=$=>{const E=new URLSearchParams;s&&E.set("project",s),$&&E.set("session",$),n(`/chat/${t}?${E.toString()}`,{replace:!0})},I=()=>{y(!1),n("/agents")},F=M.useMemo(()=>{if(N?.ui?.componentType)return r9(N.ui.componentType)},[N]),W=F?.rightPanelComponent;if(M.useEffect(()=>{if(!(!N||!F))return F.onMount&&F.onMount(N.id),()=>{F.onUnmount&&F.onUnmount(N.id)}},[N,F]),l)return d.jsx("div",{className:"min-h-screen bg-gray-100 dark:bg-gray-900 flex items-center justify-center",children:d.jsxs("div",{className:"text-center",children:[d.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto mb-4"}),d.jsx("div",{className:"text-gray-600 dark:text-gray-400",children:e("chat.loading")})]})});if(c||!N)return d.jsx("div",{className:"min-h-screen bg-gray-100 dark:bg-gray-900 flex items-center justify-center",children:d.jsxs("div",{className:"text-center max-w-md",children:[d.jsx("div",{className:"text-6xl mb-6",children:"❌"}),d.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-4",children:e("chat.agentNotFound")}),d.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-6",children:e("chat.agentNotFoundDesc")}),d.jsx("button",{onClick:()=>window.close(),className:"px-6 py-3 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors",children:e("chat.closePage")})]})});if(!N.enabled)return d.jsx("div",{className:"min-h-screen bg-gray-100 dark:bg-gray-900 flex items-center justify-center",children:d.jsxs("div",{className:"text-center max-w-md",children:[d.jsx("div",{className:"text-6xl mb-6 opacity-50",children:N.ui.icon}),d.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-4",children:e("chat.agentDisabled")}),d.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-6",children:e("chat.agentDisabledDesc",{name:N.name})}),d.jsx("div",{className:"flex space-x-4 justify-center",children:d.jsx("button",{onClick:()=>window.close(),className:"px-6 py-3 bg-gray-600 text-white rounded-lg hover:bg-gray-700 transition-colors",children:e("chat.closePage")})})]})});const ee=()=>{const $=!x;k($),$&&C&&T(!1)},A=()=>{const $=!C;T($),$&&x&&k(!1)},G=()=>{const $=v==="agui"?Y6:G6;return d.jsxs(X6,{hideLeftPanel:x,hideRightPanel:C,onToggleLeftPanel:ee,onToggleRightPanel:A,mobileLayout:"tabs",children:[d.jsx($,{agent:N,projectPath:s||void 0,onSessionChange:B,initialMessage:a||void 0}),d.jsx(Q6,{agent:N,projectPath:s||void 0,CustomComponent:W})]})};return d.jsxs("div",{className:"h-screen bg-gray-100 dark:bg-gray-900",children:[G(),m&&N&&d.jsx(Lv,{agent:N,onProjectSelect:j,onClose:I})]})},X9=Object.freeze(Object.defineProperty({__proto__:null,ChatPage:i9},Symbol.toStringTag,{value:"Module"}));export{A9 as $,Yi as A,vE as B,HA as C,Ed as D,$t as E,z0 as F,kD as G,ka as H,qr as I,E$ as J,vL as K,Uf as L,cL as M,ad as N,E9 as O,j9 as P,Ns as Q,Cg as R,vg as S,L9 as T,Ne as U,I9 as V,M9 as W,T9 as X,N9 as Y,D9 as Z,b as _,RA as a,nr as a$,$9 as a0,sA as a1,Xs as a2,v9 as a3,Il as a4,hD as a5,CA as a6,Gh as a7,ng as a8,fL as a9,pe as aA,H9 as aB,IB as aC,NB as aD,TB as aE,$3 as aF,uL as aG,w9 as aH,Na as aI,I3 as aJ,j3 as aK,ds as aL,lD as aM,Fb as aN,Nl as aO,jl as aP,Xo as aQ,zb as aR,Pb as aS,P5 as aT,rd as aU,Sn as aV,mg as aW,Hj as aX,sa as aY,ge as aZ,Nb as a_,fo as aa,bD as ab,jA as ac,ba as ad,ue as ae,be as af,K0 as ag,iB as ah,Xw as ai,U9 as aj,M$ as ak,_t as al,$n as am,yd as an,wk as ao,ps as ap,Gb as aq,oD as ar,J4 as as,eD as at,bd as au,wp as av,KB as aw,q9 as ax,V9 as ay,W9 as az,BA as b,Bj as b0,td as b1,ux as b2,va as b3,fx as b4,_9 as b5,wE as b6,aD as b7,J5 as b8,O4 as b9,cD as bA,Ml as bB,X9 as bC,kd as ba,$5 as bb,uD as bc,_a as bd,ai as be,Vo as bf,U5 as bg,bR as bh,Sa as bi,Yo as bj,F5 as bk,Ib as bl,H4 as bm,q4 as bn,Gn as bo,Hg as bp,U4 as bq,wd as br,W4 as bs,Y4 as bt,oi as bu,Ln as bv,Pg as bw,vd as bx,$b as by,lh as bz,He as c,Oe as d,X0 as e,Ct as f,FA as g,cn as h,yr as i,B$ as j,si as k,K as l,Xb as m,C9 as n,Y9 as o,OA as p,zA as q,G9 as r,PA as s,A$ as t,Er as u,CB as v,CD as w,B9 as x,DA as y,S9 as z};