@xopcai/xopc 0.0.475 → 0.0.476

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 (136) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/server/chunks.bin +916 -865
  4. package/dist/gateway/server/chunks.json +1 -1
  5. package/dist/gateway/server/schema.sql +13 -0
  6. package/dist/gateway/server/upgrades/281_session_agent_reactions.sql +13 -0
  7. package/dist/gateway/static/root/assets/{apps-page-BknrhGJ9.js → apps-page-B9Ho8S53.js} +1 -1
  8. package/dist/gateway/static/root/assets/{automations-page-C1s0jwt9.js → automations-page-BL6ASYrU.js} +1 -1
  9. package/dist/gateway/static/root/assets/{automations-workspace-DIwYmYb1.js → automations-workspace-BFk-AF43.js} +2 -2
  10. package/dist/gateway/static/root/assets/{capabilities-page-2vSlbM-C.js → capabilities-page-D9EpUcuB.js} +2 -2
  11. package/dist/gateway/static/root/assets/{capabilities-settings-panel-CfEq0ob4.js → capabilities-settings-panel-ComYXaP1.js} +1 -1
  12. package/dist/gateway/static/root/assets/{channels-Bi0L3VP1.js → channels-Aa2Iun4r.js} +1 -1
  13. package/dist/gateway/static/root/assets/chat-page-BbahuZ59.js +72 -0
  14. package/dist/gateway/static/root/assets/{chat-terminal-dock-CYAZic7B.js → chat-terminal-dock-BALrP7_l.js} +1 -1
  15. package/dist/gateway/static/root/assets/{connectors-page-Bn6Z5xfy.js → connectors-page-BUqNvStL.js} +1 -1
  16. package/dist/gateway/static/root/assets/{extension-debug-page-CNrjzlYX.js → extension-debug-page-gW4GEEcj.js} +1 -1
  17. package/dist/gateway/static/root/assets/{extension-iframe-host-DnautIj8.js → extension-iframe-host-DOPywUKI.js} +1 -1
  18. package/dist/gateway/static/root/assets/{extension-message-router-D81YD6lm.js → extension-message-router-TTAx3dPv.js} +1 -1
  19. package/dist/gateway/static/root/assets/{extension-page-BEY_ML_j.js → extension-page-Iq7vFC-g.js} +1 -1
  20. package/dist/gateway/static/root/assets/{extension-provider-CrMilva_.js → extension-provider-BNnLkq95.js} +1 -1
  21. package/dist/gateway/static/root/assets/{extension-settings-page-QRbfKUay.js → extension-settings-page-C0oLjaz6.js} +1 -1
  22. package/dist/gateway/static/root/assets/{home-page-Cs1kOdTH.js → home-page-pT-lEQsu.js} +3 -3
  23. package/dist/gateway/static/root/assets/index-BtHMU5k4.css +1 -0
  24. package/dist/gateway/static/root/assets/{index-D0R_YIRE.js → index-DdEh8KeB.js} +5 -5
  25. package/dist/gateway/static/root/assets/{local-app-workbench-page-DLGY-zR3.js → local-app-workbench-page-ReBczGac.js} +1 -1
  26. package/dist/gateway/static/root/assets/{note-detail-panel-BS7pKIMu.js → note-detail-panel-DAhIT6xP.js} +3 -3
  27. package/dist/gateway/static/root/assets/{notes-page-DBz5y6aX.js → notes-page-zAJJ2OiQ.js} +1 -1
  28. package/dist/gateway/static/root/assets/{page-context-capture-button-Dtvz4KwD.js → page-context-capture-button-Bd__UBi9.js} +1 -1
  29. package/dist/gateway/static/root/assets/{personal-page-DpmhcQoZ.js → personal-page-DHik8uj6.js} +1 -1
  30. package/dist/gateway/static/root/assets/{personal-profile-settings-KGDtrQK7.js → personal-profile-settings-Cd2xUVbw.js} +1 -1
  31. package/dist/gateway/static/root/assets/{personal-settings-panel-DBlUrnCy.js → personal-settings-panel-CHRra9hc.js} +1 -1
  32. package/dist/gateway/static/root/assets/{preview-runtime-BWkErYI2.js → preview-runtime-MJUo7XlD.js} +1 -1
  33. package/dist/gateway/static/root/assets/{project-detail-page-D6Y3kdtF.js → project-detail-page-BBF8eVJa.js} +1 -1
  34. package/dist/gateway/static/root/assets/{route-preload-CvsNMwNp.js → route-preload-Bl10PwKS.js} +2 -2
  35. package/dist/gateway/static/root/assets/{routine-panel-Cudq6VgR.js → routine-panel-BjqenuXU.js} +2 -2
  36. package/dist/gateway/static/root/assets/{session-manager-CJvUtul5.js → session-manager-fvJusKsK.js} +1 -1
  37. package/dist/gateway/static/root/assets/{settings-page-DEU9sOgT.js → settings-page-B_8kxJQW.js} +1 -1
  38. package/dist/gateway/static/root/assets/{share-preview-page-BRQ6t9CI.js → share-preview-page-C49EIXte.js} +1 -1
  39. package/dist/gateway/static/root/assets/{shares-settings-CQSN1jLt.js → shares-settings-C_ITdQqP.js} +1 -1
  40. package/dist/gateway/static/root/assets/{space-page-Cjp2j2Xx.js → space-page-DmvjU1jc.js} +1 -1
  41. package/dist/gateway/static/root/assets/{task-detail-page-CH7jSUWA.js → task-detail-page-DHYm_bsg.js} +1 -1
  42. package/dist/gateway/static/root/assets/{task-header-title-DemBzQyz.js → task-header-title-Buwr7WTV.js} +1 -1
  43. package/dist/gateway/static/root/assets/{task-result-evidence-ZKcxDYVE.js → task-result-evidence-DpV1mZJA.js} +1 -1
  44. package/dist/gateway/static/root/assets/{use-composer-attachments-O2une3Cn.js → use-composer-attachments-4FKbf6PB.js} +1 -1
  45. package/dist/gateway/static/root/assets/{use-file-preview-expanded-6TirYKSr.js → use-file-preview-expanded-CRBn6UTd.js} +1 -1
  46. package/dist/gateway/static/root/assets/{use-personal-work-CaO6D7sJ.js → use-personal-work-srLCZOam.js} +1 -1
  47. package/dist/gateway/static/root/assets/{use-realtime-voice-D3hr1-yf.js → use-realtime-voice-tyo85cre.js} +1 -1
  48. package/dist/gateway/static/root/assets/{use-workspace-tree-D6IwkuTh.js → use-workspace-tree-VwHdfiR8.js} +1 -1
  49. package/dist/gateway/static/root/assets/{voice-settings-BgdC-Ae5.js → voice-settings-DOajN2ay.js} +1 -1
  50. package/dist/gateway/static/root/assets/{workspace-api-DdVYTEEV.js → workspace-api-CIfedJeG.js} +2 -2
  51. package/dist/gateway/static/root/assets/{workspace-file-preview-dialog-BTLLCHMI.js → workspace-file-preview-dialog-Xi5feqPq.js} +1 -1
  52. package/dist/gateway/static/root/index.html +17 -17
  53. package/dist/package.js +1 -1
  54. package/dist/src/agent/agent-manager.d.ts +1 -0
  55. package/dist/src/agent/agent-manager.js +1 -0
  56. package/dist/src/agent/mcp/conversation-setup.d.ts +1 -0
  57. package/dist/src/agent/mcp/conversation-setup.js +24 -0
  58. package/dist/src/agent/service.js +1 -0
  59. package/dist/src/agent/service.types.d.ts +1 -0
  60. package/dist/src/agent/tools/capability-catalog-tool.d.ts +10 -0
  61. package/dist/src/agent/tools/capability-catalog-tool.js +63 -0
  62. package/dist/src/agent/tools/factory.d.ts +1 -0
  63. package/dist/src/agent/tools/factory.js +25 -0
  64. package/dist/src/agent/tools/xopc-use-tool.d.ts +1 -0
  65. package/dist/src/agent/tools/xopc-use-tool.js +2 -1
  66. package/dist/src/agent-config/schema.d.ts +3 -0
  67. package/dist/src/agent-config/schema.js +1 -0
  68. package/dist/src/capabilities/capability-catalog.d.ts +47 -0
  69. package/dist/src/capabilities/capability-catalog.js +162 -0
  70. package/dist/src/capabilities/store-connector.d.ts +1 -0
  71. package/dist/src/capabilities/store-connector.js +6 -3
  72. package/dist/src/chat-commands/builtins/config.js +1 -1
  73. package/dist/src/chat-commands/context.js +1 -1
  74. package/dist/src/cli/commands/agent.js +1 -1
  75. package/dist/src/cli/commands/doctor/checks/channel-plugins.js +1 -1
  76. package/dist/src/cli/commands/doctor/checks/database-schema.js +5 -5
  77. package/dist/src/cli/commands/extension-dev.js +1 -1
  78. package/dist/src/cli/commands/extension-marketplace.js +1 -1
  79. package/dist/src/cli/commands/extension.js +1 -1
  80. package/dist/src/cli/commands/onboard/channels/registry.js +1 -1
  81. package/dist/src/cli/commands/skills.js +1 -1
  82. package/dist/src/cli/extension-cli-register.js +1 -1
  83. package/dist/src/cli/utils/session.js +1 -1
  84. package/dist/src/config/index.js +1 -1
  85. package/dist/src/config/schema.d.ts +2 -0
  86. package/dist/src/config/schema.js +6 -3
  87. package/dist/src/extensions/index.js +2 -2
  88. package/dist/src/extensions/loader.js +1 -1
  89. package/dist/src/extensions/update.js +1 -1
  90. package/dist/src/gateway/agent-reactions/reaction.d.ts +27 -0
  91. package/dist/src/gateway/agent-reactions/reaction.js +186 -0
  92. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
  93. package/dist/src/gateway/hono/routes/capabilities.js +27 -0
  94. package/dist/src/gateway/hono/routes/connectors.js +1 -1
  95. package/dist/src/gateway/hono/routes/home.js +1 -1
  96. package/dist/src/gateway/hono/routes/mobile-capability-actions.d.ts +4 -0
  97. package/dist/src/gateway/hono/routes/mobile-capability-actions.js +290 -0
  98. package/dist/src/gateway/hono/routes/music-generation.js +1 -0
  99. package/dist/src/gateway/hono/routes/personal-agent.js +15 -6
  100. package/dist/src/gateway/hono/routes/sessions.js +34 -1
  101. package/dist/src/gateway/security/gateway-scopes.js +3 -0
  102. package/dist/src/gateway/service/agent-runner.d.ts +2 -0
  103. package/dist/src/gateway/service/agent-runner.js +5 -1
  104. package/dist/src/gateway/service/config-coordinator.d.ts +1 -0
  105. package/dist/src/gateway/service/config-coordinator.js +1 -1
  106. package/dist/src/gateway/service/run-gateway-agent.d.ts +3 -0
  107. package/dist/src/gateway/service/run-gateway-agent.js +43 -1
  108. package/dist/src/gateway/service/task-conversation-query-service.d.ts +4 -0
  109. package/dist/src/gateway/service.js +19 -10
  110. package/dist/src/home-intelligence/host.js +5 -5
  111. package/dist/src/personal-agent/repository.d.ts +1 -0
  112. package/dist/src/personal-agent/repository.js +1 -0
  113. package/dist/src/personal-agent/service.d.ts +2 -2
  114. package/dist/src/personal-agent/service.js +6 -3
  115. package/dist/src/providers/model-call.js +1 -0
  116. package/dist/src/realtime/runtime.js +1 -0
  117. package/dist/src/session/client-history.d.ts +1 -0
  118. package/dist/src/session/client-history.js +2 -0
  119. package/dist/src/session/types.d.ts +4 -0
  120. package/dist/src/storage/sqlite/agent-reaction-repository.d.ts +15 -0
  121. package/dist/src/storage/sqlite/agent-reaction-repository.js +73 -0
  122. package/dist/src/storage/sqlite/row-mappers.js +1 -1
  123. package/dist/src/storage/sqlite/schema.d.ts +2 -2
  124. package/dist/src/storage/sqlite/schema.js +7 -7
  125. package/dist/src/storage/sqlite/schema.sql +13 -0
  126. package/dist/src/storage/sqlite/upgrades/281_session_agent_reactions.sql +13 -0
  127. package/dist/src/tui/backends/embedded-backend.js +1 -1
  128. package/dist/src/tui/extension-host/load-extensions.js +1 -1
  129. package/dist/src/tui/tui-commands.js +1 -1
  130. package/dist/src/tui/tui-management.js +1 -1
  131. package/dist/src/tui/tui.js +1 -1
  132. package/dist/src/usage/recorder.js +6 -2
  133. package/dist/src/usage/types.d.ts +1 -0
  134. package/package.json +2 -2
  135. package/dist/gateway/static/root/assets/chat-page-DV7fS7_1.js +0 -72
  136. package/dist/gateway/static/root/assets/index-g7f1Sp02.css +0 -1
