agent-tower 0.7.4-beta.0 → 0.7.4

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 (218) hide show
  1. package/dist/mcp/tools/tasks.js +3 -3
  2. package/dist/mcp/tools/tasks.js.map +1 -1
  3. package/dist/mcp/types.js +2 -2
  4. package/dist/mcp/types.js.map +1 -1
  5. package/dist/prompts/task-handoff.d.ts.map +1 -1
  6. package/dist/prompts/task-handoff.js +2 -1
  7. package/dist/prompts/task-handoff.js.map +1 -1
  8. package/dist/routes/__tests__/sessions-runtime.test.js +2 -0
  9. package/dist/routes/__tests__/sessions-runtime.test.js.map +1 -1
  10. package/dist/routes/__tests__/tasks.test.js +41 -0
  11. package/dist/routes/__tests__/tasks.test.js.map +1 -1
  12. package/dist/routes/__tests__/workspace-history.test.d.ts +2 -0
  13. package/dist/routes/__tests__/workspace-history.test.d.ts.map +1 -0
  14. package/dist/routes/__tests__/workspace-history.test.js +174 -0
  15. package/dist/routes/__tests__/workspace-history.test.js.map +1 -0
  16. package/dist/routes/sessions.d.ts.map +1 -1
  17. package/dist/routes/sessions.js +10 -0
  18. package/dist/routes/sessions.js.map +1 -1
  19. package/dist/routes/tasks.d.ts.map +1 -1
  20. package/dist/routes/tasks.js +8 -0
  21. package/dist/routes/tasks.js.map +1 -1
  22. package/dist/runtime/__tests__/cli-driver-lifecycle.test.js +84 -0
  23. package/dist/runtime/__tests__/cli-driver-lifecycle.test.js.map +1 -1
  24. package/dist/runtime/cli-driver.js +11 -8
  25. package/dist/runtime/cli-driver.js.map +1 -1
  26. package/dist/services/__tests__/task.service.test.js +128 -13
  27. package/dist/services/__tests__/task.service.test.js.map +1 -1
  28. package/dist/services/__tests__/workspace.service.test.js +64 -5
  29. package/dist/services/__tests__/workspace.service.test.js.map +1 -1
  30. package/dist/services/message-delivery.service.d.ts +1 -0
  31. package/dist/services/message-delivery.service.d.ts.map +1 -1
  32. package/dist/services/session-manager.d.ts +4 -0
  33. package/dist/services/session-manager.d.ts.map +1 -1
  34. package/dist/services/session-manager.js +3 -1
  35. package/dist/services/session-manager.js.map +1 -1
  36. package/dist/services/session-resource-cleanup.d.ts +5 -0
  37. package/dist/services/session-resource-cleanup.d.ts.map +1 -1
  38. package/dist/services/session-resource-cleanup.js +7 -0
  39. package/dist/services/session-resource-cleanup.js.map +1 -1
  40. package/dist/services/task-cleanup.service.d.ts +2 -0
  41. package/dist/services/task-cleanup.service.d.ts.map +1 -1
  42. package/dist/services/task-cleanup.service.js +4 -0
  43. package/dist/services/task-cleanup.service.js.map +1 -1
  44. package/dist/services/task-display-state.d.ts +10 -0
  45. package/dist/services/task-display-state.d.ts.map +1 -0
  46. package/dist/services/task-display-state.js +45 -0
  47. package/dist/services/task-display-state.js.map +1 -0
  48. package/dist/services/task.service.d.ts +20 -1
  49. package/dist/services/task.service.d.ts.map +1 -1
  50. package/dist/services/task.service.js +134 -101
  51. package/dist/services/task.service.js.map +1 -1
  52. package/dist/services/workspace.service.d.ts +10 -7
  53. package/dist/services/workspace.service.d.ts.map +1 -1
  54. package/dist/services/workspace.service.js +160 -88
  55. package/dist/services/workspace.service.js.map +1 -1
  56. package/dist/web/assets/{AgentDemoPage-JXetlNBf.js → AgentDemoPage-D9bIiALx.js} +1 -1
  57. package/dist/web/assets/{AgentEnvironmentSettingsPage-CdYyUCwJ.js → AgentEnvironmentSettingsPage-BE0RC6fR.js} +1 -1
  58. package/dist/web/assets/{AttachmentPreview-DMS-PM-1.js → AttachmentPreview-TPd4gdfb.js} +2 -2
  59. package/dist/web/assets/{BranchSelect-BAq4L2ZS.js → BranchSelect-Kv3M1YhZ.js} +1 -1
  60. package/dist/web/assets/{BrandLogo--kWXXJtZ.js → BrandLogo-fR2lCwEo.js} +1 -1
  61. package/dist/web/assets/{ConversationPage-CvC4RyB5.js → ConversationPage-BZiMHI9T.js} +1 -1
  62. package/dist/web/assets/{CreateTaskInput-DjVxCAfc.js → CreateTaskInput-TcZpjBe-.js} +1 -1
  63. package/dist/web/assets/{DemoPage-cDVTGOp8.js → DemoPage-DwpThe16.js} +1 -1
  64. package/dist/web/assets/{DesignSystemPage-BI54IkKi.js → DesignSystemPage-DH9_cygJ.js} +1 -1
  65. package/dist/web/assets/{ExecutionPermissionSelector-f1UYIm1z.js → ExecutionPermissionSelector-C-akTOVg.js} +1 -1
  66. package/dist/web/assets/{GeneralSettingsPage-C0yto6C_.js → GeneralSettingsPage-v2w1eofz.js} +1 -1
  67. package/dist/web/assets/{LoadingPreviewPage-BiJSaHUi.js → LoadingPreviewPage-pgk3PWM9.js} +1 -1
  68. package/dist/web/assets/{McpSettingsPage-BbHwZtyj.js → McpSettingsPage-w1DOlY5V.js} +1 -1
  69. package/dist/web/assets/{MemberAvatar-BLezO3vS.js → MemberAvatar-CJtylxwu.js} +1 -1
  70. package/dist/web/assets/MobileTaskDetail-D5Czlr2O.js +3 -0
  71. package/dist/web/assets/{NotificationSettingsPage-CiKoL2Kv.js → NotificationSettingsPage-CkLg4WvT.js} +1 -1
  72. package/dist/web/assets/{ProfileSettingsPage-DCB48cPS.js → ProfileSettingsPage-B3yzbY1V.js} +1 -1
  73. package/dist/web/assets/ProjectKanbanPage-CuGSLvrU.js +14 -0
  74. package/dist/web/assets/{ProjectSettingsPage-COvIVq1h.js → ProjectSettingsPage-DoklOfna.js} +1 -1
  75. package/dist/web/assets/{ProviderSettingsPage-CPuJcZDg.js → ProviderSettingsPage-Cm0hbX5n.js} +2 -2
  76. package/dist/web/assets/{SettingsMasterDetail-Cv7YaRJB.js → SettingsMasterDetail-CGCUalkW.js} +1 -1
  77. package/dist/web/assets/TaskDetail-BiZbuXcE.js +1 -0
  78. package/dist/web/assets/{TaskHandoffPanel-CxH3Mgyd.js → TaskHandoffPanel-CJahUKNo.js} +24 -24
  79. package/dist/web/assets/{TeamSettingsPage-D-XDefNd.js → TeamSettingsPage-CyppRTaY.js} +1 -1
  80. package/dist/web/assets/{TranslationSettingsPage-BPHI-SZW.js → TranslationSettingsPage-BoQXEZmn.js} +1 -1
  81. package/dist/web/assets/{arc-CC81aLuf.js → arc-5NPBSbiL.js} +1 -1
  82. package/dist/web/assets/{architectureDiagram-3BPJPVTR-DL08XGaN.js → architectureDiagram-3BPJPVTR-CqPT-IsX.js} +1 -1
  83. package/dist/web/assets/{at-sign-DYPIlD6D.js → at-sign-Cf39WHCg.js} +1 -1
  84. package/dist/web/assets/{blockDiagram-GPEHLZMM-B4IW5WxI.js → blockDiagram-GPEHLZMM-BN-1z9KN.js} +1 -1
  85. package/dist/web/assets/{c4Diagram-AAUBKEIU-Cj4d_FqK.js → c4Diagram-AAUBKEIU-CkeLbmQp.js} +1 -1
  86. package/dist/web/assets/channel-CDkuQ_7m.js +1 -0
  87. package/dist/web/assets/check-yNWhPvMH.js +1 -0
  88. package/dist/web/assets/{chevron-down-DNhYsNAt.js → chevron-down-Ct7FZbKm.js} +1 -1
  89. package/dist/web/assets/{chevron-up-CjrLieBR.js → chevron-up-ARFlXMyO.js} +1 -1
  90. package/dist/web/assets/{chip-Cf92J-pQ.js → chip-BV_1-tIb.js} +1 -1
  91. package/dist/web/assets/{chunk-2J33WTMH-DeCj8QSD.js → chunk-2J33WTMH-CWR7tRuT.js} +1 -1
  92. package/dist/web/assets/{chunk-4BX2VUAB-k-6rzQmQ.js → chunk-4BX2VUAB-CAulp4D5.js} +1 -1
  93. package/dist/web/assets/{chunk-55IACEB6-qMTCQ5bX.js → chunk-55IACEB6-DqkKXsbD.js} +1 -1
  94. package/dist/web/assets/{chunk-727SXJPM-CMnu18d1.js → chunk-727SXJPM-B19m45Sq.js} +1 -1
  95. package/dist/web/assets/{chunk-AQP2D5EJ-C0mFbUMn.js → chunk-AQP2D5EJ-CuODwkza.js} +1 -1
  96. package/dist/web/assets/{chunk-FMBD7UC4-u6-_M137.js → chunk-FMBD7UC4-CbUAjtCT.js} +1 -1
  97. package/dist/web/assets/{chunk-ND2GUHAM-DHrIE_8H.js → chunk-ND2GUHAM-C54VxArl.js} +1 -1
  98. package/dist/web/assets/{chunk-QZHKN3VN-aTyC0wZq.js → chunk-QZHKN3VN-D54Uw5fD.js} +1 -1
  99. package/dist/web/assets/classDiagram-4FO5ZUOK-eHY73FGu.js +1 -0
  100. package/dist/web/assets/classDiagram-v2-Q7XG4LA2-eHY73FGu.js +1 -0
  101. package/dist/web/assets/{code-block-OCS4YCEC-CBIOQOMH.js → code-block-OCS4YCEC-CtAySD1h.js} +1 -1
  102. package/dist/web/assets/{confirm-dialog-DWeBZLJW.js → confirm-dialog-CCjHVFTv.js} +1 -1
  103. package/dist/web/assets/{content-JM9E1MeD.js → content-DZozZbBD.js} +2 -2
  104. package/dist/web/assets/{copy-D0gl9kF8.js → copy-C-jvx2et.js} +1 -1
  105. package/dist/web/assets/{cose-bilkent-S5V4N54A-xLyliSgU.js → cose-bilkent-S5V4N54A-BaB2EVcU.js} +1 -1
  106. package/dist/web/assets/{cssMode-DO5UnQ64.js → cssMode-wd7JR1S4.js} +1 -1
  107. package/dist/web/assets/{dagre-BM42HDAG-CbNpoO2d.js → dagre-BM42HDAG-C2j1Y8pO.js} +1 -1
  108. package/dist/web/assets/{diagram-2AECGRRQ-CG3hKxAX.js → diagram-2AECGRRQ-CF-EvpV9.js} +1 -1
  109. package/dist/web/assets/{diagram-5GNKFQAL-mQu9M28s.js → diagram-5GNKFQAL-rBNso835.js} +1 -1
  110. package/dist/web/assets/{diagram-KO2AKTUF-BSeEp_Uw.js → diagram-KO2AKTUF-6NW-oos1.js} +1 -1
  111. package/dist/web/assets/{diagram-LMA3HP47-D6yRdao-.js → diagram-LMA3HP47-DTfRxRLT.js} +1 -1
  112. package/dist/web/assets/{diagram-OG6HWLK6-BUBUW9wD.js → diagram-OG6HWLK6-CS4Ae-hD.js} +1 -1
  113. package/dist/web/assets/{dialog-D1lkhqVL.js → dialog-DV4wfpNU.js} +1 -1
  114. package/dist/web/assets/{erDiagram-TEJ5UH35-BQSZgRqq.js → erDiagram-TEJ5UH35-Dw9QQctN.js} +1 -1
  115. package/dist/web/assets/{file-BijjwxRR.js → file-Btui_I8Z.js} +1 -1
  116. package/dist/web/assets/{flowDiagram-I6XJVG4X-D-eqyr5Y.js → flowDiagram-I6XJVG4X-BGZ9q86S.js} +1 -1
  117. package/dist/web/assets/{folder-picker-Czxm0_S9.js → folder-picker-DiR-8Qdl.js} +1 -1
  118. package/dist/web/assets/{freemarker2-B4RvEa_U.js → freemarker2-yVWXzD3l.js} +1 -1
  119. package/dist/web/assets/{ganttDiagram-6RSMTGT7-BWGkCt_x.js → ganttDiagram-6RSMTGT7-CkGun0no.js} +1 -1
  120. package/dist/web/assets/{gitGraphDiagram-PVQCEYII-DGVc49pR.js → gitGraphDiagram-PVQCEYII-Bz3oiYvi.js} +1 -1
  121. package/dist/web/assets/{globe-Ce01-45x.js → globe-DAFqpAcW.js} +1 -1
  122. package/dist/web/assets/{handlebars-oyT7drqS.js → handlebars-BPf0z6eN.js} +1 -1
  123. package/dist/web/assets/{html-CxxWf2Qk.js → html-HCTCjfUg.js} +1 -1
  124. package/dist/web/assets/{htmlMode-RfAHh5Jj.js → htmlMode-BDkbsknt.js} +1 -1
  125. package/dist/web/assets/index-408ws6FY.css +1 -0
  126. package/dist/web/assets/{index-Dh-tgeaL.js → index-B8xoIIa6.js} +4 -4
  127. package/dist/web/assets/{index-T38iVLEb.js → index-BMcLxIvZ.js} +1 -1
  128. package/dist/web/assets/{index-DWrSDMX2.js → index-BPqjxXmH.js} +1 -1
  129. package/dist/web/assets/index-BszkzNS4.js +122 -0
  130. package/dist/web/assets/{index-DyJfPc4O.js → index-DgUtx9rV.js} +1 -1
  131. package/dist/web/assets/{index-Pt4TsHjm.js → index-DkSPjZm4.js} +1 -1
  132. package/dist/web/assets/{index-hpHE1jXY.js → index-DuM6iAxG.js} +1 -1
  133. package/dist/web/assets/{index-BMZFF1UJ.js → index-GuczxPxb.js} +1 -1
  134. package/dist/web/assets/{index-Disv1kQS.js → index-lZLy5rkr.js} +1 -1
  135. package/dist/web/assets/{infoDiagram-5YYISTIA-DLPs3dV_.js → infoDiagram-5YYISTIA-DYFufUYC.js} +1 -1
  136. package/dist/web/assets/{ishikawaDiagram-YF4QCWOH-d_OrnwDY.js → ishikawaDiagram-YF4QCWOH-IOkrKRwu.js} +1 -1
  137. package/dist/web/assets/javascript-DKmxrNeR.js +1 -0
  138. package/dist/web/assets/{journeyDiagram-JHISSGLW-EtU1st_0.js → journeyDiagram-JHISSGLW-Btl3yxne.js} +1 -1
  139. package/dist/web/assets/{jsonMode-Bqh5vIxx.js → jsonMode-DJPdvFcw.js} +1 -1
  140. package/dist/web/assets/{kanban-definition-UN3LZRKU-ZWzUnsFK.js → kanban-definition-UN3LZRKU-CDryhPbA.js} +1 -1
  141. package/dist/web/assets/{kbd-IjDGsZ2B.js → kbd-8RRRm9jd.js} +1 -1
  142. package/dist/web/assets/{key-round-CbnAuUxp.js → key-round-wojrCrDP.js} +1 -1
  143. package/dist/web/assets/{layers-Pdy9vZ6K.js → layers-BH_LL4b8.js} +1 -1
  144. package/dist/web/assets/{linear-D7n23wcA.js → linear-BLuwKHze.js} +1 -1
  145. package/dist/web/assets/{link-Bl1ZbjFh.js → link-jWQOSQOQ.js} +1 -1
  146. package/dist/web/assets/{liquid-Ds47iVLN.js → liquid-1y-xg637.js} +1 -1
  147. package/dist/web/assets/{lspLanguageFeatures-Dcch3bsp.js → lspLanguageFeatures-cYkILdCn.js} +1 -1
  148. package/dist/web/assets/{mdx-CM7ky-2B.js → mdx-CRg4Q6aP.js} +1 -1
  149. package/dist/web/assets/{menu-DubntFHq.js → menu-CMqbaDni.js} +1 -1
  150. package/dist/web/assets/{mermaid-NOHMQCX5-nBsnjgeU.js → mermaid-NOHMQCX5-CYeAhOl-.js} +4 -4
  151. package/dist/web/assets/{message-square-BE-pW0m_.js → message-square-DykJ2lWP.js} +1 -1
  152. package/dist/web/assets/{mindmap-definition-RKZ34NQL-ClHORNTt.js → mindmap-definition-RKZ34NQL-B5wtw1Rv.js} +1 -1
  153. package/dist/web/assets/{modal-CHLtZWvx.js → modal-BwOwTzij.js} +1 -1
  154. package/dist/web/assets/{monaco-BbAmalE2.js → monaco-CcHqpOKe.js} +3 -3
  155. package/dist/web/assets/{nav-row-DH7rNq1V.js → nav-row-BmtdNLxR.js} +1 -1
  156. package/dist/web/assets/{paperclip-YP3Bk1lI.js → paperclip-C4t49vX2.js} +1 -1
  157. package/dist/web/assets/{pencil-BFDuhbtW.js → pencil-BQ5_raiB.js} +1 -1
  158. package/dist/web/assets/{people-DEeNaaLt.js → people-Dr0v8HK0.js} +1 -1
  159. package/dist/web/assets/{pieDiagram-4H26LBE5-BUOaKIyP.js → pieDiagram-4H26LBE5-BZ3VoaNI.js} +1 -1
  160. package/dist/web/assets/{popover-CUmBEXxL.js → popover-CTqvKqTR.js} +1 -1
  161. package/dist/web/assets/{python-BODTtU6m.js → python-Huq_acyd.js} +1 -1
  162. package/dist/web/assets/{quadrantDiagram-W4KKPZXB-Caezg-U2.js → quadrantDiagram-W4KKPZXB-C6ArHmnG.js} +1 -1
  163. package/dist/web/assets/{razor-CHm8DY1p.js → razor-Clc87Ivb.js} +1 -1
  164. package/dist/web/assets/{requirementDiagram-4Y6WPE33-BtdP3Ka6.js → requirementDiagram-4Y6WPE33-DiLzBRQP.js} +1 -1
  165. package/dist/web/assets/{sankeyDiagram-5OEKKPKP-Bv74oA-n.js → sankeyDiagram-5OEKKPKP-QlYYd7IZ.js} +1 -1
  166. package/dist/web/assets/{search-ClmOQd4H.js → search-CMIAPUEt.js} +1 -1
  167. package/dist/web/assets/{select-CYtYPr-c.js → select-Bg7NI8i0.js} +1 -1
  168. package/dist/web/assets/{select-BB7QG08o.js → select-DqB7YF38.js} +1 -1
  169. package/dist/web/assets/{sequenceDiagram-3UESZ5HK-DuNPl-dg.js → sequenceDiagram-3UESZ5HK-COKEtqc0.js} +1 -1
  170. package/dist/web/assets/{server-bEB_DY55.js → server-D7knl8H9.js} +1 -1
  171. package/dist/web/assets/{stateDiagram-AJRCARHV-B72HAgBJ.js → stateDiagram-AJRCARHV-1RZZZdOe.js} +1 -1
  172. package/dist/web/assets/stateDiagram-v2-BHNVJYJU-CCLmVs34.js +1 -0
  173. package/dist/web/assets/{textarea-BqYPvoO-.js → textarea-BCY2J2ca.js} +1 -1
  174. package/dist/web/assets/{timeline-definition-PNZ67QCA-DTmHUgmQ.js → timeline-definition-PNZ67QCA-IJl1LY6J.js} +1 -1
  175. package/dist/web/assets/{toggles-a5fkwT_D.js → toggles-C4LmZwyo.js} +1 -1
  176. package/dist/web/assets/{tooltip-DuyJMci9.js → tooltip-Cirpotu3.js} +1 -1
  177. package/dist/web/assets/{track-DCjyrv3n.js → track-Cv7h6oaE.js} +1 -1
  178. package/dist/web/assets/{trash-2-CIyBqaVy.js → trash-2-BEOQ1ICJ.js} +1 -1
  179. package/dist/web/assets/{tsMode-C1UXAkMh.js → tsMode-CHIbCBQc.js} +1 -1
  180. package/dist/web/assets/{typescript-Biht2wHb.js → typescript-CScj0bbb.js} +1 -1
  181. package/dist/web/assets/{upload-D05XS5-G.js → upload-tLVD0xMT.js} +1 -1
  182. package/dist/web/assets/{use-profiles-CrWTyz1G.js → use-profiles-TkoP4Yw9.js} +1 -1
  183. package/dist/web/assets/{use-providers-Dv1Nk6s7.js → use-providers-Bz6YNiYj.js} +1 -1
  184. package/dist/web/assets/{use-translation-settings-CcUnipVO.js → use-translation-settings-CCpQNS30.js} +1 -1
  185. package/dist/web/assets/{useNormalizedLogs-D9W1cT4R.js → useNormalizedLogs-Bstb98cF.js} +1 -1
  186. package/dist/web/assets/{useTokenUsage-CZ5mDshD.js → useTokenUsage-D7SEwXb0.js} +1 -1
  187. package/dist/web/assets/{vennDiagram-CIIHVFJN-ByoNydXe.js → vennDiagram-CIIHVFJN-DzVayy4U.js} +1 -1
  188. package/dist/web/assets/{wardley-L42UT6IY-BqdMkOLl.js → wardley-L42UT6IY-CULSKh55.js} +1 -1
  189. package/dist/web/assets/{wardleyDiagram-YWT4CUSO-AO22HrEF.js → wardleyDiagram-YWT4CUSO-C5_h3lAA.js} +1 -1
  190. package/dist/web/assets/{xml-NLGqNFDv.js → xml-XuycSwh6.js} +1 -1
  191. package/dist/web/assets/{xychartDiagram-2RQKCTM6-vzPgjgqW.js → xychartDiagram-2RQKCTM6-F65naXcR.js} +1 -1
  192. package/dist/web/assets/{yaml-AWlGS_Ig.js → yaml-BWm159lw.js} +1 -1
  193. package/dist/web/index.html +2 -2
  194. package/node_modules/@agent-tower/shared/dist/index.d.ts +1 -0
  195. package/node_modules/@agent-tower/shared/dist/index.d.ts.map +1 -1
  196. package/node_modules/@agent-tower/shared/dist/index.js +1 -0
  197. package/node_modules/@agent-tower/shared/dist/index.js.map +1 -1
  198. package/node_modules/@agent-tower/shared/dist/task-hierarchy.d.ts +17 -0
  199. package/node_modules/@agent-tower/shared/dist/task-hierarchy.d.ts.map +1 -0
  200. package/node_modules/@agent-tower/shared/dist/task-hierarchy.js +12 -0
  201. package/node_modules/@agent-tower/shared/dist/task-hierarchy.js.map +1 -0
  202. package/node_modules/@agent-tower/shared/dist/types.d.ts +20 -4
  203. package/node_modules/@agent-tower/shared/dist/types.d.ts.map +1 -1
  204. package/node_modules/@agent-tower/shared/dist/types.js.map +1 -1
  205. package/package.json +1 -1
  206. package/prisma/migrations/20261027000000_preserve_workspace_history/migration.sql +2 -0
  207. package/prisma/schema.prisma +2 -0
  208. package/dist/web/assets/MobileTaskDetail-M_Kke9rL.js +0 -3
  209. package/dist/web/assets/ProjectKanbanPage-soDqevjQ.js +0 -12
  210. package/dist/web/assets/TaskDetail-CqhPxvg3.js +0 -1
  211. package/dist/web/assets/channel-CUa8oyzC.js +0 -1
  212. package/dist/web/assets/check-DaZqOL8l.js +0 -1
  213. package/dist/web/assets/classDiagram-4FO5ZUOK-BAx111NO.js +0 -1
  214. package/dist/web/assets/classDiagram-v2-Q7XG4LA2-BAx111NO.js +0 -1
  215. package/dist/web/assets/index-BN53vGxp.css +0 -1
  216. package/dist/web/assets/index-Cc3qXMhU.js +0 -122
  217. package/dist/web/assets/javascript-BNXtViSL.js +0 -1
  218. package/dist/web/assets/stateDiagram-v2-BHNVJYJU-Bu3l_CgB.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/code-block-OCS4YCEC-CBIOQOMH.js","assets/index-Cc3qXMhU.js","assets/index-BN53vGxp.css","assets/AttachmentPreview-DMS-PM-1.js","assets/tooltip-DuyJMci9.js","assets/kbd-IjDGsZ2B.js","assets/index-DWrSDMX2.js","assets/index-Disv1kQS.js","assets/index-Pt4TsHjm.js","assets/use-translation-settings-CcUnipVO.js","assets/copy-D0gl9kF8.js","assets/index-DyJfPc4O.js","assets/chevron-down-DNhYsNAt.js","assets/index-Dh-tgeaL.js"])))=>i.map(i=>d[i]);
