@xopcai/xopc 0.0.283 → 0.0.285

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 (234) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{activity-store-iPtG94qr.js → activity-store-B0BTIk9j.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DQ74xqLi.js → agent-avatar-dicebear-Dc-0QZTQ.js} +1 -1
  5. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CcmqK1Sc.js +1 -0
  6. package/dist/gateway/static/root/assets/agents-B_7PVt7S.js +1 -0
  7. package/dist/gateway/static/root/assets/api-COG_Tzpv.js +1 -0
  8. package/dist/gateway/static/root/assets/{api-KMJzMqvZ.js → api-Coly9ab6.js} +1 -1
  9. package/dist/gateway/static/root/assets/{app-management-settings-panel-B42TpqIb.js → app-management-settings-panel-TWBO-msg.js} +1 -1
  10. package/dist/gateway/static/root/assets/{appearance-settings-D9Lfe7Sk.js → appearance-settings-CpTZ2KuT.js} +1 -1
  11. package/dist/gateway/static/root/assets/apps-page-6qxxKFsK.js +1 -0
  12. package/dist/gateway/static/root/assets/{archive-plugin-BdmQwj4x.js → archive-plugin-z_u6alob.js} +1 -1
  13. package/dist/gateway/static/root/assets/{attachment-load-B4S0_nji.js → attachment-load-C2nS04TC.js} +1 -1
  14. package/dist/gateway/static/root/assets/{automations-page-B3TmHNjQ.js → automations-page-aIBsw9zR.js} +1 -1
  15. package/dist/gateway/static/root/assets/automations-workspace-BRQlU4qk.js +6 -0
  16. package/dist/gateway/static/root/assets/{binary-plugins-B3cXF_DP.js → binary-plugins-CGmXoZnl.js} +1 -1
  17. package/dist/gateway/static/root/assets/{block-editor-05zyBXBe.js → block-editor-CtvzCZhC.js} +3 -3
  18. package/dist/gateway/static/root/assets/{browser-automation-inputs-BTIufVbM.js → browser-automation-inputs-BOTU1isH.js} +1 -1
  19. package/dist/gateway/static/root/assets/{browser-automations-page-DRBA9nwe.js → browser-automations-page-BwU5V8J0.js} +2 -2
  20. package/dist/gateway/static/root/assets/browser-settings-page-DDjbDeHQ.js +8 -0
  21. package/dist/gateway/static/root/assets/capabilities-settings-panel-DM1Bcf1x.js +8 -0
  22. package/dist/gateway/static/root/assets/channels-settings-Bq36CUxL.js +1 -0
  23. package/dist/gateway/static/root/assets/{channels-status-swr-DMYQNs-J.js → channels-status-swr-Dfi0Desh.js} +1 -1
  24. package/dist/gateway/static/root/assets/{chat-terminal-dock-Dx5KQyo5.js → chat-terminal-dock-B0MvcO6j.js} +2 -2
  25. package/dist/gateway/static/root/assets/connectors-page-L8JehrxF.js +2 -0
  26. package/dist/gateway/static/root/assets/{date-picker-CkDROZoe.js → date-picker-DXOvbHCr.js} +1 -1
  27. package/dist/gateway/static/root/assets/{dependency-picker-Bl8HcvzL.js → dependency-picker-BEnC-eS0.js} +1 -1
  28. package/dist/gateway/static/root/assets/{desktop-pet-BcknAjbW.js → desktop-pet-DtPNvznL.js} +1 -1
  29. package/dist/gateway/static/root/assets/{desktop-pet-settings-BuCpXQPm.js → desktop-pet-settings-CYyjcSn6.js} +1 -1
  30. package/dist/gateway/static/root/assets/device-pairing-wizard-BPMGvAKE.js +1 -0
  31. package/dist/gateway/static/root/assets/{extension-debug-page-qRpb2FFa.js → extension-debug-page-H_aPMGXW.js} +1 -1
  32. package/dist/gateway/static/root/assets/{extension-page-C7gs9wu4.js → extension-page-C1JnpeMt.js} +1 -1
  33. package/dist/gateway/static/root/assets/{extension-settings-page-CyJP1CMZ.js → extension-settings-page-C75kCOqe.js} +1 -1
  34. package/dist/gateway/static/root/assets/{gateway-config-swr-Cpmyrr6j.js → gateway-config-swr-G2lQt7Ak.js} +1 -1
  35. package/dist/gateway/static/root/assets/gateway-settings-BCF732TU.js +1 -0
  36. package/dist/gateway/static/root/assets/{gateway-startup-retry-DoiPeb65.js → gateway-startup-retry-GP31PUrG.js} +1 -1
  37. package/dist/gateway/static/root/assets/{heartbeat-settings-CV6Dolcn.js → heartbeat-settings-C7fjiowt.js} +1 -1
  38. package/dist/gateway/static/root/assets/home-page-DZXeXdUL.js +1 -0
  39. package/dist/gateway/static/root/assets/{image-generation-api-CqjHWl2T.js → image-generation-api-CKFhfHSw.js} +1 -1
  40. package/dist/gateway/static/root/assets/imports-page-GROumhj8.js +1 -0
  41. package/dist/gateway/static/root/assets/{index-CHgOG1aR.js → index-ChIrvv3t.js} +47 -47
  42. package/dist/gateway/static/root/assets/index-R1VNlHjj.css +2 -0
  43. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-B3XqA41D.js → keyboard-shortcuts-settings-zcI822m_.js} +1 -1
  44. package/dist/gateway/static/root/assets/local-app-workbench-page-CAEKGTAg.js +2 -0
  45. package/dist/gateway/static/root/assets/{local-apps-page-BcIVYp0J.js → local-apps-page-BtgDJ92Q.js} +1 -1
  46. package/dist/gateway/static/root/assets/{locale-store-1urrBBCQ.js → locale-store-DlOv7896.js} +1 -1
  47. package/dist/gateway/static/root/assets/logs-page-DHZ4BEkG.js +2 -0
  48. package/dist/gateway/static/root/assets/{management-settings-DNFCdgzR.js → management-settings-DasZxCyD.js} +1 -1
  49. package/dist/gateway/static/root/assets/{markdown-view-BZmcFIWa.js → markdown-view-6oYdBahT.js} +1 -1
  50. package/dist/gateway/static/root/assets/{media-plugins-BDxNhoBC.js → media-plugins-CxthbBvk.js} +1 -1
  51. package/dist/gateway/static/root/assets/messages-Ls1Aaiqd.js +3 -0
  52. package/dist/gateway/static/root/assets/note-detail-panel-BcWq3ddw.js +5 -0
  53. package/dist/gateway/static/root/assets/notes-page-DfZ8QWyv.js +8 -0
  54. package/dist/gateway/static/root/assets/{page-tabs-agH3a2PI.js → page-tabs-BG39KidE.js} +1 -1
  55. package/dist/gateway/static/root/assets/{preview-open-alternatives-XEZ7zDOP.js → preview-open-alternatives-Bevpbq9f.js} +1 -1
  56. package/dist/gateway/static/root/assets/proactive-page-D2U_xQaS.js +1 -0
  57. package/dist/gateway/static/root/assets/{product-open-page-lXAbj85Z.js → product-open-page-Bi1seZpM.js} +1 -1
  58. package/dist/gateway/static/root/assets/project-detail-page-CzlGTW4F.js +1 -0
  59. package/dist/gateway/static/root/assets/projects-page-mQsM-TsP.js +1 -0
  60. package/dist/gateway/static/root/assets/{registry-api-CxQstD00.js → registry-api-D0ddwBFj.js} +1 -1
  61. package/dist/gateway/static/root/assets/remote-access-hub-Cb56JcO1.js +1 -0
  62. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DErKZlVJ.js → runtime-tools-settings-panel-Wkru8_My.js} +2 -2
  63. package/dist/gateway/static/root/assets/{schema-form-DhCmJQVJ.js → schema-form-CSMRzj9Y.js} +1 -1
  64. package/dist/gateway/static/root/assets/sessions-page-Hj9uFcIO.js +1 -0
  65. package/dist/gateway/static/root/assets/settings-advanced-gate-CV4-_EVA.js +1 -0
  66. package/dist/gateway/static/root/assets/{settings-form-section-Dg6chotg.js → settings-form-section-wcAdCkK8.js} +1 -1
  67. package/dist/gateway/static/root/assets/{settings-page-LyuN5N3M.js → settings-page-BcQGAnCs.js} +1 -1
  68. package/dist/gateway/static/root/assets/setup-status-panel-DzxmsaQG.js +1 -0
  69. package/dist/gateway/static/root/assets/{share-preview-page-CZvmf4Ob.js → share-preview-page-DQocUl-1.js} +1 -1
  70. package/dist/gateway/static/root/assets/shares-settings-xlJh1ccG.js +1 -0
  71. package/dist/gateway/static/root/assets/skill-reload-api-wSXJRSxX.js +1 -0
  72. package/dist/gateway/static/root/assets/skills-page-AmqtBJo7.js +2 -0
  73. package/dist/gateway/static/root/assets/{skills-page.utils-Eu0WVHTS.js → skills-page.utils-DtlfCgJp.js} +1 -1
  74. package/dist/gateway/static/root/assets/{system-settings-panel-DQKkM7B2.js → system-settings-panel-Ct698Nf-.js} +1 -1
  75. package/dist/gateway/static/root/assets/task-detail-page-sQpwq5-c.js +1 -0
  76. package/dist/gateway/static/root/assets/{theme-store-Dc5s20V3.js → theme-store-ng8KJsAT.js} +1 -1
  77. package/dist/gateway/static/root/assets/{tunnel-api-TKQpPVd6.js → tunnel-api-Boajol0M.js} +1 -1
  78. package/dist/gateway/static/root/assets/{use-autosave-CkVlrFk1.js → use-autosave-BSyxRHt2.js} +1 -1
  79. package/dist/gateway/static/root/assets/user-model-page-DIEHnAER.js +2 -0
  80. package/dist/gateway/static/root/assets/{voice-api-key-field-B12fFN-L.js → voice-api-key-field-SE3OQI1s.js} +1 -1
  81. package/dist/gateway/static/root/assets/{voice-config-api-Mk78BrpP.js → voice-config-api-VNuCmdFe.js} +1 -1
  82. package/dist/gateway/static/root/assets/{work-discovery-overlay-CT9Zy36i.js → work-discovery-overlay-Dn1vy2oq.js} +1 -1
  83. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BwefQliE.js → workflow-run-setup-panel-BJEfGY-k.js} +2 -2
  84. package/dist/gateway/static/root/assets/workflows-page-DgRNIyr7.js +6 -0
  85. package/dist/gateway/static/root/index.html +10 -10
  86. package/dist/package.js +1 -1
  87. package/dist/packages/gateway-contract/src/proactive.js +13 -4
  88. package/dist/src/agent/coding/repository-instructions.js +1 -1
  89. package/dist/src/agent/coding/workspace-revision.js +1 -1
  90. package/dist/src/agent/commands/command-isolation.js +1 -1
  91. package/dist/src/agent/tools/factory.js +7 -3
  92. package/dist/src/agent/tools/review-workspace.js +1 -1
  93. package/dist/src/browser/providers/browser-ext-install.js +10 -2
  94. package/dist/src/cli/command-loaders.js +1 -0
  95. package/dist/src/cli/command-manifest.js +4 -0
  96. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  97. package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
  98. package/dist/src/cli/commands/gateway/run-foreground.js +3 -0
  99. package/dist/src/cli/commands/import.d.ts +2 -0
  100. package/dist/src/cli/commands/import.js +78 -0
  101. package/dist/src/discussions/action-tasks.js +1 -1
  102. package/dist/src/discussions/edits.js +1 -1
  103. package/dist/src/discussions/index.js +1 -1
  104. package/dist/src/discussions/organizer.js +1 -1
  105. package/dist/src/discussions/recording.js +1 -1
  106. package/dist/src/discussions/sealer.js +1 -1
  107. package/dist/src/discussions/service.js +2 -2
  108. package/dist/src/endpoint-tools/invocation-service.d.ts +2 -0
  109. package/dist/src/endpoint-tools/invocation-service.js +48 -19
  110. package/dist/src/gateway/heartbeat/check-store.d.ts +18 -0
  111. package/dist/src/gateway/heartbeat/check-store.js +73 -0
  112. package/dist/src/gateway/heartbeat/service.d.ts +12 -3
  113. package/dist/src/gateway/heartbeat/service.js +61 -44
  114. package/dist/src/gateway/hono/routes/discussions.js +2 -2
  115. package/dist/src/gateway/hono/routes/imports.d.ts +3 -0
  116. package/dist/src/gateway/hono/routes/imports.js +56 -0
  117. package/dist/src/gateway/hono/routes/lazy-bundles.js +8 -0
  118. package/dist/src/gateway/hono/routes/proactive-control.js +2 -1
  119. package/dist/src/gateway/service.d.ts +7 -0
  120. package/dist/src/gateway/service.js +26 -9
  121. package/dist/src/imports/compatibility.d.ts +7 -0
  122. package/dist/src/imports/compatibility.js +174 -0
  123. package/dist/src/imports/contextImport.d.ts +3 -0
  124. package/dist/src/imports/contextImport.js +56 -0
  125. package/dist/src/imports/files.d.ts +13 -0
  126. package/dist/src/imports/files.js +77 -0
  127. package/dist/src/imports/importService.d.ts +50 -0
  128. package/dist/src/imports/importService.js +414 -0
  129. package/dist/src/imports/inventory.d.ts +11 -0
  130. package/dist/src/imports/inventory.js +202 -0
  131. package/dist/src/imports/planner.d.ts +11 -0
  132. package/dist/src/imports/planner.js +98 -0
  133. package/dist/src/imports/productImport.d.ts +10 -0
  134. package/dist/src/imports/productImport.js +241 -0
  135. package/dist/src/imports/runtime.d.ts +5 -0
  136. package/dist/src/imports/runtime.js +61 -0
  137. package/dist/src/imports/scanner.d.ts +14 -0
  138. package/dist/src/imports/scanner.js +159 -0
  139. package/dist/src/imports/secrets.d.ts +2 -0
  140. package/dist/src/imports/secrets.js +9 -0
  141. package/dist/src/imports/sources.d.ts +37 -0
  142. package/dist/src/imports/sources.js +75 -0
  143. package/dist/src/imports/types.d.ts +144 -0
  144. package/dist/src/imports/types.js +11 -0
  145. package/dist/src/infra/background-task.d.ts +2 -0
  146. package/dist/src/infra/background-task.js +25 -0
  147. package/dist/src/infra/process-diagnostics.d.ts +5 -0
  148. package/dist/src/infra/process-diagnostics.js +97 -0
  149. package/dist/src/infra/unhandled-rejections.js +6 -3
  150. package/dist/src/infra/update-restart.js +1 -1
  151. package/dist/src/knowledge/ingestion-service.js +1 -0
  152. package/dist/src/knowledge-memory/repository.js +4 -2
  153. package/dist/src/media-shared/http/ssrf-guard.js +1 -1
  154. package/dist/src/notifications/proactive-policy.js +7 -5
  155. package/dist/src/proactive/execution/authorization.d.ts +2 -0
  156. package/dist/src/proactive/execution/authorization.js +10 -1
  157. package/dist/src/proactive/execution/context.js +1 -0
  158. package/dist/src/proactive/execution/repository.d.ts +2 -0
  159. package/dist/src/proactive/execution/repository.js +19 -2
  160. package/dist/src/proactive/execution/worker.js +14 -4
  161. package/dist/src/proactive/experience.d.ts +4 -1
  162. package/dist/src/proactive/experience.js +3 -0
  163. package/dist/src/proactive/follow-ups.d.ts +5 -0
  164. package/dist/src/proactive/follow-ups.js +18 -7
  165. package/dist/src/proactive/inbox/cards.js +2 -1
  166. package/dist/src/proactive/inbox/delivery.js +6 -7
  167. package/dist/src/proactive/inbox/digest.d.ts +1 -1
  168. package/dist/src/proactive/inbox/digest.js +23 -13
  169. package/dist/src/proactive/inbox/notification-policy.d.ts +1 -1
  170. package/dist/src/proactive/inbox/notification-policy.js +9 -6
  171. package/dist/src/proactive/inbox/repository.js +3 -2
  172. package/dist/src/proactive/inbox/service.d.ts +6 -0
  173. package/dist/src/proactive/inbox/service.js +18 -0
  174. package/dist/src/proactive/inbox/types.d.ts +1 -0
  175. package/dist/src/proactive/policy/presence.d.ts +1 -1
  176. package/dist/src/proactive/policy/presence.js +7 -5
  177. package/dist/src/proactive/policy/service.d.ts +8 -5
  178. package/dist/src/proactive/policy/service.js +12 -12
  179. package/dist/src/proactive/scenarios/control.d.ts +3 -3
  180. package/dist/src/proactive/scenarios/control.js +12 -2
  181. package/dist/src/proactive/source-freshness.d.ts +8 -0
  182. package/dist/src/proactive/source-freshness.js +27 -0
  183. package/dist/src/proactive/status.d.ts +2 -0
  184. package/dist/src/proactive/status.js +21 -0
  185. package/dist/src/proactive/temporal/worker.js +2 -1
  186. package/dist/src/realtime/runtime.js +31 -5
  187. package/dist/src/realtime/writer.js +16 -9
  188. package/dist/src/storage/sqlite/import-repository.d.ts +18 -0
  189. package/dist/src/storage/sqlite/import-repository.js +35 -0
  190. package/dist/src/storage/sqlite/import-selection-repository.d.ts +15 -0
  191. package/dist/src/storage/sqlite/import-selection-repository.js +28 -0
  192. package/dist/src/storage/sqlite/knowledge-repository.d.ts +1 -0
  193. package/dist/src/storage/sqlite/knowledge-repository.js +2 -2
  194. package/dist/src/storage/sqlite/migrations/174_capability_imports.sql +11 -0
  195. package/dist/src/storage/sqlite/migrations/175_import_selections.sql +8 -0
  196. package/dist/src/storage/sqlite/migrations/176_proactive_quality.sql +5 -0
  197. package/dist/src/storage/sqlite/migrations/177_proactive_check_controls.sql +25 -0
  198. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  199. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  200. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  201. package/dist/src/storage/sqlite/schema.js +1 -1
  202. package/dist/src/work-discovery/candidate-discovery.js +1 -1
  203. package/dist/src/work-discovery/probe.js +1 -1
  204. package/package.json +4 -3
  205. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-SElFkQd6.js +0 -1
  206. package/dist/gateway/static/root/assets/agents-DYazUaZ6.js +0 -1
  207. package/dist/gateway/static/root/assets/apps-page-BzrodN8C.js +0 -1
  208. package/dist/gateway/static/root/assets/automations-workspace--A4I0jMu.js +0 -6
  209. package/dist/gateway/static/root/assets/browser-settings-page-DDTXUNWK.js +0 -8
  210. package/dist/gateway/static/root/assets/capabilities-settings-panel-Ll5UeXq5.js +0 -8
  211. package/dist/gateway/static/root/assets/channels-settings-BzL15bkU.js +0 -1
  212. package/dist/gateway/static/root/assets/connectors-page-RPw1AOMb.js +0 -2
  213. package/dist/gateway/static/root/assets/device-pairing-wizard-D0_tCX49.js +0 -1
  214. package/dist/gateway/static/root/assets/gateway-settings-DOeeTdWE.js +0 -1
  215. package/dist/gateway/static/root/assets/home-page-Djw1H_Go.js +0 -1
  216. package/dist/gateway/static/root/assets/index-B_Sg5BKz.css +0 -2
  217. package/dist/gateway/static/root/assets/local-app-workbench-page-BPqgyYJq.js +0 -2
  218. package/dist/gateway/static/root/assets/logs-page-BHax3XlS.js +0 -2
  219. package/dist/gateway/static/root/assets/messages-DYFcjtmG.js +0 -3
  220. package/dist/gateway/static/root/assets/note-detail-panel-Cs46LFXO.js +0 -5
  221. package/dist/gateway/static/root/assets/notes-page-BUkcn_0t.js +0 -8
  222. package/dist/gateway/static/root/assets/proactive-page-Bn484J9v.js +0 -1
  223. package/dist/gateway/static/root/assets/project-detail-page-LcH21ixD.js +0 -1
  224. package/dist/gateway/static/root/assets/projects-page-DelBiwyB.js +0 -1
  225. package/dist/gateway/static/root/assets/remote-access-hub-3BjFYXCf.js +0 -1
  226. package/dist/gateway/static/root/assets/sessions-page-CVFirgVd.js +0 -1
  227. package/dist/gateway/static/root/assets/settings-advanced-gate-DyfBpqkY.js +0 -1
  228. package/dist/gateway/static/root/assets/setup-status-panel-CrXhTzHr.js +0 -1
  229. package/dist/gateway/static/root/assets/shares-settings-DyM_D8hM.js +0 -1
  230. package/dist/gateway/static/root/assets/skill-reload-api-Bys58-15.js +0 -1
  231. package/dist/gateway/static/root/assets/skills-page-sWNvFo6D.js +0 -2
  232. package/dist/gateway/static/root/assets/task-detail-page-B18NcZQJ.js +0 -1
  233. package/dist/gateway/static/root/assets/user-model-page-ul-zr58b.js +0 -2
  234. package/dist/gateway/static/root/assets/workflows-page-BY_AWs7S.js +0 -6
