@xopcai/xopc 0.0.335 → 0.0.337

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 (167) hide show
  1. package/dist/browser-ext/dist/assets/{auth-Cjj5SuoT.js → auth-BsvblhQz.js} +2 -1
  2. package/dist/browser-ext/dist/background.js +1 -1
  3. package/dist/browser-ext/dist/sidepanel.html +1 -1
  4. package/dist/browser-ext/dist/sidepanel.js +1 -1
  5. package/dist/browser-ext/manifest.json +1 -1
  6. package/dist/extensions/telegram/xopc.extension.json +1 -1
  7. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DtmNsTNI.js → agent-avatar-dicebear-CSHghJkF.js} +1 -1
  8. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-AvGo9fao.js → agent-defaults-settings-panel-DcDz1HJb.js} +1 -1
  9. package/dist/gateway/static/root/assets/{agent-plugin-dialog-DZCh4_E1.js → agent-plugin-dialog-C7A9k86o.js} +1 -1
  10. package/dist/gateway/static/root/assets/{agents-Drt1vHf6.js → agents-wih5cVy1.js} +3 -3
  11. package/dist/gateway/static/root/assets/{app-management-settings-panel-IKZm5_s2.js → app-management-settings-panel-LQ_zVJ9C.js} +1 -1
  12. package/dist/gateway/static/root/assets/{appearance-settings-DKWGkrVW.js → appearance-settings-C2gaax8U.js} +1 -1
  13. package/dist/gateway/static/root/assets/{apps-page-DY6Q7TMZ.js → apps-page-CobrkzwB.js} +1 -1
  14. package/dist/gateway/static/root/assets/{archive-plugin-DXGAt0G7.js → archive-plugin-CK_qS4Ex.js} +1 -1
  15. package/dist/gateway/static/root/assets/{automations-page-DzqfYcqe.js → automations-page-DtuUM9W8.js} +1 -1
  16. package/dist/gateway/static/root/assets/{automations-workspace-qMpqvBz1.js → automations-workspace-BNcU6ReT.js} +1 -1
  17. package/dist/gateway/static/root/assets/{binary-plugins-Cy2FLsPv.js → binary-plugins-BN0iLzVY.js} +1 -1
  18. package/dist/gateway/static/root/assets/{block-editor-BqSpSNnv.js → block-editor-CpLJmCV2.js} +1 -1
  19. package/dist/gateway/static/root/assets/{browser-automations-page-BEeyiVEw.js → browser-automations-page-DqKKZQNI.js} +1 -1
  20. package/dist/gateway/static/root/assets/{browser-settings-page-D6SygxnY.js → browser-settings-page-B0Vxlns8.js} +1 -1
  21. package/dist/gateway/static/root/assets/{capabilities-page-C9Od0WN-.js → capabilities-page-Bn72DIFn.js} +2 -2
  22. package/dist/gateway/static/root/assets/{capabilities-settings-panel-6HAVkNE4.js → capabilities-settings-panel-n4g4t5LK.js} +1 -1
  23. package/dist/gateway/static/root/assets/{capability-header-actions-CwcT7mjE.js → capability-header-actions-CIxZrN4w.js} +1 -1
  24. package/dist/gateway/static/root/assets/{channels-D5HNBMLS.js → channels-D8P0Sbu1.js} +1 -1
  25. package/dist/gateway/static/root/assets/{chat-terminal-dock-BsxTfU1T.js → chat-terminal-dock-BJzZ5vkP.js} +1 -1
  26. package/dist/gateway/static/root/assets/{computer-settings-page-CH01h8yI.js → computer-settings-page-WT8yMsKu.js} +1 -1
  27. package/dist/gateway/static/root/assets/{connector-service-page-CTi8iaOn.js → connector-service-page-71NVbenX.js} +1 -1
  28. package/dist/gateway/static/root/assets/{connectors-page-C3GhbPPg.js → connectors-page-DdBdSoYi.js} +1 -1
  29. package/dist/gateway/static/root/assets/{date-picker-DTEOeiC4.js → date-picker-WyLSk4_J.js} +1 -1
  30. package/dist/gateway/static/root/assets/{dependency-picker-DFA0RZ02.js → dependency-picker-BTdAiaBP.js} +1 -1
  31. package/dist/gateway/static/root/assets/{desktop-pet-Txr49_Zi.js → desktop-pet-f0MgT5Um.js} +1 -1
  32. package/dist/gateway/static/root/assets/{desktop-pet-settings-Coi0DUai.js → desktop-pet-settings-DKVITn3D.js} +1 -1
  33. package/dist/gateway/static/root/assets/{device-pairing-wizard-OPY8ujCN.js → device-pairing-wizard-1Buarqmz.js} +1 -1
  34. package/dist/gateway/static/root/assets/{directory-picker-path-field-B1ckH4hn.js → directory-picker-path-field-BoGtoYn0.js} +1 -1
  35. package/dist/gateway/static/root/assets/{extension-debug-page-6e8BCEb6.js → extension-debug-page-DPwnz1-y.js} +1 -1
  36. package/dist/gateway/static/root/assets/{extension-page-DgaFykYf.js → extension-page-CzioOhli.js} +1 -1
  37. package/dist/gateway/static/root/assets/{extension-settings-page-B-TyR9GM.js → extension-settings-page-Cqq5bdYp.js} +1 -1
  38. package/dist/gateway/static/root/assets/gateway-realtime-vOLum3RR.js +1 -0
  39. package/dist/gateway/static/root/assets/{gateway-settings-CtjGyqB2.js → gateway-settings-CoXYbhk4.js} +1 -1
  40. package/dist/gateway/static/root/assets/{home-page-Cs5fPXcJ.js → home-page-z3Jiv5fF.js} +1 -1
  41. package/dist/gateway/static/root/assets/{imports-page-C72wCY44.js → imports-page-DHiUg7PR.js} +1 -1
  42. package/dist/gateway/static/root/assets/index-Bd7mDZFV.css +1 -0
  43. package/dist/gateway/static/root/assets/{index-BkSp_1Il.js → index-D3OtdgCs.js} +10 -10
  44. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-D1nzw6zI.js → keyboard-shortcuts-settings-CbcZK4S6.js} +1 -1
  45. package/dist/gateway/static/root/assets/{local-app-workbench-page-DqB0hGrZ.js → local-app-workbench-page-3HC00KSx.js} +1 -1
  46. package/dist/gateway/static/root/assets/{local-apps-page-D4FX0Ptx.js → local-apps-page-etrJtvmm.js} +1 -1
  47. package/dist/gateway/static/root/assets/{logs-page-CcWD_-zy.js → logs-page-BsSdbCw2.js} +1 -1
  48. package/dist/gateway/static/root/assets/{management-settings-L9YGzLaz.js → management-settings-DODrHfBO.js} +1 -1
  49. package/dist/gateway/static/root/assets/{media-plugins-DqsiYyAz.js → media-plugins-C0JdlHpy.js} +1 -1
  50. package/dist/gateway/static/root/assets/{note-detail-panel-DwK9Ndw1.js → note-detail-panel-fPUNv1PI.js} +3 -3
  51. package/dist/gateway/static/root/assets/{notes-page-D2FvAV9x.js → notes-page-I9h6l38z.js} +1 -1
  52. package/dist/gateway/static/root/assets/{page-context-capture-button-CeWnFomm.js → page-context-capture-button-BlcjlzGF.js} +1 -1
  53. package/dist/gateway/static/root/assets/{page-tabs-B90ywILw.js → page-tabs-_eLR6cpb.js} +1 -1
  54. package/dist/gateway/static/root/assets/{preview-open-alternatives-CwuY-FIE.js → preview-open-alternatives-BfJBJ4NU.js} +1 -1
  55. package/dist/gateway/static/root/assets/{product-open-page-CUcJOCAz.js → product-open-page-RdYBwQ_V.js} +1 -1
  56. package/dist/gateway/static/root/assets/{project-detail-page-Blo9-zcq.js → project-detail-page-DyAKlm_h.js} +1 -1
  57. package/dist/gateway/static/root/assets/{projects-page-C9rh1U9Z.js → projects-page-Bk51sbKy.js} +1 -1
  58. package/dist/gateway/static/root/assets/{remote-access-hub-Cw2Beq7s.js → remote-access-hub-BbMbnizV.js} +1 -1
  59. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-Cj8LnZRV.js → runtime-tools-settings-panel-yqbX-cYN.js} +1 -1
  60. package/dist/gateway/static/root/assets/{scenes-page-BZd4VZBP.js → scenes-page-L69Imde_.js} +1 -1
  61. package/dist/gateway/static/root/assets/{schema-form-CNbrdYAu.js → schema-form-BWlMiaNv.js} +1 -1
  62. package/dist/gateway/static/root/assets/{session-manager-DAck_U0C.js → session-manager-g96pFnRm.js} +1 -1
  63. package/dist/gateway/static/root/assets/{sessions-page-BKt3Cd0a.js → sessions-page-S-UqCz6P.js} +1 -1
  64. package/dist/gateway/static/root/assets/settings-advanced-gate-Q52AAHh_.js +1 -0
  65. package/dist/gateway/static/root/assets/{settings-form-section-u6ZXo3oJ.js → settings-form-section-DqUsAh0K.js} +1 -1
  66. package/dist/gateway/static/root/assets/{settings-page-gXacaOIv.js → settings-page-4eoaA_Hs.js} +1 -1
  67. package/dist/gateway/static/root/assets/{setup-status-panel-qKaz5drv.js → setup-status-panel-6BuwbANT.js} +1 -1
  68. package/dist/gateway/static/root/assets/{share-preview-page-DdkQ-B5M.js → share-preview-page-B-w3pIG5.js} +1 -1
  69. package/dist/gateway/static/root/assets/{shares-settings-BwFn5CYE.js → shares-settings-Bn03bnYk.js} +1 -1
  70. package/dist/gateway/static/root/assets/{skill-api-Cf3_ZQOb.js → skill-api-BN7zgPjv.js} +1 -1
  71. package/dist/gateway/static/root/assets/{skill-reload-api-CdNp1N-Y.js → skill-reload-api-BsBfMvch.js} +1 -1
  72. package/dist/gateway/static/root/assets/{skills-page-fKPvwSpa.js → skills-page-CcYeAh5v.js} +1 -1
  73. package/dist/gateway/static/root/assets/{system-settings-panel-CO3l1jdd.js → system-settings-panel-BV2zesop.js} +1 -1
  74. package/dist/gateway/static/root/assets/{task-detail-page-zClWGuT5.js → task-detail-page-BqN3GUm7.js} +1 -1
  75. package/dist/gateway/static/root/assets/{tunnel-api-Dw6DW1j5.js → tunnel-api-Dk3SmnSL.js} +1 -1
  76. package/dist/gateway/static/root/assets/{usage-page-QP_8nuHU.js → usage-page-DStU1Zyn.js} +1 -1
  77. package/dist/gateway/static/root/assets/{use-autosave-ZwnXUpG4.js → use-autosave-D3oLuZ7h.js} +1 -1
  78. package/dist/gateway/static/root/assets/{user-model-page-B72PRFAI.js → user-model-page-BXMZoqpb.js} +1 -1
  79. package/dist/gateway/static/root/assets/{voice-api-key-field-CbIxN5SC.js → voice-api-key-field-CzvudzG6.js} +1 -1
  80. package/dist/gateway/static/root/assets/{work-discovery-overlay-WIGHfEL3.js → work-discovery-overlay-D6oUEOYn.js} +1 -1
  81. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-Bk0Jhdeq.js → workflow-run-setup-panel-CXxr4wmO.js} +1 -1
  82. package/dist/gateway/static/root/assets/{workflows-page-BC385JPr.js → workflows-page-D9uPt_T2.js} +1 -1
  83. package/dist/gateway/static/root/index.html +4 -4
  84. package/dist/package.js +1 -1
  85. package/dist/packages/gateway-contract/src/product-delivery.js +10 -1
  86. package/dist/packages/realtime-protocol/src/index.js +2 -1
  87. package/dist/src/agent/agent-manager.js +5 -5
  88. package/dist/src/agent/background-review/run-background-review.js +2 -2
  89. package/dist/src/agent/bootstrap/filter-bootstrap-files.js +1 -1
  90. package/dist/src/agent/embedded/model-runtime.js +1 -1
  91. package/dist/src/agent/embedded/run-for-session.js +1 -1
  92. package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
  93. package/dist/src/agent/image/tool-model-config.js +2 -2
  94. package/dist/src/agent/service.js +4 -4
  95. package/dist/src/agent/session/session-inspector.js +1 -1
  96. package/dist/src/agent/tasks/task-judge-service.js +3 -3
  97. package/dist/src/agent/tools/xopc-use-tool.js +1 -1
  98. package/dist/src/agent-catalog/capabilities.js +2 -2
  99. package/dist/src/ai-assist/text-assist.js +1 -1
  100. package/dist/src/auth/credentials.js +1 -1
  101. package/dist/src/auth/oauth-provider-lock.js +1 -1
  102. package/dist/src/auth/sync-provider-auth.js +1 -1
  103. package/dist/src/automations/capabilities/drafts.js +1 -1
  104. package/dist/src/bootstrap/application-state.js +1 -1
  105. package/dist/src/capabilities/runtime/dispatcher.js +1 -1
  106. package/dist/src/capabilities/runtime/product.js +1 -1
  107. package/dist/src/chat-commands/agent-edit.js +1 -1
  108. package/dist/src/chat-commands/builtins/config.js +1 -1
  109. package/dist/src/cli/commands/agent.js +1 -1
  110. package/dist/src/cli/commands/agents.js +1 -1
  111. package/dist/src/cli/commands/doctor/checks/provider-auth.js +2 -2
  112. package/dist/src/cli/commands/models.js +1 -1
  113. package/dist/src/cli/commands/onboard/model.js +2 -2
  114. package/dist/src/cli/utils/init-workspace-core.js +1 -1
  115. package/dist/src/computer/runtime.js +1 -1
  116. package/dist/src/config/index.js +5 -5
  117. package/dist/src/config/loader.js +2 -2
  118. package/dist/src/config/models-json.js +1 -1
  119. package/dist/src/config/schema.js +1 -1
  120. package/dist/src/extensions/agent-plugins/validation.js +1 -1
  121. package/dist/src/gateway/agents-admin.js +2 -2
  122. package/dist/src/gateway/chat-stream/mapper.js +2 -0
  123. package/dist/src/gateway/chat-stream/protocol.d.ts +1 -0
  124. package/dist/src/gateway/file-path-classifier.js +1 -1
  125. package/dist/src/gateway/hono/lib/config-payload.js +1 -1
  126. package/dist/src/gateway/hono/routes/config-patch/misc.js +2 -2
  127. package/dist/src/gateway/hono/routes/models.js +1 -1
  128. package/dist/src/gateway/hono/routes/notes.js +2 -2
  129. package/dist/src/gateway/hono/routes/projects.js +2 -2
  130. package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
  131. package/dist/src/gateway/hono/routes/sessions.js +11 -2
  132. package/dist/src/gateway/hono/routes/tasks.js +1 -1
  133. package/dist/src/gateway/image-generation-setup.js +2 -2
  134. package/dist/src/gateway/lock.js +1 -1
  135. package/dist/src/gateway/service/sessions-api.d.ts +4 -1
  136. package/dist/src/gateway/service.js +6 -6
  137. package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
  138. package/dist/src/home-intelligence/generator.js +1 -1
  139. package/dist/src/local-apps/service.js +1 -1
  140. package/dist/src/notes/service.js +1 -1
  141. package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
  142. package/dist/src/providers/index.js +2 -2
  143. package/dist/src/providers/model-catalog-persistence.js +1 -1
  144. package/dist/src/providers/register-runtime-providers.js +1 -1
  145. package/dist/src/realtime/compact-run-event.d.ts +3 -0
  146. package/dist/src/realtime/compact-run-event.js +50 -0
  147. package/dist/src/realtime/runtime.js +7 -2
  148. package/dist/src/session/client-history.d.ts +1 -0
  149. package/dist/src/session/compact-history.d.ts +6 -0
  150. package/dist/src/session/compact-history.js +55 -0
  151. package/dist/src/session/manager.d.ts +1 -0
  152. package/dist/src/session/store.d.ts +1 -0
  153. package/dist/src/session/store.js +6 -3
  154. package/dist/src/storage/sqlite/transcript-repository.d.ts +2 -0
  155. package/dist/src/storage/sqlite/transcript-repository.js +10 -1
  156. package/dist/src/tasks/capabilities/read.js +2 -2
  157. package/dist/src/tui/backends/embedded-backend.js +3 -3
  158. package/dist/src/tui/tui-commands.js +1 -1
  159. package/dist/src/tui/tui-startup-resources.js +1 -1
  160. package/dist/src/tui/tui.js +2 -2
  161. package/dist/src/voice/realtime/persona-context.js +1 -1
  162. package/dist/src/work-discovery/service.js +2 -2
  163. package/dist/src/workflows/service/workflow-run-service.js +1 -1
  164. package/package.json +5 -5
  165. package/dist/gateway/static/root/assets/gateway-realtime-CGjSxzj6.js +0 -1
  166. package/dist/gateway/static/root/assets/index-DbLEkdNg.css +0 -1
  167. package/dist/gateway/static/root/assets/settings-advanced-gate-BToasX5M.js +0 -1
