@xopcai/xopc 0.0.329 → 0.0.330

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 (257) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-Bs1qnnhD.js → agent-avatar-dicebear-BDG0hI-J.js} +1 -1
  4. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-ArM6Sm9S.js +1 -0
  5. package/dist/gateway/static/root/assets/agent-plugin-dialog-BX_Bhre1.js +1 -0
  6. package/dist/gateway/static/root/assets/agents-BiQqpMw0.js +70 -0
  7. package/dist/gateway/static/root/assets/{app-management-settings-panel-BrIji9B5.js → app-management-settings-panel-DgttzUCG.js} +1 -1
  8. package/dist/gateway/static/root/assets/{appearance-settings-Uts-MQ7K.js → appearance-settings-CHpyWV8Z.js} +1 -1
  9. package/dist/gateway/static/root/assets/apps-page-BhfYQcm8.js +1 -0
  10. package/dist/gateway/static/root/assets/{archive-plugin-_EzRfBuI.js → archive-plugin-B7Q7Oeo7.js} +1 -1
  11. package/dist/gateway/static/root/assets/{attachment-load-CHg7_XFl.js → attachment-load-BYwqQ8qN.js} +1 -1
  12. package/dist/gateway/static/root/assets/{automations-page-CGMErk_w.js → automations-page-CsvAtTNd.js} +1 -1
  13. package/dist/gateway/static/root/assets/automations-workspace-DMH_1Ped.js +7 -0
  14. package/dist/gateway/static/root/assets/{binary-plugins-D3WB-tVn.js → binary-plugins-DdgWCI-M.js} +1 -1
  15. package/dist/gateway/static/root/assets/{block-editor-Cm1W-14I.js → block-editor-DyOagNnn.js} +53 -53
  16. package/dist/gateway/static/root/assets/{browser-automation-inputs-VnvK-GQP.js → browser-automation-inputs-CwF8OQFN.js} +1 -1
  17. package/dist/gateway/static/root/assets/browser-automations-page-D_EQjiiu.js +3 -0
  18. package/dist/gateway/static/root/assets/browser-settings-page-BE6691Jz.js +3 -0
  19. package/dist/gateway/static/root/assets/capabilities-page-MweWNrC1.js +2 -0
  20. package/dist/gateway/static/root/assets/capabilities-settings-panel-CdSWkh89.js +8 -0
  21. package/dist/gateway/static/root/assets/{capability-header-actions-C3chJDQu.js → capability-header-actions-C5F2GNE9.js} +1 -1
  22. package/dist/gateway/static/root/assets/channels-NGfwR3He.js +1 -0
  23. package/dist/gateway/static/root/assets/{chat-terminal-dock-ClbmjCL2.js → chat-terminal-dock-C6tl9Rfw.js} +2 -2
  24. package/dist/gateway/static/root/assets/{computer-settings-page-BfZaf516.js → computer-settings-page-C0MsVw4l.js} +1 -1
  25. package/dist/gateway/static/root/assets/{connector-service-page-F-fYNIx8.js → connector-service-page-DsF60pPs.js} +1 -1
  26. package/dist/gateway/static/root/assets/connectors-page-BE8NdQcR.js +2 -0
  27. package/dist/gateway/static/root/assets/date-picker-CELKKqYN.js +1 -0
  28. package/dist/gateway/static/root/assets/{dependency-picker-B_z3zihW.js → dependency-picker-BcEwCnI5.js} +1 -1
  29. package/dist/gateway/static/root/assets/{desktop-pet-C1TZzKS3.js → desktop-pet-Ww7Gm8-x.js} +1 -1
  30. package/dist/gateway/static/root/assets/desktop-pet-settings-D-dbAxGu.js +1 -0
  31. package/dist/gateway/static/root/assets/device-pairing-wizard-DsYY6szg.js +1 -0
  32. package/dist/gateway/static/root/assets/{directory-picker-path-field-BfxaNwMB.js → directory-picker-path-field-CVmuCRyO.js} +1 -1
  33. package/dist/gateway/static/root/assets/{extension-debug-page-Bs8_FYCm.js → extension-debug-page-UUHNJj-d.js} +1 -1
  34. package/dist/gateway/static/root/assets/{extension-page-DH5vFbBw.js → extension-page-BvL452mX.js} +1 -1
  35. package/dist/gateway/static/root/assets/{extension-settings-page-hGKovxxC.js → extension-settings-page-CrNnUSOs.js} +1 -1
  36. package/dist/gateway/static/root/assets/{gateway-config-swr-BYMrbKZE.js → gateway-config-swr-DMm1vU51.js} +1 -1
  37. package/dist/gateway/static/root/assets/gateway-settings-DrHhtZqv.js +1 -0
  38. package/dist/gateway/static/root/assets/{gateway-startup-retry-DMqYXHAn.js → gateway-startup-retry-Ck6tj6yE.js} +1 -1
  39. package/dist/gateway/static/root/assets/home-page-YgI6jfGA.js +1 -0
  40. package/dist/gateway/static/root/assets/{image-generation-api-D1sQGaJz.js → image-generation-api-BOh6j0BF.js} +1 -1
  41. package/dist/gateway/static/root/assets/imports-page-BuqdzA7h.js +1 -0
  42. package/dist/gateway/static/root/assets/index-DJmO2VAY.css +1 -0
  43. package/dist/gateway/static/root/assets/index-vCIBfJp7.js +121 -0
  44. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CMitbles.js → keyboard-shortcuts-settings-D9L7IdUg.js} +1 -1
  45. package/dist/gateway/static/root/assets/local-app-workbench-page-DO8uUtos.js +1 -0
  46. package/dist/gateway/static/root/assets/local-apps-page-BEvyufm7.js +1 -0
  47. package/dist/gateway/static/root/assets/locale-store-DAOwT3Zp.js +1 -0
  48. package/dist/gateway/static/root/assets/logs-page-Jev1m9sS.js +2 -0
  49. package/dist/gateway/static/root/assets/management-settings-41i7B1RO.js +1 -0
  50. package/dist/gateway/static/root/assets/{markdown-view-DXubGEic.js → markdown-view-nL4xzvI8.js} +1 -1
  51. package/dist/gateway/static/root/assets/{media-plugins-DLJrmU9J.js → media-plugins-dHbcqMan.js} +1 -1
  52. package/dist/gateway/static/root/assets/{messages-D0G_sZvA.js → messages-BZbt9x1y.js} +3 -3
  53. package/dist/gateway/static/root/assets/note-detail-panel-DonP0E6Q.js +5 -0
  54. package/dist/gateway/static/root/assets/notes-page-CYHMeVKo.js +8 -0
  55. package/dist/gateway/static/root/assets/{page-context-capture-button-C3JiQEKD.js → page-context-capture-button-BKsMcPOy.js} +1 -1
  56. package/dist/gateway/static/root/assets/{preview-open-alternatives-buk_gdip.js → preview-open-alternatives-Du18QgWc.js} +1 -1
  57. package/dist/gateway/static/root/assets/{product-open-page-DwEEO0Ak.js → product-open-page-IY1QL6s0.js} +1 -1
  58. package/dist/gateway/static/root/assets/project-detail-page-Bpw9mxfV.js +1 -0
  59. package/dist/gateway/static/root/assets/projects-page-BdYbDNUn.js +1 -0
  60. package/dist/gateway/static/root/assets/{registry-api-tx8XCHOs.js → registry-api-DCFXWBOt.js} +1 -1
  61. package/dist/gateway/static/root/assets/remote-access-hub-CLhbz3TF.js +1 -0
  62. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-De7HmmBu.js → runtime-tools-settings-panel-CuTFmXyj.js} +2 -2
  63. package/dist/gateway/static/root/assets/scenes-page-XwK2IEmr.js +2 -0
  64. package/dist/gateway/static/root/assets/{schema-form-DPMEuj5D.js → schema-form-qWQii8IU.js} +1 -1
  65. package/dist/gateway/static/root/assets/sessions-page-4-QoiDES.js +1 -0
  66. package/dist/gateway/static/root/assets/settings-advanced-gate-BggQVM1y.js +1 -0
  67. package/dist/gateway/static/root/assets/{settings-form-section-DM0D-BQ_.js → settings-form-section-B0ZBr0L9.js} +1 -1
  68. package/dist/gateway/static/root/assets/{settings-page-CWS9yOH3.js → settings-page-DpII4NO3.js} +1 -1
  69. package/dist/gateway/static/root/assets/setup-status-panel-HPpC7EE0.js +1 -0
  70. package/dist/gateway/static/root/assets/{share-preview-page-CcRi2yGy.js → share-preview-page-B2CGYZHc.js} +1 -1
  71. package/dist/gateway/static/root/assets/shares-settings-DhVCRYGP.js +1 -0
  72. package/dist/gateway/static/root/assets/skill-api-_ddww47C.js +1 -0
  73. package/dist/gateway/static/root/assets/skill-reload-api-XPZkWJJe.js +1 -0
  74. package/dist/gateway/static/root/assets/skills-page-uF7DkJMC.js +2 -0
  75. package/dist/gateway/static/root/assets/system-settings-panel-25ABVt7H.js +1 -0
  76. package/dist/gateway/static/root/assets/task-detail-page-gepxhO4j.js +1 -0
  77. package/dist/gateway/static/root/assets/tunnel-api-CwQGBI_4.js +1 -0
  78. package/dist/gateway/static/root/assets/{use-autosave-ZTHe1zCM.js → use-autosave-CL3wytbs.js} +1 -1
  79. package/dist/gateway/static/root/assets/user-model-page-DldQW9Wh.js +2 -0
  80. package/dist/gateway/static/root/assets/{voice-api-key-field-C8Kpkct-.js → voice-api-key-field-zjAzQrx4.js} +1 -1
  81. package/dist/gateway/static/root/assets/{voice-config-api-BvzxINUk.js → voice-config-api-DvzQ-128.js} +1 -1
  82. package/dist/gateway/static/root/assets/{work-discovery-overlay-ClB6T-dm.js → work-discovery-overlay-MaPPjWwl.js} +1 -1
  83. package/dist/gateway/static/root/assets/workflow-run-setup-panel-C3dQN1fE.js +3 -0
  84. package/dist/gateway/static/root/assets/workflows-page-B9lnTU3U.js +6 -0
  85. package/dist/gateway/static/root/index.html +8 -14
  86. package/dist/package.js +1 -1
  87. package/dist/src/agent/agent-manager.d.ts +1 -0
  88. package/dist/src/agent/agent-manager.js +19 -4
  89. package/dist/src/agent/background-review/run-background-review.js +1 -1
  90. package/dist/src/agent/bootstrap/filter-bootstrap-files.js +1 -1
  91. package/dist/src/agent/capabilities/definitions.d.ts +3 -2
  92. package/dist/src/agent/capabilities/definitions.js +3 -2
  93. package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
  94. package/dist/src/agent/image/tool-model-config.js +1 -1
  95. package/dist/src/agent/orchestration/llm-turn-retry.js +2 -15
  96. package/dist/src/agent/service.d.ts +1 -0
  97. package/dist/src/agent/service.js +5 -2
  98. package/dist/src/agent/tasks/task-judge-service.js +1 -1
  99. package/dist/src/agent/tools/factory.js +3 -2
  100. package/dist/src/agent/tools/index.d.ts +1 -0
  101. package/dist/src/agent/tools/index.js +2 -1
  102. package/dist/src/agent/tools/workflow-manage-tool.d.ts +2 -0
  103. package/dist/src/agent/tools/workflow-manage-tool.js +225 -0
  104. package/dist/src/agent/tools/xopc-use-tool.js +1 -1
  105. package/dist/src/agent-catalog/capabilities.js +2 -2
  106. package/dist/src/auth/credentials.js +1 -1
  107. package/dist/src/auth/oauth-provider-lock.js +1 -1
  108. package/dist/src/auth/sync-provider-auth.js +1 -1
  109. package/dist/src/automations/capabilities/drafts.js +1 -1
  110. package/dist/src/automations/draft/automation-draft-service.js +13 -4
  111. package/dist/src/bootstrap/application-state.js +1 -1
  112. package/dist/src/capabilities/runtime/dispatcher.js +1 -1
  113. package/dist/src/capabilities/runtime/product.js +1 -1
  114. package/dist/src/chat-commands/agent-edit.js +1 -1
  115. package/dist/src/chat-commands/builtins/config.js +1 -1
  116. package/dist/src/chat-previews/service.js +1 -2
  117. package/dist/src/cli/commands/agent.js +1 -1
  118. package/dist/src/cli/commands/agents.js +1 -1
  119. package/dist/src/cli/commands/models.js +1 -1
  120. package/dist/src/cli/commands/onboard/model.js +2 -2
  121. package/dist/src/cli/utils/init-workspace-core.js +1 -1
  122. package/dist/src/config/index.js +4 -4
  123. package/dist/src/config/loader.js +2 -2
  124. package/dist/src/config/models-json.js +1 -1
  125. package/dist/src/config/schema.js +1 -1
  126. package/dist/src/extensions/agent-plugins/validation.js +1 -1
  127. package/dist/src/extensions/bundled-extension-activation.d.ts +3 -1
  128. package/dist/src/extensions/bundled-extension-activation.js +5 -8
  129. package/dist/src/gateway/agents-admin.js +2 -2
  130. package/dist/src/gateway/file-path-classifier.js +1 -1
  131. package/dist/src/gateway/gateway-workflow-host.types.d.ts +1 -0
  132. package/dist/src/gateway/hono/lib/config-payload.js +1 -1
  133. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +27 -5
  134. package/dist/src/gateway/hono/routes/config-patch/misc.js +2 -2
  135. package/dist/src/gateway/hono/routes/notes.js +2 -2
  136. package/dist/src/gateway/hono/routes/projects.js +2 -2
  137. package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
  138. package/dist/src/gateway/hono/routes/tasks.js +1 -1
  139. package/dist/src/gateway/hono/routes/workflows.js +1 -23
  140. package/dist/src/gateway/image-generation-setup.js +2 -2
  141. package/dist/src/gateway/lock.js +1 -1
  142. package/dist/src/gateway/service/config-coordinator.d.ts +4 -4
  143. package/dist/src/gateway/service/config-coordinator.js +6 -6
  144. package/dist/src/gateway/service/marketplace-service.js +8 -6
  145. package/dist/src/gateway/service.d.ts +1 -1
  146. package/dist/src/gateway/service.js +14 -14
  147. package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
  148. package/dist/src/home-intelligence/generator.js +7 -6
  149. package/dist/src/home-intelligence/host.js +1 -1
  150. package/dist/src/local-apps/service.js +1 -1
  151. package/dist/src/providers/model-catalog-persistence.js +1 -1
  152. package/dist/src/providers/model-response.d.ts +2 -0
  153. package/dist/src/providers/model-response.js +24 -1
  154. package/dist/src/tasks/capabilities/read.js +2 -2
  155. package/dist/src/tui/backends/embedded-backend.js +6 -3
  156. package/dist/src/tui/tui-commands.js +2 -2
  157. package/dist/src/tui/tui-startup-resources.js +1 -1
  158. package/dist/src/tui/tui.js +3 -3
  159. package/dist/src/voice/platform-streams.js +15 -7
  160. package/dist/src/voice/realtime/agentEngine.js +19 -3
  161. package/dist/src/voice/realtime/pcmFrameBuffer.js +2 -1
  162. package/dist/src/voice/realtime/persona-context.js +1 -1
  163. package/dist/src/voice/realtime/playback-echo.js +16 -1
  164. package/dist/src/workflows/authoring/index.d.ts +1 -0
  165. package/dist/src/workflows/authoring/index.js +2 -1
  166. package/dist/src/workflows/authoring/workflow-draft-defaults.d.ts +3 -0
  167. package/dist/src/workflows/authoring/workflow-draft-defaults.js +63 -0
  168. package/dist/src/workflows/domain/index.js +1 -1
  169. package/dist/src/workflows/engine/workflow-engine.js +1 -1
  170. package/dist/src/workflows/index.js +2 -2
  171. package/dist/src/workflows/service/workflow-run-service.d.ts +1 -1
  172. package/dist/src/workflows/service/workflow-run-service.js +34 -11
  173. package/dist/src/workflows/service/workflow-session-bridge.js +2 -2
  174. package/package.json +4 -4
  175. package/skills/engineering/workflow-authoring/SKILL.md +32 -0
  176. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-DHJyAT7t.js +0 -1
  177. package/dist/gateway/static/root/assets/agent-plugin-dialog-DLKj_iIh.js +0 -1
  178. package/dist/gateway/static/root/assets/agents-SXZ5O0g4.js +0 -70
  179. package/dist/gateway/static/root/assets/apps-page-DcclVdxW.js +0 -1
  180. package/dist/gateway/static/root/assets/automations-workspace-Cc4yqiF6.js +0 -7
  181. package/dist/gateway/static/root/assets/box-DvYoGszj.js +0 -1
  182. package/dist/gateway/static/root/assets/braces-Cfmtagno.js +0 -1
  183. package/dist/gateway/static/root/assets/browser-automations-page-CZYCvSSU.js +0 -3
  184. package/dist/gateway/static/root/assets/browser-settings-page-DDz9PE6m.js +0 -3
  185. package/dist/gateway/static/root/assets/calendar-clock-D-quYVPe.js +0 -1
  186. package/dist/gateway/static/root/assets/capabilities-page-DH3aDk53.js +0 -2
  187. package/dist/gateway/static/root/assets/capabilities-settings-panel-C8jMZAJl.js +0 -8
  188. package/dist/gateway/static/root/assets/capability-discover-page-CgGvsf3t.js +0 -1
  189. package/dist/gateway/static/root/assets/channels-CuVS_KsY.js +0 -1
  190. package/dist/gateway/static/root/assets/chevron-left-DqFhpbvK.js +0 -1
  191. package/dist/gateway/static/root/assets/clock-3-DnrAnuyZ.js +0 -1
  192. package/dist/gateway/static/root/assets/connectors-page-B4SLpvSL.js +0 -2
  193. package/dist/gateway/static/root/assets/date-picker-DXQTsUJn.js +0 -1
  194. package/dist/gateway/static/root/assets/desktop-pet-settings-B5JGIfqn.js +0 -1
  195. package/dist/gateway/static/root/assets/device-pairing-wizard-DFYK_Ywf.js +0 -1
  196. package/dist/gateway/static/root/assets/extension-marketplace-api-DqV4YRYs.js +0 -1
  197. package/dist/gateway/static/root/assets/gateway-settings-BIsiP-JI.js +0 -1
  198. package/dist/gateway/static/root/assets/gauge-C78eD2BA.js +0 -1
  199. package/dist/gateway/static/root/assets/git-branch-Dh9uxTot.js +0 -1
  200. package/dist/gateway/static/root/assets/home-page-CoBivEvx.js +0 -1
  201. package/dist/gateway/static/root/assets/image-Cwyalflz.js +0 -1
  202. package/dist/gateway/static/root/assets/imports-page-rssb4rjP.js +0 -1
  203. package/dist/gateway/static/root/assets/inbox-DNoSz682.js +0 -1
  204. package/dist/gateway/static/root/assets/index-C4QN4gCi.css +0 -1
  205. package/dist/gateway/static/root/assets/index-Cr4SINLG.js +0 -121
  206. package/dist/gateway/static/root/assets/is-masked-secret-DOkL5b_X.js +0 -1
  207. package/dist/gateway/static/root/assets/layout-grid-CEVZdVFU.js +0 -1
  208. package/dist/gateway/static/root/assets/list-BBGUdmkF.js +0 -1
  209. package/dist/gateway/static/root/assets/local-app-workbench-page-Di82Oacm.js +0 -1
  210. package/dist/gateway/static/root/assets/local-apps-page-CCvA9d9L.js +0 -1
  211. package/dist/gateway/static/root/assets/locale-store-BSkKhYkc.js +0 -1
  212. package/dist/gateway/static/root/assets/lock-keyhole-DEK5kH0u.js +0 -1
  213. package/dist/gateway/static/root/assets/logs-page-BK8ol1q0.js +0 -2
  214. package/dist/gateway/static/root/assets/management-settings-CebXkEtB.js +0 -1
  215. package/dist/gateway/static/root/assets/message-circle-Badhj-4D.js +0 -1
  216. package/dist/gateway/static/root/assets/message-square-fVE7Ghj1.js +0 -1
  217. package/dist/gateway/static/root/assets/models-hub-cache-B0EUPwTv.js +0 -1
  218. package/dist/gateway/static/root/assets/network-BUQLY1BV.js +0 -1
  219. package/dist/gateway/static/root/assets/note-detail-panel-xsKDIJdK.js +0 -5
  220. package/dist/gateway/static/root/assets/notes-page-BFm7XnWH.js +0 -8
  221. package/dist/gateway/static/root/assets/paperclip-f1HujQY1.js +0 -1
  222. package/dist/gateway/static/root/assets/power-ZI-pBczI.js +0 -1
  223. package/dist/gateway/static/root/assets/project-detail-page-CRQGCRSU.js +0 -1
  224. package/dist/gateway/static/root/assets/projects-page-DcqylysA.js +0 -1
  225. package/dist/gateway/static/root/assets/remote-access-hub-Cq5MaiRW.js +0 -1
  226. package/dist/gateway/static/root/assets/scenes-page-GXJ-b3dO.js +0 -2
  227. package/dist/gateway/static/root/assets/server-BlHCBjiE.js +0 -1
  228. package/dist/gateway/static/root/assets/sessions-page-C6FwYIRA.js +0 -1
  229. package/dist/gateway/static/root/assets/settings-advanced-gate-BEyQiZs0.js +0 -1
  230. package/dist/gateway/static/root/assets/setup-status-panel-BhGKiTPf.js +0 -1
  231. package/dist/gateway/static/root/assets/shares-settings-DNmcCBfX.js +0 -1
  232. package/dist/gateway/static/root/assets/skill-api-BCAV_F1P.js +0 -1
  233. package/dist/gateway/static/root/assets/skill-card-icon-BrrpZ3Mw.js +0 -1
  234. package/dist/gateway/static/root/assets/skill-reload-api-BEV2WXGk.js +0 -1
  235. package/dist/gateway/static/root/assets/skills-page-C8zOGpKw.js +0 -2
  236. package/dist/gateway/static/root/assets/star-BUWJqJ5c.js +0 -1
  237. package/dist/gateway/static/root/assets/stethoscope-DRqTAtjD.js +0 -1
  238. package/dist/gateway/static/root/assets/store-SzD1Jvgm.js +0 -1
  239. package/dist/gateway/static/root/assets/system-settings-panel-C_lajq9u.js +0 -1
  240. package/dist/gateway/static/root/assets/task-detail-page-Dk8Bmlhw.js +0 -1
  241. package/dist/gateway/static/root/assets/tunnel-api-CYvKiE_f.js +0 -1
  242. package/dist/gateway/static/root/assets/upload-rrb46c3c.js +0 -1
  243. package/dist/gateway/static/root/assets/user-model-page-C_SPNZbP.js +0 -2
  244. package/dist/gateway/static/root/assets/user-round-C9jxPhMR.js +0 -1
  245. package/dist/gateway/static/root/assets/wand-sparkles-DWuJz5ya.js +0 -1
  246. package/dist/gateway/static/root/assets/workflow-run-setup-panel-X0Cyh2AR.js +0 -3
  247. package/dist/gateway/static/root/assets/workflows-page-BrL6dzf0.js +0 -6
  248. package/dist/src/workflows/draft/index.d.ts +0 -3
  249. package/dist/src/workflows/draft/index.js +0 -3
  250. package/dist/src/workflows/draft/workflow-draft-prompt.d.ts +0 -22
  251. package/dist/src/workflows/draft/workflow-draft-prompt.js +0 -54
  252. package/dist/src/workflows/draft/workflow-draft-service.d.ts +0 -12
  253. package/dist/src/workflows/draft/workflow-draft-service.js +0 -125
  254. package/dist/src/workflows/draft/workflow-draft-validator.d.ts +0 -4
  255. package/dist/src/workflows/draft/workflow-draft-validator.js +0 -123
  256. package/dist/src/workflows/draft/workflow-draft.types.d.ts +0 -44
  257. package/dist/src/workflows/draft/workflow-draft.types.js +0 -1
