@xopcai/xopc 0.0.432 → 0.0.434

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 (659) hide show
  1. package/README.md +5 -5
  2. package/README.zh-CN.md +5 -5
  3. package/dist/browser-ext/dist/sidepanel.js +11 -0
  4. package/dist/browser-ext/manifest.json +1 -1
  5. package/dist/extensions/feishu/src/adapters/cli-login.js +3 -3
  6. package/dist/extensions/feishu/src/outbound/media-load.js +1 -1
  7. package/dist/extensions/telegram/src/inbound-processor.js +2 -2
  8. package/dist/extensions/telegram/src/outbound-sender.js +1 -1
  9. package/dist/extensions/telegram/src/plugin.js +2 -2
  10. package/dist/extensions/telegram/xopc.extension.json +1 -1
  11. package/dist/extensions/weixin/src/api/api.js +2 -2
  12. package/dist/extensions/weixin/src/auth/accounts.js +12 -12
  13. package/dist/extensions/weixin/src/messaging/debug-mode.js +5 -5
  14. package/dist/extensions/weixin/src/messaging/inbound.js +11 -11
  15. package/dist/gateway/static/root/assets/{activity-store-iTw0JzOx.js → activity-store-Cwn_CNwl.js} +1 -1
  16. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CXuMwQ4y.js → agent-avatar-dicebear-Cd23LnJJ.js} +1 -1
  17. package/dist/gateway/static/root/assets/{agent-avatar-display-hRyDKdPJ.js → agent-avatar-display-ByzM7u9S.js} +2 -2
  18. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-BBRKBHLB.js → agent-defaults-settings-panel-B0i37diS.js} +1 -1
  19. package/dist/gateway/static/root/assets/{agent-plugin-dialog-PoKk6j20.js → agent-plugin-dialog-XN-tZ-Ox.js} +1 -1
  20. package/dist/gateway/static/root/assets/{agents--P5-QEHR.js → agents-ZDA1OaLv.js} +3 -3
  21. package/dist/gateway/static/root/assets/{agents-admin-api-DuYzWKP8.js → agents-admin-api-B5lKH_ps.js} +1 -1
  22. package/dist/gateway/static/root/assets/{api-DT_Aly4B.js → api-B9fZL-V8.js} +1 -1
  23. package/dist/gateway/static/root/assets/{api-BeNB3MkI.js → api-Djju8qIR.js} +1 -1
  24. package/dist/gateway/static/root/assets/{app-management-settings-panel-C4JhA-Kz.js → app-management-settings-panel-IlyzDPJu.js} +1 -1
  25. package/dist/gateway/static/root/assets/{appearance-settings-YM311zxY.js → appearance-settings-BxdFGob3.js} +1 -1
  26. package/dist/gateway/static/root/assets/apps-page-CxEKiOTA.js +1 -0
  27. package/dist/gateway/static/root/assets/{archive-plugin-DoYjGZv1.js → archive-plugin-4gEvotPr.js} +1 -1
  28. package/dist/gateway/static/root/assets/{automation-api-ZD1VY9jO.js → automation-api-4fVKv9PJ.js} +1 -1
  29. package/dist/gateway/static/root/assets/{automation-result-state-BO5N3gMt.js → automation-result-state-m7PeK2kl.js} +1 -1
  30. package/dist/gateway/static/root/assets/automation-run-list-CJOdy_R2.js +1 -0
  31. package/dist/gateway/static/root/assets/{automation-task-card--K7uiKHL.js → automation-task-card-DZWhCWJa.js} +3 -3
  32. package/dist/gateway/static/root/assets/{automations-page-Clcl5MI7.js → automations-page-CmxICTM4.js} +1 -1
  33. package/dist/gateway/static/root/assets/automations-workspace-R6YNDdAO.js +9 -0
  34. package/dist/gateway/static/root/assets/{binary-plugins-B-dkI6-B.js → binary-plugins-69WyJLNW.js} +1 -1
  35. package/dist/gateway/static/root/assets/{block-editor-CB6KruU-.js → block-editor-DUONDIZR.js} +1 -1
  36. package/dist/gateway/static/root/assets/{browser-automation-inputs-Bk_QFbzb.js → browser-automation-inputs-DL4YPCuN.js} +1 -1
  37. package/dist/gateway/static/root/assets/{browser-automations-page-54eckhYq.js → browser-automations-page-1Aq6XmRs.js} +1 -1
  38. package/dist/gateway/static/root/assets/{browser-control-api-B4T1KPPz.js → browser-control-api-yjru8E7R.js} +1 -1
  39. package/dist/gateway/static/root/assets/{browser-settings-page-rOmS1-T8.js → browser-settings-page-CvwpT8Um.js} +1 -1
  40. package/dist/gateway/static/root/assets/{capabilities-D_Uqx5il.js → capabilities-C7lnwKKm.js} +1 -1
  41. package/dist/gateway/static/root/assets/{capabilities-DBDeifNA.js → capabilities-DaeQXJT4.js} +1 -1
  42. package/dist/gateway/static/root/assets/capabilities-page-B5avAOUM.js +2 -0
  43. package/dist/gateway/static/root/assets/{capabilities-settings-panel-iQPbNO4A.js → capabilities-settings-panel-_9yCS78i.js} +1 -1
  44. package/dist/gateway/static/root/assets/capability-links-DeO34GIF.js +1 -0
  45. package/dist/gateway/static/root/assets/{channels-DsEP_hFB.js → channels-CoQb4HOF.js} +1 -1
  46. package/dist/gateway/static/root/assets/{chat-agents-api-D5-xZdAt.js → chat-agents-api-BUi_7GRo.js} +1 -1
  47. package/dist/gateway/static/root/assets/{chat-chart-block-B-ri4wfk.js → chat-chart-block-CcVcKsDZ.js} +1 -1
  48. package/dist/gateway/static/root/assets/chat-page-BJ8PlDjZ.js +72 -0
  49. package/dist/gateway/static/root/assets/{chat-terminal-dock-RcrdmYe8.js → chat-terminal-dock-BMXJpPuH.js} +1 -1
  50. package/dist/gateway/static/root/assets/{command-palette-api-DFd-zOz_.js → command-palette-api-luUjQPsh.js} +1 -1
  51. package/dist/gateway/static/root/assets/{composer-payload-handoff-hccuv1Lk.js → composer-payload-handoff-B5XNxNCb.js} +1 -1
  52. package/dist/gateway/static/root/assets/computer-settings-page-CWtdyEJH.js +1 -0
  53. package/dist/gateway/static/root/assets/connected-providers-grid-2idMtk65.js +1 -0
  54. package/dist/gateway/static/root/assets/connection-usage-Cm_McddI.js +1 -0
  55. package/dist/gateway/static/root/assets/connection-usage-guide-Ddh0bfkj.js +1 -0
  56. package/dist/gateway/static/root/assets/{connector-service-page-C3ZhlR8V.js → connector-service-page-C3msXaBk.js} +1 -1
  57. package/dist/gateway/static/root/assets/{connectors-api-D6CPY0Nu.js → connectors-api-NcWECWKg.js} +1 -1
  58. package/dist/gateway/static/root/assets/connectors-page-Crb6DILX.js +1 -0
  59. package/dist/gateway/static/root/assets/{date-picker-D3bxeryy.js → date-picker-Cfjq1hD_.js} +1 -1
  60. package/dist/gateway/static/root/assets/{desktop-pet-B7kSoCSo.js → desktop-pet-ChFn9v-3.js} +1 -1
  61. package/dist/gateway/static/root/assets/{desktop-pet-settings-3dEeKSHA.js → desktop-pet-settings-DvnVIv25.js} +1 -1
  62. package/dist/gateway/static/root/assets/{dev-view-store-Dk7ylv5S.js → dev-view-store-DQJ61P5L.js} +1 -1
  63. package/dist/gateway/static/root/assets/{device-pairing-wizard-CstPAnnj.js → device-pairing-wizard-KxaIL-OX.js} +1 -1
  64. package/dist/gateway/static/root/assets/{directory-picker-path-field-BUGqS-lm.js → directory-picker-path-field-Drv864uE.js} +1 -1
  65. package/dist/gateway/static/root/assets/{discussion-annotation-sync-D9-wFJDS.js → discussion-annotation-sync-DfBRkWtw.js} +1 -1
  66. package/dist/gateway/static/root/assets/{extension-debug-page-BDTA9XDE.js → extension-debug-page-DAlBIt_R.js} +1 -1
  67. package/dist/gateway/static/root/assets/{extension-iframe-host-CPEaw2ZG.js → extension-iframe-host-Bds-5kY_.js} +1 -1
  68. package/dist/gateway/static/root/assets/{extension-marketplace-api-edmEFM6F.js → extension-marketplace-api-CZg8nBwW.js} +1 -1
  69. package/dist/gateway/static/root/assets/{extension-page-Biz-65E8.js → extension-page-ZTw-oucT.js} +1 -1
  70. package/dist/gateway/static/root/assets/{extension-provider-DCur0Xcb.js → extension-provider-NKWfjpdP.js} +1 -1
  71. package/dist/gateway/static/root/assets/{extension-settings-page-CvPK63oz.js → extension-settings-page-CT7PPt_q.js} +1 -1
  72. package/dist/gateway/static/root/assets/{file-preview-surface-BFs1sAID.js → file-preview-surface-BcLeaSNe.js} +1 -1
  73. package/dist/gateway/static/root/assets/{gateway-config-swr-C-fPl1hP.js → gateway-config-swr-Cq-ByXL4.js} +1 -1
  74. package/dist/gateway/static/root/assets/{gateway-realtime-xZpX_HCq.js → gateway-realtime-DwMd2PCt.js} +1 -1
  75. package/dist/gateway/static/root/assets/gateway-realtime-store-CHrf6-nR.js +1 -0
  76. package/dist/gateway/static/root/assets/{gateway-restart-BfozBI8f.js → gateway-restart-DdiVzbkL.js} +1 -1
  77. package/dist/gateway/static/root/assets/{gateway-settings-A8BUKcfx.js → gateway-settings-1QUdNwrZ.js} +1 -1
  78. package/dist/gateway/static/root/assets/{gateway-startup-retry-BRrkiv67.js → gateway-startup-retry-PMJi5mX4.js} +1 -1
  79. package/dist/gateway/static/root/assets/{global-defaults-api-C9O_X0pj.js → global-defaults-api-DgzZh3wX.js} +1 -1
  80. package/dist/gateway/static/root/assets/{home-page-CzS-ROXe.js → home-page-Chn7YTiD.js} +2 -2
  81. package/dist/gateway/static/root/assets/{image-generation-api-ohquPPls.js → image-generation-api-CjVpsckq.js} +1 -1
  82. package/dist/gateway/static/root/assets/{imports-page-DAebChWv.js → imports-page-CJCvZFaQ.js} +1 -1
  83. package/dist/gateway/static/root/assets/index-DWQ4LbBn.js +11 -0
  84. package/dist/gateway/static/root/assets/index-iukJWzxG.css +1 -0
  85. package/dist/gateway/static/root/assets/install-connector-dialog-Bo06Ry3H.js +1 -0
  86. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-Bv4YJpTl.js → keyboard-shortcuts-settings-BylFJeGu.js} +1 -1
  87. package/dist/gateway/static/root/assets/{local-app-workbench-page-OhV8UnzK.js → local-app-workbench-page-B3MSSFsr.js} +1 -1
  88. package/dist/gateway/static/root/assets/{local-apps-page-ADzWmh3T.js → local-apps-page-BeV86rMJ.js} +1 -1
  89. package/dist/gateway/static/root/assets/{local-session-drafts-DgtYzPiy.js → local-session-drafts-jgw8UGsO.js} +2 -2
  90. package/dist/gateway/static/root/assets/{locale-store-fGFrr4_4.js → locale-store-CAZaC05J.js} +1 -1
  91. package/dist/gateway/static/root/assets/{logs-page-i0eD_bSC.js → logs-page-BMmSsUP5.js} +1 -1
  92. package/dist/gateway/static/root/assets/{management-settings-C-JTxRjw.js → management-settings-Bu7T8ewk.js} +1 -1
  93. package/dist/gateway/static/root/assets/{markdown-view-Cnt8oxNg.js → markdown-view-BatP4qeK.js} +1 -1
  94. package/dist/gateway/static/root/assets/{mcp-conversation-setup-page-BQ_US_jP.js → mcp-conversation-setup-page-rROtr0UN.js} +1 -1
  95. package/dist/gateway/static/root/assets/{media-plugins-cphVSfva.js → media-plugins-88OV72YE.js} +1 -1
  96. package/dist/gateway/static/root/assets/messages-C7fckbyG.js +3 -0
  97. package/dist/gateway/static/root/assets/{model-selector-Bv-anQ6O.js → model-selector-raBRBkN_.js} +1 -1
  98. package/dist/gateway/static/root/assets/{models-hub-cache-BLYpN4bJ.js → models-hub-cache-CzC9y3D0.js} +1 -1
  99. package/dist/gateway/static/root/assets/{note-detail-panel-B-pk3LYN.js → note-detail-panel-BvA8Vkbm.js} +3 -3
  100. package/dist/gateway/static/root/assets/note-image-lightbox-D6kUDDd5.js +1 -0
  101. package/dist/gateway/static/root/assets/{notes-api-IIQgxlMj.js → notes-api-zXpV6UXu.js} +1 -1
  102. package/dist/gateway/static/root/assets/{notes-page-C6l9zI17.js → notes-page-CjYH9Kle.js} +1 -1
  103. package/dist/gateway/static/root/assets/{oauth-api-BojfhqmL.js → oauth-api-DmxSaxM1.js} +1 -1
  104. package/dist/gateway/static/root/assets/{oauth-provider-connect-D_p1ez-o.js → oauth-provider-connect-D4Gfs-Ba.js} +1 -1
  105. package/dist/gateway/static/root/assets/{page-context-capture-button-CiEaCz7v.js → page-context-capture-button-Mig3d0UX.js} +1 -1
  106. package/dist/gateway/static/root/assets/{page-context-draft-BbGvUKjF.js → page-context-draft-C4IIZaKd.js} +1 -1
  107. package/dist/gateway/static/root/assets/page-header-store-D7G5utVi.js +1 -0
  108. package/dist/gateway/static/root/assets/{personal-avatar-Cq0y6LEK.js → personal-avatar-DLa-CpaK.js} +1 -1
  109. package/dist/gateway/static/root/assets/{personal-page-CDad-FDO.js → personal-page-l9_vYfdJ.js} +1 -1
  110. package/dist/gateway/static/root/assets/{personal-settings-panel-yVUzcKoo.js → personal-settings-panel-XSUkgcr2.js} +1 -1
  111. package/dist/gateway/static/root/assets/phone-dependencies-card-DYwnuVh3.js +1 -0
  112. package/dist/gateway/static/root/assets/phone-model-connection-2F32QTHA.js +1 -0
  113. package/dist/gateway/static/root/assets/phone-model-picker-DCVzIr0s.js +1 -0
  114. package/dist/gateway/static/root/assets/phone-settings-page-DJttE4id.js +1 -0
  115. package/dist/gateway/static/root/assets/{phone-workspace-store-DoTZvoDh.js → phone-workspace-store-Dxp-KhFP.js} +1 -1
  116. package/dist/gateway/static/root/assets/plugin-details-dialog-tyjAjFjA.js +1 -0
  117. package/dist/gateway/static/root/assets/{preference-select-fields-oZm_6PvN.js → preference-select-fields-BVP3MhGK.js} +1 -1
  118. package/dist/gateway/static/root/assets/{product-automation-feedback-Ddj5cmmF.js → product-automation-feedback-DbJvv92z.js} +1 -1
  119. package/dist/gateway/static/root/assets/{product-open-page-CTuqeUDh.js → product-open-page-RImqlhCD.js} +1 -1
  120. package/dist/gateway/static/root/assets/{product-preview-content-Ci8eDZ2h.js → product-preview-content-DxSqrKsg.js} +1 -1
  121. package/dist/gateway/static/root/assets/{product-preview-modal-J-9O-eQ2.js → product-preview-modal-Cw8Q8Uom.js} +2 -2
  122. package/dist/gateway/static/root/assets/{project-detail-page-D8QlmMQp.js → project-detail-page-BbyV8EiG.js} +1 -1
  123. package/dist/gateway/static/root/assets/{project-understanding-8DBS77KV.js → project-understanding-BMKcoUW5.js} +1 -1
  124. package/dist/gateway/static/root/assets/{projects-page-CEyyFqca.js → projects-page-CFsABLvs.js} +1 -1
  125. package/dist/gateway/static/root/assets/{providers-api-DyX07mht.js → providers-api-CAeXbJNF.js} +1 -1
  126. package/dist/gateway/static/root/assets/{recording-upload-DOhMs_aU.js → recording-upload-CfpllTe5.js} +1 -1
  127. package/dist/gateway/static/root/assets/{registry-api-Bm7kut54.js → registry-api-fLOqFyrz.js} +1 -1
  128. package/dist/gateway/static/root/assets/{remote-access-hub-DfCkv8XR.js → remote-access-hub-BvKOxy0L.js} +1 -1
  129. package/dist/gateway/static/root/assets/{resource-unavailable-jg8QV_tO.js → resource-unavailable-D15jzjV_.js} +1 -1
  130. package/dist/gateway/static/root/assets/route-preload-BWpw9qxc.js +2 -0
  131. package/dist/gateway/static/root/assets/{runtime-tools-api-BpaZgv-a.js → runtime-tools-api-D0Nrvuqv.js} +1 -1
  132. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-CGnX0DY1.js → runtime-tools-settings-panel-CA27XgL2.js} +1 -1
  133. package/dist/gateway/static/root/assets/{service-recommendation-list-NdwoBa_O.js → service-recommendation-list-B0RoYLVT.js} +1 -1
  134. package/dist/gateway/static/root/assets/session-api-CHRP5Lwf.js +1 -0
  135. package/dist/gateway/static/root/assets/session-channel-icon-D1ktvt1P.js +1 -0
  136. package/dist/gateway/static/root/assets/session-identity-label-BP7OIYth.js +1 -0
  137. package/dist/gateway/static/root/assets/session-manager-DRRWwKE4.js +25 -0
  138. package/dist/gateway/static/root/assets/{sessions-page-CAutHonI.js → sessions-page-uJHS3-6F.js} +1 -1
  139. package/dist/gateway/static/root/assets/settings-advanced-gate-CZ4J3Kuy.js +1 -0
  140. package/dist/gateway/static/root/assets/{settings-advanced-section-CICMnCwv.js → settings-advanced-section-D-llwfSj.js} +1 -1
  141. package/dist/gateway/static/root/assets/{settings-mode-store-DCnYgG87.js → settings-mode-store-BspMKc9N.js} +1 -1
  142. package/dist/gateway/static/root/assets/{settings-page-CZXi8Jro.js → settings-page-XJXcnE1_.js} +1 -1
  143. package/dist/gateway/static/root/assets/{settings-page-header-DH1qb4vP.js → settings-page-header-LuOJvqNa.js} +1 -1
  144. package/dist/gateway/static/root/assets/{settings-page-layout-B2G042F2.js → settings-page-layout-CduQ8w4a.js} +1 -1
  145. package/dist/gateway/static/root/assets/{setup-interaction-page-B-tpfd3l.js → setup-interaction-page-ujpPGl84.js} +1 -1
  146. package/dist/gateway/static/root/assets/{setup-status-panel-DtA2Lb-A.js → setup-status-panel-BN2aCJUN.js} +1 -1
  147. package/dist/gateway/static/root/assets/{share-link-dialog-BjjkGRWn.js → share-link-dialog-CTATUaa4.js} +1 -1
  148. package/dist/gateway/static/root/assets/{share-preview-page-BBaJCO3w.js → share-preview-page-Dq0J3VgS.js} +1 -1
  149. package/dist/gateway/static/root/assets/{shares-api-C1rliVTe.js → shares-api-zegE8pSE.js} +1 -1
  150. package/dist/gateway/static/root/assets/{shares-settings-BMctLz4y.js → shares-settings-DXpvsRXq.js} +1 -1
  151. package/dist/gateway/static/root/assets/{skill-api-fWp7oUet.js → skill-api-DCL1EN7f.js} +1 -1
  152. package/dist/gateway/static/root/assets/{skill-list-api-B-2Dod7G.js → skill-list-api-Bv0mmHbu.js} +1 -1
  153. package/dist/gateway/static/root/assets/{skill-reload-api-Cejk-tbD.js → skill-reload-api-DPZbadiO.js} +1 -1
  154. package/dist/gateway/static/root/assets/{skills-page-D-dxO0Vc.js → skills-page-DMC7Gaku.js} +1 -1
  155. package/dist/gateway/static/root/assets/{system-settings-panel-D-gdBXlK.js → system-settings-panel-BYFUhlqG.js} +1 -1
  156. package/dist/gateway/static/root/assets/{task-detail-page-CIX4EckU.js → task-detail-page-DvX9JoEd.js} +3 -3
  157. package/dist/gateway/static/root/assets/{task-result-evidence-Dp6gk3xn.js → task-result-evidence-Bxm8-H0B.js} +1 -1
  158. package/dist/gateway/static/root/assets/{terminal-panel-store-BDrza-7c.js → terminal-panel-store-Djf9l2qZ.js} +1 -1
  159. package/dist/gateway/static/root/assets/{theme-store-De43hGnm.js → theme-store-8GFVtotZ.js} +1 -1
  160. package/dist/gateway/static/root/assets/{tracing-settings-page-DlQJAutq.js → tracing-settings-page-oWW3SBZ4.js} +1 -1
  161. package/dist/gateway/static/root/assets/{tunnel-api-BSeDyRBI.js → tunnel-api-D-mEsSGF.js} +1 -1
  162. package/dist/gateway/static/root/assets/{understanding-activity-store-CABSRtdN.js → understanding-activity-store-CvDjsd0I.js} +1 -1
  163. package/dist/gateway/static/root/assets/{understanding-refresh-store-C5pXQtC9.js → understanding-refresh-store-DzOZJm7A.js} +1 -1
  164. package/dist/gateway/static/root/assets/{usage-page-Dd6gyHlm.js → usage-page-z-o6Uuev.js} +1 -1
  165. package/dist/gateway/static/root/assets/{use-autosave-BhdMHxgz.js → use-autosave-BVYS8UoK.js} +1 -1
  166. package/dist/gateway/static/root/assets/{use-composer-attachments-Baw8AHhn.js → use-composer-attachments-lecOV2q5.js} +1 -1
  167. package/dist/gateway/static/root/assets/{use-file-preview-expanded-B_cRX1Ih.js → use-file-preview-expanded-nd_CuFsd.js} +2 -2
  168. package/dist/gateway/static/root/assets/{use-personal-profile-DL5rDvwX.js → use-personal-profile-CQi2ZCxV.js} +1 -1
  169. package/dist/gateway/static/root/assets/{use-workspace-tree-DONQqfmT.js → use-workspace-tree-BiaddkzX.js} +1 -1
  170. package/dist/gateway/static/root/assets/{user-model-page-u2vtyxcX.js → user-model-page-Bks1n0Nj.js} +1 -1
  171. package/dist/gateway/static/root/assets/{voice-api-key-field-OChN73N1.js → voice-api-key-field-BbW8NFeZ.js} +1 -1
  172. package/dist/gateway/static/root/assets/{voice-config-api-CziHHWRu.js → voice-config-api-jSMzZWWy.js} +1 -1
  173. package/dist/gateway/static/root/assets/{voice-input-shortcut-events-CWSb-oJe.js → voice-input-shortcut-events-_SgYmx7X.js} +1 -1
  174. package/dist/gateway/static/root/assets/{voice-transcribe-api-CqEwxj11.js → voice-transcribe-api-BJCfiRFU.js} +1 -1
  175. package/dist/gateway/static/root/assets/{work-discovery-overlay-BJT2mARb.js → work-discovery-overlay-DSTSNyU7.js} +1 -1
  176. package/dist/gateway/static/root/assets/{work-discovery-page-CkHMAnBc.js → work-discovery-page-Dd_QJJvb.js} +1 -1
  177. package/dist/gateway/static/root/assets/{working-directory-picker-modal-CpZEiO2a.js → working-directory-picker-modal-q39BUcJ6.js} +1 -1
  178. package/dist/gateway/static/root/assets/{workspace-api-Yi28Sl0C.js → workspace-api-Di2OmCvz.js} +2 -2
  179. package/dist/gateway/static/root/assets/workspace-editor-agent-store-B2r9wlix.js +1 -0
  180. package/dist/gateway/static/root/assets/{workspace-file-preview-dialog-MLLldcHQ.js → workspace-file-preview-dialog-BUGNT765.js} +1 -1
  181. package/dist/gateway/static/root/assets/{workspace-open-location-menu-CjfDtW9T.js → workspace-open-location-menu-bMSvmQW7.js} +1 -1
  182. package/dist/gateway/static/root/assets/{xopc-cloud-account-card-FioKsLPf.js → xopc-cloud-account-card-Bbe19Del.js} +1 -1
  183. package/dist/gateway/static/root/index.html +87 -85
  184. package/dist/package.js +1 -1
  185. package/dist/packages/computer-control-contract/src/index.js +33 -3
  186. package/dist/packages/gateway-contract/src/session-identity.js +2 -1
  187. package/dist/packages/gateway-contract/src/session-input-command.js +19 -2
  188. package/dist/packages/gateway-contract/src/specialists.js +1 -0
  189. package/dist/src/agent/agent-manager.js +17 -17
  190. package/dist/src/agent/agent-scope.js +2 -2
  191. package/dist/src/agent/background-review/prompts.js +1 -1
  192. package/dist/src/agent/background-review/run-background-review.js +11 -11
  193. package/dist/src/agent/child-agent-factory.js +2 -2
  194. package/dist/src/agent/context/coordinator.js +2 -2
  195. package/dist/src/agent/context/execution-context.js +4 -4
  196. package/dist/src/agent/context/project-context.js +3 -3
  197. package/dist/src/agent/data-acquisition/service.js +1 -1
  198. package/dist/src/agent/embedded/codemode-extension.js +1 -1
  199. package/dist/src/agent/embedded/execution-tool-policy.d.ts +1 -1
  200. package/dist/src/agent/embedded/execution-tool-policy.js +3 -3
  201. package/dist/src/agent/embedded/external-tool-discovery.js +1 -1
  202. package/dist/src/agent/embedded/run-for-session.js +29 -14
  203. package/dist/src/agent/embedded/run-turn.js +48 -25
  204. package/dist/src/agent/embedded/runs.d.ts +2 -2
  205. package/dist/src/agent/embedded/runs.js +4 -4
  206. package/dist/src/agent/embedded/session-runner.js +30 -15
  207. package/dist/src/agent/embedded/session-tool-result-guard.js +1 -1
  208. package/dist/src/agent/embedded/tool-search-extension.d.ts +8 -2
  209. package/dist/src/agent/embedded/tool-search-extension.js +122 -30
  210. package/dist/src/agent/embedded/xopc-tools-bridge.js +1 -1
  211. package/dist/src/agent/external-tools/cliProvider.d.ts +10 -9
  212. package/dist/src/agent/external-tools/cliProvider.js +27 -7
  213. package/dist/src/agent/external-tools/composio-provider.d.ts +3 -3
  214. package/dist/src/agent/external-tools/composio-provider.js +8 -5
  215. package/dist/src/agent/external-tools/discovery.d.ts +47 -0
  216. package/dist/src/agent/external-tools/discovery.js +56 -0
  217. package/dist/src/agent/external-tools/endpoint-provider.js +4 -4
  218. package/dist/src/agent/external-tools/extension-provider.js +1 -1
  219. package/dist/src/agent/external-tools/gateway-tools.js +27 -47
  220. package/dist/src/agent/external-tools/index.d.ts +1 -0
  221. package/dist/src/agent/external-tools/index.js +7 -0
  222. package/dist/src/agent/external-tools/memory-provider.js +1 -1
  223. package/dist/src/agent/external-tools/personal-request-scope.d.ts +7 -0
  224. package/dist/src/agent/external-tools/personal-request-scope.js +83 -0
  225. package/dist/src/agent/external-tools/read-policy.js +5 -4
  226. package/dist/src/agent/external-tools/service.d.ts +2 -0
  227. package/dist/src/agent/external-tools/service.js +22 -3
  228. package/dist/src/agent/external-tools/tool-registry.d.ts +6 -0
  229. package/dist/src/agent/external-tools/types.d.ts +7 -2
  230. package/dist/src/agent/image/generation/openai-images-provider.js +1 -1
  231. package/dist/src/agent/image/generation/runtime.js +1 -1
  232. package/dist/src/agent/image/index.js +1 -1
  233. package/dist/src/agent/inbound/attachment-pipeline.js +2 -2
  234. package/dist/src/agent/inbound/inbound-loop.js +2 -2
  235. package/dist/src/agent/inbound/turn-dispatcher.d.ts +1 -1
  236. package/dist/src/agent/inbound/turn-dispatcher.js +3 -2
  237. package/dist/src/agent/independent-execution.js +2 -2
  238. package/dist/src/agent/index.js +3 -3
  239. package/dist/src/agent/mcp/connection-drafts.js +1 -1
  240. package/dist/src/agent/mcp/connection-setup.js +1 -1
  241. package/dist/src/agent/mcp/conversation-setup.js +1 -1
  242. package/dist/src/agent/mcp/discovery.js +2 -2
  243. package/dist/src/agent/mcp/transport.js +1 -1
  244. package/dist/src/agent/memory/index.js +1 -1
  245. package/dist/src/agent/orchestration/llm-turn-retry.d.ts +1 -1
  246. package/dist/src/agent/orchestration/llm-turn-retry.js +14 -9
  247. package/dist/src/agent/orchestration/run-agent-turn-with-timeout.d.ts +1 -0
  248. package/dist/src/agent/orchestration/run-agent-turn-with-timeout.js +3 -1
  249. package/dist/src/agent/prompt/response-language.js +1 -1
  250. package/dist/src/agent/prompt/sections/tooling.js +1 -1
  251. package/dist/src/agent/prompt/service-prompt-builder.js +3 -3
  252. package/dist/src/agent/prompt/system-prompt-params.js +1 -1
  253. package/dist/src/agent/sandbox/exec-policy.js +1 -1
  254. package/dist/src/agent/service/direct-turn-helpers.js +6 -6
  255. package/dist/src/agent/service/process-direct-streaming.js +6 -6
  256. package/dist/src/agent/service/webchat-tts.js +2 -2
  257. package/dist/src/agent/service.js +21 -21
  258. package/dist/src/agent/session/session-config-service.js +2 -2
  259. package/dist/src/agent/session/session-hydrator.js +1 -1
  260. package/dist/src/agent/session/session-inspector.js +1 -1
  261. package/dist/src/agent/skills/filesystem-watcher.js +1 -1
  262. package/dist/src/agent/skills/hub-lock.js +1 -1
  263. package/dist/src/agent/skills/hub-pull.js +2 -2
  264. package/dist/src/agent/skills/marketplace/adapters/store/adapter.js +1 -1
  265. package/dist/src/agent/skills/marketplace/adapters/store/store-api-client.js +1 -1
  266. package/dist/src/agent/skills/skill-manager.js +1 -1
  267. package/dist/src/agent/skills/skill-sources.js +1 -1
  268. package/dist/src/agent/source-context/index.js +1 -1
  269. package/dist/src/agent/tasks/task-judge-service.js +8 -8
  270. package/dist/src/agent/tool-manuals/computer.d.ts +1 -1
  271. package/dist/src/agent/tool-manuals/computer.js +6 -4
  272. package/dist/src/agent/tool-manuals/phone.d.ts +1 -1
  273. package/dist/src/agent/tool-manuals/phone.js +4 -4
  274. package/dist/src/agent/tool-manuals/xopc-configuration.d.ts +1 -1
  275. package/dist/src/agent/tool-manuals/xopc-configuration.js +4 -2
  276. package/dist/src/agent/tools/computer-use-tool.js +7 -6
  277. package/dist/src/agent/tools/create-share-tool.js +2 -2
  278. package/dist/src/agent/tools/delegate-tool.js +3 -3
  279. package/dist/src/agent/tools/delegation-policy.js +1 -0
  280. package/dist/src/agent/tools/exec-command.js +1 -1
  281. package/dist/src/agent/tools/executor.js +1 -1
  282. package/dist/src/agent/tools/factory.js +23 -21
  283. package/dist/src/agent/tools/fetch-text.js +1 -1
  284. package/dist/src/agent/tools/image-generate-tool.js +2 -2
  285. package/dist/src/agent/tools/index.js +4 -4
  286. package/dist/src/agent/tools/list-dir.js +1 -1
  287. package/dist/src/agent/tools/personal-attention-tool.js +2 -2
  288. package/dist/src/agent/tools/personal-request-result-tool.js +1 -1
  289. package/dist/src/agent/tools/personal-request-tool.js +4 -4
  290. package/dist/src/agent/tools/personal-result-tool.js +1 -1
  291. package/dist/src/agent/tools/personal-task-tool.js +5 -5
  292. package/dist/src/agent/tools/phone-use-tool.js +3 -3
  293. package/dist/src/agent/tools/publish-artifacts.js +1 -1
  294. package/dist/src/agent/tools/read.js +1 -1
  295. package/dist/src/agent/tools/review-workspace.js +1 -1
  296. package/dist/src/agent/tools/send-media.js +1 -1
  297. package/dist/src/agent/tools/skill-manage-tool.js +1 -1
  298. package/dist/src/agent/tools/task-collaboration-tool.js +2 -2
  299. package/dist/src/agent/tools/tts-tool.js +1 -1
  300. package/dist/src/agent/tools/user-context-tool.js +2 -2
  301. package/dist/src/agent/tools/web.js +23 -4
  302. package/dist/src/agent/tools/write.js +1 -1
  303. package/dist/src/agent/tools/xopc-use-tool.js +10 -10
  304. package/dist/src/agent/transcript/index.js +2 -2
  305. package/dist/src/agent/transcript/transcript-hygiene.js +2 -2
  306. package/dist/src/agent-matching/delegation-service.js +1 -1
  307. package/dist/src/agent-matching/service.js +2 -2
  308. package/dist/src/ai-assist/text-assist.js +1 -1
  309. package/dist/src/auth/credentials.js +1 -1
  310. package/dist/src/auth/oauth/openai.js +1 -1
  311. package/dist/src/auth/oauth/xopc-cloud.js +1 -1
  312. package/dist/src/auth/profiles/store.js +1 -1
  313. package/dist/src/automations/delivery/delivery-router.js +1 -1
  314. package/dist/src/automations/domain/index.js +1 -1
  315. package/dist/src/automations/draft/automation-draft-service.js +1 -1
  316. package/dist/src/automations/index.js +2 -2
  317. package/dist/src/automations/service/action-executor.js +2 -2
  318. package/dist/src/automations/service/automation-service.js +2 -2
  319. package/dist/src/browser/native-messaging-host.js +1 -1
  320. package/dist/src/browser/providers/browser-ext-install.js +1 -1
  321. package/dist/src/capabilities/store-connector.js +2 -2
  322. package/dist/src/channels/attachments/voice-stt-webchat.js +1 -1
  323. package/dist/src/channels/index.js +1 -1
  324. package/dist/src/channels/outbound-sender.js +1 -1
  325. package/dist/src/channels/pairing/allow-from-file.js +9 -9
  326. package/dist/src/channels/pairing/pairing-store.js +6 -6
  327. package/dist/src/chat-commands/agent-edit.js +1 -1
  328. package/dist/src/chat-commands/builtins/config.js +2 -2
  329. package/dist/src/chat-commands/builtins/session.js +1 -1
  330. package/dist/src/chat-commands/builtins/thinking.js +1 -1
  331. package/dist/src/chat-commands/builtins/tts.js +1 -1
  332. package/dist/src/chat-commands/context.js +1 -1
  333. package/dist/src/chat-commands/index.js +3 -3
  334. package/dist/src/cli/commands/agent.js +7 -7
  335. package/dist/src/cli/commands/config.js +1 -1
  336. package/dist/src/cli/commands/connectors.js +1 -1
  337. package/dist/src/cli/commands/doctor/checks/channel-plugins.js +1 -1
  338. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  339. package/dist/src/cli/commands/doctor/checks/gateway-health.js +1 -1
  340. package/dist/src/cli/commands/extension-agent-plugin.js +1 -1
  341. package/dist/src/cli/commands/extension-dev.js +1 -1
  342. package/dist/src/cli/commands/extension.js +2 -2
  343. package/dist/src/cli/commands/image.js +1 -1
  344. package/dist/src/cli/commands/init.js +1 -1
  345. package/dist/src/cli/commands/models.js +2 -2
  346. package/dist/src/cli/commands/onboard/channels/registry.js +1 -1
  347. package/dist/src/cli/commands/onboard.js +1 -1
  348. package/dist/src/cli/commands/project.js +1 -1
  349. package/dist/src/cli/commands/skills.js +2 -2
  350. package/dist/src/cli/commands/tunnel.js +4 -4
  351. package/dist/src/cli/extension-cli-register.js +5 -5
  352. package/dist/src/cli/utils/gateway-client.js +1 -1
  353. package/dist/src/cli/utils/init-workspace-core.js +2 -2
  354. package/dist/src/cli/utils/session.js +1 -1
  355. package/dist/src/computer/batch.d.ts +108 -0
  356. package/dist/src/computer/batch.js +125 -0
  357. package/dist/src/computer/broker.d.ts +28 -2
  358. package/dist/src/computer/broker.js +95 -17
  359. package/dist/src/computer/diagnostics.d.ts +5 -1
  360. package/dist/src/computer/diagnostics.js +22 -3
  361. package/dist/src/computer/errors.d.ts +15 -0
  362. package/dist/src/computer/errors.js +59 -3
  363. package/dist/src/computer/flows.js +1 -1
  364. package/dist/src/computer/model-adapter.d.ts +58 -0
  365. package/dist/src/computer/model-adapter.js +113 -67
  366. package/dist/src/computer/native-errors.d.ts +2 -0
  367. package/dist/src/computer/native-errors.js +13 -0
  368. package/dist/src/computer/program-runtime.d.ts +1 -1
  369. package/dist/src/computer/program-runtime.js +1 -0
  370. package/dist/src/computer/runtime.d.ts +11 -0
  371. package/dist/src/computer/runtime.js +106 -38
  372. package/dist/src/computer/semantic-actions.js +4 -0
  373. package/dist/src/config/index.js +3 -3
  374. package/dist/src/config/loader.js +1 -1
  375. package/dist/src/config/models-json.js +1 -1
  376. package/dist/src/config/schema.d.ts +6 -0
  377. package/dist/src/connectors/cli/authorization.js +1 -1
  378. package/dist/src/connectors/composio-sessions.js +1 -1
  379. package/dist/src/connectors/composio.js +1 -1
  380. package/dist/src/connectors/connected-source-ingestion.js +2 -2
  381. package/dist/src/connectors/connected-source-understanding.js +5 -5
  382. package/dist/src/connectors/connection-recovery-service.js +4 -4
  383. package/dist/src/connectors/content-enrichment.js +1 -1
  384. package/dist/src/connectors/health.js +1 -1
  385. package/dist/src/connectors/instances.js +1 -1
  386. package/dist/src/connectors/runtime-adapter-registry.js +2 -2
  387. package/dist/src/discussions/live-worker.js +1 -1
  388. package/dist/src/discussions/sealer.js +1 -1
  389. package/dist/src/endpoint-tools/index.js +1 -1
  390. package/dist/src/endpoint-tools/runtime.js +2 -2
  391. package/dist/src/extensions/activation-context.js +3 -3
  392. package/dist/src/extensions/agent-plugins/auth.js +1 -1
  393. package/dist/src/extensions/agent-plugins/formats.js +2 -1
  394. package/dist/src/extensions/agent-plugins/inventory.d.ts +2 -0
  395. package/dist/src/extensions/agent-plugins/inventory.js +4 -1
  396. package/dist/src/extensions/agent-plugins/skill-catalog.js +2 -2
  397. package/dist/src/extensions/agent-plugins/source-http-fetch.js +1 -1
  398. package/dist/src/extensions/agent-plugins/validation.d.ts +1 -0
  399. package/dist/src/extensions/agent-plugins/validation.js +2 -1
  400. package/dist/src/extensions/api.js +3 -3
  401. package/dist/src/extensions/bundled-extension-activation.js +1 -1
  402. package/dist/src/extensions/index.js +3 -3
  403. package/dist/src/extensions/loader.js +2 -2
  404. package/dist/src/extensions/lockfile.js +1 -1
  405. package/dist/src/extensions/sdk/index.js +1 -1
  406. package/dist/src/extensions/sdk/media.js +1 -1
  407. package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
  408. package/dist/src/gateway/agents-admin.js +1 -1
  409. package/dist/src/gateway/device-routes.js +1 -1
  410. package/dist/src/gateway/file-path-classifier.js +1 -1
  411. package/dist/src/gateway/global-defaults-admin.js +1 -1
  412. package/dist/src/gateway/hono/app.js +2 -2
  413. package/dist/src/gateway/hono/lib/config-payload.js +2 -2
  414. package/dist/src/gateway/hono/oauth-async.js +1 -1
  415. package/dist/src/gateway/hono/routes/agent-plugins.js +1 -1
  416. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
  417. package/dist/src/gateway/hono/routes/commands-skills.js +4 -4
  418. package/dist/src/gateway/hono/routes/config-patch/gateway.js +1 -1
  419. package/dist/src/gateway/hono/routes/connectors.js +1 -1
  420. package/dist/src/gateway/hono/routes/context-sources.js +1 -1
  421. package/dist/src/gateway/hono/routes/endpoint-tools.js +1 -1
  422. package/dist/src/gateway/hono/routes/home.js +1 -1
  423. package/dist/src/gateway/hono/routes/lazy-bundles.js +8 -0
  424. package/dist/src/gateway/hono/routes/location-sharing.js +1 -1
  425. package/dist/src/gateway/hono/routes/mcp.js +1 -1
  426. package/dist/src/gateway/hono/routes/memory-learning.js +3 -3
  427. package/dist/src/gateway/hono/routes/models.js +4 -4
  428. package/dist/src/gateway/hono/routes/notes.js +1 -1
  429. package/dist/src/gateway/hono/routes/phone-dependencies.js +27 -6
  430. package/dist/src/gateway/hono/routes/phone-setup.js +43 -17
  431. package/dist/src/gateway/hono/routes/phone.js +24 -9
  432. package/dist/src/gateway/hono/routes/projects.js +4 -4
  433. package/dist/src/gateway/hono/routes/runtime-tools.js +1 -1
  434. package/dist/src/gateway/hono/routes/session-command-handler.js +11 -2
  435. package/dist/src/gateway/hono/routes/session-input-control.d.ts +3 -0
  436. package/dist/src/gateway/hono/routes/session-input-control.js +37 -0
  437. package/dist/src/gateway/hono/routes/session-input-handler.d.ts +12 -0
  438. package/dist/src/gateway/hono/routes/session-input-handler.js +27 -5
  439. package/dist/src/gateway/hono/routes/sessions.js +7 -3
  440. package/dist/src/gateway/hono/routes/shares.js +1 -1
  441. package/dist/src/gateway/hono/routes/side-chats.js +1 -1
  442. package/dist/src/gateway/hono/routes/tasks.js +1 -1
  443. package/dist/src/gateway/hono/routes/user-model.js +7 -7
  444. package/dist/src/gateway/hono/routes/voice.js +7 -7
  445. package/dist/src/gateway/lock.js +11 -11
  446. package/dist/src/gateway/media-access.js +1 -1
  447. package/dist/src/gateway/mobile-privacy.js +2 -2
  448. package/dist/src/gateway/ports.js +6 -6
  449. package/dist/src/gateway/provider-model-setup.js +1 -1
  450. package/dist/src/gateway/server.js +1 -1
  451. package/dist/src/gateway/service/agent-runner.js +7 -6
  452. package/dist/src/gateway/service/config-coordinator.d.ts +6 -0
  453. package/dist/src/gateway/service/config-coordinator.js +2 -2
  454. package/dist/src/gateway/service/marketplace-service.js +2 -2
  455. package/dist/src/gateway/service/run-gateway-agent.js +5 -5
  456. package/dist/src/gateway/service/session-command-service.js +2 -2
  457. package/dist/src/gateway/service/session-input-coordinator.d.ts +6 -3
  458. package/dist/src/gateway/service/session-input-coordinator.js +48 -7
  459. package/dist/src/gateway/service.d.ts +1 -0
  460. package/dist/src/gateway/service.js +45 -42
  461. package/dist/src/gateway/session-context-summary.js +4 -4
  462. package/dist/src/gateway/session-reset-service.js +1 -1
  463. package/dist/src/gateway/workspace-editor-path.js +2 -2
  464. package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
  465. package/dist/src/home-intelligence/generator.js +2 -2
  466. package/dist/src/imports/inventory.js +2 -2
  467. package/dist/src/imports/productImport.js +1 -1
  468. package/dist/src/imports/runtime.js +1 -1
  469. package/dist/src/infra/gateway-processes.js +2 -2
  470. package/dist/src/infra/path-env.js +3 -3
  471. package/dist/src/infra/update-global.js +9 -9
  472. package/dist/src/knowledge/connected-knowledge-pipeline.js +1 -1
  473. package/dist/src/knowledge/index.js +1 -1
  474. package/dist/src/knowledge-memory/repository.js +1 -1
  475. package/dist/src/knowledge-memory/usage-policy.js +1 -1
  476. package/dist/src/local-apps/service.js +2 -2
  477. package/dist/src/mcp/gateway-http-client.js +1 -1
  478. package/dist/src/media-understanding/openai-compatible-audio.js +1 -1
  479. package/dist/src/memory-learning/source-learning.js +5 -5
  480. package/dist/src/memory-learning/task-receipts.js +1 -1
  481. package/dist/src/notes/agent-context.js +4 -4
  482. package/dist/src/notes/index.js +1 -1
  483. package/dist/src/notes/service.js +3 -3
  484. package/dist/src/personal-agent/capability-service.js +3 -3
  485. package/dist/src/personal-agent/proactivity/routes.js +1 -1
  486. package/dist/src/personal-agent/proactivity/service.js +7 -7
  487. package/dist/src/personal-agent/prompt-context.js +7 -7
  488. package/dist/src/personal-agent/prompts.js +2 -2
  489. package/dist/src/personal-agent/reply-composer.js +9 -9
  490. package/dist/src/personal-agent/request-access.d.ts +2 -0
  491. package/dist/src/personal-agent/request-access.js +22 -2
  492. package/dist/src/personal-agent/request-delivery.js +2 -2
  493. package/dist/src/personal-agent/request-service.js +9 -9
  494. package/dist/src/personal-agent/result-reader.js +1 -1
  495. package/dist/src/personal-agent/service.js +1 -1
  496. package/dist/src/personal-agent/specialist-capabilities.d.ts +2 -0
  497. package/dist/src/personal-agent/specialist-capabilities.js +9 -3
  498. package/dist/src/phone/adb-driver.d.ts +3 -0
  499. package/dist/src/phone/adb-driver.js +29 -0
  500. package/dist/src/phone/contracts.d.ts +14 -2
  501. package/dist/src/phone/contracts.js +8 -1
  502. package/dist/src/phone/gui-protocol.js +1 -1
  503. package/dist/src/phone/hdc-driver.d.ts +30 -0
  504. package/dist/src/phone/hdc-driver.js +331 -0
  505. package/dist/src/phone/hdc-video-bridge.d.ts +2 -0
  506. package/dist/src/phone/hdc-video-bridge.js +91 -0
  507. package/dist/src/phone/hdc-video-tools.d.ts +15 -0
  508. package/dist/src/phone/hdc-video-tools.js +123 -0
  509. package/dist/src/phone/hdc-video.d.ts +69 -0
  510. package/dist/src/phone/hdc-video.js +350 -0
  511. package/dist/src/phone/interactive-session.js +1 -1
  512. package/dist/src/phone/live-provider.d.ts +6 -0
  513. package/dist/src/phone/live-provider.js +1 -0
  514. package/dist/src/phone/model-adapter.d.ts +3 -0
  515. package/dist/src/phone/model-adapter.js +6 -4
  516. package/dist/src/phone/repository.js +3 -2
  517. package/dist/src/phone/runtime.d.ts +10 -4
  518. package/dist/src/phone/runtime.js +154 -88
  519. package/dist/src/phone/setup/service.d.ts +8 -6
  520. package/dist/src/phone/setup/service.js +33 -16
  521. package/dist/src/platform/client.d.ts +1 -1
  522. package/dist/src/platform/contracts.d.ts +1 -1
  523. package/dist/src/process/phone-process.d.ts +1 -1
  524. package/dist/src/process/phone-process.js +2 -2
  525. package/dist/src/projects/index.js +2 -2
  526. package/dist/src/projects/project-agent-suggestion.js +1 -1
  527. package/dist/src/projects/project-service.js +2 -2
  528. package/dist/src/projects/project-skill-service.js +2 -2
  529. package/dist/src/projects/workspace.js +1 -1
  530. package/dist/src/providers/model-reference-auditor.js +1 -1
  531. package/dist/src/realtime/runtime.js +1 -1
  532. package/dist/src/remote-access/exposure-manager.js +1 -1
  533. package/dist/src/runtime-tools/downloader.d.ts +1 -0
  534. package/dist/src/runtime-tools/downloader.js +8 -4
  535. package/dist/src/runtime-tools/harmony-dependencies.d.ts +24 -0
  536. package/dist/src/runtime-tools/harmony-dependencies.js +272 -0
  537. package/dist/src/runtime-tools/harmony-dependency-catalog.d.ts +4 -0
  538. package/dist/src/runtime-tools/harmony-dependency-catalog.js +54 -0
  539. package/dist/src/runtime-tools/harmony-paths.d.ts +9 -0
  540. package/dist/src/runtime-tools/harmony-paths.js +15 -0
  541. package/dist/src/runtime-tools/hdc-dependency-catalog.d.ts +8 -0
  542. package/dist/src/runtime-tools/hdc-dependency-catalog.js +83 -0
  543. package/dist/src/runtime-tools/hdc-files.d.ts +14 -0
  544. package/dist/src/runtime-tools/hdc-files.js +87 -0
  545. package/dist/src/runtime-tools/phone-dependencies.d.ts +6 -1
  546. package/dist/src/runtime-tools/phone-dependencies.js +22 -4
  547. package/dist/src/runtime-tools/phone-dependency-catalog.d.ts +10 -1
  548. package/dist/src/runtime-tools/phone-dependency-catalog.js +2 -0
  549. package/dist/src/runtime-tools/types.d.ts +1 -1
  550. package/dist/src/session/client-history.d.ts +2 -0
  551. package/dist/src/session/client-history.js +3 -0
  552. package/dist/src/session/compact-history.js +1 -0
  553. package/dist/src/session/index.js +2 -2
  554. package/dist/src/session/init-session-turn.js +1 -1
  555. package/dist/src/session/resolve-session.js +1 -1
  556. package/dist/src/session/store.js +5 -5
  557. package/dist/src/session/thinking-resolve.js +1 -1
  558. package/dist/src/share/hosted-session-share.js +2 -2
  559. package/dist/src/share/session-share-service.js +1 -1
  560. package/dist/src/share/share-store.js +1 -1
  561. package/dist/src/share/share-thumbnail.js +1 -1
  562. package/dist/src/share/site-proxy.js +1 -1
  563. package/dist/src/share/site-share-store.js +1 -1
  564. package/dist/src/storage/sqlite/connection.js +9 -9
  565. package/dist/src/storage/sqlite/schema.d.ts +2 -2
  566. package/dist/src/storage/sqlite/schema.js +7 -7
  567. package/dist/src/storage/sqlite/schema.sql +16 -0
  568. package/dist/src/storage/sqlite/session-creation-repository.js +3 -0
  569. package/dist/src/storage/sqlite/session-input-control-repository.d.ts +12 -0
  570. package/dist/src/storage/sqlite/session-input-control-repository.js +83 -0
  571. package/dist/src/storage/sqlite/session-input-repository.d.ts +2 -0
  572. package/dist/src/storage/sqlite/session-input-repository.js +17 -5
  573. package/dist/src/storage/sqlite/session-repository.js +1 -0
  574. package/dist/src/storage/sqlite/session-turn-replace-repository.d.ts +2 -0
  575. package/dist/src/storage/sqlite/session-turn-replace-repository.js +14 -2
  576. package/dist/src/storage/sqlite/upgrades/262_session_input_control.sql +15 -0
  577. package/dist/src/tasks/capabilities/read.js +2 -2
  578. package/dist/src/tasks/capabilities/write.js +1 -1
  579. package/dist/src/tasks/home-query-service.js +1 -1
  580. package/dist/src/tasks/index.js +5 -5
  581. package/dist/src/tasks/task-allocation-service.js +5 -5
  582. package/dist/src/tasks/task-application-service.js +5 -5
  583. package/dist/src/tasks/task-collaboration-delivery.js +1 -1
  584. package/dist/src/tasks/task-context-assembler.js +2 -2
  585. package/dist/src/tasks/task-contract-planner.js +2 -2
  586. package/dist/src/tasks/task-handoff-service.js +1 -1
  587. package/dist/src/tasks/task-handoff.js +4 -4
  588. package/dist/src/tasks/task-main-update-decision-service.js +3 -3
  589. package/dist/src/tasks/task-model-call.js +1 -1
  590. package/dist/src/tasks/task-research-result.js +4 -4
  591. package/dist/src/tasks/task-result-delivery-repository.js +1 -1
  592. package/dist/src/tasks/task-result-delivery-service.js +2 -2
  593. package/dist/src/tasks/task-run-coordinator.js +3 -3
  594. package/dist/src/tasks/task-run-dispatcher.js +1 -1
  595. package/dist/src/tui/backends/embedded-backend.js +11 -11
  596. package/dist/src/tui/backends/gateway-realtime-backend.js +2 -2
  597. package/dist/src/tui/extension-host/load-extensions.js +1 -1
  598. package/dist/src/tui/tui-commands.js +5 -5
  599. package/dist/src/tui/tui-picker-overlay.js +1 -1
  600. package/dist/src/tui/tui-skills-autocomplete.js +1 -1
  601. package/dist/src/tui/tui-startup-resources.js +3 -3
  602. package/dist/src/tui/tui.js +4 -4
  603. package/dist/src/tunnel/gateway-lifecycle.js +1 -1
  604. package/dist/src/user-context/access-policy.js +2 -2
  605. package/dist/src/user-model/bootstrap.js +1 -1
  606. package/dist/src/user-model/capture/executor.js +1 -1
  607. package/dist/src/user-model/index.js +2 -2
  608. package/dist/src/user-model/usage-policy.js +1 -1
  609. package/dist/src/voice/realtime/memory-context.js +5 -5
  610. package/dist/src/voice/realtime/omniRoute.js +1 -1
  611. package/dist/src/voice/realtime/runtime.js +4 -4
  612. package/dist/src/voice/stt/index.js +2 -2
  613. package/dist/src/voice/stt/preflight.js +1 -1
  614. package/dist/src/voice/stt/providers/alibaba-transcription.js +1 -1
  615. package/dist/src/voice/stt/providers/bailian-plan-transcription.js +1 -1
  616. package/dist/src/voice/stt/providers/xopc-cloud-transcription.js +1 -1
  617. package/dist/src/voice/stt/transcribe-core.js +1 -1
  618. package/dist/src/voice/tts/index.js +3 -3
  619. package/dist/src/voice/tts/merge-config.js +1 -1
  620. package/dist/src/voice/tts/payload.js +1 -1
  621. package/dist/src/voice/tts/providers/bailian-plan-speech.js +1 -1
  622. package/dist/src/voice/tts/providers/xopc-cloud-speech.js +1 -1
  623. package/dist/src/voice/tts/speak-core.js +1 -1
  624. package/dist/src/work-discovery/service.js +7 -7
  625. package/package.json +2 -2
  626. package/skills/tools/configure-xopc/SKILL.md +2 -2
  627. package/skills/tools/configure-xopc/references/phone/acceptance.md +3 -2
  628. package/skills/tools/configure-xopc/references/phone/dependencies.md +18 -2
  629. package/skills/tools/configure-xopc/references/phone/harmonyos.md +16 -0
  630. package/skills/tools/configure-xopc/references/phone/overview.md +2 -2
  631. package/skills/tools/configure-xopc/references/scene-index.md +2 -2
  632. package/dist/gateway/static/root/assets/apps-page-BrnAMjXr.js +0 -1
  633. package/dist/gateway/static/root/assets/automations-workspace-DM67xMcR.js +0 -9
  634. package/dist/gateway/static/root/assets/capabilities-page-DOMoAom0.js +0 -2
  635. package/dist/gateway/static/root/assets/capability-links-DzQWK1Fh.js +0 -1
  636. package/dist/gateway/static/root/assets/chat-page-DQNLsOad.js +0 -72
  637. package/dist/gateway/static/root/assets/computer-settings-page-C-7YLU9l.js +0 -1
  638. package/dist/gateway/static/root/assets/connected-providers-grid-DziNfbFz.js +0 -1
  639. package/dist/gateway/static/root/assets/connectors-page-CcG3V3OB.js +0 -1
  640. package/dist/gateway/static/root/assets/gateway-realtime-store-eEZgUEdH.js +0 -1
  641. package/dist/gateway/static/root/assets/index-BinHjymm.js +0 -11
  642. package/dist/gateway/static/root/assets/index-Cz-VjTNd.css +0 -1
  643. package/dist/gateway/static/root/assets/install-connector-dialog-xHNBuSj0.js +0 -1
  644. package/dist/gateway/static/root/assets/list-tree-B0OMswgM.js +0 -1
  645. package/dist/gateway/static/root/assets/messages-9OwWjlww.js +0 -3
  646. package/dist/gateway/static/root/assets/note-image-lightbox-DOG9mCzE.js +0 -1
  647. package/dist/gateway/static/root/assets/page-header-store-DBeD_mAA.js +0 -1
  648. package/dist/gateway/static/root/assets/phone-dependencies-card-CM2Mj4rH.js +0 -1
  649. package/dist/gateway/static/root/assets/phone-model-connection-kJYAiCgI.js +0 -1
  650. package/dist/gateway/static/root/assets/phone-model-picker-sXs8PpFk.js +0 -1
  651. package/dist/gateway/static/root/assets/phone-settings-page-ayCImqUb.js +0 -1
  652. package/dist/gateway/static/root/assets/plugin-details-dialog-B4qZ0obG.js +0 -1
  653. package/dist/gateway/static/root/assets/route-preload-Uhpfz1Jz.js +0 -2
  654. package/dist/gateway/static/root/assets/session-api-BwcBcvzv.js +0 -1
  655. package/dist/gateway/static/root/assets/session-channel-icon-SsY70Z6t.js +0 -1
  656. package/dist/gateway/static/root/assets/session-identity-label-B7sgG1PE.js +0 -1
  657. package/dist/gateway/static/root/assets/session-manager-SASXxhrN.js +0 -23
  658. package/dist/gateway/static/root/assets/settings-advanced-gate-iUlbBMZI.js +0 -1
  659. package/dist/gateway/static/root/assets/workspace-editor-agent-store-Bz_M_rk3.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-CB6KruU-.js","assets/rolldown-runtime-aKtaBQYM.js","assets/vendor-react-BOUWij0V.js","assets/locale-store-fGFrr4_4.js","assets/messages-9OwWjlww.js","assets/unlink-BEuthaaq.js","assets/createLucideIcon-DPHK1VkS.js","assets/check-DUBLcKHA.js","assets/copy-Dv6d4Dvw.js","assets/external-link-DjqjBmc3.js","assets/notes-api-IIQgxlMj.js","assets/dist-BGTk37IG.js","assets/es2015-DBLcMg5B.js","assets/dist-CxGUk8J-.js","assets/markdown-view-Cnt8oxNg.js","assets/chunk-KS7C4IRE-CiwuuyV8.js","assets/preload-helper-Czpn1I53.js","assets/download-Dk-ZjtO6.js","assets/file-image-CDUPkZvG.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/cn-0WouolD0.js","assets/bundle-mjs-rHxsej31.js","assets/app-link-DRy3-k7j.js","assets/product-delivery-DRyD9_Xq.js","assets/schemas-CCWMleym.js","assets/local-apps-Ck6kACsY.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/xml-_d7dTN2Q.js","assets/mermaid-render-oOellPHt.js","assets/markdown-view-C-DHb3Io.css","assets/chat-chart-block-B-ri4wfk.js","assets/skeleton-BI5TyibZ.js","assets/list-todo-CTVRto8O.js","assets/loader-circle-CifKLtgG.js","assets/mic-CuUb7zc-.js","assets/pause-DuPxgSxk.js","assets/pencil-DmIY3Oa-.js","assets/play-kxZvpBg8.js","assets/vendor-swr-CdRzEUwF.js","assets/floating-ui.dom-seOukHzT.js","assets/vendor-codemirror-aCQ0FcJT.js","assets/with-selector-xonYxPoM.js","assets/note-image-lightbox-DOG9mCzE.js","assets/block-editor-Cvy3D_4T.css","assets/markdown-editor-BuuGlcfG.js","assets/languages-zXtNocoy.js"])))=>i.map(i=>d[i]);