@@ -1,2 +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{g as i,u as a}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as o}from"./check-DUBLcKHA.js";import{n as s,r as c,t as l}from"./popover-select-0p9PIHRy.js";import{t as u}from"./circle-check-C23XjkUj.js";import{t as d}from"./ellipsis-0k4rZLoy.js";import{t as f}from"./folder-open-CyzJ19I9.js";import{t as p}from"./loader-circle-CifKLtgG.js";import{t as m}from"./pencil-DmIY3Oa-.js";import{t as h}from"./plus-Q2yW6OE7.js";import{t as g}from"./search-DA7gz22f.js";import{t as _}from"./x-B_N4OPjy.js";import{t as v}from"./cn-JdwAhgNB.js";import{n as y}from"./locale-store-7F4l6DRV.js";import{a as b,c as x,i as ee,n as S,o as C,r as w,s as T,t as E}from"./dist-BGTk37IG.js";import{i as D}from"./vendor-swr-BIWyz7Rc.js";import{t as O}from"./button-CS04eWY9.js";import{t as k}from"./skeleton-BwbyijEw.js";import{Bn as A,Bu as j,Cl as M,Fl as N,Fn as P,Fu as F,Hc as I,In as L,J as R,Ln as z,Lu as B,Oc as V,Po as H,Pu as U,Rn as W,Ru as G,Su as K,Vu as q,Xl as J,Yl as Y,_l as te,_o as ne,at as re,cc as ie,ct as ae,dt as oe,ft as se,fu as ce,gl as le,hu as ue,it as de,lt as fe,mt as pe,ot as me,pc as he,pt as ge,qu as _e,rt as ve,sc as ye,st as be,su as xe,ut as Se,vl as Ce,xc as we}from"./index-BkSp_1Il.js";import{t as Te}from"./page-tabs-B90ywILw.js";import{t as Ee}from"./date-picker-DTEOeiC4.js";var X=e(t(),1),Z=n(),Q=r();function De(e){let t=(0,Z.c)(15),{sourceId:n,disabled:r}=e,i=r===void 0?!1:r,a=y(Ae)===`zh`,{sources:o,starting:s,start:c}=R(),l;t[0]!==n||t[1]!==o?(l=n?o.filter(e=>e.grantId===n):o,t[0]=n,t[1]=o,t[2]=l):l=t[2];let u=l,d;t[3]===u?d=t[4]:(d=u.some(ke),t[3]=u,t[4]=d);let f=d,m=n&&u.some(Oe),h=f?a?`更新中`:`Updating`:m?a?`重试`:`Retry`:n?a?`更新理解`:`Update understanding`:a?`更新全部`:`Update all`,g=i||s||f,_;t[5]!==n||t[6]!==c?(_=()=>void c(n),t[5]=n,t[6]=c,t[7]=_):_=t[7];let v;t[8]===f?v=t[9]:(v=f?(0,Q.jsx)(p,{className:`size-3.5 animate-spin motion-reduce:animate-none`}):(0,Q.jsx)(I,{className:`size-3.5`}),t[8]=f,t[9]=v);let b;return t[10]!==h||t[11]!==g||t[12]!==_||t[13]!==v?(b=(0,Q.jsxs)(O,{variant:`ghost`,className:`h-8 shrink-0 gap-1.5 px-2 text-xs`,disabled:g,onClick:_,children:[v,h]}),t[10]=h,t[11]=g,t[12]=_,t[13]=v,t[14]=b):b=t[14],b}function Oe(e){return e.status===`failed`||e.status===`partial`||e.status===`canceled`}function ke(e){return e.status===`queued`||e.status===`running`}function Ae(e){return e.language}function je(e){let t=(0,Z.c)(22),{sourceId:n,lastCollectedAt:r}=e,i=y(Me),a=i===`zh`,o;t[0]===n?o=t[1]:(o=e=>e.sources.find(e=>e.grantId===n),t[0]=n,t[1]=o);let s=R(o);if(!s){let e;t[2]!==i||t[3]!==r||t[4]!==a?(e=r?`${a?`上次更新:`:`Last updated: `}${new Date(r).toLocaleString(i)}`:a?`尚未分析`:`Not analyzed yet`,t[2]=i,t[3]=r,t[4]=a,t[5]=e):e=t[5];let n;return t[6]===e?n=t[7]:(n=(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:e}),t[6]=e,t[7]=n),n}let c;t[8]===a?c=t[9]:(c=a?{queued:`等待更新`,waiting_desktop:`等待桌面端读取资料`,reading:`正在读取资料`,analyzing:`正在更新理解`}:{queued:`Queued`,waiting_desktop:`Waiting for desktop collection`,reading:`Reading source`,analyzing:`Updating understanding`},t[8]=a,t[9]=c);let l=c,u=s.status===`running`||s.status===`queued`,d=s.status===`failed`||s.status===`partial`||s.status===`canceled`,f=s.metadata.added,p=u?l[s.metadata.phase??`queued`]??l.queued:d?a?`更新未完成,可重试`:`Update incomplete; retry available`:f===0?a?`更新完成,暂无新增理解`:`Updated; no new understanding`:f===void 0?a?`更新完成`:`Updated`:a?`更新完成,新增 ${f} 条`:`Updated; ${f} added`,m;t[10]===p?m=t[11]:(m=(0,Q.jsx)(`p`,{children:p}),t[10]=p,t[11]=m);let h;t[12]!==i||t[13]!==s.completedAt?(h=s.completedAt?(0,Q.jsx)(`p`,{children:new Date(s.completedAt).toLocaleString(i)}):null,t[12]=i,t[13]=s.completedAt,t[14]=h):h=t[14];let g;t[15]!==d||t[16]!==s.errorMessage?(g=d&&s.errorMessage?(0,Q.jsx)(`p`,{className:`text-danger`,children:s.errorMessage}):null,t[15]=d,t[16]=s.errorMessage,t[17]=g):g=t[17];let _;return t[18]!==m||t[19]!==h||t[20]!==g?(_=(0,Q.jsxs)(`div`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,"aria-live":`polite`,children:[m,h,g]}),t[18]=m,t[19]=h,t[20]=g,t[21]=_):_=t[21],_}function Me(e){return e.language}function Ne(e){let t=(0,Z.c)(49),{language:n,busy:r,statement:i,onEdit:a,onDelete:o}=e,[s,c]=(0,X.useState)(!1),l=n===`zh`,u=l?`修改或删除这条内容`:`Edit or delete this item`,f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(d,{className:`size-4`,"aria-hidden":`true`}),t[0]=f):f=t[0];let p;t[1]!==r||t[2]!==u?(p=(0,Q.jsx)(A,{asChild:!0,children:(0,Q.jsx)(O,{variant:`ghost`,className:`size-11 shrink-0 p-0`,disabled:r,"aria-label":u,children:f})}),t[1]=r,t[2]=u,t[3]=p):p=t[3];let h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Q.jsx)(m,{className:`size-4`,"aria-hidden":`true`}),t[4]=h):h=t[4];let g=l?`修改`:`Edit`,_;t[5]!==r||t[6]!==a||t[7]!==g?(_=(0,Q.jsxs)(L,{className:`flex min-h-11 cursor-pointer items-center gap-2 rounded-lg px-3 text-sm text-fg outline-none focus:bg-surface-hover data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,disabled:r,onSelect:a,children:[h,g]}),t[5]=r,t[6]=a,t[7]=g,t[8]=_):_=t[8];let v,y;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(v=()=>c(!0),y=(0,Q.jsx)(he,{className:`size-4`,"aria-hidden":`true`}),t[9]=v,t[10]=y):(v=t[9],y=t[10]);let x=l?`删除`:`Delete`,D;t[11]!==r||t[12]!==x?(D=(0,Q.jsxs)(L,{className:`flex min-h-11 cursor-pointer items-center gap-2 rounded-lg px-3 text-sm text-fg outline-none focus:bg-surface-hover data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,disabled:r,onSelect:v,children:[y,x]}),t[11]=r,t[12]=x,t[13]=D):D=t[13];let k;t[14]!==D||t[15]!==_?(k=(0,Q.jsx)(z,{children:(0,Q.jsxs)(P,{align:`end`,sideOffset:4,className:`z-[100] min-w-36 rounded-xl border border-edge bg-surface-overlay p-1 shadow-popover`,children:[_,D]})}),t[14]=D,t[15]=_,t[16]=k):k=t[16];let j;t[17]!==k||t[18]!==p?(j=(0,Q.jsxs)(W,{modal:!1,children:[p,k]}),t[17]=k,t[18]=p,t[19]=j):j=t[19];let M;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(b,{className:`fixed inset-0 z-[110] bg-scrim`}),t[20]=M):M=t[20];let N=l?`删除这条内容?`:`Delete this item?`,F;t[21]===N?F=t[22]:(F=(0,Q.jsx)(T,{className:`font-semibold text-fg`,children:N}),t[21]=N,t[22]=F);let I=l?`删除后将不再使用这条记忆,原始对话和文件会保留。`:`This memory will no longer be used. Original conversations and files are kept.`,R;t[23]===I?R=t[24]:(R=(0,Q.jsx)(ee,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:I}),t[23]=I,t[24]=R);let B;t[25]!==F||t[26]!==R?(B=(0,Q.jsxs)(`header`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[F,R]}),t[25]=F,t[26]=R,t[27]=B):B=t[27];let V;t[28]===i?V=t[29]:(V=(0,Q.jsx)(`p`,{className:`min-h-0 flex-1 overflow-y-auto whitespace-pre-wrap break-words px-5 py-4 text-sm leading-6 text-fg`,children:i}),t[28]=i,t[29]=V);let H=l?`取消`:`Cancel`,U;t[30]===H?U=t[31]:(U=(0,Q.jsx)(S,{asChild:!0,children:(0,Q.jsx)(O,{variant:`ghost`,children:H})}),t[30]=H,t[31]=U);let G;t[32]===o?G=t[33]:(G=()=>{c(!1),o()},t[32]=o,t[33]=G);let K=l?`删除`:`Delete`,q;t[34]!==r||t[35]!==G||t[36]!==K?(q=(0,Q.jsx)(O,{disabled:r,onClick:G,children:K}),t[34]=r,t[35]=G,t[36]=K,t[37]=q):q=t[37];let J;t[38]!==U||t[39]!==q?(J=(0,Q.jsxs)(`footer`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-3`,children:[U,q]}),t[38]=U,t[39]=q,t[40]=J):J=t[40];let Y;t[41]!==B||t[42]!==V||t[43]!==J?(Y=(0,Q.jsxs)(C,{children:[M,(0,Q.jsxs)(w,{className:`fixed left-1/2 top-1/2 z-[120] flex h-[min(22rem,calc(100dvh-2rem))] w-[min(28rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-popover`,children:[B,V,J]})]}),t[41]=B,t[42]=V,t[43]=J,t[44]=Y):Y=t[44];let te;return t[45]!==s||t[46]!==j||t[47]!==Y?(te=(0,Q.jsxs)(E,{open:s,onOpenChange:c,children:[j,Y]}),t[45]=s,t[46]=j,t[47]=Y,t[48]=te):te=t[48],te}function Pe(e,t){return e?new Intl.DateTimeFormat(t===`zh`?`zh-CN`:`en`,{dateStyle:`medium`}).format(e):null}function Fe(e,t,n=new Date){let r=new Date(n.getFullYear(),n.getMonth(),n.getDate()),i=new Date(r);i.setDate(r.getDate()-1);let a=new Map;for(let n of[...e].sort((e,t)=>t.recordedAt-e.recordedAt)){let e=n.recordedAt>=r.getTime()?t===`zh`?`今天`:`Today`:n.recordedAt>=i.getTime()?t===`zh`?`昨天`:`Yesterday`:Pe(n.recordedAt,t)??(t===`zh`?`更早`:`Earlier`),o=a.get(e)??[];o.push(n),a.set(e,o)}return[...a].map(([e,t])=>({label:e,items:t}))}function Ie(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 Le(e,t){if(e.validTo){let n=Pe(e.validTo,t);return t===`zh`?`适用至 ${n}`:`Applies until ${n}`}return(t===`zh`?{stable:`相对稳定`,slow:`会随时间复核`,dynamic:`近期状态`,event:`特定阶段`}:{stable:`Relatively stable`,slow:`Reviewed over time`,dynamic:`Current context`,event:`Specific period`})[e.volatility]}function Re(e,t){return e.authority===`user_explicit`?null:e.confidence>=.85?t===`zh`?`把握较高`:`High confidence`:e.confidence>=.65?t===`zh`?`把握中等`:`Medium confidence`:t===`zh`?`证据较少`:`Limited evidence`}function ze(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 Be(e){let t=(0,Z.c)(23),{item:n,language:r,busy:i,editing:a,draft:o,onDraftChange:s,onEdit:c,onCancel:l,onDelete:u,onCorrect:d}=e,f=(0,X.useId)(),p=r===`zh`,m;t[0]!==n||t[1]!==r?(m=Re(n,r),t[0]=n,t[1]=r,t[2]=m):m=t[2];let h=m,g;t[3]===n.sources?g=t[4]:(g=new Set(n.sources?.map(He).filter(Boolean)),t[3]=n.sources,t[4]=g);let _;t[5]===g?_=t[6]:(_=[...g],t[5]=g,t[6]=_);let v=_,y=p?`修改`:`Edit`,b;return t[7]!==i||t[8]!==h||t[9]!==o||t[10]!==y||t[11]!==a||t[12]!==f||t[13]!==n||t[14]!==r||t[15]!==l||t[16]!==d||t[17]!==u||t[18]!==s||t[19]!==c||t[20]!==v||t[21]!==p?(b=(0,Q.jsx)(`article`,{className:`border-t border-edge-subtle px-4 py-3 first:border-t-0 sm:px-5 [content-visibility:auto] [contain-intrinsic-size:auto_100px]`,children:a?(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:f,children:p?`修改这条理解`:`Edit this understanding`}),(0,Q.jsx)(`textarea`,{id:f,value:o,disabled:i,onChange:e=>s(e.target.value),className:`mt-2 min-h-28 w-full resize-y rounded-xl border border-edge bg-surface-base px-3 py-2.5 text-base leading-7 text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`}),(0,Q.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Q.jsx)(O,{variant:`ghost`,disabled:i,onClick:l,children:p?`取消`:`Cancel`}),(0,Q.jsx)(O,{variant:`primary`,disabled:!o.trim()||i,onClick:d,children:i?p?`保存中…`:`Saving…`:p?`保存修改`:`Save changes`})]})]}):(0,Q.jsxs)(`div`,{className:`flex items-start gap-2 sm:gap-4`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 pt-1.5`,children:[(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-base leading-7 text-fg`,children:n.statement}),(0,Q.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs leading-5 text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:Ie(n,r)}),n.usable===!1?(0,Q.jsx)(`span`,{children:p?`暂不使用`:`Not in use`}):null,n.validTo?(0,Q.jsx)(`span`,{children:Le(n,r)}):null,n.authority!==`user_explicit`&&n.confidence<.65?(0,Q.jsx)(`span`,{children:h}):null,(0,Q.jsxs)(`details`,{className:`open:basis-full`,children:[(0,Q.jsx)(`summary`,{className:`w-fit cursor-pointer rounded-md py-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:p?`查看依据`:`View sources`}),(0,Q.jsxs)(`div`,{className:`my-2 space-y-1 border-l-2 border-edge pl-3 text-sm leading-6`,children:[(0,Q.jsx)(`p`,{children:n.usable?p?`按需用于当前协作`:`Used when relevant`:p?`暂不使用,后台继续复核`:`Not in use; reviewed automatically`}),(0,Q.jsxs)(`p`,{children:[Le(n,r),` · `,ze(n.scope,r),h?` · ${h}`:``]}),(0,Q.jsxs)(`p`,{children:[p?`最近观察:`:`Last observed: `,Pe(n.observedAt,r)]}),(0,Q.jsxs)(`p`,{children:[p?`模型层:`:`Model layer: `,p?{fact:`事实`,pattern:`模式`,interpretation:`解释`}[n.layer]:n.layer,` · `,p?`${n.independentSourceCount} 个独立来源`:`${n.independentSourceCount} independent sources`]}),v.length?v.map(Ve):(0,Q.jsx)(`p`,{children:p?`暂无更详细的来源记录`:`No further source details available`}),(0,Q.jsx)(O,{variant:`ghost`,className:`-ml-2 px-2`,disabled:i,onClick:c,children:y})]})]})]})]}),(0,Q.jsx)(Ne,{language:r,busy:i,statement:n.statement,onEdit:c,onDelete:u})]})}),t[7]=i,t[8]=h,t[9]=o,t[10]=y,t[11]=a,t[12]=f,t[13]=n,t[14]=r,t[15]=l,t[16]=d,t[17]=u,t[18]=s,t[19]=c,t[20]=v,t[21]=p,t[22]=b):b=t[22],b}function Ve(e){return(0,Q.jsx)(`p`,{className:`break-words`,children:e},e)}function He(e){return e.label}var Ue={zh:{eyebrow:`全局用户理解`,title:`xopc 如何形成对你的理解`,subtitle:`这里汇总跨项目、跨对话形成的认识,并说明它们来自哪些渠道。项目事实不会混入你的个人画像。`,channels:`理解渠道`,channelHint:`查看来源及其最近更新。`,noChannels:`尚未通过任何渠道形成可展示的全局理解。`,activeCount:`{{count}} 条已在使用`,pendingCount:`{{count}} 条暂不使用`,noUnderstanding:`暂无来自此渠道的全局理解`,pending:`最近更新`,pendingHint:`自动整理并按需使用,你可以随时修改或删除。`,nothingPending:`尚未形成全局理解。`,showAll:`查看全部 {{count}} 条`,showLess:`收起`,done:`完成`,updating:`正在从已授权渠道更新理解;你可以先查看已有内容。`,sourceKinds:{user:`你明确告诉我的`,conversation:`对话与协作`,connector:`连接的服务`,work_folder:`工作目录`,local_source:`本机来源`,inference:`综合整理`}},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:`View sources and their latest updates.`,noChannels:`No channel has formed displayable global understanding yet.`,activeCount:`{{count}} in use`,pendingCount:`{{count}} not in use`,noUnderstanding:`No usable global understanding has formed from this channel yet`,pending:`Recent updates`,pendingHint:`Organized automatically and used when relevant. Edit or delete anytime.`,nothingPending:`No understanding has formed yet.`,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`}}},We={"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:`最近文档`}},Ge={user:ye,conversation:le,connector:ce,work_folder:f,local_source:xe,inference:ce},Ke={files:f,recent_documents:xe,calendar:G,tasks:M,notes:we,mail:Ce,messages:le,code_activity:J};function $(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 qe(e,t){return e.kind===`local_source`&&e.label?We[e.label]?.[t]??e.label:e.kind===`work_folder`&&e.label?t===`zh`?`工作目录 · ${e.label}`:`Work folder · ${e.label}`:e.label?e.label:Ue[t].sourceKinds[e.kind]}function Je(e){return`${e.kind}:${e.adapterId}:${e.displayName}`}function Ye(e){let t=(0,Z.c)(91),{assertions:n,configuredSources:r,activityRunning:i,language:a,busy:s,error:c,onReviewAssertion:l,onCompleted:d}=e,f=Ue[a],[m,h]=(0,X.useState)(!1),[g,_]=(0,X.useState)(null),[y,b]=(0,X.useState)(``),x;t[0]===n?x=t[1]:(x=n.filter(nt),t[0]=n,t[1]=x);let ee=x,S;t[2]===ee?S=t[3]:(S=[...ee].sort(tt),t[2]=ee,t[3]=S);let C=S,w;if(t[4]!==r||t[5]!==ee||t[6]!==a){let e=new Map;for(let t of r){let n=t.kind===`local_source`?We[t.adapterId]?.[a]??t.displayName:t.displayName,r=Je(t);e.set(r,{key:r,grantId:t.id,kind:t.kind,category:t.category,label:t.kind===`work_folder`?a===`zh`?`工作目录 · ${n}`:`Work folder · ${n}`:n,assertions:[],lastObservedAt:t.lastCollectedAt})}for(let t of ee)for(let n of t.sources?.length?t.sources:[$(t)]){let r=qe(n,a),i=[...e.values()].find(e=>e.kind===n.kind&&e.label===r),o=i?.key??`${n.kind}:${r}`,s=i??e.get(o)??{key:o,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(o,s)}w=[...e.values()].sort(et),t[4]=r,t[5]=ee,t[6]=a,t[7]=w}else w=t[7];let T=w,E;t[8]===l?E=t[9]:(E=async(e,t,n)=>{await l(e,t,n)&&_(null)},t[8]=l,t[9]=E);let D=E,k,A,j,M,N,P,F,I,L;if(t[10]!==i||t[11]!==s||t[12]!==y||t[13]!==g||t[14]!==a||t[15]!==C||t[16]!==D||t[17]!==m||t[18]!==f.eyebrow||t[19]!==f.nothingPending||t[20]!==f.pending||t[21]!==f.pendingHint||t[22]!==f.showAll||t[23]!==f.showLess||t[24]!==f.subtitle||t[25]!==f.title||t[26]!==f.updating){let e=m?C:C.slice(0,5);k=`mx-auto w-full max-w-[42rem] pb-2`,A=`polite`;let n;t[36]===f.eyebrow?n=t[37]:(n=(0,Q.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.18em] text-accent-fg`,children:f.eyebrow}),t[36]=f.eyebrow,t[37]=n);let r;t[38]===f.title?r=t[39]:(r=(0,Q.jsx)(`h2`,{className:`mt-3 text-2xl font-semibold tracking-tight text-fg sm:text-3xl`,children:f.title}),t[38]=f.title,t[39]=r);let o;t[40]===f.subtitle?o=t[41]:(o=(0,Q.jsx)(`p`,{className:`mx-auto mt-3 max-w-[38rem] text-sm leading-6 text-fg-muted`,children:f.subtitle}),t[40]=f.subtitle,t[41]=o),t[42]!==n||t[43]!==r||t[44]!==o?(j=(0,Q.jsxs)(`div`,{className:`text-center`,children:[n,r,o]}),t[42]=n,t[43]=r,t[44]=o,t[45]=j):j=t[45],t[46]!==i||t[47]!==f.updating?(M=i?(0,Q.jsxs)(`div`,{className:`mt-6 flex items-center gap-3 rounded-xl border border-accent/20 bg-accent-soft/55 px-4 py-3 text-sm text-accent-fg`,children:[(0,Q.jsx)(p,{className:`size-4 shrink-0 animate-spin motion-reduce:animate-none`}),(0,Q.jsx)(`p`,{children:f.updating})]}):null,t[46]=i,t[47]=f.updating,t[48]=M):M=t[48],N=`mt-8`,P=`understanding-updates-title`;let c=C.length?` · ${C.length}`:``;t[49]!==f.pending||t[50]!==c?(F=(0,Q.jsxs)(`h3`,{id:`understanding-updates-title`,className:`text-sm font-semibold text-fg`,children:[f.pending,c]}),t[49]=f.pending,t[50]=c,t[51]=F):F=t[51],t[52]===f.pendingHint?I=t[53]:(I=(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:f.pendingHint}),t[52]=f.pendingHint,t[53]=I),L=C.length?(0,Q.jsxs)(`div`,{className:`mt-3`,children:[Fe(e,a).map(e=>{let{label:t,items:n}=e;return(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`border-b border-edge-subtle px-4 pb-2 pt-3 text-xs font-medium text-fg-muted`,children:t}),(0,Q.jsx)(`div`,{children:n.map(e=>(0,Q.jsx)(Be,{item:e,language:a,busy:s,editing:g===e.id,draft:y,onDraftChange:b,onEdit:()=>{_(e.id),b(e.statement)},onCancel:()=>_(null),onCorrect:()=>void D(e,`edited`,y.trim()),onDelete:()=>void D(e,`deleted`)},e.id))})]},t)}),C.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:()=>h($e),children:[m?f.showLess:f.showAll.replace(`{{count}}`,String(C.length)),(0,Q.jsx)(B,{className:v(`size-3.5 transition-transform`,m&&`rotate-180`)})]}):null]}):(0,Q.jsxs)(`div`,{className:`mt-3 flex items-start gap-3 rounded-xl border border-edge bg-surface-base/55 p-4`,children:[(0,Q.jsx)(u,{className:`mt-0.5 size-5 shrink-0 text-success`}),(0,Q.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:f.nothingPending})]}),t[10]=i,t[11]=s,t[12]=y,t[13]=g,t[14]=a,t[15]=C,t[16]=D,t[17]=m,t[18]=f.eyebrow,t[19]=f.nothingPending,t[20]=f.pending,t[21]=f.pendingHint,t[22]=f.showAll,t[23]=f.showLess,t[24]=f.subtitle,t[25]=f.title,t[26]=f.updating,t[27]=k,t[28]=A,t[29]=j,t[30]=M,t[31]=N,t[32]=P,t[33]=F,t[34]=I,t[35]=L}else k=t[27],A=t[28],j=t[29],M=t[30],N=t[31],P=t[32],F=t[33],I=t[34],L=t[35];let R;t[54]!==N||t[55]!==P||t[56]!==F||t[57]!==I||t[58]!==L?(R=(0,Q.jsxs)(`section`,{className:N,"aria-labelledby":P,children:[F,I,L]}),t[54]=N,t[55]=P,t[56]=F,t[57]=I,t[58]=L,t[59]=R):R=t[59];let z;t[60]!==T.length||t[61]!==f.channels?(z=(0,Q.jsxs)(`summary`,{className:`w-fit cursor-pointer rounded-md py-2 text-sm font-medium text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[f.channels,` · `,T.length]}),t[60]=T.length,t[61]=f.channels,t[62]=z):z=t[62];let V;t[63]===f.channelHint?V=t[64]:(V=(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:f.channelHint}),t[63]=f.channelHint,t[64]=V);let H;t[65]!==T||t[66]!==f.activeCount||t[67]!==f.noChannels||t[68]!==f.noUnderstanding||t[69]!==f.pendingCount?(H=T.length?(0,Q.jsx)(`div`,{className:`mt-3 space-y-3`,children:T.map(e=>{let t=e.category?Ke[e.category]??Ge[e.kind]:Ge[e.kind],n=e.assertions.filter(Qe).length,r=e.assertions.filter(Ze).length;return(0,Q.jsxs)(`article`,{className:`rounded-xl 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-hover 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.grantId?(0,Q.jsx)(je,{sourceId:e.grantId,lastCollectedAt:e.lastObservedAt}):null,e.assertions.length?(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[n?f.activeCount.replace(`{{count}}`,String(n)):``,r?f.pendingCount.replace(`{{count}}`,String(r)):``].filter(Boolean).join(` · `)}):(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:f.noUnderstanding})]}),e.grantId?(0,Q.jsx)(De,{sourceId:e.grantId}):null]}),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-xl border border-edge bg-surface-base/55 p-4 text-sm text-fg-muted`,children:f.noChannels}),t[65]=T,t[66]=f.activeCount,t[67]=f.noChannels,t[68]=f.noUnderstanding,t[69]=f.pendingCount,t[70]=H):H=t[70];let U;t[71]!==z||t[72]!==V||t[73]!==H?(U=(0,Q.jsxs)(`details`,{className:`mt-6 border-t border-edge pt-4`,children:[z,V,H]}),t[71]=z,t[72]=V,t[73]=H,t[74]=U):U=t[74];let W;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Q.jsx)(o,{className:`size-4`}),t[75]=W):W=t[75];let G;t[76]!==s||t[77]!==d||t[78]!==f.done?(G=(0,Q.jsx)(`div`,{className:`mt-6 flex justify-end`,children:(0,Q.jsxs)(O,{variant:`primary`,disabled:s,onClick:d,children:[W,f.done]})}),t[76]=s,t[77]=d,t[78]=f.done,t[79]=G):G=t[79];let K;t[80]===c?K=t[81]:(K=c?(0,Q.jsx)(`p`,{className:`mt-5 text-sm text-danger`,role:`alert`,children:c}):null,t[80]=c,t[81]=K);let q;return t[82]!==k||t[83]!==A||t[84]!==j||t[85]!==M||t[86]!==R||t[87]!==U||t[88]!==G||t[89]!==K?(q=(0,Q.jsxs)(`section`,{className:k,"aria-live":A,children:[j,M,R,U,G,K]}),t[82]=k,t[83]=A,t[84]=j,t[85]=M,t[86]=R,t[87]=U,t[88]=G,t[89]=K,t[90]=q):q=t[90],q}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 Ze(e){return!e.usable}function Qe(e){return e.usable}function $e(e){return!e}function et(e,t){return t.assertions.length-e.assertions.length||(t.lastObservedAt??0)-(e.lastObservedAt??0)}function tt(e,t){return t.recordedAt-e.recordedAt}function nt(e){return e.scope.type===`global`&&e.status!==`archived`&&e.status!==`rejected`}function rt(){let{pathname:e,search:t}=a(),n=y(e=>e.language),r=ve(),[i,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)(null),l=e===`/user-model`,{data:u,mutate:d}=D(l?`/api/user-model`:null,Se),f=R(e=>e.error),m=R(e=>e.sources.some(e=>e.status===`running`||e.status===`queued`)),h=n===`zh`;if((0,X.useEffect)(()=>{l&&new URLSearchParams(t).get(`workDiscovery`)===`review`&&ve.getState().setDrawerOpen(!0)},[l,t]),(0,X.useEffect)(()=>{l&&r.status!==`running`&&d()},[d,l,r.directoryRun?.id,r.status]),!l)return null;let g=r.status===`running`||m,A=async(e,t,n)=>{o(!0),c(null);try{return t===`edited`&&n?await de(e.id,n):t===`deleted`&&await be(e.id),await d(),!0}catch(e){return c(e instanceof Error?e.message:String(e)),!1}finally{o(!1)}},j=e=>{if(!e&&u&&r.status!==`running`){r.finish();return}r.setDrawerOpen(e)};return(0,Q.jsxs)(E,{open:r.drawerOpen,onOpenChange:j,children:[(0,Q.jsx)(x,{asChild:!0,children:(0,Q.jsx)(O,{type:`button`,variant:`ghost`,className:v(`relative size-8 rounded-xl p-0`,H),title:h?`查看 xopc 对你的理解`:`Review what xopc understands`,"aria-label":h?`查看 xopc 对你的理解`:`Review what xopc understands`,children:g?(0,Q.jsx)(p,{className:`size-4 animate-spin motion-reduce:animate-none`}):(0,Q.jsx)(V,{className:`size-4 text-accent-fg`})})}),(0,Q.jsxs)(C,{children:[(0,Q.jsx)(b,{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)(w,{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-xl border border-edge bg-surface-overlay 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)(T,{className:`text-sm font-semibold text-fg`,children:g?h?`正在更新用户理解`:`Updating user understanding`:h?`用户理解`:`User understanding`}),(0,Q.jsx)(ee,{className:`mt-0.5 text-xs text-fg-muted`,children:g?h?`关闭窗口也会在后台继续`:`You can close this window; work continues in the background`:h?`自动更新,可随时修改或删除`:`Updated automatically. Edit or delete anytime`})]}),(0,Q.jsx)(De,{disabled:!u?.sources?.length}),(0,Q.jsx)(S,{asChild:!0,children:(0,Q.jsx)(O,{variant:`ghost`,className:`size-8 rounded-xl p-0`,"aria-label":h?`关闭`:`Close`,children:(0,Q.jsx)(_,{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:g,language:n,busy:i,error:s??f??null,onReviewAssertion:A,onCompleted:()=>{j(!1)}}):(0,Q.jsxs)(`section`,{className:`space-y-4`,"aria-label":h?`正在加载用户理解`:`Loading user understanding`,children:[(0,Q.jsx)(k,{className:`h-8 w-2/3`}),(0,Q.jsx)(k,{className:`h-32 w-full`}),(0,Q.jsx)(k,{className:`h-32 w-full`})]})})]})})]})]})}function it(e){let t=e.get(`tab`);return t===`understanding`||t===`knowledge`?t:`overview`}var at={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`,timezoneSearch:`Search timezones…`,timezoneNoMatch:`No matching 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`,allUnderstanding:`All understanding`,understandingFilterHint:`Filter this view by how each item was formed.`,importantNow:`What matters now`,prioritySourceGoal:`From a goal you confirmed`,prioritySourceWork:`From your current work`,editPriority:`Edit focus`,addPriority:`Set current focus`,priorityTitle:`Current focus`,priorityTitlePlaceholder:`What matters most right now?`,priorityOutcome:`What a good outcome looks like`,priorityOutcomePlaceholder:`Describe the result you want…`,priorityUntil:`Focus through`,savePriority:`Save focus`,endPriority:`End focus`,endingPriority:`Ending…`,priorityHint:`This is used to keep xopc aligned with what deserves attention 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:`Recent understanding from our work. You can edit any item.`,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`,refreshing:`Refreshing…`,refreshComplete:`Refreshed`,refreshFailed:`Refresh failed`,aboutYouTitle:`A view you can correct`,aboutYouHint:`xopc quietly maintains this working context from collaboration. You can edit or retire any item.`,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`,save:`Save correction`,cancel:`Cancel`,correctionPlaceholder:`Write the accurate version…`,searchPlaceholder:`Search work memory…`,allMemory:`All work memory`,memoryFilterHint:`Filter by memory type`,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.`,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:`时区`,timezoneSearch:`搜索时区…`,timezoneNoMatch:`没有匹配的时区`,locale:`语言 / 地区`,useDeviceTimezone:`使用本机时区`,notProvided:`未填写`,editProfileHint:`这些是由你直接提供的事实,与 xopc 的观察和推断分开维护。`,saveProfile:`保存`,saving:`正在保存…`,explicit:`你告诉我的`,explicitHint:`你明确表达的事实与偏好`,learned:`协作中学到的`,learnedHint:`从实际协作中形成的认识`,allUnderstanding:`全部理解`,understandingFilterHint:`按内容来源筛选这份理解。`,importantNow:`此刻重要`,prioritySourceGoal:`来自你确认的当前目标`,prioritySourceWork:`来自当前工作上下文`,editPriority:`编辑`,addPriority:`设置当前关注`,priorityTitle:`当前关注`,priorityTitlePlaceholder:`现在最重要的是什么?`,priorityOutcome:`期待结果`,priorityOutcomePlaceholder:`描述你希望达成的结果…`,priorityUntil:`关注至`,savePriority:`保存关注`,endPriority:`结束关注`,endingPriority:`正在结束…`,priorityHint:`这项内容会帮助 xopc 在协作中优先关注当前最重要的事情。`,noPriority:`还没有设置当前优先事项。`,otherGoals:`其他进行中的目标`,howWeWork:`我们怎样协作`,howWeWorkHint:`你对沟通方式和执行行为的长期约定。`,noRules:`还没有形成协作偏好。`,recent:`最近形成的理解`,recentHint:`最近在协作中形成的认识,你可以随时修改。`,seeAll:`查看全部`,workMemory:`我在工作中记住的`,workMemoryHint:`项目事实、决定、经验和待解问题,与“关于你”的理解分别管理。`,items:`条`,maintenanceReady:`记忆整理已经启用,正在等待首次运行。`,maintenanceComplete:`最近一次记忆整理于`,maintenanceFailed:`最近一次记忆整理需要处理`,refresh:`刷新`,refreshing:`正在刷新…`,refreshComplete:`已刷新`,refreshFailed:`刷新失败`,aboutYouTitle:`一份可以共同修正的理解`,aboutYouHint:`xopc 会在协作中安静地维护这份工作认知。你仍可随时修改或停止使用任何一条。`,identity:`关于你是谁`,preferences:`偏好与工作节奏`,relationships:`重要的人与关系`,currentState:`当前状态`,insights:`我形成的判断`,emptyGroup:`这里还没有形成理解。`,correct:`修正`,save:`保存修正`,cancel:`取消`,correctionPlaceholder:`写下更准确的说法…`,searchPlaceholder:`搜索工作记忆…`,allMemory:`全部工作记忆`,memoryFilterHint:`按记忆类型筛选`,memoryLibraryHint:`这里只显示提炼后的事实、决定、经验、承诺和待解问题;邮件、日历与文档原文保留在对应来源中。`,noKnowledge:`还没有形成工作记忆。`,noKnowledgeMatch:`没有符合搜索条件的工作记忆。`,showMore:`显示更多`,expand:`查看详情`,collapse:`收起详情`,disable:`停用`,disabled:`已停用`,enable:`启用`,loadFailed:`无法载入对你的理解。`,tryAgain:`重试`,actionFailed:`修改没有保存,请重试。`}},ot=new Set([`identity.call_name`,`identity.role`,`identity.pronouns`,`preference.timezone`,`preference.locale`]),st=[`work_thread`,`project_fact`,`workspace_fact`,`decision`,`task_lesson`,`commitment`,`open_question`,`episode`,`note`],ct=`UTC.Africa/Cairo.Africa/Johannesburg.America/Chicago.America/Denver.America/Los_Angeles.America/Mexico_City.America/New_York.America/Sao_Paulo.America/Toronto.America/Vancouver.Asia/Bangkok.Asia/Dubai.Asia/Hong_Kong.Asia/Jakarta.Asia/Kolkata.Asia/Seoul.Asia/Shanghai.Asia/Singapore.Asia/Taipei.Asia/Tokyo.Australia/Melbourne.Australia/Perth.Australia/Sydney.Europe/Amsterdam.Europe/Berlin.Europe/London.Europe/Madrid.Europe/Paris.Europe/Rome.Pacific/Auckland.Pacific/Honolulu`.split(`.`);function lt(){try{let e=Intl.supportedValuesOf(`timeZone`);return[...new Set([`UTC`,...e])]}catch{return[...ct]}}var ut=lt();function dt(e){return e.map(e=>({value:e,label:e.replaceAll(`_`,` `),group:e.includes(`/`)?e.split(`/`)[0]:`UTC`}))}function ft(e,t,n=!1){return e?new Intl.DateTimeFormat(t===`zh`?`zh-CN`:`en`,{dateStyle:`medium`,...n?{timeStyle:`short`}:{}}).format(e):null}function pt(e){return typeof e==`string`&&e.trim()?e.trim():void 0}function mt(e){return{callName:pt(e.profile.callName)??``,role:pt(e.profile.role)??``,pronouns:pt(e.profile.pronouns)??``,timezone:pt(e.profile.timezone)??``,locale:pt(e.profile.locale)??``}}function ht(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 gt(e){return Array.from(e.trim()).slice(0,2).join(``).toLocaleUpperCase()}function _t(e,t){let n=ft(e,t);return t===`zh`?`当前安排至 ${n}`:`Current plan through ${n}`}function vt(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function yt(e){let[t,n,r]=e.split(`-`).map(Number);return new Date(t,n-1,r,23,59,59,999).getTime()}function bt(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 xt(e,t){return(t===`zh`?{work_thread:`工作主线`,project_fact:`项目事实`,workspace_fact:`工作区事实`,decision:`已经决定`,task_lesson:`工作经验`,commitment:`承诺与约定`,open_question:`待解问题`,episode:`重要经历`,note:`其他记录`}:{work_thread:`Work threads`,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 St(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 Ct(e){let t=(0,Z.c)(16),{title:n,hint:r,action:i,children:a,className:o}=e,s=o===void 0?``:o,c;t[0]===n?c=t[1]:(c=(0,Q.jsx)(`h2`,{className:`text-base font-semibold tracking-tight 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-6 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-end justify-between gap-4 px-1 pb-3`,children:[u,i]}),t[7]=i,t[8]=u,t[9]=d):d=t[9];let f;t[10]===a?f=t[11]:(f=(0,Q.jsx)(`div`,{className:`overflow-hidden rounded-2xl bg-surface-panel`,children:a}),t[10]=a,t[11]=f);let p;return t[12]!==s||t[13]!==d||t[14]!==f?(p=(0,Q.jsxs)(`section`,{className:s,children:[d,f]}),t[12]=s,t[13]=d,t[14]=f,t[15]=p):p=t[15],p}function wt(e){let t=(0,Z.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 items-center gap-3 px-5 py-5 text-sm text-fg-muted`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Tt({open:e,profile:t,language:n,saving:r,onOpenChange:i,onSave:a}){let o=at[n],[u,d]=(0,X.useState)(t),[f,m]=(0,X.useState)(``);(0,X.useEffect)(()=>{e&&(d(t),m(``))},[e,t]);let h=e=>{e.preventDefault(),a({callName:u.callName.trim(),role:u.role.trim(),pronouns:u.pronouns.trim(),timezone:u.timezone.trim(),locale:u.locale.trim()})},g=(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:u[e],onChange:t=>d(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`})]}),v=[`zh-CN`,`zh-TW`,`en-US`,`en-GB`,`ja-JP`];u.locale&&!v.includes(u.locale)&&v.push(u.locale);let y=fe(),x=(0,X.useMemo)(()=>[...new Set([...ut,y,u.timezone].filter(Boolean))].sort(),[y,u.timezone]),D=f.trim().toLocaleLowerCase(),k=(0,X.useMemo)(()=>dt(x.filter(e=>!D||e.toLocaleLowerCase().includes(D)||e.replaceAll(`_`,` `).toLocaleLowerCase().includes(D))),[x,D]);return(0,Q.jsx)(E,{open:e,onOpenChange:i,children:(0,Q.jsxs)(C,{children:[(0,Q.jsx)(b,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsx)(w,{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 rounded-2xl border border-edge bg-surface-overlay shadow-popover outline-none`,children:(0,Q.jsxs)(`form`,{className:`flex h-full min-h-0 flex-col overflow-hidden [border-radius:inherit]`,onSubmit:h,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)(T,{className:`font-semibold text-fg`,children:o.editProfile}),(0,Q.jsx)(ee,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:o.editProfileHint})]}),(0,Q.jsx)(S,{asChild:!0,children:(0,Q.jsx)(O,{variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":o.cancel,children:(0,Q.jsx)(_,{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:[g(`callName`,o.callName,o.callNamePlaceholder),g(`role`,o.role,o.rolePlaceholder),g(`pronouns`,o.pronouns,o.pronounsPlaceholder),(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:o.locale}),(0,Q.jsxs)(s,{value:u.locale,onChange:e=>d(t=>({...t,locale:e.target.value})),children:[(0,Q.jsx)(c,{value:``,children:o.notProvided}),v.map(e=>(0,Q.jsx)(c,{value:e,children:ht(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:o.timezone}),(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(l,{value:u.timezone,options:k,placeholder:fe(),emptyLabel:o.notProvided,ariaLabel:o.timezone,selectedLabel:u.timezone||o.notProvided,searchPlaceholder:o.timezoneSearch,searchValue:f,onSearchChange:m,statusMessage:k.length?void 0:o.timezoneNoMatch,triggerClassName:`min-w-0 flex-1 rounded-xl bg-surface-base`,onChange:e=>{d(t=>({...t,timezone:e})),m(``)}}),(0,Q.jsx)(O,{className:`shrink-0 whitespace-nowrap`,onClick:()=>d(e=>({...e,timezone:y})),children:o.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)(S,{asChild:!0,children:(0,Q.jsx)(O,{disabled:r,children:o.cancel})}),(0,Q.jsxs)(O,{type:`submit`,variant:`primary`,disabled:r,children:[r?(0,Q.jsx)(p,{className:`size-4 animate-spin`}):null,r?o.saving:o.saveProfile]})]})]})})]})})}function Et(e){let t=(0,Z.c)(94),{open:n,priority:r,title:i,outcome:a,language:o,saving:s,onOpenChange:c,onSave:l,onEnd:u}=e,d=at[o],[f,m]=(0,X.useState)(i),[h,g]=(0,X.useState)(a??``),v=r?.validTo??Date.now()+6048e5,y;t[0]===v?y=t[1]:(y=vt(v),t[0]=v,t[1]=y);let x=y,[D,k]=(0,X.useState)(x),A,j;t[2]!==x||t[3]!==n||t[4]!==a||t[5]!==i?(A=()=>{n&&(m(i),g(a??``),k(x))},j=[x,n,a,i],t[2]=x,t[3]=n,t[4]=a,t[5]=i,t[6]=A,t[7]=j):(A=t[6],j=t[7]),(0,X.useEffect)(A,j);let M;t[8]!==h||t[9]!==f||t[10]!==D||t[11]!==l||t[12]!==r?.targetType?(M=e=>{e.preventDefault(),l({title:f.trim(),...r?.targetType===`goal`?{desiredOutcome:h.trim()}:{},validTo:yt(D)})},t[8]=h,t[9]=f,t[10]=D,t[11]=l,t[12]=r?.targetType,t[13]=M):M=t[13];let N=M,P;t[14]!==h||t[15]!==f||t[16]!==D||t[17]!==r?.targetType?(P=f.trim()&&D&&(r?.targetType!==`goal`||h.trim()),t[14]=h,t[15]=f,t[16]=D,t[17]=r?.targetType,t[18]=P):P=t[18];let F=!!P,I;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Q.jsx)(b,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[19]=I):I=t[19];let L=r?d.editPriority:d.addPriority,R;t[20]===L?R=t[21]:(R=(0,Q.jsx)(T,{className:`font-semibold text-fg`,children:L}),t[20]=L,t[21]=R);let z;t[22]===d.priorityHint?z=t[23]:(z=(0,Q.jsx)(ee,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:d.priorityHint}),t[22]=d.priorityHint,t[23]=z);let B;t[24]!==z||t[25]!==R?(B=(0,Q.jsxs)(`div`,{children:[R,z]}),t[24]=z,t[25]=R,t[26]=B):B=t[26];let V;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Q.jsx)(_,{className:`size-4`}),t[27]=V):V=t[27];let H;t[28]===d.cancel?H=t[29]:(H=(0,Q.jsx)(S,{asChild:!0,children:(0,Q.jsx)(O,{variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":d.cancel,children:V})}),t[28]=d.cancel,t[29]=H);let U;t[30]!==B||t[31]!==H?(U=(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:[B,H]}),t[30]=B,t[31]=H,t[32]=U):U=t[32];let W;t[33]===d.priorityTitle?W=t[34]:(W=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:d.priorityTitle}),t[33]=d.priorityTitle,t[34]=W);let G;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(G=e=>m(e.target.value),t[35]=G):G=t[35];let K;t[36]!==f||t[37]!==d.priorityTitlePlaceholder?(K=(0,Q.jsx)(`input`,{autoFocus:!0,value:f,onChange:G,placeholder:d.priorityTitlePlaceholder,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`}),t[36]=f,t[37]=d.priorityTitlePlaceholder,t[38]=K):K=t[38];let q;t[39]!==W||t[40]!==K?(q=(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[W,K]}),t[39]=W,t[40]=K,t[41]=q):q=t[41];let J;t[42]!==h||t[43]!==r?.targetType||t[44]!==d.priorityOutcome||t[45]!==d.priorityOutcomePlaceholder?(J=r?.targetType===`goal`?(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:d.priorityOutcome}),(0,Q.jsx)(`textarea`,{value:h,onChange:e=>g(e.target.value),placeholder:d.priorityOutcomePlaceholder,className:`min-h-28 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 placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`})]}):null,t[42]=h,t[43]=r?.targetType,t[44]=d.priorityOutcome,t[45]=d.priorityOutcomePlaceholder,t[46]=J):J=t[46];let Y;t[47]===d.priorityUntil?Y=t[48]:(Y=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:d.priorityUntil}),t[47]=d.priorityUntil,t[48]=Y);let te;t[49]===r?.validFrom?te=t[50]:(te=r?.validFrom??Date.now(),t[49]=r?.validFrom,t[50]=te);let ne;t[51]===te?ne=t[52]:(ne=vt(te),t[51]=te,t[52]=ne);let re;t[53]!==D||t[54]!==d.priorityUntil||t[55]!==ne?(re=(0,Q.jsx)(Ee,{min:ne,value:D,onChange:k,ariaLabel:d.priorityUntil,className:`rounded-xl border border-edge bg-surface-base hover:border-edge-strong hover:bg-surface-base`}),t[53]=D,t[54]=d.priorityUntil,t[55]=ne,t[56]=re):re=t[56];let ie;t[57]!==Y||t[58]!==re?(ie=(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[Y,re]}),t[57]=Y,t[58]=re,t[59]=ie):ie=t[59];let ae;t[60]!==q||t[61]!==J||t[62]!==ie?(ae=(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto p-5 sm:p-6`,children:[q,J,ie]}),t[60]=q,t[61]=J,t[62]=ie,t[63]=ae):ae=t[63];let oe;t[64]!==u||t[65]!==r||t[66]!==s||t[67]!==d.endPriority||t[68]!==d.endingPriority?(oe=r&&u?(0,Q.jsxs)(O,{variant:`ghost`,className:`text-danger hover:text-danger`,disabled:s,onClick:u,children:[s?(0,Q.jsx)(p,{className:`size-4 animate-spin`}):null,s?d.endingPriority:d.endPriority]}):(0,Q.jsx)(`span`,{}),t[64]=u,t[65]=r,t[66]=s,t[67]=d.endPriority,t[68]=d.endingPriority,t[69]=oe):oe=t[69];let se;t[70]!==s||t[71]!==d.cancel?(se=(0,Q.jsx)(S,{asChild:!0,children:(0,Q.jsx)(O,{disabled:s,children:d.cancel})}),t[70]=s,t[71]=d.cancel,t[72]=se):se=t[72];let ce=!F||s,le;t[73]===s?le=t[74]:(le=s?(0,Q.jsx)(p,{className:`size-4 animate-spin`}):null,t[73]=s,t[74]=le);let ue;t[75]!==d.savePriority||t[76]!==ce||t[77]!==le?(ue=(0,Q.jsxs)(O,{type:`submit`,variant:`primary`,disabled:ce,children:[le,d.savePriority]}),t[75]=d.savePriority,t[76]=ce,t[77]=le,t[78]=ue):ue=t[78];let de;t[79]!==se||t[80]!==ue?(de=(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[se,ue]}),t[79]=se,t[80]=ue,t[81]=de):de=t[81];let fe;t[82]!==oe||t[83]!==de?(fe=(0,Q.jsxs)(`footer`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-2 border-t border-edge px-5 py-3 sm:px-6`,children:[oe,de]}),t[82]=oe,t[83]=de,t[84]=fe):fe=t[84];let pe;t[85]!==N||t[86]!==U||t[87]!==ae||t[88]!==fe?(pe=(0,Q.jsxs)(C,{children:[I,(0,Q.jsx)(w,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] h-[min(34rem,calc(100vh-2rem))] w-[min(38rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 rounded-2xl border border-edge bg-surface-overlay shadow-popover outline-none`,children:(0,Q.jsxs)(`form`,{className:`flex h-full min-h-0 flex-col overflow-hidden [border-radius:inherit]`,onSubmit:N,children:[U,ae,fe]})})]}),t[85]=N,t[86]=U,t[87]=ae,t[88]=fe,t[89]=pe):pe=t[89];let me;return t[90]!==c||t[91]!==n||t[92]!==pe?(me=(0,Q.jsx)(E,{open:n,onOpenChange:c,children:pe}),t[90]=c,t[91]=n,t[92]=pe,t[93]=me):me=t[93],me}function Dt(e){let t=(0,Z.c)(16),{rule:n,language:r,busy:i,onToggle:a}=e,o=at[r],s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(Y,{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)(O,{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 Ot(e){let t=(0,Z.c)(15),{suggestion:n,language:r,busy:i,onConfirm:a}=e,o=r===`zh`,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(V,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),t[0]=s):s=t[0];let c;t[1]===n.statement?c=t[2]:(c=(0,Q.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:n.statement}),t[1]=n.statement,t[2]=c);let l=o?`根据你已确认的模式生成;确认前不会生效`:`Suggested from a pattern you confirmed; inactive until you approve`,u;t[3]===l?u=t[4]:(u=(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:l}),t[3]=l,t[4]=u);let d;t[5]!==c||t[6]!==u?(d=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[c,u]}),t[5]=c,t[6]=u,t[7]=d):d=t[7];let f=i?o?`启用中…`:`Enabling…`:o?`确认启用`:`Approve`,p;t[8]!==i||t[9]!==a||t[10]!==f?(p=(0,Q.jsx)(O,{variant:`secondary`,className:`h-8 shrink-0`,disabled:i,onClick:a,children:f}),t[8]=i,t[9]=a,t[10]=f,t[11]=p):p=t[11];let m;return t[12]!==d||t[13]!==p?(m=(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,d,p]}),t[12]=d,t[13]=p,t[14]=m):m=t[14],m}function kt(e){let t=(0,Z.c)(22),{item:n,language:r,busy:i,expanded:a,onToggle:o,editing:s,draft:c,onDraftChange:l,onEdit:u,onCancel:d,onReview:f,onDelete:p}=e,m=at[r],h=n.updatedAt??n.createdAt,g;t[0]!==r||t[1]!==h?(g=ft(h,r),t[0]=r,t[1]=h,t[2]=g):g=t[2];let _=g,v;t[3]===n.content?v=t[4]:(v=n.content.length>96||n.content.includes(`
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{g as i,u as a}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as o}from"./check-DUBLcKHA.js";import{n as s,r as c,t as l}from"./popover-select-0p9PIHRy.js";import{t as u}from"./circle-check-C23XjkUj.js";import{t as d}from"./ellipsis-0k4rZLoy.js";import{t as f}from"./folder-open-CyzJ19I9.js";import{t as p}from"./loader-circle-CifKLtgG.js";import{t as m}from"./pencil-DmIY3Oa-.js";import{t as h}from"./plus-Q2yW6OE7.js";import{t as g}from"./search-DA7gz22f.js";import{t as _}from"./x-B_N4OPjy.js";import{t as v}from"./cn-JdwAhgNB.js";import{n as y}from"./locale-store-7F4l6DRV.js";import{a as b,c as x,i as ee,n as S,o as C,r as w,s as T,t as E}from"./dist-BGTk37IG.js";import{i as D}from"./vendor-swr-BIWyz7Rc.js";import{t as O}from"./button-CS04eWY9.js";import{t as k}from"./skeleton-BwbyijEw.js";import{Bn as A,Bu as j,Cl as M,Fl as N,Fn as P,Fu as F,Hc as I,In as L,J as R,Ln as z,Lu as B,Oc as V,Po as H,Pu as U,Rn as W,Ru as G,Su as K,Vu as q,Xl as J,Yl as Y,_l as te,_o as ne,at as re,cc as ie,ct as ae,dt as oe,ft as se,fu as ce,gl as le,hu as ue,it as de,lt as fe,mt as pe,ot as me,pc as he,pt as ge,qu as _e,rt as ve,sc as ye,st as be,su as xe,ut as Se,vl as Ce,xc as we}from"./index-D3OtdgCs.js";import{t as Te}from"./page-tabs-_eLR6cpb.js";import{t as Ee}from"./date-picker-WyLSk4_J.js";var X=e(t(),1),Z=n(),Q=r();function De(e){let t=(0,Z.c)(15),{sourceId:n,disabled:r}=e,i=r===void 0?!1:r,a=y(Ae)===`zh`,{sources:o,starting:s,start:c}=R(),l;t[0]!==n||t[1]!==o?(l=n?o.filter(e=>e.grantId===n):o,t[0]=n,t[1]=o,t[2]=l):l=t[2];let u=l,d;t[3]===u?d=t[4]:(d=u.some(ke),t[3]=u,t[4]=d);let f=d,m=n&&u.some(Oe),h=f?a?`更新中`:`Updating`:m?a?`重试`:`Retry`:n?a?`更新理解`:`Update understanding`:a?`更新全部`:`Update all`,g=i||s||f,_;t[5]!==n||t[6]!==c?(_=()=>void c(n),t[5]=n,t[6]=c,t[7]=_):_=t[7];let v;t[8]===f?v=t[9]:(v=f?(0,Q.jsx)(p,{className:`size-3.5 animate-spin motion-reduce:animate-none`}):(0,Q.jsx)(I,{className:`size-3.5`}),t[8]=f,t[9]=v);let b;return t[10]!==h||t[11]!==g||t[12]!==_||t[13]!==v?(b=(0,Q.jsxs)(O,{variant:`ghost`,className:`h-8 shrink-0 gap-1.5 px-2 text-xs`,disabled:g,onClick:_,children:[v,h]}),t[10]=h,t[11]=g,t[12]=_,t[13]=v,t[14]=b):b=t[14],b}function Oe(e){return e.status===`failed`||e.status===`partial`||e.status===`canceled`}function ke(e){return e.status===`queued`||e.status===`running`}function Ae(e){return e.language}function je(e){let t=(0,Z.c)(22),{sourceId:n,lastCollectedAt:r}=e,i=y(Me),a=i===`zh`,o;t[0]===n?o=t[1]:(o=e=>e.sources.find(e=>e.grantId===n),t[0]=n,t[1]=o);let s=R(o);if(!s){let e;t[2]!==i||t[3]!==r||t[4]!==a?(e=r?`${a?`上次更新:`:`Last updated: `}${new Date(r).toLocaleString(i)}`:a?`尚未分析`:`Not analyzed yet`,t[2]=i,t[3]=r,t[4]=a,t[5]=e):e=t[5];let n;return t[6]===e?n=t[7]:(n=(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:e}),t[6]=e,t[7]=n),n}let c;t[8]===a?c=t[9]:(c=a?{queued:`等待更新`,waiting_desktop:`等待桌面端读取资料`,reading:`正在读取资料`,analyzing:`正在更新理解`}:{queued:`Queued`,waiting_desktop:`Waiting for desktop collection`,reading:`Reading source`,analyzing:`Updating understanding`},t[8]=a,t[9]=c);let l=c,u=s.status===`running`||s.status===`queued`,d=s.status===`failed`||s.status===`partial`||s.status===`canceled`,f=s.metadata.added,p=u?l[s.metadata.phase??`queued`]??l.queued:d?a?`更新未完成,可重试`:`Update incomplete; retry available`:f===0?a?`更新完成,暂无新增理解`:`Updated; no new understanding`:f===void 0?a?`更新完成`:`Updated`:a?`更新完成,新增 ${f} 条`:`Updated; ${f} added`,m;t[10]===p?m=t[11]:(m=(0,Q.jsx)(`p`,{children:p}),t[10]=p,t[11]=m);let h;t[12]!==i||t[13]!==s.completedAt?(h=s.completedAt?(0,Q.jsx)(`p`,{children:new Date(s.completedAt).toLocaleString(i)}):null,t[12]=i,t[13]=s.completedAt,t[14]=h):h=t[14];let g;t[15]!==d||t[16]!==s.errorMessage?(g=d&&s.errorMessage?(0,Q.jsx)(`p`,{className:`text-danger`,children:s.errorMessage}):null,t[15]=d,t[16]=s.errorMessage,t[17]=g):g=t[17];let _;return t[18]!==m||t[19]!==h||t[20]!==g?(_=(0,Q.jsxs)(`div`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,"aria-live":`polite`,children:[m,h,g]}),t[18]=m,t[19]=h,t[20]=g,t[21]=_):_=t[21],_}function Me(e){return e.language}function Ne(e){let t=(0,Z.c)(49),{language:n,busy:r,statement:i,onEdit:a,onDelete:o}=e,[s,c]=(0,X.useState)(!1),l=n===`zh`,u=l?`修改或删除这条内容`:`Edit or delete this item`,f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(d,{className:`size-4`,"aria-hidden":`true`}),t[0]=f):f=t[0];let p;t[1]!==r||t[2]!==u?(p=(0,Q.jsx)(A,{asChild:!0,children:(0,Q.jsx)(O,{variant:`ghost`,className:`size-11 shrink-0 p-0`,disabled:r,"aria-label":u,children:f})}),t[1]=r,t[2]=u,t[3]=p):p=t[3];let h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Q.jsx)(m,{className:`size-4`,"aria-hidden":`true`}),t[4]=h):h=t[4];let g=l?`修改`:`Edit`,_;t[5]!==r||t[6]!==a||t[7]!==g?(_=(0,Q.jsxs)(L,{className:`flex min-h-11 cursor-pointer items-center gap-2 rounded-lg px-3 text-sm text-fg outline-none focus:bg-surface-hover data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,disabled:r,onSelect:a,children:[h,g]}),t[5]=r,t[6]=a,t[7]=g,t[8]=_):_=t[8];let v,y;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(v=()=>c(!0),y=(0,Q.jsx)(he,{className:`size-4`,"aria-hidden":`true`}),t[9]=v,t[10]=y):(v=t[9],y=t[10]);let x=l?`删除`:`Delete`,D;t[11]!==r||t[12]!==x?(D=(0,Q.jsxs)(L,{className:`flex min-h-11 cursor-pointer items-center gap-2 rounded-lg px-3 text-sm text-fg outline-none focus:bg-surface-hover data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,disabled:r,onSelect:v,children:[y,x]}),t[11]=r,t[12]=x,t[13]=D):D=t[13];let k;t[14]!==D||t[15]!==_?(k=(0,Q.jsx)(z,{children:(0,Q.jsxs)(P,{align:`end`,sideOffset:4,className:`z-[100] min-w-36 rounded-xl border border-edge bg-surface-overlay p-1 shadow-popover`,children:[_,D]})}),t[14]=D,t[15]=_,t[16]=k):k=t[16];let j;t[17]!==k||t[18]!==p?(j=(0,Q.jsxs)(W,{modal:!1,children:[p,k]}),t[17]=k,t[18]=p,t[19]=j):j=t[19];let M;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(b,{className:`fixed inset-0 z-[110] bg-scrim`}),t[20]=M):M=t[20];let N=l?`删除这条内容?`:`Delete this item?`,F;t[21]===N?F=t[22]:(F=(0,Q.jsx)(T,{className:`font-semibold text-fg`,children:N}),t[21]=N,t[22]=F);let I=l?`删除后将不再使用这条记忆,原始对话和文件会保留。`:`This memory will no longer be used. Original conversations and files are kept.`,R;t[23]===I?R=t[24]:(R=(0,Q.jsx)(ee,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:I}),t[23]=I,t[24]=R);let B;t[25]!==F||t[26]!==R?(B=(0,Q.jsxs)(`header`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[F,R]}),t[25]=F,t[26]=R,t[27]=B):B=t[27];let V;t[28]===i?V=t[29]:(V=(0,Q.jsx)(`p`,{className:`min-h-0 flex-1 overflow-y-auto whitespace-pre-wrap break-words px-5 py-4 text-sm leading-6 text-fg`,children:i}),t[28]=i,t[29]=V);let H=l?`取消`:`Cancel`,U;t[30]===H?U=t[31]:(U=(0,Q.jsx)(S,{asChild:!0,children:(0,Q.jsx)(O,{variant:`ghost`,children:H})}),t[30]=H,t[31]=U);let G;t[32]===o?G=t[33]:(G=()=>{c(!1),o()},t[32]=o,t[33]=G);let K=l?`删除`:`Delete`,q;t[34]!==r||t[35]!==G||t[36]!==K?(q=(0,Q.jsx)(O,{disabled:r,onClick:G,children:K}),t[34]=r,t[35]=G,t[36]=K,t[37]=q):q=t[37];let J;t[38]!==U||t[39]!==q?(J=(0,Q.jsxs)(`footer`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-3`,children:[U,q]}),t[38]=U,t[39]=q,t[40]=J):J=t[40];let Y;t[41]!==B||t[42]!==V||t[43]!==J?(Y=(0,Q.jsxs)(C,{children:[M,(0,Q.jsxs)(w,{className:`fixed left-1/2 top-1/2 z-[120] flex h-[min(22rem,calc(100dvh-2rem))] w-[min(28rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-popover`,children:[B,V,J]})]}),t[41]=B,t[42]=V,t[43]=J,t[44]=Y):Y=t[44];let te;return t[45]!==s||t[46]!==j||t[47]!==Y?(te=(0,Q.jsxs)(E,{open:s,onOpenChange:c,children:[j,Y]}),t[45]=s,t[46]=j,t[47]=Y,t[48]=te):te=t[48],te}function Pe(e,t){return e?new Intl.DateTimeFormat(t===`zh`?`zh-CN`:`en`,{dateStyle:`medium`}).format(e):null}function Fe(e,t,n=new Date){let r=new Date(n.getFullYear(),n.getMonth(),n.getDate()),i=new Date(r);i.setDate(r.getDate()-1);let a=new Map;for(let n of[...e].sort((e,t)=>t.recordedAt-e.recordedAt)){let e=n.recordedAt>=r.getTime()?t===`zh`?`今天`:`Today`:n.recordedAt>=i.getTime()?t===`zh`?`昨天`:`Yesterday`:Pe(n.recordedAt,t)??(t===`zh`?`更早`:`Earlier`),o=a.get(e)??[];o.push(n),a.set(e,o)}return[...a].map(([e,t])=>({label:e,items:t}))}function Ie(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 Le(e,t){if(e.validTo){let n=Pe(e.validTo,t);return t===`zh`?`适用至 ${n}`:`Applies until ${n}`}return(t===`zh`?{stable:`相对稳定`,slow:`会随时间复核`,dynamic:`近期状态`,event:`特定阶段`}:{stable:`Relatively stable`,slow:`Reviewed over time`,dynamic:`Current context`,event:`Specific period`})[e.volatility]}function Re(e,t){return e.authority===`user_explicit`?null:e.confidence>=.85?t===`zh`?`把握较高`:`High confidence`:e.confidence>=.65?t===`zh`?`把握中等`:`Medium confidence`:t===`zh`?`证据较少`:`Limited evidence`}function ze(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 Be(e){let t=(0,Z.c)(23),{item:n,language:r,busy:i,editing:a,draft:o,onDraftChange:s,onEdit:c,onCancel:l,onDelete:u,onCorrect:d}=e,f=(0,X.useId)(),p=r===`zh`,m;t[0]!==n||t[1]!==r?(m=Re(n,r),t[0]=n,t[1]=r,t[2]=m):m=t[2];let h=m,g;t[3]===n.sources?g=t[4]:(g=new Set(n.sources?.map(He).filter(Boolean)),t[3]=n.sources,t[4]=g);let _;t[5]===g?_=t[6]:(_=[...g],t[5]=g,t[6]=_);let v=_,y=p?`修改`:`Edit`,b;return t[7]!==i||t[8]!==h||t[9]!==o||t[10]!==y||t[11]!==a||t[12]!==f||t[13]!==n||t[14]!==r||t[15]!==l||t[16]!==d||t[17]!==u||t[18]!==s||t[19]!==c||t[20]!==v||t[21]!==p?(b=(0,Q.jsx)(`article`,{className:`border-t border-edge-subtle px-4 py-3 first:border-t-0 sm:px-5 [content-visibility:auto] [contain-intrinsic-size:auto_100px]`,children:a?(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:f,children:p?`修改这条理解`:`Edit this understanding`}),(0,Q.jsx)(`textarea`,{id:f,value:o,disabled:i,onChange:e=>s(e.target.value),className:`mt-2 min-h-28 w-full resize-y rounded-xl border border-edge bg-surface-base px-3 py-2.5 text-base leading-7 text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`}),(0,Q.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Q.jsx)(O,{variant:`ghost`,disabled:i,onClick:l,children:p?`取消`:`Cancel`}),(0,Q.jsx)(O,{variant:`primary`,disabled:!o.trim()||i,onClick:d,children:i?p?`保存中…`:`Saving…`:p?`保存修改`:`Save changes`})]})]}):(0,Q.jsxs)(`div`,{className:`flex items-start gap-2 sm:gap-4`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 pt-1.5`,children:[(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-base leading-7 text-fg`,children:n.statement}),(0,Q.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs leading-5 text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:Ie(n,r)}),n.usable===!1?(0,Q.jsx)(`span`,{children:p?`暂不使用`:`Not in use`}):null,n.validTo?(0,Q.jsx)(`span`,{children:Le(n,r)}):null,n.authority!==`user_explicit`&&n.confidence<.65?(0,Q.jsx)(`span`,{children:h}):null,(0,Q.jsxs)(`details`,{className:`open:basis-full`,children:[(0,Q.jsx)(`summary`,{className:`w-fit cursor-pointer rounded-md py-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:p?`查看依据`:`View sources`}),(0,Q.jsxs)(`div`,{className:`my-2 space-y-1 border-l-2 border-edge pl-3 text-sm leading-6`,children:[(0,Q.jsx)(`p`,{children:n.usable?p?`按需用于当前协作`:`Used when relevant`:p?`暂不使用,后台继续复核`:`Not in use; reviewed automatically`}),(0,Q.jsxs)(`p`,{children:[Le(n,r),` · `,ze(n.scope,r),h?` · ${h}`:``]}),(0,Q.jsxs)(`p`,{children:[p?`最近观察:`:`Last observed: `,Pe(n.observedAt,r)]}),(0,Q.jsxs)(`p`,{children:[p?`模型层:`:`Model layer: `,p?{fact:`事实`,pattern:`模式`,interpretation:`解释`}[n.layer]:n.layer,` · `,p?`${n.independentSourceCount} 个独立来源`:`${n.independentSourceCount} independent sources`]}),v.length?v.map(Ve):(0,Q.jsx)(`p`,{children:p?`暂无更详细的来源记录`:`No further source details available`}),(0,Q.jsx)(O,{variant:`ghost`,className:`-ml-2 px-2`,disabled:i,onClick:c,children:y})]})]})]})]}),(0,Q.jsx)(Ne,{language:r,busy:i,statement:n.statement,onEdit:c,onDelete:u})]})}),t[7]=i,t[8]=h,t[9]=o,t[10]=y,t[11]=a,t[12]=f,t[13]=n,t[14]=r,t[15]=l,t[16]=d,t[17]=u,t[18]=s,t[19]=c,t[20]=v,t[21]=p,t[22]=b):b=t[22],b}function Ve(e){return(0,Q.jsx)(`p`,{className:`break-words`,children:e},e)}function He(e){return e.label}var Ue={zh:{eyebrow:`全局用户理解`,title:`xopc 如何形成对你的理解`,subtitle:`这里汇总跨项目、跨对话形成的认识,并说明它们来自哪些渠道。项目事实不会混入你的个人画像。`,channels:`理解渠道`,channelHint:`查看来源及其最近更新。`,noChannels:`尚未通过任何渠道形成可展示的全局理解。`,activeCount:`{{count}} 条已在使用`,pendingCount:`{{count}} 条暂不使用`,noUnderstanding:`暂无来自此渠道的全局理解`,pending:`最近更新`,pendingHint:`自动整理并按需使用,你可以随时修改或删除。`,nothingPending:`尚未形成全局理解。`,showAll:`查看全部 {{count}} 条`,showLess:`收起`,done:`完成`,updating:`正在从已授权渠道更新理解;你可以先查看已有内容。`,sourceKinds:{user:`你明确告诉我的`,conversation:`对话与协作`,connector:`连接的服务`,work_folder:`工作目录`,local_source:`本机来源`,inference:`综合整理`}},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:`View sources and their latest updates.`,noChannels:`No channel has formed displayable global understanding yet.`,activeCount:`{{count}} in use`,pendingCount:`{{count}} not in use`,noUnderstanding:`No usable global understanding has formed from this channel yet`,pending:`Recent updates`,pendingHint:`Organized automatically and used when relevant. Edit or delete anytime.`,nothingPending:`No understanding has formed yet.`,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`}}},We={"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:`最近文档`}},Ge={user:ye,conversation:le,connector:ce,work_folder:f,local_source:xe,inference:ce},Ke={files:f,recent_documents:xe,calendar:G,tasks:M,notes:we,mail:Ce,messages:le,code_activity:J};function $(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 qe(e,t){return e.kind===`local_source`&&e.label?We[e.label]?.[t]??e.label:e.kind===`work_folder`&&e.label?t===`zh`?`工作目录 · ${e.label}`:`Work folder · ${e.label}`:e.label?e.label:Ue[t].sourceKinds[e.kind]}function Je(e){return`${e.kind}:${e.adapterId}:${e.displayName}`}function Ye(e){let t=(0,Z.c)(91),{assertions:n,configuredSources:r,activityRunning:i,language:a,busy:s,error:c,onReviewAssertion:l,onCompleted:d}=e,f=Ue[a],[m,h]=(0,X.useState)(!1),[g,_]=(0,X.useState)(null),[y,b]=(0,X.useState)(``),x;t[0]===n?x=t[1]:(x=n.filter(nt),t[0]=n,t[1]=x);let ee=x,S;t[2]===ee?S=t[3]:(S=[...ee].sort(tt),t[2]=ee,t[3]=S);let C=S,w;if(t[4]!==r||t[5]!==ee||t[6]!==a){let e=new Map;for(let t of r){let n=t.kind===`local_source`?We[t.adapterId]?.[a]??t.displayName:t.displayName,r=Je(t);e.set(r,{key:r,grantId:t.id,kind:t.kind,category:t.category,label:t.kind===`work_folder`?a===`zh`?`工作目录 · ${n}`:`Work folder · ${n}`:n,assertions:[],lastObservedAt:t.lastCollectedAt})}for(let t of ee)for(let n of t.sources?.length?t.sources:[$(t)]){let r=qe(n,a),i=[...e.values()].find(e=>e.kind===n.kind&&e.label===r),o=i?.key??`${n.kind}:${r}`,s=i??e.get(o)??{key:o,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(o,s)}w=[...e.values()].sort(et),t[4]=r,t[5]=ee,t[6]=a,t[7]=w}else w=t[7];let T=w,E;t[8]===l?E=t[9]:(E=async(e,t,n)=>{await l(e,t,n)&&_(null)},t[8]=l,t[9]=E);let D=E,k,A,j,M,N,P,F,I,L;if(t[10]!==i||t[11]!==s||t[12]!==y||t[13]!==g||t[14]!==a||t[15]!==C||t[16]!==D||t[17]!==m||t[18]!==f.eyebrow||t[19]!==f.nothingPending||t[20]!==f.pending||t[21]!==f.pendingHint||t[22]!==f.showAll||t[23]!==f.showLess||t[24]!==f.subtitle||t[25]!==f.title||t[26]!==f.updating){let e=m?C:C.slice(0,5);k=`mx-auto w-full max-w-[42rem] pb-2`,A=`polite`;let n;t[36]===f.eyebrow?n=t[37]:(n=(0,Q.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.18em] text-accent-fg`,children:f.eyebrow}),t[36]=f.eyebrow,t[37]=n);let r;t[38]===f.title?r=t[39]:(r=(0,Q.jsx)(`h2`,{className:`mt-3 text-2xl font-semibold tracking-tight text-fg sm:text-3xl`,children:f.title}),t[38]=f.title,t[39]=r);let o;t[40]===f.subtitle?o=t[41]:(o=(0,Q.jsx)(`p`,{className:`mx-auto mt-3 max-w-[38rem] text-sm leading-6 text-fg-muted`,children:f.subtitle}),t[40]=f.subtitle,t[41]=o),t[42]!==n||t[43]!==r||t[44]!==o?(j=(0,Q.jsxs)(`div`,{className:`text-center`,children:[n,r,o]}),t[42]=n,t[43]=r,t[44]=o,t[45]=j):j=t[45],t[46]!==i||t[47]!==f.updating?(M=i?(0,Q.jsxs)(`div`,{className:`mt-6 flex items-center gap-3 rounded-xl border border-accent/20 bg-accent-soft/55 px-4 py-3 text-sm text-accent-fg`,children:[(0,Q.jsx)(p,{className:`size-4 shrink-0 animate-spin motion-reduce:animate-none`}),(0,Q.jsx)(`p`,{children:f.updating})]}):null,t[46]=i,t[47]=f.updating,t[48]=M):M=t[48],N=`mt-8`,P=`understanding-updates-title`;let c=C.length?` · ${C.length}`:``;t[49]!==f.pending||t[50]!==c?(F=(0,Q.jsxs)(`h3`,{id:`understanding-updates-title`,className:`text-sm font-semibold text-fg`,children:[f.pending,c]}),t[49]=f.pending,t[50]=c,t[51]=F):F=t[51],t[52]===f.pendingHint?I=t[53]:(I=(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:f.pendingHint}),t[52]=f.pendingHint,t[53]=I),L=C.length?(0,Q.jsxs)(`div`,{className:`mt-3`,children:[Fe(e,a).map(e=>{let{label:t,items:n}=e;return(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`border-b border-edge-subtle px-4 pb-2 pt-3 text-xs font-medium text-fg-muted`,children:t}),(0,Q.jsx)(`div`,{children:n.map(e=>(0,Q.jsx)(Be,{item:e,language:a,busy:s,editing:g===e.id,draft:y,onDraftChange:b,onEdit:()=>{_(e.id),b(e.statement)},onCancel:()=>_(null),onCorrect:()=>void D(e,`edited`,y.trim()),onDelete:()=>void D(e,`deleted`)},e.id))})]},t)}),C.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:()=>h($e),children:[m?f.showLess:f.showAll.replace(`{{count}}`,String(C.length)),(0,Q.jsx)(B,{className:v(`size-3.5 transition-transform`,m&&`rotate-180`)})]}):null]}):(0,Q.jsxs)(`div`,{className:`mt-3 flex items-start gap-3 rounded-xl border border-edge bg-surface-base/55 p-4`,children:[(0,Q.jsx)(u,{className:`mt-0.5 size-5 shrink-0 text-success`}),(0,Q.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:f.nothingPending})]}),t[10]=i,t[11]=s,t[12]=y,t[13]=g,t[14]=a,t[15]=C,t[16]=D,t[17]=m,t[18]=f.eyebrow,t[19]=f.nothingPending,t[20]=f.pending,t[21]=f.pendingHint,t[22]=f.showAll,t[23]=f.showLess,t[24]=f.subtitle,t[25]=f.title,t[26]=f.updating,t[27]=k,t[28]=A,t[29]=j,t[30]=M,t[31]=N,t[32]=P,t[33]=F,t[34]=I,t[35]=L}else k=t[27],A=t[28],j=t[29],M=t[30],N=t[31],P=t[32],F=t[33],I=t[34],L=t[35];let R;t[54]!==N||t[55]!==P||t[56]!==F||t[57]!==I||t[58]!==L?(R=(0,Q.jsxs)(`section`,{className:N,"aria-labelledby":P,children:[F,I,L]}),t[54]=N,t[55]=P,t[56]=F,t[57]=I,t[58]=L,t[59]=R):R=t[59];let z;t[60]!==T.length||t[61]!==f.channels?(z=(0,Q.jsxs)(`summary`,{className:`w-fit cursor-pointer rounded-md py-2 text-sm font-medium text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[f.channels,` · `,T.length]}),t[60]=T.length,t[61]=f.channels,t[62]=z):z=t[62];let V;t[63]===f.channelHint?V=t[64]:(V=(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:f.channelHint}),t[63]=f.channelHint,t[64]=V);let H;t[65]!==T||t[66]!==f.activeCount||t[67]!==f.noChannels||t[68]!==f.noUnderstanding||t[69]!==f.pendingCount?(H=T.length?(0,Q.jsx)(`div`,{className:`mt-3 space-y-3`,children:T.map(e=>{let t=e.category?Ke[e.category]??Ge[e.kind]:Ge[e.kind],n=e.assertions.filter(Qe).length,r=e.assertions.filter(Ze).length;return(0,Q.jsxs)(`article`,{className:`rounded-xl 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-hover 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.grantId?(0,Q.jsx)(je,{sourceId:e.grantId,lastCollectedAt:e.lastObservedAt}):null,e.assertions.length?(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[n?f.activeCount.replace(`{{count}}`,String(n)):``,r?f.pendingCount.replace(`{{count}}`,String(r)):``].filter(Boolean).join(` · `)}):(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:f.noUnderstanding})]}),e.grantId?(0,Q.jsx)(De,{sourceId:e.grantId}):null]}),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-xl border border-edge bg-surface-base/55 p-4 text-sm text-fg-muted`,children:f.noChannels}),t[65]=T,t[66]=f.activeCount,t[67]=f.noChannels,t[68]=f.noUnderstanding,t[69]=f.pendingCount,t[70]=H):H=t[70];let U;t[71]!==z||t[72]!==V||t[73]!==H?(U=(0,Q.jsxs)(`details`,{className:`mt-6 border-t border-edge pt-4`,children:[z,V,H]}),t[71]=z,t[72]=V,t[73]=H,t[74]=U):U=t[74];let W;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Q.jsx)(o,{className:`size-4`}),t[75]=W):W=t[75];let G;t[76]!==s||t[77]!==d||t[78]!==f.done?(G=(0,Q.jsx)(`div`,{className:`mt-6 flex justify-end`,children:(0,Q.jsxs)(O,{variant:`primary`,disabled:s,onClick:d,children:[W,f.done]})}),t[76]=s,t[77]=d,t[78]=f.done,t[79]=G):G=t[79];let K;t[80]===c?K=t[81]:(K=c?(0,Q.jsx)(`p`,{className:`mt-5 text-sm text-danger`,role:`alert`,children:c}):null,t[80]=c,t[81]=K);let q;return t[82]!==k||t[83]!==A||t[84]!==j||t[85]!==M||t[86]!==R||t[87]!==U||t[88]!==G||t[89]!==K?(q=(0,Q.jsxs)(`section`,{className:k,"aria-live":A,children:[j,M,R,U,G,K]}),t[82]=k,t[83]=A,t[84]=j,t[85]=M,t[86]=R,t[87]=U,t[88]=G,t[89]=K,t[90]=q):q=t[90],q}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 Ze(e){return!e.usable}function Qe(e){return e.usable}function $e(e){return!e}function et(e,t){return t.assertions.length-e.assertions.length||(t.lastObservedAt??0)-(e.lastObservedAt??0)}function tt(e,t){return t.recordedAt-e.recordedAt}function nt(e){return e.scope.type===`global`&&e.status!==`archived`&&e.status!==`rejected`}function rt(){let{pathname:e,search:t}=a(),n=y(e=>e.language),r=ve(),[i,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)(null),l=e===`/user-model`,{data:u,mutate:d}=D(l?`/api/user-model`:null,Se),f=R(e=>e.error),m=R(e=>e.sources.some(e=>e.status===`running`||e.status===`queued`)),h=n===`zh`;if((0,X.useEffect)(()=>{l&&new URLSearchParams(t).get(`workDiscovery`)===`review`&&ve.getState().setDrawerOpen(!0)},[l,t]),(0,X.useEffect)(()=>{l&&r.status!==`running`&&d()},[d,l,r.directoryRun?.id,r.status]),!l)return null;let g=r.status===`running`||m,A=async(e,t,n)=>{o(!0),c(null);try{return t===`edited`&&n?await de(e.id,n):t===`deleted`&&await be(e.id),await d(),!0}catch(e){return c(e instanceof Error?e.message:String(e)),!1}finally{o(!1)}},j=e=>{if(!e&&u&&r.status!==`running`){r.finish();return}r.setDrawerOpen(e)};return(0,Q.jsxs)(E,{open:r.drawerOpen,onOpenChange:j,children:[(0,Q.jsx)(x,{asChild:!0,children:(0,Q.jsx)(O,{type:`button`,variant:`ghost`,className:v(`relative size-8 rounded-xl p-0`,H),title:h?`查看 xopc 对你的理解`:`Review what xopc understands`,"aria-label":h?`查看 xopc 对你的理解`:`Review what xopc understands`,children:g?(0,Q.jsx)(p,{className:`size-4 animate-spin motion-reduce:animate-none`}):(0,Q.jsx)(V,{className:`size-4 text-accent-fg`})})}),(0,Q.jsxs)(C,{children:[(0,Q.jsx)(b,{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)(w,{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-xl border border-edge bg-surface-overlay 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)(T,{className:`text-sm font-semibold text-fg`,children:g?h?`正在更新用户理解`:`Updating user understanding`:h?`用户理解`:`User understanding`}),(0,Q.jsx)(ee,{className:`mt-0.5 text-xs text-fg-muted`,children:g?h?`关闭窗口也会在后台继续`:`You can close this window; work continues in the background`:h?`自动更新,可随时修改或删除`:`Updated automatically. Edit or delete anytime`})]}),(0,Q.jsx)(De,{disabled:!u?.sources?.length}),(0,Q.jsx)(S,{asChild:!0,children:(0,Q.jsx)(O,{variant:`ghost`,className:`size-8 rounded-xl p-0`,"aria-label":h?`关闭`:`Close`,children:(0,Q.jsx)(_,{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:g,language:n,busy:i,error:s??f??null,onReviewAssertion:A,onCompleted:()=>{j(!1)}}):(0,Q.jsxs)(`section`,{className:`space-y-4`,"aria-label":h?`正在加载用户理解`:`Loading user understanding`,children:[(0,Q.jsx)(k,{className:`h-8 w-2/3`}),(0,Q.jsx)(k,{className:`h-32 w-full`}),(0,Q.jsx)(k,{className:`h-32 w-full`})]})})]})})]})]})}function it(e){let t=e.get(`tab`);return t===`understanding`||t===`knowledge`?t:`overview`}var at={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`,timezoneSearch:`Search timezones…`,timezoneNoMatch:`No matching 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`,allUnderstanding:`All understanding`,understandingFilterHint:`Filter this view by how each item was formed.`,importantNow:`What matters now`,prioritySourceGoal:`From a goal you confirmed`,prioritySourceWork:`From your current work`,editPriority:`Edit focus`,addPriority:`Set current focus`,priorityTitle:`Current focus`,priorityTitlePlaceholder:`What matters most right now?`,priorityOutcome:`What a good outcome looks like`,priorityOutcomePlaceholder:`Describe the result you want…`,priorityUntil:`Focus through`,savePriority:`Save focus`,endPriority:`End focus`,endingPriority:`Ending…`,priorityHint:`This is used to keep xopc aligned with what deserves attention 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:`Recent understanding from our work. You can edit any item.`,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`,refreshing:`Refreshing…`,refreshComplete:`Refreshed`,refreshFailed:`Refresh failed`,aboutYouTitle:`A view you can correct`,aboutYouHint:`xopc quietly maintains this working context from collaboration. You can edit or retire any item.`,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`,save:`Save correction`,cancel:`Cancel`,correctionPlaceholder:`Write the accurate version…`,searchPlaceholder:`Search work memory…`,allMemory:`All work memory`,memoryFilterHint:`Filter by memory type`,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.`,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:`时区`,timezoneSearch:`搜索时区…`,timezoneNoMatch:`没有匹配的时区`,locale:`语言 / 地区`,useDeviceTimezone:`使用本机时区`,notProvided:`未填写`,editProfileHint:`这些是由你直接提供的事实,与 xopc 的观察和推断分开维护。`,saveProfile:`保存`,saving:`正在保存…`,explicit:`你告诉我的`,explicitHint:`你明确表达的事实与偏好`,learned:`协作中学到的`,learnedHint:`从实际协作中形成的认识`,allUnderstanding:`全部理解`,understandingFilterHint:`按内容来源筛选这份理解。`,importantNow:`此刻重要`,prioritySourceGoal:`来自你确认的当前目标`,prioritySourceWork:`来自当前工作上下文`,editPriority:`编辑`,addPriority:`设置当前关注`,priorityTitle:`当前关注`,priorityTitlePlaceholder:`现在最重要的是什么?`,priorityOutcome:`期待结果`,priorityOutcomePlaceholder:`描述你希望达成的结果…`,priorityUntil:`关注至`,savePriority:`保存关注`,endPriority:`结束关注`,endingPriority:`正在结束…`,priorityHint:`这项内容会帮助 xopc 在协作中优先关注当前最重要的事情。`,noPriority:`还没有设置当前优先事项。`,otherGoals:`其他进行中的目标`,howWeWork:`我们怎样协作`,howWeWorkHint:`你对沟通方式和执行行为的长期约定。`,noRules:`还没有形成协作偏好。`,recent:`最近形成的理解`,recentHint:`最近在协作中形成的认识,你可以随时修改。`,seeAll:`查看全部`,workMemory:`我在工作中记住的`,workMemoryHint:`项目事实、决定、经验和待解问题,与“关于你”的理解分别管理。`,items:`条`,maintenanceReady:`记忆整理已经启用,正在等待首次运行。`,maintenanceComplete:`最近一次记忆整理于`,maintenanceFailed:`最近一次记忆整理需要处理`,refresh:`刷新`,refreshing:`正在刷新…`,refreshComplete:`已刷新`,refreshFailed:`刷新失败`,aboutYouTitle:`一份可以共同修正的理解`,aboutYouHint:`xopc 会在协作中安静地维护这份工作认知。你仍可随时修改或停止使用任何一条。`,identity:`关于你是谁`,preferences:`偏好与工作节奏`,relationships:`重要的人与关系`,currentState:`当前状态`,insights:`我形成的判断`,emptyGroup:`这里还没有形成理解。`,correct:`修正`,save:`保存修正`,cancel:`取消`,correctionPlaceholder:`写下更准确的说法…`,searchPlaceholder:`搜索工作记忆…`,allMemory:`全部工作记忆`,memoryFilterHint:`按记忆类型筛选`,memoryLibraryHint:`这里只显示提炼后的事实、决定、经验、承诺和待解问题;邮件、日历与文档原文保留在对应来源中。`,noKnowledge:`还没有形成工作记忆。`,noKnowledgeMatch:`没有符合搜索条件的工作记忆。`,showMore:`显示更多`,expand:`查看详情`,collapse:`收起详情`,disable:`停用`,disabled:`已停用`,enable:`启用`,loadFailed:`无法载入对你的理解。`,tryAgain:`重试`,actionFailed:`修改没有保存,请重试。`}},ot=new Set([`identity.call_name`,`identity.role`,`identity.pronouns`,`preference.timezone`,`preference.locale`]),st=[`work_thread`,`project_fact`,`workspace_fact`,`decision`,`task_lesson`,`commitment`,`open_question`,`episode`,`note`],ct=`UTC.Africa/Cairo.Africa/Johannesburg.America/Chicago.America/Denver.America/Los_Angeles.America/Mexico_City.America/New_York.America/Sao_Paulo.America/Toronto.America/Vancouver.Asia/Bangkok.Asia/Dubai.Asia/Hong_Kong.Asia/Jakarta.Asia/Kolkata.Asia/Seoul.Asia/Shanghai.Asia/Singapore.Asia/Taipei.Asia/Tokyo.Australia/Melbourne.Australia/Perth.Australia/Sydney.Europe/Amsterdam.Europe/Berlin.Europe/London.Europe/Madrid.Europe/Paris.Europe/Rome.Pacific/Auckland.Pacific/Honolulu`.split(`.`);function lt(){try{let e=Intl.supportedValuesOf(`timeZone`);return[...new Set([`UTC`,...e])]}catch{return[...ct]}}var ut=lt();function dt(e){return e.map(e=>({value:e,label:e.replaceAll(`_`,` `),group:e.includes(`/`)?e.split(`/`)[0]:`UTC`}))}function ft(e,t,n=!1){return e?new Intl.DateTimeFormat(t===`zh`?`zh-CN`:`en`,{dateStyle:`medium`,...n?{timeStyle:`short`}:{}}).format(e):null}function pt(e){return typeof e==`string`&&e.trim()?e.trim():void 0}function mt(e){return{callName:pt(e.profile.callName)??``,role:pt(e.profile.role)??``,pronouns:pt(e.profile.pronouns)??``,timezone:pt(e.profile.timezone)??``,locale:pt(e.profile.locale)??``}}function ht(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 gt(e){return Array.from(e.trim()).slice(0,2).join(``).toLocaleUpperCase()}function _t(e,t){let n=ft(e,t);return t===`zh`?`当前安排至 ${n}`:`Current plan through ${n}`}function vt(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function yt(e){let[t,n,r]=e.split(`-`).map(Number);return new Date(t,n-1,r,23,59,59,999).getTime()}function bt(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 xt(e,t){return(t===`zh`?{work_thread:`工作主线`,project_fact:`项目事实`,workspace_fact:`工作区事实`,decision:`已经决定`,task_lesson:`工作经验`,commitment:`承诺与约定`,open_question:`待解问题`,episode:`重要经历`,note:`其他记录`}:{work_thread:`Work threads`,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 St(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 Ct(e){let t=(0,Z.c)(16),{title:n,hint:r,action:i,children:a,className:o}=e,s=o===void 0?``:o,c;t[0]===n?c=t[1]:(c=(0,Q.jsx)(`h2`,{className:`text-base font-semibold tracking-tight 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-6 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-end justify-between gap-4 px-1 pb-3`,children:[u,i]}),t[7]=i,t[8]=u,t[9]=d):d=t[9];let f;t[10]===a?f=t[11]:(f=(0,Q.jsx)(`div`,{className:`overflow-hidden rounded-2xl bg-surface-panel`,children:a}),t[10]=a,t[11]=f);let p;return t[12]!==s||t[13]!==d||t[14]!==f?(p=(0,Q.jsxs)(`section`,{className:s,children:[d,f]}),t[12]=s,t[13]=d,t[14]=f,t[15]=p):p=t[15],p}function wt(e){let t=(0,Z.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 items-center gap-3 px-5 py-5 text-sm text-fg-muted`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Tt({open:e,profile:t,language:n,saving:r,onOpenChange:i,onSave:a}){let o=at[n],[u,d]=(0,X.useState)(t),[f,m]=(0,X.useState)(``);(0,X.useEffect)(()=>{e&&(d(t),m(``))},[e,t]);let h=e=>{e.preventDefault(),a({callName:u.callName.trim(),role:u.role.trim(),pronouns:u.pronouns.trim(),timezone:u.timezone.trim(),locale:u.locale.trim()})},g=(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:u[e],onChange:t=>d(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`})]}),v=[`zh-CN`,`zh-TW`,`en-US`,`en-GB`,`ja-JP`];u.locale&&!v.includes(u.locale)&&v.push(u.locale);let y=fe(),x=(0,X.useMemo)(()=>[...new Set([...ut,y,u.timezone].filter(Boolean))].sort(),[y,u.timezone]),D=f.trim().toLocaleLowerCase(),k=(0,X.useMemo)(()=>dt(x.filter(e=>!D||e.toLocaleLowerCase().includes(D)||e.replaceAll(`_`,` `).toLocaleLowerCase().includes(D))),[x,D]);return(0,Q.jsx)(E,{open:e,onOpenChange:i,children:(0,Q.jsxs)(C,{children:[(0,Q.jsx)(b,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsx)(w,{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 rounded-2xl border border-edge bg-surface-overlay shadow-popover outline-none`,children:(0,Q.jsxs)(`form`,{className:`flex h-full min-h-0 flex-col overflow-hidden [border-radius:inherit]`,onSubmit:h,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)(T,{className:`font-semibold text-fg`,children:o.editProfile}),(0,Q.jsx)(ee,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:o.editProfileHint})]}),(0,Q.jsx)(S,{asChild:!0,children:(0,Q.jsx)(O,{variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":o.cancel,children:(0,Q.jsx)(_,{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:[g(`callName`,o.callName,o.callNamePlaceholder),g(`role`,o.role,o.rolePlaceholder),g(`pronouns`,o.pronouns,o.pronounsPlaceholder),(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:o.locale}),(0,Q.jsxs)(s,{value:u.locale,onChange:e=>d(t=>({...t,locale:e.target.value})),children:[(0,Q.jsx)(c,{value:``,children:o.notProvided}),v.map(e=>(0,Q.jsx)(c,{value:e,children:ht(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:o.timezone}),(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(l,{value:u.timezone,options:k,placeholder:fe(),emptyLabel:o.notProvided,ariaLabel:o.timezone,selectedLabel:u.timezone||o.notProvided,searchPlaceholder:o.timezoneSearch,searchValue:f,onSearchChange:m,statusMessage:k.length?void 0:o.timezoneNoMatch,triggerClassName:`min-w-0 flex-1 rounded-xl bg-surface-base`,onChange:e=>{d(t=>({...t,timezone:e})),m(``)}}),(0,Q.jsx)(O,{className:`shrink-0 whitespace-nowrap`,onClick:()=>d(e=>({...e,timezone:y})),children:o.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)(S,{asChild:!0,children:(0,Q.jsx)(O,{disabled:r,children:o.cancel})}),(0,Q.jsxs)(O,{type:`submit`,variant:`primary`,disabled:r,children:[r?(0,Q.jsx)(p,{className:`size-4 animate-spin`}):null,r?o.saving:o.saveProfile]})]})]})})]})})}function Et(e){let t=(0,Z.c)(94),{open:n,priority:r,title:i,outcome:a,language:o,saving:s,onOpenChange:c,onSave:l,onEnd:u}=e,d=at[o],[f,m]=(0,X.useState)(i),[h,g]=(0,X.useState)(a??``),v=r?.validTo??Date.now()+6048e5,y;t[0]===v?y=t[1]:(y=vt(v),t[0]=v,t[1]=y);let x=y,[D,k]=(0,X.useState)(x),A,j;t[2]!==x||t[3]!==n||t[4]!==a||t[5]!==i?(A=()=>{n&&(m(i),g(a??``),k(x))},j=[x,n,a,i],t[2]=x,t[3]=n,t[4]=a,t[5]=i,t[6]=A,t[7]=j):(A=t[6],j=t[7]),(0,X.useEffect)(A,j);let M;t[8]!==h||t[9]!==f||t[10]!==D||t[11]!==l||t[12]!==r?.targetType?(M=e=>{e.preventDefault(),l({title:f.trim(),...r?.targetType===`goal`?{desiredOutcome:h.trim()}:{},validTo:yt(D)})},t[8]=h,t[9]=f,t[10]=D,t[11]=l,t[12]=r?.targetType,t[13]=M):M=t[13];let N=M,P;t[14]!==h||t[15]!==f||t[16]!==D||t[17]!==r?.targetType?(P=f.trim()&&D&&(r?.targetType!==`goal`||h.trim()),t[14]=h,t[15]=f,t[16]=D,t[17]=r?.targetType,t[18]=P):P=t[18];let F=!!P,I;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Q.jsx)(b,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[19]=I):I=t[19];let L=r?d.editPriority:d.addPriority,R;t[20]===L?R=t[21]:(R=(0,Q.jsx)(T,{className:`font-semibold text-fg`,children:L}),t[20]=L,t[21]=R);let z;t[22]===d.priorityHint?z=t[23]:(z=(0,Q.jsx)(ee,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:d.priorityHint}),t[22]=d.priorityHint,t[23]=z);let B;t[24]!==z||t[25]!==R?(B=(0,Q.jsxs)(`div`,{children:[R,z]}),t[24]=z,t[25]=R,t[26]=B):B=t[26];let V;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Q.jsx)(_,{className:`size-4`}),t[27]=V):V=t[27];let H;t[28]===d.cancel?H=t[29]:(H=(0,Q.jsx)(S,{asChild:!0,children:(0,Q.jsx)(O,{variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":d.cancel,children:V})}),t[28]=d.cancel,t[29]=H);let U;t[30]!==B||t[31]!==H?(U=(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:[B,H]}),t[30]=B,t[31]=H,t[32]=U):U=t[32];let W;t[33]===d.priorityTitle?W=t[34]:(W=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:d.priorityTitle}),t[33]=d.priorityTitle,t[34]=W);let G;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(G=e=>m(e.target.value),t[35]=G):G=t[35];let K;t[36]!==f||t[37]!==d.priorityTitlePlaceholder?(K=(0,Q.jsx)(`input`,{autoFocus:!0,value:f,onChange:G,placeholder:d.priorityTitlePlaceholder,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`}),t[36]=f,t[37]=d.priorityTitlePlaceholder,t[38]=K):K=t[38];let q;t[39]!==W||t[40]!==K?(q=(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[W,K]}),t[39]=W,t[40]=K,t[41]=q):q=t[41];let J;t[42]!==h||t[43]!==r?.targetType||t[44]!==d.priorityOutcome||t[45]!==d.priorityOutcomePlaceholder?(J=r?.targetType===`goal`?(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:d.priorityOutcome}),(0,Q.jsx)(`textarea`,{value:h,onChange:e=>g(e.target.value),placeholder:d.priorityOutcomePlaceholder,className:`min-h-28 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 placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`})]}):null,t[42]=h,t[43]=r?.targetType,t[44]=d.priorityOutcome,t[45]=d.priorityOutcomePlaceholder,t[46]=J):J=t[46];let Y;t[47]===d.priorityUntil?Y=t[48]:(Y=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:d.priorityUntil}),t[47]=d.priorityUntil,t[48]=Y);let te;t[49]===r?.validFrom?te=t[50]:(te=r?.validFrom??Date.now(),t[49]=r?.validFrom,t[50]=te);let ne;t[51]===te?ne=t[52]:(ne=vt(te),t[51]=te,t[52]=ne);let re;t[53]!==D||t[54]!==d.priorityUntil||t[55]!==ne?(re=(0,Q.jsx)(Ee,{min:ne,value:D,onChange:k,ariaLabel:d.priorityUntil,className:`rounded-xl border border-edge bg-surface-base hover:border-edge-strong hover:bg-surface-base`}),t[53]=D,t[54]=d.priorityUntil,t[55]=ne,t[56]=re):re=t[56];let ie;t[57]!==Y||t[58]!==re?(ie=(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[Y,re]}),t[57]=Y,t[58]=re,t[59]=ie):ie=t[59];let ae;t[60]!==q||t[61]!==J||t[62]!==ie?(ae=(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto p-5 sm:p-6`,children:[q,J,ie]}),t[60]=q,t[61]=J,t[62]=ie,t[63]=ae):ae=t[63];let oe;t[64]!==u||t[65]!==r||t[66]!==s||t[67]!==d.endPriority||t[68]!==d.endingPriority?(oe=r&&u?(0,Q.jsxs)(O,{variant:`ghost`,className:`text-danger hover:text-danger`,disabled:s,onClick:u,children:[s?(0,Q.jsx)(p,{className:`size-4 animate-spin`}):null,s?d.endingPriority:d.endPriority]}):(0,Q.jsx)(`span`,{}),t[64]=u,t[65]=r,t[66]=s,t[67]=d.endPriority,t[68]=d.endingPriority,t[69]=oe):oe=t[69];let se;t[70]!==s||t[71]!==d.cancel?(se=(0,Q.jsx)(S,{asChild:!0,children:(0,Q.jsx)(O,{disabled:s,children:d.cancel})}),t[70]=s,t[71]=d.cancel,t[72]=se):se=t[72];let ce=!F||s,le;t[73]===s?le=t[74]:(le=s?(0,Q.jsx)(p,{className:`size-4 animate-spin`}):null,t[73]=s,t[74]=le);let ue;t[75]!==d.savePriority||t[76]!==ce||t[77]!==le?(ue=(0,Q.jsxs)(O,{type:`submit`,variant:`primary`,disabled:ce,children:[le,d.savePriority]}),t[75]=d.savePriority,t[76]=ce,t[77]=le,t[78]=ue):ue=t[78];let de;t[79]!==se||t[80]!==ue?(de=(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[se,ue]}),t[79]=se,t[80]=ue,t[81]=de):de=t[81];let fe;t[82]!==oe||t[83]!==de?(fe=(0,Q.jsxs)(`footer`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-2 border-t border-edge px-5 py-3 sm:px-6`,children:[oe,de]}),t[82]=oe,t[83]=de,t[84]=fe):fe=t[84];let pe;t[85]!==N||t[86]!==U||t[87]!==ae||t[88]!==fe?(pe=(0,Q.jsxs)(C,{children:[I,(0,Q.jsx)(w,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] h-[min(34rem,calc(100vh-2rem))] w-[min(38rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 rounded-2xl border border-edge bg-surface-overlay shadow-popover outline-none`,children:(0,Q.jsxs)(`form`,{className:`flex h-full min-h-0 flex-col overflow-hidden [border-radius:inherit]`,onSubmit:N,children:[U,ae,fe]})})]}),t[85]=N,t[86]=U,t[87]=ae,t[88]=fe,t[89]=pe):pe=t[89];let me;return t[90]!==c||t[91]!==n||t[92]!==pe?(me=(0,Q.jsx)(E,{open:n,onOpenChange:c,children:pe}),t[90]=c,t[91]=n,t[92]=pe,t[93]=me):me=t[93],me}function Dt(e){let t=(0,Z.c)(16),{rule:n,language:r,busy:i,onToggle:a}=e,o=at[r],s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(Y,{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)(O,{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 Ot(e){let t=(0,Z.c)(15),{suggestion:n,language:r,busy:i,onConfirm:a}=e,o=r===`zh`,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(V,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),t[0]=s):s=t[0];let c;t[1]===n.statement?c=t[2]:(c=(0,Q.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:n.statement}),t[1]=n.statement,t[2]=c);let l=o?`根据你已确认的模式生成;确认前不会生效`:`Suggested from a pattern you confirmed; inactive until you approve`,u;t[3]===l?u=t[4]:(u=(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:l}),t[3]=l,t[4]=u);let d;t[5]!==c||t[6]!==u?(d=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[c,u]}),t[5]=c,t[6]=u,t[7]=d):d=t[7];let f=i?o?`启用中…`:`Enabling…`:o?`确认启用`:`Approve`,p;t[8]!==i||t[9]!==a||t[10]!==f?(p=(0,Q.jsx)(O,{variant:`secondary`,className:`h-8 shrink-0`,disabled:i,onClick:a,children:f}),t[8]=i,t[9]=a,t[10]=f,t[11]=p):p=t[11];let m;return t[12]!==d||t[13]!==p?(m=(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,d,p]}),t[12]=d,t[13]=p,t[14]=m):m=t[14],m}function kt(e){let t=(0,Z.c)(22),{item:n,language:r,busy:i,expanded:a,onToggle:o,editing:s,draft:c,onDraftChange:l,onEdit:u,onCancel:d,onReview:f,onDelete:p}=e,m=at[r],h=n.updatedAt??n.createdAt,g;t[0]!==r||t[1]!==h?(g=ft(h,r),t[0]=r,t[1]=h,t[2]=g):g=t[2];let _=g,v;t[3]===n.content?v=t[4]:(v=n.content.length>96||n.content.includes(`
2
2
  `),t[3]=n.content,t[4]=v);let y=v,b;return t[5]!==i||t[6]!==y||t[7]!==_||t[8]!==c||t[9]!==s||t[10]!==a||t[11]!==n.content||t[12]!==n.scope||t[13]!==r||t[14]!==d||t[15]!==p||t[16]!==l||t[17]!==u||t[18]!==f||t[19]!==o||t[20]!==m?(b=(0,Q.jsx)(`article`,{className:`group border-t border-edge-subtle px-5 py-4 first:border-t-0 sm:px-6`,children:s?(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsx)(`textarea`,{"aria-label":m.correctionPlaceholder,disabled:i,value:c,onChange:e=>l(e.target.value),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`}),(0,Q.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Q.jsx)(O,{variant:`ghost`,className:`h-8`,onClick:d,children:m.cancel}),(0,Q.jsx)(O,{variant:`primary`,className:`h-8`,disabled:!c.trim()||i,onClick:()=>f(`edit_and_approve`,c.trim()),children:m.save})]})]}):(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsx)(_e,{className:`mt-1 size-4 shrink-0 text-fg-subtle`}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-base leading-7 text-fg ${a?``:`line-clamp-2`}`,children:n.content}),(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-fg-subtle`,children:[(0,Q.jsx)(`span`,{children:bt(n.scope,r)}),_?(0,Q.jsx)(`span`,{children:_}):null]})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[y?(0,Q.jsx)(O,{variant:`ghost`,className:`size-11 p-0`,"aria-expanded":a,"aria-label":a?m.collapse:m.expand,onClick:o,children:(0,Q.jsx)(B,{className:`size-3.5 transition-transform ${a?`rotate-180`:``}`})}):null,(0,Q.jsx)(Ne,{language:r,busy:i,statement:n.content,onEdit:u,onDelete:p})]})]})}),t[5]=i,t[6]=y,t[7]=_,t[8]=c,t[9]=s,t[10]=a,t[11]=n.content,t[12]=n.scope,t[13]=r,t[14]=d,t[15]=p,t[16]=l,t[17]=u,t[18]=f,t[19]=o,t[20]=m,t[21]=b):b=t[21],b}function At(){let e=y(e=>e.language),t=at[e],n=ne(e=>e.setPageHeader),r=ne(e=>e.clearPageHeader),[a,s]=i(),{data:c,error:l,isLoading:u,isValidating:d,mutate:f}=D(`/api/user-model`,Se),v=it(a),[b,x]=(0,X.useState)(),[ee,S]=(0,X.useState)(),[C,w]=(0,X.useState)(``),[T,E]=(0,X.useState)(),[A,M]=(0,X.useState)(``),[P,L]=(0,X.useState)(``),[R,z]=(0,X.useState)(24),[B,H]=(0,X.useState)(),[W,J]=(0,X.useState)(!1),[fe,he]=(0,X.useState)(!1),[ve,xe]=(0,X.useState)(`all`),[Ce,we]=(0,X.useState)(`all`),[Ee,Z]=(0,X.useState)(`idle`),De=(0,X.useRef)(void 0),Oe=e=>{e!==v&&s(t=>{let n=new URLSearchParams(t);return e===`overview`?n.delete(`tab`):n.set(`tab`,e),n})},ke=(0,X.useCallback)(async()=>{if(!(Ee===`refreshing`||d)){De.current&&window.clearTimeout(De.current),Z(`refreshing`),S(void 0),w(t.refreshing);try{await f(),Z(`success`),w(t.refreshComplete)}catch{Z(`error`),w(``),S(t.refreshFailed)}finally{De.current=window.setTimeout(()=>Z(`idle`),1600)}}},[d,f,Ee,t]);(0,X.useEffect)(()=>()=>{De.current&&window.clearTimeout(De.current)},[]);let Ae=d||Ee===`refreshing`,je=Ae?t.refreshing:Ee===`success`?t.refreshComplete:Ee===`error`?t.refreshFailed:t.refresh;(0,X.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.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(rt,{}),(0,Q.jsx)(O,{variant:`secondary`,className:`size-9 p-0 ${Ee===`success`?`text-success`:Ee===`error`?`text-danger`:``}`,disabled:Ae,"aria-label":je,title:je,onClick:()=>void ke(),children:Ae?(0,Q.jsx)(p,{className:`size-4 animate-spin motion-reduce:animate-none`,"aria-hidden":`true`}):Ee===`success`?(0,Q.jsx)(o,{className:`size-4`,"aria-hidden":`true`}):Ee===`error`?(0,Q.jsx)(U,{className:`size-4`,"aria-hidden":`true`}):(0,Q.jsx)(I,{className:`size-4`,"aria-hidden":`true`})})]})}),r),[r,Ae,Ee,je,ke,n,t]);let Me=async(n,r)=>{x(n),S(void 0),w(``);try{await r(),await f(),w(e===`zh`?`已更新`:`Updated`)}catch{S(t.actionFailed)}finally{x(void 0)}},Ne=e=>{Me(e.id,async()=>{await de(e.id,A.trim()),E(void 0),M(``)})},Pe=async e=>{x(`profile`),S(void 0),w(``);try{await pe(e),await f(),J(!1)}catch{S(t.actionFailed)}finally{x(void 0)}},Ie=async(n,r)=>{x(`priority:${n.id}`),S(void 0),w(``);try{await ge(n.id,r),await f(),he(!1),w(e===`zh`?`当前关注已更新`:`Current focus updated`)}catch{S(t.actionFailed)}finally{x(void 0)}},Le=async n=>{x(`priority:create`),S(void 0),w(``);try{await re(n),await f(),he(!1),w(e===`zh`?`当前关注已设置`:`Current focus set`)}catch{S(t.actionFailed)}finally{x(void 0)}},Re=async n=>{x(`priority:${n.id}`),S(void 0),w(``);try{await ge(n.id,{status:`completed`}),await f(),he(!1),w(e===`zh`?`当前关注已结束`:`Current focus ended`)}catch{S(t.actionFailed)}finally{x(void 0)}};if(u)return(0,Q.jsxs)(`div`,{className:`mx-auto w-full max-w-7xl space-y-5 px-4 py-7 sm:px-6 lg:px-8 lg:py-9`,children:[(0,Q.jsx)(k,{className:`h-10 w-72 rounded-xl`}),(0,Q.jsx)(k,{className:`h-72 rounded-xl`}),(0,Q.jsxs)(`div`,{className:`grid gap-5 lg:grid-cols-2`,children:[(0,Q.jsx)(k,{className:`h-80 rounded-xl`}),(0,Q.jsx)(k,{className:`h-80 rounded-xl`})]})]});if(l||!c)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)(q,{className:`size-6 text-fg-subtle`}),(0,Q.jsx)(`p`,{className:`text-sm text-danger`,children:t.loadFailed}),(0,Q.jsx)(O,{onClick:()=>void f(),children:t.tryAgain})]});let ze=c.assertions.filter(e=>e.usable&&e.scope.type===`global`&&!ot.has(e.predicate)).sort((e,t)=>{let n=e.declaredImportance??e.inferredImportance;return(t.declaredImportance??t.inferredImportance)-n||t.recordedAt-e.recordedAt}),Ve=mt(c),He=Ve.callName||(e===`zh`?`你`:`You`),Ue=ze.filter(e=>e.authority===`user_explicit`).length,We=ze.length-Ue,Ge=ze.filter(e=>ve===`explicit`?e.authority===`user_explicit`:ve===`learned`?e.authority!==`user_explicit`:!0),Ke=c.priorities.filter(e=>e.status===`active`&&e.validTo>Date.now()),$=Ke.find(e=>e.rank===`primary`)??Ke[0],qe=St($,c.goals,e),Je=$?.targetType===`goal`?c.goals.find(e=>e.id===$.targetId):void 0,Ye=c.goals.filter(e=>e.status===`active`||e.status===`paused`).filter(e=>$?.targetType!==`goal`||e.id!==$.targetId),Xe=c.rules.filter(e=>e.status!==`archived`),Ze=c.ruleSuggestions??[],Qe=[...ze].sort((e,t)=>t.recordedAt-e.recordedAt),$e=c.knowledge.filter(e=>e.status!==`archived`&&e.status!==`rejected`),et=P.trim().toLocaleLowerCase(),tt=$e.filter(e=>Ce===`all`||e.kind===Ce),nt=tt.filter(t=>!et||t.content.toLocaleLowerCase().includes(et)||xt(t.kind,e).toLocaleLowerCase().includes(et)),ct=[{key:`identity`,title:t.identity,icon:ye,items:Ge.filter(e=>e.kind===`identity`)},{key:`preferences`,title:t.preferences,icon:ue,items:Ge.filter(e=>[`preference`,`value`,`routine`,`capability`].includes(e.kind))},{key:`relationships`,title:t.relationships,icon:Y,items:Ge.filter(e=>e.kind===`relationship`)},{key:`current`,title:t.currentState,icon:K,items:Ge.filter(e=>e.kind===`current_state`)},{key:`insights`,title:t.insights,icon:V,items:Ge.filter(e=>e.kind===`derived_insight`)}].filter(e=>e.items.length>0),lt=st.map(e=>({kind:e,count:$e.filter(t=>t.kind===e).length})).filter(e=>e.count>0),ut=lt.slice(0,4),dt=ut.length===1?`grid-cols-1`:ut.length===2?`sm:grid-cols-2`:ut.length===3?`sm:grid-cols-3`:`sm:grid-cols-2 lg:grid-cols-4`,pt=nt.slice(0,R),vt=st.map(e=>({kind:e,items:pt.filter(t=>t.kind===e),totalCount:nt.filter(t=>t.kind===e).length})).filter(e=>e.items.length>0),yt=[{id:`all`,label:t.allUnderstanding,count:ze.length},{id:`explicit`,label:t.explicit,count:Ue},{id:`learned`,label:t.learned,count:We}],bt=e=>{xe(e),Oe(`understanding`)},At=e=>{we(e),L(``),z(24),Oe(`knowledge`)},jt=t=>(0,Q.jsx)(Be,{item:t,language:e,busy:!!b,editing:T===t.id,draft:T===t.id?A:``,onDraftChange:M,onEdit:()=>{E(t.id),M(t.statement)},onCancel:()=>{E(void 0),M(``)},onDelete:()=>void Me(t.id,()=>be(t.id)),onCorrect:()=>Ne(t)},t.id),Mt=c.maintenance.lastRun?ft(c.maintenance.lastRun.finishedAt??c.maintenance.lastRun.startedAt,e,!0):null,Nt=c.maintenance.lastRun?c.maintenance.lastRun.status===`completed`?`${t.maintenanceComplete} ${Mt}`:t.maintenanceFailed:t.maintenanceReady;return(0,Q.jsxs)(`div`,{className:`mx-auto w-full max-w-6xl space-y-8 px-4 py-7 sm:px-6 lg:px-8 lg:py-10`,children:[(0,Q.jsx)(Te,{items:[{id:`overview`,label:t.overview,icon:V},{id:`understanding`,label:t.understanding,icon:ye,count:ze.length},{id:`knowledge`,label:t.knowledge,icon:_e,count:$e.length}],activeTab:v,onChange:Oe,ariaLabel:t.pageTitle,tabIdPrefix:`understanding-tab`,panelIdPrefix:`understanding-panel`,className:`w-fit max-w-full gap-1 rounded-full bg-surface-panel p-1 shadow-surface`,buttonClassName:`rounded-full px-3.5 py-2`,selectedClassName:`bg-surface-active text-fg`,unselectedClassName:`text-fg-muted hover:bg-surface-hover hover:text-fg`}),(0,Q.jsx)(`p`,{role:`status`,className:`sr-only`,children:C}),ee?(0,Q.jsxs)(`div`,{role:`alert`,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:ee}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>S(void 0),"aria-label":t.cancel,children:(0,Q.jsx)(_,{className:`size-4`})})]}):null,v===`overview`?(0,Q.jsxs)(`div`,{id:`understanding-panel-overview`,role:`tabpanel`,"aria-labelledby":`understanding-tab-overview`,className:`space-y-10`,children:[(0,Q.jsxs)(`section`,{"data-testid":`overview-hero`,className:`grid gap-8 lg:grid-cols-[minmax(0,1fr)_minmax(20rem,24rem)] lg:gap-12`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 px-1 py-2`,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)(V,{className:`size-3.5`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{children:t.portraitEyebrow})]}),(0,Q.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center gap-5`,children:[(0,Q.jsx)(`div`,{className:`flex size-20 shrink-0 items-center justify-center rounded-[1.4rem] bg-surface-active text-xl font-semibold text-fg`,children:gt(He)}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`h2`,{className:`truncate text-3xl font-semibold tracking-tight text-fg`,children:He}),(0,Q.jsx)(`p`,{className:`mt-1 break-words text-sm text-fg-muted`,children:Ve.role||t.notProvided})]}),(0,Q.jsxs)(O,{variant:`ghost`,className:`shrink-0`,onClick:()=>J(!0),children:[(0,Q.jsx)(ie,{className:`size-4`,"aria-hidden":`true`}),t.editProfile]})]}),(0,Q.jsx)(`p`,{className:`mt-5 max-w-2xl text-sm leading-6 text-fg-muted`,children:t.portraitIntro}),(0,Q.jsx)(`dl`,{className:`mt-7 grid gap-x-8 gap-y-5 sm:grid-cols-3`,children:[{icon:N,label:t.locale,value:Ve.locale?ht(Ve.locale,e):t.notProvided},{icon:te,label:t.timezone,value:Ve.timezone||t.notProvided},{icon:ye,label:t.pronouns,value:Ve.pronouns||t.notProvided}].map(({icon:e,label:t,value:n})=>(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`dt`,{className:`flex items-center gap-1.5 text-xs text-fg-subtle`,children:[(0,Q.jsx)(e,{className:`size-3.5`,"aria-hidden":`true`}),t]}),(0,Q.jsx)(`dd`,{className:`mt-1.5 truncate text-sm font-medium text-fg`,children:n})]},t))})]}),(0,Q.jsxs)(`aside`,{"data-testid":`priority-panel`,className:`flex min-h-64 flex-col rounded-[1.4rem] bg-surface-panel p-6 shadow-surface`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-xs font-semibold tracking-wide text-fg-subtle`,children:t.importantNow}),$?(0,Q.jsxs)(`p`,{className:`mt-1.5 flex items-center gap-1.5 text-xs text-fg-muted`,children:[(0,Q.jsx)(j,{className:`size-3.5`,"aria-hidden":`true`}),$.targetType===`goal`?t.prioritySourceGoal:t.prioritySourceWork]}):null]}),$&&qe?(0,Q.jsxs)(O,{variant:`ghost`,className:`h-8 shrink-0 px-2.5`,onClick:()=>he(!0),children:[(0,Q.jsx)(m,{className:`size-3.5`,"aria-hidden":`true`}),t.editPriority]}):null]}),qe?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`mt-3 text-lg font-semibold leading-7 tracking-tight text-fg`,children:qe}),Je?.desiredOutcome?(0,Q.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:Je.desiredOutcome}):null,$?(0,Q.jsxs)(`p`,{className:`mt-auto flex items-center gap-1.5 pt-4 text-xs text-fg-subtle`,children:[(0,Q.jsx)(G,{className:`size-3.5`,"aria-hidden":`true`}),_t($.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)(j,{className:`size-5 text-fg-subtle`}),(0,Q.jsx)(`span`,{children:t.noPriority}),(0,Q.jsxs)(O,{variant:`primary`,className:`mt-2`,onClick:()=>he(!0),children:[(0,Q.jsx)(h,{className:`size-4`,"aria-hidden":`true`}),t.addPriority]})]}),Ye.length?(0,Q.jsxs)(`div`,{className:`mt-5 border-t border-edge-subtle 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:Ye.slice(0,3).map(e=>(0,Q.jsx)(`p`,{className:`text-sm text-fg`,children:e.title},e.id))})]}):null]})]}),(0,Q.jsx)(`section`,{"aria-label":t.understanding,className:`grid gap-2 sm:grid-cols-2`,children:[{filter:`explicit`,icon:le,label:t.explicit,hint:t.explicitHint,count:Ue},{filter:`learned`,icon:q,label:t.learned,hint:t.learnedHint,count:We}].map(({filter:e,icon:t,label:n,hint:r,count:i})=>(0,Q.jsxs)(`button`,{type:`button`,className:`group flex min-h-24 w-full cursor-pointer items-start gap-3 rounded-2xl px-4 py-4 text-left transition-colors hover:bg-surface-panel focus-visible:z-10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent sm:px-5`,onClick:()=>bt(e),"aria-label":`${n}: ${i}`,children:[(0,Q.jsx)(t,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle`,"aria-hidden":`true`}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,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:i}),n]}),(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:r})]}),(0,Q.jsx)(F,{className:`mt-1 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5 group-hover:text-fg-muted motion-reduce:transform-none`,"aria-hidden":`true`})]},n))}),(0,Q.jsxs)(`div`,{className:`grid items-start gap-10 lg:grid-cols-2 lg:gap-8`,children:[(0,Q.jsx)(Ct,{title:t.recent,hint:t.recentHint,action:(0,Q.jsx)(O,{variant:`ghost`,className:`h-8 shrink-0`,onClick:()=>Oe(`understanding`),children:t.seeAll}),children:Qe.length?(0,Q.jsx)(`div`,{children:Fe(Qe.slice(0,3),e).map(({label:e,items:t})=>(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h3`,{className:`px-5 pb-1 pt-4 text-xs font-medium text-fg-muted`,children:e}),(0,Q.jsx)(`div`,{children:t.map(jt)})]},e))}):(0,Q.jsx)(wt,{icon:(0,Q.jsx)(q,{className:`size-5`}),children:t.emptyGroup})}),(0,Q.jsx)(Ct,{title:t.howWeWork,hint:t.howWeWorkHint,children:Xe.length||Ze.length?(0,Q.jsxs)(Q.Fragment,{children:[Xe.slice(0,3).map(t=>(0,Q.jsx)(Dt,{rule:t,language:e,busy:b===t.id,onToggle:()=>void Me(t.id,()=>se(t.id,t.status===`active`?`disabled`:`active`))},t.id)),Ze.slice(0,2).map(t=>(0,Q.jsx)(Ot,{suggestion:t,language:e,busy:b===t.id,onConfirm:()=>void Me(t.id,()=>me(t))},t.id))]}):(0,Q.jsx)(wt,{icon:(0,Q.jsx)(Y,{className:`size-5`}),children:t.noRules})})]}),(0,Q.jsx)(Ct,{title:t.workMemory,hint:t.workMemoryHint,action:(0,Q.jsx)(O,{variant:`ghost`,className:`h-8 shrink-0`,onClick:()=>Oe(`knowledge`),children:t.seeAll}),children:lt.length?(0,Q.jsx)(`div`,{"data-testid":`memory-summary-grid`,className:`grid gap-3 bg-surface-base ${dt}`,children:ut.map(({kind:t,count:n})=>(0,Q.jsxs)(`button`,{type:`button`,className:`group flex min-h-28 cursor-pointer items-start justify-between rounded-2xl bg-surface-panel px-5 py-5 text-left transition-colors hover:bg-surface-hover focus-visible:z-10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>At(t),"aria-label":`${xt(t,e)}: ${n}`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(`span`,{className:`block text-2xl font-semibold tabular-nums text-fg`,children:n}),(0,Q.jsx)(`span`,{className:`mt-1 block text-sm text-fg-muted`,children:xt(t,e)})]}),(0,Q.jsx)(F,{className:`mt-1 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5 group-hover:text-fg-muted motion-reduce:transform-none`,"aria-hidden":`true`})]},t))}):(0,Q.jsx)(wt,{icon:(0,Q.jsx)(ce,{className:`size-5`}),children:t.noKnowledge})}),(0,Q.jsx)(`footer`,{className:`flex items-center 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)(I,{className:`size-3.5`,"aria-hidden":`true`}),Nt]})})]}):null,v===`understanding`?(0,Q.jsxs)(`div`,{id:`understanding-panel-understanding`,role:`tabpanel`,"aria-labelledby":`understanding-tab-understanding`,className:`space-y-10`,children:[(0,Q.jsxs)(`div`,{className:`px-1 pt-1`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsx)(q,{className:`mt-0.5 size-5 shrink-0 text-accent-fg`,"aria-hidden":`true`}),(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})]})]}),(0,Q.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,role:`group`,"aria-label":t.understandingFilterHint,children:yt.map(e=>(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":ve===e.id,className:`touch-target inline-flex min-h-9 cursor-pointer items-center gap-1.5 rounded-full px-3 py-1.5 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${ve===e.id?`bg-surface-active text-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`}`,onClick:()=>xe(e.id),children:[e.label,(0,Q.jsx)(`span`,{className:`tabular-nums text-fg-subtle`,children:e.count})]},e.id))})]}),ct.length?ct.map(({key:e,title:t,icon:n,items:r})=>(0,Q.jsx)(Ct,{title:t,action:(0,Q.jsx)(n,{className:`size-4 text-fg-subtle`,"aria-hidden":`true`}),children:(0,Q.jsx)(`div`,{children:r.map(jt)})},e)):(0,Q.jsx)(`div`,{className:`rounded-2xl bg-surface-panel`,children:(0,Q.jsx)(wt,{icon:(0,Q.jsx)(q,{className:`size-5`}),children:t.emptyGroup})})]}):null,v===`knowledge`?(0,Q.jsxs)(`div`,{id:`understanding-panel-knowledge`,role:`tabpanel`,"aria-labelledby":`understanding-tab-knowledge`,className:`space-y-8`,children:[(0,Q.jsxs)(`div`,{className:`px-1 pt-1`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 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:Ce===`all`?t.allMemory:xt(Ce,e)}),(0,Q.jsxs)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:[tt.length,` `,t.items,` · `,t.memoryLibraryHint]})]}),(0,Q.jsxs)(`label`,{className:`relative block sm:w-80`,children:[(0,Q.jsx)(g,{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:P,onChange:e=>{L(e.target.value),z(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`})]})]}),(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,role:`group`,"aria-label":t.memoryFilterHint,children:[(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":Ce===`all`,className:`touch-target inline-flex min-h-9 cursor-pointer items-center gap-1.5 rounded-full px-3 py-1.5 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${Ce===`all`?`bg-surface-active text-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`}`,onClick:()=>we(`all`),children:[t.allMemory,(0,Q.jsx)(`span`,{className:`tabular-nums text-fg-subtle`,children:$e.length})]}),lt.map(({kind:t,count:n})=>(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":Ce===t,className:`touch-target inline-flex min-h-9 cursor-pointer items-center gap-1.5 rounded-full px-3 py-1.5 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${Ce===t?`bg-surface-active text-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`}`,onClick:()=>we(t),children:[xt(t,e),(0,Q.jsx)(`span`,{className:`tabular-nums text-fg-subtle`,children:n})]},t))]})]}),nt.length?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`space-y-8`,children:vt.map(({kind:t,items:n,totalCount:r})=>(0,Q.jsxs)(`section`,{className:`overflow-hidden rounded-2xl bg-surface-panel`,children:[(0,Q.jsxs)(`header`,{className:`flex items-center justify-between px-5 pb-1 pt-4 sm:px-6`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:xt(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)(kt,{item:t,language:e,busy:!!b,expanded:B===t.id,onToggle:()=>H(e=>e===t.id?void 0:t.id),editing:T===`knowledge:${t.id}`,draft:A,onDraftChange:M,onEdit:()=>{E(`knowledge:${t.id}`),M(t.content)},onCancel:()=>{E(void 0),M(``)},onDelete:()=>void Me(t.id,()=>ae(t.id)),onReview:(e,n)=>void Me(t.id,async()=>{await oe(t,e,n),E(void 0),M(``)})},t.id))})]},t))}),nt.length>R?(0,Q.jsx)(`div`,{className:`flex justify-center pt-2`,children:(0,Q.jsx)(O,{onClick:()=>z(e=>e+24),children:t.showMore})}):null]}):(0,Q.jsx)(`div`,{className:`rounded-2xl bg-surface-panel`,children:(0,Q.jsx)(wt,{icon:(0,Q.jsx)(g,{className:`size-5`}),children:P.trim()?t.noKnowledgeMatch:t.noKnowledge})})]}):null,(0,Q.jsx)(Tt,{open:W,profile:Ve,language:e,saving:b===`profile`,onOpenChange:J,onSave:e=>void Pe(e)}),(0,Q.jsx)(Et,{open:fe,priority:$,title:qe??``,outcome:Je?.desiredOutcome,language:e,saving:b===($?`priority:${$.id}`:`priority:create`),onOpenChange:he,onSave:e=>$?void Ie($,e):void Le(e),onEnd:$?()=>void Re($):void 0})]})}export{At 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{Do as i}from"./index-BkSp_1Il.js";import{u as a}from"./voice-config-api-LKFent6f.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{Do as i}from"./index-D3OtdgCs.js";import{u as a}from"./voice-config-api-LKFent6f.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{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{t as a}from"./messages-DsUnS7rn.js";import{n as o}from"./locale-store-7F4l6DRV.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-CS04eWY9.js";import{No as m,Y as h,rt as g}from"./index-BkSp_1Il.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=o(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=a(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-xl 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{t as a}from"./messages-DsUnS7rn.js";import{n as o}from"./locale-store-7F4l6DRV.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-CS04eWY9.js";import{No as m,Y as h,rt as g}from"./index-D3OtdgCs.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=o(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=a(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-xl 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-0p9PIHRy.js";import{t as o}from"./eye-CABVeTq0.js";import{t as s}from"./markdown-view-bxpOryax.js";import{t as c}from"./x-B_N4OPjy.js";import{t as l}from"./messages-DsUnS7rn.js";import{t as u}from"./cn-JdwAhgNB.js";import{i as d,r as f}from"./locale-store-7F4l6DRV.js";import{a as p,n as m,o as h,r as g,s as _,t as v}from"./dist-BGTk37IG.js";import{t as y}from"./button-CS04eWY9.js";import{Ac as b,Ec as x,Hc as S,Hr as C,Lr as w,Lu as T,Nl as E,Oc as D,Zr as O,oc as k,oi as A,si as j,vc as M}from"./index-BkSp_1Il.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-0p9PIHRy.js";import{t as o}from"./eye-CABVeTq0.js";import{t as s}from"./markdown-view-bxpOryax.js";import{t as c}from"./x-B_N4OPjy.js";import{t as l}from"./messages-DsUnS7rn.js";import{t as u}from"./cn-JdwAhgNB.js";import{i as d,r as f}from"./locale-store-7F4l6DRV.js";import{a as p,n as m,o as h,r as g,s as _,t as v}from"./dist-BGTk37IG.js";import{t as y}from"./button-CS04eWY9.js";import{Ac as b,Ec as x,Hc as S,Hr as C,Lr as w,Lu as T,Nl as E,Oc as D,Zr as O,oc as k,oi as A,si as j,vc as M}from"./index-D3OtdgCs.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
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 d(f(`/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:d,intent:f,locale:b,context:C,disabled:w,className:E,showLabel:O}=e,k=l===void 0?`generic.text`:l,A=d===void 0?`plain`:d,j=f===void 0?`improve`:f,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]===b?me=t[1]:(me=ne(b),t[0]=b,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]!==C||t[24]!==i||t[25]!==a||t[26]!==A||t[27]!==fe||t[28]!==j||t[29]!==b||t[30]!==k?(Ee=async e=>{ae(`edit`),K(!0),ue.current=!0,await fe({intent:j,scenario:k,input:e,locale:b,field:{id:i,label:a,format:A},context:C})},t[23]=C,t[24]=i,t[25]=a,t[26]=A,t[27]=fe,t[28]=j,t[29]=b,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]!==E||t[63]!==We?(Ge=u(`h-7 gap-1 px-2 text-xs`,We,E),t[62]=E,t[63]=We,t[64]=Ge):Ge=t[64];let Ke=w||Y,qe;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(qe=(0,z.jsx)(D,{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)(y,{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=u(`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)(p,{className:$e}),t[76]=$e,t[77]=et);let tt;t[78]===Z.title?tt=t[79]:(tt=(0,z.jsx)(_,{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)(c,{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)(m,{asChild:!0,children:(0,z.jsx)(y,{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=u(`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)(x,{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=u(`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)(o,{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-inset 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)(s,{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=u(`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)(x,{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=u(`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)(o,{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-inset 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=u(`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=u(`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-inset/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=u(`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)(s,{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)(y,{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)(y,{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)(S,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}):(0,z.jsx)(D,{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)(y,{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)(y,{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)(y,{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)(g,{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-overlay 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)(h,{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)(v,{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:w(t.argValues)}function ae(e,t,n){let r=l(t).workflows;if(!e)return r.noInputSummary;let i=j(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:(O[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=O[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:c,showGoal:d,inputClassName:f,aiAssist:p}=e,m;t[0]===c?m=t[1]:(m=c===void 0?[]:c,t[0]=c,t[1]=m);let h=m,g=d===void 0?!0:d,_,v,y,b,x,S,C;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=l(r).workflows;let e=O[n]??[];v=e.length>0;let c=u(`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),d;t[19]!==i||t[20]!==a||t[21]!==s?(d=e=>{A(e,s,e=>{a(e(i))})},t[19]=i,t[20]=a,t[21]=s,t[22]=d):d=t[22],_=d,b=`flex flex-col gap-3`,x=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:u(c,`min-h-20 resize-y`)}):(0,z.jsx)(`input`,{value:s,onChange:t=>a({...i,[e.key]:t.target.value}),placeholder:o,className:c})]},e.key)}),S=v&&h.length>0?(0,z.jsx)(se,{examples:h,labels:y,onSelect:_}):null,C=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:u(c,`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]=x,t[17]=S,t[18]=C}else _=t[12],v=t[13],y=t[14],b=t[15],x=t[16],S=t[17],C=t[18];let w;t[23]!==_||t[24]!==h||t[25]!==v||t[26]!==y?(w=!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]=w):w=t[27];let T;return t[28]!==b||t[29]!==x||t[30]!==S||t[31]!==C||t[32]!==w?(T=(0,z.jsxs)(`div`,{className:b,children:[x,S,C,w]}),t[28]=b,t[29]=x,t[30]=S,t[31]=C,t[32]=w,t[33]=T):T=t[33],T}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,c]=(0,N.useState)(!1),[l,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;c(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:l,onChange:e=>h(e.target.value),spellCheck:!1,className:u(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:c,onChange:l}=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]!==c||t[7]!==n.key||t[8]!==n.schema||t[9]!==l||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:l,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:c},disabled:s.disabled,showLabel:!1}):null,t[5]=s,t[6]=c,t[7]=n.key,t[8]=n.schema,t[9]=l,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]!==l||t[23]!==p||t[24]!==r?(C=h.length>0?(0,z.jsxs)(i,{value:r==null?``:String(r),onChange:e=>l(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=>l(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=>l(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=>l(e.target.value),className:u(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]=l,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:c}=e,d;t[0]===r?d=t[1]:(d=l(r),t[0]=r,t[1]=d);let f=d.workflows,p;t[2]!==n||t[3]!==r?(p=j(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,C,w,T,E,D,O,k,A;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]!==c||t[19]!==h||t[20]!==i){T=Symbol.for(`react.early_return_sentinel`);bb0:{let e=u(`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),l;t[31]!==n||t[32]!==a||t[33]!==c||t[34]!==h?(l=(e,t)=>{let r=t===void 0?h:t;a(e),c?.(G(n,e,r))},t[31]=n,t[32]=a,t[33]=c,t[34]=h,t[35]=l):l=t[35];let d=l,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 j=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]!==j||t[47]!==i.schemaInput?(P=e=>{if(e.field===`goal`){_(e.text);return}j({...i.schemaInput,[e.field]:e.text})},t[45]=_,t[46]=j,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],T=a;break bb0}C=`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]!==c||t[75]!==j||t[76]!==i?(w=n.inputSchema?(0,z.jsx)(le,{schema:n.inputSchema,value:i.schemaInput,onChange:j,onValidChange:(e,t)=>{g(e),c?.(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]=c,t[75]=j,t[76]=i,t[77]=w):w=t[77],A=`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],E=i.goal,t[94]===_?D=t[95]:(D=e=>_(e.target.value),t[94]=_,t[95]=D),O=f.goalPlaceholder,k=u(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]=c,t[19]=h,t[20]=i,t[21]=x,t[22]=S,t[23]=C,t[24]=w,t[25]=T,t[26]=E,t[27]=D,t[28]=O,t[29]=k,t[30]=A}else x=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];if(T!==Symbol.for(`react.early_return_sentinel`))return T;let M;t[96]!==E||t[97]!==D||t[98]!==O||t[99]!==k?(M=(0,z.jsx)(`textarea`,{value:E,onChange:D,placeholder:O,className:k}),t[96]=E,t[97]=D,t[98]=O,t[99]=k,t[100]=M):M=t[100];let F;t[101]!==S||t[102]!==M||t[103]!==A?(F=(0,z.jsxs)(`div`,{className:A,children:[S,M]}),t[101]=S,t[102]=M,t[103]=A,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]!==C||t[110]!==w||t[111]!==F||t[112]!==I?(L=(0,z.jsxs)(`div`,{className:C,children:[w,F,I]}),t[109]=C,t[110]=w,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?C(t.agentScaleExact,{count:n.min}):C(t.agentScaleRange,{min:n.min,max:n.max}):C(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:c,inputClassName:d,showTimeout:f,defaultAdvancedOpen:p,onValidityChange:m}=e,h=f===void 0?!1:f,g=p===void 0?!1:p,_=l(r).workflows,[v,y]=(0,N.useState)(g),x;t[0]!==n||t[1]!==r?(x=j(n,r),t[0]=n,t[1]=r,t[2]=x):x=t[2];let S=x,w;t[3]!==n.defaults||t[4]!==i.concurrency?(w=i.concurrency.trim()?Number(i.concurrency):n.defaults.concurrency,t[3]=n.defaults,t[4]=i.concurrency,t[5]=w):w=t[5];let D=w,O;t[6]!==n.defaults||t[7]!==i.maxSubagents?(O=i.maxSubagents.trim()?Number(i.maxSubagents):n.defaults.maxSubagents,t[6]=n.defaults,t[7]=i.maxSubagents,t[8]=O):O=t[8];let A=O,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=u(`space-y-4`,te),t[16]=te,t[17]=ne);let B=I||S.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)(E,{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)(k,{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)(b,{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]!==c||t[29]!==n||t[30]!==d||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:c,inputClassName:d}),t[28]=c,t[29]=n,t[30]=d,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=u(`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:C(_.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:C(_.runLimitsSummary,{concurrency:D,max:A})})]})]}),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)(M,{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:C(_.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:C(_.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:C(_.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};