@xopcai/xopc 0.0.200 → 0.0.201

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 (93) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{activity-store-DYVN1hRp.js → activity-store-DOhnAQOQ.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-eMarz29u.js → agent-avatar-dicebear-D8Cw0Mve.js} +1 -1
  5. package/dist/gateway/static/root/assets/{agents-DeLW-454.js → agents-ANavi648.js} +1 -1
  6. package/dist/gateway/static/root/assets/{api-B8mzbAle.js → api-E9Bk-Idp.js} +1 -1
  7. package/dist/gateway/static/root/assets/{app-management-settings-panel-yfb68wq9.js → app-management-settings-panel-BubrReXg.js} +1 -1
  8. package/dist/gateway/static/root/assets/{appearance-settings-B8SPknFM.js → appearance-settings-BY5Az2p4.js} +1 -1
  9. package/dist/gateway/static/root/assets/{apps-page-Bmor22Ny.js → apps-page-CFh9MBxc.js} +1 -1
  10. package/dist/gateway/static/root/assets/{archive-plugin-DmYRiOP3.js → archive-plugin-BY8843mB.js} +1 -1
  11. package/dist/gateway/static/root/assets/{attachment-load-D66JvcPi.js → attachment-load-DG45KScf.js} +1 -1
  12. package/dist/gateway/static/root/assets/{automations-page-Q4e8m11h.js → automations-page-751CeNI3.js} +1 -1
  13. package/dist/gateway/static/root/assets/{binary-plugins-ChIsZArT.js → binary-plugins-DGIF2ZAv.js} +1 -1
  14. package/dist/gateway/static/root/assets/{block-editor-Ck-k_d0Z.js → block-editor-C1Qktr1g.js} +1 -1
  15. package/dist/gateway/static/root/assets/{browser-settings-page--uVL73Sb.js → browser-settings-page-CGAWs-TT.js} +1 -1
  16. package/dist/gateway/static/root/assets/{browser-workflow-inputs-_ndaecsf.js → browser-workflow-inputs-D_jnndyz.js} +1 -1
  17. package/dist/gateway/static/root/assets/{browser-workflows-page-BC5jm1zL.js → browser-workflows-page-DyIRvPaq.js} +1 -1
  18. package/dist/gateway/static/root/assets/{capabilities-settings-panel-DXpf3QYN.js → capabilities-settings-panel-CghUK68J.js} +1 -1
  19. package/dist/gateway/static/root/assets/{capability-presets-api-Dy1jZJKs.js → capability-presets-api--tz0mGLY.js} +1 -1
  20. package/dist/gateway/static/root/assets/{capability-presets-settings-panel-NAjCsrTi.js → capability-presets-settings-panel-XsTfkvUn.js} +1 -1
  21. package/dist/gateway/static/root/assets/{channel-recipient-api-D-9qiuio.js → channel-recipient-api-CkOKF9nc.js} +1 -1
  22. package/dist/gateway/static/root/assets/{channels-settings-CiWUo7jW.js → channels-settings-DkoAZZMe.js} +1 -1
  23. package/dist/gateway/static/root/assets/channels-status-swr-DNDvMWpl.js +1 -0
  24. package/dist/gateway/static/root/assets/{connectors-api-5xiCRVUS.js → connectors-api-FBOe9SWC.js} +1 -1
  25. package/dist/gateway/static/root/assets/{connectors-page-DOwlMseU.js → connectors-page-e4vekkAu.js} +1 -1
  26. package/dist/gateway/static/root/assets/{cron-expression-B3PebXKZ.js → cron-expression-Q4QaYjpI.js} +1 -1
  27. package/dist/gateway/static/root/assets/{date-picker-C1Vke7Xn.js → date-picker-Dtn7e6TW.js} +1 -1
  28. package/dist/gateway/static/root/assets/{dependency-picker-FrQ0tsBC.js → dependency-picker-Br6nPaM6.js} +1 -1
  29. package/dist/gateway/static/root/assets/{desktop-pet-CPBAzNJi.js → desktop-pet-DzTM6aH8.js} +1 -1
  30. package/dist/gateway/static/root/assets/{desktop-pet-settings-D6s3glDP.js → desktop-pet-settings-FDmaty3P.js} +1 -1
  31. package/dist/gateway/static/root/assets/{directory-picker-path-field-CbNQ7QQS.js → directory-picker-path-field-X2e8xn8j.js} +1 -1
  32. package/dist/gateway/static/root/assets/{extension-debug-page-dTK14hUv.js → extension-debug-page-Dx4MBfga.js} +1 -1
  33. package/dist/gateway/static/root/assets/{extension-page-Cpdj1Kip.js → extension-page-Bf_FEDhM.js} +1 -1
  34. package/dist/gateway/static/root/assets/{extension-settings-page-iNHUZGd5.js → extension-settings-page-CrOgZxkf.js} +1 -1
  35. package/dist/gateway/static/root/assets/{gateway-config-api-SvMvWqMM.js → gateway-config-api-CZ4r-7qT.js} +1 -1
  36. package/dist/gateway/static/root/assets/{gateway-config-swr-jB0hAhWO.js → gateway-config-swr-Cv2ywpdb.js} +1 -1
  37. package/dist/gateway/static/root/assets/{gateway-settings-BilR3dGZ.js → gateway-settings-DpWmVi0w.js} +1 -1
  38. package/dist/gateway/static/root/assets/{gateway-startup-retry-C-fRlHCL.js → gateway-startup-retry-undf-k5g.js} +1 -1
  39. package/dist/gateway/static/root/assets/{heartbeat-settings-zK40dcQ5.js → heartbeat-settings-DSQZhSvT.js} +1 -1
  40. package/dist/gateway/static/root/assets/{home-page-NyXy5MLr.js → home-page-L0uHiu0T.js} +1 -1
  41. package/dist/gateway/static/root/assets/index-DRrjYYzZ.js +152 -0
  42. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-nKzsroud.js → keyboard-shortcuts-settings-Bc3Quw42.js} +1 -1
  43. package/dist/gateway/static/root/assets/{local-app-workbench-page-Ds3sPXTh.js → local-app-workbench-page-Copi3sdP.js} +1 -1
  44. package/dist/gateway/static/root/assets/{local-apps-page-DV1s_FYh.js → local-apps-page-CP9X_vtz.js} +1 -1
  45. package/dist/gateway/static/root/assets/{locale-store-xULEcFVs.js → locale-store-CnamlR07.js} +1 -1
  46. package/dist/gateway/static/root/assets/{logs-page-Biz4eA02.js → logs-page-DMKq6e29.js} +1 -1
  47. package/dist/gateway/static/root/assets/{management-settings-D7KjYgHu.js → management-settings-CJmcaVje.js} +1 -1
  48. package/dist/gateway/static/root/assets/{markdown-split-CTYbpkrd.js → markdown-split-AcuFp0TH.js} +1 -1
  49. package/dist/gateway/static/root/assets/{media-plugins-BXYnaiZ6.js → media-plugins-BvFgsiJL.js} +1 -1
  50. package/dist/gateway/static/root/assets/messages-D7kOD_o_.js +3 -0
  51. package/dist/gateway/static/root/assets/{notes-page-CWWVXpw5.js → notes-page-IW7IQ9nJ.js} +1 -1
  52. package/dist/gateway/static/root/assets/{notes-workbench-DnBkQihH.js → notes-workbench-Zb8U0anO.js} +2 -2
  53. package/dist/gateway/static/root/assets/{preview-open-alternatives-pimQAkeI.js → preview-open-alternatives-C-b34dgQ.js} +1 -1
  54. package/dist/gateway/static/root/assets/{product-open-page-BoYSS_YR.js → product-open-page-CWEzLykF.js} +1 -1
  55. package/dist/gateway/static/root/assets/{project-detail-page-ZO7t1UkB.js → project-detail-page-BuIbLnan.js} +1 -1
  56. package/dist/gateway/static/root/assets/{projects-page-By-vq41g.js → projects-page-BwUfRqNV.js} +1 -1
  57. package/dist/gateway/static/root/assets/{remote-access-hub-C0C_Y9d0.js → remote-access-hub-BTaXxcEi.js} +1 -1
  58. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DT8flaX1.js → runtime-tools-settings-panel-DAohEZrX.js} +1 -1
  59. package/dist/gateway/static/root/assets/{schema-form-DabEP-UI.js → schema-form-C_OBW8A5.js} +1 -1
  60. package/dist/gateway/static/root/assets/{sessions-page-BNlVwUzV.js → sessions-page-BnHoTCD3.js} +1 -1
  61. package/dist/gateway/static/root/assets/settings-advanced-gate-BTB_fxjt.js +1 -0
  62. package/dist/gateway/static/root/assets/{settings-form-section-DCsfZAtC.js → settings-form-section-C7w2WS-A.js} +1 -1
  63. package/dist/gateway/static/root/assets/{settings-loading-skeleton-Dac6Yd0T.js → settings-loading-skeleton-zwibve4m.js} +1 -1
  64. package/dist/gateway/static/root/assets/{settings-page-BDoYoEar.js → settings-page-B9W03dSW.js} +1 -1
  65. package/dist/gateway/static/root/assets/{setup-status-panel-DWijJ1rw.js → setup-status-panel-C8Hec2Af.js} +1 -1
  66. package/dist/gateway/static/root/assets/{share-preview-page-ie9I2_7h.js → share-preview-page-6e3ks2be.js} +1 -1
  67. package/dist/gateway/static/root/assets/{shares-settings-DU9VrJLf.js → shares-settings-Bwc5HfLI.js} +1 -1
  68. package/dist/gateway/static/root/assets/skill-reload-api-D7kunhqy.js +1 -0
  69. package/dist/gateway/static/root/assets/{skills-page-N0YhaR5S.js → skills-page-WgkaNzpc.js} +1 -1
  70. package/dist/gateway/static/root/assets/{skills-page.utils-C639DLXr.js → skills-page.utils-D9QT5cxj.js} +1 -1
  71. package/dist/gateway/static/root/assets/{system-settings-panel-CpshpQtC.js → system-settings-panel-c1HVtv1Y.js} +1 -1
  72. package/dist/gateway/static/root/assets/{task-detail-page-DsTocYkK.js → task-detail-page-CjP-6WVU.js} +1 -1
  73. package/dist/gateway/static/root/assets/{theme-store-CHQRiuCF.js → theme-store-BDyUTObE.js} +1 -1
  74. package/dist/gateway/static/root/assets/{use-autosave-ms6rDy59.js → use-autosave-D6UkH_Ga.js} +1 -1
  75. package/dist/gateway/static/root/assets/{user-context-page-BUxIemwy.js → user-context-page-D8ZhPDNF.js} +1 -1
  76. package/dist/gateway/static/root/assets/{voice-api-key-field-CObrQWh2.js → voice-api-key-field-BOxkKbGh.js} +1 -1
  77. package/dist/gateway/static/root/assets/{work-discovery-overlay-BBxrnEFt.js → work-discovery-overlay-Dd19yK9t.js} +1 -1
  78. package/dist/gateway/static/root/assets/{work-discovery-page-DN3l-HW3.js → work-discovery-page-DUkdJl1e.js} +1 -1
  79. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BxXhe3IV.js → workflow-run-setup-panel-ZA3bP65I.js} +1 -1
  80. package/dist/gateway/static/root/assets/{workflows-page-BCHkjd1i.js → workflows-page-C2b5W5bw.js} +1 -1
  81. package/dist/gateway/static/root/assets/{working-directory-picker-modal-D-IgcHPp.js → working-directory-picker-modal-BcyiDXU3.js} +1 -1
  82. package/dist/gateway/static/root/index.html +8 -8
  83. package/dist/package.js +1 -1
  84. package/dist/src/auth/oauth/types.d.ts +2 -0
  85. package/dist/src/auth/oauth/xopc-cloud.js +24 -2
  86. package/dist/src/gateway/hono/oauth-async.js +2 -0
  87. package/dist/src/gateway/service.js +5 -5
  88. package/package.json +3 -3
  89. package/dist/gateway/static/root/assets/channels-status-swr-B4Rbh3bM.js +0 -1
  90. package/dist/gateway/static/root/assets/index-CCK8zdlS.js +0 -152
  91. package/dist/gateway/static/root/assets/messages-3qRsLZuX.js +0 -3
  92. package/dist/gateway/static/root/assets/settings-advanced-gate-CxYBQDaM.js +0 -1
  93. package/dist/gateway/static/root/assets/skill-reload-api-C5RaIvoE.js +0 -1
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{f as r,l as i}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as a}from"./check-DUBLcKHA.js";import{n as o,t as ee}from"./working-directory-picker-modal-D-IgcHPp.js";import{t as s}from"./loader-circle-CifKLtgG.js";import{t as te}from"./cn-JdwAhgNB.js";import{t as c}from"./button-CSEbl4zT.js";import{t as l}from"./messages-3qRsLZuX.js";import{n as ne}from"./locale-store-xULEcFVs.js";import{$a as re,Al as ie,Ds as u,Ga as d,Hc as ae,Ja as oe,Ka as se,Kc as f,Na as p,Ol as m,Qa as ce,Xa as h,Ya as le,Yo as g,Za as _,Zc as ue,eo as de,ml as fe,no as v,qa as pe,qo as me,ro as he,to as ge}from"./index-CCK8zdlS.js";var y=e(t(),1),b=new Set([`completed`,`failed`,`canceled`]);function _e(){return new Promise(e=>window.setTimeout(e,1200))}async function ve(e,t){let n=[],r=t.wait??_e;for(let i=0;i<e.length&&!t.shouldStop?.();i+=1){let a=e[i];if(a)try{await t.grantDirectory(a.rootPath);let o=await t.startRun(a.rootPath);for(t.onRun(o,i,e.length);!b.has(o.status)&&!t.shouldStop?.();)await r(),o=await t.fetchRun(o.id),t.onRun(o,i,e.length);if(n.push(o),o.status===`canceled`||t.shouldStop?.())break}catch(e){if(t.onError?.(e,a,i),t.shouldStop?.())break}}return n}var x=new Set([`local-recent-files`,`chromium-bookmarks`,`apple-notes`,`apple-calendar`,`apple-reminders`]);function ye(e){return new Set(e.filter(e=>e.availability===`available`&&x.has(e.id)).map(e=>e.id))}var S=n(),be=[`folder_structure`,`recent_progress`,`next_steps`];function C(e){return e instanceof Error?e.message:String(e)}function xe({embedded:e=!1,onRequestClose:t}={}){let n=ne(e=>e.language),b=l(n).onboarding.workDiscovery,_e=l(n).chat.workingDirectory,x=i(),[xe]=r(),Se=e||xe.get(`new`)===`1`,[w,T]=(0,y.useState)(`loading`),[E,D]=(0,y.useState)(null),[O,k]=(0,y.useState)(null),[A,j]=(0,y.useState)(!1),[M,N]=(0,y.useState)(null),[Ce,P]=(0,y.useState)(!1),[F,I]=(0,y.useState)(``),[L,R]=(0,y.useState)(!1),[we,z]=(0,y.useState)(()=>new Set),[B,Te]=(0,y.useState)([]),[V,Ee]=(0,y.useState)(()=>new Set),[De,H]=(0,y.useState)([]),[Oe,ke]=(0,y.useState)(!1),[U,W]=(0,y.useState)({current:0,total:0}),[Ae,je]=(0,y.useState)([]),[G,Me]=(0,y.useState)(()=>new Set),K=(0,y.useRef)(!1),Ne=e=>{Me(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};(0,y.useEffect)(()=>{let e=!1;return window.electronAPI?.understandingSources?.catalog().then(t=>{e||(je(t),Me(ye(t)))}),()=>{e=!0}},[]);let q=(0,y.useCallback)(e=>{d.getState().updateDirectoryRun(e),k(e),e.status===`completed`?(z(new Set(e.result?.profileCandidates?.filter(e=>e.status===`pending`).map(e=>e.id)??[])),T(e.feedback?.recognitionDecision===`confirmed`?`recommendation`:`recognition`)):e.status===`failed`||e.status===`canceled`?T(`error`):T(`running`)},[]),Pe=async()=>{j(!0),N(null);try{let e=await pe();if(!e.length){N(b.noCandidates);return}Te(e),Ee(new Set([e[0].rootPath])),T(`candidates`)}catch(e){N(C(e))}finally{j(!1)}},Fe=e=>{Ee(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},Ie=(0,y.useCallback)((e,t,n)=>{d.getState().updateDirectoryRun(e),k(e),W({current:t+1,total:n}),H(n=>{let r=[...n];return r[t]=e,r}),T(`running`)},[]),Le=(0,y.useCallback)(e=>{H(t=>t.map(t=>t?.id===e.id?e:t))},[]),Re=async()=>{let e=B.filter(e=>V.has(e.rootPath));if(!e.length)return;j(!0),N(null),H([]),W({current:1,total:e.length}),ke(!0),K.current=!1;let t=!1;try{let n=await ve(e,{grantDirectory:_,startRun:ge,fetchRun:h,shouldStop:()=>K.current,onRun:(e,n,r)=>{Ie(e,n,r),t||(t=!0,d.getState().collectSources(e.id,[...G]))},onError:(t,n,r)=>{W({current:r+1,total:e.length}),N(b.folderAnalysisFailed.replace(`{{folder}}`,n.displayName).replace(`{{error}}`,C(t)))}});if(K.current)return;let r=n.find(e=>e.status===`completed`)??n.at(-1);r?q(r):T(`candidates`)}catch(e){N(C(e)),T(`candidates`)}finally{ke(!1),j(!1)}},J=o({onPicked:(0,y.useCallback)(async e=>{j(!0),N(null);try{D(await ce(e)),T(`consent`)}catch(e){N(C(e)),T(`intro`)}finally{j(!1)}},[])});(0,y.useEffect)(()=>{let e=!1;return le().then(async({enabled:n,state:r})=>{if(!e){if(!n){t?t():x(`/chat`,{replace:!0});return}if(!Se&&r.activeRunId)try{let t=await h(r.activeRunId);e||q(t);return}catch{}e||T(`intro`)}}).catch(t=>{e||(N(C(t)),T(`intro`))}),()=>{e=!0}},[q,x,t,Se]),(0,y.useEffect)(()=>{if(!O||w!==`running`||Oe)return;let e=!1,t=async()=>{try{let t=await h(O.id);e||q(t)}catch{}},n=window.setInterval(()=>void t(),1200),r=e=>{let n=e.detail;(!n?.runId||n.runId===O.id)&&t()};for(let e of[`work-discovery-progress`,`work-discovery-completed`,`work-discovery-failed`,`work-discovery-canceled`])window.addEventListener(e,r);return()=>{e=!0,window.clearInterval(n);for(let e of[`work-discovery-progress`,`work-discovery-completed`,`work-discovery-failed`,`work-discovery-canceled`])window.removeEventListener(e,r)}},[q,Oe,w,O]);let ze=async()=>{j(!0);try{await oe()}finally{t?t():x(`/chat`,{replace:!0})}},Be=async()=>{if(E){j(!0),N(null),H([]),W({current:0,total:0});try{await _(E.canonicalRootPath);let e=await ge(E.canonicalRootPath);q(e),d.getState().collectSources(e.id,[...G])}catch(e){N(C(e)),T(`consent`)}finally{j(!1)}}},Y=(e,t)=>{let n=t?`?draft=${encodeURIComponent(t)}`:``;x(`/chat/${encodeURIComponent(e)}${n}`)},Ve=e=>{k(e),P(!1),R(!1),z(new Set(e.result?.profileCandidates?.filter(e=>e.status===`pending`).map(e=>e.id)??[])),e.status===`completed`?T(e.feedback?.recognitionDecision===`confirmed`?`recommendation`:`recognition`):e.status===`failed`||e.status===`canceled`?T(`error`):T(`running`)},He=async()=>{O&&(K.current=!0,q(await se(O.id)))},X=async(e,t)=>{if(!O)return;await de(O.id,e.id).catch(()=>{});let r=t?`${n===`zh`?`先帮我评估这个方向,不要修改文件:`:`First assess this direction without changing files:`}\n\n${e.actionPrompt}`:e.actionPrompt;Y(O.sessionKey,r)},Ue=async()=>{if(O){j(!0),N(null);try{let e=O.result?.profileCandidates??[],t=await v((e.length>0?await he(O.id,e.map(e=>({id:e.id,status:we.has(e.id)?`accepted`:`rejected`}))):O).id,`confirmed`);k(t),Le(t),T(`recommendation`)}catch(e){N(C(e))}finally{j(!1)}}},Z=async e=>{if(!(!O||!F.trim())){j(!0),N(null);try{let t=await v(O.id,e,F.trim());k(t),Y(t.sessionKey,F.trim())}catch(e){N(C(e)),j(!1)}}},We=async()=>{if(O){j(!0);try{Y((await v(O.id,`dismissed`)).sessionKey)}catch(e){N(C(e)),j(!1)}}},Q=O?.result?.suggestions.find(e=>e.id===O.result?.primarySuggestionId)??O?.result?.suggestions[0],Ge=O?.result?.suggestions.filter(e=>e.id!==Q?.id)??[],Ke=e=>e===`command`?b.riskCommand:e===`file_write`?b.riskFileWrite:b.riskAnalysis,qe=De.filter(e=>e?.status===`completed`),Je=e&&w===`candidates`,$=qe.length>1?(0,S.jsxs)(`div`,{className:`mt-6 rounded-xl border border-edge bg-surface-panel p-2`,children:[(0,S.jsx)(`p`,{className:`px-2 pb-2 text-xs font-medium text-fg-muted`,children:b.analysisResults}),(0,S.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:qe.map(e=>{let t=B.find(t=>t.rootPath===e.rootPath)?.displayName??e.rootPath.split(/[\\/]/).filter(Boolean).at(-1)??e.rootPath;return(0,S.jsx)(`button`,{type:`button`,className:`rounded-lg px-3 py-2 text-sm font-medium transition ${e.id===O?.id?`bg-accent text-white`:`bg-surface-muted text-fg hover:bg-surface-hover`}`,onClick:()=>Ve(e),children:t},e.id)})})]}):null;return(0,S.jsxs)(`div`,{className:e?`flex h-full min-h-0 flex-1 flex-col overflow-hidden bg-surface-base`:`flex min-h-full flex-1 flex-col bg-surface-base`,children:[(0,S.jsxs)(`main`,{className:e?`mx-auto flex h-full min-h-0 w-full max-w-[40rem] flex-1 flex-col px-5 py-7 sm:px-8 sm:py-9 ${Je?`overflow-hidden`:`overflow-y-auto [scrollbar-gutter:stable]`}`:`mx-auto flex w-full max-w-[40rem] flex-1 flex-col px-5 py-10 sm:px-8 sm:py-16`,children:[e?null:(0,S.jsx)(`div`,{className:`mb-10 flex items-center justify-center`,children:(0,S.jsx)(me,{className:`size-11`})}),w===`loading`?(0,S.jsxs)(`div`,{className:`mx-auto flex min-h-[26rem] w-full max-w-md flex-col items-center`,"aria-busy":!0,children:[(0,S.jsx)(p,{className:`h-8 w-64 max-w-full`}),(0,S.jsx)(p,{className:`mt-4 h-4 w-full max-w-sm`}),(0,S.jsx)(p,{className:`mt-2 h-4 w-4/5 max-w-xs`}),(0,S.jsx)(p,{className:`mt-10 h-12 w-full rounded-xl`}),(0,S.jsx)(p,{className:`mt-3 h-11 w-full rounded-xl`}),(0,S.jsx)(p,{className:`mt-5 h-4 w-3/5 max-w-56`})]}):null,w===`intro`?(0,S.jsxs)(`section`,{className:`flex flex-1 flex-col text-center`,"aria-labelledby":`work-discovery-title`,children:[(0,S.jsxs)(`div`,{className:`mx-auto max-w-[36rem]`,children:[(0,S.jsx)(`h1`,{id:`work-discovery-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:b.title}),(0,S.jsx)(`p`,{className:`mx-auto mt-3 max-w-[34rem] text-[0.95rem] leading-7 text-fg-muted`,children:b.subtitle})]}),(0,S.jsxs)(`div`,{className:`mx-auto mt-9 w-full max-w-md`,children:[Ae.length?(0,S.jsxs)(`div`,{className:`mb-5 rounded-xl border border-edge bg-surface-panel p-3 text-left`,children:[(0,S.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:b.localSourcesTitle}),(0,S.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:b.localSourcesSubtitle}),(0,S.jsx)(`div`,{className:`mt-3 grid grid-cols-2 gap-2 sm:grid-cols-3`,children:Ae.map(e=>{let t=G.has(e.id);return(0,S.jsxs)(`button`,{type:`button`,className:te(`flex min-h-16 flex-col items-center justify-center gap-1 rounded-lg border px-2 py-2 text-xs font-medium transition-colors`,t?`border-accent/40 bg-accent-soft text-accent-fg`:`border-edge bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg`),"aria-pressed":t,onClick:()=>Ne(e.id),children:[(0,S.jsx)(`span`,{className:te(`flex size-4 items-center justify-center rounded-full border`,t?`border-accent bg-accent text-white`:`border-edge`),children:t?(0,S.jsx)(a,{className:`size-3`,"aria-hidden":!0}):null}),e.displayName]},e.id)})})]}):null,(0,S.jsxs)(c,{type:`button`,className:`h-12 w-full gap-2 bg-accent text-white hover:bg-accent-hover`,onClick:()=>void Pe(),disabled:A||J.picking,children:[A?(0,S.jsx)(s,{className:`size-4 animate-spin`}):(0,S.jsx)(u,{className:`size-4`}),b.quickScan]}),(0,S.jsxs)(c,{type:`button`,variant:`secondary`,className:`mt-3 h-11 w-full gap-2`,onClick:J.pick,disabled:A||J.picking,children:[J.picking?(0,S.jsx)(s,{className:`size-4 animate-spin`}):(0,S.jsx)(f,{className:`size-4`}),b.chooseFolderManually]}),(0,S.jsxs)(`div`,{className:`mt-4 flex items-start justify-center gap-2 text-xs leading-5 text-fg-muted`,children:[(0,S.jsx)(u,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,S.jsx)(`span`,{children:b.quickScanNote})]}),(0,S.jsx)(`button`,{type:`button`,className:`mt-4 text-sm font-medium text-accent-fg hover:underline`,onClick:()=>x(`/connectors?understanding=1&returnTo=%2Fonboarding%2Fworkspace`),children:b.connectCloudSource}),M?(0,S.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:M}):null]}),(0,S.jsx)(`button`,{type:`button`,className:`mx-auto mt-auto pt-10 text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>void ze(),disabled:A,children:b.skip})]}):null,w===`candidates`?(0,S.jsxs)(`section`,{className:e?`flex h-full min-h-0 flex-col`:void 0,"aria-labelledby":`work-discovery-candidates-title`,children:[(0,S.jsxs)(`div`,{className:e?`shrink-0 text-center`:`text-center`,children:[(0,S.jsx)(`h1`,{id:`work-discovery-candidates-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:b.candidatesTitle}),(0,S.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:b.candidatesSubtitle})]}),(0,S.jsx)(`div`,{className:e?`mt-5 min-h-0 flex-1 space-y-2 overflow-y-auto overscroll-contain pr-1 [scrollbar-gutter:stable]`:`mt-7 space-y-2`,children:B.map((e,t)=>{let n=V.has(e.rootPath);return(0,S.jsxs)(`button`,{type:`button`,"aria-pressed":n,className:`flex w-full items-start gap-3 rounded-xl border p-4 text-left transition ${n?`border-accent bg-accent-soft/45`:`border-edge bg-surface-panel hover:border-edge-strong`}`,onClick:()=>Fe(e.rootPath),children:[(0,S.jsx)(`span`,{className:`mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-md border ${n?`border-accent bg-accent text-white`:`border-edge bg-surface-base text-transparent`}`,children:(0,S.jsx)(a,{className:`size-3.5`})}),(0,S.jsx)(f,{className:`mt-0.5 size-5 shrink-0 text-accent-fg`}),(0,S.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,S.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.displayName}),t===0?(0,S.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[0.7rem] font-medium text-accent-fg`,children:b.recommendedCandidate}):null]}),(0,S.jsx)(`span`,{className:`mt-1 block truncate font-mono text-xs text-fg-muted`,children:e.rootPath}),(0,S.jsxs)(`span`,{className:`mt-2 flex flex-wrap gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[(0,S.jsx)(`span`,{children:e.projectKind===`coding`?b.codingProject:e.projectKind===`general`?b.generalProject:b.unknownProject}),e.branch?(0,S.jsx)(`span`,{children:b.branchValue.replace(`{{branch}}`,e.branch)}):null,e.changedFileCount>0?(0,S.jsx)(`span`,{children:b.changedFiles.replace(`{{count}}`,String(e.changedFileCount))}):null]})]})]},e.id)})}),(0,S.jsxs)(`div`,{className:e?`shrink-0 border-t border-edge-subtle pt-4`:void 0,children:[(0,S.jsxs)(`div`,{className:`${e?``:`mt-5 `}flex items-start gap-2 rounded-xl border border-edge-subtle bg-surface-panel px-4 py-3 text-xs leading-5 text-fg-muted`,children:[(0,S.jsx)(u,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,S.jsx)(`span`,{children:b.multiFolderPrivacyNote})]}),M?(0,S.jsx)(`p`,{className:`mt-3 text-sm text-danger`,role:`alert`,children:M}):null,(0,S.jsxs)(`div`,{className:`${e?`mt-4`:`mt-7`} flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,S.jsxs)(c,{type:`button`,className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:A||V.size===0,onClick:()=>void Re(),children:[A?(0,S.jsx)(s,{className:`mr-2 size-4 animate-spin`}):null,b.analyzeSelected.replace(`{{count}}`,String(V.size))]}),(0,S.jsx)(c,{type:`button`,variant:`secondary`,className:`h-11 flex-1`,disabled:A,onClick:J.pick,children:b.chooseFolderManually})]}),(0,S.jsx)(`button`,{type:`button`,className:`${e?`mt-3`:`mt-6`} mx-auto block text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>T(`intro`),children:b.back})]})]}):null,w===`consent`&&E?(0,S.jsxs)(`section`,{"aria-labelledby":`work-discovery-consent-title`,children:[(0,S.jsxs)(`div`,{className:`text-center`,children:[(0,S.jsx)(`h1`,{id:`work-discovery-consent-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:b.selectedTitle}),(0,S.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:b.selectedSubtitle})]}),(0,S.jsxs)(`div`,{className:`mt-8 overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-edge-subtle px-4 py-3.5`,children:[(0,S.jsx)(f,{className:`size-5 shrink-0 text-accent-fg`}),(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:E.displayName}),(0,S.jsx)(`p`,{className:`truncate font-mono text-xs text-fg-muted`,children:E.canonicalRootPath})]}),(0,S.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2.5 py-1 text-xs font-medium text-accent-fg`,children:E.projectKind===`coding`?b.codingProject:E.projectKind===`general`?b.generalProject:b.unknownProject})]}),(0,S.jsxs)(`div`,{className:`grid gap-3 border-b border-edge-subtle bg-surface-base/60 p-4 sm:grid-cols-2`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:b.localFingerprint}),(0,S.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:E.fingerprint.branch?b.branchValue.replace(`{{branch}}`,E.fingerprint.branch):b.noGitBranch})]}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:b.recentActivity}),(0,S.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:b.changedFiles.replace(`{{count}}`,String(E.fingerprint.changedFileCount))})]}),E.fingerprint.recentAreas.length>0?(0,S.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,S.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:b.recentAreas}),(0,S.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:E.fingerprint.recentAreas.map(e=>(0,S.jsx)(`code`,{className:`rounded-md bg-surface-muted px-2 py-1 text-xs text-fg`,children:e},e))})]}):null]}),(0,S.jsxs)(`div`,{className:`divide-y divide-edge-subtle px-4`,children:[(0,S.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,S.jsx)(ue,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:b.willRead}),(0,S.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:b.willReadValue})]})]}),(0,S.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,S.jsx)(g,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:b.willIgnore}),(0,S.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:b.willIgnoreValue})]})]}),(0,S.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,S.jsx)(u,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,S.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:E.remoteModel?b.providerDisclosure.replace(`{{provider}}`,E.provider):b.localDisclosure})]})]})]}),M?(0,S.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:M}):null,(0,S.jsxs)(`div`,{className:`mt-7 flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,S.jsxs)(c,{type:`button`,className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:A,onClick:()=>void Be(),children:[A?(0,S.jsx)(s,{className:`mr-2 size-4 animate-spin`}):null,b.startAnalysis]}),(0,S.jsx)(c,{type:`button`,variant:`secondary`,className:`h-11 flex-1`,disabled:A,onClick:J.pick,children:b.changeFolder})]}),(0,S.jsx)(`button`,{type:`button`,className:`mx-auto mt-6 block text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>void ze(),children:b.skip})]}):null,w===`running`&&O?(0,S.jsxs)(`section`,{"aria-labelledby":`work-discovery-running-title`,"aria-live":`polite`,children:[(0,S.jsxs)(`div`,{className:`text-center`,children:[(0,S.jsx)(`h1`,{id:`work-discovery-running-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:b.analyzingTitle}),(0,S.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:b.analyzingSubtitle}),U.total>1?(0,S.jsx)(`p`,{className:`mt-2 text-sm font-medium text-accent-fg`,children:b.analyzingFolderProgress.replace(`{{current}}`,String(U.current)).replace(`{{total}}`,String(U.total))}):null]}),(0,S.jsx)(`div`,{className:`mt-9 rounded-xl border border-edge bg-surface-panel px-5 py-2`,children:be.map((e,t)=>{let n=Math.max(0,be.indexOf(O.stage??`folder_structure`)),r=t<n,i=t===n;return(0,S.jsxs)(`div`,{className:`flex items-center gap-4 border-b border-edge-subtle py-4 last:border-b-0`,children:[(0,S.jsx)(`span`,{className:`flex size-7 items-center justify-center rounded-full ${r?`bg-accent text-white`:i?`bg-accent-soft text-accent-fg`:`bg-surface-muted text-fg-subtle`}`,children:r?(0,S.jsx)(a,{className:`size-4`}):i?(0,S.jsx)(s,{className:`size-4 animate-spin motion-reduce:animate-none`}):(0,S.jsx)(`span`,{className:`size-1.5 rounded-full bg-current`})}),(0,S.jsx)(`span`,{className:i||r?`text-sm font-medium text-fg`:`text-sm text-fg-muted`,children:b.stages[e]})]},e)})}),(0,S.jsx)(`p`,{className:`mt-4 truncate text-center font-mono text-xs text-fg-muted`,children:O.rootPath}),(0,S.jsxs)(`div`,{className:`mx-auto mt-7 flex max-w-md flex-col gap-3`,children:[(0,S.jsx)(c,{type:`button`,variant:`secondary`,className:`h-11 w-full`,onClick:()=>x(`/chat`),children:b.continueInBackground}),(0,S.jsx)(`button`,{type:`button`,className:`mx-auto text-sm text-fg-muted hover:text-danger hover:underline`,onClick:()=>void He(),children:b.cancelAnalysis})]})]}):null,w===`recognition`&&O?.result?(0,S.jsxs)(`section`,{"aria-labelledby":`work-discovery-recognition-title`,children:[(0,S.jsxs)(`div`,{className:`text-center`,children:[(0,S.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.16em] text-accent-fg`,children:b.recognitionEyebrow}),(0,S.jsx)(`h1`,{id:`work-discovery-recognition-title`,className:`mt-2 text-2xl font-semibold tracking-tight text-fg`,children:O.result.lowConfidence?b.lowConfidenceTitle:b.recognitionTitle})]}),$,(0,S.jsxs)(`div`,{className:`mt-7 rounded-2xl border border-accent/25 bg-gradient-to-br from-accent-soft/45 via-surface-panel to-surface-panel p-5 sm:p-6`,children:[(0,S.jsx)(`p`,{className:`text-base font-medium leading-7 text-fg`,children:O.result.projectSummary}),(0,S.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:O.result.currentState}),!O.result.lowConfidence&&Q?.evidence.length?(0,S.jsx)(`ul`,{className:`mt-5 space-y-2 border-t border-edge-subtle pt-4`,children:Q.evidence.slice(0,3).map((e,t)=>(0,S.jsxs)(`li`,{className:`flex gap-2 text-xs leading-5 text-fg-muted`,children:[(0,S.jsx)(ae,{className:`mt-0.5 size-3.5 shrink-0 text-accent-fg`}),(0,S.jsxs)(`span`,{children:[e.path?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`code`,{className:`font-mono text-fg`,children:e.path}),`: `]}):null,e.observation]})]},`${Q.id}-recognition-${t}`))}):null]}),O.result.workThreads?.length?(0,S.jsxs)(`div`,{className:`mt-5 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,S.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:b.workThreadsTitle}),(0,S.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:b.workThreadsSubtitle}),(0,S.jsx)(`div`,{className:`mt-3 divide-y divide-edge-subtle`,children:O.result.workThreads.map(e=>(0,S.jsxs)(`div`,{className:`py-3 first:pt-0 last:pb-0`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[0.7rem] font-medium text-accent-fg`,children:e.horizon===`current`?b.workThreadCurrent:e.horizon===`ongoing`?b.workThreadOngoing:b.workThreadLongTerm}),(0,S.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.title})]}),(0,S.jsx)(`p`,{className:`mt-1.5 text-xs leading-5 text-fg-muted`,children:e.summary})]},e.id))})]}):null,O.result.profileCandidates?.length?(0,S.jsxs)(`div`,{className:`mt-5 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,S.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:b.profileCandidatesTitle}),(0,S.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:b.profileCandidatesSubtitle}),(0,S.jsx)(`div`,{className:`mt-3 space-y-2`,children:O.result.profileCandidates.map(e=>(0,S.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 rounded-lg px-2 py-2 hover:bg-surface-muted`,children:[(0,S.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 size-4 rounded border-edge accent-accent`,checked:we.has(e.id),onChange:()=>z(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n})}),(0,S.jsx)(`span`,{className:`text-sm leading-5 text-fg`,children:e.statement})]},e.id))})]}):null,O.result.lowConfidence?(0,S.jsxs)(`div`,{className:`mt-5`,children:[(0,S.jsx)(`p`,{className:`text-sm font-medium leading-6 text-fg`,children:O.result.contextQuestion}),(0,S.jsx)(`textarea`,{value:F,onChange:e=>I(e.target.value),placeholder:b.correctionPlaceholder,className:`mt-3 min-h-24 w-full resize-y rounded-xl border border-edge bg-surface-panel px-3 py-2.5 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/15`}),(0,S.jsx)(c,{className:`mt-3 w-full bg-accent text-white hover:bg-accent-hover`,disabled:A||!F.trim(),onClick:()=>void Z(`different_goal`),children:b.continueWithCorrection})]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`div`,{className:`mt-6 flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,S.jsxs)(c,{className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:A,onClick:()=>void Ue(),children:[A?(0,S.jsx)(s,{className:`size-4 animate-spin`}):(0,S.jsx)(a,{className:`size-4`}),b.confirmUnderstanding]}),(0,S.jsx)(c,{variant:`secondary`,className:`h-11 flex-1`,disabled:A,onClick:()=>P(e=>!e),children:b.notQuiteRight})]}),Ce?(0,S.jsxs)(`div`,{className:`mt-4 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,S.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`work-discovery-correction`,children:b.correctionLabel}),(0,S.jsx)(`textarea`,{id:`work-discovery-correction`,value:F,onChange:e=>I(e.target.value),placeholder:b.correctionPlaceholder,className:`mt-2 min-h-24 w-full resize-y rounded-lg border border-edge bg-surface-base px-3 py-2.5 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/15`}),(0,S.jsxs)(`div`,{className:`mt-3 flex flex-wrap justify-end gap-2`,children:[(0,S.jsx)(c,{variant:`ghost`,disabled:A||!F.trim(),onClick:()=>void Z(`different_goal`),children:b.differentGoal}),(0,S.jsx)(c,{variant:`primary`,disabled:A||!F.trim(),onClick:()=>void Z(`corrected`),children:b.useCorrection})]})]}):null]}),M?(0,S.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:M}):null,(0,S.jsx)(`button`,{type:`button`,disabled:A,className:`mx-auto mt-6 block text-sm text-fg-muted hover:text-fg hover:underline disabled:opacity-60`,onClick:()=>void We(),children:b.openConversation})]}):null,w===`recommendation`&&O?.result&&Q?(0,S.jsxs)(`section`,{"aria-labelledby":`work-discovery-recommendation-title`,children:[(0,S.jsxs)(`div`,{className:`text-center`,children:[(0,S.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.16em] text-accent-fg`,children:b.understandingConfirmed}),(0,S.jsx)(`h1`,{id:`work-discovery-recommendation-title`,className:`mt-2 text-2xl font-semibold tracking-tight text-fg`,children:b.primaryRecommendationTitle})]}),$,(0,S.jsx)(`article`,{className:`mt-7 rounded-2xl border border-accent/30 bg-surface-panel p-5 sm:p-6`,children:(0,S.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,S.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,S.jsx)(m,{className:`size-5`})}),(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsx)(`h2`,{className:`text-lg font-semibold text-fg`,children:Q.title}),(0,S.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:Q.rationale}),(0,S.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2 text-xs`,children:[(0,S.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full bg-surface-muted px-2.5 py-1 text-fg-muted`,children:[(0,S.jsx)(fe,{className:`size-3.5`}),b.estimatedMinutes.replace(`{{count}}`,String(Q.estimatedMinutes))]}),(0,S.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2.5 py-1 text-fg-muted`,children:Ke(Q.risk)})]}),(0,S.jsxs)(`div`,{className:`mt-4 rounded-xl bg-surface-base px-4 py-3`,children:[(0,S.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:b.expectedTask}),(0,S.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg`,children:Q.expectedTask})]}),(0,S.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:[(0,S.jsx)(c,{className:`h-10 bg-accent px-4 text-white hover:bg-accent-hover`,onClick:()=>void X(Q,!1),children:b.startRecommendedAction}),(0,S.jsx)(c,{className:`h-10 px-4`,variant:`secondary`,onClick:()=>void X(Q,!0),children:b.explainFirst})]})]})]})}),Ge.length>0?(0,S.jsxs)(`div`,{className:`mt-5 border-t border-edge-subtle pt-4`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between py-2 text-sm font-medium text-fg-muted hover:text-fg`,onClick:()=>R(e=>!e),children:[b.otherDirections,(0,S.jsx)(ie,{className:`size-4 transition-transform ${L?`rotate-180`:``}`})]}),L?(0,S.jsx)(`div`,{className:`mt-2 divide-y divide-edge-subtle rounded-xl border border-edge bg-surface-panel px-4`,children:Ge.map(e=>(0,S.jsxs)(`button`,{type:`button`,className:`flex w-full items-start gap-3 py-4 text-left`,onClick:()=>void X(e,!0),children:[(0,S.jsx)(m,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle`}),(0,S.jsxs)(`span`,{children:[(0,S.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.title}),(0,S.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:e.expectedTask})]})]},e.id))}):null]}):null,(0,S.jsxs)(`div`,{className:`mt-6 flex flex-wrap items-center justify-center gap-x-5 gap-y-3`,children:[(0,S.jsx)(`button`,{type:`button`,className:`text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>Y(O.sessionKey),children:b.doSomethingElse}),(0,S.jsx)(`button`,{type:`button`,className:`text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>{P(!0),T(`recognition`)},children:b.correctUnderstanding})]})]}):null,w===`error`&&O?(0,S.jsxs)(`section`,{className:`text-center`,"aria-labelledby":`work-discovery-error-title`,children:[(0,S.jsx)(`div`,{className:`mx-auto flex size-11 items-center justify-center rounded-xl bg-danger-soft text-danger`,children:(0,S.jsx)(g,{className:`size-5`})}),(0,S.jsx)(`h1`,{id:`work-discovery-error-title`,className:`mt-5 text-2xl font-semibold tracking-tight text-fg`,children:b.errorTitle}),(0,S.jsx)(`p`,{className:`mx-auto mt-3 max-w-lg text-sm leading-6 text-fg-muted`,children:O.errorMessage}),(0,S.jsxs)(`div`,{className:`mx-auto mt-7 flex max-w-md flex-col gap-3 sm:flex-row-reverse`,children:[(0,S.jsx)(c,{className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,onClick:()=>void re(O.id).then(q),children:b.retry}),(0,S.jsx)(c,{variant:`secondary`,className:`h-11 flex-1`,onClick:()=>{k(null),D(null),T(`intro`)},children:b.chooseDifferent})]}),(0,S.jsx)(`button`,{type:`button`,className:`mt-6 text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>Y(O.sessionKey),children:b.openConversation})]}):null]}),J.hasNativePicker?null:(0,S.jsx)(ee,{open:J.modalOpen,onOpenChange:J.setModalOpen,initialAbsolutePath:E?.canonicalRootPath,onConfirm:J.confirmPick,wd:_e})]})}export{xe as WorkDiscoveryPage};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{f as r,l as i}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as a}from"./check-DUBLcKHA.js";import{n as o,t as ee}from"./working-directory-picker-modal-BcyiDXU3.js";import{t as s}from"./loader-circle-CifKLtgG.js";import{t as te}from"./cn-JdwAhgNB.js";import{t as c}from"./button-CSEbl4zT.js";import{t as l}from"./messages-D7kOD_o_.js";import{n as ne}from"./locale-store-CnamlR07.js";import{$a as re,Al as ie,Ds as u,Ga as d,Hc as ae,Ja as oe,Ka as se,Kc as f,Na as p,Ol as m,Qa as ce,Xa as h,Ya as le,Yo as g,Za as _,Zc as ue,eo as de,ml as fe,no as v,qa as pe,qo as me,ro as he,to as ge}from"./index-DRrjYYzZ.js";var y=e(t(),1),b=new Set([`completed`,`failed`,`canceled`]);function _e(){return new Promise(e=>window.setTimeout(e,1200))}async function ve(e,t){let n=[],r=t.wait??_e;for(let i=0;i<e.length&&!t.shouldStop?.();i+=1){let a=e[i];if(a)try{await t.grantDirectory(a.rootPath);let o=await t.startRun(a.rootPath);for(t.onRun(o,i,e.length);!b.has(o.status)&&!t.shouldStop?.();)await r(),o=await t.fetchRun(o.id),t.onRun(o,i,e.length);if(n.push(o),o.status===`canceled`||t.shouldStop?.())break}catch(e){if(t.onError?.(e,a,i),t.shouldStop?.())break}}return n}var x=new Set([`local-recent-files`,`chromium-bookmarks`,`apple-notes`,`apple-calendar`,`apple-reminders`]);function ye(e){return new Set(e.filter(e=>e.availability===`available`&&x.has(e.id)).map(e=>e.id))}var S=n(),be=[`folder_structure`,`recent_progress`,`next_steps`];function C(e){return e instanceof Error?e.message:String(e)}function xe({embedded:e=!1,onRequestClose:t}={}){let n=ne(e=>e.language),b=l(n).onboarding.workDiscovery,_e=l(n).chat.workingDirectory,x=i(),[xe]=r(),Se=e||xe.get(`new`)===`1`,[w,T]=(0,y.useState)(`loading`),[E,D]=(0,y.useState)(null),[O,k]=(0,y.useState)(null),[A,j]=(0,y.useState)(!1),[M,N]=(0,y.useState)(null),[Ce,P]=(0,y.useState)(!1),[F,I]=(0,y.useState)(``),[L,R]=(0,y.useState)(!1),[we,z]=(0,y.useState)(()=>new Set),[B,Te]=(0,y.useState)([]),[V,Ee]=(0,y.useState)(()=>new Set),[De,H]=(0,y.useState)([]),[Oe,ke]=(0,y.useState)(!1),[U,W]=(0,y.useState)({current:0,total:0}),[Ae,je]=(0,y.useState)([]),[G,Me]=(0,y.useState)(()=>new Set),K=(0,y.useRef)(!1),Ne=e=>{Me(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};(0,y.useEffect)(()=>{let e=!1;return window.electronAPI?.understandingSources?.catalog().then(t=>{e||(je(t),Me(ye(t)))}),()=>{e=!0}},[]);let q=(0,y.useCallback)(e=>{d.getState().updateDirectoryRun(e),k(e),e.status===`completed`?(z(new Set(e.result?.profileCandidates?.filter(e=>e.status===`pending`).map(e=>e.id)??[])),T(e.feedback?.recognitionDecision===`confirmed`?`recommendation`:`recognition`)):e.status===`failed`||e.status===`canceled`?T(`error`):T(`running`)},[]),Pe=async()=>{j(!0),N(null);try{let e=await pe();if(!e.length){N(b.noCandidates);return}Te(e),Ee(new Set([e[0].rootPath])),T(`candidates`)}catch(e){N(C(e))}finally{j(!1)}},Fe=e=>{Ee(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},Ie=(0,y.useCallback)((e,t,n)=>{d.getState().updateDirectoryRun(e),k(e),W({current:t+1,total:n}),H(n=>{let r=[...n];return r[t]=e,r}),T(`running`)},[]),Le=(0,y.useCallback)(e=>{H(t=>t.map(t=>t?.id===e.id?e:t))},[]),Re=async()=>{let e=B.filter(e=>V.has(e.rootPath));if(!e.length)return;j(!0),N(null),H([]),W({current:1,total:e.length}),ke(!0),K.current=!1;let t=!1;try{let n=await ve(e,{grantDirectory:_,startRun:ge,fetchRun:h,shouldStop:()=>K.current,onRun:(e,n,r)=>{Ie(e,n,r),t||(t=!0,d.getState().collectSources(e.id,[...G]))},onError:(t,n,r)=>{W({current:r+1,total:e.length}),N(b.folderAnalysisFailed.replace(`{{folder}}`,n.displayName).replace(`{{error}}`,C(t)))}});if(K.current)return;let r=n.find(e=>e.status===`completed`)??n.at(-1);r?q(r):T(`candidates`)}catch(e){N(C(e)),T(`candidates`)}finally{ke(!1),j(!1)}},J=o({onPicked:(0,y.useCallback)(async e=>{j(!0),N(null);try{D(await ce(e)),T(`consent`)}catch(e){N(C(e)),T(`intro`)}finally{j(!1)}},[])});(0,y.useEffect)(()=>{let e=!1;return le().then(async({enabled:n,state:r})=>{if(!e){if(!n){t?t():x(`/chat`,{replace:!0});return}if(!Se&&r.activeRunId)try{let t=await h(r.activeRunId);e||q(t);return}catch{}e||T(`intro`)}}).catch(t=>{e||(N(C(t)),T(`intro`))}),()=>{e=!0}},[q,x,t,Se]),(0,y.useEffect)(()=>{if(!O||w!==`running`||Oe)return;let e=!1,t=async()=>{try{let t=await h(O.id);e||q(t)}catch{}},n=window.setInterval(()=>void t(),1200),r=e=>{let n=e.detail;(!n?.runId||n.runId===O.id)&&t()};for(let e of[`work-discovery-progress`,`work-discovery-completed`,`work-discovery-failed`,`work-discovery-canceled`])window.addEventListener(e,r);return()=>{e=!0,window.clearInterval(n);for(let e of[`work-discovery-progress`,`work-discovery-completed`,`work-discovery-failed`,`work-discovery-canceled`])window.removeEventListener(e,r)}},[q,Oe,w,O]);let ze=async()=>{j(!0);try{await oe()}finally{t?t():x(`/chat`,{replace:!0})}},Be=async()=>{if(E){j(!0),N(null),H([]),W({current:0,total:0});try{await _(E.canonicalRootPath);let e=await ge(E.canonicalRootPath);q(e),d.getState().collectSources(e.id,[...G])}catch(e){N(C(e)),T(`consent`)}finally{j(!1)}}},Y=(e,t)=>{let n=t?`?draft=${encodeURIComponent(t)}`:``;x(`/chat/${encodeURIComponent(e)}${n}`)},Ve=e=>{k(e),P(!1),R(!1),z(new Set(e.result?.profileCandidates?.filter(e=>e.status===`pending`).map(e=>e.id)??[])),e.status===`completed`?T(e.feedback?.recognitionDecision===`confirmed`?`recommendation`:`recognition`):e.status===`failed`||e.status===`canceled`?T(`error`):T(`running`)},He=async()=>{O&&(K.current=!0,q(await se(O.id)))},X=async(e,t)=>{if(!O)return;await de(O.id,e.id).catch(()=>{});let r=t?`${n===`zh`?`先帮我评估这个方向,不要修改文件:`:`First assess this direction without changing files:`}\n\n${e.actionPrompt}`:e.actionPrompt;Y(O.sessionKey,r)},Ue=async()=>{if(O){j(!0),N(null);try{let e=O.result?.profileCandidates??[],t=await v((e.length>0?await he(O.id,e.map(e=>({id:e.id,status:we.has(e.id)?`accepted`:`rejected`}))):O).id,`confirmed`);k(t),Le(t),T(`recommendation`)}catch(e){N(C(e))}finally{j(!1)}}},Z=async e=>{if(!(!O||!F.trim())){j(!0),N(null);try{let t=await v(O.id,e,F.trim());k(t),Y(t.sessionKey,F.trim())}catch(e){N(C(e)),j(!1)}}},We=async()=>{if(O){j(!0);try{Y((await v(O.id,`dismissed`)).sessionKey)}catch(e){N(C(e)),j(!1)}}},Q=O?.result?.suggestions.find(e=>e.id===O.result?.primarySuggestionId)??O?.result?.suggestions[0],Ge=O?.result?.suggestions.filter(e=>e.id!==Q?.id)??[],Ke=e=>e===`command`?b.riskCommand:e===`file_write`?b.riskFileWrite:b.riskAnalysis,qe=De.filter(e=>e?.status===`completed`),Je=e&&w===`candidates`,$=qe.length>1?(0,S.jsxs)(`div`,{className:`mt-6 rounded-xl border border-edge bg-surface-panel p-2`,children:[(0,S.jsx)(`p`,{className:`px-2 pb-2 text-xs font-medium text-fg-muted`,children:b.analysisResults}),(0,S.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:qe.map(e=>{let t=B.find(t=>t.rootPath===e.rootPath)?.displayName??e.rootPath.split(/[\\/]/).filter(Boolean).at(-1)??e.rootPath;return(0,S.jsx)(`button`,{type:`button`,className:`rounded-lg px-3 py-2 text-sm font-medium transition ${e.id===O?.id?`bg-accent text-white`:`bg-surface-muted text-fg hover:bg-surface-hover`}`,onClick:()=>Ve(e),children:t},e.id)})})]}):null;return(0,S.jsxs)(`div`,{className:e?`flex h-full min-h-0 flex-1 flex-col overflow-hidden bg-surface-base`:`flex min-h-full flex-1 flex-col bg-surface-base`,children:[(0,S.jsxs)(`main`,{className:e?`mx-auto flex h-full min-h-0 w-full max-w-[40rem] flex-1 flex-col px-5 py-7 sm:px-8 sm:py-9 ${Je?`overflow-hidden`:`overflow-y-auto [scrollbar-gutter:stable]`}`:`mx-auto flex w-full max-w-[40rem] flex-1 flex-col px-5 py-10 sm:px-8 sm:py-16`,children:[e?null:(0,S.jsx)(`div`,{className:`mb-10 flex items-center justify-center`,children:(0,S.jsx)(me,{className:`size-11`})}),w===`loading`?(0,S.jsxs)(`div`,{className:`mx-auto flex min-h-[26rem] w-full max-w-md flex-col items-center`,"aria-busy":!0,children:[(0,S.jsx)(p,{className:`h-8 w-64 max-w-full`}),(0,S.jsx)(p,{className:`mt-4 h-4 w-full max-w-sm`}),(0,S.jsx)(p,{className:`mt-2 h-4 w-4/5 max-w-xs`}),(0,S.jsx)(p,{className:`mt-10 h-12 w-full rounded-xl`}),(0,S.jsx)(p,{className:`mt-3 h-11 w-full rounded-xl`}),(0,S.jsx)(p,{className:`mt-5 h-4 w-3/5 max-w-56`})]}):null,w===`intro`?(0,S.jsxs)(`section`,{className:`flex flex-1 flex-col text-center`,"aria-labelledby":`work-discovery-title`,children:[(0,S.jsxs)(`div`,{className:`mx-auto max-w-[36rem]`,children:[(0,S.jsx)(`h1`,{id:`work-discovery-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:b.title}),(0,S.jsx)(`p`,{className:`mx-auto mt-3 max-w-[34rem] text-[0.95rem] leading-7 text-fg-muted`,children:b.subtitle})]}),(0,S.jsxs)(`div`,{className:`mx-auto mt-9 w-full max-w-md`,children:[Ae.length?(0,S.jsxs)(`div`,{className:`mb-5 rounded-xl border border-edge bg-surface-panel p-3 text-left`,children:[(0,S.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:b.localSourcesTitle}),(0,S.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:b.localSourcesSubtitle}),(0,S.jsx)(`div`,{className:`mt-3 grid grid-cols-2 gap-2 sm:grid-cols-3`,children:Ae.map(e=>{let t=G.has(e.id);return(0,S.jsxs)(`button`,{type:`button`,className:te(`flex min-h-16 flex-col items-center justify-center gap-1 rounded-lg border px-2 py-2 text-xs font-medium transition-colors`,t?`border-accent/40 bg-accent-soft text-accent-fg`:`border-edge bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg`),"aria-pressed":t,onClick:()=>Ne(e.id),children:[(0,S.jsx)(`span`,{className:te(`flex size-4 items-center justify-center rounded-full border`,t?`border-accent bg-accent text-white`:`border-edge`),children:t?(0,S.jsx)(a,{className:`size-3`,"aria-hidden":!0}):null}),e.displayName]},e.id)})})]}):null,(0,S.jsxs)(c,{type:`button`,className:`h-12 w-full gap-2 bg-accent text-white hover:bg-accent-hover`,onClick:()=>void Pe(),disabled:A||J.picking,children:[A?(0,S.jsx)(s,{className:`size-4 animate-spin`}):(0,S.jsx)(u,{className:`size-4`}),b.quickScan]}),(0,S.jsxs)(c,{type:`button`,variant:`secondary`,className:`mt-3 h-11 w-full gap-2`,onClick:J.pick,disabled:A||J.picking,children:[J.picking?(0,S.jsx)(s,{className:`size-4 animate-spin`}):(0,S.jsx)(f,{className:`size-4`}),b.chooseFolderManually]}),(0,S.jsxs)(`div`,{className:`mt-4 flex items-start justify-center gap-2 text-xs leading-5 text-fg-muted`,children:[(0,S.jsx)(u,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,S.jsx)(`span`,{children:b.quickScanNote})]}),(0,S.jsx)(`button`,{type:`button`,className:`mt-4 text-sm font-medium text-accent-fg hover:underline`,onClick:()=>x(`/connectors?understanding=1&returnTo=%2Fonboarding%2Fworkspace`),children:b.connectCloudSource}),M?(0,S.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:M}):null]}),(0,S.jsx)(`button`,{type:`button`,className:`mx-auto mt-auto pt-10 text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>void ze(),disabled:A,children:b.skip})]}):null,w===`candidates`?(0,S.jsxs)(`section`,{className:e?`flex h-full min-h-0 flex-col`:void 0,"aria-labelledby":`work-discovery-candidates-title`,children:[(0,S.jsxs)(`div`,{className:e?`shrink-0 text-center`:`text-center`,children:[(0,S.jsx)(`h1`,{id:`work-discovery-candidates-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:b.candidatesTitle}),(0,S.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:b.candidatesSubtitle})]}),(0,S.jsx)(`div`,{className:e?`mt-5 min-h-0 flex-1 space-y-2 overflow-y-auto overscroll-contain pr-1 [scrollbar-gutter:stable]`:`mt-7 space-y-2`,children:B.map((e,t)=>{let n=V.has(e.rootPath);return(0,S.jsxs)(`button`,{type:`button`,"aria-pressed":n,className:`flex w-full items-start gap-3 rounded-xl border p-4 text-left transition ${n?`border-accent bg-accent-soft/45`:`border-edge bg-surface-panel hover:border-edge-strong`}`,onClick:()=>Fe(e.rootPath),children:[(0,S.jsx)(`span`,{className:`mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-md border ${n?`border-accent bg-accent text-white`:`border-edge bg-surface-base text-transparent`}`,children:(0,S.jsx)(a,{className:`size-3.5`})}),(0,S.jsx)(f,{className:`mt-0.5 size-5 shrink-0 text-accent-fg`}),(0,S.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,S.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.displayName}),t===0?(0,S.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[0.7rem] font-medium text-accent-fg`,children:b.recommendedCandidate}):null]}),(0,S.jsx)(`span`,{className:`mt-1 block truncate font-mono text-xs text-fg-muted`,children:e.rootPath}),(0,S.jsxs)(`span`,{className:`mt-2 flex flex-wrap gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[(0,S.jsx)(`span`,{children:e.projectKind===`coding`?b.codingProject:e.projectKind===`general`?b.generalProject:b.unknownProject}),e.branch?(0,S.jsx)(`span`,{children:b.branchValue.replace(`{{branch}}`,e.branch)}):null,e.changedFileCount>0?(0,S.jsx)(`span`,{children:b.changedFiles.replace(`{{count}}`,String(e.changedFileCount))}):null]})]})]},e.id)})}),(0,S.jsxs)(`div`,{className:e?`shrink-0 border-t border-edge-subtle pt-4`:void 0,children:[(0,S.jsxs)(`div`,{className:`${e?``:`mt-5 `}flex items-start gap-2 rounded-xl border border-edge-subtle bg-surface-panel px-4 py-3 text-xs leading-5 text-fg-muted`,children:[(0,S.jsx)(u,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,S.jsx)(`span`,{children:b.multiFolderPrivacyNote})]}),M?(0,S.jsx)(`p`,{className:`mt-3 text-sm text-danger`,role:`alert`,children:M}):null,(0,S.jsxs)(`div`,{className:`${e?`mt-4`:`mt-7`} flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,S.jsxs)(c,{type:`button`,className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:A||V.size===0,onClick:()=>void Re(),children:[A?(0,S.jsx)(s,{className:`mr-2 size-4 animate-spin`}):null,b.analyzeSelected.replace(`{{count}}`,String(V.size))]}),(0,S.jsx)(c,{type:`button`,variant:`secondary`,className:`h-11 flex-1`,disabled:A,onClick:J.pick,children:b.chooseFolderManually})]}),(0,S.jsx)(`button`,{type:`button`,className:`${e?`mt-3`:`mt-6`} mx-auto block text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>T(`intro`),children:b.back})]})]}):null,w===`consent`&&E?(0,S.jsxs)(`section`,{"aria-labelledby":`work-discovery-consent-title`,children:[(0,S.jsxs)(`div`,{className:`text-center`,children:[(0,S.jsx)(`h1`,{id:`work-discovery-consent-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:b.selectedTitle}),(0,S.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:b.selectedSubtitle})]}),(0,S.jsxs)(`div`,{className:`mt-8 overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-edge-subtle px-4 py-3.5`,children:[(0,S.jsx)(f,{className:`size-5 shrink-0 text-accent-fg`}),(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:E.displayName}),(0,S.jsx)(`p`,{className:`truncate font-mono text-xs text-fg-muted`,children:E.canonicalRootPath})]}),(0,S.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2.5 py-1 text-xs font-medium text-accent-fg`,children:E.projectKind===`coding`?b.codingProject:E.projectKind===`general`?b.generalProject:b.unknownProject})]}),(0,S.jsxs)(`div`,{className:`grid gap-3 border-b border-edge-subtle bg-surface-base/60 p-4 sm:grid-cols-2`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:b.localFingerprint}),(0,S.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:E.fingerprint.branch?b.branchValue.replace(`{{branch}}`,E.fingerprint.branch):b.noGitBranch})]}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:b.recentActivity}),(0,S.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:b.changedFiles.replace(`{{count}}`,String(E.fingerprint.changedFileCount))})]}),E.fingerprint.recentAreas.length>0?(0,S.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,S.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:b.recentAreas}),(0,S.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:E.fingerprint.recentAreas.map(e=>(0,S.jsx)(`code`,{className:`rounded-md bg-surface-muted px-2 py-1 text-xs text-fg`,children:e},e))})]}):null]}),(0,S.jsxs)(`div`,{className:`divide-y divide-edge-subtle px-4`,children:[(0,S.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,S.jsx)(ue,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:b.willRead}),(0,S.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:b.willReadValue})]})]}),(0,S.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,S.jsx)(g,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:b.willIgnore}),(0,S.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:b.willIgnoreValue})]})]}),(0,S.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,S.jsx)(u,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,S.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:E.remoteModel?b.providerDisclosure.replace(`{{provider}}`,E.provider):b.localDisclosure})]})]})]}),M?(0,S.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:M}):null,(0,S.jsxs)(`div`,{className:`mt-7 flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,S.jsxs)(c,{type:`button`,className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:A,onClick:()=>void Be(),children:[A?(0,S.jsx)(s,{className:`mr-2 size-4 animate-spin`}):null,b.startAnalysis]}),(0,S.jsx)(c,{type:`button`,variant:`secondary`,className:`h-11 flex-1`,disabled:A,onClick:J.pick,children:b.changeFolder})]}),(0,S.jsx)(`button`,{type:`button`,className:`mx-auto mt-6 block text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>void ze(),children:b.skip})]}):null,w===`running`&&O?(0,S.jsxs)(`section`,{"aria-labelledby":`work-discovery-running-title`,"aria-live":`polite`,children:[(0,S.jsxs)(`div`,{className:`text-center`,children:[(0,S.jsx)(`h1`,{id:`work-discovery-running-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:b.analyzingTitle}),(0,S.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:b.analyzingSubtitle}),U.total>1?(0,S.jsx)(`p`,{className:`mt-2 text-sm font-medium text-accent-fg`,children:b.analyzingFolderProgress.replace(`{{current}}`,String(U.current)).replace(`{{total}}`,String(U.total))}):null]}),(0,S.jsx)(`div`,{className:`mt-9 rounded-xl border border-edge bg-surface-panel px-5 py-2`,children:be.map((e,t)=>{let n=Math.max(0,be.indexOf(O.stage??`folder_structure`)),r=t<n,i=t===n;return(0,S.jsxs)(`div`,{className:`flex items-center gap-4 border-b border-edge-subtle py-4 last:border-b-0`,children:[(0,S.jsx)(`span`,{className:`flex size-7 items-center justify-center rounded-full ${r?`bg-accent text-white`:i?`bg-accent-soft text-accent-fg`:`bg-surface-muted text-fg-subtle`}`,children:r?(0,S.jsx)(a,{className:`size-4`}):i?(0,S.jsx)(s,{className:`size-4 animate-spin motion-reduce:animate-none`}):(0,S.jsx)(`span`,{className:`size-1.5 rounded-full bg-current`})}),(0,S.jsx)(`span`,{className:i||r?`text-sm font-medium text-fg`:`text-sm text-fg-muted`,children:b.stages[e]})]},e)})}),(0,S.jsx)(`p`,{className:`mt-4 truncate text-center font-mono text-xs text-fg-muted`,children:O.rootPath}),(0,S.jsxs)(`div`,{className:`mx-auto mt-7 flex max-w-md flex-col gap-3`,children:[(0,S.jsx)(c,{type:`button`,variant:`secondary`,className:`h-11 w-full`,onClick:()=>x(`/chat`),children:b.continueInBackground}),(0,S.jsx)(`button`,{type:`button`,className:`mx-auto text-sm text-fg-muted hover:text-danger hover:underline`,onClick:()=>void He(),children:b.cancelAnalysis})]})]}):null,w===`recognition`&&O?.result?(0,S.jsxs)(`section`,{"aria-labelledby":`work-discovery-recognition-title`,children:[(0,S.jsxs)(`div`,{className:`text-center`,children:[(0,S.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.16em] text-accent-fg`,children:b.recognitionEyebrow}),(0,S.jsx)(`h1`,{id:`work-discovery-recognition-title`,className:`mt-2 text-2xl font-semibold tracking-tight text-fg`,children:O.result.lowConfidence?b.lowConfidenceTitle:b.recognitionTitle})]}),$,(0,S.jsxs)(`div`,{className:`mt-7 rounded-2xl border border-accent/25 bg-gradient-to-br from-accent-soft/45 via-surface-panel to-surface-panel p-5 sm:p-6`,children:[(0,S.jsx)(`p`,{className:`text-base font-medium leading-7 text-fg`,children:O.result.projectSummary}),(0,S.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:O.result.currentState}),!O.result.lowConfidence&&Q?.evidence.length?(0,S.jsx)(`ul`,{className:`mt-5 space-y-2 border-t border-edge-subtle pt-4`,children:Q.evidence.slice(0,3).map((e,t)=>(0,S.jsxs)(`li`,{className:`flex gap-2 text-xs leading-5 text-fg-muted`,children:[(0,S.jsx)(ae,{className:`mt-0.5 size-3.5 shrink-0 text-accent-fg`}),(0,S.jsxs)(`span`,{children:[e.path?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`code`,{className:`font-mono text-fg`,children:e.path}),`: `]}):null,e.observation]})]},`${Q.id}-recognition-${t}`))}):null]}),O.result.workThreads?.length?(0,S.jsxs)(`div`,{className:`mt-5 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,S.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:b.workThreadsTitle}),(0,S.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:b.workThreadsSubtitle}),(0,S.jsx)(`div`,{className:`mt-3 divide-y divide-edge-subtle`,children:O.result.workThreads.map(e=>(0,S.jsxs)(`div`,{className:`py-3 first:pt-0 last:pb-0`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[0.7rem] font-medium text-accent-fg`,children:e.horizon===`current`?b.workThreadCurrent:e.horizon===`ongoing`?b.workThreadOngoing:b.workThreadLongTerm}),(0,S.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.title})]}),(0,S.jsx)(`p`,{className:`mt-1.5 text-xs leading-5 text-fg-muted`,children:e.summary})]},e.id))})]}):null,O.result.profileCandidates?.length?(0,S.jsxs)(`div`,{className:`mt-5 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,S.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:b.profileCandidatesTitle}),(0,S.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:b.profileCandidatesSubtitle}),(0,S.jsx)(`div`,{className:`mt-3 space-y-2`,children:O.result.profileCandidates.map(e=>(0,S.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 rounded-lg px-2 py-2 hover:bg-surface-muted`,children:[(0,S.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 size-4 rounded border-edge accent-accent`,checked:we.has(e.id),onChange:()=>z(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n})}),(0,S.jsx)(`span`,{className:`text-sm leading-5 text-fg`,children:e.statement})]},e.id))})]}):null,O.result.lowConfidence?(0,S.jsxs)(`div`,{className:`mt-5`,children:[(0,S.jsx)(`p`,{className:`text-sm font-medium leading-6 text-fg`,children:O.result.contextQuestion}),(0,S.jsx)(`textarea`,{value:F,onChange:e=>I(e.target.value),placeholder:b.correctionPlaceholder,className:`mt-3 min-h-24 w-full resize-y rounded-xl border border-edge bg-surface-panel px-3 py-2.5 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/15`}),(0,S.jsx)(c,{className:`mt-3 w-full bg-accent text-white hover:bg-accent-hover`,disabled:A||!F.trim(),onClick:()=>void Z(`different_goal`),children:b.continueWithCorrection})]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`div`,{className:`mt-6 flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,S.jsxs)(c,{className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:A,onClick:()=>void Ue(),children:[A?(0,S.jsx)(s,{className:`size-4 animate-spin`}):(0,S.jsx)(a,{className:`size-4`}),b.confirmUnderstanding]}),(0,S.jsx)(c,{variant:`secondary`,className:`h-11 flex-1`,disabled:A,onClick:()=>P(e=>!e),children:b.notQuiteRight})]}),Ce?(0,S.jsxs)(`div`,{className:`mt-4 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,S.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`work-discovery-correction`,children:b.correctionLabel}),(0,S.jsx)(`textarea`,{id:`work-discovery-correction`,value:F,onChange:e=>I(e.target.value),placeholder:b.correctionPlaceholder,className:`mt-2 min-h-24 w-full resize-y rounded-lg border border-edge bg-surface-base px-3 py-2.5 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/15`}),(0,S.jsxs)(`div`,{className:`mt-3 flex flex-wrap justify-end gap-2`,children:[(0,S.jsx)(c,{variant:`ghost`,disabled:A||!F.trim(),onClick:()=>void Z(`different_goal`),children:b.differentGoal}),(0,S.jsx)(c,{variant:`primary`,disabled:A||!F.trim(),onClick:()=>void Z(`corrected`),children:b.useCorrection})]})]}):null]}),M?(0,S.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:M}):null,(0,S.jsx)(`button`,{type:`button`,disabled:A,className:`mx-auto mt-6 block text-sm text-fg-muted hover:text-fg hover:underline disabled:opacity-60`,onClick:()=>void We(),children:b.openConversation})]}):null,w===`recommendation`&&O?.result&&Q?(0,S.jsxs)(`section`,{"aria-labelledby":`work-discovery-recommendation-title`,children:[(0,S.jsxs)(`div`,{className:`text-center`,children:[(0,S.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.16em] text-accent-fg`,children:b.understandingConfirmed}),(0,S.jsx)(`h1`,{id:`work-discovery-recommendation-title`,className:`mt-2 text-2xl font-semibold tracking-tight text-fg`,children:b.primaryRecommendationTitle})]}),$,(0,S.jsx)(`article`,{className:`mt-7 rounded-2xl border border-accent/30 bg-surface-panel p-5 sm:p-6`,children:(0,S.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,S.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,S.jsx)(m,{className:`size-5`})}),(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsx)(`h2`,{className:`text-lg font-semibold text-fg`,children:Q.title}),(0,S.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:Q.rationale}),(0,S.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2 text-xs`,children:[(0,S.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full bg-surface-muted px-2.5 py-1 text-fg-muted`,children:[(0,S.jsx)(fe,{className:`size-3.5`}),b.estimatedMinutes.replace(`{{count}}`,String(Q.estimatedMinutes))]}),(0,S.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2.5 py-1 text-fg-muted`,children:Ke(Q.risk)})]}),(0,S.jsxs)(`div`,{className:`mt-4 rounded-xl bg-surface-base px-4 py-3`,children:[(0,S.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:b.expectedTask}),(0,S.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg`,children:Q.expectedTask})]}),(0,S.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:[(0,S.jsx)(c,{className:`h-10 bg-accent px-4 text-white hover:bg-accent-hover`,onClick:()=>void X(Q,!1),children:b.startRecommendedAction}),(0,S.jsx)(c,{className:`h-10 px-4`,variant:`secondary`,onClick:()=>void X(Q,!0),children:b.explainFirst})]})]})]})}),Ge.length>0?(0,S.jsxs)(`div`,{className:`mt-5 border-t border-edge-subtle pt-4`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between py-2 text-sm font-medium text-fg-muted hover:text-fg`,onClick:()=>R(e=>!e),children:[b.otherDirections,(0,S.jsx)(ie,{className:`size-4 transition-transform ${L?`rotate-180`:``}`})]}),L?(0,S.jsx)(`div`,{className:`mt-2 divide-y divide-edge-subtle rounded-xl border border-edge bg-surface-panel px-4`,children:Ge.map(e=>(0,S.jsxs)(`button`,{type:`button`,className:`flex w-full items-start gap-3 py-4 text-left`,onClick:()=>void X(e,!0),children:[(0,S.jsx)(m,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle`}),(0,S.jsxs)(`span`,{children:[(0,S.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.title}),(0,S.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:e.expectedTask})]})]},e.id))}):null]}):null,(0,S.jsxs)(`div`,{className:`mt-6 flex flex-wrap items-center justify-center gap-x-5 gap-y-3`,children:[(0,S.jsx)(`button`,{type:`button`,className:`text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>Y(O.sessionKey),children:b.doSomethingElse}),(0,S.jsx)(`button`,{type:`button`,className:`text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>{P(!0),T(`recognition`)},children:b.correctUnderstanding})]})]}):null,w===`error`&&O?(0,S.jsxs)(`section`,{className:`text-center`,"aria-labelledby":`work-discovery-error-title`,children:[(0,S.jsx)(`div`,{className:`mx-auto flex size-11 items-center justify-center rounded-xl bg-danger-soft text-danger`,children:(0,S.jsx)(g,{className:`size-5`})}),(0,S.jsx)(`h1`,{id:`work-discovery-error-title`,className:`mt-5 text-2xl font-semibold tracking-tight text-fg`,children:b.errorTitle}),(0,S.jsx)(`p`,{className:`mx-auto mt-3 max-w-lg text-sm leading-6 text-fg-muted`,children:O.errorMessage}),(0,S.jsxs)(`div`,{className:`mx-auto mt-7 flex max-w-md flex-col gap-3 sm:flex-row-reverse`,children:[(0,S.jsx)(c,{className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,onClick:()=>void re(O.id).then(q),children:b.retry}),(0,S.jsx)(c,{variant:`secondary`,className:`h-11 flex-1`,onClick:()=>{k(null),D(null),T(`intro`)},children:b.chooseDifferent})]}),(0,S.jsx)(`button`,{type:`button`,className:`mt-6 text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>Y(O.sessionKey),children:b.openConversation})]}):null]}),J.hasNativePicker?null:(0,S.jsx)(ee,{open:J.modalOpen,onOpenChange:J.setModalOpen,initialAbsolutePath:E?.canonicalRootPath,onConfirm:J.confirmPick,wd:_e})]})}export{xe as WorkDiscoveryPage};
@@ -1,3 +1,3 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{n as i,r as a}from"./popover-select-BzdnTy3h.js";import{t as o}from"./cn-JdwAhgNB.js";import{t as s}from"./button-CSEbl4zT.js";import{t as c}from"./messages-3qRsLZuX.js";import{o as l,r as u}from"./locale-store-xULEcFVs.js";import{a as d,n as f,o as p,r as m,s as h,t as g}from"./dist-BPoKqzeH.js";import{Al as _,Ar as v,Dc as y,Jr as b,Ls as x,Ss as S,Tr as C,Yo as w,Yr as T,bs as E,ns as D,ps as O,tl as k,wi as A,ws as j,zr as M}from"./index-CCK8zdlS.js";var N=e(t(),1),P=n();function F(e){if(!e.trim())return null;try{return JSON.parse(e)}catch{return null}}function I(e){return typeof e.message==`string`&&e.message.trim()?e.message:typeof e.error==`string`&&e.error.trim()?e.error:e.error&&typeof e.error==`object`&&typeof e.error.message==`string`?e.error.message:`AI suggestion failed`}function L(e,t={}){let n=F(e.split(`
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{n as i,r as a}from"./popover-select-BzdnTy3h.js";import{t as o}from"./cn-JdwAhgNB.js";import{t as s}from"./button-CSEbl4zT.js";import{t as c}from"./messages-D7kOD_o_.js";import{o as l,r as u}from"./locale-store-CnamlR07.js";import{a as d,n as f,o as p,r as m,s as h,t as g}from"./dist-BPoKqzeH.js";import{Al as _,Ar as v,Dc as y,Jr as b,Ls as x,Ss as S,Tr as C,Yo as w,Yr as T,bs as E,ns as D,ps as O,tl as k,wi as A,ws as j,zr as M}from"./index-DRrjYYzZ.js";var N=e(t(),1),P=n();function F(e){if(!e.trim())return null;try{return JSON.parse(e)}catch{return null}}function I(e){return typeof e.message==`string`&&e.message.trim()?e.message:typeof e.error==`string`&&e.error.trim()?e.error:e.error&&typeof e.error==`object`&&typeof e.error.message==`string`?e.error.message:`AI suggestion failed`}function L(e,t={}){let n=F(e.split(`
2
2
  `).filter(e=>e.startsWith(`data:`)).map(e=>e.slice(5).trimStart()).join(`
3
3
  `));if(!n)return null;if(n.type===`text_delta`&&typeof n.delta==`string`)return t.onDelta?.(n.delta),null;if(n.type===`thinking_delta`&&typeof n.delta==`string`)return t.onThinkingDelta?.(n.delta),null;if(n.type===`done`&&typeof n.text==`string`)return n.text;if(n.type===`error`)throw Error(I(n));return null}async function R(e,t={}){let n=await l(u(`/api/ai/text-assist`),{method:`POST`,headers:{Accept:`text/event-stream`},body:JSON.stringify(e)});if(!n.ok){let e=await n.json().catch(()=>({})),t=typeof e.error==`string`?e.error:e.error?.message;throw Error(t||`AI suggestion failed (${n.status})`)}if(!n.body){let e=await n.json().catch(()=>null);if(e?.text)return e;throw Error(`AI suggestion stream is empty`)}let r=n.body.getReader(),i=new TextDecoder,a=``,o=``,s=``;for(;;){let{done:e,value:n}=await r.read();if(n){a+=i.decode(n,{stream:!e});let r=a.split(/\r?\n\r?\n/);a=r.pop()??``;for(let e of r){let n=L(e,{onDelta:e=>{o+=e,t.onDelta?.(e)},onThinkingDelta:e=>{s+=e,t.onThinkingDelta?.(e)}});n!==null&&(o=n)}}if(e)break}if(a.trim()){let e=L(a,{onDelta:e=>{o+=e,t.onDelta?.(e)},onThinkingDelta:e=>{s+=e,t.onThinkingDelta?.(e)}});e!==null&&(o=e)}let c=o.trim();if(!c)throw Error(`AI returned an empty suggestion`);return{text:c,thinking:s.trim()||void 0}}function ee(){let[e,t]=(0,N.useState)(``),[n,r]=(0,N.useState)(``),[i,a]=(0,N.useState)(!1),[o,s]=(0,N.useState)(null);return{suggestion:e,thinking:n,loading:i,error:o,generate:(0,N.useCallback)(async e=>{a(!0),s(null),t(``),r(``);try{let n=await R(e,{onDelta:e=>{t(t=>t+e)},onThinkingDelta:e=>{r(t=>t+e)}});return t(n.text),r(n.thinking??``),n.text}catch(e){return s(e instanceof Error?e.message:`AI suggestion failed`),null}finally{a(!1)}},[]),reset:(0,N.useCallback)(()=>{t(``),r(``),s(null),a(!1)},[])}}var z=r(),te=5;function ne(e){return e.startsWith(`zh`)?{title:`AI 优化文案`,buttonTitle:`优化文案`,current:`当前内容`,suggestion:`AI 建议`,editedSuggestion:`审核并编辑建议`,thinking:`模型思考`,thinkingLoading:`思考中`,edit:`编辑`,preview:`预览`,loading:`正在生成建议...`,empty:`暂无内容`,generate:`生成建议`,regenerate:`重新生成`,applyCurrent:`应用当前内容`,replace:`替换`,append:`追加`,cancel:`取消`,close:`关闭`}:{title:`AI text assist`,buttonTitle:`Improve text`,current:`Current`,suggestion:`Suggestion`,editedSuggestion:`Review and edit suggestion`,thinking:`Model thinking`,thinkingLoading:`Thinking`,edit:`Edit`,preview:`Preview`,loading:`Generating suggestion...`,empty:`No content`,generate:`Generate suggestion`,regenerate:`Regenerate`,applyCurrent:`Apply current`,replace:`Replace`,append:`Append`,cancel:`Cancel`,close:`Close`}}function B(e){let t=(0,P.c)(239),{value:n,onApply:r,fieldId:i,fieldLabel:a,scenario:c,format:l,intent:u,locale:v,context:y,disabled:b,className:C,showLabel:T}=e,D=c===void 0?`generic.text`:c,O=l===void 0?`plain`:l,j=u===void 0?`improve`:u,M=T===void 0?!0:T,[F,I]=(0,N.useState)(!1),[L,R]=(0,N.useState)(n),[B,V]=(0,N.useState)(`preview`),[H,U]=(0,N.useState)(``),[W,ae]=(0,N.useState)(`edit`),[G,K]=(0,N.useState)(!0),[oe,se]=(0,N.useState)(!1),[ce,q]=(0,N.useState)(null),le=(0,N.useRef)(null),ue=(0,N.useRef)(!0),{suggestion:de,thinking:J,loading:Y,error:X,generate:fe,reset:pe}=ee(),me;t[0]===v?me=t[1]:(me=ne(v),t[0]=v,t[1]=me);let Z=me,he;t[2]!==Y||t[3]!==J?(he=Y&&J.trim().length>0,t[2]=Y,t[3]=J,t[4]=he):he=t[4];let Q=he,ge,_e;t[5]!==F||t[6]!==n?(ge=()=>{F||R(n)},_e=[F,n],t[5]=F,t[6]=n,t[7]=ge,t[8]=_e):(ge=t[7],_e=t[8]),(0,N.useEffect)(ge,_e);let ve,ye;t[9]===de?(ve=t[10],ye=t[11]):(ye=()=>{U(de)},ve=[de],t[9]=de,t[10]=ve,t[11]=ye),(0,N.useEffect)(ye,ve);let be,xe;t[12]===J?(be=t[13],xe=t[14]):(be=()=>{J.trim()&&K(!0)},xe=[J],t[12]=J,t[13]=be,t[14]=xe),(0,N.useEffect)(be,xe);let Se;t[15]!==Q||t[16]!==G?(Se=()=>{let e=le.current;!e||!Q||!G||ue.current&&(e.scrollTop=e.scrollHeight)},t[15]=Q,t[16]=G,t[17]=Se):Se=t[17];let Ce;t[18]!==Q||t[19]!==J||t[20]!==G?(Ce=[Q,J,G],t[18]=Q,t[19]=J,t[20]=G,t[21]=Ce):Ce=t[21],(0,N.useLayoutEffect)(Se,Ce);let we;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(we=()=>{let e=le.current;e&&(ue.current=e.scrollHeight-e.scrollTop-e.clientHeight<=te)},t[22]=we):we=t[22];let Te=we,Ee;t[23]!==y||t[24]!==i||t[25]!==a||t[26]!==O||t[27]!==fe||t[28]!==j||t[29]!==v||t[30]!==D?(Ee=async e=>{ae(`edit`),K(!0),ue.current=!0,await fe({intent:j,scenario:D,input:e,locale:v,field:{id:i,label:a,format:O},context:y})},t[23]=y,t[24]=i,t[25]=a,t[26]=O,t[27]=fe,t[28]=j,t[29]=v,t[30]=D,t[31]=Ee):Ee=t[31];let De=Ee,Oe;t[32]!==pe||t[33]!==n?(Oe=e=>{se(!!e.currentTarget.closest(`[role="dialog"]`)),q(document.querySelector(`.app-main-surface`)),R(n),V(`preview`),U(``),ae(`edit`),K(!0),pe(),I(!0)},t[32]=pe,t[33]=n,t[34]=Oe):Oe=t[34];let ke=Oe,Ae;t[35]!==L||t[36]!==De?(Ae=async()=>{await De(L)},t[35]=L,t[36]=De,t[37]=Ae):Ae=t[37];let je=Ae,Me;t[38]!==pe||t[39]!==n?(Me=()=>{I(!1),R(n),V(`preview`),U(``),ae(`edit`),K(!0),pe()},t[38]=pe,t[39]=n,t[40]=Me):Me=t[40];let $=Me,Ne;t[41]!==$||t[42]!==L||t[43]!==r?(Ne=()=>{r(L),$()},t[41]=$,t[42]=L,t[43]=r,t[44]=Ne):Ne=t[44];let Pe=Ne,Fe;t[45]!==$||t[46]!==H||t[47]!==r?(Fe=()=>{H.trim()&&(r(H),$())},t[45]=$,t[46]=H,t[47]=r,t[48]=Fe):Fe=t[48];let Ie=Fe,Le;t[49]!==$||t[50]!==L||t[51]!==H||t[52]!==r?(Le=()=>{if(!H.trim())return;let e=L.trimEnd();r(e?`${e}\n\n${H}`:H),$()},t[49]=$,t[50]=L,t[51]=H,t[52]=r,t[53]=Le):Le=t[53];let Re=Le,ze;t[54]!==H||t[55]!==X||t[56]!==Y?(ze=!Y&&!X&&H.trim().length>0,t[54]=H,t[55]=X,t[56]=Y,t[57]=ze):ze=t[57];let Be=ze,Ve=L!==n,He;t[58]!==H||t[59]!==X||t[60]!==J?(He=H.trim().length>0||J.trim().length>0||!!X,t[58]=H,t[59]=X,t[60]=J,t[61]=He):He=t[61];let Ue=He,We=!M&&`size-7 p-0`,Ge;t[62]!==C||t[63]!==We?(Ge=o(`h-7 gap-1 px-2 text-xs`,We,C),t[62]=C,t[63]=We,t[64]=Ge):Ge=t[64];let Ke=b||Y,qe;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(qe=(0,z.jsx)(S,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[65]=qe):qe=t[65];let Je=M?Z.buttonTitle:null,Ye;t[66]!==Z.buttonTitle||t[67]!==ke||t[68]!==Ge||t[69]!==Ke||t[70]!==Je?(Ye=(0,z.jsxs)(s,{type:`button`,variant:`ghost`,className:Ge,title:Z.buttonTitle,"aria-label":Z.buttonTitle,disabled:Ke,onClick:ke,children:[qe,Je]}),t[66]=Z.buttonTitle,t[67]=ke,t[68]=Ge,t[69]=Ke,t[70]=Je,t[71]=Ye):Ye=t[71];let Xe;t[72]===$?Xe=t[73]:(Xe=e=>e?I(!0):$(),t[72]=$,t[73]=Xe);let Ze=ce??void 0,Qe=oe?`bg-transparent`:`bg-scrim`,$e;t[74]===Qe?$e=t[75]:($e=o(`xopc-dialog-overlay absolute inset-0 z-[80]`,Qe),t[74]=Qe,t[75]=$e);let et;t[76]===$e?et=t[77]:(et=(0,z.jsx)(d,{className:$e}),t[76]=$e,t[77]=et);let tt;t[78]===Z.title?tt=t[79]:(tt=(0,z.jsx)(h,{className:`text-base font-semibold text-fg`,children:Z.title}),t[78]=Z.title,t[79]=tt);let nt;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(nt=(0,z.jsx)(w,{className:`size-5`,strokeWidth:1.75}),t[80]=nt):nt=t[80];let rt;t[81]===Z.close?rt=t[82]:(rt=(0,z.jsx)(f,{asChild:!0,children:(0,z.jsx)(s,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":Z.close,children:nt})}),t[81]=Z.close,t[82]=rt);let it;t[83]!==tt||t[84]!==rt?(it=(0,z.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[tt,rt]}),t[83]=tt,t[84]=rt,t[85]=it):it=t[85];let at;t[86]===Z.current?at=t[87]:(at=(0,z.jsx)(`div`,{className:`min-w-0 text-xs font-medium text-fg-muted`,children:Z.current}),t[86]=Z.current,t[87]=at);let ot=B===`edit`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,st;t[88]===ot?st=t[89]:(st=o(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,ot),t[88]=ot,t[89]=st);let ct,lt;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(ct=()=>V(`edit`),lt=(0,z.jsx)(E,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[90]=ct,t[91]=lt):(ct=t[90],lt=t[91]);let ut;t[92]!==Z.edit||t[93]!==st?(ut=(0,z.jsxs)(`button`,{type:`button`,className:st,onClick:ct,children:[lt,Z.edit]}),t[92]=Z.edit,t[93]=st,t[94]=ut):ut=t[94];let dt=B===`preview`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,ft;t[95]===dt?ft=t[96]:(ft=o(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,dt),t[95]=dt,t[96]=ft);let pt,mt;t[97]===Symbol.for(`react.memo_cache_sentinel`)?(pt=()=>V(`preview`),mt=(0,z.jsx)(k,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[97]=pt,t[98]=mt):(pt=t[97],mt=t[98]);let ht;t[99]!==Z.preview||t[100]!==ft?(ht=(0,z.jsxs)(`button`,{type:`button`,className:ft,onClick:pt,children:[mt,Z.preview]}),t[99]=Z.preview,t[100]=ft,t[101]=ht):ht=t[101];let gt;t[102]!==ut||t[103]!==ht?(gt=(0,z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 rounded-lg border border-edge bg-surface-muted p-0.5`,children:[ut,ht]}),t[102]=ut,t[103]=ht,t[104]=gt):gt=t[104];let _t;t[105]!==at||t[106]!==gt?(_t=(0,z.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[at,gt]}),t[105]=at,t[106]=gt,t[107]=_t):_t=t[107];let vt;t[108]!==L||t[109]!==B||t[110]!==O||t[111]!==Z.current||t[112]!==Z.empty?(vt=B===`preview`?(0,z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg`,children:O===`markdown`?(0,z.jsx)(A,{content:L||Z.empty,compact:!0,className:`text-sm`}):(0,z.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg`,children:L||Z.empty})}):(0,z.jsx)(`textarea`,{className:`min-h-0 flex-1 resize-none overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/25`,value:L,onChange:e=>R(e.currentTarget.value),placeholder:Z.empty,"aria-label":Z.current}),t[108]=L,t[109]=B,t[110]=O,t[111]=Z.current,t[112]=Z.empty,t[113]=vt):vt=t[113];let yt;t[114]!==_t||t[115]!==vt?(yt=(0,z.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-hidden`,children:[_t,vt]}),t[114]=_t,t[115]=vt,t[116]=yt):yt=t[116];let bt;t[117]===Z.editedSuggestion?bt=t[118]:(bt=(0,z.jsx)(`span`,{children:Z.editedSuggestion}),t[117]=Z.editedSuggestion,t[118]=bt);let xt;t[119]!==Z.loading||t[120]!==Y?(xt=Y?(0,z.jsx)(`span`,{className:`ml-2 font-normal`,children:Z.loading}):null,t[119]=Z.loading,t[120]=Y,t[121]=xt):xt=t[121];let St;t[122]!==bt||t[123]!==xt?(St=(0,z.jsxs)(`div`,{className:`min-w-0 text-xs font-medium text-fg-muted`,children:[bt,xt]}),t[122]=bt,t[123]=xt,t[124]=St):St=t[124];let Ct=W===`edit`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,wt;t[125]===Ct?wt=t[126]:(wt=o(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,Ct),t[125]=Ct,t[126]=wt);let Tt,Et;t[127]===Symbol.for(`react.memo_cache_sentinel`)?(Tt=()=>ae(`edit`),Et=(0,z.jsx)(E,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[127]=Tt,t[128]=Et):(Tt=t[127],Et=t[128]);let Dt;t[129]!==Z.edit||t[130]!==wt?(Dt=(0,z.jsxs)(`button`,{type:`button`,className:wt,onClick:Tt,children:[Et,Z.edit]}),t[129]=Z.edit,t[130]=wt,t[131]=Dt):Dt=t[131];let Ot=W===`preview`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,kt;t[132]===Ot?kt=t[133]:(kt=o(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,Ot),t[132]=Ot,t[133]=kt);let At,jt;t[134]===Symbol.for(`react.memo_cache_sentinel`)?(At=()=>ae(`preview`),jt=(0,z.jsx)(k,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[134]=At,t[135]=jt):(At=t[134],jt=t[135]);let Mt;t[136]!==Z.preview||t[137]!==kt?(Mt=(0,z.jsxs)(`button`,{type:`button`,className:kt,onClick:At,children:[jt,Z.preview]}),t[136]=Z.preview,t[137]=kt,t[138]=Mt):Mt=t[138];let Nt;t[139]!==Dt||t[140]!==Mt?(Nt=(0,z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 rounded-lg border border-edge bg-surface-muted p-0.5`,children:[Dt,Mt]}),t[139]=Dt,t[140]=Mt,t[141]=Nt):Nt=t[141];let Pt;t[142]!==St||t[143]!==Nt?(Pt=(0,z.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[St,Nt]}),t[142]=St,t[143]=Nt,t[144]=Pt):Pt=t[144];let Ft=Q?`opacity-100`:`pointer-events-none opacity-0`,It;t[145]===Ft?It=t[146]:(It=o(`absolute inset-0 min-h-0 transition-opacity duration-200 ease-out motion-reduce:transition-none`,Ft),t[145]=Ft,t[146]=It);let Lt=!Q,Rt;t[147]===Symbol.for(`react.memo_cache_sentinel`)?(Rt=()=>K(re),t[147]=Rt):Rt=t[147];let zt;t[148]!==Z.thinkingLoading||t[149]!==Y?(zt=Y?(0,z.jsxs)(`span`,{className:`ml-1 font-normal`,children:[`· `,Z.thinkingLoading]}):null,t[148]=Z.thinkingLoading,t[149]=Y,t[150]=zt):zt=t[150];let Bt;t[151]!==Z.thinking||t[152]!==zt?(Bt=(0,z.jsxs)(`span`,{className:`min-w-0 truncate`,children:[Z.thinking,zt]}),t[151]=Z.thinking,t[152]=zt,t[153]=Bt):Bt=t[153];let Vt=G&&`rotate-180`,Ht;t[154]===Vt?Ht=t[155]:(Ht=o(`size-3.5 shrink-0 transition-transform`,Vt),t[154]=Vt,t[155]=Ht);let Ut;t[156]===Ht?Ut=t[157]:(Ut=(0,z.jsx)(_,{className:Ht,strokeWidth:1.75,"aria-hidden":!0}),t[156]=Ht,t[157]=Ut);let Wt;t[158]!==Bt||t[159]!==Ut?(Wt=(0,z.jsxs)(`button`,{type:`button`,className:`flex shrink-0 items-center justify-between gap-2 px-2.5 py-2 text-left text-xs font-medium text-fg-muted hover:text-fg`,onClick:Rt,children:[Bt,Ut]}),t[158]=Bt,t[159]=Ut,t[160]=Wt):Wt=t[160];let Gt;t[161]!==J||t[162]!==G?(Gt=G?(0,z.jsx)(`pre`,{ref:le,className:`min-h-0 flex-1 overflow-auto border-t border-edge px-2.5 py-2 whitespace-pre-wrap text-xs leading-5 text-fg-muted`,onScroll:Te,children:J}):null,t[161]=J,t[162]=G,t[163]=Gt):Gt=t[163];let Kt;t[164]!==Wt||t[165]!==Gt?(Kt=(0,z.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col rounded-lg border border-edge bg-surface-muted/70`,children:[Wt,Gt]}),t[164]=Wt,t[165]=Gt,t[166]=Kt):Kt=t[166];let qt;t[167]!==It||t[168]!==Lt||t[169]!==Kt?(qt=(0,z.jsx)(`div`,{className:It,"aria-hidden":Lt,children:Kt}),t[167]=It,t[168]=Lt,t[169]=Kt,t[170]=qt):qt=t[170];let Jt=Q?`pointer-events-none opacity-0`:`opacity-100`,Yt;t[171]===Jt?Yt=t[172]:(Yt=o(`absolute inset-0 min-h-0 transition-opacity duration-200 ease-out motion-reduce:transition-none`,Jt),t[171]=Jt,t[172]=Yt);let Xt;t[173]!==H||t[174]!==X||t[175]!==O||t[176]!==Z.empty||t[177]!==Z.loading||t[178]!==Z.suggestion||t[179]!==Y||t[180]!==W?(Xt=X?(0,z.jsx)(`pre`,{className:`h-full min-h-0 overflow-auto whitespace-pre-wrap rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg-muted`,children:X}):W===`preview`?(0,z.jsx)(`div`,{className:`h-full min-h-0 overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg`,children:Y&&!H.trim()?(0,z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:Z.loading}):O===`markdown`?(0,z.jsx)(A,{content:H||Z.empty,compact:!0,className:`text-sm`}):(0,z.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg`,children:H||Z.empty})}):(0,z.jsx)(`textarea`,{className:`h-full min-h-0 w-full resize-none overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/25 disabled:text-fg-muted`,value:H,onChange:e=>U(e.currentTarget.value),disabled:Y,placeholder:Y?Z.loading:Z.empty,"aria-label":Z.suggestion}),t[173]=H,t[174]=X,t[175]=O,t[176]=Z.empty,t[177]=Z.loading,t[178]=Z.suggestion,t[179]=Y,t[180]=W,t[181]=Xt):Xt=t[181];let Zt;t[182]!==Yt||t[183]!==Xt?(Zt=(0,z.jsx)(`div`,{className:Yt,children:Xt}),t[182]=Yt,t[183]=Xt,t[184]=Zt):Zt=t[184];let Qt;t[185]!==qt||t[186]!==Zt?(Qt=(0,z.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden`,children:[qt,Zt]}),t[185]=qt,t[186]=Zt,t[187]=Qt):Qt=t[187];let $t;t[188]!==Pt||t[189]!==Qt?($t=(0,z.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-hidden`,children:[Pt,Qt]}),t[188]=Pt,t[189]=Qt,t[190]=$t):$t=t[190];let en;t[191]!==yt||t[192]!==$t?(en=(0,z.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-1 gap-3 overflow-hidden p-4 md:grid-cols-2`,children:[yt,$t]}),t[191]=yt,t[192]=$t,t[193]=en):en=t[193];let tn;t[194]!==$||t[195]!==Z.cancel?(tn=(0,z.jsx)(s,{type:`button`,variant:`secondary`,onClick:$,children:Z.cancel}),t[194]=$,t[195]=Z.cancel,t[196]=tn):tn=t[196];let nn=!Ve,rn;t[197]!==Pe||t[198]!==Z.applyCurrent||t[199]!==nn?(rn=(0,z.jsx)(s,{type:`button`,variant:`secondary`,disabled:nn,onClick:Pe,children:Z.applyCurrent}),t[197]=Pe,t[198]=Z.applyCurrent,t[199]=nn,t[200]=rn):rn=t[200];let an;t[201]===je?an=t[202]:(an=()=>void je(),t[201]=je,t[202]=an);let on;t[203]===Ue?on=t[204]:(on=Ue?(0,z.jsx)(x,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}):(0,z.jsx)(S,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[203]=Ue,t[204]=on);let sn=Ue?Z.regenerate:Z.generate,cn;t[205]!==Y||t[206]!==an||t[207]!==on||t[208]!==sn?(cn=(0,z.jsxs)(s,{type:`button`,variant:`secondary`,disabled:Y,onClick:an,children:[on,sn]}),t[205]=Y,t[206]=an,t[207]=on,t[208]=sn,t[209]=cn):cn=t[209];let ln=!Be,un;t[210]!==Re||t[211]!==Z.append||t[212]!==ln?(un=(0,z.jsx)(s,{type:`button`,variant:`secondary`,disabled:ln,onClick:Re,children:Z.append}),t[210]=Re,t[211]=Z.append,t[212]=ln,t[213]=un):un=t[213];let dn=!Be,fn;t[214]!==Ie||t[215]!==Z.replace||t[216]!==dn?(fn=(0,z.jsx)(s,{type:`button`,variant:`primary`,disabled:dn,onClick:Ie,children:Z.replace}),t[214]=Ie,t[215]=Z.replace,t[216]=dn,t[217]=fn):fn=t[217];let pn;t[218]!==fn||t[219]!==tn||t[220]!==rn||t[221]!==cn||t[222]!==un?(pn=(0,z.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-4 py-3`,children:[tn,rn,cn,un,fn]}),t[218]=fn,t[219]=tn,t[220]=rn,t[221]=cn,t[222]=un,t[223]=pn):pn=t[223];let mn;t[224]!==pn||t[225]!==it||t[226]!==en?(mn=(0,z.jsx)(`div`,{className:`absolute inset-0 z-[80] flex items-center justify-center p-4 pointer-events-none`,children:(0,z.jsxs)(m,{className:`xopc-dialog-content-pane pointer-events-auto flex h-[min(78vh,38rem)] w-full max-w-4xl flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,onOpenAutoFocus:ie,children:[it,en,pn]})}),t[224]=pn,t[225]=it,t[226]=en,t[227]=mn):mn=t[227];let hn;t[228]!==mn||t[229]!==Ze||t[230]!==et?(hn=(0,z.jsxs)(p,{container:Ze,children:[et,mn]}),t[228]=mn,t[229]=Ze,t[230]=et,t[231]=hn):hn=t[231];let gn;t[232]!==F||t[233]!==hn||t[234]!==Xe?(gn=(0,z.jsx)(g,{open:F,onOpenChange:Xe,children:hn}),t[232]=F,t[233]=hn,t[234]=Xe,t[235]=gn):gn=t[235];let _n;return t[236]!==gn||t[237]!==Ye?(_n=(0,z.jsxs)(z.Fragment,{children:[Ye,gn]}),t[236]=gn,t[237]=Ye,t[238]=_n):_n=t[238],_n}function re(e){return!e}function ie(e){return e.preventDefault()}function V(e){return!!(e&&e.type===`object`&&e.properties&&!Array.isArray(e.properties))}function H(e){let t=e.properties??{},n=new Set(e.required??[]);return Object.entries(t).map(([e,t])=>({key:e,schema:t,required:n.has(e)}))}function U(e,t){return!V(e)||!e?!0:H(e).every(e=>{if(!e.required)return!0;let n=t[e.key];return n==null?!1:typeof n==`string`?n.trim().length>0:!0})}function W(e,t){if(e)return V(e.inputSchema)?Object.keys(t.schemaInput).length>0?t.schemaInput:void 0:C(t.argValues)}function ae(e,t,n){let r=c(t).workflows;if(!e)return r.noInputSummary;let i=T(e,t);if(V(e.inputSchema)&&Object.keys(n.schemaInput).length>0)return Object.entries(n.schemaInput).map(([e,t])=>`${e}: ${String(t)}`).join(` · `);let a=Object.values(n.argValues).map(e=>e.trim()).filter(Boolean),o=n.goal.trim()||i.description;return o&&a.unshift(o),a.length>0?a.join(` · `):r.noInputSummary}function G(e,t,n=!0){return e?n?V(e.inputSchema)?U(e.inputSchema,t.schemaInput)?{valid:!0}:{valid:!1,reason:`schema-required`}:{valid:(M[e.name]??[]).every(e=>!e.required||!!t.argValues[e.key]?.trim())}:{valid:!1,reason:`raw-json`}:{valid:!1}}function K(e,t){return e[t]??t}function oe(e,t){let n=M[e]??[];if(n.length===0)return{};let r=t&&typeof t==`object`&&!Array.isArray(t)?t:{},i={};for(let e of n){let t=r[e.key];t!=null&&(i[e.key]=String(t))}return i}function se(e){let t=(0,P.c)(12),{examples:n,labels:r,onSelect:i}=e;if(n.length===0)return null;let a;t[0]===r.examplePrompts?a=t[1]:(a=(0,z.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:r.examplePrompts}),t[0]=r.examplePrompts,t[1]=a);let o;if(t[2]!==n||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>(0,z.jsx)(`button`,{type:`button`,onClick:()=>i(e),className:`rounded-lg border border-edge bg-surface-base/50 px-3 py-2 text-left text-xs text-fg-muted hover:bg-surface-hover`,children:e.text},`${e.field}:${e.text}`),t[5]=i,t[6]=e),o=n.map(e),t[2]=n,t[3]=i,t[4]=o}else o=t[4];let s;t[7]===o?s=t[8]:(s=(0,z.jsx)(`div`,{className:`mt-2 flex flex-col gap-1.5`,children:o}),t[7]=o,t[8]=s);let c;return t[9]!==a||t[10]!==s?(c=(0,z.jsxs)(`div`,{children:[a,s]}),t[9]=a,t[10]=s,t[11]=c):c=t[11],c}function ce(e){let t=(0,P.c)(34),{workflowName:n,language:r,argValues:i,onArgValuesChange:a,goal:s,onGoalChange:l,examplePrompts:u,showGoal:d,inputClassName:f,aiAssist:p}=e,m;t[0]===u?m=t[1]:(m=u===void 0?[]:u,t[0]=u,t[1]=m);let h=m,g=d===void 0?!0:d,_,v,y,x,S,C,w;if(t[2]!==p||t[3]!==i||t[4]!==h||t[5]!==s||t[6]!==f||t[7]!==r||t[8]!==a||t[9]!==l||t[10]!==g||t[11]!==n){y=c(r).workflows;let e=M[n]??[];v=e.length>0;let u=o(`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`,f),d;t[19]!==i||t[20]!==a||t[21]!==l?(d=e=>{b(e,l,e=>{a(e(i))})},t[19]=i,t[20]=a,t[21]=l,t[22]=d):d=t[22],_=d,x=`flex flex-col gap-3`,S=e.map(e=>{let t=K(y.args,e.labelKey),s=K(y.args,e.placeholderKey),c=i[e.key]??``;return(0,z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,z.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,z.jsxs)(`span`,{className:`text-xs font-medium text-fg-muted`,children:[t,e.required?` *`:``]}),e.multiline&&p?(0,z.jsx)(B,{value:c,onApply:t=>a({...i,[e.key]:t}),fieldId:`workflow.arg.${e.key}`,fieldLabel:t,scenario:p.argScenario??`workflow.arg`,locale:r,context:{...p.context,workflowName:n,workflowArgs:i,fieldKey:e.key},disabled:p.disabled,showLabel:!1}):null]}),e.multiline?(0,z.jsx)(`textarea`,{value:c,onChange:t=>a({...i,[e.key]:t.target.value}),placeholder:s,className:o(u,`min-h-20 resize-y`)}):(0,z.jsx)(`input`,{value:c,onChange:t=>a({...i,[e.key]:t.target.value}),placeholder:s,className:u})]},e.key)}),C=v&&h.length>0?(0,z.jsx)(se,{examples:h,labels:y,onSelect:_}):null,w=g?(0,z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,z.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,z.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:y.goalLabel}),p?(0,z.jsx)(B,{value:s,onApply:l,fieldId:`workflow.goal`,fieldLabel:y.goalLabel,scenario:p.goalScenario??`cron.workflowGoal`,locale:r,context:{...p.context,workflowName:n,workflowArgs:i},disabled:p.disabled,showLabel:!1}):null]}),(0,z.jsx)(`textarea`,{value:s,onChange:e=>l(e.target.value),placeholder:y.goalPlaceholder,className:o(u,`min-h-20 resize-y`)})]}):null,t[2]=p,t[3]=i,t[4]=h,t[5]=s,t[6]=f,t[7]=r,t[8]=a,t[9]=l,t[10]=g,t[11]=n,t[12]=_,t[13]=v,t[14]=y,t[15]=x,t[16]=S,t[17]=C,t[18]=w}else _=t[12],v=t[13],y=t[14],x=t[15],S=t[16],C=t[17],w=t[18];let T;t[23]!==_||t[24]!==h||t[25]!==v||t[26]!==y?(T=!v&&h.length>0?(0,z.jsx)(se,{examples:h,labels:y,onSelect:_}):null,t[23]=_,t[24]=h,t[25]=v,t[26]=y,t[27]=T):T=t[27];let E;return t[28]!==x||t[29]!==S||t[30]!==C||t[31]!==w||t[32]!==T?(E=(0,z.jsxs)(`div`,{className:x,children:[S,C,w,T]}),t[28]=x,t[29]=S,t[30]=C,t[31]=w,t[32]=T,t[33]=E):E=t[33],E}var q=`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`;function le({schema:e,value:t,onChange:n,labels:r,aiAssist:i,onValidChange:a}){let s=(0,N.useMemo)(()=>H(e),[e]),[c,l]=(0,N.useState)(!1),[u,d]=(0,N.useState)(()=>JSON.stringify(t,null,2)),[f,p]=(0,N.useState)(null);if(s.length===0)return null;let m=(e,r)=>{let i={...t,[e]:r};(r===``||r===void 0)&&delete i[e],n(i),c&&d(JSON.stringify(i,null,2))},h=e=>{d(e);try{let t=e.trim()?JSON.parse(e):{};if(!t||typeof t!=`object`||Array.isArray(t)){p(r.rawJsonInvalid),a?.(!1);return}p(null),n(t),a?.(!0,t)}catch{p(r.rawJsonInvalid),a?.(!1)}};return(0,z.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel/70 p-4 shadow-surface`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:r.inputSchemaHeading}),(0,z.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-accent-fg hover:underline`,onClick:()=>{let e=!c;l(e),e&&(d(JSON.stringify(t,null,2)),p(null),a?.(!0))},children:r.rawJson})]}),c?(0,z.jsxs)(`div`,{className:`mt-3`,children:[(0,z.jsx)(`textarea`,{value:u,onChange:e=>h(e.target.value),spellCheck:!1,className:o(q,`min-h-40 font-mono text-xs leading-5`)}),f?(0,z.jsx)(`p`,{className:`mt-1 text-xs text-red-600 dark:text-red-300`,children:f}):null]}):(0,z.jsx)(`div`,{className:`mt-3 grid gap-3`,children:s.map(e=>(0,z.jsx)(ue,{field:e,value:t[e.key],labels:r,aiAssist:i,allValues:t,onChange:t=>m(e.key,t)},e.key))})]})}function ue(e){let t=(0,P.c)(30),{field:n,value:r,labels:s,aiAssist:c,allValues:l,onChange:u}=e,d=n.schema.title||n.key,f=typeof n.schema.description==`string`?n.schema.description:void 0,p=Array.isArray(n.schema.type)?n.schema.type[0]:n.schema.type,m;t[0]===n.schema.enum?m=t[1]:(m=Array.isArray(n.schema.enum)?n.schema.enum:[],t[0]=n.schema.enum,t[1]=m);let h=m,g=!!c&&!h.length&&(p===`string`||!p),_=String(d),v=n.required?` *`:``,y;t[2]!==_||t[3]!==v?(y=(0,z.jsxs)(`span`,{className:`text-xs font-medium text-fg`,children:[_,v]}),t[2]=_,t[3]=v,t[4]=y):y=t[4];let b;t[5]!==c||t[6]!==l||t[7]!==n.key||t[8]!==n.schema||t[9]!==u||t[10]!==g||t[11]!==d||t[12]!==r?(b=g&&c?(0,z.jsx)(B,{value:typeof r==`string`?r:r==null?``:String(r),onApply:u,fieldId:`workflow.schema.${n.key}`,fieldLabel:String(d),scenario:c.scenario??`workflow.arg`,locale:c.locale,context:{...c.context,fieldKey:n.key,fieldSchema:n.schema,inputValues:l},disabled:c.disabled,showLabel:!1}):null,t[5]=c,t[6]=l,t[7]=n.key,t[8]=n.schema,t[9]=u,t[10]=g,t[11]=d,t[12]=r,t[13]=b):b=t[13];let x;t[14]!==y||t[15]!==b?(x=(0,z.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[y,b]}),t[14]=y,t[15]=b,t[16]=x):x=t[16];let S;t[17]===f?S=t[18]:(S=f?(0,z.jsx)(`p`,{className:`mt-0.5 text-xs leading-5 text-fg-subtle`,children:f}):null,t[17]=f,t[18]=S);let C;t[19]!==f||t[20]!==h||t[21]!==s||t[22]!==u||t[23]!==p||t[24]!==r?(C=h.length>0?(0,z.jsxs)(i,{value:r==null?``:String(r),onChange:e=>u(e.target.value),className:q,children:[(0,z.jsx)(a,{value:``}),h.map(de)]}):p===`boolean`?(0,z.jsxs)(i,{value:typeof r==`boolean`?String(r):``,onChange:e=>u(e.target.value===``?void 0:e.target.value===`true`),className:q,children:[(0,z.jsx)(a,{value:``}),(0,z.jsx)(a,{value:`true`,children:s.booleanTrue}),(0,z.jsx)(a,{value:`false`,children:s.booleanFalse})]}):p===`number`||p===`integer`?(0,z.jsx)(`input`,{type:`number`,value:typeof r==`number`||typeof r==`string`?String(r):``,onChange:e=>u(e.target.value===``?void 0:Number(e.target.value)),className:q}):(0,z.jsx)(`textarea`,{value:typeof r==`string`?r:r==null?``:String(r),onChange:e=>u(e.target.value),className:o(q,f&&f.length>80?`min-h-20 resize-y`:`min-h-10 resize-y`)}),t[19]=f,t[20]=h,t[21]=s,t[22]=u,t[23]=p,t[24]=r,t[25]=C):C=t[25];let w;return t[26]!==x||t[27]!==S||t[28]!==C?(w=(0,z.jsxs)(`div`,{className:`block`,children:[x,S,C]}),t[26]=x,t[27]=S,t[28]=C,t[29]=w):w=t[29],w}function de(e){return(0,z.jsx)(a,{value:String(e),children:String(e)},String(e))}function J(e){let t=(0,P.c)(12),{examples:n,labels:r,onSelect:i}=e;if(n.length===0)return null;let a;t[0]===r.examplePrompts?a=t[1]:(a=(0,z.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:r.examplePrompts}),t[0]=r.examplePrompts,t[1]=a);let o;if(t[2]!==n||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>(0,z.jsx)(`button`,{type:`button`,onClick:()=>i(e),className:`rounded-lg border border-edge bg-surface-base/50 px-3 py-2 text-left text-xs text-fg-muted hover:bg-surface-hover`,children:e.text},`${e.field}:${e.text}`),t[5]=i,t[6]=e),o=n.map(e),t[2]=n,t[3]=i,t[4]=o}else o=t[4];let s;t[7]===o?s=t[8]:(s=(0,z.jsx)(`div`,{className:`mt-2 flex flex-col gap-1.5`,children:o}),t[7]=o,t[8]=s);let c;return t[9]!==a||t[10]!==s?(c=(0,z.jsxs)(`div`,{children:[a,s]}),t[9]=a,t[10]=s,t[11]=c):c=t[11],c}function Y(e){let t=(0,P.c)(114),{definition:n,language:r,value:i,onChange:a,aiAssist:s,inputClassName:l,onValidityChange:u}=e,d;t[0]===r?d=t[1]:(d=c(r),t[0]=r,t[1]=d);let f=d.workflows,p;t[2]!==n||t[3]!==r?(p=T(n,r),t[2]=n,t[3]=r,t[4]=p):p=t[4];let m=p,[h,g]=(0,N.useState)(!0),_;t[5]===m.examplePrompts?_=t[6]:(_=m.examplePrompts??[],t[5]=m.examplePrompts,t[6]=_);let v=_,y;t[7]===n.inputSchema?y=t[8]:(y=V(n.inputSchema),t[7]=n.inputSchema,t[8]=y);let b=y,x,S,C,w,E,D,O,k,A,j;if(t[9]!==s||t[10]!==n||t[11]!==v||t[12]!==b||t[13]!==l||t[14]!==f||t[15]!==r||t[16]!==m.description||t[17]!==a||t[18]!==u||t[19]!==h||t[20]!==i){E=Symbol.for(`react.early_return_sentinel`);bb0:{let e=o(`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`,l),c;t[31]!==n||t[32]!==a||t[33]!==u||t[34]!==h?(c=(e,t)=>{let r=t===void 0?h:t;a(e),u?.(G(n,e,r))},t[31]=n,t[32]=a,t[33]=u,t[34]=h,t[35]=c):c=t[35];let d=c,p;t[36]!==d||t[37]!==i?(p=e=>d({...i,goal:e}),t[36]=d,t[37]=i,t[38]=p):p=t[38];let _=p,y;t[39]!==d||t[40]!==i?(y=e=>d({...i,schemaInput:e}),t[39]=d,t[40]=i,t[41]=y):y=t[41];let T=y,M;t[42]!==d||t[43]!==i?(M=e=>d({...i,argValues:e}),t[42]=d,t[43]=i,t[44]=M):M=t[44];let N=M,P;if(t[45]!==_||t[46]!==T||t[47]!==i.schemaInput?(P=e=>{if(e.field===`goal`){_(e.text);return}T({...i.schemaInput,[e.field]:e.text})},t[45]=_,t[46]=T,t[47]=i.schemaInput,t[48]=P):P=t[48],x=P,!b){let e;t[49]!==s||t[50]!==n.id||t[51]!==n.name||t[52]!==n.title||t[53]!==m.description?(e=s?{disabled:s.disabled,argScenario:s.inputScenario??`workflow.arg`,goalScenario:s.goalScenario??`workflow.goal`,context:{...s.context,workflowId:n.id,workflowName:n.name,workflowTitle:n.title,workflowDescription:m.description}}:void 0,t[49]=s,t[50]=n.id,t[51]=n.name,t[52]=n.title,t[53]=m.description,t[54]=e):e=t[54];let a;t[55]!==n.name||t[56]!==v||t[57]!==l||t[58]!==r||t[59]!==N||t[60]!==_||t[61]!==e||t[62]!==i.argValues||t[63]!==i.goal?(a=(0,z.jsx)(ce,{workflowName:n.name,language:r,argValues:i.argValues,onArgValuesChange:N,goal:i.goal,onGoalChange:_,examplePrompts:v,inputClassName:l,aiAssist:e}),t[55]=n.name,t[56]=v,t[57]=l,t[58]=r,t[59]=N,t[60]=_,t[61]=e,t[62]=i.argValues,t[63]=i.goal,t[64]=a):a=t[64],E=a;break bb0}C=`flex flex-col gap-3`,t[65]!==s||t[66]!==n||t[67]!==f.booleanFalse||t[68]!==f.booleanTrue||t[69]!==f.inputSchemaHeading||t[70]!==f.rawJson||t[71]!==f.rawJsonInvalid||t[72]!==r||t[73]!==m.description||t[74]!==u||t[75]!==T||t[76]!==i?(w=n.inputSchema?(0,z.jsx)(le,{schema:n.inputSchema,value:i.schemaInput,onChange:T,onValidChange:(e,t)=>{g(e),u?.(G(n,t?{...i,schemaInput:t}:i,e))},aiAssist:s?{locale:r,disabled:s.disabled,scenario:s.inputScenario??`workflow.arg`,context:{...s.context,workflowId:n.id,workflowName:n.name,workflowTitle:n.title,workflowDescription:m.description}}:void 0,labels:{inputSchemaHeading:f.inputSchemaHeading,rawJson:f.rawJson,rawJsonInvalid:f.rawJsonInvalid,booleanTrue:f.booleanTrue,booleanFalse:f.booleanFalse}}):null,t[65]=s,t[66]=n,t[67]=f.booleanFalse,t[68]=f.booleanTrue,t[69]=f.inputSchemaHeading,t[70]=f.rawJson,t[71]=f.rawJsonInvalid,t[72]=r,t[73]=m.description,t[74]=u,t[75]=T,t[76]=i,t[77]=w):w=t[77],j=`flex flex-col gap-1`;let F;t[78]===f.goalLabel?F=t[79]:(F=(0,z.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:f.goalLabel}),t[78]=f.goalLabel,t[79]=F);let I;t[80]!==s||t[81]!==n.id||t[82]!==n.name||t[83]!==n.title||t[84]!==f.goalLabel||t[85]!==r||t[86]!==m.description||t[87]!==_||t[88]!==i.goal||t[89]!==i.schemaInput?(I=s?(0,z.jsx)(B,{value:i.goal,onApply:_,fieldId:`workflow.goal`,fieldLabel:f.goalLabel,scenario:s.goalScenario??`workflow.goal`,locale:r,context:{...s.context,workflowId:n.id,workflowName:n.name,workflowTitle:n.title,workflowDescription:m.description,workflowInput:i.schemaInput},disabled:s.disabled,showLabel:!1}):null,t[80]=s,t[81]=n.id,t[82]=n.name,t[83]=n.title,t[84]=f.goalLabel,t[85]=r,t[86]=m.description,t[87]=_,t[88]=i.goal,t[89]=i.schemaInput,t[90]=I):I=t[90],t[91]!==F||t[92]!==I?(S=(0,z.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[F,I]}),t[91]=F,t[92]=I,t[93]=S):S=t[93],D=i.goal,t[94]===_?O=t[95]:(O=e=>_(e.target.value),t[94]=_,t[95]=O),k=f.goalPlaceholder,A=o(e,`min-h-20 resize-y`)}t[9]=s,t[10]=n,t[11]=v,t[12]=b,t[13]=l,t[14]=f,t[15]=r,t[16]=m.description,t[17]=a,t[18]=u,t[19]=h,t[20]=i,t[21]=x,t[22]=S,t[23]=C,t[24]=w,t[25]=E,t[26]=D,t[27]=O,t[28]=k,t[29]=A,t[30]=j}else x=t[21],S=t[22],C=t[23],w=t[24],E=t[25],D=t[26],O=t[27],k=t[28],A=t[29],j=t[30];if(E!==Symbol.for(`react.early_return_sentinel`))return E;let M;t[96]!==D||t[97]!==O||t[98]!==k||t[99]!==A?(M=(0,z.jsx)(`textarea`,{value:D,onChange:O,placeholder:k,className:A}),t[96]=D,t[97]=O,t[98]=k,t[99]=A,t[100]=M):M=t[100];let F;t[101]!==S||t[102]!==M||t[103]!==j?(F=(0,z.jsxs)(`div`,{className:j,children:[S,M]}),t[101]=S,t[102]=M,t[103]=j,t[104]=F):F=t[104];let I;t[105]!==x||t[106]!==v||t[107]!==f?(I=(0,z.jsx)(J,{examples:v,labels:f,onSelect:x}),t[105]=x,t[106]=v,t[107]=f,t[108]=I):I=t[108];let L;return t[109]!==C||t[110]!==w||t[111]!==F||t[112]!==I?(L=(0,z.jsxs)(`div`,{className:C,children:[w,F,I]}),t[109]=C,t[110]=w,t[111]=F,t[112]=I,t[113]=L):L=t[113],L}function X(e,t){let n=e.metadata.estimatedAgents;return n?n.min===n.max?v(t.agentScaleExact,{count:n.min}):v(t.agentScaleRange,{min:n.min,max:n.max}):v(t.agentScaleExact,{count:e.defaults.maxSubagents})}function fe(e){let t=(0,P.c)(41),{definition:n,language:r,value:i,onChange:a,mode:s,badgeLabel:l,aiAssist:u,inputClassName:d,showTimeout:f,defaultAdvancedOpen:p,onValidityChange:m}=e,h=f===void 0?!1:f,g=p===void 0?!1:p,b=c(r).workflows,[x,S]=(0,N.useState)(g),C;t[0]!==n||t[1]!==r?(C=T(n,r),t[0]=n,t[1]=r,t[2]=C):C=t[2];let w=C,E;t[3]!==n.defaults||t[4]!==i.concurrency?(E=i.concurrency.trim()?Number(i.concurrency):n.defaults.concurrency,t[3]=n.defaults,t[4]=i.concurrency,t[5]=E):E=t[5];let k=E,A;t[6]!==n.defaults||t[7]!==i.maxSubagents?(A=i.maxSubagents.trim()?Number(i.maxSubagents):n.defaults.maxSubagents,t[6]=n.defaults,t[7]=i.maxSubagents,t[8]=A):A=t[8];let M=A,F;t[9]!==n||t[10]!==r||t[11]!==i?(F=ae(n,r,i),t[9]=n,t[10]=r,t[11]=i,t[12]=F):F=t[12];let I=F,L=l??b.readyToStart,R;t[13]!==a||t[14]!==i?(R=e=>a({...i,...e}),t[13]=a,t[14]=i,t[15]=R):R=t[15];let ee=R,te=s===`automation`&&`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,ne;t[16]===te?ne=t[17]:(ne=o(`space-y-4`,te),t[16]=te,t[17]=ne);let B=I||w.description,re;t[18]===B?re=t[19]:(re=(0,z.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:B}),t[18]=B,t[19]=re);let ie;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,z.jsx)(y,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[20]=ie):ie=t[20];let V;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,z.jsx)(D,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[21]=V):V=t[21];let H;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,z.jsx)(j,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[22]=H):H=t[22];let U;t[23]!==a||t[24]!==i?(U=e=>a({...i,...e}),t[23]=a,t[24]=i,t[25]=U):U=t[25];let W;t[26]===m?W=t[27]:(W=e=>{m?.(e)},t[26]=m,t[27]=W);let G;t[28]!==u||t[29]!==n||t[30]!==d||t[31]!==r||t[32]!==U||t[33]!==W||t[34]!==i?(G=(0,z.jsx)(Y,{definition:n,language:r,value:i,onChange:U,onValidityChange:W,aiAssist:u,inputClassName:d}),t[28]=u,t[29]=n,t[30]=d,t[31]=r,t[32]=U,t[33]=W,t[34]=i,t[35]=G):G=t[35];let K;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(K=()=>S(pe),t[36]=K):K=t[36];let oe=b.advancedSettings,se=x&&`rotate-180`,ce;t[37]===se?ce=t[38]:(ce=o(`size-4 transition-transform`,se),t[37]=se,t[38]=ce);let q;return t[39]===ce?q=t[40]:(q=(0,z.jsx)(_,{className:ce}),t[39]=ce,t[40]=q),(0,z.jsxs)(`div`,{className:ne,children:[(0,z.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:b.runPlanPreview}),re]}),(0,z.jsx)(`span`,{className:`shrink-0 rounded-full bg-accent-soft px-2 py-1 text-[11px] font-medium text-accent-fg`,children:L})]}),(0,z.jsxs)(`div`,{className:`mt-4 grid gap-2 text-xs text-fg-muted sm:grid-cols-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-surface-panel px-2.5 py-2`,children:[ie,(0,z.jsx)(`span`,{children:v(b.phaseCount,{count:n.phases.length})})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-surface-panel px-2.5 py-2`,children:[V,(0,z.jsx)(`span`,{children:X(n,b)})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-surface-panel px-2.5 py-2`,children:[H,(0,z.jsx)(`span`,{children:v(b.runLimitsSummary,{concurrency:k,max:M})})]})]}),n.phases.length>0?(0,z.jsxs)(`div`,{className:`mt-4`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:[(0,z.jsx)(O,{className:`size-3.5`,"aria-hidden":!0}),b.startPlanPhases]}),(0,z.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5`,children:n.phases.map(me)})]}):null]}),G,(0,z.jsxs)(`div`,{className:`rounded-xl border border-edge`,children:[(0,z.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between px-3 py-2.5 text-left text-sm text-fg`,onClick:K,children:[oe,q]}),x?(0,z.jsxs)(`div`,{className:`grid gap-3 border-t border-edge px-3 pb-3 pt-3 sm:grid-cols-2`,children:[(0,z.jsx)(`input`,{value:i.concurrency,onChange:e=>ee({concurrency:e.target.value}),placeholder:v(b.concurrencyPlaceholder,{default:n.defaults.concurrency}),inputMode:`numeric`,className:`rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`}),(0,z.jsx)(`input`,{value:i.maxSubagents,onChange:e=>ee({maxSubagents:e.target.value}),placeholder:v(b.maxSubagentsPlaceholder,{default:n.defaults.maxSubagents}),inputMode:`numeric`,className:`rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`}),h?(0,z.jsx)(`input`,{value:i.timeoutSeconds??``,onChange:e=>ee({timeoutSeconds:e.target.value}),placeholder:v(b.timeoutSecondsPlaceholder,{default:n.defaults.timeoutSec}),inputMode:`numeric`,className:`rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`}):null]}):null]})]})}function pe(e){return!e}function me(e,t){return(0,z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[t>0?(0,z.jsx)(`span`,{className:`text-fg-subtle`,children:`→`}):null,(0,z.jsx)(`span`,{className:`rounded-lg border border-edge-subtle bg-surface-panel px-2 py-1 text-[11px] text-fg-muted`,children:e.title})]},e.id)}export{B as a,G as i,oe as n,W as r,fe as t};