@@ -0,0 +1,2 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{u as i}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{t as a}from"./check-DUBLcKHA.js";import{n as o,r as s}from"./popover-select-DGmMQt4t.js";import{t as c}from"./circle-check-C23XjkUj.js";import{t as l}from"./clock-3-DnrAnuyZ.js";import{t as u}from"./git-branch-Dh9uxTot.js";import{t as d}from"./loader-circle-CifKLtgG.js";import{t as f}from"./message-circle-Badhj-4D.js";import{t as p}from"./x-B_N4OPjy.js";import{t as m}from"./cn-JdwAhgNB.js";import{n as h}from"./locale-store-DlOv7896.js";import{a as g,c as _,i as v,n as y,o as b,r as x,s as S,t as C}from"./dist-BGTk37IG.js";import{i as w}from"./vendor-swr-BIWyz7Rc.js";import{t as T}from"./button-BA45yciM.js";import{t as E}from"./skeleton-BwbyijEw.js";import{$ as D,$r as O,Au as k,Bu as A,Cu as ee,Dc as j,Gl as M,Gs as N,Ks as P,Pl as F,Q as I,Ql as L,Qr as R,Rl as z,Sc as B,Z as te,bl as V,bu as ne,dc as H,et as U,ic as W,jo as re,mo as G,nl as K,nt as ie,q,rt as ae,sl as J,tl as oe,tt as se,tu as ce,wu as le,xu as Y,zc as ue}from"./index-ChIrvv3t.js";import{t as de}from"./page-tabs-BG39KidE.js";var X=n(),Z=e(t(),1),Q=r(),fe=new Set([`candidate`,`needs_review`,`conflicted`,`stale`]),pe={zh:{eyebrow:`全局用户理解`,title:`xopc 如何形成对你的理解`,subtitle:`这里汇总跨项目、跨对话形成的认识,并说明它们来自哪些渠道。项目事实不会混入你的个人画像。`,channels:`理解渠道`,channelHint:`每个渠道只贡献有依据的候选内容。`,noChannels:`尚未通过任何渠道形成可展示的全局理解。`,activeCount:`{{count}} 条已在使用`,pendingCount:`{{count}} 条待确认`,noUnderstanding:`尚未从这个渠道形成可使用的全局理解`,pending:`需要你确认`,pendingHint:`确认后才会用于其他项目和之后的对话。`,nothingPending:`目前没有需要确认的全局理解。`,source:`来源`,remember:`确认`,discard:`不是这样`,edit:`修正`,save:`保存修正`,cancel:`取消`,showAll:`查看全部 {{count}} 条`,showLess:`收起`,done:`完成`,updating:`正在从已授权渠道更新理解;你可以先查看已有内容。`,sourceKinds:{user:`你明确告诉我的`,conversation:`对话与协作`,connector:`连接的服务`,work_folder:`工作目录`,local_source:`本机来源`,inference:`综合整理`},categories:{identity:`关于你是谁`,preference:`偏好`,value:`价值取向`,routine:`工作习惯`,capability:`能力与职责`,relationship:`协作关系`,current_state:`当前状态`,derived_insight:`综合判断`}},en:{eyebrow:`Global user understanding`,title:`How xopc forms its understanding of you`,subtitle:`This brings together understanding formed across projects and conversations, with the channel behind each item. Project facts stay out of your personal portrait.`,channels:`Understanding channels`,channelHint:`Each channel contributes only evidence-backed candidates.`,noChannels:`No channel has formed displayable global understanding yet.`,activeCount:`{{count}} in use`,pendingCount:`{{count}} to review`,noUnderstanding:`No usable global understanding has formed from this channel yet`,pending:`Needs your confirmation`,pendingHint:`Only confirmed items may be used across projects and future conversations.`,nothingPending:`There is no global understanding to review right now.`,source:`Source`,remember:`Confirm`,discard:`Not true`,edit:`Correct`,save:`Save correction`,cancel:`Cancel`,showAll:`View all {{count}}`,showLess:`Show less`,done:`Done`,updating:`Updating from authorized channels. You can review existing understanding now.`,sourceKinds:{user:`You told me`,conversation:`Conversations and work`,connector:`Connected services`,work_folder:`Work folders`,local_source:`On-device sources`,inference:`Synthesized understanding`},categories:{identity:`Who you are`,preference:`Preference`,value:`Values`,routine:`Routine`,capability:`Capabilities and responsibilities`,relationship:`Collaboration`,current_state:`Current state`,derived_insight:`Synthesis`}}},me={"local-recent-files":{en:`Recent files`,zh:`最近文件`},"chromium-bookmarks":{en:`Recent bookmarks`,zh:`最近书签`},"apple-notes":{en:`Apple Notes`,zh:`Apple 备忘录`},"apple-mail":{en:`Apple Mail`,zh:`Apple 邮件`},"apple-calendar":{en:`Apple Calendar`,zh:`Apple 日历`},"apple-reminders":{en:`Apple Reminders`,zh:`Apple 提醒事项`},"windows-recent-documents":{en:`Recent documents`,zh:`最近文档`},"linux-recent-documents":{en:`Recent documents`,zh:`最近文档`}},he={user:N,conversation:f,connector:L,work_folder:z,local_source:M,inference:L},$={files:z,recent_documents:M,calendar:Y,tasks:J,notes:W,mail:K,messages:f,code_activity:u};function ge(e){let t=e.authority===`user_explicit`?`user`:e.authority===`user_observed`?`conversation`:e.authority===`external_untrusted`?`connector`:`inference`;return{id:t,kind:t,observedAt:e.observedAt}}function _e(e,t){return e.kind===`local_source`&&e.label?me[e.label]?.[t]??e.label:e.kind===`work_folder`&&e.label?t===`zh`?`工作目录 · ${e.label}`:`Work folder · ${e.label}`:e.label?e.label:pe[t].sourceKinds[e.kind]}function ve(e){return`${e.kind}:${e.adapterId}:${e.displayName}`}function ye(e){let t=(0,X.c)(82),{assertions:n,configuredSources:r,activityRunning:i,language:o,busy:s,error:l,onReviewAssertion:u,onCompleted:f}=e,h=pe[o],[g,_]=(0,Z.useState)(!1),[v,y]=(0,Z.useState)(null),[b,x]=(0,Z.useState)(``),S;t[0]===n?S=t[1]:(S=n.filter(Ee),t[0]=n,t[1]=S);let C=S,w;t[2]===C?w=t[3]:(w=C.filter(Te),t[2]=C,t[3]=w);let E=w,D;if(t[4]!==r||t[5]!==C||t[6]!==o){let e=new Map;for(let t of r){let n=t.kind===`local_source`?me[t.adapterId]?.[o]??t.displayName:t.displayName,r=ve(t);e.set(r,{key:r,kind:t.kind,category:t.category,label:t.kind===`work_folder`?o===`zh`?`工作目录 · ${n}`:`Work folder · ${n}`:n,assertions:[],lastObservedAt:t.lastCollectedAt})}for(let t of C)for(let n of t.sources?.length?t.sources:[ge(t)]){let r=_e(n,o),i=[...e.values()].find(e=>e.kind===n.kind&&e.label===r),a=i?.key??`${n.kind}:${r}`,s=i??e.get(a)??{key:a,kind:n.kind,category:n.category,label:r,assertions:[],lastObservedAt:n.observedAt};s.assertions.some(e=>e.id===t.id)||s.assertions.push(t),s.lastObservedAt=Math.max(s.lastObservedAt??0,n.observedAt),e.set(a,s)}D=[...e.values()].sort(we),t[4]=r,t[5]=C,t[6]=o,t[7]=D}else D=t[7];let O=D,k;t[8]===u?k=t[9]:(k=async(e,t,n)=>{await u(e,t,n)&&y(null)},t[8]=u,t[9]=k);let A=k,ee;t[10]!==E||t[11]!==g?(ee=g?E:E.slice(0,5),t[10]=E,t[11]=g,t[12]=ee):ee=t[12];let j=ee,M;t[13]===h.eyebrow?M=t[14]:(M=(0,Q.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.18em] text-accent-fg`,children:h.eyebrow}),t[13]=h.eyebrow,t[14]=M);let N;t[15]===h.title?N=t[16]:(N=(0,Q.jsx)(`h2`,{className:`mt-3 text-2xl font-semibold tracking-tight text-fg sm:text-3xl`,children:h.title}),t[15]=h.title,t[16]=N);let P;t[17]===h.subtitle?P=t[18]:(P=(0,Q.jsx)(`p`,{className:`mx-auto mt-3 max-w-[38rem] text-sm leading-6 text-fg-muted`,children:h.subtitle}),t[17]=h.subtitle,t[18]=P);let F;t[19]!==M||t[20]!==N||t[21]!==P?(F=(0,Q.jsxs)(`div`,{className:`text-center`,children:[M,N,P]}),t[19]=M,t[20]=N,t[21]=P,t[22]=F):F=t[22];let I;t[23]!==i||t[24]!==h.updating?(I=i?(0,Q.jsxs)(`div`,{className:`mt-6 flex items-center gap-3 rounded-2xl border border-accent/20 bg-accent-soft/55 px-4 py-3 text-sm text-accent-fg`,children:[(0,Q.jsx)(d,{className:`size-4 shrink-0 animate-spin motion-reduce:animate-none`}),(0,Q.jsx)(`p`,{children:h.updating})]}):null,t[23]=i,t[24]=h.updating,t[25]=I):I=t[25];let L;t[26]===h.channels?L=t[27]:(L=(0,Q.jsx)(`h3`,{id:`understanding-channels-title`,className:`text-sm font-semibold text-fg`,children:h.channels}),t[26]=h.channels,t[27]=L);let R;t[28]===h.channelHint?R=t[29]:(R=(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:h.channelHint}),t[28]=h.channelHint,t[29]=R);let z;t[30]!==O||t[31]!==h.activeCount||t[32]!==h.noChannels||t[33]!==h.noUnderstanding||t[34]!==h.pendingCount?(z=O.length?(0,Q.jsx)(`div`,{className:`mt-3 space-y-3`,children:O.map(e=>{let t=e.category?$[e.category]??he[e.kind]:he[e.kind],n=e.assertions.filter(Ce).length,r=e.assertions.filter(Se).length;return(0,Q.jsxs)(`article`,{className:`rounded-2xl border border-edge bg-surface-base/55 px-4 py-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-surface-muted text-fg-muted`,children:(0,Q.jsx)(t,{className:`size-4`})}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`h4`,{className:`truncate text-sm font-medium text-fg`,children:e.label}),e.assertions.length?(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[n?h.activeCount.replace(`{{count}}`,String(n)):``,r?h.pendingCount.replace(`{{count}}`,String(r)):``].filter(Boolean).join(` · `)}):(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:h.noUnderstanding})]})]}),e.assertions.length?(0,Q.jsx)(`ul`,{className:`ml-12 mt-3 space-y-2 border-t border-edge-subtle pt-3 text-xs leading-5 text-fg-muted`,children:e.assertions.slice(0,5).map(xe)}):null]},e.key)})}):(0,Q.jsx)(`p`,{className:`mt-3 rounded-2xl border border-edge bg-surface-base/55 p-4 text-sm text-fg-muted`,children:h.noChannels}),t[30]=O,t[31]=h.activeCount,t[32]=h.noChannels,t[33]=h.noUnderstanding,t[34]=h.pendingCount,t[35]=z):z=t[35];let B;t[36]!==L||t[37]!==R||t[38]!==z?(B=(0,Q.jsxs)(`section`,{className:`mt-8`,"aria-labelledby":`understanding-channels-title`,children:[L,R,z]}),t[36]=L,t[37]=R,t[38]=z,t[39]=B):B=t[39];let te=E.length?` · ${E.length}`:``,V;t[40]!==h.pending||t[41]!==te?(V=(0,Q.jsxs)(`h3`,{id:`understanding-pending-title`,className:`text-sm font-semibold text-fg`,children:[h.pending,te]}),t[40]=h.pending,t[41]=te,t[42]=V):V=t[42];let H;t[43]===h.pendingHint?H=t[44]:(H=(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:h.pendingHint}),t[43]=h.pendingHint,t[44]=H);let U;t[45]!==s||t[46]!==b||t[47]!==v||t[48]!==o||t[49]!==E.length||t[50]!==A||t[51]!==g||t[52]!==h.cancel||t[53]!==h.categories||t[54]!==h.discard||t[55]!==h.edit||t[56]!==h.nothingPending||t[57]!==h.remember||t[58]!==h.save||t[59]!==h.showAll||t[60]!==h.showLess||t[61]!==h.source||t[62]!==j?(U=E.length?(0,Q.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[j.map(e=>{let t=v===e.id,n=(e.sources?.length?e.sources:[ge(e)]).map(e=>_e(e,o));return(0,Q.jsxs)(`article`,{className:`rounded-2xl border border-edge bg-surface-panel p-4 shadow-surface sm:p-5`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-[11px]`,children:[(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 font-medium text-accent-fg`,children:h.categories[e.kind]}),(0,Q.jsxs)(`span`,{className:`text-fg-subtle`,children:[h.source,`: `,n.join(` · `)]})]}),t?(0,Q.jsx)(`textarea`,{autoFocus:!0,value:b,onChange:e=>x(e.target.value),className:`mt-3 min-h-24 w-full resize-y rounded-xl border border-edge bg-surface-base px-3 py-2.5 text-sm leading-6 text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/15`}):(0,Q.jsx)(`p`,{className:`mt-3 text-[0.95rem] font-medium leading-7 text-fg`,children:e.statement}),t?(0,Q.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,Q.jsx)(T,{variant:`ghost`,disabled:s,onClick:()=>y(null),children:h.cancel}),(0,Q.jsxs)(T,{variant:`primary`,disabled:s||!b.trim(),onClick:()=>void A(e,`edited`,b.trim()),children:[s?(0,Q.jsx)(d,{className:`size-4 animate-spin`}):(0,Q.jsx)(a,{className:`size-4`}),h.save]})]}):(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-wrap justify-end gap-2`,children:[(0,Q.jsxs)(T,{variant:`ghost`,disabled:s,onClick:()=>{y(e.id),x(e.statement)},children:[(0,Q.jsx)(ue,{className:`size-3.5`}),h.edit]}),(0,Q.jsxs)(T,{variant:`secondary`,disabled:s,onClick:()=>void A(e,`rejected`),children:[(0,Q.jsx)(p,{className:`size-3.5`}),h.discard]}),(0,Q.jsxs)(T,{variant:`primary`,disabled:s,onClick:()=>void A(e,`accepted`),children:[s?(0,Q.jsx)(d,{className:`size-4 animate-spin`}):(0,Q.jsx)(a,{className:`size-4`}),h.remember]})]})]},e.id)}),E.length>5?(0,Q.jsxs)(`button`,{type:`button`,className:`mx-auto flex items-center gap-1.5 px-3 py-2 text-xs font-medium text-accent-fg hover:underline`,onClick:()=>_(be),children:[g?h.showLess:h.showAll.replace(`{{count}}`,String(E.length)),(0,Q.jsx)(ne,{className:m(`size-3.5 transition-transform`,g&&`rotate-180`)})]}):null]}):(0,Q.jsxs)(`div`,{className:`mt-3 flex items-start gap-3 rounded-2xl border border-edge bg-surface-base/55 p-4`,children:[(0,Q.jsx)(c,{className:`mt-0.5 size-5 shrink-0 text-success`}),(0,Q.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:h.nothingPending})]}),t[45]=s,t[46]=b,t[47]=v,t[48]=o,t[49]=E.length,t[50]=A,t[51]=g,t[52]=h.cancel,t[53]=h.categories,t[54]=h.discard,t[55]=h.edit,t[56]=h.nothingPending,t[57]=h.remember,t[58]=h.save,t[59]=h.showAll,t[60]=h.showLess,t[61]=h.source,t[62]=j,t[63]=U):U=t[63];let W;t[64]!==V||t[65]!==H||t[66]!==U?(W=(0,Q.jsxs)(`section`,{className:`mt-8`,"aria-labelledby":`understanding-pending-title`,children:[V,H,U]}),t[64]=V,t[65]=H,t[66]=U,t[67]=W):W=t[67];let re;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Q.jsx)(a,{className:`size-4`}),t[68]=re):re=t[68];let G;t[69]!==s||t[70]!==f||t[71]!==h.done?(G=(0,Q.jsx)(`div`,{className:`mt-6 flex justify-end`,children:(0,Q.jsxs)(T,{variant:`primary`,disabled:s,onClick:f,children:[re,h.done]})}),t[69]=s,t[70]=f,t[71]=h.done,t[72]=G):G=t[72];let K;t[73]===l?K=t[74]:(K=l?(0,Q.jsx)(`p`,{className:`mt-5 text-sm text-danger`,role:`alert`,children:l}):null,t[73]=l,t[74]=K);let ie;return t[75]!==I||t[76]!==B||t[77]!==W||t[78]!==G||t[79]!==K||t[80]!==F?(ie=(0,Q.jsxs)(`section`,{className:`mx-auto w-full max-w-[42rem] pb-2`,"aria-live":`polite`,children:[F,I,B,W,G,K]}),t[75]=I,t[76]=B,t[77]=W,t[78]=G,t[79]=K,t[80]=F,t[81]=ie):ie=t[81],ie}function be(e){return!e}function xe(e){return(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-accent/60`}),(0,Q.jsx)(`span`,{children:e.statement})]},e.id)}function Se(e){return fe.has(e.status)}function Ce(e){return e.status===`active`}function we(e,t){return t.assertions.length-e.assertions.length||(t.lastObservedAt??0)-(e.lastObservedAt??0)}function Te(e){return fe.has(e.status)}function Ee(e){return e.scope.type===`global`&&e.status!==`archived`&&e.status!==`rejected`}function De(){let{pathname:e,search:t}=i(),n=h(e=>e.language),r=q(),[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(null),l=e===`/user-model`,{data:u,mutate:f}=w(l?`/api/user-model`:null,D),E=n===`zh`,k=u?.assertions.filter(e=>e.scope.type===`global`&&[`candidate`,`needs_review`,`conflicted`,`stale`].includes(e.status)).length??0;if((0,Z.useEffect)(()=>{if(!l)return;let e=new URLSearchParams(t);if(e.get(`workDiscovery`)!==`review`)return;let n=e.get(`run`),r=!1;return(async()=>{if(n&&q.getState().directoryRun?.id!==n)try{let e=await R(n);if(r)return;q.getState().updateDirectoryRun(e)}catch{return}r||q.getState().setDrawerOpen(!0)})(),()=>{r=!0}},[l,t]),(0,Z.useEffect)(()=>{l&&r.status!==`running`&&f()},[f,l,r.directoryRun?.id,r.status]),!l)return null;let A=r.status===`running`,ee=async(e,t,n)=>{let i=q.getState().directoryRun,a=i?.result?.profileCandidates?.find(t=>t.id===e.id||!!(t.assertionId&&t.assertionId===e.assertionId)),s=r.memories.find(t=>t.id===e.id||!!(t.assertionId&&t.assertionId===e.assertionId));if(!a&&!s?.assertionId)return!1;o(!0),c(null);try{if(i&&a){let e=await O(i.id,[{id:a.id,status:t,...n?{statement:n}:{}}]);q.getState().updateDirectoryRun(e)}return s?.assertionId&&await q.getState().reviewMemory(s.assertionId,t===`accepted`,n),await f(),!0}catch(e){return c(e instanceof Error?e.message:String(e)),!1}finally{o(!1)}},j=async(e,t,n)=>{let r=[...q.getState().directoryRun?.result?.profileCandidates??[],...q.getState().memories].find(t=>t.assertionId===e.id);if(r)return ee(r,t,n);o(!0),c(null);try{return t===`edited`&&n?await te(e.id,n):await U(e.id,t===`accepted`?`active`:`rejected`),await f(),!0}catch(e){return c(e instanceof Error?e.message:String(e)),!1}finally{o(!1)}},M=e=>{if(!e&&u&&k===0&&r.status!==`running`){r.finish();return}r.setDrawerOpen(e)};return(0,Q.jsxs)(C,{open:r.drawerOpen,onOpenChange:M,children:[(0,Q.jsx)(_,{asChild:!0,children:(0,Q.jsxs)(T,{type:`button`,variant:`ghost`,className:m(`relative size-8 rounded-xl p-0`,re),title:E?`查看 xopc 对你的理解`:`Review what xopc understands`,"aria-label":E?`查看 xopc 对你的理解`:`Review what xopc understands`,children:[A?(0,Q.jsx)(d,{className:`size-4 animate-spin motion-reduce:animate-none`}):(0,Q.jsx)(H,{className:`size-4 text-accent-fg`}),k?(0,Q.jsx)(`span`,{className:`absolute right-0.5 top-0.5 size-2 rounded-full bg-accent ring-2 ring-surface-panel`}):null]})}),(0,Q.jsxs)(b,{children:[(0,Q.jsx)(g,{className:`fixed inset-0 z-[60] bg-scrim backdrop-blur-sm data-[state=closed]:animate-out data-[state=open]:animate-in motion-reduce:backdrop-blur-none`}),(0,Q.jsx)(`div`,{className:`pointer-events-none fixed inset-0 z-[61] flex items-center justify-center p-3 sm:p-6`,children:(0,Q.jsxs)(x,{className:`xopc-understanding-center pointer-events-auto flex h-[min(42rem,calc(100dvh-1.5rem))] w-[min(44rem,calc(100vw-1.5rem))] flex-col overflow-hidden rounded-[1.75rem] border border-edge bg-surface-panel shadow-float outline-none sm:h-[min(42rem,calc(100dvh-3rem))] sm:w-[min(44rem,calc(100vw-3rem))]`,children:[(0,Q.jsxs)(`header`,{className:`flex h-16 shrink-0 items-center justify-between border-b border-edge-subtle px-5 sm:px-6`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(S,{className:`text-sm font-semibold text-fg`,children:A?E?`正在更新用户理解`:`Updating user understanding`:E?`用户理解`:`User understanding`}),(0,Q.jsx)(v,{className:`mt-0.5 text-xs text-fg-muted`,children:A?E?`关闭窗口也会在后台继续`:`You can close this window; work continues in the background`:k?E?`${k} 条全局理解待确认`:`${k} global item(s) to review`:E?`查看理解来自哪些渠道`:`See which channels shaped it`})]}),(0,Q.jsx)(y,{asChild:!0,children:(0,Q.jsx)(T,{variant:`ghost`,className:`size-8 rounded-xl p-0`,"aria-label":E?`关闭`:`Close`,children:(0,Q.jsx)(p,{className:`size-4`})})})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-7 sm:px-9 sm:py-9`,children:u?(0,Q.jsx)(ye,{assertions:u.assertions,configuredSources:u.sources??[],activityRunning:A,language:n,busy:a,error:s,onReviewAssertion:j,onCompleted:()=>{M(!1)}}):(0,Q.jsx)(`section`,{className:`flex min-h-full items-center justify-center`,"aria-label":E?`正在加载用户理解`:`Loading user understanding`,children:(0,Q.jsx)(d,{className:`size-5 animate-spin text-fg-muted motion-reduce:animate-none`})})})]})})]})]})}var Oe={en:{pageTitle:`You`,pageSubtitle:`A living portrait shaped by you and xopc.`,overview:`Your portrait`,understanding:`Shared understanding`,knowledge:`Work memory`,portraitEyebrow:`YOU × XOPC`,portraitIntro:`Your explicit profile stays clear and editable. xopc builds a separate shared understanding through conversations and work.`,editProfile:`Edit basics`,callName:`What should xopc call you?`,callNamePlaceholder:`For example: Alex, Joyce, or Dr. Chen`,role:`Your role`,rolePlaceholder:`For example: founder, designer, or engineer`,pronouns:`Pronouns (optional)`,pronounsPlaceholder:`For example: she/her, he/him, they/them`,timezone:`Timezone`,locale:`Language / locale`,useDeviceTimezone:`Use this device`,notProvided:`Not provided`,editProfileHint:`These are facts you provide directly. They remain separate from xopc’s observations and inferences.`,saveProfile:`Save`,saving:`Saving…`,explicit:`You told me`,explicitHint:`Facts and preferences you stated directly`,learned:`Learned together`,learnedHint:`Patterns formed from our work`,pending:`To confirm together`,pendingHint:`Items that need your judgment`,confirmTogether:`Confirm together`,confirmHint:`These may affect future behavior. Confirm them, correct the wording, or tell me not to use them.`,nothingToConfirm:`Nothing needs your confirmation right now.`,importantNow:`What matters now`,noPriority:`No current priority has been set.`,otherGoals:`Other active outcomes`,howWeWork:`How we work together`,howWeWorkHint:`Your standing instructions for how I should communicate and act.`,noRules:`No collaboration preferences yet.`,recent:`Recently formed understanding`,recentHint:`The most useful current facts, with their origin and time horizon.`,seeAll:`See all`,workMemory:`What I remember from the work`,workMemoryHint:`Project facts, decisions, lessons, and open questions stay separate from facts about you.`,items:`items`,maintenanceReady:`Memory upkeep is enabled and waiting for its first run.`,maintenanceComplete:`Memory was last organized`,maintenanceFailed:`The latest memory upkeep needs attention`,refresh:`Refresh`,aboutYouTitle:`A view you can correct`,aboutYouHint:`This is working context, not a fixed profile. Every item can be corrected or retired.`,identity:`Who you are`,preferences:`Preferences and working rhythm`,relationships:`People and relationships`,currentState:`Current context`,insights:`My current read`,emptyGroup:`No understanding has formed here yet.`,correct:`Correct`,stopUsing:`Stop using`,confirm:`Confirm`,notTrue:`Not true`,save:`Save correction`,cancel:`Cancel`,correctionPlaceholder:`Write the accurate version…`,searchPlaceholder:`Search work memory…`,allMemory:`All work memory`,memoryLibraryHint:`Only distilled facts, decisions, lessons, commitments, and open questions appear here. Source records stay with their connector.`,noKnowledge:`No work memory has formed yet.`,noKnowledgeMatch:`No work memory matches this search.`,archive:`Archive`,showMore:`Show more`,expand:`Show details`,collapse:`Hide details`,disable:`Disable`,disabled:`Not in use`,enable:`Enable`,loadFailed:`Could not load your understanding.`,tryAgain:`Try again`,actionFailed:`The change could not be saved. Please try again.`},zh:{pageTitle:`你`,pageSubtitle:`一份由你和 xopc 共同塑造、持续生长的画像。`,overview:`你的画像`,understanding:`共同理解`,knowledge:`工作记忆`,portraitEyebrow:`YOU × XOPC`,portraitIntro:`你明确提供的基本信息会被清晰呈现并由你直接编辑;xopc 在对话与共事中形成的理解则单独维护。`,editProfile:`编辑基本信息`,callName:`希望 xopc 如何称呼你?`,callNamePlaceholder:`例如:Mic、Joyce、张老师`,role:`你的角色`,rolePlaceholder:`例如:创业者、产品设计师、工程师`,pronouns:`代词(可选)`,pronounsPlaceholder:`例如:she/her、he/him、they/them`,timezone:`时区`,locale:`语言 / 地区`,useDeviceTimezone:`使用本机时区`,notProvided:`未填写`,editProfileHint:`这些是由你直接提供的事实,与 xopc 的观察和推断分开维护。`,saveProfile:`保存`,saving:`正在保存…`,explicit:`你告诉我的`,explicitHint:`你明确表达的事实与偏好`,learned:`协作中学到的`,learnedHint:`从实际协作中形成的认识`,pending:`等待一起确认`,pendingHint:`需要由你判断的内容`,confirmTogether:`一起确认`,confirmHint:`这些理解可能影响之后的行为。你可以确认、修正,或告诉我以后不要使用。`,nothingToConfirm:`目前没有需要你确认的理解。`,importantNow:`此刻重要`,noPriority:`还没有设置当前优先事项。`,otherGoals:`其他进行中的目标`,howWeWork:`我们怎样协作`,howWeWorkHint:`你对沟通方式和执行行为的长期约定。`,noRules:`还没有形成协作偏好。`,recent:`最近形成的理解`,recentHint:`最值得使用的当前认识,同时说明它来自哪里、适用多久。`,seeAll:`查看全部`,workMemory:`我在工作中记住的`,workMemoryHint:`项目事实、决定、经验和待解问题,与“关于你”的理解分别管理。`,items:`条`,maintenanceReady:`记忆整理已经启用,正在等待首次运行。`,maintenanceComplete:`最近一次记忆整理于`,maintenanceFailed:`最近一次记忆整理需要处理`,refresh:`刷新`,aboutYouTitle:`一份可以共同修正的理解`,aboutYouHint:`它是协作中的工作认知,不是给你定型的档案。每一条都能修正或停止使用。`,identity:`关于你是谁`,preferences:`偏好与工作节奏`,relationships:`重要的人与关系`,currentState:`当前状态`,insights:`我形成的判断`,emptyGroup:`这里还没有形成理解。`,correct:`修正`,stopUsing:`不再使用`,confirm:`确认`,notTrue:`不是这样`,save:`保存修正`,cancel:`取消`,correctionPlaceholder:`写下更准确的说法…`,searchPlaceholder:`搜索工作记忆…`,allMemory:`全部工作记忆`,memoryLibraryHint:`这里只显示提炼后的事实、决定、经验、承诺和待解问题;邮件、日历与文档原文保留在对应来源中。`,noKnowledge:`还没有形成工作记忆。`,noKnowledgeMatch:`没有符合搜索条件的工作记忆。`,archive:`归档`,showMore:`显示更多`,expand:`查看详情`,collapse:`收起详情`,disable:`停用`,disabled:`已停用`,enable:`启用`,loadFailed:`无法载入对你的理解。`,tryAgain:`重试`,actionFailed:`修改没有保存,请重试。`}},ke=[`candidate`,`needs_review`,`conflicted`,`stale`],Ae=new Set([`identity.call_name`,`identity.role`,`identity.pronouns`,`preference.timezone`,`preference.locale`]),je=[`project_fact`,`workspace_fact`,`decision`,`task_lesson`,`commitment`,`open_question`,`episode`,`note`];function Me(e,t,n=!1){return e?new Intl.DateTimeFormat(t===`zh`?`zh-CN`:`en`,{dateStyle:`medium`,...n?{timeStyle:`short`}:{}}).format(e):null}function Ne(e){return typeof e==`string`&&e.trim()?e.trim():void 0}function Pe(e){return{callName:Ne(e.profile.callName)??``,role:Ne(e.profile.role)??``,pronouns:Ne(e.profile.pronouns)??``,timezone:Ne(e.profile.timezone)??``,locale:Ne(e.profile.locale)??``}}function Fe(e,t){return{"zh-CN":{en:`Simplified Chinese`,zh:`简体中文`},"zh-TW":{en:`Traditional Chinese`,zh:`繁体中文`},"en-US":{en:`English (US)`,zh:`英语(美国)`},"en-GB":{en:`English (UK)`,zh:`英语(英国)`},"ja-JP":{en:`Japanese`,zh:`日语`}}[e]?.[t]??e}function Ie(e){return Array.from(e.trim()).slice(0,2).join(``).toLocaleUpperCase()}function Le(e,t){return(t===`zh`?{user_explicit:`你告诉我的`,user_observed:`从协作中观察到`,system_inferred:`我形成的判断`,external_untrusted:`来自连接的信息`}:{user_explicit:`You told me`,user_observed:`Observed while working together`,system_inferred:`My current read`,external_untrusted:`From connected information`})[e.authority]}function Re(e,t){if(e.validTo){let n=Me(e.validTo,t);return t===`zh`?`适用至 ${n}`:`Applies until ${n}`}return(t===`zh`?{stable:`长期有效`,slow:`会随时间复核`,dynamic:`近期状态`,event:`特定阶段`}:{stable:`Long-term`,slow:`Reviewed over time`,dynamic:`Current context`,event:`Specific period`})[e.volatility]}function ze(e,t){let n=Me(e,t);return t===`zh`?`当前安排至 ${n}`:`Current plan through ${n}`}function Be(e,t){return e.authority===`user_explicit`?null:e.confidence>=.85?t===`zh`?`把握较高`:`High confidence`:e.confidence>=.65?t===`zh`?`把握中等`:`Medium confidence`:t===`zh`?`仍需确认`:`Needs confirmation`}function Ve(e,t){return(t===`zh`?{global:`所有协作`,agent:`当前智能体`,workspace:`当前工作区`,project:`当前项目`,session:`当前会话`}:{global:`All work`,agent:`This agent`,workspace:`This workspace`,project:`This project`,session:`This conversation`})[e.type]}function He(e,t){return(t===`zh`?{project_fact:`项目事实`,workspace_fact:`工作区事实`,decision:`已经决定`,task_lesson:`工作经验`,commitment:`承诺与约定`,open_question:`待解问题`,episode:`重要经历`,note:`其他记录`}:{project_fact:`Project facts`,workspace_fact:`Workspace facts`,decision:`Decisions`,task_lesson:`Lessons`,commitment:`Commitments`,open_question:`Open questions`,episode:`Episodes`,note:`Notes`})[e]}function Ue(e,t,n){if(e)return e.targetType===`goal`?t.find(t=>t.id===e.targetId)?.title:/^[0-9a-f]{8}-[0-9a-f-]{20,}$/i.test(e.targetId)?(n===`zh`?{project:`当前项目`,task:`当前任务`,assertion:`一项待处理的理解`,topic:`当前主题`}:{project:`Current project`,task:`Current task`,assertion:`An understanding to address`,topic:`Current topic`})[e.targetType]:e.targetId}function We(e){let t=(0,X.c)(14),{title:n,hint:r,action:i,children:a,className:o}=e,s=`rounded-xl border border-edge bg-surface-panel shadow-surface ${o===void 0?``:o}`,c;t[0]===n?c=t[1]:(c=(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n}),t[0]=n,t[1]=c);let l;t[2]===r?l=t[3]:(l=r?(0,Q.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-5 text-fg-muted`,children:r}):null,t[2]=r,t[3]=l);let u;t[4]!==c||t[5]!==l?(u=(0,Q.jsxs)(`div`,{children:[c,l]}),t[4]=c,t[5]=l,t[6]=u):u=t[6];let d;t[7]!==i||t[8]!==u?(d=(0,Q.jsxs)(`header`,{className:`flex items-start justify-between gap-4 border-b border-edge-subtle px-5 py-4`,children:[u,i]}),t[7]=i,t[8]=u,t[9]=d):d=t[9];let f;return t[10]!==a||t[11]!==s||t[12]!==d?(f=(0,Q.jsxs)(`section`,{className:s,children:[d,a]}),t[10]=a,t[11]=s,t[12]=d,t[13]=f):f=t[13],f}function Ge(e){let t=(0,X.c)(7),{icon:n,children:r}=e,i;t[0]===n?i=t[1]:(i=(0,Q.jsx)(`span`,{className:`text-fg-subtle`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,Q.jsx)(`p`,{children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,Q.jsxs)(`div`,{className:`flex min-h-32 flex-col items-center justify-center gap-2 px-5 py-8 text-center text-sm text-fg-muted`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Ke({open:e,profile:t,language:n,saving:r,onOpenChange:i,onSave:a}){let c=Oe[n],[l,u]=(0,Z.useState)(t);(0,Z.useEffect)(()=>{e&&u(t)},[e,t]);let f=e=>{e.preventDefault(),a({callName:l.callName.trim(),role:l.role.trim(),pronouns:l.pronouns.trim(),timezone:l.timezone.trim(),locale:l.locale.trim()})},m=(e,t,n)=>(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:t}),(0,Q.jsx)(`input`,{value:l[e],onChange:t=>u(n=>({...n,[e]:t.target.value})),placeholder:n,className:`h-10 w-full rounded-xl border border-edge bg-surface-base px-3 text-sm text-fg outline-none transition placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`})]}),h=[`zh-CN`,`zh-TW`,`en-US`,`en-GB`,`ja-JP`];return l.locale&&!h.includes(l.locale)&&h.push(l.locale),(0,Q.jsx)(C,{open:e,onOpenChange:i,children:(0,Q.jsxs)(b,{children:[(0,Q.jsx)(g,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsx)(x,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] h-[min(40rem,calc(100vh-2rem))] w-[min(42rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:(0,Q.jsxs)(`form`,{className:`flex h-full min-h-0 flex-col`,onSubmit:f,children:[(0,Q.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-4 sm:px-6`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(S,{className:`font-semibold text-fg`,children:c.editProfile}),(0,Q.jsx)(v,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:c.editProfileHint})]}),(0,Q.jsx)(y,{asChild:!0,children:(0,Q.jsx)(T,{variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":c.cancel,children:(0,Q.jsx)(p,{className:`size-4`})})})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5 sm:p-6`,children:(0,Q.jsxs)(`div`,{className:`grid gap-5 sm:grid-cols-2`,children:[m(`callName`,c.callName,c.callNamePlaceholder),m(`role`,c.role,c.rolePlaceholder),m(`pronouns`,c.pronouns,c.pronounsPlaceholder),(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:c.locale}),(0,Q.jsxs)(o,{value:l.locale,onChange:e=>u(t=>({...t,locale:e.target.value})),children:[(0,Q.jsx)(s,{value:``,children:c.notProvided}),h.map(e=>(0,Q.jsx)(s,{value:e,children:Fe(e,n)},e))]})]}),(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-sm sm:col-span-2`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:c.timezone}),(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(`input`,{value:l.timezone,onChange:e=>u(t=>({...t,timezone:e.target.value})),placeholder:I(),className:`h-10 min-w-0 flex-1 rounded-xl border border-edge bg-surface-base px-3 text-sm text-fg outline-none transition placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`}),(0,Q.jsx)(T,{className:`shrink-0 whitespace-nowrap`,onClick:()=>u(e=>({...e,timezone:I()})),children:c.useDeviceTimezone})]})]})]})}),(0,Q.jsxs)(`footer`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-3 sm:px-6`,children:[(0,Q.jsx)(y,{asChild:!0,children:(0,Q.jsx)(T,{disabled:r,children:c.cancel})}),(0,Q.jsxs)(T,{type:`submit`,variant:`primary`,disabled:r,children:[r?(0,Q.jsx)(d,{className:`size-4 animate-spin`}):null,r?c.saving:c.saveProfile]})]})]})})]})})}function qe(e){let t=(0,X.c)(28),{item:n,language:r,busy:i,editing:o,draft:s,onDraftChange:c,onEdit:u,onCancel:d,onAction:m,onCorrect:h}=e,g=Oe[r],_;t[0]===n.status?_=t[1]:(_=ke.includes(n.status),t[0]=n.status,t[1]=_);let v=_,y;t[2]!==n||t[3]!==r?(y=Be(n,r),t[2]=n,t[3]=r,t[4]=y):y=t[4];let b=y,x=`rounded-xl border p-4 ${v?`border-edge-strong bg-surface-base`:`border-edge bg-surface-panel`}`,S;t[5]!==i||t[6]!==b||t[7]!==s||t[8]!==o||t[9]!==n||t[10]!==r||t[11]!==v||t[12]!==m||t[13]!==d||t[14]!==h||t[15]!==c||t[16]!==u||t[17]!==g.cancel||t[18]!==g.confirm||t[19]!==g.correct||t[20]!==g.correctionPlaceholder||t[21]!==g.notTrue||t[22]!==g.save||t[23]!==g.stopUsing?(S=o?(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsx)(`label`,{className:`sr-only`,htmlFor:`assertion-${n.id}`,children:g.correctionPlaceholder}),(0,Q.jsx)(`textarea`,{id:`assertion-${n.id}`,value:s,onChange:e=>c(e.target.value),placeholder:g.correctionPlaceholder,className:`min-h-24 w-full resize-y rounded-xl border border-edge bg-surface-base px-3 py-2.5 text-sm leading-6 text-fg outline-none transition focus:border-accent focus:ring-2 focus:ring-accent/20`,autoFocus:!0}),(0,Q.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Q.jsx)(T,{variant:`ghost`,className:`h-8`,onClick:d,children:g.cancel}),(0,Q.jsx)(T,{variant:`primary`,className:`h-8`,disabled:!s.trim()||i,onClick:h,children:g.save})]})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:n.statement}),(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-3 gap-y-1.5 text-xs text-fg-subtle`,children:[(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,Q.jsx)(f,{className:`size-3.5`}),Le(n,r)]}),(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,Q.jsx)(l,{className:`size-3.5`}),Re(n,r)]}),n.scope.type===`global`?null:(0,Q.jsx)(`span`,{children:Ve(n.scope,r)}),b?(0,Q.jsx)(`span`,{children:b}):null]}),(0,Q.jsx)(`div`,{className:`mt-4 flex flex-wrap justify-end gap-1.5`,children:v?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(T,{variant:`secondary`,className:`h-8 gap-1.5 px-2.5`,disabled:i,onClick:()=>m(`active`),children:[(0,Q.jsx)(a,{className:`size-3.5`}),g.confirm]}),(0,Q.jsxs)(T,{variant:`ghost`,className:`h-8 gap-1.5 px-2.5`,disabled:i,onClick:u,children:[(0,Q.jsx)(ue,{className:`size-3.5`}),g.correct]}),(0,Q.jsxs)(T,{variant:`ghost`,className:`h-8 gap-1.5 px-2.5`,disabled:i,onClick:()=>m(`rejected`),children:[(0,Q.jsx)(p,{className:`size-3.5`}),g.notTrue]})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(T,{variant:`ghost`,className:`h-8 gap-1.5 px-2.5`,disabled:i,onClick:u,children:[(0,Q.jsx)(ue,{className:`size-3.5`}),g.correct]}),(0,Q.jsxs)(T,{variant:`ghost`,className:`h-8 gap-1.5 px-2.5`,disabled:i,onClick:()=>m(`archived`),children:[(0,Q.jsx)(A,{className:`size-3.5`}),g.stopUsing]})]})})]}),t[5]=i,t[6]=b,t[7]=s,t[8]=o,t[9]=n,t[10]=r,t[11]=v,t[12]=m,t[13]=d,t[14]=h,t[15]=c,t[16]=u,t[17]=g.cancel,t[18]=g.confirm,t[19]=g.correct,t[20]=g.correctionPlaceholder,t[21]=g.notTrue,t[22]=g.save,t[23]=g.stopUsing,t[24]=S):S=t[24];let C;return t[25]!==x||t[26]!==S?(C=(0,Q.jsx)(`article`,{className:x,children:S}),t[25]=x,t[26]=S,t[27]=C):C=t[27],C}function Je(e){let t=(0,X.c)(16),{rule:n,language:r,busy:i,onToggle:a}=e,o=Oe[r],s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(F,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle`}),t[0]=s):s=t[0];let c;t[1]===n.statement?c=t[2]:(c=(0,Q.jsx)(`p`,{className:`min-w-0 flex-1 text-sm leading-6 text-fg`,children:n.statement}),t[1]=n.statement,t[2]=c);let l;t[3]!==n.status||t[4]!==o.disabled?(l=n.status===`disabled`?(0,Q.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:o.disabled}):null,t[3]=n.status,t[4]=o.disabled,t[5]=l):l=t[5];let u=n.status===`active`?o.disable:o.enable,d;t[6]!==i||t[7]!==a||t[8]!==u?(d=(0,Q.jsx)(T,{variant:`ghost`,className:`h-8`,disabled:i,onClick:a,children:u}),t[6]=i,t[7]=a,t[8]=u,t[9]=d):d=t[9];let f;t[10]!==l||t[11]!==d?(f=(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-1`,children:[l,d]}),t[10]=l,t[11]=d,t[12]=f):f=t[12];let p;return t[13]!==c||t[14]!==f?(p=(0,Q.jsxs)(`div`,{className:`flex items-start gap-3 border-t border-edge-subtle px-5 py-3 first:border-t-0`,children:[s,c,f]}),t[13]=c,t[14]=f,t[15]=p):p=t[15],p}function Ye(e){let t=(0,X.c)(39),{item:n,language:r,busy:i,expanded:a,onToggle:o,onArchive:s}=e,c=Oe[r],l=n.updatedAt??n.createdAt,u;t[0]!==r||t[1]!==l?(u=Me(l,r),t[0]=r,t[1]=l,t[2]=u):u=t[2];let d=u,f;t[3]===n.content?f=t[4]:(f=n.content.length>96||n.content.includes(`
2
+ `),t[3]=n.content,t[4]=f);let p=f,m;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(k,{className:`mt-1 size-4 shrink-0 text-fg-subtle`}),t[5]=m):m=t[5];let h=`whitespace-pre-wrap text-sm leading-6 text-fg ${a?``:`line-clamp-2`}`,g;t[6]!==n.content||t[7]!==h?(g=(0,Q.jsx)(`p`,{className:h,children:n.content}),t[6]=n.content,t[7]=h,t[8]=g):g=t[8];let _;t[9]!==n.scope||t[10]!==r?(_=Ve(n.scope,r),t[9]=n.scope,t[10]=r,t[11]=_):_=t[11];let v;t[12]===_?v=t[13]:(v=(0,Q.jsx)(`span`,{children:_}),t[12]=_,t[13]=v);let y;t[14]===d?y=t[15]:(y=d?(0,Q.jsx)(`span`,{children:d}):null,t[14]=d,t[15]=y);let b;t[16]!==v||t[17]!==y?(b=(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-fg-subtle`,children:[v,y]}),t[16]=v,t[17]=y,t[18]=b):b=t[18];let x;t[19]!==b||t[20]!==g?(x=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[g,b]}),t[19]=b,t[20]=g,t[21]=x):x=t[21];let S;t[22]!==p||t[23]!==a||t[24]!==o||t[25]!==c.collapse||t[26]!==c.expand?(S=p?(0,Q.jsxs)(T,{variant:`ghost`,className:`h-8 gap-1 px-2`,onClick:o,children:[(0,Q.jsx)(`span`,{className:`hidden sm:inline`,children:a?c.collapse:c.expand}),(0,Q.jsx)(ne,{className:`size-3.5 transition-transform ${a?`rotate-180`:``}`})]}):null,t[22]=p,t[23]=a,t[24]=o,t[25]=c.collapse,t[26]=c.expand,t[27]=S):S=t[27];let C;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsx)(A,{className:`size-3.5`}),t[28]=C):C=t[28];let w;t[29]!==i||t[30]!==s||t[31]!==c.archive?(w=(0,Q.jsx)(T,{variant:`ghost`,className:`size-8 shrink-0 p-0`,disabled:i,onClick:s,"aria-label":c.archive,title:c.archive,children:C}),t[29]=i,t[30]=s,t[31]=c.archive,t[32]=w):w=t[32];let E;t[33]!==S||t[34]!==w?(E=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[S,w]}),t[33]=S,t[34]=w,t[35]=E):E=t[35];let D;return t[36]!==x||t[37]!==E?(D=(0,Q.jsx)(`article`,{className:`group border-t border-edge-subtle px-5 py-4 first:border-t-0 sm:px-6`,children:(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[m,x,E]})}),t[36]=x,t[37]=E,t[38]=D):D=t[38],D}function Xe(){let e=h(e=>e.language),t=Oe[e],n=G(e=>e.setPageHeader),r=G(e=>e.clearPageHeader),{data:i,error:o,isLoading:s,mutate:c}=w(`/api/user-model`,D),[u,d]=(0,Z.useState)(`overview`),[m,g]=(0,Z.useState)(),[_,v]=(0,Z.useState)(),[y,b]=(0,Z.useState)(),[x,S]=(0,Z.useState)(``),[C,O]=(0,Z.useState)(``),[A,M]=(0,Z.useState)(24),[I,R]=(0,Z.useState)(),[z,ne]=(0,Z.useState)(!1);(0,Z.useEffect)(()=>(n({startExtra:null,main:(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h1`,{className:`text-base font-semibold text-fg`,children:t.pageTitle}),(0,Q.jsx)(`p`,{className:`hidden text-xs text-fg-muted sm:block`,children:t.pageSubtitle})]}),end:(0,Q.jsx)(De,{})}),r),[r,n,t]);let W=async(e,n)=>{g(e),v(void 0);try{await n(),await c()}catch{v(t.actionFailed)}finally{g(void 0)}},re=(e,t)=>{W(e.id,()=>U(e.id,t))},K=e=>{W(e.id,async()=>{await te(e.id,x.trim()),b(void 0),S(``)})},q=async e=>{g(`profile`),v(void 0);try{await ae(e),await c(),ne(!1)}catch{v(t.actionFailed)}finally{g(void 0)}};if(s)return(0,Q.jsxs)(`div`,{className:`mx-auto w-full max-w-6xl space-y-5 p-4 sm:p-6 lg:py-8`,children:[(0,Q.jsx)(E,{className:`h-10 w-72 rounded-xl`}),(0,Q.jsx)(E,{className:`h-72 rounded-xl`}),(0,Q.jsxs)(`div`,{className:`grid gap-5 lg:grid-cols-2`,children:[(0,Q.jsx)(E,{className:`h-80 rounded-xl`}),(0,Q.jsx)(E,{className:`h-80 rounded-xl`})]})]});if(o||!i)return(0,Q.jsxs)(`div`,{className:`mx-auto flex min-h-72 max-w-xl flex-col items-center justify-center gap-3 p-6 text-center`,children:[(0,Q.jsx)(le,{className:`size-6 text-fg-subtle`}),(0,Q.jsx)(`p`,{className:`text-sm text-danger`,children:t.loadFailed}),(0,Q.jsx)(T,{onClick:()=>void c(),children:t.tryAgain})]});let J=[...i.assertions].sort((e,t)=>{let n=Number(ke.includes(t.status))-Number(ke.includes(e.status));if(n)return n;let r=e.declaredImportance??e.inferredImportance;return(t.declaredImportance??t.inferredImportance)-r||t.recordedAt-e.recordedAt}).filter(e=>e.scope.type===`global`&&!Ae.has(e.predicate)),Y=Pe(i),ue=Y.callName||(e===`zh`?`你`:`You`),X=J.filter(e=>ke.includes(e.status)),fe=J.filter(e=>e.status===`active`),pe=fe.filter(e=>e.authority===`user_explicit`).length,me=fe.length-pe,he=i.priorities.filter(e=>e.status===`active`&&e.validTo>Date.now()),$=he.find(e=>e.rank===`primary`)??he[0],ge=Ue($,i.goals,e),_e=$?.targetType===`goal`?i.goals.find(e=>e.id===$.targetId):void 0,ve=i.goals.filter(e=>e.status===`active`||e.status===`paused`).filter(e=>$?.targetType!==`goal`||e.id!==$.targetId),ye=i.rules.filter(e=>e.status!==`archived`),be=[...fe].sort((e,t)=>t.recordedAt-e.recordedAt),xe=i.knowledge.filter(e=>e.status!==`archived`&&e.status!==`rejected`),Se=C.trim().toLocaleLowerCase(),Ce=xe.filter(t=>!Se||t.content.toLocaleLowerCase().includes(Se)||He(t.kind,e).toLocaleLowerCase().includes(Se)),we=[{key:`identity`,title:t.identity,icon:N,items:J.filter(e=>e.kind===`identity`)},{key:`preferences`,title:t.preferences,icon:ce,items:J.filter(e=>[`preference`,`value`,`routine`,`capability`].includes(e.kind))},{key:`relationships`,title:t.relationships,icon:F,items:J.filter(e=>e.kind===`relationship`)},{key:`current`,title:t.currentState,icon:l,items:J.filter(e=>e.kind===`current_state`)},{key:`insights`,title:t.insights,icon:H,items:J.filter(e=>e.kind===`derived_insight`)}].filter(e=>e.items.length>0),Te=je.map(e=>({kind:e,count:xe.filter(t=>t.kind===e).length})).filter(e=>e.count>0),Ee=Ce.slice(0,A),Ne=je.map(e=>({kind:e,items:Ee.filter(t=>t.kind===e),totalCount:Ce.filter(t=>t.kind===e).length})).filter(e=>e.items.length>0),Le=t=>(0,Q.jsx)(qe,{item:t,language:e,busy:m===t.id,editing:y===t.id,draft:y===t.id?x:``,onDraftChange:S,onEdit:()=>{b(t.id),S(t.statement)},onCancel:()=>{b(void 0),S(``)},onAction:e=>re(t,e),onCorrect:()=>K(t)},t.id),Re=i.maintenance.lastRun?Me(i.maintenance.lastRun.finishedAt??i.maintenance.lastRun.startedAt,e,!0):null,Be=i.maintenance.lastRun?i.maintenance.lastRun.status===`completed`?`${t.maintenanceComplete} ${Re}`:t.maintenanceFailed:t.maintenanceReady;return(0,Q.jsxs)(`div`,{className:`mx-auto w-full max-w-6xl space-y-5 p-4 sm:p-6 lg:py-8`,children:[(0,Q.jsx)(de,{items:[{id:`overview`,label:t.overview,icon:H},{id:`understanding`,label:t.understanding,icon:N,count:J.length},{id:`knowledge`,label:t.knowledge,icon:k,count:xe.length}],activeTab:u,onChange:d,ariaLabel:t.pageTitle,tabIdPrefix:`understanding-tab`,panelIdPrefix:`understanding-panel`}),_?(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl border border-danger bg-danger-soft px-4 py-3 text-sm text-danger`,children:[(0,Q.jsx)(`span`,{children:_}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>v(void 0),"aria-label":t.cancel,children:(0,Q.jsx)(p,{className:`size-4`})})]}):null,u===`overview`?(0,Q.jsxs)(`div`,{id:`understanding-panel-overview`,role:`tabpanel`,"aria-labelledby":`understanding-tab-overview`,className:`space-y-5`,children:[(0,Q.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-surface`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-8 px-5 py-7 sm:px-8 sm:py-9 lg:grid-cols-[minmax(0,1fr)_21rem] lg:gap-10`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold tracking-[0.16em] text-accent-fg`,children:[(0,Q.jsx)(H,{className:`size-3.5`}),(0,Q.jsx)(`span`,{children:t.portraitEyebrow})]}),(0,Q.jsxs)(`div`,{className:`mt-6 flex items-center gap-4`,children:[(0,Q.jsx)(`div`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl border border-edge bg-surface-active text-lg font-semibold text-fg sm:size-20 sm:text-xl`,children:Ie(ue)}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`h2`,{className:`truncate text-2xl font-semibold tracking-tight text-fg sm:text-3xl`,children:ue}),(0,Q.jsx)(`p`,{className:`mt-1 truncate text-sm text-fg-muted`,children:Y.role||t.notProvided})]}),(0,Q.jsxs)(T,{className:`shrink-0`,onClick:()=>ne(!0),children:[(0,Q.jsx)(P,{className:`size-4`}),t.editProfile]})]}),(0,Q.jsx)(`p`,{className:`mt-6 max-w-2xl text-sm leading-6 text-fg-muted`,children:t.portraitIntro}),(0,Q.jsx)(`div`,{className:`mt-6 overflow-hidden rounded-xl border border-edge bg-edge-subtle`,children:(0,Q.jsx)(`div`,{className:`grid gap-px sm:grid-cols-3`,children:[{icon:V,label:t.locale,value:Y.locale?Fe(Y.locale,e):t.notProvided},{icon:oe,label:t.timezone,value:Y.timezone||t.notProvided},{icon:N,label:t.pronouns,value:Y.pronouns||t.notProvided}].map(({icon:e,label:t,value:n})=>(0,Q.jsxs)(`div`,{className:`bg-surface-panel px-4 py-3.5`,children:[(0,Q.jsxs)(`p`,{className:`flex items-center gap-1.5 text-xs text-fg-subtle`,children:[(0,Q.jsx)(e,{className:`size-3.5`}),t]}),(0,Q.jsx)(`p`,{className:`mt-1.5 truncate text-sm font-medium text-fg`,children:n})]},t))})})]}),(0,Q.jsxs)(`div`,{className:`flex min-h-52 flex-col rounded-xl border border-edge bg-surface-base p-5 sm:p-6`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-semibold tracking-wide text-fg-subtle`,children:t.importantNow}),ge?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`mt-4 text-xl font-semibold leading-7 tracking-tight text-fg`,children:ge}),_e?.desiredOutcome?(0,Q.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:_e.desiredOutcome}):null,$?(0,Q.jsx)(`p`,{className:`mt-4 text-xs text-fg-subtle`,children:ze($.validTo,e)}):null]}):(0,Q.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-2 py-6 text-center text-sm text-fg-muted`,children:[(0,Q.jsx)(ee,{className:`size-5 text-fg-subtle`}),(0,Q.jsx)(`span`,{children:t.noPriority})]}),ve.length?(0,Q.jsxs)(`div`,{className:`mt-5 border-t border-edge pt-4`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:t.otherGoals}),(0,Q.jsx)(`div`,{className:`mt-2 space-y-2`,children:ve.slice(0,3).map(e=>(0,Q.jsx)(`p`,{className:`text-sm text-fg`,children:e.title},e.id))})]}):null]})]}),(0,Q.jsx)(`div`,{className:`grid border-t border-edge-subtle sm:grid-cols-3`,children:[{icon:f,label:t.explicit,hint:t.explicitHint,count:pe},{icon:le,label:t.learned,hint:t.learnedHint,count:me},{icon:a,label:t.pending,hint:t.pendingHint,count:X.length}].map(({icon:e,label:t,hint:n,count:r},i)=>(0,Q.jsxs)(`div`,{className:`flex gap-3 px-5 py-4 sm:px-6 ${i?`border-t border-edge-subtle sm:border-l sm:border-t-0`:``}`,children:[(0,Q.jsx)(e,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle`}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`p`,{className:`text-sm font-medium text-fg`,children:[(0,Q.jsx)(`span`,{className:`mr-1.5 text-lg tabular-nums`,children:r}),t]}),(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:n})]})]},t))})]}),X.length?(0,Q.jsx)(We,{title:t.confirmTogether,hint:t.confirmHint,children:(0,Q.jsx)(`div`,{className:`grid gap-3 p-4 lg:grid-cols-2`,children:X.map(Le)})}):null,(0,Q.jsx)(We,{title:t.howWeWork,hint:t.howWeWorkHint,children:ye.length?ye.map(t=>(0,Q.jsx)(Je,{rule:t,language:e,busy:m===t.id,onToggle:()=>void W(t.id,()=>ie(t.id,t.status===`active`?`disabled`:`active`))},t.id)):(0,Q.jsx)(Ge,{icon:(0,Q.jsx)(F,{className:`size-5`}),children:t.noRules})}),(0,Q.jsx)(We,{title:t.recent,hint:t.recentHint,action:(0,Q.jsx)(T,{variant:`ghost`,className:`h-8 shrink-0`,onClick:()=>d(`understanding`),children:t.seeAll}),children:be.length?(0,Q.jsx)(`div`,{className:`grid gap-3 p-4 lg:grid-cols-2`,children:be.slice(0,6).map(Le)}):(0,Q.jsx)(Ge,{icon:(0,Q.jsx)(le,{className:`size-5`}),children:t.emptyGroup})}),(0,Q.jsx)(We,{title:t.workMemory,hint:t.workMemoryHint,action:(0,Q.jsx)(T,{variant:`ghost`,className:`h-8 shrink-0`,onClick:()=>d(`knowledge`),children:t.seeAll}),children:Te.length?(0,Q.jsx)(`div`,{className:`grid gap-px bg-edge-subtle sm:grid-cols-2 lg:grid-cols-4`,children:Te.slice(0,4).map(({kind:t,count:n})=>(0,Q.jsxs)(`div`,{className:`bg-surface-panel px-5 py-4`,children:[(0,Q.jsx)(`p`,{className:`text-2xl font-semibold tabular-nums text-fg`,children:n}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:He(t,e)})]},t))}):(0,Q.jsx)(Ge,{icon:(0,Q.jsx)(L,{className:`size-5`}),children:t.noKnowledge})}),(0,Q.jsxs)(`footer`,{className:`flex items-center justify-between gap-4 px-1 pb-2 text-xs text-fg-subtle`,children:[(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,Q.jsx)(j,{className:`size-3.5`}),Be]}),(0,Q.jsxs)(T,{variant:`ghost`,className:`h-8 gap-1.5 px-2.5`,onClick:()=>void c(),children:[(0,Q.jsx)(j,{className:`size-3.5`}),t.refresh]})]})]}):null,u===`understanding`?(0,Q.jsxs)(`div`,{id:`understanding-panel-understanding`,role:`tabpanel`,"aria-labelledby":`understanding-tab-understanding`,className:`space-y-5`,children:[(0,Q.jsx)(`div`,{className:`rounded-xl border border-edge bg-surface-panel px-5 py-5 shadow-surface sm:px-6`,children:(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsx)(le,{className:`mt-0.5 size-5 shrink-0 text-accent-fg`}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`font-semibold text-fg`,children:t.aboutYouTitle}),(0,Q.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:t.aboutYouHint})]})]})}),we.length?we.map(({key:e,title:t,icon:n,items:r})=>(0,Q.jsx)(We,{title:t,action:(0,Q.jsx)(n,{className:`size-4 text-fg-subtle`}),children:(0,Q.jsx)(`div`,{className:`grid gap-3 p-4 lg:grid-cols-2`,children:r.map(Le)})},e)):(0,Q.jsx)(`div`,{className:`rounded-xl border border-edge bg-surface-panel shadow-surface`,children:(0,Q.jsx)(Ge,{icon:(0,Q.jsx)(le,{className:`size-5`}),children:t.emptyGroup})})]}):null,u===`knowledge`?(0,Q.jsxs)(`div`,{id:`understanding-panel-knowledge`,role:`tabpanel`,"aria-labelledby":`understanding-tab-knowledge`,className:`space-y-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl border border-edge bg-surface-panel p-4 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,Q.jsxs)(`div`,{className:`max-w-2xl`,children:[(0,Q.jsx)(`h2`,{className:`font-semibold text-fg`,children:t.allMemory}),(0,Q.jsxs)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:[xe.length,` `,t.items,` · `,t.memoryLibraryHint]})]}),(0,Q.jsxs)(`label`,{className:`relative block sm:w-80`,children:[(0,Q.jsx)(B,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:t.searchPlaceholder}),(0,Q.jsx)(`input`,{type:`search`,value:C,onChange:e=>{O(e.target.value),M(24)},placeholder:t.searchPlaceholder,className:`h-10 w-full rounded-xl border border-edge bg-surface-base pl-9 pr-3 text-sm text-fg outline-none transition placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`})]})]}),Ce.length?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`space-y-4`,children:Ne.map(({kind:t,items:n,totalCount:r})=>(0,Q.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-surface`,children:[(0,Q.jsxs)(`header`,{className:`flex items-center justify-between border-b border-edge-subtle px-5 py-3 sm:px-6`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:He(t,e)}),(0,Q.jsx)(`span`,{className:`text-xs tabular-nums text-fg-subtle`,children:r})]}),(0,Q.jsx)(`div`,{children:n.map(t=>(0,Q.jsx)(Ye,{item:t,language:e,busy:m===t.id,expanded:I===t.id,onToggle:()=>R(e=>e===t.id?void 0:t.id),onArchive:()=>void W(t.id,()=>se(t.id,`archived`))},t.id))})]},t))}),Ce.length>A?(0,Q.jsx)(`div`,{className:`flex justify-center pt-2`,children:(0,Q.jsx)(T,{onClick:()=>M(e=>e+24),children:t.showMore})}):null]}):(0,Q.jsx)(`div`,{className:`rounded-xl border border-edge bg-surface-panel shadow-surface`,children:(0,Q.jsx)(Ge,{icon:(0,Q.jsx)(B,{className:`size-5`}),children:C.trim()?t.noKnowledgeMatch:t.noKnowledge})})]}):null,(0,Q.jsx)(Ke,{open:z,profile:Y,language:e,saving:m===`profile`,onOpenChange:ne,onSave:e=>void q(e)})]})}export{Xe as UserModelPage};
@@ -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{To as i}from"./index-CHgOG1aR.js";import{m as a}from"./voice-config-api-Mk78BrpP.js";var o=t();e();var s=n();function c(e){let t=(0,o.c)(15),{kind:n,providerId:c,fieldId:u,value:d,onChange:f,labels:p,placeholder:m,className:h}=e,g=m===void 0?`sk-...`:m,_;t[0]!==n||t[1]!==c?(_=()=>a({kind:n,provider:c}).then(l),t[0]=n,t[1]=c,t[2]=_):_=t[2];let v=_,y;t[3]===h?y=t[4]:(y=r(`flex min-w-0 flex-col gap-1.5`,h),t[3]=h,t[4]=y);let b;t[5]!==u||t[6]!==p||t[7]!==f||t[8]!==g||t[9]!==v||t[10]!==d?(b=(0,s.jsx)(i,{id:u,value:d,onChange:f,placeholder:g,labels:p,reveal:v,loadFailedLabel:p.loadFailed,maskedHelp:p.maskedHelp,notInConfigFile:p.notInConfigFile,inputClassName:`text-xs`}),t[5]=u,t[6]=p,t[7]=f,t[8]=g,t[9]=v,t[10]=d,t[11]=b):b=t[11];let x;return t[12]!==y||t[13]!==b?(x=(0,s.jsx)(`div`,{className:y,children:b}),t[12]=y,t[13]=b,t[14]=x):x=t[14],x}function l(e){return e.apiKey??null}export{c as t};
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{Co as i}from"./index-ChIrvv3t.js";import{m as a}from"./voice-config-api-VNuCmdFe.js";var o=t();e();var s=n();function c(e){let t=(0,o.c)(15),{kind:n,providerId:c,fieldId:u,value:d,onChange:f,labels:p,placeholder:m,className:h}=e,g=m===void 0?`sk-...`:m,_;t[0]!==n||t[1]!==c?(_=()=>a({kind:n,provider:c}).then(l),t[0]=n,t[1]=c,t[2]=_):_=t[2];let v=_,y;t[3]===h?y=t[4]:(y=r(`flex min-w-0 flex-col gap-1.5`,h),t[3]=h,t[4]=y);let b;t[5]!==u||t[6]!==p||t[7]!==f||t[8]!==g||t[9]!==v||t[10]!==d?(b=(0,s.jsx)(i,{id:u,value:d,onChange:f,placeholder:g,labels:p,reveal:v,loadFailedLabel:p.loadFailed,maskedHelp:p.maskedHelp,notInConfigFile:p.notInConfigFile,inputClassName:`text-xs`}),t[5]=u,t[6]=p,t[7]=f,t[8]=g,t[9]=v,t[10]=d,t[11]=b):b=t[11];let x;return t[12]!==y||t[13]!==b?(x=(0,s.jsx)(`div`,{className:y,children:b}),t[12]=y,t[13]=b,t[14]=x):x=t[14],x}function l(e){return e.apiKey??null}export{c as t};
@@ -1 +1 @@
1
- import{a as e,r as t}from"./locale-store-1urrBBCQ.js";import{n}from"./gateway-config-swr-Cpmyrr6j.js";var r=`xopc-local-voice-model-install-started`;async function i(){return(await e(t(`/api/voice/realtime/status`))).payload}async function a(n){let r=await e(t(`/api/voice/realtime/preview`),{method:`POST`,signal:n});if(r.payload.sampleRate!==24e3)throw Error(`Unsupported preview sample rate`);return Uint8Array.from(atob(r.payload.audio),e=>e.charCodeAt(0)).buffer}async function o(n,r,i){let a=new URLSearchParams({provider:n,model:r});return i&&a.set(`purpose`,i),(await e(t(`/api/voice/tts-voices?${a.toString()}`))).payload?.voices??[]}function s(){return{enabled:!0,provider:`xopc-local`,providers:{"xopc-local":{model:`sensevoice-small`},alibaba:{model:`qwen-audio-3.0-asr-flash`},openai:{model:`gpt-4o-mini-transcribe`}},fallback:{enabled:!1,order:[`xopc-local`]}}}function c(){return{enabled:!0,provider:`edge`,trigger:`inbound`,maxTextLength:512,timeoutMs:6e4,providers:{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`}}}}function l(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function u(e){return typeof e==`string`&&e.trim().length>0?e.trim():`xopc-local`}function d(e){let t=s();if(!l(e))return t;let n=u(e.provider),r=t.fallback??{enabled:!1,order:[`xopc-local`]};if(l(e.fallback)){let t=Array.isArray(e.fallback.order)?e.fallback.order.filter(e=>typeof e==`string`&&e.trim().length>0):r.order;r={enabled:typeof e.fallback.enabled==`boolean`?e.fallback.enabled:r.enabled,order:t.length?t:r.order}}let i={...t.providers??{},...l(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,l(t)?{...t}:{}])):{}};return{enabled:!!e.enabled,provider:n,providers:i,fallback:r}}function f(e){return typeof e==`string`&&e.trim().length>0?e.trim():`edge`}function p(e){let t=c();if(!l(e))return t;let n=f(e.provider),r=e.trigger===`off`||e.trigger===`always`||e.trigger===`inbound`||e.trigger===`tagged`?e.trigger:`inbound`,i={...t.providers??{},...l(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,l(t)?{...t}:{}])):{}};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,providers:i}}function m(e){return{...e}}function h(e){return{...e}}function g(e){let t=l(e)?e:{},n=l(t.voice)?t.voice:{},r=l(n.input)?n.input:{},i=l(r.refinement)?r.refinement:{},a=l(n.realtime)?n.realtime:{},o=i.mode===`punctuation`||i.mode===`light`||i.mode===`custom`?i.mode:`off`;return{stt:d(t.stt),tts:p(t.tts),voice:{languageMode:n.languageMode===`manual`?`manual`:`auto`,language:n.language===`zh`?`zh`:`en`,input:{refinement:{mode:o,...typeof i.model==`string`&&i.model.trim()?{model:i.model.trim()}:{},...typeof i.customInstruction==`string`?{customInstruction:i.customInstruction}:{}}},realtime:{enabled:a.enabled===!0,defaultEngine:a.defaultEngine===`omni`?`omni`:`agent`,silenceDurationMs:typeof a.silenceDurationMs==`number`?a.silenceDurationMs:1200,idleTimeoutMs:typeof a.idleTimeoutMs==`number`?a.idleTimeoutMs:6e4,maxDictationMs:typeof a.maxDictationMs==`number`?a.maxDictationMs:6e5,maxConversationMs:typeof a.maxConversationMs==`number`?a.maxConversationMs:36e5,bargeIn:a.bargeIn!==!1,...l(a.tts)&&(a.tts.provider===`alibaba`||a.tts.provider===`xopc-cloud`)?{tts:{provider:a.tts.provider,...typeof a.tts.voice==`string`?{voice:a.tts.voice}:{}}}:{},...l(a.omni)?{omni:{...a.omni}}:{}}}}}async function _(){return g((await e(t(`/api/config`))).payload?.config??{})}async function v(r){await e(t(`/api/config`),{method:`PATCH`,body:JSON.stringify({stt:m(r.stt),tts:h(r.tts),voice:r.voice})}),r.voice.languageMode===`auto`&&await e(t(`/api/voice/language`),{method:`POST`,body:JSON.stringify({language:r.voice.language})}),typeof window<`u`&&window.dispatchEvent(new Event(`voice-config-changed`)),n()}async function y(){let n=await e(t(`/api/voice/models`));if(!n.payload?.models)throw Error(`Missing voice models payload`);return n.payload.models}async function b(){let n=await e(t(`/api/voice/providers`));if(!n.payload?.providers)throw Error(`Missing voice providers payload`);return n.payload}async function x(){let n=await e(t(`/api/voice/stt-providers`));if(!n.payload?.providers)throw Error(`Missing STT providers payload`);return n.payload}async function S(){let n=await e(t(`/api/voice/local/status`));if(!n.payload)throw Error(`Missing local voice status payload`);return n.payload}async function C(n){await e(t(`/api/voice/local/models/${encodeURIComponent(n)}/install`),{method:`POST`,body:`{}`})}async function w(n){await e(t(`/api/voice/local/models/${encodeURIComponent(n)}`),{method:`DELETE`})}async function T(n,r){let i=await e(t(`/api/voice/tts-test`),{method:`POST`,signal:r,body:JSON.stringify(n)});if(i.ok===!1){let e=typeof i.error==`string`?i.error:i.error?.message;throw Error(e||`TTS test failed`)}if(!i.payload||typeof i.payload.audio!=`string`||!i.payload.audio.trim())throw Error(`TTS test returned no audio. Check the selected voice engine and try again.`);return i.payload}async function E(n){let r=await e(t(`/api/voice/reveal-api-key`),{method:`POST`,body:JSON.stringify(n)});if(!r.payload)throw Error(`Missing reveal payload`);return r.payload}export{y as a,x as c,v as d,a as f,T as h,o as i,C as l,E as m,S as n,b as o,w as p,i as r,_ as s,r as t,g as u};
1
+ import{a as e,r as t}from"./locale-store-DlOv7896.js";import{n}from"./gateway-config-swr-G2lQt7Ak.js";var r=`xopc-local-voice-model-install-started`;async function i(){return(await e(t(`/api/voice/realtime/status`))).payload}async function a(n){let r=await e(t(`/api/voice/realtime/preview`),{method:`POST`,signal:n});if(r.payload.sampleRate!==24e3)throw Error(`Unsupported preview sample rate`);return Uint8Array.from(atob(r.payload.audio),e=>e.charCodeAt(0)).buffer}async function o(n,r,i){let a=new URLSearchParams({provider:n,model:r});return i&&a.set(`purpose`,i),(await e(t(`/api/voice/tts-voices?${a.toString()}`))).payload?.voices??[]}function s(){return{enabled:!0,provider:`xopc-local`,providers:{"xopc-local":{model:`sensevoice-small`},alibaba:{model:`qwen-audio-3.0-asr-flash`},openai:{model:`gpt-4o-mini-transcribe`}},fallback:{enabled:!1,order:[`xopc-local`]}}}function c(){return{enabled:!0,provider:`edge`,trigger:`inbound`,maxTextLength:512,timeoutMs:6e4,providers:{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`}}}}function l(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function u(e){return typeof e==`string`&&e.trim().length>0?e.trim():`xopc-local`}function d(e){let t=s();if(!l(e))return t;let n=u(e.provider),r=t.fallback??{enabled:!1,order:[`xopc-local`]};if(l(e.fallback)){let t=Array.isArray(e.fallback.order)?e.fallback.order.filter(e=>typeof e==`string`&&e.trim().length>0):r.order;r={enabled:typeof e.fallback.enabled==`boolean`?e.fallback.enabled:r.enabled,order:t.length?t:r.order}}let i={...t.providers??{},...l(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,l(t)?{...t}:{}])):{}};return{enabled:!!e.enabled,provider:n,providers:i,fallback:r}}function f(e){return typeof e==`string`&&e.trim().length>0?e.trim():`edge`}function p(e){let t=c();if(!l(e))return t;let n=f(e.provider),r=e.trigger===`off`||e.trigger===`always`||e.trigger===`inbound`||e.trigger===`tagged`?e.trigger:`inbound`,i={...t.providers??{},...l(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,l(t)?{...t}:{}])):{}};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,providers:i}}function m(e){return{...e}}function h(e){return{...e}}function g(e){let t=l(e)?e:{},n=l(t.voice)?t.voice:{},r=l(n.input)?n.input:{},i=l(r.refinement)?r.refinement:{},a=l(n.realtime)?n.realtime:{},o=i.mode===`punctuation`||i.mode===`light`||i.mode===`custom`?i.mode:`off`;return{stt:d(t.stt),tts:p(t.tts),voice:{languageMode:n.languageMode===`manual`?`manual`:`auto`,language:n.language===`zh`?`zh`:`en`,input:{refinement:{mode:o,...typeof i.model==`string`&&i.model.trim()?{model:i.model.trim()}:{},...typeof i.customInstruction==`string`?{customInstruction:i.customInstruction}:{}}},realtime:{enabled:a.enabled===!0,defaultEngine:a.defaultEngine===`omni`?`omni`:`agent`,silenceDurationMs:typeof a.silenceDurationMs==`number`?a.silenceDurationMs:1200,idleTimeoutMs:typeof a.idleTimeoutMs==`number`?a.idleTimeoutMs:6e4,maxDictationMs:typeof a.maxDictationMs==`number`?a.maxDictationMs:6e5,maxConversationMs:typeof a.maxConversationMs==`number`?a.maxConversationMs:36e5,bargeIn:a.bargeIn!==!1,...l(a.tts)&&(a.tts.provider===`alibaba`||a.tts.provider===`xopc-cloud`)?{tts:{provider:a.tts.provider,...typeof a.tts.voice==`string`?{voice:a.tts.voice}:{}}}:{},...l(a.omni)?{omni:{...a.omni}}:{}}}}}async function _(){return g((await e(t(`/api/config`))).payload?.config??{})}async function v(r){await e(t(`/api/config`),{method:`PATCH`,body:JSON.stringify({stt:m(r.stt),tts:h(r.tts),voice:r.voice})}),r.voice.languageMode===`auto`&&await e(t(`/api/voice/language`),{method:`POST`,body:JSON.stringify({language:r.voice.language})}),typeof window<`u`&&window.dispatchEvent(new Event(`voice-config-changed`)),n()}async function y(){let n=await e(t(`/api/voice/models`));if(!n.payload?.models)throw Error(`Missing voice models payload`);return n.payload.models}async function b(){let n=await e(t(`/api/voice/providers`));if(!n.payload?.providers)throw Error(`Missing voice providers payload`);return n.payload}async function x(){let n=await e(t(`/api/voice/stt-providers`));if(!n.payload?.providers)throw Error(`Missing STT providers payload`);return n.payload}async function S(){let n=await e(t(`/api/voice/local/status`));if(!n.payload)throw Error(`Missing local voice status payload`);return n.payload}async function C(n){await e(t(`/api/voice/local/models/${encodeURIComponent(n)}/install`),{method:`POST`,body:`{}`})}async function w(n){await e(t(`/api/voice/local/models/${encodeURIComponent(n)}`),{method:`DELETE`})}async function T(n,r){let i=await e(t(`/api/voice/tts-test`),{method:`POST`,signal:r,body:JSON.stringify(n)});if(i.ok===!1){let e=typeof i.error==`string`?i.error:i.error?.message;throw Error(e||`TTS test failed`)}if(!i.payload||typeof i.payload.audio!=`string`||!i.payload.audio.trim())throw Error(`TTS test returned no audio. Check the selected voice engine and try again.`);return i.payload}async function E(n){let r=await e(t(`/api/voice/reveal-api-key`),{method:`POST`,body:JSON.stringify(n)});if(!r.payload)throw Error(`Missing reveal payload`);return r.payload}export{y as a,x as c,v as d,a as f,T as h,o as i,C as l,E as m,S as n,b as o,w as p,i as r,_ as s,r as t,g 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"./x-B_N4OPjy.js";import{n as a}from"./locale-store-1urrBBCQ.js";import{t as o}from"./messages-DYFcjtmG.js";import{a as s,i as c,o as l,r as u,s as d,t as f}from"./dist-BGTk37IG.js";import{t as p}from"./button-BA45yciM.js";import{Mo as m,V as h,q as g}from"./index-CHgOG1aR.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=g(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=o(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)(s,{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)(m,{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)(d,{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)(c,{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)(i,{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)(p,{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)(h,{embedded:!0,onRequestClose:N})}),t[31]=N,t[32]=J);let Y;t[33]!==q||t[34]!==J?(Y=(0,y.jsxs)(l,{children:[z,(0,y.jsx)(u,{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)(f,{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"./x-B_N4OPjy.js";import{n as a}from"./locale-store-DlOv7896.js";import{t as o}from"./messages-Ls1Aaiqd.js";import{a as s,i as c,o as l,r as u,s as d,t as f}from"./dist-BGTk37IG.js";import{t as p}from"./button-BA45yciM.js";import{Ao as m,V as h,q as g}from"./index-ChIrvv3t.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=g(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=o(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)(s,{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)(m,{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)(d,{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)(c,{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)(i,{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)(p,{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)(h,{embedded:!0,onRequestClose:N})}),t[31]=N,t[32]=J);let Y;t[33]!==q||t[34]!==J?(Y=(0,y.jsxs)(l,{children:[z,(0,y.jsx)(u,{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)(f,{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,3 +1,3 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{n as i,r as a}from"./popover-select-DGmMQt4t.js";import{t as o}from"./markdown-view-BZmcFIWa.js";import{t as s}from"./x-B_N4OPjy.js";import{t as c}from"./cn-JdwAhgNB.js";import{i as l,r as u}from"./locale-store-1urrBBCQ.js";import{t as d}from"./messages-DYFcjtmG.js";import{a as f,n as p,o as m,r as h,s as g,t as _}from"./dist-BGTk37IG.js";import{t as v}from"./button-BA45yciM.js";import{Ar as y,Br as b,Ks as x,Su as S,Xl as C,bl as w,dc as T,gr as E,hc as D,kc as O,pc as k,rc as A,xr as j,zr as M}from"./index-CHgOG1aR.js";var N=e(t(),1),P=n();function F(e){if(!e.trim())return null;try{return JSON.parse(e)}catch{return null}}function I(e){return typeof e.message==`string`&&e.message.trim()?e.message:typeof e.error==`string`&&e.error.trim()?e.error:e.error&&typeof e.error==`object`&&typeof e.error.message==`string`?e.error.message:`AI suggestion failed`}function L(e,t={}){let n=F(e.split(`
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{n as i,r as a}from"./popover-select-DGmMQt4t.js";import{t as o}from"./markdown-view-6oYdBahT.js";import{t as s}from"./x-B_N4OPjy.js";import{t as c}from"./cn-JdwAhgNB.js";import{i as l,r as u}from"./locale-store-DlOv7896.js";import{t as d}from"./messages-Ls1Aaiqd.js";import{a as f,n as p,o as m,r as h,s as g,t as _}from"./dist-BGTk37IG.js";import{t as v}from"./button-BA45yciM.js";import{Dc as y,Jl as b,Lr as x,Or as S,Rr as C,Ws as w,bu as T,dc as E,lc as D,mr as O,pc as k,tc as A,vl as j,yr as M}from"./index-ChIrvv3t.js";var N=e(t(),1),P=n();function F(e){if(!e.trim())return null;try{return JSON.parse(e)}catch{return null}}function I(e){return typeof e.message==`string`&&e.message.trim()?e.message:typeof e.error==`string`&&e.error.trim()?e.error:e.error&&typeof e.error==`object`&&typeof e.error.message==`string`?e.error.message:`AI suggestion failed`}function L(e,t={}){let n=F(e.split(`
2
2
  `).filter(e=>e.startsWith(`data:`)).map(e=>e.slice(5).trimStart()).join(`
3
- `));if(!n)return null;if(n.type===`text_delta`&&typeof n.delta==`string`)return t.onDelta?.(n.delta),null;if(n.type===`thinking_delta`&&typeof n.delta==`string`)return t.onThinkingDelta?.(n.delta),null;if(n.type===`done`&&typeof n.text==`string`)return n.text;if(n.type===`error`)throw Error(I(n));return null}async function R(e,t={}){let n=await l(u(`/api/ai/text-assist`),{method:`POST`,headers:{Accept:`text/event-stream`},body:JSON.stringify(e)});if(!n.ok){let e=await n.json().catch(()=>({})),t=typeof e.error==`string`?e.error:e.error?.message;throw Error(t||`AI suggestion failed (${n.status})`)}if(!n.body){let e=await n.json().catch(()=>null);if(e?.text)return e;throw Error(`AI suggestion stream is empty`)}let r=n.body.getReader(),i=new TextDecoder,a=``,o=``,s=``;for(;;){let{done:e,value:n}=await r.read();if(n){a+=i.decode(n,{stream:!e});let r=a.split(/\r?\n\r?\n/);a=r.pop()??``;for(let e of r){let n=L(e,{onDelta:e=>{o+=e,t.onDelta?.(e)},onThinkingDelta:e=>{s+=e,t.onThinkingDelta?.(e)}});n!==null&&(o=n)}}if(e)break}if(a.trim()){let e=L(a,{onDelta:e=>{o+=e,t.onDelta?.(e)},onThinkingDelta:e=>{s+=e,t.onThinkingDelta?.(e)}});e!==null&&(o=e)}let c=o.trim();if(!c)throw Error(`AI returned an empty suggestion`);return{text:c,thinking:s.trim()||void 0}}function ee(){let[e,t]=(0,N.useState)(``),[n,r]=(0,N.useState)(``),[i,a]=(0,N.useState)(!1),[o,s]=(0,N.useState)(null);return{suggestion:e,thinking:n,loading:i,error:o,generate:(0,N.useCallback)(async e=>{a(!0),s(null),t(``),r(``);try{let n=await R(e,{onDelta:e=>{t(t=>t+e)},onThinkingDelta:e=>{r(t=>t+e)}});return t(n.text),r(n.thinking??``),n.text}catch(e){return s(e instanceof Error?e.message:`AI suggestion failed`),null}finally{a(!1)}},[]),reset:(0,N.useCallback)(()=>{t(``),r(``),s(null),a(!1)},[])}}var z=r(),te=5;function ne(e){return e.startsWith(`zh`)?{title:`AI 优化文案`,buttonTitle:`优化文案`,current:`当前内容`,suggestion:`AI 建议`,editedSuggestion:`审核并编辑建议`,thinking:`模型思考`,thinkingLoading:`思考中`,edit:`编辑`,preview:`预览`,loading:`正在生成建议...`,empty:`暂无内容`,generate:`生成建议`,regenerate:`重新生成`,applyCurrent:`应用当前内容`,replace:`替换`,append:`追加`,cancel:`取消`,close:`关闭`}:{title:`AI text assist`,buttonTitle:`Improve text`,current:`Current`,suggestion:`Suggestion`,editedSuggestion:`Review and edit suggestion`,thinking:`Model thinking`,thinkingLoading:`Thinking`,edit:`Edit`,preview:`Preview`,loading:`Generating suggestion...`,empty:`No content`,generate:`Generate suggestion`,regenerate:`Regenerate`,applyCurrent:`Apply current`,replace:`Replace`,append:`Append`,cancel:`Cancel`,close:`Close`}}function B(e){let t=(0,P.c)(239),{value:n,onApply:r,fieldId:i,fieldLabel:a,scenario:l,format:u,intent:d,locale:y,context:b,disabled:x,className:w,showLabel:E}=e,D=l===void 0?`generic.text`:l,A=u===void 0?`plain`:u,j=d===void 0?`improve`:d,M=E===void 0?!0:E,[F,I]=(0,N.useState)(!1),[L,R]=(0,N.useState)(n),[B,V]=(0,N.useState)(`preview`),[H,U]=(0,N.useState)(``),[W,ae]=(0,N.useState)(`edit`),[G,K]=(0,N.useState)(!0),[oe,se]=(0,N.useState)(!1),[ce,q]=(0,N.useState)(null),le=(0,N.useRef)(null),ue=(0,N.useRef)(!0),{suggestion:de,thinking:J,loading:Y,error:X,generate:fe,reset:pe}=ee(),me;t[0]===y?me=t[1]:(me=ne(y),t[0]=y,t[1]=me);let Z=me,he;t[2]!==Y||t[3]!==J?(he=Y&&J.trim().length>0,t[2]=Y,t[3]=J,t[4]=he):he=t[4];let Q=he,ge,_e;t[5]!==F||t[6]!==n?(ge=()=>{F||R(n)},_e=[F,n],t[5]=F,t[6]=n,t[7]=ge,t[8]=_e):(ge=t[7],_e=t[8]),(0,N.useEffect)(ge,_e);let ve,ye;t[9]===de?(ve=t[10],ye=t[11]):(ye=()=>{U(de)},ve=[de],t[9]=de,t[10]=ve,t[11]=ye),(0,N.useEffect)(ye,ve);let be,xe;t[12]===J?(be=t[13],xe=t[14]):(be=()=>{J.trim()&&K(!0)},xe=[J],t[12]=J,t[13]=be,t[14]=xe),(0,N.useEffect)(be,xe);let Se;t[15]!==Q||t[16]!==G?(Se=()=>{let e=le.current;!e||!Q||!G||ue.current&&(e.scrollTop=e.scrollHeight)},t[15]=Q,t[16]=G,t[17]=Se):Se=t[17];let Ce;t[18]!==Q||t[19]!==J||t[20]!==G?(Ce=[Q,J,G],t[18]=Q,t[19]=J,t[20]=G,t[21]=Ce):Ce=t[21],(0,N.useLayoutEffect)(Se,Ce);let we;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(we=()=>{let e=le.current;e&&(ue.current=e.scrollHeight-e.scrollTop-e.clientHeight<=te)},t[22]=we):we=t[22];let Te=we,Ee;t[23]!==b||t[24]!==i||t[25]!==a||t[26]!==A||t[27]!==fe||t[28]!==j||t[29]!==y||t[30]!==D?(Ee=async e=>{ae(`edit`),K(!0),ue.current=!0,await fe({intent:j,scenario:D,input:e,locale:y,field:{id:i,label:a,format:A},context:b})},t[23]=b,t[24]=i,t[25]=a,t[26]=A,t[27]=fe,t[28]=j,t[29]=y,t[30]=D,t[31]=Ee):Ee=t[31];let De=Ee,Oe;t[32]!==pe||t[33]!==n?(Oe=e=>{se(!!e.currentTarget.closest(`[role="dialog"]`)),q(document.querySelector(`.app-main-surface`)),R(n),V(`preview`),U(``),ae(`edit`),K(!0),pe(),I(!0)},t[32]=pe,t[33]=n,t[34]=Oe):Oe=t[34];let ke=Oe,Ae;t[35]!==L||t[36]!==De?(Ae=async()=>{await De(L)},t[35]=L,t[36]=De,t[37]=Ae):Ae=t[37];let je=Ae,Me;t[38]!==pe||t[39]!==n?(Me=()=>{I(!1),R(n),V(`preview`),U(``),ae(`edit`),K(!0),pe()},t[38]=pe,t[39]=n,t[40]=Me):Me=t[40];let $=Me,Ne;t[41]!==$||t[42]!==L||t[43]!==r?(Ne=()=>{r(L),$()},t[41]=$,t[42]=L,t[43]=r,t[44]=Ne):Ne=t[44];let Pe=Ne,Fe;t[45]!==$||t[46]!==H||t[47]!==r?(Fe=()=>{H.trim()&&(r(H),$())},t[45]=$,t[46]=H,t[47]=r,t[48]=Fe):Fe=t[48];let Ie=Fe,Le;t[49]!==$||t[50]!==L||t[51]!==H||t[52]!==r?(Le=()=>{if(!H.trim())return;let e=L.trimEnd();r(e?`${e}\n\n${H}`:H),$()},t[49]=$,t[50]=L,t[51]=H,t[52]=r,t[53]=Le):Le=t[53];let Re=Le,ze;t[54]!==H||t[55]!==X||t[56]!==Y?(ze=!Y&&!X&&H.trim().length>0,t[54]=H,t[55]=X,t[56]=Y,t[57]=ze):ze=t[57];let Be=ze,Ve=L!==n,He;t[58]!==H||t[59]!==X||t[60]!==J?(He=H.trim().length>0||J.trim().length>0||!!X,t[58]=H,t[59]=X,t[60]=J,t[61]=He):He=t[61];let Ue=He,We=!M&&`size-7 p-0`,Ge;t[62]!==w||t[63]!==We?(Ge=c(`h-7 gap-1 px-2 text-xs`,We,w),t[62]=w,t[63]=We,t[64]=Ge):Ge=t[64];let Ke=x||Y,qe;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(qe=(0,z.jsx)(k,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[65]=qe):qe=t[65];let Je=M?Z.buttonTitle:null,Ye;t[66]!==Z.buttonTitle||t[67]!==ke||t[68]!==Ge||t[69]!==Ke||t[70]!==Je?(Ye=(0,z.jsxs)(v,{type:`button`,variant:`ghost`,className:Ge,title:Z.buttonTitle,"aria-label":Z.buttonTitle,disabled:Ke,onClick:ke,children:[qe,Je]}),t[66]=Z.buttonTitle,t[67]=ke,t[68]=Ge,t[69]=Ke,t[70]=Je,t[71]=Ye):Ye=t[71];let Xe;t[72]===$?Xe=t[73]:(Xe=e=>e?I(!0):$(),t[72]=$,t[73]=Xe);let Ze=ce??void 0,Qe=oe?`bg-transparent`:`bg-scrim`,$e;t[74]===Qe?$e=t[75]:($e=c(`xopc-dialog-overlay absolute inset-0 z-[80]`,Qe),t[74]=Qe,t[75]=$e);let et;t[76]===$e?et=t[77]:(et=(0,z.jsx)(f,{className:$e}),t[76]=$e,t[77]=et);let tt;t[78]===Z.title?tt=t[79]:(tt=(0,z.jsx)(g,{className:`text-base font-semibold text-fg`,children:Z.title}),t[78]=Z.title,t[79]=tt);let nt;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(nt=(0,z.jsx)(s,{className:`size-5`,strokeWidth:1.75}),t[80]=nt):nt=t[80];let rt;t[81]===Z.close?rt=t[82]:(rt=(0,z.jsx)(p,{asChild:!0,children:(0,z.jsx)(v,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":Z.close,children:nt})}),t[81]=Z.close,t[82]=rt);let it;t[83]!==tt||t[84]!==rt?(it=(0,z.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[tt,rt]}),t[83]=tt,t[84]=rt,t[85]=it):it=t[85];let at;t[86]===Z.current?at=t[87]:(at=(0,z.jsx)(`div`,{className:`min-w-0 text-xs font-medium text-fg-muted`,children:Z.current}),t[86]=Z.current,t[87]=at);let ot=B===`edit`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,st;t[88]===ot?st=t[89]:(st=c(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,ot),t[88]=ot,t[89]=st);let ct,lt;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(ct=()=>V(`edit`),lt=(0,z.jsx)(T,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[90]=ct,t[91]=lt):(ct=t[90],lt=t[91]);let ut;t[92]!==Z.edit||t[93]!==st?(ut=(0,z.jsxs)(`button`,{type:`button`,className:st,onClick:ct,children:[lt,Z.edit]}),t[92]=Z.edit,t[93]=st,t[94]=ut):ut=t[94];let dt=B===`preview`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,ft;t[95]===dt?ft=t[96]:(ft=c(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,dt),t[95]=dt,t[96]=ft);let pt,mt;t[97]===Symbol.for(`react.memo_cache_sentinel`)?(pt=()=>V(`preview`),mt=(0,z.jsx)(C,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[97]=pt,t[98]=mt):(pt=t[97],mt=t[98]);let ht;t[99]!==Z.preview||t[100]!==ft?(ht=(0,z.jsxs)(`button`,{type:`button`,className:ft,onClick:pt,children:[mt,Z.preview]}),t[99]=Z.preview,t[100]=ft,t[101]=ht):ht=t[101];let gt;t[102]!==ut||t[103]!==ht?(gt=(0,z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 rounded-lg border border-edge bg-surface-muted p-0.5`,children:[ut,ht]}),t[102]=ut,t[103]=ht,t[104]=gt):gt=t[104];let _t;t[105]!==at||t[106]!==gt?(_t=(0,z.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[at,gt]}),t[105]=at,t[106]=gt,t[107]=_t):_t=t[107];let vt;t[108]!==L||t[109]!==B||t[110]!==A||t[111]!==Z.current||t[112]!==Z.empty?(vt=B===`preview`?(0,z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg`,children:A===`markdown`?(0,z.jsx)(o,{content:L||Z.empty,compact:!0,className:`text-sm`}):(0,z.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg`,children:L||Z.empty})}):(0,z.jsx)(`textarea`,{className:`min-h-0 flex-1 resize-none overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/25`,value:L,onChange:e=>R(e.currentTarget.value),placeholder:Z.empty,"aria-label":Z.current}),t[108]=L,t[109]=B,t[110]=A,t[111]=Z.current,t[112]=Z.empty,t[113]=vt):vt=t[113];let yt;t[114]!==_t||t[115]!==vt?(yt=(0,z.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-hidden`,children:[_t,vt]}),t[114]=_t,t[115]=vt,t[116]=yt):yt=t[116];let bt;t[117]===Z.editedSuggestion?bt=t[118]:(bt=(0,z.jsx)(`span`,{children:Z.editedSuggestion}),t[117]=Z.editedSuggestion,t[118]=bt);let xt;t[119]!==Z.loading||t[120]!==Y?(xt=Y?(0,z.jsx)(`span`,{className:`ml-2 font-normal`,children:Z.loading}):null,t[119]=Z.loading,t[120]=Y,t[121]=xt):xt=t[121];let St;t[122]!==bt||t[123]!==xt?(St=(0,z.jsxs)(`div`,{className:`min-w-0 text-xs font-medium text-fg-muted`,children:[bt,xt]}),t[122]=bt,t[123]=xt,t[124]=St):St=t[124];let Ct=W===`edit`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,wt;t[125]===Ct?wt=t[126]:(wt=c(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,Ct),t[125]=Ct,t[126]=wt);let Tt,Et;t[127]===Symbol.for(`react.memo_cache_sentinel`)?(Tt=()=>ae(`edit`),Et=(0,z.jsx)(T,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[127]=Tt,t[128]=Et):(Tt=t[127],Et=t[128]);let Dt;t[129]!==Z.edit||t[130]!==wt?(Dt=(0,z.jsxs)(`button`,{type:`button`,className:wt,onClick:Tt,children:[Et,Z.edit]}),t[129]=Z.edit,t[130]=wt,t[131]=Dt):Dt=t[131];let Ot=W===`preview`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,kt;t[132]===Ot?kt=t[133]:(kt=c(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,Ot),t[132]=Ot,t[133]=kt);let At,jt;t[134]===Symbol.for(`react.memo_cache_sentinel`)?(At=()=>ae(`preview`),jt=(0,z.jsx)(C,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[134]=At,t[135]=jt):(At=t[134],jt=t[135]);let Mt;t[136]!==Z.preview||t[137]!==kt?(Mt=(0,z.jsxs)(`button`,{type:`button`,className:kt,onClick:At,children:[jt,Z.preview]}),t[136]=Z.preview,t[137]=kt,t[138]=Mt):Mt=t[138];let Nt;t[139]!==Dt||t[140]!==Mt?(Nt=(0,z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 rounded-lg border border-edge bg-surface-muted p-0.5`,children:[Dt,Mt]}),t[139]=Dt,t[140]=Mt,t[141]=Nt):Nt=t[141];let Pt;t[142]!==St||t[143]!==Nt?(Pt=(0,z.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[St,Nt]}),t[142]=St,t[143]=Nt,t[144]=Pt):Pt=t[144];let Ft=Q?`opacity-100`:`pointer-events-none opacity-0`,It;t[145]===Ft?It=t[146]:(It=c(`absolute inset-0 min-h-0 transition-opacity duration-200 ease-out motion-reduce:transition-none`,Ft),t[145]=Ft,t[146]=It);let Lt=!Q,Rt;t[147]===Symbol.for(`react.memo_cache_sentinel`)?(Rt=()=>K(re),t[147]=Rt):Rt=t[147];let zt;t[148]!==Z.thinkingLoading||t[149]!==Y?(zt=Y?(0,z.jsxs)(`span`,{className:`ml-1 font-normal`,children:[`· `,Z.thinkingLoading]}):null,t[148]=Z.thinkingLoading,t[149]=Y,t[150]=zt):zt=t[150];let Bt;t[151]!==Z.thinking||t[152]!==zt?(Bt=(0,z.jsxs)(`span`,{className:`min-w-0 truncate`,children:[Z.thinking,zt]}),t[151]=Z.thinking,t[152]=zt,t[153]=Bt):Bt=t[153];let Vt=G&&`rotate-180`,Ht;t[154]===Vt?Ht=t[155]:(Ht=c(`size-3.5 shrink-0 transition-transform`,Vt),t[154]=Vt,t[155]=Ht);let Ut;t[156]===Ht?Ut=t[157]:(Ut=(0,z.jsx)(S,{className:Ht,strokeWidth:1.75,"aria-hidden":!0}),t[156]=Ht,t[157]=Ut);let Wt;t[158]!==Bt||t[159]!==Ut?(Wt=(0,z.jsxs)(`button`,{type:`button`,className:`flex shrink-0 items-center justify-between gap-2 px-2.5 py-2 text-left text-xs font-medium text-fg-muted hover:text-fg`,onClick:Rt,children:[Bt,Ut]}),t[158]=Bt,t[159]=Ut,t[160]=Wt):Wt=t[160];let Gt;t[161]!==J||t[162]!==G?(Gt=G?(0,z.jsx)(`pre`,{ref:le,className:`min-h-0 flex-1 overflow-auto border-t border-edge px-2.5 py-2 whitespace-pre-wrap text-xs leading-5 text-fg-muted`,onScroll:Te,children:J}):null,t[161]=J,t[162]=G,t[163]=Gt):Gt=t[163];let Kt;t[164]!==Wt||t[165]!==Gt?(Kt=(0,z.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col rounded-lg border border-edge bg-surface-muted/70`,children:[Wt,Gt]}),t[164]=Wt,t[165]=Gt,t[166]=Kt):Kt=t[166];let qt;t[167]!==It||t[168]!==Lt||t[169]!==Kt?(qt=(0,z.jsx)(`div`,{className:It,"aria-hidden":Lt,children:Kt}),t[167]=It,t[168]=Lt,t[169]=Kt,t[170]=qt):qt=t[170];let Jt=Q?`pointer-events-none opacity-0`:`opacity-100`,Yt;t[171]===Jt?Yt=t[172]:(Yt=c(`absolute inset-0 min-h-0 transition-opacity duration-200 ease-out motion-reduce:transition-none`,Jt),t[171]=Jt,t[172]=Yt);let Xt;t[173]!==H||t[174]!==X||t[175]!==A||t[176]!==Z.empty||t[177]!==Z.loading||t[178]!==Z.suggestion||t[179]!==Y||t[180]!==W?(Xt=X?(0,z.jsx)(`pre`,{className:`h-full min-h-0 overflow-auto whitespace-pre-wrap rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg-muted`,children:X}):W===`preview`?(0,z.jsx)(`div`,{className:`h-full min-h-0 overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg`,children:Y&&!H.trim()?(0,z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:Z.loading}):A===`markdown`?(0,z.jsx)(o,{content:H||Z.empty,compact:!0,className:`text-sm`}):(0,z.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg`,children:H||Z.empty})}):(0,z.jsx)(`textarea`,{className:`h-full min-h-0 w-full resize-none overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/25 disabled:text-fg-muted`,value:H,onChange:e=>U(e.currentTarget.value),disabled:Y,placeholder:Y?Z.loading:Z.empty,"aria-label":Z.suggestion}),t[173]=H,t[174]=X,t[175]=A,t[176]=Z.empty,t[177]=Z.loading,t[178]=Z.suggestion,t[179]=Y,t[180]=W,t[181]=Xt):Xt=t[181];let Zt;t[182]!==Yt||t[183]!==Xt?(Zt=(0,z.jsx)(`div`,{className:Yt,children:Xt}),t[182]=Yt,t[183]=Xt,t[184]=Zt):Zt=t[184];let Qt;t[185]!==qt||t[186]!==Zt?(Qt=(0,z.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden`,children:[qt,Zt]}),t[185]=qt,t[186]=Zt,t[187]=Qt):Qt=t[187];let $t;t[188]!==Pt||t[189]!==Qt?($t=(0,z.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-hidden`,children:[Pt,Qt]}),t[188]=Pt,t[189]=Qt,t[190]=$t):$t=t[190];let en;t[191]!==yt||t[192]!==$t?(en=(0,z.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-1 gap-3 overflow-hidden p-4 md:grid-cols-2`,children:[yt,$t]}),t[191]=yt,t[192]=$t,t[193]=en):en=t[193];let tn;t[194]!==$||t[195]!==Z.cancel?(tn=(0,z.jsx)(v,{type:`button`,variant:`secondary`,onClick:$,children:Z.cancel}),t[194]=$,t[195]=Z.cancel,t[196]=tn):tn=t[196];let nn=!Ve,rn;t[197]!==Pe||t[198]!==Z.applyCurrent||t[199]!==nn?(rn=(0,z.jsx)(v,{type:`button`,variant:`secondary`,disabled:nn,onClick:Pe,children:Z.applyCurrent}),t[197]=Pe,t[198]=Z.applyCurrent,t[199]=nn,t[200]=rn):rn=t[200];let an;t[201]===je?an=t[202]:(an=()=>void je(),t[201]=je,t[202]=an);let on;t[203]===Ue?on=t[204]:(on=Ue?(0,z.jsx)(O,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}):(0,z.jsx)(k,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[203]=Ue,t[204]=on);let sn=Ue?Z.regenerate:Z.generate,cn;t[205]!==Y||t[206]!==an||t[207]!==on||t[208]!==sn?(cn=(0,z.jsxs)(v,{type:`button`,variant:`secondary`,disabled:Y,onClick:an,children:[on,sn]}),t[205]=Y,t[206]=an,t[207]=on,t[208]=sn,t[209]=cn):cn=t[209];let ln=!Be,un;t[210]!==Re||t[211]!==Z.append||t[212]!==ln?(un=(0,z.jsx)(v,{type:`button`,variant:`secondary`,disabled:ln,onClick:Re,children:Z.append}),t[210]=Re,t[211]=Z.append,t[212]=ln,t[213]=un):un=t[213];let dn=!Be,fn;t[214]!==Ie||t[215]!==Z.replace||t[216]!==dn?(fn=(0,z.jsx)(v,{type:`button`,variant:`primary`,disabled:dn,onClick:Ie,children:Z.replace}),t[214]=Ie,t[215]=Z.replace,t[216]=dn,t[217]=fn):fn=t[217];let pn;t[218]!==fn||t[219]!==tn||t[220]!==rn||t[221]!==cn||t[222]!==un?(pn=(0,z.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-4 py-3`,children:[tn,rn,cn,un,fn]}),t[218]=fn,t[219]=tn,t[220]=rn,t[221]=cn,t[222]=un,t[223]=pn):pn=t[223];let mn;t[224]!==pn||t[225]!==it||t[226]!==en?(mn=(0,z.jsx)(`div`,{className:`absolute inset-0 z-[80] flex items-center justify-center p-4 pointer-events-none`,children:(0,z.jsxs)(h,{className:`xopc-dialog-content-pane pointer-events-auto flex h-[min(78vh,38rem)] w-full max-w-4xl flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,onOpenAutoFocus:ie,children:[it,en,pn]})}),t[224]=pn,t[225]=it,t[226]=en,t[227]=mn):mn=t[227];let hn;t[228]!==mn||t[229]!==Ze||t[230]!==et?(hn=(0,z.jsxs)(m,{container:Ze,children:[et,mn]}),t[228]=mn,t[229]=Ze,t[230]=et,t[231]=hn):hn=t[231];let gn;t[232]!==F||t[233]!==hn||t[234]!==Xe?(gn=(0,z.jsx)(_,{open:F,onOpenChange:Xe,children:hn}),t[232]=F,t[233]=hn,t[234]=Xe,t[235]=gn):gn=t[235];let _n;return t[236]!==gn||t[237]!==Ye?(_n=(0,z.jsxs)(z.Fragment,{children:[Ye,gn]}),t[236]=gn,t[237]=Ye,t[238]=_n):_n=t[238],_n}function re(e){return!e}function ie(e){return e.preventDefault()}function V(e){return!!(e&&e.type===`object`&&e.properties&&!Array.isArray(e.properties))}function H(e){let t=e.properties??{},n=new Set(e.required??[]);return Object.entries(t).map(([e,t])=>({key:e,schema:t,required:n.has(e)}))}function U(e,t){return!V(e)||!e?!0:H(e).every(e=>{if(!e.required)return!0;let n=t[e.key];return n==null?!1:typeof n==`string`?n.trim().length>0:!0})}function W(e,t){if(e)return V(e.inputSchema)?Object.keys(t.schemaInput).length>0?t.schemaInput:void 0:E(t.argValues)}function ae(e,t,n){let r=d(t).workflows;if(!e)return r.noInputSummary;let i=b(e,t);if(V(e.inputSchema)&&Object.keys(n.schemaInput).length>0)return Object.entries(n.schemaInput).map(([e,t])=>`${e}: ${String(t)}`).join(` · `);let a=Object.values(n.argValues).map(e=>e.trim()).filter(Boolean),o=n.goal.trim()||i.description;return o&&a.unshift(o),a.length>0?a.join(` · `):r.noInputSummary}function G(e,t,n=!0){return e?n?V(e.inputSchema)?U(e.inputSchema,t.schemaInput)?{valid:!0}:{valid:!1,reason:`schema-required`}:{valid:(y[e.name]??[]).every(e=>!e.required||!!t.argValues[e.key]?.trim())}:{valid:!1,reason:`raw-json`}:{valid:!1}}function K(e,t){return e[t]??t}function oe(e,t){let n=y[e]??[];if(n.length===0)return{};let r=t&&typeof t==`object`&&!Array.isArray(t)?t:{},i={};for(let e of n){let t=r[e.key];t!=null&&(i[e.key]=String(t))}return i}function se(e){let t=(0,P.c)(12),{examples:n,labels:r,onSelect:i}=e;if(n.length===0)return null;let a;t[0]===r.examplePrompts?a=t[1]:(a=(0,z.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:r.examplePrompts}),t[0]=r.examplePrompts,t[1]=a);let o;if(t[2]!==n||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>(0,z.jsx)(`button`,{type:`button`,onClick:()=>i(e),className:`rounded-lg border border-edge bg-surface-base/50 px-3 py-2 text-left text-xs text-fg-muted hover:bg-surface-hover`,children:e.text},`${e.field}:${e.text}`),t[5]=i,t[6]=e),o=n.map(e),t[2]=n,t[3]=i,t[4]=o}else o=t[4];let s;t[7]===o?s=t[8]:(s=(0,z.jsx)(`div`,{className:`mt-2 flex flex-col gap-1.5`,children:o}),t[7]=o,t[8]=s);let c;return t[9]!==a||t[10]!==s?(c=(0,z.jsxs)(`div`,{children:[a,s]}),t[9]=a,t[10]=s,t[11]=c):c=t[11],c}function ce(e){let t=(0,P.c)(34),{workflowName:n,language:r,argValues:i,onArgValuesChange:a,goal:o,onGoalChange:s,examplePrompts:l,showGoal:u,inputClassName:f,aiAssist:p}=e,m;t[0]===l?m=t[1]:(m=l===void 0?[]:l,t[0]=l,t[1]=m);let h=m,g=u===void 0?!0:u,_,v,b,x,S,C,w;if(t[2]!==p||t[3]!==i||t[4]!==h||t[5]!==o||t[6]!==f||t[7]!==r||t[8]!==a||t[9]!==s||t[10]!==g||t[11]!==n){b=d(r).workflows;let e=y[n]??[];v=e.length>0;let l=c(`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`,f),u;t[19]!==i||t[20]!==a||t[21]!==s?(u=e=>{M(e,s,e=>{a(e(i))})},t[19]=i,t[20]=a,t[21]=s,t[22]=u):u=t[22],_=u,x=`flex flex-col gap-3`,S=e.map(e=>{let t=K(b.args,e.labelKey),o=K(b.args,e.placeholderKey),s=i[e.key]??``;return(0,z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,z.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,z.jsxs)(`span`,{className:`text-xs font-medium text-fg-muted`,children:[t,e.required?` *`:``]}),e.multiline&&p?(0,z.jsx)(B,{value:s,onApply:t=>a({...i,[e.key]:t}),fieldId:`workflow.arg.${e.key}`,fieldLabel:t,scenario:p.argScenario??`workflow.arg`,locale:r,context:{...p.context,workflowName:n,workflowArgs:i,fieldKey:e.key},disabled:p.disabled,showLabel:!1}):null]}),e.multiline?(0,z.jsx)(`textarea`,{value:s,onChange:t=>a({...i,[e.key]:t.target.value}),placeholder:o,className:c(l,`min-h-20 resize-y`)}):(0,z.jsx)(`input`,{value:s,onChange:t=>a({...i,[e.key]:t.target.value}),placeholder:o,className:l})]},e.key)}),C=v&&h.length>0?(0,z.jsx)(se,{examples:h,labels:b,onSelect:_}):null,w=g?(0,z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,z.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,z.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:b.goalLabel}),p?(0,z.jsx)(B,{value:o,onApply:s,fieldId:`workflow.goal`,fieldLabel:b.goalLabel,scenario:p.goalScenario??`cron.workflowGoal`,locale:r,context:{...p.context,workflowName:n,workflowArgs:i},disabled:p.disabled,showLabel:!1}):null]}),(0,z.jsx)(`textarea`,{value:o,onChange:e=>s(e.target.value),placeholder:b.goalPlaceholder,className:c(l,`min-h-20 resize-y`)})]}):null,t[2]=p,t[3]=i,t[4]=h,t[5]=o,t[6]=f,t[7]=r,t[8]=a,t[9]=s,t[10]=g,t[11]=n,t[12]=_,t[13]=v,t[14]=b,t[15]=x,t[16]=S,t[17]=C,t[18]=w}else _=t[12],v=t[13],b=t[14],x=t[15],S=t[16],C=t[17],w=t[18];let T;t[23]!==_||t[24]!==h||t[25]!==v||t[26]!==b?(T=!v&&h.length>0?(0,z.jsx)(se,{examples:h,labels:b,onSelect:_}):null,t[23]=_,t[24]=h,t[25]=v,t[26]=b,t[27]=T):T=t[27];let E;return t[28]!==x||t[29]!==S||t[30]!==C||t[31]!==w||t[32]!==T?(E=(0,z.jsxs)(`div`,{className:x,children:[S,C,w,T]}),t[28]=x,t[29]=S,t[30]=C,t[31]=w,t[32]=T,t[33]=E):E=t[33],E}var q=`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`;function le({schema:e,value:t,onChange:n,labels:r,aiAssist:i,onValidChange:a}){let o=(0,N.useMemo)(()=>H(e),[e]),[s,l]=(0,N.useState)(!1),[u,d]=(0,N.useState)(()=>JSON.stringify(t,null,2)),[f,p]=(0,N.useState)(null);if(o.length===0)return null;let m=(e,r)=>{let i={...t,[e]:r};(r===``||r===void 0)&&delete i[e],n(i),s&&d(JSON.stringify(i,null,2))},h=e=>{d(e);try{let t=e.trim()?JSON.parse(e):{};if(!t||typeof t!=`object`||Array.isArray(t)){p(r.rawJsonInvalid),a?.(!1);return}p(null),n(t),a?.(!0,t)}catch{p(r.rawJsonInvalid),a?.(!1)}};return(0,z.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel/70 p-4 shadow-surface`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:r.inputSchemaHeading}),(0,z.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-accent-fg hover:underline`,onClick:()=>{let e=!s;l(e),e&&(d(JSON.stringify(t,null,2)),p(null),a?.(!0))},children:r.rawJson})]}),s?(0,z.jsxs)(`div`,{className:`mt-3`,children:[(0,z.jsx)(`textarea`,{value:u,onChange:e=>h(e.target.value),spellCheck:!1,className:c(q,`min-h-40 font-mono text-xs leading-5`)}),f?(0,z.jsx)(`p`,{className:`mt-1 text-xs text-red-600 dark:text-red-300`,children:f}):null]}):(0,z.jsx)(`div`,{className:`mt-3 grid gap-3`,children:o.map(e=>(0,z.jsx)(ue,{field:e,value:t[e.key],labels:r,aiAssist:i,allValues:t,onChange:t=>m(e.key,t)},e.key))})]})}function ue(e){let t=(0,P.c)(30),{field:n,value:r,labels:o,aiAssist:s,allValues:l,onChange:u}=e,d=n.schema.title||n.key,f=typeof n.schema.description==`string`?n.schema.description:void 0,p=Array.isArray(n.schema.type)?n.schema.type[0]:n.schema.type,m;t[0]===n.schema.enum?m=t[1]:(m=Array.isArray(n.schema.enum)?n.schema.enum:[],t[0]=n.schema.enum,t[1]=m);let h=m,g=!!s&&!h.length&&(p===`string`||!p),_=String(d),v=n.required?` *`:``,y;t[2]!==_||t[3]!==v?(y=(0,z.jsxs)(`span`,{className:`text-xs font-medium text-fg`,children:[_,v]}),t[2]=_,t[3]=v,t[4]=y):y=t[4];let b;t[5]!==s||t[6]!==l||t[7]!==n.key||t[8]!==n.schema||t[9]!==u||t[10]!==g||t[11]!==d||t[12]!==r?(b=g&&s?(0,z.jsx)(B,{value:typeof r==`string`?r:r==null?``:String(r),onApply:u,fieldId:`workflow.schema.${n.key}`,fieldLabel:String(d),scenario:s.scenario??`workflow.arg`,locale:s.locale,context:{...s.context,fieldKey:n.key,fieldSchema:n.schema,inputValues:l},disabled:s.disabled,showLabel:!1}):null,t[5]=s,t[6]=l,t[7]=n.key,t[8]=n.schema,t[9]=u,t[10]=g,t[11]=d,t[12]=r,t[13]=b):b=t[13];let x;t[14]!==y||t[15]!==b?(x=(0,z.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[y,b]}),t[14]=y,t[15]=b,t[16]=x):x=t[16];let S;t[17]===f?S=t[18]:(S=f?(0,z.jsx)(`p`,{className:`mt-0.5 text-xs leading-5 text-fg-subtle`,children:f}):null,t[17]=f,t[18]=S);let C;t[19]!==f||t[20]!==h||t[21]!==o||t[22]!==u||t[23]!==p||t[24]!==r?(C=h.length>0?(0,z.jsxs)(i,{value:r==null?``:String(r),onChange:e=>u(e.target.value),className:q,children:[(0,z.jsx)(a,{value:``}),h.map(de)]}):p===`boolean`?(0,z.jsxs)(i,{value:typeof r==`boolean`?String(r):``,onChange:e=>u(e.target.value===``?void 0:e.target.value===`true`),className:q,children:[(0,z.jsx)(a,{value:``}),(0,z.jsx)(a,{value:`true`,children:o.booleanTrue}),(0,z.jsx)(a,{value:`false`,children:o.booleanFalse})]}):p===`number`||p===`integer`?(0,z.jsx)(`input`,{type:`number`,value:typeof r==`number`||typeof r==`string`?String(r):``,onChange:e=>u(e.target.value===``?void 0:Number(e.target.value)),className:q}):(0,z.jsx)(`textarea`,{value:typeof r==`string`?r:r==null?``:String(r),onChange:e=>u(e.target.value),className:c(q,f&&f.length>80?`min-h-20 resize-y`:`min-h-10 resize-y`)}),t[19]=f,t[20]=h,t[21]=o,t[22]=u,t[23]=p,t[24]=r,t[25]=C):C=t[25];let w;return t[26]!==x||t[27]!==S||t[28]!==C?(w=(0,z.jsxs)(`div`,{className:`block`,children:[x,S,C]}),t[26]=x,t[27]=S,t[28]=C,t[29]=w):w=t[29],w}function de(e){return(0,z.jsx)(a,{value:String(e),children:String(e)},String(e))}function J(e){let t=(0,P.c)(12),{examples:n,labels:r,onSelect:i}=e;if(n.length===0)return null;let a;t[0]===r.examplePrompts?a=t[1]:(a=(0,z.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:r.examplePrompts}),t[0]=r.examplePrompts,t[1]=a);let o;if(t[2]!==n||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>(0,z.jsx)(`button`,{type:`button`,onClick:()=>i(e),className:`rounded-lg border border-edge bg-surface-base/50 px-3 py-2 text-left text-xs text-fg-muted hover:bg-surface-hover`,children:e.text},`${e.field}:${e.text}`),t[5]=i,t[6]=e),o=n.map(e),t[2]=n,t[3]=i,t[4]=o}else o=t[4];let s;t[7]===o?s=t[8]:(s=(0,z.jsx)(`div`,{className:`mt-2 flex flex-col gap-1.5`,children:o}),t[7]=o,t[8]=s);let c;return t[9]!==a||t[10]!==s?(c=(0,z.jsxs)(`div`,{children:[a,s]}),t[9]=a,t[10]=s,t[11]=c):c=t[11],c}function Y(e){let t=(0,P.c)(114),{definition:n,language:r,value:i,onChange:a,aiAssist:o,inputClassName:s,onValidityChange:l}=e,u;t[0]===r?u=t[1]:(u=d(r),t[0]=r,t[1]=u);let f=u.workflows,p;t[2]!==n||t[3]!==r?(p=b(n,r),t[2]=n,t[3]=r,t[4]=p):p=t[4];let m=p,[h,g]=(0,N.useState)(!0),_;t[5]===m.examplePrompts?_=t[6]:(_=m.examplePrompts??[],t[5]=m.examplePrompts,t[6]=_);let v=_,y;t[7]===n.inputSchema?y=t[8]:(y=V(n.inputSchema),t[7]=n.inputSchema,t[8]=y);let x=y,S,C,w,T,E,D,O,k,A,j;if(t[9]!==o||t[10]!==n||t[11]!==v||t[12]!==x||t[13]!==s||t[14]!==f||t[15]!==r||t[16]!==m.description||t[17]!==a||t[18]!==l||t[19]!==h||t[20]!==i){E=Symbol.for(`react.early_return_sentinel`);bb0:{let e=c(`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`,s),u;t[31]!==n||t[32]!==a||t[33]!==l||t[34]!==h?(u=(e,t)=>{let r=t===void 0?h:t;a(e),l?.(G(n,e,r))},t[31]=n,t[32]=a,t[33]=l,t[34]=h,t[35]=u):u=t[35];let d=u,p;t[36]!==d||t[37]!==i?(p=e=>d({...i,goal:e}),t[36]=d,t[37]=i,t[38]=p):p=t[38];let _=p,y;t[39]!==d||t[40]!==i?(y=e=>d({...i,schemaInput:e}),t[39]=d,t[40]=i,t[41]=y):y=t[41];let b=y,M;t[42]!==d||t[43]!==i?(M=e=>d({...i,argValues:e}),t[42]=d,t[43]=i,t[44]=M):M=t[44];let N=M,P;if(t[45]!==_||t[46]!==b||t[47]!==i.schemaInput?(P=e=>{if(e.field===`goal`){_(e.text);return}b({...i.schemaInput,[e.field]:e.text})},t[45]=_,t[46]=b,t[47]=i.schemaInput,t[48]=P):P=t[48],S=P,!x){let e;t[49]!==o||t[50]!==n.id||t[51]!==n.name||t[52]!==n.title||t[53]!==m.description?(e=o?{disabled:o.disabled,argScenario:o.inputScenario??`workflow.arg`,goalScenario:o.goalScenario??`workflow.goal`,context:{...o.context,workflowId:n.id,workflowName:n.name,workflowTitle:n.title,workflowDescription:m.description}}:void 0,t[49]=o,t[50]=n.id,t[51]=n.name,t[52]=n.title,t[53]=m.description,t[54]=e):e=t[54];let a;t[55]!==n.name||t[56]!==v||t[57]!==s||t[58]!==r||t[59]!==N||t[60]!==_||t[61]!==e||t[62]!==i.argValues||t[63]!==i.goal?(a=(0,z.jsx)(ce,{workflowName:n.name,language:r,argValues:i.argValues,onArgValuesChange:N,goal:i.goal,onGoalChange:_,examplePrompts:v,inputClassName:s,aiAssist:e}),t[55]=n.name,t[56]=v,t[57]=s,t[58]=r,t[59]=N,t[60]=_,t[61]=e,t[62]=i.argValues,t[63]=i.goal,t[64]=a):a=t[64],E=a;break bb0}w=`flex flex-col gap-3`,t[65]!==o||t[66]!==n||t[67]!==f.booleanFalse||t[68]!==f.booleanTrue||t[69]!==f.inputSchemaHeading||t[70]!==f.rawJson||t[71]!==f.rawJsonInvalid||t[72]!==r||t[73]!==m.description||t[74]!==l||t[75]!==b||t[76]!==i?(T=n.inputSchema?(0,z.jsx)(le,{schema:n.inputSchema,value:i.schemaInput,onChange:b,onValidChange:(e,t)=>{g(e),l?.(G(n,t?{...i,schemaInput:t}:i,e))},aiAssist:o?{locale:r,disabled:o.disabled,scenario:o.inputScenario??`workflow.arg`,context:{...o.context,workflowId:n.id,workflowName:n.name,workflowTitle:n.title,workflowDescription:m.description}}:void 0,labels:{inputSchemaHeading:f.inputSchemaHeading,rawJson:f.rawJson,rawJsonInvalid:f.rawJsonInvalid,booleanTrue:f.booleanTrue,booleanFalse:f.booleanFalse}}):null,t[65]=o,t[66]=n,t[67]=f.booleanFalse,t[68]=f.booleanTrue,t[69]=f.inputSchemaHeading,t[70]=f.rawJson,t[71]=f.rawJsonInvalid,t[72]=r,t[73]=m.description,t[74]=l,t[75]=b,t[76]=i,t[77]=T):T=t[77],j=`flex flex-col gap-1`;let F;t[78]===f.goalLabel?F=t[79]:(F=(0,z.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:f.goalLabel}),t[78]=f.goalLabel,t[79]=F);let I;t[80]!==o||t[81]!==n.id||t[82]!==n.name||t[83]!==n.title||t[84]!==f.goalLabel||t[85]!==r||t[86]!==m.description||t[87]!==_||t[88]!==i.goal||t[89]!==i.schemaInput?(I=o?(0,z.jsx)(B,{value:i.goal,onApply:_,fieldId:`workflow.goal`,fieldLabel:f.goalLabel,scenario:o.goalScenario??`workflow.goal`,locale:r,context:{...o.context,workflowId:n.id,workflowName:n.name,workflowTitle:n.title,workflowDescription:m.description,workflowInput:i.schemaInput},disabled:o.disabled,showLabel:!1}):null,t[80]=o,t[81]=n.id,t[82]=n.name,t[83]=n.title,t[84]=f.goalLabel,t[85]=r,t[86]=m.description,t[87]=_,t[88]=i.goal,t[89]=i.schemaInput,t[90]=I):I=t[90],t[91]!==F||t[92]!==I?(C=(0,z.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[F,I]}),t[91]=F,t[92]=I,t[93]=C):C=t[93],D=i.goal,t[94]===_?O=t[95]:(O=e=>_(e.target.value),t[94]=_,t[95]=O),k=f.goalPlaceholder,A=c(e,`min-h-20 resize-y`)}t[9]=o,t[10]=n,t[11]=v,t[12]=x,t[13]=s,t[14]=f,t[15]=r,t[16]=m.description,t[17]=a,t[18]=l,t[19]=h,t[20]=i,t[21]=S,t[22]=C,t[23]=w,t[24]=T,t[25]=E,t[26]=D,t[27]=O,t[28]=k,t[29]=A,t[30]=j}else S=t[21],C=t[22],w=t[23],T=t[24],E=t[25],D=t[26],O=t[27],k=t[28],A=t[29],j=t[30];if(E!==Symbol.for(`react.early_return_sentinel`))return E;let M;t[96]!==D||t[97]!==O||t[98]!==k||t[99]!==A?(M=(0,z.jsx)(`textarea`,{value:D,onChange:O,placeholder:k,className:A}),t[96]=D,t[97]=O,t[98]=k,t[99]=A,t[100]=M):M=t[100];let F;t[101]!==C||t[102]!==M||t[103]!==j?(F=(0,z.jsxs)(`div`,{className:j,children:[C,M]}),t[101]=C,t[102]=M,t[103]=j,t[104]=F):F=t[104];let I;t[105]!==S||t[106]!==v||t[107]!==f?(I=(0,z.jsx)(J,{examples:v,labels:f,onSelect:S}),t[105]=S,t[106]=v,t[107]=f,t[108]=I):I=t[108];let L;return t[109]!==w||t[110]!==T||t[111]!==F||t[112]!==I?(L=(0,z.jsxs)(`div`,{className:w,children:[T,F,I]}),t[109]=w,t[110]=T,t[111]=F,t[112]=I,t[113]=L):L=t[113],L}function X(e,t){let n=e.metadata.estimatedAgents;return n?n.min===n.max?j(t.agentScaleExact,{count:n.min}):j(t.agentScaleRange,{min:n.min,max:n.max}):j(t.agentScaleExact,{count:e.defaults.maxSubagents})}function fe(e){let t=(0,P.c)(41),{definition:n,language:r,value:i,onChange:a,mode:o,badgeLabel:s,aiAssist:l,inputClassName:u,showTimeout:f,defaultAdvancedOpen:p,onValidityChange:m}=e,h=f===void 0?!1:f,g=p===void 0?!1:p,_=d(r).workflows,[v,y]=(0,N.useState)(g),C;t[0]!==n||t[1]!==r?(C=b(n,r),t[0]=n,t[1]=r,t[2]=C):C=t[2];let T=C,E;t[3]!==n.defaults||t[4]!==i.concurrency?(E=i.concurrency.trim()?Number(i.concurrency):n.defaults.concurrency,t[3]=n.defaults,t[4]=i.concurrency,t[5]=E):E=t[5];let O=E,k;t[6]!==n.defaults||t[7]!==i.maxSubagents?(k=i.maxSubagents.trim()?Number(i.maxSubagents):n.defaults.maxSubagents,t[6]=n.defaults,t[7]=i.maxSubagents,t[8]=k):k=t[8];let M=k,F;t[9]!==n||t[10]!==r||t[11]!==i?(F=ae(n,r,i),t[9]=n,t[10]=r,t[11]=i,t[12]=F):F=t[12];let I=F,L=s??_.readyToStart,R;t[13]!==a||t[14]!==i?(R=e=>a({...i,...e}),t[13]=a,t[14]=i,t[15]=R):R=t[15];let ee=R,te=o===`automation`&&`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,ne;t[16]===te?ne=t[17]:(ne=c(`space-y-4`,te),t[16]=te,t[17]=ne);let B=I||T.description,re;t[18]===B?re=t[19]:(re=(0,z.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:B}),t[18]=B,t[19]=re);let ie;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,z.jsx)(w,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[20]=ie):ie=t[20];let V;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,z.jsx)(x,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[21]=V):V=t[21];let H;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,z.jsx)(D,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[22]=H):H=t[22];let U;t[23]!==a||t[24]!==i?(U=e=>a({...i,...e}),t[23]=a,t[24]=i,t[25]=U):U=t[25];let W;t[26]===m?W=t[27]:(W=e=>{m?.(e)},t[26]=m,t[27]=W);let G;t[28]!==l||t[29]!==n||t[30]!==u||t[31]!==r||t[32]!==U||t[33]!==W||t[34]!==i?(G=(0,z.jsx)(Y,{definition:n,language:r,value:i,onChange:U,onValidityChange:W,aiAssist:l,inputClassName:u}),t[28]=l,t[29]=n,t[30]=u,t[31]=r,t[32]=U,t[33]=W,t[34]=i,t[35]=G):G=t[35];let K;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(K=()=>y(pe),t[36]=K):K=t[36];let oe=_.advancedSettings,se=v&&`rotate-180`,ce;t[37]===se?ce=t[38]:(ce=c(`size-4 transition-transform`,se),t[37]=se,t[38]=ce);let q;return t[39]===ce?q=t[40]:(q=(0,z.jsx)(S,{className:ce}),t[39]=ce,t[40]=q),(0,z.jsxs)(`div`,{className:ne,children:[(0,z.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:_.runPlanPreview}),re]}),(0,z.jsx)(`span`,{className:`shrink-0 rounded-full bg-accent-soft px-2 py-1 text-[11px] font-medium text-accent-fg`,children:L})]}),(0,z.jsxs)(`div`,{className:`mt-4 grid gap-2 text-xs text-fg-muted sm:grid-cols-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-surface-panel px-2.5 py-2`,children:[ie,(0,z.jsx)(`span`,{children:j(_.phaseCount,{count:n.phases.length})})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-surface-panel px-2.5 py-2`,children:[V,(0,z.jsx)(`span`,{children:X(n,_)})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-surface-panel px-2.5 py-2`,children:[H,(0,z.jsx)(`span`,{children:j(_.runLimitsSummary,{concurrency:O,max:M})})]})]}),n.phases.length>0?(0,z.jsxs)(`div`,{className:`mt-4`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:[(0,z.jsx)(A,{className:`size-3.5`,"aria-hidden":!0}),_.startPlanPhases]}),(0,z.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5`,children:n.phases.map(me)})]}):null]}),G,(0,z.jsxs)(`div`,{className:`rounded-xl border border-edge`,children:[(0,z.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between px-3 py-2.5 text-left text-sm text-fg`,onClick:K,children:[oe,q]}),v?(0,z.jsxs)(`div`,{className:`grid gap-3 border-t border-edge px-3 pb-3 pt-3 sm:grid-cols-2`,children:[(0,z.jsx)(`input`,{value:i.concurrency,onChange:e=>ee({concurrency:e.target.value}),placeholder:j(_.concurrencyPlaceholder,{default:n.defaults.concurrency}),inputMode:`numeric`,className:`rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`}),(0,z.jsx)(`input`,{value:i.maxSubagents,onChange:e=>ee({maxSubagents:e.target.value}),placeholder:j(_.maxSubagentsPlaceholder,{default:n.defaults.maxSubagents}),inputMode:`numeric`,className:`rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`}),h?(0,z.jsx)(`input`,{value:i.timeoutSeconds??``,onChange:e=>ee({timeoutSeconds:e.target.value}),placeholder:j(_.timeoutSecondsPlaceholder,{default:n.defaults.timeoutSec}),inputMode:`numeric`,className:`rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`}):null]}):null]})]})}function pe(e){return!e}function me(e,t){return(0,z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[t>0?(0,z.jsx)(`span`,{className:`text-fg-subtle`,children:`→`}):null,(0,z.jsx)(`span`,{className:`rounded-lg border border-edge-subtle bg-surface-panel px-2 py-1 text-[11px] text-fg-muted`,children:e.title})]},e.id)}export{B as a,G as i,oe as n,W as r,fe as t};
3
+ `));if(!n)return null;if(n.type===`text_delta`&&typeof n.delta==`string`)return t.onDelta?.(n.delta),null;if(n.type===`thinking_delta`&&typeof n.delta==`string`)return t.onThinkingDelta?.(n.delta),null;if(n.type===`done`&&typeof n.text==`string`)return n.text;if(n.type===`error`)throw Error(I(n));return null}async function R(e,t={}){let n=await l(u(`/api/ai/text-assist`),{method:`POST`,headers:{Accept:`text/event-stream`},body:JSON.stringify(e)});if(!n.ok){let e=await n.json().catch(()=>({})),t=typeof e.error==`string`?e.error:e.error?.message;throw Error(t||`AI suggestion failed (${n.status})`)}if(!n.body){let e=await n.json().catch(()=>null);if(e?.text)return e;throw Error(`AI suggestion stream is empty`)}let r=n.body.getReader(),i=new TextDecoder,a=``,o=``,s=``;for(;;){let{done:e,value:n}=await r.read();if(n){a+=i.decode(n,{stream:!e});let r=a.split(/\r?\n\r?\n/);a=r.pop()??``;for(let e of r){let n=L(e,{onDelta:e=>{o+=e,t.onDelta?.(e)},onThinkingDelta:e=>{s+=e,t.onThinkingDelta?.(e)}});n!==null&&(o=n)}}if(e)break}if(a.trim()){let e=L(a,{onDelta:e=>{o+=e,t.onDelta?.(e)},onThinkingDelta:e=>{s+=e,t.onThinkingDelta?.(e)}});e!==null&&(o=e)}let c=o.trim();if(!c)throw Error(`AI returned an empty suggestion`);return{text:c,thinking:s.trim()||void 0}}function ee(){let[e,t]=(0,N.useState)(``),[n,r]=(0,N.useState)(``),[i,a]=(0,N.useState)(!1),[o,s]=(0,N.useState)(null);return{suggestion:e,thinking:n,loading:i,error:o,generate:(0,N.useCallback)(async e=>{a(!0),s(null),t(``),r(``);try{let n=await R(e,{onDelta:e=>{t(t=>t+e)},onThinkingDelta:e=>{r(t=>t+e)}});return t(n.text),r(n.thinking??``),n.text}catch(e){return s(e instanceof Error?e.message:`AI suggestion failed`),null}finally{a(!1)}},[]),reset:(0,N.useCallback)(()=>{t(``),r(``),s(null),a(!1)},[])}}var z=r(),te=5;function ne(e){return e.startsWith(`zh`)?{title:`AI 优化文案`,buttonTitle:`优化文案`,current:`当前内容`,suggestion:`AI 建议`,editedSuggestion:`审核并编辑建议`,thinking:`模型思考`,thinkingLoading:`思考中`,edit:`编辑`,preview:`预览`,loading:`正在生成建议...`,empty:`暂无内容`,generate:`生成建议`,regenerate:`重新生成`,applyCurrent:`应用当前内容`,replace:`替换`,append:`追加`,cancel:`取消`,close:`关闭`}:{title:`AI text assist`,buttonTitle:`Improve text`,current:`Current`,suggestion:`Suggestion`,editedSuggestion:`Review and edit suggestion`,thinking:`Model thinking`,thinkingLoading:`Thinking`,edit:`Edit`,preview:`Preview`,loading:`Generating suggestion...`,empty:`No content`,generate:`Generate suggestion`,regenerate:`Regenerate`,applyCurrent:`Apply current`,replace:`Replace`,append:`Append`,cancel:`Cancel`,close:`Close`}}function B(e){let t=(0,P.c)(239),{value:n,onApply:r,fieldId:i,fieldLabel:a,scenario:l,format:u,intent:d,locale:x,context:S,disabled:C,className:w,showLabel:O}=e,k=l===void 0?`generic.text`:l,A=u===void 0?`plain`:u,j=d===void 0?`improve`:d,M=O===void 0?!0:O,[F,I]=(0,N.useState)(!1),[L,R]=(0,N.useState)(n),[B,V]=(0,N.useState)(`preview`),[H,U]=(0,N.useState)(``),[W,ae]=(0,N.useState)(`edit`),[G,K]=(0,N.useState)(!0),[oe,se]=(0,N.useState)(!1),[ce,q]=(0,N.useState)(null),le=(0,N.useRef)(null),ue=(0,N.useRef)(!0),{suggestion:de,thinking:J,loading:Y,error:X,generate:fe,reset:pe}=ee(),me;t[0]===x?me=t[1]:(me=ne(x),t[0]=x,t[1]=me);let Z=me,he;t[2]!==Y||t[3]!==J?(he=Y&&J.trim().length>0,t[2]=Y,t[3]=J,t[4]=he):he=t[4];let Q=he,ge,_e;t[5]!==F||t[6]!==n?(ge=()=>{F||R(n)},_e=[F,n],t[5]=F,t[6]=n,t[7]=ge,t[8]=_e):(ge=t[7],_e=t[8]),(0,N.useEffect)(ge,_e);let ve,ye;t[9]===de?(ve=t[10],ye=t[11]):(ye=()=>{U(de)},ve=[de],t[9]=de,t[10]=ve,t[11]=ye),(0,N.useEffect)(ye,ve);let be,xe;t[12]===J?(be=t[13],xe=t[14]):(be=()=>{J.trim()&&K(!0)},xe=[J],t[12]=J,t[13]=be,t[14]=xe),(0,N.useEffect)(be,xe);let Se;t[15]!==Q||t[16]!==G?(Se=()=>{let e=le.current;!e||!Q||!G||ue.current&&(e.scrollTop=e.scrollHeight)},t[15]=Q,t[16]=G,t[17]=Se):Se=t[17];let Ce;t[18]!==Q||t[19]!==J||t[20]!==G?(Ce=[Q,J,G],t[18]=Q,t[19]=J,t[20]=G,t[21]=Ce):Ce=t[21],(0,N.useLayoutEffect)(Se,Ce);let we;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(we=()=>{let e=le.current;e&&(ue.current=e.scrollHeight-e.scrollTop-e.clientHeight<=te)},t[22]=we):we=t[22];let Te=we,Ee;t[23]!==S||t[24]!==i||t[25]!==a||t[26]!==A||t[27]!==fe||t[28]!==j||t[29]!==x||t[30]!==k?(Ee=async e=>{ae(`edit`),K(!0),ue.current=!0,await fe({intent:j,scenario:k,input:e,locale:x,field:{id:i,label:a,format:A},context:S})},t[23]=S,t[24]=i,t[25]=a,t[26]=A,t[27]=fe,t[28]=j,t[29]=x,t[30]=k,t[31]=Ee):Ee=t[31];let De=Ee,Oe;t[32]!==pe||t[33]!==n?(Oe=e=>{se(!!e.currentTarget.closest(`[role="dialog"]`)),q(document.querySelector(`.app-main-surface`)),R(n),V(`preview`),U(``),ae(`edit`),K(!0),pe(),I(!0)},t[32]=pe,t[33]=n,t[34]=Oe):Oe=t[34];let ke=Oe,Ae;t[35]!==L||t[36]!==De?(Ae=async()=>{await De(L)},t[35]=L,t[36]=De,t[37]=Ae):Ae=t[37];let je=Ae,Me;t[38]!==pe||t[39]!==n?(Me=()=>{I(!1),R(n),V(`preview`),U(``),ae(`edit`),K(!0),pe()},t[38]=pe,t[39]=n,t[40]=Me):Me=t[40];let $=Me,Ne;t[41]!==$||t[42]!==L||t[43]!==r?(Ne=()=>{r(L),$()},t[41]=$,t[42]=L,t[43]=r,t[44]=Ne):Ne=t[44];let Pe=Ne,Fe;t[45]!==$||t[46]!==H||t[47]!==r?(Fe=()=>{H.trim()&&(r(H),$())},t[45]=$,t[46]=H,t[47]=r,t[48]=Fe):Fe=t[48];let Ie=Fe,Le;t[49]!==$||t[50]!==L||t[51]!==H||t[52]!==r?(Le=()=>{if(!H.trim())return;let e=L.trimEnd();r(e?`${e}\n\n${H}`:H),$()},t[49]=$,t[50]=L,t[51]=H,t[52]=r,t[53]=Le):Le=t[53];let Re=Le,ze;t[54]!==H||t[55]!==X||t[56]!==Y?(ze=!Y&&!X&&H.trim().length>0,t[54]=H,t[55]=X,t[56]=Y,t[57]=ze):ze=t[57];let Be=ze,Ve=L!==n,He;t[58]!==H||t[59]!==X||t[60]!==J?(He=H.trim().length>0||J.trim().length>0||!!X,t[58]=H,t[59]=X,t[60]=J,t[61]=He):He=t[61];let Ue=He,We=!M&&`size-7 p-0`,Ge;t[62]!==w||t[63]!==We?(Ge=c(`h-7 gap-1 px-2 text-xs`,We,w),t[62]=w,t[63]=We,t[64]=Ge):Ge=t[64];let Ke=C||Y,qe;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(qe=(0,z.jsx)(E,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[65]=qe):qe=t[65];let Je=M?Z.buttonTitle:null,Ye;t[66]!==Z.buttonTitle||t[67]!==ke||t[68]!==Ge||t[69]!==Ke||t[70]!==Je?(Ye=(0,z.jsxs)(v,{type:`button`,variant:`ghost`,className:Ge,title:Z.buttonTitle,"aria-label":Z.buttonTitle,disabled:Ke,onClick:ke,children:[qe,Je]}),t[66]=Z.buttonTitle,t[67]=ke,t[68]=Ge,t[69]=Ke,t[70]=Je,t[71]=Ye):Ye=t[71];let Xe;t[72]===$?Xe=t[73]:(Xe=e=>e?I(!0):$(),t[72]=$,t[73]=Xe);let Ze=ce??void 0,Qe=oe?`bg-transparent`:`bg-scrim`,$e;t[74]===Qe?$e=t[75]:($e=c(`xopc-dialog-overlay absolute inset-0 z-[80]`,Qe),t[74]=Qe,t[75]=$e);let et;t[76]===$e?et=t[77]:(et=(0,z.jsx)(f,{className:$e}),t[76]=$e,t[77]=et);let tt;t[78]===Z.title?tt=t[79]:(tt=(0,z.jsx)(g,{className:`text-base font-semibold text-fg`,children:Z.title}),t[78]=Z.title,t[79]=tt);let nt;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(nt=(0,z.jsx)(s,{className:`size-5`,strokeWidth:1.75}),t[80]=nt):nt=t[80];let rt;t[81]===Z.close?rt=t[82]:(rt=(0,z.jsx)(p,{asChild:!0,children:(0,z.jsx)(v,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":Z.close,children:nt})}),t[81]=Z.close,t[82]=rt);let it;t[83]!==tt||t[84]!==rt?(it=(0,z.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[tt,rt]}),t[83]=tt,t[84]=rt,t[85]=it):it=t[85];let at;t[86]===Z.current?at=t[87]:(at=(0,z.jsx)(`div`,{className:`min-w-0 text-xs font-medium text-fg-muted`,children:Z.current}),t[86]=Z.current,t[87]=at);let ot=B===`edit`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,st;t[88]===ot?st=t[89]:(st=c(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,ot),t[88]=ot,t[89]=st);let ct,lt;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(ct=()=>V(`edit`),lt=(0,z.jsx)(D,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[90]=ct,t[91]=lt):(ct=t[90],lt=t[91]);let ut;t[92]!==Z.edit||t[93]!==st?(ut=(0,z.jsxs)(`button`,{type:`button`,className:st,onClick:ct,children:[lt,Z.edit]}),t[92]=Z.edit,t[93]=st,t[94]=ut):ut=t[94];let dt=B===`preview`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,ft;t[95]===dt?ft=t[96]:(ft=c(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,dt),t[95]=dt,t[96]=ft);let pt,mt;t[97]===Symbol.for(`react.memo_cache_sentinel`)?(pt=()=>V(`preview`),mt=(0,z.jsx)(b,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[97]=pt,t[98]=mt):(pt=t[97],mt=t[98]);let ht;t[99]!==Z.preview||t[100]!==ft?(ht=(0,z.jsxs)(`button`,{type:`button`,className:ft,onClick:pt,children:[mt,Z.preview]}),t[99]=Z.preview,t[100]=ft,t[101]=ht):ht=t[101];let gt;t[102]!==ut||t[103]!==ht?(gt=(0,z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 rounded-lg border border-edge bg-surface-muted p-0.5`,children:[ut,ht]}),t[102]=ut,t[103]=ht,t[104]=gt):gt=t[104];let _t;t[105]!==at||t[106]!==gt?(_t=(0,z.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[at,gt]}),t[105]=at,t[106]=gt,t[107]=_t):_t=t[107];let vt;t[108]!==L||t[109]!==B||t[110]!==A||t[111]!==Z.current||t[112]!==Z.empty?(vt=B===`preview`?(0,z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg`,children:A===`markdown`?(0,z.jsx)(o,{content:L||Z.empty,compact:!0,className:`text-sm`}):(0,z.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg`,children:L||Z.empty})}):(0,z.jsx)(`textarea`,{className:`min-h-0 flex-1 resize-none overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/25`,value:L,onChange:e=>R(e.currentTarget.value),placeholder:Z.empty,"aria-label":Z.current}),t[108]=L,t[109]=B,t[110]=A,t[111]=Z.current,t[112]=Z.empty,t[113]=vt):vt=t[113];let yt;t[114]!==_t||t[115]!==vt?(yt=(0,z.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-hidden`,children:[_t,vt]}),t[114]=_t,t[115]=vt,t[116]=yt):yt=t[116];let bt;t[117]===Z.editedSuggestion?bt=t[118]:(bt=(0,z.jsx)(`span`,{children:Z.editedSuggestion}),t[117]=Z.editedSuggestion,t[118]=bt);let xt;t[119]!==Z.loading||t[120]!==Y?(xt=Y?(0,z.jsx)(`span`,{className:`ml-2 font-normal`,children:Z.loading}):null,t[119]=Z.loading,t[120]=Y,t[121]=xt):xt=t[121];let St;t[122]!==bt||t[123]!==xt?(St=(0,z.jsxs)(`div`,{className:`min-w-0 text-xs font-medium text-fg-muted`,children:[bt,xt]}),t[122]=bt,t[123]=xt,t[124]=St):St=t[124];let Ct=W===`edit`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,wt;t[125]===Ct?wt=t[126]:(wt=c(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,Ct),t[125]=Ct,t[126]=wt);let Tt,Et;t[127]===Symbol.for(`react.memo_cache_sentinel`)?(Tt=()=>ae(`edit`),Et=(0,z.jsx)(D,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[127]=Tt,t[128]=Et):(Tt=t[127],Et=t[128]);let Dt;t[129]!==Z.edit||t[130]!==wt?(Dt=(0,z.jsxs)(`button`,{type:`button`,className:wt,onClick:Tt,children:[Et,Z.edit]}),t[129]=Z.edit,t[130]=wt,t[131]=Dt):Dt=t[131];let Ot=W===`preview`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,kt;t[132]===Ot?kt=t[133]:(kt=c(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,Ot),t[132]=Ot,t[133]=kt);let At,jt;t[134]===Symbol.for(`react.memo_cache_sentinel`)?(At=()=>ae(`preview`),jt=(0,z.jsx)(b,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[134]=At,t[135]=jt):(At=t[134],jt=t[135]);let Mt;t[136]!==Z.preview||t[137]!==kt?(Mt=(0,z.jsxs)(`button`,{type:`button`,className:kt,onClick:At,children:[jt,Z.preview]}),t[136]=Z.preview,t[137]=kt,t[138]=Mt):Mt=t[138];let Nt;t[139]!==Dt||t[140]!==Mt?(Nt=(0,z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 rounded-lg border border-edge bg-surface-muted p-0.5`,children:[Dt,Mt]}),t[139]=Dt,t[140]=Mt,t[141]=Nt):Nt=t[141];let Pt;t[142]!==St||t[143]!==Nt?(Pt=(0,z.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[St,Nt]}),t[142]=St,t[143]=Nt,t[144]=Pt):Pt=t[144];let Ft=Q?`opacity-100`:`pointer-events-none opacity-0`,It;t[145]===Ft?It=t[146]:(It=c(`absolute inset-0 min-h-0 transition-opacity duration-200 ease-out motion-reduce:transition-none`,Ft),t[145]=Ft,t[146]=It);let Lt=!Q,Rt;t[147]===Symbol.for(`react.memo_cache_sentinel`)?(Rt=()=>K(re),t[147]=Rt):Rt=t[147];let zt;t[148]!==Z.thinkingLoading||t[149]!==Y?(zt=Y?(0,z.jsxs)(`span`,{className:`ml-1 font-normal`,children:[`· `,Z.thinkingLoading]}):null,t[148]=Z.thinkingLoading,t[149]=Y,t[150]=zt):zt=t[150];let Bt;t[151]!==Z.thinking||t[152]!==zt?(Bt=(0,z.jsxs)(`span`,{className:`min-w-0 truncate`,children:[Z.thinking,zt]}),t[151]=Z.thinking,t[152]=zt,t[153]=Bt):Bt=t[153];let Vt=G&&`rotate-180`,Ht;t[154]===Vt?Ht=t[155]:(Ht=c(`size-3.5 shrink-0 transition-transform`,Vt),t[154]=Vt,t[155]=Ht);let Ut;t[156]===Ht?Ut=t[157]:(Ut=(0,z.jsx)(T,{className:Ht,strokeWidth:1.75,"aria-hidden":!0}),t[156]=Ht,t[157]=Ut);let Wt;t[158]!==Bt||t[159]!==Ut?(Wt=(0,z.jsxs)(`button`,{type:`button`,className:`flex shrink-0 items-center justify-between gap-2 px-2.5 py-2 text-left text-xs font-medium text-fg-muted hover:text-fg`,onClick:Rt,children:[Bt,Ut]}),t[158]=Bt,t[159]=Ut,t[160]=Wt):Wt=t[160];let Gt;t[161]!==J||t[162]!==G?(Gt=G?(0,z.jsx)(`pre`,{ref:le,className:`min-h-0 flex-1 overflow-auto border-t border-edge px-2.5 py-2 whitespace-pre-wrap text-xs leading-5 text-fg-muted`,onScroll:Te,children:J}):null,t[161]=J,t[162]=G,t[163]=Gt):Gt=t[163];let Kt;t[164]!==Wt||t[165]!==Gt?(Kt=(0,z.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col rounded-lg border border-edge bg-surface-muted/70`,children:[Wt,Gt]}),t[164]=Wt,t[165]=Gt,t[166]=Kt):Kt=t[166];let qt;t[167]!==It||t[168]!==Lt||t[169]!==Kt?(qt=(0,z.jsx)(`div`,{className:It,"aria-hidden":Lt,children:Kt}),t[167]=It,t[168]=Lt,t[169]=Kt,t[170]=qt):qt=t[170];let Jt=Q?`pointer-events-none opacity-0`:`opacity-100`,Yt;t[171]===Jt?Yt=t[172]:(Yt=c(`absolute inset-0 min-h-0 transition-opacity duration-200 ease-out motion-reduce:transition-none`,Jt),t[171]=Jt,t[172]=Yt);let Xt;t[173]!==H||t[174]!==X||t[175]!==A||t[176]!==Z.empty||t[177]!==Z.loading||t[178]!==Z.suggestion||t[179]!==Y||t[180]!==W?(Xt=X?(0,z.jsx)(`pre`,{className:`h-full min-h-0 overflow-auto whitespace-pre-wrap rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg-muted`,children:X}):W===`preview`?(0,z.jsx)(`div`,{className:`h-full min-h-0 overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg`,children:Y&&!H.trim()?(0,z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:Z.loading}):A===`markdown`?(0,z.jsx)(o,{content:H||Z.empty,compact:!0,className:`text-sm`}):(0,z.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg`,children:H||Z.empty})}):(0,z.jsx)(`textarea`,{className:`h-full min-h-0 w-full resize-none overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/25 disabled:text-fg-muted`,value:H,onChange:e=>U(e.currentTarget.value),disabled:Y,placeholder:Y?Z.loading:Z.empty,"aria-label":Z.suggestion}),t[173]=H,t[174]=X,t[175]=A,t[176]=Z.empty,t[177]=Z.loading,t[178]=Z.suggestion,t[179]=Y,t[180]=W,t[181]=Xt):Xt=t[181];let Zt;t[182]!==Yt||t[183]!==Xt?(Zt=(0,z.jsx)(`div`,{className:Yt,children:Xt}),t[182]=Yt,t[183]=Xt,t[184]=Zt):Zt=t[184];let Qt;t[185]!==qt||t[186]!==Zt?(Qt=(0,z.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden`,children:[qt,Zt]}),t[185]=qt,t[186]=Zt,t[187]=Qt):Qt=t[187];let $t;t[188]!==Pt||t[189]!==Qt?($t=(0,z.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-hidden`,children:[Pt,Qt]}),t[188]=Pt,t[189]=Qt,t[190]=$t):$t=t[190];let en;t[191]!==yt||t[192]!==$t?(en=(0,z.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-1 gap-3 overflow-hidden p-4 md:grid-cols-2`,children:[yt,$t]}),t[191]=yt,t[192]=$t,t[193]=en):en=t[193];let tn;t[194]!==$||t[195]!==Z.cancel?(tn=(0,z.jsx)(v,{type:`button`,variant:`secondary`,onClick:$,children:Z.cancel}),t[194]=$,t[195]=Z.cancel,t[196]=tn):tn=t[196];let nn=!Ve,rn;t[197]!==Pe||t[198]!==Z.applyCurrent||t[199]!==nn?(rn=(0,z.jsx)(v,{type:`button`,variant:`secondary`,disabled:nn,onClick:Pe,children:Z.applyCurrent}),t[197]=Pe,t[198]=Z.applyCurrent,t[199]=nn,t[200]=rn):rn=t[200];let an;t[201]===je?an=t[202]:(an=()=>void je(),t[201]=je,t[202]=an);let on;t[203]===Ue?on=t[204]:(on=Ue?(0,z.jsx)(y,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}):(0,z.jsx)(E,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[203]=Ue,t[204]=on);let sn=Ue?Z.regenerate:Z.generate,cn;t[205]!==Y||t[206]!==an||t[207]!==on||t[208]!==sn?(cn=(0,z.jsxs)(v,{type:`button`,variant:`secondary`,disabled:Y,onClick:an,children:[on,sn]}),t[205]=Y,t[206]=an,t[207]=on,t[208]=sn,t[209]=cn):cn=t[209];let ln=!Be,un;t[210]!==Re||t[211]!==Z.append||t[212]!==ln?(un=(0,z.jsx)(v,{type:`button`,variant:`secondary`,disabled:ln,onClick:Re,children:Z.append}),t[210]=Re,t[211]=Z.append,t[212]=ln,t[213]=un):un=t[213];let dn=!Be,fn;t[214]!==Ie||t[215]!==Z.replace||t[216]!==dn?(fn=(0,z.jsx)(v,{type:`button`,variant:`primary`,disabled:dn,onClick:Ie,children:Z.replace}),t[214]=Ie,t[215]=Z.replace,t[216]=dn,t[217]=fn):fn=t[217];let pn;t[218]!==fn||t[219]!==tn||t[220]!==rn||t[221]!==cn||t[222]!==un?(pn=(0,z.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-4 py-3`,children:[tn,rn,cn,un,fn]}),t[218]=fn,t[219]=tn,t[220]=rn,t[221]=cn,t[222]=un,t[223]=pn):pn=t[223];let mn;t[224]!==pn||t[225]!==it||t[226]!==en?(mn=(0,z.jsx)(`div`,{className:`absolute inset-0 z-[80] flex items-center justify-center p-4 pointer-events-none`,children:(0,z.jsxs)(h,{className:`xopc-dialog-content-pane pointer-events-auto flex h-[min(78vh,38rem)] w-full max-w-4xl flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,onOpenAutoFocus:ie,children:[it,en,pn]})}),t[224]=pn,t[225]=it,t[226]=en,t[227]=mn):mn=t[227];let hn;t[228]!==mn||t[229]!==Ze||t[230]!==et?(hn=(0,z.jsxs)(m,{container:Ze,children:[et,mn]}),t[228]=mn,t[229]=Ze,t[230]=et,t[231]=hn):hn=t[231];let gn;t[232]!==F||t[233]!==hn||t[234]!==Xe?(gn=(0,z.jsx)(_,{open:F,onOpenChange:Xe,children:hn}),t[232]=F,t[233]=hn,t[234]=Xe,t[235]=gn):gn=t[235];let _n;return t[236]!==gn||t[237]!==Ye?(_n=(0,z.jsxs)(z.Fragment,{children:[Ye,gn]}),t[236]=gn,t[237]=Ye,t[238]=_n):_n=t[238],_n}function re(e){return!e}function ie(e){return e.preventDefault()}function V(e){return!!(e&&e.type===`object`&&e.properties&&!Array.isArray(e.properties))}function H(e){let t=e.properties??{},n=new Set(e.required??[]);return Object.entries(t).map(([e,t])=>({key:e,schema:t,required:n.has(e)}))}function U(e,t){return!V(e)||!e?!0:H(e).every(e=>{if(!e.required)return!0;let n=t[e.key];return n==null?!1:typeof n==`string`?n.trim().length>0:!0})}function W(e,t){if(e)return V(e.inputSchema)?Object.keys(t.schemaInput).length>0?t.schemaInput:void 0:O(t.argValues)}function ae(e,t,n){let r=d(t).workflows;if(!e)return r.noInputSummary;let i=C(e,t);if(V(e.inputSchema)&&Object.keys(n.schemaInput).length>0)return Object.entries(n.schemaInput).map(([e,t])=>`${e}: ${String(t)}`).join(` · `);let a=Object.values(n.argValues).map(e=>e.trim()).filter(Boolean),o=n.goal.trim()||i.description;return o&&a.unshift(o),a.length>0?a.join(` · `):r.noInputSummary}function G(e,t,n=!0){return e?n?V(e.inputSchema)?U(e.inputSchema,t.schemaInput)?{valid:!0}:{valid:!1,reason:`schema-required`}:{valid:(S[e.name]??[]).every(e=>!e.required||!!t.argValues[e.key]?.trim())}:{valid:!1,reason:`raw-json`}:{valid:!1}}function K(e,t){return e[t]??t}function oe(e,t){let n=S[e]??[];if(n.length===0)return{};let r=t&&typeof t==`object`&&!Array.isArray(t)?t:{},i={};for(let e of n){let t=r[e.key];t!=null&&(i[e.key]=String(t))}return i}function se(e){let t=(0,P.c)(12),{examples:n,labels:r,onSelect:i}=e;if(n.length===0)return null;let a;t[0]===r.examplePrompts?a=t[1]:(a=(0,z.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:r.examplePrompts}),t[0]=r.examplePrompts,t[1]=a);let o;if(t[2]!==n||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>(0,z.jsx)(`button`,{type:`button`,onClick:()=>i(e),className:`rounded-lg border border-edge bg-surface-base/50 px-3 py-2 text-left text-xs text-fg-muted hover:bg-surface-hover`,children:e.text},`${e.field}:${e.text}`),t[5]=i,t[6]=e),o=n.map(e),t[2]=n,t[3]=i,t[4]=o}else o=t[4];let s;t[7]===o?s=t[8]:(s=(0,z.jsx)(`div`,{className:`mt-2 flex flex-col gap-1.5`,children:o}),t[7]=o,t[8]=s);let c;return t[9]!==a||t[10]!==s?(c=(0,z.jsxs)(`div`,{children:[a,s]}),t[9]=a,t[10]=s,t[11]=c):c=t[11],c}function ce(e){let t=(0,P.c)(34),{workflowName:n,language:r,argValues:i,onArgValuesChange:a,goal:o,onGoalChange:s,examplePrompts:l,showGoal:u,inputClassName:f,aiAssist:p}=e,m;t[0]===l?m=t[1]:(m=l===void 0?[]:l,t[0]=l,t[1]=m);let h=m,g=u===void 0?!0:u,_,v,y,b,C,w,T;if(t[2]!==p||t[3]!==i||t[4]!==h||t[5]!==o||t[6]!==f||t[7]!==r||t[8]!==a||t[9]!==s||t[10]!==g||t[11]!==n){y=d(r).workflows;let e=S[n]??[];v=e.length>0;let l=c(`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`,f),u;t[19]!==i||t[20]!==a||t[21]!==s?(u=e=>{x(e,s,e=>{a(e(i))})},t[19]=i,t[20]=a,t[21]=s,t[22]=u):u=t[22],_=u,b=`flex flex-col gap-3`,C=e.map(e=>{let t=K(y.args,e.labelKey),o=K(y.args,e.placeholderKey),s=i[e.key]??``;return(0,z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,z.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,z.jsxs)(`span`,{className:`text-xs font-medium text-fg-muted`,children:[t,e.required?` *`:``]}),e.multiline&&p?(0,z.jsx)(B,{value:s,onApply:t=>a({...i,[e.key]:t}),fieldId:`workflow.arg.${e.key}`,fieldLabel:t,scenario:p.argScenario??`workflow.arg`,locale:r,context:{...p.context,workflowName:n,workflowArgs:i,fieldKey:e.key},disabled:p.disabled,showLabel:!1}):null]}),e.multiline?(0,z.jsx)(`textarea`,{value:s,onChange:t=>a({...i,[e.key]:t.target.value}),placeholder:o,className:c(l,`min-h-20 resize-y`)}):(0,z.jsx)(`input`,{value:s,onChange:t=>a({...i,[e.key]:t.target.value}),placeholder:o,className:l})]},e.key)}),w=v&&h.length>0?(0,z.jsx)(se,{examples:h,labels:y,onSelect:_}):null,T=g?(0,z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,z.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,z.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:y.goalLabel}),p?(0,z.jsx)(B,{value:o,onApply:s,fieldId:`workflow.goal`,fieldLabel:y.goalLabel,scenario:p.goalScenario??`cron.workflowGoal`,locale:r,context:{...p.context,workflowName:n,workflowArgs:i},disabled:p.disabled,showLabel:!1}):null]}),(0,z.jsx)(`textarea`,{value:o,onChange:e=>s(e.target.value),placeholder:y.goalPlaceholder,className:c(l,`min-h-20 resize-y`)})]}):null,t[2]=p,t[3]=i,t[4]=h,t[5]=o,t[6]=f,t[7]=r,t[8]=a,t[9]=s,t[10]=g,t[11]=n,t[12]=_,t[13]=v,t[14]=y,t[15]=b,t[16]=C,t[17]=w,t[18]=T}else _=t[12],v=t[13],y=t[14],b=t[15],C=t[16],w=t[17],T=t[18];let E;t[23]!==_||t[24]!==h||t[25]!==v||t[26]!==y?(E=!v&&h.length>0?(0,z.jsx)(se,{examples:h,labels:y,onSelect:_}):null,t[23]=_,t[24]=h,t[25]=v,t[26]=y,t[27]=E):E=t[27];let D;return t[28]!==b||t[29]!==C||t[30]!==w||t[31]!==T||t[32]!==E?(D=(0,z.jsxs)(`div`,{className:b,children:[C,w,T,E]}),t[28]=b,t[29]=C,t[30]=w,t[31]=T,t[32]=E,t[33]=D):D=t[33],D}var q=`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`;function le({schema:e,value:t,onChange:n,labels:r,aiAssist:i,onValidChange:a}){let o=(0,N.useMemo)(()=>H(e),[e]),[s,l]=(0,N.useState)(!1),[u,d]=(0,N.useState)(()=>JSON.stringify(t,null,2)),[f,p]=(0,N.useState)(null);if(o.length===0)return null;let m=(e,r)=>{let i={...t,[e]:r};(r===``||r===void 0)&&delete i[e],n(i),s&&d(JSON.stringify(i,null,2))},h=e=>{d(e);try{let t=e.trim()?JSON.parse(e):{};if(!t||typeof t!=`object`||Array.isArray(t)){p(r.rawJsonInvalid),a?.(!1);return}p(null),n(t),a?.(!0,t)}catch{p(r.rawJsonInvalid),a?.(!1)}};return(0,z.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel/70 p-4 shadow-surface`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:r.inputSchemaHeading}),(0,z.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-accent-fg hover:underline`,onClick:()=>{let e=!s;l(e),e&&(d(JSON.stringify(t,null,2)),p(null),a?.(!0))},children:r.rawJson})]}),s?(0,z.jsxs)(`div`,{className:`mt-3`,children:[(0,z.jsx)(`textarea`,{value:u,onChange:e=>h(e.target.value),spellCheck:!1,className:c(q,`min-h-40 font-mono text-xs leading-5`)}),f?(0,z.jsx)(`p`,{className:`mt-1 text-xs text-red-600 dark:text-red-300`,children:f}):null]}):(0,z.jsx)(`div`,{className:`mt-3 grid gap-3`,children:o.map(e=>(0,z.jsx)(ue,{field:e,value:t[e.key],labels:r,aiAssist:i,allValues:t,onChange:t=>m(e.key,t)},e.key))})]})}function ue(e){let t=(0,P.c)(30),{field:n,value:r,labels:o,aiAssist:s,allValues:l,onChange:u}=e,d=n.schema.title||n.key,f=typeof n.schema.description==`string`?n.schema.description:void 0,p=Array.isArray(n.schema.type)?n.schema.type[0]:n.schema.type,m;t[0]===n.schema.enum?m=t[1]:(m=Array.isArray(n.schema.enum)?n.schema.enum:[],t[0]=n.schema.enum,t[1]=m);let h=m,g=!!s&&!h.length&&(p===`string`||!p),_=String(d),v=n.required?` *`:``,y;t[2]!==_||t[3]!==v?(y=(0,z.jsxs)(`span`,{className:`text-xs font-medium text-fg`,children:[_,v]}),t[2]=_,t[3]=v,t[4]=y):y=t[4];let b;t[5]!==s||t[6]!==l||t[7]!==n.key||t[8]!==n.schema||t[9]!==u||t[10]!==g||t[11]!==d||t[12]!==r?(b=g&&s?(0,z.jsx)(B,{value:typeof r==`string`?r:r==null?``:String(r),onApply:u,fieldId:`workflow.schema.${n.key}`,fieldLabel:String(d),scenario:s.scenario??`workflow.arg`,locale:s.locale,context:{...s.context,fieldKey:n.key,fieldSchema:n.schema,inputValues:l},disabled:s.disabled,showLabel:!1}):null,t[5]=s,t[6]=l,t[7]=n.key,t[8]=n.schema,t[9]=u,t[10]=g,t[11]=d,t[12]=r,t[13]=b):b=t[13];let x;t[14]!==y||t[15]!==b?(x=(0,z.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[y,b]}),t[14]=y,t[15]=b,t[16]=x):x=t[16];let S;t[17]===f?S=t[18]:(S=f?(0,z.jsx)(`p`,{className:`mt-0.5 text-xs leading-5 text-fg-subtle`,children:f}):null,t[17]=f,t[18]=S);let C;t[19]!==f||t[20]!==h||t[21]!==o||t[22]!==u||t[23]!==p||t[24]!==r?(C=h.length>0?(0,z.jsxs)(i,{value:r==null?``:String(r),onChange:e=>u(e.target.value),className:q,children:[(0,z.jsx)(a,{value:``}),h.map(de)]}):p===`boolean`?(0,z.jsxs)(i,{value:typeof r==`boolean`?String(r):``,onChange:e=>u(e.target.value===``?void 0:e.target.value===`true`),className:q,children:[(0,z.jsx)(a,{value:``}),(0,z.jsx)(a,{value:`true`,children:o.booleanTrue}),(0,z.jsx)(a,{value:`false`,children:o.booleanFalse})]}):p===`number`||p===`integer`?(0,z.jsx)(`input`,{type:`number`,value:typeof r==`number`||typeof r==`string`?String(r):``,onChange:e=>u(e.target.value===``?void 0:Number(e.target.value)),className:q}):(0,z.jsx)(`textarea`,{value:typeof r==`string`?r:r==null?``:String(r),onChange:e=>u(e.target.value),className:c(q,f&&f.length>80?`min-h-20 resize-y`:`min-h-10 resize-y`)}),t[19]=f,t[20]=h,t[21]=o,t[22]=u,t[23]=p,t[24]=r,t[25]=C):C=t[25];let w;return t[26]!==x||t[27]!==S||t[28]!==C?(w=(0,z.jsxs)(`div`,{className:`block`,children:[x,S,C]}),t[26]=x,t[27]=S,t[28]=C,t[29]=w):w=t[29],w}function de(e){return(0,z.jsx)(a,{value:String(e),children:String(e)},String(e))}function J(e){let t=(0,P.c)(12),{examples:n,labels:r,onSelect:i}=e;if(n.length===0)return null;let a;t[0]===r.examplePrompts?a=t[1]:(a=(0,z.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:r.examplePrompts}),t[0]=r.examplePrompts,t[1]=a);let o;if(t[2]!==n||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>(0,z.jsx)(`button`,{type:`button`,onClick:()=>i(e),className:`rounded-lg border border-edge bg-surface-base/50 px-3 py-2 text-left text-xs text-fg-muted hover:bg-surface-hover`,children:e.text},`${e.field}:${e.text}`),t[5]=i,t[6]=e),o=n.map(e),t[2]=n,t[3]=i,t[4]=o}else o=t[4];let s;t[7]===o?s=t[8]:(s=(0,z.jsx)(`div`,{className:`mt-2 flex flex-col gap-1.5`,children:o}),t[7]=o,t[8]=s);let c;return t[9]!==a||t[10]!==s?(c=(0,z.jsxs)(`div`,{children:[a,s]}),t[9]=a,t[10]=s,t[11]=c):c=t[11],c}function Y(e){let t=(0,P.c)(114),{definition:n,language:r,value:i,onChange:a,aiAssist:o,inputClassName:s,onValidityChange:l}=e,u;t[0]===r?u=t[1]:(u=d(r),t[0]=r,t[1]=u);let f=u.workflows,p;t[2]!==n||t[3]!==r?(p=C(n,r),t[2]=n,t[3]=r,t[4]=p):p=t[4];let m=p,[h,g]=(0,N.useState)(!0),_;t[5]===m.examplePrompts?_=t[6]:(_=m.examplePrompts??[],t[5]=m.examplePrompts,t[6]=_);let v=_,y;t[7]===n.inputSchema?y=t[8]:(y=V(n.inputSchema),t[7]=n.inputSchema,t[8]=y);let b=y,x,S,w,T,E,D,O,k,A,j;if(t[9]!==o||t[10]!==n||t[11]!==v||t[12]!==b||t[13]!==s||t[14]!==f||t[15]!==r||t[16]!==m.description||t[17]!==a||t[18]!==l||t[19]!==h||t[20]!==i){E=Symbol.for(`react.early_return_sentinel`);bb0:{let e=c(`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`,s),u;t[31]!==n||t[32]!==a||t[33]!==l||t[34]!==h?(u=(e,t)=>{let r=t===void 0?h:t;a(e),l?.(G(n,e,r))},t[31]=n,t[32]=a,t[33]=l,t[34]=h,t[35]=u):u=t[35];let d=u,p;t[36]!==d||t[37]!==i?(p=e=>d({...i,goal:e}),t[36]=d,t[37]=i,t[38]=p):p=t[38];let _=p,y;t[39]!==d||t[40]!==i?(y=e=>d({...i,schemaInput:e}),t[39]=d,t[40]=i,t[41]=y):y=t[41];let C=y,M;t[42]!==d||t[43]!==i?(M=e=>d({...i,argValues:e}),t[42]=d,t[43]=i,t[44]=M):M=t[44];let N=M,P;if(t[45]!==_||t[46]!==C||t[47]!==i.schemaInput?(P=e=>{if(e.field===`goal`){_(e.text);return}C({...i.schemaInput,[e.field]:e.text})},t[45]=_,t[46]=C,t[47]=i.schemaInput,t[48]=P):P=t[48],x=P,!b){let e;t[49]!==o||t[50]!==n.id||t[51]!==n.name||t[52]!==n.title||t[53]!==m.description?(e=o?{disabled:o.disabled,argScenario:o.inputScenario??`workflow.arg`,goalScenario:o.goalScenario??`workflow.goal`,context:{...o.context,workflowId:n.id,workflowName:n.name,workflowTitle:n.title,workflowDescription:m.description}}:void 0,t[49]=o,t[50]=n.id,t[51]=n.name,t[52]=n.title,t[53]=m.description,t[54]=e):e=t[54];let a;t[55]!==n.name||t[56]!==v||t[57]!==s||t[58]!==r||t[59]!==N||t[60]!==_||t[61]!==e||t[62]!==i.argValues||t[63]!==i.goal?(a=(0,z.jsx)(ce,{workflowName:n.name,language:r,argValues:i.argValues,onArgValuesChange:N,goal:i.goal,onGoalChange:_,examplePrompts:v,inputClassName:s,aiAssist:e}),t[55]=n.name,t[56]=v,t[57]=s,t[58]=r,t[59]=N,t[60]=_,t[61]=e,t[62]=i.argValues,t[63]=i.goal,t[64]=a):a=t[64],E=a;break bb0}w=`flex flex-col gap-3`,t[65]!==o||t[66]!==n||t[67]!==f.booleanFalse||t[68]!==f.booleanTrue||t[69]!==f.inputSchemaHeading||t[70]!==f.rawJson||t[71]!==f.rawJsonInvalid||t[72]!==r||t[73]!==m.description||t[74]!==l||t[75]!==C||t[76]!==i?(T=n.inputSchema?(0,z.jsx)(le,{schema:n.inputSchema,value:i.schemaInput,onChange:C,onValidChange:(e,t)=>{g(e),l?.(G(n,t?{...i,schemaInput:t}:i,e))},aiAssist:o?{locale:r,disabled:o.disabled,scenario:o.inputScenario??`workflow.arg`,context:{...o.context,workflowId:n.id,workflowName:n.name,workflowTitle:n.title,workflowDescription:m.description}}:void 0,labels:{inputSchemaHeading:f.inputSchemaHeading,rawJson:f.rawJson,rawJsonInvalid:f.rawJsonInvalid,booleanTrue:f.booleanTrue,booleanFalse:f.booleanFalse}}):null,t[65]=o,t[66]=n,t[67]=f.booleanFalse,t[68]=f.booleanTrue,t[69]=f.inputSchemaHeading,t[70]=f.rawJson,t[71]=f.rawJsonInvalid,t[72]=r,t[73]=m.description,t[74]=l,t[75]=C,t[76]=i,t[77]=T):T=t[77],j=`flex flex-col gap-1`;let F;t[78]===f.goalLabel?F=t[79]:(F=(0,z.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:f.goalLabel}),t[78]=f.goalLabel,t[79]=F);let I;t[80]!==o||t[81]!==n.id||t[82]!==n.name||t[83]!==n.title||t[84]!==f.goalLabel||t[85]!==r||t[86]!==m.description||t[87]!==_||t[88]!==i.goal||t[89]!==i.schemaInput?(I=o?(0,z.jsx)(B,{value:i.goal,onApply:_,fieldId:`workflow.goal`,fieldLabel:f.goalLabel,scenario:o.goalScenario??`workflow.goal`,locale:r,context:{...o.context,workflowId:n.id,workflowName:n.name,workflowTitle:n.title,workflowDescription:m.description,workflowInput:i.schemaInput},disabled:o.disabled,showLabel:!1}):null,t[80]=o,t[81]=n.id,t[82]=n.name,t[83]=n.title,t[84]=f.goalLabel,t[85]=r,t[86]=m.description,t[87]=_,t[88]=i.goal,t[89]=i.schemaInput,t[90]=I):I=t[90],t[91]!==F||t[92]!==I?(S=(0,z.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[F,I]}),t[91]=F,t[92]=I,t[93]=S):S=t[93],D=i.goal,t[94]===_?O=t[95]:(O=e=>_(e.target.value),t[94]=_,t[95]=O),k=f.goalPlaceholder,A=c(e,`min-h-20 resize-y`)}t[9]=o,t[10]=n,t[11]=v,t[12]=b,t[13]=s,t[14]=f,t[15]=r,t[16]=m.description,t[17]=a,t[18]=l,t[19]=h,t[20]=i,t[21]=x,t[22]=S,t[23]=w,t[24]=T,t[25]=E,t[26]=D,t[27]=O,t[28]=k,t[29]=A,t[30]=j}else x=t[21],S=t[22],w=t[23],T=t[24],E=t[25],D=t[26],O=t[27],k=t[28],A=t[29],j=t[30];if(E!==Symbol.for(`react.early_return_sentinel`))return E;let M;t[96]!==D||t[97]!==O||t[98]!==k||t[99]!==A?(M=(0,z.jsx)(`textarea`,{value:D,onChange:O,placeholder:k,className:A}),t[96]=D,t[97]=O,t[98]=k,t[99]=A,t[100]=M):M=t[100];let F;t[101]!==S||t[102]!==M||t[103]!==j?(F=(0,z.jsxs)(`div`,{className:j,children:[S,M]}),t[101]=S,t[102]=M,t[103]=j,t[104]=F):F=t[104];let I;t[105]!==x||t[106]!==v||t[107]!==f?(I=(0,z.jsx)(J,{examples:v,labels:f,onSelect:x}),t[105]=x,t[106]=v,t[107]=f,t[108]=I):I=t[108];let L;return t[109]!==w||t[110]!==T||t[111]!==F||t[112]!==I?(L=(0,z.jsxs)(`div`,{className:w,children:[T,F,I]}),t[109]=w,t[110]=T,t[111]=F,t[112]=I,t[113]=L):L=t[113],L}function X(e,t){let n=e.metadata.estimatedAgents;return n?n.min===n.max?M(t.agentScaleExact,{count:n.min}):M(t.agentScaleRange,{min:n.min,max:n.max}):M(t.agentScaleExact,{count:e.defaults.maxSubagents})}function fe(e){let t=(0,P.c)(41),{definition:n,language:r,value:i,onChange:a,mode:o,badgeLabel:s,aiAssist:l,inputClassName:u,showTimeout:f,defaultAdvancedOpen:p,onValidityChange:m}=e,h=f===void 0?!1:f,g=p===void 0?!1:p,_=d(r).workflows,[v,y]=(0,N.useState)(g),b;t[0]!==n||t[1]!==r?(b=C(n,r),t[0]=n,t[1]=r,t[2]=b):b=t[2];let x=b,S;t[3]!==n.defaults||t[4]!==i.concurrency?(S=i.concurrency.trim()?Number(i.concurrency):n.defaults.concurrency,t[3]=n.defaults,t[4]=i.concurrency,t[5]=S):S=t[5];let E=S,D;t[6]!==n.defaults||t[7]!==i.maxSubagents?(D=i.maxSubagents.trim()?Number(i.maxSubagents):n.defaults.maxSubagents,t[6]=n.defaults,t[7]=i.maxSubagents,t[8]=D):D=t[8];let O=D,F;t[9]!==n||t[10]!==r||t[11]!==i?(F=ae(n,r,i),t[9]=n,t[10]=r,t[11]=i,t[12]=F):F=t[12];let I=F,L=s??_.readyToStart,R;t[13]!==a||t[14]!==i?(R=e=>a({...i,...e}),t[13]=a,t[14]=i,t[15]=R):R=t[15];let ee=R,te=o===`automation`&&`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,ne;t[16]===te?ne=t[17]:(ne=c(`space-y-4`,te),t[16]=te,t[17]=ne);let B=I||x.description,re;t[18]===B?re=t[19]:(re=(0,z.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:B}),t[18]=B,t[19]=re);let ie;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,z.jsx)(j,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[20]=ie):ie=t[20];let V;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,z.jsx)(w,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[21]=V):V=t[21];let H;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,z.jsx)(k,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[22]=H):H=t[22];let U;t[23]!==a||t[24]!==i?(U=e=>a({...i,...e}),t[23]=a,t[24]=i,t[25]=U):U=t[25];let W;t[26]===m?W=t[27]:(W=e=>{m?.(e)},t[26]=m,t[27]=W);let G;t[28]!==l||t[29]!==n||t[30]!==u||t[31]!==r||t[32]!==U||t[33]!==W||t[34]!==i?(G=(0,z.jsx)(Y,{definition:n,language:r,value:i,onChange:U,onValidityChange:W,aiAssist:l,inputClassName:u}),t[28]=l,t[29]=n,t[30]=u,t[31]=r,t[32]=U,t[33]=W,t[34]=i,t[35]=G):G=t[35];let K;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(K=()=>y(pe),t[36]=K):K=t[36];let oe=_.advancedSettings,se=v&&`rotate-180`,ce;t[37]===se?ce=t[38]:(ce=c(`size-4 transition-transform`,se),t[37]=se,t[38]=ce);let q;return t[39]===ce?q=t[40]:(q=(0,z.jsx)(T,{className:ce}),t[39]=ce,t[40]=q),(0,z.jsxs)(`div`,{className:ne,children:[(0,z.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:_.runPlanPreview}),re]}),(0,z.jsx)(`span`,{className:`shrink-0 rounded-full bg-accent-soft px-2 py-1 text-[11px] font-medium text-accent-fg`,children:L})]}),(0,z.jsxs)(`div`,{className:`mt-4 grid gap-2 text-xs text-fg-muted sm:grid-cols-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-surface-panel px-2.5 py-2`,children:[ie,(0,z.jsx)(`span`,{children:M(_.phaseCount,{count:n.phases.length})})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-surface-panel px-2.5 py-2`,children:[V,(0,z.jsx)(`span`,{children:X(n,_)})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-surface-panel px-2.5 py-2`,children:[H,(0,z.jsx)(`span`,{children:M(_.runLimitsSummary,{concurrency:E,max:O})})]})]}),n.phases.length>0?(0,z.jsxs)(`div`,{className:`mt-4`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:[(0,z.jsx)(A,{className:`size-3.5`,"aria-hidden":!0}),_.startPlanPhases]}),(0,z.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5`,children:n.phases.map(me)})]}):null]}),G,(0,z.jsxs)(`div`,{className:`rounded-xl border border-edge`,children:[(0,z.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between px-3 py-2.5 text-left text-sm text-fg`,onClick:K,children:[oe,q]}),v?(0,z.jsxs)(`div`,{className:`grid gap-3 border-t border-edge px-3 pb-3 pt-3 sm:grid-cols-2`,children:[(0,z.jsx)(`input`,{value:i.concurrency,onChange:e=>ee({concurrency:e.target.value}),placeholder:M(_.concurrencyPlaceholder,{default:n.defaults.concurrency}),inputMode:`numeric`,className:`rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`}),(0,z.jsx)(`input`,{value:i.maxSubagents,onChange:e=>ee({maxSubagents:e.target.value}),placeholder:M(_.maxSubagentsPlaceholder,{default:n.defaults.maxSubagents}),inputMode:`numeric`,className:`rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`}),h?(0,z.jsx)(`input`,{value:i.timeoutSeconds??``,onChange:e=>ee({timeoutSeconds:e.target.value}),placeholder:M(_.timeoutSecondsPlaceholder,{default:n.defaults.timeoutSec}),inputMode:`numeric`,className:`rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`}):null]}):null]})]})}function pe(e){return!e}function me(e,t){return(0,z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[t>0?(0,z.jsx)(`span`,{className:`text-fg-subtle`,children:`→`}):null,(0,z.jsx)(`span`,{className:`rounded-lg border border-edge-subtle bg-surface-panel px-2 py-1 text-[11px] text-fg-muted`,children:e.title})]},e.id)}export{B as a,G as i,oe as n,W as r,fe as t};