2
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{l as a,t as o,u as s}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{f as c,i as l,l as u,n as d,o as f,p}from"./locale-store-fGFrr4_4.js";import{t as m}from"./messages-9OwWjlww.js";import{a as h,i as g,n as _,o as v,r as y,s as b,t as x}from"./dist-BGTk37IG.js";import{E as S,b as C,d as w,h as T,i as E,n as D,o as O,r as k,t as A,w as j,x as M}from"./discussion-annotation-sync-D9-wFJDS.js";import{t as N}from"./arrow-left-D880xG-P.js";import{a as P,c as F,d as ee,i as te,l as I,n as ne,o as L,r as R,s as z,t as re,u as B}from"./product-automation-feedback-Ddj5cmmF.js";import{t as ie}from"./check-DUBLcKHA.js";import{t as V}from"./chevron-down-ccbiQQz_.js";import{n as ae,r as oe}from"./popover-select-CEMWIrtY.js";import{t as se}from"./circle-check-C23XjkUj.js";import{t as ce}from"./code-xml-DJtYhZUF.js";import{t as H}from"./copy-Dv6d4Dvw.js";import{t as le}from"./download-Dk-ZjtO6.js";import{t as ue}from"./ellipsis-0k4rZLoy.js";import{t as de}from"./external-link-DjqjBmc3.js";import{t as fe}from"./eye-CABVeTq0.js";import{t as pe}from"./file-text-D12HbeVy.js";import{t as me}from"./history-DXH_9jsE.js";import{C as he,E as ge,F as _e,O as ve,P as ye,S as U,T as W,_ as be,a as G,c as xe,d as Se,f as Ce,h as we,l as Te,m as K,n as Ee,r as q,s as J,u as De,w as Oe,x as ke}from"./notes-api-IIQgxlMj.js";import{t as Ae}from"./loader-circle-CifKLtgG.js";import{P as je}from"./markdown-view-Cnt8oxNg.js";import{t as Me}from"./message-circle-Badhj-4D.js";import{t as Ne}from"./pencil-DmIY3Oa-.js";import{t as Pe}from"./play-kxZvpBg8.js";import{t as Fe}from"./refresh-cw-BRlGaq2w.js";import{t as Ie}from"./search-DA7gz22f.js";import{t as Le}from"./sparkles-DHlfQFAF.js";import{t as Re}from"./square-pen-B8FsvqNu.js";import{t as Y}from"./square-DMK_fB-3.js";import{t as ze}from"./trash-2-DusmjVPV.js";import{t as X}from"./x-B_N4OPjy.js";import{t as Be}from"./cn-0WouolD0.js";import{t as Ve}from"./skeleton-BI5TyibZ.js";import{t as He}from"./session-manager-SASXxhrN.js";import{i as Ue}from"./vendor-swr-CdRzEUwF.js";import{t as Z}from"./button-Cc4hUNTt.js";import{a as We,i as Ge,o as Ke,s as qe}from"./dist-GJ8-1PAx.js";import{t as Je}from"./copy-to-clipboard-HOJ79TWv.js";import{r as Ye}from"./app-chrome-BeB4KgOf.js";import{i as Xe}from"./theme-store-De43hGnm.js";import{t as Ze}from"./page-header-store-DBeD_mAA.js";import{t as Qe}from"./sliding-tab-list-DuQyViqe.js";import{t as $e}from"./confirm-dialog-D7dQJytv.js";import{b as et,d as tt,o as nt,s as rt,v as it}from"./shares-api-C1rliVTe.js";import{l as at,m as ot,o as st,r as ct,t as lt,u as ut}from"./dist-ZrL34Ps4.js";import{t as dt}from"./automation-api-ZD1VY9jO.js";import{t as ft}from"./oauth-provider-connect-D_p1ez-o.js";import{n as pt,t as mt}from"./page-context-draft-BbGvUKjF.js";import"./note-image-lightbox-DOG9mCzE.js";import{t as ht}from"./page-context-capture-button-CiEaCz7v.js";var Q=e(t(),1),gt=n(),$=r(),_t=6e4,vt=36e5,yt=864e5;function bt(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function xt(e,t,n){let r=t-e;if(r<_t)return n.justNow;if(r<vt){let e=Math.floor(r/_t);return n.minutesAgo.replace(`{{n}}`,String(e))}let i=bt(t);if(e>=i)return n.today+` `+new Date(e).toLocaleTimeString(n.locale,{hour:`2-digit`,minute:`2-digit`});if(e>=i-yt)return n.yesterday+` `+new Date(e).toLocaleTimeString(n.locale,{hour:`2-digit`,minute:`2-digit`});if(r<7*yt){let e=Math.floor(r/yt);return n.daysAgo.replace(`{{n}}`,String(e))}return new Date(e).toLocaleDateString(n.locale,{month:`short`,day:`numeric`})}function St(e,t,n){let r=bt(t);if(e>=r)return n.today;if(e>=r-yt)return n.yesterday;let i=new Date(e),a=new Date(t);return i.getFullYear()===a.getFullYear()?i.toLocaleDateString(n.locale,{month:`long`,day:`numeric`}):i.toLocaleDateString(n.locale,{year:`numeric`,month:`long`,day:`numeric`})}function Ct(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function wt(e){let t=(0,gt.c)(45),{title:n,description:r,prompt:i,coverage:a,className:o,variant:c}=e,l=c===void 0?`card`:c,u=d(Dt),f=m(u).automations.suggestions,p=m(u).automations,h=s(),g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g={revalidateOnFocus:!1,refreshInterval:15e3},t[0]=g):g=t[0];let{data:_}=Ue(a?`automation-suggestion-coverage`:null,Et,g),v=a?_?.automations.find(e=>te(e,a)):void 0,y=v?ne(v,p):[];if(l===`titleAction`){if(v){let e;t[1]===o?e=t[2]:(e=Be(`flex min-w-0 items-center gap-2 rounded-lg border border-emerald-500/25 bg-emerald-500/10 px-2.5 py-1.5`,o),t[1]=o,t[2]=e);let n;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(se,{className:`size-3.5 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[3]=n):n=t[3];let r;return t[4]===h?r=t[5]:(r=()=>h(`/automations`),t[4]=h,t[5]=r),(0,$.jsxs)(`section`,{className:e,children:[n,(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,children:f.coveredTitle}),(0,$.jsx)(Z,{variant:`ghost`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:r,children:f.manage})]})}let e;t[6]===o?e=t[7]:(e=Be(`flex min-w-0 items-center gap-2 rounded-lg bg-surface-panel px-2.5 py-1.5 shadow-surface`,o),t[6]=o,t[7]=e);let a;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(j,{className:`size-3.5 shrink-0 text-accent`,"aria-hidden":!0}),t[8]=a):a=t[8];let s;t[9]!==r||t[10]!==n?(s=(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,title:r,children:n}),t[9]=r,t[10]=n,t[11]=s):s=t[11];let c;t[12]!==h||t[13]!==i?(c=()=>{let e=new URLSearchParams({draft:i,autogenerate:`1`});h(`/automations?${e.toString()}`)},t[12]=h,t[13]=i,t[14]=c):c=t[14];let l;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(Le,{className:`size-3.5`,"aria-hidden":!0}),t[15]=l):l=t[15],(0,$.jsxs)(`section`,{className:e,children:[a,s,(0,$.jsxs)(Z,{variant:`secondary`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:c,children:[l,f.setup]})]})}if(v){let e;t[16]===o?e=t[17]:(e=Be(`rounded-lg border border-emerald-500/25 bg-emerald-500/10 p-3`,o),t[16]=o,t[17]=e);let n;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(se,{className:`mt-0.5 size-4 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[18]=n):n=t[18];let r;t[19]===h?r=t[20]:(r=()=>h(`/automations`),t[19]=h,t[20]=r);let i;return t[21]!==f||t[22]!==r?(i=(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsx)(Z,{variant:`ghost`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:r,children:f.manage})}),t[21]=f,t[22]=r,t[23]=i):i=t[23],(0,$.jsxs)(`section`,{className:e,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[n,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:f.coveredTitle}),(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:R(f.coveredDescription,{name:v.name})})]})]}),(0,$.jsxs)(`div`,{className:`mt-2 rounded-md bg-surface-base/55 px-2.5 py-2`,children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg`,children:p.explain.whyCovered}),(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:y.map(Tt)})]}),i]})}let b;t[24]===o?b=t[25]:(b=Be(`rounded-lg bg-surface-panel p-3 shadow-surface`,o),t[24]=o,t[25]=b);let x;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(j,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[26]=x):x=t[26];let S;t[27]===n?S=t[28]:(S=(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n}),t[27]=n,t[28]=S);let C;t[29]===r?C=t[30]:(C=(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:r}),t[29]=r,t[30]=C);let w;t[31]!==S||t[32]!==C?(w=(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[x,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[S,C]})]}),t[31]=S,t[32]=C,t[33]=w):w=t[33];let T;t[34]!==h||t[35]!==i?(T=()=>{let e=new URLSearchParams({draft:i,autogenerate:`1`});h(`/automations?${e.toString()}`)},t[34]=h,t[35]=i,t[36]=T):T=t[36];let E;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(Le,{className:`size-3.5`,"aria-hidden":!0}),t[37]=E):E=t[37];let D;t[38]!==f.create||t[39]!==T?(D=(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsxs)(Z,{variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:T,children:[E,f.create]})}),t[38]=f.create,t[39]=T,t[40]=D):D=t[40];let O;return t[41]!==D||t[42]!==b||t[43]!==w?(O=(0,$.jsxs)(`section`,{className:b,children:[w,D]}),t[41]=D,t[42]=b,t[43]=w,t[44]=O):O=t[44],O}function Tt(e){return(0,$.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function Et(){return dt.list()}function Dt(e){return e.language}function Ot(e){let t=(0,gt.c)(93),{detail:n,template:r,onTemplate:i,zh:a,busy:o,processing:s,pageText:c,editing:u,onOrganize:d,onRegenerate:f,onPersonalNotes:p,noteActions:m}=e,[h,g]=(0,Q.useState)(!1),_;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>{g(!1),e()},t[0]=_):_=t[0];let v=_,y=`/api/discussions/${encodeURIComponent(n.discussion.id)}`,b=!!n.discussion.audioAttachmentId&&!n.discussion.audioDeletedAt,x=a?`更多笔记操作`:`More note actions`,S;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,$.jsx)(ue,{className:`size-5`,"aria-hidden":!0}),t[1]=S):S=t[1];let C;t[2]===x?C=t[3]:(C=(0,$.jsx)(qe,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,"aria-label":x,className:`inline-flex size-11 shrink-0 items-center justify-center rounded-full text-fg-muted hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:S})}),t[2]=x,t[3]=C);let w=a?`笔记工具`:`Note tools`,T;t[4]!==p||t[5]!==a?(T=p?(0,$.jsxs)(Z,{className:`min-h-11 w-full justify-start`,onClick:()=>v(p),children:[(0,$.jsx)(Re,{className:`size-4`}),a?`添加我的补充`:`Add my notes`]}):null,t[4]=p,t[5]=a,t[6]=T):T=t[6];let E;t[7]!==m||t[8]!==a?(E=m?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(Z,{className:`min-h-11 w-full justify-start`,disabled:m.busy,onClick:()=>v(m.onAnalyze),children:[(0,$.jsx)(Le,{className:`size-4`}),a?`进一步分析`:`Analyze this note`]}),(0,$.jsxs)(Z,{className:`min-h-11 w-full justify-start`,disabled:m.busy,onClick:()=>v(m.onChat),children:[(0,$.jsx)(Me,{className:`size-4`}),a?`就这篇笔记提问`:`Ask about this note`]})]}):null,t[7]=m,t[8]=a,t[9]=E):E=t[9];let D=a?`整理笔记`:`Organize notes`,O;t[10]===D?O=t[11]:(O=(0,$.jsx)(`p`,{className:`px-2 text-xs text-fg-muted`,children:D}),t[10]=D,t[11]=O);let k=a?`纪要模板`:`Summary template`,A;t[12]===i?A=t[13]:(A=e=>i(e.target.value),t[12]=i,t[13]=A);let j=a?`通用会议`:`General`,M;t[14]===j?M=t[15]:(M=(0,$.jsx)(oe,{value:`general`,children:j}),t[14]=j,t[15]=M);let N=a?`项目例会`:`Project`,P;t[16]===N?P=t[17]:(P=(0,$.jsx)(oe,{value:`project`,children:N}),t[16]=N,t[17]=P);let F=a?`需求评审`:`Review`,ee;t[18]===F?ee=t[19]:(ee=(0,$.jsx)(oe,{value:`review`,children:F}),t[18]=F,t[19]=ee);let te=a?`客户访谈`:`Interview`,I;t[20]===te?I=t[21]:(I=(0,$.jsx)(oe,{value:`interview`,children:te}),t[20]=te,t[21]=I);let ne;t[22]!==k||t[23]!==A||t[24]!==M||t[25]!==P||t[26]!==ee||t[27]!==I||t[28]!==r?(ne=(0,$.jsxs)(ae,{value:r,"aria-label":k,onChange:A,children:[M,P,ee,I]}),t[22]=k,t[23]=A,t[24]=M,t[25]=P,t[26]=ee,t[27]=I,t[28]=r,t[29]=ne):ne=t[29];let L=o||s||!n.discussion.canonicalTranscript,R;t[30]===d?R=t[31]:(R=()=>v(d),t[30]=d,t[31]=R);let z;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,$.jsx)(Fe,{className:`size-4`}),t[32]=z):z=t[32];let re=a?`重新整理纪要`:`Regenerate summary`,B;t[33]!==L||t[34]!==R||t[35]!==re?(B=(0,$.jsxs)(Z,{className:`min-h-11 w-full justify-start`,disabled:L,onClick:R,children:[z,re]}),t[33]=L,t[34]=R,t[35]=re,t[36]=B):B=t[36];let ie;t[37]!==b||t[38]!==o||t[39]!==n.discussion.status||t[40]!==f||t[41]!==s||t[42]!==a?(ie=b&&[`completed`,`needs_attention`].includes(n.discussion.status)?(0,$.jsx)(Z,{className:`min-h-11 w-full justify-start`,disabled:o||s,onClick:()=>v(f),children:a?`从原音重新生成`:`Regenerate from audio`}):null,t[37]=b,t[38]=o,t[39]=n.discussion.status,t[40]=f,t[41]=s,t[42]=a,t[43]=ie):ie=t[43];let V;t[44]!==ne||t[45]!==B||t[46]!==ie||t[47]!==O?(V=(0,$.jsxs)(`div`,{className:`space-y-2 py-3`,children:[O,ne,B,ie]}),t[44]=ne,t[45]=B,t[46]=ie,t[47]=O,t[48]=V):V=t[48];let se=a?`导出与分享`:`Export and share`,ce;t[49]===se?ce=t[50]:(ce=(0,$.jsx)(`p`,{className:`px-2 text-xs text-fg-muted`,children:se}),t[49]=se,t[50]=ce);let H;t[51]!==b||t[52]!==y||t[53]!==a?(H=b?(0,$.jsxs)(`a`,{className:`flex min-h-11 items-center gap-2 rounded-lg px-2 text-sm hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,href:l(`${y}/audio`),download:!0,children:[(0,$.jsx)(le,{className:`size-4`}),a?`下载录音`:`Download recording`]}):null,t[51]=b,t[52]=y,t[53]=a,t[54]=H):H=t[54];let de;t[55]!==m||t[56]!==a?(de=m?(0,$.jsx)(Z,{className:`min-h-11 w-full justify-start`,disabled:m.busy,onClick:()=>v(m.onShare),children:a?`分享笔记`:`Share note`}):null,t[55]=m,t[56]=a,t[57]=de):de=t[57];let fe;t[58]===y?fe=t[59]:(fe=(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:[`md`,`txt`,`srt`].map(e=>(0,$.jsx)(`a`,{className:`inline-flex min-h-11 items-center rounded-lg px-3 text-sm text-accent-fg hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,href:l(`${y}/export?format=${e}`),download:!0,children:e.toUpperCase()},e))}),t[58]=y,t[59]=fe);let pe=n.note.id,me=String(n.note.remoteVersion??1),he;t[60]!==n.note.id||t[61]!==me?(he={kind:`note`,id:pe,revision:me},t[60]=n.note.id,t[61]=me,t[62]=he):he=t[62];let ge;t[63]===c?ge=t[64]:(ge={text:c,draft:!1},t[63]=c,t[64]=ge);let _e=a?`带到新对话`:`Use in a new chat`,ve=o||s||u||!c||c.length>16e3,ye;t[65]!==he||t[66]!==ge||t[67]!==_e||t[68]!==ve?(ye=(0,$.jsx)(ht,{resource:he,selection:ge,label:_e,disabled:ve}),t[65]=he,t[66]=ge,t[67]=_e,t[68]=ve,t[69]=ye):ye=t[69];let U=c.length>16e3?a?`内容较长,请先筛选部分原文。`:`Filter the transcript to share a smaller selection.`:a?`分享当前显示的文字,不包含原音。`:`Shares displayed text, without audio.`,W;t[70]===U?W=t[71]:(W=(0,$.jsx)(`p`,{className:`px-2 text-xs leading-5 text-fg-muted`,children:U}),t[70]=U,t[71]=W);let be;t[72]!==ce||t[73]!==H||t[74]!==de||t[75]!==fe||t[76]!==ye||t[77]!==W?(be=(0,$.jsxs)(`div`,{className:`space-y-2 border-t border-edge-subtle py-3`,children:[ce,H,de,fe,ye,W]}),t[72]=ce,t[73]=H,t[74]=de,t[75]=fe,t[76]=ye,t[77]=W,t[78]=be):be=t[78];let G;t[79]!==m||t[80]!==a?(G=m?(0,$.jsxs)(`div`,{className:`space-y-1 border-t border-edge-subtle pt-2`,children:[(0,$.jsx)(Z,{className:`min-h-11 w-full justify-start`,onClick:()=>v(m.onHistory),children:a?`版本历史`:`Version history`}),(0,$.jsx)(Z,{className:`min-h-11 w-full justify-start text-danger`,disabled:m.busy,onClick:()=>v(m.onDelete),children:a?`删除笔记`:`Delete note`})]}):null,t[79]=m,t[80]=a,t[81]=G):G=t[81];let xe;t[82]!==V||t[83]!==be||t[84]!==G||t[85]!==w||t[86]!==T||t[87]!==E?(xe=(0,$.jsx)(We,{children:(0,$.jsxs)(Ge,{align:`end`,sideOffset:6,collisionPadding:12,"aria-label":w,className:`z-[140] max-h-[min(38rem,var(--radix-popover-content-available-height,85dvh))] w-[min(20rem,calc(100vw-2rem))] overflow-y-auto rounded-2xl border border-edge bg-surface-overlay p-3 text-fg shadow-elevated`,children:[T,E,V,be,G]})}),t[82]=V,t[83]=be,t[84]=G,t[85]=w,t[86]=T,t[87]=E,t[88]=xe):xe=t[88];let Se;return t[89]!==h||t[90]!==C||t[91]!==xe?(Se=(0,$.jsxs)(Ke,{open:h,onOpenChange:g,children:[C,xe]}),t[89]=h,t[90]=C,t[91]=xe,t[92]=Se):Se=t[92],Se}var kt=e=>`${Math.floor(e/6e4)}:${String(Math.floor(e/1e3)%60).padStart(2,`0`)}`;function At({id:e,query:t,zh:n,refreshKey:r,sourceKey:i,active:a,tab:o,onEvidence:s,onPlay:c}){let[u,d]=(0,Q.useState)(),[p,m]=(0,Q.useState)(!0),[h,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)(!1),y=(0,Q.useRef)(0),[b,x]=(0,Q.useState)(),[S,C]=(0,Q.useState)(),[w,T]=(0,Q.useState)(``),[E,D]=(0,Q.useState)(0);(0,Q.useEffect)(()=>{if(!a||t)return;let e=window.setInterval(()=>D(e=>e+1),3e3);return()=>window.clearInterval(e)},[a,t]),(0,Q.useEffect)(()=>{C(void 0)},[e,t]),(0,Q.useEffect)(()=>{let n=++y.current,r=new AbortController;m(!0),v(!1),g(``);let a=window.setTimeout(()=>{f(l(`/api/discussions/${encodeURIComponent(e)}/review?q=${encodeURIComponent(t)}`),{signal:r.signal}).then(e=>{y.current===n&&(d(e),x(i),T(t))}).catch(e=>{y.current===n&&!r.signal.aborted&&g(String(e))}).finally(()=>{y.current===n&&m(!1)})},t?200:0);return()=>{y.current++,r.abort(),window.clearTimeout(a)}},[e,t,r,i,E]);async function O(){if(!u||_)return;let r=y.current;v(!0);try{let n=await f(l(`/api/discussions/${encodeURIComponent(e)}/review?q=${encodeURIComponent(t)}&offset=${u.hits.length}&version=${u.version}`));r===y.current&&d({...n,hits:[...u.hits,...n.hits]})}catch(e){r===y.current&&g(n?`内容已变化,请重新搜索。${String(e)}`:`Content changed; search again. ${String(e)}`)}finally{v(!1)}}function k(e){C(e),(!e.provisional||e.kind===`chapter`)&&e.transcriptRevision!==void 0&&e.segments.length&&s({transcriptRevision:e.transcriptRevision,stale:e.stale,audioAvailable:u?.coverage.audioAvailable??!1,timingVerified:e.segments.some(e=>e.playback.length>0),segments:e.segments})}let A=e=>e.kind===`chapter`?n?`章节`:`Chapter`:e.kind===`annotation`?n?`我的标记`:`My mark`:e.kind===`analysis`?n?`分析`:`Analysis`:n?`原文`:`Transcript`,j=e=>(0,$.jsxs)(`article`,{className:`space-y-2 rounded-xl bg-surface-inset p-4`,children:[(0,$.jsxs)(`button`,{className:`text-left text-sm text-accent-fg`,onClick:()=>k(e),children:[e.startedAtMs===void 0?``:`${kt(e.startedAtMs)}${e.endedAtMs===void 0?``:`–${kt(e.endedAtMs)}`} · `,e.title||A(e)]}),(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-sm`,children:e.kind===`chapter`&&!t&&e.text.length>300?`${e.text.slice(0,300)}…`:e.text}),(0,$.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[A(e),e.provisional?n?` · 阶段性结果`:` · Partial result`:``,e.stale?n?` · 原文已更新,保留旧版依据`:` · Earlier transcript revision`:``,e.kind===`chapter`?` · ${e.highlightCount??0} ${n?`个重点`:`marks`} · ${e.actionCount??0} ${n?`个候选行动`:`candidate actions`}`:``]}),e.kind!==`chapter`||t||S?.id===e.id?e.segments.map(e=>(0,$.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[kt(e.startedAtMs),` · `,e.text.length>500?`${e.text.slice(0,500)}…`:e.text]},`${e.sequence}:${e.startedAtMs}`)):null,e.playback.slice(0,3).map((e,t)=>(0,$.jsxs)(Z,{onClick:()=>c(e.startedAtMs,e.endedAtMs),children:[n?`回听上下文`:`Play context`,` `,kt(e.startedAtMs),`–`,kt(e.endedAtMs)]},t)),e.segments.length?(0,$.jsx)(Z,{onClick:()=>k(e),children:n?`查看对应原文`:`View transcript`}):(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`暂无可核实的原文定位`:`No verified transcript reference`})]},e.id);return(0,$.jsxs)(`section`,{"aria-label":n?`长录音回顾`:`Recording review`,className:`flex flex-col gap-3`,children:[h?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:h}),(0,$.jsx)(Z,{onClick:()=>D(e=>e+1),children:n?`刷新结果`:`Refresh results`})]}):null,p&&(!u||b!==i||w!==t)?(0,$.jsx)(Ve,{className:`h-20 w-full`}):null,u&&b===i&&(!t||w===t)?(0,$.jsxs)($.Fragment,{children:[t?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium`,children:n?`搜索结果 · ${u.total}`:`Search results · ${u.total}`}),(0,$.jsx)(Z,{onClick:()=>D(e=>e+1),children:n?`刷新结果`:`Refresh results`}),(0,$.jsx)(`div`,{"aria-label":n?`命中位置`:`Match positions`,className:`relative my-3 h-5 rounded bg-surface-inset`,children:u.hits.filter(e=>e.startedAtMs!==void 0).map(e=>(0,$.jsx)(`button`,{className:`absolute top-0 h-5 w-1.5 rounded bg-accent`,style:{left:`${Math.min(99,100*e.startedAtMs/Math.max(1,u.coverage.durationMs))}%`},"aria-label":`${kt(e.startedAtMs)} ${e.title||A(e)}`,onClick:()=>k(e)},e.id))}),u.total?null:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n?`未找到关键词;尚未转写的内容无法搜索。`:`No matches. Untranscribed audio is not searchable yet.`}),u.hits.map(j)]}):(0,$.jsxs)($.Fragment,{children:[o===`summary`&&u.chapters.length?(0,$.jsxs)(`details`,{className:`rounded-xl bg-surface-inset px-4`,children:[(0,$.jsxs)(`summary`,{className:`min-h-11 cursor-pointer py-3 text-sm font-medium focus-visible:ring-2 focus-visible:ring-accent`,children:[n?`章节目录`:`Chapters`,` · `,u.chapters.length]}),(0,$.jsx)(`div`,{className:`space-y-3 pb-4`,children:u.chapters.map(j)})]}):null,u.hits.length?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium`,children:n?`本轮已完成转写(阶段性)`:`Available transcription from this run`}),u.hits.map(j)]}):null]}),u.hasMore?(0,$.jsx)(Z,{disabled:_,onClick:()=>void O(),children:n?`加载更多结果`:`More results`}):null,(0,$.jsxs)(`details`,{className:`rounded-lg text-xs text-fg-muted`,children:[(0,$.jsx)(`summary`,{className:`min-h-11 cursor-pointer py-3 focus-visible:ring-2 focus-visible:ring-accent`,children:n?`处理范围`:`Processing coverage`}),(0,$.jsxs)(`div`,{role:`status`,className:`space-y-2 pb-3 leading-5`,children:[(0,$.jsxs)(`p`,{children:[n?`原音`:`Audio`,` · `,u.coverage.audioAvailable?n?`已保存,可回听`:`Saved, ready to play`:n?`尚不可用`:`Unavailable`]}),(0,$.jsxs)(`p`,{children:[n?`本轮转写已处理`:`Processed this run`,` `,kt(u.coverage.processedMs),` / `,kt(u.coverage.durationMs),` · `,n?`连续处理至`:`Continuous through`,` `,kt(u.coverage.continuousThroughMs)]}),(0,$.jsxs)(`p`,{children:[n?`分析覆盖`:`Analysis coverage`,` · `,u.coverage.analysisRanges.length?u.coverage.analysisRanges.map(e=>`${kt(e.startedAtMs)}–${kt(e.endedAtMs)}`).join(`、`):n?`暂无本版已完成章节`:`No completed chapters for this revision`,u.coverage.analysisStale?n?`;已发布分析基于旧版原文`:`; published analysis uses an earlier transcript`:``,` · `,u.coverage.complete?n?`本轮处理完成`:`Run complete`:n?`阶段性内容,其余仍待处理`:`Partial content; remaining work pending`]})]})]}),S?.provisional?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`以上是本轮已保存的阶段性原文;正式发布后才能校对和标记具体段落。`:`Saved partial text; segment editing and highlighting become available after publication.`}):null]}):null]})}function jt({recordingId:e,discussionId:t,zh:n,onEvidence:r,onPlay:i}){let{data:a=[],mutate:o}=Ue(`/api/discussions/${t}/annotations`,e=>f(l(e))),[s,c]=(0,Q.useState)([]),[u,d]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(``),_=(0,Q.useCallback)(async()=>{c(await k(e))},[e]),v=(0,Q.useCallback)(async()=>{try{await A(e,t),await _(),await o()}catch(e){await o(),g(e instanceof Error?e.message:String(e))}},[e,t,_,o]);(0,Q.useEffect)(()=>{_().catch(e=>g(String(e))),v();let e=()=>{_().catch(e=>g(String(e)))};window.addEventListener(`discussion-annotations-changed`,e),window.addEventListener(`online`,v);let t=window.setInterval(()=>{navigator.onLine&&v()},15e3);return()=>{window.removeEventListener(`discussion-annotations-changed`,e),window.removeEventListener(`online`,v),window.clearInterval(t)}},[_,v]);let y=new Map(a.map(e=>[e.annotation.id,{...e,localState:`synced`}]));for(let e of s)if(e.state!==`synced`||!y.has(e.annotation.id)){let t=y.get(e.annotation.id);y.set(e.annotation.id,{annotation:e.annotation,state:t?.state??`pending`,playback:t?.playback??[],evidence:t?.evidence,localState:e.state})}let b=async(t,n=s.find(e=>e.annotation.id===t.id)?.nonce??null)=>{try{await O(e,{...t,updatedAt:Date.now()},n),m(null),g(``),await _(),v()}catch(e){g(e instanceof Error?e.message:String(e))}};return(0,$.jsxs)(`section`,{className:`space-y-4`,"aria-label":n?`我的标记`:`My highlights`,children:[h?(0,$.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[h,(0,$.jsx)(Z,{onClick:()=>void v(),children:n?`重试同步`:`Retry sync`})]}):null,y.size?null:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n?`录音时标重点,或在原文中标记整段。标记先保存在本机。`:`Highlight while recording or mark a transcript segment. Highlights save locally first.`}),[...y.values()].sort((e,t)=>e.annotation.anchor.capturedAt-t.annotation.anchor.capturedAt).filter(e=>!e.annotation.deleted||e.localState===`conflict`).map(e=>(0,$.jsxs)(`article`,{className:`space-y-2 rounded-lg border border-edge p-3`,children:[(0,$.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[e.annotation.kind===`highlight`?n?`重点`:`Highlight`:e.annotation.kind===`question`?n?`问题`:`Question`:n?`我的补充`:`My note`,` · `,new Date(e.annotation.anchor.capturedAt).toLocaleString(),` · `,e.localState===`synced`?n?`已同步`:`Synced`:e.localState===`conflict`?n?`同步冲突,保留了本机修改`:`Conflict; local edits retained`:n?`本机已保存,待同步`:`Saved locally; sync pending`]}),e.evidence?.segments.map(e=>(0,$.jsx)(`blockquote`,{className:`text-sm`,children:e.text},e.sequence)),e.positionMs===void 0?null:(0,$.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[n?`标记位置`:`Marked position`,` · `,Math.floor(e.positionMs/6e4),`:`,String(Math.floor(e.positionMs/1e3)%60).padStart(2,`0`)]}),e.annotation.text?(0,$.jsxs)(`p`,{className:`whitespace-pre-wrap text-sm`,children:[n?`我的说明:`:`My context: `,e.annotation.text]}):null,(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsx)(Z,{disabled:!e.evidence,onClick:()=>e.evidence&&r(e.evidence),children:n?`查看原文`:`View transcript`}),e.playback.map((e,t)=>(0,$.jsxs)(Z,{onClick:()=>i(e),children:[n?`回听`:`Play`,` `,Math.floor(e.startedAtMs/6e4),`:`,String(Math.floor(e.startedAtMs/1e3)%60).padStart(2,`0`)]},t)),(0,$.jsx)(Z,{onClick:()=>{d(s.find(t=>t.annotation.id===e.annotation.id)?.nonce??null),m({...e.annotation,revision:a.find(t=>t.annotation.id===e.annotation.id)?.annotation.revision??e.annotation.revision})},children:e.localState===`conflict`?n?`合并修改`:`Merge changes`:n?`添加说明/类型`:`Edit context/type`}),(0,$.jsx)(Z,{onClick:()=>void b({...e.annotation,deleted:!0}),children:n?`移除标记`:`Remove`})]}),e.state===`located`&&!e.evidence?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`该位置原文尚未生成,可先回听原音。`:`Transcript for this position is pending; audio is usable.`}):null,e.state===`unavailable`?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`该位置原音未保存、已删除或时间尚无法核实;保留原始标记,不自动移动。`:`Audio at this position is missing, deleted or unverified. The original anchor has been retained.`}):e.state===`pending`?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`等待原音/原文完成定位`:`Awaiting audio/transcript positioning`}):null,e.localState===`conflict`?(0,$.jsx)(Z,{onClick:()=>{let t=s.find(t=>t.annotation.id===e.annotation.id),n=a.find(t=>t.annotation.id===e.annotation.id);t&&n&&D(t,n.annotation).then(_)},children:n?`使用服务端版本`:`Use server version`}):null]},e.annotation.id)),p?(0,$.jsxs)(`div`,{role:`dialog`,"aria-label":n?`编辑标记`:`Edit highlight`,className:`rounded-lg border border-edge p-3`,children:[(0,$.jsxs)(ae,{value:p.kind,"aria-label":n?`标记类型`:`Highlight type`,onChange:e=>m({...p,kind:e.target.value}),children:[(0,$.jsx)(oe,{value:`highlight`,children:n?`重点`:`Highlight`}),(0,$.jsx)(oe,{value:`question`,children:n?`问题`:`Question`}),(0,$.jsx)(oe,{value:`note`,children:n?`补充`:`Context`})]}),(0,$.jsx)(`textarea`,{"aria-label":n?`我的说明`:`My context`,maxLength:4e3,value:p.text,onChange:e=>m({...p,text:e.target.value}),className:`my-2 min-h-24 w-full rounded border border-edge bg-surface-inset p-2`}),(0,$.jsx)(Z,{onClick:()=>void b(p,u),children:n?`保存到本机并同步`:`Save locally and sync`}),(0,$.jsx)(Z,{onClick:()=>m(null),children:n?`取消`:`Cancel`})]}):null]})}var Mt={tab:`summary`,query:``,page:1,positionMs:0},Nt=p((e,t)=>({notes:{},update:(n,r)=>{let i={...Ft(n,t().notes[n]),...r};e(e=>({notes:{...e.notes,[n]:i}}));try{localStorage.setItem(`discussion-review:${n}`,JSON.stringify(i))}catch{}}})),Pt=new Map;function Ft(e,t){if(t)return t;if(Pt.has(e))return Pt.get(e);let n=Mt;try{let t=JSON.parse(localStorage.getItem(`discussion-review:${e}`)??`null`);t&&[`summary`,`transcript`,`marks`].includes(t.tab)&&typeof t.query==`string`&&Number.isSafeInteger(t.page)&&t.page>0&&t.page<=1e4&&Number.isFinite(t.positionMs)&&t.positionMs>=0&&(n={...Mt,...t})}catch{}return Pt.set(e,n),n}function It(e){let t=(0,gt.c)(51),{initial:n,zh:r,busy:i,onClose:a,onSave:o}=e,[s,c]=(0,Q.useState)(n),l;t[0]!==i||t[1]!==a?(l=e=>{!e&&!i&&a()},t[0]=i,t[1]=a,t[2]=l):l=t[2];let u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(h,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),t[3]=u):u=t[3];let d=r?`编辑纪要内容`:`Edit meeting content`,f;t[4]===d?f=t[5]:(f=(0,$.jsx)(`header`,{className:`border-b border-edge p-4`,children:(0,$.jsx)(b,{children:d})}),t[4]=d,t[5]=f);let p=r?`人工修改会保留,重新整理不会覆盖。已创建任务保持不变。`:`Your changes survive regeneration. Existing tasks remain unchanged.`,m;t[6]===p?m=t[7]:(m=(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:p}),t[6]=p,t[7]=m);let g=r?`内容`:`Content`,_;t[8]===s?_=t[9]:(_=e=>c({...s,text:e.target.value}),t[8]=s,t[9]=_);let S;t[10]!==s.text||t[11]!==_?(S=(0,$.jsx)(`textarea`,{className:`mt-1 min-h-32 w-full rounded border border-edge bg-transparent p-2`,value:s.text,onChange:_}),t[10]=s.text,t[11]=_,t[12]=S):S=t[12];let C;t[13]!==g||t[14]!==S?(C=(0,$.jsxs)(`label`,{className:`block text-sm`,children:[g,S]}),t[13]=g,t[14]=S,t[15]=C):C=t[15];let w;t[16]!==s||t[17]!==r?(w=s.kind===`actionItems`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`label`,{className:`block text-sm`,children:[r?`负责人原话`:`Owner as stated`,(0,$.jsx)(`input`,{className:`mt-1 w-full rounded border border-edge bg-transparent p-2`,value:s.owner??``,onChange:e=>c({...s,owner:e.target.value})})]}),(0,$.jsxs)(`label`,{className:`block text-sm`,children:[r?`期限原话`:`Date as stated`,(0,$.jsx)(`input`,{className:`mt-1 w-full rounded border border-edge bg-transparent p-2`,value:s.dueDate??``,onChange:e=>c({...s,dueDate:e.target.value})})]})]}):null,t[16]=s,t[17]=r,t[18]=w):w=t[18];let T;t[19]!==s||t[20]!==r?(T=s.kind===`summary`?null:(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:!!s.ignored,onChange:e=>c({...s,ignored:e.target.checked})}),r?`忽略此项`:`Ignore this item`]}),t[19]=s,t[20]=r,t[21]=T):T=t[21];let E;t[22]!==C||t[23]!==w||t[24]!==T||t[25]!==m?(E=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-4`,children:[m,C,w,T]}),t[22]=C,t[23]=w,t[24]=T,t[25]=m,t[26]=E):E=t[26];let D=r?`取消`:`Cancel`,O;t[27]!==i||t[28]!==a||t[29]!==D?(O=(0,$.jsx)(Z,{disabled:i,onClick:a,children:D}),t[27]=i,t[28]=a,t[29]=D,t[30]=O):O=t[30];let k;t[31]!==i||t[32]!==s.text?(k=i||!s.text.trim(),t[31]=i,t[32]=s.text,t[33]=k):k=t[33];let A;t[34]!==s||t[35]!==o?(A=()=>void o(s),t[34]=s,t[35]=o,t[36]=A):A=t[36];let j=r?`保存修改`:`Save changes`,M;t[37]!==k||t[38]!==A||t[39]!==j?(M=(0,$.jsx)(Z,{variant:`primary`,disabled:k,onClick:A,children:j}),t[37]=k,t[38]=A,t[39]=j,t[40]=M):M=t[40];let N;t[41]!==O||t[42]!==M?(N=(0,$.jsxs)(`footer`,{className:`flex justify-end gap-2 border-t border-edge p-3`,children:[O,M]}),t[41]=O,t[42]=M,t[43]=N):N=t[43];let P;t[44]!==E||t[45]!==N||t[46]!==f?(P=(0,$.jsxs)(v,{children:[u,(0,$.jsxs)(y,{"aria-describedby":void 0,className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[71] flex h-[min(32rem,90dvh)] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay`,children:[f,E,N]})]}),t[44]=E,t[45]=N,t[46]=f,t[47]=P):P=t[47];let F;return t[48]!==l||t[49]!==P?(F=(0,$.jsx)(x,{open:!0,onOpenChange:l,children:P}),t[48]=l,t[49]=P,t[50]=F):F=t[50],F}function Lt(e,t,n){if(t===`summary`){let r=e.organization;if(!r)return``;let i=r.organization;if(!i)return``;let a=e=>e.filter(e=>n.showIgnored||!e.ignored);return JSON.stringify({discussionId:e.discussion.id,view:t,revision:r.revision,transcriptRevision:r.transcriptRevision,summary:i.summary,decisions:a(i.decisions),actionItems:a(i.actionItems),risks:a(i.risks),openQuestions:a(i.openQuestions),chapters:i.chapters},null,2)}let r=n.query.toLocaleLowerCase(),i=e.transcript.segments.filter(e=>(e.displayText??e.rawText??``).toLocaleLowerCase().includes(r)||e.speakerLabel?.toLocaleLowerCase().includes(r)).slice(0,n.page*50);return i.length?JSON.stringify({discussionId:e.discussion.id,view:t,revision:e.transcript.revision,scope:`loaded filtered segments only`,segments:i.map(e=>({sequence:e.sequence,startedAtMs:e.startedAtMs,speaker:e.speakerLabel,text:e.displayText??e.rawText??``}))},null,2):``}var Rt=e=>`${String(Math.floor(e/6e4)).padStart(2,`0`)}:${String(Math.floor(e/1e3)%60).padStart(2,`0`)}`;function zt({noteId:e,onPersonalNotes:t,noteActions:n}){let r=a(),i=d(e=>e.language)===`zh`,{data:s,mutate:c,isLoading:u}=Ue([`note-discussion-document`,e],()=>w(e),{refreshInterval:e=>e&&([`recording`,`stopping`,`sealing`,`organizing`].includes(e.discussion.status)||e.recordingJob?.state===`queued`||e.recordingJob?.state===`running`)?3e3:0}),p=s?.discussion.id,m=`/api/discussions/${encodeURIComponent(p??``)}`,{data:g=[],mutate:_}=Ue(p?`${m}/actions`:null,e=>f(l(e)),{refreshInterval:1e4}),S=Nt(t=>Ft(e,t.notes[e])),D=Nt(e=>e.update),k=S.tab,j=t=>D(e,{tab:t}),N=S.query,P=t=>D(e,{query:t}),[F,ee]=(0,Q.useState)(!1),te=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{F&&te.current?.focus()},[F]);let[I,ne]=(0,Q.useState)(`general`),[L,R]=(0,Q.useState)(null),[z,re]=(0,Q.useState)(null),[B,V]=(0,Q.useState)(null),[ae,oe]=(0,Q.useState)(!1),[se,ce]=(0,Q.useState)([]),[H,le]=(0,Q.useState)(null),[ue,de]=(0,Q.useState)(!1),fe=S.page,pe=t=>D(e,{page:t}),me=(0,Q.useRef)(null),[he,ge]=(0,Q.useState)([]),_e=(0,Q.useRef)(0),ve=(0,Q.useRef)(0),ye=(0,Q.useRef)(s?.transcript.revision);ye.current=s?.transcript.revision;let U=(0,Q.useRef)(null),W=(0,Q.useRef)(null),[,be]=(0,Q.useState)(0);(0,Q.useEffect)(()=>{let e=()=>{c(),_()};return window.addEventListener(`discussion-updated`,e),window.addEventListener(`discussion-segment-updated`,e),()=>{window.removeEventListener(`discussion-updated`,e),window.removeEventListener(`discussion-segment-updated`,e)}},[c,_]),(0,Q.useEffect)(()=>{s?.discussion.template&&ne(s.discussion.template)},[s?.discussion.template]);async function G(e){if(!ue){de(!0),le(null);try{await e(),await c(),await _()}catch(e){le(e instanceof Error?e.message:String(e))}finally{de(!1)}}}function xe(e,t){U.current&&(me.current=t??null,U.current.readyState===0?(W.current=e/1e3,U.current.load()):(U.current.currentTime=e/1e3,U.current.play().catch(()=>void 0)))}function Se(e){let t=e.stale||e.transcriptRevision!==ye.current;R({...e,stale:t}),t||ge(e.segments.map(e=>e.sequence))}async function Ce(e,t,n=!1){if(!s)return;let r=_e.current,i=++ve.current;await G(async()=>{let a=await f(l(`${m}/evidence?revision=${t??s.organization?.transcriptRevision??s.transcript.revision}&segments=${e.join(`,`)}`));if(!(r!==_e.current||i!==ve.current)&&(Se(a),n&&a.segments[0]?.playback[0])){let e=a.segments[0].playback[0];xe(e.startedAtMs,e.endedAtMs)}})}async function we(e){s&&await G(async()=>{await O(s.discussion.clientRequestId,E({type:`transcript`,capturedAt:Date.now(),transcriptRevision:s.transcript.revision,segmentIds:[e.sequence]})),j(`marks`),A(s.discussion.clientRequestId,s.discussion.id).catch(e=>le(String(e)))})}(0,Q.useEffect)(()=>(_e.current++,R(null),ge([]),re(null),V(null),ce([]),le(null),me.current=null,()=>{_e.current++}),[e]),(0,Q.useEffect)(()=>{let t=s?.discussion.audioSha256??s?.discussion.audioAttachmentId;if(!t)return;let n=Ft(e,Nt.getState().notes[e]);n.source&&n.source!==t?(_e.current++,R(null),ge([]),U.current?.pause(),D(e,{positionMs:0,source:t}),W.current=0,me.current=null):D(e,{source:t})},[e,s?.discussion.audioSha256,s?.discussion.audioAttachmentId,D]),(0,Q.useEffect)(()=>{s?.discussion.audioDeletedAt&&(U.current?.pause(),W.current=null,me.current=null,R(e=>e?{...e,audioAvailable:!1,timingVerified:!1,segments:e.segments.map(e=>({...e,playback:[]}))}:null))},[s?.discussion.audioDeletedAt]),(0,Q.useEffect)(()=>{S.tab===`transcript`&&S.anchor!==void 0&&S.anchorRevision===s?.transcript.revision&&window.setTimeout(()=>document.getElementById(`discussion-segment-${S.anchor}`)?.scrollIntoView?.({block:`center`}),0)},[S.tab,S.anchor,S.anchorRevision,s?.transcript.revision]),(0,Q.useEffect)(()=>{ge([]),R(e=>e&&e.transcriptRevision!==s?.transcript.revision?{...e,stale:!0}:e)},[s?.transcript.revision]);let Te=(e,t,n)=>t.some(e=>ae||!e.ignored)?(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsx)(`h3`,{className:`font-semibold text-fg`,children:e}),t.filter(e=>ae||!e.ignored).map(e=>(0,$.jsxs)(`div`,{className:`flex items-start gap-3 text-sm`,children:[(0,$.jsxs)(`p`,{className:`flex-1 whitespace-pre-wrap`,children:[e.text,e.supersededBy||e.disputedBy?(0,$.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:i?`有后续变更`:`Later changes`}):null,e.editedByUser?(0,$.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:i?e.ignored?`已忽略`:`人工编辑`:e.ignored?`Ignored`:`Edited`}):null]}),(0,$.jsx)(`button`,{className:`text-xs text-fg-muted`,disabled:ue,onClick:()=>V({kind:n,itemId:e.id,text:e.text,ignored:e.ignored}),children:i?`编辑`:`Edit`}),e.evidenceSegmentIds.length?(0,$.jsx)(`button`,{disabled:ue,className:`shrink-0 text-accent-fg`,onClick:()=>void Ce(e.evidenceSegmentIds,e.evidenceRevision),children:i?`原话`:`Source`}):(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:i?`暂无定位`:`No source timing`})]},e.id))]}):null;if(u)return(0,$.jsx)(Ve,{className:`h-48 w-full`});if(!s)return null;let{discussion:K,transcript:Ee,organization:q}=s,J=q?.organization,De=[`stopping`,`sealing`,`organizing`].includes(K.status),Oe=[`recording`,`completed`,`needs_attention`].includes(K.status),ke=Ee.segments.filter(e=>(e.displayText??e.rawText??``).toLocaleLowerCase().includes(N.toLocaleLowerCase())||e.speakerLabel?.toLocaleLowerCase().includes(N.toLocaleLowerCase())),Ae=k===`marks`||N.trim()?``:Lt(s,k,{query:N,page:fe,showIgnored:ae});return(0,$.jsxs)(`section`,{className:`relative flex h-full min-h-0 w-full flex-col text-fg`,onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`f`&&(e.preventDefault(),ee(!0))},children:[(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start gap-3 px-5 pb-3 pt-5 sm:px-7`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`h2`,{className:`text-xl font-semibold leading-snug tracking-tight`,children:!s.note.title||/^Discussion · \d{4}-\d{2}-\d{2} \d{2}:\d{2}$/.test(s.note.title)?i?`语音笔记`:`Voice note`:s.note.title}),(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[i?`录音`:`Recording`,` · `,Rt(K.durationMs??0)]})]}),(0,$.jsx)(`button`,{type:`button`,"aria-label":i?`搜索此 Note`:`Search this Note`,"aria-expanded":F||!!N,onClick:()=>{ee(e=>!e),F&&P(``)},className:`inline-flex size-11 shrink-0 items-center justify-center rounded-full text-fg-muted hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:(0,$.jsx)(Ie,{className:`size-5`,"aria-hidden":!0})}),(0,$.jsx)(Ot,{noteActions:n,detail:s,template:I,onTemplate:ne,zh:i,busy:ue,processing:De,pageText:Ae,editing:!!B||!!z,onPersonalNotes:t,onOrganize:()=>void G(()=>f(l(`${m}/organize`),{method:`POST`,body:JSON.stringify({template:I})})),onRegenerate:()=>void G(()=>T(K.id,`from_audio`))})]}),(0,$.jsx)(Qe,{as:`nav`,"aria-label":i?`笔记内容`:`Note content`,className:`mx-5 mb-2 flex shrink-0 gap-1 rounded-xl bg-surface-inset p-1 sm:mx-7`,indicatorClassName:`rounded-lg bg-surface-panel shadow-sm`,children:[`summary`,`transcript`,`marks`].map(e=>(0,$.jsx)(`button`,{"aria-pressed":k===e,className:`min-h-11 min-w-0 flex-1 rounded-lg px-2 text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${k===e?`bg-surface-panel font-medium text-fg shadow-sm`:`text-fg-muted hover:text-fg`}`,onClick:()=>j(e),children:e===`summary`?i?`概览`:`Overview`:e===`marks`?i?`标记`:`Highlights`:i?`原文`:`Transcript`},e))}),H?(0,$.jsxs)(`details`,{role:`alert`,className:`px-4 py-2 text-sm text-danger`,children:[(0,$.jsx)(`summary`,{children:i?`操作未完成,可以稍后重试`:`Action incomplete. Try again later`}),(0,$.jsx)(`p`,{className:`mt-2 break-words text-xs text-fg-muted`,children:H})]}):null,F||N?(0,$.jsxs)(`label`,{className:`mx-5 mb-2 flex shrink-0 items-center gap-2 rounded-xl bg-surface-inset px-3 sm:mx-7`,children:[(0,$.jsx)(Ie,{className:`size-4 text-fg-muted`}),(0,$.jsx)(`input`,{ref:te,"aria-label":i?`搜索此 Note`:`Search this Note`,className:`min-h-11 min-w-0 w-full bg-transparent text-sm outline-none`,maxLength:200,placeholder:i?`搜索这篇笔记`:`Search this note`,value:N,onChange:e=>{P(e.target.value),pe(1)}}),(0,$.jsx)(`button`,{className:`inline-flex size-11 shrink-0 items-center justify-center rounded-lg focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":i?`关闭搜索`:`Close search`,onClick:()=>{P(``),ee(!1)},children:(0,$.jsx)(X,{className:`size-4`})})]}):null,(0,$.jsxs)(`main`,{className:`flex min-h-0 flex-1 flex-col gap-5 overflow-y-auto px-5 pb-6 pt-1 sm:px-7`,children:[K.status!==`recording`||s.recordingJob?(0,$.jsx)(C,{context:`note`,input:M(s),zh:i,busy:ue,onRetry:e=>void G(()=>e===`analyze`?f(l(`${m}/organize`),{method:`POST`,body:JSON.stringify({template:I})}):T(K.id,e===`regenerate`?`from_audio`:`resume`))}):null,(0,$.jsx)(`div`,{hidden:!!N.trim(),children:k===`marks`?(0,$.jsx)(jt,{recordingId:K.clientRequestId,discussionId:K.id,zh:i,onEvidence:Se,onPlay:e=>xe(e.startedAtMs,e.endedAtMs)},K.id):k===`summary`?J?(0,$.jsxs)(`div`,{className:`mx-auto max-w-3xl space-y-6`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsx)(`h3`,{className:`text-base font-medium`,children:i?`摘要`:`Summary`}),(0,$.jsx)(`button`,{className:`inline-flex size-11 shrink-0 items-center justify-center rounded-full text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":i?`编辑概要`:`Edit overview`,title:i?`编辑概要`:`Edit overview`,disabled:ue||De,onClick:()=>V({kind:`summary`,itemId:`summary`,text:J.summary}),children:(0,$.jsx)(Re,{className:`size-4`,"aria-hidden":!0})})]}),(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-[15px] leading-7`,children:J.summary}),J.summaryEditedByUser?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i?`已由你编辑`:`Edited by you`}):null,J.summaryEvidenceSegmentIds?.length?Array.from({length:Math.ceil(J.summaryEvidenceSegmentIds.length/100)},(e,t)=>(0,$.jsxs)(Z,{onClick:()=>void Ce(J.summaryEvidenceSegmentIds.slice(t*100,(t+1)*100)),children:[i?`查看原话`:`View source`,J.summaryEvidenceSegmentIds.length>100?` · ${t+1}`:``]},t)):null,J.keyPointEvidence?.length?(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsx)(`h3`,{children:i?`重点结论`:`Key points`}),J.keyPointEvidence.map(e=>(0,$.jsxs)(`div`,{className:`flex gap-2 text-sm`,children:[(0,$.jsx)(`p`,{className:`flex-1`,children:e.text}),(0,$.jsx)(Z,{onClick:()=>void Ce(e.evidenceSegmentIds,e.evidenceRevision),children:i?`原话`:`Source`})]},e.id))]}):J.keyPoints.length?(0,$.jsxs)(`section`,{className:`space-y-3`,children:[(0,$.jsx)(`h3`,{className:`text-base font-medium`,children:i?`重点结论`:`Key points`}),(0,$.jsx)(`ul`,{className:`list-disc space-y-2 pl-5 text-[15px] leading-7`,children:J.keyPoints.map((e,t)=>(0,$.jsx)(`li`,{children:e},`${t}:${e}`))})]}):null,[...J.decisions,...J.actionItems,...J.risks,...J.openQuestions].some(e=>e.ignored)?(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:ae,onChange:e=>oe(e.target.checked)}),i?`显示已忽略项`:`Show ignored items`]}):null,se.length?(0,$.jsx)(Z,{disabled:ue,onClick:()=>void G(async()=>{for(let e of se)await f(l(`${m}/actions/${encodeURIComponent(e)}/convert`),{method:`POST`,body:JSON.stringify({organizationRevision:q.revision})});ce([])}),children:i?`加入所选 ${se.length} 项任务`:`Add ${se.length} selected tasks`}):null,Te(i?`已决定事项`:`Decisions`,J.decisions,`decisions`),J.actionItems.length?(0,$.jsxs)(`section`,{className:`space-y-3`,children:[(0,$.jsx)(`h3`,{className:`font-semibold`,children:i?`下一步行动`:`Next actions`}),J.actionItems.filter(e=>ae||!e.ignored).map(e=>{let t=g.find(t=>t.actionId===e.id);return(0,$.jsxs)(`article`,{className:`rounded-lg border border-edge-subtle p-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[!t&&!e.ignored&&(!(e.supersededBy||e.disputedBy)||e.reviewedChangeId===(e.supersededBy??e.disputedBy))?(0,$.jsx)(`input`,{type:`checkbox`,"aria-label":`${i?`选择行动`:`Select action`}: ${e.title}`,className:`ui-checkbox`,checked:se.includes(e.id),onChange:t=>ce(t.target.checked?[...se,e.id]:se.filter(t=>t!==e.id))}):null,(0,$.jsxs)(`p`,{className:`flex-1 text-sm font-medium`,children:[e.title,e.supersededBy||e.disputedBy?(0,$.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:i?`有后续变更,请复核`:`Review later changes`}):null,e.editedByUser?(0,$.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:i?e.ignored?`已忽略`:`人工编辑`:e.ignored?`Ignored`:`Edited`}):null]}),(0,$.jsx)(`button`,{className:`text-xs text-fg-muted`,disabled:ue||De,onClick:()=>V({kind:`actionItems`,itemId:e.id,text:e.title,owner:e.owner,dueDate:e.dueDate,ignored:e.ignored}),children:i?`编辑`:`Edit`})]}),(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[e.owner??(i?`负责人未明确`:`Owner unspecified`),` · `,e.dueDate??(i?`期限未明确`:`Date unspecified`)]}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-3 text-xs`,children:[e.evidenceSegmentIds.length?(0,$.jsx)(`button`,{disabled:ue,className:`text-accent-fg`,onClick:()=>void Ce(e.evidenceSegmentIds,e.evidenceRevision),children:i?`查看原话`:`Source`}):null,t?t.deleted?(0,$.jsx)(`span`,{children:i?`关联任务已删除`:`Linked task deleted`}):(0,$.jsx)(o,{className:`text-accent-fg`,to:je(`${r.pathname}${r.search}`,t.taskId),children:t.resolution===`done`?i?`已完成 · 查看任务`:`Done · View task`:i?`查看任务 / 交给助手`:`View task / Delegate`}):e.ignored?null:(0,$.jsx)(Z,{disabled:ue||!!(e.supersededBy||e.disputedBy)&&e.reviewedChangeId!==(e.supersededBy??e.disputedBy),onClick:()=>void G(()=>f(l(`${m}/actions/${encodeURIComponent(e.id)}/convert`),{method:`POST`,body:JSON.stringify({organizationRevision:q.revision})})),children:i?`加入我的任务`:`Add to my tasks`})]})]},e.id)})]}):null,Te(i?`风险`:`Risks`,J.risks,`risks`),Te(i?`尚未确定`:`Open questions`,J.openQuestions,`openQuestions`),J.changes?.length?(0,$.jsxs)(`section`,{className:`space-y-3`,children:[(0,$.jsx)(`h3`,{className:`font-semibold`,children:i?`前后变更`:`Changes during the meeting`}),J.changes.map(e=>{let t=[...J.decisions,...J.actionItems,...J.risks,...J.openQuestions],n=t.find(t=>t.id===e.fromId),r=t.find(t=>t.id===e.toId);return!n||!r?null:(0,$.jsxs)(`article`,{className:`space-y-2 rounded border border-edge p-3 text-sm`,children:[(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.relation===`supersedes`?i?`后续撤销或替代`:`Later superseded`:i?`存在冲突,尚未明确解决`:`Unresolved conflict`}),(0,$.jsx)(`button`,{className:`block text-left text-accent-fg`,onClick:()=>void Ce(n.evidenceSegmentIds,n.evidenceRevision),children:`title`in n?n.title:n.text}),(0,$.jsx)(`span`,{children:`↓`}),(0,$.jsx)(`button`,{className:`block text-left text-accent-fg`,onClick:()=>void Ce(r.evidenceSegmentIds,r.evidenceRevision),children:`title`in r?r.title:r.text})]},`${e.fromId}:${e.toId}`)})]}):null]}):(0,$.jsxs)(`div`,{className:`mx-auto max-w-3xl space-y-4 py-3`,children:[(0,$.jsx)(`h3`,{className:`text-base font-medium`,children:Ee.text?i?`录音摘录`:`From your recording`:i?`笔记正在整理`:`Preparing your note`}),(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-[15px] leading-7 ${Ee.text?`text-fg`:`text-fg-muted`}`,children:Ee.text?Ee.text.slice(0,400)+(Ee.text.length>400?`…`:``):i?`文字整理完成后,重点和行动会出现在这里。`:`Highlights and actions will appear as processing completes.`}),Ee.text?(0,$.jsx)(Z,{className:`min-h-11`,onClick:()=>j(`transcript`),children:i?`查看原文`:`Read transcript`}):null]}):(0,$.jsxs)(`div`,{className:`space-y-4`,children:[ke.slice(0,fe*50).map(e=>(0,$.jsxs)(`article`,{id:`discussion-segment-${e.sequence}`,className:`rounded-md border p-3 ${he.includes(e.sequence)||S.anchor===e.sequence&&S.anchorRevision===Ee.revision?`border-accent`:`border-edge-subtle`}`,children:[(0,$.jsxs)(`div`,{className:`mb-2 flex items-center gap-3 text-xs text-fg-muted`,children:[(0,$.jsxs)(`button`,{className:`inline-flex items-center gap-1 text-accent-fg`,disabled:!K.audioAttachmentId||!!K.audioDeletedAt,onClick:()=>void Ce([e.sequence],Ee.revision,!0),children:[(0,$.jsx)(Pe,{className:`size-3`}),Rt(e.startedAtMs)]}),e.status===`confirmed`?(0,$.jsx)(`button`,{onClick:()=>void we(e),children:i?`标记此段`:`Highlight segment`}):null,(0,$.jsx)(`span`,{children:e.speakerLabel??(i?`未区分说话人`:`Speaker unknown`)}),Oe&&e.status===`confirmed`?(0,$.jsx)(`button`,{className:`ml-auto`,onClick:()=>re({segment:e,text:e.displayText??e.rawText??``,speaker:e.speakerLabel??``}),children:i?`校对`:`Edit`}):null]}),(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-6`,children:e.displayText??e.rawText??(i?`等待转写`:`Awaiting transcription`)})]},e.sequence)),ke.length>fe*50?(0,$.jsx)(Z,{onClick:()=>pe(fe+1),children:i?`加载更多`:`More`}):null]})}),(0,$.jsx)(`div`,{children:(0,$.jsx)(At,{id:K.id,query:N.trim(),zh:i,sourceKey:`${K.audioSha256}:${K.audioDeletedAt}`,active:De||K.status===`recording`,tab:k,refreshKey:`${K.updatedAt}:${Ee.revision}:${q?.revision}`,onEvidence:Se,onPlay:xe},K.id)})]}),K.audioAttachmentId&&!K.audioDeletedAt?(0,$.jsx)(`footer`,{className:`shrink-0 border-t border-edge-subtle p-3`,children:(0,$.jsx)(`audio`,{ref:U,controls:!0,preload:`metadata`,className:`h-10 w-full`,src:l(`${m}/audio`),onTimeUpdate:()=>{let t=(U.current?.currentTime??0)*1e3;be(t),D(e,{positionMs:t}),me.current!==null&&t>=me.current&&(U.current?.pause(),me.current=null)},onLoadedMetadata:()=>{W.current!==null&&U.current?(U.current.currentTime=W.current,W.current=null,U.current.play().catch(()=>void 0)):U.current&&(U.current.currentTime=S.positionMs/1e3)},onError:()=>le(i?`录音暂不可播放`:`Recording unavailable`)})}):null,L?(0,$.jsxs)(`aside`,{"aria-label":i?`原话证据`:`Source evidence`,className:`absolute inset-y-0 right-0 z-10 flex w-[min(26rem,100%)] flex-col border-l border-edge bg-surface-overlay`,children:[(0,$.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b border-edge p-4`,children:[(0,$.jsxs)(`h3`,{children:[i?`原话证据`:`Source evidence`,` · v`,L.transcriptRevision]}),(0,$.jsx)(`button`,{"aria-label":i?`关闭`:`Close`,onClick:()=>R(null),children:(0,$.jsx)(X,{className:`size-4`})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-4`,children:[(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i?`按整段定位,不代表词句级时间。`:`Segment timing; not word-level alignment.`}),L.stale?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i?`原文已更新,以下保留当时版本的依据。`:`Transcript updated; showing the original evidence revision.`}):null,!L.audioAvailable||!L.timingVerified?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i?`原文仍可查看;原音不可用或时间定位待核实。`:`Text remains available; audio is missing or timing is unverified.`}):null,L.segments.map(t=>(0,$.jsxs)(`article`,{className:`space-y-2 rounded border border-edge p-3`,children:[(0,$.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[Rt(t.startedAtMs),`–`,Rt(t.endedAtMs),` · `,t.speakerLabel??(i?`说话人未明确`:`Unknown speaker`)]}),(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-7`,children:t.text}),t.playback.map((e,t)=>(0,$.jsxs)(Z,{onClick:()=>xe(e.startedAtMs,e.endedAtMs),children:[i?`播放原话`:`Play source`,` `,Rt(e.startedAtMs),`–`,Rt(e.endedAtMs)]},t)),L.stale?null:(0,$.jsx)(Z,{onClick:()=>{P(``),pe(Math.max(fe,Math.ceil((Ee.segments.findIndex(e=>e.sequence===t.sequence)+1)/50))),j(`transcript`),ge([t.sequence]),R(null),D(e,{anchor:t.sequence,anchorRevision:Ee.revision}),window.setTimeout(()=>document.getElementById(`discussion-segment-${t.sequence}`)?.scrollIntoView?.({block:`center`}),0)},children:i?`定位原文`:`Locate transcript`})]},t.sequence))]})]}):null,B&&q?(0,$.jsx)(It,{initial:B,zh:i,busy:ue,onClose:()=>V(null),onSave:e=>G(async()=>{await f(l(`${m}/summary`),{method:`PATCH`,body:JSON.stringify({...e,expectedRevision:q.revision})}),V(null)})},`${B.kind}:${B.itemId}:${q.revision}`):null,z?(0,$.jsx)(x,{open:!0,onOpenChange:e=>{e||re(null)},children:(0,$.jsxs)(v,{children:[(0,$.jsx)(h,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(y,{"aria-describedby":void 0,className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[71] flex h-[min(28rem,90dvh)] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay`,children:[(0,$.jsxs)(`header`,{className:`flex items-center justify-between border-b border-edge p-4`,children:[(0,$.jsx)(b,{children:i?`校对逐字稿`:`Edit transcript`}),(0,$.jsx)(`button`,{"aria-label":i?`关闭校对`:`Close editor`,onClick:()=>re(null),children:(0,$.jsx)(X,{className:`size-4`})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-3 overflow-y-auto p-4`,children:[(0,$.jsxs)(`label`,{className:`block text-xs`,children:[i?`本段说话人`:`Speaker for this segment`,(0,$.jsx)(`input`,{className:`mt-1 w-full rounded border border-edge bg-surface-inset p-2 text-sm`,value:z.speaker,onChange:e=>re({...z,speaker:e.target.value})})]}),z.segment.speakerLabel?(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:!!z.applyToSpeakerGroup,onChange:e=>re({...z,applyToSpeakerGroup:e.target.checked})}),i?`同时更名所有同标签片段;输入已有标签可合并说话人`:`Rename all segments with this label; use an existing label to merge speakers`]}):null,(0,$.jsx)(`textarea`,{className:`min-h-32 w-full rounded border border-edge bg-surface-inset p-2 text-sm`,value:z.text,onChange:e=>re({...z,text:e.target.value})})]}),(0,$.jsx)(`footer`,{className:`border-t border-edge p-3`,children:(0,$.jsxs)(Z,{variant:`primary`,disabled:ue||!z.text.trim(),onClick:()=>void G(async()=>{await f(l(`${m}/segments/${z.segment.sequence}`),{method:`PATCH`,body:JSON.stringify({displayText:z.text,speakerLabel:z.speaker,expectedRevision:z.segment.revision,applyToSpeakerGroup:z.applyToSpeakerGroup,expectedTranscriptRevision:Ee.revision})}),re(null)}),children:[(0,$.jsx)(ie,{className:`size-4`}),i?`保存修订`:`Save revision`]})})]})]})}):null]})}var Bt={edit:Ne,ai_edit:Le,sync:Fe,restore:S};function Vt(e,t){return{edit:t.triggerEdit,ai_edit:t.triggerAiEdit,sync:t.triggerSync,restore:t.triggerRestore}[e]??e}function Ht({noteId:e,activeTimestamp:t,onSelect:n,onClose:r,onRestored:i}){let a=d(e=>e.language),o=m(a).notes,s={justNow:o.justNow,minutesAgo:o.minutesAgo,today:o.today,yesterday:o.yesterday,daysAgo:o.daysAgo,locale:c(a)},{data:l}=Ue(e?[`note-history`,e]:null,()=>Ce(e)),[u,f]=(0,Q.useState)(!1),[p,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(null),v=(0,Q.useCallback)(async t=>{f(!0),_(null);try{await W(e,t),h(null),i()}catch{_(o.restoreFailed)}finally{f(!1)}},[e,o.restoreSuccess,o.restoreFailed,i]),y=Date.now();return(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,$.jsx)(me,{className:`size-4`,"aria-hidden":!0}),o.history]}),(0,$.jsx)(`button`,{type:`button`,onClick:r,className:`rounded-lg p-1 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:(0,$.jsx)(X,{className:`size-4`,"aria-hidden":!0})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[g?(0,$.jsx)(`p`,{className:`border-b border-danger/20 bg-danger-soft px-4 py-2 text-xs text-danger`,role:`alert`,children:g}):null,l?.length?(0,$.jsx)(`ul`,{className:`divide-y divide-edge`,children:l.map(e=>{let r=Bt[e.trigger]??Ne,i=t===e.timestamp,a=p===e.timestamp;return(0,$.jsxs)(`li`,{children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:Be(`w-full px-4 py-3 text-left transition-colors`,i?`bg-accent/10`:`hover:bg-surface-hover`),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(r,{className:`size-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:Vt(e.trigger,o)}),(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:xt(e.timestamp,y,s)})]}),e.snippet&&(0,$.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted/60`,children:e.snippet})]}),i&&(0,$.jsx)(`div`,{className:`border-t border-edge/50 px-4 py-2`,children:a?(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs text-fg-muted`,children:o.restoreConfirm}),(0,$.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),v(e.timestamp)},disabled:u,className:`shrink-0 rounded-lg bg-accent px-3 py-1 text-xs font-medium text-on-accent transition-colors hover:bg-accent/90 disabled:opacity-50`,children:u?`...`:o.restore}),(0,$.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),h(null)},className:`shrink-0 rounded-lg px-2 py-1 text-xs text-fg-muted hover:bg-surface-hover`,children:`Cancel`})]}):(0,$.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),h(e.timestamp)},className:`rounded-lg bg-surface-hover px-3 py-1 text-xs font-medium text-fg transition-colors hover:bg-accent hover:text-on-accent`,children:o.restore})})]},e.timestamp)})}):(0,$.jsxs)(`div`,{className:`px-4 py-8 text-center`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:o.historyEmpty}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted/60`,children:o.historyEmptyDescription})]})]})]})}function Ut({noteId:e,note:t,catalyzing:n,onCatalyze:r,onClose:i,noteThreads:a,openingChat:o,onOpenChat:c,onOpenNewChat:l}){let u=m(d(e=>e.language)).notes,f=s(),p=t?.aiDeep?.catalysis,h=p?.report??null,[g,_]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(!1),{data:b,mutate:x,isLoading:S}=Ue(e?[`note-agent-context-status`,e]:null,()=>Te(e),{revalidateOnFocus:!1}),C=(0,Q.useCallback)(async()=>{if(!v){y(!0),_(null);try{await x(()=>ke(e),{revalidate:!1})}catch(e){_(`${u.contextRebuildFailed}: ${e instanceof Error?e.message:u.quickCaptureFailedHint}`)}finally{y(!1)}}},[v,x,u.contextRebuildFailed,u.quickCaptureFailedHint,e]),w=(0,Q.useCallback)(async t=>{try{await U(e,t)}catch{}},[e]);return(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Le,{className:`size-4 text-accent`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:u.catalysisSectionTitle})]}),(0,$.jsx)(`button`,{type:`button`,onClick:i,"aria-label":u.lightboxClose,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:(0,$.jsx)(N,{className:`size-4 rotate-180`,"aria-hidden":!0})})]}),(0,$.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:[(0,$.jsx)(`p`,{className:`mb-4 text-xs leading-relaxed text-fg-muted`,children:u.catalysisSectionDescription}),b?(0,$.jsxs)(`section`,{className:`mb-4 rounded-xl bg-surface-base p-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.contextStatusTitle}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void C(),disabled:S||v,className:`rounded-md px-1.5 py-0.5 text-[11px] font-medium text-accent transition-colors hover:bg-accent/10 disabled:cursor-not-allowed disabled:opacity-50`,children:v?u.processing:u.contextRebuild}),(0,$.jsx)(`span`,{className:Be(`rounded-full px-2 py-0.5 text-[11px] font-medium`,b.status===`ready`?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-300`:b.status===`partial`?`bg-amber-500/10 text-amber-600 dark:text-amber-300`:`bg-red-500/10 text-red-600 dark:text-red-300`),children:b.status})]}),(0,$.jsx)(`div`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:u.contextStatusDetail.replace(`{{attachments}}`,String(b.attachments.length)).replace(`{{tokens}}`,String(b.tokenEstimate??0))}),g?(0,$.jsx)(`p`,{className:`mt-3 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:g}):null,b.attachments.length>0?(0,$.jsx)(`div`,{className:`mt-3 space-y-1.5`,children:b.attachments.slice(0,5).map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-lg bg-surface-hover px-2 py-1.5 text-xs`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.fileName}),(0,$.jsx)(`span`,{className:`shrink-0 text-fg-muted`,children:e.status})]},e.attachmentId))}):null]}):null,(0,$.jsx)(`button`,{type:`button`,onClick:r,disabled:n,className:`w-full rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-on-accent transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:n?u.processing:h?u.recatalyze:u.catalyzeAction}),h?(0,$.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.valueHypothesis}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg`,children:h.valueHypothesis})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.targetUsers}),(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:h.targetUsers.slice(0,5).map(e=>(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg`,children:e},e))})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.keyQuestions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:h.keyQuestions.slice(0,3).map(e=>(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-accent`}),(0,$.jsx)(`span`,{children:e})]},e))})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.mvpPathLabel}),(0,$.jsx)(`ol`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:h.mvpPath.slice(0,3).map((e,t)=>(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsxs)(`span`,{className:`text-fg-muted`,children:[t+1,`.`]}),(0,$.jsx)(`span`,{children:e})]},e))})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.risks}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:h.risks.slice(0,3).map(e=>(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-fg-muted`}),(0,$.jsx)(`span`,{children:e})]},e))})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.nextActions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:h.nextActions.slice(0,4).map(e=>(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`rounded bg-accent/10 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-accent`,children:e.kind}),(0,$.jsx)(`span`,{children:e.text})]},`${e.kind}:${e.text}`))})]}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:u.confidenceLabel.replace(`{{percent}}`,String(Math.round(h.confidence*100)))}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>void w(`helpful`),className:Be(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,p?.feedback===`helpful`&&`bg-accent/10 text-accent`),"aria-label":u.feedbackHelpfulAria,children:(0,$.jsx)(I,{className:`size-3.5`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void w(`not_helpful`),className:Be(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,p?.feedback===`not_helpful`&&`bg-accent/10 text-accent`),"aria-label":u.feedbackNotHelpfulAria,children:(0,$.jsx)(B,{className:`size-3.5`,"aria-hidden":!0})})]})]})]}):(0,$.jsx)(`div`,{className:`mt-4 rounded-lg border border-dashed border-edge-subtle px-3 py-6 text-center text-sm text-fg-muted`,children:u.noCatalysisReportHint}),(0,$.jsxs)(`section`,{className:`mt-6 rounded-xl bg-surface-base p-4`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,$.jsx)(Me,{className:`size-4 text-accent`,"aria-hidden":!0}),u.relatedThreadsTitle]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:u.relatedThreadsDescription})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:c,disabled:o,className:`rounded-lg border border-edge px-2.5 py-1.5 text-xs font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`,children:o?u.openingChat:u.openThread}),(0,$.jsx)(`button`,{type:`button`,onClick:l,disabled:o,className:`rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-on-accent transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:u.newThread})]})]}),a.length>0?(0,$.jsx)(`div`,{className:`space-y-2`,children:a.slice(0,5).map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>f(`/chat/${encodeURIComponent(e.key)}`),className:`w-full rounded-lg border border-edge-subtle px-3 py-2 text-left transition-colors hover:bg-surface-hover`,children:[(0,$.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.name||u.noteDiscussionFallback}),(0,$.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:u.messageCount.replace(`{{count}}`,String(e.messageCount??0))})]},e.key))}):(0,$.jsx)(`div`,{className:`rounded-lg border border-dashed border-edge-subtle px-3 py-5 text-center text-sm text-fg-muted`,children:u.noThreads})]})]})]})}var Wt=[{value:`86400000`,zh:`24 小时`,en:`24 hours`},{value:`604800000`,zh:`7 天`,en:`7 days`},{value:`2592000000`,zh:`30 天`,en:`30 days`}];function Gt({open:e,onOpenChange:t,note:n}){let r=d(e=>e.language)===`zh`,i=r?Yt:Xt,{data:a,mutate:o}=Ue(e?[`note-shares`,n.id]:null,()=>K(n.id)),s=Ue(e?`hosted-share-auth-status`:null,tt),c=s.data===!0,l=Ue(e&&c?`hosted-publication-capabilities`:null,rt),u=l.data?.publishing.allowed===!0,f=Ue(e&&c?[`hosted-note-publications`,n.id]:null,()=>Se(n.id)),[p,m]=(0,Q.useState)(new Set),[S,C]=(0,Q.useState)(`86400000`),[w,T]=(0,Q.useState)(``),[E,D]=(0,Q.useState)(``),[O,k]=(0,Q.useState)(`hosted`),[A,j]=(0,Q.useState)(!1),[M,N]=(0,Q.useState)(null),[P,F]=(0,Q.useState)(null),[te,I]=(0,Q.useState)(!1),[ne,L]=(0,Q.useState)(null),R=(0,Q.useMemo)(()=>{let e=new Set;return n.markdown.replace(/xopc-attachment:\/\/notes\/([^/]+)\/([^\s)]+)/gi,(t,r,i)=>{try{decodeURIComponent(r)===n.id&&e.add(decodeURIComponent(i))}catch{}return t}),(n.attachments??[]).filter(t=>e.has(t.id))},[n.attachments,n.id,n.markdown]);(0,Q.useEffect)(()=>{e&&(m(new Set(R.map(e=>e.id))),F(null),I(!1),L(null))},[e,R]);let z=async()=>{j(!0),L(null);try{let e={expectedNoteVersion:n.updatedAt,attachmentIds:[...p],ttlMs:Number(S),maxViews:w.trim()?Number(w):null,description:E.trim()||void 0};if(O===`hosted`){let t=await q(n.id,e);F(t.shareUrl),await f.mutate()}else{let t=await G(n.id,e);F(t.payload.shareUrl),await o()}}catch(e){L(e instanceof Error?e.message:String(e))}finally{j(!1)}},re=async(e,t)=>{N(e.id),L(null);try{t===`refresh`?await he(n.id,e.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[...p]}):await it(e.id),await f.mutate()}catch(e){L(e instanceof Error?e.message:String(e))}finally{N(null)}},B=async(e,t)=>{N(e.id),L(null);try{t===`refresh`?await Oe(n.id,e.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[...p]}):t===`extend`?await nt(e.id,864e5):await et(e.id),await o()}catch(e){L(e instanceof Error?e.message:String(e))}finally{N(null)}},V=async e=>{L(null);try{if(!await Je(e)){I(!1),L(i.copyFailed);return}I(!0),window.setTimeout(()=>I(!1),1500)}catch{I(!1),L(i.copyFailed)}};return(0,$.jsx)(x,{open:e,onOpenChange:t,children:(0,$.jsxs)(v,{children:[(0,$.jsx)(h,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(y,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[71] flex h-[min(42rem,calc(100dvh-2rem))] w-[min(40rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-popover outline-none`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between border-b border-edge px-5 py-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(b,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[(0,$.jsx)(ee,{className:`size-4`}),i.title]}),(0,$.jsx)(g,{className:`mt-1 text-xs text-fg-muted`,children:i.description})]}),(0,$.jsx)(_,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-fg-muted hover:bg-surface-hover`,"aria-label":i.close,children:(0,$.jsx)(X,{className:`size-4`})})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,$.jsxs)(`section`,{className:`rounded-lg border border-edge bg-surface-inset p-4`,children:[(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n.title||i.untitled}),(0,$.jsx)(`p`,{className:`mt-2 line-clamp-4 whitespace-pre-wrap text-xs leading-5 text-fg-muted`,children:n.markdown||i.empty}),(0,$.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:i.privateExcluded})]}),R.length>0?(0,$.jsxs)(`section`,{className:`mt-5`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.attachments}),(0,$.jsx)(`div`,{className:`mt-2 grid gap-2`,children:R.map(e=>(0,$.jsxs)(`label`,{className:`flex items-center gap-3 rounded-lg border border-edge-subtle px-3 py-2 text-sm text-fg-muted`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:p.has(e.id),onChange:()=>m(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n}),className:`accent-accent`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.fileName}),(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:Jt(e.size)})]},e.id))})]}):null,(0,$.jsxs)(`section`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted sm:col-span-2`,children:[i.delivery,(0,$.jsxs)(ae,{value:O,onChange:e=>k(e.target.value),children:[(0,$.jsx)(oe,{value:`hosted`,children:i.deliveryHosted}),(0,$.jsx)(oe,{value:`local`,children:i.deliveryLocal})]})]}),O===`hosted`&&s.data===!1?(0,$.jsx)(`div`,{className:`sm:col-span-2`,children:(0,$.jsx)(ft,{providerId:`xopc-share`,displayName:`XOPC Hosted Share`,connected:!1,onConnected:()=>void s.mutate(!0,{revalidate:!1})})}):null,O===`hosted`&&c&&l.data&&!u?(0,$.jsx)(`p`,{className:`rounded-lg border border-warning/30 bg-warning-soft px-3 py-2 text-xs text-warning sm:col-span-2`,children:i.hostedDisabled}):null,(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[i.expires,(0,$.jsx)(ae,{value:S,onChange:e=>C(e.target.value),children:Wt.map(e=>(0,$.jsx)(oe,{value:e.value,children:r?e.zh:e.en},e.value))})]}),(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[i.maxViews,(0,$.jsx)(`input`,{type:`number`,min:1,max:1e3,value:w,onChange:e=>T(e.target.value),placeholder:i.unlimited,className:`h-9 rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent`})]}),(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted sm:col-span-2`,children:[i.publicDescription,(0,$.jsx)(`input`,{value:E,onChange:e=>D(e.target.value),className:`h-9 rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent`})]})]}),P?(0,$.jsx)(`div`,{className:`mt-5 rounded-lg border border-success/25 bg-success-soft p-3`,children:(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsx)(`input`,{readOnly:!0,value:P,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none`}),(0,$.jsxs)(Z,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void V(P),children:[te?(0,$.jsx)(ie,{className:`size-4`}):(0,$.jsx)(H,{className:`size-4`}),te?i.copied:i.copy]}),(0,$.jsxs)(Z,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>window.open(P,`_blank`,`noopener,noreferrer`),children:[(0,$.jsx)(de,{className:`size-4`}),i.open]})]})}):null,ne?(0,$.jsx)(`p`,{className:`mt-4 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,children:ne}):null,(a?.items.length??0)>0?(0,$.jsxs)(`section`,{className:`mt-6 border-t border-edge pt-5`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.activeLinks}),(0,$.jsx)(`div`,{className:`mt-2 grid gap-2`,children:a.items.map(e=>(0,$.jsx)(qt,{share:e,busy:M===e.id,t:i,onCopy:V,onAction:B},e.id))})]}):null,(f.data?.length??0)>0?(0,$.jsxs)(`section`,{className:`mt-6 border-t border-edge pt-5`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.hostedLinks}),(0,$.jsx)(`div`,{className:`mt-2 grid gap-2`,children:f.data.map(e=>(0,$.jsx)(Kt,{publication:e,stale:e.source?.version!==String(n.updatedAt),busy:M===e.id,publishingAllowed:u,t:i,onCopy:V,onAction:re},e.id))})]}):null]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-2 border-t border-edge px-5 py-3`,children:[(0,$.jsx)(_,{asChild:!0,children:(0,$.jsx)(Z,{type:`button`,variant:`ghost`,children:i.close})}),(0,$.jsxs)(Z,{type:`button`,onClick:()=>void z(),disabled:A||O===`hosted`&&(!c||!u),children:[A?(0,$.jsx)(Ae,{className:`size-4 animate-spin`}):(0,$.jsx)(ee,{className:`size-4`}),A?i.creating:i.create]})]})]})]})})}function Kt(e){let t=(0,gt.c)(64),{publication:n,stale:r,busy:i,publishingAllowed:a,t:o,onCopy:s,onAction:c}=e,l=n.revoked||n.expired,u=l&&`opacity-60`,d;t[0]===u?d=t[1]:(d=Be(`rounded-lg border border-edge-subtle p-3`,u),t[0]=u,t[1]=d);let f=r&&!l?o.stale:l?o.inactive:o.active,p;t[2]===f?p=t[3]:(p=(0,$.jsx)(`span`,{children:f}),t[2]=f,t[3]=p);let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(`span`,{children:`·`}),t[4]=m):m=t[4];let h=n.maxViews===null?``:` / ${n.maxViews}`,g;t[5]!==n.viewCount||t[6]!==o.views||t[7]!==h?(g=(0,$.jsxs)(`span`,{children:[o.views,` `,n.viewCount,h]}),t[5]=n.viewCount,t[6]=o.views,t[7]=h,t[8]=g):g=t[8];let _;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(`span`,{children:`·`}),t[9]=_):_=t[9];let v;t[10]!==n.revision||t[11]!==o.revision?(v=(0,$.jsxs)(`span`,{children:[o.revision,` `,n.revision]}),t[10]=n.revision,t[11]=o.revision,t[12]=v):v=t[12];let y;t[13]!==p||t[14]!==g||t[15]!==v?(y=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[p,m,g,_,v]}),t[13]=p,t[14]=g,t[15]=v,t[16]=y):y=t[16];let b;t[17]===n.shareUrl?b=t[18]:(b=(0,$.jsx)(`div`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.shareUrl}),t[17]=n.shareUrl,t[18]=b);let x;t[19]!==y||t[20]!==b?(x=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[y,b]}),t[19]=y,t[20]=b,t[21]=x):x=t[21];let S;t[22]===i?S=t[23]:(S=i?(0,$.jsx)(Ae,{className:`size-4 animate-spin text-fg-muted`}):null,t[22]=i,t[23]=S);let C;t[24]!==x||t[25]!==S?(C=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[x,S]}),t[24]=x,t[25]=S,t[26]=C):C=t[26];let w=!a,T;t[27]!==s||t[28]!==n.shareUrl?(T=()=>void s(n.shareUrl),t[27]=s,t[28]=n.shareUrl,t[29]=T):T=t[29];let E;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(H,{className:`size-3.5`}),t[30]=E):E=t[30];let D;t[31]!==o.copy||t[32]!==w||t[33]!==T?(D=(0,$.jsxs)(Z,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:w,onClick:T,children:[E,o.copy]}),t[31]=o.copy,t[32]=w,t[33]=T,t[34]=D):D=t[34];let O=!a,k;t[35]===n.shareUrl?k=t[36]:(k=()=>window.open(n.shareUrl,`_blank`,`noopener,noreferrer`),t[35]=n.shareUrl,t[36]=k);let A;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(de,{className:`size-3.5`}),t[37]=A):A=t[37];let j;t[38]!==o.open||t[39]!==O||t[40]!==k?(j=(0,$.jsxs)(Z,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:O,onClick:k,children:[A,o.open]}),t[38]=o.open,t[39]=O,t[40]=k,t[41]=j):j=t[41];let M;t[42]!==i||t[43]!==l||t[44]!==c||t[45]!==n||t[46]!==a||t[47]!==r||t[48]!==o.refresh?(M=r&&!l?(0,$.jsxs)(Z,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:i||!a,onClick:()=>void c(n,`refresh`),children:[(0,$.jsx)(Fe,{className:`size-3.5`}),o.refresh]}):null,t[42]=i,t[43]=l,t[44]=c,t[45]=n,t[46]=a,t[47]=r,t[48]=o.refresh,t[49]=M):M=t[49];let N;t[50]!==i||t[51]!==c||t[52]!==n||t[53]!==o.revoke?(N=n.revoked?null:(0,$.jsxs)(Z,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:i,onClick:()=>void c(n,`revoke`),children:[(0,$.jsx)(ze,{className:`size-3.5`}),o.revoke]}),t[50]=i,t[51]=c,t[52]=n,t[53]=o.revoke,t[54]=N):N=t[54];let P;t[55]!==D||t[56]!==j||t[57]!==M||t[58]!==N?(P=(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[D,j,M,N]}),t[55]=D,t[56]=j,t[57]=M,t[58]=N,t[59]=P):P=t[59];let F;return t[60]!==C||t[61]!==d||t[62]!==P?(F=(0,$.jsxs)(`div`,{className:d,children:[C,P]}),t[60]=C,t[61]=d,t[62]=P,t[63]=F):F=t[63],F}function qt(e){let t=(0,gt.c)(68),{share:n,busy:r,t:i,onCopy:a,onAction:o}=e,s=n.revoked||n.expired,c=s&&`opacity-60`,l;t[0]===c?l=t[1]:(l=Be(`rounded-lg border border-edge-subtle p-3`,c),t[0]=c,t[1]=l);let u=n.stale&&!s?i.stale:s?i.inactive:i.active,d;t[2]===u?d=t[3]:(d=(0,$.jsx)(`span`,{children:u}),t[2]=u,t[3]=d);let f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(`span`,{children:`·`}),t[4]=f):f=t[4];let p=n.maxViews===null?``:` / ${n.maxViews}`,m;t[5]!==n.viewCount||t[6]!==i.views||t[7]!==p?(m=(0,$.jsxs)(`span`,{children:[i.views,` `,n.viewCount,p]}),t[5]=n.viewCount,t[6]=i.views,t[7]=p,t[8]=m):m=t[8];let h;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(`span`,{children:`·`}),t[9]=h):h=t[9];let g;t[10]===n.expiresAt?g=t[11]:(g=new Date(n.expiresAt).toLocaleDateString(),t[10]=n.expiresAt,t[11]=g);let _;t[12]===g?_=t[13]:(_=(0,$.jsx)(`span`,{children:g}),t[12]=g,t[13]=_);let v;t[14]!==_||t[15]!==d||t[16]!==m?(v=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[d,f,m,h,_]}),t[14]=_,t[15]=d,t[16]=m,t[17]=v):v=t[17];let y;t[18]===n.shareUrl?y=t[19]:(y=(0,$.jsx)(`div`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.shareUrl}),t[18]=n.shareUrl,t[19]=y);let b;t[20]!==v||t[21]!==y?(b=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[v,y]}),t[20]=v,t[21]=y,t[22]=b):b=t[22];let x;t[23]===r?x=t[24]:(x=r?(0,$.jsx)(Ae,{className:`size-4 animate-spin text-fg-muted`}):null,t[23]=r,t[24]=x);let S;t[25]!==b||t[26]!==x?(S=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[b,x]}),t[25]=b,t[26]=x,t[27]=S):S=t[27];let C;t[28]!==a||t[29]!==n.shareUrl?(C=()=>void a(n.shareUrl),t[28]=a,t[29]=n.shareUrl,t[30]=C):C=t[30];let w;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(H,{className:`size-3.5`}),t[31]=w):w=t[31];let T;t[32]!==i.copy||t[33]!==C?(T=(0,$.jsxs)(Z,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:C,children:[w,i.copy]}),t[32]=i.copy,t[33]=C,t[34]=T):T=t[34];let E;t[35]===n.shareUrl?E=t[36]:(E=()=>window.open(n.shareUrl,`_blank`,`noopener,noreferrer`),t[35]=n.shareUrl,t[36]=E);let D;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,$.jsx)(de,{className:`size-3.5`}),t[37]=D):D=t[37];let O;t[38]!==i.open||t[39]!==E?(O=(0,$.jsxs)(Z,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:E,children:[D,i.open]}),t[38]=i.open,t[39]=E,t[40]=O):O=t[40];let k;t[41]!==r||t[42]!==s||t[43]!==o||t[44]!==n||t[45]!==i.refresh?(k=n.stale&&!s?(0,$.jsxs)(Z,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`refresh`),children:[(0,$.jsx)(Fe,{className:`size-3.5`}),i.refresh]}):null,t[41]=r,t[42]=s,t[43]=o,t[44]=n,t[45]=i.refresh,t[46]=k):k=t[46];let A;t[47]!==r||t[48]!==s||t[49]!==o||t[50]!==n||t[51]!==i.extend?(A=s?null:(0,$.jsx)(Z,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`extend`),children:i.extend}),t[47]=r,t[48]=s,t[49]=o,t[50]=n,t[51]=i.extend,t[52]=A):A=t[52];let j;t[53]!==r||t[54]!==o||t[55]!==n||t[56]!==i.revoke?(j=n.revoked?null:(0,$.jsxs)(Z,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`revoke`),children:[(0,$.jsx)(ze,{className:`size-3.5`}),i.revoke]}),t[53]=r,t[54]=o,t[55]=n,t[56]=i.revoke,t[57]=j):j=t[57];let M;t[58]!==T||t[59]!==O||t[60]!==k||t[61]!==A||t[62]!==j?(M=(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[T,O,k,A,j]}),t[58]=T,t[59]=O,t[60]=k,t[61]=A,t[62]=j,t[63]=M):M=t[63];let N;return t[64]!==S||t[65]!==l||t[66]!==M?(N=(0,$.jsxs)(`div`,{className:l,children:[S,M]}),t[64]=S,t[65]=l,t[66]=M,t[67]=N):N=t[67],N}function Jt(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}var Yt={title:`分享笔记`,description:`创建一个无需登录即可查看的只读快照。`,close:`关闭`,untitled:`无标题笔记`,empty:`空笔记`,privateExcluded:`不会分享标签、AI 元数据、项目、讨论、历史版本或未引用附件。`,attachments:`包含的附件`,expires:`有效期`,maxViews:`最多查看次数`,unlimited:`不限`,publicDescription:`公开说明(可选)`,create:`创建分享链接`,creating:`创建中…`,copy:`复制`,copied:`已复制`,open:`打开`,activeLinks:`这条笔记的分享`,copyFailed:`无法复制到剪贴板,请手动选择链接并复制。`,delivery:`发布方式`,deliveryHosted:`平台托管(外网稳定访问)`,deliveryLocal:`本机直连(需要隧道或公网部署)`,hostedLinks:`平台托管发布`,revision:`版本`,hostedDisabled:`管理员已暂停你的公网分享能力。已有托管链接当前不可访问,但仍可撤销。`,stale:`旧版本`,inactive:`已失效`,active:`有效`,views:`查看`,refresh:`更新快照`,extend:`延长 24 小时`,revoke:`撤销`},Xt={title:`Share Note`,description:`Create a read-only snapshot that opens without sign-in.`,close:`Close`,untitled:`Untitled Note`,empty:`Empty Note`,privateExcluded:`Tags, AI metadata, projects, discussions, history, and unreferenced attachments are excluded.`,attachments:`Included attachments`,expires:`Expires`,maxViews:`Maximum views`,unlimited:`Unlimited`,publicDescription:`Public description (optional)`,create:`Create share link`,creating:`Creating…`,copy:`Copy`,copied:`Copied`,open:`Open`,activeLinks:`Shares for this Note`,copyFailed:`Could not copy to the clipboard. Select the link and copy it manually.`,delivery:`Publishing method`,deliveryHosted:`Hosted platform (stable public access)`,deliveryLocal:`Direct from this device (requires public access)`,hostedLinks:`Hosted publications`,revision:`Revision`,hostedDisabled:`An administrator has paused public sharing for your account. Existing hosted links are unavailable, but can still be revoked.`,stale:`Older version`,inactive:`Inactive`,active:`Active`,views:`Views`,refresh:`Update snapshot`,extend:`Extend 24 hours`,revoke:`Revoke`};function Zt(e){let t=(0,gt.c)(18),{input:n,labels:r,showLabel:i}=e,a=i===void 0||i,o;t[0]===n?o=t[1]:(o=n(),t[0]=n,t[1]=o);let s=o.source.id,c;t[2]===s?c=t[3]:(c=e=>e.source?.type===`note`&&e.source.id===s&&e.status!==`idle`,t[2]=s,t[3]=c);let l=L(c),u;t[4]===s?u=t[5]:(u=e=>e.source?.type===`note`&&e.source.id===s&&e.status===`preparing`,t[4]=s,t[5]=u);let d=L(u),f=L(Qt),p;t[6]!==n||t[7]!==r||t[8]!==d||t[9]!==a?(p=(0,$.jsx)(P,{input:n,labels:r,disabled:d,showLabel:a}),t[6]=n,t[7]=r,t[8]=d,t[9]=a,t[10]=p):p=t[10];let m;t[11]!==l||t[12]!==r||t[13]!==f?(m=l?(0,$.jsx)(`button`,{type:`button`,onClick:f,title:r.stop,"aria-label":r.stop,className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:(0,$.jsx)(Y,{className:`size-3.5`,"aria-hidden":!0})}):null,t[11]=l,t[12]=r,t[13]=f,t[14]=m):m=t[14];let h;return t[15]!==p||t[16]!==m?(h=(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[p,m]}),t[15]=p,t[16]=m,t[17]=h):h=t[17],h}function Qt(e){return e.stop}function $t(e,t){let n=z(t.replace(/^\s*(`{3,}|~{3,})[^\n]*$/gm,``).replace(/xopc-attachment:\/\/[^\s)]+/g,``).replace(/^(\s*[-*+]\s+)\[[ xX]\]\s*/gm,`$1`)),r=z(e);return!r||n.split(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-DUONDIZR.js","assets/rolldown-runtime-aKtaBQYM.js","assets/vendor-react-BOUWij0V.js","assets/locale-store-CAZaC05J.js","assets/messages-C7fckbyG.js","assets/unlink-BEuthaaq.js","assets/createLucideIcon-DPHK1VkS.js","assets/check-DUBLcKHA.js","assets/copy-Dv6d4Dvw.js","assets/external-link-DjqjBmc3.js","assets/notes-api-zXpV6UXu.js","assets/dist-BGTk37IG.js","assets/es2015-DBLcMg5B.js","assets/dist-CxGUk8J-.js","assets/markdown-view-BatP4qeK.js","assets/chunk-KS7C4IRE-CiwuuyV8.js","assets/preload-helper-Czpn1I53.js","assets/download-Dk-ZjtO6.js","assets/file-image-CDUPkZvG.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/cn-0WouolD0.js","assets/bundle-mjs-rHxsej31.js","assets/app-link-DRy3-k7j.js","assets/product-delivery-DRyD9_Xq.js","assets/schemas-CCWMleym.js","assets/local-apps-Ck6kACsY.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/xml-_d7dTN2Q.js","assets/mermaid-render-oOellPHt.js","assets/markdown-view-C-DHb3Io.css","assets/chat-chart-block-CcVcKsDZ.js","assets/skeleton-BI5TyibZ.js","assets/list-todo-CTVRto8O.js","assets/loader-circle-CifKLtgG.js","assets/mic-CuUb7zc-.js","assets/pause-DuPxgSxk.js","assets/pencil-DmIY3Oa-.js","assets/play-kxZvpBg8.js","assets/vendor-swr-CdRzEUwF.js","assets/floating-ui.dom-seOukHzT.js","assets/vendor-codemirror-aCQ0FcJT.js","assets/with-selector-xonYxPoM.js","assets/note-image-lightbox-D6kUDDd5.js","assets/block-editor-Cvy3D_4T.css","assets/markdown-editor-BuuGlcfG.js","assets/languages-zXtNocoy.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{l as a,t as o,u as s}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{f as c,i as l,l as u,n as d,o as f,p}from"./locale-store-CAZaC05J.js";import{t as m}from"./messages-C7fckbyG.js";import{a as h,i as g,n as _,o as v,r as y,s as b,t as x}from"./dist-BGTk37IG.js";import{E as S,b as C,d as w,h as T,i as E,n as D,o as O,r as k,t as A,w as j,x as M}from"./discussion-annotation-sync-DfBRkWtw.js";import{t as N}from"./arrow-left-D880xG-P.js";import{a as P,c as F,d as ee,i as te,l as I,n as ne,o as L,r as R,s as z,t as re,u as B}from"./product-automation-feedback-DbJvv92z.js";import{t as ie}from"./check-DUBLcKHA.js";import{t as V}from"./chevron-down-ccbiQQz_.js";import{n as ae,r as oe}from"./popover-select-CEMWIrtY.js";import{t as se}from"./circle-check-C23XjkUj.js";import{t as ce}from"./code-xml-DJtYhZUF.js";import{t as H}from"./copy-Dv6d4Dvw.js";import{t as le}from"./download-Dk-ZjtO6.js";import{t as ue}from"./ellipsis-0k4rZLoy.js";import{t as de}from"./external-link-DjqjBmc3.js";import{t as fe}from"./eye-CABVeTq0.js";import{t as pe}from"./file-text-D12HbeVy.js";import{t as me}from"./history-DXH_9jsE.js";import{C as he,E as ge,F as _e,O as ve,P as ye,S as U,T as W,_ as be,a as G,c as xe,d as Se,f as Ce,h as we,l as Te,m as K,n as Ee,r as q,s as J,u as De,w as Oe,x as ke}from"./notes-api-zXpV6UXu.js";import{t as Ae}from"./loader-circle-CifKLtgG.js";import{P as je}from"./markdown-view-BatP4qeK.js";import{t as Me}from"./message-circle-Badhj-4D.js";import{t as Ne}from"./pencil-DmIY3Oa-.js";import{t as Pe}from"./play-kxZvpBg8.js";import{t as Fe}from"./refresh-cw-BRlGaq2w.js";import{t as Ie}from"./search-DA7gz22f.js";import{t as Le}from"./sparkles-DHlfQFAF.js";import{t as Re}from"./square-pen-B8FsvqNu.js";import{t as Y}from"./square-DMK_fB-3.js";import{t as ze}from"./trash-2-DusmjVPV.js";import{t as X}from"./x-B_N4OPjy.js";import{t as Be}from"./cn-0WouolD0.js";import{t as Ve}from"./skeleton-BI5TyibZ.js";import{t as He}from"./session-manager-DRRWwKE4.js";import{i as Ue}from"./vendor-swr-CdRzEUwF.js";import{t as Z}from"./button-Cc4hUNTt.js";import{a as We,i as Ge,o as Ke,s as qe}from"./dist-GJ8-1PAx.js";import{t as Je}from"./copy-to-clipboard-HOJ79TWv.js";import{r as Ye}from"./app-chrome-BeB4KgOf.js";import{i as Xe}from"./theme-store-8GFVtotZ.js";import{t as Ze}from"./page-header-store-D7G5utVi.js";import{t as Qe}from"./automation-api-4fVKv9PJ.js";import{t as $e}from"./sliding-tab-list-DuQyViqe.js";import{t as et}from"./confirm-dialog-D7dQJytv.js";import{b as tt,d as nt,o as rt,s as it,v as at}from"./shares-api-zegE8pSE.js";import{l as ot,m as st,o as ct,r as lt,t as ut,u as dt}from"./dist-ZrL34Ps4.js";import{t as ft}from"./oauth-provider-connect-D4Gfs-Ba.js";import{n as pt,t as mt}from"./page-context-draft-C4IIZaKd.js";import"./note-image-lightbox-D6kUDDd5.js";import{t as ht}from"./page-context-capture-button-Mig3d0UX.js";var Q=e(t(),1),gt=n(),$=r(),_t=6e4,vt=36e5,yt=864e5;function bt(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function xt(e,t,n){let r=t-e;if(r<_t)return n.justNow;if(r<vt){let e=Math.floor(r/_t);return n.minutesAgo.replace(`{{n}}`,String(e))}let i=bt(t);if(e>=i)return n.today+` `+new Date(e).toLocaleTimeString(n.locale,{hour:`2-digit`,minute:`2-digit`});if(e>=i-yt)return n.yesterday+` `+new Date(e).toLocaleTimeString(n.locale,{hour:`2-digit`,minute:`2-digit`});if(r<7*yt){let e=Math.floor(r/yt);return n.daysAgo.replace(`{{n}}`,String(e))}return new Date(e).toLocaleDateString(n.locale,{month:`short`,day:`numeric`})}function St(e,t,n){let r=bt(t);if(e>=r)return n.today;if(e>=r-yt)return n.yesterday;let i=new Date(e),a=new Date(t);return i.getFullYear()===a.getFullYear()?i.toLocaleDateString(n.locale,{month:`long`,day:`numeric`}):i.toLocaleDateString(n.locale,{year:`numeric`,month:`long`,day:`numeric`})}function Ct(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function wt(e){let t=(0,gt.c)(45),{title:n,description:r,prompt:i,coverage:a,className:o,variant:c}=e,l=c===void 0?`card`:c,u=d(Dt),f=m(u).automations.suggestions,p=m(u).automations,h=s(),g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g={revalidateOnFocus:!1,refreshInterval:15e3},t[0]=g):g=t[0];let{data:_}=Ue(a?`automation-suggestion-coverage`:null,Et,g),v=a?_?.automations.find(e=>te(e,a)):void 0,y=v?ne(v,p):[];if(l===`titleAction`){if(v){let e;t[1]===o?e=t[2]:(e=Be(`flex min-w-0 items-center gap-2 rounded-lg border border-emerald-500/25 bg-emerald-500/10 px-2.5 py-1.5`,o),t[1]=o,t[2]=e);let n;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(se,{className:`size-3.5 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[3]=n):n=t[3];let r;return t[4]===h?r=t[5]:(r=()=>h(`/automations`),t[4]=h,t[5]=r),(0,$.jsxs)(`section`,{className:e,children:[n,(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,children:f.coveredTitle}),(0,$.jsx)(Z,{variant:`ghost`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:r,children:f.manage})]})}let e;t[6]===o?e=t[7]:(e=Be(`flex min-w-0 items-center gap-2 rounded-lg bg-surface-panel px-2.5 py-1.5 shadow-surface`,o),t[6]=o,t[7]=e);let a;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(j,{className:`size-3.5 shrink-0 text-accent`,"aria-hidden":!0}),t[8]=a):a=t[8];let s;t[9]!==r||t[10]!==n?(s=(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,title:r,children:n}),t[9]=r,t[10]=n,t[11]=s):s=t[11];let c;t[12]!==h||t[13]!==i?(c=()=>{let e=new URLSearchParams({draft:i,autogenerate:`1`});h(`/automations?${e.toString()}`)},t[12]=h,t[13]=i,t[14]=c):c=t[14];let l;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(Le,{className:`size-3.5`,"aria-hidden":!0}),t[15]=l):l=t[15],(0,$.jsxs)(`section`,{className:e,children:[a,s,(0,$.jsxs)(Z,{variant:`secondary`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:c,children:[l,f.setup]})]})}if(v){let e;t[16]===o?e=t[17]:(e=Be(`rounded-lg border border-emerald-500/25 bg-emerald-500/10 p-3`,o),t[16]=o,t[17]=e);let n;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(se,{className:`mt-0.5 size-4 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[18]=n):n=t[18];let r;t[19]===h?r=t[20]:(r=()=>h(`/automations`),t[19]=h,t[20]=r);let i;return t[21]!==f||t[22]!==r?(i=(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsx)(Z,{variant:`ghost`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:r,children:f.manage})}),t[21]=f,t[22]=r,t[23]=i):i=t[23],(0,$.jsxs)(`section`,{className:e,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[n,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:f.coveredTitle}),(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:R(f.coveredDescription,{name:v.name})})]})]}),(0,$.jsxs)(`div`,{className:`mt-2 rounded-md bg-surface-base/55 px-2.5 py-2`,children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg`,children:p.explain.whyCovered}),(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:y.map(Tt)})]}),i]})}let b;t[24]===o?b=t[25]:(b=Be(`rounded-lg bg-surface-panel p-3 shadow-surface`,o),t[24]=o,t[25]=b);let x;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(j,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[26]=x):x=t[26];let S;t[27]===n?S=t[28]:(S=(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n}),t[27]=n,t[28]=S);let C;t[29]===r?C=t[30]:(C=(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:r}),t[29]=r,t[30]=C);let w;t[31]!==S||t[32]!==C?(w=(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[x,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[S,C]})]}),t[31]=S,t[32]=C,t[33]=w):w=t[33];let T;t[34]!==h||t[35]!==i?(T=()=>{let e=new URLSearchParams({draft:i,autogenerate:`1`});h(`/automations?${e.toString()}`)},t[34]=h,t[35]=i,t[36]=T):T=t[36];let E;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(Le,{className:`size-3.5`,"aria-hidden":!0}),t[37]=E):E=t[37];let D;t[38]!==f.create||t[39]!==T?(D=(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsxs)(Z,{variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:T,children:[E,f.create]})}),t[38]=f.create,t[39]=T,t[40]=D):D=t[40];let O;return t[41]!==D||t[42]!==b||t[43]!==w?(O=(0,$.jsxs)(`section`,{className:b,children:[w,D]}),t[41]=D,t[42]=b,t[43]=w,t[44]=O):O=t[44],O}function Tt(e){return(0,$.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function Et(){return Qe.list()}function Dt(e){return e.language}function Ot(e){let t=(0,gt.c)(93),{detail:n,template:r,onTemplate:i,zh:a,busy:o,processing:s,pageText:c,editing:u,onOrganize:d,onRegenerate:f,onPersonalNotes:p,noteActions:m}=e,[h,g]=(0,Q.useState)(!1),_;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>{g(!1),e()},t[0]=_):_=t[0];let v=_,y=`/api/discussions/${encodeURIComponent(n.discussion.id)}`,b=!!n.discussion.audioAttachmentId&&!n.discussion.audioDeletedAt,x=a?`更多笔记操作`:`More note actions`,S;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,$.jsx)(ue,{className:`size-5`,"aria-hidden":!0}),t[1]=S):S=t[1];let C;t[2]===x?C=t[3]:(C=(0,$.jsx)(qe,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,"aria-label":x,className:`inline-flex size-11 shrink-0 items-center justify-center rounded-full text-fg-muted hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:S})}),t[2]=x,t[3]=C);let w=a?`笔记工具`:`Note tools`,T;t[4]!==p||t[5]!==a?(T=p?(0,$.jsxs)(Z,{className:`min-h-11 w-full justify-start`,onClick:()=>v(p),children:[(0,$.jsx)(Re,{className:`size-4`}),a?`添加我的补充`:`Add my notes`]}):null,t[4]=p,t[5]=a,t[6]=T):T=t[6];let E;t[7]!==m||t[8]!==a?(E=m?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(Z,{className:`min-h-11 w-full justify-start`,disabled:m.busy,onClick:()=>v(m.onAnalyze),children:[(0,$.jsx)(Le,{className:`size-4`}),a?`进一步分析`:`Analyze this note`]}),(0,$.jsxs)(Z,{className:`min-h-11 w-full justify-start`,disabled:m.busy,onClick:()=>v(m.onChat),children:[(0,$.jsx)(Me,{className:`size-4`}),a?`就这篇笔记提问`:`Ask about this note`]})]}):null,t[7]=m,t[8]=a,t[9]=E):E=t[9];let D=a?`整理笔记`:`Organize notes`,O;t[10]===D?O=t[11]:(O=(0,$.jsx)(`p`,{className:`px-2 text-xs text-fg-muted`,children:D}),t[10]=D,t[11]=O);let k=a?`纪要模板`:`Summary template`,A;t[12]===i?A=t[13]:(A=e=>i(e.target.value),t[12]=i,t[13]=A);let j=a?`通用会议`:`General`,M;t[14]===j?M=t[15]:(M=(0,$.jsx)(oe,{value:`general`,children:j}),t[14]=j,t[15]=M);let N=a?`项目例会`:`Project`,P;t[16]===N?P=t[17]:(P=(0,$.jsx)(oe,{value:`project`,children:N}),t[16]=N,t[17]=P);let F=a?`需求评审`:`Review`,ee;t[18]===F?ee=t[19]:(ee=(0,$.jsx)(oe,{value:`review`,children:F}),t[18]=F,t[19]=ee);let te=a?`客户访谈`:`Interview`,I;t[20]===te?I=t[21]:(I=(0,$.jsx)(oe,{value:`interview`,children:te}),t[20]=te,t[21]=I);let ne;t[22]!==k||t[23]!==A||t[24]!==M||t[25]!==P||t[26]!==ee||t[27]!==I||t[28]!==r?(ne=(0,$.jsxs)(ae,{value:r,"aria-label":k,onChange:A,children:[M,P,ee,I]}),t[22]=k,t[23]=A,t[24]=M,t[25]=P,t[26]=ee,t[27]=I,t[28]=r,t[29]=ne):ne=t[29];let L=o||s||!n.discussion.canonicalTranscript,R;t[30]===d?R=t[31]:(R=()=>v(d),t[30]=d,t[31]=R);let z;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,$.jsx)(Fe,{className:`size-4`}),t[32]=z):z=t[32];let re=a?`重新整理纪要`:`Regenerate summary`,B;t[33]!==L||t[34]!==R||t[35]!==re?(B=(0,$.jsxs)(Z,{className:`min-h-11 w-full justify-start`,disabled:L,onClick:R,children:[z,re]}),t[33]=L,t[34]=R,t[35]=re,t[36]=B):B=t[36];let ie;t[37]!==b||t[38]!==o||t[39]!==n.discussion.status||t[40]!==f||t[41]!==s||t[42]!==a?(ie=b&&[`completed`,`needs_attention`].includes(n.discussion.status)?(0,$.jsx)(Z,{className:`min-h-11 w-full justify-start`,disabled:o||s,onClick:()=>v(f),children:a?`从原音重新生成`:`Regenerate from audio`}):null,t[37]=b,t[38]=o,t[39]=n.discussion.status,t[40]=f,t[41]=s,t[42]=a,t[43]=ie):ie=t[43];let V;t[44]!==ne||t[45]!==B||t[46]!==ie||t[47]!==O?(V=(0,$.jsxs)(`div`,{className:`space-y-2 py-3`,children:[O,ne,B,ie]}),t[44]=ne,t[45]=B,t[46]=ie,t[47]=O,t[48]=V):V=t[48];let se=a?`导出与分享`:`Export and share`,ce;t[49]===se?ce=t[50]:(ce=(0,$.jsx)(`p`,{className:`px-2 text-xs text-fg-muted`,children:se}),t[49]=se,t[50]=ce);let H;t[51]!==b||t[52]!==y||t[53]!==a?(H=b?(0,$.jsxs)(`a`,{className:`flex min-h-11 items-center gap-2 rounded-lg px-2 text-sm hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,href:l(`${y}/audio`),download:!0,children:[(0,$.jsx)(le,{className:`size-4`}),a?`下载录音`:`Download recording`]}):null,t[51]=b,t[52]=y,t[53]=a,t[54]=H):H=t[54];let de;t[55]!==m||t[56]!==a?(de=m?(0,$.jsx)(Z,{className:`min-h-11 w-full justify-start`,disabled:m.busy,onClick:()=>v(m.onShare),children:a?`分享笔记`:`Share note`}):null,t[55]=m,t[56]=a,t[57]=de):de=t[57];let fe;t[58]===y?fe=t[59]:(fe=(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:[`md`,`txt`,`srt`].map(e=>(0,$.jsx)(`a`,{className:`inline-flex min-h-11 items-center rounded-lg px-3 text-sm text-accent-fg hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,href:l(`${y}/export?format=${e}`),download:!0,children:e.toUpperCase()},e))}),t[58]=y,t[59]=fe);let pe=n.note.id,me=String(n.note.remoteVersion??1),he;t[60]!==n.note.id||t[61]!==me?(he={kind:`note`,id:pe,revision:me},t[60]=n.note.id,t[61]=me,t[62]=he):he=t[62];let ge;t[63]===c?ge=t[64]:(ge={text:c,draft:!1},t[63]=c,t[64]=ge);let _e=a?`带到新对话`:`Use in a new chat`,ve=o||s||u||!c||c.length>16e3,ye;t[65]!==he||t[66]!==ge||t[67]!==_e||t[68]!==ve?(ye=(0,$.jsx)(ht,{resource:he,selection:ge,label:_e,disabled:ve}),t[65]=he,t[66]=ge,t[67]=_e,t[68]=ve,t[69]=ye):ye=t[69];let U=c.length>16e3?a?`内容较长,请先筛选部分原文。`:`Filter the transcript to share a smaller selection.`:a?`分享当前显示的文字,不包含原音。`:`Shares displayed text, without audio.`,W;t[70]===U?W=t[71]:(W=(0,$.jsx)(`p`,{className:`px-2 text-xs leading-5 text-fg-muted`,children:U}),t[70]=U,t[71]=W);let be;t[72]!==ce||t[73]!==H||t[74]!==de||t[75]!==fe||t[76]!==ye||t[77]!==W?(be=(0,$.jsxs)(`div`,{className:`space-y-2 border-t border-edge-subtle py-3`,children:[ce,H,de,fe,ye,W]}),t[72]=ce,t[73]=H,t[74]=de,t[75]=fe,t[76]=ye,t[77]=W,t[78]=be):be=t[78];let G;t[79]!==m||t[80]!==a?(G=m?(0,$.jsxs)(`div`,{className:`space-y-1 border-t border-edge-subtle pt-2`,children:[(0,$.jsx)(Z,{className:`min-h-11 w-full justify-start`,onClick:()=>v(m.onHistory),children:a?`版本历史`:`Version history`}),(0,$.jsx)(Z,{className:`min-h-11 w-full justify-start text-danger`,disabled:m.busy,onClick:()=>v(m.onDelete),children:a?`删除笔记`:`Delete note`})]}):null,t[79]=m,t[80]=a,t[81]=G):G=t[81];let xe;t[82]!==V||t[83]!==be||t[84]!==G||t[85]!==w||t[86]!==T||t[87]!==E?(xe=(0,$.jsx)(We,{children:(0,$.jsxs)(Ge,{align:`end`,sideOffset:6,collisionPadding:12,"aria-label":w,className:`z-[140] max-h-[min(38rem,var(--radix-popover-content-available-height,85dvh))] w-[min(20rem,calc(100vw-2rem))] overflow-y-auto rounded-2xl border border-edge bg-surface-overlay p-3 text-fg shadow-elevated`,children:[T,E,V,be,G]})}),t[82]=V,t[83]=be,t[84]=G,t[85]=w,t[86]=T,t[87]=E,t[88]=xe):xe=t[88];let Se;return t[89]!==h||t[90]!==C||t[91]!==xe?(Se=(0,$.jsxs)(Ke,{open:h,onOpenChange:g,children:[C,xe]}),t[89]=h,t[90]=C,t[91]=xe,t[92]=Se):Se=t[92],Se}var kt=e=>`${Math.floor(e/6e4)}:${String(Math.floor(e/1e3)%60).padStart(2,`0`)}`;function At({id:e,query:t,zh:n,refreshKey:r,sourceKey:i,active:a,tab:o,onEvidence:s,onPlay:c}){let[u,d]=(0,Q.useState)(),[p,m]=(0,Q.useState)(!0),[h,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)(!1),y=(0,Q.useRef)(0),[b,x]=(0,Q.useState)(),[S,C]=(0,Q.useState)(),[w,T]=(0,Q.useState)(``),[E,D]=(0,Q.useState)(0);(0,Q.useEffect)(()=>{if(!a||t)return;let e=window.setInterval(()=>D(e=>e+1),3e3);return()=>window.clearInterval(e)},[a,t]),(0,Q.useEffect)(()=>{C(void 0)},[e,t]),(0,Q.useEffect)(()=>{let n=++y.current,r=new AbortController;m(!0),v(!1),g(``);let a=window.setTimeout(()=>{f(l(`/api/discussions/${encodeURIComponent(e)}/review?q=${encodeURIComponent(t)}`),{signal:r.signal}).then(e=>{y.current===n&&(d(e),x(i),T(t))}).catch(e=>{y.current===n&&!r.signal.aborted&&g(String(e))}).finally(()=>{y.current===n&&m(!1)})},t?200:0);return()=>{y.current++,r.abort(),window.clearTimeout(a)}},[e,t,r,i,E]);async function O(){if(!u||_)return;let r=y.current;v(!0);try{let n=await f(l(`/api/discussions/${encodeURIComponent(e)}/review?q=${encodeURIComponent(t)}&offset=${u.hits.length}&version=${u.version}`));r===y.current&&d({...n,hits:[...u.hits,...n.hits]})}catch(e){r===y.current&&g(n?`内容已变化,请重新搜索。${String(e)}`:`Content changed; search again. ${String(e)}`)}finally{v(!1)}}function k(e){C(e),(!e.provisional||e.kind===`chapter`)&&e.transcriptRevision!==void 0&&e.segments.length&&s({transcriptRevision:e.transcriptRevision,stale:e.stale,audioAvailable:u?.coverage.audioAvailable??!1,timingVerified:e.segments.some(e=>e.playback.length>0),segments:e.segments})}let A=e=>e.kind===`chapter`?n?`章节`:`Chapter`:e.kind===`annotation`?n?`我的标记`:`My mark`:e.kind===`analysis`?n?`分析`:`Analysis`:n?`原文`:`Transcript`,j=e=>(0,$.jsxs)(`article`,{className:`space-y-2 rounded-xl bg-surface-inset p-4`,children:[(0,$.jsxs)(`button`,{className:`text-left text-sm text-accent-fg`,onClick:()=>k(e),children:[e.startedAtMs===void 0?``:`${kt(e.startedAtMs)}${e.endedAtMs===void 0?``:`–${kt(e.endedAtMs)}`} · `,e.title||A(e)]}),(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-sm`,children:e.kind===`chapter`&&!t&&e.text.length>300?`${e.text.slice(0,300)}…`:e.text}),(0,$.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[A(e),e.provisional?n?` · 阶段性结果`:` · Partial result`:``,e.stale?n?` · 原文已更新,保留旧版依据`:` · Earlier transcript revision`:``,e.kind===`chapter`?` · ${e.highlightCount??0} ${n?`个重点`:`marks`} · ${e.actionCount??0} ${n?`个候选行动`:`candidate actions`}`:``]}),e.kind!==`chapter`||t||S?.id===e.id?e.segments.map(e=>(0,$.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[kt(e.startedAtMs),` · `,e.text.length>500?`${e.text.slice(0,500)}…`:e.text]},`${e.sequence}:${e.startedAtMs}`)):null,e.playback.slice(0,3).map((e,t)=>(0,$.jsxs)(Z,{onClick:()=>c(e.startedAtMs,e.endedAtMs),children:[n?`回听上下文`:`Play context`,` `,kt(e.startedAtMs),`–`,kt(e.endedAtMs)]},t)),e.segments.length?(0,$.jsx)(Z,{onClick:()=>k(e),children:n?`查看对应原文`:`View transcript`}):(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`暂无可核实的原文定位`:`No verified transcript reference`})]},e.id);return(0,$.jsxs)(`section`,{"aria-label":n?`长录音回顾`:`Recording review`,className:`flex flex-col gap-3`,children:[h?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:h}),(0,$.jsx)(Z,{onClick:()=>D(e=>e+1),children:n?`刷新结果`:`Refresh results`})]}):null,p&&(!u||b!==i||w!==t)?(0,$.jsx)(Ve,{className:`h-20 w-full`}):null,u&&b===i&&(!t||w===t)?(0,$.jsxs)($.Fragment,{children:[t?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium`,children:n?`搜索结果 · ${u.total}`:`Search results · ${u.total}`}),(0,$.jsx)(Z,{onClick:()=>D(e=>e+1),children:n?`刷新结果`:`Refresh results`}),(0,$.jsx)(`div`,{"aria-label":n?`命中位置`:`Match positions`,className:`relative my-3 h-5 rounded bg-surface-inset`,children:u.hits.filter(e=>e.startedAtMs!==void 0).map(e=>(0,$.jsx)(`button`,{className:`absolute top-0 h-5 w-1.5 rounded bg-accent`,style:{left:`${Math.min(99,100*e.startedAtMs/Math.max(1,u.coverage.durationMs))}%`},"aria-label":`${kt(e.startedAtMs)} ${e.title||A(e)}`,onClick:()=>k(e)},e.id))}),u.total?null:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n?`未找到关键词;尚未转写的内容无法搜索。`:`No matches. Untranscribed audio is not searchable yet.`}),u.hits.map(j)]}):(0,$.jsxs)($.Fragment,{children:[o===`summary`&&u.chapters.length?(0,$.jsxs)(`details`,{className:`rounded-xl bg-surface-inset px-4`,children:[(0,$.jsxs)(`summary`,{className:`min-h-11 cursor-pointer py-3 text-sm font-medium focus-visible:ring-2 focus-visible:ring-accent`,children:[n?`章节目录`:`Chapters`,` · `,u.chapters.length]}),(0,$.jsx)(`div`,{className:`space-y-3 pb-4`,children:u.chapters.map(j)})]}):null,u.hits.length?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium`,children:n?`本轮已完成转写(阶段性)`:`Available transcription from this run`}),u.hits.map(j)]}):null]}),u.hasMore?(0,$.jsx)(Z,{disabled:_,onClick:()=>void O(),children:n?`加载更多结果`:`More results`}):null,(0,$.jsxs)(`details`,{className:`rounded-lg text-xs text-fg-muted`,children:[(0,$.jsx)(`summary`,{className:`min-h-11 cursor-pointer py-3 focus-visible:ring-2 focus-visible:ring-accent`,children:n?`处理范围`:`Processing coverage`}),(0,$.jsxs)(`div`,{role:`status`,className:`space-y-2 pb-3 leading-5`,children:[(0,$.jsxs)(`p`,{children:[n?`原音`:`Audio`,` · `,u.coverage.audioAvailable?n?`已保存,可回听`:`Saved, ready to play`:n?`尚不可用`:`Unavailable`]}),(0,$.jsxs)(`p`,{children:[n?`本轮转写已处理`:`Processed this run`,` `,kt(u.coverage.processedMs),` / `,kt(u.coverage.durationMs),` · `,n?`连续处理至`:`Continuous through`,` `,kt(u.coverage.continuousThroughMs)]}),(0,$.jsxs)(`p`,{children:[n?`分析覆盖`:`Analysis coverage`,` · `,u.coverage.analysisRanges.length?u.coverage.analysisRanges.map(e=>`${kt(e.startedAtMs)}–${kt(e.endedAtMs)}`).join(`、`):n?`暂无本版已完成章节`:`No completed chapters for this revision`,u.coverage.analysisStale?n?`;已发布分析基于旧版原文`:`; published analysis uses an earlier transcript`:``,` · `,u.coverage.complete?n?`本轮处理完成`:`Run complete`:n?`阶段性内容,其余仍待处理`:`Partial content; remaining work pending`]})]})]}),S?.provisional?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`以上是本轮已保存的阶段性原文;正式发布后才能校对和标记具体段落。`:`Saved partial text; segment editing and highlighting become available after publication.`}):null]}):null]})}function jt({recordingId:e,discussionId:t,zh:n,onEvidence:r,onPlay:i}){let{data:a=[],mutate:o}=Ue(`/api/discussions/${t}/annotations`,e=>f(l(e))),[s,c]=(0,Q.useState)([]),[u,d]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(``),_=(0,Q.useCallback)(async()=>{c(await k(e))},[e]),v=(0,Q.useCallback)(async()=>{try{await A(e,t),await _(),await o()}catch(e){await o(),g(e instanceof Error?e.message:String(e))}},[e,t,_,o]);(0,Q.useEffect)(()=>{_().catch(e=>g(String(e))),v();let e=()=>{_().catch(e=>g(String(e)))};window.addEventListener(`discussion-annotations-changed`,e),window.addEventListener(`online`,v);let t=window.setInterval(()=>{navigator.onLine&&v()},15e3);return()=>{window.removeEventListener(`discussion-annotations-changed`,e),window.removeEventListener(`online`,v),window.clearInterval(t)}},[_,v]);let y=new Map(a.map(e=>[e.annotation.id,{...e,localState:`synced`}]));for(let e of s)if(e.state!==`synced`||!y.has(e.annotation.id)){let t=y.get(e.annotation.id);y.set(e.annotation.id,{annotation:e.annotation,state:t?.state??`pending`,playback:t?.playback??[],evidence:t?.evidence,localState:e.state})}let b=async(t,n=s.find(e=>e.annotation.id===t.id)?.nonce??null)=>{try{await O(e,{...t,updatedAt:Date.now()},n),m(null),g(``),await _(),v()}catch(e){g(e instanceof Error?e.message:String(e))}};return(0,$.jsxs)(`section`,{className:`space-y-4`,"aria-label":n?`我的标记`:`My highlights`,children:[h?(0,$.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[h,(0,$.jsx)(Z,{onClick:()=>void v(),children:n?`重试同步`:`Retry sync`})]}):null,y.size?null:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n?`录音时标重点,或在原文中标记整段。标记先保存在本机。`:`Highlight while recording or mark a transcript segment. Highlights save locally first.`}),[...y.values()].sort((e,t)=>e.annotation.anchor.capturedAt-t.annotation.anchor.capturedAt).filter(e=>!e.annotation.deleted||e.localState===`conflict`).map(e=>(0,$.jsxs)(`article`,{className:`space-y-2 rounded-lg border border-edge p-3`,children:[(0,$.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[e.annotation.kind===`highlight`?n?`重点`:`Highlight`:e.annotation.kind===`question`?n?`问题`:`Question`:n?`我的补充`:`My note`,` · `,new Date(e.annotation.anchor.capturedAt).toLocaleString(),` · `,e.localState===`synced`?n?`已同步`:`Synced`:e.localState===`conflict`?n?`同步冲突,保留了本机修改`:`Conflict; local edits retained`:n?`本机已保存,待同步`:`Saved locally; sync pending`]}),e.evidence?.segments.map(e=>(0,$.jsx)(`blockquote`,{className:`text-sm`,children:e.text},e.sequence)),e.positionMs===void 0?null:(0,$.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[n?`标记位置`:`Marked position`,` · `,Math.floor(e.positionMs/6e4),`:`,String(Math.floor(e.positionMs/1e3)%60).padStart(2,`0`)]}),e.annotation.text?(0,$.jsxs)(`p`,{className:`whitespace-pre-wrap text-sm`,children:[n?`我的说明:`:`My context: `,e.annotation.text]}):null,(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsx)(Z,{disabled:!e.evidence,onClick:()=>e.evidence&&r(e.evidence),children:n?`查看原文`:`View transcript`}),e.playback.map((e,t)=>(0,$.jsxs)(Z,{onClick:()=>i(e),children:[n?`回听`:`Play`,` `,Math.floor(e.startedAtMs/6e4),`:`,String(Math.floor(e.startedAtMs/1e3)%60).padStart(2,`0`)]},t)),(0,$.jsx)(Z,{onClick:()=>{d(s.find(t=>t.annotation.id===e.annotation.id)?.nonce??null),m({...e.annotation,revision:a.find(t=>t.annotation.id===e.annotation.id)?.annotation.revision??e.annotation.revision})},children:e.localState===`conflict`?n?`合并修改`:`Merge changes`:n?`添加说明/类型`:`Edit context/type`}),(0,$.jsx)(Z,{onClick:()=>void b({...e.annotation,deleted:!0}),children:n?`移除标记`:`Remove`})]}),e.state===`located`&&!e.evidence?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`该位置原文尚未生成,可先回听原音。`:`Transcript for this position is pending; audio is usable.`}):null,e.state===`unavailable`?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`该位置原音未保存、已删除或时间尚无法核实;保留原始标记,不自动移动。`:`Audio at this position is missing, deleted or unverified. The original anchor has been retained.`}):e.state===`pending`?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`等待原音/原文完成定位`:`Awaiting audio/transcript positioning`}):null,e.localState===`conflict`?(0,$.jsx)(Z,{onClick:()=>{let t=s.find(t=>t.annotation.id===e.annotation.id),n=a.find(t=>t.annotation.id===e.annotation.id);t&&n&&D(t,n.annotation).then(_)},children:n?`使用服务端版本`:`Use server version`}):null]},e.annotation.id)),p?(0,$.jsxs)(`div`,{role:`dialog`,"aria-label":n?`编辑标记`:`Edit highlight`,className:`rounded-lg border border-edge p-3`,children:[(0,$.jsxs)(ae,{value:p.kind,"aria-label":n?`标记类型`:`Highlight type`,onChange:e=>m({...p,kind:e.target.value}),children:[(0,$.jsx)(oe,{value:`highlight`,children:n?`重点`:`Highlight`}),(0,$.jsx)(oe,{value:`question`,children:n?`问题`:`Question`}),(0,$.jsx)(oe,{value:`note`,children:n?`补充`:`Context`})]}),(0,$.jsx)(`textarea`,{"aria-label":n?`我的说明`:`My context`,maxLength:4e3,value:p.text,onChange:e=>m({...p,text:e.target.value}),className:`my-2 min-h-24 w-full rounded border border-edge bg-surface-inset p-2`}),(0,$.jsx)(Z,{onClick:()=>void b(p,u),children:n?`保存到本机并同步`:`Save locally and sync`}),(0,$.jsx)(Z,{onClick:()=>m(null),children:n?`取消`:`Cancel`})]}):null]})}var Mt={tab:`summary`,query:``,page:1,positionMs:0},Nt=p((e,t)=>({notes:{},update:(n,r)=>{let i={...Ft(n,t().notes[n]),...r};e(e=>({notes:{...e.notes,[n]:i}}));try{localStorage.setItem(`discussion-review:${n}`,JSON.stringify(i))}catch{}}})),Pt=new Map;function Ft(e,t){if(t)return t;if(Pt.has(e))return Pt.get(e);let n=Mt;try{let t=JSON.parse(localStorage.getItem(`discussion-review:${e}`)??`null`);t&&[`summary`,`transcript`,`marks`].includes(t.tab)&&typeof t.query==`string`&&Number.isSafeInteger(t.page)&&t.page>0&&t.page<=1e4&&Number.isFinite(t.positionMs)&&t.positionMs>=0&&(n={...Mt,...t})}catch{}return Pt.set(e,n),n}function It(e){let t=(0,gt.c)(51),{initial:n,zh:r,busy:i,onClose:a,onSave:o}=e,[s,c]=(0,Q.useState)(n),l;t[0]!==i||t[1]!==a?(l=e=>{!e&&!i&&a()},t[0]=i,t[1]=a,t[2]=l):l=t[2];let u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(h,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),t[3]=u):u=t[3];let d=r?`编辑纪要内容`:`Edit meeting content`,f;t[4]===d?f=t[5]:(f=(0,$.jsx)(`header`,{className:`border-b border-edge p-4`,children:(0,$.jsx)(b,{children:d})}),t[4]=d,t[5]=f);let p=r?`人工修改会保留,重新整理不会覆盖。已创建任务保持不变。`:`Your changes survive regeneration. Existing tasks remain unchanged.`,m;t[6]===p?m=t[7]:(m=(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:p}),t[6]=p,t[7]=m);let g=r?`内容`:`Content`,_;t[8]===s?_=t[9]:(_=e=>c({...s,text:e.target.value}),t[8]=s,t[9]=_);let S;t[10]!==s.text||t[11]!==_?(S=(0,$.jsx)(`textarea`,{className:`mt-1 min-h-32 w-full rounded border border-edge bg-transparent p-2`,value:s.text,onChange:_}),t[10]=s.text,t[11]=_,t[12]=S):S=t[12];let C;t[13]!==g||t[14]!==S?(C=(0,$.jsxs)(`label`,{className:`block text-sm`,children:[g,S]}),t[13]=g,t[14]=S,t[15]=C):C=t[15];let w;t[16]!==s||t[17]!==r?(w=s.kind===`actionItems`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`label`,{className:`block text-sm`,children:[r?`负责人原话`:`Owner as stated`,(0,$.jsx)(`input`,{className:`mt-1 w-full rounded border border-edge bg-transparent p-2`,value:s.owner??``,onChange:e=>c({...s,owner:e.target.value})})]}),(0,$.jsxs)(`label`,{className:`block text-sm`,children:[r?`期限原话`:`Date as stated`,(0,$.jsx)(`input`,{className:`mt-1 w-full rounded border border-edge bg-transparent p-2`,value:s.dueDate??``,onChange:e=>c({...s,dueDate:e.target.value})})]})]}):null,t[16]=s,t[17]=r,t[18]=w):w=t[18];let T;t[19]!==s||t[20]!==r?(T=s.kind===`summary`?null:(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:!!s.ignored,onChange:e=>c({...s,ignored:e.target.checked})}),r?`忽略此项`:`Ignore this item`]}),t[19]=s,t[20]=r,t[21]=T):T=t[21];let E;t[22]!==C||t[23]!==w||t[24]!==T||t[25]!==m?(E=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-4`,children:[m,C,w,T]}),t[22]=C,t[23]=w,t[24]=T,t[25]=m,t[26]=E):E=t[26];let D=r?`取消`:`Cancel`,O;t[27]!==i||t[28]!==a||t[29]!==D?(O=(0,$.jsx)(Z,{disabled:i,onClick:a,children:D}),t[27]=i,t[28]=a,t[29]=D,t[30]=O):O=t[30];let k;t[31]!==i||t[32]!==s.text?(k=i||!s.text.trim(),t[31]=i,t[32]=s.text,t[33]=k):k=t[33];let A;t[34]!==s||t[35]!==o?(A=()=>void o(s),t[34]=s,t[35]=o,t[36]=A):A=t[36];let j=r?`保存修改`:`Save changes`,M;t[37]!==k||t[38]!==A||t[39]!==j?(M=(0,$.jsx)(Z,{variant:`primary`,disabled:k,onClick:A,children:j}),t[37]=k,t[38]=A,t[39]=j,t[40]=M):M=t[40];let N;t[41]!==O||t[42]!==M?(N=(0,$.jsxs)(`footer`,{className:`flex justify-end gap-2 border-t border-edge p-3`,children:[O,M]}),t[41]=O,t[42]=M,t[43]=N):N=t[43];let P;t[44]!==E||t[45]!==N||t[46]!==f?(P=(0,$.jsxs)(v,{children:[u,(0,$.jsxs)(y,{"aria-describedby":void 0,className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[71] flex h-[min(32rem,90dvh)] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay`,children:[f,E,N]})]}),t[44]=E,t[45]=N,t[46]=f,t[47]=P):P=t[47];let F;return t[48]!==l||t[49]!==P?(F=(0,$.jsx)(x,{open:!0,onOpenChange:l,children:P}),t[48]=l,t[49]=P,t[50]=F):F=t[50],F}function Lt(e,t,n){if(t===`summary`){let r=e.organization;if(!r)return``;let i=r.organization;if(!i)return``;let a=e=>e.filter(e=>n.showIgnored||!e.ignored);return JSON.stringify({discussionId:e.discussion.id,view:t,revision:r.revision,transcriptRevision:r.transcriptRevision,summary:i.summary,decisions:a(i.decisions),actionItems:a(i.actionItems),risks:a(i.risks),openQuestions:a(i.openQuestions),chapters:i.chapters},null,2)}let r=n.query.toLocaleLowerCase(),i=e.transcript.segments.filter(e=>(e.displayText??e.rawText??``).toLocaleLowerCase().includes(r)||e.speakerLabel?.toLocaleLowerCase().includes(r)).slice(0,n.page*50);return i.length?JSON.stringify({discussionId:e.discussion.id,view:t,revision:e.transcript.revision,scope:`loaded filtered segments only`,segments:i.map(e=>({sequence:e.sequence,startedAtMs:e.startedAtMs,speaker:e.speakerLabel,text:e.displayText??e.rawText??``}))},null,2):``}var Rt=e=>`${String(Math.floor(e/6e4)).padStart(2,`0`)}:${String(Math.floor(e/1e3)%60).padStart(2,`0`)}`;function zt({noteId:e,onPersonalNotes:t,noteActions:n}){let r=a(),i=d(e=>e.language)===`zh`,{data:s,mutate:c,isLoading:u}=Ue([`note-discussion-document`,e],()=>w(e),{refreshInterval:e=>e&&([`recording`,`stopping`,`sealing`,`organizing`].includes(e.discussion.status)||e.recordingJob?.state===`queued`||e.recordingJob?.state===`running`)?3e3:0}),p=s?.discussion.id,m=`/api/discussions/${encodeURIComponent(p??``)}`,{data:g=[],mutate:_}=Ue(p?`${m}/actions`:null,e=>f(l(e)),{refreshInterval:1e4}),S=Nt(t=>Ft(e,t.notes[e])),D=Nt(e=>e.update),k=S.tab,j=t=>D(e,{tab:t}),N=S.query,P=t=>D(e,{query:t}),[F,ee]=(0,Q.useState)(!1),te=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{F&&te.current?.focus()},[F]);let[I,ne]=(0,Q.useState)(`general`),[L,R]=(0,Q.useState)(null),[z,re]=(0,Q.useState)(null),[B,V]=(0,Q.useState)(null),[ae,oe]=(0,Q.useState)(!1),[se,ce]=(0,Q.useState)([]),[H,le]=(0,Q.useState)(null),[ue,de]=(0,Q.useState)(!1),fe=S.page,pe=t=>D(e,{page:t}),me=(0,Q.useRef)(null),[he,ge]=(0,Q.useState)([]),_e=(0,Q.useRef)(0),ve=(0,Q.useRef)(0),ye=(0,Q.useRef)(s?.transcript.revision);ye.current=s?.transcript.revision;let U=(0,Q.useRef)(null),W=(0,Q.useRef)(null),[,be]=(0,Q.useState)(0);(0,Q.useEffect)(()=>{let e=()=>{c(),_()};return window.addEventListener(`discussion-updated`,e),window.addEventListener(`discussion-segment-updated`,e),()=>{window.removeEventListener(`discussion-updated`,e),window.removeEventListener(`discussion-segment-updated`,e)}},[c,_]),(0,Q.useEffect)(()=>{s?.discussion.template&&ne(s.discussion.template)},[s?.discussion.template]);async function G(e){if(!ue){de(!0),le(null);try{await e(),await c(),await _()}catch(e){le(e instanceof Error?e.message:String(e))}finally{de(!1)}}}function xe(e,t){U.current&&(me.current=t??null,U.current.readyState===0?(W.current=e/1e3,U.current.load()):(U.current.currentTime=e/1e3,U.current.play().catch(()=>void 0)))}function Se(e){let t=e.stale||e.transcriptRevision!==ye.current;R({...e,stale:t}),t||ge(e.segments.map(e=>e.sequence))}async function Ce(e,t,n=!1){if(!s)return;let r=_e.current,i=++ve.current;await G(async()=>{let a=await f(l(`${m}/evidence?revision=${t??s.organization?.transcriptRevision??s.transcript.revision}&segments=${e.join(`,`)}`));if(!(r!==_e.current||i!==ve.current)&&(Se(a),n&&a.segments[0]?.playback[0])){let e=a.segments[0].playback[0];xe(e.startedAtMs,e.endedAtMs)}})}async function we(e){s&&await G(async()=>{await O(s.discussion.clientRequestId,E({type:`transcript`,capturedAt:Date.now(),transcriptRevision:s.transcript.revision,segmentIds:[e.sequence]})),j(`marks`),A(s.discussion.clientRequestId,s.discussion.id).catch(e=>le(String(e)))})}(0,Q.useEffect)(()=>(_e.current++,R(null),ge([]),re(null),V(null),ce([]),le(null),me.current=null,()=>{_e.current++}),[e]),(0,Q.useEffect)(()=>{let t=s?.discussion.audioSha256??s?.discussion.audioAttachmentId;if(!t)return;let n=Ft(e,Nt.getState().notes[e]);n.source&&n.source!==t?(_e.current++,R(null),ge([]),U.current?.pause(),D(e,{positionMs:0,source:t}),W.current=0,me.current=null):D(e,{source:t})},[e,s?.discussion.audioSha256,s?.discussion.audioAttachmentId,D]),(0,Q.useEffect)(()=>{s?.discussion.audioDeletedAt&&(U.current?.pause(),W.current=null,me.current=null,R(e=>e?{...e,audioAvailable:!1,timingVerified:!1,segments:e.segments.map(e=>({...e,playback:[]}))}:null))},[s?.discussion.audioDeletedAt]),(0,Q.useEffect)(()=>{S.tab===`transcript`&&S.anchor!==void 0&&S.anchorRevision===s?.transcript.revision&&window.setTimeout(()=>document.getElementById(`discussion-segment-${S.anchor}`)?.scrollIntoView?.({block:`center`}),0)},[S.tab,S.anchor,S.anchorRevision,s?.transcript.revision]),(0,Q.useEffect)(()=>{ge([]),R(e=>e&&e.transcriptRevision!==s?.transcript.revision?{...e,stale:!0}:e)},[s?.transcript.revision]);let Te=(e,t,n)=>t.some(e=>ae||!e.ignored)?(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsx)(`h3`,{className:`font-semibold text-fg`,children:e}),t.filter(e=>ae||!e.ignored).map(e=>(0,$.jsxs)(`div`,{className:`flex items-start gap-3 text-sm`,children:[(0,$.jsxs)(`p`,{className:`flex-1 whitespace-pre-wrap`,children:[e.text,e.supersededBy||e.disputedBy?(0,$.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:i?`有后续变更`:`Later changes`}):null,e.editedByUser?(0,$.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:i?e.ignored?`已忽略`:`人工编辑`:e.ignored?`Ignored`:`Edited`}):null]}),(0,$.jsx)(`button`,{className:`text-xs text-fg-muted`,disabled:ue,onClick:()=>V({kind:n,itemId:e.id,text:e.text,ignored:e.ignored}),children:i?`编辑`:`Edit`}),e.evidenceSegmentIds.length?(0,$.jsx)(`button`,{disabled:ue,className:`shrink-0 text-accent-fg`,onClick:()=>void Ce(e.evidenceSegmentIds,e.evidenceRevision),children:i?`原话`:`Source`}):(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:i?`暂无定位`:`No source timing`})]},e.id))]}):null;if(u)return(0,$.jsx)(Ve,{className:`h-48 w-full`});if(!s)return null;let{discussion:K,transcript:Ee,organization:q}=s,J=q?.organization,De=[`stopping`,`sealing`,`organizing`].includes(K.status),Oe=[`recording`,`completed`,`needs_attention`].includes(K.status),ke=Ee.segments.filter(e=>(e.displayText??e.rawText??``).toLocaleLowerCase().includes(N.toLocaleLowerCase())||e.speakerLabel?.toLocaleLowerCase().includes(N.toLocaleLowerCase())),Ae=k===`marks`||N.trim()?``:Lt(s,k,{query:N,page:fe,showIgnored:ae});return(0,$.jsxs)(`section`,{className:`relative flex h-full min-h-0 w-full flex-col text-fg`,onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`f`&&(e.preventDefault(),ee(!0))},children:[(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start gap-3 px-5 pb-3 pt-5 sm:px-7`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`h2`,{className:`text-xl font-semibold leading-snug tracking-tight`,children:!s.note.title||/^Discussion · \d{4}-\d{2}-\d{2} \d{2}:\d{2}$/.test(s.note.title)?i?`语音笔记`:`Voice note`:s.note.title}),(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[i?`录音`:`Recording`,` · `,Rt(K.durationMs??0)]})]}),(0,$.jsx)(`button`,{type:`button`,"aria-label":i?`搜索此 Note`:`Search this Note`,"aria-expanded":F||!!N,onClick:()=>{ee(e=>!e),F&&P(``)},className:`inline-flex size-11 shrink-0 items-center justify-center rounded-full text-fg-muted hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:(0,$.jsx)(Ie,{className:`size-5`,"aria-hidden":!0})}),(0,$.jsx)(Ot,{noteActions:n,detail:s,template:I,onTemplate:ne,zh:i,busy:ue,processing:De,pageText:Ae,editing:!!B||!!z,onPersonalNotes:t,onOrganize:()=>void G(()=>f(l(`${m}/organize`),{method:`POST`,body:JSON.stringify({template:I})})),onRegenerate:()=>void G(()=>T(K.id,`from_audio`))})]}),(0,$.jsx)($e,{as:`nav`,"aria-label":i?`笔记内容`:`Note content`,className:`mx-5 mb-2 flex shrink-0 gap-1 rounded-xl bg-surface-inset p-1 sm:mx-7`,indicatorClassName:`rounded-lg bg-surface-panel shadow-sm`,children:[`summary`,`transcript`,`marks`].map(e=>(0,$.jsx)(`button`,{"aria-pressed":k===e,className:`min-h-11 min-w-0 flex-1 rounded-lg px-2 text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${k===e?`bg-surface-panel font-medium text-fg shadow-sm`:`text-fg-muted hover:text-fg`}`,onClick:()=>j(e),children:e===`summary`?i?`概览`:`Overview`:e===`marks`?i?`标记`:`Highlights`:i?`原文`:`Transcript`},e))}),H?(0,$.jsxs)(`details`,{role:`alert`,className:`px-4 py-2 text-sm text-danger`,children:[(0,$.jsx)(`summary`,{children:i?`操作未完成,可以稍后重试`:`Action incomplete. Try again later`}),(0,$.jsx)(`p`,{className:`mt-2 break-words text-xs text-fg-muted`,children:H})]}):null,F||N?(0,$.jsxs)(`label`,{className:`mx-5 mb-2 flex shrink-0 items-center gap-2 rounded-xl bg-surface-inset px-3 sm:mx-7`,children:[(0,$.jsx)(Ie,{className:`size-4 text-fg-muted`}),(0,$.jsx)(`input`,{ref:te,"aria-label":i?`搜索此 Note`:`Search this Note`,className:`min-h-11 min-w-0 w-full bg-transparent text-sm outline-none`,maxLength:200,placeholder:i?`搜索这篇笔记`:`Search this note`,value:N,onChange:e=>{P(e.target.value),pe(1)}}),(0,$.jsx)(`button`,{className:`inline-flex size-11 shrink-0 items-center justify-center rounded-lg focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":i?`关闭搜索`:`Close search`,onClick:()=>{P(``),ee(!1)},children:(0,$.jsx)(X,{className:`size-4`})})]}):null,(0,$.jsxs)(`main`,{className:`flex min-h-0 flex-1 flex-col gap-5 overflow-y-auto px-5 pb-6 pt-1 sm:px-7`,children:[K.status!==`recording`||s.recordingJob?(0,$.jsx)(C,{context:`note`,input:M(s),zh:i,busy:ue,onRetry:e=>void G(()=>e===`analyze`?f(l(`${m}/organize`),{method:`POST`,body:JSON.stringify({template:I})}):T(K.id,e===`regenerate`?`from_audio`:`resume`))}):null,(0,$.jsx)(`div`,{hidden:!!N.trim(),children:k===`marks`?(0,$.jsx)(jt,{recordingId:K.clientRequestId,discussionId:K.id,zh:i,onEvidence:Se,onPlay:e=>xe(e.startedAtMs,e.endedAtMs)},K.id):k===`summary`?J?(0,$.jsxs)(`div`,{className:`mx-auto max-w-3xl space-y-6`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsx)(`h3`,{className:`text-base font-medium`,children:i?`摘要`:`Summary`}),(0,$.jsx)(`button`,{className:`inline-flex size-11 shrink-0 items-center justify-center rounded-full text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":i?`编辑概要`:`Edit overview`,title:i?`编辑概要`:`Edit overview`,disabled:ue||De,onClick:()=>V({kind:`summary`,itemId:`summary`,text:J.summary}),children:(0,$.jsx)(Re,{className:`size-4`,"aria-hidden":!0})})]}),(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-[15px] leading-7`,children:J.summary}),J.summaryEditedByUser?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i?`已由你编辑`:`Edited by you`}):null,J.summaryEvidenceSegmentIds?.length?Array.from({length:Math.ceil(J.summaryEvidenceSegmentIds.length/100)},(e,t)=>(0,$.jsxs)(Z,{onClick:()=>void Ce(J.summaryEvidenceSegmentIds.slice(t*100,(t+1)*100)),children:[i?`查看原话`:`View source`,J.summaryEvidenceSegmentIds.length>100?` · ${t+1}`:``]},t)):null,J.keyPointEvidence?.length?(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsx)(`h3`,{children:i?`重点结论`:`Key points`}),J.keyPointEvidence.map(e=>(0,$.jsxs)(`div`,{className:`flex gap-2 text-sm`,children:[(0,$.jsx)(`p`,{className:`flex-1`,children:e.text}),(0,$.jsx)(Z,{onClick:()=>void Ce(e.evidenceSegmentIds,e.evidenceRevision),children:i?`原话`:`Source`})]},e.id))]}):J.keyPoints.length?(0,$.jsxs)(`section`,{className:`space-y-3`,children:[(0,$.jsx)(`h3`,{className:`text-base font-medium`,children:i?`重点结论`:`Key points`}),(0,$.jsx)(`ul`,{className:`list-disc space-y-2 pl-5 text-[15px] leading-7`,children:J.keyPoints.map((e,t)=>(0,$.jsx)(`li`,{children:e},`${t}:${e}`))})]}):null,[...J.decisions,...J.actionItems,...J.risks,...J.openQuestions].some(e=>e.ignored)?(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:ae,onChange:e=>oe(e.target.checked)}),i?`显示已忽略项`:`Show ignored items`]}):null,se.length?(0,$.jsx)(Z,{disabled:ue,onClick:()=>void G(async()=>{for(let e of se)await f(l(`${m}/actions/${encodeURIComponent(e)}/convert`),{method:`POST`,body:JSON.stringify({organizationRevision:q.revision})});ce([])}),children:i?`加入所选 ${se.length} 项任务`:`Add ${se.length} selected tasks`}):null,Te(i?`已决定事项`:`Decisions`,J.decisions,`decisions`),J.actionItems.length?(0,$.jsxs)(`section`,{className:`space-y-3`,children:[(0,$.jsx)(`h3`,{className:`font-semibold`,children:i?`下一步行动`:`Next actions`}),J.actionItems.filter(e=>ae||!e.ignored).map(e=>{let t=g.find(t=>t.actionId===e.id);return(0,$.jsxs)(`article`,{className:`rounded-lg border border-edge-subtle p-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[!t&&!e.ignored&&(!(e.supersededBy||e.disputedBy)||e.reviewedChangeId===(e.supersededBy??e.disputedBy))?(0,$.jsx)(`input`,{type:`checkbox`,"aria-label":`${i?`选择行动`:`Select action`}: ${e.title}`,className:`ui-checkbox`,checked:se.includes(e.id),onChange:t=>ce(t.target.checked?[...se,e.id]:se.filter(t=>t!==e.id))}):null,(0,$.jsxs)(`p`,{className:`flex-1 text-sm font-medium`,children:[e.title,e.supersededBy||e.disputedBy?(0,$.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:i?`有后续变更,请复核`:`Review later changes`}):null,e.editedByUser?(0,$.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:i?e.ignored?`已忽略`:`人工编辑`:e.ignored?`Ignored`:`Edited`}):null]}),(0,$.jsx)(`button`,{className:`text-xs text-fg-muted`,disabled:ue||De,onClick:()=>V({kind:`actionItems`,itemId:e.id,text:e.title,owner:e.owner,dueDate:e.dueDate,ignored:e.ignored}),children:i?`编辑`:`Edit`})]}),(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[e.owner??(i?`负责人未明确`:`Owner unspecified`),` · `,e.dueDate??(i?`期限未明确`:`Date unspecified`)]}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-3 text-xs`,children:[e.evidenceSegmentIds.length?(0,$.jsx)(`button`,{disabled:ue,className:`text-accent-fg`,onClick:()=>void Ce(e.evidenceSegmentIds,e.evidenceRevision),children:i?`查看原话`:`Source`}):null,t?t.deleted?(0,$.jsx)(`span`,{children:i?`关联任务已删除`:`Linked task deleted`}):(0,$.jsx)(o,{className:`text-accent-fg`,to:je(`${r.pathname}${r.search}`,t.taskId),children:t.resolution===`done`?i?`已完成 · 查看任务`:`Done · View task`:i?`查看任务 / 交给助手`:`View task / Delegate`}):e.ignored?null:(0,$.jsx)(Z,{disabled:ue||!!(e.supersededBy||e.disputedBy)&&e.reviewedChangeId!==(e.supersededBy??e.disputedBy),onClick:()=>void G(()=>f(l(`${m}/actions/${encodeURIComponent(e.id)}/convert`),{method:`POST`,body:JSON.stringify({organizationRevision:q.revision})})),children:i?`加入我的任务`:`Add to my tasks`})]})]},e.id)})]}):null,Te(i?`风险`:`Risks`,J.risks,`risks`),Te(i?`尚未确定`:`Open questions`,J.openQuestions,`openQuestions`),J.changes?.length?(0,$.jsxs)(`section`,{className:`space-y-3`,children:[(0,$.jsx)(`h3`,{className:`font-semibold`,children:i?`前后变更`:`Changes during the meeting`}),J.changes.map(e=>{let t=[...J.decisions,...J.actionItems,...J.risks,...J.openQuestions],n=t.find(t=>t.id===e.fromId),r=t.find(t=>t.id===e.toId);return!n||!r?null:(0,$.jsxs)(`article`,{className:`space-y-2 rounded border border-edge p-3 text-sm`,children:[(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.relation===`supersedes`?i?`后续撤销或替代`:`Later superseded`:i?`存在冲突,尚未明确解决`:`Unresolved conflict`}),(0,$.jsx)(`button`,{className:`block text-left text-accent-fg`,onClick:()=>void Ce(n.evidenceSegmentIds,n.evidenceRevision),children:`title`in n?n.title:n.text}),(0,$.jsx)(`span`,{children:`↓`}),(0,$.jsx)(`button`,{className:`block text-left text-accent-fg`,onClick:()=>void Ce(r.evidenceSegmentIds,r.evidenceRevision),children:`title`in r?r.title:r.text})]},`${e.fromId}:${e.toId}`)})]}):null]}):(0,$.jsxs)(`div`,{className:`mx-auto max-w-3xl space-y-4 py-3`,children:[(0,$.jsx)(`h3`,{className:`text-base font-medium`,children:Ee.text?i?`录音摘录`:`From your recording`:i?`笔记正在整理`:`Preparing your note`}),(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-[15px] leading-7 ${Ee.text?`text-fg`:`text-fg-muted`}`,children:Ee.text?Ee.text.slice(0,400)+(Ee.text.length>400?`…`:``):i?`文字整理完成后,重点和行动会出现在这里。`:`Highlights and actions will appear as processing completes.`}),Ee.text?(0,$.jsx)(Z,{className:`min-h-11`,onClick:()=>j(`transcript`),children:i?`查看原文`:`Read transcript`}):null]}):(0,$.jsxs)(`div`,{className:`space-y-4`,children:[ke.slice(0,fe*50).map(e=>(0,$.jsxs)(`article`,{id:`discussion-segment-${e.sequence}`,className:`rounded-md border p-3 ${he.includes(e.sequence)||S.anchor===e.sequence&&S.anchorRevision===Ee.revision?`border-accent`:`border-edge-subtle`}`,children:[(0,$.jsxs)(`div`,{className:`mb-2 flex items-center gap-3 text-xs text-fg-muted`,children:[(0,$.jsxs)(`button`,{className:`inline-flex items-center gap-1 text-accent-fg`,disabled:!K.audioAttachmentId||!!K.audioDeletedAt,onClick:()=>void Ce([e.sequence],Ee.revision,!0),children:[(0,$.jsx)(Pe,{className:`size-3`}),Rt(e.startedAtMs)]}),e.status===`confirmed`?(0,$.jsx)(`button`,{onClick:()=>void we(e),children:i?`标记此段`:`Highlight segment`}):null,(0,$.jsx)(`span`,{children:e.speakerLabel??(i?`未区分说话人`:`Speaker unknown`)}),Oe&&e.status===`confirmed`?(0,$.jsx)(`button`,{className:`ml-auto`,onClick:()=>re({segment:e,text:e.displayText??e.rawText??``,speaker:e.speakerLabel??``}),children:i?`校对`:`Edit`}):null]}),(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-6`,children:e.displayText??e.rawText??(i?`等待转写`:`Awaiting transcription`)})]},e.sequence)),ke.length>fe*50?(0,$.jsx)(Z,{onClick:()=>pe(fe+1),children:i?`加载更多`:`More`}):null]})}),(0,$.jsx)(`div`,{children:(0,$.jsx)(At,{id:K.id,query:N.trim(),zh:i,sourceKey:`${K.audioSha256}:${K.audioDeletedAt}`,active:De||K.status===`recording`,tab:k,refreshKey:`${K.updatedAt}:${Ee.revision}:${q?.revision}`,onEvidence:Se,onPlay:xe},K.id)})]}),K.audioAttachmentId&&!K.audioDeletedAt?(0,$.jsx)(`footer`,{className:`shrink-0 border-t border-edge-subtle p-3`,children:(0,$.jsx)(`audio`,{ref:U,controls:!0,preload:`metadata`,className:`h-10 w-full`,src:l(`${m}/audio`),onTimeUpdate:()=>{let t=(U.current?.currentTime??0)*1e3;be(t),D(e,{positionMs:t}),me.current!==null&&t>=me.current&&(U.current?.pause(),me.current=null)},onLoadedMetadata:()=>{W.current!==null&&U.current?(U.current.currentTime=W.current,W.current=null,U.current.play().catch(()=>void 0)):U.current&&(U.current.currentTime=S.positionMs/1e3)},onError:()=>le(i?`录音暂不可播放`:`Recording unavailable`)})}):null,L?(0,$.jsxs)(`aside`,{"aria-label":i?`原话证据`:`Source evidence`,className:`absolute inset-y-0 right-0 z-10 flex w-[min(26rem,100%)] flex-col border-l border-edge bg-surface-overlay`,children:[(0,$.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b border-edge p-4`,children:[(0,$.jsxs)(`h3`,{children:[i?`原话证据`:`Source evidence`,` · v`,L.transcriptRevision]}),(0,$.jsx)(`button`,{"aria-label":i?`关闭`:`Close`,onClick:()=>R(null),children:(0,$.jsx)(X,{className:`size-4`})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-4`,children:[(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i?`按整段定位,不代表词句级时间。`:`Segment timing; not word-level alignment.`}),L.stale?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i?`原文已更新,以下保留当时版本的依据。`:`Transcript updated; showing the original evidence revision.`}):null,!L.audioAvailable||!L.timingVerified?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i?`原文仍可查看;原音不可用或时间定位待核实。`:`Text remains available; audio is missing or timing is unverified.`}):null,L.segments.map(t=>(0,$.jsxs)(`article`,{className:`space-y-2 rounded border border-edge p-3`,children:[(0,$.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[Rt(t.startedAtMs),`–`,Rt(t.endedAtMs),` · `,t.speakerLabel??(i?`说话人未明确`:`Unknown speaker`)]}),(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-7`,children:t.text}),t.playback.map((e,t)=>(0,$.jsxs)(Z,{onClick:()=>xe(e.startedAtMs,e.endedAtMs),children:[i?`播放原话`:`Play source`,` `,Rt(e.startedAtMs),`–`,Rt(e.endedAtMs)]},t)),L.stale?null:(0,$.jsx)(Z,{onClick:()=>{P(``),pe(Math.max(fe,Math.ceil((Ee.segments.findIndex(e=>e.sequence===t.sequence)+1)/50))),j(`transcript`),ge([t.sequence]),R(null),D(e,{anchor:t.sequence,anchorRevision:Ee.revision}),window.setTimeout(()=>document.getElementById(`discussion-segment-${t.sequence}`)?.scrollIntoView?.({block:`center`}),0)},children:i?`定位原文`:`Locate transcript`})]},t.sequence))]})]}):null,B&&q?(0,$.jsx)(It,{initial:B,zh:i,busy:ue,onClose:()=>V(null),onSave:e=>G(async()=>{await f(l(`${m}/summary`),{method:`PATCH`,body:JSON.stringify({...e,expectedRevision:q.revision})}),V(null)})},`${B.kind}:${B.itemId}:${q.revision}`):null,z?(0,$.jsx)(x,{open:!0,onOpenChange:e=>{e||re(null)},children:(0,$.jsxs)(v,{children:[(0,$.jsx)(h,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(y,{"aria-describedby":void 0,className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[71] flex h-[min(28rem,90dvh)] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay`,children:[(0,$.jsxs)(`header`,{className:`flex items-center justify-between border-b border-edge p-4`,children:[(0,$.jsx)(b,{children:i?`校对逐字稿`:`Edit transcript`}),(0,$.jsx)(`button`,{"aria-label":i?`关闭校对`:`Close editor`,onClick:()=>re(null),children:(0,$.jsx)(X,{className:`size-4`})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-3 overflow-y-auto p-4`,children:[(0,$.jsxs)(`label`,{className:`block text-xs`,children:[i?`本段说话人`:`Speaker for this segment`,(0,$.jsx)(`input`,{className:`mt-1 w-full rounded border border-edge bg-surface-inset p-2 text-sm`,value:z.speaker,onChange:e=>re({...z,speaker:e.target.value})})]}),z.segment.speakerLabel?(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:!!z.applyToSpeakerGroup,onChange:e=>re({...z,applyToSpeakerGroup:e.target.checked})}),i?`同时更名所有同标签片段;输入已有标签可合并说话人`:`Rename all segments with this label; use an existing label to merge speakers`]}):null,(0,$.jsx)(`textarea`,{className:`min-h-32 w-full rounded border border-edge bg-surface-inset p-2 text-sm`,value:z.text,onChange:e=>re({...z,text:e.target.value})})]}),(0,$.jsx)(`footer`,{className:`border-t border-edge p-3`,children:(0,$.jsxs)(Z,{variant:`primary`,disabled:ue||!z.text.trim(),onClick:()=>void G(async()=>{await f(l(`${m}/segments/${z.segment.sequence}`),{method:`PATCH`,body:JSON.stringify({displayText:z.text,speakerLabel:z.speaker,expectedRevision:z.segment.revision,applyToSpeakerGroup:z.applyToSpeakerGroup,expectedTranscriptRevision:Ee.revision})}),re(null)}),children:[(0,$.jsx)(ie,{className:`size-4`}),i?`保存修订`:`Save revision`]})})]})]})}):null]})}var Bt={edit:Ne,ai_edit:Le,sync:Fe,restore:S};function Vt(e,t){return{edit:t.triggerEdit,ai_edit:t.triggerAiEdit,sync:t.triggerSync,restore:t.triggerRestore}[e]??e}function Ht({noteId:e,activeTimestamp:t,onSelect:n,onClose:r,onRestored:i}){let a=d(e=>e.language),o=m(a).notes,s={justNow:o.justNow,minutesAgo:o.minutesAgo,today:o.today,yesterday:o.yesterday,daysAgo:o.daysAgo,locale:c(a)},{data:l}=Ue(e?[`note-history`,e]:null,()=>Ce(e)),[u,f]=(0,Q.useState)(!1),[p,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(null),v=(0,Q.useCallback)(async t=>{f(!0),_(null);try{await W(e,t),h(null),i()}catch{_(o.restoreFailed)}finally{f(!1)}},[e,o.restoreSuccess,o.restoreFailed,i]),y=Date.now();return(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,$.jsx)(me,{className:`size-4`,"aria-hidden":!0}),o.history]}),(0,$.jsx)(`button`,{type:`button`,onClick:r,className:`rounded-lg p-1 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:(0,$.jsx)(X,{className:`size-4`,"aria-hidden":!0})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[g?(0,$.jsx)(`p`,{className:`border-b border-danger/20 bg-danger-soft px-4 py-2 text-xs text-danger`,role:`alert`,children:g}):null,l?.length?(0,$.jsx)(`ul`,{className:`divide-y divide-edge`,children:l.map(e=>{let r=Bt[e.trigger]??Ne,i=t===e.timestamp,a=p===e.timestamp;return(0,$.jsxs)(`li`,{children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:Be(`w-full px-4 py-3 text-left transition-colors`,i?`bg-accent/10`:`hover:bg-surface-hover`),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(r,{className:`size-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:Vt(e.trigger,o)}),(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:xt(e.timestamp,y,s)})]}),e.snippet&&(0,$.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted/60`,children:e.snippet})]}),i&&(0,$.jsx)(`div`,{className:`border-t border-edge/50 px-4 py-2`,children:a?(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs text-fg-muted`,children:o.restoreConfirm}),(0,$.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),v(e.timestamp)},disabled:u,className:`shrink-0 rounded-lg bg-accent px-3 py-1 text-xs font-medium text-on-accent transition-colors hover:bg-accent/90 disabled:opacity-50`,children:u?`...`:o.restore}),(0,$.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),h(null)},className:`shrink-0 rounded-lg px-2 py-1 text-xs text-fg-muted hover:bg-surface-hover`,children:`Cancel`})]}):(0,$.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),h(e.timestamp)},className:`rounded-lg bg-surface-hover px-3 py-1 text-xs font-medium text-fg transition-colors hover:bg-accent hover:text-on-accent`,children:o.restore})})]},e.timestamp)})}):(0,$.jsxs)(`div`,{className:`px-4 py-8 text-center`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:o.historyEmpty}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted/60`,children:o.historyEmptyDescription})]})]})]})}function Ut({noteId:e,note:t,catalyzing:n,onCatalyze:r,onClose:i,noteThreads:a,openingChat:o,onOpenChat:c,onOpenNewChat:l}){let u=m(d(e=>e.language)).notes,f=s(),p=t?.aiDeep?.catalysis,h=p?.report??null,[g,_]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(!1),{data:b,mutate:x,isLoading:S}=Ue(e?[`note-agent-context-status`,e]:null,()=>Te(e),{revalidateOnFocus:!1}),C=(0,Q.useCallback)(async()=>{if(!v){y(!0),_(null);try{await x(()=>ke(e),{revalidate:!1})}catch(e){_(`${u.contextRebuildFailed}: ${e instanceof Error?e.message:u.quickCaptureFailedHint}`)}finally{y(!1)}}},[v,x,u.contextRebuildFailed,u.quickCaptureFailedHint,e]),w=(0,Q.useCallback)(async t=>{try{await U(e,t)}catch{}},[e]);return(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Le,{className:`size-4 text-accent`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:u.catalysisSectionTitle})]}),(0,$.jsx)(`button`,{type:`button`,onClick:i,"aria-label":u.lightboxClose,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:(0,$.jsx)(N,{className:`size-4 rotate-180`,"aria-hidden":!0})})]}),(0,$.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:[(0,$.jsx)(`p`,{className:`mb-4 text-xs leading-relaxed text-fg-muted`,children:u.catalysisSectionDescription}),b?(0,$.jsxs)(`section`,{className:`mb-4 rounded-xl bg-surface-base p-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.contextStatusTitle}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void C(),disabled:S||v,className:`rounded-md px-1.5 py-0.5 text-[11px] font-medium text-accent transition-colors hover:bg-accent/10 disabled:cursor-not-allowed disabled:opacity-50`,children:v?u.processing:u.contextRebuild}),(0,$.jsx)(`span`,{className:Be(`rounded-full px-2 py-0.5 text-[11px] font-medium`,b.status===`ready`?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-300`:b.status===`partial`?`bg-amber-500/10 text-amber-600 dark:text-amber-300`:`bg-red-500/10 text-red-600 dark:text-red-300`),children:b.status})]}),(0,$.jsx)(`div`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:u.contextStatusDetail.replace(`{{attachments}}`,String(b.attachments.length)).replace(`{{tokens}}`,String(b.tokenEstimate??0))}),g?(0,$.jsx)(`p`,{className:`mt-3 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:g}):null,b.attachments.length>0?(0,$.jsx)(`div`,{className:`mt-3 space-y-1.5`,children:b.attachments.slice(0,5).map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-lg bg-surface-hover px-2 py-1.5 text-xs`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.fileName}),(0,$.jsx)(`span`,{className:`shrink-0 text-fg-muted`,children:e.status})]},e.attachmentId))}):null]}):null,(0,$.jsx)(`button`,{type:`button`,onClick:r,disabled:n,className:`w-full rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-on-accent transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:n?u.processing:h?u.recatalyze:u.catalyzeAction}),h?(0,$.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.valueHypothesis}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg`,children:h.valueHypothesis})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.targetUsers}),(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:h.targetUsers.slice(0,5).map(e=>(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg`,children:e},e))})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.keyQuestions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:h.keyQuestions.slice(0,3).map(e=>(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-accent`}),(0,$.jsx)(`span`,{children:e})]},e))})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.mvpPathLabel}),(0,$.jsx)(`ol`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:h.mvpPath.slice(0,3).map((e,t)=>(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsxs)(`span`,{className:`text-fg-muted`,children:[t+1,`.`]}),(0,$.jsx)(`span`,{children:e})]},e))})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.risks}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:h.risks.slice(0,3).map(e=>(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-fg-muted`}),(0,$.jsx)(`span`,{children:e})]},e))})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.nextActions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:h.nextActions.slice(0,4).map(e=>(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`rounded bg-accent/10 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-accent`,children:e.kind}),(0,$.jsx)(`span`,{children:e.text})]},`${e.kind}:${e.text}`))})]}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:u.confidenceLabel.replace(`{{percent}}`,String(Math.round(h.confidence*100)))}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>void w(`helpful`),className:Be(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,p?.feedback===`helpful`&&`bg-accent/10 text-accent`),"aria-label":u.feedbackHelpfulAria,children:(0,$.jsx)(I,{className:`size-3.5`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void w(`not_helpful`),className:Be(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,p?.feedback===`not_helpful`&&`bg-accent/10 text-accent`),"aria-label":u.feedbackNotHelpfulAria,children:(0,$.jsx)(B,{className:`size-3.5`,"aria-hidden":!0})})]})]})]}):(0,$.jsx)(`div`,{className:`mt-4 rounded-lg border border-dashed border-edge-subtle px-3 py-6 text-center text-sm text-fg-muted`,children:u.noCatalysisReportHint}),(0,$.jsxs)(`section`,{className:`mt-6 rounded-xl bg-surface-base p-4`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,$.jsx)(Me,{className:`size-4 text-accent`,"aria-hidden":!0}),u.relatedThreadsTitle]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:u.relatedThreadsDescription})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:c,disabled:o,className:`rounded-lg border border-edge px-2.5 py-1.5 text-xs font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`,children:o?u.openingChat:u.openThread}),(0,$.jsx)(`button`,{type:`button`,onClick:l,disabled:o,className:`rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-on-accent transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:u.newThread})]})]}),a.length>0?(0,$.jsx)(`div`,{className:`space-y-2`,children:a.slice(0,5).map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>f(`/chat/${encodeURIComponent(e.key)}`),className:`w-full rounded-lg border border-edge-subtle px-3 py-2 text-left transition-colors hover:bg-surface-hover`,children:[(0,$.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.name||u.noteDiscussionFallback}),(0,$.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:u.messageCount.replace(`{{count}}`,String(e.messageCount??0))})]},e.key))}):(0,$.jsx)(`div`,{className:`rounded-lg border border-dashed border-edge-subtle px-3 py-5 text-center text-sm text-fg-muted`,children:u.noThreads})]})]})]})}var Wt=[{value:`86400000`,zh:`24 小时`,en:`24 hours`},{value:`604800000`,zh:`7 天`,en:`7 days`},{value:`2592000000`,zh:`30 天`,en:`30 days`}];function Gt({open:e,onOpenChange:t,note:n}){let r=d(e=>e.language)===`zh`,i=r?Yt:Xt,{data:a,mutate:o}=Ue(e?[`note-shares`,n.id]:null,()=>K(n.id)),s=Ue(e?`hosted-share-auth-status`:null,nt),c=s.data===!0,l=Ue(e&&c?`hosted-publication-capabilities`:null,it),u=l.data?.publishing.allowed===!0,f=Ue(e&&c?[`hosted-note-publications`,n.id]:null,()=>Se(n.id)),[p,m]=(0,Q.useState)(new Set),[S,C]=(0,Q.useState)(`86400000`),[w,T]=(0,Q.useState)(``),[E,D]=(0,Q.useState)(``),[O,k]=(0,Q.useState)(`hosted`),[A,j]=(0,Q.useState)(!1),[M,N]=(0,Q.useState)(null),[P,F]=(0,Q.useState)(null),[te,I]=(0,Q.useState)(!1),[ne,L]=(0,Q.useState)(null),R=(0,Q.useMemo)(()=>{let e=new Set;return n.markdown.replace(/xopc-attachment:\/\/notes\/([^/]+)\/([^\s)]+)/gi,(t,r,i)=>{try{decodeURIComponent(r)===n.id&&e.add(decodeURIComponent(i))}catch{}return t}),(n.attachments??[]).filter(t=>e.has(t.id))},[n.attachments,n.id,n.markdown]);(0,Q.useEffect)(()=>{e&&(m(new Set(R.map(e=>e.id))),F(null),I(!1),L(null))},[e,R]);let z=async()=>{j(!0),L(null);try{let e={expectedNoteVersion:n.updatedAt,attachmentIds:[...p],ttlMs:Number(S),maxViews:w.trim()?Number(w):null,description:E.trim()||void 0};if(O===`hosted`){let t=await q(n.id,e);F(t.shareUrl),await f.mutate()}else{let t=await G(n.id,e);F(t.payload.shareUrl),await o()}}catch(e){L(e instanceof Error?e.message:String(e))}finally{j(!1)}},re=async(e,t)=>{N(e.id),L(null);try{t===`refresh`?await he(n.id,e.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[...p]}):await at(e.id),await f.mutate()}catch(e){L(e instanceof Error?e.message:String(e))}finally{N(null)}},B=async(e,t)=>{N(e.id),L(null);try{t===`refresh`?await Oe(n.id,e.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[...p]}):t===`extend`?await rt(e.id,864e5):await tt(e.id),await o()}catch(e){L(e instanceof Error?e.message:String(e))}finally{N(null)}},V=async e=>{L(null);try{if(!await Je(e)){I(!1),L(i.copyFailed);return}I(!0),window.setTimeout(()=>I(!1),1500)}catch{I(!1),L(i.copyFailed)}};return(0,$.jsx)(x,{open:e,onOpenChange:t,children:(0,$.jsxs)(v,{children:[(0,$.jsx)(h,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(y,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[71] flex h-[min(42rem,calc(100dvh-2rem))] w-[min(40rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-popover outline-none`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between border-b border-edge px-5 py-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(b,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[(0,$.jsx)(ee,{className:`size-4`}),i.title]}),(0,$.jsx)(g,{className:`mt-1 text-xs text-fg-muted`,children:i.description})]}),(0,$.jsx)(_,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-fg-muted hover:bg-surface-hover`,"aria-label":i.close,children:(0,$.jsx)(X,{className:`size-4`})})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,$.jsxs)(`section`,{className:`rounded-lg border border-edge bg-surface-inset p-4`,children:[(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n.title||i.untitled}),(0,$.jsx)(`p`,{className:`mt-2 line-clamp-4 whitespace-pre-wrap text-xs leading-5 text-fg-muted`,children:n.markdown||i.empty}),(0,$.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:i.privateExcluded})]}),R.length>0?(0,$.jsxs)(`section`,{className:`mt-5`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.attachments}),(0,$.jsx)(`div`,{className:`mt-2 grid gap-2`,children:R.map(e=>(0,$.jsxs)(`label`,{className:`flex items-center gap-3 rounded-lg border border-edge-subtle px-3 py-2 text-sm text-fg-muted`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:p.has(e.id),onChange:()=>m(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n}),className:`accent-accent`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.fileName}),(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:Jt(e.size)})]},e.id))})]}):null,(0,$.jsxs)(`section`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted sm:col-span-2`,children:[i.delivery,(0,$.jsxs)(ae,{value:O,onChange:e=>k(e.target.value),children:[(0,$.jsx)(oe,{value:`hosted`,children:i.deliveryHosted}),(0,$.jsx)(oe,{value:`local`,children:i.deliveryLocal})]})]}),O===`hosted`&&s.data===!1?(0,$.jsx)(`div`,{className:`sm:col-span-2`,children:(0,$.jsx)(ft,{providerId:`xopc-share`,displayName:`XOPC Hosted Share`,connected:!1,onConnected:()=>void s.mutate(!0,{revalidate:!1})})}):null,O===`hosted`&&c&&l.data&&!u?(0,$.jsx)(`p`,{className:`rounded-lg border border-warning/30 bg-warning-soft px-3 py-2 text-xs text-warning sm:col-span-2`,children:i.hostedDisabled}):null,(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[i.expires,(0,$.jsx)(ae,{value:S,onChange:e=>C(e.target.value),children:Wt.map(e=>(0,$.jsx)(oe,{value:e.value,children:r?e.zh:e.en},e.value))})]}),(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[i.maxViews,(0,$.jsx)(`input`,{type:`number`,min:1,max:1e3,value:w,onChange:e=>T(e.target.value),placeholder:i.unlimited,className:`h-9 rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent`})]}),(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted sm:col-span-2`,children:[i.publicDescription,(0,$.jsx)(`input`,{value:E,onChange:e=>D(e.target.value),className:`h-9 rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent`})]})]}),P?(0,$.jsx)(`div`,{className:`mt-5 rounded-lg border border-success/25 bg-success-soft p-3`,children:(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsx)(`input`,{readOnly:!0,value:P,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none`}),(0,$.jsxs)(Z,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void V(P),children:[te?(0,$.jsx)(ie,{className:`size-4`}):(0,$.jsx)(H,{className:`size-4`}),te?i.copied:i.copy]}),(0,$.jsxs)(Z,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>window.open(P,`_blank`,`noopener,noreferrer`),children:[(0,$.jsx)(de,{className:`size-4`}),i.open]})]})}):null,ne?(0,$.jsx)(`p`,{className:`mt-4 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,children:ne}):null,(a?.items.length??0)>0?(0,$.jsxs)(`section`,{className:`mt-6 border-t border-edge pt-5`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.activeLinks}),(0,$.jsx)(`div`,{className:`mt-2 grid gap-2`,children:a.items.map(e=>(0,$.jsx)(qt,{share:e,busy:M===e.id,t:i,onCopy:V,onAction:B},e.id))})]}):null,(f.data?.length??0)>0?(0,$.jsxs)(`section`,{className:`mt-6 border-t border-edge pt-5`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.hostedLinks}),(0,$.jsx)(`div`,{className:`mt-2 grid gap-2`,children:f.data.map(e=>(0,$.jsx)(Kt,{publication:e,stale:e.source?.version!==String(n.updatedAt),busy:M===e.id,publishingAllowed:u,t:i,onCopy:V,onAction:re},e.id))})]}):null]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-2 border-t border-edge px-5 py-3`,children:[(0,$.jsx)(_,{asChild:!0,children:(0,$.jsx)(Z,{type:`button`,variant:`ghost`,children:i.close})}),(0,$.jsxs)(Z,{type:`button`,onClick:()=>void z(),disabled:A||O===`hosted`&&(!c||!u),children:[A?(0,$.jsx)(Ae,{className:`size-4 animate-spin`}):(0,$.jsx)(ee,{className:`size-4`}),A?i.creating:i.create]})]})]})]})})}function Kt(e){let t=(0,gt.c)(64),{publication:n,stale:r,busy:i,publishingAllowed:a,t:o,onCopy:s,onAction:c}=e,l=n.revoked||n.expired,u=l&&`opacity-60`,d;t[0]===u?d=t[1]:(d=Be(`rounded-lg border border-edge-subtle p-3`,u),t[0]=u,t[1]=d);let f=r&&!l?o.stale:l?o.inactive:o.active,p;t[2]===f?p=t[3]:(p=(0,$.jsx)(`span`,{children:f}),t[2]=f,t[3]=p);let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(`span`,{children:`·`}),t[4]=m):m=t[4];let h=n.maxViews===null?``:` / ${n.maxViews}`,g;t[5]!==n.viewCount||t[6]!==o.views||t[7]!==h?(g=(0,$.jsxs)(`span`,{children:[o.views,` `,n.viewCount,h]}),t[5]=n.viewCount,t[6]=o.views,t[7]=h,t[8]=g):g=t[8];let _;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(`span`,{children:`·`}),t[9]=_):_=t[9];let v;t[10]!==n.revision||t[11]!==o.revision?(v=(0,$.jsxs)(`span`,{children:[o.revision,` `,n.revision]}),t[10]=n.revision,t[11]=o.revision,t[12]=v):v=t[12];let y;t[13]!==p||t[14]!==g||t[15]!==v?(y=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[p,m,g,_,v]}),t[13]=p,t[14]=g,t[15]=v,t[16]=y):y=t[16];let b;t[17]===n.shareUrl?b=t[18]:(b=(0,$.jsx)(`div`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.shareUrl}),t[17]=n.shareUrl,t[18]=b);let x;t[19]!==y||t[20]!==b?(x=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[y,b]}),t[19]=y,t[20]=b,t[21]=x):x=t[21];let S;t[22]===i?S=t[23]:(S=i?(0,$.jsx)(Ae,{className:`size-4 animate-spin text-fg-muted`}):null,t[22]=i,t[23]=S);let C;t[24]!==x||t[25]!==S?(C=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[x,S]}),t[24]=x,t[25]=S,t[26]=C):C=t[26];let w=!a,T;t[27]!==s||t[28]!==n.shareUrl?(T=()=>void s(n.shareUrl),t[27]=s,t[28]=n.shareUrl,t[29]=T):T=t[29];let E;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(H,{className:`size-3.5`}),t[30]=E):E=t[30];let D;t[31]!==o.copy||t[32]!==w||t[33]!==T?(D=(0,$.jsxs)(Z,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:w,onClick:T,children:[E,o.copy]}),t[31]=o.copy,t[32]=w,t[33]=T,t[34]=D):D=t[34];let O=!a,k;t[35]===n.shareUrl?k=t[36]:(k=()=>window.open(n.shareUrl,`_blank`,`noopener,noreferrer`),t[35]=n.shareUrl,t[36]=k);let A;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(de,{className:`size-3.5`}),t[37]=A):A=t[37];let j;t[38]!==o.open||t[39]!==O||t[40]!==k?(j=(0,$.jsxs)(Z,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:O,onClick:k,children:[A,o.open]}),t[38]=o.open,t[39]=O,t[40]=k,t[41]=j):j=t[41];let M;t[42]!==i||t[43]!==l||t[44]!==c||t[45]!==n||t[46]!==a||t[47]!==r||t[48]!==o.refresh?(M=r&&!l?(0,$.jsxs)(Z,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:i||!a,onClick:()=>void c(n,`refresh`),children:[(0,$.jsx)(Fe,{className:`size-3.5`}),o.refresh]}):null,t[42]=i,t[43]=l,t[44]=c,t[45]=n,t[46]=a,t[47]=r,t[48]=o.refresh,t[49]=M):M=t[49];let N;t[50]!==i||t[51]!==c||t[52]!==n||t[53]!==o.revoke?(N=n.revoked?null:(0,$.jsxs)(Z,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:i,onClick:()=>void c(n,`revoke`),children:[(0,$.jsx)(ze,{className:`size-3.5`}),o.revoke]}),t[50]=i,t[51]=c,t[52]=n,t[53]=o.revoke,t[54]=N):N=t[54];let P;t[55]!==D||t[56]!==j||t[57]!==M||t[58]!==N?(P=(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[D,j,M,N]}),t[55]=D,t[56]=j,t[57]=M,t[58]=N,t[59]=P):P=t[59];let F;return t[60]!==C||t[61]!==d||t[62]!==P?(F=(0,$.jsxs)(`div`,{className:d,children:[C,P]}),t[60]=C,t[61]=d,t[62]=P,t[63]=F):F=t[63],F}function qt(e){let t=(0,gt.c)(68),{share:n,busy:r,t:i,onCopy:a,onAction:o}=e,s=n.revoked||n.expired,c=s&&`opacity-60`,l;t[0]===c?l=t[1]:(l=Be(`rounded-lg border border-edge-subtle p-3`,c),t[0]=c,t[1]=l);let u=n.stale&&!s?i.stale:s?i.inactive:i.active,d;t[2]===u?d=t[3]:(d=(0,$.jsx)(`span`,{children:u}),t[2]=u,t[3]=d);let f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(`span`,{children:`·`}),t[4]=f):f=t[4];let p=n.maxViews===null?``:` / ${n.maxViews}`,m;t[5]!==n.viewCount||t[6]!==i.views||t[7]!==p?(m=(0,$.jsxs)(`span`,{children:[i.views,` `,n.viewCount,p]}),t[5]=n.viewCount,t[6]=i.views,t[7]=p,t[8]=m):m=t[8];let h;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(`span`,{children:`·`}),t[9]=h):h=t[9];let g;t[10]===n.expiresAt?g=t[11]:(g=new Date(n.expiresAt).toLocaleDateString(),t[10]=n.expiresAt,t[11]=g);let _;t[12]===g?_=t[13]:(_=(0,$.jsx)(`span`,{children:g}),t[12]=g,t[13]=_);let v;t[14]!==_||t[15]!==d||t[16]!==m?(v=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[d,f,m,h,_]}),t[14]=_,t[15]=d,t[16]=m,t[17]=v):v=t[17];let y;t[18]===n.shareUrl?y=t[19]:(y=(0,$.jsx)(`div`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.shareUrl}),t[18]=n.shareUrl,t[19]=y);let b;t[20]!==v||t[21]!==y?(b=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[v,y]}),t[20]=v,t[21]=y,t[22]=b):b=t[22];let x;t[23]===r?x=t[24]:(x=r?(0,$.jsx)(Ae,{className:`size-4 animate-spin text-fg-muted`}):null,t[23]=r,t[24]=x);let S;t[25]!==b||t[26]!==x?(S=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[b,x]}),t[25]=b,t[26]=x,t[27]=S):S=t[27];let C;t[28]!==a||t[29]!==n.shareUrl?(C=()=>void a(n.shareUrl),t[28]=a,t[29]=n.shareUrl,t[30]=C):C=t[30];let w;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(H,{className:`size-3.5`}),t[31]=w):w=t[31];let T;t[32]!==i.copy||t[33]!==C?(T=(0,$.jsxs)(Z,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:C,children:[w,i.copy]}),t[32]=i.copy,t[33]=C,t[34]=T):T=t[34];let E;t[35]===n.shareUrl?E=t[36]:(E=()=>window.open(n.shareUrl,`_blank`,`noopener,noreferrer`),t[35]=n.shareUrl,t[36]=E);let D;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,$.jsx)(de,{className:`size-3.5`}),t[37]=D):D=t[37];let O;t[38]!==i.open||t[39]!==E?(O=(0,$.jsxs)(Z,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:E,children:[D,i.open]}),t[38]=i.open,t[39]=E,t[40]=O):O=t[40];let k;t[41]!==r||t[42]!==s||t[43]!==o||t[44]!==n||t[45]!==i.refresh?(k=n.stale&&!s?(0,$.jsxs)(Z,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`refresh`),children:[(0,$.jsx)(Fe,{className:`size-3.5`}),i.refresh]}):null,t[41]=r,t[42]=s,t[43]=o,t[44]=n,t[45]=i.refresh,t[46]=k):k=t[46];let A;t[47]!==r||t[48]!==s||t[49]!==o||t[50]!==n||t[51]!==i.extend?(A=s?null:(0,$.jsx)(Z,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`extend`),children:i.extend}),t[47]=r,t[48]=s,t[49]=o,t[50]=n,t[51]=i.extend,t[52]=A):A=t[52];let j;t[53]!==r||t[54]!==o||t[55]!==n||t[56]!==i.revoke?(j=n.revoked?null:(0,$.jsxs)(Z,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`revoke`),children:[(0,$.jsx)(ze,{className:`size-3.5`}),i.revoke]}),t[53]=r,t[54]=o,t[55]=n,t[56]=i.revoke,t[57]=j):j=t[57];let M;t[58]!==T||t[59]!==O||t[60]!==k||t[61]!==A||t[62]!==j?(M=(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[T,O,k,A,j]}),t[58]=T,t[59]=O,t[60]=k,t[61]=A,t[62]=j,t[63]=M):M=t[63];let N;return t[64]!==S||t[65]!==l||t[66]!==M?(N=(0,$.jsxs)(`div`,{className:l,children:[S,M]}),t[64]=S,t[65]=l,t[66]=M,t[67]=N):N=t[67],N}function Jt(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}var Yt={title:`分享笔记`,description:`创建一个无需登录即可查看的只读快照。`,close:`关闭`,untitled:`无标题笔记`,empty:`空笔记`,privateExcluded:`不会分享标签、AI 元数据、项目、讨论、历史版本或未引用附件。`,attachments:`包含的附件`,expires:`有效期`,maxViews:`最多查看次数`,unlimited:`不限`,publicDescription:`公开说明(可选)`,create:`创建分享链接`,creating:`创建中…`,copy:`复制`,copied:`已复制`,open:`打开`,activeLinks:`这条笔记的分享`,copyFailed:`无法复制到剪贴板,请手动选择链接并复制。`,delivery:`发布方式`,deliveryHosted:`平台托管(外网稳定访问)`,deliveryLocal:`本机直连(需要隧道或公网部署)`,hostedLinks:`平台托管发布`,revision:`版本`,hostedDisabled:`管理员已暂停你的公网分享能力。已有托管链接当前不可访问,但仍可撤销。`,stale:`旧版本`,inactive:`已失效`,active:`有效`,views:`查看`,refresh:`更新快照`,extend:`延长 24 小时`,revoke:`撤销`},Xt={title:`Share Note`,description:`Create a read-only snapshot that opens without sign-in.`,close:`Close`,untitled:`Untitled Note`,empty:`Empty Note`,privateExcluded:`Tags, AI metadata, projects, discussions, history, and unreferenced attachments are excluded.`,attachments:`Included attachments`,expires:`Expires`,maxViews:`Maximum views`,unlimited:`Unlimited`,publicDescription:`Public description (optional)`,create:`Create share link`,creating:`Creating…`,copy:`Copy`,copied:`Copied`,open:`Open`,activeLinks:`Shares for this Note`,copyFailed:`Could not copy to the clipboard. Select the link and copy it manually.`,delivery:`Publishing method`,deliveryHosted:`Hosted platform (stable public access)`,deliveryLocal:`Direct from this device (requires public access)`,hostedLinks:`Hosted publications`,revision:`Revision`,hostedDisabled:`An administrator has paused public sharing for your account. Existing hosted links are unavailable, but can still be revoked.`,stale:`Older version`,inactive:`Inactive`,active:`Active`,views:`Views`,refresh:`Update snapshot`,extend:`Extend 24 hours`,revoke:`Revoke`};function Zt(e){let t=(0,gt.c)(18),{input:n,labels:r,showLabel:i}=e,a=i===void 0||i,o;t[0]===n?o=t[1]:(o=n(),t[0]=n,t[1]=o);let s=o.source.id,c;t[2]===s?c=t[3]:(c=e=>e.source?.type===`note`&&e.source.id===s&&e.status!==`idle`,t[2]=s,t[3]=c);let l=L(c),u;t[4]===s?u=t[5]:(u=e=>e.source?.type===`note`&&e.source.id===s&&e.status===`preparing`,t[4]=s,t[5]=u);let d=L(u),f=L(Qt),p;t[6]!==n||t[7]!==r||t[8]!==d||t[9]!==a?(p=(0,$.jsx)(P,{input:n,labels:r,disabled:d,showLabel:a}),t[6]=n,t[7]=r,t[8]=d,t[9]=a,t[10]=p):p=t[10];let m;t[11]!==l||t[12]!==r||t[13]!==f?(m=l?(0,$.jsx)(`button`,{type:`button`,onClick:f,title:r.stop,"aria-label":r.stop,className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:(0,$.jsx)(Y,{className:`size-3.5`,"aria-hidden":!0})}):null,t[11]=l,t[12]=r,t[13]=f,t[14]=m):m=t[14];let h;return t[15]!==p||t[16]!==m?(h=(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[p,m]}),t[15]=p,t[16]=m,t[17]=h):h=t[17],h}function Qt(e){return e.stop}function $t(e,t){let n=z(t.replace(/^\s*(`{3,}|~{3,})[^\n]*$/gm,``).replace(/xopc-attachment:\/\/[^\s)]+/g,``).replace(/^(\s*[-*+]\s+)\[[ xX]\]\s*/gm,`$1`)),r=z(e);return!r||n.split(`
3
3
  `)[0]===r?n:[r,n].filter(Boolean).join(`
4
4
 
5
- `)}var en=()=>i(()=>import(`./block-editor-CB6KruU-.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44])),tn=()=>i(()=>import(`./markdown-editor-BuuGlcfG.js`),__vite__mapDeps([45,1,2,41,46,16])),nn=(0,Q.lazy)(()=>en().then(e=>({default:e.BlockEditor}))),rn=(0,Q.lazy)(()=>tn().then(e=>({default:e.MarkdownEditor})));function an(){let e=(0,gt.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col px-6 py-4`,"aria-busy":!0,children:[(0,$.jsx)(`div`,{className:`h-8 w-56 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-6 h-4 w-11/12 animate-pulse rounded bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-3 h-4 w-9/12 animate-pulse rounded bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-3 h-4 w-10/12 animate-pulse rounded bg-surface-hover`})]}),e[0]=t):t=e[0],t}function on(e){let t=(0,gt.c)(29),{mode:n,onModeChange:r,labels:i}=e,a;t[0]===i.edit?a=t[1]:(a={id:`wysiwyg`,label:i.edit,Icon:pe},t[0]=i.edit,t[1]=a);let o;t[2]===i.source?o=t[3]:(o={id:`source`,label:i.source,Icon:ce},t[2]=i.source,t[3]=o);let s;t[4]===i.preview?s=t[5]:(s={id:`preview`,label:i.preview,Icon:fe},t[4]=i.preview,t[5]=s);let c;t[6]!==a||t[7]!==o||t[8]!==s?(c=[a,o,s],t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9];let l=c,u;t[10]!==n||t[11]!==l?(u=l.find(e=>e.id===n)??l[0],t[10]=n,t[11]=l,t[12]=u):u=t[12];let d=u,f=d.Icon,p=sn,m;t[13]===f?m=t[14]:(m=(0,$.jsx)(f,{className:`size-3.5`,"aria-hidden":!0}),t[13]=f,t[14]=m);let h;t[15]===d.label?h=t[16]:(h=(0,$.jsx)(`span`,{children:d.label}),t[15]=d.label,t[16]=h);let g;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(V,{className:`size-3 text-fg-subtle`,"aria-hidden":!0}),t[17]=g):g=t[17];let _;t[18]!==d.label||t[19]!==m||t[20]!==h?(_=(0,$.jsx)(ot,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,"aria-label":d.label,className:`inline-flex h-8 items-center gap-1.5 rounded-lg border border-edge px-2.5 text-xs font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[m,h,g]})}),t[18]=d.label,t[19]=m,t[20]=h,t[21]=_):_=t[21];let v;t[22]!==n||t[23]!==l||t[24]!==r?(v=(0,$.jsx)(st,{children:(0,$.jsx)(lt,{align:`end`,sideOffset:6,className:`z-50 min-w-36 rounded-xl border border-edge bg-surface-overlay p-1 shadow-popover`,children:l.map(e=>{let{id:t,label:i,Icon:a}=e;return(0,$.jsxs)(ct,{onSelect:()=>r(t),onPointerMove:()=>p(t),onFocus:()=>p(t),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,children:[(0,$.jsx)(a,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`flex-1`,children:i}),n===t?(0,$.jsx)(ie,{className:`size-4 text-accent`,"aria-hidden":!0}):null]},t)})})}),t[22]=n,t[23]=l,t[24]=r,t[25]=v):v=t[25];let y;return t[26]!==v||t[27]!==_?(y=(0,$.jsxs)(at,{modal:!1,children:[_,v]}),t[26]=v,t[27]=_,t[28]=y):y=t[28],y}function sn(e){e===`wysiwyg`&&en(),e===`source`&&tn()}function cn(e){let t=(0,gt.c)(16),{noteId:n,onBack:r,onSaved:i,showBackButton:a,backButtonClassName:o,clearHeaderOnCleanup:s,onOpenSearch:c,autoFocus:l,initialMode:u,onAutoFocusConsumed:f}=e,p=a===void 0||a,h=s===void 0||s,g=l!==void 0&&l,_=d(ln),v;t[0]===_?v=t[1]:(v=m(_),t[0]=_,t[1]=v);let y=v.notes.lightboxClose,b;t[2]!==g||t[3]!==o||t[4]!==h||t[5]!==u||t[6]!==n||t[7]!==f||t[8]!==r||t[9]!==c||t[10]!==i||t[11]!==p?(b=(0,$.jsx)(un,{noteId:n,onBack:r,onSaved:i,showBackButton:p,backButtonClassName:o,clearHeaderOnCleanup:h,onOpenSearch:c,autoFocus:g,initialMode:u,onAutoFocusConsumed:f}),t[2]=g,t[3]=o,t[4]=h,t[5]=u,t[6]=n,t[7]=f,t[8]=r,t[9]=c,t[10]=i,t[11]=p,t[12]=b):b=t[12];let x;return t[13]!==y||t[14]!==b?(x=(0,$.jsx)(ye,{closeLabel:y,children:b}),t[13]=y,t[14]=b,t[15]=x):x=t[15],x}function ln(e){return e.language}function un({noteId:e,onBack:t,onSaved:n,showBackButton:r=!0,backButtonClassName:i,clearHeaderOnCleanup:a=!0,onOpenSearch:o,autoFocus:c=!1,initialMode:l=`wysiwyg`,onAutoFocusConsumed:f}){let p=d(e=>e.language),h=m(p).notes,g=m(p).chat.pageContext,_=m(p).automations.suggestions,{data:v}=Ue([`note-discussion-document`,e],()=>w(e)),[y,b]=(0,Q.useState)(!0),x=s(),S=Xe(e=>e.resolved)===`dark`,{openImage:C}=_e(),[T,E]=(0,Q.useState)(l),[D,O]=(0,Q.useState)(null),[k,A]=(0,Q.useState)(null),[j,M]=(0,Q.useState)(!1),[P,te]=(0,Q.useState)(``),[I,ne]=(0,Q.useState)(360),[R,z]=(0,Q.useState)(!1),[B,V]=(0,Q.useState)(!1),[ae,oe]=(0,Q.useState)(!1),se=(0,Q.useRef)(0);(0,Q.useEffect)(()=>()=>{se.current+=1},[e]);let[ce,H]=(0,Q.useState)(null),[le,de]=(0,Q.useState)(!1),[fe,he]=(0,Q.useState)(null),[ye,U]=(0,Q.useState)(!1),[W,G]=(0,Q.useState)(!1),Se=(0,Q.useRef)(!1),Ce=(0,Q.useRef)(!1),Te=(0,Q.useRef)(null),K=(0,Q.useRef)(null),q=(0,Q.useRef)(null),Oe=(0,Q.useRef)(null),ke=(0,Q.useRef)(null),Ae=(0,Q.useRef)(null),je=(0,Q.useRef)(null),Ne=(0,Q.useRef)(null),Pe=(0,Q.useRef)(null),Fe=Ze(e=>e.setPageHeader),Re=Ze(e=>e.clearPageHeader),{data:Y,mutate:X,error:Ve}=Ue(e?[`note-detail`,e]:null,()=>xe(e)),{data:Z=[],mutate:We}=Ue(e?[`note-threads`,e]:null,()=>we(e),{revalidateOnFocus:!1}),Ge=k!==null,Ke=(0,Q.useCallback)(e=>{H(`${h.refreshFailed}: ${e instanceof Error?e.message:h.quickCaptureFailedHint}`)},[h.quickCaptureFailedHint,h.refreshFailed]);(0,Q.useEffect)(()=>{if(!e)return;let t=t=>{t.detail?.noteId===e&&X().catch(Ke)};return window.addEventListener(`note-updated`,t),()=>window.removeEventListener(`note-updated`,t)},[X,e,Ke]),(0,Q.useEffect)(()=>{Se.current=!1,te(``),A(null),O(null),Ce.current=!1,Pe.current=null},[e]),(0,Q.useEffect)(()=>{!Y||Se.current||(te(Y.title??``),Se.current=!0)},[Y]),(0,Q.useEffect)(()=>{if(!c||!Y||Ge||Pe.current===e)return;let t=window.requestAnimationFrame(()=>{Ne.current?.focus(),f?.()});return Pe.current=e,()=>window.cancelAnimationFrame(t)},[c,Ge,Y,e,f]);let qe=Y?new Date(Y.createdAt).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``,Je=(0,Q.useMemo)(()=>r?(0,$.jsx)(`button`,{type:`button`,onClick:t,"aria-label":h.back,className:Be(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,Ye,i),children:(0,$.jsx)(N,{className:`size-4`,"aria-hidden":!0})}):null,[i,h.back,t,r]),Qe=(0,Q.useCallback)(()=>{let t=L.getState();t.source?.type===`note`&&t.source.id===e&&t.stop()},[e]),et=(0,Q.useCallback)(e=>{e!==`preview`&&Qe(),E(e)},[Qe]),tt=(0,Q.useCallback)(t=>{Qe(),te(t),e&&(Oe.current=t,K.current&&clearTimeout(K.current),K.current=setTimeout(async()=>{let t=Oe.current;if(Oe.current=null,t!==null){M(!0);try{await ge(e,{title:t}),await X(),n?.()}catch{}finally{M(!1)}}},600))},[Qe,e,X,n]),nt=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:Be(`flex min-w-0 items-center gap-2`,Ye),children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,title:P||qe||void 0,children:P||qe}),j?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted opacity-60`,children:h.saving}):null]}),[h.saving,j,qe,P]),rt=(0,Q.useCallback)(async(t=!1)=>{oe(!0),H(null);try{let n=await be(e,{forceNew:t});await X(),await We(),x(`/chat/${encodeURIComponent(n.conversationId)}`)}catch(e){H(`${h.chatOpenFailedTitle}: ${e instanceof Error?e.message:h.chatOpenFailedMessage}`)}finally{oe(!1)}},[X,We,x,e,h.chatOpenFailedMessage,h.chatOpenFailedTitle]),it=(0,Q.useCallback)(async()=>{V(!0),H(null);try{await Ee(e),await X()}catch(e){H(`${h.catalysisFailed}: ${e instanceof Error?e.message:h.chatOpenFailedMessage}`)}finally{V(!1)}},[X,e]),dt=(0,Q.useCallback)(()=>{O(D===`breakdown`?null:`breakdown`),!Y?.aiDeep?.catalysis?.report&&!B&&it()},[D,B,it,Y?.aiDeep?.catalysis?.report]),ft=(0,Q.useCallback)(()=>{let t=k?k.markdown??``:q.current??Y?.markdown??``,n=k?k.title??``:P,r=$t(n,t);return{source:{type:`note`,id:e,title:n||h.titlePlaceholder},text:r,language:F(r,p)}},[p,h.titlePlaceholder,Y?.markdown,e,k,P]),ht=(0,Q.useCallback)(async()=>{Te.current&&clearTimeout(Te.current),K.current&&clearTimeout(K.current),Te.current=null,K.current=null;let t=q.current,r=Oe.current;q.current=null,Oe.current=null;let i={};if(t!==null&&(i.markdown=t),r!==null&&(i.title=r),Object.keys(i).length===0)return Y??null;M(!0);try{let t=await ge(e,i);return await X(t,{revalidate:!1}),n?.(),t}catch(e){return q.current===null&&(q.current=t),Oe.current===null&&(Oe.current=r),H(`${h.saveFailed}: ${e instanceof Error?e.message:h.saveFailedHint}`),null}finally{M(!1)}},[X,h.saveFailed,h.saveFailedHint,Y,e,n]),gt=(0,Q.useCallback)(async()=>{if(!Y||ae||j)return;oe(!0),H(null);let e=u.getState(),t=++se.current,n=()=>se.current===t&&u.getState().baseUrl===e.baseUrl&&u.getState().conversationId===e.conversationId;try{let t=window.getSelection(),r=t?.anchorNode&&t.focusNode&&ke.current?.contains(t.anchorNode)&&ke.current.contains(t.focusNode)?t.toString():``,i=await ht();if(!i||!n())return;if(q.current!==null||Oe.current!==null)throw Error(g.unavailable);let a=pt.capture({title:i.title||i.id,text:i.markdown,resourceRefs:[{kind:`note`,id:i.id,revision:String(i.remoteVersion??1)}],selection:r?{text:r,draft:!1}:void 0}),o=await new He().createSession();if(!n())return;if(q.current!==null||Oe.current!==null)throw Error(g.unavailable);let s=mt(e.baseUrl,e.conversationId,o.key);if(!pt.put(s,a))throw Error(g.unavailable);x(`/chat/${encodeURIComponent(o.key)}`)}catch{n()&&H(g.unavailable)}finally{se.current===t&&oe(!1)}},[Y,ae,j,ht,x,g.unavailable]),_t=(0,Q.useCallback)(async()=>{H(null);let e=await ht();e&&(he(e),de(!0))},[ht]),vt=(0,Q.useCallback)(async()=>{if(!(W||j)){U(!1),G(!0),H(null),Qe(),Te.current&&clearTimeout(Te.current),K.current&&clearTimeout(K.current),Te.current=null,K.current=null,q.current=null,Oe.current=null;try{await J(e),window.dispatchEvent(new CustomEvent(`note-deleted`,{detail:{noteId:e}})),n?.(),t()}catch(e){H(`${h.deleteFailed}: ${e instanceof Error?e.message:h.quickCaptureFailedHint}`)}finally{G(!1)}}},[W,h.deleteFailed,h.quickCaptureFailedHint,e,t,n,j,Qe]),yt=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:Be(`flex min-w-0 items-center gap-1 sm:gap-2`,Ye),children:[o?(0,$.jsx)(`button`,{type:`button`,onClick:o,"aria-label":h.searchDialogTitle,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:(0,$.jsx)(Ie,{className:`size-4`,"aria-hidden":!0})}):null,(0,$.jsx)(Zt,{input:ft,showLabel:!1,labels:{read:h.readAloud,preparing:h.readAloudPreparing,pause:h.readAloudPause,resume:h.readAloudResume,retry:h.readAloudRetry,stop:h.readAloudStop}}),(0,$.jsxs)(`button`,{type:`button`,onClick:dt,disabled:B,"aria-label":h.catalysisSectionTitle,className:Be(`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50`,D===`breakdown`?`bg-accent/10 text-accent`:`bg-accent/10 text-fg hover:bg-accent/15`),children:[(0,$.jsx)(Le,{className:`size-3.5`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:B?h.catalyzing:h.catalyzeButton})]}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>rt(!1),"aria-label":h.openChatButton,disabled:ae,className:Be(`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors`,`border border-edge text-fg-muted hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`),children:[(0,$.jsx)(Me,{className:`size-3.5`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:ae?h.openingChat:h.openChatButton})]}),(0,$.jsx)(on,{mode:T,onModeChange:et,labels:{edit:h.modeEdit,source:h.modeSource,preview:h.modePreview}}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>void gt(),disabled:ae||j||!Y||!!k,className:`inline-flex items-center gap-1.5 rounded-lg border border-edge px-2.5 py-1.5 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:[(0,$.jsx)(pe,{className:`size-3.5`,"aria-hidden":!0}),g.capture]}),(0,$.jsxs)(at,{modal:!1,children:[(0,$.jsx)(ot,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,"aria-label":h.noteActions,title:h.noteActions,className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:(0,$.jsx)(ue,{className:`size-4`,"aria-hidden":!0})})}),(0,$.jsx)(st,{children:(0,$.jsxs)(lt,{align:`end`,sideOffset:6,className:`z-50 min-w-40 rounded-xl border border-edge bg-surface-overlay p-1 shadow-popover`,children:[(0,$.jsxs)(ct,{onSelect:()=>void _t(),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,children:[(0,$.jsx)(ee,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),p===`zh`?`分享`:`Share`]}),(0,$.jsxs)(ct,{onSelect:()=>O(D===`history`?null:`history`),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,children:[(0,$.jsx)(me,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`flex-1`,children:h.history}),D===`history`?(0,$.jsx)(ie,{className:`size-4 text-accent`,"aria-hidden":!0}):null]}),(0,$.jsx)(ut,{className:`my-1 h-px bg-edge-subtle`}),(0,$.jsxs)(ct,{disabled:W||j,onSelect:()=>U(!0),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-danger outline-none hover:bg-danger-soft focus:bg-danger-soft data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,children:[(0,$.jsx)(ze,{className:`size-4`,"aria-hidden":!0}),h.delete]})]})})]})]}),[B,dt,rt,gt,g.capture,Y,k,T,h.history,h.modeEdit,h.modePreview,h.modeSource,ae,D,o,h.searchDialogTitle,h.readAloud,h.readAloudPause,h.readAloudPreparing,h.readAloudResume,h.readAloudRetry,h.readAloudStop,et,ft,_t,W,j,p,h.delete,U]);(0,Q.useLayoutEffect)(()=>(Fe({startExtra:Je,main:Y&&!(v&&y)?nt:null,end:Y&&!(v&&y)?yt:null}),()=>{a&&Re()}),[a,Re,yt,nt,Je,v,y,Y,Fe]);let bt=(0,Q.useCallback)(t=>{e&&(Qe(),q.current=t,Te.current&&clearTimeout(Te.current),Te.current=setTimeout(async()=>{let t=q.current;if(q.current=null,t!==null){M(!0),H(null);try{await ge(e,{markdown:t}),await X(),n?.()}catch(e){H(`${h.saveFailed}: ${e instanceof Error?e.message:h.saveFailedHint}`)}finally{M(!1)}}},600))},[Qe,e,X,h.saveFailed,h.saveFailedHint,n]),xt=(0,Q.useCallback)(t=>{De(e,t.timestamp).then(e=>{e&&(Qe(),A(e))})},[e,Qe]),St=(0,Q.useCallback)(()=>{Qe(),O(null),A(null)},[Qe]),Ct=(0,Q.useCallback)(()=>{Qe(),O(null),A(null),X().catch(Ke),n?.()},[X,n,Ke,Qe]);if((0,Q.useEffect)(()=>()=>{Te.current&&clearTimeout(Te.current),K.current&&clearTimeout(K.current);let t=q.current,n=Oe.current;q.current=null,Oe.current=null;let r={};t!==null&&(r.markdown=t),n!==null&&(r.title=n),Object.keys(r).length>0&&ge(e,r).catch(()=>void 0)},[e]),Y===void 0)return Ve?(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-6 text-center`,role:`alert`,children:[(0,$.jsx)(`p`,{className:`text-sm text-danger`,children:h.home.loadFailed}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void X().catch(Ke),className:`rounded-lg border border-edge px-3 py-2 text-sm text-fg hover:bg-surface-hover`,children:h.home.retry}),(0,$.jsx)(`button`,{type:`button`,onClick:t,className:`text-sm text-fg-muted hover:text-fg`,children:h.back})]}):(0,$.jsx)(an,{});if(Y===null)return(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 text-center`,children:[(0,$.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:h.notFoundTitle}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:h.notFoundDescription}),(0,$.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-lg border border-edge px-3 py-1.5 text-sm font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:h.back})]});let Tt=Ge?k.title??``:P,Et=Ge?k.markdown??``:q.current??Y.markdown??``,Dt=new Date(Y.createdAt).getTime(),Ot=Number.isFinite(Dt)&&Date.now()-Dt<3600*1e3?(0,$.jsx)(wt,{title:_.noteCreatedTitle,description:_.noteCreatedDescription,prompt:_.noteCreatedPrompt,coverage:{eventType:`note.created`,source:`notes`,eventPayload:{noteId:e}},variant:`titleAction`,className:`ml-3 hidden max-w-[18rem] shrink-0 md:flex`}):null;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 gap-3 p-4 sm:px-5`,children:[(0,$.jsxs)(`div`,{className:`mx-auto flex min-h-0 min-w-0 w-full max-w-[60rem] flex-1 flex-col`,children:[ce?(0,$.jsx)(`p`,{className:`mb-3 shrink-0 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,role:`alert`,children:ce}):null,(0,$.jsx)(re,{eventType:`note.created`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,$.jsx)(re,{eventType:`note.updated`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),v&&!y?(0,$.jsx)(`button`,{className:`mb-2 inline-flex min-h-11 shrink-0 items-center self-start rounded-lg px-2 text-sm text-accent-fg focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>b(!0),children:p===`zh`?`← 返回录音笔记`:`← Back to recording`}):null,(0,$.jsxs)(`div`,{ref:ke,className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel xl:flex-row`,children:[v&&y?(0,$.jsx)(zt,{noteId:e,noteActions:{onAnalyze:dt,onChat:()=>{rt(!1)},onShare:()=>{_t()},onHistory:()=>O(D===`history`?null:`history`),onDelete:()=>U(!0),busy:W||j||B||ae},onPersonalNotes:()=>{b(!1),window.setTimeout(()=>Ne.current?.focus(),0)}}):null,(0,$.jsx)(`div`,{className:v&&y?`hidden`:`min-h-0 min-w-0 flex-1`,children:Ge?(0,$.jsxs)(`div`,{className:`h-full overflow-y-auto px-4 py-4 sm:px-6`,children:[Tt&&(0,$.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg/70`,children:Tt}),Et?(0,$.jsx)(ve,{noteId:e,content:Et,className:`opacity-80`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:h.emptyPreview})]}):(0,$.jsxs)($.Fragment,{children:[T===`wysiwyg`&&(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,$.jsx)(`input`,{ref:Ne,type:`text`,value:P,onChange:e=>tt(e.target.value),onCompositionStart:()=>{Ce.current=!0},onCompositionEnd:()=>{Ce.current=!1},onKeyDown:e=>{let t=e.nativeEvent;e.key===`Enter`&&!Ce.current&&!t.isComposing&&(e.preventDefault(),(ke.current?.querySelector(`.ProseMirror`))?.focus())},placeholder:h.titlePlaceholder,className:`min-w-0 flex-1 border-none bg-transparent text-2xl font-bold text-fg placeholder:text-fg-muted/40 focus:outline-none`}),Ot]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(an,{}),children:(0,$.jsx)(nn,{initialContent:Y.markdown??``,onChange:bt,noteId:e},`wysiwyg-${e}`)})})]}),T===`source`&&(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,$.jsx)(`input`,{ref:Ne,type:`text`,value:P,onChange:e=>tt(e.target.value),placeholder:h.titlePlaceholder,className:`min-w-0 flex-1 border-none bg-transparent text-2xl font-bold text-fg placeholder:text-fg-muted/40 focus:outline-none`}),Ot]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(an,{}),children:(0,$.jsx)(rn,{initialContent:Y.markdown??``,onChange:bt,isDark:S},`source-${e}`)})})]}),T===`preview`&&(0,$.jsxs)(`div`,{className:`h-full overflow-y-auto px-4 py-4 sm:px-6`,onClick:e=>{let t=e.target;t instanceof HTMLImageElement&&C(t.currentSrc||t.src,t.alt)},children:[P&&!Y.markdown.trimStart().startsWith(`# ${P.trim()}\n`)&&Y.markdown.trim()!==`# ${P.trim()}`&&(0,$.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg`,children:P}),Y.markdown?(0,$.jsx)(ve,{noteId:e,content:Y.markdown,className:`[&_img]:cursor-zoom-in`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:h.emptyPreview})]})]})})]})]}),(0,$.jsx)(`div`,{ref:Ae,className:Be(`relative flex min-h-0 shrink-0 flex-col overflow-hidden`,!R&&`transition-[width] duration-300 ease-in-out`),style:{width:D?I:0},children:(0,$.jsxs)(`div`,{ref:je,className:`flex min-h-0 flex-1 flex-col`,style:{width:I},children:[(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,onPointerDown:e=>{e.preventDefault();let t=e.currentTarget;t.setPointerCapture(e.pointerId),z(!0);let n=e.clientX,r=I,i=e.pointerId,a=0,o=I,s=I,c=()=>{a=0,s=o,D&&Ae.current?.style.setProperty(`width`,`${s}px`),je.current?.style.setProperty(`width`,`${s}px`)},l=e=>{let t=r-(e.clientX-n);o=Math.max(280,Math.min(600,Math.round(t))),a===0&&(a=window.requestAnimationFrame(c))},u=()=>{a!==0&&(window.cancelAnimationFrame(a),c());try{t.releasePointerCapture(i)}catch{}z(!1),ne(s),window.removeEventListener(`pointermove`,l),window.removeEventListener(`pointerup`,u),window.removeEventListener(`pointercancel`,u)};window.addEventListener(`pointermove`,l),window.addEventListener(`pointerup`,u),window.addEventListener(`pointercancel`,u)},className:Be(`absolute left-0 top-0 z-10 h-full w-2 -translate-x-1/2 cursor-col-resize`,`before:content-[''] before:pointer-events-none before:absolute before:left-1/2 before:top-0 before:h-full before:w-px before:-translate-x-1/2`,`before:bg-transparent before:transition-[background-color] before:duration-150`,`hover:before:bg-edge/65 dark:hover:before:bg-edge/75`,R&&`before:!bg-edge/80 dark:before:!bg-edge/85`,`touch-none select-none`)}),(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel`,children:D===`history`?(0,$.jsx)(Ht,{noteId:e,activeTimestamp:k?.timestamp??null,onSelect:xt,onClose:St,onRestored:Ct}):D===`breakdown`?(0,$.jsx)(Ut,{noteId:e,note:Y??null,catalyzing:B,onCatalyze:it,onClose:()=>O(null),noteThreads:Z,openingChat:ae,onOpenChat:()=>rt(!1),onOpenNewChat:()=>rt(!0)}):null})]})})]}),fe?(0,$.jsx)(Gt,{open:le,onOpenChange:de,note:fe}):null,(0,$.jsx)($e,{open:ye,title:h.deleteConfirmTitle,description:h.deleteConfirmDescription.replace(`{{title}}`,Y.title||h.titlePlaceholder),confirmLabel:h.deleteConfirmLabel,cancelLabel:h.deleteCancelLabel,destructive:!0,onConfirm:()=>void vt(),onCancel:()=>U(!1)})]})}export{xt as i,Ct as n,St as r,cn as t};
5
+ `)}var en=()=>i(()=>import(`./block-editor-DUONDIZR.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44])),tn=()=>i(()=>import(`./markdown-editor-BuuGlcfG.js`),__vite__mapDeps([45,1,2,41,46,16])),nn=(0,Q.lazy)(()=>en().then(e=>({default:e.BlockEditor}))),rn=(0,Q.lazy)(()=>tn().then(e=>({default:e.MarkdownEditor})));function an(){let e=(0,gt.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col px-6 py-4`,"aria-busy":!0,children:[(0,$.jsx)(`div`,{className:`h-8 w-56 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-6 h-4 w-11/12 animate-pulse rounded bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-3 h-4 w-9/12 animate-pulse rounded bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-3 h-4 w-10/12 animate-pulse rounded bg-surface-hover`})]}),e[0]=t):t=e[0],t}function on(e){let t=(0,gt.c)(29),{mode:n,onModeChange:r,labels:i}=e,a;t[0]===i.edit?a=t[1]:(a={id:`wysiwyg`,label:i.edit,Icon:pe},t[0]=i.edit,t[1]=a);let o;t[2]===i.source?o=t[3]:(o={id:`source`,label:i.source,Icon:ce},t[2]=i.source,t[3]=o);let s;t[4]===i.preview?s=t[5]:(s={id:`preview`,label:i.preview,Icon:fe},t[4]=i.preview,t[5]=s);let c;t[6]!==a||t[7]!==o||t[8]!==s?(c=[a,o,s],t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9];let l=c,u;t[10]!==n||t[11]!==l?(u=l.find(e=>e.id===n)??l[0],t[10]=n,t[11]=l,t[12]=u):u=t[12];let d=u,f=d.Icon,p=sn,m;t[13]===f?m=t[14]:(m=(0,$.jsx)(f,{className:`size-3.5`,"aria-hidden":!0}),t[13]=f,t[14]=m);let h;t[15]===d.label?h=t[16]:(h=(0,$.jsx)(`span`,{children:d.label}),t[15]=d.label,t[16]=h);let g;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(V,{className:`size-3 text-fg-subtle`,"aria-hidden":!0}),t[17]=g):g=t[17];let _;t[18]!==d.label||t[19]!==m||t[20]!==h?(_=(0,$.jsx)(st,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,"aria-label":d.label,className:`inline-flex h-8 items-center gap-1.5 rounded-lg border border-edge px-2.5 text-xs font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[m,h,g]})}),t[18]=d.label,t[19]=m,t[20]=h,t[21]=_):_=t[21];let v;t[22]!==n||t[23]!==l||t[24]!==r?(v=(0,$.jsx)(ct,{children:(0,$.jsx)(ut,{align:`end`,sideOffset:6,className:`z-50 min-w-36 rounded-xl border border-edge bg-surface-overlay p-1 shadow-popover`,children:l.map(e=>{let{id:t,label:i,Icon:a}=e;return(0,$.jsxs)(lt,{onSelect:()=>r(t),onPointerMove:()=>p(t),onFocus:()=>p(t),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,children:[(0,$.jsx)(a,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`flex-1`,children:i}),n===t?(0,$.jsx)(ie,{className:`size-4 text-accent`,"aria-hidden":!0}):null]},t)})})}),t[22]=n,t[23]=l,t[24]=r,t[25]=v):v=t[25];let y;return t[26]!==v||t[27]!==_?(y=(0,$.jsxs)(ot,{modal:!1,children:[_,v]}),t[26]=v,t[27]=_,t[28]=y):y=t[28],y}function sn(e){e===`wysiwyg`&&en(),e===`source`&&tn()}function cn(e){let t=(0,gt.c)(16),{noteId:n,onBack:r,onSaved:i,showBackButton:a,backButtonClassName:o,clearHeaderOnCleanup:s,onOpenSearch:c,autoFocus:l,initialMode:u,onAutoFocusConsumed:f}=e,p=a===void 0||a,h=s===void 0||s,g=l!==void 0&&l,_=d(ln),v;t[0]===_?v=t[1]:(v=m(_),t[0]=_,t[1]=v);let y=v.notes.lightboxClose,b;t[2]!==g||t[3]!==o||t[4]!==h||t[5]!==u||t[6]!==n||t[7]!==f||t[8]!==r||t[9]!==c||t[10]!==i||t[11]!==p?(b=(0,$.jsx)(un,{noteId:n,onBack:r,onSaved:i,showBackButton:p,backButtonClassName:o,clearHeaderOnCleanup:h,onOpenSearch:c,autoFocus:g,initialMode:u,onAutoFocusConsumed:f}),t[2]=g,t[3]=o,t[4]=h,t[5]=u,t[6]=n,t[7]=f,t[8]=r,t[9]=c,t[10]=i,t[11]=p,t[12]=b):b=t[12];let x;return t[13]!==y||t[14]!==b?(x=(0,$.jsx)(ye,{closeLabel:y,children:b}),t[13]=y,t[14]=b,t[15]=x):x=t[15],x}function ln(e){return e.language}function un({noteId:e,onBack:t,onSaved:n,showBackButton:r=!0,backButtonClassName:i,clearHeaderOnCleanup:a=!0,onOpenSearch:o,autoFocus:c=!1,initialMode:l=`wysiwyg`,onAutoFocusConsumed:f}){let p=d(e=>e.language),h=m(p).notes,g=m(p).chat.pageContext,_=m(p).automations.suggestions,{data:v}=Ue([`note-discussion-document`,e],()=>w(e)),[y,b]=(0,Q.useState)(!0),x=s(),S=Xe(e=>e.resolved)===`dark`,{openImage:C}=_e(),[T,E]=(0,Q.useState)(l),[D,O]=(0,Q.useState)(null),[k,A]=(0,Q.useState)(null),[j,M]=(0,Q.useState)(!1),[P,te]=(0,Q.useState)(``),[I,ne]=(0,Q.useState)(360),[R,z]=(0,Q.useState)(!1),[B,V]=(0,Q.useState)(!1),[ae,oe]=(0,Q.useState)(!1),se=(0,Q.useRef)(0);(0,Q.useEffect)(()=>()=>{se.current+=1},[e]);let[ce,H]=(0,Q.useState)(null),[le,de]=(0,Q.useState)(!1),[fe,he]=(0,Q.useState)(null),[ye,U]=(0,Q.useState)(!1),[W,G]=(0,Q.useState)(!1),Se=(0,Q.useRef)(!1),Ce=(0,Q.useRef)(!1),Te=(0,Q.useRef)(null),K=(0,Q.useRef)(null),q=(0,Q.useRef)(null),Oe=(0,Q.useRef)(null),ke=(0,Q.useRef)(null),Ae=(0,Q.useRef)(null),je=(0,Q.useRef)(null),Ne=(0,Q.useRef)(null),Pe=(0,Q.useRef)(null),Fe=Ze(e=>e.setPageHeader),Re=Ze(e=>e.clearPageHeader),{data:Y,mutate:X,error:Ve}=Ue(e?[`note-detail`,e]:null,()=>xe(e)),{data:Z=[],mutate:We}=Ue(e?[`note-threads`,e]:null,()=>we(e),{revalidateOnFocus:!1}),Ge=k!==null,Ke=(0,Q.useCallback)(e=>{H(`${h.refreshFailed}: ${e instanceof Error?e.message:h.quickCaptureFailedHint}`)},[h.quickCaptureFailedHint,h.refreshFailed]);(0,Q.useEffect)(()=>{if(!e)return;let t=t=>{t.detail?.noteId===e&&X().catch(Ke)};return window.addEventListener(`note-updated`,t),()=>window.removeEventListener(`note-updated`,t)},[X,e,Ke]),(0,Q.useEffect)(()=>{Se.current=!1,te(``),A(null),O(null),Ce.current=!1,Pe.current=null},[e]),(0,Q.useEffect)(()=>{!Y||Se.current||(te(Y.title??``),Se.current=!0)},[Y]),(0,Q.useEffect)(()=>{if(!c||!Y||Ge||Pe.current===e)return;let t=window.requestAnimationFrame(()=>{Ne.current?.focus(),f?.()});return Pe.current=e,()=>window.cancelAnimationFrame(t)},[c,Ge,Y,e,f]);let qe=Y?new Date(Y.createdAt).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``,Je=(0,Q.useMemo)(()=>r?(0,$.jsx)(`button`,{type:`button`,onClick:t,"aria-label":h.back,className:Be(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,Ye,i),children:(0,$.jsx)(N,{className:`size-4`,"aria-hidden":!0})}):null,[i,h.back,t,r]),Qe=(0,Q.useCallback)(()=>{let t=L.getState();t.source?.type===`note`&&t.source.id===e&&t.stop()},[e]),$e=(0,Q.useCallback)(e=>{e!==`preview`&&Qe(),E(e)},[Qe]),tt=(0,Q.useCallback)(t=>{Qe(),te(t),e&&(Oe.current=t,K.current&&clearTimeout(K.current),K.current=setTimeout(async()=>{let t=Oe.current;if(Oe.current=null,t!==null){M(!0);try{await ge(e,{title:t}),await X(),n?.()}catch{}finally{M(!1)}}},600))},[Qe,e,X,n]),nt=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:Be(`flex min-w-0 items-center gap-2`,Ye),children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,title:P||qe||void 0,children:P||qe}),j?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted opacity-60`,children:h.saving}):null]}),[h.saving,j,qe,P]),rt=(0,Q.useCallback)(async(t=!1)=>{oe(!0),H(null);try{let n=await be(e,{forceNew:t});await X(),await We(),x(`/chat/${encodeURIComponent(n.conversationId)}`)}catch(e){H(`${h.chatOpenFailedTitle}: ${e instanceof Error?e.message:h.chatOpenFailedMessage}`)}finally{oe(!1)}},[X,We,x,e,h.chatOpenFailedMessage,h.chatOpenFailedTitle]),it=(0,Q.useCallback)(async()=>{V(!0),H(null);try{await Ee(e),await X()}catch(e){H(`${h.catalysisFailed}: ${e instanceof Error?e.message:h.chatOpenFailedMessage}`)}finally{V(!1)}},[X,e]),at=(0,Q.useCallback)(()=>{O(D===`breakdown`?null:`breakdown`),!Y?.aiDeep?.catalysis?.report&&!B&&it()},[D,B,it,Y?.aiDeep?.catalysis?.report]),ft=(0,Q.useCallback)(()=>{let t=k?k.markdown??``:q.current??Y?.markdown??``,n=k?k.title??``:P,r=$t(n,t);return{source:{type:`note`,id:e,title:n||h.titlePlaceholder},text:r,language:F(r,p)}},[p,h.titlePlaceholder,Y?.markdown,e,k,P]),ht=(0,Q.useCallback)(async()=>{Te.current&&clearTimeout(Te.current),K.current&&clearTimeout(K.current),Te.current=null,K.current=null;let t=q.current,r=Oe.current;q.current=null,Oe.current=null;let i={};if(t!==null&&(i.markdown=t),r!==null&&(i.title=r),Object.keys(i).length===0)return Y??null;M(!0);try{let t=await ge(e,i);return await X(t,{revalidate:!1}),n?.(),t}catch(e){return q.current===null&&(q.current=t),Oe.current===null&&(Oe.current=r),H(`${h.saveFailed}: ${e instanceof Error?e.message:h.saveFailedHint}`),null}finally{M(!1)}},[X,h.saveFailed,h.saveFailedHint,Y,e,n]),gt=(0,Q.useCallback)(async()=>{if(!Y||ae||j)return;oe(!0),H(null);let e=u.getState(),t=++se.current,n=()=>se.current===t&&u.getState().baseUrl===e.baseUrl&&u.getState().conversationId===e.conversationId;try{let t=window.getSelection(),r=t?.anchorNode&&t.focusNode&&ke.current?.contains(t.anchorNode)&&ke.current.contains(t.focusNode)?t.toString():``,i=await ht();if(!i||!n())return;if(q.current!==null||Oe.current!==null)throw Error(g.unavailable);let a=pt.capture({title:i.title||i.id,text:i.markdown,resourceRefs:[{kind:`note`,id:i.id,revision:String(i.remoteVersion??1)}],selection:r?{text:r,draft:!1}:void 0}),o=await new He().createSession();if(!n())return;if(q.current!==null||Oe.current!==null)throw Error(g.unavailable);let s=mt(e.baseUrl,e.conversationId,o.key);if(!pt.put(s,a))throw Error(g.unavailable);x(`/chat/${encodeURIComponent(o.key)}`)}catch{n()&&H(g.unavailable)}finally{se.current===t&&oe(!1)}},[Y,ae,j,ht,x,g.unavailable]),_t=(0,Q.useCallback)(async()=>{H(null);let e=await ht();e&&(he(e),de(!0))},[ht]),vt=(0,Q.useCallback)(async()=>{if(!(W||j)){U(!1),G(!0),H(null),Qe(),Te.current&&clearTimeout(Te.current),K.current&&clearTimeout(K.current),Te.current=null,K.current=null,q.current=null,Oe.current=null;try{await J(e),window.dispatchEvent(new CustomEvent(`note-deleted`,{detail:{noteId:e}})),n?.(),t()}catch(e){H(`${h.deleteFailed}: ${e instanceof Error?e.message:h.quickCaptureFailedHint}`)}finally{G(!1)}}},[W,h.deleteFailed,h.quickCaptureFailedHint,e,t,n,j,Qe]),yt=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:Be(`flex min-w-0 items-center gap-1 sm:gap-2`,Ye),children:[o?(0,$.jsx)(`button`,{type:`button`,onClick:o,"aria-label":h.searchDialogTitle,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:(0,$.jsx)(Ie,{className:`size-4`,"aria-hidden":!0})}):null,(0,$.jsx)(Zt,{input:ft,showLabel:!1,labels:{read:h.readAloud,preparing:h.readAloudPreparing,pause:h.readAloudPause,resume:h.readAloudResume,retry:h.readAloudRetry,stop:h.readAloudStop}}),(0,$.jsxs)(`button`,{type:`button`,onClick:at,disabled:B,"aria-label":h.catalysisSectionTitle,className:Be(`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50`,D===`breakdown`?`bg-accent/10 text-accent`:`bg-accent/10 text-fg hover:bg-accent/15`),children:[(0,$.jsx)(Le,{className:`size-3.5`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:B?h.catalyzing:h.catalyzeButton})]}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>rt(!1),"aria-label":h.openChatButton,disabled:ae,className:Be(`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors`,`border border-edge text-fg-muted hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`),children:[(0,$.jsx)(Me,{className:`size-3.5`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:ae?h.openingChat:h.openChatButton})]}),(0,$.jsx)(on,{mode:T,onModeChange:$e,labels:{edit:h.modeEdit,source:h.modeSource,preview:h.modePreview}}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>void gt(),disabled:ae||j||!Y||!!k,className:`inline-flex items-center gap-1.5 rounded-lg border border-edge px-2.5 py-1.5 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:[(0,$.jsx)(pe,{className:`size-3.5`,"aria-hidden":!0}),g.capture]}),(0,$.jsxs)(ot,{modal:!1,children:[(0,$.jsx)(st,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,"aria-label":h.noteActions,title:h.noteActions,className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:(0,$.jsx)(ue,{className:`size-4`,"aria-hidden":!0})})}),(0,$.jsx)(ct,{children:(0,$.jsxs)(ut,{align:`end`,sideOffset:6,className:`z-50 min-w-40 rounded-xl border border-edge bg-surface-overlay p-1 shadow-popover`,children:[(0,$.jsxs)(lt,{onSelect:()=>void _t(),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,children:[(0,$.jsx)(ee,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),p===`zh`?`分享`:`Share`]}),(0,$.jsxs)(lt,{onSelect:()=>O(D===`history`?null:`history`),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,children:[(0,$.jsx)(me,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`flex-1`,children:h.history}),D===`history`?(0,$.jsx)(ie,{className:`size-4 text-accent`,"aria-hidden":!0}):null]}),(0,$.jsx)(dt,{className:`my-1 h-px bg-edge-subtle`}),(0,$.jsxs)(lt,{disabled:W||j,onSelect:()=>U(!0),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-danger outline-none hover:bg-danger-soft focus:bg-danger-soft data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,children:[(0,$.jsx)(ze,{className:`size-4`,"aria-hidden":!0}),h.delete]})]})})]})]}),[B,at,rt,gt,g.capture,Y,k,T,h.history,h.modeEdit,h.modePreview,h.modeSource,ae,D,o,h.searchDialogTitle,h.readAloud,h.readAloudPause,h.readAloudPreparing,h.readAloudResume,h.readAloudRetry,h.readAloudStop,$e,ft,_t,W,j,p,h.delete,U]);(0,Q.useLayoutEffect)(()=>(Fe({startExtra:Je,main:Y&&!(v&&y)?nt:null,end:Y&&!(v&&y)?yt:null}),()=>{a&&Re()}),[a,Re,yt,nt,Je,v,y,Y,Fe]);let bt=(0,Q.useCallback)(t=>{e&&(Qe(),q.current=t,Te.current&&clearTimeout(Te.current),Te.current=setTimeout(async()=>{let t=q.current;if(q.current=null,t!==null){M(!0),H(null);try{await ge(e,{markdown:t}),await X(),n?.()}catch(e){H(`${h.saveFailed}: ${e instanceof Error?e.message:h.saveFailedHint}`)}finally{M(!1)}}},600))},[Qe,e,X,h.saveFailed,h.saveFailedHint,n]),xt=(0,Q.useCallback)(t=>{De(e,t.timestamp).then(e=>{e&&(Qe(),A(e))})},[e,Qe]),St=(0,Q.useCallback)(()=>{Qe(),O(null),A(null)},[Qe]),Ct=(0,Q.useCallback)(()=>{Qe(),O(null),A(null),X().catch(Ke),n?.()},[X,n,Ke,Qe]);if((0,Q.useEffect)(()=>()=>{Te.current&&clearTimeout(Te.current),K.current&&clearTimeout(K.current);let t=q.current,n=Oe.current;q.current=null,Oe.current=null;let r={};t!==null&&(r.markdown=t),n!==null&&(r.title=n),Object.keys(r).length>0&&ge(e,r).catch(()=>void 0)},[e]),Y===void 0)return Ve?(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-6 text-center`,role:`alert`,children:[(0,$.jsx)(`p`,{className:`text-sm text-danger`,children:h.home.loadFailed}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void X().catch(Ke),className:`rounded-lg border border-edge px-3 py-2 text-sm text-fg hover:bg-surface-hover`,children:h.home.retry}),(0,$.jsx)(`button`,{type:`button`,onClick:t,className:`text-sm text-fg-muted hover:text-fg`,children:h.back})]}):(0,$.jsx)(an,{});if(Y===null)return(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 text-center`,children:[(0,$.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:h.notFoundTitle}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:h.notFoundDescription}),(0,$.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-lg border border-edge px-3 py-1.5 text-sm font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:h.back})]});let Tt=Ge?k.title??``:P,Et=Ge?k.markdown??``:q.current??Y.markdown??``,Dt=new Date(Y.createdAt).getTime(),Ot=Number.isFinite(Dt)&&Date.now()-Dt<3600*1e3?(0,$.jsx)(wt,{title:_.noteCreatedTitle,description:_.noteCreatedDescription,prompt:_.noteCreatedPrompt,coverage:{eventType:`note.created`,source:`notes`,eventPayload:{noteId:e}},variant:`titleAction`,className:`ml-3 hidden max-w-[18rem] shrink-0 md:flex`}):null;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 gap-3 p-4 sm:px-5`,children:[(0,$.jsxs)(`div`,{className:`mx-auto flex min-h-0 min-w-0 w-full max-w-[60rem] flex-1 flex-col`,children:[ce?(0,$.jsx)(`p`,{className:`mb-3 shrink-0 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,role:`alert`,children:ce}):null,(0,$.jsx)(re,{eventType:`note.created`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,$.jsx)(re,{eventType:`note.updated`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),v&&!y?(0,$.jsx)(`button`,{className:`mb-2 inline-flex min-h-11 shrink-0 items-center self-start rounded-lg px-2 text-sm text-accent-fg focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>b(!0),children:p===`zh`?`← 返回录音笔记`:`← Back to recording`}):null,(0,$.jsxs)(`div`,{ref:ke,className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel xl:flex-row`,children:[v&&y?(0,$.jsx)(zt,{noteId:e,noteActions:{onAnalyze:at,onChat:()=>{rt(!1)},onShare:()=>{_t()},onHistory:()=>O(D===`history`?null:`history`),onDelete:()=>U(!0),busy:W||j||B||ae},onPersonalNotes:()=>{b(!1),window.setTimeout(()=>Ne.current?.focus(),0)}}):null,(0,$.jsx)(`div`,{className:v&&y?`hidden`:`min-h-0 min-w-0 flex-1`,children:Ge?(0,$.jsxs)(`div`,{className:`h-full overflow-y-auto px-4 py-4 sm:px-6`,children:[Tt&&(0,$.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg/70`,children:Tt}),Et?(0,$.jsx)(ve,{noteId:e,content:Et,className:`opacity-80`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:h.emptyPreview})]}):(0,$.jsxs)($.Fragment,{children:[T===`wysiwyg`&&(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,$.jsx)(`input`,{ref:Ne,type:`text`,value:P,onChange:e=>tt(e.target.value),onCompositionStart:()=>{Ce.current=!0},onCompositionEnd:()=>{Ce.current=!1},onKeyDown:e=>{let t=e.nativeEvent;e.key===`Enter`&&!Ce.current&&!t.isComposing&&(e.preventDefault(),(ke.current?.querySelector(`.ProseMirror`))?.focus())},placeholder:h.titlePlaceholder,className:`min-w-0 flex-1 border-none bg-transparent text-2xl font-bold text-fg placeholder:text-fg-muted/40 focus:outline-none`}),Ot]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(an,{}),children:(0,$.jsx)(nn,{initialContent:Y.markdown??``,onChange:bt,noteId:e},`wysiwyg-${e}`)})})]}),T===`source`&&(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,$.jsx)(`input`,{ref:Ne,type:`text`,value:P,onChange:e=>tt(e.target.value),placeholder:h.titlePlaceholder,className:`min-w-0 flex-1 border-none bg-transparent text-2xl font-bold text-fg placeholder:text-fg-muted/40 focus:outline-none`}),Ot]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(an,{}),children:(0,$.jsx)(rn,{initialContent:Y.markdown??``,onChange:bt,isDark:S},`source-${e}`)})})]}),T===`preview`&&(0,$.jsxs)(`div`,{className:`h-full overflow-y-auto px-4 py-4 sm:px-6`,onClick:e=>{let t=e.target;t instanceof HTMLImageElement&&C(t.currentSrc||t.src,t.alt)},children:[P&&!Y.markdown.trimStart().startsWith(`# ${P.trim()}\n`)&&Y.markdown.trim()!==`# ${P.trim()}`&&(0,$.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg`,children:P}),Y.markdown?(0,$.jsx)(ve,{noteId:e,content:Y.markdown,className:`[&_img]:cursor-zoom-in`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:h.emptyPreview})]})]})})]})]}),(0,$.jsx)(`div`,{ref:Ae,className:Be(`relative flex min-h-0 shrink-0 flex-col overflow-hidden`,!R&&`transition-[width] duration-300 ease-in-out`),style:{width:D?I:0},children:(0,$.jsxs)(`div`,{ref:je,className:`flex min-h-0 flex-1 flex-col`,style:{width:I},children:[(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,onPointerDown:e=>{e.preventDefault();let t=e.currentTarget;t.setPointerCapture(e.pointerId),z(!0);let n=e.clientX,r=I,i=e.pointerId,a=0,o=I,s=I,c=()=>{a=0,s=o,D&&Ae.current?.style.setProperty(`width`,`${s}px`),je.current?.style.setProperty(`width`,`${s}px`)},l=e=>{let t=r-(e.clientX-n);o=Math.max(280,Math.min(600,Math.round(t))),a===0&&(a=window.requestAnimationFrame(c))},u=()=>{a!==0&&(window.cancelAnimationFrame(a),c());try{t.releasePointerCapture(i)}catch{}z(!1),ne(s),window.removeEventListener(`pointermove`,l),window.removeEventListener(`pointerup`,u),window.removeEventListener(`pointercancel`,u)};window.addEventListener(`pointermove`,l),window.addEventListener(`pointerup`,u),window.addEventListener(`pointercancel`,u)},className:Be(`absolute left-0 top-0 z-10 h-full w-2 -translate-x-1/2 cursor-col-resize`,`before:content-[''] before:pointer-events-none before:absolute before:left-1/2 before:top-0 before:h-full before:w-px before:-translate-x-1/2`,`before:bg-transparent before:transition-[background-color] before:duration-150`,`hover:before:bg-edge/65 dark:hover:before:bg-edge/75`,R&&`before:!bg-edge/80 dark:before:!bg-edge/85`,`touch-none select-none`)}),(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel`,children:D===`history`?(0,$.jsx)(Ht,{noteId:e,activeTimestamp:k?.timestamp??null,onSelect:xt,onClose:St,onRestored:Ct}):D===`breakdown`?(0,$.jsx)(Ut,{noteId:e,note:Y??null,catalyzing:B,onCatalyze:it,onClose:()=>O(null),noteThreads:Z,openingChat:ae,onOpenChat:()=>rt(!1),onOpenNewChat:()=>rt(!0)}):null})]})})]}),fe?(0,$.jsx)(Gt,{open:le,onOpenChange:de,note:fe}):null,(0,$.jsx)(et,{open:ye,title:h.deleteConfirmTitle,description:h.deleteConfirmDescription.replace(`{{title}}`,Y.title||h.titlePlaceholder),confirmLabel:h.deleteConfirmLabel,cancelLabel:h.deleteCancelLabel,destructive:!0,onConfirm:()=>void vt(),onCancel:()=>U(!1)})]})}export{xt as i,Ct as n,St as r,cn as t};
@@ -0,0 +1 @@
1
+ import"./notes-api-zXpV6UXu.js";