@xopcai/xopc 0.0.414 → 0.0.416

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 (359) hide show
  1. package/dist/browser-ext/_locales/en/messages.json +4 -1
  2. package/dist/browser-ext/_locales/zh_CN/messages.json +4 -1
  3. package/dist/browser-ext/dist/assets/{page-context-MuzjMBlJ.js → page-context-CVvmTWZb.js} +33 -9
  4. package/dist/browser-ext/dist/background.js +39 -10
  5. package/dist/browser-ext/dist/sidepanel.html +1 -1
  6. package/dist/browser-ext/dist/sidepanel.js +22 -3
  7. package/dist/browser-ext/manifest.json +1 -1
  8. package/dist/extensions/telegram/xopc.extension.json +1 -1
  9. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-ClobpdW3.js → agent-avatar-dicebear-CufU7cqe.js} +1 -1
  10. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-DHDAcss8.js +1 -0
  11. package/dist/gateway/static/root/assets/agents-BV3dAoa0.js +77 -0
  12. package/dist/gateway/static/root/assets/{agents-admin-api-CeBkHnl8.js → agents-admin-api-B1p-ghg9.js} +1 -1
  13. package/dist/gateway/static/root/assets/{app-management-settings-panel-CLunLNGp.js → app-management-settings-panel-D4-n1uBg.js} +1 -1
  14. package/dist/gateway/static/root/assets/{appearance-settings-DBEgoE9g.js → appearance-settings-Cgn4eNsX.js} +1 -1
  15. package/dist/gateway/static/root/assets/apps-page-BOYzD7Zz.js +1 -0
  16. package/dist/gateway/static/root/assets/{archive-plugin-JElK4Goq.js → archive-plugin-B4btCsiV.js} +1 -1
  17. package/dist/gateway/static/root/assets/{automations-page-CZ0UqwyU.js → automations-page-yb1EL_3N.js} +1 -1
  18. package/dist/gateway/static/root/assets/automations-workspace-J7LJ4RuV.js +8 -0
  19. package/dist/gateway/static/root/assets/{binary-plugins-CXFawow6.js → binary-plugins-DQT9e258.js} +1 -1
  20. package/dist/gateway/static/root/assets/{block-editor-BoduwSYI.js → block-editor-B50rU9tL.js} +30 -30
  21. package/dist/gateway/static/root/assets/{browser-automation-inputs-D1pDgMJu.js → browser-automation-inputs-D6AccXaA.js} +1 -1
  22. package/dist/gateway/static/root/assets/browser-automations-page-BiQz6lJA.js +3 -0
  23. package/dist/gateway/static/root/assets/browser-settings-page-W9kuxBbE.js +3 -0
  24. package/dist/gateway/static/root/assets/{capabilities-Bpeh6E22.js → capabilities-BlxF36t-.js} +1 -1
  25. package/dist/gateway/static/root/assets/capabilities-page-iXe87MdG.js +2 -0
  26. package/dist/gateway/static/root/assets/capabilities-settings-panel-CRLSXe7Z.js +8 -0
  27. package/dist/gateway/static/root/assets/{capability-header-actions-BasrAWA0.js → capability-header-actions-BMnbzHms.js} +1 -1
  28. package/dist/gateway/static/root/assets/channels-CrRJkOKX.js +1 -0
  29. package/dist/gateway/static/root/assets/{chat-terminal-dock-CwQbzcZ_.js → chat-terminal-dock-Bd3af4gL.js} +2 -2
  30. package/dist/gateway/static/root/assets/{computer-settings-page-DNWeJKfF.js → computer-settings-page-DXfqy7xh.js} +1 -1
  31. package/dist/gateway/static/root/assets/{connector-service-page-CxHgC5RM.js → connector-service-page-B-cw0CPU.js} +1 -1
  32. package/dist/gateway/static/root/assets/connectors-page-DbFxc0Fd.js +1 -0
  33. package/dist/gateway/static/root/assets/{date-picker-CXxLbLJb.js → date-picker-CqzXevH6.js} +1 -1
  34. package/dist/gateway/static/root/assets/{dependency-picker-DVuWMrSj.js → dependency-picker-pgT4Gyaf.js} +1 -1
  35. package/dist/gateway/static/root/assets/{desktop-pet-settings-BDlg9g4s.js → desktop-pet-settings-Dy_-i2L8.js} +1 -1
  36. package/dist/gateway/static/root/assets/{desktop-pet-KbVLtAlO.js → desktop-pet-zICeqw9c.js} +1 -1
  37. package/dist/gateway/static/root/assets/device-pairing-wizard-ByGbxqkg.js +1 -0
  38. package/dist/gateway/static/root/assets/{directory-picker-path-field-a7xEodzo.js → directory-picker-path-field-C-aQ7qoM.js} +1 -1
  39. package/dist/gateway/static/root/assets/{extension-debug-page-CHelH5u_.js → extension-debug-page-2NwpYkS5.js} +1 -1
  40. package/dist/gateway/static/root/assets/{extension-page-CrVHmS9-.js → extension-page-y9J0z7_Q.js} +1 -1
  41. package/dist/gateway/static/root/assets/{extension-settings-page-CiMybi0r.js → extension-settings-page-BtowusUh.js} +1 -1
  42. package/dist/gateway/static/root/assets/{gateway-config-swr-DF_HV6NP.js → gateway-config-swr-fQKBHBi1.js} +1 -1
  43. package/dist/gateway/static/root/assets/gateway-realtime-C52ghnBK.js +1 -0
  44. package/dist/gateway/static/root/assets/gateway-realtime-store-Bx9KCID-.js +1 -0
  45. package/dist/gateway/static/root/assets/gateway-settings-BYSKzUMR.js +1 -0
  46. package/dist/gateway/static/root/assets/{gateway-startup-retry-B91CBTzO.js → gateway-startup-retry-Cfwxof4k.js} +1 -1
  47. package/dist/gateway/static/root/assets/highlight-code-Cz6eeDH5.js +1 -0
  48. package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-8ACAVktj.js → highlighted-body-KQOG7T2V-BiAa8HKC.js} +1 -1
  49. package/dist/gateway/static/root/assets/home-page-Cd1BjYHj.js +2 -0
  50. package/dist/gateway/static/root/assets/{image-generation-api-CVBaWmrV.js → image-generation-api-gBFro48x.js} +1 -1
  51. package/dist/gateway/static/root/assets/{imports-page-C5IP3e6d.js → imports-page-BZQpXgjj.js} +1 -1
  52. package/dist/gateway/static/root/assets/index-Cy16gQST.css +1 -0
  53. package/dist/gateway/static/root/assets/index-DRyGCING.js +710 -0
  54. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BhU6VYvd.js → keyboard-shortcuts-settings-CYunR34k.js} +1 -1
  55. package/dist/gateway/static/root/assets/local-app-workbench-page-B_Ac1lly.js +1 -0
  56. package/dist/gateway/static/root/assets/{local-apps-page-DcP1Bdlk.js → local-apps-page-w-J5bY02.js} +1 -1
  57. package/dist/gateway/static/root/assets/{local-session-drafts-DvmwiLUx.js → local-session-drafts-iGX_6O0O.js} +1 -1
  58. package/dist/gateway/static/root/assets/{locale-store-JogcXC4J.js → locale-store-B7s2Hb35.js} +1 -1
  59. package/dist/gateway/static/root/assets/logs-page-Dnjvvx2i.js +2 -0
  60. package/dist/gateway/static/root/assets/management-settings-w1EDwgLW.js +1 -0
  61. package/dist/gateway/static/root/assets/{media-plugins-BnPpcJ2J.js → media-plugins-CIx1koXw.js} +1 -1
  62. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-DISkHmEC.js +1 -0
  63. package/dist/gateway/static/root/assets/{messages-RzwPiQNL.js → messages-BYq0cPbn.js} +2 -2
  64. package/dist/gateway/static/root/assets/note-detail-panel-CNkxMTFU.js +5 -0
  65. package/dist/gateway/static/root/assets/note-image-lightbox-D5GH2wuC.js +1 -0
  66. package/dist/gateway/static/root/assets/notes-page-DZgKqFBG.js +8 -0
  67. package/dist/gateway/static/root/assets/page-context-capture-button-DusR2Itk.js +1 -0
  68. package/dist/gateway/static/root/assets/personal-page-CR5JFkQ9.js +1 -0
  69. package/dist/gateway/static/root/assets/personal-settings-panel-B7undvlr.js +1 -0
  70. package/dist/gateway/static/root/assets/phone-model-picker-fWDltRUJ.js +1 -0
  71. package/dist/gateway/static/root/assets/phone-settings-page-CsOirAiy.js +1 -0
  72. package/dist/gateway/static/root/assets/plugin-details-dialog-BOBVIB3j.js +1 -0
  73. package/dist/gateway/static/root/assets/{preview-open-alternatives-FGqN-mQx.js → preview-open-alternatives-CMxjsKSw.js} +1 -1
  74. package/dist/gateway/static/root/assets/{product-open-page-CwnHLfdL.js → product-open-page-CrlyJx5M.js} +1 -1
  75. package/dist/gateway/static/root/assets/{product-preview-content-BD6k5hF9.js → product-preview-content-B-Jhzi7W.js} +1 -1
  76. package/dist/gateway/static/root/assets/project-detail-page-DoYUbtcI.js +7 -0
  77. package/dist/gateway/static/root/assets/projects-page-xGQd9oAZ.js +1 -0
  78. package/dist/gateway/static/root/assets/refresh-cw-BRlGaq2w.js +1 -0
  79. package/dist/gateway/static/root/assets/{registry-api-BGqSwITi.js → registry-api-BcfoLEna.js} +1 -1
  80. package/dist/gateway/static/root/assets/remote-access-hub-Gs0Xkws9.js +1 -0
  81. package/dist/gateway/static/root/assets/{runtime-tools-api-CSm5SpnR.js → runtime-tools-api-DesqGCnE.js} +1 -1
  82. package/dist/gateway/static/root/assets/runtime-tools-settings-panel-Bwg7U7TR.js +1 -0
  83. package/dist/gateway/static/root/assets/{schema-form-DoVn5jJK.js → schema-form-ByzTNR_C.js} +1 -1
  84. package/dist/gateway/static/root/assets/{session-api-DTxZyMta.js → session-api-DdQnMwkl.js} +1 -1
  85. package/dist/gateway/static/root/assets/{session-manager-B2HDomj4.js → session-manager-B_h0jlLb.js} +1 -1
  86. package/dist/gateway/static/root/assets/sessions-page-XzK1ftbR.js +1 -0
  87. package/dist/gateway/static/root/assets/settings-advanced-gate-D_8Mvnog.js +1 -0
  88. package/dist/gateway/static/root/assets/{settings-form-section-Ce8vVv-9.js → settings-form-section-Brgd8IOV.js} +1 -1
  89. package/dist/gateway/static/root/assets/{settings-page-DP2w3ejC.js → settings-page-B6Mv02eg.js} +1 -1
  90. package/dist/gateway/static/root/assets/settings-page-header-BWyxJKOG.js +1 -0
  91. package/dist/gateway/static/root/assets/{settings-page-layout-B20AfmFG.js → settings-page-layout-DLHcS-0T.js} +1 -1
  92. package/dist/gateway/static/root/assets/setup-status-panel-DSCj5yis.js +1 -0
  93. package/dist/gateway/static/root/assets/{share-preview-page-DV4dKrmG.js → share-preview-page-DF8Of0aZ.js} +1 -1
  94. package/dist/gateway/static/root/assets/shares-settings-DXNPe4Tl.js +1 -0
  95. package/dist/gateway/static/root/assets/{skill-api-DTdejInH.js → skill-api-CKCDCHLq.js} +1 -1
  96. package/dist/gateway/static/root/assets/skill-reload-api-BH0WF6Br.js +1 -0
  97. package/dist/gateway/static/root/assets/skills-page-DFWMVRW4.js +2 -0
  98. package/dist/gateway/static/root/assets/system-settings-panel-DB-ttubV.js +1 -0
  99. package/dist/gateway/static/root/assets/task-detail-page-BJY7c8wb.js +2 -0
  100. package/dist/gateway/static/root/assets/{task-result-evidence-DIGSC4qF.js → task-result-evidence-B-vt1BgK.js} +1 -1
  101. package/dist/gateway/static/root/assets/{tracing-settings-page-BaU8frtc.js → tracing-settings-page-Dt51Z_ws.js} +1 -1
  102. package/dist/gateway/static/root/assets/{tunnel-api-BCcOUsqu.js → tunnel-api-Dok3t7Qe.js} +1 -1
  103. package/dist/gateway/static/root/assets/usage-page-lJym5G7F.js +1 -0
  104. package/dist/gateway/static/root/assets/{use-autosave-C1X47WVb.js → use-autosave-D4EMIB-V.js} +1 -1
  105. package/dist/gateway/static/root/assets/user-model-page-BXdNkITp.js +2 -0
  106. package/dist/gateway/static/root/assets/{voice-api-key-field-Bk4DQMTw.js → voice-api-key-field-CO3KuanA.js} +1 -1
  107. package/dist/gateway/static/root/assets/{voice-config-api-D7xsWrdh.js → voice-config-api-BkUlN7GH.js} +1 -1
  108. package/dist/gateway/static/root/assets/{work-discovery-overlay-B7_NmTB5.js → work-discovery-overlay-BJRtgQM3.js} +1 -1
  109. package/dist/gateway/static/root/assets/wrench-DFb4r8bH.js +1 -0
  110. package/dist/gateway/static/root/assets/xopc-cloud-account-card-CS-_GxHV.js +1 -0
  111. package/dist/gateway/static/root/browser-setup-test.html +5 -0
  112. package/dist/gateway/static/root/browser-setup-test.js +7 -0
  113. package/dist/gateway/static/root/index.html +17 -14
  114. package/dist/package.js +1 -1
  115. package/dist/packages/gateway-contract/src/browser-setup.js +6 -0
  116. package/dist/packages/gateway-contract/src/index.js +4 -0
  117. package/dist/packages/gateway-contract/src/phone-setup.js +6 -0
  118. package/dist/packages/realtime-client/src/index.js +1 -0
  119. package/dist/packages/realtime-protocol/src/index.js +1 -0
  120. package/dist/src/agent/agent-manager.d.ts +4 -0
  121. package/dist/src/agent/agent-manager.js +12 -1
  122. package/dist/src/agent/coding/workspace-revision.js +1 -1
  123. package/dist/src/agent/commands/command-registry.js +1 -1
  124. package/dist/src/agent/embedded/tool-search-extension.js +14 -1
  125. package/dist/src/agent/memory/context-recovery.d.ts +1 -1
  126. package/dist/src/agent/service.d.ts +1 -0
  127. package/dist/src/agent/service.js +5 -0
  128. package/dist/src/agent/service.types.d.ts +2 -0
  129. package/dist/src/agent/skills/installer.js +3 -3
  130. package/dist/src/agent/tool-manuals/phone.d.ts +1 -1
  131. package/dist/src/agent/tool-manuals/phone.js +4 -2
  132. package/dist/src/agent/tool-manuals/xopc-configuration.d.ts +2 -0
  133. package/dist/src/agent/tool-manuals/xopc-configuration.js +25 -0
  134. package/dist/src/agent/tools/browser/tool/browser-use-tool.d.ts +2 -0
  135. package/dist/src/agent/tools/browser/tool/browser-use-tool.js +6 -2
  136. package/dist/src/agent/tools/factory.d.ts +3 -0
  137. package/dist/src/agent/tools/factory.js +11 -1
  138. package/dist/src/agent/tools/personal-task-tool.d.ts +1 -1
  139. package/dist/src/agent/tools/personal-task-tool.js +23 -21
  140. package/dist/src/agent/tools/phone-use-tool.d.ts +1 -0
  141. package/dist/src/agent/tools/phone-use-tool.js +29 -1
  142. package/dist/src/agent/tools/tool-manual-tool.d.ts +1 -1
  143. package/dist/src/agent/tools/tool-manual-tool.js +3 -1
  144. package/dist/src/agent/tools/toolExposure.js +3 -0
  145. package/dist/src/agent/tools/xopc-use-tool.d.ts +4 -2
  146. package/dist/src/agent/tools/xopc-use-tool.js +40 -2
  147. package/dist/src/backup/archive.js +2 -1
  148. package/dist/src/browser/drivers/browser-driver.d.ts +2 -2
  149. package/dist/src/browser/drivers/extension-driver.d.ts +2 -2
  150. package/dist/src/browser/drivers/extension-driver.js +6 -3
  151. package/dist/src/browser/providers/browser-ext-install.js +3 -2
  152. package/dist/src/browser/runtime/browser-runtime.d.ts +4 -1
  153. package/dist/src/browser/runtime/browser-runtime.js +29 -17
  154. package/dist/src/browser/setup/repository.d.ts +5 -0
  155. package/dist/src/browser/setup/repository.js +42 -0
  156. package/dist/src/browser/setup/service.d.ts +152 -0
  157. package/dist/src/browser/setup/service.js +404 -0
  158. package/dist/src/browser/setup/types.d.ts +38 -0
  159. package/dist/src/browser/setup/types.js +1 -0
  160. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  161. package/dist/src/cli/commands/extension-marketplace.js +3 -3
  162. package/dist/src/cli/commands/extension-pack.js +1 -1
  163. package/dist/src/cli/commands/extension.js +2 -2
  164. package/dist/src/config/schema.d.ts +2 -0
  165. package/dist/src/extensions/install.js +1 -1
  166. package/dist/src/extensions/update.js +1 -1
  167. package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
  168. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
  169. package/dist/src/gateway/hono/routes/browser-setup.d.ts +3 -0
  170. package/dist/src/gateway/hono/routes/browser-setup.js +114 -0
  171. package/dist/src/gateway/hono/routes/browser.d.ts +2 -1
  172. package/dist/src/gateway/hono/routes/browser.js +1 -1
  173. package/dist/src/gateway/hono/routes/lazy-bundles.js +8 -0
  174. package/dist/src/gateway/hono/routes/phone-dependencies.js +1 -1
  175. package/dist/src/gateway/hono/routes/phone-setup.d.ts +7 -0
  176. package/dist/src/gateway/hono/routes/phone-setup.js +162 -0
  177. package/dist/src/gateway/hono/routes/phone.js +11 -7
  178. package/dist/src/gateway/hono/routes/public-gateway.js +2 -0
  179. package/dist/src/gateway/provider-model-setup.js +1 -1
  180. package/dist/src/gateway/service/config-coordinator.d.ts +2 -0
  181. package/dist/src/gateway/service/config-coordinator.js +1 -1
  182. package/dist/src/gateway/service/session-input-coordinator.js +1 -1
  183. package/dist/src/gateway/service.d.ts +5 -0
  184. package/dist/src/gateway/service.js +52 -7
  185. package/dist/src/gateway/xopc-cloud-capability-setup.js +7 -1
  186. package/dist/src/home-intelligence/host.js +2 -2
  187. package/dist/src/infra/unhandled-rejections.js +2 -2
  188. package/dist/src/infra/update-runner.js +1 -1
  189. package/dist/src/personal-agent/prompts.js +1 -1
  190. package/dist/src/phone/adb-driver.d.ts +8 -2
  191. package/dist/src/phone/adb-driver.js +124 -54
  192. package/dist/src/phone/cloud-adb.js +8 -0
  193. package/dist/src/phone/cloud-scrcpy.d.ts +3 -1
  194. package/dist/src/phone/cloud-scrcpy.js +17 -3
  195. package/dist/src/phone/contracts.d.ts +85 -0
  196. package/dist/src/phone/contracts.js +31 -5
  197. package/dist/src/phone/model-adapter.d.ts +141 -2
  198. package/dist/src/phone/model-adapter.js +176 -24
  199. package/dist/src/phone/numeric-entry.d.ts +31 -0
  200. package/dist/src/phone/numeric-entry.js +126 -0
  201. package/dist/src/phone/planning.d.ts +27 -0
  202. package/dist/src/phone/planning.js +79 -0
  203. package/dist/src/phone/recovery.d.ts +37 -0
  204. package/dist/src/phone/recovery.js +81 -0
  205. package/dist/src/phone/reliability.d.ts +7 -0
  206. package/dist/src/phone/reliability.js +66 -0
  207. package/dist/src/phone/repository.d.ts +1 -0
  208. package/dist/src/phone/repository.js +3 -0
  209. package/dist/src/phone/runtime.d.ts +8 -0
  210. package/dist/src/phone/runtime.js +387 -41
  211. package/dist/src/phone/scrcpy-text.d.ts +11 -0
  212. package/dist/src/phone/scrcpy-text.js +72 -0
  213. package/dist/src/phone/scrcpy.d.ts +5 -1
  214. package/dist/src/phone/scrcpy.js +48 -3
  215. package/dist/src/phone/semantic-controls.d.ts +13 -0
  216. package/dist/src/phone/semantic-controls.js +76 -0
  217. package/dist/src/phone/setup/service.d.ts +148 -0
  218. package/dist/src/phone/setup/service.js +251 -0
  219. package/dist/src/providers/presentation.js +2 -2
  220. package/dist/src/providers/xopc-cloud-model-source.js +6 -2
  221. package/dist/src/realtime/runtime.js +1 -1
  222. package/dist/src/storage/sqlite/connection.js +2 -2
  223. package/dist/src/storage/sqlite/offline-access.js +13 -7
  224. package/dist/src/storage/sqlite/schema-errors.d.ts +12 -0
  225. package/dist/src/storage/sqlite/schema-errors.js +21 -3
  226. package/dist/src/storage/sqlite/schema-upgrade.d.ts +4 -0
  227. package/dist/src/storage/sqlite/schema-upgrade.js +78 -0
  228. package/dist/src/storage/sqlite/schema.d.ts +4 -3
  229. package/dist/src/storage/sqlite/schema.js +14 -8
  230. package/dist/src/storage/sqlite/schema.sql +10 -0
  231. package/dist/src/storage/sqlite/upgrades/203_remove_retired_proactive_contracts.sql +70 -0
  232. package/dist/src/storage/sqlite/upgrades/204_home_intelligence.sql +78 -0
  233. package/dist/src/storage/sqlite/upgrades/205_agent_catalog.sql +66 -0
  234. package/dist/src/storage/sqlite/upgrades/206_home_advice_strategy_version.sql +2 -0
  235. package/dist/src/storage/sqlite/upgrades/207_user_model_policy_contract.sql +121 -0
  236. package/dist/src/storage/sqlite/upgrades/208_automation_management.sql +2 -0
  237. package/dist/src/storage/sqlite/upgrades/209_automation_event_hub.sql +48 -0
  238. package/dist/src/storage/sqlite/upgrades/210_remove_legacy_automation_timeout.sql +14 -0
  239. package/dist/src/storage/sqlite/upgrades/211_automation_result_deliveries.sql +16 -0
  240. package/dist/src/storage/sqlite/upgrades/212_automation_delivery_policy.sql +30 -0
  241. package/dist/src/storage/sqlite/upgrades/213_automation_reliability_contract.sql +188 -0
  242. package/dist/src/storage/sqlite/upgrades/214_ai_usage_ledger.sql +41 -0
  243. package/dist/src/storage/sqlite/upgrades/215_scene_execution_adapters.sql +6 -0
  244. package/dist/src/storage/sqlite/upgrades/216_remove_scene_model_usage.sql +1 -0
  245. package/dist/src/storage/sqlite/upgrades/217_remove_legacy_memory_tables.sql +4 -0
  246. package/dist/src/storage/sqlite/upgrades/218_core_relation_indexes.sql +26 -0
  247. package/dist/src/storage/sqlite/upgrades/219_json_contracts.sql +123 -0
  248. package/dist/src/storage/sqlite/upgrades/220_normalize_timestamps.sql +339 -0
  249. package/dist/src/storage/sqlite/upgrades/221_ai_usage_retention_index.sql +2 -0
  250. package/dist/src/storage/sqlite/upgrades/222_session_config_authority.sql +13 -0
  251. package/dist/src/storage/sqlite/upgrades/223_session_creation_receipts.sql +59 -0
  252. package/dist/src/storage/sqlite/upgrades/224_task_origin_links.sql +8 -0
  253. package/dist/src/storage/sqlite/upgrades/225_task_collaboration.sql +32 -0
  254. package/dist/src/storage/sqlite/upgrades/226_task_main_updates.sql +9 -0
  255. package/dist/src/storage/sqlite/upgrades/227_task_main_update_decisions.sql +8 -0
  256. package/dist/src/storage/sqlite/upgrades/228_task_main_agent_links.sql +14 -0
  257. package/dist/src/storage/sqlite/upgrades/229_task_criterion_reviews.sql +12 -0
  258. package/dist/src/storage/sqlite/upgrades/230_personal_agent_onboarding.sql +8 -0
  259. package/dist/src/storage/sqlite/upgrades/231_task_result_deliveries.sql +32 -0
  260. package/dist/src/storage/sqlite/upgrades/232_personal_requests.sql +28 -0
  261. package/dist/src/storage/sqlite/upgrades/233_observability_usage_links.sql +3 -0
  262. package/dist/src/storage/sqlite/upgrades/234_task_result_reply.sql +14 -0
  263. package/dist/src/storage/sqlite/upgrades/235_personal_conversation_priority.sql +3 -0
  264. package/dist/src/storage/sqlite/upgrades/236_personal_proactivity.sql +53 -0
  265. package/dist/src/storage/sqlite/upgrades/237_personal_strategy_versions.sql +18 -0
  266. package/dist/src/storage/sqlite/upgrades/238_browser_record_replay.sql +45 -0
  267. package/dist/src/storage/sqlite/upgrades/239_clarification_notifications.sql +26 -0
  268. package/dist/src/storage/sqlite/upgrades/240_device_settings.sql +5 -0
  269. package/dist/src/storage/sqlite/upgrades/241_device_grant_audit.sql +13 -0
  270. package/dist/src/storage/sqlite/upgrades/242_cloud_usage_receipts.sql +5 -0
  271. package/dist/src/storage/sqlite/upgrades/243_voice_opening_greetings.sql +12 -0
  272. package/dist/src/storage/sqlite/upgrades/244_device_request_proofs.sql +8 -0
  273. package/dist/src/storage/sqlite/upgrades/245_memory_learning.sql +125 -0
  274. package/dist/src/storage/sqlite/upgrades/246_personal_session_thinking.sql +22 -0
  275. package/dist/src/storage/sqlite/upgrades/247_agent_selection_records.sql +32 -0
  276. package/dist/src/storage/sqlite/upgrades/248_next_turn_suggestions.sql +20 -0
  277. package/dist/src/storage/sqlite/upgrades/249_task_allocations.sql +17 -0
  278. package/dist/src/storage/sqlite/upgrades/250_research_checkpoints.sql +15 -0
  279. package/dist/src/storage/sqlite/upgrades/251_personal_result_reads.sql +40 -0
  280. package/dist/src/storage/sqlite/upgrades/252_task_work_revisions.sql +15 -0
  281. package/dist/src/storage/sqlite/upgrades/253_discussion_processing_recovery.sql +20 -0
  282. package/dist/src/storage/sqlite/upgrades/254_discussion_annotations.sql +17 -0
  283. package/dist/src/storage/sqlite/upgrades/255_discussion_chapter_progress.sql +10 -0
  284. package/dist/src/storage/sqlite/upgrades/256_task_main_update_retries.sql +21 -0
  285. package/dist/src/storage/sqlite/upgrades/257_session_composer_history.sql +11 -0
  286. package/dist/src/storage/sqlite/upgrades/258_task_phase_changes.sql +20 -0
  287. package/dist/src/storage/sqlite/upgrades/259_personal_default_style.sql +10 -0
  288. package/dist/src/storage/sqlite/upgrades/260_browser_setup.sql +9 -0
  289. package/dist/src/storage/sqlite/windows-database-owners.js +33 -28
  290. package/dist/src/tasks/capabilities/relations.d.ts +2 -2
  291. package/dist/src/tui/clipboard-image.js +1 -1
  292. package/dist/src/tui/tui.js +1 -1
  293. package/dist/src/utils/index.js +1 -1
  294. package/dist/src/utils/logger/index.js +1 -1
  295. package/dist/src/utils/logger.js +1 -1
  296. package/dist/src/work-discovery/probe.js +1 -1
  297. package/package.json +3 -3
  298. package/skills/tools/configure-xopc/SKILL.md +47 -0
  299. package/skills/tools/configure-xopc/references/browser/acceptance.md +31 -0
  300. package/skills/tools/configure-xopc/references/browser/chrome-extension.md +19 -0
  301. package/skills/tools/configure-xopc/references/browser/overview.md +22 -0
  302. package/skills/tools/configure-xopc/references/browser/permissions.md +25 -0
  303. package/skills/tools/configure-xopc/references/browser/troubleshooting.md +24 -0
  304. package/skills/tools/configure-xopc/references/phone/acceptance.md +25 -0
  305. package/skills/tools/configure-xopc/references/phone/aliyun.md +29 -0
  306. package/skills/tools/configure-xopc/references/phone/dependencies.md +18 -0
  307. package/skills/tools/configure-xopc/references/phone/local.md +19 -0
  308. package/skills/tools/configure-xopc/references/phone/models.md +18 -0
  309. package/skills/tools/configure-xopc/references/phone/overview.md +30 -0
  310. package/skills/tools/configure-xopc/references/phone/troubleshooting.md +24 -0
  311. package/skills/tools/configure-xopc/references/scene-index.md +12 -0
  312. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-mf0jgEPE.js +0 -1
  313. package/dist/gateway/static/root/assets/agents-CKhZ4UYQ.js +0 -77
  314. package/dist/gateway/static/root/assets/apps-page-BZ_MaQJf.js +0 -1
  315. package/dist/gateway/static/root/assets/automations-workspace-CHUDHNVL.js +0 -8
  316. package/dist/gateway/static/root/assets/browser-automations-page-DStDm9y1.js +0 -3
  317. package/dist/gateway/static/root/assets/browser-settings-page-6I4oetKt.js +0 -3
  318. package/dist/gateway/static/root/assets/capabilities-page-C-EecWbS.js +0 -2
  319. package/dist/gateway/static/root/assets/capabilities-settings-panel-BQoCPk3x.js +0 -8
  320. package/dist/gateway/static/root/assets/channels-BKf_-Mdt.js +0 -1
  321. package/dist/gateway/static/root/assets/connectors-page-CUBg8spT.js +0 -1
  322. package/dist/gateway/static/root/assets/device-pairing-wizard-PmP_vGem.js +0 -1
  323. package/dist/gateway/static/root/assets/gateway-realtime-DMAzNlm-.js +0 -1
  324. package/dist/gateway/static/root/assets/gateway-realtime-store-CoIgC1Al.js +0 -1
  325. package/dist/gateway/static/root/assets/gateway-settings-DnrQ28E2.js +0 -1
  326. package/dist/gateway/static/root/assets/highlight-code-AMjU04kR.js +0 -1
  327. package/dist/gateway/static/root/assets/home-page-pTwVME-g.js +0 -2
  328. package/dist/gateway/static/root/assets/index-BLL0wKRZ.css +0 -1
  329. package/dist/gateway/static/root/assets/index-ygkHNYyo.js +0 -710
  330. package/dist/gateway/static/root/assets/local-app-workbench-page-Cwl6EvuX.js +0 -1
  331. package/dist/gateway/static/root/assets/logs-page-CS3hcTOq.js +0 -2
  332. package/dist/gateway/static/root/assets/management-settings-DC-Y_-GP.js +0 -1
  333. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-vckgHpON.js +0 -1
  334. package/dist/gateway/static/root/assets/note-detail-panel-C7u4dxEk.js +0 -5
  335. package/dist/gateway/static/root/assets/note-image-lightbox-jvqYtySx.js +0 -1
  336. package/dist/gateway/static/root/assets/notes-page-Bs7F5Hpf.js +0 -8
  337. package/dist/gateway/static/root/assets/page-context-capture-button-DO_yhXS1.js +0 -1
  338. package/dist/gateway/static/root/assets/personal-page-BexL2-PQ.js +0 -1
  339. package/dist/gateway/static/root/assets/personal-settings-panel-BKA4fbYH.js +0 -1
  340. package/dist/gateway/static/root/assets/phone-dependencies-card-ChFtdFhA.js +0 -1
  341. package/dist/gateway/static/root/assets/phone-model-picker-CZoIAQ1j.js +0 -1
  342. package/dist/gateway/static/root/assets/phone-settings-page-DRyK0nHH.js +0 -1
  343. package/dist/gateway/static/root/assets/plugin-details-dialog-B-N61jJH.js +0 -1
  344. package/dist/gateway/static/root/assets/project-detail-page-DtKmFBml.js +0 -7
  345. package/dist/gateway/static/root/assets/projects-page-CFZIz9mc.js +0 -1
  346. package/dist/gateway/static/root/assets/remote-access-hub-CWEc7W0m.js +0 -1
  347. package/dist/gateway/static/root/assets/runtime-tools-settings-panel-q_oswAdV.js +0 -1
  348. package/dist/gateway/static/root/assets/sessions-page-BuPqNxpd.js +0 -1
  349. package/dist/gateway/static/root/assets/settings-advanced-gate-QTVDCGJG.js +0 -1
  350. package/dist/gateway/static/root/assets/settings-page-header-CYpuTXUW.js +0 -1
  351. package/dist/gateway/static/root/assets/setup-status-panel-ZmlE8jIE.js +0 -1
  352. package/dist/gateway/static/root/assets/shares-settings-CtNxWqW-.js +0 -1
  353. package/dist/gateway/static/root/assets/skill-reload-api-Egaf8PqZ.js +0 -1
  354. package/dist/gateway/static/root/assets/skills-page-C6FKxf4J.js +0 -2
  355. package/dist/gateway/static/root/assets/system-settings-panel-Baxkhov7.js +0 -1
  356. package/dist/gateway/static/root/assets/task-detail-page-C77-rpkt.js +0 -2
  357. package/dist/gateway/static/root/assets/usage-page-BFeIbpbi.js +0 -1
  358. package/dist/gateway/static/root/assets/user-model-page-u8zY5jea.js +0 -2
  359. package/dist/gateway/static/root/assets/xopc-cloud-account-card-CJ_akAvc.js +0 -1
