@xopcai/xopc 0.0.484 → 0.0.485

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 (67) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/src/inbound-processor.js +4 -6
  3. package/dist/extensions/telegram/xopc.extension.json +1 -1
  4. package/dist/extensions/weixin/src/messaging/process-message.js +2 -1
  5. package/dist/gateway/server/chunks.bin +842 -830
  6. package/dist/gateway/server/chunks.json +1 -1
  7. package/dist/gateway/static/root/assets/{automations-page-B1Ri4sh8.js → automations-page-uY_wmZY1.js} +1 -1
  8. package/dist/gateway/static/root/assets/{automations-workspace-CNSza6ir.js → automations-workspace-DyQq55Rh.js} +2 -2
  9. package/dist/gateway/static/root/assets/{capabilities-page-EENl65YY.js → capabilities-page-WCl7Fdce.js} +2 -2
  10. package/dist/gateway/static/root/assets/{chat-page-LOR5JxDh.js → chat-page-3fVhP77N.js} +30 -30
  11. package/dist/gateway/static/root/assets/command-palette-api-UrqPvWR1.js +1 -0
  12. package/dist/gateway/static/root/assets/{index-DE6GguFZ.js → index-790PGhZb.js} +4 -4
  13. package/dist/gateway/static/root/assets/{note-detail-panel-DXzfoiyk.js → note-detail-panel-Bwm_aehq.js} +2 -2
  14. package/dist/gateway/static/root/assets/{notes-page-BNTgiHSk.js → notes-page-DkZWV3Ds.js} +1 -1
  15. package/dist/gateway/static/root/assets/{personal-page-D7zTHQ0K.js → personal-page-cauym9hr.js} +1 -1
  16. package/dist/gateway/static/root/assets/{project-detail-page-Dgs8ImMC.js → project-detail-page-D9WKZe3z.js} +1 -1
  17. package/dist/gateway/static/root/assets/{route-preload-7WVrzJca.js → route-preload-DF8LOfKW.js} +2 -2
  18. package/dist/gateway/static/root/assets/{settings-page-BOzzOS6k.js → settings-page-Cd9WZ-Ac.js} +1 -1
  19. package/dist/gateway/static/root/assets/{skills-page-gGU0LZ5e.js → skills-page-kL8E5zgi.js} +1 -1
  20. package/dist/gateway/static/root/assets/{space-page-CKVuhV2i.js → space-page-DlJB7GT1.js} +2 -2
  21. package/dist/gateway/static/root/assets/{task-detail-page-DEpYIaok.js → task-detail-page-BFa0Px-B.js} +1 -1
  22. package/dist/gateway/static/root/assets/{task-header-title-Cdgp2rCs.js → task-header-title-qzNctGl5.js} +1 -1
  23. package/dist/gateway/static/root/assets/{use-personal-work-Dd2jRUpz.js → use-personal-work-B1DWeBnm.js} +1 -1
  24. package/dist/gateway/static/root/index.html +6 -6
  25. package/dist/package.js +1 -1
  26. package/dist/src/agent/mcp/connection-drafts.d.ts +3 -1
  27. package/dist/src/agent/mcp/connection-drafts.js +24 -11
  28. package/dist/src/agent/mcp/connection-setup.js +13 -10
  29. package/dist/src/agent/mcp/native-mcp.js +1 -0
  30. package/dist/src/agent/mcp/network-policy.d.ts +6 -0
  31. package/dist/src/agent/mcp/network-policy.js +49 -0
  32. package/dist/src/agent/mcp/transport.js +14 -7
  33. package/dist/src/agent/messaging/message-router.js +2 -2
  34. package/dist/src/agent/service/direct-turn-helpers.js +9 -24
  35. package/dist/src/chat-commands/command-parse.d.ts +1 -0
  36. package/dist/src/chat-commands/command-parse.js +8 -10
  37. package/dist/src/chat-commands/registry.d.ts +5 -0
  38. package/dist/src/chat-commands/registry.js +8 -0
  39. package/dist/src/config/schema.d.ts +54 -4
  40. package/dist/src/config/schema.js +3 -1
  41. package/dist/src/gateway/hono/routes/home.js +1 -1
  42. package/dist/src/gateway/hono/routes/mobile-capability-panels.d.ts +67 -0
  43. package/dist/src/gateway/hono/routes/mobile-capability-panels.js +16 -131
  44. package/dist/src/gateway/hono/routes/mobile-mcp-setup.d.ts +9 -0
  45. package/dist/src/gateway/hono/routes/mobile-mcp-setup.js +929 -0
  46. package/dist/src/gateway/hono/routes/session-command-handler.js +1 -4
  47. package/dist/src/gateway/hono/routes/session-input-handler.js +1 -4
  48. package/dist/src/gateway/next-turn-suggestions/generator.js +16 -2
  49. package/dist/src/gateway/next-turn-suggestions/service.d.ts +2 -1
  50. package/dist/src/gateway/next-turn-suggestions/service.js +17 -5
  51. package/dist/src/gateway/next-turn-suggestions/snapshot.d.ts +11 -0
  52. package/dist/src/gateway/next-turn-suggestions/snapshot.js +31 -2
  53. package/dist/src/gateway/service/config-coordinator.d.ts +14 -1
  54. package/dist/src/gateway/service.js +4 -4
  55. package/dist/src/home-intelligence/host.js +5 -5
  56. package/dist/src/media/generation-changes.d.ts +4 -0
  57. package/dist/src/media/generation-changes.js +37 -0
  58. package/dist/src/music-generation/repository.js +12 -6
  59. package/dist/src/session/reset-triggers.js +1 -1
  60. package/dist/src/tui/tui-commands.d.ts +2 -1
  61. package/dist/src/tui/tui-commands.js +3 -3
  62. package/dist/src/tui/tui-submit.d.ts +1 -1
  63. package/dist/src/tui/tui-submit.js +2 -4
  64. package/dist/src/video-generation/drafts.js +2 -0
  65. package/dist/src/video-generation/repository.js +13 -6
  66. package/package.json +1 -1
  67. package/dist/gateway/static/root/assets/command-palette-api-YP0zV_Ol.js +0 -1
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/attachment-process-heavy-DGZZ-M85.js","assets/rolldown-runtime-aKtaBQYM.js","assets/preload-helper-Czpn1I53.js","assets/pdf-runtime-JnUAvfIa.js","assets/chat-page-LOR5JxDh.js","assets/marked.esm-8VXEA2AD.js","assets/vendor-react-BOUWij0V.js","assets/chunk-KS7C4IRE-DIIvxCDx.js","assets/locale-store-CHjsq5NR.js","assets/messages-C7QSnTdg.js","assets/dist-DlirbHVs.js","assets/es2015-CFqg57eW.js","assets/dist-CDSvxjOh.js","assets/createLucideIcon-DPHK1VkS.js","assets/app-window-DXFNqt_0.js","assets/archive-Dz0hferG.js","assets/arrow-left-D880xG-P.js","assets/video-generation-Cec49Jwg.js","assets/arrow-up-D5ZtR1QT.js","assets/product-automation-feedback-GA_YPLkr.js","assets/activity-YogQEteU.js","assets/bot-DjLkhyZL.js","assets/circle-check-C23XjkUj.js","assets/circle-pause-CN9jYH2s.js","assets/clock-3-DnrAnuyZ.js","assets/external-link-DjqjBmc3.js","assets/loader-circle-CifKLtgG.js","assets/message-square-fVE7Ghj1.js","assets/pause-DuPxgSxk.js","assets/play-kxZvpBg8.js","assets/rotate-ccw-JM1TBLpp.js","assets/rotate-cw-LIg3Am9S.js","assets/sparkles-DHlfQFAF.js","assets/triangle-alert-2JXFNNKU.js","assets/volume-2-BSJhAY97.js","assets/zap-dximCGjy.js","assets/cn-0WouolD0.js","assets/bundle-mjs-rHxsej31.js","assets/session-manager-DUWeBdeG.js","assets/schemas-CCWMleym.js","assets/turn-outcome-BSbEJx8h.js","assets/product-delivery-4gEqUIsK.js","assets/session-api-CR3NLqvs.js","assets/gateway-startup-retry-DgmvR-hb.js","assets/local-session-drafts-CGSV1RQg.js","assets/tool-activity-BtJkgjFf.js","assets/attachment-utils-core-BPYdUI6y.js","assets/gateway-realtime-CoIFB3im.js","assets/gateway-realtime-store-CTWm23Qi.js","assets/playback-coordinator-CWHIf0wr.js","assets/registry-api-CDpUAb2R.js","assets/agents-admin-api-DSr-PWuW.js","assets/gateway-config-swr-BD-ams0X.js","assets/vendor-swr-CdRzEUwF.js","assets/button-C5tRaJxt.js","assets/automation-api-D-gn6x5E.js","assets/earth-C9Z4bTTG.js","assets/check-DUBLcKHA.js","assets/chevron-down-ccbiQQz_.js","assets/chevron-right-BweFrslA.js","assets/working-directory-picker-modal-DgM21YVT.js","assets/file-archive-DanfQJNe.js","assets/interaction-BdhHBbYa.js","assets/form-field-width-DJw_jULe.js","assets/settings-form-draft-Dy10ldo8.js","assets/popover-select-hRG1EzAY.js","assets/skeleton-DzdOeGYz.js","assets/dist-BSVQC3i_.js","assets/dist-DSRLZhL9.js","assets/floating-ui.dom-CiMnRY5O.js","assets/floating-ui.react-dom-Gx6CM22l.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/circle-alert-BEjgurr2.js","assets/send-1f1Ntw6E.js","assets/circle-x-DFsCKeya.js","assets/circle-BoO4YvTx.js","assets/file-tree-utils-DJs1faGv.js","assets/copy-Dv6d4Dvw.js","assets/database-CjjeZfRG.js","assets/download-Dk-ZjtO6.js","assets/ellipsis-0k4rZLoy.js","assets/file-code-corner-byQA1VfD.js","assets/file-image-CDUPkZvG.js","assets/file-text-D12HbeVy.js","assets/file-CStvVK2S.js","assets/folder-kanban-CpLlFI1o.js","assets/folder-open-CyzJ19I9.js","assets/folder-CN-pC3XL.js","assets/git-branch-Dh9uxTot.js","assets/globe-DSSGFWFn.js","assets/history-DXH_9jsE.js","assets/notes-api-D5SvfybU.js","assets/markdown-view-ihzUc4ud.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/app-link-Ji4uewEG.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/xml-_d7dTN2Q.js","assets/mermaid-render-oOellPHt.js","assets/markdown-view-Czi3_WHu.css","assets/chat-chart-block-B83s8HE9.js","assets/key-round-DWbpyU2U.js","assets/laptop-CI3hBVrl.js","assets/link-2-D_ZKYUW7.js","assets/list-checks-BbsExAoq.js","assets/list-todo-CTVRto8O.js","assets/messages-square-BckAJrEW.js","assets/mic-CuUb7zc-.js","assets/monitor-Af5eAvF7.js","assets/use-generated-media-CzRbgtcv.js","assets/install-connector-dialog-CntHi8Rh.js","assets/secret-input-DsjfQmDn.js","assets/eye-CABVeTq0.js","assets/is-masked-secret-DOkL5b_X.js","assets/connectors-api-CRGq-TSw.js","assets/electron-env-DHOGevH3.js","assets/oauth-provider-connect-DGYky6ut.js","assets/cloud-C4-yfnnk.js","assets/models-hub-cache-BrD6r5Qs.js","assets/oauth-api-DnMpUoyx.js","assets/connection-usage-guide-B9hoSOnN.js","assets/connection-usage-BhdQRWgQ.js","assets/paperclip-f1HujQY1.js","assets/pencil-DmIY3Oa-.js","assets/pin-off-BMRv-Kxr.js","assets/refresh-cw-BRlGaq2w.js","assets/save-DRDABU--.js","assets/search-DA7gz22f.js","assets/settings-2-D-csvaET.js","assets/settings-uiTATseT.js","assets/share-2-CnIB9PsV.js","assets/shield-check-BU58siTV.js","assets/smartphone-DSSsQFqA.js","assets/square-DMK_fB-3.js","assets/preview-runtime-C1U57WSM.js","assets/use-async-resource-BHFGZCY2.js","assets/workspace-api-BuNWyNvA.js","assets/files-GdwDamkp.js","assets/index.module-Cd9ENXfk.js","assets/trash-2-DusmjVPV.js","assets/user-round-C9jxPhMR.js","assets/wifi-off-C35sMFUl.js","assets/share-link-dialog-2JjvWs0q.js","assets/copy-text-row-gqdh0Bg1.js","assets/wrench-DFb4r8bH.js","assets/tasks-CwyNaa-j.js","assets/specialists-xbB3xL9e.js","assets/api-CGs641OT.js","assets/session-identity-DRFdxntH.js","assets/new-session-preferences-gb411vZP.js","assets/composer-model-config-control-C2Bku39S.js","assets/model-selector-QFZY5XNN.js","assets/open-capability-settings-DQsmJxI7.js","assets/model-sort-_Tz8s_4N.js","assets/cloud-credits-B-nbtkqv.js","assets/space-api-_uKFiASp.js","assets/home-task-actions-C8Fi6GBq.js","assets/capabilities-BaKHutgZ.js","assets/capabilities-abgigXV1.js","assets/right-workspace-store-Cehybf-G.js","assets/phone-workspace-store-DGaibcsi.js","assets/workspace-editor-agent-store-CX8zX9eZ.js","assets/chat-agents-api-CyvBfBbp.js","assets/middleware-Pd0e8Igk.js","assets/composer-payload-handoff-ClWsunJ2.js","assets/voice-input-shortcut-events-DN-_rY5a.js","assets/chunk-D32TOXHM-DQIy-Baq.js","assets/linkify-it-BkqEorO0.js","assets/tool-friendly-title-CJVFJ2Ud.js","assets/use-realtime-voice-9OvLwHzk.js","assets/voice-CUfqdnlR.js","assets/composer-notifications-MGKffwC7.js","assets/activity-store-hSe5Nbgk.js","assets/voice-call-context-BM2A4bLz.js","assets/app-chrome-BeB4KgOf.js","assets/page-header-store-NP7MCIaP.js","assets/new-chat-navigation-spnin196.js","assets/loopi-CNtmi9FU.js","assets/loopi-C09I2mNj.css","assets/extension-provider-DFcRbTHI.js","assets/theme-store-CvG266p8.js","assets/extension-message-router-B2wbucV7.js","assets/agent-avatar-display-D_UDgOr9.js","assets/skill-wire-pattern-BPpeIcCi.js","assets/composer-handoff-params-DBpzHuNo.js","assets/agent-display-names-Bje7vfSn.js","assets/use-directory-picker-C4p7AgWY.js","assets/confirm-dialog-MHCmEEUZ.js","assets/shares-api-BhWvN3LS.js","assets/dist-DaFr5KMw.js","assets/use-composer-attachments-DJsIzJ1c.js","assets/chevron-left-DqFhpbvK.js","assets/use-file-preview-expanded-BFF2vXm5.js","assets/message-square-plus-XP0tGdlV.js","assets/minimize-2-DtOGrlpo.js","assets/constants-D5Z-mUto.js","assets/sliding-tab-list-CmcrqRzN.js","assets/sliding-indicator-hwz0sx3h.js","assets/use-share-link-WKZLlEqr.js","assets/file-preview-surface-Da1xZiG6.js","assets/command-palette-api-YP0zV_Ol.js","assets/skill-list-api-B26hHnXq.js","assets/skill-api-utils-C7V4JVXM.js","assets/automation-task-card-C453Q-Wa.js","assets/automation-display-DaVDNZz8.js","assets/message-circle-Badhj-4D.js","assets/date-picker-DwITf4I2.js","assets/calendar-days-hw_Y-g-s.js","assets/time-picker-otHjbob1.js","assets/dev-view-store-DsjH8x76.js","assets/extension-iframe-host-CIAq7PSn.js","assets/extension-authoritative-grants-DYp2nNol.js","assets/runtime-health-zDkHcOZO.js","assets/api-B3T06TLl.js","assets/terminal-panel-store-Cy90Ix5U.js","assets/agents-app-path-ciChvpCS.js","assets/use-media-query-ady-FgjK.js","assets/oauth-authorization-window-o6URRos4.js","assets/page-context-draft-Bk7jVvAG.js","assets/management-api-FVu7eYXD.js","assets/side-chat-shortcut-BIw-1TTD.js","assets/chat-page-zQeUaawJ.css","assets/space-workbook-BAwHwK6O.js","assets/space-workbook-CvOADsEJ.css","assets/space-workbook-format-D1PqIvbd.js","assets/xlsx-Cl_0CZaL.js"])))=>i.map(i=>d[i]);
2
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,i as n,n as r,t as i}from"./vendor-react-BOUWij0V.js";import{t as a}from"./preload-helper-Czpn1I53.js";import{_ as o,d as s,f as c,m as l,p as u,t as d,u as f}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{i as p,l as m,n as h,o as g}from"./locale-store-CHjsq5NR.js";import{t as _}from"./archive-Dz0hferG.js";import{t as v}from"./arrow-down-to-line-C5D8Vt-L.js";import{t as y}from"./arrow-left-D880xG-P.js";import{n as b,r as x}from"./popover-select-hRG1EzAY.js";import{t as S}from"./ellipsis-0k4rZLoy.js";import{t as C}from"./file-image-CDUPkZvG.js";import{t as w}from"./file-text-D12HbeVy.js";import{t as T}from"./file-CStvVK2S.js";import{n as E,t as D}from"./table-cells-split-DpObdvTg.js";import{n as O,t as k}from"./star-BuMAkjC9.js";import{a as ee,c as A,l as j,r as M,s as N}from"./use-generated-media-CzRbgtcv.js";import{t as te}from"./panel-right-CFGrHTsD.js";import{t as ne}from"./pause-DuPxgSxk.js";import{t as P}from"./play-kxZvpBg8.js";import{t as re}from"./plus-Q2yW6OE7.js";import{t as ie}from"./presentation-D-Ui_vVA.js";import{t as ae}from"./rotate-ccw-JM1TBLpp.js";import{t as oe}from"./search-DA7gz22f.js";import{t as se}from"./share-2-CnIB9PsV.js";import{i as ce,m as le,n as ue,r as de,t as fe}from"./preview-runtime-C1U57WSM.js";import{t as pe}from"./trash-2-DusmjVPV.js";import{t as me}from"./upload-rrb46c3c.js";import{n as he}from"./share-link-dialog-2JjvWs0q.js";import{t as ge}from"./x-B_N4OPjy.js";import{t as F}from"./cn-0WouolD0.js";import{t as _e}from"./skeleton-DzdOeGYz.js";import{a as ve}from"./api-CGs641OT.js";import{a as ye}from"./session-api-CR3NLqvs.js";import{t as be}from"./session-manager-DUWeBdeG.js";import{o as xe}from"./local-session-drafts-CGSV1RQg.js";import{l as Se,o as Ce,s as we,t as I}from"./new-session-preferences-gb411vZP.js";import{c as Te,d as Ee,f as De,i as Oe,l as ke,n as Ae,p as je,r as Me,t as Ne,u as Pe}from"./space-api-_uKFiASp.js";import{i as Fe,t as Ie}from"./vendor-swr-CdRzEUwF.js";import{t as Le}from"./chat-agents-api-CyvBfBbp.js";import"./constants-D5Z-mUto.js";import{a as Re,i as ze,o as Be,r as Ve,s as He}from"./dist-BSVQC3i_.js";import{i as L}from"./theme-store-CvG266p8.js";import{t as Ue}from"./page-tabs-DoYMKhVO.js";import{t as We}from"./page-header-store-NP7MCIaP.js";import{t as Ge}from"./use-share-link-WKZLlEqr.js";var Ke=e(n(),1),R=r(),z=e(t(),1),B=i();function qe({itemId:e,version:t,hit:n,download:r}){let i=h(e=>e.language),o=L(e=>e.resolved),s=le(t.fileName,t.mimeType),c=s===`audio`||s===`video`,[l,u]=(0,z.useState)(null),d={id:`space:${t.id}`,context:`attachment`,source:{kind:`inline`},fileName:t.fileName,mimeType:t.mimeType,size:t.sizeBytes,type:s},f=de(d),[p,m]=(0,z.useState)({loading:!0,textContent:null,binaryBuffer:null,loadError:null}),{plugin:g,controls:_}=f,{setPage:v,pageCount:y}=_,b=typeof n?.locator.page==`number`?n.locator.page:void 0,x=typeof n?.locator.slide==`number`?n.locator.slide:void 0,S=typeof n?.locator.line==`number`?n.locator.line:void 0,C=typeof n?.locator.sheet==`string`?n.locator.sheet:void 0,w=typeof n?.locator.paragraph==`number`?n.locator.paragraph:void 0;if((0,z.useEffect)(()=>{b&&y!==null&&v(b)},[b,y,v]),(0,z.useEffect)(()=>{let n=new AbortController,r;if(!c){if(g.readMode===`metadata`){m({loading:!1,textContent:null,binaryBuffer:null,loadError:null});return}if(g.maxBytes&&t.sizeBytes>g.maxBytes){m({loading:!1,textContent:null,binaryBuffer:null,loadError:i===`zh`?`文件过大,可下载查看`:`File too large to preview`});return}return Te(e,t.id,n.signal).then(async e=>{let i=g.readMode===`text`?await e.text():null,o=g.readMode===`binary`?await e.arrayBuffer():null,c=s===`pptx`&&o?await a(()=>import(`./attachment-process-heavy-DGZZ-M85.js`).then(e=>e.processPptx(o,t.fileName)),__vite__mapDeps([0,1,2,3])):void 0;n.signal.aborted||(c&&u(c.extractedText),r=g.readMode===`url`?URL.createObjectURL(new Blob([e],{type:t.mimeType})):void 0,m({loading:!1,textContent:i,binaryBuffer:o,rawUrl:r,loadError:null}))}).catch(()=>{n.signal.aborted||m({loading:!1,textContent:null,binaryBuffer:null,loadError:i===`zh`?`资料暂不可读`:`Content unavailable`})}),()=>{n.abort(),r&&URL.revokeObjectURL(r)}}},[s,c,e,t.id,t.fileName,t.mimeType,t.sizeBytes,g,i]),c){let n=ke(e,t.id);return(0,B.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 items-center justify-center overflow-hidden bg-surface-panel p-3`,children:s===`audio`?(0,B.jsx)(`audio`,{src:n,controls:!0,preload:`metadata`,className:`w-full`}):(0,B.jsx)(`video`,{src:n,controls:!0,playsInline:!0,preload:`metadata`,className:`max-h-full max-w-full rounded-lg`})})}return(0,B.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-surface-panel`,children:[g.capabilities.some(e=>[`zoom`,`pageNavigation`,`rotate`,`search`].includes(e))?(0,B.jsx)(`div`,{className:`border-b border-edge-subtle px-2 py-1`,children:(0,B.jsx)(fe,{controller:f})}):null,(0,B.jsx)(ue,{...p,descriptor:d,language:i,resolvedTheme:o,targetLine:S,targetSlide:x,targetSheet:C,targetParagraph:w,extractedText:l,controller:f,actions:{onDownload:r,canDownload:!0}})]})}var V=`grid h-9 w-11 shrink-0 place-items-center overflow-hidden rounded-md bg-surface-inset text-fg-muted`;function Je(e){let t=(0,R.c)(17),{kind:n,src:r}=e,i=(0,z.useRef)(null),[a,o]=(0,z.useState)(!1),[s,c]=(0,z.useState)(!1),[l,u]=(0,z.useState)(!1),d,f;t[0]===n?(d=t[1],f=t[2]):(d=()=>{let e=i.current;if(n!==`video`||!e)return;let t=new IntersectionObserver(e=>{e.some(Ye)&&(o(!0),t.disconnect())});return t.observe(e),()=>t.disconnect()},f=[n],t[0]=n,t[1]=d,t[2]=f),(0,z.useEffect)(d,f);let p=n===`image`?C:E,m=!s&&`invisible`,h;t[3]===m?h=t[4]:(h=F(`absolute inset-0 size-full object-cover`,m),t[3]=m,t[4]=h);let g=h,_;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=F(V,`relative`),t[5]=_):_=t[5];let v;t[6]===p?v=t[7]:(v=(0,B.jsx)(p,{className:`size-4`}),t[6]=p,t[7]=v);let y;t[8]!==l||t[9]!==n||t[10]!==g||t[11]!==r||t[12]!==a?(y=!l&&(n===`image`?(0,B.jsx)(`img`,{src:r,width:44,height:36,loading:`lazy`,decoding:`async`,alt:``,className:g,onLoad:()=>c(!0),onError:()=>u(!0)}):a&&(0,B.jsx)(`video`,{src:`${r}#t=0.1`,muted:!0,playsInline:!0,preload:`metadata`,className:g,onLoadedData:()=>c(!0),onError:()=>u(!0)})),t[8]=l,t[9]=n,t[10]=g,t[11]=r,t[12]=a,t[13]=y):y=t[13];let b;return t[14]!==v||t[15]!==y?(b=(0,B.jsxs)(`span`,{ref:i,className:_,"aria-hidden":!0,children:[v,y]}),t[14]=v,t[15]=y,t[16]=b):b=t[16],b}function Ye(e){return e.isIntersecting}function Xe(e){let t=(0,R.c)(2),{icon:n}=e,r=n===void 0?T:n,i;return t[0]===r?i=t[1]:(i=(0,B.jsx)(`span`,{className:V,children:(0,B.jsx)(r,{className:`size-4`,"aria-hidden":!0})}),t[0]=r,t[1]=i),i}function Ze(e){let t=(0,R.c)(25),{src:n,title:r,zh:i}=e,a;t[0]===n?a=t[1]:(a=e=>e.active?.entry.source.src===n?e.active.entry.element:null,t[0]=n,t[1]=a);let o=N(a),{playing:s,starting:c,failed:l,toggle:u}=M(o),[d,f]=(0,z.useState)(!1),p=d||l,m=s||c,h=p?ae:m?ne:P,g=p?i?`重试播放`:`Retry playback`:m?i?`暂停`:`Pause`:i?`播放`:`Play`,_;t[2]!==o||t[3]!==n||t[4]!==r||t[5]!==u?(_=function(){f(!1),o?u():ee({kind:`audio`,src:n,title:r}).catch(e=>{e instanceof DOMException&&e.name===`AbortError`||f(!0)})},t[2]=o,t[3]=n,t[4]=r,t[5]=u,t[6]=_):_=t[6];let v=_,y=`${g} ${r}`,b=m&&`bg-accent-soft text-accent-fg`,x;t[7]===b?x=t[8]:(x=F(V,`hover:bg-surface-active`,b),t[7]=b,t[8]=x);let S;t[9]===h?S=t[10]:(S=(0,B.jsx)(h,{className:`size-4`,"aria-hidden":!0}),t[9]=h,t[10]=S);let C;t[11]!==x||t[12]!==S?(C=(0,B.jsx)(`span`,{className:x,children:S}),t[11]=x,t[12]=S,t[13]=C):C=t[13];let w;t[14]!==g||t[15]!==v||t[16]!==y||t[17]!==C?(w=(0,B.jsx)(`button`,{type:`button`,"aria-label":y,title:g,onClick:v,className:`absolute start-2 top-1/2 grid size-11 -translate-y-1/2 place-items-center rounded-md focus-visible:outline-2 focus-visible:outline-accent sm:start-3`,children:C}),t[14]=g,t[15]=v,t[16]=y,t[17]=C,t[18]=w):w=t[18];let T;t[19]!==d||t[20]!==i?(T=d?(0,B.jsx)(`span`,{role:`alert`,className:`sr-only`,children:i?`音频暂时无法播放,请重试。`:`Audio could not play. Try again.`}):null,t[19]=d,t[20]=i,t[21]=T):T=t[21];let E;return t[22]!==w||t[23]!==T?(E=(0,B.jsxs)(B.Fragment,{children:[w,T]}),t[22]=w,t[23]=T,t[24]=E):E=t[24],E}var Qe=e=>/\.(xlsx|csv|tsv)$/i.test(e);async function $e(e,t){if(e.size>4*1024*1024)throw Error(`limits`);let n=await e.arrayBuffer(),r=new Worker(new URL(`/assets/space-workbook-import.worker-Bw2gfMG9.js`,``+import.meta.url),{type:`module`});try{return await new Promise((e,i)=>{let a=setTimeout(()=>i(Error(`limits`)),12e3);r.onmessage=t=>{clearTimeout(a),`workbook`in t.data?e(t.data.workbook):i(Error(t.data.error))},r.onerror=()=>{clearTimeout(a),i(Error(`unsupported`))},r.postMessage({bytes:n,fileName:t},[n])})}finally{r.terminate()}}var H=(0,z.lazy)(()=>a(()=>import(`./chat-page-LOR5JxDh.js`).then(e=>e.n).then(e=>({default:e.ChatPage})),__vite__mapDeps([4,1,5,6,2,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,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221])));async function et(e,t,n){let r=`xopc.workbook-chat:${m.getState().baseUrl}:${e}`,i=null;try{i=localStorage.getItem(r)??sessionStorage.getItem(r)}catch{}if(i){if(await xe(i))return i;try{return await ye(i),i}catch(e){if(e.status!==404)throw e}}if(t&&t!==i)return t;let a=I(),o=n?ve(n).catch(e=>{if(e.status!==404)throw e}):void 0,[s,c]=await Promise.all([Le(),o]),{agentId:l,projectId:u}=Se({origin:`workbook`,project:c?{kind:`project`,projectId:c.id}:{kind:`none`}},{defaultAgentId:s.defaultId,selectedAgentId:s.items.find(e=>e.id===a.selectedAgentId)?.id,projectDefaultAgentId:s.items.find(e=>e.id===c?.defaultAgentId)?.id}),d=we(a,l),f=await new be().createSession({agentId:l,projectId:u,executionMode:c?.workspaceRoot?.trim()?Ce(a,c.id)??`local_checkout`:void 0,initialAgentConfig:d?{model:d.modelRef,thinkingLevel:d.thinkingLevel}:void 0});try{localStorage.setItem(r,f.key)}catch{}return f.key}function tt({id:e,open:t,zh:n,originId:r,projectId:i,onClose:a,readSelection:o,prepareSendContext:s,onRunSettled:c}){let[l,u]=(0,z.useState)(),[d,f]=(0,z.useState)(),[p,m]=(0,z.useState)(!1),[h,g]=(0,z.useState)(!1),[_,v]=(0,z.useState)(0),y=(0,z.useRef)(void 0),b=(0,z.useRef)(null);(0,z.useEffect)(()=>{let t=!0;return y.current??=et(e,r,i),y.current.then(e=>{t&&u(e)},()=>{t&&g(!0)}),()=>{t=!1}},[_,e,r,i]),(0,z.useEffect)(()=>{t&&b.current?.focus({preventScroll:!0})},[t]);async function x(){m(!0);try{let e=await o();e&&f(ce(e))}finally{m(!1)}}let S=(0,B.jsxs)(`div`,{className:`space-y-3 p-4`,children:[(0,B.jsx)(_e,{className:`h-5 w-1/2`}),(0,B.jsx)(_e,{className:`h-16 w-full rounded-xl`})]});return(0,B.jsxs)(`aside`,{id:`workbook-chat`,"data-workbook-chat":!0,"aria-labelledby":`workbook-chat-heading`,className:F(`file-preview-surface absolute inset-y-0 end-0 z-30 min-h-0 w-[min(26rem,calc(100%-1rem))] shrink-0 flex-col overflow-hidden border-s border-edge shadow-popover @min-[48rem]/space:relative @min-[48rem]/space:w-[clamp(22rem,36%,31rem)] @min-[48rem]/space:shadow-none`,t?`flex`:`hidden`),onKeyDown:e=>{e.key!==`Escape`||e.defaultPrevented||e.nativeEvent.isComposing||(e.preventDefault(),a())},children:[(0,B.jsxs)(`header`,{className:`flex min-h-14 shrink-0 items-center justify-between gap-2 border-b border-edge-subtle px-3 py-2`,children:[(0,B.jsx)(`h2`,{id:`workbook-chat-heading`,ref:b,tabIndex:-1,className:`text-sm font-semibold text-fg outline-none`,children:n?`工作簿对话`:`Workbook chat`}),(0,B.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,B.jsxs)(`button`,{type:`button`,disabled:!l||p,onClick:()=>void x(),className:`inline-flex min-h-9 shrink-0 items-center gap-1.5 rounded-lg px-2 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:[(0,B.jsx)(D,{className:`size-4`,"aria-hidden":!0}),n?`添加选区`:`Add selection`]}),(0,B.jsx)(`button`,{type:`button`,className:`inline-flex size-9 shrink-0 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:ring-2 focus-visible:ring-accent`,onClick:a,"aria-label":n?`收起工作簿对话`:`Close workbook chat`,children:(0,B.jsx)(ge,{className:`size-4`,"aria-hidden":!0})})]})]}),(0,B.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:l?(0,B.jsx)(z.Suspense,{fallback:S,children:(0,B.jsx)(H,{embedded:!0,conversationId:l,prepareSendContext:s,onRunSettled:c,embeddedAttachmentHandoffId:t?d:void 0,composerPlaceholder:n?`提问,或说明想怎么改这份工作簿…`:`Ask a question or describe a change…`})}):h?(0,B.jsxs)(`div`,{role:`alert`,className:`p-4 text-sm text-fg-muted`,children:[(0,B.jsx)(`p`,{children:n?`暂时无法打开对话。`:`Could not open the chat.`}),(0,B.jsx)(`button`,{type:`button`,className:`mt-2 rounded-lg px-2 py-1 text-accent-fg hover:bg-accent-soft`,onClick:()=>{y.current=void 0,g(!1),v(e=>e+1)},children:n?`重试`:`Retry`})]}):S})]})}function U(e){let t=(0,R.c)(4),{items:n}=e,r;t[0]===n?r=t[1]:(r=n.map(nt),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,B.jsx)(`ul`,{className:`space-y-1`,children:r}),t[2]=r,t[3]=i),i}function nt(e){return(0,B.jsxs)(`li`,{className:`grid grid-cols-[minmax(7rem,1fr)_2fr] gap-2 text-xs`,children:[(0,B.jsxs)(`span`,{className:`truncate font-medium`,title:`${e.sheetName}!${e.cell}`,children:[e.sheetName,`!`,e.cell]}),(0,B.jsxs)(`span`,{className:`min-w-0 break-words`,children:[(0,B.jsx)(`span`,{className:`text-fg-muted`,children:e.beforeFormula??String(e.before??`—`)}),(0,B.jsx)(`span`,{"aria-hidden":!0,children:` → `}),e.afterFormula??String(e.after??`—`)]})]},`${e.sheetId}:${e.cell}`)}function rt({id:e,versionId:t,proposalId:n,undo:r,zh:i,onClose:a,onComplete:o}){let[s,c]=(0,z.useState)(!1),[l,u]=(0,z.useState)(``),d=Fe(n?[`workbook-proposal`,e,n]:null,()=>Oe(e,n),{shouldRetryOnError:!1}),f=!!d.data?.appliedVersionId;async function p(){c(!0),u(``);try{d.data?await De(e,{action:`apply`,proposalId:d.data.proposalId}):r&&await De(e,{action:`undo`,versionId:t,sourceVersionId:r}),o()}catch(e){u(e?.status===409?i?`工作簿已有更新,请在最新版本重新检查。`:`The workbook has changed. Review the latest version and try again.`:i?`操作未完成,请重试。`:`Could not complete the action. Try again.`)}finally{c(!1)}}return(0,B.jsxs)(`section`,{"aria-label":i?`工作簿修改`:`Workbook changes`,className:`max-h-[38%] shrink-0 overflow-y-auto border-b border-edge-subtle bg-surface-panel px-4 py-3`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,B.jsx)(`h3`,{className:`me-auto text-sm font-semibold`,children:r?i?`撤销这次修改`:`Undo this change`:f?i?`本次已保存的修改`:`Saved changes`:i?`审阅修改`:`Review changes`}),(0,B.jsx)(`button`,{type:`button`,onClick:a,className:`min-h-8 rounded-lg px-2 text-xs text-fg-muted hover:bg-surface-hover focus-visible:outline-2 focus-visible:outline-accent`,children:i?`关闭`:`Close`}),r||d.data&&!f?(0,B.jsx)(`button`,{type:`button`,onClick:()=>void p(),disabled:s,className:`min-h-8 rounded-lg bg-accent px-2.5 text-xs font-medium text-on-accent hover:bg-accent-hover focus-visible:outline-2 focus-visible:outline-accent disabled:opacity-50`,children:r?i?`撤销修改`:`Undo change`:i?`应用并保存新版本`:`Apply and save a new version`}):null]}),r?(0,B.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:i?`恢复修改前的内容,并保留两个历史版本。`:`Restore the previous contents and keep both versions in history.`}):null,d.isLoading?(0,B.jsx)(_e,{className:`mt-2 h-8`}):null,d.data?(0,B.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[(0,B.jsx)(U,{items:d.data.changes}),d.data.effects.length?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`h4`,{className:`text-xs text-fg-muted`,children:i?`公式重算结果`:`Recalculated results`}),(0,B.jsx)(U,{items:d.data.effects})]}):null]}):null,l||d.error?(0,B.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:l||(i?`该建议已过期或不可用。`:`This proposal has expired or is unavailable.`)}):null]})}var it=(0,z.lazy)(()=>a(()=>import(`./space-workbook-BAwHwK6O.js`),__vite__mapDeps([222,1,6,2,7,11,12,10,77,13,37,66,36,155,8,9,39,69,70,180,163,223]))),at={document:w,pdf:w,spreadsheet:A,presentation:ie,audio:j,archive:_},W=`inline-flex size-9 shrink-0 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,ot=`block w-full rounded-lg px-3 py-2 text-start text-sm hover:bg-surface-hover`,st=`rounded-lg bg-accent px-3 py-2 text-sm font-medium text-on-accent hover:bg-accent-hover disabled:opacity-50`,ct=`grid grid-cols-[minmax(0,1fr)_5rem] items-center gap-3 px-2 sm:px-3 @xl/list:grid-cols-[minmax(0,1fr)_4.5rem_minmax(0,0.55fr)_6.5rem] @xl/list:gap-4`,G=38,K=30,q=72,J=`xopc.space.previewWidth`;function lt(){try{let e=Number(window.localStorage.getItem(J));if(e>=K&&e<=q)return e}catch{}return G}function ut(e){try{window.localStorage.setItem(J,String(e))}catch{}}function dt(e){let t=e.get(`view`);return t===`favorites`||t===`trash`?t:`all`}function ft(e){let t=(0,R.c)(33),{zh:n,width:r,onResize:i}=e,a=(0,z.useRef)(null),[o,s]=(0,z.useState)(!1),c;t[0]===i?c=t[1]:(c=function(e){let t=Math.max(K,Math.min(q,e));return i(t),t},t[0]=i,t[1]=c);let l=c,u=n?`调整资料预览宽度`:`Resize file preview`,d;t[2]===r?d=t[3]:(d=Math.round(r),t[2]=r,t[3]=d);let f=n?`左右拖动调整宽度,双击恢复默认`:`Drag to resize, double-click to reset`,p=o&&`bg-accent-soft/40`,m;t[4]===p?m=t[5]:(m=F(`group absolute inset-y-0 start-0 z-20 hidden w-3 -translate-x-1/2 cursor-col-resize touch-none select-none items-center justify-center rounded-sm focus-visible:outline-2 focus-visible:outline-accent @min-[58rem]/space:flex`,p),t[4]=p,t[5]=m);let h;t[6]===r?h=t[7]:(h=e=>{if(e.button!==0||a.current)return;let t=e.currentTarget,n=t.closest(`[data-space-preview-host]`)?.parentElement?.clientWidth;n&&(e.preventDefault(),t.setPointerCapture(e.pointerId),a.current={id:e.pointerId,startX:e.clientX,startWidth:r,availableWidth:n,currentWidth:r},s(!0))},t[6]=r,t[7]=h);let g;t[8]===l?g=t[9]:(g=e=>{let t=a.current;t?.id===e.pointerId&&(t.currentWidth=l(t.startWidth+(t.startX-e.clientX)*100/t.availableWidth))},t[8]=l,t[9]=g);let _;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>{a.current?.id===e.pointerId&&(ut(a.current.currentWidth),a.current=null,s(!1))},t[10]=_):_=t[10];let v;t[11]===l?v=t[12]:(v=()=>ut(l(G)),t[11]=l,t[12]=v);let y;t[13]!==l||t[14]!==r?(y=e=>{let t={ArrowLeft:r+2,ArrowRight:r-2,Home:K,End:q};Object.hasOwn(t,e.key)&&(e.preventDefault(),ut(l(t[e.key])))},t[13]=l,t[14]=r,t[15]=y):y=t[15];let b=o&&`bg-accent`,x;t[16]===b?x=t[17]:(x=F(`h-10 w-0.5 rounded-full bg-edge group-hover:bg-accent group-focus-visible:bg-accent`,b),t[16]=b,t[17]=x);let S;t[18]===x?S=t[19]:(S=(0,B.jsx)(`span`,{"aria-hidden":!0,className:x}),t[18]=x,t[19]=S);let C;t[20]===o?C=t[21]:(C=o?(0,B.jsx)(`span`,{"aria-hidden":!0,className:`fixed inset-0 z-50 cursor-col-resize`}):null,t[20]=o,t[21]=C);let w;return t[22]!==v||t[23]!==y||t[24]!==S||t[25]!==C||t[26]!==u||t[27]!==d||t[28]!==f||t[29]!==m||t[30]!==h||t[31]!==g?(w=(0,B.jsxs)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":u,"aria-controls":`space-file-preview`,"aria-valuemin":K,"aria-valuemax":q,"aria-valuenow":d,tabIndex:0,title:f,className:m,onPointerDown:h,onPointerMove:g,onLostPointerCapture:_,onDoubleClick:v,onKeyDown:y,children:[S,C]}),t[22]=v,t[23]=y,t[24]=S,t[25]=C,t[26]=u,t[27]=d,t[28]=f,t[29]=m,t[30]=h,t[31]=g,t[32]=w):w=t[32],w}function pt(e){return e?.available?e.kind===`task`&&e.taskId?`/tasks/${encodeURIComponent(e.taskId)}`:e.kind===`automation`&&e.automationRunId?`/automations?view=execution&run=${encodeURIComponent(e.automationRunId)}`:`/chat/${encodeURIComponent(e.conversationId)}`:null}function mt(e){let t=(0,R.c)(20),{text:n,query:r}=e,i,a,o,s,c;if(t[0]!==r||t[1]!==n){c=Symbol.for(`react.early_return_sentinel`);bb0:{let e=r?n.toLowerCase().indexOf(r.toLowerCase()):-1;if(e<0){let e;t[7]===n?e=t[8]:(e=(0,B.jsx)(B.Fragment,{children:n}),t[7]=n,t[8]=e),c=e;break bb0}i=e+r.length,s=e>40?`…${n.slice(e-40,e)}`:n.slice(0,e),a=`rounded-sm bg-accent-soft text-accent-fg`,o=n.slice(e,i)}t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c}else i=t[2],a=t[3],o=t[4],s=t[5],c=t[6];if(c!==Symbol.for(`react.early_return_sentinel`))return c;let l;t[9]!==a||t[10]!==o?(l=(0,B.jsx)(`mark`,{className:a,children:o}),t[9]=a,t[10]=o,t[11]=l):l=t[11];let u;t[12]!==i||t[13]!==n?(u=n.slice(i,i+100),t[12]=i,t[13]=n,t[14]=u):u=t[14];let d=i+100<n.length?`…`:``,f;return t[15]!==s||t[16]!==l||t[17]!==u||t[18]!==d?(f=(0,B.jsxs)(B.Fragment,{children:[s,l,u,d]}),t[15]=s,t[16]=l,t[17]=u,t[18]=d,t[19]=f):f=t[19],f}function ht(e){let t=(0,R.c)(22),{zh:n}=e,[r,i]=o(),a=u(),s=(0,z.useRef)(null),c;t[0]===r?c=t[1]:(c=(r.get(`q`)??``).slice(0,160),t[0]=r,t[1]=c);let l=c,d=n?`搜索资料`:`Search files`,f,p;t[2]!==a||t[3]!==l?(f=()=>{let e=s.current;e&&(document.activeElement!==e||a===`POP`)&&(e.value=l)},p=[a,l],t[2]=a,t[3]=l,t[4]=f,t[5]=p):(f=t[4],p=t[5]),(0,z.useLayoutEffect)(f,p);let m;t[6]===i?m=t[7]:(m=function(e){i(t=>{let n=new URLSearchParams(t);return e?n.set(`q`,e):n.delete(`q`),n},{replace:!0})},t[6]=i,t[7]=m);let h=m,g;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,B.jsx)(oe,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),t[8]=g):g=t[8];let _;t[9]===h?_=t[10]:(_=e=>h(e.target.value),t[9]=h,t[10]=_);let v;t[11]!==d||t[12]!==l||t[13]!==_?(v=(0,B.jsx)(`input`,{ref:s,defaultValue:l,maxLength:160,onChange:_,"aria-label":d,placeholder:d,className:`min-w-0 flex-1 bg-transparent text-sm text-fg outline-none`}),t[11]=d,t[12]=l,t[13]=_,t[14]=v):v=t[14];let y;t[15]!==h||t[16]!==l||t[17]!==n?(y=l?(0,B.jsx)(`button`,{type:`button`,className:F(W,`size-6`),onClick:()=>{h(``),s.current&&(s.current.value=``,s.current.focus())},"aria-label":n?`清除搜索`:`Clear search`,children:(0,B.jsx)(ge,{className:`size-4`})}):null,t[15]=h,t[16]=l,t[17]=n,t[18]=y):y=t[18];let b;return t[19]!==v||t[20]!==y?(b=(0,B.jsxs)(`div`,{role:`search`,className:`flex h-9 min-w-0 flex-1 items-center gap-2 rounded-lg border border-edge-subtle bg-surface-inset px-2.5 focus-within:ring-2 focus-within:ring-accent @min-[40rem]/space-list:w-[clamp(7rem,24cqw,18rem)]`,children:[g,v,y]}),t[19]=v,t[20]=y,t[21]=b):b=t[21],b}function gt(e){let t=(0,R.c)(44),{zh:n}=e,[r,i]=o(),a=n?`文档`:`Documents`,s;t[0]===a?s=t[1]:(s=[`document`,a],t[0]=a,t[1]=s);let c=n?`表格`:`Spreadsheets`,l;t[2]===c?l=t[3]:(l=[`spreadsheet`,c],t[2]=c,t[3]=l);let u=n?`演示`:`Slides`,d;t[4]===u?d=t[5]:(d=[`presentation`,u],t[4]=u,t[5]=d);let f=n?`图片`:`Images`,p;t[6]===f?p=t[7]:(p=[`image`,f],t[6]=f,t[7]=p);let m=n?`音频`:`Audio`,h;t[8]===m?h=t[9]:(h=[`audio`,m],t[8]=m,t[9]=h);let g=n?`视频`:`Video`,_;t[10]===g?_=t[11]:(_=[`video`,g],t[10]=g,t[11]=_);let v=n?`压缩包`:`Archives`,y;t[12]===v?y=t[13]:(y=[`archive`,v],t[12]=v,t[13]=y);let S=n?`文件`:`Files`,C;t[14]===S?C=t[15]:(C=[`file`,S],t[14]=S,t[15]=C);let w;t[16]!==h||t[17]!==_||t[18]!==y||t[19]!==C||t[20]!==s||t[21]!==l||t[22]!==d||t[23]!==p?(w=[s,l,d,p,h,_,y,C],t[16]=h,t[17]=_,t[18]=y,t[19]=C,t[20]=s,t[21]=l,t[22]=d,t[23]=p,t[24]=w):w=t[24];let T=w,E;t[25]===n?E=t[26]:(E=(0,B.jsx)(ht,{zh:n}),t[25]=n,t[26]=E);let D;t[27]===r?D=t[28]:(D=r.get(`kind`)??`all`,t[27]=r,t[28]=D);let O=n?`资料类型`:`File type`,k;t[29]===i?k=t[30]:(k=e=>i(t=>{let n=new URLSearchParams(t);return e.target.value===`all`?n.delete(`kind`):n.set(`kind`,e.target.value),n}),t[29]=i,t[30]=k);let ee=n?`全部类型`:`All types`,A;t[31]===ee?A=t[32]:(A=(0,B.jsx)(x,{value:`all`,children:ee}),t[31]=ee,t[32]=A);let j;t[33]===T?j=t[34]:(j=T.map(Y),t[33]=T,t[34]=j);let M;t[35]!==D||t[36]!==O||t[37]!==k||t[38]!==A||t[39]!==j?(M=(0,B.jsxs)(b,{value:D,align:`end`,"aria-label":O,triggerClassName:`h-9 shrink-0`,onChange:k,children:[A,j]}),t[35]=D,t[36]=O,t[37]=k,t[38]=A,t[39]=j,t[40]=M):M=t[40];let N;return t[41]!==E||t[42]!==M?(N=(0,B.jsxs)(`div`,{className:`flex w-full min-w-0 items-center gap-2`,children:[E,M]}),t[41]=E,t[42]=M,t[43]=N):N=t[43],N}function Y(e){let[t,n]=e;return(0,B.jsx)(x,{value:t,children:n},t)}function _t(e){let t=(0,R.c)(25),{zh:n,onViewChange:r}=e,[i,a]=o(),s=n?`全部资料`:`All files`,c;t[0]===s?c=t[1]:(c={id:`all`,label:s,icon:O},t[0]=s,t[1]=c);let l=n?`收藏`:`Favorites`,u;t[2]===l?u=t[3]:(u={id:`favorites`,label:l,icon:k},t[2]=l,t[3]=u);let d=n?`回收站`:`Trash`,f;t[4]===d?f=t[5]:(f={id:`trash`,label:d,icon:pe},t[4]=d,t[5]=f);let p;t[6]!==c||t[7]!==u||t[8]!==f?(p=[c,u,f],t[6]=c,t[7]=u,t[8]=f,t[9]=p):p=t[9];let m=p,h;t[10]!==r||t[11]!==a?(h=function(e){r(),a(t=>{let n=new URLSearchParams(t);for(let e of[`view`,`item`,`version`,`q`,`kind`])n.delete(e);return e!==`all`&&n.set(`view`,e),n})},t[10]=r,t[11]=a,t[12]=h):h=t[12];let g=h,_=n?`资料库`:`Space`,v;t[13]===_?v=t[14]:(v=(0,B.jsx)(`h1`,{className:`sr-only`,children:_}),t[13]=_,t[14]=v);let y;t[15]===i?y=t[16]:(y=dt(i),t[15]=i,t[16]=y);let b=n?`资料范围`:`Library views`,x;t[17]!==g||t[18]!==m||t[19]!==y||t[20]!==b?(x=(0,B.jsx)(Ue,{items:m,activeTab:y,onChange:g,ariaLabel:b,tabIdPrefix:`space-tab`,panelIdPrefix:`space-list`,className:`pb-0 [scrollbar-width:none]`,buttonClassName:`h-9 py-1.5`,scrollActiveIntoView:!0}),t[17]=g,t[18]=m,t[19]=y,t[20]=b,t[21]=x):x=t[21];let S;return t[22]!==v||t[23]!==x?(S=(0,B.jsxs)(`div`,{className:`min-w-0`,children:[v,x]}),t[22]=v,t[23]=x,t[24]=S):S=t[24],S}function X(){let e=Ge(),t=h(e=>e.language)===`zh`,n=We(e=>e.setPageHeader),r=We(e=>e.clearPageHeader),i=c(),u=s(),[m,_]=o(),C=l(),w=m.get(`version`),T=m.get(`sheet`)??void 0,E=m.get(`range`)??void 0,D=m.get(`proposal`)??void 0,O=m.get(`undo`)??void 0,[ee,A]=(0,z.useState)(lt),[j,M]=(0,z.useState)(!1),[N,ne]=(0,z.useState)(!1),[P,ie]=(0,z.useState)(!1),[ae,oe]=(0,z.useState)(``),[le,ue]=(0,z.useState)(),[de,fe]=(0,z.useState)(),[pe,ve]=(0,z.useState)(),[ye,be]=(0,z.useState)(),xe=(0,z.useRef)(new Map),Se=(0,z.useRef)(null),Ce=(0,z.useRef)(null),we=(0,z.useRef)(null),I=(0,z.useRef)(null),De=(0,z.useRef)(null),Oe=(0,z.useRef)(null),Le=(0,z.useRef)(null),L=dt(m),Ue=(m.get(`q`)??``).slice(0,160),R=(0,z.useDeferredValue)(Ue),V=m.get(`item`),Ye=(0,z.useRef)(V);(0,z.useLayoutEffect)(()=>{Ye.current!==V&&(Ye.current=V,ue(void 0),fe(void 0),ve(void 0))},[V]);let H=f(({currentLocation:e,nextLocation:t})=>{if(!I.current?.hasChanges())return!1;if(e.pathname!==t.pathname)return!0;let n=new URLSearchParams(e.search),r=new URLSearchParams(t.search);return n.get(`item`)===r.get(`item`)?!r.has(`version`)&&vt?!1:n.get(`version`)!==r.get(`version`):!0});(0,z.useEffect)(()=>{if(H.state!==`blocked`)return;let e=!0;return(async()=>{let t=I.current,n=await t?.flushSave();e&&(!t||n?H.proceed():H.reset())})(),()=>{e=!1}},[H]);let et=m.get(`kind`),U=m.get(`taskId`)?`taskId`:m.get(`projectId`)?`projectId`:void 0,nt=(0,z.useCallback)(()=>{be(void 0),oe(``),M(!1),ne(!1)},[]);(0,z.useLayoutEffect)(()=>(n({startExtra:null,main:(0,B.jsx)(_t,{zh:t,onViewChange:nt}),end:(0,B.jsx)(gt,{zh:t}),className:`@max-[40rem]/space-list:h-auto @max-[40rem]/space-list:min-h-14 @max-[40rem]/space-list:gap-y-2 @max-[40rem]/space-list:py-2 @max-[40rem]/space-list:[&>:last-child]:col-span-full`}),r),[r,nt,n,t]),(0,z.useLayoutEffect)(()=>{Oe.current&&(Oe.current.scrollTop=0)},[L]);let G=Ie((e,t)=>{if(e&&!t?.nextCursor)return null;let n=new URLSearchParams({view:L,q:R});return et&&n.set(`kind`,et),U&&n.set(U,m.get(U)),e&&t?.nextCursor&&n.set(`cursor`,t.nextCursor),`${Ee}?${n}`},Me,{refreshInterval:4e3}),K=Fe(V?Pe(V):null,Ae,{refreshInterval:e=>e?.currentVersion.mimeType===`application/vnd.xopc.univer-workbook+json`?0:4e3,revalidateOnFocus:!1}),q=G.data?.flatMap(e=>e.items)??[],J=K.data,ut=!!(w&&(T||D||O)),ht=J&&le?.itemId===J.id&&le.versions.includes(J.currentVersion.id)?le:void 0,Y=ht?.locationKey===u.key?J?.currentVersion:J?.versions.find(e=>e.id===w)??(ut?void 0:J?.currentVersion),X=Y?.mimeType===je,vt=X&&Y.id===J?.currentVersion.id,yt=vt&&ht?ht.seed:Y?.id;(0,z.useEffect)(()=>{if(H.state!==`unblocked`||!w||w===Y?.id||ht?.locationKey!==u.key)return;let e=new URLSearchParams(m);e.delete(`version`),_(e,{replace:!0})},[u.key,H.state,ht,m,w,_,Y?.id]);let bt=Y?.id===J?.currentVersion.id?q.find(e=>e.id===V)?.hit:void 0,Z=J?.origins.find(e=>e.versionId===Y?.id&&e.available)??J?.origins.find(e=>e.available)??J?.origin,xt=pt(Z),St=Z?.projectId??J?.origins.find(e=>e.projectId)?.projectId,Ct=de?.itemId===J?.id&&!!de?.open,wt=pe?.itemId===J?.id&&pe?.versionId!==J?.currentVersion.id,Tt=!!(J&&w&&!J.versions.some(e=>e.id===w)),Et=K.mutate,Dt=(0,z.useCallback)(()=>I.current?.prepareChatContext()??Promise.resolve(null),[]),Ot=(0,z.useCallback)(async()=>I.current?.readSelection(),[]),kt=(0,z.useCallback)((e,t)=>{if(Ye.current===e.id)return Et(n=>!n||n.revision>e.revision?n:n.currentVersion.id!==e.currentVersion.id&&e.currentVersion.id!==t&&I.current?.hasChanges()?(ve({itemId:e.id,versionId:e.currentVersion.id}),{...n,title:e.title,favorite:e.favorite,revision:e.revision}):(ve(void 0),e),{revalidate:!1})},[Et]),At=(0,z.useCallback)(async()=>{V&&(await kt(await Ae(Pe(V))),G.mutate())},[kt,G.mutate,V]),jt=(0,z.useCallback)(()=>{At().catch(()=>{})},[At]);(0,z.useEffect)(()=>{Tt&&At().catch(()=>{})},[Tt,At,w]);function Mt(){fe(e=>e&&{...e,open:!1}),requestAnimationFrame(()=>we.current?.focus({preventScroll:!0}))}function Q(e){_(t=>{let n=new URLSearchParams(t);for(let[t,r]of Object.entries(e))r?n.set(t,r):n.delete(t);return n})}function Nt(e){M(!1),ne(!1),oe(``),Q({item:e,version:null,sheet:null,range:null,proposal:null,undo:null})}function Pt(){Nt(null),V&&requestAnimationFrame(()=>xe.current.get(V)?.focus())}(0,z.useLayoutEffect)(()=>{V&&De.current&&getComputedStyle(De.current).visibility===`hidden`&&Se.current?.focus({preventScroll:!0})},[C,V]),(0,z.useEffect)(()=>{if(!V)return;let e=e=>{if(!(e.key!==`Escape`||e.defaultPrevented)&&!(e.target instanceof Element&&e.target.closest(`[data-space-workbook], [data-workbook-chat]`))){if(j||N){M(!1),ne(!1);return}_(e=>{let t=new URLSearchParams(e);return t.delete(`item`),t.delete(`version`),t}),requestAnimationFrame(()=>xe.current.get(V)?.focus())}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[N,j,V,_]);function Ft(e,t){if(e.key!==`ArrowUp`&&e.key!==`ArrowDown`)return;e.preventDefault();let n=q[t+(e.key===`ArrowDown`?1:-1)];n&&xe.current.get(n.id)?.focus()}async function It(e){if(!P){ie(!0),oe(``);try{await e()}catch{oe(t?`操作未完成,请重试`:`Could not complete the action. Try again.`),X?At().catch(()=>{}):K.mutate()}finally{ie(!1)}}}function $(e,t,n,r){return It(async()=>{let i=Pe(t.id),a=e===`restore`||e===`purge`?`/${e}`:``,o=t.revision,s=I.current;if(s&&vt&&V===t.id&&(e===`patch`||e===`trash`)){let e=await s.flushSave();if(!e)return;e!==Y.id&&(o=(await Ae(i)).revision)}let c=await g(p(i+a),{method:e===`patch`?`PATCH`:e===`trash`?`DELETE`:`POST`,body:JSON.stringify({revision:o,...n})});e===`trash`&&be({id:t.id,revision:o+1}),(e===`restore`||e===`purge`)&&be(void 0),e===`patch`?Ye.current===t.id&&(M(!1),X?(await kt(c),r?.()):await K.mutate()):V===t.id&&Nt(null),await G.mutate()})}async function Lt(){!J||!Y||await It(async()=>{let e=I.current,t=vt&&e?await e.flushSave():Y.id;if(!t)return;let n=await Te(J.id,t),r=X?`${J.title.replace(/[\\/\x00-\x1f]/g,`_`)}.xlsx`:Y.fileName,i=X?new Blob([await a(()=>import(`./space-workbook-format-D1PqIvbd.js`).then(e=>n.text().then(t=>e.writeWorkbook(JSON.parse(t)))),__vite__mapDeps([224,225]))],{type:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`}):n,o=URL.createObjectURL(i),s=document.createElement(`a`);s.href=o,s.download=r,s.click(),setTimeout(()=>URL.revokeObjectURL(o),1e3)})}function Rt(){!J||!Y||It(async()=>{let e=await Te(J.id,Y.id);if(e.size>33554432)throw Error(`Attachment too large`);let t=new globalThis.File([e],Y.fileName,{type:Y.mimeType}),n=new URLSearchParams({attachmentHandoff:ce(t)});Z?.projectId&&Z.available&&n.set(`projectId`,Z.projectId),i({pathname:`/chat/new`,search:`?${n}`},{state:{forceNewChat:!0}})})}function zt(e){M(!1),Q({item:e,version:null,sheet:null,range:null,proposal:null,undo:null,view:null,q:null,kind:null,projectId:null,taskId:null}),G.mutate()}function Bt(){It(async()=>{let e=t?`未命名工作簿`:`Untitled workbook`,{blankWorkbook:n}=await a(async()=>{let{blankWorkbook:e}=await import(`./space-workbook-format-D1PqIvbd.js`);return{blankWorkbook:e}},__vite__mapDeps([224,225])),{id:r}=await Ne(crypto.randomUUID(),e,n(e,t?`工作表 1`:`Sheet 1`));zt(r)})}function Vt(e,n,r){It(async()=>{try{let i=await $e(await n(),e),a=i.name||(t?`导入的工作簿`:`Imported workbook`),{id:o}=await Ne(crypto.randomUUID(),a,i,r);zt(o)}catch(e){let n=e instanceof Error?e.message:``;oe(n===`limits`||e?.status===413?t?`表格过大。可先拆分数据,再分别导入。`:`This workbook is too large. Split the data into smaller files and try again.`:n===`array-formula`||n===`linked-formula`?t?`这份表格包含暂不支持转换的公式,可以继续预览原文件。`:`This workbook contains formulas that cannot be converted. You can still preview the original.`:t?`无法导入表格,请检查文件后重试。`:`Could not import this workbook. Check the file and try again.`)}})}function Ht(e){if(e.preventDefault(),!J)return;let t=String(new FormData(e.currentTarget).get(`title`)??``).trim();t&&(t===J.title?Wt():$(`patch`,J,{title:t}))}function Ut(){requestAnimationFrame(()=>{document.activeElement===document.body&&Ce.current?.focus({preventScroll:!0})})}function Wt(e=!0){M(!1),X&&e&&Ut()}function Gt(e,t){if(!J||P)return;let n=e.trim();!n||n===J.title?Wt(t):$(`patch`,J,{title:n},t?Ut:void 0)}let Kt=new Intl.DateTimeFormat(t?`zh-CN`:`en`,{month:`short`,day:`numeric`}),qt=e=>Kt.format(e),Jt=J&&Y&&J.versions.length>1?(0,B.jsx)(b,{value:Y.id,"aria-label":t?X?`工作簿版本`:`资料版本`:X?`Workbook version`:`File version`,className:X?`max-w-32 shrink-0`:void 0,triggerClassName:X?`h-8 px-2 text-xs`:void 0,onChange:e=>{let t=e.target.value;t!==Y.id&&Q({version:t===J.currentVersion.id?null:t,sheet:null,range:null,proposal:null,undo:null})},children:J.versions.map((e,n)=>(0,B.jsxs)(x,{value:e.id,children:[e.id===J.currentVersion.id?t?`最新版`:`Latest`:qt(e.createdAt),` · v`,J.versions.length-n]},e.id))}):null,Yt=e=>e.origin?.label??(e.origin?.kind===`task`?t?`任务`:`Task`:e.origin?.kind===`automation`?t?`定时任务`:`Automation`:t?`对话`:`Chat`),Xt=ae||ye?(0,B.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-t border-edge-subtle bg-surface-panel px-3 py-2 text-sm`,role:`status`,children:[(0,B.jsx)(`span`,{children:ae||(t?`已移到回收站`:`Moved to Trash`)}),ye?(0,B.jsx)(`button`,{type:`button`,disabled:P,className:`rounded-lg p-1 text-accent-fg`,onClick:()=>void $(`restore`,ye),children:t?`撤销`:`Undo`}):null]}):null;return(0,B.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col overflow-hidden`,children:[(0,B.jsx)(`div`,{className:`mx-auto flex w-full max-w-[74rem] min-h-0 flex-1 px-3 pt-3 sm:px-5 sm:pt-5 @min-[58rem]/space:px-6`,children:(0,B.jsxs)(`section`,{ref:De,id:`space-list-${L}`,role:`tabpanel`,"aria-labelledby":`space-tab-${L}`,className:`@container/list flex min-w-0 flex-1 flex-col`,children:[L===`all`&&!U&&(!et||et===`spreadsheet`)?(0,B.jsxs)(`div`,{className:`mb-3 flex shrink-0 flex-wrap justify-end gap-2`,children:[(0,B.jsx)(`input`,{ref:Le,type:`file`,className:`hidden`,accept:`.xlsx,.csv,.tsv`,onChange:e=>{let t=e.currentTarget.files?.[0];e.currentTarget.value=``,t&&Vt(t.name,async()=>t)}}),(0,B.jsxs)(`button`,{type:`button`,disabled:P,onClick:()=>Le.current?.click(),title:t?`导入 XLSX、CSV 或 TSV 的数据、公式与基础布局`:`Import data, formulas and basic layout from XLSX, CSV or TSV`,className:`inline-flex min-h-10 items-center gap-2 rounded-lg px-3 text-sm text-fg-muted hover:bg-surface-hover focus-visible:outline-2 focus-visible:outline-accent disabled:opacity-50`,children:[(0,B.jsx)(me,{className:`size-4`,"aria-hidden":!0}),t?`导入表格`:`Import workbook`]}),(0,B.jsxs)(`button`,{type:`button`,disabled:P,onClick:Bt,className:F(st,`inline-flex min-h-10 items-center gap-2 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent`),children:[(0,B.jsx)(re,{className:`size-4`,"aria-hidden":!0}),t?`新建表格`:`New workbook`]})]}):null,U?(0,B.jsx)(`div`,{className:`mb-3 flex shrink-0 justify-end`,children:(0,B.jsxs)(`button`,{type:`button`,onClick:()=>Q({[U]:null}),className:`inline-flex min-h-9 items-center gap-1 rounded-lg bg-surface-inset px-2 py-1 text-sm text-fg-muted hover:bg-surface-hover`,children:[U===`projectId`?t?`当前项目`:`Project`:t?`当前任务`:`Task`,(0,B.jsx)(ge,{className:`size-3.5`})]})}):null,(0,B.jsxs)(`div`,{ref:Oe,className:`min-h-0 flex-1 overflow-y-auto pb-5`,children:[G.isLoading?(0,B.jsx)(`div`,{className:`space-y-2`,"aria-busy":`true`,children:Array.from({length:5},(e,t)=>(0,B.jsx)(_e,{className:`h-14 w-full rounded-xl`},t))}):null,G.error?(0,B.jsx)(`button`,{className:`rounded-lg py-3 text-sm text-accent-fg`,onClick:()=>void G.mutate(),children:t?`加载失败,重试`:`Could not load. Retry`}):null,!G.isLoading&&!G.error&&q.length===0?(0,B.jsx)(`p`,{className:`py-10 text-center text-sm text-fg-muted`,children:Ue?t?`没有匹配的资料`:`No matching results`:L===`favorites`?t?`暂无收藏`:`No favorites`:L===`trash`?t?`回收站为空`:`Trash is empty`:t?`暂无资料`:`No results yet`}):null,q.length>0?(0,B.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-edge-subtle`,children:[(0,B.jsxs)(`div`,{className:F(ct,`min-h-10 border-b border-edge-subtle bg-surface-inset text-xs font-medium text-fg-muted`),children:[(0,B.jsx)(`span`,{children:t?`名称`:`Name`}),(0,B.jsx)(`span`,{className:`hidden @xl/list:block`,children:t?`格式`:`Format`}),(0,B.jsx)(`span`,{className:`hidden @xl/list:block`,children:t?`来源`:`Source`}),(0,B.jsx)(`span`,{className:`min-w-[5rem] text-end`,children:t?`更新日期`:`Updated`})]}),(0,B.jsx)(`ul`,{className:`divide-y divide-edge-subtle`,children:q.map((e,n)=>{let r=at[e.kind],i=e.currentVersion,a=i.mimeType===`application/vnd.xopc.univer-workbook+json`?`XLSX`:/\.([a-z\d]{1,12})$/i.exec(i.fileName)?.[1]?.toUpperCase(),o=ke(e.id,i.id),s=e.kind===`audio`&&L!==`trash`,c=e.origin?Yt(e):null;return(0,B.jsxs)(`li`,{className:`relative [contain-intrinsic-size:auto_55px] [content-visibility:auto]`,children:[(0,B.jsxs)(`button`,{type:`button`,title:e.title,ref:t=>{t?xe.current.set(e.id,t):xe.current.delete(e.id)},onKeyDown:e=>Ft(e,n),"aria-pressed":V===e.id,onClick:()=>Nt(e.id),className:F(ct,`min-h-[54px] w-full py-1.5 text-start focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-accent`,V===e.id?`bg-accent-soft`:`hover:bg-surface-hover`),children:[(0,B.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2.5 sm:gap-3`,children:[s?(0,B.jsx)(`span`,{className:`w-11 shrink-0`,"aria-hidden":!0}):e.kind===`image`||e.kind===`video`?(0,B.jsx)(Je,{kind:e.kind,src:o},i.id):(0,B.jsx)(Xe,{icon:r}),(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:(0,B.jsx)(mt,{text:e.title,query:R.trim()})}),a||c?(0,B.jsxs)(`span`,{className:`block truncate text-xs text-fg-muted @xl/list:hidden`,children:[a,a&&c?` · `:null,c]}):null,e.hit?(0,B.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:(0,B.jsx)(mt,{text:e.hit.text,query:R.trim()})}):null]})]}),(0,B.jsx)(`span`,{className:`hidden @xl/list:block`,children:a?(0,B.jsx)(`span`,{className:`inline-block max-w-full truncate rounded bg-surface-inset px-1.5 py-0.5 align-middle text-xs font-medium text-fg-muted`,children:a}):(0,B.jsx)(`span`,{className:`text-xs text-fg-muted`,children:`—`})}),(0,B.jsx)(`span`,{className:`hidden truncate text-sm text-fg-muted @xl/list:block`,children:c??`—`}),(0,B.jsx)(`time`,{className:`min-w-[5rem] text-end text-xs whitespace-nowrap tabular-nums text-fg-muted`,children:qt(e.updatedAt)})]}),s?(0,B.jsx)(Ze,{src:o,title:e.title,zh:t},i.id):null]},e.id)})})]}):null,G.data?.at(-1)?.nextCursor?(0,B.jsx)(`button`,{className:`mt-3 rounded-lg py-2 text-sm text-accent-fg`,onClick:()=>void G.setSize(G.size+1),children:t?`加载更多`:`Load more`}):null]})]})}),V&&C?(0,Ke.createPortal)((0,B.jsxs)(`section`,{id:`space-file-preview`,"aria-label":X?t?`工作簿编辑器`:`Workbook editor`:t?`资料预览`:`File preview`,style:{"--space-preview-width":`${ee}%`},"data-space-workbook-surface":X?``:void 0,className:F(`file-preview-surface absolute inset-0 z-40 flex min-h-0 min-w-0`,!X&&`@min-[58rem]/space:relative @min-[58rem]/space:inset-auto @min-[58rem]/space:w-[var(--space-preview-width)] @min-[58rem]/space:shrink-0 @min-[58rem]/space:border-s @min-[58rem]/space:border-edge-subtle`),children:[X?null:(0,B.jsx)(ft,{zh:t,width:ee,onResize:A}),(0,B.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[(0,B.jsxs)(`header`,{className:`flex min-h-14 shrink-0 items-center gap-1 border-b border-edge-subtle px-3 py-2`,children:[(0,B.jsx)(`button`,{type:`button`,className:F(W,!X&&`@min-[58rem]/space:hidden`),onClick:Pt,"aria-label":t?`返回资料库`:`Back to library`,children:(0,B.jsx)(y,{className:`size-4`})}),X&&j&&J?(0,B.jsx)(`input`,{defaultValue:J.title,maxLength:240,autoFocus:!0,readOnly:P,onFocus:e=>e.currentTarget.select(),onBlur:e=>Gt(e.currentTarget.value,!1),onKeyDown:e=>{e.key!==`Enter`&&e.key!==`Escape`||(e.stopPropagation(),!(P||e.nativeEvent.isComposing||e.keyCode===229)&&(e.preventDefault(),e.key===`Enter`?Gt(e.currentTarget.value,!0):Wt()))},"aria-label":t?`工作簿名称`:`Workbook name`,className:`h-9 min-w-0 flex-1 rounded-lg border border-edge bg-surface-inset px-2 text-sm font-semibold text-fg outline-none focus:border-accent`},J.id):(0,B.jsx)(`h2`,{ref:Se,tabIndex:-1,className:`min-w-0 flex-1 text-sm leading-5 font-semibold wrap-anywhere text-fg`,children:X&&J&&!J.trashedAt?(0,B.jsx)(`button`,{type:`button`,ref:Ce,title:t?`重命名工作簿`:`Rename workbook`,disabled:P,className:`block min-h-9 max-w-full truncate rounded-lg px-2 text-start hover:bg-surface-hover focus-visible:outline-2 focus-visible:outline-accent`,onClick:()=>M(!0),children:J.title}):J?.title??(t?`预览`:`Preview`)}),X?Jt:null,J&&!J.trashedAt?(0,B.jsxs)(B.Fragment,{children:[X?(0,B.jsxs)(`button`,{type:`button`,ref:we,className:F(W,`w-auto gap-1.5 px-2`,Ct&&`bg-accent-soft text-accent-fg`),"aria-expanded":Ct,"aria-controls":de?.itemId===J.id?`workbook-chat`:void 0,"aria-label":t?`工作簿对话`:`Workbook chat`,onClick:()=>Ct?Mt():fe({itemId:J.id,open:!0}),children:[(0,B.jsx)(te,{className:`size-4`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`hidden whitespace-nowrap @min-[34rem]/space:inline`,children:t?`工作簿对话`:`Workbook chat`})]}):null,(0,B.jsx)(`button`,{type:`button`,className:F(W,J.favorite&&`text-accent-fg`),"aria-pressed":J.favorite,"aria-label":t?`收藏`:`Favorite`,disabled:P,onClick:()=>void $(`patch`,J,{favorite:!J.favorite}),children:(0,B.jsx)(k,{className:F(`size-4`,J.favorite&&`fill-current`)})}),Y&&/^(?:audio|video)\//i.test(Y.mimeType)?(0,B.jsx)(`button`,{type:`button`,className:W,disabled:P,"aria-label":t?`分享链接`:`Share link`,onClick:()=>e.createShareLink({spaceVersion:{itemId:J.id,versionId:Y.id},fileName:Y.fileName}),children:(0,B.jsx)(se,{className:`size-4`})}):null,(0,B.jsx)(`button`,{type:`button`,className:W,disabled:P,"aria-label":X?t?`下载此版本为 Excel`:`Download this version as Excel`:t?`下载`:`Download`,onClick:()=>void Lt(),children:(0,B.jsx)(v,{className:`size-4`})}),(0,B.jsxs)(Be,{children:[(0,B.jsx)(He,{className:W,"aria-label":t?`更多操作`:`More actions`,children:(0,B.jsx)(S,{className:`size-4`})}),(0,B.jsx)(Re,{children:(0,B.jsxs)(ze,{align:`end`,sideOffset:5,className:`z-50 min-w-36 rounded-xl border border-edge bg-surface-overlay p-1 shadow-popover`,onCloseAutoFocus:e=>{X&&j&&e.preventDefault()},children:[(0,B.jsx)(Ve,{className:ot,onClick:()=>M(!0),children:t?`重命名`:`Rename`}),(0,B.jsx)(Ve,{className:F(ot,`text-red-600 dark:text-red-400`),disabled:P,onClick:()=>void $(`trash`,J),children:t?`移到回收站`:`Move to Trash`})]})})]})]}):null,X?null:(0,B.jsx)(`button`,{type:`button`,className:F(W,`hidden @min-[58rem]/space:inline-flex`),onClick:Pt,"aria-label":t?`关闭预览`:`Close preview`,children:(0,B.jsx)(ge,{className:`size-4`})})]}),!X&&j&&J?(0,B.jsxs)(`form`,{className:`flex shrink-0 flex-wrap items-center gap-2 px-3 py-2`,onSubmit:Ht,children:[(0,B.jsx)(`input`,{name:`title`,defaultValue:J.title,required:!0,maxLength:240,autoFocus:!0,"aria-label":t?`资料名称`:`Result name`,className:`min-w-24 flex-1 rounded-lg border border-edge bg-surface-panel px-2 py-2 text-sm`}),(0,B.jsx)(`button`,{className:st,disabled:P,children:t?`保存`:`Save`}),(0,B.jsx)(`button`,{type:`button`,className:`rounded-lg p-2 text-sm hover:bg-surface-hover`,onClick:()=>M(!1),children:t?`取消`:`Cancel`})]}):null,K.isLoading?(0,B.jsx)(_e,{className:`m-3 min-h-0 flex-1 rounded-xl`}):null,K.error?(0,B.jsx)(`p`,{className:`px-3 py-5 text-sm text-fg-muted`,children:t?`资料暂不可用`:`Result unavailable`}):null,J&&ut&&!Y?(0,B.jsxs)(`p`,{role:`status`,className:`px-3 py-5 text-sm text-fg-muted`,children:[t?`引用的工作簿版本已不可用。`:`The referenced workbook version is unavailable.`,(0,B.jsx)(`button`,{type:`button`,className:`ms-2 text-accent-fg`,onClick:()=>Q({version:null,sheet:null,range:null,proposal:null,undo:null}),children:t?`打开最新版本`:`Open latest version`})]}):null,J&&Y?(0,B.jsxs)(B.Fragment,{children:[X&&(D||O)&&!J.trashedAt?(0,B.jsx)(rt,{id:J.id,versionId:Y.id,proposalId:D,undo:O,zh:t,onClose:()=>Q({proposal:null,undo:null}),onComplete:()=>{K.mutate(),G.mutate(),Q({version:null,proposal:null,undo:null})}},`${D??``}:${O??``}`):null,X?(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(_e,{className:`m-3 min-h-0 flex-1 rounded-xl`}),children:(0,B.jsx)(it,{id:J.id,versionId:Y.id,title:J.title,zh:t,editable:!J.trashedAt&&vt,controls:I,targetSheet:T,targetRange:E,newerVersionPending:wt,onCopy:zt,onSaved:e=>{ue(t=>({itemId:J.id,seed:yt,locationKey:u.key,versions:[...new Set([...t?.seed&&t.seed===yt?t.versions:[Y.id],e])]})),Ae(Pe(J.id)).then(t=>kt(t,e)).catch(()=>{}),G.mutate()}},`${vt?`latest`:`history`}:${yt}`)}):(0,B.jsx)(qe,{itemId:J.id,version:Y,hit:bt,download:Lt},Y.id),!X||bt||xt||J.trashedAt||Y.indexStatus===`pending`?(0,B.jsxs)(`div`,{className:`max-h-[45%] shrink-0 space-y-2 overflow-y-auto border-t border-edge-subtle px-3 py-2`,children:[bt?(0,B.jsx)(`p`,{className:`line-clamp-2 text-xs text-fg-muted`,children:(0,B.jsx)(mt,{text:bt.text,query:R.trim()})}):null,(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 text-xs text-fg-muted`,children:[(0,B.jsx)(`span`,{children:Z?Yt(J):null}),Y.indexStatus===`pending`?(0,B.jsx)(`span`,{children:t?`正在索引`:`Indexing`}):null,X?null:Jt]}),(0,B.jsx)(`footer`,{className:`flex flex-wrap items-center justify-between gap-2`,children:J.trashedAt?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`button`,{type:`button`,className:st,disabled:P,onClick:()=>void $(`restore`,J),children:t?`恢复`:`Restore`}),(0,B.jsx)(`button`,{type:`button`,className:`rounded-lg px-2 py-2 text-sm text-red-600 hover:bg-surface-hover dark:text-red-400`,onClick:()=>ne(!0),children:t?`永久删除`:`Delete permanently`})]}):(0,B.jsxs)(B.Fragment,{children:[xt?(0,B.jsx)(d,{className:`rounded-lg px-2 py-2 text-sm text-fg-muted hover:bg-surface-hover`,to:xt,children:t?`查看来源`:`Open source`}):(0,B.jsx)(`span`,{}),!X&&Qe(Y.fileName)?(0,B.jsx)(`button`,{type:`button`,className:F(ot,`w-auto border border-edge`),disabled:P,title:t?`导入数据、公式与基础布局,保留原文件`:`Import data, formulas and basic layout as a separate workbook`,onClick:()=>Vt(Y.fileName,()=>Te(J.id,Y.id),{id:J.id,versionId:Y.id}),children:t?`创建可编辑副本`:`Make an editable copy`}):null,X?null:(0,B.jsx)(`button`,{type:`button`,className:st,disabled:P||Y.sizeBytes>33554432,title:Y.sizeBytes>33554432?t?`超过对话附件大小上限`:`Exceeds the chat attachment size limit`:void 0,onClick:Rt,children:t?`在对话中使用`:`Use in chat`})]})}),N?(0,B.jsxs)(`div`,{role:`alert`,className:`rounded-xl border border-edge bg-surface-panel p-3 text-sm`,children:[(0,B.jsx)(`p`,{children:t?`永久删除「${J.title}」?`:`Delete “${J.title}” permanently?`}),(0,B.jsxs)(`div`,{className:`mt-2 flex justify-end gap-2`,children:[(0,B.jsx)(`button`,{type:`button`,className:ot,onClick:()=>ne(!1),children:t?`取消`:`Cancel`}),(0,B.jsx)(`button`,{type:`button`,className:F(ot,`text-red-600 dark:text-red-400`),disabled:P,onClick:()=>void $(`purge`,J),children:t?`删除`:`Delete`})]})]}):null]}):null]}):null,Xt]}),X&&J&&!J.trashedAt&&de?.itemId===J.id?(0,B.jsx)(tt,{id:J.id,open:Ct,zh:t,originId:Z?.available?Z.conversationId:void 0,projectId:St,onClose:Mt,readSelection:Ot,prepareSendContext:Dt,onRunSettled:jt},J.id):null]}),C):null,V&&C?null:Xt,(0,B.jsx)(he,{open:e.dialogOpen,onOpenChange:e.handleOpenChange,result:e.result,loading:e.loading,error:e.error,pendingParams:e.pendingParams,onConfirm:e.confirmShareLink})]})}export{X as SpacePage};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/attachment-process-heavy-DGZZ-M85.js","assets/rolldown-runtime-aKtaBQYM.js","assets/preload-helper-Czpn1I53.js","assets/pdf-runtime-JnUAvfIa.js","assets/chat-page-3fVhP77N.js","assets/marked.esm-8VXEA2AD.js","assets/vendor-react-BOUWij0V.js","assets/chunk-KS7C4IRE-DIIvxCDx.js","assets/locale-store-CHjsq5NR.js","assets/messages-C7QSnTdg.js","assets/dist-DlirbHVs.js","assets/es2015-CFqg57eW.js","assets/dist-CDSvxjOh.js","assets/createLucideIcon-DPHK1VkS.js","assets/app-window-DXFNqt_0.js","assets/archive-Dz0hferG.js","assets/arrow-left-D880xG-P.js","assets/video-generation-Cec49Jwg.js","assets/arrow-up-D5ZtR1QT.js","assets/product-automation-feedback-GA_YPLkr.js","assets/activity-YogQEteU.js","assets/bot-DjLkhyZL.js","assets/circle-check-C23XjkUj.js","assets/circle-pause-CN9jYH2s.js","assets/clock-3-DnrAnuyZ.js","assets/external-link-DjqjBmc3.js","assets/loader-circle-CifKLtgG.js","assets/message-square-fVE7Ghj1.js","assets/pause-DuPxgSxk.js","assets/play-kxZvpBg8.js","assets/rotate-ccw-JM1TBLpp.js","assets/rotate-cw-LIg3Am9S.js","assets/sparkles-DHlfQFAF.js","assets/triangle-alert-2JXFNNKU.js","assets/volume-2-BSJhAY97.js","assets/zap-dximCGjy.js","assets/cn-0WouolD0.js","assets/bundle-mjs-rHxsej31.js","assets/session-manager-DUWeBdeG.js","assets/schemas-CCWMleym.js","assets/turn-outcome-BSbEJx8h.js","assets/product-delivery-4gEqUIsK.js","assets/session-api-CR3NLqvs.js","assets/gateway-startup-retry-DgmvR-hb.js","assets/local-session-drafts-CGSV1RQg.js","assets/tool-activity-BtJkgjFf.js","assets/attachment-utils-core-BPYdUI6y.js","assets/gateway-realtime-CoIFB3im.js","assets/gateway-realtime-store-CTWm23Qi.js","assets/playback-coordinator-CWHIf0wr.js","assets/registry-api-CDpUAb2R.js","assets/agents-admin-api-DSr-PWuW.js","assets/gateway-config-swr-BD-ams0X.js","assets/vendor-swr-CdRzEUwF.js","assets/button-C5tRaJxt.js","assets/automation-api-D-gn6x5E.js","assets/earth-C9Z4bTTG.js","assets/check-DUBLcKHA.js","assets/chevron-down-ccbiQQz_.js","assets/chevron-right-BweFrslA.js","assets/working-directory-picker-modal-DgM21YVT.js","assets/file-archive-DanfQJNe.js","assets/interaction-BdhHBbYa.js","assets/form-field-width-DJw_jULe.js","assets/settings-form-draft-Dy10ldo8.js","assets/popover-select-hRG1EzAY.js","assets/skeleton-DzdOeGYz.js","assets/dist-BSVQC3i_.js","assets/dist-DSRLZhL9.js","assets/floating-ui.dom-CiMnRY5O.js","assets/floating-ui.react-dom-Gx6CM22l.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/circle-alert-BEjgurr2.js","assets/send-1f1Ntw6E.js","assets/circle-x-DFsCKeya.js","assets/circle-BoO4YvTx.js","assets/file-tree-utils-DJs1faGv.js","assets/copy-Dv6d4Dvw.js","assets/database-CjjeZfRG.js","assets/download-Dk-ZjtO6.js","assets/ellipsis-0k4rZLoy.js","assets/file-code-corner-byQA1VfD.js","assets/file-image-CDUPkZvG.js","assets/file-text-D12HbeVy.js","assets/file-CStvVK2S.js","assets/folder-kanban-CpLlFI1o.js","assets/folder-open-CyzJ19I9.js","assets/folder-CN-pC3XL.js","assets/git-branch-Dh9uxTot.js","assets/globe-DSSGFWFn.js","assets/history-DXH_9jsE.js","assets/notes-api-D5SvfybU.js","assets/markdown-view-ihzUc4ud.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/app-link-Ji4uewEG.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/xml-_d7dTN2Q.js","assets/mermaid-render-oOellPHt.js","assets/markdown-view-Czi3_WHu.css","assets/chat-chart-block-B83s8HE9.js","assets/key-round-DWbpyU2U.js","assets/laptop-CI3hBVrl.js","assets/link-2-D_ZKYUW7.js","assets/list-checks-BbsExAoq.js","assets/list-todo-CTVRto8O.js","assets/messages-square-BckAJrEW.js","assets/mic-CuUb7zc-.js","assets/monitor-Af5eAvF7.js","assets/use-generated-media-CzRbgtcv.js","assets/install-connector-dialog-CntHi8Rh.js","assets/secret-input-DsjfQmDn.js","assets/eye-CABVeTq0.js","assets/is-masked-secret-DOkL5b_X.js","assets/connectors-api-CRGq-TSw.js","assets/electron-env-DHOGevH3.js","assets/oauth-provider-connect-DGYky6ut.js","assets/cloud-C4-yfnnk.js","assets/models-hub-cache-BrD6r5Qs.js","assets/oauth-api-DnMpUoyx.js","assets/connection-usage-guide-B9hoSOnN.js","assets/connection-usage-BhdQRWgQ.js","assets/paperclip-f1HujQY1.js","assets/pencil-DmIY3Oa-.js","assets/pin-off-BMRv-Kxr.js","assets/refresh-cw-BRlGaq2w.js","assets/save-DRDABU--.js","assets/search-DA7gz22f.js","assets/settings-2-D-csvaET.js","assets/settings-uiTATseT.js","assets/share-2-CnIB9PsV.js","assets/shield-check-BU58siTV.js","assets/smartphone-DSSsQFqA.js","assets/square-DMK_fB-3.js","assets/preview-runtime-C1U57WSM.js","assets/use-async-resource-BHFGZCY2.js","assets/workspace-api-BuNWyNvA.js","assets/files-GdwDamkp.js","assets/index.module-Cd9ENXfk.js","assets/trash-2-DusmjVPV.js","assets/user-round-C9jxPhMR.js","assets/wifi-off-C35sMFUl.js","assets/share-link-dialog-2JjvWs0q.js","assets/copy-text-row-gqdh0Bg1.js","assets/wrench-DFb4r8bH.js","assets/tasks-CwyNaa-j.js","assets/specialists-xbB3xL9e.js","assets/api-CGs641OT.js","assets/session-identity-DRFdxntH.js","assets/new-session-preferences-gb411vZP.js","assets/composer-model-config-control-C2Bku39S.js","assets/model-selector-QFZY5XNN.js","assets/open-capability-settings-DQsmJxI7.js","assets/model-sort-_Tz8s_4N.js","assets/cloud-credits-B-nbtkqv.js","assets/space-api-_uKFiASp.js","assets/home-task-actions-C8Fi6GBq.js","assets/capabilities-BaKHutgZ.js","assets/capabilities-abgigXV1.js","assets/right-workspace-store-Cehybf-G.js","assets/phone-workspace-store-DGaibcsi.js","assets/workspace-editor-agent-store-CX8zX9eZ.js","assets/chat-agents-api-CyvBfBbp.js","assets/middleware-Pd0e8Igk.js","assets/composer-payload-handoff-ClWsunJ2.js","assets/voice-input-shortcut-events-DN-_rY5a.js","assets/chunk-D32TOXHM-DQIy-Baq.js","assets/linkify-it-BkqEorO0.js","assets/tool-friendly-title-CJVFJ2Ud.js","assets/use-realtime-voice-9OvLwHzk.js","assets/voice-CUfqdnlR.js","assets/composer-notifications-MGKffwC7.js","assets/activity-store-hSe5Nbgk.js","assets/voice-call-context-BM2A4bLz.js","assets/app-chrome-BeB4KgOf.js","assets/page-header-store-NP7MCIaP.js","assets/new-chat-navigation-spnin196.js","assets/loopi-CNtmi9FU.js","assets/loopi-C09I2mNj.css","assets/extension-provider-DFcRbTHI.js","assets/theme-store-CvG266p8.js","assets/extension-message-router-B2wbucV7.js","assets/agent-avatar-display-D_UDgOr9.js","assets/skill-wire-pattern-BPpeIcCi.js","assets/composer-handoff-params-DBpzHuNo.js","assets/agent-display-names-Bje7vfSn.js","assets/use-directory-picker-C4p7AgWY.js","assets/confirm-dialog-MHCmEEUZ.js","assets/shares-api-BhWvN3LS.js","assets/dist-DaFr5KMw.js","assets/use-composer-attachments-DJsIzJ1c.js","assets/chevron-left-DqFhpbvK.js","assets/use-file-preview-expanded-BFF2vXm5.js","assets/message-square-plus-XP0tGdlV.js","assets/minimize-2-DtOGrlpo.js","assets/constants-D5Z-mUto.js","assets/sliding-tab-list-CmcrqRzN.js","assets/sliding-indicator-hwz0sx3h.js","assets/use-share-link-WKZLlEqr.js","assets/file-preview-surface-Da1xZiG6.js","assets/command-palette-api-UrqPvWR1.js","assets/skill-list-api-B26hHnXq.js","assets/skill-api-utils-C7V4JVXM.js","assets/automation-task-card-C453Q-Wa.js","assets/automation-display-DaVDNZz8.js","assets/message-circle-Badhj-4D.js","assets/date-picker-DwITf4I2.js","assets/calendar-days-hw_Y-g-s.js","assets/time-picker-otHjbob1.js","assets/dev-view-store-DsjH8x76.js","assets/extension-iframe-host-CIAq7PSn.js","assets/extension-authoritative-grants-DYp2nNol.js","assets/runtime-health-zDkHcOZO.js","assets/api-B3T06TLl.js","assets/terminal-panel-store-Cy90Ix5U.js","assets/agents-app-path-ciChvpCS.js","assets/use-media-query-ady-FgjK.js","assets/oauth-authorization-window-o6URRos4.js","assets/page-context-draft-Bk7jVvAG.js","assets/management-api-FVu7eYXD.js","assets/side-chat-shortcut-BIw-1TTD.js","assets/chat-page-zQeUaawJ.css","assets/space-workbook-BAwHwK6O.js","assets/space-workbook-CvOADsEJ.css","assets/space-workbook-format-D1PqIvbd.js","assets/xlsx-Cl_0CZaL.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,i as n,n as r,t as i}from"./vendor-react-BOUWij0V.js";import{t as a}from"./preload-helper-Czpn1I53.js";import{_ as o,d as s,f as c,m as l,p as u,t as d,u as f}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{i as p,l as m,n as h,o as g}from"./locale-store-CHjsq5NR.js";import{t as _}from"./archive-Dz0hferG.js";import{t as v}from"./arrow-down-to-line-C5D8Vt-L.js";import{t as y}from"./arrow-left-D880xG-P.js";import{n as b,r as x}from"./popover-select-hRG1EzAY.js";import{t as S}from"./ellipsis-0k4rZLoy.js";import{t as C}from"./file-image-CDUPkZvG.js";import{t as w}from"./file-text-D12HbeVy.js";import{t as T}from"./file-CStvVK2S.js";import{n as E,t as D}from"./table-cells-split-DpObdvTg.js";import{n as O,t as k}from"./star-BuMAkjC9.js";import{a as ee,c as A,l as j,r as M,s as N}from"./use-generated-media-CzRbgtcv.js";import{t as te}from"./panel-right-CFGrHTsD.js";import{t as ne}from"./pause-DuPxgSxk.js";import{t as P}from"./play-kxZvpBg8.js";import{t as re}from"./plus-Q2yW6OE7.js";import{t as ie}from"./presentation-D-Ui_vVA.js";import{t as ae}from"./rotate-ccw-JM1TBLpp.js";import{t as oe}from"./search-DA7gz22f.js";import{t as se}from"./share-2-CnIB9PsV.js";import{i as ce,m as le,n as ue,r as de,t as fe}from"./preview-runtime-C1U57WSM.js";import{t as pe}from"./trash-2-DusmjVPV.js";import{t as me}from"./upload-rrb46c3c.js";import{n as he}from"./share-link-dialog-2JjvWs0q.js";import{t as ge}from"./x-B_N4OPjy.js";import{t as F}from"./cn-0WouolD0.js";import{t as _e}from"./skeleton-DzdOeGYz.js";import{a as ve}from"./api-CGs641OT.js";import{a as ye}from"./session-api-CR3NLqvs.js";import{t as be}from"./session-manager-DUWeBdeG.js";import{o as xe}from"./local-session-drafts-CGSV1RQg.js";import{l as Se,o as Ce,s as we,t as I}from"./new-session-preferences-gb411vZP.js";import{c as Te,d as Ee,f as De,i as Oe,l as ke,n as Ae,p as je,r as Me,t as Ne,u as Pe}from"./space-api-_uKFiASp.js";import{i as Fe,t as Ie}from"./vendor-swr-CdRzEUwF.js";import{t as Le}from"./chat-agents-api-CyvBfBbp.js";import"./constants-D5Z-mUto.js";import{a as Re,i as ze,o as Be,r as Ve,s as He}from"./dist-BSVQC3i_.js";import{i as L}from"./theme-store-CvG266p8.js";import{t as Ue}from"./page-tabs-DoYMKhVO.js";import{t as We}from"./page-header-store-NP7MCIaP.js";import{t as Ge}from"./use-share-link-WKZLlEqr.js";var Ke=e(n(),1),R=r(),z=e(t(),1),B=i();function qe({itemId:e,version:t,hit:n,download:r}){let i=h(e=>e.language),o=L(e=>e.resolved),s=le(t.fileName,t.mimeType),c=s===`audio`||s===`video`,[l,u]=(0,z.useState)(null),d={id:`space:${t.id}`,context:`attachment`,source:{kind:`inline`},fileName:t.fileName,mimeType:t.mimeType,size:t.sizeBytes,type:s},f=de(d),[p,m]=(0,z.useState)({loading:!0,textContent:null,binaryBuffer:null,loadError:null}),{plugin:g,controls:_}=f,{setPage:v,pageCount:y}=_,b=typeof n?.locator.page==`number`?n.locator.page:void 0,x=typeof n?.locator.slide==`number`?n.locator.slide:void 0,S=typeof n?.locator.line==`number`?n.locator.line:void 0,C=typeof n?.locator.sheet==`string`?n.locator.sheet:void 0,w=typeof n?.locator.paragraph==`number`?n.locator.paragraph:void 0;if((0,z.useEffect)(()=>{b&&y!==null&&v(b)},[b,y,v]),(0,z.useEffect)(()=>{let n=new AbortController,r;if(!c){if(g.readMode===`metadata`){m({loading:!1,textContent:null,binaryBuffer:null,loadError:null});return}if(g.maxBytes&&t.sizeBytes>g.maxBytes){m({loading:!1,textContent:null,binaryBuffer:null,loadError:i===`zh`?`文件过大,可下载查看`:`File too large to preview`});return}return Te(e,t.id,n.signal).then(async e=>{let i=g.readMode===`text`?await e.text():null,o=g.readMode===`binary`?await e.arrayBuffer():null,c=s===`pptx`&&o?await a(()=>import(`./attachment-process-heavy-DGZZ-M85.js`).then(e=>e.processPptx(o,t.fileName)),__vite__mapDeps([0,1,2,3])):void 0;n.signal.aborted||(c&&u(c.extractedText),r=g.readMode===`url`?URL.createObjectURL(new Blob([e],{type:t.mimeType})):void 0,m({loading:!1,textContent:i,binaryBuffer:o,rawUrl:r,loadError:null}))}).catch(()=>{n.signal.aborted||m({loading:!1,textContent:null,binaryBuffer:null,loadError:i===`zh`?`资料暂不可读`:`Content unavailable`})}),()=>{n.abort(),r&&URL.revokeObjectURL(r)}}},[s,c,e,t.id,t.fileName,t.mimeType,t.sizeBytes,g,i]),c){let n=ke(e,t.id);return(0,B.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 items-center justify-center overflow-hidden bg-surface-panel p-3`,children:s===`audio`?(0,B.jsx)(`audio`,{src:n,controls:!0,preload:`metadata`,className:`w-full`}):(0,B.jsx)(`video`,{src:n,controls:!0,playsInline:!0,preload:`metadata`,className:`max-h-full max-w-full rounded-lg`})})}return(0,B.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-surface-panel`,children:[g.capabilities.some(e=>[`zoom`,`pageNavigation`,`rotate`,`search`].includes(e))?(0,B.jsx)(`div`,{className:`border-b border-edge-subtle px-2 py-1`,children:(0,B.jsx)(fe,{controller:f})}):null,(0,B.jsx)(ue,{...p,descriptor:d,language:i,resolvedTheme:o,targetLine:S,targetSlide:x,targetSheet:C,targetParagraph:w,extractedText:l,controller:f,actions:{onDownload:r,canDownload:!0}})]})}var V=`grid h-9 w-11 shrink-0 place-items-center overflow-hidden rounded-md bg-surface-inset text-fg-muted`;function Je(e){let t=(0,R.c)(17),{kind:n,src:r}=e,i=(0,z.useRef)(null),[a,o]=(0,z.useState)(!1),[s,c]=(0,z.useState)(!1),[l,u]=(0,z.useState)(!1),d,f;t[0]===n?(d=t[1],f=t[2]):(d=()=>{let e=i.current;if(n!==`video`||!e)return;let t=new IntersectionObserver(e=>{e.some(Ye)&&(o(!0),t.disconnect())});return t.observe(e),()=>t.disconnect()},f=[n],t[0]=n,t[1]=d,t[2]=f),(0,z.useEffect)(d,f);let p=n===`image`?C:E,m=!s&&`invisible`,h;t[3]===m?h=t[4]:(h=F(`absolute inset-0 size-full object-cover`,m),t[3]=m,t[4]=h);let g=h,_;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=F(V,`relative`),t[5]=_):_=t[5];let v;t[6]===p?v=t[7]:(v=(0,B.jsx)(p,{className:`size-4`}),t[6]=p,t[7]=v);let y;t[8]!==l||t[9]!==n||t[10]!==g||t[11]!==r||t[12]!==a?(y=!l&&(n===`image`?(0,B.jsx)(`img`,{src:r,width:44,height:36,loading:`lazy`,decoding:`async`,alt:``,className:g,onLoad:()=>c(!0),onError:()=>u(!0)}):a&&(0,B.jsx)(`video`,{src:`${r}#t=0.1`,muted:!0,playsInline:!0,preload:`metadata`,className:g,onLoadedData:()=>c(!0),onError:()=>u(!0)})),t[8]=l,t[9]=n,t[10]=g,t[11]=r,t[12]=a,t[13]=y):y=t[13];let b;return t[14]!==v||t[15]!==y?(b=(0,B.jsxs)(`span`,{ref:i,className:_,"aria-hidden":!0,children:[v,y]}),t[14]=v,t[15]=y,t[16]=b):b=t[16],b}function Ye(e){return e.isIntersecting}function Xe(e){let t=(0,R.c)(2),{icon:n}=e,r=n===void 0?T:n,i;return t[0]===r?i=t[1]:(i=(0,B.jsx)(`span`,{className:V,children:(0,B.jsx)(r,{className:`size-4`,"aria-hidden":!0})}),t[0]=r,t[1]=i),i}function Ze(e){let t=(0,R.c)(25),{src:n,title:r,zh:i}=e,a;t[0]===n?a=t[1]:(a=e=>e.active?.entry.source.src===n?e.active.entry.element:null,t[0]=n,t[1]=a);let o=N(a),{playing:s,starting:c,failed:l,toggle:u}=M(o),[d,f]=(0,z.useState)(!1),p=d||l,m=s||c,h=p?ae:m?ne:P,g=p?i?`重试播放`:`Retry playback`:m?i?`暂停`:`Pause`:i?`播放`:`Play`,_;t[2]!==o||t[3]!==n||t[4]!==r||t[5]!==u?(_=function(){f(!1),o?u():ee({kind:`audio`,src:n,title:r}).catch(e=>{e instanceof DOMException&&e.name===`AbortError`||f(!0)})},t[2]=o,t[3]=n,t[4]=r,t[5]=u,t[6]=_):_=t[6];let v=_,y=`${g} ${r}`,b=m&&`bg-accent-soft text-accent-fg`,x;t[7]===b?x=t[8]:(x=F(V,`hover:bg-surface-active`,b),t[7]=b,t[8]=x);let S;t[9]===h?S=t[10]:(S=(0,B.jsx)(h,{className:`size-4`,"aria-hidden":!0}),t[9]=h,t[10]=S);let C;t[11]!==x||t[12]!==S?(C=(0,B.jsx)(`span`,{className:x,children:S}),t[11]=x,t[12]=S,t[13]=C):C=t[13];let w;t[14]!==g||t[15]!==v||t[16]!==y||t[17]!==C?(w=(0,B.jsx)(`button`,{type:`button`,"aria-label":y,title:g,onClick:v,className:`absolute start-2 top-1/2 grid size-11 -translate-y-1/2 place-items-center rounded-md focus-visible:outline-2 focus-visible:outline-accent sm:start-3`,children:C}),t[14]=g,t[15]=v,t[16]=y,t[17]=C,t[18]=w):w=t[18];let T;t[19]!==d||t[20]!==i?(T=d?(0,B.jsx)(`span`,{role:`alert`,className:`sr-only`,children:i?`音频暂时无法播放,请重试。`:`Audio could not play. Try again.`}):null,t[19]=d,t[20]=i,t[21]=T):T=t[21];let E;return t[22]!==w||t[23]!==T?(E=(0,B.jsxs)(B.Fragment,{children:[w,T]}),t[22]=w,t[23]=T,t[24]=E):E=t[24],E}var Qe=e=>/\.(xlsx|csv|tsv)$/i.test(e);async function $e(e,t){if(e.size>4*1024*1024)throw Error(`limits`);let n=await e.arrayBuffer(),r=new Worker(new URL(`/assets/space-workbook-import.worker-Bw2gfMG9.js`,``+import.meta.url),{type:`module`});try{return await new Promise((e,i)=>{let a=setTimeout(()=>i(Error(`limits`)),12e3);r.onmessage=t=>{clearTimeout(a),`workbook`in t.data?e(t.data.workbook):i(Error(t.data.error))},r.onerror=()=>{clearTimeout(a),i(Error(`unsupported`))},r.postMessage({bytes:n,fileName:t},[n])})}finally{r.terminate()}}var H=(0,z.lazy)(()=>a(()=>import(`./chat-page-3fVhP77N.js`).then(e=>e.n).then(e=>({default:e.ChatPage})),__vite__mapDeps([4,1,5,6,2,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,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221])));async function et(e,t,n){let r=`xopc.workbook-chat:${m.getState().baseUrl}:${e}`,i=null;try{i=localStorage.getItem(r)??sessionStorage.getItem(r)}catch{}if(i){if(await xe(i))return i;try{return await ye(i),i}catch(e){if(e.status!==404)throw e}}if(t&&t!==i)return t;let a=I(),o=n?ve(n).catch(e=>{if(e.status!==404)throw e}):void 0,[s,c]=await Promise.all([Le(),o]),{agentId:l,projectId:u}=Se({origin:`workbook`,project:c?{kind:`project`,projectId:c.id}:{kind:`none`}},{defaultAgentId:s.defaultId,selectedAgentId:s.items.find(e=>e.id===a.selectedAgentId)?.id,projectDefaultAgentId:s.items.find(e=>e.id===c?.defaultAgentId)?.id}),d=we(a,l),f=await new be().createSession({agentId:l,projectId:u,executionMode:c?.workspaceRoot?.trim()?Ce(a,c.id)??`local_checkout`:void 0,initialAgentConfig:d?{model:d.modelRef,thinkingLevel:d.thinkingLevel}:void 0});try{localStorage.setItem(r,f.key)}catch{}return f.key}function tt({id:e,open:t,zh:n,originId:r,projectId:i,onClose:a,readSelection:o,prepareSendContext:s,onRunSettled:c}){let[l,u]=(0,z.useState)(),[d,f]=(0,z.useState)(),[p,m]=(0,z.useState)(!1),[h,g]=(0,z.useState)(!1),[_,v]=(0,z.useState)(0),y=(0,z.useRef)(void 0),b=(0,z.useRef)(null);(0,z.useEffect)(()=>{let t=!0;return y.current??=et(e,r,i),y.current.then(e=>{t&&u(e)},()=>{t&&g(!0)}),()=>{t=!1}},[_,e,r,i]),(0,z.useEffect)(()=>{t&&b.current?.focus({preventScroll:!0})},[t]);async function x(){m(!0);try{let e=await o();e&&f(ce(e))}finally{m(!1)}}let S=(0,B.jsxs)(`div`,{className:`space-y-3 p-4`,children:[(0,B.jsx)(_e,{className:`h-5 w-1/2`}),(0,B.jsx)(_e,{className:`h-16 w-full rounded-xl`})]});return(0,B.jsxs)(`aside`,{id:`workbook-chat`,"data-workbook-chat":!0,"aria-labelledby":`workbook-chat-heading`,className:F(`file-preview-surface absolute inset-y-0 end-0 z-30 min-h-0 w-[min(26rem,calc(100%-1rem))] shrink-0 flex-col overflow-hidden border-s border-edge shadow-popover @min-[48rem]/space:relative @min-[48rem]/space:w-[clamp(22rem,36%,31rem)] @min-[48rem]/space:shadow-none`,t?`flex`:`hidden`),onKeyDown:e=>{e.key!==`Escape`||e.defaultPrevented||e.nativeEvent.isComposing||(e.preventDefault(),a())},children:[(0,B.jsxs)(`header`,{className:`flex min-h-14 shrink-0 items-center justify-between gap-2 border-b border-edge-subtle px-3 py-2`,children:[(0,B.jsx)(`h2`,{id:`workbook-chat-heading`,ref:b,tabIndex:-1,className:`text-sm font-semibold text-fg outline-none`,children:n?`工作簿对话`:`Workbook chat`}),(0,B.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,B.jsxs)(`button`,{type:`button`,disabled:!l||p,onClick:()=>void x(),className:`inline-flex min-h-9 shrink-0 items-center gap-1.5 rounded-lg px-2 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:[(0,B.jsx)(D,{className:`size-4`,"aria-hidden":!0}),n?`添加选区`:`Add selection`]}),(0,B.jsx)(`button`,{type:`button`,className:`inline-flex size-9 shrink-0 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:ring-2 focus-visible:ring-accent`,onClick:a,"aria-label":n?`收起工作簿对话`:`Close workbook chat`,children:(0,B.jsx)(ge,{className:`size-4`,"aria-hidden":!0})})]})]}),(0,B.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:l?(0,B.jsx)(z.Suspense,{fallback:S,children:(0,B.jsx)(H,{embedded:!0,conversationId:l,prepareSendContext:s,onRunSettled:c,embeddedAttachmentHandoffId:t?d:void 0,composerPlaceholder:n?`提问,或说明想怎么改这份工作簿…`:`Ask a question or describe a change…`})}):h?(0,B.jsxs)(`div`,{role:`alert`,className:`p-4 text-sm text-fg-muted`,children:[(0,B.jsx)(`p`,{children:n?`暂时无法打开对话。`:`Could not open the chat.`}),(0,B.jsx)(`button`,{type:`button`,className:`mt-2 rounded-lg px-2 py-1 text-accent-fg hover:bg-accent-soft`,onClick:()=>{y.current=void 0,g(!1),v(e=>e+1)},children:n?`重试`:`Retry`})]}):S})]})}function U(e){let t=(0,R.c)(4),{items:n}=e,r;t[0]===n?r=t[1]:(r=n.map(nt),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,B.jsx)(`ul`,{className:`space-y-1`,children:r}),t[2]=r,t[3]=i),i}function nt(e){return(0,B.jsxs)(`li`,{className:`grid grid-cols-[minmax(7rem,1fr)_2fr] gap-2 text-xs`,children:[(0,B.jsxs)(`span`,{className:`truncate font-medium`,title:`${e.sheetName}!${e.cell}`,children:[e.sheetName,`!`,e.cell]}),(0,B.jsxs)(`span`,{className:`min-w-0 break-words`,children:[(0,B.jsx)(`span`,{className:`text-fg-muted`,children:e.beforeFormula??String(e.before??`—`)}),(0,B.jsx)(`span`,{"aria-hidden":!0,children:` → `}),e.afterFormula??String(e.after??`—`)]})]},`${e.sheetId}:${e.cell}`)}function rt({id:e,versionId:t,proposalId:n,undo:r,zh:i,onClose:a,onComplete:o}){let[s,c]=(0,z.useState)(!1),[l,u]=(0,z.useState)(``),d=Fe(n?[`workbook-proposal`,e,n]:null,()=>Oe(e,n),{shouldRetryOnError:!1}),f=!!d.data?.appliedVersionId;async function p(){c(!0),u(``);try{d.data?await De(e,{action:`apply`,proposalId:d.data.proposalId}):r&&await De(e,{action:`undo`,versionId:t,sourceVersionId:r}),o()}catch(e){u(e?.status===409?i?`工作簿已有更新,请在最新版本重新检查。`:`The workbook has changed. Review the latest version and try again.`:i?`操作未完成,请重试。`:`Could not complete the action. Try again.`)}finally{c(!1)}}return(0,B.jsxs)(`section`,{"aria-label":i?`工作簿修改`:`Workbook changes`,className:`max-h-[38%] shrink-0 overflow-y-auto border-b border-edge-subtle bg-surface-panel px-4 py-3`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,B.jsx)(`h3`,{className:`me-auto text-sm font-semibold`,children:r?i?`撤销这次修改`:`Undo this change`:f?i?`本次已保存的修改`:`Saved changes`:i?`审阅修改`:`Review changes`}),(0,B.jsx)(`button`,{type:`button`,onClick:a,className:`min-h-8 rounded-lg px-2 text-xs text-fg-muted hover:bg-surface-hover focus-visible:outline-2 focus-visible:outline-accent`,children:i?`关闭`:`Close`}),r||d.data&&!f?(0,B.jsx)(`button`,{type:`button`,onClick:()=>void p(),disabled:s,className:`min-h-8 rounded-lg bg-accent px-2.5 text-xs font-medium text-on-accent hover:bg-accent-hover focus-visible:outline-2 focus-visible:outline-accent disabled:opacity-50`,children:r?i?`撤销修改`:`Undo change`:i?`应用并保存新版本`:`Apply and save a new version`}):null]}),r?(0,B.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:i?`恢复修改前的内容,并保留两个历史版本。`:`Restore the previous contents and keep both versions in history.`}):null,d.isLoading?(0,B.jsx)(_e,{className:`mt-2 h-8`}):null,d.data?(0,B.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[(0,B.jsx)(U,{items:d.data.changes}),d.data.effects.length?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`h4`,{className:`text-xs text-fg-muted`,children:i?`公式重算结果`:`Recalculated results`}),(0,B.jsx)(U,{items:d.data.effects})]}):null]}):null,l||d.error?(0,B.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:l||(i?`该建议已过期或不可用。`:`This proposal has expired or is unavailable.`)}):null]})}var it=(0,z.lazy)(()=>a(()=>import(`./space-workbook-BAwHwK6O.js`),__vite__mapDeps([222,1,6,2,7,11,12,10,77,13,37,66,36,155,8,9,39,69,70,180,163,223]))),at={document:w,pdf:w,spreadsheet:A,presentation:ie,audio:j,archive:_},W=`inline-flex size-9 shrink-0 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,ot=`block w-full rounded-lg px-3 py-2 text-start text-sm hover:bg-surface-hover`,st=`rounded-lg bg-accent px-3 py-2 text-sm font-medium text-on-accent hover:bg-accent-hover disabled:opacity-50`,ct=`grid grid-cols-[minmax(0,1fr)_5rem] items-center gap-3 px-2 sm:px-3 @xl/list:grid-cols-[minmax(0,1fr)_4.5rem_minmax(0,0.55fr)_6.5rem] @xl/list:gap-4`,G=38,K=30,q=72,J=`xopc.space.previewWidth`;function lt(){try{let e=Number(window.localStorage.getItem(J));if(e>=K&&e<=q)return e}catch{}return G}function ut(e){try{window.localStorage.setItem(J,String(e))}catch{}}function dt(e){let t=e.get(`view`);return t===`favorites`||t===`trash`?t:`all`}function ft(e){let t=(0,R.c)(33),{zh:n,width:r,onResize:i}=e,a=(0,z.useRef)(null),[o,s]=(0,z.useState)(!1),c;t[0]===i?c=t[1]:(c=function(e){let t=Math.max(K,Math.min(q,e));return i(t),t},t[0]=i,t[1]=c);let l=c,u=n?`调整资料预览宽度`:`Resize file preview`,d;t[2]===r?d=t[3]:(d=Math.round(r),t[2]=r,t[3]=d);let f=n?`左右拖动调整宽度,双击恢复默认`:`Drag to resize, double-click to reset`,p=o&&`bg-accent-soft/40`,m;t[4]===p?m=t[5]:(m=F(`group absolute inset-y-0 start-0 z-20 hidden w-3 -translate-x-1/2 cursor-col-resize touch-none select-none items-center justify-center rounded-sm focus-visible:outline-2 focus-visible:outline-accent @min-[58rem]/space:flex`,p),t[4]=p,t[5]=m);let h;t[6]===r?h=t[7]:(h=e=>{if(e.button!==0||a.current)return;let t=e.currentTarget,n=t.closest(`[data-space-preview-host]`)?.parentElement?.clientWidth;n&&(e.preventDefault(),t.setPointerCapture(e.pointerId),a.current={id:e.pointerId,startX:e.clientX,startWidth:r,availableWidth:n,currentWidth:r},s(!0))},t[6]=r,t[7]=h);let g;t[8]===l?g=t[9]:(g=e=>{let t=a.current;t?.id===e.pointerId&&(t.currentWidth=l(t.startWidth+(t.startX-e.clientX)*100/t.availableWidth))},t[8]=l,t[9]=g);let _;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>{a.current?.id===e.pointerId&&(ut(a.current.currentWidth),a.current=null,s(!1))},t[10]=_):_=t[10];let v;t[11]===l?v=t[12]:(v=()=>ut(l(G)),t[11]=l,t[12]=v);let y;t[13]!==l||t[14]!==r?(y=e=>{let t={ArrowLeft:r+2,ArrowRight:r-2,Home:K,End:q};Object.hasOwn(t,e.key)&&(e.preventDefault(),ut(l(t[e.key])))},t[13]=l,t[14]=r,t[15]=y):y=t[15];let b=o&&`bg-accent`,x;t[16]===b?x=t[17]:(x=F(`h-10 w-0.5 rounded-full bg-edge group-hover:bg-accent group-focus-visible:bg-accent`,b),t[16]=b,t[17]=x);let S;t[18]===x?S=t[19]:(S=(0,B.jsx)(`span`,{"aria-hidden":!0,className:x}),t[18]=x,t[19]=S);let C;t[20]===o?C=t[21]:(C=o?(0,B.jsx)(`span`,{"aria-hidden":!0,className:`fixed inset-0 z-50 cursor-col-resize`}):null,t[20]=o,t[21]=C);let w;return t[22]!==v||t[23]!==y||t[24]!==S||t[25]!==C||t[26]!==u||t[27]!==d||t[28]!==f||t[29]!==m||t[30]!==h||t[31]!==g?(w=(0,B.jsxs)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":u,"aria-controls":`space-file-preview`,"aria-valuemin":K,"aria-valuemax":q,"aria-valuenow":d,tabIndex:0,title:f,className:m,onPointerDown:h,onPointerMove:g,onLostPointerCapture:_,onDoubleClick:v,onKeyDown:y,children:[S,C]}),t[22]=v,t[23]=y,t[24]=S,t[25]=C,t[26]=u,t[27]=d,t[28]=f,t[29]=m,t[30]=h,t[31]=g,t[32]=w):w=t[32],w}function pt(e){return e?.available?e.kind===`task`&&e.taskId?`/tasks/${encodeURIComponent(e.taskId)}`:e.kind===`automation`&&e.automationRunId?`/automations?view=execution&run=${encodeURIComponent(e.automationRunId)}`:`/chat/${encodeURIComponent(e.conversationId)}`:null}function mt(e){let t=(0,R.c)(20),{text:n,query:r}=e,i,a,o,s,c;if(t[0]!==r||t[1]!==n){c=Symbol.for(`react.early_return_sentinel`);bb0:{let e=r?n.toLowerCase().indexOf(r.toLowerCase()):-1;if(e<0){let e;t[7]===n?e=t[8]:(e=(0,B.jsx)(B.Fragment,{children:n}),t[7]=n,t[8]=e),c=e;break bb0}i=e+r.length,s=e>40?`…${n.slice(e-40,e)}`:n.slice(0,e),a=`rounded-sm bg-accent-soft text-accent-fg`,o=n.slice(e,i)}t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c}else i=t[2],a=t[3],o=t[4],s=t[5],c=t[6];if(c!==Symbol.for(`react.early_return_sentinel`))return c;let l;t[9]!==a||t[10]!==o?(l=(0,B.jsx)(`mark`,{className:a,children:o}),t[9]=a,t[10]=o,t[11]=l):l=t[11];let u;t[12]!==i||t[13]!==n?(u=n.slice(i,i+100),t[12]=i,t[13]=n,t[14]=u):u=t[14];let d=i+100<n.length?`…`:``,f;return t[15]!==s||t[16]!==l||t[17]!==u||t[18]!==d?(f=(0,B.jsxs)(B.Fragment,{children:[s,l,u,d]}),t[15]=s,t[16]=l,t[17]=u,t[18]=d,t[19]=f):f=t[19],f}function ht(e){let t=(0,R.c)(22),{zh:n}=e,[r,i]=o(),a=u(),s=(0,z.useRef)(null),c;t[0]===r?c=t[1]:(c=(r.get(`q`)??``).slice(0,160),t[0]=r,t[1]=c);let l=c,d=n?`搜索资料`:`Search files`,f,p;t[2]!==a||t[3]!==l?(f=()=>{let e=s.current;e&&(document.activeElement!==e||a===`POP`)&&(e.value=l)},p=[a,l],t[2]=a,t[3]=l,t[4]=f,t[5]=p):(f=t[4],p=t[5]),(0,z.useLayoutEffect)(f,p);let m;t[6]===i?m=t[7]:(m=function(e){i(t=>{let n=new URLSearchParams(t);return e?n.set(`q`,e):n.delete(`q`),n},{replace:!0})},t[6]=i,t[7]=m);let h=m,g;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,B.jsx)(oe,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),t[8]=g):g=t[8];let _;t[9]===h?_=t[10]:(_=e=>h(e.target.value),t[9]=h,t[10]=_);let v;t[11]!==d||t[12]!==l||t[13]!==_?(v=(0,B.jsx)(`input`,{ref:s,defaultValue:l,maxLength:160,onChange:_,"aria-label":d,placeholder:d,className:`min-w-0 flex-1 bg-transparent text-sm text-fg outline-none`}),t[11]=d,t[12]=l,t[13]=_,t[14]=v):v=t[14];let y;t[15]!==h||t[16]!==l||t[17]!==n?(y=l?(0,B.jsx)(`button`,{type:`button`,className:F(W,`size-6`),onClick:()=>{h(``),s.current&&(s.current.value=``,s.current.focus())},"aria-label":n?`清除搜索`:`Clear search`,children:(0,B.jsx)(ge,{className:`size-4`})}):null,t[15]=h,t[16]=l,t[17]=n,t[18]=y):y=t[18];let b;return t[19]!==v||t[20]!==y?(b=(0,B.jsxs)(`div`,{role:`search`,className:`flex h-9 min-w-0 flex-1 items-center gap-2 rounded-lg border border-edge-subtle bg-surface-inset px-2.5 focus-within:ring-2 focus-within:ring-accent @min-[40rem]/space-list:w-[clamp(7rem,24cqw,18rem)]`,children:[g,v,y]}),t[19]=v,t[20]=y,t[21]=b):b=t[21],b}function gt(e){let t=(0,R.c)(44),{zh:n}=e,[r,i]=o(),a=n?`文档`:`Documents`,s;t[0]===a?s=t[1]:(s=[`document`,a],t[0]=a,t[1]=s);let c=n?`表格`:`Spreadsheets`,l;t[2]===c?l=t[3]:(l=[`spreadsheet`,c],t[2]=c,t[3]=l);let u=n?`演示`:`Slides`,d;t[4]===u?d=t[5]:(d=[`presentation`,u],t[4]=u,t[5]=d);let f=n?`图片`:`Images`,p;t[6]===f?p=t[7]:(p=[`image`,f],t[6]=f,t[7]=p);let m=n?`音频`:`Audio`,h;t[8]===m?h=t[9]:(h=[`audio`,m],t[8]=m,t[9]=h);let g=n?`视频`:`Video`,_;t[10]===g?_=t[11]:(_=[`video`,g],t[10]=g,t[11]=_);let v=n?`压缩包`:`Archives`,y;t[12]===v?y=t[13]:(y=[`archive`,v],t[12]=v,t[13]=y);let S=n?`文件`:`Files`,C;t[14]===S?C=t[15]:(C=[`file`,S],t[14]=S,t[15]=C);let w;t[16]!==h||t[17]!==_||t[18]!==y||t[19]!==C||t[20]!==s||t[21]!==l||t[22]!==d||t[23]!==p?(w=[s,l,d,p,h,_,y,C],t[16]=h,t[17]=_,t[18]=y,t[19]=C,t[20]=s,t[21]=l,t[22]=d,t[23]=p,t[24]=w):w=t[24];let T=w,E;t[25]===n?E=t[26]:(E=(0,B.jsx)(ht,{zh:n}),t[25]=n,t[26]=E);let D;t[27]===r?D=t[28]:(D=r.get(`kind`)??`all`,t[27]=r,t[28]=D);let O=n?`资料类型`:`File type`,k;t[29]===i?k=t[30]:(k=e=>i(t=>{let n=new URLSearchParams(t);return e.target.value===`all`?n.delete(`kind`):n.set(`kind`,e.target.value),n}),t[29]=i,t[30]=k);let ee=n?`全部类型`:`All types`,A;t[31]===ee?A=t[32]:(A=(0,B.jsx)(x,{value:`all`,children:ee}),t[31]=ee,t[32]=A);let j;t[33]===T?j=t[34]:(j=T.map(Y),t[33]=T,t[34]=j);let M;t[35]!==D||t[36]!==O||t[37]!==k||t[38]!==A||t[39]!==j?(M=(0,B.jsxs)(b,{value:D,align:`end`,"aria-label":O,triggerClassName:`h-9 shrink-0`,onChange:k,children:[A,j]}),t[35]=D,t[36]=O,t[37]=k,t[38]=A,t[39]=j,t[40]=M):M=t[40];let N;return t[41]!==E||t[42]!==M?(N=(0,B.jsxs)(`div`,{className:`flex w-full min-w-0 items-center gap-2`,children:[E,M]}),t[41]=E,t[42]=M,t[43]=N):N=t[43],N}function Y(e){let[t,n]=e;return(0,B.jsx)(x,{value:t,children:n},t)}function _t(e){let t=(0,R.c)(25),{zh:n,onViewChange:r}=e,[i,a]=o(),s=n?`全部资料`:`All files`,c;t[0]===s?c=t[1]:(c={id:`all`,label:s,icon:O},t[0]=s,t[1]=c);let l=n?`收藏`:`Favorites`,u;t[2]===l?u=t[3]:(u={id:`favorites`,label:l,icon:k},t[2]=l,t[3]=u);let d=n?`回收站`:`Trash`,f;t[4]===d?f=t[5]:(f={id:`trash`,label:d,icon:pe},t[4]=d,t[5]=f);let p;t[6]!==c||t[7]!==u||t[8]!==f?(p=[c,u,f],t[6]=c,t[7]=u,t[8]=f,t[9]=p):p=t[9];let m=p,h;t[10]!==r||t[11]!==a?(h=function(e){r(),a(t=>{let n=new URLSearchParams(t);for(let e of[`view`,`item`,`version`,`q`,`kind`])n.delete(e);return e!==`all`&&n.set(`view`,e),n})},t[10]=r,t[11]=a,t[12]=h):h=t[12];let g=h,_=n?`资料库`:`Space`,v;t[13]===_?v=t[14]:(v=(0,B.jsx)(`h1`,{className:`sr-only`,children:_}),t[13]=_,t[14]=v);let y;t[15]===i?y=t[16]:(y=dt(i),t[15]=i,t[16]=y);let b=n?`资料范围`:`Library views`,x;t[17]!==g||t[18]!==m||t[19]!==y||t[20]!==b?(x=(0,B.jsx)(Ue,{items:m,activeTab:y,onChange:g,ariaLabel:b,tabIdPrefix:`space-tab`,panelIdPrefix:`space-list`,className:`pb-0 [scrollbar-width:none]`,buttonClassName:`h-9 py-1.5`,scrollActiveIntoView:!0}),t[17]=g,t[18]=m,t[19]=y,t[20]=b,t[21]=x):x=t[21];let S;return t[22]!==v||t[23]!==x?(S=(0,B.jsxs)(`div`,{className:`min-w-0`,children:[v,x]}),t[22]=v,t[23]=x,t[24]=S):S=t[24],S}function X(){let e=Ge(),t=h(e=>e.language)===`zh`,n=We(e=>e.setPageHeader),r=We(e=>e.clearPageHeader),i=c(),u=s(),[m,_]=o(),C=l(),w=m.get(`version`),T=m.get(`sheet`)??void 0,E=m.get(`range`)??void 0,D=m.get(`proposal`)??void 0,O=m.get(`undo`)??void 0,[ee,A]=(0,z.useState)(lt),[j,M]=(0,z.useState)(!1),[N,ne]=(0,z.useState)(!1),[P,ie]=(0,z.useState)(!1),[ae,oe]=(0,z.useState)(``),[le,ue]=(0,z.useState)(),[de,fe]=(0,z.useState)(),[pe,ve]=(0,z.useState)(),[ye,be]=(0,z.useState)(),xe=(0,z.useRef)(new Map),Se=(0,z.useRef)(null),Ce=(0,z.useRef)(null),we=(0,z.useRef)(null),I=(0,z.useRef)(null),De=(0,z.useRef)(null),Oe=(0,z.useRef)(null),Le=(0,z.useRef)(null),L=dt(m),Ue=(m.get(`q`)??``).slice(0,160),R=(0,z.useDeferredValue)(Ue),V=m.get(`item`),Ye=(0,z.useRef)(V);(0,z.useLayoutEffect)(()=>{Ye.current!==V&&(Ye.current=V,ue(void 0),fe(void 0),ve(void 0))},[V]);let H=f(({currentLocation:e,nextLocation:t})=>{if(!I.current?.hasChanges())return!1;if(e.pathname!==t.pathname)return!0;let n=new URLSearchParams(e.search),r=new URLSearchParams(t.search);return n.get(`item`)===r.get(`item`)?!r.has(`version`)&&vt?!1:n.get(`version`)!==r.get(`version`):!0});(0,z.useEffect)(()=>{if(H.state!==`blocked`)return;let e=!0;return(async()=>{let t=I.current,n=await t?.flushSave();e&&(!t||n?H.proceed():H.reset())})(),()=>{e=!1}},[H]);let et=m.get(`kind`),U=m.get(`taskId`)?`taskId`:m.get(`projectId`)?`projectId`:void 0,nt=(0,z.useCallback)(()=>{be(void 0),oe(``),M(!1),ne(!1)},[]);(0,z.useLayoutEffect)(()=>(n({startExtra:null,main:(0,B.jsx)(_t,{zh:t,onViewChange:nt}),end:(0,B.jsx)(gt,{zh:t}),className:`@max-[40rem]/space-list:h-auto @max-[40rem]/space-list:min-h-14 @max-[40rem]/space-list:gap-y-2 @max-[40rem]/space-list:py-2 @max-[40rem]/space-list:[&>:last-child]:col-span-full`}),r),[r,nt,n,t]),(0,z.useLayoutEffect)(()=>{Oe.current&&(Oe.current.scrollTop=0)},[L]);let G=Ie((e,t)=>{if(e&&!t?.nextCursor)return null;let n=new URLSearchParams({view:L,q:R});return et&&n.set(`kind`,et),U&&n.set(U,m.get(U)),e&&t?.nextCursor&&n.set(`cursor`,t.nextCursor),`${Ee}?${n}`},Me,{refreshInterval:4e3}),K=Fe(V?Pe(V):null,Ae,{refreshInterval:e=>e?.currentVersion.mimeType===`application/vnd.xopc.univer-workbook+json`?0:4e3,revalidateOnFocus:!1}),q=G.data?.flatMap(e=>e.items)??[],J=K.data,ut=!!(w&&(T||D||O)),ht=J&&le?.itemId===J.id&&le.versions.includes(J.currentVersion.id)?le:void 0,Y=ht?.locationKey===u.key?J?.currentVersion:J?.versions.find(e=>e.id===w)??(ut?void 0:J?.currentVersion),X=Y?.mimeType===je,vt=X&&Y.id===J?.currentVersion.id,yt=vt&&ht?ht.seed:Y?.id;(0,z.useEffect)(()=>{if(H.state!==`unblocked`||!w||w===Y?.id||ht?.locationKey!==u.key)return;let e=new URLSearchParams(m);e.delete(`version`),_(e,{replace:!0})},[u.key,H.state,ht,m,w,_,Y?.id]);let bt=Y?.id===J?.currentVersion.id?q.find(e=>e.id===V)?.hit:void 0,Z=J?.origins.find(e=>e.versionId===Y?.id&&e.available)??J?.origins.find(e=>e.available)??J?.origin,xt=pt(Z),St=Z?.projectId??J?.origins.find(e=>e.projectId)?.projectId,Ct=de?.itemId===J?.id&&!!de?.open,wt=pe?.itemId===J?.id&&pe?.versionId!==J?.currentVersion.id,Tt=!!(J&&w&&!J.versions.some(e=>e.id===w)),Et=K.mutate,Dt=(0,z.useCallback)(()=>I.current?.prepareChatContext()??Promise.resolve(null),[]),Ot=(0,z.useCallback)(async()=>I.current?.readSelection(),[]),kt=(0,z.useCallback)((e,t)=>{if(Ye.current===e.id)return Et(n=>!n||n.revision>e.revision?n:n.currentVersion.id!==e.currentVersion.id&&e.currentVersion.id!==t&&I.current?.hasChanges()?(ve({itemId:e.id,versionId:e.currentVersion.id}),{...n,title:e.title,favorite:e.favorite,revision:e.revision}):(ve(void 0),e),{revalidate:!1})},[Et]),At=(0,z.useCallback)(async()=>{V&&(await kt(await Ae(Pe(V))),G.mutate())},[kt,G.mutate,V]),jt=(0,z.useCallback)(()=>{At().catch(()=>{})},[At]);(0,z.useEffect)(()=>{Tt&&At().catch(()=>{})},[Tt,At,w]);function Mt(){fe(e=>e&&{...e,open:!1}),requestAnimationFrame(()=>we.current?.focus({preventScroll:!0}))}function Q(e){_(t=>{let n=new URLSearchParams(t);for(let[t,r]of Object.entries(e))r?n.set(t,r):n.delete(t);return n})}function Nt(e){M(!1),ne(!1),oe(``),Q({item:e,version:null,sheet:null,range:null,proposal:null,undo:null})}function Pt(){Nt(null),V&&requestAnimationFrame(()=>xe.current.get(V)?.focus())}(0,z.useLayoutEffect)(()=>{V&&De.current&&getComputedStyle(De.current).visibility===`hidden`&&Se.current?.focus({preventScroll:!0})},[C,V]),(0,z.useEffect)(()=>{if(!V)return;let e=e=>{if(!(e.key!==`Escape`||e.defaultPrevented)&&!(e.target instanceof Element&&e.target.closest(`[data-space-workbook], [data-workbook-chat]`))){if(j||N){M(!1),ne(!1);return}_(e=>{let t=new URLSearchParams(e);return t.delete(`item`),t.delete(`version`),t}),requestAnimationFrame(()=>xe.current.get(V)?.focus())}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[N,j,V,_]);function Ft(e,t){if(e.key!==`ArrowUp`&&e.key!==`ArrowDown`)return;e.preventDefault();let n=q[t+(e.key===`ArrowDown`?1:-1)];n&&xe.current.get(n.id)?.focus()}async function It(e){if(!P){ie(!0),oe(``);try{await e()}catch{oe(t?`操作未完成,请重试`:`Could not complete the action. Try again.`),X?At().catch(()=>{}):K.mutate()}finally{ie(!1)}}}function $(e,t,n,r){return It(async()=>{let i=Pe(t.id),a=e===`restore`||e===`purge`?`/${e}`:``,o=t.revision,s=I.current;if(s&&vt&&V===t.id&&(e===`patch`||e===`trash`)){let e=await s.flushSave();if(!e)return;e!==Y.id&&(o=(await Ae(i)).revision)}let c=await g(p(i+a),{method:e===`patch`?`PATCH`:e===`trash`?`DELETE`:`POST`,body:JSON.stringify({revision:o,...n})});e===`trash`&&be({id:t.id,revision:o+1}),(e===`restore`||e===`purge`)&&be(void 0),e===`patch`?Ye.current===t.id&&(M(!1),X?(await kt(c),r?.()):await K.mutate()):V===t.id&&Nt(null),await G.mutate()})}async function Lt(){!J||!Y||await It(async()=>{let e=I.current,t=vt&&e?await e.flushSave():Y.id;if(!t)return;let n=await Te(J.id,t),r=X?`${J.title.replace(/[\\/\x00-\x1f]/g,`_`)}.xlsx`:Y.fileName,i=X?new Blob([await a(()=>import(`./space-workbook-format-D1PqIvbd.js`).then(e=>n.text().then(t=>e.writeWorkbook(JSON.parse(t)))),__vite__mapDeps([224,225]))],{type:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`}):n,o=URL.createObjectURL(i),s=document.createElement(`a`);s.href=o,s.download=r,s.click(),setTimeout(()=>URL.revokeObjectURL(o),1e3)})}function Rt(){!J||!Y||It(async()=>{let e=await Te(J.id,Y.id);if(e.size>33554432)throw Error(`Attachment too large`);let t=new globalThis.File([e],Y.fileName,{type:Y.mimeType}),n=new URLSearchParams({attachmentHandoff:ce(t)});Z?.projectId&&Z.available&&n.set(`projectId`,Z.projectId),i({pathname:`/chat/new`,search:`?${n}`},{state:{forceNewChat:!0}})})}function zt(e){M(!1),Q({item:e,version:null,sheet:null,range:null,proposal:null,undo:null,view:null,q:null,kind:null,projectId:null,taskId:null}),G.mutate()}function Bt(){It(async()=>{let e=t?`未命名工作簿`:`Untitled workbook`,{blankWorkbook:n}=await a(async()=>{let{blankWorkbook:e}=await import(`./space-workbook-format-D1PqIvbd.js`);return{blankWorkbook:e}},__vite__mapDeps([224,225])),{id:r}=await Ne(crypto.randomUUID(),e,n(e,t?`工作表 1`:`Sheet 1`));zt(r)})}function Vt(e,n,r){It(async()=>{try{let i=await $e(await n(),e),a=i.name||(t?`导入的工作簿`:`Imported workbook`),{id:o}=await Ne(crypto.randomUUID(),a,i,r);zt(o)}catch(e){let n=e instanceof Error?e.message:``;oe(n===`limits`||e?.status===413?t?`表格过大。可先拆分数据,再分别导入。`:`This workbook is too large. Split the data into smaller files and try again.`:n===`array-formula`||n===`linked-formula`?t?`这份表格包含暂不支持转换的公式,可以继续预览原文件。`:`This workbook contains formulas that cannot be converted. You can still preview the original.`:t?`无法导入表格,请检查文件后重试。`:`Could not import this workbook. Check the file and try again.`)}})}function Ht(e){if(e.preventDefault(),!J)return;let t=String(new FormData(e.currentTarget).get(`title`)??``).trim();t&&(t===J.title?Wt():$(`patch`,J,{title:t}))}function Ut(){requestAnimationFrame(()=>{document.activeElement===document.body&&Ce.current?.focus({preventScroll:!0})})}function Wt(e=!0){M(!1),X&&e&&Ut()}function Gt(e,t){if(!J||P)return;let n=e.trim();!n||n===J.title?Wt(t):$(`patch`,J,{title:n},t?Ut:void 0)}let Kt=new Intl.DateTimeFormat(t?`zh-CN`:`en`,{month:`short`,day:`numeric`}),qt=e=>Kt.format(e),Jt=J&&Y&&J.versions.length>1?(0,B.jsx)(b,{value:Y.id,"aria-label":t?X?`工作簿版本`:`资料版本`:X?`Workbook version`:`File version`,className:X?`max-w-32 shrink-0`:void 0,triggerClassName:X?`h-8 px-2 text-xs`:void 0,onChange:e=>{let t=e.target.value;t!==Y.id&&Q({version:t===J.currentVersion.id?null:t,sheet:null,range:null,proposal:null,undo:null})},children:J.versions.map((e,n)=>(0,B.jsxs)(x,{value:e.id,children:[e.id===J.currentVersion.id?t?`最新版`:`Latest`:qt(e.createdAt),` · v`,J.versions.length-n]},e.id))}):null,Yt=e=>e.origin?.label??(e.origin?.kind===`task`?t?`任务`:`Task`:e.origin?.kind===`automation`?t?`定时任务`:`Automation`:t?`对话`:`Chat`),Xt=ae||ye?(0,B.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-t border-edge-subtle bg-surface-panel px-3 py-2 text-sm`,role:`status`,children:[(0,B.jsx)(`span`,{children:ae||(t?`已移到回收站`:`Moved to Trash`)}),ye?(0,B.jsx)(`button`,{type:`button`,disabled:P,className:`rounded-lg p-1 text-accent-fg`,onClick:()=>void $(`restore`,ye),children:t?`撤销`:`Undo`}):null]}):null;return(0,B.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col overflow-hidden`,children:[(0,B.jsx)(`div`,{className:`mx-auto flex w-full max-w-[74rem] min-h-0 flex-1 px-3 pt-3 sm:px-5 sm:pt-5 @min-[58rem]/space:px-6`,children:(0,B.jsxs)(`section`,{ref:De,id:`space-list-${L}`,role:`tabpanel`,"aria-labelledby":`space-tab-${L}`,className:`@container/list flex min-w-0 flex-1 flex-col`,children:[L===`all`&&!U&&(!et||et===`spreadsheet`)?(0,B.jsxs)(`div`,{className:`mb-3 flex shrink-0 flex-wrap justify-end gap-2`,children:[(0,B.jsx)(`input`,{ref:Le,type:`file`,className:`hidden`,accept:`.xlsx,.csv,.tsv`,onChange:e=>{let t=e.currentTarget.files?.[0];e.currentTarget.value=``,t&&Vt(t.name,async()=>t)}}),(0,B.jsxs)(`button`,{type:`button`,disabled:P,onClick:()=>Le.current?.click(),title:t?`导入 XLSX、CSV 或 TSV 的数据、公式与基础布局`:`Import data, formulas and basic layout from XLSX, CSV or TSV`,className:`inline-flex min-h-10 items-center gap-2 rounded-lg px-3 text-sm text-fg-muted hover:bg-surface-hover focus-visible:outline-2 focus-visible:outline-accent disabled:opacity-50`,children:[(0,B.jsx)(me,{className:`size-4`,"aria-hidden":!0}),t?`导入表格`:`Import workbook`]}),(0,B.jsxs)(`button`,{type:`button`,disabled:P,onClick:Bt,className:F(st,`inline-flex min-h-10 items-center gap-2 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent`),children:[(0,B.jsx)(re,{className:`size-4`,"aria-hidden":!0}),t?`新建表格`:`New workbook`]})]}):null,U?(0,B.jsx)(`div`,{className:`mb-3 flex shrink-0 justify-end`,children:(0,B.jsxs)(`button`,{type:`button`,onClick:()=>Q({[U]:null}),className:`inline-flex min-h-9 items-center gap-1 rounded-lg bg-surface-inset px-2 py-1 text-sm text-fg-muted hover:bg-surface-hover`,children:[U===`projectId`?t?`当前项目`:`Project`:t?`当前任务`:`Task`,(0,B.jsx)(ge,{className:`size-3.5`})]})}):null,(0,B.jsxs)(`div`,{ref:Oe,className:`min-h-0 flex-1 overflow-y-auto pb-5`,children:[G.isLoading?(0,B.jsx)(`div`,{className:`space-y-2`,"aria-busy":`true`,children:Array.from({length:5},(e,t)=>(0,B.jsx)(_e,{className:`h-14 w-full rounded-xl`},t))}):null,G.error?(0,B.jsx)(`button`,{className:`rounded-lg py-3 text-sm text-accent-fg`,onClick:()=>void G.mutate(),children:t?`加载失败,重试`:`Could not load. Retry`}):null,!G.isLoading&&!G.error&&q.length===0?(0,B.jsx)(`p`,{className:`py-10 text-center text-sm text-fg-muted`,children:Ue?t?`没有匹配的资料`:`No matching results`:L===`favorites`?t?`暂无收藏`:`No favorites`:L===`trash`?t?`回收站为空`:`Trash is empty`:t?`暂无资料`:`No results yet`}):null,q.length>0?(0,B.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-edge-subtle`,children:[(0,B.jsxs)(`div`,{className:F(ct,`min-h-10 border-b border-edge-subtle bg-surface-inset text-xs font-medium text-fg-muted`),children:[(0,B.jsx)(`span`,{children:t?`名称`:`Name`}),(0,B.jsx)(`span`,{className:`hidden @xl/list:block`,children:t?`格式`:`Format`}),(0,B.jsx)(`span`,{className:`hidden @xl/list:block`,children:t?`来源`:`Source`}),(0,B.jsx)(`span`,{className:`min-w-[5rem] text-end`,children:t?`更新日期`:`Updated`})]}),(0,B.jsx)(`ul`,{className:`divide-y divide-edge-subtle`,children:q.map((e,n)=>{let r=at[e.kind],i=e.currentVersion,a=i.mimeType===`application/vnd.xopc.univer-workbook+json`?`XLSX`:/\.([a-z\d]{1,12})$/i.exec(i.fileName)?.[1]?.toUpperCase(),o=ke(e.id,i.id),s=e.kind===`audio`&&L!==`trash`,c=e.origin?Yt(e):null;return(0,B.jsxs)(`li`,{className:`relative [contain-intrinsic-size:auto_55px] [content-visibility:auto]`,children:[(0,B.jsxs)(`button`,{type:`button`,title:e.title,ref:t=>{t?xe.current.set(e.id,t):xe.current.delete(e.id)},onKeyDown:e=>Ft(e,n),"aria-pressed":V===e.id,onClick:()=>Nt(e.id),className:F(ct,`min-h-[54px] w-full py-1.5 text-start focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-accent`,V===e.id?`bg-accent-soft`:`hover:bg-surface-hover`),children:[(0,B.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2.5 sm:gap-3`,children:[s?(0,B.jsx)(`span`,{className:`w-11 shrink-0`,"aria-hidden":!0}):e.kind===`image`||e.kind===`video`?(0,B.jsx)(Je,{kind:e.kind,src:o},i.id):(0,B.jsx)(Xe,{icon:r}),(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:(0,B.jsx)(mt,{text:e.title,query:R.trim()})}),a||c?(0,B.jsxs)(`span`,{className:`block truncate text-xs text-fg-muted @xl/list:hidden`,children:[a,a&&c?` · `:null,c]}):null,e.hit?(0,B.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:(0,B.jsx)(mt,{text:e.hit.text,query:R.trim()})}):null]})]}),(0,B.jsx)(`span`,{className:`hidden @xl/list:block`,children:a?(0,B.jsx)(`span`,{className:`inline-block max-w-full truncate rounded bg-surface-inset px-1.5 py-0.5 align-middle text-xs font-medium text-fg-muted`,children:a}):(0,B.jsx)(`span`,{className:`text-xs text-fg-muted`,children:`—`})}),(0,B.jsx)(`span`,{className:`hidden truncate text-sm text-fg-muted @xl/list:block`,children:c??`—`}),(0,B.jsx)(`time`,{className:`min-w-[5rem] text-end text-xs whitespace-nowrap tabular-nums text-fg-muted`,children:qt(e.updatedAt)})]}),s?(0,B.jsx)(Ze,{src:o,title:e.title,zh:t},i.id):null]},e.id)})})]}):null,G.data?.at(-1)?.nextCursor?(0,B.jsx)(`button`,{className:`mt-3 rounded-lg py-2 text-sm text-accent-fg`,onClick:()=>void G.setSize(G.size+1),children:t?`加载更多`:`Load more`}):null]})]})}),V&&C?(0,Ke.createPortal)((0,B.jsxs)(`section`,{id:`space-file-preview`,"aria-label":X?t?`工作簿编辑器`:`Workbook editor`:t?`资料预览`:`File preview`,style:{"--space-preview-width":`${ee}%`},"data-space-workbook-surface":X?``:void 0,className:F(`file-preview-surface absolute inset-0 z-40 flex min-h-0 min-w-0`,!X&&`@min-[58rem]/space:relative @min-[58rem]/space:inset-auto @min-[58rem]/space:w-[var(--space-preview-width)] @min-[58rem]/space:shrink-0 @min-[58rem]/space:border-s @min-[58rem]/space:border-edge-subtle`),children:[X?null:(0,B.jsx)(ft,{zh:t,width:ee,onResize:A}),(0,B.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[(0,B.jsxs)(`header`,{className:`flex min-h-14 shrink-0 items-center gap-1 border-b border-edge-subtle px-3 py-2`,children:[(0,B.jsx)(`button`,{type:`button`,className:F(W,!X&&`@min-[58rem]/space:hidden`),onClick:Pt,"aria-label":t?`返回资料库`:`Back to library`,children:(0,B.jsx)(y,{className:`size-4`})}),X&&j&&J?(0,B.jsx)(`input`,{defaultValue:J.title,maxLength:240,autoFocus:!0,readOnly:P,onFocus:e=>e.currentTarget.select(),onBlur:e=>Gt(e.currentTarget.value,!1),onKeyDown:e=>{e.key!==`Enter`&&e.key!==`Escape`||(e.stopPropagation(),!(P||e.nativeEvent.isComposing||e.keyCode===229)&&(e.preventDefault(),e.key===`Enter`?Gt(e.currentTarget.value,!0):Wt()))},"aria-label":t?`工作簿名称`:`Workbook name`,className:`h-9 min-w-0 flex-1 rounded-lg border border-edge bg-surface-inset px-2 text-sm font-semibold text-fg outline-none focus:border-accent`},J.id):(0,B.jsx)(`h2`,{ref:Se,tabIndex:-1,className:`min-w-0 flex-1 text-sm leading-5 font-semibold wrap-anywhere text-fg`,children:X&&J&&!J.trashedAt?(0,B.jsx)(`button`,{type:`button`,ref:Ce,title:t?`重命名工作簿`:`Rename workbook`,disabled:P,className:`block min-h-9 max-w-full truncate rounded-lg px-2 text-start hover:bg-surface-hover focus-visible:outline-2 focus-visible:outline-accent`,onClick:()=>M(!0),children:J.title}):J?.title??(t?`预览`:`Preview`)}),X?Jt:null,J&&!J.trashedAt?(0,B.jsxs)(B.Fragment,{children:[X?(0,B.jsxs)(`button`,{type:`button`,ref:we,className:F(W,`w-auto gap-1.5 px-2`,Ct&&`bg-accent-soft text-accent-fg`),"aria-expanded":Ct,"aria-controls":de?.itemId===J.id?`workbook-chat`:void 0,"aria-label":t?`工作簿对话`:`Workbook chat`,onClick:()=>Ct?Mt():fe({itemId:J.id,open:!0}),children:[(0,B.jsx)(te,{className:`size-4`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`hidden whitespace-nowrap @min-[34rem]/space:inline`,children:t?`工作簿对话`:`Workbook chat`})]}):null,(0,B.jsx)(`button`,{type:`button`,className:F(W,J.favorite&&`text-accent-fg`),"aria-pressed":J.favorite,"aria-label":t?`收藏`:`Favorite`,disabled:P,onClick:()=>void $(`patch`,J,{favorite:!J.favorite}),children:(0,B.jsx)(k,{className:F(`size-4`,J.favorite&&`fill-current`)})}),Y&&/^(?:audio|video)\//i.test(Y.mimeType)?(0,B.jsx)(`button`,{type:`button`,className:W,disabled:P,"aria-label":t?`分享链接`:`Share link`,onClick:()=>e.createShareLink({spaceVersion:{itemId:J.id,versionId:Y.id},fileName:Y.fileName}),children:(0,B.jsx)(se,{className:`size-4`})}):null,(0,B.jsx)(`button`,{type:`button`,className:W,disabled:P,"aria-label":X?t?`下载此版本为 Excel`:`Download this version as Excel`:t?`下载`:`Download`,onClick:()=>void Lt(),children:(0,B.jsx)(v,{className:`size-4`})}),(0,B.jsxs)(Be,{children:[(0,B.jsx)(He,{className:W,"aria-label":t?`更多操作`:`More actions`,children:(0,B.jsx)(S,{className:`size-4`})}),(0,B.jsx)(Re,{children:(0,B.jsxs)(ze,{align:`end`,sideOffset:5,className:`z-50 min-w-36 rounded-xl border border-edge bg-surface-overlay p-1 shadow-popover`,onCloseAutoFocus:e=>{X&&j&&e.preventDefault()},children:[(0,B.jsx)(Ve,{className:ot,onClick:()=>M(!0),children:t?`重命名`:`Rename`}),(0,B.jsx)(Ve,{className:F(ot,`text-red-600 dark:text-red-400`),disabled:P,onClick:()=>void $(`trash`,J),children:t?`移到回收站`:`Move to Trash`})]})})]})]}):null,X?null:(0,B.jsx)(`button`,{type:`button`,className:F(W,`hidden @min-[58rem]/space:inline-flex`),onClick:Pt,"aria-label":t?`关闭预览`:`Close preview`,children:(0,B.jsx)(ge,{className:`size-4`})})]}),!X&&j&&J?(0,B.jsxs)(`form`,{className:`flex shrink-0 flex-wrap items-center gap-2 px-3 py-2`,onSubmit:Ht,children:[(0,B.jsx)(`input`,{name:`title`,defaultValue:J.title,required:!0,maxLength:240,autoFocus:!0,"aria-label":t?`资料名称`:`Result name`,className:`min-w-24 flex-1 rounded-lg border border-edge bg-surface-panel px-2 py-2 text-sm`}),(0,B.jsx)(`button`,{className:st,disabled:P,children:t?`保存`:`Save`}),(0,B.jsx)(`button`,{type:`button`,className:`rounded-lg p-2 text-sm hover:bg-surface-hover`,onClick:()=>M(!1),children:t?`取消`:`Cancel`})]}):null,K.isLoading?(0,B.jsx)(_e,{className:`m-3 min-h-0 flex-1 rounded-xl`}):null,K.error?(0,B.jsx)(`p`,{className:`px-3 py-5 text-sm text-fg-muted`,children:t?`资料暂不可用`:`Result unavailable`}):null,J&&ut&&!Y?(0,B.jsxs)(`p`,{role:`status`,className:`px-3 py-5 text-sm text-fg-muted`,children:[t?`引用的工作簿版本已不可用。`:`The referenced workbook version is unavailable.`,(0,B.jsx)(`button`,{type:`button`,className:`ms-2 text-accent-fg`,onClick:()=>Q({version:null,sheet:null,range:null,proposal:null,undo:null}),children:t?`打开最新版本`:`Open latest version`})]}):null,J&&Y?(0,B.jsxs)(B.Fragment,{children:[X&&(D||O)&&!J.trashedAt?(0,B.jsx)(rt,{id:J.id,versionId:Y.id,proposalId:D,undo:O,zh:t,onClose:()=>Q({proposal:null,undo:null}),onComplete:()=>{K.mutate(),G.mutate(),Q({version:null,proposal:null,undo:null})}},`${D??``}:${O??``}`):null,X?(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(_e,{className:`m-3 min-h-0 flex-1 rounded-xl`}),children:(0,B.jsx)(it,{id:J.id,versionId:Y.id,title:J.title,zh:t,editable:!J.trashedAt&&vt,controls:I,targetSheet:T,targetRange:E,newerVersionPending:wt,onCopy:zt,onSaved:e=>{ue(t=>({itemId:J.id,seed:yt,locationKey:u.key,versions:[...new Set([...t?.seed&&t.seed===yt?t.versions:[Y.id],e])]})),Ae(Pe(J.id)).then(t=>kt(t,e)).catch(()=>{}),G.mutate()}},`${vt?`latest`:`history`}:${yt}`)}):(0,B.jsx)(qe,{itemId:J.id,version:Y,hit:bt,download:Lt},Y.id),!X||bt||xt||J.trashedAt||Y.indexStatus===`pending`?(0,B.jsxs)(`div`,{className:`max-h-[45%] shrink-0 space-y-2 overflow-y-auto border-t border-edge-subtle px-3 py-2`,children:[bt?(0,B.jsx)(`p`,{className:`line-clamp-2 text-xs text-fg-muted`,children:(0,B.jsx)(mt,{text:bt.text,query:R.trim()})}):null,(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 text-xs text-fg-muted`,children:[(0,B.jsx)(`span`,{children:Z?Yt(J):null}),Y.indexStatus===`pending`?(0,B.jsx)(`span`,{children:t?`正在索引`:`Indexing`}):null,X?null:Jt]}),(0,B.jsx)(`footer`,{className:`flex flex-wrap items-center justify-between gap-2`,children:J.trashedAt?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`button`,{type:`button`,className:st,disabled:P,onClick:()=>void $(`restore`,J),children:t?`恢复`:`Restore`}),(0,B.jsx)(`button`,{type:`button`,className:`rounded-lg px-2 py-2 text-sm text-red-600 hover:bg-surface-hover dark:text-red-400`,onClick:()=>ne(!0),children:t?`永久删除`:`Delete permanently`})]}):(0,B.jsxs)(B.Fragment,{children:[xt?(0,B.jsx)(d,{className:`rounded-lg px-2 py-2 text-sm text-fg-muted hover:bg-surface-hover`,to:xt,children:t?`查看来源`:`Open source`}):(0,B.jsx)(`span`,{}),!X&&Qe(Y.fileName)?(0,B.jsx)(`button`,{type:`button`,className:F(ot,`w-auto border border-edge`),disabled:P,title:t?`导入数据、公式与基础布局,保留原文件`:`Import data, formulas and basic layout as a separate workbook`,onClick:()=>Vt(Y.fileName,()=>Te(J.id,Y.id),{id:J.id,versionId:Y.id}),children:t?`创建可编辑副本`:`Make an editable copy`}):null,X?null:(0,B.jsx)(`button`,{type:`button`,className:st,disabled:P||Y.sizeBytes>33554432,title:Y.sizeBytes>33554432?t?`超过对话附件大小上限`:`Exceeds the chat attachment size limit`:void 0,onClick:Rt,children:t?`在对话中使用`:`Use in chat`})]})}),N?(0,B.jsxs)(`div`,{role:`alert`,className:`rounded-xl border border-edge bg-surface-panel p-3 text-sm`,children:[(0,B.jsx)(`p`,{children:t?`永久删除「${J.title}」?`:`Delete “${J.title}” permanently?`}),(0,B.jsxs)(`div`,{className:`mt-2 flex justify-end gap-2`,children:[(0,B.jsx)(`button`,{type:`button`,className:ot,onClick:()=>ne(!1),children:t?`取消`:`Cancel`}),(0,B.jsx)(`button`,{type:`button`,className:F(ot,`text-red-600 dark:text-red-400`),disabled:P,onClick:()=>void $(`purge`,J),children:t?`删除`:`Delete`})]})]}):null]}):null]}):null,Xt]}),X&&J&&!J.trashedAt&&de?.itemId===J.id?(0,B.jsx)(tt,{id:J.id,open:Ct,zh:t,originId:Z?.available?Z.conversationId:void 0,projectId:St,onClose:Mt,readSelection:Ot,prepareSendContext:Dt,onRunSettled:jt},J.id):null]}),C):null,V&&C?null:Xt,(0,B.jsx)(he,{open:e.dialogOpen,onOpenChange:e.handleOpenChange,result:e.result,loading:e.loading,error:e.error,pendingParams:e.pendingParams,onConfirm:e.confirmShareLink})]})}export{X as SpacePage};
@@ -1,3 +1,3 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{_ as i,d as a,f as o,h as s,t as c}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{i as l,l as u,n as d,o as f}from"./locale-store-CHjsq5NR.js";import{t as p}from"./messages-C7QSnTdg.js";import{a as m,i as h,n as g,o as _,r as v,s as y,t as b}from"./dist-DlirbHVs.js";import{E as x,Y as S,_ as C,ct as w,q as T,t as E}from"./chat-page-LOR5JxDh.js";import{t as ee}from"./arrow-left-D880xG-P.js";import{f as D,i as O,u as k}from"./automation-display-DaVDNZz8.js";import{t as te}from"./check-DUBLcKHA.js";import{t as A}from"./chevron-right-BweFrslA.js";import{n as j,r as M}from"./popover-select-hRG1EzAY.js";import{t as N}from"./circle-BoO4YvTx.js";import{t as P}from"./ellipsis-0k4rZLoy.js";import{t as F}from"./external-link-DjqjBmc3.js";import{t as I}from"./file-icon-N6WjUhq_.js";import{t as ne}from"./folder-kanban-CpLlFI1o.js";import{t as re}from"./folder-open-CyzJ19I9.js";import{F as ie,N as ae,V as oe,z as se}from"./markdown-view-ihzUc4ud.js";import{t as ce}from"./message-square-fVE7Ghj1.js";import{t as le}from"./pause-DuPxgSxk.js";import{t as ue}from"./play-kxZvpBg8.js";import{t as L}from"./x-B_N4OPjy.js";import{t as R}from"./cn-0WouolD0.js";import{t as de}from"./skeleton-DzdOeGYz.js";import{f as fe}from"./tasks-CwyNaa-j.js";import{c as pe}from"./api-CGs641OT.js";import{xt as me}from"./session-manager-DUWeBdeG.js";import{i as he}from"./vendor-swr-CdRzEUwF.js";import{C as ge,D as _e,T as ve,a as ye,b as be,c as xe,f as Se,h as Ce,j as we,k as Te,o as Ee,p as De,r as Oe,s as ke}from"./home-task-actions-C8Fi6GBq.js";import{t as Ae}from"./chat-agents-api-CyvBfBbp.js";import{t as z}from"./button-C5tRaJxt.js";import{r as je}from"./right-workspace-store-Cehybf-G.js";import{c as Me}from"./composer-payload-handoff-ClWsunJ2.js";import{t as Ne}from"./page-header-store-NP7MCIaP.js";import{t as Pe}from"./agent-avatar-display-D_UDgOr9.js";import{t as Fe}from"./automation-api-D-gn6x5E.js";import{n as Ie}from"./agent-display-names-Bje7vfSn.js";import{t as B}from"./sliding-tab-list-CmcrqRzN.js";import{t as Le}from"./confirm-dialog-MHCmEEUZ.js";import{l as Re,m as ze,o as Be,r as Ve,t as He,u as Ue}from"./dist-DaFr5KMw.js";import{d as We,f as Ge,l as Ke,o as qe,u as Je}from"./automation-task-card-C453Q-Wa.js";import{t as Ye}from"./date-picker-DwITf4I2.js";import{t as Xe}from"./time-picker-otHjbob1.js";import{n as Ze}from"./date-formatters-DukWSVwc.js";import{n as Qe,r as $e,t as et}from"./task-header-title-Cdgp2rCs.js";import{t as tt}from"./date-time-picker-ChG1CqR1.js";import{a as nt,i as rt,n as it,o as V,r as H,t as at}from"./task-run-issue-notice-CGrUMy0s.js";import{t as ot}from"./page-context-capture-button-BXSBeGms.js";import{t as st}from"./dependency-picker-DEPr5_Wk.js";var U=e(t(),1),W=n(),G=r();function ct(e,t,n){let r=new URLSearchParams(e),i=r.getAll(`taskPanel`).filter(e=>e!==t&&e!==`${t}:closed`);r.delete(`taskPanel`);for(let e of i)r.append(`taskPanel`,e);return r.append(`taskPanel`,n?t:`${t}:closed`),r}function lt(e){let t=(0,W.c)(32),n,r,a,o,s,c,l;t[0]===e?(n=t[1],r=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7]):({panelId:r,title:l,defaultOpen:s,children:n,summaryClassName:o,chevron:c,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l);let u=s!==void 0&&s,d=c!==void 0&&c,[f,p]=i(),m;if(t[8]!==u||t[9]!==r||t[10]!==f){let e=f.getAll(`taskPanel`);m=e.includes(r)||u&&!e.includes(`${r}:closed`),t[8]=u,t[9]=r,t[10]=f,t[11]=m}else m=t[11];let h=m,g=o??`cursor-pointer py-2 text-xs text-fg-muted hover:text-fg`,_=d&&`flex list-none items-center justify-between gap-3 [&::-webkit-details-marker]:hidden`,v;t[12]!==g||t[13]!==_?(v=R(g,_),t[12]=g,t[13]=_,t[14]=v):v=t[14];let y;t[15]!==h||t[16]!==r||t[17]!==p?(y=e=>{e.preventDefault(),p(e=>ct(e,r,!h),{preventScrollReset:!0})},t[15]=h,t[16]=r,t[17]=p,t[18]=y):y=t[18];let b;t[19]!==d||t[20]!==h||t[21]!==l?(b=d?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`min-w-0 flex-1`,children:l}),(0,G.jsx)(A,{"aria-hidden":!0,className:R(`size-4 shrink-0 text-fg-subtle motion-safe:transition-transform motion-safe:duration-150`,h&&`rotate-90`)})]}):l,t[19]=d,t[20]=h,t[21]=l,t[22]=b):b=t[22];let x;t[23]!==v||t[24]!==y||t[25]!==b?(x=(0,G.jsx)(`summary`,{className:v,onClick:y,children:b}),t[23]=v,t[24]=y,t[25]=b,t[26]=x):x=t[26];let S;return t[27]!==n||t[28]!==h||t[29]!==a||t[30]!==x?(S=(0,G.jsxs)(`details`,{...a,open:h,children:[x,n]}),t[27]=n,t[28]=h,t[29]=a,t[30]=x,t[31]=S):S=t[31],S}function ut(e){let t=e;for(;t&&!/(auto|scroll)/.test(getComputedStyle(t).overflowY);)t=t.parentElement;return t}function dt(e,t){let n=e?.closest(`.task-detail-scroll`),r=Array.from(n?.querySelectorAll(`[data-task-section]`)??[]).find(e=>e.dataset.taskSection===t);if(!r||!n)return;r instanceof HTMLDetailsElement&&(r.open=!0);let i=ut(n),a=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;if(!i){r.scrollIntoView({block:`start`,behavior:a?`instant`:`smooth`});return}let o=(e?.parentElement?.getBoundingClientRect().height??0)+16,s=Math.max(0,Math.min(i.scrollHeight-i.clientHeight,i.scrollTop+r.getBoundingClientRect().top-i.getBoundingClientRect().top-i.clientTop-o));i.scrollTo({top:s,behavior:a?`instant`:`smooth`});let c=i;return{cancel:()=>c.scrollTo({top:c.scrollTop,behavior:`instant`}),isComplete:()=>Math.abs(c.scrollTop-s)<1}}function ft(e){let t=(0,W.c)(28),{language:n,hasSchedule:r}=e,[a,o]=i(),s;t[0]===a?s=t[1]:(s=a.get(`taskSection`),t[0]=a,t[1]=s);let c=s,l=(0,U.useRef)(null),u=(0,U.useRef)(null),d=(0,U.useRef)(null),f=(0,U.useRef)(void 0),p=(0,U.useRef)(o),m=(0,U.useRef)(c),h,g;t[2]!==c||t[3]!==o?(h=()=>{p.current=o,m.current=c},g=[o,c],t[2]=c,t[3]=o,t[4]=h,t[5]=g):(h=t[4],g=t[5]),(0,U.useEffect)(h,g);let _=(0,U.useRef)(void 0),v=(0,U.useRef)(!1),y;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>{let e=d.current;d.current=null,_.current=void 0,!(!e||!v.current)&&(v.current=!1,p.current(t=>{let n=ct(t,e,!0);return n.set(`taskSection`,e),n},{preventScrollReset:!0}))},t[6]=y):y=t[6];let b=y,x;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(x=(e,t)=>{let n=t!==void 0&&t;clearTimeout(f.current),d.current=e,v.current=n,f.current=setTimeout(b,800),_.current=dt(l.current,e)},t[7]=x):x=t[7];let S=x,[C,w]=(0,U.useState)(c??`results`),T;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(T=[],t[8]=T):T=t[8];let[E,ee]=(0,U.useState)(T),D;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>{let e=l.current,t=e?.closest(`.task-detail-scroll`),n=e?.parentElement;if(!t||!n)return;let r=Array.from(t.querySelectorAll(`[data-task-section]`));ee(r.map(pt));let i=0,a=()=>{if(d.current)return;let e=ut(t),i=n.getBoundingClientRect().bottom+24,a=r[0];for(let e of r)e.getBoundingClientRect().top<=i&&(a=e);if(e&&e.scrollHeight>e.clientHeight&&e.scrollTop+e.clientHeight>=e.scrollHeight-2&&(a=r.at(-1)),!a)return;let o=a.dataset.taskSection;w(o),m.current!==o&&(u.current=o,clearTimeout(f.current),f.current=setTimeout(()=>{p.current(e=>{let t=new URLSearchParams(e);return t.set(`taskSection`,o),t},{replace:!0,preventScrollReset:!0})},160))},o=e=>{if(!(!(e.target instanceof Element)||!e.target.contains(t))){if(d.current){clearTimeout(f.current),f.current=setTimeout(b,160);return}clearTimeout(f.current),i||=requestAnimationFrame(()=>{i=0,a()})}},s=n=>{!(n.target instanceof Node)||!t.contains(n.target)||e.contains(n.target)||n instanceof KeyboardEvent&&![`ArrowUp`,`ArrowDown`,`PageUp`,`PageDown`,`Home`,`End`,` `].includes(n.key)||(_.current?.cancel(),_.current=void 0,d.current=null,v.current=!1,clearTimeout(f.current))},c=e=>{e.target instanceof Element&&e.target.contains(t)&&d.current&&(!_.current||_.current.isComplete())&&(clearTimeout(f.current),b())},h=()=>{let e=n.getBoundingClientRect().height;for(let t of r)t.style.scrollMarginTop=`${e+16}px`};h();let g=typeof ResizeObserver>`u`?null:new ResizeObserver(h);return g?.observe(n),window.addEventListener(`resize`,h),document.addEventListener(`scroll`,o,!0),document.addEventListener(`scrollend`,c,!0),document.addEventListener(`wheel`,s,{capture:!0,passive:!0}),document.addEventListener(`touchstart`,s,{capture:!0,passive:!0}),document.addEventListener(`pointerdown`,s,{capture:!0,passive:!0}),document.addEventListener(`keydown`,s,!0),()=>{cancelAnimationFrame(i),g?.disconnect(),window.removeEventListener(`resize`,h),document.removeEventListener(`scroll`,o,!0),document.removeEventListener(`scrollend`,c,!0),document.removeEventListener(`wheel`,s,!0),document.removeEventListener(`touchstart`,s,!0),document.removeEventListener(`pointerdown`,s,!0),document.removeEventListener(`keydown`,s,!0)}},t[9]=D):D=t[9];let O;t[10]!==r||t[11]!==n?(O=[n,r,b],t[10]=r,t[11]=n,t[12]=O):O=t[12],(0,U.useEffect)(D,O);let k,te;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(te=()=>()=>{clearTimeout(f.current),_.current?.cancel()},k=[],t[13]=k,t[14]=te):(k=t[13],te=t[14]),(0,U.useEffect)(te,k);let A,j;t[15]===c?(A=t[16],j=t[17]):(A=()=>{!c||u.current===c||(u.current=c,w(c),S(c))},j=[c,S],t[15]=c,t[16]=A,t[17]=j),(0,U.useEffect)(A,j);let M;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(M=()=>{let e=l.current,t=e?.querySelector(`[aria-current="location"]`);if(!e||!t)return;let n=t.offsetLeft<e.scrollLeft?t.offsetLeft:t.offsetLeft+t.offsetWidth>e.scrollLeft+e.clientWidth?t.offsetLeft+t.offsetWidth-e.clientWidth:e.scrollLeft;n!==e.scrollLeft&&e.scrollTo({left:n,behavior:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?`instant`:`smooth`})},t[18]=M):M=t[18];let N;t[19]!==C||t[20]!==E?(N=[C,E],t[19]=C,t[20]=E,t[21]=N):N=t[21],(0,U.useEffect)(M,N);let P=n===`zh`?`任务详情分区`:`Task detail sections`,F;t[22]!==C||t[23]!==E?(F=E.map(e=>(0,G.jsx)(`button`,{type:`button`,"aria-current":C===e.id?`location`:void 0,"aria-pressed":C===e.id,"data-sliding-active":C===e.id,className:R(`relative z-10 min-h-9 min-w-max flex-1 touch-manipulation rounded-lg px-3 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,C===e.id?`text-fg`:`text-fg-muted hover:text-fg`),onClick:()=>{u.current=e.id,w(e.id),S(e.id,!0)},children:e.label},e.id)),t[22]=C,t[23]=E,t[24]=F):F=t[24];let I;return t[25]!==P||t[26]!==F?(I=(0,G.jsx)(B,{scrollFocusedItemIntoView:!1,as:`nav`,ref:l,"aria-label":P,className:`flex w-full gap-0.5 overflow-x-auto rounded-xl bg-surface-inset p-1`,indicatorClassName:`rounded-lg bg-surface-panel ring-1 ring-edge-subtle duration-300 [transition-timing-function:cubic-bezier(0.22,1,0.36,1)]`,children:F}),t[25]=P,t[26]=F,t[27]=I):I=t[27],I}function pt(e){return{id:e.dataset.taskSection,label:e.dataset.taskSectionLabel}}var mt=`Default criteria were not expanded into concrete acceptance items; broad completion cannot certify item coverage.`;function ht(e){let t=(0,W.c)(64),{criterion:n,index:r,language:i,closed:a,pending:o,onReview:s,projectId:c,conversationId:l}=e,u=i===`zh`,d=(0,U.useId)(),f=n.status===`passed`,p=n.evidence.length>0||n.method||n.review||n.note,m=n.verificationStatus===`passed`?u?`通过`:`Passed`:n.verificationStatus===`failed`?u?`未通过`:`Failed`:u?`未核验`:`Unverified`,h=n.review?.status===`passed`?u?`已验收`:`Accepted`:n.review?.status===`failed`?u?`未通过`:`Failed`:u?`已撤销验收`:`Acceptance cleared`,g=!a&&!o&&`cursor-pointer`,_;t[0]===g?_=t[1]:(_=R(`relative grid size-11 shrink-0 place-items-center rounded-full`,g),t[0]=g,t[1]=_);let v=o||void 0,y;t[2]!==r||t[3]!==s||t[4]!==o?(y=e=>{o||s(r,e.target.checked?`passed`:`unverified`)},t[2]=r,t[3]=s,t[4]=o,t[5]=y):y=t[5];let b;t[6]!==f||t[7]!==a||t[8]!==v||t[9]!==y||t[10]!==d?(b=(0,G.jsx)(`input`,{type:`checkbox`,"aria-labelledby":d,className:`peer sr-only`,checked:f,disabled:a,"aria-disabled":v,onChange:y}),t[6]=f,t[7]=a,t[8]=v,t[9]=y,t[10]=d,t[11]=b):b=t[11];let x=f?`border-edge bg-surface-inset text-fg`:`border-fg-subtle/70`,S=!a&&!o&&`hover:bg-surface-hover`,C;t[12]!==x||t[13]!==S?(C=R(`grid size-5 place-items-center rounded-full border motion-safe:transition-colors motion-safe:duration-150 peer-focus-visible:ring-2 peer-focus-visible:ring-accent peer-focus-visible:ring-offset-2 peer-focus-visible:ring-offset-surface-panel`,x,S),t[12]=x,t[13]=S,t[14]=C):C=t[14];let w;t[15]===f?w=t[16]:(w=f?(0,G.jsx)(te,{className:`size-3.5`,strokeWidth:2.8}):null,t[15]=f,t[16]=w);let T;t[17]!==C||t[18]!==w?(T=(0,G.jsx)(`span`,{"aria-hidden":!0,className:C,children:w}),t[17]=C,t[18]=w,t[19]=T):T=t[19];let E;t[20]!==T||t[21]!==_||t[22]!==b?(E=(0,G.jsxs)(`label`,{className:_,children:[b,T]}),t[20]=T,t[21]=_,t[22]=b,t[23]=E):E=t[23];let ee=`criterion:${r}:evidence`,D;t[24]!==n.text||t[25]!==d?(D=(0,G.jsx)(`span`,{id:d,className:`block whitespace-pre-wrap break-words text-sm leading-5 text-fg [overflow-wrap:anywhere]`,children:n.text}),t[24]=n.text,t[25]=d,t[26]=D):D=t[26];let O=u?`验收依据`:`Acceptance evidence`,k;t[27]===O?k=t[28]:(k=(0,G.jsx)(`p`,{className:`font-medium text-fg`,children:O}),t[27]=O,t[28]=k);let A;t[29]!==n.method||t[30]!==m||t[31]!==u?(A=n.method?(0,G.jsxs)(`p`,{children:[u?`自动核验`:`Automatic verification`,` · `,m,n.method===`model_reviewed`?u?` · 模型审阅`:` · Model review`:``]}):null,t[29]=n.method,t[30]=m,t[31]=u,t[32]=A):A=t[32];let j;t[33]!==n.review||t[34]!==i||t[35]!==h||t[36]!==u?(j=n.review?(0,G.jsxs)(`p`,{children:[u?`人工验收`:`User review`,` · `,h,` · `,Ze(n.review.reviewedAt,i)]}):null,t[33]=n.review,t[34]=i,t[35]=h,t[36]=u,t[37]=j):j=t[37];let M;t[38]!==n.note||t[39]!==r||t[40]!==i?(M=n.note&&n.note!==mt?(0,G.jsx)(V,{content:rt(n.note,i),contentKey:`criterion:${r}:note`,language:i,markdown:!1}):null,t[38]=n.note,t[39]=r,t[40]=i,t[41]=M):M=t[41];let N;t[42]!==l||t[43]!==n.evidence||t[44]!==i||t[45]!==c?(N=(0,G.jsx)(it,{evidence:n.evidence,projectId:c,conversationId:l,language:i}),t[42]=l,t[43]=n.evidence,t[44]=i,t[45]=c,t[46]=N):N=t[46];let P;t[47]!==p||t[48]!==u?(P=p?null:(0,G.jsx)(`p`,{children:u?`暂无验收依据`:`No evidence yet`}),t[47]=p,t[48]=u,t[49]=P):P=t[49];let F;t[50]!==k||t[51]!==A||t[52]!==j||t[53]!==M||t[54]!==N||t[55]!==P?(F=(0,G.jsxs)(`div`,{className:`mb-3 space-y-2 rounded-lg bg-surface-inset px-3 py-2.5 text-xs leading-5 text-fg-muted`,children:[k,A,j,M,N,P]}),t[50]=k,t[51]=A,t[52]=j,t[53]=M,t[54]=N,t[55]=P,t[56]=F):F=t[56];let I;t[57]!==ee||t[58]!==D||t[59]!==F?(I=(0,G.jsx)(lt,{panelId:ee,chevron:!0,className:`min-w-0 flex-1`,summaryClassName:`-ms-1 min-h-11 cursor-pointer rounded-lg py-3 pe-2 ps-1 outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,title:D,children:F}),t[57]=ee,t[58]=D,t[59]=F,t[60]=I):I=t[60];let ne;return t[61]!==E||t[62]!==I?(ne=(0,G.jsxs)(`li`,{className:`relative flex min-w-0 items-start px-2 before:absolute before:end-0 before:start-13 before:top-0 before:border-t before:border-edge-subtle first:before:hidden sm:px-3`,children:[E,I]}),t[61]=E,t[62]=I,t[63]=ne):ne=t[63],ne}function gt(e){let t=(0,W.c)(40),{criteria:n,language:r,closed:i,pending:a,blockedReason:o,error:s,onReview:c,projectId:l,conversationId:u,reviewDisabled:d}=e,f=r===`zh`,p;t[0]===n?p=t[1]:(p=n.some(_t),t[0]=n,t[1]=p);let m=p,h;t[2]!==m||t[3]!==r||t[4]!==f?(h=m?(0,G.jsx)(lt,{panelId:`acceptance:diagnostic`,title:f?`验收标准需要细化`:`The criteria need more detail`,className:`mx-4 mb-2 text-xs leading-5 text-fg-muted`,children:(0,G.jsx)(`p`,{className:`mt-2 break-words`,children:rt(mt,r)})}):null,t[2]=m,t[3]=r,t[4]=f,t[5]=h):h=t[5];let g=a||void 0,_;if(t[6]!==i||t[7]!==u||t[8]!==n||t[9]!==r||t[10]!==c||t[11]!==a||t[12]!==l||t[13]!==d){let e;t[15]!==i||t[16]!==u||t[17]!==r||t[18]!==c||t[19]!==a||t[20]!==l||t[21]!==d?(e=(e,t)=>(0,G.jsx)(ht,{criterion:e,index:t,language:r,closed:i||!!d,pending:a,onReview:c,projectId:l,conversationId:u},`${t}:${e.text}`),t[15]=i,t[16]=u,t[17]=r,t[18]=c,t[19]=a,t[20]=l,t[21]=d,t[22]=e):e=t[22],_=n.map(e),t[6]=i,t[7]=u,t[8]=n,t[9]=r,t[10]=c,t[11]=a,t[12]=l,t[13]=d,t[14]=_}else _=t[14];let v;t[23]!==g||t[24]!==_?(v=(0,G.jsx)(`ul`,{"aria-busy":g,className:`border-t border-edge-subtle`,children:_}),t[23]=g,t[24]=_,t[25]=v):v=t[25];let y;t[26]!==n.length||t[27]!==f?(y=n.length===0?(0,G.jsx)(`p`,{className:`px-4 py-4 text-sm text-fg-muted`,children:f?`尚未定义验收标准`:`No acceptance criteria defined`}):null,t[26]=n.length,t[27]=f,t[28]=y):y=t[28];let b;t[29]===s?b=t[30]:(b=s?(0,G.jsx)(`p`,{role:`alert`,className:`mx-4 my-2 text-sm text-danger`,children:s}):null,t[29]=s,t[30]=b);let x;t[31]!==o||t[32]!==i?(x=!i&&o?(0,G.jsx)(`p`,{className:`border-t border-edge-subtle px-4 py-2.5 text-xs text-fg-muted`,children:o}):null,t[31]=o,t[32]=i,t[33]=x):x=t[33];let S;return t[34]!==h||t[35]!==v||t[36]!==y||t[37]!==b||t[38]!==x?(S=(0,G.jsxs)(G.Fragment,{children:[h,v,y,b,x]}),t[34]=h,t[35]=v,t[36]=y,t[37]=b,t[38]=x,t[39]=S):S=t[39],S}function _t(e){return e.note===mt}function vt(e){let t=(0,W.c)(27),{detail:n,language:r}=e,i=r===`zh`,o=a(),s;if(t[0]!==n||t[1]!==r||t[2]!==o||t[3]!==i){let e=n.deliverables??[],a=ye(n),l=a&&H(a,r),u;if(t[5]!==n.runs||t[6]!==n.task){let e;t[8]===n.task?e=t[9]:(e=e=>e.contractVersion===n.task.latestContractVersion,t[8]=n.task,t[9]=e),u=new Set(n.runs.filter(e).map(Tt)),t[5]=n.runs,t[6]=n.task,t[7]=u}else u=t[7];let d=u,f=n.context.filter(wt).map(Ct),p=new Set(e.flatMap(St).filter(Boolean)),m=new Set([...f.map(xt),...p].filter(Boolean)),h;t[10]===d?h=t[11]:(h=e=>d.has(e.runId),t[10]=d,t[11]=h);for(let e of n.receipts.filter(h))for(let t of e.evidence.filter(bt))t.uri&&m.has(t.uri)||(t.uri&&m.add(t.uri),f.push(t));let g=l?.summary,_=g&&g.length<=160&&!g.includes(`
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{_ as i,d as a,f as o,h as s,t as c}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{i as l,l as u,n as d,o as f}from"./locale-store-CHjsq5NR.js";import{t as p}from"./messages-C7QSnTdg.js";import{a as m,i as h,n as g,o as _,r as v,s as y,t as b}from"./dist-DlirbHVs.js";import{E as x,Y as S,_ as C,ct as w,q as T,t as E}from"./chat-page-3fVhP77N.js";import{t as ee}from"./arrow-left-D880xG-P.js";import{f as D,i as O,u as k}from"./automation-display-DaVDNZz8.js";import{t as te}from"./check-DUBLcKHA.js";import{t as A}from"./chevron-right-BweFrslA.js";import{n as j,r as M}from"./popover-select-hRG1EzAY.js";import{t as N}from"./circle-BoO4YvTx.js";import{t as P}from"./ellipsis-0k4rZLoy.js";import{t as F}from"./external-link-DjqjBmc3.js";import{t as I}from"./file-icon-N6WjUhq_.js";import{t as ne}from"./folder-kanban-CpLlFI1o.js";import{t as re}from"./folder-open-CyzJ19I9.js";import{F as ie,N as ae,V as oe,z as se}from"./markdown-view-ihzUc4ud.js";import{t as ce}from"./message-square-fVE7Ghj1.js";import{t as le}from"./pause-DuPxgSxk.js";import{t as ue}from"./play-kxZvpBg8.js";import{t as L}from"./x-B_N4OPjy.js";import{t as R}from"./cn-0WouolD0.js";import{t as de}from"./skeleton-DzdOeGYz.js";import{f as fe}from"./tasks-CwyNaa-j.js";import{c as pe}from"./api-CGs641OT.js";import{xt as me}from"./session-manager-DUWeBdeG.js";import{i as he}from"./vendor-swr-CdRzEUwF.js";import{C as ge,D as _e,T as ve,a as ye,b as be,c as xe,f as Se,h as Ce,j as we,k as Te,o as Ee,p as De,r as Oe,s as ke}from"./home-task-actions-C8Fi6GBq.js";import{t as Ae}from"./chat-agents-api-CyvBfBbp.js";import{t as z}from"./button-C5tRaJxt.js";import{r as je}from"./right-workspace-store-Cehybf-G.js";import{c as Me}from"./composer-payload-handoff-ClWsunJ2.js";import{t as Ne}from"./page-header-store-NP7MCIaP.js";import{t as Pe}from"./agent-avatar-display-D_UDgOr9.js";import{t as Fe}from"./automation-api-D-gn6x5E.js";import{n as Ie}from"./agent-display-names-Bje7vfSn.js";import{t as B}from"./sliding-tab-list-CmcrqRzN.js";import{t as Le}from"./confirm-dialog-MHCmEEUZ.js";import{l as Re,m as ze,o as Be,r as Ve,t as He,u as Ue}from"./dist-DaFr5KMw.js";import{d as We,f as Ge,l as Ke,o as qe,u as Je}from"./automation-task-card-C453Q-Wa.js";import{t as Ye}from"./date-picker-DwITf4I2.js";import{t as Xe}from"./time-picker-otHjbob1.js";import{n as Ze}from"./date-formatters-DukWSVwc.js";import{n as Qe,r as $e,t as et}from"./task-header-title-qzNctGl5.js";import{t as tt}from"./date-time-picker-ChG1CqR1.js";import{a as nt,i as rt,n as it,o as V,r as H,t as at}from"./task-run-issue-notice-CGrUMy0s.js";import{t as ot}from"./page-context-capture-button-BXSBeGms.js";import{t as st}from"./dependency-picker-DEPr5_Wk.js";var U=e(t(),1),W=n(),G=r();function ct(e,t,n){let r=new URLSearchParams(e),i=r.getAll(`taskPanel`).filter(e=>e!==t&&e!==`${t}:closed`);r.delete(`taskPanel`);for(let e of i)r.append(`taskPanel`,e);return r.append(`taskPanel`,n?t:`${t}:closed`),r}function lt(e){let t=(0,W.c)(32),n,r,a,o,s,c,l;t[0]===e?(n=t[1],r=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7]):({panelId:r,title:l,defaultOpen:s,children:n,summaryClassName:o,chevron:c,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l);let u=s!==void 0&&s,d=c!==void 0&&c,[f,p]=i(),m;if(t[8]!==u||t[9]!==r||t[10]!==f){let e=f.getAll(`taskPanel`);m=e.includes(r)||u&&!e.includes(`${r}:closed`),t[8]=u,t[9]=r,t[10]=f,t[11]=m}else m=t[11];let h=m,g=o??`cursor-pointer py-2 text-xs text-fg-muted hover:text-fg`,_=d&&`flex list-none items-center justify-between gap-3 [&::-webkit-details-marker]:hidden`,v;t[12]!==g||t[13]!==_?(v=R(g,_),t[12]=g,t[13]=_,t[14]=v):v=t[14];let y;t[15]!==h||t[16]!==r||t[17]!==p?(y=e=>{e.preventDefault(),p(e=>ct(e,r,!h),{preventScrollReset:!0})},t[15]=h,t[16]=r,t[17]=p,t[18]=y):y=t[18];let b;t[19]!==d||t[20]!==h||t[21]!==l?(b=d?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`min-w-0 flex-1`,children:l}),(0,G.jsx)(A,{"aria-hidden":!0,className:R(`size-4 shrink-0 text-fg-subtle motion-safe:transition-transform motion-safe:duration-150`,h&&`rotate-90`)})]}):l,t[19]=d,t[20]=h,t[21]=l,t[22]=b):b=t[22];let x;t[23]!==v||t[24]!==y||t[25]!==b?(x=(0,G.jsx)(`summary`,{className:v,onClick:y,children:b}),t[23]=v,t[24]=y,t[25]=b,t[26]=x):x=t[26];let S;return t[27]!==n||t[28]!==h||t[29]!==a||t[30]!==x?(S=(0,G.jsxs)(`details`,{...a,open:h,children:[x,n]}),t[27]=n,t[28]=h,t[29]=a,t[30]=x,t[31]=S):S=t[31],S}function ut(e){let t=e;for(;t&&!/(auto|scroll)/.test(getComputedStyle(t).overflowY);)t=t.parentElement;return t}function dt(e,t){let n=e?.closest(`.task-detail-scroll`),r=Array.from(n?.querySelectorAll(`[data-task-section]`)??[]).find(e=>e.dataset.taskSection===t);if(!r||!n)return;r instanceof HTMLDetailsElement&&(r.open=!0);let i=ut(n),a=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;if(!i){r.scrollIntoView({block:`start`,behavior:a?`instant`:`smooth`});return}let o=(e?.parentElement?.getBoundingClientRect().height??0)+16,s=Math.max(0,Math.min(i.scrollHeight-i.clientHeight,i.scrollTop+r.getBoundingClientRect().top-i.getBoundingClientRect().top-i.clientTop-o));i.scrollTo({top:s,behavior:a?`instant`:`smooth`});let c=i;return{cancel:()=>c.scrollTo({top:c.scrollTop,behavior:`instant`}),isComplete:()=>Math.abs(c.scrollTop-s)<1}}function ft(e){let t=(0,W.c)(28),{language:n,hasSchedule:r}=e,[a,o]=i(),s;t[0]===a?s=t[1]:(s=a.get(`taskSection`),t[0]=a,t[1]=s);let c=s,l=(0,U.useRef)(null),u=(0,U.useRef)(null),d=(0,U.useRef)(null),f=(0,U.useRef)(void 0),p=(0,U.useRef)(o),m=(0,U.useRef)(c),h,g;t[2]!==c||t[3]!==o?(h=()=>{p.current=o,m.current=c},g=[o,c],t[2]=c,t[3]=o,t[4]=h,t[5]=g):(h=t[4],g=t[5]),(0,U.useEffect)(h,g);let _=(0,U.useRef)(void 0),v=(0,U.useRef)(!1),y;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>{let e=d.current;d.current=null,_.current=void 0,!(!e||!v.current)&&(v.current=!1,p.current(t=>{let n=ct(t,e,!0);return n.set(`taskSection`,e),n},{preventScrollReset:!0}))},t[6]=y):y=t[6];let b=y,x;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(x=(e,t)=>{let n=t!==void 0&&t;clearTimeout(f.current),d.current=e,v.current=n,f.current=setTimeout(b,800),_.current=dt(l.current,e)},t[7]=x):x=t[7];let S=x,[C,w]=(0,U.useState)(c??`results`),T;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(T=[],t[8]=T):T=t[8];let[E,ee]=(0,U.useState)(T),D;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>{let e=l.current,t=e?.closest(`.task-detail-scroll`),n=e?.parentElement;if(!t||!n)return;let r=Array.from(t.querySelectorAll(`[data-task-section]`));ee(r.map(pt));let i=0,a=()=>{if(d.current)return;let e=ut(t),i=n.getBoundingClientRect().bottom+24,a=r[0];for(let e of r)e.getBoundingClientRect().top<=i&&(a=e);if(e&&e.scrollHeight>e.clientHeight&&e.scrollTop+e.clientHeight>=e.scrollHeight-2&&(a=r.at(-1)),!a)return;let o=a.dataset.taskSection;w(o),m.current!==o&&(u.current=o,clearTimeout(f.current),f.current=setTimeout(()=>{p.current(e=>{let t=new URLSearchParams(e);return t.set(`taskSection`,o),t},{replace:!0,preventScrollReset:!0})},160))},o=e=>{if(!(!(e.target instanceof Element)||!e.target.contains(t))){if(d.current){clearTimeout(f.current),f.current=setTimeout(b,160);return}clearTimeout(f.current),i||=requestAnimationFrame(()=>{i=0,a()})}},s=n=>{!(n.target instanceof Node)||!t.contains(n.target)||e.contains(n.target)||n instanceof KeyboardEvent&&![`ArrowUp`,`ArrowDown`,`PageUp`,`PageDown`,`Home`,`End`,` `].includes(n.key)||(_.current?.cancel(),_.current=void 0,d.current=null,v.current=!1,clearTimeout(f.current))},c=e=>{e.target instanceof Element&&e.target.contains(t)&&d.current&&(!_.current||_.current.isComplete())&&(clearTimeout(f.current),b())},h=()=>{let e=n.getBoundingClientRect().height;for(let t of r)t.style.scrollMarginTop=`${e+16}px`};h();let g=typeof ResizeObserver>`u`?null:new ResizeObserver(h);return g?.observe(n),window.addEventListener(`resize`,h),document.addEventListener(`scroll`,o,!0),document.addEventListener(`scrollend`,c,!0),document.addEventListener(`wheel`,s,{capture:!0,passive:!0}),document.addEventListener(`touchstart`,s,{capture:!0,passive:!0}),document.addEventListener(`pointerdown`,s,{capture:!0,passive:!0}),document.addEventListener(`keydown`,s,!0),()=>{cancelAnimationFrame(i),g?.disconnect(),window.removeEventListener(`resize`,h),document.removeEventListener(`scroll`,o,!0),document.removeEventListener(`scrollend`,c,!0),document.removeEventListener(`wheel`,s,!0),document.removeEventListener(`touchstart`,s,!0),document.removeEventListener(`pointerdown`,s,!0),document.removeEventListener(`keydown`,s,!0)}},t[9]=D):D=t[9];let O;t[10]!==r||t[11]!==n?(O=[n,r,b],t[10]=r,t[11]=n,t[12]=O):O=t[12],(0,U.useEffect)(D,O);let k,te;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(te=()=>()=>{clearTimeout(f.current),_.current?.cancel()},k=[],t[13]=k,t[14]=te):(k=t[13],te=t[14]),(0,U.useEffect)(te,k);let A,j;t[15]===c?(A=t[16],j=t[17]):(A=()=>{!c||u.current===c||(u.current=c,w(c),S(c))},j=[c,S],t[15]=c,t[16]=A,t[17]=j),(0,U.useEffect)(A,j);let M;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(M=()=>{let e=l.current,t=e?.querySelector(`[aria-current="location"]`);if(!e||!t)return;let n=t.offsetLeft<e.scrollLeft?t.offsetLeft:t.offsetLeft+t.offsetWidth>e.scrollLeft+e.clientWidth?t.offsetLeft+t.offsetWidth-e.clientWidth:e.scrollLeft;n!==e.scrollLeft&&e.scrollTo({left:n,behavior:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?`instant`:`smooth`})},t[18]=M):M=t[18];let N;t[19]!==C||t[20]!==E?(N=[C,E],t[19]=C,t[20]=E,t[21]=N):N=t[21],(0,U.useEffect)(M,N);let P=n===`zh`?`任务详情分区`:`Task detail sections`,F;t[22]!==C||t[23]!==E?(F=E.map(e=>(0,G.jsx)(`button`,{type:`button`,"aria-current":C===e.id?`location`:void 0,"aria-pressed":C===e.id,"data-sliding-active":C===e.id,className:R(`relative z-10 min-h-9 min-w-max flex-1 touch-manipulation rounded-lg px-3 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,C===e.id?`text-fg`:`text-fg-muted hover:text-fg`),onClick:()=>{u.current=e.id,w(e.id),S(e.id,!0)},children:e.label},e.id)),t[22]=C,t[23]=E,t[24]=F):F=t[24];let I;return t[25]!==P||t[26]!==F?(I=(0,G.jsx)(B,{scrollFocusedItemIntoView:!1,as:`nav`,ref:l,"aria-label":P,className:`flex w-full gap-0.5 overflow-x-auto rounded-xl bg-surface-inset p-1`,indicatorClassName:`rounded-lg bg-surface-panel ring-1 ring-edge-subtle duration-300 [transition-timing-function:cubic-bezier(0.22,1,0.36,1)]`,children:F}),t[25]=P,t[26]=F,t[27]=I):I=t[27],I}function pt(e){return{id:e.dataset.taskSection,label:e.dataset.taskSectionLabel}}var mt=`Default criteria were not expanded into concrete acceptance items; broad completion cannot certify item coverage.`;function ht(e){let t=(0,W.c)(64),{criterion:n,index:r,language:i,closed:a,pending:o,onReview:s,projectId:c,conversationId:l}=e,u=i===`zh`,d=(0,U.useId)(),f=n.status===`passed`,p=n.evidence.length>0||n.method||n.review||n.note,m=n.verificationStatus===`passed`?u?`通过`:`Passed`:n.verificationStatus===`failed`?u?`未通过`:`Failed`:u?`未核验`:`Unverified`,h=n.review?.status===`passed`?u?`已验收`:`Accepted`:n.review?.status===`failed`?u?`未通过`:`Failed`:u?`已撤销验收`:`Acceptance cleared`,g=!a&&!o&&`cursor-pointer`,_;t[0]===g?_=t[1]:(_=R(`relative grid size-11 shrink-0 place-items-center rounded-full`,g),t[0]=g,t[1]=_);let v=o||void 0,y;t[2]!==r||t[3]!==s||t[4]!==o?(y=e=>{o||s(r,e.target.checked?`passed`:`unverified`)},t[2]=r,t[3]=s,t[4]=o,t[5]=y):y=t[5];let b;t[6]!==f||t[7]!==a||t[8]!==v||t[9]!==y||t[10]!==d?(b=(0,G.jsx)(`input`,{type:`checkbox`,"aria-labelledby":d,className:`peer sr-only`,checked:f,disabled:a,"aria-disabled":v,onChange:y}),t[6]=f,t[7]=a,t[8]=v,t[9]=y,t[10]=d,t[11]=b):b=t[11];let x=f?`border-edge bg-surface-inset text-fg`:`border-fg-subtle/70`,S=!a&&!o&&`hover:bg-surface-hover`,C;t[12]!==x||t[13]!==S?(C=R(`grid size-5 place-items-center rounded-full border motion-safe:transition-colors motion-safe:duration-150 peer-focus-visible:ring-2 peer-focus-visible:ring-accent peer-focus-visible:ring-offset-2 peer-focus-visible:ring-offset-surface-panel`,x,S),t[12]=x,t[13]=S,t[14]=C):C=t[14];let w;t[15]===f?w=t[16]:(w=f?(0,G.jsx)(te,{className:`size-3.5`,strokeWidth:2.8}):null,t[15]=f,t[16]=w);let T;t[17]!==C||t[18]!==w?(T=(0,G.jsx)(`span`,{"aria-hidden":!0,className:C,children:w}),t[17]=C,t[18]=w,t[19]=T):T=t[19];let E;t[20]!==T||t[21]!==_||t[22]!==b?(E=(0,G.jsxs)(`label`,{className:_,children:[b,T]}),t[20]=T,t[21]=_,t[22]=b,t[23]=E):E=t[23];let ee=`criterion:${r}:evidence`,D;t[24]!==n.text||t[25]!==d?(D=(0,G.jsx)(`span`,{id:d,className:`block whitespace-pre-wrap break-words text-sm leading-5 text-fg [overflow-wrap:anywhere]`,children:n.text}),t[24]=n.text,t[25]=d,t[26]=D):D=t[26];let O=u?`验收依据`:`Acceptance evidence`,k;t[27]===O?k=t[28]:(k=(0,G.jsx)(`p`,{className:`font-medium text-fg`,children:O}),t[27]=O,t[28]=k);let A;t[29]!==n.method||t[30]!==m||t[31]!==u?(A=n.method?(0,G.jsxs)(`p`,{children:[u?`自动核验`:`Automatic verification`,` · `,m,n.method===`model_reviewed`?u?` · 模型审阅`:` · Model review`:``]}):null,t[29]=n.method,t[30]=m,t[31]=u,t[32]=A):A=t[32];let j;t[33]!==n.review||t[34]!==i||t[35]!==h||t[36]!==u?(j=n.review?(0,G.jsxs)(`p`,{children:[u?`人工验收`:`User review`,` · `,h,` · `,Ze(n.review.reviewedAt,i)]}):null,t[33]=n.review,t[34]=i,t[35]=h,t[36]=u,t[37]=j):j=t[37];let M;t[38]!==n.note||t[39]!==r||t[40]!==i?(M=n.note&&n.note!==mt?(0,G.jsx)(V,{content:rt(n.note,i),contentKey:`criterion:${r}:note`,language:i,markdown:!1}):null,t[38]=n.note,t[39]=r,t[40]=i,t[41]=M):M=t[41];let N;t[42]!==l||t[43]!==n.evidence||t[44]!==i||t[45]!==c?(N=(0,G.jsx)(it,{evidence:n.evidence,projectId:c,conversationId:l,language:i}),t[42]=l,t[43]=n.evidence,t[44]=i,t[45]=c,t[46]=N):N=t[46];let P;t[47]!==p||t[48]!==u?(P=p?null:(0,G.jsx)(`p`,{children:u?`暂无验收依据`:`No evidence yet`}),t[47]=p,t[48]=u,t[49]=P):P=t[49];let F;t[50]!==k||t[51]!==A||t[52]!==j||t[53]!==M||t[54]!==N||t[55]!==P?(F=(0,G.jsxs)(`div`,{className:`mb-3 space-y-2 rounded-lg bg-surface-inset px-3 py-2.5 text-xs leading-5 text-fg-muted`,children:[k,A,j,M,N,P]}),t[50]=k,t[51]=A,t[52]=j,t[53]=M,t[54]=N,t[55]=P,t[56]=F):F=t[56];let I;t[57]!==ee||t[58]!==D||t[59]!==F?(I=(0,G.jsx)(lt,{panelId:ee,chevron:!0,className:`min-w-0 flex-1`,summaryClassName:`-ms-1 min-h-11 cursor-pointer rounded-lg py-3 pe-2 ps-1 outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,title:D,children:F}),t[57]=ee,t[58]=D,t[59]=F,t[60]=I):I=t[60];let ne;return t[61]!==E||t[62]!==I?(ne=(0,G.jsxs)(`li`,{className:`relative flex min-w-0 items-start px-2 before:absolute before:end-0 before:start-13 before:top-0 before:border-t before:border-edge-subtle first:before:hidden sm:px-3`,children:[E,I]}),t[61]=E,t[62]=I,t[63]=ne):ne=t[63],ne}function gt(e){let t=(0,W.c)(40),{criteria:n,language:r,closed:i,pending:a,blockedReason:o,error:s,onReview:c,projectId:l,conversationId:u,reviewDisabled:d}=e,f=r===`zh`,p;t[0]===n?p=t[1]:(p=n.some(_t),t[0]=n,t[1]=p);let m=p,h;t[2]!==m||t[3]!==r||t[4]!==f?(h=m?(0,G.jsx)(lt,{panelId:`acceptance:diagnostic`,title:f?`验收标准需要细化`:`The criteria need more detail`,className:`mx-4 mb-2 text-xs leading-5 text-fg-muted`,children:(0,G.jsx)(`p`,{className:`mt-2 break-words`,children:rt(mt,r)})}):null,t[2]=m,t[3]=r,t[4]=f,t[5]=h):h=t[5];let g=a||void 0,_;if(t[6]!==i||t[7]!==u||t[8]!==n||t[9]!==r||t[10]!==c||t[11]!==a||t[12]!==l||t[13]!==d){let e;t[15]!==i||t[16]!==u||t[17]!==r||t[18]!==c||t[19]!==a||t[20]!==l||t[21]!==d?(e=(e,t)=>(0,G.jsx)(ht,{criterion:e,index:t,language:r,closed:i||!!d,pending:a,onReview:c,projectId:l,conversationId:u},`${t}:${e.text}`),t[15]=i,t[16]=u,t[17]=r,t[18]=c,t[19]=a,t[20]=l,t[21]=d,t[22]=e):e=t[22],_=n.map(e),t[6]=i,t[7]=u,t[8]=n,t[9]=r,t[10]=c,t[11]=a,t[12]=l,t[13]=d,t[14]=_}else _=t[14];let v;t[23]!==g||t[24]!==_?(v=(0,G.jsx)(`ul`,{"aria-busy":g,className:`border-t border-edge-subtle`,children:_}),t[23]=g,t[24]=_,t[25]=v):v=t[25];let y;t[26]!==n.length||t[27]!==f?(y=n.length===0?(0,G.jsx)(`p`,{className:`px-4 py-4 text-sm text-fg-muted`,children:f?`尚未定义验收标准`:`No acceptance criteria defined`}):null,t[26]=n.length,t[27]=f,t[28]=y):y=t[28];let b;t[29]===s?b=t[30]:(b=s?(0,G.jsx)(`p`,{role:`alert`,className:`mx-4 my-2 text-sm text-danger`,children:s}):null,t[29]=s,t[30]=b);let x;t[31]!==o||t[32]!==i?(x=!i&&o?(0,G.jsx)(`p`,{className:`border-t border-edge-subtle px-4 py-2.5 text-xs text-fg-muted`,children:o}):null,t[31]=o,t[32]=i,t[33]=x):x=t[33];let S;return t[34]!==h||t[35]!==v||t[36]!==y||t[37]!==b||t[38]!==x?(S=(0,G.jsxs)(G.Fragment,{children:[h,v,y,b,x]}),t[34]=h,t[35]=v,t[36]=y,t[37]=b,t[38]=x,t[39]=S):S=t[39],S}function _t(e){return e.note===mt}function vt(e){let t=(0,W.c)(27),{detail:n,language:r}=e,i=r===`zh`,o=a(),s;if(t[0]!==n||t[1]!==r||t[2]!==o||t[3]!==i){let e=n.deliverables??[],a=ye(n),l=a&&H(a,r),u;if(t[5]!==n.runs||t[6]!==n.task){let e;t[8]===n.task?e=t[9]:(e=e=>e.contractVersion===n.task.latestContractVersion,t[8]=n.task,t[9]=e),u=new Set(n.runs.filter(e).map(Tt)),t[5]=n.runs,t[6]=n.task,t[7]=u}else u=t[7];let d=u,f=n.context.filter(wt).map(Ct),p=new Set(e.flatMap(St).filter(Boolean)),m=new Set([...f.map(xt),...p].filter(Boolean)),h;t[10]===d?h=t[11]:(h=e=>d.has(e.runId),t[10]=d,t[11]=h);for(let e of n.receipts.filter(h))for(let t of e.evidence.filter(bt))t.uri&&m.has(t.uri)||(t.uri&&m.add(t.uri),f.push(t));let g=l?.summary,_=g&&g.length<=160&&!g.includes(`
2
2
  `)&&!/\b(?:Claim|Criterion|Research claim)\b|c-ac\d|Default criteria were not/i.test(g)?g:void 0,v=f.filter(e=>!p.has(e.uri)),y=i?`交付结果`:`Deliverables`,b;t[12]===y?b=t[13]:(b=(0,G.jsx)(`h2`,{id:`task-results-heading`,className:`text-sm font-semibold text-fg`,children:y}),t[12]=y,t[13]=b);let x;t[14]!==e||t[15]!==n||t[16]!==o||t[17]!==i?(x=e.length?(0,G.jsx)(`ul`,{className:`mt-3 grid gap-2 sm:grid-cols-2`,children:e.map(e=>{let t=e.artifact?.title??e.reference?.title??e.id;return(0,G.jsxs)(`li`,{className:`min-w-0`,children:[(0,G.jsxs)($e,{item:e,conversationId:e.task?.conversationId??n.conversation.activeConversationId,backgroundPath:`${o.pathname}${o.search}`,zh:i,className:`flex min-h-11 w-full min-w-0 items-center gap-2 rounded-lg bg-surface-inset px-3 py-2 text-left text-sm text-fg hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,G.jsx)(I,{name:t}),(0,G.jsx)(`span`,{className:`min-w-0 break-words [overflow-wrap:anywhere]`,children:t})]}),e.artifact?.availability===`available`&&e.artifact.uri?.startsWith(`media://outbound/`)?(0,G.jsx)(C,{file:e.artifact,zh:i}):null]},e.id)})}):null,t[14]=e,t[15]=n,t[16]=o,t[17]=i,t[18]=x):x=t[18];let S;t[19]!==n||t[20]!==r||t[21]!==v?(S=v.length?(0,G.jsx)(it,{evidence:v,language:r,projectId:n.task.projectId,conversationId:n.conversation.activeConversationId??void 0,compact:!0}):null,t[19]=n,t[20]=r,t[21]=v,t[22]=S):S=t[22];let w;t[23]!==e||t[24]!==v.length||t[25]!==i?(w=!e.length&&!v.length?(0,G.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:i?`尚无可查看的交付物`:`No deliverables available yet`}):null,t[23]=e,t[24]=v.length,t[25]=i,t[26]=w):w=t[26],s=(0,G.jsxs)(`section`,{"aria-label":i?`交付结果`:`Deliverables`,className:`rounded-xl bg-surface-panel p-4`,children:[b,_?(0,G.jsx)(`p`,{className:`mt-2 break-words text-sm leading-6 text-fg-muted [overflow-wrap:anywhere]`,children:_}):null,a&&a.completionVerdict!==`achieved`?(0,G.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:i?`本次执行尚未报告目标全部达成。`:`This run has not reported the full goal achieved.`}):null,x,S,w,a?null:(0,G.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:i?`尚无本版任务的执行结果`:`No run result for this task version`}),a&&l&&(a.needsUser||l.remainingWork.length>0||l.nextAction)?(0,G.jsxs)(`div`,{className:`mt-4 space-y-2 border-t border-edge-subtle pt-3`,"aria-label":i?`执行待办`:`Run follow-up`,children:[(0,G.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:a.needsUser?i?`需要你决定`:`Your decision needed`:i?`待处理事项`:`Remaining work`}),l.remainingWork.length>0?(0,G.jsx)(`ul`,{className:`space-y-2 text-sm leading-6 text-fg`,children:l.remainingWork.map(yt)}):null,l.nextAction?(0,G.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-sm leading-6 text-fg [overflow-wrap:anywhere]`,children:l.nextAction}):null,a.needsUser?(0,G.jsx)(c,{className:`inline-flex min-h-9 items-center rounded-sm text-xs font-medium text-accent-fg hover:underline focus-visible:ring-2 focus-visible:ring-accent/40`,to:ae(n.task.id),children:i?`查看并决定`:`Review and decide`}):null]}):null]}),t[0]=n,t[1]=r,t[2]=o,t[3]=i,t[4]=s}else s=t[4];return s}function yt(e){return(0,G.jsx)(`li`,{className:`whitespace-pre-wrap break-words [overflow-wrap:anywhere]`,children:e},e)}function bt(e){return e.kind===`artifact`}function xt(e){return e.uri}function St(e){return[e.artifact?.uri,e.artifact?.shareUrl,e.artifact?.workspaceRelativePath]}function Ct(e){return{kind:[`file`,`url`].includes(e.targetKind)?`artifact`:`source`,title:e.title??e.targetId,summary:``,...[`file`,`url`].includes(e.targetKind)?{uri:e.targetId}:{},provenance:`user`,strength:`observed`,observedAt:0}}function wt(e){return e.role===`deliverable`}function Tt(e){return e.id}function Et(e){let t=(0,W.c)(14),{detail:n,receipt:r,language:i}=e,a;t[0]!==n.runs||t[1]!==i||t[2]!==r?(a=H(r,i,n.runs.find(e=>e.id===r.runId)?.terminalMessage),t[0]=n.runs,t[1]=i,t[2]=r,t[3]=a):a=t[3];let o=a,s;t[4]===o.issue?s=t[5]:(s=o.issue?(0,G.jsx)(at,{issue:o.issue}):null,t[4]=o.issue,t[5]=s);let c;t[6]!==n.task||t[7]!==i||t[8]!==r||t[9]!==o.summary?(c=o.summary?(0,G.jsx)(V,{content:o.summary,contentKey:`${n.task.id}:result:${r.runId}`,language:i}):null,t[6]=n.task,t[7]=i,t[8]=r,t[9]=o.summary,t[10]=c):c=t[10];let l;return t[11]!==s||t[12]!==c?(l=(0,G.jsxs)(G.Fragment,{children:[s,c]}),t[11]=s,t[12]=c,t[13]=l):l=t[13],l}function Dt(e){let t=(0,W.c)(19),{detail:n,language:r}=e,i=r===`zh`,a=Me(r),o;t[0]===n?o=t[1]:(o=ye(n),t[0]=n,t[1]=o);let s=o,c;t[2]===s?.runId?c=t[3]:(c=e=>e.runId!==s?.runId,t[2]=s?.runId,t[3]=c);let l=n.receipts.filter(c),[u,d]=(0,U.useState)(`idle`),f;t[4]===s?f=t[5]:(f=async function(e){if(s){d(`pending`);try{await _e(s.runId,e),d(`saved`)}catch{d(`failed`)}}},t[4]=s,t[5]=f);let p=f,m;t[6]!==n||t[7]!==r?(m=(0,G.jsx)(S,{detail:n,language:r}),t[6]=n,t[7]=r,t[8]=m):m=t[8];let h=s?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,G.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:a.latestResult}),(0,G.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[a.receiptStatuses[s.status],` · `,a.verificationStatuses[s.verification.status]]})]}),(0,G.jsx)(Et,{detail:n,receipt:s,language:r}),s.evidence.length>0?(0,G.jsxs)(`details`,{children:[(0,G.jsxs)(`summary`,{className:`cursor-pointer py-2 text-xs text-fg-muted`,children:[i?`验证依据与执行产物`:`Evidence and artifacts`,` · `,s.evidence.length]}),(0,G.jsx)(it,{evidence:s.evidence,projectId:n.task.projectId,conversationId:n.conversation.activeConversationId??void 0,language:r})]}):null,(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-t border-edge-subtle pt-3`,children:[(0,G.jsx)(z,{variant:`ghost`,className:`min-h-9 px-2 text-xs`,disabled:u===`pending`,onClick:()=>void p(`helpful`),children:a.doneWell}),(0,G.jsx)(z,{variant:`ghost`,className:`min-h-9 px-2 text-xs`,disabled:u===`pending`,onClick:()=>void p(`not_helpful`),children:a.needsFix}),u===`saved`?(0,G.jsx)(`span`,{role:`status`,className:`text-xs text-fg-muted`,children:i?`反馈已记录`:`Feedback saved`}):null,u===`failed`?(0,G.jsx)(`span`,{role:`alert`,className:`text-xs text-danger`,children:a.actionFailed}):null]})]}):null,g=l.length>0?(0,G.jsxs)(`details`,{className:`border-t border-edge-subtle pt-3`,children:[(0,G.jsx)(`summary`,{className:`cursor-pointer py-2 text-xs text-fg-muted`,children:a.executionHistory.replace(`{{count}}`,String(l.length))}),(0,G.jsx)(`div`,{className:`mt-3 space-y-4`,children:l.map(e=>(0,G.jsxs)(`article`,{className:`space-y-2 rounded-lg bg-surface-hover p-3`,children:[(0,G.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.receiptStatuses[e.status]}),(0,G.jsx)(Et,{detail:n,receipt:e,language:r})]},e.runId))})]}):null,_;t[9]!==a||t[10]!==n.criterionReviewHistory||t[11]!==r||t[12]!==i?(_=n.criterionReviewHistory?.length?(0,G.jsxs)(`details`,{className:`border-t border-edge-subtle pt-3`,children:[(0,G.jsx)(`summary`,{className:`cursor-pointer py-2 text-xs text-fg-muted`,children:i?`历史验收判定`:`Past criterion reviews`}),(0,G.jsx)(`ul`,{className:`mt-2 space-y-2 text-sm`,children:n.criterionReviewHistory.map(e=>(0,G.jsxs)(`li`,{className:`rounded-lg bg-surface-hover p-3`,children:[(0,G.jsx)(`p`,{children:e.criterionText}),(0,G.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[a.verificationStatuses[e.status],` · `,Ze(e.reviewedAt,r)]}),e.note?(0,G.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:rt(e.note,r)}):null]},`${e.contractVersion}:${e.resultId??``}:${e.criterionIndex}`))})]}):null,t[9]=a,t[10]=n.criterionReviewHistory,t[11]=r,t[12]=i,t[13]=_):_=t[13];let v;return t[14]!==m||t[15]!==h||t[16]!==g||t[17]!==_?(v=(0,G.jsxs)(`div`,{className:`space-y-4`,children:[m,h,g,_]}),t[14]=m,t[15]=h,t[16]=g,t[17]=_,t[18]=v):v=t[18],v}function Ot(e){let t=(0,W.c)(33),{changes:n,language:r}=e,i=r===`zh`,a;t[0]===i?a=t[1]:(a=i?{backlog:`待办池`,ready:`就绪`,active:`进行中`,review:`待验收`,closed:`已关闭`}:{backlog:`Backlog`,ready:`Ready`,active:`Active`,review:`Review`,closed:`Closed`},t[0]=i,t[1]=a);let o=a,s;t[2]===i?s=t[3]:(s=i?{board:`看板`,mobile:`移动端`,api:`手动操作`,runtime:`自动流转`,undo:`撤销`}:{board:`Board`,mobile:`Mobile`,api:`Manual update`,runtime:`Automatic`,undo:`Undo`},t[2]=i,t[3]=s);let c=s,l;t[4]===i?l=t[5]:(l=i?{done:`完成`,cancelled:`取消`,duplicate:`重复`,wont_do:`不做`}:{done:`Done`,cancelled:`Cancelled`,duplicate:`Duplicate`,wont_do:`Won’t do`},t[4]=i,t[5]=l);let u=l,d;t[6]===i?d=t[7]:(d=i?{user:`用户`,agent:`Agent`,system:`系统`,integration:`外部服务`}:{user:`User`,agent:`Agent`,system:`System`,integration:`Integration`},t[6]=i,t[7]=d);let f=d,p=i?`变更记录`:`Change log`,m;t[8]!==n.length||t[9]!==p?(m=(0,G.jsxs)(`summary`,{className:`cursor-pointer text-sm font-semibold text-fg`,children:[p,` (`,n.length,`)`]}),t[8]=n.length,t[9]=p,t[10]=m):m=t[10];let h;if(t[11]!==f||t[12]!==n||t[13]!==r||t[14]!==o||t[15]!==u||t[16]!==c){let e;t[18]!==f||t[19]!==r||t[20]!==o||t[21]!==u||t[22]!==c?(e=e=>(0,G.jsxs)(`li`,{className:`text-sm text-fg`,children:[(0,G.jsxs)(`div`,{children:[o[e.fromPhase],e.fromResolution?` · ${u[e.fromResolution]}`:``,` → `,o[e.toPhase],e.toResolution?` · ${u[e.toResolution]}`:``]}),(0,G.jsxs)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:[f[e.actor.kind],e.actor.id?` (${e.actor.id})`:``,` · `,c[e.source],` · `,(0,G.jsx)(`time`,{dateTime:new Date(e.createdAt).toISOString(),children:Ze(e.createdAt,r)})]})]},e.id),t[18]=f,t[19]=r,t[20]=o,t[21]=u,t[22]=c,t[23]=e):e=t[23],h=[...n].reverse().map(e),t[11]=f,t[12]=n,t[13]=r,t[14]=o,t[15]=u,t[16]=c,t[17]=h}else h=t[17];let g;t[24]===h?g=t[25]:(g=(0,G.jsx)(`ol`,{className:`mt-3 max-h-80 space-y-3 overflow-y-auto`,children:h}),t[24]=h,t[25]=g);let _;t[26]!==n.length||t[27]!==i?(_=n.length?null:(0,G.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:i?`暂无阶段变更记录`:`No phase changes yet`}),t[26]=n.length,t[27]=i,t[28]=_):_=t[28];let v;return t[29]!==m||t[30]!==g||t[31]!==_?(v=(0,G.jsxs)(`details`,{className:`rounded-xl border border-edge bg-surface-panel p-4`,children:[m,g,_]}),t[29]=m,t[30]=g,t[31]=_,t[32]=v):v=t[32],v}function kt({schedules:e,language:t,onEdit:n,onUpdated:r}){let i=t===`zh`,a=p(t),[o,s]=(0,U.useState)(null),l=(0,U.useRef)(!1),[u,d]=(0,U.useState)(null),f=e=>new Date(e).toLocaleString(i?`zh-CN`:`en-US`,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,timeZoneName:`short`});async function m(e){if(!l.current){l.current=!0,s(e.id),d(null);try{r((await Fe.update(e.id,{enabled:!1,expectedRevision:e.updatedAtMs})).automation)}catch(e){d(e instanceof Error?e.message:a.automations.feedback.actionFailed)}finally{l.current=!1,s(null)}}}return(0,G.jsxs)(`section`,{"aria-label":i?`执行时间`:`Execution schedule`,className:`rounded-xl bg-surface-inset p-4`,children:[(0,G.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:i?`执行时间`:`Execution schedule`}),(0,G.jsx)(`div`,{className:`mt-3 space-y-4`,children:e.map(e=>{let r=e.trigger.kind===`schedule`?e.trigger.schedule:null,s=k(e),l=!e.management||e.management.editable.includes(`trigger`),u=!e.management||e.management.editable.includes(`enabled`);return(0,G.jsxs)(`article`,{className:`space-y-2 text-sm text-fg`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,G.jsx)(`span`,{className:`break-words font-medium`,children:e.name}),(0,G.jsx)(`span`,{className:`text-xs text-fg-muted`,children:s?i?`已执行`:`Completed`:e.enabled?i?`已启用`:`Enabled`:i?`已取消定时执行`:`Scheduling disabled`})]}),(0,G.jsx)(`p`,{children:r?.kind===`once`?`${i?`单次执行:`:`Run once: `}${f(Date.parse(r.at))}`:O(e.trigger,a.automations,a.cron,t)}),r?.kind===`cron`?(0,G.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[i?`执行时区:`:`Schedule timezone: `,r.tz||(i?`服务所在电脑时区`:`Server timezone`)]}):null,(0,G.jsxs)(`p`,{className:`text-fg-muted`,children:[i?`下次执行:`:`Next run: `,s?i?`已执行,无后续计划`:`Completed; no upcoming run`:e.enabled?e.state.nextRunAtMs===void 0?i?`暂无后续执行`:`No upcoming run`:f(e.state.nextRunAtMs):i?`已取消,不再自动执行`:`Disabled; no automatic runs`]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[l?(0,G.jsx)(z,{variant:`secondary`,disabled:o!==null,onClick:()=>n(e),children:i?`修改时间`:`Edit schedule`}):null,e.enabled&&u?(0,G.jsx)(z,{variant:`ghost`,disabled:o!==null,onClick:()=>void m(e),children:o===e.id?i?`正在取消…`:`Cancelling…`:i?`取消定时执行`:`Cancel schedule`}):null,(0,G.jsx)(z,{asChild:!0,variant:`ghost`,children:(0,G.jsx)(c,{to:`/automations?automation=${encodeURIComponent(e.id)}`,children:i?`查看自动化`:`View automation`})})]})]},e.id)})}),u?(0,G.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-danger`,children:u}):null]})}var At=`w-full rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg focus-visible:outline-2 focus-visible:outline-accent`;function jt({taskId:e,taskTitle:t,projectId:n,executorAgentId:r,language:i,onClose:a,onCreated:o,automation:s}){let l=i===`zh`,u=p(i).automations,[d,f]=(0,U.useState)(()=>s?We(s):{...Ge,name:t,projectId:n??``,actionMode:`task_command`,taskId:e,agentId:r??``,triggerMode:`once`,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`}),[x,S]=(0,U.useState)(null),[C,w]=(0,U.useState)(!1),T=(0,U.useRef)(!1),[E,ee]=(0,U.useState)(null),D=e=>f(t=>({...t,...e}));async function O(e){if(e.preventDefault(),!(T.current||x)&&(ee(null),!(!d.name.trim()||!s&&!r))){if(d.triggerMode===`once`&&(!Number.isFinite(new Date(d.onceAt).getTime())||new Date(d.onceAt).getTime()<=Date.now())){ee(u.experience.futureTime);return}T.current=!0,w(!0);try{let e=s?Ke(s,d).trigger:Je(d).trigger,{automation:t}=s?await Fe.update(s.id,{trigger:e,...s.management?{}:{name:d.name.trim(),delivery:{...s.delivery,notificationPolicy:d.notificationPolicy}},...!s.management||s.management.editable.includes(`enabled`)?{enabled:!0}:{},expectedRevision:s.updatedAtMs}):await Fe.create({...Je(d),enabled:!0});S(t),o(t)}catch(e){ee(e instanceof Error?e.message:u.feedback.actionFailed)}finally{T.current=!1,w(!1)}}}return(0,G.jsx)(b,{open:!0,onOpenChange:e=>{!e&&!T.current&&a()},children:(0,G.jsxs)(_,{children:[(0,G.jsx)(m,{className:`fixed inset-0 z-[110] bg-black/45`}),(0,G.jsxs)(v,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[111] flex h-[min(38rem,calc(100dvh-2rem))] w-[min(32rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-popover outline-none`,children:[(0,G.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-3 border-b border-edge-subtle px-5 py-4`,children:[(0,G.jsx)(y,{className:`text-base font-semibold text-fg`,children:s?l?`修改执行时间`:`Edit execution schedule`:l?`设置执行时间`:`Set execution time`}),(0,G.jsx)(g,{asChild:!0,children:(0,G.jsx)(z,{variant:`ghost`,className:`size-9 p-0`,disabled:C,"aria-label":l?`关闭`:`Close`,children:(0,G.jsx)(L,{className:`size-4`})})})]}),(0,G.jsx)(h,{className:`sr-only`,children:l?`为当前任务创建定时或周期自动化。`:`Create a scheduled or recurring automation for this task.`}),x?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-5`,children:[(0,G.jsx)(`p`,{role:`status`,className:`text-sm font-medium text-fg`,children:s?l?`执行时间已更新`:`Schedule updated`:l?`执行时间已设置`:`Schedule created`}),(0,G.jsx)(`p`,{className:`break-words text-sm text-fg-muted`,children:x.name}),(0,G.jsx)(z,{asChild:!0,variant:`primary`,children:(0,G.jsx)(c,{to:`/automations?automation=${encodeURIComponent(x.id)}`,children:l?`查看自动化`:`View automation`})})]}),(0,G.jsx)(`footer`,{className:`shrink-0 border-t border-edge-subtle p-4`,children:(0,G.jsx)(z,{onClick:a,children:l?`完成`:`Done`})})]}):(0,G.jsxs)(`form`,{onSubmit:e=>void O(e),className:`flex min-h-0 flex-1 flex-col`,children:[(0,G.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-5`,children:[(0,G.jsxs)(`p`,{className:`break-words text-sm text-fg-muted`,children:[l?`执行任务:`:`Task: `,t]}),(0,G.jsxs)(`fieldset`,{disabled:C,className:`space-y-4`,children:[(0,G.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[u.form.name,(0,G.jsx)(`input`,{required:!0,readOnly:!!s?.management,className:At,value:d.name,onChange:e=>D({name:e.target.value})})]}),(0,G.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[u.form.trigger,(0,G.jsxs)(j,{value:d.triggerMode,onChange:e=>D({triggerMode:e.target.value}),children:[s?.trigger.kind===`schedule`&&s.trigger.schedule.kind===`interval`?(0,G.jsx)(M,{value:`interval`,children:l?`固定间隔`:`Fixed interval`}):null,s?.trigger.kind===`schedule`&&s.trigger.schedule.kind===`cron`?(0,G.jsx)(M,{value:`cron`,children:l?`自定义规则`:`Custom schedule`}):null,(0,G.jsx)(M,{value:`once`,children:u.trigger.once}),(0,G.jsx)(M,{value:`daily`,children:u.trigger.daily}),(0,G.jsx)(M,{value:`weekly`,children:u.trigger.weekly})]})]}),d.triggerMode===`once`?(0,G.jsx)(tt,{label:u.form.onceAt,disabled:C,value:d.onceAt,defaultTime:d.time,onChange:e=>D({onceAt:e})}):[`daily`,`weekly`].includes(d.triggerMode)?(0,G.jsxs)(`div`,{className:`grid gap-2 text-sm text-fg`,children:[(0,G.jsx)(`span`,{children:u.form.time}),(0,G.jsx)(Xe,{disabled:C,value:d.time,onChange:e=>D({time:e}),ariaLabel:u.form.time})]}):null,d.triggerMode===`weekly`?(0,G.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[u.form.day,(0,G.jsx)(j,{value:d.weekday,onChange:e=>D({weekday:e.target.value}),children:[`sunday`,`monday`,`tuesday`,`wednesday`,`thursday`,`friday`,`saturday`].map((e,t)=>(0,G.jsx)(M,{value:String(t),children:u.weekdays[e]},e))})]}):null,d.triggerMode===`cron`?(0,G.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[l?`定时规则`:`Cron expression`,(0,G.jsx)(`input`,{required:!0,className:At,value:d.cronExpr,onChange:e=>D({cronExpr:e.target.value})})]}):null,d.triggerMode===`interval`?(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,G.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[l?`执行间隔`:`Interval`,(0,G.jsx)(`input`,{required:!0,type:`number`,min:`1`,className:At,value:d.intervalValue,onChange:e=>D({intervalValue:e.target.value})})]}),(0,G.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[l?`单位`:`Unit`,(0,G.jsxs)(j,{value:d.intervalUnit,onChange:e=>D({intervalUnit:e.target.value}),children:[(0,G.jsx)(M,{value:`minute`,children:l?`分钟`:`Minutes`}),(0,G.jsx)(M,{value:`hour`,children:l?`小时`:`Hours`}),(0,G.jsx)(M,{value:`day`,children:l?`天`:`Days`}),(0,G.jsx)(M,{value:`week`,children:l?`周`:`Weeks`})]})]})]}):null,(0,G.jsx)(qe,{form:d,onChange:D,language:i}),(0,G.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[u.draft.notifications,(0,G.jsxs)(j,{disabled:!!s?.management,value:d.notificationPolicy,onChange:e=>D({notificationPolicy:e.target.value}),children:[(0,G.jsx)(M,{value:`attention`,children:u.draft.notifyAttention}),(0,G.jsx)(M,{value:`all`,children:u.draft.notifyAll}),(0,G.jsx)(M,{value:`none`,children:u.draft.notifyNone})]})]})]}),!s&&!r?(0,G.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:l?`请先为任务指定执行 Agent。`:`Assign an executor agent to the task first.`}):null,E?(0,G.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:E}):null]}),(0,G.jsxs)(`footer`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle p-4`,children:[(0,G.jsx)(z,{type:`button`,variant:`ghost`,disabled:C,onClick:a,children:l?`取消`:`Cancel`}),(0,G.jsx)(z,{type:`submit`,variant:`primary`,disabled:C||!s&&!r||!d.name.trim()||d.triggerMode===`once`&&!d.onceAt,children:C?l?`正在保存…`:`Saving…`:s?s.enabled?l?`保存修改`:`Save changes`:l?`保存并启用`:`Save and enable`:l?`创建自动化`:`Create automation`})]})]})]})]})})}function Mt(e){let t=(0,W.c)(14),{detail:n,executorName:r,language:i,onUpdated:a,ref:o}=e,s=i===`zh`,l;if(t[0]!==n||t[1]!==r||t[2]!==i||t[3]!==a||t[4]!==o||t[5]!==s){let e=n.waits.find(Ft),u=n.allowedCommands.includes(`resolve_wait`)&&!e?n.waits.filter(Pt):[],d=n.presentation.status===`needsUser`,f=ye(n),p=n.runs.find(Nt),m={queued:s?`等待开始执行。`:`Waiting to start.`,running:r?s?`${r} 正在处理任务。`:`${r} is working on the task.`:s?`任务处理中。`:`The task is in progress.`,waiting:s?`任务正在等待继续。`:`The task is waiting to resume.`,verifying:s?`正在检查执行结果。`:`Checking the result.`},h=rt(n.presentation.reason??e?.reason??n.waits[0]?.reason??(n.task.phase===`closed`?f?.summary??(s?`任务已关闭,可查看交付物与执行结果。`:`The task is closed. Review its deliverables and results.`):n.task.phase===`review`?s?`请检查交付物并勾选通过的验收项。`:`Review the deliverables and check the criteria that pass.`:(p&&m[p.status])??f?.summary??(s?`任务尚未开始,可开始执行或设置执行时间。`:`Start the task or set an execution time.`)),i),g=n.attention.length>0?(0,G.jsx)(`ul`,{className:`mt-3 space-y-3`,children:n.attention.map((e,t)=>{let r=u.some(t=>e.kind===`input_required`&&t.kind===`user_input`||e.kind===`approval_required`&&t.kind===`approval`),a=rt(e.summary,i);return(0,G.jsxs)(`li`,{className:`text-sm leading-6 text-fg-muted`,children:[(0,G.jsx)(V,{content:a,contentKey:`${n.task.id}:attention:${e.kind}:${t}`,language:i,previewHeight:72,children:(0,G.jsx)(T,{content:me(a),compact:!0,breaks:!0})}),!r&&(e.kind===`input_required`||e.kind===`approval_required`)?(0,G.jsx)(c,{className:`mt-2 inline-flex min-h-11 items-center rounded-lg bg-accent-soft px-3 font-medium text-accent-fg`,to:ae(n.task.id),children:s?e.kind===`approval_required`?`查看并决定`:`补充信息`:e.kind===`approval_required`?`Review decision`:`Provide information`}):null]},`${e.kind}-${t}`)})}):null,_=d?s?`需要你处理`:`Your action needed`:s?`当前进展`:`Current progress`,v=u.length>1?` · ${u.length}`:``,y;t[7]!==_||t[8]!==v?(y=(0,G.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[_,v]}),t[7]=_,t[8]=v,t[9]=y):y=t[9];let b;t[10]!==n||t[11]!==a||t[12]!==s?(b=e=>(0,G.jsx)(nt,{wait:e,detail:n,zh:s,onUpdated:a},e.id),t[10]=n,t[11]=a,t[12]=s,t[13]=b):b=t[13],l=(0,G.jsxs)(`section`,{ref:o,tabIndex:-1,"aria-label":s?`当前需要处理`:`Current action`,className:`rounded-xl bg-surface-panel p-4`,children:[y,u.map(b),u.length>0?g?(0,G.jsxs)(`details`,{className:`mt-3`,children:[(0,G.jsx)(`summary`,{className:`cursor-pointer text-xs text-fg-muted`,children:s?`等待详情`:`Waiting details`}),g]}):null:g??(0,G.jsx)(V,{content:h,contentKey:`${n.task.id}:current-progress`,language:i,previewHeight:72,className:`mt-2 text-sm leading-6 text-fg-muted`,children:(0,G.jsx)(T,{content:me(h),compact:!0})})]}),t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=l}else l=t[6];return l}function Nt(e){return!e.parentRunId&&[`queued`,`running`,`waiting`,`verifying`].includes(e.status)}function Pt(e){return(e.kind===`user_input`||e.kind===`approval`&&typeof e.condition.capability==`string`)&&e.condition.type!==`connection`}function Ft(e){return e.kind===`paused`}function It(e){let t=(0,W.c)(17),{children:n,contentKey:r,language:a,className:o}=e,s=(0,U.useId)(),c=U.Children.toArray(n),[l,u]=i(),d;t[0]!==r||t[1]!==l?(d=l.getAll(`taskExpanded`).includes(r),t[0]=r,t[1]=l,t[2]=d):d=t[2];let f=d,p=f?c:c.slice(0,3),m;t[3]!==s||t[4]!==p?(m=(0,G.jsx)(`ul`,{id:s,className:`space-y-1.5`,children:p}),t[3]=s,t[4]=p,t[5]=m):m=t[5];let h;t[6]!==r||t[7]!==f||t[8]!==s||t[9]!==c.length||t[10]!==a||t[11]!==u?(h=c.length>3?(0,G.jsx)(`button`,{type:`button`,"aria-expanded":f,"aria-controls":s,className:`mt-2 min-h-9 rounded-sm text-xs font-medium text-accent hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,onClick:()=>u(e=>{let t=new URLSearchParams(e),n=t.getAll(`taskExpanded`).filter(e=>e!==r);return t.delete(`taskExpanded`),n.forEach(e=>t.append(`taskExpanded`,e)),f||t.append(`taskExpanded`,r),t},{preventScrollReset:!0}),children:a===`zh`?f?`收起`:`查看全部(${c.length})`:f?`Show less`:`Show all (${c.length})`}):null,t[6]=r,t[7]=f,t[8]=s,t[9]=c.length,t[10]=a,t[11]=u,t[12]=h):h=t[12];let g;return t[13]!==o||t[14]!==m||t[15]!==h?(g=(0,G.jsxs)(`div`,{className:o,children:[m,h]}),t[13]=o,t[14]=m,t[15]=h,t[16]=g):g=t[16],g}function Lt({taskId:e}){let t=u(e=>e.conversationId),n=d(e=>e.language),[r,i]=(0,U.useState)(``),[a,o]=(0,U.useState)(null),[s,c]=(0,U.useState)(!1),[p,m]=(0,U.useState)(!1),[h,g]=(0,U.useState)([]),[_,v]=(0,U.useState)(null),y=l(`/api/tasks/${encodeURIComponent(e)}/collaboration`),{data:b,error:x,mutate:S}=he([`task-collaboration`,e,t],()=>f(`${y}?recent=1`),{revalidateOnFocus:!0}),C=[...new Map([...h,...b?.items??[]].map(e=>[e.id,e])).values()].sort((e,t)=>e.sequence-t.sequence),w=async()=>{let e=C[0];if(!(!e||p)){m(!0);try{let t=await f(`${y}?recent=1&beforeSequence=${e.sequence}`);g(e=>[...t.items,...e])}catch(e){v(e instanceof Error?e.message:String(e))}finally{m(!1)}}};(0,U.useEffect)(()=>{let t=t=>{let n=t.detail;(!n?.taskId||n.taskId===e)&&S()};return window.addEventListener(`task-collaboration-entry-added`,t),window.addEventListener(`gateway-realtime-connected`,t),()=>{window.removeEventListener(`task-collaboration-entry-added`,t),window.removeEventListener(`gateway-realtime-connected`,t)}},[S,e]);let T=async()=>{if(!(!r.trim()||s)){c(!0),v(null);try{await f(y,{method:`POST`,headers:{"idempotency-key":crypto.randomUUID()},body:JSON.stringify({kind:a?`answer`:`instruction`,body:r.trim(),...a?{causationId:a}:{}})}),i(``),o(null),await S()}catch(e){v(e instanceof Error?e.message:String(e))}finally{c(!1)}}};return(0,G.jsxs)(`section`,{className:`rounded-xl bg-surface-inset p-4`,children:[(0,G.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n===`zh`?`任务留言`:`Task updates`}),(0,G.jsxs)(`div`,{className:`mt-3 max-h-64 space-y-2 overflow-y-auto`,children:[!b&&!x?(0,G.jsxs)(`div`,{"aria-busy":`true`,className:`space-y-2`,children:[(0,G.jsx)(de,{className:`h-14 w-full`}),(0,G.jsx)(de,{className:`h-14 w-4/5`})]}):null,x?(0,G.jsx)(`p`,{role:`status`,className:`text-xs text-fg-muted`,children:n===`zh`?`暂时无法读取留言`:`Updates unavailable`}):null,C[0]&&C[0].sequence>1?(0,G.jsx)(`button`,{type:`button`,disabled:p,onClick:()=>void w(),className:`text-xs text-accent hover:underline disabled:opacity-50`,children:n===`zh`?`查看更早留言`:`Earlier updates`}):null,C.map(t=>(0,G.jsxs)(`div`,{className:`rounded-lg bg-surface-base px-3 py-2 text-sm`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-subtle`,children:[(0,G.jsx)(`span`,{children:t.authorKind===`worker_agent`?n===`zh`?`执行 Agent`:`Worker`:t.authorKind===`main_agent`?n===`zh`?`主 Agent`:`Main Agent`:t.authorKind===`system`?n===`zh`?`系统`:`System`:n===`zh`?`用户`:`You`}),(0,G.jsxs)(`span`,{children:[`· `,t.kind]}),t.deliveryStatus?(0,G.jsxs)(`span`,{children:[`· `,t.deliveryStatus]}):null]}),(0,G.jsx)(`div`,{className:`mt-1 min-w-0 text-fg`,"data-task-collaboration-body":!0,children:(0,G.jsx)(V,{content:t.body,contentKey:`${e}:update:${t.id}`,language:n,breaks:!0,previewHeight:120})}),t.kind===`question`&&t.authorKind===`worker_agent`?(0,G.jsx)(`button`,{type:`button`,className:`mt-2 text-xs text-accent hover:underline`,onClick:()=>o(t.id),children:n===`zh`?`回复问题`:`Reply`}):null]},t.id)),b&&!C.length?(0,G.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n===`zh`?`暂无进展留言`:`No updates yet`}):null]}),a?(0,G.jsxs)(`p`,{className:`mt-3 text-xs text-accent`,children:[n===`zh`?`正在回复执行 Agent 的问题`:`Replying to the worker`,(0,G.jsx)(`button`,{type:`button`,className:`ml-2 underline`,onClick:()=>o(null),children:n===`zh`?`取消`:`Cancel`})]}):null,(0,G.jsx)(`textarea`,{value:r,onChange:e=>i(e.target.value),rows:2,"aria-label":n===`zh`?`任务留言`:`Task message`,placeholder:n===`zh`?`给执行 Agent 留言`:`Message the worker`,className:`mt-3 w-full resize-y rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`}),_?(0,G.jsx)(`p`,{role:`alert`,className:`mt-1 text-xs text-danger`,children:_}):null,(0,G.jsx)(`button`,{type:`button`,disabled:!r.trim()||s,onClick:()=>void T(),className:`mt-2 rounded-lg bg-accent px-3 py-2 text-xs font-medium text-white disabled:opacity-50`,children:s?n===`zh`?`发送中`:`Sending`:n===`zh`?`发送`:`Send`})]})}function Rt(e,t,n,r){return!!(e&&t!==e.version&&n!==e.value&&r!==n)}function zt(e,t){let n={...e.task};t.title!==void 0&&(n.title=t.title),t.priority!==void 0&&(n.priority=t.priority);for(let e of[`body`,`projectId`,`milestoneId`,`parentTaskId`,`dueAt`,`ownerId`]){let r=t[e];r!==void 0&&(r===null?delete n[e]:Object.assign(n,{[e]:r}))}return n.version+=1,n.updatedAt=Date.now(),{...e,task:n}}function Bt(e,t){return(t===`zh`?{backlog:`待规划`,ready:`就绪`,active:`进行中`,review:`待验收`,closed:`已关闭`}:{backlog:`Backlog`,ready:`Ready`,active:`Active`,review:`Review`,closed:`Closed`})[e]}function Vt(e){if(e===void 0)return``;let t=new Date(e);return new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,10)}function Ht(e){return e?new Date(`${e}T23:59:59.999`).getTime():null}var Ut=[`backlog`,`ready`,`active`,`review`,`closed`],Wt=[`low`,`normal`,`high`,`critical`],Gt=(0,U.memo)(function(e){let t=(0,W.c)(20),{value:n,disabled:r,canMove:i,canApprove:a,canReopen:o,language:s,label:c,onChange:l}=e,u;t[0]!==a||t[1]!==i||t[2]!==o||t[3]!==n?(u=e=>e!==n&&!i&&!(e===`closed`?a:n===`closed`&&o),t[0]=a,t[1]=i,t[2]=o,t[3]=n,t[4]=u):u=t[4];let d=u,f;t[5]===c?f=t[6]:(f=(0,G.jsx)(`span`,{children:c}),t[5]=c,t[6]=f);let p;t[7]===l?p=t[8]:(p=e=>l(e.target.value),t[7]=l,t[8]=p);let m;t[9]!==s||t[10]!==d?(m=Ut.map(e=>(0,G.jsx)(M,{value:e,disabled:d(e),children:Bt(e,s)},e)),t[9]=s,t[10]=d,t[11]=m):m=t[11];let h;t[12]!==r||t[13]!==p||t[14]!==m||t[15]!==n?(h=(0,G.jsx)(j,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:p,children:m}),t[12]=r,t[13]=p,t[14]=m,t[15]=n,t[16]=h):h=t[16];let g;return t[17]!==f||t[18]!==h?(g=(0,G.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[f,h]}),t[17]=f,t[18]=h,t[19]=g):g=t[19],g}),Kt=(0,U.memo)(function(e){let t=(0,W.c)(14),{value:n,disabled:r,label:i,labels:a,onChange:o}=e,s;t[0]===i?s=t[1]:(s=(0,G.jsx)(`span`,{children:i}),t[0]=i,t[1]=s);let c;t[2]===o?c=t[3]:(c=e=>o(e.target.value),t[2]=o,t[3]=c);let l;t[4]===a?l=t[5]:(l=Wt.map(e=>(0,G.jsx)(M,{value:e,children:a[e]},e)),t[4]=a,t[5]=l);let u;t[6]!==r||t[7]!==c||t[8]!==l||t[9]!==n?(u=(0,G.jsx)(j,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:c,children:l}),t[6]=r,t[7]=c,t[8]=l,t[9]=n,t[10]=u):u=t[10];let d;return t[11]!==s||t[12]!==u?(d=(0,G.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[s,u]}),t[11]=s,t[12]=u,t[13]=d):d=t[13],d}),qt=(0,U.memo)(function(e){let t=(0,W.c)(10),{value:n,disabled:r,label:i,onChange:a}=e,o;t[0]===i?o=t[1]:(o=(0,G.jsx)(`span`,{children:i}),t[0]=i,t[1]=o);let s;t[2]!==r||t[3]!==i||t[4]!==a||t[5]!==n?(s=(0,G.jsx)(Ye,{disabled:r,value:n,onChange:a,ariaLabel:i}),t[2]=r,t[3]=i,t[4]=a,t[5]=n,t[6]=s):s=t[6];let c;return t[7]!==o||t[8]!==s?(c=(0,G.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[o,s]}),t[7]=o,t[8]=s,t[9]=c):c=t[9],c}),Jt=(0,U.memo)(function(e){let t=(0,W.c)(36),{value:n,disabled:r,label:i,unassignedLabel:a,agents:o,language:s,onChange:c}=e,l,u,d,f,m,h,g,_,v,y;if(t[0]!==o||t[1]!==r||t[2]!==i||t[3]!==s||t[4]!==c||t[5]!==a||t[6]!==n){let{agentsSettings:e}=p(s);v=`grid gap-1.5 text-xs text-fg-muted`,t[17]===i?y=t[18]:(y=(0,G.jsx)(`span`,{children:i}),t[17]=i,t[18]=y),l=j,u=`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,d=`border-0`,f=n,m=r,t[19]===c?h=t[20]:(h=e=>c(e.target.value),t[19]=c,t[20]=h),t[21]===a?g=t[22]:(g=(0,G.jsx)(M,{value:``,disabled:!0,children:a}),t[21]=a,t[22]=g),_=o.map(t=>(0,G.jsx)(M,{value:t.id,children:Ie(t,e)},t.id)),t[0]=o,t[1]=r,t[2]=i,t[3]=s,t[4]=c,t[5]=a,t[6]=n,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=m,t[12]=h,t[13]=g,t[14]=_,t[15]=v,t[16]=y}else l=t[7],u=t[8],d=t[9],f=t[10],m=t[11],h=t[12],g=t[13],_=t[14],v=t[15],y=t[16];let b;t[23]!==l||t[24]!==u||t[25]!==d||t[26]!==f||t[27]!==m||t[28]!==h||t[29]!==g||t[30]!==_?(b=(0,G.jsxs)(l,{triggerClassName:u,contentClassName:d,value:f,disabled:m,onChange:h,children:[g,_]}),t[23]=l,t[24]=u,t[25]=d,t[26]=f,t[27]=m,t[28]=h,t[29]=g,t[30]=_,t[31]=b):b=t[31];let x;return t[32]!==b||t[33]!==v||t[34]!==y?(x=(0,G.jsxs)(`label`,{className:v,children:[y,b]}),t[32]=b,t[33]=v,t[34]=y,t[35]=x):x=t[35],x}),Yt=(0,U.memo)(function(e){let t=(0,W.c)(9),{candidates:n,selected:r,disabled:i,labels:a,getTaskHref:o,onChange:s}=e,c;t[0]===r?c=t[1]:(c=r.map(rn),t[0]=r,t[1]=c);let l;return t[2]!==n||t[3]!==i||t[4]!==o||t[5]!==a||t[6]!==s||t[7]!==c?(l=(0,G.jsx)(st,{borderless:!0,candidates:n,selectedIds:c,disabled:i,getTaskHref:o,onChange:s,labels:a}),t[2]=n,t[3]=i,t[4]=o,t[5]=a,t[6]=s,t[7]=c,t[8]=l):l=t[8],l},(e,t)=>e.disabled===t.disabled&&e.labels===t.labels&&e.getTaskHref===t.getTaskHref&&e.onChange===t.onChange&&e.candidates.length===t.candidates.length&&e.candidates.every((e,n)=>e.id===t.candidates[n]?.id&&e.title===t.candidates[n]?.title)&&e.selected.length===t.selected.length&&e.selected.every((e,n)=>e.id===t.selected[n]?.id&&e.title===t.selected[n]?.title)),Xt=`xopc.taskDetail.chatPanelPercent`,Zt=42;function Qt(e,t){let n=Math.max(30,352/Math.max(t,1)*100),r=Math.min(60,(t-480)/Math.max(t,1)*100);return r<n?Zt:Math.min(r,Math.max(n,e))}function $t(){try{let e=Number(window.localStorage.getItem(Xt));return Number.isFinite(e)&&e>=30&&e<=60?e:Zt}catch{return Zt}}function en(e){let t=(0,W.c)(13),{items:n,empty:r,contentKey:i}=e,a=d(tn);if(n.length===0){let e;return t[0]===r?e=t[1]:(e=(0,G.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:r}),t[0]=r,t[1]=e),e}let o;t[2]===n?o=t[3]:(o=n.join(`
3
3
  `),t[2]=n,t[3]=o);let s;t[4]===n?s=t[5]:(s=n.map(K),t[4]=n,t[5]=s);let c;t[6]===s?c=t[7]:(c=(0,G.jsx)(`ul`,{className:`space-y-2`,children:s}),t[6]=s,t[7]=c);let l;return t[8]!==i||t[9]!==a||t[10]!==o||t[11]!==c?(l=(0,G.jsx)(V,{content:o,contentKey:i,language:a,previewHeight:144,children:c}),t[8]=i,t[9]=a,t[10]=o,t[11]=c,t[12]=l):l=t[12],l}function K(e){return(0,G.jsxs)(`li`,{className:`flex gap-2 text-sm leading-6 text-fg`,children:[(0,G.jsx)(N,{className:`mt-1 size-4 shrink-0 text-fg-subtle`}),(0,G.jsx)(`span`,{className:`min-w-0 whitespace-pre-wrap break-words [overflow-wrap:anywhere]`,children:e})]},e)}function tn(e){return e.language}function q({taskId:e,presentation:t,backgroundPath:n,onDeleted:r,onHeaderChange:s}){let[l,f]=i(),m=o(),h=d(e=>e.language),g=u(e=>e.conversationId),_=(0,U.useMemo)(()=>Me(h),[h]),v=Ne(e=>e.setPageHeader),y=Ne(e=>e.clearPageHeader),b=je(e=>e.panes),S=x(e=>e.openForSession),{data:C,error:T,mutate:O,lastChange:k,conversationLoading:te,conversationError:A}=w(e),{data:j,error:M,mutate:N}=he(e?[`task-detail-automations`,g]:null,()=>Fe.list(),{refreshInterval:3e4}),[I,L]=(0,U.useState)(null),[me,_e]=(0,U.useState)(null),[B,We]=(0,U.useState)(()=>new Set),[Ge,Ke]=(0,U.useState)([]),[qe,Je]=(0,U.useState)(null),[Ye,Xe]=(0,U.useState)([]),[$e,tt]=(0,U.useState)(!1),[nt,rt]=(0,U.useState)(``),[it,H]=(0,U.useState)(!1),[at,st]=(0,U.useState)(``),[W,dt]=(0,U.useState)($t),[pt,mt]=(0,U.useState)(!1),ht=(0,U.useRef)(null),_t=(0,U.useRef)(null),yt=(0,U.useRef)(null),{key:bt,state:xt}=a(),St=xt?.focusTaskResults,Ct=!!C;(0,U.useEffect)(()=>{if(!Ct||St!==e)return;let t=requestAnimationFrame(()=>{_t.current?.scrollIntoView?.({block:`start`}),_t.current?.focus({preventScroll:!0})});return()=>cancelAnimationFrame(t)},[St,bt,Ct,e]);let wt=(0,U.useRef)(null),Tt=(0,U.useRef)(null),[Et,At]=(0,U.useState)(!1),Nt=(0,U.useRef)(!1),Pt=(0,U.useRef)(!1),Ft=(0,U.useRef)(``),Bt=(0,U.useRef)(null),Ut=(0,U.useRef)(null),Wt=(0,U.useRef)(null),K=(0,U.useRef)(C),[tn,q]=(0,U.useState)(null),[nn,rn]=(0,U.useState)(null),[an,on]=(0,U.useState)(!1),[sn,cn]=(0,U.useState)(!1),[ln,un]=(0,U.useState)(null),dn=(0,U.useRef)(null),fn=(0,U.useMemo)(()=>({link:_.linkDependencies,linked:_.linkedDependencies,searchPlaceholder:_.dependencySearchPlaceholder,noMatches:_.noDependencyMatches,noCandidates:_.noDependencyCandidates,remove:_.removeDependency}),[_.dependencySearchPlaceholder,_.linkDependencies,_.linkedDependencies,_.noDependencyCandidates,_.noDependencyMatches,_.removeDependency]),pn=C?.dependencies.map(e=>`${e.id}:${e.title}`).join(`\0`)??``,mn=(0,U.useMemo)(()=>se(l.get(`returnTo`),`/`,[`/projects`,`/chat`,`/notes`,`/tasks`]),[l]),hn=(0,U.useCallback)(e=>t===`modal`&&n?ie(n,e):oe(`/tasks/${encodeURIComponent(e)}`,mn),[n,t,mn]);K.current=C;let J=(0,U.useCallback)((e,t)=>{We(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]);(0,U.useEffect)(()=>{L(null),_e(null),q(null),tt(!1),Bt.current=null,H(!1),rn(null),on(!1),cn(!1),un(null)},[e]),(0,U.useEffect)(()=>{let e=!0;return Ae().then(t=>{e&&Xe(t.items)}).catch(()=>void 0),()=>{e=!1}},[g]),(0,U.useEffect)(()=>{if(!k||k.source===`user`)return;rn(k);let e=window.setTimeout(()=>rn(null),3500);return()=>window.clearTimeout(e)},[k]),(0,U.useEffect)(()=>{let t=C?.task.projectId,n=C?.dependencies??[];if(!t){Wt.current=null,Je(null),Ke(n);return}Wt.current!==t&&(Wt.current=t,Je(null));let r=!0;return pe(t).then(t=>{if(!r)return;Je(t.project.name);let i=new Map;for(let r of[...t.tasks,...n])r.id!==e&&i.set(r.id,{id:r.id,title:r.title});Ke([...i.values()])}).catch(()=>{r&&Ke(n)}),()=>{r=!1}},[pn,C?.task.projectId,e]);let Y=(0,U.useCallback)(async(t,n=`command`)=>{let r=K.current;if(r){J(n,!0),L(null),t.type===`signoff`&&_e(null);try{await O(await De(e,t,r.task.version),{revalidate:!1})}catch{L(_.actionFailed),t.type===`signoff`&&_e(_.actionFailed)}finally{J(n,!1)}}},[_.actionFailed,O,J,e]),gn=async t=>{J(`command`,!0),L(null);try{let n=await ge(e,t);await O(),n.status===`waiting_connection`&&n.connectionConversationId?m(`/chat/${encodeURIComponent(n.connectionConversationId)}`):[`queued`,`running`,`verifying`,`succeeded`].includes(n.status)||L(Oe(n,h))}catch{L(_.actionFailed)}finally{J(`command`,!1)}},_n=(0,U.useCallback)(async(t,n)=>{let r=K.current;if(!r)return!1;n&&J(n,!0),L(null);try{let n=Te(e,t,r.task.version);return await O(n,{optimisticData:zt(r,t),populateCache:!0,revalidate:!1,rollbackOnError:!0}),!0}catch{return L(_.actionFailed),!1}finally{n&&J(n,!1)}},[_.actionFailed,O,J,e]),vn=()=>{C&&(Bt.current={value:C.task.title,version:C.task.version},q(null),rt(C.task.title),tt(!0))},yn=()=>{Nt.current=!0,rt(K.current?.task.title??``),Bt.current=null,q(null),tt(!1),queueMicrotask(()=>{Nt.current=!1})},bn=async(e=!1)=>{if(Nt.current){Nt.current=!1;return}let t=K.current;if(!t||B.has(`title`))return;let n=nt.trim();if(!n){yn();return}let r=Bt.current;if(!e&&Rt(r,t.task.version,t.task.title,n)){q(`title`);return}if(n===t.task.title){yn();return}await _n({title:n},`title`)&&(Bt.current=null,q(null),tt(!1))},xn=async()=>{if(!C)return;if(Pt.current){Pt.current=!1;return}let e=at.trim(),t=Ut.current;if(Rt(t,C.task.version,C.task.body??``,e)){q(`description`);return}if(at===Ft.current||e===(C.task.body??``).trim()){H(!1);return}await _n({body:e||null})&&(q(null),H(!1))},Sn=(0,U.useCallback)(async e=>{let t=K.current;!t||e===t.task.phase||await Y({type:`move`,phase:e},`phase`)},[Y]),Cn=(0,U.useCallback)(e=>{_n({priority:e},`priority`)},[_n]),wn=(0,U.useCallback)(e=>{_n({dueAt:Ht(e)},`dueAt`)},[_n]),Tn=(0,U.useCallback)(e=>{dt(e);try{window.localStorage.setItem(Xt,String(e))}catch{}},[]),En=(0,U.useCallback)(e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`&&e.key!==`Home`)return;e.preventDefault();let t=wt.current?.clientWidth??0,n=e.key===`Home`?Zt:W+(e.key===`ArrowLeft`?2:-2);Tn(Qt(n,t))},[W,Tn]),Dn=(0,U.useCallback)(e=>{if(!window.matchMedia(`(min-width: 1024px)`).matches)return;let t=wt.current;if(!t)return;e.preventDefault();let n=e.currentTarget,r=e.pointerId;n.setPointerCapture(r),mt(!0);let i=W,a=0,o=()=>{a=0,t.style.setProperty(`--task-chat-panel-width`,`${i}%`)},s=e=>{let n=t.getBoundingClientRect();i=Qt((n.right-e.clientX)/n.width*100,n.width),a===0&&(a=window.requestAnimationFrame(o))},c=()=>{a!==0&&(window.cancelAnimationFrame(a),o());try{n.releasePointerCapture(r)}catch{}mt(!1),Tn(i),window.removeEventListener(`pointermove`,s),window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c)};window.addEventListener(`pointermove`,s),window.addEventListener(`pointerup`,c),window.addEventListener(`pointercancel`,c)},[W,Tn]),On=(0,U.useCallback)(async t=>{let n=K.current;if(n){J(`dependencies`,!0),L(null);try{await O(await we(e,t,n.task.version),{revalidate:!1})}catch{L(_.dependencyUpdateFailed)}finally{J(`dependencies`,!1)}}},[_.dependencyUpdateFailed,O,J,e]),kn=(0,U.useCallback)(async t=>{let n=K.current;if(!(!n||!t||t===n.conversation.currentExecutorAgentId)){J(`delegateAgentId`,!0),L(null);try{await O(await be(e,t,n.task.version),{revalidate:!1})}catch{L(_.actionFailed)}finally{J(`delegateAgentId`,!1)}}},[_.actionFailed,O,J,e]),An=(0,U.useCallback)(async()=>{J(`delete`,!0),L(null);try{await Ce(e),r?r():m(mn,{replace:!0})}catch(e){L(e instanceof Error?e.message:_.actionFailed)}finally{J(`delete`,!1)}},[_.actionFailed,m,r,mn,J,e]),jn=(0,U.useCallback)(async(t,n,r)=>{if(!t.acceptanceTarget)return!1;J(`acceptance`,!0),_e(null),L(null);try{return await O(await ve(e,fe(e,t.task.latestContractVersion,n),r,t.task.version,t.task.latestContractVersion,t.acceptanceTarget.id),{revalidate:!1}),!0}catch{return _e(_.actionFailed),L(_.actionFailed),O().catch(()=>void 0),!1}finally{J(`acceptance`,!1)}},[_.actionFailed,O,J,e]),Mn=C?.task.title,Nn=Mn!==void 0;if((0,U.useLayoutEffect)(()=>{let e=Tt.current,t=e?.parentElement;if(!Nn||!e||!t||typeof IntersectionObserver>`u`)return;let n=new IntersectionObserver(([e])=>{let n=ut(t),r=n?n.getBoundingClientRect().top+n.clientTop:0;At(!e.isIntersecting&&e.boundingClientRect.bottom<=r)});return n.observe(e),()=>n.disconnect()},[Nn,e]),(0,U.useLayoutEffect)(()=>{s?.({taskId:e,title:Mn,compact:Et})},[Et,s,e,Mn]),(0,U.useLayoutEffect)(()=>{if(t!==`modal`)return v({startExtra:(0,G.jsx)(c,{to:mn,className:`flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":_.backToWork,children:(0,G.jsx)(ee,{className:`size-4`})}),main:Nn?(0,G.jsx)(`div`,{className:`min-w-0 text-sm font-semibold text-fg`,children:(0,G.jsx)(et,{label:qe?`${qe} / ${_.taskLabel}`:_.taskLabel,title:Mn,compact:Et})}):null,end:e?(0,G.jsx)(c,{to:`/space?taskId=${encodeURIComponent(e)}`,className:`rounded-lg px-2.5 py-2 text-sm text-fg-muted hover:bg-surface-hover`,children:h===`zh`?`成果`:`Results`}):null}),y},[y,Et,_.backToWork,_.taskLabel,Nn,h,t,qe,mn,v,e,Mn]),T&&!C)return(0,G.jsx)(`div`,{className:t===`modal`?`p-5 text-sm text-danger`:`mx-auto max-w-3xl p-6 text-sm text-danger`,children:_.taskNotFound});if(!C)return(0,G.jsx)(`div`,{className:t===`modal`?`p-5`:`mx-auto max-w-4xl p-4 sm:p-6`,children:(0,G.jsx)(Qe,{})});let Pn=C.waits[0],X=C.runs.find(e=>!e.parentRunId&&[`queued`,`running`,`waiting`,`verifying`].includes(e.status)),Fn=xe(C),In=Fn.length>0&&Fn.every(e=>e.status===`passed`),Ln=C.waits.find(e=>e.kind===`paused`),Rn=ye(C),zn=Ee(C),Bn=_.detailStatuses[zn],Vn=C.task.body?.trim()||C.task.contract?.objective.trim()||``,Hn=C.allowedCommands.includes(`mark_ready`),Un=C.allowedCommands.includes(`start`),Wn=C.allowedCommands.includes(`add_wait`),Gn=!Pn&&!X&&In&&C.presentation.primaryAction?.type===`review`&&C.allowedCommands.includes(`close`),Kn=C.allowedCommands.includes(`reopen`),Z=C.conversation.activeConversationId,Q=C.conversation.currentExecutorAgentId??C.task.delegateAgentId??C.task.ownerId,qn=Ye.find(e=>e.id===Q),Jn=p(h).agentsSettings,Yn=qn?Ie(qn,Jn):void 0,Xn=X?.executorKind===`agent`?Ye.find(e=>e.id===(X.executorRef.agentId??C.conversation.currentExecutorAgentId)):void 0,Zn=Xn?Ie(Xn,Jn):void 0,Qn=!!(Z&&b[Z]?.open),$n=C.context.filter(e=>e.role!==`deliverable`),er=j?.automations.filter(t=>t.action.kind===`task_command`&&t.action.taskId===e)??[],$=er.filter(e=>e.trigger.kind===`schedule`&&e.action.kind===`task_command`&&e.action.command.type===`start`),tr=$.filter(e=>e.enabled&&e.state.nextRunAtMs!==void 0).map(e=>e.state.nextRunAtMs).sort((e,t)=>e-t)[0],nr=e=>{N(t=>({automations:[e,...(t?.automations??[]).filter(t=>t.id!==e.id)]}),{revalidate:!1})},rr=e=>{un(e),cn(!0)},ir=()=>{j&&($.length===1?rr($[0]):$.length>1?(dn.current&&(dn.current.open=!0),f(e=>ct(e,`schedule`,!0),{preventScrollReset:!0}),dn.current?.scrollIntoView({block:`start`,behavior:`smooth`}),dn.current?.focus({preventScroll:!0})):(un(null),cn(!0)))},ar=C.sessions.filter((e,t,n)=>n.findIndex(t=>t.conversationId===e.conversationId)===t),or=C.task.contract?.expectedOutputs??[],sr=C.task.contract?.constraints??[],cr=C.task.contract?.approvalRequired??[],lr=C.task.contract?.assumptions??[],ur=C.task.contract?.risks??[],dr=sr.length>0||cr.length>0||lr.length>0||ur.length>0,fr=(...e)=>!!nn?.changedFields.some(t=>e.includes(t)),pr=C.allowedCommands.includes(`move`),mr=B.has(`command`),hr=B.has(`delete`),gr=X!==void 0,_r=()=>{let e=ht.current;e&&(e.open=!0,f(e=>ct(e,`acceptance`,!0),{preventScrollReset:!0}),e.scrollIntoView({block:`start`,behavior:`smooth`}),e.focus({preventScroll:!0}))},vr=C.presentation.primaryAction,yr=()=>{Q&&Y({type:`start`,executor:{kind:`agent`,agentId:Q}})},br=()=>{_t.current?.scrollIntoView({block:`start`,behavior:`smooth`}),_t.current?.focus({preventScroll:!0})},xr=(()=>{switch(vr?.type){case`mark_ready`:return{label:_.scheduleTask,activate:()=>void Y({type:`mark_ready`})};case`resume`:return{label:_.resumeTask,activate:()=>void Y({type:`resolve_wait`,waitId:vr.waitId})};case`resolve_wait`:{let t=C.waits.find(e=>e.id===vr.waitId);if(t?.condition.type===`connection`&&t.taskRunId)return{label:h===`zh`?`检查连接并继续`:`Check connection and resume`,activate:()=>void gn(t.taskRunId)};let n=t&&t.condition.type!==`connection`&&(t.kind===`user_input`||t.kind===`approval`&&typeof t.condition.capability==`string`);return{label:h===`zh`?`处理待办`:`Resolve pending item`,activate:()=>n?yt.current?.focus():m(ae(e))}}case`inspect_run`:return{label:h===`zh`?`查看待处理事项`:`View pending issue`,activate:()=>yt.current?.focus()};case`review`:return{label:h===`zh`?`去验收`:`Review results`,activate:_r};case`signoff`:return{label:h===`zh`?`确认验收`:`Accept result`,activate:()=>void Y({type:`signoff`,resultId:vr.resultId})};case`view_results`:return{label:h===`zh`?`查看结果`:`View results`,activate:br};case`retry_allocation`:return{label:h===`zh`?`重新分配`:`Retry assignment`,activate:()=>void Y({type:`retry_allocation`})};case`retry_run`:return{label:h===`zh`?`重试任务`:`Retry task`,activate:()=>void gn(vr.runId)};case`start`:return{label:_.runTask,activate:yr,disabled:!Q}}})(),Sr=(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[xr?(0,G.jsx)(z,{className:`min-h-9 px-3 py-1.5 text-xs`,variant:`primary`,disabled:mr||xr.disabled,onClick:xr.activate,children:xr.label}):null,Kn?(0,G.jsxs)(z,{className:`min-h-9 px-3 py-1.5 text-xs`,variant:`ghost`,disabled:mr,onClick:()=>void Y({type:`reopen`,phase:`ready`}),children:[(0,G.jsx)(ue,{className:`size-4`}),_.reopenTask]}):null,C.task.phase!==`review`&&!Ln&&Wn?(0,G.jsxs)(z,{variant:`ghost`,className:`min-h-9 px-3 py-1.5 text-xs`,disabled:mr,onClick:()=>void Y({type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}),children:[(0,G.jsx)(le,{className:`size-4`}),_.pauseTask]}):null,!Pn&&!X&&C.task.phase!==`closed`&&C.task.phase!==`review`?(0,G.jsxs)(z,{variant:`ghost`,className:`min-h-9 px-3 py-1.5 text-xs`,disabled:!j,onClick:ir,children:[(0,G.jsx)(D,{className:`size-4`}),$.length>0?h===`zh`?`管理执行时间`:`Manage schedule`:h===`zh`?`设置执行时间`:`Set execution time`]}):null,(0,G.jsxs)(Re,{children:[(0,G.jsx)(ze,{asChild:!0,children:(0,G.jsx)(z,{type:`button`,variant:`ghost`,className:`size-9 p-0`,disabled:mr||hr,"aria-label":_.moreActions,children:(0,G.jsx)(P,{className:`size-4`,"aria-hidden":!0})})}),(0,G.jsx)(Be,{children:(0,G.jsxs)(He,{align:`end`,sideOffset:6,className:`z-[100] min-w-44 rounded-lg border border-edge bg-surface-overlay p-1 shadow-popover`,children:[C.task.phase===`review`&&!Ln&&Wn?(0,G.jsx)(Ve,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg outline-none focus:bg-surface-hover`,onSelect:()=>void Y({type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}),children:_.pauseTask}):null,C.task.phase===`review`&&!Pn&&!X?(0,G.jsx)(Ve,{disabled:!j,className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg outline-none focus:bg-surface-hover data-[disabled]:opacity-50`,onSelect:ir,children:$.length>0?h===`zh`?`管理执行时间`:`Manage schedule`:h===`zh`?`设置执行时间`:`Set execution time`}):null,C.task.phase===`review`&&!Pn&&Un&&Q?(0,G.jsx)(Ve,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg outline-none focus:bg-surface-hover`,onSelect:()=>void Y({type:`start`,executor:{kind:`agent`,agentId:Q}}),children:_.runTask}):null,Hn&&(Un||Pn||C.task.phase===`review`)?(0,G.jsx)(Ve,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg outline-none focus:bg-surface-hover`,onSelect:()=>void Y({type:`mark_ready`}),children:_.scheduleTask}):null,X?(0,G.jsx)(Ve,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>{J(`command`,!0),L(null),O(Se(e,X.id,X.version),{revalidate:!1}).catch(()=>L(_.actionFailed)).finally(()=>J(`command`,!1))},children:_.cancelActiveRun}):null,X?(0,G.jsx)(Ue,{className:`my-1 h-px bg-edge`}):null,C.task.phase===`closed`?null:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Ve,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>void Y({type:`close`,resolution:`cancelled`}),children:_.cancelTask}),(0,G.jsx)(Ue,{className:`my-1 h-px bg-edge`})]}),(0,G.jsx)(Ve,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>{if(gr){L(_.deleteActiveTaskBlocked);return}on(!0)},children:_.deleteTask})]})})]})]});return(0,G.jsxs)(`div`,{ref:wt,className:`flex h-full min-h-0 flex-col overflow-hidden ${pt?`lg:cursor-col-resize lg:select-none`:``}`,style:{"--task-chat-panel-width":`${W}%`},children:[(0,G.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto lg:flex-row lg:overflow-hidden`,children:[(0,G.jsxs)(`div`,{className:`task-detail-scroll flex min-w-0 shrink-0 flex-col bg-surface-base lg:min-h-0 lg:flex-1 lg:shrink lg:overflow-y-auto lg:overscroll-contain`,children:[(0,G.jsxs)(`header`,{ref:Tt,className:R(`shrink-0 px-4 py-5 sm:px-6 sm:py-6`,fr(`title`)&&`task-detail-live-update`),children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-x-6 gap-y-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[qe?(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,G.jsx)(ne,{className:`size-3.5`,"aria-hidden":!0}),qe]}):null,qe?(0,G.jsx)(`span`,{"aria-hidden":`true`,children:`/`}):null,(0,G.jsx)(`span`,{children:_.taskLabel}),nn?(0,G.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,role:`status`,children:nn.source===`agent`?h===`zh`?`Agent 刚刚更新`:`Updated by Agent`:h===`zh`?`执行结果已同步`:`Execution result synced`}):null]}),$e?(0,G.jsx)(`textarea`,{autoFocus:!0,"data-task-inline-editor":!0,"aria-label":h===`zh`?`任务标题`:`Task title`,rows:2,value:nt,onFocus:e=>{Bt.current?.value===nt&&(e.currentTarget.setSelectionRange(0,0),e.currentTarget.scrollTop=0)},onChange:e=>rt(e.target.value),onBlur:()=>void bn(),onKeyDown:e=>{e.nativeEvent.isComposing||(e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),yn()):e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),e.currentTarget.blur()))},className:`mt-2 block max-h-56 min-h-14 w-full max-w-3xl resize-none overflow-y-auto bg-transparent p-0 text-xl font-semibold leading-7 tracking-tight text-fg sm:text-2xl outline-none [field-sizing:content]`}):(0,G.jsx)(V,{content:C.task.title,contentKey:`${e}:title`,language:h,previewHeight:56,className:`mt-2 max-w-3xl`,children:(0,G.jsx)(`h1`,{className:`break-words text-xl font-semibold leading-7 tracking-tight text-fg sm:text-2xl`,children:(0,G.jsx)(`button`,{type:`button`,className:`max-w-full whitespace-pre-wrap break-words [overflow-wrap:anywhere] rounded-sm text-left outline-none hover:bg-surface-hover/60 focus-visible:ring-2 focus-visible:ring-accent/40`,title:C.task.title,onClick:vn,children:C.task.title})})}),tn===`title`?(0,G.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,G.jsx)(`span`,{children:h===`zh`?`Agent 在你编辑期间更新了标题。`:`The Agent updated the title while you were editing.`}),(0,G.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:yn,children:h===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,G.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,disabled:B.has(`title`),onClick:()=>void bn(!0),children:h===`zh`?`保留我的修改`:`Keep my changes`})]}):null]}),(0,G.jsx)(`span`,{className:R(`shrink-0 rounded-full px-2.5 py-1 text-xs font-medium`,ke(zn)),children:Bn})]}),(0,G.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-4 gap-y-2 text-xs text-fg-muted`,children:[(0,G.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2`,children:[Q?(0,G.jsx)(Pe,{agentId:Q,avatar:qn?.avatar,size:20,className:`shrink-0`}):null,(0,G.jsxs)(`span`,{className:`min-w-0 break-words [overflow-wrap:anywhere]`,children:[_.executorLabel,` · `,Yn??Q??_.unassigned]})]}),(0,G.jsx)(`span`,{className:`text-fg-subtle`,children:_.updatedAt.replace(`{{date}}`,Ze(C.task.updatedAt,h))})]})]}),(0,G.jsxs)(`div`,{className:`sticky top-0 z-10 flex shrink-0 flex-wrap items-center justify-end gap-2 border-b border-edge-subtle bg-surface-panel px-4 py-2 sm:px-5`,"aria-label":h===`zh`?`任务操作`:`Task actions`,children:[Sr,I?(0,G.jsx)(`p`,{role:`alert`,className:`basis-full text-sm text-danger`,children:I}):null,(0,G.jsx)(ft,{language:h,hasSchedule:$.length>0},e)]}),(0,G.jsxs)(`section`,{className:`min-w-0 space-y-4 p-4 sm:p-5`,children:[zn===`review`?null:(0,G.jsx)(Mt,{ref:yt,detail:C,executorName:Zn,language:h,onUpdated:e=>{O(e,{revalidate:!1})}}),(0,G.jsxs)(`section`,{"data-task-section":`results`,"data-task-section-label":h===`zh`?`交付结果`:`Results`,ref:_t,tabIndex:-1,"aria-labelledby":`task-results-heading`,className:`scroll-mt-24 space-y-4`,children:[(0,G.jsx)(vt,{detail:C,language:h}),(0,G.jsx)(lt,{panelId:`acceptance`,chevron:!0,"data-task-section":`acceptance`,"data-task-section-label":h===`zh`?`验收`:`Acceptance`,defaultOpen:!0,ref:ht,tabIndex:-1,"aria-label":_.successDefinition,className:`scroll-mt-24 overflow-hidden rounded-2xl bg-surface-panel`,summaryClassName:`min-h-12 cursor-pointer px-4 py-2 text-sm font-semibold text-fg outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,title:(0,G.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[h===`zh`?`验收`:`Acceptance`,(0,G.jsxs)(`span`,{"aria-live":`polite`,className:`rounded-full bg-surface-inset px-2 py-0.5 text-xs font-medium tabular-nums text-fg-muted`,children:[Fn.filter(e=>e.status===`passed`).length,`/`,Fn.length]})]}),children:(0,G.jsx)(gt,{criteria:Fn,language:h,closed:C.task.phase===`closed`,pending:B.has(`acceptance`),error:me,reviewDisabled:!C.acceptanceTarget||C.presentation.primaryAction?.type===`inspect_run`,blockedReason:Pn?h===`zh`?`请先处理待办事项`:`Resolve the pending request first`:X?h===`zh`?`请等待当前执行结束`:`Wait for the current run to finish`:void 0,onReview:(e,t)=>jn(C,e,t),projectId:C.task.projectId,conversationId:Z??void 0},`${e}:${C.task.latestContractVersion}:${C.acceptanceTarget?.id??``}`)})]}),(0,G.jsx)(lt,{panelId:`report`,chevron:!0,defaultOpen:!0,"data-task-section":`report`,"data-task-section-label":h===`zh`?`执行报告`:`Report`,className:`rounded-2xl bg-surface-panel p-4`,summaryClassName:`cursor-pointer rounded-sm text-sm font-medium text-fg`,title:h===`zh`?`完整执行报告`:`Full execution report`,children:(0,G.jsx)(Dt,{detail:C,language:h},Rn?.runId??e)}),!j&&!M?(0,G.jsx)(de,{className:`h-9 rounded-lg`}):null,M?(0,G.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-2 text-sm text-danger`,children:[(0,G.jsx)(`span`,{children:h===`zh`?`无法读取执行计划,请重试后再设置时间。`:`Could not load schedules. Retry before setting a time.`}),(0,G.jsx)(z,{variant:`ghost`,onClick:()=>void N(),children:h===`zh`?`重试`:`Retry`})]}):null,$.length>0?(0,G.jsx)(lt,{panelId:`schedule`,chevron:!0,defaultOpen:!0,"data-task-section":`schedule`,"data-task-section-label":h===`zh`?`执行时间`:`Schedule`,ref:dn,tabIndex:-1,className:`scroll-mt-24 rounded-2xl bg-surface-panel p-4`,summaryClassName:`cursor-pointer rounded-sm text-sm text-fg-muted`,title:(0,G.jsxs)(G.Fragment,{children:[h===`zh`?`执行时间`:`Execution schedule`,` · `,$.length,tr===void 0?``:` · ${h===`zh`?`下次执行:`:`Next run: `}${Ze(tr,h)}`]}),children:(0,G.jsx)(`div`,{className:`mt-3`,children:(0,G.jsx)(kt,{schedules:$,language:h,onEdit:rr,onUpdated:nr})})}):null,(0,G.jsx)(lt,{panelId:`goal`,chevron:!0,defaultOpen:!0,"data-task-section":`goal`,"data-task-section-label":h===`zh`?`目标说明`:`Goal`,className:`rounded-2xl bg-surface-panel p-4`,summaryClassName:`cursor-pointer rounded-sm text-sm font-medium text-fg`,title:h===`zh`?`任务目标与说明`:`Task goal and description`,children:(0,G.jsx)(`div`,{className:`mt-3`,children:(0,G.jsxs)(`section`,{className:`overflow-hidden rounded-xl bg-surface-inset divide-y divide-edge-subtle`,children:[(0,G.jsxs)(`div`,{className:`border-b border-edge-subtle p-5`,children:[(0,G.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h===`zh`?`任务目标`:`Task goal`}),(0,G.jsx)(V,{content:C.task.contract?.objective||C.task.title,contentKey:`${e}:goal`,language:h,markdown:!1,previewHeight:72,className:`mt-3 text-sm leading-6 text-fg`}),(0,G.jsxs)(z,{variant:`ghost`,className:`mt-2 min-h-9 px-2 text-xs`,onClick:_r,children:[_.successDefinition,` · `,Fn.length]})]}),or.length>0?(0,G.jsxs)(`div`,{className:`p-5`,children:[(0,G.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:_.expectedOutputs}),(0,G.jsx)(`div`,{className:`mt-2`,children:(0,G.jsx)(en,{contentKey:`${e}:expectedOutputs`,items:or,empty:_.noDefinition})})]}):null,(0,G.jsxs)(`details`,{className:R(`p-5`,fr(`body`)&&`task-detail-live-update`),children:[(0,G.jsx)(`summary`,{className:`cursor-pointer text-sm font-semibold text-fg`,children:_.taskDescription}),it?(0,G.jsx)(`textarea`,{autoFocus:!0,"data-task-inline-editor":!0,rows:6,value:at,onChange:e=>st(e.target.value),onBlur:()=>void xn(),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),Pt.current=!0,st(C.task.body??C.task.contract?.objective??``),H(!1),queueMicrotask(()=>{Pt.current=!1}))},className:`mt-3 w-full resize-y rounded-lg bg-surface-hover px-3 py-2 text-sm leading-6 text-fg outline-none ring-2 ring-accent/20 focus:ring-accent/50`}):(0,G.jsxs)(`div`,{className:`mt-2`,children:[Vn&&Vn!==C.task.title?(0,G.jsx)(V,{content:Vn,contentKey:`${e}:description`,language:h}):(0,G.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:_.noTaskDescription}),(0,G.jsx)(`button`,{type:`button`,className:`mt-2 rounded-md px-2 py-1 text-xs text-accent hover:bg-surface-hover focus-visible:bg-surface-hover`,onClick:()=>{let e=C.task.body??C.task.contract?.objective??``;Ft.current=e,Ut.current={value:C.task.body??``,version:C.task.version},q(null),st(e),H(!0)},children:h===`zh`?`编辑说明`:`Edit description`})]}),tn===`description`?(0,G.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,G.jsx)(`span`,{children:h===`zh`?`Agent 在你编辑期间更新了描述。`:`The Agent updated the description while you were editing.`}),(0,G.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{st(C.task.body??``),q(null),H(!1)},children:h===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,G.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void _n({body:at.trim()||null}).then(e=>{e&&(q(null),H(!1))}),children:h===`zh`?`保留我的修改`:`Keep my changes`})]}):null]}),dr?(0,G.jsxs)(`section`,{className:R(`p-5`,fr(`contract`)&&`task-detail-live-update`),children:[(0,G.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:_.taskDefinition}),(0,G.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:h===`zh`?`执行边界及补充背景`:`Execution boundaries and supporting context`}),sr.length>0?(0,G.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,G.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:_.constraints}),(0,G.jsx)(`div`,{className:`mt-3`,children:(0,G.jsx)(en,{contentKey:`${e}:constraints`,items:sr,empty:_.noDefinition})})]}):null,cr.length>0?(0,G.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,G.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:_.approvalRequired}),(0,G.jsx)(`div`,{className:`mt-3`,children:(0,G.jsx)(en,{contentKey:`${e}:approvalRequired`,items:cr,empty:_.noDefinition})})]}):null,lr.length>0?(0,G.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,G.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:_.contextAssumptions}),(0,G.jsx)(`div`,{className:`mt-3`,children:(0,G.jsx)(en,{contentKey:`${e}:assumptions`,items:lr,empty:_.noDefinition})})]}):null,ur.length>0?(0,G.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,G.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:_.contextRisks}),(0,G.jsx)(`div`,{className:`mt-3`,children:(0,G.jsx)(en,{contentKey:`${e}:risks`,items:ur,empty:_.noDefinition})})]}):null]}):null]})})}),(0,G.jsxs)(lt,{panelId:`management`,chevron:!0,defaultOpen:!0,"data-task-section":`management`,"data-task-section-label":h===`zh`?`任务管理`:`Management`,"aria-label":h===`zh`?`任务管理`:`Task management`,className:`rounded-2xl bg-surface-panel p-4`,summaryClassName:`cursor-pointer rounded-sm text-sm font-medium text-fg`,title:h===`zh`?`任务管理`:`Task management`,children:[(0,G.jsxs)(`aside`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-inset divide-y divide-edge-subtle`,children:[(0,G.jsxs)(`section`,{className:R(`p-5`,fr(`phase`,`resolution`,`priority`,`dueAt`,`delegateAgentId`)&&`task-detail-live-update`),children:[(0,G.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:_.taskProperties}),(0,G.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,G.jsx)(Gt,{value:C.task.phase,disabled:B.has(`phase`),canMove:pr,canApprove:Gn,canReopen:Kn,language:h,label:_.taskPhase,onChange:Sn}),(0,G.jsx)(Kt,{value:C.task.priority,disabled:B.has(`priority`),label:_.priority,labels:_.priorityLabels,onChange:Cn}),(0,G.jsx)(qt,{value:Vt(C.task.dueAt),disabled:B.has(`dueAt`),label:_.dueDate,onChange:wn}),(0,G.jsx)(Jt,{value:C.conversation.currentExecutorAgentId??``,disabled:B.has(`delegateAgentId`),label:_.executorLabel,unassignedLabel:_.unassigned,agents:Ye,language:h,onChange:kn})]})]}),(0,G.jsxs)(`details`,{className:R(`p-5`,fr(`dependencies`)&&`task-detail-live-update`),children:[(0,G.jsxs)(`summary`,{className:`cursor-pointer text-sm font-semibold text-fg`,children:[_.taskRelations,` · `,C.dependencies.length,` / `,C.dependents.length]}),(0,G.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:_.dependencies}),(0,G.jsx)(Yt,{candidates:Ge,selected:C.dependencies,disabled:B.has(`dependencies`),labels:fn,getTaskHref:hn,onChange:On})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:_.dependents}),C.dependents.length>0?(0,G.jsx)(`div`,{className:`space-y-1.5`,children:C.dependents.map(t=>(0,G.jsx)(V,{content:t.title,contentKey:`${e}:dependent:${t.id}`,language:h,previewHeight:72,className:`rounded-lg bg-surface-hover p-2.5`,children:(0,G.jsx)(c,{to:hn(t.id),className:`block break-words [overflow-wrap:anywhere] text-sm text-fg-muted transition-colors hover:text-fg`,children:t.title})},t.id))}):(0,G.jsx)(`p`,{className:`text-sm text-fg-subtle`,children:_.noDependents})]})]})]})]}),C.task.phase===`closed`?null:(0,G.jsxs)(z,{variant:`ghost`,className:`my-3`,disabled:!j,onClick:ir,children:[(0,G.jsx)(D,{className:`size-4`}),$.length>0?h===`zh`?`管理执行时间`:`Manage schedule`:_.scheduleRecurringTask]}),(0,G.jsxs)(`details`,{className:`mb-4 rounded-xl bg-surface-inset p-5`,children:[(0,G.jsx)(`summary`,{className:`cursor-pointer text-sm font-semibold text-fg`,children:h===`zh`?`关联内容`:`Related work`}),ar.length>0||C.runs.length>0||er.length>0||C.dependencies.length>0||C.dependents.length>0?(0,G.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:[ar.length>0?(0,G.jsxs)(`div`,{className:`rounded-lg bg-surface-hover p-3`,children:[(0,G.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:h===`zh`?`对话 · ${ar.length}`:`Conversations · ${ar.length}`}),(0,G.jsx)(It,{contentKey:`${e}:sessions`,language:h,className:`mt-2`,children:ar.map(t=>(0,G.jsx)(`li`,{children:(0,G.jsx)(c,{className:`block break-words [overflow-wrap:anywhere] text-sm text-accent hover:underline`,to:t.conversationId===Z?ae(e):`/chat/${encodeURIComponent(t.conversationId)}`,children:t.conversationId===Z?h===`zh`?`当前执行对话`:`Current execution chat`:t.role===`discussion`?h===`zh`?`关联讨论`:`Linked discussion`:h===`zh`?`历史执行对话`:`Earlier execution chat`})},t.id))})]}):null,er.length>0?(0,G.jsxs)(`div`,{className:`rounded-lg bg-surface-hover p-3`,children:[(0,G.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:h===`zh`?`自动化 · ${er.length}`:`Automations · ${er.length}`}),(0,G.jsx)(It,{contentKey:`${e}:automations`,language:h,className:`mt-2`,children:er.map(e=>(0,G.jsx)(`li`,{children:(0,G.jsx)(c,{className:`block break-words [overflow-wrap:anywhere] text-sm text-accent hover:underline`,to:`/automations?automation=${encodeURIComponent(e.id)}`,children:e.name})},e.id))})]}):null,C.dependencies.length>0||C.dependents.length>0?(0,G.jsxs)(`div`,{className:`rounded-lg bg-surface-hover p-3`,children:[(0,G.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:_.taskRelations}),(0,G.jsx)(`p`,{className:`mt-2 text-sm text-fg`,children:h===`zh`?`${C.dependencies.length} 个前置任务 · ${C.dependents.length} 个后续任务`:`${C.dependencies.length} prerequisites · ${C.dependents.length} dependents`})]}):null]}):(0,G.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:h===`zh`?`还没有关联内容`:`No related work yet`}),(0,G.jsx)(`div`,{className:`mt-4 border-t border-edge-subtle pt-3`,children:(0,G.jsx)(ot,{resource:{kind:`task`,id:C.task.id,revision:String(C.task.version)},disabled:$e||it||B.size>0})})]}),$n.length>0?(0,G.jsxs)(`section`,{className:R(`p-5`,fr(`context`)&&`task-detail-live-update`),children:[(0,G.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:_.contextUsed}),(0,G.jsx)(`ul`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,children:$n.map(e=>(0,G.jsxs)(`li`,{className:`min-w-0 rounded-lg bg-surface-hover p-2.5`,children:[(0,G.jsxs)(`span`,{className:`text-[11px] text-fg-subtle`,children:[_.contextRoleLabels[e.role],` · `,_.contextKindLabels[e.targetKind]]}),e.targetKind===`url`&&/^https?:\/\//.test(e.targetId)?(0,G.jsx)(`a`,{className:`mt-1 block break-all text-sm text-accent hover:underline`,href:e.targetId,target:`_blank`,rel:`noreferrer`,children:e.title??e.targetId}):(0,G.jsx)(`p`,{className:`mt-1 break-words text-sm text-fg`,children:e.title??e.targetId})]},e.id))})]}):null]}),(0,G.jsx)(lt,{panelId:`activity`,chevron:!0,defaultOpen:!0,"data-task-section":`activity`,"data-task-section-label":h===`zh`?`活动留言`:`Activity`,className:`rounded-2xl bg-surface-panel p-4`,summaryClassName:`cursor-pointer rounded-sm text-sm font-semibold text-fg`,title:h===`zh`?`活动记录与留言`:`Activity and updates`,children:(0,G.jsxs)(`div`,{className:`mt-3 space-y-4`,children:[(0,G.jsx)(Lt,{taskId:e},e),(0,G.jsx)(Ot,{changes:C.phaseChanges,language:h})]})})]})]}),(0,G.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":h===`zh`?`调整任务信息和 Agent 对话的宽度`:`Resize task details and Agent chat`,"aria-valuemin":30,"aria-valuemax":60,"aria-valuenow":Math.round(W),tabIndex:0,onPointerDown:Dn,onKeyDown:En,onDoubleClick:()=>Tn(Zt),className:`hidden w-2 shrink-0 cursor-col-resize touch-none bg-surface-panel outline-none focus-visible:bg-accent-soft lg:block`}),(0,G.jsxs)(`aside`,{className:`flex min-h-[34rem] min-w-0 shrink-0 flex-col bg-surface-panel lg:min-h-0 lg:w-[var(--task-chat-panel-width)]`,children:[(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge-subtle px-4 py-3`,children:[(0,G.jsx)(`h2`,{className:`text-sm font-medium text-fg-muted`,children:h===`zh`?`执行对话`:`Execution chat`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[ar.length>1?(0,G.jsxs)(Re,{children:[(0,G.jsx)(ze,{asChild:!0,children:(0,G.jsx)(z,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,children:h===`zh`?`${ar.length} 段对话`:`${ar.length} conversations`})}),(0,G.jsx)(Be,{children:(0,G.jsx)(He,{align:`end`,sideOffset:6,className:`z-[100] min-w-52 rounded-lg border border-edge bg-surface-overlay p-1 shadow-popover`,children:ar.map(t=>(0,G.jsx)(Ve,{asChild:!0,children:(0,G.jsx)(c,{className:`block rounded-md px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,to:t.conversationId===Z?ae(e):`/chat/${encodeURIComponent(t.conversationId)}`,children:t.conversationId===Z?h===`zh`?`当前执行对话`:`Current execution chat`:t.role===`discussion`?h===`zh`?`关联讨论`:`Linked discussion`:h===`zh`?`历史执行对话`:`Earlier execution chat`})},t.id))})})]}):null,Z?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(z,{type:`button`,variant:`ghost`,className:R(`size-8 p-0`,Qn&&`bg-surface-hover text-fg`),"aria-label":h===`zh`?`项目文件`:`Project files`,"aria-pressed":Qn,onClick:()=>{je.getState().openFiles(Z),S(Z)},children:(0,G.jsx)(re,{className:`size-4`,"aria-hidden":!0})}),(0,G.jsx)(z,{asChild:!0,variant:`ghost`,className:`size-8 p-0`,children:(0,G.jsx)(c,{to:ae(e),"aria-label":h===`zh`?`全屏打开对话`:`Open chat full screen`,children:(0,G.jsx)(F,{className:`size-4`,"aria-hidden":!0})})})]}):null]})]}),Z?(0,G.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,G.jsx)(E,{embedded:!0,conversationId:Z,taskId:e})}):te?(0,G.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,G.jsxs)(`div`,{className:`max-w-xs`,children:[(0,G.jsx)(ce,{className:`mx-auto size-8 animate-pulse text-fg-subtle`}),(0,G.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:h===`zh`?`正在创建任务会话`:`Creating task conversation`})]})}):A?(0,G.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,G.jsxs)(`div`,{className:`max-w-xs`,children:[(0,G.jsx)(ce,{className:`mx-auto size-8 text-danger`}),(0,G.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:h===`zh`?`任务会话创建失败`:`Could not create task conversation`}),(0,G.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:A instanceof Error?A.message:String(A)})]})}):(0,G.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,G.jsxs)(`div`,{className:`max-w-xs`,children:[(0,G.jsx)(ce,{className:`mx-auto size-8 text-fg-subtle`}),(0,G.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:h===`zh`?`等待任务会话`:`Waiting for a task conversation`}),(0,G.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:h===`zh`?`安排或开始任务后,Agent 的执行过程和持续对话会显示在这里。`:`Schedule or start the task to see the agent run and continue the conversation here.`})]})})]})]}),sn?(0,G.jsx)(jt,{automation:ln??void 0,taskId:e,taskTitle:C.task.title,projectId:C.task.projectId,executorAgentId:Q,language:h,onClose:()=>cn(!1),onCreated:nr},`${e}:${ln?.id??`new`}`):null,(0,G.jsx)(Le,{open:an,title:_.deleteTaskTitle,description:_.deleteTaskDescription.replace(`{{title}}`,C.task.title),confirmLabel:_.confirmDeleteTask,cancelLabel:_.keepTask,destructive:!0,onConfirm:()=>{on(!1),An()},onCancel:()=>on(!1)})]})}function nn(){let e=(0,W.c)(2),{taskId:t}=s(),n=t===void 0?``:t,r;return e[0]===n?r=e[1]:(r=(0,G.jsx)(q,{taskId:n,presentation:`page`}),e[0]=n,e[1]=r),r}function rn(e){return e.id}export{nn as TaskDetailPage,q as TaskDetailView};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{a,c as o,i as s,n as c,o as l,r as u,s as d,t as f}from"./dist-DlirbHVs.js";import{h as p}from"./chat-page-LOR5JxDh.js";import{D as m}from"./markdown-view-ihzUc4ud.js";import{t as h}from"./x-B_N4OPjy.js";import{t as g}from"./cn-0WouolD0.js";import{t as _}from"./skeleton-DzdOeGYz.js";import{r as v}from"./turn-outcome-BSbEJx8h.js";import{o as y}from"./product-delivery-4gEqUIsK.js";import{n as b}from"./attachment-utils-core-BPYdUI6y.js";import{r as x}from"./right-workspace-store-Cehybf-G.js";var S=n(),C=e(t(),1),w=r();function T(e){if(!e)return;let t=URL.parse(e,window.location.origin);return t&&[`http:`,`https:`].includes(t.protocol)&&/^(?:https?:\/\/|\/(?!\/))/i.test(e)?t.href:void 0}function E(e){let t=(0,S.c)(30),{item:n,workspaceScope:r,conversationId:g,backgroundPath:_,zh:E,className:O,children:k}=e,{artifact:A,reference:j,task:M}=n,[N,P]=(0,C.useState)(!1),F=A?.title??j?.title??n.id,I;t[0]===j?I=t[1]:(I=j&&y(j),t[0]=j,t[1]=I);let L=I,R=j?.kind===`chat_preview`?j.revision:void 0,z;t[2]!==A?.shareUrl||t[3]!==A?.uri?(z=T(A?.uri)??T(A?.shareUrl),t[2]=A?.shareUrl,t[3]=A?.uri,t[4]=z):z=t[4];let B=z,V=A?.uri,H;t[5]!==V||t[6]!==B?(H=V&&/^\/api\/(?:music-generation\/sessions\/[^/]+\/jobs\/[a-f0-9]{64}\/audio|video-generation\/sessions\/[^/]+\/jobs\/[a-fA-F0-9-]+\/video)$/.test(V)?B:void 0,t[5]=V,t[6]=B,t[7]=H):H=t[7];let U=H,W;t[8]!==A?.workspaceRelativePath||t[9]!==V?(W=V?.startsWith(`media://`)||V&&v(V)||A?.workspaceRelativePath,t[8]=A?.workspaceRelativePath,t[9]=V,t[10]=W):W=t[10];let G=!!W,K=!!(B&&window.electronAPI?.browser),q;return t[11]!==A||t[12]!==_||t[13]!==k||t[14]!==O||t[15]!==g||t[16]!==K||t[17]!==G||t[18]!==U||t[19]!==n.id||t[20]!==N||t[21]!==L||t[22]!==j||t[23]!==R||t[24]!==M?.id||t[25]!==F||t[26]!==B||t[27]!==r||t[28]!==E?(q=L?(0,w.jsx)(i,{to:m(_,L),className:O,children:k}):U||j&&R?(0,w.jsxs)(f,{open:N,onOpenChange:P,children:[(0,w.jsx)(o,{className:O,children:k}),N?(0,w.jsxs)(l,{children:[(0,w.jsx)(a,{className:`xopc-dialog-overlay fixed inset-0 z-[90] bg-black/45`}),(0,w.jsxs)(u,{onKeyDown:D,className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[91] flex h-[min(42rem,calc(100dvh-2rem))] w-[min(56rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge`,children:[(0,w.jsxs)(`header`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,w.jsx)(d,{className:`truncate font-medium text-fg`,children:F}),(0,w.jsx)(s,{className:`sr-only`,children:E?`预览交付物`:`Preview deliverable`}),(0,w.jsx)(c,{"aria-label":E?`关闭预览`:`Close preview`,className:`grid size-8 shrink-0 place-items-center rounded-lg hover:bg-surface-hover`,children:(0,w.jsx)(h,{className:`size-4`})})]}),(0,w.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 pb-4`,children:U?(0,w.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-4 py-4`,children:[A?.kind===`audio`?(0,w.jsx)(`audio`,{controls:!0,preload:`metadata`,src:U,"aria-label":F,className:`w-full max-w-xl`}):(0,w.jsx)(`video`,{controls:!0,playsInline:!0,preload:`metadata`,src:U,"aria-label":F,className:`min-h-0 max-w-full rounded-lg bg-black`}),(0,w.jsx)(`a`,{href:`${U}?download=1`,download:!0,className:`shrink-0 text-sm text-accent-fg hover:underline`,children:E?`下载`:`Download`})]}):j&&R?(0,w.jsx)(p,{leaseId:`personal-deliverable:${n.id}`,reference:j,sourceHash:R,preferredHeight:480,language:E?`zh`:`en`}):null})]})]}):null]}):G||K?(0,w.jsx)(`button`,{type:`button`,className:O,onClick:()=>{let e=x.getState();G&&A?e.openFile({attachment:{...b(A),taskId:M?.id},conversationId:g},r):e.openBrowser(B,r)},children:k}):B?(0,w.jsx)(`a`,{href:B,target:`_blank`,rel:`noopener noreferrer`,className:O,children:k}):(0,w.jsx)(`div`,{className:O,children:k}),t[11]=A,t[12]=_,t[13]=k,t[14]=O,t[15]=g,t[16]=K,t[17]=G,t[18]=U,t[19]=n.id,t[20]=N,t[21]=L,t[22]=j,t[23]=R,t[24]=M?.id,t[25]=F,t[26]=B,t[27]=r,t[28]=E,t[29]=q):q=t[29],q}function D(e){return e.stopPropagation()}function O(){let e=(0,S.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,w.jsxs)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[(0,w.jsx)(_,{className:`h-32 rounded-2xl`}),(0,w.jsx)(_,{className:`h-52 rounded-2xl`}),(0,w.jsx)(_,{className:`h-40 rounded-2xl`})]}),e[0]=t):t=e[0],t}function k(e){let t=(0,S.c)(16),{label:n,title:r,compact:i}=e,a=i&&!!r,o=a&&`-translate-y-2 opacity-0`,s;t[0]===o?s=t[1]:(s=g(`truncate [grid-area:1/1] motion-safe:transition-[opacity,translate] motion-safe:duration-200 motion-safe:ease-out`,o),t[0]=o,t[1]=s);let c;t[2]!==n||t[3]!==a||t[4]!==s?(c=(0,w.jsx)(`span`,{"aria-hidden":a,className:s,children:n}),t[2]=n,t[3]=a,t[4]=s,t[5]=c):c=t[5];let l=!a,u=!a&&`translate-y-2 opacity-0`,d;t[6]===u?d=t[7]:(d=g(`truncate [grid-area:1/1] motion-safe:transition-[opacity,translate] motion-safe:duration-200 motion-safe:ease-out`,u),t[6]=u,t[7]=d);let f;t[8]!==l||t[9]!==d||t[10]!==r?(f=(0,w.jsx)(`span`,{"aria-hidden":l,className:d,children:r}),t[8]=l,t[9]=d,t[10]=r,t[11]=f):f=t[11];let p;return t[12]!==a||t[13]!==c||t[14]!==f?(p=(0,w.jsxs)(`span`,{className:`grid min-w-0 overflow-hidden leading-6`,"data-task-header-compact":a,children:[c,f]}),t[12]=a,t[13]=c,t[14]=f,t[15]=p):p=t[15],p}export{O as n,E as r,k as t};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{a,c as o,i as s,n as c,o as l,r as u,s as d,t as f}from"./dist-DlirbHVs.js";import{h as p}from"./chat-page-3fVhP77N.js";import{D as m}from"./markdown-view-ihzUc4ud.js";import{t as h}from"./x-B_N4OPjy.js";import{t as g}from"./cn-0WouolD0.js";import{t as _}from"./skeleton-DzdOeGYz.js";import{r as v}from"./turn-outcome-BSbEJx8h.js";import{o as y}from"./product-delivery-4gEqUIsK.js";import{n as b}from"./attachment-utils-core-BPYdUI6y.js";import{r as x}from"./right-workspace-store-Cehybf-G.js";var S=n(),C=e(t(),1),w=r();function T(e){if(!e)return;let t=URL.parse(e,window.location.origin);return t&&[`http:`,`https:`].includes(t.protocol)&&/^(?:https?:\/\/|\/(?!\/))/i.test(e)?t.href:void 0}function E(e){let t=(0,S.c)(30),{item:n,workspaceScope:r,conversationId:g,backgroundPath:_,zh:E,className:O,children:k}=e,{artifact:A,reference:j,task:M}=n,[N,P]=(0,C.useState)(!1),F=A?.title??j?.title??n.id,I;t[0]===j?I=t[1]:(I=j&&y(j),t[0]=j,t[1]=I);let L=I,R=j?.kind===`chat_preview`?j.revision:void 0,z;t[2]!==A?.shareUrl||t[3]!==A?.uri?(z=T(A?.uri)??T(A?.shareUrl),t[2]=A?.shareUrl,t[3]=A?.uri,t[4]=z):z=t[4];let B=z,V=A?.uri,H;t[5]!==V||t[6]!==B?(H=V&&/^\/api\/(?:music-generation\/sessions\/[^/]+\/jobs\/[a-f0-9]{64}\/audio|video-generation\/sessions\/[^/]+\/jobs\/[a-fA-F0-9-]+\/video)$/.test(V)?B:void 0,t[5]=V,t[6]=B,t[7]=H):H=t[7];let U=H,W;t[8]!==A?.workspaceRelativePath||t[9]!==V?(W=V?.startsWith(`media://`)||V&&v(V)||A?.workspaceRelativePath,t[8]=A?.workspaceRelativePath,t[9]=V,t[10]=W):W=t[10];let G=!!W,K=!!(B&&window.electronAPI?.browser),q;return t[11]!==A||t[12]!==_||t[13]!==k||t[14]!==O||t[15]!==g||t[16]!==K||t[17]!==G||t[18]!==U||t[19]!==n.id||t[20]!==N||t[21]!==L||t[22]!==j||t[23]!==R||t[24]!==M?.id||t[25]!==F||t[26]!==B||t[27]!==r||t[28]!==E?(q=L?(0,w.jsx)(i,{to:m(_,L),className:O,children:k}):U||j&&R?(0,w.jsxs)(f,{open:N,onOpenChange:P,children:[(0,w.jsx)(o,{className:O,children:k}),N?(0,w.jsxs)(l,{children:[(0,w.jsx)(a,{className:`xopc-dialog-overlay fixed inset-0 z-[90] bg-black/45`}),(0,w.jsxs)(u,{onKeyDown:D,className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[91] flex h-[min(42rem,calc(100dvh-2rem))] w-[min(56rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge`,children:[(0,w.jsxs)(`header`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,w.jsx)(d,{className:`truncate font-medium text-fg`,children:F}),(0,w.jsx)(s,{className:`sr-only`,children:E?`预览交付物`:`Preview deliverable`}),(0,w.jsx)(c,{"aria-label":E?`关闭预览`:`Close preview`,className:`grid size-8 shrink-0 place-items-center rounded-lg hover:bg-surface-hover`,children:(0,w.jsx)(h,{className:`size-4`})})]}),(0,w.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 pb-4`,children:U?(0,w.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-4 py-4`,children:[A?.kind===`audio`?(0,w.jsx)(`audio`,{controls:!0,preload:`metadata`,src:U,"aria-label":F,className:`w-full max-w-xl`}):(0,w.jsx)(`video`,{controls:!0,playsInline:!0,preload:`metadata`,src:U,"aria-label":F,className:`min-h-0 max-w-full rounded-lg bg-black`}),(0,w.jsx)(`a`,{href:`${U}?download=1`,download:!0,className:`shrink-0 text-sm text-accent-fg hover:underline`,children:E?`下载`:`Download`})]}):j&&R?(0,w.jsx)(p,{leaseId:`personal-deliverable:${n.id}`,reference:j,sourceHash:R,preferredHeight:480,language:E?`zh`:`en`}):null})]})]}):null]}):G||K?(0,w.jsx)(`button`,{type:`button`,className:O,onClick:()=>{let e=x.getState();G&&A?e.openFile({attachment:{...b(A),taskId:M?.id},conversationId:g},r):e.openBrowser(B,r)},children:k}):B?(0,w.jsx)(`a`,{href:B,target:`_blank`,rel:`noopener noreferrer`,className:O,children:k}):(0,w.jsx)(`div`,{className:O,children:k}),t[11]=A,t[12]=_,t[13]=k,t[14]=O,t[15]=g,t[16]=K,t[17]=G,t[18]=U,t[19]=n.id,t[20]=N,t[21]=L,t[22]=j,t[23]=R,t[24]=M?.id,t[25]=F,t[26]=B,t[27]=r,t[28]=E,t[29]=q):q=t[29],q}function D(e){return e.stopPropagation()}function O(){let e=(0,S.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,w.jsxs)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[(0,w.jsx)(_,{className:`h-32 rounded-2xl`}),(0,w.jsx)(_,{className:`h-52 rounded-2xl`}),(0,w.jsx)(_,{className:`h-40 rounded-2xl`})]}),e[0]=t):t=e[0],t}function k(e){let t=(0,S.c)(16),{label:n,title:r,compact:i}=e,a=i&&!!r,o=a&&`-translate-y-2 opacity-0`,s;t[0]===o?s=t[1]:(s=g(`truncate [grid-area:1/1] motion-safe:transition-[opacity,translate] motion-safe:duration-200 motion-safe:ease-out`,o),t[0]=o,t[1]=s);let c;t[2]!==n||t[3]!==a||t[4]!==s?(c=(0,w.jsx)(`span`,{"aria-hidden":a,className:s,children:n}),t[2]=n,t[3]=a,t[4]=s,t[5]=c):c=t[5];let l=!a,u=!a&&`translate-y-2 opacity-0`,d;t[6]===u?d=t[7]:(d=g(`truncate [grid-area:1/1] motion-safe:transition-[opacity,translate] motion-safe:duration-200 motion-safe:ease-out`,u),t[6]=u,t[7]=d);let f;t[8]!==l||t[9]!==d||t[10]!==r?(f=(0,w.jsx)(`span`,{"aria-hidden":l,className:d,children:r}),t[8]=l,t[9]=d,t[10]=r,t[11]=f):f=t[11];let p;return t[12]!==a||t[13]!==c||t[14]!==f?(p=(0,w.jsxs)(`span`,{className:`grid min-w-0 overflow-hidden leading-6`,"data-task-header-compact":a,children:[c,f]}),t[12]=a,t[13]=c,t[14]=f,t[15]=p):p=t[15],p}export{O as n,E as r,k as t};