@xopcai/xopc 0.0.187 → 0.0.188

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 (216) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/demo-memory/src/index.js +1 -0
  3. package/dist/extensions/feishu/src/streaming/streaming-adapter.js +1 -3
  4. package/dist/extensions/telegram/src/adapters/streaming-adapter.js +0 -2
  5. package/dist/extensions/telegram/src/draft-stream.d.ts +0 -4
  6. package/dist/extensions/telegram/src/draft-stream.js +1 -53
  7. package/dist/extensions/telegram/xopc.extension.json +1 -1
  8. package/dist/gateway/static/root/assets/{activity-store-WlR2zEvA.js → activity-store--QoUGhiS.js} +1 -1
  9. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-RedDszrG.js → agent-avatar-dicebear-B0yweLNQ.js} +1 -1
  10. package/dist/gateway/static/root/assets/{agents-Df9mTa-K.js → agents-C6OV-gMm.js} +1 -1
  11. package/dist/gateway/static/root/assets/{api-tVOllncq.js → api-5laWqfiE.js} +1 -1
  12. package/dist/gateway/static/root/assets/{app-management-settings-panel-C9hKBzaF.js → app-management-settings-panel-BXJ8Jiv_.js} +1 -1
  13. package/dist/gateway/static/root/assets/{appearance-settings-5cQvq7hd.js → appearance-settings-DG9n9D1M.js} +1 -1
  14. package/dist/gateway/static/root/assets/{apps-page-Bd3tN-k2.js → apps-page-Ci14lDeO.js} +1 -1
  15. package/dist/gateway/static/root/assets/{archive-plugin-Ct-shK4n.js → archive-plugin-Ceh5qrZf.js} +1 -1
  16. package/dist/gateway/static/root/assets/{attachment-load-CpPj3m-q.js → attachment-load-jFW7uYf7.js} +1 -1
  17. package/dist/gateway/static/root/assets/automations-page-Q1xmb4Rh.js +6 -0
  18. package/dist/gateway/static/root/assets/{binary-plugins-BpSXZBle.js → binary-plugins-XDlkI1r4.js} +1 -1
  19. package/dist/gateway/static/root/assets/{block-editor-B8hR2tXc.js → block-editor-kyKc2IhE.js} +1 -1
  20. package/dist/gateway/static/root/assets/{browser-settings-page-jb5Hf-hm.js → browser-settings-page-DbowrHXD.js} +1 -1
  21. package/dist/gateway/static/root/assets/{browser-workflow-inputs-D_LAXUrh.js → browser-workflow-inputs-BJa5Iz_v.js} +1 -1
  22. package/dist/gateway/static/root/assets/{browser-workflows-page-CPAs7-6s.js → browser-workflows-page-CTQQOsn5.js} +1 -1
  23. package/dist/gateway/static/root/assets/{capabilities-settings-panel-BjUe4raq.js → capabilities-settings-panel-DoZPFdKF.js} +1 -1
  24. package/dist/gateway/static/root/assets/{capability-presets-api-CKklVY2p.js → capability-presets-api-Dn-7MMEo.js} +1 -1
  25. package/dist/gateway/static/root/assets/{capability-presets-settings-panel-DiWIMYRr.js → capability-presets-settings-panel-Bt8Hnx0h.js} +1 -1
  26. package/dist/gateway/static/root/assets/{channel-recipient-api-WWN-nbFL.js → channel-recipient-api-BgIkWq01.js} +1 -1
  27. package/dist/gateway/static/root/assets/{channels-settings-D8IkjMuX.js → channels-settings-Bpsebsru.js} +1 -1
  28. package/dist/gateway/static/root/assets/channels-status-swr-DFmdYRE5.js +1 -0
  29. package/dist/gateway/static/root/assets/{connector-logo-CdNkVFdB.js → connector-logo-TRr9ybf6.js} +1 -1
  30. package/dist/gateway/static/root/assets/{connectors-page-BT2ahw52.js → connectors-page-Tg5kl22i.js} +1 -1
  31. package/dist/gateway/static/root/assets/{desktop-pet-Bm_IEAf3.js → desktop-pet-CSwd00CV.js} +1 -1
  32. package/dist/gateway/static/root/assets/{desktop-pet-settings-C0Ve04-G.js → desktop-pet-settings-CuNQvHGu.js} +1 -1
  33. package/dist/gateway/static/root/assets/{directory-picker-path-field-B2cvhvAI.js → directory-picker-path-field-ct0n5Rje.js} +1 -1
  34. package/dist/gateway/static/root/assets/{extension-debug-page-DNashgGu.js → extension-debug-page-BeRBuMUU.js} +1 -1
  35. package/dist/gateway/static/root/assets/{extension-page-Bvo-5htX.js → extension-page-DbK-Cwao.js} +1 -1
  36. package/dist/gateway/static/root/assets/{extension-settings-page-BBESdISV.js → extension-settings-page-C9ag5tb5.js} +1 -1
  37. package/dist/gateway/static/root/assets/{gateway-config-api-ClQvokMo.js → gateway-config-api-CC7EvEFp.js} +1 -1
  38. package/dist/gateway/static/root/assets/{gateway-settings-CIRs2QVy.js → gateway-settings-9g8uIry9.js} +1 -1
  39. package/dist/gateway/static/root/assets/{gateway-startup-retry-CntXJF6W.js → gateway-startup-retry-B2DmdlwO.js} +1 -1
  40. package/dist/gateway/static/root/assets/{heartbeat-settings-CWKcZuvc.js → heartbeat-settings-fl1oC_-5.js} +1 -1
  41. package/dist/gateway/static/root/assets/{home-page-C59f8UJw.js → home-page-Bao9jq_z.js} +1 -1
  42. package/dist/gateway/static/root/assets/{image-generation-api-DjSAQwGy.js → image-generation-api-GMTaS6eI.js} +1 -1
  43. package/dist/gateway/static/root/assets/index-Cl5n1f_U.css +1 -0
  44. package/dist/gateway/static/root/assets/index-OJgiMh07.js +223 -0
  45. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-ahKHpjoW.js → keyboard-shortcuts-settings-DhGYddbI.js} +1 -1
  46. package/dist/gateway/static/root/assets/{local-app-workbench-page-DRB4UQBE.js → local-app-workbench-page-B69NvtvH.js} +1 -1
  47. package/dist/gateway/static/root/assets/{local-apps-page-B6GKdgza.js → local-apps-page-CmnrBmWi.js} +1 -1
  48. package/dist/gateway/static/root/assets/{locale-store-Bff30u5V.js → locale-store-D6hs74o5.js} +1 -1
  49. package/dist/gateway/static/root/assets/{logs-page-CNp4XiBN.js → logs-page-Cq3cABqg.js} +1 -1
  50. package/dist/gateway/static/root/assets/{markdown-split-BeNMJm_i.js → markdown-split-CZaBPOVn.js} +1 -1
  51. package/dist/gateway/static/root/assets/{media-plugins-Bdzrj_-6.js → media-plugins-CiKvSgCv.js} +1 -1
  52. package/dist/gateway/static/root/assets/messages-D02NNLCZ.js +3 -0
  53. package/dist/gateway/static/root/assets/{notes-page-MYIi-9S9.js → notes-page-Bisbzqlz.js} +1 -1
  54. package/dist/gateway/static/root/assets/{notes-workbench-DqSkeDXX.js → notes-workbench-BOZfJFhE.js} +2 -2
  55. package/dist/gateway/static/root/assets/{page-tabs-3t88bbGx.js → page-tabs-BxlwhAbH.js} +1 -1
  56. package/dist/gateway/static/root/assets/{preview-open-alternatives-Cf_BWbeE.js → preview-open-alternatives-RM8wXxfT.js} +1 -1
  57. package/dist/gateway/static/root/assets/{product-open-page-CKq73c98.js → product-open-page-DdBlibek.js} +1 -1
  58. package/dist/gateway/static/root/assets/{project-detail-page-BrbHs4Wp.js → project-detail-page-TSKFb2tN.js} +1 -1
  59. package/dist/gateway/static/root/assets/{projects-page-B80rtkj6.js → projects-page-BokeBrTT.js} +1 -1
  60. package/dist/gateway/static/root/assets/{remote-access-hub-_Q3GEznb.js → remote-access-hub-C56anxCX.js} +1 -1
  61. package/dist/gateway/static/root/assets/{schema-form-NqOm-OG1.js → schema-form-BDKbpmXv.js} +1 -1
  62. package/dist/gateway/static/root/assets/{sessions-page-55dJOUVg.js → sessions-page-C7TQADrD.js} +1 -1
  63. package/dist/gateway/static/root/assets/settings-advanced-gate-BDOPKeAX.js +1 -0
  64. package/dist/gateway/static/root/assets/{settings-form-section-DYAS8p8z.js → settings-form-section-zxo5ZGOu.js} +1 -1
  65. package/dist/gateway/static/root/assets/{settings-loading-skeleton-DZFhxihA.js → settings-loading-skeleton-DgIp8_S6.js} +1 -1
  66. package/dist/gateway/static/root/assets/{settings-page-BSIiMLi-.js → settings-page-BUPSIa9P.js} +1 -1
  67. package/dist/gateway/static/root/assets/{settings-page-layout-DfFfkdED.js → settings-page-layout-97LmwrzC.js} +1 -1
  68. package/dist/gateway/static/root/assets/{setup-status-panel-q_yE6-H1.js → setup-status-panel-BRg766eW.js} +1 -1
  69. package/dist/gateway/static/root/assets/{share-preview-page-CYtrQaZN.js → share-preview-page-BH7i3g1S.js} +1 -1
  70. package/dist/gateway/static/root/assets/{shares-settings-gYkRX9Ik.js → shares-settings-DhEAviQ_.js} +1 -1
  71. package/dist/gateway/static/root/assets/skill-reload-api-Ct7AV8ls.js +1 -0
  72. package/dist/gateway/static/root/assets/{skills-page-GZHKDFSb.js → skills-page-DoVuprZm.js} +1 -1
  73. package/dist/gateway/static/root/assets/{skills-page.utils-BBXirAjc.js → skills-page.utils-s-a5WV9j.js} +1 -1
  74. package/dist/gateway/static/root/assets/{system-settings-panel-DLf5YvFl.js → system-settings-panel-BxjeMT5k.js} +1 -1
  75. package/dist/gateway/static/root/assets/{task-detail-page-DFGkuYfl.js → task-detail-page-BahycnfW.js} +1 -1
  76. package/dist/gateway/static/root/assets/{theme-store-y7e_tvYi.js → theme-store-BRxdsmic.js} +1 -1
  77. package/dist/gateway/static/root/assets/{time-picker-5sHEZ5w5.js → time-picker-BGk_Tbsj.js} +1 -1
  78. package/dist/gateway/static/root/assets/{typed-models-lib-DR12j_dr.js → typed-models-lib-39MjwPSq.js} +1 -1
  79. package/dist/gateway/static/root/assets/{use-save-bar-registration-BsvcJgZl.js → use-save-bar-registration-5aVSjTjO.js} +1 -1
  80. package/dist/gateway/static/root/assets/{user-context-page-q5dr8JFG.js → user-context-page-B9K41qmy.js} +1 -1
  81. package/dist/gateway/static/root/assets/{voice-api-key-field-DKADXFWD.js → voice-api-key-field-XU-7sBSg.js} +1 -1
  82. package/dist/gateway/static/root/assets/{work-discovery-overlay-BC1nExf8.js → work-discovery-overlay-CJqu8UHq.js} +1 -1
  83. package/dist/gateway/static/root/assets/{work-discovery-page-fNvSg40M.js → work-discovery-page-BBVnRHju.js} +1 -1
  84. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-C8X5W-8k.js → workflow-run-setup-panel-DXtg8Qxl.js} +1 -1
  85. package/dist/gateway/static/root/assets/{workflows-page-YJBKmPYK.js → workflows-page-Bs_tYfst.js} +1 -1
  86. package/dist/gateway/static/root/index.html +7 -7
  87. package/dist/package.js +1 -1
  88. package/dist/packages/gateway-contract/src/tool-activity.js +223 -0
  89. package/dist/src/agent/agent-manager.js +2 -8
  90. package/dist/src/agent/code-intelligence/binary.js +1 -1
  91. package/dist/src/agent/embedded/run-for-session.d.ts +0 -2
  92. package/dist/src/agent/embedded/run-for-session.js +99 -112
  93. package/dist/src/agent/external-tools/composio-provider.d.ts +29 -0
  94. package/dist/src/agent/external-tools/composio-provider.js +307 -0
  95. package/dist/src/agent/external-tools/extension-provider.d.ts +20 -0
  96. package/dist/src/agent/external-tools/extension-provider.js +68 -0
  97. package/dist/src/agent/external-tools/gateway-tools.d.ts +8 -0
  98. package/dist/src/agent/external-tools/gateway-tools.js +89 -0
  99. package/dist/src/agent/external-tools/index.d.ts +24 -0
  100. package/dist/src/agent/external-tools/index.js +40 -0
  101. package/dist/src/agent/external-tools/mcp-provider.d.ts +29 -0
  102. package/dist/src/agent/external-tools/mcp-provider.js +118 -0
  103. package/dist/src/agent/external-tools/memory-provider.d.ts +21 -0
  104. package/dist/src/agent/external-tools/memory-provider.js +56 -0
  105. package/dist/src/agent/external-tools/refs.d.ts +5 -0
  106. package/dist/src/agent/external-tools/refs.js +18 -0
  107. package/dist/src/agent/external-tools/service.d.ts +26 -0
  108. package/dist/src/agent/external-tools/service.js +117 -0
  109. package/dist/src/agent/external-tools/types.d.ts +28 -0
  110. package/dist/src/agent/external-tools/types.js +9 -0
  111. package/dist/src/agent/inbound/inbound-loop.d.ts +0 -2
  112. package/dist/src/agent/inbound/inbound-loop.js +0 -3
  113. package/dist/src/agent/mcp/{bundle-mcp-materialize.d.ts → bundle-mcp-gateway.d.ts} +1 -19
  114. package/dist/src/agent/mcp/bundle-mcp-gateway.js +60 -0
  115. package/dist/src/agent/mcp/bundle-mcp-names.d.ts +0 -8
  116. package/dist/src/agent/mcp/bundle-mcp-names.js +2 -29
  117. package/dist/src/agent/mcp/bundle-mcp-policy.d.ts +4 -7
  118. package/dist/src/agent/mcp/bundle-mcp-policy.js +6 -20
  119. package/dist/src/agent/mcp/bundle-mcp-runtime.js +2 -2
  120. package/dist/src/agent/mcp/bundle-mcp-tools.d.ts +1 -2
  121. package/dist/src/agent/mcp/bundle-mcp-tools.js +1 -2
  122. package/dist/src/agent/mcp/bundle-mcp-types.d.ts +0 -5
  123. package/dist/src/agent/mcp/index.d.ts +0 -2
  124. package/dist/src/agent/mcp/index.js +2 -5
  125. package/dist/src/agent/mcp/mcp-stdio-transport.js +1 -1
  126. package/dist/src/agent/mcp/mcp-transport.js +1 -1
  127. package/dist/src/agent/memory/context/planner.d.ts +1 -0
  128. package/dist/src/agent/memory/context/planner.js +22 -7
  129. package/dist/src/agent/memory/manager.d.ts +4 -1
  130. package/dist/src/agent/memory/manager.js +5 -2
  131. package/dist/src/agent/memory/types.d.ts +2 -0
  132. package/dist/src/agent/messaging/stream-manager.d.ts +2 -14
  133. package/dist/src/agent/messaging/stream-manager.js +0 -12
  134. package/dist/src/agent/orchestration/agent-event-handler.d.ts +1 -3
  135. package/dist/src/agent/orchestration/agent-event-handler.js +0 -36
  136. package/dist/src/agent/orchestration/agent-orchestrator.d.ts +0 -5
  137. package/dist/src/agent/orchestration/agent-orchestrator.js +0 -5
  138. package/dist/src/agent/prompt/sections/behavior.js +6 -4
  139. package/dist/src/agent/service.d.ts +0 -3
  140. package/dist/src/agent/service.js +0 -28
  141. package/dist/src/agent/service.types.d.ts +0 -3
  142. package/dist/src/agent/skills/hub-pull.js +1 -1
  143. package/dist/src/agent/starter-agents.js +2 -2
  144. package/dist/src/agent/tools/delegate-tool.js +5 -1
  145. package/dist/src/agent/tools/executor.js +1 -1
  146. package/dist/src/agent/tools/factory.d.ts +2 -1
  147. package/dist/src/agent/tools/factory.js +16 -22
  148. package/dist/src/agent/tools/index.d.ts +0 -1
  149. package/dist/src/agent/tools/index.js +1 -2
  150. package/dist/src/agent/workflow/workflow-child-tools.js +7 -1
  151. package/dist/src/browser/providers/cloakbrowser.js +1 -1
  152. package/dist/src/channels/channel-domain.d.ts +0 -4
  153. package/dist/src/channels/plugin-types.d.ts +0 -2
  154. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  155. package/dist/src/cli/commands/extension-marketplace.js +1 -1
  156. package/dist/src/connectors/health.js +1 -1
  157. package/dist/src/extensions/extension-registry-impl.d.ts +3 -1
  158. package/dist/src/extensions/extension-registry-impl.js +7 -1
  159. package/dist/src/extensions/loader.js +1 -1
  160. package/dist/src/extensions/types/core.d.ts +2 -1
  161. package/dist/src/extensions/update.js +1 -1
  162. package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
  163. package/dist/src/gateway/agent-builtin-tools.js +5 -2
  164. package/dist/src/gateway/chat-stream/mapper.js +16 -1
  165. package/dist/src/gateway/chat-stream/protocol.d.ts +4 -0
  166. package/dist/src/gateway/file-reference-errors.d.ts +6 -0
  167. package/dist/src/gateway/file-reference-errors.js +21 -0
  168. package/dist/src/gateway/heartbeat/service.js +1 -1
  169. package/dist/src/gateway/hono/lib/config-payload.js +1 -1
  170. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
  171. package/dist/src/gateway/hono/routes/config-patch/misc.js +1 -1
  172. package/dist/src/gateway/hono/routes/mcp.js +1 -1
  173. package/dist/src/gateway/hono/routes/projects.js +34 -13
  174. package/dist/src/gateway/hono/routes/workflows.js +1 -1
  175. package/dist/src/gateway/hono/routes/workspace.js +34 -13
  176. package/dist/src/gateway/hono/routes/you.js +3 -3
  177. package/dist/src/gateway/service/config-coordinator.js +1 -1
  178. package/dist/src/gateway/service/run-gateway-agent.js +4 -1
  179. package/dist/src/gateway/service.js +6 -6
  180. package/dist/src/heartbeat/index.js +1 -1
  181. package/dist/src/infra/update-runner.js +1 -1
  182. package/dist/src/share/share-zip.js +1 -1
  183. package/dist/src/storage/sqlite/memory-records-repository.js +3 -1
  184. package/dist/src/storage/sqlite/migrations/108_repair_user_memory_provider.sql +18 -0
  185. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  186. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  187. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  188. package/dist/src/storage/sqlite/schema.js +1 -1
  189. package/dist/src/tui/tool-summary.d.ts +1 -2
  190. package/dist/src/tui/tool-summary.js +2 -18
  191. package/dist/src/tunnel/frpc-binary.js +1 -1
  192. package/dist/src/user-context/projection.d.ts +1 -0
  193. package/dist/src/user-context/projection.js +2 -1
  194. package/dist/src/voice/local/model-files.js +1 -1
  195. package/dist/src/work-discovery/service.js +1 -1
  196. package/package.json +1 -1
  197. package/dist/gateway/static/root/assets/automations-page-w6K9GZQ7.js +0 -6
  198. package/dist/gateway/static/root/assets/channels-status-swr-CySs1GQX.js +0 -1
  199. package/dist/gateway/static/root/assets/index-D-YfWVyS.css +0 -1
  200. package/dist/gateway/static/root/assets/index-vi5KlR5_.js +0 -222
  201. package/dist/gateway/static/root/assets/messages-CPxz48hr.js +0 -3
  202. package/dist/gateway/static/root/assets/settings-advanced-gate-CSFCZj14.js +0 -1
  203. package/dist/gateway/static/root/assets/skill-reload-api-BoNBMKW6.js +0 -1
  204. package/dist/src/agent/feedback/feedback-coordinator.d.ts +0 -73
  205. package/dist/src/agent/feedback/feedback-coordinator.js +0 -156
  206. package/dist/src/agent/feedback/index.d.ts +0 -4
  207. package/dist/src/agent/feedback/index.js +0 -2
  208. package/dist/src/agent/lifecycle/progress.d.ts +0 -90
  209. package/dist/src/agent/lifecycle/progress.js +0 -339
  210. package/dist/src/agent/mcp/bundle-mcp-materialize.js +0 -183
  211. package/dist/src/agent/mcp/mcp-tool-meta.d.ts +0 -8
  212. package/dist/src/agent/mcp/mcp-tool-meta.js +0 -13
  213. package/dist/src/agent/mcp/resolve-embedded-mcp-tools.d.ts +0 -14
  214. package/dist/src/agent/mcp/resolve-embedded-mcp-tools.js +0 -48
  215. package/dist/src/agent/tools/composio-tool.d.ts +0 -21
  216. package/dist/src/agent/tools/composio-tool.js +0 -261
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,l as a}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as o}from"./check-DUBLcKHA.js";import{t as s}from"./cn-JdwAhgNB.js";import{t as c}from"./messages-CPxz48hr.js";import{n as l}from"./locale-store-Bff30u5V.js";import{i as u}from"./vendor-swr-BIWyz7Rc.js";import{$o as d,$t as f,Bl as p,Bo as m,Bs as h,Bt as g,Cc as _,Es as v,Gt as y,Ho as b,Ht as x,Io as S,Jt as C,Kt as w,Lc as T,Lo as E,Ps as D,Qt as O,Ro as k,Rt as A,Tc as j,Us as M,Ut as N,Vo as P,Vt as F,Wo as I,Wt as L,Xt as R,Yl as z,Yt as B,Zt as V,_l as H,an as U,as as W,bs as G,cc as ee,cn as K,cu as q,do as te,en as ne,es as J,eu as Y,fn as X,fu as re,gc as ie,hc as ae,hl as Z,hn as oe,in as se,jc as ce,kc as le,ks as ue,ln as de,lu as fe,mn as pe,mu as me,nc as he,nl as ge,nn as _e,nu as ve,oc as ye,on as be,os as xe,ou as Se,qt as Ce,rn as we,rt as Te,sn as Ee,tn as De,to as Oe,tr as ke,un as Ae,yu as je,zl as Me,zo as Ne,zs as Pe,zt as Fe}from"./index-vi5KlR5_.js";import{t as Ie}from"./page-tabs-3t88bbGx.js";import{t as Le}from"./time-picker-5sHEZ5w5.js";import{E as Re,O as ze,t as Be}from"./connector-logo-CdNkVFdB.js";var Ve=n(),Q=e(t(),1),$=r();function He(e){let t=(0,Ve.c)(104),{value:n,onChange:r,labels:i,language:a,inputClassName:o}=e,c;t[0]===n.timezone?c=t[1]:(c=()=>pe.some(e=>e.value===n.timezone)?``:n.timezone,t[0]=n.timezone,t[1]=c);let[l,u]=(0,Q.useState)(c),f;t[2]===n.timezone?f=t[3]:(f=()=>!!n.timezone&&!pe.some(e=>e.value===n.timezone),t[2]=n.timezone,t[3]=f);let[p,m]=(0,Q.useState)(f),h;t[4]===n.pronouns?h=t[5]:(h=()=>!!n.pronouns&&!X.some(e=>e.value===n.pronouns),t[4]=n.pronouns,t[5]=h);let[g,_]=(0,Q.useState)(h),v;bb0:{if(p){v=`__custom__`;break bb0}v=pe.some(e=>e.value===n.timezone)?n.timezone:`__custom__`}let y=v,b;t[6]!==r||t[7]!==n?(b=e=>r({...n,...e}),t[6]=r,t[7]=n,t[8]=b):b=t[8];let x=b,S;t[9]===a?S=t[10]:(S=(e,t)=>a===`zh`?t:e,t[9]=a,t[10]=S);let C=S,w;t[11]===i.callName?w=t[12]:(w=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.callName}),t[11]=i.callName,t[12]=w);let T;t[13]===x?T=t[14]:(T=e=>x({callName:e.target.value}),t[13]=x,t[14]=T);let E;t[15]!==o||t[16]!==i.callNamePlaceholder||t[17]!==T||t[18]!==n.callName?(E=(0,$.jsx)(`input`,{className:o,value:n.callName,onChange:T,placeholder:i.callNamePlaceholder,autoComplete:`off`}),t[15]=o,t[16]=i.callNamePlaceholder,t[17]=T,t[18]=n.callName,t[19]=E):E=t[19];let D;t[20]!==w||t[21]!==E?(D=(0,$.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[w,E]}),t[20]=w,t[21]=E,t[22]=D):D=t[22];let O;t[23]===i.pronouns?O=t[24]:(O=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.pronouns}),t[23]=i.pronouns,t[24]=O);let k=g?`__custom__`:n.pronouns,A;t[25]!==x||t[26]!==n.pronouns?(A=e=>{if(e.target.value===`__custom__`){_(!0),X.some(e=>e.value===n.pronouns)&&x({pronouns:``});return}_(!1),x({pronouns:e.target.value})},t[25]=x,t[26]=n.pronouns,t[27]=A):A=t[27];let j;t[28]===i.pronounsPlaceholder?j=t[29]:(j=(0,$.jsx)(J,{value:``,children:i.pronounsPlaceholder}),t[28]=i.pronounsPlaceholder,t[29]=j);let M;t[30]===C?M=t[31]:(M=X.map(e=>(0,$.jsx)(J,{value:e.value,children:C(e.labelEn,e.labelZh)},e.value)),t[30]=C,t[31]=M);let N;t[32]===i.custom?N=t[33]:(N=(0,$.jsx)(J,{value:`__custom__`,children:i.custom}),t[32]=i.custom,t[33]=N);let P;t[34]!==o||t[35]!==k||t[36]!==A||t[37]!==j||t[38]!==M||t[39]!==N?(P=(0,$.jsxs)(d,{className:o,value:k,onChange:A,children:[j,M,N]}),t[34]=o,t[35]=k,t[36]=A,t[37]=j,t[38]=M,t[39]=N,t[40]=P):P=t[40];let F;t[41]!==o||t[42]!==i.pronounsPlaceholder||t[43]!==g||t[44]!==x||t[45]!==n.pronouns?(F=g?(0,$.jsx)(`input`,{className:s(o,`mt-1 text-xs`),value:n.pronouns,onChange:e=>x({pronouns:e.target.value}),placeholder:i.pronounsPlaceholder,autoComplete:`off`}):null,t[41]=o,t[42]=i.pronounsPlaceholder,t[43]=g,t[44]=x,t[45]=n.pronouns,t[46]=F):F=t[46];let I;t[47]!==O||t[48]!==P||t[49]!==F?(I=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm`,children:[O,P,F]}),t[47]=O,t[48]=P,t[49]=F,t[50]=I):I=t[50];let L;t[51]===i.timezone?L=t[52]:(L=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.timezone}),t[51]=i.timezone,t[52]=L);let R;t[53]===o?R=t[54]:(R=s(o,`min-w-0 flex-1`),t[53]=o,t[54]=R);let z;t[55]===x?z=t[56]:(z=e=>{if(e.target.value===`__custom__`){m(!0);return}m(!1),u(``),x({timezone:e.target.value})},t[55]=x,t[56]=z);let B;t[57]===C?B=t[58]:(B=pe.map(e=>(0,$.jsx)(J,{value:e.value,children:C(e.labelEn,e.labelZh)},e.value)),t[57]=C,t[58]=B);let V;t[59]===i.timezoneCustom?V=t[60]:(V=(0,$.jsx)(J,{value:`__custom__`,children:i.timezoneCustom}),t[59]=i.timezoneCustom,t[60]=V);let H;t[61]!==R||t[62]!==z||t[63]!==B||t[64]!==V||t[65]!==y?(H=(0,$.jsxs)(d,{className:R,value:y,onChange:z,children:[B,V]}),t[61]=R,t[62]=z,t[63]=B,t[64]=V,t[65]=y,t[66]=H):H=t[66];let U;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(U=s(`shrink-0 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,G.press),t[67]=U):U=t[67];let W;t[68]===x?W=t[69]:(W=()=>{let e=oe();if(!e)return;let t=pe.some(t=>t.value===e);m(!t),u(t?``:e),x({timezone:e})},t[68]=x,t[69]=W);let ee;t[70]!==i.timezoneDetect||t[71]!==W?(ee=(0,$.jsx)(`button`,{type:`button`,className:U,onClick:W,children:i.timezoneDetect}),t[70]=i.timezoneDetect,t[71]=W,t[72]=ee):ee=t[72];let K;t[73]!==H||t[74]!==ee?(K=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[H,ee]}),t[73]=H,t[74]=ee,t[75]=K):K=t[75];let q;t[76]!==l||t[77]!==o||t[78]!==p||t[79]!==x?(q=p?(0,$.jsx)(`input`,{className:s(o,`mt-1 font-mono text-xs`),value:l,onChange:e=>{u(e.target.value),x({timezone:e.target.value})},placeholder:`e.g. Asia/Shanghai`,autoComplete:`off`}):null,t[76]=l,t[77]=o,t[78]=p,t[79]=x,t[80]=q):q=t[80];let te;t[81]!==L||t[82]!==K||t[83]!==q?(te=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[L,K,q]}),t[81]=L,t[82]=K,t[83]=q,t[84]=te):te=t[84];let ne;t[85]===i.notes?ne=t[86]:(ne=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.notes}),t[85]=i.notes,t[86]=ne);let Y;t[87]===o?Y=t[88]:(Y=s(o,`min-h-28 resize-y text-sm leading-relaxed`),t[87]=o,t[88]=Y);let re;t[89]===x?re=t[90]:(re=e=>x({notes:e.target.value}),t[89]=x,t[90]=re);let ie;t[91]!==i.notesPlaceholder||t[92]!==Y||t[93]!==re||t[94]!==n.notes?(ie=(0,$.jsx)(`textarea`,{className:Y,value:n.notes,onChange:re,placeholder:i.notesPlaceholder,rows:5,spellCheck:!0}),t[91]=i.notesPlaceholder,t[92]=Y,t[93]=re,t[94]=n.notes,t[95]=ie):ie=t[95];let ae;t[96]!==ne||t[97]!==ie?(ae=(0,$.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[ne,ie]}),t[96]=ne,t[97]=ie,t[98]=ae):ae=t[98];let Z;return t[99]!==D||t[100]!==I||t[101]!==te||t[102]!==ae?(Z=(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[D,I,te,ae]}),t[99]=D,t[100]=I,t[101]=te,t[102]=ae,t[103]=Z):Z=t[103],Z}function Ue(e){let t=(0,Ve.c)(57),{open:n,t:r,onOpenChange:i,onNavigate:a}=e,o;t[0]!==r.helpLearningBody||t[1]!==r.helpLearningTitle?(o={icon:me,title:r.helpLearningTitle,body:r.helpLearningBody},t[0]=r.helpLearningBody,t[1]=r.helpLearningTitle,t[2]=o):o=t[2];let c;t[3]!==r.helpSharingBody||t[4]!==r.helpSharingTitle?(c={icon:D,title:r.helpSharingTitle,body:r.helpSharingBody},t[3]=r.helpSharingBody,t[4]=r.helpSharingTitle,t[5]=c):c=t[5];let l;t[6]!==r.helpSourcesBody||t[7]!==r.helpSourcesTitle?(l={icon:p,title:r.helpSourcesTitle,body:r.helpSourcesBody},t[6]=r.helpSourcesBody,t[7]=r.helpSourcesTitle,t[8]=l):l=t[8];let u;t[9]!==r.helpControlBody||t[10]!==r.helpControlTitle?(u={icon:ye,title:r.helpControlTitle,body:r.helpControlBody},t[9]=r.helpControlBody,t[10]=r.helpControlTitle,t[11]=u):u=t[11];let d;t[12]!==o||t[13]!==c||t[14]!==l||t[15]!==u?(d=[o,c,l,u],t[12]=o,t[13]=c,t[14]=l,t[15]=u,t[16]=d):d=t[16];let f=d,h;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(m,{className:s(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,xe)}),t[17]=h):h=t[17];let g;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(g=s(`fixed right-3 top-1/2 flex h-[min(44rem,calc(100dvh-1.5rem))] w-[min(30rem,calc(100vw-1.5rem))] -translate-y-1/2 flex-col overflow-hidden`,W,`rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`),t[18]=g):g=t[18];let _;t[19]===r.helpTitle?_=t[20]:(_=(0,$.jsx)(b,{className:`text-base font-semibold text-fg`,children:r.helpTitle}),t[19]=r.helpTitle,t[20]=_);let y;t[21]===r.helpSubtitle?y=t[22]:(y=(0,$.jsx)(Ne,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r.helpSubtitle}),t[21]=r.helpSubtitle,t[22]=y);let x;t[23]!==_||t[24]!==y?(x=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[_,y]}),t[23]=_,t[24]=y,t[25]=x):x=t[25];let C;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(ue,{className:`size-4`,"aria-hidden":!0}),t[26]=C):C=t[26];let w;t[27]===r.close?w=t[28]:(w=(0,$.jsx)(E,{asChild:!0,children:(0,$.jsx)(v,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":r.close,children:C})}),t[27]=r.close,t[28]=w);let T;t[29]!==x||t[30]!==w?(T=(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-4`,children:[x,w]}),t[29]=x,t[30]=w,t[31]=T):T=t[31];let O;t[32]===f?O=t[33]:(O=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-2`,children:f.map(We)}),t[32]=f,t[33]=O);let A;t[34]!==a||t[35]!==i?(A=()=>{i(!1),a(`sources`)},t[34]=a,t[35]=i,t[36]=A):A=t[36];let j;t[37]!==r.tabs.sources||t[38]!==A?(j=(0,$.jsx)(v,{type:`button`,variant:`ghost`,onClick:A,children:r.tabs.sources}),t[37]=r.tabs.sources,t[38]=A,t[39]=j):j=t[39];let M;t[40]!==a||t[41]!==i?(M=()=>{i(!1),a(`privacy`)},t[40]=a,t[41]=i,t[42]=M):M=t[42];let N;t[43]!==r.openPrivacyControls||t[44]!==M?(N=(0,$.jsx)(v,{type:`button`,variant:`secondary`,onClick:M,children:r.openPrivacyControls}),t[43]=r.openPrivacyControls,t[44]=M,t[45]=N):N=t[45];let F;t[46]!==j||t[47]!==N?(F=(0,$.jsxs)(`footer`,{className:`flex shrink-0 flex-wrap justify-end gap-2 border-t border-edge px-5 py-4`,children:[j,N]}),t[46]=j,t[47]=N,t[48]=F):F=t[48];let I;t[49]!==T||t[50]!==O||t[51]!==F?(I=(0,$.jsxs)(P,{children:[h,(0,$.jsxs)(k,{className:g,children:[T,O,F]})]}),t[49]=T,t[50]=O,t[51]=F,t[52]=I):I=t[52];let L;return t[53]!==i||t[54]!==n||t[55]!==I?(L=(0,$.jsx)(S,{open:n,onOpenChange:i,children:I}),t[53]=i,t[54]=n,t[55]=I,t[56]=L):L=t[56],L}function We(e){let{icon:t,title:n,body:r}=e;return(0,$.jsxs)(`section`,{className:`flex gap-3 border-b border-edge-subtle py-4 last:border-b-0`,children:[(0,$.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-lg bg-surface-muted text-fg-muted`,children:(0,$.jsx)(t,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r})]})]},n)}var Ge={zh:[`周日`,`周一`,`周二`,`周三`,`周四`,`周五`,`周六`],en:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]};function Ke(e,t){if(e.kind===`interval`){let n=t===`zh`?`每 ${e.everyHours} 小时`:`Every ${e.everyHours} hours`;return e.minute===0?n:t===`zh`?`${n},整点后 ${e.minute} 分`:`${n}, at :${String(e.minute).padStart(2,`0`)}`}if(e.kind===`daily`)return t===`zh`?`每天 ${e.time}`:`Daily at ${e.time}`;let n=Ge[t][e.weekday];return t===`zh`?`每${n} ${e.time}`:`Every ${n} at ${e.time}`}function qe(e,t,n){return e?new Intl.DateTimeFormat(t===`zh`?`zh-CN`:`en-US`,{timeZone:n,month:`short`,day:`numeric`,weekday:`short`,hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`}).format(new Date(e)):t===`zh`?`暂无计划`:`Not scheduled`}function Je(e,t){let n=new Intl.DateTimeFormat(`en`,{timeZone:e,timeZoneName:`shortOffset`}).formatToParts().find(e=>e.type===`timeZoneName`)?.value,r=t===`zh`&&e===`Asia/Shanghai`?`中国标准时间`:e;return n?`${r} (${n.replace(`GMT`,`UTC`)})`:r}var Ye={light:{kind:`interval`,everyHours:6,minute:0},deep:{kind:`daily`,time:`03:00`},rem:{kind:`weekly`,weekday:0,time:`05:00`}},Xe=[1,2,3,4,6,8,12,24];function Ze(e){let t=(0,Ve.c)(136),{open:n,phase:r,value:i,language:a,saving:o,onOpenChange:c,onSave:l}=e,u=a===`zh`,[f,p]=(0,Q.useState)(i),h,g;t[0]!==n||t[1]!==i?(h=()=>{n&&p(i)},g=[n,i],t[0]=n,t[1]=i,t[2]=h,t[3]=g):(h=t[2],g=t[3]),(0,Q.useEffect)(h,g);let _;t[4]===f?_=t[5]:(_=e=>{let t=f.schedule,n=t.kind===`daily`||t.kind===`weekly`?t.time:`03:00`,r=e===`interval`?{kind:e,everyHours:6,minute:0}:e===`daily`?{kind:e,time:n}:{kind:e,weekday:0,time:n};p({...f,schedule:r})},t[4]=f,t[5]=_);let y=_,x;t[6]===f?x=t[7]:(x=e=>{f.schedule.kind===`interval`&&p({...f,schedule:{...f.schedule,...e}})},t[6]=f,t[7]=x);let C=x,w;t[8]===f?w=t[9]:(w=e=>{f.schedule.kind===`weekly`&&p({...f,schedule:{...f.schedule,...e}})},t[8]=f,t[9]=w);let T=w,D;t[10]===f?D=t[11]:(D=e=>{f.schedule.kind!==`interval`&&p({...f,schedule:{...f.schedule,time:e}})},t[10]=f,t[11]=D);let O=D,A;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(m,{className:s(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,xe)}),t[12]=A):A=t[12];let j;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(j=s(`fixed left-1/2 top-1/2 flex h-[min(38rem,calc(100dvh-1.5rem))] w-[min(32rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,W,`rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`),t[13]=j):j=t[13];let M;t[14]===r?M=t[15]:(M=r.toUpperCase(),t[14]=r,t[15]=M);let N=u?`运行计划`:`Schedule`,F;t[16]!==N||t[17]!==M?(F=(0,$.jsxs)(b,{className:`text-base font-semibold text-fg`,children:[M,` · `,N]}),t[16]=N,t[17]=M,t[18]=F):F=t[18];let I=u?`设置后台记忆整理的频率和时间。`:`Choose when background memory consolidation runs.`,L;t[19]===I?L=t[20]:(L=(0,$.jsx)(Ne,{className:`mt-1 text-sm text-fg-muted`,children:I}),t[19]=I,t[20]=L);let R;t[21]!==F||t[22]!==L?(R=(0,$.jsxs)(`div`,{children:[F,L]}),t[21]=F,t[22]=L,t[23]=R):R=t[23];let z=u?`关闭`:`Close`,B;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(ue,{className:`size-4`}),t[24]=B):B=t[24];let V;t[25]===z?V=t[26]:(V=(0,$.jsx)(E,{asChild:!0,children:(0,$.jsx)(v,{variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":z,children:B})}),t[25]=z,t[26]=V);let H;t[27]!==R||t[28]!==V?(H=(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-4`,children:[R,V]}),t[27]=R,t[28]=V,t[29]=H):H=t[29];let U=u?`自动运行`:`Automatic runs`,G;t[30]===U?G=t[31]:(G=(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:U}),t[30]=U,t[31]=G);let ee=u?`关闭后仍可手动立即运行。`:`You can still run this phase manually.`,K;t[32]===ee?K=t[33]:(K=(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:ee}),t[32]=ee,t[33]=K);let q;t[34]!==G||t[35]!==K?(q=(0,$.jsxs)(`div`,{children:[G,K]}),t[34]=G,t[35]=K,t[36]=q):q=t[36];let te=f.enabled,ne=f.enabled?`bg-accent`:`bg-surface-active`,Y;t[37]===ne?Y=t[38]:(Y=s(`relative h-6 w-11 shrink-0 overflow-hidden rounded-full transition-colors`,ne),t[37]=ne,t[38]=Y);let X;t[39]===f?X=t[40]:(X=()=>p({...f,enabled:!f.enabled}),t[39]=f,t[40]=X);let re=f.enabled&&`translate-x-5`,ie;t[41]===re?ie=t[42]:(ie=s(`absolute left-0.5 top-0.5 size-5 rounded-full bg-white shadow-sm transition-transform`,re),t[41]=re,t[42]=ie);let Z;t[43]===ie?Z=t[44]:(Z=(0,$.jsx)(`span`,{className:ie}),t[43]=ie,t[44]=Z);let oe;t[45]!==f.enabled||t[46]!==Y||t[47]!==X||t[48]!==Z?(oe=(0,$.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":te,className:Y,onClick:X,children:Z}),t[45]=f.enabled,t[46]=Y,t[47]=X,t[48]=Z,t[49]=oe):oe=t[49];let se;t[50]!==q||t[51]!==oe?(se=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-4 rounded-xl border border-edge-subtle bg-surface-subtle px-4 py-3`,children:[q,oe]}),t[50]=q,t[51]=oe,t[52]=se):se=t[52];let ce=u?`运行频率`:`Frequency`,le;t[53]===ce?le=t[54]:(le=(0,$.jsx)(`span`,{children:ce}),t[53]=ce,t[54]=le);let de;t[55]===y?de=t[56]:(de=e=>y(e.target.value),t[55]=y,t[56]=de);let fe=u?`每隔几小时`:`Every few hours`,pe;t[57]===fe?pe=t[58]:(pe=(0,$.jsx)(J,{value:`interval`,children:fe}),t[57]=fe,t[58]=pe);let me=u?`每天`:`Daily`,he;t[59]===me?he=t[60]:(he=(0,$.jsx)(J,{value:`daily`,children:me}),t[59]=me,t[60]=he);let ge=u?`每周`:`Weekly`,_e;t[61]===ge?_e=t[62]:(_e=(0,$.jsx)(J,{value:`weekly`,children:ge}),t[61]=ge,t[62]=_e);let ve;t[63]!==f.schedule.kind||t[64]!==de||t[65]!==pe||t[66]!==he||t[67]!==_e?(ve=(0,$.jsxs)(d,{value:f.schedule.kind,onChange:de,children:[pe,he,_e]}),t[63]=f.schedule.kind,t[64]=de,t[65]=pe,t[66]=he,t[67]=_e,t[68]=ve):ve=t[68];let ye;t[69]!==le||t[70]!==ve?(ye=(0,$.jsxs)(`label`,{className:`block space-y-2 text-sm font-medium text-fg`,children:[le,ve]}),t[69]=le,t[70]=ve,t[71]=ye):ye=t[71];let be;t[72]!==f.schedule.everyHours||t[73]!==f.schedule.kind||t[74]!==f.schedule.minute||t[75]!==C||t[76]!==u?(be=f.schedule.kind===`interval`?(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:`block space-y-2 text-sm font-medium text-fg`,children:[(0,$.jsx)(`span`,{children:u?`间隔`:`Interval`}),(0,$.jsx)(d,{value:String(f.schedule.everyHours),onChange:e=>C({everyHours:Number(e.target.value)}),children:Xe.map(e=>(0,$.jsx)(J,{value:String(e),children:u?`${e} 小时`:`${e} hours`},e))})]}),(0,$.jsxs)(`label`,{className:`block space-y-2 text-sm font-medium text-fg`,children:[(0,$.jsx)(`span`,{children:u?`开始分钟`:`Minute`}),(0,$.jsx)(d,{value:String(f.schedule.minute),onChange:e=>C({minute:Number(e.target.value)}),children:[0,15,30,45].map($e)})]})]}):null,t[72]=f.schedule.everyHours,t[73]=f.schedule.kind,t[74]=f.schedule.minute,t[75]=C,t[76]=u,t[77]=be):be=t[77];let Se;t[78]!==f.schedule.kind||t[79]!==f.schedule.weekday||t[80]!==T||t[81]!==u?(Se=f.schedule.kind===`weekly`?(0,$.jsxs)(`label`,{className:`block space-y-2 text-sm font-medium text-fg`,children:[(0,$.jsx)(`span`,{children:u?`星期`:`Weekday`}),(0,$.jsx)(d,{value:String(f.schedule.weekday),onChange:e=>T({weekday:Number(e.target.value)}),children:(u?[`周日`,`周一`,`周二`,`周三`,`周四`,`周五`,`周六`]:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]).map(Qe)})]}):null,t[78]=f.schedule.kind,t[79]=f.schedule.weekday,t[80]=T,t[81]=u,t[82]=Se):Se=t[82];let Ce;t[83]!==f.schedule.kind||t[84]!==f.schedule.time||t[85]!==O||t[86]!==u?(Ce=f.schedule.kind===`daily`||f.schedule.kind===`weekly`?(0,$.jsxs)(`label`,{className:`block space-y-2 text-sm font-medium text-fg`,children:[(0,$.jsx)(`span`,{children:u?`运行时间`:`Run time`}),(0,$.jsx)(Le,{value:f.schedule.time,minuteStep:15,ariaLabel:u?`运行时间`:`Run time`,onChange:O})]}):null,t[83]=f.schedule.kind,t[84]=f.schedule.time,t[85]=O,t[86]=u,t[87]=Ce):Ce=t[87];let we=u?`计划预览`:`Schedule preview`,Te;t[88]===we?Te=t[89]:(Te=(0,$.jsx)(`p`,{className:`text-xs font-medium text-accent-fg`,children:we}),t[88]=we,t[89]=Te);let Ee;t[90]!==f.schedule||t[91]!==a?(Ee=Ke(f.schedule,a),t[90]=f.schedule,t[91]=a,t[92]=Ee):Ee=t[92];let De;t[93]===Ee?De=t[94]:(De=(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:Ee}),t[93]=Ee,t[94]=De);let Oe;t[95]!==Te||t[96]!==De?(Oe=(0,$.jsxs)(`div`,{className:`rounded-xl bg-accent-soft px-4 py-3`,children:[Te,De]}),t[95]=Te,t[96]=De,t[97]=Oe):Oe=t[97];let ke;t[98]!==se||t[99]!==ye||t[100]!==be||t[101]!==Se||t[102]!==Ce||t[103]!==Oe?(ke=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto px-5 py-5`,children:[se,ye,be,Se,Ce,Oe]}),t[98]=se,t[99]=ye,t[100]=be,t[101]=Se,t[102]=Ce,t[103]=Oe,t[104]=ke):ke=t[104];let Ae;t[105]===r?Ae=t[106]:(Ae=()=>p({enabled:!0,schedule:Ye[r]}),t[105]=r,t[106]=Ae);let je;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(je=(0,$.jsx)(ae,{className:`size-4`}),t[107]=je):je=t[107];let Me=u?`恢复推荐值`:`Restore recommended`,Pe;t[108]!==o||t[109]!==Ae||t[110]!==Me?(Pe=(0,$.jsxs)(v,{type:`button`,variant:`ghost`,disabled:o,onClick:Ae,children:[je,Me]}),t[108]=o,t[109]=Ae,t[110]=Me,t[111]=Pe):Pe=t[111];let Fe=u?`取消`:`Cancel`,Ie;t[112]!==o||t[113]!==Fe?(Ie=(0,$.jsx)(E,{asChild:!0,children:(0,$.jsx)(v,{type:`button`,variant:`ghost`,disabled:o,children:Fe})}),t[112]=o,t[113]=Fe,t[114]=Ie):Ie=t[114];let Re;t[115]!==f||t[116]!==l?(Re=()=>void l(f),t[115]=f,t[116]=l,t[117]=Re):Re=t[117];let ze=o?u?`保存中…`:`Saving…`:u?`保存`:`Save`,Be;t[118]!==o||t[119]!==Re||t[120]!==ze?(Be=(0,$.jsx)(v,{type:`button`,variant:`primary`,disabled:o,onClick:Re,children:ze}),t[118]=o,t[119]=Re,t[120]=ze,t[121]=Be):Be=t[121];let He;t[122]!==Ie||t[123]!==Be?(He=(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[Ie,Be]}),t[122]=Ie,t[123]=Be,t[124]=He):He=t[124];let Ue;t[125]!==Pe||t[126]!==He?(Ue=(0,$.jsxs)(`footer`,{className:`flex shrink-0 items-center justify-between gap-3 border-t border-edge px-5 py-4`,children:[Pe,He]}),t[125]=Pe,t[126]=He,t[127]=Ue):Ue=t[127];let We;t[128]!==H||t[129]!==ke||t[130]!==Ue?(We=(0,$.jsxs)(P,{children:[A,(0,$.jsxs)(k,{className:j,children:[H,ke,Ue]})]}),t[128]=H,t[129]=ke,t[130]=Ue,t[131]=We):We=t[131];let Ge;return t[132]!==c||t[133]!==n||t[134]!==We?(Ge=(0,$.jsx)(S,{open:n,onOpenChange:c,children:We}),t[132]=c,t[133]=n,t[134]=We,t[135]=Ge):Ge=t[135],Ge}function Qe(e,t){return(0,$.jsx)(J,{value:String(t),children:e},e)}function $e(e){return(0,$.jsx)(J,{value:String(e),children:String(e).padStart(2,`0`)},e)}var et=[`UTC`,`Asia/Shanghai`,`Asia/Hong_Kong`,`Asia/Tokyo`,`Asia/Singapore`,`Asia/Kolkata`,`Europe/London`,`Europe/Paris`,`America/New_York`,`America/Chicago`,`America/Denver`,`America/Los_Angeles`,`Australia/Sydney`],tt={zh:{light:[`快速整理`,`整理近期产生的记忆信号。`],deep:[`深度巩固`,`强化反复被证明有用的理解。`],rem:[`模式发现`,`从跨任务证据中提出长期模式。`]},en:{light:[`Quick consolidation`,`Organizes recently created memory signals.`],deep:[`Deep consolidation`,`Strengthens understanding that repeatedly proves useful.`],rem:[`Pattern discovery`,`Proposes long-term patterns from evidence across tasks.`]}};function nt({language:e}){let t=e===`zh`,{data:n,error:r,isLoading:i,mutate:a}=u(`/api/you/dreaming`,y),[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null);if(i)return(0,$.jsx)(Oe,{className:`h-64 rounded-2xl`});if(r||!n)return(0,$.jsx)(`div`,{className:`rounded-2xl border border-danger/25 bg-danger-soft p-5 text-sm text-danger`,children:t?`无法加载 Dreaming 状态`:`Could not load Dreaming status`});let p=t?{off:`关闭`,observe:`只观察`,review:`生成待确认建议`,automatic:`自动应用高置信结果`}:{off:`Off`,observe:`Observe only`,review:`Propose for review`,automatic:`Apply high-confidence results`},m=t?{insufficient_feedback:`还需要更多经过评价的回答`,low_helpful_rate:`记忆帮助率尚未达标`,high_record_error_rate:`记录错误率偏高`,sensitive_feedback_detected:`近期出现敏感信息反馈`,insufficient_dreaming_runs:`还需要更多稳定运行记录`,high_dreaming_failure_rate:`后台整理失败率偏高`}:{insufficient_feedback:`More evaluated responses are required`,low_helpful_rate:`Memory helpfulness is below the threshold`,high_record_error_rate:`Record error rate is too high`,sensitive_feedback_detected:`Recent sensitive-information feedback was detected`,insufficient_dreaming_runs:`More stable Dreaming runs are required`,high_dreaming_failure_rate:`Dreaming failure rate is too high`},h=async(e,t)=>{s(t);try{return await _e(e),await a(),!0}catch(e){return I({type:`error`,title:`Dreaming`,message:e instanceof Error?e.message:String(e)}),!1}finally{s(null)}},g=async e=>{s(`run:${e}`);try{await f(e),await a()}catch(e){I({type:`error`,title:`Dreaming`,message:e instanceof Error?e.message:String(e)})}finally{s(null)}},_=[...new Set([n.settings.timezone,...et])],b=tt[e];return(0,$.jsxs)(`div`,{id:`you-panel-dreaming`,role:`tabpanel`,"aria-labelledby":`you-tab-dreaming`,className:`space-y-6`,children:[(0,$.jsxs)(`section`,{children:[(0,$.jsxs)(`h2`,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[(0,$.jsx)(T,{className:`size-4 text-accent`,"aria-hidden":!0}),`Dreaming`]}),(0,$.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-6 text-fg-muted`,children:t?`在空闲时整理已有证据、发现模式,并用可审计的方式提出或应用长期理解。`:`Consolidates existing evidence during idle time, discovers patterns, and records every proposal or change.`})]}),(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-[minmax(0,1fr)_16rem]`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t?`运行模式`:`Operating mode`}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t?`当前生效:${p[n.config.mode]} · 写入级别:${n.config.writeDisposition}`:`Effective: ${p[n.config.mode]} · write disposition: ${n.config.writeDisposition}`})]}),(0,$.jsx)(d,{value:n.settings.mode,disabled:o!==null,onChange:e=>void h({...n.settings,mode:e.target.value},`mode`),children:Object.entries(p).map(([e,t])=>(0,$.jsx)(J,{value:e,children:t},e))})]}),n.settings.mode===`automatic`&&!n.readiness.ready?(0,$.jsxs)(`div`,{className:`mt-4 rounded-xl border border-warning/25 bg-warning-soft/35 px-4 py-3`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t?`自动写入暂时降级为待确认`:`Automatic writes are temporarily downgraded to review`}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n.readiness.reasons.map(e=>m[e]??e).join(t?`;`:`; `)})]}):null]}),(0,$.jsxs)(`section`,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,$.jsx)(re,{className:`size-4 text-fg-muted`}),t?`运行计划`:`Schedule`]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:Je(n.settings.timezone,e)})]}),(0,$.jsx)(`div`,{className:`w-full sm:w-64`,children:(0,$.jsx)(d,{value:n.settings.timezone,disabled:o!==null,onChange:e=>void h({...n.settings,timezone:e.target.value},`timezone`),children:_.map(t=>(0,$.jsx)(J,{value:t,children:Je(t,e)},t))})})]}),(0,$.jsx)(`div`,{className:`mt-3 grid gap-3 lg:grid-cols-3`,children:[`light`,`deep`,`rem`].map(r=>{let i=n.settings.phases[r],a=n.config.phases[r],[s,c]=b[r],u=i.enabled&&n.config.enabled;return(0,$.jsxs)(`article`,{className:`flex min-h-52 flex-col rounded-2xl border border-edge bg-surface-panel p-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-wide text-accent`,children:r}),(0,$.jsx)(`h4`,{className:`mt-1 text-sm font-semibold text-fg`,children:s})]}),(0,$.jsx)(`span`,{className:u?`text-xs text-success`:`text-xs text-fg-subtle`,children:u?t?`已启用`:`Enabled`:i.enabled?t?`随模式暂停`:`Paused by mode`:t?`已暂停`:`Paused`})]}),(0,$.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:c}),(0,$.jsxs)(`div`,{className:`mt-4 rounded-xl bg-surface-muted px-3 py-3`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:Ke(i.schedule,e)}),(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[t?`下次运行:`:`Next run: `,u?qe(a.nextRunsAt[0],e,n.settings.timezone):t?`已暂停`:`Paused`]})]}),(0,$.jsxs)(`div`,{className:`mt-auto flex gap-2 pt-4`,children:[(0,$.jsxs)(v,{type:`button`,variant:`secondary`,className:`flex-1`,disabled:o!==null,onClick:()=>l(r),children:[(0,$.jsx)(le,{className:`size-3.5`}),t?`编辑计划`:`Edit`]}),(0,$.jsxs)(v,{type:`button`,variant:`ghost`,className:`flex-1`,disabled:!n.config.enabled||o!==null,onClick:()=>void g(r),children:[(0,$.jsx)(j,{className:`size-3.5`}),t?`立即运行`:`Run now`]})]})]},r)})})]}),(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t?`最近运行`:`Recent runs`}),n.runs.length?(0,$.jsx)(`div`,{className:`mt-3 divide-y divide-edge overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:n.runs.map(t=>(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 px-4 py-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`p`,{className:`text-sm font-medium uppercase text-fg`,children:[t.phase,` · `,t.mode]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.reason??t.status})]}),(0,$.jsxs)(`div`,{className:`text-right text-xs text-fg-subtle`,children:[(0,$.jsx)(`p`,{children:t.status}),(0,$.jsx)(`p`,{children:Te(Date.parse(t.startedAt),e)})]})]},t.runId))}):(0,$.jsx)(`p`,{className:`mt-3 rounded-xl bg-surface-muted px-4 py-3 text-sm text-fg-muted`,children:t?`还没有运行记录。`:`No runs yet.`})]}),c?(0,$.jsx)(Ze,{open:!0,phase:c,value:n.settings.phases[c],language:e,saving:o===`schedule:${c}`,onOpenChange:e=>{e||l(null)},onSave:async e=>{await h({...n.settings,phases:{...n.settings.phases,[c]:e}},`schedule:${c}`)&&l(null)}}):null]})}function rt(e){let t=(0,Ve.c)(33),{source:n,language:r,busy:i,onOpenChange:a,onConfirm:o}=e,l=c(r).you,[u,d]=(0,Q.useState)(`keep`),f=n?.accountLabel??(n?.accountCount&&n.accountCount>1&&n.accountOrdinal?l.sourceAccountFallback.replace(`{{index}}`,String(n.accountOrdinal)).replace(`{{count}}`,String(n.accountCount)):void 0),g,_;t[0]===n?(g=t[1],_=t[2]):(g=()=>{n&&d(`keep`)},_=[n],t[0]=n,t[1]=g,t[2]=_),(0,Q.useEffect)(g,_);let y;t[3]!==i||t[4]!==a?(y=e=>!i&&a(e),t[3]=i,t[4]=a,t[5]=y):y=t[5];let x;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(m,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[6]=x):x=t[6];let C;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(ue,{className:`size-4`,"aria-hidden":!0}),t[7]=C):C=t[7];let w;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(w=()=>d(`keep`),t[8]=w):w=t[8];let T=u===`keep`?`border-accent/40 bg-accent-soft/35`:`border-edge-subtle hover:bg-surface-hover`,D;t[9]===T?D=t[10]:(D=s(`flex w-full items-start gap-3 rounded-xl border p-4 text-left`,T),t[9]=T,t[10]=D);let O;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,$.jsx)(p,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[11]=O):O=t[11];let A;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(A=()=>d(`delete`),t[12]=A):A=t[12];let j=u===`delete`?`border-danger/40 bg-danger-soft`:`border-edge-subtle hover:bg-surface-hover`,N;t[13]===j?N=t[14]:(N=s(`flex w-full items-start gap-3 rounded-xl border p-4 text-left disabled:cursor-not-allowed disabled:opacity-55`,j),t[13]=j,t[14]=N);let F;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,$.jsx)(M,{className:`mt-0.5 size-4 shrink-0 text-danger`,"aria-hidden":!0}),t[15]=F):F=t[15];let I=l.disconnectDeleteBody.replace(`{{count}}`,String(n?.derivedUnderstandingCount??0)),L;t[16]===I?L=t[17]:(L=(0,$.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:I}),t[16]=I,t[17]=L);let R;t[18]!==i||t[19]!==l.cancel?(R=(0,$.jsx)(E,{asChild:!0,children:(0,$.jsx)(v,{type:`button`,variant:`ghost`,disabled:i,children:l.cancel})}),t[18]=i,t[19]=l.cancel,t[20]=R):R=t[20];let z=u===`delete`?`border-danger/35 text-danger hover:bg-danger-soft`:void 0,B;t[21]!==o||t[22]!==u?(B=()=>o(u),t[21]=o,t[22]=u,t[23]=B):B=t[23];let V;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,$.jsx)(h,{className:`size-4`,"aria-hidden":!0}),t[24]=V):V=t[24];let H=i?l.disconnecting:l.disconnectAction,U;t[25]!==i||t[26]!==z||t[27]!==B||t[28]!==H?(U=(0,$.jsxs)(v,{type:`button`,variant:`secondary`,className:z,disabled:i,onClick:B,children:[V,H]}),t[25]=i,t[26]=z,t[27]=B,t[28]=H,t[29]=U):U=t[29];let W;return t[30]!==R||t[31]!==U?(W=(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle px-5 py-4`,children:[R,U]}),t[30]=R,t[31]=U,t[32]=W):W=t[32],(0,$.jsx)(S,{open:n!==null,onOpenChange:y,children:(0,$.jsxs)(P,{children:[x,(0,$.jsxs)(k,{className:`fixed left-1/2 top-1/2 z-[131] flex h-[min(31rem,calc(100dvh-2rem))] w-[min(32rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-elevated`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-5 py-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(b,{className:`text-base font-semibold text-fg`,children:l.disconnectTitle}),(0,$.jsx)(Ne,{className:`mt-1 text-sm text-fg-muted`,children:l.disconnectBody.replace(`{{source}}`,n?.displayName??``)})]}),(0,$.jsx)(E,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":l.cancel,disabled:i,children:C})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-3 overflow-y-auto p-5`,children:[(0,$.jsxs)(`div`,{className:`rounded-xl bg-surface-muted px-4 py-3 text-xs leading-5 text-fg-muted`,children:[f?(0,$.jsx)(`p`,{className:`font-medium text-fg`,children:l.disconnectAccount.replace(`{{account}}`,f)}):null,(0,$.jsx)(`p`,{children:l.disconnectImpact.replace(`{{items}}`,String(n?.knowledgeItemCount??0)).replace(`{{understandings}}`,String(n?.derivedUnderstandingCount??0))})]}),(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":u===`keep`,onClick:w,className:D,children:[O,(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:l.disconnectKeepTitle}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:l.disconnectKeepBody})]})]}),(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":u===`delete`,onClick:A,disabled:!n?.derivedUnderstandingCount,className:N,children:[F,(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:l.disconnectDeleteTitle}),L]})]})]}),W]})]})})}var it={"composio-gmail":`gmail`,"composio-googledrive":`google-drive`,"composio-notion":`notion`,"composio-slack":`slack`,memory:`memory`};function at(e){if(e.branding?.logoUrl)return e.branding;let t=it[e.id];return t?{...e.branding,logoUrl:`/connector-icons/${t}.svg`}:e.branding}function ot(e,t){return Object.entries(t).reduce((e,[t,n])=>e.replace(`{{${t}}}`,String(n)),e)}function st(e){return e.status===`active`||e.status===`connected`}function ct(e,t){return!st(e)||e.learning?.status===`failed`||e.lastSyncStatus===`failed`?{summary:t.sourceNeedsAttention,tone:`attention`,badge:t.attentionTitle}:e.learning?.status===`paused`?{summary:t.sourcePausedSummary,tone:`paused`,badge:t.paused}:e.learning?.status===`queued`||e.learning?.status===`running`?{summary:t.sourceReading,tone:`learning`}:e.learningFunnel.provisionalClaims>0?{summary:ot(t.sourcePendingReview,{count:e.learningFunnel.provisionalClaims}),tone:`review`}:e.learningFunnel.activeClaims>0?{summary:ot(t.sourceReliable,{count:e.learningFunnel.activeClaims}),tone:`useful`}:e.learningFunnel.attributedItems>0?{summary:ot(t.sourceStillLearning,{count:e.learningFunnel.attributedItems}),tone:`learning`}:e.learningFunnel.indexedItems>0?{summary:ot(t.sourceNoPersonalSignal,{count:e.learningFunnel.indexedItems}),tone:`neutral`}:e.learning?.status===`completed`?{summary:t.sourceNoRecentSignal,tone:`neutral`}:{summary:t.sourcePreparing,tone:`learning`}}function lt(e,t){let n=e.id.toLocaleLowerCase();return/(github|gitlab|linear|jira)/.test(n)?t.sourcePurposeWork:/(gmail|outlook|slack|teams)/.test(n)?t.sourcePurposeCommunication:/calendar/.test(n)?t.sourcePurposeSchedule:/(docs|drive|notion|sheets|excel|onedrive|one-drive|local-files)/.test(n)?t.sourcePurposeDocuments:t.sourcePurposeDefault}function ut(e,t){return e.accountLabel?e.accountLabel:e.accountCount&&e.accountCount>1&&e.accountOrdinal?ot(t.sourceAccountFallback,{index:e.accountOrdinal,count:e.accountCount}):t.sourceUnknownAccount}function dt(e){return e.lastSyncAt??e.learning?.updatedAt??e.lastActivityAt??e.lastConnectedAt}function ft(e,t){let n=Date.parse(e);return Number.isFinite(n)?Te(n,t):e}function pt(e,t){return{attention:0,learning:1,review:2,useful:3,paused:4,neutral:5}[ct(e,t).tone]}function mt(e){let t=(0,Ve.c)(173),{source:n,language:r,t:i,busy:a,onOpenChange:o,onLearn:c,onPause:l,onConfigure:u,onDisconnect:d,onViewUnderstanding:f}=e;if(!n)return null;let p;t[0]!==n||t[1]!==i?(p=ct(n,i),t[0]=n,t[1]=i,t[2]=p):p=t[2];let g=p,_,y,x,C,w,T,D,O,A,j,M,N,F,I,L,R;if(t[3]!==r||t[4]!==o||t[5]!==f||t[6]!==g.summary||t[7]!==g.tone||t[8]!==n||t[9]!==i){let e=dt(n);C=n.learning?.status===`paused`,w=g.tone===`attention`,x=S,D=!0,O=o,y=P,t[26]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(m,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[26]=T):T=t[26],_=k,L=`fixed inset-y-0 right-0 z-[131] flex h-dvh w-[min(34rem,100vw)] flex-col overflow-hidden border-l border-edge bg-surface-panel shadow-elevated`;let a=n.displayName,c;t[27]===n?c=t[28]:(c=at(n),t[27]=n,t[28]=c);let l;t[29]!==n.displayName||t[30]!==c?(l=(0,$.jsx)(Be,{connector:{displayName:a,branding:c},size:`sm`}),t[29]=n.displayName,t[30]=c,t[31]=l):l=t[31];let u;t[32]===n.displayName?u=t[33]:(u=(0,$.jsx)(b,{className:`truncate text-base font-semibold text-fg`,children:n.displayName}),t[32]=n.displayName,t[33]=u);let d;t[34]!==n||t[35]!==i?(d=ut(n,i),t[34]=n,t[35]=i,t[36]=d):d=t[36];let p;t[37]===d?p=t[38]:(p=(0,$.jsx)(Ne,{className:`mt-0.5 truncate text-sm text-fg-muted`,children:d}),t[37]=d,t[38]=p);let h;t[39]!==u||t[40]!==p?(h=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[u,p]}),t[39]=u,t[40]=p,t[41]=h):h=t[41];let B;t[42]!==l||t[43]!==h?(B=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[l,h]}),t[42]=l,t[43]=h,t[44]=B):B=t[44];let V;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,$.jsx)(ue,{className:`size-4`,"aria-hidden":!0}),t[45]=V):V=t[45];let H;t[46]===i.close?H=t[47]:(H=(0,$.jsx)(E,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":i.close,children:V})}),t[46]=i.close,t[47]=H),t[48]!==B||t[49]!==H?(R=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-5 py-4`,children:[B,H]}),t[48]=B,t[49]=H,t[50]=R):R=t[50],F=`min-h-0 flex-1 space-y-5 overflow-y-auto p-5`;let U;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,$.jsx)(me,{className:`size-4 text-accent`,"aria-hidden":!0}),t[51]=U):U=t[51];let W;t[52]===i.sourceTaskTitle?W=t[53]:(W=(0,$.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[U,i.sourceTaskTitle]}),t[52]=i.sourceTaskTitle,t[53]=W);let G=g.tone===`attention`?`border-warning/30 bg-warning-soft text-fg`:`border-edge-subtle bg-surface-muted text-fg`,ee;t[54]===G?ee=t[55]:(ee=s(`mt-3 rounded-xl border px-4 py-3 text-sm leading-6`,G),t[54]=G,t[55]=ee);let K;t[56]!==g.summary||t[57]!==ee?(K=(0,$.jsx)(`p`,{className:ee,children:g.summary}),t[56]=g.summary,t[57]=ee,t[58]=K):K=t[58];let q;t[59]===n.learningFunnel.activeClaims?q=t[60]:(q=(0,$.jsx)(`strong`,{className:`text-xl font-semibold text-fg`,children:n.learningFunnel.activeClaims}),t[59]=n.learningFunnel.activeClaims,t[60]=q);let te;t[61]===i.sourceReliableMetric?te=t[62]:(te=(0,$.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:i.sourceReliableMetric}),t[61]=i.sourceReliableMetric,t[62]=te);let ne;t[63]!==q||t[64]!==te?(ne=(0,$.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-base px-4 py-3`,children:[q,te]}),t[63]=q,t[64]=te,t[65]=ne):ne=t[65];let J;t[66]===n.learningFunnel.provisionalClaims?J=t[67]:(J=(0,$.jsx)(`strong`,{className:`text-xl font-semibold text-fg`,children:n.learningFunnel.provisionalClaims}),t[66]=n.learningFunnel.provisionalClaims,t[67]=J);let Y;t[68]===i.sourcePendingMetric?Y=t[69]:(Y=(0,$.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:i.sourcePendingMetric}),t[68]=i.sourcePendingMetric,t[69]=Y);let X;t[70]!==J||t[71]!==Y?(X=(0,$.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-base px-4 py-3`,children:[J,Y]}),t[70]=J,t[71]=Y,t[72]=X):X=t[72];let re;t[73]!==ne||t[74]!==X?(re=(0,$.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 gap-3`,children:[ne,X]}),t[73]=ne,t[74]=X,t[75]=re):re=t[75];let ie;t[76]!==f||t[77]!==n.learningFunnel.activeClaims||t[78]!==n.learningFunnel.provisionalClaims||t[79]!==i.sourceViewUnderstanding?(ie=n.learningFunnel.activeClaims>0||n.learningFunnel.provisionalClaims>0?(0,$.jsxs)(v,{type:`button`,variant:`ghost`,className:`mt-2 px-2`,onClick:f,children:[i.sourceViewUnderstanding,(0,$.jsx)(fe,{className:`size-4`,"aria-hidden":!0})]}):null,t[76]=f,t[77]=n.learningFunnel.activeClaims,t[78]=n.learningFunnel.provisionalClaims,t[79]=i.sourceViewUnderstanding,t[80]=ie):ie=t[80],t[81]!==W||t[82]!==K||t[83]!==re||t[84]!==ie?(I=(0,$.jsxs)(`section`,{children:[W,K,re,ie]}),t[81]=W,t[82]=K,t[83]=re,t[84]=ie,t[85]=I):I=t[85],A=`border-t border-edge-subtle pt-5`;let ae;t[86]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,$.jsx)(z,{className:`size-4 text-accent`,"aria-hidden":!0}),t[86]=ae):ae=t[86],t[87]===i.sourceRecentRunTitle?j=t[88]:(j=(0,$.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[ae,i.sourceRecentRunTitle]}),t[87]=i.sourceRecentRunTitle,t[88]=j);let Z;t[89]!==n.learningFunnel.activeClaims||t[90]!==n.learningFunnel.attributedItems||t[91]!==n.learningFunnel.indexedItems||t[92]!==i.sourceRecentRunSummary?(Z=ot(i.sourceRecentRunSummary,{indexed:n.learningFunnel.indexedItems,attributed:n.learningFunnel.attributedItems,claims:n.learningFunnel.activeClaims}),t[89]=n.learningFunnel.activeClaims,t[90]=n.learningFunnel.attributedItems,t[91]=n.learningFunnel.indexedItems,t[92]=i.sourceRecentRunSummary,t[93]=Z):Z=t[93],t[94]===Z?M=t[95]:(M=(0,$.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:Z}),t[94]=Z,t[95]=M),N=e?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:ot(i.sourceUpdatedAt,{time:ft(e,r)})}):null,t[3]=r,t[4]=o,t[5]=f,t[6]=g.summary,t[7]=g.tone,t[8]=n,t[9]=i,t[10]=_,t[11]=y,t[12]=x,t[13]=C,t[14]=w,t[15]=T,t[16]=D,t[17]=O,t[18]=A,t[19]=j,t[20]=M,t[21]=N,t[22]=F,t[23]=I,t[24]=L,t[25]=R}else _=t[10],y=t[11],x=t[12],C=t[13],w=t[14],T=t[15],D=t[16],O=t[17],A=t[18],j=t[19],M=t[20],N=t[21],F=t[22],I=t[23],L=t[24],R=t[25];let B;t[96]!==A||t[97]!==j||t[98]!==M||t[99]!==N?(B=(0,$.jsxs)(`section`,{className:A,children:[j,M,N]}),t[96]=A,t[97]=j,t[98]=M,t[99]=N,t[100]=B):B=t[100];let V;t[101]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,$.jsx)(ye,{className:`size-4 text-accent`,"aria-hidden":!0}),t[101]=V):V=t[101];let H;t[102]===i.sourceAccessTitle?H=t[103]:(H=(0,$.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[V,i.sourceAccessTitle]}),t[102]=i.sourceAccessTitle,t[103]=H);let U;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,$.jsx)(Se,{className:`mt-1 size-4 shrink-0 text-success`,"aria-hidden":!0}),t[104]=U):U=t[104];let W;t[105]===i.sourceReadAccess?W=t[106]:(W=(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[U,(0,$.jsx)(`span`,{children:i.sourceReadAccess})]}),t[105]=i.sourceReadAccess,t[106]=W);let G;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,$.jsx)(Se,{className:`mt-1 size-4 shrink-0 text-success`,"aria-hidden":!0}),t[107]=G):G=t[107];let K;t[108]===i.sourceMemoryAccess?K=t[109]:(K=(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[G,(0,$.jsx)(`span`,{children:i.sourceMemoryAccess})]}),t[108]=i.sourceMemoryAccess,t[109]=K);let q;t[110]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,$.jsx)(ye,{className:`mt-1 size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[110]=q):q=t[110];let te=n.access.write?i.sourceWriteAccess:i.sourceNoWriteAccess,ne;t[111]===te?ne=t[112]:(ne=(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[q,(0,$.jsx)(`span`,{children:te})]}),t[111]=te,t[112]=ne);let J;t[113]!==W||t[114]!==K||t[115]!==ne?(J=(0,$.jsxs)(`ul`,{className:`mt-3 space-y-2 text-sm leading-6 text-fg-muted`,children:[W,K,ne]}),t[113]=W,t[114]=K,t[115]=ne,t[116]=J):J=t[116];let Y;t[117]!==H||t[118]!==J?(Y=(0,$.jsxs)(`section`,{className:`border-t border-edge-subtle pt-5`,children:[H,J]}),t[117]=H,t[118]=J,t[119]=Y):Y=t[119];let X;t[120]!==B||t[121]!==Y||t[122]!==F||t[123]!==I?(X=(0,$.jsxs)(`div`,{className:F,children:[I,B,Y]}),t[120]=B,t[121]=Y,t[122]=F,t[123]=I,t[124]=X):X=t[124];let re;t[125]===i.sourceManagementTitle?re=t[126]:(re=(0,$.jsx)(`p`,{className:`mb-2 px-1 text-xs font-medium text-fg-subtle`,children:i.sourceManagementTitle}),t[125]=i.sourceManagementTitle,t[126]=re);let ae;t[127]!==a||t[128]!==C||t[129]!==w||t[130]!==c||t[131]!==l||t[132]!==n||t[133]!==i.sourcePauseLearning||t[134]!==i.sourceResumeLearning||t[135]!==i.sourceRetryLearning?(ae=st(n)?C||w?(0,$.jsxs)(v,{type:`button`,variant:`secondary`,disabled:a,onClick:()=>c(n),children:[a?(0,$.jsx)(ie,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,$.jsx)(he,{className:`size-4`,"aria-hidden":!0}),w?i.sourceRetryLearning:i.sourceResumeLearning]}):(0,$.jsxs)(v,{type:`button`,variant:`secondary`,disabled:a,onClick:()=>l(n),children:[(0,$.jsx)(ce,{className:`size-4`,"aria-hidden":!0}),i.sourcePauseLearning]}):null,t[127]=a,t[128]=C,t[129]=w,t[130]=c,t[131]=l,t[132]=n,t[133]=i.sourcePauseLearning,t[134]=i.sourceResumeLearning,t[135]=i.sourceRetryLearning,t[136]=ae):ae=t[136];let Z;t[137]!==u||t[138]!==n?(Z=()=>u(n),t[137]=u,t[138]=n,t[139]=Z):Z=t[139];let oe;t[140]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,$.jsx)(ee,{className:`size-4`,"aria-hidden":!0}),t[140]=oe):oe=t[140];let se;t[141]!==i.sourceConnectionSettings||t[142]!==Z?(se=(0,$.jsxs)(v,{type:`button`,variant:`secondary`,onClick:Z,children:[oe,i.sourceConnectionSettings]}),t[141]=i.sourceConnectionSettings,t[142]=Z,t[143]=se):se=t[143];let le;t[144]!==d||t[145]!==n?(le=()=>d(n),t[144]=d,t[145]=n,t[146]=le):le=t[146];let de;t[147]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,$.jsx)(h,{className:`size-4`,"aria-hidden":!0}),t[147]=de):de=t[147];let pe;t[148]!==i.disconnect||t[149]!==le?(pe=(0,$.jsxs)(v,{type:`button`,variant:`ghost`,className:`ml-auto text-danger hover:bg-danger-soft hover:text-danger`,onClick:le,children:[de,i.disconnect]}),t[148]=i.disconnect,t[149]=le,t[150]=pe):pe=t[150];let ge;t[151]!==ae||t[152]!==se||t[153]!==pe?(ge=(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[ae,se,pe]}),t[151]=ae,t[152]=se,t[153]=pe,t[154]=ge):ge=t[154];let _e;t[155]!==re||t[156]!==ge?(_e=(0,$.jsxs)(`div`,{className:`shrink-0 border-t border-edge-subtle p-4`,children:[re,ge]}),t[155]=re,t[156]=ge,t[157]=_e):_e=t[157];let ve;t[158]!==_||t[159]!==X||t[160]!==_e||t[161]!==L||t[162]!==R?(ve=(0,$.jsxs)(_,{className:L,children:[R,X,_e]}),t[158]=_,t[159]=X,t[160]=_e,t[161]=L,t[162]=R,t[163]=ve):ve=t[163];let be;t[164]!==y||t[165]!==T||t[166]!==ve?(be=(0,$.jsxs)(y,{children:[T,ve]}),t[164]=y,t[165]=T,t[166]=ve,t[167]=be):be=t[167];let xe;return t[168]!==x||t[169]!==D||t[170]!==O||t[171]!==be?(xe=(0,$.jsx)(x,{open:D,onOpenChange:O,children:be}),t[168]=x,t[169]=D,t[170]=O,t[171]=be,t[172]=xe):xe=t[172],xe}function ht(e){let t=(0,Ve.c)(77),{sources:n,recommendations:r,language:i,t:a,busyId:o,onAddSource:c,onConnectRecommendation:l,onLearn:u,onPause:d,onConfigure:f,onDisconnect:p,onViewUnderstanding:m}=e,[h,g]=(0,Q.useState)(null),y;if(t[0]!==n||t[1]!==a){let e=n.filter(_t),r=new Map;for(let t of e){let e=r.get(t.id)??[];e.push(t),r.set(t.id,e)}let i;t[3]===a?i=t[4]:(i=(e,t)=>Math.min(...e.accounts.map(e=>pt(e,a)))-Math.min(...t.accounts.map(e=>pt(e,a)))||e.source.displayName.localeCompare(t.source.displayName),t[3]=a,t[4]=i),y=[...r.values()].map(e=>({source:e[0],accounts:e.sort((e,t)=>pt(e,a)-pt(t,a)||ut(e,a).localeCompare(ut(t,a)))})).sort(i),t[0]=n,t[1]=a,t[2]=y}else y=t[2];let b=y,x,S,C,w,T,E,D,O,k;if(t[5]!==b||t[6]!==h||t[7]!==n||t[8]!==a.sourceConnectedSummary||t[9]!==a.sourcesSubtitle||t[10]!==a.sourcesTitle){let e=b.reduce(gt,0),r;t[20]!==h||t[21]!==n?(r=h?n.find(e=>e.instanceId===h)??null:null,t[20]=h,t[21]=n,t[22]=r):r=t[22],x=r,E=`you-panel-sources`,D=`tabpanel`,O=`you-tab-sources`,k=`space-y-5`,T=`flex flex-wrap items-start justify-between gap-3`,t[23]===a.sourcesTitle?S=t[24]:(S=(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:a.sourcesTitle}),t[23]=a.sourcesTitle,t[24]=S),t[25]===a.sourcesSubtitle?C=t[26]:(C=(0,$.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-6 text-fg-muted`,children:a.sourcesSubtitle}),t[25]=a.sourcesSubtitle,t[26]=C),w=b.length>0?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:ot(a.sourceConnectedSummary,{accounts:e,sources:b.length})}):null,t[5]=b,t[6]=h,t[7]=n,t[8]=a.sourceConnectedSummary,t[9]=a.sourcesSubtitle,t[10]=a.sourcesTitle,t[11]=x,t[12]=S,t[13]=C,t[14]=w,t[15]=T,t[16]=E,t[17]=D,t[18]=O,t[19]=k}else x=t[11],S=t[12],C=t[13],w=t[14],T=t[15],E=t[16],D=t[17],O=t[18],k=t[19];let A;t[27]!==S||t[28]!==C||t[29]!==w?(A=(0,$.jsxs)(`div`,{children:[S,C,w]}),t[27]=S,t[28]=C,t[29]=w,t[30]=A):A=t[30];let j;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,$.jsx)(_,{className:`size-4`,"aria-hidden":!0}),t[31]=j):j=t[31];let M;t[32]!==c||t[33]!==a.addSource?(M=(0,$.jsxs)(v,{type:`button`,variant:`primary`,onClick:c,children:[j,a.addSource]}),t[32]=c,t[33]=a.addSource,t[34]=M):M=t[34];let N;t[35]!==A||t[36]!==M||t[37]!==T?(N=(0,$.jsxs)(`div`,{className:T,children:[A,M]}),t[35]=A,t[36]=M,t[37]=T,t[38]=N):N=t[38];let P;t[39]!==l||t[40]!==r||t[41]!==a.connectRecommendedSource||t[42]!==a.permissionsBeforeConnectBadge||t[43]!==a.recommendationReason||t[44]!==a.recommendationsTitle?(P=r.length>0?(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.recommendationsTitle}),(0,$.jsx)(`div`,{className:`mt-3 grid gap-3 lg:grid-cols-3`,children:r.map(e=>(0,$.jsxs)(`article`,{className:`rounded-xl border border-accent/20 bg-accent-soft/20 p-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.jsx)(he,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h4`,{className:`truncate text-sm font-semibold text-fg`,children:e.sourceName}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:a.recommendationReason.replace(`{{goal}}`,e.taskTitle)})]})]}),(0,$.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`text-[11px] text-fg-subtle`,children:a.permissionsBeforeConnectBadge}),(0,$.jsx)(v,{type:`button`,variant:`secondary`,className:`h-8 px-2.5`,onClick:()=>l(e.sourceId),children:a.connectRecommendedSource})]})]},e.sourceId))})]}):null,t[39]=l,t[40]=r,t[41]=a.connectRecommendedSource,t[42]=a.permissionsBeforeConnectBadge,t[43]=a.recommendationReason,t[44]=a.recommendationsTitle,t[45]=P):P=t[45];let F;t[46]!==b||t[47]!==i||t[48]!==c||t[49]!==a?(F=b.length>0?(0,$.jsx)(`div`,{className:`space-y-3`,children:b.map(e=>{let{source:t,accounts:n}=e;return(0,$.jsxs)(`section`,{className:`overflow-hidden rounded-2xl border border-edge-subtle bg-surface-base`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3 border-b border-edge-subtle px-4 py-3.5 sm:px-5`,children:[(0,$.jsx)(Be,{connector:{displayName:t.displayName,branding:at(t)},size:`sm`}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.displayName}),n.length>1?(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:ot(a.sourceAccountCount,{count:n.length})}):null]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:lt(t,a)})]})]}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:n.map(e=>{let t=ct(e,a),n=dt(e);return(0,$.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-3 px-4 py-3.5 text-left transition-colors hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/40 sm:px-5`,onClick:()=>g(e.instanceId??null),children:[(0,$.jsx)(`span`,{className:s(`size-2 shrink-0 rounded-full`,t.tone===`attention`?`bg-warning`:t.tone===`useful`?`bg-success`:t.tone===`learning`?`bg-accent`:`bg-fg-subtle/50`),"aria-hidden":!0}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:ut(e,a)}),t.badge?(0,$.jsx)(`span`,{className:s(`rounded-full px-2 py-0.5 text-[11px] font-medium`,t.tone===`attention`?`bg-warning-soft text-fg`:`bg-surface-muted text-fg-muted`),children:t.badge}):null]}),(0,$.jsx)(`span`,{className:s(`mt-1 block text-xs leading-5`,t.tone===`attention`?`text-fg`:`text-fg-muted`),children:t.summary})]}),n?(0,$.jsx)(`span`,{className:`hidden shrink-0 text-xs text-fg-subtle sm:block`,children:ot(a.sourceUpdatedAt,{time:ft(n,i)})}):null,(0,$.jsx)(fe,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0})]},e.instanceId)})})]},t.id)})}):(0,$.jsxs)(`div`,{className:`rounded-2xl border border-dashed border-edge p-10 text-center`,children:[(0,$.jsx)(q,{className:`mx-auto size-5 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:a.noSources}),(0,$.jsxs)(v,{type:`button`,variant:`secondary`,className:`mt-4`,onClick:c,children:[(0,$.jsx)(_,{className:`size-4`,"aria-hidden":!0}),a.addSource]})]}),t[46]=b,t[47]=i,t[48]=c,t[49]=a,t[50]=F):F=t[50];let I=x?o===`source-learning:${x.instanceId}`:!1,L;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(L=e=>{e||g(null)},t[51]=L):L=t[51];let R;t[52]===f?R=t[53]:(R=e=>{g(null),f(e)},t[52]=f,t[53]=R);let z;t[54]===p?z=t[55]:(z=e=>{g(null),p(e)},t[54]=p,t[55]=z);let B;t[56]===m?B=t[57]:(B=()=>{g(null),m()},t[56]=m,t[57]=B);let V;t[58]!==i||t[59]!==u||t[60]!==d||t[61]!==x||t[62]!==a||t[63]!==I||t[64]!==R||t[65]!==z||t[66]!==B?(V=(0,$.jsx)(mt,{source:x,language:i,t:a,busy:I,onOpenChange:L,onLearn:u,onPause:d,onConfigure:R,onDisconnect:z,onViewUnderstanding:B}),t[58]=i,t[59]=u,t[60]=d,t[61]=x,t[62]=a,t[63]=I,t[64]=R,t[65]=z,t[66]=B,t[67]=V):V=t[67];let H;return t[68]!==N||t[69]!==P||t[70]!==F||t[71]!==V||t[72]!==E||t[73]!==D||t[74]!==O||t[75]!==k?(H=(0,$.jsxs)(`div`,{id:E,role:D,"aria-labelledby":O,className:k,children:[N,P,F,V]}),t[68]=N,t[69]=P,t[70]=F,t[71]=V,t[72]=E,t[73]=D,t[74]=O,t[75]=k,t[76]=H):H=t[76],H}function gt(e,t){return e+t.accounts.length}function _t(e){return e.installed}var vt=new Set([`overview`,`memory`,`collaboration`,`sources`,`dreaming`,`privacy`]);function yt(e){return e&&vt.has(e)?e:`overview`}var bt=[`collaboration`,`priorities`,`boundaries`,`people`,`current`,`basics`],xt=[`relationship`,`routine`,`long_term_goal`],St=`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent/50 focus:ring-2 focus:ring-accent/20`;function Ct(e,t){return e.replace(`{{count}}`,String(t))}function wt(e){let t=(0,Ve.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`span`,{className:`inline-flex rounded-full bg-surface-muted px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=r),r}function Tt(e,t){let n=Date.parse(e);return Number.isFinite(n)?Te(n,t):e}function Et(){let e=(0,Ve.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(Oe,{className:`h-24 rounded-2xl`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsxs)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[t,(0,$.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,$.jsx)(Oe,{className:`h-64 rounded-2xl`}),(0,$.jsx)(Oe,{className:`h-64 rounded-2xl`})]})]}),e[1]=n):n=e[1],n}function Dt(e,t){return e.origin===`connected_source`?t.origins.connected_source.replace(`{{source}}`,e.sourceName):t.origins[e.origin]}function Ot(e){let t=(0,Ve.c)(19),{item:n,language:r,t:i,busy:a,onConfirm:c,onReject:l,onUpdate:u,onForget:d}=e,[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(n.statement),[g,_]=(0,Q.useState)(null),[y,b]=(0,Q.useState)(!1),x=n.status!==`active`,S=x?`border-warning/35 bg-warning-soft/35`:`border-edge-subtle bg-surface-panel`,C;t[0]===S?C=t[1]:(C=s(`rounded-xl border p-3.5`,S),t[0]=S,t[1]=C);let T;t[2]!==a||t[3]!==m||t[4]!==f||t[5]!==g||t[6]!==y||t[7]!==n||t[8]!==r||t[9]!==x||t[10]!==c||t[11]!==d||t[12]!==l||t[13]!==u||t[14]!==i?(T=f?(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(`textarea`,{className:s(St,`min-h-20 resize-y`),value:m,onChange:e=>h(e.target.value),placeholder:i.updatePlaceholder}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,$.jsx)(v,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>{h(n.statement),p(!1)},children:i.cancel}),(0,$.jsx)(v,{type:`button`,variant:`primary`,className:`h-8 px-2`,disabled:a||!m.trim(),onClick:()=>{u(m.trim()),p(!1)},children:i.save})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:n.statement}),(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,$.jsx)(he,{className:`size-3 text-accent`,"aria-hidden":!0}),Dt(n,i)]}),(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5`,children:i.understandingScopes[n.scope.type]}),(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5`,children:i.stability[n.stability]}),n.evidenceCount>0?(0,$.jsx)(`span`,{children:Ct(i.evidenceCount,n.evidenceCount)}):null,n.latestEvidenceAt?(0,$.jsx)(`span`,{children:i.observedAt.replace(`{{time}}`,Tt(n.latestEvidenceAt,r))}):null]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[x?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(v,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:c,children:[(0,$.jsx)(o,{className:`size-3.5`,"aria-hidden":!0}),i.confirm]}),(0,$.jsxs)(v,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:l,children:[(0,$.jsx)(ue,{className:`size-3.5`,"aria-hidden":!0}),i.notTrue]})]}):null,(0,$.jsxs)(v,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:()=>p(!0),children:[(0,$.jsx)(le,{className:`size-3.5`,"aria-hidden":!0}),i.change]}),(0,$.jsxs)(v,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:y,onClick:()=>{if(g){_(null);return}b(!0),w(n.id).then(e=>_(e.history)).finally(()=>b(!1))},children:[(0,$.jsx)(Z,{className:`size-3.5`,"aria-hidden":!0}),i.history]}),(0,$.jsxs)(v,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:d,children:[(0,$.jsx)(M,{className:`size-3.5`,"aria-hidden":!0}),i.forget]})]})]}),(0,$.jsxs)(`details`,{className:`mt-2 rounded-lg bg-surface-muted/70 px-3 py-2 text-xs text-fg-muted`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer font-medium text-fg-muted`,children:i.viewEvidence}),(0,$.jsxs)(`dl`,{className:`mt-2 grid gap-1.5 sm:grid-cols-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceSource}),(0,$.jsx)(`dd`,{className:`mt-0.5 break-all text-fg-muted`,children:n.sourceName})]}),n.sourcePath?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidencePath}),(0,$.jsx)(`dd`,{className:`mt-0.5 break-all text-fg-muted`,children:n.sourcePath})]}):null,(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceUpdated}),(0,$.jsx)(`dd`,{className:`mt-0.5 text-fg-muted`,children:Tt(n.updatedAt,r)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceSupport}),(0,$.jsx)(`dd`,{className:`mt-0.5 text-fg-muted`,children:Ct(i.evidenceCount,n.evidenceCount)})]}),n.evidenceBasis?(0,$.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceRule}),(0,$.jsx)(`dd`,{className:`mt-0.5 text-fg-muted`,children:i.evidenceRuleValue.replace(`{{events}}`,String(n.evidenceBasis.eventCount)).replace(`{{days}}`,String(n.evidenceBasis.activeDays)).replace(`{{window}}`,String(n.evidenceBasis.windowDays))})]}):null,n.confidence===void 0?null:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceConfidence}),(0,$.jsxs)(`dd`,{className:`mt-0.5 text-fg-muted`,children:[Math.round(n.confidence*100),`%`]})]}),n.validTo?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceValidUntil}),(0,$.jsx)(`dd`,{className:`mt-0.5 text-fg-muted`,children:Tt(n.validTo,r)})]}):null,n.expiresAt?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceExpires}),(0,$.jsx)(`dd`,{className:`mt-0.5 text-fg-muted`,children:Tt(n.expiresAt,r)})]}):null]})]}),g?(0,$.jsxs)(`div`,{className:`mt-2 space-y-2 border-t border-edge pt-2`,children:[(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:i.historyTitle}),g.map(e=>(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3 text-xs`,children:[(0,$.jsx)(`p`,{className:`min-w-0 text-fg-muted`,children:e.statement}),(0,$.jsx)(`span`,{className:`shrink-0 text-fg-subtle`,children:Tt(e.updatedAt,r)})]},e.id))]}):null]}),t[2]=a,t[3]=m,t[4]=f,t[5]=g,t[6]=y,t[7]=n,t[8]=r,t[9]=x,t[10]=c,t[11]=d,t[12]=l,t[13]=u,t[14]=i,t[15]=T):T=t[15];let E;return t[16]!==C||t[17]!==T?(E=(0,$.jsx)(`article`,{className:C,children:T}),t[16]=C,t[17]=T,t[18]=E):E=t[18],E}function kt(e){let t=(0,Ve.c)(86),{claim:n,language:r,t:i,busy:a,onDecision:c}=e,l=typeof n.value.label==`string`?n.value.label:``,u;if(t[0]!==n.class||t[1]!==n.value.hour||t[2]!==n.value.weekday||t[3]!==l||t[4]!==r||t[5]!==i.claimProject||t[6]!==i.claimRelationship||t[7]!==i.claimRoutine){let e=r===`zh`?[`周日`,`周一`,`周二`,`周三`,`周四`,`周五`,`周六`]:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`];u=n.class===`relationship`?i.claimRelationship.replace(`{{label}}`,l):n.class===`project`?i.claimProject.replace(`{{label}}`,l):i.claimRoutine.replace(`{{weekday}}`,e[Number(n.value.weekday)]??``).replace(`{{hour}}`,String(n.value.hour).padStart(2,`0`)),t[0]=n.class,t[1]=n.value.hour,t[2]=n.value.weekday,t[3]=l,t[4]=r,t[5]=i.claimProject,t[6]=i.claimRelationship,t[7]=i.claimRoutine,t[8]=u}else u=t[8];let d=u,f;t[9]===n.evidence?f=t[10]:(f=new Set(n.evidence.map(At)),t[9]=n.evidence,t[10]=f);let p;t[11]===f?p=t[12]:(p=[...f],t[11]=f,t[12]=p);let m=p,h=n.state===`provisional`||n.state===`stale`,g=h?`border-warning/35 bg-warning-soft/35`:`border-edge-subtle bg-surface-panel`,_;t[13]===g?_=t[14]:(_=s(`rounded-xl border p-3.5`,g),t[13]=g,t[14]=_);let y=i.claimClasses[n.class],b;t[15]===y?b=t[16]:(b=(0,$.jsx)(`span`,{className:`text-[11px] font-medium text-fg-subtle`,children:y}),t[15]=y,t[16]=b);let x;t[17]===d?x=t[18]:(x=(0,$.jsx)(`p`,{className:`mt-1 text-sm font-medium leading-6 text-fg`,children:d}),t[17]=d,t[18]=x);let S;t[19]!==b||t[20]!==x?(S=(0,$.jsxs)(`div`,{children:[b,x]}),t[19]=b,t[20]=x,t[21]=S):S=t[21];let C=i.claimStates[n.state],w;t[22]===C?w=t[23]:(w=(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-1 text-[11px] text-fg-muted`,children:C}),t[22]=C,t[23]=w);let T;t[24]!==w||t[25]!==S?(T=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[S,w]}),t[24]=w,t[25]=S,t[26]=T):T=t[26];let E;t[27]!==n.activeDayCount||t[28]!==n.independentEvidenceCount||t[29]!==i.claimEvidence?(E=i.claimEvidence.replace(`{{events}}`,String(n.independentEvidenceCount)).replace(`{{days}}`,String(n.activeDayCount)),t[27]=n.activeDayCount,t[28]=n.independentEvidenceCount,t[29]=i.claimEvidence,t[30]=E):E=t[30];let D;t[31]===E?D=t[32]:(D=(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:E}),t[31]=E,t[32]=D);let O;t[33]!==n.lastReinforcedAt||t[34]!==r||t[35]!==i.observedAt?(O=i.observedAt.replace(`{{time}}`,Tt(n.lastReinforcedAt,r)),t[33]=n.lastReinforcedAt,t[34]=r,t[35]=i.observedAt,t[36]=O):O=t[36];let k;t[37]===O?k=t[38]:(k=(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:O}),t[37]=O,t[38]=k);let A;t[39]!==a||t[40]!==h||t[41]!==c||t[42]!==i.confirm||t[43]!==i.notTrue?(A=h?(0,$.jsxs)(`div`,{className:`flex gap-1`,children:[(0,$.jsxs)(v,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:()=>c(`confirm`),children:[(0,$.jsx)(o,{className:`size-3.5`,"aria-hidden":!0}),i.confirm]}),(0,$.jsxs)(v,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:()=>c(`reject`),children:[(0,$.jsx)(ue,{className:`size-3.5`,"aria-hidden":!0}),i.notTrue]})]}):null,t[39]=a,t[40]=h,t[41]=c,t[42]=i.confirm,t[43]=i.notTrue,t[44]=A):A=t[44];let j;t[45]!==k||t[46]!==A?(j=(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-between gap-2`,children:[k,A]}),t[45]=k,t[46]=A,t[47]=j):j=t[47];let M;t[48]===i.viewEvidence?M=t[49]:(M=(0,$.jsx)(`summary`,{className:`cursor-pointer font-medium`,children:i.viewEvidence}),t[48]=i.viewEvidence,t[49]=M);let N;t[50]===i.evidenceSource?N=t[51]:(N=(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceSource}),t[50]=i.evidenceSource,t[51]=N);let P=m.join(`, `),F;t[52]===P?F=t[53]:(F=(0,$.jsx)(`dd`,{className:`mt-0.5 break-all`,children:P}),t[52]=P,t[53]=F);let I;t[54]!==N||t[55]!==F?(I=(0,$.jsxs)(`div`,{children:[N,F]}),t[54]=N,t[55]=F,t[56]=I):I=t[56];let L;t[57]===i.evidenceConfidence?L=t[58]:(L=(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceConfidence}),t[57]=i.evidenceConfidence,t[58]=L);let R;t[59]===n.confidence?R=t[60]:(R=Math.round(n.confidence*100),t[59]=n.confidence,t[60]=R);let z;t[61]===R?z=t[62]:(z=(0,$.jsxs)(`dd`,{className:`mt-0.5`,children:[R,`%`]}),t[61]=R,t[62]=z);let B;t[63]!==L||t[64]!==z?(B=(0,$.jsxs)(`div`,{children:[L,z]}),t[63]=L,t[64]=z,t[65]=B):B=t[65];let V;t[66]===i.evidenceRule?V=t[67]:(V=(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceRule}),t[66]=i.evidenceRule,t[67]=V);let H;t[68]===i.claimRule?H=t[69]:(H=(0,$.jsx)(`dd`,{className:`mt-0.5`,children:i.claimRule}),t[68]=i.claimRule,t[69]=H);let U;t[70]!==V||t[71]!==H?(U=(0,$.jsxs)(`div`,{className:`sm:col-span-2`,children:[V,H]}),t[70]=V,t[71]=H,t[72]=U):U=t[72];let W;t[73]!==I||t[74]!==B||t[75]!==U?(W=(0,$.jsxs)(`dl`,{className:`mt-2 grid gap-1.5 sm:grid-cols-2`,children:[I,B,U]}),t[73]=I,t[74]=B,t[75]=U,t[76]=W):W=t[76];let G;t[77]!==M||t[78]!==W?(G=(0,$.jsxs)(`details`,{className:`mt-2 rounded-lg bg-surface-muted/70 px-3 py-2 text-xs text-fg-muted`,children:[M,W]}),t[77]=M,t[78]=W,t[79]=G):G=t[79];let ee;return t[80]!==T||t[81]!==D||t[82]!==j||t[83]!==G||t[84]!==_?(ee=(0,$.jsxs)(`article`,{className:_,children:[T,D,j,G]}),t[80]=T,t[81]=D,t[82]=j,t[83]=G,t[84]=_,t[85]=ee):ee=t[85],ee}function At(e){return e.sourceInstanceId}function jt(e){let t=(0,Ve.c)(70),{playbook:n,busy:r,t:i,onToggleGroup:a,onCreate:o,onUpdate:c,onDelete:l,onRollback:u}=e,[f,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(``),y=n.enabled?`border-edge-subtle bg-surface-panel`:`border-edge-subtle bg-surface-muted`,b;t[0]===y?b=t[1]:(b=s(`rounded-xl border p-4`,y),t[0]=y,t[1]=b);let x=i.playbookNames[n.id],S;t[2]===x?S=t[3]:(S=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:x}),t[2]=x,t[3]=S);let C;t[4]!==n.rules||t[5]!==i.playbookRuleCount?(C=Ct(i.playbookRuleCount,n.rules.filter(Pt).length),t[4]=n.rules,t[5]=i.playbookRuleCount,t[6]=C):C=t[6];let w;t[7]===C?w=t[8]:(w=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:C}),t[7]=C,t[8]=w);let T;t[9]!==S||t[10]!==w?(T=(0,$.jsxs)(`div`,{children:[S,w]}),t[9]=S,t[10]=w,t[11]=T):T=t[11];let E=n.enabled?i.pausePlaybook:i.resumePlaybook,D;t[12]!==r||t[13]!==a||t[14]!==E?(D=(0,$.jsx)(v,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:r,onClick:a,children:E}),t[12]=r,t[13]=a,t[14]=E,t[15]=D):D=t[15];let O;t[16]!==T||t[17]!==D?(O=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[T,D]}),t[16]=T,t[17]=D,t[18]=O):O=t[18];let k;t[19]!==r||t[20]!==m||t[21]!==g||t[22]!==l||t[23]!==u||t[24]!==c||t[25]!==n.rules||t[26]!==i.cancel||t[27]!==i.deleteRule||t[28]!==i.disableRule||t[29]!==i.edit||t[30]!==i.enableRule||t[31]!==i.moveDown||t[32]!==i.moveUp||t[33]!==i.rollbackRule||t[34]!==i.ruleChannelContext||t[35]!==i.ruleContextAny||t[36]!==i.ruleHistory||t[37]!==i.ruleSupportContext||t[38]!==i.ruleSupportNeeds||t[39]!==i.save?(k=n.rules.map((e,t)=>(0,$.jsx)(`li`,{className:s(`rounded-lg border border-edge-subtle p-2.5`,!e.enabled&&`opacity-60`),children:m===e.id?(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(`textarea`,{className:s(St,`min-h-16 resize-y`),value:g,onChange:e=>_(e.target.value)}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-1`,children:[(0,$.jsx)(v,{type:`button`,variant:`ghost`,className:`h-7 px-2`,onClick:()=>h(null),children:i.cancel}),(0,$.jsx)(v,{type:`button`,variant:`primary`,className:`h-7 px-2`,disabled:!g.trim(),onClick:()=>{c(e.id,{statement:g.trim()}),h(null)},children:i.save})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:e.statement}),(0,$.jsxs)(`div`,{className:`mt-2 grid grid-cols-2 gap-1`,children:[(0,$.jsxs)(`label`,{className:`grid gap-1 text-[10px] text-fg-subtle`,children:[i.ruleSupportContext,(0,$.jsxs)(d,{value:e.context.supportNeed??``,disabled:r,onChange:t=>c(e.id,{context:{supportNeed:t.target.value||null}}),children:[(0,$.jsx)(J,{value:``,children:i.ruleContextAny}),[`listen`,`clarify`,`advise`,`act`,`unknown`].map(e=>(0,$.jsx)(J,{value:e,children:i.ruleSupportNeeds[e]},e))]})]}),(0,$.jsxs)(`label`,{className:`grid gap-1 text-[10px] text-fg-subtle`,children:[i.ruleChannelContext,(0,$.jsxs)(d,{value:e.context.channel??``,disabled:r,onChange:t=>c(e.id,{context:{channel:t.target.value||null}}),children:[(0,$.jsx)(J,{value:``,children:i.ruleContextAny}),[`webchat`,`telegram`,`weixin`,`feishu`,`cli`].map(Nt)]})]})]}),(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap justify-end gap-1`,children:[(0,$.jsx)(v,{type:`button`,variant:`ghost`,className:`h-7 px-2`,disabled:r||t===0,onClick:()=>c(e.id,{order:n.rules[t-1].order-1}),children:i.moveUp}),(0,$.jsx)(v,{type:`button`,variant:`ghost`,className:`h-7 px-2`,disabled:r||t===n.rules.length-1,onClick:()=>c(e.id,{order:n.rules[t+1].order+1}),children:i.moveDown}),(0,$.jsx)(v,{type:`button`,variant:`ghost`,className:`h-7 px-2`,disabled:r,onClick:()=>c(e.id,{enabled:!e.enabled}),children:e.enabled?i.disableRule:i.enableRule}),(0,$.jsxs)(v,{type:`button`,variant:`ghost`,className:`h-7 px-2`,disabled:r,onClick:()=>{h(e.id),_(e.statement)},children:[(0,$.jsx)(le,{className:`size-3`,"aria-hidden":!0}),i.edit]}),(0,$.jsxs)(v,{type:`button`,variant:`ghost`,className:`h-7 px-2 text-danger`,disabled:r,onClick:()=>l(e.id),children:[(0,$.jsx)(M,{className:`size-3`,"aria-hidden":!0}),i.deleteRule]})]}),e.versions.length>1?(0,$.jsxs)(`details`,{className:`mt-2 border-t border-edge-subtle pt-2`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-[11px] text-fg-subtle`,children:i.ruleHistory}),(0,$.jsx)(`div`,{className:`mt-2 space-y-2`,children:e.versions.filter(Mt).map(t=>(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2 text-[11px]`,children:[(0,$.jsx)(`p`,{className:`line-clamp-2 text-fg-muted`,children:t.statement}),(0,$.jsx)(v,{type:`button`,variant:`ghost`,className:`h-7 shrink-0 px-2`,disabled:r,onClick:()=>u(e.id,t.id),children:i.rollbackRule})]},t.id))})]}):null]})},e.id)),t[19]=r,t[20]=m,t[21]=g,t[22]=l,t[23]=u,t[24]=c,t[25]=n.rules,t[26]=i.cancel,t[27]=i.deleteRule,t[28]=i.disableRule,t[29]=i.edit,t[30]=i.enableRule,t[31]=i.moveDown,t[32]=i.moveUp,t[33]=i.rollbackRule,t[34]=i.ruleChannelContext,t[35]=i.ruleContextAny,t[36]=i.ruleHistory,t[37]=i.ruleSupportContext,t[38]=i.ruleSupportNeeds,t[39]=i.save,t[40]=k):k=t[40];let A;t[41]===k?A=t[42]:(A=(0,$.jsx)(`ul`,{className:`mt-3 space-y-2`,children:k}),t[41]=k,t[42]=A);let j;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(j=e=>p(e.target.value),t[43]=j):j=t[43];let N;t[44]!==f||t[45]!==i.newRulePlaceholder?(N=(0,$.jsx)(`input`,{className:St,value:f,onChange:j,placeholder:i.newRulePlaceholder}),t[44]=f,t[45]=i.newRulePlaceholder,t[46]=N):N=t[46];let P;t[47]!==r||t[48]!==f?(P=r||!f.trim(),t[47]=r,t[48]=f,t[49]=P):P=t[49];let F;t[50]!==f||t[51]!==o?(F=()=>{o(f.trim()),p(``)},t[50]=f,t[51]=o,t[52]=F):F=t[52];let I;t[53]!==i.addRule||t[54]!==P||t[55]!==F?(I=(0,$.jsx)(v,{type:`button`,variant:`secondary`,disabled:P,onClick:F,children:i.addRule}),t[53]=i.addRule,t[54]=P,t[55]=F,t[56]=I):I=t[56];let L;t[57]!==N||t[58]!==I?(L=(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[N,I]}),t[57]=N,t[58]=I,t[59]=L):L=t[59];let R=i.playbookRuleExamples[n.id],z;t[60]===R?z=t[61]:(z=(0,$.jsx)(`p`,{className:`mt-1.5 text-[11px] leading-5 text-fg-subtle`,children:R}),t[60]=R,t[61]=z);let B;t[62]!==L||t[63]!==z?(B=(0,$.jsxs)(`div`,{className:`mt-3`,children:[L,z]}),t[62]=L,t[63]=z,t[64]=B):B=t[64];let V;return t[65]!==O||t[66]!==A||t[67]!==b||t[68]!==B?(V=(0,$.jsxs)(`article`,{className:b,children:[O,A,B]}),t[65]=O,t[66]=A,t[67]=b,t[68]=B,t[69]=V):V=t[69],V}function Mt(e){return!e.current}function Nt(e){return(0,$.jsx)(J,{value:e,children:e},e)}function Pt(e){return e.enabled}function Ft(e){let t=(0,Ve.c)(46),{suggestion:n,draft:r,busy:i,onDraftChange:a,onSave:o,onLater:c,t:l}=e,u;t[0]!==n||t[1]!==l.meetSuggestedTitle||t[2]!==l.meetTitle?(u=n?l.meetSuggestedTitle.replace(`{{name}}`,n.value):l.meetTitle,t[0]=n,t[1]=l.meetSuggestedTitle,t[2]=l.meetTitle,t[3]=u):u=t[3];let d;t[4]===u?d=t[5]:(d=(0,$.jsx)(`h2`,{className:`text-xl font-semibold tracking-tight text-fg`,children:u}),t[4]=u,t[5]=d);let f=n?l.meetSuggestedBody:l.meetBody,p;t[6]===f?p=t[7]:(p=(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:f}),t[6]=f,t[7]=p);let m;t[8]===l.callName?m=t[9]:(m=(0,$.jsx)(`label`,{className:`sr-only`,htmlFor:`you-call-name`,children:l.callName}),t[8]=l.callName,t[9]=m);let h;t[10]===a?h=t[11]:(h=e=>a(e.target.value),t[10]=a,t[11]=h);let g;t[12]!==i||t[13]!==r||t[14]!==o?(g=e=>{e.key===`Enter`&&r.trim()&&!i&&o()},t[12]=i,t[13]=r,t[14]=o,t[15]=g):g=t[15];let _=l.meetPlaceholder,y;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(y=s(St,`h-10 flex-1 bg-surface-base/90`),t[16]=y):y=t[16];let b;t[17]!==r||t[18]!==l.meetPlaceholder||t[19]!==h||t[20]!==g?(b=(0,$.jsx)(`input`,{id:`you-call-name`,value:r,maxLength:80,onChange:h,onKeyDown:g,placeholder:_,className:y}),t[17]=r,t[18]=l.meetPlaceholder,t[19]=h,t[20]=g,t[21]=b):b=t[21];let x;t[22]!==i||t[23]!==r?(x=i||!r.trim(),t[22]=i,t[23]=r,t[24]=x):x=t[24];let S=i?l.meetSaving:l.meetSave,C;t[25]!==o||t[26]!==x||t[27]!==S?(C=(0,$.jsx)(v,{type:`button`,variant:`primary`,className:`h-10 shrink-0`,disabled:x,onClick:o,children:S}),t[25]=o,t[26]=x,t[27]=S,t[28]=C):C=t[28];let w;t[29]!==b||t[30]!==C||t[31]!==m?(w=(0,$.jsxs)(`div`,{className:`mt-5 flex max-w-xl flex-col gap-2 sm:flex-row`,children:[m,b,C]}),t[29]=b,t[30]=C,t[31]=m,t[32]=w):w=t[32];let T;t[33]!==n||t[34]!==l.meetSource?(T=n?(0,$.jsxs)(`p`,{className:`mt-3 flex items-start gap-1.5 text-xs leading-5 text-fg-subtle`,children:[(0,$.jsx)(ye,{className:`mt-0.5 size-3.5 shrink-0 text-accent`,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:l.meetSource})]}):null,t[33]=n,t[34]=l.meetSource,t[35]=T):T=t[35];let E;t[36]!==i||t[37]!==c||t[38]!==l.meetLater?(E=(0,$.jsx)(`button`,{type:`button`,disabled:i,className:`mt-3 text-xs font-medium text-fg-muted hover:text-fg hover:underline disabled:opacity-60`,onClick:c,children:l.meetLater}),t[36]=i,t[37]=c,t[38]=l.meetLater,t[39]=E):E=t[39];let D;return t[40]!==w||t[41]!==T||t[42]!==E||t[43]!==d||t[44]!==p?(D=(0,$.jsx)(`section`,{className:`relative overflow-hidden rounded-2xl border border-accent/25 bg-gradient-to-br from-accent-soft/80 via-surface-panel to-surface-panel p-5 sm:p-6`,children:(0,$.jsxs)(`div`,{className:`relative max-w-2xl`,children:[d,p,w,T,E]})}),t[40]=w,t[41]=T,t[42]=E,t[43]=d,t[44]=p,t[45]=D):D=t[45],D}function It(){let e=l(e=>e.language),t=c(e).you,n=a(),[r,f]=i(),m=yt(r.get(`tab`)),h=te(e=>e.setPageHeader),_=te(e=>e.clearPageHeader),{data:y,error:b,isLoading:S,mutate:w}=u(`/api/you`,Ce),[E,D]=(0,Q.useState)(null),[k,j]=(0,Q.useState)(!1),[M,P]=(0,Q.useState)(``),[z,W]=(0,Q.useState)(`preference`),[G,ee]=(0,Q.useState)(!1),[q,X]=(0,Q.useState)(null),[re,ie]=(0,Q.useState)(!1),[ae,Z]=(0,Q.useState)(null),[ce,ue]=(0,Q.useState)(!1),[pe,he]=(0,Q.useState)(``),[_e,xe]=(0,Q.useState)(!1),[Se,Te]=(0,Q.useState)(null),[Oe,Ne]=(0,Q.useState)(!1),[Be,Ve]=(0,Q.useState)(!1),[We,Ge]=(0,Q.useState)(!1),[Ke,qe]=(0,Q.useState)(null),[Je,Ye]=(0,Q.useState)(!1),[Xe,Ze]=(0,Q.useState)(null),[Qe,$e]=(0,Q.useState)(null),[et,tt]=(0,Q.useState)(!1),[it,at]=(0,Q.useState)(null),[ot,st]=(0,Q.useState)(null),ct=(0,Q.useRef)(null),lt=(0,Q.useRef)(null),ut=(0,Q.useRef)(null),dt=y?.profile??{callName:``,pronouns:``,timezone:``,notes:``},ft=(0,Q.useMemo)(()=>y?.understanding.filter(e=>e.status===`active`)??[],[y]),pt=(0,Q.useMemo)(()=>y?.understanding.filter(e=>e.status!==`active`)??[],[y]),mt=(0,Q.useMemo)(()=>y?.connectedClaims.filter(e=>e.state!==`rejected`)??[],[y]),gt=(0,Q.useMemo)(()=>mt.filter(e=>e.state!==`active`),[mt]),_t=(0,Q.useMemo)(()=>new Map(bt.map(e=>[e,ft.filter(t=>t.facet===e)])),[ft]),vt=Se??y?.controls??null,At=y?.sources.filter(e=>e.installed&&e.enabled)??[],Mt=At.filter(e=>[`failed`,`unauthorized`,`degraded`,`not_configured`].includes(e.status));(0,Q.useEffect)(()=>{let e=()=>{w()};return window.addEventListener(`connector-learning-updated`,e),()=>window.removeEventListener(`connector-learning-updated`,e)},[w]),(0,Q.useEffect)(()=>{if(m!==`memory`||!ot)return;let e=requestAnimationFrame(()=>{(ot===`profile`?ct:lt).current?.scrollIntoView({behavior:`smooth`,block:`start`}),st(null)});return()=>cancelAnimationFrame(e)},[ot,m]);async function Nt(e){if(!(!y||We)){Ge(!0);try{let n=await U(e);await w({...y,relationship:n.relationship},{revalidate:!1}),I({type:`success`,title:t.collaborationTitle,message:t.saved})}catch{I({type:`error`,title:t.supportModeTitle,message:t.saveError})}finally{Ge(!1)}}}async function Pt(e,n){D(`claim:${e.id}`);try{let t=await De(e.id,n);await w(e=>e&&{...e,connectedClaims:e.connectedClaims.map(e=>e.id===t.id?t:e)},{revalidate:!1})}catch{I({type:`error`,title:t.connectedClaimsTitle,message:t.saveError})}finally{D(null)}}let It=e=>{let t=new URLSearchParams;e!==`overview`&&t.set(`tab`,e),f(t,{replace:!0})},Lt=e=>{st(e),It(`memory`)},Rt=e=>{let t=new URLSearchParams({connector:e.id});e.instanceId&&t.set(`instance`,e.instanceId),n(`/connectors?${t.toString()}`)},zt=async e=>{if(e.instanceId){D(`source-learning:${e.instanceId}`);try{e.learning?.status===`paused`?await Re(e.instanceId,!1):await ze(e.instanceId),await w(),I({type:`success`,title:e.displayName,message:t.sourceLearningStarted})}catch(n){I({type:`error`,title:e.displayName,message:n instanceof Error?n.message:t.sourceLearningStartFailed})}finally{D(null)}}},Bt=async e=>{if(e.instanceId){D(`source-learning:${e.instanceId}`);try{await Re(e.instanceId,!0),await w()}catch(n){I({type:`error`,title:e.displayName,message:n instanceof Error?n.message:t.sourceLearningStartFailed})}finally{D(null)}}};(0,Q.useLayoutEffect)(()=>(h({startExtra:null,main:(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.title}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:t.subtitle})]}),end:(0,$.jsxs)(v,{type:`button`,variant:`ghost`,className:`h-8 gap-1.5 px-2.5 text-xs`,onClick:()=>Ye(!0),children:[(0,$.jsx)(ve,{className:`size-3.5`,"aria-hidden":!0}),t.howItWorks]})}),()=>_()),[_,h,t.howItWorks,t.subtitle,t.title]),(0,Q.useEffect)(()=>{!y||y.profile.callName||he(y.profileSetup.callNameSuggestion?.value??``)},[y,y?.profile.callName,y?.profileSetup.callNameSuggestion?.id]);async function Vt(e,n,r){D(e.id);try{let t=await be(e.id,{action:n,content:r});await w(r=>r&&{...r,understanding:n===`reject`?r.understanding.filter(t=>t.id!==e.id):r.understanding.map(n=>n.id===e.id?t:n)},{revalidate:!1}),w()}catch{I({type:`error`,title:t.title,message:t.saveError})}finally{D(null)}}async function Ht(e,n){D(`consent:${e}`);try{await F(e,n),await w(),I({type:`success`,title:t.title,message:t.saved})}catch{I({type:`error`,title:t.title,message:t.saveError})}finally{D(null)}}async function Ut(){let e=M.trim();if(e){D(`understanding:new`);try{await g({content:e,kind:z}),P(``),j(!1),ee(!1),await w(),I({type:`success`,title:t.understandingTitle,message:t.saved})}catch{I({type:`error`,title:t.understandingTitle,message:t.saveError})}finally{D(null)}}}async function Wt(){if(pt.length){D(`understanding:batch`);try{await A(pt.map(e=>e.id),`confirm`),await w()}catch{I({type:`error`,title:t.reviewTitle,message:t.saveError})}finally{D(null)}}}async function Gt(e,n){D(`conflict:${e}`);try{await R(e,n),await w()}catch{I({type:`error`,title:t.conflictsTitle,message:t.saveError})}finally{D(null)}}async function Kt(e){D(`grant:${e}`);try{await V(e),await w()}catch{I({type:`error`,title:t.grantsTitle,message:t.saveError})}finally{D(null)}}async function qt(r,i){D(`insight:${r.id}`);try{let t=await we(r.id,{action:i,uiLocale:e});await w(),i===`apply`&&t.href&&n(t.href)}catch{I({type:`error`,title:t.insightsTitle,message:t.saveError})}finally{D(null)}}async function Jt(e){D(`playbook:${e.id}`);try{await ne(e.id,!e.enabled),await w()}catch{I({type:`error`,title:t.playbooksTitle,message:t.saveError})}finally{D(null)}}async function Yt(e,n){D(`playbook:${e}`);try{await n(),await w()}catch{I({type:`error`,title:t.playbooksTitle,message:t.saveError})}finally{D(null)}}async function Xt(){if(q){D(q.id);try{await C(q.id);let e=q.id;X(null),await w(t=>t&&{...t,understanding:t.understanding.filter(t=>t.id!==e)},{revalidate:!1}),w()}catch{I({type:`error`,title:t.title,message:t.saveError})}finally{D(null)}}}async function Zt(){if(ae){ue(!0);try{let e=await K(ae);ie(!1),Z(null),await w(t=>t&&{...t,...e},{revalidate:!1})}catch{I({type:`error`,title:t.title,message:t.saveError})}finally{ue(!1)}}}async function Qt(){let e=pe.trim();if(!(!e||_e)){xe(!0);try{let t=await K({callName:e,timezone:dt.timezone||oe()});await w(e=>e&&{...e,...t},{revalidate:!1})}catch{I({type:`error`,title:t.title,message:t.saveError})}finally{xe(!1)}}}async function $t(){if(!_e){xe(!0);try{let e=await de(`snooze`);await w(t=>t&&{...t,profileSetup:e.profileSetup},{revalidate:!1})}catch{I({type:`error`,title:t.title,message:t.saveError})}finally{xe(!1)}}}function en(){Z(dt),ie(!0),Lt(`profile`)}function tn(e,t=!1){W(e),ee(t),j(!0),It(`memory`)}function nn(){j(!1),ee(!1),P(``)}async function rn(e){if(!Oe){Te(e),Ne(!0);try{Te(await Ee(e)),await w(),I({type:`success`,title:t.privacyTitle,message:t.saved})}catch{Te(null),I({type:`error`,title:t.privacyTitle,message:t.saveError})}finally{Ne(!1)}}}async function an(e){if(!(Be||e===y?.trust.defaultActionLevel)){Ve(!0);try{let n=await Ae(e);await w(e=>e&&{...e,trust:n},{revalidate:!1}),I({type:`success`,title:t.trustTitle,message:t.saved})}catch{I({type:`error`,title:t.trustTitle,message:t.saveError})}finally{Ve(!1),qe(null)}}}async function on(e){if(!(!Qe?.instanceId||et)){tt(!0);try{let n=await N(Qe.instanceId,e);$e(null),await w(),I({type:`success`,title:t.sourcesTitle,message:e===`delete`?t.disconnectDeleted.replace(`{{count}}`,String(n.deletedUnderstandingCount)):t.disconnectSuccess})}catch{I({type:`error`,title:t.sourcesTitle,message:t.saveError})}finally{tt(!1)}}}async function sn(){if(!it){at(`export`);try{let e=await L(),t=URL.createObjectURL(new Blob([JSON.stringify(e,null,2)],{type:`application/json`})),n=document.createElement(`a`);n.href=t,n.download=`xopc-about-you-${e.exportedAt.slice(0,10)}.json`,n.click(),URL.revokeObjectURL(t)}catch{I({type:`error`,title:t.transferTitle,message:t.saveError})}finally{at(null)}}}async function cn(e){if(!(!e||it)){at(`import`);try{if(e.size>2*1024*1024)throw Error(`file too large`);let n=await B(JSON.parse(await e.text()));await w(),Lt(`review`),I({type:`success`,title:t.transferTitle,message:t.importSuccess.replace(`{{count}}`,String(n.importedCount)).replace(`{{skipped}}`,String(n.skippedCount))})}catch{I({type:`error`,title:t.transferTitle,message:t.importError})}finally{ut.current&&(ut.current.value=``),Ze(null),at(null)}}}function ln(){Ze(null),ut.current&&(ut.current.value=``)}return(0,$.jsxs)(`main`,{className:`flex w-full flex-1 flex-col gap-5 px-3 py-6 sm:px-5 xl:px-6`,children:[(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(Ie,{items:[{id:`overview`,label:t.tabs.overview,icon:H},{id:`memory`,label:t.tabs.memory,icon:me,count:pt.length+gt.length||void 0},{id:`collaboration`,label:t.tabs.collaboration,icon:je},{id:`sources`,label:t.tabs.sources,icon:p},{id:`dreaming`,label:t.tabs.dreaming,icon:T},{id:`privacy`,label:t.tabs.privacy,icon:ye}],activeTab:m,onChange:It,ariaLabel:t.title,tabIdPrefix:`you-tab`,panelIdPrefix:`you-panel`,className:`pr-8 sm:pr-1`,buttonClassName:`px-2.5 sm:px-3`}),(0,$.jsx)(`div`,{className:`pointer-events-none absolute inset-y-1 right-0 w-8 bg-gradient-to-l from-surface-panel to-transparent sm:hidden`,"aria-hidden":!0})]}),S?(0,$.jsx)(Et,{}):b||!y?(0,$.jsx)(`div`,{className:`rounded-2xl border border-danger/25 bg-danger-soft p-5 text-sm text-danger`,children:t.loadError}):null,y&&m===`overview`?(0,$.jsxs)(`div`,{id:`you-panel-overview`,role:`tabpanel`,"aria-labelledby":`you-tab-overview`,className:`space-y-4`,children:[!dt.callName&&y.profileSetup.shouldPrompt?(0,$.jsx)(Ft,{suggestion:y.profileSetup.callNameSuggestion,draft:pe,busy:_e,onDraftChange:he,onSave:()=>void Qt(),onLater:()=>void $t(),t}):null,pt.length>0||gt.length>0||Mt.length>0||!dt.callName?(0,$.jsxs)(`section`,{className:`rounded-2xl border border-warning/25 bg-warning-soft/35 p-5`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.attentionTitle}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[pt.length+gt.length>0?(0,$.jsxs)(v,{type:`button`,variant:`secondary`,onClick:()=>Lt(`review`),children:[Ct(t.reviewCount,pt.length+gt.length),(0,$.jsx)(fe,{className:`size-4`,"aria-hidden":!0})]}):null,Mt.length>0?(0,$.jsxs)(v,{type:`button`,variant:`secondary`,onClick:()=>It(`sources`),children:[Ct(t.sourceIssues,Mt.length),(0,$.jsx)(fe,{className:`size-4`,"aria-hidden":!0})]}):null,dt.callName?null:(0,$.jsxs)(v,{type:`button`,variant:`secondary`,onClick:en,children:[t.completeProfile,(0,$.jsx)(fe,{className:`size-4`,"aria-hidden":!0})]})]})]}):null,(0,$.jsx)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-4`,children:(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,$.jsxs)(`button`,{type:`button`,className:`rounded-xl border border-edge-subtle bg-surface-panel p-3 text-left hover:bg-surface-hover`,onClick:()=>It(`memory`),children:[(0,$.jsx)(`span`,{className:`text-xl font-semibold text-fg`,children:ft.length}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:t.knownSummary})]}),(0,$.jsxs)(`button`,{type:`button`,className:`rounded-xl border border-edge-subtle bg-surface-panel p-3 text-left hover:bg-surface-hover`,onClick:()=>It(`sources`),children:[(0,$.jsx)(`span`,{className:`text-xl font-semibold text-fg`,children:At.length}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:t.connectedSources})]}),(0,$.jsxs)(`button`,{type:`button`,className:`rounded-xl border border-edge-subtle bg-surface-panel p-3 text-left hover:bg-surface-hover`,onClick:()=>Lt(`review`),children:[(0,$.jsx)(`span`,{className:`text-xl font-semibold text-fg`,children:pt.length+gt.length}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:t.waitingReview})]})]})}),y.insights.length>0?(0,$.jsxs)(`section`,{className:`rounded-2xl border border-accent/15 bg-surface-base p-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,$.jsx)(ge,{className:`size-4 text-accent`,"aria-hidden":!0}),t.insightsTitle]}),(0,$.jsx)(wt,{children:t.confirmedContextBadge})]}),(0,$.jsx)(`div`,{className:`mt-4 grid gap-3 lg:grid-cols-2`,children:y.insights.map(e=>(0,$.jsxs)(`article`,{className:`rounded-xl border border-edge-subtle bg-surface-panel p-4`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:e.insight}),(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:e.evidenceCount>1?Ct(t.insightEvidence,e.evidenceCount):t.insightReason}),(0,$.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2`,children:[(0,$.jsx)(v,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:E===`insight:${e.id}`,onClick:()=>void qt(e,`dismiss`),children:t.notNow}),(0,$.jsx)(v,{type:`button`,variant:`primary`,className:`h-8 px-2`,disabled:E===`insight:${e.id}`,onClick:()=>void qt(e,`apply`),children:t.insightActions[e.action]})]})]},e.id))})]}):null,(0,$.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,$.jsx)(Y,{className:`size-4 text-accent`,"aria-hidden":!0}),t.profileTitle]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.profileHint})]}),(0,$.jsx)(v,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>Lt(`profile`),children:(0,$.jsx)(fe,{className:`size-4`,"aria-hidden":!0})})]}),(0,$.jsxs)(`dl`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.callName}),(0,$.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:dt.callName||`—`})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.timezone}),(0,$.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:dt.timezone||`—`})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.pronouns}),(0,$.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:dt.pronouns||`—`})]}),dt.notes?(0,$.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.notes}),(0,$.jsx)(`dd`,{className:`mt-1 line-clamp-2 text-sm leading-6 text-fg`,children:dt.notes})]}):null]})]}),(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,$.jsx)(me,{className:`size-4 text-accent`,"aria-hidden":!0}),t.understandingTitle]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.understandingHint})]}),(0,$.jsx)(v,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>It(`memory`),children:(0,$.jsx)(fe,{className:`size-4`,"aria-hidden":!0})})]}),(0,$.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[ft.slice(0,4).map(e=>(0,$.jsx)(`div`,{className:`rounded-lg bg-surface-panel px-3 py-2.5 text-sm leading-5 text-fg`,children:e.statement},e.id)),ft.length===0?(0,$.jsx)(`p`,{className:`py-5 text-center text-sm text-fg-muted`,children:t.emptyUnderstanding}):null]})]})]})]}):null,y&&m===`memory`?(0,$.jsxs)(`div`,{id:`you-panel-memory`,role:`tabpanel`,"aria-labelledby":`you-tab-memory`,className:`space-y-6`,children:[(0,$.jsxs)(`section`,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.memoryTitle}),(0,$.jsx)(wt,{children:t.sharedAgentsBadge})]}),(0,$.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-6 text-fg-muted`,children:t.memoryHint})]}),(0,$.jsxs)(`section`,{ref:ct,id:`you-profile-card`,className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`h2`,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[(0,$.jsx)(Y,{className:`size-4 text-accent`,"aria-hidden":!0}),t.profileTitle]}),(0,$.jsx)(wt,{children:t.onlyYouEditBadge})]}),(0,$.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm text-fg-muted`,children:t.profileHint})]}),re?null:(0,$.jsxs)(v,{type:`button`,variant:`secondary`,onClick:en,children:[(0,$.jsx)(le,{className:`size-3.5`,"aria-hidden":!0}),t.edit]})]}),re&&ae?(0,$.jsxs)(`div`,{className:`mt-5`,children:[(0,$.jsx)(He,{value:ae,onChange:Z,language:e,inputClassName:St,labels:{callName:t.callName,callNamePlaceholder:t.meetPlaceholder,pronouns:t.pronouns,pronounsPlaceholder:t.pronounsPlaceholder,timezone:t.timezone,timezoneCustom:t.timezoneCustom,timezoneDetect:t.timezoneDetect,custom:t.custom,notes:t.notes,notesPlaceholder:t.notesPlaceholder}}),(0,$.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,$.jsx)(v,{type:`button`,variant:`ghost`,onClick:()=>{ie(!1),Z(null)},children:t.cancel}),(0,$.jsx)(v,{type:`button`,variant:`primary`,disabled:ce,onClick:()=>void Zt(),children:ce?t.saving:t.save})]})]}):(0,$.jsxs)(`dl`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.callName}),(0,$.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:dt.callName||`—`})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.timezone}),(0,$.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:dt.timezone||`—`})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.pronouns}),(0,$.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:dt.pronouns||`—`})]}),(0,$.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.notes}),(0,$.jsx)(`dd`,{className:`mt-1 whitespace-pre-wrap text-sm leading-6 text-fg`,children:dt.notes||`—`})]})]})]}),(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.structuredContextTitle}),(0,$.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2 xl:grid-cols-4`,children:[(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":k&&!G&&z===`preference`,className:s(`rounded-xl border bg-surface-panel p-4 text-left transition-colors hover:border-accent/30 hover:bg-surface-hover`,k&&!G&&z===`preference`?`border-accent/40 bg-accent-soft/20`:`border-edge-subtle`),onClick:()=>tn(`preference`),children:[(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:t.addPreference}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.addPreferenceHint})]}),(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":k&&!G&&z===`boundary`,className:s(`rounded-xl border bg-surface-panel p-4 text-left transition-colors hover:border-accent/30 hover:bg-surface-hover`,k&&!G&&z===`boundary`?`border-accent/40 bg-accent-soft/20`:`border-edge-subtle`),onClick:()=>tn(`boundary`),children:[(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:t.addBoundary}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.addBoundaryHint})]}),(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":k&&!G&&z===`current_state`,className:s(`rounded-xl border bg-surface-panel p-4 text-left transition-colors hover:border-accent/30 hover:bg-surface-hover`,k&&!G&&z===`current_state`?`border-accent/40 bg-accent-soft/20`:`border-edge-subtle`),onClick:()=>tn(`current_state`),children:[(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:t.addCurrentFocus}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.addCurrentFocusHint})]}),(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":k&&G,className:s(`rounded-xl border bg-surface-panel p-4 text-left transition-colors hover:border-accent/30 hover:bg-surface-hover`,k&&G?`border-accent/40 bg-accent-soft/20`:`border-edge-subtle`),onClick:()=>tn(`relationship`,!0),children:[(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:t.addOther}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.addOtherHint})]})]}),k?(0,$.jsxs)(`div`,{className:`mt-4 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:G?t.addOther:z===`preference`?t.addPreference:z===`boundary`?t.addBoundary:t.addCurrentFocus}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:G?t.addOtherHint:z===`preference`?t.addPreferenceHint:z===`boundary`?t.addBoundaryHint:t.addCurrentFocusHint})]}),G?null:(0,$.jsx)(wt,{children:t.understandingKinds[z]})]}),(0,$.jsx)(`textarea`,{className:s(St,`mt-3 min-h-24 resize-y`),value:M,onChange:e=>P(e.target.value),placeholder:t.understandingPlaceholders[z],autoFocus:!0}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-end justify-between gap-3`,children:[G?(0,$.jsxs)(`label`,{className:`grid min-w-48 gap-1 text-xs font-medium text-fg-muted`,children:[t.understandingKind,(0,$.jsx)(d,{value:z,onChange:e=>W(e.target.value),children:xt.map(e=>(0,$.jsx)(J,{value:e,children:t.understandingKinds[e]},e))})]}):(0,$.jsx)(`span`,{}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsx)(v,{type:`button`,variant:`ghost`,onClick:nn,children:t.cancel}),(0,$.jsx)(v,{type:`button`,variant:`primary`,disabled:!M.trim()||E===`understanding:new`,onClick:()=>void Ut(),children:t.add})]})]})]}):null]}),y.conflictGroups.some(e=>e.unresolved)?(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.conflictsTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.conflictsHint}),(0,$.jsx)(`div`,{className:`mt-3 space-y-3`,children:y.conflictGroups.filter(e=>e.unresolved).map(n=>(0,$.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-xl border border-warning/35 bg-warning-soft/25`,children:n.records.filter(e=>e.storedStatus!==`archived`&&e.storedStatus!==`rejected`).map(r=>(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3 px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:r.statement}),(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:[Dt(r,t),` · `,Tt(r.updatedAt,e)]})]}),(0,$.jsx)(v,{type:`button`,variant:`secondary`,className:`h-8 shrink-0 px-2.5`,disabled:E===`conflict:${n.id}`,onClick:()=>void Gt(n.id,r.id),children:t.useThis})]},r.id))},n.id))})]}):null,y.consentRequests.length>0?(0,$.jsxs)(`section`,{className:`space-y-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.consentTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.consentHint})]}),y.consentRequests.map(e=>(0,$.jsxs)(`article`,{className:`rounded-2xl border border-accent/25 bg-accent-soft/20 p-4`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:e.statement}),(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.consentPurpose.replace(`{{purpose}}`,e.purpose)}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap justify-end gap-2`,children:[(0,$.jsx)(v,{type:`button`,variant:`ghost`,disabled:E===`consent:${e.id}`,onClick:()=>void Ht(e.id,`deny`),children:t.consentDeny}),(0,$.jsx)(v,{type:`button`,variant:`secondary`,disabled:E===`consent:${e.id}`,onClick:()=>void Ht(e.id,`once`),children:t.consentOnce}),(0,$.jsx)(v,{type:`button`,variant:`secondary`,disabled:E===`consent:${e.id}`,onClick:()=>void Ht(e.id,`session`),children:t.consentSession}),(0,$.jsx)(v,{type:`button`,variant:`primary`,disabled:E===`consent:${e.id}`,onClick:()=>void Ht(e.id,`always`),children:t.consentAlways})]})]},e.id))]}):null,(0,$.jsxs)(`div`,{ref:lt,className:`space-y-6 scroll-mt-6`,children:[mt.length>0?(0,$.jsxs)(`section`,{children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.connectedClaimsTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.connectedClaimsHint})]}),(0,$.jsx)(`div`,{className:`mt-3 grid gap-3 lg:grid-cols-2`,children:mt.map(n=>(0,$.jsx)(kt,{claim:n,language:e,t,busy:E===`claim:${n.id}`,onDecision:e=>void Pt(n,e)},n.id))})]}):null,pt.length>0?(0,$.jsxs)(`section`,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.reviewTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.reviewHint})]}),(0,$.jsx)(v,{type:`button`,variant:`secondary`,disabled:E===`understanding:batch`,onClick:()=>void Wt(),children:t.reviewAll})]}),(0,$.jsx)(`div`,{className:`mt-3 grid gap-3 lg:grid-cols-2`,children:pt.map(n=>(0,$.jsx)(Ot,{item:n,language:e,t,busy:E===n.id,onConfirm:()=>void Vt(n,`confirm`),onReject:()=>void Vt(n,`reject`),onUpdate:e=>void Vt(n,`update`,e),onForget:()=>X(n)},n.id))})]}):ft.length>0||mt.some(e=>e.state===`active`)?(0,$.jsxs)(`div`,{className:`rounded-2xl border border-success/20 bg-success-soft p-6 text-center`,children:[(0,$.jsx)(o,{className:`mx-auto size-5 text-success`,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`mt-2 text-sm font-semibold text-fg`,children:t.nothingToReview}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.nothingToReviewHint})]}):null]}),bt.map(n=>{let r=_t.get(n)??[];return r.length===0?null:(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.facets[n]}),(0,$.jsx)(`div`,{className:`mt-3 grid gap-3 lg:grid-cols-2`,children:r.map(n=>(0,$.jsx)(Ot,{item:n,language:e,t,busy:E===n.id,onConfirm:()=>void Vt(n,`confirm`),onReject:()=>void Vt(n,`reject`),onUpdate:e=>void Vt(n,`update`,e),onForget:()=>X(n)},n.id))})]},n)}),y.understanding.length===0&&mt.length===0?(0,$.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge p-10 text-center text-sm text-fg-muted`,children:t.emptyUnderstanding}):null]}):null,y&&m===`collaboration`?(0,$.jsxs)(`div`,{id:`you-panel-collaboration`,role:`tabpanel`,"aria-labelledby":`you-tab-collaboration`,className:`space-y-6`,children:[(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.collaborationTitle}),(0,$.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-6 text-fg-muted`,children:t.collaborationHint})]}),(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,$.jsxs)(`div`,{className:`max-w-2xl`,children:[(0,$.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,$.jsx)(H,{className:`size-4 text-accent`,"aria-hidden":!0}),t.supportModeTitle]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.supportModeHint})]}),(0,$.jsxs)(`label`,{className:`grid min-w-48 gap-1 text-xs font-medium text-fg-muted`,children:[(0,$.jsx)(`span`,{className:`sr-only`,children:t.supportModeTitle}),(0,$.jsx)(d,{value:y.relationship.supportMode,disabled:We,onChange:e=>void Nt({supportMode:e.target.value}),children:Object.entries(t.supportModes).map(([e,t])=>(0,$.jsx)(J,{value:e,children:t},e))})]})]}),(0,$.jsxs)(`div`,{className:`mt-4 grid gap-3 border-t border-edge-subtle pt-4 sm:grid-cols-2 lg:grid-cols-4`,children:[(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:y.relationship.proactiveEnabled,disabled:We,onChange:e=>void Nt({proactiveEnabled:e.target.checked})}),t.proactiveEnabled]}),(0,$.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.quietStart,(0,$.jsx)(Le,{value:y.relationship.quietStart??``,disabled:We,allowEmpty:!0,clearLabel:t.clearTime,ariaLabel:t.quietStart,onChange:e=>void Nt({quietStart:e||null})})]}),(0,$.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.quietEnd,(0,$.jsx)(Le,{value:y.relationship.quietEnd??``,disabled:We,allowEmpty:!0,clearLabel:t.clearTime,ariaLabel:t.quietEnd,onChange:e=>void Nt({quietEnd:e||null})})]}),(0,$.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.blockedTopics,(0,$.jsx)(`input`,{className:St,defaultValue:y.relationship.blockedTopics.join(`, `),disabled:We,onBlur:e=>void Nt({blockedTopics:e.target.value.split(`,`).map(e=>e.trim()).filter(Boolean)})})]})]}),(0,$.jsx)(`p`,{className:`mt-3 text-right text-xs text-fg-subtle`,children:We?t.saving:t.autoSaveHint})]}),(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`h2`,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[(0,$.jsx)(je,{className:`size-4 text-accent`,"aria-hidden":!0}),t.playbooksTitle]}),(0,$.jsx)(wt,{children:t.affectsAgentsBadge})]}),y.playbooks.length>0?(0,$.jsx)(`div`,{className:`mt-4 grid gap-3 xl:grid-cols-3`,children:y.playbooks.map(e=>(0,$.jsx)(jt,{playbook:e,busy:E===`playbook:${e.id}`,t,onToggleGroup:()=>void Jt(e),onCreate:t=>void Yt(e.id,()=>Fe(e.id,t,(e.rules.at(-1)?.order??0)+10)),onUpdate:(t,n)=>void Yt(e.id,()=>se(e.id,t,n)),onDelete:t=>void Yt(e.id,()=>x(e.id,t)),onRollback:(t,n)=>void Yt(e.id,()=>O(e.id,t,n))},e.id))}):(0,$.jsx)(`p`,{className:`mt-4 rounded-xl bg-surface-muted px-4 py-3 text-sm text-fg-muted`,children:t.emptyPlaybooks})]})]}):null,y&&m===`sources`?(0,$.jsx)(ht,{sources:y.sources,recommendations:y.sourceRecommendations,language:e,t,busyId:E,onAddSource:()=>n(`/connectors?personalContext=1`),onConnectRecommendation:e=>n(`/connectors?personalContext=1&connector=${encodeURIComponent(e)}&returnTo=%2Fyou%3Ftab%3Dsources`),onLearn:e=>void zt(e),onPause:e=>void Bt(e),onConfigure:Rt,onDisconnect:$e,onViewUnderstanding:()=>It(`memory`)}):null,y&&m===`dreaming`?(0,$.jsx)(nt,{language:e}):null,y&&m===`privacy`&&vt?(0,$.jsxs)(`div`,{id:`you-panel-privacy`,role:`tabpanel`,"aria-labelledby":`you-tab-privacy`,className:`space-y-6`,children:[(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.privacyTitle}),(0,$.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-6 text-fg-muted`,children:t.privacyHint})]}),(0,$.jsxs)(`div`,{className:`grid gap-6 xl:grid-cols-2`,children:[(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.controlTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.controlHint}),(0,$.jsxs)(`div`,{className:`mt-4 space-y-3 rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[t.learningMode,(0,$.jsx)(d,{value:vt.mode,disabled:Oe,onChange:e=>void rn({...vt,mode:e.target.value}),children:Object.entries(t.learningModes).map(([e,t])=>(0,$.jsx)(J,{value:e,children:t},e))})]}),(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[t.sensitive,(0,$.jsx)(d,{value:vt.sensitiveWritePolicy,disabled:Oe,onChange:e=>void rn({...vt,sensitiveWritePolicy:e.target.value}),children:Object.entries(t.sensitiveOptions).map(([e,t])=>(0,$.jsx)(J,{value:e,children:t},e))}),(0,$.jsx)(`span`,{className:`font-normal leading-5 text-fg-subtle`,children:t.sensitiveOptionHints[vt.sensitiveWritePolicy]})]}),(0,$.jsx)(`p`,{className:`text-right text-xs text-fg-subtle`,children:Oe?t.saving:t.autoSaveHint})]})]}),(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.trustTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.trustHint}),(0,$.jsx)(`div`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,children:y.trust.levels.map(e=>(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":e===y.trust.defaultActionLevel,disabled:Be,onClick:()=>{e!==y.trust.defaultActionLevel&&(e===`auto`?qe(e):an(e))},className:s(`rounded-xl border p-3 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-70`,e===y.trust.defaultActionLevel?`border-accent/35 bg-accent-soft/35`:`border-edge-subtle bg-surface-panel hover:border-accent/25 hover:bg-surface-hover`),children:[(0,$.jsx)(`p`,{className:`text-xs font-semibold text-fg`,children:t.trustLevels[e]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.trustLevelHints[e]}),e===y.trust.defaultActionLevel?(0,$.jsx)(`span`,{className:`mt-2 inline-block rounded-full bg-accent-soft px-2 py-0.5 text-[11px] text-accent-fg`,children:t.defaultTrust}):null]},e))})]})]}),(0,$.jsx)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.jsx)(ye,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.sharingTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.sharingHint})]})]})}),(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.grantsTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.grantsHint}),y.referenceGrants.length>0?(0,$.jsx)(`div`,{className:`mt-3 divide-y divide-edge overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:y.referenceGrants.map(n=>(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`p`,{className:`truncate text-sm text-fg`,children:n.statement}),(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:[n.grantScope?t.grantScopes[n.grantScope]:``,n.expiresAt?` · ${Tt(n.expiresAt,e)}`:``]})]}),(0,$.jsx)(v,{type:`button`,variant:`ghost`,className:`h-8 px-2.5`,disabled:E===`grant:${n.id}`,onClick:()=>void Kt(n.id),children:t.revoke})]},n.id))}):(0,$.jsx)(`p`,{className:`mt-3 rounded-xl bg-surface-muted px-4 py-3 text-sm text-fg-muted`,children:t.noGrants})]}),(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.transferTitle}),(0,$.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,$.jsxs)(v,{type:`button`,variant:`secondary`,disabled:it!==null,onClick:()=>void sn(),children:[(0,$.jsx)(Me,{className:`size-4`,"aria-hidden":!0}),it===`export`?t.exporting:t.exportAction]}),(0,$.jsxs)(v,{type:`button`,variant:`secondary`,disabled:it!==null,onClick:()=>ut.current?.click(),children:[(0,$.jsx)(Pe,{className:`size-4`,"aria-hidden":!0}),it===`import`?t.importing:t.importAction]}),(0,$.jsx)(`input`,{ref:ut,type:`file`,accept:`application/json,.json`,className:`sr-only`,onChange:e=>Ze(e.target.files?.[0]??null)})]})]})]}):null,(0,$.jsx)(ke,{open:q!==null,title:t.forgetTitle,description:t.forgetBody,confirmLabel:t.forget,cancelLabel:t.cancel,destructive:!0,onConfirm:()=>void Xt(),onCancel:()=>X(null)}),(0,$.jsx)(ke,{open:Ke===`auto`,title:t.autoConfirmTitle,description:t.autoConfirmBody,confirmLabel:t.autoConfirmAction,cancelLabel:t.cancel,onConfirm:()=>void an(`auto`),onCancel:()=>qe(null)}),(0,$.jsx)(ke,{open:Xe!==null,title:t.importConfirmTitle,description:t.importConfirmBody.replace(`{{name}}`,Xe?.name??``),confirmLabel:t.importConfirmAction,cancelLabel:t.cancel,onConfirm:()=>{let e=Xe;Ze(null),cn(e)},onCancel:ln}),(0,$.jsx)(rt,{source:Qe,language:e,busy:et,onOpenChange:e=>{e||$e(null)},onConfirm:e=>void on(e)}),(0,$.jsx)(Ue,{open:Je,t,onOpenChange:Ye,onNavigate:It})]})}export{It as UserContextPage};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,l as a}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as o}from"./check-DUBLcKHA.js";import{t as s}from"./cn-JdwAhgNB.js";import{t as c}from"./messages-D02NNLCZ.js";import{n as l}from"./locale-store-D6hs74o5.js";import{i as u}from"./vendor-swr-BIWyz7Rc.js";import{$o as d,$t as f,Bl as p,Bo as m,Bs as h,Bt as g,Cc as _,Es as v,Gt as y,Ho as b,Ht as x,Io as S,Jt as C,Kt as w,Lc as T,Lo as E,Ps as D,Qt as O,Ro as k,Rt as A,Tc as j,Us as M,Ut as N,Vo as P,Vt as F,Wo as I,Wt as L,Xt as R,Yl as z,Yt as B,Zt as V,_l as H,an as U,as as W,bs as G,cc as ee,cn as K,cu as q,do as te,en as ne,es as J,eu as Y,fn as X,fu as re,gc as ie,hc as ae,hl as Z,hn as oe,in as se,jc as ce,kc as le,ks as ue,ln as de,lu as fe,mn as pe,mu as me,nc as he,nl as ge,nn as _e,nu as ve,oc as ye,on as be,os as xe,ou as Se,qt as Ce,rn as we,rt as Te,sn as Ee,tn as De,to as Oe,tr as ke,un as Ae,yu as je,zl as Me,zo as Ne,zs as Pe,zt as Fe}from"./index-OJgiMh07.js";import{t as Ie}from"./page-tabs-BxlwhAbH.js";import{t as Le}from"./time-picker-BGk_Tbsj.js";import{E as Re,O as ze,t as Be}from"./connector-logo-TRr9ybf6.js";var Ve=n(),Q=e(t(),1),$=r();function He(e){let t=(0,Ve.c)(104),{value:n,onChange:r,labels:i,language:a,inputClassName:o}=e,c;t[0]===n.timezone?c=t[1]:(c=()=>pe.some(e=>e.value===n.timezone)?``:n.timezone,t[0]=n.timezone,t[1]=c);let[l,u]=(0,Q.useState)(c),f;t[2]===n.timezone?f=t[3]:(f=()=>!!n.timezone&&!pe.some(e=>e.value===n.timezone),t[2]=n.timezone,t[3]=f);let[p,m]=(0,Q.useState)(f),h;t[4]===n.pronouns?h=t[5]:(h=()=>!!n.pronouns&&!X.some(e=>e.value===n.pronouns),t[4]=n.pronouns,t[5]=h);let[g,_]=(0,Q.useState)(h),v;bb0:{if(p){v=`__custom__`;break bb0}v=pe.some(e=>e.value===n.timezone)?n.timezone:`__custom__`}let y=v,b;t[6]!==r||t[7]!==n?(b=e=>r({...n,...e}),t[6]=r,t[7]=n,t[8]=b):b=t[8];let x=b,S;t[9]===a?S=t[10]:(S=(e,t)=>a===`zh`?t:e,t[9]=a,t[10]=S);let C=S,w;t[11]===i.callName?w=t[12]:(w=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.callName}),t[11]=i.callName,t[12]=w);let T;t[13]===x?T=t[14]:(T=e=>x({callName:e.target.value}),t[13]=x,t[14]=T);let E;t[15]!==o||t[16]!==i.callNamePlaceholder||t[17]!==T||t[18]!==n.callName?(E=(0,$.jsx)(`input`,{className:o,value:n.callName,onChange:T,placeholder:i.callNamePlaceholder,autoComplete:`off`}),t[15]=o,t[16]=i.callNamePlaceholder,t[17]=T,t[18]=n.callName,t[19]=E):E=t[19];let D;t[20]!==w||t[21]!==E?(D=(0,$.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[w,E]}),t[20]=w,t[21]=E,t[22]=D):D=t[22];let O;t[23]===i.pronouns?O=t[24]:(O=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.pronouns}),t[23]=i.pronouns,t[24]=O);let k=g?`__custom__`:n.pronouns,A;t[25]!==x||t[26]!==n.pronouns?(A=e=>{if(e.target.value===`__custom__`){_(!0),X.some(e=>e.value===n.pronouns)&&x({pronouns:``});return}_(!1),x({pronouns:e.target.value})},t[25]=x,t[26]=n.pronouns,t[27]=A):A=t[27];let j;t[28]===i.pronounsPlaceholder?j=t[29]:(j=(0,$.jsx)(J,{value:``,children:i.pronounsPlaceholder}),t[28]=i.pronounsPlaceholder,t[29]=j);let M;t[30]===C?M=t[31]:(M=X.map(e=>(0,$.jsx)(J,{value:e.value,children:C(e.labelEn,e.labelZh)},e.value)),t[30]=C,t[31]=M);let N;t[32]===i.custom?N=t[33]:(N=(0,$.jsx)(J,{value:`__custom__`,children:i.custom}),t[32]=i.custom,t[33]=N);let P;t[34]!==o||t[35]!==k||t[36]!==A||t[37]!==j||t[38]!==M||t[39]!==N?(P=(0,$.jsxs)(d,{className:o,value:k,onChange:A,children:[j,M,N]}),t[34]=o,t[35]=k,t[36]=A,t[37]=j,t[38]=M,t[39]=N,t[40]=P):P=t[40];let F;t[41]!==o||t[42]!==i.pronounsPlaceholder||t[43]!==g||t[44]!==x||t[45]!==n.pronouns?(F=g?(0,$.jsx)(`input`,{className:s(o,`mt-1 text-xs`),value:n.pronouns,onChange:e=>x({pronouns:e.target.value}),placeholder:i.pronounsPlaceholder,autoComplete:`off`}):null,t[41]=o,t[42]=i.pronounsPlaceholder,t[43]=g,t[44]=x,t[45]=n.pronouns,t[46]=F):F=t[46];let I;t[47]!==O||t[48]!==P||t[49]!==F?(I=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm`,children:[O,P,F]}),t[47]=O,t[48]=P,t[49]=F,t[50]=I):I=t[50];let L;t[51]===i.timezone?L=t[52]:(L=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.timezone}),t[51]=i.timezone,t[52]=L);let R;t[53]===o?R=t[54]:(R=s(o,`min-w-0 flex-1`),t[53]=o,t[54]=R);let z;t[55]===x?z=t[56]:(z=e=>{if(e.target.value===`__custom__`){m(!0);return}m(!1),u(``),x({timezone:e.target.value})},t[55]=x,t[56]=z);let B;t[57]===C?B=t[58]:(B=pe.map(e=>(0,$.jsx)(J,{value:e.value,children:C(e.labelEn,e.labelZh)},e.value)),t[57]=C,t[58]=B);let V;t[59]===i.timezoneCustom?V=t[60]:(V=(0,$.jsx)(J,{value:`__custom__`,children:i.timezoneCustom}),t[59]=i.timezoneCustom,t[60]=V);let H;t[61]!==R||t[62]!==z||t[63]!==B||t[64]!==V||t[65]!==y?(H=(0,$.jsxs)(d,{className:R,value:y,onChange:z,children:[B,V]}),t[61]=R,t[62]=z,t[63]=B,t[64]=V,t[65]=y,t[66]=H):H=t[66];let U;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(U=s(`shrink-0 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,G.press),t[67]=U):U=t[67];let W;t[68]===x?W=t[69]:(W=()=>{let e=oe();if(!e)return;let t=pe.some(t=>t.value===e);m(!t),u(t?``:e),x({timezone:e})},t[68]=x,t[69]=W);let ee;t[70]!==i.timezoneDetect||t[71]!==W?(ee=(0,$.jsx)(`button`,{type:`button`,className:U,onClick:W,children:i.timezoneDetect}),t[70]=i.timezoneDetect,t[71]=W,t[72]=ee):ee=t[72];let K;t[73]!==H||t[74]!==ee?(K=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[H,ee]}),t[73]=H,t[74]=ee,t[75]=K):K=t[75];let q;t[76]!==l||t[77]!==o||t[78]!==p||t[79]!==x?(q=p?(0,$.jsx)(`input`,{className:s(o,`mt-1 font-mono text-xs`),value:l,onChange:e=>{u(e.target.value),x({timezone:e.target.value})},placeholder:`e.g. Asia/Shanghai`,autoComplete:`off`}):null,t[76]=l,t[77]=o,t[78]=p,t[79]=x,t[80]=q):q=t[80];let te;t[81]!==L||t[82]!==K||t[83]!==q?(te=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[L,K,q]}),t[81]=L,t[82]=K,t[83]=q,t[84]=te):te=t[84];let ne;t[85]===i.notes?ne=t[86]:(ne=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.notes}),t[85]=i.notes,t[86]=ne);let Y;t[87]===o?Y=t[88]:(Y=s(o,`min-h-28 resize-y text-sm leading-relaxed`),t[87]=o,t[88]=Y);let re;t[89]===x?re=t[90]:(re=e=>x({notes:e.target.value}),t[89]=x,t[90]=re);let ie;t[91]!==i.notesPlaceholder||t[92]!==Y||t[93]!==re||t[94]!==n.notes?(ie=(0,$.jsx)(`textarea`,{className:Y,value:n.notes,onChange:re,placeholder:i.notesPlaceholder,rows:5,spellCheck:!0}),t[91]=i.notesPlaceholder,t[92]=Y,t[93]=re,t[94]=n.notes,t[95]=ie):ie=t[95];let ae;t[96]!==ne||t[97]!==ie?(ae=(0,$.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[ne,ie]}),t[96]=ne,t[97]=ie,t[98]=ae):ae=t[98];let Z;return t[99]!==D||t[100]!==I||t[101]!==te||t[102]!==ae?(Z=(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[D,I,te,ae]}),t[99]=D,t[100]=I,t[101]=te,t[102]=ae,t[103]=Z):Z=t[103],Z}function Ue(e){let t=(0,Ve.c)(57),{open:n,t:r,onOpenChange:i,onNavigate:a}=e,o;t[0]!==r.helpLearningBody||t[1]!==r.helpLearningTitle?(o={icon:me,title:r.helpLearningTitle,body:r.helpLearningBody},t[0]=r.helpLearningBody,t[1]=r.helpLearningTitle,t[2]=o):o=t[2];let c;t[3]!==r.helpSharingBody||t[4]!==r.helpSharingTitle?(c={icon:D,title:r.helpSharingTitle,body:r.helpSharingBody},t[3]=r.helpSharingBody,t[4]=r.helpSharingTitle,t[5]=c):c=t[5];let l;t[6]!==r.helpSourcesBody||t[7]!==r.helpSourcesTitle?(l={icon:p,title:r.helpSourcesTitle,body:r.helpSourcesBody},t[6]=r.helpSourcesBody,t[7]=r.helpSourcesTitle,t[8]=l):l=t[8];let u;t[9]!==r.helpControlBody||t[10]!==r.helpControlTitle?(u={icon:ye,title:r.helpControlTitle,body:r.helpControlBody},t[9]=r.helpControlBody,t[10]=r.helpControlTitle,t[11]=u):u=t[11];let d;t[12]!==o||t[13]!==c||t[14]!==l||t[15]!==u?(d=[o,c,l,u],t[12]=o,t[13]=c,t[14]=l,t[15]=u,t[16]=d):d=t[16];let f=d,h;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(m,{className:s(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,xe)}),t[17]=h):h=t[17];let g;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(g=s(`fixed right-3 top-1/2 flex h-[min(44rem,calc(100dvh-1.5rem))] w-[min(30rem,calc(100vw-1.5rem))] -translate-y-1/2 flex-col overflow-hidden`,W,`rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`),t[18]=g):g=t[18];let _;t[19]===r.helpTitle?_=t[20]:(_=(0,$.jsx)(b,{className:`text-base font-semibold text-fg`,children:r.helpTitle}),t[19]=r.helpTitle,t[20]=_);let y;t[21]===r.helpSubtitle?y=t[22]:(y=(0,$.jsx)(Ne,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r.helpSubtitle}),t[21]=r.helpSubtitle,t[22]=y);let x;t[23]!==_||t[24]!==y?(x=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[_,y]}),t[23]=_,t[24]=y,t[25]=x):x=t[25];let C;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(ue,{className:`size-4`,"aria-hidden":!0}),t[26]=C):C=t[26];let w;t[27]===r.close?w=t[28]:(w=(0,$.jsx)(E,{asChild:!0,children:(0,$.jsx)(v,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":r.close,children:C})}),t[27]=r.close,t[28]=w);let T;t[29]!==x||t[30]!==w?(T=(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-4`,children:[x,w]}),t[29]=x,t[30]=w,t[31]=T):T=t[31];let O;t[32]===f?O=t[33]:(O=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-2`,children:f.map(We)}),t[32]=f,t[33]=O);let A;t[34]!==a||t[35]!==i?(A=()=>{i(!1),a(`sources`)},t[34]=a,t[35]=i,t[36]=A):A=t[36];let j;t[37]!==r.tabs.sources||t[38]!==A?(j=(0,$.jsx)(v,{type:`button`,variant:`ghost`,onClick:A,children:r.tabs.sources}),t[37]=r.tabs.sources,t[38]=A,t[39]=j):j=t[39];let M;t[40]!==a||t[41]!==i?(M=()=>{i(!1),a(`privacy`)},t[40]=a,t[41]=i,t[42]=M):M=t[42];let N;t[43]!==r.openPrivacyControls||t[44]!==M?(N=(0,$.jsx)(v,{type:`button`,variant:`secondary`,onClick:M,children:r.openPrivacyControls}),t[43]=r.openPrivacyControls,t[44]=M,t[45]=N):N=t[45];let F;t[46]!==j||t[47]!==N?(F=(0,$.jsxs)(`footer`,{className:`flex shrink-0 flex-wrap justify-end gap-2 border-t border-edge px-5 py-4`,children:[j,N]}),t[46]=j,t[47]=N,t[48]=F):F=t[48];let I;t[49]!==T||t[50]!==O||t[51]!==F?(I=(0,$.jsxs)(P,{children:[h,(0,$.jsxs)(k,{className:g,children:[T,O,F]})]}),t[49]=T,t[50]=O,t[51]=F,t[52]=I):I=t[52];let L;return t[53]!==i||t[54]!==n||t[55]!==I?(L=(0,$.jsx)(S,{open:n,onOpenChange:i,children:I}),t[53]=i,t[54]=n,t[55]=I,t[56]=L):L=t[56],L}function We(e){let{icon:t,title:n,body:r}=e;return(0,$.jsxs)(`section`,{className:`flex gap-3 border-b border-edge-subtle py-4 last:border-b-0`,children:[(0,$.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-lg bg-surface-muted text-fg-muted`,children:(0,$.jsx)(t,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r})]})]},n)}var Ge={zh:[`周日`,`周一`,`周二`,`周三`,`周四`,`周五`,`周六`],en:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]};function Ke(e,t){if(e.kind===`interval`){let n=t===`zh`?`每 ${e.everyHours} 小时`:`Every ${e.everyHours} hours`;return e.minute===0?n:t===`zh`?`${n},整点后 ${e.minute} 分`:`${n}, at :${String(e.minute).padStart(2,`0`)}`}if(e.kind===`daily`)return t===`zh`?`每天 ${e.time}`:`Daily at ${e.time}`;let n=Ge[t][e.weekday];return t===`zh`?`每${n} ${e.time}`:`Every ${n} at ${e.time}`}function qe(e,t,n){return e?new Intl.DateTimeFormat(t===`zh`?`zh-CN`:`en-US`,{timeZone:n,month:`short`,day:`numeric`,weekday:`short`,hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`}).format(new Date(e)):t===`zh`?`暂无计划`:`Not scheduled`}function Je(e,t){let n=new Intl.DateTimeFormat(`en`,{timeZone:e,timeZoneName:`shortOffset`}).formatToParts().find(e=>e.type===`timeZoneName`)?.value,r=t===`zh`&&e===`Asia/Shanghai`?`中国标准时间`:e;return n?`${r} (${n.replace(`GMT`,`UTC`)})`:r}var Ye={light:{kind:`interval`,everyHours:6,minute:0},deep:{kind:`daily`,time:`03:00`},rem:{kind:`weekly`,weekday:0,time:`05:00`}},Xe=[1,2,3,4,6,8,12,24];function Ze(e){let t=(0,Ve.c)(136),{open:n,phase:r,value:i,language:a,saving:o,onOpenChange:c,onSave:l}=e,u=a===`zh`,[f,p]=(0,Q.useState)(i),h,g;t[0]!==n||t[1]!==i?(h=()=>{n&&p(i)},g=[n,i],t[0]=n,t[1]=i,t[2]=h,t[3]=g):(h=t[2],g=t[3]),(0,Q.useEffect)(h,g);let _;t[4]===f?_=t[5]:(_=e=>{let t=f.schedule,n=t.kind===`daily`||t.kind===`weekly`?t.time:`03:00`,r=e===`interval`?{kind:e,everyHours:6,minute:0}:e===`daily`?{kind:e,time:n}:{kind:e,weekday:0,time:n};p({...f,schedule:r})},t[4]=f,t[5]=_);let y=_,x;t[6]===f?x=t[7]:(x=e=>{f.schedule.kind===`interval`&&p({...f,schedule:{...f.schedule,...e}})},t[6]=f,t[7]=x);let C=x,w;t[8]===f?w=t[9]:(w=e=>{f.schedule.kind===`weekly`&&p({...f,schedule:{...f.schedule,...e}})},t[8]=f,t[9]=w);let T=w,D;t[10]===f?D=t[11]:(D=e=>{f.schedule.kind!==`interval`&&p({...f,schedule:{...f.schedule,time:e}})},t[10]=f,t[11]=D);let O=D,A;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(m,{className:s(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,xe)}),t[12]=A):A=t[12];let j;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(j=s(`fixed left-1/2 top-1/2 flex h-[min(38rem,calc(100dvh-1.5rem))] w-[min(32rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,W,`rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`),t[13]=j):j=t[13];let M;t[14]===r?M=t[15]:(M=r.toUpperCase(),t[14]=r,t[15]=M);let N=u?`运行计划`:`Schedule`,F;t[16]!==N||t[17]!==M?(F=(0,$.jsxs)(b,{className:`text-base font-semibold text-fg`,children:[M,` · `,N]}),t[16]=N,t[17]=M,t[18]=F):F=t[18];let I=u?`设置后台记忆整理的频率和时间。`:`Choose when background memory consolidation runs.`,L;t[19]===I?L=t[20]:(L=(0,$.jsx)(Ne,{className:`mt-1 text-sm text-fg-muted`,children:I}),t[19]=I,t[20]=L);let R;t[21]!==F||t[22]!==L?(R=(0,$.jsxs)(`div`,{children:[F,L]}),t[21]=F,t[22]=L,t[23]=R):R=t[23];let z=u?`关闭`:`Close`,B;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(ue,{className:`size-4`}),t[24]=B):B=t[24];let V;t[25]===z?V=t[26]:(V=(0,$.jsx)(E,{asChild:!0,children:(0,$.jsx)(v,{variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":z,children:B})}),t[25]=z,t[26]=V);let H;t[27]!==R||t[28]!==V?(H=(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-4`,children:[R,V]}),t[27]=R,t[28]=V,t[29]=H):H=t[29];let U=u?`自动运行`:`Automatic runs`,G;t[30]===U?G=t[31]:(G=(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:U}),t[30]=U,t[31]=G);let ee=u?`关闭后仍可手动立即运行。`:`You can still run this phase manually.`,K;t[32]===ee?K=t[33]:(K=(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:ee}),t[32]=ee,t[33]=K);let q;t[34]!==G||t[35]!==K?(q=(0,$.jsxs)(`div`,{children:[G,K]}),t[34]=G,t[35]=K,t[36]=q):q=t[36];let te=f.enabled,ne=f.enabled?`bg-accent`:`bg-surface-active`,Y;t[37]===ne?Y=t[38]:(Y=s(`relative h-6 w-11 shrink-0 overflow-hidden rounded-full transition-colors`,ne),t[37]=ne,t[38]=Y);let X;t[39]===f?X=t[40]:(X=()=>p({...f,enabled:!f.enabled}),t[39]=f,t[40]=X);let re=f.enabled&&`translate-x-5`,ie;t[41]===re?ie=t[42]:(ie=s(`absolute left-0.5 top-0.5 size-5 rounded-full bg-white shadow-sm transition-transform`,re),t[41]=re,t[42]=ie);let Z;t[43]===ie?Z=t[44]:(Z=(0,$.jsx)(`span`,{className:ie}),t[43]=ie,t[44]=Z);let oe;t[45]!==f.enabled||t[46]!==Y||t[47]!==X||t[48]!==Z?(oe=(0,$.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":te,className:Y,onClick:X,children:Z}),t[45]=f.enabled,t[46]=Y,t[47]=X,t[48]=Z,t[49]=oe):oe=t[49];let se;t[50]!==q||t[51]!==oe?(se=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-4 rounded-xl border border-edge-subtle bg-surface-subtle px-4 py-3`,children:[q,oe]}),t[50]=q,t[51]=oe,t[52]=se):se=t[52];let ce=u?`运行频率`:`Frequency`,le;t[53]===ce?le=t[54]:(le=(0,$.jsx)(`span`,{children:ce}),t[53]=ce,t[54]=le);let de;t[55]===y?de=t[56]:(de=e=>y(e.target.value),t[55]=y,t[56]=de);let fe=u?`每隔几小时`:`Every few hours`,pe;t[57]===fe?pe=t[58]:(pe=(0,$.jsx)(J,{value:`interval`,children:fe}),t[57]=fe,t[58]=pe);let me=u?`每天`:`Daily`,he;t[59]===me?he=t[60]:(he=(0,$.jsx)(J,{value:`daily`,children:me}),t[59]=me,t[60]=he);let ge=u?`每周`:`Weekly`,_e;t[61]===ge?_e=t[62]:(_e=(0,$.jsx)(J,{value:`weekly`,children:ge}),t[61]=ge,t[62]=_e);let ve;t[63]!==f.schedule.kind||t[64]!==de||t[65]!==pe||t[66]!==he||t[67]!==_e?(ve=(0,$.jsxs)(d,{value:f.schedule.kind,onChange:de,children:[pe,he,_e]}),t[63]=f.schedule.kind,t[64]=de,t[65]=pe,t[66]=he,t[67]=_e,t[68]=ve):ve=t[68];let ye;t[69]!==le||t[70]!==ve?(ye=(0,$.jsxs)(`label`,{className:`block space-y-2 text-sm font-medium text-fg`,children:[le,ve]}),t[69]=le,t[70]=ve,t[71]=ye):ye=t[71];let be;t[72]!==f.schedule.everyHours||t[73]!==f.schedule.kind||t[74]!==f.schedule.minute||t[75]!==C||t[76]!==u?(be=f.schedule.kind===`interval`?(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:`block space-y-2 text-sm font-medium text-fg`,children:[(0,$.jsx)(`span`,{children:u?`间隔`:`Interval`}),(0,$.jsx)(d,{value:String(f.schedule.everyHours),onChange:e=>C({everyHours:Number(e.target.value)}),children:Xe.map(e=>(0,$.jsx)(J,{value:String(e),children:u?`${e} 小时`:`${e} hours`},e))})]}),(0,$.jsxs)(`label`,{className:`block space-y-2 text-sm font-medium text-fg`,children:[(0,$.jsx)(`span`,{children:u?`开始分钟`:`Minute`}),(0,$.jsx)(d,{value:String(f.schedule.minute),onChange:e=>C({minute:Number(e.target.value)}),children:[0,15,30,45].map($e)})]})]}):null,t[72]=f.schedule.everyHours,t[73]=f.schedule.kind,t[74]=f.schedule.minute,t[75]=C,t[76]=u,t[77]=be):be=t[77];let Se;t[78]!==f.schedule.kind||t[79]!==f.schedule.weekday||t[80]!==T||t[81]!==u?(Se=f.schedule.kind===`weekly`?(0,$.jsxs)(`label`,{className:`block space-y-2 text-sm font-medium text-fg`,children:[(0,$.jsx)(`span`,{children:u?`星期`:`Weekday`}),(0,$.jsx)(d,{value:String(f.schedule.weekday),onChange:e=>T({weekday:Number(e.target.value)}),children:(u?[`周日`,`周一`,`周二`,`周三`,`周四`,`周五`,`周六`]:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]).map(Qe)})]}):null,t[78]=f.schedule.kind,t[79]=f.schedule.weekday,t[80]=T,t[81]=u,t[82]=Se):Se=t[82];let Ce;t[83]!==f.schedule.kind||t[84]!==f.schedule.time||t[85]!==O||t[86]!==u?(Ce=f.schedule.kind===`daily`||f.schedule.kind===`weekly`?(0,$.jsxs)(`label`,{className:`block space-y-2 text-sm font-medium text-fg`,children:[(0,$.jsx)(`span`,{children:u?`运行时间`:`Run time`}),(0,$.jsx)(Le,{value:f.schedule.time,minuteStep:15,ariaLabel:u?`运行时间`:`Run time`,onChange:O})]}):null,t[83]=f.schedule.kind,t[84]=f.schedule.time,t[85]=O,t[86]=u,t[87]=Ce):Ce=t[87];let we=u?`计划预览`:`Schedule preview`,Te;t[88]===we?Te=t[89]:(Te=(0,$.jsx)(`p`,{className:`text-xs font-medium text-accent-fg`,children:we}),t[88]=we,t[89]=Te);let Ee;t[90]!==f.schedule||t[91]!==a?(Ee=Ke(f.schedule,a),t[90]=f.schedule,t[91]=a,t[92]=Ee):Ee=t[92];let De;t[93]===Ee?De=t[94]:(De=(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:Ee}),t[93]=Ee,t[94]=De);let Oe;t[95]!==Te||t[96]!==De?(Oe=(0,$.jsxs)(`div`,{className:`rounded-xl bg-accent-soft px-4 py-3`,children:[Te,De]}),t[95]=Te,t[96]=De,t[97]=Oe):Oe=t[97];let ke;t[98]!==se||t[99]!==ye||t[100]!==be||t[101]!==Se||t[102]!==Ce||t[103]!==Oe?(ke=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto px-5 py-5`,children:[se,ye,be,Se,Ce,Oe]}),t[98]=se,t[99]=ye,t[100]=be,t[101]=Se,t[102]=Ce,t[103]=Oe,t[104]=ke):ke=t[104];let Ae;t[105]===r?Ae=t[106]:(Ae=()=>p({enabled:!0,schedule:Ye[r]}),t[105]=r,t[106]=Ae);let je;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(je=(0,$.jsx)(ae,{className:`size-4`}),t[107]=je):je=t[107];let Me=u?`恢复推荐值`:`Restore recommended`,Pe;t[108]!==o||t[109]!==Ae||t[110]!==Me?(Pe=(0,$.jsxs)(v,{type:`button`,variant:`ghost`,disabled:o,onClick:Ae,children:[je,Me]}),t[108]=o,t[109]=Ae,t[110]=Me,t[111]=Pe):Pe=t[111];let Fe=u?`取消`:`Cancel`,Ie;t[112]!==o||t[113]!==Fe?(Ie=(0,$.jsx)(E,{asChild:!0,children:(0,$.jsx)(v,{type:`button`,variant:`ghost`,disabled:o,children:Fe})}),t[112]=o,t[113]=Fe,t[114]=Ie):Ie=t[114];let Re;t[115]!==f||t[116]!==l?(Re=()=>void l(f),t[115]=f,t[116]=l,t[117]=Re):Re=t[117];let ze=o?u?`保存中…`:`Saving…`:u?`保存`:`Save`,Be;t[118]!==o||t[119]!==Re||t[120]!==ze?(Be=(0,$.jsx)(v,{type:`button`,variant:`primary`,disabled:o,onClick:Re,children:ze}),t[118]=o,t[119]=Re,t[120]=ze,t[121]=Be):Be=t[121];let He;t[122]!==Ie||t[123]!==Be?(He=(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[Ie,Be]}),t[122]=Ie,t[123]=Be,t[124]=He):He=t[124];let Ue;t[125]!==Pe||t[126]!==He?(Ue=(0,$.jsxs)(`footer`,{className:`flex shrink-0 items-center justify-between gap-3 border-t border-edge px-5 py-4`,children:[Pe,He]}),t[125]=Pe,t[126]=He,t[127]=Ue):Ue=t[127];let We;t[128]!==H||t[129]!==ke||t[130]!==Ue?(We=(0,$.jsxs)(P,{children:[A,(0,$.jsxs)(k,{className:j,children:[H,ke,Ue]})]}),t[128]=H,t[129]=ke,t[130]=Ue,t[131]=We):We=t[131];let Ge;return t[132]!==c||t[133]!==n||t[134]!==We?(Ge=(0,$.jsx)(S,{open:n,onOpenChange:c,children:We}),t[132]=c,t[133]=n,t[134]=We,t[135]=Ge):Ge=t[135],Ge}function Qe(e,t){return(0,$.jsx)(J,{value:String(t),children:e},e)}function $e(e){return(0,$.jsx)(J,{value:String(e),children:String(e).padStart(2,`0`)},e)}var et=[`UTC`,`Asia/Shanghai`,`Asia/Hong_Kong`,`Asia/Tokyo`,`Asia/Singapore`,`Asia/Kolkata`,`Europe/London`,`Europe/Paris`,`America/New_York`,`America/Chicago`,`America/Denver`,`America/Los_Angeles`,`Australia/Sydney`],tt={zh:{light:[`快速整理`,`整理近期产生的记忆信号。`],deep:[`深度巩固`,`强化反复被证明有用的理解。`],rem:[`模式发现`,`从跨任务证据中提出长期模式。`]},en:{light:[`Quick consolidation`,`Organizes recently created memory signals.`],deep:[`Deep consolidation`,`Strengthens understanding that repeatedly proves useful.`],rem:[`Pattern discovery`,`Proposes long-term patterns from evidence across tasks.`]}};function nt({language:e}){let t=e===`zh`,{data:n,error:r,isLoading:i,mutate:a}=u(`/api/you/dreaming`,y),[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null);if(i)return(0,$.jsx)(Oe,{className:`h-64 rounded-2xl`});if(r||!n)return(0,$.jsx)(`div`,{className:`rounded-2xl border border-danger/25 bg-danger-soft p-5 text-sm text-danger`,children:t?`无法加载 Dreaming 状态`:`Could not load Dreaming status`});let p=t?{off:`关闭`,observe:`只观察`,review:`生成待确认建议`,automatic:`自动应用高置信结果`}:{off:`Off`,observe:`Observe only`,review:`Propose for review`,automatic:`Apply high-confidence results`},m=t?{insufficient_feedback:`还需要更多经过评价的回答`,low_helpful_rate:`记忆帮助率尚未达标`,high_record_error_rate:`记录错误率偏高`,sensitive_feedback_detected:`近期出现敏感信息反馈`,insufficient_dreaming_runs:`还需要更多稳定运行记录`,high_dreaming_failure_rate:`后台整理失败率偏高`}:{insufficient_feedback:`More evaluated responses are required`,low_helpful_rate:`Memory helpfulness is below the threshold`,high_record_error_rate:`Record error rate is too high`,sensitive_feedback_detected:`Recent sensitive-information feedback was detected`,insufficient_dreaming_runs:`More stable Dreaming runs are required`,high_dreaming_failure_rate:`Dreaming failure rate is too high`},h=async(e,t)=>{s(t);try{return await _e(e),await a(),!0}catch(e){return I({type:`error`,title:`Dreaming`,message:e instanceof Error?e.message:String(e)}),!1}finally{s(null)}},g=async e=>{s(`run:${e}`);try{await f(e),await a()}catch(e){I({type:`error`,title:`Dreaming`,message:e instanceof Error?e.message:String(e)})}finally{s(null)}},_=[...new Set([n.settings.timezone,...et])],b=tt[e];return(0,$.jsxs)(`div`,{id:`you-panel-dreaming`,role:`tabpanel`,"aria-labelledby":`you-tab-dreaming`,className:`space-y-6`,children:[(0,$.jsxs)(`section`,{children:[(0,$.jsxs)(`h2`,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[(0,$.jsx)(T,{className:`size-4 text-accent`,"aria-hidden":!0}),`Dreaming`]}),(0,$.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-6 text-fg-muted`,children:t?`在空闲时整理已有证据、发现模式,并用可审计的方式提出或应用长期理解。`:`Consolidates existing evidence during idle time, discovers patterns, and records every proposal or change.`})]}),(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-[minmax(0,1fr)_16rem]`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t?`运行模式`:`Operating mode`}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t?`当前生效:${p[n.config.mode]} · 写入级别:${n.config.writeDisposition}`:`Effective: ${p[n.config.mode]} · write disposition: ${n.config.writeDisposition}`})]}),(0,$.jsx)(d,{value:n.settings.mode,disabled:o!==null,onChange:e=>void h({...n.settings,mode:e.target.value},`mode`),children:Object.entries(p).map(([e,t])=>(0,$.jsx)(J,{value:e,children:t},e))})]}),n.settings.mode===`automatic`&&!n.readiness.ready?(0,$.jsxs)(`div`,{className:`mt-4 rounded-xl border border-warning/25 bg-warning-soft/35 px-4 py-3`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t?`自动写入暂时降级为待确认`:`Automatic writes are temporarily downgraded to review`}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n.readiness.reasons.map(e=>m[e]??e).join(t?`;`:`; `)})]}):null]}),(0,$.jsxs)(`section`,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,$.jsx)(re,{className:`size-4 text-fg-muted`}),t?`运行计划`:`Schedule`]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:Je(n.settings.timezone,e)})]}),(0,$.jsx)(`div`,{className:`w-full sm:w-64`,children:(0,$.jsx)(d,{value:n.settings.timezone,disabled:o!==null,onChange:e=>void h({...n.settings,timezone:e.target.value},`timezone`),children:_.map(t=>(0,$.jsx)(J,{value:t,children:Je(t,e)},t))})})]}),(0,$.jsx)(`div`,{className:`mt-3 grid gap-3 lg:grid-cols-3`,children:[`light`,`deep`,`rem`].map(r=>{let i=n.settings.phases[r],a=n.config.phases[r],[s,c]=b[r],u=i.enabled&&n.config.enabled;return(0,$.jsxs)(`article`,{className:`flex min-h-52 flex-col rounded-2xl border border-edge bg-surface-panel p-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-wide text-accent`,children:r}),(0,$.jsx)(`h4`,{className:`mt-1 text-sm font-semibold text-fg`,children:s})]}),(0,$.jsx)(`span`,{className:u?`text-xs text-success`:`text-xs text-fg-subtle`,children:u?t?`已启用`:`Enabled`:i.enabled?t?`随模式暂停`:`Paused by mode`:t?`已暂停`:`Paused`})]}),(0,$.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:c}),(0,$.jsxs)(`div`,{className:`mt-4 rounded-xl bg-surface-muted px-3 py-3`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:Ke(i.schedule,e)}),(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[t?`下次运行:`:`Next run: `,u?qe(a.nextRunsAt[0],e,n.settings.timezone):t?`已暂停`:`Paused`]})]}),(0,$.jsxs)(`div`,{className:`mt-auto flex gap-2 pt-4`,children:[(0,$.jsxs)(v,{type:`button`,variant:`secondary`,className:`flex-1`,disabled:o!==null,onClick:()=>l(r),children:[(0,$.jsx)(le,{className:`size-3.5`}),t?`编辑计划`:`Edit`]}),(0,$.jsxs)(v,{type:`button`,variant:`ghost`,className:`flex-1`,disabled:!n.config.enabled||o!==null,onClick:()=>void g(r),children:[(0,$.jsx)(j,{className:`size-3.5`}),t?`立即运行`:`Run now`]})]})]},r)})})]}),(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t?`最近运行`:`Recent runs`}),n.runs.length?(0,$.jsx)(`div`,{className:`mt-3 divide-y divide-edge overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:n.runs.map(t=>(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 px-4 py-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`p`,{className:`text-sm font-medium uppercase text-fg`,children:[t.phase,` · `,t.mode]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.reason??t.status})]}),(0,$.jsxs)(`div`,{className:`text-right text-xs text-fg-subtle`,children:[(0,$.jsx)(`p`,{children:t.status}),(0,$.jsx)(`p`,{children:Te(Date.parse(t.startedAt),e)})]})]},t.runId))}):(0,$.jsx)(`p`,{className:`mt-3 rounded-xl bg-surface-muted px-4 py-3 text-sm text-fg-muted`,children:t?`还没有运行记录。`:`No runs yet.`})]}),c?(0,$.jsx)(Ze,{open:!0,phase:c,value:n.settings.phases[c],language:e,saving:o===`schedule:${c}`,onOpenChange:e=>{e||l(null)},onSave:async e=>{await h({...n.settings,phases:{...n.settings.phases,[c]:e}},`schedule:${c}`)&&l(null)}}):null]})}function rt(e){let t=(0,Ve.c)(33),{source:n,language:r,busy:i,onOpenChange:a,onConfirm:o}=e,l=c(r).you,[u,d]=(0,Q.useState)(`keep`),f=n?.accountLabel??(n?.accountCount&&n.accountCount>1&&n.accountOrdinal?l.sourceAccountFallback.replace(`{{index}}`,String(n.accountOrdinal)).replace(`{{count}}`,String(n.accountCount)):void 0),g,_;t[0]===n?(g=t[1],_=t[2]):(g=()=>{n&&d(`keep`)},_=[n],t[0]=n,t[1]=g,t[2]=_),(0,Q.useEffect)(g,_);let y;t[3]!==i||t[4]!==a?(y=e=>!i&&a(e),t[3]=i,t[4]=a,t[5]=y):y=t[5];let x;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(m,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[6]=x):x=t[6];let C;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(ue,{className:`size-4`,"aria-hidden":!0}),t[7]=C):C=t[7];let w;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(w=()=>d(`keep`),t[8]=w):w=t[8];let T=u===`keep`?`border-accent/40 bg-accent-soft/35`:`border-edge-subtle hover:bg-surface-hover`,D;t[9]===T?D=t[10]:(D=s(`flex w-full items-start gap-3 rounded-xl border p-4 text-left`,T),t[9]=T,t[10]=D);let O;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,$.jsx)(p,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[11]=O):O=t[11];let A;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(A=()=>d(`delete`),t[12]=A):A=t[12];let j=u===`delete`?`border-danger/40 bg-danger-soft`:`border-edge-subtle hover:bg-surface-hover`,N;t[13]===j?N=t[14]:(N=s(`flex w-full items-start gap-3 rounded-xl border p-4 text-left disabled:cursor-not-allowed disabled:opacity-55`,j),t[13]=j,t[14]=N);let F;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,$.jsx)(M,{className:`mt-0.5 size-4 shrink-0 text-danger`,"aria-hidden":!0}),t[15]=F):F=t[15];let I=l.disconnectDeleteBody.replace(`{{count}}`,String(n?.derivedUnderstandingCount??0)),L;t[16]===I?L=t[17]:(L=(0,$.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:I}),t[16]=I,t[17]=L);let R;t[18]!==i||t[19]!==l.cancel?(R=(0,$.jsx)(E,{asChild:!0,children:(0,$.jsx)(v,{type:`button`,variant:`ghost`,disabled:i,children:l.cancel})}),t[18]=i,t[19]=l.cancel,t[20]=R):R=t[20];let z=u===`delete`?`border-danger/35 text-danger hover:bg-danger-soft`:void 0,B;t[21]!==o||t[22]!==u?(B=()=>o(u),t[21]=o,t[22]=u,t[23]=B):B=t[23];let V;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,$.jsx)(h,{className:`size-4`,"aria-hidden":!0}),t[24]=V):V=t[24];let H=i?l.disconnecting:l.disconnectAction,U;t[25]!==i||t[26]!==z||t[27]!==B||t[28]!==H?(U=(0,$.jsxs)(v,{type:`button`,variant:`secondary`,className:z,disabled:i,onClick:B,children:[V,H]}),t[25]=i,t[26]=z,t[27]=B,t[28]=H,t[29]=U):U=t[29];let W;return t[30]!==R||t[31]!==U?(W=(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle px-5 py-4`,children:[R,U]}),t[30]=R,t[31]=U,t[32]=W):W=t[32],(0,$.jsx)(S,{open:n!==null,onOpenChange:y,children:(0,$.jsxs)(P,{children:[x,(0,$.jsxs)(k,{className:`fixed left-1/2 top-1/2 z-[131] flex h-[min(31rem,calc(100dvh-2rem))] w-[min(32rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-elevated`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-5 py-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(b,{className:`text-base font-semibold text-fg`,children:l.disconnectTitle}),(0,$.jsx)(Ne,{className:`mt-1 text-sm text-fg-muted`,children:l.disconnectBody.replace(`{{source}}`,n?.displayName??``)})]}),(0,$.jsx)(E,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":l.cancel,disabled:i,children:C})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-3 overflow-y-auto p-5`,children:[(0,$.jsxs)(`div`,{className:`rounded-xl bg-surface-muted px-4 py-3 text-xs leading-5 text-fg-muted`,children:[f?(0,$.jsx)(`p`,{className:`font-medium text-fg`,children:l.disconnectAccount.replace(`{{account}}`,f)}):null,(0,$.jsx)(`p`,{children:l.disconnectImpact.replace(`{{items}}`,String(n?.knowledgeItemCount??0)).replace(`{{understandings}}`,String(n?.derivedUnderstandingCount??0))})]}),(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":u===`keep`,onClick:w,className:D,children:[O,(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:l.disconnectKeepTitle}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:l.disconnectKeepBody})]})]}),(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":u===`delete`,onClick:A,disabled:!n?.derivedUnderstandingCount,className:N,children:[F,(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:l.disconnectDeleteTitle}),L]})]})]}),W]})]})})}var it={"composio-gmail":`gmail`,"composio-googledrive":`google-drive`,"composio-notion":`notion`,"composio-slack":`slack`,memory:`memory`};function at(e){if(e.branding?.logoUrl)return e.branding;let t=it[e.id];return t?{...e.branding,logoUrl:`/connector-icons/${t}.svg`}:e.branding}function ot(e,t){return Object.entries(t).reduce((e,[t,n])=>e.replace(`{{${t}}}`,String(n)),e)}function st(e){return e.status===`active`||e.status===`connected`}function ct(e,t){return!st(e)||e.learning?.status===`failed`||e.lastSyncStatus===`failed`?{summary:t.sourceNeedsAttention,tone:`attention`,badge:t.attentionTitle}:e.learning?.status===`paused`?{summary:t.sourcePausedSummary,tone:`paused`,badge:t.paused}:e.learning?.status===`queued`||e.learning?.status===`running`?{summary:t.sourceReading,tone:`learning`}:e.learningFunnel.provisionalClaims>0?{summary:ot(t.sourcePendingReview,{count:e.learningFunnel.provisionalClaims}),tone:`review`}:e.learningFunnel.activeClaims>0?{summary:ot(t.sourceReliable,{count:e.learningFunnel.activeClaims}),tone:`useful`}:e.learningFunnel.attributedItems>0?{summary:ot(t.sourceStillLearning,{count:e.learningFunnel.attributedItems}),tone:`learning`}:e.learningFunnel.indexedItems>0?{summary:ot(t.sourceNoPersonalSignal,{count:e.learningFunnel.indexedItems}),tone:`neutral`}:e.learning?.status===`completed`?{summary:t.sourceNoRecentSignal,tone:`neutral`}:{summary:t.sourcePreparing,tone:`learning`}}function lt(e,t){let n=e.id.toLocaleLowerCase();return/(github|gitlab|linear|jira)/.test(n)?t.sourcePurposeWork:/(gmail|outlook|slack|teams)/.test(n)?t.sourcePurposeCommunication:/calendar/.test(n)?t.sourcePurposeSchedule:/(docs|drive|notion|sheets|excel|onedrive|one-drive|local-files)/.test(n)?t.sourcePurposeDocuments:t.sourcePurposeDefault}function ut(e,t){return e.accountLabel?e.accountLabel:e.accountCount&&e.accountCount>1&&e.accountOrdinal?ot(t.sourceAccountFallback,{index:e.accountOrdinal,count:e.accountCount}):t.sourceUnknownAccount}function dt(e){return e.lastSyncAt??e.learning?.updatedAt??e.lastActivityAt??e.lastConnectedAt}function ft(e,t){let n=Date.parse(e);return Number.isFinite(n)?Te(n,t):e}function pt(e,t){return{attention:0,learning:1,review:2,useful:3,paused:4,neutral:5}[ct(e,t).tone]}function mt(e){let t=(0,Ve.c)(173),{source:n,language:r,t:i,busy:a,onOpenChange:o,onLearn:c,onPause:l,onConfigure:u,onDisconnect:d,onViewUnderstanding:f}=e;if(!n)return null;let p;t[0]!==n||t[1]!==i?(p=ct(n,i),t[0]=n,t[1]=i,t[2]=p):p=t[2];let g=p,_,y,x,C,w,T,D,O,A,j,M,N,F,I,L,R;if(t[3]!==r||t[4]!==o||t[5]!==f||t[6]!==g.summary||t[7]!==g.tone||t[8]!==n||t[9]!==i){let e=dt(n);C=n.learning?.status===`paused`,w=g.tone===`attention`,x=S,D=!0,O=o,y=P,t[26]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(m,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[26]=T):T=t[26],_=k,L=`fixed inset-y-0 right-0 z-[131] flex h-dvh w-[min(34rem,100vw)] flex-col overflow-hidden border-l border-edge bg-surface-panel shadow-elevated`;let a=n.displayName,c;t[27]===n?c=t[28]:(c=at(n),t[27]=n,t[28]=c);let l;t[29]!==n.displayName||t[30]!==c?(l=(0,$.jsx)(Be,{connector:{displayName:a,branding:c},size:`sm`}),t[29]=n.displayName,t[30]=c,t[31]=l):l=t[31];let u;t[32]===n.displayName?u=t[33]:(u=(0,$.jsx)(b,{className:`truncate text-base font-semibold text-fg`,children:n.displayName}),t[32]=n.displayName,t[33]=u);let d;t[34]!==n||t[35]!==i?(d=ut(n,i),t[34]=n,t[35]=i,t[36]=d):d=t[36];let p;t[37]===d?p=t[38]:(p=(0,$.jsx)(Ne,{className:`mt-0.5 truncate text-sm text-fg-muted`,children:d}),t[37]=d,t[38]=p);let h;t[39]!==u||t[40]!==p?(h=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[u,p]}),t[39]=u,t[40]=p,t[41]=h):h=t[41];let B;t[42]!==l||t[43]!==h?(B=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[l,h]}),t[42]=l,t[43]=h,t[44]=B):B=t[44];let V;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,$.jsx)(ue,{className:`size-4`,"aria-hidden":!0}),t[45]=V):V=t[45];let H;t[46]===i.close?H=t[47]:(H=(0,$.jsx)(E,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":i.close,children:V})}),t[46]=i.close,t[47]=H),t[48]!==B||t[49]!==H?(R=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-5 py-4`,children:[B,H]}),t[48]=B,t[49]=H,t[50]=R):R=t[50],F=`min-h-0 flex-1 space-y-5 overflow-y-auto p-5`;let U;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,$.jsx)(me,{className:`size-4 text-accent`,"aria-hidden":!0}),t[51]=U):U=t[51];let W;t[52]===i.sourceTaskTitle?W=t[53]:(W=(0,$.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[U,i.sourceTaskTitle]}),t[52]=i.sourceTaskTitle,t[53]=W);let G=g.tone===`attention`?`border-warning/30 bg-warning-soft text-fg`:`border-edge-subtle bg-surface-muted text-fg`,ee;t[54]===G?ee=t[55]:(ee=s(`mt-3 rounded-xl border px-4 py-3 text-sm leading-6`,G),t[54]=G,t[55]=ee);let K;t[56]!==g.summary||t[57]!==ee?(K=(0,$.jsx)(`p`,{className:ee,children:g.summary}),t[56]=g.summary,t[57]=ee,t[58]=K):K=t[58];let q;t[59]===n.learningFunnel.activeClaims?q=t[60]:(q=(0,$.jsx)(`strong`,{className:`text-xl font-semibold text-fg`,children:n.learningFunnel.activeClaims}),t[59]=n.learningFunnel.activeClaims,t[60]=q);let te;t[61]===i.sourceReliableMetric?te=t[62]:(te=(0,$.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:i.sourceReliableMetric}),t[61]=i.sourceReliableMetric,t[62]=te);let ne;t[63]!==q||t[64]!==te?(ne=(0,$.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-base px-4 py-3`,children:[q,te]}),t[63]=q,t[64]=te,t[65]=ne):ne=t[65];let J;t[66]===n.learningFunnel.provisionalClaims?J=t[67]:(J=(0,$.jsx)(`strong`,{className:`text-xl font-semibold text-fg`,children:n.learningFunnel.provisionalClaims}),t[66]=n.learningFunnel.provisionalClaims,t[67]=J);let Y;t[68]===i.sourcePendingMetric?Y=t[69]:(Y=(0,$.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:i.sourcePendingMetric}),t[68]=i.sourcePendingMetric,t[69]=Y);let X;t[70]!==J||t[71]!==Y?(X=(0,$.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-base px-4 py-3`,children:[J,Y]}),t[70]=J,t[71]=Y,t[72]=X):X=t[72];let re;t[73]!==ne||t[74]!==X?(re=(0,$.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 gap-3`,children:[ne,X]}),t[73]=ne,t[74]=X,t[75]=re):re=t[75];let ie;t[76]!==f||t[77]!==n.learningFunnel.activeClaims||t[78]!==n.learningFunnel.provisionalClaims||t[79]!==i.sourceViewUnderstanding?(ie=n.learningFunnel.activeClaims>0||n.learningFunnel.provisionalClaims>0?(0,$.jsxs)(v,{type:`button`,variant:`ghost`,className:`mt-2 px-2`,onClick:f,children:[i.sourceViewUnderstanding,(0,$.jsx)(fe,{className:`size-4`,"aria-hidden":!0})]}):null,t[76]=f,t[77]=n.learningFunnel.activeClaims,t[78]=n.learningFunnel.provisionalClaims,t[79]=i.sourceViewUnderstanding,t[80]=ie):ie=t[80],t[81]!==W||t[82]!==K||t[83]!==re||t[84]!==ie?(I=(0,$.jsxs)(`section`,{children:[W,K,re,ie]}),t[81]=W,t[82]=K,t[83]=re,t[84]=ie,t[85]=I):I=t[85],A=`border-t border-edge-subtle pt-5`;let ae;t[86]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,$.jsx)(z,{className:`size-4 text-accent`,"aria-hidden":!0}),t[86]=ae):ae=t[86],t[87]===i.sourceRecentRunTitle?j=t[88]:(j=(0,$.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[ae,i.sourceRecentRunTitle]}),t[87]=i.sourceRecentRunTitle,t[88]=j);let Z;t[89]!==n.learningFunnel.activeClaims||t[90]!==n.learningFunnel.attributedItems||t[91]!==n.learningFunnel.indexedItems||t[92]!==i.sourceRecentRunSummary?(Z=ot(i.sourceRecentRunSummary,{indexed:n.learningFunnel.indexedItems,attributed:n.learningFunnel.attributedItems,claims:n.learningFunnel.activeClaims}),t[89]=n.learningFunnel.activeClaims,t[90]=n.learningFunnel.attributedItems,t[91]=n.learningFunnel.indexedItems,t[92]=i.sourceRecentRunSummary,t[93]=Z):Z=t[93],t[94]===Z?M=t[95]:(M=(0,$.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:Z}),t[94]=Z,t[95]=M),N=e?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:ot(i.sourceUpdatedAt,{time:ft(e,r)})}):null,t[3]=r,t[4]=o,t[5]=f,t[6]=g.summary,t[7]=g.tone,t[8]=n,t[9]=i,t[10]=_,t[11]=y,t[12]=x,t[13]=C,t[14]=w,t[15]=T,t[16]=D,t[17]=O,t[18]=A,t[19]=j,t[20]=M,t[21]=N,t[22]=F,t[23]=I,t[24]=L,t[25]=R}else _=t[10],y=t[11],x=t[12],C=t[13],w=t[14],T=t[15],D=t[16],O=t[17],A=t[18],j=t[19],M=t[20],N=t[21],F=t[22],I=t[23],L=t[24],R=t[25];let B;t[96]!==A||t[97]!==j||t[98]!==M||t[99]!==N?(B=(0,$.jsxs)(`section`,{className:A,children:[j,M,N]}),t[96]=A,t[97]=j,t[98]=M,t[99]=N,t[100]=B):B=t[100];let V;t[101]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,$.jsx)(ye,{className:`size-4 text-accent`,"aria-hidden":!0}),t[101]=V):V=t[101];let H;t[102]===i.sourceAccessTitle?H=t[103]:(H=(0,$.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[V,i.sourceAccessTitle]}),t[102]=i.sourceAccessTitle,t[103]=H);let U;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,$.jsx)(Se,{className:`mt-1 size-4 shrink-0 text-success`,"aria-hidden":!0}),t[104]=U):U=t[104];let W;t[105]===i.sourceReadAccess?W=t[106]:(W=(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[U,(0,$.jsx)(`span`,{children:i.sourceReadAccess})]}),t[105]=i.sourceReadAccess,t[106]=W);let G;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,$.jsx)(Se,{className:`mt-1 size-4 shrink-0 text-success`,"aria-hidden":!0}),t[107]=G):G=t[107];let K;t[108]===i.sourceMemoryAccess?K=t[109]:(K=(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[G,(0,$.jsx)(`span`,{children:i.sourceMemoryAccess})]}),t[108]=i.sourceMemoryAccess,t[109]=K);let q;t[110]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,$.jsx)(ye,{className:`mt-1 size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[110]=q):q=t[110];let te=n.access.write?i.sourceWriteAccess:i.sourceNoWriteAccess,ne;t[111]===te?ne=t[112]:(ne=(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[q,(0,$.jsx)(`span`,{children:te})]}),t[111]=te,t[112]=ne);let J;t[113]!==W||t[114]!==K||t[115]!==ne?(J=(0,$.jsxs)(`ul`,{className:`mt-3 space-y-2 text-sm leading-6 text-fg-muted`,children:[W,K,ne]}),t[113]=W,t[114]=K,t[115]=ne,t[116]=J):J=t[116];let Y;t[117]!==H||t[118]!==J?(Y=(0,$.jsxs)(`section`,{className:`border-t border-edge-subtle pt-5`,children:[H,J]}),t[117]=H,t[118]=J,t[119]=Y):Y=t[119];let X;t[120]!==B||t[121]!==Y||t[122]!==F||t[123]!==I?(X=(0,$.jsxs)(`div`,{className:F,children:[I,B,Y]}),t[120]=B,t[121]=Y,t[122]=F,t[123]=I,t[124]=X):X=t[124];let re;t[125]===i.sourceManagementTitle?re=t[126]:(re=(0,$.jsx)(`p`,{className:`mb-2 px-1 text-xs font-medium text-fg-subtle`,children:i.sourceManagementTitle}),t[125]=i.sourceManagementTitle,t[126]=re);let ae;t[127]!==a||t[128]!==C||t[129]!==w||t[130]!==c||t[131]!==l||t[132]!==n||t[133]!==i.sourcePauseLearning||t[134]!==i.sourceResumeLearning||t[135]!==i.sourceRetryLearning?(ae=st(n)?C||w?(0,$.jsxs)(v,{type:`button`,variant:`secondary`,disabled:a,onClick:()=>c(n),children:[a?(0,$.jsx)(ie,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,$.jsx)(he,{className:`size-4`,"aria-hidden":!0}),w?i.sourceRetryLearning:i.sourceResumeLearning]}):(0,$.jsxs)(v,{type:`button`,variant:`secondary`,disabled:a,onClick:()=>l(n),children:[(0,$.jsx)(ce,{className:`size-4`,"aria-hidden":!0}),i.sourcePauseLearning]}):null,t[127]=a,t[128]=C,t[129]=w,t[130]=c,t[131]=l,t[132]=n,t[133]=i.sourcePauseLearning,t[134]=i.sourceResumeLearning,t[135]=i.sourceRetryLearning,t[136]=ae):ae=t[136];let Z;t[137]!==u||t[138]!==n?(Z=()=>u(n),t[137]=u,t[138]=n,t[139]=Z):Z=t[139];let oe;t[140]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,$.jsx)(ee,{className:`size-4`,"aria-hidden":!0}),t[140]=oe):oe=t[140];let se;t[141]!==i.sourceConnectionSettings||t[142]!==Z?(se=(0,$.jsxs)(v,{type:`button`,variant:`secondary`,onClick:Z,children:[oe,i.sourceConnectionSettings]}),t[141]=i.sourceConnectionSettings,t[142]=Z,t[143]=se):se=t[143];let le;t[144]!==d||t[145]!==n?(le=()=>d(n),t[144]=d,t[145]=n,t[146]=le):le=t[146];let de;t[147]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,$.jsx)(h,{className:`size-4`,"aria-hidden":!0}),t[147]=de):de=t[147];let pe;t[148]!==i.disconnect||t[149]!==le?(pe=(0,$.jsxs)(v,{type:`button`,variant:`ghost`,className:`ml-auto text-danger hover:bg-danger-soft hover:text-danger`,onClick:le,children:[de,i.disconnect]}),t[148]=i.disconnect,t[149]=le,t[150]=pe):pe=t[150];let ge;t[151]!==ae||t[152]!==se||t[153]!==pe?(ge=(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[ae,se,pe]}),t[151]=ae,t[152]=se,t[153]=pe,t[154]=ge):ge=t[154];let _e;t[155]!==re||t[156]!==ge?(_e=(0,$.jsxs)(`div`,{className:`shrink-0 border-t border-edge-subtle p-4`,children:[re,ge]}),t[155]=re,t[156]=ge,t[157]=_e):_e=t[157];let ve;t[158]!==_||t[159]!==X||t[160]!==_e||t[161]!==L||t[162]!==R?(ve=(0,$.jsxs)(_,{className:L,children:[R,X,_e]}),t[158]=_,t[159]=X,t[160]=_e,t[161]=L,t[162]=R,t[163]=ve):ve=t[163];let be;t[164]!==y||t[165]!==T||t[166]!==ve?(be=(0,$.jsxs)(y,{children:[T,ve]}),t[164]=y,t[165]=T,t[166]=ve,t[167]=be):be=t[167];let xe;return t[168]!==x||t[169]!==D||t[170]!==O||t[171]!==be?(xe=(0,$.jsx)(x,{open:D,onOpenChange:O,children:be}),t[168]=x,t[169]=D,t[170]=O,t[171]=be,t[172]=xe):xe=t[172],xe}function ht(e){let t=(0,Ve.c)(77),{sources:n,recommendations:r,language:i,t:a,busyId:o,onAddSource:c,onConnectRecommendation:l,onLearn:u,onPause:d,onConfigure:f,onDisconnect:p,onViewUnderstanding:m}=e,[h,g]=(0,Q.useState)(null),y;if(t[0]!==n||t[1]!==a){let e=n.filter(_t),r=new Map;for(let t of e){let e=r.get(t.id)??[];e.push(t),r.set(t.id,e)}let i;t[3]===a?i=t[4]:(i=(e,t)=>Math.min(...e.accounts.map(e=>pt(e,a)))-Math.min(...t.accounts.map(e=>pt(e,a)))||e.source.displayName.localeCompare(t.source.displayName),t[3]=a,t[4]=i),y=[...r.values()].map(e=>({source:e[0],accounts:e.sort((e,t)=>pt(e,a)-pt(t,a)||ut(e,a).localeCompare(ut(t,a)))})).sort(i),t[0]=n,t[1]=a,t[2]=y}else y=t[2];let b=y,x,S,C,w,T,E,D,O,k;if(t[5]!==b||t[6]!==h||t[7]!==n||t[8]!==a.sourceConnectedSummary||t[9]!==a.sourcesSubtitle||t[10]!==a.sourcesTitle){let e=b.reduce(gt,0),r;t[20]!==h||t[21]!==n?(r=h?n.find(e=>e.instanceId===h)??null:null,t[20]=h,t[21]=n,t[22]=r):r=t[22],x=r,E=`you-panel-sources`,D=`tabpanel`,O=`you-tab-sources`,k=`space-y-5`,T=`flex flex-wrap items-start justify-between gap-3`,t[23]===a.sourcesTitle?S=t[24]:(S=(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:a.sourcesTitle}),t[23]=a.sourcesTitle,t[24]=S),t[25]===a.sourcesSubtitle?C=t[26]:(C=(0,$.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-6 text-fg-muted`,children:a.sourcesSubtitle}),t[25]=a.sourcesSubtitle,t[26]=C),w=b.length>0?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:ot(a.sourceConnectedSummary,{accounts:e,sources:b.length})}):null,t[5]=b,t[6]=h,t[7]=n,t[8]=a.sourceConnectedSummary,t[9]=a.sourcesSubtitle,t[10]=a.sourcesTitle,t[11]=x,t[12]=S,t[13]=C,t[14]=w,t[15]=T,t[16]=E,t[17]=D,t[18]=O,t[19]=k}else x=t[11],S=t[12],C=t[13],w=t[14],T=t[15],E=t[16],D=t[17],O=t[18],k=t[19];let A;t[27]!==S||t[28]!==C||t[29]!==w?(A=(0,$.jsxs)(`div`,{children:[S,C,w]}),t[27]=S,t[28]=C,t[29]=w,t[30]=A):A=t[30];let j;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,$.jsx)(_,{className:`size-4`,"aria-hidden":!0}),t[31]=j):j=t[31];let M;t[32]!==c||t[33]!==a.addSource?(M=(0,$.jsxs)(v,{type:`button`,variant:`primary`,onClick:c,children:[j,a.addSource]}),t[32]=c,t[33]=a.addSource,t[34]=M):M=t[34];let N;t[35]!==A||t[36]!==M||t[37]!==T?(N=(0,$.jsxs)(`div`,{className:T,children:[A,M]}),t[35]=A,t[36]=M,t[37]=T,t[38]=N):N=t[38];let P;t[39]!==l||t[40]!==r||t[41]!==a.connectRecommendedSource||t[42]!==a.permissionsBeforeConnectBadge||t[43]!==a.recommendationReason||t[44]!==a.recommendationsTitle?(P=r.length>0?(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.recommendationsTitle}),(0,$.jsx)(`div`,{className:`mt-3 grid gap-3 lg:grid-cols-3`,children:r.map(e=>(0,$.jsxs)(`article`,{className:`rounded-xl border border-accent/20 bg-accent-soft/20 p-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.jsx)(he,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h4`,{className:`truncate text-sm font-semibold text-fg`,children:e.sourceName}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:a.recommendationReason.replace(`{{goal}}`,e.taskTitle)})]})]}),(0,$.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`text-[11px] text-fg-subtle`,children:a.permissionsBeforeConnectBadge}),(0,$.jsx)(v,{type:`button`,variant:`secondary`,className:`h-8 px-2.5`,onClick:()=>l(e.sourceId),children:a.connectRecommendedSource})]})]},e.sourceId))})]}):null,t[39]=l,t[40]=r,t[41]=a.connectRecommendedSource,t[42]=a.permissionsBeforeConnectBadge,t[43]=a.recommendationReason,t[44]=a.recommendationsTitle,t[45]=P):P=t[45];let F;t[46]!==b||t[47]!==i||t[48]!==c||t[49]!==a?(F=b.length>0?(0,$.jsx)(`div`,{className:`space-y-3`,children:b.map(e=>{let{source:t,accounts:n}=e;return(0,$.jsxs)(`section`,{className:`overflow-hidden rounded-2xl border border-edge-subtle bg-surface-base`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3 border-b border-edge-subtle px-4 py-3.5 sm:px-5`,children:[(0,$.jsx)(Be,{connector:{displayName:t.displayName,branding:at(t)},size:`sm`}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.displayName}),n.length>1?(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:ot(a.sourceAccountCount,{count:n.length})}):null]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:lt(t,a)})]})]}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:n.map(e=>{let t=ct(e,a),n=dt(e);return(0,$.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-3 px-4 py-3.5 text-left transition-colors hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/40 sm:px-5`,onClick:()=>g(e.instanceId??null),children:[(0,$.jsx)(`span`,{className:s(`size-2 shrink-0 rounded-full`,t.tone===`attention`?`bg-warning`:t.tone===`useful`?`bg-success`:t.tone===`learning`?`bg-accent`:`bg-fg-subtle/50`),"aria-hidden":!0}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:ut(e,a)}),t.badge?(0,$.jsx)(`span`,{className:s(`rounded-full px-2 py-0.5 text-[11px] font-medium`,t.tone===`attention`?`bg-warning-soft text-fg`:`bg-surface-muted text-fg-muted`),children:t.badge}):null]}),(0,$.jsx)(`span`,{className:s(`mt-1 block text-xs leading-5`,t.tone===`attention`?`text-fg`:`text-fg-muted`),children:t.summary})]}),n?(0,$.jsx)(`span`,{className:`hidden shrink-0 text-xs text-fg-subtle sm:block`,children:ot(a.sourceUpdatedAt,{time:ft(n,i)})}):null,(0,$.jsx)(fe,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0})]},e.instanceId)})})]},t.id)})}):(0,$.jsxs)(`div`,{className:`rounded-2xl border border-dashed border-edge p-10 text-center`,children:[(0,$.jsx)(q,{className:`mx-auto size-5 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:a.noSources}),(0,$.jsxs)(v,{type:`button`,variant:`secondary`,className:`mt-4`,onClick:c,children:[(0,$.jsx)(_,{className:`size-4`,"aria-hidden":!0}),a.addSource]})]}),t[46]=b,t[47]=i,t[48]=c,t[49]=a,t[50]=F):F=t[50];let I=x?o===`source-learning:${x.instanceId}`:!1,L;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(L=e=>{e||g(null)},t[51]=L):L=t[51];let R;t[52]===f?R=t[53]:(R=e=>{g(null),f(e)},t[52]=f,t[53]=R);let z;t[54]===p?z=t[55]:(z=e=>{g(null),p(e)},t[54]=p,t[55]=z);let B;t[56]===m?B=t[57]:(B=()=>{g(null),m()},t[56]=m,t[57]=B);let V;t[58]!==i||t[59]!==u||t[60]!==d||t[61]!==x||t[62]!==a||t[63]!==I||t[64]!==R||t[65]!==z||t[66]!==B?(V=(0,$.jsx)(mt,{source:x,language:i,t:a,busy:I,onOpenChange:L,onLearn:u,onPause:d,onConfigure:R,onDisconnect:z,onViewUnderstanding:B}),t[58]=i,t[59]=u,t[60]=d,t[61]=x,t[62]=a,t[63]=I,t[64]=R,t[65]=z,t[66]=B,t[67]=V):V=t[67];let H;return t[68]!==N||t[69]!==P||t[70]!==F||t[71]!==V||t[72]!==E||t[73]!==D||t[74]!==O||t[75]!==k?(H=(0,$.jsxs)(`div`,{id:E,role:D,"aria-labelledby":O,className:k,children:[N,P,F,V]}),t[68]=N,t[69]=P,t[70]=F,t[71]=V,t[72]=E,t[73]=D,t[74]=O,t[75]=k,t[76]=H):H=t[76],H}function gt(e,t){return e+t.accounts.length}function _t(e){return e.installed}var vt=new Set([`overview`,`memory`,`collaboration`,`sources`,`dreaming`,`privacy`]);function yt(e){return e&&vt.has(e)?e:`overview`}var bt=[`collaboration`,`priorities`,`boundaries`,`people`,`current`,`basics`],xt=[`relationship`,`routine`,`long_term_goal`],St=`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent/50 focus:ring-2 focus:ring-accent/20`;function Ct(e,t){return e.replace(`{{count}}`,String(t))}function wt(e){let t=(0,Ve.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`span`,{className:`inline-flex rounded-full bg-surface-muted px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=r),r}function Tt(e,t){let n=Date.parse(e);return Number.isFinite(n)?Te(n,t):e}function Et(){let e=(0,Ve.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(Oe,{className:`h-24 rounded-2xl`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsxs)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[t,(0,$.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,$.jsx)(Oe,{className:`h-64 rounded-2xl`}),(0,$.jsx)(Oe,{className:`h-64 rounded-2xl`})]})]}),e[1]=n):n=e[1],n}function Dt(e,t){return e.origin===`connected_source`?t.origins.connected_source.replace(`{{source}}`,e.sourceName):t.origins[e.origin]}function Ot(e){let t=(0,Ve.c)(19),{item:n,language:r,t:i,busy:a,onConfirm:c,onReject:l,onUpdate:u,onForget:d}=e,[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(n.statement),[g,_]=(0,Q.useState)(null),[y,b]=(0,Q.useState)(!1),x=n.status!==`active`,S=x?`border-warning/35 bg-warning-soft/35`:`border-edge-subtle bg-surface-panel`,C;t[0]===S?C=t[1]:(C=s(`rounded-xl border p-3.5`,S),t[0]=S,t[1]=C);let T;t[2]!==a||t[3]!==m||t[4]!==f||t[5]!==g||t[6]!==y||t[7]!==n||t[8]!==r||t[9]!==x||t[10]!==c||t[11]!==d||t[12]!==l||t[13]!==u||t[14]!==i?(T=f?(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(`textarea`,{className:s(St,`min-h-20 resize-y`),value:m,onChange:e=>h(e.target.value),placeholder:i.updatePlaceholder}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,$.jsx)(v,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>{h(n.statement),p(!1)},children:i.cancel}),(0,$.jsx)(v,{type:`button`,variant:`primary`,className:`h-8 px-2`,disabled:a||!m.trim(),onClick:()=>{u(m.trim()),p(!1)},children:i.save})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:n.statement}),(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,$.jsx)(he,{className:`size-3 text-accent`,"aria-hidden":!0}),Dt(n,i)]}),(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5`,children:i.understandingScopes[n.scope.type]}),(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5`,children:i.stability[n.stability]}),n.evidenceCount>0?(0,$.jsx)(`span`,{children:Ct(i.evidenceCount,n.evidenceCount)}):null,n.latestEvidenceAt?(0,$.jsx)(`span`,{children:i.observedAt.replace(`{{time}}`,Tt(n.latestEvidenceAt,r))}):null]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[x?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(v,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:c,children:[(0,$.jsx)(o,{className:`size-3.5`,"aria-hidden":!0}),i.confirm]}),(0,$.jsxs)(v,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:l,children:[(0,$.jsx)(ue,{className:`size-3.5`,"aria-hidden":!0}),i.notTrue]})]}):null,(0,$.jsxs)(v,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:()=>p(!0),children:[(0,$.jsx)(le,{className:`size-3.5`,"aria-hidden":!0}),i.change]}),(0,$.jsxs)(v,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:y,onClick:()=>{if(g){_(null);return}b(!0),w(n.id).then(e=>_(e.history)).finally(()=>b(!1))},children:[(0,$.jsx)(Z,{className:`size-3.5`,"aria-hidden":!0}),i.history]}),(0,$.jsxs)(v,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:d,children:[(0,$.jsx)(M,{className:`size-3.5`,"aria-hidden":!0}),i.forget]})]})]}),(0,$.jsxs)(`details`,{className:`mt-2 rounded-lg bg-surface-muted/70 px-3 py-2 text-xs text-fg-muted`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer font-medium text-fg-muted`,children:i.viewEvidence}),(0,$.jsxs)(`dl`,{className:`mt-2 grid gap-1.5 sm:grid-cols-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceSource}),(0,$.jsx)(`dd`,{className:`mt-0.5 break-all text-fg-muted`,children:n.sourceName})]}),n.sourcePath?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidencePath}),(0,$.jsx)(`dd`,{className:`mt-0.5 break-all text-fg-muted`,children:n.sourcePath})]}):null,(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceUpdated}),(0,$.jsx)(`dd`,{className:`mt-0.5 text-fg-muted`,children:Tt(n.updatedAt,r)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceSupport}),(0,$.jsx)(`dd`,{className:`mt-0.5 text-fg-muted`,children:Ct(i.evidenceCount,n.evidenceCount)})]}),n.evidenceBasis?(0,$.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceRule}),(0,$.jsx)(`dd`,{className:`mt-0.5 text-fg-muted`,children:i.evidenceRuleValue.replace(`{{events}}`,String(n.evidenceBasis.eventCount)).replace(`{{days}}`,String(n.evidenceBasis.activeDays)).replace(`{{window}}`,String(n.evidenceBasis.windowDays))})]}):null,n.confidence===void 0?null:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceConfidence}),(0,$.jsxs)(`dd`,{className:`mt-0.5 text-fg-muted`,children:[Math.round(n.confidence*100),`%`]})]}),n.validTo?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceValidUntil}),(0,$.jsx)(`dd`,{className:`mt-0.5 text-fg-muted`,children:Tt(n.validTo,r)})]}):null,n.expiresAt?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceExpires}),(0,$.jsx)(`dd`,{className:`mt-0.5 text-fg-muted`,children:Tt(n.expiresAt,r)})]}):null]})]}),g?(0,$.jsxs)(`div`,{className:`mt-2 space-y-2 border-t border-edge pt-2`,children:[(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:i.historyTitle}),g.map(e=>(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3 text-xs`,children:[(0,$.jsx)(`p`,{className:`min-w-0 text-fg-muted`,children:e.statement}),(0,$.jsx)(`span`,{className:`shrink-0 text-fg-subtle`,children:Tt(e.updatedAt,r)})]},e.id))]}):null]}),t[2]=a,t[3]=m,t[4]=f,t[5]=g,t[6]=y,t[7]=n,t[8]=r,t[9]=x,t[10]=c,t[11]=d,t[12]=l,t[13]=u,t[14]=i,t[15]=T):T=t[15];let E;return t[16]!==C||t[17]!==T?(E=(0,$.jsx)(`article`,{className:C,children:T}),t[16]=C,t[17]=T,t[18]=E):E=t[18],E}function kt(e){let t=(0,Ve.c)(86),{claim:n,language:r,t:i,busy:a,onDecision:c}=e,l=typeof n.value.label==`string`?n.value.label:``,u;if(t[0]!==n.class||t[1]!==n.value.hour||t[2]!==n.value.weekday||t[3]!==l||t[4]!==r||t[5]!==i.claimProject||t[6]!==i.claimRelationship||t[7]!==i.claimRoutine){let e=r===`zh`?[`周日`,`周一`,`周二`,`周三`,`周四`,`周五`,`周六`]:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`];u=n.class===`relationship`?i.claimRelationship.replace(`{{label}}`,l):n.class===`project`?i.claimProject.replace(`{{label}}`,l):i.claimRoutine.replace(`{{weekday}}`,e[Number(n.value.weekday)]??``).replace(`{{hour}}`,String(n.value.hour).padStart(2,`0`)),t[0]=n.class,t[1]=n.value.hour,t[2]=n.value.weekday,t[3]=l,t[4]=r,t[5]=i.claimProject,t[6]=i.claimRelationship,t[7]=i.claimRoutine,t[8]=u}else u=t[8];let d=u,f;t[9]===n.evidence?f=t[10]:(f=new Set(n.evidence.map(At)),t[9]=n.evidence,t[10]=f);let p;t[11]===f?p=t[12]:(p=[...f],t[11]=f,t[12]=p);let m=p,h=n.state===`provisional`||n.state===`stale`,g=h?`border-warning/35 bg-warning-soft/35`:`border-edge-subtle bg-surface-panel`,_;t[13]===g?_=t[14]:(_=s(`rounded-xl border p-3.5`,g),t[13]=g,t[14]=_);let y=i.claimClasses[n.class],b;t[15]===y?b=t[16]:(b=(0,$.jsx)(`span`,{className:`text-[11px] font-medium text-fg-subtle`,children:y}),t[15]=y,t[16]=b);let x;t[17]===d?x=t[18]:(x=(0,$.jsx)(`p`,{className:`mt-1 text-sm font-medium leading-6 text-fg`,children:d}),t[17]=d,t[18]=x);let S;t[19]!==b||t[20]!==x?(S=(0,$.jsxs)(`div`,{children:[b,x]}),t[19]=b,t[20]=x,t[21]=S):S=t[21];let C=i.claimStates[n.state],w;t[22]===C?w=t[23]:(w=(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-1 text-[11px] text-fg-muted`,children:C}),t[22]=C,t[23]=w);let T;t[24]!==w||t[25]!==S?(T=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[S,w]}),t[24]=w,t[25]=S,t[26]=T):T=t[26];let E;t[27]!==n.activeDayCount||t[28]!==n.independentEvidenceCount||t[29]!==i.claimEvidence?(E=i.claimEvidence.replace(`{{events}}`,String(n.independentEvidenceCount)).replace(`{{days}}`,String(n.activeDayCount)),t[27]=n.activeDayCount,t[28]=n.independentEvidenceCount,t[29]=i.claimEvidence,t[30]=E):E=t[30];let D;t[31]===E?D=t[32]:(D=(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:E}),t[31]=E,t[32]=D);let O;t[33]!==n.lastReinforcedAt||t[34]!==r||t[35]!==i.observedAt?(O=i.observedAt.replace(`{{time}}`,Tt(n.lastReinforcedAt,r)),t[33]=n.lastReinforcedAt,t[34]=r,t[35]=i.observedAt,t[36]=O):O=t[36];let k;t[37]===O?k=t[38]:(k=(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:O}),t[37]=O,t[38]=k);let A;t[39]!==a||t[40]!==h||t[41]!==c||t[42]!==i.confirm||t[43]!==i.notTrue?(A=h?(0,$.jsxs)(`div`,{className:`flex gap-1`,children:[(0,$.jsxs)(v,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:()=>c(`confirm`),children:[(0,$.jsx)(o,{className:`size-3.5`,"aria-hidden":!0}),i.confirm]}),(0,$.jsxs)(v,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:()=>c(`reject`),children:[(0,$.jsx)(ue,{className:`size-3.5`,"aria-hidden":!0}),i.notTrue]})]}):null,t[39]=a,t[40]=h,t[41]=c,t[42]=i.confirm,t[43]=i.notTrue,t[44]=A):A=t[44];let j;t[45]!==k||t[46]!==A?(j=(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-between gap-2`,children:[k,A]}),t[45]=k,t[46]=A,t[47]=j):j=t[47];let M;t[48]===i.viewEvidence?M=t[49]:(M=(0,$.jsx)(`summary`,{className:`cursor-pointer font-medium`,children:i.viewEvidence}),t[48]=i.viewEvidence,t[49]=M);let N;t[50]===i.evidenceSource?N=t[51]:(N=(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceSource}),t[50]=i.evidenceSource,t[51]=N);let P=m.join(`, `),F;t[52]===P?F=t[53]:(F=(0,$.jsx)(`dd`,{className:`mt-0.5 break-all`,children:P}),t[52]=P,t[53]=F);let I;t[54]!==N||t[55]!==F?(I=(0,$.jsxs)(`div`,{children:[N,F]}),t[54]=N,t[55]=F,t[56]=I):I=t[56];let L;t[57]===i.evidenceConfidence?L=t[58]:(L=(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceConfidence}),t[57]=i.evidenceConfidence,t[58]=L);let R;t[59]===n.confidence?R=t[60]:(R=Math.round(n.confidence*100),t[59]=n.confidence,t[60]=R);let z;t[61]===R?z=t[62]:(z=(0,$.jsxs)(`dd`,{className:`mt-0.5`,children:[R,`%`]}),t[61]=R,t[62]=z);let B;t[63]!==L||t[64]!==z?(B=(0,$.jsxs)(`div`,{children:[L,z]}),t[63]=L,t[64]=z,t[65]=B):B=t[65];let V;t[66]===i.evidenceRule?V=t[67]:(V=(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceRule}),t[66]=i.evidenceRule,t[67]=V);let H;t[68]===i.claimRule?H=t[69]:(H=(0,$.jsx)(`dd`,{className:`mt-0.5`,children:i.claimRule}),t[68]=i.claimRule,t[69]=H);let U;t[70]!==V||t[71]!==H?(U=(0,$.jsxs)(`div`,{className:`sm:col-span-2`,children:[V,H]}),t[70]=V,t[71]=H,t[72]=U):U=t[72];let W;t[73]!==I||t[74]!==B||t[75]!==U?(W=(0,$.jsxs)(`dl`,{className:`mt-2 grid gap-1.5 sm:grid-cols-2`,children:[I,B,U]}),t[73]=I,t[74]=B,t[75]=U,t[76]=W):W=t[76];let G;t[77]!==M||t[78]!==W?(G=(0,$.jsxs)(`details`,{className:`mt-2 rounded-lg bg-surface-muted/70 px-3 py-2 text-xs text-fg-muted`,children:[M,W]}),t[77]=M,t[78]=W,t[79]=G):G=t[79];let ee;return t[80]!==T||t[81]!==D||t[82]!==j||t[83]!==G||t[84]!==_?(ee=(0,$.jsxs)(`article`,{className:_,children:[T,D,j,G]}),t[80]=T,t[81]=D,t[82]=j,t[83]=G,t[84]=_,t[85]=ee):ee=t[85],ee}function At(e){return e.sourceInstanceId}function jt(e){let t=(0,Ve.c)(70),{playbook:n,busy:r,t:i,onToggleGroup:a,onCreate:o,onUpdate:c,onDelete:l,onRollback:u}=e,[f,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(``),y=n.enabled?`border-edge-subtle bg-surface-panel`:`border-edge-subtle bg-surface-muted`,b;t[0]===y?b=t[1]:(b=s(`rounded-xl border p-4`,y),t[0]=y,t[1]=b);let x=i.playbookNames[n.id],S;t[2]===x?S=t[3]:(S=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:x}),t[2]=x,t[3]=S);let C;t[4]!==n.rules||t[5]!==i.playbookRuleCount?(C=Ct(i.playbookRuleCount,n.rules.filter(Pt).length),t[4]=n.rules,t[5]=i.playbookRuleCount,t[6]=C):C=t[6];let w;t[7]===C?w=t[8]:(w=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:C}),t[7]=C,t[8]=w);let T;t[9]!==S||t[10]!==w?(T=(0,$.jsxs)(`div`,{children:[S,w]}),t[9]=S,t[10]=w,t[11]=T):T=t[11];let E=n.enabled?i.pausePlaybook:i.resumePlaybook,D;t[12]!==r||t[13]!==a||t[14]!==E?(D=(0,$.jsx)(v,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:r,onClick:a,children:E}),t[12]=r,t[13]=a,t[14]=E,t[15]=D):D=t[15];let O;t[16]!==T||t[17]!==D?(O=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[T,D]}),t[16]=T,t[17]=D,t[18]=O):O=t[18];let k;t[19]!==r||t[20]!==m||t[21]!==g||t[22]!==l||t[23]!==u||t[24]!==c||t[25]!==n.rules||t[26]!==i.cancel||t[27]!==i.deleteRule||t[28]!==i.disableRule||t[29]!==i.edit||t[30]!==i.enableRule||t[31]!==i.moveDown||t[32]!==i.moveUp||t[33]!==i.rollbackRule||t[34]!==i.ruleChannelContext||t[35]!==i.ruleContextAny||t[36]!==i.ruleHistory||t[37]!==i.ruleSupportContext||t[38]!==i.ruleSupportNeeds||t[39]!==i.save?(k=n.rules.map((e,t)=>(0,$.jsx)(`li`,{className:s(`rounded-lg border border-edge-subtle p-2.5`,!e.enabled&&`opacity-60`),children:m===e.id?(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(`textarea`,{className:s(St,`min-h-16 resize-y`),value:g,onChange:e=>_(e.target.value)}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-1`,children:[(0,$.jsx)(v,{type:`button`,variant:`ghost`,className:`h-7 px-2`,onClick:()=>h(null),children:i.cancel}),(0,$.jsx)(v,{type:`button`,variant:`primary`,className:`h-7 px-2`,disabled:!g.trim(),onClick:()=>{c(e.id,{statement:g.trim()}),h(null)},children:i.save})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:e.statement}),(0,$.jsxs)(`div`,{className:`mt-2 grid grid-cols-2 gap-1`,children:[(0,$.jsxs)(`label`,{className:`grid gap-1 text-[10px] text-fg-subtle`,children:[i.ruleSupportContext,(0,$.jsxs)(d,{value:e.context.supportNeed??``,disabled:r,onChange:t=>c(e.id,{context:{supportNeed:t.target.value||null}}),children:[(0,$.jsx)(J,{value:``,children:i.ruleContextAny}),[`listen`,`clarify`,`advise`,`act`,`unknown`].map(e=>(0,$.jsx)(J,{value:e,children:i.ruleSupportNeeds[e]},e))]})]}),(0,$.jsxs)(`label`,{className:`grid gap-1 text-[10px] text-fg-subtle`,children:[i.ruleChannelContext,(0,$.jsxs)(d,{value:e.context.channel??``,disabled:r,onChange:t=>c(e.id,{context:{channel:t.target.value||null}}),children:[(0,$.jsx)(J,{value:``,children:i.ruleContextAny}),[`webchat`,`telegram`,`weixin`,`feishu`,`cli`].map(Nt)]})]})]}),(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap justify-end gap-1`,children:[(0,$.jsx)(v,{type:`button`,variant:`ghost`,className:`h-7 px-2`,disabled:r||t===0,onClick:()=>c(e.id,{order:n.rules[t-1].order-1}),children:i.moveUp}),(0,$.jsx)(v,{type:`button`,variant:`ghost`,className:`h-7 px-2`,disabled:r||t===n.rules.length-1,onClick:()=>c(e.id,{order:n.rules[t+1].order+1}),children:i.moveDown}),(0,$.jsx)(v,{type:`button`,variant:`ghost`,className:`h-7 px-2`,disabled:r,onClick:()=>c(e.id,{enabled:!e.enabled}),children:e.enabled?i.disableRule:i.enableRule}),(0,$.jsxs)(v,{type:`button`,variant:`ghost`,className:`h-7 px-2`,disabled:r,onClick:()=>{h(e.id),_(e.statement)},children:[(0,$.jsx)(le,{className:`size-3`,"aria-hidden":!0}),i.edit]}),(0,$.jsxs)(v,{type:`button`,variant:`ghost`,className:`h-7 px-2 text-danger`,disabled:r,onClick:()=>l(e.id),children:[(0,$.jsx)(M,{className:`size-3`,"aria-hidden":!0}),i.deleteRule]})]}),e.versions.length>1?(0,$.jsxs)(`details`,{className:`mt-2 border-t border-edge-subtle pt-2`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-[11px] text-fg-subtle`,children:i.ruleHistory}),(0,$.jsx)(`div`,{className:`mt-2 space-y-2`,children:e.versions.filter(Mt).map(t=>(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2 text-[11px]`,children:[(0,$.jsx)(`p`,{className:`line-clamp-2 text-fg-muted`,children:t.statement}),(0,$.jsx)(v,{type:`button`,variant:`ghost`,className:`h-7 shrink-0 px-2`,disabled:r,onClick:()=>u(e.id,t.id),children:i.rollbackRule})]},t.id))})]}):null]})},e.id)),t[19]=r,t[20]=m,t[21]=g,t[22]=l,t[23]=u,t[24]=c,t[25]=n.rules,t[26]=i.cancel,t[27]=i.deleteRule,t[28]=i.disableRule,t[29]=i.edit,t[30]=i.enableRule,t[31]=i.moveDown,t[32]=i.moveUp,t[33]=i.rollbackRule,t[34]=i.ruleChannelContext,t[35]=i.ruleContextAny,t[36]=i.ruleHistory,t[37]=i.ruleSupportContext,t[38]=i.ruleSupportNeeds,t[39]=i.save,t[40]=k):k=t[40];let A;t[41]===k?A=t[42]:(A=(0,$.jsx)(`ul`,{className:`mt-3 space-y-2`,children:k}),t[41]=k,t[42]=A);let j;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(j=e=>p(e.target.value),t[43]=j):j=t[43];let N;t[44]!==f||t[45]!==i.newRulePlaceholder?(N=(0,$.jsx)(`input`,{className:St,value:f,onChange:j,placeholder:i.newRulePlaceholder}),t[44]=f,t[45]=i.newRulePlaceholder,t[46]=N):N=t[46];let P;t[47]!==r||t[48]!==f?(P=r||!f.trim(),t[47]=r,t[48]=f,t[49]=P):P=t[49];let F;t[50]!==f||t[51]!==o?(F=()=>{o(f.trim()),p(``)},t[50]=f,t[51]=o,t[52]=F):F=t[52];let I;t[53]!==i.addRule||t[54]!==P||t[55]!==F?(I=(0,$.jsx)(v,{type:`button`,variant:`secondary`,disabled:P,onClick:F,children:i.addRule}),t[53]=i.addRule,t[54]=P,t[55]=F,t[56]=I):I=t[56];let L;t[57]!==N||t[58]!==I?(L=(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[N,I]}),t[57]=N,t[58]=I,t[59]=L):L=t[59];let R=i.playbookRuleExamples[n.id],z;t[60]===R?z=t[61]:(z=(0,$.jsx)(`p`,{className:`mt-1.5 text-[11px] leading-5 text-fg-subtle`,children:R}),t[60]=R,t[61]=z);let B;t[62]!==L||t[63]!==z?(B=(0,$.jsxs)(`div`,{className:`mt-3`,children:[L,z]}),t[62]=L,t[63]=z,t[64]=B):B=t[64];let V;return t[65]!==O||t[66]!==A||t[67]!==b||t[68]!==B?(V=(0,$.jsxs)(`article`,{className:b,children:[O,A,B]}),t[65]=O,t[66]=A,t[67]=b,t[68]=B,t[69]=V):V=t[69],V}function Mt(e){return!e.current}function Nt(e){return(0,$.jsx)(J,{value:e,children:e},e)}function Pt(e){return e.enabled}function Ft(e){let t=(0,Ve.c)(46),{suggestion:n,draft:r,busy:i,onDraftChange:a,onSave:o,onLater:c,t:l}=e,u;t[0]!==n||t[1]!==l.meetSuggestedTitle||t[2]!==l.meetTitle?(u=n?l.meetSuggestedTitle.replace(`{{name}}`,n.value):l.meetTitle,t[0]=n,t[1]=l.meetSuggestedTitle,t[2]=l.meetTitle,t[3]=u):u=t[3];let d;t[4]===u?d=t[5]:(d=(0,$.jsx)(`h2`,{className:`text-xl font-semibold tracking-tight text-fg`,children:u}),t[4]=u,t[5]=d);let f=n?l.meetSuggestedBody:l.meetBody,p;t[6]===f?p=t[7]:(p=(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:f}),t[6]=f,t[7]=p);let m;t[8]===l.callName?m=t[9]:(m=(0,$.jsx)(`label`,{className:`sr-only`,htmlFor:`you-call-name`,children:l.callName}),t[8]=l.callName,t[9]=m);let h;t[10]===a?h=t[11]:(h=e=>a(e.target.value),t[10]=a,t[11]=h);let g;t[12]!==i||t[13]!==r||t[14]!==o?(g=e=>{e.key===`Enter`&&r.trim()&&!i&&o()},t[12]=i,t[13]=r,t[14]=o,t[15]=g):g=t[15];let _=l.meetPlaceholder,y;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(y=s(St,`h-10 flex-1 bg-surface-base/90`),t[16]=y):y=t[16];let b;t[17]!==r||t[18]!==l.meetPlaceholder||t[19]!==h||t[20]!==g?(b=(0,$.jsx)(`input`,{id:`you-call-name`,value:r,maxLength:80,onChange:h,onKeyDown:g,placeholder:_,className:y}),t[17]=r,t[18]=l.meetPlaceholder,t[19]=h,t[20]=g,t[21]=b):b=t[21];let x;t[22]!==i||t[23]!==r?(x=i||!r.trim(),t[22]=i,t[23]=r,t[24]=x):x=t[24];let S=i?l.meetSaving:l.meetSave,C;t[25]!==o||t[26]!==x||t[27]!==S?(C=(0,$.jsx)(v,{type:`button`,variant:`primary`,className:`h-10 shrink-0`,disabled:x,onClick:o,children:S}),t[25]=o,t[26]=x,t[27]=S,t[28]=C):C=t[28];let w;t[29]!==b||t[30]!==C||t[31]!==m?(w=(0,$.jsxs)(`div`,{className:`mt-5 flex max-w-xl flex-col gap-2 sm:flex-row`,children:[m,b,C]}),t[29]=b,t[30]=C,t[31]=m,t[32]=w):w=t[32];let T;t[33]!==n||t[34]!==l.meetSource?(T=n?(0,$.jsxs)(`p`,{className:`mt-3 flex items-start gap-1.5 text-xs leading-5 text-fg-subtle`,children:[(0,$.jsx)(ye,{className:`mt-0.5 size-3.5 shrink-0 text-accent`,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:l.meetSource})]}):null,t[33]=n,t[34]=l.meetSource,t[35]=T):T=t[35];let E;t[36]!==i||t[37]!==c||t[38]!==l.meetLater?(E=(0,$.jsx)(`button`,{type:`button`,disabled:i,className:`mt-3 text-xs font-medium text-fg-muted hover:text-fg hover:underline disabled:opacity-60`,onClick:c,children:l.meetLater}),t[36]=i,t[37]=c,t[38]=l.meetLater,t[39]=E):E=t[39];let D;return t[40]!==w||t[41]!==T||t[42]!==E||t[43]!==d||t[44]!==p?(D=(0,$.jsx)(`section`,{className:`relative overflow-hidden rounded-2xl border border-accent/25 bg-gradient-to-br from-accent-soft/80 via-surface-panel to-surface-panel p-5 sm:p-6`,children:(0,$.jsxs)(`div`,{className:`relative max-w-2xl`,children:[d,p,w,T,E]})}),t[40]=w,t[41]=T,t[42]=E,t[43]=d,t[44]=p,t[45]=D):D=t[45],D}function It(){let e=l(e=>e.language),t=c(e).you,n=a(),[r,f]=i(),m=yt(r.get(`tab`)),h=te(e=>e.setPageHeader),_=te(e=>e.clearPageHeader),{data:y,error:b,isLoading:S,mutate:w}=u(`/api/you`,Ce),[E,D]=(0,Q.useState)(null),[k,j]=(0,Q.useState)(!1),[M,P]=(0,Q.useState)(``),[z,W]=(0,Q.useState)(`preference`),[G,ee]=(0,Q.useState)(!1),[q,X]=(0,Q.useState)(null),[re,ie]=(0,Q.useState)(!1),[ae,Z]=(0,Q.useState)(null),[ce,ue]=(0,Q.useState)(!1),[pe,he]=(0,Q.useState)(``),[_e,xe]=(0,Q.useState)(!1),[Se,Te]=(0,Q.useState)(null),[Oe,Ne]=(0,Q.useState)(!1),[Be,Ve]=(0,Q.useState)(!1),[We,Ge]=(0,Q.useState)(!1),[Ke,qe]=(0,Q.useState)(null),[Je,Ye]=(0,Q.useState)(!1),[Xe,Ze]=(0,Q.useState)(null),[Qe,$e]=(0,Q.useState)(null),[et,tt]=(0,Q.useState)(!1),[it,at]=(0,Q.useState)(null),[ot,st]=(0,Q.useState)(null),ct=(0,Q.useRef)(null),lt=(0,Q.useRef)(null),ut=(0,Q.useRef)(null),dt=y?.profile??{callName:``,pronouns:``,timezone:``,notes:``},ft=(0,Q.useMemo)(()=>y?.understanding.filter(e=>e.status===`active`)??[],[y]),pt=(0,Q.useMemo)(()=>y?.understanding.filter(e=>e.status!==`active`)??[],[y]),mt=(0,Q.useMemo)(()=>y?.connectedClaims.filter(e=>e.state!==`rejected`)??[],[y]),gt=(0,Q.useMemo)(()=>mt.filter(e=>e.state!==`active`),[mt]),_t=(0,Q.useMemo)(()=>new Map(bt.map(e=>[e,ft.filter(t=>t.facet===e)])),[ft]),vt=Se??y?.controls??null,At=y?.sources.filter(e=>e.installed&&e.enabled)??[],Mt=At.filter(e=>[`failed`,`unauthorized`,`degraded`,`not_configured`].includes(e.status));(0,Q.useEffect)(()=>{let e=()=>{w()};return window.addEventListener(`connector-learning-updated`,e),()=>window.removeEventListener(`connector-learning-updated`,e)},[w]),(0,Q.useEffect)(()=>{if(m!==`memory`||!ot)return;let e=requestAnimationFrame(()=>{(ot===`profile`?ct:lt).current?.scrollIntoView({behavior:`smooth`,block:`start`}),st(null)});return()=>cancelAnimationFrame(e)},[ot,m]);async function Nt(e){if(!(!y||We)){Ge(!0);try{let n=await U(e);await w({...y,relationship:n.relationship},{revalidate:!1}),I({type:`success`,title:t.collaborationTitle,message:t.saved})}catch{I({type:`error`,title:t.supportModeTitle,message:t.saveError})}finally{Ge(!1)}}}async function Pt(e,n){D(`claim:${e.id}`);try{let t=await De(e.id,n);await w(e=>e&&{...e,connectedClaims:e.connectedClaims.map(e=>e.id===t.id?t:e)},{revalidate:!1})}catch{I({type:`error`,title:t.connectedClaimsTitle,message:t.saveError})}finally{D(null)}}let It=e=>{let t=new URLSearchParams;e!==`overview`&&t.set(`tab`,e),f(t,{replace:!0})},Lt=e=>{st(e),It(`memory`)},Rt=e=>{let t=new URLSearchParams({connector:e.id});e.instanceId&&t.set(`instance`,e.instanceId),n(`/connectors?${t.toString()}`)},zt=async e=>{if(e.instanceId){D(`source-learning:${e.instanceId}`);try{e.learning?.status===`paused`?await Re(e.instanceId,!1):await ze(e.instanceId),await w(),I({type:`success`,title:e.displayName,message:t.sourceLearningStarted})}catch(n){I({type:`error`,title:e.displayName,message:n instanceof Error?n.message:t.sourceLearningStartFailed})}finally{D(null)}}},Bt=async e=>{if(e.instanceId){D(`source-learning:${e.instanceId}`);try{await Re(e.instanceId,!0),await w()}catch(n){I({type:`error`,title:e.displayName,message:n instanceof Error?n.message:t.sourceLearningStartFailed})}finally{D(null)}}};(0,Q.useLayoutEffect)(()=>(h({startExtra:null,main:(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.title}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:t.subtitle})]}),end:(0,$.jsxs)(v,{type:`button`,variant:`ghost`,className:`h-8 gap-1.5 px-2.5 text-xs`,onClick:()=>Ye(!0),children:[(0,$.jsx)(ve,{className:`size-3.5`,"aria-hidden":!0}),t.howItWorks]})}),()=>_()),[_,h,t.howItWorks,t.subtitle,t.title]),(0,Q.useEffect)(()=>{!y||y.profile.callName||he(y.profileSetup.callNameSuggestion?.value??``)},[y,y?.profile.callName,y?.profileSetup.callNameSuggestion?.id]);async function Vt(e,n,r){D(e.id);try{let t=await be(e.id,{action:n,content:r});await w(r=>r&&{...r,understanding:n===`reject`?r.understanding.filter(t=>t.id!==e.id):r.understanding.map(n=>n.id===e.id?t:n)},{revalidate:!1}),w()}catch{I({type:`error`,title:t.title,message:t.saveError})}finally{D(null)}}async function Ht(e,n){D(`consent:${e}`);try{await F(e,n),await w(),I({type:`success`,title:t.title,message:t.saved})}catch{I({type:`error`,title:t.title,message:t.saveError})}finally{D(null)}}async function Ut(){let e=M.trim();if(e){D(`understanding:new`);try{await g({content:e,kind:z}),P(``),j(!1),ee(!1),await w(),I({type:`success`,title:t.understandingTitle,message:t.saved})}catch{I({type:`error`,title:t.understandingTitle,message:t.saveError})}finally{D(null)}}}async function Wt(){if(pt.length){D(`understanding:batch`);try{await A(pt.map(e=>e.id),`confirm`),await w()}catch{I({type:`error`,title:t.reviewTitle,message:t.saveError})}finally{D(null)}}}async function Gt(e,n){D(`conflict:${e}`);try{await R(e,n),await w()}catch{I({type:`error`,title:t.conflictsTitle,message:t.saveError})}finally{D(null)}}async function Kt(e){D(`grant:${e}`);try{await V(e),await w()}catch{I({type:`error`,title:t.grantsTitle,message:t.saveError})}finally{D(null)}}async function qt(r,i){D(`insight:${r.id}`);try{let t=await we(r.id,{action:i,uiLocale:e});await w(),i===`apply`&&t.href&&n(t.href)}catch{I({type:`error`,title:t.insightsTitle,message:t.saveError})}finally{D(null)}}async function Jt(e){D(`playbook:${e.id}`);try{await ne(e.id,!e.enabled),await w()}catch{I({type:`error`,title:t.playbooksTitle,message:t.saveError})}finally{D(null)}}async function Yt(e,n){D(`playbook:${e}`);try{await n(),await w()}catch{I({type:`error`,title:t.playbooksTitle,message:t.saveError})}finally{D(null)}}async function Xt(){if(q){D(q.id);try{await C(q.id);let e=q.id;X(null),await w(t=>t&&{...t,understanding:t.understanding.filter(t=>t.id!==e)},{revalidate:!1}),w()}catch{I({type:`error`,title:t.title,message:t.saveError})}finally{D(null)}}}async function Zt(){if(ae){ue(!0);try{let e=await K(ae);ie(!1),Z(null),await w(t=>t&&{...t,...e},{revalidate:!1})}catch{I({type:`error`,title:t.title,message:t.saveError})}finally{ue(!1)}}}async function Qt(){let e=pe.trim();if(!(!e||_e)){xe(!0);try{let t=await K({callName:e,timezone:dt.timezone||oe()});await w(e=>e&&{...e,...t},{revalidate:!1})}catch{I({type:`error`,title:t.title,message:t.saveError})}finally{xe(!1)}}}async function $t(){if(!_e){xe(!0);try{let e=await de(`snooze`);await w(t=>t&&{...t,profileSetup:e.profileSetup},{revalidate:!1})}catch{I({type:`error`,title:t.title,message:t.saveError})}finally{xe(!1)}}}function en(){Z(dt),ie(!0),Lt(`profile`)}function tn(e,t=!1){W(e),ee(t),j(!0),It(`memory`)}function nn(){j(!1),ee(!1),P(``)}async function rn(e){if(!Oe){Te(e),Ne(!0);try{Te(await Ee(e)),await w(),I({type:`success`,title:t.privacyTitle,message:t.saved})}catch{Te(null),I({type:`error`,title:t.privacyTitle,message:t.saveError})}finally{Ne(!1)}}}async function an(e){if(!(Be||e===y?.trust.defaultActionLevel)){Ve(!0);try{let n=await Ae(e);await w(e=>e&&{...e,trust:n},{revalidate:!1}),I({type:`success`,title:t.trustTitle,message:t.saved})}catch{I({type:`error`,title:t.trustTitle,message:t.saveError})}finally{Ve(!1),qe(null)}}}async function on(e){if(!(!Qe?.instanceId||et)){tt(!0);try{let n=await N(Qe.instanceId,e);$e(null),await w(),I({type:`success`,title:t.sourcesTitle,message:e===`delete`?t.disconnectDeleted.replace(`{{count}}`,String(n.deletedUnderstandingCount)):t.disconnectSuccess})}catch{I({type:`error`,title:t.sourcesTitle,message:t.saveError})}finally{tt(!1)}}}async function sn(){if(!it){at(`export`);try{let e=await L(),t=URL.createObjectURL(new Blob([JSON.stringify(e,null,2)],{type:`application/json`})),n=document.createElement(`a`);n.href=t,n.download=`xopc-about-you-${e.exportedAt.slice(0,10)}.json`,n.click(),URL.revokeObjectURL(t)}catch{I({type:`error`,title:t.transferTitle,message:t.saveError})}finally{at(null)}}}async function cn(e){if(!(!e||it)){at(`import`);try{if(e.size>2*1024*1024)throw Error(`file too large`);let n=await B(JSON.parse(await e.text()));await w(),Lt(`review`),I({type:`success`,title:t.transferTitle,message:t.importSuccess.replace(`{{count}}`,String(n.importedCount)).replace(`{{skipped}}`,String(n.skippedCount))})}catch{I({type:`error`,title:t.transferTitle,message:t.importError})}finally{ut.current&&(ut.current.value=``),Ze(null),at(null)}}}function ln(){Ze(null),ut.current&&(ut.current.value=``)}return(0,$.jsxs)(`main`,{className:`flex w-full flex-1 flex-col gap-5 px-3 py-6 sm:px-5 xl:px-6`,children:[(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(Ie,{items:[{id:`overview`,label:t.tabs.overview,icon:H},{id:`memory`,label:t.tabs.memory,icon:me,count:pt.length+gt.length||void 0},{id:`collaboration`,label:t.tabs.collaboration,icon:je},{id:`sources`,label:t.tabs.sources,icon:p},{id:`dreaming`,label:t.tabs.dreaming,icon:T},{id:`privacy`,label:t.tabs.privacy,icon:ye}],activeTab:m,onChange:It,ariaLabel:t.title,tabIdPrefix:`you-tab`,panelIdPrefix:`you-panel`,className:`pr-8 sm:pr-1`,buttonClassName:`px-2.5 sm:px-3`}),(0,$.jsx)(`div`,{className:`pointer-events-none absolute inset-y-1 right-0 w-8 bg-gradient-to-l from-surface-panel to-transparent sm:hidden`,"aria-hidden":!0})]}),S?(0,$.jsx)(Et,{}):b||!y?(0,$.jsx)(`div`,{className:`rounded-2xl border border-danger/25 bg-danger-soft p-5 text-sm text-danger`,children:t.loadError}):null,y&&m===`overview`?(0,$.jsxs)(`div`,{id:`you-panel-overview`,role:`tabpanel`,"aria-labelledby":`you-tab-overview`,className:`space-y-4`,children:[!dt.callName&&y.profileSetup.shouldPrompt?(0,$.jsx)(Ft,{suggestion:y.profileSetup.callNameSuggestion,draft:pe,busy:_e,onDraftChange:he,onSave:()=>void Qt(),onLater:()=>void $t(),t}):null,pt.length>0||gt.length>0||Mt.length>0||!dt.callName?(0,$.jsxs)(`section`,{className:`rounded-2xl border border-warning/25 bg-warning-soft/35 p-5`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.attentionTitle}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[pt.length+gt.length>0?(0,$.jsxs)(v,{type:`button`,variant:`secondary`,onClick:()=>Lt(`review`),children:[Ct(t.reviewCount,pt.length+gt.length),(0,$.jsx)(fe,{className:`size-4`,"aria-hidden":!0})]}):null,Mt.length>0?(0,$.jsxs)(v,{type:`button`,variant:`secondary`,onClick:()=>It(`sources`),children:[Ct(t.sourceIssues,Mt.length),(0,$.jsx)(fe,{className:`size-4`,"aria-hidden":!0})]}):null,dt.callName?null:(0,$.jsxs)(v,{type:`button`,variant:`secondary`,onClick:en,children:[t.completeProfile,(0,$.jsx)(fe,{className:`size-4`,"aria-hidden":!0})]})]})]}):null,(0,$.jsx)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-4`,children:(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,$.jsxs)(`button`,{type:`button`,className:`rounded-xl border border-edge-subtle bg-surface-panel p-3 text-left hover:bg-surface-hover`,onClick:()=>It(`memory`),children:[(0,$.jsx)(`span`,{className:`text-xl font-semibold text-fg`,children:ft.length}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:t.knownSummary})]}),(0,$.jsxs)(`button`,{type:`button`,className:`rounded-xl border border-edge-subtle bg-surface-panel p-3 text-left hover:bg-surface-hover`,onClick:()=>It(`sources`),children:[(0,$.jsx)(`span`,{className:`text-xl font-semibold text-fg`,children:At.length}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:t.connectedSources})]}),(0,$.jsxs)(`button`,{type:`button`,className:`rounded-xl border border-edge-subtle bg-surface-panel p-3 text-left hover:bg-surface-hover`,onClick:()=>Lt(`review`),children:[(0,$.jsx)(`span`,{className:`text-xl font-semibold text-fg`,children:pt.length+gt.length}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:t.waitingReview})]})]})}),y.insights.length>0?(0,$.jsxs)(`section`,{className:`rounded-2xl border border-accent/15 bg-surface-base p-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,$.jsx)(ge,{className:`size-4 text-accent`,"aria-hidden":!0}),t.insightsTitle]}),(0,$.jsx)(wt,{children:t.confirmedContextBadge})]}),(0,$.jsx)(`div`,{className:`mt-4 grid gap-3 lg:grid-cols-2`,children:y.insights.map(e=>(0,$.jsxs)(`article`,{className:`rounded-xl border border-edge-subtle bg-surface-panel p-4`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:e.insight}),(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:e.evidenceCount>1?Ct(t.insightEvidence,e.evidenceCount):t.insightReason}),(0,$.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2`,children:[(0,$.jsx)(v,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:E===`insight:${e.id}`,onClick:()=>void qt(e,`dismiss`),children:t.notNow}),(0,$.jsx)(v,{type:`button`,variant:`primary`,className:`h-8 px-2`,disabled:E===`insight:${e.id}`,onClick:()=>void qt(e,`apply`),children:t.insightActions[e.action]})]})]},e.id))})]}):null,(0,$.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,$.jsx)(Y,{className:`size-4 text-accent`,"aria-hidden":!0}),t.profileTitle]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.profileHint})]}),(0,$.jsx)(v,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>Lt(`profile`),children:(0,$.jsx)(fe,{className:`size-4`,"aria-hidden":!0})})]}),(0,$.jsxs)(`dl`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.callName}),(0,$.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:dt.callName||`—`})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.timezone}),(0,$.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:dt.timezone||`—`})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.pronouns}),(0,$.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:dt.pronouns||`—`})]}),dt.notes?(0,$.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.notes}),(0,$.jsx)(`dd`,{className:`mt-1 line-clamp-2 text-sm leading-6 text-fg`,children:dt.notes})]}):null]})]}),(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,$.jsx)(me,{className:`size-4 text-accent`,"aria-hidden":!0}),t.understandingTitle]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.understandingHint})]}),(0,$.jsx)(v,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>It(`memory`),children:(0,$.jsx)(fe,{className:`size-4`,"aria-hidden":!0})})]}),(0,$.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[ft.slice(0,4).map(e=>(0,$.jsx)(`div`,{className:`rounded-lg bg-surface-panel px-3 py-2.5 text-sm leading-5 text-fg`,children:e.statement},e.id)),ft.length===0?(0,$.jsx)(`p`,{className:`py-5 text-center text-sm text-fg-muted`,children:t.emptyUnderstanding}):null]})]})]})]}):null,y&&m===`memory`?(0,$.jsxs)(`div`,{id:`you-panel-memory`,role:`tabpanel`,"aria-labelledby":`you-tab-memory`,className:`space-y-6`,children:[(0,$.jsxs)(`section`,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.memoryTitle}),(0,$.jsx)(wt,{children:t.sharedAgentsBadge})]}),(0,$.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-6 text-fg-muted`,children:t.memoryHint})]}),(0,$.jsxs)(`section`,{ref:ct,id:`you-profile-card`,className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`h2`,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[(0,$.jsx)(Y,{className:`size-4 text-accent`,"aria-hidden":!0}),t.profileTitle]}),(0,$.jsx)(wt,{children:t.onlyYouEditBadge})]}),(0,$.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm text-fg-muted`,children:t.profileHint})]}),re?null:(0,$.jsxs)(v,{type:`button`,variant:`secondary`,onClick:en,children:[(0,$.jsx)(le,{className:`size-3.5`,"aria-hidden":!0}),t.edit]})]}),re&&ae?(0,$.jsxs)(`div`,{className:`mt-5`,children:[(0,$.jsx)(He,{value:ae,onChange:Z,language:e,inputClassName:St,labels:{callName:t.callName,callNamePlaceholder:t.meetPlaceholder,pronouns:t.pronouns,pronounsPlaceholder:t.pronounsPlaceholder,timezone:t.timezone,timezoneCustom:t.timezoneCustom,timezoneDetect:t.timezoneDetect,custom:t.custom,notes:t.notes,notesPlaceholder:t.notesPlaceholder}}),(0,$.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,$.jsx)(v,{type:`button`,variant:`ghost`,onClick:()=>{ie(!1),Z(null)},children:t.cancel}),(0,$.jsx)(v,{type:`button`,variant:`primary`,disabled:ce,onClick:()=>void Zt(),children:ce?t.saving:t.save})]})]}):(0,$.jsxs)(`dl`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.callName}),(0,$.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:dt.callName||`—`})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.timezone}),(0,$.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:dt.timezone||`—`})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.pronouns}),(0,$.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:dt.pronouns||`—`})]}),(0,$.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.notes}),(0,$.jsx)(`dd`,{className:`mt-1 whitespace-pre-wrap text-sm leading-6 text-fg`,children:dt.notes||`—`})]})]})]}),(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.structuredContextTitle}),(0,$.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2 xl:grid-cols-4`,children:[(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":k&&!G&&z===`preference`,className:s(`rounded-xl border bg-surface-panel p-4 text-left transition-colors hover:border-accent/30 hover:bg-surface-hover`,k&&!G&&z===`preference`?`border-accent/40 bg-accent-soft/20`:`border-edge-subtle`),onClick:()=>tn(`preference`),children:[(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:t.addPreference}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.addPreferenceHint})]}),(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":k&&!G&&z===`boundary`,className:s(`rounded-xl border bg-surface-panel p-4 text-left transition-colors hover:border-accent/30 hover:bg-surface-hover`,k&&!G&&z===`boundary`?`border-accent/40 bg-accent-soft/20`:`border-edge-subtle`),onClick:()=>tn(`boundary`),children:[(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:t.addBoundary}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.addBoundaryHint})]}),(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":k&&!G&&z===`current_state`,className:s(`rounded-xl border bg-surface-panel p-4 text-left transition-colors hover:border-accent/30 hover:bg-surface-hover`,k&&!G&&z===`current_state`?`border-accent/40 bg-accent-soft/20`:`border-edge-subtle`),onClick:()=>tn(`current_state`),children:[(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:t.addCurrentFocus}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.addCurrentFocusHint})]}),(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":k&&G,className:s(`rounded-xl border bg-surface-panel p-4 text-left transition-colors hover:border-accent/30 hover:bg-surface-hover`,k&&G?`border-accent/40 bg-accent-soft/20`:`border-edge-subtle`),onClick:()=>tn(`relationship`,!0),children:[(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:t.addOther}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.addOtherHint})]})]}),k?(0,$.jsxs)(`div`,{className:`mt-4 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:G?t.addOther:z===`preference`?t.addPreference:z===`boundary`?t.addBoundary:t.addCurrentFocus}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:G?t.addOtherHint:z===`preference`?t.addPreferenceHint:z===`boundary`?t.addBoundaryHint:t.addCurrentFocusHint})]}),G?null:(0,$.jsx)(wt,{children:t.understandingKinds[z]})]}),(0,$.jsx)(`textarea`,{className:s(St,`mt-3 min-h-24 resize-y`),value:M,onChange:e=>P(e.target.value),placeholder:t.understandingPlaceholders[z],autoFocus:!0}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-end justify-between gap-3`,children:[G?(0,$.jsxs)(`label`,{className:`grid min-w-48 gap-1 text-xs font-medium text-fg-muted`,children:[t.understandingKind,(0,$.jsx)(d,{value:z,onChange:e=>W(e.target.value),children:xt.map(e=>(0,$.jsx)(J,{value:e,children:t.understandingKinds[e]},e))})]}):(0,$.jsx)(`span`,{}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsx)(v,{type:`button`,variant:`ghost`,onClick:nn,children:t.cancel}),(0,$.jsx)(v,{type:`button`,variant:`primary`,disabled:!M.trim()||E===`understanding:new`,onClick:()=>void Ut(),children:t.add})]})]})]}):null]}),y.conflictGroups.some(e=>e.unresolved)?(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.conflictsTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.conflictsHint}),(0,$.jsx)(`div`,{className:`mt-3 space-y-3`,children:y.conflictGroups.filter(e=>e.unresolved).map(n=>(0,$.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-xl border border-warning/35 bg-warning-soft/25`,children:n.records.filter(e=>e.storedStatus!==`archived`&&e.storedStatus!==`rejected`).map(r=>(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3 px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:r.statement}),(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:[Dt(r,t),` · `,Tt(r.updatedAt,e)]})]}),(0,$.jsx)(v,{type:`button`,variant:`secondary`,className:`h-8 shrink-0 px-2.5`,disabled:E===`conflict:${n.id}`,onClick:()=>void Gt(n.id,r.id),children:t.useThis})]},r.id))},n.id))})]}):null,y.consentRequests.length>0?(0,$.jsxs)(`section`,{className:`space-y-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.consentTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.consentHint})]}),y.consentRequests.map(e=>(0,$.jsxs)(`article`,{className:`rounded-2xl border border-accent/25 bg-accent-soft/20 p-4`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:e.statement}),(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.consentPurpose.replace(`{{purpose}}`,e.purpose)}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap justify-end gap-2`,children:[(0,$.jsx)(v,{type:`button`,variant:`ghost`,disabled:E===`consent:${e.id}`,onClick:()=>void Ht(e.id,`deny`),children:t.consentDeny}),(0,$.jsx)(v,{type:`button`,variant:`secondary`,disabled:E===`consent:${e.id}`,onClick:()=>void Ht(e.id,`once`),children:t.consentOnce}),(0,$.jsx)(v,{type:`button`,variant:`secondary`,disabled:E===`consent:${e.id}`,onClick:()=>void Ht(e.id,`session`),children:t.consentSession}),(0,$.jsx)(v,{type:`button`,variant:`primary`,disabled:E===`consent:${e.id}`,onClick:()=>void Ht(e.id,`always`),children:t.consentAlways})]})]},e.id))]}):null,(0,$.jsxs)(`div`,{ref:lt,className:`space-y-6 scroll-mt-6`,children:[mt.length>0?(0,$.jsxs)(`section`,{children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.connectedClaimsTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.connectedClaimsHint})]}),(0,$.jsx)(`div`,{className:`mt-3 grid gap-3 lg:grid-cols-2`,children:mt.map(n=>(0,$.jsx)(kt,{claim:n,language:e,t,busy:E===`claim:${n.id}`,onDecision:e=>void Pt(n,e)},n.id))})]}):null,pt.length>0?(0,$.jsxs)(`section`,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.reviewTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.reviewHint})]}),(0,$.jsx)(v,{type:`button`,variant:`secondary`,disabled:E===`understanding:batch`,onClick:()=>void Wt(),children:t.reviewAll})]}),(0,$.jsx)(`div`,{className:`mt-3 grid gap-3 lg:grid-cols-2`,children:pt.map(n=>(0,$.jsx)(Ot,{item:n,language:e,t,busy:E===n.id,onConfirm:()=>void Vt(n,`confirm`),onReject:()=>void Vt(n,`reject`),onUpdate:e=>void Vt(n,`update`,e),onForget:()=>X(n)},n.id))})]}):ft.length>0||mt.some(e=>e.state===`active`)?(0,$.jsxs)(`div`,{className:`rounded-2xl border border-success/20 bg-success-soft p-6 text-center`,children:[(0,$.jsx)(o,{className:`mx-auto size-5 text-success`,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`mt-2 text-sm font-semibold text-fg`,children:t.nothingToReview}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.nothingToReviewHint})]}):null]}),bt.map(n=>{let r=_t.get(n)??[];return r.length===0?null:(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.facets[n]}),(0,$.jsx)(`div`,{className:`mt-3 grid gap-3 lg:grid-cols-2`,children:r.map(n=>(0,$.jsx)(Ot,{item:n,language:e,t,busy:E===n.id,onConfirm:()=>void Vt(n,`confirm`),onReject:()=>void Vt(n,`reject`),onUpdate:e=>void Vt(n,`update`,e),onForget:()=>X(n)},n.id))})]},n)}),y.understanding.length===0&&mt.length===0?(0,$.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge p-10 text-center text-sm text-fg-muted`,children:t.emptyUnderstanding}):null]}):null,y&&m===`collaboration`?(0,$.jsxs)(`div`,{id:`you-panel-collaboration`,role:`tabpanel`,"aria-labelledby":`you-tab-collaboration`,className:`space-y-6`,children:[(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.collaborationTitle}),(0,$.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-6 text-fg-muted`,children:t.collaborationHint})]}),(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,$.jsxs)(`div`,{className:`max-w-2xl`,children:[(0,$.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,$.jsx)(H,{className:`size-4 text-accent`,"aria-hidden":!0}),t.supportModeTitle]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.supportModeHint})]}),(0,$.jsxs)(`label`,{className:`grid min-w-48 gap-1 text-xs font-medium text-fg-muted`,children:[(0,$.jsx)(`span`,{className:`sr-only`,children:t.supportModeTitle}),(0,$.jsx)(d,{value:y.relationship.supportMode,disabled:We,onChange:e=>void Nt({supportMode:e.target.value}),children:Object.entries(t.supportModes).map(([e,t])=>(0,$.jsx)(J,{value:e,children:t},e))})]})]}),(0,$.jsxs)(`div`,{className:`mt-4 grid gap-3 border-t border-edge-subtle pt-4 sm:grid-cols-2 lg:grid-cols-4`,children:[(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:y.relationship.proactiveEnabled,disabled:We,onChange:e=>void Nt({proactiveEnabled:e.target.checked})}),t.proactiveEnabled]}),(0,$.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.quietStart,(0,$.jsx)(Le,{value:y.relationship.quietStart??``,disabled:We,allowEmpty:!0,clearLabel:t.clearTime,ariaLabel:t.quietStart,onChange:e=>void Nt({quietStart:e||null})})]}),(0,$.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.quietEnd,(0,$.jsx)(Le,{value:y.relationship.quietEnd??``,disabled:We,allowEmpty:!0,clearLabel:t.clearTime,ariaLabel:t.quietEnd,onChange:e=>void Nt({quietEnd:e||null})})]}),(0,$.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.blockedTopics,(0,$.jsx)(`input`,{className:St,defaultValue:y.relationship.blockedTopics.join(`, `),disabled:We,onBlur:e=>void Nt({blockedTopics:e.target.value.split(`,`).map(e=>e.trim()).filter(Boolean)})})]})]}),(0,$.jsx)(`p`,{className:`mt-3 text-right text-xs text-fg-subtle`,children:We?t.saving:t.autoSaveHint})]}),(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`h2`,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[(0,$.jsx)(je,{className:`size-4 text-accent`,"aria-hidden":!0}),t.playbooksTitle]}),(0,$.jsx)(wt,{children:t.affectsAgentsBadge})]}),y.playbooks.length>0?(0,$.jsx)(`div`,{className:`mt-4 grid gap-3 xl:grid-cols-3`,children:y.playbooks.map(e=>(0,$.jsx)(jt,{playbook:e,busy:E===`playbook:${e.id}`,t,onToggleGroup:()=>void Jt(e),onCreate:t=>void Yt(e.id,()=>Fe(e.id,t,(e.rules.at(-1)?.order??0)+10)),onUpdate:(t,n)=>void Yt(e.id,()=>se(e.id,t,n)),onDelete:t=>void Yt(e.id,()=>x(e.id,t)),onRollback:(t,n)=>void Yt(e.id,()=>O(e.id,t,n))},e.id))}):(0,$.jsx)(`p`,{className:`mt-4 rounded-xl bg-surface-muted px-4 py-3 text-sm text-fg-muted`,children:t.emptyPlaybooks})]})]}):null,y&&m===`sources`?(0,$.jsx)(ht,{sources:y.sources,recommendations:y.sourceRecommendations,language:e,t,busyId:E,onAddSource:()=>n(`/connectors?personalContext=1`),onConnectRecommendation:e=>n(`/connectors?personalContext=1&connector=${encodeURIComponent(e)}&returnTo=%2Fyou%3Ftab%3Dsources`),onLearn:e=>void zt(e),onPause:e=>void Bt(e),onConfigure:Rt,onDisconnect:$e,onViewUnderstanding:()=>It(`memory`)}):null,y&&m===`dreaming`?(0,$.jsx)(nt,{language:e}):null,y&&m===`privacy`&&vt?(0,$.jsxs)(`div`,{id:`you-panel-privacy`,role:`tabpanel`,"aria-labelledby":`you-tab-privacy`,className:`space-y-6`,children:[(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.privacyTitle}),(0,$.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-6 text-fg-muted`,children:t.privacyHint})]}),(0,$.jsxs)(`div`,{className:`grid gap-6 xl:grid-cols-2`,children:[(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.controlTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.controlHint}),(0,$.jsxs)(`div`,{className:`mt-4 space-y-3 rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[t.learningMode,(0,$.jsx)(d,{value:vt.mode,disabled:Oe,onChange:e=>void rn({...vt,mode:e.target.value}),children:Object.entries(t.learningModes).map(([e,t])=>(0,$.jsx)(J,{value:e,children:t},e))})]}),(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[t.sensitive,(0,$.jsx)(d,{value:vt.sensitiveWritePolicy,disabled:Oe,onChange:e=>void rn({...vt,sensitiveWritePolicy:e.target.value}),children:Object.entries(t.sensitiveOptions).map(([e,t])=>(0,$.jsx)(J,{value:e,children:t},e))}),(0,$.jsx)(`span`,{className:`font-normal leading-5 text-fg-subtle`,children:t.sensitiveOptionHints[vt.sensitiveWritePolicy]})]}),(0,$.jsx)(`p`,{className:`text-right text-xs text-fg-subtle`,children:Oe?t.saving:t.autoSaveHint})]})]}),(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.trustTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.trustHint}),(0,$.jsx)(`div`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,children:y.trust.levels.map(e=>(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":e===y.trust.defaultActionLevel,disabled:Be,onClick:()=>{e!==y.trust.defaultActionLevel&&(e===`auto`?qe(e):an(e))},className:s(`rounded-xl border p-3 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-70`,e===y.trust.defaultActionLevel?`border-accent/35 bg-accent-soft/35`:`border-edge-subtle bg-surface-panel hover:border-accent/25 hover:bg-surface-hover`),children:[(0,$.jsx)(`p`,{className:`text-xs font-semibold text-fg`,children:t.trustLevels[e]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.trustLevelHints[e]}),e===y.trust.defaultActionLevel?(0,$.jsx)(`span`,{className:`mt-2 inline-block rounded-full bg-accent-soft px-2 py-0.5 text-[11px] text-accent-fg`,children:t.defaultTrust}):null]},e))})]})]}),(0,$.jsx)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.jsx)(ye,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.sharingTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.sharingHint})]})]})}),(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.grantsTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.grantsHint}),y.referenceGrants.length>0?(0,$.jsx)(`div`,{className:`mt-3 divide-y divide-edge overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:y.referenceGrants.map(n=>(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`p`,{className:`truncate text-sm text-fg`,children:n.statement}),(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:[n.grantScope?t.grantScopes[n.grantScope]:``,n.expiresAt?` · ${Tt(n.expiresAt,e)}`:``]})]}),(0,$.jsx)(v,{type:`button`,variant:`ghost`,className:`h-8 px-2.5`,disabled:E===`grant:${n.id}`,onClick:()=>void Kt(n.id),children:t.revoke})]},n.id))}):(0,$.jsx)(`p`,{className:`mt-3 rounded-xl bg-surface-muted px-4 py-3 text-sm text-fg-muted`,children:t.noGrants})]}),(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.transferTitle}),(0,$.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,$.jsxs)(v,{type:`button`,variant:`secondary`,disabled:it!==null,onClick:()=>void sn(),children:[(0,$.jsx)(Me,{className:`size-4`,"aria-hidden":!0}),it===`export`?t.exporting:t.exportAction]}),(0,$.jsxs)(v,{type:`button`,variant:`secondary`,disabled:it!==null,onClick:()=>ut.current?.click(),children:[(0,$.jsx)(Pe,{className:`size-4`,"aria-hidden":!0}),it===`import`?t.importing:t.importAction]}),(0,$.jsx)(`input`,{ref:ut,type:`file`,accept:`application/json,.json`,className:`sr-only`,onChange:e=>Ze(e.target.files?.[0]??null)})]})]})]}):null,(0,$.jsx)(ke,{open:q!==null,title:t.forgetTitle,description:t.forgetBody,confirmLabel:t.forget,cancelLabel:t.cancel,destructive:!0,onConfirm:()=>void Xt(),onCancel:()=>X(null)}),(0,$.jsx)(ke,{open:Ke===`auto`,title:t.autoConfirmTitle,description:t.autoConfirmBody,confirmLabel:t.autoConfirmAction,cancelLabel:t.cancel,onConfirm:()=>void an(`auto`),onCancel:()=>qe(null)}),(0,$.jsx)(ke,{open:Xe!==null,title:t.importConfirmTitle,description:t.importConfirmBody.replace(`{{name}}`,Xe?.name??``),confirmLabel:t.importConfirmAction,cancelLabel:t.cancel,onConfirm:()=>{let e=Xe;Ze(null),cn(e)},onCancel:ln}),(0,$.jsx)(rt,{source:Qe,language:e,busy:et,onOpenChange:e=>{e||$e(null)},onConfirm:e=>void on(e)}),(0,$.jsx)(Ue,{open:Je,t,onOpenChange:Ye,onNavigate:It})]})}export{It as UserContextPage};
@@ -1 +1 @@
1
- import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./cn-JdwAhgNB.js";import{r as i,s as a}from"./locale-store-Bff30u5V.js";import{$a as o,_s as s}from"./index-vi5KlR5_.js";e();var c=t();function l(){return{enabled:!0,provider:`xopc-local`,alibaba:{model:`paraformer-v2`},openai:{model:`whisper-1`},providers:{"xopc-local":{model:`sensevoice-small`}},fallback:{enabled:!1,order:[`xopc-local`]}}}function u(){return{enabled:!0,provider:`edge`,trigger:`inbound`,maxTextLength:512,timeoutMs:6e4,alibaba:{model:`qwen-tts`,voice:`Cherry`},openai:{model:`tts-1`,voice:`alloy`},edge:{voice:`zh-CN-XiaoxiaoNeural`,lang:`zh-CN`},minimax:{model:`speech-2.8-hd`,voice:`male-qn-qingse`},"tts-local-cli":{command:``,outputFormat:`wav`}}}function d(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function f(e){return typeof e==`string`&&e.trim().length>0?e.trim():`xopc-local`}function p(e,t,n){let r=d(e.providers)?e.providers:void 0,i=r&&d(r[t])?r[t]:void 0;return{...n,...i??{}}}function m(e){let t=l();if(!d(e))return t;let n=f(e.provider),r=p(e,`alibaba`,t.alibaba??{}),i=p(e,`openai`,t.openai??{}),a=t.fallback??{enabled:!1,order:[`xopc-local`]};if(d(e.fallback)){let t=Array.isArray(e.fallback.order)?e.fallback.order.filter(e=>typeof e==`string`&&e.trim().length>0):a.order;a={enabled:typeof e.fallback.enabled==`boolean`?e.fallback.enabled:a.enabled,order:t.length?t:a.order}}let o=d(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,d(t)?{...t}:{}])):void 0;return{enabled:!!e.enabled,provider:n,alibaba:r,openai:i,...o?{providers:o}:{},fallback:a}}function h(e){return typeof e==`string`&&e.trim().length>0?e.trim():`edge`}function g(e){let t=u();if(!d(e))return t;let n=h(e.provider),r=e.trigger===`off`||e.trigger===`always`||e.trigger===`inbound`||e.trigger===`tagged`?e.trigger:`inbound`,i=t[`tts-local-cli`]??{},a=d(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,d(t)?{...t}:{}])):void 0;return{enabled:!!e.enabled,provider:n,trigger:r,maxTextLength:typeof e.maxTextLength==`number`&&Number.isFinite(e.maxTextLength)?e.maxTextLength:t.maxTextLength,timeoutMs:typeof e.timeoutMs==`number`&&Number.isFinite(e.timeoutMs)?e.timeoutMs:t.timeoutMs,...a?{providers:a}:{},alibaba:p(e,`alibaba`,t.alibaba??{}),openai:p(e,`openai`,t.openai??{}),edge:p(e,`edge`,t.edge??{}),minimax:p(e,`minimax`,t.minimax??{}),"tts-local-cli":p(e,`tts-local-cli`,i)}}function _(e){let{alibaba:t,openai:n,providers:r,...i}=e,a={...r??{}};return t&&(a.alibaba={...a.alibaba??{},...t}),n&&(a.openai={...a.openai??{},...n}),{...i,...Object.keys(a).length>0?{providers:a}:{}}}function v(e){let{alibaba:t,openai:n,edge:r,minimax:i,"tts-local-cli":a,providers:o,...s}=e,c={...o??{}};return t&&(c.alibaba={...c.alibaba??{},...t}),n&&(c.openai={...c.openai??{},...n}),r&&(c.edge={...c.edge??{},...r}),i&&(c.minimax={...c.minimax??{},...i}),a&&(c[`tts-local-cli`]={...c[`tts-local-cli`]??{},...a}),{...s,...Object.keys(c).length>0?{providers:c}:{}}}function y(e){let t=d(e)?e:{},n=d(t.voice)?t.voice:{},r=d(n.input)?n.input:{},i=d(r.refinement)?r.refinement:{},a=i.mode===`punctuation`||i.mode===`light`||i.mode===`custom`?i.mode:`off`;return{stt:m(t.stt),tts:g(t.tts),voice:{languageMode:n.languageMode===`manual`?`manual`:`auto`,language:n.language===`zh`?`zh`:`en`,input:{refinement:{mode:a,...typeof i.model==`string`&&i.model.trim()?{model:i.model.trim()}:{},...typeof i.customInstruction==`string`?{customInstruction:i.customInstruction}:{}}}}}}async function b(){return y((await a(i(`/api/config`))).payload?.config??{})}async function x(e){await a(i(`/api/config`),{method:`PATCH`,body:JSON.stringify({stt:_(e.stt),tts:v(e.tts),voice:e.voice})}),e.voice.languageMode===`auto`&&await a(i(`/api/voice/language`),{method:`POST`,body:JSON.stringify({language:e.voice.language})}),typeof window<`u`&&window.dispatchEvent(new Event(`voice-config-changed`)),o()}async function S(){let e=await a(i(`/api/voice/models`));if(!e.payload?.models)throw Error(`Missing voice models payload`);return e.payload.models}async function C(){let e=await a(i(`/api/voice/providers`));if(!e.payload?.providers)throw Error(`Missing voice providers payload`);return e.payload}async function w(){let e=await a(i(`/api/voice/stt-providers`));if(!e.payload?.providers)throw Error(`Missing STT providers payload`);return e.payload}async function T(){let e=await a(i(`/api/voice/local/status`));if(!e.payload)throw Error(`Missing local voice status payload`);return e.payload}async function E(e){await a(i(`/api/voice/local/models/${encodeURIComponent(e)}/install`),{method:`POST`,body:`{}`})}async function D(e){await a(i(`/api/voice/local/models/${encodeURIComponent(e)}`),{method:`DELETE`})}async function O(e){let t=await a(i(`/api/voice/tts-test`),{method:`POST`,body:JSON.stringify(e)});if(t.ok===!1){let e=typeof t.error==`string`?t.error:t.error?.message;throw Error(e||`TTS test failed`)}if(!t.payload||typeof t.payload.audio!=`string`||!t.payload.audio.trim())throw Error(`TTS test returned no audio. Check the selected voice engine and try again.`);return t.payload}async function k(e){let t=await a(i(`/api/voice/reveal-api-key`),{method:`POST`,body:JSON.stringify(e)});if(!t.payload)throw Error(`Missing reveal payload`);return t.payload}var A=n();function j(e){let t=(0,c.c)(15),{kind:n,providerId:i,fieldId:a,value:o,onChange:l,labels:u,placeholder:d,className:f}=e,p=d===void 0?`sk-...`:d,m;t[0]!==n||t[1]!==i?(m=()=>k({kind:n,provider:i}).then(M),t[0]=n,t[1]=i,t[2]=m):m=t[2];let h=m,g;t[3]===f?g=t[4]:(g=r(`flex min-w-0 flex-col gap-1.5`,f),t[3]=f,t[4]=g);let _;t[5]!==a||t[6]!==u||t[7]!==l||t[8]!==p||t[9]!==h||t[10]!==o?(_=(0,A.jsx)(s,{id:a,value:o,onChange:l,placeholder:p,labels:u,reveal:h,loadFailedLabel:u.loadFailed,maskedHelp:u.maskedHelp,notInConfigFile:u.notInConfigFile,inputClassName:`text-xs`}),t[5]=a,t[6]=u,t[7]=l,t[8]=p,t[9]=h,t[10]=o,t[11]=_):_=t[11];let v;return t[12]!==g||t[13]!==_?(v=(0,A.jsx)(`div`,{className:g,children:_}),t[12]=g,t[13]=_,t[14]=v):v=t[14],v}function M(e){return e.apiKey??null}export{b as a,y as c,O as d,C as i,x as l,T as n,w as o,S as r,E as s,j as t,D as u};
1
+ import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./cn-JdwAhgNB.js";import{r as i,s as a}from"./locale-store-D6hs74o5.js";import{$a as o,_s as s}from"./index-OJgiMh07.js";e();var c=t();function l(){return{enabled:!0,provider:`xopc-local`,alibaba:{model:`paraformer-v2`},openai:{model:`whisper-1`},providers:{"xopc-local":{model:`sensevoice-small`}},fallback:{enabled:!1,order:[`xopc-local`]}}}function u(){return{enabled:!0,provider:`edge`,trigger:`inbound`,maxTextLength:512,timeoutMs:6e4,alibaba:{model:`qwen-tts`,voice:`Cherry`},openai:{model:`tts-1`,voice:`alloy`},edge:{voice:`zh-CN-XiaoxiaoNeural`,lang:`zh-CN`},minimax:{model:`speech-2.8-hd`,voice:`male-qn-qingse`},"tts-local-cli":{command:``,outputFormat:`wav`}}}function d(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function f(e){return typeof e==`string`&&e.trim().length>0?e.trim():`xopc-local`}function p(e,t,n){let r=d(e.providers)?e.providers:void 0,i=r&&d(r[t])?r[t]:void 0;return{...n,...i??{}}}function m(e){let t=l();if(!d(e))return t;let n=f(e.provider),r=p(e,`alibaba`,t.alibaba??{}),i=p(e,`openai`,t.openai??{}),a=t.fallback??{enabled:!1,order:[`xopc-local`]};if(d(e.fallback)){let t=Array.isArray(e.fallback.order)?e.fallback.order.filter(e=>typeof e==`string`&&e.trim().length>0):a.order;a={enabled:typeof e.fallback.enabled==`boolean`?e.fallback.enabled:a.enabled,order:t.length?t:a.order}}let o=d(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,d(t)?{...t}:{}])):void 0;return{enabled:!!e.enabled,provider:n,alibaba:r,openai:i,...o?{providers:o}:{},fallback:a}}function h(e){return typeof e==`string`&&e.trim().length>0?e.trim():`edge`}function g(e){let t=u();if(!d(e))return t;let n=h(e.provider),r=e.trigger===`off`||e.trigger===`always`||e.trigger===`inbound`||e.trigger===`tagged`?e.trigger:`inbound`,i=t[`tts-local-cli`]??{},a=d(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,d(t)?{...t}:{}])):void 0;return{enabled:!!e.enabled,provider:n,trigger:r,maxTextLength:typeof e.maxTextLength==`number`&&Number.isFinite(e.maxTextLength)?e.maxTextLength:t.maxTextLength,timeoutMs:typeof e.timeoutMs==`number`&&Number.isFinite(e.timeoutMs)?e.timeoutMs:t.timeoutMs,...a?{providers:a}:{},alibaba:p(e,`alibaba`,t.alibaba??{}),openai:p(e,`openai`,t.openai??{}),edge:p(e,`edge`,t.edge??{}),minimax:p(e,`minimax`,t.minimax??{}),"tts-local-cli":p(e,`tts-local-cli`,i)}}function _(e){let{alibaba:t,openai:n,providers:r,...i}=e,a={...r??{}};return t&&(a.alibaba={...a.alibaba??{},...t}),n&&(a.openai={...a.openai??{},...n}),{...i,...Object.keys(a).length>0?{providers:a}:{}}}function v(e){let{alibaba:t,openai:n,edge:r,minimax:i,"tts-local-cli":a,providers:o,...s}=e,c={...o??{}};return t&&(c.alibaba={...c.alibaba??{},...t}),n&&(c.openai={...c.openai??{},...n}),r&&(c.edge={...c.edge??{},...r}),i&&(c.minimax={...c.minimax??{},...i}),a&&(c[`tts-local-cli`]={...c[`tts-local-cli`]??{},...a}),{...s,...Object.keys(c).length>0?{providers:c}:{}}}function y(e){let t=d(e)?e:{},n=d(t.voice)?t.voice:{},r=d(n.input)?n.input:{},i=d(r.refinement)?r.refinement:{},a=i.mode===`punctuation`||i.mode===`light`||i.mode===`custom`?i.mode:`off`;return{stt:m(t.stt),tts:g(t.tts),voice:{languageMode:n.languageMode===`manual`?`manual`:`auto`,language:n.language===`zh`?`zh`:`en`,input:{refinement:{mode:a,...typeof i.model==`string`&&i.model.trim()?{model:i.model.trim()}:{},...typeof i.customInstruction==`string`?{customInstruction:i.customInstruction}:{}}}}}}async function b(){return y((await a(i(`/api/config`))).payload?.config??{})}async function x(e){await a(i(`/api/config`),{method:`PATCH`,body:JSON.stringify({stt:_(e.stt),tts:v(e.tts),voice:e.voice})}),e.voice.languageMode===`auto`&&await a(i(`/api/voice/language`),{method:`POST`,body:JSON.stringify({language:e.voice.language})}),typeof window<`u`&&window.dispatchEvent(new Event(`voice-config-changed`)),o()}async function S(){let e=await a(i(`/api/voice/models`));if(!e.payload?.models)throw Error(`Missing voice models payload`);return e.payload.models}async function C(){let e=await a(i(`/api/voice/providers`));if(!e.payload?.providers)throw Error(`Missing voice providers payload`);return e.payload}async function w(){let e=await a(i(`/api/voice/stt-providers`));if(!e.payload?.providers)throw Error(`Missing STT providers payload`);return e.payload}async function T(){let e=await a(i(`/api/voice/local/status`));if(!e.payload)throw Error(`Missing local voice status payload`);return e.payload}async function E(e){await a(i(`/api/voice/local/models/${encodeURIComponent(e)}/install`),{method:`POST`,body:`{}`})}async function D(e){await a(i(`/api/voice/local/models/${encodeURIComponent(e)}`),{method:`DELETE`})}async function O(e){let t=await a(i(`/api/voice/tts-test`),{method:`POST`,body:JSON.stringify(e)});if(t.ok===!1){let e=typeof t.error==`string`?t.error:t.error?.message;throw Error(e||`TTS test failed`)}if(!t.payload||typeof t.payload.audio!=`string`||!t.payload.audio.trim())throw Error(`TTS test returned no audio. Check the selected voice engine and try again.`);return t.payload}async function k(e){let t=await a(i(`/api/voice/reveal-api-key`),{method:`POST`,body:JSON.stringify(e)});if(!t.payload)throw Error(`Missing reveal payload`);return t.payload}var A=n();function j(e){let t=(0,c.c)(15),{kind:n,providerId:i,fieldId:a,value:o,onChange:l,labels:u,placeholder:d,className:f}=e,p=d===void 0?`sk-...`:d,m;t[0]!==n||t[1]!==i?(m=()=>k({kind:n,provider:i}).then(M),t[0]=n,t[1]=i,t[2]=m):m=t[2];let h=m,g;t[3]===f?g=t[4]:(g=r(`flex min-w-0 flex-col gap-1.5`,f),t[3]=f,t[4]=g);let _;t[5]!==a||t[6]!==u||t[7]!==l||t[8]!==p||t[9]!==h||t[10]!==o?(_=(0,A.jsx)(s,{id:a,value:o,onChange:l,placeholder:p,labels:u,reveal:h,loadFailedLabel:u.loadFailed,maskedHelp:u.maskedHelp,notInConfigFile:u.notInConfigFile,inputClassName:`text-xs`}),t[5]=a,t[6]=u,t[7]=l,t[8]=p,t[9]=h,t[10]=o,t[11]=_):_=t[11];let v;return t[12]!==g||t[13]!==_?(v=(0,A.jsx)(`div`,{className:g,children:_}),t[12]=g,t[13]=_,t[14]=v):v=t[14],v}function M(e){return e.apiKey??null}export{b as a,y as c,O as d,C as i,x as l,T as n,w as o,S as r,E as s,j as t,D as u};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./messages-CPxz48hr.js";import{n as a}from"./locale-store-Bff30u5V.js";import{Bo as o,Ds as s,Es as c,Ho as l,Io as u,Ro as d,Vo as f,fo as p,ks as m,zo as h}from"./index-vi5KlR5_.js";import{WorkDiscoveryPage as g}from"./work-discovery-page-fNvSg40M.js";var _=n(),v=e(t(),1),y=r(),b=180;function x(e){let t=(0,_.c)(40),{requestedOpen:n,onExited:r}=e,x=a(C),w=p(S),[T,E]=(0,v.useState)(!0),D=(0,v.useRef)(!1),O=(0,v.useRef)(null),k;t[0]===x?k=t[1]:(k=i(x),t[0]=x,t[1]=k);let A=k.onboarding.workDiscovery,j=w?x===`zh`?`在后台继续`:`Continue in background`:x===`zh`?`稍后再说`:`Maybe later`,M;t[2]===r?M=t[3]:(M=()=>{if(D.current)return;D.current=!0,E(!1);let e=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?0:b;O.current=window.setTimeout(r,e)},t[2]=r,t[3]=M);let N=M,P,F;t[4]!==N||t[5]!==n?(P=()=>{n||N()},F=[N,n],t[4]=N,t[5]=n,t[6]=P,t[7]=F):(P=t[6],F=t[7]),(0,v.useEffect)(P,F);let I,L;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>()=>{O.current!==null&&window.clearTimeout(O.current)},L=[],t[8]=I,t[9]=L):(I=t[8],L=t[9]),(0,v.useEffect)(I,L);let R;t[10]===N?R=t[11]:(R=e=>{e||N()},t[10]=N,t[11]=R);let z;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,y.jsx)(o,{className:`xopc-dialog-overlay fixed inset-0 z-[75] bg-scrim backdrop-blur-[1px]`}),t[12]=z):z=t[12];let B;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,y.jsx)(s,{className:`size-7 shrink-0`,"aria-hidden":!0}),t[13]=B):B=t[13];let V;t[14]===A.title?V=t[15]:(V=(0,y.jsx)(l,{className:`truncate text-sm font-semibold text-fg`,children:A.title}),t[14]=A.title,t[15]=V);let H;t[16]===A.subtitle?H=t[17]:(H=(0,y.jsx)(h,{className:`sr-only`,children:A.subtitle}),t[16]=A.subtitle,t[17]=H);let U;t[18]!==V||t[19]!==H?(U=(0,y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[B,V,H]}),t[18]=V,t[19]=H,t[20]=U):U=t[20];let W;t[21]===j?W=t[22]:(W=(0,y.jsx)(`span`,{className:`hidden text-xs sm:inline`,children:j}),t[21]=j,t[22]=W);let G;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,y.jsx)(m,{className:`size-4`,"aria-hidden":!0}),t[23]=G):G=t[23];let K;t[24]!==j||t[25]!==N||t[26]!==W?(K=(0,y.jsxs)(c,{type:`button`,variant:`ghost`,className:`h-9 shrink-0 gap-1.5 px-2.5 text-fg-muted`,title:j,"aria-label":j,onClick:N,children:[W,G]}),t[24]=j,t[25]=N,t[26]=W,t[27]=K):K=t[27];let q;t[28]!==U||t[29]!==K?(q=(0,y.jsxs)(`header`,{className:`flex h-14 shrink-0 items-center justify-between gap-4 border-b border-edge bg-surface-panel px-4 sm:px-5`,children:[U,K]}),t[28]=U,t[29]=K,t[30]=q):q=t[30];let J;t[31]===N?J=t[32]:(J=(0,y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,y.jsx)(g,{embedded:!0,onRequestClose:N})}),t[31]=N,t[32]=J);let Y;t[33]!==q||t[34]!==J?(Y=(0,y.jsxs)(f,{children:[z,(0,y.jsx)(d,{className:`xopc-work-discovery-dialog pointer-events-none fixed inset-0 z-[76] flex items-center justify-center p-3 outline-none sm:p-6`,children:(0,y.jsxs)(`section`,{className:`xopc-work-discovery-panel pointer-events-auto flex h-[min(47.5rem,calc(100dvh-1.5rem))] w-[min(45rem,calc(100vw-1.5rem))] flex-col overflow-hidden rounded-2xl border border-edge bg-surface-base shadow-float sm:h-[min(47.5rem,calc(100dvh-3rem))] sm:w-[min(45rem,calc(100vw-3rem))]`,children:[q,J]})})]}),t[33]=q,t[34]=J,t[35]=Y):Y=t[35];let X;return t[36]!==T||t[37]!==Y||t[38]!==R?(X=(0,y.jsx)(u,{open:T,onOpenChange:R,children:Y}),t[36]=T,t[37]=Y,t[38]=R,t[39]=X):X=t[39],X}function S(e){return e.status===`running`}function C(e){return e.language}export{x as WorkDiscoveryOverlay};
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"./messages-D02NNLCZ.js";import{n as a}from"./locale-store-D6hs74o5.js";import{Bo as o,Ds as s,Es as c,Ho as l,Io as u,Ro as d,Vo as f,fo as p,ks as m,zo as h}from"./index-OJgiMh07.js";import{WorkDiscoveryPage as g}from"./work-discovery-page-BBVnRHju.js";var _=n(),v=e(t(),1),y=r(),b=180;function x(e){let t=(0,_.c)(40),{requestedOpen:n,onExited:r}=e,x=a(C),w=p(S),[T,E]=(0,v.useState)(!0),D=(0,v.useRef)(!1),O=(0,v.useRef)(null),k;t[0]===x?k=t[1]:(k=i(x),t[0]=x,t[1]=k);let A=k.onboarding.workDiscovery,j=w?x===`zh`?`在后台继续`:`Continue in background`:x===`zh`?`稍后再说`:`Maybe later`,M;t[2]===r?M=t[3]:(M=()=>{if(D.current)return;D.current=!0,E(!1);let e=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?0:b;O.current=window.setTimeout(r,e)},t[2]=r,t[3]=M);let N=M,P,F;t[4]!==N||t[5]!==n?(P=()=>{n||N()},F=[N,n],t[4]=N,t[5]=n,t[6]=P,t[7]=F):(P=t[6],F=t[7]),(0,v.useEffect)(P,F);let I,L;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>()=>{O.current!==null&&window.clearTimeout(O.current)},L=[],t[8]=I,t[9]=L):(I=t[8],L=t[9]),(0,v.useEffect)(I,L);let R;t[10]===N?R=t[11]:(R=e=>{e||N()},t[10]=N,t[11]=R);let z;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,y.jsx)(o,{className:`xopc-dialog-overlay fixed inset-0 z-[75] bg-scrim backdrop-blur-[1px]`}),t[12]=z):z=t[12];let B;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,y.jsx)(s,{className:`size-7 shrink-0`,"aria-hidden":!0}),t[13]=B):B=t[13];let V;t[14]===A.title?V=t[15]:(V=(0,y.jsx)(l,{className:`truncate text-sm font-semibold text-fg`,children:A.title}),t[14]=A.title,t[15]=V);let H;t[16]===A.subtitle?H=t[17]:(H=(0,y.jsx)(h,{className:`sr-only`,children:A.subtitle}),t[16]=A.subtitle,t[17]=H);let U;t[18]!==V||t[19]!==H?(U=(0,y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[B,V,H]}),t[18]=V,t[19]=H,t[20]=U):U=t[20];let W;t[21]===j?W=t[22]:(W=(0,y.jsx)(`span`,{className:`hidden text-xs sm:inline`,children:j}),t[21]=j,t[22]=W);let G;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,y.jsx)(m,{className:`size-4`,"aria-hidden":!0}),t[23]=G):G=t[23];let K;t[24]!==j||t[25]!==N||t[26]!==W?(K=(0,y.jsxs)(c,{type:`button`,variant:`ghost`,className:`h-9 shrink-0 gap-1.5 px-2.5 text-fg-muted`,title:j,"aria-label":j,onClick:N,children:[W,G]}),t[24]=j,t[25]=N,t[26]=W,t[27]=K):K=t[27];let q;t[28]!==U||t[29]!==K?(q=(0,y.jsxs)(`header`,{className:`flex h-14 shrink-0 items-center justify-between gap-4 border-b border-edge bg-surface-panel px-4 sm:px-5`,children:[U,K]}),t[28]=U,t[29]=K,t[30]=q):q=t[30];let J;t[31]===N?J=t[32]:(J=(0,y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,y.jsx)(g,{embedded:!0,onRequestClose:N})}),t[31]=N,t[32]=J);let Y;t[33]!==q||t[34]!==J?(Y=(0,y.jsxs)(f,{children:[z,(0,y.jsx)(d,{className:`xopc-work-discovery-dialog pointer-events-none fixed inset-0 z-[76] flex items-center justify-center p-3 outline-none sm:p-6`,children:(0,y.jsxs)(`section`,{className:`xopc-work-discovery-panel pointer-events-auto flex h-[min(47.5rem,calc(100dvh-1.5rem))] w-[min(45rem,calc(100vw-1.5rem))] flex-col overflow-hidden rounded-2xl border border-edge bg-surface-base shadow-float sm:h-[min(47.5rem,calc(100dvh-3rem))] sm:w-[min(45rem,calc(100vw-3rem))]`,children:[q,J]})})]}),t[33]=q,t[34]=J,t[35]=Y):Y=t[35];let X;return t[36]!==T||t[37]!==Y||t[38]!==R?(X=(0,y.jsx)(u,{open:T,onOpenChange:R,children:Y}),t[36]=T,t[37]=Y,t[38]=R,t[39]=X):X=t[39],X}function S(e){return e.status===`running`}function C(e){return e.language}export{x as WorkDiscoveryOverlay};