@@ -0,0 +1,5 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-B50rU9tL.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-DRyGCING.js","assets/preload-helper-zJ_50EbN.js","assets/es2015-DBLcMg5B.js","assets/vendor-react-BOUWij0V.js","assets/dist-CxGUk8J-.js","assets/middleware-Pd0e8Igk.js","assets/locale-store-B7s2Hb35.js","assets/messages-BYq0cPbn.js","assets/dist-CI_fqRk-.js","assets/floating-ui.dom-B7uQOZZW.js","assets/chunk-KS7C4IRE-BvcCCgTW.js","assets/vendor-swr-BIWyz7Rc.js","assets/createLucideIcon-DPHK1VkS.js","assets/app-window-DXFNqt_0.js","assets/check-DUBLcKHA.js","assets/chevron-down-ccbiQQz_.js","assets/popover-select-DGKUpVsz.js","assets/dist-C3DSFZCi.js","assets/skeleton-BI5TyibZ.js","assets/cn-0WouolD0.js","assets/bundle-mjs-rHxsej31.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/circle-check-C23XjkUj.js","assets/copy-Dv6d4Dvw.js","assets/download-Dk-ZjtO6.js","assets/ellipsis-0k4rZLoy.js","assets/external-link-DjqjBmc3.js","assets/eye-CABVeTq0.js","assets/file-image-CDUPkZvG.js","assets/folder-open-CyzJ19I9.js","assets/globe-DSSGFWFn.js","assets/loader-circle-CifKLtgG.js","assets/refresh-cw-BRlGaq2w.js","assets/wrench-DFb4r8bH.js","assets/session-manager-B_h0jlLb.js","assets/schemas-CObaziC7.js","assets/gateway-realtime-C52ghnBK.js","assets/gateway-realtime-store-Bx9KCID-.js","assets/local-session-drafts-iGX_6O0O.js","assets/session-api-DdQnMwkl.js","assets/gateway-startup-retry-Cfwxof4k.js","assets/personal-proactivity-BJcZ3Yhi.js","assets/constants-DeXt1mV-.js","assets/tool-activity-BtJkgjFf.js","assets/registry-api-BcfoLEna.js","assets/attachment-utils-core-BIOUBrpT.js","assets/agents-admin-api-B1p-ghg9.js","assets/gateway-config-swr-fQKBHBi1.js","assets/capabilities-BlxF36t-.js","assets/local-apps-yys1VChX.js","assets/tasks-TVRjEggr.js","assets/specialists-4bkS5rZ4.js","assets/product-delivery-BqNm-8S5.js","assets/files-Bw4SBGdM.js","assets/button-aIC072nz.js","assets/sliding-indicator-hwz0sx3h.js","assets/runtime-tools-api-DesqGCnE.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/electron-env-Dit0bHgy.js","assets/index-Cy16gQST.css","assets/vendor-codemirror-Qdcjid65.js","assets/with-selector-aYPsXwdl.js","assets/note-image-lightbox-D5GH2wuC.js","assets/block-editor-Cvy3D_4T.css","assets/markdown-editor-phTQ0mox.js","assets/languages-byq_L2Ae.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-zJ_50EbN.js";import{l as a,t as o,u as s}from"./chunk-KS7C4IRE-BvcCCgTW.js";import{t as c}from"./check-DUBLcKHA.js";import{t as l}from"./chevron-down-ccbiQQz_.js";import{n as u,r as d}from"./popover-select-DGKUpVsz.js";import{t as f}from"./circle-check-C23XjkUj.js";import{t as p}from"./copy-Dv6d4Dvw.js";import{t as m}from"./download-Dk-ZjtO6.js";import{t as h}from"./ellipsis-0k4rZLoy.js";import{t as g}from"./external-link-DjqjBmc3.js";import{t as _}from"./eye-CABVeTq0.js";import{t as v}from"./loader-circle-CifKLtgG.js";import{t as y}from"./refresh-cw-BRlGaq2w.js";import{t as b}from"./messages-BYq0cPbn.js";import{t as x}from"./cn-0WouolD0.js";import{f as S,i as C,l as w,n as T,o as E,p as D}from"./locale-store-B7s2Hb35.js";import{t as O}from"./session-manager-B_h0jlLb.js";import{t as k}from"./copy-to-clipboard-HOJ79TWv.js";import{i as A}from"./vendor-swr-BIWyz7Rc.js";import{t as j}from"./button-aIC072nz.js";import{t as M}from"./skeleton-BI5TyibZ.js";import{a as N,i as P,o as F,s as I}from"./dist-C3DSFZCi.js";import{Ai as L,Bc as R,Cr as z,Di as B,Dl as ee,Ei as te,Eo as ne,Ga as re,Gc as ie,Gr as V,Hc as ae,Hr as H,Is as U,Kl as oe,Lo as se,Ls as ce,Ml as le,Nc as ue,Ni as de,Pi as W,Sr as fe,Tr as pe,Uc as me,Ur as G,Vc as he,Wc as ge,Wr as _e,Wu as ve,Xd as K,Yd as ye,Zc as be,Zl as xe,_l as Se,a as Ce,aa as we,ad as q,an as J,ar as Te,br as Y,c as X,ca as Ee,co as De,cr as Oe,d as ke,da as Ae,dn as je,dr as Me,er as Ne,fa as Pe,fn as Fe,fr as Ie,gu as Le,i as Re,in as ze,ir as Be,jt as Ve,ku as He,la as Ue,ll as We,lr as Ge,mn as Z,mr as Ke,nn as qe,o as Je,or as Ye,pa as Xe,pn as Ze,rn as Qe,rr as $e,s as et,sl as tt,sr as nt,tn as rt,tr as it,u as at,ua as ot,ul as st,vd as ct,vr as lt,xl as ut,xr as dt,yl as ft,yr as pt,zc as mt}from"./index-DRyGCING.js";import"./note-image-lightbox-D5GH2wuC.js";import{t as ht}from"./page-context-capture-button-DusR2Itk.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=T(Dt),d=b(u).automations.suggestions,p=b(u).automations,m=s(),h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h={revalidateOnFocus:!1,refreshInterval:15e3},t[0]=h):h=t[0];let{data:g}=A(a?`automation-suggestion-coverage`:null,Et,h),_=a?g?.automations.find(e=>et(e,a)):void 0,v=_?Ce(_,p):[];if(l===`titleAction`){if(_){let e;t[1]===o?e=t[2]:(e=x(`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)(f,{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]===m?r=t[5]:(r=()=>m(`/automations`),t[4]=m,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:d.coveredTitle}),(0,$.jsx)(j,{variant:`ghost`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:r,children:d.manage})]})}let e;t[6]===o?e=t[7]:(e=x(`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)(He,{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]!==m||t[13]!==i?(c=()=>{m(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[12]=m,t[13]=i,t[14]=c):c=t[14];let l;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(ut,{className:`size-3.5`,"aria-hidden":!0}),t[15]=l):l=t[15],(0,$.jsxs)(`section`,{className:e,children:[a,s,(0,$.jsxs)(j,{variant:`secondary`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:c,children:[l,d.setup]})]})}if(_){let e;t[16]===o?e=t[17]:(e=x(`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)(f,{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]===m?r=t[20]:(r=()=>m(`/automations`),t[19]=m,t[20]=r);let i;return t[21]!==d||t[22]!==r?(i=(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsx)(j,{variant:`ghost`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:r,children:d.manage})}),t[21]=d,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:d.coveredTitle}),(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:Je(d.coveredDescription,{name:_.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:v.map(Tt)})]}),i]})}let y;t[24]===o?y=t[25]:(y=x(`rounded-lg bg-surface-panel p-3 shadow-surface`,o),t[24]=o,t[25]=y);let S;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,$.jsx)(He,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[26]=S):S=t[26];let C;t[27]===n?C=t[28]:(C=(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n}),t[27]=n,t[28]=C);let w;t[29]===r?w=t[30]:(w=(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:r}),t[29]=r,t[30]=w);let E;t[31]!==C||t[32]!==w?(E=(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[S,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[C,w]})]}),t[31]=C,t[32]=w,t[33]=E):E=t[33];let D;t[34]!==m||t[35]!==i?(D=()=>{m(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[34]=m,t[35]=i,t[36]=D):D=t[36];let O;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,$.jsx)(ut,{className:`size-3.5`,"aria-hidden":!0}),t[37]=O):O=t[37];let k;t[38]!==d.create||t[39]!==D?(k=(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsxs)(j,{variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:D,children:[O,d.create]})}),t[38]=d.create,t[39]=D,t[40]=k):k=t[40];let M;return t[41]!==k||t[42]!==y||t[43]!==E?(M=(0,$.jsxs)(`section`,{className:y,children:[E,k]}),t[41]=k,t[42]=y,t[43]=E,t[44]=M):M=t[44],M}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 X.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:l,onOrganize:f,onRegenerate:p,onPersonalNotes:g,noteActions:_}=e,[v,b]=(0,Q.useState)(!1),x;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(x=e=>{b(!1),e()},t[0]=x):x=t[0];let S=x,w=`/api/discussions/${encodeURIComponent(n.discussion.id)}`,T=!!n.discussion.audioAttachmentId&&!n.discussion.audioDeletedAt,E=a?`更多笔记操作`:`More note actions`,D;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,$.jsx)(h,{className:`size-5`,"aria-hidden":!0}),t[1]=D):D=t[1];let O;t[2]===E?O=t[3]:(O=(0,$.jsx)(I,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,"aria-label":E,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:D})}),t[2]=E,t[3]=O);let k=a?`笔记工具`:`Note tools`,A;t[4]!==g||t[5]!==a?(A=g?(0,$.jsxs)(j,{className:`min-h-11 w-full justify-start`,onClick:()=>S(g),children:[(0,$.jsx)(ft,{className:`size-4`}),a?`添加我的补充`:`Add my notes`]}):null,t[4]=g,t[5]=a,t[6]=A):A=t[6];let M;t[7]!==_||t[8]!==a?(M=_?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(j,{className:`min-h-11 w-full justify-start`,disabled:_.busy,onClick:()=>S(_.onAnalyze),children:[(0,$.jsx)(ut,{className:`size-4`}),a?`进一步分析`:`Analyze this note`]}),(0,$.jsxs)(j,{className:`min-h-11 w-full justify-start`,disabled:_.busy,onClick:()=>S(_.onChat),children:[(0,$.jsx)(Le,{className:`size-4`}),a?`就这篇笔记提问`:`Ask about this note`]})]}):null,t[7]=_,t[8]=a,t[9]=M):M=t[9];let L=a?`整理笔记`:`Organize notes`,R;t[10]===L?R=t[11]:(R=(0,$.jsx)(`p`,{className:`px-2 text-xs text-fg-muted`,children:L}),t[10]=L,t[11]=R);let z=a?`纪要模板`:`Summary template`,B;t[12]===i?B=t[13]:(B=e=>i(e.target.value),t[12]=i,t[13]=B);let ee=a?`通用会议`:`General`,te;t[14]===ee?te=t[15]:(te=(0,$.jsx)(d,{value:`general`,children:ee}),t[14]=ee,t[15]=te);let ne=a?`项目例会`:`Project`,re;t[16]===ne?re=t[17]:(re=(0,$.jsx)(d,{value:`project`,children:ne}),t[16]=ne,t[17]=re);let ie=a?`需求评审`:`Review`,V;t[18]===ie?V=t[19]:(V=(0,$.jsx)(d,{value:`review`,children:ie}),t[18]=ie,t[19]=V);let ae=a?`客户访谈`:`Interview`,H;t[20]===ae?H=t[21]:(H=(0,$.jsx)(d,{value:`interview`,children:ae}),t[20]=ae,t[21]=H);let U;t[22]!==z||t[23]!==B||t[24]!==te||t[25]!==re||t[26]!==V||t[27]!==H||t[28]!==r?(U=(0,$.jsxs)(u,{value:r,"aria-label":z,onChange:B,children:[te,re,V,H]}),t[22]=z,t[23]=B,t[24]=te,t[25]=re,t[26]=V,t[27]=H,t[28]=r,t[29]=U):U=t[29];let oe=o||s||!n.discussion.canonicalTranscript,se;t[30]===f?se=t[31]:(se=()=>S(f),t[30]=f,t[31]=se);let ce;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,$.jsx)(y,{className:`size-4`}),t[32]=ce):ce=t[32];let le=a?`重新整理纪要`:`Regenerate summary`,ue;t[33]!==oe||t[34]!==se||t[35]!==le?(ue=(0,$.jsxs)(j,{className:`min-h-11 w-full justify-start`,disabled:oe,onClick:se,children:[ce,le]}),t[33]=oe,t[34]=se,t[35]=le,t[36]=ue):ue=t[36];let de;t[37]!==T||t[38]!==o||t[39]!==n.discussion.status||t[40]!==p||t[41]!==s||t[42]!==a?(de=T&&[`completed`,`needs_attention`].includes(n.discussion.status)?(0,$.jsx)(j,{className:`min-h-11 w-full justify-start`,disabled:o||s,onClick:()=>S(p),children:a?`从原音重新生成`:`Regenerate from audio`}):null,t[37]=T,t[38]=o,t[39]=n.discussion.status,t[40]=p,t[41]=s,t[42]=a,t[43]=de):de=t[43];let W;t[44]!==U||t[45]!==ue||t[46]!==de||t[47]!==R?(W=(0,$.jsxs)(`div`,{className:`space-y-2 py-3`,children:[R,U,ue,de]}),t[44]=U,t[45]=ue,t[46]=de,t[47]=R,t[48]=W):W=t[48];let fe=a?`导出与分享`:`Export and share`,pe;t[49]===fe?pe=t[50]:(pe=(0,$.jsx)(`p`,{className:`px-2 text-xs text-fg-muted`,children:fe}),t[49]=fe,t[50]=pe);let me;t[51]!==T||t[52]!==w||t[53]!==a?(me=T?(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:C(`${w}/audio`),download:!0,children:[(0,$.jsx)(m,{className:`size-4`}),a?`下载录音`:`Download recording`]}):null,t[51]=T,t[52]=w,t[53]=a,t[54]=me):me=t[54];let G;t[55]!==_||t[56]!==a?(G=_?(0,$.jsx)(j,{className:`min-h-11 w-full justify-start`,disabled:_.busy,onClick:()=>S(_.onShare),children:a?`分享笔记`:`Share note`}):null,t[55]=_,t[56]=a,t[57]=G):G=t[57];let he;t[58]===w?he=t[59]:(he=(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:C(`${w}/export?format=${e}`),download:!0,children:e.toUpperCase()},e))}),t[58]=w,t[59]=he);let ge=n.note.id,_e=String(n.note.remoteVersion??1),ve;t[60]!==n.note.id||t[61]!==_e?(ve={kind:`note`,id:ge,revision:_e},t[60]=n.note.id,t[61]=_e,t[62]=ve):ve=t[62];let K;t[63]===c?K=t[64]:(K={text:c,draft:!1},t[63]=c,t[64]=K);let ye=a?`带到新对话`:`Use in a new chat`,be=o||s||l||!c||c.length>16e3,xe;t[65]!==ve||t[66]!==K||t[67]!==ye||t[68]!==be?(xe=(0,$.jsx)(ht,{resource:ve,selection:K,label:ye,disabled:be}),t[65]=ve,t[66]=K,t[67]=ye,t[68]=be,t[69]=xe):xe=t[69];let Se=c.length>16e3?a?`内容较长,请先筛选部分原文。`:`Filter the transcript to share a smaller selection.`:a?`分享当前显示的文字,不包含原音。`:`Shares displayed text, without audio.`,Ce;t[70]===Se?Ce=t[71]:(Ce=(0,$.jsx)(`p`,{className:`px-2 text-xs leading-5 text-fg-muted`,children:Se}),t[70]=Se,t[71]=Ce);let we;t[72]!==pe||t[73]!==me||t[74]!==G||t[75]!==he||t[76]!==xe||t[77]!==Ce?(we=(0,$.jsxs)(`div`,{className:`space-y-2 border-t border-edge-subtle py-3`,children:[pe,me,G,he,xe,Ce]}),t[72]=pe,t[73]=me,t[74]=G,t[75]=he,t[76]=xe,t[77]=Ce,t[78]=we):we=t[78];let q;t[79]!==_||t[80]!==a?(q=_?(0,$.jsxs)(`div`,{className:`space-y-1 border-t border-edge-subtle pt-2`,children:[(0,$.jsx)(j,{className:`min-h-11 w-full justify-start`,onClick:()=>S(_.onHistory),children:a?`版本历史`:`Version history`}),(0,$.jsx)(j,{className:`min-h-11 w-full justify-start text-danger`,disabled:_.busy,onClick:()=>S(_.onDelete),children:a?`删除笔记`:`Delete note`})]}):null,t[79]=_,t[80]=a,t[81]=q):q=t[81];let J;t[82]!==W||t[83]!==we||t[84]!==q||t[85]!==k||t[86]!==A||t[87]!==M?(J=(0,$.jsx)(N,{children:(0,$.jsxs)(P,{align:`end`,sideOffset:6,collisionPadding:12,"aria-label":k,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:[A,M,W,we,q]})}),t[82]=W,t[83]=we,t[84]=q,t[85]=k,t[86]=A,t[87]=M,t[88]=J):J=t[88];let Te;return t[89]!==v||t[90]!==O||t[91]!==J?(Te=(0,$.jsxs)(F,{open:v,onOpenChange:b,children:[O,J]}),t[89]=v,t[90]=O,t[91]=J,t[92]=Te):Te=t[92],Te}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[l,u]=(0,Q.useState)(),[d,f]=(0,Q.useState)(!0),[p,m]=(0,Q.useState)(``),[h,g]=(0,Q.useState)(!1),_=(0,Q.useRef)(0),[v,y]=(0,Q.useState)(),[b,x]=(0,Q.useState)(),[S,w]=(0,Q.useState)(``),[T,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)(()=>{x(void 0)},[e,t]),(0,Q.useEffect)(()=>{let n=++_.current,r=new AbortController;f(!0),g(!1),m(``);let a=window.setTimeout(()=>{E(C(`/api/discussions/${encodeURIComponent(e)}/review?q=${encodeURIComponent(t)}`),{signal:r.signal}).then(e=>{_.current===n&&(u(e),y(i),w(t))}).catch(e=>{_.current===n&&!r.signal.aborted&&m(String(e))}).finally(()=>{_.current===n&&f(!1)})},t?200:0);return()=>{_.current++,r.abort(),window.clearTimeout(a)}},[e,t,r,i,T]);async function O(){if(!l||h)return;let r=_.current;g(!0);try{let n=await E(C(`/api/discussions/${encodeURIComponent(e)}/review?q=${encodeURIComponent(t)}&offset=${l.hits.length}&version=${l.version}`));r===_.current&&u({...n,hits:[...l.hits,...n.hits]})}catch(e){r===_.current&&m(n?`内容已变化,请重新搜索。${String(e)}`:`Content changed; search again. ${String(e)}`)}finally{g(!1)}}function k(e){x(e),(!e.provisional||e.kind===`chapter`)&&e.transcriptRevision!==void 0&&e.segments.length&&s({transcriptRevision:e.transcriptRevision,stale:e.stale,audioAvailable:l?.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`,N=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||b?.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)(j,{onClick:()=>c(e.startedAtMs,e.endedAtMs),children:[n?`回听上下文`:`Play context`,` `,kt(e.startedAtMs),`–`,kt(e.endedAtMs)]},t)),e.segments.length?(0,$.jsx)(j,{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:[p?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:p}),(0,$.jsx)(j,{onClick:()=>D(e=>e+1),children:n?`刷新结果`:`Refresh results`})]}):null,d&&(!l||v!==i||S!==t)?(0,$.jsx)(M,{className:`h-20 w-full`}):null,l&&v===i&&(!t||S===t)?(0,$.jsxs)($.Fragment,{children:[t?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium`,children:n?`搜索结果 · ${l.total}`:`Search results · ${l.total}`}),(0,$.jsx)(j,{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:l.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,l.coverage.durationMs))}%`},"aria-label":`${kt(e.startedAtMs)} ${e.title||A(e)}`,onClick:()=>k(e)},e.id))}),l.total?null:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n?`未找到关键词;尚未转写的内容无法搜索。`:`No matches. Untranscribed audio is not searchable yet.`}),l.hits.map(N)]}):(0,$.jsxs)($.Fragment,{children:[o===`summary`&&l.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`,` · `,l.chapters.length]}),(0,$.jsx)(`div`,{className:`space-y-3 pb-4`,children:l.chapters.map(N)})]}):null,l.hits.length?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium`,children:n?`本轮已完成转写(阶段性)`:`Available transcription from this run`}),l.hits.map(N)]}):null]}),l.hasMore?(0,$.jsx)(j,{disabled:h,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`,` · `,l.coverage.audioAvailable?n?`已保存,可回听`:`Saved, ready to play`:n?`尚不可用`:`Unavailable`]}),(0,$.jsxs)(`p`,{children:[n?`本轮转写已处理`:`Processed this run`,` `,kt(l.coverage.processedMs),` / `,kt(l.coverage.durationMs),` · `,n?`连续处理至`:`Continuous through`,` `,kt(l.coverage.continuousThroughMs)]}),(0,$.jsxs)(`p`,{children:[n?`分析覆盖`:`Analysis coverage`,` · `,l.coverage.analysisRanges.length?l.coverage.analysisRanges.map(e=>`${kt(e.startedAtMs)}–${kt(e.endedAtMs)}`).join(`、`):n?`暂无本版已完成章节`:`No completed chapters for this revision`,l.coverage.analysisStale?n?`;已发布分析基于旧版原文`:`; published analysis uses an earlier transcript`:``,` · `,l.coverage.complete?n?`本轮处理完成`:`Run complete`:n?`阶段性内容,其余仍待处理`:`Partial content; remaining work pending`]})]})]}),b?.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}=A(`/api/discussions/${t}/annotations`,e=>E(C(e))),[s,c]=(0,Q.useState)([]),[l,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(``),_=(0,Q.useCallback)(async()=>{c(await Qe(e))},[e]),v=(0,Q.useCallback)(async()=>{try{await rt(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 J(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)(j,{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)(j,{disabled:!e.evidence,onClick:()=>e.evidence&&r(e.evidence),children:n?`查看原文`:`View transcript`}),e.playback.map((e,t)=>(0,$.jsxs)(j,{onClick:()=>i(e),children:[n?`回听`:`Play`,` `,Math.floor(e.startedAtMs/6e4),`:`,String(Math.floor(e.startedAtMs/1e3)%60).padStart(2,`0`)]},t)),(0,$.jsx)(j,{onClick:()=>{f(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)(j,{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)(j,{onClick:()=>{let t=s.find(t=>t.annotation.id===e.annotation.id),n=a.find(t=>t.annotation.id===e.annotation.id);t&&n&&qe(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)(u,{value:p.kind,"aria-label":n?`标记类型`:`Highlight type`,onChange:e=>m({...p,kind:e.target.value}),children:[(0,$.jsx)(d,{value:`highlight`,children:n?`重点`:`Highlight`}),(0,$.jsx)(d,{value:`question`,children:n?`问题`:`Question`}),(0,$.jsx)(d,{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)(j,{onClick:()=>void b(p,l),children:n?`保存到本机并同步`:`Save locally and sync`}),(0,$.jsx)(j,{onClick:()=>m(null),children:n?`取消`:`Cancel`})]}):null]})}var Mt={tab:`summary`,query:``,page:1,positionMs:0},Nt=D((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)(me,{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)(ie,{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 h=r?`内容`:`Content`,g;t[8]===s?g=t[9]:(g=e=>c({...s,text:e.target.value}),t[8]=s,t[9]=g);let _;t[10]!==s.text||t[11]!==g?(_=(0,$.jsx)(`textarea`,{className:`mt-1 min-h-32 w-full rounded border border-edge bg-transparent p-2`,value:s.text,onChange:g}),t[10]=s.text,t[11]=g,t[12]=_):_=t[12];let v;t[13]!==h||t[14]!==_?(v=(0,$.jsxs)(`label`,{className:`block text-sm`,children:[h,_]}),t[13]=h,t[14]=_,t[15]=v):v=t[15];let y;t[16]!==s||t[17]!==r?(y=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]=y):y=t[18];let b;t[19]!==s||t[20]!==r?(b=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]=b):b=t[21];let x;t[22]!==v||t[23]!==y||t[24]!==b||t[25]!==m?(x=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-4`,children:[m,v,y,b]}),t[22]=v,t[23]=y,t[24]=b,t[25]=m,t[26]=x):x=t[26];let S=r?`取消`:`Cancel`,C;t[27]!==i||t[28]!==a||t[29]!==S?(C=(0,$.jsx)(j,{disabled:i,onClick:a,children:S}),t[27]=i,t[28]=a,t[29]=S,t[30]=C):C=t[30];let w;t[31]!==i||t[32]!==s.text?(w=i||!s.text.trim(),t[31]=i,t[32]=s.text,t[33]=w):w=t[33];let T;t[34]!==s||t[35]!==o?(T=()=>void o(s),t[34]=s,t[35]=o,t[36]=T):T=t[36];let E=r?`保存修改`:`Save changes`,D;t[37]!==w||t[38]!==T||t[39]!==E?(D=(0,$.jsx)(j,{variant:`primary`,disabled:w,onClick:T,children:E}),t[37]=w,t[38]=T,t[39]=E,t[40]=D):D=t[40];let O;t[41]!==C||t[42]!==D?(O=(0,$.jsxs)(`footer`,{className:`flex justify-end gap-2 border-t border-edge p-3`,children:[C,D]}),t[41]=C,t[42]=D,t[43]=O):O=t[43];let k;t[44]!==x||t[45]!==O||t[46]!==f?(k=(0,$.jsxs)(ge,{children:[u,(0,$.jsxs)(he,{"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,x,O]})]}),t[44]=x,t[45]=O,t[46]=f,t[47]=k):k=t[47];let A;return t[48]!==l||t[49]!==k?(A=(0,$.jsx)(mt,{open:!0,onOpenChange:l,children:k}),t[48]=l,t[49]=k,t[50]=A):A=t[50],A}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=T(e=>e.language)===`zh`,{data:s,mutate:l,isLoading:u}=A([`note-discussion-document`,e],()=>je(e),{refreshInterval:e=>e&&([`recording`,`stopping`,`sealing`,`organizing`].includes(e.discussion.status)||e.recordingJob?.state===`queued`||e.recordingJob?.state===`running`)?3e3:0}),d=s?.discussion.id,f=`/api/discussions/${encodeURIComponent(d??``)}`,{data:p=[],mutate:m}=A(d?`${f}/actions`:null,e=>E(C(e)),{refreshInterval:1e4}),h=Nt(t=>Ft(e,t.notes[e])),g=Nt(e=>e.update),_=h.tab,v=t=>g(e,{tab:t}),y=h.query,b=t=>g(e,{query:t}),[x,S]=(0,Q.useState)(!1),w=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{x&&w.current?.focus()},[x]);let[D,O]=(0,Q.useState)(`general`),[k,N]=(0,Q.useState)(null),[P,F]=(0,Q.useState)(null),[I,L]=(0,Q.useState)(null),[R,z]=(0,Q.useState)(!1),[B,ee]=(0,Q.useState)([]),[te,ne]=(0,Q.useState)(null),[V,ae]=(0,Q.useState)(!1),H=h.page,U=t=>g(e,{page:t}),se=(0,Q.useRef)(null),[ce,de]=(0,Q.useState)([]),W=(0,Q.useRef)(0),fe=(0,Q.useRef)(0),pe=(0,Q.useRef)(s?.transcript.revision);pe.current=s?.transcript.revision;let G=(0,Q.useRef)(null),_e=(0,Q.useRef)(null),[,ve]=(0,Q.useState)(0);(0,Q.useEffect)(()=>{let e=()=>{l(),m()};return window.addEventListener(`discussion-updated`,e),window.addEventListener(`discussion-segment-updated`,e),()=>{window.removeEventListener(`discussion-updated`,e),window.removeEventListener(`discussion-segment-updated`,e)}},[l,m]),(0,Q.useEffect)(()=>{s?.discussion.template&&O(s.discussion.template)},[s?.discussion.template]);async function K(e){if(!V){ae(!0),ne(null);try{await e(),await l(),await m()}catch(e){ne(e instanceof Error?e.message:String(e))}finally{ae(!1)}}}function ye(e,t){G.current&&(se.current=t??null,G.current.readyState===0?(_e.current=e/1e3,G.current.load()):(G.current.currentTime=e/1e3,G.current.play().catch(()=>void 0)))}function xe(e){let t=e.stale||e.transcriptRevision!==pe.current;N({...e,stale:t}),t||de(e.segments.map(e=>e.sequence))}async function Se(e,t,n=!1){if(!s)return;let r=W.current,i=++fe.current;await K(async()=>{let a=await E(C(`${f}/evidence?revision=${t??s.organization?.transcriptRevision??s.transcript.revision}&segments=${e.join(`,`)}`));if(!(r!==W.current||i!==fe.current)&&(xe(a),n&&a.segments[0]?.playback[0])){let e=a.segments[0].playback[0];ye(e.startedAtMs,e.endedAtMs)}})}async function Ce(e){s&&await K(async()=>{await J(s.discussion.clientRequestId,ze({type:`transcript`,capturedAt:Date.now(),transcriptRevision:s.transcript.revision,segmentIds:[e.sequence]})),v(`marks`),rt(s.discussion.clientRequestId,s.discussion.id).catch(e=>ne(String(e)))})}(0,Q.useEffect)(()=>(W.current++,N(null),de([]),F(null),L(null),ee([]),ne(null),se.current=null,()=>{W.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?(W.current++,N(null),de([]),G.current?.pause(),g(e,{positionMs:0,source:t}),_e.current=0,se.current=null):g(e,{source:t})},[e,s?.discussion.audioSha256,s?.discussion.audioAttachmentId,g]),(0,Q.useEffect)(()=>{s?.discussion.audioDeletedAt&&(G.current?.pause(),_e.current=null,se.current=null,N(e=>e?{...e,audioAvailable:!1,timingVerified:!1,segments:e.segments.map(e=>({...e,playback:[]}))}:null))},[s?.discussion.audioDeletedAt]),(0,Q.useEffect)(()=>{h.tab===`transcript`&&h.anchor!==void 0&&h.anchorRevision===s?.transcript.revision&&window.setTimeout(()=>document.getElementById(`discussion-segment-${h.anchor}`)?.scrollIntoView?.({block:`center`}),0)},[h.tab,h.anchor,h.anchorRevision,s?.transcript.revision]),(0,Q.useEffect)(()=>{de([]),N(e=>e&&e.transcriptRevision!==s?.transcript.revision?{...e,stale:!0}:e)},[s?.transcript.revision]);let we=(e,t,n)=>t.some(e=>R||!e.ignored)?(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsx)(`h3`,{className:`font-semibold text-fg`,children:e}),t.filter(e=>R||!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:V,onClick:()=>L({kind:n,itemId:e.id,text:e.text,ignored:e.ignored}),children:i?`编辑`:`Edit`}),e.evidenceSegmentIds.length?(0,$.jsx)(`button`,{disabled:V,className:`shrink-0 text-accent-fg`,onClick:()=>void Se(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)(M,{className:`h-48 w-full`});if(!s)return null;let{discussion:q,transcript:Te,organization:Y}=s,X=Y?.organization,Ee=[`stopping`,`sealing`,`organizing`].includes(q.status),De=[`recording`,`completed`,`needs_attention`].includes(q.status),Oe=Te.segments.filter(e=>(e.displayText??e.rawText??``).toLocaleLowerCase().includes(y.toLocaleLowerCase())||e.speakerLabel?.toLocaleLowerCase().includes(y.toLocaleLowerCase())),ke=_===`marks`||y.trim()?``:Lt(s,_,{query:y,page:H,showIgnored:R});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(),S(!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(q.durationMs??0)]})]}),(0,$.jsx)(`button`,{type:`button`,"aria-label":i?`搜索此 Note`:`Search this Note`,"aria-expanded":x||!!y,onClick:()=>{S(e=>!e),x&&b(``)},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)(le,{className:`size-5`,"aria-hidden":!0})}),(0,$.jsx)(Ot,{noteActions:n,detail:s,template:D,onTemplate:O,zh:i,busy:V,processing:Ee,pageText:ke,editing:!!I||!!P,onPersonalNotes:t,onOrganize:()=>void K(()=>E(C(`${f}/organize`),{method:`POST`,body:JSON.stringify({template:D})})),onRegenerate:()=>void K(()=>Fe(q.id,`from_audio`))})]}),(0,$.jsx)(re,{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":_===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 ${_===e?`bg-surface-panel font-medium text-fg shadow-sm`:`text-fg-muted hover:text-fg`}`,onClick:()=>v(e),children:e===`summary`?i?`概览`:`Overview`:e===`marks`?i?`标记`:`Highlights`:i?`原文`:`Transcript`},e))}),te?(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:te})]}):null,x||y?(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)(le,{className:`size-4 text-fg-muted`}),(0,$.jsx)(`input`,{ref:w,"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:y,onChange:e=>{b(e.target.value),U(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:()=>{b(``),S(!1)},children:(0,$.jsx)(be,{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:[q.status!==`recording`||s.recordingJob?(0,$.jsx)(Ze,{context:`note`,input:Z(s),zh:i,busy:V,onRetry:e=>void K(()=>e===`analyze`?E(C(`${f}/organize`),{method:`POST`,body:JSON.stringify({template:D})}):Fe(q.id,e===`regenerate`?`from_audio`:`resume`))}):null,(0,$.jsx)(`div`,{hidden:!!y.trim(),children:_===`marks`?(0,$.jsx)(jt,{recordingId:q.clientRequestId,discussionId:q.id,zh:i,onEvidence:xe,onPlay:e=>ye(e.startedAtMs,e.endedAtMs)},q.id):_===`summary`?X?(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:V||Ee,onClick:()=>L({kind:`summary`,itemId:`summary`,text:X.summary}),children:(0,$.jsx)(ft,{className:`size-4`,"aria-hidden":!0})})]}),(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-[15px] leading-7`,children:X.summary}),X.summaryEditedByUser?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i?`已由你编辑`:`Edited by you`}):null,X.summaryEvidenceSegmentIds?.length?Array.from({length:Math.ceil(X.summaryEvidenceSegmentIds.length/100)},(e,t)=>(0,$.jsxs)(j,{onClick:()=>void Se(X.summaryEvidenceSegmentIds.slice(t*100,(t+1)*100)),children:[i?`查看原话`:`View source`,X.summaryEvidenceSegmentIds.length>100?` · ${t+1}`:``]},t)):null,X.keyPointEvidence?.length?(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsx)(`h3`,{children:i?`重点结论`:`Key points`}),X.keyPointEvidence.map(e=>(0,$.jsxs)(`div`,{className:`flex gap-2 text-sm`,children:[(0,$.jsx)(`p`,{className:`flex-1`,children:e.text}),(0,$.jsx)(j,{onClick:()=>void Se(e.evidenceSegmentIds,e.evidenceRevision),children:i?`原话`:`Source`})]},e.id))]}):X.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:X.keyPoints.map((e,t)=>(0,$.jsx)(`li`,{children:e},`${t}:${e}`))})]}):null,[...X.decisions,...X.actionItems,...X.risks,...X.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:R,onChange:e=>z(e.target.checked)}),i?`显示已忽略项`:`Show ignored items`]}):null,B.length?(0,$.jsx)(j,{disabled:V,onClick:()=>void K(async()=>{for(let e of B)await E(C(`${f}/actions/${encodeURIComponent(e)}/convert`),{method:`POST`,body:JSON.stringify({organizationRevision:Y.revision})});ee([])}),children:i?`加入所选 ${B.length} 项任务`:`Add ${B.length} selected tasks`}):null,we(i?`已决定事项`:`Decisions`,X.decisions,`decisions`),X.actionItems.length?(0,$.jsxs)(`section`,{className:`space-y-3`,children:[(0,$.jsx)(`h3`,{className:`font-semibold`,children:i?`下一步行动`:`Next actions`}),X.actionItems.filter(e=>R||!e.ignored).map(e=>{let t=p.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:B.includes(e.id),onChange:t=>ee(t.target.checked?[...B,e.id]:B.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:V||Ee,onClick:()=>L({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:V,className:`text-accent-fg`,onClick:()=>void Se(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:ue(`${r.pathname}${r.search}`,t.taskId),children:t.resolution===`done`?i?`已完成 · 查看任务`:`Done · View task`:i?`查看任务 / 交给助手`:`View task / Delegate`}):e.ignored?null:(0,$.jsx)(j,{disabled:V||!!(e.supersededBy||e.disputedBy)&&e.reviewedChangeId!==(e.supersededBy??e.disputedBy),onClick:()=>void K(()=>E(C(`${f}/actions/${encodeURIComponent(e.id)}/convert`),{method:`POST`,body:JSON.stringify({organizationRevision:Y.revision})})),children:i?`加入我的任务`:`Add to my tasks`})]})]},e.id)})]}):null,we(i?`风险`:`Risks`,X.risks,`risks`),we(i?`尚未确定`:`Open questions`,X.openQuestions,`openQuestions`),X.changes?.length?(0,$.jsxs)(`section`,{className:`space-y-3`,children:[(0,$.jsx)(`h3`,{className:`font-semibold`,children:i?`前后变更`:`Changes during the meeting`}),X.changes.map(e=>{let t=[...X.decisions,...X.actionItems,...X.risks,...X.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 Se(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 Se(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:Te.text?i?`录音摘录`:`From your recording`:i?`笔记正在整理`:`Preparing your note`}),(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-[15px] leading-7 ${Te.text?`text-fg`:`text-fg-muted`}`,children:Te.text?Te.text.slice(0,400)+(Te.text.length>400?`…`:``):i?`文字整理完成后,重点和行动会出现在这里。`:`Highlights and actions will appear as processing completes.`}),Te.text?(0,$.jsx)(j,{className:`min-h-11`,onClick:()=>v(`transcript`),children:i?`查看原文`:`Read transcript`}):null]}):(0,$.jsxs)(`div`,{className:`space-y-4`,children:[Oe.slice(0,H*50).map(e=>(0,$.jsxs)(`article`,{id:`discussion-segment-${e.sequence}`,className:`rounded-md border p-3 ${ce.includes(e.sequence)||h.anchor===e.sequence&&h.anchorRevision===Te.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:!q.audioAttachmentId||!!q.audioDeletedAt,onClick:()=>void Se([e.sequence],Te.revision,!0),children:[(0,$.jsx)(oe,{className:`size-3`}),Rt(e.startedAtMs)]}),e.status===`confirmed`?(0,$.jsx)(`button`,{onClick:()=>void Ce(e),children:i?`标记此段`:`Highlight segment`}):null,(0,$.jsx)(`span`,{children:e.speakerLabel??(i?`未区分说话人`:`Speaker unknown`)}),De&&e.status===`confirmed`?(0,$.jsx)(`button`,{className:`ml-auto`,onClick:()=>F({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)),Oe.length>H*50?(0,$.jsx)(j,{onClick:()=>U(H+1),children:i?`加载更多`:`More`}):null]})}),(0,$.jsx)(`div`,{children:(0,$.jsx)(At,{id:q.id,query:y.trim(),zh:i,sourceKey:`${q.audioSha256}:${q.audioDeletedAt}`,active:Ee||q.status===`recording`,tab:_,refreshKey:`${q.updatedAt}:${Te.revision}:${Y?.revision}`,onEvidence:xe,onPlay:ye},q.id)})]}),q.audioAttachmentId&&!q.audioDeletedAt?(0,$.jsx)(`footer`,{className:`shrink-0 border-t border-edge-subtle p-3`,children:(0,$.jsx)(`audio`,{ref:G,controls:!0,preload:`metadata`,className:`h-10 w-full`,src:C(`${f}/audio`),onTimeUpdate:()=>{let t=(G.current?.currentTime??0)*1e3;ve(t),g(e,{positionMs:t}),se.current!==null&&t>=se.current&&(G.current?.pause(),se.current=null)},onLoadedMetadata:()=>{_e.current!==null&&G.current?(G.current.currentTime=_e.current,_e.current=null,G.current.play().catch(()=>void 0)):G.current&&(G.current.currentTime=h.positionMs/1e3)},onError:()=>ne(i?`录音暂不可播放`:`Recording unavailable`)})}):null,k?(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`,k.transcriptRevision]}),(0,$.jsx)(`button`,{"aria-label":i?`关闭`:`Close`,onClick:()=>N(null),children:(0,$.jsx)(be,{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.`}),k.stale?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i?`原文已更新,以下保留当时版本的依据。`:`Transcript updated; showing the original evidence revision.`}):null,!k.audioAvailable||!k.timingVerified?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i?`原文仍可查看;原音不可用或时间定位待核实。`:`Text remains available; audio is missing or timing is unverified.`}):null,k.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)(j,{onClick:()=>ye(e.startedAtMs,e.endedAtMs),children:[i?`播放原话`:`Play source`,` `,Rt(e.startedAtMs),`–`,Rt(e.endedAtMs)]},t)),k.stale?null:(0,$.jsx)(j,{onClick:()=>{b(``),U(Math.max(H,Math.ceil((Te.segments.findIndex(e=>e.sequence===t.sequence)+1)/50))),v(`transcript`),de([t.sequence]),N(null),g(e,{anchor:t.sequence,anchorRevision:Te.revision}),window.setTimeout(()=>document.getElementById(`discussion-segment-${t.sequence}`)?.scrollIntoView?.({block:`center`}),0)},children:i?`定位原文`:`Locate transcript`})]},t.sequence))]})]}):null,I&&Y?(0,$.jsx)(It,{initial:I,zh:i,busy:V,onClose:()=>L(null),onSave:e=>K(async()=>{await E(C(`${f}/summary`),{method:`PATCH`,body:JSON.stringify({...e,expectedRevision:Y.revision})}),L(null)})},`${I.kind}:${I.itemId}:${Y.revision}`):null,P?(0,$.jsx)(mt,{open:!0,onOpenChange:e=>{e||F(null)},children:(0,$.jsxs)(ge,{children:[(0,$.jsx)(me,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(he,{"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)(ie,{children:i?`校对逐字稿`:`Edit transcript`}),(0,$.jsx)(`button`,{"aria-label":i?`关闭校对`:`Close editor`,onClick:()=>F(null),children:(0,$.jsx)(be,{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:P.speaker,onChange:e=>F({...P,speaker:e.target.value})})]}),P.segment.speakerLabel?(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:!!P.applyToSpeakerGroup,onChange:e=>F({...P,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:P.text,onChange:e=>F({...P,text:e.target.value})})]}),(0,$.jsx)(`footer`,{className:`border-t border-edge p-3`,children:(0,$.jsxs)(j,{variant:`primary`,disabled:V||!P.text.trim(),onClick:()=>void K(async()=>{await E(C(`${f}/segments/${P.segment.sequence}`),{method:`PATCH`,body:JSON.stringify({displayText:P.text,speakerLabel:P.speaker,expectedRevision:P.segment.revision,applyToSpeakerGroup:P.applyToSpeakerGroup,expectedTranscriptRevision:Te.revision})}),F(null)}),children:[(0,$.jsx)(c,{className:`size-4`}),i?`保存修订`:`Save revision`]})})]})]})}):null]})}var Bt={edit:xe,ai_edit:ut,sync:y,restore:K};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=T(e=>e.language),o=b(a).notes,s={justNow:o.justNow,minutesAgo:o.minutesAgo,today:o.today,yesterday:o.yesterday,daysAgo:o.daysAgo,locale:S(a)},{data:c}=A(e?[`note-history`,e]:null,()=>Ge(e)),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(null),h=(0,Q.useCallback)(async t=>{u(!0),m(null);try{await fe(e,t),f(null),i()}catch{m(o.restoreFailed)}finally{u(!1)}},[e,o.restoreSuccess,o.restoreFailed,i]),g=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)(ve,{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)(be,{className:`size-4`,"aria-hidden":!0})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[p?(0,$.jsx)(`p`,{className:`border-b border-danger/20 bg-danger-soft px-4 py-2 text-xs text-danger`,role:`alert`,children:p}):null,c?.length?(0,$.jsx)(`ul`,{className:`divide-y divide-edge`,children:c.map(e=>{let r=Bt[e.trigger]??xe,i=t===e.timestamp,a=d===e.timestamp;return(0,$.jsxs)(`li`,{children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:x(`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,g,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(),h(e.timestamp)},disabled:l,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:l?`...`:o.restore}),(0,$.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),f(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(),f(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=b(T(e=>e.language)).notes,d=s(),f=t?.aiDeep?.catalysis,p=f?.report??null,[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(!1),{data:v,mutate:y,isLoading:S}=A(e?[`note-agent-context-status`,e]:null,()=>Ye(e),{revalidateOnFocus:!1}),C=(0,Q.useCallback)(async()=>{if(!g){_(!0),h(null);try{await y(()=>lt(e),{revalidate:!1})}catch(e){h(`${u.contextRebuildFailed}: ${e instanceof Error?e.message:u.quickCaptureFailedHint}`)}finally{_(!1)}}},[g,y,u.contextRebuildFailed,u.quickCaptureFailedHint,e]),w=(0,Q.useCallback)(async t=>{try{await pt(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)(ut,{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)(ye,{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}),v?(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||g,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:g?u.processing:u.contextRebuild}),(0,$.jsx)(`span`,{className:x(`rounded-full px-2 py-0.5 text-[11px] font-medium`,v.status===`ready`?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-300`:v.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:v.status})]}),(0,$.jsx)(`div`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:u.contextStatusDetail.replace(`{{attachments}}`,String(v.attachments.length)).replace(`{{tokens}}`,String(v.tokenEstimate??0))}),m?(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:m}):null,v.attachments.length>0?(0,$.jsx)(`div`,{className:`mt-3 space-y-1.5`,children:v.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:p?u.recatalyze:u.catalyzeAction}),p?(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:p.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:p.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:p.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:p.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:p.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:p.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(p.confidence*100)))}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>void w(`helpful`),className:x(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,f?.feedback===`helpful`&&`bg-accent/10 text-accent`),"aria-label":u.feedbackHelpfulAria,children:(0,$.jsx)(We,{className:`size-3.5`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void w(`not_helpful`),className:x(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,f?.feedback===`not_helpful`&&`bg-accent/10 text-accent`),"aria-label":u.feedbackNotHelpfulAria,children:(0,$.jsx)(st,{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)(Le,{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:()=>d(`/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=T(e=>e.language)===`zh`,i=r?Yt:Xt,{data:a,mutate:o}=A(e?[`note-shares`,n.id]:null,()=>Me(n.id)),s=A(e?`hosted-share-auth-status`:null,L),l=s.data===!0,f=A(e&&l?`hosted-publication-capabilities`:null,B),m=f.data?.publishing.allowed===!0,h=A(e&&l?[`hosted-note-publications`,n.id]:null,()=>Oe(n.id)),[_,y]=(0,Q.useState)(new Set),[b,x]=(0,Q.useState)(`86400000`),[S,C]=(0,Q.useState)(``),[w,E]=(0,Q.useState)(``),[D,O]=(0,Q.useState)(`hosted`),[M,N]=(0,Q.useState)(!1),[P,F]=(0,Q.useState)(null),[I,z]=(0,Q.useState)(null),[ne,re]=(0,Q.useState)(!1),[V,H]=(0,Q.useState)(null),U=(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&&(y(new Set(U.map(e=>e.id))),z(null),re(!1),H(null))},[e,U]);let oe=async()=>{N(!0),H(null);try{let e={expectedNoteVersion:n.updatedAt,attachmentIds:[..._],ttlMs:Number(b),maxViews:S.trim()?Number(S):null,description:w.trim()||void 0};D===`hosted`?(z((await it(n.id,e)).shareUrl),await h.mutate()):(z((await $e(n.id,e)).payload.shareUrl),await o())}catch(e){H(e instanceof Error?e.message:String(e))}finally{N(!1)}},se=async(e,t)=>{F(e.id),H(null);try{t===`refresh`?await Y(n.id,e.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[..._]}):await de(e.id),await h.mutate()}catch(e){H(e instanceof Error?e.message:String(e))}finally{F(null)}},ce=async(e,t)=>{F(e.id),H(null);try{t===`refresh`?await dt(n.id,e.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[..._]}):t===`extend`?await te(e.id,864e5):await W(e.id),await o()}catch(e){H(e instanceof Error?e.message:String(e))}finally{F(null)}},le=async e=>{H(null);try{if(!await k(e)){re(!1),H(i.copyFailed);return}re(!0),window.setTimeout(()=>re(!1),1500)}catch{re(!1),H(i.copyFailed)}};return(0,$.jsx)(mt,{open:e,onOpenChange:t,children:(0,$.jsxs)(ge,{children:[(0,$.jsx)(me,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(he,{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)(ie,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[(0,$.jsx)(ee,{className:`size-4`}),i.title]}),(0,$.jsx)(ae,{className:`mt-1 text-xs text-fg-muted`,children:i.description})]}),(0,$.jsx)(R,{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)(be,{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})]}),U.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:U.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:_.has(e.id),onChange:()=>y(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)(u,{value:D,onChange:e=>O(e.target.value),children:[(0,$.jsx)(d,{value:`hosted`,children:i.deliveryHosted}),(0,$.jsx)(d,{value:`local`,children:i.deliveryLocal})]})]}),D===`hosted`&&s.data===!1?(0,$.jsx)(`div`,{className:`sm:col-span-2`,children:(0,$.jsx)(Ve,{providerId:`xopc-share`,displayName:`XOPC Hosted Share`,connected:!1,onConnected:()=>void s.mutate(!0,{revalidate:!1})})}):null,D===`hosted`&&l&&f.data&&!m?(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)(u,{value:b,onChange:e=>x(e.target.value),children:Wt.map(e=>(0,$.jsx)(d,{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:S,onChange:e=>C(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:w,onChange:e=>E(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`})]})]}),I?(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:I,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none`}),(0,$.jsxs)(j,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void le(I),children:[ne?(0,$.jsx)(c,{className:`size-4`}):(0,$.jsx)(p,{className:`size-4`}),ne?i.copied:i.copy]}),(0,$.jsxs)(j,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>window.open(I,`_blank`,`noopener,noreferrer`),children:[(0,$.jsx)(g,{className:`size-4`}),i.open]})]})}):null,V?(0,$.jsx)(`p`,{className:`mt-4 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,children:V}):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:P===e.id,t:i,onCopy:le,onAction:ce},e.id))})]}):null,(h.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:h.data.map(e=>(0,$.jsx)(Kt,{publication:e,stale:e.source?.version!==String(n.updatedAt),busy:P===e.id,publishingAllowed:m,t:i,onCopy:le,onAction:se},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)(R,{asChild:!0,children:(0,$.jsx)(j,{type:`button`,variant:`ghost`,children:i.close})}),(0,$.jsxs)(j,{type:`button`,onClick:()=>void oe(),disabled:M||D===`hosted`&&(!l||!m),children:[M?(0,$.jsx)(v,{className:`size-4 animate-spin`}):(0,$.jsx)(ee,{className:`size-4`}),M?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=x(`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,m;t[2]===f?m=t[3]:(m=(0,$.jsx)(`span`,{children:f}),t[2]=f,t[3]=m);let h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(`span`,{children:`·`}),t[4]=h):h=t[4];let _=n.maxViews===null?``:` / ${n.maxViews}`,b;t[5]!==n.viewCount||t[6]!==o.views||t[7]!==_?(b=(0,$.jsxs)(`span`,{children:[o.views,` `,n.viewCount,_]}),t[5]=n.viewCount,t[6]=o.views,t[7]=_,t[8]=b):b=t[8];let S;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,$.jsx)(`span`,{children:`·`}),t[9]=S):S=t[9];let C;t[10]!==n.revision||t[11]!==o.revision?(C=(0,$.jsxs)(`span`,{children:[o.revision,` `,n.revision]}),t[10]=n.revision,t[11]=o.revision,t[12]=C):C=t[12];let w;t[13]!==m||t[14]!==b||t[15]!==C?(w=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[m,h,b,S,C]}),t[13]=m,t[14]=b,t[15]=C,t[16]=w):w=t[16];let T;t[17]===n.shareUrl?T=t[18]:(T=(0,$.jsx)(`div`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.shareUrl}),t[17]=n.shareUrl,t[18]=T);let E;t[19]!==w||t[20]!==T?(E=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[w,T]}),t[19]=w,t[20]=T,t[21]=E):E=t[21];let D;t[22]===i?D=t[23]:(D=i?(0,$.jsx)(v,{className:`size-4 animate-spin text-fg-muted`}):null,t[22]=i,t[23]=D);let O;t[24]!==E||t[25]!==D?(O=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[E,D]}),t[24]=E,t[25]=D,t[26]=O):O=t[26];let k=!a,A;t[27]!==s||t[28]!==n.shareUrl?(A=()=>void s(n.shareUrl),t[27]=s,t[28]=n.shareUrl,t[29]=A):A=t[29];let M;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,$.jsx)(p,{className:`size-3.5`}),t[30]=M):M=t[30];let N;t[31]!==o.copy||t[32]!==k||t[33]!==A?(N=(0,$.jsxs)(j,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:k,onClick:A,children:[M,o.copy]}),t[31]=o.copy,t[32]=k,t[33]=A,t[34]=N):N=t[34];let P=!a,F;t[35]===n.shareUrl?F=t[36]:(F=()=>window.open(n.shareUrl,`_blank`,`noopener,noreferrer`),t[35]=n.shareUrl,t[36]=F);let I;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,$.jsx)(g,{className:`size-3.5`}),t[37]=I):I=t[37];let L;t[38]!==o.open||t[39]!==P||t[40]!==F?(L=(0,$.jsxs)(j,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:P,onClick:F,children:[I,o.open]}),t[38]=o.open,t[39]=P,t[40]=F,t[41]=L):L=t[41];let R;t[42]!==i||t[43]!==l||t[44]!==c||t[45]!==n||t[46]!==a||t[47]!==r||t[48]!==o.refresh?(R=r&&!l?(0,$.jsxs)(j,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:i||!a,onClick:()=>void c(n,`refresh`),children:[(0,$.jsx)(y,{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]=R):R=t[49];let z;t[50]!==i||t[51]!==c||t[52]!==n||t[53]!==o.revoke?(z=n.revoked?null:(0,$.jsxs)(j,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:i,onClick:()=>void c(n,`revoke`),children:[(0,$.jsx)(tt,{className:`size-3.5`}),o.revoke]}),t[50]=i,t[51]=c,t[52]=n,t[53]=o.revoke,t[54]=z):z=t[54];let B;t[55]!==N||t[56]!==L||t[57]!==R||t[58]!==z?(B=(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[N,L,R,z]}),t[55]=N,t[56]=L,t[57]=R,t[58]=z,t[59]=B):B=t[59];let ee;return t[60]!==O||t[61]!==d||t[62]!==B?(ee=(0,$.jsxs)(`div`,{className:d,children:[O,B]}),t[60]=O,t[61]=d,t[62]=B,t[63]=ee):ee=t[63],ee}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=x(`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 m=n.maxViews===null?``:` / ${n.maxViews}`,h;t[5]!==n.viewCount||t[6]!==i.views||t[7]!==m?(h=(0,$.jsxs)(`span`,{children:[i.views,` `,n.viewCount,m]}),t[5]=n.viewCount,t[6]=i.views,t[7]=m,t[8]=h):h=t[8];let _;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(`span`,{children:`·`}),t[9]=_):_=t[9];let b;t[10]===n.expiresAt?b=t[11]:(b=new Date(n.expiresAt).toLocaleDateString(),t[10]=n.expiresAt,t[11]=b);let S;t[12]===b?S=t[13]:(S=(0,$.jsx)(`span`,{children:b}),t[12]=b,t[13]=S);let C;t[14]!==S||t[15]!==d||t[16]!==h?(C=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[d,f,h,_,S]}),t[14]=S,t[15]=d,t[16]=h,t[17]=C):C=t[17];let w;t[18]===n.shareUrl?w=t[19]:(w=(0,$.jsx)(`div`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.shareUrl}),t[18]=n.shareUrl,t[19]=w);let T;t[20]!==C||t[21]!==w?(T=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[C,w]}),t[20]=C,t[21]=w,t[22]=T):T=t[22];let E;t[23]===r?E=t[24]:(E=r?(0,$.jsx)(v,{className:`size-4 animate-spin text-fg-muted`}):null,t[23]=r,t[24]=E);let D;t[25]!==T||t[26]!==E?(D=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[T,E]}),t[25]=T,t[26]=E,t[27]=D):D=t[27];let O;t[28]!==a||t[29]!==n.shareUrl?(O=()=>void a(n.shareUrl),t[28]=a,t[29]=n.shareUrl,t[30]=O):O=t[30];let k;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(p,{className:`size-3.5`}),t[31]=k):k=t[31];let A;t[32]!==i.copy||t[33]!==O?(A=(0,$.jsxs)(j,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:O,children:[k,i.copy]}),t[32]=i.copy,t[33]=O,t[34]=A):A=t[34];let M;t[35]===n.shareUrl?M=t[36]:(M=()=>window.open(n.shareUrl,`_blank`,`noopener,noreferrer`),t[35]=n.shareUrl,t[36]=M);let N;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,$.jsx)(g,{className:`size-3.5`}),t[37]=N):N=t[37];let P;t[38]!==i.open||t[39]!==M?(P=(0,$.jsxs)(j,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:M,children:[N,i.open]}),t[38]=i.open,t[39]=M,t[40]=P):P=t[40];let F;t[41]!==r||t[42]!==s||t[43]!==o||t[44]!==n||t[45]!==i.refresh?(F=n.stale&&!s?(0,$.jsxs)(j,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`refresh`),children:[(0,$.jsx)(y,{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]=F):F=t[46];let I;t[47]!==r||t[48]!==s||t[49]!==o||t[50]!==n||t[51]!==i.extend?(I=s?null:(0,$.jsx)(j,{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]=I):I=t[52];let L;t[53]!==r||t[54]!==o||t[55]!==n||t[56]!==i.revoke?(L=n.revoked?null:(0,$.jsxs)(j,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`revoke`),children:[(0,$.jsx)(tt,{className:`size-3.5`}),i.revoke]}),t[53]=r,t[54]=o,t[55]=n,t[56]=i.revoke,t[57]=L):L=t[57];let R;t[58]!==A||t[59]!==P||t[60]!==F||t[61]!==I||t[62]!==L?(R=(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[A,P,F,I,L]}),t[58]=A,t[59]=P,t[60]=F,t[61]=I,t[62]=L,t[63]=R):R=t[63];let z;return t[64]!==D||t[65]!==l||t[66]!==R?(z=(0,$.jsxs)(`div`,{className:l,children:[D,R]}),t[64]=D,t[65]=l,t[66]=R,t[67]=z):z=t[67],z}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?!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=G(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=G(u),f=G(Qt),p;t[6]!==n||t[7]!==r||t[8]!==d||t[9]!==a?(p=(0,$.jsx)(H,{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)(Se,{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=_e(t.replace(/^\s*(`{3,}|~{3,})[^\n]*$/gm,``).replace(/xopc-attachment:\/\/[^\s)]+/g,``).replace(/^(\s*[-*+]\s+)\[[ xX]\]\s*/gm,`$1`)),r=_e(e);return!r||n.split(`
3
+ `)[0]===r?n:[r,n].filter(Boolean).join(`
4
+
5
+ `)}var en=()=>i(()=>import(`./block-editor-B50rU9tL.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,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65])),tn=()=>i(()=>import(`./markdown-editor-phTQ0mox.js`),__vite__mapDeps([66,1,62,5,67,3])),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:q},t[0]=i.edit,t[1]=a);let o;t[2]===i.source?o=t[3]:(o={id:`source`,label:i.source,Icon:ct},t[2]=i.source,t[3]=o);let s;t[4]===i.preview?s=t[5]:(s={id:`preview`,label:i.preview,Icon:_},t[4]=i.preview,t[5]=s);let u;t[6]!==a||t[7]!==o||t[8]!==s?(u=[a,o,s],t[6]=a,t[7]=o,t[8]=s,t[9]=u):u=t[9];let d=u,f;t[10]!==n||t[11]!==d?(f=d.find(e=>e.id===n)??d[0],t[10]=n,t[11]=d,t[12]=f):f=t[12];let p=f,m=p.Icon,h=sn,g;t[13]===m?g=t[14]:(g=(0,$.jsx)(m,{className:`size-3.5`,"aria-hidden":!0}),t[13]=m,t[14]=g);let v;t[15]===p.label?v=t[16]:(v=(0,$.jsx)(`span`,{children:p.label}),t[15]=p.label,t[16]=v);let y;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,$.jsx)(l,{className:`size-3 text-fg-subtle`,"aria-hidden":!0}),t[17]=y):y=t[17];let b;t[18]!==p.label||t[19]!==g||t[20]!==v?(b=(0,$.jsx)(Xe,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,"aria-label":p.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:[g,v,y]})}),t[18]=p.label,t[19]=g,t[20]=v,t[21]=b):b=t[21];let x;t[22]!==n||t[23]!==d||t[24]!==r?(x=(0,$.jsx)(ot,{children:(0,$.jsx)(Ee,{align:`end`,sideOffset:6,className:`z-50 min-w-36 rounded-xl border border-edge bg-surface-overlay p-1 shadow-popover`,children:d.map(e=>{let{id:t,label:i,Icon:a}=e;return(0,$.jsxs)(Ue,{onSelect:()=>r(t),onPointerMove:()=>h(t),onFocus:()=>h(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)(c,{className:`size-4 text-accent`,"aria-hidden":!0}):null]},t)})})}),t[22]=n,t[23]=d,t[24]=r,t[25]=x):x=t[25];let S;return t[26]!==x||t[27]!==b?(S=(0,$.jsxs)(Ae,{modal:!1,children:[b,x]}),t[26]=x,t[27]=b,t[28]=S):S=t[28],S}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:d}=e,f=a===void 0?!0:a,p=s===void 0?!0:s,m=l===void 0?!1:l,h=T(ln),g;t[0]===h?g=t[1]:(g=b(h),t[0]=h,t[1]=g);let _=g.notes.lightboxClose,v;t[2]!==m||t[3]!==o||t[4]!==p||t[5]!==u||t[6]!==n||t[7]!==d||t[8]!==r||t[9]!==c||t[10]!==i||t[11]!==f?(v=(0,$.jsx)(un,{noteId:n,onBack:r,onSaved:i,showBackButton:f,backButtonClassName:o,clearHeaderOnCleanup:p,onOpenSearch:c,autoFocus:m,initialMode:u,onAutoFocusConsumed:d}),t[2]=m,t[3]=o,t[4]=p,t[5]=u,t[6]=n,t[7]=d,t[8]=r,t[9]=c,t[10]=i,t[11]=f,t[12]=v):v=t[12];let y;return t[13]!==_||t[14]!==v?(y=(0,$.jsx)(U,{closeLabel:_,children:v}),t[13]=_,t[14]=v,t[15]=y):y=t[15],y}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:l=!1,initialMode:u=`wysiwyg`,onAutoFocusConsumed:d}){let f=T(e=>e.language),p=b(f).notes,m=b(f).chat.pageContext,g=b(f).automations.suggestions,{data:_}=A([`note-discussion-document`,e],()=>je(e)),[v,y]=(0,Q.useState)(!0),S=s(),C=ne(e=>e.resolved)===`dark`,{openImage:E}=ce(),[D,k]=(0,Q.useState)(u),[j,M]=(0,Q.useState)(null),[N,P]=(0,Q.useState)(null),[F,I]=(0,Q.useState)(!1),[L,R]=(0,Q.useState)(``),[B,te]=(0,Q.useState)(360),[re,ie]=(0,Q.useState)(!1),[ae,H]=(0,Q.useState)(!1),[U,oe]=(0,Q.useState)(!1),ue=(0,Q.useRef)(0);(0,Q.useEffect)(()=>()=>{ue.current+=1},[e]);let[de,W]=(0,Q.useState)(null),[fe,me]=(0,Q.useState)(!1),[he,ge]=(0,Q.useState)(null),[_e,K]=(0,Q.useState)(!1),[be,xe]=(0,Q.useState)(!1),Se=(0,Q.useRef)(!1),Ce=(0,Q.useRef)(!1),J=(0,Q.useRef)(null),Y=(0,Q.useRef)(null),X=(0,Q.useRef)(null),Oe=(0,Q.useRef)(null),Me=(0,Q.useRef)(null),Fe=(0,Q.useRef)(null),ze=(0,Q.useRef)(null),Ve=(0,Q.useRef)(null),He=(0,Q.useRef)(null),We=De(e=>e.setPageHeader),Ge=De(e=>e.clearPageHeader),{data:Z,mutate:qe,error:Je}=A(e?[`note-detail`,e]:null,()=>Te(e)),{data:Ye=[],mutate:Ze}=A(e?[`note-threads`,e]:null,()=>Ie(e),{revalidateOnFocus:!1}),Qe=N!==null,$e=(0,Q.useCallback)(e=>{W(`${p.refreshFailed}: ${e instanceof Error?e.message:p.quickCaptureFailedHint}`)},[p.quickCaptureFailedHint,p.refreshFailed]);(0,Q.useEffect)(()=>{if(!e)return;let t=t=>{t.detail?.noteId===e&&qe().catch($e)};return window.addEventListener(`note-updated`,t),()=>window.removeEventListener(`note-updated`,t)},[qe,e,$e]),(0,Q.useEffect)(()=>{Se.current=!1,R(``),P(null),M(null),Ce.current=!1,He.current=null},[e]),(0,Q.useEffect)(()=>{!Z||Se.current||(R(Z.title??``),Se.current=!0)},[Z]),(0,Q.useEffect)(()=>{if(!l||!Z||Qe||He.current===e)return;let t=window.requestAnimationFrame(()=>{Ve.current?.focus(),d?.()});return He.current=e,()=>window.cancelAnimationFrame(t)},[l,Qe,Z,e,d]);let et=Z?new Date(Z.createdAt).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``,rt=(0,Q.useMemo)(()=>r?(0,$.jsx)(`button`,{type:`button`,onClick:t,"aria-label":p.back,className:x(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,se,i),children:(0,$.jsx)(ye,{className:`size-4`,"aria-hidden":!0})}):null,[i,p.back,t,r]),it=(0,Q.useCallback)(()=>{let t=G.getState();t.source?.type===`note`&&t.source.id===e&&t.stop()},[e]),st=(0,Q.useCallback)(e=>{e!==`preview`&&it(),k(e)},[it]),ct=(0,Q.useCallback)(t=>{it(),R(t),e&&(Oe.current=t,Y.current&&clearTimeout(Y.current),Y.current=setTimeout(async()=>{let t=Oe.current;if(Oe.current=null,t!==null){I(!0);try{await z(e,{title:t}),await qe(),n?.()}catch{}finally{I(!1)}}},600))},[it,e,qe,n]),lt=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:x(`flex min-w-0 items-center gap-2`,se),children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,title:L||et||void 0,children:L||et}),F?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted opacity-60`,children:p.saving}):null]}),[p.saving,F,et,L]),dt=(0,Q.useCallback)(async(t=!1)=>{oe(!0),W(null);try{let n=await Ke(e,{forceNew:t});await qe(),await Ze(),S(`/chat/${encodeURIComponent(n.conversationId)}`)}catch(e){W(`${p.chatOpenFailedTitle}: ${e instanceof Error?e.message:p.chatOpenFailedMessage}`)}finally{oe(!1)}},[qe,Ze,S,e,p.chatOpenFailedMessage,p.chatOpenFailedTitle]),ft=(0,Q.useCallback)(async()=>{H(!0),W(null);try{await Ne(e),await qe()}catch(e){W(`${p.catalysisFailed}: ${e instanceof Error?e.message:p.chatOpenFailedMessage}`)}finally{H(!1)}},[qe,e]),pt=(0,Q.useCallback)(()=>{M(j===`breakdown`?null:`breakdown`),!Z?.aiDeep?.catalysis?.report&&!ae&&ft()},[j,ae,ft,Z?.aiDeep?.catalysis?.report]),mt=(0,Q.useCallback)(()=>{let t=N?N.markdown??``:X.current??Z?.markdown??``,n=N?N.title??``:L,r=$t(n,t);return{source:{type:`note`,id:e,title:n||p.titlePlaceholder},text:r,language:V(r,f)}},[f,p.titlePlaceholder,Z?.markdown,e,N,L]),ht=(0,Q.useCallback)(async()=>{J.current&&clearTimeout(J.current),Y.current&&clearTimeout(Y.current),J.current=null,Y.current=null;let t=X.current,r=Oe.current;X.current=null,Oe.current=null;let i={};if(t!==null&&(i.markdown=t),r!==null&&(i.title=r),Object.keys(i).length===0)return Z??null;I(!0);try{let t=await z(e,i);return await qe(t,{revalidate:!1}),n?.(),t}catch(e){return X.current===null&&(X.current=t),Oe.current===null&&(Oe.current=r),W(`${p.saveFailed}: ${e instanceof Error?e.message:p.saveFailedHint}`),null}finally{I(!1)}},[qe,p.saveFailed,p.saveFailedHint,Z,e,n]),gt=(0,Q.useCallback)(async()=>{if(!Z||U||F)return;oe(!0),W(null);let e=w.getState(),t=++ue.current,n=()=>ue.current===t&&w.getState().baseUrl===e.baseUrl&&w.getState().conversationId===e.conversationId;try{let t=window.getSelection(),r=t?.anchorNode&&t.focusNode&&Me.current?.contains(t.anchorNode)&&Me.current.contains(t.focusNode)?t.toString():``,i=await ht();if(!i||!n())return;if(X.current!==null||Oe.current!==null)throw Error(m.unavailable);let a=ke.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 O().createSession();if(!n())return;if(X.current!==null||Oe.current!==null)throw Error(m.unavailable);let s=at(e.baseUrl,e.conversationId,o.key);if(!ke.put(s,a))throw Error(m.unavailable);S(`/chat/${encodeURIComponent(o.key)}`)}catch{n()&&W(m.unavailable)}finally{ue.current===t&&oe(!1)}},[Z,U,F,ht,S,m.unavailable]),_t=(0,Q.useCallback)(async()=>{W(null);let e=await ht();e&&(ge(e),me(!0))},[ht]),vt=(0,Q.useCallback)(async()=>{if(!(be||F)){K(!1),xe(!0),W(null),it(),J.current&&clearTimeout(J.current),Y.current&&clearTimeout(Y.current),J.current=null,Y.current=null,X.current=null,Oe.current=null;try{await Be(e),window.dispatchEvent(new CustomEvent(`note-deleted`,{detail:{noteId:e}})),n?.(),t()}catch(e){W(`${p.deleteFailed}: ${e instanceof Error?e.message:p.quickCaptureFailedHint}`)}finally{xe(!1)}}},[be,p.deleteFailed,p.quickCaptureFailedHint,e,t,n,F,it]),yt=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:x(`flex min-w-0 items-center gap-1 sm:gap-2`,se),children:[o?(0,$.jsx)(`button`,{type:`button`,onClick:o,"aria-label":p.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)(le,{className:`size-4`,"aria-hidden":!0})}):null,(0,$.jsx)(Zt,{input:mt,showLabel:!1,labels:{read:p.readAloud,preparing:p.readAloudPreparing,pause:p.readAloudPause,resume:p.readAloudResume,retry:p.readAloudRetry,stop:p.readAloudStop}}),(0,$.jsxs)(`button`,{type:`button`,onClick:pt,disabled:ae,"aria-label":p.catalysisSectionTitle,className:x(`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`,j===`breakdown`?`bg-accent/10 text-accent`:`bg-accent/10 text-fg hover:bg-accent/15`),children:[(0,$.jsx)(ut,{className:`size-3.5`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:ae?p.catalyzing:p.catalyzeButton})]}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>dt(!1),"aria-label":p.openChatButton,disabled:U,className:x(`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)(Le,{className:`size-3.5`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:U?p.openingChat:p.openChatButton})]}),(0,$.jsx)(on,{mode:D,onModeChange:st,labels:{edit:p.modeEdit,source:p.modeSource,preview:p.modePreview}}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>void gt(),disabled:U||F||!Z||!!N,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)(q,{className:`size-3.5`,"aria-hidden":!0}),m.capture]}),(0,$.jsxs)(Ae,{modal:!1,children:[(0,$.jsx)(Xe,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,"aria-label":p.noteActions,title:p.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)(h,{className:`size-4`,"aria-hidden":!0})})}),(0,$.jsx)(ot,{children:(0,$.jsxs)(Ee,{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)(Ue,{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}),f===`zh`?`分享`:`Share`]}),(0,$.jsxs)(Ue,{onSelect:()=>M(j===`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)(ve,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`flex-1`,children:p.history}),j===`history`?(0,$.jsx)(c,{className:`size-4 text-accent`,"aria-hidden":!0}):null]}),(0,$.jsx)(Pe,{className:`my-1 h-px bg-edge-subtle`}),(0,$.jsxs)(Ue,{disabled:be||F,onSelect:()=>K(!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)(tt,{className:`size-4`,"aria-hidden":!0}),p.delete]})]})})]})]}),[ae,pt,dt,gt,m.capture,Z,N,D,p.history,p.modeEdit,p.modePreview,p.modeSource,U,j,o,p.searchDialogTitle,p.readAloud,p.readAloudPause,p.readAloudPreparing,p.readAloudResume,p.readAloudRetry,p.readAloudStop,st,mt,_t,be,F,f,p.delete,K]);(0,Q.useLayoutEffect)(()=>(We({startExtra:rt,main:Z&&!(_&&v)?lt:null,end:Z&&!(_&&v)?yt:null}),()=>{a&&Ge()}),[a,Ge,yt,lt,rt,_,v,Z,We]);let bt=(0,Q.useCallback)(t=>{e&&(it(),X.current=t,J.current&&clearTimeout(J.current),J.current=setTimeout(async()=>{let t=X.current;if(X.current=null,t!==null){I(!0),W(null);try{await z(e,{markdown:t}),await qe(),n?.()}catch(e){W(`${p.saveFailed}: ${e instanceof Error?e.message:p.saveFailedHint}`)}finally{I(!1)}}},600))},[it,e,qe,p.saveFailed,p.saveFailedHint,n]),xt=(0,Q.useCallback)(t=>{nt(e,t.timestamp).then(e=>{e&&(it(),P(e))})},[e,it]),St=(0,Q.useCallback)(()=>{it(),M(null),P(null)},[it]),Ct=(0,Q.useCallback)(()=>{it(),M(null),P(null),qe().catch($e),n?.()},[qe,n,$e,it]);if((0,Q.useEffect)(()=>()=>{J.current&&clearTimeout(J.current),Y.current&&clearTimeout(Y.current);let t=X.current,n=Oe.current;X.current=null,Oe.current=null;let r={};t!==null&&(r.markdown=t),n!==null&&(r.title=n),Object.keys(r).length>0&&z(e,r).catch(()=>void 0)},[e]),Z===void 0)return Je?(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:p.home.loadFailed}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void qe().catch($e),className:`rounded-lg border border-edge px-3 py-2 text-sm text-fg hover:bg-surface-hover`,children:p.home.retry}),(0,$.jsx)(`button`,{type:`button`,onClick:t,className:`text-sm text-fg-muted hover:text-fg`,children:p.back})]}):(0,$.jsx)(an,{});if(Z===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:p.notFoundTitle}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:p.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:p.back})]});let Tt=Qe?N.title??``:L,Et=Qe?N.markdown??``:X.current??Z.markdown??``,Dt=new Date(Z.createdAt).getTime(),Ot=Number.isFinite(Dt)&&Date.now()-Dt<3600*1e3?(0,$.jsx)(wt,{title:g.noteCreatedTitle,description:g.noteCreatedDescription,prompt:g.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:[de?(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:de}):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?(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:()=>y(!0),children:f===`zh`?`← 返回录音笔记`:`← Back to recording`}):null,(0,$.jsxs)(`div`,{ref:Me,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?(0,$.jsx)(zt,{noteId:e,noteActions:{onAnalyze:pt,onChat:()=>{dt(!1)},onShare:()=>{_t()},onHistory:()=>M(j===`history`?null:`history`),onDelete:()=>K(!0),busy:be||F||ae||U},onPersonalNotes:()=>{y(!1),window.setTimeout(()=>Ve.current?.focus(),0)}}):null,(0,$.jsx)(`div`,{className:_&&v?`hidden`:`min-h-0 min-w-0 flex-1`,children:Qe?(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)(pe,{noteId:e,content:Et,className:`opacity-80`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:p.emptyPreview})]}):(0,$.jsxs)($.Fragment,{children:[D===`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:Ve,type:`text`,value:L,onChange:e=>ct(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(),(Me.current?.querySelector(`.ProseMirror`))?.focus())},placeholder:p.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:Z.markdown??``,onChange:bt,noteId:e},`wysiwyg-${e}`)})})]}),D===`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:Ve,type:`text`,value:L,onChange:e=>ct(e.target.value),placeholder:p.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:Z.markdown??``,onChange:bt,isDark:C},`source-${e}`)})})]}),D===`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&&E(t.currentSrc||t.src,t.alt)},children:[L&&!Z.markdown.trimStart().startsWith(`# ${L.trim()}\n`)&&Z.markdown.trim()!==`# ${L.trim()}`&&(0,$.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg`,children:L}),Z.markdown?(0,$.jsx)(pe,{noteId:e,content:Z.markdown,className:`[&_img]:cursor-zoom-in`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:p.emptyPreview})]})]})})]})]}),(0,$.jsx)(`div`,{ref:Fe,className:x(`relative flex min-h-0 shrink-0 flex-col overflow-hidden`,!re&&`transition-[width] duration-300 ease-in-out`),style:{width:j?B:0},children:(0,$.jsxs)(`div`,{ref:ze,className:`flex min-h-0 flex-1 flex-col`,style:{width:B},children:[(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,onPointerDown:e=>{e.preventDefault();let t=e.currentTarget;t.setPointerCapture(e.pointerId),ie(!0);let n=e.clientX,r=B,i=e.pointerId,a=0,o=B,s=B,c=()=>{a=0,s=o,j&&Fe.current?.style.setProperty(`width`,`${s}px`),ze.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{}ie(!1),te(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:x(`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`,re&&`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:j===`history`?(0,$.jsx)(Ht,{noteId:e,activeTimestamp:N?.timestamp??null,onSelect:xt,onClose:St,onRestored:Ct}):j===`breakdown`?(0,$.jsx)(Ut,{noteId:e,note:Z??null,catalyzing:ae,onCatalyze:ft,onClose:()=>M(null),noteThreads:Ye,openingChat:U,onOpenChat:()=>dt(!1),onOpenNewChat:()=>dt(!0)}):null})]})})]}),he?(0,$.jsx)(Gt,{open:fe,onOpenChange:me,note:he}):null,(0,$.jsx)(we,{open:_e,title:p.deleteConfirmTitle,description:p.deleteConfirmDescription.replace(`{{title}}`,Z.title||p.titlePlaceholder),confirmLabel:p.deleteConfirmLabel,cancelLabel:p.deleteCancelLabel,destructive:!0,onConfirm:()=>void vt(),onCancel:()=>K(!1)})]})}export{xt as i,Ct as n,St as r,cn as t};
@@ -0,0 +1 @@
1
+ import"./index-DRyGCING.js";
@@ -0,0 +1,8 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,l as a,m as o,u as s}from"./chunk-KS7C4IRE-BvcCCgTW.js";import{t as c}from"./chevron-down-ccbiQQz_.js";import{t as l}from"./popover-select-DGKUpVsz.js";import{t as u}from"./ellipsis-0k4rZLoy.js";import{t as d}from"./loader-circle-CifKLtgG.js";import{t as f}from"./messages-BYq0cPbn.js";import{t as p}from"./cn-0WouolD0.js";import{f as m,l as ee,n as h}from"./locale-store-B7s2Hb35.js";import{i as g}from"./vendor-swr-BIWyz7Rc.js";import{t as _}from"./skeleton-BI5TyibZ.js";import{$t as v,Cr as y,Da as b,Dr as x,Fc as S,Ga as te,Gd as C,Jd as w,Jn as ne,Kd as re,Lo as ie,Ml as T,Nl as E,Pd as D,Qu as ae,Vd as O,Wl as k,Yd as A,Zc as j,Zd as oe,aa as se,ad as ce,au as le,ca as ue,cn as M,co as de,da as fe,en as N,eu as P,fu as pe,gl as me,ir as he,la as ge,ln as _e,mr as ve,nr as ye,on as F,pa as be,pr as xe,rl as Se,sl as Ce,sn as we,ua as Te,un as Ee,ur as De,wr as I,xl as Oe,zu as ke}from"./index-DRyGCING.js";import{i as Ae,t as L}from"./note-detail-panel-CNkxMTFU.js";var R=n(),z=e(t(),1),B=r();function V({projectId:e}){let t=h(e=>e.language)===`zh`,n=s(),r=(0,z.useRef)(null),i=(0,z.useRef)(null),[a,o]=(0,z.useState)(null),[c,l]=(0,z.useState)(null),[u,d]=(0,z.useState)(null);async function f(){let t=i.current;if(!(!t||a!==null)){o(0),l(null);try{let r=await Ee();if(r.consentAcknowledgedAt==null){d(r.consentPolicyVersion);return}let a=await v(t.file,t.requestId),s=await _e({clientRequestId:t.requestId,contextProjectId:e,source:`web`,consentPolicyVersion:r.consentPolicyVersion});t.discussionId=s.discussion.id,await we({...a,serverDiscussionId:s.discussion.id,projectId:e}),s.discussion.audioAttachmentId||await N(a,s.discussion.id,o),await F(t.requestId),i.current=null,n(`/notes/${encodeURIComponent(s.note.id)}`)}catch(e){l(e instanceof Error?e.message:String(e))}finally{o(null)}}}return(0,B.jsxs)(`div`,{className:`inline-flex flex-wrap items-center gap-2 text-xs`,children:[(0,B.jsx)(`input`,{ref:r,hidden:!0,type:`file`,accept:`audio/*,.m4a,.wav,.mp3,.webm,.ogg`,onChange:e=>{let n=e.target.files?.[0];if(e.target.value=``,n){if(!n.size||n.size>1073741824){l(t?`音频须为 1 字节至 1 GiB`:`Audio must be between 1 byte and 1 GiB`);return}i.current={file:n,requestId:crypto.randomUUID()},f()}}}),(0,B.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1 rounded-md p-2 hover:bg-surface-hover`,disabled:a!==null,onClick:()=>c&&i.current?void f():r.current?.click(),children:[(0,B.jsx)(Se,{className:`size-3.5`}),a===null?c&&i.current?t?`重试导入`:`Retry import`:t?`导入录音`:`Import recording`:`${a}%`]}),u===null?null:(0,B.jsxs)(`span`,{children:[t?`请确认你有权上传此录音,并允许配置的语音服务处理。`:`Confirm permission to upload this recording and process it with your configured speech service.`,(0,B.jsx)(`button`,{type:`button`,className:`p-2 text-accent`,onClick:()=>void M(u).then(()=>(d(null),f())).catch(e=>l(String(e))),children:t?`确认导入`:`Confirm import`})]}),c?(0,B.jsx)(`span`,{role:`alert`,className:`text-danger`,children:c}):null]})}async function je(e){e.note??=await ye({title:e.title,markdown:e.markdown,projectId:e.projectId,channel:`web`},e.requestId);let t=e.note.id;for(let n=e.attachments.length;n<e.files.length;n++)e.attachments.push(await I(t,e.files[n],`${e.requestId}:file:${n}`));if(e.attachments.length){let n=e.attachments.map(e=>`[${e.fileName.replace(/[\\[\]]/g,`\\$&`).replace(/[\r\n]/g,` `)}](${x(t,e.id)})`);e.note=await y(t,{markdown:`${e.markdown}\n\n## ${e.materialHeading}\n\n${n.join(`
2
+
3
+ `)}`})}return{noteId:t,conversationId:(await ve(t,{projectId:e.projectId})).conversationId}}function Me(e,t,n){let r=new URLSearchParams({draft:n.replace(`{{id}}`,t),autoSend:`1`});return`/chat/${encodeURIComponent(e)}?${r}`}var H={meeting:C,requirements:ce,research:E,weekly:D};function Ne({projects:e,projectId:t,onProjectChange:n,onCreated:r,labels:i,projectsLoading:a,projectsError:o}){let u=i.home,f=s(),[m,ee]=(0,z.useState)(``),[h,g]=(0,z.useState)(null),[_,v]=(0,z.useState)(!1),[y,b]=(0,z.useState)([]),[x,S]=(0,z.useState)(!1),[C,w]=(0,z.useState)(null),[ne,ie]=(0,z.useState)(``),T=(0,z.useRef)(null),E=(0,z.useRef)(!1),D=(0,z.useRef)(null),O=(0,z.useRef)(null),k=x||!!T.current,A=h?u.templateOptions[h]:null,oe=!!(m.trim()||y.length);async function se(){if(!(E.current||!oe&&!T.current)){E.current=!0,S(!0),w(null),T.current??={requestId:crypto.randomUUID(),title:m.trim().split(`
4
+ `)[0]?.slice(0,80)||A?.label||i.titlePlaceholder,markdown:`## ${u.requestHeading}\n\n${A?`${A.prompt}\n`:``}${m.trim()}`,projectId:t||void 0,files:[...y],attachments:[],materialHeading:u.materialsHeading};try{let e=await je(T.current);r(),f(Me(e.conversationId,e.noteId,u.agentPrompt))}catch(e){T.current.note&&r(),w(e instanceof Error?e.message:i.quickCaptureFailedHint)}finally{E.current=!1,S(!1)}}}function ce(){T.current=null,w(null),ee(``),b([]),g(null),v(!1),O.current?.focus()}return(0,B.jsxs)(`section`,{"aria-label":u.askLabel,children:[(0,B.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),se()},className:`relative rounded-xl border border-edge bg-surface-panel p-4 focus-within:border-accent/60 sm:p-5`,children:[(0,B.jsxs)(`fieldset`,{disabled:k,className:`min-w-0`,children:[(0,B.jsxs)(`label`,{htmlFor:`notes-home-prompt`,className:`flex items-center gap-2 text-xs font-medium text-accent-fg`,children:[(0,B.jsx)(Oe,{className:`size-4`,"aria-hidden":!0}),u.askLabel]}),(0,B.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:u.agentResultHint}),A?(0,B.jsxs)(`div`,{className:`mt-3 flex items-start gap-2 rounded-lg bg-accent-soft px-3 py-2 text-xs leading-5 text-accent-fg`,children:[(0,B.jsxs)(`p`,{className:`min-w-0 flex-1`,children:[(0,B.jsxs)(`span`,{className:`font-medium`,children:[A.label,` · `]}),A.prompt.split(`
5
+
6
+ `)[0]]}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>g(null),"aria-label":i.searchClear,className:`shrink-0 rounded p-1 hover:bg-surface-hover`,children:(0,B.jsx)(j,{className:`size-3.5`})})]}):null,(0,B.jsx)(`textarea`,{ref:O,id:`notes-home-prompt`,value:m,onChange:e=>ee(e.target.value),placeholder:A?A.prompt.split(`
7
+
8
+ `).at(-1):u.askPlaceholder,rows:2,onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&!e.nativeEvent.isComposing&&(e.preventDefault(),se())},className:`mt-2 min-h-16 w-full resize-y bg-transparent py-2 text-base leading-6 text-fg outline-none placeholder:text-fg-muted sm:text-sm`}),y.length?(0,B.jsx)(`ul`,{className:`mb-3 flex flex-wrap gap-2`,children:y.map((e,t)=>(0,B.jsxs)(`li`,{className:`flex max-w-full items-center gap-2 rounded-md border border-edge px-2 py-1 text-xs text-fg-muted`,children:[(0,B.jsx)(P,{className:`size-3 shrink-0`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`truncate`,children:e.name}),(0,B.jsx)(`button`,{type:`button`,"aria-label":`${u.removeMaterial}: ${e.name}`,onClick:()=>b(e=>e.filter((e,n)=>n!==t)),className:`rounded p-1 hover:bg-surface-hover`,children:(0,B.jsx)(j,{className:`size-3`})})]},`${e.name}-${t}`))}):null,(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 sm:pr-40`,children:[(0,B.jsx)(`div`,{className:`w-44 max-w-full`,children:(0,B.jsx)(l,{value:t,options:e.filter(e=>e.name.toLowerCase().includes(ne.toLowerCase())).map(e=>({value:e.id,label:e.name})),selectedLabel:t?e.find(e=>e.id===t)?.name:u.unassigned,placeholder:u.unassigned,emptyLabel:u.unassigned,ariaLabel:u.assignProject,triggerIcon:(0,B.jsx)(ae,{className:`size-4 shrink-0`,"aria-hidden":!0}),triggerClassName:`h-8 border-transparent bg-transparent px-2 text-xs text-fg-muted hover:bg-surface-hover`,onChange:n,disabled:k,loading:a,statusMessage:o?u.projectsLoadFailed:void 0,searchPlaceholder:u.projectSearch,searchValue:ne,onSearchChange:ie})}),(0,B.jsxs)(`button`,{type:`button`,onClick:()=>D.current?.click(),className:`inline-flex h-8 items-center gap-1.5 rounded-md px-2 text-xs text-fg-muted hover:bg-surface-hover`,children:[(0,B.jsx)(P,{className:`size-4`,"aria-hidden":!0}),u.addMaterials]}),(0,B.jsx)(`input`,{ref:D,type:`file`,multiple:!0,className:`hidden`,"aria-label":u.addMaterials,onChange:e=>{let t=Array.from(e.target.files??[]);b(e=>[...e,...t]),e.target.value=``}})]})]}),(0,B.jsx)(`div`,{className:`mt-2 flex justify-end sm:absolute sm:bottom-5 sm:right-5 sm:mt-0`,children:(0,B.jsxs)(`button`,{type:`submit`,disabled:x||!T.current&&!oe,className:`inline-flex h-9 items-center gap-2 rounded-lg bg-accent px-4 text-sm font-medium text-on-accent hover:bg-accent-hover focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50`,children:[x?(0,B.jsx)(d,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,B.jsx)(re,{className:`size-4`,"aria-hidden":!0}),x?u.creating:C?u.retry:u.agentCreate]})})]}),C?(0,B.jsxs)(`div`,{className:`mt-3 rounded-lg border border-danger/25 bg-danger-soft px-3 py-3 text-xs text-danger`,role:`alert`,children:[(0,B.jsx)(`p`,{children:C}),T.current?.note?(0,B.jsx)(`p`,{className:`mt-1`,children:u.partialFailure}):null,(0,B.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-3`,children:[T.current?.note?(0,B.jsx)(`button`,{type:`button`,onClick:()=>f(`/notes/${encodeURIComponent(T.current.note.id)}?edit=1`),className:`underline`,children:u.openSavedDraft}):null,(0,B.jsx)(`button`,{type:`button`,onClick:ce,className:`underline`,children:u.newRequest})]})]}):null,(0,B.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:(0,B.jsxs)(`button`,{type:`button`,disabled:k,"aria-expanded":_,"aria-controls":`notes-home-templates`,onClick:()=>v(e=>!e),className:`touch-target inline-flex items-center gap-1.5 rounded-md px-2 py-2 hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:[u.templates,(0,B.jsx)(c,{className:p(`size-3.5 transition-transform`,_&&`rotate-180`),"aria-hidden":!0})]})}),(0,B.jsxs)(te,{id:`notes-home-templates`,hidden:!_,className:p(`mt-1 flex-wrap items-center gap-1 text-xs text-fg-muted`,_?`flex`:`hidden`),role:`group`,"aria-label":u.templates,indicatorClassName:`rounded-md bg-accent-soft`,children:[Object.keys(H).map(e=>{let t=H[e];return(0,B.jsxs)(`button`,{type:`button`,disabled:k,"aria-pressed":h===e,onClick:()=>{g(h===e?null:e),O.current?.focus()},className:p(`inline-flex items-center gap-1.5 rounded-md px-2 py-2 hover:bg-surface-hover disabled:opacity-50`,h===e&&`bg-accent-soft text-accent-fg`),children:[(0,B.jsx)(t,{className:`size-3.5`,"aria-hidden":!0}),u.templateOptions[e].label]},e)}),(0,B.jsx)(`button`,{type:`button`,className:`text-xs text-fg-muted`,onClick:()=>window.dispatchEvent(new CustomEvent(`open-recording-recoveries`)),children:i.discussionCapture.recoveredTitle}),(0,B.jsx)(V,{})]})]})}function Pe(e,t){let n=Number(e.get(`page`)??0),r=Number.isSafeInteger(n)&&n>=0?n:0,i=e.get(`view`);return{projectId:e.get(`projectId`)||void 0,unassigned:e.get(`unassigned`)===`true`||i===`unassigned`||void 0,pinned:i===`favorites`?!0:void 0,agentEdited:i===`agent`||void 0,status:i===`archived`?`archived`:void 0,search:t.trim()||void 0,sortBy:`updatedAt`,sortOrder:`desc`,limit:12,offset:r*12}}function Fe(e){let t=e.snippet?.trim()??``,n=e.title?.trim();return n&&t.startsWith(n)?t.slice(n.length).replace(/^[\s::·—-]+/,``):t}function Ie(e,t,n){return e.kind===`voice`&&/^Discussion · \d{4}-\d{2}-\d{2} \d{2}:\d{2}$/.test(e.title??``)?n:e.title?.trim()||Fe(e).slice(0,48)||t}var U=`touch-target inline-flex min-h-9 items-center justify-center gap-2 rounded-lg px-3 text-sm text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-50`;function W(){let e=h(e=>e.language),t=f(e).notes,n=t.home,r=ee(e=>e.conversationId),i=de(e=>e.setPageHeader),v=de(e=>e.clearPageHeader),x=s(),{pathname:S,search:re}=a(),[E,D]=o(),j=E.get(`projectId`)||``,M=E.get(`view`)||`all`,N=E.get(`unassigned`)===`true`||M===`unassigned`,P=E.get(`search`)||``,[_e]=b(P,250),[ve,F]=(0,z.useState)(j),[Se,we]=(0,z.useState)(``),[Ee,I]=(0,z.useState)(null),[L,R]=(0,z.useState)(!1),[V,je]=(0,z.useState)(!1),[Me,H]=(0,z.useState)(new Set),[W,G]=(0,z.useState)(null),[K,Le]=(0,z.useState)(null),q=(0,z.useRef)(new Set),J=(0,z.useRef)(null),Re=(0,z.useRef)(!1),ze=(0,z.useRef)(null),Be=Pe(E,_e),Y=(Be.offset??0)/12,{data:Ve,error:He,isLoading:Ue,mutate:We}=g(r?[`notes-home`,r,Be]:null,()=>xe(Be)),{data:Ge,error:Ke,isLoading:X,mutate:qe}=g(r?[`notes-home-projects`,r]:null,De),Z=Ge?.items??[],Je=Z.filter(e=>e.noteCount>0).slice(0,2),Ye=Z.find(e=>e.id===j)?.name??n.projectNotes,Xe=Ve?.items??[],Q=Ve?.total??0,Ze=Ue||P!==_e,Qe=(0,z.useMemo)(()=>({justNow:t.justNow,minutesAgo:t.minutesAgo,today:t.today,yesterday:t.yesterday,daysAgo:t.daysAgo,locale:m(e)}),[e,t.justNow,t.minutesAgo,t.today,t.yesterday,t.daysAgo]),[$e,et]=(0,z.useState)(()=>Date.now());(0,z.useEffect)(()=>{F(j)},[j]),(0,z.useEffect)(()=>{let e=window.setInterval(()=>et(Date.now()),6e4);return()=>window.clearInterval(e)},[]);let $=(0,z.useCallback)(()=>{We().catch(()=>void 0),qe().catch(()=>void 0)},[We,qe]);(0,z.useEffect)(()=>{let e=[`note-updated`,`note-created`,`note-deleted`,`project-updated`,`project-created`,`project-deleted`];return e.forEach(e=>window.addEventListener(e,$)),()=>e.forEach(e=>window.removeEventListener(e,$))},[$]);let tt=(0,z.useCallback)((e,t=!1)=>{let n=`${S}${re}`,r=new URLSearchParams({returnTo:n});t&&r.set(`edit`,`1`),x(`/notes/${encodeURIComponent(e)}?${r}`)},[S,re,x]),nt=(0,z.useCallback)(async()=>{if(!(Re.current||!r)){Re.current=!0,R(!0),I(null),J.current??={key:crypto.randomUUID(),projectId:j||void 0};try{let e=await ye({markdown:``,kind:`thought`,projectId:J.current.projectId},J.current.key);J.current=null,$(),tt(e.id,!0)}catch(e){I(`${t.createBlankFailed}: ${e instanceof Error?e.message:t.createBlankFailedHint}`)}finally{Re.current=!1,R(!1)}}},[j,t.createBlankFailed,t.createBlankFailedHint,tt,$,r]),rt=(0,z.useCallback)(e=>{D(t=>{let n=new URLSearchParams(t);return e?n.set(`search`,e):n.delete(`search`),n.delete(`page`),n},{replace:!0})},[D]);function it(e,t=`all`){let n=new URLSearchParams;e&&n.set(`projectId`,e),t===`unassigned`?n.set(`unassigned`,`true`):t!==`all`&&n.set(`view`,t),F(e),D(n)}function at(e){D(t=>{let n=new URLSearchParams(t);return N&&n.set(`unassigned`,`true`),e===`all`?n.delete(`view`):n.set(`view`,e),n.delete(`page`),n})}async function ot(e,n){if(!q.current.has(e)){q.current.add(e),H(new Set(q.current)),I(null);try{await y(e,{pinned:n}),$()}catch(e){I(`${t.actionFailed}: ${e instanceof Error?e.message:t.quickCaptureFailedHint}`)}finally{q.current.delete(e),H(new Set(q.current))}}}async function st(){let e=W;if(!(!e||K)){G(null),Le(e.id),I(null);try{await he(e.id),window.dispatchEvent(new CustomEvent(`note-deleted`,{detail:{noteId:e.id}})),$()}catch(e){I(`${t.deleteFailed}: ${e instanceof Error?e.message:t.quickCaptureFailedHint}`)}finally{Le(null)}}}if((0,z.useLayoutEffect)(()=>{if(!r){v();return}return i({startExtra:null,main:(0,B.jsx)(`h1`,{className:`truncate text-base font-semibold text-fg`,children:t.title}),end:(0,B.jsx)(`div`,{className:p(`flex min-w-0 items-center gap-2`,ie),children:(0,B.jsxs)(`label`,{className:`flex h-9 w-32 min-w-0 items-center gap-2 rounded-lg border border-edge bg-surface-panel px-2 sm:w-48`,children:[(0,B.jsx)(T,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,B.jsx)(`input`,{ref:ze,type:`search`,value:P,onChange:e=>rt(e.target.value),"aria-label":t.searchDialogTitle,placeholder:t.searchPlaceholder,className:`min-w-0 flex-1 bg-transparent text-sm text-fg outline-none placeholder:text-fg-muted`})]})})}),()=>v()},[v,nt,L,n.blankNote,t.searchDialogTitle,t.searchPlaceholder,t.title,P,i,rt,r]),(0,z.useEffect)(()=>{let e=e=>{!(e.metaKey||e.ctrlKey)||e.altKey||e.isComposing||e.target?.closest(`input, textarea, [contenteditable="true"], [role="dialog"]`)||(e.key.toLowerCase()===`n`&&(e.preventDefault(),nt()),e.key.toLowerCase()===`f`&&(e.preventDefault(),ze.current?.focus()))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[nt]),!r)return(0,B.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8 text-sm text-fg-muted`,children:t.needToken});let ct=[{id:`all`,label:n.homeNav,Icon:le},{id:`favorites`,label:n.favorites,Icon:me},{id:`unassigned`,label:n.unassigned,Icon:ke},{id:`archived`,label:t.filterArchived,Icon:oe}],lt=j?`project:${j}`:N?`unassigned`:`all`,ut=!Ze&&!He&&Q===0&&!j&&!N&&!P&&M===`all`;return(0,B.jsxs)(`div`,{className:`flex h-full min-h-0 w-full flex-1 overflow-hidden bg-surface-panel`,children:[(0,B.jsxs)(`aside`,{className:`hidden w-44 shrink-0 flex-col gap-1 overflow-y-auto px-3 py-6 xl:flex`,"aria-label":n.homeNav,children:[ct.map(({id:e,label:t,Icon:n})=>(0,B.jsxs)(`button`,{type:`button`,onClick:()=>it(``,e),"aria-current":!j&&(e===`unassigned`?N:!N&&M===e)?`page`:void 0,className:p(U,`justify-start px-2 text-left text-xs`,!j&&(e===`unassigned`?N:!N&&M===e)&&`bg-surface-hover font-medium text-fg`),children:[(0,B.jsx)(n,{className:`size-4 shrink-0`,"aria-hidden":!0}),t]},e)),(0,B.jsx)(`span`,{className:`mb-1 mt-7 px-2 text-xs text-fg-muted`,children:n.projects}),X?[0,1,2].map(e=>(0,B.jsx)(_,{className:`mb-2 h-8 w-full`},e)):Z.slice(0,8).map(e=>(0,B.jsxs)(`button`,{type:`button`,onClick:()=>it(e.id),"aria-current":j===e.id?`page`:void 0,className:p(U,`justify-start px-2 text-left text-xs`,j===e.id&&`bg-surface-hover font-medium text-fg`),children:[(0,B.jsx)(ae,{className:`size-4 shrink-0`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`truncate`,children:e.name})]},e.id)),(0,B.jsxs)(`button`,{type:`button`,onClick:()=>x(`/projects`),className:p(U,`mt-2 justify-start px-2 text-xs`),children:[n.allProjects,(0,B.jsx)(w,{className:`ml-auto size-3`,"aria-hidden":!0})]})]}),(0,B.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,B.jsxs)(`div`,{className:`mx-auto flex w-full max-w-7xl flex-col px-4 pb-4 pt-3 sm:px-6 sm:pb-7 lg:px-8 lg:pb-9 lg:pt-4`,children:[(0,B.jsxs)(`div`,{className:`mb-5 flex flex-wrap items-start justify-between gap-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h2`,{className:`min-w-0 break-words text-2xl font-semibold tracking-tight text-fg`,children:j?Ye:N?n.unassigned:ut?n.firstNoteTitle:n.continueTitle}),(0,B.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:j?n.projectDescription:ut?n.firstNoteDescription:n.continueDescription})]}),j?(0,B.jsxs)(`button`,{type:`button`,onClick:()=>x(`/projects/${encodeURIComponent(j)}`),className:p(U,`text-xs`),children:[n.openProject,(0,B.jsx)(w,{className:`size-3.5`,"aria-hidden":!0})]}):null]}),Ee?(0,B.jsx)(`p`,{className:`mb-4 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,role:`alert`,children:Ee}):null,(0,B.jsxs)(`section`,{"aria-label":n.startAction,children:[(0,B.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,B.jsxs)(`button`,{type:`button`,onClick:()=>void nt(),disabled:L,className:`touch-target flex min-h-20 items-center gap-3 rounded-xl border border-edge bg-surface-panel p-4 text-left transition-colors hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:[L?(0,B.jsx)(d,{className:`size-5 shrink-0 animate-spin text-fg-muted`,"aria-hidden":!0}):(0,B.jsx)(k,{className:`size-5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:n.blankNote}),(0,B.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:n.blankActionHint})]})]}),(0,B.jsxs)(`button`,{type:`button`,"aria-label":n.recordAction,onClick:()=>ne(j||void 0),className:`touch-target flex min-h-20 items-center gap-3 rounded-xl border border-edge bg-surface-panel p-4 text-left transition-colors hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,B.jsx)(pe,{className:`size-5 shrink-0 text-accent-fg`,"aria-hidden":!0}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:n.recordAction}),(0,B.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:n.recordActionHint})]})]})]}),(0,B.jsxs)(`button`,{type:`button`,onClick:()=>{je(e=>!e),V||window.requestAnimationFrame(()=>document.getElementById(`notes-home-prompt`)?.focus())},"aria-expanded":V,"aria-controls":`notes-home-agent-composer`,title:n.agentActionHint,className:`touch-target mt-2 inline-flex min-h-11 items-center gap-2 rounded-lg px-2 text-sm text-fg-muted hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,B.jsx)(Oe,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),n.agentAction,(0,B.jsx)(c,{className:p(`size-4 transition-transform`,V&&`rotate-180`),"aria-hidden":!0})]}),(0,B.jsx)(`div`,{id:`notes-home-agent-composer`,hidden:!V,className:p(`mt-3`,!V&&`hidden`),children:(0,B.jsx)(Ne,{projects:Z,projectId:ve,onProjectChange:F,onCreated:$,labels:t,projectsLoading:X,projectsError:!!Ke})})]}),Ke?(0,B.jsxs)(`div`,{role:`alert`,className:`mt-4 flex items-center gap-3 text-xs text-danger`,children:[(0,B.jsx)(`span`,{children:n.projectsLoadFailed}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>void qe().catch(()=>void 0),className:`underline`,children:n.retry})]}):null,ut?null:(0,B.jsxs)(`section`,{className:`mt-8 pb-6`,"aria-label":n.recentNotes,children:[(0,B.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-3`,children:[(0,B.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:M===`favorites`?n.favorites:M===`archived`?t.filterArchived:j?n.projectNotes:n.recentNotes}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,B.jsx)(`button`,{type:`button`,"aria-pressed":M===`agent`,onClick:()=>at(M===`agent`?`all`:`agent`),className:p(`touch-target rounded-md px-2 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:ring-2 focus-visible:ring-accent`,M===`agent`&&`bg-accent-soft text-accent-fg`),children:n.agentEdited}),(0,B.jsx)(`span`,{className:`hidden text-xs text-fg-muted xl:inline`,children:n.sortUpdated}),(0,B.jsx)(`div`,{className:`w-48 max-w-full xl:hidden`,children:(0,B.jsx)(l,{value:lt,allowEmpty:!1,ariaLabel:n.projects,placeholder:n.allNotes,options:[{value:`all`,label:n.allNotes},{value:`unassigned`,label:n.unassigned},...Z.filter(e=>e.name.toLowerCase().includes(Se.toLowerCase())).map(e=>({value:`project:${e.id}`,label:e.name}))],selectedLabel:j?Ye:N?n.unassigned:n.allNotes,triggerClassName:`h-8 bg-surface-panel text-xs`,loading:X,searchPlaceholder:n.projectSearch,searchValue:Se,onSearchChange:we,onChange:e=>it(e.startsWith(`project:`)?e.slice(8):``,e===`unassigned`?e:`all`)})})]})]}),(0,B.jsxs)(te,{className:`flex flex-wrap items-center gap-x-5 border-b border-edge xl:hidden`,"aria-label":t.libraryTitle,role:`group`,children:[[{id:`all`,label:t.filterAll},{id:`favorites`,label:n.favorites},{id:`archived`,label:t.filterArchived}].map(({id:e,label:t})=>(0,B.jsx)(`button`,{type:`button`,"aria-pressed":M===e||e===`all`&&M===`unassigned`,onClick:()=>at(e),className:p(`touch-target border-b-2 border-transparent py-3 text-xs text-fg-muted hover:text-fg`,(M===e||e===`all`&&M===`unassigned`)&&`border-fg font-medium text-fg`),children:t},e)),(0,B.jsx)(`span`,{className:`ml-auto py-3 text-xs text-fg-muted`,children:n.sortUpdated})]}),He?(0,B.jsxs)(`div`,{className:`py-10 text-center`,role:`alert`,children:[(0,B.jsx)(`p`,{className:`text-sm text-danger`,children:n.loadFailed}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>void We().catch(()=>void 0),className:p(U,`mt-2`),children:n.retry})]}):Ze?(0,B.jsx)(`div`,{"aria-busy":`true`,className:`divide-y divide-edge`,children:[0,1,2,3].map(e=>(0,B.jsxs)(`div`,{className:`flex items-center gap-3 py-4`,children:[(0,B.jsx)(_,{className:`h-10 w-8 shrink-0`}),(0,B.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,B.jsx)(_,{className:`h-4 w-2/3`}),(0,B.jsx)(_,{className:`h-3 w-1/2`})]})]},e))}):Xe.length===0?(0,B.jsxs)(`div`,{className:`flex flex-col items-center px-4 py-12 text-center`,children:[(0,B.jsx)(le,{className:`mb-4 size-8 text-fg-muted`,strokeWidth:1.3,"aria-hidden":!0}),(0,B.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:P||M!==`all`&&M!==`unassigned`?n.noMatches:j?n.projectEmpty:n.emptyTitle}),(0,B.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-fg-muted`,children:P||M!==`all`&&M!==`unassigned`?n.noMatchesHint:j?n.projectEmptyHint:n.emptyDescription})]}):(0,B.jsx)(`ul`,{className:`divide-y divide-edge`,children:Xe.map(e=>{let r=e.voiceAttachmentId||e.kind===`voice`?C:e.kind===`bookmark`?O:ce,i=Ie(e,t.titlePlaceholder,n.voiceNote),a=Fe(e)||(e.coverAttachmentId?t.imageNote:t.noText);return(0,B.jsxs)(`li`,{className:`group flex min-w-0 items-center gap-3 py-4`,children:[(0,B.jsxs)(`button`,{type:`button`,onClick:()=>tt(e.id),className:`touch-target flex min-w-0 flex-1 items-center gap-3 rounded-md text-left focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,B.jsx)(`span`,{className:`flex h-10 w-8 shrink-0 items-center justify-center rounded-md border border-edge text-fg-muted`,children:(0,B.jsx)(r,{className:`size-4`,"aria-hidden":!0})}),(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(`span`,{className:`block truncate text-base font-medium text-fg sm:text-sm group-hover:text-accent-fg`,children:i}),(0,B.jsxs)(`span`,{className:`mt-1 flex min-w-0 items-center gap-1.5 text-xs text-fg-muted`,children:[e.lastEditTrigger===`ai_edit`?(0,B.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-accent-fg`,children:[(0,B.jsx)(Oe,{className:`size-3`,"aria-hidden":!0}),n.agentEditLabel,(0,B.jsx)(`span`,{"aria-hidden":!0,children:`·`})]}):null,(0,B.jsx)(`span`,{className:`truncate`,children:a})]}),(0,B.jsx)(`time`,{dateTime:new Date(e.updatedAt).toISOString(),className:`mt-1.5 block text-xs text-fg-muted sm:hidden`,children:Ae(e.updatedAt,$e,Qe)})]})]}),(0,B.jsx)(`span`,{className:`hidden max-w-32 truncate text-xs text-fg-muted md:block`,title:e.projects?.map(e=>e.name).join(` · `),children:e.projects?.map(e=>e.name).join(` · `)||n.unassigned}),(0,B.jsx)(`time`,{dateTime:new Date(e.updatedAt).toISOString(),className:`hidden w-24 shrink-0 text-right text-xs text-fg-muted sm:block`,children:Ae(e.updatedAt,$e,Qe)}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>void ot(e.id,!e.pinned),disabled:Me.has(e.id),"aria-label":`${e.pinned?n.unfavorite:n.favorite}: ${i}`,"aria-pressed":!!e.pinned,className:`touch-target inline-flex size-9 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg disabled:opacity-50 focus-visible:ring-2 focus-visible:ring-accent`,children:(0,B.jsx)(me,{className:p(`size-4`,e.pinned&&`fill-current text-fg`),"aria-hidden":!0})}),(0,B.jsxs)(fe,{children:[(0,B.jsx)(be,{asChild:!0,children:(0,B.jsx)(`button`,{type:`button`,disabled:K===e.id,"aria-label":`${t.noteActions}: ${i}`,className:`touch-target inline-flex size-9 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg disabled:opacity-50 focus-visible:ring-2 focus-visible:ring-accent`,children:K===e.id?(0,B.jsx)(d,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,B.jsx)(u,{className:`size-4`,"aria-hidden":!0})})}),(0,B.jsx)(Te,{children:(0,B.jsx)(ue,{align:`end`,sideOffset:4,className:`z-50 min-w-36 rounded-lg border border-edge bg-surface-overlay p-1 shadow-popover`,children:(0,B.jsxs)(ge,{className:`touch-target flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-danger-soft focus:bg-danger-soft`,onSelect:()=>G(e),children:[(0,B.jsx)(Ce,{className:`size-4`,"aria-hidden":!0}),t.delete]})})})]})]},e.id)})}),!Ze&&!He&&Q>0?(0,B.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-between gap-3 text-xs text-fg-muted`,"aria-live":`polite`,children:[(0,B.jsx)(`span`,{children:t.noteCount.replace(`{{count}}`,String(Q))}),Q>12||Y>0?(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`button`,{type:`button`,"aria-label":n.previousPage,disabled:Y===0,className:U,onClick:()=>D(e=>{let t=new URLSearchParams(e);return t.set(`page`,String(Y-1)),t}),children:(0,B.jsx)(A,{className:`size-4`,"aria-hidden":!0})}),(0,B.jsxs)(`span`,{children:[Y+1,` / `,Math.max(1,Math.ceil(Q/12))]}),(0,B.jsx)(`button`,{type:`button`,"aria-label":n.nextPage,disabled:(Y+1)*12>=Q,className:U,onClick:()=>D(e=>{let t=new URLSearchParams(e);return t.set(`page`,String(Y+1)),t}),children:(0,B.jsx)(w,{className:`size-4`,"aria-hidden":!0})})]}):null]}):null]}),!j&&!N&&(X||Je.length>0)?(0,B.jsxs)(`section`,{className:`mt-8`,"aria-label":n.continueProjects,children:[(0,B.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,B.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.continueProjects}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>x(`/projects`),className:`text-xs text-fg-muted hover:text-fg`,children:n.allProjects})]}),(0,B.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:X?[0,1].map(e=>(0,B.jsx)(_,{className:`h-28 w-full`},e)):Je.map(e=>(0,B.jsxs)(`button`,{type:`button`,onClick:()=>it(e.id),className:`min-w-0 rounded-lg border border-edge bg-surface-panel p-3 text-left transition-colors sm:p-4 hover:bg-surface-base focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,B.jsxs)(`span`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,B.jsx)(ae,{className:`size-4 shrink-0`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`truncate`,children:e.name})]}),e.description?(0,B.jsx)(`p`,{className:`mt-2 hidden line-clamp-1 text-xs text-fg-muted sm:block`,children:e.description}):null,(0,B.jsxs)(`span`,{className:`mt-2 flex flex-wrap items-center justify-between gap-1 text-xs text-fg-muted sm:mt-3`,children:[(0,B.jsx)(`span`,{children:t.noteCount.replace(`{{count}}`,String(e.noteCount))}),(0,B.jsx)(`span`,{children:e.updatedAt?Ae(e.updatedAt,$e,Qe):n.emptyProject})]})]},e.id))})]}):null]})}),(0,B.jsx)(se,{open:W!==null,title:t.deleteConfirmTitle,description:t.deleteConfirmDescription.replace(`{{title}}`,W?.title||t.titlePlaceholder),confirmLabel:t.deleteConfirmLabel,cancelLabel:t.deleteCancelLabel,destructive:!0,onConfirm:()=>void st(),onCancel:()=>G(null)})]})}function G(){let e=(0,R.c)(12),{noteId:t}=i(),n=s(),[r]=o(),a;e[0]===r?a=e[1]:(a=S(r.get(`returnTo`),`/notes`,[`/chat`,`/personal`,`/projects`,`/notes`,`/tasks`]),e[0]=r,e[1]=a);let c=a,l;e[2]!==n||e[3]!==c?(l=()=>{n(c)},e[2]=n,e[3]=c,e[4]=l):l=e[4];let u=l;if(!t)return null;let d=r.get(`edit`)===`1`?`wysiwyg`:`preview`,f;e[5]===r?f=e[6]:(f=r.get(`edit`),e[5]=r,e[6]=f);let p=f===`1`,m;return e[7]!==u||e[8]!==t||e[9]!==d||e[10]!==p?(m=(0,B.jsx)(`div`,{className:`mx-auto flex h-full min-h-0 w-full max-w-6xl flex-1 flex-col`,children:(0,B.jsx)(L,{noteId:t,onBack:u,initialMode:d,autoFocus:p},t)}),e[7]=u,e[8]=t,e[9]=d,e[10]=p,e[11]=m):m=e[11],m}function K(){let e=(0,R.c)(2),{noteId:t}=i(),n;return e[0]===t?n=e[1]:(n=t?(0,B.jsx)(G,{}):(0,B.jsx)(W,{}),e[0]=t,e[1]=n),n}export{K as NotesPage};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{l as r,u as i}from"./chunk-KS7C4IRE-BvcCCgTW.js";import{t as a}from"./loader-circle-CifKLtgG.js";import{t as o}from"./messages-BYq0cPbn.js";import{l as s,n as c}from"./locale-store-B7s2Hb35.js";import{t as l}from"./session-manager-B_h0jlLb.js";import{ad as u,d,u as f,uc as p}from"./index-DRyGCING.js";var m=e(t(),1),h=n();function g({resource:e,selection:t,label:n,disabled:g=!1}){let _=o(c(e=>e.language)).chat.pageContext,v=i(),y=r().key,[b,x]=(0,m.useState)(!1),[S,C]=(0,m.useState)(!1),w=(0,m.useRef)(!1),T=(0,m.useRef)(0),E=s(e=>e.baseUrl),D=s(e=>e.conversationId);(0,m.useEffect)(()=>(w.current=!1,x(!1),C(!1),()=>{T.current+=1}),[y,e.kind,e.id,e.revision,t?.text,t?.draft,g,E,D]);async function O(){if(g||w.current)return;w.current=!0,x(!0),C(!1);let n=T.current,r=()=>T.current===n&&s.getState().baseUrl===E&&s.getState().conversationId===D;try{let n=d.capture({title:``,text:``,resourceRefs:[e],selection:t}),i=await p(`xopc.context.resolve`,n.envelope);if(!r())return;let a=i.resources[0];if(i.resources.length!==1||JSON.stringify(i.snapshot)!==JSON.stringify(n.envelope)||a.reference.kind!==e.kind||a.reference.id!==e.id||a.reference.revision!==e.revision)throw Error(`Context mismatch`);n.title=a.title,n.preview=a.text,n.truncated=a.truncated;let o=await new l().createSession();if(!r())return;if(!d.put(f(E,D,o.key),n))throw Error(`Context draft limit reached`);v(`/chat/${encodeURIComponent(o.key)}`)}catch{r()&&C(!0)}finally{T.current===n&&(w.current=!1,x(!1))}}return(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col items-start gap-1`,children:[(0,h.jsxs)(`button`,{type:`button`,disabled:g||b,onClick:()=>void O(),"aria-busy":b,title:g?_.unavailable:n??_.capture,className:`inline-flex min-h-9 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:[b?(0,h.jsx)(a,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,h.jsx)(u,{className:`size-3.5`,"aria-hidden":!0}),n??_.capture]}),S?(0,h.jsx)(`p`,{role:`alert`,className:`max-w-72 text-xs text-danger`,children:_.unavailable}):null]})}export{g as t};
@@ -0,0 +1 @@
1
+ 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"./chunk-KS7C4IRE-BvcCCgTW.js";import{t as a}from"./check-DUBLcKHA.js";import{t as o}from"./popover-select-DGKUpVsz.js";import{t as s}from"./messages-BYq0cPbn.js";import{i as c,n as l,o as u}from"./locale-store-B7s2Hb35.js";import{T as d,d as f,t as p}from"./session-manager-B_h0jlLb.js";import{t as m}from"./skeleton-BI5TyibZ.js";import{a as h,i as g,o as _,r as v,s as y,t as b}from"./dist-C3DSFZCi.js";import{Cu as x,Jd as S,Kl as ee,Pc as C,U as w,W as T,Wo as E,Xl as D,Y as O,Yd as te,Zc as ne,_l as k,co as A,eo as j,es as M,kl as N,n as P,ns as F,oi as re,qa as I,qd as ie,rl as ae,zo as oe}from"./index-DRyGCING.js";import{l as L,n as se,t as ce}from"./voice-config-api-BkUlN7GH.js";import{t as R}from"./date-formatters-DukWSVwc.js";var z=n(),B=e(t(),1),V=r(),H=[`intro`,`identity`,`voice`,`connections`],le=[{id:`loopi`,zh:`Loopi`,en:`Loopi`},{id:`loopi-curious`,zh:`好奇`,en:`Curious`},{id:`loopi-care`,zh:`温和`,en:`Gentle`}];function U(e){return!!(e?.enabled&&(e.status===`connected`||e.connectionStatus===`connected`||e.authStatus===`connected`))}async function W(e,t){let n=await new Promise((e,n)=>{let r=new FileReader;r.onload=()=>e(String(r.result)),r.onerror=()=>n(r.error),r.readAsDataURL(t)});await u(c(`/api/agents/${encodeURIComponent(e)}/avatar`),{method:`PUT`,body:JSON.stringify({base64:n.slice(n.indexOf(`,`)+1),mimeType:t.type})}),j(e)}function ue({modelsAvailable:e,onCreated:t}){let n=l(e=>e.language)===`zh`,r=l(e=>e.language),[o,d]=(0,B.useState)(`intro`),[f,p]=(0,B.useState)({displayName:`Ada`,appearance:`loopi`,voice:null}),[h,g]=(0,B.useState)(!1),[_,v]=(0,B.useState)(!1),[y,b]=(0,B.useState)(null),[x,C]=(0,B.useState)(null),[D,ne]=(0,B.useState)(null),[k,A]=(0,B.useState)(null),[j,N]=(0,B.useState)(!0),[P,re]=(0,B.useState)([]),[ie,oe]=(0,B.useState)(null),R=(0,B.useRef)(null),z=(0,B.useRef)(null),[ue,de]=(0,B.useState)([]),[G,fe]=(0,B.useState)(!0),[pe,K]=(0,B.useState)([]),[q,J]=(0,B.useState)(null);(0,B.useEffect)(()=>{let e=!1;return u(c(`/api/personal-agent/onboarding`)).then(t=>{e||(d(t.payload.step),p(t.payload.draft))}).catch(t=>{e||b(t instanceof Error?t.message:String(t))}).finally(()=>{e||g(!0)}),()=>{e=!0}},[]),(0,B.useEffect)(()=>{if(!h)return;let e=window.setTimeout(()=>{u(c(`/api/personal-agent/onboarding`),{method:`PUT`,body:JSON.stringify({step:o,draft:f})}).catch(()=>{})},350);return()=>window.clearTimeout(e)},[f,h,o]),(0,B.useEffect)(()=>{let e=!1;return ce().then(t=>{e||(t.tts&&t.enabled?A({provider:t.tts.provider,model:t.tts.model,enabled:!0}):N(!1))}).catch(()=>{e||N(!1)}),()=>{e=!0}},[]),(0,B.useEffect)(()=>{if(!k?.enabled)return;let e=!1;return se(k.provider,k.model,`realtime`).then(t=>{e||re(t.slice(0,12))}).catch(()=>{}).finally(()=>{e||N(!1)}),()=>{e=!0}},[k]),(0,B.useEffect)(()=>{if(o!==`connections`)return;let e=!1;return fe(!0),Promise.allSettled([M({page:1,pageSize:24,verification:`verified`}),F()]).then(([t,n])=>{if(!e){if(t.status===`fulfilled`){let e=[`gmail`,`googlecalendar`,`googledrive`,`github`,`linear`];de(t.value.connectors.filter(t=>t.runtime.type===`composio`&&e.includes(t.runtime.toolkit)).sort((t,n)=>e.indexOf(t.runtime.type===`composio`?t.runtime.toolkit:``)-e.indexOf(n.runtime.type===`composio`?n.runtime.toolkit:``)))}n.status===`fulfilled`&&K(n.value),fe(!1)}}),()=>{e=!0}},[o]),(0,B.useEffect)(()=>()=>{z.current?.abort(),R.current?.close()},[]),(0,B.useEffect)(()=>()=>{D&&URL.revokeObjectURL(D)},[D]);let me=async(e,t=f)=>{await u(c(`/api/personal-agent/onboarding`),{method:`PUT`,body:JSON.stringify({step:e,draft:t})}),d(e)},Y=async e=>{b(null);let t=H[Math.max(0,Math.min(H.length-1,H.indexOf(o)+e))];try{await me(t)}catch(e){b(e instanceof Error?e.message:String(e))}},he=async(n=!1)=>{if(!(!e||_)){v(!0),b(null);try{let e=n?{displayName:`Ada`,appearance:`loopi`,voice:null}:f,r=e.voice&&k?.enabled&&P.some(t=>t.id===e.voice)?{provider:k.provider,model:k.model,voice:e.voice}:void 0,i=(await u(c(`/api/personal-agent`),{method:`POST`,body:JSON.stringify({displayName:e.displayName.trim()||`Ada`,appearance:e.appearance,...r?{voicePreference:r}:{}})})).payload,a=!1;if(!n&&x)try{await W(i.agentId,x),i=(await u(c(`/api/personal-agent/profile`),{method:`PATCH`,body:JSON.stringify({revision:i.revision,displayName:i.displayName,appearance:`custom`})})).payload}catch{a=!0}t(i,a)}catch(e){b(e instanceof Error?e.message:String(e))}finally{v(!1)}}},X=(0,B.useCallback)(async e=>{z.current?.abort(),R.current?.close();let t=new AbortController;z.current=t,oe(e),b(null);try{let n=new E;R.current=n,await n.start();let r=await L(t.signal,e);if(t.signal.aborted)return;n.enqueue(r,()=>oe(null))}catch(e){t.signal.aborted||b(e instanceof Error?e.message:String(e)),oe(null)}},[]);if(!h)return(0,V.jsxs)(`div`,{className:`mx-auto w-full max-w-xl space-y-4 px-6 py-14`,children:[(0,V.jsx)(m,{className:`h-10 w-2/3`}),(0,V.jsx)(m,{className:`h-64 w-full rounded-2xl`}),(0,V.jsx)(m,{className:`h-12 w-full rounded-xl`})]});let Z=H.indexOf(o),ge={intro:n?`创建一个和你一起做事的助手`:`Create an assistant to work with you`,identity:n?`先给它一个形象和名字`:`Choose a look and a name`,voice:n?`想让我用什么声音回应?`:`How should your assistant sound?`,connections:n?`要让我了解哪些信息?`:`What information can your assistant use?`}[o];return(0,V.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-surface-base`,children:[(0,V.jsx)(`header`,{className:`shrink-0 px-5 pt-5 sm:px-8 sm:pt-7`,children:(0,V.jsxs)(`div`,{className:`mx-auto w-full max-w-2xl`,children:[(0,V.jsxs)(`div`,{className:`flex min-h-10 items-center justify-between gap-4`,children:[Z>0?(0,V.jsxs)(`button`,{type:`button`,disabled:_,onClick:()=>void Y(-1),className:`-ml-2 inline-flex min-h-10 items-center gap-1.5 rounded-lg px-2 text-sm text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-40`,children:[(0,V.jsx)(te,{className:`size-4`}),n?`上一步`:`Back`]}):(0,V.jsx)(`span`,{className:`text-sm font-medium text-fg-muted`,children:n?`设置我的助手`:`Set up my assistant`}),(0,V.jsx)(i,{to:`/chat`,className:`-mr-2 inline-flex min-h-10 items-center rounded-lg px-2 text-sm 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:n?`稍后继续`:`Finish later`})]}),(0,V.jsx)(`div`,{className:`mt-4 grid grid-cols-4 gap-1.5`,role:`progressbar`,"aria-label":n?`设置进度`:`Setup progress`,"aria-valuenow":Z+1,"aria-valuemin":1,"aria-valuemax":H.length,children:H.map((e,t)=>(0,V.jsx)(`span`,{className:`h-1 rounded-full transition-colors duration-200 ${t<=Z?`bg-accent`:`bg-surface-active`}`},e))})]})}),(0,V.jsx)(`main`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto px-5 py-8 sm:px-8`,children:(0,V.jsxs)(`div`,{className:`mx-auto my-auto w-full max-w-2xl py-6 motion-safe:animate-[page-enter_220ms_ease-out]`,children:[(0,V.jsxs)(`div`,{className:`mb-8 flex items-center gap-4`,children:[(0,V.jsx)(`span`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl bg-surface-hover`,children:D?(0,V.jsx)(`img`,{src:D,alt:``,className:`size-14 rounded-xl object-cover`}):(0,V.jsx)(I,{appearance:f.appearance,className:`size-14`})}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`我的助手`:`My assistant`}),(0,V.jsx)(`p`,{className:`mt-1 text-lg font-semibold text-fg`,children:f.displayName||`Ada`})]})]}),(0,V.jsx)(`p`,{className:`mb-3 text-xs font-medium tracking-wide text-fg-subtle`,children:n?`第 ${Z+1} 步 · 共 ${H.length} 步`:`Step ${Z+1} of ${H.length}`}),(0,V.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight text-fg sm:text-3xl`,children:ge}),o===`intro`&&(0,V.jsxs)(`div`,{className:`mt-6 max-w-xl space-y-3 text-base leading-8 text-fg-muted`,children:[(0,V.jsx)(`p`,{children:n?`你可以找它讨论问题,也可以交给它一件要推进的事。`:`Talk through a question or give it something to move forward.`}),(0,V.jsx)(`p`,{children:n?`需要深入处理时,它会找合适的 Agent,并把进展带回对话。`:`It can ask a suitable Agent for deeper work and bring the progress back.`}),(0,V.jsx)(`p`,{children:n?`它能使用哪些数据和设备,由你决定。`:`You choose which data and devices it can use.`})]}),o===`identity`&&(0,V.jsxs)(`div`,{className:`mt-7 space-y-7`,children:[(0,V.jsxs)(`label`,{className:`block text-sm font-medium text-fg`,children:[n?`助手名字`:`Assistant name`,(0,V.jsx)(`input`,{value:f.displayName,maxLength:60,onChange:e=>p(t=>({...t,displayName:e.target.value})),onBlur:()=>p(e=>({...e,displayName:e.displayName.trim()||`Ada`})),className:`mt-2 block w-full rounded-xl border border-edge bg-surface-panel px-4 py-3 text-fg outline-none focus-visible:ring-2 focus-visible:ring-accent`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`mb-3 text-sm font-medium text-fg`,children:n?`选择头像`:`Choose an avatar`}),(0,V.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[le.map(e=>(0,V.jsxs)(`button`,{type:`button`,"aria-pressed":!x&&f.appearance===e.id,onClick:()=>{C(null),ne(null),p(t=>({...t,appearance:e.id}))},className:`flex min-h-28 flex-col items-center justify-center gap-2 rounded-2xl p-3 text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${!x&&f.appearance===e.id?`bg-accent/10 text-fg ring-1 ring-accent/40`:`bg-surface-panel text-fg-muted hover:bg-surface-hover`}`,children:[(0,V.jsx)(I,{appearance:e.id,className:`size-14`}),n?e.zh:e.en]},e.id)),(0,V.jsxs)(`label`,{className:`flex min-h-28 cursor-pointer flex-col items-center justify-center gap-2 rounded-2xl p-3 text-sm transition-colors focus-within:ring-2 focus-within:ring-accent ${x?`bg-accent/10 text-fg ring-1 ring-accent/40`:`bg-surface-panel text-fg-muted hover:bg-surface-hover`}`,children:[(0,V.jsx)(ae,{className:`size-6`}),n?`上传图片`:`Upload image`,(0,V.jsx)(`input`,{className:`sr-only`,type:`file`,accept:`image/png,image/jpeg,image/webp`,onChange:e=>{let t=e.target.files?.[0];if(t){if(t.size>512*1024||![`image/png`,`image/jpeg`,`image/webp`].includes(t.type)){b(n?`请选择不超过 512 KB 的 PNG、JPEG 或 WebP 图片。`:`Choose a PNG, JPEG, or WebP image under 512 KB.`);return}C(t),ne(URL.createObjectURL(t))}}})]})]}),(0,V.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:n?`自定义图片在创建助手时上传;刷新后需要重新选择。`:`Custom images upload when you create the assistant; select again after a refresh.`})]})]}),o===`voice`&&(0,V.jsxs)(`div`,{className:`mt-5`,children:[(0,V.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:n?`用于这个助手的语音通话;文字回答不受影响。试听不会使用麦克风。`:`This affects calls with this assistant. Text stays the same. Preview does not use your microphone.`}),j?(0,V.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[(0,V.jsx)(m,{className:`h-20 rounded-xl`}),(0,V.jsx)(m,{className:`h-20 rounded-xl`})]}):k?.enabled&&P.length>0?(0,V.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[(0,V.jsx)(`button`,{type:`button`,"aria-pressed":!f.voice,onClick:()=>p(e=>({...e,voice:null})),className:`rounded-xl p-4 text-left text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${f.voice?`bg-surface-panel text-fg-muted hover:bg-surface-hover`:`bg-accent/10 text-fg ring-1 ring-accent/40`}`,children:n?`使用默认声音`:`Use the default voice`}),P.map(e=>(0,V.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl p-3 transition-colors ${f.voice===e.id?`bg-accent/10 ring-1 ring-accent/40`:`bg-surface-panel hover:bg-surface-hover`}`,children:[(0,V.jsxs)(`button`,{type:`button`,className:`min-w-0 flex-1 rounded-lg text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-pressed":f.voice===e.id,onClick:()=>p(t=>({...t,voice:e.id})),children:[(0,V.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.name}),(0,V.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:e.description||e.style||(n?`点击选择`:`Select this voice`)})]}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>void X(e.id),className:`flex size-9 shrink-0 items-center justify-center rounded-full bg-surface-hover text-fg hover:bg-surface-active focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":n?`试听${e.name}`:`Preview ${e.name}`,children:(0,V.jsx)(ee,{className:`size-4 ${ie===e.id?`text-accent`:``}`})})]},e.id))]}):(0,V.jsxs)(`div`,{className:`mt-5 rounded-xl bg-surface-panel p-5 text-sm text-fg-muted`,children:[(0,V.jsx)(`p`,{children:n?`当前没有可试听的语音。你可以先用文字对话,稍后再设置。`:`No voice is ready to preview. You can start with text and set it up later.`}),(0,V.jsx)(i,{to:`/settings/capabilities/models?configure=speech&returnTo=%2Fpersonal`,className:`mt-3 inline-block text-accent hover:underline`,children:n?`设置语音服务`:`Set up voice`})]})]}),o===`connections`&&(0,V.jsxs)(`div`,{className:`mt-5`,children:[(0,V.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:n?`现在连接,或进入对话后再添加。连接不会自动读取历史数据或创建持续关注。`:`Connect now or add sources later. Connecting does not automatically scan history or create ongoing monitoring.`}),G?(0,V.jsxs)(`div`,{className:`mt-5 space-y-2`,children:[(0,V.jsx)(m,{className:`h-18 rounded-xl`}),(0,V.jsx)(m,{className:`h-18 rounded-xl`})]}):(0,V.jsx)(`div`,{className:`mt-5 space-y-2`,children:ue.length?ue.map(e=>{let t=U(pe.find(t=>t.connectorId===e.id));return(0,V.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-surface-panel p-4`,children:[(0,V.jsx)(T,{connector:e,size:`sm`}),(0,V.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,V.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:e.displayName}),(0,V.jsx)(`p`,{className:`line-clamp-2 text-xs text-fg-muted`,children:e.description})]}),t?(0,V.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-success`,children:[(0,V.jsx)(a,{className:`size-4`}),n?`已连接`:`Connected`]}):(0,V.jsx)(`button`,{type:`button`,onClick:()=>J(O(e)),className:`rounded-lg bg-surface-hover px-3 py-2 text-xs text-fg transition-colors hover:bg-surface-active focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:n?`连接`:`Connect`})]},e.id)}):(0,V.jsx)(`p`,{className:`rounded-xl bg-surface-panel p-5 text-sm text-fg-muted`,children:n?`暂无可用的推荐服务;你仍可直接进入对话。`:`No suggested services are available. You can continue to chat.`})})]}),!e&&(0,V.jsxs)(`p`,{className:`mt-5 rounded-xl bg-warning/5 p-4 text-sm text-fg-muted`,children:[n?`开始前需要一个可用模型。`:`A compatible model is required before you start.`,` `,(0,V.jsx)(i,{to:`/settings/capabilities/models`,className:`text-accent underline`,children:n?`配置模型`:`Set up a model`})]}),y&&(0,V.jsx)(`p`,{role:`alert`,className:`mt-5 text-sm text-danger`,children:y})]},o)}),(0,V.jsx)(`footer`,{className:`shrink-0 px-5 pb-6 pt-3 sm:px-8 sm:pb-9`,children:(0,V.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col-reverse gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,V.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:n?`这些选择以后都能调整`:`You can change these choices later`}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[o===`intro`&&(0,V.jsx)(`button`,{type:`button`,disabled:!e||_,onClick:()=>void he(!0),className:`min-h-11 rounded-lg px-3 text-sm text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-40`,children:n?`用默认设置开始`:`Use defaults`}),o===`voice`&&(0,V.jsx)(`button`,{type:`button`,onClick:()=>{let e={...f,voice:null};p(e),b(null),me(`connections`,e).catch(e=>b(e instanceof Error?e.message:String(e)))},className:`min-h-11 rounded-lg px-3 text-sm 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:n?`跳过`:`Skip`}),(0,V.jsxs)(`button`,{type:`button`,disabled:_||o===`connections`&&!e,onClick:()=>o===`connections`?void he():void Y(1),className:`flex min-h-11 items-center gap-2 rounded-xl bg-accent px-5 text-sm font-medium text-on-accent transition-colors hover:bg-accent-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 disabled:opacity-40`,children:[_?n?`正在创建…`:`Creating…`:o===`connections`?n?`进入对话`:`Start chatting`:n?`继续`:`Continue`,` `,!_&&(0,V.jsx)(S,{className:`size-4`})]})]})]})}),q&&(0,V.jsx)(w,{draft:q,onChange:J,onClose:()=>J(null),t:s(r).connectorsSettings,onInstalled:async()=>{K(await F()),J(null)}})]})}function de({record:e,zh:t,onSelectVoice:n,onGreetingChange:r}){let[a,s]=(0,B.useState)(!1),[c,l]=(0,B.useState)(!0),[u,d]=(0,B.useState)(``),[f,p]=(0,B.useState)(null),[h,g]=(0,B.useState)([]),[_,v]=(0,B.useState)(e.voicePreference?.voice??``),[y,b]=(0,B.useState)(!1),[x,S]=(0,B.useState)(null),[C,w]=(0,B.useState)(null),T=(0,B.useRef)(null),D=(0,B.useRef)(null);(0,B.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await ce();if(e||(s(t.openingGreeting===!0),!t.enabled||!t.tts))return;let n={provider:t.tts.provider,model:t.tts.model};p(n);let r=await se(n.provider,n.model,`realtime`);e||g(r)}catch(t){e||S(t instanceof Error?t.message:String(t))}finally{e||l(!1)}})(),()=>{e=!0}},[]),(0,B.useEffect)(()=>()=>{D.current?.abort(),T.current?.close()},[]);let O=()=>{D.current?.abort(),D.current=null,T.current?.close(),T.current=null,w(null)},te=async e=>{if(C!==null){O();return}O(),S(null);let n=new AbortController;D.current=n,w(e);try{let t=new E;T.current=t,await t.start();let r=await L(n.signal,e);n.signal.aborted||t.enqueue(r,()=>{D.current===n&&(w(null),D.current=null,T.current=null,t.close())})}catch(e){if(!n.signal.aborted){let n=e?.body?.error?.code;S(t&&n===`unsupported_voice`?`当前音色暂不可用,请刷新语音目录或选择其他音色。`:e instanceof Error?e.message:String(e))}D.current===n&&O()}},ne=async e=>{if(y||e===_)return;O();let t=_;v(e),d(``),b(!0),S(null);try{await n(e&&f?{provider:f.provider,model:f.model,voice:e}:null)||v(t)}catch(e){v(t),S(e instanceof Error?e.message:String(e))}finally{b(!1)}},A=h.find(e=>e.id===_),j=t?`默认声音`:`Default voice`,M=A?.name||(_?t?`当前音色不可用`:`Current voice unavailable`:j),N=u.trim().toLocaleLowerCase(),P=h.filter(e=>!N||`${e.name} ${e.description??``} ${e.style??``}`.toLocaleLowerCase().includes(N)).map(e=>({value:e.id,label:e.name}));return(0,V.jsxs)(`section`,{className:`border-t border-edge pt-5`,children:[(0,V.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:t?`通话声音`:`Call voice`}),c?(0,V.jsx)(`div`,{className:`mt-3`,"aria-busy":`true`,children:(0,V.jsx)(m,{className:`h-10 w-full`})}):f&&h.length?(0,V.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,V.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,V.jsx)(o,{value:_,selectedLabel:M,options:P,placeholder:j,emptyLabel:j,ariaLabel:t?`选择通话音色`:`Choose call voice`,disabled:y,onChange:e=>void ne(e),searchPlaceholder:h.length>8?t?`搜索音色`:`Search voices`:void 0,searchValue:u,onSearchChange:d,statusMessage:N&&!P.length?t?`没有匹配的音色`:`No matching voices`:void 0})}),(0,V.jsxs)(`button`,{type:`button`,disabled:y||!!(_&&!A),onClick:()=>void te(_),className:`touch-target flex h-10 shrink-0 items-center justify-center gap-1.5 rounded-lg border border-edge px-3 text-sm 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`,title:C===null?t?`试听${M}`:`Preview ${M}`:t?`停止试听`:`Stop preview`,"aria-label":C===null?t?`试听${M}`:`Preview ${M}`:t?`停止试听`:`Stop preview`,children:[C===null?(0,V.jsx)(ee,{className:`size-4`,"aria-hidden":!0}):(0,V.jsx)(k,{className:`size-4 text-accent`,"aria-hidden":!0}),C===null?t?`试听`:`Preview`:t?`停止`:`Stop`]})]}),(0,V.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:A?.description||A?.style||(_?t?`选择后自动保存,用于之后的语音通话。`:`Saved automatically for future voice calls.`:t?`跟随语音服务的默认音色。`:`Uses the voice service’s default voice.`)})]}):(0,V.jsxs)(`p`,{className:`mt-3 text-sm text-fg-muted`,children:[t?`当前没有可用音色。`:`No voice is ready.`,` `,(0,V.jsx)(i,{to:`/settings/capabilities/models?configure=speech&returnTo=%2Fpersonal`,className:`text-accent underline`,children:t?`设置语音服务`:`Set up voice`})]}),r&&a&&(0,V.jsxs)(`label`,{className:`mt-4 flex items-center justify-between gap-3 text-sm text-fg`,children:[t?`连接时打招呼`:`Greet me when connected`,(0,V.jsx)(`input`,{type:`checkbox`,checked:e.voiceCallPreferences?.openingGreetingEnabled??!0,disabled:y,onChange:e=>{let t=e.target.checked;b(!0),r(t).catch(e=>S(String(e))).finally(()=>b(!1))}})]}),x&&(0,V.jsx)(`p`,{role:`alert`,className:`mt-3 text-xs text-danger`,children:x})]})}var G=new p;function fe({conversationId:e,zh:t,onSaved:n}){let r=d(t=>t.sessions[e]),[i,a]=(0,B.useState)(!0),[o,c]=(0,B.useState)(``);(0,B.useEffect)(()=>{let t=!0;return G.loadSessionAgentConfig(e).then(n=>{t&&f(e,n)}).catch(e=>{t&&c(String(e))}).finally(()=>{t&&a(!1)}),()=>{t=!1}},[e]);let l=!!r?.modelConfigSaving;async function u(t,i){d.getState().patchSessionMeta(e,{modelConfigSaving:!0});try{f(e,await G.patchSessionAgentConfig(e,{model:t,thinkingLevel:i,configVersion:r?.configVersion})),await n()}catch(t){let n=await G.loadSessionAgentConfig(e).catch(()=>null);throw n&&f(e,n),t}finally{d.getState().patchSessionMeta(e,{modelConfigSaving:!1})}}return(0,V.jsxs)(`section`,{children:[(0,V.jsx)(`h3`,{className:`mb-3 text-sm font-medium text-fg`,children:t?`对话模型与思考强度`:`Conversation model and thinking`}),i?(0,V.jsx)(m,{className:`h-9 w-full`}):(0,V.jsx)(re,{chat:s(t?`zh`:`en`).chat,sessionModel:r?.model??``,thinkingLevel:r?.thinkingLevel??`off`,modelDisabled:l,thinkingDisabled:l,onModelChange:u,onThinkingChange:e=>u(r?.model??``,e)}),o&&(0,V.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm text-danger`,children:o})]})}var pe=5;function K(e){let t=e.replace(/\s+/g,` `).trim();if(t.length<=58)return t;let n=t.replace(/([^)]{1,80})|\([^)]{1,80}\)/g,``).replace(/([A-Za-z0-9])(?=[\u4e00-\u9fff])/g,`$1 `).replace(/\s+/g,` `).trim(),r=n.split(/[。!?;;,]/,1)[0]?.trim()||n;return r.length>58?`${r.slice(0,57).trimEnd()}…`:r}function q(e,t){if(e.phase===`closed`)return{label:t?`已结束`:`Finished`,tone:`bg-fg-subtle`};let n=e.operationalState??e.runStatus;return n===`running`?{label:t?`正在执行`:`Working`,tone:`bg-accent`}:n===`queued`?{label:t?`等待开始`:`Queued`,tone:`bg-fg-subtle`}:n===`failed`?{label:t?`执行失败`:`Failed`,tone:`bg-danger`}:n===`waiting`?{label:t?`等待继续`:`Waiting`,tone:`bg-warning`}:n===`blocked`?{label:t?`已阻塞`:`Blocked`,tone:`bg-warning`}:n===`verifying`?{label:t?`正在验证`:`Verifying`,tone:`bg-accent`}:n===`cancelled`?{label:t?`执行已取消`:`Cancelled`,tone:`bg-fg-subtle`}:e.phase===`review`?{label:t?`等待验收`:`In review`,tone:`bg-warning`}:e.phase===`active`?{label:t?`正在推进`:`In progress`,tone:`bg-accent`}:e.phase===`ready`?{label:t?`准备开始`:`Ready`,tone:`bg-fg-subtle`}:{label:t?`待处理`:`Planned`,tone:`bg-fg-subtle`}}function J(e){let t=(0,z.c)(30),{item:n,zh:r}=e,a;t[0]!==n||t[1]!==r?(a=q(n,r),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o=a,s;t[3]===n.id?s=t[4]:(s=C(`/personal`,n.id),t[3]=n.id,t[4]=s);let c=`mt-2 size-1.5 shrink-0 rounded-full ${o.tone}`,l;t[5]===c?l=t[6]:(l=(0,V.jsx)(`span`,{className:c,"aria-hidden":!0}),t[5]=c,t[6]=l);let u;t[7]===n.title?u=t[8]:(u=K(n.title),t[7]=n.title,t[8]=u);let d;t[9]===u?d=t[10]:(d=(0,V.jsx)(`span`,{className:`line-clamp-2 break-words text-sm font-medium leading-5 text-fg`,children:u}),t[9]=u,t[10]=d);let f;t[11]===o.label?f=t[12]:(f=(0,V.jsx)(`span`,{children:o.label}),t[11]=o.label,t[12]=f);let p;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,V.jsx)(`span`,{className:`text-fg-subtle`,"aria-hidden":!0,children:`·`}),t[13]=p):p=t[13];let m=r?`zh`:`en`,h;t[14]!==n.updatedAt||t[15]!==m?(h=R(n.updatedAt,m),t[14]=n.updatedAt,t[15]=m,t[16]=h):h=t[16];let g;t[17]===h?g=t[18]:(g=(0,V.jsx)(`span`,{children:h}),t[17]=h,t[18]=g);let _;t[19]!==g||t[20]!==f?(_=(0,V.jsxs)(`span`,{className:`mt-1.5 flex items-center gap-2 text-xs text-fg-muted`,children:[f,p,g]}),t[19]=g,t[20]=f,t[21]=_):_=t[21];let v;t[22]!==_||t[23]!==d?(v=(0,V.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[d,_]}),t[22]=_,t[23]=d,t[24]=v):v=t[24];let y;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,V.jsx)(ie,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle opacity-0 transition-opacity duration-150 group-hover:opacity-100 group-focus-visible:opacity-100`,"aria-hidden":!0}),t[25]=y):y=t[25];let b;return t[26]!==v||t[27]!==s||t[28]!==l?(b=(0,V.jsxs)(i,{to:s,className:`group flex min-w-0 items-start gap-3 rounded-2xl bg-surface-panel px-4 py-4 transition-colors duration-150 hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[l,v,y]}),t[26]=v,t[27]=s,t[28]=l,t[29]=b):b=t[29],b}var me=[{id:`loopi`,zh:`Loopi`,en:`Loopi`,color:`bg-slate-100/50 dark:bg-slate-400/10`},{id:`loopi-curious`,zh:`好奇`,en:`Curious`,color:`bg-blue-100/50 dark:bg-blue-400/10`},{id:`loopi-care`,zh:`温和`,en:`Gentle`,color:`bg-violet-100/50 dark:bg-violet-400/10`}];function Y(){let e=oe(),t=(0,B.useRef)(e);t.current=e;let n=l(e=>e.language)===`zh`,r=A(e=>e.setPageHeader),i=A(e=>e.clearPageHeader),[a,o]=(0,B.useState)(null),s=(0,B.useRef)(null),d=(0,B.useRef)(Promise.resolve()),[f,p]=(0,B.useState)([]),[S,ee]=(0,B.useState)(!0),[C,w]=(0,B.useState)(0),[T,E]=(0,B.useState)(null),[O,te]=(0,B.useState)(!1),[k,M]=(0,B.useState)(`loopi`),[F,re]=(0,B.useState)(!1),ie=(0,B.useRef)(null),L=(0,B.useRef)(null),se=(0,B.useRef)(null),[ce,R]=(0,B.useState)(``),[z,H]=(0,B.useState)(!1),[le,U]=(0,B.useState)(!1),[W,G]=(0,B.useState)(!1),[K,q]=(0,B.useState)(null),[Y,he]=(0,B.useState)(!1),[X,Z]=(0,B.useState)(!1),[ge,_e]=(0,B.useState)(!1),[Q,ve]=(0,B.useState)(0),$=(0,B.useRef)(0),ye=(0,B.useCallback)(()=>{G(!1),U(!1),H(!0)},[]),be=(0,B.useCallback)(()=>{G(!1),U(!1),H(e=>!e)},[]),xe=(0,B.useCallback)(async()=>{try{let[e,t]=await Promise.all([u(c(`/api/personal-agent`)),u(c(`/api/personal-agent/models`))]);s.current=e.payload,o(e.payload),window.dispatchEvent(new CustomEvent(`personal-agent-updated`,{detail:e.payload})),e.payload&&window.dispatchEvent(new Event(`session-updated`)),p(t.payload),e.payload&&(R(e.payload.displayName),M(e.payload.appearance))}catch(e){E(e instanceof Error?e.message:String(e))}finally{ee(!1)}},[]);(0,B.useEffect)(()=>{xe()},[xe]);let Se=(0,B.useCallback)(e=>{w(e=>e+1),E(null);let t=d.current.then(async()=>{let t=s.current;if(!t)return!1;let n=e.displayName?.trim()||t.displayName,r=e.appearance??t.appearance,i=e.voicePreference===void 0?t.voicePreference:e.voicePreference;if(n===t.displayName&&r===t.appearance&&JSON.stringify(i)===JSON.stringify(t.voicePreference)&&(!e.voiceCallPreferences||JSON.stringify(e.voiceCallPreferences)===JSON.stringify(t.voiceCallPreferences)))return!0;try{let a=await u(c(`/api/personal-agent/profile`),{method:`PATCH`,body:JSON.stringify({revision:t.revision,displayName:n,appearance:r,...e.voicePreference===void 0?{}:{voicePreference:i},...e.voiceCallPreferences?{voiceCallPreferences:e.voiceCallPreferences}:{}})});return s.current=a.payload,o(a.payload),window.dispatchEvent(new CustomEvent(`personal-agent-updated`,{detail:a.payload})),!0}catch(e){return E(e instanceof Error?e.message:String(e)),!1}}).finally(()=>w(e=>e-1));return d.current=t,t},[]),Ce=(0,B.useCallback)(async()=>{let e=++$.current;G(!0),q(null),he(!1),Z(!1),_e(!1),ve(0);try{let t=await u(c(`/api/personal-agent/activity?limit=${pe}&offset=0`));if(e!==$.current)return;q(t.payload),ve(t.payload.items.length)}catch{e===$.current&&he(!0)}},[]),we=(0,B.useCallback)(async()=>{if(!K||X||Q>=K.total)return;let e=$.current;Z(!0),_e(!1);try{let t=await u(c(`/api/personal-agent/activity?limit=${pe}&offset=${Q}`));if(e!==$.current)return;q(e=>e?{total:t.payload.total,items:[...e.items,...t.payload.items.filter(t=>!e.items.some(e=>e.id===t.id))]}:t.payload),ve(e=>e+t.payload.items.length)}catch{e===$.current&&_e(!0)}finally{e===$.current&&Z(!1)}},[K,Q,X]);(0,B.useEffect)(()=>{if(!W||!K||X)return;let e,t=()=>{window.clearTimeout(e),e=window.setTimeout(async()=>{let e=$.current;try{let t=await u(c(`/api/personal-agent/activity?limit=${Math.max(pe,Math.min(100,Q))}&offset=0`));if(e!==$.current)return;q(t.payload),ve(t.payload.items.length)}catch{}},120)},n=window.setInterval(t,5e3);return window.addEventListener(`task-changed-v2`,t),window.addEventListener(`gateway-realtime-connected`,t),()=>{window.clearTimeout(e),window.clearInterval(n),window.removeEventListener(`task-changed-v2`,t),window.removeEventListener(`gateway-realtime-connected`,t)}},[K,Q,X,W]);let Te=async e=>{if(!a||![`image/png`,`image/jpeg`,`image/webp`].includes(e.type)){E(n?`请选择 PNG、JPEG 或 WebP 图片。`:`Choose a PNG, JPEG, or WebP image.`);return}if(e.size===0||e.size>512*1024){E(n?`图片大小不能超过 512 KB。`:`Image must be 512 KB or smaller.`);return}re(!0),E(null);try{let t=await new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result)),r.onerror=()=>n(r.error),r.readAsDataURL(e)});await u(c(`/api/agents/${encodeURIComponent(a.agentId)}/avatar`),{method:`PUT`,body:JSON.stringify({base64:t.slice(t.indexOf(`,`)+1),mimeType:e.type})}),j(a.agentId),M(`custom`),U(!1),await Se({appearance:`custom`})}catch(e){E(e instanceof Error?e.message:String(e))}finally{re(!1)}};(0,B.useLayoutEffect)(()=>{let o=a?.state===`ready`,s=o?a.appearance:k,c=o?a.displayName:`Ada`;return r({startExtra:null,main:(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[o?(0,V.jsx)(`button`,{ref:se,type:`button`,onClick:be,"aria-expanded":z,className:`touch-target -m-1 shrink-0 rounded-full p-1 transition-opacity hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":n?`编辑${c}的资料`:`Edit ${c}'s profile`,title:n?`资料`:`Profile`,children:(0,V.jsx)(`span`,{className:`flex size-8 items-center justify-center`,children:(0,V.jsx)(I,{appearance:s,agentId:a?.agentId,className:`size-8`})})}):(0,V.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center`,children:(0,V.jsx)(I,{appearance:s,agentId:a?.agentId,className:`size-8`})}),(0,V.jsx)(`h1`,{className:`min-w-0 truncate text-sm font-semibold text-fg sm:text-base`,children:c})]}),end:o?(0,V.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,V.jsx)(`button`,{type:`button`,disabled:e.active,onClick:()=>{a?.state===`ready`&&t.current.open({conversationId:a.conversationId,name:a.displayName,mode:`assistant`})},className:`touch-target rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg disabled:opacity-50`,"aria-label":n?`语音通话`:`Voice call`,title:n?`语音通话`:`Voice call`,children:(0,V.jsx)(D,{className:`size-5`})}),(0,V.jsxs)(_,{open:W,onOpenChange:e=>{e?Ce():G(!1)},children:[(0,V.jsx)(y,{asChild:!0,children:(0,V.jsx)(`button`,{type:`button`,"aria-pressed":W,className:`touch-target rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":n?`正在做的事`:`Activity`,children:(0,V.jsx)(x,{className:`size-5`})})}),(0,V.jsx)(h,{children:(0,V.jsxs)(g,{side:`bottom`,align:`end`,sideOffset:8,collisionPadding:8,"aria-label":n?`派发的任务`:`Delegated tasks`,className:`z-50 flex h-[min(34rem,calc(100dvh-6rem))] w-[min(22rem,calc(100vw-1rem))] min-h-0 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-xl focus:outline-none`,children:[(0,V.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 px-6 pb-3 pt-6`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`h2`,{className:`text-base font-semibold tracking-tight text-fg`,children:n?`交给我推进的事`:`Delegated work`}),(0,V.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:K?n?`最近更新 · 共 ${K.total} 项`:`Recently updated · ${K.total} total`:n?`查看任务进展与结果`:`Follow progress and results`})]}),(0,V.jsx)(v,{className:`touch-target -mr-2 -mt-1 rounded-lg p-2 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":n?`关闭活动`:`Close activity`,children:(0,V.jsx)(ne,{className:`size-4`})})]}),(0,V.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-3 pb-5 pt-3`,children:[!K&&!Y&&(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(m,{className:`h-18 rounded-2xl`}),(0,V.jsx)(m,{className:`h-18 rounded-2xl`}),(0,V.jsx)(m,{className:`h-18 rounded-2xl`})]}),Y&&(0,V.jsxs)(`div`,{className:`px-5 py-12 text-center`,children:[(0,V.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n?`暂时无法读取任务`:`Could not load tasks`}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>void Ce(),className:`mt-3 rounded-lg px-3 py-2 text-sm text-accent hover:bg-surface-hover`,children:n?`重试`:`Try again`})]}),K?.items.length===0&&(0,V.jsxs)(`div`,{className:`px-5 py-16 text-center`,children:[(0,V.jsx)(x,{className:`mx-auto size-7 text-fg-subtle`,"aria-hidden":!0}),(0,V.jsx)(`p`,{className:`mt-4 text-sm font-medium text-fg`,children:n?`还没有派发的任务`:`No delegated work yet`}),(0,V.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n?`你可以在对话里直接告诉我想推进的事。`:`Tell me what you would like to move forward in chat.`})]}),K&&K.items.length>0&&(0,V.jsx)(`div`,{className:`space-y-2`,children:K.items.map(e=>(0,V.jsx)(J,{item:e,zh:n},e.id))}),K&&Q<K.total&&(0,V.jsxs)(`div`,{className:`pt-4 text-center`,children:[(0,V.jsx)(`button`,{type:`button`,onClick:()=>void we(),disabled:X,className:`min-h-10 rounded-xl bg-surface-panel px-5 text-sm font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:opacity-50`,children:X?n?`正在加载…`:`Loading…`:n?`加载更多`:`Load more`}),ge&&(0,V.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:n?`加载失败,请重试`:`Could not load more. Try again.`})]})]})]})})]}),(0,V.jsx)(`button`,{ref:L,type:`button`,onClick:be,"aria-expanded":z,className:`touch-target rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":n?`编辑资料`:`Edit profile`,children:(0,V.jsx)(N,{className:`size-5`})})]}):null}),()=>i()},[K,Y,Q,X,ge,k,i,we,Ce,a,r,W,z,be,e.active,n]);function Ee(){return a?(0,V.jsxs)(_,{open:z,onOpenChange:e=>{H(e),e||U(!1)},children:[(0,V.jsx)(b,{virtualRef:L}),(0,V.jsx)(h,{children:(0,V.jsxs)(g,{side:`bottom`,align:`end`,sideOffset:8,collisionPadding:8,"aria-label":n?`编辑 Personal AI`:`Edit Personal AI`,onInteractOutside:e=>{e.target instanceof Node&&(L.current?.contains(e.target)||se.current?.contains(e.target))&&e.preventDefault()},className:`z-50 flex w-[min(22rem,calc(100vw-1rem))] flex-col rounded-2xl border border-edge bg-surface-overlay shadow-xl outline-none`,children:[(0,V.jsxs)(`div`,{className:`relative flex shrink-0 flex-col items-center px-4 pt-4 text-center`,children:[(0,V.jsx)(`button`,{type:`button`,disabled:F,onClick:()=>U(e=>!e),"aria-expanded":le,"aria-controls":`personal-appearance-options`,"aria-label":n?`选择头像`:`Choose avatar`,className:`rounded-full transition-opacity hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:(0,V.jsx)(I,{appearance:k,agentId:a.agentId,className:`size-16`})}),(0,V.jsx)(`input`,{id:`personal-name`,"aria-label":n?`助手名称`:`Assistant name`,value:ce,onChange:e=>R(e.target.value),onBlur:e=>{let t=e.currentTarget.value.trim();t?(R(t),Se({displayName:t})):R(s.current?.displayName??``)},onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&(e.currentTarget.value=s.current?.displayName??``,R(e.currentTarget.value),e.currentTarget.blur())},maxLength:60,placeholder:`Ada`,className:`mt-2 w-full min-w-0 rounded-lg border border-transparent bg-transparent px-2 py-1 text-center text-lg font-semibold text-fg outline-none transition-colors hover:border-edge focus:border-edge focus:bg-surface-base focus-visible:ring-2 focus-visible:ring-accent`}),C>0&&(0,V.jsx)(`span`,{className:`absolute right-4 top-4 text-xs text-fg-muted`,children:n?`正在保存…`:`Saving…`})]}),(0,V.jsxs)(`div`,{className:`space-y-4 px-4 py-4`,children:[T&&(0,V.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:T}),le&&(0,V.jsxs)(`section`,{id:`personal-appearance-options`,children:[(0,V.jsx)(`h3`,{className:`mb-3 text-sm font-medium text-fg`,children:n?`形象`:`Appearance`}),(0,V.jsxs)(`div`,{className:`grid grid-cols-4 gap-2`,children:[me.map(e=>(0,V.jsxs)(`button`,{type:`button`,onClick:()=>{M(e.id),U(!1),Se({appearance:e.id})},"aria-pressed":k===e.id,className:`flex min-w-0 flex-col items-center gap-1.5 rounded-xl px-1 py-2 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${k===e.id?`bg-accent/10 ring-1 ring-accent/40`:`bg-surface-panel hover:bg-surface-hover`}`,children:[(0,V.jsx)(`span`,{className:`flex size-8 items-center justify-center rounded-full ${e.color}`,children:(0,V.jsx)(I,{appearance:e.id,className:`size-8`})}),(0,V.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:n?e.zh:e.en})]},e.id)),(0,V.jsx)(`input`,{ref:ie,type:`file`,accept:`image/png,image/jpeg,image/webp`,className:`sr-only`,"aria-label":n?`上传头像`:`Upload avatar`,onChange:e=>{let t=e.currentTarget.files?.[0];t&&Te(t),e.currentTarget.value=``}}),(0,V.jsxs)(`button`,{type:`button`,disabled:F,onClick:()=>ie.current?.click(),"aria-pressed":k===`custom`,className:`flex min-w-0 flex-col items-center gap-1.5 rounded-xl px-1 py-2 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50 ${k===`custom`?`bg-accent/10 ring-1 ring-accent/40`:`bg-surface-panel hover:bg-surface-hover`}`,children:[(0,V.jsx)(`span`,{className:`flex size-8 items-center justify-center rounded-full bg-surface-panel`,children:k===`custom`?(0,V.jsx)(I,{appearance:`custom`,agentId:a.agentId,className:`size-8`}):(0,V.jsx)(ae,{className:`size-4 text-fg-muted`,"aria-hidden":!0})}),(0,V.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:F?n?`上传中…`:`Uploading…`:n?`上传`:`Upload`})]})]})]}),(0,V.jsx)(de,{onGreetingChange:e=>Se({voiceCallPreferences:{openingGreetingEnabled:e}}),record:a,zh:n,onSelectVoice:e=>Se({voicePreference:e})}),(0,V.jsx)(`div`,{className:`border-t border-edge pt-4`,children:(0,V.jsx)(fe,{conversationId:a.conversationId,zh:n,onSaved:async()=>{let e=await u(c(`/api/personal-agent`));e.ok&&e.payload&&(s.current=e.payload,o(e.payload))}})})]})]})})]}):null}return S?(0,V.jsxs)(`div`,{className:`mx-auto w-full max-w-2xl space-y-5 px-6 py-12`,children:[(0,V.jsx)(m,{className:`h-20 w-20 rounded-full`}),(0,V.jsx)(m,{className:`h-9 w-72`}),(0,V.jsx)(m,{className:`h-44 w-full rounded-2xl`})]}):a?.state===`ready`?(0,V.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col bg-surface-panel`,children:[O&&(0,V.jsxs)(`div`,{role:`alert`,className:`flex shrink-0 items-center justify-between gap-3 border-b border-warning/30 bg-warning/5 px-5 py-3 text-sm text-fg-muted`,children:[(0,V.jsx)(`span`,{children:n?`助手已创建,头像上传未完成。可在资料设置中重新上传。`:`Your assistant is ready. Upload the avatar again in profile settings.`}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>{te(!1),ye()},className:`shrink-0 text-accent hover:underline`,children:n?`打开设置`:`Open settings`})]}),(0,V.jsx)(`div`,{className:`flex min-h-0 flex-1`,children:(0,V.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,V.jsx)(P,{embedded:!0,personal:!0,personalWelcome:{name:a.displayName,addressAs:a.userCallName??void 0,avatar:(0,V.jsx)(I,{appearance:a.appearance,agentId:a.agentId,className:`size-14`}),opening:n?`有什么想讨论或推进的事?直接告诉我就好。`:`What would you like to discuss or move forward? Just tell me what is on your mind.`},conversationId:a.conversationId})})}),Ee()]}):(0,V.jsx)(ue,{modelsAvailable:f.length>0,onCreated:(e,t)=>{s.current=e,o(e),R(e.displayName),te(t),window.dispatchEvent(new CustomEvent(`personal-agent-updated`,{detail:e})),window.dispatchEvent(new Event(`session-updated`))}})}export{Y as PersonalPage};
@@ -0,0 +1 @@
1
+ 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"./popover-select-DGKUpVsz.js";import{i as a,n as o,o as s}from"./locale-store-B7s2Hb35.js";import{t as c}from"./personal-proactivity-BJcZ3Yhi.js";import{t as l}from"./skeleton-BI5TyibZ.js";import{to as u}from"./index-DRyGCING.js";import{n as d,t as f}from"./settings-page-header-BWyxJKOG.js";import"./settings-page-layout-DLHcS-0T.js";var p=n(),m=e(t(),1),h=r();function g(){try{return[`UTC`,...Intl.supportedValuesOf(`timeZone`)]}catch{return[`UTC`,`Asia/Shanghai`,`Asia/Hong_Kong`,`Asia/Taipei`,`Asia/Tokyo`,`Asia/Seoul`,`Asia/Singapore`,`Asia/Kolkata`,`Asia/Dubai`,`Europe/London`,`Europe/Paris`,`Europe/Berlin`,`America/New_York`,`America/Chicago`,`America/Denver`,`America/Los_Angeles`,`Australia/Sydney`,`Pacific/Auckland`]}}var _=g();function v({zh:e}){let[t,n]=(0,m.useState)(),[r,o]=(0,m.useState)(``),[u,d]=(0,m.useState)(!1),[f,p]=(0,m.useState)(``),g=f.trim().toLowerCase().replaceAll(`_`,` `),v=[...new Set([..._,t?.timezone].filter(e=>!!e))].sort().filter(e=>e.replaceAll(`_`,` `).toLowerCase().includes(g)).map(e=>({value:e,label:e.replaceAll(`_`,` `),group:e.split(`/`)[0]}));(0,m.useEffect)(()=>{let e=!0;return s(a(`/api/personal-agent/proactivity`)).then(t=>{e&&t.ok&&n(c.parse(t.payload))}).catch(t=>{e&&o(String(t))}),()=>{e=!1}},[]);async function y(e){if(!(!t||u)){d(!0),o(``);try{let r=await s(a(`/api/personal-agent/proactivity`),{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...t,...e})});r.ok&&n(c.parse(r.payload))}catch(e){o(String(e));let t=await s(a(`/api/personal-agent/proactivity`)).catch(()=>null);t?.ok&&n(c.parse(t.payload))}finally{d(!1)}}}return(0,h.jsxs)(`section`,{className:`space-y-3 border-t border-edge pt-5`,children:[(0,h.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:e?`主动联系`:`Proactive messages`}),!t&&!r?(0,h.jsx)(l,{className:`h-9 w-full`}):t&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(i,{placeholder:e?`选择主动方式`:`Choose participation`,value:t.mode,disabled:u,allowEmpty:!1,options:[{value:`off`,label:e?`关闭主动联系`:`Off`},{value:`follow_up`,label:e?`仅明确跟进`:`Requested follow-ups`},{value:`balanced`,label:e?`适度主动`:`Thoughtful participation`}],onChange:e=>void y({mode:e})}),(0,h.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,h.jsxs)(`label`,{className:`text-xs text-fg-muted`,children:[e?`免打扰开始`:`Quiet from`,(0,h.jsx)(i,{placeholder:e?`选择时间`:`Choose time`,value:String(t.quietStart),disabled:u,allowEmpty:!1,options:Array.from({length:24},(e,t)=>({value:String(t),label:`${String(t).padStart(2,`0`)}:00`})),onChange:e=>void y({quietStart:Number(e)})})]}),(0,h.jsxs)(`label`,{className:`text-xs text-fg-muted`,children:[e?`免打扰结束`:`Quiet until`,(0,h.jsx)(i,{placeholder:e?`选择时间`:`Choose time`,value:String(t.quietEnd),disabled:u,allowEmpty:!1,options:Array.from({length:24},(e,t)=>({value:String(t),label:`${String(t).padStart(2,`0`)}:00`})),onChange:e=>void y({quietEnd:Number(e)})})]})]}),(0,h.jsxs)(`label`,{className:`block text-xs text-fg-muted`,children:[e?`时区`:`Timezone`,(0,h.jsx)(i,{placeholder:e?`选择时区`:`Choose timezone`,ariaLabel:e?`时区`:`Timezone`,value:t.timezone,selectedLabel:t.timezone.replaceAll(`_`,` `),options:v,disabled:u,allowEmpty:!1,triggerClassName:`mt-1`,searchPlaceholder:e?`搜索时区或城市`:`Search timezone or city`,searchValue:f,onSearchChange:p,statusMessage:v.length?void 0:e?`没有匹配的时区`:`No matching timezones`,onChange:e=>{p(``),e!==t.timezone&&y({timezone:e})}})]}),(0,h.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e?`有值得交流的进展时,在聊天里留下消息。明确请求的结果会照常交付。`:`Useful developments appear in this chat. Requested results are delivered as usual.`})]}),r&&(0,h.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:r})]})}function y(){let e=(0,p.c)(8),{displayName:t}=u(),n=o(b)===`zh`,r=n?`设置 ${t} 主动联系你的方式和免打扰时段。`:`Manage proactive messages from ${t} and quiet hours.`,i;e[0]!==t||e[1]!==r?(i=(0,h.jsx)(f,{title:t,subtitle:r}),e[0]=t,e[1]=r,e[2]=i):i=e[2];let a;e[3]===n?a=e[4]:(a=(0,h.jsx)(v,{zh:n}),e[3]=n,e[4]=a);let s;return e[5]!==i||e[6]!==a?(s=(0,h.jsxs)(d,{children:[i,a]}),e[5]=i,e[6]=a,e[7]=s):s=e[7],s}function b(e){return e.language}export{y as PersonalSettingsPanel};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{n,r}from"./popover-select-DGKUpVsz.js";import{a as i,i as a,o}from"./locale-store-B7s2Hb35.js";import{i as s}from"./vendor-swr-BIWyz7Rc.js";import{t as c}from"./skeleton-BI5TyibZ.js";var l=e(),u=`phone-mock/settings-about`;async function d(e,t,n=t===void 0?`GET`:`POST`){let r=await o(a(`/api/phone${e}`),{method:n,...t===void 0?{}:{headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}});if(!r.ok)throw Error(r.error?.message??`Phone operation failed`);return r.payload}var f=()=>d(`/settings`),p=()=>d(`/devices`),m=()=>d(`/models`);async function h(e,t){let n=await i(a(`/api/phone/devices/${encodeURIComponent(e)}/screen`),{signal:t});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error?.message??`HTTP ${n.status}`)}return n.blob()}async function g(e,t){return(await d(e?`/devices/${encodeURIComponent(e)}/apps`:`/apps?serial=${encodeURIComponent(t)}`)).applications}var _=t();function v(e){let t=(0,l.c)(25),{value:i,onChange:a,zh:o,disabled:u}=e,d=u===void 0?!1:u,f=s(`phone-models`,m);if(!f.data&&!f.error){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,_.jsx)(c,{className:`h-11 w-full rounded-lg`}),t[0]=e):e=t[0],e}let p=o?`手机模型`:`Phone model`,h=d||!!f.error,g;t[1]===a?g=t[2]:(g=e=>a(e.target.value),t[1]=a,t[2]=g);let v=o?`未配置`:`Not configured`,y;t[3]===v?y=t[4]:(y=(0,_.jsx)(r,{value:``,children:v}),t[3]=v,t[4]=y);let b;t[5]!==f.data?.models||t[6]!==i||t[7]!==o?(b=i&&!f.data?.models.some(e=>e.id===i)&&(0,_.jsx)(r,{value:i,disabled:!0,children:o?`当前模型不可用,请重新选择`:`Current model unavailable; choose another`}),t[5]=f.data?.models,t[6]=i,t[7]=o,t[8]=b):b=t[8];let x;t[9]!==f.data?.models||t[10]!==o?(x=f.data?.models.map(e=>(0,_.jsx)(r,{value:e.id,children:`${e.name} · ${e.id.split(`/`)[0]}${e.configured?``:o?` · 待配置凭据`:` · Credentials needed`}`},e.id)),t[9]=f.data?.models,t[10]=o,t[11]=x):x=t[11];let S;t[12]!==p||t[13]!==h||t[14]!==g||t[15]!==y||t[16]!==b||t[17]!==x||t[18]!==i?(S=(0,_.jsxs)(n,{"aria-label":p,value:i,disabled:h,onChange:g,children:[y,b,x]}),t[12]=p,t[13]=h,t[14]=g,t[15]=y,t[16]=b,t[17]=x,t[18]=i,t[19]=S):S=t[19];let C;t[20]===f.error?C=t[21]:(C=f.error&&(0,_.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:String(f.error)}),t[20]=f.error,t[21]=C);let w;return t[22]!==C||t[23]!==S?(w=(0,_.jsxs)(`div`,{className:`space-y-2`,children:[S,C]}),t[22]=C,t[23]=S,t[24]=w):w=t[24],w}function y(e){let t=(0,l.c)(24),{value:n,inherited:r,onChange:i,zh:a}=e,o=a?`手机操作模型`:`Phone Use model`,s;t[0]===o?s=t[1]:(s=(0,_.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:o}),t[0]=o,t[1]=s);let c=n?n.primary:`${a?`继承全局`:`Inherited`}: ${r?.primary??`—`}`,u;t[2]===c?u=t[3]:(u=(0,_.jsx)(`p`,{className:`mt-1 break-all text-xs text-fg-muted`,children:c}),t[2]=c,t[3]=u);let d;t[4]!==s||t[5]!==u?(d=(0,_.jsxs)(`div`,{children:[s,u]}),t[4]=s,t[5]=u,t[6]=d):d=t[6];let f;t[7]!==r?.primary||t[8]!==i||t[9]!==n?(f=()=>i(n?void 0:{primary:r?.primary??``,fallbacks:[]}),t[7]=r?.primary,t[8]=i,t[9]=n,t[10]=f):f=t[10];let p=n?a?`继承全局`:`Inherit globally`:a?`单独设置`:`Override`,m;t[11]!==f||t[12]!==p?(m=(0,_.jsx)(`button`,{type:`button`,className:`touch-target rounded-lg px-3 py-2 text-sm text-accent-fg hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:f,children:p}),t[11]=f,t[12]=p,t[13]=m):m=t[13];let h;t[14]!==d||t[15]!==m?(h=(0,_.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[d,m]}),t[14]=d,t[15]=m,t[16]=h):h=t[16];let g;t[17]!==i||t[18]!==n||t[19]!==a?(g=n&&(0,_.jsx)(v,{value:n.primary,onChange:e=>i({primary:e,fallbacks:[]}),zh:a}),t[17]=i,t[18]=n,t[19]=a,t[20]=g):g=t[20];let y;return t[21]!==g||t[22]!==h?(y=(0,_.jsxs)(`section`,{className:`space-y-3 rounded-2xl border border-edge bg-surface-base p-4`,children:[h,g]}),t[21]=g,t[22]=h,t[23]=y):y=t[23],y}export{p as a,f as c,g as i,d as l,v as n,m as o,u as r,h as s,y as t};