@@ -1,8 +1,8 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/workspace-file-preview-dialog-BTLLCHMI.js","assets/rolldown-runtime-aKtaBQYM.js","assets/vendor-react-BOUWij0V.js","assets/locale-store-B4o4aDCg.js","assets/messages-hlOsXkQ7.js","assets/use-file-preview-expanded-6TirYKSr.js","assets/chunk-KS7C4IRE-BPb7KheU.js","assets/preload-helper-Czpn1I53.js","assets/createLucideIcon-DPHK1VkS.js","assets/app-window-DXFNqt_0.js","assets/check-DUBLcKHA.js","assets/chevron-down-ccbiQQz_.js","assets/copy-Dv6d4Dvw.js","assets/download-Dk-ZjtO6.js","assets/ellipsis-0k4rZLoy.js","assets/external-link-DjqjBmc3.js","assets/eye-CABVeTq0.js","assets/folder-open-CyzJ19I9.js","assets/link-2-D_ZKYUW7.js","assets/loader-circle-CifKLtgG.js","assets/markdown-view-C7kqotD-.js","assets/diagnostics-Bo0Z42P_.js","assets/dist-CY7CS_D3.js","assets/es2015-DBLcMg5B.js","assets/dist-CxGUk8J-.js","assets/file-image-CDUPkZvG.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/cn-0WouolD0.js","assets/bundle-mjs-rHxsej31.js","assets/app-link-CauYDM-y.js","assets/product-delivery-4gEqUIsK.js","assets/schemas-CCWMleym.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/xml-_d7dTN2Q.js","assets/mermaid-render-oOellPHt.js","assets/markdown-view-DG8DDkEA.css","assets/message-square-plus-XP0tGdlV.js","assets/minimize-2-DtOGrlpo.js","assets/paperclip-f1HujQY1.js","assets/pencil-DmIY3Oa-.js","assets/refresh-cw-BRlGaq2w.js","assets/save-DRDABU--.js","assets/preview-runtime-BWkErYI2.js","assets/rotate-cw-LIg3Am9S.js","assets/search-DA7gz22f.js","assets/skeleton-DzdOeGYz.js","assets/turn-outcome-BSbEJx8h.js","assets/attachment-utils-core-BPYdUI6y.js","assets/electron-env-DHOGevH3.js","assets/use-async-resource-BHFGZCY2.js","assets/workspace-api-DdVYTEEV.js","assets/files-GdwDamkp.js","assets/index.module-Cd9ENXfk.js","assets/session-api-7-TPnKv0.js","assets/gateway-startup-retry-D0i7dt51.js","assets/constants-D5Z-mUto.js","assets/interaction-BdhHBbYa.js","assets/composer-notifications-Drbl5lKS.js","assets/activity-store-BK11iD5x.js","assets/app-chrome-BeB4KgOf.js","assets/sliding-tab-list-CmcrqRzN.js","assets/sliding-indicator-hwz0sx3h.js","assets/dist-ZrL34Ps4.js","assets/dist-BuHnPloF.js","assets/floating-ui.dom-seOukHzT.js","assets/share-link-dialog-3RNzFIH3.js","assets/popover-select-CLsphyzA.js","assets/dist-GJ8-1PAx.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/globe-DSSGFWFn.js","assets/button-ChmVQg9O.js","assets/copy-text-row-BnSoJ0FX.js","assets/right-workspace-store-CFf15f36.js","assets/phone-workspace-store-B0mF8oMk.js","assets/theme-store-C7t81hG7.js","assets/middleware-Pd0e8Igk.js","assets/file-preview-surface-BSrIpn5C.js","assets/shares-api-B532SLIU.js"])))=>i.map(i=>d[i]);
2
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{h as a,l as o,t as s,u as c}from"./chunk-KS7C4IRE-BPb7KheU.js";import{i as l,n as u,o as d}from"./locale-store-B4o4aDCg.js";import{t as f}from"./messages-hlOsXkQ7.js";import{a as p,i as m,n as h,o as g,r as _,s as v,t as y}from"./dist-CY7CS_D3.js";import{t as b}from"./arrow-right-DSSvoX71.js";import{f as x}from"./automation-display-DaVDNZz8.js";import{t as S}from"./check-DUBLcKHA.js";import{t as C}from"./chevron-down-ccbiQQz_.js";import{t as w}from"./chevron-right-BweFrslA.js";import{t as T}from"./circle-alert-BEjgurr2.js";import{t as E}from"./circle-check-C23XjkUj.js";import{t as D}from"./circle-pause-CN9jYH2s.js";import{t as O}from"./clock-3-DnrAnuyZ.js";import{t as k}from"./external-link-DjqjBmc3.js";import{t as A}from"./file-text-D12HbeVy.js";import{t as j}from"./grip-horizontal-CqVA8V1e.js";import{t as M}from"./history-DXH_9jsE.js";import{t as N}from"./list-todo-CTVRto8O.js";import{t as P}from"./lock-keyhole-DEK5kH0u.js";import{N as F,t as I}from"./markdown-view-C7kqotD-.js";import{t as L}from"./message-circle-Badhj-4D.js";import{t as R}from"./message-square-fVE7Ghj1.js";import{t as z}from"./panels-top-left-BKvp2Dag.js";import{t as B}from"./paperclip-f1HujQY1.js";import{t as V}from"./plus-Q2yW6OE7.js";import{t as H}from"./refresh-cw-BRlGaq2w.js";import{t as U}from"./search-DA7gz22f.js";import{t as W}from"./settings-2-D-csvaET.js";import{t as G}from"./sparkles-DHlfQFAF.js";import{t as K}from"./undo-2-6IMTwK4M.js";import{t as ee}from"./x-B_N4OPjy.js";import{t as q}from"./cn-0WouolD0.js";import{t as J}from"./skeleton-DzdOeGYz.js";import{o as te}from"./turn-outcome-BSbEJx8h.js";import{i as Y,l as ne,s as re}from"./capabilities-Clwtvm7F.js";import{i as ie}from"./vendor-swr-CdRzEUwF.js";import{S as ae,b as oe,c as se,g as ce,h as le,m as ue,n as de,s as fe,v as pe,w as me,y as he}from"./workspace-preview-store-DYd8E5bV.js";import{t as X}from"./button-ChmVQg9O.js";import{a as ge,i as _e,o as ve,r as ye,s as be}from"./dist-GJ8-1PAx.js";import{a as xe,c as Se,i as Ce,o as we,r as Te,s as Ee,t as De}from"./composer-payload-handoff-DKLokix8.js";import{t as Oe}from"./use-realtime-voice-D3hr1-yf.js";import{t as ke}from"./page-header-store-D_2QZ6Ps.js";import{t as Ae}from"./automation-api-CxLFngqe.js";import{r as je}from"./composer-handoff-params-DBpzHuNo.js";import{t as Me}from"./sliding-tab-list-CmcrqRzN.js";import{n as Ne,t as Pe}from"./use-composer-attachments-O2une3Cn.js";import{n as Fe,r as Ie}from"./voice-input-shortcut-events-C-8Ts1gq.js";import{n as Le}from"./date-formatters-DukWSVwc.js";import{a as Re,i as ze,r as Be,t as Ve}from"./routine-panel-Cudq6VgR.js";import{r as He,t as Ue}from"./task-result-evidence-ZKcxDYVE.js";import{n as We}from"./tab-completion-input-CxtEp0aP.js";var Ge=n(),Z=e(t(),1);function Ke(e,t,n=!1){let[r,i]=(0,Z.useState)(null),[a,o]=(0,Z.useState)(!0),[s,c]=(0,Z.useState)(null),l=(0,Z.useRef)(0),u=(0,Z.useCallback)(async()=>{let t=++l.current;c(null);try{let r=await(n?ue(e,!0):ue(e));t===l.current&&i(r)}catch(e){t===l.current&&c(e instanceof Error?e.message:String(e))}finally{t===l.current&&o(!1)}},[e,n]);return(0,Z.useEffect)(()=>(u(),()=>{l.current++}),[u,t]),(0,Z.useEffect)(()=>{let e,t=1/0,n=n=>{let r=Date.now()+n;r>=t||(window.clearTimeout(e),t=r,e=window.setTimeout(()=>{e=void 0,t=1/0,u()},n))},r=()=>n(100),i=()=>n(750),a=()=>{document.visibilityState===`visible`&&r()},o=[`task-changed-v2`,`task-updated`,`session-created`,`agent-run-started`,`agent-run-ended`,`automation-run-completed`,`home-advisor-updated`,`gateway-realtime-connected`,`realtime-gap`,`focus`],s=[`session-updated`,`session-transcript-updated`];return o.forEach(e=>window.addEventListener(e,r)),s.forEach(e=>window.addEventListener(e,i)),document.addEventListener(`visibilitychange`,a),()=>{o.forEach(e=>window.removeEventListener(e,r)),s.forEach(e=>window.removeEventListener(e,i)),document.removeEventListener(`visibilitychange`,a),window.clearTimeout(e)}},[u]),{home:r,loading:a,loadError:s,setLoadError:c,load:u}}var Q=r(),$=12e3;function qe(e){let t=(0,Ge.c)(107),{variant:n,inputId:r,inputRef:i,intent:a,labels:o,attachments:s,isDragging:c,attachmentBusy:l,attachmentsFull:u,voice:d,chat:f,cancelAction:p,onIntentChange:m,onPickFiles:h,onRemoveAttachment:g,onPaste:_,onDragOver:v,onDragLeave:y,onDrop:b,onSubmit:x}=e,S=n===`inline`,C;t[0]!==s||t[1]!==a?(C=!!a.trim()||s.length>0,t[0]=s,t[1]=a,t[2]=C):C=t[2];let w=C,T=d.voiceActive&&d.phase!==`error`,E;t[3]!==x||t[4]!==d.voiceActive?(E=e=>{if(d.voiceActive){e.preventDefault();return}x(e)},t[3]=x,t[4]=d.voiceActive,t[5]=E):E=t[5];let D=S?`mx-auto mt-6 w-full overflow-hidden rounded-xl border border-edge bg-surface-base p-2 text-left shadow-surface transition-colors focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/15 sm:mt-8`:`flex min-h-0 flex-1 flex-col`,O;t[6]===D?O=t[7]:(O=q(`relative`,D),t[6]=D,t[7]=O);let k;t[8]!==S||t[9]!==c||t[10]!==o.dropFiles?(k=c?(0,Q.jsx)(`div`,{className:q(`pointer-events-none absolute inset-0 z-10 flex items-center justify-center bg-accent-soft/90 text-sm font-medium text-accent-fg backdrop-blur-[1px]`,S&&`rounded-2xl`),children:o.dropFiles}):null,t[8]=S,t[9]=c,t[10]=o.dropFiles,t[11]=k):k=t[11];let A=!S&&`flex min-h-0 flex-1 flex-col overflow-y-auto px-5 py-4`,j;t[12]===A?j=t[13]:(j=q(A),t[12]=A,t[13]=j);let M=S?`sr-only`:`mb-2 shrink-0 text-sm font-medium text-fg`,N;t[14]!==r||t[15]!==o.intentLabel||t[16]!==M?(N=(0,Q.jsx)(`label`,{htmlFor:r,className:M,children:o.intentLabel}),t[14]=r,t[15]=o.intentLabel,t[16]=M,t[17]=N):N=t[17];let P;t[18]!==l||t[19]!==f||t[20]!==d.audioLevel||t[21]!==d.cancelVoiceInput||t[22]!==d.confirmVoiceInput||t[23]!==d.elapsedLabel||t[24]!==d.error||t[25]!==d.finalTranscript||t[26]!==d.partialTranscript||t[27]!==d.phase||t[28]!==d.recordedDictation||t[29]!==d.retryVoiceInput||t[30]!==d.settingsRequired||t[31]!==d.voiceActive?(P=d.voiceActive?(0,Q.jsx)(Te,{phase:d.phase,elapsedLabel:d.elapsedLabel,recordedDictation:d.recordedDictation,audioLevel:d.audioLevel,partialTranscript:d.partialTranscript,finalTranscript:d.finalTranscript,error:d.error,settingsRequired:d.settingsRequired,disabled:l,chat:f,onCancel:d.cancelVoiceInput,onConfirm:d.confirmVoiceInput,onRetry:d.retryVoiceInput}):null,t[18]=l,t[19]=f,t[20]=d.audioLevel,t[21]=d.cancelVoiceInput,t[22]=d.confirmVoiceInput,t[23]=d.elapsedLabel,t[24]=d.error,t[25]=d.finalTranscript,t[26]=d.partialTranscript,t[27]=d.phase,t[28]=d.recordedDictation,t[29]=d.retryVoiceInput,t[30]=d.settingsRequired,t[31]=d.voiceActive,t[32]=P):P=t[32];let F=T&&`hidden`,I=S?`min-h-24 bg-transparent px-3 py-2`:`min-h-32 flex-1 rounded-xl border border-edge bg-surface-base p-3 focus:border-accent focus:ring-2 focus:ring-accent/20`,L;t[33]!==F||t[34]!==I?(L=q(`w-full resize-none text-sm font-normal leading-6 text-fg outline-none placeholder:text-fg-subtle`,F,I),t[33]=F,t[34]=I,t[35]=L):L=t[35];let R;t[36]===m?R=t[37]:(R=e=>m(e.target.value),t[36]=m,t[37]=R);let z=!S,V;t[38]!==r||t[39]!==i||t[40]!==a||t[41]!==o.intentPlaceholder||t[42]!==o.intentSuggestion||t[43]!==m||t[44]!==_||t[45]!==L||t[46]!==R||t[47]!==z?(V=(0,Q.jsx)(We,{ref:i,id:r,className:L,value:a,onChange:R,onPaste:_,suggestion:o.intentSuggestion,onAcceptSuggestion:m,onKeyDown:Je,placeholder:o.intentPlaceholder,maxLength:$,autoFocus:z}),t[38]=r,t[39]=i,t[40]=a,t[41]=o.intentPlaceholder,t[42]=o.intentSuggestion,t[43]=m,t[44]=_,t[45]=L,t[46]=R,t[47]=z,t[48]=V):V=t[48];let H=S?`border-b-0 bg-transparent px-3 pb-2 pt-0`:`mt-3 border-b-0 bg-transparent px-0 pb-0`,U;t[49]!==s||t[50]!==g||t[51]!==H?(U=(0,Q.jsx)(Ne,{attachments:s,topPadded:!1,onRemove:g,className:H}),t[49]=s,t[50]=g,t[51]=H,t[52]=U):U=t[52];let W;t[53]!==S||t[54]!==a.length||t[55]!==o.shortcut?(W=S?null:(0,Q.jsxs)(`div`,{className:`mt-2 flex shrink-0 items-center justify-between gap-3 text-[11px] text-fg-subtle`,children:[(0,Q.jsx)(`span`,{children:o.shortcut}),(0,Q.jsxs)(`span`,{className:`tabular-nums`,children:[a.length.toLocaleString(),` / `,$.toLocaleString()]})]}),t[53]=S,t[54]=a.length,t[55]=o.shortcut,t[56]=W):W=t[56];let K;t[57]!==P||t[58]!==V||t[59]!==U||t[60]!==W||t[61]!==j||t[62]!==N?(K=(0,Q.jsxs)(`div`,{className:j,children:[N,P,V,U,W]}),t[57]=P,t[58]=V,t[59]=U,t[60]=W,t[61]=j,t[62]=N,t[63]=K):K=t[63];let ee=S?`border-edge-subtle px-1 pt-2`:`border-edge px-5 py-4`,J;t[64]===ee?J=t[65]:(J=q(`flex shrink-0 items-center gap-2 border-t`,ee),t[64]=ee,t[65]=J);let te=!S&&`mr-auto`,Y;t[66]===te?Y=t[67]:(Y=q(`flex items-center gap-1`,te),t[66]=te,t[67]=Y);let ne=l||u,re;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Q.jsx)(B,{className:`size-4`,"aria-hidden":!0}),t[68]=re):re=t[68];let ie;t[69]!==o.attachTitle||t[70]!==h||t[71]!==ne?(ie=(0,Q.jsx)(X,{type:`button`,variant:`ghost`,className:`size-9 rounded-lg p-0`,disabled:ne,title:o.attachTitle,"aria-label":o.attachTitle,onClick:h,children:re}),t[69]=o.attachTitle,t[70]=h,t[71]=ne,t[72]=ie):ie=t[72];let ae;t[73]!==l||t[74]!==f||t[75]!==d.startVoiceInput||t[76]!==d.voiceActive?(ae=d.voiceActive?null:(0,Q.jsx)(we,{disabled:l,chat:f,onStart:d.startVoiceInput}),t[73]=l,t[74]=f,t[75]=d.startVoiceInput,t[76]=d.voiceActive,t[77]=ae):ae=t[77];let oe;t[78]!==Y||t[79]!==ie||t[80]!==ae?(oe=(0,Q.jsxs)(`div`,{className:Y,children:[ie,ae]}),t[78]=Y,t[79]=ie,t[80]=ae,t[81]=oe):oe=t[81];let se;t[82]!==p||t[83]!==S||t[84]!==o.shortcut?(se=S?(0,Q.jsx)(`span`,{className:`hidden text-[11px] text-fg-subtle sm:inline`,children:o.shortcut}):p,t[82]=p,t[83]=S,t[84]=o.shortcut,t[85]=se):se=t[85];let ce=S?`ml-auto h-9 rounded-lg px-3.5 text-xs`:`min-w-32`,le=!w||l||d.voiceActive,ue=S?`size-3.5`:`size-4`,de;t[86]===ue?de=t[87]:(de=(0,Q.jsx)(G,{className:ue,"aria-hidden":!0}),t[86]=ue,t[87]=de);let fe;t[88]!==o.submit||t[89]!==ce||t[90]!==le||t[91]!==de?(fe=(0,Q.jsxs)(X,{type:`submit`,variant:`primary`,className:ce,disabled:le,children:[de,o.submit]}),t[88]=o.submit,t[89]=ce,t[90]=le,t[91]=de,t[92]=fe):fe=t[92];let pe;t[93]!==J||t[94]!==oe||t[95]!==se||t[96]!==fe?(pe=(0,Q.jsxs)(`div`,{className:J,children:[oe,se,fe]}),t[93]=J,t[94]=oe,t[95]=se,t[96]=fe,t[97]=pe):pe=t[97];let me;return t[98]!==y||t[99]!==v||t[100]!==b||t[101]!==E||t[102]!==K||t[103]!==pe||t[104]!==O||t[105]!==k?(me=(0,Q.jsxs)(`form`,{onSubmit:E,onDragOver:v,onDragLeave:y,onDrop:b,className:O,children:[k,K,pe]}),t[98]=y,t[99]=v,t[100]=b,t[101]=E,t[102]=K,t[103]=pe,t[104]=O,t[105]=k,t[106]=me):me=t[106],me}function Je(e){e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}function Ye(e){let t=(0,Ge.c)(12),{href:n,children:r,onOpen:i}=e,a=o();if(n&&/^https?:\/\//i.test(n)){let e;return t[0]!==r||t[1]!==n?(e=(0,Q.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,className:`rounded-sm text-accent-fg hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r}),t[0]=r,t[1]=n,t[2]=e):e=t[2],e}if(n?.startsWith(`/`)&&!n.startsWith(`//`)){let e=`${a.pathname}${a.search}`,o;t[3]!==n||t[4]!==e?(o=F(e,n),t[3]=n,t[4]=e,t[5]=o):o=t[5];let c;return t[6]!==r||t[7]!==i||t[8]!==o?(c=(0,Q.jsx)(s,{to:o,className:`rounded-sm text-accent-fg hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:i,children:r}),t[6]=r,t[7]=i,t[8]=o,t[9]=c):c=t[9],c}let c;return t[10]===r?c=t[11]:(c=(0,Q.jsx)(`span`,{children:r}),t[10]=r,t[11]=c),c}function Xe(e){let t=(0,Ge.c)(6),{opportunity:n,onOpen:r}=e,i=u(Ze),a,o;if(t[0]!==i||t[1]!==r||t[2]!==n.evidence||t[3]!==n.evidencePresentation){o=Symbol.for(`react.early_return_sentinel`);bb0:{let e=f(i).projectsPage.home.advisorEvidenceCopy,t=n.evidencePresentation,s=t?.locale===i?t.groups:void 0,c=new Intl.DateTimeFormat(i===`zh`?`zh-CN`:`en`,{dateStyle:`medium`,timeStyle:`short`}),l=t=>(0,Q.jsx)(`ul`,{className:`mt-2 space-y-3 border-l border-edge pl-3 text-xs leading-5 text-fg-muted`,children:t.map(t=>{let n=!!(t.href&&(/^https?:\/\//i.test(t.href)||t.href.startsWith(`/`)&&!t.href.startsWith(`//`)));return(0,Q.jsxs)(`li`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:[(0,Q.jsxs)(`p`,{className:`text-fg-subtle`,children:[e.sources[t.sourceType],` · `,(0,Q.jsx)(`time`,{dateTime:new Date(t.observedAt).toISOString(),children:c.format(t.observedAt)})]}),(0,Q.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap`,children:t.observation}),(0,Q.jsx)(`p`,{className:`mt-1`,children:n?(0,Q.jsx)(Ye,{href:t.href,onOpen:r,children:e.openSource}):e.noSource})]},t.id)})}),u=(t,r)=>(0,Q.jsxs)(`li`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:[(0,Q.jsx)(`p`,{className:`text-fg-muted`,children:t.summary}),(0,Q.jsxs)(`details`,{className:`mt-1`,children:[(0,Q.jsxs)(`summary`,{className:`min-h-9 cursor-pointer rounded-sm py-2 text-fg-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[e.originals,` · `,e.sourceCount.replace(`{{count}}`,String(t.evidenceIds.length))]}),l(n.evidence.filter(e=>t.evidenceIds.includes(e.id)))]})]},r);if(!s){o=(0,Q.jsxs)(`div`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:[(0,Q.jsx)(`p`,{children:e.unavailable}),(0,Q.jsxs)(`details`,{children:[(0,Q.jsx)(`summary`,{className:`min-h-9 cursor-pointer rounded-sm py-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:e.originals}),l(n.evidence)]})]});break bb0}a=(0,Q.jsxs)(`div`,{className:`mt-2 text-xs leading-5`,children:[(0,Q.jsx)(`p`,{className:`mb-3 text-fg-subtle`,children:e.aiNote}),(0,Q.jsx)(`ul`,{className:`space-y-3 border-l border-edge pl-3`,children:s.slice(0,3).map(u)}),s.length>3?(0,Q.jsxs)(`details`,{className:`mt-2`,children:[(0,Q.jsx)(`summary`,{className:`min-h-9 cursor-pointer rounded-sm py-2 text-fg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:e.more.replace(`{{count}}`,String(s.length-3))}),(0,Q.jsx)(`ul`,{className:`space-y-3 border-l border-edge pl-3`,children:s.slice(3).map(u)})]}):null]})}t[0]=i,t[1]=r,t[2]=n.evidence,t[3]=n.evidencePresentation,t[4]=a,t[5]=o}else a=t[4],o=t[5];return o===Symbol.for(`react.early_return_sentinel`)?a:o}function Ze(e){return e.language}function Qe(e){let t=(0,Ge.c)(4),{label:n,onClick:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(M,{className:`size-3.5`,"aria-hidden":!0}),t[0]=i):i=t[0];let a;return t[1]!==n||t[2]!==r?(a=(0,Q.jsxs)(`button`,{type:`button`,className:`inline-flex min-h-9 items-center gap-1.5 rounded-lg px-2 text-xs font-medium text-fg-muted transition-colors duration-150 hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:r,children:[i,n]}),t[1]=n,t[2]=r,t[3]=a):a=t[3],a}function $e(e){let t=(0,Ge.c)(63),{opportunity:n,copy:r,onOpenHistory:i}=e,a,o,s,c,l,u;if(t[0]!==r.aiLabel||t[1]!==r.automationAction||t[2]!==r.automationHint||t[3]!==r.history||t[4]!==r.minutes||t[5]!==r.needsSetup||t[6]!==r.why||t[7]!==i||t[8]!==n.capabilities||t[9]!==n.continuation||t[10]!==n.estimatedMinutes||t[11]!==n.outcome||t[12]!==n.rationale||t[13]!==n.title){let e=n.capabilities.filter(et),d;t[20]===r.aiLabel?d=t[21]:(d=(0,Q.jsx)(`span`,{children:r.aiLabel}),t[20]=r.aiLabel,t[21]=d);let f;t[22]!==r.minutes||t[23]!==n.estimatedMinutes?(f=n.estimatedMinutes?(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Q.jsx)(O,{className:`size-3.5`,"aria-hidden":!0}),n.estimatedMinutes,` `,r.minutes]}):null,t[22]=r.minutes,t[23]=n.estimatedMinutes,t[24]=f):f=t[24];let p;t[25]!==d||t[26]!==f?(p=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[d,f]}),t[25]=d,t[26]=f,t[27]=p):p=t[27];let m;t[28]!==r.history||t[29]!==i?(m=(0,Q.jsx)(Qe,{label:r.history,onClick:i}),t[28]=r.history,t[29]=i,t[30]=m):m=t[30],t[31]!==m||t[32]!==p?(a=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[p,m]}),t[31]=m,t[32]=p,t[33]=a):a=t[33],t[34]===n.title?o=t[35]:(o=(0,Q.jsx)(`h3`,{className:`mt-3 text-xl font-semibold leading-7 tracking-tight text-fg`,children:n.title}),t[34]=n.title,t[35]=o),t[36]===n.outcome?s=t[37]:(s=(0,Q.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:n.outcome}),t[36]=n.outcome,t[37]=s);let h;t[38]===r.why?h=t[39]:(h=(0,Q.jsxs)(`span`,{className:`font-medium text-fg`,children:[r.why,`:`]}),t[38]=r.why,t[39]=h),t[40]!==n.rationale||t[41]!==h?(c=(0,Q.jsxs)(`p`,{className:`mt-4 text-sm leading-6 text-fg-muted`,children:[h,n.rationale]}),t[40]=n.rationale,t[41]=h,t[42]=c):c=t[42],t[43]!==r.automationAction||t[44]!==r.automationHint||t[45]!==n.continuation?(l=n.continuation?.kind===`automation`?(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-col gap-3 rounded-xl border border-edge bg-surface-subtle p-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,Q.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:r.automationHint}),(0,Q.jsx)(`a`,{href:`#${n.continuation.href}`,className:`inline-flex min-h-11 shrink-0 items-center rounded-lg px-3 text-xs font-medium text-accent hover:bg-accent-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r.automationAction})]}):null,t[43]=r.automationAction,t[44]=r.automationHint,t[45]=n.continuation,t[46]=l):l=t[46],u=e.length>0?(0,Q.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,"aria-label":r.needsSetup,children:e.map(e=>(0,Q.jsxs)(`a`,{href:`#${e.recoveryPath??`/settings`}`,className:`rounded-full border border-accent/25 bg-accent-soft px-2.5 py-1 text-xs text-accent hover:border-accent/50`,children:[r.needsSetup,` · `,e.capability]},`${e.kind}:${e.capability}`))}):null,t[0]=r.aiLabel,t[1]=r.automationAction,t[2]=r.automationHint,t[3]=r.history,t[4]=r.minutes,t[5]=r.needsSetup,t[6]=r.why,t[7]=i,t[8]=n.capabilities,t[9]=n.continuation,t[10]=n.estimatedMinutes,t[11]=n.outcome,t[12]=n.rationale,t[13]=n.title,t[14]=a,t[15]=o,t[16]=s,t[17]=c,t[18]=l,t[19]=u}else a=t[14],o=t[15],s=t[16],c=t[17],l=t[18],u=t[19];let d;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(C,{className:`size-3.5 transition-transform group-open:rotate-180`,"aria-hidden":!0}),t[47]=d):d=t[47];let f;t[48]===r.evidence?f=t[49]:(f=(0,Q.jsxs)(`summary`,{className:`flex min-h-9 cursor-pointer list-none items-center gap-1.5 text-xs font-medium text-fg-muted hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[r.evidence,d]}),t[48]=r.evidence,t[49]=f);let p;t[50]===n?p=t[51]:(p=(0,Q.jsx)(Xe,{opportunity:n}),t[50]=n,t[51]=p);let m;t[52]!==f||t[53]!==p?(m=(0,Q.jsxs)(`details`,{className:`mt-4 group`,children:[f,p]}),t[52]=f,t[53]=p,t[54]=m):m=t[54];let h;return t[55]!==a||t[56]!==m||t[57]!==o||t[58]!==s||t[59]!==c||t[60]!==l||t[61]!==u?(h=(0,Q.jsxs)(Q.Fragment,{children:[a,o,s,c,l,u,m]}),t[55]=a,t[56]=m,t[57]=o,t[58]=s,t[59]=c,t[60]=l,t[61]=u,t[62]=h):h=t[62],h}function et(e){return e.readiness!==`ready`}function tt(e){let t=(0,Ge.c)(142),{advisor:n,copy:r,busy:i,onRefresh:a,onAction:o,onFeedback:s,onClarification:c,onOpenHistory:l,preflight:u,receipt:d}=e,[f,p]=(0,Z.useState)(),m;t[0]!==n.alternatives||t[1]!==n.primary||t[2]!==n.state?(m=n.state===`ready`?[n.primary,...n.alternatives]:[],t[0]=n.alternatives,t[1]=n.primary,t[2]=n.state,t[3]=m):m=t[3];let h=m,g;t[4]!==h||t[5]!==f?(g=h.find(e=>e.id===f)??h[0],t[4]=h,t[5]=f,t[6]=g):g=t[6];let _=g,v;t[7]===h[0]?.id?v=t[8]:(v=()=>p(h[0]?.id),t[7]=h[0]?.id,t[8]=v);let y=h[0]?.id,b;if(t[9]!==n.state||t[10]!==y?(b=[n.state,y],t[9]=n.state,t[10]=y,t[11]=b):b=t[11],(0,Z.useEffect)(v,b),n.state===`disabled`)return null;if(d){let e;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(E,{className:`size-5 shrink-0 text-success`,"aria-hidden":!0}),t[12]=e):e=t[12];let n;t[13]===d.title?n=t[14]:(n=(0,Q.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:d.title}),t[13]=d.title,t[14]=n);let i;t[15]===d.detail?i=t[16]:(i=(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:d.detail}),t[15]=d.detail,t[16]=i);let a;t[17]!==n||t[18]!==i?(a=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[n,i]}),t[17]=n,t[18]=i,t[19]=a):a=t[19];let o;t[20]!==r.history||t[21]!==l?(o=(0,Q.jsx)(Qe,{label:r.history,onClick:l}),t[20]=r.history,t[21]=l,t[22]=o):o=t[22];let s=`#${d.href}`,c;t[23]!==r.viewProgress||t[24]!==s?(c=(0,Q.jsx)(X,{asChild:!0,variant:`secondary`,className:`min-h-10 text-xs`,children:(0,Q.jsx)(`a`,{href:s,children:r.viewProgress})}),t[23]=r.viewProgress,t[24]=s,t[25]=c):c=t[25];let u;t[26]!==o||t[27]!==c?(u=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[o,c]}),t[26]=o,t[27]=c,t[28]=u):u=t[28];let f;return t[29]!==u||t[30]!==a?(f=(0,Q.jsx)(`section`,{className:`mt-7 rounded-2xl border border-success/25 bg-success-soft px-5 py-4`,role:`status`,children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center`,children:[e,a,u]})}),t[29]=u,t[30]=a,t[31]=f):f=t[31],f}if(n.state===`quiet`||n.state===`refreshing`)return null;if(n.state===`clarification`){let e;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(G,{className:`size-4`,"aria-hidden":!0}),t[32]=e):e=t[32];let a;t[33]===r.aiLabel?a=t[34]:(a=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-accent`,children:[e,r.aiLabel]}),t[33]=r.aiLabel,t[34]=a);let o;t[35]!==r.history||t[36]!==l?(o=(0,Q.jsx)(Qe,{label:r.history,onClick:l}),t[35]=r.history,t[36]=l,t[37]=o):o=t[37];let s;t[38]!==a||t[39]!==o?(s=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[a,o]}),t[38]=a,t[39]=o,t[40]=s):s=t[40];let u;t[41]===n.question.question?u=t[42]:(u=(0,Q.jsx)(`h3`,{id:`home-advisor-question`,className:`mt-3 text-lg font-semibold text-fg`,children:n.question.question}),t[41]=n.question.question,t[42]=u);let d;if(t[43]!==n.question.options||t[44]!==n.question.question||t[45]!==i||t[46]!==c){let e;t[48]!==n.question.question||t[49]!==i||t[50]!==c?(e=e=>(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:`min-h-11`,disabled:i,onClick:()=>c(n.question.question,e.label),children:e.label},e.id),t[48]=n.question.question,t[49]=i,t[50]=c,t[51]=e):e=t[51],d=n.question.options.map(e),t[43]=n.question.options,t[44]=n.question.question,t[45]=i,t[46]=c,t[47]=d}else d=t[47];let f;t[52]===d?f=t[53]:(f=(0,Q.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:d}),t[52]=d,t[53]=f);let p;return t[54]!==u||t[55]!==f||t[56]!==s?(p=(0,Q.jsxs)(`section`,{className:`mt-7 rounded-2xl border border-accent/25 bg-surface-base px-5 py-5`,"aria-labelledby":`home-advisor-question`,children:[s,u,f]}),t[54]=u,t[55]=f,t[56]=s,t[57]=p):p=t[57],p}if(!_)return null;let x=u?.opportunityId===_.id?u.value:void 0,S;t[58]!==n.stale||t[59]!==r.refreshing?(S=n.stale?(0,Q.jsxs)(`p`,{className:`mb-3 inline-flex items-center gap-2 text-xs text-accent`,children:[(0,Q.jsx)(H,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),r.refreshing]}):null,t[58]=n.stale,t[59]=r.refreshing,t[60]=S):S=t[60];let w;t[61]!==r||t[62]!==l||t[63]!==_?(w=(0,Q.jsx)($e,{opportunity:_,copy:r,onOpenHistory:l}),t[61]=r,t[62]=l,t[63]=_,t[64]=w):w=t[64];let T;t[65]!==i||t[66]!==r.configure||t[67]!==r.degradedStart||t[68]!==r.setupHint||t[69]!==r.setupTitle||t[70]!==o||t[71]!==_||t[72]!==x?(T=x?.state===`needs_setup`?(0,Q.jsx)(`div`,{className:`mt-5 rounded-xl border border-accent/25 bg-accent-soft/40 p-4`,role:`alert`,"aria-live":`polite`,children:(0,Q.jsxs)(`div`,{className:`flex gap-3`,children:[(0,Q.jsx)(W,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:r.setupTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:r.setupHint}),(0,Q.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs leading-5 text-fg-muted`,children:x.blockers.map(nt)}),(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[x.recoveryActions.map(e=>(0,Q.jsxs)(`a`,{href:`#${e.href}`,className:`inline-flex min-h-11 items-center rounded-lg border border-accent/30 px-3 text-xs font-medium text-accent hover:bg-accent-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[r.configure,` · `,e.capability]},e.capability)),x.degradedAction?(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:`min-h-11`,disabled:i,onClick:()=>o(_,`degraded_start`),children:r.degradedStart}):null]})]})]})}):null,t[65]=i,t[66]=r.configure,t[67]=r.degradedStart,t[68]=r.setupHint,t[69]=r.setupTitle,t[70]=o,t[71]=_,t[72]=x,t[73]=T):T=t[73];let D;t[74]!==i||t[75]!==r.start||t[76]!==o||t[77]!==_?(D=_.actions.canStart?(0,Q.jsxs)(X,{type:`button`,variant:`primary`,className:`min-h-11`,disabled:i,onClick:()=>o(_,`start`),children:[(0,Q.jsx)(G,{className:`size-4`,"aria-hidden":!0}),r.start]}):null,t[74]=i,t[75]=r.start,t[76]=o,t[77]=_,t[78]=D):D=t[78];let O;t[79]!==i||t[80]!==r.discuss||t[81]!==o||t[82]!==_?(O=_.actions.canDiscuss?(0,Q.jsxs)(X,{type:`button`,variant:`secondary`,className:`min-h-11`,disabled:i,onClick:()=>o(_,`discuss`),children:[(0,Q.jsx)(L,{className:`size-4`,"aria-hidden":!0}),r.discuss]}):null,t[79]=i,t[80]=r.discuss,t[81]=o,t[82]=_,t[83]=O):O=t[83];let k;t[84]!==O||t[85]!==D?(k=(0,Q.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center gap-2`,children:[D,O]}),t[84]=O,t[85]=D,t[86]=k):k=t[86];let A;t[87]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsx)(C,{className:`size-3.5`,"aria-hidden":!0}),t[87]=A):A=t[87];let j;t[88]===r.more?j=t[89]:(j=(0,Q.jsxs)(`summary`,{className:`inline-flex min-h-9 cursor-pointer list-none items-center gap-1.5 rounded-lg px-2 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:ring-2 focus-visible:ring-accent`,children:[r.more,A]}),t[88]=r.more,t[89]=j);let M;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(H,{className:`size-4`,"aria-hidden":!0}),t[90]=M):M=t[90];let N;t[91]!==i||t[92]!==r.refresh||t[93]!==a?(N=(0,Q.jsxs)(X,{type:`button`,variant:`ghost`,className:`min-h-11`,disabled:i,onClick:a,title:r.refresh,children:[M,r.refresh]}),t[91]=i,t[92]=r.refresh,t[93]=a,t[94]=N):N=t[94];let P;t[95]===r.feedback?P=t[96]:(P=(0,Q.jsx)(`summary`,{className:`flex min-h-11 cursor-pointer list-none items-center rounded-lg px-3 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r.feedback}),t[95]=r.feedback,t[96]=P);let F;t[97]===r.alreadyDone?F=t[98]:(F=[`already_done`,r.alreadyDone],t[97]=r.alreadyDone,t[98]=F);let I;t[99]===r.irrelevant?I=t[100]:(I=[`irrelevant`,r.irrelevant],t[99]=r.irrelevant,t[100]=I);let R;t[101]===r.later?R=t[102]:(R=[`too_early`,r.later],t[101]=r.later,t[102]=R);let z;t[103]===r.sourceIncorrect?z=t[104]:(z=[`source_incorrect`,r.sourceIncorrect],t[103]=r.sourceIncorrect,t[104]=z);let B;t[105]===r.lessLikeThis?B=t[106]:(B=[`less_like_this`,r.lessLikeThis],t[105]=r.lessLikeThis,t[106]=B);let V;t[107]!==F||t[108]!==I||t[109]!==R||t[110]!==z||t[111]!==B?(V=[F,I,R,z,B],t[107]=F,t[108]=I,t[109]=R,t[110]=z,t[111]=B,t[112]=V):V=t[112];let U=V,K;t[113]!==i||t[114]!==s||t[115]!==_||t[116]!==U?(K=(0,Q.jsx)(`div`,{className:`absolute right-0 z-20 mt-1 w-44 rounded-xl border border-edge bg-surface-overlay p-1 shadow-float`,children:U.map(e=>{let[t,n]=e;return(0,Q.jsx)(`button`,{type:`button`,disabled:i,className:`min-h-10 w-full rounded-lg px-3 text-left text-sm text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>s(_,t),children:n},t)})}),t[113]=i,t[114]=s,t[115]=_,t[116]=U,t[117]=K):K=t[117];let ee;t[118]!==P||t[119]!==K?(ee=(0,Q.jsxs)(`details`,{className:`relative`,children:[P,K]}),t[118]=P,t[119]=K,t[120]=ee):ee=t[120];let q;t[121]!==N||t[122]!==ee?(q=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[N,ee]}),t[121]=N,t[122]=ee,t[123]=q):q=t[123];let J;t[124]!==i||t[125]!==r.alternatives||t[126]!==h||t[127]!==_.id?(J=h.length>1?(0,Q.jsxs)(`div`,{className:`border-t border-edge-subtle pt-2`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium text-fg-subtle`,children:r.alternatives}),(0,Q.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:h.filter(e=>e.id!==_.id).map(e=>(0,Q.jsx)(`button`,{type:`button`,disabled:i,className:`min-h-10 rounded-lg border border-edge px-3 text-left text-sm text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>p(e.id),children:e.title},e.id))})]}):null,t[124]=i,t[125]=r.alternatives,t[126]=h,t[127]=_.id,t[128]=J):J=t[128];let te;t[129]!==j||t[130]!==q||t[131]!==J?(te=(0,Q.jsxs)(`details`,{className:`mt-1`,children:[j,q,J]}),t[129]=j,t[130]=q,t[131]=J,t[132]=te):te=t[132];let Y;t[133]!==k||t[134]!==te||t[135]!==S||t[136]!==w||t[137]!==T?(Y=(0,Q.jsxs)(`div`,{className:`px-5 py-5 sm:px-6`,children:[S,w,T,k,te]}),t[133]=k,t[134]=te,t[135]=S,t[136]=w,t[137]=T,t[138]=Y):Y=t[138];let ne;return t[139]!==r.aiLabel||t[140]!==Y?(ne=(0,Q.jsx)(`section`,{className:`mt-7 rounded-2xl border border-accent/25 bg-surface-base`,"aria-label":r.aiLabel,children:Y}),t[139]=r.aiLabel,t[140]=Y,t[141]=ne):ne=t[141],ne}function nt(e){return(0,Q.jsx)(`li`,{children:e.message},`${e.kind}:${e.capability}`)}function rt(e){let t=(0,Ge.c)(11),{observation:n,language:r,onUpdated:i}=e,a=r===`zh`,o=n.followUps??[],[s,c]=(0,Z.useState)(!1),[u,f]=(0,Z.useState)(``),[p,m]=(0,Z.useState)(``),[h,g]=(0,Z.useState)(``),_;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(_=[],t[0]=_):_=t[0];let[v,y]=(0,Z.useState)(_),[b,x]=(0,Z.useState)(!0),[S,C]=(0,Z.useState)(!1),[w,T]=(0,Z.useState)(``),E;t[1]!==n.topics||t[2]!==a?(E=e=>{f(e?.goal??``),g(e?.firstStep??(a?`先整理已有线索、已知事实和资料缺口,再提出下一步建议。`:`Organize existing evidence, known facts and missing material, then propose the next step.`)),m(``),y(e?[e.topicId]:n.topics.slice(0,3).map(dt)),c(!0),T(``)},t[1]=n.topics,t[2]=a,t[3]=E):E=t[3];let D=E,O;t[4]!==r||t[5]!==i?(O=e=>(0,Q.jsx)(ft,{followUp:e,language:r,onUpdated:i},e.id),t[4]=r,t[5]=i,t[6]=O):O=t[6];let k=o.filter(ut).map(O),A=n.status===`active`?(0,Q.jsxs)(Q.Fragment,{children:[o.some(lt)?null:(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(`p`,{className:`text-base font-semibold text-fg`,children:a?`把一件事推进到完成`:`Keep one goal moving until it is done`}),(0,Q.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:a?`记住目标和进展,一步步整理证据、查清问题。有新资料继续推进,遇到阻塞会告诉你缺什么。`:`Keep the goal and its progress together. Work through the evidence, continue when input arrives, and make blockers clear.`})]}),s?null:(n.followUpCandidates??[]).map(e=>(0,Q.jsxs)(`div`,{className:`space-y-2 rounded-lg bg-surface-inset p-3`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a?`这条请求可能需要继续跟进,请先确认目标`:`This request may need follow-through. Confirm the goal first.`}),(0,Q.jsx)(`p`,{className:`line-clamp-2 text-sm text-fg`,children:e.goal}),(0,Q.jsx)(X,{variant:`tonal`,onClick:()=>D(e),children:a?`设为持续目标`:`Set up a continuing goal`})]},e.topicId)),s?(0,Q.jsxs)(`form`,{className:`space-y-3 rounded-lg bg-surface-inset p-3`,onSubmit:e=>{e.preventDefault(),!S&&(C(!0),T(``),d(l(`/api/home/follow-ups`),{method:`POST`,body:JSON.stringify({goal:u,criteria:p.split(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/workspace-file-preview-dialog-Xi5feqPq.js","assets/rolldown-runtime-aKtaBQYM.js","assets/vendor-react-BOUWij0V.js","assets/locale-store-B4o4aDCg.js","assets/messages-hlOsXkQ7.js","assets/use-file-preview-expanded-CRBn6UTd.js","assets/chunk-KS7C4IRE-BPb7KheU.js","assets/preload-helper-Czpn1I53.js","assets/createLucideIcon-DPHK1VkS.js","assets/app-window-DXFNqt_0.js","assets/check-DUBLcKHA.js","assets/chevron-down-ccbiQQz_.js","assets/copy-Dv6d4Dvw.js","assets/download-Dk-ZjtO6.js","assets/ellipsis-0k4rZLoy.js","assets/external-link-DjqjBmc3.js","assets/eye-CABVeTq0.js","assets/folder-open-CyzJ19I9.js","assets/link-2-D_ZKYUW7.js","assets/loader-circle-CifKLtgG.js","assets/markdown-view-C7kqotD-.js","assets/diagnostics-Bo0Z42P_.js","assets/dist-CY7CS_D3.js","assets/es2015-DBLcMg5B.js","assets/dist-CxGUk8J-.js","assets/file-image-CDUPkZvG.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/cn-0WouolD0.js","assets/bundle-mjs-rHxsej31.js","assets/app-link-CauYDM-y.js","assets/product-delivery-4gEqUIsK.js","assets/schemas-CCWMleym.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/xml-_d7dTN2Q.js","assets/mermaid-render-oOellPHt.js","assets/markdown-view-DG8DDkEA.css","assets/message-square-plus-XP0tGdlV.js","assets/minimize-2-DtOGrlpo.js","assets/paperclip-f1HujQY1.js","assets/pencil-DmIY3Oa-.js","assets/refresh-cw-BRlGaq2w.js","assets/save-DRDABU--.js","assets/preview-runtime-MJUo7XlD.js","assets/rotate-cw-LIg3Am9S.js","assets/search-DA7gz22f.js","assets/skeleton-DzdOeGYz.js","assets/turn-outcome-BSbEJx8h.js","assets/attachment-utils-core-BPYdUI6y.js","assets/electron-env-DHOGevH3.js","assets/use-async-resource-BHFGZCY2.js","assets/workspace-api-CIfedJeG.js","assets/files-GdwDamkp.js","assets/index.module-Cd9ENXfk.js","assets/session-api-7-TPnKv0.js","assets/gateway-startup-retry-D0i7dt51.js","assets/constants-D5Z-mUto.js","assets/interaction-BdhHBbYa.js","assets/composer-notifications-Drbl5lKS.js","assets/activity-store-BK11iD5x.js","assets/app-chrome-BeB4KgOf.js","assets/sliding-tab-list-CmcrqRzN.js","assets/sliding-indicator-hwz0sx3h.js","assets/dist-ZrL34Ps4.js","assets/dist-BuHnPloF.js","assets/floating-ui.dom-seOukHzT.js","assets/share-link-dialog-3RNzFIH3.js","assets/popover-select-CLsphyzA.js","assets/dist-GJ8-1PAx.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/globe-DSSGFWFn.js","assets/button-ChmVQg9O.js","assets/copy-text-row-BnSoJ0FX.js","assets/right-workspace-store-CFf15f36.js","assets/phone-workspace-store-B0mF8oMk.js","assets/theme-store-C7t81hG7.js","assets/middleware-Pd0e8Igk.js","assets/file-preview-surface-BSrIpn5C.js","assets/shares-api-B532SLIU.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{h as a,l as o,t as s,u as c}from"./chunk-KS7C4IRE-BPb7KheU.js";import{i as l,n as u,o as d}from"./locale-store-B4o4aDCg.js";import{t as f}from"./messages-hlOsXkQ7.js";import{a as p,i as m,n as h,o as g,r as _,s as v,t as y}from"./dist-CY7CS_D3.js";import{t as b}from"./arrow-right-DSSvoX71.js";import{f as x}from"./automation-display-DaVDNZz8.js";import{t as S}from"./check-DUBLcKHA.js";import{t as C}from"./chevron-down-ccbiQQz_.js";import{t as w}from"./chevron-right-BweFrslA.js";import{t as T}from"./circle-alert-BEjgurr2.js";import{t as E}from"./circle-check-C23XjkUj.js";import{t as D}from"./circle-pause-CN9jYH2s.js";import{t as O}from"./clock-3-DnrAnuyZ.js";import{t as k}from"./external-link-DjqjBmc3.js";import{t as A}from"./file-text-D12HbeVy.js";import{t as j}from"./grip-horizontal-CqVA8V1e.js";import{t as M}from"./history-DXH_9jsE.js";import{t as N}from"./list-todo-CTVRto8O.js";import{t as P}from"./lock-keyhole-DEK5kH0u.js";import{N as F,t as I}from"./markdown-view-C7kqotD-.js";import{t as L}from"./message-circle-Badhj-4D.js";import{t as R}from"./message-square-fVE7Ghj1.js";import{t as z}from"./panels-top-left-BKvp2Dag.js";import{t as B}from"./paperclip-f1HujQY1.js";import{t as V}from"./plus-Q2yW6OE7.js";import{t as H}from"./refresh-cw-BRlGaq2w.js";import{t as U}from"./search-DA7gz22f.js";import{t as W}from"./settings-2-D-csvaET.js";import{t as G}from"./sparkles-DHlfQFAF.js";import{t as K}from"./undo-2-6IMTwK4M.js";import{t as ee}from"./x-B_N4OPjy.js";import{t as q}from"./cn-0WouolD0.js";import{t as J}from"./skeleton-DzdOeGYz.js";import{o as te}from"./turn-outcome-BSbEJx8h.js";import{i as Y,l as ne,s as re}from"./capabilities-Clwtvm7F.js";import{i as ie}from"./vendor-swr-CdRzEUwF.js";import{S as ae,b as oe,c as se,g as ce,h as le,m as ue,n as de,s as fe,v as pe,w as me,y as he}from"./workspace-preview-store-DYd8E5bV.js";import{t as X}from"./button-ChmVQg9O.js";import{a as ge,i as _e,o as ve,r as ye,s as be}from"./dist-GJ8-1PAx.js";import{a as xe,c as Se,i as Ce,o as we,r as Te,s as Ee,t as De}from"./composer-payload-handoff-DKLokix8.js";import{t as Oe}from"./use-realtime-voice-tyo85cre.js";import{t as ke}from"./page-header-store-D_2QZ6Ps.js";import{t as Ae}from"./automation-api-CxLFngqe.js";import{r as je}from"./composer-handoff-params-DBpzHuNo.js";import{t as Me}from"./sliding-tab-list-CmcrqRzN.js";import{n as Ne,t as Pe}from"./use-composer-attachments-4FKbf6PB.js";import{n as Fe,r as Ie}from"./voice-input-shortcut-events-C-8Ts1gq.js";import{n as Le}from"./date-formatters-DukWSVwc.js";import{a as Re,i as ze,r as Be,t as Ve}from"./routine-panel-BjqenuXU.js";import{r as He,t as Ue}from"./task-result-evidence-DpV1mZJA.js";import{n as We}from"./tab-completion-input-CxtEp0aP.js";var Ge=n(),Z=e(t(),1);function Ke(e,t,n=!1){let[r,i]=(0,Z.useState)(null),[a,o]=(0,Z.useState)(!0),[s,c]=(0,Z.useState)(null),l=(0,Z.useRef)(0),u=(0,Z.useCallback)(async()=>{let t=++l.current;c(null);try{let r=await(n?ue(e,!0):ue(e));t===l.current&&i(r)}catch(e){t===l.current&&c(e instanceof Error?e.message:String(e))}finally{t===l.current&&o(!1)}},[e,n]);return(0,Z.useEffect)(()=>(u(),()=>{l.current++}),[u,t]),(0,Z.useEffect)(()=>{let e,t=1/0,n=n=>{let r=Date.now()+n;r>=t||(window.clearTimeout(e),t=r,e=window.setTimeout(()=>{e=void 0,t=1/0,u()},n))},r=()=>n(100),i=()=>n(750),a=()=>{document.visibilityState===`visible`&&r()},o=[`task-changed-v2`,`task-updated`,`session-created`,`agent-run-started`,`agent-run-ended`,`automation-run-completed`,`home-advisor-updated`,`gateway-realtime-connected`,`realtime-gap`,`focus`],s=[`session-updated`,`session-transcript-updated`];return o.forEach(e=>window.addEventListener(e,r)),s.forEach(e=>window.addEventListener(e,i)),document.addEventListener(`visibilitychange`,a),()=>{o.forEach(e=>window.removeEventListener(e,r)),s.forEach(e=>window.removeEventListener(e,i)),document.removeEventListener(`visibilitychange`,a),window.clearTimeout(e)}},[u]),{home:r,loading:a,loadError:s,setLoadError:c,load:u}}var Q=r(),$=12e3;function qe(e){let t=(0,Ge.c)(107),{variant:n,inputId:r,inputRef:i,intent:a,labels:o,attachments:s,isDragging:c,attachmentBusy:l,attachmentsFull:u,voice:d,chat:f,cancelAction:p,onIntentChange:m,onPickFiles:h,onRemoveAttachment:g,onPaste:_,onDragOver:v,onDragLeave:y,onDrop:b,onSubmit:x}=e,S=n===`inline`,C;t[0]!==s||t[1]!==a?(C=!!a.trim()||s.length>0,t[0]=s,t[1]=a,t[2]=C):C=t[2];let w=C,T=d.voiceActive&&d.phase!==`error`,E;t[3]!==x||t[4]!==d.voiceActive?(E=e=>{if(d.voiceActive){e.preventDefault();return}x(e)},t[3]=x,t[4]=d.voiceActive,t[5]=E):E=t[5];let D=S?`mx-auto mt-6 w-full overflow-hidden rounded-xl border border-edge bg-surface-base p-2 text-left shadow-surface transition-colors focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/15 sm:mt-8`:`flex min-h-0 flex-1 flex-col`,O;t[6]===D?O=t[7]:(O=q(`relative`,D),t[6]=D,t[7]=O);let k;t[8]!==S||t[9]!==c||t[10]!==o.dropFiles?(k=c?(0,Q.jsx)(`div`,{className:q(`pointer-events-none absolute inset-0 z-10 flex items-center justify-center bg-accent-soft/90 text-sm font-medium text-accent-fg backdrop-blur-[1px]`,S&&`rounded-2xl`),children:o.dropFiles}):null,t[8]=S,t[9]=c,t[10]=o.dropFiles,t[11]=k):k=t[11];let A=!S&&`flex min-h-0 flex-1 flex-col overflow-y-auto px-5 py-4`,j;t[12]===A?j=t[13]:(j=q(A),t[12]=A,t[13]=j);let M=S?`sr-only`:`mb-2 shrink-0 text-sm font-medium text-fg`,N;t[14]!==r||t[15]!==o.intentLabel||t[16]!==M?(N=(0,Q.jsx)(`label`,{htmlFor:r,className:M,children:o.intentLabel}),t[14]=r,t[15]=o.intentLabel,t[16]=M,t[17]=N):N=t[17];let P;t[18]!==l||t[19]!==f||t[20]!==d.audioLevel||t[21]!==d.cancelVoiceInput||t[22]!==d.confirmVoiceInput||t[23]!==d.elapsedLabel||t[24]!==d.error||t[25]!==d.finalTranscript||t[26]!==d.partialTranscript||t[27]!==d.phase||t[28]!==d.recordedDictation||t[29]!==d.retryVoiceInput||t[30]!==d.settingsRequired||t[31]!==d.voiceActive?(P=d.voiceActive?(0,Q.jsx)(Te,{phase:d.phase,elapsedLabel:d.elapsedLabel,recordedDictation:d.recordedDictation,audioLevel:d.audioLevel,partialTranscript:d.partialTranscript,finalTranscript:d.finalTranscript,error:d.error,settingsRequired:d.settingsRequired,disabled:l,chat:f,onCancel:d.cancelVoiceInput,onConfirm:d.confirmVoiceInput,onRetry:d.retryVoiceInput}):null,t[18]=l,t[19]=f,t[20]=d.audioLevel,t[21]=d.cancelVoiceInput,t[22]=d.confirmVoiceInput,t[23]=d.elapsedLabel,t[24]=d.error,t[25]=d.finalTranscript,t[26]=d.partialTranscript,t[27]=d.phase,t[28]=d.recordedDictation,t[29]=d.retryVoiceInput,t[30]=d.settingsRequired,t[31]=d.voiceActive,t[32]=P):P=t[32];let F=T&&`hidden`,I=S?`min-h-24 bg-transparent px-3 py-2`:`min-h-32 flex-1 rounded-xl border border-edge bg-surface-base p-3 focus:border-accent focus:ring-2 focus:ring-accent/20`,L;t[33]!==F||t[34]!==I?(L=q(`w-full resize-none text-sm font-normal leading-6 text-fg outline-none placeholder:text-fg-subtle`,F,I),t[33]=F,t[34]=I,t[35]=L):L=t[35];let R;t[36]===m?R=t[37]:(R=e=>m(e.target.value),t[36]=m,t[37]=R);let z=!S,V;t[38]!==r||t[39]!==i||t[40]!==a||t[41]!==o.intentPlaceholder||t[42]!==o.intentSuggestion||t[43]!==m||t[44]!==_||t[45]!==L||t[46]!==R||t[47]!==z?(V=(0,Q.jsx)(We,{ref:i,id:r,className:L,value:a,onChange:R,onPaste:_,suggestion:o.intentSuggestion,onAcceptSuggestion:m,onKeyDown:Je,placeholder:o.intentPlaceholder,maxLength:$,autoFocus:z}),t[38]=r,t[39]=i,t[40]=a,t[41]=o.intentPlaceholder,t[42]=o.intentSuggestion,t[43]=m,t[44]=_,t[45]=L,t[46]=R,t[47]=z,t[48]=V):V=t[48];let H=S?`border-b-0 bg-transparent px-3 pb-2 pt-0`:`mt-3 border-b-0 bg-transparent px-0 pb-0`,U;t[49]!==s||t[50]!==g||t[51]!==H?(U=(0,Q.jsx)(Ne,{attachments:s,topPadded:!1,onRemove:g,className:H}),t[49]=s,t[50]=g,t[51]=H,t[52]=U):U=t[52];let W;t[53]!==S||t[54]!==a.length||t[55]!==o.shortcut?(W=S?null:(0,Q.jsxs)(`div`,{className:`mt-2 flex shrink-0 items-center justify-between gap-3 text-[11px] text-fg-subtle`,children:[(0,Q.jsx)(`span`,{children:o.shortcut}),(0,Q.jsxs)(`span`,{className:`tabular-nums`,children:[a.length.toLocaleString(),` / `,$.toLocaleString()]})]}),t[53]=S,t[54]=a.length,t[55]=o.shortcut,t[56]=W):W=t[56];let K;t[57]!==P||t[58]!==V||t[59]!==U||t[60]!==W||t[61]!==j||t[62]!==N?(K=(0,Q.jsxs)(`div`,{className:j,children:[N,P,V,U,W]}),t[57]=P,t[58]=V,t[59]=U,t[60]=W,t[61]=j,t[62]=N,t[63]=K):K=t[63];let ee=S?`border-edge-subtle px-1 pt-2`:`border-edge px-5 py-4`,J;t[64]===ee?J=t[65]:(J=q(`flex shrink-0 items-center gap-2 border-t`,ee),t[64]=ee,t[65]=J);let te=!S&&`mr-auto`,Y;t[66]===te?Y=t[67]:(Y=q(`flex items-center gap-1`,te),t[66]=te,t[67]=Y);let ne=l||u,re;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Q.jsx)(B,{className:`size-4`,"aria-hidden":!0}),t[68]=re):re=t[68];let ie;t[69]!==o.attachTitle||t[70]!==h||t[71]!==ne?(ie=(0,Q.jsx)(X,{type:`button`,variant:`ghost`,className:`size-9 rounded-lg p-0`,disabled:ne,title:o.attachTitle,"aria-label":o.attachTitle,onClick:h,children:re}),t[69]=o.attachTitle,t[70]=h,t[71]=ne,t[72]=ie):ie=t[72];let ae;t[73]!==l||t[74]!==f||t[75]!==d.startVoiceInput||t[76]!==d.voiceActive?(ae=d.voiceActive?null:(0,Q.jsx)(we,{disabled:l,chat:f,onStart:d.startVoiceInput}),t[73]=l,t[74]=f,t[75]=d.startVoiceInput,t[76]=d.voiceActive,t[77]=ae):ae=t[77];let oe;t[78]!==Y||t[79]!==ie||t[80]!==ae?(oe=(0,Q.jsxs)(`div`,{className:Y,children:[ie,ae]}),t[78]=Y,t[79]=ie,t[80]=ae,t[81]=oe):oe=t[81];let se;t[82]!==p||t[83]!==S||t[84]!==o.shortcut?(se=S?(0,Q.jsx)(`span`,{className:`hidden text-[11px] text-fg-subtle sm:inline`,children:o.shortcut}):p,t[82]=p,t[83]=S,t[84]=o.shortcut,t[85]=se):se=t[85];let ce=S?`ml-auto h-9 rounded-lg px-3.5 text-xs`:`min-w-32`,le=!w||l||d.voiceActive,ue=S?`size-3.5`:`size-4`,de;t[86]===ue?de=t[87]:(de=(0,Q.jsx)(G,{className:ue,"aria-hidden":!0}),t[86]=ue,t[87]=de);let fe;t[88]!==o.submit||t[89]!==ce||t[90]!==le||t[91]!==de?(fe=(0,Q.jsxs)(X,{type:`submit`,variant:`primary`,className:ce,disabled:le,children:[de,o.submit]}),t[88]=o.submit,t[89]=ce,t[90]=le,t[91]=de,t[92]=fe):fe=t[92];let pe;t[93]!==J||t[94]!==oe||t[95]!==se||t[96]!==fe?(pe=(0,Q.jsxs)(`div`,{className:J,children:[oe,se,fe]}),t[93]=J,t[94]=oe,t[95]=se,t[96]=fe,t[97]=pe):pe=t[97];let me;return t[98]!==y||t[99]!==v||t[100]!==b||t[101]!==E||t[102]!==K||t[103]!==pe||t[104]!==O||t[105]!==k?(me=(0,Q.jsxs)(`form`,{onSubmit:E,onDragOver:v,onDragLeave:y,onDrop:b,className:O,children:[k,K,pe]}),t[98]=y,t[99]=v,t[100]=b,t[101]=E,t[102]=K,t[103]=pe,t[104]=O,t[105]=k,t[106]=me):me=t[106],me}function Je(e){e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}function Ye(e){let t=(0,Ge.c)(12),{href:n,children:r,onOpen:i}=e,a=o();if(n&&/^https?:\/\//i.test(n)){let e;return t[0]!==r||t[1]!==n?(e=(0,Q.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,className:`rounded-sm text-accent-fg hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r}),t[0]=r,t[1]=n,t[2]=e):e=t[2],e}if(n?.startsWith(`/`)&&!n.startsWith(`//`)){let e=`${a.pathname}${a.search}`,o;t[3]!==n||t[4]!==e?(o=F(e,n),t[3]=n,t[4]=e,t[5]=o):o=t[5];let c;return t[6]!==r||t[7]!==i||t[8]!==o?(c=(0,Q.jsx)(s,{to:o,className:`rounded-sm text-accent-fg hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:i,children:r}),t[6]=r,t[7]=i,t[8]=o,t[9]=c):c=t[9],c}let c;return t[10]===r?c=t[11]:(c=(0,Q.jsx)(`span`,{children:r}),t[10]=r,t[11]=c),c}function Xe(e){let t=(0,Ge.c)(6),{opportunity:n,onOpen:r}=e,i=u(Ze),a,o;if(t[0]!==i||t[1]!==r||t[2]!==n.evidence||t[3]!==n.evidencePresentation){o=Symbol.for(`react.early_return_sentinel`);bb0:{let e=f(i).projectsPage.home.advisorEvidenceCopy,t=n.evidencePresentation,s=t?.locale===i?t.groups:void 0,c=new Intl.DateTimeFormat(i===`zh`?`zh-CN`:`en`,{dateStyle:`medium`,timeStyle:`short`}),l=t=>(0,Q.jsx)(`ul`,{className:`mt-2 space-y-3 border-l border-edge pl-3 text-xs leading-5 text-fg-muted`,children:t.map(t=>{let n=!!(t.href&&(/^https?:\/\//i.test(t.href)||t.href.startsWith(`/`)&&!t.href.startsWith(`//`)));return(0,Q.jsxs)(`li`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:[(0,Q.jsxs)(`p`,{className:`text-fg-subtle`,children:[e.sources[t.sourceType],` · `,(0,Q.jsx)(`time`,{dateTime:new Date(t.observedAt).toISOString(),children:c.format(t.observedAt)})]}),(0,Q.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap`,children:t.observation}),(0,Q.jsx)(`p`,{className:`mt-1`,children:n?(0,Q.jsx)(Ye,{href:t.href,onOpen:r,children:e.openSource}):e.noSource})]},t.id)})}),u=(t,r)=>(0,Q.jsxs)(`li`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:[(0,Q.jsx)(`p`,{className:`text-fg-muted`,children:t.summary}),(0,Q.jsxs)(`details`,{className:`mt-1`,children:[(0,Q.jsxs)(`summary`,{className:`min-h-9 cursor-pointer rounded-sm py-2 text-fg-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[e.originals,` · `,e.sourceCount.replace(`{{count}}`,String(t.evidenceIds.length))]}),l(n.evidence.filter(e=>t.evidenceIds.includes(e.id)))]})]},r);if(!s){o=(0,Q.jsxs)(`div`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:[(0,Q.jsx)(`p`,{children:e.unavailable}),(0,Q.jsxs)(`details`,{children:[(0,Q.jsx)(`summary`,{className:`min-h-9 cursor-pointer rounded-sm py-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:e.originals}),l(n.evidence)]})]});break bb0}a=(0,Q.jsxs)(`div`,{className:`mt-2 text-xs leading-5`,children:[(0,Q.jsx)(`p`,{className:`mb-3 text-fg-subtle`,children:e.aiNote}),(0,Q.jsx)(`ul`,{className:`space-y-3 border-l border-edge pl-3`,children:s.slice(0,3).map(u)}),s.length>3?(0,Q.jsxs)(`details`,{className:`mt-2`,children:[(0,Q.jsx)(`summary`,{className:`min-h-9 cursor-pointer rounded-sm py-2 text-fg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:e.more.replace(`{{count}}`,String(s.length-3))}),(0,Q.jsx)(`ul`,{className:`space-y-3 border-l border-edge pl-3`,children:s.slice(3).map(u)})]}):null]})}t[0]=i,t[1]=r,t[2]=n.evidence,t[3]=n.evidencePresentation,t[4]=a,t[5]=o}else a=t[4],o=t[5];return o===Symbol.for(`react.early_return_sentinel`)?a:o}function Ze(e){return e.language}function Qe(e){let t=(0,Ge.c)(4),{label:n,onClick:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(M,{className:`size-3.5`,"aria-hidden":!0}),t[0]=i):i=t[0];let a;return t[1]!==n||t[2]!==r?(a=(0,Q.jsxs)(`button`,{type:`button`,className:`inline-flex min-h-9 items-center gap-1.5 rounded-lg px-2 text-xs font-medium text-fg-muted transition-colors duration-150 hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:r,children:[i,n]}),t[1]=n,t[2]=r,t[3]=a):a=t[3],a}function $e(e){let t=(0,Ge.c)(63),{opportunity:n,copy:r,onOpenHistory:i}=e,a,o,s,c,l,u;if(t[0]!==r.aiLabel||t[1]!==r.automationAction||t[2]!==r.automationHint||t[3]!==r.history||t[4]!==r.minutes||t[5]!==r.needsSetup||t[6]!==r.why||t[7]!==i||t[8]!==n.capabilities||t[9]!==n.continuation||t[10]!==n.estimatedMinutes||t[11]!==n.outcome||t[12]!==n.rationale||t[13]!==n.title){let e=n.capabilities.filter(et),d;t[20]===r.aiLabel?d=t[21]:(d=(0,Q.jsx)(`span`,{children:r.aiLabel}),t[20]=r.aiLabel,t[21]=d);let f;t[22]!==r.minutes||t[23]!==n.estimatedMinutes?(f=n.estimatedMinutes?(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Q.jsx)(O,{className:`size-3.5`,"aria-hidden":!0}),n.estimatedMinutes,` `,r.minutes]}):null,t[22]=r.minutes,t[23]=n.estimatedMinutes,t[24]=f):f=t[24];let p;t[25]!==d||t[26]!==f?(p=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[d,f]}),t[25]=d,t[26]=f,t[27]=p):p=t[27];let m;t[28]!==r.history||t[29]!==i?(m=(0,Q.jsx)(Qe,{label:r.history,onClick:i}),t[28]=r.history,t[29]=i,t[30]=m):m=t[30],t[31]!==m||t[32]!==p?(a=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[p,m]}),t[31]=m,t[32]=p,t[33]=a):a=t[33],t[34]===n.title?o=t[35]:(o=(0,Q.jsx)(`h3`,{className:`mt-3 text-xl font-semibold leading-7 tracking-tight text-fg`,children:n.title}),t[34]=n.title,t[35]=o),t[36]===n.outcome?s=t[37]:(s=(0,Q.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:n.outcome}),t[36]=n.outcome,t[37]=s);let h;t[38]===r.why?h=t[39]:(h=(0,Q.jsxs)(`span`,{className:`font-medium text-fg`,children:[r.why,`:`]}),t[38]=r.why,t[39]=h),t[40]!==n.rationale||t[41]!==h?(c=(0,Q.jsxs)(`p`,{className:`mt-4 text-sm leading-6 text-fg-muted`,children:[h,n.rationale]}),t[40]=n.rationale,t[41]=h,t[42]=c):c=t[42],t[43]!==r.automationAction||t[44]!==r.automationHint||t[45]!==n.continuation?(l=n.continuation?.kind===`automation`?(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-col gap-3 rounded-xl border border-edge bg-surface-subtle p-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,Q.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:r.automationHint}),(0,Q.jsx)(`a`,{href:`#${n.continuation.href}`,className:`inline-flex min-h-11 shrink-0 items-center rounded-lg px-3 text-xs font-medium text-accent hover:bg-accent-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r.automationAction})]}):null,t[43]=r.automationAction,t[44]=r.automationHint,t[45]=n.continuation,t[46]=l):l=t[46],u=e.length>0?(0,Q.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,"aria-label":r.needsSetup,children:e.map(e=>(0,Q.jsxs)(`a`,{href:`#${e.recoveryPath??`/settings`}`,className:`rounded-full border border-accent/25 bg-accent-soft px-2.5 py-1 text-xs text-accent hover:border-accent/50`,children:[r.needsSetup,` · `,e.capability]},`${e.kind}:${e.capability}`))}):null,t[0]=r.aiLabel,t[1]=r.automationAction,t[2]=r.automationHint,t[3]=r.history,t[4]=r.minutes,t[5]=r.needsSetup,t[6]=r.why,t[7]=i,t[8]=n.capabilities,t[9]=n.continuation,t[10]=n.estimatedMinutes,t[11]=n.outcome,t[12]=n.rationale,t[13]=n.title,t[14]=a,t[15]=o,t[16]=s,t[17]=c,t[18]=l,t[19]=u}else a=t[14],o=t[15],s=t[16],c=t[17],l=t[18],u=t[19];let d;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(C,{className:`size-3.5 transition-transform group-open:rotate-180`,"aria-hidden":!0}),t[47]=d):d=t[47];let f;t[48]===r.evidence?f=t[49]:(f=(0,Q.jsxs)(`summary`,{className:`flex min-h-9 cursor-pointer list-none items-center gap-1.5 text-xs font-medium text-fg-muted hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[r.evidence,d]}),t[48]=r.evidence,t[49]=f);let p;t[50]===n?p=t[51]:(p=(0,Q.jsx)(Xe,{opportunity:n}),t[50]=n,t[51]=p);let m;t[52]!==f||t[53]!==p?(m=(0,Q.jsxs)(`details`,{className:`mt-4 group`,children:[f,p]}),t[52]=f,t[53]=p,t[54]=m):m=t[54];let h;return t[55]!==a||t[56]!==m||t[57]!==o||t[58]!==s||t[59]!==c||t[60]!==l||t[61]!==u?(h=(0,Q.jsxs)(Q.Fragment,{children:[a,o,s,c,l,u,m]}),t[55]=a,t[56]=m,t[57]=o,t[58]=s,t[59]=c,t[60]=l,t[61]=u,t[62]=h):h=t[62],h}function et(e){return e.readiness!==`ready`}function tt(e){let t=(0,Ge.c)(142),{advisor:n,copy:r,busy:i,onRefresh:a,onAction:o,onFeedback:s,onClarification:c,onOpenHistory:l,preflight:u,receipt:d}=e,[f,p]=(0,Z.useState)(),m;t[0]!==n.alternatives||t[1]!==n.primary||t[2]!==n.state?(m=n.state===`ready`?[n.primary,...n.alternatives]:[],t[0]=n.alternatives,t[1]=n.primary,t[2]=n.state,t[3]=m):m=t[3];let h=m,g;t[4]!==h||t[5]!==f?(g=h.find(e=>e.id===f)??h[0],t[4]=h,t[5]=f,t[6]=g):g=t[6];let _=g,v;t[7]===h[0]?.id?v=t[8]:(v=()=>p(h[0]?.id),t[7]=h[0]?.id,t[8]=v);let y=h[0]?.id,b;if(t[9]!==n.state||t[10]!==y?(b=[n.state,y],t[9]=n.state,t[10]=y,t[11]=b):b=t[11],(0,Z.useEffect)(v,b),n.state===`disabled`)return null;if(d){let e;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(E,{className:`size-5 shrink-0 text-success`,"aria-hidden":!0}),t[12]=e):e=t[12];let n;t[13]===d.title?n=t[14]:(n=(0,Q.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:d.title}),t[13]=d.title,t[14]=n);let i;t[15]===d.detail?i=t[16]:(i=(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:d.detail}),t[15]=d.detail,t[16]=i);let a;t[17]!==n||t[18]!==i?(a=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[n,i]}),t[17]=n,t[18]=i,t[19]=a):a=t[19];let o;t[20]!==r.history||t[21]!==l?(o=(0,Q.jsx)(Qe,{label:r.history,onClick:l}),t[20]=r.history,t[21]=l,t[22]=o):o=t[22];let s=`#${d.href}`,c;t[23]!==r.viewProgress||t[24]!==s?(c=(0,Q.jsx)(X,{asChild:!0,variant:`secondary`,className:`min-h-10 text-xs`,children:(0,Q.jsx)(`a`,{href:s,children:r.viewProgress})}),t[23]=r.viewProgress,t[24]=s,t[25]=c):c=t[25];let u;t[26]!==o||t[27]!==c?(u=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[o,c]}),t[26]=o,t[27]=c,t[28]=u):u=t[28];let f;return t[29]!==u||t[30]!==a?(f=(0,Q.jsx)(`section`,{className:`mt-7 rounded-2xl border border-success/25 bg-success-soft px-5 py-4`,role:`status`,children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center`,children:[e,a,u]})}),t[29]=u,t[30]=a,t[31]=f):f=t[31],f}if(n.state===`quiet`||n.state===`refreshing`)return null;if(n.state===`clarification`){let e;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(G,{className:`size-4`,"aria-hidden":!0}),t[32]=e):e=t[32];let a;t[33]===r.aiLabel?a=t[34]:(a=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-accent`,children:[e,r.aiLabel]}),t[33]=r.aiLabel,t[34]=a);let o;t[35]!==r.history||t[36]!==l?(o=(0,Q.jsx)(Qe,{label:r.history,onClick:l}),t[35]=r.history,t[36]=l,t[37]=o):o=t[37];let s;t[38]!==a||t[39]!==o?(s=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[a,o]}),t[38]=a,t[39]=o,t[40]=s):s=t[40];let u;t[41]===n.question.question?u=t[42]:(u=(0,Q.jsx)(`h3`,{id:`home-advisor-question`,className:`mt-3 text-lg font-semibold text-fg`,children:n.question.question}),t[41]=n.question.question,t[42]=u);let d;if(t[43]!==n.question.options||t[44]!==n.question.question||t[45]!==i||t[46]!==c){let e;t[48]!==n.question.question||t[49]!==i||t[50]!==c?(e=e=>(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:`min-h-11`,disabled:i,onClick:()=>c(n.question.question,e.label),children:e.label},e.id),t[48]=n.question.question,t[49]=i,t[50]=c,t[51]=e):e=t[51],d=n.question.options.map(e),t[43]=n.question.options,t[44]=n.question.question,t[45]=i,t[46]=c,t[47]=d}else d=t[47];let f;t[52]===d?f=t[53]:(f=(0,Q.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:d}),t[52]=d,t[53]=f);let p;return t[54]!==u||t[55]!==f||t[56]!==s?(p=(0,Q.jsxs)(`section`,{className:`mt-7 rounded-2xl border border-accent/25 bg-surface-base px-5 py-5`,"aria-labelledby":`home-advisor-question`,children:[s,u,f]}),t[54]=u,t[55]=f,t[56]=s,t[57]=p):p=t[57],p}if(!_)return null;let x=u?.opportunityId===_.id?u.value:void 0,S;t[58]!==n.stale||t[59]!==r.refreshing?(S=n.stale?(0,Q.jsxs)(`p`,{className:`mb-3 inline-flex items-center gap-2 text-xs text-accent`,children:[(0,Q.jsx)(H,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),r.refreshing]}):null,t[58]=n.stale,t[59]=r.refreshing,t[60]=S):S=t[60];let w;t[61]!==r||t[62]!==l||t[63]!==_?(w=(0,Q.jsx)($e,{opportunity:_,copy:r,onOpenHistory:l}),t[61]=r,t[62]=l,t[63]=_,t[64]=w):w=t[64];let T;t[65]!==i||t[66]!==r.configure||t[67]!==r.degradedStart||t[68]!==r.setupHint||t[69]!==r.setupTitle||t[70]!==o||t[71]!==_||t[72]!==x?(T=x?.state===`needs_setup`?(0,Q.jsx)(`div`,{className:`mt-5 rounded-xl border border-accent/25 bg-accent-soft/40 p-4`,role:`alert`,"aria-live":`polite`,children:(0,Q.jsxs)(`div`,{className:`flex gap-3`,children:[(0,Q.jsx)(W,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:r.setupTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:r.setupHint}),(0,Q.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs leading-5 text-fg-muted`,children:x.blockers.map(nt)}),(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[x.recoveryActions.map(e=>(0,Q.jsxs)(`a`,{href:`#${e.href}`,className:`inline-flex min-h-11 items-center rounded-lg border border-accent/30 px-3 text-xs font-medium text-accent hover:bg-accent-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[r.configure,` · `,e.capability]},e.capability)),x.degradedAction?(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:`min-h-11`,disabled:i,onClick:()=>o(_,`degraded_start`),children:r.degradedStart}):null]})]})]})}):null,t[65]=i,t[66]=r.configure,t[67]=r.degradedStart,t[68]=r.setupHint,t[69]=r.setupTitle,t[70]=o,t[71]=_,t[72]=x,t[73]=T):T=t[73];let D;t[74]!==i||t[75]!==r.start||t[76]!==o||t[77]!==_?(D=_.actions.canStart?(0,Q.jsxs)(X,{type:`button`,variant:`primary`,className:`min-h-11`,disabled:i,onClick:()=>o(_,`start`),children:[(0,Q.jsx)(G,{className:`size-4`,"aria-hidden":!0}),r.start]}):null,t[74]=i,t[75]=r.start,t[76]=o,t[77]=_,t[78]=D):D=t[78];let O;t[79]!==i||t[80]!==r.discuss||t[81]!==o||t[82]!==_?(O=_.actions.canDiscuss?(0,Q.jsxs)(X,{type:`button`,variant:`secondary`,className:`min-h-11`,disabled:i,onClick:()=>o(_,`discuss`),children:[(0,Q.jsx)(L,{className:`size-4`,"aria-hidden":!0}),r.discuss]}):null,t[79]=i,t[80]=r.discuss,t[81]=o,t[82]=_,t[83]=O):O=t[83];let k;t[84]!==O||t[85]!==D?(k=(0,Q.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center gap-2`,children:[D,O]}),t[84]=O,t[85]=D,t[86]=k):k=t[86];let A;t[87]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsx)(C,{className:`size-3.5`,"aria-hidden":!0}),t[87]=A):A=t[87];let j;t[88]===r.more?j=t[89]:(j=(0,Q.jsxs)(`summary`,{className:`inline-flex min-h-9 cursor-pointer list-none items-center gap-1.5 rounded-lg px-2 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:ring-2 focus-visible:ring-accent`,children:[r.more,A]}),t[88]=r.more,t[89]=j);let M;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(H,{className:`size-4`,"aria-hidden":!0}),t[90]=M):M=t[90];let N;t[91]!==i||t[92]!==r.refresh||t[93]!==a?(N=(0,Q.jsxs)(X,{type:`button`,variant:`ghost`,className:`min-h-11`,disabled:i,onClick:a,title:r.refresh,children:[M,r.refresh]}),t[91]=i,t[92]=r.refresh,t[93]=a,t[94]=N):N=t[94];let P;t[95]===r.feedback?P=t[96]:(P=(0,Q.jsx)(`summary`,{className:`flex min-h-11 cursor-pointer list-none items-center rounded-lg px-3 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r.feedback}),t[95]=r.feedback,t[96]=P);let F;t[97]===r.alreadyDone?F=t[98]:(F=[`already_done`,r.alreadyDone],t[97]=r.alreadyDone,t[98]=F);let I;t[99]===r.irrelevant?I=t[100]:(I=[`irrelevant`,r.irrelevant],t[99]=r.irrelevant,t[100]=I);let R;t[101]===r.later?R=t[102]:(R=[`too_early`,r.later],t[101]=r.later,t[102]=R);let z;t[103]===r.sourceIncorrect?z=t[104]:(z=[`source_incorrect`,r.sourceIncorrect],t[103]=r.sourceIncorrect,t[104]=z);let B;t[105]===r.lessLikeThis?B=t[106]:(B=[`less_like_this`,r.lessLikeThis],t[105]=r.lessLikeThis,t[106]=B);let V;t[107]!==F||t[108]!==I||t[109]!==R||t[110]!==z||t[111]!==B?(V=[F,I,R,z,B],t[107]=F,t[108]=I,t[109]=R,t[110]=z,t[111]=B,t[112]=V):V=t[112];let U=V,K;t[113]!==i||t[114]!==s||t[115]!==_||t[116]!==U?(K=(0,Q.jsx)(`div`,{className:`absolute right-0 z-20 mt-1 w-44 rounded-xl border border-edge bg-surface-overlay p-1 shadow-float`,children:U.map(e=>{let[t,n]=e;return(0,Q.jsx)(`button`,{type:`button`,disabled:i,className:`min-h-10 w-full rounded-lg px-3 text-left text-sm text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>s(_,t),children:n},t)})}),t[113]=i,t[114]=s,t[115]=_,t[116]=U,t[117]=K):K=t[117];let ee;t[118]!==P||t[119]!==K?(ee=(0,Q.jsxs)(`details`,{className:`relative`,children:[P,K]}),t[118]=P,t[119]=K,t[120]=ee):ee=t[120];let q;t[121]!==N||t[122]!==ee?(q=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[N,ee]}),t[121]=N,t[122]=ee,t[123]=q):q=t[123];let J;t[124]!==i||t[125]!==r.alternatives||t[126]!==h||t[127]!==_.id?(J=h.length>1?(0,Q.jsxs)(`div`,{className:`border-t border-edge-subtle pt-2`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium text-fg-subtle`,children:r.alternatives}),(0,Q.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:h.filter(e=>e.id!==_.id).map(e=>(0,Q.jsx)(`button`,{type:`button`,disabled:i,className:`min-h-10 rounded-lg border border-edge px-3 text-left text-sm text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>p(e.id),children:e.title},e.id))})]}):null,t[124]=i,t[125]=r.alternatives,t[126]=h,t[127]=_.id,t[128]=J):J=t[128];let te;t[129]!==j||t[130]!==q||t[131]!==J?(te=(0,Q.jsxs)(`details`,{className:`mt-1`,children:[j,q,J]}),t[129]=j,t[130]=q,t[131]=J,t[132]=te):te=t[132];let Y;t[133]!==k||t[134]!==te||t[135]!==S||t[136]!==w||t[137]!==T?(Y=(0,Q.jsxs)(`div`,{className:`px-5 py-5 sm:px-6`,children:[S,w,T,k,te]}),t[133]=k,t[134]=te,t[135]=S,t[136]=w,t[137]=T,t[138]=Y):Y=t[138];let ne;return t[139]!==r.aiLabel||t[140]!==Y?(ne=(0,Q.jsx)(`section`,{className:`mt-7 rounded-2xl border border-accent/25 bg-surface-base`,"aria-label":r.aiLabel,children:Y}),t[139]=r.aiLabel,t[140]=Y,t[141]=ne):ne=t[141],ne}function nt(e){return(0,Q.jsx)(`li`,{children:e.message},`${e.kind}:${e.capability}`)}function rt(e){let t=(0,Ge.c)(11),{observation:n,language:r,onUpdated:i}=e,a=r===`zh`,o=n.followUps??[],[s,c]=(0,Z.useState)(!1),[u,f]=(0,Z.useState)(``),[p,m]=(0,Z.useState)(``),[h,g]=(0,Z.useState)(``),_;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(_=[],t[0]=_):_=t[0];let[v,y]=(0,Z.useState)(_),[b,x]=(0,Z.useState)(!0),[S,C]=(0,Z.useState)(!1),[w,T]=(0,Z.useState)(``),E;t[1]!==n.topics||t[2]!==a?(E=e=>{f(e?.goal??``),g(e?.firstStep??(a?`先整理已有线索、已知事实和资料缺口,再提出下一步建议。`:`Organize existing evidence, known facts and missing material, then propose the next step.`)),m(``),y(e?[e.topicId]:n.topics.slice(0,3).map(dt)),c(!0),T(``)},t[1]=n.topics,t[2]=a,t[3]=E):E=t[3];let D=E,O;t[4]!==r||t[5]!==i?(O=e=>(0,Q.jsx)(ft,{followUp:e,language:r,onUpdated:i},e.id),t[4]=r,t[5]=i,t[6]=O):O=t[6];let k=o.filter(ut).map(O),A=n.status===`active`?(0,Q.jsxs)(Q.Fragment,{children:[o.some(lt)?null:(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(`p`,{className:`text-base font-semibold text-fg`,children:a?`把一件事推进到完成`:`Keep one goal moving until it is done`}),(0,Q.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:a?`记住目标和进展,一步步整理证据、查清问题。有新资料继续推进,遇到阻塞会告诉你缺什么。`:`Keep the goal and its progress together. Work through the evidence, continue when input arrives, and make blockers clear.`})]}),s?null:(n.followUpCandidates??[]).map(e=>(0,Q.jsxs)(`div`,{className:`space-y-2 rounded-lg bg-surface-inset p-3`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a?`这条请求可能需要继续跟进,请先确认目标`:`This request may need follow-through. Confirm the goal first.`}),(0,Q.jsx)(`p`,{className:`line-clamp-2 text-sm text-fg`,children:e.goal}),(0,Q.jsx)(X,{variant:`tonal`,onClick:()=>D(e),children:a?`设为持续目标`:`Set up a continuing goal`})]},e.topicId)),s?(0,Q.jsxs)(`form`,{className:`space-y-3 rounded-lg bg-surface-inset p-3`,onSubmit:e=>{e.preventDefault(),!S&&(C(!0),T(``),d(l(`/api/home/follow-ups`),{method:`POST`,body:JSON.stringify({goal:u,criteria:p.split(`
3
3
  `).map(ot).filter(Boolean),firstStep:h,topicIds:v,autoContinue:b,stepBudget:3,locale:r,expectedObservationRevision:n.revision,idempotencyKey:crypto.randomUUID()})}).then(e=>{te.parse(e),c(!1),i()}).catch(e=>{T(e instanceof Error?e.message:String(e)),i()}).finally(()=>C(!1)))},children:[(0,Q.jsxs)(`label`,{className:`block text-sm text-fg`,children:[a?`希望最终达成什么?`:`What outcome should we reach?`,(0,Q.jsx)(`textarea`,{required:!0,maxLength:1e3,value:u,onChange:e=>f(e.target.value),placeholder:a?`例如:查清 connector 重复请求的原因,并整理可验证的解决方案。`:`For example: understand duplicate connector requests and prepare a verifiable resolution.`,className:`mt-1 min-h-20 w-full rounded-lg border border-edge bg-surface-panel p-2`})]}),(0,Q.jsxs)(`label`,{className:`block text-sm text-fg`,children:[a?`达到什么标准才算完成?每行一条,最多 10 项`:`What counts as done? One criterion per line`,(0,Q.jsx)(`textarea`,{required:!0,maxLength:1e4,value:p,onChange:e=>m(e.target.value),placeholder:a?`明确复现条件
4
4
  原因有日志或代码证据支持
5
5
  给出修复后需要通过的验证项`:`Reproduction conditions are clear
6
6
  Evidence supports the cause
7
- Verification checks are defined`,className:`mt-1 min-h-24 w-full rounded-lg border border-edge bg-surface-panel p-2`})]}),(0,Q.jsxs)(`label`,{className:`block text-sm text-fg`,children:[a?`现在先推进哪一步?`:`What is the first step?`,(0,Q.jsx)(`input`,{required:!0,maxLength:1e3,value:h,onChange:e=>g(e.target.value),placeholder:a?`整理现有线索、已知事实和缺少的日志。`:`Organize existing reports, known facts and missing logs.`,className:`mt-1 w-full rounded-lg border border-edge bg-surface-panel p-2`})]}),(0,Q.jsxs)(`details`,{children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer text-xs text-fg-muted`,children:a?`参考资料范围:已选 ${v.length} 段对话`:`Source scope: ${v.length} selected conversations`}),(0,Q.jsx)(`div`,{className:`mt-2 max-h-40 space-y-2 overflow-y-auto`,children:n.topics.map(e=>(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:v.includes(e.id),disabled:!v.includes(e.id)&&v.length>=8,onChange:t=>y(t.target.checked?[...v,e.id]:v.filter(t=>t!==e.id))}),(0,Q.jsx)(`span`,{className:`truncate`,children:e.title})]},e.id))})]}),n.topics.length?null:(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:a?`先在对话里提供这件事的背景资料,开启观察后再选为参考来源。`:`First provide the background in a chat, then select it as a source.`}),(0,Q.jsxs)(`label`,{className:`flex items-start gap-2 text-xs leading-5 text-fg-muted`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:b,onChange:e=>x(e.target.checked),className:`mt-1`}),a?`资料齐备时自动继续本轮分析,最多 3 步;缺资料或检查未通过就停下。只整理资料和分析,不修改外部服务。`:`Continue private analysis automatically, up to 3 steps this round. Stop for missing input or failed checks. No changes to external services.`]}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a?`一份阶段结果不等于整个目标完成。最终由你对照完成标准验收,随时可以暂停或结束。`:`A step result does not complete the goal. You review the final criteria, and can pause or end at any time.`}),w?(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:w}):null,(0,Q.jsx)(X,{variant:`primary`,type:`submit`,disabled:S||!v.length,children:a?`确认目标,开始第一步`:`Confirm goal and start`}),(0,Q.jsx)(X,{variant:`ghost`,disabled:S,onClick:()=>c(!1),children:a?`取消`:`Cancel`})]}):(0,Q.jsx)(X,{variant:o.some(ct)?`ghost`:`primary`,onClick:()=>D(),children:o.some(st)?a?`再交给我一件事`:`Add another goal`:a?`交给我持续推进一件事`:`Keep a goal moving`})]}):null,j=o.some(at)?(0,Q.jsxs)(`details`,{children:[(0,Q.jsx)(`summary`,{className:`text-xs text-fg-muted`,children:a?`已结束的目标`:`Past goals`}),o.filter(it).map(e=>(0,Q.jsx)(ft,{followUp:e,language:r,onUpdated:i},e.id))]}):null,M;return t[7]!==k||t[8]!==A||t[9]!==j?(M=(0,Q.jsxs)(`div`,{className:`mt-3 space-y-4`,children:[k,A,j]}),t[7]=k,t[8]=A,t[9]=j,t[10]=M):M=t[10],M}function it(e){return[`done`,`ended`].includes(e.status)}function at(e){return[`done`,`ended`].includes(e.status)}function ot(e){return e.trim()}function st(e){return![`done`,`ended`].includes(e.status)}function ct(e){return![`done`,`ended`].includes(e.status)}function lt(e){return![`done`,`ended`].includes(e.status)}function ut(e){return![`done`,`ended`].includes(e.status)}function dt(e){return e.id}function ft(e){let t=(0,Ge.c)(100),{followUp:n,language:r,onUpdated:i}=e,a=r===`zh`,[o,s]=(0,Z.useState)(),[c,u]=(0,Z.useState)(!1),[f,p]=(0,Z.useState)(``),[m,h]=(0,Z.useState)(``),[g,_]=(0,Z.useState)(``),[v,y]=(0,Z.useState)(!1),[b,x]=(0,Z.useState)(),[S,C]=(0,Z.useState)(!1),[w,T]=(0,Z.useState)(!1),E;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(E=[],t[0]=E):E=t[0];let[D,O]=(0,Z.useState)(E),[k,A]=(0,Z.useState)(``),j=o&&o.revision>n.revision?o:n,M;t[1]===j.steps?M=t[2]:(M=j.steps.at(-1),t[1]=j.steps,t[2]=M);let N=M,P;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(P=[`done`,`ended`],t[3]=P):P=t[3];let F=P.includes(j.status),I=N?.status===`queued`?a?`下一步已安排`:`Next step queued`:N&&[`succeeded`,`failed`,`cancelled`].includes(N.status)?a?`正在整理本步结果`:`Processing the step result`:a?`正在推进`:`In progress`,L=a?`等资料 / 待处理`:`Waiting for input`,R=a?`等你确认下一步`:`Review next step`,z=a?`已暂停`:`Paused`,B=a?`已由你验收完成`:`Accepted by you`,V=a?`已结束`:`Ended`,H;t[4]!==I||t[5]!==L||t[6]!==R||t[7]!==z||t[8]!==B||t[9]!==V?(H={working:I,waiting:L,review:R,paused:z,done:B,ended:V},t[4]=I,t[5]=L,t[6]=R,t[7]=z,t[8]=B,t[9]=V,t[10]=H):H=t[10];let U=H[j.status],W;t[11]!==c||t[12]!==j.id||t[13]!==j.revision||t[14]!==i||t[15]!==a?(W=e=>{c||(u(!0),p(``),d(l(`/api/home/follow-ups/${encodeURIComponent(j.id)}/command`),{method:`POST`,body:JSON.stringify({expectedRevision:j.revision,idempotencyKey:crypto.randomUUID(),command:e})}).then(t=>{s(te.parse(t)),e.kind===`add_input`&&h(``),y(!1),C(!1),T(!1),i()}).catch(e=>{let t=e instanceof Error?e.message:String(e);p(/changed/i.test(t)?a?`这条目标有新进展,已刷新。请确认后再操作。`:`Progress changed. Review the refreshed goal and try again.`:t),i()}).finally(()=>u(!1)))},t[11]=c,t[12]=j.id,t[13]=j.revision,t[14]=i,t[15]=a,t[16]=W):W=t[16];let G=W,K=a?`持续推进的目标`:`Continuing goal`,ee=a?`持续推进`:`Continuing goal`,q;t[17]===ee?q=t[18]:(q=(0,Q.jsx)(`p`,{className:`text-xs font-medium text-accent-fg`,children:ee}),t[17]=ee,t[18]=q);let J;t[19]===U?J=t[20]:(J=(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,role:`status`,children:U}),t[19]=U,t[20]=J);let Y;t[21]!==q||t[22]!==J?(Y=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[q,J]}),t[21]=q,t[22]=J,t[23]=Y):Y=t[23];let ne;t[24]===j.goal?ne=t[25]:(ne=(0,Q.jsx)(`h4`,{className:`break-words text-base font-semibold text-fg`,children:j.goal}),t[24]=j.goal,t[25]=ne);let re;t[26]===f?re=t[27]:(re=f?(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:f}):null,t[26]=f,t[27]=re);let ie;t[28]!==j.stopPending||t[29]!==a?(ie=j.stopPending?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:a?`已停止安排新步骤,正在确认上一步是否终止。`:`No new steps will start until the previous execution is confirmed stopped.`}):null,t[28]=j.stopPending,t[29]=a,t[30]=ie):ie=t[30];let ae;t[31]!==j.summary||t[32]!==a?(ae=j.summary?(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a?`最近进展`:`Latest progress`}),(0,Q.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap break-words text-sm text-fg`,children:j.summary})]}):null,t[31]=j.summary,t[32]=a,t[33]=ae):ae=t[33];let oe;t[34]!==j.waitingFor||t[35]!==a?(oe=j.waitingFor?(0,Q.jsxs)(`div`,{className:`rounded-lg bg-surface-panel p-3`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a?`当前需要`:`What is needed`}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:j.waitingFor===`Source scope or goal contract needs review`?a?`参考资料或目标要求已变更,请先检查。`:`Source scope or goal requirements need review.`:j.waitingFor===`Step history changed; review before resuming`?a?`一步历史结果已删除,目标已暂停。请确认下一步后再继续。`:`A step was deleted. Review the next action before resuming.`:j.waitingFor===`New material awaits review`?a?`有新增资料还没核对,请先推进下一步。`:`New material needs review before goal acceptance.`:j.waitingFor})]}):null,t[34]=j.waitingFor,t[35]=a,t[36]=oe):oe=t[36];let se;t[37]!==j.nextStep||t[38]!==j.status||t[39]!==a?(se=j.nextStep?(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:j.status===`working`?a?`当前这一步`:`Current step`:a?`建议下一步`:`Proposed next step`}),(0,Q.jsx)(`p`,{className:`mt-1 break-words text-sm text-fg`,children:j.nextStep})]}):null,t[37]=j.nextStep,t[38]=j.status,t[39]=a,t[40]=se):se=t[40];let ce;t[41]!==N||t[42]!==b||t[43]!==a?(ce=N?(0,Q.jsx)(X,{variant:`secondary`,onClick:()=>x(b===N.taskId?void 0:N.taskId),children:a?`查看第 ${N.number} 步的进度与结果`:`Review step ${N.number}`}):null,t[41]=N,t[42]=b,t[43]=a,t[44]=ce):ce=t[44];let le;t[45]!==k||t[46]!==S||t[47]!==G||t[48]!==c||t[49]!==D||t[50]!==w||t[51]!==v||t[52]!==F||t[53]!==j.autoContinue||t[54]!==j.criteria||t[55]!==j.nextStep||t[56]!==j.remainingSteps||t[57]!==j.status||t[58]!==j.stopPending||t[59]!==N?.verified||t[60]!==g||t[61]!==m||t[62]!==a?(le=F?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:j.autoContinue?a?`本轮还可自动推进 ${j.remainingSteps} 步。每步结果都会保留,遇到资料缺口会停下。`:`Up to ${j.remainingSteps} more automatic steps this round. Missing input stops progress.`:a?`每个下一步都由你确认后再执行。`:`You confirm each next step before it runs.`}),j.status===`review`&&!j.stopPending?(0,Q.jsx)(X,{variant:`primary`,disabled:c,onClick:()=>{_(j.nextStep),y(!v)},children:j.nextStep?a?`确认或调整下一步`:`Confirm or adjust next step`:a?`安排下一步`:`Set the next step`}):null,v?(0,Q.jsxs)(`form`,{className:`space-y-2`,onSubmit:e=>{e.preventDefault(),G({kind:`continue`,nextStep:g,stepBudget:j.autoContinue?3:1})},children:[(0,Q.jsxs)(`label`,{className:`block text-xs text-fg-muted`,children:[a?`下一步要完成什么?`:`What should the next step deliver?`,(0,Q.jsx)(`textarea`,{required:!0,maxLength:1e3,value:g,onChange:e=>_(e.target.value),className:`mt-1 min-h-20 w-full rounded-lg border border-edge bg-surface-inset p-2 text-sm text-fg`})]}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:j.autoContinue?a?`确认后,本轮最多再推进 3 步。`:`Confirm up to 3 more private steps this round.`:a?`确认后仅执行这一步。`:`Confirm this step only.`}),(0,Q.jsx)(X,{type:`submit`,variant:`primary`,disabled:c,children:a?`确认继续推进`:`Continue with this step`})]}):null,(0,Q.jsxs)(`form`,{className:`space-y-2`,onSubmit:e=>{e.preventDefault(),G({kind:`add_input`,text:m})},children:[(0,Q.jsxs)(`label`,{className:`block text-xs text-fg-muted`,children:[a?`补充资料或最新情况`:`Add evidence or an update`,(0,Q.jsx)(`textarea`,{required:!0,maxLength:8e3,value:m,onChange:e=>h(e.target.value),placeholder:a?`粘贴复现条件、日志片段,或说明有什么新进展。`:`Add reproduction steps, logs or new progress.`,className:`mt-1 min-h-16 w-full rounded-lg border border-edge bg-surface-inset p-2 text-sm text-fg`})]}),(0,Q.jsx)(X,{variant:j.status===`waiting`?`primary`:`secondary`,disabled:c||!m.trim(),type:`submit`,children:j.status===`waiting`&&j.autoContinue&&j.remainingSteps>0&&N?.verified?a?`补充资料,继续推进`:`Add evidence and continue`:a?`补充到这条目标`:`Add to this goal`})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[j.status===`waiting`&&!j.stopPending?(0,Q.jsx)(X,{variant:`ghost`,onClick:()=>{_(j.nextStep),y(!v)},children:a?`调整下一步`:`Adjust next step`}):null,(0,Q.jsx)(X,{variant:`ghost`,disabled:c,onClick:()=>G({kind:j.status===`paused`?`resume`:`pause`}),children:j.status===`paused`?a?`恢复推进`:`Resume`:a?`暂停推进`:`Pause`}),N?.verified&&j.status!==`working`&&!j.stopPending?(0,Q.jsx)(X,{variant:`ghost`,onClick:()=>C(!S),children:a?`验收整个目标`:`Review goal completion`}):null,(0,Q.jsx)(X,{variant:`ghost`,onClick:()=>T(!w),children:a?`结束跟进`:`End follow-up`})]}),w?(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:a?`停止后续推进并请求取消当前步骤,保留已有结果。`:`Stop further work and cancel the current step. Keep previous results.`}),(0,Q.jsx)(X,{disabled:c,onClick:()=>G({kind:`end`}),children:a?`确认结束跟进`:`Confirm end`})]}):null,S?(0,Q.jsxs)(`form`,{className:`space-y-3 rounded-lg bg-surface-panel p-3`,onSubmit:e=>{e.preventDefault(),G({kind:`complete`,confirmedCriteria:D,note:k})},children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:a?`请对照结果逐项确认,阶段产出不代表目标已完成。`:`Confirm each criterion against the results. A completed step is not a completed goal.`}),j.criteria.map((e,t)=>(0,Q.jsxs)(`label`,{className:`flex items-start gap-2 text-sm text-fg-muted`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:D.includes(t),onChange:e=>O(e.target.checked?[...D,t]:D.filter(e=>e!==t))}),e]},t)),(0,Q.jsxs)(`label`,{className:`block text-xs text-fg-muted`,children:[a?`验收依据`:`Acceptance evidence`,(0,Q.jsx)(`textarea`,{required:!0,maxLength:1e3,value:k,onChange:e=>A(e.target.value),className:`mt-1 w-full rounded-lg border border-edge bg-surface-panel p-2 text-sm`})]}),(0,Q.jsx)(X,{type:`submit`,variant:`primary`,disabled:c||D.length!==j.criteria.length||!k.trim(),children:a?`确认目标已完成`:`Accept completed goal`})]}):null]}),t[45]=k,t[46]=S,t[47]=G,t[48]=c,t[49]=D,t[50]=w,t[51]=v,t[52]=F,t[53]=j.autoContinue,t[54]=j.criteria,t[55]=j.nextStep,t[56]=j.remainingSteps,t[57]=j.status,t[58]=j.stopPending,t[59]=N?.verified,t[60]=g,t[61]=m,t[62]=a,t[63]=le):le=t[63];let ue=a?`完成标准与推进记录`:`Acceptance criteria and step history`,de;t[64]===ue?de=t[65]:(de=(0,Q.jsx)(`summary`,{className:`cursor-pointer text-xs text-fg-muted`,children:ue}),t[64]=ue,t[65]=de);let fe;t[66]===j.criteria?fe=t[67]:(fe=j.criteria.map(pt),t[66]=j.criteria,t[67]=fe);let pe;t[68]===fe?pe=t[69]:(pe=(0,Q.jsx)(`ul`,{className:`mt-2 list-disc pl-4 text-sm text-fg-muted`,children:fe}),t[68]=fe,t[69]=pe);let me;if(t[70]!==j.steps||t[71]!==a){let e;t[73]===a?e=t[74]:(e=e=>(0,Q.jsxs)(`div`,{className:`mt-2 flex items-center justify-between gap-2 border-l border-edge pl-3 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`span`,{children:[e.number,`. `,e.action,` · `,e.verified?a?`本步检查通过`:`Step checked`:a?`结果待核查`:`Needs review`]}),(0,Q.jsx)(X,{variant:`ghost`,onClick:()=>x(e.taskId),children:a?`查看`:`Review`})]},e.number),t[73]=a,t[74]=e),me=j.steps.map(e),t[70]=j.steps,t[71]=a,t[72]=me}else me=t[72];let he;t[75]!==de||t[76]!==pe||t[77]!==me?(he=(0,Q.jsxs)(`details`,{children:[de,pe,me]}),t[75]=de,t[76]=pe,t[77]=me,t[78]=he):he=t[78];let ge;t[79]!==r||t[80]!==i||t[81]!==b?(ge=b?(0,Q.jsx)(ze,{taskId:b,language:r,onComplete:i}):null,t[79]=r,t[80]=i,t[81]=b,t[82]=ge):ge=t[82];let _e=`#/tasks/${encodeURIComponent(j.rootTaskId)}`,ve=a?`查看完整目标与子任务`:`View the goal and its child tasks`,ye;t[83]!==_e||t[84]!==ve?(ye=(0,Q.jsx)(`a`,{className:`inline-block text-xs text-accent-fg`,href:_e,children:ve}),t[83]=_e,t[84]=ve,t[85]=ye):ye=t[85];let be;return t[86]!==K||t[87]!==Y||t[88]!==ne||t[89]!==re||t[90]!==ie||t[91]!==ae||t[92]!==oe||t[93]!==se||t[94]!==ce||t[95]!==le||t[96]!==he||t[97]!==ge||t[98]!==ye?(be=(0,Q.jsxs)(`section`,{className:`space-y-3 rounded-lg bg-surface-inset p-3`,"aria-label":K,children:[Y,ne,re,ie,ae,oe,se,ce,le,he,ge,ye]}),t[86]=K,t[87]=Y,t[88]=ne,t[89]=re,t[90]=ie,t[91]=ae,t[92]=oe,t[93]=se,t[94]=ce,t[95]=le,t[96]=he,t[97]=ge,t[98]=ye,t[99]=be):be=t[99],be}function pt(e){return(0,Q.jsx)(`li`,{children:e},e)}function mt(e){let t=(0,Ge.c)(29),{starters:n,revision:r,language:i,onStarted:a,onUpdated:o}=e,s=i===`zh`,[c,u]=(0,Z.useState)(),[f,p]=(0,Z.useState)(!1),[m,h]=(0,Z.useState)(``),g;if(t[0]!==f||t[1]!==m||t[2]!==i||t[3]!==a||t[4]!==o||t[5]!==r||t[6]!==c||t[7]!==n||t[8]!==s){let e;t[10]===c?e=t[11]:(e=e=>e.kind===c,t[10]=c,t[11]=e);let _=n.find(e),v=_&&ne[_.kind][i],y=s?`这些工作,可以先帮你整理一份`:`Here is work I can prepare for you`,b;t[12]===y?b=t[13]:(b=(0,Q.jsx)(`p`,{className:`text-base font-semibold text-fg`,children:y}),t[12]=y,t[13]=b);let x=s?`从近期的相关请求中整理资料和待办,先给你看结果,再决定是否定期交给我。`:`Turn recent requests into useful drafts. Review the result before deciding whether to make it recurring.`,S;t[14]===x?S=t[15]:(S=(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:x}),t[14]=x,t[15]=S);let C;if(t[16]!==f||t[17]!==i||t[18]!==c||t[19]!==n||t[20]!==s){let e;t[22]!==f||t[23]!==i||t[24]!==c||t[25]!==s?(e=e=>{let t=ne[e.kind][i];return(0,Q.jsxs)(`article`,{className:`flex min-w-0 flex-col items-start gap-2 rounded-lg border border-edge p-3`,children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:t.title}),(0,Q.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:t.output}),(0,Q.jsx)(`p`,{className:`mt-auto text-xs text-fg-subtle`,children:s?`最近有 ${e.requestCount} 条相关请求`:`${e.requestCount} related recent requests`}),(0,Q.jsx)(X,{disabled:f,"aria-expanded":c===e.kind,onClick:()=>{u(e.kind),h(``)},children:s?`看看会做什么`:`See what I will prepare`})]},e.kind)},t[22]=f,t[23]=i,t[24]=c,t[25]=s,t[26]=e):e=t[26],C=n.map(e),t[16]=f,t[17]=i,t[18]=c,t[19]=n,t[20]=s,t[21]=C}else C=t[21];let w;t[27]===C?w=t[28]:(w=(0,Q.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:C}),t[27]=C,t[28]=w),g=(0,Q.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[b,S,w,_&&v?(0,Q.jsxs)(`form`,{className:`space-y-3 rounded-lg border border-edge bg-surface-inset p-3`,onSubmit:e=>{e.preventDefault(),!f&&(p(!0),h(``),d(l(`/api/home/observation/prepare`),{method:`POST`,body:JSON.stringify({kind:_.kind,topicIds:_.topicIds,expectedRevision:r,idempotencyKey:crypto.randomUUID(),locale:i})}).then(e=>{let t=Y.parse(e);if(t.outcome!==`task`)throw Error(s?`暂时无法开始,请稍后重试。`:`Could not start this draft.`);a(t.taskId),u(void 0),o()}).catch(e=>{let t=e instanceof Error?e.message:String(e);h(/revision|Refresh|available/i.test(t)?s?`工作记录有更新,已刷新可用任务,请重新确认。`:`Work has changed. Review the refreshed task and try again.`:t),o()}).finally(()=>p(!1)))},children:[(0,Q.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:s?`你会得到:${v.title}`:`You will get: ${v.title}`}),(0,Q.jsx)(`ul`,{className:`list-disc space-y-1 pl-4 text-sm text-fg-muted`,children:v.deliverables.map(gt)}),(0,Q.jsxs)(`details`,{className:`text-xs text-fg-muted`,children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer`,children:s?`这次参考的请求`:`Requests used for this draft`}),_.previews.map(ht)]}),(0,Q.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:s?`先准备私人草稿,资料不足会标出来。不发消息,也不自动设定时。`:`Prepare a private draft and flag missing material. No messages or recurring runs.`}),m?(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:m}):null,(0,Q.jsx)(X,{variant:`primary`,type:`submit`,disabled:f,children:f?s?`正在创建任务…`:`Starting…`:s?`先生成一份`:`Prepare this draft`}),(0,Q.jsx)(X,{variant:`ghost`,disabled:f,onClick:()=>u(void 0),children:s?`取消`:`Cancel`})]}):null]}),t[0]=f,t[1]=m,t[2]=i,t[3]=a,t[4]=o,t[5]=r,t[6]=c,t[7]=n,t[8]=s,t[9]=g}else g=t[9];return g}function ht(e,t){return(0,Q.jsx)(`p`,{className:`mt-2 break-words`,children:e},t)}function gt(e){return(0,Q.jsx)(`li`,{children:e},e)}function _t({observation:e,advisor:t,language:n,emphasizeStart:r=!0,onUpdated:i}){let a=n===`zh`,[o,s]=(0,Z.useState)(!1),[c,u]=(0,Z.useState)(``),[f,p]=(0,Z.useState)(``),[m,h]=(0,Z.useState)(!1),[g,_]=(0,Z.useState)(``),[v,y]=(0,Z.useState)(`once`),[b,x]=(0,Z.useState)(),[S,w]=(0,Z.useState)(!1),[T,E]=(0,Z.useState)(),[D,O]=(0,Z.useState)(!1),[k,A]=(0,Z.useState)(!1),[j,M]=(0,Z.useState)(),[N,F]=(0,Z.useState)(!1),I=t.state===`ready`?t.primary:void 0,L=I?.evidence.map(e=>/^observation:([^:]+):/.exec(e.id)?.[1]).find(Boolean),R=e.topics.filter(e=>e.feedback.some(e=>e.status===`active`)||e.trials.length||e.routine),z=R.find(e=>e.id===T),B=b?e.topics.find(e=>e.id===b):e.topics.find(e=>e.routine&&e.routine.status!==`ended`)??e.topics.find(e=>e.trials.length)??e.topics.find(e=>e.id===L)??e.topics[0],V=e.status===`active`&&B?.id===L?I:void 0,H=B?.trials[0],U=!!(B?.routine||H||V),W=t.state===`quiet`&&[`model_unavailable`,`generation_failed`,`budget_exhausted`].includes(t.reason),K=async e=>{if(!o){s(!0),u(``),p(``);try{await e(),i()}catch(e){u(e instanceof Error?e.message:String(e)),i()}finally{s(!1)}}},ee=async t=>re.parse(await d(l(`/api/home/observation/command`),{method:`POST`,body:JSON.stringify({expectedRevision:e.revision,idempotencyKey:crypto.randomUUID(),command:t})})),q=()=>{B&&(x(B.id),w(!S))},J=()=>B&&void K(async()=>{let t=await d(l(`/api/home/observation/discussion`),{method:`POST`,body:JSON.stringify({topicId:B.id,expectedRevision:e.revision,idempotencyKey:crypto.randomUUID()})});window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:t}))});return(0,Q.jsxs)(`section`,{className:`rounded-xl bg-surface-panel p-4`,"aria-labelledby":`home-observation-title`,"aria-busy":o,"data-workbench-panel":!0,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,Q.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-accent-soft text-accent-fg`,children:(0,Q.jsx)(G,{className:`size-4`,"aria-hidden":!0})}),(0,Q.jsx)(`h2`,{id:`home-observation-title`,className:`text-base font-semibold tracking-tight text-fg`,children:a?`交给我`:`Let me handle it`})]}),(0,Q.jsxs)(X,{variant:`ghost`,className:`gap-1 rounded-lg px-2 text-xs`,"aria-expanded":D,onClick:()=>O(!D),children:[a?`记录与设置`:`History and settings`,(0,Q.jsx)(C,{className:D?`size-3.5 shrink-0 rotate-180`:`size-3.5 shrink-0`,"aria-hidden":!0})]})]}),c?(0,Q.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-danger`,children:c}):null,f?(0,Q.jsx)(`p`,{role:`status`,className:`mt-3 text-sm text-fg-muted`,children:f}):null,b&&!B&&g?(0,Q.jsxs)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:[a?`这件事已不在记录中。未保存的内容:`:`This item is no longer available. Your unsaved note: `,g]}):null,(0,Q.jsx)(rt,{observation:e,language:n,onUpdated:i}),e.status===`active`?(0,Q.jsx)(X,{className:`mt-3`,variant:`ghost`,"aria-expanded":m,onClick:()=>h(!m),children:a?`一次性整理与定期安排`:`One-off drafts and recurring work`}):null,e.status!==`active`||m?(0,Q.jsx)(Q.Fragment,{children:e.status===`disabled`?(0,Q.jsxs)(`div`,{className:`mt-4`,children:[(0,Q.jsx)(`h3`,{className:`text-balance text-lg font-semibold leading-snug tracking-tight text-fg`,children:a?`把重复的事,慢慢交给我`:`Let me take recurring work off your hands`}),(0,Q.jsx)(`p`,{className:`mt-2 max-w-prose text-sm leading-6 text-fg-muted`,children:a?`我会结合你在 xopc 中的工作记录,寻找可以代劳的事情。有合适的建议时,先做一次给你看。`:`I can look through your work in xopc for tasks I could take on, then offer a first draft for you to review.`}),(0,Q.jsx)(X,{className:`mt-3 rounded-lg text-xs sm:shadow-none`,variant:r?`primary`:`tonal`,disabled:o,onClick:()=>void K(async()=>{await ee({kind:`start`,backfillDays:30})}),children:a?`帮我发现重复工作`:`Find recurring work`}),(0,Q.jsxs)(`p`,{className:`mt-4 flex items-start gap-2 text-xs leading-5 text-fg-muted`,children:[(0,Q.jsx)(P,{className:`mt-1 size-3 shrink-0`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:a?`仅查看最近 30 天已授权的私人会话及后续工作记录。不扫描屏幕,定期执行前会请你确认。`:`Uses up to 30 days of authorized private chats and new work. No screen recording. Recurring runs need your confirmation.`})]})]}):(0,Q.jsxs)(Q.Fragment,{children:[!U&&e.status===`active`&&e.starters?.length?(0,Q.jsx)(mt,{starters:e.starters,revision:e.revision,language:n,onStarted:M,onUpdated:i}):U?B?.routine?(0,Q.jsx)(Be,{routine:B.routine,language:n,onUpdated:i},B.routine.id):H?(0,Q.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:[`review`,`closed`].includes(H.phase)?a?`先看看这次做得怎么样`:`Review the first result`:a?`先做一次,再决定是否定期交给我`:`Try it once before making it recurring`}),(0,Q.jsx)(`p`,{className:`text-base font-medium text-fg`,children:H.title}),(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:a?`满意后再决定要不要定期交给我。`:`Review the result before deciding whether to make it recurring.`}),(0,Q.jsx)(X,{variant:`primary`,onClick:()=>M(j===H.taskId?void 0:H.taskId),children:a?`查看这次结果`:`Review this result`}),[`review`,`closed`].includes(H.phase)?(0,Q.jsx)(Ve,{topicId:B.id,trial:H,language:n,onUpdated:i},H.taskId):null]}):V&&B?(0,Q.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a?`这件事,可以先让我试试`:`Here is something I could try`}),(0,Q.jsx)(`p`,{className:`text-base font-medium text-fg`,children:V.title}),(0,Q.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:V.outcome}),V.risk===`analysis`?(0,Q.jsx)(X,{variant:`primary`,disabled:o,onClick:()=>void K(async()=>{let t=Y.parse(await d(l(`/api/home/observation/trial`),{method:`POST`,body:JSON.stringify({topicId:B.id,opportunityId:V.id,expectedRevision:e.revision,expectedOpportunityRevision:V.revision,idempotencyKey:crypto.randomUUID()})}));if(t.outcome===`task`)M(t.taskId);else throw Error(a?`请先完成相关能力配置。`:`Set up the required capabilities first.`)}),children:a?`先帮我做一次`:`Try it once`}):(0,Q.jsx)(X,{variant:`primary`,disabled:o,onClick:J,children:a?`先确认怎么做`:`Discuss the approach`}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:V.risk===`analysis`?a?`先生成私人草稿,由你查看后决定下一步。`:`Start with a private draft for you to review.`:a?`这件事需要外部服务,先一起确认范围。`:`This needs an external service. Agree on the scope first.`}),(0,Q.jsxs)(`details`,{className:`text-xs text-fg-muted`,children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer`,children:a?`为什么推荐这件事`:`Why this suggestion`}),(0,Q.jsx)(`p`,{className:`mt-2 leading-5`,children:V.rationale}),V.evidence.map(e=>(0,Q.jsx)(`p`,{className:`mt-2 leading-5`,children:e.observation},e.id))]})]}):null:(0,Q.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,Q.jsx)(`p`,{className:`text-base font-medium text-fg`,children:a?`先做一件具体的事`:`Start with a concrete task`}),(0,Q.jsx)(`p`,{className:`max-w-prose text-sm leading-6 text-fg-muted`,children:e.status===`paused`?a?`已暂停寻找新建议。你也可以直接告诉我,哪件事最想少做一点。`:`New suggestions are paused. You can still tell me what you would like to spend less time on.`:W?a?`暂时无法生成新建议,已有记录和反馈都已保留。你也可以直接说说想交给我的事。`:`New suggestions are temporarily unavailable. Your records and feedback are saved. You can still tell me what you would like help with.`:a?`例如整理 PR 审查清单、汇总问题线索,或写一份工作进展草稿。先准备一次,满意后再设为定期执行。`:`Prepare a PR review checklist, collect issue reports, or draft a work update. Try it once before making it recurring.`}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:[`pr_review`,`issue_digest`,`work_summary`].map(e=>{let t=ne[e][n],r=a?`请帮我准备「${t.title}」。\n目标:${t.output}\n\n要参考的资料或链接:\n\n先生成私人草稿;缺少资料时明确告诉我,不要开启定时执行。`:`Prepare ${t.title}.\n${t.output}\n\nSource material or links:\n\nCreate a private draft and flag missing information. Do not create recurring runs.`;return(0,Q.jsx)(X,{asChild:!0,children:(0,Q.jsx)(`a`,{href:`#/chat/new?${new URLSearchParams({draft:r})}`,children:t.title})},e)})}),e.status===`paused`?(0,Q.jsx)(X,{variant:`ghost`,onClick:()=>F(!N),children:a?`恢复寻找建议`:`Resume suggestions`}):null]}),U&&B&&e.status===`active`?(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-1`,children:[(0,Q.jsx)(X,{variant:`ghost`,disabled:o,"aria-expanded":S,onClick:q,children:a?`调整做法`:`Refine the approach`}),(0,Q.jsx)(X,{variant:`ghost`,disabled:o,onClick:J,children:a?`聊聊这件事`:`Discuss this task`})]}):null,j?(0,Q.jsx)(ze,{taskId:j,language:n,onComplete:i}):null,N?(0,Q.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:a?`恢复后,要补看暂停期间的工作吗?`:`Include work from while suggestions were paused?`}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[[`catch_up`,`new_only`].map(e=>(0,Q.jsx)(X,{disabled:o,onClick:()=>void K(async()=>{await ee({kind:`resume`,mode:e}),F(!1)}),children:e===`catch_up`?a?`一起补看`:`Include earlier work`:a?`只看之后的工作`:`New work only`},e)),(0,Q.jsx)(X,{variant:`ghost`,onClick:()=>F(!1),children:a?`取消`:`Cancel`})]})]}):null]})}):null,S&&B?(0,Q.jsxs)(`form`,{className:`mt-3 space-y-3 rounded-lg bg-surface-inset p-3`,onSubmit:e=>{e.preventDefault(),K(async()=>{await ee({kind:`feedback`,topicId:B.id,text:g,scope:v}),_(``),w(!1),p(a?`已记下。改变定期做法前,会先请你确认。`:`Preference saved. I will ask before changing the recurring approach.`)})},children:[(0,Q.jsxs)(`label`,{className:`block text-xs text-fg-muted`,children:[a?`关于「${B.title}」,希望我怎么做?`:`How should I handle “${B.title}”?`,(0,Q.jsx)(`textarea`,{required:!0,maxLength:1e3,value:g,onChange:e=>_(e.target.value),placeholder:a?`例如:先列出未解决的阻塞,每项附上来源。`:`For example: list unresolved blockers first and include sources.`,className:`mt-1 min-h-24 w-full rounded-lg border border-edge bg-surface-inset p-2 text-sm text-fg`})]}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-1`,role:`group`,"aria-label":a?`反馈范围`:`Feedback scope`,children:[`once`,`project`,`similar`].filter(e=>e!==`project`||B.projectId).map(e=>(0,Q.jsx)(X,{type:`button`,variant:e===v?`secondary`:`ghost`,"aria-pressed":e===v,onClick:()=>y(e),children:e===`once`?a?`仅这一次`:`Just this time`:e===`project`?a?`这个项目都适用`:`This project`:a?`以后这类事都适用`:`Similar future work`},e))}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a?`记下你的要求;改变定期安排前,仍会请你确认。`:`I will remember your preference and ask before changing a recurring arrangement.`}),(0,Q.jsx)(X,{type:`submit`,variant:`primary`,disabled:o||!g.trim(),children:a?`记住这个要求`:`Save preference`}),(0,Q.jsx)(X,{variant:`ghost`,onClick:()=>{w(!1),_(``),y(`once`)},children:a?`取消`:`Cancel`})]}):null,D?(0,Q.jsxs)(`div`,{className:`mt-4 space-y-3 rounded-lg bg-surface-inset p-3`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,role:`status`,children:e.status===`disabled`?a?`尚未开启`:`Not enabled`:e.status===`paused`?a?`已暂停寻找新建议`:`Suggestions paused`:e.analyzedRevision<e.revision?a?`正在整理最近的工作记录`:`Reviewing recent work`:a?`有新发现时会在这里告诉你`:`New suggestions will appear here`}),(0,Q.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:a?`只查看已授权的 xopc 私人会话和相关任务结果。暂停寻找建议不会停止已经确认的定期安排。`:`Uses authorized private xopc chats and related task results. Pausing suggestions does not stop confirmed recurring tasks.`}),e.status===`disabled`?null:(0,Q.jsx)(X,{disabled:o,variant:`ghost`,onClick:()=>e.status===`active`?void K(async()=>{await ee({kind:`pause`})}):F(!N),children:e.status===`active`?a?`暂停寻找建议`:`Pause suggestions`:a?`恢复寻找建议`:`Resume suggestions`}),R.length?(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:a?`已保存的要求与试做`:`Saved preferences and trials`}),(0,Q.jsx)(`div`,{className:`max-h-48 space-y-2 overflow-y-auto`,children:R.map(e=>(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-lg bg-surface-panel p-2`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm text-fg`,children:e.routine?.title||e.trials[0]?.title||(a?`已保存的工作要求`:`Saved work preferences`)}),(0,Q.jsx)(X,{variant:`ghost`,disabled:!!g&&e.id!==B?.id,onClick:()=>{E(e.id),x(e.id),A(!1)},children:a?`管理`:`Manage`})]},e.id))}),z?(0,Q.jsxs)(`div`,{className:`space-y-2 rounded-lg bg-surface-panel p-3`,children:[e.status===`active`?(0,Q.jsx)(X,{variant:`ghost`,disabled:o,onClick:q,children:a?`调整要求`:`Edit preferences`}):null,z.feedback.filter(e=>e.status===`active`).map(e=>(0,Q.jsxs)(`div`,{className:`text-xs text-fg`,children:[(0,Q.jsx)(`p`,{children:e.text}),(0,Q.jsx)(X,{disabled:o,variant:`ghost`,onClick:()=>void K(async()=>{await ee({kind:`retract`,topicId:z.id,feedbackId:e.id})}),children:a?`撤回要求`:`Retract preference`})]},e.id)),z.trials.map(e=>(0,Q.jsxs)(X,{variant:`ghost`,onClick:()=>M(e.taskId),children:[a?`查看结果:`:`Review result: `,e.title]},e.taskId)),(0,Q.jsx)(X,{variant:`ghost`,disabled:o,onClick:()=>A(!0),children:a?`不再参考这件事`:`Stop using this work history`}),k?(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-fg`,children:a?`清除关于这件事的理解和要求。原始记录、已有任务和自动化保留。`:`Forget this understanding and saved preferences. Original records, tasks and automations remain.`}),(0,Q.jsx)(X,{disabled:o,onClick:()=>void K(async()=>{await ee({kind:`forget`,topicId:z.id}),x(void 0),E(void 0),A(!1),_(``),w(!1),M(void 0)}),children:a?`确认不再参考`:`Confirm exclusion`})]}):null]}):null]}):(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a?`你确认的要求与试做结果会保存在这里。普通聊天记录仍在原对话中查看。`:`Your saved preferences and trial results will appear here. View ordinary work history in its original chat.`})]}):null]})}var vt=new Set([`started`,`discussing`,`completed`]);function yt(){let e=(0,Ge.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[0,1,2].map(bt)}),e[0]=t):t=e[0],t}function bt(e){return(0,Q.jsxs)(`div`,{className:`space-y-2 rounded-xl border border-edge-subtle p-4`,children:[(0,Q.jsx)(J,{className:`h-4 w-24 rounded`}),(0,Q.jsx)(J,{className:`h-5 w-4/5 rounded`}),(0,Q.jsx)(J,{className:`h-4 w-3/5 rounded`})]},e)}function xt(e){let t=(0,Ge.c)(11),{open:n,refreshKey:r,onOpenChange:i,onReevaluate:a}=e,o=u(St),s=f(o).projectsPage.home,l=c(),[d,b]=(0,Z.useState)(`all`),x;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(x=[],t[0]=x):x=t[0];let[S,w]=(0,Z.useState)(x),[T,E]=(0,Z.useState)(!1),[D,A]=(0,Z.useState)(),j;t[1]===n?j=t[2]:(j=()=>{if(!n)return;let e=!0;return E(!0),A(void 0),le().then(t=>{e&&w(t.items)}).catch(t=>{e&&A(t instanceof Error?t.message:String(t))}).finally(()=>{e&&E(!1)}),()=>{e=!1}},t[1]=n,t[2]=j);let N;t[3]!==n||t[4]!==r?(N=[n,r],t[3]=n,t[4]=r,t[5]=N):N=t[5],(0,Z.useEffect)(j,N);let P=S.filter(e=>d===`all`||(d===`adopted`?vt.has(e.status):!vt.has(e.status))),I=new Intl.DateTimeFormat(o===`zh`?`zh-CN`:`en`,{dateStyle:`medium`}),L=new Intl.DateTimeFormat(o===`zh`?`zh-CN`:`en`,{dateStyle:`medium`,timeStyle:`short`}),R=new Map;for(let e of P){let t=I.format(new Date(e.updatedAt));R.set(t,[...R.get(t)??[],e])}let z=[...R.entries()],B=e=>e.feedbackKind===`already_done`?s.advisorHistoryStatusCompleted:e.feedbackKind===`irrelevant`?s.advisorHistoryStatusIrrelevant:e.feedbackKind===`source_incorrect`?s.advisorHistoryStatusSourceIncorrect:e.feedbackKind===`less_like_this`?s.advisorHistoryStatusLessLikeThis:{available:s.advisorHistoryStatusAvailable,started:s.advisorHistoryStatusStarted,discussing:s.advisorHistoryStatusDiscussing,completed:s.advisorHistoryStatusCompleted,snoozed:s.advisorHistoryStatusSnoozed,dismissed:s.advisorHistoryStatusDismissed,expired:s.advisorHistoryStatusExpired,superseded:s.advisorHistoryStatusSuperseded}[e.status],V=e=>{if(e.href){i(!1),l(F(`/`,e.href));return}e.status===`discussing`&&(i(!1),l(`/chat/new?${new URLSearchParams({draft:e.opportunity.actionPrompt}).toString()}`))},U;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Q.jsx)(p,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim`}),t[6]=U):U=t[6];let W;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Q.jsx)(M,{className:`mt-0.5 size-5 shrink-0 text-accent`,"aria-hidden":!0}),t[7]=W):W=t[7];let G;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Q.jsx)(ee,{className:`size-4`,"aria-hidden":!0}),t[8]=G):G=t[8];let K=T?(0,Q.jsx)(yt,{}):D?(0,Q.jsxs)(`div`,{className:`rounded-xl border border-danger/25 bg-danger-soft p-4 text-sm text-danger`,children:[(0,Q.jsx)(`p`,{children:s.advisorHistoryLoadFailed}),(0,Q.jsx)(X,{type:`button`,variant:`ghost`,className:`mt-2`,onClick:()=>i(!1),children:s.advisorHistoryClose})]}):z.length===0?(0,Q.jsxs)(`div`,{className:`py-16 text-center`,children:[(0,Q.jsx)(M,{className:`mx-auto size-6 text-fg-subtle`,"aria-hidden":!0}),(0,Q.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:s.advisorHistoryEmpty}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:s.advisorHistoryEmptyHint})]}):(0,Q.jsx)(`div`,{className:`space-y-6`,children:z.map(e=>{let[t,n]=e;return(0,Q.jsxs)(`section`,{"aria-label":t,children:[(0,Q.jsx)(`h3`,{className:`mb-2 text-xs font-medium text-fg-subtle`,children:t}),(0,Q.jsx)(`div`,{className:`space-y-2`,children:n.map(e=>{let t=!!e.href||e.status===`discussing`,n=[`snoozed`,`dismissed`,`expired`,`superseded`].includes(e.status);return(0,Q.jsxs)(`article`,{className:`rounded-xl border border-edge-subtle bg-surface-base p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium text-accent`,children:B(e)}),(0,Q.jsx)(`h4`,{className:`mt-1.5 text-sm font-semibold leading-5 text-fg`,children:e.opportunity.title}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:e.opportunity.outcome})]}),(0,Q.jsx)(`time`,{className:`shrink-0 text-[11px] text-fg-subtle`,dateTime:new Date(e.updatedAt).toISOString(),children:L.format(new Date(e.updatedAt))})]}),e.snoozedUntil?(0,Q.jsxs)(`p`,{className:`mt-2 inline-flex items-center gap-1 text-xs text-fg-muted`,children:[(0,Q.jsx)(O,{className:`size-3.5`,"aria-hidden":!0}),s.advisorHistoryReturnsAt,` `,L.format(new Date(e.snoozedUntil))]}):null,(0,Q.jsxs)(`details`,{className:`group mt-3`,children:[(0,Q.jsxs)(`summary`,{className:`flex min-h-8 cursor-pointer list-none items-center gap-1 text-xs font-medium text-fg-muted hover:text-fg`,children:[s.advisorHistoryEvidence,(0,Q.jsx)(C,{className:`size-3.5 transition-transform duration-200 group-open:rotate-180 motion-reduce:transition-none`,"aria-hidden":!0})]}),(0,Q.jsx)(Xe,{opportunity:e.opportunity,onOpen:()=>i(!1)})]}),t||n?(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[t?(0,Q.jsxs)(X,{type:`button`,variant:`secondary`,className:`min-h-9 text-xs`,onClick:()=>V(e),children:[(0,Q.jsx)(k,{className:`size-3.5`,"aria-hidden":!0}),e.status===`discussing`?s.advisorHistoryContinueDiscussion:s.advisorHistoryViewProgress]}):null,n?(0,Q.jsxs)(X,{type:`button`,variant:`ghost`,className:`min-h-9 text-xs`,onClick:()=>{i(!1),a()},children:[(0,Q.jsx)(H,{className:`size-3.5`,"aria-hidden":!0}),s.advisorHistoryReevaluate]}):null]}):null]},e.opportunity.id)})})]},t)})}),q;return t[9]===K?q=t[10]:(q=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:K}),t[9]=K,t[10]=q),(0,Q.jsx)(y,{open:n,onOpenChange:i,children:(0,Q.jsxs)(g,{children:[U,(0,Q.jsxs)(_,{className:`xopc-drawer-right fixed right-0 top-0 z-[90] flex size-full max-w-lg flex-col overflow-hidden border-l border-edge bg-surface-overlay shadow-popover outline-none`,"aria-describedby":`home-advisor-history-description`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start gap-3 border-b border-edge px-5 py-4`,children:[W,(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(v,{className:`text-base font-semibold text-fg`,children:s.advisorHistoryTitle}),(0,Q.jsx)(m,{id:`home-advisor-history-description`,className:`mt-1 text-xs leading-5 text-fg-muted`,children:s.advisorHistoryDescription})]}),(0,Q.jsx)(h,{asChild:!0,children:(0,Q.jsx)(X,{type:`button`,variant:`ghost`,className:`-mr-2 size-9 shrink-0 p-0`,"aria-label":s.advisorHistoryClose,children:G})})]}),(0,Q.jsx)(`div`,{className:`shrink-0 border-b border-edge-subtle px-5 py-3`,children:(0,Q.jsx)(Me,{className:`inline-flex rounded-lg bg-surface-inset p-1`,role:`group`,"aria-label":s.advisorHistoryFilterLabel,indicatorClassName:`rounded-md bg-surface-panel shadow-surface`,children:[[`all`,s.advisorHistoryFilterAll],[`adopted`,s.advisorHistoryFilterAdopted],[`other`,s.advisorHistoryFilterOther]].map(e=>{let[t,n]=e;return(0,Q.jsx)(`button`,{type:`button`,className:`min-h-9 rounded-md px-3 text-xs font-medium transition-colors duration-150 ${d===t?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`}`,"aria-pressed":d===t,onClick:()=>b(t),children:n},t)})})}),q]})]})})}function St(e){return e.language}function Ct(e,t){return e.replace(`{{count}}`,String(t))}function wt(e,t){if(e.state===`disabled`)return null;if(e.state===`ready`){let n=1+e.alternatives.length;return{label:Ct(t.ready,n),detail:e.primary.title,tone:`accent`,refreshing:!!e.stale}}return e.state===`clarification`?{label:t.clarification,detail:e.question.question,tone:`accent`,refreshing:!1}:e.state===`refreshing`?{label:t.refreshing,detail:e.previous?.title??t.refreshingDetail,tone:`accent`,refreshing:!0}:e.reason===`generation_failed`?{label:t.generationFailed,detail:t.generationFailedDetail,tone:`danger`,refreshing:!1}:e.reason===`budget_exhausted`?{label:t.budgetExhausted,detail:t.budgetExhaustedDetail,tone:`warning`,refreshing:!1}:e.reason===`model_unavailable`?{label:t.modelUnavailable,detail:t.modelUnavailableDetail,tone:`warning`,refreshing:!1}:{label:t.idle,detail:t.idleDetail,tone:`neutral`,refreshing:!1}}var Tt={accent:`bg-accent`,danger:`bg-danger`,neutral:`bg-fg-subtle`,warning:`bg-warning`};function Et(e){let t=(0,Ge.c)(45),{advisor:n,busy:r,copy:i,onOpenHistory:a,onRefresh:o}=e,[s,c]=(0,Z.useState)(!1),l;t[0]!==n||t[1]!==i?(l=wt(n,i),t[0]=n,t[1]=i,t[2]=l):l=t[2];let u=l;if(!u)return null;let d=n.state!==`refreshing`,f=n.state===`ready`?i.findAnother:i.retry,p=`${i.label}:${u.label}`,m;t[3]===u.refreshing?m=t[4]:(m=u.refreshing?(0,Q.jsx)(H,{className:`size-4 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):(0,Q.jsx)(G,{className:`size-4`,"aria-hidden":!0}),t[3]=u.refreshing,t[4]=m);let h;t[5]!==u.refreshing||t[6]!==u.tone?(h=u.tone!==`neutral`&&!u.refreshing?(0,Q.jsx)(`span`,{className:q(`absolute right-1.5 top-1.5 size-1.5 rounded-full`,Tt[u.tone]),"aria-hidden":!0}):null,t[5]=u.refreshing,t[6]=u.tone,t[7]=h):h=t[7];let g;t[8]!==p||t[9]!==m||t[10]!==h?(g=(0,Q.jsx)(be,{asChild:!0,children:(0,Q.jsxs)(X,{type:`button`,variant:`ghost`,className:`relative size-9 rounded-lg p-0 data-[state=open]:bg-surface-hover data-[state=open]:text-fg`,"aria-label":p,title:p,children:[m,h]})}),t[8]=p,t[9]=m,t[10]=h,t[11]=g):g=t[11];let _;t[12]===u.refreshing?_=t[13]:(_=(0,Q.jsx)(`span`,{className:`mt-1 flex size-7 shrink-0 items-center justify-center rounded-lg bg-accent-soft text-accent`,children:u.refreshing?(0,Q.jsx)(H,{className:`size-4 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):(0,Q.jsx)(G,{className:`size-4`,"aria-hidden":!0})}),t[12]=u.refreshing,t[13]=_);let v;t[14]===u.label?v=t[15]:(v=(0,Q.jsx)(`p`,{className:`font-semibold text-fg`,children:u.label}),t[14]=u.label,t[15]=v);let y;t[16]===u.detail?y=t[17]:(y=(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:u.detail}),t[16]=u.detail,t[17]=y);let b;t[18]!==v||t[19]!==y?(b=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[v,y]}),t[18]=v,t[19]=y,t[20]=b):b=t[20];let x;t[21]!==_||t[22]!==b?(x=(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[_,b]}),t[21]=_,t[22]=b,t[23]=x):x=t[23];let S;t[24]===a?S=t[25]:(S=()=>{c(!1),a()},t[24]=a,t[25]=S);let C;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsx)(M,{className:`size-3.5`,"aria-hidden":!0}),t[26]=C):C=t[26];let w;t[27]!==i.history||t[28]!==S?(w=(0,Q.jsxs)(X,{type:`button`,variant:`ghost`,className:`h-9 rounded-lg text-xs`,onClick:S,children:[C,i.history]}),t[27]=i.history,t[28]=S,t[29]=w):w=t[29];let T;t[30]!==r||t[31]!==d||t[32]!==o||t[33]!==f?(T=d?(0,Q.jsxs)(X,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg text-xs`,disabled:r,onClick:()=>{c(!1),o()},children:[(0,Q.jsx)(H,{className:`size-3.5`,"aria-hidden":!0}),f]}):null,t[30]=r,t[31]=d,t[32]=o,t[33]=f,t[34]=T):T=t[34];let E;t[35]!==w||t[36]!==T?(E=(0,Q.jsxs)(`div`,{className:`mt-4 flex items-center justify-end gap-1 border-t border-edge-subtle pt-3`,children:[w,T]}),t[35]=w,t[36]=T,t[37]=E):E=t[37];let D;t[38]!==E||t[39]!==x?(D=(0,Q.jsx)(ge,{children:(0,Q.jsxs)(_e,{side:`bottom`,align:`end`,sideOffset:6,className:`z-[70] w-[min(21rem,calc(100vw-1.5rem))] rounded-xl border border-edge bg-surface-overlay p-4 text-sm text-fg shadow-popover outline-none`,onOpenAutoFocus:Dt,children:[x,E]})}),t[38]=E,t[39]=x,t[40]=D):D=t[40];let O;return t[41]!==s||t[42]!==D||t[43]!==g?(O=(0,Q.jsxs)(ve,{open:s,onOpenChange:c,children:[g,D]}),t[41]=s,t[42]=D,t[43]=g,t[44]=O):O=t[44],O}function Dt(e){return e.preventDefault()}var Ot=(0,Z.lazy)(()=>i(()=>import(`./workspace-file-preview-dialog-BTLLCHMI.js`).then(e=>e.n).then(e=>({default:e.WorkspaceFilePreviewPanel})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78])));function kt(e){let t=(0,Ge.c)(39),{item:n,language:r,primary:i,showNew:a,onOpen:o}=e,s=a!==void 0&&a,c;t[0]===r?c=t[1]:(c=f(r),t[0]=r,t[1]=c);let l=c.projectsPage.home.workbench,u;t[2]===s?u=t[3]:(u=s?(0,Q.jsx)(`span`,{className:`grid size-9 shrink-0 place-items-center rounded-lg bg-surface-inset text-fg-muted`,children:(0,Q.jsx)(A,{className:`size-4`,"aria-hidden":!0})}):null,t[2]=s,t[3]=u);let d;t[4]===n.title?d=t[5]:(d=(0,Q.jsx)(`p`,{className:`break-words text-sm font-semibold text-fg`,children:n.title}),t[4]=n.title,t[5]=d);let p;t[6]!==l.newDelivery||t[7]!==s?(p=s?(0,Q.jsx)(`span`,{className:`mr-2 font-medium text-accent-fg`,children:l.newDelivery}):null,t[6]=l.newDelivery,t[7]=s,t[8]=p):p=t[8];let m;t[9]===n.completedAt?m=t[10]:(m=new Date(n.completedAt).toISOString(),t[9]=n.completedAt,t[10]=m);let h;t[11]!==n.completedAt||t[12]!==r?(h=Le(new Date(n.completedAt),r),t[11]=n.completedAt,t[12]=r,t[13]=h):h=t[13];let g;t[14]!==m||t[15]!==h?(g=(0,Q.jsx)(`time`,{dateTime:m,children:h}),t[14]=m,t[15]=h,t[16]=g):g=t[16];let _;t[17]!==p||t[18]!==g?(_=(0,Q.jsxs)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:[p,g]}),t[17]=p,t[18]=g,t[19]=_):_=t[19];let v;t[20]===n.summary?v=t[21]:(v=n.summary?(0,Q.jsx)(`p`,{className:`mt-1 line-clamp-2 break-words text-xs leading-5 text-fg-muted`,children:n.summary}):null,t[20]=n.summary,t[21]=v);let y;t[22]!==v||t[23]!==d||t[24]!==_?(y=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[d,_,v]}),t[22]=v,t[23]=d,t[24]=_,t[25]=y):y=t[25];let b;t[26]!==y||t[27]!==u?(b=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 basis-48 items-start gap-3`,children:[u,y]}),t[26]=y,t[27]=u,t[28]=b):b=t[28];let x=i?`primary`:s?`ghost`:`tonal`,S;t[29]===s?S=t[30]:(S=s?(0,Q.jsx)(w,{className:`size-3.5`,"aria-hidden":!0}):null,t[29]=s,t[30]=S);let C;t[31]!==l.openDelivery||t[32]!==o||t[33]!==x||t[34]!==S?(C=(0,Q.jsxs)(X,{variant:x,className:`min-h-9 shrink-0 gap-1 rounded-lg px-2.5 text-xs sm:shadow-none`,onClick:o,children:[l.openDelivery,S]}),t[31]=l.openDelivery,t[32]=o,t[33]=x,t[34]=S,t[35]=C):C=t[35];let T;return t[36]!==b||t[37]!==C?(T=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 px-4 py-3.5`,children:[b,C]}),t[36]=b,t[37]=C,t[38]=T):T=t[38],T}function At({view:e,items:t,language:n,onSelect:r,onClose:i,onRead:a,onOpenFull:o,onRestoreFocus:s}){let c=f(n).projectsPage.home,[l,u]=(0,Z.useState)(!1),[d,m]=(0,Z.useState)(!1),[b,x]=(0,Z.useState)(null),S=(0,Z.useRef)(!1),C=e&&e!==`history`?e:null,{data:w,error:T,mutate:E}=ie(C?[`home-delivery`,C.id]:null,async()=>{if(!C)return;if(C.kind===`automation`){let{run:e}=await Ae.getRun(C.subjectId);return{kind:`automation`,summary:e.summary}}let e=await ce(C.subjectId),t=e.receipts.find(e=>`task:${e.runId}`===C.id);if(!t)throw Error(c.workbench.deliveryFailed);return{kind:`task`,detail:e,receipt:t}},{shouldRetryOnError:!1}),D=w?.kind===`task`||!!w?.summary?.trim();async function O(e){if(!S.current){S.current=!0,u(!0),m(!1);try{e.kind===`automation`&&!e.read&&await Ae.markRunRead(e.subjectId),a(e)}catch{m(!0)}finally{S.current=!1,u(!1)}}}return(0,Q.jsx)(y,{open:e!==null,onOpenChange:e=>{!e&&!S.current&&(m(!1),i())},children:(0,Q.jsxs)(g,{children:[(0,Q.jsx)(p,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim`}),(0,Q.jsxs)(_,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(36rem,calc(100dvh-2rem))] w-[min(42rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay outline-none`,"aria-describedby":void 0,onCloseAutoFocus:e=>{e.preventDefault(),s()},children:[(0,Q.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,Q.jsx)(v,{className:`truncate text-base font-semibold text-fg`,children:C?.title??c.workbench.deliveryHistory}),(0,Q.jsx)(h,{asChild:!0,children:(0,Q.jsx)(X,{variant:`ghost`,className:`size-9 p-0`,disabled:l,"aria-label":n===`zh`?`关闭`:`Close`,children:(0,Q.jsx)(ee,{className:`size-4`})})})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:e===`history`?t.length?(0,Q.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:t.map(e=>(0,Q.jsx)(kt,{item:e,language:n,onOpen:()=>{m(!1),r(e)}},e.id))}):(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:c.workbench.deliveryEmpty}):T?(0,Q.jsxs)(`div`,{role:`alert`,className:`space-y-2 text-sm text-danger`,children:[(0,Q.jsx)(`p`,{children:c.workbench.deliveryFailed}),(0,Q.jsx)(X,{variant:`secondary`,onClick:()=>void E(),children:c.retry})]}):w?w.kind===`task`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(He,{content:w.receipt.summary,contentKey:w.receipt.runId,language:n}),(0,Q.jsx)(Ue,{evidence:w.receipt.evidence,projectId:w.detail.task.projectId,conversationId:w.detail.conversation.activeConversationId??void 0,language:n,onOpenFile:x}),(0,Q.jsx)(y,{open:b!==null,onOpenChange:e=>{e||x(null)},children:(0,Q.jsxs)(g,{children:[(0,Q.jsx)(p,{className:`fixed inset-0 z-[90] bg-scrim`}),(0,Q.jsxs)(_,{className:`fixed left-1/2 top-1/2 z-[100] flex h-[min(54rem,calc(100dvh-2rem))] w-[min(72rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel outline-none`,"aria-describedby":void 0,children:[(0,Q.jsx)(v,{className:`sr-only`,children:b}),(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(J,{className:`m-4 min-h-24`}),children:(0,Q.jsx)(Ot,{filePath:b,projectId:w.detail.task.projectId,conversationId:w.detail.conversation.activeConversationId,onClose:()=>x(null)})})]})]})})]}):w.kind===`automation`&&w.summary?(0,Q.jsx)(I,{content:w.summary}):(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:c.workbench.noSummary}):(0,Q.jsxs)(`div`,{className:`space-y-3`,"aria-busy":!0,children:[(0,Q.jsx)(J,{className:`h-5 w-2/3`}),(0,Q.jsx)(J,{className:`h-24`})]})}),C?(0,Q.jsxs)(`footer`,{className:`shrink-0 space-y-2 border-t border-edge px-4 py-3`,children:[d?(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:c.workbench.readFailed}):null,(0,Q.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[(0,Q.jsx)(X,{variant:`ghost`,disabled:l,onClick:()=>o(C),children:c.workbench.openFullResult}),(0,Q.jsx)(X,{variant:`primary`,disabled:!!T||!D||l,onClick:()=>void O(C),children:c.workbench.markRead})]})]}):null]})]})})}var jt=[`attention`,`delivery`,`resume`,`background`,`observation`],Mt=[`left`,`right`,`full`],Nt=`xopc.workbench.layout`,Pt=`application/x-xopc-workbench-card`,Ft=24,It=340,Lt=304,Rt=864,zt=1/1.57,Bt=260,Vt=72,Ht=1600,Ut={order:[...jt],lanes:{},sizes:{},ratio:zt};function Wt(){try{let e=JSON.parse(localStorage.getItem(Nt)??`{}`),t=Array.isArray(e?.order)?jt.filter(t=>e.order.includes(t)).sort((t,n)=>e.order.indexOf(t)-e.order.indexOf(n)):[],n={},r={};for(let t of jt){let i=e?.lanes?.[t];Mt.includes(i)&&(n[t]=i);let{width:a,height:o}=e?.sizes?.[t]??{},s=Number.isFinite(a)&&a>=Bt,c=Number.isFinite(o)&&o>=Vt&&o<=Ht;(s||c)&&(r[t]={width:s?a:void 0,height:c?o:void 0})}let i=typeof e?.ratio==`number`&&e.ratio>0&&e.ratio<1?e.ratio:zt;return{order:[...new Set([...t,...jt])],lanes:n,sizes:r,ratio:i}}catch{return Ut}}var Gt=`w-full justify-start rounded-md px-2.5 text-sm text-fg`;function Kt(e,t,n){return Math.round(Math.min(n,Math.max(t,e)))}function qt({cards:e,editing:t,language:n}){let r=n===`zh`,[i,a]=(0,Z.useState)(Wt),[o,s]=(0,Z.useState)({width:0,heights:{}}),[c,l]=(0,Z.useState)(),[u,d]=(0,Z.useState)(),[f,p]=(0,Z.useState)(),[m,h]=(0,Z.useState)(),[g,_]=(0,Z.useState)(``),v=(0,Z.useRef)(null),y=(0,Z.useRef)(null),b=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{if(!f)try{localStorage.setItem(Nt,JSON.stringify(i))}catch{}},[i,f]),(0,Z.useEffect)(()=>{let e=v.current,t=e?.closest(`[data-workbench-page-scroll]`);if(!e||!t)return;let n=e=>{let n=e.target instanceof Element?e.target.closest(`[data-workbench-card-scroll]`):null;n&&xe(e,n,t,{handoffOnly:!0})};return e.addEventListener(`wheel`,n,{passive:!1}),()=>e.removeEventListener(`wheel`,n)},[]);let x=o.width-Ft,S=Math.max(It,x-Lt),C=Math.max(It,Math.min(S,Math.round(x*i.ratio))),w=new Map(e.map(e=>[e.id,e])),T=Mt.map(e=>i.order.flatMap(t=>{let n=w.get(t);return n&&(i.lanes[t]??n.lane)===e?[n]:[]})),E=e.some(({id:e})=>i.lanes[e]===`left`||i.lanes[e]===`right`),D=o.width>=Rt,O=D&&(t||E||T[0].length>0&&T[1].length>0);(0,Z.useLayoutEffect)(()=>{let e=v.current;if(!e||typeof ResizeObserver>`u`)return;let t=()=>{let t=e.clientWidth,n={};for(let t of e.children)t instanceof HTMLElement&&t.dataset.workbenchItem&&(n[t.dataset.workbenchItem]=Math.ceil(t.getBoundingClientRect().height));s(e=>e.width===t&&Object.keys(e.heights).length===Object.keys(n).length&&Object.entries(n).every(([t,n])=>e.heights[t]===n)?e:{width:t,heights:n})},n=new ResizeObserver(t);n.observe(e);for(let t of e.children)n.observe(t);return t(),()=>n.disconnect()},[e,t,O,C]);function k(e,t){let{lane:n,anchor:o,after:s}=t;h(i),a(t=>{let r=t.order.filter(t=>t!==e);return r.splice(o?r.indexOf(o)+ +!!s:r.length,0,e),{...t,order:r,lanes:{...t.lanes,[e]:n}}}),_(r?`已移动「${w.get(e)?.label}」`:`Moved ${w.get(e)?.label}`)}function A(){l(void 0),d(void 0)}function M(e,t){!c||e.dataTransfer.getData(Pt)!==c||t.anchor===c||(e.preventDefault(),k(c,t),A())}function N(e,t){!c||t.anchor===c||(e.preventDefault(),e.dataTransfer.dropEffect=`move`,d(e=>e?.lane===t.lane&&e.anchor===t.anchor&&e.after===t.after?e:t))}function P(e,t,n){let r=e.currentTarget.getBoundingClientRect();return{lane:t,anchor:n,after:e.clientY>=r.top+r.height/2}}function F(e){let t=Kt(e,It,S);t!==C&&a(e=>({...e,ratio:t/x}))}function I(e){let t=y.current;t&&(y.current=null,p(void 0),e?a(t.before):i.ratio!==t.before.ratio&&h(t.before))}function L(e,t){a(n=>{let r=n.sizes[e];if(r?.width===t.width&&r?.height===t.height)return n;let i={...n.sizes,[e]:t};return t.width===void 0&&t.height===void 0&&delete i[e],{...n,sizes:i}})}function R(e){i.sizes[e.id]&&(h(i),L(e.id,{}),_(r?`「${e.label}」已恢复自动尺寸`:`${e.label} restored to automatic size`))}function z(e,t){let n=b.current;if(n)if(b.current=null,p(void 0),t)a(n.before);else{let t=n.before.sizes[e.id],a=i.sizes[e.id];(a?.width!==t?.width||a?.height!==t?.height)&&(h(n.before),_(r?`已调整「${e.label}」大小`:`Resized ${e.label}`))}}let B=r?[`左栏`,`右栏`,`全宽`]:[`Left column`,`Right column`,`Full width`],V=[0,0,0],H=new Map,U=Mt.filter((e,n)=>t&&T[n].length===0);for(let[e,t]of Mt.entries()){let n=e===1?C+Ft:0,r=e===0?C:e===1?x-C:o.width;t===`full`&&(V[2]=Math.max(V[0],V[1]));let i=T[e].map(e=>e.id);U.includes(t)&&i.push(t);for(let t of i)H.set(t,{top:V[e],left:n,width:r}),V[e]+=(o.heights[t]??0)+Ft}return(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`span`,{className:`sr-only`,role:`status`,children:g}),t?(0,Q.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-x-3 text-xs text-fg-muted`,children:[(0,Q.jsx)(`p`,{children:r?`拖动上方手柄移动卡片,拖动右下角调整大小。`:`Drag the top handle to move a card, or its bottom-right corner to resize.`}),(0,Q.jsxs)(`div`,{className:`flex gap-1`,children:[(0,Q.jsxs)(X,{variant:`ghost`,className:`rounded-lg text-xs`,disabled:!m,onClick:()=>{m&&(a(m),h(void 0),_(r?`已撤销布局调整`:`Layout change undone`))},children:[(0,Q.jsx)(K,{className:`size-3.5`,"aria-hidden":!0}),r?`撤销`:`Undo`]}),(0,Q.jsx)(X,{variant:`ghost`,className:`rounded-lg text-xs`,onClick:()=>{h(i),a(Ut)},children:r?`恢复默认布局`:`Reset layout`})]})]}):null,(0,Q.jsxs)(`div`,{ref:v,className:q(`relative min-w-0`,!O&&`flex flex-col gap-6`,f&&`select-none`),style:O?{height:Math.max(0,V[2]-Ft)}:void 0,children:[O?(0,Q.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":r?`调整左右栏宽度`:`Resize workbench columns`,"aria-valuemin":It,"aria-valuemax":S,"aria-valuenow":C,tabIndex:0,title:r?`左右拖动调整栏宽,双击恢复默认`:`Drag to resize columns, double-click to reset`,className:`group absolute top-0 z-10 flex w-6 touch-none cursor-col-resize items-start justify-center rounded-lg pt-3 focus-visible:outline-2 focus-visible:outline-accent`,style:{left:C,height:Math.max(0,Math.max(V[0],V[1])-Ft)},onPointerDown:e=>{e.button!==0||f||(e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),y.current={id:e.pointerId,x:e.clientX,width:C,before:i},p(`columns`))},onPointerMove:e=>{let t=y.current;t?.id===e.pointerId&&F(t.width+e.clientX-t.x)},onPointerUp:()=>I(!1),onPointerCancel:()=>I(!0),onLostPointerCapture:()=>I(!0),onDoubleClick:()=>{h(i),a(e=>({...e,ratio:zt}))},onKeyDown:e=>{let t={ArrowLeft:C-16,ArrowRight:C+16,Home:It,End:S};Object.hasOwn(t,e.key)&&(e.preventDefault(),h(i),F(t[e.key]))},children:(0,Q.jsx)(`span`,{"aria-hidden":!0,className:q(`h-8 w-px rounded-full bg-edge-strong motion-safe:transition-colors group-hover:bg-accent`,f===`columns`&&`bg-accent`)})}):null,T.flatMap((e,n)=>e.map((a,s)=>{let m=Mt[n],g=u?.anchor===a.id,v=r?`移动「${a.label}」`:`Move ${a.label}`,y=r?`调整「${a.label}」大小`:`Resize ${a.label}`,x=H.get(a.id),S=(O?x?.width:o.width)??o.width,C=i.sizes[a.id],w=D&&C?.width!==void 0?Math.min(S,C.width):void 0,T=C?.height,E=f===a.id,F=`home-workbench-content-${a.id}`;return(0,Q.jsxs)(`div`,{"data-workbench-item":a.id,"data-workbench-lane":m,className:q(`relative min-w-0`,O&&`absolute`,c===a.id&&`opacity-50`,t&&`rounded-xl bg-surface-panel pb-3 pointer-coarse:pb-8`,t&&`[&_[data-workbench-panel]]:bg-transparent`,E&&`ring-2 ring-accent`),style:O?{...x,width:w??x?.width}:{width:w},onDragOver:c?e=>N(e,P(e,m,a.id)):void 0,onDrop:c?e=>M(e,P(e,m,a.id)):void 0,onDragLeave:e=>{e.relatedTarget instanceof Node&&e.currentTarget.contains(e.relatedTarget)||d(e=>e?.anchor===a.id?void 0:e)},children:[g?(0,Q.jsx)(`span`,{"aria-hidden":!0,className:q(`pointer-events-none absolute inset-x-0 z-10 h-0.5 rounded-full bg-accent`,u.after?`-bottom-2`:`-top-2`)}):null,t?(0,Q.jsx)(`div`,{className:`flex justify-start px-2 pt-1`,children:(0,Q.jsxs)(ve,{children:[(0,Q.jsx)(be,{asChild:!0,children:(0,Q.jsx)(X,{variant:`ghost`,className:`h-7 cursor-grab rounded-lg px-3 py-0 active:cursor-grabbing`,"aria-label":v,title:v,draggable:!0,onDragStart:e=>{let t=e.currentTarget.closest(`[data-workbench-item]`);if(t){let n=t.getBoundingClientRect();e.dataTransfer.setDragImage(t,e.clientX-n.left,e.clientY-n.top)}e.dataTransfer.setData(Pt,a.id),e.dataTransfer.effectAllowed=`move`,l(a.id)},onDragEnd:A,children:(0,Q.jsx)(j,{className:`size-4`,"aria-hidden":!0})})}),(0,Q.jsx)(ge,{children:(0,Q.jsxs)(_e,{align:`start`,sideOffset:4,"aria-label":v,className:`z-50 min-w-36 rounded-lg border border-edge bg-surface-overlay p-1 shadow-popover`,children:[(0,Q.jsx)(ye,{asChild:!0,children:(0,Q.jsx)(X,{variant:`ghost`,className:Gt,disabled:s===0,onClick:()=>k(a.id,{lane:m,anchor:e[s-1]?.id}),children:r?`上移`:`Move up`})}),(0,Q.jsx)(ye,{asChild:!0,children:(0,Q.jsx)(X,{variant:`ghost`,className:Gt,disabled:s===e.length-1,onClick:()=>k(a.id,{lane:m,anchor:e[s+1]?.id,after:!0}),children:r?`下移`:`Move down`})}),Mt.map((e,t)=>(0,Q.jsx)(ye,{asChild:!0,children:(0,Q.jsx)(X,{variant:`ghost`,className:Gt,disabled:e===m,onClick:()=>k(a.id,{lane:e}),children:r?`移到${B[t]}`:`Move to ${B[t].toLowerCase()}`})},e)),(0,Q.jsx)(ye,{asChild:!0,children:(0,Q.jsx)(X,{variant:`ghost`,className:Gt,disabled:!C,onClick:()=>R(a),children:r?`恢复自动尺寸`:`Restore automatic size`})})]})})]})}):null,(0,Q.jsx)(`div`,{id:F,"data-workbench-card-scroll":T===void 0?void 0:``,className:q(`min-w-0 rounded-xl`,t&&(a.id===`delivery`||a.id===`resume`)&&`px-3`,T!==void 0&&`overflow-auto overscroll-y-auto focus-visible:outline-2 focus-visible:outline-accent [&>section]:min-h-full [&>section:has(>[data-workbench-fill])]:flex [&>section:has(>[data-workbench-fill])]:flex-col [&>section>[data-workbench-fill]]:grow`),style:{height:T},role:T===void 0?void 0:`group`,"aria-label":T===void 0?void 0:a.label,tabIndex:T===void 0?void 0:0,children:a.content}),t?(0,Q.jsxs)(Q.Fragment,{children:[E?(0,Q.jsxs)(`span`,{"aria-hidden":!0,className:`pointer-events-none absolute bottom-2 right-9 z-10 rounded-md bg-accent-soft px-2 py-1 text-xs tabular-nums text-accent-fg`,children:[D?`${w??S} × `:``,T??b.current?.height,` px`]}):null,(0,Q.jsx)(X,{variant:`segmented`,className:q(`absolute bottom-0 right-0 z-10 size-8 touch-none rounded-none rounded-br-xl p-0 active:scale-100`,`pointer-fine:[clip-path:polygon(0_75%,75%_75%,75%_0,100%_0,100%_100%,0_100%)]`,`after:pointer-events-none after:absolute after:inset-0 after:rounded-br-xl after:border-b-2 after:border-r-2 after:border-accent after:opacity-0 motion-safe:after:transition-opacity hover:after:opacity-100 focus-visible:after:opacity-100`,D?`cursor-nwse-resize`:`cursor-ns-resize`,E&&`after:opacity-100`),"aria-label":y,"aria-controls":F,title:r?`拖动或使用方向键调整大小,双击恢复自动尺寸`:`Drag or use arrow keys to resize. Double-click to restore automatic size.`,onPointerDown:e=>{if(e.button!==0||f)return;let t=document.getElementById(F)?.getBoundingClientRect();t&&(e.currentTarget.focus({preventScroll:!0}),e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),b.current={pointer:e.pointerId,x:e.clientX,y:e.clientY,width:Math.round(t.width),height:Math.round(t.height),before:i},p(a.id))},onPointerMove:e=>{let t=b.current;if(t?.pointer!==e.pointerId)return;let n=t.before.sizes[a.id],r=e.clientX-t.x,i=e.clientY-t.y;L(a.id,{width:D&&r!==0?Kt(t.width+r,Bt,S):n?.width,height:i===0?n?.height:Kt(t.height+i,Vt,Ht)})},onPointerUp:()=>z(a,!1),onPointerCancel:()=>z(a,!0),onLostPointerCapture:()=>z(a,!0),onDoubleClick:()=>R(a),onKeyDown:e=>{if(e.key===`Escape`&&E){e.preventDefault();let t=b.current?.pointer;z(a,!0),t!==void 0&&e.currentTarget.hasPointerCapture(t)&&e.currentTarget.releasePointerCapture(t);return}if(e.key===`Home`||e.key===`Enter`||e.key===` `){e.preventDefault(),R(a);return}let t=e.key===`ArrowLeft`||e.key===`ArrowRight`,n=e.key===`ArrowUp`||e.key===`ArrowDown`;if((!t||!D)&&!n)return;let o=document.getElementById(F)?.getBoundingClientRect();if(!o)return;e.preventDefault();let s=e.key===`ArrowLeft`||e.key===`ArrowUp`?-16:16;h(i),L(a.id,{width:t?Kt((w??o.width)+s,Bt,S):C?.width,height:n?Kt((T??o.height)+s,Vt,Ht):C?.height}),_(r?`已调整「${a.label}」大小`:`Resized ${a.label}`)}})]}):null]},a.id)})),U.map(e=>(0,Q.jsx)(`div`,{"data-workbench-item":e,className:q(`grid min-h-16 place-items-center rounded-xl border border-dashed border-edge-strong text-xs text-fg-muted`,O&&`absolute`,u?.lane===e&&!u.anchor&&`border-accent bg-accent-soft text-accent-fg`),style:O?H.get(e):void 0,onDragOver:t=>N(t,{lane:e}),onDrop:t=>M(t,{lane:e}),onDragLeave:()=>d(t=>t?.lane===e&&!t.anchor?void 0:t),children:B[Mt.indexOf(e)]},e))]})]})}function Jt(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}var Yt=`xopc-home-read-deliveries`,Xt=`min-w-0 rounded-xl bg-surface-panel`,Zt=`text-base font-semibold tracking-tight text-fg`,Qt=`@min-[54rem]/workbench:grid-cols-[minmax(0,1fr)_minmax(19rem,0.57fr)]`;function $t(){try{let e=JSON.parse(localStorage.getItem(Yt)??`[]`);return Array.isArray(e)?e.filter(e=>typeof e==`string`).slice(0,300):[]}catch{return[]}}function en(){let e=(0,Ge.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(J,{className:`h-56 rounded-xl`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsxs)(`div`,{className:`grid items-start gap-6 ${Qt}`,"aria-busy":!0,children:[(0,Q.jsxs)(`div`,{className:`space-y-6`,children:[t,(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsx)(J,{className:`h-5 w-28 rounded-md`}),(0,Q.jsx)(J,{className:`h-24 rounded-xl`})]})]}),(0,Q.jsx)(J,{className:`h-44 rounded-xl`})]}),e[1]=n):n=e[1],n}function tn(e){let t=(0,Ge.c)(91),{item:n,busy:r,primary:i,dueLabel:o,failureLabel:s,locale:c,onAction:l,onComplete:u,onUpdated:d}=e,[p,m]=a(),h;t[0]===n.openAction?h=t[1]:(h=n.openAction?.type===`open`?/^\/tasks\/([^/?#]+)/.exec(n.openAction.href):null,t[0]=n.openAction,t[1]=h);let g=h,_=n.primaryAction?.type===`task_review`?n.primaryAction.taskId:g?decodeURIComponent(g[1]):void 0,v;t[2]!==_||t[3]!==p?(v=_&&p.get(`reviewTask`)===_,t[2]=_,t[3]=p,t[4]=v):v=t[4];let y=!!v,b;t[5]!==_||t[6]!==p||t[7]!==m?(b=e=>{let t=new URLSearchParams(p);e&&_?t.set(`reviewTask`,_):t.delete(`reviewTask`),m(t)},t[5]=_,t[6]=p,t[7]=m,t[8]=b):b=t[8];let x=b,[S,C]=(0,Z.useState)(!1),w;t[9]===c?w=t[10]:(w=f(c),t[9]=c,t[10]=w);let T=w.projectsPage.home.workbench,E=n.primaryAction?.type===`connector_decision`,D;t[11]!==o||t[12]!==n.dueAt||t[13]!==c?(D=n.dueAt===void 0?null:`${o} ${Le(n.dueAt,c)}`,t[11]=o,t[12]=n.dueAt,t[13]=c,t[14]=D):D=t[14];let O=D,k;t[15]!==E||t[16]!==n.summary?(k=E?n.summary.split(`
7
+ Verification checks are defined`,className:`mt-1 min-h-24 w-full rounded-lg border border-edge bg-surface-panel p-2`})]}),(0,Q.jsxs)(`label`,{className:`block text-sm text-fg`,children:[a?`现在先推进哪一步?`:`What is the first step?`,(0,Q.jsx)(`input`,{required:!0,maxLength:1e3,value:h,onChange:e=>g(e.target.value),placeholder:a?`整理现有线索、已知事实和缺少的日志。`:`Organize existing reports, known facts and missing logs.`,className:`mt-1 w-full rounded-lg border border-edge bg-surface-panel p-2`})]}),(0,Q.jsxs)(`details`,{children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer text-xs text-fg-muted`,children:a?`参考资料范围:已选 ${v.length} 段对话`:`Source scope: ${v.length} selected conversations`}),(0,Q.jsx)(`div`,{className:`mt-2 max-h-40 space-y-2 overflow-y-auto`,children:n.topics.map(e=>(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:v.includes(e.id),disabled:!v.includes(e.id)&&v.length>=8,onChange:t=>y(t.target.checked?[...v,e.id]:v.filter(t=>t!==e.id))}),(0,Q.jsx)(`span`,{className:`truncate`,children:e.title})]},e.id))})]}),n.topics.length?null:(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:a?`先在对话里提供这件事的背景资料,开启观察后再选为参考来源。`:`First provide the background in a chat, then select it as a source.`}),(0,Q.jsxs)(`label`,{className:`flex items-start gap-2 text-xs leading-5 text-fg-muted`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:b,onChange:e=>x(e.target.checked),className:`mt-1`}),a?`资料齐备时自动继续本轮分析,最多 3 步;缺资料或检查未通过就停下。只整理资料和分析,不修改外部服务。`:`Continue private analysis automatically, up to 3 steps this round. Stop for missing input or failed checks. No changes to external services.`]}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a?`一份阶段结果不等于整个目标完成。最终由你对照完成标准验收,随时可以暂停或结束。`:`A step result does not complete the goal. You review the final criteria, and can pause or end at any time.`}),w?(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:w}):null,(0,Q.jsx)(X,{variant:`primary`,type:`submit`,disabled:S||!v.length,children:a?`确认目标,开始第一步`:`Confirm goal and start`}),(0,Q.jsx)(X,{variant:`ghost`,disabled:S,onClick:()=>c(!1),children:a?`取消`:`Cancel`})]}):(0,Q.jsx)(X,{variant:o.some(ct)?`ghost`:`primary`,onClick:()=>D(),children:o.some(st)?a?`再交给我一件事`:`Add another goal`:a?`交给我持续推进一件事`:`Keep a goal moving`})]}):null,j=o.some(at)?(0,Q.jsxs)(`details`,{children:[(0,Q.jsx)(`summary`,{className:`text-xs text-fg-muted`,children:a?`已结束的目标`:`Past goals`}),o.filter(it).map(e=>(0,Q.jsx)(ft,{followUp:e,language:r,onUpdated:i},e.id))]}):null,M;return t[7]!==k||t[8]!==A||t[9]!==j?(M=(0,Q.jsxs)(`div`,{className:`mt-3 space-y-4`,children:[k,A,j]}),t[7]=k,t[8]=A,t[9]=j,t[10]=M):M=t[10],M}function it(e){return[`done`,`ended`].includes(e.status)}function at(e){return[`done`,`ended`].includes(e.status)}function ot(e){return e.trim()}function st(e){return![`done`,`ended`].includes(e.status)}function ct(e){return![`done`,`ended`].includes(e.status)}function lt(e){return![`done`,`ended`].includes(e.status)}function ut(e){return![`done`,`ended`].includes(e.status)}function dt(e){return e.id}function ft(e){let t=(0,Ge.c)(100),{followUp:n,language:r,onUpdated:i}=e,a=r===`zh`,[o,s]=(0,Z.useState)(),[c,u]=(0,Z.useState)(!1),[f,p]=(0,Z.useState)(``),[m,h]=(0,Z.useState)(``),[g,_]=(0,Z.useState)(``),[v,y]=(0,Z.useState)(!1),[b,x]=(0,Z.useState)(),[S,C]=(0,Z.useState)(!1),[w,T]=(0,Z.useState)(!1),E;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(E=[],t[0]=E):E=t[0];let[D,O]=(0,Z.useState)(E),[k,A]=(0,Z.useState)(``),j=o&&o.revision>n.revision?o:n,M;t[1]===j.steps?M=t[2]:(M=j.steps.at(-1),t[1]=j.steps,t[2]=M);let N=M,P;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(P=[`done`,`ended`],t[3]=P):P=t[3];let F=P.includes(j.status),I=N?.status===`queued`?a?`下一步已安排`:`Next step queued`:N&&[`succeeded`,`failed`,`cancelled`].includes(N.status)?a?`正在整理本步结果`:`Processing the step result`:a?`正在推进`:`In progress`,L=a?`等资料 / 待处理`:`Waiting for input`,R=a?`等你确认下一步`:`Review next step`,z=a?`已暂停`:`Paused`,B=a?`已由你验收完成`:`Accepted by you`,V=a?`已结束`:`Ended`,H;t[4]!==I||t[5]!==L||t[6]!==R||t[7]!==z||t[8]!==B||t[9]!==V?(H={working:I,waiting:L,review:R,paused:z,done:B,ended:V},t[4]=I,t[5]=L,t[6]=R,t[7]=z,t[8]=B,t[9]=V,t[10]=H):H=t[10];let U=H[j.status],W;t[11]!==c||t[12]!==j.id||t[13]!==j.revision||t[14]!==i||t[15]!==a?(W=e=>{c||(u(!0),p(``),d(l(`/api/home/follow-ups/${encodeURIComponent(j.id)}/command`),{method:`POST`,body:JSON.stringify({expectedRevision:j.revision,idempotencyKey:crypto.randomUUID(),command:e})}).then(t=>{s(te.parse(t)),e.kind===`add_input`&&h(``),y(!1),C(!1),T(!1),i()}).catch(e=>{let t=e instanceof Error?e.message:String(e);p(/changed/i.test(t)?a?`这条目标有新进展,已刷新。请确认后再操作。`:`Progress changed. Review the refreshed goal and try again.`:t),i()}).finally(()=>u(!1)))},t[11]=c,t[12]=j.id,t[13]=j.revision,t[14]=i,t[15]=a,t[16]=W):W=t[16];let G=W,K=a?`持续推进的目标`:`Continuing goal`,ee=a?`持续推进`:`Continuing goal`,q;t[17]===ee?q=t[18]:(q=(0,Q.jsx)(`p`,{className:`text-xs font-medium text-accent-fg`,children:ee}),t[17]=ee,t[18]=q);let J;t[19]===U?J=t[20]:(J=(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,role:`status`,children:U}),t[19]=U,t[20]=J);let Y;t[21]!==q||t[22]!==J?(Y=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[q,J]}),t[21]=q,t[22]=J,t[23]=Y):Y=t[23];let ne;t[24]===j.goal?ne=t[25]:(ne=(0,Q.jsx)(`h4`,{className:`break-words text-base font-semibold text-fg`,children:j.goal}),t[24]=j.goal,t[25]=ne);let re;t[26]===f?re=t[27]:(re=f?(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:f}):null,t[26]=f,t[27]=re);let ie;t[28]!==j.stopPending||t[29]!==a?(ie=j.stopPending?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:a?`已停止安排新步骤,正在确认上一步是否终止。`:`No new steps will start until the previous execution is confirmed stopped.`}):null,t[28]=j.stopPending,t[29]=a,t[30]=ie):ie=t[30];let ae;t[31]!==j.summary||t[32]!==a?(ae=j.summary?(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a?`最近进展`:`Latest progress`}),(0,Q.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap break-words text-sm text-fg`,children:j.summary})]}):null,t[31]=j.summary,t[32]=a,t[33]=ae):ae=t[33];let oe;t[34]!==j.waitingFor||t[35]!==a?(oe=j.waitingFor?(0,Q.jsxs)(`div`,{className:`rounded-lg bg-surface-panel p-3`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a?`当前需要`:`What is needed`}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:j.waitingFor===`Source scope or goal contract needs review`?a?`参考资料或目标要求已变更,请先检查。`:`Source scope or goal requirements need review.`:j.waitingFor===`Step history changed; review before resuming`?a?`一步历史结果已删除,目标已暂停。请确认下一步后再继续。`:`A step was deleted. Review the next action before resuming.`:j.waitingFor===`New material awaits review`?a?`有新增资料还没核对,请先推进下一步。`:`New material needs review before goal acceptance.`:j.waitingFor})]}):null,t[34]=j.waitingFor,t[35]=a,t[36]=oe):oe=t[36];let se;t[37]!==j.nextStep||t[38]!==j.status||t[39]!==a?(se=j.nextStep?(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:j.status===`working`?a?`当前这一步`:`Current step`:a?`建议下一步`:`Proposed next step`}),(0,Q.jsx)(`p`,{className:`mt-1 break-words text-sm text-fg`,children:j.nextStep})]}):null,t[37]=j.nextStep,t[38]=j.status,t[39]=a,t[40]=se):se=t[40];let ce;t[41]!==N||t[42]!==b||t[43]!==a?(ce=N?(0,Q.jsx)(X,{variant:`secondary`,onClick:()=>x(b===N.taskId?void 0:N.taskId),children:a?`查看第 ${N.number} 步的进度与结果`:`Review step ${N.number}`}):null,t[41]=N,t[42]=b,t[43]=a,t[44]=ce):ce=t[44];let le;t[45]!==k||t[46]!==S||t[47]!==G||t[48]!==c||t[49]!==D||t[50]!==w||t[51]!==v||t[52]!==F||t[53]!==j.autoContinue||t[54]!==j.criteria||t[55]!==j.nextStep||t[56]!==j.remainingSteps||t[57]!==j.status||t[58]!==j.stopPending||t[59]!==N?.verified||t[60]!==g||t[61]!==m||t[62]!==a?(le=F?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:j.autoContinue?a?`本轮还可自动推进 ${j.remainingSteps} 步。每步结果都会保留,遇到资料缺口会停下。`:`Up to ${j.remainingSteps} more automatic steps this round. Missing input stops progress.`:a?`每个下一步都由你确认后再执行。`:`You confirm each next step before it runs.`}),j.status===`review`&&!j.stopPending?(0,Q.jsx)(X,{variant:`primary`,disabled:c,onClick:()=>{_(j.nextStep),y(!v)},children:j.nextStep?a?`确认或调整下一步`:`Confirm or adjust next step`:a?`安排下一步`:`Set the next step`}):null,v?(0,Q.jsxs)(`form`,{className:`space-y-2`,onSubmit:e=>{e.preventDefault(),G({kind:`continue`,nextStep:g,stepBudget:j.autoContinue?3:1})},children:[(0,Q.jsxs)(`label`,{className:`block text-xs text-fg-muted`,children:[a?`下一步要完成什么?`:`What should the next step deliver?`,(0,Q.jsx)(`textarea`,{required:!0,maxLength:1e3,value:g,onChange:e=>_(e.target.value),className:`mt-1 min-h-20 w-full rounded-lg border border-edge bg-surface-inset p-2 text-sm text-fg`})]}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:j.autoContinue?a?`确认后,本轮最多再推进 3 步。`:`Confirm up to 3 more private steps this round.`:a?`确认后仅执行这一步。`:`Confirm this step only.`}),(0,Q.jsx)(X,{type:`submit`,variant:`primary`,disabled:c,children:a?`确认继续推进`:`Continue with this step`})]}):null,(0,Q.jsxs)(`form`,{className:`space-y-2`,onSubmit:e=>{e.preventDefault(),G({kind:`add_input`,text:m})},children:[(0,Q.jsxs)(`label`,{className:`block text-xs text-fg-muted`,children:[a?`补充资料或最新情况`:`Add evidence or an update`,(0,Q.jsx)(`textarea`,{required:!0,maxLength:8e3,value:m,onChange:e=>h(e.target.value),placeholder:a?`粘贴复现条件、日志片段,或说明有什么新进展。`:`Add reproduction steps, logs or new progress.`,className:`mt-1 min-h-16 w-full rounded-lg border border-edge bg-surface-inset p-2 text-sm text-fg`})]}),(0,Q.jsx)(X,{variant:j.status===`waiting`?`primary`:`secondary`,disabled:c||!m.trim(),type:`submit`,children:j.status===`waiting`&&j.autoContinue&&j.remainingSteps>0&&N?.verified?a?`补充资料,继续推进`:`Add evidence and continue`:a?`补充到这条目标`:`Add to this goal`})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[j.status===`waiting`&&!j.stopPending?(0,Q.jsx)(X,{variant:`ghost`,onClick:()=>{_(j.nextStep),y(!v)},children:a?`调整下一步`:`Adjust next step`}):null,(0,Q.jsx)(X,{variant:`ghost`,disabled:c,onClick:()=>G({kind:j.status===`paused`?`resume`:`pause`}),children:j.status===`paused`?a?`恢复推进`:`Resume`:a?`暂停推进`:`Pause`}),N?.verified&&j.status!==`working`&&!j.stopPending?(0,Q.jsx)(X,{variant:`ghost`,onClick:()=>C(!S),children:a?`验收整个目标`:`Review goal completion`}):null,(0,Q.jsx)(X,{variant:`ghost`,onClick:()=>T(!w),children:a?`结束跟进`:`End follow-up`})]}),w?(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:a?`停止后续推进并请求取消当前步骤,保留已有结果。`:`Stop further work and cancel the current step. Keep previous results.`}),(0,Q.jsx)(X,{disabled:c,onClick:()=>G({kind:`end`}),children:a?`确认结束跟进`:`Confirm end`})]}):null,S?(0,Q.jsxs)(`form`,{className:`space-y-3 rounded-lg bg-surface-panel p-3`,onSubmit:e=>{e.preventDefault(),G({kind:`complete`,confirmedCriteria:D,note:k})},children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:a?`请对照结果逐项确认,阶段产出不代表目标已完成。`:`Confirm each criterion against the results. A completed step is not a completed goal.`}),j.criteria.map((e,t)=>(0,Q.jsxs)(`label`,{className:`flex items-start gap-2 text-sm text-fg-muted`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:D.includes(t),onChange:e=>O(e.target.checked?[...D,t]:D.filter(e=>e!==t))}),e]},t)),(0,Q.jsxs)(`label`,{className:`block text-xs text-fg-muted`,children:[a?`验收依据`:`Acceptance evidence`,(0,Q.jsx)(`textarea`,{required:!0,maxLength:1e3,value:k,onChange:e=>A(e.target.value),className:`mt-1 w-full rounded-lg border border-edge bg-surface-panel p-2 text-sm`})]}),(0,Q.jsx)(X,{type:`submit`,variant:`primary`,disabled:c||D.length!==j.criteria.length||!k.trim(),children:a?`确认目标已完成`:`Accept completed goal`})]}):null]}),t[45]=k,t[46]=S,t[47]=G,t[48]=c,t[49]=D,t[50]=w,t[51]=v,t[52]=F,t[53]=j.autoContinue,t[54]=j.criteria,t[55]=j.nextStep,t[56]=j.remainingSteps,t[57]=j.status,t[58]=j.stopPending,t[59]=N?.verified,t[60]=g,t[61]=m,t[62]=a,t[63]=le):le=t[63];let ue=a?`完成标准与推进记录`:`Acceptance criteria and step history`,de;t[64]===ue?de=t[65]:(de=(0,Q.jsx)(`summary`,{className:`cursor-pointer text-xs text-fg-muted`,children:ue}),t[64]=ue,t[65]=de);let fe;t[66]===j.criteria?fe=t[67]:(fe=j.criteria.map(pt),t[66]=j.criteria,t[67]=fe);let pe;t[68]===fe?pe=t[69]:(pe=(0,Q.jsx)(`ul`,{className:`mt-2 list-disc pl-4 text-sm text-fg-muted`,children:fe}),t[68]=fe,t[69]=pe);let me;if(t[70]!==j.steps||t[71]!==a){let e;t[73]===a?e=t[74]:(e=e=>(0,Q.jsxs)(`div`,{className:`mt-2 flex items-center justify-between gap-2 border-l border-edge pl-3 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`span`,{children:[e.number,`. `,e.action,` · `,e.verified?a?`本步检查通过`:`Step checked`:a?`结果待核查`:`Needs review`]}),(0,Q.jsx)(X,{variant:`ghost`,onClick:()=>x(e.taskId),children:a?`查看`:`Review`})]},e.number),t[73]=a,t[74]=e),me=j.steps.map(e),t[70]=j.steps,t[71]=a,t[72]=me}else me=t[72];let he;t[75]!==de||t[76]!==pe||t[77]!==me?(he=(0,Q.jsxs)(`details`,{children:[de,pe,me]}),t[75]=de,t[76]=pe,t[77]=me,t[78]=he):he=t[78];let ge;t[79]!==r||t[80]!==i||t[81]!==b?(ge=b?(0,Q.jsx)(ze,{taskId:b,language:r,onComplete:i}):null,t[79]=r,t[80]=i,t[81]=b,t[82]=ge):ge=t[82];let _e=`#/tasks/${encodeURIComponent(j.rootTaskId)}`,ve=a?`查看完整目标与子任务`:`View the goal and its child tasks`,ye;t[83]!==_e||t[84]!==ve?(ye=(0,Q.jsx)(`a`,{className:`inline-block text-xs text-accent-fg`,href:_e,children:ve}),t[83]=_e,t[84]=ve,t[85]=ye):ye=t[85];let be;return t[86]!==K||t[87]!==Y||t[88]!==ne||t[89]!==re||t[90]!==ie||t[91]!==ae||t[92]!==oe||t[93]!==se||t[94]!==ce||t[95]!==le||t[96]!==he||t[97]!==ge||t[98]!==ye?(be=(0,Q.jsxs)(`section`,{className:`space-y-3 rounded-lg bg-surface-inset p-3`,"aria-label":K,children:[Y,ne,re,ie,ae,oe,se,ce,le,he,ge,ye]}),t[86]=K,t[87]=Y,t[88]=ne,t[89]=re,t[90]=ie,t[91]=ae,t[92]=oe,t[93]=se,t[94]=ce,t[95]=le,t[96]=he,t[97]=ge,t[98]=ye,t[99]=be):be=t[99],be}function pt(e){return(0,Q.jsx)(`li`,{children:e},e)}function mt(e){let t=(0,Ge.c)(29),{starters:n,revision:r,language:i,onStarted:a,onUpdated:o}=e,s=i===`zh`,[c,u]=(0,Z.useState)(),[f,p]=(0,Z.useState)(!1),[m,h]=(0,Z.useState)(``),g;if(t[0]!==f||t[1]!==m||t[2]!==i||t[3]!==a||t[4]!==o||t[5]!==r||t[6]!==c||t[7]!==n||t[8]!==s){let e;t[10]===c?e=t[11]:(e=e=>e.kind===c,t[10]=c,t[11]=e);let _=n.find(e),v=_&&ne[_.kind][i],y=s?`这些工作,可以先帮你整理一份`:`Here is work I can prepare for you`,b;t[12]===y?b=t[13]:(b=(0,Q.jsx)(`p`,{className:`text-base font-semibold text-fg`,children:y}),t[12]=y,t[13]=b);let x=s?`从近期的相关请求中整理资料和待办,先给你看结果,再决定是否定期交给我。`:`Turn recent requests into useful drafts. Review the result before deciding whether to make it recurring.`,S;t[14]===x?S=t[15]:(S=(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:x}),t[14]=x,t[15]=S);let C;if(t[16]!==f||t[17]!==i||t[18]!==c||t[19]!==n||t[20]!==s){let e;t[22]!==f||t[23]!==i||t[24]!==c||t[25]!==s?(e=e=>{let t=ne[e.kind][i];return(0,Q.jsxs)(`article`,{className:`flex min-w-0 flex-col items-start gap-2 rounded-lg border border-edge p-3`,children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:t.title}),(0,Q.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:t.output}),(0,Q.jsx)(`p`,{className:`mt-auto text-xs text-fg-subtle`,children:s?`最近有 ${e.requestCount} 条相关请求`:`${e.requestCount} related recent requests`}),(0,Q.jsx)(X,{disabled:f,"aria-expanded":c===e.kind,onClick:()=>{u(e.kind),h(``)},children:s?`看看会做什么`:`See what I will prepare`})]},e.kind)},t[22]=f,t[23]=i,t[24]=c,t[25]=s,t[26]=e):e=t[26],C=n.map(e),t[16]=f,t[17]=i,t[18]=c,t[19]=n,t[20]=s,t[21]=C}else C=t[21];let w;t[27]===C?w=t[28]:(w=(0,Q.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:C}),t[27]=C,t[28]=w),g=(0,Q.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[b,S,w,_&&v?(0,Q.jsxs)(`form`,{className:`space-y-3 rounded-lg border border-edge bg-surface-inset p-3`,onSubmit:e=>{e.preventDefault(),!f&&(p(!0),h(``),d(l(`/api/home/observation/prepare`),{method:`POST`,body:JSON.stringify({kind:_.kind,topicIds:_.topicIds,expectedRevision:r,idempotencyKey:crypto.randomUUID(),locale:i})}).then(e=>{let t=Y.parse(e);if(t.outcome!==`task`)throw Error(s?`暂时无法开始,请稍后重试。`:`Could not start this draft.`);a(t.taskId),u(void 0),o()}).catch(e=>{let t=e instanceof Error?e.message:String(e);h(/revision|Refresh|available/i.test(t)?s?`工作记录有更新,已刷新可用任务,请重新确认。`:`Work has changed. Review the refreshed task and try again.`:t),o()}).finally(()=>p(!1)))},children:[(0,Q.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:s?`你会得到:${v.title}`:`You will get: ${v.title}`}),(0,Q.jsx)(`ul`,{className:`list-disc space-y-1 pl-4 text-sm text-fg-muted`,children:v.deliverables.map(gt)}),(0,Q.jsxs)(`details`,{className:`text-xs text-fg-muted`,children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer`,children:s?`这次参考的请求`:`Requests used for this draft`}),_.previews.map(ht)]}),(0,Q.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:s?`先准备私人草稿,资料不足会标出来。不发消息,也不自动设定时。`:`Prepare a private draft and flag missing material. No messages or recurring runs.`}),m?(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:m}):null,(0,Q.jsx)(X,{variant:`primary`,type:`submit`,disabled:f,children:f?s?`正在创建任务…`:`Starting…`:s?`先生成一份`:`Prepare this draft`}),(0,Q.jsx)(X,{variant:`ghost`,disabled:f,onClick:()=>u(void 0),children:s?`取消`:`Cancel`})]}):null]}),t[0]=f,t[1]=m,t[2]=i,t[3]=a,t[4]=o,t[5]=r,t[6]=c,t[7]=n,t[8]=s,t[9]=g}else g=t[9];return g}function ht(e,t){return(0,Q.jsx)(`p`,{className:`mt-2 break-words`,children:e},t)}function gt(e){return(0,Q.jsx)(`li`,{children:e},e)}function _t({observation:e,advisor:t,language:n,emphasizeStart:r=!0,onUpdated:i}){let a=n===`zh`,[o,s]=(0,Z.useState)(!1),[c,u]=(0,Z.useState)(``),[f,p]=(0,Z.useState)(``),[m,h]=(0,Z.useState)(!1),[g,_]=(0,Z.useState)(``),[v,y]=(0,Z.useState)(`once`),[b,x]=(0,Z.useState)(),[S,w]=(0,Z.useState)(!1),[T,E]=(0,Z.useState)(),[D,O]=(0,Z.useState)(!1),[k,A]=(0,Z.useState)(!1),[j,M]=(0,Z.useState)(),[N,F]=(0,Z.useState)(!1),I=t.state===`ready`?t.primary:void 0,L=I?.evidence.map(e=>/^observation:([^:]+):/.exec(e.id)?.[1]).find(Boolean),R=e.topics.filter(e=>e.feedback.some(e=>e.status===`active`)||e.trials.length||e.routine),z=R.find(e=>e.id===T),B=b?e.topics.find(e=>e.id===b):e.topics.find(e=>e.routine&&e.routine.status!==`ended`)??e.topics.find(e=>e.trials.length)??e.topics.find(e=>e.id===L)??e.topics[0],V=e.status===`active`&&B?.id===L?I:void 0,H=B?.trials[0],U=!!(B?.routine||H||V),W=t.state===`quiet`&&[`model_unavailable`,`generation_failed`,`budget_exhausted`].includes(t.reason),K=async e=>{if(!o){s(!0),u(``),p(``);try{await e(),i()}catch(e){u(e instanceof Error?e.message:String(e)),i()}finally{s(!1)}}},ee=async t=>re.parse(await d(l(`/api/home/observation/command`),{method:`POST`,body:JSON.stringify({expectedRevision:e.revision,idempotencyKey:crypto.randomUUID(),command:t})})),q=()=>{B&&(x(B.id),w(!S))},J=()=>B&&void K(async()=>{let t=await d(l(`/api/home/observation/discussion`),{method:`POST`,body:JSON.stringify({topicId:B.id,expectedRevision:e.revision,idempotencyKey:crypto.randomUUID()})});window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:t}))});return(0,Q.jsxs)(`section`,{className:`rounded-xl bg-surface-panel p-4`,"aria-labelledby":`home-observation-title`,"aria-busy":o,"data-workbench-panel":!0,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,Q.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-accent-soft text-accent-fg`,children:(0,Q.jsx)(G,{className:`size-4`,"aria-hidden":!0})}),(0,Q.jsx)(`h2`,{id:`home-observation-title`,className:`text-base font-semibold tracking-tight text-fg`,children:a?`交给我`:`Let me handle it`})]}),(0,Q.jsxs)(X,{variant:`ghost`,className:`gap-1 rounded-lg px-2 text-xs`,"aria-expanded":D,onClick:()=>O(!D),children:[a?`记录与设置`:`History and settings`,(0,Q.jsx)(C,{className:D?`size-3.5 shrink-0 rotate-180`:`size-3.5 shrink-0`,"aria-hidden":!0})]})]}),c?(0,Q.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-danger`,children:c}):null,f?(0,Q.jsx)(`p`,{role:`status`,className:`mt-3 text-sm text-fg-muted`,children:f}):null,b&&!B&&g?(0,Q.jsxs)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:[a?`这件事已不在记录中。未保存的内容:`:`This item is no longer available. Your unsaved note: `,g]}):null,(0,Q.jsx)(rt,{observation:e,language:n,onUpdated:i}),e.status===`active`?(0,Q.jsx)(X,{className:`mt-3`,variant:`ghost`,"aria-expanded":m,onClick:()=>h(!m),children:a?`一次性整理与定期安排`:`One-off drafts and recurring work`}):null,e.status!==`active`||m?(0,Q.jsx)(Q.Fragment,{children:e.status===`disabled`?(0,Q.jsxs)(`div`,{className:`mt-4`,children:[(0,Q.jsx)(`h3`,{className:`text-balance text-lg font-semibold leading-snug tracking-tight text-fg`,children:a?`把重复的事,慢慢交给我`:`Let me take recurring work off your hands`}),(0,Q.jsx)(`p`,{className:`mt-2 max-w-prose text-sm leading-6 text-fg-muted`,children:a?`我会结合你在 xopc 中的工作记录,寻找可以代劳的事情。有合适的建议时,先做一次给你看。`:`I can look through your work in xopc for tasks I could take on, then offer a first draft for you to review.`}),(0,Q.jsx)(X,{className:`mt-3 rounded-lg text-xs sm:shadow-none`,variant:r?`primary`:`tonal`,disabled:o,onClick:()=>void K(async()=>{await ee({kind:`start`,backfillDays:30})}),children:a?`帮我发现重复工作`:`Find recurring work`}),(0,Q.jsxs)(`p`,{className:`mt-4 flex items-start gap-2 text-xs leading-5 text-fg-muted`,children:[(0,Q.jsx)(P,{className:`mt-1 size-3 shrink-0`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:a?`仅查看最近 30 天已授权的私人会话及后续工作记录。不扫描屏幕,定期执行前会请你确认。`:`Uses up to 30 days of authorized private chats and new work. No screen recording. Recurring runs need your confirmation.`})]})]}):(0,Q.jsxs)(Q.Fragment,{children:[!U&&e.status===`active`&&e.starters?.length?(0,Q.jsx)(mt,{starters:e.starters,revision:e.revision,language:n,onStarted:M,onUpdated:i}):U?B?.routine?(0,Q.jsx)(Be,{routine:B.routine,language:n,onUpdated:i},B.routine.id):H?(0,Q.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:[`review`,`closed`].includes(H.phase)?a?`先看看这次做得怎么样`:`Review the first result`:a?`先做一次,再决定是否定期交给我`:`Try it once before making it recurring`}),(0,Q.jsx)(`p`,{className:`text-base font-medium text-fg`,children:H.title}),(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:a?`满意后再决定要不要定期交给我。`:`Review the result before deciding whether to make it recurring.`}),(0,Q.jsx)(X,{variant:`primary`,onClick:()=>M(j===H.taskId?void 0:H.taskId),children:a?`查看这次结果`:`Review this result`}),[`review`,`closed`].includes(H.phase)?(0,Q.jsx)(Ve,{topicId:B.id,trial:H,language:n,onUpdated:i},H.taskId):null]}):V&&B?(0,Q.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a?`这件事,可以先让我试试`:`Here is something I could try`}),(0,Q.jsx)(`p`,{className:`text-base font-medium text-fg`,children:V.title}),(0,Q.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:V.outcome}),V.risk===`analysis`?(0,Q.jsx)(X,{variant:`primary`,disabled:o,onClick:()=>void K(async()=>{let t=Y.parse(await d(l(`/api/home/observation/trial`),{method:`POST`,body:JSON.stringify({topicId:B.id,opportunityId:V.id,expectedRevision:e.revision,expectedOpportunityRevision:V.revision,idempotencyKey:crypto.randomUUID()})}));if(t.outcome===`task`)M(t.taskId);else throw Error(a?`请先完成相关能力配置。`:`Set up the required capabilities first.`)}),children:a?`先帮我做一次`:`Try it once`}):(0,Q.jsx)(X,{variant:`primary`,disabled:o,onClick:J,children:a?`先确认怎么做`:`Discuss the approach`}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:V.risk===`analysis`?a?`先生成私人草稿,由你查看后决定下一步。`:`Start with a private draft for you to review.`:a?`这件事需要外部服务,先一起确认范围。`:`This needs an external service. Agree on the scope first.`}),(0,Q.jsxs)(`details`,{className:`text-xs text-fg-muted`,children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer`,children:a?`为什么推荐这件事`:`Why this suggestion`}),(0,Q.jsx)(`p`,{className:`mt-2 leading-5`,children:V.rationale}),V.evidence.map(e=>(0,Q.jsx)(`p`,{className:`mt-2 leading-5`,children:e.observation},e.id))]})]}):null:(0,Q.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,Q.jsx)(`p`,{className:`text-base font-medium text-fg`,children:a?`先做一件具体的事`:`Start with a concrete task`}),(0,Q.jsx)(`p`,{className:`max-w-prose text-sm leading-6 text-fg-muted`,children:e.status===`paused`?a?`已暂停寻找新建议。你也可以直接告诉我,哪件事最想少做一点。`:`New suggestions are paused. You can still tell me what you would like to spend less time on.`:W?a?`暂时无法生成新建议,已有记录和反馈都已保留。你也可以直接说说想交给我的事。`:`New suggestions are temporarily unavailable. Your records and feedback are saved. You can still tell me what you would like help with.`:a?`例如整理 PR 审查清单、汇总问题线索,或写一份工作进展草稿。先准备一次,满意后再设为定期执行。`:`Prepare a PR review checklist, collect issue reports, or draft a work update. Try it once before making it recurring.`}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:[`pr_review`,`issue_digest`,`work_summary`].map(e=>{let t=ne[e][n],r=a?`请帮我准备「${t.title}」。\n目标:${t.output}\n\n要参考的资料或链接:\n\n先生成私人草稿;缺少资料时明确告诉我,不要开启定时执行。`:`Prepare ${t.title}.\n${t.output}\n\nSource material or links:\n\nCreate a private draft and flag missing information. Do not create recurring runs.`;return(0,Q.jsx)(X,{asChild:!0,children:(0,Q.jsx)(`a`,{href:`#/chat/new?${new URLSearchParams({draft:r})}`,children:t.title})},e)})}),e.status===`paused`?(0,Q.jsx)(X,{variant:`ghost`,onClick:()=>F(!N),children:a?`恢复寻找建议`:`Resume suggestions`}):null]}),U&&B&&e.status===`active`?(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-1`,children:[(0,Q.jsx)(X,{variant:`ghost`,disabled:o,"aria-expanded":S,onClick:q,children:a?`调整做法`:`Refine the approach`}),(0,Q.jsx)(X,{variant:`ghost`,disabled:o,onClick:J,children:a?`聊聊这件事`:`Discuss this task`})]}):null,j?(0,Q.jsx)(ze,{taskId:j,language:n,onComplete:i}):null,N?(0,Q.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:a?`恢复后,要补看暂停期间的工作吗?`:`Include work from while suggestions were paused?`}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[[`catch_up`,`new_only`].map(e=>(0,Q.jsx)(X,{disabled:o,onClick:()=>void K(async()=>{await ee({kind:`resume`,mode:e}),F(!1)}),children:e===`catch_up`?a?`一起补看`:`Include earlier work`:a?`只看之后的工作`:`New work only`},e)),(0,Q.jsx)(X,{variant:`ghost`,onClick:()=>F(!1),children:a?`取消`:`Cancel`})]})]}):null]})}):null,S&&B?(0,Q.jsxs)(`form`,{className:`mt-3 space-y-3 rounded-lg bg-surface-inset p-3`,onSubmit:e=>{e.preventDefault(),K(async()=>{await ee({kind:`feedback`,topicId:B.id,text:g,scope:v}),_(``),w(!1),p(a?`已记下。改变定期做法前,会先请你确认。`:`Preference saved. I will ask before changing the recurring approach.`)})},children:[(0,Q.jsxs)(`label`,{className:`block text-xs text-fg-muted`,children:[a?`关于「${B.title}」,希望我怎么做?`:`How should I handle “${B.title}”?`,(0,Q.jsx)(`textarea`,{required:!0,maxLength:1e3,value:g,onChange:e=>_(e.target.value),placeholder:a?`例如:先列出未解决的阻塞,每项附上来源。`:`For example: list unresolved blockers first and include sources.`,className:`mt-1 min-h-24 w-full rounded-lg border border-edge bg-surface-inset p-2 text-sm text-fg`})]}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-1`,role:`group`,"aria-label":a?`反馈范围`:`Feedback scope`,children:[`once`,`project`,`similar`].filter(e=>e!==`project`||B.projectId).map(e=>(0,Q.jsx)(X,{type:`button`,variant:e===v?`secondary`:`ghost`,"aria-pressed":e===v,onClick:()=>y(e),children:e===`once`?a?`仅这一次`:`Just this time`:e===`project`?a?`这个项目都适用`:`This project`:a?`以后这类事都适用`:`Similar future work`},e))}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a?`记下你的要求;改变定期安排前,仍会请你确认。`:`I will remember your preference and ask before changing a recurring arrangement.`}),(0,Q.jsx)(X,{type:`submit`,variant:`primary`,disabled:o||!g.trim(),children:a?`记住这个要求`:`Save preference`}),(0,Q.jsx)(X,{variant:`ghost`,onClick:()=>{w(!1),_(``),y(`once`)},children:a?`取消`:`Cancel`})]}):null,D?(0,Q.jsxs)(`div`,{className:`mt-4 space-y-3 rounded-lg bg-surface-inset p-3`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,role:`status`,children:e.status===`disabled`?a?`尚未开启`:`Not enabled`:e.status===`paused`?a?`已暂停寻找新建议`:`Suggestions paused`:e.analyzedRevision<e.revision?a?`正在整理最近的工作记录`:`Reviewing recent work`:a?`有新发现时会在这里告诉你`:`New suggestions will appear here`}),(0,Q.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:a?`只查看已授权的 xopc 私人会话和相关任务结果。暂停寻找建议不会停止已经确认的定期安排。`:`Uses authorized private xopc chats and related task results. Pausing suggestions does not stop confirmed recurring tasks.`}),e.status===`disabled`?null:(0,Q.jsx)(X,{disabled:o,variant:`ghost`,onClick:()=>e.status===`active`?void K(async()=>{await ee({kind:`pause`})}):F(!N),children:e.status===`active`?a?`暂停寻找建议`:`Pause suggestions`:a?`恢复寻找建议`:`Resume suggestions`}),R.length?(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:a?`已保存的要求与试做`:`Saved preferences and trials`}),(0,Q.jsx)(`div`,{className:`max-h-48 space-y-2 overflow-y-auto`,children:R.map(e=>(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-lg bg-surface-panel p-2`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm text-fg`,children:e.routine?.title||e.trials[0]?.title||(a?`已保存的工作要求`:`Saved work preferences`)}),(0,Q.jsx)(X,{variant:`ghost`,disabled:!!g&&e.id!==B?.id,onClick:()=>{E(e.id),x(e.id),A(!1)},children:a?`管理`:`Manage`})]},e.id))}),z?(0,Q.jsxs)(`div`,{className:`space-y-2 rounded-lg bg-surface-panel p-3`,children:[e.status===`active`?(0,Q.jsx)(X,{variant:`ghost`,disabled:o,onClick:q,children:a?`调整要求`:`Edit preferences`}):null,z.feedback.filter(e=>e.status===`active`).map(e=>(0,Q.jsxs)(`div`,{className:`text-xs text-fg`,children:[(0,Q.jsx)(`p`,{children:e.text}),(0,Q.jsx)(X,{disabled:o,variant:`ghost`,onClick:()=>void K(async()=>{await ee({kind:`retract`,topicId:z.id,feedbackId:e.id})}),children:a?`撤回要求`:`Retract preference`})]},e.id)),z.trials.map(e=>(0,Q.jsxs)(X,{variant:`ghost`,onClick:()=>M(e.taskId),children:[a?`查看结果:`:`Review result: `,e.title]},e.taskId)),(0,Q.jsx)(X,{variant:`ghost`,disabled:o,onClick:()=>A(!0),children:a?`不再参考这件事`:`Stop using this work history`}),k?(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-fg`,children:a?`清除关于这件事的理解和要求。原始记录、已有任务和自动化保留。`:`Forget this understanding and saved preferences. Original records, tasks and automations remain.`}),(0,Q.jsx)(X,{disabled:o,onClick:()=>void K(async()=>{await ee({kind:`forget`,topicId:z.id}),x(void 0),E(void 0),A(!1),_(``),w(!1),M(void 0)}),children:a?`确认不再参考`:`Confirm exclusion`})]}):null]}):null]}):(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a?`你确认的要求与试做结果会保存在这里。普通聊天记录仍在原对话中查看。`:`Your saved preferences and trial results will appear here. View ordinary work history in its original chat.`})]}):null]})}var vt=new Set([`started`,`discussing`,`completed`]);function yt(){let e=(0,Ge.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[0,1,2].map(bt)}),e[0]=t):t=e[0],t}function bt(e){return(0,Q.jsxs)(`div`,{className:`space-y-2 rounded-xl border border-edge-subtle p-4`,children:[(0,Q.jsx)(J,{className:`h-4 w-24 rounded`}),(0,Q.jsx)(J,{className:`h-5 w-4/5 rounded`}),(0,Q.jsx)(J,{className:`h-4 w-3/5 rounded`})]},e)}function xt(e){let t=(0,Ge.c)(11),{open:n,refreshKey:r,onOpenChange:i,onReevaluate:a}=e,o=u(St),s=f(o).projectsPage.home,l=c(),[d,b]=(0,Z.useState)(`all`),x;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(x=[],t[0]=x):x=t[0];let[S,w]=(0,Z.useState)(x),[T,E]=(0,Z.useState)(!1),[D,A]=(0,Z.useState)(),j;t[1]===n?j=t[2]:(j=()=>{if(!n)return;let e=!0;return E(!0),A(void 0),le().then(t=>{e&&w(t.items)}).catch(t=>{e&&A(t instanceof Error?t.message:String(t))}).finally(()=>{e&&E(!1)}),()=>{e=!1}},t[1]=n,t[2]=j);let N;t[3]!==n||t[4]!==r?(N=[n,r],t[3]=n,t[4]=r,t[5]=N):N=t[5],(0,Z.useEffect)(j,N);let P=S.filter(e=>d===`all`||(d===`adopted`?vt.has(e.status):!vt.has(e.status))),I=new Intl.DateTimeFormat(o===`zh`?`zh-CN`:`en`,{dateStyle:`medium`}),L=new Intl.DateTimeFormat(o===`zh`?`zh-CN`:`en`,{dateStyle:`medium`,timeStyle:`short`}),R=new Map;for(let e of P){let t=I.format(new Date(e.updatedAt));R.set(t,[...R.get(t)??[],e])}let z=[...R.entries()],B=e=>e.feedbackKind===`already_done`?s.advisorHistoryStatusCompleted:e.feedbackKind===`irrelevant`?s.advisorHistoryStatusIrrelevant:e.feedbackKind===`source_incorrect`?s.advisorHistoryStatusSourceIncorrect:e.feedbackKind===`less_like_this`?s.advisorHistoryStatusLessLikeThis:{available:s.advisorHistoryStatusAvailable,started:s.advisorHistoryStatusStarted,discussing:s.advisorHistoryStatusDiscussing,completed:s.advisorHistoryStatusCompleted,snoozed:s.advisorHistoryStatusSnoozed,dismissed:s.advisorHistoryStatusDismissed,expired:s.advisorHistoryStatusExpired,superseded:s.advisorHistoryStatusSuperseded}[e.status],V=e=>{if(e.href){i(!1),l(F(`/`,e.href));return}e.status===`discussing`&&(i(!1),l(`/chat/new?${new URLSearchParams({draft:e.opportunity.actionPrompt}).toString()}`))},U;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Q.jsx)(p,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim`}),t[6]=U):U=t[6];let W;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Q.jsx)(M,{className:`mt-0.5 size-5 shrink-0 text-accent`,"aria-hidden":!0}),t[7]=W):W=t[7];let G;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Q.jsx)(ee,{className:`size-4`,"aria-hidden":!0}),t[8]=G):G=t[8];let K=T?(0,Q.jsx)(yt,{}):D?(0,Q.jsxs)(`div`,{className:`rounded-xl border border-danger/25 bg-danger-soft p-4 text-sm text-danger`,children:[(0,Q.jsx)(`p`,{children:s.advisorHistoryLoadFailed}),(0,Q.jsx)(X,{type:`button`,variant:`ghost`,className:`mt-2`,onClick:()=>i(!1),children:s.advisorHistoryClose})]}):z.length===0?(0,Q.jsxs)(`div`,{className:`py-16 text-center`,children:[(0,Q.jsx)(M,{className:`mx-auto size-6 text-fg-subtle`,"aria-hidden":!0}),(0,Q.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:s.advisorHistoryEmpty}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:s.advisorHistoryEmptyHint})]}):(0,Q.jsx)(`div`,{className:`space-y-6`,children:z.map(e=>{let[t,n]=e;return(0,Q.jsxs)(`section`,{"aria-label":t,children:[(0,Q.jsx)(`h3`,{className:`mb-2 text-xs font-medium text-fg-subtle`,children:t}),(0,Q.jsx)(`div`,{className:`space-y-2`,children:n.map(e=>{let t=!!e.href||e.status===`discussing`,n=[`snoozed`,`dismissed`,`expired`,`superseded`].includes(e.status);return(0,Q.jsxs)(`article`,{className:`rounded-xl border border-edge-subtle bg-surface-base p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium text-accent`,children:B(e)}),(0,Q.jsx)(`h4`,{className:`mt-1.5 text-sm font-semibold leading-5 text-fg`,children:e.opportunity.title}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:e.opportunity.outcome})]}),(0,Q.jsx)(`time`,{className:`shrink-0 text-[11px] text-fg-subtle`,dateTime:new Date(e.updatedAt).toISOString(),children:L.format(new Date(e.updatedAt))})]}),e.snoozedUntil?(0,Q.jsxs)(`p`,{className:`mt-2 inline-flex items-center gap-1 text-xs text-fg-muted`,children:[(0,Q.jsx)(O,{className:`size-3.5`,"aria-hidden":!0}),s.advisorHistoryReturnsAt,` `,L.format(new Date(e.snoozedUntil))]}):null,(0,Q.jsxs)(`details`,{className:`group mt-3`,children:[(0,Q.jsxs)(`summary`,{className:`flex min-h-8 cursor-pointer list-none items-center gap-1 text-xs font-medium text-fg-muted hover:text-fg`,children:[s.advisorHistoryEvidence,(0,Q.jsx)(C,{className:`size-3.5 transition-transform duration-200 group-open:rotate-180 motion-reduce:transition-none`,"aria-hidden":!0})]}),(0,Q.jsx)(Xe,{opportunity:e.opportunity,onOpen:()=>i(!1)})]}),t||n?(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[t?(0,Q.jsxs)(X,{type:`button`,variant:`secondary`,className:`min-h-9 text-xs`,onClick:()=>V(e),children:[(0,Q.jsx)(k,{className:`size-3.5`,"aria-hidden":!0}),e.status===`discussing`?s.advisorHistoryContinueDiscussion:s.advisorHistoryViewProgress]}):null,n?(0,Q.jsxs)(X,{type:`button`,variant:`ghost`,className:`min-h-9 text-xs`,onClick:()=>{i(!1),a()},children:[(0,Q.jsx)(H,{className:`size-3.5`,"aria-hidden":!0}),s.advisorHistoryReevaluate]}):null]}):null]},e.opportunity.id)})})]},t)})}),q;return t[9]===K?q=t[10]:(q=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:K}),t[9]=K,t[10]=q),(0,Q.jsx)(y,{open:n,onOpenChange:i,children:(0,Q.jsxs)(g,{children:[U,(0,Q.jsxs)(_,{className:`xopc-drawer-right fixed right-0 top-0 z-[90] flex size-full max-w-lg flex-col overflow-hidden border-l border-edge bg-surface-overlay shadow-popover outline-none`,"aria-describedby":`home-advisor-history-description`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start gap-3 border-b border-edge px-5 py-4`,children:[W,(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(v,{className:`text-base font-semibold text-fg`,children:s.advisorHistoryTitle}),(0,Q.jsx)(m,{id:`home-advisor-history-description`,className:`mt-1 text-xs leading-5 text-fg-muted`,children:s.advisorHistoryDescription})]}),(0,Q.jsx)(h,{asChild:!0,children:(0,Q.jsx)(X,{type:`button`,variant:`ghost`,className:`-mr-2 size-9 shrink-0 p-0`,"aria-label":s.advisorHistoryClose,children:G})})]}),(0,Q.jsx)(`div`,{className:`shrink-0 border-b border-edge-subtle px-5 py-3`,children:(0,Q.jsx)(Me,{className:`inline-flex rounded-lg bg-surface-inset p-1`,role:`group`,"aria-label":s.advisorHistoryFilterLabel,indicatorClassName:`rounded-md bg-surface-panel shadow-surface`,children:[[`all`,s.advisorHistoryFilterAll],[`adopted`,s.advisorHistoryFilterAdopted],[`other`,s.advisorHistoryFilterOther]].map(e=>{let[t,n]=e;return(0,Q.jsx)(`button`,{type:`button`,className:`min-h-9 rounded-md px-3 text-xs font-medium transition-colors duration-150 ${d===t?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`}`,"aria-pressed":d===t,onClick:()=>b(t),children:n},t)})})}),q]})]})})}function St(e){return e.language}function Ct(e,t){return e.replace(`{{count}}`,String(t))}function wt(e,t){if(e.state===`disabled`)return null;if(e.state===`ready`){let n=1+e.alternatives.length;return{label:Ct(t.ready,n),detail:e.primary.title,tone:`accent`,refreshing:!!e.stale}}return e.state===`clarification`?{label:t.clarification,detail:e.question.question,tone:`accent`,refreshing:!1}:e.state===`refreshing`?{label:t.refreshing,detail:e.previous?.title??t.refreshingDetail,tone:`accent`,refreshing:!0}:e.reason===`generation_failed`?{label:t.generationFailed,detail:t.generationFailedDetail,tone:`danger`,refreshing:!1}:e.reason===`budget_exhausted`?{label:t.budgetExhausted,detail:t.budgetExhaustedDetail,tone:`warning`,refreshing:!1}:e.reason===`model_unavailable`?{label:t.modelUnavailable,detail:t.modelUnavailableDetail,tone:`warning`,refreshing:!1}:{label:t.idle,detail:t.idleDetail,tone:`neutral`,refreshing:!1}}var Tt={accent:`bg-accent`,danger:`bg-danger`,neutral:`bg-fg-subtle`,warning:`bg-warning`};function Et(e){let t=(0,Ge.c)(45),{advisor:n,busy:r,copy:i,onOpenHistory:a,onRefresh:o}=e,[s,c]=(0,Z.useState)(!1),l;t[0]!==n||t[1]!==i?(l=wt(n,i),t[0]=n,t[1]=i,t[2]=l):l=t[2];let u=l;if(!u)return null;let d=n.state!==`refreshing`,f=n.state===`ready`?i.findAnother:i.retry,p=`${i.label}:${u.label}`,m;t[3]===u.refreshing?m=t[4]:(m=u.refreshing?(0,Q.jsx)(H,{className:`size-4 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):(0,Q.jsx)(G,{className:`size-4`,"aria-hidden":!0}),t[3]=u.refreshing,t[4]=m);let h;t[5]!==u.refreshing||t[6]!==u.tone?(h=u.tone!==`neutral`&&!u.refreshing?(0,Q.jsx)(`span`,{className:q(`absolute right-1.5 top-1.5 size-1.5 rounded-full`,Tt[u.tone]),"aria-hidden":!0}):null,t[5]=u.refreshing,t[6]=u.tone,t[7]=h):h=t[7];let g;t[8]!==p||t[9]!==m||t[10]!==h?(g=(0,Q.jsx)(be,{asChild:!0,children:(0,Q.jsxs)(X,{type:`button`,variant:`ghost`,className:`relative size-9 rounded-lg p-0 data-[state=open]:bg-surface-hover data-[state=open]:text-fg`,"aria-label":p,title:p,children:[m,h]})}),t[8]=p,t[9]=m,t[10]=h,t[11]=g):g=t[11];let _;t[12]===u.refreshing?_=t[13]:(_=(0,Q.jsx)(`span`,{className:`mt-1 flex size-7 shrink-0 items-center justify-center rounded-lg bg-accent-soft text-accent`,children:u.refreshing?(0,Q.jsx)(H,{className:`size-4 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):(0,Q.jsx)(G,{className:`size-4`,"aria-hidden":!0})}),t[12]=u.refreshing,t[13]=_);let v;t[14]===u.label?v=t[15]:(v=(0,Q.jsx)(`p`,{className:`font-semibold text-fg`,children:u.label}),t[14]=u.label,t[15]=v);let y;t[16]===u.detail?y=t[17]:(y=(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:u.detail}),t[16]=u.detail,t[17]=y);let b;t[18]!==v||t[19]!==y?(b=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[v,y]}),t[18]=v,t[19]=y,t[20]=b):b=t[20];let x;t[21]!==_||t[22]!==b?(x=(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[_,b]}),t[21]=_,t[22]=b,t[23]=x):x=t[23];let S;t[24]===a?S=t[25]:(S=()=>{c(!1),a()},t[24]=a,t[25]=S);let C;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsx)(M,{className:`size-3.5`,"aria-hidden":!0}),t[26]=C):C=t[26];let w;t[27]!==i.history||t[28]!==S?(w=(0,Q.jsxs)(X,{type:`button`,variant:`ghost`,className:`h-9 rounded-lg text-xs`,onClick:S,children:[C,i.history]}),t[27]=i.history,t[28]=S,t[29]=w):w=t[29];let T;t[30]!==r||t[31]!==d||t[32]!==o||t[33]!==f?(T=d?(0,Q.jsxs)(X,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg text-xs`,disabled:r,onClick:()=>{c(!1),o()},children:[(0,Q.jsx)(H,{className:`size-3.5`,"aria-hidden":!0}),f]}):null,t[30]=r,t[31]=d,t[32]=o,t[33]=f,t[34]=T):T=t[34];let E;t[35]!==w||t[36]!==T?(E=(0,Q.jsxs)(`div`,{className:`mt-4 flex items-center justify-end gap-1 border-t border-edge-subtle pt-3`,children:[w,T]}),t[35]=w,t[36]=T,t[37]=E):E=t[37];let D;t[38]!==E||t[39]!==x?(D=(0,Q.jsx)(ge,{children:(0,Q.jsxs)(_e,{side:`bottom`,align:`end`,sideOffset:6,className:`z-[70] w-[min(21rem,calc(100vw-1.5rem))] rounded-xl border border-edge bg-surface-overlay p-4 text-sm text-fg shadow-popover outline-none`,onOpenAutoFocus:Dt,children:[x,E]})}),t[38]=E,t[39]=x,t[40]=D):D=t[40];let O;return t[41]!==s||t[42]!==D||t[43]!==g?(O=(0,Q.jsxs)(ve,{open:s,onOpenChange:c,children:[g,D]}),t[41]=s,t[42]=D,t[43]=g,t[44]=O):O=t[44],O}function Dt(e){return e.preventDefault()}var Ot=(0,Z.lazy)(()=>i(()=>import(`./workspace-file-preview-dialog-Xi5feqPq.js`).then(e=>e.n).then(e=>({default:e.WorkspaceFilePreviewPanel})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78])));function kt(e){let t=(0,Ge.c)(39),{item:n,language:r,primary:i,showNew:a,onOpen:o}=e,s=a!==void 0&&a,c;t[0]===r?c=t[1]:(c=f(r),t[0]=r,t[1]=c);let l=c.projectsPage.home.workbench,u;t[2]===s?u=t[3]:(u=s?(0,Q.jsx)(`span`,{className:`grid size-9 shrink-0 place-items-center rounded-lg bg-surface-inset text-fg-muted`,children:(0,Q.jsx)(A,{className:`size-4`,"aria-hidden":!0})}):null,t[2]=s,t[3]=u);let d;t[4]===n.title?d=t[5]:(d=(0,Q.jsx)(`p`,{className:`break-words text-sm font-semibold text-fg`,children:n.title}),t[4]=n.title,t[5]=d);let p;t[6]!==l.newDelivery||t[7]!==s?(p=s?(0,Q.jsx)(`span`,{className:`mr-2 font-medium text-accent-fg`,children:l.newDelivery}):null,t[6]=l.newDelivery,t[7]=s,t[8]=p):p=t[8];let m;t[9]===n.completedAt?m=t[10]:(m=new Date(n.completedAt).toISOString(),t[9]=n.completedAt,t[10]=m);let h;t[11]!==n.completedAt||t[12]!==r?(h=Le(new Date(n.completedAt),r),t[11]=n.completedAt,t[12]=r,t[13]=h):h=t[13];let g;t[14]!==m||t[15]!==h?(g=(0,Q.jsx)(`time`,{dateTime:m,children:h}),t[14]=m,t[15]=h,t[16]=g):g=t[16];let _;t[17]!==p||t[18]!==g?(_=(0,Q.jsxs)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:[p,g]}),t[17]=p,t[18]=g,t[19]=_):_=t[19];let v;t[20]===n.summary?v=t[21]:(v=n.summary?(0,Q.jsx)(`p`,{className:`mt-1 line-clamp-2 break-words text-xs leading-5 text-fg-muted`,children:n.summary}):null,t[20]=n.summary,t[21]=v);let y;t[22]!==v||t[23]!==d||t[24]!==_?(y=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[d,_,v]}),t[22]=v,t[23]=d,t[24]=_,t[25]=y):y=t[25];let b;t[26]!==y||t[27]!==u?(b=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 basis-48 items-start gap-3`,children:[u,y]}),t[26]=y,t[27]=u,t[28]=b):b=t[28];let x=i?`primary`:s?`ghost`:`tonal`,S;t[29]===s?S=t[30]:(S=s?(0,Q.jsx)(w,{className:`size-3.5`,"aria-hidden":!0}):null,t[29]=s,t[30]=S);let C;t[31]!==l.openDelivery||t[32]!==o||t[33]!==x||t[34]!==S?(C=(0,Q.jsxs)(X,{variant:x,className:`min-h-9 shrink-0 gap-1 rounded-lg px-2.5 text-xs sm:shadow-none`,onClick:o,children:[l.openDelivery,S]}),t[31]=l.openDelivery,t[32]=o,t[33]=x,t[34]=S,t[35]=C):C=t[35];let T;return t[36]!==b||t[37]!==C?(T=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 px-4 py-3.5`,children:[b,C]}),t[36]=b,t[37]=C,t[38]=T):T=t[38],T}function At({view:e,items:t,language:n,onSelect:r,onClose:i,onRead:a,onOpenFull:o,onRestoreFocus:s}){let c=f(n).projectsPage.home,[l,u]=(0,Z.useState)(!1),[d,m]=(0,Z.useState)(!1),[b,x]=(0,Z.useState)(null),S=(0,Z.useRef)(!1),C=e&&e!==`history`?e:null,{data:w,error:T,mutate:E}=ie(C?[`home-delivery`,C.id]:null,async()=>{if(!C)return;if(C.kind===`automation`){let{run:e}=await Ae.getRun(C.subjectId);return{kind:`automation`,summary:e.summary}}let e=await ce(C.subjectId),t=e.receipts.find(e=>`task:${e.runId}`===C.id);if(!t)throw Error(c.workbench.deliveryFailed);return{kind:`task`,detail:e,receipt:t}},{shouldRetryOnError:!1}),D=w?.kind===`task`||!!w?.summary?.trim();async function O(e){if(!S.current){S.current=!0,u(!0),m(!1);try{e.kind===`automation`&&!e.read&&await Ae.markRunRead(e.subjectId),a(e)}catch{m(!0)}finally{S.current=!1,u(!1)}}}return(0,Q.jsx)(y,{open:e!==null,onOpenChange:e=>{!e&&!S.current&&(m(!1),i())},children:(0,Q.jsxs)(g,{children:[(0,Q.jsx)(p,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim`}),(0,Q.jsxs)(_,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(36rem,calc(100dvh-2rem))] w-[min(42rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay outline-none`,"aria-describedby":void 0,onCloseAutoFocus:e=>{e.preventDefault(),s()},children:[(0,Q.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,Q.jsx)(v,{className:`truncate text-base font-semibold text-fg`,children:C?.title??c.workbench.deliveryHistory}),(0,Q.jsx)(h,{asChild:!0,children:(0,Q.jsx)(X,{variant:`ghost`,className:`size-9 p-0`,disabled:l,"aria-label":n===`zh`?`关闭`:`Close`,children:(0,Q.jsx)(ee,{className:`size-4`})})})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:e===`history`?t.length?(0,Q.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:t.map(e=>(0,Q.jsx)(kt,{item:e,language:n,onOpen:()=>{m(!1),r(e)}},e.id))}):(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:c.workbench.deliveryEmpty}):T?(0,Q.jsxs)(`div`,{role:`alert`,className:`space-y-2 text-sm text-danger`,children:[(0,Q.jsx)(`p`,{children:c.workbench.deliveryFailed}),(0,Q.jsx)(X,{variant:`secondary`,onClick:()=>void E(),children:c.retry})]}):w?w.kind===`task`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(He,{content:w.receipt.summary,contentKey:w.receipt.runId,language:n}),(0,Q.jsx)(Ue,{evidence:w.receipt.evidence,projectId:w.detail.task.projectId,conversationId:w.detail.conversation.activeConversationId??void 0,language:n,onOpenFile:x}),(0,Q.jsx)(y,{open:b!==null,onOpenChange:e=>{e||x(null)},children:(0,Q.jsxs)(g,{children:[(0,Q.jsx)(p,{className:`fixed inset-0 z-[90] bg-scrim`}),(0,Q.jsxs)(_,{className:`fixed left-1/2 top-1/2 z-[100] flex h-[min(54rem,calc(100dvh-2rem))] w-[min(72rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel outline-none`,"aria-describedby":void 0,children:[(0,Q.jsx)(v,{className:`sr-only`,children:b}),(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(J,{className:`m-4 min-h-24`}),children:(0,Q.jsx)(Ot,{filePath:b,projectId:w.detail.task.projectId,conversationId:w.detail.conversation.activeConversationId,onClose:()=>x(null)})})]})]})})]}):w.kind===`automation`&&w.summary?(0,Q.jsx)(I,{content:w.summary}):(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:c.workbench.noSummary}):(0,Q.jsxs)(`div`,{className:`space-y-3`,"aria-busy":!0,children:[(0,Q.jsx)(J,{className:`h-5 w-2/3`}),(0,Q.jsx)(J,{className:`h-24`})]})}),C?(0,Q.jsxs)(`footer`,{className:`shrink-0 space-y-2 border-t border-edge px-4 py-3`,children:[d?(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:c.workbench.readFailed}):null,(0,Q.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[(0,Q.jsx)(X,{variant:`ghost`,disabled:l,onClick:()=>o(C),children:c.workbench.openFullResult}),(0,Q.jsx)(X,{variant:`primary`,disabled:!!T||!D||l,onClick:()=>void O(C),children:c.workbench.markRead})]})]}):null]})]})})}var jt=[`attention`,`delivery`,`resume`,`background`,`observation`],Mt=[`left`,`right`,`full`],Nt=`xopc.workbench.layout`,Pt=`application/x-xopc-workbench-card`,Ft=24,It=340,Lt=304,Rt=864,zt=1/1.57,Bt=260,Vt=72,Ht=1600,Ut={order:[...jt],lanes:{},sizes:{},ratio:zt};function Wt(){try{let e=JSON.parse(localStorage.getItem(Nt)??`{}`),t=Array.isArray(e?.order)?jt.filter(t=>e.order.includes(t)).sort((t,n)=>e.order.indexOf(t)-e.order.indexOf(n)):[],n={},r={};for(let t of jt){let i=e?.lanes?.[t];Mt.includes(i)&&(n[t]=i);let{width:a,height:o}=e?.sizes?.[t]??{},s=Number.isFinite(a)&&a>=Bt,c=Number.isFinite(o)&&o>=Vt&&o<=Ht;(s||c)&&(r[t]={width:s?a:void 0,height:c?o:void 0})}let i=typeof e?.ratio==`number`&&e.ratio>0&&e.ratio<1?e.ratio:zt;return{order:[...new Set([...t,...jt])],lanes:n,sizes:r,ratio:i}}catch{return Ut}}var Gt=`w-full justify-start rounded-md px-2.5 text-sm text-fg`;function Kt(e,t,n){return Math.round(Math.min(n,Math.max(t,e)))}function qt({cards:e,editing:t,language:n}){let r=n===`zh`,[i,a]=(0,Z.useState)(Wt),[o,s]=(0,Z.useState)({width:0,heights:{}}),[c,l]=(0,Z.useState)(),[u,d]=(0,Z.useState)(),[f,p]=(0,Z.useState)(),[m,h]=(0,Z.useState)(),[g,_]=(0,Z.useState)(``),v=(0,Z.useRef)(null),y=(0,Z.useRef)(null),b=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{if(!f)try{localStorage.setItem(Nt,JSON.stringify(i))}catch{}},[i,f]),(0,Z.useEffect)(()=>{let e=v.current,t=e?.closest(`[data-workbench-page-scroll]`);if(!e||!t)return;let n=e=>{let n=e.target instanceof Element?e.target.closest(`[data-workbench-card-scroll]`):null;n&&xe(e,n,t,{handoffOnly:!0})};return e.addEventListener(`wheel`,n,{passive:!1}),()=>e.removeEventListener(`wheel`,n)},[]);let x=o.width-Ft,S=Math.max(It,x-Lt),C=Math.max(It,Math.min(S,Math.round(x*i.ratio))),w=new Map(e.map(e=>[e.id,e])),T=Mt.map(e=>i.order.flatMap(t=>{let n=w.get(t);return n&&(i.lanes[t]??n.lane)===e?[n]:[]})),E=e.some(({id:e})=>i.lanes[e]===`left`||i.lanes[e]===`right`),D=o.width>=Rt,O=D&&(t||E||T[0].length>0&&T[1].length>0);(0,Z.useLayoutEffect)(()=>{let e=v.current;if(!e||typeof ResizeObserver>`u`)return;let t=()=>{let t=e.clientWidth,n={};for(let t of e.children)t instanceof HTMLElement&&t.dataset.workbenchItem&&(n[t.dataset.workbenchItem]=Math.ceil(t.getBoundingClientRect().height));s(e=>e.width===t&&Object.keys(e.heights).length===Object.keys(n).length&&Object.entries(n).every(([t,n])=>e.heights[t]===n)?e:{width:t,heights:n})},n=new ResizeObserver(t);n.observe(e);for(let t of e.children)n.observe(t);return t(),()=>n.disconnect()},[e,t,O,C]);function k(e,t){let{lane:n,anchor:o,after:s}=t;h(i),a(t=>{let r=t.order.filter(t=>t!==e);return r.splice(o?r.indexOf(o)+ +!!s:r.length,0,e),{...t,order:r,lanes:{...t.lanes,[e]:n}}}),_(r?`已移动「${w.get(e)?.label}」`:`Moved ${w.get(e)?.label}`)}function A(){l(void 0),d(void 0)}function M(e,t){!c||e.dataTransfer.getData(Pt)!==c||t.anchor===c||(e.preventDefault(),k(c,t),A())}function N(e,t){!c||t.anchor===c||(e.preventDefault(),e.dataTransfer.dropEffect=`move`,d(e=>e?.lane===t.lane&&e.anchor===t.anchor&&e.after===t.after?e:t))}function P(e,t,n){let r=e.currentTarget.getBoundingClientRect();return{lane:t,anchor:n,after:e.clientY>=r.top+r.height/2}}function F(e){let t=Kt(e,It,S);t!==C&&a(e=>({...e,ratio:t/x}))}function I(e){let t=y.current;t&&(y.current=null,p(void 0),e?a(t.before):i.ratio!==t.before.ratio&&h(t.before))}function L(e,t){a(n=>{let r=n.sizes[e];if(r?.width===t.width&&r?.height===t.height)return n;let i={...n.sizes,[e]:t};return t.width===void 0&&t.height===void 0&&delete i[e],{...n,sizes:i}})}function R(e){i.sizes[e.id]&&(h(i),L(e.id,{}),_(r?`「${e.label}」已恢复自动尺寸`:`${e.label} restored to automatic size`))}function z(e,t){let n=b.current;if(n)if(b.current=null,p(void 0),t)a(n.before);else{let t=n.before.sizes[e.id],a=i.sizes[e.id];(a?.width!==t?.width||a?.height!==t?.height)&&(h(n.before),_(r?`已调整「${e.label}」大小`:`Resized ${e.label}`))}}let B=r?[`左栏`,`右栏`,`全宽`]:[`Left column`,`Right column`,`Full width`],V=[0,0,0],H=new Map,U=Mt.filter((e,n)=>t&&T[n].length===0);for(let[e,t]of Mt.entries()){let n=e===1?C+Ft:0,r=e===0?C:e===1?x-C:o.width;t===`full`&&(V[2]=Math.max(V[0],V[1]));let i=T[e].map(e=>e.id);U.includes(t)&&i.push(t);for(let t of i)H.set(t,{top:V[e],left:n,width:r}),V[e]+=(o.heights[t]??0)+Ft}return(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`span`,{className:`sr-only`,role:`status`,children:g}),t?(0,Q.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-x-3 text-xs text-fg-muted`,children:[(0,Q.jsx)(`p`,{children:r?`拖动上方手柄移动卡片,拖动右下角调整大小。`:`Drag the top handle to move a card, or its bottom-right corner to resize.`}),(0,Q.jsxs)(`div`,{className:`flex gap-1`,children:[(0,Q.jsxs)(X,{variant:`ghost`,className:`rounded-lg text-xs`,disabled:!m,onClick:()=>{m&&(a(m),h(void 0),_(r?`已撤销布局调整`:`Layout change undone`))},children:[(0,Q.jsx)(K,{className:`size-3.5`,"aria-hidden":!0}),r?`撤销`:`Undo`]}),(0,Q.jsx)(X,{variant:`ghost`,className:`rounded-lg text-xs`,onClick:()=>{h(i),a(Ut)},children:r?`恢复默认布局`:`Reset layout`})]})]}):null,(0,Q.jsxs)(`div`,{ref:v,className:q(`relative min-w-0`,!O&&`flex flex-col gap-6`,f&&`select-none`),style:O?{height:Math.max(0,V[2]-Ft)}:void 0,children:[O?(0,Q.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":r?`调整左右栏宽度`:`Resize workbench columns`,"aria-valuemin":It,"aria-valuemax":S,"aria-valuenow":C,tabIndex:0,title:r?`左右拖动调整栏宽,双击恢复默认`:`Drag to resize columns, double-click to reset`,className:`group absolute top-0 z-10 flex w-6 touch-none cursor-col-resize items-start justify-center rounded-lg pt-3 focus-visible:outline-2 focus-visible:outline-accent`,style:{left:C,height:Math.max(0,Math.max(V[0],V[1])-Ft)},onPointerDown:e=>{e.button!==0||f||(e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),y.current={id:e.pointerId,x:e.clientX,width:C,before:i},p(`columns`))},onPointerMove:e=>{let t=y.current;t?.id===e.pointerId&&F(t.width+e.clientX-t.x)},onPointerUp:()=>I(!1),onPointerCancel:()=>I(!0),onLostPointerCapture:()=>I(!0),onDoubleClick:()=>{h(i),a(e=>({...e,ratio:zt}))},onKeyDown:e=>{let t={ArrowLeft:C-16,ArrowRight:C+16,Home:It,End:S};Object.hasOwn(t,e.key)&&(e.preventDefault(),h(i),F(t[e.key]))},children:(0,Q.jsx)(`span`,{"aria-hidden":!0,className:q(`h-8 w-px rounded-full bg-edge-strong motion-safe:transition-colors group-hover:bg-accent`,f===`columns`&&`bg-accent`)})}):null,T.flatMap((e,n)=>e.map((a,s)=>{let m=Mt[n],g=u?.anchor===a.id,v=r?`移动「${a.label}」`:`Move ${a.label}`,y=r?`调整「${a.label}」大小`:`Resize ${a.label}`,x=H.get(a.id),S=(O?x?.width:o.width)??o.width,C=i.sizes[a.id],w=D&&C?.width!==void 0?Math.min(S,C.width):void 0,T=C?.height,E=f===a.id,F=`home-workbench-content-${a.id}`;return(0,Q.jsxs)(`div`,{"data-workbench-item":a.id,"data-workbench-lane":m,className:q(`relative min-w-0`,O&&`absolute`,c===a.id&&`opacity-50`,t&&`rounded-xl bg-surface-panel pb-3 pointer-coarse:pb-8`,t&&`[&_[data-workbench-panel]]:bg-transparent`,E&&`ring-2 ring-accent`),style:O?{...x,width:w??x?.width}:{width:w},onDragOver:c?e=>N(e,P(e,m,a.id)):void 0,onDrop:c?e=>M(e,P(e,m,a.id)):void 0,onDragLeave:e=>{e.relatedTarget instanceof Node&&e.currentTarget.contains(e.relatedTarget)||d(e=>e?.anchor===a.id?void 0:e)},children:[g?(0,Q.jsx)(`span`,{"aria-hidden":!0,className:q(`pointer-events-none absolute inset-x-0 z-10 h-0.5 rounded-full bg-accent`,u.after?`-bottom-2`:`-top-2`)}):null,t?(0,Q.jsx)(`div`,{className:`flex justify-start px-2 pt-1`,children:(0,Q.jsxs)(ve,{children:[(0,Q.jsx)(be,{asChild:!0,children:(0,Q.jsx)(X,{variant:`ghost`,className:`h-7 cursor-grab rounded-lg px-3 py-0 active:cursor-grabbing`,"aria-label":v,title:v,draggable:!0,onDragStart:e=>{let t=e.currentTarget.closest(`[data-workbench-item]`);if(t){let n=t.getBoundingClientRect();e.dataTransfer.setDragImage(t,e.clientX-n.left,e.clientY-n.top)}e.dataTransfer.setData(Pt,a.id),e.dataTransfer.effectAllowed=`move`,l(a.id)},onDragEnd:A,children:(0,Q.jsx)(j,{className:`size-4`,"aria-hidden":!0})})}),(0,Q.jsx)(ge,{children:(0,Q.jsxs)(_e,{align:`start`,sideOffset:4,"aria-label":v,className:`z-50 min-w-36 rounded-lg border border-edge bg-surface-overlay p-1 shadow-popover`,children:[(0,Q.jsx)(ye,{asChild:!0,children:(0,Q.jsx)(X,{variant:`ghost`,className:Gt,disabled:s===0,onClick:()=>k(a.id,{lane:m,anchor:e[s-1]?.id}),children:r?`上移`:`Move up`})}),(0,Q.jsx)(ye,{asChild:!0,children:(0,Q.jsx)(X,{variant:`ghost`,className:Gt,disabled:s===e.length-1,onClick:()=>k(a.id,{lane:m,anchor:e[s+1]?.id,after:!0}),children:r?`下移`:`Move down`})}),Mt.map((e,t)=>(0,Q.jsx)(ye,{asChild:!0,children:(0,Q.jsx)(X,{variant:`ghost`,className:Gt,disabled:e===m,onClick:()=>k(a.id,{lane:e}),children:r?`移到${B[t]}`:`Move to ${B[t].toLowerCase()}`})},e)),(0,Q.jsx)(ye,{asChild:!0,children:(0,Q.jsx)(X,{variant:`ghost`,className:Gt,disabled:!C,onClick:()=>R(a),children:r?`恢复自动尺寸`:`Restore automatic size`})})]})})]})}):null,(0,Q.jsx)(`div`,{id:F,"data-workbench-card-scroll":T===void 0?void 0:``,className:q(`min-w-0 rounded-xl`,t&&(a.id===`delivery`||a.id===`resume`)&&`px-3`,T!==void 0&&`overflow-auto overscroll-y-auto focus-visible:outline-2 focus-visible:outline-accent [&>section]:min-h-full [&>section:has(>[data-workbench-fill])]:flex [&>section:has(>[data-workbench-fill])]:flex-col [&>section>[data-workbench-fill]]:grow`),style:{height:T},role:T===void 0?void 0:`group`,"aria-label":T===void 0?void 0:a.label,tabIndex:T===void 0?void 0:0,children:a.content}),t?(0,Q.jsxs)(Q.Fragment,{children:[E?(0,Q.jsxs)(`span`,{"aria-hidden":!0,className:`pointer-events-none absolute bottom-2 right-9 z-10 rounded-md bg-accent-soft px-2 py-1 text-xs tabular-nums text-accent-fg`,children:[D?`${w??S} × `:``,T??b.current?.height,` px`]}):null,(0,Q.jsx)(X,{variant:`segmented`,className:q(`absolute bottom-0 right-0 z-10 size-8 touch-none rounded-none rounded-br-xl p-0 active:scale-100`,`pointer-fine:[clip-path:polygon(0_75%,75%_75%,75%_0,100%_0,100%_100%,0_100%)]`,`after:pointer-events-none after:absolute after:inset-0 after:rounded-br-xl after:border-b-2 after:border-r-2 after:border-accent after:opacity-0 motion-safe:after:transition-opacity hover:after:opacity-100 focus-visible:after:opacity-100`,D?`cursor-nwse-resize`:`cursor-ns-resize`,E&&`after:opacity-100`),"aria-label":y,"aria-controls":F,title:r?`拖动或使用方向键调整大小,双击恢复自动尺寸`:`Drag or use arrow keys to resize. Double-click to restore automatic size.`,onPointerDown:e=>{if(e.button!==0||f)return;let t=document.getElementById(F)?.getBoundingClientRect();t&&(e.currentTarget.focus({preventScroll:!0}),e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),b.current={pointer:e.pointerId,x:e.clientX,y:e.clientY,width:Math.round(t.width),height:Math.round(t.height),before:i},p(a.id))},onPointerMove:e=>{let t=b.current;if(t?.pointer!==e.pointerId)return;let n=t.before.sizes[a.id],r=e.clientX-t.x,i=e.clientY-t.y;L(a.id,{width:D&&r!==0?Kt(t.width+r,Bt,S):n?.width,height:i===0?n?.height:Kt(t.height+i,Vt,Ht)})},onPointerUp:()=>z(a,!1),onPointerCancel:()=>z(a,!0),onLostPointerCapture:()=>z(a,!0),onDoubleClick:()=>R(a),onKeyDown:e=>{if(e.key===`Escape`&&E){e.preventDefault();let t=b.current?.pointer;z(a,!0),t!==void 0&&e.currentTarget.hasPointerCapture(t)&&e.currentTarget.releasePointerCapture(t);return}if(e.key===`Home`||e.key===`Enter`||e.key===` `){e.preventDefault(),R(a);return}let t=e.key===`ArrowLeft`||e.key===`ArrowRight`,n=e.key===`ArrowUp`||e.key===`ArrowDown`;if((!t||!D)&&!n)return;let o=document.getElementById(F)?.getBoundingClientRect();if(!o)return;e.preventDefault();let s=e.key===`ArrowLeft`||e.key===`ArrowUp`?-16:16;h(i),L(a.id,{width:t?Kt((w??o.width)+s,Bt,S):C?.width,height:n?Kt((T??o.height)+s,Vt,Ht):C?.height}),_(r?`已调整「${a.label}」大小`:`Resized ${a.label}`)}})]}):null]},a.id)})),U.map(e=>(0,Q.jsx)(`div`,{"data-workbench-item":e,className:q(`grid min-h-16 place-items-center rounded-xl border border-dashed border-edge-strong text-xs text-fg-muted`,O&&`absolute`,u?.lane===e&&!u.anchor&&`border-accent bg-accent-soft text-accent-fg`),style:O?H.get(e):void 0,onDragOver:t=>N(t,{lane:e}),onDrop:t=>M(t,{lane:e}),onDragLeave:()=>d(t=>t?.lane===e&&!t.anchor?void 0:t),children:B[Mt.indexOf(e)]},e))]})]})}function Jt(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}var Yt=`xopc-home-read-deliveries`,Xt=`min-w-0 rounded-xl bg-surface-panel`,Zt=`text-base font-semibold tracking-tight text-fg`,Qt=`@min-[54rem]/workbench:grid-cols-[minmax(0,1fr)_minmax(19rem,0.57fr)]`;function $t(){try{let e=JSON.parse(localStorage.getItem(Yt)??`[]`);return Array.isArray(e)?e.filter(e=>typeof e==`string`).slice(0,300):[]}catch{return[]}}function en(){let e=(0,Ge.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(J,{className:`h-56 rounded-xl`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsxs)(`div`,{className:`grid items-start gap-6 ${Qt}`,"aria-busy":!0,children:[(0,Q.jsxs)(`div`,{className:`space-y-6`,children:[t,(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsx)(J,{className:`h-5 w-28 rounded-md`}),(0,Q.jsx)(J,{className:`h-24 rounded-xl`})]})]}),(0,Q.jsx)(J,{className:`h-44 rounded-xl`})]}),e[1]=n):n=e[1],n}function tn(e){let t=(0,Ge.c)(91),{item:n,busy:r,primary:i,dueLabel:o,failureLabel:s,locale:c,onAction:l,onComplete:u,onUpdated:d}=e,[p,m]=a(),h;t[0]===n.openAction?h=t[1]:(h=n.openAction?.type===`open`?/^\/tasks\/([^/?#]+)/.exec(n.openAction.href):null,t[0]=n.openAction,t[1]=h);let g=h,_=n.primaryAction?.type===`task_review`?n.primaryAction.taskId:g?decodeURIComponent(g[1]):void 0,v;t[2]!==_||t[3]!==p?(v=_&&p.get(`reviewTask`)===_,t[2]=_,t[3]=p,t[4]=v):v=t[4];let y=!!v,b;t[5]!==_||t[6]!==p||t[7]!==m?(b=e=>{let t=new URLSearchParams(p);e&&_?t.set(`reviewTask`,_):t.delete(`reviewTask`),m(t)},t[5]=_,t[6]=p,t[7]=m,t[8]=b):b=t[8];let x=b,[S,C]=(0,Z.useState)(!1),w;t[9]===c?w=t[10]:(w=f(c),t[9]=c,t[10]=w);let T=w.projectsPage.home.workbench,E=n.primaryAction?.type===`connector_decision`,D;t[11]!==o||t[12]!==n.dueAt||t[13]!==c?(D=n.dueAt===void 0?null:`${o} ${Le(n.dueAt,c)}`,t[11]=o,t[12]=n.dueAt,t[13]=c,t[14]=D):D=t[14];let O=D,k;t[15]!==E||t[16]!==n.summary?(k=E?n.summary.split(`
8
8
  `)[0]:n.summary,t[15]=E,t[16]=n.summary,t[17]=k):k=t[17];let A;t[18]!==n.projectName||t[19]!==k?(A=[n.projectName,k].filter(Boolean),t[18]=n.projectName,t[19]=k,t[20]=A):A=t[20];let j=A.join(` · `),M=!!(_&&(n.primaryAction?.type===`task_review`||n.primaryAction?.type===`open`)),N;t[21]!==n.id||t[22]!==n.openAction||t[23]!==n.title||t[24]!==l?(N=n.openAction?(0,Q.jsx)(`button`,{type:`button`,className:`touch-target min-w-0 break-words rounded-sm text-left text-sm font-semibold text-fg hover:underline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent`,onClick:()=>l(n.openAction,n.id),children:n.title}):(0,Q.jsx)(`span`,{className:`break-words text-sm font-semibold text-fg`,children:n.title}),t[21]=n.id,t[22]=n.openAction,t[23]=n.title,t[24]=l,t[25]=N):N=t[25];let P;t[26]!==O||t[27]!==s||t[28]!==n.kind?(P=O||n.kind===`failure`?(0,Q.jsx)(`span`,{className:`rounded-md bg-warning-soft px-1.5 py-0.5 text-xs text-fg-muted`,children:O??s}):null,t[26]=O,t[27]=s,t[28]=n.kind,t[29]=P):P=t[29];let F;t[30]!==N||t[31]!==P?(F=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2 gap-y-1`,children:[N,P]}),t[30]=N,t[31]=P,t[32]=F):F=t[32];let I;t[33]===j?I=t[34]:(I=(0,Q.jsx)(`p`,{className:`mt-1 line-clamp-2 break-words text-xs leading-5 text-fg-muted`,children:j}),t[33]=j,t[34]=I);let L;t[35]!==F||t[36]!==I?(L=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 basis-52`,children:[F,I]}),t[35]=F,t[36]=I,t[37]=L):L=t[37];let R;t[38]!==n.primaryAction?.type||t[39]!==c||t[40]!==y||t[41]!==_||t[42]!==x?(R=_&&n.primaryAction?.type===`retry_task`?(0,Q.jsx)(X,{variant:`ghost`,className:`min-h-9 px-2 text-xs`,"aria-expanded":y,onClick:()=>x(!y),children:c===`zh`?`查看结果与依据`:`View result and evidence`}):null,t[38]=n.primaryAction?.type,t[39]=c,t[40]=y,t[41]=_,t[42]=x,t[43]=R):R=t[43];let z;t[44]!==E||t[45]!==r||t[46]!==M||t[47]!==n.id||t[48]!==n.primaryAction||t[49]!==l||t[50]!==i||t[51]!==y||t[52]!==S||t[53]!==x||t[54]!==T?(z=n.primaryAction?(0,Q.jsx)(X,{type:`button`,variant:i?`primary`:`tonal`,className:`min-h-9 shrink-0 rounded-lg px-3 text-xs sm:shadow-none`,disabled:r,"aria-expanded":E?S:M?y:void 0,onClick:()=>{E?C(rn):M?x(!y):l(n.primaryAction,n.id)},children:E?T.viewScope:n.primaryAction.label}):null,t[44]=E,t[45]=r,t[46]=M,t[47]=n.id,t[48]=n.primaryAction,t[49]=l,t[50]=i,t[51]=y,t[52]=S,t[53]=x,t[54]=T,t[55]=z):z=t[55];let B;t[56]!==R||t[57]!==z?(B=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[R,z]}),t[56]=R,t[57]=z,t[58]=B):B=t[58];let V;t[59]!==L||t[60]!==B?(V=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-4 gap-y-2`,children:[L,B]}),t[59]=L,t[60]=B,t[61]=V):V=t[61];let H;t[62]!==E||t[63]!==r||t[64]!==n.id||t[65]!==n.primaryAction||t[66]!==n.secondaryActions||t[67]!==n.summary||t[68]!==l||t[69]!==S?(H=E&&S?(0,Q.jsxs)(`div`,{className:`mt-3 space-y-2 rounded-lg bg-surface-inset px-3 py-2`,children:[(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-xs text-fg-muted`,children:n.summary}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsx)(X,{variant:`primary`,disabled:r,onClick:()=>l(n.primaryAction,n.id),children:n.primaryAction?.label}),n.secondaryActions.map(e=>(0,Q.jsx)(X,{disabled:r,onClick:()=>l(e,n.id),children:e.label},e.label))]})]}):null,t[62]=E,t[63]=r,t[64]=n.id,t[65]=n.primaryAction,t[66]=n.secondaryActions,t[67]=n.summary,t[68]=l,t[69]=S,t[70]=H):H=t[70];let U;t[71]!==E||t[72]!==r||t[73]!==M||t[74]!==n.id||t[75]!==n.secondaryActions||t[76]!==l?(U=!E&&!M&&n.secondaryActions.length?(0,Q.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1`,children:n.secondaryActions.filter(nn).map(e=>(0,Q.jsx)(X,{variant:`ghost`,disabled:r,onClick:()=>l(e,n.id),children:e.label},e.label))}):null,t[71]=E,t[72]=r,t[73]=M,t[74]=n.id,t[75]=n.secondaryActions,t[76]=l,t[77]=U):U=t[77];let W;t[78]!==c||t[79]!==u||t[80]!==d||t[81]!==y||t[82]!==_||t[83]!==x?(W=y&&_?(0,Q.jsx)(ze,{taskId:_,language:c,onUpdated:d,onComplete:()=>{x(!1),u()}},_):null,t[78]=c,t[79]=u,t[80]=d,t[81]=y,t[82]=_,t[83]=x,t[84]=W):W=t[84];let G;return t[85]!==r||t[86]!==V||t[87]!==H||t[88]!==U||t[89]!==W?(G=(0,Q.jsxs)(`article`,{className:`px-4 py-3.5 sm:px-5 sm:py-4`,"aria-busy":r,children:[V,H,U,W]}),t[85]=r,t[86]=V,t[87]=H,t[88]=U,t[89]=W,t[90]=G):G=t[90],G}function nn(e){return e.type!==`open`}function rn(e){return!e}function an(e){let t=(0,Ge.c)(40),{item:n,onAction:r,language:i,onUpdated:a}=e,[o,s]=(0,Z.useState)(!1),c;t[0]===n.openAction?c=t[1]:(c=n.openAction?.type===`open`?/^\/tasks\/([^/?#]+)/.exec(n.openAction.href):null,t[0]=n.openAction,t[1]=c);let l=c,u=l?decodeURIComponent(l[1]):void 0,d;t[2]!==n.backgroundState||t[3]!==n.kind?(d=n.kind===`scheduled`?(0,Q.jsx)(x,{className:`size-4`,"aria-hidden":!0}):n.backgroundState===`paused`?(0,Q.jsx)(D,{className:`size-4`,"aria-hidden":!0}):(0,Q.jsx)(`span`,{className:`size-1.5 rounded-full bg-fg-subtle`,"aria-hidden":!0}),t[2]=n.backgroundState,t[3]=n.kind,t[4]=d):d=t[4];let f=d,p=!n.openAction,m=u?o:void 0,h;t[5]!==n.id||t[6]!==n.openAction||t[7]!==r||t[8]!==u?(h=()=>u?s(on):n.openAction&&r(n.openAction,n.id),t[5]=n.id,t[6]=n.openAction,t[7]=r,t[8]=u,t[9]=h):h=t[9];let g;t[10]===f?g=t[11]:(g=(0,Q.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-inset text-fg-muted`,children:f}),t[10]=f,t[11]=g);let _;t[12]===n.title?_=t[13]:(_=(0,Q.jsx)(`span`,{className:`block line-clamp-2 break-words text-sm font-medium text-fg`,children:n.title}),t[12]=n.title,t[13]=_);let v;t[14]!==n.kind||t[15]!==n.summary||t[16]!==n.updatedAt||t[17]!==i?(v=n.kind===`scheduled`?(0,Q.jsx)(`time`,{className:`block text-xs text-fg-muted`,dateTime:new Date(n.updatedAt).toISOString(),children:Le(n.updatedAt,i)}):(0,Q.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:n.summary}),t[14]=n.kind,t[15]=n.summary,t[16]=n.updatedAt,t[17]=i,t[18]=v):v=t[18];let y;t[19]!==_||t[20]!==v?(y=(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[_,v]}),t[19]=_,t[20]=v,t[21]=y):y=t[21];let b;t[22]!==o||t[23]!==n.openAction?(b=n.openAction?(0,Q.jsxs)(`span`,{className:`flex max-w-[35%] shrink-0 items-center gap-1 text-right text-xs leading-4 text-fg-muted group-hover:text-fg`,children:[(0,Q.jsx)(`span`,{children:n.openAction.label}),(0,Q.jsx)(w,{className:o?`size-3.5 shrink-0 rotate-90`:`size-3.5 shrink-0`,"aria-hidden":!0})]}):null,t[22]=o,t[23]=n.openAction,t[24]=b):b=t[24];let S;t[25]!==b||t[26]!==p||t[27]!==m||t[28]!==h||t[29]!==g||t[30]!==y?(S=(0,Q.jsxs)(`button`,{type:`button`,className:`group flex min-h-12 w-full items-center gap-2.5 rounded-lg px-2 py-2 text-left motion-safe:transition-colors enabled:hover:bg-surface-hover focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-accent`,disabled:p,"aria-expanded":m,onClick:h,children:[g,y,b]}),t[25]=b,t[26]=p,t[27]=m,t[28]=h,t[29]=g,t[30]=y,t[31]=S):S=t[31];let C;t[32]!==o||t[33]!==i||t[34]!==a||t[35]!==u?(C=u&&o?(0,Q.jsx)(ze,{taskId:u,language:i,onUpdated:a,onComplete:()=>s(!1)}):null,t[32]=o,t[33]=i,t[34]=a,t[35]=u,t[36]=C):C=t[36];let T;return t[37]!==S||t[38]!==C?(T=(0,Q.jsxs)(`div`,{children:[S,C]}),t[37]=S,t[38]=C,t[39]=T):T=t[39],T}function on(e){return!e}function sn(){let e=u(e=>e.language),t=f(e),n=t.projectsPage,r=Se(e),i=c(),a=o(),l=ke(e=>e.setPageHeader),d=ke(e=>e.clearPageHeader),[x,E]=(0,Z.useState)(!1),[D,O]=(0,Z.useState)(!1),{home:k,loading:A,loadError:j,setLoadError:M,load:P}=Ke(e,a.key,!0),I=n.home.workbench,L=(0,Z.useRef)(null),[B,H]=(0,Z.useState)(null),[W,K]=(0,Z.useState)($t),q=(0,Z.useRef)(null),[J,te]=(0,Z.useState)(!1),[Y,ne]=(0,Z.useState)(!1),[re,ie]=(0,Z.useState)(``),ce=(0,Z.useRef)(!1),[le,ue]=(0,Z.useState)(),[ge,_e]=(0,Z.useState)(!1),[ve,ye]=(0,Z.useState)(null),[be,xe]=(0,Z.useState)(!1),[we,Te]=(0,Z.useState)(),[Ae,Me]=(0,Z.useState)(!1),[Ne,ze]=(0,Z.useState)(0),[Be,Ve]=(0,Z.useState)(),[He,Ue]=(0,Z.useState)(),[We,Ge]=(0,Z.useState)(!1),$=Pe({chat:t.chat}),Je=(0,Z.useRef)(null),Ye=Oe({disabled:We,chat:t.chat,onTranscript:e=>{ie(t=>Ce(t,e)),window.setTimeout(()=>Je.current?.focus(),0)}}),{phase:Xe,voiceActive:Ze,startVoiceInput:Qe,cancelVoiceInput:$e,confirmVoiceInput:et,retryVoiceInput:nt}=Ye;(0,Z.useEffect)(()=>{if(!Be)return;let e=window.setTimeout(()=>Ve(void 0),8e3);return()=>window.clearTimeout(e)},[Be]);let rt=(0,Z.useCallback)(async e=>{if(!(e.length===0||We)){Ge(!0);try{await $.processFiles(e)}finally{Ge(!1)}}},[We,$.processFiles]),it=(0,Z.useCallback)(async e=>{let t=Ee(e.clipboardData);t.length!==0&&(e.preventDefault(),await rt(t))},[rt]),at=(0,Z.useCallback)(e=>{e.dataTransfer.types.includes(`Files`)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`,$.setIsDragging(!0))},[$.setIsDragging]),ot=(0,Z.useCallback)(e=>{let t=e.relatedTarget;(!(t instanceof Node)||!e.currentTarget.contains(t))&&$.setIsDragging(!1)},[$.setIsDragging]),st=(0,Z.useCallback)(async e=>{e.preventDefault(),$.setIsDragging(!1),await rt(Array.from(e.dataTransfer.files))},[$.setIsDragging,rt]),ct=(0,Z.useCallback)(e=>{e.preventDefault();let t=$.wireAttachmentsPayload(),n=t.length>0?De(t):void 0,r=je(re,n,{projectScope:`none`});r&&(ne(!1),ie(``),$.clearAttachments(),i(r))},[$.clearAttachments,$.wireAttachmentsPayload,re,i]),lt=$.attachments.length>=10,ut={attachTitle:lt?Jt(t.chat.maxAttachmentsReached,{max:10}):`${t.chat.attachFile} (${$.attachments.length}/10)`,dropFiles:t.chat.dropFiles,intentLabel:r.intentLabel,intentPlaceholder:r.intentPlaceholder,intentSuggestion:r.intentSuggestion,shortcut:n.home.submitShortcut,submit:r.newWork},dt=(0,Z.useMemo)(()=>({label:n.home.advisorStatusLabel,ready:n.home.advisorStatusReady,clarification:n.home.advisorStatusClarification,refreshing:n.home.advisorStatusRefreshing,refreshingDetail:n.home.advisorRefreshing,idle:n.home.advisorStatusIdle,idleDetail:n.home.advisorUnavailableTitle,generationFailed:n.home.advisorStatusGenerationFailed,budgetExhausted:n.home.advisorStatusBudgetExhausted,modelUnavailable:n.home.advisorStatusModelUnavailable,generationFailedDetail:n.home.advisorGenerationFailed,budgetExhaustedDetail:n.home.advisorBudgetExhausted,modelUnavailableDetail:n.home.advisorModelUnavailable,history:n.home.advisorHistory,retry:n.home.retry,findAnother:n.home.advisorRefresh}),[n.home]),ft=(k?.recentDeliveries??[]).map(e=>W.includes(e.id)?{...e,read:!0}:e),pt=Date.now(),mt=ft.filter(e=>!e.read&&e.completedAt>=pt-10080*6e4),ht=k?.resumable??[],gt=(k?.needsUser.length??0)+(k?.attentionPolicy?.suppressedAttentionCount??0)+(k?.attentionPolicy?.suppressedDecisionCount??0),vt=new Date(pt);vt.setHours(24,0,0,0);let yt=k?.needsUser.filter(e=>e.dueAt!==void 0&&e.dueAt>=pt&&e.dueAt<vt.getTime()).length??0,bt=k?.background??[],St=bt.filter(e=>e.kind!==`scheduled`),Ct=bt.filter(e=>e.kind===`scheduled`),wt=k?.advisor.state===`ready`||k?.advisor.state===`clarification`||!!we;(0,Z.useEffect)(()=>{if(!we)return;let e=window.setTimeout(()=>Te(void 0),8e3);return()=>window.clearTimeout(e)},[we]);let Tt=k?gt>0?`attention`:mt.length>0?`delivery`:ht.length>0||St.length>0||k.runningConversations?.length||wt?`resume`:`idle`:void 0,Dt=Tt===`idle`,Ot=Dt&&!Y,jt=Ot||Y,Mt=(0,Z.useRef)(Tt),Nt=(0,Z.useRef)(!1);(0,Z.useLayoutEffect)(()=>{let e=Mt.current;if(Mt.current=Tt,!e||!Tt||Tt===e||(Nt.current&&(Nt.current=!1,document.activeElement===document.body&&L.current?.focus({preventScroll:!0})),window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches))return;let t=L.current?.animate?.([{opacity:.7,transform:`translateY(4px)`},{opacity:1,transform:`translateY(0)`}],{duration:180,easing:`ease-out`});return()=>t?.cancel()},[Tt]),(0,Z.useEffect)(()=>{let e=e=>{(e.key===Yt||e.key===null)&&K($t())};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[]);let Pt=(0,Z.useCallback)(e=>{K(t=>[...new Set([e,...t])].slice(0,300));try{localStorage.setItem(Yt,JSON.stringify([...new Set([e,...$t()])].slice(0,300)))}catch{}},[]);(0,Z.useEffect)(()=>{!jt&&Ze&&$e()},[$e,jt,Ze]),(0,Z.useEffect)(()=>{let e=e=>{let t=e.detail?.target;t&&t!==`chat`||!jt||We||(e.preventDefault(),Xe===`recording`?et():Xe===`idle`?(Je.current?.focus(),Qe()):Xe===`error`&&nt())},t=e=>{let t=e.detail?.target;t&&t!==`chat`||!jt||!Ze||(e.preventDefault(),$e(),Je.current?.focus())};return window.addEventListener(Ie,e),window.addEventListener(Fe,t),()=>{window.removeEventListener(Ie,e),window.removeEventListener(Fe,t)}},[We,$e,jt,et,nt,Qe,Ze,Xe]);let Ft=(0,Z.useCallback)(e=>{e||$e(),ne(e)},[$e]),It=(0,Z.useCallback)((t,n)=>{if(t.type===`open`){i(F(`/`,t.href));return}if(t.type===`task_review`||ce.current)return;ce.current=!0,ye(n);let r=k?.needsUser.findIndex(e=>e.id===n)??-1,a=r<0?void 0:{item:k?.needsUser[r],slot:r};ue(void 0),M(null),(async()=>{try{if(t.type===`retry_task`)await Re(t.taskId,e),ue({...a,message:e===`zh`?`任务已重新开始,可查看执行进度。`:`Task restarted. View progress.`,href:F(`/`,`/tasks/${encodeURIComponent(t.taskId)}`)});else if(t.type===`connector_decision`)await he({kind:`connector_approval`,approvalId:t.approvalId},t.decision),ue({...a,message:e===`zh`?t.decision===`approve`?`已批准授权,任务状态将自动更新。`:`已拒绝授权。`:t.decision===`approve`?`Permission approved. Task status will update.`:`Permission denied.`});else if(t.type===`retry_run`){let n=await oe({kind:t.subjectKind,runId:t.runId});ue({...a,message:e===`zh`?`已发起重试,可查看新的执行结果。`:`Retry started. Follow the new execution.`,href:n.conversationId?`/chat/${encodeURIComponent(n.conversationId)}`:`/automations?run=${encodeURIComponent(n.runId)}`})}else t.type===`acknowledge_run`&&(await fe({kind:t.subjectKind,runId:t.runId}),ue({...a,message:e===`zh`?`已确认此异常,已从待处理事项移除。`:`Issue acknowledged and removed from pending items.`}));Nt.current=!0,await P()}catch(e){M(e instanceof Error?e.message:String(e))}finally{ce.current=!1,ye(null)}})()},[k,e,P,i]),Lt=(0,Z.useCallback)((t,n)=>{let r=t.task.phase===`closed`&&t.task.resolution===`done`?de(t):void 0;r&&Pt(`task:${r.runId}`),Nt.current=!0;let i=n?k?.needsUser.findIndex(e=>e.id===n.id):void 0;ue({item:n,slot:i,message:e===`zh`?t.task.phase===`closed`?`任务已验收完成。`:`操作已保存,任务状态已更新。`:t.task.phase===`closed`?`Task accepted.`:`Action saved. Task status updated.`,href:F(`/`,`/tasks/${encodeURIComponent(t.task.id)}`)}),P()},[k,e,P,Pt]),Rt=(0,Z.useCallback)(()=>{xe(!0),Te(void 0),Ue(void 0),M(null),pe(e).then(()=>P()).catch(e=>M(e instanceof Error?e.message:String(e))).finally(()=>xe(!1))},[e,P]),zt=(0,Z.useCallback)((e,t)=>{xe(!0),M(null),se(e,t).then(async t=>{if(t.outcome===`needs_setup`){Ue({opportunityId:e.id,value:t.preflight});return}if(Ue(void 0),ze(e=>e+1),t.outcome===`task`){Te({title:n.home.advisorStartedTitle,detail:Jt(n.home.advisorStartedDetail,{title:e.title}),href:F(`/`,t.href)}),await P();return}i(t.href)}).catch(e=>M(e instanceof Error?e.message:String(e))).finally(()=>xe(!1))},[P,i,n.home.advisorStartedDetail,n.home.advisorStartedTitle]),Bt=(0,Z.useCallback)((e,t)=>{xe(!0),Te(void 0),Ue(void 0),M(null),ae(e,{kind:t,snoozedUntil:t===`too_early`?Date.now()+4320*6e4:void 0}).then(({idempotencyKey:t})=>(Ve({opportunityId:e.id,idempotencyKey:t}),ze(e=>e+1),P())).catch(e=>M(e instanceof Error?e.message:String(e))).finally(()=>xe(!1))},[P]),Vt=(0,Z.useCallback)(()=>{if(!Be)return;let e=Be;Ve(void 0),xe(!0),M(null),me(e.opportunityId,e.idempotencyKey).then(()=>(ze(e=>e+1),P())).catch(t=>{Ve(e),M(t instanceof Error?t.message:String(t))}).finally(()=>xe(!1))},[Be,P]),Ht=(0,Z.useCallback)((e,t)=>{i(`/chat/new?${new URLSearchParams({draft:`${e}\n\n${t}`}).toString()}`)},[i]),Ut=e=>{q.current=document.activeElement instanceof HTMLElement?document.activeElement:null,H(e)},Wt=e=>{Pt(e.id),H(null),ue({message:I.deliverySaved}),P()},Gt=x?k?.needsUser??[]:k?.needsUser.slice(0,2)??[],Kt=gt-Gt.length,Qt=le?.item&&!k?.needsUser.some(e=>e.id===le.item?.id)&&(le.slot??1/0)<2?le.item:void 0,nn=[...Gt];Qt&&nn.splice(le?.slot??0,0,Qt);let rn=(k?.runningConversations??[]).map(t=>({id:t.runId,kind:`running`,title:t.title??(e===`zh`?`对话正在执行`:`Conversation in progress`),summary:I.inProgress,updatedAt:t.updatedAt,secondaryActions:[],openAction:{type:`open`,label:I.inProgress,href:`/chat/${encodeURIComponent(t.conversationId)}`}})),on=[...St,...rn].sort((e,t)=>t.updatedAt-e.updatedAt),sn=Tt===`attention`&&!we&&!J,cn=k?.advisor.state===`ready`?k.advisor.primary.title:k?.advisor.state===`clarification`?k.advisor.question.question:void 0,ln=mt.length>0?(0,Q.jsxs)(`section`,{className:`space-y-2`,"aria-labelledby":`home-delivery-title`,children:[(0,Q.jsxs)(`div`,{className:`flex min-h-9 flex-wrap items-center justify-between gap-x-3 pl-1`,children:[(0,Q.jsx)(`h2`,{id:`home-delivery-title`,className:Zt,children:I.progress}),(0,Q.jsxs)(X,{variant:`ghost`,className:`rounded-lg px-2 text-xs`,onClick:()=>Ut(`history`),children:[I.deliveryHistory,(0,Q.jsx)(b,{className:`size-3.5`,"aria-hidden":!0})]})]}),(0,Q.jsx)(`div`,{className:`${Xt} space-y-1`,"data-workbench-fill":!0,"data-workbench-panel":!0,children:mt.slice(0,Tt===`attention`?1:3).map((t,n)=>(0,Q.jsx)(kt,{item:t,language:e,showNew:!0,primary:Tt===`delivery`&&n===0,onOpen:()=>Ut(t)},t.id))})]}):null,un=[{title:I.inProgress,items:on.filter(e=>!e.backgroundState&&!e.statusLabel)},{title:I.waiting,items:on.filter(e=>e.backgroundState===`waiting`||!e.backgroundState&&e.statusLabel)},{title:I.paused,items:on.filter(e=>e.backgroundState===`paused`)},{title:I.scheduled,items:Ct}].filter(e=>e.items.length>0),dn=Tt===`attention`?1:3,fn=un.length?(0,Q.jsxs)(`section`,{className:Xt,"aria-labelledby":`home-background-title`,"data-workbench-panel":!0,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 px-4 pb-1 pt-4`,children:[(0,Q.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-inset text-fg-muted`,children:(0,Q.jsx)(N,{className:`size-4`,"aria-hidden":!0})}),(0,Q.jsx)(`h2`,{id:`home-background-title`,className:Zt,children:I.background})]}),(0,Q.jsxs)(`div`,{className:`px-3 pb-3`,children:[un.map(({title:t,items:n})=>(0,Q.jsxs)(`div`,{className:`pt-3`,children:[(0,Q.jsx)(`h3`,{className:`mb-1 px-2 text-xs font-medium text-fg-muted`,children:t}),(0,Q.jsx)(`div`,{className:`space-y-1`,children:(ge?n:n.slice(0,dn)).map(t=>(0,Q.jsx)(an,{item:t,language:e,onAction:It,onUpdated:Lt},t.id))})]},t)),un.some(({items:e})=>e.length>dn)?(0,Q.jsxs)(X,{variant:`ghost`,className:`mt-2 w-full justify-start rounded-lg px-2 text-xs`,"aria-expanded":ge,onClick:()=>_e(e=>!e),children:[(0,Q.jsx)(C,{className:ge?`size-3.5 rotate-180`:`size-3.5`,"aria-hidden":!0}),e===`zh`?ge?`收起`:`查看全部 ${on.length+Ct.length} 项`:ge?`Show less`:`View all ${on.length+Ct.length} items`]}):null]})]}):null,pn=!k?.observation&&wt,mn=gt>0?(0,Q.jsxs)(`section`,{className:Xt,"aria-labelledby":`home-needs-user-title`,"data-workbench-panel":!0,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-2 px-4 pb-1 pt-4 sm:px-5`,children:[(0,Q.jsx)(`span`,{className:`mr-0.5 grid size-9 shrink-0 place-items-center rounded-lg bg-warning-soft text-fg`,children:(0,Q.jsx)(T,{className:`size-[18px]`,"aria-hidden":!0})}),(0,Q.jsx)(`h2`,{id:`home-needs-user-title`,className:`text-lg font-semibold tracking-tight text-fg sm:text-xl`,children:I.attention}),(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-inset px-2 py-0.5 text-xs font-semibold tabular-nums text-fg-muted`,"aria-live":`polite`,"aria-label":Jt(n.home.attentionTitle,{count:gt}),children:gt}),yt>0?(0,Q.jsx)(`span`,{className:`ml-auto rounded-md bg-warning-soft px-2 py-1 text-xs text-fg-muted`,children:Jt(I.dueToday,{count:yt})}):null]}),(0,Q.jsxs)(`div`,{className:`space-y-1 pb-2`,children:[nn.map((t,i)=>t===Qt?(0,Q.jsxs)(`div`,{className:`flex min-h-16 items-center justify-between gap-3 px-4 py-3 text-sm text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:t.title}),(0,Q.jsx)(S,{className:`size-4 shrink-0 text-success`,"aria-label":e===`zh`?`已处理`:`Handled`})]},t.id):(0,Q.jsx)(tn,{item:t,primary:i===0||i===1&&nn[0]===Qt,busy:ve!==null,dueLabel:n.home.dueLabel,failureLabel:r.runAttention,locale:e,onAction:It,onComplete:()=>void P(),onUpdated:e=>Lt(e,t)},t.id)),x||Kt>0?(0,Q.jsx)(`div`,{className:`px-2 py-1.5 sm:px-3`,children:(0,Q.jsxs)(X,{variant:`ghost`,className:`w-full justify-start rounded-lg px-2 text-xs`,"aria-expanded":x,onClick:()=>E(e=>!e),children:[(0,Q.jsx)(C,{className:x?`size-3.5 rotate-180`:`size-3.5`,"aria-hidden":!0}),x?I.collapse:Jt(I.remaining,{count:Kt})]})}):null]})]}):null,hn=k&&(ht.length>0||pn)?(0,Q.jsxs)(`section`,{className:`space-y-2`,"aria-labelledby":`home-resume-title`,children:[(0,Q.jsx)(`h2`,{id:`home-resume-title`,className:`flex min-h-9 items-center pl-1 ${Zt}`,children:I.resume}),ht.length>0?(0,Q.jsx)(`div`,{className:`${Xt} space-y-1 p-2`,"data-workbench-fill":!0,"data-workbench-panel":!0,children:ht.slice(0,Tt===`attention`?1:3).map(t=>(0,Q.jsxs)(s,{className:`group flex w-full flex-wrap items-center gap-x-3 gap-y-2 rounded-lg p-2 text-left motion-safe:transition-colors hover:bg-surface-hover focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-accent`,to:F(`/`,t.href),children:[(0,Q.jsx)(`span`,{className:`grid size-9 shrink-0 place-items-center rounded-lg bg-surface-inset text-fg-muted`,children:t.kind===`task`?(0,Q.jsx)(N,{className:`size-4`,"aria-hidden":!0}):(0,Q.jsx)(R,{className:`size-4`,"aria-hidden":!0})}),(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`span`,{className:`block break-words text-sm font-semibold text-fg`,children:t.title}),(0,Q.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,children:[t.projectName,t.summary||Jt(I.lastActive,{time:Le(t.updatedAt,e)})].filter(Boolean).join(` · `)})]}),(0,Q.jsxs)(`span`,{className:`flex max-w-[35%] shrink-0 items-center gap-1 text-right text-xs leading-4 text-fg-muted group-hover:text-fg`,children:[t.kind===`task`?I.continueTask:I.continueChat,(0,Q.jsx)(w,{className:`size-3.5 shrink-0`,"aria-hidden":!0})]})]},`${t.kind}:${t.id}`))}):null,!k.observation&&cn&&Tt===`attention`&&!we?(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 rounded-lg bg-surface-inset px-3 py-1`,children:[(0,Q.jsxs)(`p`,{className:`flex min-w-0 flex-1 items-center gap-2 text-xs text-fg-muted`,children:[(0,Q.jsx)(G,{className:`size-4 shrink-0 text-accent`,"aria-hidden":!0}),(0,Q.jsxs)(`span`,{className:`truncate`,children:[n.home.advisorStatusLabel,` · `,cn]})]}),(0,Q.jsx)(X,{variant:`ghost`,"aria-expanded":J,onClick:()=>te(e=>!e),children:J?I.hideSuggestion:I.viewSuggestion})]}):null,!k.observation&&wt&&!sn?(0,Q.jsx)(tt,{advisor:k.advisor,busy:be,copy:{aiLabel:n.home.advisorAiLabel,why:n.home.advisorWhy,evidence:n.home.advisorEvidence,needsSetup:n.home.advisorNeedsSetup,start:n.home.advisorStart,discuss:n.home.advisorDiscuss,refresh:n.home.advisorRefresh,refreshing:n.home.advisorRefreshing,history:n.home.advisorHistory,viewProgress:n.home.advisorViewProgress,alternatives:n.home.advisorAlternatives,more:I.moreSuggestionActions,feedback:n.home.advisorFeedback,alreadyDone:n.home.advisorAlreadyDone,irrelevant:n.home.advisorIrrelevant,later:n.home.advisorLater,lessLikeThis:n.home.advisorLessLikeThis,sourceIncorrect:n.home.advisorSourceIncorrect,minutes:n.home.advisorMinutes,setupTitle:n.home.advisorSetupTitle,setupHint:n.home.advisorSetupHint,configure:n.home.advisorConfigure,degradedStart:n.home.advisorDegradedStart,automationHint:n.home.advisorAutomationHint,automationAction:n.home.advisorAutomationAction},onRefresh:Rt,onAction:zt,onFeedback:Bt,onClarification:Ht,onOpenHistory:()=>Me(!0),preflight:He,receipt:we}):null]}):null,gn=[{id:`attention`,label:I.attention,lane:`left`,content:mn},{id:`delivery`,label:I.progress,lane:`left`,content:ln},{id:`resume`,label:I.resume,lane:`left`,content:hn},{id:`background`,label:I.background,lane:`right`,content:fn},{id:`observation`,label:e===`zh`?`交给我`:`Let me handle it`,lane:`right`,content:k?.observation?(0,Q.jsx)(_t,{observation:k.observation,advisor:k.advisor,language:e,emphasizeStart:Tt!==`attention`&&Tt!==`delivery`,onUpdated:()=>void P()}):null}].filter(e=>e.content),_n=gn.length>0,vn=e===`zh`?`布局`:`Layout`,yn=e===`zh`?`完成布局`:`Done`,bn=(0,Z.useMemo)(()=>(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[k&&!Dt?(0,Q.jsx)(Et,{advisor:k.advisor,busy:be,copy:dt,onOpenHistory:()=>Me(!0),onRefresh:Rt}):null,_n?(0,Q.jsxs)(X,{type:`button`,variant:`ghost`,className:D?`h-9 w-9 gap-1.5 rounded-lg bg-accent-soft p-0 text-accent-fg sm:w-auto sm:px-2.5`:`size-9 rounded-lg p-0`,"aria-label":D?yn:vn,title:D?yn:vn,onClick:()=>O(e=>!e),children:[D?(0,Q.jsx)(S,{className:`size-4 shrink-0`,"aria-hidden":!0}):(0,Q.jsx)(z,{className:`size-4`,"aria-hidden":!0}),D?(0,Q.jsx)(`span`,{className:`hidden whitespace-nowrap sm:inline`,children:yn}):null]}):null,Dt?null:(0,Q.jsxs)(X,{type:`button`,variant:`primary`,className:`ml-1 h-9 gap-1.5 whitespace-nowrap rounded-lg px-2.5 sm:shadow-none`,onClick:()=>ne(!0),children:[(0,Q.jsx)(V,{className:`size-4 shrink-0`,"aria-hidden":!0}),r.newWork]})]}),[be,dt,_n,r.newWork,yn,D,k,Dt,vn,Rt]);return(0,Z.useLayoutEffect)(()=>(l({startExtra:null,main:(0,Q.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),end:bn}),()=>d()),[d,bn,l,n.title]),(0,Q.jsxs)(`div`,{className:`@container/workbench mx-auto flex w-full min-w-0 max-w-7xl flex-1 flex-col px-4 pb-8 pt-5 sm:px-6 sm:pt-7 lg:px-8`,children:[(0,Q.jsx)(`input`,{ref:$.fileInputRef,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{let t=e.target.files;t&&rt(Array.from(t)),e.target.value=``}}),(0,Q.jsx)(y,{open:Y,onOpenChange:Ft,children:(0,Q.jsxs)(g,{children:[(0,Q.jsx)(p,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(_,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(31rem,calc(100dvh-1.5rem))] w-[min(36rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float focus:outline-none`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start gap-4 border-b border-edge px-5 py-4`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(v,{className:`text-base font-semibold text-fg`,children:r.dialogTitle}),(0,Q.jsx)(m,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:r.dialogDescription})]}),(0,Q.jsx)(h,{asChild:!0,children:(0,Q.jsx)(X,{type:`button`,variant:`ghost`,className:`-mr-2 -mt-1 size-8 shrink-0 rounded-lg p-0`,title:n.cancel,"aria-label":n.cancel,children:(0,Q.jsx)(ee,{className:`size-4`,"aria-hidden":!0})})})]}),(0,Q.jsx)(qe,{variant:`dialog`,inputId:`new-conversation-intent`,inputRef:Je,intent:re,labels:{...ut,submit:r.submit},attachments:$.attachments,isDragging:$.isDragging,attachmentBusy:We,attachmentsFull:lt,voice:Ye,chat:t.chat,cancelAction:(0,Q.jsx)(h,{asChild:!0,children:(0,Q.jsx)(X,{type:`button`,variant:`ghost`,children:n.cancel})}),onIntentChange:ie,onPickFiles:()=>$.fileInputRef.current?.click(),onRemoveAttachment:$.removeAttachment,onPaste:e=>void it(e),onDragOver:at,onDragLeave:ot,onDrop:e=>void st(e),onSubmit:ct})]})]})}),(0,Q.jsx)(xt,{open:Ae,refreshKey:Ne,onOpenChange:Me,onReevaluate:Rt}),j?(0,Q.jsxs)(`div`,{role:`alert`,className:`mb-6 flex items-center justify-between gap-3 rounded-xl border border-danger/25 bg-danger-soft px-4 py-3 text-sm text-danger`,children:[(0,Q.jsx)(`span`,{children:j}),(0,Q.jsx)(X,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void P(),children:n.home.retry})]}):null,(0,Q.jsx)(At,{view:B,items:ft,language:e,onSelect:H,onClose:()=>H(null),onRead:Wt,onOpenFull:e=>{H(null),i(F(`/`,e.href))},onRestoreFocus:()=>{(q.current?.isConnected?q.current:L.current)?.focus({preventScroll:!0})}}),(0,Q.jsx)(`div`,{role:`status`,children:le?(0,Q.jsxs)(`div`,{className:`mb-3 flex w-full flex-wrap items-center justify-between gap-2 rounded-lg bg-success-soft px-3 py-1.5 text-xs text-fg`,children:[(0,Q.jsx)(`span`,{children:le.message}),le.href?(0,Q.jsx)(X,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>i(le.href),children:e===`zh`?`查看进展与结果`:`View progress and result`}):null]}):null}),A?(0,Q.jsx)(en,{}):k?(0,Q.jsxs)(`div`,{ref:L,tabIndex:-1,className:`flex min-h-0 w-full flex-1 flex-col gap-4 outline-none`,children:[gt===0?(0,Q.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,"aria-live":`polite`,children:I.noAttention}):null,Ot?(0,Q.jsxs)(`section`,{className:`mx-auto flex w-full max-w-[640px] flex-1 flex-col justify-center pb-12 pt-10 text-center sm:pb-20 sm:pt-16`,children:[(0,Q.jsx)(`h2`,{className:`text-2xl font-semibold tracking-tight text-fg sm:text-3xl`,children:I.startTitle}),(0,Q.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:I.startHint}),(0,Q.jsx)(qe,{variant:`inline`,inputId:`home-conversation-intent`,inputRef:Je,intent:re,labels:{...ut,intentPlaceholder:I.startExample},attachments:$.attachments,isDragging:$.isDragging,attachmentBusy:We,attachmentsFull:lt,voice:Ye,chat:t.chat,onIntentChange:ie,onPickFiles:()=>$.fileInputRef.current?.click(),onRemoveAttachment:$.removeAttachment,onPaste:e=>void it(e),onDragOver:at,onDragLeave:ot,onDrop:e=>void st(e),onSubmit:ct}),(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap justify-center gap-2`,children:[(0,Q.jsxs)(X,{variant:`ghost`,onClick:()=>window.dispatchEvent(new Event(`open-command-palette`)),children:[(0,Q.jsx)(U,{className:`size-4`,"aria-hidden":!0}),I.findWork]}),(0,Q.jsx)(X,{variant:`ghost`,onClick:()=>Ut(`history`),children:I.deliveryHistory})]})]}):null,(0,Q.jsx)(qt,{cards:gn,editing:D,language:e}),!Dt&&!ln&&ft.length>0?(0,Q.jsx)(X,{variant:`ghost`,className:`self-start px-2 text-xs`,onClick:()=>Ut(`history`),children:I.deliveryHistory}):null]}):null,Be?(0,Q.jsxs)(`div`,{role:`status`,className:`fixed bottom-5 left-1/2 z-[100] flex -translate-x-1/2 items-center gap-4 rounded-lg border border-edge bg-surface-overlay px-4 py-3 text-sm text-fg shadow-float`,children:[(0,Q.jsx)(`span`,{children:n.home.advisorFeedbackSaved}),(0,Q.jsx)(`button`,{type:`button`,className:`font-medium text-accent-fg hover:underline`,onClick:Vt,children:n.home.advisorUndo})]}):null]})}export{sn as HomePage};