2
- import{c as ed,cF as se,u as Xe,j as p,o as fr,r as y,m as Tu,af as Kn,q as ft,ag as Xn,ah as Zn,J as td,cG as xu,cl as nd,p as vt,aB as rd,aL as ku,cH as id,n as sd,cI as ad,X as ud,cJ as od,aF as ld,bg as yu,cK as cd,cL as dd,bx as Ii,l as kn,a0 as yn,b8 as hd,a2 as An,aj as Au,cM as fd}from"./index-Cc3qXMhU.js";import{c as _u,f as md,a as pd,b as gd}from"./AttachmentPreview-DMS-PM-1.js";import{t as xs,u as Cu}from"./use-translation-settings-CcUnipVO.js";import{C as bd}from"./copy-D0gl9kF8.js";import{R as Ed,A as Td,P as xd,C as kd}from"./index-DyJfPc4O.js";import{T as yd,t as ks}from"./tooltip-DuyJMci9.js";import{C as Su}from"./chevron-down-DNhYsNAt.js";const Ad=[["path",{d:"M12 16v5",key:"zza2cw"}],["path",{d:"M16 14v7",key:"1g90b9"}],["path",{d:"M20 10v11",key:"1iqoj0"}],["path",{d:"m22 3-8.646 8.646a.5.5 0 0 1-.708 0L9.354 8.354a.5.5 0 0 0-.707 0L2 15",key:"1fw8x9"}],["path",{d:"M4 18v3",key:"1yp0dc"}],["path",{d:"M8 14v7",key:"n3cwzv"}]],_d=ed("chart-no-axes-combined",Ad),Cd=/^[ \t]{0,3}::agent-download\{file="([^"\r\n]+)"\}[ \t]*$/,Sd=/^[a-zA-Z]:[\\/]/,Nd=1024;function Nu(e){if(!e||e.length>Nd||e!==e.trim()||e.includes("\\")||/[\0-\x1f\x7f]/.test(e)||e.startsWith("/")||Sd.test(e))return null;const t=e.split("/");return t.some(n=>!n||n==="."||n==="..")?null:t.join("/")}function Id(e){const t=e.match(Cd);return t?Nu(t[1]):null}function wd(e,t){const n=new Set(e.flatMap(i=>i.deliveryId?[i.deliveryId]:[])),r=t.filter(i=>i.state!=="CANCELLED"&&!n.has(i.id)).map(i=>({id:`user:${i.id}`,deliveryId:i.id,timestamp:Date.parse(i.createdAt),type:se.User,content:i.originalText}));return r.length?[...e,...r].sort((i,s)=>(i.timestamp??0)-(s.timestamp??0)):e}function Ld({item:e,onConversationCreated:t}){const{t:n}=Xe(),r="attachmentIds"in e.body&&Array.isArray(e.body.attachmentIds)?e.body.attachmentIds:[],i=_u(r),s=md(e);return p.jsx("div",{className:"my-4 flex justify-end","data-submission-id":e.id,children:p.jsxs("div",{className:"flex max-w-[85%] min-w-0 flex-col items-end",children:[p.jsxs("div",{className:"max-w-full min-w-0 rounded-2xl rounded-tr-sm bg-foreground/[0.08] px-5 py-3.5 text-sm",children:[p.jsx("p",{className:"whitespace-pre-wrap break-words",children:e.text}),i.data?.map(a=>p.jsx("span",{className:"mt-1 block text-xs text-muted-foreground",children:a.originalName},a.id))]}),e.failed&&p.jsxs("div",{className:"mt-1 max-w-full px-0.5 text-xs text-muted-foreground","data-message-feedback":!0,children:[p.jsx("p",{children:n("Acceptance unknown; check or retry the same submission.")}),p.jsx("button",{type:"button",className:"mt-1 text-xs underline",disabled:s.isPending,onClick:()=>s.mutate(void 0,{onSuccess:a=>{"id"in a&&t?.(a.id)}}),children:n("Retry original submission")})]})]})})}const ei=new WeakMap,Dn=[];function Rd(e,t,n){let r=ei.get(e);r||(r=new Map,ei.set(e,r));let i=r.get(t);if(i)i.owners.add(n),n.permission(i.denied);else{const s=new Set;let a=0;const u=()=>{i.epoch++;for(const d of s)d.refresh()},o=(d=!0)=>{const h=++a;e.emit(Zn.SUBSCRIBE,{topic:"session",id:t},f=>{if(h!==a||r.get(t)!==i)return;const m=i.denied;i.denied=!f.success;for(const b of s)b.permission(!f.success);m&&f.success&&u()}),d&&u()},c=d=>{d.sessionId===t&&u()};i={owners:s,epoch:0,denied:!1,dispose:()=>{a++,e.off("connect",o),e.off(Xn.TRANSLATION_INVALIDATED,c),e.emit(Zn.UNSUBSCRIBE,{topic:"session",id:t})}},r.set(t,i),e.on("connect",o),e.on(Xn.TRANSLATION_INVALIDATED,c),s.add(n),e.connected&&o(!1)}return()=>{i.owners.delete(n),i.owners.size||(i.dispose(),r.delete(t))}}function ys(e,t){return ei.get(e)?.get(t)?.epoch??0}function As(e){return e instanceof td&&[401,403,404].includes(e.status)}function Iu(e){return e.type===se.Assistant&&e.title!=="Thinking"&&!e.content.startsWith("Thinking:")&&e.textBlock?.semanticType==="assistant_message"}function Od(e){return new Map(e.map(t=>[JSON.stringify([t.sessionId,t.turnId,t.blockId]),t]))}function Dd(e,t,n){const r=[];let i=null;if(!Iu(t)||!t.textBlock)return{content:t.content,overlays:r,version:i};const s=xu(t.content,t.textBlock),a=s.map(u=>{const o=n.get(JSON.stringify([e,u.turnId,u.blockId]));return u.state!=="SEALED"||!o||o.sourceRevision!==u.sourceRevision||o.originalText!==u.content||(r.push(o),o.state!=="SUCCESS"||o.translatedText===null)?u.content:(i=`${o.sourceId}:${o.sourceRevision}`,o.translatedText)}).join("");return{content:s.length?a:t.content,overlays:r,version:i}}function Pd(e,t){const n=new Map(e?.map(r=>[r.sourceId,r]));return nd(e,t.map(r=>{const i=n.get(r.sourceId);return i&&i.overlayRevision>r.overlayRevision?i:r}))}async function vd(e,t,n){const r=[];for(let i=0;i<1;i+=100){let s=null;const a=new Set;do{if(n.aborted)throw new DOMException("Aborted","AbortError");const u=await vt.get(`/sessions/${encodeURIComponent(e)}/translations`,{signal:n,params:{...s?{cursor:s}:{}}});if(r.push(...u.items),s=u.nextCursor,s&&(a.has(s)||a.size>=1e3))throw new Error("Translation pagination did not finish");s&&a.add(s)}while(s!==null)}return r}function Md(e,t){const n=fr(),[r,i]=y.useState(!1),s=y.useMemo(()=>JSON.stringify(t.filter(Iu).map(c=>{const d=c.textBlock;return[d.turnId,d.blockId,d.sourceRevision,d.state,d.paragraphs?.length??0]})),[t]),a=y.useRef({sessionId:e,selection:s}),u=Tu({queryKey:ft.sessionTranslations.session(e),enabled:s!=="[]",queryFn:async({signal:c})=>{const d=Kn.getSocket();for(let h=0;h<3;h++){const f=ys(d,e);let m;try{m=await vd(e,void 0,c)}catch(b){throw!c.aborted&&As(b)&&n.setQueryData(ft.sessionTranslations.session(e),Dn),b}if(c.aborted)throw new DOMException("Aborted","AbortError");if(ys(d,e)===f)return m}throw new Error("Translation snapshot changed while reading")},structuralSharing:(c,d)=>Pd(c,d),refetchOnMount:"always",refetchInterval:5e3,retry:!1,gcTime:30*6e4});y.useEffect(()=>{const c=Kn.connect();return Rd(c,e,{refresh:()=>{n.invalidateQueries({queryKey:ft.sessionTranslations.session(e)},{cancelRefetch:!1})},permission:h=>{i(h),h&&(n.cancelQueries({queryKey:ft.sessionTranslations.session(e)},{revert:!1}),n.setQueryData(ft.sessionTranslations.session(e),Dn))}})},[n,e]),y.useEffect(()=>{const c=a.current;a.current={sessionId:e,selection:s},c.sessionId===e&&c.selection!==s&&n.invalidateQueries({queryKey:ft.sessionTranslations.session(e)},{cancelRefetch:!1})},[n,e,s]);const o=As(u.error);return{...u,overlays:!r&&!o?u.data??Dn:Dn}}class Bd{initialized=!1;sources=new Map;live=new Set;pending=new Set;completed=new Set;eligible=new Set;consumed=new Set;update(t,n,r){for(const i of t){const s=this.sources.get(i.id);(i.streaming||this.initialized&&(s===void 0||s!==i.revision))&&this.live.add(i.id),this.sources.set(i.id,i.revision)}r&&(this.initialized=!0);for(const i of n)i.state!=="SUCCESS"?i.state!=="NOT_REQUIRED"&&this.pending.add(i.version):this.completed.has(i.version)||(this.completed.add(i.version),(this.live.has(i.id)||this.pending.has(i.version))&&this.eligible.add(i.version))}claim=t=>this.consumed.has(t)?!1:(this.consumed.add(t),this.eligible.has(t))}function Fd(e,t,n,r){const i=y.useMemo(()=>new Bd,[e]);return i.update(t,n,r),i.claim}const Pn=new Map;function Hd(e){const t=Pn.get(e);if(t)t.count++;else{const n=Kn.connect(),r=()=>n.emit(Zn.SUBSCRIBE,{topic:"task",id:e});n.on("connect",r),n.connected&&r(),Pn.set(e,{count:1,release:()=>{n.off("connect",r),n.emit(Zn.UNSUBSCRIBE,{topic:"task",id:e})}})}return()=>{const n=Pn.get(e);n&&--n.count===0&&(n.release(),Pn.delete(e))}}const qn=e=>["message-deliveries",e];function _s(e,t="pending",n="SESSION"){const r=fr(),i=rd({queryKey:[...qn(e),t],structuralSharing:(s,a)=>id(s,a),initialPageParam:"",queryFn:async({pageParam:s})=>{const a=await vt.get("/message-deliveries",{params:{scopeType:n,scopeId:n==="TEAM_TASK"?e.replace(/^task:/,""):e,filter:t,...s?{cursor:s}:{}}});if(t!=="pending"||s)return a;const u=r.getQueryData([...qn(e),"pending"]),o=new Set(a.items.map(h=>h.id)),c=u?.pages.flatMap(h=>h.items).filter(h=>!["SENT","CANCELLED"].includes(h.state)&&!o.has(h.id))??[],d=await Promise.all(c.map(h=>vt.get(`/message-deliveries/${encodeURIComponent(h.id)}`)));for(const h of d)ku(r,h);return{...a,items:[...a.items,...d]}},getNextPageParam:s=>s.nextCursor??void 0,enabled:!!e,refetchInterval:s=>s.state.data?.pages.some(a=>a.items.some(u=>!["SENT","CANCELLED"].includes(u.state)))?1e3:5e3});return y.useEffect(()=>{n==="TEAM_TASK"&&i.dataUpdatedAt&&r.invalidateQueries({queryKey:["team-runs","task",e.replace(/^task:/,"")]})},[r,n,e,i.dataUpdatedAt]),y.useEffect(()=>{if(!e)return;const s=n==="TEAM_TASK"?Hd(e.replace(/^task:/,"")):void 0,a=Kn.connect(),u=()=>{r.invalidateQueries({queryKey:qn(e)})},o=c=>{(c.sessionId===e||c.taskId&&`task:${c.taskId}`===e)&&u()};return a.on(Xn.MESSAGE_DELIVERY_INVALIDATED,o),a.on("connect",u),()=>{s?.(),a.off(Xn.MESSAGE_DELIVERY_INVALIDATED,o),a.off("connect",u)}},[e,n,r]),i}function Ud(e){const t=fr();return sd({mutationFn:({delivery:n,action:r})=>{const i={action:r,expectedRevision:n.revision};return pd(`action:${n.id}`,i,s=>{const{clientSubmissionId:a,...u}=s;return vt.post(`/message-deliveries/${n.id}/actions`,{...u,actionId:a})})},onSuccess:n=>ku(t,n.delivery),onSettled:()=>t.invalidateQueries({queryKey:qn(e)})})}function jd({text:e,label:t,getText:n,canCopy:r}){const{t:i}=Xe(),[s,a]=y.useState(null),u=y.useRef(!1),o=y.useRef(!0);y.useEffect(()=>(o.current=!0,()=>{o.current=!1}),[]);const c=async()=>{if(!u.current){u.current=!0;try{const d=n?await n():e;if(!o.current||r&&!r())return;if(navigator.clipboard?.writeText)await navigator.clipboard.writeText(d);else{const h=document.activeElement,f=document.createElement("textarea");f.value=d,f.readOnly=!0,f.style.position="fixed",f.style.opacity="0",document.body.appendChild(f);try{if(f.focus(),f.select(),!document.execCommand("copy"))throw new Error}finally{f.remove(),h?.focus()}}o.current&&a("已复制")}catch{o.current&&a("Copy failed.")}finally{u.current=!1}}};return p.jsxs("span",{className:"inline-flex items-center gap-1",children:[p.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 rounded px-1.5 py-1 text-xs text-muted-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":t,onClick:()=>{c()},children:[p.jsx(bd,{size:12}),t]}),s&&p.jsx("span",{className:"text-xs text-muted-foreground",role:"status",children:i(s)})]})}function wu({original:e,children:t,onOpen:n,getOriginal:r,canCopy:i,loading:s,error:a,label:u="Original"}){const{t:o}=Xe(),[c,d]=y.useState(!1),h=y.useRef(null),f=y.useRef(null),m=y.useRef(!1),b=y.useRef(!1),k=y.useRef(!1),S=y.useRef(null),_=y.useId(),L=y.useId(),I=()=>{S.current&&clearTimeout(S.current)},B=($=!1)=>{I(),b.current=$,d(!1)},z=()=>{I(),S.current=setTimeout(()=>{!f.current?.contains(document.activeElement)&&document.activeElement!==h.current&&B()},250)};y.useEffect(()=>()=>{S.current&&clearTimeout(S.current)},[]);const R=y.useRef(n);return y.useEffect(()=>{R.current=n},[n]),y.useEffect(()=>{c&&R.current?.()},[c]),p.jsxs(Ed,{open:c,onOpenChange:$=>{b.current=!1,d($)},children:[p.jsx(Td,{asChild:!0,children:p.jsx("button",{type:"button",ref:h,"aria-haspopup":"dialog","aria-expanded":c,"aria-controls":c?L:void 0,"aria-label":o(u),title:o(u),className:"inline-flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",onPointerEnter:$=>{$.pointerType==="mouse"&&(I(),d(!0))},onPointerLeave:z,onFocus:()=>{m.current||(I(),d(!0)),m.current=!1},onBlur:z,onClick:()=>{I(),d(!0)},onKeyDown:$=>{($.key==="ArrowDown"||$.key==="Tab"&&!$.shiftKey&&c)&&($.preventDefault(),k.current=!0,d(!0),f.current?.querySelector("button")?.focus()),$.key==="Escape"&&c&&($.preventDefault(),$.stopPropagation(),B(!0))},children:p.jsx(ad,{size:14,"aria-hidden":"true"})})}),p.jsx(xd,{children:p.jsxs(kd,{ref:f,id:L,align:"start",sideOffset:6,collisionPadding:12,"aria-labelledby":_,className:"z-[80] flex max-h-[var(--radix-popover-content-available-height)] w-[min(36rem,calc(100vw-24px))] flex-col rounded-xl border border-border bg-background p-4 text-foreground shadow-xl outline-none",onOpenAutoFocus:$=>{$.preventDefault(),k.current&&f.current?.querySelector("button")?.focus(),k.current=!1},onFocusOutside:$=>{$.target===h.current&&$.preventDefault()},onCloseAutoFocus:$=>{$.preventDefault(),b.current&&document.activeElement!==h.current&&(m.current=!0,h.current?.focus()),b.current=!1},onEscapeKeyDown:$=>{$.preventDefault(),$.stopPropagation(),B(!0)},onPointerEnter:I,onPointerLeave:z,onFocus:I,onBlur:z,children:[p.jsxs("div",{className:"mb-3 flex shrink-0 items-center justify-between gap-2",children:[p.jsx("h3",{id:_,className:"text-sm font-medium",children:o(u)}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(jd,{text:e,getText:r,canCopy:i,label:o(u==="Original"?"Copy original":"复制")}),p.jsx("button",{type:"button","aria-label":o("关闭"),onClick:()=>B(!0),className:"rounded p-1 hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring",children:p.jsx(ud,{size:15})})]})]}),s&&p.jsx("span",{role:"status",className:"text-xs text-muted-foreground",children:o("Loading")}),a&&p.jsxs("div",{role:"alert",className:"text-xs text-destructive",children:[a,p.jsx("button",{type:"button",onClick:n,className:"ml-2 underline",children:o("Retry")})]}),p.jsx("div",{tabIndex:0,"aria-label":o(u),className:"max-h-[min(55vh,28rem)] min-h-0 overflow-y-auto overscroll-contain break-words pr-2 text-sm leading-6 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:t})]})})]})}function zd({version:e,claim:t,children:n}){const r=y.useRef(null),i=y.useRef(e);return y.useLayoutEffect(()=>{const s=i.current!==e;i.current=e;const a=e!==null&&t?.(e);if(!s||!a||!r.current?.animate||window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;const u=r.current.animate([{opacity:.55,transform:"translateY(2px)"},{opacity:1,transform:"translateY(0)"}],{duration:180,easing:"ease-out"});return()=>u.cancel()},[e,t]),p.jsx("div",{ref:r,"data-translation-version":e??"original",children:n})}const Cs=new Set(["FAILED","CANCELLED","INTERRUPTED","QUEUE_FULL","PAUSED_DISABLED"]),$d={PENDING:"Waiting for translation",RUNNING:"Translating…",RETRY_WAIT:"Waiting to retry translation",FAILED:"Translation failed",CANCELLED:"Translation cancelled",INTERRUPTED:"Translation interrupted",QUEUE_FULL:"Translation queue full",PAUSED_DISABLED:"Translation paused"};function qd({overlay:e,enabled:t}){const n=fr();return p.jsx(Yd,{state:e.state,errorCode:e.errorCode,enabled:t,onRetry:async()=>{try{await vt.post(`/sessions/${encodeURIComponent(e.sessionId)}/translations/${encodeURIComponent(e.sourceId)}/retry`,{expectedRevision:e.sourceRevision})}finally{n.invalidateQueries({queryKey:ft.sessionTranslations.session(e.sessionId)})}}})}function Yd({state:e,errorCode:t,enabled:n,onRetry:r}){const{t:i}=Xe(),[s,a]=y.useState(!1),u=y.useRef(!1),[o,c]=y.useState(null),d=y.useRef(!0);y.useEffect(()=>(d.current=!0,()=>{d.current=!1}),[]);const h=$d[e];if(!h)return null;const f=e==="FAILED"||t&&(Cs.has(e)||e==="RETRY_WAIT");return p.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[p.jsx("span",{children:i(h)}),n&&Cs.has(e)&&p.jsx("button",{type:"button",disabled:s,className:"rounded px-1.5 py-1 underline hover:bg-muted disabled:opacity-50",onClick:async()=>{if(!u.current){u.current=!0,a(!0),c(null);try{await r()}catch(m){d.current&&c(xs(m))}finally{u.current=!1,d.current&&a(!1)}}},children:i(s?"Retrying…":"Retry translation")}),f&&p.jsxs("p",{role:"alert",className:"w-full break-words text-destructive",children:[i(xs(t)),t&&p.jsxs(p.Fragment,{children:[" ",p.jsxs("span",{className:"font-mono",children:["(",t,")"]})]})]}),o&&p.jsx("span",{role:"alert",children:i(o)})]})}function Vd({delivery:e}){const t=_u(e.attachmentIds);return["SENT","CANCELLED"].includes(e.state)?null:t.data?.map(n=>p.jsx("a",{className:"mt-1 block text-xs underline",href:`/api/attachments/${encodeURIComponent(n.id)}/file`,target:"_blank",rel:"noreferrer",children:n.originalName},n.id))}function Lu({delivery:e}){const{t}=Xe(),n=Ud(od(e)?e.sessionId:`task:${e.destination.taskId}`),r=Cu(),i=e.sentMode==="ORIGINAL"&&e.acceptedText!==null;if(i&&!e.lastError&&["READY","DISPATCHING"].includes(e.state)||e.state==="SENT"&&e.sentMode!=="TRANSLATED")return null;if(e.state==="SENT")return p.jsx("div",{className:"flex justify-end",children:p.jsx(wu,{original:e.actualSentText??"",label:"Actual sent text",children:p.jsx("pre",{className:"whitespace-pre-wrap",children:e.actualSentText})})});if(e.state==="CANCELLED")return p.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t("Cancelled")});const s=e.state==="DELIVERY_UNKNOWN"?[["confirm_not_sent","Confirmed not sent: retry"],["end_unknown","End operation (may already be received)"]]:e.state==="DISPATCHING"?[]:[...!i&&r.data?.enabled===!0&&["TRANSLATION_FAILED","PAUSED_DISABLED"].includes(e.state)?[["retry_translation","Retry translation"]]:[],...["DELIVERY_FAILED","PAUSED_DISABLED"].includes(e.state)&&e.acceptedText!==null?[["retry_delivery","Retry delivery"]]:[],...!i&&["TRANSLATION_FAILED","PAUSED_DISABLED","WAITING_TRANSLATION","WAITING_TASK_INPUT","READY","WAITING_PREDECESSOR","ACCEPTED"].includes(e.state)?[["send_original","Send original"]]:[],["cancel","Cancel"]];return p.jsxs("div",{className:"space-y-1 text-xs text-muted-foreground","data-delivery-state":e.state,"aria-live":"polite",children:[p.jsx("p",{children:t(e.state==="DELIVERY_UNKNOWN"?"Delivery result unknown. Verify before retrying.":["ACCEPTED","WAITING_PREDECESSOR"].includes(e.state)?"Queued, not sent":e.state==="TRANSLATION_FAILED"?"Translation failed":e.state==="PAUSED_DISABLED"?"Sending paused":e.state==="DELIVERY_FAILED"?"Delivery failed":e.state==="WAITING_TASK_INPUT"?"Waiting for task input":e.state==="WAITING_TRANSLATION"?"Waiting for translation":"Waiting to send")}),e.lastError&&p.jsx("p",{children:e.lastError}),p.jsx("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:s.map(([a,u])=>p.jsx("button",{type:"button",className:"underline",disabled:n.isPending,onClick:()=>n.mutate({delivery:e,action:a}),children:t(u)},a))}),n.error&&p.jsx("p",{role:"alert",className:"text-destructive",children:t("Delivery action failed. Refresh and try again.")})]})}function Nt(e,t,n){let r=n.initialDeps??[],i,s=!0;function a(){var u,o,c;let d;n.key&&((u=n.debug)!=null&&u.call(n))&&(d=Date.now());const h=e();if(!(h.length!==r.length||h.some((b,k)=>r[k]!==b)))return i;r=h;let m;if(n.key&&((o=n.debug)!=null&&o.call(n))&&(m=Date.now()),i=t(...h),n.key&&((c=n.debug)!=null&&c.call(n))){const b=Math.round((Date.now()-d)*100)/100,k=Math.round((Date.now()-m)*100)/100,S=k/16,_=(L,I)=>{for(L=String(L);L.length<I;)L=" "+L;return L};console.info(`%c⏱ ${_(k,5)} /${_(b,5)} ms`,`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/code-block-OCS4YCEC-CtAySD1h.js","assets/index-BszkzNS4.js","assets/index-408ws6FY.css","assets/AttachmentPreview-TPd4gdfb.js","assets/tooltip-Cirpotu3.js","assets/kbd-8RRRm9jd.js","assets/index-BPqjxXmH.js","assets/index-lZLy5rkr.js","assets/index-DkSPjZm4.js","assets/use-translation-settings-CCpQNS30.js","assets/copy-C-jvx2et.js","assets/index-DgUtx9rV.js","assets/chevron-down-Ct7FZbKm.js","assets/index-B8xoIIa6.js"])))=>i.map(i=>d[i]);
2
+ import{c as ed,cJ as se,u as Xe,j as p,o as fr,r as y,m as Tu,af as Kn,q as ft,ag as Xn,ah as Zn,J as td,cK as xu,cp as nd,p as vt,aC as rd,aM as ku,cL as id,n as sd,cM as ad,X as ud,cN as od,aG as ld,bh as yu,cO as cd,cP as dd,bB as Ii,l as kn,a0 as yn,b9 as hd,a2 as An,aj as Au,cQ as fd}from"./index-BszkzNS4.js";import{c as _u,f as md,a as pd,b as gd}from"./AttachmentPreview-TPd4gdfb.js";import{t as xs,u as Cu}from"./use-translation-settings-CCpQNS30.js";import{C as bd}from"./copy-C-jvx2et.js";import{R as Ed,A as Td,P as xd,C as kd}from"./index-DgUtx9rV.js";import{T as yd,t as ks}from"./tooltip-Cirpotu3.js";import{C as Su}from"./chevron-down-Ct7FZbKm.js";const Ad=[["path",{d:"M12 16v5",key:"zza2cw"}],["path",{d:"M16 14v7",key:"1g90b9"}],["path",{d:"M20 10v11",key:"1iqoj0"}],["path",{d:"m22 3-8.646 8.646a.5.5 0 0 1-.708 0L9.354 8.354a.5.5 0 0 0-.707 0L2 15",key:"1fw8x9"}],["path",{d:"M4 18v3",key:"1yp0dc"}],["path",{d:"M8 14v7",key:"n3cwzv"}]],_d=ed("chart-no-axes-combined",Ad),Cd=/^[ \t]{0,3}::agent-download\{file="([^"\r\n]+)"\}[ \t]*$/,Sd=/^[a-zA-Z]:[\\/]/,Nd=1024;function Nu(e){if(!e||e.length>Nd||e!==e.trim()||e.includes("\\")||/[\0-\x1f\x7f]/.test(e)||e.startsWith("/")||Sd.test(e))return null;const t=e.split("/");return t.some(n=>!n||n==="."||n==="..")?null:t.join("/")}function Id(e){const t=e.match(Cd);return t?Nu(t[1]):null}function wd(e,t){const n=new Set(e.flatMap(i=>i.deliveryId?[i.deliveryId]:[])),r=t.filter(i=>i.state!=="CANCELLED"&&!n.has(i.id)).map(i=>({id:`user:${i.id}`,deliveryId:i.id,timestamp:Date.parse(i.createdAt),type:se.User,content:i.originalText}));return r.length?[...e,...r].sort((i,s)=>(i.timestamp??0)-(s.timestamp??0)):e}function Ld({item:e,onConversationCreated:t}){const{t:n}=Xe(),r="attachmentIds"in e.body&&Array.isArray(e.body.attachmentIds)?e.body.attachmentIds:[],i=_u(r),s=md(e);return p.jsx("div",{className:"my-4 flex justify-end","data-submission-id":e.id,children:p.jsxs("div",{className:"flex max-w-[85%] min-w-0 flex-col items-end",children:[p.jsxs("div",{className:"max-w-full min-w-0 rounded-2xl rounded-tr-sm bg-foreground/[0.08] px-5 py-3.5 text-sm",children:[p.jsx("p",{className:"whitespace-pre-wrap break-words",children:e.text}),i.data?.map(a=>p.jsx("span",{className:"mt-1 block text-xs text-muted-foreground",children:a.originalName},a.id))]}),e.failed&&p.jsxs("div",{className:"mt-1 max-w-full px-0.5 text-xs text-muted-foreground","data-message-feedback":!0,children:[p.jsx("p",{children:n("Acceptance unknown; check or retry the same submission.")}),p.jsx("button",{type:"button",className:"mt-1 text-xs underline",disabled:s.isPending,onClick:()=>s.mutate(void 0,{onSuccess:a=>{"id"in a&&t?.(a.id)}}),children:n("Retry original submission")})]})]})})}const ei=new WeakMap,Dn=[];function Rd(e,t,n){let r=ei.get(e);r||(r=new Map,ei.set(e,r));let i=r.get(t);if(i)i.owners.add(n),n.permission(i.denied);else{const s=new Set;let a=0;const u=()=>{i.epoch++;for(const d of s)d.refresh()},o=(d=!0)=>{const h=++a;e.emit(Zn.SUBSCRIBE,{topic:"session",id:t},f=>{if(h!==a||r.get(t)!==i)return;const m=i.denied;i.denied=!f.success;for(const b of s)b.permission(!f.success);m&&f.success&&u()}),d&&u()},c=d=>{d.sessionId===t&&u()};i={owners:s,epoch:0,denied:!1,dispose:()=>{a++,e.off("connect",o),e.off(Xn.TRANSLATION_INVALIDATED,c),e.emit(Zn.UNSUBSCRIBE,{topic:"session",id:t})}},r.set(t,i),e.on("connect",o),e.on(Xn.TRANSLATION_INVALIDATED,c),s.add(n),e.connected&&o(!1)}return()=>{i.owners.delete(n),i.owners.size||(i.dispose(),r.delete(t))}}function ys(e,t){return ei.get(e)?.get(t)?.epoch??0}function As(e){return e instanceof td&&[401,403,404].includes(e.status)}function Iu(e){return e.type===se.Assistant&&e.title!=="Thinking"&&!e.content.startsWith("Thinking:")&&e.textBlock?.semanticType==="assistant_message"}function Od(e){return new Map(e.map(t=>[JSON.stringify([t.sessionId,t.turnId,t.blockId]),t]))}function Dd(e,t,n){const r=[];let i=null;if(!Iu(t)||!t.textBlock)return{content:t.content,overlays:r,version:i};const s=xu(t.content,t.textBlock),a=s.map(u=>{const o=n.get(JSON.stringify([e,u.turnId,u.blockId]));return u.state!=="SEALED"||!o||o.sourceRevision!==u.sourceRevision||o.originalText!==u.content||(r.push(o),o.state!=="SUCCESS"||o.translatedText===null)?u.content:(i=`${o.sourceId}:${o.sourceRevision}`,o.translatedText)}).join("");return{content:s.length?a:t.content,overlays:r,version:i}}function Pd(e,t){const n=new Map(e?.map(r=>[r.sourceId,r]));return nd(e,t.map(r=>{const i=n.get(r.sourceId);return i&&i.overlayRevision>r.overlayRevision?i:r}))}async function vd(e,t,n){const r=[];for(let i=0;i<1;i+=100){let s=null;const a=new Set;do{if(n.aborted)throw new DOMException("Aborted","AbortError");const u=await vt.get(`/sessions/${encodeURIComponent(e)}/translations`,{signal:n,params:{...s?{cursor:s}:{}}});if(r.push(...u.items),s=u.nextCursor,s&&(a.has(s)||a.size>=1e3))throw new Error("Translation pagination did not finish");s&&a.add(s)}while(s!==null)}return r}function Md(e,t){const n=fr(),[r,i]=y.useState(!1),s=y.useMemo(()=>JSON.stringify(t.filter(Iu).map(c=>{const d=c.textBlock;return[d.turnId,d.blockId,d.sourceRevision,d.state,d.paragraphs?.length??0]})),[t]),a=y.useRef({sessionId:e,selection:s}),u=Tu({queryKey:ft.sessionTranslations.session(e),enabled:s!=="[]",queryFn:async({signal:c})=>{const d=Kn.getSocket();for(let h=0;h<3;h++){const f=ys(d,e);let m;try{m=await vd(e,void 0,c)}catch(b){throw!c.aborted&&As(b)&&n.setQueryData(ft.sessionTranslations.session(e),Dn),b}if(c.aborted)throw new DOMException("Aborted","AbortError");if(ys(d,e)===f)return m}throw new Error("Translation snapshot changed while reading")},structuralSharing:(c,d)=>Pd(c,d),refetchOnMount:"always",refetchInterval:5e3,retry:!1,gcTime:30*6e4});y.useEffect(()=>{const c=Kn.connect();return Rd(c,e,{refresh:()=>{n.invalidateQueries({queryKey:ft.sessionTranslations.session(e)},{cancelRefetch:!1})},permission:h=>{i(h),h&&(n.cancelQueries({queryKey:ft.sessionTranslations.session(e)},{revert:!1}),n.setQueryData(ft.sessionTranslations.session(e),Dn))}})},[n,e]),y.useEffect(()=>{const c=a.current;a.current={sessionId:e,selection:s},c.sessionId===e&&c.selection!==s&&n.invalidateQueries({queryKey:ft.sessionTranslations.session(e)},{cancelRefetch:!1})},[n,e,s]);const o=As(u.error);return{...u,overlays:!r&&!o?u.data??Dn:Dn}}class Bd{initialized=!1;sources=new Map;live=new Set;pending=new Set;completed=new Set;eligible=new Set;consumed=new Set;update(t,n,r){for(const i of t){const s=this.sources.get(i.id);(i.streaming||this.initialized&&(s===void 0||s!==i.revision))&&this.live.add(i.id),this.sources.set(i.id,i.revision)}r&&(this.initialized=!0);for(const i of n)i.state!=="SUCCESS"?i.state!=="NOT_REQUIRED"&&this.pending.add(i.version):this.completed.has(i.version)||(this.completed.add(i.version),(this.live.has(i.id)||this.pending.has(i.version))&&this.eligible.add(i.version))}claim=t=>this.consumed.has(t)?!1:(this.consumed.add(t),this.eligible.has(t))}function Fd(e,t,n,r){const i=y.useMemo(()=>new Bd,[e]);return i.update(t,n,r),i.claim}const Pn=new Map;function Hd(e){const t=Pn.get(e);if(t)t.count++;else{const n=Kn.connect(),r=()=>n.emit(Zn.SUBSCRIBE,{topic:"task",id:e});n.on("connect",r),n.connected&&r(),Pn.set(e,{count:1,release:()=>{n.off("connect",r),n.emit(Zn.UNSUBSCRIBE,{topic:"task",id:e})}})}return()=>{const n=Pn.get(e);n&&--n.count===0&&(n.release(),Pn.delete(e))}}const qn=e=>["message-deliveries",e];function _s(e,t="pending",n="SESSION"){const r=fr(),i=rd({queryKey:[...qn(e),t],structuralSharing:(s,a)=>id(s,a),initialPageParam:"",queryFn:async({pageParam:s})=>{const a=await vt.get("/message-deliveries",{params:{scopeType:n,scopeId:n==="TEAM_TASK"?e.replace(/^task:/,""):e,filter:t,...s?{cursor:s}:{}}});if(t!=="pending"||s)return a;const u=r.getQueryData([...qn(e),"pending"]),o=new Set(a.items.map(h=>h.id)),c=u?.pages.flatMap(h=>h.items).filter(h=>!["SENT","CANCELLED"].includes(h.state)&&!o.has(h.id))??[],d=await Promise.all(c.map(h=>vt.get(`/message-deliveries/${encodeURIComponent(h.id)}`)));for(const h of d)ku(r,h);return{...a,items:[...a.items,...d]}},getNextPageParam:s=>s.nextCursor??void 0,enabled:!!e,refetchInterval:s=>s.state.data?.pages.some(a=>a.items.some(u=>!["SENT","CANCELLED"].includes(u.state)))?1e3:5e3});return y.useEffect(()=>{n==="TEAM_TASK"&&i.dataUpdatedAt&&r.invalidateQueries({queryKey:["team-runs","task",e.replace(/^task:/,"")]})},[r,n,e,i.dataUpdatedAt]),y.useEffect(()=>{if(!e)return;const s=n==="TEAM_TASK"?Hd(e.replace(/^task:/,"")):void 0,a=Kn.connect(),u=()=>{r.invalidateQueries({queryKey:qn(e)})},o=c=>{(c.sessionId===e||c.taskId&&`task:${c.taskId}`===e)&&u()};return a.on(Xn.MESSAGE_DELIVERY_INVALIDATED,o),a.on("connect",u),()=>{s?.(),a.off(Xn.MESSAGE_DELIVERY_INVALIDATED,o),a.off("connect",u)}},[e,n,r]),i}function Ud(e){const t=fr();return sd({mutationFn:({delivery:n,action:r})=>{const i={action:r,expectedRevision:n.revision};return pd(`action:${n.id}`,i,s=>{const{clientSubmissionId:a,...u}=s;return vt.post(`/message-deliveries/${n.id}/actions`,{...u,actionId:a})})},onSuccess:n=>ku(t,n.delivery),onSettled:()=>t.invalidateQueries({queryKey:qn(e)})})}function jd({text:e,label:t,getText:n,canCopy:r}){const{t:i}=Xe(),[s,a]=y.useState(null),u=y.useRef(!1),o=y.useRef(!0);y.useEffect(()=>(o.current=!0,()=>{o.current=!1}),[]);const c=async()=>{if(!u.current){u.current=!0;try{const d=n?await n():e;if(!o.current||r&&!r())return;if(navigator.clipboard?.writeText)await navigator.clipboard.writeText(d);else{const h=document.activeElement,f=document.createElement("textarea");f.value=d,f.readOnly=!0,f.style.position="fixed",f.style.opacity="0",document.body.appendChild(f);try{if(f.focus(),f.select(),!document.execCommand("copy"))throw new Error}finally{f.remove(),h?.focus()}}o.current&&a("已复制")}catch{o.current&&a("Copy failed.")}finally{u.current=!1}}};return p.jsxs("span",{className:"inline-flex items-center gap-1",children:[p.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 rounded px-1.5 py-1 text-xs text-muted-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":t,onClick:()=>{c()},children:[p.jsx(bd,{size:12}),t]}),s&&p.jsx("span",{className:"text-xs text-muted-foreground",role:"status",children:i(s)})]})}function wu({original:e,children:t,onOpen:n,getOriginal:r,canCopy:i,loading:s,error:a,label:u="Original"}){const{t:o}=Xe(),[c,d]=y.useState(!1),h=y.useRef(null),f=y.useRef(null),m=y.useRef(!1),b=y.useRef(!1),k=y.useRef(!1),S=y.useRef(null),_=y.useId(),L=y.useId(),I=()=>{S.current&&clearTimeout(S.current)},B=($=!1)=>{I(),b.current=$,d(!1)},z=()=>{I(),S.current=setTimeout(()=>{!f.current?.contains(document.activeElement)&&document.activeElement!==h.current&&B()},250)};y.useEffect(()=>()=>{S.current&&clearTimeout(S.current)},[]);const R=y.useRef(n);return y.useEffect(()=>{R.current=n},[n]),y.useEffect(()=>{c&&R.current?.()},[c]),p.jsxs(Ed,{open:c,onOpenChange:$=>{b.current=!1,d($)},children:[p.jsx(Td,{asChild:!0,children:p.jsx("button",{type:"button",ref:h,"aria-haspopup":"dialog","aria-expanded":c,"aria-controls":c?L:void 0,"aria-label":o(u),title:o(u),className:"inline-flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",onPointerEnter:$=>{$.pointerType==="mouse"&&(I(),d(!0))},onPointerLeave:z,onFocus:()=>{m.current||(I(),d(!0)),m.current=!1},onBlur:z,onClick:()=>{I(),d(!0)},onKeyDown:$=>{($.key==="ArrowDown"||$.key==="Tab"&&!$.shiftKey&&c)&&($.preventDefault(),k.current=!0,d(!0),f.current?.querySelector("button")?.focus()),$.key==="Escape"&&c&&($.preventDefault(),$.stopPropagation(),B(!0))},children:p.jsx(ad,{size:14,"aria-hidden":"true"})})}),p.jsx(xd,{children:p.jsxs(kd,{ref:f,id:L,align:"start",sideOffset:6,collisionPadding:12,"aria-labelledby":_,className:"z-[80] flex max-h-[var(--radix-popover-content-available-height)] w-[min(36rem,calc(100vw-24px))] flex-col rounded-xl border border-border bg-background p-4 text-foreground shadow-xl outline-none",onOpenAutoFocus:$=>{$.preventDefault(),k.current&&f.current?.querySelector("button")?.focus(),k.current=!1},onFocusOutside:$=>{$.target===h.current&&$.preventDefault()},onCloseAutoFocus:$=>{$.preventDefault(),b.current&&document.activeElement!==h.current&&(m.current=!0,h.current?.focus()),b.current=!1},onEscapeKeyDown:$=>{$.preventDefault(),$.stopPropagation(),B(!0)},onPointerEnter:I,onPointerLeave:z,onFocus:I,onBlur:z,children:[p.jsxs("div",{className:"mb-3 flex shrink-0 items-center justify-between gap-2",children:[p.jsx("h3",{id:_,className:"text-sm font-medium",children:o(u)}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(jd,{text:e,getText:r,canCopy:i,label:o(u==="Original"?"Copy original":"复制")}),p.jsx("button",{type:"button","aria-label":o("关闭"),onClick:()=>B(!0),className:"rounded p-1 hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring",children:p.jsx(ud,{size:15})})]})]}),s&&p.jsx("span",{role:"status",className:"text-xs text-muted-foreground",children:o("Loading")}),a&&p.jsxs("div",{role:"alert",className:"text-xs text-destructive",children:[a,p.jsx("button",{type:"button",onClick:n,className:"ml-2 underline",children:o("Retry")})]}),p.jsx("div",{tabIndex:0,"aria-label":o(u),className:"max-h-[min(55vh,28rem)] min-h-0 overflow-y-auto overscroll-contain break-words pr-2 text-sm leading-6 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:t})]})})]})}function zd({version:e,claim:t,children:n}){const r=y.useRef(null),i=y.useRef(e);return y.useLayoutEffect(()=>{const s=i.current!==e;i.current=e;const a=e!==null&&t?.(e);if(!s||!a||!r.current?.animate||window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;const u=r.current.animate([{opacity:.55,transform:"translateY(2px)"},{opacity:1,transform:"translateY(0)"}],{duration:180,easing:"ease-out"});return()=>u.cancel()},[e,t]),p.jsx("div",{ref:r,"data-translation-version":e??"original",children:n})}const Cs=new Set(["FAILED","CANCELLED","INTERRUPTED","QUEUE_FULL","PAUSED_DISABLED"]),$d={PENDING:"Waiting for translation",RUNNING:"Translating…",RETRY_WAIT:"Waiting to retry translation",FAILED:"Translation failed",CANCELLED:"Translation cancelled",INTERRUPTED:"Translation interrupted",QUEUE_FULL:"Translation queue full",PAUSED_DISABLED:"Translation paused"};function qd({overlay:e,enabled:t}){const n=fr();return p.jsx(Yd,{state:e.state,errorCode:e.errorCode,enabled:t,onRetry:async()=>{try{await vt.post(`/sessions/${encodeURIComponent(e.sessionId)}/translations/${encodeURIComponent(e.sourceId)}/retry`,{expectedRevision:e.sourceRevision})}finally{n.invalidateQueries({queryKey:ft.sessionTranslations.session(e.sessionId)})}}})}function Yd({state:e,errorCode:t,enabled:n,onRetry:r}){const{t:i}=Xe(),[s,a]=y.useState(!1),u=y.useRef(!1),[o,c]=y.useState(null),d=y.useRef(!0);y.useEffect(()=>(d.current=!0,()=>{d.current=!1}),[]);const h=$d[e];if(!h)return null;const f=e==="FAILED"||t&&(Cs.has(e)||e==="RETRY_WAIT");return p.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[p.jsx("span",{children:i(h)}),n&&Cs.has(e)&&p.jsx("button",{type:"button",disabled:s,className:"rounded px-1.5 py-1 underline hover:bg-muted disabled:opacity-50",onClick:async()=>{if(!u.current){u.current=!0,a(!0),c(null);try{await r()}catch(m){d.current&&c(xs(m))}finally{u.current=!1,d.current&&a(!1)}}},children:i(s?"Retrying…":"Retry translation")}),f&&p.jsxs("p",{role:"alert",className:"w-full break-words text-destructive",children:[i(xs(t)),t&&p.jsxs(p.Fragment,{children:[" ",p.jsxs("span",{className:"font-mono",children:["(",t,")"]})]})]}),o&&p.jsx("span",{role:"alert",children:i(o)})]})}function Vd({delivery:e}){const t=_u(e.attachmentIds);return["SENT","CANCELLED"].includes(e.state)?null:t.data?.map(n=>p.jsx("a",{className:"mt-1 block text-xs underline",href:`/api/attachments/${encodeURIComponent(n.id)}/file`,target:"_blank",rel:"noreferrer",children:n.originalName},n.id))}function Lu({delivery:e}){const{t}=Xe(),n=Ud(od(e)?e.sessionId:`task:${e.destination.taskId}`),r=Cu(),i=e.sentMode==="ORIGINAL"&&e.acceptedText!==null;if(i&&!e.lastError&&["READY","DISPATCHING"].includes(e.state)||e.state==="SENT"&&e.sentMode!=="TRANSLATED")return null;if(e.state==="SENT")return p.jsx("div",{className:"flex justify-end",children:p.jsx(wu,{original:e.actualSentText??"",label:"Actual sent text",children:p.jsx("pre",{className:"whitespace-pre-wrap",children:e.actualSentText})})});if(e.state==="CANCELLED")return p.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t("Cancelled")});const s=e.state==="DELIVERY_UNKNOWN"?[["confirm_not_sent","Confirmed not sent: retry"],["end_unknown","End operation (may already be received)"]]:e.state==="DISPATCHING"?[]:[...!i&&r.data?.enabled===!0&&["TRANSLATION_FAILED","PAUSED_DISABLED"].includes(e.state)?[["retry_translation","Retry translation"]]:[],...["DELIVERY_FAILED","PAUSED_DISABLED"].includes(e.state)&&e.acceptedText!==null?[["retry_delivery","Retry delivery"]]:[],...!i&&["TRANSLATION_FAILED","PAUSED_DISABLED","WAITING_TRANSLATION","WAITING_TASK_INPUT","READY","WAITING_PREDECESSOR","ACCEPTED"].includes(e.state)?[["send_original","Send original"]]:[],["cancel","Cancel"]];return p.jsxs("div",{className:"space-y-1 text-xs text-muted-foreground","data-delivery-state":e.state,"aria-live":"polite",children:[p.jsx("p",{children:t(e.state==="DELIVERY_UNKNOWN"?"Delivery result unknown. Verify before retrying.":["ACCEPTED","WAITING_PREDECESSOR"].includes(e.state)?"Queued, not sent":e.state==="TRANSLATION_FAILED"?"Translation failed":e.state==="PAUSED_DISABLED"?"Sending paused":e.state==="DELIVERY_FAILED"?"Delivery failed":e.state==="WAITING_TASK_INPUT"?"Waiting for task input":e.state==="WAITING_TRANSLATION"?"Waiting for translation":"Waiting to send")}),e.lastError&&p.jsx("p",{children:e.lastError}),p.jsx("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:s.map(([a,u])=>p.jsx("button",{type:"button",className:"underline",disabled:n.isPending,onClick:()=>n.mutate({delivery:e,action:a}),children:t(u)},a))}),n.error&&p.jsx("p",{role:"alert",className:"text-destructive",children:t("Delivery action failed. Refresh and try again.")})]})}function Nt(e,t,n){let r=n.initialDeps??[],i,s=!0;function a(){var u,o,c;let d;n.key&&((u=n.debug)!=null&&u.call(n))&&(d=Date.now());const h=e();if(!(h.length!==r.length||h.some((b,k)=>r[k]!==b)))return i;r=h;let m;if(n.key&&((o=n.debug)!=null&&o.call(n))&&(m=Date.now()),i=t(...h),n.key&&((c=n.debug)!=null&&c.call(n))){const b=Math.round((Date.now()-d)*100)/100,k=Math.round((Date.now()-m)*100)/100,S=k/16,_=(L,I)=>{for(L=String(L);L.length<I;)L=" "+L;return L};console.info(`%c⏱ ${_(k,5)} /${_(b,5)} ms`,`
3
3
  font-size: .6rem;
4
4
  font-weight: bold;
5
5
  color: hsl(${Math.max(0,Math.min(120-120*S,120))}deg 100% 31%);`,n?.key)}return n?.onChange&&!(s&&n.skipInitialOnChange)&&n.onChange(i),s=!1,i}return a.updateDeps=u=>{r=u},a}function Ss(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const Wd=(e,t)=>Math.abs(e-t)<1.01,Gd=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)}},Ns=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},Qd=e=>e,Kd=e=>{const t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let i=t;i<=n;i++)r.push(i);return r},Xd=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const i=a=>{const{width:u,height:o}=a;t({width:Math.round(u),height:Math.round(o)})};if(i(Ns(n)),!r.ResizeObserver)return()=>{};const s=new r.ResizeObserver(a=>{const u=()=>{const o=a[0];if(o?.borderBoxSize){const c=o.borderBoxSize[0];if(c){i({width:c.inlineSize,height:c.blockSize});return}}i(Ns(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(u):u()});return s.observe(n,{box:"border-box"}),()=>{s.unobserve(n)}},Is={passive:!0},ws=typeof window>"u"?!0:"onscrollend"in window,Zd=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;let i=0;const s=e.options.useScrollendEvent&&ws?()=>{}:Gd(r,()=>{t(i,!1)},e.options.isScrollingResetDelay),a=d=>()=>{const{horizontal:h,isRtl:f}=e.options;i=h?n.scrollLeft*(f&&-1||1):n.scrollTop,s(),t(i,d)},u=a(!0),o=a(!1);n.addEventListener("scroll",u,Is);const c=e.options.useScrollendEvent&&ws;return c&&n.addEventListener("scrollend",o,Is),()=>{n.removeEventListener("scroll",u),c&&n.removeEventListener("scrollend",o)}},Jd=(e,t,n)=>{if(t?.borderBoxSize){const r=t.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},eh=(e,{adjustments:t=0,behavior:n},r)=>{var i,s;const a=e+t;(s=(i=r.scrollElement)==null?void 0:i.scrollTo)==null||s.call(i,{[r.options.horizontal?"left":"top"]:a,behavior:n})};class th{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.currentScrollToIndex=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(i=>{i.forEach(s=>{const a=()=>{this._measureElement(s.target,s)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()})}));return{disconnect:()=>{var i;(i=r())==null||i.disconnect(),n=null},observe:i=>{var s;return(s=r())==null?void 0:s.observe(i,{box:"border-box"})},unobserve:i=>{var s;return(s=r())==null?void 0:s.unobserve(i)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([r,i])=>{typeof i>"u"&&delete n[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Qd,rangeExtractor:Kd,onChange:()=>{},measureElement:Jd,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...n}},this.notify=n=>{var r,i;(i=(r=this.options).onChange)==null||i.call(r,this,n)},this.maybeNotify=Nt(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(i=>{this.observer.observe(i)}),this.unsubs.push(this.options.observeElementRect(this,i=>{this.scrollRect=i,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(i,s)=>{this.scrollAdjustments=0,this.scrollDirection=s?this.getScrollOffset()<i?"forward":"backward":null,this.scrollOffset=i,this.isScrolling=s,this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,r)=>{const i=new Map,s=new Map;for(let a=r-1;a>=0;a--){const u=n[a];if(i.has(u.lane))continue;const o=s.get(u.lane);if(o==null||u.end>o.end?s.set(u.lane,u):u.end<o.end&&i.set(u.lane,!0),i.size===this.options.lanes)break}return s.size===this.options.lanes?Array.from(s.values()).sort((a,u)=>a.end===u.end?a.index-u.index:a.end-u.end)[0]:void 0},this.getMeasurementOptions=Nt(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(n,r,i,s,a,u)=>(this.prevLanes!==void 0&&this.prevLanes!==u&&(this.lanesChangedFlag=!0),this.prevLanes=u,this.pendingMeasuredCacheIndexes=[],{count:n,paddingStart:r,scrollMargin:i,getItemKey:s,enabled:a,lanes:u}),{key:!1}),this.getMeasurements=Nt(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:n,paddingStart:r,scrollMargin:i,getItemKey:s,enabled:a,lanes:u},o)=>{if(!a)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(const f of this.laneAssignments.keys())f>=n&&this.laneAssignments.delete(f);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(f=>{this.itemSizeCache.set(f.key,f.size)}));const c=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1);const d=this.measurementsCache.slice(0,c),h=new Array(u).fill(void 0);for(let f=0;f<c;f++){const m=d[f];m&&(h[m.lane]=f)}for(let f=c;f<n;f++){const m=s(f),b=this.laneAssignments.get(f);let k,S;if(b!==void 0&&this.options.lanes>1){k=b;const B=h[k],z=B!==void 0?d[B]:void 0;S=z?z.end+this.options.gap:r+i}else{const B=this.options.lanes===1?d[f-1]:this.getFurthestMeasurement(d,f);S=B?B.end+this.options.gap:r+i,k=B?B.lane:f%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(f,k)}const _=o.get(m),L=typeof _=="number"?_:this.options.estimateSize(f),I=S+L;d[f]={index:f,start:S,size:L,end:I,key:m,lane:k},h[k]=f}return this.measurementsCache=d,d},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Nt(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,i,s)=>this.range=n.length>0&&r>0?nh({measurements:n,outerSize:r,scrollOffset:i,lanes:s}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Nt(()=>{let n=null,r=null;const i=this.calculateRange();return i&&(n=i.startIndex,r=i.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,r]},(n,r,i,s,a)=>s===null||a===null?[]:n({startIndex:s,endIndex:a,overscan:r,count:i}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,i=n.getAttribute(r);return i?parseInt(i,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this._measureElement=(n,r)=>{const i=this.indexFromElement(n),s=this.measurementsCache[i];if(!s)return;const a=s.key,u=this.elementsCache.get(a);u!==n&&(u&&this.observer.unobserve(u),this.observer.observe(n),this.elementsCache.set(a,n)),n.isConnected&&this.resizeItem(i,this.options.measureElement(n,r,this))},this.resizeItem=(n,r)=>{const i=this.measurementsCache[n];if(!i)return;const s=this.itemSizeCache.get(i.key)??i.size,a=r-s;a!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(i,a,this):i.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=a,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(i.index),this.itemSizeCache=new Map(this.itemSizeCache.set(i.key,r)),this.notify(!1))},this.measureElement=n=>{if(!n){this.elementsCache.forEach((r,i)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(i))});return}this._measureElement(n,void 0)},this.getVirtualItems=Nt(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const i=[];for(let s=0,a=n.length;s<a;s++){const u=n[s],o=r[u];i.push(o)}return i},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length!==0)return Ss(r[Ru(0,r.length-1,i=>Ss(r[i]).start,n)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const n=this.scrollElement.document.documentElement;return this.options.horizontal?n.scrollWidth-this.scrollElement.innerWidth:n.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(n,r,i=0)=>{if(!this.scrollElement)return 0;const s=this.getSize(),a=this.getScrollOffset();r==="auto"&&(r=n>=a+s?"end":"start"),r==="center"?n+=(i-s)/2:r==="end"&&(n-=s);const u=this.getMaxScrollOffset();return Math.max(Math.min(u,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const i=this.measurementsCache[n];if(!i)return;const s=this.getSize(),a=this.getScrollOffset();if(r==="auto")if(i.end>=a+s-this.options.scrollPaddingEnd)r="end";else if(i.start<=a+this.options.scrollPaddingStart)r="start";else return[a,r];if(r==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),r];const u=r==="end"?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(u,r,i.size),r]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(n,{align:r="start",behavior:i}={})=>{i==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(n,r),{adjustments:void 0,behavior:i})},this.scrollToIndex=(n,{align:r="auto",behavior:i}={})=>{i==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),n=Math.max(0,Math.min(n,this.options.count-1)),this.currentScrollToIndex=n;let s=0;const a=10,u=c=>{if(!this.targetWindow)return;const d=this.getOffsetForIndex(n,c);if(!d){console.warn("Failed to get offset for index:",n);return}const[h,f]=d;this._scrollToOffset(h,{adjustments:void 0,behavior:i}),this.targetWindow.requestAnimationFrame(()=>{const m=()=>{if(this.currentScrollToIndex!==n)return;const b=this.getScrollOffset(),k=this.getOffsetForIndex(n,f);if(!k){console.warn("Failed to get offset for index:",n);return}Wd(k[0],b)||o(f)};this.isDynamicMode()?this.targetWindow.requestAnimationFrame(m):m()})},o=c=>{this.targetWindow&&this.currentScrollToIndex===n&&(s++,s<a?this.targetWindow.requestAnimationFrame(()=>u(c)):console.warn(`Failed to scroll to index ${n} after ${a} attempts.`))};u(r)},this.scrollBy=(n,{behavior:r}={})=>{r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+n,{adjustments:void 0,behavior:r})},this.getTotalSize=()=>{var n;const r=this.getMeasurements();let i;if(r.length===0)i=this.options.paddingStart;else if(this.options.lanes===1)i=((n=r[r.length-1])==null?void 0:n.end)??0;else{const s=Array(this.options.lanes).fill(null);let a=r.length-1;for(;a>=0&&s.some(u=>u===null);){const u=r[a];s[u.lane]===null&&(s[u.lane]=u.end),a--}i=Math.max(...s.filter(u=>u!==null))}return Math.max(i-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(n,{adjustments:r,behavior:i})=>{this.options.scrollToFn(n,{behavior:i,adjustments:r},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(t)}}const Ru=(e,t,n,r)=>{for(;e<=t;){const i=(e+t)/2|0,s=n(i);if(s<r)e=i+1;else if(s>r)t=i-1;else return i}return e>0?e-1:0};function nh({measurements:e,outerSize:t,scrollOffset:n,lanes:r}){const i=e.length-1,s=o=>e[o].start;if(e.length<=r)return{startIndex:0,endIndex:i};let a=Ru(0,i,s,n),u=a;if(r===1)for(;u<i&&e[u].end<n+t;)u++;else if(r>1){const o=Array(r).fill(0);for(;u<i&&o.some(d=>d<n+t);){const d=e[u];o[d.lane]=d.end,u++}const c=Array(r).fill(n+t);for(;a>=0&&c.some(d=>d>=n);){const d=e[a];c[d.lane]=d.start,a--}a=Math.max(0,a-a%r),u=Math.min(i,u+(r-1-u%r))}return{startIndex:a,endIndex:u}}const Ls=typeof document<"u"?y.useLayoutEffect:y.useEffect;function rh({useFlushSync:e=!0,...t}){const n=y.useReducer(()=>({}),{})[1],r={...t,onChange:(s,a)=>{var u;e&&a?ld.flushSync(n):n(),(u=t.onChange)==null||u.call(t,s,a)}},[i]=y.useState(()=>new th(r));return i.setOptions(r),Ls(()=>i._didMount(),[]),Ls(()=>i._willUpdate()),i}function ih(e){return rh({observeElementRect:Xd,observeElementOffset:Zd,scrollToFn:eh,...e})}function sh(e,t,n){const r=n,i=r.getScrollOffset()+r.scrollAdjustments;return e.end+t<=i}const mr=(function(e){if(e==null)return lh;if(typeof e=="function")return pr(e);if(typeof e=="object")return Array.isArray(e)?ah(e):uh(e);if(typeof e=="string")return oh(e);throw new Error("Expected function, string, or object as test")});function ah(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=mr(e[n]);return pr(r);function r(...i){let s=-1;for(;++s<t.length;)if(t[s].apply(this,i))return!0;return!1}}function uh(e){const t=e;return pr(n);function n(r){const i=r;let s;for(s in e)if(i[s]!==t[s])return!1;return!0}}function oh(e){return pr(t);function t(n){return n&&n.type===e}}function pr(e){return t;function t(n,r,i){return!!(ch(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function lh(){return!0}function ch(e){return e!==null&&typeof e=="object"&&"type"in e}const Ou=[],en=!0,ti=!1,Jn="skip";function wi(e,t,n,r){let i;typeof t=="function"&&typeof n!="function"?(r=n,n=t):i=t;const s=mr(i),a=r?-1:1;u(e,void 0,[])();function u(o,c,d){const h=o&&typeof o=="object"?o:{};if(typeof h.type=="string"){const m=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(o.type+(m?"<"+m+">":""))+")"})}return f;function f(){let m=Ou,b,k,S;if((!t||s(o,c,d[d.length-1]||void 0))&&(m=dh(n(o,d)),m[0]===ti))return m;if("children"in o&&o.children){const _=o;if(_.children&&m[0]!==Jn)for(k=(r?_.children.length:-1)+a,S=d.concat(_);k>-1&&k<_.children.length;){const L=_.children[k];if(b=u(L,k,S)(),b[0]===ti)return b;k=typeof b[1]=="number"?b[1]:k+a}}return m}}}function dh(e){return Array.isArray(e)?e:typeof e=="number"?[en,e]:e==null?Ou:[e]}function st(e,t,n,r){let i,s,a;typeof t=="function"&&typeof n!="function"?(s=void 0,a=t,i=n):(s=t,a=n,i=r),wi(e,s,u,i);function u(o,c){const d=c[c.length-1],h=d?d.children.indexOf(o):void 0;return a(o,h,d)}}function hh({defaultOrigin:e="",allowedLinkPrefixes:t=[],allowedImagePrefixes:n=[],allowDataImages:r=!1,allowedProtocols:i=[],blockedImageClass:s="inline-block bg-gray-200 dark:bg-gray-700 text-gray-600 dark:text-gray-400 px-3 py-1 rounded text-sm",blockedLinkClass:a="text-gray-500"}){const u=t.length&&!t.every(c=>c==="*"),o=n.length&&!n.every(c=>c==="*");if(!e&&(u||o))throw new Error("defaultOrigin is required when allowedLinkPrefixes or allowedImagePrefixes are provided");return c=>{const d=gh(e,t,n,r,i,s,a);st(c,d)}}function Rs(e,t){if(typeof e!="string")return null;try{return new URL(e)}catch{if(t)try{return new URL(e,t)}catch{return null}if(e.startsWith("/")||e.startsWith("./")||e.startsWith("../"))try{return new URL(e,"http://example.com")}catch{return null}return null}}function fh(e){return typeof e!="string"?!1:e.startsWith("/")||e.startsWith("./")||e.startsWith("../")}const mh=new Set(["https:","http:","irc:","ircs:","mailto:","xmpp:","blob:"]),ph=new Set(["javascript:","data:","file:","vbscript:"]);function Os(e,t,n,r=!1,i=!1,s=[]){if(!e)return null;if(typeof e=="string"&&e.startsWith("#")&&!i)try{if(new URL(e,"http://example.com").hash===e)return e}catch{}if(typeof e=="string"&&e.startsWith("data:"))return i&&r&&e.startsWith("data:image/")?e:null;if(typeof e=="string"&&e.startsWith("blob:")){try{if(new URL(e).protocol==="blob:"&&e.length>5){const d=e.substring(5);if(d&&d.length>0&&d!=="invalid")return e}}catch{return null}return null}const a=Rs(e,n);if(!a||ph.has(a.protocol)||!(mh.has(a.protocol)||s.includes(a.protocol)||s.includes("*")))return null;if(a.protocol==="mailto:"||!a.protocol.match(/^https?:$/))return a.href;const o=fh(e);return a&&t.some(c=>{const d=Rs(c,n);return!d||d.origin!==a.origin?!1:a.href.startsWith(d.href)})?o?a.pathname+a.search+a.hash:a.href:t.includes("*")?a.protocol!=="https:"&&a.protocol!=="http:"?null:o?a.pathname+a.search+a.hash:a.href:null}const Rr=Symbol("node-seen"),gh=(e,t,n,r,i,s,a)=>{const u=(o,c,d)=>{if(o.type!=="element"||o[Rr])return en;if(o.tagName==="a"){const h=Os(o.properties.href,t,e,!1,!1,i);return h===null?(o[Rr]=!0,st(o,u),d&&typeof c=="number"&&(d.children[c]={type:"element",tagName:"span",properties:{title:"Blocked URL: "+String(o.properties.href),class:a},children:[...o.children,{type:"text",value:" [blocked]"}]}),Jn):(o.properties.href=h,o.properties.target="_blank",o.properties.rel="noopener noreferrer",en)}if(o.tagName==="img"){const h=Os(o.properties.src,n,e,r,!0,i);return h===null?(o[Rr]=!0,st(o,u),d&&typeof c=="number"&&(d.children[c]={type:"element",tagName:"span",properties:{class:s},children:[{type:"text",value:"[Image blocked: "+String(o.properties.alt||"No description")+"]"}]}),Jn):(o.properties.src=h,en)}return en};return u},Du=-1,gr=0,rn=1,er=2,Li=3,Ri=4,Oi=5,Di=6,Pu=7,vu=8,Ds=typeof self=="object"?self:globalThis,bh=(e,t)=>{const n=(i,s)=>(e.set(s,i),i),r=i=>{if(e.has(i))return e.get(i);const[s,a]=t[i];switch(s){case gr:case Du:return n(a,i);case rn:{const u=n([],i);for(const o of a)u.push(r(o));return u}case er:{const u=n({},i);for(const[o,c]of a)u[r(o)]=r(c);return u}case Li:return n(new Date(a),i);case Ri:{const{source:u,flags:o}=a;return n(new RegExp(u,o),i)}case Oi:{const u=n(new Map,i);for(const[o,c]of a)u.set(r(o),r(c));return u}case Di:{const u=n(new Set,i);for(const o of a)u.add(r(o));return u}case Pu:{const{name:u,message:o}=a;return n(new Ds[u](o),i)}case vu:return n(BigInt(a),i);case"BigInt":return n(Object(BigInt(a)),i);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:u}=new Uint8Array(a);return n(new DataView(u),a)}}return n(new Ds[s](a),i)};return r},Ps=e=>bh(new Map,e)(0),It="",{toString:Eh}={},{keys:Th}=Object,Vt=e=>{const t=typeof e;if(t!=="object"||!e)return[gr,t];const n=Eh.call(e).slice(8,-1);switch(n){case"Array":return[rn,It];case"Object":return[er,It];case"Date":return[Li,It];case"RegExp":return[Ri,It];case"Map":return[Oi,It];case"Set":return[Di,It];case"DataView":return[rn,n]}return n.includes("Array")?[rn,n]:n.includes("Error")?[Pu,n]:[er,n]},vn=([e,t])=>e===gr&&(t==="function"||t==="symbol"),xh=(e,t,n,r)=>{const i=(a,u)=>{const o=r.push(a)-1;return n.set(u,o),o},s=a=>{if(n.has(a))return n.get(a);let[u,o]=Vt(a);switch(u){case gr:{let d=a;switch(o){case"bigint":u=vu,d=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+o);d=null;break;case"undefined":return i([Du],a)}return i([u,d],a)}case rn:{if(o){let f=a;return o==="DataView"?f=new Uint8Array(a.buffer):o==="ArrayBuffer"&&(f=new Uint8Array(a)),i([o,[...f]],a)}const d=[],h=i([u,d],a);for(const f of a)d.push(s(f));return h}case er:{if(o)switch(o){case"BigInt":return i([o,a.toString()],a);case"Boolean":case"Number":case"String":return i([o,a.valueOf()],a)}if(t&&"toJSON"in a)return s(a.toJSON());const d=[],h=i([u,d],a);for(const f of Th(a))(e||!vn(Vt(a[f])))&&d.push([s(f),s(a[f])]);return h}case Li:return i([u,a.toISOString()],a);case Ri:{const{source:d,flags:h}=a;return i([u,{source:d,flags:h}],a)}case Oi:{const d=[],h=i([u,d],a);for(const[f,m]of a)(e||!(vn(Vt(f))||vn(Vt(m))))&&d.push([s(f),s(m)]);return h}case Di:{const d=[],h=i([u,d],a);for(const f of a)(e||!vn(Vt(f)))&&d.push(s(f));return h}}const{message:c}=a;return i([u,{name:o,message:c}],a)};return s},vs=(e,{json:t,lossy:n}={})=>{const r=[];return xh(!(t||n),!!t,new Map,r)(e),r},gt=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Ps(vs(e,t)):structuredClone(e):(e,t)=>Ps(vs(e,t));class _n{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}_n.prototype.normal={};_n.prototype.property={};_n.prototype.space=void 0;function Mu(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new _n(n,r,t)}function gn(e){return e.toLowerCase()}class Se{constructor(t,n){this.attribute=n,this.property=t}}Se.prototype.attribute="";Se.prototype.booleanish=!1;Se.prototype.boolean=!1;Se.prototype.commaOrSpaceSeparated=!1;Se.prototype.commaSeparated=!1;Se.prototype.defined=!1;Se.prototype.mustUseProperty=!1;Se.prototype.number=!1;Se.prototype.overloadedBoolean=!1;Se.prototype.property="";Se.prototype.spaceSeparated=!1;Se.prototype.space=void 0;let kh=0;const Z=xt(),me=xt(),ni=xt(),M=xt(),ce=xt(),Dt=xt(),we=xt();function xt(){return 2**++kh}const ri=Object.freeze(Object.defineProperty({__proto__:null,boolean:Z,booleanish:me,commaOrSpaceSeparated:we,commaSeparated:Dt,number:M,overloadedBoolean:ni,spaceSeparated:ce},Symbol.toStringTag,{value:"Module"})),Or=Object.keys(ri);class Pi extends Se{constructor(t,n,r,i){let s=-1;if(super(t,n),Ms(this,"space",i),typeof r=="number")for(;++s<Or.length;){const a=Or[s];Ms(this,Or[s],(r&ri[a])===ri[a])}}}Pi.prototype.defined=!0;function Ms(e,t,n){n&&(e[t]=n)}function Ft(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const s=new Pi(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[gn(r)]=r,n[gn(s.attribute)]=r}return new _n(t,n,e.space)}const Bu=Ft({properties:{ariaActiveDescendant:null,ariaAtomic:me,ariaAutoComplete:null,ariaBusy:me,ariaChecked:me,ariaColCount:M,ariaColIndex:M,ariaColSpan:M,ariaControls:ce,ariaCurrent:null,ariaDescribedBy:ce,ariaDetails:null,ariaDisabled:me,ariaDropEffect:ce,ariaErrorMessage:null,ariaExpanded:me,ariaFlowTo:ce,ariaGrabbed:me,ariaHasPopup:null,ariaHidden:me,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ce,ariaLevel:M,ariaLive:null,ariaModal:me,ariaMultiLine:me,ariaMultiSelectable:me,ariaOrientation:null,ariaOwns:ce,ariaPlaceholder:null,ariaPosInSet:M,ariaPressed:me,ariaReadOnly:me,ariaRelevant:null,ariaRequired:me,ariaRoleDescription:ce,ariaRowCount:M,ariaRowIndex:M,ariaRowSpan:M,ariaSelected:me,ariaSetSize:M,ariaSort:null,ariaValueMax:M,ariaValueMin:M,ariaValueNow:M,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Fu(e,t){return t in e?e[t]:t}function Hu(e,t){return Fu(e,t.toLowerCase())}const yh=Ft({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Dt,acceptCharset:ce,accessKey:ce,action:null,allow:null,allowFullScreen:Z,allowPaymentRequest:Z,allowUserMedia:Z,alt:null,as:null,async:Z,autoCapitalize:null,autoComplete:ce,autoFocus:Z,autoPlay:Z,blocking:ce,capture:null,charSet:null,checked:Z,cite:null,className:ce,cols:M,colSpan:null,content:null,contentEditable:me,controls:Z,controlsList:ce,coords:M|Dt,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Z,defer:Z,dir:null,dirName:null,disabled:Z,download:ni,draggable:me,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Z,formTarget:null,headers:ce,height:M,hidden:ni,high:M,href:null,hrefLang:null,htmlFor:ce,httpEquiv:ce,id:null,imageSizes:null,imageSrcSet:null,inert:Z,inputMode:null,integrity:null,is:null,isMap:Z,itemId:null,itemProp:ce,itemRef:ce,itemScope:Z,itemType:ce,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Z,low:M,manifest:null,max:null,maxLength:M,media:null,method:null,min:null,minLength:M,multiple:Z,muted:Z,name:null,nonce:null,noModule:Z,noValidate:Z,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:Z,optimum:M,pattern:null,ping:ce,placeholder:null,playsInline:Z,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Z,referrerPolicy:null,rel:ce,required:Z,reversed:Z,rows:M,rowSpan:M,sandbox:ce,scope:null,scoped:Z,seamless:Z,selected:Z,shadowRootClonable:Z,shadowRootDelegatesFocus:Z,shadowRootMode:null,shape:null,size:M,sizes:null,slot:null,span:M,spellCheck:me,src:null,srcDoc:null,srcLang:null,srcSet:null,start:M,step:null,style:null,tabIndex:M,target:null,title:null,translate:null,type:null,typeMustMatch:Z,useMap:null,value:me,width:M,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ce,axis:null,background:null,bgColor:null,border:M,borderColor:null,bottomMargin:M,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Z,declare:Z,event:null,face:null,frame:null,frameBorder:null,hSpace:M,leftMargin:M,link:null,longDesc:null,lowSrc:null,marginHeight:M,marginWidth:M,noResize:Z,noHref:Z,noShade:Z,noWrap:Z,object:null,profile:null,prompt:null,rev:null,rightMargin:M,rules:null,scheme:null,scrolling:me,standby:null,summary:null,text:null,topMargin:M,valueType:null,version:null,vAlign:null,vLink:null,vSpace:M,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Z,disableRemotePlayback:Z,prefix:null,property:null,results:M,security:null,unselectable:null},space:"html",transform:Hu}),Ah=Ft({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:we,accentHeight:M,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:M,amplitude:M,arabicForm:null,ascent:M,attributeName:null,attributeType:null,azimuth:M,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:M,by:null,calcMode:null,capHeight:M,className:ce,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:M,diffuseConstant:M,direction:null,display:null,dur:null,divisor:M,dominantBaseline:null,download:Z,dx:null,dy:null,edgeMode:null,editable:null,elevation:M,enableBackground:null,end:null,event:null,exponent:M,externalResourcesRequired:null,fill:null,fillOpacity:M,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:Dt,g2:Dt,glyphName:Dt,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:M,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:M,horizOriginX:M,horizOriginY:M,id:null,ideographic:M,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:M,k:M,k1:M,k2:M,k3:M,k4:M,kernelMatrix:we,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:M,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:M,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:M,overlineThickness:M,paintOrder:null,panose1:null,path:null,pathLength:M,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ce,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:M,pointsAtY:M,pointsAtZ:M,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:we,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:we,rev:we,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:we,requiredFeatures:we,requiredFonts:we,requiredFormats:we,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:M,specularExponent:M,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:M,strikethroughThickness:M,string:null,stroke:null,strokeDashArray:we,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:M,strokeOpacity:M,strokeWidth:null,style:null,surfaceScale:M,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:we,tabIndex:M,tableValues:null,target:null,targetX:M,targetY:M,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:we,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:M,underlineThickness:M,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:M,values:null,vAlphabetic:M,vMathematical:M,vectorEffect:null,vHanging:M,vIdeographic:M,version:null,vertAdvY:M,vertOriginX:M,vertOriginY:M,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:M,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Fu}),Uu=Ft({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()}}),ju=Ft({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Hu}),zu=Ft({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),_h={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"},Ch=/[A-Z]/g,Bs=/-[a-z]/g,Sh=/^data[-\w.:]+$/i;function br(e,t){const n=gn(t);let r=t,i=Se;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Sh.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(Bs,Ih);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!Bs.test(s)){let a=s.replace(Ch,Nh);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}i=Pi}return new i(r,t)}function Nh(e){return"-"+e.toLowerCase()}function Ih(e){return e.charAt(1).toUpperCase()}const Cn=Mu([Bu,yh,Uu,ju,zu],"html"),ut=Mu([Bu,Ah,Uu,ju,zu],"svg");function Fs(e){const t=[],n=String(e||"");let r=n.indexOf(","),i=0,s=!1;for(;!s;){r===-1&&(r=n.length,s=!0);const a=n.slice(i,r).trim();(a||!s)&&t.push(a),i=r+1,r=n.indexOf(",",i)}return t}function $u(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Hs=/[#.]/g;function wh(e,t){const n=e||"",r={};let i=0,s,a;for(;i<n.length;){Hs.lastIndex=i;const u=Hs.exec(n),o=n.slice(i,u?u.index:n.length);o&&(s?s==="#"?r.id=o:Array.isArray(r.className)?r.className.push(o):r.className=[o]:a=o,i+=o.length),u&&(s=u[0],i++)}return{type:"element",tagName:a||t||"div",properties:r,children:[]}}function Us(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function qu(e){return e.join(" ").trim()}function Yu(e,t,n){const r=n?Dh(n):void 0;function i(s,a,...u){let o;if(s==null){o={type:"root",children:[]};const c=a;u.unshift(c)}else{o=wh(s,t);const c=o.tagName.toLowerCase(),d=r?r.get(c):void 0;if(o.tagName=d||c,Lh(a))u.unshift(a);else for(const[h,f]of Object.entries(a))Rh(e,o.properties,h,f)}for(const c of u)ii(o.children,c);return o.type==="element"&&o.tagName==="template"&&(o.content={type:"root",children:o.children},o.children=[]),o}return i}function Lh(e){if(e===null||typeof e!="object"||Array.isArray(e))return!0;if(typeof e.type!="string")return!1;const t=e,n=Object.keys(e);for(const r of n){const i=t[r];if(i&&typeof i=="object"){if(!Array.isArray(i))return!0;const s=i;for(const a of s)if(typeof a!="number"&&typeof a!="string")return!0}}return!!("children"in e&&Array.isArray(e.children))}function Rh(e,t,n,r){const i=br(e,n);let s;if(r!=null){if(typeof r=="number"){if(Number.isNaN(r))return;s=r}else typeof r=="boolean"?s=r:typeof r=="string"?i.spaceSeparated?s=Us(r):i.commaSeparated?s=Fs(r):i.commaOrSpaceSeparated?s=Us(Fs(r).join(" ")):s=js(i,i.property,r):Array.isArray(r)?s=[...r]:s=i.property==="style"?Oh(r):String(r);if(Array.isArray(s)){const a=[];for(const u of s)a.push(js(i,i.property,u));s=a}i.property==="className"&&Array.isArray(t.className)&&(s=t.className.concat(s)),t[i.property]=s}}function ii(e,t){if(t!=null)if(typeof t=="number"||typeof t=="string")e.push({type:"text",value:String(t)});else if(Array.isArray(t))for(const n of t)ii(e,n);else if(typeof t=="object"&&"type"in t)t.type==="root"?ii(e,t.children):e.push(t);else throw new Error("Expected node, nodes, or string, got `"+t+"`")}function js(e,t,n){if(typeof n=="string"){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(n===""||gn(n)===gn(t)))return!0}return n}function Oh(e){const t=[];for(const[n,r]of Object.entries(e))t.push([n,r].join(": "));return t.join("; ")}function Dh(e){const t=new Map;for(const n of e)t.set(n.toLowerCase(),n);return t}const Ph=["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","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","foreignObject","glyphRef","linearGradient","radialGradient","solidColor","textArea","textPath"],vh=Yu(Cn,"div"),Mh=Yu(ut,"g",Ph);function Bh(e){const t=String(e),n=[];return{toOffset:i,toPoint:r};function r(s){if(typeof s=="number"&&s>-1&&s<=t.length){let a=0;for(;;){let u=n[a];if(u===void 0){const o=zs(t,n[a-1]);u=o===-1?t.length+1:o+1,n[a]=u}if(u>s)return{line:a+1,column:s-(a>0?n[a-1]:0)+1,offset:s};a++}}}function i(s){if(s&&typeof s.line=="number"&&typeof s.column=="number"&&!Number.isNaN(s.line)&&!Number.isNaN(s.column)){for(;n.length<s.line;){const u=n[n.length-1],o=zs(t,u),c=o===-1?t.length+1:o+1;if(u===c)break;n.push(c)}const a=(s.line>1?n[s.line-2]:0)+s.column-1;if(a<n[s.line-1])return a}}}function zs(e,t){const n=e.indexOf("\r",t),r=e.indexOf(`
@@ -116,8 +116,8 @@ Please report this to https://github.com/markedjs/marked.`,t){let i="<p>An error
116
116
  `||d==="\r"){o=!0;break}if(!o)return u;let c=[];for(let d of u)d===" "?c.push("\\t"):d===`
117
117
  `?c.push("\\n"):d==="\r"?c.push("\\r"):c.push(d);return c.join("")},i=t.length>0?n.length+1:n.length,s=new Array(i),a=0;t.length>0&&(s[a]=t.map(r).join(" "),a+=1);for(let u of n)s[a]=u.map(r).join(" "),a+=1;return s.join(`
118
118
  `)},Zr=e=>{let t=!1;for(let r of e)if(r==="\\"||r==="|"){t=!0;break}if(!t)return e;let n=[];for(let r of e)r==="\\"?n.push("\\\\"):r==="|"?n.push("\\|"):n.push(r);return n.join("")},lk=e=>{let{headers:t,rows:n}=e;if(t.length===0)return"";let r=new Array(n.length+2),i=0,s=t.map(u=>Zr(u));r[i]=`| ${s.join(" | ")} |`,i+=1;let a=new Array(t.length);for(let u=0;u<t.length;u+=1)a[u]="---";r[i]=`| ${a.join(" | ")} |`,i+=1;for(let u of n)if(u.length<t.length){let o=new Array(t.length);for(let c=0;c<t.length;c+=1)o[c]=c<u.length?Zr(u[c]):"";r[i]=`| ${o.join(" | ")} |`,i+=1}else{let o=u.map(c=>Zr(c));r[i]=`| ${o.join(" | ")} |`,i+=1}return r.join(`
119
- `)},ck=({children:e,className:t,onCopy:n,onError:r,timeout:i=2e3})=>{let[s,a]=y.useState(!1),[u,o]=y.useState(!1),c=y.useRef(null),d=y.useRef(0),{isAnimating:h}=y.useContext(Pe),f=async b=>{var k,S;if(typeof window>"u"||!((k=navigator?.clipboard)!=null&&k.write)){r?.(new Error("Clipboard API not available"));return}try{let _=(S=c.current)==null?void 0:S.closest('[data-streamdown="table-wrapper"]'),L=_?.querySelector("table");if(!L){r?.(new Error("Table not found"));return}let I=Vl(L),B=b==="csv"?Wl(I):ok(I),z=new ClipboardItem({"text/plain":new Blob([B],{type:"text/plain"}),"text/html":new Blob([L.outerHTML],{type:"text/html"})});await navigator.clipboard.write([z]),o(!0),a(!1),n?.(b),d.current=window.setTimeout(()=>o(!1),i)}catch(_){r?.(_)}};y.useEffect(()=>{let b=k=>{let S=k.composedPath();c.current&&!S.includes(c.current)&&a(!1)};return document.addEventListener("mousedown",b),()=>{document.removeEventListener("mousedown",b),window.clearTimeout(d.current)}},[]);let m=u?us:os;return p.jsxs("div",{className:"relative",ref:c,children:[p.jsx("button",{className:Q("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:h,onClick:()=>a(!s),title:"Copy table",type:"button",children:e??p.jsx(m,{size:14})}),s?p.jsxs("div",{className:"absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg",children:[p.jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>f("csv"),title:"Copy table as CSV",type:"button",children:"CSV"}),p.jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>f("tsv"),title:"Copy table as TSV",type:"button",children:"TSV"})]}):null]})},dk=({children:e,className:t,onDownload:n,onError:r})=>{let[i,s]=y.useState(!1),a=y.useRef(null),{isAnimating:u}=y.useContext(Pe),o=c=>{var d;try{let h=(d=a.current)==null?void 0:d.closest('[data-streamdown="table-wrapper"]'),f=h?.querySelector("table");if(!f){r?.(new Error("Table not found"));return}let m=Vl(f),b=c==="csv"?Wl(m):lk(m);Pt(`table.${c==="csv"?"csv":"md"}`,b,c==="csv"?"text/csv":"text/markdown"),s(!1),n?.(c)}catch(h){r?.(h)}};return y.useEffect(()=>{let c=d=>{let h=d.composedPath();a.current&&!h.includes(a.current)&&s(!1)};return document.addEventListener("mousedown",c),()=>{document.removeEventListener("mousedown",c)}},[]),p.jsxs("div",{className:"relative",ref:a,children:[p.jsx("button",{className:Q("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:u,onClick:()=>s(!i),title:"Download table",type:"button",children:e??p.jsx(Ir,{size:14})}),i?p.jsxs("div",{className:"absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg",children:[p.jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>o("csv"),title:"Download table as CSV",type:"button",children:"CSV"}),p.jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>o("markdown"),title:"Download table as Markdown",type:"button",children:"Markdown"})]}):null]})},hk=({children:e,className:t,showControls:n,...r})=>p.jsxs("div",{className:"my-4 flex flex-col space-y-2","data-streamdown":"table-wrapper",children:[n?p.jsxs("div",{className:"flex items-center justify-end gap-1",children:[p.jsx(ck,{}),p.jsx(dk,{})]}):null,p.jsx("div",{className:"overflow-x-auto overscroll-y-auto",children:p.jsx("table",{className:Q("w-full border-collapse border border-border",t),"data-streamdown":"table",...r,children:e})})]}),fk=y.lazy(()=>Ii(()=>import("./code-block-OCS4YCEC-CBIOQOMH.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])).then(e=>({default:e.CodeBlock}))),mk=y.lazy(()=>Ii(()=>Promise.resolve().then(()=>Y3),void 0).then(e=>({default:e.Mermaid}))),pk=/language-([^\s]+)/;function wr(e,t){if(!(e!=null&&e.position||t!=null&&t.position))return!0;if(!(e!=null&&e.position&&t!=null&&t.position))return!1;let n=e.position.start,r=t.position.start,i=e.position.end,s=t.position.end;return n?.line===r?.line&&n?.column===r?.column&&i?.line===s?.line&&i?.column===s?.column}function he(e,t){return e.className===t.className&&wr(e.node,t.node)}var yi=(e,t)=>typeof e=="boolean"?e:e[t]!==!1,jn=(e,t)=>{if(typeof e=="boolean")return e;let n=e.mermaid;return n===!1?!1:n===!0||n===void 0?!0:n[t]!==!1},cs=y.memo(({children:e,className:t,node:n,...r})=>p.jsx("ol",{className:Q("list-inside list-decimal whitespace-normal [li_&]:pl-6",t),"data-streamdown":"ordered-list",...r,children:e}),(e,t)=>he(e,t));cs.displayName="MarkdownOl";var Gl=y.memo(({children:e,className:t,node:n,...r})=>p.jsx("li",{className:Q("py-1 [&>p]:inline",t),"data-streamdown":"list-item",...r,children:e}),(e,t)=>e.className===t.className&&wr(e.node,t.node));Gl.displayName="MarkdownLi";var Ql=y.memo(({children:e,className:t,node:n,...r})=>p.jsx("ul",{className:Q("list-inside list-disc whitespace-normal [li_&]:pl-6",t),"data-streamdown":"unordered-list",...r,children:e}),(e,t)=>he(e,t));Ql.displayName="MarkdownUl";var Kl=y.memo(({className:e,node:t,...n})=>p.jsx("hr",{className:Q("my-6 border-border",e),"data-streamdown":"horizontal-rule",...n}),(e,t)=>he(e,t));Kl.displayName="MarkdownHr";var Xl=y.memo(({children:e,className:t,node:n,...r})=>p.jsx("span",{className:Q("font-semibold",t),"data-streamdown":"strong",...r,children:e}),(e,t)=>he(e,t));Xl.displayName="MarkdownStrong";var gk=({children:e,className:t,href:n,node:r,...i})=>{let{linkSafety:s}=y.useContext(Pe),[a,u]=y.useState(!1),o=n==="streamdown:incomplete-link",c=y.useCallback(async m=>{if(!(!(s!=null&&s.enabled&&n)||o)){if(m.preventDefault(),s.onLinkCheck&&await s.onLinkCheck(n)){window.open(n,"_blank","noreferrer");return}u(!0)}},[s,n,o]),d=y.useCallback(()=>{n&&window.open(n,"_blank","noreferrer")},[n]),h=y.useCallback(()=>{u(!1)},[]),f={url:n??"",isOpen:a,onClose:h,onConfirm:d};return s!=null&&s.enabled&&n?p.jsxs(p.Fragment,{children:[p.jsx("button",{className:Q("wrap-anywhere appearance-none text-left font-medium text-primary underline",t),"data-incomplete":o,"data-streamdown":"link",onClick:c,type:"button",children:e}),s.renderModal?s.renderModal(f):p.jsx(nk,{...f})]}):p.jsx("a",{className:Q("wrap-anywhere font-medium text-primary underline",t),"data-incomplete":o,"data-streamdown":"link",href:n,rel:"noreferrer",target:"_blank",...i,children:e})},Zl=y.memo(gk,(e,t)=>he(e,t)&&e.href===t.href);Zl.displayName="MarkdownA";var Jl=y.memo(({children:e,className:t,node:n,...r})=>p.jsx("h1",{className:Q("mt-6 mb-2 font-semibold text-3xl",t),"data-streamdown":"heading-1",...r,children:e}),(e,t)=>he(e,t));Jl.displayName="MarkdownH1";var ec=y.memo(({children:e,className:t,node:n,...r})=>p.jsx("h2",{className:Q("mt-6 mb-2 font-semibold text-2xl",t),"data-streamdown":"heading-2",...r,children:e}),(e,t)=>he(e,t));ec.displayName="MarkdownH2";var tc=y.memo(({children:e,className:t,node:n,...r})=>p.jsx("h3",{className:Q("mt-6 mb-2 font-semibold text-xl",t),"data-streamdown":"heading-3",...r,children:e}),(e,t)=>he(e,t));tc.displayName="MarkdownH3";var nc=y.memo(({children:e,className:t,node:n,...r})=>p.jsx("h4",{className:Q("mt-6 mb-2 font-semibold text-lg",t),"data-streamdown":"heading-4",...r,children:e}),(e,t)=>he(e,t));nc.displayName="MarkdownH4";var rc=y.memo(({children:e,className:t,node:n,...r})=>p.jsx("h5",{className:Q("mt-6 mb-2 font-semibold text-base",t),"data-streamdown":"heading-5",...r,children:e}),(e,t)=>he(e,t));rc.displayName="MarkdownH5";var ic=y.memo(({children:e,className:t,node:n,...r})=>p.jsx("h6",{className:Q("mt-6 mb-2 font-semibold text-sm",t),"data-streamdown":"heading-6",...r,children:e}),(e,t)=>he(e,t));ic.displayName="MarkdownH6";var sc=y.memo(({children:e,className:t,node:n,...r})=>{let{controls:i}=y.useContext(Pe),s=yi(i,"table");return p.jsx(hk,{className:t,showControls:s,...r,children:e})},(e,t)=>he(e,t));sc.displayName="MarkdownTable";var ac=y.memo(({children:e,className:t,node:n,...r})=>p.jsx("thead",{className:Q("bg-muted/80",t),"data-streamdown":"table-header",...r,children:e}),(e,t)=>he(e,t));ac.displayName="MarkdownThead";var uc=y.memo(({children:e,className:t,node:n,...r})=>p.jsx("tbody",{className:Q("divide-y divide-border bg-muted/40",t),"data-streamdown":"table-body",...r,children:e}),(e,t)=>he(e,t));uc.displayName="MarkdownTbody";var oc=y.memo(({children:e,className:t,node:n,...r})=>p.jsx("tr",{className:Q("border-border border-b",t),"data-streamdown":"table-row",...r,children:e}),(e,t)=>he(e,t));oc.displayName="MarkdownTr";var lc=y.memo(({children:e,className:t,node:n,...r})=>p.jsx("th",{className:Q("whitespace-nowrap px-4 py-2 text-left font-semibold text-sm",t),"data-streamdown":"table-header-cell",...r,children:e}),(e,t)=>he(e,t));lc.displayName="MarkdownTh";var cc=y.memo(({children:e,className:t,node:n,...r})=>p.jsx("td",{className:Q("px-4 py-2 text-sm",t),"data-streamdown":"table-cell",...r,children:e}),(e,t)=>he(e,t));cc.displayName="MarkdownTd";var dc=y.memo(({children:e,className:t,node:n,...r})=>p.jsx("blockquote",{className:Q("my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic",t),"data-streamdown":"blockquote",...r,children:e}),(e,t)=>he(e,t));dc.displayName="MarkdownBlockquote";var hc=y.memo(({children:e,className:t,node:n,...r})=>p.jsx("sup",{className:Q("text-sm",t),"data-streamdown":"superscript",...r,children:e}),(e,t)=>he(e,t));hc.displayName="MarkdownSup";var fc=y.memo(({children:e,className:t,node:n,...r})=>p.jsx("sub",{className:Q("text-sm",t),"data-streamdown":"subscript",...r,children:e}),(e,t)=>he(e,t));fc.displayName="MarkdownSub";var mc=y.memo(({children:e,className:t,node:n,...r})=>{if("data-footnotes"in r){let i=a=>{var u,o;if(!y.isValidElement(a))return!1;let c=Array.isArray(a.props.children)?a.props.children:[a.props.children],d=!1,h=!1;for(let f of c)if(f){if(typeof f=="string")f.trim()!==""&&(d=!0);else if(y.isValidElement(f))if(((u=f.props)==null?void 0:u["data-footnote-backref"])!==void 0)h=!0;else{let m=Array.isArray(f.props.children)?f.props.children:[f.props.children];for(let b of m){if(typeof b=="string"&&b.trim()!==""){d=!0;break}if(y.isValidElement(b)&&((o=b.props)==null?void 0:o["data-footnote-backref"])===void 0){d=!0;break}}}}return h&&!d},s=Array.isArray(e)?e.map(a=>{if(!y.isValidElement(a))return a;if(a.type===cs){let u=(Array.isArray(a.props.children)?a.props.children:[a.props.children]).filter(o=>!i(o));return u.length===0?null:{...a,props:{...a.props,children:u}}}return a}):e;return(Array.isArray(s)?s.some(a=>a!==null):s!==null)?p.jsx("section",{className:t,...r,children:s}):null}return p.jsx("section",{className:t,...r,children:e})},(e,t)=>he(e,t));mc.displayName="MarkdownSection";var bk=({node:e,className:t,children:n,...r})=>{var i;let s=!("data-block"in r),{mermaid:a,controls:u}=y.useContext(Pe),o=ls();if(s)return p.jsx("code",{className:Q("rounded bg-muted px-1.5 py-0.5 font-mono text-sm",t),"data-streamdown":"inline-code",...r,children:n});let c=t?.match(pk),d=(i=c?.at(1))!=null?i:"",h="";if(y.isValidElement(n)&&n.props&&typeof n.props=="object"&&"children"in n.props&&typeof n.props.children=="string"?h=n.props.children:typeof n=="string"&&(h=n),d==="mermaid"&&o){let m=yi(u,"mermaid"),b=jn(u,"download"),k=jn(u,"copy"),S=jn(u,"fullscreen"),_=jn(u,"panZoom"),L=m&&(b||k||S);return p.jsx(y.Suspense,{fallback:p.jsx(tu,{}),children:p.jsxs("div",{className:Q("group relative my-4 h-auto rounded-xl border p-4",t),"data-streamdown":"mermaid-block",children:[L?p.jsxs("div",{className:"flex items-center justify-end gap-2",children:[b?p.jsx(ik,{chart:h,config:a?.config}):null,k?p.jsx(Ja,{code:h}):null,S?p.jsx(uk,{chart:h,config:a?.config}):null]}):null,p.jsx(mk,{chart:h,config:a?.config,showControls:_})]})})}let f=yi(u,"code");return p.jsx(y.Suspense,{fallback:p.jsx(tu,{}),children:p.jsx(fk,{className:Q("overflow-x-auto border-border border-t",t),code:h,language:d,children:f?p.jsxs(p.Fragment,{children:[p.jsx(Xx,{code:h,language:d}),p.jsx(Ja,{})]}):null})})},pc=y.memo(bk,(e,t)=>e.className===t.className&&wr(e.node,t.node));pc.displayName="MarkdownCode";var gc=y.memo(Jx,(e,t)=>e.className===t.className&&wr(e.node,t.node));gc.displayName="MarkdownImg";var bc=y.memo(({children:e,className:t,node:n,...r})=>{let i=(Array.isArray(e)?e:[e]).filter(s=>s!=null&&s!=="");if(i.length===1&&y.isValidElement(i[0])){let s=i[0].props.node,a=s?.tagName;if(a==="img")return p.jsx(p.Fragment,{children:e});if(a==="code"&&"data-block"in i[0].props)return p.jsx(p.Fragment,{children:e})}return p.jsx("p",{className:t,...r,children:e})},(e,t)=>he(e,t));bc.displayName="MarkdownParagraph";var Ek={ol:cs,li:Gl,ul:Ql,hr:Kl,strong:Xl,a:Zl,h1:Jl,h2:ec,h3:tc,h4:nc,h5:rc,h6:ic,table:sc,thead:ac,tbody:uc,tr:oc,th:lc,td:cc,blockquote:dc,code:pc,img:gc,pre:({children:e})=>y.isValidElement(e)?y.cloneElement(e,{"data-block":"true"}):e,sup:hc,sub:fc,p:bc,section:mc},Tk=()=>e=>{st(e,"html",(t,n,r)=>{!r||typeof n!="number"||(r.children[n]={type:"text",value:t.value})})},nu=[],ru={allowDangerousHtml:!0},zn=new WeakMap,xk=class{constructor(){this.cache=new Map,this.keyCache=new WeakMap,this.maxSize=100}generateCacheKey(e){let t=this.keyCache.get(e);if(t)return t;let n=e.rehypePlugins,r=e.remarkPlugins,i=e.remarkRehypeOptions;if(!(n||r||i)){let d="default";return this.keyCache.set(e,d),d}let s=d=>{if(!d||d.length===0)return"";let h="";for(let f=0;f<d.length;f+=1){let m=d[f];if(f>0&&(h+=","),Array.isArray(m)){let[b,k]=m;if(typeof b=="function"){let S=zn.get(b);S||(S=b.name,zn.set(b,S)),h+=S}else h+=String(b);h+=":",h+=JSON.stringify(k)}else if(typeof m=="function"){let b=zn.get(m);b||(b=m.name,zn.set(m,b)),h+=b}else h+=String(m)}return h},a=s(n),u=s(r),o=i?JSON.stringify(i):"",c=`${u}::${a}::${o}`;return this.keyCache.set(e,c),c}get(e){let t=this.generateCacheKey(e),n=this.cache.get(t);return n&&(this.cache.delete(t),this.cache.set(t,n)),n}set(e,t){let n=this.generateCacheKey(e);if(this.cache.size>=this.maxSize){let r=this.cache.keys().next().value;r&&this.cache.delete(r)}this.cache.set(n,t)}clear(){this.cache.clear()}},iu=new xk,Ec=e=>{let t=kk(e),n=e.children||"";return Ik(t.runSync(t.parse(n),n),e)},kk=e=>{let t=iu.get(e);if(t)return t;let n=Ak(e);return iu.set(e,n),n},yk=e=>e.some(t=>Array.isArray(t)?t[0]===li:t===li),Ak=e=>{let t=e.rehypePlugins||nu,n=e.remarkPlugins||nu,r=yk(t)?n:[...n,Tk],i=e.remarkRehypeOptions?{...ru,...e.remarkRehypeOptions}:ru;return V2().use(YT).use(r).use(N2,i).use(t)},_k=e=>e,Ck=(e,t,n,r)=>{n?e.children.splice(t,1):e.children[t]={type:"text",value:r}},Sk=(e,t)=>{var n;for(let r in $r)if(Object.hasOwn($r,r)&&Object.hasOwn(e.properties,r)){let i=e.properties[r],s=$r[r];(s===null||s.includes(e.tagName))&&(e.properties[r]=(n=t(String(i||""),r,e))!=null?n:void 0)}},Nk=(e,t,n,r,i,s)=>{let a=!1;return r?a=!r.includes(e.tagName):i&&(a=i.includes(e.tagName)),!a&&s&&typeof t=="number"&&(a=!s(e,t,n)),a},Ik=(e,t)=>{let{allowElement:n,allowedElements:r,disallowedElements:i,skipHtml:s,unwrapDisallowed:a,urlTransform:u}=t;if(n||r||i||s||u){let o=u||_k;st(e,(c,d,h)=>{if(c.type==="raw"&&h&&typeof d=="number")return Ck(h,d,s,c.value),d;if(c.type==="element"&&(Sk(c,o),Nk(c,d,h,r,i,n)&&h&&typeof d=="number"))return a&&c.children?h.children.splice(d,1,...c.children):h.children.splice(d,1),d})}return JE(e,{Fragment:p.Fragment,components:t.components,ignoreInvalidStyle:!0,jsx:p.jsx,jsxs:p.jsxs,passKeys:!0,passNode:!0})},wk=/\[\^[\w-]{1,200}\](?!:)/,Lk=/\[\^[\w-]{1,200}\]:/,Rk=/<\/(\w+)>/,Ok=/<(\w+)[\s>]/,Dk=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Pk=e=>{let t=0;for(let n=0;n<e.length-1;n+=1)e[n]==="$"&&e[n+1]==="$"&&(t+=1,n+=1);return t},vk=e=>{let t=wk.test(e),n=Lk.test(e);if(t||n)return[e];let r=De.lex(e,{gfm:!0}),i=[],s=[],a=!1;for(let u of r){let o=u.raw,c=i.length;if(s.length>0){if(i[c-1]+=o,u.type==="html"){let d=o.match(Rk);if(d){let h=d[1];s.at(-1)===h&&s.pop()}}continue}if(u.type==="html"&&u.block){let d=o.match(Ok);if(d){let h=d[1];o.includes(`</${h}>`)||Dk.has(h.toLowerCase())||s.push(h)}}if(c>0&&!a){let d=i[c-1];if(Pk(d)%2===1){i[c-1]=d+o;continue}}i.push(o),u.type!=="space"&&(a=u.type==="code")}return i},su,au,Gn={...cn,protocols:{...cn.protocols,href:[...(au=(su=cn.protocols)==null?void 0:su.href)!=null?au:[],"tel"]}},Ai={raw:li,sanitize:[Do,Gn],harden:[hh,{allowedImagePrefixes:["*"],allowedLinkPrefixes:["*"],allowedProtocols:["*"],defaultOrigin:void 0,allowDataImages:!0}]},Mk={gfm:[wb,{}]},uu=Object.values(Ai),Bk=Object.values(Mk),Fk={block:" ▋",circle:" ●"},Hk={shikiTheme:["github-light","github-dark"],controls:!0,isAnimating:!1,mode:"streaming",mermaid:void 0,linkSafety:{enabled:!0}},Pe=y.createContext(Hk),Tc=y.memo(({content:e,shouldParseIncompleteMarkdown:t,index:n,...r})=>p.jsx(Ec,{...r,children:e}),(e,t)=>{if(e.content!==t.content||e.index!==t.index)return!1;if(e.components!==t.components){let n=Object.keys(e.components||{}),r=Object.keys(t.components||{});if(n.length!==r.length||n.some(i=>{var s,a;return((s=e.components)==null?void 0:s[i])!==((a=t.components)==null?void 0:a[i])}))return!1}return!(e.rehypePlugins!==t.rehypePlugins||e.remarkPlugins!==t.remarkPlugins)});Tc.displayName="Block";var Uk=["github-light","github-dark"],xc=y.memo(({children:e,mode:t="streaming",parseIncompleteMarkdown:n=!0,components:r,rehypePlugins:i=uu,remarkPlugins:s=Bk,className:a,shikiTheme:u=Uk,mermaid:o,controls:c=!0,isAnimating:d=!1,animated:h,BlockComponent:f=Tc,parseMarkdownIntoBlocksFn:m=vk,caret:b,plugins:k,remend:S,linkSafety:_={enabled:!0},allowedTags:L,...I})=>{let B=y.useId(),[z,R]=y.useTransition(),$=y.useMemo(()=>typeof e!="string"?"":t==="streaming"&&n?BE(e,S):e,[e,t,n,S]),G=y.useMemo(()=>m($),[$,m]),[K,N]=y.useState(G);y.useEffect(()=>{t==="streaming"?R(()=>{N(G)}):N(G)},[G,t]);let U=t==="streaming"?K:G,v=y.useMemo(()=>U.map((re,x)=>`${B}-${x}`),[U.length,B]),V=y.useMemo(()=>h?h===!0?xi():xi(h):null,[h]),q=y.useMemo(()=>{var re,x;return{shikiTheme:(x=(re=k?.code)==null?void 0:re.getThemes())!=null?x:u,controls:c,isAnimating:d,mode:t,mermaid:o,linkSafety:_}},[u,c,d,t,o,_,k?.code]),j=y.useMemo(()=>({...Ek,...r}),[r]),F=y.useMemo(()=>{let re=[];return k!=null&&k.cjk&&(re=[...re,...k.cjk.remarkPluginsBefore]),re=[...re,...s],k!=null&&k.cjk&&(re=[...re,...k.cjk.remarkPluginsAfter]),k!=null&&k.math&&(re=[...re,k.math.remarkPlugin]),re},[s,k?.math,k?.cjk]),W=y.useMemo(()=>{var re;let x=i;if(L&&Object.keys(L).length>0&&i===uu){let Ne={...Gn,tagNames:[...(re=Gn.tagNames)!=null?re:[],...Object.keys(L)],attributes:{...Gn.attributes,...L}};x=[Ai.raw,[Do,Ne],Ai.harden]}return k!=null&&k.math&&(x=[...x,k.math.rehypePlugin]),V&&d&&(x=[...x,V.rehypePlugin]),x},[i,k?.math,V,d,L]),ue=y.useMemo(()=>b&&d?{"--streamdown-caret":`"${Fk[b]}"`}:void 0,[b,d]);return t==="static"?p.jsx(ki.Provider,{value:k??null,children:p.jsx(Pe.Provider,{value:q,children:p.jsx("div",{className:Q("space-y-4 whitespace-normal *:first:mt-0 *:last:mb-0",a),children:p.jsx(Ec,{components:j,rehypePlugins:W,remarkPlugins:F,...I,children:e})})})}):p.jsx(ki.Provider,{value:k??null,children:p.jsx(Pe.Provider,{value:q,children:p.jsxs("div",{className:Q("space-y-4 whitespace-normal *:first:mt-0 *:last:mb-0",b?"*:last:after:inline *:last:after:align-baseline *:last:after:content-[var(--streamdown-caret)]":null,a),style:ue,children:[U.length===0&&b&&d&&p.jsx("span",{}),U.map((re,x)=>p.jsx(f,{components:j,content:re,index:x,rehypePlugins:W,remarkPlugins:F,shouldParseIncompleteMarkdown:n,...I},v[x]))]})})})},(e,t)=>e.children===t.children&&e.shikiTheme===t.shikiTheme&&e.isAnimating===t.isAnimating&&e.animated===t.animated&&e.mode===t.mode&&e.plugins===t.plugins&&e.className===t.className&&e.linkSafety===t.linkSafety);xc.displayName="Streamdown";var jk=({children:e,className:t,minZoom:n=.5,maxZoom:r=3,zoomStep:i=.1,showControls:s=!0,initialZoom:a=1,fullscreen:u=!1})=>{let o=y.useRef(null),c=y.useRef(null),[d,h]=y.useState(a),[f,m]=y.useState({x:0,y:0}),[b,k]=y.useState(!1),[S,_]=y.useState({x:0,y:0}),[L,I]=y.useState({x:0,y:0}),B=y.useCallback(v=>{h(V=>Math.max(n,Math.min(r,V+v)))},[n,r]),z=y.useCallback(()=>{B(i)},[B,i]),R=y.useCallback(()=>{B(-i)},[B,i]),$=y.useCallback(()=>{h(a),m({x:0,y:0})},[a]),G=y.useCallback(v=>{v.preventDefault();let V=v.deltaY>0?-i:i;B(V)},[B,i]),K=y.useCallback(v=>{if(v.button!==0||v.isPrimary===!1)return;k(!0),_({x:v.clientX,y:v.clientY}),I(f);let V=v.currentTarget;V instanceof HTMLElement&&V.setPointerCapture(v.pointerId)},[f]),N=y.useCallback(v=>{if(!b)return;v.preventDefault();let V=v.clientX-S.x,q=v.clientY-S.y;m({x:L.x+V,y:L.y+q})},[b,S,L]),U=y.useCallback(v=>{k(!1);let V=v.currentTarget;V instanceof HTMLElement&&V.releasePointerCapture(v.pointerId)},[]);return y.useEffect(()=>{let v=o.current;if(v)return v.addEventListener("wheel",G,{passive:!1}),()=>{v.removeEventListener("wheel",G)}},[G]),y.useEffect(()=>{let v=c.current;if(v&&b)return document.body.style.userSelect="none",v.addEventListener("pointermove",N,{passive:!1}),v.addEventListener("pointerup",U),v.addEventListener("pointercancel",U),()=>{document.body.style.userSelect="",v.removeEventListener("pointermove",N),v.removeEventListener("pointerup",U),v.removeEventListener("pointercancel",U)}},[b,N,U]),p.jsxs("div",{className:Q("relative flex flex-col",u?"h-full w-full":"min-h-28 w-full",t),ref:o,style:{cursor:b?"grabbing":"grab"},children:[s?p.jsxs("div",{className:Q("absolute z-10 flex flex-col gap-1 rounded-md border border-border bg-background/90 p-1 shadow-sm backdrop-blur-sm",u?"bottom-4 left-4":"bottom-2 left-2"),children:[p.jsx("button",{className:"flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",disabled:d>=r,onClick:z,title:"Zoom in",type:"button",children:p.jsx(Gx,{size:16})}),p.jsx("button",{className:"flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",disabled:d<=n,onClick:R,title:"Zoom out",type:"button",children:p.jsx(Qx,{size:16})}),p.jsx("button",{className:"flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",onClick:$,title:"Reset zoom and pan",type:"button",children:p.jsx(Wx,{size:16})})]}):null,p.jsx("div",{className:Q("flex-1 origin-center transition-transform duration-150 ease-out",u?"flex h-full w-full items-center justify-center":"flex w-full items-center justify-center"),onPointerDown:K,ref:c,role:"application",style:{transform:`translate(${f.x}px, ${f.y}px) scale(${d})`,transformOrigin:"center center",touchAction:"none",willChange:"transform"},children:e})]})},kc=({chart:e,className:t,config:n,fullscreen:r=!1,showControls:i=!0})=>{let[s,a]=y.useState(null),[u,o]=y.useState(!1),[c,d]=y.useState(""),[h,f]=y.useState(""),[m,b]=y.useState(0),{mermaid:k}=y.useContext(Pe),S=ls(),_=k?.errorComponent,{shouldRender:L,containerRef:I}=Mx({immediate:r});if(y.useEffect(()=>{if(L){if(!S){a("Mermaid plugin not available. Please add the mermaid plugin to enable diagram rendering.");return}(async()=>{try{a(null),o(!0);let z=S.getMermaid(n),R=e.split("").reduce((K,N)=>(K<<5)-K+N.charCodeAt(0)|0,0),$=`mermaid-${Math.abs(R)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:G}=await z.render($,e);d(G),f(G)}catch(z){if(!(h||c)){let R=z instanceof Error?z.message:"Failed to render Mermaid chart";a(R)}}finally{o(!1)}})()}},[e,n,m,L,S]),!(L||c||h))return p.jsx("div",{className:Q("my-4 min-h-[200px]",t),ref:I});if(u&&!c&&!h)return p.jsx("div",{className:Q("my-4 flex justify-center p-4",t),ref:I,children:p.jsxs("div",{className:"flex items-center space-x-2 text-muted-foreground",children:[p.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-current border-b-2"}),p.jsx("span",{className:"text-sm",children:"Loading diagram..."})]})});if(s&&!c&&!h){let z=()=>b(R=>R+1);return _?p.jsx("div",{ref:I,children:p.jsx(_,{chart:e,error:s,retry:z})}):p.jsxs("div",{className:Q("rounded-lg border border-red-200 bg-red-50 p-4",t),ref:I,children:[p.jsxs("p",{className:"font-mono text-red-700 text-sm",children:["Mermaid Error: ",s]}),p.jsxs("details",{className:"mt-2",children:[p.jsx("summary",{className:"cursor-pointer text-red-600 text-xs",children:"Show Code"}),p.jsx("pre",{className:"mt-2 overflow-x-auto rounded bg-red-100 p-2 text-red-800 text-xs",children:e})]})]})}let B=c||h;return p.jsx("div",{className:Q("size-full",t),"data-streamdown":"mermaid",ref:I,children:p.jsx(jk,{className:Q(r?"size-full overflow-hidden":"my-4 overflow-hidden",t),fullscreen:r,maxZoom:3,minZoom:.5,showControls:i,zoomStep:.1,children:p.jsx("div",{"aria-label":"Mermaid chart",className:Q("flex justify-center",r?"size-full items-center":null),dangerouslySetInnerHTML:{__html:B},role:"img"})})})};function zk({content:e,children:t,className:n,side:r="top",align:i="center"}){return p.jsx(yd,{content:e,side:r,align:i,children:p.jsx("div",{className:kn("relative inline-block [&>:disabled]:pointer-events-none",n),children:t})})}const yc=/^[a-zA-Z]:[\\/]/,$k=/[/\\](attachments|conversations)[/\\]/,qk=/^\/(Users|home|tmp|private|var|opt|mnt|Volumes)(\/|$)/;function ou(e){return e.replace(/\\/g,"/").replace(/\/{2,}/g,"/")}function Yk(e){const t=e.match(/^(.*)#L([1-9]\d*)(?:C([1-9]\d*))?$/i);if(t)return{path:t[1],line:Number(t[2]),column:t[3]?Number(t[3]):void 0};const n=e.match(/^(.*?):(\d+)(?::(\d+))?$/);if(n&&n[1]){const r=Number(n[2]),i=n[3]?Number(n[3]):void 0;if(r>0&&(!n[3]||i&&i>0))return{path:n[1],line:r,column:i}}return{path:e}}function Vk(e,t){if(!t)return null;const n=ou(e),r=ou(t).replace(/\/$/,"");return n===r?null:n.startsWith(`${r}/`)?n.slice(r.length+1):n.startsWith("./")?n.slice(2):!n.startsWith("/")&&!yc.test(e)&&!n.startsWith("../")?n:null}function Wk(e){return`${yn()}/attachments/by-path?path=${encodeURIComponent(e)}`}function Ac(e,t){if(/^https?:\/\//i.test(e))return{type:"external",url:e};if(/^(mailto|tel):/i.test(e))return{type:"external",url:e};if(e.startsWith("/api/")||e.startsWith("#"))return{type:"internal",url:e};const n=Yk(e),r=Vk(n.path,t);return r?{type:"workspace-file",path:r,line:n.line,column:n.column}:$k.test(e)?{type:"attachment",path:e,url:Wk(e)}:qk.test(e)||yc.test(e)?{type:"unknown-local",path:e}:{type:"internal",url:e}}function Gk(e,t){const n=new URLSearchParams({workingDir:e,path:t});return`${yn()}/files/image?${n.toString()}`}function Qk(e){const t=new URLSearchParams({path:e});return`${yn()}/files/image?${t.toString()}`}const _c="/__agent-tower/message-intent/codex-inline-vis",Cc="/__agent-tower/message-intent/agent-download",Kk=/^[ \t]{0,3}::codex-inline-vis\{file="([^"\r\n]+)"\}[ \t]*$/,Sc=/^[a-z0-9][a-z0-9-]*\.html$/,Xk=/^[ \t]{0,3}(`{3,}|~{3,})/;function Zk(e,t){const n=t[0]==="`"?"`":"~";return new RegExp(`^[ \\t]{0,3}${n}{${t.length},}[ \\t]*$`).test(e)}function Jk(e){let t=null;return e.split(/\r?\n/).map(n=>{if(t)return Zk(n,t)&&(t=null),n;const r=n.match(Xk);if(r)return t=r[1],n;const i=n.match(Kk);if(i&&Sc.test(i[1])){const u=`${_c}?file=${encodeURIComponent(i[1])}`;return`[${i[1]}](${u})`}const s=Id(n);if(!s)return n;const a=`${Cc}?file=${encodeURIComponent(s)}`;return`[${s}](${a})`}).join(`
120
- `)}function e3(e){try{const t=new URL(e,"http://agent-tower.local"),n=t.searchParams.get("file");if(!n)return null;if(t.pathname===_c&&Sc.test(n))return{type:"codex-inline-visualization",file:n};if(t.pathname===Cc){const r=Nu(n);return r?{type:"agent-download",file:r}:null}return null}catch{return null}}function ty(e,t){return`${yn()}/sessions/${encodeURIComponent(e)}/visualizations/${encodeURIComponent(t)}`}function t3(e,t){const n=new URLSearchParams({path:t});return`${yn()}/sessions/${encodeURIComponent(e)}/artifacts/download?${n.toString()}`}const Nc=new Set(["localhost","127.0.0.1","::1","[::1]","0.0.0.0"]);function n3(e){return/^\d+$/.test(e)?`http://127.0.0.1:${e}`:/^[a-zA-Z][a-zA-Z\d+\-.]*:\/\//.test(e)?e:`http://${e}`}function _i(e){try{return new URL(n3(e.trim()))}catch{return null}}function lu(e){return Nc.has(e.hostname.toLowerCase())?"loopback":e.hostname.toLowerCase()}function cu(e){return e.port?e.port:e.protocol==="https:"?"443":"80"}function r3(e,t){return e.protocol===t.protocol&&lu(e)===lu(t)&&cu(e)===cu(t)}function Ic(e){return!e||e==="/"?"":e.endsWith("/")?e.slice(0,-1):e}function i3(e,t){return t?e===t||e.startsWith(`${t}/`):!0}function $n(e,t){return t?{kind:"target",target:t.origin,path:`${t.pathname}${t.search}${t.hash}`}:{kind:"target",target:e,path:null}}function du(e,t){try{const i=new URL(e),s=i.searchParams.get("__agent_tower_preview_token"),a=new URL(t.startsWith("/")?t:`/${t}`,"http://preview.local");return i.pathname=a.pathname,i.search=a.search,i.hash=a.hash,s&&i.searchParams.set("__agent_tower_preview_token",s),i.toString()}catch{}const n=e.endsWith("/")?e:`${e}/`,r=t.startsWith("/")?t.slice(1):t;return`${n}${r}`}function ny(e,t,n){const r=e.trim();if(!r)return null;if(r.startsWith("/"))return n?{kind:"proxy",url:du(n,r)}:null;const i=_i(r);if(!i)return $n(r,null);if(!t||!n)return $n(r,i);const s=_i(t);if(!s||!r3(i,s))return $n(r,i);const a=Ic(s.pathname);if(!i3(i.pathname,a))return $n(r,i);const u=i.pathname.slice(a.length)||"/";return{kind:"proxy",url:du(n,`${u}${i.search}${i.hash}`)}}function ry(e,t,n,r){if(!e||!t)return null;try{const i=new URL(e),s=new URL(t,r),a=new URL(n,r),u=s.pathname==="/"?"":s.pathname.endsWith("/")?s.pathname.slice(0,-1):s.pathname;if(a.origin!==s.origin||u&&a.pathname!==u&&!a.pathname.startsWith(`${u}/`))return a.toString();const o=a.pathname.slice(u.length)||"/",c=Ic(i.pathname);return i.pathname=`${c}${o}`.replace(/\/{2,}/g,"/")||"/",i.search=a.search,i.hash=a.hash,i.toString()}catch{return null}}function s3(e){const t=_i(e);return!!(t&&Nc.has(t.hostname.toLowerCase()))}const wc=({src:e,alt:t,className:n,node:r,...i})=>p.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"inline-block",children:p.jsx("img",{src:e,alt:t,...i,className:kn("max-w-[300px] max-h-[200px] object-contain rounded-lg border border-border cursor-pointer hover:opacity-90 active:opacity-90 transition-opacity",n)})}),a3=({href:e="",children:t,node:n,onClick:r,className:i,...s})=>{const{t:a}=Xe(),{workingDir:u,onOpenWorkspaceFile:o,onOpenPreviewUrl:c,onOpenVisualization:d,downloadSessionId:h}=s,f=e3(e),m=Ac(e,u),b={...s};delete b.workingDir,delete b.onOpenWorkspaceFile,delete b.onOpenPreviewUrl,delete b.onOpenVisualization,delete b.downloadSessionId;const k=ks(i),S=ks("inline-flex max-w-full items-center gap-1.5 align-middle font-medium");if(f?.type==="codex-inline-visualization")return d?p.jsxs("button",{type:"button",onClick:()=>d(f.file),title:a("Open visualization"),className:S,children:[p.jsx(_d,{className:"size-4 shrink-0","aria-hidden":!0}),p.jsx("span",{className:"truncate",children:f.file})]}):p.jsx("code",{title:f.file,children:f.file});if(f?.type==="agent-download")return h?p.jsxs("a",{href:t3(h,f.file),download:f.file.split("/").at(-1),title:a("Download file"),className:S,children:[p.jsx(hd,{className:"size-4 shrink-0","aria-hidden":!0}),p.jsx("span",{className:"truncate",children:f.file.split("/").at(-1)})]}):p.jsx("code",{title:f.file,children:f.file});if(c&&s3(e)){const L=I=>{r?.(I),!I.defaultPrevented&&(I.preventDefault(),c(e))};return p.jsx("a",{href:e,onClick:L,className:k,...b,children:t})}if(m.type==="workspace-file"&&o){const L=I=>{r?.(I),!I.defaultPrevented&&(I.preventDefault(),o(m.path,m.line,m.column))};return p.jsx("a",{href:e,onClick:L,className:k,...b,children:t})}if(m.type==="unknown-local"||m.type==="workspace-file"){const L=m.path;return p.jsx("code",{title:L,children:t})}const _=m.url;return p.jsx("a",{href:_,onClick:r,className:k,...b,children:t})},u3=({children:e,className:t,node:n,...r})=>p.jsx("li",{className:kn("py-0 pl-0 [&>p]:inline",t),...r,children:e}),o3={img:wc,li:u3};function l3({workingDir:e,onOpenWorkspaceFile:t,onOpenPreviewUrl:n,onOpenVisualization:r,downloadSessionId:i}){return{...o3,a:s=>p.jsx(a3,{...s,workingDir:e,onOpenWorkspaceFile:t,onOpenPreviewUrl:n,onOpenVisualization:r,downloadSessionId:i}),img:s=>{const a=Ac(s.src??"",e),u=a.type==="workspace-file"&&e?Gk(e,a.path):a.type==="attachment"?a.url:a.type==="unknown-local"?Qk(a.path):s.src;return p.jsx(wc,{...s,src:u})}}}const c3={mermaid:{download:!0,copy:!0,fullscreen:!0,panZoom:!0}},d3=/(^|\n)(```|~~~)[^\S\r\n]*mermaid(?:[\s\r\n]|$)/i;let Ci=null;function h3(e){return d3.test(e)}function f3(){return Ci??=Ii(async()=>{const{mermaid:e}=await import("./index-Dh-tgeaL.js").then(t=>t.bm);return{mermaid:e}},__vite__mapDeps([13,1,2])).then(({mermaid:e})=>({mermaid:e})),Ci}function m3(e){const t=h3(e),[n,r]=y.useState();return y.useEffect(()=>{if(!t){r(void 0);return}let i=!0;return f3().then(s=>{i&&r(s)}).catch(()=>{Ci=null,i&&r(void 0)}),()=>{i=!1}},[t]),t?n:void 0}function Lc(e){if(e.tool?.status)return e.tool.status;if(e.title?.endsWith("✓"))return"success";if(e.title?.endsWith("✗"))return"failed";if(e.title?.includes("待审批"))return"pending_approval"}function p3(e){return Lc(e)==="success"}function g3(e){const t=Lc(e);return t==="failed"||t==="timed_out"}function Lr(e){return e.title==="Thinking"||e.content.startsWith("Thinking:")}function b3(e){return e.type===se.Tool&&!!e.children?.length}function E3(e){return e.type!==se.Cursor&&!e.children?.length&&e.content.trim()===""}function ds(e){return!!e.tokenUsage||E3(e)}function T3(e){const t=e.tool?.status;return t==="pending_approval"||t==="denied"}function x3(e){return e.type===se.Cursor||e.type===se.User||e.type===se.Assistant||e.type===se.Error||e.type===se.Warning?!0:e.type===se.Info&&e.tokenUsage?!1:T3(e)}function hu(e){return Lr(e)?!0:b3(e)||e.type!==se.Tool&&e.type!==se.Action?!1:!x3(e)}function hs(e){return!Lr(e)&&(e.type===se.Tool||e.type===se.Action)}function Qn(e){const t=e.filter(i=>!ds(i)),n=[];let r=0;for(;r<t.length;){const i=t[r];if(hu(i)){const s=[i];let a=r+1;for(;a<t.length;){const u=t[a];if(hu(u))s.push(u),a++;else break}s.some(hs)?n.push({kind:"execution-group",logs:s,key:s[0].id}):s.forEach(u=>n.push({kind:"single",log:u,key:u.id})),r=a}else n.push({kind:"single",log:i,key:i.id}),r++}return n}function k3(e){const t=[];let n,r=[];const i=()=>{!n&&r.length===0||t.push({key:n?`turn-${n.id}`:`turn-${r[0]?.id??t.length}`,user:n,agentLogs:r})};for(const s of e)s.type===se.User?(i(),n=s,r=[]):r.push(s);return i(),t}function y3(e){let t=-1;for(let n=e.length-1;n>=0;n-=1){const r=e[n];if(r.content.trim()){if(r.type===se.Assistant)return n;t===-1&&r.type===se.Error&&(t=n)}}return t}function A3(e,t){if(!Number.isFinite(e)||!Number.isFinite(t))return null;const n=Math.max(0,t-e),r=n===0?0:Math.max(1,Math.round(n/1e3)),i=Math.floor(r/3600),s=Math.floor(r%3600/60),a=r%60;return i>0?`${i}h${s>0?` ${s}m`:""}`:s>0?`${s}m${a>0?` ${a}s`:""}`:`${a}s`}function _3(e){const t=e.agentLogs.reduce((i,s)=>Number.isFinite(s.cursorActivity?.processingStartedAt)?s.cursorActivity?.processingStartedAt:i,void 0),n=e.user?.timestamp??t??e.agentLogs.find(i=>Number.isFinite(i.timestamp))?.timestamp,r=e.agentLogs.reduce((i,s)=>Number.isFinite(s.timestamp)?i===void 0?s.timestamp:Math.max(i,s.timestamp):i,void 0);return{startedAt:n,latestLogAt:r}}function C3(e,t,n,r){const i=t&&n===!0,s=_3(e),a=i?null:t?r??s.latestLogAt??null:s.latestLogAt??null,u={start:s.startedAt,end:a};if(i)return{key:e.key,user:e.user??null,running:!0,duration:u,showSummary:!0,summaryCollapsible:!1,inlineItems:Qn(e.agentLogs),processedItems:[],finalItems:[]};if(e.agentLogs.length===0)return{key:e.key,user:e.user??null,running:!1,duration:u,showSummary:!1,summaryCollapsible:!1,inlineItems:[],processedItems:[],finalItems:[]};const o=y3(e.agentLogs),c=o>=0?e.agentLogs.slice(0,o):e.agentLogs,d=o>=0?e.agentLogs.slice(o):[],h=c.some(f=>!ds(f));return{key:e.key,user:e.user??null,running:!1,duration:u,showSummary:!0,summaryCollapsible:h,inlineItems:[],processedItems:h?Qn(c):[],finalItems:Qn(d)}}function Jr(e){return`item:${e.key}`}function S3(e,t){const n=[];for(const r of e){if(r.user&&n.push({kind:"user",key:`user:${r.user.id}`,log:r.user}),r.showSummary&&n.push({kind:"summary",key:`summary:${r.key}`,turnKey:r.key,duration:r.duration,collapsible:r.summaryCollapsible}),r.running){for(const i of r.inlineItems)n.push({kind:"item",key:Jr(i),item:i,processed:!1});continue}if(t.has(r.key))for(const i of r.processedItems)n.push({kind:"item",key:Jr(i),item:i,processed:!0});for(const i of r.finalItems)n.push({kind:"item",key:Jr(i),item:i,processed:!1})}return n}function N3(e){if(!e)return 40;switch(e.kind){case"user":return 72;case"summary":return 44;default:return 32}}function I3(e){let t=e?.parentElement??null;for(;t;){const n=window.getComputedStyle(t).overflowY;if(n==="auto"||n==="scroll")return t;t=t.parentElement}return null}const lr=y.memo(({content:e,className:t,workingDir:n,onOpenWorkspaceFile:r,onOpenPreviewUrl:i,onOpenVisualization:s,downloadSessionId:a})=>{const u=y.useMemo(()=>s||a?Jk(e):e,[e,a,s]),o=m3(u),c=y.useMemo(()=>l3({workingDir:n,onOpenWorkspaceFile:r,onOpenPreviewUrl:i,onOpenVisualization:s,downloadSessionId:a}),[a,i,s,r,n]);return p.jsx(xc,{className:kn("session-log-message-markdown",t),components:c,plugins:o,controls:o?c3:void 0,children:u})});lr.displayName="MarkdownMessage";function w3({id:e}){const{data:t}=Tu({queryKey:["message-delivery",e],queryFn:()=>vt.get(`/message-deliveries/${encodeURIComponent(e)}`),staleTime:1/0});return t?p.jsx(Lu,{delivery:t}):null}const Rc=y.createContext(new Map),fs=y.memo(({content:e,deliveryId:t,compact:n,workingDir:r,onOpenWorkspaceFile:i,onOpenPreviewUrl:s})=>{const a=y.useContext(Rc).get(t??"");return p.jsx("div",{className:n?"flex justify-end mb-4 mt-2":"flex justify-end mb-8 mt-4",children:p.jsxs("div",{className:"flex max-w-[85%] min-w-0 flex-col items-end",children:[p.jsxs("div",{className:`relative bg-foreground/[0.08] text-foreground rounded-2xl rounded-tr-sm max-w-full min-w-0 leading-relaxed ${n?"px-3.5 py-2.5 text-[13px]":"px-5 py-3.5 text-sm"}`,children:[p.jsx(lr,{content:e,workingDir:r,onOpenWorkspaceFile:i,onOpenPreviewUrl:s}),a&&p.jsx(Vd,{delivery:a})]}),t&&p.jsx("div",{className:"mt-1 max-w-full px-0.5","data-message-feedback":!0,children:a?p.jsx(Lu,{delivery:a}):p.jsx(w3,{id:t})})]})})});fs.displayName="UserMessage";const ms=y.memo(({content:e,isOpenDefault:t=!0})=>{const[n,r]=y.useState(t),i=y.useRef(null),[s,a]=y.useState(0);y.useEffect(()=>{i.current&&a(i.current.scrollHeight)},[e,n]);const u=y.useMemo(()=>{const c=e.replace(/^Thinking:\s*/i,"").trim().split(`
119
+ `)},ck=({children:e,className:t,onCopy:n,onError:r,timeout:i=2e3})=>{let[s,a]=y.useState(!1),[u,o]=y.useState(!1),c=y.useRef(null),d=y.useRef(0),{isAnimating:h}=y.useContext(Pe),f=async b=>{var k,S;if(typeof window>"u"||!((k=navigator?.clipboard)!=null&&k.write)){r?.(new Error("Clipboard API not available"));return}try{let _=(S=c.current)==null?void 0:S.closest('[data-streamdown="table-wrapper"]'),L=_?.querySelector("table");if(!L){r?.(new Error("Table not found"));return}let I=Vl(L),B=b==="csv"?Wl(I):ok(I),z=new ClipboardItem({"text/plain":new Blob([B],{type:"text/plain"}),"text/html":new Blob([L.outerHTML],{type:"text/html"})});await navigator.clipboard.write([z]),o(!0),a(!1),n?.(b),d.current=window.setTimeout(()=>o(!1),i)}catch(_){r?.(_)}};y.useEffect(()=>{let b=k=>{let S=k.composedPath();c.current&&!S.includes(c.current)&&a(!1)};return document.addEventListener("mousedown",b),()=>{document.removeEventListener("mousedown",b),window.clearTimeout(d.current)}},[]);let m=u?us:os;return p.jsxs("div",{className:"relative",ref:c,children:[p.jsx("button",{className:Q("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:h,onClick:()=>a(!s),title:"Copy table",type:"button",children:e??p.jsx(m,{size:14})}),s?p.jsxs("div",{className:"absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg",children:[p.jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>f("csv"),title:"Copy table as CSV",type:"button",children:"CSV"}),p.jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>f("tsv"),title:"Copy table as TSV",type:"button",children:"TSV"})]}):null]})},dk=({children:e,className:t,onDownload:n,onError:r})=>{let[i,s]=y.useState(!1),a=y.useRef(null),{isAnimating:u}=y.useContext(Pe),o=c=>{var d;try{let h=(d=a.current)==null?void 0:d.closest('[data-streamdown="table-wrapper"]'),f=h?.querySelector("table");if(!f){r?.(new Error("Table not found"));return}let m=Vl(f),b=c==="csv"?Wl(m):lk(m);Pt(`table.${c==="csv"?"csv":"md"}`,b,c==="csv"?"text/csv":"text/markdown"),s(!1),n?.(c)}catch(h){r?.(h)}};return y.useEffect(()=>{let c=d=>{let h=d.composedPath();a.current&&!h.includes(a.current)&&s(!1)};return document.addEventListener("mousedown",c),()=>{document.removeEventListener("mousedown",c)}},[]),p.jsxs("div",{className:"relative",ref:a,children:[p.jsx("button",{className:Q("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:u,onClick:()=>s(!i),title:"Download table",type:"button",children:e??p.jsx(Ir,{size:14})}),i?p.jsxs("div",{className:"absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg",children:[p.jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>o("csv"),title:"Download table as CSV",type:"button",children:"CSV"}),p.jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>o("markdown"),title:"Download table as Markdown",type:"button",children:"Markdown"})]}):null]})},hk=({children:e,className:t,showControls:n,...r})=>p.jsxs("div",{className:"my-4 flex flex-col space-y-2","data-streamdown":"table-wrapper",children:[n?p.jsxs("div",{className:"flex items-center justify-end gap-1",children:[p.jsx(ck,{}),p.jsx(dk,{})]}):null,p.jsx("div",{className:"overflow-x-auto overscroll-y-auto",children:p.jsx("table",{className:Q("w-full border-collapse border border-border",t),"data-streamdown":"table",...r,children:e})})]}),fk=y.lazy(()=>Ii(()=>import("./code-block-OCS4YCEC-CtAySD1h.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])).then(e=>({default:e.CodeBlock}))),mk=y.lazy(()=>Ii(()=>Promise.resolve().then(()=>Y3),void 0).then(e=>({default:e.Mermaid}))),pk=/language-([^\s]+)/;function wr(e,t){if(!(e!=null&&e.position||t!=null&&t.position))return!0;if(!(e!=null&&e.position&&t!=null&&t.position))return!1;let n=e.position.start,r=t.position.start,i=e.position.end,s=t.position.end;return n?.line===r?.line&&n?.column===r?.column&&i?.line===s?.line&&i?.column===s?.column}function he(e,t){return e.className===t.className&&wr(e.node,t.node)}var yi=(e,t)=>typeof e=="boolean"?e:e[t]!==!1,jn=(e,t)=>{if(typeof e=="boolean")return e;let n=e.mermaid;return n===!1?!1:n===!0||n===void 0?!0:n[t]!==!1},cs=y.memo(({children:e,className:t,node:n,...r})=>p.jsx("ol",{className:Q("list-inside list-decimal whitespace-normal [li_&]:pl-6",t),"data-streamdown":"ordered-list",...r,children:e}),(e,t)=>he(e,t));cs.displayName="MarkdownOl";var Gl=y.memo(({children:e,className:t,node:n,...r})=>p.jsx("li",{className:Q("py-1 [&>p]:inline",t),"data-streamdown":"list-item",...r,children:e}),(e,t)=>e.className===t.className&&wr(e.node,t.node));Gl.displayName="MarkdownLi";var Ql=y.memo(({children:e,className:t,node:n,...r})=>p.jsx("ul",{className:Q("list-inside list-disc whitespace-normal [li_&]:pl-6",t),"data-streamdown":"unordered-list",...r,children:e}),(e,t)=>he(e,t));Ql.displayName="MarkdownUl";var Kl=y.memo(({className:e,node:t,...n})=>p.jsx("hr",{className:Q("my-6 border-border",e),"data-streamdown":"horizontal-rule",...n}),(e,t)=>he(e,t));Kl.displayName="MarkdownHr";var Xl=y.memo(({children:e,className:t,node:n,...r})=>p.jsx("span",{className:Q("font-semibold",t),"data-streamdown":"strong",...r,children:e}),(e,t)=>he(e,t));Xl.displayName="MarkdownStrong";var gk=({children:e,className:t,href:n,node:r,...i})=>{let{linkSafety:s}=y.useContext(Pe),[a,u]=y.useState(!1),o=n==="streamdown:incomplete-link",c=y.useCallback(async m=>{if(!(!(s!=null&&s.enabled&&n)||o)){if(m.preventDefault(),s.onLinkCheck&&await s.onLinkCheck(n)){window.open(n,"_blank","noreferrer");return}u(!0)}},[s,n,o]),d=y.useCallback(()=>{n&&window.open(n,"_blank","noreferrer")},[n]),h=y.useCallback(()=>{u(!1)},[]),f={url:n??"",isOpen:a,onClose:h,onConfirm:d};return s!=null&&s.enabled&&n?p.jsxs(p.Fragment,{children:[p.jsx("button",{className:Q("wrap-anywhere appearance-none text-left font-medium text-primary underline",t),"data-incomplete":o,"data-streamdown":"link",onClick:c,type:"button",children:e}),s.renderModal?s.renderModal(f):p.jsx(nk,{...f})]}):p.jsx("a",{className:Q("wrap-anywhere font-medium text-primary underline",t),"data-incomplete":o,"data-streamdown":"link",href:n,rel:"noreferrer",target:"_blank",...i,children:e})},Zl=y.memo(gk,(e,t)=>he(e,t)&&e.href===t.href);Zl.displayName="MarkdownA";var Jl=y.memo(({children:e,className:t,node:n,...r})=>p.jsx("h1",{className:Q("mt-6 mb-2 font-semibold text-3xl",t),"data-streamdown":"heading-1",...r,children:e}),(e,t)=>he(e,t));Jl.displayName="MarkdownH1";var ec=y.memo(({children:e,className:t,node:n,...r})=>p.jsx("h2",{className:Q("mt-6 mb-2 font-semibold text-2xl",t),"data-streamdown":"heading-2",...r,children:e}),(e,t)=>he(e,t));ec.displayName="MarkdownH2";var tc=y.memo(({children:e,className:t,node:n,...r})=>p.jsx("h3",{className:Q("mt-6 mb-2 font-semibold text-xl",t),"data-streamdown":"heading-3",...r,children:e}),(e,t)=>he(e,t));tc.displayName="MarkdownH3";var nc=y.memo(({children:e,className:t,node:n,...r})=>p.jsx("h4",{className:Q("mt-6 mb-2 font-semibold text-lg",t),"data-streamdown":"heading-4",...r,children:e}),(e,t)=>he(e,t));nc.displayName="MarkdownH4";var rc=y.memo(({children:e,className:t,node:n,...r})=>p.jsx("h5",{className:Q("mt-6 mb-2 font-semibold text-base",t),"data-streamdown":"heading-5",...r,children:e}),(e,t)=>he(e,t));rc.displayName="MarkdownH5";var ic=y.memo(({children:e,className:t,node:n,...r})=>p.jsx("h6",{className:Q("mt-6 mb-2 font-semibold text-sm",t),"data-streamdown":"heading-6",...r,children:e}),(e,t)=>he(e,t));ic.displayName="MarkdownH6";var sc=y.memo(({children:e,className:t,node:n,...r})=>{let{controls:i}=y.useContext(Pe),s=yi(i,"table");return p.jsx(hk,{className:t,showControls:s,...r,children:e})},(e,t)=>he(e,t));sc.displayName="MarkdownTable";var ac=y.memo(({children:e,className:t,node:n,...r})=>p.jsx("thead",{className:Q("bg-muted/80",t),"data-streamdown":"table-header",...r,children:e}),(e,t)=>he(e,t));ac.displayName="MarkdownThead";var uc=y.memo(({children:e,className:t,node:n,...r})=>p.jsx("tbody",{className:Q("divide-y divide-border bg-muted/40",t),"data-streamdown":"table-body",...r,children:e}),(e,t)=>he(e,t));uc.displayName="MarkdownTbody";var oc=y.memo(({children:e,className:t,node:n,...r})=>p.jsx("tr",{className:Q("border-border border-b",t),"data-streamdown":"table-row",...r,children:e}),(e,t)=>he(e,t));oc.displayName="MarkdownTr";var lc=y.memo(({children:e,className:t,node:n,...r})=>p.jsx("th",{className:Q("whitespace-nowrap px-4 py-2 text-left font-semibold text-sm",t),"data-streamdown":"table-header-cell",...r,children:e}),(e,t)=>he(e,t));lc.displayName="MarkdownTh";var cc=y.memo(({children:e,className:t,node:n,...r})=>p.jsx("td",{className:Q("px-4 py-2 text-sm",t),"data-streamdown":"table-cell",...r,children:e}),(e,t)=>he(e,t));cc.displayName="MarkdownTd";var dc=y.memo(({children:e,className:t,node:n,...r})=>p.jsx("blockquote",{className:Q("my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic",t),"data-streamdown":"blockquote",...r,children:e}),(e,t)=>he(e,t));dc.displayName="MarkdownBlockquote";var hc=y.memo(({children:e,className:t,node:n,...r})=>p.jsx("sup",{className:Q("text-sm",t),"data-streamdown":"superscript",...r,children:e}),(e,t)=>he(e,t));hc.displayName="MarkdownSup";var fc=y.memo(({children:e,className:t,node:n,...r})=>p.jsx("sub",{className:Q("text-sm",t),"data-streamdown":"subscript",...r,children:e}),(e,t)=>he(e,t));fc.displayName="MarkdownSub";var mc=y.memo(({children:e,className:t,node:n,...r})=>{if("data-footnotes"in r){let i=a=>{var u,o;if(!y.isValidElement(a))return!1;let c=Array.isArray(a.props.children)?a.props.children:[a.props.children],d=!1,h=!1;for(let f of c)if(f){if(typeof f=="string")f.trim()!==""&&(d=!0);else if(y.isValidElement(f))if(((u=f.props)==null?void 0:u["data-footnote-backref"])!==void 0)h=!0;else{let m=Array.isArray(f.props.children)?f.props.children:[f.props.children];for(let b of m){if(typeof b=="string"&&b.trim()!==""){d=!0;break}if(y.isValidElement(b)&&((o=b.props)==null?void 0:o["data-footnote-backref"])===void 0){d=!0;break}}}}return h&&!d},s=Array.isArray(e)?e.map(a=>{if(!y.isValidElement(a))return a;if(a.type===cs){let u=(Array.isArray(a.props.children)?a.props.children:[a.props.children]).filter(o=>!i(o));return u.length===0?null:{...a,props:{...a.props,children:u}}}return a}):e;return(Array.isArray(s)?s.some(a=>a!==null):s!==null)?p.jsx("section",{className:t,...r,children:s}):null}return p.jsx("section",{className:t,...r,children:e})},(e,t)=>he(e,t));mc.displayName="MarkdownSection";var bk=({node:e,className:t,children:n,...r})=>{var i;let s=!("data-block"in r),{mermaid:a,controls:u}=y.useContext(Pe),o=ls();if(s)return p.jsx("code",{className:Q("rounded bg-muted px-1.5 py-0.5 font-mono text-sm",t),"data-streamdown":"inline-code",...r,children:n});let c=t?.match(pk),d=(i=c?.at(1))!=null?i:"",h="";if(y.isValidElement(n)&&n.props&&typeof n.props=="object"&&"children"in n.props&&typeof n.props.children=="string"?h=n.props.children:typeof n=="string"&&(h=n),d==="mermaid"&&o){let m=yi(u,"mermaid"),b=jn(u,"download"),k=jn(u,"copy"),S=jn(u,"fullscreen"),_=jn(u,"panZoom"),L=m&&(b||k||S);return p.jsx(y.Suspense,{fallback:p.jsx(tu,{}),children:p.jsxs("div",{className:Q("group relative my-4 h-auto rounded-xl border p-4",t),"data-streamdown":"mermaid-block",children:[L?p.jsxs("div",{className:"flex items-center justify-end gap-2",children:[b?p.jsx(ik,{chart:h,config:a?.config}):null,k?p.jsx(Ja,{code:h}):null,S?p.jsx(uk,{chart:h,config:a?.config}):null]}):null,p.jsx(mk,{chart:h,config:a?.config,showControls:_})]})})}let f=yi(u,"code");return p.jsx(y.Suspense,{fallback:p.jsx(tu,{}),children:p.jsx(fk,{className:Q("overflow-x-auto border-border border-t",t),code:h,language:d,children:f?p.jsxs(p.Fragment,{children:[p.jsx(Xx,{code:h,language:d}),p.jsx(Ja,{})]}):null})})},pc=y.memo(bk,(e,t)=>e.className===t.className&&wr(e.node,t.node));pc.displayName="MarkdownCode";var gc=y.memo(Jx,(e,t)=>e.className===t.className&&wr(e.node,t.node));gc.displayName="MarkdownImg";var bc=y.memo(({children:e,className:t,node:n,...r})=>{let i=(Array.isArray(e)?e:[e]).filter(s=>s!=null&&s!=="");if(i.length===1&&y.isValidElement(i[0])){let s=i[0].props.node,a=s?.tagName;if(a==="img")return p.jsx(p.Fragment,{children:e});if(a==="code"&&"data-block"in i[0].props)return p.jsx(p.Fragment,{children:e})}return p.jsx("p",{className:t,...r,children:e})},(e,t)=>he(e,t));bc.displayName="MarkdownParagraph";var Ek={ol:cs,li:Gl,ul:Ql,hr:Kl,strong:Xl,a:Zl,h1:Jl,h2:ec,h3:tc,h4:nc,h5:rc,h6:ic,table:sc,thead:ac,tbody:uc,tr:oc,th:lc,td:cc,blockquote:dc,code:pc,img:gc,pre:({children:e})=>y.isValidElement(e)?y.cloneElement(e,{"data-block":"true"}):e,sup:hc,sub:fc,p:bc,section:mc},Tk=()=>e=>{st(e,"html",(t,n,r)=>{!r||typeof n!="number"||(r.children[n]={type:"text",value:t.value})})},nu=[],ru={allowDangerousHtml:!0},zn=new WeakMap,xk=class{constructor(){this.cache=new Map,this.keyCache=new WeakMap,this.maxSize=100}generateCacheKey(e){let t=this.keyCache.get(e);if(t)return t;let n=e.rehypePlugins,r=e.remarkPlugins,i=e.remarkRehypeOptions;if(!(n||r||i)){let d="default";return this.keyCache.set(e,d),d}let s=d=>{if(!d||d.length===0)return"";let h="";for(let f=0;f<d.length;f+=1){let m=d[f];if(f>0&&(h+=","),Array.isArray(m)){let[b,k]=m;if(typeof b=="function"){let S=zn.get(b);S||(S=b.name,zn.set(b,S)),h+=S}else h+=String(b);h+=":",h+=JSON.stringify(k)}else if(typeof m=="function"){let b=zn.get(m);b||(b=m.name,zn.set(m,b)),h+=b}else h+=String(m)}return h},a=s(n),u=s(r),o=i?JSON.stringify(i):"",c=`${u}::${a}::${o}`;return this.keyCache.set(e,c),c}get(e){let t=this.generateCacheKey(e),n=this.cache.get(t);return n&&(this.cache.delete(t),this.cache.set(t,n)),n}set(e,t){let n=this.generateCacheKey(e);if(this.cache.size>=this.maxSize){let r=this.cache.keys().next().value;r&&this.cache.delete(r)}this.cache.set(n,t)}clear(){this.cache.clear()}},iu=new xk,Ec=e=>{let t=kk(e),n=e.children||"";return Ik(t.runSync(t.parse(n),n),e)},kk=e=>{let t=iu.get(e);if(t)return t;let n=Ak(e);return iu.set(e,n),n},yk=e=>e.some(t=>Array.isArray(t)?t[0]===li:t===li),Ak=e=>{let t=e.rehypePlugins||nu,n=e.remarkPlugins||nu,r=yk(t)?n:[...n,Tk],i=e.remarkRehypeOptions?{...ru,...e.remarkRehypeOptions}:ru;return V2().use(YT).use(r).use(N2,i).use(t)},_k=e=>e,Ck=(e,t,n,r)=>{n?e.children.splice(t,1):e.children[t]={type:"text",value:r}},Sk=(e,t)=>{var n;for(let r in $r)if(Object.hasOwn($r,r)&&Object.hasOwn(e.properties,r)){let i=e.properties[r],s=$r[r];(s===null||s.includes(e.tagName))&&(e.properties[r]=(n=t(String(i||""),r,e))!=null?n:void 0)}},Nk=(e,t,n,r,i,s)=>{let a=!1;return r?a=!r.includes(e.tagName):i&&(a=i.includes(e.tagName)),!a&&s&&typeof t=="number"&&(a=!s(e,t,n)),a},Ik=(e,t)=>{let{allowElement:n,allowedElements:r,disallowedElements:i,skipHtml:s,unwrapDisallowed:a,urlTransform:u}=t;if(n||r||i||s||u){let o=u||_k;st(e,(c,d,h)=>{if(c.type==="raw"&&h&&typeof d=="number")return Ck(h,d,s,c.value),d;if(c.type==="element"&&(Sk(c,o),Nk(c,d,h,r,i,n)&&h&&typeof d=="number"))return a&&c.children?h.children.splice(d,1,...c.children):h.children.splice(d,1),d})}return JE(e,{Fragment:p.Fragment,components:t.components,ignoreInvalidStyle:!0,jsx:p.jsx,jsxs:p.jsxs,passKeys:!0,passNode:!0})},wk=/\[\^[\w-]{1,200}\](?!:)/,Lk=/\[\^[\w-]{1,200}\]:/,Rk=/<\/(\w+)>/,Ok=/<(\w+)[\s>]/,Dk=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Pk=e=>{let t=0;for(let n=0;n<e.length-1;n+=1)e[n]==="$"&&e[n+1]==="$"&&(t+=1,n+=1);return t},vk=e=>{let t=wk.test(e),n=Lk.test(e);if(t||n)return[e];let r=De.lex(e,{gfm:!0}),i=[],s=[],a=!1;for(let u of r){let o=u.raw,c=i.length;if(s.length>0){if(i[c-1]+=o,u.type==="html"){let d=o.match(Rk);if(d){let h=d[1];s.at(-1)===h&&s.pop()}}continue}if(u.type==="html"&&u.block){let d=o.match(Ok);if(d){let h=d[1];o.includes(`</${h}>`)||Dk.has(h.toLowerCase())||s.push(h)}}if(c>0&&!a){let d=i[c-1];if(Pk(d)%2===1){i[c-1]=d+o;continue}}i.push(o),u.type!=="space"&&(a=u.type==="code")}return i},su,au,Gn={...cn,protocols:{...cn.protocols,href:[...(au=(su=cn.protocols)==null?void 0:su.href)!=null?au:[],"tel"]}},Ai={raw:li,sanitize:[Do,Gn],harden:[hh,{allowedImagePrefixes:["*"],allowedLinkPrefixes:["*"],allowedProtocols:["*"],defaultOrigin:void 0,allowDataImages:!0}]},Mk={gfm:[wb,{}]},uu=Object.values(Ai),Bk=Object.values(Mk),Fk={block:" ▋",circle:" ●"},Hk={shikiTheme:["github-light","github-dark"],controls:!0,isAnimating:!1,mode:"streaming",mermaid:void 0,linkSafety:{enabled:!0}},Pe=y.createContext(Hk),Tc=y.memo(({content:e,shouldParseIncompleteMarkdown:t,index:n,...r})=>p.jsx(Ec,{...r,children:e}),(e,t)=>{if(e.content!==t.content||e.index!==t.index)return!1;if(e.components!==t.components){let n=Object.keys(e.components||{}),r=Object.keys(t.components||{});if(n.length!==r.length||n.some(i=>{var s,a;return((s=e.components)==null?void 0:s[i])!==((a=t.components)==null?void 0:a[i])}))return!1}return!(e.rehypePlugins!==t.rehypePlugins||e.remarkPlugins!==t.remarkPlugins)});Tc.displayName="Block";var Uk=["github-light","github-dark"],xc=y.memo(({children:e,mode:t="streaming",parseIncompleteMarkdown:n=!0,components:r,rehypePlugins:i=uu,remarkPlugins:s=Bk,className:a,shikiTheme:u=Uk,mermaid:o,controls:c=!0,isAnimating:d=!1,animated:h,BlockComponent:f=Tc,parseMarkdownIntoBlocksFn:m=vk,caret:b,plugins:k,remend:S,linkSafety:_={enabled:!0},allowedTags:L,...I})=>{let B=y.useId(),[z,R]=y.useTransition(),$=y.useMemo(()=>typeof e!="string"?"":t==="streaming"&&n?BE(e,S):e,[e,t,n,S]),G=y.useMemo(()=>m($),[$,m]),[K,N]=y.useState(G);y.useEffect(()=>{t==="streaming"?R(()=>{N(G)}):N(G)},[G,t]);let U=t==="streaming"?K:G,v=y.useMemo(()=>U.map((re,x)=>`${B}-${x}`),[U.length,B]),V=y.useMemo(()=>h?h===!0?xi():xi(h):null,[h]),q=y.useMemo(()=>{var re,x;return{shikiTheme:(x=(re=k?.code)==null?void 0:re.getThemes())!=null?x:u,controls:c,isAnimating:d,mode:t,mermaid:o,linkSafety:_}},[u,c,d,t,o,_,k?.code]),j=y.useMemo(()=>({...Ek,...r}),[r]),F=y.useMemo(()=>{let re=[];return k!=null&&k.cjk&&(re=[...re,...k.cjk.remarkPluginsBefore]),re=[...re,...s],k!=null&&k.cjk&&(re=[...re,...k.cjk.remarkPluginsAfter]),k!=null&&k.math&&(re=[...re,k.math.remarkPlugin]),re},[s,k?.math,k?.cjk]),W=y.useMemo(()=>{var re;let x=i;if(L&&Object.keys(L).length>0&&i===uu){let Ne={...Gn,tagNames:[...(re=Gn.tagNames)!=null?re:[],...Object.keys(L)],attributes:{...Gn.attributes,...L}};x=[Ai.raw,[Do,Ne],Ai.harden]}return k!=null&&k.math&&(x=[...x,k.math.rehypePlugin]),V&&d&&(x=[...x,V.rehypePlugin]),x},[i,k?.math,V,d,L]),ue=y.useMemo(()=>b&&d?{"--streamdown-caret":`"${Fk[b]}"`}:void 0,[b,d]);return t==="static"?p.jsx(ki.Provider,{value:k??null,children:p.jsx(Pe.Provider,{value:q,children:p.jsx("div",{className:Q("space-y-4 whitespace-normal *:first:mt-0 *:last:mb-0",a),children:p.jsx(Ec,{components:j,rehypePlugins:W,remarkPlugins:F,...I,children:e})})})}):p.jsx(ki.Provider,{value:k??null,children:p.jsx(Pe.Provider,{value:q,children:p.jsxs("div",{className:Q("space-y-4 whitespace-normal *:first:mt-0 *:last:mb-0",b?"*:last:after:inline *:last:after:align-baseline *:last:after:content-[var(--streamdown-caret)]":null,a),style:ue,children:[U.length===0&&b&&d&&p.jsx("span",{}),U.map((re,x)=>p.jsx(f,{components:j,content:re,index:x,rehypePlugins:W,remarkPlugins:F,shouldParseIncompleteMarkdown:n,...I},v[x]))]})})})},(e,t)=>e.children===t.children&&e.shikiTheme===t.shikiTheme&&e.isAnimating===t.isAnimating&&e.animated===t.animated&&e.mode===t.mode&&e.plugins===t.plugins&&e.className===t.className&&e.linkSafety===t.linkSafety);xc.displayName="Streamdown";var jk=({children:e,className:t,minZoom:n=.5,maxZoom:r=3,zoomStep:i=.1,showControls:s=!0,initialZoom:a=1,fullscreen:u=!1})=>{let o=y.useRef(null),c=y.useRef(null),[d,h]=y.useState(a),[f,m]=y.useState({x:0,y:0}),[b,k]=y.useState(!1),[S,_]=y.useState({x:0,y:0}),[L,I]=y.useState({x:0,y:0}),B=y.useCallback(v=>{h(V=>Math.max(n,Math.min(r,V+v)))},[n,r]),z=y.useCallback(()=>{B(i)},[B,i]),R=y.useCallback(()=>{B(-i)},[B,i]),$=y.useCallback(()=>{h(a),m({x:0,y:0})},[a]),G=y.useCallback(v=>{v.preventDefault();let V=v.deltaY>0?-i:i;B(V)},[B,i]),K=y.useCallback(v=>{if(v.button!==0||v.isPrimary===!1)return;k(!0),_({x:v.clientX,y:v.clientY}),I(f);let V=v.currentTarget;V instanceof HTMLElement&&V.setPointerCapture(v.pointerId)},[f]),N=y.useCallback(v=>{if(!b)return;v.preventDefault();let V=v.clientX-S.x,q=v.clientY-S.y;m({x:L.x+V,y:L.y+q})},[b,S,L]),U=y.useCallback(v=>{k(!1);let V=v.currentTarget;V instanceof HTMLElement&&V.releasePointerCapture(v.pointerId)},[]);return y.useEffect(()=>{let v=o.current;if(v)return v.addEventListener("wheel",G,{passive:!1}),()=>{v.removeEventListener("wheel",G)}},[G]),y.useEffect(()=>{let v=c.current;if(v&&b)return document.body.style.userSelect="none",v.addEventListener("pointermove",N,{passive:!1}),v.addEventListener("pointerup",U),v.addEventListener("pointercancel",U),()=>{document.body.style.userSelect="",v.removeEventListener("pointermove",N),v.removeEventListener("pointerup",U),v.removeEventListener("pointercancel",U)}},[b,N,U]),p.jsxs("div",{className:Q("relative flex flex-col",u?"h-full w-full":"min-h-28 w-full",t),ref:o,style:{cursor:b?"grabbing":"grab"},children:[s?p.jsxs("div",{className:Q("absolute z-10 flex flex-col gap-1 rounded-md border border-border bg-background/90 p-1 shadow-sm backdrop-blur-sm",u?"bottom-4 left-4":"bottom-2 left-2"),children:[p.jsx("button",{className:"flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",disabled:d>=r,onClick:z,title:"Zoom in",type:"button",children:p.jsx(Gx,{size:16})}),p.jsx("button",{className:"flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",disabled:d<=n,onClick:R,title:"Zoom out",type:"button",children:p.jsx(Qx,{size:16})}),p.jsx("button",{className:"flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",onClick:$,title:"Reset zoom and pan",type:"button",children:p.jsx(Wx,{size:16})})]}):null,p.jsx("div",{className:Q("flex-1 origin-center transition-transform duration-150 ease-out",u?"flex h-full w-full items-center justify-center":"flex w-full items-center justify-center"),onPointerDown:K,ref:c,role:"application",style:{transform:`translate(${f.x}px, ${f.y}px) scale(${d})`,transformOrigin:"center center",touchAction:"none",willChange:"transform"},children:e})]})},kc=({chart:e,className:t,config:n,fullscreen:r=!1,showControls:i=!0})=>{let[s,a]=y.useState(null),[u,o]=y.useState(!1),[c,d]=y.useState(""),[h,f]=y.useState(""),[m,b]=y.useState(0),{mermaid:k}=y.useContext(Pe),S=ls(),_=k?.errorComponent,{shouldRender:L,containerRef:I}=Mx({immediate:r});if(y.useEffect(()=>{if(L){if(!S){a("Mermaid plugin not available. Please add the mermaid plugin to enable diagram rendering.");return}(async()=>{try{a(null),o(!0);let z=S.getMermaid(n),R=e.split("").reduce((K,N)=>(K<<5)-K+N.charCodeAt(0)|0,0),$=`mermaid-${Math.abs(R)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:G}=await z.render($,e);d(G),f(G)}catch(z){if(!(h||c)){let R=z instanceof Error?z.message:"Failed to render Mermaid chart";a(R)}}finally{o(!1)}})()}},[e,n,m,L,S]),!(L||c||h))return p.jsx("div",{className:Q("my-4 min-h-[200px]",t),ref:I});if(u&&!c&&!h)return p.jsx("div",{className:Q("my-4 flex justify-center p-4",t),ref:I,children:p.jsxs("div",{className:"flex items-center space-x-2 text-muted-foreground",children:[p.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-current border-b-2"}),p.jsx("span",{className:"text-sm",children:"Loading diagram..."})]})});if(s&&!c&&!h){let z=()=>b(R=>R+1);return _?p.jsx("div",{ref:I,children:p.jsx(_,{chart:e,error:s,retry:z})}):p.jsxs("div",{className:Q("rounded-lg border border-red-200 bg-red-50 p-4",t),ref:I,children:[p.jsxs("p",{className:"font-mono text-red-700 text-sm",children:["Mermaid Error: ",s]}),p.jsxs("details",{className:"mt-2",children:[p.jsx("summary",{className:"cursor-pointer text-red-600 text-xs",children:"Show Code"}),p.jsx("pre",{className:"mt-2 overflow-x-auto rounded bg-red-100 p-2 text-red-800 text-xs",children:e})]})]})}let B=c||h;return p.jsx("div",{className:Q("size-full",t),"data-streamdown":"mermaid",ref:I,children:p.jsx(jk,{className:Q(r?"size-full overflow-hidden":"my-4 overflow-hidden",t),fullscreen:r,maxZoom:3,minZoom:.5,showControls:i,zoomStep:.1,children:p.jsx("div",{"aria-label":"Mermaid chart",className:Q("flex justify-center",r?"size-full items-center":null),dangerouslySetInnerHTML:{__html:B},role:"img"})})})};function zk({content:e,children:t,className:n,side:r="top",align:i="center"}){return p.jsx(yd,{content:e,side:r,align:i,children:p.jsx("div",{className:kn("relative inline-block [&>:disabled]:pointer-events-none",n),children:t})})}const yc=/^[a-zA-Z]:[\\/]/,$k=/[/\\](attachments|conversations)[/\\]/,qk=/^\/(Users|home|tmp|private|var|opt|mnt|Volumes)(\/|$)/;function ou(e){return e.replace(/\\/g,"/").replace(/\/{2,}/g,"/")}function Yk(e){const t=e.match(/^(.*)#L([1-9]\d*)(?:C([1-9]\d*))?$/i);if(t)return{path:t[1],line:Number(t[2]),column:t[3]?Number(t[3]):void 0};const n=e.match(/^(.*?):(\d+)(?::(\d+))?$/);if(n&&n[1]){const r=Number(n[2]),i=n[3]?Number(n[3]):void 0;if(r>0&&(!n[3]||i&&i>0))return{path:n[1],line:r,column:i}}return{path:e}}function Vk(e,t){if(!t)return null;const n=ou(e),r=ou(t).replace(/\/$/,"");return n===r?null:n.startsWith(`${r}/`)?n.slice(r.length+1):n.startsWith("./")?n.slice(2):!n.startsWith("/")&&!yc.test(e)&&!n.startsWith("../")?n:null}function Wk(e){return`${yn()}/attachments/by-path?path=${encodeURIComponent(e)}`}function Ac(e,t){if(/^https?:\/\//i.test(e))return{type:"external",url:e};if(/^(mailto|tel):/i.test(e))return{type:"external",url:e};if(e.startsWith("/api/")||e.startsWith("#"))return{type:"internal",url:e};const n=Yk(e),r=Vk(n.path,t);return r?{type:"workspace-file",path:r,line:n.line,column:n.column}:$k.test(e)?{type:"attachment",path:e,url:Wk(e)}:qk.test(e)||yc.test(e)?{type:"unknown-local",path:e}:{type:"internal",url:e}}function Gk(e,t){const n=new URLSearchParams({workingDir:e,path:t});return`${yn()}/files/image?${n.toString()}`}function Qk(e){const t=new URLSearchParams({path:e});return`${yn()}/files/image?${t.toString()}`}const _c="/__agent-tower/message-intent/codex-inline-vis",Cc="/__agent-tower/message-intent/agent-download",Kk=/^[ \t]{0,3}::codex-inline-vis\{file="([^"\r\n]+)"\}[ \t]*$/,Sc=/^[a-z0-9][a-z0-9-]*\.html$/,Xk=/^[ \t]{0,3}(`{3,}|~{3,})/;function Zk(e,t){const n=t[0]==="`"?"`":"~";return new RegExp(`^[ \\t]{0,3}${n}{${t.length},}[ \\t]*$`).test(e)}function Jk(e){let t=null;return e.split(/\r?\n/).map(n=>{if(t)return Zk(n,t)&&(t=null),n;const r=n.match(Xk);if(r)return t=r[1],n;const i=n.match(Kk);if(i&&Sc.test(i[1])){const u=`${_c}?file=${encodeURIComponent(i[1])}`;return`[${i[1]}](${u})`}const s=Id(n);if(!s)return n;const a=`${Cc}?file=${encodeURIComponent(s)}`;return`[${s}](${a})`}).join(`
120
+ `)}function e3(e){try{const t=new URL(e,"http://agent-tower.local"),n=t.searchParams.get("file");if(!n)return null;if(t.pathname===_c&&Sc.test(n))return{type:"codex-inline-visualization",file:n};if(t.pathname===Cc){const r=Nu(n);return r?{type:"agent-download",file:r}:null}return null}catch{return null}}function ty(e,t){return`${yn()}/sessions/${encodeURIComponent(e)}/visualizations/${encodeURIComponent(t)}`}function t3(e,t){const n=new URLSearchParams({path:t});return`${yn()}/sessions/${encodeURIComponent(e)}/artifacts/download?${n.toString()}`}const Nc=new Set(["localhost","127.0.0.1","::1","[::1]","0.0.0.0"]);function n3(e){return/^\d+$/.test(e)?`http://127.0.0.1:${e}`:/^[a-zA-Z][a-zA-Z\d+\-.]*:\/\//.test(e)?e:`http://${e}`}function _i(e){try{return new URL(n3(e.trim()))}catch{return null}}function lu(e){return Nc.has(e.hostname.toLowerCase())?"loopback":e.hostname.toLowerCase()}function cu(e){return e.port?e.port:e.protocol==="https:"?"443":"80"}function r3(e,t){return e.protocol===t.protocol&&lu(e)===lu(t)&&cu(e)===cu(t)}function Ic(e){return!e||e==="/"?"":e.endsWith("/")?e.slice(0,-1):e}function i3(e,t){return t?e===t||e.startsWith(`${t}/`):!0}function $n(e,t){return t?{kind:"target",target:t.origin,path:`${t.pathname}${t.search}${t.hash}`}:{kind:"target",target:e,path:null}}function du(e,t){try{const i=new URL(e),s=i.searchParams.get("__agent_tower_preview_token"),a=new URL(t.startsWith("/")?t:`/${t}`,"http://preview.local");return i.pathname=a.pathname,i.search=a.search,i.hash=a.hash,s&&i.searchParams.set("__agent_tower_preview_token",s),i.toString()}catch{}const n=e.endsWith("/")?e:`${e}/`,r=t.startsWith("/")?t.slice(1):t;return`${n}${r}`}function ny(e,t,n){const r=e.trim();if(!r)return null;if(r.startsWith("/"))return n?{kind:"proxy",url:du(n,r)}:null;const i=_i(r);if(!i)return $n(r,null);if(!t||!n)return $n(r,i);const s=_i(t);if(!s||!r3(i,s))return $n(r,i);const a=Ic(s.pathname);if(!i3(i.pathname,a))return $n(r,i);const u=i.pathname.slice(a.length)||"/";return{kind:"proxy",url:du(n,`${u}${i.search}${i.hash}`)}}function ry(e,t,n,r){if(!e||!t)return null;try{const i=new URL(e),s=new URL(t,r),a=new URL(n,r),u=s.pathname==="/"?"":s.pathname.endsWith("/")?s.pathname.slice(0,-1):s.pathname;if(a.origin!==s.origin||u&&a.pathname!==u&&!a.pathname.startsWith(`${u}/`))return a.toString();const o=a.pathname.slice(u.length)||"/",c=Ic(i.pathname);return i.pathname=`${c}${o}`.replace(/\/{2,}/g,"/")||"/",i.search=a.search,i.hash=a.hash,i.toString()}catch{return null}}function s3(e){const t=_i(e);return!!(t&&Nc.has(t.hostname.toLowerCase()))}const wc=({src:e,alt:t,className:n,node:r,...i})=>p.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"inline-block",children:p.jsx("img",{src:e,alt:t,...i,className:kn("max-w-[300px] max-h-[200px] object-contain rounded-lg border border-border cursor-pointer hover:opacity-90 active:opacity-90 transition-opacity",n)})}),a3=({href:e="",children:t,node:n,onClick:r,className:i,...s})=>{const{t:a}=Xe(),{workingDir:u,onOpenWorkspaceFile:o,onOpenPreviewUrl:c,onOpenVisualization:d,downloadSessionId:h}=s,f=e3(e),m=Ac(e,u),b={...s};delete b.workingDir,delete b.onOpenWorkspaceFile,delete b.onOpenPreviewUrl,delete b.onOpenVisualization,delete b.downloadSessionId;const k=ks(i),S=ks("inline-flex max-w-full items-center gap-1.5 align-middle font-medium");if(f?.type==="codex-inline-visualization")return d?p.jsxs("button",{type:"button",onClick:()=>d(f.file),title:a("Open visualization"),className:S,children:[p.jsx(_d,{className:"size-4 shrink-0","aria-hidden":!0}),p.jsx("span",{className:"truncate",children:f.file})]}):p.jsx("code",{title:f.file,children:f.file});if(f?.type==="agent-download")return h?p.jsxs("a",{href:t3(h,f.file),download:f.file.split("/").at(-1),title:a("Download file"),className:S,children:[p.jsx(hd,{className:"size-4 shrink-0","aria-hidden":!0}),p.jsx("span",{className:"truncate",children:f.file.split("/").at(-1)})]}):p.jsx("code",{title:f.file,children:f.file});if(c&&s3(e)){const L=I=>{r?.(I),!I.defaultPrevented&&(I.preventDefault(),c(e))};return p.jsx("a",{href:e,onClick:L,className:k,...b,children:t})}if(m.type==="workspace-file"&&o){const L=I=>{r?.(I),!I.defaultPrevented&&(I.preventDefault(),o(m.path,m.line,m.column))};return p.jsx("a",{href:e,onClick:L,className:k,...b,children:t})}if(m.type==="unknown-local"||m.type==="workspace-file"){const L=m.path;return p.jsx("code",{title:L,children:t})}const _=m.url;return p.jsx("a",{href:_,onClick:r,className:k,...b,children:t})},u3=({children:e,className:t,node:n,...r})=>p.jsx("li",{className:kn("py-0 pl-0 [&>p]:inline",t),...r,children:e}),o3={img:wc,li:u3};function l3({workingDir:e,onOpenWorkspaceFile:t,onOpenPreviewUrl:n,onOpenVisualization:r,downloadSessionId:i}){return{...o3,a:s=>p.jsx(a3,{...s,workingDir:e,onOpenWorkspaceFile:t,onOpenPreviewUrl:n,onOpenVisualization:r,downloadSessionId:i}),img:s=>{const a=Ac(s.src??"",e),u=a.type==="workspace-file"&&e?Gk(e,a.path):a.type==="attachment"?a.url:a.type==="unknown-local"?Qk(a.path):s.src;return p.jsx(wc,{...s,src:u})}}}const c3={mermaid:{download:!0,copy:!0,fullscreen:!0,panZoom:!0}},d3=/(^|\n)(```|~~~)[^\S\r\n]*mermaid(?:[\s\r\n]|$)/i;let Ci=null;function h3(e){return d3.test(e)}function f3(){return Ci??=Ii(async()=>{const{mermaid:e}=await import("./index-B8xoIIa6.js").then(t=>t.bm);return{mermaid:e}},__vite__mapDeps([13,1,2])).then(({mermaid:e})=>({mermaid:e})),Ci}function m3(e){const t=h3(e),[n,r]=y.useState();return y.useEffect(()=>{if(!t){r(void 0);return}let i=!0;return f3().then(s=>{i&&r(s)}).catch(()=>{Ci=null,i&&r(void 0)}),()=>{i=!1}},[t]),t?n:void 0}function Lc(e){if(e.tool?.status)return e.tool.status;if(e.title?.endsWith("✓"))return"success";if(e.title?.endsWith("✗"))return"failed";if(e.title?.includes("待审批"))return"pending_approval"}function p3(e){return Lc(e)==="success"}function g3(e){const t=Lc(e);return t==="failed"||t==="timed_out"}function Lr(e){return e.title==="Thinking"||e.content.startsWith("Thinking:")}function b3(e){return e.type===se.Tool&&!!e.children?.length}function E3(e){return e.type!==se.Cursor&&!e.children?.length&&e.content.trim()===""}function ds(e){return!!e.tokenUsage||E3(e)}function T3(e){const t=e.tool?.status;return t==="pending_approval"||t==="denied"}function x3(e){return e.type===se.Cursor||e.type===se.User||e.type===se.Assistant||e.type===se.Error||e.type===se.Warning?!0:e.type===se.Info&&e.tokenUsage?!1:T3(e)}function hu(e){return Lr(e)?!0:b3(e)||e.type!==se.Tool&&e.type!==se.Action?!1:!x3(e)}function hs(e){return!Lr(e)&&(e.type===se.Tool||e.type===se.Action)}function Qn(e){const t=e.filter(i=>!ds(i)),n=[];let r=0;for(;r<t.length;){const i=t[r];if(hu(i)){const s=[i];let a=r+1;for(;a<t.length;){const u=t[a];if(hu(u))s.push(u),a++;else break}s.some(hs)?n.push({kind:"execution-group",logs:s,key:s[0].id}):s.forEach(u=>n.push({kind:"single",log:u,key:u.id})),r=a}else n.push({kind:"single",log:i,key:i.id}),r++}return n}function k3(e){const t=[];let n,r=[];const i=()=>{!n&&r.length===0||t.push({key:n?`turn-${n.id}`:`turn-${r[0]?.id??t.length}`,user:n,agentLogs:r})};for(const s of e)s.type===se.User?(i(),n=s,r=[]):r.push(s);return i(),t}function y3(e){let t=-1;for(let n=e.length-1;n>=0;n-=1){const r=e[n];if(r.content.trim()){if(r.type===se.Assistant)return n;t===-1&&r.type===se.Error&&(t=n)}}return t}function A3(e,t){if(!Number.isFinite(e)||!Number.isFinite(t))return null;const n=Math.max(0,t-e),r=n===0?0:Math.max(1,Math.round(n/1e3)),i=Math.floor(r/3600),s=Math.floor(r%3600/60),a=r%60;return i>0?`${i}h${s>0?` ${s}m`:""}`:s>0?`${s}m${a>0?` ${a}s`:""}`:`${a}s`}function _3(e){const t=e.agentLogs.reduce((i,s)=>Number.isFinite(s.cursorActivity?.processingStartedAt)?s.cursorActivity?.processingStartedAt:i,void 0),n=e.user?.timestamp??t??e.agentLogs.find(i=>Number.isFinite(i.timestamp))?.timestamp,r=e.agentLogs.reduce((i,s)=>Number.isFinite(s.timestamp)?i===void 0?s.timestamp:Math.max(i,s.timestamp):i,void 0);return{startedAt:n,latestLogAt:r}}function C3(e,t,n,r){const i=t&&n===!0,s=_3(e),a=i?null:t?r??s.latestLogAt??null:s.latestLogAt??null,u={start:s.startedAt,end:a};if(i)return{key:e.key,user:e.user??null,running:!0,duration:u,showSummary:!0,summaryCollapsible:!1,inlineItems:Qn(e.agentLogs),processedItems:[],finalItems:[]};if(e.agentLogs.length===0)return{key:e.key,user:e.user??null,running:!1,duration:u,showSummary:!1,summaryCollapsible:!1,inlineItems:[],processedItems:[],finalItems:[]};const o=y3(e.agentLogs),c=o>=0?e.agentLogs.slice(0,o):e.agentLogs,d=o>=0?e.agentLogs.slice(o):[],h=c.some(f=>!ds(f));return{key:e.key,user:e.user??null,running:!1,duration:u,showSummary:!0,summaryCollapsible:h,inlineItems:[],processedItems:h?Qn(c):[],finalItems:Qn(d)}}function Jr(e){return`item:${e.key}`}function S3(e,t){const n=[];for(const r of e){if(r.user&&n.push({kind:"user",key:`user:${r.user.id}`,log:r.user}),r.showSummary&&n.push({kind:"summary",key:`summary:${r.key}`,turnKey:r.key,duration:r.duration,collapsible:r.summaryCollapsible}),r.running){for(const i of r.inlineItems)n.push({kind:"item",key:Jr(i),item:i,processed:!1});continue}if(t.has(r.key))for(const i of r.processedItems)n.push({kind:"item",key:Jr(i),item:i,processed:!0});for(const i of r.finalItems)n.push({kind:"item",key:Jr(i),item:i,processed:!1})}return n}function N3(e){if(!e)return 40;switch(e.kind){case"user":return 72;case"summary":return 44;default:return 32}}function I3(e){let t=e?.parentElement??null;for(;t;){const n=window.getComputedStyle(t).overflowY;if(n==="auto"||n==="scroll")return t;t=t.parentElement}return null}const lr=y.memo(({content:e,className:t,workingDir:n,onOpenWorkspaceFile:r,onOpenPreviewUrl:i,onOpenVisualization:s,downloadSessionId:a})=>{const u=y.useMemo(()=>s||a?Jk(e):e,[e,a,s]),o=m3(u),c=y.useMemo(()=>l3({workingDir:n,onOpenWorkspaceFile:r,onOpenPreviewUrl:i,onOpenVisualization:s,downloadSessionId:a}),[a,i,s,r,n]);return p.jsx(xc,{className:kn("session-log-message-markdown",t),components:c,plugins:o,controls:o?c3:void 0,children:u})});lr.displayName="MarkdownMessage";function w3({id:e}){const{data:t}=Tu({queryKey:["message-delivery",e],queryFn:()=>vt.get(`/message-deliveries/${encodeURIComponent(e)}`),staleTime:1/0});return t?p.jsx(Lu,{delivery:t}):null}const Rc=y.createContext(new Map),fs=y.memo(({content:e,deliveryId:t,compact:n,workingDir:r,onOpenWorkspaceFile:i,onOpenPreviewUrl:s})=>{const a=y.useContext(Rc).get(t??"");return p.jsx("div",{className:n?"flex justify-end mb-4 mt-2":"flex justify-end mb-8 mt-4",children:p.jsxs("div",{className:"flex max-w-[85%] min-w-0 flex-col items-end",children:[p.jsxs("div",{className:`relative bg-foreground/[0.08] text-foreground rounded-2xl rounded-tr-sm max-w-full min-w-0 leading-relaxed ${n?"px-3.5 py-2.5 text-[13px]":"px-5 py-3.5 text-sm"}`,children:[p.jsx(lr,{content:e,workingDir:r,onOpenWorkspaceFile:i,onOpenPreviewUrl:s}),a&&p.jsx(Vd,{delivery:a})]}),t&&p.jsx("div",{className:"mt-1 max-w-full px-0.5","data-message-feedback":!0,children:a?p.jsx(Lu,{delivery:a}):p.jsx(w3,{id:t})})]})})});fs.displayName="UserMessage";const ms=y.memo(({content:e,isOpenDefault:t=!0})=>{const[n,r]=y.useState(t),i=y.useRef(null),[s,a]=y.useState(0);y.useEffect(()=>{i.current&&a(i.current.scrollHeight)},[e,n]);const u=y.useMemo(()=>{const c=e.replace(/^Thinking:\s*/i,"").trim().split(`
121
121
  `)[0]||"";return c.length>80?c.slice(0,80)+"…":c},[e]);return p.jsxs("div",{className:"my-1.5",children:[p.jsxs("button",{onClick:()=>r(!n),className:"group flex items-center gap-1.5 py-1 text-xs text-muted-foreground hover:text-foreground transition-colors select-none w-full text-left",children:[p.jsx("span",{className:"shrink-0 w-3.5 h-3.5 flex items-center justify-center transition-transform duration-200",style:{transform:n?"rotate(90deg)":"rotate(0deg)"},children:p.jsx(An,{size:11,strokeWidth:2})}),p.jsx("span",{className:"font-medium",children:"Thinking"}),!n&&u&&p.jsx("span",{className:"truncate text-muted-foreground ml-1 font-normal",children:u})]}),p.jsx("div",{className:"overflow-hidden relative",style:{maxHeight:n?s+16:0},children:p.jsx("div",{ref:i,className:"pl-5 pt-1 pb-2 before:absolute before:left-[7px] before:top-1 before:bottom-2 before:w-px before:bg-border/60",children:p.jsx("div",{className:"text-xs text-muted-foreground leading-relaxed whitespace-pre-wrap min-w-0",children:e.replace(/^Thinking:\s*/i,"").trim()})})})]})});ms.displayName="ThinkingBlock";function Oc(e,t=140){return(e.split(`
122
122
  `)[0]||"").slice(0,t)}function Dc(e){const t=e.title?.replace(/\s*[✓✗]$/,"").replace(/\s*\(待审批\)$/,"");return e.tool?.kind?e.tool.name||t||"Tool":Oc(e.content,140)||e.tool?.name||t||"Tool"}const L3=new Set(["bash","shell","read","write","edit","glob","grep"]);function R3(e){const t=Dc(e),n=e.tool?.name?.trim().toLowerCase();if(!n||!L3.has(n))return t;const r=e.content.match(/(?:^|\n)Input\n([\s\S]*?)(?:\n\nContent\n|$)/i)?.[1]?.trim();if(r)try{const i=JSON.parse(r);if(typeof i.command=="string"){const s=i.command.split(/\s*(?:&&|\|\||;)\s*/)[0]?.trim();if(s)return s.length>72?`${s.slice(0,72)}…`:s}if(typeof i.file_path=="string")return i.file_path.split("/").pop()||i.file_path;if(typeof i.pattern=="string")return i.pattern}catch{}return t}function O3(e){const t=e.flatMap(n=>{if(Lr(n)){const r=Oc(n.content.replace(/^Thinking:\s*/i,"").trim(),72);return r?[r]:[]}return hs(n)?[R3(n)]:[]});return t.filter((n,r)=>r===0||n!==t[r-1])}const Si=y.memo(({title:e,content:t,type:n})=>{const[r,i]=y.useState(!1);if(n===se.Action)return p.jsxs("div",{className:"flex items-center gap-1.5 py-0.5 text-xs text-muted-foreground",children:[p.jsx("span",{className:"shrink-0 w-1 h-1 rounded-full bg-muted-foreground/40"}),p.jsx("span",{children:t})]});const a=e.endsWith("✓"),u=e.endsWith("✗"),o=u?"text-destructive":a?"text-success":"text-muted-foreground/70",c=t?.split(`
123
123
  `)[0]||"",d=c!==e?c:"";return p.jsxs("div",{className:"my-2",children:[p.jsxs("button",{onClick:()=>i(!r),className:"group flex items-center gap-1.5 py-1 text-xs w-full text-left transition-colors",children:[p.jsx("span",{className:`shrink-0 w-3.5 h-3.5 flex items-center justify-center ${o}`,children:u?p.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:p.jsx("path",{d:"M2 2l6 6M8 2l-6 6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}):a?p.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:p.jsx("path",{d:"M2 5.5l2 2 4-4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}):p.jsx("span",{className:"w-1 h-1 rounded-full bg-muted-foreground/40"})}),p.jsx("span",{className:"font-medium text-muted-foreground shrink-0",children:e.replace(/\s*[✓✗]$/,"")}),d&&p.jsx("span",{className:"truncate text-muted-foreground font-mono",children:d}),t&&p.jsx("span",{className:"ml-auto shrink-0 opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground/70",children:r?p.jsx(Su,{size:10}):p.jsx(An,{size:10})})]}),r&&t&&p.jsx("div",{className:"ml-5 mt-0.5 mb-1.5 rounded-md bg-muted/50 border border-border/60 overflow-x-auto",children:p.jsx("code",{className:"block p-2.5 text-xs font-mono text-muted-foreground leading-relaxed whitespace-pre-wrap break-all",children:t})})]})});Si.displayName="ToolBlock";const Pc=y.memo(({count:e})=>{const[t,n]=y.useState(()=>({current:e,previous:null}));return t.current!==e&&n({current:e,previous:t.current}),p.jsxs("span",{className:"agent-tool-count inline-flex items-center justify-center px-1.5 rounded-full bg-muted text-muted-foreground text-[10px] font-medium leading-none tabular-nums",children:[p.jsxs("span",{className:"agent-tool-count__window",style:{width:`${String(e).length}ch`},"aria-hidden":"true",children:[t.previous!==null&&p.jsx("span",{className:"agent-tool-count__value agent-tool-count__value--out whitespace-nowrap min-w-max",onAnimationEnd:()=>n(r=>r.previous===null?r:{...r,previous:null}),children:t.previous},`out-${t.previous}`),p.jsx("span",{className:kn("agent-tool-count__value agent-tool-count__value--in whitespace-nowrap min-w-max",t.previous!==null&&"agent-tool-count__value--rolling"),children:t.current},`in-${t.current}`)]}),p.jsx("span",{className:"sr-only",children:e})]})});Pc.displayName="ToolCountBadge";const Ni=y.memo(({logs:e,onBeforeToggle:t})=>{const{t:n}=Xe(),[r,i]=y.useState(!1),s=e.filter(hs),a=O3(e),u=s.length;return p.jsxs("div",{className:"my-2",children:[p.jsxs("button",{type:"button",onClick:()=>{t?.(),i(!r)},"aria-expanded":r,className:"group flex items-center gap-1.5 py-1 text-xs w-full text-left transition-colors",children:[p.jsx("span",{className:"shrink-0 w-3.5 h-3.5 flex items-center justify-center transition-transform duration-200",style:{transform:r?"rotate(90deg)":"rotate(0deg)"},children:p.jsx(An,{size:11,strokeWidth:2,className:"text-muted-foreground/70"})}),p.jsx("span",{className:"font-medium text-muted-foreground shrink-0",children:n("工具调用")}),p.jsx("span",{className:"shrink-0 inline-flex items-center gap-1",children:p.jsx(Pc,{count:u})}),!r&&p.jsxs("span",{className:"truncate text-muted-foreground font-mono",children:[a.slice(-3).join(", "),a.length>3?" …":""]})]}),r&&p.jsx("div",{className:"ml-5 mt-0.5 mb-1.5",children:e.map(o=>Lr(o)?p.jsx(ms,{content:o.content,isOpenDefault:!1},o.id):p.jsx(vc,{log:o,title:Dc(o),onBeforeToggle:t},o.id))})]})});Ni.displayName="ExecutionDetailsGroup";const vc=y.memo(({log:e,title:t,onBeforeToggle:n})=>{const[r,i]=y.useState(!1),s=!!e.content.trim()&&e.content.trim()!==t.trim(),a=p3(e),u=g3(e)||e.type===se.Error;return p.jsxs("div",{children:[p.jsxs("button",{type:"button",onClick:()=>{s&&(n?.(),i(!r))},"aria-expanded":s?r:void 0,className:`group flex items-center gap-1.5 py-0.5 text-xs w-full text-left ${s?"cursor-pointer":"cursor-default"}`,children:[p.jsx("span",{className:"shrink-0 w-3.5 h-3.5 flex items-center justify-center",children:u?p.jsx("svg",{width:"8",height:"8",viewBox:"0 0 10 10",fill:"none",className:"text-destructive",children:p.jsx("path",{d:"M2 2l6 6M8 2l-6 6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}):a?p.jsx("svg",{width:"8",height:"8",viewBox:"0 0 10 10",fill:"none",className:"text-success",children:p.jsx("path",{d:"M2 5.5l2 2 4-4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}):p.jsx("span",{className:"w-1 h-1 rounded-full bg-muted-foreground/40"})}),p.jsx("span",{className:"truncate text-muted-foreground font-mono",children:t}),s&&p.jsx("span",{className:"ml-auto shrink-0 opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground/70",children:r?p.jsx(Su,{size:10}):p.jsx(An,{size:10})})]}),r&&s&&p.jsx("div",{className:"ml-5 mt-0.5 mb-1 rounded-md bg-muted/50 border border-border/60 overflow-x-auto",children:p.jsx("code",{className:"block p-2.5 text-xs font-mono text-muted-foreground leading-relaxed whitespace-pre-wrap break-all",children:e.content})})]})});vc.displayName="ToolGroupItem";const Mc=y.memo(({content:e,compact:t})=>p.jsx("div",{className:`text-foreground whitespace-pre-wrap min-w-0 ${t?"text-[13px] leading-5":"text-sm leading-6"}`,children:e}));Mc.displayName="AgentText";const Bc=y.createContext(null),Fc=y.memo(({log:e,compact:t,workingDir:n,onOpenWorkspaceFile:r,onOpenPreviewUrl:i,onOpenVisualization:s,downloadSessionId:a})=>{const u=y.useContext(Bc),o=u?Dd(u.sessionId,e,u.overlays):void 0,c=o?.overlays.filter(f=>f.state!=="NOT_REQUIRED")??[],d=o?.content??e.content,h={workingDir:n,onOpenWorkspaceFile:r,onOpenPreviewUrl:i,onOpenVisualization:s,downloadSessionId:a};return p.jsxs("div",{className:`relative text-foreground min-w-0 ${c.length?"pr-8":""} ${t?"text-[13px] leading-5":"text-sm leading-6"}`,children:[p.jsx(zd,{claim:u?.claimReveal,version:o?.version??null,children:p.jsx(lr,{className:"space-y-2",content:d,...h})}),c.length>0&&p.jsx("div",{className:"absolute bottom-0 right-0",children:p.jsxs(wu,{original:e.content,children:[p.jsx(lr,{content:e.content,...h}),c.map(f=>p.jsx(qd,{overlay:f,enabled:u?.enabled??!1},f.sourceId))]},`${e.id}:${e.textBlock?.sourceRevision}`)})]})});Fc.displayName="AssistantMessage";const Hc=y.memo(({content:e})=>p.jsx(Au,{tone:"danger",className:"my-2",children:p.jsx("pre",{className:"text-xs leading-relaxed whitespace-pre-wrap break-all min-w-0",children:e})}));Hc.displayName="ErrorMessage";const Uc=y.memo(({content:e})=>p.jsx(Au,{tone:"warning",className:"my-2",children:p.jsx("pre",{className:"text-xs leading-relaxed whitespace-pre-wrap break-all min-w-0",children:e})}));Uc.displayName="WarningMessage";function fu(e,t){const n=Math.max(0,Math.floor(e/1e3));if(n<60)return t("{count} 秒",{count:n});const r=Math.floor(n/60),i=n%60;if(r<60)return t("{minutes} 分 {seconds} 秒",{minutes:r,seconds:i});const s=Math.floor(r/60),a=r%60;return t("{hours} 小时 {minutes} 分",{hours:s,minutes:a})}const jc=y.memo(({activity:e})=>{const{t}=Xe(),[n]=y.useState(()=>Date.now()),[r,i]=y.useState(n),s=e?.processingStartedAt??n;y.useEffect(()=>{const c=window.setInterval(()=>i(Date.now()),1e3);return()=>window.clearInterval(c)},[]);const a=fu(r-s,t),u=e?.lastOutputAt==null?null:fu(r-e.lastOutputAt,t),o=t("正在思考");return p.jsx(zk,{align:"start",content:p.jsxs("div",{className:"flex min-w-max flex-col gap-0.5",children:[p.jsx("span",{children:t("已处理 {duration}",{duration:a})}),p.jsx("span",{className:"text-inverse-muted",children:u?t("最后一次输出于 {duration}前",{duration:u}):t("等待首次输出")})]}),children:p.jsx("span",{tabIndex:0,"aria-label":o,className:"inline-flex cursor-help select-none py-1 text-sm font-normal outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:p.jsx("span",{className:"agent-thinking-shimmer","aria-hidden":"true",children:Array.from(o).map((c,d)=>p.jsx("span",{className:"agent-thinking-char",style:{animationDelay:`${d*45}ms`},children:c},`${c}-${d}`))})})})});jc.displayName="ThinkingIndicator";const zc=y.memo(({turnKey:e,duration:t,collapsible:n,isOpen:r,onToggle:i,onBeforeToggle:s})=>{const{t:a}=Xe(),u=t?a("已处理 {duration}",{duration:t}):a("已处理"),o=p.jsxs(p.Fragment,{children:[p.jsx("span",{children:u}),n&&p.jsx("span",{className:"flex size-4 shrink-0 items-center justify-center transition-transform duration-200 motion-reduce:transition-none",style:{transform:r?"rotate(90deg)":"rotate(0deg)"},children:p.jsx(An,{size:14,strokeWidth:2})})]});return n?p.jsx("div",{className:"mb-3 mt-1",children:p.jsx("button",{type:"button","data-at-group-header":e,"aria-expanded":r,onClick:()=>{s?.(),i(e)},className:"group flex w-full items-center gap-1.5 border-b border-border/60 py-2 text-left text-sm leading-6 text-muted-foreground transition-colors hover:text-foreground/80",children:o})}):p.jsx("div",{className:"mb-3 mt-1",children:p.jsx("div",{role:"status",className:"flex w-full items-center gap-1.5 border-b border-border/60 py-2 text-sm leading-6 text-muted-foreground",children:o})})});zc.displayName="ProcessedGroupSummary";function D3(e,t,n,r,i,s,a,u){if(e.kind==="execution-group")return p.jsx(Ni,{logs:e.logs,onBeforeToggle:u});const o=e.log;if(o.type===se.Tool&&o.children?.length)return p.jsx(Ni,{logs:o.children,onBeforeToggle:u});if(ds(o))return null;if(o.title==="Thinking"||o.content.startsWith("Thinking:"))return p.jsx(ms,{content:o.content,isOpenDefault:!0});switch(o.type){case se.User:return p.jsx(fs,{content:o.content,deliveryId:o.deliveryId,compact:t,workingDir:n,onOpenWorkspaceFile:r,onOpenPreviewUrl:i});case se.Tool:return p.jsx(Si,{type:o.type,title:o.title||"Tool",content:o.content});case se.Action:return p.jsx(Si,{type:o.type,title:"Action",content:o.content});case se.Assistant:return p.jsx(Fc,{log:o,compact:t,workingDir:n,onOpenWorkspaceFile:r,onOpenPreviewUrl:i,onOpenVisualization:s,downloadSessionId:a});case se.Info:return o.tokenUsage?null:p.jsx(Mc,{content:o.content,compact:t});case se.Error:return p.jsx(Hc,{content:o.content});case se.Warning:return p.jsx(Uc,{content:o.content});case se.Cursor:return p.jsx(jc,{activity:o.cursorActivity});default:return null}}const P3=8,v3=y.forwardRef(function(t,n){const r=Md(t.sessionId,t.logs),i=Cu(),s=y.useMemo(()=>t.logs.flatMap(k=>k.textBlock?xu(k.content,k.textBlock).map(S=>({id:JSON.stringify([S.turnId,S.blockId]),revision:S.sourceRevision,streaming:k.textBlock.state==="OPEN"})):[]),[t.logs]),a=y.useMemo(()=>Od(r.overlays),[r.overlays]),u=Fd(t.sessionId,s,r.overlays.map(k=>({id:JSON.stringify([k.turnId,k.blockId]),version:`${k.sourceId}:${k.sourceRevision}`,state:k.state})),t.logs.some(k=>k.type!==se.Cursor)),o=y.useMemo(()=>({sessionId:t.sessionId,overlays:a,claimReveal:u,enabled:!i.isError&&i.data?.enabled===!0}),[t.sessionId,i.data?.enabled,i.isError,a,u]),c=_s(t.sessionId),d=_s(t.sessionId,"sent"),h=y.useMemo(()=>new Map([...c.data?.pages.flatMap(k=>k.items)??[],...d.data?.pages.flatMap(k=>k.items)??[]].sort((k,S)=>k.revision-S.revision).map(k=>[k.id,k])),[c.data,d.data]),f=y.useMemo(()=>[...h.values()].map(k=>k.clientSubmissionId),[h]),m=gd(t.sessionId,f),b=y.useMemo(()=>wd(t.logs,[...h.values()]),[t.logs,h]);return p.jsx(Bc.Provider,{value:o,children:p.jsxs(Rc.Provider,{value:h,children:[p.jsx($c,{...t,logs:b,ref:n}),m.filter(k=>![...h.values()].some(S=>S.clientSubmissionId===k.id)).map(k=>p.jsx(Ld,{item:k},k.id)),c.hasNextPage&&p.jsx("button",{type:"button",className:"text-xs underline",onClick:()=>{c.fetchNextPage()},children:"Load more"})]})})}),iy=y.forwardRef(function(t,n){return t.sessionId?p.jsx(v3,{...t,sessionId:t.sessionId,ref:n},t.sessionId):p.jsx($c,{...t,ref:n})}),$c=y.forwardRef(function({logs:t,isOutputActive:n,lastExitAt:r,onUserToggleDetails:i,scrollElementRef:s,workingDir:a,onOpenWorkspaceFile:u,onOpenPreviewUrl:o,onOpenVisualization:c,downloadSessionId:d},h){const[f,m]=y.useState(null),[b,k]=y.useState(!1),[S,_]=y.useState(0),[L,I]=y.useState(()=>new Set),[B,z]=y.useState(()=>Date.now());y.useEffect(()=>{if(!n)return;const F=()=>z(Date.now()),W=window.setTimeout(F,0),ue=window.setInterval(F,1e3);return()=>{window.clearTimeout(W),window.clearInterval(ue)}},[n]);const R=y.useCallback(F=>{if(!F)return;const W=s?.current??I3(F);m(ue=>ue===W?ue:W),_(W?.clientHeight??0),k(!0)},[s]);y.useEffect(()=>{if(!f)return;const F=()=>_(f.clientHeight);if(F(),typeof ResizeObserver>"u")return;const W=new ResizeObserver(F);return W.observe(f),()=>W.disconnect()},[f]);const $=y.useCallback(F=>{I(W=>{const ue=new Set(W);return ue.has(F)?ue.delete(F):ue.add(F),ue})},[]),G=y.useMemo(()=>{if(n===void 0)return null;const F=k3(t),W=F.length-1;return F.map((ue,re)=>C3(ue,re===W,n,r))},[t,n,r]),K=y.useMemo(()=>n===void 0?Qn(t):null,[n,t]),N=y.useMemo(()=>K?K.map(F=>({kind:"item",key:`legacy:${F.key}`,item:F,processed:!1})):S3(G??[],L),[L,K,G]),U=ih({count:N.length,getScrollElement:()=>f,estimateSize:F=>N3(N[F]),getItemKey:F=>N[F]?.key??F,overscan:P3,measureElement:F=>F.getBoundingClientRect().height});U.shouldAdjustScrollPositionOnItemSizeChange=sh;const v=f!==null&&S>0;y.useImperativeHandle(h,()=>({scrollToBottom:(F="instant")=>{const W=s?.current;if(!W||(v&&N.length>0&&U.scrollToIndex(N.length-1,{align:"end"}),W.scrollTo({top:W.scrollHeight,behavior:F}),F!=="instant"))return;let ue=0;const re=()=>{const x=s?.current;x&&(x.scrollHeight-x.scrollTop-x.clientHeight<=1||(x.scrollTop=x.scrollHeight,++ue<5&&requestAnimationFrame(re)))};requestAnimationFrame(re)}}),[v,N.length,s,U]);const V=y.useCallback(F=>{const W=F.end===null?B:F.end;return A3(F.start,W)},[B]),q=y.useCallback(F=>{switch(F.kind){case"user":return p.jsx(fs,{content:F.log.content,deliveryId:F.log.deliveryId,workingDir:a,onOpenWorkspaceFile:u,onOpenPreviewUrl:o});case"summary":return p.jsx(zc,{turnKey:F.turnKey,duration:V(F.duration),collapsible:F.collapsible,isOpen:L.has(F.turnKey),onToggle:$,onBeforeToggle:i});case"item":return D3(F.item,!1,a,u,o,c,d,i);default:return null}},[d,V,L,o,c,u,i,$,a]),j=U.getVirtualItems();return b?p.jsx("div",{ref:R,className:"w-full mx-auto pb-4 min-w-0",style:{overflowWrap:"anywhere"},children:v?p.jsx("div",{style:{height:U.getTotalSize(),width:"100%",position:"relative"},children:j.map(F=>{const W=N[F.index];return W?p.jsx("div",{"data-index":F.index,"data-at-row":W.key,...W.kind==="item"&&W.processed?{"data-processed-content":""}:{},ref:U.measureElement,style:{position:"absolute",top:F.start,left:0,width:"100%"},children:q(W)},W.key):null})},"virtualized"):p.jsx("div",{children:N.map(F=>p.jsx("div",{"data-at-row":F.key,...F.kind==="item"&&F.processed?{"data-processed-content":""}:{},children:q(F)},F.key))},"static")}):p.jsx("div",{ref:R,className:"w-full mx-auto pb-4 min-w-0",style:{overflowWrap:"anywhere"}})}),M3=/^(0|[1-9]\d*)$/,B3=2147483647;function F3(e,t){if(!Array.isArray(t))return Fe("patch sequence must be an array");let n=e;for(const r of t){const i=H3(n,r);if(!i.ok)return i;n=i.conversation}return{ok:!0,conversation:n}}function H3(e,t){if(!dr(t))return Fe("operation is not an object");const n=z3(t.path);return n?t.op==="add"?U3(e,n,t):t.op==="replace"?j3(e,n,t):$e(t):$e(t)}function U3(e,t,n){if(n.value===void 0)return Fe("operation value is required");if(hr(n.value))return Fe("operation value cannot contain undefined");if(t.length===1&&t[0]==="sessionId")return Ot({...e,sessionId:n.value});if(t[0]!=="entries"||t.length!==2)return $e(n);const r=qc(t[1]);if(r===void 0)return $e(n);if(!Array.isArray(e.entries))return Fe("entries is not an array");if(r>e.entries.length)return $e(n);const i=e.entries.slice();return i.splice(r,0,n.value),Ot(cr(e,i))}function j3(e,t,n){if(n.value===void 0)return Fe("operation value is required");if(hr(n.value))return Fe("operation value cannot contain undefined");if(t.length===1&&t[0]==="entries"){const d=n.value,h=Array.isArray(d)?d.slice():d;return Ot(cr(e,h))}if(t[0]!=="entries")return $e(n);const r=qc(t[1]);if(r===void 0)return $e(n);if(!Array.isArray(e.entries))return Fe("entries is not an array");const i=t.length===2,s=t.length===3&&t[2]==="content",a=t.length===4&&t[2]==="metadata"&&t[3]==="status";if(!i&&!s&&!a)return $e(n);if(i){if(r>=e.entries.length)return $e(n);const d=e.entries.slice();return d[r]=n.value,Ot(cr(e,d))}const u=e.entries[r];if(!dr(u))return Fe("entry does not exist");if(s)return u.content===void 0?Fe("entry content does not exist"):Ot(mu(e,r,{...u,content:n.value}));const o=u.metadata;if(!dr(o)||o.status===void 0)return Fe("entry metadata status does not exist");const c={...o,status:n.value};return Ot(mu(e,r,{...u,metadata:c}))}function mu(e,t,n){const r=e.entries.slice();return r[t]=n,cr(e,r)}function cr(e,t){return{...e,entries:t}}function z3(e){if(!(typeof e!="string"||!e.startsWith("/")))return e.slice(1).split("/")}function qc(e){if(!M3.test(e))return;const t=Number(e);if(Number.isSafeInteger(t))return t<=B3?t:void 0}function dr(e){return typeof e=="object"&&e!==null}function hr(e){return e===void 0?!0:Array.isArray(e)?e.some(hr):dr(e)?Object.keys(e).some(t=>hr(e[t])):!1}function Ot(e){return{ok:!0,conversation:e}}function Fe(e){return{ok:!1,kind:"failed",reason:e}}function $e(e){return console.warn("[sessionLogStore] unsupported conversation patch op/path",{op:e.op,path:e.path}),{ok:!1,kind:"unsupported",reason:`unsupported op/path: ${String(e.op)} ${String(e.path)}`}}const sy={entries:[],isTruncated:!1},$3=50,pu=500;function gu(e){return typeof e?.seq=="number"?e.seq:0}function bu(e){return e?.entries.at(-1)?.id}function Eu(e){const t=e?.entries.at(-1);if(t)return JSON.stringify(t)}function ay(e){return{...e,entries:Array.isArray(e.entries)?e.entries:[],isTruncated:!1}}function uy(e,t){if(!e||e.isTruncated)return!0;const n=gu(e),r=gu(t);if(r>n)return!0;if(r<n)return!1;if(t.entries.length>e.entries.length)return!0;if(t.entries.length<e.entries.length)return!1;const i=bu(e),s=bu(t);if(s&&i&&s!==i)return!0;const a=Eu(e),u=Eu(t);return!!(u&&a&&u!==a)}function q3(e,t){for(;t.length>$3;){const n=t[0];t=t.slice(1);const{[n]:r,...i}=e;e=i}return{conversations:e,accessOrder:t}}const oy=fd((e,t)=>({conversations:{},accessOrder:[],setConversation:(n,r)=>{e(i=>{const s=i.accessOrder.filter(u=>u!==n);s.push(n);const a={...i.conversations,[n]:{...r,isTruncated:r.isTruncated??!1}};return q3(a,s)})},applyPatch:(n,r,i)=>{const s=t().conversations[n];if(!s)return!1;if(typeof i=="number"&&typeof s.seq=="number"&&i<=s.seq)return!0;const a=F3(s,r);if(!a.ok)return a.kind==="failed"&&console.error("[sessionLogStore] applyPatch failed:",a.reason),!1;const u={...a.conversation,seq:typeof i=="number"?i:s.seq,isTruncated:s.isTruncated??!1};return e(o=>({conversations:{...o.conversations,[n]:u}})),!0},touchAccess:n=>{e(r=>{const i=r.accessOrder.indexOf(n);if(i===-1||i===r.accessOrder.length-1)return r;const s=[...r.accessOrder];return s.splice(i,1),s.push(n),{accessOrder:s}})},truncateSession:n=>{e(r=>{const i=r.conversations[n];return!i||i.entries.length<=pu?r:{conversations:{...r.conversations,[n]:{...i,entries:i.entries.slice(-pu),isTruncated:!0}}}})},removeSession:n=>{e(r=>{const{[n]:i,...s}=r.conversations;return{conversations:s,accessOrder:r.accessOrder.filter(a=>a!==n)}})},getConversation:n=>t().conversations[n],clear:()=>{e({conversations:{},accessOrder:[]})}})),Y3=Object.freeze(Object.defineProperty({__proto__:null,Mermaid:kc},Symbol.toStringTag,{value:"Module"}));export{sy as E,Kx as I,Pe as L,Vd as M,Ld as O,xc as Q,zk as T,ey as Z,iy as a,F3 as b,uy as c,qn as d,_s as e,Lu as f,Q as g,ih as h,sh as i,Fd as j,zd as k,wu as l,Yd as m,ay as n,m3 as o,Jk as p,l3 as q,Hd as r,o3 as s,c3 as t,oy as u,ny as v,du as w,ty as x,ry as y};
@@ -1 +1 @@
1
- import{c as a}from"./index-Cc3qXMhU.js";const e=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],o=a("message-square",e);export{o as M};
1
+ import{c as a}from"./index-BszkzNS4.js";const e=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],o=a("message-square",e);export{o as M};
@@ -1,4 +1,4 @@
1
- import{g as ae}from"./chunk-55IACEB6-qMTCQ5bX.js";import{s as ce}from"./chunk-2J33WTMH-DeCj8QSD.js";import{_ as h,l as I,o as le,r as he,D as de,G as j,c as P,i as G,b3 as ge,ac as ue,ad as pe,ae as fe}from"./index-Dh-tgeaL.js";import"./index-Cc3qXMhU.js";const _=[];for(let t=0;t<256;++t)_.push((t+256).toString(16).slice(1));function me(t,e=0){return(_[t[e+0]]+_[t[e+1]]+_[t[e+2]]+_[t[e+3]]+"-"+_[t[e+4]]+_[t[e+5]]+"-"+_[t[e+6]]+_[t[e+7]]+"-"+_[t[e+8]]+_[t[e+9]]+"-"+_[t[e+10]]+_[t[e+11]]+_[t[e+12]]+_[t[e+13]]+_[t[e+14]]+_[t[e+15]]).toLowerCase()}const ye=new Uint8Array(16);function Ee(){return crypto.getRandomValues(ye)}function _e(t,e,a){return crypto.randomUUID?crypto.randomUUID():be(t)}function be(t,e,a){t=t||{};const l=t.random??t.rng?.()??Ee();if(l.length<16)throw new Error("Random bytes length must be >= 16");return l[6]=l[6]&15|64,l[8]=l[8]&63|128,me(l)}var q=(function(){var t=h(function(L,s,i,o){for(i=i||{},o=L.length;o--;i[L[o]]=s);return i},"o"),e=[1,4],a=[1,13],l=[1,12],n=[1,15],d=[1,16],f=[1,20],y=[1,19],E=[6,7,8],b=[1,26],v=[1,24],R=[1,25],g=[6,7,11],A=[1,6,13,15,16,19,22],J=[1,33],K=[1,34],$=[1,6,7,11,13,15,16,19,22],H={trace:h(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,MINDMAP:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,ICON:15,CLASS:16,nodeWithId:17,nodeWithoutId:18,NODE_DSTART:19,NODE_DESCR:20,NODE_DEND:21,NODE_ID:22,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"MINDMAP",11:"EOF",13:"SPACELIST",15:"ICON",16:"CLASS",19:"NODE_DSTART",20:"NODE_DESCR",21:"NODE_DEND",22:"NODE_ID"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[18,3],[17,1],[17,4]],performAction:h(function(s,i,o,c,p,r,B){var u=r.length-1;switch(p){case 6:case 7:return c;case 8:c.getLogger().trace("Stop NL ");break;case 9:c.getLogger().trace("Stop EOF ");break;case 11:c.getLogger().trace("Stop NL2 ");break;case 12:c.getLogger().trace("Stop EOF2 ");break;case 15:c.getLogger().info("Node: ",r[u].id),c.addNode(r[u-1].length,r[u].id,r[u].descr,r[u].type);break;case 16:c.getLogger().trace("Icon: ",r[u]),c.decorateNode({icon:r[u]});break;case 17:case 21:c.decorateNode({class:r[u]});break;case 18:c.getLogger().trace("SPACELIST");break;case 19:c.getLogger().trace("Node: ",r[u].id),c.addNode(0,r[u].id,r[u].descr,r[u].type);break;case 20:c.decorateNode({icon:r[u]});break;case 25:c.getLogger().trace("node found ..",r[u-2]),this.$={id:r[u-1],descr:r[u-1],type:c.getType(r[u-2],r[u])};break;case 26:this.$={id:r[u],descr:r[u],type:c.nodeType.DEFAULT};break;case 27:c.getLogger().trace("node found ..",r[u-3]),this.$={id:r[u-3],descr:r[u-1],type:c.getType(r[u-2],r[u])};break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:e},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:e},{6:a,7:[1,10],9:9,12:11,13:l,14:14,15:n,16:d,17:17,18:18,19:f,22:y},t(E,[2,3]),{1:[2,2]},t(E,[2,4]),t(E,[2,5]),{1:[2,6],6:a,12:21,13:l,14:14,15:n,16:d,17:17,18:18,19:f,22:y},{6:a,9:22,12:11,13:l,14:14,15:n,16:d,17:17,18:18,19:f,22:y},{6:b,7:v,10:23,11:R},t(g,[2,22],{17:17,18:18,14:27,15:[1,28],16:[1,29],19:f,22:y}),t(g,[2,18]),t(g,[2,19]),t(g,[2,20]),t(g,[2,21]),t(g,[2,23]),t(g,[2,24]),t(g,[2,26],{19:[1,30]}),{20:[1,31]},{6:b,7:v,10:32,11:R},{1:[2,7],6:a,12:21,13:l,14:14,15:n,16:d,17:17,18:18,19:f,22:y},t(A,[2,14],{7:J,11:K}),t($,[2,8]),t($,[2,9]),t($,[2,10]),t(g,[2,15]),t(g,[2,16]),t(g,[2,17]),{20:[1,35]},{21:[1,36]},t(A,[2,13],{7:J,11:K}),t($,[2,11]),t($,[2,12]),{21:[1,37]},t(g,[2,25]),t(g,[2,27])],defaultActions:{2:[2,1],6:[2,2]},parseError:h(function(s,i){if(i.recoverable)this.trace(s);else{var o=new Error(s);throw o.hash=i,o}},"parseError"),parse:h(function(s){var i=this,o=[0],c=[],p=[null],r=[],B=this.table,u="",U=0,Q=0,ie=2,Z=1,se=r.slice.call(arguments,1),m=Object.create(this.lexer),T={yy:{}};for(var W in this.yy)Object.prototype.hasOwnProperty.call(this.yy,W)&&(T.yy[W]=this.yy[W]);m.setInput(s,T.yy),T.yy.lexer=m,T.yy.parser=this,typeof m.yylloc>"u"&&(m.yylloc={});var z=m.yylloc;r.push(z);var re=m.options&&m.options.ranges;typeof T.yy.parseError=="function"?this.parseError=T.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function oe(S){o.length=o.length-2*S,p.length=p.length-S,r.length=r.length-S}h(oe,"popStack");function ee(){var S;return S=c.pop()||m.lex()||Z,typeof S!="number"&&(S instanceof Array&&(c=S,S=c.pop()),S=i.symbols_[S]||S),S}h(ee,"lex");for(var k,O,x,X,C={},V,N,te,F;;){if(O=o[o.length-1],this.defaultActions[O]?x=this.defaultActions[O]:((k===null||typeof k>"u")&&(k=ee()),x=B[O]&&B[O][k]),typeof x>"u"||!x.length||!x[0]){var Y="";F=[];for(V in B[O])this.terminals_[V]&&V>ie&&F.push("'"+this.terminals_[V]+"'");m.showPosition?Y="Parse error on line "+(U+1)+`:
1
+ import{g as ae}from"./chunk-55IACEB6-DqkKXsbD.js";import{s as ce}from"./chunk-2J33WTMH-CWR7tRuT.js";import{_ as h,l as I,o as le,r as he,D as de,G as j,c as P,i as G,b3 as ge,ac as ue,ad as pe,ae as fe}from"./index-B8xoIIa6.js";import"./index-BszkzNS4.js";const _=[];for(let t=0;t<256;++t)_.push((t+256).toString(16).slice(1));function me(t,e=0){return(_[t[e+0]]+_[t[e+1]]+_[t[e+2]]+_[t[e+3]]+"-"+_[t[e+4]]+_[t[e+5]]+"-"+_[t[e+6]]+_[t[e+7]]+"-"+_[t[e+8]]+_[t[e+9]]+"-"+_[t[e+10]]+_[t[e+11]]+_[t[e+12]]+_[t[e+13]]+_[t[e+14]]+_[t[e+15]]).toLowerCase()}const ye=new Uint8Array(16);function Ee(){return crypto.getRandomValues(ye)}function _e(t,e,a){return crypto.randomUUID?crypto.randomUUID():be(t)}function be(t,e,a){t=t||{};const l=t.random??t.rng?.()??Ee();if(l.length<16)throw new Error("Random bytes length must be >= 16");return l[6]=l[6]&15|64,l[8]=l[8]&63|128,me(l)}var q=(function(){var t=h(function(L,s,i,o){for(i=i||{},o=L.length;o--;i[L[o]]=s);return i},"o"),e=[1,4],a=[1,13],l=[1,12],n=[1,15],d=[1,16],f=[1,20],y=[1,19],E=[6,7,8],b=[1,26],v=[1,24],R=[1,25],g=[6,7,11],A=[1,6,13,15,16,19,22],J=[1,33],K=[1,34],$=[1,6,7,11,13,15,16,19,22],H={trace:h(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,MINDMAP:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,ICON:15,CLASS:16,nodeWithId:17,nodeWithoutId:18,NODE_DSTART:19,NODE_DESCR:20,NODE_DEND:21,NODE_ID:22,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"MINDMAP",11:"EOF",13:"SPACELIST",15:"ICON",16:"CLASS",19:"NODE_DSTART",20:"NODE_DESCR",21:"NODE_DEND",22:"NODE_ID"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[18,3],[17,1],[17,4]],performAction:h(function(s,i,o,c,p,r,B){var u=r.length-1;switch(p){case 6:case 7:return c;case 8:c.getLogger().trace("Stop NL ");break;case 9:c.getLogger().trace("Stop EOF ");break;case 11:c.getLogger().trace("Stop NL2 ");break;case 12:c.getLogger().trace("Stop EOF2 ");break;case 15:c.getLogger().info("Node: ",r[u].id),c.addNode(r[u-1].length,r[u].id,r[u].descr,r[u].type);break;case 16:c.getLogger().trace("Icon: ",r[u]),c.decorateNode({icon:r[u]});break;case 17:case 21:c.decorateNode({class:r[u]});break;case 18:c.getLogger().trace("SPACELIST");break;case 19:c.getLogger().trace("Node: ",r[u].id),c.addNode(0,r[u].id,r[u].descr,r[u].type);break;case 20:c.decorateNode({icon:r[u]});break;case 25:c.getLogger().trace("node found ..",r[u-2]),this.$={id:r[u-1],descr:r[u-1],type:c.getType(r[u-2],r[u])};break;case 26:this.$={id:r[u],descr:r[u],type:c.nodeType.DEFAULT};break;case 27:c.getLogger().trace("node found ..",r[u-3]),this.$={id:r[u-3],descr:r[u-1],type:c.getType(r[u-2],r[u])};break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:e},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:e},{6:a,7:[1,10],9:9,12:11,13:l,14:14,15:n,16:d,17:17,18:18,19:f,22:y},t(E,[2,3]),{1:[2,2]},t(E,[2,4]),t(E,[2,5]),{1:[2,6],6:a,12:21,13:l,14:14,15:n,16:d,17:17,18:18,19:f,22:y},{6:a,9:22,12:11,13:l,14:14,15:n,16:d,17:17,18:18,19:f,22:y},{6:b,7:v,10:23,11:R},t(g,[2,22],{17:17,18:18,14:27,15:[1,28],16:[1,29],19:f,22:y}),t(g,[2,18]),t(g,[2,19]),t(g,[2,20]),t(g,[2,21]),t(g,[2,23]),t(g,[2,24]),t(g,[2,26],{19:[1,30]}),{20:[1,31]},{6:b,7:v,10:32,11:R},{1:[2,7],6:a,12:21,13:l,14:14,15:n,16:d,17:17,18:18,19:f,22:y},t(A,[2,14],{7:J,11:K}),t($,[2,8]),t($,[2,9]),t($,[2,10]),t(g,[2,15]),t(g,[2,16]),t(g,[2,17]),{20:[1,35]},{21:[1,36]},t(A,[2,13],{7:J,11:K}),t($,[2,11]),t($,[2,12]),{21:[1,37]},t(g,[2,25]),t(g,[2,27])],defaultActions:{2:[2,1],6:[2,2]},parseError:h(function(s,i){if(i.recoverable)this.trace(s);else{var o=new Error(s);throw o.hash=i,o}},"parseError"),parse:h(function(s){var i=this,o=[0],c=[],p=[null],r=[],B=this.table,u="",U=0,Q=0,ie=2,Z=1,se=r.slice.call(arguments,1),m=Object.create(this.lexer),T={yy:{}};for(var W in this.yy)Object.prototype.hasOwnProperty.call(this.yy,W)&&(T.yy[W]=this.yy[W]);m.setInput(s,T.yy),T.yy.lexer=m,T.yy.parser=this,typeof m.yylloc>"u"&&(m.yylloc={});var z=m.yylloc;r.push(z);var re=m.options&&m.options.ranges;typeof T.yy.parseError=="function"?this.parseError=T.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function oe(S){o.length=o.length-2*S,p.length=p.length-S,r.length=r.length-S}h(oe,"popStack");function ee(){var S;return S=c.pop()||m.lex()||Z,typeof S!="number"&&(S instanceof Array&&(c=S,S=c.pop()),S=i.symbols_[S]||S),S}h(ee,"lex");for(var k,O,x,X,C={},V,N,te,F;;){if(O=o[o.length-1],this.defaultActions[O]?x=this.defaultActions[O]:((k===null||typeof k>"u")&&(k=ee()),x=B[O]&&B[O][k]),typeof x>"u"||!x.length||!x[0]){var Y="";F=[];for(V in B[O])this.terminals_[V]&&V>ie&&F.push("'"+this.terminals_[V]+"'");m.showPosition?Y="Parse error on line "+(U+1)+`:
2
2
  `+m.showPosition()+`
3
3
  Expecting `+F.join(", ")+", got '"+(this.terminals_[k]||k)+"'":Y="Parse error on line "+(U+1)+": Unexpected "+(k==Z?"end of input":"'"+(this.terminals_[k]||k)+"'"),this.parseError(Y,{text:m.match,token:this.terminals_[k]||k,line:m.yylineno,loc:z,expected:F})}if(x[0]instanceof Array&&x.length>1)throw new Error("Parse Error: multiple actions possible at state: "+O+", token: "+k);switch(x[0]){case 1:o.push(k),p.push(m.yytext),r.push(m.yylloc),o.push(x[1]),k=null,Q=m.yyleng,u=m.yytext,U=m.yylineno,z=m.yylloc;break;case 2:if(N=this.productions_[x[1]][1],C.$=p[p.length-N],C._$={first_line:r[r.length-(N||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(N||1)].first_column,last_column:r[r.length-1].last_column},re&&(C._$.range=[r[r.length-(N||1)].range[0],r[r.length-1].range[1]]),X=this.performAction.apply(C,[u,Q,U,T.yy,x[1],p,r].concat(se)),typeof X<"u")return X;N&&(o=o.slice(0,-1*N*2),p=p.slice(0,-1*N),r=r.slice(0,-1*N)),o.push(this.productions_[x[1]][0]),p.push(C.$),r.push(C._$),te=B[o[o.length-2]][o[o.length-1]],o.push(te);break;case 3:return!0}}return!0},"parse")},ne=(function(){var L={EOF:1,parseError:h(function(i,o){if(this.yy.parser)this.yy.parser.parseError(i,o);else throw new Error(i)},"parseError"),setInput:h(function(s,i){return this.yy=i||this.yy||{},this._input=s,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:h(function(){var s=this._input[0];this.yytext+=s,this.yyleng++,this.offset++,this.match+=s,this.matched+=s;var i=s.match(/(?:\r\n?|\n).*/g);return i?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),s},"input"),unput:h(function(s){var i=s.length,o=s.split(/(?:\r\n?|\n)/g);this._input=s+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-i),this.offset-=i;var c=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),o.length-1&&(this.yylineno-=o.length-1);var p=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:o?(o.length===c.length?this.yylloc.first_column:0)+c[c.length-o.length].length-o[0].length:this.yylloc.first_column-i},this.options.ranges&&(this.yylloc.range=[p[0],p[0]+this.yyleng-i]),this.yyleng=this.yytext.length,this},"unput"),more:h(function(){return this._more=!0,this},"more"),reject:h(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:h(function(s){this.unput(this.match.slice(s))},"less"),pastInput:h(function(){var s=this.matched.substr(0,this.matched.length-this.match.length);return(s.length>20?"...":"")+s.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:h(function(){var s=this.match;return s.length<20&&(s+=this._input.substr(0,20-s.length)),(s.substr(0,20)+(s.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:h(function(){var s=this.pastInput(),i=new Array(s.length+1).join("-");return s+this.upcomingInput()+`
@@ -1 +1 @@
1
- import{H as c,j as e,l as p}from"./index-Cc3qXMhU.js";import{D as u,a as m}from"./dialog-D1lkhqVL.js";const g=({isOpen:a,onClose:n,title:s,children:r,action:t,className:l})=>(c(a),e.jsx(u,{open:a,onOpenChange:o=>{o||n()},children:e.jsx(m,{title:s,footer:t,className:p("max-w-lg",l),onOpenAutoFocus:o=>{o.preventDefault(),o.currentTarget?.focus()},children:r})}));export{g as M};
1
+ import{H as c,j as e,l as p}from"./index-BszkzNS4.js";import{D as u,a as m}from"./dialog-DV4wfpNU.js";const g=({isOpen:a,onClose:n,title:s,children:r,action:t,className:l})=>(c(a),e.jsx(u,{open:a,onOpenChange:o=>{o||n()},children:e.jsx(m,{title:s,footer:t,className:p("max-w-lg",l),onOpenAutoFocus:o=>{o.preventDefault(),o.currentTarget?.focus()},children:r})}));export{g as M};