@@ -1 +0,0 @@
1
- function e(e){return e===`***`||e===`••••••••••••`||/^•+$/.test(e)}function t(e){return e>0?`•`.repeat(e):``}export{e as n,t};
@@ -1 +0,0 @@
1
- import{t as e}from"./createLucideIcon-DPHK1VkS.js";var t=e(`layout-grid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]);export{t};
@@ -1 +0,0 @@
1
- import{t as e}from"./createLucideIcon-DPHK1VkS.js";var t=e(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]);export{t};
@@ -1 +0,0 @@
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,m as a,t as o}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as s}from"./createLucideIcon-DPHK1VkS.js";import{t as c}from"./check-DUBLcKHA.js";import{t as ee}from"./circle-check-C23XjkUj.js";import{t as l}from"./clock-3-DnrAnuyZ.js";import{t as te}from"./external-link-DjqjBmc3.js";import{t as u}from"./loader-circle-CifKLtgG.js";import{t as d}from"./power-ZI-pBczI.js";import{t as f}from"./x-B_N4OPjy.js";import{n as p,r as m}from"./locale-store-BSkKhYkc.js";import{a as h,i as g,n as _,o as v,r as y,s as b,t as x}from"./dist-BGTk37IG.js";import{a as S}from"./local-apps-Bpja8nC6.js";import{a as C,i as ne}from"./vendor-swr-BIWyz7Rc.js";import{t as w}from"./button-CS04eWY9.js";import{t as re}from"./skeleton-BwbyijEw.js";import{$l as ie,Ar as ae,Bc as oe,Cr as se,Dc as ce,Eo as le,Er as ue,Ic as de,Il as fe,Kc as pe,Mr as me,Oc as he,Or as ge,Sl as _e,Sr as ve,Tr as ye,br as be,go as xe,hi as Se,jr as Ce,kr as we,lo as Te,nl as Ee,qc as De,vl as Oe,wr as ke,xr as Ae}from"./index-Cr4SINLG.js";import{t as je}from"./page-context-capture-button-C3JiQEKD.js";import{n as Me,t as Ne}from"./tab-completion-input-D64VNmiA.js";import{t as Pe}from"./tab-completion-input.utils-BP3NH_du.js";var Fe=s(`file-diff`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M9 10h6`,key:`9gxzsh`}],[`path`,{d:`M12 13V7`,key:`h0r20n`}],[`path`,{d:`M9 17h6`,key:`r8uit2`}]]),T=s(`message-square-code`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`m10 8-3 3 3 3`,key:`fp6dz7`}],[`path`,{d:`m14 14 3-3-3-3`,key:`1yrceu`}]]),Ie=s(`power-off`,[[`path`,{d:`M18.36 6.64A9 9 0 0 1 20.77 15`,key:`dxknvb`}],[`path`,{d:`M6.16 6.16a9 9 0 1 0 12.68 12.68`,key:`1x7qb5`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),E=e(t(),1),D=`build-xopc-local-app`;function Le(e){return(e.routing?.agentId??e.agentId??``).trim().toLowerCase()}function Re(e){return e.find(e=>Le(e)===`coder`)??null}function ze(e,t){let n=new URLSearchParams({skill:D}),r=t?.trim();return r&&n.set(`draft`,r),`/chat/${encodeURIComponent(e)}?${n.toString()}`}var Be=n(),O=r();function Ve(e){let t=(0,Be.c)(36),{scenarios:n,results:r,runningTarget:i,zh:a,onRunAll:o,onRunScenario:s,onAskCoder:c}=e;if(!n.length)return null;let te=a?`产品场景`:`Product scenarios`,d;t[0]===te?d=t[1]:(d=(0,O.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:te}),t[0]=te,t[1]=d);let f=a?`${n.length} 个关键用户路径`:`${n.length} critical user journey${n.length===1?``:`s`}`,p;t[2]===f?p=t[3]:(p=(0,O.jsx)(`p`,{className:`mt-0.5 text-[11px] text-fg-subtle`,children:f}),t[2]=f,t[3]=p);let m;t[4]!==d||t[5]!==p?(m=(0,O.jsxs)(`div`,{children:[d,p]}),t[4]=d,t[5]=p,t[6]=m):m=t[6];let h=i!==null,g;t[7]===i?g=t[8]:(g=i===`all`?(0,O.jsx)(u,{className:`size-3 animate-spin`}):(0,O.jsx)(De,{className:`size-3`}),t[7]=i,t[8]=g);let _=a?`全部重跑`:`Run all`,v;t[9]!==o||t[10]!==h||t[11]!==g||t[12]!==_?(v=(0,O.jsxs)(w,{variant:`ghost`,className:`h-7 rounded-lg px-2 text-[11px]`,onClick:o,disabled:h,children:[g,_]}),t[9]=o,t[10]=h,t[11]=g,t[12]=_,t[13]=v):v=t[13];let y;t[14]!==m||t[15]!==v?(y=(0,O.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[m,v]}),t[14]=m,t[15]=v,t[16]=y):y=t[16];let b=a?`产品场景验收结果`:`Product scenario acceptance results`,x;if(t[17]!==c||t[18]!==s||t[19]!==r||t[20]!==i||t[21]!==n||t[22]!==a){let e;t[24]!==c||t[25]!==s||t[26]!==r||t[27]!==i||t[28]!==a?(e=e=>{let t=r[e.id],n=i===`all`||i===e.id?`running`:t?.status??`pending`;return(0,O.jsx)(`li`,{className:`py-2.5 first:pt-1`,children:(0,O.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,O.jsx)(`span`,{className:`mt-0.5 shrink-0`,"aria-hidden":!0,children:n===`running`?(0,O.jsx)(u,{className:`size-3.5 animate-spin text-accent`}):n===`passed`?(0,O.jsx)(ee,{className:`size-3.5 text-success`}):n===`failed`?(0,O.jsx)(fe,{className:`size-3.5 text-danger`}):(0,O.jsx)(l,{className:`size-3.5 text-fg-subtle`})}),(0,O.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,O.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsx)(`p`,{className:`truncate text-[11px] font-medium text-fg`,children:e.name}),(0,O.jsx)(`p`,{className:`mt-0.5 text-[10px] text-fg-subtle`,children:a?`${e.stepCount} 个步骤`:`${e.stepCount} step${e.stepCount===1?``:`s`}`})]}),(0,O.jsx)(w,{variant:`ghost`,className:`size-7 shrink-0 rounded-lg p-0`,onClick:()=>s(e.id),disabled:i!==null,"aria-label":a?`重跑${e.name}`:`Rerun ${e.name}`,title:a?`单独重跑`:`Rerun scenario`,children:(0,O.jsx)(De,{className:`size-3`})})]}),n===`running`?(0,O.jsx)(`p`,{className:`mt-1 text-[11px] leading-4 text-fg-muted`,children:a?`正在隔离预览中执行…`:`Running in an isolated preview…`}):t?.status===`failed`?(0,O.jsxs)(`div`,{className:`mt-1.5`,children:[(0,O.jsx)(`p`,{className:`text-[11px] leading-4 text-danger`,children:t.message}),(0,O.jsxs)(w,{variant:`ghost`,className:`mt-1 h-7 rounded-lg px-2 text-[11px] text-danger hover:text-danger`,onClick:()=>c(e,t),children:[(0,O.jsx)(T,{className:`size-3`}),a?`让 Coder 修复`:`Ask Coder to fix`]})]}):t?.status===`passed`?(0,O.jsx)(`p`,{className:`mt-1 text-[11px] leading-4 text-fg-muted`,children:a?`场景已通过`:`Scenario passed`}):(0,O.jsx)(`p`,{className:`mt-1 text-[11px] leading-4 text-fg-muted`,children:a?`等待运行`:`Waiting to run`})]})]})},e.id)},t[24]=c,t[25]=s,t[26]=r,t[27]=i,t[28]=a,t[29]=e):e=t[29],x=n.map(e),t[17]=c,t[18]=s,t[19]=r,t[20]=i,t[21]=n,t[22]=a,t[23]=x}else x=t[23];let S;t[30]!==b||t[31]!==x?(S=(0,O.jsx)(`ul`,{className:`mt-2 divide-y divide-edge-subtle`,"aria-label":b,children:x}),t[30]=b,t[31]=x,t[32]=S):S=t[32];let C;return t[33]!==y||t[34]!==S?(C=(0,O.jsxs)(`div`,{className:`mt-3 border-t border-edge-subtle pt-3`,children:[y,S]}),t[33]=y,t[34]=S,t[35]=C):C=t[35],C}var He=`allow-scripts allow-forms`;function Ue(e,t){return Se(e,t)}function We(e,t,n){return!!(t&&n&&e.sourceHash===t&&e.status===n.status&&e.interactiveCount===n.interactiveCount&&JSON.stringify(e.checks)===JSON.stringify(n.checks))}function Ge(){let{appId:e}=a(),t=e===`new`,n=p(e=>e.language)===`zh`,r=p(e=>e.language),s=i(),{mutate:l}=C(),fe=le(e=>e.setPageHeader),Se=le(e=>e.clearPageHeader),{data:D,isLoading:Le,error:Be,mutate:Ge}=ne(!t&&e?[`local-app`,e]:null,()=>ke(e)),{data:k,isLoading:Ke,mutate:qe}=ne(!t&&e?[`local-app-validation`,e]:null,()=>me(e)),[Je,Ye]=(0,E.useState)(``),[Xe,Ze]=(0,E.useState)(``),[A,j]=(0,E.useState)(!1),[Qe,M]=(0,E.useState)(null),[$e,et]=(0,E.useState)(!1),[tt,nt]=(0,E.useState)(!1),[N,rt]=(0,E.useState)(0),[it,at]=(0,E.useState)(``),[P,ot]=(0,E.useState)(!1),[F,st]=(0,E.useState)(!1),[I,L]=(0,E.useState)(`booting`),[R,ct]=(0,E.useState)(null),[z,lt]=(0,E.useState)(null),[B,ut]=(0,E.useState)({}),[V,dt]=(0,E.useState)(`all`),[H,U]=(0,E.useState)(0),[ft,pt]=(0,E.useState)(0),[mt,ht]=(0,E.useState)(null),[W,gt]=(0,E.useState)(null),[_t,vt]=(0,E.useState)([]),[G,yt]=(0,E.useState)(!1),bt=(0,E.useRef)(new Set),K=(0,E.useRef)(null),xt=(0,E.useRef)(null),St=(0,E.useRef)(null),q=(0,E.useRef)(null),J=(0,E.useRef)(``),Y=k?.acceptanceScenarios??[],X=(0,E.useMemo)(()=>{if(!Y.length)return null;let e=Y.map(e=>B[e.id]).filter(e=>!!e);return e.length===Y.length?{status:e.some(e=>e.status===`failed`)?`failed`:`passed`,scenarioCount:Y.length,scenarios:e}:null},[Y,B]),Z=(0,E.useMemo)(()=>{if(!z)return null;if(!k?.acceptanceScenarioCount)return z;if(!X)return null;let e=X.scenarios.find(e=>e.status===`failed`),t={id:`criteria`,status:X.status,message:e?`${e.name}: ${e.message}`:`${X.scenarioCount} product scenario(s) passed`},n=[...z.checks,t];return{status:n.some(e=>e.status===`failed`)?`failed`:`passed`,checks:n,interactiveCount:z.interactiveCount}},[z,X,k?.acceptanceScenarioCount]),Ct=(0,E.useCallback)(async(e,t)=>{let n=Re(await xe(e.projectId))??await Te(e.projectId,`coder`);bt.current.add(n.key),s(ze(n.key,t))},[s]),wt=(0,E.useCallback)(async(e=!0)=>{if(!D)return null;st(!0);try{let t=await me(D.id);return await qe(t,{revalidate:!1}),e&&(q.current=t.sourceHash??null,dt(`all`),U(0),rt(e=>e+1)),t}catch(e){return M(e instanceof Error?e.message:String(e)),null}finally{st(!1)}},[D,qe]);(0,E.useEffect)(()=>{if(!D)return;let e=!1;xe(D.projectId).then(t=>{e||(bt.current=new Set(t.filter(e=>(e.routing?.agentId??e.agentId)?.toLowerCase()===`coder`).map(e=>e.key)))}).catch(()=>{});let t=e=>{let t=e.detail?.key;!t||!bt.current.has(t)||(K.current!==null&&window.clearTimeout(K.current),K.current=window.setTimeout(()=>{K.current=null,wt(!0)},750))};return window.addEventListener(`session-transcript-updated`,t),()=>{e=!0,window.removeEventListener(`session-transcript-updated`,t),K.current!==null&&window.clearTimeout(K.current)}},[D,wt]),(0,E.useEffect)(()=>{vt(D?.acceptanceRuns??[])},[D?.acceptanceRuns]),(0,E.useEffect)(()=>{q.current=null},[D?.id]),(0,E.useEffect)(()=>{!k?.sourceHash||q.current===k.sourceHash||(q.current=k.sourceHash,dt(`all`),U(0),rt(e=>e+1))},[D?.id,k?.sourceHash]),(0,E.useLayoutEffect)(()=>{if(!D)return;L(`booting`),ct(null),lt(null),gt(null),yt(!1),J.current=``;let e=window.setTimeout(()=>L(e=>e===`failed`?e:`timeout`),7e3),t=xt.current?ve(xt.current,t=>{let n=S(t);if(n){if(n.type===`ready`){L(e=>e===`failed`?e:`healthy`);return}if(n.type===`acceptance`){window.clearTimeout(e),lt(n.detail),gt(q.current);return}n.type!==`criteria`&&(window.clearTimeout(e),ct(n.detail),L(`failed`))}}):()=>{};return()=>{window.clearTimeout(e),t()}},[D,N]),(0,E.useLayoutEffect)(()=>{if(!D||k?.status!==`healthy`||!Y.length){ht(null);return}let e=V===`all`?Y[H]:Y.find(e=>e.id===V),t=e?[e]:[];if(!t.length)return;ht(V),ut(e=>{if(V===`all`&&H===0)return{};let t={...e};return delete t[V],t});let r=!1,i=e=>{ut(n=>{let r={...n};for(let n of t)r[n.id]={id:n.id,name:n.name,status:`failed`,message:e,failureKind:`runner`};return r}),ht(null)},a=window.setTimeout(()=>i(r?n?`场景在 10 秒内未完成。`:`Scenario did not finish within 10 seconds.`:n?`验收执行器未能连接,请重新验收。`:`The acceptance runner did not connect. Run acceptance again.`),1e4),o=St.current?ve(St.current,e=>{let t=S(e);t&&(t.type===`ready`?r=!0:t.type===`criteria`?(window.clearTimeout(a),ut(e=>{let n={...e};for(let e of t.detail.scenarios)(n[e.id]?.status!==`failed`||e.status===`failed`)&&(n[e.id]=e);return n}),V===`all`&&H+1<Y.length?(U(e=>e+1),pt(e=>e+1)):ht(null)):t.type===`error`&&(window.clearTimeout(a),i(be(t.detail))))}):()=>{};return()=>{window.clearTimeout(a),o()}},[Y,D,ft,V,H,N,k?.status,n]),(0,E.useEffect)(()=>{if(!D||!Z||!W||W!==k?.sourceHash)return;let e=`${D.id}:${W}:${JSON.stringify(Z)}`;J.current!==e&&(J.current=e,yt(!0),ge(D.id,W,Z).then(t=>{J.current===e&&vt(e=>[t,...e.filter(e=>e.id!==t.id)].toSorted((e,t)=>t.createdAt-e.createdAt).slice(0,20))}).catch(t=>{J.current===e&&(J.current=``,yt(!1),M(t instanceof Error?t.message:String(t)))}).finally(()=>{J.current===e&&yt(!1)}))},[Z,W,D,k?.sourceHash]);let Q=(0,E.useCallback)(async e=>{if(D){ot(!0),M(null);try{await Ct(D,e)}catch(e){M(e instanceof Error?e.message:String(e)),ot(!1)}}},[D,Ct]);(0,E.useLayoutEffect)(()=>(fe({startExtra:(0,O.jsx)(o,{to:`/local-apps`,className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":n?`返回本地应用`:`Back to local apps`,children:(0,O.jsx)(ie,{className:`size-4`})}),main:(0,O.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:D?.name||(n?`创建本地应用`:`Create local app`)}),end:D?(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,O.jsx)(je,{resource:{kind:`local_app`,id:D.id,revision:k?.sourceHash??``},disabled:A||P||F||!k?.sourceHash}),(0,O.jsx)(w,{asChild:!0,variant:`ghost`,className:`h-9`,children:(0,O.jsxs)(o,{to:`/projects/${encodeURIComponent(D.projectId)}`,children:[(0,O.jsx)(_e,{className:`size-4`}),`Project`]})}),(0,O.jsxs)(w,{className:`h-9`,onClick:()=>void Q(),disabled:P,children:[P?(0,O.jsx)(u,{className:`size-4 animate-spin`}):(0,O.jsx)(T,{className:`size-4`}),n?`继续开发`:`Continue building`]})]}):null}),()=>Se()),[D,A,P,F,k?.sourceHash,Se,Q,fe,n]);async function Tt(e){e.preventDefault(),j(!0),M(null);try{let e=await se({name:Je,idea:Xe});await l(`local-apps-list`);let t=n?`请基于 APP_BRIEF.md 完成这个本地应用的首版。先检查现有草稿,再实现最小可用版本并运行校验;完成后告诉我可以如何预览。`:`Build the first usable version of this local app from APP_BRIEF.md. Inspect the existing draft, implement the smallest useful version, run validation, and tell me how to preview it.`;try{await Ct(e,t)}catch{s(`/local-apps/${encodeURIComponent(e.id)}`,{replace:!0})}}catch(e){M(e instanceof Error?e.message:String(e))}finally{j(!1)}}async function Et(){if(D){j(!0),M(null);try{await Ge(await ue(D.id),{revalidate:!1}),await qe(),await Promise.all([l(`local-apps-list`),l(`gateway-extensions-list`)]),et(!1)}catch(e){M(e instanceof Error?e.message:String(e))}finally{j(!1)}}}async function Dt(e){j(!0),M(null);try{return await Ge(await e(),{revalidate:!1}),await qe(),await Promise.all([l(`local-apps-list`),l(`gateway-extensions-list`)]),!0}catch(e){return M(e instanceof Error?e.message:String(e)),!1}finally{j(!1)}}async function Ot(e){D&&await Dt(()=>ae(D.id,e))}async function kt(e){D&&await Dt(()=>we(D.id,e))}async function At(){D&&await Dt(()=>Ce(D.id))&&nt(!1)}async function jt(e){if(!(!D||!e.length)){M(null);try{await Q((await ye(D.id,{sourceHash:k?.sourceHash,locale:n?`zh`:`en`,diagnostics:e})).prompt)}catch(e){M(e instanceof Error?e.message:String(e))}}}function Mt(){jt([...k?.issues.map(e=>({phase:`build`,code:e.code,message:e.message}))??[],...R?[{phase:`runtime`,code:R.kind,message:be(R)}]:[],...Z?.checks.filter(e=>e.status===`failed`&&e.id!==`criteria`).map(e=>({phase:`acceptance`,code:e.id,message:e.message}))??[],...Object.values(B).filter(e=>e.status===`failed`).map(e=>({phase:e.failureKind===`runner`?`runner`:`acceptance`,code:e.id,message:`${e.name}: ${e.message}`})),...I===`timeout`?[{phase:`boot`,code:`boot_timeout`,message:`Preview did not report ready within 7 seconds.`}]:[]])}function Nt(){dt(`all`),U(0),pt(e=>e+1)}function Pt(e){dt(e),U(0),pt(e=>e+1)}function Ft(e,t){jt([{phase:t.failureKind===`runner`?`runner`:`acceptance`,code:e.id,message:`${e.name}: ${t.message}`}])}let It=_t.findIndex(e=>We(e,W,Z)),$=It>=0?_t[It]:null,Lt=It>=0?_t[It+1]??null:_t[0]??null,Rt=Ae(Z),zt=Lt?Lt.checks.filter(e=>e.status===`failed`).map(e=>e.message):[],Bt=k?.status===`failed`||I===`failed`||I===`timeout`||Z?.status===`failed`||Object.values(B).some(e=>e.status===`failed`),Vt=zt.filter(e=>!Rt.includes(e)).length;async function Ht(){let e=await wt(!1);if(e?.status===`healthy`&&e.sourceHash!==W){q.current=e.sourceHash??null,U(0),rt(e=>e+1);return}e?.status===`healthy`&&I===`healthy`&&Z?.status===`passed`&&$&&$.sourceHash===e.sourceHash&&et(!0)}return t?(0,O.jsx)(`div`,{className:`flex min-h-0 flex-1 bg-surface-panel p-3 sm:p-5 xl:p-6`,children:(0,O.jsxs)(`div`,{className:`mx-auto grid w-full max-w-6xl overflow-hidden rounded-2xl border border-edge-subtle bg-surface-base shadow-surface lg:grid-cols-[minmax(280px,0.8fr)_minmax(0,1.5fr)]`,children:[(0,O.jsxs)(`form`,{onSubmit:Tt,className:`flex flex-col border-b border-edge-subtle p-5 lg:border-b-0 lg:border-r`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-semibold uppercase tracking-[0.14em] text-accent`,children:[(0,O.jsx)(de,{className:`size-4`}),n?`告诉 Coder 你的想法`:`Tell Coder your idea`]}),(0,O.jsx)(`h2`,{className:`mt-4 text-xl font-semibold tracking-tight text-fg`,children:n?`你想创建什么?`:`What do you want to create?`}),(0,O.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:n?`我们会建立一个 Coder Project,并把应用上下文和开发 Skill 带入对话。`:`We will create a Coder Project and carry the app context and development skill into chat.`}),(0,O.jsxs)(`label`,{className:`mt-6 text-xs font-medium text-fg-muted`,children:[n?`应用名称`:`App name`,(0,O.jsx)(Ne,{value:Je,onChange:e=>Ye(e.target.value),suggestion:Pe(n?`例如:阅读清单`:`e.g. Reading list`),onAcceptSuggestion:Ye,required:!0,className:`mt-2 w-full rounded-xl border border-edge bg-surface-panel px-3 py-2.5 text-sm text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,placeholder:n?`例如:阅读清单`:`e.g. Reading list`})]}),(0,O.jsxs)(`label`,{className:`mt-4 text-xs font-medium text-fg-muted`,children:[n?`描述你的想法`:`Describe your idea`,(0,O.jsx)(Me,{value:Xe,onChange:e=>Ze(e.target.value),suggestion:Pe(n?`我想要一个可以记录待读文章、标记进度并按主题筛选的小工具…`:`I want a small tool that tracks articles, reading progress, and topics…`),onAcceptSuggestion:Ze,required:!0,rows:7,className:`mt-2 w-full resize-none rounded-xl border border-edge bg-surface-panel px-3 py-2.5 text-sm leading-6 text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,placeholder:n?`我想要一个可以记录待读文章、标记进度并按主题筛选的小工具…`:`I want a small tool that tracks articles, reading progress, and topics…`})]}),Qe?(0,O.jsx)(`p`,{className:`mt-3 text-sm text-danger`,role:`alert`,children:Qe}):null,(0,O.jsxs)(w,{type:`submit`,variant:`primary`,className:`mt-5 h-10`,disabled:A||!Je.trim()||!Xe.trim(),children:[A?(0,O.jsx)(u,{className:`size-4 animate-spin`}):(0,O.jsx)(T,{className:`size-4`}),n?`进入 Coder 对话`:`Continue with Coder`]})]}),(0,O.jsx)(`div`,{className:`hidden min-h-[620px] place-items-center bg-surface-panel p-8 lg:grid`,children:(0,O.jsxs)(`div`,{className:`max-w-md text-center`,children:[(0,O.jsx)(`div`,{className:`mx-auto flex size-16 items-center justify-center rounded-2xl border border-edge bg-surface-base text-accent shadow-surface`,children:(0,O.jsx)(Ee,{className:`size-7`})}),(0,O.jsx)(`h3`,{className:`mt-5 text-base font-semibold text-fg`,children:n?`创建后,这里就是实时预览`:`Your live preview appears here`}),(0,O.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:n?`你可以先体验草稿,再决定是否把它添加到左侧导航。`:`Try the draft first, then decide whether to add it to the sidebar.`})]})})]})}):Le?(0,O.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-3 bg-surface-panel p-3 lg:grid-cols-[280px_minmax(0,1fr)_260px]`,children:[(0,O.jsx)(re,{className:`rounded-xl`}),(0,O.jsx)(re,{className:`rounded-xl`}),(0,O.jsx)(re,{className:`rounded-xl`})]}):Be||!D?(0,O.jsx)(`div`,{className:`m-6 rounded-xl border border-danger/30 bg-danger-soft p-4 text-sm text-danger`,children:Be instanceof Error?Be.message:n?`找不到应用`:`App not found`}):(0,O.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-3 overflow-hidden bg-surface-panel p-3 lg:grid-cols-[280px_minmax(0,1fr)_300px]`,children:[(0,O.jsxs)(`aside`,{className:`min-h-0 overflow-y-auto rounded-xl border border-edge-subtle bg-surface-base p-4 shadow-surface`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-semibold uppercase tracking-[0.12em] text-accent`,children:[(0,O.jsx)(de,{className:`size-4`}),n?`创作对话`:`Build conversation`]}),(0,O.jsx)(`div`,{className:`mt-4 rounded-xl bg-surface-panel p-3 text-sm leading-6 text-fg`,children:D.idea}),(0,O.jsxs)(`div`,{className:`mt-4 rounded-xl bg-accent-soft p-3`,children:[(0,O.jsxs)(`p`,{className:`flex items-center gap-2 text-sm font-medium text-accent-fg`,children:[(0,O.jsx)(ee,{className:`size-4`}),n?`草稿已准备好`:`Draft is ready`]}),(0,O.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n?`继续迭代会进入对应 Project,由 Coder 读取应用上下文和专属 skill。`:`Continue in the Project where Coder has the app context and dedicated skill.`})]}),(0,O.jsxs)(`form`,{className:`mt-5`,onSubmit:e=>{e.preventDefault(),Q(it)},children:[(0,O.jsx)(`label`,{className:`text-xs font-medium text-fg-muted`,htmlFor:`local-app-change-request`,children:n?`下一步想改什么?`:`What should change next?`}),(0,O.jsx)(Me,{id:`local-app-change-request`,value:it,onChange:e=>at(e.target.value),suggestion:Pe(n?`例如:增加月视图,并支持按标签筛选`:`e.g. Add a monthly view and tag filters`),onAcceptSuggestion:at,rows:4,className:`mt-2 w-full resize-none rounded-xl border border-edge bg-surface-panel px-3 py-2.5 text-sm leading-6 text-fg outline-none focus-visible:ring-2 focus-visible:ring-accent`,placeholder:n?`例如:增加月视图,并支持按标签筛选`:`e.g. Add a monthly view and tag filters`}),(0,O.jsxs)(w,{type:`submit`,className:`mt-2 w-full`,disabled:P||!it.trim(),children:[P?(0,O.jsx)(u,{className:`size-4 animate-spin`}):(0,O.jsx)(T,{className:`size-4`}),n?`让 Coder 修改`:`Ask Coder to update`]})]}),(0,O.jsxs)(w,{variant:`ghost`,className:`mt-2 w-full`,onClick:()=>void Q(),disabled:P,children:[(0,O.jsx)(_e,{className:`size-4`}),n?`打开已有开发对话`:`Open development chat`]})]}),(0,O.jsxs)(`section`,{className:`flex min-h-0 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-base shadow-surface`,children:[(0,O.jsxs)(`div`,{className:`flex h-11 shrink-0 items-center justify-between border-b border-edge-subtle px-3`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[(0,O.jsx)(`span`,{className:`size-2 rounded-full ${k?.status===`failed`||I===`failed`||I===`timeout`||Z?.status===`failed`?`bg-danger`:k?.status===`healthy`&&I===`healthy`&&Z?.status===`passed`&&$?.sourceHash===k.sourceHash&&!G?`bg-success`:`bg-fg-subtle`}`}),I===`failed`||I===`timeout`?n?`预览运行异常`:`Preview runtime issue`:k?.status===`failed`||Z?.status===`failed`?n?`自动验收未通过`:`Acceptance needs attention`:I===`booting`||!Z?n?`自动验收中`:`Running acceptance`:G||$?.sourceHash!==k?.sourceHash?n?`正在保存验收快照`:`Saving acceptance snapshot`:n?`草稿已通过验收`:`Draft accepted`]}),(0,O.jsxs)(w,{variant:`ghost`,className:`h-8 px-2`,onClick:()=>void wt(!0),disabled:F,children:[F?(0,O.jsx)(u,{className:`size-3.5 animate-spin`}):(0,O.jsx)(De,{className:`size-3.5`}),n?`重新验收`:`Run again`]})]}),(0,O.jsx)(`iframe`,{ref:xt,title:`${D.name} preview`,src:m(D.draftPreviewUrl),sandbox:He,className:`min-h-0 w-full flex-1 bg-white`,onError:()=>{ct({kind:`script_error`,message:`Preview document failed to load`}),L(`failed`)}},N),k?.status===`healthy`&&k.acceptanceScenarioCount>0?(0,O.jsx)(`iframe`,{ref:St,title:`${D.name} acceptance runner`,src:`${m(D.draftPreviewUrl)}?xopcAcceptance=1&xopcScenario=${encodeURIComponent(V===`all`?Y[H]?.id??``:V)}`,sandbox:He,"aria-hidden":`true`,tabIndex:-1,className:`pointer-events-none fixed left-[-200vw] top-0 h-[720px] w-[1024px] opacity-0`},`criteria-${N}-${ft}-${H}`):null]}),(0,O.jsxs)(`aside`,{className:`min-h-0 overflow-y-auto rounded-xl border border-edge-subtle bg-surface-base p-4 shadow-surface`,children:[(0,O.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n?`发布状态`:`Release status`}),(0,O.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:D.installationState===`not_installed`?n?`尚未安装`:`Not installed`:D.enabled?n?`版本 ${D.activeVersion} 正在使用`:`Version ${D.activeVersion} is active`:n?`已禁用,版本仍保留`:`Disabled, release retained`})]}),(0,O.jsx)(`span`,{className:`mt-1 size-2.5 rounded-full ${D.enabled?`bg-success`:`bg-fg-subtle`}`,"aria-hidden":!0})]}),(0,O.jsxs)(`dl`,{className:`mt-4 grid grid-cols-2 gap-3 text-xs`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`dt`,{className:`text-fg-subtle`,children:n?`当前草稿`:`Draft`}),(0,O.jsxs)(`dd`,{className:`mt-1 font-medium text-fg`,children:[`v`,D.draftVersion]})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`dt`,{className:`text-fg-subtle`,children:n?`已安装`:`Installed`}),(0,O.jsx)(`dd`,{className:`mt-1 font-medium text-fg`,children:D.activeVersion?`v${D.activeVersion}`:`—`})]})]}),(0,O.jsxs)(`div`,{className:`mt-5 border-t border-edge-subtle pt-4`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,O.jsxs)(`h3`,{className:`flex items-center gap-2 text-xs font-semibold text-fg`,children:[(0,O.jsx)(Fe,{className:`size-4 text-accent`}),n?`草稿检查`:`Draft checks`]}),Ke||F?(0,O.jsx)(u,{className:`size-3.5 animate-spin text-fg-muted`}):k?.status===`healthy`?(0,O.jsx)(ee,{className:`size-4 text-success`}):(0,O.jsx)(ce,{className:`size-4 text-danger`})]}),k?(0,O.jsxs)(`div`,{className:`mt-2`,children:[(0,O.jsx)(`p`,{className:`text-xs leading-5 ${k.status===`healthy`?`text-fg-muted`:`text-danger`}`,children:k.status===`healthy`?k.hasDraftChanges?n?`${k.changedFileCount} 个文件有改动,可以安装新版本。`:`${k.changedFileCount} changed files are ready for a new release.`:n?`草稿与当前安装版本一致。`:`Draft matches the installed release.`:k.issues[0]?.message}),k.changedFiles.length?(0,O.jsx)(`ul`,{className:`mt-2 space-y-1`,children:k.changedFiles.slice(0,4).map(e=>(0,O.jsxs)(`li`,{className:`flex min-w-0 items-center gap-2 text-[11px] text-fg-muted`,children:[(0,O.jsx)(`span`,{className:`w-4 shrink-0 font-medium text-fg-subtle`,children:e.status===`added`?`+`:e.status===`deleted`?`−`:`•`}),(0,O.jsx)(`span`,{className:`truncate font-mono`,children:e.path})]},e.path))}):null,k.changedFileCount>4?(0,O.jsx)(`p`,{className:`mt-1 text-[10px] text-fg-subtle`,children:n?`还有 ${k.changedFileCount-4} 个文件`:`${k.changedFileCount-4} more files`}):null,(0,O.jsxs)(`div`,{className:`mt-3 border-t border-edge-subtle pt-3`,children:[(0,O.jsxs)(`p`,{className:`flex items-center gap-2 text-xs font-medium text-fg`,children:[(0,O.jsx)(`span`,{className:`size-2 rounded-full ${I===`healthy`?`bg-success`:I===`booting`?`bg-fg-subtle`:`bg-danger`}`}),n?`预览运行`:`Preview runtime`]}),(0,O.jsx)(`p`,{className:`mt-1 text-xs leading-5 ${I===`failed`||I===`timeout`?`text-danger`:`text-fg-muted`}`,children:R?be(R):I===`healthy`?n?`已成功启动,未发现未捕获异常。`:`Started successfully with no uncaught errors.`:I===`timeout`?n?`7 秒内未完成启动,可能出现白屏或阻塞。`:`Did not finish booting within 7 seconds.`:n?`正在等待应用启动。`:`Waiting for the app to start.`})]}),(0,O.jsxs)(`div`,{className:`mt-3 border-t border-edge-subtle pt-3`,children:[(0,O.jsxs)(`p`,{className:`flex items-center gap-2 text-xs font-medium text-fg`,children:[(0,O.jsx)(`span`,{className:`size-2 rounded-full ${Z?.status===`passed`?`bg-success`:Z?.status===`failed`?`bg-danger`:`bg-fg-subtle`}`}),n?`自动验收`:`Automatic acceptance`]}),Z?(0,O.jsx)(`ul`,{className:`mt-2 space-y-1.5`,children:Z.checks.map(e=>(0,O.jsxs)(`li`,{className:`flex items-start gap-2 text-[11px] leading-4 ${e.status===`failed`?`text-danger`:`text-fg-muted`}`,children:[(0,O.jsx)(`span`,{className:`mt-1 size-1.5 shrink-0 rounded-full ${e.status===`failed`?`bg-danger`:e.status===`passed`?`bg-success`:`bg-fg-subtle`}`}),(0,O.jsx)(`span`,{children:e.message})]},e.id))}):(0,O.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:k?.acceptanceScenarioCount?n?`正在检查页面基础质量和 ${k.acceptanceScenarioCount} 个产品场景。`:`Checking page quality and ${k.acceptanceScenarioCount} product scenario(s).`:n?`正在检查页面内容和基础交互。`:`Checking rendered content and basic interaction.`}),G?(0,O.jsxs)(`p`,{className:`mt-2 flex items-center gap-2 text-[11px] text-fg-muted`,children:[(0,O.jsx)(u,{className:`size-3 animate-spin`}),n?`正在保存当前源码对应的验收快照…`:`Saving the acceptance snapshot for this source…`]}):$?(0,O.jsx)(`p`,{className:`mt-2 text-[11px] leading-4 text-fg-muted`,children:Lt?n?`相比上次:已修复 ${Vt} 项,仍有 ${Rt.length} 项。`:`Since the previous run: ${Vt} fixed, ${Rt.length} remaining.`:n?`首个验收快照已保存。`:`First acceptance snapshot saved.`}):null,(0,O.jsx)(Ve,{scenarios:Y,results:B,runningTarget:mt,zh:n,onRunAll:Nt,onRunScenario:Pt,onAskCoder:Ft})]}),Bt?(0,O.jsxs)(w,{className:`mt-3 w-full`,onClick:Mt,disabled:P,children:[(0,O.jsx)(T,{className:`size-4`}),n?`让 Coder 修复`:`Ask Coder to fix`]}):null]}):(0,O.jsx)(re,{className:`mt-2 h-12 rounded-lg`})]}),(0,O.jsxs)(`div`,{className:`mt-5 border-t border-edge-subtle pt-4`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-semibold text-fg`,children:[(0,O.jsx)(oe,{className:`size-4 text-accent`}),n?`权限`:`Permissions`]}),(0,O.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:(k?.permissions??D.permissions).map(e=>(0,O.jsx)(`span`,{className:`rounded-md bg-surface-hover px-2 py-1 text-[11px] text-fg-muted`,children:e},e))})]}),(0,O.jsx)(w,{variant:`primary`,className:`mt-5 w-full`,onClick:()=>void Ht(),disabled:A||Ke||F||G||k?.status===`failed`||I!==`healthy`||Z?.status!==`passed`||!$||$.sourceHash!==k?.sourceHash||D.installationState===`installed`&&k?.hasDraftChanges===!1,children:D.installationState===`installed`?n?`安装当前更新`:`Install current update`:n?`添加到左侧导航`:`Add to sidebar`}),D.installationState===`installed`?(0,O.jsxs)(`div`,{className:`mt-2 flex gap-2`,children:[(0,O.jsxs)(w,{className:`min-w-0 flex-1`,onClick:()=>void Ot(!D.enabled),disabled:A,children:[D.enabled?(0,O.jsx)(Ie,{className:`size-4`}):(0,O.jsx)(d,{className:`size-4`}),D.enabled?n?`禁用`:`Disable`:n?`启用`:`Enable`]}),(0,O.jsx)(w,{variant:`ghost`,className:`text-danger hover:text-danger`,onClick:()=>nt(!0),disabled:A,"aria-label":n?`卸载应用`:`Uninstall app`,children:(0,O.jsx)(he,{className:`size-4`})})]}):null,(0,O.jsxs)(`div`,{className:`mt-6 border-t border-edge-subtle pt-4`,children:[(0,O.jsxs)(`h3`,{className:`flex items-center gap-2 text-xs font-semibold text-fg`,children:[(0,O.jsx)(Oe,{className:`size-4`}),n?`版本历史`:`Release history`]}),D.releases.length?(0,O.jsx)(`ul`,{className:`mt-2 divide-y divide-edge-subtle`,children:D.releases.map(e=>(0,O.jsxs)(`li`,{className:`flex items-center justify-between gap-3 py-2.5`,children:[(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-medium text-fg`,children:[`v`,e.version,e.isActive?(0,O.jsx)(`span`,{className:`rounded-full bg-success-soft px-1.5 py-0.5 text-[10px] text-success`,children:n?`当前`:`Active`}):null]}),(0,O.jsx)(`p`,{className:`mt-0.5 truncate text-[10px] text-fg-subtle`,children:Ue(e.createdAt,r)})]}),e.isActive?null:(0,O.jsxs)(w,{variant:`ghost`,className:`h-7 px-2 text-xs`,onClick:()=>void kt(e.id),disabled:A,children:[(0,O.jsx)(pe,{className:`size-3.5`}),n?`恢复`:`Restore`]})]},e.id))}):(0,O.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:n?`安装首个版本后,可以从这里恢复。`:`Install the first version to enable recovery.`})]}),Qe?(0,O.jsx)(`p`,{className:`mt-3 text-xs leading-5 text-danger`,role:`alert`,children:Qe}):null]}),(0,O.jsx)(x,{open:$e,onOpenChange:et,children:(0,O.jsxs)(v,{children:[(0,O.jsx)(h,{className:`xopc-dialog-overlay fixed inset-0 z-50 bg-scrim backdrop-blur-[2px]`}),(0,O.jsxs)(y,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-50 flex h-[min(560px,calc(100vh-32px))] w-[min(520px,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-2xl focus:outline-none`,children:[(0,O.jsxs)(`div`,{className:`flex items-start justify-between border-b border-edge-subtle p-5`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(b,{className:`text-base font-semibold text-fg`,children:n?`确认安装到 XOPC`:`Confirm installation`}),(0,O.jsx)(g,{className:`mt-1 text-sm text-fg-muted`,children:n?`当前草稿会成为左侧导航中的可用版本。`:`The current draft will become the version available in the sidebar.`})]}),(0,O.jsx)(_,{className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover`,children:(0,O.jsx)(f,{className:`size-4`})})]}),(0,O.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,O.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-panel p-4`,children:[(0,O.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:D.name}),(0,O.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:D.extensionId})]}),(0,O.jsx)(`h4`,{className:`mt-5 text-xs font-semibold text-fg`,children:n?`本次迭代`:`This iteration`}),(0,O.jsxs)(`dl`,{className:`mt-2 grid grid-cols-2 gap-3 text-xs`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`dt`,{className:`text-fg-subtle`,children:n?`文件变化`:`Changed files`}),(0,O.jsx)(`dd`,{className:`mt-1 font-medium text-fg`,children:k?.changedFileCount??0})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`dt`,{className:`text-fg-subtle`,children:n?`自动验收`:`Acceptance`}),(0,O.jsxs)(`dd`,{className:`mt-1 flex items-center gap-1.5 font-medium text-success`,children:[(0,O.jsx)(ee,{className:`size-3.5`}),n?`已通过并保存`:`Passed and saved`]})]})]}),k?.changedFiles.length?(0,O.jsx)(`ul`,{className:`mt-3 space-y-1`,children:k.changedFiles.slice(0,5).map(e=>(0,O.jsxs)(`li`,{className:`flex min-w-0 items-center gap-2 text-[11px] text-fg-muted`,children:[(0,O.jsx)(`span`,{className:`w-4 shrink-0 font-medium text-fg-subtle`,children:e.status===`added`?`+`:e.status===`deleted`?`−`:`•`}),(0,O.jsx)(`span`,{className:`truncate font-mono`,children:e.path})]},e.path))}):null,(0,O.jsx)(`h4`,{className:`mt-5 text-xs font-semibold text-fg`,children:n?`请求权限`:`Requested permissions`}),(0,O.jsx)(`ul`,{className:`mt-2 space-y-2`,children:(k?.permissions??D.permissions).map(e=>(0,O.jsxs)(`li`,{className:`flex items-center gap-2 text-sm text-fg`,children:[(0,O.jsx)(c,{className:`size-4 text-success`}),e,D.installationState===`installed`&&k?.permissionDelta.added.includes(e)?(0,O.jsx)(`span`,{className:`rounded-full bg-warning-soft px-2 py-0.5 text-[10px] text-warning`,children:n?`新增`:`New`}):null]},e))}),D.installationState===`installed`&&k?.permissionDelta.added.length?(0,O.jsx)(`p`,{className:`mt-4 rounded-xl bg-warning-soft p-3 text-xs leading-5 text-warning`,children:n?`此更新增加了权限,请确认这些能力符合你的修改意图。`:`This update adds permissions. Confirm they match the change you requested.`}):null,(0,O.jsx)(`p`,{className:`mt-5 rounded-xl bg-accent-soft p-3 text-xs leading-5 text-accent-fg`,children:n?`Phase 1 应用只能使用界面主题和本地存储,不能访问网络或运行系统命令。`:`Phase 1 apps can use theme and local storage only. They cannot access the network or run system commands.`})]}),(0,O.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge-subtle p-4`,children:[(0,O.jsx)(_,{asChild:!0,children:(0,O.jsx)(w,{children:n?`取消`:`Cancel`})}),(0,O.jsxs)(w,{variant:`primary`,onClick:()=>void Et(),disabled:A,children:[A?(0,O.jsx)(u,{className:`size-4 animate-spin`}):(0,O.jsx)(te,{className:`size-4`}),n?`确认安装`:`Install`]})]})]})]})}),(0,O.jsx)(x,{open:tt,onOpenChange:nt,children:(0,O.jsxs)(v,{children:[(0,O.jsx)(h,{className:`xopc-dialog-overlay fixed inset-0 z-50 bg-scrim backdrop-blur-[2px]`}),(0,O.jsxs)(y,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-50 flex h-[min(420px,calc(100vh-32px))] w-[min(500px,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-2xl focus:outline-none`,children:[(0,O.jsxs)(`div`,{className:`flex items-start justify-between border-b border-edge-subtle p-5`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(b,{className:`text-base font-semibold text-fg`,children:n?`卸载当前应用?`:`Uninstall this app?`}),(0,O.jsx)(g,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:n?`应用会从侧栏移除,但 Project、源码、版本历史和本地数据都会保留。`:`The app leaves the sidebar, while its Project, source, release history, and local data remain.`})]}),(0,O.jsx)(_,{className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover`,children:(0,O.jsx)(f,{className:`size-4`})})]}),(0,O.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:(0,O.jsxs)(`div`,{className:`rounded-xl bg-surface-panel p-4`,children:[(0,O.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:D.name}),(0,O.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n?`之后可从任意保留版本重新安装。`:`You can reinstall any retained release later.`})]})}),(0,O.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge-subtle p-4`,children:[(0,O.jsx)(_,{asChild:!0,children:(0,O.jsx)(w,{children:n?`取消`:`Cancel`})}),(0,O.jsxs)(w,{variant:`ghost`,className:`text-danger hover:bg-danger-soft hover:text-danger`,onClick:()=>void At(),disabled:A,children:[A?(0,O.jsx)(u,{className:`size-4 animate-spin`}):(0,O.jsx)(he,{className:`size-4`}),n?`卸载但保留 Project`:`Uninstall and keep Project`]})]})]})]})})]})}export{Ge as LocalAppWorkbenchPage};
@@ -1 +0,0 @@
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-BMYIfy9x.js";import{t as a}from"./box-DvYoGszj.js";import{t as o}from"./plus-Q2yW6OE7.js";import{n as s}from"./locale-store-BSkKhYkc.js";import{i as c}from"./vendor-swr-BIWyz7Rc.js";import{t as l}from"./button-CS04eWY9.js";import{t as u}from"./skeleton-BwbyijEw.js";import{Dr as d,Eo as f,Ql as p}from"./index-Cr4SINLG.js";var m=n(),h=e(t(),1),g=r();function _(){let e=(0,m.c)(20),t=s(x)===`zh`,n=f(b),r=f(y),{data:u,isLoading:_,error:S}=c(`local-apps-list`,d),C,w;e[0]!==r||e[1]!==n||e[2]!==t?(C=()=>(n({startExtra:null,main:(0,g.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t?`应用工坊`:`App Workshop`}),end:(0,g.jsx)(l,{asChild:!0,variant:`primary`,className:`h-9`,children:(0,g.jsxs)(i,{to:`/local-apps/new`,children:[(0,g.jsx)(o,{className:`size-4`}),t?`创建应用`:`Create app`]})})}),()=>r()),w=[r,n,t],e[0]=r,e[1]=n,e[2]=t,e[3]=C,e[4]=w):(C=e[3],w=e[4]),(0,h.useLayoutEffect)(C,w);let T=t?`把自己的工具放进 XOPC`:`Put your own tools inside XOPC`,E;e[5]===T?E=e[6]:(E=(0,g.jsx)(`h2`,{className:`text-2xl font-semibold tracking-tight text-fg`,children:T}),e[5]=T,e[6]=E);let D=t?`每个应用都会自动创建一个由 Coder 负责的 Project,可预览、安装到侧栏,并持续迭代。`:`Every app gets a Coder-owned Project for previewing, installing in the sidebar, and ongoing iteration.`,O;e[7]===D?O=e[8]:(O=(0,g.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:D}),e[7]=D,e[8]=O);let k;e[9]!==E||e[10]!==O?(k=(0,g.jsxs)(`div`,{className:`mb-7 max-w-2xl`,children:[E,O]}),e[9]=E,e[10]=O,e[11]=k):k=e[11];let A;e[12]!==u||e[13]!==S||e[14]!==_||e[15]!==t?(A=_?(0,g.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:Array.from({length:3}).map(v)}):S?(0,g.jsx)(`p`,{className:`rounded-xl border border-danger/30 bg-danger-soft p-4 text-sm text-danger`,children:S instanceof Error?S.message:String(S)}):u?.length?(0,g.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:u.map(e=>(0,g.jsxs)(i,{to:`/local-apps/${encodeURIComponent(e.id)}`,className:`group flex min-h-44 flex-col rounded-xl border border-edge-subtle bg-surface-base p-4 shadow-surface transition-colors hover:bg-surface-hover/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,g.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,g.jsx)(`div`,{className:`flex size-10 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,g.jsx)(a,{className:`size-5`})}),(0,g.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:e.installationState===`not_installed`?t?`草稿`:`Draft`:e.enabled?t?`已在侧栏`:`In sidebar`:t?`已禁用`:`Disabled`})]}),(0,g.jsx)(`h3`,{className:`mt-4 truncate text-sm font-semibold text-fg`,children:e.name}),(0,g.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description||e.idea}),(0,g.jsxs)(`div`,{className:`mt-auto flex items-center justify-end pt-3 text-xs font-medium text-accent`,children:[t?`打开工作台`:`Open workbench`,(0,g.jsx)(p,{className:`ml-1 size-3.5 transition-transform group-hover:translate-x-0.5`})]})]},e.id))}):(0,g.jsxs)(`div`,{className:`px-6 py-16 text-center`,children:[(0,g.jsx)(a,{className:`mx-auto size-8 text-fg-subtle`}),(0,g.jsx)(`h3`,{className:`mt-4 text-sm font-semibold text-fg`,children:t?`还没有本地应用`:`No local apps yet`}),(0,g.jsx)(`p`,{className:`mx-auto mt-2 max-w-md text-sm text-fg-muted`,children:t?`描述你想解决的问题,XOPC 会创建应用骨架和可持续开发的 Project。`:`Describe the problem and XOPC will create an app scaffold and an ongoing Project.`}),(0,g.jsx)(l,{asChild:!0,variant:`primary`,className:`mt-5`,children:(0,g.jsxs)(i,{to:`/local-apps/new`,children:[(0,g.jsx)(o,{className:`size-4`}),t?`创建第一个应用`:`Create your first app`]})})]}),e[12]=u,e[13]=S,e[14]=_,e[15]=t,e[16]=A):A=e[16];let j;return e[17]!==k||e[18]!==A?(j=(0,g.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto bg-surface-panel px-3 py-8 sm:px-5 xl:px-6`,children:(0,g.jsxs)(`div`,{className:`mx-auto max-w-6xl`,children:[k,A]})}),e[17]=k,e[18]=A,e[19]=j):j=e[19],j}function v(e,t){return(0,g.jsx)(u,{className:`h-44 rounded-xl`},t)}function y(e){return e.clearPageHeader}function b(e){return e.setPageHeader}function x(e){return e.language}export{_ as LocalAppsPage};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./messages-D0G_sZvA.js";var r=e(t(),1),i=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},a=(e=>e?i(e):i),o=e=>e;function s(e,t=o){let n=r.useSyncExternalStore(e.subscribe,r.useCallback(()=>t(e.getState()),[e,t]),r.useCallback(()=>t(e.getInitialState()),[e,t]));return r.useDebugValue(n),n}var c=e=>{let t=a(e),n=e=>s(t,e);return Object.assign(n,t),n},l=(e=>e?c(e):c);function u(e){let t=(e??``).trim().toLowerCase().replace(/_/g,`-`);return t&&(t===`zh`||t.startsWith(`zh-`))?`zh`:`en`}function d(){if(typeof navigator>`u`)return`en`;let e=(navigator.language||navigator.languages?.[0]||``).trim();return e?u(e):`en`}function f(e){return e===`zh`?`zh-CN`:`en`}function p(e){document.documentElement.setAttribute(`lang`,f(e)),document.title=n(e).appTitle}function m(){return K.getState().language}function h(e,t,n){let r=e.trim().toLowerCase();return!!(!r||r===`http ${t}`||n&&r===n.trim().toLowerCase()||t===429&&(r===`rate_limited`||r===`too many requests`||r===`too many authentication attempts`)||t===500&&r===`internal server error`)}function g(e,t,r){let i=r?.trim()??``;if(i&&!h(i,e,t))return i;let a=n(m()).api;return e>=500?e===502?a.errorBadGateway:e===503?a.errorServiceUnavailable:e===504?a.errorGatewayTimeout:e===500?a.errorInternal:a.errorServer.replace(`{{status}}`,String(e)):e===404?a.errorNotFound:e===403?a.errorForbidden:e===429?a.errorRateLimited:a.errorRequest.replace(`{{status}}`,String(e))}var _=`xopc.token`,v=`xopc.language`;function y(){try{return localStorage.getItem(_)||``}catch{return``}}function b(){try{localStorage.removeItem(_)}catch{}}function x(){return S()||d()}function S(){try{let e=localStorage.getItem(v);return e===`en`||e===`zh`?e:null}catch{return null}}function C(e){try{localStorage.setItem(v,e)}catch(e){console.error(`Failed to save language:`,e)}}var w=l(e=>({baseUrl:typeof window<`u`?window.location.origin:``,conversationId:void 0,tokenDialogOpen:!1,tokenExpired:!1,setBrowserSession:t=>{b(),e({conversationId:t,tokenDialogOpen:!1,tokenExpired:!1}),window.dispatchEvent(new CustomEvent(`gateway-authenticated`))},clearBrowserSession:()=>{fetch(`/api/browser-session`,{method:`DELETE`,credentials:`same-origin`,redirect:`error`,signal:AbortSignal.timeout(8e3)}).catch(()=>{}),e({conversationId:void 0})},openTokenDialog:()=>e({tokenDialogOpen:!0}),closeTokenDialog:()=>e({tokenDialogOpen:!1}),onUnauthorized:()=>{e({conversationId:void 0,tokenDialogOpen:!1,tokenExpired:!0}),window.dispatchEvent(new CustomEvent(`gateway-auth-expired`))}}));async function T(e){return fetch(`/api/browser-session`,{method:`POST`,credentials:`same-origin`,redirect:`error`,signal:AbortSignal.timeout(8e3),headers:{Authorization:`Bearer ${e}`}})}async function E(){try{let e=await fetch(`/api/browser-session`,{credentials:`same-origin`,redirect:`error`,signal:AbortSignal.timeout(8e3)});if(e.ok){let t=await e.json();if(t.conversationId){w.getState().setBrowserSession(t.conversationId);return}}if(e.status!==401)return;let t=window.electronAPI?.gateway?.getCredential,n=typeof t==`function`?await t():y();if(!n)return;let r=await T(n);if(!r.ok)return;let i=await r.json();i.conversationId&&w.getState().setBrowserSession(i.conversationId)}catch{}}var D=null,O=null;function k(){D||=new Promise(e=>{O=e})}function A(){D&&(O?.(),D=null,O=null)}typeof window<`u`&&window.addEventListener(`gateway-authenticated`,A);async function j(e,t){D&&await D;let n=new Headers(t?.headers),r=t?.body,i=typeof FormData<`u`&&r instanceof FormData;!n.has(`Content-Type`)&&!i&&n.set(`Content-Type`,`application/json`);let a=await fetch(e,{...t,credentials:`same-origin`,redirect:`error`,headers:n});return a.status===401&&(k(),w.getState().onUnauthorized()),a}async function M(e,t){let n=await j(e,t);if(!n.ok){let e=await n.json().catch(()=>({})),t=typeof e.error==`string`?e.error:e.error?.message,r=g(n.status,n.statusText,t),i=n.headers.get(`Retry-After`),a=i==null?NaN:Number(i);throw Object.assign(Error(r),{status:n.status,body:e,...Number.isFinite(a)&&a>=0?{retryAfterMs:a*1e3}:{}})}return n.json()}function N(){return window.location.origin}function P(e){let t=e.startsWith(`/`)?e:`/${e}`;return`${N()}${t}`}var F,I,L,R;function z(e){return e===`en`||e===`zh`}function B(e){C(e),p(e)}function V(e){window.electronAPI?.locale?.setLanguage(e).catch(()=>{})}function H(e,t){return e?.token===t.token&&e.language===t.language}async function U(){for(;I;){let e=I;I=void 0,F=e,(await Promise.allSettled([M(P(`/api/voice/language`),{method:`POST`,body:JSON.stringify({language:e.language})}),M(P(`/api/user-model/assertions`),{method:`POST`,body:JSON.stringify({scope:{type:`global`},subject:{type:`user`,id:`self`},predicate:`preference.locale`,cardinality:`single`,kind:`preference`,value:e.language===`zh`?`zh-CN`:`en`,statement:e.language===`zh`?`The user prefers Chinese.`:`The user prefers English.`,volatility:`slow`,declaredImportance:.8})})])).every(e=>e.status===`fulfilled`)&&(L=e),F=void 0}}function W(){R||=U().finally(()=>{R=void 0,I&&W()})}function G(e){let t=w.getState().conversationId;if(!t)return;let n={token:t,language:e};if(H(F,n)){I=void 0;return}H(I,n)||!F&&H(L,n)||(I=n,W())}var K=l(e=>({language:x(),setLanguage:t=>{B(t),e({language:t}),V(t),G(t)}}));function q(){G(K.getState().language);let e=w.subscribe((e,t)=>{e.conversationId&&e.conversationId!==t.conversationId&&G(K.getState().language)}),t=window.electronAPI?.locale;if(!t)return e;let n=!1,r=S();r?V(r):t.getLanguage().then(e=>{n||!z(e)||(B(e),K.setState({language:e}),G(e))});let i=t.onChanged(e=>{n||!z(e)||(B(e),K.setState({language:e}),G(e))});return()=>{n=!0,i(),e()}}export{M as a,w as c,p as d,f,j as i,x as l,K as n,T as o,l as p,P as r,E as s,q as t,g as u};
@@ -1 +0,0 @@
1
- import{t as e}from"./createLucideIcon-DPHK1VkS.js";var t=e(`lock-keyhole`,[[`circle`,{cx:`12`,cy:`16`,r:`1`,key:`1au0dj`}],[`rect`,{x:`3`,y:`10`,width:`18`,height:`12`,rx:`2`,key:`6s8ecr`}],[`path`,{d:`M7 10V7a5 5 0 0 1 10 0v3`,key:`1pqi11`}]]);export{t};
@@ -1,2 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{g as i}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as a}from"./createLucideIcon-DPHK1VkS.js";import{n as o,r as s}from"./popover-select-DcsFzD_i.js";import{t as c}from"./download-Dk-ZjtO6.js";import{t as l}from"./gauge-C78eD2BA.js";import{t as u}from"./search-DA7gz22f.js";import{t as d}from"./x-B_N4OPjy.js";import{t as f}from"./messages-D0G_sZvA.js";import{t as p}from"./cn-JdwAhgNB.js";import{a as m,c as h,n as g,r as _}from"./locale-store-BSkKhYkc.js";import{a as v,n as y,o as b,r as x,s as S,t as C}from"./dist-BGTk37IG.js";import{t as w}from"./copy-to-clipboard-HOJ79TWv.js";import{t as T}from"./button-CS04eWY9.js";import{a as E,i as D,o as O,r as k}from"./dist-3h6cXXhT.js";import{t as A}from"./skeleton-BwbyijEw.js";import{i as j,o as M,s as N}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{Ia as P,Kt as F,Oa as I,Pl as L,Qo as R,Tl as z,Wl as B,Xo as ee,bl as V,jc as H,no as U,qc as W}from"./index-Cr4SINLG.js";import{r as te}from"./settings-page-layout-X1x-2Cp9.js";var G=a(`list-filter`,[[`path`,{d:`M2 5h20`,key:`1fs1ex`}],[`path`,{d:`M6 12h12`,key:`8npq4p`}],[`path`,{d:`M9 19h6`,key:`456am0`}]]),K=e(t(),1),q=n();function J(e){let t=new URLSearchParams;if(!e)return``;e.level?.length&&t.set(`level`,e.level.join(`,`)),e.from&&t.set(`from`,e.from),e.to&&t.set(`to`,e.to),e.q&&t.set(`q`,e.q),e.module&&t.set(`module`,e.module),e.requestId&&t.set(`requestId`,e.requestId),e.conversationId&&t.set(`conversationId`,e.conversationId),e.transcriptId&&t.set(`transcriptId`,e.transcriptId),e.limit!=null&&t.set(`limit`,String(e.limit)),e.offset!=null&&t.set(`offset`,String(e.offset));let n=t.toString();return n?`?${n}`:``}async function Y(e){return m(_(`/api/logs${J(e)}`))}async function X(){return(await m(_(`/api/logs/files`))).files??[]}async function Z(){return(await m(_(`/api/logs/modules`))).modules??[]}async function Q(){let e=await m(_(`/api/logs/stats`));return{byLevel:e.byLevel??{},runtime:e.runtime}}async function ne(){return(await m(_(`/api/logs/dir`))).dir??``}async function re(){return(await m(_(`/api/logs/level`))).level??`info`}async function ie(e,t){return m(_(`/api/logs/level`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({level:e,...t==null?{}:{duration:String(t)}})})}async function ae(e){let t=new URLSearchParams;e?.from&&t.set(`from`,e.from),e?.to&&t.set(`to`,e.to),e?.limit!=null&&t.set(`limit`,String(e.limit));let n=t.toString();return(await m(_(`/api/logs/errors/summary${n?`?${n}`:``}`))).items??[]}var oe=500,se=class{_callbacks;_cleanup;constructor(e){this._callbacks=e}connect(e,t){this.disconnect();let n=new Set(e?.length?e:[`trace`,`debug`,`info`,`warn`,`error`,`fatal`]);this._cleanup=P(`logs`,{onEvent:e=>{if(e.event!==`log.entry`||!e.data||typeof e.data!=`object`)return;let r=e.data;!n.has(r.level)||t&&r.module!==t||this._callbacks.onEntry(r)},onGap:()=>this._callbacks.onError(`Live log replay gap; refresh the log query`)}),this._callbacks.onConnected()}disconnect(){this._cleanup?.(),this._cleanup=void 0}};function ce(e,t){let n=`${t.timestamp}-${t.requestId??``}-${t.message}`;return[t,...e.filter(e=>`${e.timestamp}-${e.requestId??``}-${e.message}`!==n)].slice(0,oe)}var le=[`trace`,`debug`,`info`,`warn`,`error`,`fatal`];function ue(e){let t=new Date(String(e.timestamp)).getTime();return Number.isFinite(t)?t:0}function de(e){return e.toSorted((e,t)=>ue(t)-ue(e))}var fe=new Set(le),pe=[`error`,`fatal`],me=[`warn`,`error`,`fatal`],he=[`info`,`warn`,`error`,`fatal`];function ge(e){if(!e)return new Set;let t=new Set;for(let n of e.split(`,`)){let e=n.trim();fe.has(e)&&t.add(e)}return t}function _e(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function ve(e,t){return e.size===t.length?t.every(t=>e.has(t)):!1}function ye(e){return e.size===0?`all`:ve(e,pe)?`errors`:ve(e,me)?`warnPlus`:ve(e,he)?`infoPlus`:e.size===le.length&&le.every(t=>e.has(t))?`verbose`:`custom`}function be(e){let t=ye(e);return t===`custom`?`other`:t}function xe(e){switch(e){case`all`:return new Set;case`errors`:return new Set(pe);case`warnPlus`:return new Set(me);case`infoPlus`:return new Set(he);case`verbose`:return new Set(le)}}function Se(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function Ce(e){return String(e.module||e.service||e.extension||`—`)}function we(e){if(typeof e.message==`string`&&e.message)return e.message;try{return JSON.stringify(e)}catch{return``}}function Te(e){try{return new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}catch{return e}}function Ee(e){try{return new Date(e).toLocaleString()}catch{return e}}function De(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Oe(e){let t=e.trim();return t.length<=10?t:`${t.slice(0,8)}…`}function ke(e){return String(e).toLowerCase()}function Ae(e){let t=e.phase??e.meta?.phase;return typeof t==`string`&&t.trim()?t:`—`}function je(e){return`${e.timestamp}-${e.requestId??``}-${e.message}`}function Me(e){let t=e.err??e.meta?.err;if(!t||typeof t!=`object`)return null;let n=t;return{name:typeof n.name==`string`?n.name:void 0,message:typeof n.message==`string`?n.message:void 0,stack:typeof n.stack==`string`?n.stack:void 0}}function Ne(e,t){if(t.selectedLevels.size>0&&!t.selectedLevels.has(e.level)||t.moduleFilter&&Ce(e)!==t.moduleFilter||t.requestIdFilter&&e.requestId!==t.requestIdFilter||t.transcriptIdFilter&&e.transcriptId!==t.transcriptIdFilter&&e.conversationId!==t.transcriptIdFilter)return!1;if(t.dateFrom){let n=new Date(t.dateFrom).getTime(),r=new Date(String(e.timestamp)).getTime();if(Number.isFinite(n)&&Number.isFinite(r)&&r<n)return!1}if(t.dateTo){let n=new Date(t.dateTo).getTime(),r=new Date(String(e.timestamp)).getTime();if(Number.isFinite(n)&&Number.isFinite(r)&&r>n)return!1}if(t.debouncedSearch){let n=t.debouncedSearch.toLowerCase();if(![e.message,Ce(e),Ae(e),e.requestId,e.conversationId,e.transcriptId,Me(e)?.message,Me(e)?.stack].filter(Boolean).map(String).join(` `).toLowerCase().includes(n))return!1}return!0}function Pe(e,t){let n=[];for(let r of le){let i=e[r]??0;i>0&&n.push(`${t[r]} ${i}`)}return n.join(` · `)}function Fe(e,t){switch(t.type){case`setSearchInput`:return e.searchInput===t.value?e:{...e,searchInput:t.value};case`setDebouncedSearch`:return e.debouncedSearch===t.value?e:{...e,debouncedSearch:t.value};case`setLevels`:return _e(e.selectedLevels,t.value)?e:{...e,selectedLevels:t.value};case`toggleLevel`:{let n=new Set(e.selectedLevels);return n.has(t.level)?n.delete(t.level):n.add(t.level),{...e,selectedLevels:n}}case`setModule`:return e.moduleFilter===t.value?e:{...e,moduleFilter:t.value};case`setRequestIdFilter`:return e.requestIdFilter===t.value?e:{...e,requestIdFilter:t.value};case`setTranscriptIdFilter`:return e.transcriptIdFilter===t.value?e:{...e,transcriptIdFilter:t.value};case`setDateFrom`:return e.dateFrom===t.value?e:{...e,dateFrom:t.value};case`setDateTo`:return e.dateTo===t.value?e:{...e,dateTo:t.value};case`setAutoRefresh`:return e.autoRefresh===t.value?e:{...e,autoRefresh:t.value};case`syncFromUrl`:{let n=t.payload;return e.searchInput===n.searchInput&&e.debouncedSearch===n.debouncedSearch&&_e(e.selectedLevels,n.selectedLevels)&&e.moduleFilter===n.moduleFilter&&e.requestIdFilter===n.requestIdFilter&&e.transcriptIdFilter===n.transcriptIdFilter&&e.dateFrom===n.dateFrom&&e.dateTo===n.dateTo&&e.autoRefresh===n.autoRefresh?e:{...e,...n}}case`clearAll`:return{searchInput:``,debouncedSearch:``,selectedLevels:new Set,moduleFilter:``,requestIdFilter:``,transcriptIdFilter:``,dateFrom:``,dateTo:``,autoRefresh:e.autoRefresh}}}var Ie={logs:[],loading:!1,error:null,hasMore:!1,modules:[],files:[],stats:null,logDir:null};function Le(e,t){switch(t.type){case`queryStart`:return{...e,loading:!0,error:null,logs:[]};case`querySuccess`:return{...e,loading:!1,logs:de(t.logs),hasMore:t.hasMore};case`queryError`:return t.resetLogs?{...e,loading:!1,error:t.message,logs:[],hasMore:!1}:{...e,loading:!1,error:t.message};case`appendSuccess`:return{...e,loading:!1,logs:de([...e.logs,...t.logs]),hasMore:t.hasMore};case`metaSuccess`:return{...e,modules:t.modules,stats:t.stats,files:t.files};case`filesSuccess`:return{...e,files:t.files,logDir:t.logDir};case`filesClear`:return{...e,files:[]};case`liveTick`:return{...e,logs:de(t.logs),hasMore:t.hasMore,stats:t.stats};case`appendLiveEntry`:return{...e,logs:de(ce(e.logs,t.entry))};case`updateStats`:return{...e,stats:t.stats};case`refreshAllSuccess`:return{...e,loading:!1,logs:de(t.logs),hasMore:t.hasMore,stats:t.stats,files:t.files}}}function Re(e){let t=f(e).logs,n=h(e=>e.conversationId),r=!!n,[a,o]=i(),s=(0,K.useRef)(a),[c,l]=(0,K.useReducer)(Fe,void 0,()=>{let e=s.current,t=e.get(`q`)??``;return{searchInput:t,debouncedSearch:t.trim(),selectedLevels:ge(e.get(`level`)),moduleFilter:e.get(`module`)??``,requestIdFilter:e.get(`requestId`)??``,transcriptIdFilter:e.get(`transcriptId`)??``,dateFrom:e.get(`from`)??``,dateTo:e.get(`to`)??``,autoRefresh:e.get(`live`)===`1`}}),[u,d]=(0,K.useReducer)(Le,Ie),[p,m]=(0,K.useState)(null),[g,_]=(0,K.useState)(!1),[v,y]=(0,K.useState)(!1),[b,x]=(0,K.useState)(null),[S,C]=(0,K.useState)([]),[w,T]=(0,K.useState)(!1),{searchInput:E,debouncedSearch:D,selectedLevels:O,moduleFilter:k,requestIdFilter:A,transcriptIdFilter:j,dateFrom:M,dateTo:N,autoRefresh:P}=c,{logs:F,loading:I,error:L,hasMore:R,modules:z,files:B,stats:ee,logDir:V}=u,H=(0,K.useCallback)(e=>l({type:`setSearchInput`,value:e}),[]),W=(0,K.useCallback)(e=>l({type:`setLevels`,value:e}),[]),te=(0,K.useCallback)(e=>l({type:`setModule`,value:e}),[]),G=(0,K.useCallback)(e=>l({type:`setRequestIdFilter`,value:e}),[]),q=(0,K.useCallback)(e=>l({type:`setTranscriptIdFilter`,value:e}),[]),J=(0,K.useCallback)(e=>l({type:`setDateFrom`,value:e}),[]),re=(0,K.useCallback)(e=>l({type:`setDateTo`,value:e}),[]),ie=(0,K.useCallback)(e=>l({type:`setAutoRefresh`,value:e}),[]),oe=(0,K.useMemo)(()=>be(O),[O]),ce=e=>{if(e===`other`){y(!0);return}l({type:`setLevels`,value:xe(e)})},le=D.length>0||O.size>0||!!k||!!A||!!j||!!M||!!N,ue=+(D.length>0)+ +(O.size>0)+ +!!k+ +!!A+ +!!j+(M||N?1:0);(0,K.useEffect)(()=>{let e=setTimeout(()=>l({type:`setDebouncedSearch`,value:E.trim()}),300);return()=>clearTimeout(e)},[E]),(0,K.useEffect)(()=>{let e=a.get(`q`)??``;l({type:`syncFromUrl`,payload:{searchInput:e,debouncedSearch:e.trim(),selectedLevels:ge(a.get(`level`)),moduleFilter:a.get(`module`)??``,requestIdFilter:a.get(`requestId`)??``,transcriptIdFilter:a.get(`transcriptId`)??``,dateFrom:a.get(`from`)??``,dateTo:a.get(`to`)??``,autoRefresh:a.get(`live`)===`1`}})},[a]),(0,K.useEffect)(()=>{let e=new URLSearchParams(a),t=D.trim();t?e.set(`q`,t):e.delete(`q`),O.size>0?e.set(`level`,Array.from(O).sort().join(`,`)):e.delete(`level`),k?e.set(`module`,k):e.delete(`module`),A?e.set(`requestId`,A):e.delete(`requestId`),j?e.set(`transcriptId`,j):e.delete(`transcriptId`),M?e.set(`from`,M):e.delete(`from`),N?e.set(`to`,N):e.delete(`to`),P?e.set(`live`,`1`):e.delete(`live`),e.toString()!==a.toString()&&o(e,{replace:!0})},[P,M,N,D,k,A,j,a,O,o]);let de=(0,K.useMemo)(()=>({q:D||void 0,level:O.size>0?Array.from(O):void 0,module:k||void 0,requestId:A||void 0,transcriptId:j||void 0,from:M||void 0,to:N||void 0,limit:50}),[D,O,k,A,j,M,N]),fe=(0,K.useMemo)(()=>({debouncedSearch:D,selectedLevels:O,moduleFilter:k,requestIdFilter:A,transcriptIdFilter:j,dateFrom:M,dateTo:N}),[D,O,k,A,j,M,N]),pe=(0,K.useRef)(fe);return pe.current=fe,(0,K.useEffect)(()=>{if(!r)return;let e=!1;return T(!0),ae({from:M||void 0,to:N||void 0,limit:12}).then(t=>{e||C(t)}).catch(()=>{e||C([])}).finally(()=>{e||T(!1)}),()=>{e=!0}},[r,M,N]),(0,K.useEffect)(()=>{if(!r)return;let e=!1;return d({type:`queryStart`}),(async()=>{try{let t=await Y({...de,offset:0});if(e)return;d({type:`querySuccess`,logs:t.logs,hasMore:t.logs.length===50})}catch(n){e||d({type:`queryError`,message:n instanceof Error?n.message:t.loadError,resetLogs:!0})}})(),()=>{e=!0}},[r,de,t.loadError]),(0,K.useEffect)(()=>{if(!r)return;let e=!1;return(async()=>{try{let[t,n,r]=await Promise.all([Z(),Q(),X()]);e||d({type:`metaSuccess`,modules:t,stats:n,files:r})}catch{}})(),()=>{e=!0}},[r]),(0,K.useEffect)(()=>{if(!r||!g)return;let e=!1;return(async()=>{try{let[t,n]=await Promise.all([X(),ne()]);e||d({type:`filesSuccess`,files:t,logDir:n})}catch{e||d({type:`filesClear`})}})(),()=>{e=!0}},[r,g]),(0,K.useEffect)(()=>{if(!P||!r)return;let e=new se({onConnected:()=>{},onEntry:e=>{Ne(e,pe.current)&&d({type:`appendLiveEntry`,entry:e})},onError:()=>{}});e.connect(O.size>0?Array.from(O):void 0,k||void 0);let t=window.setInterval(()=>{Q().then(e=>{d({type:`updateStats`,stats:e})}).catch(()=>{})},3e4);return()=>{e.disconnect(),clearInterval(t)}},[P,r,n,O,k]),(0,K.useEffect)(()=>{if(!b)return;let e=window.setTimeout(()=>x(null),2e3);return()=>clearTimeout(e)},[b]),{L:t,hasToken:r,logs:F,loading:I,error:L,hasMore:R,searchInput:E,setSearchInput:H,selectedLevels:O,setSelectedLevels:W,moduleFilter:k,setModuleFilter:te,requestIdFilter:A,transcriptIdFilter:j,dateFrom:M,setDateFrom:J,dateTo:N,setDateTo:re,modules:z,files:B,stats:ee,selectedLog:p,setSelectedLog:m,filesOpen:g,setFilesOpen:_,filtersOpen:v,setFiltersOpen:y,logDir:V,autoRefresh:P,setAutoRefresh:ie,copiedDetail:b,setCopiedDetail:x,hasActiveFilters:le,activeFilterCount:ue,clearFilters:()=>l({type:`clearAll`}),toggleDialogLevel:e=>l({type:`toggleLevel`,level:e}),handleLoadMore:()=>{I||!R||(async()=>{d({type:`queryStart`});try{let e=await Y({...de,offset:F.length});d({type:`appendSuccess`,logs:e.logs,hasMore:e.logs.length===50})}catch(e){d({type:`queryError`,message:e instanceof Error?e.message:t.loadError})}})()},refreshAll:()=>{(async()=>{d({type:`queryStart`});try{let e=await Y({...de,offset:0}),[t,n]=await Promise.all([Q(),X()]);d({type:`refreshAllSuccess`,logs:e.logs,hasMore:e.logs.length===50,stats:t,files:n})}catch(e){d({type:`queryError`,message:e instanceof Error?e.message:t.loadError})}})()},levelSegment:oe,handleLevelSegment:ce,filterByRequestId:(0,K.useCallback)(e=>{m(null),G(e)},[G]),filterByTranscriptId:(0,K.useCallback)(e=>{m(null),q(e)},[q]),filterByErrorSummary:(0,K.useCallback)(e=>{l({type:`setSearchInput`,value:e.errName}),l({type:`setDebouncedSearch`,value:e.errName}),e.module&&l({type:`setModule`,value:e.module}),l({type:`setLevels`,value:xe(`errors`)})},[]),openChatForSession:(0,K.useCallback)(e=>{let t=e.conversationId?.trim();if(t){window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{conversationId:t}}));return}let n=e.transcriptId?.trim();n&&U({transcriptId:n}).then(e=>{window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{conversationId:e.conversationId}}))}).catch(()=>{})},[]),errorSummary:S,errorSummaryLoading:w}}var $=r();function ze(e){let t=(0,q.c)(36),{L:n,items:r,loading:i,onSelectItem:a}=e,[o,s]=(0,K.useState)(!1);if(!i&&r.length===0)return null;let c;t[0]===r?c=t[1]:(c=r.reduce(Ve,0),t[0]=r,t[1]=c);let l=c,u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>s(Be),t[2]=u):u=t[2];let d;t[3]===n.errorSummaryTitle?d=t[4]:(d=(0,$.jsx)(`h2`,{className:`text-sm font-semibold tracking-tight text-fg`,children:n.errorSummaryTitle}),t[3]=n.errorSummaryTitle,t[4]=d);let f;t[5]===n.errorSummaryHint?f=t[6]:(f=(0,$.jsx)(`p`,{className:`mt-0.5 text-xs leading-5 text-fg-muted`,children:n.errorSummaryHint}),t[5]=n.errorSummaryHint,t[6]=f);let m;t[7]!==d||t[8]!==f?(m=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[d,f]}),t[7]=d,t[8]=f,t[9]=m):m=t[9];let h;t[10]!==r.length||t[11]!==i||t[12]!==l?(h=i?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(A,{className:`h-5 w-8 rounded-md`}),(0,$.jsx)(A,{className:`h-5 w-10 rounded-md`})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`rounded-md bg-red-500/10 px-2 py-0.5 text-xs tabular-nums text-red-600 dark:text-red-400`,children:r.length}),(0,$.jsxs)(`span`,{className:`rounded-md bg-surface-hover px-2 py-0.5 text-xs tabular-nums text-fg-muted`,children:[`×`,l]})]}),t[10]=r.length,t[11]=i,t[12]=l,t[13]=h):h=t[13];let g=o&&`rotate-180`,_;t[14]===g?_=t[15]:(_=p(`size-4 text-fg-muted transition-transform duration-150 ease-out motion-reduce:transition-none`,g),t[14]=g,t[15]=_);let v;t[16]===_?v=t[17]:(v=(0,$.jsx)(B,{className:_,strokeWidth:1.75,"aria-hidden":!0}),t[16]=_,t[17]=v);let y;t[18]!==h||t[19]!==v?(y=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 pt-0.5`,children:[h,v]}),t[18]=h,t[19]=v,t[20]=y):y=t[20];let b;t[21]!==o||t[22]!==y||t[23]!==m?(b=(0,$.jsxs)(`button`,{type:`button`,onClick:u,"aria-expanded":o,className:`flex w-full items-start justify-between gap-3 px-4 py-4 text-left transition-colors hover:bg-surface-hover/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-inset sm:px-5`,children:[m,y]}),t[21]=o,t[22]=y,t[23]=m,t[24]=b):b=t[24];let x;t[25]!==n.module||t[26]!==n.phase||t[27]!==n.time||t[28]!==o||t[29]!==r||t[30]!==i||t[31]!==a?(x=o&&!i&&r.length>0?(0,$.jsx)(`ul`,{className:`mx-1 mb-1 flex flex-col gap-1 rounded-lg bg-surface-base/45 p-1 [&>li]:rounded-lg`,children:r.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>a?.(e),className:p(`flex w-full flex-col gap-1 px-4 py-2.5 text-left transition-colors hover:bg-surface-hover`,a&&`cursor-pointer`),children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.errName}),(0,$.jsxs)(`span`,{className:`shrink-0 rounded-md bg-red-500/10 px-2 py-0.5 text-xs tabular-nums text-red-600 dark:text-red-400`,children:[`×`,e.count]})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[e.phase?(0,$.jsxs)(`span`,{children:[n.phase,`: `,e.phase]}):null,e.module?(0,$.jsxs)(`span`,{children:[n.module,`: `,e.module]}):null,(0,$.jsxs)(`span`,{children:[n.time,`: `,Te(e.lastSeen)]})]}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-subtle`,children:e.sampleMessage})]})},e.key))}):null,t[25]=n.module,t[26]=n.phase,t[27]=n.time,t[28]=o,t[29]=r,t[30]=i,t[31]=a,t[32]=x):x=t[32];let S;return t[33]!==b||t[34]!==x?(S=(0,$.jsxs)(`section`,{className:`overflow-hidden rounded-xl bg-surface-hover/20`,children:[b,x]}),t[33]=b,t[34]=x,t[35]=S):S=t[35],S}function Be(e){return!e}function Ve(e,t){return e+t.count}function He(e){let t=(0,q.c)(75),{log:n,labels:r,onFilterByRequestId:i,onFilterByTranscriptId:a,onOpenChat:o}=e,s=n.level??`info`,c=typeof n.requestId==`string`?n.requestId:``,l=typeof n.conversationId==`string`?n.conversationId:``,u=typeof n.transcriptId==`string`?n.transcriptId:``,d;t[0]===n?d=t[1]:(d=Ae(n),t[0]=n,t[1]=d);let f=d,m;t[2]===n?m=t[3]:(m=Me(n),t[2]=n,t[3]=m);let h=m,g=s===`error`||s===`fatal`,_;t[4]===r.message?_=t[5]:(_=(0,$.jsx)(`span`,{className:`text-xs font-sans font-medium text-fg-muted`,children:r.message}),t[4]=r.message,t[5]=_);let v=g&&`border-red-500/40`,y;t[6]===v?y=t[7]:(y=p(`mt-2 whitespace-pre-wrap break-words border border-edge bg-surface-base p-3 text-xs leading-relaxed text-fg dark:border-edge`,v),t[6]=v,t[7]=y);let b=n.message||`—`,x;t[8]!==y||t[9]!==b?(x=(0,$.jsx)(`pre`,{className:y,children:b}),t[8]=y,t[9]=b,t[10]=x):x=t[10];let S;t[11]!==_||t[12]!==x?(S=(0,$.jsxs)(`div`,{children:[_,x]}),t[11]=_,t[12]=x,t[13]=S):S=t[13];let C;t[14]!==h||t[15]!==r.stackTrace?(C=h?.stack?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{className:`text-xs font-sans font-medium text-fg-muted`,children:r.stackTrace}),h.name?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-red-600 dark:text-red-400`,children:h.name}):null,(0,$.jsx)(`pre`,{className:`mt-2 overflow-x-auto whitespace-pre-wrap break-words border border-red-500/30 bg-surface-base p-3 text-xs leading-relaxed text-fg dark:border-red-500/30`,children:h.stack})]}):null,t[14]=h,t[15]=r.stackTrace,t[16]=C):C=t[16];let w;t[17]===r.time?w=t[18]:(w=(0,$.jsx)(`span`,{className:`font-sans text-fg-muted`,children:r.time}),t[17]=r.time,t[18]=w);let E;t[19]===n.timestamp?E=t[20]:(E=(0,$.jsx)(`code`,{className:`break-all text-fg`,children:n.timestamp}),t[19]=n.timestamp,t[20]=E);let D;t[21]===r.level?D=t[22]:(D=(0,$.jsx)(`span`,{className:`font-sans text-fg-muted`,children:r.level}),t[21]=r.level,t[22]=D);let O=g&&`font-medium text-red-600 dark:text-red-400`,k;t[23]===O?k=t[24]:(k=p(`text-fg`,O),t[23]=O,t[24]=k);let A;t[25]===s?A=t[26]:(A=ke(s),t[25]=s,t[26]=A);let j;t[27]!==k||t[28]!==A?(j=(0,$.jsx)(`span`,{className:k,children:A}),t[27]=k,t[28]=A,t[29]=j):j=t[29];let M;t[30]===r.module?M=t[31]:(M=(0,$.jsx)(`span`,{className:`font-sans text-fg-muted`,children:r.module}),t[30]=r.module,t[31]=M);let N;t[32]===n?N=t[33]:(N=Ce(n),t[32]=n,t[33]=N);let P;t[34]===N?P=t[35]:(P=(0,$.jsx)(`code`,{className:`break-all text-fg`,children:N}),t[34]=N,t[35]=P);let F;t[36]!==r.phase||t[37]!==f?(F=f===`—`?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`font-sans text-fg-muted`,children:r.phase}),(0,$.jsx)(`code`,{className:`break-all text-fg`,children:f})]}),t[36]=r.phase,t[37]=f,t[38]=F):F=t[38];let I;t[39]!==r.filterByRequestId||t[40]!==r.requestId||t[41]!==i||t[42]!==c?(I=c?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`font-sans text-fg-muted`,children:r.requestId}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,$.jsx)(`code`,{className:`break-all text-fg`,children:c}),i?(0,$.jsx)(T,{type:`button`,variant:`secondary`,className:`h-7 px-2 text-[11px]`,onClick:()=>i(c),children:r.filterByRequestId}):null]})]}):null,t[39]=r.filterByRequestId,t[40]=r.requestId,t[41]=i,t[42]=c,t[43]=I):I=t[43];let L;t[44]!==r.conversationId||t[45]!==r.openChat||t[46]!==o||t[47]!==l?(L=l?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`font-sans text-fg-muted`,children:r.conversationId}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,$.jsx)(`code`,{className:`break-all text-fg`,children:l}),o?(0,$.jsx)(T,{type:`button`,variant:`secondary`,className:`h-7 px-2 text-[11px]`,onClick:()=>o({conversationId:l}),children:r.openChat}):null]})]}):null,t[44]=r.conversationId,t[45]=r.openChat,t[46]=o,t[47]=l,t[48]=L):L=t[48];let R;t[49]!==r.filterByTranscriptId||t[50]!==r.openChat||t[51]!==r.transcriptId||t[52]!==a||t[53]!==o||t[54]!==u?(R=u?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`font-sans text-fg-muted`,children:r.transcriptId}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,$.jsx)(`code`,{className:`break-all text-fg`,children:u}),a?(0,$.jsx)(T,{type:`button`,variant:`secondary`,className:`h-7 px-2 text-[11px]`,onClick:()=>a(u),children:r.filterByTranscriptId}):null,o?(0,$.jsx)(T,{type:`button`,variant:`secondary`,className:`h-7 px-2 text-[11px]`,onClick:()=>o({transcriptId:u}),children:r.openChat}):null]})]}):null,t[49]=r.filterByTranscriptId,t[50]=r.openChat,t[51]=r.transcriptId,t[52]=a,t[53]=o,t[54]=u,t[55]=R):R=t[55];let z;t[56]!==w||t[57]!==E||t[58]!==D||t[59]!==j||t[60]!==M||t[61]!==P||t[62]!==F||t[63]!==I||t[64]!==L||t[65]!==R?(z=(0,$.jsxs)(`div`,{className:`grid grid-cols-[5.5rem_1fr] gap-x-3 gap-y-2 text-xs`,children:[w,E,D,j,M,P,F,I,L,R]}),t[56]=w,t[57]=E,t[58]=D,t[59]=j,t[60]=M,t[61]=P,t[62]=F,t[63]=I,t[64]=L,t[65]=R,t[66]=z):z=t[66];let B;t[67]!==r.metadata||t[68]!==n.meta?(B=n.meta&&Object.keys(n.meta).length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{className:`text-xs font-sans font-medium text-fg-muted`,children:r.metadata}),(0,$.jsx)(`pre`,{className:`mt-2 overflow-x-auto whitespace-pre-wrap break-words border border-edge bg-surface-base p-3 text-xs leading-relaxed text-fg dark:border-edge`,children:JSON.stringify(n.meta,null,2)})]}):null,t[67]=r.metadata,t[68]=n.meta,t[69]=B):B=t[69];let ee;return t[70]!==z||t[71]!==B||t[72]!==S||t[73]!==C?(ee=(0,$.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[S,C,z,B]}),t[70]=z,t[71]=B,t[72]=S,t[73]=C,t[74]=ee):ee=t[74],ee}function Ue(e){let t=(0,q.c)(50),{L:n,log:r,onClose:i,copiedDetail:a,onCopiedMessage:o,onCopiedJson:s,onFilterByRequestId:c,onFilterByTranscriptId:l,onOpenChat:u}=e,f=r!==null,m;t[0]===i?m=t[1]:(m=e=>!e&&i(),t[0]=i,t[1]=m);let h;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(v,{className:p(`xopc-dialog-overlay fixed inset-0 bg-scrim`,M)}),t[2]=h):h=t[2];let g;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(g=p(`xopc-drawer-right fixed right-0 top-0 flex size-full max-w-lg flex-col border-l border-edge bg-surface-overlay shadow-popover outline-none`,j,`dark:border-edge`),t[3]=g):g=t[3];let _;t[4]===n.details?_=t[5]:(_=(0,$.jsx)(S,{className:`text-base font-semibold tracking-tight text-fg`,children:n.details}),t[4]=n.details,t[5]=_);let E;t[6]!==n.copied||t[7]!==n.copyJson||t[8]!==n.copyMessage||t[9]!==a||t[10]!==r||t[11]!==s||t[12]!==o?(E=r?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(T,{type:`button`,variant:`ghost`,className:`h-9 shrink-0 gap-1 px-2 text-xs`,onClick:()=>{w(typeof r.message==`string`?r.message:``).then(e=>{e&&o()})},children:[(0,$.jsx)(L,{className:`size-3.5 shrink-0`,strokeWidth:1.75}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:a===`message`?n.copied:n.copyMessage})]}),(0,$.jsxs)(T,{type:`button`,variant:`ghost`,className:`h-9 shrink-0 gap-1 px-2 text-xs`,onClick:()=>{w(JSON.stringify(r,null,2)).then(e=>{e&&s()})},children:[(0,$.jsx)(L,{className:`size-3.5 shrink-0`,strokeWidth:1.75}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:a===`json`?n.copied:n.copyJson})]})]}):null,t[6]=n.copied,t[7]=n.copyJson,t[8]=n.copyMessage,t[9]=a,t[10]=r,t[11]=s,t[12]=o,t[13]=E):E=t[13];let D;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,$.jsx)(d,{className:`size-5`,strokeWidth:1.75}),t[14]=D):D=t[14];let O;t[15]===n.close?O=t[16]:(O=(0,$.jsx)(y,{asChild:!0,children:(0,$.jsx)(T,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":n.close,children:D})}),t[15]=n.close,t[16]=O);let k;t[17]!==E||t[18]!==O?(k=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[E,O]}),t[17]=E,t[18]=O,t[19]=k):k=t[19];let A;t[20]!==_||t[21]!==k?(A=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3 dark:border-edge`,children:[_,k]}),t[20]=_,t[21]=k,t[22]=A):A=t[22];let N;t[23]!==n.conversationId||t[24]!==n.filterByRequestId||t[25]!==n.filterByTranscriptId||t[26]!==n.level||t[27]!==n.message||t[28]!==n.metadata||t[29]!==n.module||t[30]!==n.openChat||t[31]!==n.phase||t[32]!==n.requestId||t[33]!==n.stackTrace||t[34]!==n.time||t[35]!==n.transcriptId||t[36]!==r||t[37]!==c||t[38]!==l||t[39]!==u?(N=r?(0,$.jsx)(He,{log:r,labels:{time:n.time,level:n.level,module:n.module,message:n.message,metadata:n.metadata,requestId:n.requestId,conversationId:n.conversationId,transcriptId:n.transcriptId,phase:n.phase,stackTrace:n.stackTrace,filterByRequestId:n.filterByRequestId,filterByTranscriptId:n.filterByTranscriptId,openChat:n.openChat},onFilterByRequestId:c,onFilterByTranscriptId:l,onOpenChat:u}):null,t[23]=n.conversationId,t[24]=n.filterByRequestId,t[25]=n.filterByTranscriptId,t[26]=n.level,t[27]=n.message,t[28]=n.metadata,t[29]=n.module,t[30]=n.openChat,t[31]=n.phase,t[32]=n.requestId,t[33]=n.stackTrace,t[34]=n.time,t[35]=n.transcriptId,t[36]=r,t[37]=c,t[38]=l,t[39]=u,t[40]=N):N=t[40];let P;t[41]===N?P=t[42]:(P=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-4 font-mono text-sm leading-relaxed`,children:N}),t[41]=N,t[42]=P);let F;t[43]!==A||t[44]!==P?(F=(0,$.jsxs)(b,{children:[h,(0,$.jsxs)(x,{className:g,"aria-describedby":void 0,children:[A,P]})]}),t[43]=A,t[44]=P,t[45]=F):F=t[45];let I;return t[46]!==f||t[47]!==F||t[48]!==m?(I=(0,$.jsx)(C,{open:f,onOpenChange:m,children:F}),t[46]=f,t[47]=F,t[48]=m,t[49]=I):I=t[49],I}function We(e){let t=(0,q.c)(25),{L:n,open:r,onOpenChange:i,files:a,logDir:o}=e,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(v,{className:p(`xopc-dialog-overlay fixed inset-0 bg-scrim`,M)}),t[0]=s):s=t[0];let c;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=p(`xopc-dialog-content fixed left-1/2 top-1/2 flex max-h-[min(32rem,85vh)] w-[min(100%-2rem,24rem)] -translate-x-1/2 -translate-y-1/2 flex-col rounded-xl border border-edge bg-surface-overlay shadow-popover outline-none`,j,`dark:border-edge`),t[1]=c):c=t[1];let l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(V,{className:`size-4 text-fg-muted`,strokeWidth:1.75}),t[2]=l):l=t[2];let u;t[3]===n.logFiles?u=t[4]:(u=(0,$.jsxs)(S,{className:`flex items-center gap-2 text-base font-semibold tracking-tight text-fg`,children:[l,n.logFiles]}),t[3]=n.logFiles,t[4]=u);let f;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(d,{className:`size-5`,strokeWidth:1.75}),t[5]=f):f=t[5];let m;t[6]===n.close?m=t[7]:(m=(0,$.jsx)(y,{asChild:!0,children:(0,$.jsx)(T,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":n.close,children:f})}),t[6]=n.close,t[7]=m);let h;t[8]!==u||t[9]!==m?(h=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3 dark:border-edge`,children:[u,m]}),t[8]=u,t[9]=m,t[10]=h):h=t[10];let g;t[11]!==n.filesEmpty||t[12]!==a?(g=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:a.length===0?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.filesEmpty}):(0,$.jsx)(`ul`,{className:`flex flex-col gap-2`,children:a.map(Ge)})}),t[11]=n.filesEmpty,t[12]=a,t[13]=g):g=t[13];let _;t[14]!==n.logDir||t[15]!==o?(_=o?(0,$.jsxs)(`div`,{className:`shrink-0 border-t border-edge-subtle px-4 py-2 text-xs text-fg-subtle dark:border-edge`,children:[(0,$.jsxs)(`span`,{className:`font-medium text-fg-muted`,children:[n.logDir,`: `]}),(0,$.jsx)(`code`,{className:`break-all text-fg-subtle`,children:o})]}):null,t[14]=n.logDir,t[15]=o,t[16]=_):_=t[16];let w;t[17]!==h||t[18]!==g||t[19]!==_?(w=(0,$.jsxs)(b,{children:[s,(0,$.jsxs)(x,{className:c,children:[h,g,_]})]}),t[17]=h,t[18]=g,t[19]=_,t[20]=w):w=t[20];let E;return t[21]!==i||t[22]!==r||t[23]!==w?(E=(0,$.jsx)(C,{open:r,onOpenChange:i,children:w}),t[21]=i,t[22]=r,t[23]=w,t[24]=E):E=t[24],E}function Ge(e){return(0,$.jsxs)(`li`,{className:`flex flex-col gap-1 rounded-lg border border-edge-subtle bg-surface-base px-3 py-2 dark:border-edge`,children:[(0,$.jsx)(`span`,{className:`break-all font-mono text-xs text-fg`,children:e.name}),(0,$.jsxs)(`span`,{className:`flex flex-wrap gap-x-2 text-xs text-fg-subtle`,children:[(0,$.jsx)(`span`,{children:De(e.size)}),(0,$.jsx)(`span`,{children:Ee(e.modified)})]})]},e.name)}function Ke(e){let t=(0,q.c)(68),{L:n,open:r,onOpenChange:i,dateFrom:a,onDateFromChange:o,dateTo:s,onDateToChange:c,selectedLevels:l,onToggleLevel:u}=e,f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(v,{className:p(`xopc-dialog-overlay fixed inset-0 bg-scrim`,M)}),t[0]=f):f=t[0];let m;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(m=p(`xopc-dialog-content fixed left-1/2 top-1/2 flex max-h-[min(32rem,90vh)] w-[min(100%-2rem,22rem)] -translate-x-1/2 -translate-y-1/2 flex-col rounded-xl border border-edge bg-surface-overlay shadow-popover outline-none`,j,`dark:border-edge`),t[1]=m):m=t[1];let h;t[2]===n.filtersDialogTitle?h=t[3]:(h=(0,$.jsx)(S,{className:`text-base font-semibold tracking-tight text-fg`,children:n.filtersDialogTitle}),t[2]=n.filtersDialogTitle,t[3]=h);let g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(d,{className:`size-5`,strokeWidth:1.75}),t[4]=g):g=t[4];let _;t[5]===n.close?_=t[6]:(_=(0,$.jsx)(y,{asChild:!0,children:(0,$.jsx)(T,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":n.close,children:g})}),t[5]=n.close,t[6]=_);let w;t[7]!==h||t[8]!==_?(w=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3 dark:border-edge`,children:[h,_]}),t[7]=h,t[8]=_,t[9]=w):w=t[9];let E;t[10]===n.filtersDialogDesc?E=t[11]:(E=(0,$.jsx)(`div`,{id:`log-filters-desc`,className:`sr-only`,children:n.filtersDialogDesc}),t[10]=n.filtersDialogDesc,t[11]=E);let D;t[12]===n.timeRange?D=t[13]:(D=(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:n.timeRange}),t[12]=n.timeRange,t[13]=D);let O;t[14]===n.from?O=t[15]:(O=(0,$.jsx)(`label`,{htmlFor:`log-from-d`,className:`mb-1 block text-xs text-fg-muted`,children:n.from}),t[14]=n.from,t[15]=O);let k;t[16]===o?k=t[17]:(k=e=>o(e.target.value),t[16]=o,t[17]=k);let A;t[18]!==a||t[19]!==k?(A=(0,$.jsx)(`input`,{id:`log-from-d`,type:`datetime-local`,value:a,onChange:k,className:`w-full rounded-xl border border-edge bg-surface-base p-2 text-sm text-fg dark:border-edge`}),t[18]=a,t[19]=k,t[20]=A):A=t[20];let N;t[21]!==A||t[22]!==O?(N=(0,$.jsxs)(`div`,{children:[O,A]}),t[21]=A,t[22]=O,t[23]=N):N=t[23];let P;t[24]===n.to?P=t[25]:(P=(0,$.jsx)(`label`,{htmlFor:`log-to-d`,className:`mb-1 block text-xs text-fg-muted`,children:n.to}),t[24]=n.to,t[25]=P);let F;t[26]===c?F=t[27]:(F=e=>c(e.target.value),t[26]=c,t[27]=F);let I;t[28]!==s||t[29]!==F?(I=(0,$.jsx)(`input`,{id:`log-to-d`,type:`datetime-local`,value:s,onChange:F,className:`w-full rounded-xl border border-edge bg-surface-base p-2 text-sm text-fg dark:border-edge`}),t[28]=s,t[29]=F,t[30]=I):I=t[30];let L;t[31]!==P||t[32]!==I?(L=(0,$.jsxs)(`div`,{children:[P,I]}),t[31]=P,t[32]=I,t[33]=L):L=t[33];let R;t[34]!==N||t[35]!==L?(R=(0,$.jsxs)(`div`,{className:`mt-2 flex flex-col gap-3`,children:[N,L]}),t[34]=N,t[35]=L,t[36]=R):R=t[36];let z;t[37]===n.levelCustom?z=t[38]:(z=(0,$.jsx)(`p`,{className:`mt-6 text-xs font-medium text-fg-muted`,children:n.levelCustom}),t[37]=n.levelCustom,t[38]=z);let B;t[39]===n.levelCustomHint?B=t[40]:(B=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:n.levelCustomHint}),t[39]=n.levelCustomHint,t[40]=B);let ee=n.level,V;t[41]!==n.levelNames||t[42]!==u||t[43]!==l?(V=le.map(e=>(0,$.jsx)(`button`,{type:`button`,className:p(`rounded-full border px-3 py-1.5 text-xs font-medium capitalize transition-[color,background-color,border-color] duration-150 ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,l.has(e)?`border-edge bg-surface-active text-fg dark:border-edge`:`border-edge-subtle bg-surface-base text-fg-muted hover:bg-surface-hover dark:border-edge`),onClick:()=>u(e),children:n.levelNames[e]},e)),t[41]=n.levelNames,t[42]=u,t[43]=l,t[44]=V):V=t[44];let H;t[45]!==n.level||t[46]!==V?(H=(0,$.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,role:`group`,"aria-label":ee,children:V}),t[45]=n.level,t[46]=V,t[47]=H):H=t[47];let U;t[48]!==R||t[49]!==z||t[50]!==B||t[51]!==H||t[52]!==D?(U=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-4`,children:[D,R,z,B,H]}),t[48]=R,t[49]=z,t[50]=B,t[51]=H,t[52]=D,t[53]=U):U=t[53];let W;t[54]===i?W=t[55]:(W=()=>i(!1),t[54]=i,t[55]=W);let te;t[56]!==n.filtersDone||t[57]!==W?(te=(0,$.jsx)(`div`,{className:`shrink-0 border-t border-edge-subtle px-4 py-3 dark:border-edge`,children:(0,$.jsx)(T,{type:`button`,className:`w-full rounded-xl`,onClick:W,children:n.filtersDone})}),t[56]=n.filtersDone,t[57]=W,t[58]=te):te=t[58];let G;t[59]!==U||t[60]!==te||t[61]!==w||t[62]!==E?(G=(0,$.jsxs)(b,{children:[f,(0,$.jsxs)(x,{className:m,"aria-describedby":`log-filters-desc`,children:[w,E,U,te]})]}),t[59]=U,t[60]=te,t[61]=w,t[62]=E,t[63]=G):G=t[63];let K;return t[64]!==i||t[65]!==r||t[66]!==G?(K=(0,$.jsx)(C,{open:r,onOpenChange:i,children:G}),t[64]=i,t[65]=r,t[66]=G,t[67]=K):K=t[67],K}var qe=1;function Je(e,t){let n=0,r=0,i=e;for(;i&&i!==t;)n+=i.offsetLeft,r+=i.offsetTop,i=i.offsetParent;return i===t?{x:n,y:r}:null}var Ye=`pointer-events-none absolute left-0 top-0 z-[1] rounded-pill bg-surface-panel shadow-sm will-change-transform [backface-visibility:hidden] dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,Xe=`touch-target relative z-[2] box-border flex h-6 flex-1 cursor-pointer items-center justify-center gap-1 rounded-pill border-0 bg-transparent px-2 py-0 text-center text-xs font-medium leading-none outline-none transition-[color,background-color,box-shadow] duration-150 ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel active:scale-100 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50`;function Ze({value:e,onChange:t,options:n,"aria-label":r,className:i,buttonClassName:a}){let o=(0,K.useRef)(null),s=(0,K.useRef)([]),[c,l]=(0,K.useState)({x:0,y:0,w:0,h:0}),[u,d]=(0,K.useState)(!1),[f,m]=(0,K.useState)(!1),h=(0,K.useCallback)(()=>{let t=o.current;if(!t)return;let r=n.findIndex(t=>t.value===e);if(r<0)return;let i=s.current[r];if(!i)return;let a=qe,c=t.getBoundingClientRect(),u=i.getBoundingClientRect(),f=Je(i,t),p,m;if(f)p=f.x,m=f.y;else{let e=getComputedStyle(t),n=parseFloat(e.borderLeftWidth)||0,r=parseFloat(e.borderTopWidth)||0;p=u.left-c.left-n,m=u.top-c.top-r}l({x:p+a,y:m+a,w:Math.max(0,u.width-a*2),h:Math.max(0,u.height-a*2)}),d(!0)},[n,e]),g=(0,K.useRef)(h);return g.current=h,(0,K.useLayoutEffect)(()=>{let e=requestAnimationFrame(()=>h());return()=>cancelAnimationFrame(e)},[h]),(0,K.useEffect)(()=>{let e=requestAnimationFrame(()=>{requestAnimationFrame(()=>m(!0))});return()=>cancelAnimationFrame(e)},[]),(0,K.useEffect)(()=>{let e=o.current;if(!e)return;let t=()=>{requestAnimationFrame(()=>g.current())},n=new ResizeObserver(t);return n.observe(e),window.addEventListener(`resize`,t),()=>{n.disconnect(),window.removeEventListener(`resize`,t)}},[]),(0,$.jsxs)(`div`,{ref:o,className:p(F,`relative isolate flex w-full max-w-full flex-row items-center`,i),role:`group`,"aria-label":r,children:[(0,$.jsx)(`div`,{"aria-hidden":!0,className:p(Ye,`motion-reduce:!transition-none motion-reduce:!duration-0`,f&&`transition-[transform,width,height] duration-300 [transition-timing-function:cubic-bezier(0.32,0.72,0,1)]`),style:{width:c.w,height:c.h,transform:`translate3d(${c.x}px, ${c.y}px, 0)`,opacity:u&&c.w>0?1:0}}),n.map((n,r)=>{let i=n.icon,o=e===n.value;return(0,$.jsxs)(`button`,{ref:e=>{s.current[r]=e},type:`button`,"aria-pressed":o,title:n.title??n.label,onClick:()=>t(n.value),className:p(Xe,o?`text-fg`:`text-fg-subtle`,a),children:[i?(0,$.jsx)(i,{className:`block size-3 shrink-0 opacity-80`,strokeWidth:1.75,"aria-hidden":!0}):null,(0,$.jsx)(`span`,{className:`min-w-0 shrink truncate leading-none`,children:n.label})]},n.value)})]})}function Qe(e){let t=(0,q.c)(76),{L:n,levelSegment:r,onLevelSegment:i,searchInput:a,onSearchInputChange:c,moduleFilter:l,onModuleFilterChange:f,modules:m,onOpenFilters:h,activeFilterCount:g,hasActiveFilters:_,onClearFilters:v,autoRefresh:y}=e,b=n.filters,x;t[0]===n.presetAll?x=t[1]:(x={value:`all`,label:n.presetAll},t[0]=n.presetAll,t[1]=x);let S;t[2]===n.presetErrors?S=t[3]:(S={value:`errors`,label:n.presetErrors},t[2]=n.presetErrors,t[3]=S);let C;t[4]===n.presetWarnPlus?C=t[5]:(C={value:`warnPlus`,label:n.presetWarnPlus},t[4]=n.presetWarnPlus,t[5]=C);let w;t[6]===n.presetInfoPlus?w=t[7]:(w={value:`infoPlus`,label:n.presetInfoPlus},t[6]=n.presetInfoPlus,t[7]=w);let E;t[8]===n.presetVerbose?E=t[9]:(E={value:`verbose`,label:n.presetVerbose},t[8]=n.presetVerbose,t[9]=E);let D;t[10]===n.presetOther?D=t[11]:(D={value:`other`,label:n.presetOther},t[10]=n.presetOther,t[11]=D);let O;t[12]!==x||t[13]!==S||t[14]!==C||t[15]!==w||t[16]!==E||t[17]!==D?(O=[x,S,C,w,E,D],t[12]=x,t[13]=S,t[14]=C,t[15]=w,t[16]=E,t[17]=D,t[18]=O):O=t[18];let k;t[19]!==n.levelPresetAria||t[20]!==r||t[21]!==i||t[22]!==O?(k=(0,$.jsx)(`div`,{className:`overflow-x-auto pb-1 [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,children:(0,$.jsx)(`div`,{className:`min-w-[min(100%,36rem)]`,children:(0,$.jsx)(Ze,{"aria-label":n.levelPresetAria,value:r,onChange:i,options:O,buttonClassName:`h-8 px-1.5 text-[11px] sm:px-2 sm:text-xs`})})}),t[19]=n.levelPresetAria,t[20]=r,t[21]=i,t[22]=O,t[23]=k):k=t[23];let A;t[24]===n.searchPlaceholder?A=t[25]:(A=(0,$.jsx)(`span`,{className:`sr-only`,children:n.searchPlaceholder}),t[24]=n.searchPlaceholder,t[25]=A);let j;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,$.jsx)(u,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,strokeWidth:1.75,"aria-hidden":!0}),t[26]=j):j=t[26];let M;t[27]===c?M=t[28]:(M=e=>c(e.target.value),t[27]=c,t[28]=M);let N=n.searchPlaceholder,P;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(P=p(`h-10 w-full rounded-md border border-edge bg-surface-panel py-0 pl-10 pr-3 text-sm leading-5 text-fg placeholder:text-fg-subtle dark:border-edge`,ee),t[29]=P):P=t[29];let F;t[30]!==n.searchPlaceholder||t[31]!==a||t[32]!==M?(F=(0,$.jsx)(`input`,{type:`search`,value:a,onChange:M,placeholder:N,autoComplete:`off`,spellCheck:!1,className:P}),t[30]=n.searchPlaceholder,t[31]=a,t[32]=M,t[33]=F):F=t[33];let I;t[34]!==A||t[35]!==F?(I=(0,$.jsxs)(`label`,{className:`relative min-w-0 flex-1 sm:min-w-[12rem]`,children:[A,j,F]}),t[34]=A,t[35]=F,t[36]=I):I=t[36];let L;t[37]===f?L=t[38]:(L=e=>f(e.target.value),t[37]=f,t[38]=L);let z=n.module,B=n.module,V;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(V=p(R,`h-10 w-full min-w-0 rounded-md py-0`),t[39]=V):V=t[39];let H;t[40]===n.allModules?H=t[41]:(H=(0,$.jsx)(s,{value:``,children:n.allModules}),t[40]=n.allModules,t[41]=H);let U;t[42]===m?U=t[43]:(U=m.map($e),t[42]=m,t[43]=U);let W;t[44]!==n.module||t[45]!==l||t[46]!==L||t[47]!==H||t[48]!==U?(W=(0,$.jsxs)(o,{id:`log-module`,value:l,onChange:L,"aria-label":z,title:B,className:V,children:[H,U]}),t[44]=n.module,t[45]=l,t[46]=L,t[47]=H,t[48]=U,t[49]=W):W=t[49];let te;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,$.jsx)(G,{className:`size-4`,strokeWidth:1.75}),t[50]=te):te=t[50];let K;t[51]===g?K=t[52]:(K=g>0?(0,$.jsx)(`span`,{className:`rounded-md bg-surface-hover px-1.5 text-xs tabular-nums text-fg-muted`,children:g}):null,t[51]=g,t[52]=K);let J;t[53]!==n.filtersMore||t[54]!==h||t[55]!==K?(J=(0,$.jsxs)(T,{type:`button`,variant:`secondary`,className:`h-10 min-h-[44px] gap-2 rounded-md sm:min-h-10`,onClick:h,children:[te,n.filtersMore,K]}),t[53]=n.filtersMore,t[54]=h,t[55]=K,t[56]=J):J=t[56];let Y;t[57]!==n.clear||t[58]!==_||t[59]!==v?(Y=_?(0,$.jsxs)(T,{type:`button`,variant:`ghost`,className:`h-10 min-h-[44px] gap-1 sm:min-h-10`,onClick:v,children:[(0,$.jsx)(d,{className:`size-4`,strokeWidth:1.75}),n.clear]}):null,t[57]=n.clear,t[58]=_,t[59]=v,t[60]=Y):Y=t[60];let X;t[61]!==J||t[62]!==Y?(X=(0,$.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center justify-end gap-2`,children:[J,Y]}),t[61]=J,t[62]=Y,t[63]=X):X=t[63];let Z;t[64]!==I||t[65]!==W||t[66]!==X?(Z=(0,$.jsxs)(`div`,{className:`grid gap-2 lg:grid-cols-[minmax(16rem,1fr)_minmax(12rem,16rem)_auto] lg:items-center`,children:[I,W,X]}),t[64]=I,t[65]=W,t[66]=X,t[67]=Z):Z=t[67];let Q;t[68]!==n.liveHint||t[69]!==y?(Q=y?(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:n.liveHint}):null,t[68]=n.liveHint,t[69]=y,t[70]=Q):Q=t[70];let ne;return t[71]!==n.filters||t[72]!==Z||t[73]!==Q||t[74]!==k?(ne=(0,$.jsxs)(`section`,{className:`flex flex-col gap-4 rounded-xl bg-surface-hover/20 p-4 sm:p-5`,"aria-label":b,children:[k,Z,Q]}),t[71]=n.filters,t[72]=Z,t[73]=Q,t[74]=k,t[75]=ne):ne=t[75],ne}function $e(e){return(0,$.jsx)(s,{value:e,children:e},e)}function et(e){let t=(0,q.c)(20),{L:n,logs:r,loading:i,hasMore:a,onSelectLog:o,onLoadMore:s,onRefreshAll:c,onFilterByRequestId:l}=e,u;t[0]!==i||t[1]!==r.length?(u=i&&r.length===0?(0,$.jsx)(`div`,{className:`overflow-hidden rounded-xl bg-surface-hover/20`,"aria-busy":`true`,children:Array.from({length:8}).map(tt)}):null,t[0]=i,t[1]=r.length,t[2]=u):u=t[2];let d;t[3]!==n||t[4]!==i||t[5]!==r.length||t[6]!==c?(d=!i&&r.length===0?(0,$.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 rounded-xl bg-surface-hover/20 py-16 text-center`,children:[(0,$.jsx)(z,{className:`size-12 text-fg-subtle`,strokeWidth:1.5,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`text-base font-semibold tracking-tight text-fg`,children:n.noLogs}),(0,$.jsx)(`p`,{className:`max-w-sm text-sm leading-relaxed text-fg-muted`,children:n.noLogsDescription}),(0,$.jsxs)(T,{type:`button`,variant:`secondary`,className:`mt-4 gap-2`,onClick:c,children:[(0,$.jsx)(W,{className:`size-4`,strokeWidth:1.75}),n.refresh]})]}):null,t[3]=n,t[4]=i,t[5]=r.length,t[6]=c,t[7]=d):d=t[7];let f;t[8]!==n||t[9]!==a||t[10]!==i||t[11]!==r||t[12]!==l||t[13]!==s||t[14]!==o?(f=r.length>0?(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsxs)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:[Se(n.showingCount,{count:String(r.length)}),a?(0,$.jsxs)(`span`,{className:`text-fg-subtle`,children:[` · `,n.moreAvailable]}):null]}),(0,$.jsxs)(`div`,{className:`overflow-hidden rounded-xl bg-surface-hover/20 p-1 text-sm leading-6`,children:[(0,$.jsxs)(`div`,{className:`hidden items-center gap-3 px-3 py-2 text-xs font-medium text-fg-subtle md:flex`,"aria-hidden":!0,children:[(0,$.jsx)(`span`,{className:`w-[5.25rem] shrink-0`,children:n.time}),(0,$.jsx)(`span`,{className:`w-[4.5rem] shrink-0`,children:n.level}),(0,$.jsx)(`span`,{className:`w-[4.5rem] shrink-0 sm:w-[5.25rem]`,children:n.requestId}),(0,$.jsx)(`span`,{className:`hidden max-w-[6rem] shrink-0 xl:block`,children:n.phase}),(0,$.jsx)(`span`,{className:`hidden max-w-[7rem] shrink-0 lg:block`,children:n.module}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1`,children:n.message})]}),(0,$.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:r.map(e=>{let t=e.level??`info`,r=typeof e.requestId==`string`?e.requestId.trim():``,i=Ae(e),a=t===`error`||t===`fatal`;return(0,$.jsx)(`li`,{className:`rounded-lg bg-surface-base/45`,children:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>o(e),className:p(`flex w-full min-w-0 items-center gap-3 px-3 py-2.5 text-left transition-colors duration-150 ease-out`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,a&&`bg-red-500/5`),children:[(0,$.jsx)(`span`,{className:`w-[4.75rem] shrink-0 font-mono text-xs tabular-nums text-fg-subtle sm:w-[5.25rem] sm:text-sm`,children:Te(e.timestamp)}),(0,$.jsx)(`span`,{className:p(`w-[4.5rem] shrink-0 truncate`,a?`font-medium text-red-600 dark:text-red-400`:`text-fg-muted`),title:t,children:ke(t)}),(0,$.jsx)(`span`,{className:`hidden w-[4.5rem] shrink-0 truncate font-mono sm:block sm:w-[5.25rem]`,children:r?l?(0,$.jsx)(`span`,{role:`link`,tabIndex:0,className:`cursor-pointer text-accent hover:underline`,title:`${n.requestId}: ${r}`,onClick:e=>{e.stopPropagation(),l(r)},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),l(r))},children:Oe(r)}):(0,$.jsx)(`span`,{className:`text-fg-subtle`,title:`${n.requestId}: ${r}`,children:Oe(r)}):(0,$.jsx)(`span`,{className:`text-fg-subtle`,children:`—`})}),(0,$.jsx)(`span`,{className:`hidden max-w-[6rem] shrink-0 truncate text-fg-subtle xl:inline`,title:i===`—`?void 0:i,children:i===`—`?`—`:i}),(0,$.jsx)(`span`,{className:`hidden max-w-[7rem] shrink-0 truncate text-fg-muted lg:inline`,title:Ce(e),children:Ce(e)}),(0,$.jsx)(`span`,{className:p(`min-w-0 flex-1 truncate`,`text-fg`),children:we(e)})]})},je(e))})})]}),a?(0,$.jsx)(`div`,{className:`flex justify-center pt-1`,children:(0,$.jsxs)(T,{type:`button`,variant:`secondary`,className:`gap-2`,disabled:i,onClick:s,children:[i?(0,$.jsx)(W,{className:`size-4 animate-spin motion-reduce:animate-none`,strokeWidth:1.75}):(0,$.jsx)(B,{className:`size-4`,strokeWidth:1.75}),n.loadMore]})}):null]}):null,t[8]=n,t[9]=a,t[10]=i,t[11]=r,t[12]=l,t[13]=s,t[14]=o,t[15]=f):f=t[15];let m;return t[16]!==u||t[17]!==d||t[18]!==f?(m=(0,$.jsxs)($.Fragment,{children:[u,d,f]}),t[16]=u,t[17]=d,t[18]=f,t[19]=m):m=t[19],m}function tt(e,t){return(0,$.jsxs)(`div`,{className:`flex gap-3 px-3 py-2.5`,children:[(0,$.jsx)(`div`,{className:`h-4 w-16 shrink-0 bg-surface-hover motion-reduce:animate-none animate-pulse`}),(0,$.jsx)(`div`,{className:`h-4 w-12 shrink-0 bg-surface-hover motion-reduce:animate-none animate-pulse`}),(0,$.jsx)(`div`,{className:`h-4 w-20 shrink-0 bg-surface-hover motion-reduce:animate-none animate-pulse`}),(0,$.jsx)(`div`,{className:`h-4 min-w-0 flex-1 bg-surface-hover motion-reduce:animate-none animate-pulse`})]},t)}function nt(e){let t=(0,q.c)(8),{L:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(H,{className:`mt-0.5 size-5 shrink-0 text-fg-subtle`,strokeWidth:1.75,"aria-hidden":!0}),t[0]=r):r=t[0];let i;t[1]===n.title?i=t[2]:(i=(0,$.jsx)(`h1`,{className:`text-base font-semibold tracking-tight text-fg`,children:n.title}),t[1]=n.title,t[2]=i);let a;t[3]===n.needToken?a=t[4]:(a=(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:n.needToken}),t[3]=n.needToken,t[4]=a);let o;return t[5]!==i||t[6]!==a?(o=(0,$.jsx)(`div`,{className:`flex w-full flex-col gap-3 px-3 py-10 sm:px-5 xl:px-6`,children:(0,$.jsxs)(`div`,{className:`flex items-start gap-3 rounded-2xl bg-surface-base p-6`,children:[r,(0,$.jsxs)(`div`,{children:[i,a]})]})}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o}function rt(e){return/[",\n\r]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e}function it(e){let t=[`timestamp`,`level`,`module`,`phase`,`requestId`,`transcriptId`,`message`],n=e.map(e=>{let t=String(e.module||``),n=String(e.phase??e.meta?.phase??``);return[e.timestamp,e.level,t,n,e.requestId??``,e.transcriptId??``,e.message??``].map(e=>rt(String(e))).join(`,`)});return[t.join(`,`),...n].join(`
2
- `)}function at(e,t,n){let r=new Blob([e],{type:n}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=t,a.click(),URL.revokeObjectURL(i)}function ot(e,t){let n=new Date().toISOString().replace(/[:.]/g,`-`);if(t===`json`){at(JSON.stringify(e,null,2),`xopc-logs-${n}.json`,`application/json`);return}at(it(e),`xopc-logs-${n}.csv`,`text/csv;charset=utf-8`)}function st(e){let t=(0,q.c)(32),{L:n,logs:r,disabled:i}=e,a=i||r.length===0,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(c,{className:`size-4`,strokeWidth:1.75}),t[0]=o):o=t[0];let s;t[1]===n.exportLogs?s=t[2]:(s=(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:n.exportLogs}),t[1]=n.exportLogs,t[2]=s);let l;t[3]!==n.exportLogs||t[4]!==a||t[5]!==s?(l=(0,$.jsx)(O,{asChild:!0,children:(0,$.jsxs)(T,{type:`button`,variant:`secondary`,className:`h-9 gap-2 whitespace-nowrap px-3 text-xs`,disabled:a,title:n.exportLogs,children:[o,s]})}),t[3]=n.exportLogs,t[4]=a,t[5]=s,t[6]=l):l=t[6];let u;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(u=p(`w-52 rounded-xl border border-edge bg-surface-panel p-2 shadow-popover outline-none`,N,`dark:border-edge`),t[7]=u):u=t[7];let d;t[8]===n.exportLogs?d=t[9]:(d=(0,$.jsx)(`p`,{className:`px-2 py-1 text-xs font-medium text-fg`,children:n.exportLogs}),t[8]=n.exportLogs,t[9]=d);let f;t[10]===n.exportHint?f=t[11]:(f=(0,$.jsx)(`p`,{className:`px-2 pb-2 text-xs leading-5 text-fg-muted`,children:n.exportHint}),t[10]=n.exportHint,t[11]=f);let m;t[12]===r?m=t[13]:(m=()=>ot(r,`json`),t[12]=r,t[13]=m);let h;t[14]!==n.exportJson||t[15]!==m?(h=(0,$.jsx)(T,{type:`button`,variant:`ghost`,className:`h-8 justify-start px-2 text-xs`,onClick:m,children:n.exportJson}),t[14]=n.exportJson,t[15]=m,t[16]=h):h=t[16];let g;t[17]===r?g=t[18]:(g=()=>ot(r,`csv`),t[17]=r,t[18]=g);let _;t[19]!==n.exportCsv||t[20]!==g?(_=(0,$.jsx)(T,{type:`button`,variant:`ghost`,className:`h-8 justify-start px-2 text-xs`,onClick:g,children:n.exportCsv}),t[19]=n.exportCsv,t[20]=g,t[21]=_):_=t[21];let v;t[22]!==_||t[23]!==h?(v=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[h,_]}),t[22]=_,t[23]=h,t[24]=v):v=t[24];let y;t[25]!==v||t[26]!==d||t[27]!==f?(y=(0,$.jsx)(D,{children:(0,$.jsxs)(k,{side:`bottom`,align:`end`,sideOffset:6,className:u,children:[d,f,v]})}),t[25]=v,t[26]=d,t[27]=f,t[28]=y):y=t[28];let b;return t[29]!==y||t[30]!==l?(b=(0,$.jsxs)(E,{children:[l,y]}),t[29]=y,t[30]=l,t[31]=b):b=t[31],b}function ct(e){let t=(0,q.c)(38),{L:n}=e,[r,i]=(0,K.useState)(!1),[a,o]=(0,K.useState)(`info`),[s,c]=(0,K.useState)(!1),[u,d]=(0,K.useState)(null),f,m;t[0]!==n.logLevelLoadError||t[1]!==r?(f=()=>{if(!r)return;let e=!1;return re().then(t=>{e||o(t)}).catch(t=>{e||d(t instanceof Error?t.message:n.logLevelLoadError)}),()=>{e=!0}},m=[r,n.logLevelLoadError],t[0]=n.logLevelLoadError,t[1]=r,t[2]=f,t[3]=m):(f=t[2],m=t[3]),(0,K.useEffect)(f,m);let h;t[4]===n.logLevelSaveError?h=t[5]:(h=e=>{c(!0),d(null),ie(e).then(e=>{o(e.current),i(!1)}).catch(e=>{d(e instanceof Error?e.message:n.logLevelSaveError)}).finally(()=>c(!1))},t[4]=n.logLevelSaveError,t[5]=h);let g=h,_;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(l,{className:`size-4`,strokeWidth:1.75}),t[6]=_):_=t[6];let v;t[7]===n.logLevelTitle?v=t[8]:(v=(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:n.logLevelTitle}),t[7]=n.logLevelTitle,t[8]=v);let y;t[9]===a?y=t[10]:(y=(0,$.jsx)(`span`,{className:`tabular-nums text-fg-muted`,children:a}),t[9]=a,t[10]=y);let b;t[11]!==n.logLevelTitle||t[12]!==v||t[13]!==y?(b=(0,$.jsx)(O,{asChild:!0,children:(0,$.jsxs)(T,{type:`button`,variant:`secondary`,className:`h-9 gap-2 whitespace-nowrap px-3 text-xs`,title:n.logLevelTitle,children:[_,v,y]})}),t[11]=n.logLevelTitle,t[12]=v,t[13]=y,t[14]=b):b=t[14];let x;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(x=p(`w-56 rounded-xl border border-edge bg-surface-panel p-3 shadow-popover outline-none`,N,`dark:border-edge`),t[15]=x):x=t[15];let S;t[16]===n.logLevelTitle?S=t[17]:(S=(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:n.logLevelTitle}),t[16]=n.logLevelTitle,t[17]=S);let C;t[18]===n.logLevelHint?C=t[19]:(C=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n.logLevelHint}),t[18]=n.logLevelHint,t[19]=C);let w;t[20]!==n.levelNames||t[21]!==g||t[22]!==a||t[23]!==s?(w=le.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,disabled:s,onClick:()=>g(e),className:p(`flex w-full items-center justify-between rounded-md px-2 py-1.5 text-left text-xs transition-colors`,a===e?`bg-accent/10 font-medium text-accent`:`text-fg hover:bg-surface-hover`),children:[(0,$.jsx)(`span`,{children:n.levelNames[e]}),(0,$.jsx)(`span`,{className:`font-mono text-[10px] uppercase text-fg-subtle`,children:e})]})},e)),t[20]=n.levelNames,t[21]=g,t[22]=a,t[23]=s,t[24]=w):w=t[24];let A;t[25]===w?A=t[26]:(A=(0,$.jsx)(`ul`,{className:`mt-3 flex flex-col gap-1`,children:w}),t[25]=w,t[26]=A);let j;t[27]===u?j=t[28]:(j=u?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-red-600 dark:text-red-400`,children:u}):null,t[27]=u,t[28]=j);let M;t[29]!==C||t[30]!==A||t[31]!==j||t[32]!==S?(M=(0,$.jsx)(D,{children:(0,$.jsxs)(k,{side:`bottom`,align:`end`,sideOffset:6,className:x,children:[S,C,A,j]})}),t[29]=C,t[30]=A,t[31]=j,t[32]=S,t[33]=M):M=t[33];let P;return t[34]!==r||t[35]!==M||t[36]!==b?(P=(0,$.jsxs)(E,{open:r,onOpenChange:i,children:[b,M]}),t[34]=r,t[35]=M,t[36]=b,t[37]=P):P=t[37],P}function lt(e){let t=(0,q.c)(49),{L:n,autoRefresh:r,onAutoRefreshChange:i,fileCount:a,onOpenFiles:o,loading:s,onRefreshAll:c,logs:l}=e,u;t[0]===n.title?u=t[1]:(u=(0,$.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight text-fg sm:text-lg`,children:n.title}),t[0]=n.title,t[1]=u);let d;t[2]===n.subtitle?d=t[3]:(d=(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-relaxed text-fg-muted sm:mt-1`,children:n.subtitle}),t[2]=n.subtitle,t[3]=d);let f;t[4]!==u||t[5]!==d?(f=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[u,d]}),t[4]=u,t[5]=d,t[6]=f):f=t[6];let p=r?`live`:`paused`,m;t[7]===i?m=t[8]:(m=e=>i(e===`live`),t[7]=i,t[8]=m);let h;t[9]===n.refreshManual?h=t[10]:(h={value:`paused`,label:n.refreshManual},t[9]=n.refreshManual,t[10]=h);let g;t[11]===n.refreshLive?g=t[12]:(g={value:`live`,label:n.refreshLive},t[11]=n.refreshLive,t[12]=g);let _;t[13]!==h||t[14]!==g?(_=[h,g],t[13]=h,t[14]=g,t[15]=_):_=t[15];let v;t[16]!==n.refreshModeAria||t[17]!==p||t[18]!==m||t[19]!==_?(v=(0,$.jsx)(`div`,{className:`w-full sm:w-52`,children:(0,$.jsx)(Ze,{"aria-label":n.refreshModeAria,value:p,onChange:m,options:_,buttonClassName:`h-8`})}),t[16]=n.refreshModeAria,t[17]=p,t[18]=m,t[19]=_,t[20]=v):v=t[20];let y;t[21]===n?y=t[22]:(y=(0,$.jsx)(ct,{L:n}),t[21]=n,t[22]=y);let b;t[23]!==n||t[24]!==s||t[25]!==l?(b=(0,$.jsx)(st,{L:n,logs:l,disabled:s}),t[23]=n,t[24]=s,t[25]=l,t[26]=b):b=t[26];let x;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(V,{className:`size-4`,strokeWidth:1.75}),t[27]=x):x=t[27];let S;t[28]===a?S=t[29]:(S=a>0?(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-1.5 text-xs text-fg-muted`,children:a}):null,t[28]=a,t[29]=S);let C;t[30]!==n.logFiles||t[31]!==o||t[32]!==S?(C=(0,$.jsxs)(T,{type:`button`,variant:`ghost`,className:`h-9 min-h-[44px] min-w-[44px] px-2 sm:min-h-9 sm:min-w-0`,title:n.logFiles,"aria-label":n.logFiles,onClick:o,children:[x,S]}),t[30]=n.logFiles,t[31]=o,t[32]=S,t[33]=C):C=t[33];let w;t[34]!==n.refresh||t[35]!==s||t[36]!==c?(w=(0,$.jsx)(I,{className:`h-9 min-h-[44px] min-w-[44px] px-2 sm:min-h-9 sm:min-w-0`,loading:s,label:n.refresh,onClick:c}),t[34]=n.refresh,t[35]=s,t[36]=c,t[37]=w):w=t[37];let E;t[38]!==y||t[39]!==b||t[40]!==C||t[41]!==w?(E=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center justify-end gap-1 sm:self-center`,children:[y,b,C,w]}),t[38]=y,t[39]=b,t[40]=C,t[41]=w,t[42]=E):E=t[42];let D;t[43]!==E||t[44]!==v?(D=(0,$.jsxs)(`div`,{className:`flex w-full shrink-0 flex-col gap-2 rounded-xl bg-surface-hover/20 p-2 sm:flex-row sm:items-center sm:justify-between`,children:[v,E]}),t[43]=E,t[44]=v,t[45]=D):D=t[45];let O;return t[46]!==D||t[47]!==f?(O=(0,$.jsxs)(`header`,{className:`flex flex-col gap-4`,children:[f,D]}),t[46]=D,t[47]=f,t[48]=O):O=t[48],O}function ut(e){let t=(0,q.c)(33),{L:n,stats:r}=e,i;t[0]===r.byLevel?i=t[1]:(i=r.byLevel??{},t[0]=r.byLevel,t[1]=i);let a;t[2]!==n.levelNames||t[3]!==i?(a=Pe(i,n.levelNames),t[2]=n.levelNames,t[3]=i,t[4]=a):a=t[4];let o=a,s=r.runtime?.errorsLast24h;if(!o&&s==null)return null;let c;t[5]===n.statsRegion?c=t[6]:(c=(0,$.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.statsRegion}),t[5]=n.statsRegion,t[6]=c);let l;t[7]===o?l=t[8]:(l=o?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`mx-1.5 text-fg-subtle`,children:`·`}),(0,$.jsx)(`span`,{className:`tabular-nums`,children:o})]}):null,t[7]=o,t[8]=l);let u;t[9]!==n.runtimeErrors||t[10]!==s?(u=s!=null&&s>0?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`mx-1.5 text-fg-subtle`,children:`·`}),(0,$.jsxs)(`span`,{className:`tabular-nums text-red-600 dark:text-red-400`,children:[n.runtimeErrors,` `,s]})]}):null,t[9]=n.runtimeErrors,t[10]=s,t[11]=u):u=t[11];let d;t[12]!==c||t[13]!==l||t[14]!==u?(d=(0,$.jsx)(O,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,className:`max-w-full truncate rounded-lg border border-transparent px-1 py-0.5 text-left text-xs leading-5 text-fg-subtle transition-colors duration-150 ease-out hover:border-edge-subtle hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel dark:hover:border-edge`,children:[c,l,u]})}),t[12]=c,t[13]=l,t[14]=u,t[15]=d):d=t[15];let f;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(f=p(`w-[min(calc(100vw-2rem),20rem)] rounded-xl border border-edge bg-surface-panel p-3 shadow-popover outline-none`,N,`dark:border-edge`),t[16]=f):f=t[16];let m;t[17]===n.statsDetailTitle?m=t[18]:(m=(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:n.statsDetailTitle}),t[17]=n.statsDetailTitle,t[18]=m);let h;t[19]===n.statsHint?h=t[20]:(h=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n.statsHint}),t[19]=n.statsHint,t[20]=h);let g;t[21]!==n.levelNames||t[22]!==r.byLevel?(g=le.map(e=>{let t=r.byLevel?.[e]??0;return t===0?null:(0,$.jsxs)(`li`,{className:`flex items-center justify-between gap-2 rounded-md border border-edge-subtle bg-surface-base px-2 py-1 text-xs dark:border-edge`,children:[(0,$.jsx)(`span`,{className:`font-medium capitalize text-fg`,children:n.levelNames[e]}),(0,$.jsx)(`span`,{className:`tabular-nums text-fg-muted`,children:t})]},e)}),t[21]=n.levelNames,t[22]=r.byLevel,t[23]=g):g=t[23];let _;t[24]===g?_=t[25]:(_=(0,$.jsx)(`ul`,{className:`mt-3 flex flex-col gap-1.5`,children:g}),t[24]=g,t[25]=_);let v;t[26]!==_||t[27]!==m||t[28]!==h?(v=(0,$.jsx)(D,{children:(0,$.jsxs)(k,{side:`bottom`,align:`start`,sideOffset:6,className:f,children:[m,h,_]})}),t[26]=_,t[27]=m,t[28]=h,t[29]=v):v=t[29];let y;return t[30]!==v||t[31]!==d?(y=(0,$.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:(0,$.jsxs)(E,{children:[d,v]})}),t[30]=v,t[31]=d,t[32]=y):y=t[32],y}function dt(){let e=(0,q.c)(89),{L:t,hasToken:n,logs:r,loading:i,error:a,hasMore:o,searchInput:s,setSearchInput:c,selectedLevels:l,moduleFilter:u,setModuleFilter:d,dateFrom:f,setDateFrom:p,dateTo:m,setDateTo:h,modules:_,files:v,stats:y,selectedLog:b,setSelectedLog:x,filesOpen:S,setFilesOpen:C,filtersOpen:w,setFiltersOpen:T,logDir:E,autoRefresh:D,setAutoRefresh:O,copiedDetail:k,setCopiedDetail:A,hasActiveFilters:j,activeFilterCount:M,clearFilters:N,toggleDialogLevel:P,handleLoadMore:F,refreshAll:I,levelSegment:L,handleLevelSegment:R,filterByRequestId:z,filterByTranscriptId:B,filterByErrorSummary:ee,openChatForSession:V,errorSummary:H,errorSummaryLoading:U}=Re(g(ft));if(!n){let n;return e[0]===t?n=e[1]:(n=(0,$.jsx)(nt,{L:t}),e[0]=t,e[1]=n),n}let W;e[2]===C?W=e[3]:(W=()=>C(!0),e[2]=C,e[3]=W);let G;e[4]!==t||e[5]!==D||e[6]!==v.length||e[7]!==i||e[8]!==r||e[9]!==I||e[10]!==O||e[11]!==W?(G=(0,$.jsx)(lt,{L:t,autoRefresh:D,onAutoRefreshChange:O,fileCount:v.length,onOpenFiles:W,loading:i,onRefreshAll:I,logs:r}),e[4]=t,e[5]=D,e[6]=v.length,e[7]=i,e[8]=r,e[9]=I,e[10]=O,e[11]=W,e[12]=G):G=e[12];let K;e[13]===a?K=e[14]:(K=a?(0,$.jsx)(`div`,{className:`rounded-xl bg-danger-soft px-3 py-2 text-sm text-danger`,role:`alert`,children:a}):null,e[13]=a,e[14]=K);let J;e[15]!==t||e[16]!==y?(J=y?(0,$.jsx)(ut,{L:t,stats:y}):null,e[15]=t,e[16]=y,e[17]=J):J=e[17];let Y;e[18]!==t||e[19]!==H||e[20]!==U||e[21]!==ee?(Y=(0,$.jsx)(ze,{L:t,items:H,loading:U,onSelectItem:ee}),e[18]=t,e[19]=H,e[20]=U,e[21]=ee,e[22]=Y):Y=e[22];let X;e[23]===T?X=e[24]:(X=()=>T(!0),e[23]=T,e[24]=X);let Z;e[25]!==t||e[26]!==M||e[27]!==D||e[28]!==N||e[29]!==R||e[30]!==j||e[31]!==L||e[32]!==u||e[33]!==_||e[34]!==s||e[35]!==d||e[36]!==c||e[37]!==X?(Z=(0,$.jsx)(Qe,{L:t,levelSegment:L,onLevelSegment:R,searchInput:s,onSearchInputChange:c,moduleFilter:u,onModuleFilterChange:d,modules:_,onOpenFilters:X,activeFilterCount:M,hasActiveFilters:j,onClearFilters:N,autoRefresh:D}),e[25]=t,e[26]=M,e[27]=D,e[28]=N,e[29]=R,e[30]=j,e[31]=L,e[32]=u,e[33]=_,e[34]=s,e[35]=d,e[36]=c,e[37]=X,e[38]=Z):Z=e[38];let Q;e[39]!==t||e[40]!==z||e[41]!==F||e[42]!==o||e[43]!==i||e[44]!==r||e[45]!==I||e[46]!==x?(Q=(0,$.jsx)(et,{L:t,logs:r,loading:i,hasMore:o,onSelectLog:x,onLoadMore:F,onRefreshAll:I,onFilterByRequestId:z}),e[39]=t,e[40]=z,e[41]=F,e[42]=o,e[43]=i,e[44]=r,e[45]=I,e[46]=x,e[47]=Q):Q=e[47];let ne;e[48]!==t||e[49]!==f||e[50]!==m||e[51]!==w||e[52]!==l||e[53]!==p||e[54]!==h||e[55]!==T||e[56]!==P?(ne=(0,$.jsx)(Ke,{L:t,open:w,onOpenChange:T,dateFrom:f,onDateFromChange:p,dateTo:m,onDateToChange:h,selectedLevels:l,onToggleLevel:P}),e[48]=t,e[49]=f,e[50]=m,e[51]=w,e[52]=l,e[53]=p,e[54]=h,e[55]=T,e[56]=P,e[57]=ne):ne=e[57];let re;e[58]===x?re=e[59]:(re=()=>x(null),e[58]=x,e[59]=re);let ie,ae;e[60]===A?(ie=e[61],ae=e[62]):(ie=()=>A(`message`),ae=()=>A(`json`),e[60]=A,e[61]=ie,e[62]=ae);let oe;e[63]!==t||e[64]!==k||e[65]!==z||e[66]!==B||e[67]!==V||e[68]!==b||e[69]!==ie||e[70]!==ae||e[71]!==re?(oe=(0,$.jsx)(Ue,{L:t,log:b,onClose:re,copiedDetail:k,onCopiedMessage:ie,onCopiedJson:ae,onFilterByRequestId:z,onFilterByTranscriptId:B,onOpenChat:V}),e[63]=t,e[64]=k,e[65]=z,e[66]=B,e[67]=V,e[68]=b,e[69]=ie,e[70]=ae,e[71]=re,e[72]=oe):oe=e[72];let se;e[73]!==t||e[74]!==v||e[75]!==S||e[76]!==E||e[77]!==C?(se=(0,$.jsx)(We,{L:t,open:S,onOpenChange:C,files:v,logDir:E}),e[73]=t,e[74]=v,e[75]=S,e[76]=E,e[77]=C,e[78]=se):se=e[78];let ce;return e[79]!==G||e[80]!==oe||e[81]!==se||e[82]!==K||e[83]!==J||e[84]!==Y||e[85]!==Z||e[86]!==Q||e[87]!==ne?(ce=(0,$.jsxs)(te,{gap:`gap-6`,children:[G,K,J,Y,Z,Q,ne,oe,se]}),e[79]=G,e[80]=oe,e[81]=se,e[82]=K,e[83]=J,e[84]=Y,e[85]=Z,e[86]=Q,e[87]=ne,e[88]=ce):ce=e[88],ce}function ft(e){return e.language}export{dt as LogsPage};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{g as i}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as a}from"./createLucideIcon-DPHK1VkS.js";import{t as o}from"./chevron-left-DqFhpbvK.js";import{t as s}from"./popover-select-DcsFzD_i.js";import{t as c}from"./plus-Q2yW6OE7.js";import{t as l}from"./search-DA7gz22f.js";import{t as u}from"./x-B_N4OPjy.js";import{t as ee}from"./messages-D0G_sZvA.js";import{t as d}from"./cn-JdwAhgNB.js";import{i as f,n as te,r as p}from"./locale-store-BSkKhYkc.js";import{a as m,n as h,o as g,r as _,s as v,t as y}from"./dist-BGTk37IG.js";import{i as b}from"./vendor-swr-BIWyz7Rc.js";import{t as x}from"./button-CS04eWY9.js";import{i as S,o as ne}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{Lc as C,Oa as w,Ul as T,ao as E,cl as D,ka as O,ml as k,tu as A,zo as j}from"./index-Cr4SINLG.js";import{n as M,r as N,t as P}from"./settings-page-layout-X1x-2Cp9.js";import{t as F}from"./device-pairing-wizard-DFYK_Ywf.js";import{n as I}from"./settings-loading-skeleton-CAmWMaOT.js";var re=a(`shield-off`,[[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71`,key:`1jlk70`}],[`path`,{d:`M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264`,key:`18rp1v`}]]),L=e(t(),1),R=n(),z=720*60*60*1e3;function B(e){let t=[e.access,e.principal].filter(e=>e!==null);return t.length>0&&t.every(e=>e.revokedAt!==void 0)}function V(e){return B(e)?`revoked`:e.endpoints.length>0?`online`:`offline`}function ie(e){return new Set(e.endpoints.flatMap(e=>e.tools.map(({descriptor:e})=>e.name))).size}function ae(e,t=Date.now()){return V(e)===`offline`?(e.lastSeenAt??e.createdAt)<t-z:!1}function oe(e,t,n=Date.now()){let r=t.query.trim().toLocaleLowerCase();return e.filter(e=>{let i=V(e),a=t.status===`all`||(t.status===`active`?i!==`revoked`:t.status===`stale`?ae(e,n):i===t.status),o=!t.platform||e.platform===t.platform,s=!r||[e.displayName,e.id,e.kind,e.platform].some(e=>e.toLocaleLowerCase().includes(r));return a&&o&&s})}function se(e){return e.length>8?e.slice(-8):e}var H=r();function ce(e){let t=(0,R.c)(59),{device:n,busy:r,onClose:i,onRevoke:a}=e,o=te(U),s;t[0]===o?s=t[1]:(s=ee(o),t[0]=o,t[1]=s);let c=s.endpointToolsSettings,l=o===`zh`?`zh-CN`:`en`,f;t[2]===l?f=t[3]:(f=new Intl.DateTimeFormat(l,{dateStyle:`medium`,timeStyle:`short`}),t[2]=l,t[3]=f);let p=f,b;t[4]===n?b=t[5]:(b=n?V(n):`offline`,t[4]=n,t[5]=b);let C=b,w=n!==null,T;t[6]===i?T=t[7]:(T=e=>!e&&i(),t[6]=i,t[7]=T);let E;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,H.jsx)(m,{className:d(`xopc-dialog-overlay fixed inset-0 bg-scrim`,ne)}),t[8]=E):E=t[8];let D;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(D=d(`xopc-drawer-right fixed right-0 top-0 flex size-full max-w-lg flex-col border-l border-edge bg-surface-overlay shadow-popover outline-none`,S),t[9]=D):D=t[9];let O=n?.displayName??c.deviceDetails,k;t[10]===O?k=t[11]:(k=(0,H.jsx)(v,{className:`truncate text-base font-semibold text-fg`,children:O}),t[10]=O,t[11]=k);let A;t[12]===n?A=t[13]:(A=n?(0,H.jsxs)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:[n.kind,` · `,n.platform,` · `,se(n.id)]}):null,t[12]=n,t[13]=A);let j;t[14]!==k||t[15]!==A?(j=(0,H.jsxs)(`div`,{className:`min-w-0`,children:[k,A]}),t[14]=k,t[15]=A,t[16]=j):j=t[16];let M;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,H.jsx)(u,{className:`size-5`,"aria-hidden":!0}),t[17]=M):M=t[17];let N;t[18]===c.close?N=t[19]:(N=(0,H.jsx)(h,{asChild:!0,children:(0,H.jsx)(x,{variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":c.close,children:M})}),t[18]=c.close,t[19]=N);let P;t[20]!==j||t[21]!==N?(P=(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[j,N]}),t[20]=j,t[21]=N,t[22]=P):P=t[22];let F;t[23]!==c.accessActive||t[24]!==c.accessRevoked||t[25]!==c.accessTitle||t[26]!==c.createdAt||t[27]!==c.endpointCount||t[28]!==c.endpointsTitle||t[29]!==c.identityId||t[30]!==c.identityTitle||t[31]!==c.lastSeen||t[32]!==c.never||t[33]!==c.noAccessIdentity||t[34]!==c.noOnlineEndpoints||t[35]!==c.noPermissions||t[36]!==c.permissions||t[37]!==c.status||t[38]!==c.statusLabel||t[39]!==c.toolCount||t[40]!==n||t[41]!==p||t[42]!==C?(F=n?(0,H.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto p-4`,children:[(0,H.jsxs)(`dl`,{className:`grid grid-cols-2 gap-3 rounded-xl bg-surface-hover/40 p-4`,children:[(0,H.jsx)(W,{label:c.statusLabel,value:c.status[C]}),(0,H.jsx)(W,{label:c.lastSeen,value:n.lastSeenAt?p.format(n.lastSeenAt):c.never}),(0,H.jsx)(W,{label:c.endpointCount,value:String(n.endpoints.length)}),(0,H.jsx)(W,{label:c.toolCount,value:String(ie(n))})]}),(0,H.jsxs)(`section`,{children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:c.accessTitle}),(0,H.jsx)(`div`,{className:`mt-2 rounded-xl border border-edge-subtle bg-surface-base p-3 text-xs text-fg-muted`,children:n.access?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{children:n.access.revokedAt?c.accessRevoked:c.accessActive}),(0,H.jsxs)(`p`,{className:`mt-1 break-words`,children:[c.permissions,`: `,n.access.scopes.join(`, `)||c.noPermissions]})]}):(0,H.jsx)(`p`,{children:c.noAccessIdentity})})]}),(0,H.jsxs)(`section`,{children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:c.endpointsTitle}),(0,H.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[n.endpoints.length===0?(0,H.jsx)(`p`,{className:`text-sm text-fg-muted`,children:c.noOnlineEndpoints}):null,n.endpoints.map(e=>(0,H.jsxs)(`article`,{className:`rounded-xl border border-edge-subtle bg-surface-base p-3`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,H.jsx)(`p`,{className:`min-w-0 break-all text-xs font-medium text-fg`,children:e.endpointId}),(0,H.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[c.status[e.availability],` · v`,e.appVersion]})]}),(0,H.jsx)(`div`,{className:`mt-3 space-y-2`,children:e.tools.map(e=>{let{descriptor:t}=e;return(0,H.jsxs)(`div`,{className:`rounded-lg bg-surface-hover/50 px-3 py-2`,children:[(0,H.jsx)(`p`,{className:`break-all text-xs font-medium text-fg`,children:t.name}),(0,H.jsx)(`p`,{className:`mt-0.5 break-words text-xs text-fg-subtle`,children:t.requiredPermissions.join(`, `)||c.noPermissions})]},t.name)})})]},e.connectionId))]})]}),(0,H.jsxs)(`section`,{children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:c.identityTitle}),(0,H.jsxs)(`dl`,{className:`mt-2 rounded-xl border border-edge-subtle bg-surface-base p-3 text-xs`,children:[(0,H.jsx)(W,{label:c.identityId,value:n.id,breakAll:!0}),(0,H.jsx)(`div`,{className:`mt-3`,children:(0,H.jsx)(W,{label:c.createdAt,value:p.format(n.createdAt)})})]})]})]}):null,t[23]=c.accessActive,t[24]=c.accessRevoked,t[25]=c.accessTitle,t[26]=c.createdAt,t[27]=c.endpointCount,t[28]=c.endpointsTitle,t[29]=c.identityId,t[30]=c.identityTitle,t[31]=c.lastSeen,t[32]=c.never,t[33]=c.noAccessIdentity,t[34]=c.noOnlineEndpoints,t[35]=c.noPermissions,t[36]=c.permissions,t[37]=c.status,t[38]=c.statusLabel,t[39]=c.toolCount,t[40]=n,t[41]=p,t[42]=C,t[43]=F):F=t[43];let I;t[44]!==r||t[45]!==c.removeDevice||t[46]!==c.revoking||t[47]!==n||t[48]!==a||t[49]!==C?(I=n&&C!==`revoked`?(0,H.jsx)(`div`,{className:`shrink-0 border-t border-edge px-4 py-3`,children:(0,H.jsxs)(x,{variant:`secondary`,className:`w-full text-danger`,disabled:r,onClick:()=>a(n),children:[(0,H.jsx)(re,{className:`size-4`,"aria-hidden":!0}),r?c.revoking:c.removeDevice]})}):null,t[44]=r,t[45]=c.removeDevice,t[46]=c.revoking,t[47]=n,t[48]=a,t[49]=C,t[50]=I):I=t[50];let L;t[51]!==P||t[52]!==F||t[53]!==I?(L=(0,H.jsxs)(g,{children:[E,(0,H.jsxs)(_,{className:D,"aria-describedby":void 0,children:[P,F,I]})]}),t[51]=P,t[52]=F,t[53]=I,t[54]=L):L=t[54];let z;return t[55]!==L||t[56]!==w||t[57]!==T?(z=(0,H.jsx)(y,{open:w,onOpenChange:T,children:L}),t[55]=L,t[56]=w,t[57]=T,t[58]=z):z=t[58],z}function U(e){return e.language}function W(e){let t=(0,R.c)(10),{label:n,value:r,breakAll:i}=e,a=i===void 0?!1:i,o;t[0]===n?o=t[1]:(o=(0,H.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:n}),t[0]=n,t[1]=o);let s=a&&`break-all font-mono text-xs`,c;t[2]===s?c=t[3]:(c=d(`mt-1 text-sm text-fg`,s),t[2]=s,t[3]=c);let l;t[4]!==c||t[5]!==r?(l=(0,H.jsx)(`dd`,{className:c,children:r}),t[4]=c,t[5]=r,t[6]=l):l=t[6];let u;return t[7]!==o||t[8]!==l?(u=(0,H.jsxs)(`div`,{className:`min-w-0`,children:[o,l]}),t[7]=o,t[8]=l,t[9]=u):u=t[9],u}function le(e){let t=(0,R.c)(19),{onPaired:n}=e,[r,a]=i(),o=te(de),s;t[0]===o?s=t[1]:(s=ee(o),t[0]=o,t[1]=s);let l=s.endpointToolsSettings.deviceAccess,u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u={open:!1},t[2]=u):u=t[2];let[d,f]=(0,L.useState)(u),p,m;t[3]!==r||t[4]!==a?(p=()=>{let e=r.get(`startDevicePairing`);e!==`mobile`&&e!==`browser`||(f({open:!0,target:e}),a(ue,{replace:!0}))},m=[r,a],t[3]=r,t[4]=a,t[5]=p,t[6]=m):(p=t[5],m=t[6]),(0,L.useEffect)(p,m);let h,g;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h=()=>f({open:!0}),g=(0,H.jsx)(c,{className:`size-4`,"aria-hidden":!0}),t[7]=h,t[8]=g):(h=t[7],g=t[8]);let _;t[9]===l.addDevice?_=t[10]:(_=(0,H.jsxs)(x,{variant:`primary`,onClick:h,children:[g,l.addDevice]}),t[9]=l.addDevice,t[10]=_);let v;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>f(t=>({...t,open:e})),t[11]=v):v=t[11];let y;t[12]!==d.open||t[13]!==d.target||t[14]!==n?(y=(0,H.jsx)(F,{open:d.open,onOpenChange:v,onPaired:n,targetKind:d.target}),t[12]=d.open,t[13]=d.target,t[14]=n,t[15]=y):y=t[15];let b;return t[16]!==_||t[17]!==y?(b=(0,H.jsxs)(H.Fragment,{children:[_,y]}),t[16]=_,t[17]=y,t[18]=b):b=t[18],b}function ue(e){let t=new URLSearchParams(e);return t.delete(`startDevicePairing`),t}function de(e){return e.language}async function G(e){let t=await e.json().catch(()=>null);if(!e.ok||t?.payload===void 0)throw Error(t?.error?.message??`Endpoint management request failed: ${e.status}`);return t.payload}function fe(){return p(`/api/endpoint-tools/devices`)}function pe(e){let t=new URLSearchParams({page:String(e.page),pageSize:String(e.pageSize)});return e.query.trim()&&t.set(`query`,e.query.trim()),e.principalId&&t.set(`principalId`,e.principalId),e.status&&t.set(`status`,e.status),e.effect&&t.set(`effect`,e.effect),p(`/api/endpoint-tools/invocations?${t}`)}async function me(){return G(await f(fe()))}async function he(e){let t=Array.from({length:Math.ceil(e.length/100)},(t,n)=>e.slice(n*100,(n+1)*100));await Promise.all(t.map(async e=>{await G(await f(p(`/api/endpoint-tools/devices/revoke`),{method:`POST`,body:JSON.stringify({ids:e})}))}))}async function ge(e){return G(await f(pe(e)))}var _e=5e3,K=20,ve=20;function ye(e){return e===`online`||e===`succeeded`?`bg-success-soft text-success`:e===`running`?`bg-accent-soft text-accent-fg`:e===`failed`||e===`revoked`?`bg-danger-soft text-danger`:`bg-surface-hover text-fg-muted`}function be(e){let t=(0,R.c)(5),{status:n,label:r}=e,i;t[0]===n?i=t[1]:(i=d(`rounded-full px-2 py-0.5 text-xs font-medium`,ye(n)),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,H.jsx)(`span`,{className:i,children:r}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a}function xe(){let e=te(e=>e.language),t=ee(e).endpointToolsSettings,[n,r]=i(),a=n.get(`view`)===`activity`?`activity`:`devices`,[c,u]=(0,L.useState)(null),[f,p]=(0,L.useState)([]),[m,h]=(0,L.useState)(!1),[g,_]=(0,L.useState)(!1),[v,y]=(0,L.useState)(``),[S,ne]=(0,L.useState)(`active`),[F,R]=(0,L.useState)(``),[z,B]=(0,L.useState)(1),[U,W]=(0,L.useState)(()=>new Set),[ue,de]=(0,L.useState)(``),[G]=E(ue,250),[ye,xe]=(0,L.useState)(``),[Se,Ce]=(0,L.useState)(``),[we,Te]=(0,L.useState)(``),[Ee,q]=(0,L.useState)(1),De={page:Ee,pageSize:ve,query:G,principalId:ye,status:Se,effect:we},J=b(fe(),me,{refreshInterval:_e}),Y=b(a===`activity`?pe(De):null,()=>ge(De),{refreshInterval:_e,keepPreviousData:!0}),Oe=(0,L.useMemo)(()=>new Intl.DateTimeFormat(e===`zh`?`zh-CN`:`en`,{dateStyle:`medium`,timeStyle:`short`}),[e]);if(J.isLoading&&!J.data)return(0,H.jsx)(N,{children:(0,H.jsx)(I,{sections:2})});let X=J.data??[],ke=Y.data?.items??[],Ae=X.filter(e=>V(e)===`online`).length,je=X.filter(e=>V(e)!==`revoked`).length,Me=X.filter(e=>ae(e)).length,Ne=[...new Set(X.map(e=>e.platform))].toSorted(),Z=oe(X,{query:v,status:S,platform:F}),Pe=Math.max(1,Math.ceil(Z.length/K)),Q=Math.min(z,Pe),Fe=Z.slice((Q-1)*K,Q*K),$=Fe.reduce((e,t)=>(V(t)!==`revoked`&&e.push(t.id),e),[]),Ie=$.length>0&&$.every(e=>U.has(e)),Le=e=>{r(t=>{let n=new URLSearchParams(t);return e===`devices`?n.delete(`view`):n.set(`view`,e),n},{replace:!0})},Re=async()=>{await Promise.all([J.mutate(),a===`activity`?Y.mutate():Promise.resolve()])},ze=async()=>{if(!(f.length===0||m)){h(!0),_(!1);try{await he(f.map(e=>e.id)),p([]),W(new Set),await J.mutate()}catch{_(!0)}finally{h(!1)}}},Be=e=>{e(),B(1),W(new Set)};return(0,H.jsxs)(N,{children:[(0,H.jsx)(M,{title:t.title,subtitle:t.subtitle,actions:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(w,{className:`size-9 shrink-0 p-0`,label:t.refresh,onClick:Re}),(0,H.jsx)(le,{onPaired:()=>void J.mutate()})]})}),J.error||Y.error?(0,H.jsx)(`div`,{className:`rounded-xl bg-danger-soft px-4 py-3 text-sm text-danger`,children:t.loadError}):null,(0,H.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[{label:t.activeDevices,value:je,filter:`active`},{label:t.onlineDevices,value:Ae,filter:`online`},{label:t.staleDevices,value:Me,filter:`stale`}].map(({label:e,value:t,filter:n})=>(0,H.jsxs)(`button`,{type:`button`,className:d(`touch-target rounded-xl px-4 py-3 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,S===n?`bg-surface-active`:`bg-surface-hover/20 hover:bg-surface-hover/50`),"aria-pressed":S===n,onClick:()=>{Be(()=>ne(n)),Le(`devices`)},children:[(0,H.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e}),(0,H.jsx)(`span`,{className:`mt-1 block text-2xl font-semibold text-fg`,children:t})]},n))}),(0,H.jsx)(j,{items:[{id:`devices`,label:t.devicesTab,icon:D,count:je},{id:`activity`,label:t.activityTab,icon:A,count:Y.data?.total}],activeTab:a,onChange:Le,ariaLabel:t.viewsAria,tabIdPrefix:`endpoint-management-tab`,panelIdPrefix:`endpoint-management-panel`}),(0,H.jsxs)(P,{id:`devices`,activeTab:a,tabIdPrefix:`endpoint-management-tab`,panelIdPrefix:`endpoint-management-panel`,title:t.devicesTitle,hint:t.devicesHint,children:[(0,H.jsxs)(`div`,{className:`mb-4 grid gap-2 sm:grid-cols-[minmax(0,1fr)_11rem_11rem]`,children:[(0,H.jsxs)(`label`,{className:`relative block`,children:[(0,H.jsx)(`span`,{className:`sr-only`,children:t.searchDevices}),(0,H.jsx)(l,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,H.jsx)(`input`,{type:`search`,"aria-label":t.searchDevices,value:v,placeholder:t.searchDevices,className:`h-10 w-full rounded-lg border border-edge bg-surface-inset pl-9 pr-3 text-base text-fg placeholder:text-fg-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent sm:text-sm`,onChange:e=>Be(()=>y(e.target.value))})]}),(0,H.jsx)(s,{value:S,options:[{value:`active`,label:t.filterActive},{value:`online`,label:t.status.online},{value:`offline`,label:t.status.offline},{value:`stale`,label:t.filterStale},{value:`revoked`,label:t.status.revoked},{value:`all`,label:t.filterAll}],placeholder:t.statusLabel,allowEmpty:!1,ariaLabel:t.statusLabel,onChange:e=>Be(()=>ne(e))}),(0,H.jsx)(s,{value:F,options:Ne.map(e=>({value:e,label:e})),placeholder:t.allPlatforms,emptyLabel:t.allPlatforms,ariaLabel:t.platformLabel,onChange:e=>Be(()=>R(e))})]}),U.size>0?(0,H.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-3 rounded-xl bg-accent-soft px-3 py-2`,children:[(0,H.jsx)(`p`,{className:`text-sm font-medium text-accent-fg`,children:t.selectedCount.replace(`{{count}}`,String(U.size))}),(0,H.jsxs)(x,{variant:`secondary`,className:`text-danger`,onClick:()=>{_(!1),p(X.filter(e=>U.has(e.id)))},children:[(0,H.jsx)(re,{className:`size-4`,"aria-hidden":!0}),t.removeSelected]})]}):null,X.length===0?(0,H.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.noDevices}):Z.length===0?(0,H.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.noMatchingDevices}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`flex min-h-10 items-center gap-3 border-b border-edge-subtle px-1`,children:(0,H.jsxs)(`label`,{className:d(`touch-target flex items-center gap-2 text-xs text-fg-muted`,$.length>0?`cursor-pointer`:`cursor-not-allowed opacity-50`),children:[(0,H.jsx)(`input`,{type:`checkbox`,"aria-label":t.selectPage,checked:Ie,disabled:$.length===0,className:`size-4 accent-accent`,onChange:e=>{W(t=>{let n=new Set(t);for(let t of $)e.target.checked?n.add(t):n.delete(t);return n})}}),t.selectPage]})}),(0,H.jsx)(`ul`,{className:`divide-y divide-edge-subtle`,children:Fe.map(e=>{let n=V(e),r=e.kind===`mobile`?C:k;return(0,H.jsxs)(`li`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(`label`,{className:d(`touch-target flex size-10 shrink-0 items-center justify-center`,n===`revoked`?`cursor-not-allowed opacity-40`:`cursor-pointer`),children:(0,H.jsx)(`input`,{type:`checkbox`,checked:U.has(e.id),disabled:n===`revoked`,"aria-label":t.selectDevice.replace(`{{name}}`,e.displayName),className:`size-4 accent-accent`,onChange:t=>{W(n=>{let r=new Set(n);return t.target.checked?r.add(e.id):r.delete(e.id),r})}})}),(0,H.jsxs)(`button`,{type:`button`,className:`touch-target flex min-w-0 flex-1 items-center gap-3 py-3 text-left hover:bg-surface-hover/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>u(e),children:[(0,H.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-inset text-fg-muted`,children:(0,H.jsx)(r,{className:`size-4`,"aria-hidden":!0})}),(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.displayName}),(0,H.jsx)(be,{status:n,label:t.status[n]})]}),(0,H.jsxs)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:[e.platform,` · `,se(e.id),` · `,t.lastSeen,`: `,e.lastSeenAt?Oe.format(e.lastSeenAt):t.never]})]}),(0,H.jsx)(`span`,{className:`hidden shrink-0 text-right text-xs text-fg-muted sm:block`,children:t.endpointSummary.replace(`{{endpoints}}`,String(e.endpoints.length)).replace(`{{tools}}`,String(ie(e)))}),(0,H.jsx)(T,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0})]})]},e.id)})}),(0,H.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-between gap-3 border-t border-edge-subtle pt-3`,children:[(0,H.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.paginationSummary.replace(`{{from}}`,String((Q-1)*K+1)).replace(`{{to}}`,String(Math.min(Q*K,Z.length))).replace(`{{total}}`,String(Z.length))}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(x,{variant:`ghost`,className:`size-9 p-0`,"aria-label":t.previousPage,disabled:Q<=1,onClick:()=>B(e=>Math.max(1,e-1)),children:(0,H.jsx)(o,{className:`size-4`,"aria-hidden":!0})}),(0,H.jsx)(x,{variant:`ghost`,className:`size-9 p-0`,"aria-label":t.nextPage,disabled:Q>=Pe,onClick:()=>B(e=>Math.min(Pe,e+1)),children:(0,H.jsx)(T,{className:`size-4`,"aria-hidden":!0})})]})]})]})]}),(0,H.jsxs)(P,{id:`activity`,activeTab:a,tabIdPrefix:`endpoint-management-tab`,panelIdPrefix:`endpoint-management-panel`,title:t.callsTitle,hint:t.callsHint,children:[(0,H.jsxs)(`div`,{className:`mb-4 grid gap-2 sm:grid-cols-2 lg:grid-cols-4`,children:[(0,H.jsxs)(`label`,{className:`relative block sm:col-span-2 lg:col-span-1`,children:[(0,H.jsx)(`span`,{className:`sr-only`,children:t.searchActivity}),(0,H.jsx)(l,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,H.jsx)(`input`,{type:`search`,"aria-label":t.searchActivity,value:ue,placeholder:t.searchActivity,className:`h-10 w-full rounded-lg border border-edge bg-surface-inset pl-9 pr-3 text-base text-fg placeholder:text-fg-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent sm:text-sm`,onChange:e=>{de(e.target.value),q(1)}})]}),(0,H.jsx)(s,{value:ye,options:X.map(e=>({value:e.id,label:`${e.displayName} · ${se(e.id)}`})),placeholder:t.allDevices,emptyLabel:t.allDevices,ariaLabel:t.deviceLabel,onChange:e=>{xe(e),q(1)}}),(0,H.jsx)(s,{value:Se,options:[{value:`running`,label:t.status.running},{value:`succeeded`,label:t.status.succeeded},{value:`failed`,label:t.status.failed}],placeholder:t.allStatuses,emptyLabel:t.allStatuses,ariaLabel:t.statusLabel,onChange:e=>{Ce(e),q(1)}}),(0,H.jsx)(s,{value:we,options:[{value:`read`,label:t.effects.read},{value:`write`,label:t.effects.write},{value:`destructive`,label:t.effects.destructive}],placeholder:t.allEffects,emptyLabel:t.allEffects,ariaLabel:t.effectLabel,onChange:e=>{Te(e),q(1)}})]}),Y.isLoading&&!Y.data?(0,H.jsx)(I,{sections:1}):null,ke.length===0&&!Y.isLoading?(0,H.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.noMatchingCalls}):null,(0,H.jsx)(`div`,{className:`space-y-2`,children:ke.map(e=>(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-lg bg-surface-base/55 px-3 py-2.5`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`p`,{className:`break-all text-sm font-medium text-fg`,children:e.toolName}),(0,H.jsxs)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:[Oe.format(e.startedAt),` · `,t.effects[e.effect],` · `,e.endpointId]}),e.errorMessage?(0,H.jsx)(`p`,{className:`mt-1 text-xs text-danger`,children:e.errorMessage}):null]}),(0,H.jsx)(be,{status:e.status,label:t.status[e.status]})]},e.id))}),Y.data&&Y.data.total>0?(0,H.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-between gap-3 border-t border-edge-subtle pt-3`,children:[(0,H.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.paginationSummary.replace(`{{from}}`,String((Y.data.page-1)*Y.data.pageSize+1)).replace(`{{to}}`,String(Math.min(Y.data.page*Y.data.pageSize,Y.data.total))).replace(`{{total}}`,String(Y.data.total))}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(x,{variant:`ghost`,className:`size-9 p-0`,"aria-label":t.previousPage,disabled:Y.data.page<=1,onClick:()=>q(e=>Math.max(1,e-1)),children:(0,H.jsx)(o,{className:`size-4`,"aria-hidden":!0})}),(0,H.jsx)(x,{variant:`ghost`,className:`size-9 p-0`,"aria-label":t.nextPage,disabled:Y.data.page>=Y.data.totalPages,onClick:()=>q(e=>Math.min(Y.data.totalPages,e+1)),children:(0,H.jsx)(T,{className:`size-4`,"aria-hidden":!0})})]})]}):null]}),(0,H.jsx)(ce,{device:c,busy:m,onClose:()=>u(null),onRevoke:e=>{u(null),_(!1),p([e])}}),(0,H.jsx)(O,{open:f.length>0,title:f.length>1?t.removeManyTitle:t.removeTitle,description:`${f.length>1?t.removeManyDescription.replace(`{{count}}`,String(f.length)):t.removeDescription.replace(`{{name}}`,f[0]?.displayName??``)}${g?`\n\n${t.revokeError}`:``}`,confirmLabel:m?t.revoking:t.removeDevice,cancelLabel:t.cancel,destructive:!0,onConfirm:()=>void ze(),onCancel:()=>{m||p([])}})]})}export{xe as EndpointToolsManagementSettings};
@@ -1 +0,0 @@
1
- import{t as e}from"./createLucideIcon-DPHK1VkS.js";var t=e(`message-circle`,[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}]]);export{t};
@@ -1 +0,0 @@
1
- import{t as e}from"./createLucideIcon-DPHK1VkS.js";var t=e(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]);export{t};
@@ -1 +0,0 @@
1
- import{r as e}from"./locale-store-BSkKhYkc.js";import{o as t}from"./vendor-swr-BIWyz7Rc.js";import{n}from"./gateway-config-swr-BYMrbKZE.js";import{r}from"./registry-api-tx8XCHOs.js";var i=`models-json-config`,a=`model-catalog`,o=`capability-readiness`;async function s(){await Promise.all([n(),t(e(`/api/providers/meta`)),t(i),t(a),t(o),r()])}export{s as i,i as n,a as r,o as t};
@@ -1 +0,0 @@
1
- import{t as e}from"./createLucideIcon-DPHK1VkS.js";var t=e(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]);export{t};
@@ -1,5 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-Cm1W-14I.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-Cr4SINLG.js","assets/preload-helper-zJ_50EbN.js","assets/es2015-DBLcMg5B.js","assets/vendor-react-BOUWij0V.js","assets/dist-CxGUk8J-.js","assets/dist-CI_fqRk-.js","assets/floating-ui.dom-B7uQOZZW.js","assets/markdown-view-DXubGEic.js","assets/dist-BGTk37IG.js","assets/chunk-KS7C4IRE-BMYIfy9x.js","assets/createLucideIcon-DPHK1VkS.js","assets/download-Dk-ZjtO6.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/locale-store-BSkKhYkc.js","assets/messages-D0G_sZvA.js","assets/cn-JdwAhgNB.js","assets/app-link-C6gA5Nck.js","assets/product-delivery-bv3z8Xkh.js","assets/schemas-88fK3zzl.js","assets/local-apps-Bpja8nC6.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/markdown-view-DSjfHfaW.css","assets/dist-Che_jiQF.js","assets/vendor-swr-BIWyz7Rc.js","assets/check-DUBLcKHA.js","assets/popover-select-DcsFzD_i.js","assets/dist-3h6cXXhT.js","assets/skeleton-BwbyijEw.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/settings-shell-layer-context-BTQUDoJ2.js","assets/circle-check-C23XjkUj.js","assets/clock-3-DnrAnuyZ.js","assets/copy-Dv6d4Dvw.js","assets/ellipsis-0k4rZLoy.js","assets/external-link-DjqjBmc3.js","assets/eye-CABVeTq0.js","assets/folder-open-CyzJ19I9.js","assets/git-branch-Dh9uxTot.js","assets/globe-DSSGFWFn.js","assets/link-2-D_ZKYUW7.js","assets/loader-circle-CifKLtgG.js","assets/message-circle-Badhj-4D.js","assets/message-square-plus-XP0tGdlV.js","assets/message-square-fVE7Ghj1.js","assets/minimize-2-DtOGrlpo.js","assets/pencil-DmIY3Oa-.js","assets/rotate-cw-LIg3Am9S.js","assets/search-DA7gz22f.js","assets/middleware-Pd0e8Igk.js","assets/capabilities-sAZT4brT.js","assets/tasks-CDR_RVbQ.js","assets/conversation-identity-Cw0n9uzK.js","assets/files-BK6enEvD.js","assets/tool-activity-BtJkgjFf.js","assets/turn-outcome-D0SnyZ3Z.js","assets/button-CS04eWY9.js","assets/registry-api-tx8XCHOs.js","assets/gateway-startup-retry-DMqYXHAn.js","assets/gateway-config-swr-BYMrbKZE.js","assets/models-hub-cache-B0EUPwTv.js","assets/electron-env-Dit0bHgy.js","assets/is-masked-secret-DOkL5b_X.js","assets/index-C4QN4gCi.css","assets/vendor-codemirror-DFxP3B9T.js","assets/list-BBGUdmkF.js","assets/with-selector-aYPsXwdl.js","assets/note-image-lightbox-1qg2v-9j.js","assets/block-editor-BdOTO0Yo.css","assets/markdown-editor-BhBJANcx.js","assets/code-editor-CXIH8jQw.js","assets/languages-BFe8nIOO.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{f as a,t as o}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as s}from"./createLucideIcon-DPHK1VkS.js";import{t as c}from"./check-DUBLcKHA.js";import{n as l,r as u}from"./popover-select-DcsFzD_i.js";import{t as d}from"./circle-check-C23XjkUj.js";import{t as f}from"./copy-Dv6d4Dvw.js";import{t as p}from"./download-Dk-ZjtO6.js";import{t as m}from"./ellipsis-0k4rZLoy.js";import{t as h}from"./external-link-DjqjBmc3.js";import{t as g}from"./eye-CABVeTq0.js";import{t as _}from"./loader-circle-CifKLtgG.js";import{t as v}from"./message-circle-Badhj-4D.js";import{t as y}from"./pencil-DmIY3Oa-.js";import{t as b}from"./search-DA7gz22f.js";import{t as x}from"./x-B_N4OPjy.js";import{t as S}from"./messages-D0G_sZvA.js";import{t as C}from"./cn-JdwAhgNB.js";import{a as w,c as T,f as E,n as D,r as O}from"./locale-store-BSkKhYkc.js";import{a as k,i as A,n as j,o as M,r as N,s as P,t as F}from"./dist-BGTk37IG.js";import{t as I}from"./copy-to-clipboard-HOJ79TWv.js";import{i as L}from"./vendor-swr-BIWyz7Rc.js";import{t as R}from"./button-CS04eWY9.js";import{t as ee}from"./skeleton-BwbyijEw.js";import{$l as te,$n as z,Ac as ne,Al as re,Bn as ie,Eo as B,Fr as ae,Gn as oe,Go as se,Hn as ce,I as V,Ic as le,Ir as ue,Jn as H,Kn as de,L as fe,Mt as pe,Nr as U,Oc as me,Pc as W,Pr as G,Qn as he,Tl as ge,Un as _e,Vc as ve,Vn as ye,Wl as be,Wn as xe,Xc as K,Xn as Se,Yn as Ce,Zn as we,a as Te,aa as Ee,ar as De,c as Oe,ca as ke,cn as Ae,dr as je,er as Me,fr as Ne,gr as Pe,j as Fe,ka as Ie,kc as Le,l as Re,la as ze,ln as Be,lr as Ve,mr as He,na as q,nr as J,o as Ue,pr as We,qc as Ge,rr as Ke,s as qe,ta as Je,ts as Ye,ur as Xe,vl as Ze,zn as Qe}from"./index-Cr4SINLG.js";import{n as $e,t as et}from"./note-image-lightbox-1qg2v-9j.js";import{t as Y}from"./page-context-capture-button-C3JiQEKD.js";var X=s(`arrow-down-to-line`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),tt=s(`bookmark`,[[`path`,{d:`M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z`,key:`oz39mx`}]]),nt=s(`lightbulb`,[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]),Z=e(t(),1),rt=n(),Q=r(),it=6e4,at=36e5,ot=864e5;function st(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function $(e,t,n){let r=t-e;if(r<it)return n.justNow;if(r<at){let e=Math.floor(r/it);return n.minutesAgo.replace(`{{n}}`,String(e))}let i=st(t);if(e>=i)return n.today+` `+new Date(e).toLocaleTimeString(n.locale,{hour:`2-digit`,minute:`2-digit`});if(e>=i-ot)return n.yesterday+` `+new Date(e).toLocaleTimeString(n.locale,{hour:`2-digit`,minute:`2-digit`});if(r<7*ot){let e=Math.floor(r/ot);return n.daysAgo.replace(`{{n}}`,String(e))}return new Date(e).toLocaleDateString(n.locale,{month:`short`,day:`numeric`})}function ct(e,t,n){let r=st(t);if(e>=r)return n.today;if(e>=r-ot)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 lt(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function ut(e){let t=(0,rt.c)(45),{title:n,description:r,prompt:i,coverage:o,className:s,variant:c}=e,l=c===void 0?`card`:c,u=D(pt),f=S(u).automations.suggestions,p=S(u).automations,m=a(),h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h={revalidateOnFocus:!1,refreshInterval:15e3},t[0]=h):h=t[0];let{data:g}=L(o?`automation-suggestion-coverage`:null,ft,h),_=o?g?.automations.find(e=>Oe(e,o)):void 0,v=_?Ue(_,p):[];if(l===`titleAction`){if(_){let e;t[1]===s?e=t[2]:(e=C(`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`,s),t[1]=s,t[2]=e);let n;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(d,{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,Q.jsxs)(`section`,{className:e,children:[n,(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,children:f.coveredTitle}),(0,Q.jsx)(R,{variant:`ghost`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:r,children:f.manage})]})}let e;t[6]===s?e=t[7]:(e=C(`flex min-w-0 items-center gap-2 rounded-lg bg-surface-panel px-2.5 py-1.5 shadow-surface`,s),t[6]=s,t[7]=e);let a;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(nt,{className:`size-3.5 shrink-0 text-accent`,"aria-hidden":!0}),t[8]=a):a=t[8];let o;t[9]!==r||t[10]!==n?(o=(0,Q.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]=o):o=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,Q.jsx)(le,{className:`size-3.5`,"aria-hidden":!0}),t[15]=l):l=t[15],(0,Q.jsxs)(`section`,{className:e,children:[a,o,(0,Q.jsxs)(R,{variant:`secondary`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:c,children:[l,f.setup]})]})}if(_){let e;t[16]===s?e=t[17]:(e=C(`rounded-lg border border-emerald-500/25 bg-emerald-500/10 p-3`,s),t[16]=s,t[17]=e);let n;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(d,{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]!==f||t[22]!==r?(i=(0,Q.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Q.jsx)(R,{variant:`ghost`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:r,children:f.manage})}),t[21]=f,t[22]=r,t[23]=i):i=t[23],(0,Q.jsxs)(`section`,{className:e,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-2`,children:[n,(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:f.coveredTitle}),(0,Q.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:qe(f.coveredDescription,{name:_.name})})]})]}),(0,Q.jsxs)(`div`,{className:`mt-2 rounded-md bg-surface-base/55 px-2.5 py-2`,children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg`,children:p.explain.whyCovered}),(0,Q.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:v.map(dt)})]}),i]})}let y;t[24]===s?y=t[25]:(y=C(`rounded-lg bg-surface-panel p-3 shadow-surface`,s),t[24]=s,t[25]=y);let b;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(nt,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[26]=b):b=t[26];let x;t[27]===n?x=t[28]:(x=(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n}),t[27]=n,t[28]=x);let w;t[29]===r?w=t[30]:(w=(0,Q.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:r}),t[29]=r,t[30]=w);let T;t[31]!==x||t[32]!==w?(T=(0,Q.jsxs)(`div`,{className:`flex items-start gap-2`,children:[b,(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[x,w]})]}),t[31]=x,t[32]=w,t[33]=T):T=t[33];let E;t[34]!==m||t[35]!==i?(E=()=>{m(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[34]=m,t[35]=i,t[36]=E):E=t[36];let O;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(le,{className:`size-3.5`,"aria-hidden":!0}),t[37]=O):O=t[37];let k;t[38]!==f.create||t[39]!==E?(k=(0,Q.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Q.jsxs)(R,{variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:E,children:[O,f.create]})}),t[38]=f.create,t[39]=E,t[40]=k):k=t[40];let A;return t[41]!==k||t[42]!==y||t[43]!==T?(A=(0,Q.jsxs)(`section`,{className:y,children:[T,k]}),t[41]=k,t[42]=y,t[43]=T,t[44]=A):A=t[44],A}function dt(e){return(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function ft(){return Re.list()}function pt(e){return e.language}function mt(e){let t=(0,rt.c)(51),{initial:n,zh:r,busy:i,onClose:a,onSave:o}=e,[s,c]=(0,Z.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,Q.jsx)(k,{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,Q.jsx)(`header`,{className:`border-b border-edge p-4`,children:(0,Q.jsx)(P,{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,Q.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,Q.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,Q.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,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`label`,{className:`block text-sm`,children:[r?`负责人原话`:`Owner as stated`,(0,Q.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,Q.jsxs)(`label`,{className:`block text-sm`,children:[r?`期限原话`:`Date as stated`,(0,Q.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,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,Q.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,Q.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,Q.jsx)(R,{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,Q.jsx)(R,{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,Q.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 A;t[44]!==x||t[45]!==O||t[46]!==f?(A=(0,Q.jsxs)(M,{children:[u,(0,Q.jsxs)(N,{"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]=A):A=t[47];let j;return t[48]!==l||t[49]!==A?(j=(0,Q.jsx)(F,{open:!0,onOpenChange:l,children:A}),t[48]=l,t[49]=A,t[50]=j):j=t[50],j}function ht(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 gt=e=>`${String(Math.floor(e/6e4)).padStart(2,`0`)}:${String(Math.floor(e/1e3)%60).padStart(2,`0`)}`;function _t({noteId:e}){let t=D(e=>e.language)===`zh`,{data:n,mutate:r,isLoading:i}=L([`note-discussion-document`,e],()=>Ae(e),{refreshInterval:e=>e&&([`recording`,`stopping`,`sealing`,`organizing`].includes(e.discussion.status)||e.recordingJob?.state===`queued`||e.recordingJob?.state===`running`)?3e3:0}),a=n?.discussion.id,s=`/api/discussions/${encodeURIComponent(a??``)}`,{data:d=[],mutate:f}=L(a?`${s}/actions`:null,e=>w(O(e)),{refreshInterval:1e4}),[m,h]=(0,Z.useState)(`summary`),[g,_]=(0,Z.useState)(``),[v,y]=(0,Z.useState)(`general`),[S,C]=(0,Z.useState)(null),[T,E]=(0,Z.useState)(null),[A,j]=(0,Z.useState)(null),[I,te]=(0,Z.useState)(!1),[z,ne]=(0,Z.useState)([]),[re,ie]=(0,Z.useState)(null),[B,ae]=(0,Z.useState)(!1),[oe,se]=(0,Z.useState)(1),ce=(0,Z.useRef)(null),V=(0,Z.useRef)(null),[le,ue]=(0,Z.useState)(0);(0,Z.useEffect)(()=>{let e=()=>{r(),f()};return window.addEventListener(`discussion-updated`,e),window.addEventListener(`discussion-segment-updated`,e),()=>{window.removeEventListener(`discussion-updated`,e),window.removeEventListener(`discussion-segment-updated`,e)}},[r,f]),(0,Z.useEffect)(()=>{n?.discussion.template&&y(n.discussion.template)},[n?.discussion.template]);async function H(e){if(!B){ae(!0),ie(null);try{await e(),await r(),await f()}catch(e){ie(e instanceof Error?e.message:String(e))}finally{ae(!1)}}}function de(e){ce.current&&(ce.current.readyState===0?(V.current=e/1e3,ce.current.load()):ce.current.currentTime=e/1e3,ce.current.play().catch(()=>void 0))}async function fe(e,t){n?.organization&&await H(async()=>{C((await w(O(`${s}/transcript?revision=${t??n.organization.transcriptRevision}`))).segments.filter(t=>e.includes(t.sequence)))})}let pe=(e,n,r)=>n.some(e=>I||!e.ignored)?(0,Q.jsxs)(`section`,{className:`space-y-2`,children:[(0,Q.jsx)(`h3`,{className:`font-semibold text-fg`,children:e}),n.filter(e=>I||!e.ignored).map(e=>(0,Q.jsxs)(`div`,{className:`flex items-start gap-3 text-sm`,children:[(0,Q.jsxs)(`p`,{className:`flex-1 whitespace-pre-wrap`,children:[e.text,e.supersededBy||e.disputedBy?(0,Q.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:t?`有后续变更`:`Later changes`}):null,e.editedByUser?(0,Q.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:t?e.ignored?`已忽略`:`人工编辑`:e.ignored?`Ignored`:`Edited`}):null]}),(0,Q.jsx)(`button`,{className:`text-xs text-fg-muted`,disabled:B,onClick:()=>j({kind:r,itemId:e.id,text:e.text,ignored:e.ignored}),children:t?`编辑`:`Edit`}),e.evidenceSegmentIds.length?(0,Q.jsx)(`button`,{disabled:B,className:`shrink-0 text-accent-fg`,onClick:()=>void fe(e.evidenceSegmentIds,e.evidenceRevision),children:t?`原话`:`Source`}):(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:t?`暂无定位`:`No source timing`})]},e.id))]}):null;if(i)return(0,Q.jsx)(ee,{className:`h-48 w-full`});if(!n)return null;let{discussion:U,transcript:me,organization:W}=n,G=W?.organization,he=[`stopping`,`sealing`,`organizing`].includes(U.status),_e=[`recording`,`completed`,`needs_attention`].includes(U.status),ve=me.segments.filter(e=>(e.displayText??e.rawText??``).toLocaleLowerCase().includes(g.toLocaleLowerCase())||e.speakerLabel?.toLocaleLowerCase().includes(g.toLocaleLowerCase())),ye=ht(n,m,{query:g,page:oe,showIgnored:I});return(0,Q.jsxs)(`section`,{className:`relative flex h-full min-h-0 w-full flex-col text-fg`,children:[(0,Q.jsxs)(`header`,{className:`flex shrink-0 flex-wrap items-center gap-3 border-b border-edge-subtle p-4`,children:[(0,Q.jsx)(ge,{className:`size-4 text-accent`}),(0,Q.jsxs)(`span`,{className:`text-sm font-medium`,children:[gt(U.durationMs??0),` · `,he?t?`正在整理`:`Processing`:U.status===`completed`?t?`整理完成`:`Ready`:U.status]}),(0,Q.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,Q.jsxs)(l,{value:v,"aria-label":t?`纪要模板`:`Summary template`,onChange:e=>y(e.target.value),children:[(0,Q.jsx)(u,{value:`general`,children:t?`通用会议`:`General`}),(0,Q.jsx)(u,{value:`project`,children:t?`项目例会`:`Project`}),(0,Q.jsx)(u,{value:`review`,children:t?`需求评审`:`Review`}),(0,Q.jsx)(u,{value:`interview`,children:t?`客户访谈`:`Interview`})]}),(0,Q.jsxs)(R,{disabled:B||he||!U.canonicalTranscript,onClick:()=>void H(()=>w(O(`${s}/organize`),{method:`POST`,body:JSON.stringify({template:v})})),children:[(0,Q.jsx)(Ge,{className:`size-3.5`}),t?`重新整理`:`Regenerate`]})]})]}),(0,Q.jsxs)(`nav`,{"aria-label":t?`会议内容`:`Meeting content`,className:`flex shrink-0 items-center gap-4 border-b border-edge-subtle px-4 py-2 text-sm`,children:[[`summary`,`transcript`].map(e=>(0,Q.jsx)(`button`,{className:m===e?`font-medium text-accent-fg`:`text-fg-muted`,onClick:()=>h(e),children:e===`summary`?t?`纪要与行动`:`Summary & actions`:t?`逐字稿`:`Transcript`},e)),(0,Q.jsxs)(`div`,{className:`ml-auto flex items-center gap-2 text-xs`,children:[(0,Q.jsx)(p,{className:`size-3`}),[`md`,`txt`,`srt`].map(e=>(0,Q.jsx)(`a`,{className:`text-accent-fg`,href:O(`${s}/export?format=${e}`),download:!0,children:e.toUpperCase()},e))]})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-edge-subtle px-4 py-2`,children:[(0,Q.jsx)(Y,{resource:{kind:`note`,id:e,revision:String(n.note.remoteVersion??1)},selection:{text:ye,draft:!1},label:t?`引用当前会议内容到新对话`:`Reference displayed meeting content`,disabled:B||he||!!(A||T)||!ye||ye.length>16e3}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:ye.length>16e3?t?`内容超过 16,000 字符,请筛选更少的逐字稿内容后重试。`:`Over 16,000 characters. Filter fewer transcript segments and try again.`:t?`仅附带当前纪要或已加载的筛选逐字稿,不含录音;作为用户提供的文本。`:`Includes this summary or loaded filtered transcript only, not audio; treated as user-provided text.`})]}),re?(0,Q.jsx)(`p`,{role:`alert`,className:`px-4 py-2 text-sm text-danger`,children:re}):null,n.recordingJob?.state===`queued`||n.recordingJob?.state===`running`?(0,Q.jsx)(`p`,{role:`status`,className:`px-4 py-2 text-sm text-fg-muted`,children:t?`录音已上传,正在后台校验与保存。关闭此页面不会中断处理。`:`Recording uploaded. Verification and saving continue in the background, even if you close this page.`}):null,U.status===`needs_attention`?(0,Q.jsxs)(`div`,{className:`flex gap-2 p-4 text-sm text-danger`,children:[(0,Q.jsx)(`span`,{children:U.failureMessage}),(0,Q.jsx)(`button`,{disabled:B,onClick:()=>void H(()=>Be(U.id)),children:t?`重试`:`Retry`})]}):null,W&&W.transcriptRevision!==me.revision?(0,Q.jsx)(`p`,{className:`px-4 py-2 text-xs text-fg-muted`,children:t?`转写已修改,当前纪要引用的是修改前版本。重新整理可生成新版纪要。`:`Transcript changed. This summary cites the previous revision; regenerate to update.`}):null,(0,Q.jsx)(`main`,{className:`min-h-0 flex-1 overflow-y-auto p-4 sm:p-6`,children:m===`summary`?G?(0,Q.jsxs)(`div`,{className:`mx-auto max-w-3xl space-y-6`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:G.summaryEditedByUser?t?`概要已人工编辑`:`Overview edited`:``}),(0,Q.jsx)(`button`,{disabled:B||he,onClick:()=>j({kind:`summary`,itemId:`summary`,text:G.summary}),children:t?`编辑概要`:`Edit overview`})]}),(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-7`,children:G.summary}),(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:I,onChange:e=>te(e.target.checked)}),t?`显示已忽略项`:`Show ignored items`]}),z.length?(0,Q.jsx)(R,{disabled:B,onClick:()=>void H(async()=>{for(let e of z)await w(O(`${s}/actions/${encodeURIComponent(e)}/convert`),{method:`POST`,body:JSON.stringify({organizationRevision:W.revision})});ne([])}),children:t?`加入所选 ${z.length} 项任务`:`Add ${z.length} selected tasks`}):null,pe(t?`已决定事项`:`Decisions`,G.decisions,`decisions`),G.actionItems.length?(0,Q.jsxs)(`section`,{className:`space-y-3`,children:[(0,Q.jsx)(`h3`,{className:`font-semibold`,children:t?`下一步行动`:`Next actions`}),G.actionItems.filter(e=>I||!e.ignored).map(e=>{let n=d.find(t=>t.actionId===e.id);return(0,Q.jsxs)(`article`,{className:`rounded-lg border border-edge-subtle p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-2`,children:[!n&&!e.ignored&&(!(e.supersededBy||e.disputedBy)||e.reviewedChangeId===(e.supersededBy??e.disputedBy))?(0,Q.jsx)(`input`,{type:`checkbox`,"aria-label":`${t?`选择行动`:`Select action`}: ${e.title}`,className:`ui-checkbox`,checked:z.includes(e.id),onChange:t=>ne(t.target.checked?[...z,e.id]:z.filter(t=>t!==e.id))}):null,(0,Q.jsxs)(`p`,{className:`flex-1 text-sm font-medium`,children:[e.title,e.supersededBy||e.disputedBy?(0,Q.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:t?`有后续变更,请复核`:`Review later changes`}):null,e.editedByUser?(0,Q.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:t?e.ignored?`已忽略`:`人工编辑`:e.ignored?`Ignored`:`Edited`}):null]}),(0,Q.jsx)(`button`,{className:`text-xs text-fg-muted`,disabled:B||he,onClick:()=>j({kind:`actionItems`,itemId:e.id,text:e.title,owner:e.owner,dueDate:e.dueDate,ignored:e.ignored}),children:t?`编辑`:`Edit`})]}),(0,Q.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[e.owner??(t?`负责人未明确`:`Owner unspecified`),` · `,e.dueDate??(t?`期限未明确`:`Date unspecified`)]}),(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-3 text-xs`,children:[e.evidenceSegmentIds.length?(0,Q.jsx)(`button`,{disabled:B,className:`text-accent-fg`,onClick:()=>void fe(e.evidenceSegmentIds,e.evidenceRevision),children:t?`查看原话`:`Source`}):null,n?n.deleted?(0,Q.jsx)(`span`,{children:t?`关联任务已删除`:`Linked task deleted`}):(0,Q.jsx)(o,{className:`text-accent-fg`,to:`/tasks/${encodeURIComponent(n.taskId)}`,children:n.resolution===`done`?t?`已完成 · 查看任务`:`Done · View task`:t?`查看任务 / 交给助手`:`View task / Delegate`}):e.ignored?null:(0,Q.jsx)(R,{disabled:B||!!(e.supersededBy||e.disputedBy)&&e.reviewedChangeId!==(e.supersededBy??e.disputedBy),onClick:()=>void H(()=>w(O(`${s}/actions/${encodeURIComponent(e.id)}/convert`),{method:`POST`,body:JSON.stringify({organizationRevision:W.revision})})),children:t?`加入我的任务`:`Add to my tasks`})]})]},e.id)})]}):null,pe(t?`风险`:`Risks`,G.risks,`risks`),pe(t?`尚未确定`:`Open questions`,G.openQuestions,`openQuestions`),G.changes?.length?(0,Q.jsxs)(`section`,{className:`space-y-3`,children:[(0,Q.jsx)(`h3`,{className:`font-semibold`,children:t?`前后变更`:`Changes during the meeting`}),G.changes.map(e=>{let n=[...G.decisions,...G.actionItems,...G.risks,...G.openQuestions],r=n.find(t=>t.id===e.fromId),i=n.find(t=>t.id===e.toId);return!r||!i?null:(0,Q.jsxs)(`article`,{className:`space-y-2 rounded border border-edge p-3 text-sm`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.relation===`supersedes`?t?`后续撤销或替代`:`Later superseded`:t?`存在冲突,尚未明确解决`:`Unresolved conflict`}),(0,Q.jsx)(`button`,{className:`block text-left text-accent-fg`,onClick:()=>void fe(r.evidenceSegmentIds,r.evidenceRevision),children:`title`in r?r.title:r.text}),(0,Q.jsx)(`span`,{children:`↓`}),(0,Q.jsx)(`button`,{className:`block text-left text-accent-fg`,onClick:()=>void fe(i.evidenceSegmentIds,i.evidenceRevision),children:`title`in i?i.title:i.text})]},`${e.fromId}:${e.toId}`)})]}):null,G.chapters.length?(0,Q.jsxs)(`section`,{className:`space-y-3`,children:[(0,Q.jsx)(`h3`,{className:`font-semibold`,children:t?`章节回顾`:`Chapters`}),G.chapters.map((e,t)=>(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`button`,{className:`text-sm text-accent-fg`,onClick:()=>de(e.startedAtMs),children:[gt(e.startedAtMs),` · `,e.title]}),(0,Q.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap text-sm text-fg-muted`,children:e.summary})]},t))]}):null]}):(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:he?t?`录音已保存,纪要正在生成。可以先查看逐字稿。`:`Recording saved. Summary is processing; you can read the transcript.`:t?`录音结束后自动生成纪要。`:`Summary appears after recording ends.`}),he?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(ee,{className:`h-6 w-3/4`}),(0,Q.jsx)(ee,{className:`h-24 w-full`})]}):null]}):(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md border border-edge px-3`,children:[(0,Q.jsx)(b,{className:`size-4 text-fg-muted`}),(0,Q.jsx)(`input`,{className:`w-full bg-transparent py-2 text-sm outline-none`,placeholder:t?`查找原话或说话人`:`Search words or speaker`,value:g,onChange:e=>{_(e.target.value),se(1)}})]}),ve.slice(0,oe*50).map(e=>(0,Q.jsxs)(`article`,{className:`rounded-md border p-3 ${le>=e.startedAtMs&&le<e.endedAtMs?`border-accent`:`border-edge-subtle`}`,children:[(0,Q.jsxs)(`div`,{className:`mb-2 flex items-center gap-3 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`button`,{className:`inline-flex items-center gap-1 text-accent-fg`,onClick:()=>de(e.startedAtMs),children:[(0,Q.jsx)(K,{className:`size-3`}),gt(e.startedAtMs)]}),(0,Q.jsx)(`span`,{children:e.speakerLabel??(t?`未区分说话人`:`Speaker unknown`)}),_e&&e.status===`confirmed`?(0,Q.jsx)(`button`,{className:`ml-auto`,onClick:()=>E({segment:e,text:e.displayText??e.rawText??``,speaker:e.speakerLabel??``}),children:t?`校对`:`Edit`}):null]}),(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-6`,children:e.displayText??e.rawText??(t?`等待转写`:`Awaiting transcription`)})]},e.sequence)),ve.length>oe*50?(0,Q.jsx)(R,{onClick:()=>se(oe+1),children:t?`加载更多`:`More`}):null]})}),U.audioAttachmentId&&!U.audioDeletedAt?(0,Q.jsxs)(`footer`,{className:`shrink-0 border-t border-edge-subtle p-3`,children:[(0,Q.jsx)(`audio`,{ref:ce,controls:!0,preload:`metadata`,className:`h-10 w-full`,src:O(`${s}/audio`),onTimeUpdate:()=>ue((ce.current?.currentTime??0)*1e3),onLoadedMetadata:()=>{V.current!==null&&ce.current&&(ce.current.currentTime=V.current,V.current=null)},onError:()=>ie(t?`录音暂不可播放`:`Recording unavailable`)}),(0,Q.jsx)(`a`,{className:`mt-1 block text-right text-xs text-accent-fg`,href:O(`${s}/audio`),download:!0,children:t?`下载录音`:`Download recording`})]}):null,S?(0,Q.jsxs)(`aside`,{"aria-label":t?`原话证据`:`Source evidence`,className:`absolute inset-y-0 right-0 z-10 flex w-[min(26rem,100%)] flex-col border-l border-edge bg-surface-panel`,children:[(0,Q.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b border-edge p-4`,children:[(0,Q.jsx)(`h3`,{children:t?`原话证据`:`Source evidence`}),(0,Q.jsx)(`button`,{"aria-label":t?`关闭`:`Close`,onClick:()=>C(null),children:(0,Q.jsx)(x,{className:`size-4`})})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-4`,children:S.length?S.map(e=>(0,Q.jsxs)(`article`,{children:[(0,Q.jsxs)(`button`,{className:`mb-2 text-xs text-accent-fg`,onClick:()=>de(e.startedAtMs),children:[gt(e.startedAtMs),` · `,e.speakerLabel??(t?`说话人未明确`:`Unknown speaker`)]}),(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-7`,children:e.displayText??e.rawText})]},e.sequence)):(0,Q.jsx)(`p`,{children:t?`此版本暂无可定位原话。`:`No timed source available for this revision.`})})]}):null,A&&W?(0,Q.jsx)(mt,{initial:A,zh:t,busy:B,onClose:()=>j(null),onSave:e=>H(async()=>{await w(O(`${s}/summary`),{method:`PATCH`,body:JSON.stringify({...e,expectedRevision:W.revision})}),j(null)})},`${A.kind}:${A.itemId}:${W.revision}`):null,T?(0,Q.jsx)(F,{open:!0,onOpenChange:e=>{e||E(null)},children:(0,Q.jsxs)(M,{children:[(0,Q.jsx)(k,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(N,{"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,Q.jsxs)(`header`,{className:`flex items-center justify-between border-b border-edge p-4`,children:[(0,Q.jsx)(P,{children:t?`校对逐字稿`:`Edit transcript`}),(0,Q.jsx)(`button`,{"aria-label":t?`关闭校对`:`Close editor`,onClick:()=>E(null),children:(0,Q.jsx)(x,{className:`size-4`})})]}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-3 overflow-y-auto p-4`,children:[(0,Q.jsxs)(`label`,{className:`block text-xs`,children:[t?`本段说话人`:`Speaker for this segment`,(0,Q.jsx)(`input`,{className:`mt-1 w-full rounded border border-edge bg-surface-inset p-2 text-sm`,value:T.speaker,onChange:e=>E({...T,speaker:e.target.value})})]}),T.segment.speakerLabel?(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:!!T.applyToSpeakerGroup,onChange:e=>E({...T,applyToSpeakerGroup:e.target.checked})}),t?`同时更名所有同标签片段;输入已有标签可合并说话人`:`Rename all segments with this label; use an existing label to merge speakers`]}):null,(0,Q.jsx)(`textarea`,{className:`min-h-32 w-full rounded border border-edge bg-surface-inset p-2 text-sm`,value:T.text,onChange:e=>E({...T,text:e.target.value})})]}),(0,Q.jsx)(`footer`,{className:`border-t border-edge p-3`,children:(0,Q.jsxs)(R,{variant:`primary`,disabled:B||!T.text.trim(),onClick:()=>void H(async()=>{await w(O(`${s}/segments/${T.segment.sequence}`),{method:`PATCH`,body:JSON.stringify({displayText:T.text,speakerLabel:T.speaker,expectedRevision:T.segment.revision,applyToSpeakerGroup:T.applyToSpeakerGroup,expectedTranscriptRevision:me.revision})}),E(null)}),children:[(0,Q.jsx)(c,{className:`size-4`}),t?`保存修订`:`Save revision`]})})]})]})}):null]})}var vt={edit:y,ai_edit:le,sync:Ge,restore:X};function yt(e,t){return{edit:t.triggerEdit,ai_edit:t.triggerAiEdit,sync:t.triggerSync,restore:t.triggerRestore}[e]??e}function bt({noteId:e,activeTimestamp:t,onSelect:n,onClose:r,onRestored:i}){let a=D(e=>e.language),o=S(a).notes,s={justNow:o.justNow,minutesAgo:o.minutesAgo,today:o.today,yesterday:o.yesterday,daysAgo:o.daysAgo,locale:E(a)},{data:c}=L(e?[`note-history`,e]:null,()=>Me(e)),[l,u]=(0,Z.useState)(!1),[d,f]=(0,Z.useState)(null),[p,m]=(0,Z.useState)(null),h=(0,Z.useCallback)(async t=>{u(!0),m(null);try{await We(e,t),f(null),i()}catch{m(o.restoreFailed)}finally{u(!1)}},[e,o.restoreSuccess,o.restoreFailed,i]),g=Date.now();return(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,Q.jsx)(Ze,{className:`size-4`,"aria-hidden":!0}),o.history]}),(0,Q.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,Q.jsx)(x,{className:`size-4`,"aria-hidden":!0})})]}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[p?(0,Q.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,Q.jsx)(`ul`,{className:`divide-y divide-edge`,children:c.map(e=>{let r=vt[e.trigger]??y,i=t===e.timestamp,a=d===e.timestamp;return(0,Q.jsxs)(`li`,{children:[(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:C(`w-full px-4 py-3 text-left transition-colors`,i?`bg-accent/10`:`hover:bg-surface-hover`),children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(r,{className:`size-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:yt(e.trigger,o)}),(0,Q.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:$(e.timestamp,g,s)})]}),e.snippet&&(0,Q.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted/60`,children:e.snippet})]}),i&&(0,Q.jsx)(`div`,{className:`border-t border-edge/50 px-4 py-2`,children:a?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-xs text-fg-muted`,children:o.restoreConfirm}),(0,Q.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,Q.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,Q.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,Q.jsxs)(`div`,{className:`px-4 py-8 text-center`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:o.historyEmpty}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted/60`,children:o.historyEmptyDescription})]})]})]})}function xt({noteId:e,note:t,catalyzing:n,onCatalyze:r,onClose:i,noteThreads:o,openingChat:s,onOpenChat:c,onOpenNewChat:l}){let u=S(D(e=>e.language)).notes,d=a(),f=t?.aiDeep?.catalysis,p=f?.report??null,[m,h]=(0,Z.useState)(null),[g,_]=(0,Z.useState)(!1),{data:y,mutate:b,isLoading:x}=L(e?[`note-agent-context-status`,e]:null,()=>we(e),{revalidateOnFocus:!1}),w=(0,Z.useCallback)(async()=>{if(!g){_(!0),h(null);try{await b(()=>Ve(e),{revalidate:!1})}catch(e){h(`${u.contextRebuildFailed}: ${e instanceof Error?e.message:u.quickCaptureFailedHint}`)}finally{_(!1)}}},[g,b,u.contextRebuildFailed,u.quickCaptureFailedHint,e]),T=(0,Z.useCallback)(async t=>{try{await Xe(e,t)}catch{}},[e]);return(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(le,{className:`size-4 text-accent`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:u.catalysisSectionTitle})]}),(0,Q.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,Q.jsx)(te,{className:`size-4 rotate-180`,"aria-hidden":!0})})]}),(0,Q.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:[(0,Q.jsx)(`p`,{className:`mb-4 text-xs leading-relaxed text-fg-muted`,children:u.catalysisSectionDescription}),y?(0,Q.jsxs)(`section`,{className:`mb-4 rounded-xl bg-surface-base p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.contextStatusTitle}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void w(),disabled:x||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,Q.jsx)(`span`,{className:C(`rounded-full px-2 py-0.5 text-[11px] font-medium`,y.status===`ready`?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-300`:y.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:y.status})]}),(0,Q.jsx)(`div`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:u.contextStatusDetail.replace(`{{attachments}}`,String(y.attachments.length)).replace(`{{tokens}}`,String(y.tokenEstimate??0))}),m?(0,Q.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,y.attachments.length>0?(0,Q.jsx)(`div`,{className:`mt-3 space-y-1.5`,children:y.attachments.slice(0,5).map(e=>(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-lg bg-surface-hover px-2 py-1.5 text-xs`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.fileName}),(0,Q.jsx)(`span`,{className:`shrink-0 text-fg-muted`,children:e.status})]},e.attachmentId))}):null]}):null,(0,Q.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,Q.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.valueHypothesis}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg`,children:p.valueHypothesis})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.targetUsers}),(0,Q.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:p.targetUsers.slice(0,5).map(e=>(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg`,children:e},e))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.keyQuestions}),(0,Q.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.keyQuestions.slice(0,3).map(e=>(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-accent`}),(0,Q.jsx)(`span`,{children:e})]},e))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.mvpPathLabel}),(0,Q.jsx)(`ol`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.mvpPath.slice(0,3).map((e,t)=>(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsxs)(`span`,{className:`text-fg-muted`,children:[t+1,`.`]}),(0,Q.jsx)(`span`,{children:e})]},e))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.risks}),(0,Q.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.risks.slice(0,3).map(e=>(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-fg-muted`}),(0,Q.jsx)(`span`,{children:e})]},e))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.nextActions}),(0,Q.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.nextActions.slice(0,4).map(e=>(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsx)(`span`,{className:`rounded bg-accent/10 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-accent`,children:e.kind}),(0,Q.jsx)(`span`,{children:e.text})]},`${e.kind}:${e.text}`))})]}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:u.confidenceLabel.replace(`{{percent}}`,String(Math.round(p.confidence*100)))}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void T(`helpful`),className:C(`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,Q.jsx)(Le,{className:`size-3.5`,"aria-hidden":!0})}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void T(`not_helpful`),className:C(`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,Q.jsx)(ne,{className:`size-3.5`,"aria-hidden":!0})})]})]})]}):(0,Q.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,Q.jsxs)(`section`,{className:`mt-6 rounded-xl bg-surface-base p-4`,children:[(0,Q.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,Q.jsx)(v,{className:`size-4 text-accent`,"aria-hidden":!0}),u.relatedThreadsTitle]}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:u.relatedThreadsDescription})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:c,disabled:s,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:s?u.openingChat:u.openThread}),(0,Q.jsx)(`button`,{type:`button`,onClick:l,disabled:s,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})]})]}),o.length>0?(0,Q.jsx)(`div`,{className:`space-y-2`,children:o.slice(0,5).map(e=>(0,Q.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,Q.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.name||u.noteDiscussionFallback}),(0,Q.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:u.messageCount.replace(`{{count}}`,String(e.messageCount??0))})]},e.key))}):(0,Q.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 St=[{value:`86400000`,zh:`24 小时`,en:`24 hours`},{value:`604800000`,zh:`7 天`,en:`7 days`},{value:`2592000000`,zh:`30 天`,en:`30 days`}];function Ct({open:e,onOpenChange:t,note:n}){let r=D(e=>e.language)===`zh`,i=r?Dt:Ot,{data:a,mutate:o}=L(e?[`note-shares`,n.id]:null,()=>J(n.id)),s=L(e?`hosted-share-auth-status`:null,Ee),d=s.data===!0,p=L(e&&d?`hosted-publication-capabilities`:null,q),m=p.data?.publishing.allowed===!0,g=L(e&&d?[`hosted-note-publications`,n.id]:null,()=>z(n.id)),[v,y]=(0,Z.useState)(new Set),[b,S]=(0,Z.useState)(`86400000`),[C,w]=(0,Z.useState)(``),[T,E]=(0,Z.useState)(``),[O,ee]=(0,Z.useState)(`hosted`),[te,ne]=(0,Z.useState)(!1),[re,ie]=(0,Z.useState)(null),[B,ae]=(0,Z.useState)(null),[oe,se]=(0,Z.useState)(!1),[ce,V]=(0,Z.useState)(null),le=(0,Z.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,Z.useEffect)(()=>{e&&(y(new Set(le.map(e=>e.id))),ae(null),se(!1),V(null))},[e,le]);let ue=async()=>{ne(!0),V(null);try{let e={expectedNoteVersion:n.updatedAt,attachmentIds:[...v],ttlMs:Number(b),maxViews:C.trim()?Number(C):null,description:T.trim()||void 0};O===`hosted`?(ae((await de(n.id,e)).shareUrl),await g.mutate()):(ae((await H(n.id,e)).payload.shareUrl),await o())}catch(e){V(e instanceof Error?e.message:String(e))}finally{ne(!1)}},fe=async(e,t)=>{ie(e.id),V(null);try{t===`refresh`?await je(n.id,e.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[...v]}):await ke(e.id),await g.mutate()}catch(e){V(e instanceof Error?e.message:String(e))}finally{ie(null)}},U=async(e,t)=>{ie(e.id),V(null);try{t===`refresh`?await Ne(n.id,e.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[...v]}):t===`extend`?await Je(e.id,864e5):await ze(e.id),await o()}catch(e){V(e instanceof Error?e.message:String(e))}finally{ie(null)}},me=async e=>{V(null);try{if(!await I(e)){se(!1),V(i.copyFailed);return}se(!0),window.setTimeout(()=>se(!1),1500)}catch{se(!1),V(i.copyFailed)}};return(0,Q.jsx)(F,{open:e,onOpenChange:t,children:(0,Q.jsxs)(M,{children:[(0,Q.jsx)(k,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(N,{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,Q.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between border-b border-edge px-5 py-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(P,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[(0,Q.jsx)(ve,{className:`size-4`}),i.title]}),(0,Q.jsx)(A,{className:`mt-1 text-xs text-fg-muted`,children:i.description})]}),(0,Q.jsx)(j,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-fg-muted hover:bg-surface-hover`,"aria-label":i.close,children:(0,Q.jsx)(x,{className:`size-4`})})})]}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,Q.jsxs)(`section`,{className:`rounded-lg border border-edge bg-surface-inset p-4`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n.title||i.untitled}),(0,Q.jsx)(`p`,{className:`mt-2 line-clamp-4 whitespace-pre-wrap text-xs leading-5 text-fg-muted`,children:n.markdown||i.empty}),(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:i.privateExcluded})]}),le.length>0?(0,Q.jsxs)(`section`,{className:`mt-5`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.attachments}),(0,Q.jsx)(`div`,{className:`mt-2 grid gap-2`,children:le.map(e=>(0,Q.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,Q.jsx)(`input`,{type:`checkbox`,checked:v.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,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.fileName}),(0,Q.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:Et(e.size)})]},e.id))})]}):null,(0,Q.jsxs)(`section`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted sm:col-span-2`,children:[i.delivery,(0,Q.jsxs)(l,{value:O,onChange:e=>ee(e.target.value),children:[(0,Q.jsx)(u,{value:`hosted`,children:i.deliveryHosted}),(0,Q.jsx)(u,{value:`local`,children:i.deliveryLocal})]})]}),O===`hosted`&&s.data===!1?(0,Q.jsx)(`div`,{className:`sm:col-span-2`,children:(0,Q.jsx)(pe,{providerId:`xopc-share`,displayName:`XOPC Hosted Share`,connected:!1,onConnected:()=>void s.mutate(!0,{revalidate:!1})})}):null,O===`hosted`&&d&&p.data&&!m?(0,Q.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,Q.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[i.expires,(0,Q.jsx)(l,{value:b,onChange:e=>S(e.target.value),children:St.map(e=>(0,Q.jsx)(u,{value:e.value,children:r?e.zh:e.en},e.value))})]}),(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[i.maxViews,(0,Q.jsx)(`input`,{type:`number`,min:1,max:1e3,value:C,onChange:e=>w(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,Q.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted sm:col-span-2`,children:[i.publicDescription,(0,Q.jsx)(`input`,{value:T,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`})]})]}),B?(0,Q.jsx)(`div`,{className:`mt-5 rounded-lg border border-success/25 bg-success-soft p-3`,children:(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(`input`,{readOnly:!0,value:B,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none`}),(0,Q.jsxs)(R,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void me(B),children:[oe?(0,Q.jsx)(c,{className:`size-4`}):(0,Q.jsx)(f,{className:`size-4`}),oe?i.copied:i.copy]}),(0,Q.jsxs)(R,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>window.open(B,`_blank`,`noopener,noreferrer`),children:[(0,Q.jsx)(h,{className:`size-4`}),i.open]})]})}):null,ce?(0,Q.jsx)(`p`,{className:`mt-4 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,children:ce}):null,(a?.items.length??0)>0?(0,Q.jsxs)(`section`,{className:`mt-6 border-t border-edge pt-5`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.activeLinks}),(0,Q.jsx)(`div`,{className:`mt-2 grid gap-2`,children:a.items.map(e=>(0,Q.jsx)(Tt,{share:e,busy:re===e.id,t:i,onCopy:me,onAction:U},e.id))})]}):null,(g.data?.length??0)>0?(0,Q.jsxs)(`section`,{className:`mt-6 border-t border-edge pt-5`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.hostedLinks}),(0,Q.jsx)(`div`,{className:`mt-2 grid gap-2`,children:g.data.map(e=>(0,Q.jsx)(wt,{publication:e,stale:e.source?.version!==String(n.updatedAt),busy:re===e.id,publishingAllowed:m,t:i,onCopy:me,onAction:fe},e.id))})]}):null]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-2 border-t border-edge px-5 py-3`,children:[(0,Q.jsx)(j,{asChild:!0,children:(0,Q.jsx)(R,{type:`button`,variant:`ghost`,children:i.close})}),(0,Q.jsxs)(R,{type:`button`,onClick:()=>void ue(),disabled:te||O===`hosted`&&(!d||!m),children:[te?(0,Q.jsx)(_,{className:`size-4 animate-spin`}):(0,Q.jsx)(ve,{className:`size-4`}),te?i.creating:i.create]})]})]})]})})}function wt(e){let t=(0,rt.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=C(`rounded-lg border border-edge-subtle p-3`,u),t[0]=u,t[1]=d);let p=r&&!l?o.stale:l?o.inactive:o.active,m;t[2]===p?m=t[3]:(m=(0,Q.jsx)(`span`,{children:p}),t[2]=p,t[3]=m);let g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Q.jsx)(`span`,{children:`·`}),t[4]=g):g=t[4];let v=n.maxViews===null?``:` / ${n.maxViews}`,y;t[5]!==n.viewCount||t[6]!==o.views||t[7]!==v?(y=(0,Q.jsxs)(`span`,{children:[o.views,` `,n.viewCount,v]}),t[5]=n.viewCount,t[6]=o.views,t[7]=v,t[8]=y):y=t[8];let b;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(`span`,{children:`·`}),t[9]=b):b=t[9];let x;t[10]!==n.revision||t[11]!==o.revision?(x=(0,Q.jsxs)(`span`,{children:[o.revision,` `,n.revision]}),t[10]=n.revision,t[11]=o.revision,t[12]=x):x=t[12];let S;t[13]!==m||t[14]!==y||t[15]!==x?(S=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[m,g,y,b,x]}),t[13]=m,t[14]=y,t[15]=x,t[16]=S):S=t[16];let w;t[17]===n.shareUrl?w=t[18]:(w=(0,Q.jsx)(`div`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.shareUrl}),t[17]=n.shareUrl,t[18]=w);let T;t[19]!==S||t[20]!==w?(T=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[S,w]}),t[19]=S,t[20]=w,t[21]=T):T=t[21];let E;t[22]===i?E=t[23]:(E=i?(0,Q.jsx)(_,{className:`size-4 animate-spin text-fg-muted`}):null,t[22]=i,t[23]=E);let D;t[24]!==T||t[25]!==E?(D=(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[T,E]}),t[24]=T,t[25]=E,t[26]=D):D=t[26];let O=!a,k;t[27]!==s||t[28]!==n.shareUrl?(k=()=>void s(n.shareUrl),t[27]=s,t[28]=n.shareUrl,t[29]=k):k=t[29];let A;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsx)(f,{className:`size-3.5`}),t[30]=A):A=t[30];let j;t[31]!==o.copy||t[32]!==O||t[33]!==k?(j=(0,Q.jsxs)(R,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:O,onClick:k,children:[A,o.copy]}),t[31]=o.copy,t[32]=O,t[33]=k,t[34]=j):j=t[34];let M=!a,N;t[35]===n.shareUrl?N=t[36]:(N=()=>window.open(n.shareUrl,`_blank`,`noopener,noreferrer`),t[35]=n.shareUrl,t[36]=N);let P;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Q.jsx)(h,{className:`size-3.5`}),t[37]=P):P=t[37];let F;t[38]!==o.open||t[39]!==M||t[40]!==N?(F=(0,Q.jsxs)(R,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:M,onClick:N,children:[P,o.open]}),t[38]=o.open,t[39]=M,t[40]=N,t[41]=F):F=t[41];let I;t[42]!==i||t[43]!==l||t[44]!==c||t[45]!==n||t[46]!==a||t[47]!==r||t[48]!==o.refresh?(I=r&&!l?(0,Q.jsxs)(R,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:i||!a,onClick:()=>void c(n,`refresh`),children:[(0,Q.jsx)(Ge,{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]=I):I=t[49];let L;t[50]!==i||t[51]!==c||t[52]!==n||t[53]!==o.revoke?(L=n.revoked?null:(0,Q.jsxs)(R,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:i,onClick:()=>void c(n,`revoke`),children:[(0,Q.jsx)(me,{className:`size-3.5`}),o.revoke]}),t[50]=i,t[51]=c,t[52]=n,t[53]=o.revoke,t[54]=L):L=t[54];let ee;t[55]!==j||t[56]!==F||t[57]!==I||t[58]!==L?(ee=(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[j,F,I,L]}),t[55]=j,t[56]=F,t[57]=I,t[58]=L,t[59]=ee):ee=t[59];let te;return t[60]!==D||t[61]!==d||t[62]!==ee?(te=(0,Q.jsxs)(`div`,{className:d,children:[D,ee]}),t[60]=D,t[61]=d,t[62]=ee,t[63]=te):te=t[63],te}function Tt(e){let t=(0,rt.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=C(`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,Q.jsx)(`span`,{children:u}),t[2]=u,t[3]=d);let p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(`span`,{children:`·`}),t[4]=p):p=t[4];let m=n.maxViews===null?``:` / ${n.maxViews}`,g;t[5]!==n.viewCount||t[6]!==i.views||t[7]!==m?(g=(0,Q.jsxs)(`span`,{children:[i.views,` `,n.viewCount,m]}),t[5]=n.viewCount,t[6]=i.views,t[7]=m,t[8]=g):g=t[8];let v;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(`span`,{children:`·`}),t[9]=v):v=t[9];let y;t[10]===n.expiresAt?y=t[11]:(y=new Date(n.expiresAt).toLocaleDateString(),t[10]=n.expiresAt,t[11]=y);let b;t[12]===y?b=t[13]:(b=(0,Q.jsx)(`span`,{children:y}),t[12]=y,t[13]=b);let x;t[14]!==b||t[15]!==d||t[16]!==g?(x=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[d,p,g,v,b]}),t[14]=b,t[15]=d,t[16]=g,t[17]=x):x=t[17];let S;t[18]===n.shareUrl?S=t[19]:(S=(0,Q.jsx)(`div`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.shareUrl}),t[18]=n.shareUrl,t[19]=S);let w;t[20]!==x||t[21]!==S?(w=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[x,S]}),t[20]=x,t[21]=S,t[22]=w):w=t[22];let T;t[23]===r?T=t[24]:(T=r?(0,Q.jsx)(_,{className:`size-4 animate-spin text-fg-muted`}):null,t[23]=r,t[24]=T);let E;t[25]!==w||t[26]!==T?(E=(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[w,T]}),t[25]=w,t[26]=T,t[27]=E):E=t[27];let D;t[28]!==a||t[29]!==n.shareUrl?(D=()=>void a(n.shareUrl),t[28]=a,t[29]=n.shareUrl,t[30]=D):D=t[30];let O;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(f,{className:`size-3.5`}),t[31]=O):O=t[31];let k;t[32]!==i.copy||t[33]!==D?(k=(0,Q.jsxs)(R,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:D,children:[O,i.copy]}),t[32]=i.copy,t[33]=D,t[34]=k):k=t[34];let A;t[35]===n.shareUrl?A=t[36]:(A=()=>window.open(n.shareUrl,`_blank`,`noopener,noreferrer`),t[35]=n.shareUrl,t[36]=A);let j;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(h,{className:`size-3.5`}),t[37]=j):j=t[37];let M;t[38]!==i.open||t[39]!==A?(M=(0,Q.jsxs)(R,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:A,children:[j,i.open]}),t[38]=i.open,t[39]=A,t[40]=M):M=t[40];let N;t[41]!==r||t[42]!==s||t[43]!==o||t[44]!==n||t[45]!==i.refresh?(N=n.stale&&!s?(0,Q.jsxs)(R,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`refresh`),children:[(0,Q.jsx)(Ge,{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]=N):N=t[46];let P;t[47]!==r||t[48]!==s||t[49]!==o||t[50]!==n||t[51]!==i.extend?(P=s?null:(0,Q.jsx)(R,{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]=P):P=t[52];let F;t[53]!==r||t[54]!==o||t[55]!==n||t[56]!==i.revoke?(F=n.revoked?null:(0,Q.jsxs)(R,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`revoke`),children:[(0,Q.jsx)(me,{className:`size-3.5`}),i.revoke]}),t[53]=r,t[54]=o,t[55]=n,t[56]=i.revoke,t[57]=F):F=t[57];let I;t[58]!==k||t[59]!==M||t[60]!==N||t[61]!==P||t[62]!==F?(I=(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[k,M,N,P,F]}),t[58]=k,t[59]=M,t[60]=N,t[61]=P,t[62]=F,t[63]=I):I=t[63];let L;return t[64]!==E||t[65]!==l||t[66]!==I?(L=(0,Q.jsxs)(`div`,{className:l,children:[E,I]}),t[64]=E,t[65]=l,t[66]=I,t[67]=L):L=t[67],L}function Et(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}var Dt={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:`撤销`},Ot={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 kt(e){let t=(0,rt.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(At),p;t[6]!==n||t[7]!==r||t[8]!==d||t[9]!==a?(p=(0,Q.jsx)(U,{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,Q.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,Q.jsx)(W,{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,Q.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 At(e){return e.stop}function jt(e,t){let n=ae(t.replace(/^\s*(`{3,}|~{3,})[^\n]*$/gm,``).replace(/xopc-attachment:\/\/[^\s)]+/g,``).replace(/^(\s*[-*+]\s+)\[[ xX]\]\s*/gm,`$1`)),r=ae(e);return!r||n.split(`
3
- `)[0]===r?n:[r,n].filter(Boolean).join(`
4
-
5
- `)}var Mt=()=>i(()=>import(`./block-editor-Cm1W-14I.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,66,67,68,69,70])),Nt=()=>i(()=>import(`./markdown-editor-BhBJANcx.js`),__vite__mapDeps([71,1,66,5,72,73,3])),Pt=(0,Z.lazy)(()=>Mt().then(e=>({default:e.BlockEditor}))),Ft=(0,Z.lazy)(()=>Nt().then(e=>({default:e.MarkdownEditor})));function It(){let e=(0,rt.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col px-6 py-4`,"aria-busy":!0,children:[(0,Q.jsx)(`div`,{className:`h-8 w-56 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,Q.jsx)(`div`,{className:`mt-6 h-4 w-11/12 animate-pulse rounded bg-surface-hover`}),(0,Q.jsx)(`div`,{className:`mt-3 h-4 w-9/12 animate-pulse rounded bg-surface-hover`}),(0,Q.jsx)(`div`,{className:`mt-3 h-4 w-10/12 animate-pulse rounded bg-surface-hover`})]}),e[0]=t):t=e[0],t}function Lt(e){let t=(0,rt.c)(29),{mode:n,onModeChange:r,labels:i}=e,a;t[0]===i.edit?a=t[1]:(a={id:`wysiwyg`,label:i.edit,Icon:ge},t[0]=i.edit,t[1]=a);let o;t[2]===i.source?o=t[3]:(o={id:`source`,label:i.source,Icon:re},t[2]=i.source,t[3]=o);let s;t[4]===i.preview?s=t[5]:(s={id:`preview`,label:i.preview,Icon:g},t[4]=i.preview,t[5]=s);let l;t[6]!==a||t[7]!==o||t[8]!==s?(l=[a,o,s],t[6]=a,t[7]=o,t[8]=s,t[9]=l):l=t[9];let u=l,d;t[10]!==n||t[11]!==u?(d=u.find(e=>e.id===n)??u[0],t[10]=n,t[11]=u,t[12]=d):d=t[12];let f=d,p=f.Icon,m=Rt,h;t[13]===p?h=t[14]:(h=(0,Q.jsx)(p,{className:`size-3.5`,"aria-hidden":!0}),t[13]=p,t[14]=h);let _;t[15]===f.label?_=t[16]:(_=(0,Q.jsx)(`span`,{children:f.label}),t[15]=f.label,t[16]=_);let v;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(be,{className:`size-3 text-fg-subtle`,"aria-hidden":!0}),t[17]=v):v=t[17];let y;t[18]!==f.label||t[19]!==h||t[20]!==_?(y=(0,Q.jsx)(xe,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"aria-label":f.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:[h,_,v]})}),t[18]=f.label,t[19]=h,t[20]=_,t[21]=y):y=t[21];let b;t[22]!==n||t[23]!==u||t[24]!==r?(b=(0,Q.jsx)(ye,{children:(0,Q.jsx)(Qe,{align:`end`,sideOffset:6,className:`z-50 min-w-36 rounded-xl border border-edge bg-surface-panel p-1 shadow-popover`,children:u.map(e=>{let{id:t,label:i,Icon:a}=e;return(0,Q.jsxs)(ie,{onSelect:()=>r(t),onPointerMove:()=>m(t),onFocus:()=>m(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,Q.jsx)(a,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`flex-1`,children:i}),n===t?(0,Q.jsx)(c,{className:`size-4 text-accent`,"aria-hidden":!0}):null]},t)})})}),t[22]=n,t[23]=u,t[24]=r,t[25]=b):b=t[25];let x;return t[26]!==b||t[27]!==y?(x=(0,Q.jsxs)(ce,{modal:!1,children:[y,b]}),t[26]=b,t[27]=y,t[28]=x):x=t[28],x}function Rt(e){e===`wysiwyg`&&Mt(),e===`source`&&Nt()}function zt(e){let t=(0,rt.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=D(Bt),g;t[0]===h?g=t[1]:(g=S(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,Q.jsx)(Vt,{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,Q.jsx)(et,{closeLabel:_,children:v}),t[13]=_,t[14]=v,t[15]=y):y=t[15],y}function Bt(e){return e.language}function Vt({noteId:e,onBack:t,onSaved:n,showBackButton:r=!0,backButtonClassName:i,clearHeaderOnCleanup:o=!0,onOpenSearch:s,autoFocus:l=!1,initialMode:u=`wysiwyg`,onAutoFocusConsumed:d}){let f=D(e=>e.language),p=S(f).notes,h=S(f).chat.pageContext,g=S(f).automations.suggestions,{data:_}=L([`note-discussion-document`,e],()=>Ae(e)),[y,x]=(0,Z.useState)(!0),w=a(),E=se(e=>e.resolved)===`dark`,{openImage:O}=$e(),[k,A]=(0,Z.useState)(u),[j,M]=(0,Z.useState)(null),[N,P]=(0,Z.useState)(null),[F,I]=(0,Z.useState)(!1),[R,ee]=(0,Z.useState)(``),[z,ne]=(0,Z.useState)(360),[re,ae]=(0,Z.useState)(!1),[H,de]=(0,Z.useState)(!1),[pe,U]=(0,Z.useState)(!1),W=(0,Z.useRef)(0);(0,Z.useEffect)(()=>()=>{W.current+=1},[e]);let[be,K]=(0,Z.useState)(null),[we,Ee]=(0,Z.useState)(!1),[Oe,ke]=(0,Z.useState)(null),[je,Me]=(0,Z.useState)(!1),[Ne,Le]=(0,Z.useState)(!1),Re=(0,Z.useRef)(!1),ze=(0,Z.useRef)(!1),Be=(0,Z.useRef)(null),Ve=(0,Z.useRef)(null),q=(0,Z.useRef)(null),J=(0,Z.useRef)(null),Ue=(0,Z.useRef)(null),We=(0,Z.useRef)(null),Ge=(0,Z.useRef)(null),qe=(0,Z.useRef)(null),Je=(0,Z.useRef)(null),Xe=B(e=>e.setPageHeader),et=B(e=>e.clearPageHeader),{data:Y,mutate:X,error:tt}=L(e?[`note-detail`,e]:null,()=>Se(e)),{data:nt=[],mutate:rt}=L(e?[`note-threads`,e]:null,()=>Ke(e),{revalidateOnFocus:!1}),it=N!==null,at=(0,Z.useCallback)(e=>{K(`${p.refreshFailed}: ${e instanceof Error?e.message:p.quickCaptureFailedHint}`)},[p.quickCaptureFailedHint,p.refreshFailed]);(0,Z.useEffect)(()=>{if(!e)return;let t=t=>{t.detail?.noteId===e&&X().catch(at)};return window.addEventListener(`note-updated`,t),()=>window.removeEventListener(`note-updated`,t)},[X,e,at]),(0,Z.useEffect)(()=>{Re.current=!1,ee(``),P(null),M(null),ze.current=!1,Je.current=null},[e]),(0,Z.useEffect)(()=>{!Y||Re.current||(ee(Y.title??``),Re.current=!0)},[Y]),(0,Z.useEffect)(()=>{if(!l||!Y||it||Je.current===e)return;let t=window.requestAnimationFrame(()=>{qe.current?.focus(),d?.()});return Je.current=e,()=>window.cancelAnimationFrame(t)},[l,it,Y,e,d]);let ot=Y?new Date(Y.createdAt).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``,st=(0,Z.useMemo)(()=>r?(0,Q.jsx)(`button`,{type:`button`,onClick:t,"aria-label":p.back,className:C(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,Ye,i),children:(0,Q.jsx)(te,{className:`size-4`,"aria-hidden":!0})}):null,[i,p.back,t,r]),$=(0,Z.useCallback)(()=>{let t=G.getState();t.source?.type===`note`&&t.source.id===e&&t.stop()},[e]),ct=(0,Z.useCallback)(e=>{e!==`preview`&&$(),A(e)},[$]),lt=(0,Z.useCallback)(t=>{$(),ee(t),e&&(J.current=t,Ve.current&&clearTimeout(Ve.current),Ve.current=setTimeout(async()=>{let t=J.current;if(J.current=null,t!==null){I(!0);try{await He(e,{title:t}),await X(),n?.()}catch{}finally{I(!1)}}},600))},[$,e,X,n]),dt=(0,Z.useMemo)(()=>(0,Q.jsxs)(`div`,{className:C(`flex min-w-0 items-center gap-2`,Ye),children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,title:R||ot||void 0,children:R||ot}),F?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted opacity-60`,children:p.saving}):null]}),[p.saving,F,ot,R]),ft=(0,Z.useCallback)(async(t=!1)=>{U(!0),K(null);try{let n=await De(e,{forceNew:t});await X(),await rt(),w(`/chat/${encodeURIComponent(n.conversationId)}`)}catch(e){K(`${p.chatOpenFailedTitle}: ${e instanceof Error?e.message:p.chatOpenFailedMessage}`)}finally{U(!1)}},[X,rt,w,e,p.chatOpenFailedMessage,p.chatOpenFailedTitle]),pt=(0,Z.useCallback)(async()=>{de(!0),K(null);try{await oe(e),await X()}catch(e){K(`${p.catalysisFailed}: ${e instanceof Error?e.message:p.chatOpenFailedMessage}`)}finally{de(!1)}},[X,e]),mt=(0,Z.useCallback)(()=>{M(j===`breakdown`?null:`breakdown`),!Y?.aiDeep?.catalysis?.report&&!H&&pt()},[j,H,pt,Y?.aiDeep?.catalysis?.report]),ht=(0,Z.useCallback)(()=>{let t=N?N.markdown??``:q.current??Y?.markdown??``,n=N?N.title??``:R,r=jt(n,t);return{source:{type:`note`,id:e,title:n||p.titlePlaceholder},text:r,language:ue(r,f)}},[f,p.titlePlaceholder,Y?.markdown,e,N,R]),gt=(0,Z.useCallback)(async()=>{Be.current&&clearTimeout(Be.current),Ve.current&&clearTimeout(Ve.current),Be.current=null,Ve.current=null;let t=q.current,r=J.current;q.current=null,J.current=null;let i={};if(t!==null&&(i.markdown=t),r!==null&&(i.title=r),Object.keys(i).length===0)return Y??null;I(!0);try{let t=await He(e,i);return await X(t,{revalidate:!1}),n?.(),t}catch(e){return q.current===null&&(q.current=t),J.current===null&&(J.current=r),K(`${p.saveFailed}: ${e instanceof Error?e.message:p.saveFailedHint}`),null}finally{I(!1)}},[X,p.saveFailed,p.saveFailedHint,Y,e,n]),vt=(0,Z.useCallback)(async()=>{if(!Y||pe||F)return;U(!0),K(null);let e=T.getState(),t=++W.current,n=()=>W.current===t&&T.getState().baseUrl===e.baseUrl&&T.getState().conversationId===e.conversationId;try{let t=window.getSelection(),r=t?.anchorNode&&t.focusNode&&Ue.current?.contains(t.anchorNode)&&Ue.current.contains(t.focusNode)?t.toString():``,i=await gt();if(!i||!n())return;if(q.current!==null||J.current!==null)throw Error(h.unavailable);let a=fe.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 Fe().createSession();if(!n())return;if(q.current!==null||J.current!==null)throw Error(h.unavailable);let s=V(e.baseUrl,e.conversationId,o.key);if(!fe.put(s,a))throw Error(h.unavailable);w(`/chat/${encodeURIComponent(o.key)}`)}catch{n()&&K(h.unavailable)}finally{W.current===t&&U(!1)}},[Y,pe,F,gt,w,h.unavailable]),yt=(0,Z.useCallback)(async()=>{K(null);let e=await gt();e&&(ke(e),Ee(!0))},[gt]),St=(0,Z.useCallback)(async()=>{if(!(Ne||F)){Me(!1),Le(!0),K(null),$(),Be.current&&clearTimeout(Be.current),Ve.current&&clearTimeout(Ve.current),Be.current=null,Ve.current=null,q.current=null,J.current=null;try{await Ce(e),window.dispatchEvent(new CustomEvent(`note-deleted`,{detail:{noteId:e}})),n?.(),t()}catch(e){K(`${p.deleteFailed}: ${e instanceof Error?e.message:p.quickCaptureFailedHint}`)}finally{Le(!1)}}},[Ne,p.deleteFailed,p.quickCaptureFailedHint,e,t,n,F,$]),wt=(0,Z.useMemo)(()=>(0,Q.jsxs)(`div`,{className:C(`flex min-w-0 items-center gap-1 sm:gap-2`,Ye),children:[s?(0,Q.jsx)(`button`,{type:`button`,onClick:s,"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,Q.jsx)(b,{className:`size-4`,"aria-hidden":!0})}):null,(0,Q.jsx)(kt,{input:ht,showLabel:!1,labels:{read:p.readAloud,preparing:p.readAloudPreparing,pause:p.readAloudPause,resume:p.readAloudResume,retry:p.readAloudRetry,stop:p.readAloudStop}}),(0,Q.jsxs)(`button`,{type:`button`,onClick:mt,disabled:H,"aria-label":p.catalysisSectionTitle,className:C(`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,Q.jsx)(le,{className:`size-3.5`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`hidden sm:inline`,children:H?p.catalyzing:p.catalyzeButton})]}),(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>ft(!1),"aria-label":p.openChatButton,disabled:pe,className:C(`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,Q.jsx)(v,{className:`size-3.5`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`hidden sm:inline`,children:pe?p.openingChat:p.openChatButton})]}),(0,Q.jsx)(Lt,{mode:k,onModeChange:ct,labels:{edit:p.modeEdit,source:p.modeSource,preview:p.modePreview}}),(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>void vt(),disabled:pe||F||!Y||!!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,Q.jsx)(ge,{className:`size-3.5`,"aria-hidden":!0}),h.capture]}),(0,Q.jsxs)(ce,{modal:!1,children:[(0,Q.jsx)(xe,{asChild:!0,children:(0,Q.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,Q.jsx)(m,{className:`size-4`,"aria-hidden":!0})})}),(0,Q.jsx)(ye,{children:(0,Q.jsxs)(Qe,{align:`end`,sideOffset:6,className:`z-50 min-w-40 rounded-xl border border-edge bg-surface-panel p-1 shadow-popover`,children:[(0,Q.jsxs)(ie,{onSelect:()=>void yt(),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,Q.jsx)(ve,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),f===`zh`?`分享`:`Share`]}),(0,Q.jsxs)(ie,{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,Q.jsx)(Ze,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`flex-1`,children:p.history}),j===`history`?(0,Q.jsx)(c,{className:`size-4 text-accent`,"aria-hidden":!0}):null]}),(0,Q.jsx)(_e,{className:`my-1 h-px bg-edge-subtle`}),(0,Q.jsxs)(ie,{disabled:Ne||F,onSelect:()=>Me(!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,Q.jsx)(me,{className:`size-4`,"aria-hidden":!0}),p.delete]})]})})]})]}),[H,mt,ft,vt,h.capture,Y,N,k,p.history,p.modeEdit,p.modePreview,p.modeSource,pe,j,s,p.searchDialogTitle,p.readAloud,p.readAloudPause,p.readAloudPreparing,p.readAloudResume,p.readAloudRetry,p.readAloudStop,ct,ht,yt,Ne,F,f,p.delete,Me]);(0,Z.useLayoutEffect)(()=>(Xe({startExtra:st,main:Y?dt:null,end:Y?wt:null}),()=>{o&&et()}),[o,et,wt,dt,st,Y,Xe]);let Tt=(0,Z.useCallback)(t=>{e&&($(),q.current=t,Be.current&&clearTimeout(Be.current),Be.current=setTimeout(async()=>{let t=q.current;if(q.current=null,t!==null){I(!0),K(null);try{await He(e,{markdown:t}),await X(),n?.()}catch(e){K(`${p.saveFailed}: ${e instanceof Error?e.message:p.saveFailedHint}`)}finally{I(!1)}}},600))},[$,e,X,p.saveFailed,p.saveFailedHint,n]),Et=(0,Z.useCallback)(t=>{he(e,t.timestamp).then(e=>{e&&($(),P(e))})},[e,$]),Dt=(0,Z.useCallback)(()=>{$(),M(null),P(null)},[$]),Ot=(0,Z.useCallback)(()=>{$(),M(null),P(null),X().catch(at),n?.()},[X,n,at,$]);if((0,Z.useEffect)(()=>()=>{Be.current&&clearTimeout(Be.current),Ve.current&&clearTimeout(Ve.current);let t=q.current,n=J.current;q.current=null,J.current=null;let r={};t!==null&&(r.markdown=t),n!==null&&(r.title=n),Object.keys(r).length>0&&He(e,r).catch(()=>void 0)},[e]),Y===void 0)return tt?(0,Q.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-6 text-center`,role:`alert`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-danger`,children:p.home.loadFailed}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void X().catch(at),className:`rounded-lg border border-edge px-3 py-2 text-sm text-fg hover:bg-surface-hover`,children:p.home.retry}),(0,Q.jsx)(`button`,{type:`button`,onClick:t,className:`text-sm text-fg-muted hover:text-fg`,children:p.back})]}):(0,Q.jsx)(It,{});if(Y===null)return(0,Q.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 text-center`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:p.notFoundTitle}),(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:p.notFoundDescription}),(0,Q.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 At=it?N.title??``:R,Mt=it?N.markdown??``:q.current??Y.markdown??``,Nt=new Date(Y.createdAt).getTime(),Rt=Number.isFinite(Nt)&&Date.now()-Nt<3600*1e3?(0,Q.jsx)(ut,{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,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 gap-3 p-4 sm:px-5`,children:[(0,Q.jsxs)(`div`,{className:`mx-auto flex min-h-0 min-w-0 w-full max-w-[60rem] flex-1 flex-col`,children:[be?(0,Q.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:be}):null,(0,Q.jsx)(Te,{eventType:`note.created`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,Q.jsx)(Te,{eventType:`note.updated`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),_?(0,Q.jsxs)(`div`,{className:`mb-2 flex shrink-0 gap-4 text-sm`,children:[(0,Q.jsx)(`button`,{className:y?`text-accent-fg`:`text-fg-muted`,onClick:()=>x(!0),children:f===`zh`?`会议`:`Meeting`}),(0,Q.jsx)(`button`,{className:y?`text-fg-muted`:`text-accent-fg`,onClick:()=>x(!1),children:f===`zh`?`我的笔记`:`My notes`})]}):null,(0,Q.jsxs)(`div`,{ref:Ue,className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel xl:flex-row`,children:[_&&y?(0,Q.jsx)(_t,{noteId:e}):null,(0,Q.jsx)(`div`,{className:_&&y?`hidden`:`min-h-0 min-w-0 flex-1`,children:it?(0,Q.jsxs)(`div`,{className:`h-full overflow-y-auto px-4 py-4 sm:px-6`,children:[At&&(0,Q.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg/70`,children:At}),Mt?(0,Q.jsx)(Pe,{noteId:e,content:Mt,className:`opacity-80`}):(0,Q.jsx)(`p`,{className:`italic text-fg-muted`,children:p.emptyPreview})]}):(0,Q.jsxs)(Q.Fragment,{children:[k===`wysiwyg`&&(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,Q.jsx)(`input`,{ref:qe,type:`text`,value:R,onChange:e=>lt(e.target.value),onCompositionStart:()=>{ze.current=!0},onCompositionEnd:()=>{ze.current=!1},onKeyDown:e=>{let t=e.nativeEvent;e.key===`Enter`&&!ze.current&&!t.isComposing&&(e.preventDefault(),(Ue.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`}),Rt]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(It,{}),children:(0,Q.jsx)(Pt,{initialContent:Y.markdown??``,onChange:Tt,noteId:e},`wysiwyg-${e}`)})})]}),k===`source`&&(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,Q.jsx)(`input`,{ref:qe,type:`text`,value:R,onChange:e=>lt(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`}),Rt]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(It,{}),children:(0,Q.jsx)(Ft,{initialContent:Y.markdown??``,onChange:Tt,isDark:E},`source-${e}`)})})]}),k===`preview`&&(0,Q.jsxs)(`div`,{className:`h-full overflow-y-auto px-4 py-4 sm:px-6`,onClick:e=>{let t=e.target;t instanceof HTMLImageElement&&O(t.currentSrc||t.src,t.alt)},children:[R&&!Y.markdown.trimStart().startsWith(`# ${R.trim()}\n`)&&Y.markdown.trim()!==`# ${R.trim()}`&&(0,Q.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg`,children:R}),Y.markdown?(0,Q.jsx)(Pe,{noteId:e,content:Y.markdown,className:`[&_img]:cursor-zoom-in`}):(0,Q.jsx)(`p`,{className:`italic text-fg-muted`,children:p.emptyPreview})]})]})})]})]}),(0,Q.jsx)(`div`,{ref:We,className:C(`relative flex min-h-0 shrink-0 flex-col overflow-hidden`,!re&&`transition-[width] duration-300 ease-in-out`),style:{width:j?z:0},children:(0,Q.jsxs)(`div`,{ref:Ge,className:`flex min-h-0 flex-1 flex-col`,style:{width:z},children:[(0,Q.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,onPointerDown:e=>{e.preventDefault();let t=e.currentTarget;t.setPointerCapture(e.pointerId),ae(!0);let n=e.clientX,r=z,i=e.pointerId,a=0,o=z,s=z,c=()=>{a=0,s=o,j&&We.current?.style.setProperty(`width`,`${s}px`),Ge.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{}ae(!1),ne(s),window.removeEventListener(`pointermove`,l),window.removeEventListener(`pointerup`,u),window.removeEventListener(`pointercancel`,u)};window.addEventListener(`pointermove`,l),window.addEventListener(`pointerup`,u),window.addEventListener(`pointercancel`,u)},className:C(`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,Q.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,Q.jsx)(bt,{noteId:e,activeTimestamp:N?.timestamp??null,onSelect:Et,onClose:Dt,onRestored:Ot}):j===`breakdown`?(0,Q.jsx)(xt,{noteId:e,note:Y??null,catalyzing:H,onCatalyze:pt,onClose:()=>M(null),noteThreads:nt,openingChat:pe,onOpenChat:()=>ft(!1),onOpenNewChat:()=>ft(!0)}):null})]})})]}),Oe?(0,Q.jsx)(Ct,{open:we,onOpenChange:Ee,note:Oe}):null,(0,Q.jsx)(Ie,{open:je,title:p.deleteConfirmTitle,description:p.deleteConfirmDescription.replace(`{{title}}`,Y.title||p.titlePlaceholder),confirmLabel:p.deleteConfirmLabel,cancelLabel:p.deleteCancelLabel,destructive:!0,onConfirm:()=>void St(),onCancel:()=>Me(!1)})]})}export{tt as a,$ as i,lt as n,ct as r,zt as t};