@xopcai/xopc 0.0.402 → 0.0.404

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 (168) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DF_bLVLU.js → agent-avatar-dicebear-CdwFK70g.js} +1 -1
  4. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-BMj9HwIQ.js +1 -0
  5. package/dist/gateway/static/root/assets/{agents-admin-api-DvSe10zu.js → agents-admin-api-D6XzhsQy.js} +1 -1
  6. package/dist/gateway/static/root/assets/agents-hrm6V8Dp.js +77 -0
  7. package/dist/gateway/static/root/assets/{app-management-settings-panel-Cr_dcDOi.js → app-management-settings-panel-Rg9jOmoj.js} +1 -1
  8. package/dist/gateway/static/root/assets/{appearance-settings-C5TsJu_t.js → appearance-settings-S3yp0GUO.js} +1 -1
  9. package/dist/gateway/static/root/assets/apps-page-ChrJSB_2.js +1 -0
  10. package/dist/gateway/static/root/assets/{archive-plugin-CpsVjh9E.js → archive-plugin-J7hwA5cs.js} +1 -1
  11. package/dist/gateway/static/root/assets/{automations-page-Db1YnE2r.js → automations-page-Cesz1cjw.js} +1 -1
  12. package/dist/gateway/static/root/assets/automations-workspace-DdopDyED.js +6 -0
  13. package/dist/gateway/static/root/assets/{binary-plugins-DYdnW_Fa.js → binary-plugins-Bg4Se8Kg.js} +1 -1
  14. package/dist/gateway/static/root/assets/{block-editor-HZ37eyhY.js → block-editor-Bw1sO9YH.js} +40 -40
  15. package/dist/gateway/static/root/assets/{browser-automation-inputs-B-V9Vc6B.js → browser-automation-inputs-Y46Mf8aY.js} +1 -1
  16. package/dist/gateway/static/root/assets/browser-automations-page-BcNjBdFQ.js +3 -0
  17. package/dist/gateway/static/root/assets/browser-settings-page-ByeqxrSF.js +3 -0
  18. package/dist/gateway/static/root/assets/{capabilities-glv1DeRI.js → capabilities-CIv3LUQk.js} +1 -1
  19. package/dist/gateway/static/root/assets/{capabilities-page-DEZJFRU_.js → capabilities-page-BUTQSo3A.js} +2 -2
  20. package/dist/gateway/static/root/assets/capabilities-settings-panel-B-Uwmjbo.js +8 -0
  21. package/dist/gateway/static/root/assets/{capability-header-actions-BBPBfpGd.js → capability-header-actions-BGGJKzPL.js} +1 -1
  22. package/dist/gateway/static/root/assets/channels-z6iuM4HE.js +1 -0
  23. package/dist/gateway/static/root/assets/{chat-terminal-dock-DQWv9Smb.js → chat-terminal-dock-oMmP0flJ.js} +2 -2
  24. package/dist/gateway/static/root/assets/{computer-settings-page-CyPqxL6X.js → computer-settings-page-CERhSG5W.js} +1 -1
  25. package/dist/gateway/static/root/assets/{connector-service-page-DmCt-Kgx.js → connector-service-page-DyW3mLTh.js} +1 -1
  26. package/dist/gateway/static/root/assets/connectors-page-CdMwhiio.js +1 -0
  27. package/dist/gateway/static/root/assets/{date-picker-aOgNPu_Y.js → date-picker-CO3Jhdzg.js} +1 -1
  28. package/dist/gateway/static/root/assets/{dependency-picker-oALjIlhN.js → dependency-picker-DbyMpo5J.js} +1 -1
  29. package/dist/gateway/static/root/assets/{desktop-pet-pp9_jT3M.js → desktop-pet-DJ9OAPJs.js} +1 -1
  30. package/dist/gateway/static/root/assets/{desktop-pet-settings-BZCCh5T4.js → desktop-pet-settings-CNrNXWlk.js} +1 -1
  31. package/dist/gateway/static/root/assets/{device-pairing-wizard-DpKzQlqA.js → device-pairing-wizard-TzK-VCuf.js} +1 -1
  32. package/dist/gateway/static/root/assets/{directory-picker-path-field-LSNVNUaG.js → directory-picker-path-field-BmFgRA8G.js} +1 -1
  33. package/dist/gateway/static/root/assets/{extension-debug-page-Bvy_tPme.js → extension-debug-page-C3ZpHHYc.js} +1 -1
  34. package/dist/gateway/static/root/assets/{extension-page-D3J8-8AM.js → extension-page-gfOwpT2R.js} +1 -1
  35. package/dist/gateway/static/root/assets/{extension-settings-page-F6KLsxCY.js → extension-settings-page-BS7cDqZJ.js} +1 -1
  36. package/dist/gateway/static/root/assets/{gateway-config-swr-DAir1JsW.js → gateway-config-swr-BvuySoCX.js} +1 -1
  37. package/dist/gateway/static/root/assets/{gateway-realtime-dE0XrVAT.js → gateway-realtime-SBtdXzco.js} +1 -1
  38. package/dist/gateway/static/root/assets/gateway-realtime-store-dKq2fm2X.js +1 -0
  39. package/dist/gateway/static/root/assets/gateway-settings-UB6hyqcj.js +1 -0
  40. package/dist/gateway/static/root/assets/{gateway-startup-retry-CqyGHM2M.js → gateway-startup-retry-CEpuztYK.js} +1 -1
  41. package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-BCCIvIlA.js → highlighted-body-KQOG7T2V-BRfDRn2k.js} +1 -1
  42. package/dist/gateway/static/root/assets/home-page-DBUnR1DO.js +2 -0
  43. package/dist/gateway/static/root/assets/{image-generation-api-DjQXmXWa.js → image-generation-api-BoMWmqwF.js} +1 -1
  44. package/dist/gateway/static/root/assets/{imports-page-Bg5N_9Vg.js → imports-page-CPiPsiEP.js} +1 -1
  45. package/dist/gateway/static/root/assets/{index-cmsFpzI8.js → index-DmURUvvA.js} +114 -114
  46. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BxH3LBLL.js → keyboard-shortcuts-settings-D9y8h4dR.js} +1 -1
  47. package/dist/gateway/static/root/assets/local-app-workbench-page-DoAmV6on.js +1 -0
  48. package/dist/gateway/static/root/assets/{local-apps-page-CsTZ1d01.js → local-apps-page-CE6Ag8oQ.js} +1 -1
  49. package/dist/gateway/static/root/assets/{local-session-drafts-fhip41-L.js → local-session-drafts-DhJjHCfQ.js} +1 -1
  50. package/dist/gateway/static/root/assets/{locale-store-Jnhw2WMv.js → locale-store-D5h-Ha6-.js} +1 -1
  51. package/dist/gateway/static/root/assets/logs-page-DFysUb2k.js +2 -0
  52. package/dist/gateway/static/root/assets/management-settings-CmXPsu0I.js +1 -0
  53. package/dist/gateway/static/root/assets/{markdown-view-B58RypQ4.js → markdown-view-CthsQiiO.js} +1 -1
  54. package/dist/gateway/static/root/assets/{media-plugins-CGq_o7tI.js → media-plugins-DvfdiczR.js} +1 -1
  55. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-SuiLTd5Y.js +1 -0
  56. package/dist/gateway/static/root/assets/{messages-DBvKzlCl.js → messages-Bwv-AOYl.js} +2 -2
  57. package/dist/gateway/static/root/assets/note-detail-panel-BpddDFQt.js +5 -0
  58. package/dist/gateway/static/root/assets/note-image-lightbox-CMLVzPsQ.js +1 -0
  59. package/dist/gateway/static/root/assets/notes-page-DQ4KZsWt.js +8 -0
  60. package/dist/gateway/static/root/assets/{page-context-capture-button-BH9WwSgw.js → page-context-capture-button-BcxVEGa2.js} +1 -1
  61. package/dist/gateway/static/root/assets/personal-page-CCQDxb7E.js +1 -0
  62. package/dist/gateway/static/root/assets/plugin-details-dialog-CGFQ_-bG.js +1 -0
  63. package/dist/gateway/static/root/assets/plugin-presentation-DF1gfuGf.js +1 -0
  64. package/dist/gateway/static/root/assets/{preview-open-alternatives-rJ3l8Ii4.js → preview-open-alternatives-CXjjpXVx.js} +1 -1
  65. package/dist/gateway/static/root/assets/{product-open-page-CuzuFyIk.js → product-open-page-DqiyvM4c.js} +1 -1
  66. package/dist/gateway/static/root/assets/{product-preview-content-Dw2DstzN.js → product-preview-content-f7Q4giA3.js} +1 -1
  67. package/dist/gateway/static/root/assets/project-detail-page-PBK7vXK5.js +1 -0
  68. package/dist/gateway/static/root/assets/projects-page-DO_pIhy-.js +1 -0
  69. package/dist/gateway/static/root/assets/{registry-api-BbUEMGcj.js → registry-api-Bf0hVPNV.js} +1 -1
  70. package/dist/gateway/static/root/assets/{remote-access-hub-CpEq4PU0.js → remote-access-hub-BFtELmg0.js} +1 -1
  71. package/dist/gateway/static/root/assets/{runtime-tools-api-D0xtCTXr.js → runtime-tools-api-ByH1meP7.js} +1 -1
  72. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-CNar1-_V.js → runtime-tools-settings-panel-B9Beu-oK.js} +1 -1
  73. package/dist/gateway/static/root/assets/{schema-form-D_cAMxj5.js → schema-form-ZAX7C5uI.js} +1 -1
  74. package/dist/gateway/static/root/assets/{session-api-CAKgrbgz.js → session-api-fVuszA_P.js} +1 -1
  75. package/dist/gateway/static/root/assets/{session-manager-D_N7qha7.js → session-manager-BUMUjup5.js} +1 -1
  76. package/dist/gateway/static/root/assets/sessions-page-D27knqOl.js +1 -0
  77. package/dist/gateway/static/root/assets/settings-advanced-gate-CDzdr1zW.js +1 -0
  78. package/dist/gateway/static/root/assets/{settings-form-section-DvLxOebb.js → settings-form-section-BTUFu5KS.js} +1 -1
  79. package/dist/gateway/static/root/assets/{settings-page-C6Tl6TD4.js → settings-page-YFr6zzh7.js} +1 -1
  80. package/dist/gateway/static/root/assets/setup-status-panel-C5Jszsd1.js +1 -0
  81. package/dist/gateway/static/root/assets/{share-preview-page-BLraXBAe.js → share-preview-page-CsfrvY_G.js} +1 -1
  82. package/dist/gateway/static/root/assets/shares-settings-BW6BNot0.js +1 -0
  83. package/dist/gateway/static/root/assets/{skill-api-BE_i8VdM.js → skill-api-o3HSgF_K.js} +1 -1
  84. package/dist/gateway/static/root/assets/skill-reload-api-BJsPnE87.js +1 -0
  85. package/dist/gateway/static/root/assets/skills-page-Kuf2t7MG.js +2 -0
  86. package/dist/gateway/static/root/assets/{style-pk3FR76e.js → style-DOz6lLJB.js} +1 -1
  87. package/dist/gateway/static/root/assets/{system-settings-panel-M550B6Mj.js → system-settings-panel-B69rR6vw.js} +1 -1
  88. package/dist/gateway/static/root/assets/task-detail-page-DOb97OLI.js +2 -0
  89. package/dist/gateway/static/root/assets/{task-expandable-content-HdEeV_0-.js → task-expandable-content-BZCJqajv.js} +1 -1
  90. package/dist/gateway/static/root/assets/tracing-settings-page-BIq3Ayeg.js +1 -0
  91. package/dist/gateway/static/root/assets/{tunnel-api-CC_TCY7S.js → tunnel-api-V9pJ8fUo.js} +1 -1
  92. package/dist/gateway/static/root/assets/usage-page-DZdpti28.js +1 -0
  93. package/dist/gateway/static/root/assets/{use-autosave-DrxAqqzV.js → use-autosave-BnMIUc_5.js} +1 -1
  94. package/dist/gateway/static/root/assets/user-model-page-BEgJ97hp.js +2 -0
  95. package/dist/gateway/static/root/assets/{voice-api-key-field-Bu4paIbu.js → voice-api-key-field-1h6fMaZL.js} +1 -1
  96. package/dist/gateway/static/root/assets/{voice-config-api-T3nM4buh.js → voice-config-api-CRjdZdJF.js} +1 -1
  97. package/dist/gateway/static/root/assets/{work-discovery-overlay-3TAUYZF4.js → work-discovery-overlay-CVNqSNz8.js} +1 -1
  98. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-sgFaaLoB.js → workflow-run-setup-panel-Dq63AthQ.js} +2 -2
  99. package/dist/gateway/static/root/assets/workflows-page-CfA1iwZu.js +6 -0
  100. package/dist/gateway/static/root/assets/{xopc-cloud-account-card-DMZelX5s.js → xopc-cloud-account-card-BsW2acj1.js} +1 -1
  101. package/dist/gateway/static/root/index.html +14 -14
  102. package/dist/package.js +1 -1
  103. package/dist/src/agent/tool-manuals/computer.d.ts +1 -1
  104. package/dist/src/agent/tool-manuals/computer.js +2 -2
  105. package/dist/src/cli/commands/extension-marketplace.js +2 -2
  106. package/dist/src/cli/commands/extension.js +1 -1
  107. package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
  108. package/dist/src/cli/commands/onboard.js +1 -1
  109. package/dist/src/computer/broker.d.ts +2 -0
  110. package/dist/src/computer/broker.js +64 -19
  111. package/dist/src/computer/diagnostics.d.ts +6 -0
  112. package/dist/src/computer/diagnostics.js +7 -2
  113. package/dist/src/computer/keyboard.d.ts +2 -0
  114. package/dist/src/computer/keyboard.js +31 -0
  115. package/dist/src/computer/model-adapter.d.ts +6 -0
  116. package/dist/src/computer/model-adapter.js +76 -4
  117. package/dist/src/computer/runtime.d.ts +9 -1
  118. package/dist/src/computer/runtime.js +73 -5
  119. package/dist/src/computer/semantic-plan.d.ts +41 -0
  120. package/dist/src/computer/semantic-plan.js +95 -0
  121. package/dist/src/computer/task-state.js +3 -2
  122. package/dist/src/extensions/update.js +1 -1
  123. package/dist/src/gateway/auth.d.ts +2 -0
  124. package/dist/src/gateway/auth.js +13 -4
  125. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
  126. package/dist/src/gateway/hono/routes/config.js +1 -1
  127. package/dist/src/gateway/hono/routes/connectors.js +1 -1
  128. package/dist/src/gateway/security/audit.js +3 -3
  129. package/dist/src/gateway/service/config-coordinator.js +1 -1
  130. package/dist/src/gateway/service.js +2 -2
  131. package/dist/src/infra/update-restart.js +1 -1
  132. package/dist/src/infra/update-runner.js +1 -1
  133. package/package.json +4 -4
  134. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CB96Cbva.js +0 -1
  135. package/dist/gateway/static/root/assets/agents-C97HREhT.js +0 -77
  136. package/dist/gateway/static/root/assets/apps-page-erjVBKui.js +0 -1
  137. package/dist/gateway/static/root/assets/automations-workspace-iTSZBSZf.js +0 -6
  138. package/dist/gateway/static/root/assets/browser-automations-page-D0lBDbJO.js +0 -3
  139. package/dist/gateway/static/root/assets/browser-settings-page-DIbXx7Ux.js +0 -3
  140. package/dist/gateway/static/root/assets/capabilities-settings-panel-BfdoIjPK.js +0 -8
  141. package/dist/gateway/static/root/assets/channels-CapZyaWK.js +0 -1
  142. package/dist/gateway/static/root/assets/connectors-page-3xUE-PGt.js +0 -1
  143. package/dist/gateway/static/root/assets/gateway-realtime-store-CPlVuu0d.js +0 -1
  144. package/dist/gateway/static/root/assets/gateway-settings-_YecsQF1.js +0 -1
  145. package/dist/gateway/static/root/assets/home-page-DUoecphg.js +0 -2
  146. package/dist/gateway/static/root/assets/local-app-workbench-page-C7RejhJl.js +0 -1
  147. package/dist/gateway/static/root/assets/logs-page-uLju0b0e.js +0 -2
  148. package/dist/gateway/static/root/assets/management-settings-BkTmllrn.js +0 -1
  149. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-DdlL1T6J.js +0 -1
  150. package/dist/gateway/static/root/assets/note-detail-panel-Cps8VMV6.js +0 -5
  151. package/dist/gateway/static/root/assets/note-image-lightbox-BYNLO2pt.js +0 -1
  152. package/dist/gateway/static/root/assets/notes-page-CdmoFpQ9.js +0 -8
  153. package/dist/gateway/static/root/assets/personal-page-UKNVJRDn.js +0 -1
  154. package/dist/gateway/static/root/assets/plugin-details-dialog-gvBSFAhm.js +0 -1
  155. package/dist/gateway/static/root/assets/plugin-presentation-C0la7V8t.js +0 -1
  156. package/dist/gateway/static/root/assets/project-detail-page-C0XssfWQ.js +0 -1
  157. package/dist/gateway/static/root/assets/projects-page-cT6yy_Xk.js +0 -1
  158. package/dist/gateway/static/root/assets/sessions-page-D5qR92KP.js +0 -1
  159. package/dist/gateway/static/root/assets/settings-advanced-gate-eKqVXNOq.js +0 -1
  160. package/dist/gateway/static/root/assets/setup-status-panel-DuN4e4iO.js +0 -1
  161. package/dist/gateway/static/root/assets/shares-settings-u2Y5Ljhu.js +0 -1
  162. package/dist/gateway/static/root/assets/skill-reload-api-1xNCuBFH.js +0 -1
  163. package/dist/gateway/static/root/assets/skills-page-Clye5gro.js +0 -2
  164. package/dist/gateway/static/root/assets/task-detail-page-DqFhFqWu.js +0 -2
  165. package/dist/gateway/static/root/assets/tracing-settings-page-nXw76P46.js +0 -1
  166. package/dist/gateway/static/root/assets/usage-page-BZ0t4KYM.js +0 -1
  167. package/dist/gateway/static/root/assets/user-model-page-BAQOJoHC.js +0 -2
  168. package/dist/gateway/static/root/assets/workflows-page-CxNXNDNc.js +0 -6
@@ -0,0 +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{d as i,f as a,t as o}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as ee}from"./circle-check-C23XjkUj.js";import{t as s}from"./folder-open-CyzJ19I9.js";import{t as c}from"./messages-Bwv-AOYl.js";import{t as l}from"./cn-0WouolD0.js";import{a as u,n as te,r as d}from"./locale-store-D5h-Ha6-.js";import{a as f,i as p,o as m,r as ne,s as re,t as h}from"./dist-BGTk37IG.js";import{a as g}from"./vendor-swr-BIWyz7Rc.js";import{$a as ie,$l as _,Af as v,Au as y,Ju as ae,Kc as b,Rc as oe,Rd as x,kl as S,nf as C,pf as w,uf as T}from"./index-DmURUvvA.js";import{t as se}from"./capability-links-DzQWK1Fh.js";import{t as E}from"./capability-icon-DVoZxEgW.js";import{t as D}from"./browser-BLJWD7WI.js";var ce=n(),O=e(D(),1),k=e(t(),1),A=r();function j(e){let t=(0,ce.c)(6),{fields:n,values:r,onChange:i}=e,a;t[0]===n?a=t[1]:(a=Object.entries(n),t[0]=n,t[1]=a);let o;return t[2]!==i||t[3]!==a||t[4]!==r?(o=(0,A.jsx)(A.Fragment,{children:a.map(e=>{let[t,n]=e;return(0,A.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[(0,A.jsxs)(`span`,{children:[n.title,n.required?` *`:``]}),n.type===`boolean`?(0,A.jsx)(`input`,{type:`checkbox`,checked:r[t]===!0,onChange:e=>i({...r,[t]:e.target.checked})}):(0,A.jsx)(`input`,{className:`w-full rounded-lg border border-edge bg-surface-inset px-3 py-2.5`,type:n.sensitive?`password`:n.type===`number`?`number`:`text`,required:n.required,autoComplete:`off`,value:String(r[t]??``),onChange:e=>i({...r,[t]:n.type===`number`?Number(e.target.value):e.target.value})})]},t)})}),t[2]=i,t[3]=a,t[4]=r,t[5]=o):o=t[5],o}function M(e){let t=(0,ce.c)(62),{account:n,fields:r,zh:i,busy:a,attempt:o,initialMethod:ee,onBack:s,onConnect:c,onSave:l,onRedirect:u,onSkip:te}=e,[d,f]=(0,k.useState)(ee&&n.methods.some(e=>e.id===ee)?ee:n.methods[0]?.id??``),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p={},t[0]=p):p=t[0];let[m,ne]=(0,k.useState)(p),[re,h]=(0,k.useState)(``),[g,ie]=(0,k.useState)(),_;t[1]===d?_=t[2]:(_=e=>e.id===d,t[1]=d,t[2]=_);let y=n.methods.find(_),x;t[3]===i?x=t[4]:(x=(e,t)=>i?e:t,t[3]=i,t[4]=x);let S=x,C=o?.challenge?.type===`qr`?o.challenge.url:void 0,w,T;t[5]===C?(w=t[6],T=t[7]):(w=()=>{let e=!1;return ie(void 0),C&&O.toDataURL(C,{width:240,margin:2}).then(t=>{e||ie(t)}).catch(P),()=>{e=!0}},T=[C],t[5]=C,t[6]=w,t[7]=T),(0,k.useEffect)(w,T);let se;t[8]===o?se=t[9]:(se=o&&![`cancelled`,`error`,`connected`].includes(o.state),t[8]=o,t[9]=se);let E=se,D=o?.authorizationUrl??o?.challenge?.url,M=`连接 ${n.title}`,F=`Connect ${n.title}`,I;t[10]!==S||t[11]!==M||t[12]!==F?(I=S(M,F),t[10]=S,t[11]=M,t[12]=F,t[13]=I):I=t[13];let L;t[14]===S?L=t[15]:(L=S(`返回插件详情`,`Back to plugin details`),t[14]=S,t[15]=L);let R;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,A.jsx)(v,{className:`size-4`}),t[16]=R):R=t[16];let z;t[17]!==s||t[18]!==L?(z=(0,A.jsx)(b,{variant:`ghost`,className:`shrink-0`,onClick:s,"aria-label":L,children:R}),t[17]=s,t[18]=L,t[19]=z):z=t[19];let B;t[20]===S?B=t[21]:(B=S(`连接 `,`Connect `),t[20]=S,t[21]=B);let V;t[22]!==n.title||t[23]!==B?(V=(0,A.jsxs)(`h3`,{className:`text-base font-semibold`,children:[B,n.title]}),t[22]=n.title,t[23]=B,t[24]=V):V=t[24];let H;t[25]!==n.description||t[26]!==S?(H=n.description??S(`完成授权后自动检查连接。也可以稍后在详情页继续。`,`The connection is checked after authorization. You can also continue later in plugin details.`),t[25]=n.description,t[26]=S,t[27]=H):H=t[27];let U;t[28]===H?U=t[29]:(U=(0,A.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:H}),t[28]=H,t[29]=U);let W;t[30]!==V||t[31]!==U?(W=(0,A.jsxs)(`div`,{children:[V,U]}),t[30]=V,t[31]=U,t[32]=W):W=t[32];let G;t[33]!==z||t[34]!==W?(G=(0,A.jsxs)(`div`,{className:`flex items-start gap-3`,children:[z,W]}),t[33]=z,t[34]=W,t[35]=G):G=t[35];let K;t[36]!==n.methods||t[37]!==E||t[38]!==a||t[39]!==d||t[40]!==S?(K=n.methods.length>1?(0,A.jsx)(`div`,{role:`tablist`,"aria-label":S(`授权方式`,`Authorization methods`),className:`flex flex-wrap gap-2 rounded-lg bg-surface-inset p-1.5`,children:n.methods.map(e=>(0,A.jsx)(`button`,{role:`tab`,type:`button`,"aria-selected":d===e.id,className:`min-h-10 rounded-md px-3 text-sm ${d===e.id?`bg-surface-panel font-medium text-fg`:`text-fg-muted`}`,disabled:a||!!E,onClick:()=>{f(e.id),ne({})},children:e.title},e.id))}):null,t[36]=n.methods,t[37]=E,t[38]=a,t[39]=d,t[40]=S,t[41]=K):K=t[41];let q=y?.instructions?.length||y?.helpUrl?(0,A.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-edge bg-surface-inset p-4 text-sm text-fg-muted`,children:[y.instructions?.length?(0,A.jsx)(`ol`,{className:`list-decimal space-y-2 pl-5`,children:y.instructions.map(N)}):null,y.helpUrl?(0,A.jsx)(`a`,{className:`text-accent underline`,href:y.helpUrl,target:`_blank`,rel:`noopener noreferrer`,children:S(`打开官方配置说明`,`Open setup instructions`)}):null]}):null,J=(y?.type===`form`||y?.fields?.length)&&!E?(0,A.jsxs)(`form`,{className:`space-y-4`,onSubmit:e=>{e.preventDefault(),l(y.id,m)},children:[(0,A.jsx)(j,{fields:Object.fromEntries((y.fields??[]).filter(e=>r[e]).map(e=>[e,{...r[e],required:!0}])),values:m,onChange:ne}),(0,A.jsxs)(b,{type:`submit`,disabled:a||!y.fields?.every(e=>m[e]!==void 0&&m[e]!==``),children:[a?(0,A.jsx)(ae,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,S(`保存并连接`,`Save and connect`)]})]}):(0,A.jsxs)(`div`,{className:`space-y-4`,children:[E?null:(0,A.jsx)(b,{disabled:a,onClick:()=>c(d),children:S(`连接账号`,`Connect account`)}),E?(0,A.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:o.challenge?.message??(o.state===`preparing`?S(`正在准备登录…`,`Preparing sign-in…`):S(`请完成登录,返回后会自动继续。`,`Finish signing in. Installation continues automatically.`))}):null,C&&E?g?(0,A.jsx)(`img`,{src:g,alt:S(`使用 ${n.title} 扫码授权`,`Scan to authorize ${n.title}`),className:`mx-auto size-60 max-w-full rounded-lg`}):(0,A.jsx)(oe,{className:`mx-auto size-60`}):null,D&&E?(0,A.jsx)(`a`,{href:D,target:`_blank`,rel:`noopener noreferrer`,className:`inline-block text-sm text-accent underline`,children:C?S(`也可以打开授权页面`,`Or open the authorization page`):S(`打开登录页面`,`Open sign-in page`)}):null,o?.expiresAt&&E?(0,A.jsxs)(`p`,{className:`text-center text-xs text-fg-muted`,children:[S(`本次授权有效期至 `,`This sign-in expires at `),new Date(o.expiresAt).toLocaleTimeString()]}):null,o?.error?(0,A.jsx)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:o.error}):null,o?.acceptsRedirect&&E?(0,A.jsxs)(`details`,{className:`text-sm`,children:[(0,A.jsx)(`summary`,{className:`cursor-pointer text-fg-muted`,children:S(`登录后没有自动返回?`,`Did sign-in not return automatically?`)}),(0,A.jsxs)(`form`,{className:`mt-3 space-y-3`,onSubmit:e=>{e.preventDefault(),u(re)},children:[(0,A.jsxs)(`label`,{children:[S(`登录回调地址`,`Sign-in callback URL`),(0,A.jsx)(`input`,{value:re,onChange:e=>h(e.target.value),className:`mt-1 w-full rounded-lg border border-edge bg-surface-inset p-2`})]}),(0,A.jsx)(b,{type:`submit`,disabled:a||!re,children:S(`继续登录`,`Continue sign-in`)})]})]}):null]}),Y;t[42]===S?Y=t[43]:(Y=S(`暂时跳过`,`Skip for now`),t[42]=S,t[43]=Y);let X;t[44]!==a||t[45]!==te||t[46]!==Y?(X=(0,A.jsx)(b,{variant:`secondary`,disabled:a,onClick:te,children:Y}),t[44]=a,t[45]=te,t[46]=Y,t[47]=X):X=t[47];let Z;t[48]===S?Z=t[49]:(Z=S(`相关功能暂不可用,可随时在插件详情中授权。`,`Features requiring this account stay unavailable. Connect later in plugin details.`),t[48]=S,t[49]=Z);let le;t[50]===Z?le=t[51]:(le=(0,A.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:Z}),t[50]=Z,t[51]=le);let ue;t[52]!==X||t[53]!==le?(ue=(0,A.jsxs)(`div`,{className:`border-t border-edge pt-4`,children:[X,le]}),t[52]=X,t[53]=le,t[54]=ue):ue=t[54];let Q;return t[55]!==I||t[56]!==G||t[57]!==K||t[58]!==q||t[59]!==J||t[60]!==ue?(Q=(0,A.jsxs)(`section`,{className:`space-y-5`,"aria-label":I,children:[G,K,q,J,ue]}),t[55]=I,t[56]=G,t[57]=K,t[58]=q,t[59]=J,t[60]=ue,t[61]=Q):Q=t[61],Q}function N(e,t){return(0,A.jsx)(`li`,{children:e},t)}function P(){}async function F(e,t=`GET`,n){let r=await u(d(e),{method:t,...n===void 0?{}:{body:JSON.stringify(n)}});if(!r.ok)throw Error(r.error??`Request failed`);return r.payload}function I({extension:e,zh:t,onChanged:n,onStart:r,onInstalled:i,initialConnect:a=!1}){let s=`/api/extensions/agent-plugins/${encodeURIComponent(e.pluginId)}`,[c,l]=(0,k.useState)(),[u,te]=(0,k.useState)({}),[d,f]=(0,k.useState)(!1),[p,m]=(0,k.useState)(``),[ne,re]=(0,k.useState)({}),[h,g]=(0,k.useState)(null),[ie,_]=(0,k.useState)(``),[v,y]=(0,k.useState)(null),[x,S]=(0,k.useState)(!1),w=(0,k.useRef)(new Set),se=(0,k.useRef)(new Set),E=(0,k.useRef)(void 0),D=(0,k.useRef)(null),ce=(0,k.useRef)(new Set),O=(e,n)=>t?e:n,N=e.setup?.authorizations??[],P=new Set(N.flatMap(e=>e.servers)),I=[...N,...(c?.connections??[]).filter(t=>!P.has(t.name)&&(e.components?.mcp.find(e=>e.name===t.name)?.type!==`stdio`||t.state===`token_required`)).map(t=>{let n=t.state===`token_required`||e.components?.mcp.find(e=>e.name===t.name)?.connectionAuth?.mode===`api-key`;return{id:t.name,title:t.name,servers:[t.name],methods:[{id:n?`api-key`:`oauth`,title:n?O(`访问令牌`,`Access token`):O(`浏览器登录`,`Browser sign-in`),type:n?`form`:`oauth`,...n?{fields:[`__apiKey`]}:{server:t.name}}]}})],L=e=>e.servers.every(e=>c?.connections.find(t=>t.name===e)?.state===`connected`)&&(!N.some(t=>t.id===e.id)||c?.authorizations?.find(t=>t.id===e.id)?.state===`connected`),R=(c?.authorizations??[]).flatMap(e=>(e.issues??[]).map(t=>({...t,account:I.find(t=>t.id===e.id)}))),z=I.filter(e=>!L(e)),B=c?.installed||c?.state===`completed`,V=e.setup?.userConfig??{},H=new Set(N.flatMap(e=>e.methods.flatMap(e=>e.fields??[]))),U=Object.fromEntries(Object.entries(V).filter(([e])=>!H.has(e))),W=c?.error===`Connection verification failed. Check the credentials or login status and try again.`?O(`连接验证未通过,请检查凭据或登录状态后重试。`,c.error):c?.error,G=Object.fromEntries(Object.entries(V).filter(([e])=>c?.missingConfig?.includes(e))),K=d||c?.state===`running`,q=I.find(e=>e.id===v);(0,k.useEffect)(()=>{let e=!1;return F(`${s}/setup`).then(t=>{e||l(t)}).catch(t=>{e||(l(null),m(String(t)))}),()=>{e=!0}},[s]),(0,k.useEffect)(()=>{if(c?.state!==`running`)return;let e=!1,t=!1,r=setInterval(()=>{t||(t=!0,F(`${s}/setup`).then(t=>{e||(l(t),t?.state!==`running`&&n())}).catch(t=>{e||m(String(t))}).finally(()=>{t=!1}))},750);return()=>{e=!0,clearInterval(r)}},[s,c?.state]),(0,k.useEffect)(()=>{if(!c||!c.connections.some(e=>[`oauth_required`,`error`].includes(e.state)))return;let e=!1;return F(`${s}/setup/reusable`).then(t=>{e||re(t)}).catch(()=>{e||re({})}),()=>{e=!0}},[s,c?.revision]),(0,k.useEffect)(()=>{if(!ie||c?.state===`completed`)return;let e=!1,t=!1,n=async()=>{if(!t){t=!0;try{let t=await F(`${s}/setup/auth/${encodeURIComponent(ie)}`);e||g(t)}catch(t){e||m(String(t))}finally{t=!1}}};n();let r=setInterval(()=>void n(),1500),i=()=>void n();return window.addEventListener(`focus`,i),()=>{e=!0,clearInterval(r),window.removeEventListener(`focus`,i)}},[s,ie,c?.state]),(0,k.useEffect)(()=>{let e=h?.authorizationUrl??(h?.challenge?.type===`url`?h.challenge.url:void 0);if(!h)return;if(h.error||[`cancelled`,`error`,`connected`].includes(h.state)){D.current?.close(),D.current=null;return}if(!e){h.challenge?.type===`qr`&&(D.current?.close(),D.current=null);return}let t=`${h.id}:${e}`;if(ce.current.has(t))return;ce.current.add(t);let n=D.current;D.current=null,n&&!n.closed?n.location.replace(e):window.open(e,`_blank`,`noopener,noreferrer`)},[h]);async function J(e,t={},r=c?.revision){f(!0),m(``);try{let a=await F(`${s}/setup`,`POST`,{action:e,expectedRevision:r,...e===`start`?{}:{idempotencyKey:crypto.randomUUID()},...t}),o=e===`configure`&&N.find(e=>e.id===t.authorization)?.methods.some(e=>e.id===t.method&&e.type===`cli`);return([`reuse`,`start`].includes(e)||e===`configure`&&!o)&&(te({}),S(!1),a=await F(`${s}/setup`,`POST`,{action:`prepare`,expectedRevision:a.revision,idempotencyKey:crypto.randomUUID()})),l(a),await n(),[`complete`,`defer`].includes(e)&&(y(null),g(null),_(``),D.current?.close(),D.current=null,i?.()),a}catch(e){m(e instanceof Error?e.message:String(e));try{l(await F(`${s}/setup`))}catch{}return null}finally{f(!1)}}(0,k.useEffect)(()=>{if(!c||K||p||[`cancelled`,`running`,`failed`].includes(c.state)||c.state===`completed`)return;let e,t=``;if(c.state===`pending`?(e=`prepare`,t=`prepare:${s}:${c.revision}`):h?.state===`connected`&&(e=`prepare`,t=`auth:${s}:${h.id}`),e&&!w.current.has(t)){w.current.add(t),J(e);return}c.resources===`ready`&&!c.missingConfig?.length&&!c.partial&&c.connections.every(e=>e.state===`connected`)&&(c.authorizations??[]).every(e=>e.state===`connected`)&&(t=`complete:${s}:${c.revision}`,w.current.has(t)||(w.current.add(t),J(`complete`)))},[c,h,K,p,s]),(0,k.useEffect)(()=>{K||!c||c.state===`cancelled`||(q&&c.revision!==E.current&&L(q)?(y(null),g(null),_(``)):(!B||a)&&c.resources===`ready`&&(!c.missingConfig?.length||a&&!c.missingConfig.some(e=>e in U))&&!v&&z[0]&&!se.current.has(z[0].id)&&(se.current.add(z[0].id),E.current=c.revision,y(z[0].id)))},[c,K,B,v,a]);function Y(e,t){let n=e.methods.find(e=>e.id===t),r=n?.type===`oauth`||n?.type===`cli`?window.open(`about:blank`,`_blank`):null;r&&(r.opener=null),D.current=r,g(null),J(`authorize`,{server:e.id,...N.some(t=>t.id===e.id)?{method:t}:{}}).then(t=>{t?_(e.id):(r?.close(),D.current=null)})}async function X(t,n,r){if(n===`api-key`&&!N.some(e=>e.id===t.id)){f(!0),m(``);try{let n=e.components?.mcp.find(e=>e.name===t.id);await F(`${s}/mcp/${encodeURIComponent(t.id)}/auth`,`PUT`,{mode:`api-key`,secrets:[{target:n.type===`stdio`?`env`:`headers`,key:n.connectionAuth?.headerName??(n.type===`stdio`?`API_KEY`:`Authorization`),prefix:n.connectionAuth?.prefix??(n.type===`stdio`?``:`Bearer `),value:r.__apiKey}]});let i=await F(`${s}/setup`);l(i),f(!1),await J(`prepare`,{},i.revision);return}catch(e){m(String(e)),f(!1);return}f(!1)}else if(t.methods.find(e=>e.id===n)?.type===`cli`){let e=window.open(`about:blank`,`_blank`);e&&(e.opener=null),D.current=e,g(null);let i=await J(`configure`,{authorization:t.id,method:n,values:r},c?.revision);i&&await J(`authorize`,{server:t.id,method:n},i.revision)?_(t.id):(e?.close(),D.current=null)}else await J(`configure`,{authorization:t.id,method:n,values:r})}if(c===void 0)return(0,A.jsx)(oe,{className:`h-40 w-full`});let Z=()=>{J(`defer`)};return q?(0,A.jsxs)(`div`,{className:`space-y-3`,children:[(0,A.jsx)(M,{initialMethod:c?.authorizations?.find(e=>e.id===q.id)?.method,account:q,fields:{...V,__apiKey:{type:`string`,title:O(`访问令牌`,`Access token`),required:!0,sensitive:!0}},zh:t,busy:K,attempt:h,onBack:()=>y(null),onConnect:e=>Y(q,e),onSave:(e,t)=>void X(q,e,t),onRedirect:e=>{f(!0),F(`${s}/setup/auth/${encodeURIComponent(ie)}/redirect`,`POST`,{url:e}).catch(e=>m(String(e))).finally(()=>f(!1))},onSkip:Z},`${q.id}:${c?.authorizations?.find(e=>e.id===q.id)?.method??``}`),ne[q.id]?.map(e=>(0,A.jsxs)(b,{disabled:K,variant:`secondary`,onClick:()=>void J(`reuse`,{server:q.id,sourceServerId:e.id}),children:[O(`使用已登录账号:`,`Use signed-in account: `),e.name]},e.id)),p||W&&q.servers.some(e=>c?.connections.find(t=>t.name===e)?.state===`error`)?(0,A.jsx)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:p||W}):null]}):(0,A.jsxs)(`section`,{className:`space-y-5`,"aria-label":O(`插件安装与授权`,`Plugin setup`),children:[B?(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h3`,{className:`font-medium`,children:O(`安装完成`,`Installation complete`)}),(0,A.jsx)(`p`,{role:`status`,className:`mt-1 text-sm text-fg-muted`,children:e.activationEligible===!1?O(`插件已停用。`,`Plugin is disabled.`):c?.partial||z.length||R.length||c?.missingConfig?.length?O(`插件已安装,部分功能仍需要授权。`,`Plugin installed. Some features still need authorization.`):O(`所有 Agent 均可使用。可在 Agent 设置中单独调整。`,`Available to all agents. Customize individual agents in Agent settings.`)})]}):(0,A.jsxs)(`div`,{className:`rounded-xl border border-edge p-4`,children:[(0,A.jsx)(`h3`,{className:`font-medium`,children:O(`安装准备`,`Installation setup`)}),(0,A.jsx)(`ol`,{className:`mt-4 space-y-4 text-sm`,"aria-live":`polite`,children:[{name:O(`准备资源`,`Prepare resources`),done:c?.resources===`ready`,running:K&&c?.resources!==`ready`},{name:O(`授权账号`,`Authorize accounts`),done:c?.resources===`ready`&&!c?.missingConfig?.length&&z.length===0,running:!1},{name:O(`加载可用工具`,`Load available tools`),done:!1,running:K&&c?.resources===`ready`}].map(e=>(0,A.jsxs)(`li`,{className:`flex items-center gap-3`,children:[e.done?(0,A.jsx)(ee,{className:`size-5 text-accent`,"aria-hidden":!0}):e.running?(0,A.jsx)(ae,{className:`size-5 animate-spin text-accent`,"aria-hidden":!0}):(0,A.jsx)(C,{className:`size-5 text-fg-muted`,"aria-hidden":!0}),e.name]},e.name))}),(0,A.jsx)(`p`,{className:`mt-4 text-xs text-fg-muted`,children:O(`安装后所有 Agent 均可使用,可在各自的设置中调整。`,`Available to all agents after installation. Customize individual agents in Agent settings.`)})]}),!c||c.state===`cancelled`?(0,A.jsx)(b,{disabled:d||e.readiness===`blocked`,onClick:()=>void J(`start`),children:O(`继续安装`,`Continue installation`)}):(0,A.jsxs)(A.Fragment,{children:[c.missingConfig?.length||x?(0,A.jsxs)(`form`,{className:`space-y-4 rounded-xl border border-edge p-4`,onSubmit:e=>{e.preventDefault(),J(`configure`,{values:u})},children:[(0,A.jsx)(`h4`,{className:`font-medium`,children:O(`补充配置`,`Required configuration`)}),(0,A.jsx)(j,{fields:x?U:G,values:u,onChange:te}),(0,A.jsx)(b,{type:`submit`,disabled:K||!Object.keys(u).length,children:O(`继续`,`Continue`)})]}):null,B&&(z.length||c.missingConfig?.length)?(0,A.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl border border-amber-500/30 bg-amber-500/10 p-4 text-sm`,children:[(0,A.jsx)(T,{className:`mt-0.5 size-5 shrink-0`,"aria-hidden":!0}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`p`,{className:`font-medium`,children:O(`需要授权`,`Authorization required`)}),(0,A.jsx)(`p`,{className:`mt-1 text-fg-muted`,children:O(`授权后即可使用相关功能。已就绪的功能可继续使用。`,`Connect these accounts to use their features. Ready features remain available.`)})]})]}):null,R.length?(0,A.jsx)(`div`,{className:`space-y-3`,"aria-label":O(`需要补充权限`,`Additional permissions required`),children:R.map(e=>(0,A.jsxs)(`div`,{role:`alert`,className:`space-y-3 rounded-xl border border-amber-500/30 bg-amber-500/10 p-4 text-sm`,children:[(0,A.jsx)(`p`,{className:`font-medium`,children:e.title}),(0,A.jsx)(`p`,{className:`text-fg-muted`,children:O(`账号已连接,以下权限尚未就绪;其他已授权功能可继续使用。`,`Account connected. These permissions are not ready; other authorized features remain available.`)}),e.scopes.length?(0,A.jsx)(`p`,{className:`break-all font-mono text-xs`,children:e.scopes.join(`, `)}):null,(0,A.jsx)(`ol`,{className:`list-inside list-decimal space-y-1 text-fg-muted`,children:e.instructions.map(e=>(0,A.jsx)(`li`,{children:e},e))}),(0,A.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[e.helpUrl?(0,A.jsx)(b,{variant:`secondary`,asChild:!0,children:(0,A.jsx)(`a`,{href:e.helpUrl,target:`_blank`,rel:`noopener noreferrer`,children:O(`前往开通应用权限`,`Open application permissions`)})}):null,e.method&&e.account?(0,A.jsx)(b,{disabled:K,onClick:()=>{E.current=c.revision,y(e.account.id),Y(e.account,e.method)},children:O(`补充授权`,`Grant missing permissions`)}):null,(0,A.jsx)(b,{variant:`secondary`,disabled:K,onClick:()=>void J(`prepare`),children:O(`重新检查权限`,`Check permissions again`)})]})]},`${e.account?.id}:${e.id}`))}):null,I.length?(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(`h4`,{className:`text-sm font-medium`,children:O(`账号与连接`,`Accounts and connections`)}),I.map(e=>(0,A.jsxs)(`div`,{role:`group`,"aria-label":e.title,className:`flex items-center justify-between gap-3 rounded-lg border border-edge p-3`,children:[(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsx)(`p`,{className:`text-sm font-medium`,children:e.title}),(0,A.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:L(e)?O(`已连接`,`Connected`):O(`需要授权`,`Authorization required`)})]}),(0,A.jsx)(b,{variant:L(e)?`secondary`:`primary`,disabled:K||c.resources!==`ready`,onClick:()=>{g(null),_(``),E.current=c.revision,y(e.id)},children:L(e)?O(`重新授权`,`Reconnect`):O(`连接账号`,`Connect account`)})]},e.id))]}):null,!B&&c.resources===`ready`?(0,A.jsxs)(`div`,{children:[(0,A.jsx)(b,{variant:`secondary`,disabled:K,onClick:Z,children:O(`暂时跳过`,`Skip for now`)}),(0,A.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:O(`先完成安装,稍后在详情页授权。未授权的功能暂不可用。`,`Finish installation and connect later in plugin details. Unauthenticated features remain unavailable.`)})]}):null,B&&Object.keys(U).length&&!x?(0,A.jsx)(b,{variant:`ghost`,disabled:K,onClick:()=>S(!0),children:O(`修改插件配置`,`Edit plugin configuration`)}):null,B&&!R.length&&N.some(e=>e.methods.some(e=>e.type===`cli`))?(0,A.jsx)(b,{variant:`secondary`,disabled:K,onClick:()=>void J(`prepare`),children:O(`检查连接与权限`,`Check connection and permissions`)}):null,!K&&(p||[`failed`,`interrupted`].includes(c.state)||c.connections.some(e=>e.state===`error`))?(0,A.jsx)(b,{variant:`secondary`,onClick:()=>void J(`prepare`),children:O(`重试检查`,`Retry checks`)}):null,B?null:(0,A.jsx)(b,{variant:`ghost`,disabled:d,onClick:()=>void J(`cancel`),children:O(`取消安装`,`Cancel installation`)}),B&&!z.length&&!c.missingConfig?.length?e.setup?.tasks?.map(t=>(0,A.jsxs)(`div`,{className:`space-y-3 rounded-lg bg-surface-inset p-4 text-sm`,children:[(0,A.jsx)(`p`,{children:t}),(0,A.jsx)(b,{asChild:!0,disabled:!e.active,children:(0,A.jsx)(o,{to:`/chat/new?${new URLSearchParams({draft:t,projectScope:`none`})}`,state:{forceNewChat:!0},onClick:t=>{e.active?r?.():t.preventDefault()},children:O(`开始这个任务`,`Start this task`)})})]},t)):null]}),K?(0,A.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:O(`正在准备,可关闭后继续。`,`Preparing. You can close this window and resume.`)}):null,c?.error&&!c.deferred&&!c.missingConfig?.length?(0,A.jsx)(`p`,{className:`text-sm text-fg-muted`,children:W}):null,p?(0,A.jsx)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:p}):null]})}var L=`w-full rounded-lg border border-edge bg-surface-inset px-3 py-2 text-sm text-fg`;function R(e,t){if(e.startsWith(`content.skills:`)){let n=e.slice(15);return t?`提供技能:${n}`:`Add skill: ${n}`}if(e.startsWith(`runtime.mcp.stdio:`)){let n=e.slice(18).split(`:`,1)[0];return t?`在 Gateway 上运行工具服务:${n}`:`Run a tool service on the Gateway: ${n}`}if(e.startsWith(`network.mcp:`)){let n=e.slice(12).split(`:`,1)[0];return t?`连接外部工具服务:${n}`:`Connect to an external tool service: ${n}`}return e.startsWith(`runtime.capability-access:`)?t?`按账号授权启用相关技能和工具`:`Enable skills and tools according to account authorization`:e.startsWith(`runtime.authorization:`)?t?`在本机运行账号登录程序:${e.split(`:`)[1]}`:`Run account sign-in locally: ${e.split(`:`)[1]}`:e.startsWith(`runtime.resource:`)?t?`下载可执行资源:${e.split(`:`)[1]}`:`Download executable resource: ${e.split(`:`)[1]}`:e.startsWith(`network.resource:`)?t?`下载并校验资源:${e.split(`:`)[1]}`:`Download and verify resource: ${e.split(`:`)[1]}`:e}function z(e,t){return t?.publisher?.verification!==`verified`||t.latestVersion.riskTier&&t.latestVersion.riskTier!==`content`?!0:e.addedCapabilities.some(e=>!e.startsWith(`content.skills:`))}async function B(e,t,n){let r=await u(d(e),{method:t,...n===void 0?{}:{body:JSON.stringify(n)}});if(!r.ok)throw Error(r.error??`Request failed`);return r.payload}function V({extension:e,onClose:t,onUninstalled:n,initialSource:r=``,marketplace:o,autoInstall:u=!1}){let d=te(e=>e.language),v=d.startsWith(`zh`),oe=o?.localizations?.[v?`zh-CN`:`en`],C=oe?.displayName??o?.name,T=oe?.description??o?.description,D=(0,k.useId)(),{mutate:ce}=g(),[O,j]=(0,k.useState)(e),[M,N]=(0,k.useState)(r||e?.installationSource||``),[P,F]=(0,k.useState)(null),[V,H]=(0,k.useState)([]),[U,W]=(0,k.useState)(!1),[G,K]=(0,k.useState)(``),[q,J]=(0,k.useState)(!1),[Y,X]=(0,k.useState)(!1),[Z,le]=(0,k.useState)(!1),[ue,Q]=(0,k.useState)(!1),[de,fe]=(0,k.useState)(!1),[pe,me]=(0,k.useState)(!1),he=a(),ge=i(),[_e,ve]=(0,k.useState)(!1),ye=(0,k.useRef)(!1),be=`/api/extensions/agent-plugins/${encodeURIComponent(O?.pluginId??``)}`,xe=M.trim().startsWith(`store:`),Se=()=>ce(`gateway-extensions-list`);async function $(e){W(!0),K(``);try{await e()}catch(e){K(e instanceof Error?e.message:String(e))}finally{W(!1)}}function Ce(e){N(e),F(null),H([]),K(``)}let we=typeof window<`u`?window.electronAPI?.file:void 0,Te=/^(?:\/|[A-Za-z]:[\\/])/.test(M.trim())?M.trim():void 0;async function Ee(){if(!we?.openDirectory){fe(!0);return}let e=await we.openDirectory(Te?{defaultPath:Te}:void 0);e&&Ce(e)}async function De(){if(!we?.openFile){fe(!0);return}let e=await we.openFile({...Te?{defaultPath:Te}:{},extensions:[`zip`]});e&&Ce(e)}function Oe(e){return[...e.dataTransfer.types].some(e=>e===`Files`||e===`text/plain`||e===`text/uri-list`)}function ke(e){if(!Oe(e))return;e.preventDefault(),Q(!1);let t=Array.from(e.dataTransfer.files);if(t.length){if(t.length>1){K(v?`一次只能选择一个插件目录或 ZIP。`:`Choose one plugin directory or ZIP at a time.`);return}let e=we?.getPathForFile?.(t[0]);e?Ce(e):K(v?`浏览器无法读取本机文件路径,请使用“选择文件或目录”选择安装包。`:`The browser cannot read local file paths. Use Choose file or folder to select the package.`);return}let n=e.dataTransfer.getData(`text/uri-list`)||e.dataTransfer.getData(`text/plain`);n.trim()&&Ce(n.trim().split(/\r?\n/)[0])}async function Ae(e){j(await B(`${be}/activation`,`POST`,{enabled:e})),await Se()}async function je(e){let t=!O,n=await B(t?`/api/extensions/install`:`${be}/update`,`POST`,{source:M,reviewHash:e.reviewHash,...e.layout?{setup:!0}:{}});j(n),await Se(),!e.layout&&t&&!n.activationEligible&&n.readiness!==`blocked`&&n.pluginId&&(n=await B(`/api/extensions/agent-plugins/${encodeURIComponent(n.pluginId)}/activation`,`POST`,{enabled:!0}),j(n),await Se()),F(null),ve(!e.layout&&t&&n.activationEligible===!0)}async function Me(){let e=await B(`/api/extensions/inspect`,`POST`,{source:M});if(z(e,o)){F(e);return}await je(e)}(0,k.useEffect)(()=>{e&&!e.setup&&j(e)},[e]),(0,k.useEffect)(()=>{if(!e?.setup||!e.pluginId)return;let t=!1;return B(`/api/extensions/agent-plugins/${encodeURIComponent(e.pluginId)}`,`GET`).then(e=>{t||j(e)}).catch(()=>{}),()=>{t=!0}},[e?.pluginId]),(0,k.useEffect)(()=>{!u||O||!xe||ye.current||(ye.current=!0,$(Me))},[u,O,xe]);let Ne=u&&!O&&xe&&!ye.current;return(0,A.jsx)(h,{defaultOpen:!0,onOpenChange:e=>!e&&t(),children:(0,A.jsxs)(m,{children:[(0,A.jsx)(f,{className:`fixed inset-0 z-[130] bg-scrim`}),(0,A.jsxs)(ne,{className:`fixed left-1/2 top-1/2 z-[131] flex h-[min(82vh,42rem)] w-[min(38rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-popover`,children:[(0,A.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge p-4`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,A.jsx)(E,{iconUrl:O?.branding?.iconUrl??o?.branding?.iconUrl,fallback:y}),(0,A.jsx)(re,{className:`font-semibold`,children:O?.name??C??(v?`安装插件`:`Install plugin`)})]}),(0,A.jsx)(b,{variant:`ghost`,onClick:t,children:v?`关闭`:`Close`})]}),(0,A.jsx)(p,{className:`sr-only`,children:v?`安装、组件、账号连接和权限`:`Installation, components, connections and permissions`}),(0,A.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-4`,children:[!O&&xe?(0,A.jsxs)(`section`,{className:`space-y-4`,children:[(0,A.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl border border-edge bg-surface-base p-4`,children:[(0,A.jsx)(_,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}),(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsx)(`p`,{className:`font-medium text-fg`,children:C??P?.manifest.name??M.slice(6)}),T?(0,A.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:T}):null,(0,A.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:o?.publisher?.verification===`verified`?v?`已认证发布者 · 安装后所有 Agent 均可使用`:`Verified publisher · available to all agents after installation`:v?`安装前会检查来源和所需权限`:`Source and required permissions are checked before installation`})]})]}),P?null:(0,A.jsxs)(b,{className:`w-full`,disabled:U||Ne,onClick:()=>void $(Me),children:[U||Ne?(0,A.jsx)(ae,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,U||Ne?v?`正在安全检查并安装…`:`Checking and installing…`:v?`一键安装`:`Install`]})]}):null,O?(0,A.jsxs)(A.Fragment,{children:[_e?(0,A.jsxs)(`div`,{role:`status`,className:`flex items-start gap-3 rounded-lg border border-emerald-500/25 bg-emerald-500/10 p-4`,children:[(0,A.jsx)(ee,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`p`,{className:`font-medium text-fg`,children:v?`插件已安装并启用`:`Plugin installed and enabled`}),(0,A.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:v?`现在可以直接在对话中使用它。`:`It is ready to use in your conversations.`})]})]}):null,(!O.setup||O.readiness!==`setup_required`)&&!O.activationEligible?(0,A.jsxs)(`div`,{role:`status`,className:`space-y-3 rounded-lg border border-accent/25 bg-accent-soft p-4`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`p`,{className:`font-medium text-accent-fg`,children:v?`插件已安装,当前尚未启用`:`Plugin installed. It is not enabled yet.`}),(0,A.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:v?`启用后,Skills 和 MCP 才会加入 Agent 运行时。`:`Enable it to make its skills and MCP servers available to the Agent runtime.`})]}),(0,A.jsx)(b,{disabled:U||O.readiness===`blocked`,onClick:()=>void $(()=>Ae(!0)),children:v?`启用插件`:`Enable plugin`})]}):null,O.setup?(0,A.jsx)(I,{extension:O,zh:v,onStart:t,onInstalled:()=>{t(),he(se(O.pluginId,`installed`,!1,ge.pathname+ge.search))},onChanged:async()=>{j(await B(`${be}`,`GET`)),await Se()}}):null,(0,A.jsxs)(`details`,{className:`rounded-lg border border-edge p-3`,children:[(0,A.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium`,children:v?`插件详情`:`Plugin details`}),(0,A.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,A.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[v?`插件`:`Plugin`,` · `,O.version,` · `,O.readiness&&{ready:v?`已就绪`:`Ready`,setup_required:v?`待连接`:`Setup required`,degraded:v?`部分不可用`:`Partially available`,blocked:v?`已阻止`:`Blocked`}[O.readiness]]}),O.provenance?(0,A.jsxs)(`p`,{className:`break-words text-xs text-fg-muted`,children:[O.provenance.publisherVerification===`verified`?v?`已认证发布者`:`Verified publisher`:v?`社区发布者`:`Community publisher`,` · `,O.provenance.packageName,`@`,O.provenance.version,` · SHA-256 `,O.provenance.sha256.slice(0,12),`…`,O.provenance.riskTier?` · ${O.provenance.riskTier}`:``]}):null,(0,A.jsx)(`p`,{className:`text-sm`,children:O.description}),O.installationSource?(0,A.jsxs)(`p`,{className:`break-all text-xs text-fg-muted`,children:[v?`来源:`:`Source: `,O.installationSource,O.resolvedCommit?` · ${O.resolvedCommit.slice(0,12)}`:``]}):null,O.activationEligible?(0,A.jsx)(b,{disabled:U,variant:`secondary`,onClick:()=>void $(()=>Ae(!1)),children:v?`停用`:`Disable`}):null,O.canRollback?(0,A.jsx)(b,{disabled:U,variant:`secondary`,onClick:()=>void $(async()=>{j(await B(`${be}/rollback`,`POST`)),await Se()}),children:v?`回滚上一版本`:`Roll back`}):null]})]}),O.diagnostics?.map((e,t)=>(0,A.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[e.component,`: `,e.message]},t))]}):null,O?(0,A.jsxs)(b,{variant:`ghost`,className:`px-0`,"aria-expanded":pe,onClick:()=>me(e=>!e),children:[(0,A.jsx)(w,{className:l(`size-4 transition-transform motion-reduce:transition-none`,pe&&`rotate-180`),"aria-hidden":!0}),v?`高级操作`:`Advanced actions`]}):null,!O&&!xe||pe?(0,A.jsxs)(`form`,{className:l(`space-y-3`,O&&`border-t border-edge pt-4`),onSubmit:e=>{e.preventDefault(),$(async()=>{let e=await B(`/api/extensions/inspect`,`POST`,{source:M});e.candidates?(H(e.candidates),F(null)):(H([]),F(e))})},children:[(0,A.jsxs)(`div`,{"data-testid":`plugin-source-dropzone`,className:l(`rounded-xl border border-dashed p-3 transition-colors`,ue?`border-accent bg-accent-soft`:`border-edge bg-surface-inset/40`),onDragEnter:e=>{Oe(e)&&(e.preventDefault(),Q(!0))},onDragOver:e=>{Oe(e)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`,Q(!0))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||Q(!1)},onDrop:ke,children:[(0,A.jsxs)(`div`,{className:`mb-2 flex items-start gap-2`,children:[(0,A.jsx)(S,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`label`,{htmlFor:D,className:`block text-sm font-medium`,children:O?v?`更新包来源`:`Update package source`:v?`安装包来源`:`Package source`}),(0,A.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:v?`输入 github:组织/仓库、Git / ZIP 地址或宿主目录;marketplace 可选择插件。`:`Enter github:owner/repo, a Git / ZIP URL or a Gateway directory. Marketplaces let you choose a plugin.`})]})]}),(0,A.jsx)(`input`,{id:D,className:L,value:M,onChange:e=>Ce(e.target.value),placeholder:v?`/插件目录/或/插件.zip`:`/plugin/folder/or/plugin.zip`,autoComplete:`off`,spellCheck:!1,required:!0}),(0,A.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:we?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(b,{type:`button`,variant:`secondary`,disabled:U,onClick:()=>void $(Ee),children:[(0,A.jsx)(s,{className:`size-4`,"aria-hidden":!0}),v?`选择目录`:`Choose directory`]}),(0,A.jsxs)(b,{type:`button`,variant:`secondary`,disabled:U,onClick:()=>void $(De),children:[(0,A.jsx)(x,{className:`size-4`,"aria-hidden":!0}),v?`选择 ZIP`:`Choose ZIP`]})]}):(0,A.jsxs)(b,{type:`button`,variant:`secondary`,disabled:U,onClick:()=>fe(!0),children:[(0,A.jsx)(s,{className:`size-4`,"aria-hidden":!0}),v?`选择文件或目录`:`Choose file or folder`]})})]}),(0,A.jsx)(b,{type:`submit`,variant:`secondary`,disabled:U||!M,children:v?`检查安装包`:`Inspect package`})]}):null,V.length?(0,A.jsx)(`div`,{className:`space-y-2`,"aria-label":v?`选择插件`:`Choose a plugin`,children:V.map(e=>(0,A.jsx)(b,{variant:`secondary`,className:`w-full justify-start`,onClick:()=>{Ce(e.source),$(async()=>F(await B(`/api/extensions/inspect`,`POST`,{source:e.source})))},children:e.name},e.source))}):null,P?(0,A.jsxs)(`div`,{role:`region`,"aria-labelledby":`plugin-authorization-title`,className:`space-y-3 rounded-xl border border-amber-500/30 bg-amber-500/10 p-4 text-sm`,children:[(0,A.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,A.jsx)(_,{className:`mt-0.5 size-5 shrink-0 text-amber-700 dark:text-amber-300`,"aria-hidden":!0}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`p`,{id:`plugin-authorization-title`,className:`font-medium text-fg`,children:v?`需要你的授权`:`Your authorization is required`}),(0,A.jsx)(`p`,{className:`mt-1 text-fg-muted`,children:v?`此插件需要以下新增能力。确认后自动准备资源,按需登录账号,所有 Agent 均可使用。`:`Review these capabilities. Resources are prepared automatically; sign in if needed. Available to all agents.`})]})]}),(0,A.jsx)(`ul`,{tabIndex:0,"aria-label":v?`插件新增能力`:`Added plugin capabilities`,className:`max-h-[min(28vh,14rem)] space-y-2 overflow-y-auto overscroll-contain rounded-lg border border-edge bg-surface-panel p-3 break-words focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:P.addedCapabilities.map(e=>(0,A.jsxs)(`li`,{className:`flex gap-2`,children:[(0,A.jsx)(`span`,{"aria-hidden":!0,children:`•`}),(0,A.jsx)(`span`,{children:R(e,v)})]},e))}),P.capabilities.some(e=>e.startsWith(`runtime.`))?(0,A.jsxs)(`details`,{children:[(0,A.jsx)(`summary`,{className:`cursor-pointer text-fg-muted`,children:v?`查看执行内容`:`View execution details`}),(0,A.jsx)(`ul`,{tabIndex:0,"aria-label":v?`插件执行内容`:`Plugin execution details`,className:`mt-2 max-h-40 space-y-2 overflow-y-auto overscroll-contain break-all font-mono text-xs`,children:P.capabilities.filter(e=>e.startsWith(`runtime.`)).map(e=>(0,A.jsx)(`li`,{children:e},e))})]}):null,P.diagnostics.map((e,t)=>(0,A.jsxs)(`p`,{children:[e.component,`: `,e.message]},t))]}):null,O&&pe?(0,A.jsx)(`div`,{className:`border-t border-edge pt-4`,children:Z?(0,A.jsxs)(`div`,{className:`space-y-3 text-sm`,children:[(0,A.jsx)(`p`,{children:v?`卸载保留账号凭据;服务端授权需到相应服务撤销。`:`Credentials are retained. Revoke provider authorization in the service itself.`}),(0,A.jsxs)(`label`,{className:`flex gap-2`,children:[(0,A.jsx)(`input`,{type:`checkbox`,checked:q,onChange:e=>J(e.target.checked)}),v?`同时删除插件数据`:`Also delete plugin data`]}),(0,A.jsxs)(`label`,{className:`flex gap-2`,children:[(0,A.jsx)(`input`,{type:`checkbox`,checked:Y,onChange:e=>X(e.target.checked)}),v?`同时删除本地凭据`:`Also delete local credentials`]}),(0,A.jsx)(b,{disabled:U,onClick:()=>void $(async()=>{await B(be,`DELETE`,{removeData:q,removeCredentials:Y}),await Se(),(n??t)()}),children:v?`确认卸载`:`Confirm uninstall`})]}):(0,A.jsx)(b,{variant:`ghost`,disabled:U,onClick:()=>le(!0),children:v?`卸载插件`:`Uninstall`})}):null,G?(0,A.jsx)(`p`,{role:`alert`,className:`break-words text-sm text-fg-muted`,children:G}):null]}),P?(0,A.jsxs)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-2 border-t border-edge p-4`,children:[(0,A.jsx)(b,{variant:`ghost`,disabled:U,onClick:()=>F(null),children:v?`取消`:`Cancel`}),(0,A.jsxs)(b,{disabled:U||!!O&&P.manifest.name!==O.name,onClick:()=>void $(()=>je(P)),children:[U?(0,A.jsx)(ae,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,v?`授权并安装`:`Authorize and install`]})]}):null]}),we?null:(0,A.jsx)(ie,{open:de,onOpenChange:fe,initialAbsolutePath:Te,onConfirm:async e=>Ce(e),wd:c(d).chat.workingDirectory,selectKind:`file-or-directory`,fileExtensions:[`zip`],title:v?`选择插件安装包`:`Choose plugin package`,description:v?`选择插件目录或 ZIP 文件。`:`Choose a plugin directory or ZIP file.`,confirmLabel:v?`使用此来源`:`Use this source`,nested:!0})]})})}function H(e,t){return e.localizations?.[t?`zh-CN`:`en`]?.displayName??(e.setup?.authorizations?.length===1?e.setup.authorizations[0].title:e.name)}function U(e){return e.authorizationStatus===`required`||!!e.setup?.authorizations?.length&&e.authorizationStatus!==`connected`}function W(e){return e.active&&!U(e)&&(e.authorizationStatus===`connected`||e.authorizationStatus===`not_required`)}export{I as a,V as i,H as n,U as r,W as t};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./download-Dk-ZjtO6.js";import{t as r}from"./external-link-DjqjBmc3.js";import{t as i}from"./cn-0WouolD0.js";import{Ic as a,os as o}from"./index-cmsFpzI8.js";var s=e(),c=t();function l(e){let t=(0,s.c)(31),{message:l,downloadLabel:u,onDownload:d,openSystemLabel:f,onOpenWithSystemApp:p,chooseAppLabel:m,onChooseOpenWithApp:h,canOpenWithSystemApp:g,canChooseOpenWithApp:_}=e,v=g===void 0?!0:g,y=_===void 0?!0:_,b;t[0]!==v||t[1]!==p||t[2]!==f?(b=o()&&v&&typeof p==`function`&&typeof f==`string`&&f.length>0,t[0]=v,t[1]=p,t[2]=f,t[3]=b):b=t[3];let x=b,S;t[4]!==y||t[5]!==m||t[6]!==h?(S=o()&&y&&typeof h==`function`&&typeof m==`string`&&m.length>0,t[4]=y,t[5]=m,t[6]=h,t[7]=S):S=t[7];let C=S,w;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(w=i(`flex flex-col gap-2 rounded-lg border border-edge-subtle bg-surface-hover/60 p-3 sm:flex-row sm:items-center sm:justify-between dark:border-edge`),t[8]=w):w=t[8];let T;t[9]===l?T=t[10]:(T=(0,c.jsx)(`p`,{className:`min-w-0 text-xs leading-relaxed text-fg-muted`,children:l}),t[9]=l,t[10]=T);let E;t[11]!==p||t[12]!==f||t[13]!==x?(E=x?(0,c.jsxs)(`button`,{type:`button`,className:i(`inline-flex items-center gap-1.5 rounded-md border border-edge bg-surface-panel px-3 py-1.5 text-xs font-medium text-fg shadow-sm dark:border-edge`,a.transition,a.press,a.focusRingPanel),onClick:()=>void p?.(),children:[(0,c.jsx)(r,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),f]}):null,t[11]=p,t[12]=f,t[13]=x,t[14]=E):E=t[14];let D;t[15]!==m||t[16]!==h||t[17]!==C?(D=C?(0,c.jsxs)(`button`,{type:`button`,className:i(`inline-flex items-center gap-1.5 rounded-md border border-edge bg-surface-panel px-3 py-1.5 text-xs font-medium text-fg shadow-sm dark:border-edge`,a.transition,a.press,a.focusRingPanel),onClick:()=>void h?.(),children:[(0,c.jsx)(r,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),m]}):null,t[15]=m,t[16]=h,t[17]=C,t[18]=D):D=t[18];let O;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(O=i(`inline-flex items-center gap-1.5 rounded-md border border-accent bg-accent px-3 py-1.5 text-xs font-medium text-on-accent shadow-sm`,a.transition,a.press,a.focusRingPanel),t[19]=O):O=t[19];let k;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,c.jsx)(n,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[20]=k):k=t[20];let A;t[21]!==u||t[22]!==d?(A=(0,c.jsxs)(`button`,{type:`button`,className:O,onClick:d,children:[k,u]}),t[21]=u,t[22]=d,t[23]=A):A=t[23];let j;t[24]!==A||t[25]!==E||t[26]!==D?(j=(0,c.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[E,D,A]}),t[24]=A,t[25]=E,t[26]=D,t[27]=j):j=t[27];let M;return t[28]!==j||t[29]!==T?(M=(0,c.jsxs)(`div`,{className:w,children:[T,j]}),t[28]=j,t[29]=T,t[30]=M):M=t[30],M}export{l as t};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./download-Dk-ZjtO6.js";import{t as r}from"./external-link-DjqjBmc3.js";import{t as i}from"./cn-0WouolD0.js";import{Ic as a,os as o}from"./index-DmURUvvA.js";var s=e(),c=t();function l(e){let t=(0,s.c)(31),{message:l,downloadLabel:u,onDownload:d,openSystemLabel:f,onOpenWithSystemApp:p,chooseAppLabel:m,onChooseOpenWithApp:h,canOpenWithSystemApp:g,canChooseOpenWithApp:_}=e,v=g===void 0?!0:g,y=_===void 0?!0:_,b;t[0]!==v||t[1]!==p||t[2]!==f?(b=o()&&v&&typeof p==`function`&&typeof f==`string`&&f.length>0,t[0]=v,t[1]=p,t[2]=f,t[3]=b):b=t[3];let x=b,S;t[4]!==y||t[5]!==m||t[6]!==h?(S=o()&&y&&typeof h==`function`&&typeof m==`string`&&m.length>0,t[4]=y,t[5]=m,t[6]=h,t[7]=S):S=t[7];let C=S,w;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(w=i(`flex flex-col gap-2 rounded-lg border border-edge-subtle bg-surface-hover/60 p-3 sm:flex-row sm:items-center sm:justify-between dark:border-edge`),t[8]=w):w=t[8];let T;t[9]===l?T=t[10]:(T=(0,c.jsx)(`p`,{className:`min-w-0 text-xs leading-relaxed text-fg-muted`,children:l}),t[9]=l,t[10]=T);let E;t[11]!==p||t[12]!==f||t[13]!==x?(E=x?(0,c.jsxs)(`button`,{type:`button`,className:i(`inline-flex items-center gap-1.5 rounded-md border border-edge bg-surface-panel px-3 py-1.5 text-xs font-medium text-fg shadow-sm dark:border-edge`,a.transition,a.press,a.focusRingPanel),onClick:()=>void p?.(),children:[(0,c.jsx)(r,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),f]}):null,t[11]=p,t[12]=f,t[13]=x,t[14]=E):E=t[14];let D;t[15]!==m||t[16]!==h||t[17]!==C?(D=C?(0,c.jsxs)(`button`,{type:`button`,className:i(`inline-flex items-center gap-1.5 rounded-md border border-edge bg-surface-panel px-3 py-1.5 text-xs font-medium text-fg shadow-sm dark:border-edge`,a.transition,a.press,a.focusRingPanel),onClick:()=>void h?.(),children:[(0,c.jsx)(r,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),m]}):null,t[15]=m,t[16]=h,t[17]=C,t[18]=D):D=t[18];let O;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(O=i(`inline-flex items-center gap-1.5 rounded-md border border-accent bg-accent px-3 py-1.5 text-xs font-medium text-on-accent shadow-sm`,a.transition,a.press,a.focusRingPanel),t[19]=O):O=t[19];let k;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,c.jsx)(n,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[20]=k):k=t[20];let A;t[21]!==u||t[22]!==d?(A=(0,c.jsxs)(`button`,{type:`button`,className:O,onClick:d,children:[k,u]}),t[21]=u,t[22]=d,t[23]=A):A=t[23];let j;t[24]!==A||t[25]!==E||t[26]!==D?(j=(0,c.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[E,D,A]}),t[24]=A,t[25]=E,t[26]=D,t[27]=j):j=t[27];let M;return t[28]!==j||t[29]!==T?(M=(0,c.jsxs)(`div`,{className:w,children:[T,j]}),t[28]=j,t[29]=T,t[30]=M):M=t[30],M}export{l as t};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{d as n,r,t as i}from"./chunk-KS7C4IRE-B2HK1psj.js";import{n as a}from"./locale-store-Jnhw2WMv.js";import{a as o,r as s}from"./product-delivery-DwmnNJvk.js";import{i as c}from"./vendor-swr-BIWyz7Rc.js";import{Hr as l,Rc as u}from"./index-cmsFpzI8.js";import{t as d}from"./open-route-MyZ2sB9C.js";var f=e(),p=t();function m(){let e=(0,f.c)(14),t=n(),i=a(h)===`zh`,m=s(`xopc://open${t.search}`),_=m?.kind===`local_app`?m.id:null,{data:v,error:y}=c(_?[`local-app-open`,_]:null,()=>l(_));if(!m){let t=i?`这个打开链接无效。`:`This open link is invalid.`,n;return e[0]!==t||e[1]!==i?(n=(0,p.jsx)(g,{message:t,zh:i}),e[0]=t,e[1]=i,e[2]=n):n=e[2],n}if(m.kind!==`local_app`){let t=o({...m,title:m.id,capabilities:[`open`]}),n;return e[3]!==t||e[4]!==i?(n=t?(0,p.jsx)(r,{to:t,replace:!0}):(0,p.jsx)(g,{message:i?`这个内容无法在应用中打开。`:`This content cannot be opened in the app.`,zh:i}),e[3]=t,e[4]=i,e[5]=n):n=e[5],n}if(y){let t=typeof y==`object`&&y&&`status`in y&&y.status===404?i?`找不到这个应用,它可能已被删除。`:`This app was not found and may have been deleted.`:y instanceof Error?y.message:i?`无法打开这个应用。`:`Unable to open this app.`,n;return e[6]!==t||e[7]!==i?(n=(0,p.jsx)(g,{message:t,zh:i}),e[6]=t,e[7]=i,e[8]=n):n=e[8],n}if(v){let t;e[9]===v?t=e[10]:(t=d(v),e[9]=v,e[10]=t);let n;return e[11]===t?n=e[12]:(n=(0,p.jsx)(r,{to:t,replace:!0}),e[11]=t,e[12]=n),n}let b;return e[13]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,p.jsxs)(`div`,{className:`flex w-full flex-col gap-4 px-3 py-6 sm:px-5 xl:px-6`,"aria-busy":!0,children:[(0,p.jsx)(u,{className:`h-6 w-48`}),(0,p.jsx)(u,{className:`h-32 rounded-xl`})]}),e[13]=b):b=e[13],b}function h(e){return e.language}function g(e){let t=(0,f.c)(7),{message:n,zh:r}=e,a;t[0]===n?a=t[1]:(a=(0,p.jsx)(`p`,{children:n}),t[0]=n,t[1]=a);let o=r?`查看应用`:`View apps`,s;t[2]===o?s=t[3]:(s=(0,p.jsx)(i,{className:`mt-3 inline-flex font-medium text-accent hover:underline`,to:`/local-apps`,children:o}),t[2]=o,t[3]=s);let c;return t[4]!==a||t[5]!==s?(c=(0,p.jsxs)(`div`,{className:`m-6 rounded-xl border border-danger/30 bg-danger-soft p-4 text-sm text-danger`,role:`alert`,children:[a,s]}),t[4]=a,t[5]=s,t[6]=c):c=t[6],c}export{m as ProductOpenPage};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{d as n,r,t as i}from"./chunk-KS7C4IRE-B2HK1psj.js";import{n as a}from"./locale-store-D5h-Ha6-.js";import{a as o,r as s}from"./product-delivery-DwmnNJvk.js";import{i as c}from"./vendor-swr-BIWyz7Rc.js";import{Hr as l,Rc as u}from"./index-DmURUvvA.js";import{t as d}from"./open-route-MyZ2sB9C.js";var f=e(),p=t();function m(){let e=(0,f.c)(14),t=n(),i=a(h)===`zh`,m=s(`xopc://open${t.search}`),_=m?.kind===`local_app`?m.id:null,{data:v,error:y}=c(_?[`local-app-open`,_]:null,()=>l(_));if(!m){let t=i?`这个打开链接无效。`:`This open link is invalid.`,n;return e[0]!==t||e[1]!==i?(n=(0,p.jsx)(g,{message:t,zh:i}),e[0]=t,e[1]=i,e[2]=n):n=e[2],n}if(m.kind!==`local_app`){let t=o({...m,title:m.id,capabilities:[`open`]}),n;return e[3]!==t||e[4]!==i?(n=t?(0,p.jsx)(r,{to:t,replace:!0}):(0,p.jsx)(g,{message:i?`这个内容无法在应用中打开。`:`This content cannot be opened in the app.`,zh:i}),e[3]=t,e[4]=i,e[5]=n):n=e[5],n}if(y){let t=typeof y==`object`&&y&&`status`in y&&y.status===404?i?`找不到这个应用,它可能已被删除。`:`This app was not found and may have been deleted.`:y instanceof Error?y.message:i?`无法打开这个应用。`:`Unable to open this app.`,n;return e[6]!==t||e[7]!==i?(n=(0,p.jsx)(g,{message:t,zh:i}),e[6]=t,e[7]=i,e[8]=n):n=e[8],n}if(v){let t;e[9]===v?t=e[10]:(t=d(v),e[9]=v,e[10]=t);let n;return e[11]===t?n=e[12]:(n=(0,p.jsx)(r,{to:t,replace:!0}),e[11]=t,e[12]=n),n}let b;return e[13]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,p.jsxs)(`div`,{className:`flex w-full flex-col gap-4 px-3 py-6 sm:px-5 xl:px-6`,"aria-busy":!0,children:[(0,p.jsx)(u,{className:`h-6 w-48`}),(0,p.jsx)(u,{className:`h-32 rounded-xl`})]}),e[13]=b):b=e[13],b}function h(e){return e.language}function g(e){let t=(0,f.c)(7),{message:n,zh:r}=e,a;t[0]===n?a=t[1]:(a=(0,p.jsx)(`p`,{children:n}),t[0]=n,t[1]=a);let o=r?`查看应用`:`View apps`,s;t[2]===o?s=t[3]:(s=(0,p.jsx)(i,{className:`mt-3 inline-flex font-medium text-accent hover:underline`,to:`/local-apps`,children:o}),t[2]=o,t[3]=s);let c;return t[4]!==a||t[5]!==s?(c=(0,p.jsxs)(`div`,{className:`m-6 rounded-xl border border-danger/30 bg-danger-soft p-4 text-sm text-danger`,role:`alert`,children:[a,s]}),t[4]=a,t[5]=s,t[6]=c):c=t[6],c}export{m as ProductOpenPage};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as r}from"./markdown-view-B58RypQ4.js";import{t as i}from"./messages-DBvKzlCl.js";import{c as a,n as o,r as s}from"./locale-store-Jnhw2WMv.js";import{i as c}from"./vendor-swr-BIWyz7Rc.js";import{Hr as l,Pn as u,Wr as d,_o as f,fi as p,h as m,ji as h,l as g,v as _,vi as v}from"./index-cmsFpzI8.js";import{i as y}from"./automation-display-DCkjVzA0.js";import{t as b}from"./open-route-MyZ2sB9C.js";var x=e(),S=t();async function C(e){switch(e.kind){case`project`:return{kind:e.kind,value:await f(e.id)};case`workflow_run`:return{kind:e.kind,value:await m(e.id,{ownerAgentId:e.ownerAgentId})};case`workflow_definition`:{let t=await _();return{kind:e.kind,value:t.find(t=>t.id===e.id||t.name===e.id)}}case`automation`:{let[t,n]=await Promise.all([g.list(),g.runs(5,e.id)]);return{kind:e.kind,value:t.automations.find(t=>t.id===e.id),runs:n.runs}}case`local_app`:{let t=await l(e.id),n=e.sourceHash?await d(e.id,e.sourceHash):void 0;return{kind:e.kind,value:t,previewUrl:n?.previewUrl||t.draftPreviewUrl}}}}var w={pending:[`等待中`,`Pending`],planned:[`计划中`,`Planned`],active:[`进行中`,`Active`],paused:[`已暂停`,`Paused`],completed:[`已完成`,`Completed`],cancelled:[`已取消`,`Cancelled`],archived:[`已归档`,`Archived`],queued:[`排队中`,`Queued`],running:[`运行中`,`Running`],succeeded:[`成功`,`Succeeded`],failed:[`失败`,`Failed`],timeout:[`超时`,`Timed out`],cancelling:[`取消中`,`Cancelling`],unknown:[`尚未评估`,`Not assessed`],on_track:[`进展正常`,`On track`],at_risk:[`存在风险`,`At risk`],off_track:[`偏离计划`,`Off track`]};function T(e){let t=(0,x.c)(138),{target:r}=e,l=a(A),d=o(k),f=d===`zh`,m=i(d),g;t[0]===f?g=t[1]:(g=e=>w[e]?.[+!f]||e,t[0]=f,t[1]=g);let _=g,T;t[2]!==r.href||t[3]!==l?(T=[`chat-product-preview`,r.href,l],t[2]=r.href,t[3]=l,t[4]=T):T=t[4];let j;t[5]===r?j=t[6]:(j=()=>C(r),t[5]=r,t[6]=j);let M;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(M={shouldRetryOnError:!1,refreshInterval:O},t[7]=M):M=t[7];let{data:N,error:P,isLoading:F}=c(T,j,M);if(F){let e;return t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,S.jsx)(u,{}),t[8]=e):e=t[8],e}if(P){let e=f?`无法加载内容,它可能已删除或暂时不可用。`:`Unable to load this content. It may have been deleted or be temporarily unavailable.`,n;return t[9]===e?n=t[10]:(n=(0,S.jsx)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:e}),t[9]=e,t[10]=n),n}if(!N?.value){let e=f?`内容不存在或已删除。`:`This content is unavailable or has been deleted.`,n;return t[11]===e?n=t[12]:(n=(0,S.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e}),t[11]=e,t[12]=n),n}let I=D;if(N.kind===`project`){let e=N.value,n;t[13]===e.name?n=t[14]:(n=(0,S.jsx)(`h2`,{className:`break-words text-lg font-semibold text-fg`,children:e.name}),t[13]=e.name,t[14]=n);let r;t[15]!==e.status||t[16]!==_?(r=_(e.status),t[15]=e.status,t[16]=_,t[17]=r):r=t[17];let i;t[18]!==e.health||t[19]!==_?(i=_(e.health),t[18]=e.health,t[19]=_,t[20]=i):i=t[20];let a;t[21]!==r||t[22]!==i?(a=(0,S.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[r,` · `,i]}),t[21]=r,t[22]=i,t[23]=a):a=t[23];let o;t[24]!==I||t[25]!==e.description?(o=I(e.description),t[24]=I,t[25]=e.description,t[26]=o):o=t[26];let s;t[27]!==I||t[28]!==e.brief?(s=I(e.brief),t[27]=I,t[28]=e.brief,t[29]=s):s=t[29];let c;t[30]!==I||t[31]!==e.outcome?(c=I(e.outcome),t[30]=I,t[31]=e.outcome,t[32]=c):c=t[32];let l;t[33]!==s||t[34]!==c||t[35]!==n||t[36]!==a||t[37]!==o?(l=(0,S.jsxs)(`div`,{className:`space-y-3`,children:[n,a,o,s,c]}),t[33]=s,t[34]=c,t[35]=n,t[36]=a,t[37]=o,t[38]=l):l=t[38];let u;t[39]!==e.successCriteria||t[40]!==f?(u=e.successCriteria?.length>0&&(0,S.jsxs)(`section`,{className:`space-y-3`,children:[(0,S.jsx)(`h3`,{className:`font-medium text-fg`,children:f?`完成标准`:`Success criteria`}),(0,S.jsx)(`ul`,{className:`list-disc space-y-2 pl-5 text-sm text-fg`,children:e.successCriteria.map(E)})]}),t[39]=e.successCriteria,t[40]=f,t[41]=u):u=t[41];let d;t[42]!==e.milestones||t[43]!==_||t[44]!==f?(d=e.milestones?.length>0&&(0,S.jsxs)(`section`,{className:`space-y-3`,children:[(0,S.jsx)(`h3`,{className:`font-medium text-fg`,children:f?`里程碑`:`Milestones`}),e.milestones.slice(0,8).map(e=>(0,S.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[e.title,` · `,_(e.status)]},e.id))]}),t[42]=e.milestones,t[43]=_,t[44]=f,t[45]=d):d=t[45];let p;t[46]!==I||t[47]!==e.recentUpdates||t[48]!==f?(p=e.recentUpdates?.[0]&&(0,S.jsxs)(`section`,{className:`space-y-3`,children:[(0,S.jsx)(`h3`,{className:`font-medium text-fg`,children:f?`最近进展`:`Latest update`}),I(e.recentUpdates[0].summary)]}),t[46]=I,t[47]=e.recentUpdates,t[48]=f,t[49]=p):p=t[49];let m;return t[50]!==l||t[51]!==u||t[52]!==d||t[53]!==p?(m=(0,S.jsxs)(`div`,{className:`space-y-6`,children:[l,u,d,p]}),t[50]=l,t[51]=u,t[52]=d,t[53]=p,t[54]=m):m=t[54],m}if(N.kind===`workflow_run`){let{run:e,phases:n}=N.value,r;t[55]===e.title?r=t[56]:(r=(0,S.jsx)(`h2`,{className:`break-words text-lg font-semibold text-fg`,children:e.title}),t[55]=e.title,t[56]=r);let i;t[57]!==e.status||t[58]!==_?(i=_(e.status),t[57]=e.status,t[58]=_,t[59]=i):i=t[59];let a=e.metrics?` · ${e.metrics.doneAgentCount}/${e.metrics.agentCount} ${f?`执行单元完成`:`agents completed`}`:``,o;t[60]!==i||t[61]!==a?(o=(0,S.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[i,a]}),t[60]=i,t[61]=a,t[62]=o):o=t[62];let s;t[63]!==r||t[64]!==o?(s=(0,S.jsxs)(`div`,{className:`space-y-3`,children:[r,o]}),t[63]=r,t[64]=o,t[65]=s):s=t[65];let c;t[66]===e.error?c=t[67]:(c=e.error&&(0,S.jsx)(`p`,{role:`alert`,className:`rounded-lg border border-edge p-3 text-sm text-danger`,children:e.error.message}),t[66]=e.error,t[67]=c);let l;t[68]!==I||t[69]!==e.result||t[70]!==f?(l=p(e.result)?I(v(e.result)):(0,S.jsx)(`p`,{className:`text-sm text-fg-muted`,children:f?`尚无运行结果。`:`No result yet.`}),t[68]=I,t[69]=e.result,t[70]=f,t[71]=l):l=t[71];let u;t[72]!==n||t[73]!==_||t[74]!==f?(u=n.length>0&&(0,S.jsxs)(`section`,{className:`space-y-3`,children:[(0,S.jsx)(`h3`,{className:`font-medium text-fg`,children:f?`运行进度`:`Progress`}),n.map(e=>(0,S.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[e.title,` · `,_(e.status)]},e.id))]}),t[72]=n,t[73]=_,t[74]=f,t[75]=u):u=t[75];let d;return t[76]!==c||t[77]!==l||t[78]!==u||t[79]!==s?(d=(0,S.jsxs)(`div`,{className:`space-y-6`,children:[s,c,l,u]}),t[76]=c,t[77]=l,t[78]=u,t[79]=s,t[80]=d):d=t[80],d}if(N.kind===`workflow_definition`){let e=N.value,n,r,i,a;if(t[81]!==e||t[82]!==d||t[83]!==I){let o=h(e,d);n=`space-y-6`,r=(0,S.jsx)(`h2`,{className:`break-words text-lg font-semibold text-fg`,children:o.title}),i=I(o.description),a=I(o.whenToUse),t[81]=e,t[82]=d,t[83]=I,t[84]=n,t[85]=r,t[86]=i,t[87]=a}else n=t[84],r=t[85],i=t[86],a=t[87];let o;t[88]!==e.phases||t[89]!==I||t[90]!==f?(o=e.phases.length>0&&(0,S.jsxs)(`section`,{className:`space-y-3`,children:[(0,S.jsx)(`h3`,{className:`font-medium text-fg`,children:f?`执行阶段`:`Phases`}),e.phases.map(e=>(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:e.title}),I(e.description)]},e.id))]}),t[88]=e.phases,t[89]=I,t[90]=f,t[91]=o):o=t[91];let s;return t[92]!==n||t[93]!==r||t[94]!==i||t[95]!==a||t[96]!==o?(s=(0,S.jsxs)(`div`,{className:n,children:[r,i,a,o]}),t[92]=n,t[93]=r,t[94]=i,t[95]=a,t[96]=o,t[97]=s):s=t[97],s}if(N.kind===`automation`){let e=N.value,n=e.action.kind===`agent`?e.action.instruction:e.action.kind===`workflow`?e.action.goal:void 0,r;t[98]===e.name?r=t[99]:(r=(0,S.jsx)(`h2`,{className:`break-words text-lg font-semibold text-fg`,children:e.name}),t[98]=e.name,t[99]=r);let i;t[100]!==e.description||t[101]!==I?(i=I(e.description),t[100]=e.description,t[101]=I,t[102]=i):i=t[102];let a;t[103]!==n||t[104]!==I?(a=I(n),t[103]=n,t[104]=I,t[105]=a):a=t[105];let o;t[106]!==e.state.nextRunAtMs||t[107]!==f?(o=e.state.nextRunAtMs&&(0,S.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[f?`下次运行`:`Next run`,` · `,new Date(e.state.nextRunAtMs).toLocaleString(f?`zh-CN`:`en-US`)]}),t[106]=e.state.nextRunAtMs,t[107]=f,t[108]=o):o=t[108];let s;t[109]===e.state.lastError?s=t[110]:(s=e.state.lastError&&(0,S.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:e.state.lastError}),t[109]=e.state.lastError,t[110]=s);let c=f?`最近运行`:`Recent runs`,l;t[111]===c?l=t[112]:(l=(0,S.jsx)(`h3`,{className:`font-medium text-fg`,children:c}),t[111]=c,t[112]=l);let u;t[113]!==N.runs||t[114]!==I||t[115]!==_||t[116]!==f?(u=N.runs.length?N.runs.map(e=>(0,S.jsxs)(`div`,{className:`space-y-2 rounded-lg border border-edge p-3`,children:[(0,S.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[_(e.status),` · `,new Date(e.createdAtMs).toLocaleString(f?`zh-CN`:`en-US`)]}),I(e.summary),e.error&&(0,S.jsx)(`p`,{className:`text-sm text-danger`,children:e.error})]},e.id)):(0,S.jsx)(`p`,{className:`text-sm text-fg-muted`,children:f?`暂无运行记录。`:`No runs yet.`}),t[113]=N.runs,t[114]=I,t[115]=_,t[116]=f,t[117]=u):u=t[117];let p;return t[118]!==l||t[119]!==u?(p=(0,S.jsxs)(`section`,{className:`space-y-3`,children:[l,u]}),t[118]=l,t[119]=u,t[120]=p):p=t[120],(0,S.jsxs)(`div`,{className:`space-y-6`,children:[(0,S.jsxs)(`div`,{className:`space-y-3`,children:[r,(0,S.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[e.enabled?f?`已启用`:`Enabled`:f?`已停用`:`Disabled`,` · `,y(e.trigger,m.automations,m.cron,d)]}),i,a,o,s]}),p]})}let L=N.value,R;t[121]===L.name?R=t[122]:(R=(0,S.jsx)(`h2`,{className:`break-words text-lg font-semibold text-fg`,children:L.name}),t[121]=L.name,t[122]=R);let z=L.description||L.idea,B;t[123]!==I||t[124]!==z?(B=I(z),t[123]=I,t[124]=z,t[125]=B):B=t[125];let V;t[126]!==L.name||t[127]!==N.previewUrl||t[128]!==f?(V=N.previewUrl&&(0,S.jsx)(`iframe`,{title:f?`${L.name} 交互预览`:`${L.name} interactive preview`,src:s(N.previewUrl),sandbox:`allow-scripts allow-forms`,className:`h-[min(30rem,55dvh)] w-full rounded-lg border border-edge bg-white`}),t[126]=L.name,t[127]=N.previewUrl,t[128]=f,t[129]=V):V=t[129];let H;t[130]!==L||t[131]!==f?(H=L.installationState===`installed`&&L.enabled&&L.status===`installed`&&(0,S.jsx)(n,{to:b(L),className:`inline-flex rounded-lg bg-accent px-3 py-2 text-sm text-white focus-visible:ring-2 focus-visible:ring-accent`,children:f?`使用应用`:`Use app`}),t[130]=L,t[131]=f,t[132]=H):H=t[132];let U;return t[133]!==R||t[134]!==B||t[135]!==V||t[136]!==H?(U=(0,S.jsxs)(`div`,{className:`space-y-5`,children:[R,B,V,H]}),t[133]=R,t[134]=B,t[135]=V,t[136]=H,t[137]=U):U=t[137],U}function E(e,t){return(0,S.jsx)(`li`,{children:e},t)}function D(e){return e?.trim()?(0,S.jsx)(r,{content:e,mermaidActions:!1}):null}function O(e){return e?.kind===`workflow_run`&&[`queued`,`running`].includes(e.value.run.status)||e?.kind===`automation`&&e.value?.state.runningRunId?3e3:0}function k(e){return e.language}function A(e){return e.conversationId}export{T as default};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as r}from"./markdown-view-CthsQiiO.js";import{t as i}from"./messages-Bwv-AOYl.js";import{c as a,n as o,r as s}from"./locale-store-D5h-Ha6-.js";import{i as c}from"./vendor-swr-BIWyz7Rc.js";import{Hr as l,Pn as u,Wr as d,_o as f,fi as p,h as m,ji as h,l as g,v as _,vi as v}from"./index-DmURUvvA.js";import{i as y}from"./automation-display-DCkjVzA0.js";import{t as b}from"./open-route-MyZ2sB9C.js";var x=e(),S=t();async function C(e){switch(e.kind){case`project`:return{kind:e.kind,value:await f(e.id)};case`workflow_run`:return{kind:e.kind,value:await m(e.id,{ownerAgentId:e.ownerAgentId})};case`workflow_definition`:{let t=await _();return{kind:e.kind,value:t.find(t=>t.id===e.id||t.name===e.id)}}case`automation`:{let[t,n]=await Promise.all([g.list(),g.runs(5,e.id)]);return{kind:e.kind,value:t.automations.find(t=>t.id===e.id),runs:n.runs}}case`local_app`:{let t=await l(e.id),n=e.sourceHash?await d(e.id,e.sourceHash):void 0;return{kind:e.kind,value:t,previewUrl:n?.previewUrl||t.draftPreviewUrl}}}}var w={pending:[`等待中`,`Pending`],planned:[`计划中`,`Planned`],active:[`进行中`,`Active`],paused:[`已暂停`,`Paused`],completed:[`已完成`,`Completed`],cancelled:[`已取消`,`Cancelled`],archived:[`已归档`,`Archived`],queued:[`排队中`,`Queued`],running:[`运行中`,`Running`],succeeded:[`成功`,`Succeeded`],failed:[`失败`,`Failed`],timeout:[`超时`,`Timed out`],cancelling:[`取消中`,`Cancelling`],unknown:[`尚未评估`,`Not assessed`],on_track:[`进展正常`,`On track`],at_risk:[`存在风险`,`At risk`],off_track:[`偏离计划`,`Off track`]};function T(e){let t=(0,x.c)(138),{target:r}=e,l=a(A),d=o(k),f=d===`zh`,m=i(d),g;t[0]===f?g=t[1]:(g=e=>w[e]?.[+!f]||e,t[0]=f,t[1]=g);let _=g,T;t[2]!==r.href||t[3]!==l?(T=[`chat-product-preview`,r.href,l],t[2]=r.href,t[3]=l,t[4]=T):T=t[4];let j;t[5]===r?j=t[6]:(j=()=>C(r),t[5]=r,t[6]=j);let M;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(M={shouldRetryOnError:!1,refreshInterval:O},t[7]=M):M=t[7];let{data:N,error:P,isLoading:F}=c(T,j,M);if(F){let e;return t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,S.jsx)(u,{}),t[8]=e):e=t[8],e}if(P){let e=f?`无法加载内容,它可能已删除或暂时不可用。`:`Unable to load this content. It may have been deleted or be temporarily unavailable.`,n;return t[9]===e?n=t[10]:(n=(0,S.jsx)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:e}),t[9]=e,t[10]=n),n}if(!N?.value){let e=f?`内容不存在或已删除。`:`This content is unavailable or has been deleted.`,n;return t[11]===e?n=t[12]:(n=(0,S.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e}),t[11]=e,t[12]=n),n}let I=D;if(N.kind===`project`){let e=N.value,n;t[13]===e.name?n=t[14]:(n=(0,S.jsx)(`h2`,{className:`break-words text-lg font-semibold text-fg`,children:e.name}),t[13]=e.name,t[14]=n);let r;t[15]!==e.status||t[16]!==_?(r=_(e.status),t[15]=e.status,t[16]=_,t[17]=r):r=t[17];let i;t[18]!==e.health||t[19]!==_?(i=_(e.health),t[18]=e.health,t[19]=_,t[20]=i):i=t[20];let a;t[21]!==r||t[22]!==i?(a=(0,S.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[r,` · `,i]}),t[21]=r,t[22]=i,t[23]=a):a=t[23];let o;t[24]!==I||t[25]!==e.description?(o=I(e.description),t[24]=I,t[25]=e.description,t[26]=o):o=t[26];let s;t[27]!==I||t[28]!==e.brief?(s=I(e.brief),t[27]=I,t[28]=e.brief,t[29]=s):s=t[29];let c;t[30]!==I||t[31]!==e.outcome?(c=I(e.outcome),t[30]=I,t[31]=e.outcome,t[32]=c):c=t[32];let l;t[33]!==s||t[34]!==c||t[35]!==n||t[36]!==a||t[37]!==o?(l=(0,S.jsxs)(`div`,{className:`space-y-3`,children:[n,a,o,s,c]}),t[33]=s,t[34]=c,t[35]=n,t[36]=a,t[37]=o,t[38]=l):l=t[38];let u;t[39]!==e.successCriteria||t[40]!==f?(u=e.successCriteria?.length>0&&(0,S.jsxs)(`section`,{className:`space-y-3`,children:[(0,S.jsx)(`h3`,{className:`font-medium text-fg`,children:f?`完成标准`:`Success criteria`}),(0,S.jsx)(`ul`,{className:`list-disc space-y-2 pl-5 text-sm text-fg`,children:e.successCriteria.map(E)})]}),t[39]=e.successCriteria,t[40]=f,t[41]=u):u=t[41];let d;t[42]!==e.milestones||t[43]!==_||t[44]!==f?(d=e.milestones?.length>0&&(0,S.jsxs)(`section`,{className:`space-y-3`,children:[(0,S.jsx)(`h3`,{className:`font-medium text-fg`,children:f?`里程碑`:`Milestones`}),e.milestones.slice(0,8).map(e=>(0,S.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[e.title,` · `,_(e.status)]},e.id))]}),t[42]=e.milestones,t[43]=_,t[44]=f,t[45]=d):d=t[45];let p;t[46]!==I||t[47]!==e.recentUpdates||t[48]!==f?(p=e.recentUpdates?.[0]&&(0,S.jsxs)(`section`,{className:`space-y-3`,children:[(0,S.jsx)(`h3`,{className:`font-medium text-fg`,children:f?`最近进展`:`Latest update`}),I(e.recentUpdates[0].summary)]}),t[46]=I,t[47]=e.recentUpdates,t[48]=f,t[49]=p):p=t[49];let m;return t[50]!==l||t[51]!==u||t[52]!==d||t[53]!==p?(m=(0,S.jsxs)(`div`,{className:`space-y-6`,children:[l,u,d,p]}),t[50]=l,t[51]=u,t[52]=d,t[53]=p,t[54]=m):m=t[54],m}if(N.kind===`workflow_run`){let{run:e,phases:n}=N.value,r;t[55]===e.title?r=t[56]:(r=(0,S.jsx)(`h2`,{className:`break-words text-lg font-semibold text-fg`,children:e.title}),t[55]=e.title,t[56]=r);let i;t[57]!==e.status||t[58]!==_?(i=_(e.status),t[57]=e.status,t[58]=_,t[59]=i):i=t[59];let a=e.metrics?` · ${e.metrics.doneAgentCount}/${e.metrics.agentCount} ${f?`执行单元完成`:`agents completed`}`:``,o;t[60]!==i||t[61]!==a?(o=(0,S.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[i,a]}),t[60]=i,t[61]=a,t[62]=o):o=t[62];let s;t[63]!==r||t[64]!==o?(s=(0,S.jsxs)(`div`,{className:`space-y-3`,children:[r,o]}),t[63]=r,t[64]=o,t[65]=s):s=t[65];let c;t[66]===e.error?c=t[67]:(c=e.error&&(0,S.jsx)(`p`,{role:`alert`,className:`rounded-lg border border-edge p-3 text-sm text-danger`,children:e.error.message}),t[66]=e.error,t[67]=c);let l;t[68]!==I||t[69]!==e.result||t[70]!==f?(l=p(e.result)?I(v(e.result)):(0,S.jsx)(`p`,{className:`text-sm text-fg-muted`,children:f?`尚无运行结果。`:`No result yet.`}),t[68]=I,t[69]=e.result,t[70]=f,t[71]=l):l=t[71];let u;t[72]!==n||t[73]!==_||t[74]!==f?(u=n.length>0&&(0,S.jsxs)(`section`,{className:`space-y-3`,children:[(0,S.jsx)(`h3`,{className:`font-medium text-fg`,children:f?`运行进度`:`Progress`}),n.map(e=>(0,S.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[e.title,` · `,_(e.status)]},e.id))]}),t[72]=n,t[73]=_,t[74]=f,t[75]=u):u=t[75];let d;return t[76]!==c||t[77]!==l||t[78]!==u||t[79]!==s?(d=(0,S.jsxs)(`div`,{className:`space-y-6`,children:[s,c,l,u]}),t[76]=c,t[77]=l,t[78]=u,t[79]=s,t[80]=d):d=t[80],d}if(N.kind===`workflow_definition`){let e=N.value,n,r,i,a;if(t[81]!==e||t[82]!==d||t[83]!==I){let o=h(e,d);n=`space-y-6`,r=(0,S.jsx)(`h2`,{className:`break-words text-lg font-semibold text-fg`,children:o.title}),i=I(o.description),a=I(o.whenToUse),t[81]=e,t[82]=d,t[83]=I,t[84]=n,t[85]=r,t[86]=i,t[87]=a}else n=t[84],r=t[85],i=t[86],a=t[87];let o;t[88]!==e.phases||t[89]!==I||t[90]!==f?(o=e.phases.length>0&&(0,S.jsxs)(`section`,{className:`space-y-3`,children:[(0,S.jsx)(`h3`,{className:`font-medium text-fg`,children:f?`执行阶段`:`Phases`}),e.phases.map(e=>(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:e.title}),I(e.description)]},e.id))]}),t[88]=e.phases,t[89]=I,t[90]=f,t[91]=o):o=t[91];let s;return t[92]!==n||t[93]!==r||t[94]!==i||t[95]!==a||t[96]!==o?(s=(0,S.jsxs)(`div`,{className:n,children:[r,i,a,o]}),t[92]=n,t[93]=r,t[94]=i,t[95]=a,t[96]=o,t[97]=s):s=t[97],s}if(N.kind===`automation`){let e=N.value,n=e.action.kind===`agent`?e.action.instruction:e.action.kind===`workflow`?e.action.goal:void 0,r;t[98]===e.name?r=t[99]:(r=(0,S.jsx)(`h2`,{className:`break-words text-lg font-semibold text-fg`,children:e.name}),t[98]=e.name,t[99]=r);let i;t[100]!==e.description||t[101]!==I?(i=I(e.description),t[100]=e.description,t[101]=I,t[102]=i):i=t[102];let a;t[103]!==n||t[104]!==I?(a=I(n),t[103]=n,t[104]=I,t[105]=a):a=t[105];let o;t[106]!==e.state.nextRunAtMs||t[107]!==f?(o=e.state.nextRunAtMs&&(0,S.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[f?`下次运行`:`Next run`,` · `,new Date(e.state.nextRunAtMs).toLocaleString(f?`zh-CN`:`en-US`)]}),t[106]=e.state.nextRunAtMs,t[107]=f,t[108]=o):o=t[108];let s;t[109]===e.state.lastError?s=t[110]:(s=e.state.lastError&&(0,S.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:e.state.lastError}),t[109]=e.state.lastError,t[110]=s);let c=f?`最近运行`:`Recent runs`,l;t[111]===c?l=t[112]:(l=(0,S.jsx)(`h3`,{className:`font-medium text-fg`,children:c}),t[111]=c,t[112]=l);let u;t[113]!==N.runs||t[114]!==I||t[115]!==_||t[116]!==f?(u=N.runs.length?N.runs.map(e=>(0,S.jsxs)(`div`,{className:`space-y-2 rounded-lg border border-edge p-3`,children:[(0,S.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[_(e.status),` · `,new Date(e.createdAtMs).toLocaleString(f?`zh-CN`:`en-US`)]}),I(e.summary),e.error&&(0,S.jsx)(`p`,{className:`text-sm text-danger`,children:e.error})]},e.id)):(0,S.jsx)(`p`,{className:`text-sm text-fg-muted`,children:f?`暂无运行记录。`:`No runs yet.`}),t[113]=N.runs,t[114]=I,t[115]=_,t[116]=f,t[117]=u):u=t[117];let p;return t[118]!==l||t[119]!==u?(p=(0,S.jsxs)(`section`,{className:`space-y-3`,children:[l,u]}),t[118]=l,t[119]=u,t[120]=p):p=t[120],(0,S.jsxs)(`div`,{className:`space-y-6`,children:[(0,S.jsxs)(`div`,{className:`space-y-3`,children:[r,(0,S.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[e.enabled?f?`已启用`:`Enabled`:f?`已停用`:`Disabled`,` · `,y(e.trigger,m.automations,m.cron,d)]}),i,a,o,s]}),p]})}let L=N.value,R;t[121]===L.name?R=t[122]:(R=(0,S.jsx)(`h2`,{className:`break-words text-lg font-semibold text-fg`,children:L.name}),t[121]=L.name,t[122]=R);let z=L.description||L.idea,B;t[123]!==I||t[124]!==z?(B=I(z),t[123]=I,t[124]=z,t[125]=B):B=t[125];let V;t[126]!==L.name||t[127]!==N.previewUrl||t[128]!==f?(V=N.previewUrl&&(0,S.jsx)(`iframe`,{title:f?`${L.name} 交互预览`:`${L.name} interactive preview`,src:s(N.previewUrl),sandbox:`allow-scripts allow-forms`,className:`h-[min(30rem,55dvh)] w-full rounded-lg border border-edge bg-white`}),t[126]=L.name,t[127]=N.previewUrl,t[128]=f,t[129]=V):V=t[129];let H;t[130]!==L||t[131]!==f?(H=L.installationState===`installed`&&L.enabled&&L.status===`installed`&&(0,S.jsx)(n,{to:b(L),className:`inline-flex rounded-lg bg-accent px-3 py-2 text-sm text-white focus-visible:ring-2 focus-visible:ring-accent`,children:f?`使用应用`:`Use app`}),t[130]=L,t[131]=f,t[132]=H):H=t[132];let U;return t[133]!==R||t[134]!==B||t[135]!==V||t[136]!==H?(U=(0,S.jsxs)(`div`,{className:`space-y-5`,children:[R,B,V,H]}),t[133]=R,t[134]=B,t[135]=V,t[136]=H,t[137]=U):U=t[137],U}function E(e,t){return(0,S.jsx)(`li`,{children:e},t)}function D(e){return e?.trim()?(0,S.jsx)(r,{content:e,mermaidActions:!1}):null}function O(e){return e?.kind===`workflow_run`&&[`queued`,`running`].includes(e.value.run.status)||e?.kind===`automation`&&e.value?.state.runningRunId?3e3:0}function k(e){return e.language}function A(e){return e.conversationId}export{T as default};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,g as a,m as o,t as s}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as c}from"./check-DUBLcKHA.js";import{t as l}from"./circle-check-C23XjkUj.js";import{t as u}from"./copy-Dv6d4Dvw.js";import{t as d}from"./download-Dk-ZjtO6.js";import{t as f}from"./external-link-DjqjBmc3.js";import{F as p,V as m,t as h,z as g}from"./markdown-view-CthsQiiO.js";import{t as _}from"./plus-Q2yW6OE7.js";import{t as v}from"./x-B_N4OPjy.js";import{t as y}from"./messages-Bwv-AOYl.js";import{t as b}from"./cn-0WouolD0.js";import{a as x,c as S,f as C,n as w,r as T}from"./locale-store-D5h-Ha6-.js";import{a as E,c as D,i as O,n as k,o as A,r as j,s as M,t as N}from"./dist-BGTk37IG.js";import{i as P,t as F}from"./tasks-PuIUgF9L.js";import{t as I}from"./copy-to-clipboard-HOJ79TWv.js";import{i as L}from"./vendor-swr-BIWyz7Rc.js";import{a as R}from"./attachment-utils-core-BIOUBrpT.js";import{o as z}from"./agents-admin-api-D6XzhsQy.js";import{$l as B,$n as V,A as H,Af as U,Ao as W,Ba as G,Bd as ee,Bl as te,Bs as ne,Co as K,Cr as re,Cs as ie,Dl as q,Do as ae,Dr as oe,Ds as se,Du as ce,Ed as le,Ef as ue,Eo as de,Er as fe,Es as pe,Eu as J,Ga as me,Go as he,Ha as ge,Ir as _e,Ja as ve,Jl as ye,Ju as be,Ka as xe,Kc as Y,Kd as Se,Md as Ce,Mf as we,Nd as Te,Ni as Ee,Nl as De,Nr as Oe,Od as ke,Oo as Ae,Qc as je,Rc as Me,Rn as Ne,So as Pe,Su as Fe,To as Ie,Tr as Le,Ts as Re,Ua as ze,Ui as Be,Vl as Ve,Vu as He,Wa as Ue,Wl as We,Xa as Ge,Ya as Ke,Za as qe,Zc as Je,Zd as Ye,Zs as Xe,_ as Ze,_d as Qe,_o as $e,aa as et,ar as tt,au as nt,bo as rt,co as it,df as at,ds as ot,el as st,er as ct,fa as lt,ff as ut,fr as dt,fs as ft,go as pt,hd as mt,hf as ht,ho as gt,ir as _t,is as vt,iu as yt,ji as bt,kd as xt,kf as St,kl as Ct,ko as wt,ku as Tt,lo as Et,lr as Dt,ma as Ot,ml as kt,mo as At,mr as jt,na as Mt,nf as Nt,ni as Pt,no as Ft,nr as It,od as Lt,oo as Rt,pf as zt,pl as Bt,po as Vt,qa as Ht,ql as Ut,qu as Wt,ri as Gt,rl as Kt,rr as qt,sd as Jt,sf as Yt,su as Xt,ta as Zt,td as Qt,tr as $t,tu as en,uf as tn,us as nn,uu as rn,v as an,vd as on,vo as sn,wo as cn,ws as ln,xf as un,xl as dn,xo as fn,xu as pn,yd as mn,yo as hn,yu as gn,za as _n,zu as vn}from"./index-DmURUvvA.js";import{n as yn,t as bn}from"./use-autosave-BnMIUc_5.js";import{t as xn}from"./directory-picker-path-field-BmFgRA8G.js";import{d as Sn,h as Cn,o as wn}from"./skill-api-o3HSgF_K.js";import{t as Tn}from"./date-picker-CO3Jhdzg.js";import{t as En}from"./automations-workspace-DdopDyED.js";import{i as Dn,r as On,t as kn}from"./workflow-run-setup-panel-Dq63AthQ.js";import{t as An}from"./page-context-capture-button-BcxVEGa2.js";import{i as X,n as jn,r as Mn,t as Nn}from"./note-detail-panel-BpddDFQt.js";import{c as Pn,l as Fn,n as In,o as Z,r as Ln,t as Rn,u as zn}from"./style-DOz6lLJB.js";import{t as Bn}from"./dependency-picker-DbyMpo5J.js";var Vn=n(),Q=e(t(),1),$=r();function Hn(e){let t=(0,Vn.c)(15),{noteId:n,attachmentId:r,className:i}=e,[a,o]=(0,Q.useState)(!1),s;t[0]!==r||t[1]!==n?(s=Gt(n,r),t[0]=r,t[1]=n,t[2]=s):s=t[2];let c=s;if(a){let e;t[3]===i?e=t[4]:(e=b(`flex size-12 shrink-0 items-center justify-center rounded-lg border border-edge-subtle bg-surface-hover text-fg-muted`,i),t[3]=i,t[4]=e);let n;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(Qe,{className:`size-4`}),t[5]=n):n=t[5];let r;return t[6]===e?r=t[7]:(r=(0,$.jsx)(`div`,{className:e,"aria-hidden":!0,children:n}),t[6]=e,t[7]=r),r}let l;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>o(!0),t[8]=l):l=t[8];let u;t[9]===i?u=t[10]:(u=b(`size-12 shrink-0 rounded-lg border border-edge-subtle bg-surface-hover object-cover`,i),t[9]=i,t[10]=u);let d;return t[11]!==n||t[12]!==c||t[13]!==u?(d=(0,$.jsx)(_e,{src:c,expectedNoteId:n,alt:``,loading:`lazy`,draggable:!1,onLoadFailed:l,className:u}),t[11]=n,t[12]=c,t[13]=u,t[14]=d):d=t[14],d}function Un(e){if(!Number.isFinite(e)||e<0)return`0:00`;let t=Math.floor(e/60),n=Math.floor(e%60);return`${t}:${String(n).padStart(2,`0`)}`}function Wn(e){let t=(0,Vn.c)(38),{noteId:n,attachmentId:r,durationSec:i,className:a}=e,{playing:o,loading:s,currentTime:c,duration:l,noteId:u,attachmentId:d}=Pt(),f=Pt(Kn),p=u===n&&d===r,m=p&&o,h=p&&s,g=p?c:0,_=p&&l>0?l:i??0,v=_>0?Math.min(g/_*100,100):0,y;t[0]!==r||t[1]!==i||t[2]!==n||t[3]!==f?(y=e=>{e.stopPropagation(),f(n,r,i)},t[0]=r,t[1]=i,t[2]=n,t[3]=f,t[4]=y):y=t[4];let x=y,S;t[5]!==r||t[6]!==i||t[7]!==n||t[8]!==f?(S=e=>{(e.key===`Enter`||e.key===` `)&&(e.stopPropagation(),e.preventDefault(),f(n,r,i))},t[5]=r,t[6]=i,t[7]=n,t[8]=f,t[9]=S):S=t[9];let C=S,w;t[10]===a?w=t[11]:(w=b(`flex items-center gap-2`,a),t[10]=a,t[11]=w);let T=m?`bg-accent text-on-accent`:`bg-accent/10 text-accent hover:bg-accent/20`,E;t[12]===T?E=t[13]:(E=b(`flex size-7 shrink-0 items-center justify-center rounded-full transition-colors`,T),t[12]=T,t[13]=E);let D=m?`Pause`:`Play`,O;t[14]!==h||t[15]!==m?(O=h?(0,$.jsx)(be,{className:`size-3.5 animate-spin`}):m?(0,$.jsx)(J,{className:`size-3.5`}):(0,$.jsx)(gn,{className:`size-3.5 ml-0.5`}),t[14]=h,t[15]=m,t[16]=O):O=t[16];let k;t[17]!==x||t[18]!==C||t[19]!==E||t[20]!==D||t[21]!==O?(k=(0,$.jsx)(`button`,{type:`button`,onClick:x,onKeyDown:C,className:E,"aria-label":D,children:O}),t[17]=x,t[18]=C,t[19]=E,t[20]=D,t[21]=O,t[22]=k):k=t[22];let A=`${v}%`,j;t[23]===A?j=t[24]:(j=(0,$.jsx)(`div`,{className:`h-1 w-full overflow-hidden rounded-full bg-accent/10`,children:(0,$.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-[width] duration-200 ease-linear`,style:{width:A}})}),t[23]=A,t[24]=j);let M;t[25]!==_||t[26]!==p||t[27]!==g?(M=Un(p&&g>0?g:_),t[25]=_,t[26]=p,t[27]=g,t[28]=M):M=t[28];let N;t[29]===M?N=t[30]:(N=(0,$.jsx)(`span`,{className:`text-[10px] tabular-nums text-fg-muted`,children:M}),t[29]=M,t[30]=N);let P;t[31]!==j||t[32]!==N?(P=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[j,N]}),t[31]=j,t[32]=N,t[33]=P):P=t[33];let F;return t[34]!==P||t[35]!==w||t[36]!==k?(F=(0,$.jsxs)(`div`,{className:w,onClick:Gn,children:[k,P]}),t[34]=P,t[35]=w,t[36]=k,t[37]=F):F=t[37],F}function Gn(e){return e.stopPropagation()}function Kn(e){return e.toggle}function qn(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function Jn(e){let t=(0,Vn.c)(89),{note:n,selected:r,onPress:i,onPin:a,onArchive:o,onDelete:s,labels:c,timeLabels:l}=e,u=r===void 0?!1:r,d=w(nr)===`zh`,f=n.kind===`voice`&&/^Discussion · \d{4}-\d{2}-\d{2} \d{2}:\d{2}$/.test(n.title??``)?d?`语音笔记`:`Voice note`:n.title,p;t[0]!==c||t[1]!==n?(p=qn(n,c),t[0]=c,t[1]=n,t[2]=p):p=t[2];let m=p,h=!n.snippet?.trim(),[g]=(0,Q.useState)(tr),_;t[3]!==n.createdAt||t[4]!==g||t[5]!==l?(_=X(n.createdAt,g,l),t[3]=n.createdAt,t[4]=g,t[5]=l,t[6]=_):_=t[6];let v=_,y,x;t[7]!==n.id||t[8]!==i?(y=()=>i(n.id),x=e=>{e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),i(n.id))},t[7]=n.id,t[8]=i,t[9]=y,t[10]=x):(y=t[9],x=t[10]);let S=u?`bg-surface-active hover:bg-surface-active`:`bg-transparent hover:bg-surface-panel/70`,C;t[11]===S?C=t[12]:(C=b(`group relative flex cursor-pointer flex-col gap-2 overflow-hidden rounded-lg px-3 py-2.5`,`transition-colors duration-150 ease-out`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-rail`,S),t[11]=S,t[12]=C);let T=u?`true`:void 0,E;t[13]===u?E=t[14]:(E=u?(0,$.jsx)(`span`,{className:`pointer-events-none absolute inset-y-2 left-0 w-0.5 rounded-r-pill bg-accent`,"aria-hidden":!0}):null,t[13]=u,t[14]=E);let D;t[15]!==n.coverAttachmentId||t[16]!==n.id||t[17]!==n.kind||t[18]!==n.voiceAttachmentId||t[19]!==n.voiceDurationSec?(D=n.coverAttachmentId?(0,$.jsx)(Hn,{noteId:n.id,attachmentId:n.coverAttachmentId}):n.kind===`voice`&&n.voiceAttachmentId?(0,$.jsx)(Wn,{noteId:n.id,attachmentId:n.voiceAttachmentId,durationSec:n.voiceDurationSec,className:`mt-0.5 w-28 shrink-0`}):null,t[15]=n.coverAttachmentId,t[16]=n.id,t[17]=n.kind,t[18]=n.voiceAttachmentId,t[19]=n.voiceDurationSec,t[20]=D):D=t[20];let O;t[21]!==f||t[22]!==n.title?(O=n.title&&(0,$.jsx)(`h3`,{className:`mb-0.5 truncate text-sm font-semibold text-fg`,children:f}),t[21]=f,t[22]=n.title,t[23]=O):O=t[23];let k=n.title?`text-fg-muted`:h?`italic text-fg-muted`:`text-fg`,A;t[24]===k?A=t[25]:(A=b(`truncate text-sm leading-5`,k),t[24]=k,t[25]=A);let j;t[26]!==m||t[27]!==A?(j=(0,$.jsx)(`p`,{className:A,children:m}),t[26]=m,t[27]=A,t[28]=j):j=t[28];let M;t[29]!==O||t[30]!==j?(M=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[O,j]}),t[29]=O,t[30]=j,t[31]=M):M=t[31];let N;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,$.jsx)(ee,{className:`size-4`}),t[32]=N):N=t[32];let P;t[33]===c.actions?P=t[34]:(P=(0,$.jsx)(tt,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:er,className:`shrink-0 rounded-md p-1 text-fg-muted opacity-100 transition-opacity hover:bg-surface-panel focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent lg:opacity-0 lg:group-hover:opacity-100 lg:focus-visible:opacity-100`,"aria-label":c.actions,title:c.actions,children:N})}),t[33]=c.actions,t[34]=P);let F;t[35]!==n.id||t[36]!==n.pinned||t[37]!==a?(F=()=>{a(n.id,!n.pinned).catch(Qn)},t[35]=n.id,t[36]=n.pinned,t[37]=a,t[38]=F):F=t[38];let I;t[39]===n.pinned?I=t[40]:(I=n.pinned?(0,$.jsx)(pn,{className:`size-4`}):(0,$.jsx)(Fe,{className:`size-4`}),t[39]=n.pinned,t[40]=I);let L=n.pinned?c.unpin:c.pin,R;t[41]!==F||t[42]!==I||t[43]!==L?(R=(0,$.jsxs)($t,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:F,children:[I,L]}),t[41]=F,t[42]=I,t[43]=L,t[44]=R):R=t[44];let z;t[45]!==n.id||t[46]!==o?(z=()=>{o(n.id).catch(Zn)},t[45]=n.id,t[46]=o,t[47]=z):z=t[47];let B;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(we,{className:`size-4`}),t[48]=B):B=t[48];let V;t[49]!==c.archive||t[50]!==z?(V=(0,$.jsxs)($t,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:z,children:[B,c.archive]}),t[49]=c.archive,t[50]=z,t[51]=V):V=t[51];let H;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,$.jsx)(_t,{className:`my-1 h-px bg-edge-subtle`}),t[52]=H):H=t[52];let U;t[53]!==n.id||t[54]!==s?(U=()=>{s(n.id).catch(Xn)},t[53]=n.id,t[54]=s,t[55]=U):U=t[55];let W;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,$.jsx)(De,{className:`size-4`}),t[56]=W):W=t[56];let G;t[57]!==c.delete||t[58]!==U?(G=(0,$.jsxs)($t,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-red-500 outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:U,children:[W,c.delete]}),t[57]=c.delete,t[58]=U,t[59]=G):G=t[59];let te;t[60]!==R||t[61]!==V||t[62]!==G?(te=(0,$.jsx)(It,{children:(0,$.jsxs)(ct,{className:`z-50 min-w-[140px] rounded-xl border border-edge bg-surface-overlay p-1 shadow-lg`,sideOffset:4,align:`end`,onClick:$n,children:[R,V,H,G]})}),t[60]=R,t[61]=V,t[62]=G,t[63]=te):te=t[63];let ne;t[64]!==P||t[65]!==te?(ne=(0,$.jsxs)(qt,{children:[P,te]}),t[64]=P,t[65]=te,t[66]=ne):ne=t[66];let K;t[67]!==D||t[68]!==M||t[69]!==ne?(K=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[D,M,ne]}),t[67]=D,t[68]=M,t[69]=ne,t[70]=K):K=t[70];let re;t[71]===n.pinned?re=t[72]:(re=n.pinned&&(0,$.jsx)(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-accent/10 px-1.5 py-0.5 text-xs font-medium text-accent`,children:(0,$.jsx)(Fe,{className:`size-3`})}),t[71]=n.pinned,t[72]=re);let ie;t[73]===n.tags?ie=t[74]:(ie=n.tags?.slice(0,2).map(Yn),t[73]=n.tags,t[74]=ie);let q;t[75]===v?q=t[76]:(q=(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:v}),t[75]=v,t[76]=q);let ae;t[77]!==re||t[78]!==ie||t[79]!==q?(ae=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[re,ie,q]}),t[77]=re,t[78]=ie,t[79]=q,t[80]=ae):ae=t[80];let oe;return t[81]!==K||t[82]!==ae||t[83]!==y||t[84]!==x||t[85]!==C||t[86]!==T||t[87]!==E?(oe=(0,$.jsxs)(`article`,{role:`button`,tabIndex:0,onClick:y,onKeyDown:x,className:C,"aria-current":T,children:[E,K,ae]}),t[81]=K,t[82]=ae,t[83]=y,t[84]=x,t[85]=C,t[86]=T,t[87]=E,t[88]=oe):oe=t[88],oe}function Yn(e){return(0,$.jsx)(`span`,{className:`max-w-24 truncate rounded-md bg-surface-hover px-1.5 py-0.5 text-xs text-fg-muted`,children:e},e)}function Xn(){}function Zn(){}function Qn(){}function $n(e){return e.stopPropagation()}function er(e){return e.stopPropagation()}function tr(){return Date.now()}function nr(e){return e.language}var rr=3e4;function ir(){if(!(typeof MediaRecorder>`u`))return[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`,`audio/ogg;codecs=opus`].find(e=>MediaRecorder.isTypeSupported(e))}function ar({placeholder:e,submitLabel:t,actionsLabel:n,imageLabel:r,voiceLabel:i,stopRecordingLabel:a,onCapture:o,onImagePick:s,onVoiceCapture:c,onVoiceError:l,recordingLabel:u,imageDisabled:d=!1,voiceDisabled:f=!1,onDiscussionCapture:p,discussionCaptureLabel:m}){let[h,g]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(!1),[C,w]=(0,Q.useState)(0),[T,E]=(0,Q.useState)(!1),D=(0,Q.useRef)(null),O=(0,Q.useRef)(null),k=(0,Q.useRef)(null),A=(0,Q.useRef)([]),j=(0,Q.useRef)(0),M=(0,Q.useRef)(null),N=(0,Q.useRef)(null),P=(0,Q.useCallback)(()=>{M.current&&=(clearInterval(M.current),null),N.current&&=(clearTimeout(N.current),null),k.current?.getTracks().forEach(e=>e.stop()),k.current=null,O.current=null,A.current=[],S(!1),w(0)},[]);(0,Q.useEffect)(()=>()=>P(),[P]);let F=(0,Q.useCallback)(async()=>{let e=O.current;if(!e||e.state!==`recording`)return;E(!0),await new Promise(t=>{e.addEventListener(`stop`,()=>t(),{once:!0}),e.stop()});let t=Math.max(1,Math.round((Date.now()-j.current)/1e3)),n=e.mimeType||ir()||`audio/webm`,r=new Blob(A.current,{type:n});if(P(),r.size>0&&c){let e=n.includes(`mp4`)?`m4a`:n.includes(`ogg`)?`ogg`:`webm`,i=new File([r],`voice-${Date.now()}.${e}`,{type:n});try{await c(i,t)}finally{E(!1)}return}E(!1)},[P,c]),I=(0,Q.useCallback)(async()=>{if(!(!c||T||x)){if(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`){l?.();return}try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});k.current=e;let t=ir(),n=t?new MediaRecorder(e,{mimeType:t}):new MediaRecorder(e);O.current=n,A.current=[],j.current=Date.now(),n.ondataavailable=e=>{e.data.size>0&&A.current.push(e.data)},n.start(),S(!0),w(0),M.current=setInterval(()=>{w(Math.round((Date.now()-j.current)/1e3))},250),N.current=setTimeout(()=>{F()},rr)}catch{P(),l?.()}}},[P,c,l,x,F,T]),L=(0,Q.useCallback)(async()=>{let e=h.trim();if(!(!e||v)){y(!0),g(``);try{await o(e)}catch{g(e)}finally{y(!1),D.current?.focus()}}},[h,v,o]),R=(0,Q.useCallback)(e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),L())},[L]),z=v||T,B=!!(s||c||p);return(0,$.jsxs)(`div`,{className:b(`flex items-center gap-1.5 rounded-2xl border border-edge bg-surface-panel p-2 shadow-float dark:shadow-elevated`,`focus-within:border-accent focus-within:ring-1 focus-within:ring-accent`,x&&`border-danger ring-1 ring-danger/40`),"aria-busy":z,children:[x?(0,$.jsx)(`button`,{type:`button`,onClick:()=>void F(),disabled:T,className:`shrink-0 rounded-lg bg-danger-soft p-2 text-danger transition-colors hover:bg-danger-soft disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":a,title:a,"aria-pressed":`true`,children:(0,$.jsx)(We,{className:`size-4 fill-current`,"aria-hidden":!0})}):B?(0,$.jsxs)(qt,{children:[(0,$.jsx)(tt,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,disabled:z,className:`shrink-0 rounded-lg p-2 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":n,title:n,children:(0,$.jsx)(_,{className:`size-4`,"aria-hidden":!0})})}),(0,$.jsx)(It,{children:(0,$.jsxs)(ct,{side:`top`,align:`start`,sideOffset:8,className:`z-50 min-w-44 rounded-xl border border-edge bg-surface-overlay p-1 shadow-popover`,children:[s?(0,$.jsxs)($t,{disabled:d,onSelect:s,className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,children:[(0,$.jsx)(mt,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),r]}):null,c?(0,$.jsxs)($t,{disabled:f,onSelect:()=>void I(),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,children:[(0,$.jsx)(vn,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),i]}):null,p?(0,$.jsxs)($t,{onSelect:p,className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,children:[(0,$.jsx)(ue,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),m]}):null]})})]}):null,x?(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate py-1.5 text-sm text-danger`,children:u.replace(`{{seconds}}`,String(C))}):(0,$.jsx)(`textarea`,{ref:D,value:h,onChange:e=>g(e.target.value),onKeyDown:R,placeholder:e,"aria-label":e,rows:1,disabled:z,className:`max-h-28 min-h-8 flex-1 resize-none overflow-y-auto bg-transparent py-1.5 text-sm leading-5 text-fg placeholder:text-fg-muted focus:outline-none disabled:opacity-60`,style:{fieldSizing:`content`}}),(0,$.jsx)(`button`,{type:`button`,disabled:!h.trim()||z||x,onClick:()=>void L(),"aria-label":t,title:t,className:b(`shrink-0 rounded-lg p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,h.trim()&&!z&&!x?`bg-accent text-on-accent hover:bg-accent-hover`:`text-fg-disabled`),children:(0,$.jsx)(yt,{className:`size-4`,"aria-hidden":!0})})]})}var or={statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1},sr=240,cr=320,lr=520,ur=560;function dr(e){if(globalThis.localStorage===void 0)return cr;try{let t=globalThis.localStorage.getItem(e);if(!t)return cr;let n=Number(t);return Number.isFinite(n)?n:cr}catch{return cr}}function fr(e,t){if(globalThis.localStorage!==void 0)try{globalThis.localStorage.setItem(e,String(Math.round(t)))}catch{}}var pr={thought:Ve,todo:Ut,voice:vn,media:mt,bookmark:un,mixed:Ve,task:Ut};function mr(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function hr(e,t){return e.statusFilter===t.patch.statusFilter&&e.kindFilter===t.patch.kindFilter&&e.pinnedOnly===t.patch.pinnedOnly}function gr(e,t){return`${e.replace(/\/$/,``)}/${encodeURIComponent(t)}`}function _r({selectedNoteId:e,basePath:t,managePageHeader:n=!1,showLibrary:r=!0,allowMediaCapture:a=!0,projectId:o,listTitle:s,listDescription:c,emptyText:l,emptyDescription:u,listWidthStorageKey:d=`xopc.notes.listWidth`}){let f=w(e=>e.language),p=y(f).notes,m=!!S(e=>e.conversationId),[h,g]=(0,Q.useReducer)(Ft,or),[x,T]=(0,Q.useState)(!1),[D,P]=(0,Q.useState)(``),[F,I]=(0,Q.useState)(0),[R,z]=(0,Q.useState)(()=>dr(d)),[B,H]=(0,Q.useState)(!1),[U,W]=(0,Q.useState)(!1),[G,ee]=(0,Q.useState)(!1),[te,K]=(0,Q.useState)(null),[ie,q]=(0,Q.useState)(null),ae=(0,Q.useRef)(null),se=(0,Q.useRef)(null),[ce]=(0,Q.useState)(()=>Date.now()),le=i(),ue=(0,Q.useCallback)(e=>{let t=ae.current?.clientWidth??window.innerWidth,n=Math.max(sr,t-ur);return Math.max(sr,Math.min(Math.min(lr,n),e))},[]),de=(0,Q.useCallback)(e=>{let t=ue(e);z(t),fr(d,t)},[ue,d]);(0,Q.useLayoutEffect)(()=>{z(e=>ue(e))},[ue]);let{data:pe,mutate:J,isLoading:me}=L((0,Q.useMemo)(()=>m?[`notes-list`,o,h.statusFilter,h.kindFilter,h.pinnedOnly]:null,[m,o,h.statusFilter,h.kindFilter,h.pinnedOnly]),()=>re({status:h.statusFilter===`all`?void 0:h.statusFilter,kind:h.kindFilter===`all`?void 0:h.kindFilter,projectId:o,pinned:h.pinnedOnly?!0:void 0,limit:100,sortBy:`createdAt`,sortOrder:`desc`}),{keepPreviousData:!0}),ge=me&&!pe,_e=pe?.items??[],ve=pe?.total??0,ye=D.trim(),{data:be,isLoading:xe}=L(m&&x&&ye?[`notes-search`,o,ye]:null,()=>re({search:ye,projectId:o,limit:30,sortBy:`updatedAt`,sortOrder:`desc`})),Y=be?.items??[],Se=e?_e.some(t=>t.id===e):!0;(0,Q.useEffect)(()=>{I(0)},[ye]),(0,Q.useEffect)(()=>{F>=Y.length&&I(Math.max(0,Y.length-1))},[F,Y.length]),(0,Q.useEffect)(()=>{let e=()=>{J().catch(e=>{K(`${p.refreshFailed}: ${e instanceof Error?e.message:p.quickCaptureFailedHint}`)})};return window.addEventListener(`note-updated`,e),()=>window.removeEventListener(`note-updated`,e)},[J,p.quickCaptureFailedHint,p.refreshFailed]);let Ce=he(e=>e.setPageHeader),we=he(e=>e.clearPageHeader),Te=p.noteCount.replace(`{{count}}`,String(ve)),Ee=!r&&ve===0&&c?c:Te,De=p.searchDialogTitle,ke=p.searchClose,Ae=p.searchClear,je=(0,Q.useMemo)(()=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>T(!0),className:b(`inline-flex h-9 items-center gap-2 rounded-lg border border-edge bg-surface-base px-3 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,ne),"aria-label":De,children:[(0,$.jsx)(nt,{className:`size-4`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:De})]}),[De]);(0,Q.useLayoutEffect)(()=>{if(n)return m?(Ce({startExtra:null,main:(0,$.jsxs)(`div`,{className:b(`flex min-w-0 items-center gap-2`,ne),children:[(0,$.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,children:s??p.title}),(0,$.jsx)(`button`,{type:`button`,className:`text-xs text-fg-muted`,onClick:()=>window.dispatchEvent(new CustomEvent(`open-recording-recoveries`)),children:p.discussionCapture.recoveredTitle}),Te?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:Te}):null]}),end:je}),()=>we()):(we(),()=>we())},[we,m,je,s,n,p.title,p.discussionCapture.recoveredTitle,Te,e,Ce]);let Me=(0,Q.useMemo)(()=>({justNow:p.justNow,minutesAgo:p.minutesAgo,today:p.today,yesterday:p.yesterday,daysAgo:p.daysAgo,locale:C(f)}),[f,p.justNow,p.minutesAgo,p.today,p.yesterday,p.daysAgo]),Ne=(0,Q.useMemo)(()=>[{id:`recent`,label:p.viewRecent,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1}},{id:`inbox`,label:p.filterInbox,patch:{statusFilter:`inbox`,kindFilter:`all`,pinnedOnly:!1}},{id:`pinned`,label:p.pinned,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!0}},{id:`tasks`,label:p.viewTasks,patch:{statusFilter:`all`,kindFilter:`todo`,pinnedOnly:!1}},{id:`voice`,label:p.kindVoice,patch:{statusFilter:`all`,kindFilter:`voice`,pinnedOnly:!1}},{id:`media`,label:p.kindMedia,patch:{statusFilter:`all`,kindFilter:`media`,pinnedOnly:!1}},{id:`bookmarks`,label:p.kindBookmark,patch:{statusFilter:`all`,kindFilter:`bookmark`,pinnedOnly:!1}},{id:`processed`,label:p.filterProcessed,patch:{statusFilter:`processed`,kindFilter:`all`,pinnedOnly:!1}},{id:`archive`,label:p.filterArchived,patch:{statusFilter:`archived`,kindFilter:`all`,pinnedOnly:!1}}],[p.filterArchived,p.filterInbox,p.filterProcessed,p.kindBookmark,p.kindMedia,p.kindVoice,p.pinned,p.viewRecent,p.viewTasks]),Pe=Ne.find(e=>hr(h,e))??Ne[0],Fe=s??Pe.label,Ie=(0,Q.useCallback)(async e=>{K(null);try{let n=o?await dt({markdown:e,kind:`thought`,projectId:o,channel:`web`}):await Le(e,`web`);await J(),le(gr(t,n.id))}catch(e){throw K(`${p.quickCaptureFailed}: ${e instanceof Error?e.message:p.quickCaptureFailedHint}`),e}},[t,J,p.quickCaptureFailed,p.quickCaptureFailedHint,le,o]),Re=(0,Q.useCallback)(async()=>{if(!G){ee(!0),K(null);try{let e=await dt({markdown:``,kind:`thought`,projectId:o,channel:`web`});g({type:`patch`,patch:or}),await J(),q(e.id),le(gr(t,e.id))}catch(e){K(`${p.createBlankFailed}: ${e instanceof Error?e.message:p.createBlankFailedHint}`)}finally{ee(!1)}}},[t,G,J,p.createBlankFailed,p.createBlankFailedHint,le,o]),ze=(0,Q.useCallback)(()=>{let e=document.createElement(`input`);e.type=`file`,e.accept=`image/*`,e.onchange=async()=>{let t=e.files?.[0];if(t)try{K(null),await fe(t,`web`),await J()}catch(e){K(`${p.imageUploadFailed}: ${e instanceof Error?e.message:p.imageUploadFailedHint}`)}},e.click()},[J,p.imageUploadFailed,p.imageUploadFailedHint]),Be=(0,Q.useCallback)(async(e,t)=>{try{K(null),await oe(e,t,`web`),await J()}catch(e){K(`${p.voiceUploadFailed}: ${e instanceof Error?e.message:p.voiceUploadFailedHint}`)}},[J,p.voiceUploadFailed,p.voiceUploadFailedHint]),He=(0,Q.useCallback)(()=>{K(`${p.voiceCaptureFailed}: ${p.voiceCaptureFailedHint}`)},[p.voiceCaptureFailed,p.voiceCaptureFailedHint]),Ue=(0,Q.useCallback)(async(e,t)=>{K(null);try{await Oe(e,{pinned:t}),await J()}catch(e){K(`${p.actionFailed}: ${e instanceof Error?e.message:p.quickCaptureFailedHint}`)}},[J,p.actionFailed,p.quickCaptureFailedHint]),We=(0,Q.useCallback)(async e=>{K(null);try{await Oe(e,{status:`archived`}),await J()}catch(e){K(`${p.actionFailed}: ${e instanceof Error?e.message:p.quickCaptureFailedHint}`)}},[J,p.actionFailed,p.quickCaptureFailedHint]),Ge=(0,Q.useCallback)(async e=>{K(null);try{await jt(e),await J()}catch(e){K(`${p.actionFailed}: ${e instanceof Error?e.message:p.quickCaptureFailedHint}`)}},[J,p.actionFailed,p.quickCaptureFailedHint]),Ke=(0,Q.useCallback)(e=>{le(gr(t,e))},[t,le]),qe=(0,Q.useCallback)(e=>{le(gr(t,e)),T(!1)},[t,le]),Je=(0,Q.useCallback)(e=>{if(Y.length){if(e.key===`ArrowDown`)e.preventDefault(),I(e=>Math.min(Y.length-1,e+1));else if(e.key===`ArrowUp`)e.preventDefault(),I(e=>Math.max(0,e-1));else if(e.key===`Enter`){e.preventDefault();let t=Y[F]??Y[0];t&&qe(t.id)}}},[F,qe,Y]),Ye=(0,Q.useCallback)(e=>{e.preventDefault();let t=e.currentTarget,n=se.current;t.setPointerCapture(e.pointerId),H(!0);let r=ae.current?.clientWidth??window.innerWidth,i=Math.max(sr,r-ur),a=Math.min(lr,i),o=e=>Math.max(sr,Math.min(a,e)),s=e.clientX,c=o(R),l=e.pointerId,u=0,f=c,p=c;n&&(n.style.transition=`none`,n.style.width=`${c}px`);let m=()=>{u=0,p=f,n&&(n.style.width=`${p}px`)},h=e=>{f=o(c+e.clientX-s),u===0&&(u=window.requestAnimationFrame(m))},g=()=>{u!==0&&(window.cancelAnimationFrame(u),m());try{t.releasePointerCapture(l)}catch{}H(!1),ae.current?.style.setProperty(`--notes-list-width`,`${p}px`),n&&(n.style.removeProperty(`transition`),n.style.removeProperty(`width`)),z(p),fr(d,p),window.removeEventListener(`pointermove`,h),window.removeEventListener(`pointerup`,g),window.removeEventListener(`pointercancel`,g)};window.addEventListener(`pointermove`,h),window.addEventListener(`pointerup`,g),window.addEventListener(`pointercancel`,g)},[d,R]);(0,Q.useEffect)(()=>{let e=e=>{e.defaultPrevented||e.repeat||e.key.toLowerCase()!==`n`||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||(e.preventDefault(),Re())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Re]);let Xe=(0,Q.useCallback)(e=>{e.key===`ArrowLeft`?(e.preventDefault(),de(R-16)):e.key===`ArrowRight`?(e.preventDefault(),de(R+16)):e.key===`Home`?(e.preventDefault(),de(sr)):e.key===`End`&&(e.preventDefault(),de(lr))},[de,R]);return m?(0,$.jsxs)(`div`,{ref:ae,className:`flex h-full min-h-0 w-full flex-1 overflow-hidden bg-surface-base`,style:{"--notes-list-width":`${R}px`},children:[(0,$.jsxs)(`section`,{ref:se,className:b(`relative flex min-h-0 w-full shrink-0 flex-col overflow-hidden bg-surface-rail`,!B&&`lg:transition-[width] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,U?`lg:w-0 lg:min-w-0 lg:max-w-0 lg:pointer-events-none`:`lg:w-[var(--notes-list-width)]`,e&&`hidden lg:flex`),"aria-hidden":U?!0:void 0,children:[(0,$.jsxs)(`div`,{className:`shrink-0 border-b border-edge-subtle p-3`,children:[te?(0,$.jsx)(`p`,{className:`mb-3 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:te}):null,(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[r?(0,$.jsx)(ot,{value:Pe.id,onChange:e=>{let t=Ne.find(t=>t.id===e.target.value);t&&g({type:`patch`,patch:t.patch})},className:`-ml-1 h-7 w-full max-w-44 rounded-lg border border-transparent bg-transparent px-2 text-sm font-semibold text-fg transition-colors hover:border-edge hover:bg-surface-base focus:border-accent focus:bg-surface-base focus:outline-none focus:ring-1 focus:ring-accent`,"aria-label":p.libraryTitle,children:Ne.map(e=>(0,$.jsx)(ft,{value:e.id,children:e.label},e.id))}):(0,$.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:Fe}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:Ee})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>W(!0),className:`hidden size-11 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent lg:inline-flex`,"aria-label":p.collapseNotesList,title:p.collapseNotesList,children:(0,$.jsx)(Tt,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>V(o),"aria-label":f===`zh`?`开始录音`:`Start recording`,className:`inline-flex size-11 shrink-0 items-center justify-center rounded-full text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,children:(0,$.jsx)(vn,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:Re,disabled:G,className:`inline-flex size-11 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":p.createBlankNote,title:p.createBlankShortcut,children:(0,$.jsx)(_,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>T(!0),className:`inline-flex size-11 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":p.searchDialogTitle,title:p.searchDialogTitle,children:(0,$.jsx)(nt,{className:`size-4`,"aria-hidden":!0})})]})]})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-2 py-3 [scrollbar-gutter:stable]`,children:ge?(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:[1,2,3,4].map(e=>(0,$.jsx)(`div`,{className:`h-20 animate-pulse rounded-lg bg-surface-hover`},e))}):_e.length===0?(0,$.jsxs)(`div`,{className:`flex h-full min-h-48 flex-col items-center justify-center gap-2 px-6 py-10 text-center`,children:[(0,$.jsx)(`span`,{className:`mb-1 inline-flex size-12 items-center justify-center rounded-xl border border-edge-subtle bg-surface-base text-fg-muted`,children:(0,$.jsx)(Ve,{className:`size-6`,"aria-hidden":!0})}),(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:e&&!Se?p.noteOutsideCurrentView:l??p.noNotes}),e&&!Se?null:(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:u??p.noNotesDescription})]}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e&&!Se?(0,$.jsx)(`div`,{className:`mb-2 rounded-lg border border-edge-subtle bg-surface-base px-3 py-2 text-xs leading-5 text-fg-muted`,children:p.noteOutsideCurrentView}):null,_e.map((t,n)=>{let r=n>0?jn(_e[n-1].createdAt):null;return(0,$.jsxs)(`div`,{children:[jn(t.createdAt)!==r&&(0,$.jsx)(`div`,{className:b(`px-3 pb-1.5 pt-2 text-xs font-medium text-fg-muted`,n===0&&`pt-0`),children:Mn(t.createdAt,ce,Me)}),(0,$.jsx)(Jn,{note:t,selected:t.id===e,onPress:Ke,onPin:Ue,onArchive:We,onDelete:Ge,timeLabels:Me,labels:{pin:p.pin,unpin:p.unpin,archive:p.archive,delete:p.delete,actions:p.noteActions,imageNote:p.imageNote,noText:p.noText}})]},t.id)})]})}),(0,$.jsx)(`div`,{className:`shrink-0 border-t border-edge-subtle p-3`,children:(0,$.jsx)(ar,{placeholder:p.quickCapturePlaceholder,submitLabel:p.quickCaptureSubmit,actionsLabel:p.quickCaptureActions,imageLabel:p.quickCaptureImage,voiceLabel:p.quickCaptureVoice,stopRecordingLabel:p.stopRecording,onCapture:Ie,onImagePick:a?ze:void 0,onVoiceCapture:a?Be:void 0,onVoiceError:He,recordingLabel:p.recording,discussionCaptureLabel:p.discussionCapture.title,onDiscussionCapture:()=>V(o)})})]}),(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":p.resizeNotesList,"aria-valuemin":sr,"aria-valuemax":lr,"aria-valuenow":Math.round(R),tabIndex:0,onPointerDown:Ye,onDoubleClick:()=>de(cr),onKeyDown:Xe,title:p.resizeNotesList,className:b(`group relative z-10 hidden shrink-0 cursor-col-resize touch-none select-none items-center justify-center bg-transparent hover:bg-surface-hover/60 lg:flex`,`lg:transition-[width,opacity] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,U?`lg:w-0 lg:opacity-0 lg:pointer-events-none`:`lg:w-2 lg:opacity-100`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-0`),children:(0,$.jsx)(`span`,{"aria-hidden":!0,className:b(`h-full w-px bg-transparent transition-[background-color,transform] duration-150`,`group-hover:bg-accent/70 group-focus-visible:bg-accent`,B&&`bg-accent scale-x-[2]`)})}),(0,$.jsxs)(`section`,{className:b(`relative min-w-0 flex-1 bg-surface-base`,!e&&`hidden lg:flex`),children:[U?(0,$.jsx)(`button`,{type:`button`,onClick:()=>W(!1),className:`absolute left-3 top-3 z-10 hidden size-8 items-center justify-center rounded-lg border border-edge bg-surface-base text-fg-muted shadow-surface transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent lg:inline-flex`,"aria-label":p.expandNotesList,title:p.expandNotesList,children:(0,$.jsx)(Tt,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}):null,e?(0,$.jsx)(Nn,{noteId:e,onBack:()=>le(t),onSaved:()=>{J().catch(e=>{K(`${p.refreshFailed}: ${e instanceof Error?e.message:p.quickCaptureFailedHint}`)})},backButtonClassName:`lg:hidden`,clearHeaderOnCleanup:!1,onOpenSearch:()=>T(!0),autoFocus:e===ie,onAutoFocusConsumed:()=>q(null)}):(0,$.jsx)(`div`,{className:`flex h-full min-h-0 flex-1 items-center justify-center px-8 text-center`,children:(0,$.jsxs)(`div`,{className:`max-w-sm`,children:[(0,$.jsx)(Ve,{className:`mx-auto size-9 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`mt-4 text-base font-semibold text-fg`,children:p.emptyEditorTitle}),(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:p.emptyEditorDescription}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>V(o),"aria-label":f===`zh`?`开始录音`:`Start recording`,className:`inline-flex size-11 shrink-0 items-center justify-center rounded-full text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,children:(0,$.jsx)(vn,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsxs)(`button`,{type:`button`,onClick:Re,disabled:G,className:`mt-5 inline-flex items-center gap-2 rounded-lg bg-accent px-3 py-2 text-sm font-medium text-on-accent transition-colors hover:bg-accent-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-50`,children:[(0,$.jsx)(_,{className:`size-4`,"aria-hidden":!0}),G?p.creatingBlankNote:p.createBlankNote]})]})})]}),(0,$.jsx)(N,{open:x,onOpenChange:T,children:(0,$.jsxs)(A,{children:[(0,$.jsx)(E,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(j,{className:`xopc-dialog-content fixed left-1/2 top-24 z-[90] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float focus:outline-none`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,$.jsx)(M,{className:`text-sm font-semibold text-fg`,children:De}),(0,$.jsx)(O,{className:`sr-only`,children:p.searchPlaceholder}),(0,$.jsx)(k,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":ke,children:(0,$.jsx)(v,{className:`size-4`,"aria-hidden":!0})})})]}),(0,$.jsxs)(`div`,{className:`p-4`,children:[(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(nt,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`input`,{type:`search`,value:D,onChange:e=>P(e.target.value),onKeyDown:Je,placeholder:p.searchPlaceholder,className:`w-full rounded-lg border border-edge bg-surface-base py-2 pl-9 pr-10 text-sm text-fg placeholder:text-fg-muted focus:border-accent focus:outline-none focus:ring-1 focus:ring-accent`}),D?(0,$.jsx)(`button`,{type:`button`,onClick:()=>P(``),className:`absolute right-2 top-1/2 inline-flex size-7 -translate-y-1/2 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":Ae,children:(0,$.jsx)(v,{className:`size-3.5`,"aria-hidden":!0})}):null]}),(0,$.jsx)(`div`,{className:`mt-4 max-h-[min(28rem,calc(100vh-14rem))] overflow-y-auto [scrollbar-gutter:stable]`,children:ye?xe&&!be?(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:[1,2,3].map(e=>(0,$.jsx)(`div`,{className:`h-16 animate-pulse rounded-lg bg-surface-hover`},e))}):Y.length===0?(0,$.jsxs)(`div`,{className:`flex min-h-40 flex-col items-center justify-center gap-2 px-6 text-center`,children:[(0,$.jsx)(Ve,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:p.searchNoResults}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:p.searchNoResultsDescription})]}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`p`,{className:`px-2 pb-1 text-xs text-fg-muted`,children:p.searchResultsCount.replace(`{{count}}`,String(be?.total??Y.length))}),Y.map((e,t)=>{let n=pr[e.kind]||Ve,r=mr(e,{imageNote:p.imageNote,noText:p.noText});return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>qe(e.id),onMouseEnter:()=>I(t),className:b(`flex w-full items-start gap-3 rounded-lg px-3 py-2.5 text-left transition-colors`,t===F?`bg-surface-active`:`hover:bg-surface-hover`),children:[(0,$.jsx)(n,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.title||r}),(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:X(e.updatedAt,ce,Me)})]}),e.title?(0,$.jsx)(`span`,{className:`mt-0.5 block line-clamp-2 text-xs leading-5 text-fg-muted`,children:r}):null,e.tags?.length?(0,$.jsx)(`span`,{className:`mt-1 flex min-w-0 flex-wrap gap-1`,children:e.tags.slice(0,3).map(e=>(0,$.jsx)(`span`,{className:`max-w-24 truncate rounded-md bg-surface-hover px-1.5 py-0.5 text-xs text-fg-muted`,children:e},e))}):null]})]},e.id)})]}):(0,$.jsxs)(`div`,{className:`flex min-h-40 flex-col items-center justify-center gap-2 px-6 text-center`,children:[(0,$.jsx)(nt,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:p.searchEmptyTitle}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:p.searchEmptyDescription})]})})]})]})]})})]}):(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:[(0,$.jsx)(Ve,{className:`size-10 text-fg-muted`}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:p.needToken})]})}var vr=()=>({goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``});function yr({projectId:e}){let t=w(e=>e.language),n=y(t).workflows,r=t===`zh`,[i,a]=(0,Q.useState)(!1),[o,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(``),[f,p]=(0,Q.useState)(vr),[m,h]=(0,Q.useState)([]),[g,_]=(0,Q.useState)(!0),[b,x]=(0,Q.useState)(!1),[S,C]=(0,Q.useState)(null),[T,P]=(0,Q.useState)(null),F=L(i?`workflow-definitions`:null,an,{revalidateOnFocus:!1}),I=L(i?`workflow-agents`:null,z,{revalidateOnFocus:!1}),R=L(i?[`workflow-project-presets`,e]:null,()=>Ze(e),{revalidateOnFocus:!1}),B=F.data?.find(e=>e.id===o),V=B?bt(B,t):null,U=u||I.data?.defaultId,W=F.isLoading||I.isLoading||R.isLoading,G=F.error||I.error||R.error,ee=Dn(B,f,g).valid,te=e=>{b||(e&&(l(``),d(``),p(vr()),h([]),_(!0),C(null),P(null)),a(e))},ne=e=>{l(e),p(vr()),_(!0),C(null),h(R.data?.find(t=>t.definitionId===e)?.contextRefs??[])},K=async()=>{if(!(!B||!U||!ee||b||T||W||G)){x(!0),C(null);try{P({runId:(await H({definitionId:B.id,agentId:U,projectId:e,goal:f.goal.trim()||V?.description||B.title,input:On(B,f),contextRefs:m,concurrency:f.concurrency.trim()?Number(f.concurrency):void 0,maxSubagents:f.maxSubagents.trim()?Number(f.maxSubagents):void 0})).runId,agentId:U})}catch(e){C(e instanceof Error?e.message:n.startFailed);return}finally{x(!1)}}};return(0,$.jsxs)(N,{open:i,onOpenChange:te,children:[(0,$.jsx)(D,{asChild:!0,children:(0,$.jsxs)(Y,{variant:`secondary`,className:`h-9 rounded-lg`,children:[(0,$.jsx)(le,{className:`size-4`,"aria-hidden":!0}),y(t).projectDetailPage.common.runWorkflow]})}),(0,$.jsxs)(A,{children:[(0,$.jsx)(E,{className:`xopc-dialog-overlay fixed inset-0 z-50 bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(j,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-50 flex h-[min(46rem,calc(100dvh-2rem))] w-[min(48rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-float`,children:[(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(M,{className:`text-base font-semibold text-fg`,children:y(t).projectDetailPage.common.runWorkflow}),(0,$.jsx)(O,{className:`mt-1 text-xs text-fg-muted`,children:r?`选择工作流并运行,结果将关联到当前项目。`:`Choose and run a workflow. The run will be linked to this project.`})]}),(0,$.jsx)(k,{asChild:!0,children:(0,$.jsx)(Y,{variant:`ghost`,className:`size-8 p-0`,disabled:b,"aria-label":n.pickStartClose,children:(0,$.jsx)(v,{className:`size-4`,"aria-hidden":!0})})})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:T?(0,$.jsxs)(`div`,{role:`status`,className:`flex flex-col items-center gap-3 py-12 text-center`,children:[(0,$.jsx)(c,{className:`size-8 text-success`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-base font-medium text-fg`,children:n.startSuccess}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r?`工作流正在后台运行,你可以继续处理项目。`:`The workflow is running in the background. You can continue working on your project.`}),(0,$.jsx)(Y,{asChild:!0,variant:`secondary`,children:(0,$.jsx)(s,{to:`/workflows/runs/${encodeURIComponent(T.runId)}?agentId=${encodeURIComponent(T.agentId)}&projectId=${encodeURIComponent(e)}`,children:n.taskOpenDetails})})]}):W?(0,$.jsxs)(`div`,{className:`space-y-4`,"aria-label":r?`正在加载工作流`:`Loading workflows`,children:[(0,$.jsx)(Me,{className:`h-10 w-full rounded-lg`}),(0,$.jsx)(Me,{className:`h-10 w-full rounded-lg`}),(0,$.jsx)(Me,{className:`h-56 w-full rounded-xl`})]}):G?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:G instanceof Error?G.message:n.startFailed}):F.data?.length?(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[n.chooseWorkflow,(0,$.jsxs)(ot,{value:o,onChange:e=>ne(e.target.value),disabled:b,"aria-label":n.chooseWorkflow,className:`mt-1 w-full`,children:[(0,$.jsx)(ft,{value:``,children:n.chooseWorkflow}),F.data.map(e=>(0,$.jsx)(ft,{value:e.id,children:bt(e,t).title},e.id))]})]}),(0,$.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[r?`执行助手`:`Execution assistant`,(0,$.jsx)(ot,{value:U??``,onChange:e=>d(e.target.value),disabled:b,"aria-label":r?`执行助手`:`Execution assistant`,className:`mt-1 w-full`,children:I.data?.agents.map(e=>(0,$.jsx)(ft,{value:e.id,children:Ne(e,y(t).agentsSettings)},e.id))})]}),B&&V?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:V.description}),(0,$.jsx)(zn,{projectId:e,language:t,value:m,onChange:h}),(0,$.jsx)(kn,{definition:B,language:t,value:f,onChange:p,mode:`manual`,onValidityChange:e=>_(e.reason!==`raw-json`)})]}):null,S?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:S}):null]}):(0,$.jsx)(`p`,{className:`py-12 text-center text-sm text-fg-muted`,children:r?`还没有可运行的工作流,请先新建工作流。`:`No workflows are available. Create a workflow to get started.`})}),(0,$.jsxs)(`footer`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3 border-t border-edge px-5 py-4`,children:[(0,$.jsx)(Y,{asChild:!0,variant:`ghost`,disabled:b,children:(0,$.jsx)(s,{to:`/workflows/new?projectId=${encodeURIComponent(e)}`,onClick:e=>{b&&e.preventDefault()},children:n.addWorkflow})}),T?(0,$.jsx)(k,{asChild:!0,children:(0,$.jsx)(Y,{variant:`primary`,children:n.pickStartClose})}):(0,$.jsxs)(Y,{variant:`primary`,disabled:W||!!G||!B||!U||!ee||b,onClick:()=>void K(),children:[(0,$.jsx)(gn,{className:`size-4`,"aria-hidden":!0}),b?n.starting:n.runWorkflow]})]})]})]})]})}function br(e){return x(T(`/api/projects/${encodeURIComponent(e)}/skills`))}function xr(e,t){return x(T(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`))}function Sr(e,t){return x(T(`/api/projects/${encodeURIComponent(e)}/workspace-trust`),{method:`PATCH`,body:JSON.stringify({trusted:t})})}function Cr(e,t){let n=new FormData;return n.set(`file`,t),x(T(`/api/projects/${encodeURIComponent(e)}/skills/upload`),{method:`POST`,body:n})}function wr(e,t,n={}){return x(T(`/api/projects/${encodeURIComponent(e)}/skills/marketplace/install`),{method:`POST`,body:JSON.stringify({name:t,...n})})}function Tr(e,t){return x(T(`/api/projects/${encodeURIComponent(e)}/skills/source/install`),{method:`POST`,body:JSON.stringify({source:t})})}function Er(e,t){return x(T(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`),{method:`DELETE`})}function Dr({projectId:e,copy:t}){let n=w(e=>e.language),[r,i]=(0,Q.useState)([]),[a,o]=(0,Q.useState)([]),[s,c]=(0,Q.useState)([]),[l,u]=(0,Q.useState)([]),[f,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(null),[g,y]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(!0),[C,T]=(0,Q.useState)(!1),[D,O]=(0,Q.useState)(null),[P,F]=(0,Q.useState)(``),[I,L]=(0,Q.useState)(null),[R,z]=(0,Q.useState)(null),[V,H]=(0,Q.useState)(``),[U,W]=(0,Q.useState)(1),[G,ee]=(0,Q.useState)(null),[ne,K]=(0,Q.useState)(!1),[re,ie]=(0,Q.useState)(``),[q,ae]=(0,Q.useState)(``),oe=(0,Q.useRef)(null),ce=(0,Q.useCallback)(async()=>{S(!0),F(``);try{let t=await br(e);i(t.items),o(t.inheritedItems),c(t.sources)}catch(e){F(e instanceof Error?e.message:String(e))}finally{S(!1)}},[e]);(0,Q.useEffect)(()=>{ce()},[ce]),(0,Q.useEffect)(()=>{let t=!1;return Pe(e).then(e=>{t||u(e)}).catch(()=>{t||u([])}),()=>{t=!0}},[e]),(0,Q.useEffect)(()=>{if(!f){h(null);return}let e=l.find(e=>e.key===f),t=!1;return h(null),F(``),y(!0),Mt(e?.agentId??e?.routing?.agentId,f,!0).then(e=>{t||h(e)}).catch(e=>{t||F(e instanceof Error?e.message:String(e))}).finally(()=>{t||y(!1)}),()=>{t=!0}},[f,l]),(0,Q.useEffect)(()=>{if(I!==`marketplace`)return;let e=new AbortController,t=window.setTimeout(()=>{K(!0),ie(``),wn({q:V,page:U,pageSize:8,sort:`downloads`,signal:e.signal}).then(ee).catch(t=>{e.signal.aborted||ie(t instanceof Error?t.message:String(t))}).finally(()=>{e.signal.aborted||K(!1)})},250);return()=>{window.clearTimeout(t),e.abort()}},[I,U,V]);async function ue(e,t){T(!0),O(t??null),F(``);try{await e(),L(null),ae(``),await ce()}catch(e){F(e instanceof Error?e.message:String(e))}finally{T(!1),O(null)}}async function de(t){F(``);try{z((await xr(e,t)).skill)}catch(e){F(e instanceof Error?e.message:String(e))}}async function fe(n){if(n.removable&&window.confirm(t.removeConfirm.replace(`{{name}}`,n.name))){T(!0);try{await Er(e,n.directoryId),await ce()}catch(e){F(e instanceof Error?e.message:String(e))}finally{T(!1)}}}async function J(){T(!0),F(``);try{await Sr(e,!0),await ce()}catch(e){F(e instanceof Error?e.message:String(e))}finally{T(!1)}}let me=s.find(e=>e.origin===`agents-workspace`),he=new Map(m?.skills.map(e=>[e.name,e]));return(0,$.jsxs)(`section`,{id:`project-panel-skills`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-skills`,className:`grid content-start gap-4`,children:[(0,$.jsx)(`div`,{className:`rounded-lg bg-surface-panel p-4 shadow-surface`,children:(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.title}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.description})]}),(0,$.jsxs)(pe,{children:[(0,$.jsx)(se,{asChild:!0,children:(0,$.jsxs)(Y,{type:`button`,children:[(0,$.jsx)(_,{className:`size-4`,"aria-hidden":!0}),t.add,(0,$.jsx)(zt,{className:`size-3.5`,"aria-hidden":!0})]})}),(0,$.jsx)(Re,{children:(0,$.jsxs)(ln,{align:`end`,sideOffset:8,className:`z-50 w-72 rounded-lg border border-edge bg-surface-overlay p-1.5 shadow-xl`,children:[(0,$.jsx)(jr,{icon:te,title:t.marketplace,hint:t.marketplaceHint,onClick:()=>L(`marketplace`)}),(0,$.jsx)(jr,{icon:le,title:t.source,hint:t.sourceHint,onClick:()=>L(`source`)}),(0,$.jsx)(jr,{icon:Ct,title:t.upload,hint:t.uploadHint,onClick:()=>oe.current?.click()})]})})]}),(0,$.jsx)(`input`,{ref:oe,type:`file`,accept:`.zip,application/zip`,className:`hidden`,onChange:t=>{let n=t.target.files?.[0];n&&ue(()=>Cr(e,n)),t.target.value=``}})]})}),P?(0,$.jsx)(`p`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:P}):null,me?.state===`untrusted`?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-lg border border-amber-500/30 bg-amber-500/10 px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,$.jsx)(Wt,{className:`mt-0.5 size-4 shrink-0 text-amber-700 dark:text-amber-300`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.trustTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.trustHint})]})]}),(0,$.jsxs)(Y,{type:`button`,variant:`secondary`,disabled:C,onClick:()=>void J(),children:[(0,$.jsx)(B,{className:`size-4`,"aria-hidden":!0}),C?t.trusting:t.trustAction]})]}):null,l.length?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-3 rounded-lg border border-edge bg-surface-panel p-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.sessionViewLabel}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:g?t.sessionLoading:f?m?.agentId:t.sessionViewAll})]}),(0,$.jsx)(nn,{value:f,options:l.map(e=>({value:e.key,label:e.name?.trim()||`${t.sessionFallback} · ${e.key.slice(-12)}`})),placeholder:t.sessionViewAll,emptyLabel:t.sessionViewAll,triggerClassName:`w-[min(24rem,calc(100vw-3rem))]`,onChange:p})]}):null,x?(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:[0,1,2].map(e=>(0,$.jsx)(Me,{className:`h-36 rounded-lg`},e))}):r.length?(0,$.jsx)(Or,{title:t.localTitle,items:r,copy:t,busy:C,availabilityByName:he,onPreview:de,onRemove:fe}):(0,$.jsxs)(`div`,{className:`rounded-lg border border-dashed border-edge bg-surface-panel px-6 py-12 text-center`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.empty}),(0,$.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:t.emptyHint})]}),!x&&a.length?(0,$.jsx)(Or,{title:t.inheritedTitle,hint:t.inheritedHint,items:a,copy:t,busy:C,availabilityByName:he,onPreview:de,onRemove:fe}):null,(0,$.jsx)(N,{open:I!==null,onOpenChange:e=>{e||L(null)},children:(0,$.jsxs)(A,{children:[(0,$.jsx)(E,{className:`xopc-dialog-overlay fixed inset-0 z-50 bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(j,{className:b(`xopc-dialog-content fixed left-1/2 top-1/2 z-50 flex -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-xl`,I===`marketplace`?`h-[min(46rem,calc(100vh-2rem))] w-[min(58rem,calc(100vw-2rem))]`:`h-[min(22rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))]`),children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,$.jsx)(M,{className:`text-base font-semibold text-fg`,children:I===`marketplace`?t.marketplace:t.source}),(0,$.jsx)(k,{asChild:!0,children:(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,$.jsx)(v,{className:`size-4`})})})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:I===`marketplace`?(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.marketplace}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.marketplaceHint}),(0,$.jsxs)(`div`,{className:`relative mt-3`,children:[(0,$.jsx)(nt,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`input`,{className:`h-10 w-full rounded-md border border-edge bg-surface-base pl-9 pr-3 text-sm outline-none focus:border-accent`,value:V,onChange:e=>{H(e.target.value),W(1)},placeholder:t.marketplacePlaceholder,autoFocus:!0})]}),re?(0,$.jsx)(`p`,{className:`mt-3 text-sm text-red-600 dark:text-red-300`,children:re}):null,ne&&!G?(0,$.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[0,1,2,3].map(e=>(0,$.jsx)(Me,{className:`h-32 rounded-lg`},e))}):G?.items.length?(0,$.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:G.items.map(i=>{let a=et(i,n),o=i.providerId??G.provider,s=Cn(i,o),c=r.some(e=>e.origin===`xopc-workspace`&&(e.directoryId===i.id||e.directoryId===s||e.name===i.name)),l=D===s;return(0,$.jsxs)(`article`,{className:`group flex min-h-32 gap-3 rounded-lg border border-edge bg-surface-base p-3`,children:[(0,$.jsx)(Sn,{name:i.name,className:`size-10`}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,$.jsx)(`h4`,{className:`truncate text-sm font-semibold text-fg`,children:a.displayName}),(0,$.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:a.description||`—`}),(0,$.jsxs)(`div`,{className:`mt-auto flex items-end justify-between gap-2 pt-2`,children:[(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-fg-subtle`,children:[(0,$.jsx)(d,{className:`size-3.5`,"aria-hidden":!0}),t.marketplaceDownloads,` `,i.downloads]}),(0,$.jsx)(Y,{type:`button`,className:`h-8 px-2.5 text-xs`,variant:c?`secondary`:`primary`,disabled:C||c,onClick:()=>void ue(()=>wr(e,s,{provider:o}),s),children:c?t.marketplaceInstalled:l?t.installing:t.install})]})]})]},`${o??`default`}:${i.id}`)})}):ne?null:(0,$.jsx)(`p`,{className:`mt-6 text-center text-sm text-fg-muted`,children:t.marketplaceEmpty}),G&&G.meta.totalPages>1?(0,$.jsxs)(`div`,{className:`mt-3 flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:t.marketplacePage.replace(`{{page}}`,String(G.meta.page)).replace(`{{total}}`,String(G.meta.totalPages))}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsxs)(Y,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:ne||U<=1,onClick:()=>W(e=>Math.max(1,e-1)),children:[(0,$.jsx)(ut,{className:`size-4`}),t.marketplacePrevious]}),(0,$.jsxs)(Y,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:ne||U>=G.meta.totalPages,onClick:()=>W(e=>e+1),children:[t.marketplaceNext,(0,$.jsx)(at,{className:`size-4`})]})]})]}):null]}):(0,$.jsxs)(`section`,{className:`flex h-full flex-col`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:t.sourceHint}),(0,$.jsx)(`input`,{className:`mt-4 h-10 w-full rounded-md border border-edge bg-surface-base px-3 text-sm outline-none focus:border-accent`,value:q,onChange:e=>ae(e.target.value),placeholder:t.sourcePlaceholder,autoFocus:!0}),(0,$.jsxs)(`div`,{className:`mt-auto flex justify-end gap-2 border-t border-edge pt-4`,children:[(0,$.jsx)(k,{asChild:!0,children:(0,$.jsx)(Y,{type:`button`,variant:`secondary`,children:t.close})}),(0,$.jsx)(Y,{type:`button`,disabled:C||!q.trim(),onClick:()=>void ue(()=>Tr(e,q.trim())),children:C?t.installing:t.install})]})]})})]})]})}),(0,$.jsx)(N,{open:!!R,onOpenChange:e=>{e||z(null)},children:(0,$.jsxs)(A,{children:[(0,$.jsx)(E,{className:`xopc-dialog-overlay fixed inset-0 z-50 bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(j,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-50 flex h-[min(42rem,calc(100vh-2rem))] w-[min(48rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-xl`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,$.jsx)(M,{className:`text-base font-semibold text-fg`,children:R?.name}),(0,$.jsx)(k,{asChild:!0,children:(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,$.jsx)(v,{className:`size-4`})})})]}),(0,$.jsx)(`pre`,{className:`min-h-0 flex-1 overflow-auto whitespace-pre-wrap p-5 text-sm leading-6 text-fg-muted`,children:R?.bodyMarkdown})]})]})})]})}function Or(e){let t=(0,Vn.c)(25),{title:n,hint:r,items:i,copy:a,busy:o,availabilityByName:s,onPreview:c,onRemove:l}=e,u;t[0]===n?u=t[1]:(u=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n}),t[0]=n,t[1]=u);let d;t[2]===r?d=t[3]:(d=r?(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:r}):null,t[2]=r,t[3]=d);let p;t[4]!==u||t[5]!==d?(p=(0,$.jsxs)(`div`,{children:[u,d]}),t[4]=u,t[5]=d,t[6]=p):p=t[6];let m;if(t[7]!==s||t[8]!==o||t[9]!==a||t[10]!==i||t[11]!==c||t[12]!==l){let e;t[14]!==s||t[15]!==o||t[16]!==a||t[17]!==c||t[18]!==l?(e=e=>{let t=e.effective?s.get(e.name):void 0;return(0,$.jsxs)(`article`,{className:b(`flex min-h-36 flex-col rounded-lg border border-edge bg-surface-panel p-4`,!e.effective&&`opacity-70`),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(we,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,$.jsx)(`h4`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:e.name})]}),(0,$.jsx)(`p`,{className:`mt-2 line-clamp-2 flex-1 text-sm leading-5 text-fg-muted`,children:e.description||e.directoryId}),(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5 text-[11px] text-fg-subtle`,children:[(0,$.jsx)(`span`,{className:`rounded-md bg-surface-hover/70 px-2 py-0.5`,children:kr(a,e.origin)}),e.writable?null:(0,$.jsx)(`span`,{className:`rounded-md bg-surface-hover/70 px-2 py-0.5`,children:a.sourceReadOnly}),e.effective?null:(0,$.jsx)(`span`,{className:`rounded-md bg-amber-500/10 px-2 py-0.5 text-amber-800 dark:text-amber-200`,children:a.shadowed}),t?(0,$.jsx)(`span`,{className:b(`rounded-md px-2 py-0.5`,t.availableForCurrentAgent?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-amber-500/10 text-amber-800 dark:text-amber-200`),children:Ar(a,t)}):null]}),(0,$.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-2`,children:[(0,$.jsxs)(Y,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>void c(e.key),children:[(0,$.jsx)(f,{className:`size-3.5`,"aria-hidden":!0}),a.view]}),e.removable?(0,$.jsxs)(Y,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs text-red-600`,disabled:o,onClick:()=>void l(e),children:[(0,$.jsx)(De,{className:`size-3.5`,"aria-hidden":!0}),a.remove]}):null]})]},e.key)},t[14]=s,t[15]=o,t[16]=a,t[17]=c,t[18]=l,t[19]=e):e=t[19],m=i.map(e),t[7]=s,t[8]=o,t[9]=a,t[10]=i,t[11]=c,t[12]=l,t[13]=m}else m=t[13];let h;t[20]===m?h=t[21]:(h=(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:m}),t[20]=m,t[21]=h);let g;return t[22]!==p||t[23]!==h?(g=(0,$.jsxs)(`section`,{className:`grid gap-3`,children:[p,h]}),t[22]=p,t[23]=h,t[24]=g):g=t[24],g}function kr(e,t){switch(t){case`xopc-workspace`:return e.xopcSource;case`agents-workspace`:return e.agentsSource;case`xopc-global`:case`custom-global`:return e.globalXopcSource;case`agents-global`:return e.globalAgentsSource;case`bundled`:return e.bundledSource;case`extra`:return e.extraSource}}function Ar(e,t){if(t.availableForCurrentAgent)return e.sessionAvailable;switch(t.unavailableReason){case`agent-denied`:return e.sessionUnavailableAgent;case`disabled`:return e.sessionUnavailableDisabled;case`requirements-unmet`:return e.sessionUnavailableRequirements;case`model-invocation-disabled`:return e.sessionUnavailableModel;case`tool-gated`:return e.sessionUnavailableTools;default:return e.sessionUnavailableAgent}}function jr(e){let t=(0,Vn.c)(13),{icon:n,title:r,hint:i,onClick:a}=e,o;t[0]===n?o=t[1]:(o=(0,$.jsx)(n,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`,"aria-hidden":!0}),t[0]=n,t[1]=o);let s;t[2]===r?s=t[3]:(s=(0,$.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:r}),t[2]=r,t[3]=s);let c;t[4]===i?c=t[5]:(c=(0,$.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-fg-muted`,children:i}),t[4]=i,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,$.jsxs)(`span`,{className:`min-w-0`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;return t[9]!==a||t[10]!==o||t[11]!==l?(u=(0,$.jsx)(ie,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,className:`flex w-full items-start gap-3 rounded-md px-3 py-2.5 text-left hover:bg-surface-hover`,onClick:a,children:[o,l]})}),t[9]=a,t[10]=o,t[11]=l,t[12]=u):u=t[12],u}function Mr(e){return{name:e.name,description:e.description??``,status:e.status,defaultAgentId:e.defaultAgentId??``,executionMode:e.executionMode,workspaceRoot:e.workspaceRoot??``,brief:e.brief??``,instructions:e.instructions??``}}function Nr(e,t,n){let r=Mr(t),i=Mr(n),a=Object.keys(r).filter(t=>e[t]===r[t]);return{...e,...Object.fromEntries(a.map(e=>[e,i[e]]))}}var Pr={active:0,review:1,ready:2,backlog:3,closed:4},Fr={failed:0,blocked:1,waiting:2,verifying:3,running:4,queued:5,allocating:5,cancelled:6,idle:7},Ir={critical:0,high:1,normal:2,low:3};function Lr(e,t=4){return e.filter(e=>e.phase!==`closed`&&!(e.operationalState===`waiting`&&e.attention.length===0)).sort((e,t)=>{let n=Number(t.attention.length>0)-Number(e.attention.length>0);if(n!==0)return n;let r=Fr[e.operationalState]-Fr[t.operationalState];if(r!==0)return r;let i=Pr[e.phase]-Pr[t.phase];if(i!==0)return i;let a=Ir[e.priority]-Ir[t.priority];return a===0?t.updatedAt-e.updatedAt:a}).slice(0,t)}var Rr=[`backlog`,`ready`,`active`,`review`,`closed`];function zr(e){return{backlog:e.filter(e=>e.phase===`backlog`),ready:e.filter(e=>e.phase===`ready`),active:e.filter(e=>e.phase===`active`),review:e.filter(e=>e.phase===`review`),closed:e.filter(e=>e.phase===`closed`)}}function Br(e,t){if(e.phase!==t){if(e.phase===`closed`&&t!==`closed`&&e.allowedCommands.includes(`reopen`))return`reopen_${t}`;if(t===`closed`&&e.phase===`review`&&e.allowedCommands.includes(`close`))return`complete`;if(t!==`closed`&&e.allowedCommands.includes(`move`))return`move_${t}`}}function Vr(e){if(e.allowedCommands.includes(`resolve_wait`))return`resume`;if(e.allowedCommands.includes(`mark_ready`))return`ready`;if(e.allowedCommands.includes(`start`))return`run`;if(e.allowedCommands.includes(`request_review`))return`review`;if(e.phase===`review`&&e.allowedCommands.includes(`close`))return`complete`;if(e.allowedCommands.includes(`reopen`))return`reopen`;if(e.allowedCommands.includes(`add_wait`))return`pause`}function Hr(e){let t=new Map,n=new Map;for(let r of e)t.set(r.dependencyTaskId,[...t.get(r.dependencyTaskId)??[],r.dependentTaskId]),n.set(r.dependentTaskId,[...n.get(r.dependentTaskId)??[],r.dependencyTaskId]);return{outgoing:t,incoming:n}}function Ur(e,t){let n=new Set(e.map(e=>e.id)),{outgoing:r,incoming:i}=Hr(t.filter(e=>n.has(e.dependencyTaskId)&&n.has(e.dependentTaskId))),a=new Map(e.map(e=>[e.id,i.get(e.id)?.length??0])),o=new Map(e.map(e=>[e.id,0])),s=e.filter(e=>a.get(e.id)===0).sort((e,t)=>t.updatedAt-e.updatedAt).map(e=>e.id);for(let e=0;e<s.length;e+=1){let t=s[e];for(let e of r.get(t)??[]){o.set(e,Math.max(o.get(e)??0,(o.get(t)??0)+1));let n=(a.get(e)??1)-1;a.set(e,n),n===0&&s.push(e)}}let c=new Map;for(let t of e){let e=o.get(t.id)??0;c.set(e,[...c.get(e)??[],t.id])}let l=new Map;for(let[e,t]of c)t.forEach((t,n)=>l.set(t,{x:e*300,y:n*136}));return l}function Wr(e,t){let{incoming:n}=Hr(t),r=new Set(e.filter(e=>e.operationalState===`blocked`).map(e=>e.id)),i=[...r];for(let e=0;e<i.length;e+=1)for(let t of n.get(i[e])??[])r.has(t)||(r.add(t),i.push(t));return r}function Gr(e,t){let{incoming:n,outgoing:r}=Hr(t),i=new Set([e]);for(let t of[n,r]){let n=[e],r=new Set(n);for(let e=0;e<n.length;e+=1)for(let a of t.get(n[e])??[])r.has(a)||(r.add(a),i.add(a),n.push(a))}return i}var Kr={backlog:`border-edge`,ready:`border-edge`,active:`border-accent ring-2 ring-accent/15`,review:`border-amber-400/80`,closed:`border-emerald-400/60`};function qr(e){let t=(0,Vn.c)(25),{data:n,selected:r}=e,i=n.task,a=i.operationalState===`waiting`||i.operationalState===`blocked`,o=Kr[i.phase],s=r&&`ring-2 ring-accent/30`,c=n.dimmed&&`opacity-30`,l;t[0]!==o||t[1]!==s||t[2]!==c?(l=b(`group w-56 rounded-xl border bg-surface-panel p-3 shadow-surface transition-opacity`,o,s,c),t[0]=o,t[1]=s,t[2]=c,t[3]=l):l=t[3];let u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(Ln,{type:`target`,position:Fn.Left,className:`!size-3 !border-2 !border-surface-panel !bg-accent opacity-60 transition-opacity group-hover:opacity-100`}),t[4]=u):u=t[4];let d;t[5]===i.title?d=t[6]:(d=(0,$.jsx)(`strong`,{className:`line-clamp-2 min-w-0 text-sm font-medium leading-5 text-fg`,children:i.title}),t[5]=i.title,t[6]=d);let f;t[7]===a?f=t[8]:(f=a?(0,$.jsx)(on,{className:`mt-0.5 size-3.5 shrink-0 text-violet-600 dark:text-violet-300`,"aria-hidden":!0}):null,t[7]=a,t[8]=f);let p;t[9]!==d||t[10]!==f?(p=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[d,f]}),t[9]=d,t[10]=f,t[11]=p):p=t[11];let m;t[12]===n.phaseLabel?m=t[13]:(m=(0,$.jsx)(`span`,{children:n.phaseLabel}),t[12]=n.phaseLabel,t[13]=m);let h;t[14]!==a||t[15]!==i.blockedBy?(h=a&&i.blockedBy.length>0?(0,$.jsx)(`span`,{children:i.blockedBy.length}):null,t[14]=a,t[15]=i.blockedBy,t[16]=h):h=t[16];let g;t[17]!==h||t[18]!==m?(g=(0,$.jsxs)(`div`,{className:`mt-2 flex items-center justify-between gap-2 text-[11px] text-fg-subtle`,children:[m,h]}),t[17]=h,t[18]=m,t[19]=g):g=t[19];let _;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(Ln,{type:`source`,position:Fn.Right,className:`!size-3 !border-2 !border-surface-panel !bg-accent opacity-60 transition-opacity group-hover:opacity-100`}),t[20]=_):_=t[20];let v;return t[21]!==g||t[22]!==l||t[23]!==p?(v=(0,$.jsxs)(`div`,{className:l,children:[u,p,g,_]}),t[21]=g,t[22]=l,t[23]=p,t[24]=v):v=t[24],v}var Jr={taskNode:qr};function Yr(e){let t=(0,Vn.c)(90),{tasks:n,dependencyEdges:r,returnTo:i,copy:a,onDependenciesChange:o}=e,[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(),[g,_]=(0,Q.useState)(),v=(0,Q.useRef)(null),y;t[0]!==r||t[1]!==n?(y=Wr(n,r),t[0]=r,t[1]=n,t[2]=y):y=t[2];let x=y,S;t[3]!==x||t[4]!==u||t[5]!==c||t[6]!==n?(S=u?n.filter(e=>x.has(e.id)):c?n:n.filter(ri),t[3]=x,t[4]=u,t[5]=c,t[6]=n,t[7]=S):S=t[7];let C=S,w;t[8]===C?w=t[9]:(w=new Set(C.map(ni)),t[8]=C,t[9]=w);let T=w,E;if(t[10]!==r||t[11]!==T){let e;t[13]===T?e=t[14]:(e=e=>T.has(e.dependencyTaskId)&&T.has(e.dependentTaskId),t[13]=T,t[14]=e),E=r.filter(e),t[10]=r,t[11]=T,t[12]=E}else E=t[12];let D=E,O;t[15]!==D||t[16]!==C?(O=Ur(C,D),t[15]=D,t[16]=C,t[17]=O):O=t[17];let k=O,A;t[18]!==m||t[19]!==D?(A=m?Gr(m,D):void 0,t[18]=m,t[19]=D,t[20]=A):A=t[20];let j=A,M;t[21]===m?M=t[22]:(M=e=>e.id===m,t[21]=m,t[22]=M);let N=C.find(M),P;t[23]===C?P=t[24]:(P=new Map(C.map(ti)),t[23]=C,t[24]=P);let F=P,I;if(t[25]!==a.phases||t[26]!==k||t[27]!==j||t[28]!==C){let e;t[30]!==a.phases||t[31]!==k||t[32]!==j?(e=e=>({id:e.id,type:`taskNode`,position:k.get(e.id)??{x:0,y:0},data:{task:e,phaseLabel:a.phases[e.phase],dimmed:!!(j&&!j.has(e.id))}}),t[30]=a.phases,t[31]=k,t[32]=j,t[33]=e):e=t[33],I=C.map(e),t[25]=a.phases,t[26]=k,t[27]=j,t[28]=C,t[29]=I}else I=t[29];let L=I,R;if(t[34]!==j||t[35]!==F||t[36]!==D){let e;t[38]!==j||t[39]!==F?(e=e=>{let t=F.get(e.dependencyTaskId),n=t?.phase===`closed`&&t.resolution===`done`,r=!!(j&&(!j.has(e.dependencyTaskId)||!j.has(e.dependentTaskId)));return{id:`${e.dependencyTaskId}:${e.dependentTaskId}`,source:e.dependencyTaskId,target:e.dependentTaskId,markerEnd:{type:Pn.ArrowClosed},style:{stroke:n?`var(--color-edge-strong)`:`var(--color-accent)`,strokeWidth:n?1.25:1.75,opacity:r?.18:1,strokeDasharray:n?`5 5`:void 0}}},t[38]=j,t[39]=F,t[40]=e):e=t[40],R=D.map(e),t[34]=j,t[35]=F,t[36]=D,t[37]=R}else R=t[37];let z=R,B,V;t[41]!==m||t[42]!==T?(B=()=>{m&&!T.has(m)&&h(void 0)},V=[m,T],t[41]=m,t[42]=T,t[43]=B,t[44]=V):(B=t[43],V=t[44]),(0,Q.useEffect)(B,V);let H,U;t[45]!==z||t[46]!==g?(H=()=>{g&&!z.some(e=>e.id===g)&&_(void 0)},U=[z,g],t[45]=z,t[46]=g,t[47]=H,t[48]=U):(H=t[47],U=t[48]),(0,Q.useEffect)(H,U);let W;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(W=()=>{let e=window.requestAnimationFrame(()=>{v.current?.fitView({padding:.2,minZoom:.35,maxZoom:1,duration:250})});return()=>window.cancelAnimationFrame(e)},t[49]=W):W=t[49];let G;t[50]!==u||t[51]!==c||t[52]!==C.length?(G=[u,c,C.length],t[50]=u,t[51]=c,t[52]=C.length,t[53]=G):G=t[53],(0,Q.useEffect)(W,G);let ee;t[54]===m?ee=t[55]:(ee=()=>{m&&v.current?.fitView({nodes:[{id:m}],padding:1.5,minZoom:.7,maxZoom:1,duration:250})},t[54]=m,t[55]=ee);let te=ee,ne;t[56]!==r||t[57]!==o?(ne=e=>{if(!e.source||!e.target||e.source===e.target)return;let t=r.filter(t=>t.dependentTaskId===e.target).map(ei);t.includes(e.source)||o(e.target,[...t,e.source])},t[56]=r,t[57]=o,t[58]=ne):ne=t[58];let K=ne,re;t[59]!==r||t[60]!==o||t[61]!==g?(re=()=>{if(!g)return;let e=r.find(e=>`${e.dependencyTaskId}:${e.dependentTaskId}`===g);e&&(_(void 0),o(e.dependentTaskId,r.filter(t=>t.dependentTaskId===e.dependentTaskId&&t.dependencyTaskId!==e.dependencyTaskId).map($r)))},t[59]=r,t[60]=o,t[61]=g,t[62]=re):re=t[62];let ie=re,q;t[63]===a.connectHint?q=t[64]:(q=(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.connectHint}),t[63]=a.connectHint,t[64]=q);let ae=u?`secondary`:`ghost`,oe;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(oe=()=>d(Qr),t[65]=oe):oe=t[65];let se=u?a.allTasks:a.blockedChains,ce;t[66]!==u||t[67]!==ae||t[68]!==se?(ce=(0,$.jsx)(Y,{type:`button`,variant:ae,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":u,onClick:oe,children:se}),t[66]=u,t[67]=ae,t[68]=se,t[69]=ce):ce=t[69];let le;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(le=()=>l(Zr),t[70]=le):le=t[70];let ue=c?a.hideCompleted:a.showCompleted,de;t[71]!==u||t[72]!==c||t[73]!==ue?(de=(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":c,onClick:le,disabled:u,children:ue}),t[71]=u,t[72]=c,t[73]=ue,t[74]=de):de=t[74];let fe=N?(0,$.jsxs)(Y,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,onClick:te,children:[(0,$.jsx)(Ce,{className:`size-3.5`,"aria-hidden":!0}),a.locateTask]}):null,pe;t[75]!==a.removeDependency||t[76]!==ie||t[77]!==g?(pe=g?(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs text-danger`,onClick:ie,children:a.removeDependency}):null,t[75]=a.removeDependency,t[76]=ie,t[77]=g,t[78]=pe):pe=t[78];let J;t[79]!==ce||t[80]!==de||t[81]!==fe||t[82]!==pe?(J=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[ce,de,fe,pe]}),t[79]=ce,t[80]=de,t[81]=fe,t[82]=pe,t[83]=J):J=t[83];let me;t[84]!==q||t[85]!==J?(me=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-b border-edge bg-surface-panel px-3 py-2.5`,children:[q,J]}),t[84]=q,t[85]=J,t[86]=me):me=t[86];let he=C.length>0?(0,$.jsxs)(`div`,{className:b(`grid h-[min(42rem,calc(100vh-14rem))] min-h-[28rem]`,N&&`lg:grid-cols-[minmax(0,1fr)_18rem]`),children:[(0,$.jsxs)(Z,{nodes:L,edges:z,nodeTypes:Jr,nodesDraggable:!1,nodesConnectable:!0,elementsSelectable:!0,onNodeClick:(e,t)=>h(t.id),onEdgeClick:(e,t)=>_(t.id),onConnect:K,onPaneClick:()=>{h(void 0),_(void 0)},onInit:e=>{v.current=e},fitView:!0,minZoom:.25,maxZoom:1.25,panOnScroll:!0,zoomOnDoubleClick:!1,proOptions:{hideAttribution:!0},children:[(0,$.jsx)(Rn,{color:`var(--color-edge)`,gap:22,size:1}),(0,$.jsx)(In,{showInteractive:!1,className:`!border-edge !bg-surface-panel !shadow-surface`})]}),N?(0,$.jsxs)(`aside`,{className:`overflow-y-auto border-t border-edge bg-surface-panel p-4 lg:border-l lg:border-t-0`,children:[(0,$.jsx)(`p`,{className:`text-xs font-medium text-accent-fg`,children:a.phases[N.phase]}),(0,$.jsx)(`h3`,{className:`mt-2 text-sm font-semibold leading-6 text-fg`,children:N.title}),N.operationalState===`blocked`&&N.blockedBy.length>0?(0,$.jsxs)(`div`,{className:`mt-4 rounded-lg bg-violet-500/8 p-3`,children:[(0,$.jsx)(`p`,{className:`text-xs font-medium text-violet-700 dark:text-violet-300`,children:a.blockedBy.replace(`{{count}}`,String(N.blockedBy.length))}),(0,$.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs leading-5 text-fg-muted`,children:N.blockedBy.map(Xr)})]}):null,(0,$.jsxs)(s,{to:p(i,N.id),className:`mt-4 inline-flex items-center gap-1.5 text-xs font-medium text-accent-fg hover:underline`,children:[(0,$.jsx)(f,{className:`size-3.5`,"aria-hidden":!0}),a.openTask]})]}):null]}):(0,$.jsx)(`div`,{className:`flex min-h-72 items-center justify-center px-6 text-center text-sm text-fg-muted`,children:a.empty}),ge;return t[87]!==me||t[88]!==he?(ge=(0,$.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-base/40`,children:[me,he]}),t[87]=me,t[88]=he,t[89]=ge):ge=t[89],ge}function Xr(e){return(0,$.jsx)(`li`,{children:e.title},e.id)}function Zr(e){return!e}function Qr(e){return!e}function $r(e){return e.dependencyTaskId}function ei(e){return e.dependencyTaskId}function ti(e){return[e.id,e]}function ni(e){return e.id}function ri(e){return e.phase!==`closed`}function ii(e){return e instanceof Element?!!e.closest(`a,button,input,select,textarea,[contenteditable="true"],[draggable="true"],[data-board-pan-skip="true"]`):!0}var ai={backlog:Yt,ready:Yt,active:Qt,review:q,closed:l},oi={backlog:`bg-surface-hover text-fg-muted`,ready:`bg-surface-panel text-fg-muted`,active:`bg-accent-soft text-accent-fg`,review:`bg-amber-500/10 text-amber-700 dark:text-amber-300`,closed:`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`};function si(e){return e===`running`||e===`queued`?`border-accent/20 bg-accent-soft text-accent-fg`:e===`verifying`?`border-emerald-500/20 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`waiting`?`border-amber-500/20 bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`failed`?`border-red-500/20 bg-red-500/10 text-red-700 dark:text-red-300`:e===`blocked`?`border-violet-500/20 bg-violet-500/10 text-violet-700 dark:text-violet-300`:`border-edge-subtle bg-surface-hover text-fg-muted`}function ci(e){return e===`passed`?`border-emerald-500/20 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`failed`?`border-red-500/20 bg-red-500/10 text-red-700 dark:text-red-300`:`border-edge-subtle bg-surface-hover text-fg-muted`}function li(e){let t=(0,Vn.c)(83),{task:n,returnTo:r,copy:i,busy:a,onAction:o,onDragStart:c,onDropBefore:u}=e,d,f,m,h,g,_,v,y,x,S,C,w,T,E,D,O;t[0]!==c||t[1]!==u||t[2]!==r||t[3]!==n?(g=Vr(n),_=g!==`review`&&n.allowedCommands.includes(`request_review`)?`review`:void 0,m=n.phase===`closed`,h=!!(n.dueAt&&n.dueAt<Date.now()&&!m),f=m?l:Nt,y=n.priority!==`normal`,v=y||n.operationalState!==`idle`||!!n.latestVerification||n.acceptanceCriteriaCount>0||!!n.dueAt||!!n.nextCheckAt,C=!0,t[20]!==c||t[21]!==n.id?(w=e=>{e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,n.id),c(n.id)},t[20]=c,t[21]=n.id,t[22]=w):w=t[22],t[23]===c?T=t[24]:(T=()=>c(``),t[23]=c,t[24]=T),E=di,t[25]!==u||t[26]!==n.id?(D=e=>{e.preventDefault(),e.stopPropagation(),u(n.id)},t[25]=u,t[26]=n.id,t[27]=D):D=t[27],O=`group relative min-h-max min-w-0 shrink-0 overflow-hidden rounded-xl border border-edge-subtle bg-surface-base shadow-surface transition-[border-color,box-shadow] hover:border-edge focus-within:border-accent/40`,d=s,t[28]!==r||t[29]!==n.id?(x=p(r,n.id),t[28]=r,t[29]=n.id,t[30]=x):x=t[30],S=b(`block min-w-0 p-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,_?`pr-19`:g&&`pr-11`),t[0]=c,t[1]=u,t[2]=r,t[3]=n,t[4]=d,t[5]=f,t[6]=m,t[7]=h,t[8]=g,t[9]=_,t[10]=v,t[11]=y,t[12]=x,t[13]=S,t[14]=C,t[15]=w,t[16]=T,t[17]=E,t[18]=D,t[19]=O):(d=t[4],f=t[5],m=t[6],h=t[7],g=t[8],_=t[9],v=t[10],y=t[11],x=t[12],S=t[13],C=t[14],w=t[15],T=t[16],E=t[17],D=t[18],O=t[19]);let k=m?`text-emerald-600 dark:text-emerald-400`:`text-fg-subtle`,A;t[31]===k?A=t[32]:(A=b(`mt-0.5 size-4 shrink-0`,k),t[31]=k,t[32]=A);let j;t[33]!==f||t[34]!==A?(j=(0,$.jsx)(f,{className:A,"aria-hidden":!0}),t[33]=f,t[34]=A,t[35]=j):j=t[35];let M=m?`text-fg-subtle`:`text-fg`,N;t[36]===M?N=t[37]:(N=b(`min-w-0 break-words text-sm font-semibold leading-5`,M),t[36]=M,t[37]=N);let P;t[38]!==N||t[39]!==n.title?(P=(0,$.jsx)(`h3`,{className:N,children:n.title}),t[38]=N,t[39]=n.title,t[40]=P):P=t[40];let F;t[41]!==j||t[42]!==P?(F=(0,$.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[j,P]}),t[41]=j,t[42]=P,t[43]=F):F=t[43];let I;t[44]!==i||t[45]!==n.attention||t[46]!==n.blockedBy||t[47]!==n.operationalState?(I=n.operationalState===`blocked`&&n.blockedBy.length>0?(0,$.jsxs)(`div`,{className:`ml-6.5 mt-2.5 rounded-lg bg-violet-500/8 px-2.5 py-2 text-xs text-violet-700 dark:text-violet-300`,children:[(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 font-medium`,children:[(0,$.jsx)(on,{className:`size-3.5`,"aria-hidden":!0}),i.blockedBy.replace(`{{count}}`,String(n.blockedBy.length))]}),(0,$.jsx)(`p`,{className:`mt-1 line-clamp-2 leading-5 text-fg-muted`,children:n.blockedBy.map(ui).join(`、`)})]}):n.attention[0]?(0,$.jsxs)(`p`,{className:`ml-6.5 mt-2.5 flex items-start gap-1.5 text-xs leading-5 text-fg-muted`,children:[(0,$.jsx)(tn,{className:`mt-0.5 size-3.5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`line-clamp-2`,children:n.attention[0].summary})]}):null,t[44]=i,t[45]=n.attention,t[46]=n.blockedBy,t[47]=n.operationalState,t[48]=I):I=t[48];let L;t[49]!==i||t[50]!==h||t[51]!==v||t[52]!==y||t[53]!==n.acceptanceCriteriaCount||t[54]!==n.dueAt||t[55]!==n.latestVerification||t[56]!==n.nextCheckAt||t[57]!==n.operationalState||t[58]!==n.priority?(L=v?(0,$.jsxs)(`div`,{className:`ml-6.5 mt-2.5 flex flex-wrap items-center gap-1.5 text-[11px]`,children:[y?(0,$.jsx)(`span`,{className:b(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,n.priority===`critical`?`border-red-500/20 bg-red-500/10 text-red-700 dark:text-red-300`:n.priority===`high`?`border-amber-500/20 bg-amber-500/10 text-amber-700 dark:text-amber-300`:`border-edge-subtle bg-surface-hover text-fg-muted`),children:i.priorityOptions[n.priority]}):null,n.operationalState===`idle`?null:(0,$.jsx)(`span`,{className:b(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,si(n.operationalState)),children:i.operationalStates[n.operationalState]}),n.latestVerification?(0,$.jsx)(`span`,{className:b(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,ci(n.latestVerification)),children:i.verification[n.latestVerification]}):null,n.acceptanceCriteriaCount>0?(0,$.jsxs)(`span`,{className:`inline-flex min-h-6 items-center gap-1 rounded-md border border-edge-subtle bg-surface-hover px-2 text-fg-muted`,children:[(0,$.jsx)(Qt,{className:`size-3`,"aria-hidden":!0}),i.acceptanceCriteria.replace(`{{count}}`,String(n.acceptanceCriteriaCount))]}):null,n.dueAt?(0,$.jsxs)(`span`,{className:b(`inline-flex min-h-6 items-center gap-1 rounded-md border px-2`,h?`border-red-500/20 bg-red-500/10 text-red-700 dark:text-red-300`:`border-edge-subtle bg-surface-hover text-fg-muted`),children:[(0,$.jsx)(ht,{className:`size-3`,"aria-hidden":!0}),Ee(new Date(n.dueAt))]}):null,n.nextCheckAt?(0,$.jsxs)(`span`,{className:`inline-flex min-h-6 items-center gap-1 rounded-md border border-accent/20 bg-accent-soft px-2 text-accent-fg`,children:[(0,$.jsx)(ht,{className:`size-3`,"aria-hidden":!0}),Ee(new Date(n.nextCheckAt))]}):null]}):null,t[49]=i,t[50]=h,t[51]=v,t[52]=y,t[53]=n.acceptanceCriteriaCount,t[54]=n.dueAt,t[55]=n.latestVerification,t[56]=n.nextCheckAt,t[57]=n.operationalState,t[58]=n.priority,t[59]=L):L=t[59];let R;t[60]!==d||t[61]!==x||t[62]!==F||t[63]!==I||t[64]!==L||t[65]!==S?(R=(0,$.jsxs)(d,{to:x,className:S,children:[F,I,L]}),t[60]=d,t[61]=x,t[62]=F,t[63]=I,t[64]=L,t[65]=S,t[66]=R):R=t[66];let z;t[67]!==a||t[68]!==i||t[69]!==o||t[70]!==g||t[71]!==_||t[72]!==n?(z=g?(0,$.jsxs)(`div`,{className:`absolute right-2.5 top-2.5 z-10 flex items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100 [@media(hover:none)]:opacity-100`,children:[_?(0,$.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>o(n,_),className:`inline-flex size-7 items-center justify-center rounded-md bg-surface-hover text-fg-muted hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-wait disabled:opacity-50`,"aria-label":i.actions[_],title:i.actions[_],children:(0,$.jsx)(q,{className:`size-3.5`,"aria-hidden":!0})}):null,(0,$.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>o(n,g),className:`inline-flex size-7 items-center justify-center rounded-md bg-accent-soft text-accent-fg hover:bg-accent-soft/80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-wait disabled:opacity-50`,"aria-label":i.actions[g],title:i.actions[g],children:(0,$.jsx)(St,{className:`size-3.5`,"aria-hidden":!0})})]}):null,t[67]=a,t[68]=i,t[69]=o,t[70]=g,t[71]=_,t[72]=n,t[73]=z):z=t[73];let B;return t[74]!==R||t[75]!==z||t[76]!==C||t[77]!==w||t[78]!==T||t[79]!==E||t[80]!==D||t[81]!==O?(B=(0,$.jsxs)(`article`,{draggable:C,onDragStart:w,onDragEnd:T,onDragOver:E,onDrop:D,className:O,children:[R,z]}),t[74]=R,t[75]=z,t[76]=C,t[77]=w,t[78]=T,t[79]=E,t[80]=D,t[81]=O,t[82]=B):B=t[82],B}function ui(e){return e.title}function di(e){e.preventDefault(),e.stopPropagation()}function fi({tasks:e,dependencyEdges:t,returnTo:n,copy:r,onAction:i,onReorder:a,onUndoMove:o,onDependenciesChange:s,onCreate:c,actionBusyId:l,ref:u}){let d=(0,Q.useRef)(null),f=(0,Q.useRef)(null),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(`board`),[C,T]=(0,Q.useState)(!1),[D,P]=(0,Q.useState)(()=>crypto.randomUUID()),[F,I]=(0,Q.useState)(``),[L,R]=(0,Q.useState)(`normal`),[z,B]=(0,Q.useState)(``),[V,H]=(0,Q.useState)([]),[U,G]=(0,Q.useState)(!1),[ee,te]=(0,Q.useState)(null),ne=w(e=>e.language),K=Be({chat:y(ne).chat}),re=zr(e),ie=e.filter(e=>e.phase!==`closed`),q=(e,t)=>void i(e,t),ae=async(t,n)=>{let r=e.find(e=>e.id===p);if(m(null),!r||r.id===n)return;let o=re[r.phase],s=o.findIndex(e=>e.id===r.id),c=s>=0?o[s+1]?.id??null:null;if(r.phase===t&&c===n)return;let l=Br(r,t);r.phase!==t&&!l||l&&!await i(r,l)||await a(r.id,n)&&v({taskId:r.id,phase:r.phase,beforeTaskId:c})},oe=async e=>{e.preventDefault();let t=F.trim();if(!(!t||U)){G(!0),te(null);try{let e=z?new Date(`${z}T23:59:59.999`).getTime():void 0;await c({requestId:D,objective:t,priority:L,dependsOnTaskIds:V,attachments:K.wireAttachmentsPayload(),...e===void 0?{}:{dueAt:e}}),I(``),R(`normal`),B(``),H([]),K.clearAttachments(),P(crypto.randomUUID()),T(!1)}catch(e){te(e instanceof Error?e.message:r.createFailed)}finally{G(!1)}}},se=()=>{P(crypto.randomUUID()),I(``),R(`normal`),B(``),H([]),K.clearAttachments(),te(null),T(!0)};(0,Q.useImperativeHandle)(u,()=>({openCreate:se})),(0,Q.useEffect)(()=>{if(!_)return;let e=window.setTimeout(()=>v(null),6e3);return()=>window.clearTimeout(e)},[_]);let ue=(0,Q.useCallback)(e=>{let t=f.current;!t||t.pointerId!==e.pointerId||(f.current=null,g(!1),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},[]),de=(0,Q.useCallback)(e=>{if(e.button!==0||ii(e.target))return;let t=d.current;t&&(f.current={pointerId:e.pointerId,startX:e.clientX,scrollLeft:t.scrollLeft,active:!1},e.currentTarget.setPointerCapture(e.pointerId))},[]),fe=(0,Q.useCallback)(e=>{let t=f.current,n=d.current;if(!t||!n||t.pointerId!==e.pointerId)return;let r=e.clientX-t.startX;!t.active&&Math.abs(r)<5||(t.active||(t.active=!0,g(!0)),e.preventDefault(),n.scrollLeft=t.scrollLeft-r)},[]);return(0,$.jsxs)(`section`,{id:`project-panel-board`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-board`,className:`flex h-full min-h-0 flex-col overflow-hidden`,children:[(0,$.jsxs)(`div`,{className:`mb-4 flex shrink-0 flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:r.title}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r.description})]}),(0,$.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:(0,$.jsxs)(W,{className:`flex rounded-lg border border-edge bg-surface-panel p-0.5`,children:[(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":x===`board`,onClick:()=>S(`board`),className:b(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium`,x===`board`?`bg-surface-hover text-fg`:`text-fg-muted hover:text-fg`),children:[(0,$.jsx)(Lt,{className:`size-3.5`,"aria-hidden":!0}),r.views.board]}),(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":x===`graph`,onClick:()=>S(`graph`),className:b(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium`,x===`graph`?`bg-surface-hover text-fg`:`text-fg-muted hover:text-fg`),children:[(0,$.jsx)(le,{className:`size-3.5`,"aria-hidden":!0}),r.views.graph]})]})})]}),x===`board`?(0,$.jsx)(`div`,{ref:d,className:b(`min-h-0 w-full min-w-0 flex-1 overflow-x-auto overflow-y-hidden overscroll-x-contain pb-2 [scrollbar-width:thin]`,h?`cursor-grabbing select-none`:`cursor-grab`),onPointerDown:de,onPointerMove:fe,onPointerUp:ue,onPointerCancel:ue,onLostPointerCapture:e=>{f.current?.pointerId===e.pointerId&&(f.current=null,g(!1))},children:(0,$.jsx)(`div`,{className:`grid h-full min-h-0 min-w-[103rem] grid-cols-5 gap-3`,children:Rr.map(t=>{let i=ai[t],a=re[t];return(0,$.jsxs)(`section`,{onDragOver:n=>{let r=e.find(e=>e.id===p);r&&(r.phase===t||Br(r,t))&&n.preventDefault()},onDrop:e=>{e.preventDefault(),ae(t,null)},className:`flex min-h-0 min-w-0 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-inset/70 p-2.5`,children:[(0,$.jsxs)(`header`,{className:`mb-2.5 flex shrink-0 items-center gap-2 px-0.5`,children:[(0,$.jsxs)(`div`,{className:b(`flex items-center gap-1.5 rounded-md px-2 py-1`,oi[t]),children:[(0,$.jsx)(i,{className:`size-3.5`,"aria-hidden":!0}),(0,$.jsx)(`h3`,{className:`text-sm font-semibold`,children:r.phases[t]})]}),(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:a.length})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-y-contain pr-1 [scrollbar-gutter:stable] [scrollbar-width:thin]`,children:(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:a.map(e=>(0,$.jsx)(li,{task:e,returnTo:n,copy:r,busy:l===e.id,onAction:q,onDragStart:m,onDropBefore:e=>void ae(t,e)},e.id))})})]},t)})})}):(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,$.jsx)(Yr,{tasks:e,dependencyEdges:t,returnTo:n,copy:{...r.graph,phases:r.phases},onDependenciesChange:s})}),(0,$.jsx)(N,{open:C,onOpenChange:e=>{U||T(e)},children:(0,$.jsxs)(A,{children:[(0,$.jsx)(E,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(j,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(40rem,calc(100vh-2rem))] w-[min(38rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float focus:outline-none`,children:[(0,$.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,$.jsx)(M,{className:`text-base font-semibold text-fg`,children:r.createTitle}),(0,$.jsx)(O,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r.createDescription})]}),(0,$.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:e=>void oe(e),children:[(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,$.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,$.jsx)(`label`,{htmlFor:`project-task-objective`,className:`font-medium text-fg-muted`,children:r.objective}),(0,$.jsxs)(`div`,{className:b(`overflow-hidden rounded-lg border border-edge bg-surface-base transition-colors focus-within:border-accent`,K.isDragging&&`border-accent bg-accent-soft/30`),onDragOver:e=>{e.preventDefault(),U||K.setIsDragging(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||K.setIsDragging(!1)},onDrop:e=>{e.preventDefault(),K.setIsDragging(!1),U||K.processFiles(Array.from(e.dataTransfer.files))},children:[(0,$.jsx)(`textarea`,{id:`project-task-objective`,autoFocus:!0,className:`min-h-28 w-full resize-y bg-transparent px-3 py-3 text-sm leading-6 text-fg outline-none placeholder:text-fg-subtle`,value:F,onChange:e=>{I(e.target.value),te(null)},placeholder:r.objectivePlaceholder,maxLength:12e3,disabled:U}),(0,$.jsx)(Zt,{attachments:K.attachments,topPadded:!1,onRemove:e=>{U||K.removeAttachment(e)}}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-t border-edge-subtle px-2.5 py-2`,children:[(0,$.jsxs)(Y,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:U,onClick:()=>K.fileInputRef.current?.click(),children:[(0,$.jsx)(ce,{className:`size-3.5`,"aria-hidden":!0}),r.addFiles]}),(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:r.attachmentsDescription}),(0,$.jsx)(`input`,{ref:K.fileInputRef,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{K.processFiles(Array.from(e.target.files??[])),e.currentTarget.value=``}})]})]})]}),(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,$.jsx)(`span`,{className:`font-medium text-fg-muted`,children:r.priority}),(0,$.jsx)(ot,{value:L,onChange:e=>R(e.target.value),disabled:U,children:[`low`,`normal`,`high`,`critical`].map(e=>(0,$.jsx)(ft,{value:e,children:r.priorityOptions[e]},e))})]}),(0,$.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,$.jsxs)(`span`,{className:`font-medium text-fg-muted`,children:[r.dueDate,` `,(0,$.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:r.optional})]}),(0,$.jsx)(Tn,{className:`min-h-10 bg-surface-base`,value:z,onChange:B,disabled:U,ariaLabel:r.dueDate})]})]}),(0,$.jsxs)(`fieldset`,{className:`grid gap-2`,children:[(0,$.jsxs)(`legend`,{className:`text-sm font-medium text-fg-muted`,children:[r.dependencies,` `,(0,$.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:r.optional})]}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:r.dependenciesDescription}),(0,$.jsx)(Bn,{candidates:ie,selectedIds:V,disabled:U,onChange:H,labels:{link:r.linkDependencies,linked:r.linkedDependencies,searchPlaceholder:r.dependencySearchPlaceholder,noMatches:r.noDependencyMatches,noCandidates:r.noDependencyCandidates,remove:r.removeDependency}})]}),ee?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:ee}):null]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,$.jsx)(k,{asChild:!0,children:(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:U,children:r.cancel})}),(0,$.jsx)(Y,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:U||!F.trim(),children:U?r.creating:ne===`zh`?`保存待安排任务`:`Save for later`})]})]})]})]})}),_?(0,$.jsxs)(`div`,{role:`status`,className:`fixed bottom-5 left-1/2 z-50 flex -translate-x-1/2 items-center gap-4 rounded-lg border border-edge bg-surface-panel px-4 py-3 text-sm text-fg shadow-float`,children:[(0,$.jsx)(`span`,{children:r.moved}),(0,$.jsx)(`button`,{type:`button`,className:`font-medium text-accent-fg hover:underline`,onClick:()=>{let e=_;v(null),o(e.taskId,e.phase,e.beforeTaskId).then(t=>{t||v(e)})},children:r.undo})]}):null]})}var pi=new Set([{id:`overview`,icon:Jt},{id:`tasks`,icon:Se},{id:`automations`,icon:dn},{id:`files`,icon:ke},{id:`notes`,icon:Te},{id:`skills`,icon:ye},{id:`sessions`,icon:He},{id:`progress`,icon:mn},{id:`settings`,icon:en}].map(e=>e.id)),mi=`xopc.projectFiles.panelWidthPx`,hi=320,gi=220,_i=560;function vi(e,t){return e.name!==t.name||e.description!==(t.description??``)||e.status!==t.status||e.defaultAgentId!==(t.defaultAgentId??``)||e.executionMode!==t.executionMode||e.brief!==(t.brief??``)||e.instructions!==(t.instructions??``)}function yi(e){return Math.min(_i,Math.max(gi,Math.round(e)))}function bi(){try{let e=window.localStorage.getItem(mi);if(e==null)return hi;let t=Number.parseInt(e,10);return Number.isFinite(t)?yi(t):hi}catch{return hi}}function xi(e){try{window.localStorage.setItem(mi,String(yi(e)))}catch{}}function Si(e){return!!(e&&pi.has(e))}function Ci(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function wi(e,t=``){if(!e)return t;let n=new Date(e);return Number.isNaN(n.getTime())?String(e):Ee(n)}function Ti(e){return e===`active`?`bg-accent-soft text-accent-fg`:e===`done`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`paused`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`archived`?`bg-surface-inset text-fg-subtle`:`bg-surface-hover text-fg-muted`}function Ei(e){let t=(0,Vn.c)(8),{label:n,hint:r,children:i}=e,a;t[0]===n?a=t[1]:(a=(0,$.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=r?(0,$.jsx)(`span`,{className:`text-xs leading-5 text-fg-subtle`,children:r}):null,t[2]=r,t[3]=o);let s;return t[4]!==i||t[5]!==a||t[6]!==o?(s=(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[a,i,o]}),t[4]=i,t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function Di(e=!1){return b(`w-full rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,e?`min-h-24 py-2 leading-5`:`min-h-10`)}function Oi(e){let t=(0,Vn.c)(10),{label:n,value:r,mono:i}=e,a=i===void 0?!1:i,o;t[0]===n?o=t[1]:(o=(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-subtle`,children:n}),t[0]=n,t[1]=o);let s=a&&`font-mono text-xs`,c;t[2]===s?c=t[3]:(c=b(`mt-1 min-w-0 truncate text-sm text-fg`,s),t[2]=s,t[3]=c);let l;t[4]!==c||t[5]!==r?(l=(0,$.jsx)(`div`,{className:c,title:r,children:r}),t[4]=c,t[5]=r,t[6]=l):l=t[6];let u;return t[7]!==o||t[8]!==l?(u=(0,$.jsxs)(`div`,{className:`min-w-0 rounded-md bg-surface-base px-3 py-2`,children:[o,l]}),t[7]=o,t[8]=l,t[9]=u):u=t[9],u}function ki(e){return[e.name,e.slug,e.workspaceRoot,e.description,e.brief].filter(Boolean).join(` `).toLowerCase()}function Ai(e){let t=e.lastActiveAt??e.updatedAt??e.createdAt,n=t?new Date(t).getTime():0;return Number.isFinite(n)?n:0}function ji(e){return e.trim().replace(/[\\/]+$/,``).split(/[\\/]/).filter(Boolean).pop()??``}function Mi(e){let t=e?.body;return t?.code===`workspace_root_missing`&&t.workspaceRoot?t.workspaceRoot:null}function Ni(e){let t=e.actor;return t.name?t.name:t.agentId?t.agentId:t.id?t.id:t.conversationId?t.conversationId:t.kind}function Pi(e){return e.primaryObject.title?.trim()||e.primaryObject.id}function Fi(e){let t=e.source;return t.toolCallId?`${t.kind} · ${t.toolCallId}`:t.runId?`${t.kind} · ${t.runId}`:t.requestId?`${t.kind} · ${t.requestId}`:t.kind}function Ii(e){let t=e.sourceChannel?.trim();return t?Li(t):``}function Li(e){let t=e.trim().toLowerCase();return t?t===`tui`?`TUI`:t===`acp`?`ACP`:t===`webchat`?`Webchat`:t:``}function Ri(e){let t=e.payload.changes;if(Array.isArray(t)&&t.length)return t.filter(e=>typeof e==`string`).join(`, `);let n=e.payload.contentPreview;if(typeof n==`string`&&n.trim())return n.trim();let r=e.payload.title??e.payload.name;return typeof r==`string`&&r.trim()?r.trim():``}function zi(e){return e.map(e=>({fileId:e.fileId,name:e.name,path:e.path,isDirectory:e.type===`directory`,children:e.type===`directory`?[]:void 0}))}function Bi(e,t,n){return e.map(e=>e.path===t?{...e,children:n}:e.isDirectory&&e.children?.length?{...e,children:Bi(e.children,t,n)}:e)}function Vi({currentProject:e,pm:t,projectsText:n,wd:r}){let a=i(),[o,s]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)([e]),[d,f]=(0,Q.useState)(``),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(`new`),[C,w]=(0,Q.useState)(``),[T,D]=(0,Q.useState)(``),[P,F]=(0,Q.useState)(!1),[I,L]=(0,Q.useState)(!0),[R,z]=(0,Q.useState)(null),[B,V]=(0,Q.useState)(null),H=(0,Q.useCallback)(async()=>{m(!0),g(null);try{let t=await K({limit:100});u(n=>{let r=new Map;r.set(e.id,e);for(let e of n)r.set(e.id,e);for(let e of t.items)r.set(e.id,e);return Array.from(r.values())})}catch(e){g(e instanceof Error?e.message:String(e))}finally{m(!1)}},[e]);(0,Q.useEffect)(()=>{u(t=>[e,...t.filter(t=>t.id!==e.id)])},[e]),(0,Q.useEffect)(()=>{o&&H()},[H,o]);let U=(0,Q.useMemo)(()=>{let t=d.trim().toLowerCase().split(/\s+/).filter(Boolean);return l.filter(t=>t.id!==e.id).filter(e=>{if(t.length===0)return!0;let n=ki(e);return t.every(e=>n.includes(e))}).sort((e,t)=>Ai(t)-Ai(e))},[e.id,l,d]),W=e=>t.statuses[e.status]??e.status,G=e=>e.description||e.brief||t.common.defaultWorkspace,ee=e=>{S(e),w(``),D(``),z(null),y(!0),s(!1)},te=(0,Q.useCallback)(async(e={})=>{let t=T.trim(),n=C.trim()||(x===`directory`?ji(t):``);if(n){F(!0),z(null),V(null);try{let r=await At({autoUnderstand:I,name:n,...t?{workspaceRoot:t}:{},...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});y(!1),w(``),D(``),L(!0),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:r.id}})),u(e=>[r,...e.filter(e=>e.id!==r.id)]),a(`/projects/${encodeURIComponent(r.id)}`)}catch(e){let t=Mi(e);t?(V(t),y(!1)):z(e instanceof Error?e.message:String(e))}finally{F(!1)}}},[x,C,a,T,I]),ne=(0,Q.useCallback)(e=>{e.preventDefault(),te()},[te]),re=(0,Q.useCallback)(()=>{te({createWorkspaceRoot:!0})},[te]),ie=(0,Q.useCallback)(()=>{V(null),y(!0)},[]),q=e=>{D(e),x===`directory`&&!C.trim()&&w(ji(e))},ae=(e,t)=>(0,$.jsxs)(`button`,{type:`button`,className:b(`grid w-full grid-cols-[1rem_minmax(0,1fr)_auto] items-center gap-2 rounded-md p-2 text-left hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,t&&`bg-accent-soft/55 hover:bg-accent-soft/70`),onClick:()=>{s(!1),t||a(`/projects/${encodeURIComponent(e.id)}`)},children:[(0,$.jsx)(c,{className:b(`size-4 text-accent-fg`,!t&&`invisible`),"aria-hidden":!0}),(0,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.name}),(0,$.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:G(e)})]}),(0,$.jsx)(`span`,{className:b(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,Ti(e.status)),children:W(e)})]},e.id);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(pe,{open:o,onOpenChange:s,children:[(0,$.jsx)(se,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,className:`group flex max-w-full min-w-0 items-center gap-2 rounded-lg px-2 py-1 text-left hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":t.projectSwitcher.switchProject,title:t.projectSwitcher.switchProject,children:[(0,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:e.name}),(0,$.jsx)(`span`,{className:b(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,Ti(e.status)),children:W(e)})]}),(0,$.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:G(e)})]}),(0,$.jsx)(zt,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-data-[state=open]:rotate-180`,"aria-hidden":!0})]})}),(0,$.jsx)(Re,{children:(0,$.jsxs)(ln,{side:`bottom`,align:`start`,sideOffset:6,className:`z-[70] w-[min(26rem,calc(100vw-2rem))] overflow-hidden rounded-xl border border-edge bg-surface-overlay p-1.5 shadow-popover outline-none`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,$.jsxs)(`label`,{className:`relative block`,children:[(0,$.jsx)(nt,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`input`,{type:`search`,className:`h-9 w-full rounded-lg border border-edge bg-surface-base pl-9 pr-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:d,onChange:e=>f(e.target.value),placeholder:t.projectSwitcher.searchPlaceholder,"aria-label":t.projectSwitcher.searchPlaceholder})]}),(0,$.jsxs)(`div`,{className:`mt-1 max-h-[min(54vh,24rem)] overflow-y-auto pr-0.5 [scrollbar-gutter:stable]`,children:[(0,$.jsx)(`div`,{className:`px-2 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.current}),ae(e,!0),(0,$.jsx)(`div`,{className:`px-2 pb-1 pt-3 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.recent}),h?(0,$.jsx)(`div`,{className:`p-2 text-xs text-red-600 dark:text-red-400`,children:h}):null,p&&U.length===0?(0,$.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.loading}):null,!p&&U.length===0?(0,$.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.noMatches}):null,U.map(e=>ae(e,!1))]}),(0,$.jsxs)(`div`,{className:`mt-1 border-t border-edge-subtle pt-1`,children:[(0,$.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>ee(`new`),children:[(0,$.jsx)(_,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.newProject})]}),(0,$.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>ee(`directory`),children:[(0,$.jsx)(ke,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.openDirectory})]}),(0,$.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>{s(!1),a(`/projects`)},children:[(0,$.jsx)(en,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.manageProjects})]})]})]})})]}),(0,$.jsx)(N,{open:v,onOpenChange:e=>!P&&y(e),children:(0,$.jsxs)(A,{children:[(0,$.jsx)(E,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(j,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(32rem,calc(100vh-2rem))] w-[min(40rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float focus:outline-none`,children:[(0,$.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,$.jsx)(M,{className:`text-base font-semibold text-fg`,children:x===`directory`?t.projectSwitcher.createFromDirectoryTitle:n.createTitle}),(0,$.jsx)(O,{className:`mt-1 text-sm text-fg-muted`,children:x===`directory`?t.projectSwitcher.createFromDirectoryDescription:n.createDescription})]}),(0,$.jsxs)(`form`,{onSubmit:ne,className:`flex min-h-0 flex-1 flex-col`,children:[(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[R?(0,$.jsx)(`div`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:R}):null,(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,$.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.projectName}),(0,$.jsx)(`input`,{className:`min-h-10 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:C,onChange:e=>w(e.target.value),placeholder:`xopc`})]}),(0,$.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,$.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.workspaceRoot}),(0,$.jsx)(xn,{value:T,onChange:q,disabled:P,wd:r,placeholder:n.workspacePlaceholder,inputClassName:`min-h-10 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`}),(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.workspaceHint})]}),(0,$.jsx)(it,{checked:I,onChange:L,disabled:P})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,$.jsx)(k,{asChild:!0,children:(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:P,children:n.cancel})}),(0,$.jsxs)(Y,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:P||!(C.trim()||x===`directory`&&ji(T)),children:[(0,$.jsx)(_,{className:`size-4`,"aria-hidden":!0}),n.create]})]})]})]})]})}),(0,$.jsx)(N,{open:!!B,onOpenChange:e=>{e||V(null)},children:(0,$.jsxs)(A,{children:[(0,$.jsx)(E,{className:`xopc-dialog-overlay fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(j,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[110] flex w-[min(30rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float focus:outline-none`,children:[(0,$.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,$.jsx)(M,{className:`text-base font-semibold text-fg`,children:n.workspaceMissingTitle}),(0,$.jsx)(O,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:B?Ci(n.workspaceMissingDescription,{workspace:B}):null})]}),B?(0,$.jsx)(`div`,{className:`px-5 py-4`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-inset px-3 py-2 text-sm text-fg-muted`,children:[(0,$.jsx)(ke,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:B})]})}):null,(0,$.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:ie,disabled:P,children:n.workspaceMissingBack}),(0,$.jsxs)(Y,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:re,disabled:P,children:[(0,$.jsx)(xt,{className:`size-4`,"aria-hidden":!0}),n.workspaceMissingCreate]})]})]})]})})]})}function Hi(){let{projectId:e=``,tabId:t,noteId:n}=o(),r=i(),[c]=a(),l=w(e=>e.language),d=y(l),f=d.chat.workingDirectory,x=d.projectDetailPage,S=d.projectsPage,C=he(e=>e.setPageHeader),T=he(e=>e.clearPageHeader),[D,L]=(0,Q.useState)(null),B=(0,Q.useRef)(D);(0,Q.useLayoutEffect)(()=>{B.current=D},[D]);let[V,H]=(0,Q.useState)(null),[W,ee]=(0,Q.useState)([]),[te,ne]=(0,Q.useState)(``),[K,re]=(0,Q.useState)([]),[ie,q]=(0,Q.useState)(0),[oe,se]=(0,Q.useState)(!1),[ce,le]=(0,Q.useState)(!1),[ue,fe]=(0,Q.useState)(!1),[pe,J]=(0,Q.useState)([]),[_e,be]=(0,Q.useState)(null),Ce=(0,Q.useRef)(new Set),[Ee,Oe]=(0,Q.useState)(null),[Le,Re]=(0,Q.useState)(null),[Be,Ve]=(0,Q.useState)(null),[We,Ze]=(0,Q.useState)(bi),[Qe,et]=(0,Q.useState)(!1),[tt,it]=(0,Q.useState)(!1),[at,ct]=(0,Q.useState)(``),[ut,dt]=(0,Q.useState)([]),[mt,ht]=(0,Q.useState)(!1),[_t,yt]=(0,Q.useState)(null),[bt,St]=(0,Q.useState)(!1),[Ct,Tt]=(0,Q.useState)(null),[At,jt]=(0,Q.useState)([]),[Mt,Nt]=(0,Q.useState)(``),[Pt,Ft]=(0,Q.useState)(!0),[It,Lt]=(0,Q.useState)(!1),[zt,Ut]=(0,Q.useState)(!1),[Wt,Gt]=(0,Q.useState)(null),[qt,Yt]=(0,Q.useState)(!1),[Zt,Qt]=(0,Q.useState)(`fixed`),[$t,nn]=(0,Q.useState)(``),[an,on]=(0,Q.useState)(null),[ln,un]=(0,Q.useState)(!1),[gn,vn]=(0,Q.useState)(!1),[Sn,Cn]=(0,Q.useState)(!1),[wn,Tn]=(0,Q.useState)(null),Dn=(0,Q.useRef)(null),On=(0,Q.useRef)(!1),[kn,X]=(0,Q.useState)(null),[jn,Mn]=(0,Q.useState)({title:``,reason:``}),[Nn,Pn]=(0,Q.useState)({name:``,description:``,status:`active`,defaultAgentId:``,executionMode:`local_checkout`,workspaceRoot:``,brief:``,instructions:``}),Fn=(0,Q.useRef)(Nn),In=`overview`,Z=n?`notes`:Si(t)?t:In,Ln=(0,Q.useMemo)(()=>g(c.get(`returnTo`),`/projects`,[`/chat`]),[c]),Rn=(0,Q.useCallback)(t=>{if(!e)return`/projects`;let n=`/projects/${encodeURIComponent(e)}/${t}`;return Ln===`/projects`?n:m(n,Ln)},[Ln,e]),zn=(0,Q.useCallback)(t=>{e&&r(Rn(t))},[r,e,Rn]),Bn=(0,Q.useCallback)(()=>{if(Z===`tasks`&&Dn.current){Dn.current.openCreate();return}On.current=!0,zn(`tasks`)},[zn,Z]);(0,Q.useEffect)(()=>{Z!==`tasks`||!On.current||(On.current=!1,Dn.current?.openCreate())},[Z]);let Vn=(0,Q.useCallback)(t=>{e&&r(Rn(t),{replace:!0})},[r,e,Rn]),Hn=(0,Q.useCallback)(e=>t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||Vn(e)},[Vn]),Un=(0,Q.useCallback)(e=>e.startsWith(`/chat/`)?`sessions`:e.startsWith(`/notes`)?`notes`:Z,[Z]);(0,Q.useEffect)(()=>{!e||!t||Si(t)||r(Rn(In),{replace:!0})},[In,r,e,Rn,t]),(0,Q.useEffect)(()=>{if(!e)return;let t=!1;return Ft(!0),X(null),Promise.all([$e(e),rt(e),Pe(e),z().catch(()=>null),fn(e).catch(()=>null)]).then(([e,n,r,i,a])=>{if(t)return;L(e),H(n),ee(r),be(a),jt(i?.agents??[]),Nt(e.defaultAgentId??``);let o=Mr(e);Fn.current=o,Pn(o)}).catch(e=>{t||(be(null),X(e instanceof Error?e.message:String(e)))}).finally(()=>{t||Ft(!1)}),()=>{t=!0}},[e]);let Wn=(0,Q.useCallback)(async()=>{e&&H(await rt(e))},[e]);(0,Q.useEffect)(()=>{if(Pt)return;let t=!0,n=0,r=r=>{let i=r.detail?.id;if(!e||i&&i!==e)return;let a=++n;Promise.all([$e(e),rt(e)]).then(([e,r])=>{if(!t||n!==a)return;let i=B.current;if(!(i?.id===e.id&&i.version>e.version)){if(i?.id===e.id){let t=Nr(Fn.current,i,e);Fn.current=t,Pn(t)}B.current=e,L(e),H(r)}}).catch(e=>{!t||n!==a||e instanceof Error&&`status`in e&&e.status===404&&(L(null),H(null),X(e.message))})};return window.addEventListener(`project-resource-changed`,r),r(new Event(`project-resource-changed`)),()=>{t=!1,window.removeEventListener(`project-resource-changed`,r)}},[e,Pt]),(0,Q.useEffect)(()=>{let t,n=n=>{let r=F.safeParse(n.detail);!r.success||r.data.projectId!==e||(window.clearTimeout(t),t=window.setTimeout(()=>void Wn(),120))},r=n=>{let r=P.safeParse(n.detail);!r.success||r.data.projectId!==e||(window.clearTimeout(t),t=window.setTimeout(()=>void Wn(),120))};return window.addEventListener(`task-changed-v2`,n),window.addEventListener(`task-deleted-v1`,r),()=>{window.clearTimeout(t),window.removeEventListener(`task-changed-v2`,n),window.removeEventListener(`task-deleted-v1`,r)}},[e,Wn]);let Gn=(0,Q.useCallback)(async(e,t)=>{Tn(e.id),X(null);try{let n=await Kt(e.id),r=t.startsWith(`move_`)?{type:`move`,phase:t.slice(5)}:t.startsWith(`reopen_`)?{type:`reopen`,phase:t.slice(7)}:t===`ready`?{type:`mark_ready`}:t===`run`?{type:`start`,executor:{kind:`agent`,agentId:n.task.delegateAgentId??(await st(e.id)).agentId}}:t===`pause`?{type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}:t===`review`?{type:`request_review`}:t===`complete`?{type:`close`,resolution:`done`}:t===`reopen`?{type:`reopen`,phase:`ready`}:{type:`resolve_wait`,waitId:n.waits[0]?.id??``};if(r.type===`resolve_wait`&&!r.waitId)throw Error(`No active wait to resolve`);return await Je(e.id,r,n.task.version),await Wn(),!0}catch(e){return await Wn().catch(()=>void 0),X(e instanceof Error?e.message:x.board.actionFailed),!1}finally{Tn(null)}},[V,x.board.actionFailed,Wn]),Kn=(0,Q.useCallback)(async t=>{e&&(X(null),await je({idempotencyKey:t.requestId,title:t.objective,projectId:e,priority:t.priority,dueAt:t.dueAt,locale:l,contract:{objective:t.objective,expectedOutputs:[],acceptanceCriteria:[],constraints:[],approvalRequired:[],assumptions:[],risks:[],acceptancePolicy:`manual`,outputDestinations:[]},dependencies:t.dependsOnTaskIds,context:t.attachments.map((e,t)=>({targetKind:`file`,targetId:e.uri??e.name??`attachment-${t+1}`,role:`input`,title:e.name,pinned:!0,retrievalPolicy:{},metadata:{mimeType:e.mimeType,size:e.size,data:e.data}})),authorityGrants:[],activation:{mode:`capture`,phase:`backlog`}}),await Wn())},[l,e,Wn]),qn=(0,Q.useCallback)(async(e,t)=>{Tn(e),X(null);try{return await Bt(e,t,(await Kt(e)).task.version),await Wn(),!0}catch(e){return await Wn().catch(()=>void 0),X(e instanceof Error?e.message:x.board.actionFailed),!1}finally{Tn(null)}},[x.board.actionFailed,Wn]),Jn=(0,Q.useCallback)(async(e,t,n)=>{Tn(e),X(null);try{let r=await Kt(e);return r.task.phase!==t&&(r=await Je(e,r.task.phase===`closed`?{type:`reopen`,phase:t===`closed`?`ready`:t}:t===`closed`?{type:`close`,resolution:`done`}:{type:`move`,phase:t},r.task.version)),await Bt(e,n,r.task.version),await Wn(),!0}catch(e){return await Wn().catch(()=>void 0),X(e instanceof Error?e.message:x.board.actionFailed),!1}finally{Tn(null)}},[x.board.actionFailed,Wn]),Yn=(0,Q.useCallback)(async(e,t)=>{Tn(e),X(null);try{await kt(e,t,(await Kt(e)).task.version),await Wn()}catch(e){await Wn().catch(()=>void 0),X(e instanceof Error?e.message:x.board.actionFailed)}finally{Tn(null)}},[x.board.actionFailed,Wn]),Xn=(0,Q.useCallback)(async()=>{if(D){se(!0),X(null);try{let e=await sn(D.id,{includeRelated:ce,limit:100});re(e.items),q(e.total)}catch(e){X(e instanceof Error?e.message:String(e))}finally{se(!1)}}},[D,ce]);(0,Q.useEffect)(()=>{Z===`progress`&&Xn()},[Xn,Z]);let Zn=(0,Q.useCallback)(async()=>{if(!D?.effectiveWorkspaceRoot?.trim()){J([]),Ce.current.clear(),Tt(null);return}St(!0),Tt(null),Ce.current.clear();try{J(zi((await hn(D.id,``)).entries)),Ce.current.add(``)}catch(e){J([]),Ce.current.clear(),Tt(e instanceof Error?e.message:String(e))}finally{St(!1)}},[D]),Qn=(0,Q.useCallback)(async e=>{if(!(!D?.effectiveWorkspaceRoot?.trim()||Ce.current.has(e))){Ce.current.add(e),Tt(null);try{let t=await hn(D.id,e);J(n=>Bi(n,e,zi(t.entries)))}catch(t){Ce.current.delete(e),Tt(t instanceof Error?t.message:String(t))}}},[D]),$n=(0,Q.useCallback)(async e=>{if(!D?.effectiveWorkspaceRoot?.trim())return;let t=zi((await hn(D.id,e)).entries);J(e?n=>Bi(n,e,t):t),Ce.current.add(e)},[D]);(0,Q.useEffect)(()=>{Z===`files`&&Zn()},[Zn,Z]);let er=at.trim();(0,Q.useEffect)(()=>{if(Z!==`files`||!D||!tt||!er){dt([]),ht(!1),yt(null);return}let e=!1;ht(!0),yt(null),dt([]);let t=window.setTimeout(()=>{ae(D.id,er,50).then(t=>{e||dt(t)}).catch(t=>{e||yt(t instanceof Error?t.message:String(t))}).finally(()=>{e||ht(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[er,D,tt,Z]);let tr=(0,Q.useCallback)(async()=>{if(!D)return;let[e,t]=await Promise.all([$e(D.id),rt(D.id)]);H(t),L(e)},[D]),nr=(0,Q.useCallback)(async e=>{if(e.preventDefault(),!(!D||!jn.title.trim())){vn(!0),X(null);try{await gt(D.id,{title:jn.title.trim(),reason:jn.reason.trim()||void 0}),Mn({title:``,reason:``}),Cn(!1),await tr()}catch(e){X(e instanceof Error?e.message:String(e))}finally{vn(!1)}}},[jn.reason,jn.title,D,tr]),rr=(0,Q.useMemo)(()=>(0,$.jsx)(s,{to:Ln,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":Ln===`/projects`?x.backToProjects:d.sidebar.back,children:(0,$.jsx)(U,{className:`size-4`,"aria-hidden":!0})}),[Ln,d.sidebar.back,x.backToProjects]),ir=(0,Q.useMemo)(()=>D?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(An,{resource:{kind:`project`,id:D.id,revision:String(D.version)},disabled:It||vi(Nn,D)}),(0,$.jsx)(yr,{projectId:D.id},D.id),(0,$.jsxs)(Y,{variant:`secondary`,className:`h-9 rounded-lg`,onClick:Bn,children:[(0,$.jsx)(_,{className:`size-4`,"aria-hidden":!0}),x.board.create]}),(0,$.jsx)(Y,{asChild:!0,variant:`primary`,className:`h-9 rounded-lg`,children:(0,$.jsxs)(s,{to:Rt(D.id),state:{forceNewChat:!0,agentId:D.defaultAgentId},onClick:Hn(`sessions`),children:[(0,$.jsx)(He,{className:`size-4`,"aria-hidden":!0}),x.common.newChat]})})]}):null,[Bn,Hn,x.board.create,x.common.newChat,D,It,Nn]);(0,Q.useLayoutEffect)(()=>(C({startExtra:rr,main:D?(0,$.jsx)(Vi,{currentProject:D,pm:x,projectsText:S,wd:f}):(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:x.fallbackTitle}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:x.fallbackContext})]}),end:ir}),()=>T()),[T,ir,rr,x,D,S,C,f]);function ar(e){L(t=>t?{...t,...e}:null),Nt(e.defaultAgentId??``),fn(e.id).then(be).catch(()=>be(null)),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}async function or(e=Fn.current){if(!(!D||!vi(e,D))){X(null),Gt(null);try{let t=await wt(D.id,{name:e.name.trim(),status:e.status,description:e.description,defaultAgentId:e.defaultAgentId,executionMode:e.executionMode,brief:e.brief,instructions:e.instructions},D.version);ar(t);let n=Fn.current,r={...n,name:n.name===e.name?t.name:n.name,description:n.description===e.description?t.description??``:n.description,status:n.status===e.status?t.status:n.status,defaultAgentId:n.defaultAgentId===e.defaultAgentId?t.defaultAgentId??``:n.defaultAgentId,executionMode:n.executionMode===e.executionMode?t.executionMode:n.executionMode,brief:n.brief===e.brief?t.brief??``:n.brief,instructions:n.instructions===e.instructions?t.instructions??``:n.instructions};Fn.current=r,Pn(r)}catch(e){let t=Mi(e);throw t?Gt(t):X(e instanceof Error?e.message:String(e)),e}}}function sr(e){e.preventDefault(),Tr.flush()}function cr(e,t=!1){let n={...Fn.current,...e};Fn.current=n,Pn(n),t&&Tr.saveNow(n)}let lr=(0,Q.useCallback)(()=>{if(!D)return;let e=D.workspaceRoot?.trim()??``;Qt(e?`fixed`:`follow`),nn(e||D.effectiveWorkspaceRoot||``),Yt(!0)},[D]);async function ur(e={}){if(!D)return;let t=Zt===`fixed`?$t.trim():``;if(!(Zt===`fixed`&&!t)){Lt(!0),X(null),Gt(null);try{let n=await wt(D.id,{workspaceRoot:t,...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}},D.version);ar(n),cr({workspaceRoot:n.workspaceRoot??``}),Yt(!1),Gt(null)}catch(e){let t=Mi(e);t?(Gt(t),Yt(!1)):X(e instanceof Error?e.message:String(e))}finally{Lt(!1)}}}async function dr(){if(!(!D||an)){on(`pin`),X(null);try{ar(D.pinnedAt?await Ae(D.id,D.version):await cn(D.id,D.version))}catch(e){X(e instanceof Error?e.message:String(e))}finally{on(null)}}}async function fr(){if(!(!D||an)){on(`archive`),X(null);try{let e=D.status===`archived`?await Ie(D.id,D.version):await Vt(D.id,D.version);ar(e),cr({status:e.status})}catch(e){X(e instanceof Error?e.message:String(e))}finally{on(null)}}}async function pr(){if(D){un(!0),X(null);try{await pt(D.id,D.version),Ut(!1),r(`/projects`)}catch(e){X(e instanceof Error?e.message:String(e))}finally{un(!1)}}}async function mr(){if(!(!D||ue)){fe(!0),X(null);try{await de(D.id)}catch(e){X(e instanceof Error?e.message:String(e))}finally{fe(!1)}}}let hr=(0,Q.useCallback)(e=>{Oe(e)},[]),gr=(0,Q.useCallback)((e,t)=>{t||Oe(e)},[]),vr=(0,Q.useCallback)(async(e,t,n)=>{let r=D?.id;if(r)switch(e){case`preview`:t.isDirectory||Oe(t.path);break;case`download`:if(t.isDirectory)return;try{let e=G(t.path);if(ge(_n(e))!==`text`){let n=await xe(t.path,{projectId:r}),i=R(e)??`application/octet-stream`;Ue(e,await n.arrayBuffer(),i)}else{let{content:n}=await Ht(t.path,{projectId:r});me(e,n)}}catch(e){Xe(`warning`,e instanceof Error?e.message:String(e),void 0,{duration:4e3})}break;case`copyPath`:try{await I(t.path)&&Xe(`success`,d.workspace.pathCopied,void 0,{duration:2500})}catch{Xe(`warning`,d.clipboard.copyFailed,void 0,{duration:4e3})}break;case`openDefault`:await Ot(()=>window.electronAPI?.shell?.openFileResource?.(t.fileId),d.workspace.openFileFailed);break;case`openWith`:await Ot(()=>window.electronAPI?.shell?.chooseAppAndOpenFileResource?.(t.fileId),d.workspace.openFileFailed);break;case`openWithApp`:if(!n)return;await Ot(()=>window.electronAPI?.shell?.openFileResourceWithApp?.(t.fileId,n),d.workspace.openFileFailed);break;case`revealInFolder`:await Ot(()=>window.electronAPI?.shell?.showFileResourceInFolder?.(t.fileId),d.workspace.revealFileFailed);break;case`trash`:Re(t);break;case`delete`:t.isDirectory||Ve(t);break;default:break}},[d.clipboard.copyFailed,d.workspace.openFileFailed,d.workspace.pathCopied,d.workspace.revealFileFailed,D?.id]),br=(0,Q.useCallback)(async()=>{let e=Le;if(!e)return;let t=await window.electronAPI?.shell?.trashFileResource?.(e.fileId);if(!t?.ok){Xe(`warning`,t?.error??d.workspace.trashFailed,void 0,{duration:4e3});return}Ee===e.path&&Oe(null),Re(null),await Zn(),Xe(`success`,d.workspace.trashSuccess,void 0,{duration:2500})},[d.workspace.trashFailed,d.workspace.trashSuccess,Le,Ee,Zn]),xr=(0,Q.useCallback)(async(e,t)=>{let n=D?.id;if(n)try{await Promise.all(e.map(e=>ve(e,t,{projectId:n}))),await $n(t).catch(()=>void 0),Xe(`success`,d.workspace.uploadSuccess.replace(`{{count}}`,String(e.length)),void 0,{duration:2500})}catch(e){await $n(t).catch(()=>void 0),Xe(`warning`,`${d.workspace.uploadFailed}: ${e instanceof Error?e.message:String(e)}`,void 0,{duration:4e3})}},[d.workspace.uploadFailed,d.workspace.uploadSuccess,D?.id,$n]),Sr=(0,Q.useCallback)(async()=>{let e=Be;if(e)try{await ze(e.fileId),Ee===e.path&&Oe(null),Ve(null);let t=e.path.lastIndexOf(`/`);await $n(t<0?``:e.path.slice(0,t)).catch(()=>void 0),Xe(`success`,d.workspace.deleteSuccess,void 0,{duration:2500})}catch(e){Xe(`warning`,`${d.workspace.deleteFailed}: ${e instanceof Error?e.message:String(e)}`,void 0,{duration:4e3})}},[d.workspace.deleteFailed,d.workspace.deleteSuccess,Be,Ee,$n]),Cr=(0,Q.useCallback)(e=>{if(!window.matchMedia(`(min-width: 1024px)`).matches)return;e.preventDefault();let t=e.currentTarget,n=t.closest(`[data-project-files-grid]`);if(!n)return;t.setPointerCapture(e.pointerId),et(!0);let r=e.clientX,i=We,a=e.pointerId,o=0,s=i,c=i,l=()=>{o=0,c=s,n.style.setProperty(`--project-files-panel-width`,`${c}px`)},u=e=>{s=yi(i+(e.clientX-r)),o===0&&(o=window.requestAnimationFrame(l))},d=()=>{o!==0&&(window.cancelAnimationFrame(o),l());try{t.releasePointerCapture(a)}catch{}et(!1),Ze(c),xi(c),window.removeEventListener(`pointermove`,u),window.removeEventListener(`pointerup`,d),window.removeEventListener(`pointercancel`,d)};window.addEventListener(`pointermove`,u),window.addEventListener(`pointerup`,d),window.addEventListener(`pointercancel`,d)},[We]);(0,Q.useEffect)(()=>{Z!==`files`&&Oe(null)},[e,Z]);let wr=!!(D&&vi(Nn,D)),Tr=bn({value:D?Nn:null,dirty:wr,onSave:or,validate:e=>e.name.trim()?null:x.settings.nameRequired});if(Pt)return(0,$.jsx)(`main`,{className:`w-full flex-1 p-3 text-sm text-fg-muted sm:px-5 sm:py-4 xl:px-6`,children:x.loading});if(!D)return(0,$.jsxs)(`main`,{className:`w-full flex-1 p-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,$.jsxs)(s,{to:Ln,className:`inline-flex items-center gap-2 text-sm text-accent-fg hover:underline`,children:[(0,$.jsx)(U,{className:`size-4`,"aria-hidden":!0}),Ln===`/projects`?x.backToProjects:d.sidebar.back]}),(0,$.jsx)(`p`,{className:`mt-6 rounded-lg bg-surface-panel p-4 shadow-surface text-sm text-fg-muted`,children:kn||x.notFound})]});let Er=W.slice(0,3),Or=V?.blockers??[],kr=Lr(V?.tasks??[]),Ar=V?.tasks.filter(e=>[`queued`,`running`,`waiting`,`verifying`].includes(e.operationalState)).length??0,jr=e=>x.statuses[e]??e,Pr=e=>Ci(x.common.messages,{count:e}),Fr=te.trim().toLowerCase(),Ir=Fr?W.filter(e=>{let t=wi(e.updatedAt),n=e.routing?.agentId||e.agentId||x.common.agent,r=e.name?.trim()||x.sessions.fallbackTitle,i=Pr(e.messageCount??0),a=Ii(e);return[r,e.key,n,a,t,i].filter(Boolean).join(` `).toLowerCase().includes(Fr)}):W,Rr=W.length>0&&Ir.length===0,zr=At.find(e=>e.id===D.defaultAgentId)?.name||D.defaultAgentId||x.settings.globalDefaultAgent,Br=At.find(e=>e.id===Nn.defaultAgentId),Vr=D.workspaceRoot?.trim()||``,Hr=D.status===`archived`,Ur=!!D.pinnedAt,Wr=!Vr,Gr=Vr||Br?.workspace||D.effectiveWorkspaceRoot||x.common.defaultWorkspace,Kr=Zt===`fixed`?$t.trim()||x.settings.workspacePlaceholder:Br?.workspace||D.effectiveWorkspaceRoot||x.common.defaultWorkspace,qr=(Zt===`fixed`?$t.trim():``)!==Vr&&(Zt===`follow`||!!$t.trim()),Jr=[{id:`overview`,icon:Jt,label:x.tabs.overview},{id:`tasks`,icon:Se,label:x.tabs.tasks},{id:`automations`,icon:dn,label:x.tabs.automations},{id:`files`,icon:ke,label:x.tabs.files},{id:`notes`,icon:Te,label:x.tabs.notes},{id:`skills`,icon:ye,label:x.tabs.skills},{id:`sessions`,icon:He,label:x.tabs.sessions},{id:`progress`,icon:mn,label:x.tabs.progress}];async function Yr(){if(!Gr)return;let e=await I(Gr);Xe(e?`success`:`warning`,e?d.workspace.pathCopied:d.clipboard.copyFailed,void 0,{duration:e?2500:4e3})}function Xr(){Gt(null),Yt(!0)}return(0,$.jsxs)(`main`,{className:`flex h-full min-h-0 w-full flex-1 flex-col overflow-hidden p-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,$.jsx)(`div`,{className:`flex shrink-0 items-start justify-between gap-3`,children:(0,$.jsx)(vt,{items:[...Jr,{id:`settings`,icon:en,label:x.tabs.settings,suffix:wr?(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-amber-500`,"aria-label":x.settings.unsavedChanges}):void 0}],activeTab:Z,onChange:zn,ariaLabel:x.navAria,tabIdPrefix:`project-primary-tab`,className:`min-w-0 flex-1`})}),kn?(0,$.jsx)(`p`,{className:`mt-3 shrink-0 rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:kn}):null,(0,$.jsxs)(`div`,{className:b(`mt-3 min-h-0 flex-1`,Z===`overview`?`overflow-y-auto pr-1 [scrollbar-gutter:stable] xl:overflow-hidden xl:pr-0`:Z===`tasks`?`overflow-hidden`:`overflow-y-auto pr-1 [scrollbar-gutter:stable]`),children:[Z===`overview`?(0,$.jsxs)(`section`,{id:`project-panel-overview`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-overview`,className:`grid min-h-full gap-4 xl:h-full xl:min-h-0 xl:grid-cols-[minmax(0,1fr)_20rem] xl:overflow-hidden`,children:[(0,$.jsxs)(`div`,{className:`grid min-w-0 content-start gap-4 xl:min-h-0 xl:overflow-y-auto xl:pr-1 xl:[scrollbar-gutter:stable]`,children:[(0,$.jsx)(Et,{projectId:D.id},D.id),(0,$.jsxs)(`div`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel shadow-surface`,children:[(0,$.jsx)(`div`,{className:`p-5`,children:(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.overview.directionTitle}),(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:Ci(x.overview.activitySummary,{moving:Ar,attention:Or.length})})]}),(0,$.jsx)(`p`,{className:`mt-2 max-w-3xl text-base font-medium leading-7 text-fg`,children:D.outcome||D.description||D.brief||x.overview.directionFallback}),V?.digest.recommendedAction?(0,$.jsx)(`p`,{className:`mt-3 max-w-3xl rounded-lg bg-surface-hover px-3 py-2.5 text-sm font-medium leading-6 text-fg`,children:Ci(x.overview.recommendedNext,{action:V.digest.recommendedAction})}):null]}),(0,$.jsxs)(Y,{type:`button`,variant:`ghost`,className:`h-8 shrink-0 rounded-lg px-2 text-xs`,onClick:()=>void mr(),disabled:ue,children:[(0,$.jsx)(Xt,{className:`size-3.5`,"aria-hidden":!0}),ue?x.overview.savingDigest:x.overview.saveDigest]})]})}),(0,$.jsxs)(`div`,{className:`border-t border-edge-subtle`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-5 py-3.5`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.overview.nextActions}),(0,$.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-fg-muted transition-colors hover:text-fg`,onClick:()=>zn(`tasks`),children:x.common.viewAll})]}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle border-t border-edge-subtle`,children:kr.length?kr.map(e=>(0,$.jsxs)(s,{to:p(Rn(`overview`),e.id),className:`block px-5 py-3 transition-colors hover:bg-surface-hover`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,$.jsxs)(`span`,{className:b(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,e.attention.length?`bg-warning/10 text-warning`:`bg-surface-hover text-fg-muted`),children:[x.board.phases[e.phase],e.operationalState===`idle`?``:` · ${x.board.operationalStates[e.operationalState]}`]})]}),e.attention[0]?(0,$.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:e.attention[0].summary}):null]},e.id)):(0,$.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:x.overview.noNextActions})})]})]}),V?.recentResults.length?(0,$.jsxs)(`div`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel`,children:[(0,$.jsx)(`div`,{className:`border-b border-edge-subtle px-5 py-3.5`,children:(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.overview.recentResults})}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:V.recentResults.slice(0,3).map(({taskId:e,taskTitle:t,receipt:n})=>(0,$.jsxs)(s,{to:p(Rn(`overview`),e),className:`block px-5 py-3 transition-colors hover:bg-surface-hover`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),(0,$.jsxs)(`span`,{className:`shrink-0 rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:[x.overview.resultStatuses[n.status],` · `,x.board.verification[n.verification.status]]})]}),(0,$.jsx)(`div`,{className:`mt-1 line-clamp-3 text-sm leading-5 text-fg-muted`,children:(0,$.jsx)(h,{content:n.summary,compact:!0})})]},n.runId))})]}):null,D.milestones.length||D.recentUpdates.length?(0,$.jsxs)(`div`,{className:`grid min-w-0 gap-4 md:grid-cols-2`,children:[D.milestones.length?(0,$.jsxs)(`div`,{className:`overflow-hidden rounded-xl bg-surface-panel`,children:[(0,$.jsx)(`div`,{className:`border-b border-edge-subtle px-5 py-3.5`,children:(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.overview.milestones})}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:D.milestones.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-5 py-3`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:x.statuses[e.status]})]},e.id))})]}):null,D.recentUpdates.length?(0,$.jsxs)(`div`,{className:`overflow-hidden rounded-xl bg-surface-panel`,children:[(0,$.jsx)(`div`,{className:`border-b border-edge-subtle px-5 py-3.5`,children:(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.overview.projectUpdates})}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:D.recentUpdates.slice(0,3).map(e=>(0,$.jsxs)(`div`,{className:`px-5 py-3`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-5 text-fg`,children:e.summary}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:x.overview.healthLabels[e.health]})]},e.id))})]}):null]}):null]}),(0,$.jsxs)(`aside`,{className:`grid min-w-0 content-start gap-4 xl:min-h-0 xl:overflow-y-auto xl:pr-1 xl:[scrollbar-gutter:stable]`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 rounded-xl bg-surface-panel p-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.overview.attention}),(0,$.jsxs)(Y,{type:`button`,variant:`ghost`,className:`h-8 shrink-0 rounded-lg px-2 text-xs`,"aria-expanded":Sn,onClick:()=>Cn(e=>!e),children:[(0,$.jsx)(_,{className:b(`size-3.5 transition-transform`,Sn&&`rotate-45`),"aria-hidden":!0}),x.overview.addBlocker]})]}),Or.length?(0,$.jsx)(`div`,{className:`mt-3 grid gap-3`,children:Or.map(e=>{let t=(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(tn,{className:`size-4 text-amber-600 dark:text-amber-300`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title})]}),(0,$.jsxs)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:[x.overview.attentionKinds[e.kind]??e.kind,e.detail?` · ${e.detail}`:e.status?` · ${jr(e.status)}`:``]})]});return e.href?(0,$.jsx)(s,{to:e.href,onClick:Hn(Un(e.href)),className:`min-w-0 rounded-md bg-surface-base p-3 hover:bg-surface-hover`,children:t},e.id):(0,$.jsx)(`div`,{className:`min-w-0 rounded-md bg-surface-base p-3`,children:t},e.id)})}):(0,$.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:x.overview.noBlockedTasks}),Sn?(0,$.jsxs)(`form`,{onSubmit:nr,className:`mt-4 flex gap-2 border-t border-edge-subtle pt-4`,children:[(0,$.jsx)(`input`,{className:`min-h-9 min-w-0 flex-1 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:jn.title,onChange:e=>Mn(t=>({...t,title:e.target.value})),placeholder:x.overview.blockerTitlePlaceholder}),(0,$.jsx)(Y,{type:`submit`,variant:`secondary`,className:`shrink-0 rounded-lg px-3`,disabled:gn||!jn.title.trim(),"aria-label":gn?x.overview.addingBlocker:x.overview.addBlocker,title:gn?x.overview.addingBlocker:x.overview.addBlocker,children:(0,$.jsx)(_,{className:`size-4`,"aria-hidden":!0})})]}):null]}),(0,$.jsxs)(`div`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge-subtle px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(Ye,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:x.overview.recentSessions})]}),(0,$.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,onClick:()=>zn(`sessions`),children:x.common.viewAll})]}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:Er.length?Er.map(e=>(0,$.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:Hn(`sessions`),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.name||e.key}),(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:wi(e.updatedAt)})]}),(e.routing?.agentId||e.agentId)&&(e.routing?.agentId||e.agentId)!==D.defaultAgentId?(0,$.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:e.routing?.agentId||e.agentId}):null]},e.key)):(0,$.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:x.overview.noSessions})})]})]})]}):null,Z===`tasks`?(0,$.jsx)(fi,{ref:Dn,tasks:V?.tasks??[],dependencyEdges:V?.dependencyEdges??[],returnTo:Rn(`tasks`),copy:x.board,onAction:Gn,onReorder:qn,onUndoMove:Jn,onDependenciesChange:Yn,onCreate:Kn,actionBusyId:wn}):null,Z===`automations`?(0,$.jsx)(`section`,{id:`project-panel-automations`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-automations`,className:`grid min-h-full content-start gap-4`,children:(0,$.jsx)(En,{projectId:D.id,embedded:!0,title:x.automations.title,subtitle:x.automations.hint})}):null,Z===`notes`?(0,$.jsx)(`section`,{id:`project-panel-notes`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-notes`,className:`flex h-full min-h-[28rem] overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:(0,$.jsx)(_r,{selectedNoteId:n,basePath:`/projects/${encodeURIComponent(D.id)}/notes`,showLibrary:!1,allowMediaCapture:!1,projectId:D.id,listTitle:x.notes.title,listDescription:x.notes.hint,emptyText:x.notes.emptyTitle,emptyDescription:x.notes.emptyDescription,listWidthStorageKey:`xopc.projectNotes.listWidth.${D.id}`})}):null,Z===`skills`?(0,$.jsx)(Dr,{projectId:D.id,copy:x.skills}):null,Z===`files`?(0,$.jsx)(`section`,{id:`project-panel-files`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-files`,className:`flex h-full min-h-[28rem] flex-col`,children:(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl bg-surface-panel`,children:D.effectiveWorkspaceRoot?(0,$.jsxs)(`div`,{"data-project-files-grid":!0,className:b(`grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[var(--project-files-panel-width)_8px_minmax(0,1fr)]`,Qe&&`cursor-col-resize select-none`),style:{"--project-files-panel-width":`${We}px`},children:[(0,$.jsxs)(`aside`,{className:`flex min-h-0 flex-col border-b border-edge bg-surface-panel lg:border-b-0`,children:[(0,$.jsxs)(`div`,{className:`flex h-11 items-center gap-1 bg-surface-hover/30 px-3 text-sm`,children:[_e?(0,$.jsx)(lt,{resourceId:_e.fileId,displayName:_e.name}):null,(0,$.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,className:b(`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,tt&&`bg-surface-hover text-fg`),onClick:()=>it(!0),"aria-label":x.files.search,title:x.files.search,"aria-pressed":tt,children:(0,$.jsx)(nt,{className:`size-3.5`,"aria-hidden":!0})}),(0,$.jsx)(Ge,{className:`size-7 shrink-0 rounded-md p-0`,loading:bt,label:d.cron.refresh,onClick:()=>void Zn()})]})]}),tt?(0,$.jsx)(`div`,{className:`shrink-0 bg-surface-hover/20 px-3 py-2`,children:(0,$.jsxs)(`div`,{className:`flex h-8 items-center gap-2 rounded-md bg-surface-base px-2 focus-within:ring-2 focus-within:ring-accent/30`,children:[(0,$.jsx)(nt,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`input`,{type:`text`,role:`searchbox`,value:at,onChange:e=>ct(e.target.value),placeholder:x.files.searchPlaceholder,"aria-label":x.files.searchPlaceholder,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none placeholder:text-fg-subtle`}),(0,$.jsx)(`button`,{type:`button`,className:`flex size-6 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":x.files.clearSearch,title:x.files.clearSearch,onClick:()=>{ct(``),it(!1)},children:(0,$.jsx)(v,{className:`size-3.5`,"aria-hidden":!0})})]})}):null,Ct?(0,$.jsx)(`div`,{className:`bg-red-500/10 px-4 py-3 text-sm text-red-700 dark:text-red-300`,children:Ct}):null,er?(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-2`,children:mt?(0,$.jsxs)(`div`,{className:`space-y-2 px-3 py-1`,children:[(0,$.jsx)(Me,{className:`h-11 w-full`}),(0,$.jsx)(Me,{className:`h-11 w-full`}),(0,$.jsx)(Me,{className:`h-11 w-full`})]}):_t?(0,$.jsxs)(`p`,{className:`px-3 py-2 text-xs text-red-600 dark:text-red-400`,children:[d.workspace.loadError,`: `,_t]}):ut.length===0?(0,$.jsx)(`p`,{className:`px-3 py-2 text-xs text-fg-muted`,children:x.files.noSearchResults}):ut.map(e=>(0,$.jsxs)(`button`,{type:`button`,className:b(`flex w-full min-w-0 items-center gap-2 px-3 py-2 text-left hover:bg-surface-hover`,Ee===e.path&&`bg-accent-soft text-accent-fg`),onClick:()=>Oe(e.path),title:e.path,children:[(0,$.jsx)(Te,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`block truncate text-sm text-fg`,children:e.name}),(0,$.jsx)(`span`,{className:`block truncate text-xs text-fg-subtle`,children:e.path})]})]},e.path))}):bt&&pe.length===0?(0,$.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:x.files.loading}):(0,$.jsx)(Ke,{tree:pe,selectedPath:Ee,onSelectFile:hr,onSelectEntry:gr,onExpandDir:e=>void Qn(e),onAction:vr,onUploadFiles:(e,t)=>void xr(e,t),uploadDropHint:d.workspace.dropToUpload,actionLabels:{preview:d.workspace.preview,download:d.workspace.download,copyPath:d.workspace.copyPath,openDefault:d.workspace.openSystemApp,openDirectory:d.workspace.openInFileManager,openWith:d.workspace.openWith,revealInFolder:d.workspace.revealInFolder,trash:d.workspace.moveToTrash,delete:d.workspace.deleteFile,recommendedApps:d.workspace.recommendedApps,desktopUpdateRequired:d.workspace.desktopUpdateRequired},emptyHint:x.files.emptyDirectory})]}),(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":x.files.resizeHandle,className:b(`group hidden cursor-col-resize touch-none items-stretch justify-center bg-transparent transition-colors hover:bg-surface-hover/60 lg:flex`,Qe&&`bg-surface-hover/70`),onPointerDown:Cr,children:(0,$.jsx)(`div`,{className:b(`my-3 w-px rounded-full bg-transparent transition-colors`,`group-hover:bg-edge-strong/55`,Qe&&`bg-accent/60`)})}),(0,$.jsx)(`div`,{className:`min-h-0 min-w-0 overflow-hidden bg-surface-base`,children:Ee?(0,$.jsx)(Dt,{filePath:Ee,projectId:D.id,agentId:D.defaultAgentId||Mt||void 0,onClose:()=>Oe(null)}):(0,$.jsx)(`div`,{className:`flex h-full min-h-[18rem] items-center justify-center px-6 text-center`,children:(0,$.jsxs)(`div`,{className:`max-w-sm`,children:[(0,$.jsx)(ke,{className:`mx-auto size-8 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:x.files.previewEmptyTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:x.files.previewEmptyDescription})]})})})]}):(0,$.jsxs)(`div`,{className:`grid gap-3 px-4 py-8 text-sm text-fg-muted`,children:[(0,$.jsx)(`p`,{children:x.files.needWorkspace}),(0,$.jsx)(`div`,{children:(0,$.jsx)(Y,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>zn(`settings`),children:x.files.openSettings})})]})})}):null,Z===`sessions`?(0,$.jsxs)(`section`,{id:`project-panel-sessions`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-sessions`,className:`grid min-h-full content-start gap-3`,children:[W.length?(0,$.jsxs)(`label`,{className:`relative flex min-h-9 w-full max-w-lg cursor-text items-center rounded-lg bg-surface-panel py-1.5 pl-9 pr-9 shadow-surface`,children:[(0,$.jsx)(nt,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,"aria-hidden":!0}),(0,$.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:te,onChange:e=>ne(e.currentTarget.value),placeholder:x.sessions.searchPlaceholder,"aria-label":x.sessions.searchPlaceholder,className:`min-w-0 flex-1 appearance-none border-0 bg-transparent py-0.5 text-sm leading-normal text-fg caret-current placeholder:text-fg-disabled focus:border-0 focus:shadow-none focus:outline-none focus:ring-0 focus-visible:outline-none`}),te?(0,$.jsx)(`button`,{type:`button`,className:`absolute right-2 top-1/2 inline-flex size-6 -translate-y-1/2 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":x.sessions.clearSearch,onClick:()=>ne(``),children:(0,$.jsx)(v,{className:`size-3.5`,"aria-hidden":!0})}):null]}):null,Ir.length?(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:Ir.map(e=>{let t=wi(e.updatedAt),n=e.routing?.agentId||e.agentId||x.common.agent,r=Ii(e),i=e.name?.trim()||x.sessions.fallbackTitle,a=Pr(e.messageCount??0);return(0,$.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:Hn(`sessions`),className:`group flex min-h-[8.75rem] min-w-0 flex-col rounded-lg bg-surface-panel p-4 shadow-surface transition-colors hover:bg-surface-hover/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,$.jsx)(`span`,{className:`mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-base text-fg-muted`,children:(0,$.jsx)(He,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-sm font-semibold text-fg`,children:i}),r?(0,$.jsx)(`span`,{className:`shrink-0 rounded-md bg-surface-base px-2 py-0.5 text-[11px] font-medium leading-5 text-fg-muted`,children:r}):null]})})]}),(0,$.jsxs)(`div`,{className:`mt-auto grid gap-2 pt-4 text-xs text-fg-muted`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`span`,{className:`min-w-0 max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[x.sessions.agent,`: `,n]}),(0,$.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:a})]}),t?(0,$.jsxs)(`span`,{className:`truncate rounded-md bg-surface-base px-2 py-1`,children:[x.sessions.updated,`: `,t]}):null]})]},e.key)})}):Rr?(0,$.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:x.sessions.noMatches})}):(0,$.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:x.sessions.emptyTitle}),(0,$.jsx)(`p`,{className:`mx-auto mt-1 max-w-md text-sm leading-6 text-fg-muted`,children:x.sessions.emptyDescription})]})})]}):null,Z===`progress`?(0,$.jsxs)(`section`,{id:`project-panel-progress`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-progress`,className:`grid min-h-full content-start gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.progress.title}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:Ci(x.progress.count,{count:ie})})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`label`,{className:`inline-flex min-h-9 items-center gap-2 rounded-lg bg-surface-panel px-3 text-sm text-fg-muted shadow-surface`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:ce,onChange:e=>le(e.currentTarget.checked),className:`size-4 rounded border-edge text-accent focus:ring-accent/30`}),x.progress.includeRelated]}),(0,$.jsxs)(Y,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3`,onClick:()=>void Xn(),disabled:oe,children:[(0,$.jsx)(rn,{className:b(`size-4`,oe&&`animate-spin`),"aria-hidden":!0}),x.common.refresh]})]})]}),(0,$.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:oe&&K.length===0?(0,$.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:x.progress.loading}):K.length?(0,$.jsx)(`div`,{className:`divide-y divide-edge`,children:K.map(e=>{let t=x.progress.types[e.type]??e.type,n=x.progress.objectKinds[e.primaryObject.kind]??e.primaryObject.kind,r=Ri(e),i=e.relatedProjects.length>0&&!e.scopes.some(e=>e.scopeKind===`project`&&e.scopeId===D.id);return(0,$.jsxs)(`article`,{className:`grid gap-2 px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),i?(0,$.jsx)(`span`,{className:`rounded-full bg-surface-inset px-2 py-0.5 text-xs font-medium text-fg-muted`,children:x.progress.related}):null]}),(0,$.jsxs)(`p`,{className:`mt-1 min-w-0 truncate text-sm text-fg-muted`,children:[n,`: `,Pi(e)]})]}),(0,$.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,dateTime:new Date(e.createdAt).toISOString(),children:wi(e.createdAt)})]}),r?(0,$.jsx)(`p`,{className:`line-clamp-2 text-sm leading-5 text-fg-muted`,children:r}):null,(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[(0,$.jsxs)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:[x.progress.actor,`: `,Ni(e)]}),(0,$.jsxs)(`span`,{className:`max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[x.progress.source,`: `,Fi(e)]})]})]},e.id)})}):(0,$.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:x.progress.empty})})]}):null,Z===`settings`?(0,$.jsxs)(`form`,{id:`project-panel-settings`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-settings`,onSubmit:sr,onBlurCapture:Tr.onBlurCapture,className:`grid min-h-full content-start gap-4 pb-1`,children:[(0,$.jsxs)(`section`,{className:`flex min-w-0 items-start justify-between gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.settings.summaryTitle}),(0,$.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:x.settings.summaryHint})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-2`,children:[(0,$.jsx)(`span`,{className:b(`rounded-full px-2 py-0.5 text-xs font-medium`,Ti(Nn.status)),children:x.settings.statuses[Nn.status]}),(0,$.jsx)(yn,{status:Tr.status,error:Tr.error})]})]}),(0,$.jsxs)(`div`,{className:`grid items-start gap-4 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,$.jsxs)(`div`,{className:`grid gap-4`,children:[(0,$.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.settings.detailsTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:x.settings.detailsHint})]}),(0,$.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,$.jsx)(Ei,{label:x.settings.name,children:(0,$.jsx)(`input`,{className:Di(),value:Nn.name,onChange:e=>cr({name:e.target.value})})}),(0,$.jsx)(Ei,{label:x.settings.defaultAgent,children:(0,$.jsxs)(ot,{className:Di(),value:Nn.defaultAgentId,onChange:e=>cr({defaultAgentId:e.target.value},!0),children:[(0,$.jsx)(ft,{value:``,children:x.settings.globalDefaultAgent}),At.map(e=>(0,$.jsx)(ft,{value:e.id,children:Ne(e,d.agentsSettings)},e.id))]})}),(0,$.jsx)(Ei,{label:x.settings.status,children:Hr?(0,$.jsx)(`div`,{className:`grid min-h-10 content-center rounded-md border border-edge bg-surface-inset px-3 text-sm text-fg-muted`,children:x.settings.statuses.archived}):(0,$.jsxs)(ot,{className:Di(),value:Nn.status===`archived`?`active`:Nn.status,onChange:e=>cr({status:e.target.value},!0),children:[(0,$.jsx)(ft,{value:`active`,children:x.settings.statuses.active}),(0,$.jsx)(ft,{value:`paused`,children:x.settings.statuses.paused})]})}),(0,$.jsx)(Ei,{label:x.settings.executionMode,hint:x.settings.executionModeHint,children:(0,$.jsxs)(ot,{className:Di(),value:Nn.executionMode,onChange:e=>cr({executionMode:e.target.value},!0),children:[(0,$.jsx)(ft,{value:`managed_worktree`,children:x.settings.executionModeWorktree}),(0,$.jsx)(ft,{value:`local_checkout`,children:x.settings.executionModeLocal})]})}),(0,$.jsx)(Ei,{label:x.settings.description,hint:x.settings.descriptionHint,children:(0,$.jsx)(`textarea`,{className:Di(!0),value:Nn.description,onChange:e=>cr({description:e.target.value})})})]})]}),(0,$.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.settings.projectGuidanceTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:x.settings.projectGuidanceHint})]}),(0,$.jsx)(Ei,{label:x.settings.brief,hint:x.settings.briefHint,children:(0,$.jsx)(`textarea`,{className:Di(!0),value:Nn.brief,onChange:e=>cr({brief:e.target.value})})}),(0,$.jsx)(Ei,{label:x.settings.instructions,hint:x.settings.instructionsHint,children:(0,$.jsx)(`textarea`,{className:Di(!0),value:Nn.instructions,onChange:e=>cr({instructions:e.target.value})})})]})]}),(0,$.jsxs)(`aside`,{className:`grid gap-4 xl:sticky xl:top-0`,children:[(0,$.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.settings.workspaceRoot}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:x.settings.workspaceIndependentHint})]}),(0,$.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,$.jsx)(`span`,{className:`w-fit rounded-md bg-surface-inset px-2 py-0.5 text-xs font-medium text-fg-muted`,children:Wr?x.settings.workspaceModeFollow:x.settings.workspaceModeFixed}),(0,$.jsx)(`div`,{className:`break-all font-mono text-xs leading-5 text-fg`,title:Gr,children:Gr}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsxs)(Y,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:()=>void Yr(),children:[(0,$.jsx)(u,{className:`size-4`,"aria-hidden":!0}),x.settings.copyWorkspacePath]}),_e?(0,$.jsx)(lt,{resourceId:_e.fileId,displayName:_e.name}):null,(0,$.jsxs)(Y,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:lr,children:[(0,$.jsx)(xt,{className:`size-4`,"aria-hidden":!0}),x.settings.migrateWorkspace]})]})]})]}),(0,$.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.settings.currentProjectTitle}),(0,$.jsxs)(`div`,{className:`grid gap-2`,children:[(0,$.jsx)(Oi,{label:x.settings.defaultAgent,value:zr}),(0,$.jsx)(Oi,{label:x.settings.pinState,value:Ur?x.settings.pinned:x.settings.notPinned}),(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,$.jsx)(Oi,{label:x.settings.createdAt,value:wi(D.createdAt)||x.common.never}),(0,$.jsx)(Oi,{label:x.settings.updatedAt,value:wi(D.updatedAt)||x.common.never})]})]})]}),(0,$.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:x.settings.managementTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:x.settings.managementHint})]}),(0,$.jsxs)(`div`,{className:`grid gap-3`,children:[(0,$.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:Ur?x.settings.pinnedTitle:x.settings.pinTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:x.settings.pinHint})]}),(0,$.jsxs)(Y,{type:`button`,variant:`ghost`,className:`w-fit rounded-lg`,disabled:an===`pin`,onClick:()=>void dr(),children:[Ur?(0,$.jsx)(pn,{className:`size-4`,"aria-hidden":!0}):(0,$.jsx)(Fe,{className:`size-4`,"aria-hidden":!0}),Ur?x.settings.unpinProject:x.settings.pinProject]})]}),(0,$.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:Hr?x.settings.restoreTitle:x.settings.archiveTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:Hr?x.settings.restoreHint:x.settings.archiveHint})]}),(0,$.jsxs)(Y,{type:`button`,variant:Hr?`primary`:`ghost`,className:`w-fit rounded-lg`,disabled:an===`archive`,onClick:()=>void fr(),children:[Hr?(0,$.jsx)(rn,{className:`size-4`,"aria-hidden":!0}):(0,$.jsx)(we,{className:`size-4`,"aria-hidden":!0}),Hr?x.settings.restoreProject:x.settings.archiveProject]})]})]})]}),(0,$.jsxs)(`section`,{className:`grid gap-3 rounded-lg border border-red-500/20 bg-red-500/5 p-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-red-700 dark:text-red-300`,children:x.settings.dangerTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-red-700/80 dark:text-red-200/80`,children:x.settings.dangerHint})]}),(0,$.jsxs)(Y,{type:`button`,variant:`ghost`,className:`w-fit text-red-600 hover:bg-red-500/10 hover:text-red-700 focus-visible:ring-red-500 dark:text-red-400 dark:hover:text-red-300`,onClick:()=>Ut(!0),children:[(0,$.jsx)(De,{className:`size-4`,"aria-hidden":!0}),x.settings.deleteConfirmAction]})]})]})]})]}):null]}),(0,$.jsx)(N,{open:zt,onOpenChange:e=>{ln||Ut(e)},children:(0,$.jsxs)(A,{children:[(0,$.jsx)(E,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(j,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] w-[min(28rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-overlay p-5 shadow-float focus:outline-none`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.jsx)(`span`,{className:`mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg bg-red-500/10 text-red-600 dark:text-red-400`,children:(0,$.jsx)(tn,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(M,{className:`text-base font-semibold text-fg`,children:x.settings.deleteConfirmTitle}),(0,$.jsx)(O,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:D?Ci(x.settings.deleteConfirm,{name:D.name}):x.settings.deleteConfirmFallback})]})]}),(0,$.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,$.jsx)(k,{asChild:!0,children:(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:ln,children:x.common.cancel})}),(0,$.jsxs)(Y,{type:`button`,variant:`ghost`,className:`rounded-lg text-red-600 hover:bg-red-500/10 hover:text-red-700 focus-visible:ring-red-500 dark:text-red-400 dark:hover:text-red-300`,disabled:ln||!D,onClick:()=>void pr(),children:[(0,$.jsx)(De,{className:`size-4`,"aria-hidden":!0}),x.settings.deleteConfirmAction]})]})]})]})}),(0,$.jsx)(qe,{open:!!Le,title:d.workspace.trashConfirmTitle,description:d.workspace.trashConfirmDescription.replace(`{{name}}`,Le?.name??``),confirmLabel:d.workspace.moveToTrash,cancelLabel:d.workspace.cancel,destructive:!0,onConfirm:()=>void br(),onCancel:()=>Re(null)}),(0,$.jsx)(qe,{open:!!Be,title:d.workspace.deleteConfirmTitle,description:d.workspace.deleteConfirmDescription.replace(`{{name}}`,Be?.name??``),confirmLabel:d.workspace.deleteFile,cancelLabel:d.workspace.cancel,destructive:!0,onConfirm:()=>void Sr(),onCancel:()=>Ve(null)}),(0,$.jsx)(N,{open:qt,onOpenChange:e=>{It||Yt(e)},children:(0,$.jsxs)(A,{children:[(0,$.jsx)(E,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(j,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(34rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float focus:outline-none`,children:[(0,$.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,$.jsx)(M,{className:`text-base font-semibold text-fg`,children:x.settings.workspaceMigrationTitle}),(0,$.jsx)(O,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:x.settings.workspaceMigrationDescription})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,$.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,$.jsx)(`span`,{className:`font-medium text-fg-muted`,children:x.settings.workspaceMode}),(0,$.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:b(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,Zt===`fixed`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,$.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:Zt===`fixed`,onChange:()=>Qt(`fixed`),disabled:It}),(0,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsx)(`span`,{className:`block font-medium`,children:x.settings.workspaceModeFixed}),(0,$.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:x.settings.workspaceMigrationFixedHint})]})]}),(0,$.jsxs)(`label`,{className:b(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,Zt===`follow`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,$.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:Zt===`follow`,onChange:()=>Qt(`follow`),disabled:It}),(0,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsx)(`span`,{className:`block font-medium`,children:x.settings.workspaceModeFollow}),(0,$.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:x.settings.workspaceHint})]})]})]})]}),Zt===`fixed`?(0,$.jsx)(xn,{value:$t,onChange:nn,disabled:It,wd:f,placeholder:x.settings.workspacePlaceholder,inputClassName:Di(),autoFocus:!0}):null,(0,$.jsx)(`div`,{className:`rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm leading-6 text-amber-800 dark:text-amber-200`,children:x.settings.workspaceMigrationImpact}),(0,$.jsx)(`div`,{className:`rounded-lg bg-surface-inset px-3 py-2 text-xs leading-5 text-fg-subtle`,children:Ci(x.settings.workspaceCurrent,{workspace:Kr})})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,$.jsx)(k,{asChild:!0,children:(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:It,children:x.common.cancel})}),(0,$.jsxs)(Y,{type:`button`,variant:`primary`,className:`rounded-lg`,disabled:It||!qr,onClick:()=>void ur(),children:[(0,$.jsx)(xt,{className:`size-4`,"aria-hidden":!0}),x.settings.workspaceMigrationConfirm]})]})]})]})}),(0,$.jsx)(N,{open:!!Wt,onOpenChange:e=>{e||Gt(null)},children:(0,$.jsxs)(A,{children:[(0,$.jsx)(E,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(j,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex w-[min(30rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float focus:outline-none`,children:[(0,$.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,$.jsx)(M,{className:`text-base font-semibold text-fg`,children:x.settings.workspaceMissingTitle}),(0,$.jsx)(O,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:Wt?Ci(x.settings.workspaceMissingDescription,{workspace:Wt}):null})]}),Wt?(0,$.jsx)(`div`,{className:`px-5 py-4`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-inset px-3 py-2 text-sm text-fg-muted`,children:[(0,$.jsx)(ke,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:Wt})]})}):null,(0,$.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:Xr,disabled:It,children:x.settings.workspaceMissingBack}),(0,$.jsxs)(Y,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:()=>void ur({createWorkspaceRoot:!0}),disabled:It,children:[(0,$.jsx)(xt,{className:`size-4`,"aria-hidden":!0}),x.settings.workspaceMissingCreate]})]})]})]})})]})}export{Hi as ProjectDetailPage};