@xopcai/xopc 0.0.411 → 0.0.412
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.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-sGJnq-SA.js → agent-avatar-dicebear-BrGZdh5N.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-BI7OTo-T.js → agent-defaults-settings-panel-BjZpom5V.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-RIXL0p7_.js → agents-s3ws5Qi-.js} +3 -3
- package/dist/gateway/static/root/assets/{app-management-settings-panel-BGzhSS6H.js → app-management-settings-panel-C6DHuX0L.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-DtEZq4b2.js → appearance-settings-DYGY92Yr.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-DZqBof2D.js → apps-page-PpT_YMmD.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-CGdU_E5B.js → archive-plugin-DAmsio91.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-BAPZY56r.js → automations-page-BVutrwON.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-CI-yQnSj.js → automations-workspace-G6-9IYbR.js} +1 -1
- package/dist/gateway/static/root/assets/{binary-plugins-B0ispXo2.js → binary-plugins-41QCRAxz.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-B9Ci-prO.js → block-editor-BQ8AA-Ot.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-Xzdif447.js → browser-automations-page-o3jNFlCb.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-Bhu-83eC.js → browser-settings-page-G0dVwiX4.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-page-BIc0Zlsw.js → capabilities-page-BZQanmZY.js} +2 -2
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-CQEfpLdj.js → capabilities-settings-panel-D-YadSx_.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-header-actions-Cic05oWh.js → capability-header-actions-CDgI-YZF.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-DQbEoo_o.js → channels-3WX3f0bR.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-Bm-IGeDe.js → chat-terminal-dock-CUkCx_9x.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-C9xMfwXK.js → computer-settings-page-CuZrL9gL.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-DcdASUU9.js → connector-service-page-49mgdRET.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-eh-xpMPK.js → connectors-page-Bjj2wAeG.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-gVLWu9R0.js → date-picker-BpBjADAk.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-C0LARyok.js → dependency-picker-R8kdHLr3.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-v_le3sCs.js → desktop-pet-BpiosRqb.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-B_-j-D4W.js → desktop-pet-settings-9h6evrKB.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-CxG_FcQ6.js → device-pairing-wizard-CZ5lwiLE.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-CBefVUPR.js → directory-picker-path-field-DwXqp_iu.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-CTe7Molh.js → extension-debug-page-Bj93A2Gn.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-C0-oP7S_.js → extension-page-Bri62YsN.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-DYJmgMUg.js → extension-settings-page-BSo6vRhS.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-C13P4lQd.js → gateway-settings-DgEwWJwz.js} +1 -1
- package/dist/gateway/static/root/assets/{highlight-code-CslBKXdS.js → highlight-code-CSFBakwF.js} +1 -1
- package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-CN5PNRN3.js → highlighted-body-KQOG7T2V-Ci1QpkBn.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-B_XrkGmA.js → home-page-BKj-aPsL.js} +2 -2
- package/dist/gateway/static/root/assets/{image-generation-api-DRLXG9Ws.js → image-generation-api-N5MYXlxr.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page--cuF5vwU.js → imports-page-YfaRnpk1.js} +1 -1
- package/dist/gateway/static/root/assets/{index-6YjAt50A.js → index-CiDVRMmX.js} +9 -9
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-5g2PxgBs.js → keyboard-shortcuts-settings-BTQcPOix.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-B6U1HQpp.js → local-app-workbench-page-kCZ_fbSZ.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-BChE6nUD.js → local-apps-page-BjzaB1ls.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-B9mq03SK.js → logs-page-5Jt3uqYt.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings-2W_qJsha.js → management-settings-DOQMLPrI.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-BmLuWkkZ.js → media-plugins-8mlDAjD6.js} +1 -1
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-B4nztFE4.js +1 -0
- package/dist/gateway/static/root/assets/{note-detail-panel-C4gZsNBL.js → note-detail-panel-1wsKlkk3.js} +3 -3
- package/dist/gateway/static/root/assets/note-image-lightbox-B82cToeV.js +1 -0
- package/dist/gateway/static/root/assets/{notes-page-Chdwrjni.js → notes-page-DKREWOku.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-capture-button-B7rDRlS7.js → page-context-capture-button-oSJIFF3E.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-page-mQl9BftY.js → personal-page-CoqQTkkS.js} +1 -1
- package/dist/gateway/static/root/assets/{plugin-details-dialog-FvwSxZPB.js → plugin-details-dialog-CdOJ3Tir.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-Z4NM7_Dn.js → preview-open-alternatives-n6Shdp3u.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-C5TcIaJj.js → product-open-page-BPF5rRTI.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-5xID6jIj.js → product-preview-content-BOsGPNbw.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-CGOyx7zX.js → project-detail-page-ZADyvA7-.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-Dd11tbRX.js → projects-page-BkRe6Z8S.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-Bintk9nL.js → remote-access-hub-CCGf5kF4.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-CbmiiLsq.js → runtime-tools-settings-panel-BxaxVlwM.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-DtPkiYwm.js → schema-form-cXD1BC02.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-BBlEP7y3.js → sessions-page-B81rRu2-.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-DLHGV-I-.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-DD3iD5t5.js → settings-form-section-BXeszXR7.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-iLY3LRDq.js → settings-page-CNmh4YmR.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-v4P0IAkG.js → setup-status-panel-gEqkJWyw.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-B8h9lqDL.js → share-preview-page-CS9cOCgX.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-DMzej6z2.js → shares-settings-D9Ul96XW.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-api-C9RsrvOp.js → skill-api-B5lDCuOH.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-B20x7EE9.js → skill-reload-api-NLAaNaDn.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-C_ulsnv7.js → skills-page-dWeFt-6J.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-PTRGMKkq.js → system-settings-panel-DdDsFdCh.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-DEPwo4vf.js → task-detail-page-DO3FM--W.js} +1 -1
- package/dist/gateway/static/root/assets/{task-result-evidence-DjNWPpn_.js → task-result-evidence-HJO1BlJm.js} +1 -1
- package/dist/gateway/static/root/assets/{tracing-settings-page-CVJt7IXC.js → tracing-settings-page-Dm3yToJ1.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-C6XfsSWy.js → tunnel-api-DXU94F2Y.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-DgqLD8Y5.js → usage-page-DJJhACRJ.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-DO-Twmbm.js → use-autosave-B1z_TIBu.js} +1 -1
- package/dist/gateway/static/root/assets/{user-model-page-BwK37aob.js → user-model-page-DnZ4qFaO.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-MGe3HkS_.js → voice-api-key-field-HOLjEhh3.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-DptHqYh5.js → work-discovery-overlay-C9RklDaR.js} +1 -1
- package/dist/gateway/static/root/assets/{xopc-cloud-account-card-Y_UIryBH.js → xopc-cloud-account-card-CWwGTBib.js} +1 -1
- package/dist/gateway/static/root/index.html +1 -1
- package/dist/package.js +1 -1
- package/dist/src/agent-catalog/repository.js +4 -0
- package/dist/src/cli/utils/init-workspace-core.js +5 -3
- package/dist/src/config/config-file.d.ts +6 -0
- package/dist/src/config/config-file.js +35 -0
- package/dist/src/config/loader.js +5 -4
- package/dist/src/gateway/service.js +4 -4
- package/dist/src/home-intelligence/host.js +2 -2
- package/package.json +5 -5
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-61Il2HQR.js +0 -1
- package/dist/gateway/static/root/assets/note-image-lightbox-XqJIaaRV.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BCQUth4g.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
2
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-zJ_50EbN.js";import{l as a,m as o,t as s,u as c}from"./chunk-KS7C4IRE-BvcCCgTW.js";import{t as l}from"./circle-check-C23XjkUj.js";import{t as u}from"./external-link-DjqjBmc3.js";import{t as d}from"./messages-DMXSIJUO.js";import{t as f}from"./cn-0WouolD0.js";import{n as p}from"./locale-store-DAgpZxAS.js";import{s as m}from"./tasks-TVRjEggr.js";import{t as h}from"./button-aIC072nz.js";import{t as g}from"./skeleton-BI5TyibZ.js";import{a as _,i as v,o as y,s as b}from"./dist-C3DSFZCi.js";import{$s as x,Bc as S,Cn as C,Ec as w,Fc as T,Fo as E,Gs as D,Hu as O,Ic as k,Id as A,Jr as j,Kc as M,Ks as N,Lc as P,Md as F,Pc as I,Pd as L,Pl as R,Qs as z,Rc as B,Rs as V,Sn as H,Tl as ee,Tn as U,Va as W,Vl as G,Vs as K,Xs as q,Yr as J,Ys as te,Zl as ne,Zs as re,_l as ie,di as ae,ga as oe,jd as se,kc as ce,mu as le,oc as ue,oi as de,qs as fe,r as pe,ro as me,tc as he,wn as ge,xd as Y,zc as _e,zs as ve}from"./index-6YjAt50A.js";import{n as ye}from"./date-formatters-DukWSVwc.js";import{n as be}from"./tab-completion-input-CxtEp0aP.js";import{i as xe,n as Se,r as X,t as Ce}from"./task-result-evidence-DjNWPpn_.js";var Z=n(),Q=e(t(),1);function we(e,t,n=!1){let[r,i]=(0,Q.useState)(null),[a,o]=(0,Q.useState)(!0),[s,c]=(0,Q.useState)(null),l=(0,Q.useRef)(0),u=(0,Q.useCallback)(async()=>{let t=++l.current;c(null);try{let r=await(n?D(e,!0):D(e));t===l.current&&i(r)}catch(e){t===l.current&&c(e instanceof Error?e.message:String(e))}finally{t===l.current&&o(!1)}},[e,n]);return(0,Q.useEffect)(()=>(u(),()=>{l.current++}),[u,t]),(0,Q.useEffect)(()=>{let e,t=1/0,n=n=>{let r=Date.now()+n;r>=t||(window.clearTimeout(e),t=r,e=window.setTimeout(()=>{e=void 0,t=1/0,u()},n))},r=()=>n(100),i=()=>n(750),a=()=>{document.visibilityState===`visible`&&r()},o=[`task-changed-v2`,`task-updated`,`session-created`,`agent-run-started`,`agent-run-ended`,`automation-run-completed`,`home-advisor-updated`,`gateway-realtime-connected`,`realtime-gap`,`focus`],s=[`session-updated`,`session-transcript-updated`];return o.forEach(e=>window.addEventListener(e,r)),s.forEach(e=>window.addEventListener(e,i)),document.addEventListener(`visibilitychange`,a),()=>{o.forEach(e=>window.removeEventListener(e,r)),s.forEach(e=>window.removeEventListener(e,i)),document.removeEventListener(`visibilitychange`,a),window.clearTimeout(e)}},[u]),{home:r,loading:a,loadError:s,setLoadError:c,load:u}}var $=r(),Te=12e3;function Ee(e){let t=(0,Z.c)(107),{variant:n,inputId:r,inputRef:i,intent:a,labels:o,attachments:s,isDragging:c,attachmentBusy:l,attachmentsFull:u,voice:d,chat:p,cancelAction:m,onIntentChange:g,onPickFiles:_,onRemoveAttachment:v,onPaste:y,onDragOver:b,onDragLeave:x,onDrop:S,onSubmit:C}=e,w=n===`inline`,T;t[0]!==s||t[1]!==a?(T=!!a.trim()||s.length>0,t[0]=s,t[1]=a,t[2]=T):T=t[2];let E=T,D=d.voiceActive&&d.phase!==`error`,O;t[3]!==C||t[4]!==d.voiceActive?(O=e=>{if(d.voiceActive){e.preventDefault();return}C(e)},t[3]=C,t[4]=d.voiceActive,t[5]=O):O=t[5];let k=w?`mx-auto mt-6 w-full overflow-hidden rounded-xl border border-edge bg-surface-base p-2 text-left shadow-surface transition-colors focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/15 sm:mt-8`:`flex min-h-0 flex-1 flex-col`,A;t[6]===k?A=t[7]:(A=f(`relative`,k),t[6]=k,t[7]=A);let j;t[8]!==w||t[9]!==c||t[10]!==o.dropFiles?(j=c?(0,$.jsx)(`div`,{className:f(`pointer-events-none absolute inset-0 z-10 flex items-center justify-center bg-accent-soft/90 text-sm font-medium text-accent-fg backdrop-blur-[1px]`,w&&`rounded-2xl`),children:o.dropFiles}):null,t[8]=w,t[9]=c,t[10]=o.dropFiles,t[11]=j):j=t[11];let M=!w&&`flex min-h-0 flex-1 flex-col overflow-y-auto px-5 py-4`,N;t[12]===M?N=t[13]:(N=f(M),t[12]=M,t[13]=N);let P=w?`sr-only`:`mb-2 shrink-0 text-sm font-medium text-fg`,F;t[14]!==r||t[15]!==o.intentLabel||t[16]!==P?(F=(0,$.jsx)(`label`,{htmlFor:r,className:P,children:o.intentLabel}),t[14]=r,t[15]=o.intentLabel,t[16]=P,t[17]=F):F=t[17];let I;t[18]!==l||t[19]!==p||t[20]!==d.audioLevel||t[21]!==d.cancelVoiceInput||t[22]!==d.confirmVoiceInput||t[23]!==d.elapsedLabel||t[24]!==d.error||t[25]!==d.finalTranscript||t[26]!==d.partialTranscript||t[27]!==d.phase||t[28]!==d.recordedDictation||t[29]!==d.retryVoiceInput||t[30]!==d.settingsRequired||t[31]!==d.voiceActive?(I=d.voiceActive?(0,$.jsx)(ge,{phase:d.phase,elapsedLabel:d.elapsedLabel,recordedDictation:d.recordedDictation,audioLevel:d.audioLevel,partialTranscript:d.partialTranscript,finalTranscript:d.finalTranscript,error:d.error,settingsRequired:d.settingsRequired,disabled:l,chat:p,onCancel:d.cancelVoiceInput,onConfirm:d.confirmVoiceInput,onRetry:d.retryVoiceInput}):null,t[18]=l,t[19]=p,t[20]=d.audioLevel,t[21]=d.cancelVoiceInput,t[22]=d.confirmVoiceInput,t[23]=d.elapsedLabel,t[24]=d.error,t[25]=d.finalTranscript,t[26]=d.partialTranscript,t[27]=d.phase,t[28]=d.recordedDictation,t[29]=d.retryVoiceInput,t[30]=d.settingsRequired,t[31]=d.voiceActive,t[32]=I):I=t[32];let L=D&&`hidden`,R=w?`min-h-24 bg-transparent px-3 py-2`:`min-h-32 flex-1 rounded-xl border border-edge bg-surface-base p-3 focus:border-accent focus:ring-2 focus:ring-accent/20`,z;t[33]!==L||t[34]!==R?(z=f(`w-full resize-none text-sm font-normal leading-6 text-fg outline-none placeholder:text-fg-subtle`,L,R),t[33]=L,t[34]=R,t[35]=z):z=t[35];let B;t[36]===g?B=t[37]:(B=e=>g(e.target.value),t[36]=g,t[37]=B);let V=!w,H;t[38]!==r||t[39]!==i||t[40]!==a||t[41]!==o.intentPlaceholder||t[42]!==o.intentSuggestion||t[43]!==g||t[44]!==y||t[45]!==z||t[46]!==B||t[47]!==V?(H=(0,$.jsx)(be,{ref:i,id:r,className:z,value:a,onChange:B,onPaste:y,suggestion:o.intentSuggestion,onAcceptSuggestion:g,onKeyDown:De,placeholder:o.intentPlaceholder,maxLength:Te,autoFocus:V}),t[38]=r,t[39]=i,t[40]=a,t[41]=o.intentPlaceholder,t[42]=o.intentSuggestion,t[43]=g,t[44]=y,t[45]=z,t[46]=B,t[47]=V,t[48]=H):H=t[48];let ee=w?`border-b-0 bg-transparent px-3 pb-2 pt-0`:`mt-3 border-b-0 bg-transparent px-0 pb-0`,U;t[49]!==s||t[50]!==v||t[51]!==ee?(U=(0,$.jsx)(de,{attachments:s,topPadded:!1,onRemove:v,className:ee}),t[49]=s,t[50]=v,t[51]=ee,t[52]=U):U=t[52];let W;t[53]!==w||t[54]!==a.length||t[55]!==o.shortcut?(W=w?null:(0,$.jsxs)(`div`,{className:`mt-2 flex shrink-0 items-center justify-between gap-3 text-[11px] text-fg-subtle`,children:[(0,$.jsx)(`span`,{children:o.shortcut}),(0,$.jsxs)(`span`,{className:`tabular-nums`,children:[a.length.toLocaleString(),` / `,Te.toLocaleString()]})]}),t[53]=w,t[54]=a.length,t[55]=o.shortcut,t[56]=W):W=t[56];let G;t[57]!==I||t[58]!==H||t[59]!==U||t[60]!==W||t[61]!==N||t[62]!==F?(G=(0,$.jsxs)(`div`,{className:N,children:[F,I,H,U,W]}),t[57]=I,t[58]=H,t[59]=U,t[60]=W,t[61]=N,t[62]=F,t[63]=G):G=t[63];let K=w?`border-edge-subtle px-1 pt-2`:`border-edge px-5 py-4`,q;t[64]===K?q=t[65]:(q=f(`flex shrink-0 items-center gap-2 border-t`,K),t[64]=K,t[65]=q);let te=!w&&`mr-auto`,re;t[66]===te?re=t[67]:(re=f(`flex items-center gap-1`,te),t[66]=te,t[67]=re);let ae=l||u,oe;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,$.jsx)(ne,{className:`size-4`,"aria-hidden":!0}),t[68]=oe):oe=t[68];let se;t[69]!==o.attachTitle||t[70]!==_||t[71]!==ae?(se=(0,$.jsx)(h,{type:`button`,variant:`ghost`,className:`size-9 rounded-lg p-0`,disabled:ae,title:o.attachTitle,"aria-label":o.attachTitle,onClick:_,children:oe}),t[69]=o.attachTitle,t[70]=_,t[71]=ae,t[72]=se):se=t[72];let ce;t[73]!==l||t[74]!==p||t[75]!==d.startVoiceInput||t[76]!==d.voiceActive?(ce=d.voiceActive?null:(0,$.jsx)(J,{disabled:l,chat:p,onStart:d.startVoiceInput}),t[73]=l,t[74]=p,t[75]=d.startVoiceInput,t[76]=d.voiceActive,t[77]=ce):ce=t[77];let le;t[78]!==re||t[79]!==se||t[80]!==ce?(le=(0,$.jsxs)(`div`,{className:re,children:[se,ce]}),t[78]=re,t[79]=se,t[80]=ce,t[81]=le):le=t[81];let ue;t[82]!==m||t[83]!==w||t[84]!==o.shortcut?(ue=w?(0,$.jsx)(`span`,{className:`hidden text-[11px] text-fg-subtle sm:inline`,children:o.shortcut}):m,t[82]=m,t[83]=w,t[84]=o.shortcut,t[85]=ue):ue=t[85];let fe=w?`ml-auto h-9 rounded-lg px-3.5 text-xs`:`min-w-32`,pe=!E||l||d.voiceActive,me=w?`size-3.5`:`size-4`,he;t[86]===me?he=t[87]:(he=(0,$.jsx)(ie,{className:me,"aria-hidden":!0}),t[86]=me,t[87]=he);let Y;t[88]!==o.submit||t[89]!==fe||t[90]!==pe||t[91]!==he?(Y=(0,$.jsxs)(h,{type:`submit`,variant:`primary`,className:fe,disabled:pe,children:[he,o.submit]}),t[88]=o.submit,t[89]=fe,t[90]=pe,t[91]=he,t[92]=Y):Y=t[92];let _e;t[93]!==q||t[94]!==le||t[95]!==ue||t[96]!==Y?(_e=(0,$.jsxs)(`div`,{className:q,children:[le,ue,Y]}),t[93]=q,t[94]=le,t[95]=ue,t[96]=Y,t[97]=_e):_e=t[97];let ve;return t[98]!==x||t[99]!==b||t[100]!==S||t[101]!==O||t[102]!==G||t[103]!==_e||t[104]!==A||t[105]!==j?(ve=(0,$.jsxs)(`form`,{onSubmit:O,onDragOver:b,onDragLeave:x,onDrop:S,className:A,children:[j,G,_e]}),t[98]=x,t[99]=b,t[100]=S,t[101]=O,t[102]=G,t[103]=_e,t[104]=A,t[105]=j,t[106]=ve):ve=t[106],ve}function De(e){e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}function Oe(e){let t=(0,Z.c)(12),{href:n,children:r,onOpen:i}=e,o=a();if(n&&/^https?:\/\//i.test(n)){let e;return t[0]!==r||t[1]!==n?(e=(0,$.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,className:`rounded-sm text-accent-fg hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r}),t[0]=r,t[1]=n,t[2]=e):e=t[2],e}if(n?.startsWith(`/`)&&!n.startsWith(`//`)){let e=`${o.pathname}${o.search}`,a;t[3]!==n||t[4]!==e?(a=w(e,n),t[3]=n,t[4]=e,t[5]=a):a=t[5];let c;return t[6]!==r||t[7]!==i||t[8]!==a?(c=(0,$.jsx)(s,{to:a,className:`rounded-sm text-accent-fg hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:i,children:r}),t[6]=r,t[7]=i,t[8]=a,t[9]=c):c=t[9],c}let c;return t[10]===r?c=t[11]:(c=(0,$.jsx)(`span`,{children:r}),t[10]=r,t[11]=c),c}function ke(e){let t=(0,Z.c)(4),{label:n,onClick:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsx)(O,{className:`size-3.5`,"aria-hidden":!0}),t[0]=i):i=t[0];let a;return t[1]!==n||t[2]!==r?(a=(0,$.jsxs)(`button`,{type:`button`,className:`inline-flex min-h-9 items-center gap-1.5 rounded-lg px-2 text-xs font-medium text-fg-muted transition-colors duration-150 hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:r,children:[i,n]}),t[1]=n,t[2]=r,t[3]=a):a=t[3],a}function Ae(e){let t=(0,Z.c)(65),{opportunity:n,copy:r,onOpenHistory:i}=e,a,o,s,c,l,u;if(t[0]!==r.aiLabel||t[1]!==r.automationAction||t[2]!==r.automationHint||t[3]!==r.history||t[4]!==r.minutes||t[5]!==r.needsSetup||t[6]!==r.why||t[7]!==i||t[8]!==n.capabilities||t[9]!==n.continuation||t[10]!==n.estimatedMinutes||t[11]!==n.outcome||t[12]!==n.rationale||t[13]!==n.title){let e=n.capabilities.filter(Me),d;t[20]===r.aiLabel?d=t[21]:(d=(0,$.jsx)(`span`,{children:r.aiLabel}),t[20]=r.aiLabel,t[21]=d);let f;t[22]!==r.minutes||t[23]!==n.estimatedMinutes?(f=n.estimatedMinutes?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,$.jsx)(Y,{className:`size-3.5`,"aria-hidden":!0}),n.estimatedMinutes,` `,r.minutes]}):null,t[22]=r.minutes,t[23]=n.estimatedMinutes,t[24]=f):f=t[24];let p;t[25]!==d||t[26]!==f?(p=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[d,f]}),t[25]=d,t[26]=f,t[27]=p):p=t[27];let m;t[28]!==r.history||t[29]!==i?(m=(0,$.jsx)(ke,{label:r.history,onClick:i}),t[28]=r.history,t[29]=i,t[30]=m):m=t[30],t[31]!==m||t[32]!==p?(a=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[p,m]}),t[31]=m,t[32]=p,t[33]=a):a=t[33],t[34]===n.title?o=t[35]:(o=(0,$.jsx)(`h3`,{className:`mt-3 text-xl font-semibold leading-7 tracking-tight text-fg`,children:n.title}),t[34]=n.title,t[35]=o),t[36]===n.outcome?s=t[37]:(s=(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:n.outcome}),t[36]=n.outcome,t[37]=s);let h;t[38]===r.why?h=t[39]:(h=(0,$.jsxs)(`span`,{className:`font-medium text-fg`,children:[r.why,`:`]}),t[38]=r.why,t[39]=h),t[40]!==n.rationale||t[41]!==h?(c=(0,$.jsxs)(`p`,{className:`mt-4 text-sm leading-6 text-fg-muted`,children:[h,n.rationale]}),t[40]=n.rationale,t[41]=h,t[42]=c):c=t[42],t[43]!==r.automationAction||t[44]!==r.automationHint||t[45]!==n.continuation?(l=n.continuation?.kind===`automation`?(0,$.jsxs)(`div`,{className:`mt-4 flex flex-col gap-3 rounded-xl border border-edge bg-surface-subtle p-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:r.automationHint}),(0,$.jsx)(`a`,{href:`#${n.continuation.href}`,className:`inline-flex min-h-11 shrink-0 items-center rounded-lg px-3 text-xs font-medium text-accent hover:bg-accent-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r.automationAction})]}):null,t[43]=r.automationAction,t[44]=r.automationHint,t[45]=n.continuation,t[46]=l):l=t[46],u=e.length>0?(0,$.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,"aria-label":r.needsSetup,children:e.map(e=>(0,$.jsxs)(`a`,{href:`#${e.recoveryPath??`/settings`}`,className:`rounded-full border border-accent/25 bg-accent-soft px-2.5 py-1 text-xs text-accent hover:border-accent/50`,children:[r.needsSetup,` · `,e.capability]},`${e.kind}:${e.capability}`))}):null,t[0]=r.aiLabel,t[1]=r.automationAction,t[2]=r.automationHint,t[3]=r.history,t[4]=r.minutes,t[5]=r.needsSetup,t[6]=r.why,t[7]=i,t[8]=n.capabilities,t[9]=n.continuation,t[10]=n.estimatedMinutes,t[11]=n.outcome,t[12]=n.rationale,t[13]=n.title,t[14]=a,t[15]=o,t[16]=s,t[17]=c,t[18]=l,t[19]=u}else a=t[14],o=t[15],s=t[16],c=t[17],l=t[18],u=t[19];let d;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(L,{className:`size-3.5 transition-transform group-open:rotate-180`,"aria-hidden":!0}),t[47]=d):d=t[47];let f;t[48]===r.evidence?f=t[49]:(f=(0,$.jsxs)(`summary`,{className:`flex min-h-9 cursor-pointer list-none items-center gap-1.5 text-xs font-medium text-fg-muted hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[r.evidence,d]}),t[48]=r.evidence,t[49]=f);let p;t[50]===n.evidence?p=t[51]:(p=n.evidence.map(je),t[50]=n.evidence,t[51]=p);let m;t[52]===p?m=t[53]:(m=(0,$.jsx)(`ul`,{className:`mt-2 space-y-2 border-l border-edge pl-3 text-xs leading-5 text-fg-muted`,children:p}),t[52]=p,t[53]=m);let h;t[54]!==m||t[55]!==f?(h=(0,$.jsxs)(`details`,{open:!0,className:`mt-4 group`,children:[f,m]}),t[54]=m,t[55]=f,t[56]=h):h=t[56];let g;return t[57]!==a||t[58]!==h||t[59]!==o||t[60]!==s||t[61]!==c||t[62]!==l||t[63]!==u?(g=(0,$.jsxs)($.Fragment,{children:[a,o,s,c,l,u,h]}),t[57]=a,t[58]=h,t[59]=o,t[60]=s,t[61]=c,t[62]=l,t[63]=u,t[64]=g):g=t[64],g}function je(e){return(0,$.jsx)(`li`,{children:(0,$.jsx)(Oe,{href:e.href,children:e.observation})},e.id)}function Me(e){return e.readiness!==`ready`}function Ne(e){let t=(0,Z.c)(134),{advisor:n,copy:r,busy:i,onRefresh:a,onAction:o,onFeedback:s,onClarification:c,onOpenHistory:u,preflight:d,receipt:f}=e,[p,m]=(0,Q.useState)(),g;t[0]!==n.alternatives||t[1]!==n.primary||t[2]!==n.state?(g=n.state===`ready`?[n.primary,...n.alternatives]:[],t[0]=n.alternatives,t[1]=n.primary,t[2]=n.state,t[3]=g):g=t[3];let _=g,v;t[4]!==_||t[5]!==p?(v=_.find(e=>e.id===p)??_[0],t[4]=_,t[5]=p,t[6]=v):v=t[6];let y=v,b;t[7]===_[0]?.id?b=t[8]:(b=()=>m(_[0]?.id),t[7]=_[0]?.id,t[8]=b);let x=_[0]?.id,S;if(t[9]!==n.state||t[10]!==x?(S=[n.state,x],t[9]=n.state,t[10]=x,t[11]=S):S=t[11],(0,Q.useEffect)(b,S),n.state===`disabled`)return null;if(f){let e;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(l,{className:`size-5 shrink-0 text-success`,"aria-hidden":!0}),t[12]=e):e=t[12];let n;t[13]===f.title?n=t[14]:(n=(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:f.title}),t[13]=f.title,t[14]=n);let i;t[15]===f.detail?i=t[16]:(i=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:f.detail}),t[15]=f.detail,t[16]=i);let a;t[17]!==n||t[18]!==i?(a=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[n,i]}),t[17]=n,t[18]=i,t[19]=a):a=t[19];let o;t[20]!==r.history||t[21]!==u?(o=(0,$.jsx)(ke,{label:r.history,onClick:u}),t[20]=r.history,t[21]=u,t[22]=o):o=t[22];let s=`#${f.href}`,c;t[23]!==r.viewProgress||t[24]!==s?(c=(0,$.jsx)(h,{asChild:!0,variant:`secondary`,className:`min-h-10 text-xs`,children:(0,$.jsx)(`a`,{href:s,children:r.viewProgress})}),t[23]=r.viewProgress,t[24]=s,t[25]=c):c=t[25];let d;t[26]!==o||t[27]!==c?(d=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[o,c]}),t[26]=o,t[27]=c,t[28]=d):d=t[28];let p;return t[29]!==d||t[30]!==a?(p=(0,$.jsx)(`section`,{className:`mt-7 rounded-2xl border border-success/25 bg-success-soft px-5 py-4`,role:`status`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center`,children:[e,a,d]})}),t[29]=d,t[30]=a,t[31]=p):p=t[31],p}if(n.state===`quiet`||n.state===`refreshing`)return null;if(n.state===`clarification`){let e;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(ie,{className:`size-4`,"aria-hidden":!0}),t[32]=e):e=t[32];let a;t[33]===r.aiLabel?a=t[34]:(a=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-accent`,children:[e,r.aiLabel]}),t[33]=r.aiLabel,t[34]=a);let o;t[35]!==r.history||t[36]!==u?(o=(0,$.jsx)(ke,{label:r.history,onClick:u}),t[35]=r.history,t[36]=u,t[37]=o):o=t[37];let s;t[38]!==a||t[39]!==o?(s=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[a,o]}),t[38]=a,t[39]=o,t[40]=s):s=t[40];let l;t[41]===n.question.question?l=t[42]:(l=(0,$.jsx)(`h3`,{id:`home-advisor-question`,className:`mt-3 text-lg font-semibold text-fg`,children:n.question.question}),t[41]=n.question.question,t[42]=l);let d;if(t[43]!==n.question.options||t[44]!==n.question.question||t[45]!==i||t[46]!==c){let e;t[48]!==n.question.question||t[49]!==i||t[50]!==c?(e=e=>(0,$.jsx)(h,{type:`button`,variant:`secondary`,className:`min-h-11`,disabled:i,onClick:()=>c(n.question.question,e.label),children:e.label},e.id),t[48]=n.question.question,t[49]=i,t[50]=c,t[51]=e):e=t[51],d=n.question.options.map(e),t[43]=n.question.options,t[44]=n.question.question,t[45]=i,t[46]=c,t[47]=d}else d=t[47];let f;t[52]===d?f=t[53]:(f=(0,$.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:d}),t[52]=d,t[53]=f);let p;return t[54]!==l||t[55]!==f||t[56]!==s?(p=(0,$.jsxs)(`section`,{className:`mt-7 rounded-2xl border border-accent/25 bg-surface-base px-5 py-5`,"aria-labelledby":`home-advisor-question`,children:[s,l,f]}),t[54]=l,t[55]=f,t[56]=s,t[57]=p):p=t[57],p}if(!y)return null;let C=d?.opportunityId===y.id?d.value:void 0,w;t[58]!==n.stale||t[59]!==r.refreshing?(w=n.stale?(0,$.jsxs)(`p`,{className:`mb-3 inline-flex items-center gap-2 text-xs text-accent`,children:[(0,$.jsx)(R,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),r.refreshing]}):null,t[58]=n.stale,t[59]=r.refreshing,t[60]=w):w=t[60];let T;t[61]!==r||t[62]!==u||t[63]!==y?(T=(0,$.jsx)(Ae,{opportunity:y,copy:r,onOpenHistory:u}),t[61]=r,t[62]=u,t[63]=y,t[64]=T):T=t[64];let E;t[65]!==i||t[66]!==r.configure||t[67]!==r.degradedStart||t[68]!==r.setupHint||t[69]!==r.setupTitle||t[70]!==o||t[71]!==y||t[72]!==C?(E=C?.state===`needs_setup`?(0,$.jsx)(`div`,{className:`mt-5 rounded-xl border border-accent/25 bg-accent-soft/40 p-4`,role:`alert`,"aria-live":`polite`,children:(0,$.jsxs)(`div`,{className:`flex gap-3`,children:[(0,$.jsx)(ee,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:r.setupTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:r.setupHint}),(0,$.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs leading-5 text-fg-muted`,children:C.blockers.map(Pe)}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[C.recoveryActions.map(e=>(0,$.jsxs)(`a`,{href:`#${e.href}`,className:`inline-flex min-h-11 items-center rounded-lg border border-accent/30 px-3 text-xs font-medium text-accent hover:bg-accent-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[r.configure,` · `,e.capability]},e.capability)),C.degradedAction?(0,$.jsx)(h,{type:`button`,variant:`secondary`,className:`min-h-11`,disabled:i,onClick:()=>o(y,`degraded_start`),children:r.degradedStart}):null]})]})]})}):null,t[65]=i,t[66]=r.configure,t[67]=r.degradedStart,t[68]=r.setupHint,t[69]=r.setupTitle,t[70]=o,t[71]=y,t[72]=C,t[73]=E):E=t[73];let D;t[74]!==i||t[75]!==r.start||t[76]!==o||t[77]!==y?(D=y.actions.canStart?(0,$.jsxs)(h,{type:`button`,variant:`primary`,className:`min-h-11`,disabled:i,onClick:()=>o(y,`start`),children:[(0,$.jsx)(ie,{className:`size-4`,"aria-hidden":!0}),r.start]}):null,t[74]=i,t[75]=r.start,t[76]=o,t[77]=y,t[78]=D):D=t[78];let O;t[79]!==i||t[80]!==r.discuss||t[81]!==o||t[82]!==y?(O=y.actions.canDiscuss?(0,$.jsxs)(h,{type:`button`,variant:`secondary`,className:`min-h-11`,disabled:i,onClick:()=>o(y,`discuss`),children:[(0,$.jsx)(le,{className:`size-4`,"aria-hidden":!0}),r.discuss]}):null,t[79]=i,t[80]=r.discuss,t[81]=o,t[82]=y,t[83]=O):O=t[83];let k;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(R,{className:`size-4`,"aria-hidden":!0}),t[84]=k):k=t[84];let A;t[85]!==i||t[86]!==r.refresh||t[87]!==a?(A=(0,$.jsxs)(h,{type:`button`,variant:`ghost`,className:`min-h-11`,disabled:i,onClick:a,title:r.refresh,children:[k,r.refresh]}),t[85]=i,t[86]=r.refresh,t[87]=a,t[88]=A):A=t[88];let j;t[89]===r.feedback?j=t[90]:(j=(0,$.jsx)(`summary`,{className:`flex min-h-11 cursor-pointer list-none items-center rounded-lg px-3 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r.feedback}),t[89]=r.feedback,t[90]=j);let M;t[91]===r.alreadyDone?M=t[92]:(M=[`already_done`,r.alreadyDone],t[91]=r.alreadyDone,t[92]=M);let N;t[93]===r.irrelevant?N=t[94]:(N=[`irrelevant`,r.irrelevant],t[93]=r.irrelevant,t[94]=N);let P;t[95]===r.later?P=t[96]:(P=[`too_early`,r.later],t[95]=r.later,t[96]=P);let F;t[97]===r.sourceIncorrect?F=t[98]:(F=[`source_incorrect`,r.sourceIncorrect],t[97]=r.sourceIncorrect,t[98]=F);let I;t[99]===r.lessLikeThis?I=t[100]:(I=[`less_like_this`,r.lessLikeThis],t[99]=r.lessLikeThis,t[100]=I);let L;t[101]!==M||t[102]!==N||t[103]!==P||t[104]!==F||t[105]!==I?(L=[M,N,P,F,I],t[101]=M,t[102]=N,t[103]=P,t[104]=F,t[105]=I,t[106]=L):L=t[106];let z=L,B;t[107]!==i||t[108]!==s||t[109]!==y||t[110]!==z?(B=(0,$.jsx)(`div`,{className:`absolute right-0 z-20 mt-1 w-44 rounded-xl border border-edge bg-surface-overlay p-1 shadow-float`,children:z.map(e=>{let[t,n]=e;return(0,$.jsx)(`button`,{type:`button`,disabled:i,className:`min-h-10 w-full rounded-lg px-3 text-left text-sm text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>s(y,t),children:n},t)})}),t[107]=i,t[108]=s,t[109]=y,t[110]=z,t[111]=B):B=t[111];let V;t[112]!==j||t[113]!==B?(V=(0,$.jsxs)(`details`,{className:`relative ml-auto`,children:[j,B]}),t[112]=j,t[113]=B,t[114]=V):V=t[114];let H;t[115]!==O||t[116]!==A||t[117]!==V||t[118]!==D?(H=(0,$.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center gap-2`,children:[D,O,A,V]}),t[115]=O,t[116]=A,t[117]=V,t[118]=D,t[119]=H):H=t[119];let U;t[120]!==H||t[121]!==w||t[122]!==T||t[123]!==E?(U=(0,$.jsxs)(`div`,{className:`px-5 py-5 sm:px-6`,children:[w,T,E,H]}),t[120]=H,t[121]=w,t[122]=T,t[123]=E,t[124]=U):U=t[124];let W;t[125]!==i||t[126]!==r.alternatives||t[127]!==_||t[128]!==y.id?(W=_.length>1?(0,$.jsxs)(`div`,{className:`border-t border-edge-subtle px-5 py-4 sm:px-6`,children:[(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg-subtle`,children:r.alternatives}),(0,$.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:_.filter(e=>e.id!==y.id).map(e=>(0,$.jsx)(`button`,{type:`button`,disabled:i,className:`min-h-10 rounded-lg border border-edge px-3 text-left text-sm text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>m(e.id),children:e.title},e.id))})]}):null,t[125]=i,t[126]=r.alternatives,t[127]=_,t[128]=y.id,t[129]=W):W=t[129];let G;return t[130]!==r.aiLabel||t[131]!==U||t[132]!==W?(G=(0,$.jsxs)(`section`,{className:`mt-7 rounded-2xl border border-accent/25 bg-surface-base`,"aria-label":r.aiLabel,children:[U,W]}),t[130]=r.aiLabel,t[131]=U,t[132]=W,t[133]=G):G=t[133],G}function Pe(e){return(0,$.jsx)(`li`,{children:e.message},`${e.kind}:${e.capability}`)}var Fe=new Set([`started`,`discussing`,`completed`]);function Ie(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[0,1,2].map(Le)}),e[0]=t):t=e[0],t}function Le(e){return(0,$.jsxs)(`div`,{className:`space-y-2 rounded-xl border border-edge-subtle p-4`,children:[(0,$.jsx)(g,{className:`h-4 w-24 rounded`}),(0,$.jsx)(g,{className:`h-5 w-4/5 rounded`}),(0,$.jsx)(g,{className:`h-4 w-3/5 rounded`})]},e)}function Re(e){let t=(0,Z.c)(11),{open:n,refreshKey:r,onOpenChange:i,onReevaluate:a}=e,o=p(ze),s=d(o).projectsPage.home,l=c(),[f,m]=(0,Q.useState)(`all`),g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=[],t[0]=g):g=t[0];let[_,v]=(0,Q.useState)(g),[y,b]=(0,Q.useState)(!1),[x,C]=(0,Q.useState)(),E;t[1]===n?E=t[2]:(E=()=>{if(!n)return;let e=!0;return b(!0),C(void 0),N().then(t=>{e&&v(t.items)}).catch(t=>{e&&C(t instanceof Error?t.message:String(t))}).finally(()=>{e&&b(!1)}),()=>{e=!1}},t[1]=n,t[2]=E);let D;t[3]!==n||t[4]!==r?(D=[n,r],t[3]=n,t[4]=r,t[5]=D):D=t[5],(0,Q.useEffect)(E,D);let A=_.filter(e=>f===`all`||(f===`adopted`?Fe.has(e.status):!Fe.has(e.status))),j=new Intl.DateTimeFormat(o===`zh`?`zh-CN`:`en`,{dateStyle:`medium`}),F=new Intl.DateTimeFormat(o===`zh`?`zh-CN`:`en`,{dateStyle:`medium`,timeStyle:`short`}),z=new Map;for(let e of A){let t=j.format(new Date(e.updatedAt));z.set(t,[...z.get(t)??[],e])}let V=[...z.entries()],H=e=>e.feedbackKind===`already_done`?s.advisorHistoryStatusCompleted:e.feedbackKind===`irrelevant`?s.advisorHistoryStatusIrrelevant:e.feedbackKind===`source_incorrect`?s.advisorHistoryStatusSourceIncorrect:e.feedbackKind===`less_like_this`?s.advisorHistoryStatusLessLikeThis:{available:s.advisorHistoryStatusAvailable,started:s.advisorHistoryStatusStarted,discussing:s.advisorHistoryStatusDiscussing,completed:s.advisorHistoryStatusCompleted,snoozed:s.advisorHistoryStatusSnoozed,dismissed:s.advisorHistoryStatusDismissed,expired:s.advisorHistoryStatusExpired,superseded:s.advisorHistoryStatusSuperseded}[e.status],ee=e=>{if(e.href){i(!1),l(w(`/`,e.href));return}e.status===`discussing`&&(i(!1),l(`/chat/new?${new URLSearchParams({draft:e.opportunity.actionPrompt}).toString()}`))},U;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,$.jsx)(B,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim`}),t[6]=U):U=t[6];let G;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,$.jsx)(O,{className:`mt-0.5 size-5 shrink-0 text-accent`,"aria-hidden":!0}),t[7]=G):G=t[7];let K;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,$.jsx)(M,{className:`size-4`,"aria-hidden":!0}),t[8]=K):K=t[8];let q=y?(0,$.jsx)(Ie,{}):x?(0,$.jsxs)(`div`,{className:`rounded-xl border border-danger/25 bg-danger-soft p-4 text-sm text-danger`,children:[(0,$.jsx)(`p`,{children:s.advisorHistoryLoadFailed}),(0,$.jsx)(h,{type:`button`,variant:`ghost`,className:`mt-2`,onClick:()=>i(!1),children:s.advisorHistoryClose})]}):V.length===0?(0,$.jsxs)(`div`,{className:`py-16 text-center`,children:[(0,$.jsx)(O,{className:`mx-auto size-6 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:s.advisorHistoryEmpty}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:s.advisorHistoryEmptyHint})]}):(0,$.jsx)(`div`,{className:`space-y-6`,children:V.map(e=>{let[t,n]=e;return(0,$.jsxs)(`section`,{"aria-label":t,children:[(0,$.jsx)(`h3`,{className:`mb-2 text-xs font-medium text-fg-subtle`,children:t}),(0,$.jsx)(`div`,{className:`space-y-2`,children:n.map(e=>{let t=!!e.href||e.status===`discussing`,n=[`snoozed`,`dismissed`,`expired`,`superseded`].includes(e.status);return(0,$.jsxs)(`article`,{className:`rounded-xl border border-edge-subtle bg-surface-base p-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`text-xs font-medium text-accent`,children:H(e)}),(0,$.jsx)(`h4`,{className:`mt-1.5 text-sm font-semibold leading-5 text-fg`,children:e.opportunity.title}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:e.opportunity.outcome})]}),(0,$.jsx)(`time`,{className:`shrink-0 text-[11px] text-fg-subtle`,dateTime:new Date(e.updatedAt).toISOString(),children:F.format(new Date(e.updatedAt))})]}),e.snoozedUntil?(0,$.jsxs)(`p`,{className:`mt-2 inline-flex items-center gap-1 text-xs text-fg-muted`,children:[(0,$.jsx)(Y,{className:`size-3.5`,"aria-hidden":!0}),s.advisorHistoryReturnsAt,` `,F.format(new Date(e.snoozedUntil))]}):null,(0,$.jsxs)(`details`,{className:`group mt-3`,children:[(0,$.jsxs)(`summary`,{className:`flex min-h-8 cursor-pointer list-none items-center gap-1 text-xs font-medium text-fg-muted hover:text-fg`,children:[s.advisorHistoryEvidence,(0,$.jsx)(L,{className:`size-3.5 transition-transform duration-200 group-open:rotate-180 motion-reduce:transition-none`,"aria-hidden":!0})]}),(0,$.jsx)(`ul`,{className:`mt-2 space-y-1.5 border-l border-edge pl-3 text-xs leading-5 text-fg-muted`,children:e.opportunity.evidence.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsx)(Oe,{href:e.href,onOpen:()=>i(!1),children:e.observation})},e.id))})]}),t||n?(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[t?(0,$.jsxs)(h,{type:`button`,variant:`secondary`,className:`min-h-9 text-xs`,onClick:()=>ee(e),children:[(0,$.jsx)(u,{className:`size-3.5`,"aria-hidden":!0}),e.status===`discussing`?s.advisorHistoryContinueDiscussion:s.advisorHistoryViewProgress]}):null,n?(0,$.jsxs)(h,{type:`button`,variant:`ghost`,className:`min-h-9 text-xs`,onClick:()=>{i(!1),a()},children:[(0,$.jsx)(R,{className:`size-3.5`,"aria-hidden":!0}),s.advisorHistoryReevaluate]}):null]}):null]},e.opportunity.id)})})]},t)})}),J;return t[9]===q?J=t[10]:(J=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:q}),t[9]=q,t[10]=J),(0,$.jsx)(I,{open:n,onOpenChange:i,children:(0,$.jsxs)(_e,{children:[U,(0,$.jsxs)(k,{className:`xopc-drawer-right fixed right-0 top-0 z-[90] flex size-full max-w-lg flex-col overflow-hidden border-l border-edge bg-surface-overlay shadow-popover outline-none`,"aria-describedby":`home-advisor-history-description`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start gap-3 border-b border-edge px-5 py-4`,children:[G,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(S,{className:`text-base font-semibold text-fg`,children:s.advisorHistoryTitle}),(0,$.jsx)(P,{id:`home-advisor-history-description`,className:`mt-1 text-xs leading-5 text-fg-muted`,children:s.advisorHistoryDescription})]}),(0,$.jsx)(T,{asChild:!0,children:(0,$.jsx)(h,{type:`button`,variant:`ghost`,className:`-mr-2 size-9 shrink-0 p-0`,"aria-label":s.advisorHistoryClose,children:K})})]}),(0,$.jsx)(`div`,{className:`shrink-0 border-b border-edge-subtle px-5 py-3`,children:(0,$.jsx)(W,{className:`inline-flex rounded-lg bg-surface-inset p-1`,role:`group`,"aria-label":s.advisorHistoryFilterLabel,indicatorClassName:`rounded-md bg-surface-panel shadow-surface`,children:[[`all`,s.advisorHistoryFilterAll],[`adopted`,s.advisorHistoryFilterAdopted],[`other`,s.advisorHistoryFilterOther]].map(e=>{let[t,n]=e;return(0,$.jsx)(`button`,{type:`button`,className:`min-h-9 rounded-md px-3 text-xs font-medium transition-colors duration-150 ${f===t?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`}`,"aria-pressed":f===t,onClick:()=>m(t),children:n},t)})})}),J]})]})})}function ze(e){return e.language}function Be(e,t){return e.replace(`{{count}}`,String(t))}function Ve(e,t){if(e.state===`disabled`)return null;if(e.state===`ready`){let n=1+e.alternatives.length;return{label:Be(t.ready,n),detail:e.primary.title,tone:`accent`,refreshing:!!e.stale}}return e.state===`clarification`?{label:t.clarification,detail:e.question.question,tone:`accent`,refreshing:!1}:e.state===`refreshing`?{label:t.refreshing,detail:e.previous?.title??t.refreshingDetail,tone:`accent`,refreshing:!0}:e.reason===`generation_failed`?{label:t.generationFailed,detail:t.generationFailedDetail,tone:`danger`,refreshing:!1}:e.reason===`budget_exhausted`?{label:t.budgetExhausted,detail:t.budgetExhaustedDetail,tone:`warning`,refreshing:!1}:e.reason===`model_unavailable`?{label:t.modelUnavailable,detail:t.modelUnavailableDetail,tone:`warning`,refreshing:!1}:{label:t.idle,detail:t.idleDetail,tone:`neutral`,refreshing:!1}}var He={accent:`bg-accent`,danger:`bg-danger`,neutral:`bg-fg-subtle`,warning:`bg-warning`};function Ue(e){let t=(0,Z.c)(50),{advisor:n,busy:r,copy:i,onOpenHistory:a,onRefresh:o}=e,[s,c]=(0,Q.useState)(!1),l;t[0]!==n||t[1]!==i?(l=Ve(n,i),t[0]=n,t[1]=i,t[2]=l):l=t[2];let u=l;if(!u)return null;let d=n.state!==`refreshing`,p=n.state===`ready`?i.findAnother:i.retry,m=`${i.label}:${u.label}`,g;t[3]===u.refreshing?g=t[4]:(g=u.refreshing?(0,$.jsx)(R,{className:`size-3.5 shrink-0 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):(0,$.jsx)(ie,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[3]=u.refreshing,t[4]=g);let x=He[u.tone],S;t[5]===x?S=t[6]:(S=f(`size-1.5 shrink-0 rounded-full`,x),t[5]=x,t[6]=S);let C;t[7]===S?C=t[8]:(C=(0,$.jsx)(`span`,{className:S,"aria-hidden":!0}),t[7]=S,t[8]=C);let w;t[9]!==i.label||t[10]!==u.label?(w=(0,$.jsxs)(`span`,{className:`truncate`,children:[i.label,` · `,u.label]}),t[9]=i.label,t[10]=u.label,t[11]=w):w=t[11];let T;t[12]!==m||t[13]!==g||t[14]!==C||t[15]!==w?(T=(0,$.jsx)(b,{asChild:!0,children:(0,$.jsxs)(h,{type:`button`,variant:`ghost`,className:`h-9 max-w-56 rounded-lg px-2.5`,"aria-label":m,children:[g,C,w]})}),t[12]=m,t[13]=g,t[14]=C,t[15]=w,t[16]=T):T=t[16];let E;t[17]===u.refreshing?E=t[18]:(E=(0,$.jsx)(`span`,{className:`mt-1 flex size-7 shrink-0 items-center justify-center rounded-lg bg-accent-soft text-accent`,children:u.refreshing?(0,$.jsx)(R,{className:`size-4 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):(0,$.jsx)(ie,{className:`size-4`,"aria-hidden":!0})}),t[17]=u.refreshing,t[18]=E);let D;t[19]===u.label?D=t[20]:(D=(0,$.jsx)(`p`,{className:`font-semibold text-fg`,children:u.label}),t[19]=u.label,t[20]=D);let k;t[21]===u.detail?k=t[22]:(k=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:u.detail}),t[21]=u.detail,t[22]=k);let A;t[23]!==D||t[24]!==k?(A=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[D,k]}),t[23]=D,t[24]=k,t[25]=A):A=t[25];let j;t[26]!==A||t[27]!==E?(j=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[E,A]}),t[26]=A,t[27]=E,t[28]=j):j=t[28];let M;t[29]===a?M=t[30]:(M=()=>{c(!1),a()},t[29]=a,t[30]=M);let N;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,$.jsx)(O,{className:`size-3.5`,"aria-hidden":!0}),t[31]=N):N=t[31];let P;t[32]!==i.history||t[33]!==M?(P=(0,$.jsxs)(h,{type:`button`,variant:`ghost`,className:`h-9 rounded-lg text-xs`,onClick:M,children:[N,i.history]}),t[32]=i.history,t[33]=M,t[34]=P):P=t[34];let F;t[35]!==r||t[36]!==d||t[37]!==o||t[38]!==p?(F=d?(0,$.jsxs)(h,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg text-xs`,disabled:r,onClick:()=>{c(!1),o()},children:[(0,$.jsx)(R,{className:`size-3.5`,"aria-hidden":!0}),p]}):null,t[35]=r,t[36]=d,t[37]=o,t[38]=p,t[39]=F):F=t[39];let I;t[40]!==P||t[41]!==F?(I=(0,$.jsxs)(`div`,{className:`mt-4 flex items-center justify-end gap-1 border-t border-edge-subtle pt-3`,children:[P,F]}),t[40]=P,t[41]=F,t[42]=I):I=t[42];let L;t[43]!==j||t[44]!==I?(L=(0,$.jsx)(_,{children:(0,$.jsxs)(v,{side:`bottom`,align:`end`,sideOffset:6,className:`z-[70] w-[min(21rem,calc(100vw-1.5rem))] rounded-xl border border-edge bg-surface-overlay p-4 text-sm text-fg shadow-popover outline-none`,onOpenAutoFocus:We,children:[j,I]})}),t[43]=j,t[44]=I,t[45]=L):L=t[45];let z;return t[46]!==s||t[47]!==L||t[48]!==T?(z=(0,$.jsxs)(y,{open:s,onOpenChange:c,children:[T,L]}),t[46]=s,t[47]=L,t[48]=T,t[49]=z):z=t[49],z}function We(e){return e.preventDefault()}async function Ge(e,t=`en`){let n=await fe(e),r=n.runs.filter(e=>!e.parentRunId).sort((e,t)=>t.queuedAt-e.queuedAt)[0];if(!n.allowedCommands.includes(`start`)||r?.status!==`failed`)throw Error(t===`zh`?`任务状态已变化,暂时无法重试。请刷新并查看当前状态。`:`Task is no longer available for retry. Refresh and review its current state.`);await K(e,{type:`start`,executor:m.parse({...r.executorRef,kind:r.executorKind})},n.task.version)}function Ke(e){let t=e.runs.filter(e=>!e.parentRunId).sort((e,t)=>t.queuedAt-e.queuedAt)[0],n=e.conversation?.currentExecutorAgentId??e.task.delegateAgentId,r=n?{kind:`agent`,agentId:n}:t?{...t.executorRef,kind:t.executorKind}:void 0,i=m.safeParse(r);return i.success?i.data:void 0}var qe=(0,Q.lazy)(()=>i(()=>import(`./index-6YjAt50A.js`).then(e=>e.Xn).then(e=>({default:e.WorkspaceFilePreviewPanel})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52])));function Je({taskId:e,language:t,onComplete:n,onUpdated:r}){let i=t===`zh`,o=a(),c=`${o.pathname}${o.search}`,[l,u]=(0,Q.useState)(),[d,f]=(0,Q.useState)(),[p,m]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(),[y,b]=(0,Q.useState)(!1),x=(0,Q.useRef)(!1),C=(0,Q.useRef)(0),[w,T]=(0,Q.useState)(0);(0,Q.useEffect)(()=>{u(void 0),v(void 0)},[e]),(0,Q.useEffect)(()=>{let t=!0,n=++C.current;return f(void 0),fe(e).then(e=>{t&&n===C.current&&!x.current&&u(e)}).catch(e=>{t&&n===C.current&&f(e instanceof Error?e.message:String(e))}),()=>{t=!1}},[e,w]),(0,Q.useEffect)(()=>{let t=()=>{x.current||T(e=>e+1)},n=n=>{n.detail?.taskId===e&&t()};return window.addEventListener(`task-changed-v2`,n),window.addEventListener(`focus`,t),window.addEventListener(`realtime-gap`,t),window.addEventListener(`gateway-realtime-connected`,t),()=>{window.removeEventListener(`task-changed-v2`,n),window.removeEventListener(`focus`,t),window.removeEventListener(`realtime-gap`,t),window.removeEventListener(`gateway-realtime-connected`,t)}},[e]);let E=l?xe(l):[],D=l?.task.phase===`review`&&l.allowedCommands.includes(`close`)&&l.waits.length===0&&E.length>0&&E.every(e=>e.status===`passed`),O=l?Ke(l):void 0,A=l?.allowedCommands.includes(`start`)&&l.waits.length===0&&O,j=e=>{C.current++,u(e),r?.(e)};async function M(e,t,r=!1){if(!x.current){x.current=!0,C.current++,b(!0),f(void 0);try{j(await e()),v(t),r&&n()}catch(e){f(e instanceof Error?e.message:String(e))}finally{x.current=!1,b(!1)}}}let N=l?.receipts.filter(e=>l.runs.some(t=>t.id===e.runId&&t.contractVersion===l.task.latestContractVersion)).sort((e,t)=>t.finalizedAt-e.finalizedAt)[0],P=E.filter(e=>e.status===`passed`).length,F=E.filter(e=>e.status===`failed`).length,L=E.length-P-F,R=l?.task.contract?.acceptancePolicy===`verified_auto`,V=ce(c,e);return(0,$.jsxs)(`section`,{className:`mt-4 space-y-4 rounded-xl border border-edge bg-surface-panel p-4`,"aria-label":i?`任务结果与处理`:`Task result and actions`,"aria-busy":y,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i?`执行结果`:`Result`}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(h,{variant:`ghost`,disabled:y,onClick:()=>T(e=>e+1),children:i?`刷新状态`:`Refresh status`}),(0,$.jsx)(s,{to:V,className:`inline-flex min-h-9 items-center text-xs font-medium text-accent-fg hover:underline`,children:i?`查看任务详情`:`Task details`})]})]}),d?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:d}):null,y?(0,$.jsx)(`p`,{role:`status`,className:`text-xs text-fg-muted`,children:i?`正在处理…`:`Processing…`}):null,_?(0,$.jsx)(`p`,{role:`status`,className:`text-sm text-success`,children:_}):null,!l&&!d?(0,$.jsxs)(`div`,{className:`space-y-3`,"aria-busy":!0,children:[(0,$.jsx)(g,{className:`h-5 w-1/3`}),(0,$.jsx)(g,{className:`h-24 w-full`})]}):null,l?(0,$.jsxs)($.Fragment,{children:[N?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:N.completionVerdict===`achieved`?i?`执行报告已达成目标,请结合依据逐项验收。`:`The run reports the goal achieved. Review the evidence before accepting.`:i?`当前为阶段性结果,尚有工作需要推进。`:`This is a partial result. More work is needed.`}),(0,$.jsx)(X,{content:N.summary,contentKey:`home:${e}:result:${N.runId}`,language:t,previewHeight:180}),N.remainingWork.length>0?(0,$.jsxs)(`div`,{className:`text-sm text-fg-muted`,children:[(0,$.jsx)(`p`,{className:`font-medium text-fg`,children:i?`尚待完成`:`Remaining work`}),(0,$.jsx)(`ul`,{className:`mt-1 list-disc space-y-1 pl-5`,children:N.remainingWork.map((e,t)=>(0,$.jsx)(`li`,{children:e},t))})]}):null,N.nextAction?(0,$.jsxs)(`p`,{className:`whitespace-pre-wrap text-sm text-fg-muted`,children:[(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i?`下一步:`:`Next step: `}),N.nextAction]}):null,N.judgment?(0,$.jsxs)(`div`,{className:`space-y-1 text-sm text-fg-muted`,children:[(0,$.jsx)(`p`,{className:`font-medium text-fg`,children:i?`判断依据`:`Assessment`}),(0,$.jsx)(`p`,{children:N.judgment.recommendation}),(0,$.jsx)(`ul`,{className:`list-disc space-y-1 pl-5`,children:N.judgment.reasons.map((e,t)=>(0,$.jsx)(`li`,{children:e},t))}),N.judgment.uncertainty?(0,$.jsxs)(`p`,{children:[i?`待确认:`:`Uncertainty: `,N.judgment.uncertainty]}):null]}):null,(0,$.jsx)(Ce,{evidence:N.evidence,projectId:l.task.projectId,conversationId:l.conversation?.activeConversationId,language:t,onOpenFile:m})]}):(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:i?`当前任务版本暂无执行结果,可先处理等待事项或查看执行进度。`:`No result for the current task version. Resolve pending items or view progress.`}),E.length>0?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`h3`,{className:`text-sm font-semibold text-fg`,children:[i?`验收条件`:`Acceptance criteria`,` `,(0,$.jsxs)(`span`,{className:`font-normal text-fg-muted`,children:[P,`/`,E.length]})]}),E.map((n,r)=>(0,$.jsxs)(`div`,{className:`space-y-2 border-t border-edge-subtle pt-3`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 text-sm text-fg`,children:[(0,$.jsx)(`p`,{className:`break-words`,children:n.text}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:i?{passed:`已通过`,failed:`未通过`,unverified:`待判定`}[n.status]:{passed:`Passed`,failed:`Failed`,unverified:`Not reviewed`}[n.status]})]}),l.task.phase===`review`&&!R?(0,$.jsx)(`div`,{className:`flex gap-2`,children:[`passed`,`failed`].map(t=>(0,$.jsx)(h,{variant:`secondary`,disabled:y||n.status===t,onClick:()=>void M(()=>z(e,r,t,l.task.version,l.task.latestContractVersion),i?`判定已保存。`:`Review saved.`),children:i?t===`passed`?`确认通过`:`未通过`:t===`passed`?`Mark passed`:`Mark failed`},t))}):null]}),n.note?(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-xs leading-5 text-fg-muted`,children:n.note}):null,n.review?.note?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.review.note}):null,(0,$.jsx)(Ce,{evidence:n.evidence,projectId:l.task.projectId,conversationId:l.conversation?.activeConversationId,language:t,onOpenFile:m})]},r))]}):null,l.waits.length>0?(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i?`等待处理`:`Pending items`}),l.waits.map(t=>(0,$.jsx)(`div`,{children:l.allowedCommands.includes(`resolve_wait`)&&(t.kind===`user_input`||t.kind===`approval`&&typeof t.condition.capability==`string`)&&t.condition.type!==`connection`?(0,$.jsx)(Se,{wait:t,detail:l,zh:i,onUpdated:j}):(0,$.jsxs)(`div`,{className:`rounded-lg bg-surface-hover p-3 text-sm text-fg-muted`,children:[(0,$.jsx)(`p`,{children:t.reason}),t.kind===`paused`&&l.allowedCommands.includes(`resolve_wait`)?(0,$.jsx)(h,{className:`mt-2`,disabled:y,onClick:()=>void M(()=>K(e,{type:`resolve_wait`,waitId:t.id},l.task.version),i?`已解除暂停,任务状态已更新。`:`Pause resolved. Task status updated.`),children:i?`恢复任务`:`Resume task`}):(0,$.jsx)(s,{to:typeof t.condition.dependsOnTaskId==`string`?ce(c,t.condition.dependsOnTaskId):V,className:`mt-2 inline-flex min-h-9 items-center text-accent-fg hover:underline`,children:i?`查看并处理`:`View and resolve`})]})},t.id))]}):null,l.task.phase===`review`&&!D?(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:i?`尚有 ${L} 项待判定、${F} 项未通过、${l.waits.length} 项等待处理。${R?`此任务需要执行验证;请继续执行以补齐依据和未完成项。`:`查看依据后逐项判定;未通过时可继续执行修正。`}`:`${L} unreviewed, ${F} failed, ${l.waits.length} pending items. ${R?`This task requires execution verification. Continue execution to supply missing evidence.`:`Review the evidence and mark each criterion; continue execution to fix failures.`}`}):null,(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[l.task.phase===`review`?(0,$.jsx)(h,{variant:`primary`,disabled:y||!D,onClick:()=>void M(()=>K(e,{type:`close`,resolution:`done`},l.task.version),i?`任务已验收完成。`:`Task accepted.`,!0),children:i?`验收完成`:`Accept task`}):null,A?(0,$.jsx)(h,{variant:D?`secondary`:`primary`,disabled:y,onClick:()=>void M(()=>K(e,{type:`start`,executor:O},l.task.version),i?`已开始执行,结果将自动更新。`:`Execution started. Results will update automatically.`),children:i?N?`继续执行并验证`:`开始执行`:N?`Continue and verify`:`Start execution`}):null]})]}):null,l&&p?(0,$.jsx)(I,{open:!0,onOpenChange:e=>{e||m(null)},children:(0,$.jsxs)(_e,{children:[(0,$.jsx)(B,{className:`fixed inset-0 z-[80] bg-scrim`}),(0,$.jsxs)(k,{className:`app-main-surface fixed left-1/2 top-1/2 z-[90] flex h-[min(54rem,calc(100dvh-2rem))] w-[min(72rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel outline-none`,"aria-describedby":void 0,children:[(0,$.jsxs)(S,{className:`sr-only`,children:[i?`交付物预览`:`Artifact preview`,` · `,p]}),(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsxs)(`div`,{className:`flex-1 space-y-3 p-4`,"aria-busy":!0,children:[(0,$.jsx)(g,{className:`h-9 w-full`}),(0,$.jsx)(g,{className:`h-64 w-full`})]}),children:(0,$.jsx)(qe,{filePath:p,projectId:l.task.projectId,conversationId:l.conversation?.activeConversationId,onClose:()=>m(null)})})]})]})}):null]})}function Ye(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function Xe(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`div`,{className:`space-y-8`,"aria-busy":!0,children:[(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsx)(g,{className:`h-10 w-3/5 rounded-xl`}),(0,$.jsx)(g,{className:`h-5 w-4/5 rounded-lg`})]}),(0,$.jsx)(g,{className:`h-64 rounded-2xl`}),(0,$.jsx)(g,{className:`h-32 rounded-xl`})]}),e[0]=t):t=e[0],t}function Ze(e){let t=(0,Z.c)(61),{item:n,busy:r,recommendationLabel:i,dueLabel:a,failureLabel:s,locale:c,onAction:l,onComplete:u,onUpdated:d}=e,[f,p]=o(),m;t[0]===n.openAction?m=t[1]:(m=n.openAction?.type===`open`?/^\/tasks\/([^/?#]+)/.exec(n.openAction.href):null,t[0]=n.openAction,t[1]=m);let g=m,_=n.primaryAction?.type===`task_review`?n.primaryAction.taskId:g?decodeURIComponent(g[1]):void 0,v;t[2]!==_||t[3]!==f?(v=_&&f.get(`reviewTask`)===_,t[2]=_,t[3]=f,t[4]=v):v=t[4];let y=!!v,b;t[5]!==_||t[6]!==f||t[7]!==p?(b=e=>{let t=new URLSearchParams(f);e&&_?t.set(`reviewTask`,_):t.delete(`reviewTask`),p(t)},t[5]=_,t[6]=f,t[7]=p,t[8]=b):b=t[8];let x=b,S;t[9]!==a||t[10]!==n.dueAt||t[11]!==c?(S=n.dueAt?`${a} ${ye(new Date(n.dueAt),c)}`:null,t[9]=a,t[10]=n.dueAt,t[11]=c,t[12]=S):S=t[12];let C=S,w=n.kind===`failure`?s:C,T;t[13]===w?T=t[14]:(T=w?(0,$.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 text-xs font-medium text-warning`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-warning`,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:w})]}):null,t[13]=w,t[14]=T);let E=!n.openAction,D;t[15]!==n.id||t[16]!==n.openAction||t[17]!==l?(D=()=>n.openAction&&l(n.openAction,n.id),t[15]=n.id,t[16]=n.openAction,t[17]=l,t[18]=D):D=t[18];let O;t[19]===n.title?O=t[20]:(O=(0,$.jsx)(`span`,{className:`block text-lg font-semibold leading-7 tracking-tight text-fg`,children:n.title}),t[19]=n.title,t[20]=O);let k;t[21]===n.summary?k=t[22]:(k=(0,$.jsx)(`span`,{className:`mt-1.5 block text-sm leading-6 text-fg-muted`,children:n.summary}),t[21]=n.summary,t[22]=k);let A;t[23]!==E||t[24]!==D||t[25]!==O||t[26]!==k?(A=(0,$.jsxs)(`button`,{type:`button`,className:`block w-full text-left outline-none focus-visible:rounded-md focus-visible:ring-2 focus-visible:ring-accent`,disabled:E,onClick:D,children:[O,k]}),t[23]=E,t[24]=D,t[25]=O,t[26]=k,t[27]=A):A=t[27];let j;t[28]!==n.recommendation||t[29]!==i?(j=n.recommendation?(0,$.jsxs)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:[(0,$.jsxs)(`span`,{className:`font-semibold text-fg`,children:[i,`:`]}),n.recommendation]}):null,t[28]=n.recommendation,t[29]=i,t[30]=j):j=t[30];let M;t[31]!==r||t[32]!==n.id||t[33]!==n.primaryAction||t[34]!==n.secondaryActions||t[35]!==l||t[36]!==y||t[37]!==_||t[38]!==x?(M=n.primaryAction||n.secondaryActions.length>0?(0,$.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:[n.primaryAction?(0,$.jsx)(h,{type:`button`,variant:`primary`,className:`h-9 rounded-lg px-3.5 text-xs`,disabled:r,"aria-expanded":_&&[`task_review`,`open`].includes(n.primaryAction.type)?y:void 0,onClick:()=>_&&[`task_review`,`open`].includes(n.primaryAction.type)?x(!y):l(n.primaryAction,n.id),children:n.primaryAction.label}):null,n.secondaryActions.map(e=>(0,$.jsx)(h,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3.5 text-xs shadow-none`,disabled:r,onClick:()=>l(e,n.id),children:e.label},`${e.type}:${e.label}`))]}):null,t[31]=r,t[32]=n.id,t[33]=n.primaryAction,t[34]=n.secondaryActions,t[35]=l,t[36]=y,t[37]=_,t[38]=x,t[39]=M):M=t[39];let N;t[40]!==n.primaryAction?.type||t[41]!==c||t[42]!==y||t[43]!==_||t[44]!==x?(N=_&&n.primaryAction?.type===`retry_task`?(0,$.jsx)(h,{variant:`ghost`,className:`mt-2`,"aria-expanded":y,onClick:()=>x(!y),children:c===`zh`?`查看结果与依据`:`View result and evidence`}):null,t[40]=n.primaryAction?.type,t[41]=c,t[42]=y,t[43]=_,t[44]=x,t[45]=N):N=t[45];let P;t[46]!==c||t[47]!==u||t[48]!==d||t[49]!==y||t[50]!==_||t[51]!==x?(P=y&&_?(0,$.jsx)(Je,{taskId:_,language:c,onUpdated:d,onComplete:()=>{x(!1),u()}},_):null,t[46]=c,t[47]=u,t[48]=d,t[49]=y,t[50]=_,t[51]=x,t[52]=P):P=t[52];let F;return t[53]!==r||t[54]!==A||t[55]!==j||t[56]!==M||t[57]!==N||t[58]!==P||t[59]!==T?(F=(0,$.jsxs)(`article`,{className:`px-5 py-5 sm:px-6 sm:py-6`,"aria-busy":r,children:[T,A,j,M,N,P]}),t[53]=r,t[54]=A,t[55]=j,t[56]=M,t[57]=N,t[58]=P,t[59]=T,t[60]=F):F=t[60],F}function Qe(e){let t=(0,Z.c)(38),{item:n,onAction:r,language:i,onUpdated:a}=e,[o,s]=(0,Q.useState)(!1),c;t[0]===n.openAction?c=t[1]:(c=n.openAction?.type===`open`?/^\/tasks\/([^/?#]+)/.exec(n.openAction.href):null,t[0]=n.openAction,t[1]=c);let l=c,u=l?decodeURIComponent(l[1]):void 0,d;t[2]===n.kind?d=t[3]:(d=n.kind===`scheduled`?(0,$.jsx)(A,{className:`size-4`,"aria-hidden":!0}):(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-fg-subtle`,"aria-hidden":!0}),t[2]=n.kind,t[3]=d);let f=d,p=!n.openAction,m=u?o:void 0,h;t[4]!==n.id||t[5]!==n.openAction||t[6]!==r||t[7]!==u?(h=()=>u?s($e):n.openAction&&r(n.openAction,n.id),t[4]=n.id,t[5]=n.openAction,t[6]=r,t[7]=u,t[8]=h):h=t[8];let g;t[9]===f?g=t[10]:(g=(0,$.jsx)(`span`,{className:`flex size-7 shrink-0 items-center justify-center text-fg-subtle`,children:f}),t[9]=f,t[10]=g);let _;t[11]===n.title?_=t[12]:(_=(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:n.title}),t[11]=n.title,t[12]=_);let v;t[13]===n.summary?v=t[14]:(v=(0,$.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,children:n.summary}),t[13]=n.summary,t[14]=v);let y;t[15]!==_||t[16]!==v?(y=(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[_,v]}),t[15]=_,t[16]=v,t[17]=y):y=t[17];let b;t[18]===n.statusLabel?b=t[19]:(b=n.statusLabel?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:n.statusLabel}):null,t[18]=n.statusLabel,t[19]=b);let x;t[20]===n.openAction?x=t[21]:(x=n.openAction?(0,$.jsx)(F,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}):null,t[20]=n.openAction,t[21]=x);let S;t[22]!==b||t[23]!==x||t[24]!==p||t[25]!==m||t[26]!==h||t[27]!==g||t[28]!==y?(S=(0,$.jsxs)(`button`,{type:`button`,className:`flex min-h-16 w-full items-center gap-3 py-3 text-left outline-none hover:text-fg focus-visible:rounded-md focus-visible:ring-2 focus-visible:ring-accent`,disabled:p,"aria-expanded":m,onClick:h,children:[g,y,b,x]}),t[22]=b,t[23]=x,t[24]=p,t[25]=m,t[26]=h,t[27]=g,t[28]=y,t[29]=S):S=t[29];let C;t[30]!==o||t[31]!==i||t[32]!==a||t[33]!==u?(C=u&&o?(0,$.jsx)(Je,{taskId:u,language:i,onUpdated:a,onComplete:()=>s(!1)}):null,t[30]=o,t[31]=i,t[32]=a,t[33]=u,t[34]=C):C=t[34];let w;return t[35]!==S||t[36]!==C?(w=(0,$.jsxs)(`div`,{children:[S,C]}),t[35]=S,t[36]=C,t[37]=w):w=t[37],w}function $e(e){return!e}function et(){let e=p(e=>e.language),t=d(e),n=t.projectsPage,r=ue(e),i=c(),o=a(),s=me(e=>e.setPageHeader),l=me(e=>e.clearPageHeader),[u,f]=(0,Q.useState)(!1),{home:m,loading:g,loadError:_,setLoadError:v,load:y}=we(e,o.key,u),[b,D]=(0,Q.useState)(!1),[O,A]=(0,Q.useState)(``),N=(0,Q.useRef)(!1),[F,L]=(0,Q.useState)(),[R,z]=(0,Q.useState)(!1),[ee,W]=(0,Q.useState)(null),[K,J]=(0,Q.useState)(!1),[ne,ie]=(0,Q.useState)(),[ce,le]=(0,Q.useState)(!1),[de,fe]=(0,Q.useState)(0),[ge,Y]=(0,Q.useState)(),[ye,be]=(0,Q.useState)(),[xe,Se]=(0,Q.useState)(!1),X=j({chat:t.chat}),Ce=(0,Q.useRef)(null),Z=E({disabled:xe,chat:t.chat,onTranscript:e=>{A(t=>U(t,e)),window.setTimeout(()=>Ce.current?.focus(),0)}}),{phase:Te,voiceActive:De,startVoiceInput:Oe,cancelVoiceInput:ke,confirmVoiceInput:Ae,retryVoiceInput:je}=Z;(0,Q.useEffect)(()=>{if(!ge)return;let e=window.setTimeout(()=>Y(void 0),8e3);return()=>window.clearTimeout(e)},[ge]);let Me=(0,Q.useCallback)(async e=>{if(!(e.length===0||xe)){Se(!0);try{await X.processFiles(e)}finally{Se(!1)}}},[xe,X.processFiles]),Pe=(0,Q.useCallback)(async e=>{let t=ae(e.clipboardData);t.length!==0&&(e.preventDefault(),await Me(t))},[Me]),Fe=(0,Q.useCallback)(e=>{e.dataTransfer.types.includes(`Files`)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`,X.setIsDragging(!0))},[X.setIsDragging]),Ie=(0,Q.useCallback)(e=>{let t=e.relatedTarget;(!(t instanceof Node)||!e.currentTarget.contains(t))&&X.setIsDragging(!1)},[X.setIsDragging]),Le=(0,Q.useCallback)(async e=>{e.preventDefault(),X.setIsDragging(!1),await Me(Array.from(e.dataTransfer.files))},[X.setIsDragging,Me]),ze=(0,Q.useCallback)(e=>{e.preventDefault();let t=X.wireAttachmentsPayload(),n=oe(O,t.length>0?pe(t):void 0,{projectScope:`none`});n&&(D(!1),A(``),X.clearAttachments(),i(n))},[X.clearAttachments,X.wireAttachmentsPayload,O,i]),Be=X.attachments.length>=10,Ve={attachTitle:Be?Ye(t.chat.maxAttachmentsReached,{max:10}):`${t.chat.attachFile} (${X.attachments.length}/10)`,dropFiles:t.chat.dropFiles,intentLabel:r.intentLabel,intentPlaceholder:r.intentPlaceholder,intentSuggestion:r.intentSuggestion,shortcut:n.home.submitShortcut,submit:r.newWork},He=(0,Q.useMemo)(()=>({label:n.home.advisorStatusLabel,ready:n.home.advisorStatusReady,clarification:n.home.advisorStatusClarification,refreshing:n.home.advisorStatusRefreshing,refreshingDetail:n.home.advisorRefreshing,idle:n.home.advisorStatusIdle,idleDetail:n.home.advisorUnavailableTitle,generationFailed:n.home.advisorStatusGenerationFailed,budgetExhausted:n.home.advisorStatusBudgetExhausted,modelUnavailable:n.home.advisorStatusModelUnavailable,generationFailedDetail:n.home.advisorGenerationFailed,budgetExhaustedDetail:n.home.advisorBudgetExhausted,modelUnavailableDetail:n.home.advisorModelUnavailable,history:n.home.advisorHistory,retry:n.home.retry,findAnother:n.home.advisorRefresh}),[n.home]),We=!!(m&&m.needsUser.length===0&&m.backgroundCount===0),Ke=!!(m&&m.needsUser.length===0),qe=Ke||b;(0,Q.useEffect)(()=>{!qe&&De&&ke()},[ke,qe,De]),(0,Q.useEffect)(()=>{let e=e=>{let t=e.detail?.target;t&&t!==`chat`||!qe||xe||(e.preventDefault(),Te===`recording`?Ae():Te===`idle`?(Ce.current?.focus(),Oe()):Te===`error`&&je())},t=e=>{let t=e.detail?.target;t&&t!==`chat`||!qe||!De||(e.preventDefault(),ke(),Ce.current?.focus())};return window.addEventListener(C,e),window.addEventListener(H,t),()=>{window.removeEventListener(C,e),window.removeEventListener(H,t)}},[xe,ke,qe,Ae,je,Oe,De,Te]);let Je=(0,Q.useCallback)(e=>{e||ke(),D(e)},[ke]),$e=(0,Q.useCallback)((t,n)=>{if(t.type===`open`){i(w(`/`,t.href));return}t.type===`task_review`||N.current||(N.current=!0,W(n),L(void 0),v(null),(async()=>{try{if(t.type===`retry_task`)await Ge(t.taskId,e),L({message:e===`zh`?`任务已重新开始,可查看执行进度。`:`Task restarted. View progress.`,href:w(`/`,`/tasks/${encodeURIComponent(t.taskId)}`)});else if(t.type===`connector_decision`)await q({kind:`connector_approval`,approvalId:t.approvalId},t.decision),L({message:e===`zh`?t.decision===`approve`?`已批准授权,任务状态将自动更新。`:`已拒绝授权。`:t.decision===`approve`?`Permission approved. Task status will update.`:`Permission denied.`});else if(t.type===`retry_run`){let n=await re({kind:t.subjectKind,runId:t.runId});L({message:e===`zh`?`已发起重试,可查看新的执行结果。`:`Retry started. Follow the new execution.`,href:n.conversationId?`/chat/${encodeURIComponent(n.conversationId)}`:`/automations?run=${encodeURIComponent(n.runId)}`})}else t.type===`acknowledge_run`&&(await V({kind:t.subjectKind,runId:t.runId}),L({message:e===`zh`?`已确认此异常,已从待处理事项移除。`:`Issue acknowledged and removed from pending items.`}));await y()}catch(e){v(e instanceof Error?e.message:String(e))}finally{N.current=!1,W(null)}})())},[e,y,i]),et=(0,Q.useCallback)(t=>{L({message:e===`zh`?t.task.phase===`closed`?`任务已验收完成。`:`操作已保存,任务状态已更新。`:t.task.phase===`closed`?`Task accepted.`:`Action saved. Task status updated.`,href:w(`/`,`/tasks/${encodeURIComponent(t.task.id)}`)}),y()},[e,y]),tt=(0,Q.useCallback)(()=>{J(!0),ie(void 0),be(void 0),v(null),te(e).then(()=>y()).catch(e=>v(e instanceof Error?e.message:String(e))).finally(()=>J(!1))},[e,y]),nt=(0,Q.useCallback)((e,t)=>{J(!0),v(null),ve(e,t).then(async t=>{if(t.outcome===`needs_setup`){be({opportunityId:e.id,value:t.preflight});return}if(be(void 0),fe(e=>e+1),t.outcome===`task`){ie({title:n.home.advisorStartedTitle,detail:Ye(n.home.advisorStartedDetail,{title:e.title}),href:w(`/`,t.href)}),await y();return}i(t.href)}).catch(e=>v(e instanceof Error?e.message:String(e))).finally(()=>J(!1))},[y,i,n.home.advisorStartedDetail,n.home.advisorStartedTitle]),rt=(0,Q.useCallback)((e,t)=>{J(!0),ie(void 0),be(void 0),v(null),x(e,{kind:t,snoozedUntil:t===`too_early`?Date.now()+4320*6e4:void 0}).then(({idempotencyKey:t})=>(Y({opportunityId:e.id,idempotencyKey:t}),fe(e=>e+1),y())).catch(e=>v(e instanceof Error?e.message:String(e))).finally(()=>J(!1))},[y]),it=(0,Q.useCallback)(()=>{if(!ge)return;let e=ge;Y(void 0),J(!0),v(null),he(e.opportunityId,e.idempotencyKey).then(()=>(fe(e=>e+1),y())).catch(t=>{Y(e),v(t instanceof Error?t.message:String(t))}).finally(()=>J(!1))},[ge,y]),at=(0,Q.useCallback)((e,t)=>{i(`/chat/new?${new URLSearchParams({draft:`${e}\n\n${t}`}).toString()}`)},[i]),ot=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[m?(0,$.jsx)(Ue,{advisor:m.advisor,busy:K,copy:He,onOpenHistory:()=>le(!0),onRefresh:tt}):null,Ke?null:(0,$.jsxs)(h,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>D(!0),children:[(0,$.jsx)(G,{className:`size-4`,"aria-hidden":!0}),r.newWork]})]}),[K,He,r.newWork,m,tt,Ke]);(0,Q.useLayoutEffect)(()=>(s({startExtra:null,main:(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),end:ot}),()=>l()),[l,ot,s,n.title]);let st=m?.needsUser.length??0,ct=m?.backgroundCount??0,lt=st>0?Ye(n.home.attentionTitle,{count:st}):ct>0?n.home.clearTitle:n.home.idleTitle,ut=st>0?ct>0?Ye(n.home.attentionIntroWithBackground,{count:ct}):n.home.attentionIntro:ct>0?Ye(n.home.clearIntro,{count:ct}):n.home.idleIntro;return(0,$.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[920px] flex-1 flex-col px-4 pb-8 pt-3 sm:px-6 lg:px-8 lg:pb-12 lg:pt-4`,children:[(0,$.jsx)(`input`,{ref:X.fileInputRef,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{let t=e.target.files;t&&Me(Array.from(t)),e.target.value=``}}),(0,$.jsx)(I,{open:b,onOpenChange:Je,children:(0,$.jsxs)(_e,{children:[(0,$.jsx)(B,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(k,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(31rem,calc(100dvh-1.5rem))] w-[min(36rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float focus:outline-none`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start gap-4 border-b border-edge px-5 py-4`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(S,{className:`text-base font-semibold text-fg`,children:r.dialogTitle}),(0,$.jsx)(P,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:r.dialogDescription})]}),(0,$.jsx)(T,{asChild:!0,children:(0,$.jsx)(h,{type:`button`,variant:`ghost`,className:`-mr-2 -mt-1 size-8 shrink-0 rounded-lg p-0`,title:n.cancel,"aria-label":n.cancel,children:(0,$.jsx)(M,{className:`size-4`,"aria-hidden":!0})})})]}),(0,$.jsx)(Ee,{variant:`dialog`,inputId:`new-conversation-intent`,inputRef:Ce,intent:O,labels:{...Ve,submit:r.submit},attachments:X.attachments,isDragging:X.isDragging,attachmentBusy:xe,attachmentsFull:Be,voice:Z,chat:t.chat,cancelAction:(0,$.jsx)(T,{asChild:!0,children:(0,$.jsx)(h,{type:`button`,variant:`ghost`,children:n.cancel})}),onIntentChange:A,onPickFiles:()=>X.fileInputRef.current?.click(),onRemoveAttachment:X.removeAttachment,onPaste:e=>void Pe(e),onDragOver:Fe,onDragLeave:Ie,onDrop:e=>void Le(e),onSubmit:ze})]})]})}),(0,$.jsx)(Re,{open:ce,refreshKey:de,onOpenChange:le,onReevaluate:tt}),_?(0,$.jsxs)(`div`,{role:`alert`,className:`mb-6 flex items-center justify-between gap-3 rounded-xl border border-danger/25 bg-danger-soft px-4 py-3 text-sm text-danger`,children:[(0,$.jsx)(`span`,{children:_}),(0,$.jsx)(h,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void y(),children:n.home.retry})]}):null,F?(0,$.jsxs)(`div`,{role:`status`,className:`mb-5 flex flex-wrap items-center justify-between gap-3 rounded-xl border border-success/25 bg-success-soft px-4 py-3 text-sm text-fg`,children:[(0,$.jsx)(`span`,{children:F.message}),F.href?(0,$.jsx)(h,{variant:`ghost`,onClick:()=>i(F.href),children:e===`zh`?`查看进展与结果`:`View progress and result`}):null]}):null,g?(0,$.jsx)(Xe,{}):m?(0,$.jsxs)(`div`,{className:We?`mx-auto my-auto w-full max-w-[640px]`:`w-full`,children:[(0,$.jsxs)(`section`,{className:We?`w-full text-center`:`max-w-3xl`,children:[(0,$.jsx)(`h2`,{className:`text-3xl font-semibold leading-tight tracking-[-0.035em] text-fg sm:text-4xl`,children:lt}),(0,$.jsx)(`p`,{className:We?`mx-auto mt-3 max-w-xl text-sm leading-6 text-fg-muted sm:text-base sm:leading-7`:`mt-3 max-w-2xl text-sm leading-6 text-fg-muted sm:text-base sm:leading-7`,children:ut})]}),Ke?(0,$.jsx)(Ee,{variant:`inline`,inputId:`home-conversation-intent`,inputRef:Ce,intent:O,labels:Ve,attachments:X.attachments,isDragging:X.isDragging,attachmentBusy:xe,attachmentsFull:Be,voice:Z,chat:t.chat,onIntentChange:A,onPickFiles:()=>X.fileInputRef.current?.click(),onRemoveAttachment:X.removeAttachment,onPaste:e=>void Pe(e),onDragOver:Fe,onDragLeave:Ie,onDrop:e=>void Le(e),onSubmit:ze}):null,(0,$.jsx)(Ne,{advisor:m.advisor,busy:K,copy:{aiLabel:n.home.advisorAiLabel,why:n.home.advisorWhy,evidence:n.home.advisorEvidence,needsSetup:n.home.advisorNeedsSetup,start:n.home.advisorStart,discuss:n.home.advisorDiscuss,refresh:n.home.advisorRefresh,refreshing:n.home.advisorRefreshing,history:n.home.advisorHistory,viewProgress:n.home.advisorViewProgress,alternatives:n.home.advisorAlternatives,feedback:n.home.advisorFeedback,alreadyDone:n.home.advisorAlreadyDone,irrelevant:n.home.advisorIrrelevant,later:n.home.advisorLater,lessLikeThis:n.home.advisorLessLikeThis,sourceIncorrect:n.home.advisorSourceIncorrect,minutes:n.home.advisorMinutes,setupTitle:n.home.advisorSetupTitle,setupHint:n.home.advisorSetupHint,configure:n.home.advisorConfigure,degradedStart:n.home.advisorDegradedStart,automationHint:n.home.advisorAutomationHint,automationAction:n.home.advisorAutomationAction},onRefresh:tt,onAction:nt,onFeedback:rt,onClarification:at,onOpenHistory:()=>le(!0),preflight:ye,receipt:ne}),m.needsUser.length>0?(0,$.jsxs)(`section`,{className:`mt-10`,"aria-labelledby":`home-needs-user-title`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 px-1`,children:[(0,$.jsx)(se,{className:`size-4 text-warning`,"aria-hidden":!0}),(0,$.jsx)(`h2`,{id:`home-needs-user-title`,className:`text-sm font-semibold text-fg`,children:n.home.needsUserTitle})]}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-2xl border border-edge-subtle bg-surface-base`,children:m.needsUser.map(t=>(0,$.jsx)(Ze,{item:t,busy:ee!==null,recommendationLabel:n.home.recommendationLabel,dueLabel:n.home.dueLabel,failureLabel:r.runAttention,locale:e,onAction:$e,onComplete:()=>void y(),onUpdated:et},t.id))}),u||(m.attentionPolicy?.suppressedDecisionCount??0)+(m.attentionPolicy?.suppressedAttentionCount??0)>0?(0,$.jsx)(h,{variant:`ghost`,className:`mt-2`,"aria-expanded":u,onClick:()=>f(e=>!e),children:e===`zh`?u?`收起待处理事项`:`查看其余 ${(m.attentionPolicy?.suppressedDecisionCount??0)+(m.attentionPolicy?.suppressedAttentionCount??0)} 项待处理事项`:u?`Show fewer pending items`:`View ${(m.attentionPolicy?.suppressedDecisionCount??0)+(m.attentionPolicy?.suppressedAttentionCount??0)} more pending items`}):null]}):null,m.background.length>0?(0,$.jsxs)(`section`,{className:`mt-10`,"aria-labelledby":`home-background-title`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-1`,children:[(0,$.jsx)(`h2`,{id:`home-background-title`,className:`text-sm font-semibold text-fg`,children:n.home.backgroundTitle}),(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:Ye(n.home.backgroundCount,{count:m.backgroundCount})})]}),(0,$.jsx)(`div`,{className:`mt-2 divide-y divide-edge-subtle border-y border-edge-subtle`,children:(R?m.background:m.background.slice(0,3)).map(t=>(0,$.jsx)(Qe,{item:t,language:e,onAction:$e,onUpdated:et},t.id))}),m.background.length>3?(0,$.jsx)(h,{variant:`ghost`,className:`mt-2`,"aria-expanded":R,onClick:()=>z(e=>!e),children:e===`zh`?R?`收起`:`查看全部 ${m.backgroundCount} 项`:R?`Show less`:`View all ${m.backgroundCount} items`}):null]}):null]}):null,ge?(0,$.jsxs)(`div`,{role:`status`,className:`fixed bottom-5 left-1/2 z-[100] flex -translate-x-1/2 items-center gap-4 rounded-lg border border-edge bg-surface-overlay px-4 py-3 text-sm text-fg shadow-float`,children:[(0,$.jsx)(`span`,{children:n.home.advisorFeedbackSaved}),(0,$.jsx)(`button`,{type:`button`,className:`font-medium text-accent-fg hover:underline`,onClick:it,children:n.home.advisorUndo})]}):null]})}export{et as HomePage};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CiDVRMmX.js","assets/rolldown-runtime-aKtaBQYM.js","assets/preload-helper-zJ_50EbN.js","assets/es2015-DBLcMg5B.js","assets/vendor-react-BOUWij0V.js","assets/dist-CxGUk8J-.js","assets/middleware-Pd0e8Igk.js","assets/locale-store-DAgpZxAS.js","assets/messages-DMXSIJUO.js","assets/dist-CI_fqRk-.js","assets/floating-ui.dom-B7uQOZZW.js","assets/chunk-KS7C4IRE-BvcCCgTW.js","assets/vendor-swr-BIWyz7Rc.js","assets/createLucideIcon-DPHK1VkS.js","assets/check-DUBLcKHA.js","assets/popover-select-DGKUpVsz.js","assets/dist-C3DSFZCi.js","assets/skeleton-BI5TyibZ.js","assets/cn-0WouolD0.js","assets/bundle-mjs-rHxsej31.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/circle-check-C23XjkUj.js","assets/copy-Dv6d4Dvw.js","assets/download-Dk-ZjtO6.js","assets/external-link-DjqjBmc3.js","assets/file-image-CDUPkZvG.js","assets/globe-DSSGFWFn.js","assets/loader-circle-CifKLtgG.js","assets/session-manager-DWbcMHcj.js","assets/schemas-CObaziC7.js","assets/gateway-realtime-CY1LBGBS.js","assets/gateway-realtime-store-Dafw95ol.js","assets/local-session-drafts-BCaC-1rH.js","assets/session-api-D6-Vz8xK.js","assets/gateway-startup-retry-CPKGkr6D.js","assets/personal-proactivity-BJcZ3Yhi.js","assets/constants-DeXt1mV-.js","assets/tool-activity-BtJkgjFf.js","assets/registry-api-B6kqbuw8.js","assets/attachment-utils-core-BIOUBrpT.js","assets/agents-admin-api-uGDeJR1f.js","assets/gateway-config-swr-BVqYVaGy.js","assets/capabilities-B9b5KCBb.js","assets/local-apps-yys1VChX.js","assets/tasks-TVRjEggr.js","assets/specialists-4bkS5rZ4.js","assets/product-delivery-BqNm-8S5.js","assets/files-Bw4SBGdM.js","assets/button-aIC072nz.js","assets/sliding-indicator-hwz0sx3h.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/electron-env-Dit0bHgy.js","assets/index-caRW34rg.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-zJ_50EbN.js";import{l as a,m as o,t as s,u as c}from"./chunk-KS7C4IRE-BvcCCgTW.js";import{t as l}from"./circle-check-C23XjkUj.js";import{t as u}from"./external-link-DjqjBmc3.js";import{t as d}from"./messages-DMXSIJUO.js";import{t as f}from"./cn-0WouolD0.js";import{n as p}from"./locale-store-DAgpZxAS.js";import{s as m}from"./tasks-TVRjEggr.js";import{t as h}from"./button-aIC072nz.js";import{t as g}from"./skeleton-BI5TyibZ.js";import{a as _,i as v,o as y,s as b}from"./dist-C3DSFZCi.js";import{$s as x,Bc as S,Cn as C,Ec as w,Fc as T,Fo as E,Gs as D,Hu as O,Ic as k,Id as A,Jr as j,Kc as M,Ks as N,Lc as P,Md as F,Pc as I,Pd as L,Pl as R,Qs as z,Rc as B,Rs as V,Sn as H,Tl as ee,Tn as U,Va as W,Vl as G,Vs as K,Xs as q,Yr as J,Ys as te,Zl as ne,Zs as re,_l as ie,di as ae,ga as oe,jd as se,kc as ce,mu as le,oc as ue,oi as de,qs as fe,r as pe,ro as me,tc as he,wn as ge,xd as Y,zc as _e,zs as ve}from"./index-CiDVRMmX.js";import{n as ye}from"./date-formatters-DukWSVwc.js";import{n as be}from"./tab-completion-input-CxtEp0aP.js";import{i as xe,n as Se,r as X,t as Ce}from"./task-result-evidence-HJO1BlJm.js";var Z=n(),Q=e(t(),1);function we(e,t,n=!1){let[r,i]=(0,Q.useState)(null),[a,o]=(0,Q.useState)(!0),[s,c]=(0,Q.useState)(null),l=(0,Q.useRef)(0),u=(0,Q.useCallback)(async()=>{let t=++l.current;c(null);try{let r=await(n?D(e,!0):D(e));t===l.current&&i(r)}catch(e){t===l.current&&c(e instanceof Error?e.message:String(e))}finally{t===l.current&&o(!1)}},[e,n]);return(0,Q.useEffect)(()=>(u(),()=>{l.current++}),[u,t]),(0,Q.useEffect)(()=>{let e,t=1/0,n=n=>{let r=Date.now()+n;r>=t||(window.clearTimeout(e),t=r,e=window.setTimeout(()=>{e=void 0,t=1/0,u()},n))},r=()=>n(100),i=()=>n(750),a=()=>{document.visibilityState===`visible`&&r()},o=[`task-changed-v2`,`task-updated`,`session-created`,`agent-run-started`,`agent-run-ended`,`automation-run-completed`,`home-advisor-updated`,`gateway-realtime-connected`,`realtime-gap`,`focus`],s=[`session-updated`,`session-transcript-updated`];return o.forEach(e=>window.addEventListener(e,r)),s.forEach(e=>window.addEventListener(e,i)),document.addEventListener(`visibilitychange`,a),()=>{o.forEach(e=>window.removeEventListener(e,r)),s.forEach(e=>window.removeEventListener(e,i)),document.removeEventListener(`visibilitychange`,a),window.clearTimeout(e)}},[u]),{home:r,loading:a,loadError:s,setLoadError:c,load:u}}var $=r(),Te=12e3;function Ee(e){let t=(0,Z.c)(107),{variant:n,inputId:r,inputRef:i,intent:a,labels:o,attachments:s,isDragging:c,attachmentBusy:l,attachmentsFull:u,voice:d,chat:p,cancelAction:m,onIntentChange:g,onPickFiles:_,onRemoveAttachment:v,onPaste:y,onDragOver:b,onDragLeave:x,onDrop:S,onSubmit:C}=e,w=n===`inline`,T;t[0]!==s||t[1]!==a?(T=!!a.trim()||s.length>0,t[0]=s,t[1]=a,t[2]=T):T=t[2];let E=T,D=d.voiceActive&&d.phase!==`error`,O;t[3]!==C||t[4]!==d.voiceActive?(O=e=>{if(d.voiceActive){e.preventDefault();return}C(e)},t[3]=C,t[4]=d.voiceActive,t[5]=O):O=t[5];let k=w?`mx-auto mt-6 w-full overflow-hidden rounded-xl border border-edge bg-surface-base p-2 text-left shadow-surface transition-colors focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/15 sm:mt-8`:`flex min-h-0 flex-1 flex-col`,A;t[6]===k?A=t[7]:(A=f(`relative`,k),t[6]=k,t[7]=A);let j;t[8]!==w||t[9]!==c||t[10]!==o.dropFiles?(j=c?(0,$.jsx)(`div`,{className:f(`pointer-events-none absolute inset-0 z-10 flex items-center justify-center bg-accent-soft/90 text-sm font-medium text-accent-fg backdrop-blur-[1px]`,w&&`rounded-2xl`),children:o.dropFiles}):null,t[8]=w,t[9]=c,t[10]=o.dropFiles,t[11]=j):j=t[11];let M=!w&&`flex min-h-0 flex-1 flex-col overflow-y-auto px-5 py-4`,N;t[12]===M?N=t[13]:(N=f(M),t[12]=M,t[13]=N);let P=w?`sr-only`:`mb-2 shrink-0 text-sm font-medium text-fg`,F;t[14]!==r||t[15]!==o.intentLabel||t[16]!==P?(F=(0,$.jsx)(`label`,{htmlFor:r,className:P,children:o.intentLabel}),t[14]=r,t[15]=o.intentLabel,t[16]=P,t[17]=F):F=t[17];let I;t[18]!==l||t[19]!==p||t[20]!==d.audioLevel||t[21]!==d.cancelVoiceInput||t[22]!==d.confirmVoiceInput||t[23]!==d.elapsedLabel||t[24]!==d.error||t[25]!==d.finalTranscript||t[26]!==d.partialTranscript||t[27]!==d.phase||t[28]!==d.recordedDictation||t[29]!==d.retryVoiceInput||t[30]!==d.settingsRequired||t[31]!==d.voiceActive?(I=d.voiceActive?(0,$.jsx)(ge,{phase:d.phase,elapsedLabel:d.elapsedLabel,recordedDictation:d.recordedDictation,audioLevel:d.audioLevel,partialTranscript:d.partialTranscript,finalTranscript:d.finalTranscript,error:d.error,settingsRequired:d.settingsRequired,disabled:l,chat:p,onCancel:d.cancelVoiceInput,onConfirm:d.confirmVoiceInput,onRetry:d.retryVoiceInput}):null,t[18]=l,t[19]=p,t[20]=d.audioLevel,t[21]=d.cancelVoiceInput,t[22]=d.confirmVoiceInput,t[23]=d.elapsedLabel,t[24]=d.error,t[25]=d.finalTranscript,t[26]=d.partialTranscript,t[27]=d.phase,t[28]=d.recordedDictation,t[29]=d.retryVoiceInput,t[30]=d.settingsRequired,t[31]=d.voiceActive,t[32]=I):I=t[32];let L=D&&`hidden`,R=w?`min-h-24 bg-transparent px-3 py-2`:`min-h-32 flex-1 rounded-xl border border-edge bg-surface-base p-3 focus:border-accent focus:ring-2 focus:ring-accent/20`,z;t[33]!==L||t[34]!==R?(z=f(`w-full resize-none text-sm font-normal leading-6 text-fg outline-none placeholder:text-fg-subtle`,L,R),t[33]=L,t[34]=R,t[35]=z):z=t[35];let B;t[36]===g?B=t[37]:(B=e=>g(e.target.value),t[36]=g,t[37]=B);let V=!w,H;t[38]!==r||t[39]!==i||t[40]!==a||t[41]!==o.intentPlaceholder||t[42]!==o.intentSuggestion||t[43]!==g||t[44]!==y||t[45]!==z||t[46]!==B||t[47]!==V?(H=(0,$.jsx)(be,{ref:i,id:r,className:z,value:a,onChange:B,onPaste:y,suggestion:o.intentSuggestion,onAcceptSuggestion:g,onKeyDown:De,placeholder:o.intentPlaceholder,maxLength:Te,autoFocus:V}),t[38]=r,t[39]=i,t[40]=a,t[41]=o.intentPlaceholder,t[42]=o.intentSuggestion,t[43]=g,t[44]=y,t[45]=z,t[46]=B,t[47]=V,t[48]=H):H=t[48];let ee=w?`border-b-0 bg-transparent px-3 pb-2 pt-0`:`mt-3 border-b-0 bg-transparent px-0 pb-0`,U;t[49]!==s||t[50]!==v||t[51]!==ee?(U=(0,$.jsx)(de,{attachments:s,topPadded:!1,onRemove:v,className:ee}),t[49]=s,t[50]=v,t[51]=ee,t[52]=U):U=t[52];let W;t[53]!==w||t[54]!==a.length||t[55]!==o.shortcut?(W=w?null:(0,$.jsxs)(`div`,{className:`mt-2 flex shrink-0 items-center justify-between gap-3 text-[11px] text-fg-subtle`,children:[(0,$.jsx)(`span`,{children:o.shortcut}),(0,$.jsxs)(`span`,{className:`tabular-nums`,children:[a.length.toLocaleString(),` / `,Te.toLocaleString()]})]}),t[53]=w,t[54]=a.length,t[55]=o.shortcut,t[56]=W):W=t[56];let G;t[57]!==I||t[58]!==H||t[59]!==U||t[60]!==W||t[61]!==N||t[62]!==F?(G=(0,$.jsxs)(`div`,{className:N,children:[F,I,H,U,W]}),t[57]=I,t[58]=H,t[59]=U,t[60]=W,t[61]=N,t[62]=F,t[63]=G):G=t[63];let K=w?`border-edge-subtle px-1 pt-2`:`border-edge px-5 py-4`,q;t[64]===K?q=t[65]:(q=f(`flex shrink-0 items-center gap-2 border-t`,K),t[64]=K,t[65]=q);let te=!w&&`mr-auto`,re;t[66]===te?re=t[67]:(re=f(`flex items-center gap-1`,te),t[66]=te,t[67]=re);let ae=l||u,oe;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,$.jsx)(ne,{className:`size-4`,"aria-hidden":!0}),t[68]=oe):oe=t[68];let se;t[69]!==o.attachTitle||t[70]!==_||t[71]!==ae?(se=(0,$.jsx)(h,{type:`button`,variant:`ghost`,className:`size-9 rounded-lg p-0`,disabled:ae,title:o.attachTitle,"aria-label":o.attachTitle,onClick:_,children:oe}),t[69]=o.attachTitle,t[70]=_,t[71]=ae,t[72]=se):se=t[72];let ce;t[73]!==l||t[74]!==p||t[75]!==d.startVoiceInput||t[76]!==d.voiceActive?(ce=d.voiceActive?null:(0,$.jsx)(J,{disabled:l,chat:p,onStart:d.startVoiceInput}),t[73]=l,t[74]=p,t[75]=d.startVoiceInput,t[76]=d.voiceActive,t[77]=ce):ce=t[77];let le;t[78]!==re||t[79]!==se||t[80]!==ce?(le=(0,$.jsxs)(`div`,{className:re,children:[se,ce]}),t[78]=re,t[79]=se,t[80]=ce,t[81]=le):le=t[81];let ue;t[82]!==m||t[83]!==w||t[84]!==o.shortcut?(ue=w?(0,$.jsx)(`span`,{className:`hidden text-[11px] text-fg-subtle sm:inline`,children:o.shortcut}):m,t[82]=m,t[83]=w,t[84]=o.shortcut,t[85]=ue):ue=t[85];let fe=w?`ml-auto h-9 rounded-lg px-3.5 text-xs`:`min-w-32`,pe=!E||l||d.voiceActive,me=w?`size-3.5`:`size-4`,he;t[86]===me?he=t[87]:(he=(0,$.jsx)(ie,{className:me,"aria-hidden":!0}),t[86]=me,t[87]=he);let Y;t[88]!==o.submit||t[89]!==fe||t[90]!==pe||t[91]!==he?(Y=(0,$.jsxs)(h,{type:`submit`,variant:`primary`,className:fe,disabled:pe,children:[he,o.submit]}),t[88]=o.submit,t[89]=fe,t[90]=pe,t[91]=he,t[92]=Y):Y=t[92];let _e;t[93]!==q||t[94]!==le||t[95]!==ue||t[96]!==Y?(_e=(0,$.jsxs)(`div`,{className:q,children:[le,ue,Y]}),t[93]=q,t[94]=le,t[95]=ue,t[96]=Y,t[97]=_e):_e=t[97];let ve;return t[98]!==x||t[99]!==b||t[100]!==S||t[101]!==O||t[102]!==G||t[103]!==_e||t[104]!==A||t[105]!==j?(ve=(0,$.jsxs)(`form`,{onSubmit:O,onDragOver:b,onDragLeave:x,onDrop:S,className:A,children:[j,G,_e]}),t[98]=x,t[99]=b,t[100]=S,t[101]=O,t[102]=G,t[103]=_e,t[104]=A,t[105]=j,t[106]=ve):ve=t[106],ve}function De(e){e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}function Oe(e){let t=(0,Z.c)(12),{href:n,children:r,onOpen:i}=e,o=a();if(n&&/^https?:\/\//i.test(n)){let e;return t[0]!==r||t[1]!==n?(e=(0,$.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,className:`rounded-sm text-accent-fg hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r}),t[0]=r,t[1]=n,t[2]=e):e=t[2],e}if(n?.startsWith(`/`)&&!n.startsWith(`//`)){let e=`${o.pathname}${o.search}`,a;t[3]!==n||t[4]!==e?(a=w(e,n),t[3]=n,t[4]=e,t[5]=a):a=t[5];let c;return t[6]!==r||t[7]!==i||t[8]!==a?(c=(0,$.jsx)(s,{to:a,className:`rounded-sm text-accent-fg hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:i,children:r}),t[6]=r,t[7]=i,t[8]=a,t[9]=c):c=t[9],c}let c;return t[10]===r?c=t[11]:(c=(0,$.jsx)(`span`,{children:r}),t[10]=r,t[11]=c),c}function ke(e){let t=(0,Z.c)(4),{label:n,onClick:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsx)(O,{className:`size-3.5`,"aria-hidden":!0}),t[0]=i):i=t[0];let a;return t[1]!==n||t[2]!==r?(a=(0,$.jsxs)(`button`,{type:`button`,className:`inline-flex min-h-9 items-center gap-1.5 rounded-lg px-2 text-xs font-medium text-fg-muted transition-colors duration-150 hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:r,children:[i,n]}),t[1]=n,t[2]=r,t[3]=a):a=t[3],a}function Ae(e){let t=(0,Z.c)(65),{opportunity:n,copy:r,onOpenHistory:i}=e,a,o,s,c,l,u;if(t[0]!==r.aiLabel||t[1]!==r.automationAction||t[2]!==r.automationHint||t[3]!==r.history||t[4]!==r.minutes||t[5]!==r.needsSetup||t[6]!==r.why||t[7]!==i||t[8]!==n.capabilities||t[9]!==n.continuation||t[10]!==n.estimatedMinutes||t[11]!==n.outcome||t[12]!==n.rationale||t[13]!==n.title){let e=n.capabilities.filter(Me),d;t[20]===r.aiLabel?d=t[21]:(d=(0,$.jsx)(`span`,{children:r.aiLabel}),t[20]=r.aiLabel,t[21]=d);let f;t[22]!==r.minutes||t[23]!==n.estimatedMinutes?(f=n.estimatedMinutes?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,$.jsx)(Y,{className:`size-3.5`,"aria-hidden":!0}),n.estimatedMinutes,` `,r.minutes]}):null,t[22]=r.minutes,t[23]=n.estimatedMinutes,t[24]=f):f=t[24];let p;t[25]!==d||t[26]!==f?(p=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[d,f]}),t[25]=d,t[26]=f,t[27]=p):p=t[27];let m;t[28]!==r.history||t[29]!==i?(m=(0,$.jsx)(ke,{label:r.history,onClick:i}),t[28]=r.history,t[29]=i,t[30]=m):m=t[30],t[31]!==m||t[32]!==p?(a=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[p,m]}),t[31]=m,t[32]=p,t[33]=a):a=t[33],t[34]===n.title?o=t[35]:(o=(0,$.jsx)(`h3`,{className:`mt-3 text-xl font-semibold leading-7 tracking-tight text-fg`,children:n.title}),t[34]=n.title,t[35]=o),t[36]===n.outcome?s=t[37]:(s=(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:n.outcome}),t[36]=n.outcome,t[37]=s);let h;t[38]===r.why?h=t[39]:(h=(0,$.jsxs)(`span`,{className:`font-medium text-fg`,children:[r.why,`:`]}),t[38]=r.why,t[39]=h),t[40]!==n.rationale||t[41]!==h?(c=(0,$.jsxs)(`p`,{className:`mt-4 text-sm leading-6 text-fg-muted`,children:[h,n.rationale]}),t[40]=n.rationale,t[41]=h,t[42]=c):c=t[42],t[43]!==r.automationAction||t[44]!==r.automationHint||t[45]!==n.continuation?(l=n.continuation?.kind===`automation`?(0,$.jsxs)(`div`,{className:`mt-4 flex flex-col gap-3 rounded-xl border border-edge bg-surface-subtle p-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:r.automationHint}),(0,$.jsx)(`a`,{href:`#${n.continuation.href}`,className:`inline-flex min-h-11 shrink-0 items-center rounded-lg px-3 text-xs font-medium text-accent hover:bg-accent-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r.automationAction})]}):null,t[43]=r.automationAction,t[44]=r.automationHint,t[45]=n.continuation,t[46]=l):l=t[46],u=e.length>0?(0,$.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,"aria-label":r.needsSetup,children:e.map(e=>(0,$.jsxs)(`a`,{href:`#${e.recoveryPath??`/settings`}`,className:`rounded-full border border-accent/25 bg-accent-soft px-2.5 py-1 text-xs text-accent hover:border-accent/50`,children:[r.needsSetup,` · `,e.capability]},`${e.kind}:${e.capability}`))}):null,t[0]=r.aiLabel,t[1]=r.automationAction,t[2]=r.automationHint,t[3]=r.history,t[4]=r.minutes,t[5]=r.needsSetup,t[6]=r.why,t[7]=i,t[8]=n.capabilities,t[9]=n.continuation,t[10]=n.estimatedMinutes,t[11]=n.outcome,t[12]=n.rationale,t[13]=n.title,t[14]=a,t[15]=o,t[16]=s,t[17]=c,t[18]=l,t[19]=u}else a=t[14],o=t[15],s=t[16],c=t[17],l=t[18],u=t[19];let d;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(L,{className:`size-3.5 transition-transform group-open:rotate-180`,"aria-hidden":!0}),t[47]=d):d=t[47];let f;t[48]===r.evidence?f=t[49]:(f=(0,$.jsxs)(`summary`,{className:`flex min-h-9 cursor-pointer list-none items-center gap-1.5 text-xs font-medium text-fg-muted hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[r.evidence,d]}),t[48]=r.evidence,t[49]=f);let p;t[50]===n.evidence?p=t[51]:(p=n.evidence.map(je),t[50]=n.evidence,t[51]=p);let m;t[52]===p?m=t[53]:(m=(0,$.jsx)(`ul`,{className:`mt-2 space-y-2 border-l border-edge pl-3 text-xs leading-5 text-fg-muted`,children:p}),t[52]=p,t[53]=m);let h;t[54]!==m||t[55]!==f?(h=(0,$.jsxs)(`details`,{open:!0,className:`mt-4 group`,children:[f,m]}),t[54]=m,t[55]=f,t[56]=h):h=t[56];let g;return t[57]!==a||t[58]!==h||t[59]!==o||t[60]!==s||t[61]!==c||t[62]!==l||t[63]!==u?(g=(0,$.jsxs)($.Fragment,{children:[a,o,s,c,l,u,h]}),t[57]=a,t[58]=h,t[59]=o,t[60]=s,t[61]=c,t[62]=l,t[63]=u,t[64]=g):g=t[64],g}function je(e){return(0,$.jsx)(`li`,{children:(0,$.jsx)(Oe,{href:e.href,children:e.observation})},e.id)}function Me(e){return e.readiness!==`ready`}function Ne(e){let t=(0,Z.c)(134),{advisor:n,copy:r,busy:i,onRefresh:a,onAction:o,onFeedback:s,onClarification:c,onOpenHistory:u,preflight:d,receipt:f}=e,[p,m]=(0,Q.useState)(),g;t[0]!==n.alternatives||t[1]!==n.primary||t[2]!==n.state?(g=n.state===`ready`?[n.primary,...n.alternatives]:[],t[0]=n.alternatives,t[1]=n.primary,t[2]=n.state,t[3]=g):g=t[3];let _=g,v;t[4]!==_||t[5]!==p?(v=_.find(e=>e.id===p)??_[0],t[4]=_,t[5]=p,t[6]=v):v=t[6];let y=v,b;t[7]===_[0]?.id?b=t[8]:(b=()=>m(_[0]?.id),t[7]=_[0]?.id,t[8]=b);let x=_[0]?.id,S;if(t[9]!==n.state||t[10]!==x?(S=[n.state,x],t[9]=n.state,t[10]=x,t[11]=S):S=t[11],(0,Q.useEffect)(b,S),n.state===`disabled`)return null;if(f){let e;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(l,{className:`size-5 shrink-0 text-success`,"aria-hidden":!0}),t[12]=e):e=t[12];let n;t[13]===f.title?n=t[14]:(n=(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:f.title}),t[13]=f.title,t[14]=n);let i;t[15]===f.detail?i=t[16]:(i=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:f.detail}),t[15]=f.detail,t[16]=i);let a;t[17]!==n||t[18]!==i?(a=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[n,i]}),t[17]=n,t[18]=i,t[19]=a):a=t[19];let o;t[20]!==r.history||t[21]!==u?(o=(0,$.jsx)(ke,{label:r.history,onClick:u}),t[20]=r.history,t[21]=u,t[22]=o):o=t[22];let s=`#${f.href}`,c;t[23]!==r.viewProgress||t[24]!==s?(c=(0,$.jsx)(h,{asChild:!0,variant:`secondary`,className:`min-h-10 text-xs`,children:(0,$.jsx)(`a`,{href:s,children:r.viewProgress})}),t[23]=r.viewProgress,t[24]=s,t[25]=c):c=t[25];let d;t[26]!==o||t[27]!==c?(d=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[o,c]}),t[26]=o,t[27]=c,t[28]=d):d=t[28];let p;return t[29]!==d||t[30]!==a?(p=(0,$.jsx)(`section`,{className:`mt-7 rounded-2xl border border-success/25 bg-success-soft px-5 py-4`,role:`status`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center`,children:[e,a,d]})}),t[29]=d,t[30]=a,t[31]=p):p=t[31],p}if(n.state===`quiet`||n.state===`refreshing`)return null;if(n.state===`clarification`){let e;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(ie,{className:`size-4`,"aria-hidden":!0}),t[32]=e):e=t[32];let a;t[33]===r.aiLabel?a=t[34]:(a=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-accent`,children:[e,r.aiLabel]}),t[33]=r.aiLabel,t[34]=a);let o;t[35]!==r.history||t[36]!==u?(o=(0,$.jsx)(ke,{label:r.history,onClick:u}),t[35]=r.history,t[36]=u,t[37]=o):o=t[37];let s;t[38]!==a||t[39]!==o?(s=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[a,o]}),t[38]=a,t[39]=o,t[40]=s):s=t[40];let l;t[41]===n.question.question?l=t[42]:(l=(0,$.jsx)(`h3`,{id:`home-advisor-question`,className:`mt-3 text-lg font-semibold text-fg`,children:n.question.question}),t[41]=n.question.question,t[42]=l);let d;if(t[43]!==n.question.options||t[44]!==n.question.question||t[45]!==i||t[46]!==c){let e;t[48]!==n.question.question||t[49]!==i||t[50]!==c?(e=e=>(0,$.jsx)(h,{type:`button`,variant:`secondary`,className:`min-h-11`,disabled:i,onClick:()=>c(n.question.question,e.label),children:e.label},e.id),t[48]=n.question.question,t[49]=i,t[50]=c,t[51]=e):e=t[51],d=n.question.options.map(e),t[43]=n.question.options,t[44]=n.question.question,t[45]=i,t[46]=c,t[47]=d}else d=t[47];let f;t[52]===d?f=t[53]:(f=(0,$.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:d}),t[52]=d,t[53]=f);let p;return t[54]!==l||t[55]!==f||t[56]!==s?(p=(0,$.jsxs)(`section`,{className:`mt-7 rounded-2xl border border-accent/25 bg-surface-base px-5 py-5`,"aria-labelledby":`home-advisor-question`,children:[s,l,f]}),t[54]=l,t[55]=f,t[56]=s,t[57]=p):p=t[57],p}if(!y)return null;let C=d?.opportunityId===y.id?d.value:void 0,w;t[58]!==n.stale||t[59]!==r.refreshing?(w=n.stale?(0,$.jsxs)(`p`,{className:`mb-3 inline-flex items-center gap-2 text-xs text-accent`,children:[(0,$.jsx)(R,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),r.refreshing]}):null,t[58]=n.stale,t[59]=r.refreshing,t[60]=w):w=t[60];let T;t[61]!==r||t[62]!==u||t[63]!==y?(T=(0,$.jsx)(Ae,{opportunity:y,copy:r,onOpenHistory:u}),t[61]=r,t[62]=u,t[63]=y,t[64]=T):T=t[64];let E;t[65]!==i||t[66]!==r.configure||t[67]!==r.degradedStart||t[68]!==r.setupHint||t[69]!==r.setupTitle||t[70]!==o||t[71]!==y||t[72]!==C?(E=C?.state===`needs_setup`?(0,$.jsx)(`div`,{className:`mt-5 rounded-xl border border-accent/25 bg-accent-soft/40 p-4`,role:`alert`,"aria-live":`polite`,children:(0,$.jsxs)(`div`,{className:`flex gap-3`,children:[(0,$.jsx)(ee,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:r.setupTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:r.setupHint}),(0,$.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs leading-5 text-fg-muted`,children:C.blockers.map(Pe)}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[C.recoveryActions.map(e=>(0,$.jsxs)(`a`,{href:`#${e.href}`,className:`inline-flex min-h-11 items-center rounded-lg border border-accent/30 px-3 text-xs font-medium text-accent hover:bg-accent-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[r.configure,` · `,e.capability]},e.capability)),C.degradedAction?(0,$.jsx)(h,{type:`button`,variant:`secondary`,className:`min-h-11`,disabled:i,onClick:()=>o(y,`degraded_start`),children:r.degradedStart}):null]})]})]})}):null,t[65]=i,t[66]=r.configure,t[67]=r.degradedStart,t[68]=r.setupHint,t[69]=r.setupTitle,t[70]=o,t[71]=y,t[72]=C,t[73]=E):E=t[73];let D;t[74]!==i||t[75]!==r.start||t[76]!==o||t[77]!==y?(D=y.actions.canStart?(0,$.jsxs)(h,{type:`button`,variant:`primary`,className:`min-h-11`,disabled:i,onClick:()=>o(y,`start`),children:[(0,$.jsx)(ie,{className:`size-4`,"aria-hidden":!0}),r.start]}):null,t[74]=i,t[75]=r.start,t[76]=o,t[77]=y,t[78]=D):D=t[78];let O;t[79]!==i||t[80]!==r.discuss||t[81]!==o||t[82]!==y?(O=y.actions.canDiscuss?(0,$.jsxs)(h,{type:`button`,variant:`secondary`,className:`min-h-11`,disabled:i,onClick:()=>o(y,`discuss`),children:[(0,$.jsx)(le,{className:`size-4`,"aria-hidden":!0}),r.discuss]}):null,t[79]=i,t[80]=r.discuss,t[81]=o,t[82]=y,t[83]=O):O=t[83];let k;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(R,{className:`size-4`,"aria-hidden":!0}),t[84]=k):k=t[84];let A;t[85]!==i||t[86]!==r.refresh||t[87]!==a?(A=(0,$.jsxs)(h,{type:`button`,variant:`ghost`,className:`min-h-11`,disabled:i,onClick:a,title:r.refresh,children:[k,r.refresh]}),t[85]=i,t[86]=r.refresh,t[87]=a,t[88]=A):A=t[88];let j;t[89]===r.feedback?j=t[90]:(j=(0,$.jsx)(`summary`,{className:`flex min-h-11 cursor-pointer list-none items-center rounded-lg px-3 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r.feedback}),t[89]=r.feedback,t[90]=j);let M;t[91]===r.alreadyDone?M=t[92]:(M=[`already_done`,r.alreadyDone],t[91]=r.alreadyDone,t[92]=M);let N;t[93]===r.irrelevant?N=t[94]:(N=[`irrelevant`,r.irrelevant],t[93]=r.irrelevant,t[94]=N);let P;t[95]===r.later?P=t[96]:(P=[`too_early`,r.later],t[95]=r.later,t[96]=P);let F;t[97]===r.sourceIncorrect?F=t[98]:(F=[`source_incorrect`,r.sourceIncorrect],t[97]=r.sourceIncorrect,t[98]=F);let I;t[99]===r.lessLikeThis?I=t[100]:(I=[`less_like_this`,r.lessLikeThis],t[99]=r.lessLikeThis,t[100]=I);let L;t[101]!==M||t[102]!==N||t[103]!==P||t[104]!==F||t[105]!==I?(L=[M,N,P,F,I],t[101]=M,t[102]=N,t[103]=P,t[104]=F,t[105]=I,t[106]=L):L=t[106];let z=L,B;t[107]!==i||t[108]!==s||t[109]!==y||t[110]!==z?(B=(0,$.jsx)(`div`,{className:`absolute right-0 z-20 mt-1 w-44 rounded-xl border border-edge bg-surface-overlay p-1 shadow-float`,children:z.map(e=>{let[t,n]=e;return(0,$.jsx)(`button`,{type:`button`,disabled:i,className:`min-h-10 w-full rounded-lg px-3 text-left text-sm text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>s(y,t),children:n},t)})}),t[107]=i,t[108]=s,t[109]=y,t[110]=z,t[111]=B):B=t[111];let V;t[112]!==j||t[113]!==B?(V=(0,$.jsxs)(`details`,{className:`relative ml-auto`,children:[j,B]}),t[112]=j,t[113]=B,t[114]=V):V=t[114];let H;t[115]!==O||t[116]!==A||t[117]!==V||t[118]!==D?(H=(0,$.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center gap-2`,children:[D,O,A,V]}),t[115]=O,t[116]=A,t[117]=V,t[118]=D,t[119]=H):H=t[119];let U;t[120]!==H||t[121]!==w||t[122]!==T||t[123]!==E?(U=(0,$.jsxs)(`div`,{className:`px-5 py-5 sm:px-6`,children:[w,T,E,H]}),t[120]=H,t[121]=w,t[122]=T,t[123]=E,t[124]=U):U=t[124];let W;t[125]!==i||t[126]!==r.alternatives||t[127]!==_||t[128]!==y.id?(W=_.length>1?(0,$.jsxs)(`div`,{className:`border-t border-edge-subtle px-5 py-4 sm:px-6`,children:[(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg-subtle`,children:r.alternatives}),(0,$.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:_.filter(e=>e.id!==y.id).map(e=>(0,$.jsx)(`button`,{type:`button`,disabled:i,className:`min-h-10 rounded-lg border border-edge px-3 text-left text-sm text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>m(e.id),children:e.title},e.id))})]}):null,t[125]=i,t[126]=r.alternatives,t[127]=_,t[128]=y.id,t[129]=W):W=t[129];let G;return t[130]!==r.aiLabel||t[131]!==U||t[132]!==W?(G=(0,$.jsxs)(`section`,{className:`mt-7 rounded-2xl border border-accent/25 bg-surface-base`,"aria-label":r.aiLabel,children:[U,W]}),t[130]=r.aiLabel,t[131]=U,t[132]=W,t[133]=G):G=t[133],G}function Pe(e){return(0,$.jsx)(`li`,{children:e.message},`${e.kind}:${e.capability}`)}var Fe=new Set([`started`,`discussing`,`completed`]);function Ie(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[0,1,2].map(Le)}),e[0]=t):t=e[0],t}function Le(e){return(0,$.jsxs)(`div`,{className:`space-y-2 rounded-xl border border-edge-subtle p-4`,children:[(0,$.jsx)(g,{className:`h-4 w-24 rounded`}),(0,$.jsx)(g,{className:`h-5 w-4/5 rounded`}),(0,$.jsx)(g,{className:`h-4 w-3/5 rounded`})]},e)}function Re(e){let t=(0,Z.c)(11),{open:n,refreshKey:r,onOpenChange:i,onReevaluate:a}=e,o=p(ze),s=d(o).projectsPage.home,l=c(),[f,m]=(0,Q.useState)(`all`),g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=[],t[0]=g):g=t[0];let[_,v]=(0,Q.useState)(g),[y,b]=(0,Q.useState)(!1),[x,C]=(0,Q.useState)(),E;t[1]===n?E=t[2]:(E=()=>{if(!n)return;let e=!0;return b(!0),C(void 0),N().then(t=>{e&&v(t.items)}).catch(t=>{e&&C(t instanceof Error?t.message:String(t))}).finally(()=>{e&&b(!1)}),()=>{e=!1}},t[1]=n,t[2]=E);let D;t[3]!==n||t[4]!==r?(D=[n,r],t[3]=n,t[4]=r,t[5]=D):D=t[5],(0,Q.useEffect)(E,D);let A=_.filter(e=>f===`all`||(f===`adopted`?Fe.has(e.status):!Fe.has(e.status))),j=new Intl.DateTimeFormat(o===`zh`?`zh-CN`:`en`,{dateStyle:`medium`}),F=new Intl.DateTimeFormat(o===`zh`?`zh-CN`:`en`,{dateStyle:`medium`,timeStyle:`short`}),z=new Map;for(let e of A){let t=j.format(new Date(e.updatedAt));z.set(t,[...z.get(t)??[],e])}let V=[...z.entries()],H=e=>e.feedbackKind===`already_done`?s.advisorHistoryStatusCompleted:e.feedbackKind===`irrelevant`?s.advisorHistoryStatusIrrelevant:e.feedbackKind===`source_incorrect`?s.advisorHistoryStatusSourceIncorrect:e.feedbackKind===`less_like_this`?s.advisorHistoryStatusLessLikeThis:{available:s.advisorHistoryStatusAvailable,started:s.advisorHistoryStatusStarted,discussing:s.advisorHistoryStatusDiscussing,completed:s.advisorHistoryStatusCompleted,snoozed:s.advisorHistoryStatusSnoozed,dismissed:s.advisorHistoryStatusDismissed,expired:s.advisorHistoryStatusExpired,superseded:s.advisorHistoryStatusSuperseded}[e.status],ee=e=>{if(e.href){i(!1),l(w(`/`,e.href));return}e.status===`discussing`&&(i(!1),l(`/chat/new?${new URLSearchParams({draft:e.opportunity.actionPrompt}).toString()}`))},U;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,$.jsx)(B,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim`}),t[6]=U):U=t[6];let G;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,$.jsx)(O,{className:`mt-0.5 size-5 shrink-0 text-accent`,"aria-hidden":!0}),t[7]=G):G=t[7];let K;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,$.jsx)(M,{className:`size-4`,"aria-hidden":!0}),t[8]=K):K=t[8];let q=y?(0,$.jsx)(Ie,{}):x?(0,$.jsxs)(`div`,{className:`rounded-xl border border-danger/25 bg-danger-soft p-4 text-sm text-danger`,children:[(0,$.jsx)(`p`,{children:s.advisorHistoryLoadFailed}),(0,$.jsx)(h,{type:`button`,variant:`ghost`,className:`mt-2`,onClick:()=>i(!1),children:s.advisorHistoryClose})]}):V.length===0?(0,$.jsxs)(`div`,{className:`py-16 text-center`,children:[(0,$.jsx)(O,{className:`mx-auto size-6 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:s.advisorHistoryEmpty}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:s.advisorHistoryEmptyHint})]}):(0,$.jsx)(`div`,{className:`space-y-6`,children:V.map(e=>{let[t,n]=e;return(0,$.jsxs)(`section`,{"aria-label":t,children:[(0,$.jsx)(`h3`,{className:`mb-2 text-xs font-medium text-fg-subtle`,children:t}),(0,$.jsx)(`div`,{className:`space-y-2`,children:n.map(e=>{let t=!!e.href||e.status===`discussing`,n=[`snoozed`,`dismissed`,`expired`,`superseded`].includes(e.status);return(0,$.jsxs)(`article`,{className:`rounded-xl border border-edge-subtle bg-surface-base p-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`text-xs font-medium text-accent`,children:H(e)}),(0,$.jsx)(`h4`,{className:`mt-1.5 text-sm font-semibold leading-5 text-fg`,children:e.opportunity.title}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:e.opportunity.outcome})]}),(0,$.jsx)(`time`,{className:`shrink-0 text-[11px] text-fg-subtle`,dateTime:new Date(e.updatedAt).toISOString(),children:F.format(new Date(e.updatedAt))})]}),e.snoozedUntil?(0,$.jsxs)(`p`,{className:`mt-2 inline-flex items-center gap-1 text-xs text-fg-muted`,children:[(0,$.jsx)(Y,{className:`size-3.5`,"aria-hidden":!0}),s.advisorHistoryReturnsAt,` `,F.format(new Date(e.snoozedUntil))]}):null,(0,$.jsxs)(`details`,{className:`group mt-3`,children:[(0,$.jsxs)(`summary`,{className:`flex min-h-8 cursor-pointer list-none items-center gap-1 text-xs font-medium text-fg-muted hover:text-fg`,children:[s.advisorHistoryEvidence,(0,$.jsx)(L,{className:`size-3.5 transition-transform duration-200 group-open:rotate-180 motion-reduce:transition-none`,"aria-hidden":!0})]}),(0,$.jsx)(`ul`,{className:`mt-2 space-y-1.5 border-l border-edge pl-3 text-xs leading-5 text-fg-muted`,children:e.opportunity.evidence.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsx)(Oe,{href:e.href,onOpen:()=>i(!1),children:e.observation})},e.id))})]}),t||n?(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[t?(0,$.jsxs)(h,{type:`button`,variant:`secondary`,className:`min-h-9 text-xs`,onClick:()=>ee(e),children:[(0,$.jsx)(u,{className:`size-3.5`,"aria-hidden":!0}),e.status===`discussing`?s.advisorHistoryContinueDiscussion:s.advisorHistoryViewProgress]}):null,n?(0,$.jsxs)(h,{type:`button`,variant:`ghost`,className:`min-h-9 text-xs`,onClick:()=>{i(!1),a()},children:[(0,$.jsx)(R,{className:`size-3.5`,"aria-hidden":!0}),s.advisorHistoryReevaluate]}):null]}):null]},e.opportunity.id)})})]},t)})}),J;return t[9]===q?J=t[10]:(J=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:q}),t[9]=q,t[10]=J),(0,$.jsx)(I,{open:n,onOpenChange:i,children:(0,$.jsxs)(_e,{children:[U,(0,$.jsxs)(k,{className:`xopc-drawer-right fixed right-0 top-0 z-[90] flex size-full max-w-lg flex-col overflow-hidden border-l border-edge bg-surface-overlay shadow-popover outline-none`,"aria-describedby":`home-advisor-history-description`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start gap-3 border-b border-edge px-5 py-4`,children:[G,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(S,{className:`text-base font-semibold text-fg`,children:s.advisorHistoryTitle}),(0,$.jsx)(P,{id:`home-advisor-history-description`,className:`mt-1 text-xs leading-5 text-fg-muted`,children:s.advisorHistoryDescription})]}),(0,$.jsx)(T,{asChild:!0,children:(0,$.jsx)(h,{type:`button`,variant:`ghost`,className:`-mr-2 size-9 shrink-0 p-0`,"aria-label":s.advisorHistoryClose,children:K})})]}),(0,$.jsx)(`div`,{className:`shrink-0 border-b border-edge-subtle px-5 py-3`,children:(0,$.jsx)(W,{className:`inline-flex rounded-lg bg-surface-inset p-1`,role:`group`,"aria-label":s.advisorHistoryFilterLabel,indicatorClassName:`rounded-md bg-surface-panel shadow-surface`,children:[[`all`,s.advisorHistoryFilterAll],[`adopted`,s.advisorHistoryFilterAdopted],[`other`,s.advisorHistoryFilterOther]].map(e=>{let[t,n]=e;return(0,$.jsx)(`button`,{type:`button`,className:`min-h-9 rounded-md px-3 text-xs font-medium transition-colors duration-150 ${f===t?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`}`,"aria-pressed":f===t,onClick:()=>m(t),children:n},t)})})}),J]})]})})}function ze(e){return e.language}function Be(e,t){return e.replace(`{{count}}`,String(t))}function Ve(e,t){if(e.state===`disabled`)return null;if(e.state===`ready`){let n=1+e.alternatives.length;return{label:Be(t.ready,n),detail:e.primary.title,tone:`accent`,refreshing:!!e.stale}}return e.state===`clarification`?{label:t.clarification,detail:e.question.question,tone:`accent`,refreshing:!1}:e.state===`refreshing`?{label:t.refreshing,detail:e.previous?.title??t.refreshingDetail,tone:`accent`,refreshing:!0}:e.reason===`generation_failed`?{label:t.generationFailed,detail:t.generationFailedDetail,tone:`danger`,refreshing:!1}:e.reason===`budget_exhausted`?{label:t.budgetExhausted,detail:t.budgetExhaustedDetail,tone:`warning`,refreshing:!1}:e.reason===`model_unavailable`?{label:t.modelUnavailable,detail:t.modelUnavailableDetail,tone:`warning`,refreshing:!1}:{label:t.idle,detail:t.idleDetail,tone:`neutral`,refreshing:!1}}var He={accent:`bg-accent`,danger:`bg-danger`,neutral:`bg-fg-subtle`,warning:`bg-warning`};function Ue(e){let t=(0,Z.c)(50),{advisor:n,busy:r,copy:i,onOpenHistory:a,onRefresh:o}=e,[s,c]=(0,Q.useState)(!1),l;t[0]!==n||t[1]!==i?(l=Ve(n,i),t[0]=n,t[1]=i,t[2]=l):l=t[2];let u=l;if(!u)return null;let d=n.state!==`refreshing`,p=n.state===`ready`?i.findAnother:i.retry,m=`${i.label}:${u.label}`,g;t[3]===u.refreshing?g=t[4]:(g=u.refreshing?(0,$.jsx)(R,{className:`size-3.5 shrink-0 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):(0,$.jsx)(ie,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[3]=u.refreshing,t[4]=g);let x=He[u.tone],S;t[5]===x?S=t[6]:(S=f(`size-1.5 shrink-0 rounded-full`,x),t[5]=x,t[6]=S);let C;t[7]===S?C=t[8]:(C=(0,$.jsx)(`span`,{className:S,"aria-hidden":!0}),t[7]=S,t[8]=C);let w;t[9]!==i.label||t[10]!==u.label?(w=(0,$.jsxs)(`span`,{className:`truncate`,children:[i.label,` · `,u.label]}),t[9]=i.label,t[10]=u.label,t[11]=w):w=t[11];let T;t[12]!==m||t[13]!==g||t[14]!==C||t[15]!==w?(T=(0,$.jsx)(b,{asChild:!0,children:(0,$.jsxs)(h,{type:`button`,variant:`ghost`,className:`h-9 max-w-56 rounded-lg px-2.5`,"aria-label":m,children:[g,C,w]})}),t[12]=m,t[13]=g,t[14]=C,t[15]=w,t[16]=T):T=t[16];let E;t[17]===u.refreshing?E=t[18]:(E=(0,$.jsx)(`span`,{className:`mt-1 flex size-7 shrink-0 items-center justify-center rounded-lg bg-accent-soft text-accent`,children:u.refreshing?(0,$.jsx)(R,{className:`size-4 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):(0,$.jsx)(ie,{className:`size-4`,"aria-hidden":!0})}),t[17]=u.refreshing,t[18]=E);let D;t[19]===u.label?D=t[20]:(D=(0,$.jsx)(`p`,{className:`font-semibold text-fg`,children:u.label}),t[19]=u.label,t[20]=D);let k;t[21]===u.detail?k=t[22]:(k=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:u.detail}),t[21]=u.detail,t[22]=k);let A;t[23]!==D||t[24]!==k?(A=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[D,k]}),t[23]=D,t[24]=k,t[25]=A):A=t[25];let j;t[26]!==A||t[27]!==E?(j=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[E,A]}),t[26]=A,t[27]=E,t[28]=j):j=t[28];let M;t[29]===a?M=t[30]:(M=()=>{c(!1),a()},t[29]=a,t[30]=M);let N;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,$.jsx)(O,{className:`size-3.5`,"aria-hidden":!0}),t[31]=N):N=t[31];let P;t[32]!==i.history||t[33]!==M?(P=(0,$.jsxs)(h,{type:`button`,variant:`ghost`,className:`h-9 rounded-lg text-xs`,onClick:M,children:[N,i.history]}),t[32]=i.history,t[33]=M,t[34]=P):P=t[34];let F;t[35]!==r||t[36]!==d||t[37]!==o||t[38]!==p?(F=d?(0,$.jsxs)(h,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg text-xs`,disabled:r,onClick:()=>{c(!1),o()},children:[(0,$.jsx)(R,{className:`size-3.5`,"aria-hidden":!0}),p]}):null,t[35]=r,t[36]=d,t[37]=o,t[38]=p,t[39]=F):F=t[39];let I;t[40]!==P||t[41]!==F?(I=(0,$.jsxs)(`div`,{className:`mt-4 flex items-center justify-end gap-1 border-t border-edge-subtle pt-3`,children:[P,F]}),t[40]=P,t[41]=F,t[42]=I):I=t[42];let L;t[43]!==j||t[44]!==I?(L=(0,$.jsx)(_,{children:(0,$.jsxs)(v,{side:`bottom`,align:`end`,sideOffset:6,className:`z-[70] w-[min(21rem,calc(100vw-1.5rem))] rounded-xl border border-edge bg-surface-overlay p-4 text-sm text-fg shadow-popover outline-none`,onOpenAutoFocus:We,children:[j,I]})}),t[43]=j,t[44]=I,t[45]=L):L=t[45];let z;return t[46]!==s||t[47]!==L||t[48]!==T?(z=(0,$.jsxs)(y,{open:s,onOpenChange:c,children:[T,L]}),t[46]=s,t[47]=L,t[48]=T,t[49]=z):z=t[49],z}function We(e){return e.preventDefault()}async function Ge(e,t=`en`){let n=await fe(e),r=n.runs.filter(e=>!e.parentRunId).sort((e,t)=>t.queuedAt-e.queuedAt)[0];if(!n.allowedCommands.includes(`start`)||r?.status!==`failed`)throw Error(t===`zh`?`任务状态已变化,暂时无法重试。请刷新并查看当前状态。`:`Task is no longer available for retry. Refresh and review its current state.`);await K(e,{type:`start`,executor:m.parse({...r.executorRef,kind:r.executorKind})},n.task.version)}function Ke(e){let t=e.runs.filter(e=>!e.parentRunId).sort((e,t)=>t.queuedAt-e.queuedAt)[0],n=e.conversation?.currentExecutorAgentId??e.task.delegateAgentId,r=n?{kind:`agent`,agentId:n}:t?{...t.executorRef,kind:t.executorKind}:void 0,i=m.safeParse(r);return i.success?i.data:void 0}var qe=(0,Q.lazy)(()=>i(()=>import(`./index-CiDVRMmX.js`).then(e=>e.Xn).then(e=>({default:e.WorkspaceFilePreviewPanel})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52])));function Je({taskId:e,language:t,onComplete:n,onUpdated:r}){let i=t===`zh`,o=a(),c=`${o.pathname}${o.search}`,[l,u]=(0,Q.useState)(),[d,f]=(0,Q.useState)(),[p,m]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(),[y,b]=(0,Q.useState)(!1),x=(0,Q.useRef)(!1),C=(0,Q.useRef)(0),[w,T]=(0,Q.useState)(0);(0,Q.useEffect)(()=>{u(void 0),v(void 0)},[e]),(0,Q.useEffect)(()=>{let t=!0,n=++C.current;return f(void 0),fe(e).then(e=>{t&&n===C.current&&!x.current&&u(e)}).catch(e=>{t&&n===C.current&&f(e instanceof Error?e.message:String(e))}),()=>{t=!1}},[e,w]),(0,Q.useEffect)(()=>{let t=()=>{x.current||T(e=>e+1)},n=n=>{n.detail?.taskId===e&&t()};return window.addEventListener(`task-changed-v2`,n),window.addEventListener(`focus`,t),window.addEventListener(`realtime-gap`,t),window.addEventListener(`gateway-realtime-connected`,t),()=>{window.removeEventListener(`task-changed-v2`,n),window.removeEventListener(`focus`,t),window.removeEventListener(`realtime-gap`,t),window.removeEventListener(`gateway-realtime-connected`,t)}},[e]);let E=l?xe(l):[],D=l?.task.phase===`review`&&l.allowedCommands.includes(`close`)&&l.waits.length===0&&E.length>0&&E.every(e=>e.status===`passed`),O=l?Ke(l):void 0,A=l?.allowedCommands.includes(`start`)&&l.waits.length===0&&O,j=e=>{C.current++,u(e),r?.(e)};async function M(e,t,r=!1){if(!x.current){x.current=!0,C.current++,b(!0),f(void 0);try{j(await e()),v(t),r&&n()}catch(e){f(e instanceof Error?e.message:String(e))}finally{x.current=!1,b(!1)}}}let N=l?.receipts.filter(e=>l.runs.some(t=>t.id===e.runId&&t.contractVersion===l.task.latestContractVersion)).sort((e,t)=>t.finalizedAt-e.finalizedAt)[0],P=E.filter(e=>e.status===`passed`).length,F=E.filter(e=>e.status===`failed`).length,L=E.length-P-F,R=l?.task.contract?.acceptancePolicy===`verified_auto`,V=ce(c,e);return(0,$.jsxs)(`section`,{className:`mt-4 space-y-4 rounded-xl border border-edge bg-surface-panel p-4`,"aria-label":i?`任务结果与处理`:`Task result and actions`,"aria-busy":y,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i?`执行结果`:`Result`}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(h,{variant:`ghost`,disabled:y,onClick:()=>T(e=>e+1),children:i?`刷新状态`:`Refresh status`}),(0,$.jsx)(s,{to:V,className:`inline-flex min-h-9 items-center text-xs font-medium text-accent-fg hover:underline`,children:i?`查看任务详情`:`Task details`})]})]}),d?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:d}):null,y?(0,$.jsx)(`p`,{role:`status`,className:`text-xs text-fg-muted`,children:i?`正在处理…`:`Processing…`}):null,_?(0,$.jsx)(`p`,{role:`status`,className:`text-sm text-success`,children:_}):null,!l&&!d?(0,$.jsxs)(`div`,{className:`space-y-3`,"aria-busy":!0,children:[(0,$.jsx)(g,{className:`h-5 w-1/3`}),(0,$.jsx)(g,{className:`h-24 w-full`})]}):null,l?(0,$.jsxs)($.Fragment,{children:[N?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:N.completionVerdict===`achieved`?i?`执行报告已达成目标,请结合依据逐项验收。`:`The run reports the goal achieved. Review the evidence before accepting.`:i?`当前为阶段性结果,尚有工作需要推进。`:`This is a partial result. More work is needed.`}),(0,$.jsx)(X,{content:N.summary,contentKey:`home:${e}:result:${N.runId}`,language:t,previewHeight:180}),N.remainingWork.length>0?(0,$.jsxs)(`div`,{className:`text-sm text-fg-muted`,children:[(0,$.jsx)(`p`,{className:`font-medium text-fg`,children:i?`尚待完成`:`Remaining work`}),(0,$.jsx)(`ul`,{className:`mt-1 list-disc space-y-1 pl-5`,children:N.remainingWork.map((e,t)=>(0,$.jsx)(`li`,{children:e},t))})]}):null,N.nextAction?(0,$.jsxs)(`p`,{className:`whitespace-pre-wrap text-sm text-fg-muted`,children:[(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i?`下一步:`:`Next step: `}),N.nextAction]}):null,N.judgment?(0,$.jsxs)(`div`,{className:`space-y-1 text-sm text-fg-muted`,children:[(0,$.jsx)(`p`,{className:`font-medium text-fg`,children:i?`判断依据`:`Assessment`}),(0,$.jsx)(`p`,{children:N.judgment.recommendation}),(0,$.jsx)(`ul`,{className:`list-disc space-y-1 pl-5`,children:N.judgment.reasons.map((e,t)=>(0,$.jsx)(`li`,{children:e},t))}),N.judgment.uncertainty?(0,$.jsxs)(`p`,{children:[i?`待确认:`:`Uncertainty: `,N.judgment.uncertainty]}):null]}):null,(0,$.jsx)(Ce,{evidence:N.evidence,projectId:l.task.projectId,conversationId:l.conversation?.activeConversationId,language:t,onOpenFile:m})]}):(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:i?`当前任务版本暂无执行结果,可先处理等待事项或查看执行进度。`:`No result for the current task version. Resolve pending items or view progress.`}),E.length>0?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`h3`,{className:`text-sm font-semibold text-fg`,children:[i?`验收条件`:`Acceptance criteria`,` `,(0,$.jsxs)(`span`,{className:`font-normal text-fg-muted`,children:[P,`/`,E.length]})]}),E.map((n,r)=>(0,$.jsxs)(`div`,{className:`space-y-2 border-t border-edge-subtle pt-3`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 text-sm text-fg`,children:[(0,$.jsx)(`p`,{className:`break-words`,children:n.text}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:i?{passed:`已通过`,failed:`未通过`,unverified:`待判定`}[n.status]:{passed:`Passed`,failed:`Failed`,unverified:`Not reviewed`}[n.status]})]}),l.task.phase===`review`&&!R?(0,$.jsx)(`div`,{className:`flex gap-2`,children:[`passed`,`failed`].map(t=>(0,$.jsx)(h,{variant:`secondary`,disabled:y||n.status===t,onClick:()=>void M(()=>z(e,r,t,l.task.version,l.task.latestContractVersion),i?`判定已保存。`:`Review saved.`),children:i?t===`passed`?`确认通过`:`未通过`:t===`passed`?`Mark passed`:`Mark failed`},t))}):null]}),n.note?(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-xs leading-5 text-fg-muted`,children:n.note}):null,n.review?.note?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.review.note}):null,(0,$.jsx)(Ce,{evidence:n.evidence,projectId:l.task.projectId,conversationId:l.conversation?.activeConversationId,language:t,onOpenFile:m})]},r))]}):null,l.waits.length>0?(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i?`等待处理`:`Pending items`}),l.waits.map(t=>(0,$.jsx)(`div`,{children:l.allowedCommands.includes(`resolve_wait`)&&(t.kind===`user_input`||t.kind===`approval`&&typeof t.condition.capability==`string`)&&t.condition.type!==`connection`?(0,$.jsx)(Se,{wait:t,detail:l,zh:i,onUpdated:j}):(0,$.jsxs)(`div`,{className:`rounded-lg bg-surface-hover p-3 text-sm text-fg-muted`,children:[(0,$.jsx)(`p`,{children:t.reason}),t.kind===`paused`&&l.allowedCommands.includes(`resolve_wait`)?(0,$.jsx)(h,{className:`mt-2`,disabled:y,onClick:()=>void M(()=>K(e,{type:`resolve_wait`,waitId:t.id},l.task.version),i?`已解除暂停,任务状态已更新。`:`Pause resolved. Task status updated.`),children:i?`恢复任务`:`Resume task`}):(0,$.jsx)(s,{to:typeof t.condition.dependsOnTaskId==`string`?ce(c,t.condition.dependsOnTaskId):V,className:`mt-2 inline-flex min-h-9 items-center text-accent-fg hover:underline`,children:i?`查看并处理`:`View and resolve`})]})},t.id))]}):null,l.task.phase===`review`&&!D?(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:i?`尚有 ${L} 项待判定、${F} 项未通过、${l.waits.length} 项等待处理。${R?`此任务需要执行验证;请继续执行以补齐依据和未完成项。`:`查看依据后逐项判定;未通过时可继续执行修正。`}`:`${L} unreviewed, ${F} failed, ${l.waits.length} pending items. ${R?`This task requires execution verification. Continue execution to supply missing evidence.`:`Review the evidence and mark each criterion; continue execution to fix failures.`}`}):null,(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[l.task.phase===`review`?(0,$.jsx)(h,{variant:`primary`,disabled:y||!D,onClick:()=>void M(()=>K(e,{type:`close`,resolution:`done`},l.task.version),i?`任务已验收完成。`:`Task accepted.`,!0),children:i?`验收完成`:`Accept task`}):null,A?(0,$.jsx)(h,{variant:D?`secondary`:`primary`,disabled:y,onClick:()=>void M(()=>K(e,{type:`start`,executor:O},l.task.version),i?`已开始执行,结果将自动更新。`:`Execution started. Results will update automatically.`),children:i?N?`继续执行并验证`:`开始执行`:N?`Continue and verify`:`Start execution`}):null]})]}):null,l&&p?(0,$.jsx)(I,{open:!0,onOpenChange:e=>{e||m(null)},children:(0,$.jsxs)(_e,{children:[(0,$.jsx)(B,{className:`fixed inset-0 z-[80] bg-scrim`}),(0,$.jsxs)(k,{className:`app-main-surface fixed left-1/2 top-1/2 z-[90] flex h-[min(54rem,calc(100dvh-2rem))] w-[min(72rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel outline-none`,"aria-describedby":void 0,children:[(0,$.jsxs)(S,{className:`sr-only`,children:[i?`交付物预览`:`Artifact preview`,` · `,p]}),(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsxs)(`div`,{className:`flex-1 space-y-3 p-4`,"aria-busy":!0,children:[(0,$.jsx)(g,{className:`h-9 w-full`}),(0,$.jsx)(g,{className:`h-64 w-full`})]}),children:(0,$.jsx)(qe,{filePath:p,projectId:l.task.projectId,conversationId:l.conversation?.activeConversationId,onClose:()=>m(null)})})]})]})}):null]})}function Ye(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function Xe(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`div`,{className:`space-y-8`,"aria-busy":!0,children:[(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsx)(g,{className:`h-10 w-3/5 rounded-xl`}),(0,$.jsx)(g,{className:`h-5 w-4/5 rounded-lg`})]}),(0,$.jsx)(g,{className:`h-64 rounded-2xl`}),(0,$.jsx)(g,{className:`h-32 rounded-xl`})]}),e[0]=t):t=e[0],t}function Ze(e){let t=(0,Z.c)(61),{item:n,busy:r,recommendationLabel:i,dueLabel:a,failureLabel:s,locale:c,onAction:l,onComplete:u,onUpdated:d}=e,[f,p]=o(),m;t[0]===n.openAction?m=t[1]:(m=n.openAction?.type===`open`?/^\/tasks\/([^/?#]+)/.exec(n.openAction.href):null,t[0]=n.openAction,t[1]=m);let g=m,_=n.primaryAction?.type===`task_review`?n.primaryAction.taskId:g?decodeURIComponent(g[1]):void 0,v;t[2]!==_||t[3]!==f?(v=_&&f.get(`reviewTask`)===_,t[2]=_,t[3]=f,t[4]=v):v=t[4];let y=!!v,b;t[5]!==_||t[6]!==f||t[7]!==p?(b=e=>{let t=new URLSearchParams(f);e&&_?t.set(`reviewTask`,_):t.delete(`reviewTask`),p(t)},t[5]=_,t[6]=f,t[7]=p,t[8]=b):b=t[8];let x=b,S;t[9]!==a||t[10]!==n.dueAt||t[11]!==c?(S=n.dueAt?`${a} ${ye(new Date(n.dueAt),c)}`:null,t[9]=a,t[10]=n.dueAt,t[11]=c,t[12]=S):S=t[12];let C=S,w=n.kind===`failure`?s:C,T;t[13]===w?T=t[14]:(T=w?(0,$.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 text-xs font-medium text-warning`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-warning`,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:w})]}):null,t[13]=w,t[14]=T);let E=!n.openAction,D;t[15]!==n.id||t[16]!==n.openAction||t[17]!==l?(D=()=>n.openAction&&l(n.openAction,n.id),t[15]=n.id,t[16]=n.openAction,t[17]=l,t[18]=D):D=t[18];let O;t[19]===n.title?O=t[20]:(O=(0,$.jsx)(`span`,{className:`block text-lg font-semibold leading-7 tracking-tight text-fg`,children:n.title}),t[19]=n.title,t[20]=O);let k;t[21]===n.summary?k=t[22]:(k=(0,$.jsx)(`span`,{className:`mt-1.5 block text-sm leading-6 text-fg-muted`,children:n.summary}),t[21]=n.summary,t[22]=k);let A;t[23]!==E||t[24]!==D||t[25]!==O||t[26]!==k?(A=(0,$.jsxs)(`button`,{type:`button`,className:`block w-full text-left outline-none focus-visible:rounded-md focus-visible:ring-2 focus-visible:ring-accent`,disabled:E,onClick:D,children:[O,k]}),t[23]=E,t[24]=D,t[25]=O,t[26]=k,t[27]=A):A=t[27];let j;t[28]!==n.recommendation||t[29]!==i?(j=n.recommendation?(0,$.jsxs)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:[(0,$.jsxs)(`span`,{className:`font-semibold text-fg`,children:[i,`:`]}),n.recommendation]}):null,t[28]=n.recommendation,t[29]=i,t[30]=j):j=t[30];let M;t[31]!==r||t[32]!==n.id||t[33]!==n.primaryAction||t[34]!==n.secondaryActions||t[35]!==l||t[36]!==y||t[37]!==_||t[38]!==x?(M=n.primaryAction||n.secondaryActions.length>0?(0,$.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:[n.primaryAction?(0,$.jsx)(h,{type:`button`,variant:`primary`,className:`h-9 rounded-lg px-3.5 text-xs`,disabled:r,"aria-expanded":_&&[`task_review`,`open`].includes(n.primaryAction.type)?y:void 0,onClick:()=>_&&[`task_review`,`open`].includes(n.primaryAction.type)?x(!y):l(n.primaryAction,n.id),children:n.primaryAction.label}):null,n.secondaryActions.map(e=>(0,$.jsx)(h,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3.5 text-xs shadow-none`,disabled:r,onClick:()=>l(e,n.id),children:e.label},`${e.type}:${e.label}`))]}):null,t[31]=r,t[32]=n.id,t[33]=n.primaryAction,t[34]=n.secondaryActions,t[35]=l,t[36]=y,t[37]=_,t[38]=x,t[39]=M):M=t[39];let N;t[40]!==n.primaryAction?.type||t[41]!==c||t[42]!==y||t[43]!==_||t[44]!==x?(N=_&&n.primaryAction?.type===`retry_task`?(0,$.jsx)(h,{variant:`ghost`,className:`mt-2`,"aria-expanded":y,onClick:()=>x(!y),children:c===`zh`?`查看结果与依据`:`View result and evidence`}):null,t[40]=n.primaryAction?.type,t[41]=c,t[42]=y,t[43]=_,t[44]=x,t[45]=N):N=t[45];let P;t[46]!==c||t[47]!==u||t[48]!==d||t[49]!==y||t[50]!==_||t[51]!==x?(P=y&&_?(0,$.jsx)(Je,{taskId:_,language:c,onUpdated:d,onComplete:()=>{x(!1),u()}},_):null,t[46]=c,t[47]=u,t[48]=d,t[49]=y,t[50]=_,t[51]=x,t[52]=P):P=t[52];let F;return t[53]!==r||t[54]!==A||t[55]!==j||t[56]!==M||t[57]!==N||t[58]!==P||t[59]!==T?(F=(0,$.jsxs)(`article`,{className:`px-5 py-5 sm:px-6 sm:py-6`,"aria-busy":r,children:[T,A,j,M,N,P]}),t[53]=r,t[54]=A,t[55]=j,t[56]=M,t[57]=N,t[58]=P,t[59]=T,t[60]=F):F=t[60],F}function Qe(e){let t=(0,Z.c)(38),{item:n,onAction:r,language:i,onUpdated:a}=e,[o,s]=(0,Q.useState)(!1),c;t[0]===n.openAction?c=t[1]:(c=n.openAction?.type===`open`?/^\/tasks\/([^/?#]+)/.exec(n.openAction.href):null,t[0]=n.openAction,t[1]=c);let l=c,u=l?decodeURIComponent(l[1]):void 0,d;t[2]===n.kind?d=t[3]:(d=n.kind===`scheduled`?(0,$.jsx)(A,{className:`size-4`,"aria-hidden":!0}):(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-fg-subtle`,"aria-hidden":!0}),t[2]=n.kind,t[3]=d);let f=d,p=!n.openAction,m=u?o:void 0,h;t[4]!==n.id||t[5]!==n.openAction||t[6]!==r||t[7]!==u?(h=()=>u?s($e):n.openAction&&r(n.openAction,n.id),t[4]=n.id,t[5]=n.openAction,t[6]=r,t[7]=u,t[8]=h):h=t[8];let g;t[9]===f?g=t[10]:(g=(0,$.jsx)(`span`,{className:`flex size-7 shrink-0 items-center justify-center text-fg-subtle`,children:f}),t[9]=f,t[10]=g);let _;t[11]===n.title?_=t[12]:(_=(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:n.title}),t[11]=n.title,t[12]=_);let v;t[13]===n.summary?v=t[14]:(v=(0,$.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,children:n.summary}),t[13]=n.summary,t[14]=v);let y;t[15]!==_||t[16]!==v?(y=(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[_,v]}),t[15]=_,t[16]=v,t[17]=y):y=t[17];let b;t[18]===n.statusLabel?b=t[19]:(b=n.statusLabel?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:n.statusLabel}):null,t[18]=n.statusLabel,t[19]=b);let x;t[20]===n.openAction?x=t[21]:(x=n.openAction?(0,$.jsx)(F,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}):null,t[20]=n.openAction,t[21]=x);let S;t[22]!==b||t[23]!==x||t[24]!==p||t[25]!==m||t[26]!==h||t[27]!==g||t[28]!==y?(S=(0,$.jsxs)(`button`,{type:`button`,className:`flex min-h-16 w-full items-center gap-3 py-3 text-left outline-none hover:text-fg focus-visible:rounded-md focus-visible:ring-2 focus-visible:ring-accent`,disabled:p,"aria-expanded":m,onClick:h,children:[g,y,b,x]}),t[22]=b,t[23]=x,t[24]=p,t[25]=m,t[26]=h,t[27]=g,t[28]=y,t[29]=S):S=t[29];let C;t[30]!==o||t[31]!==i||t[32]!==a||t[33]!==u?(C=u&&o?(0,$.jsx)(Je,{taskId:u,language:i,onUpdated:a,onComplete:()=>s(!1)}):null,t[30]=o,t[31]=i,t[32]=a,t[33]=u,t[34]=C):C=t[34];let w;return t[35]!==S||t[36]!==C?(w=(0,$.jsxs)(`div`,{children:[S,C]}),t[35]=S,t[36]=C,t[37]=w):w=t[37],w}function $e(e){return!e}function et(){let e=p(e=>e.language),t=d(e),n=t.projectsPage,r=ue(e),i=c(),o=a(),s=me(e=>e.setPageHeader),l=me(e=>e.clearPageHeader),[u,f]=(0,Q.useState)(!1),{home:m,loading:g,loadError:_,setLoadError:v,load:y}=we(e,o.key,u),[b,D]=(0,Q.useState)(!1),[O,A]=(0,Q.useState)(``),N=(0,Q.useRef)(!1),[F,L]=(0,Q.useState)(),[R,z]=(0,Q.useState)(!1),[ee,W]=(0,Q.useState)(null),[K,J]=(0,Q.useState)(!1),[ne,ie]=(0,Q.useState)(),[ce,le]=(0,Q.useState)(!1),[de,fe]=(0,Q.useState)(0),[ge,Y]=(0,Q.useState)(),[ye,be]=(0,Q.useState)(),[xe,Se]=(0,Q.useState)(!1),X=j({chat:t.chat}),Ce=(0,Q.useRef)(null),Z=E({disabled:xe,chat:t.chat,onTranscript:e=>{A(t=>U(t,e)),window.setTimeout(()=>Ce.current?.focus(),0)}}),{phase:Te,voiceActive:De,startVoiceInput:Oe,cancelVoiceInput:ke,confirmVoiceInput:Ae,retryVoiceInput:je}=Z;(0,Q.useEffect)(()=>{if(!ge)return;let e=window.setTimeout(()=>Y(void 0),8e3);return()=>window.clearTimeout(e)},[ge]);let Me=(0,Q.useCallback)(async e=>{if(!(e.length===0||xe)){Se(!0);try{await X.processFiles(e)}finally{Se(!1)}}},[xe,X.processFiles]),Pe=(0,Q.useCallback)(async e=>{let t=ae(e.clipboardData);t.length!==0&&(e.preventDefault(),await Me(t))},[Me]),Fe=(0,Q.useCallback)(e=>{e.dataTransfer.types.includes(`Files`)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`,X.setIsDragging(!0))},[X.setIsDragging]),Ie=(0,Q.useCallback)(e=>{let t=e.relatedTarget;(!(t instanceof Node)||!e.currentTarget.contains(t))&&X.setIsDragging(!1)},[X.setIsDragging]),Le=(0,Q.useCallback)(async e=>{e.preventDefault(),X.setIsDragging(!1),await Me(Array.from(e.dataTransfer.files))},[X.setIsDragging,Me]),ze=(0,Q.useCallback)(e=>{e.preventDefault();let t=X.wireAttachmentsPayload(),n=oe(O,t.length>0?pe(t):void 0,{projectScope:`none`});n&&(D(!1),A(``),X.clearAttachments(),i(n))},[X.clearAttachments,X.wireAttachmentsPayload,O,i]),Be=X.attachments.length>=10,Ve={attachTitle:Be?Ye(t.chat.maxAttachmentsReached,{max:10}):`${t.chat.attachFile} (${X.attachments.length}/10)`,dropFiles:t.chat.dropFiles,intentLabel:r.intentLabel,intentPlaceholder:r.intentPlaceholder,intentSuggestion:r.intentSuggestion,shortcut:n.home.submitShortcut,submit:r.newWork},He=(0,Q.useMemo)(()=>({label:n.home.advisorStatusLabel,ready:n.home.advisorStatusReady,clarification:n.home.advisorStatusClarification,refreshing:n.home.advisorStatusRefreshing,refreshingDetail:n.home.advisorRefreshing,idle:n.home.advisorStatusIdle,idleDetail:n.home.advisorUnavailableTitle,generationFailed:n.home.advisorStatusGenerationFailed,budgetExhausted:n.home.advisorStatusBudgetExhausted,modelUnavailable:n.home.advisorStatusModelUnavailable,generationFailedDetail:n.home.advisorGenerationFailed,budgetExhaustedDetail:n.home.advisorBudgetExhausted,modelUnavailableDetail:n.home.advisorModelUnavailable,history:n.home.advisorHistory,retry:n.home.retry,findAnother:n.home.advisorRefresh}),[n.home]),We=!!(m&&m.needsUser.length===0&&m.backgroundCount===0),Ke=!!(m&&m.needsUser.length===0),qe=Ke||b;(0,Q.useEffect)(()=>{!qe&&De&&ke()},[ke,qe,De]),(0,Q.useEffect)(()=>{let e=e=>{let t=e.detail?.target;t&&t!==`chat`||!qe||xe||(e.preventDefault(),Te===`recording`?Ae():Te===`idle`?(Ce.current?.focus(),Oe()):Te===`error`&&je())},t=e=>{let t=e.detail?.target;t&&t!==`chat`||!qe||!De||(e.preventDefault(),ke(),Ce.current?.focus())};return window.addEventListener(C,e),window.addEventListener(H,t),()=>{window.removeEventListener(C,e),window.removeEventListener(H,t)}},[xe,ke,qe,Ae,je,Oe,De,Te]);let Je=(0,Q.useCallback)(e=>{e||ke(),D(e)},[ke]),$e=(0,Q.useCallback)((t,n)=>{if(t.type===`open`){i(w(`/`,t.href));return}t.type===`task_review`||N.current||(N.current=!0,W(n),L(void 0),v(null),(async()=>{try{if(t.type===`retry_task`)await Ge(t.taskId,e),L({message:e===`zh`?`任务已重新开始,可查看执行进度。`:`Task restarted. View progress.`,href:w(`/`,`/tasks/${encodeURIComponent(t.taskId)}`)});else if(t.type===`connector_decision`)await q({kind:`connector_approval`,approvalId:t.approvalId},t.decision),L({message:e===`zh`?t.decision===`approve`?`已批准授权,任务状态将自动更新。`:`已拒绝授权。`:t.decision===`approve`?`Permission approved. Task status will update.`:`Permission denied.`});else if(t.type===`retry_run`){let n=await re({kind:t.subjectKind,runId:t.runId});L({message:e===`zh`?`已发起重试,可查看新的执行结果。`:`Retry started. Follow the new execution.`,href:n.conversationId?`/chat/${encodeURIComponent(n.conversationId)}`:`/automations?run=${encodeURIComponent(n.runId)}`})}else t.type===`acknowledge_run`&&(await V({kind:t.subjectKind,runId:t.runId}),L({message:e===`zh`?`已确认此异常,已从待处理事项移除。`:`Issue acknowledged and removed from pending items.`}));await y()}catch(e){v(e instanceof Error?e.message:String(e))}finally{N.current=!1,W(null)}})())},[e,y,i]),et=(0,Q.useCallback)(t=>{L({message:e===`zh`?t.task.phase===`closed`?`任务已验收完成。`:`操作已保存,任务状态已更新。`:t.task.phase===`closed`?`Task accepted.`:`Action saved. Task status updated.`,href:w(`/`,`/tasks/${encodeURIComponent(t.task.id)}`)}),y()},[e,y]),tt=(0,Q.useCallback)(()=>{J(!0),ie(void 0),be(void 0),v(null),te(e).then(()=>y()).catch(e=>v(e instanceof Error?e.message:String(e))).finally(()=>J(!1))},[e,y]),nt=(0,Q.useCallback)((e,t)=>{J(!0),v(null),ve(e,t).then(async t=>{if(t.outcome===`needs_setup`){be({opportunityId:e.id,value:t.preflight});return}if(be(void 0),fe(e=>e+1),t.outcome===`task`){ie({title:n.home.advisorStartedTitle,detail:Ye(n.home.advisorStartedDetail,{title:e.title}),href:w(`/`,t.href)}),await y();return}i(t.href)}).catch(e=>v(e instanceof Error?e.message:String(e))).finally(()=>J(!1))},[y,i,n.home.advisorStartedDetail,n.home.advisorStartedTitle]),rt=(0,Q.useCallback)((e,t)=>{J(!0),ie(void 0),be(void 0),v(null),x(e,{kind:t,snoozedUntil:t===`too_early`?Date.now()+4320*6e4:void 0}).then(({idempotencyKey:t})=>(Y({opportunityId:e.id,idempotencyKey:t}),fe(e=>e+1),y())).catch(e=>v(e instanceof Error?e.message:String(e))).finally(()=>J(!1))},[y]),it=(0,Q.useCallback)(()=>{if(!ge)return;let e=ge;Y(void 0),J(!0),v(null),he(e.opportunityId,e.idempotencyKey).then(()=>(fe(e=>e+1),y())).catch(t=>{Y(e),v(t instanceof Error?t.message:String(t))}).finally(()=>J(!1))},[ge,y]),at=(0,Q.useCallback)((e,t)=>{i(`/chat/new?${new URLSearchParams({draft:`${e}\n\n${t}`}).toString()}`)},[i]),ot=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[m?(0,$.jsx)(Ue,{advisor:m.advisor,busy:K,copy:He,onOpenHistory:()=>le(!0),onRefresh:tt}):null,Ke?null:(0,$.jsxs)(h,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>D(!0),children:[(0,$.jsx)(G,{className:`size-4`,"aria-hidden":!0}),r.newWork]})]}),[K,He,r.newWork,m,tt,Ke]);(0,Q.useLayoutEffect)(()=>(s({startExtra:null,main:(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),end:ot}),()=>l()),[l,ot,s,n.title]);let st=m?.needsUser.length??0,ct=m?.backgroundCount??0,lt=st>0?Ye(n.home.attentionTitle,{count:st}):ct>0?n.home.clearTitle:n.home.idleTitle,ut=st>0?ct>0?Ye(n.home.attentionIntroWithBackground,{count:ct}):n.home.attentionIntro:ct>0?Ye(n.home.clearIntro,{count:ct}):n.home.idleIntro;return(0,$.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[920px] flex-1 flex-col px-4 pb-8 pt-3 sm:px-6 lg:px-8 lg:pb-12 lg:pt-4`,children:[(0,$.jsx)(`input`,{ref:X.fileInputRef,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{let t=e.target.files;t&&Me(Array.from(t)),e.target.value=``}}),(0,$.jsx)(I,{open:b,onOpenChange:Je,children:(0,$.jsxs)(_e,{children:[(0,$.jsx)(B,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(k,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(31rem,calc(100dvh-1.5rem))] w-[min(36rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float focus:outline-none`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start gap-4 border-b border-edge px-5 py-4`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(S,{className:`text-base font-semibold text-fg`,children:r.dialogTitle}),(0,$.jsx)(P,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:r.dialogDescription})]}),(0,$.jsx)(T,{asChild:!0,children:(0,$.jsx)(h,{type:`button`,variant:`ghost`,className:`-mr-2 -mt-1 size-8 shrink-0 rounded-lg p-0`,title:n.cancel,"aria-label":n.cancel,children:(0,$.jsx)(M,{className:`size-4`,"aria-hidden":!0})})})]}),(0,$.jsx)(Ee,{variant:`dialog`,inputId:`new-conversation-intent`,inputRef:Ce,intent:O,labels:{...Ve,submit:r.submit},attachments:X.attachments,isDragging:X.isDragging,attachmentBusy:xe,attachmentsFull:Be,voice:Z,chat:t.chat,cancelAction:(0,$.jsx)(T,{asChild:!0,children:(0,$.jsx)(h,{type:`button`,variant:`ghost`,children:n.cancel})}),onIntentChange:A,onPickFiles:()=>X.fileInputRef.current?.click(),onRemoveAttachment:X.removeAttachment,onPaste:e=>void Pe(e),onDragOver:Fe,onDragLeave:Ie,onDrop:e=>void Le(e),onSubmit:ze})]})]})}),(0,$.jsx)(Re,{open:ce,refreshKey:de,onOpenChange:le,onReevaluate:tt}),_?(0,$.jsxs)(`div`,{role:`alert`,className:`mb-6 flex items-center justify-between gap-3 rounded-xl border border-danger/25 bg-danger-soft px-4 py-3 text-sm text-danger`,children:[(0,$.jsx)(`span`,{children:_}),(0,$.jsx)(h,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void y(),children:n.home.retry})]}):null,F?(0,$.jsxs)(`div`,{role:`status`,className:`mb-5 flex flex-wrap items-center justify-between gap-3 rounded-xl border border-success/25 bg-success-soft px-4 py-3 text-sm text-fg`,children:[(0,$.jsx)(`span`,{children:F.message}),F.href?(0,$.jsx)(h,{variant:`ghost`,onClick:()=>i(F.href),children:e===`zh`?`查看进展与结果`:`View progress and result`}):null]}):null,g?(0,$.jsx)(Xe,{}):m?(0,$.jsxs)(`div`,{className:We?`mx-auto my-auto w-full max-w-[640px]`:`w-full`,children:[(0,$.jsxs)(`section`,{className:We?`w-full text-center`:`max-w-3xl`,children:[(0,$.jsx)(`h2`,{className:`text-3xl font-semibold leading-tight tracking-[-0.035em] text-fg sm:text-4xl`,children:lt}),(0,$.jsx)(`p`,{className:We?`mx-auto mt-3 max-w-xl text-sm leading-6 text-fg-muted sm:text-base sm:leading-7`:`mt-3 max-w-2xl text-sm leading-6 text-fg-muted sm:text-base sm:leading-7`,children:ut})]}),Ke?(0,$.jsx)(Ee,{variant:`inline`,inputId:`home-conversation-intent`,inputRef:Ce,intent:O,labels:Ve,attachments:X.attachments,isDragging:X.isDragging,attachmentBusy:xe,attachmentsFull:Be,voice:Z,chat:t.chat,onIntentChange:A,onPickFiles:()=>X.fileInputRef.current?.click(),onRemoveAttachment:X.removeAttachment,onPaste:e=>void Pe(e),onDragOver:Fe,onDragLeave:Ie,onDrop:e=>void Le(e),onSubmit:ze}):null,(0,$.jsx)(Ne,{advisor:m.advisor,busy:K,copy:{aiLabel:n.home.advisorAiLabel,why:n.home.advisorWhy,evidence:n.home.advisorEvidence,needsSetup:n.home.advisorNeedsSetup,start:n.home.advisorStart,discuss:n.home.advisorDiscuss,refresh:n.home.advisorRefresh,refreshing:n.home.advisorRefreshing,history:n.home.advisorHistory,viewProgress:n.home.advisorViewProgress,alternatives:n.home.advisorAlternatives,feedback:n.home.advisorFeedback,alreadyDone:n.home.advisorAlreadyDone,irrelevant:n.home.advisorIrrelevant,later:n.home.advisorLater,lessLikeThis:n.home.advisorLessLikeThis,sourceIncorrect:n.home.advisorSourceIncorrect,minutes:n.home.advisorMinutes,setupTitle:n.home.advisorSetupTitle,setupHint:n.home.advisorSetupHint,configure:n.home.advisorConfigure,degradedStart:n.home.advisorDegradedStart,automationHint:n.home.advisorAutomationHint,automationAction:n.home.advisorAutomationAction},onRefresh:tt,onAction:nt,onFeedback:rt,onClarification:at,onOpenHistory:()=>le(!0),preflight:ye,receipt:ne}),m.needsUser.length>0?(0,$.jsxs)(`section`,{className:`mt-10`,"aria-labelledby":`home-needs-user-title`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 px-1`,children:[(0,$.jsx)(se,{className:`size-4 text-warning`,"aria-hidden":!0}),(0,$.jsx)(`h2`,{id:`home-needs-user-title`,className:`text-sm font-semibold text-fg`,children:n.home.needsUserTitle})]}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-2xl border border-edge-subtle bg-surface-base`,children:m.needsUser.map(t=>(0,$.jsx)(Ze,{item:t,busy:ee!==null,recommendationLabel:n.home.recommendationLabel,dueLabel:n.home.dueLabel,failureLabel:r.runAttention,locale:e,onAction:$e,onComplete:()=>void y(),onUpdated:et},t.id))}),u||(m.attentionPolicy?.suppressedDecisionCount??0)+(m.attentionPolicy?.suppressedAttentionCount??0)>0?(0,$.jsx)(h,{variant:`ghost`,className:`mt-2`,"aria-expanded":u,onClick:()=>f(e=>!e),children:e===`zh`?u?`收起待处理事项`:`查看其余 ${(m.attentionPolicy?.suppressedDecisionCount??0)+(m.attentionPolicy?.suppressedAttentionCount??0)} 项待处理事项`:u?`Show fewer pending items`:`View ${(m.attentionPolicy?.suppressedDecisionCount??0)+(m.attentionPolicy?.suppressedAttentionCount??0)} more pending items`}):null]}):null,m.background.length>0?(0,$.jsxs)(`section`,{className:`mt-10`,"aria-labelledby":`home-background-title`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-1`,children:[(0,$.jsx)(`h2`,{id:`home-background-title`,className:`text-sm font-semibold text-fg`,children:n.home.backgroundTitle}),(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:Ye(n.home.backgroundCount,{count:m.backgroundCount})})]}),(0,$.jsx)(`div`,{className:`mt-2 divide-y divide-edge-subtle border-y border-edge-subtle`,children:(R?m.background:m.background.slice(0,3)).map(t=>(0,$.jsx)(Qe,{item:t,language:e,onAction:$e,onUpdated:et},t.id))}),m.background.length>3?(0,$.jsx)(h,{variant:`ghost`,className:`mt-2`,"aria-expanded":R,onClick:()=>z(e=>!e),children:e===`zh`?R?`收起`:`查看全部 ${m.backgroundCount} 项`:R?`Show less`:`View all ${m.backgroundCount} items`}):null]}):null]}):null,ge?(0,$.jsxs)(`div`,{role:`status`,className:`fixed bottom-5 left-1/2 z-[100] flex -translate-x-1/2 items-center gap-4 rounded-lg border border-edge bg-surface-overlay px-4 py-3 text-sm text-fg shadow-float`,children:[(0,$.jsx)(`span`,{children:n.home.advisorFeedbackSaved}),(0,$.jsx)(`button`,{type:`button`,className:`font-medium text-accent-fg hover:underline`,onClick:it,children:n.home.advisorUndo})]}):null]})}export{et as HomePage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{i as r,o as i}from"./locale-store-DAgpZxAS.js";import{t as a}from"./skeleton-BI5TyibZ.js";import{Kc as o,ii as s}from"./index-
|
|
1
|
+
import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{i as r,o as i}from"./locale-store-DAgpZxAS.js";import{t as a}from"./skeleton-BI5TyibZ.js";import{Kc as o,ii as s}from"./index-CiDVRMmX.js";var c=t();e();var l=n();function u(e){let t=(0,c.c)(30),{primary:n,value:r,models:i,loading:u,error:d,zh:f,onChange:p}=e,m;if(t[0]!==i||t[1]!==n||t[2]!==r){let e;t[4]!==n||t[5]!==r?(e=e=>e.id!==n&&!r.includes(e.id),t[4]=n,t[5]=r,t[6]=e):e=t[6],m=i.filter(e),t[0]=i,t[1]=n,t[2]=r,t[3]=m}else m=t[3];let h=m,g=f?`回退顺序`:`Fallback order`,_;t[7]===g?_=t[8]:(_=(0,l.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:g}),t[7]=g,t[8]=_);let v=f?`主模型不可用时,按从左到右的顺序尝试。`:`Tried from left to right when the primary model is unavailable.`,y;t[9]===v?y=t[10]:(y=(0,l.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:v}),t[9]=v,t[10]=y);let b;t[11]!==_||t[12]!==y?(b=(0,l.jsx)(`div`,{className:`flex items-center justify-between gap-3`,children:(0,l.jsxs)(`div`,{children:[_,y]})}),t[11]=_,t[12]=y,t[13]=b):b=t[13];let x;t[14]!==i||t[15]!==p||t[16]!==r||t[17]!==f?(x=r.length>0?(0,l.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:r.map((e,t)=>(0,l.jsxs)(`span`,{className:`inline-flex items-center gap-2 rounded-full bg-surface-base/70 py-1 pl-2.5 pr-1 text-xs text-fg`,children:[(0,l.jsx)(`span`,{className:`text-fg-subtle`,children:t+1}),(0,l.jsx)(`span`,{children:i.find(t=>t.id===e)?.name??e}),(0,l.jsx)(`button`,{type:`button`,"aria-label":f?`移除 ${e}`:`Remove ${e}`,className:`rounded-full p-1 text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>p(r.filter(t=>t!==e)),children:(0,l.jsx)(o,{className:`size-3`})})]},e))}):(0,l.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:f?`未设置回退模型。`:`No fallback models configured.`}),t[14]=i,t[15]=p,t[16]=r,t[17]=f,t[18]=x):x=t[18];let S;t[19]!==h||t[20]!==d||t[21]!==u||t[22]!==p||t[23]!==r||t[24]!==f?(S=u?(0,l.jsx)(a,{className:`mt-3 h-11 w-full max-w-md rounded-lg`}):(0,l.jsx)(s,{value:``,models:h,modelsLoading:u,modelsError:d,placeholder:f?`添加回退模型`:`Add fallback model`,searchPlaceholder:f?`搜索模型或服务商`:`Search models or providers`,noMatches:f?`没有可添加的模型`:`No models available to add`,showProviderInTrigger:!1,contentAlign:`start`,className:`mt-3 w-full max-w-md`,ariaLabel:f?`添加回退模型`:`Add fallback model`,onChange:e=>{e&&p([...r,e])}}),t[19]=h,t[20]=d,t[21]=u,t[22]=p,t[23]=r,t[24]=f,t[25]=S):S=t[25];let C;return t[26]!==b||t[27]!==x||t[28]!==S?(C=(0,l.jsxs)(`div`,{children:[b,x,S]}),t[26]=b,t[27]=x,t[28]=S,t[29]=C):C=t[29],C}async function d(){let e=await i(r(`/api/image-generation/catalog`));if(!Array.isArray(e.payload?.providers))throw Error(`Invalid image provider catalog`);return e.payload.providers}async function f(){let e=await i(r(`/api/image-generation/custom-providers`));if(!Array.isArray(e.payload?.providers))throw Error(`Invalid custom image provider list`);return e.payload.providers}async function p(e,t){await i(r(`/api/image-generation/custom-providers/${encodeURIComponent(e)}`),{method:`PUT`,body:JSON.stringify(t)})}async function m(e){await i(r(`/api/image-generation/custom-providers/${encodeURIComponent(e)}`),{method:`DELETE`})}async function h(e,t){await i(r(`/api/image-generation/providers/${encodeURIComponent(e)}/credential`),{method:`PUT`,body:JSON.stringify({apiKey:t})})}async function g(e,t){let n=await i(r(`/api/image-generation/providers/${encodeURIComponent(e)}/test`),{method:`POST`,body:JSON.stringify({modelId:t})});if(!Array.isArray(n.payload?.images))throw Error(`Invalid image generation test response`);return{images:n.payload.images}}export{h as a,p as i,f as n,g as o,d as r,u as s,m as t};
|
package/dist/gateway/static/root/assets/{imports-page--cuF5vwU.js → imports-page-YfaRnpk1.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-BvcCCgTW.js";import{t as a}from"./check-DUBLcKHA.js";import{t as o}from"./download-Dk-ZjtO6.js";import{t as s}from"./messages-DMXSIJUO.js";import{t as c}from"./cn-0WouolD0.js";import{i as l,n as u,o as d}from"./locale-store-DAgpZxAS.js";import{t as f}from"./button-aIC072nz.js";import{i as p,o as m}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{$u as h,Bc as g,Fc as _,Hl as v,Ic as y,Kc as b,Lc as x,Ol as S,Pc as C,Pd as w,Rc as T,Tl as E,bn as D,eu as O,zc as k,zd as A}from"./index-6YjAt50A.js";import{n as j,r as M}from"./settings-page-layout-Dx5S-Msc.js";var N=e(t(),1);async function P(e,t,n){return(await d(l(`/api/imports${e}`),{...t===void 0?{}:{method:`POST`,body:JSON.stringify(t)},signal:n})).data}var F=n();function I(e){return e.kind!==`connection`&&(e.status===`ready`||e.status===`conflict`||e.kind===`project`&&e.status===`existing`)}function L(e,t){let n=e.filter(I),r=n.filter(e=>t.has(e.id)).length;return{checked:n.length>0&&r===n.length,indeterminate:r>0&&r<n.length,selectedCount:r,availableCount:n.length}}function R(e,t,n,r){return n.reduce((t,n)=>z(e,t,n,r),new Set(t))}function z(e,t,n,r){let i=new Set(t);if(!I(n))return i;if(r){if(i.add(n.id),n.parentId&&i.add(n.parentId),n.kind===`project`)for(let t of e.candidates)t.parentId===n.id&&t.kind===`skill`&&t.suggested&&I(t)&&i.add(t.id)}else if(i.delete(n.id),n.kind===`project`)for(let t of e.candidates)t.parentId===n.id&&i.delete(t.id);return i}var B=r();function V(e){let t=(0,F.c)(34),{open:n,sourceName:r,inventory:i,selected:a,onSelected:o,busy:l,locked:d,error:v,onClose:S,onRefresh:w,onSubmit:j}=e,M=s(u(ue)).imports,[P,I]=(0,N.useState)(!0),[L,V]=(0,N.useState)(!1),U;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(U=()=>{I(!0),V(!1)},t[0]=U):U=t[0];let fe=i?.id,W;t[1]===fe?W=t[2]:(W=[fe],t[1]=fe,t[2]=W),(0,N.useEffect)(U,W);let G=i?.candidates.filter(le)??[],pe;t[3]===i?.candidates?pe=t[4]:(pe=i?.candidates.filter(ce)??[],t[3]=i?.candidates,t[4]=pe);let K=pe,ge;t[5]===i?.candidates?ge=t[6]:(ge=i?.candidates.filter(se)??[],t[5]=i?.candidates,t[6]=ge);let _e=ge,q;if(t[7]!==i?.candidates){q=new Map;for(let e of i?.candidates??[]){if(!e.parentId)continue;let t=q.get(e.parentId)??[];t.push(e),q.set(e.parentId,t)}t[7]=i?.candidates,t[8]=q}else q=t[8];let ye=q,be=i?.candidates.filter(e=>a.has(e.id))??[],xe=M.selected.replace(`{skills}`,String(be.filter(oe).length)).replace(`{context}`,String(be.filter(ae).length)).replace(`{projects}`,String(be.filter(ie).length)),Se;t[9]!==i||t[10]!==o||t[11]!==a?(Se=(e,t)=>{i&&o(z(i,a,e,t))},t[9]=i,t[10]=o,t[11]=a,t[12]=Se):Se=t[12];let Ce=Se,we;t[13]!==i||t[14]!==o||t[15]!==a?(we=(e,t)=>{i&&o(R(i,a,e,t))},t[13]=i,t[14]=o,t[15]=a,t[16]=we):we=t[16];let J=we,Y;t[17]===S?Y=t[18]:(Y=e=>{e||S()},t[17]=S,t[18]=Y);let X;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,B.jsx)(T,{className:`xopc-dialog-overlay fixed inset-0 bg-scrim ${m}`}),t[19]=X):X=t[19];let Z;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(Z=c(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(calc(100dvh-2rem),760px)] w-[min(calc(100%-2rem),720px)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay outline-none`,`max-sm:bottom-0 max-sm:left-0 max-sm:top-auto max-sm:h-[min(92dvh,760px)] max-sm:w-full max-sm:translate-x-0 max-sm:translate-y-0 max-sm:rounded-b-none`,p),t[20]=Z):Z=t[20];let Q;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(Q=(0,B.jsx)(b,{"aria-hidden":`true`,className:`h-4 w-4`}),t[21]=Q):Q=t[21];let Te=v&&(0,B.jsxs)(`div`,{role:`alert`,className:`space-y-3 rounded-xl border border-edge bg-surface-inset p-4 text-sm text-fg`,children:[(0,B.jsx)(`p`,{children:v}),(0,B.jsx)(f,{variant:`secondary`,disabled:d,onClick:w,children:M.refresh})]}),$;t[22]!==v||t[23]!==i?($=!i&&!v&&(0,B.jsx)(D,{sections:2}),t[22]=v,t[23]=i,t[24]=$):$=t[24];let Ee=i&&(0,B.jsxs)(B.Fragment,{children:[!i.complete&&(0,B.jsx)(`p`,{className:`rounded-lg bg-surface-inset p-3 text-sm text-fg-muted`,children:M.incomplete}),G.length>0&&(0,B.jsxs)(me,{icon:E,title:M.personalSetup,description:M.personalSetupHint,items:G,selected:a,open:P,disabled:d,onOpenChange:I,onCheckedChange:e=>J(G,e),children:[(0,B.jsx)(he,{icon:O,title:M.kinds.skill,items:G.filter(re),inventoryId:i.id,selected:a,disabled:d,onToggle:Ce,onToggleAll:e=>J(G.filter(ne),e)}),(0,B.jsx)(he,{icon:A,title:M.kinds.context,items:G.filter(te),inventoryId:i.id,selected:a,disabled:d,onToggle:Ce,onToggleAll:e=>J(G.filter(ee),e)})]}),K.length>0&&(0,B.jsx)(me,{icon:h,title:M.kinds.project,description:M.projectsHint.replace(`{count}`,String(K.length)),items:K,selected:a,open:L,disabled:d,onOpenChange:V,onCheckedChange:e=>J(K,e),children:(0,B.jsx)(ve,{inventoryId:i.id,projects:K,projectChildren:ye,selected:a,disabled:d,onToggle:Ce})}),_e.length>0&&(0,B.jsx)(de,{inventoryId:i.id,items:_e}),!i.candidates.length&&(0,B.jsx)(`p`,{className:`rounded-xl bg-surface-inset p-5 text-sm text-fg-muted`,children:M.noContent}),!!i.notices.length&&(0,B.jsxs)(`details`,{className:`rounded-xl border border-edge bg-surface-inset p-4 text-sm text-fg-muted`,children:[(0,B.jsxs)(`summary`,{className:`cursor-pointer font-medium text-fg`,children:[M.scanNotices,` (`,i.notices.length,`)`]}),(0,B.jsx)(`ul`,{className:`mt-3 space-y-2`,children:i.notices.map(H)})]})]}),De;t[25]!==Te||t[26]!==$||t[27]!==Ee?(De=(0,B.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-4 sm:p-6`,children:[Te,$,Ee]}),t[25]=Te,t[26]=$,t[27]=Ee,t[28]=De):De=t[28];let Oe=f,ke=!i||!a.size||l,Ae=l?M.importing:d?M.retry:M.importCount.replace(`{count}`,String(a.size)),je;return t[29]!==Oe||t[30]!==j||t[31]!==ke||t[32]!==Ae?(je=(0,B.jsx)(Oe,{variant:`primary`,disabled:ke,onClick:j,children:Ae}),t[29]=Oe,t[30]=j,t[31]=ke,t[32]=Ae,t[33]=je):je=t[33],(0,B.jsx)(C,{open:n,onOpenChange:Y,children:(0,B.jsxs)(k,{children:[X,(0,B.jsxs)(y,{className:Z,children:[(0,B.jsx)(`header`,{className:`shrink-0 space-y-2 border-b border-edge p-5 sm:p-6`,children:(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(g,{className:`text-xl font-semibold text-fg`,children:M.chooseTitle.replace(`{source}`,r)}),(0,B.jsx)(x,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:M.chooseHint})]}),(0,B.jsx)(_,{asChild:!0,children:(0,B.jsx)(f,{variant:`ghost`,"aria-label":M.close,className:`h-10 w-10 shrink-0 p-0`,children:Q})})]})}),De,(0,B.jsx)(`footer`,{className:`shrink-0 border-t border-edge bg-surface-overlay p-4 sm:px-6 sm:py-5`,children:(0,B.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,B.jsxs)(`div`,{"aria-live":`polite`,className:`min-w-0`,children:[(0,B.jsx)(`p`,{className:`text-sm text-fg-muted`,children:xe}),l&&(0,B.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:M.runningHint}),d&&!l&&(0,B.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:M.retryHint})]}),(0,B.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2`,children:[(0,B.jsx)(f,{variant:`ghost`,onClick:S,children:l?M.close:M.cancel}),je]})]})})]})]})})}function H(e,t){return(0,B.jsx)(`li`,{className:`break-words`,children:e},t)}function ee(e){return e.kind===`context`}function te(e){return e.kind===`context`}function ne(e){return e.kind===`skill`}function re(e){return e.kind===`skill`}function ie(e){return e.kind===`project`}function ae(e){return e.kind===`context`}function oe(e){return e.kind===`skill`}function se(e){return e.kind===`connection`}function ce(e){return e.kind===`project`}function le(e){return!e.parentId&&(e.kind===`skill`||e.kind===`context`)}function ue(e){return e.language}function de(e){let t=(0,F.c)(13),{inventoryId:n,items:r}=e,a=s(u(fe)).imports,[o,l]=(0,N.useState)(!1),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>l(U),t[0]=d):d=t[0];let p;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,B.jsx)(`span`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-surface-panel text-fg`,children:(0,B.jsx)(v,{"aria-hidden":`true`,className:`h-5 w-5`})}),t[1]=p):p=t[1];let m=a.connectionsHint.replace(`{count}`,String(r.length)),h;t[2]===m?h=t[3]:(h=(0,B.jsx)(`span`,{className:`mt-0.5 block truncate text-xs font-normal text-fg-muted`,children:m}),t[2]=m,t[3]=h);let g=o&&`rotate-180`,_;t[4]===g?_=t[5]:(_=c(`h-4 w-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,g),t[4]=g,t[5]=_);let y;t[6]===_?y=t[7]:(y=(0,B.jsx)(w,{"aria-hidden":`true`,className:_}),t[6]=_,t[7]=y);let b;return t[8]!==n||t[9]!==r||t[10]!==o||t[11]!==a?(b=o&&(0,B.jsxs)(`div`,{className:`space-y-2 border-t border-edge bg-surface-overlay p-3 sm:p-4`,children:[r.map(e=>(0,B.jsx)(W,{inventoryId:n,item:e},e.id)),(0,B.jsx)(f,{asChild:!0,variant:`secondary`,children:(0,B.jsx)(i,{to:`/capabilities/connectors`,children:a.connectionsAction})})]}),t[8]=n,t[9]=r,t[10]=o,t[11]=a,t[12]=b):b=t[12],(0,B.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-inset`,children:[(0,B.jsx)(`div`,{className:`flex min-h-16 items-center gap-3 px-3 py-2 sm:px-4`,children:(0,B.jsxs)(f,{variant:`ghost`,className:`min-w-0 flex-1 justify-start gap-3 px-1 text-left`,"aria-expanded":o,onClick:d,children:[p,(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:a.kinds.connection}),h]}),y]})}),b]})}function U(e){return!e}function fe(e){return e.language}function W(e){let t=(0,F.c)(34),{inventoryId:n,item:r}=e,i=u(pe),a;t[0]===i?a=t[1]:(a=s(i),t[0]=i,t[1]=a);let o=a.imports,[c,l]=(0,N.useState)(),[d,p]=(0,N.useState)(!1),[m,h]=(0,N.useState)(``),g;t[2]!==n||t[3]!==r.id||t[4]!==c?(g=async function(){if(p(G),!c)try{l(await P(`/inventories/${n}/items/${r.id}/preview`))}catch(e){let t=e;h(t instanceof Error?t.message:String(t))}},t[2]=n,t[3]=r.id,t[4]=c,t[5]=g):g=t[5];let _=g,v;t[6]===r.name?v=t[7]:(v=(0,B.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:r.name}),t[6]=r.name,t[7]=v);let y;t[8]===r.displayPath?y=t[9]:(y=(0,B.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,title:r.displayPath,children:r.displayPath}),t[8]=r.displayPath,t[9]=y);let b=o.statuses[r.status],x;t[10]===b?x=t[11]:(x=(0,B.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:b}),t[10]=b,t[11]=x);let S;t[12]!==v||t[13]!==y||t[14]!==x?(S=(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[v,y,x]}),t[12]=v,t[13]=y,t[14]=x,t[15]=S):S=t[15];let C;t[16]===_?C=t[17]:(C=()=>void _(),t[16]=_,t[17]=C);let w;t[18]!==o.preview||t[19]!==C?(w=(0,B.jsx)(f,{variant:`ghost`,className:`h-9 shrink-0 px-2`,onClick:C,children:o.preview}),t[18]=o.preview,t[19]=C,t[20]=w):w=t[20];let T;t[21]!==w||t[22]!==S?(T=(0,B.jsxs)(`div`,{className:`flex items-start gap-3`,children:[S,w]}),t[21]=w,t[22]=S,t[23]=T):T=t[23];let E;t[24]===r.reason?E=t[25]:(E=r.reason&&(0,B.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:r.reason}),t[24]=r.reason,t[25]=E);let O;t[26]!==m||t[27]!==d||t[28]!==c?(O=d&&(0,B.jsx)(`div`,{className:`mt-3 rounded-lg bg-surface-inset p-3`,children:m?(0,B.jsx)(`p`,{role:`alert`,className:`text-xs text-fg-muted`,children:m}):c?(0,B.jsx)(`pre`,{className:`max-h-48 overflow-auto whitespace-pre-wrap break-words text-xs text-fg`,children:c.text}):(0,B.jsx)(D,{sections:1})}),t[26]=m,t[27]=d,t[28]=c,t[29]=O):O=t[29];let k;return t[30]!==T||t[31]!==E||t[32]!==O?(k=(0,B.jsxs)(`div`,{className:`rounded-xl border border-edge p-3`,children:[T,E,O]}),t[30]=T,t[31]=E,t[32]=O,t[33]=k):k=t[33],k}function G(e){return!e}function pe(e){return e.language}function me(e){let t=(0,F.c)(40),{icon:n,title:r,description:i,items:a,selected:o,open:s,disabled:l,onOpenChange:u,onCheckedChange:d,children:p}=e,m;t[0]!==a||t[1]!==o?(m=L(a,o),t[0]=a,t[1]=o,t[2]=m):m=t[2];let h=m,g;t[3]!==u||t[4]!==s?(g=()=>u(!s),t[3]=u,t[4]=s,t[5]=g):g=t[5];let _;t[6]===n?_=t[7]:(_=(0,B.jsx)(`span`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-surface-panel text-fg`,children:(0,B.jsx)(n,{"aria-hidden":`true`,className:`h-5 w-5`})}),t[6]=n,t[7]=_);let v;t[8]===r?v=t[9]:(v=(0,B.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:r}),t[8]=r,t[9]=v);let y;t[10]===i?y=t[11]:(y=(0,B.jsx)(`span`,{className:`mt-0.5 block truncate text-xs font-normal text-fg-muted`,children:i}),t[10]=i,t[11]=y);let b;t[12]!==v||t[13]!==y?(b=(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[v,y]}),t[12]=v,t[13]=y,t[14]=b):b=t[14];let x=s&&`rotate-180`,S;t[15]===x?S=t[16]:(S=c(`h-4 w-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,x),t[15]=x,t[16]=S);let C;t[17]===S?C=t[18]:(C=(0,B.jsx)(w,{"aria-hidden":`true`,className:S}),t[17]=S,t[18]=C);let T;t[19]!==s||t[20]!==g||t[21]!==_||t[22]!==b||t[23]!==C?(T=(0,B.jsxs)(f,{variant:`ghost`,className:`min-w-0 flex-1 justify-start gap-3 px-1 text-left`,"aria-expanded":s,onClick:g,children:[_,b,C]}),t[19]=s,t[20]=g,t[21]=_,t[22]=b,t[23]=C,t[24]=T):T=t[24];let E=l||!h.availableCount,D;t[25]!==d||t[26]!==h.checked||t[27]!==h.indeterminate||t[28]!==E||t[29]!==r?(D=(0,B.jsx)(X,{label:r,checked:h.checked,indeterminate:h.indeterminate,disabled:E,onChange:d}),t[25]=d,t[26]=h.checked,t[27]=h.indeterminate,t[28]=E,t[29]=r,t[30]=D):D=t[30];let O;t[31]!==T||t[32]!==D?(O=(0,B.jsxs)(`div`,{className:`flex min-h-16 items-center gap-3 px-3 py-2 sm:px-4`,children:[T,D]}),t[31]=T,t[32]=D,t[33]=O):O=t[33];let k;t[34]!==p||t[35]!==s?(k=s&&(0,B.jsx)(`div`,{className:`space-y-2 border-t border-edge bg-surface-overlay p-3 sm:p-4`,children:p}),t[34]=p,t[35]=s,t[36]=k):k=t[36];let A;return t[37]!==O||t[38]!==k?(A=(0,B.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-inset`,children:[O,k]}),t[37]=O,t[38]=k,t[39]=A):A=t[39],A}function he(e){let t=(0,F.c)(34),{icon:n,title:r,items:i,inventoryId:a,selected:o,disabled:l,onToggle:d,onToggleAll:p}=e,m=s(u(_e)).imports,[h,g]=(0,N.useState)(!1),[_,v]=(0,N.useState)(``),[y,b]=(0,N.useState)(60);if(!i.length)return null;let x;t[0]!==i||t[1]!==o?(x=L(i,o),t[0]=i,t[1]=o,t[2]=x):x=t[2];let S=x,C=Y(i,_),T=C.slice(0,y),E;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(E=()=>g(ge),t[3]=E):E=t[3];let D;t[4]===n?D=t[5]:(D=(0,B.jsx)(n,{"aria-hidden":`true`,className:`h-5 w-5 shrink-0 text-fg-muted`}),t[4]=n,t[5]=D);let O;t[6]!==i.length||t[7]!==r?(O=(0,B.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-fg`,children:[r,` (`,i.length,`)`]}),t[6]=i.length,t[7]=r,t[8]=O):O=t[8];let k;t[9]!==S.availableCount||t[10]!==S.selectedCount?(k=(0,B.jsxs)(`span`,{className:`text-xs font-normal text-fg-muted`,children:[S.selectedCount,`/`,S.availableCount]}),t[9]=S.availableCount,t[10]=S.selectedCount,t[11]=k):k=t[11];let A=h&&`rotate-180`,j;t[12]===A?j=t[13]:(j=c(`h-4 w-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,A),t[12]=A,t[13]=j);let M;t[14]===j?M=t[15]:(M=(0,B.jsx)(w,{"aria-hidden":`true`,className:j}),t[14]=j,t[15]=M);let P;t[16]!==h||t[17]!==D||t[18]!==O||t[19]!==k||t[20]!==M?(P=(0,B.jsxs)(f,{variant:`ghost`,className:`min-w-0 flex-1 justify-start px-1 text-left`,"aria-expanded":h,onClick:E,children:[D,O,k,M]}),t[16]=h,t[17]=D,t[18]=O,t[19]=k,t[20]=M,t[21]=P):P=t[21];let I=l||!S.availableCount,R;t[22]!==p||t[23]!==S.checked||t[24]!==S.indeterminate||t[25]!==I||t[26]!==r?(R=(0,B.jsx)(X,{label:r,checked:S.checked,indeterminate:S.indeterminate,disabled:I,onChange:p}),t[22]=p,t[23]=S.checked,t[24]=S.indeterminate,t[25]=I,t[26]=r,t[27]=R):R=t[27];let z;t[28]!==P||t[29]!==R?(z=(0,B.jsxs)(`div`,{className:`flex min-h-14 items-center gap-2 px-3 py-2`,children:[P,R]}),t[28]=P,t[29]=R,t[30]=z):z=t[30];let V=h&&(0,B.jsxs)(`div`,{className:`space-y-2 border-t border-edge p-2`,children:[i.length>8&&(0,B.jsx)(J,{value:_,label:m.searchWithin.replace(`{group}`,r),onChange:e=>{v(e),b(60)}}),(0,B.jsx)(`div`,{className:`space-y-1`,children:T.map(e=>(0,B.jsx)(Z,{inventoryId:a,item:e,checked:o.has(e.id),disabled:l,onChange:t=>d(e,t)},e.id))}),!C.length&&(0,B.jsx)(`p`,{className:`p-3 text-sm text-fg-muted`,children:m.noMatches}),T.length<C.length&&(0,B.jsx)(f,{variant:`ghost`,className:`w-full`,onClick:()=>b(K),children:m.showMore.replace(`{count}`,String(C.length-T.length))})]}),H;return t[31]!==z||t[32]!==V?(H=(0,B.jsxs)(`div`,{className:`rounded-xl border border-edge`,children:[z,V]}),t[31]=z,t[32]=V,t[33]=H):H=t[33],H}function K(e){return e+60}function ge(e){return!e}function _e(e){return e.language}function ve(e){let t=(0,F.c)(15),{inventoryId:n,projects:r,projectChildren:i,selected:a,disabled:o,onToggle:c}=e,l=s(u(ye)).imports,[d,p]=(0,N.useState)(``),[m,h]=(0,N.useState)(60),g;t[0]===i?g=t[1]:(g=e=>i.get(e.id)??[],t[0]=i,t[1]=g);let _=Y(r,d,g),v=_.slice(0,m),y=r.length>8&&(0,B.jsx)(J,{value:d,label:l.searchWithin.replace(`{group}`,l.kinds.project),onChange:e=>{p(e),h(60)}}),b;t[2]!==o||t[3]!==n||t[4]!==c||t[5]!==i||t[6]!==a?(b=e=>(0,B.jsx)(be,{inventoryId:n,project:e,children:i.get(e.id)??[],selected:a,disabled:o,onToggle:c},e.id),t[2]=o,t[3]=n,t[4]=c,t[5]=i,t[6]=a,t[7]=b):b=t[7];let x=v.map(b),S;t[8]===x?S=t[9]:(S=(0,B.jsx)(`div`,{className:`space-y-2`,children:x}),t[8]=x,t[9]=S);let C=!_.length&&(0,B.jsx)(`p`,{className:`p-3 text-sm text-fg-muted`,children:l.noMatches}),w=v.length<_.length&&(0,B.jsx)(f,{variant:`ghost`,className:`w-full`,onClick:()=>h(q),children:l.showMore.replace(`{count}`,String(_.length-v.length))}),T;return t[10]!==y||t[11]!==S||t[12]!==C||t[13]!==w?(T=(0,B.jsxs)(`div`,{className:`space-y-2`,children:[y,S,C,w]}),t[10]=y,t[11]=S,t[12]=C,t[13]=w,t[14]=T):T=t[14],T}function q(e){return e+60}function ye(e){return e.language}function be(e){let t=(0,F.c)(52),{inventoryId:n,project:r,children:i,selected:a,disabled:o,onToggle:l}=e,d=s(u(we)).imports,[p,m]=(0,N.useState)(!1),h;if(t[0]!==i||t[1]!==a){let e;t[3]===a?e=t[4]:(e=e=>a.has(e.id),t[3]=a,t[4]=e),h=i.filter(e),t[0]=i,t[1]=a,t[2]=h}else h=t[2];let g=h.length,_=f,v;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(v=()=>m(Ce),t[5]=v):v=t[5];let y;t[6]===r.name?y=t[7]:(y=(0,B.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:r.name}),t[6]=r.name,t[7]=y);let b;t[8]===r.displayPath?b=t[9]:(b=(0,B.jsx)(`span`,{className:`mt-0.5 block truncate text-xs font-normal text-fg-muted`,children:r.displayPath}),t[8]=r.displayPath,t[9]=b);let x;t[10]!==y||t[11]!==b?(x=(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[y,b]}),t[10]=y,t[11]=b,t[12]=x):x=t[12];let S=i.length>0&&(0,B.jsxs)(`span`,{className:`text-xs font-normal text-fg-muted`,children:[d.projectContents.replace(`{skills}`,String(i.filter(Se).length)).replace(`{context}`,String(i.filter(xe).length)),` · `,d.chosenCount.replace(`{count}`,String(g))]}),C=p&&`rotate-180`,T;t[13]===C?T=t[14]:(T=c(`h-4 w-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,C),t[13]=C,t[14]=T);let E;t[15]===T?E=t[16]:(E=(0,B.jsx)(w,{"aria-hidden":`true`,className:T}),t[15]=T,t[16]=E);let D;t[17]!==_||t[18]!==p||t[19]!==S||t[20]!==E||t[21]!==v||t[22]!==x?(D=(0,B.jsxs)(_,{variant:`ghost`,className:`min-w-0 flex-1 justify-start px-2 text-left`,"aria-expanded":p,onClick:v,children:[x,S,E]}),t[17]=_,t[18]=p,t[19]=S,t[20]=E,t[21]=v,t[22]=x,t[23]=D):D=t[23];let O=r.name,k;t[24]!==r.id||t[25]!==a?(k=a.has(r.id),t[24]=r.id,t[25]=a,t[26]=k):k=t[26];let A;t[27]!==o||t[28]!==r?(A=o||!I(r),t[27]=o,t[28]=r,t[29]=A):A=t[29];let j;t[30]!==l||t[31]!==r?(j=e=>l(r,e.target.checked),t[30]=l,t[31]=r,t[32]=j):j=t[32];let M;t[33]!==r.name||t[34]!==k||t[35]!==A||t[36]!==j?(M=(0,B.jsx)(`input`,{type:`checkbox`,"aria-label":O,checked:k,disabled:A,onChange:j}),t[33]=r.name,t[34]=k,t[35]=A,t[36]=j,t[37]=M):M=t[37];let P;t[38]!==D||t[39]!==M?(P=(0,B.jsxs)(`div`,{className:`flex items-center gap-2 p-2`,children:[D,M]}),t[38]=D,t[39]=M,t[40]=P):P=t[40];let L;t[41]!==i||t[42]!==o||t[43]!==n||t[44]!==l||t[45]!==p||t[46]!==a||t[47]!==d?(L=p&&(0,B.jsx)(`div`,{className:`border-t border-edge p-2`,children:i.length?(0,B.jsx)(`div`,{className:`space-y-1`,children:i.map(e=>(0,B.jsx)(Z,{inventoryId:n,item:e,checked:a.has(e.id),disabled:o,onChange:t=>l(e,t)},e.id))}):(0,B.jsx)(`p`,{className:`p-2 text-xs text-fg-muted`,children:d.directoryOnly})}),t[41]=i,t[42]=o,t[43]=n,t[44]=l,t[45]=p,t[46]=a,t[47]=d,t[48]=L):L=t[48];let R;return t[49]!==P||t[50]!==L?(R=(0,B.jsxs)(`div`,{className:`rounded-xl border border-edge`,children:[P,L]}),t[49]=P,t[50]=L,t[51]=R):R=t[51],R}function xe(e){return e.kind===`context`}function Se(e){return e.kind===`skill`}function Ce(e){return!e}function we(e){return e.language}function J(e){let t=(0,F.c)(13),{value:n,label:r,onChange:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,B.jsx)(S,{"aria-hidden":`true`,className:`h-4 w-4 shrink-0 text-fg-muted`}),t[0]=a):a=t[0];let o;t[1]===r?o=t[2]:(o=(0,B.jsx)(`span`,{className:`sr-only`,children:r}),t[1]=r,t[2]=o);let s=`${r}…`,c;t[3]===i?c=t[4]:(c=e=>i(e.target.value),t[3]=i,t[4]=c);let l;t[5]!==r||t[6]!==s||t[7]!==c||t[8]!==n?(l=(0,B.jsx)(`input`,{type:`search`,autoComplete:`off`,value:n,placeholder:s,"aria-label":r,onChange:c,className:`min-w-0 flex-1 border-0 bg-transparent px-0 py-2 text-sm text-fg placeholder:text-fg-subtle`}),t[5]=r,t[6]=s,t[7]=c,t[8]=n,t[9]=l):l=t[9];let u;return t[10]!==o||t[11]!==l?(u=(0,B.jsxs)(`label`,{className:`flex items-center gap-2 rounded-lg border border-edge bg-surface-panel px-3 focus-within:border-accent focus-within:ring-1 focus-within:ring-accent`,children:[a,o,l]}),t[10]=o,t[11]=l,t[12]=u):u=t[12],u}function Y(e,t,n=()=>[]){let r=t.trim().toLocaleLowerCase();if(!r)return e;let i=e=>`${e.name} ${e.description} ${e.displayPath}`.toLocaleLowerCase().includes(r);return e.filter(e=>i(e)||n(e).some(i))}function X(e){let t=(0,F.c)(10),{label:n,checked:r,indeterminate:i,disabled:a,onChange:o}=e,s=(0,N.useRef)(null),c,l;t[0]===i?(c=t[1],l=t[2]):(c=()=>{s.current&&(s.current.indeterminate=i)},l=[i],t[0]=i,t[1]=c,t[2]=l),(0,N.useEffect)(c,l);let u;t[3]===o?u=t[4]:(u=e=>o(e.target.checked),t[3]=o,t[4]=u);let d;return t[5]!==r||t[6]!==a||t[7]!==n||t[8]!==u?(d=(0,B.jsx)(`input`,{ref:s,type:`checkbox`,"aria-label":n,checked:r,disabled:a,onChange:u}),t[5]=r,t[6]=a,t[7]=n,t[8]=u,t[9]=d):d=t[9],d}function Z(e){let t=(0,F.c)(52),{inventoryId:n,item:r,checked:i,disabled:a,onChange:o}=e,c=u(Te),l;t[0]===c?l=t[1]:(l=s(c),t[0]=c,t[1]=l);let d=l.imports,[p,m]=(0,N.useState)(),[h,g]=(0,N.useState)(``),[_,v]=(0,N.useState)(!1),y;t[2]!==n||t[3]!==r.id||t[4]!==p?(y=async function(){if(v(Q),!p)try{m(await P(`/inventories/${n}/items/${r.id}/preview`))}catch(e){let t=e;g(t instanceof Error?t.message:String(t))}},t[2]=n,t[3]=r.id,t[4]=p,t[5]=y):y=t[5];let b=y,x;t[6]!==a||t[7]!==r?(x=a||!I(r),t[6]=a,t[7]=r,t[8]=x):x=t[8];let S;t[9]===o?S=t[10]:(S=e=>o(e.target.checked),t[9]=o,t[10]=S);let C;t[11]!==i||t[12]!==x||t[13]!==S?(C=(0,B.jsx)(`input`,{type:`checkbox`,className:`mt-0.5`,checked:i,disabled:x,onChange:S}),t[11]=i,t[12]=x,t[13]=S,t[14]=C):C=t[14];let w;t[15]===r.name?w=t[16]:(w=(0,B.jsx)(`span`,{className:`block break-words text-sm font-medium text-fg`,children:r.name}),t[15]=r.name,t[16]=w);let T;t[17]===r.displayPath?T=t[18]:(T=(0,B.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,title:r.displayPath,children:r.displayPath}),t[17]=r.displayPath,t[18]=T);let E;t[19]!==w||t[20]!==T?(E=(0,B.jsxs)(`span`,{className:`min-w-0`,children:[w,T]}),t[19]=w,t[20]=T,t[21]=E):E=t[21];let O;t[22]!==C||t[23]!==E?(O=(0,B.jsxs)(`label`,{className:`flex min-w-0 flex-1 cursor-pointer items-start gap-3 py-1`,children:[C,E]}),t[22]=C,t[23]=E,t[24]=O):O=t[24];let k;t[25]!==r.name||t[26]!==r.status||t[27]!==d||t[28]!==b?(k=r.status!==`blocked`&&(0,B.jsx)(f,{variant:`ghost`,"aria-label":`${d.preview}: ${r.name}`,className:`h-9 shrink-0 px-2`,onClick:()=>void b(),children:d.preview}),t[25]=r.name,t[26]=r.status,t[27]=d,t[28]=b,t[29]=k):k=t[29];let A;t[30]!==O||t[31]!==k?(A=(0,B.jsxs)(`div`,{className:`flex items-start gap-2`,children:[O,k]}),t[30]=O,t[31]=k,t[32]=A):A=t[32];let j;t[33]===r.description?j=t[34]:(j=r.description&&(0,B.jsx)(`p`,{className:`pl-7 text-xs text-fg-muted`,children:r.description}),t[33]=r.description,t[34]=j);let M;t[35]!==r.status||t[36]!==r.targetName||t[37]!==d?(M=r.status!==`ready`&&(0,B.jsxs)(`p`,{className:`pl-7 text-xs text-fg-muted`,children:[d.statuses[r.status],r.status===`conflict`?` → ${r.targetName}`:``]}),t[35]=r.status,t[36]=r.targetName,t[37]=d,t[38]=M):M=t[38];let L;t[39]===r.reason?L=t[40]:(L=r.reason&&(0,B.jsx)(`p`,{className:`break-words pl-7 text-xs text-fg-muted`,children:r.reason}),t[39]=r.reason,t[40]=L);let R;t[41]!==p||t[42]!==h||t[43]!==_||t[44]!==d?(R=_&&(0,B.jsx)(`div`,{className:`ml-7 mt-2 rounded-lg border border-edge bg-surface-inset p-3`,children:h?(0,B.jsx)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:h}):p?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`pre`,{className:`max-h-60 overflow-auto whitespace-pre-wrap break-words text-xs text-fg`,children:p.text}),p.truncated&&(0,B.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:d.previewTruncated})]}):(0,B.jsx)(D,{sections:1})}),t[41]=p,t[42]=h,t[43]=_,t[44]=d,t[45]=R):R=t[45];let z;return t[46]!==A||t[47]!==j||t[48]!==M||t[49]!==L||t[50]!==R?(z=(0,B.jsxs)(`div`,{className:`min-w-0 rounded-lg px-2 py-1.5 hover:bg-surface-hover/60`,children:[A,j,M,L,R]}),t[46]=A,t[47]=j,t[48]=M,t[49]=L,t[50]=R,t[51]=z):z=t[51],z}function Q(e){return!e}function Te(e){return e.language}function $(){let e=s(u(e=>e.language)).imports,[t,n]=(0,N.useState)(),[r,c]=(0,N.useState)(),[l,d]=(0,N.useState)(!1),[p,m]=(0,N.useState)(),[h,g]=(0,N.useState)(new Set),[_,v]=(0,N.useState)(!1),[y,b]=(0,N.useState)(),[x,S]=(0,N.useState)(),[C,w]=(0,N.useState)(``),[T,E]=(0,N.useState)(``),[O,k]=(0,N.useState)(0),A=(0,N.useRef)(null),F=(0,N.useRef)(!1);(0,N.useEffect)(()=>{let e=new AbortController;return w(``),P(`/sources`,void 0,e.signal).then(e=>n(e.sources)).catch(t=>{e.signal.aborted||w(t instanceof Error?t.message:String(t))}),()=>{e.abort(),A.current?.abort()}},[O]);let I=(t?.flatMap(e=>e.lastImport?.status===`running`?[e.lastImport.id]:[])??[]).join(`,`);(0,N.useEffect)(()=>{if(!I)return;let e=new AbortController,t,n=async()=>{for(let t of I.split(`,`))try{let n=await P(`/runs/${t}`,void 0,e.signal);e.signal.aborted||L(n)}catch{}e.signal.aborted||(t=setTimeout(()=>void n(),3e3))};return t=setTimeout(()=>void n(),1500),()=>{e.abort(),clearTimeout(t)}},[I]);function L(e){n(t=>t?.map(t=>t.id===e.source?{...t,lastImport:e}:t)),e.status!==`running`&&b(t=>t?.requestId===e.id?void 0:t)}async function R(e){A.current?.abort();let t=new AbortController;A.current=t,c(e),d(!0),m(void 0),g(new Set),E(``),S(void 0),b(void 0);try{let n=await P(`/sources/${e}/scan`,{},t.signal);t.signal.aborted||(m(n),g(new Set(n.candidates.filter(e=>!e.parentId&&e.suggested).map(e=>e.id))))}catch(e){t.signal.aborted||E(e instanceof Error?e.message:String(e))}}async function z(){if(!p||!h.size||F.current)return;F.current=!0,v(!0),E(``),w(``);let e=y??{inventoryId:p.id,candidateIds:[...h],requestId:crypto.randomUUID(),retryOf:x};b(e);try{L(await P(`/runs`,e)),d(!1)}catch(e){let t=e instanceof Error?e.message:String(e);E(t),w(t);let n=e.body?.code;n&&[`invalid_input`,`inventory_stale`,`invalid_selection`,`missing_parent`,`not_found`,`conflict`].includes(n)&&b(void 0)}finally{F.current=!1,v(!1)}}async function H(e){c(e.source),d(!0),m(void 0),g(new Set),E(``),b(void 0),S(e.id),A.current?.abort();let t=new AbortController;A.current=t;try{let n=await P(`/inventories/${e.inventoryId}`,void 0,t.signal);if(t.signal.aborted)return;let r=new Set(e.items.filter(e=>e.status===`failed`).map(e=>e.candidateId));n.candidates.forEach(e=>{r.has(e.id)&&e.parentId&&r.add(e.parentId)}),m({...n,candidates:n.candidates.filter(e=>r.has(e.id))}),g(r)}catch(e){t.signal.aborted||E(e instanceof Error?e.message:String(e))}}let ee=t?.filter(e=>e.detected||e.lastImport);return(0,B.jsxs)(M,{children:[(0,B.jsx)(j,{title:e.title,subtitle:e.subtitle}),C&&(0,B.jsxs)(`div`,{role:`alert`,className:`rounded-xl bg-danger-soft p-4 text-sm text-danger`,children:[(0,B.jsx)(`p`,{children:C}),!t&&(0,B.jsx)(f,{variant:`ghost`,onClick:()=>k(e=>e+1),children:e.retry})]}),!t&&!C&&(0,B.jsx)(D,{sections:1}),t&&(0,B.jsxs)(`section`,{className:`space-y-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h2`,{className:`text-base font-medium text-fg`,children:e.apps}),(0,B.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.detectedHint})]}),ee?.length?(0,B.jsx)(`div`,{className:`flex flex-col gap-1 overflow-hidden rounded-xl bg-surface-hover/20 p-1 [&>*]:rounded-lg [&>*]:bg-surface-base/45`,children:ee.map(t=>(0,B.jsxs)(`article`,{className:`space-y-3 p-5 sm:p-6`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,B.jsx)(`div`,{"aria-hidden":`true`,className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-xl bg-surface-hover text-fg`,children:(0,B.jsx)(o,{className:`h-5 w-5`})}),(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(`h3`,{className:`font-medium text-fg`,children:t.name}),(0,B.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.includes})]}),(0,B.jsx)(f,{variant:`secondary`,disabled:_||!t.detected||!!y&&r!==t.id||t.lastImport?.status===`running`,onClick:()=>{w(``),y&&r===t.id?d(!0):R(t.id)},children:_&&r===t.id?e.importing:y&&r===t.id?e.retry:t.lastImport?e.importAgain:e.import})]}),t.lastImport&&(0,B.jsxs)(`div`,{role:`status`,className:`space-y-2 text-sm text-fg-muted`,children:[(0,B.jsxs)(`p`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(a,{className:`h-4 w-4 shrink-0`}),t.lastImport.status===`running`?e.importing:t.lastImport.issues.length?e.finishedWithIssues:e.finished]}),(0,B.jsxs)(`p`,{children:[e.summary.replace(`{skills}`,String(t.lastImport.skills)).replace(`{context}`,String(t.lastImport.context)).replace(`{projects}`,String(t.lastImport.projects)),t.lastImport.skipped>0&&` · ${e.skipped.replace(`{count}`,String(t.lastImport.skipped))}`]}),!!t.lastImport.issues.length&&(0,B.jsxs)(`details`,{children:[(0,B.jsxs)(`summary`,{className:`cursor-pointer text-fg`,children:[e.details,` (`,t.lastImport.issues.length,`)`]}),(0,B.jsx)(`ul`,{className:`mt-2 space-y-2`,children:t.lastImport.issues.map((e,t)=>(0,B.jsxs)(`li`,{className:`break-words`,children:[(0,B.jsx)(`span`,{className:`font-medium`,children:e.name}),` — `,e.reason]},t))})]}),t.lastImport.status===`partial`&&(0,B.jsx)(f,{variant:`ghost`,disabled:_||!!y,onClick:()=>void H(t.lastImport),children:e.retryFailed})]})]},t.id))}):(0,B.jsxs)(`div`,{className:`rounded-xl bg-surface-hover/20 p-6 text-sm text-fg-muted`,children:[(0,B.jsx)(`p`,{children:e.empty}),(0,B.jsx)(f,{variant:`ghost`,className:`mt-3`,onClick:()=>k(e=>e+1),children:e.refresh})]}),(0,B.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:e.footnote}),ee?.some(e=>e.lastImport)&&(0,B.jsxs)(`div`,{className:`flex gap-4 text-sm`,children:[(0,B.jsx)(i,{className:`text-accent`,to:`/capabilities/skills`,children:e.openSkills}),(0,B.jsx)(i,{className:`text-accent`,to:`/projects`,children:e.openProjects}),(0,B.jsx)(i,{className:`text-accent`,to:`/capabilities/connectors`,children:e.connections})]})]}),(0,B.jsx)(V,{open:l,sourceName:t?.find(e=>e.id===r)?.name??``,inventory:p,selected:h,onSelected:g,busy:_,locked:_||!!y,error:T,onClose:()=>{A.current?.abort(),d(!1)},onRefresh:()=>{r&&R(r)},onSubmit:()=>void z()})]})}export{$ as ImportsPage};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-BvcCCgTW.js";import{t as a}from"./check-DUBLcKHA.js";import{t as o}from"./download-Dk-ZjtO6.js";import{t as s}from"./messages-DMXSIJUO.js";import{t as c}from"./cn-0WouolD0.js";import{i as l,n as u,o as d}from"./locale-store-DAgpZxAS.js";import{t as f}from"./button-aIC072nz.js";import{i as p,o as m}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{$u as h,Bc as g,Fc as _,Hl as v,Ic as y,Kc as b,Lc as x,Ol as S,Pc as C,Pd as w,Rc as T,Tl as E,bn as D,eu as O,zc as k,zd as A}from"./index-CiDVRMmX.js";import{n as j,r as M}from"./settings-page-layout-Dx5S-Msc.js";var N=e(t(),1);async function P(e,t,n){return(await d(l(`/api/imports${e}`),{...t===void 0?{}:{method:`POST`,body:JSON.stringify(t)},signal:n})).data}var F=n();function I(e){return e.kind!==`connection`&&(e.status===`ready`||e.status===`conflict`||e.kind===`project`&&e.status===`existing`)}function L(e,t){let n=e.filter(I),r=n.filter(e=>t.has(e.id)).length;return{checked:n.length>0&&r===n.length,indeterminate:r>0&&r<n.length,selectedCount:r,availableCount:n.length}}function R(e,t,n,r){return n.reduce((t,n)=>z(e,t,n,r),new Set(t))}function z(e,t,n,r){let i=new Set(t);if(!I(n))return i;if(r){if(i.add(n.id),n.parentId&&i.add(n.parentId),n.kind===`project`)for(let t of e.candidates)t.parentId===n.id&&t.kind===`skill`&&t.suggested&&I(t)&&i.add(t.id)}else if(i.delete(n.id),n.kind===`project`)for(let t of e.candidates)t.parentId===n.id&&i.delete(t.id);return i}var B=r();function V(e){let t=(0,F.c)(34),{open:n,sourceName:r,inventory:i,selected:a,onSelected:o,busy:l,locked:d,error:v,onClose:S,onRefresh:w,onSubmit:j}=e,M=s(u(ue)).imports,[P,I]=(0,N.useState)(!0),[L,V]=(0,N.useState)(!1),U;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(U=()=>{I(!0),V(!1)},t[0]=U):U=t[0];let fe=i?.id,W;t[1]===fe?W=t[2]:(W=[fe],t[1]=fe,t[2]=W),(0,N.useEffect)(U,W);let G=i?.candidates.filter(le)??[],pe;t[3]===i?.candidates?pe=t[4]:(pe=i?.candidates.filter(ce)??[],t[3]=i?.candidates,t[4]=pe);let K=pe,ge;t[5]===i?.candidates?ge=t[6]:(ge=i?.candidates.filter(se)??[],t[5]=i?.candidates,t[6]=ge);let _e=ge,q;if(t[7]!==i?.candidates){q=new Map;for(let e of i?.candidates??[]){if(!e.parentId)continue;let t=q.get(e.parentId)??[];t.push(e),q.set(e.parentId,t)}t[7]=i?.candidates,t[8]=q}else q=t[8];let ye=q,be=i?.candidates.filter(e=>a.has(e.id))??[],xe=M.selected.replace(`{skills}`,String(be.filter(oe).length)).replace(`{context}`,String(be.filter(ae).length)).replace(`{projects}`,String(be.filter(ie).length)),Se;t[9]!==i||t[10]!==o||t[11]!==a?(Se=(e,t)=>{i&&o(z(i,a,e,t))},t[9]=i,t[10]=o,t[11]=a,t[12]=Se):Se=t[12];let Ce=Se,we;t[13]!==i||t[14]!==o||t[15]!==a?(we=(e,t)=>{i&&o(R(i,a,e,t))},t[13]=i,t[14]=o,t[15]=a,t[16]=we):we=t[16];let J=we,Y;t[17]===S?Y=t[18]:(Y=e=>{e||S()},t[17]=S,t[18]=Y);let X;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,B.jsx)(T,{className:`xopc-dialog-overlay fixed inset-0 bg-scrim ${m}`}),t[19]=X):X=t[19];let Z;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(Z=c(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(calc(100dvh-2rem),760px)] w-[min(calc(100%-2rem),720px)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay outline-none`,`max-sm:bottom-0 max-sm:left-0 max-sm:top-auto max-sm:h-[min(92dvh,760px)] max-sm:w-full max-sm:translate-x-0 max-sm:translate-y-0 max-sm:rounded-b-none`,p),t[20]=Z):Z=t[20];let Q;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(Q=(0,B.jsx)(b,{"aria-hidden":`true`,className:`h-4 w-4`}),t[21]=Q):Q=t[21];let Te=v&&(0,B.jsxs)(`div`,{role:`alert`,className:`space-y-3 rounded-xl border border-edge bg-surface-inset p-4 text-sm text-fg`,children:[(0,B.jsx)(`p`,{children:v}),(0,B.jsx)(f,{variant:`secondary`,disabled:d,onClick:w,children:M.refresh})]}),$;t[22]!==v||t[23]!==i?($=!i&&!v&&(0,B.jsx)(D,{sections:2}),t[22]=v,t[23]=i,t[24]=$):$=t[24];let Ee=i&&(0,B.jsxs)(B.Fragment,{children:[!i.complete&&(0,B.jsx)(`p`,{className:`rounded-lg bg-surface-inset p-3 text-sm text-fg-muted`,children:M.incomplete}),G.length>0&&(0,B.jsxs)(me,{icon:E,title:M.personalSetup,description:M.personalSetupHint,items:G,selected:a,open:P,disabled:d,onOpenChange:I,onCheckedChange:e=>J(G,e),children:[(0,B.jsx)(he,{icon:O,title:M.kinds.skill,items:G.filter(re),inventoryId:i.id,selected:a,disabled:d,onToggle:Ce,onToggleAll:e=>J(G.filter(ne),e)}),(0,B.jsx)(he,{icon:A,title:M.kinds.context,items:G.filter(te),inventoryId:i.id,selected:a,disabled:d,onToggle:Ce,onToggleAll:e=>J(G.filter(ee),e)})]}),K.length>0&&(0,B.jsx)(me,{icon:h,title:M.kinds.project,description:M.projectsHint.replace(`{count}`,String(K.length)),items:K,selected:a,open:L,disabled:d,onOpenChange:V,onCheckedChange:e=>J(K,e),children:(0,B.jsx)(ve,{inventoryId:i.id,projects:K,projectChildren:ye,selected:a,disabled:d,onToggle:Ce})}),_e.length>0&&(0,B.jsx)(de,{inventoryId:i.id,items:_e}),!i.candidates.length&&(0,B.jsx)(`p`,{className:`rounded-xl bg-surface-inset p-5 text-sm text-fg-muted`,children:M.noContent}),!!i.notices.length&&(0,B.jsxs)(`details`,{className:`rounded-xl border border-edge bg-surface-inset p-4 text-sm text-fg-muted`,children:[(0,B.jsxs)(`summary`,{className:`cursor-pointer font-medium text-fg`,children:[M.scanNotices,` (`,i.notices.length,`)`]}),(0,B.jsx)(`ul`,{className:`mt-3 space-y-2`,children:i.notices.map(H)})]})]}),De;t[25]!==Te||t[26]!==$||t[27]!==Ee?(De=(0,B.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-4 sm:p-6`,children:[Te,$,Ee]}),t[25]=Te,t[26]=$,t[27]=Ee,t[28]=De):De=t[28];let Oe=f,ke=!i||!a.size||l,Ae=l?M.importing:d?M.retry:M.importCount.replace(`{count}`,String(a.size)),je;return t[29]!==Oe||t[30]!==j||t[31]!==ke||t[32]!==Ae?(je=(0,B.jsx)(Oe,{variant:`primary`,disabled:ke,onClick:j,children:Ae}),t[29]=Oe,t[30]=j,t[31]=ke,t[32]=Ae,t[33]=je):je=t[33],(0,B.jsx)(C,{open:n,onOpenChange:Y,children:(0,B.jsxs)(k,{children:[X,(0,B.jsxs)(y,{className:Z,children:[(0,B.jsx)(`header`,{className:`shrink-0 space-y-2 border-b border-edge p-5 sm:p-6`,children:(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(g,{className:`text-xl font-semibold text-fg`,children:M.chooseTitle.replace(`{source}`,r)}),(0,B.jsx)(x,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:M.chooseHint})]}),(0,B.jsx)(_,{asChild:!0,children:(0,B.jsx)(f,{variant:`ghost`,"aria-label":M.close,className:`h-10 w-10 shrink-0 p-0`,children:Q})})]})}),De,(0,B.jsx)(`footer`,{className:`shrink-0 border-t border-edge bg-surface-overlay p-4 sm:px-6 sm:py-5`,children:(0,B.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,B.jsxs)(`div`,{"aria-live":`polite`,className:`min-w-0`,children:[(0,B.jsx)(`p`,{className:`text-sm text-fg-muted`,children:xe}),l&&(0,B.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:M.runningHint}),d&&!l&&(0,B.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:M.retryHint})]}),(0,B.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2`,children:[(0,B.jsx)(f,{variant:`ghost`,onClick:S,children:l?M.close:M.cancel}),je]})]})})]})]})})}function H(e,t){return(0,B.jsx)(`li`,{className:`break-words`,children:e},t)}function ee(e){return e.kind===`context`}function te(e){return e.kind===`context`}function ne(e){return e.kind===`skill`}function re(e){return e.kind===`skill`}function ie(e){return e.kind===`project`}function ae(e){return e.kind===`context`}function oe(e){return e.kind===`skill`}function se(e){return e.kind===`connection`}function ce(e){return e.kind===`project`}function le(e){return!e.parentId&&(e.kind===`skill`||e.kind===`context`)}function ue(e){return e.language}function de(e){let t=(0,F.c)(13),{inventoryId:n,items:r}=e,a=s(u(fe)).imports,[o,l]=(0,N.useState)(!1),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>l(U),t[0]=d):d=t[0];let p;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,B.jsx)(`span`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-surface-panel text-fg`,children:(0,B.jsx)(v,{"aria-hidden":`true`,className:`h-5 w-5`})}),t[1]=p):p=t[1];let m=a.connectionsHint.replace(`{count}`,String(r.length)),h;t[2]===m?h=t[3]:(h=(0,B.jsx)(`span`,{className:`mt-0.5 block truncate text-xs font-normal text-fg-muted`,children:m}),t[2]=m,t[3]=h);let g=o&&`rotate-180`,_;t[4]===g?_=t[5]:(_=c(`h-4 w-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,g),t[4]=g,t[5]=_);let y;t[6]===_?y=t[7]:(y=(0,B.jsx)(w,{"aria-hidden":`true`,className:_}),t[6]=_,t[7]=y);let b;return t[8]!==n||t[9]!==r||t[10]!==o||t[11]!==a?(b=o&&(0,B.jsxs)(`div`,{className:`space-y-2 border-t border-edge bg-surface-overlay p-3 sm:p-4`,children:[r.map(e=>(0,B.jsx)(W,{inventoryId:n,item:e},e.id)),(0,B.jsx)(f,{asChild:!0,variant:`secondary`,children:(0,B.jsx)(i,{to:`/capabilities/connectors`,children:a.connectionsAction})})]}),t[8]=n,t[9]=r,t[10]=o,t[11]=a,t[12]=b):b=t[12],(0,B.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-inset`,children:[(0,B.jsx)(`div`,{className:`flex min-h-16 items-center gap-3 px-3 py-2 sm:px-4`,children:(0,B.jsxs)(f,{variant:`ghost`,className:`min-w-0 flex-1 justify-start gap-3 px-1 text-left`,"aria-expanded":o,onClick:d,children:[p,(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:a.kinds.connection}),h]}),y]})}),b]})}function U(e){return!e}function fe(e){return e.language}function W(e){let t=(0,F.c)(34),{inventoryId:n,item:r}=e,i=u(pe),a;t[0]===i?a=t[1]:(a=s(i),t[0]=i,t[1]=a);let o=a.imports,[c,l]=(0,N.useState)(),[d,p]=(0,N.useState)(!1),[m,h]=(0,N.useState)(``),g;t[2]!==n||t[3]!==r.id||t[4]!==c?(g=async function(){if(p(G),!c)try{l(await P(`/inventories/${n}/items/${r.id}/preview`))}catch(e){let t=e;h(t instanceof Error?t.message:String(t))}},t[2]=n,t[3]=r.id,t[4]=c,t[5]=g):g=t[5];let _=g,v;t[6]===r.name?v=t[7]:(v=(0,B.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:r.name}),t[6]=r.name,t[7]=v);let y;t[8]===r.displayPath?y=t[9]:(y=(0,B.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,title:r.displayPath,children:r.displayPath}),t[8]=r.displayPath,t[9]=y);let b=o.statuses[r.status],x;t[10]===b?x=t[11]:(x=(0,B.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:b}),t[10]=b,t[11]=x);let S;t[12]!==v||t[13]!==y||t[14]!==x?(S=(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[v,y,x]}),t[12]=v,t[13]=y,t[14]=x,t[15]=S):S=t[15];let C;t[16]===_?C=t[17]:(C=()=>void _(),t[16]=_,t[17]=C);let w;t[18]!==o.preview||t[19]!==C?(w=(0,B.jsx)(f,{variant:`ghost`,className:`h-9 shrink-0 px-2`,onClick:C,children:o.preview}),t[18]=o.preview,t[19]=C,t[20]=w):w=t[20];let T;t[21]!==w||t[22]!==S?(T=(0,B.jsxs)(`div`,{className:`flex items-start gap-3`,children:[S,w]}),t[21]=w,t[22]=S,t[23]=T):T=t[23];let E;t[24]===r.reason?E=t[25]:(E=r.reason&&(0,B.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:r.reason}),t[24]=r.reason,t[25]=E);let O;t[26]!==m||t[27]!==d||t[28]!==c?(O=d&&(0,B.jsx)(`div`,{className:`mt-3 rounded-lg bg-surface-inset p-3`,children:m?(0,B.jsx)(`p`,{role:`alert`,className:`text-xs text-fg-muted`,children:m}):c?(0,B.jsx)(`pre`,{className:`max-h-48 overflow-auto whitespace-pre-wrap break-words text-xs text-fg`,children:c.text}):(0,B.jsx)(D,{sections:1})}),t[26]=m,t[27]=d,t[28]=c,t[29]=O):O=t[29];let k;return t[30]!==T||t[31]!==E||t[32]!==O?(k=(0,B.jsxs)(`div`,{className:`rounded-xl border border-edge p-3`,children:[T,E,O]}),t[30]=T,t[31]=E,t[32]=O,t[33]=k):k=t[33],k}function G(e){return!e}function pe(e){return e.language}function me(e){let t=(0,F.c)(40),{icon:n,title:r,description:i,items:a,selected:o,open:s,disabled:l,onOpenChange:u,onCheckedChange:d,children:p}=e,m;t[0]!==a||t[1]!==o?(m=L(a,o),t[0]=a,t[1]=o,t[2]=m):m=t[2];let h=m,g;t[3]!==u||t[4]!==s?(g=()=>u(!s),t[3]=u,t[4]=s,t[5]=g):g=t[5];let _;t[6]===n?_=t[7]:(_=(0,B.jsx)(`span`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-surface-panel text-fg`,children:(0,B.jsx)(n,{"aria-hidden":`true`,className:`h-5 w-5`})}),t[6]=n,t[7]=_);let v;t[8]===r?v=t[9]:(v=(0,B.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:r}),t[8]=r,t[9]=v);let y;t[10]===i?y=t[11]:(y=(0,B.jsx)(`span`,{className:`mt-0.5 block truncate text-xs font-normal text-fg-muted`,children:i}),t[10]=i,t[11]=y);let b;t[12]!==v||t[13]!==y?(b=(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[v,y]}),t[12]=v,t[13]=y,t[14]=b):b=t[14];let x=s&&`rotate-180`,S;t[15]===x?S=t[16]:(S=c(`h-4 w-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,x),t[15]=x,t[16]=S);let C;t[17]===S?C=t[18]:(C=(0,B.jsx)(w,{"aria-hidden":`true`,className:S}),t[17]=S,t[18]=C);let T;t[19]!==s||t[20]!==g||t[21]!==_||t[22]!==b||t[23]!==C?(T=(0,B.jsxs)(f,{variant:`ghost`,className:`min-w-0 flex-1 justify-start gap-3 px-1 text-left`,"aria-expanded":s,onClick:g,children:[_,b,C]}),t[19]=s,t[20]=g,t[21]=_,t[22]=b,t[23]=C,t[24]=T):T=t[24];let E=l||!h.availableCount,D;t[25]!==d||t[26]!==h.checked||t[27]!==h.indeterminate||t[28]!==E||t[29]!==r?(D=(0,B.jsx)(X,{label:r,checked:h.checked,indeterminate:h.indeterminate,disabled:E,onChange:d}),t[25]=d,t[26]=h.checked,t[27]=h.indeterminate,t[28]=E,t[29]=r,t[30]=D):D=t[30];let O;t[31]!==T||t[32]!==D?(O=(0,B.jsxs)(`div`,{className:`flex min-h-16 items-center gap-3 px-3 py-2 sm:px-4`,children:[T,D]}),t[31]=T,t[32]=D,t[33]=O):O=t[33];let k;t[34]!==p||t[35]!==s?(k=s&&(0,B.jsx)(`div`,{className:`space-y-2 border-t border-edge bg-surface-overlay p-3 sm:p-4`,children:p}),t[34]=p,t[35]=s,t[36]=k):k=t[36];let A;return t[37]!==O||t[38]!==k?(A=(0,B.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-inset`,children:[O,k]}),t[37]=O,t[38]=k,t[39]=A):A=t[39],A}function he(e){let t=(0,F.c)(34),{icon:n,title:r,items:i,inventoryId:a,selected:o,disabled:l,onToggle:d,onToggleAll:p}=e,m=s(u(_e)).imports,[h,g]=(0,N.useState)(!1),[_,v]=(0,N.useState)(``),[y,b]=(0,N.useState)(60);if(!i.length)return null;let x;t[0]!==i||t[1]!==o?(x=L(i,o),t[0]=i,t[1]=o,t[2]=x):x=t[2];let S=x,C=Y(i,_),T=C.slice(0,y),E;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(E=()=>g(ge),t[3]=E):E=t[3];let D;t[4]===n?D=t[5]:(D=(0,B.jsx)(n,{"aria-hidden":`true`,className:`h-5 w-5 shrink-0 text-fg-muted`}),t[4]=n,t[5]=D);let O;t[6]!==i.length||t[7]!==r?(O=(0,B.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-fg`,children:[r,` (`,i.length,`)`]}),t[6]=i.length,t[7]=r,t[8]=O):O=t[8];let k;t[9]!==S.availableCount||t[10]!==S.selectedCount?(k=(0,B.jsxs)(`span`,{className:`text-xs font-normal text-fg-muted`,children:[S.selectedCount,`/`,S.availableCount]}),t[9]=S.availableCount,t[10]=S.selectedCount,t[11]=k):k=t[11];let A=h&&`rotate-180`,j;t[12]===A?j=t[13]:(j=c(`h-4 w-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,A),t[12]=A,t[13]=j);let M;t[14]===j?M=t[15]:(M=(0,B.jsx)(w,{"aria-hidden":`true`,className:j}),t[14]=j,t[15]=M);let P;t[16]!==h||t[17]!==D||t[18]!==O||t[19]!==k||t[20]!==M?(P=(0,B.jsxs)(f,{variant:`ghost`,className:`min-w-0 flex-1 justify-start px-1 text-left`,"aria-expanded":h,onClick:E,children:[D,O,k,M]}),t[16]=h,t[17]=D,t[18]=O,t[19]=k,t[20]=M,t[21]=P):P=t[21];let I=l||!S.availableCount,R;t[22]!==p||t[23]!==S.checked||t[24]!==S.indeterminate||t[25]!==I||t[26]!==r?(R=(0,B.jsx)(X,{label:r,checked:S.checked,indeterminate:S.indeterminate,disabled:I,onChange:p}),t[22]=p,t[23]=S.checked,t[24]=S.indeterminate,t[25]=I,t[26]=r,t[27]=R):R=t[27];let z;t[28]!==P||t[29]!==R?(z=(0,B.jsxs)(`div`,{className:`flex min-h-14 items-center gap-2 px-3 py-2`,children:[P,R]}),t[28]=P,t[29]=R,t[30]=z):z=t[30];let V=h&&(0,B.jsxs)(`div`,{className:`space-y-2 border-t border-edge p-2`,children:[i.length>8&&(0,B.jsx)(J,{value:_,label:m.searchWithin.replace(`{group}`,r),onChange:e=>{v(e),b(60)}}),(0,B.jsx)(`div`,{className:`space-y-1`,children:T.map(e=>(0,B.jsx)(Z,{inventoryId:a,item:e,checked:o.has(e.id),disabled:l,onChange:t=>d(e,t)},e.id))}),!C.length&&(0,B.jsx)(`p`,{className:`p-3 text-sm text-fg-muted`,children:m.noMatches}),T.length<C.length&&(0,B.jsx)(f,{variant:`ghost`,className:`w-full`,onClick:()=>b(K),children:m.showMore.replace(`{count}`,String(C.length-T.length))})]}),H;return t[31]!==z||t[32]!==V?(H=(0,B.jsxs)(`div`,{className:`rounded-xl border border-edge`,children:[z,V]}),t[31]=z,t[32]=V,t[33]=H):H=t[33],H}function K(e){return e+60}function ge(e){return!e}function _e(e){return e.language}function ve(e){let t=(0,F.c)(15),{inventoryId:n,projects:r,projectChildren:i,selected:a,disabled:o,onToggle:c}=e,l=s(u(ye)).imports,[d,p]=(0,N.useState)(``),[m,h]=(0,N.useState)(60),g;t[0]===i?g=t[1]:(g=e=>i.get(e.id)??[],t[0]=i,t[1]=g);let _=Y(r,d,g),v=_.slice(0,m),y=r.length>8&&(0,B.jsx)(J,{value:d,label:l.searchWithin.replace(`{group}`,l.kinds.project),onChange:e=>{p(e),h(60)}}),b;t[2]!==o||t[3]!==n||t[4]!==c||t[5]!==i||t[6]!==a?(b=e=>(0,B.jsx)(be,{inventoryId:n,project:e,children:i.get(e.id)??[],selected:a,disabled:o,onToggle:c},e.id),t[2]=o,t[3]=n,t[4]=c,t[5]=i,t[6]=a,t[7]=b):b=t[7];let x=v.map(b),S;t[8]===x?S=t[9]:(S=(0,B.jsx)(`div`,{className:`space-y-2`,children:x}),t[8]=x,t[9]=S);let C=!_.length&&(0,B.jsx)(`p`,{className:`p-3 text-sm text-fg-muted`,children:l.noMatches}),w=v.length<_.length&&(0,B.jsx)(f,{variant:`ghost`,className:`w-full`,onClick:()=>h(q),children:l.showMore.replace(`{count}`,String(_.length-v.length))}),T;return t[10]!==y||t[11]!==S||t[12]!==C||t[13]!==w?(T=(0,B.jsxs)(`div`,{className:`space-y-2`,children:[y,S,C,w]}),t[10]=y,t[11]=S,t[12]=C,t[13]=w,t[14]=T):T=t[14],T}function q(e){return e+60}function ye(e){return e.language}function be(e){let t=(0,F.c)(52),{inventoryId:n,project:r,children:i,selected:a,disabled:o,onToggle:l}=e,d=s(u(we)).imports,[p,m]=(0,N.useState)(!1),h;if(t[0]!==i||t[1]!==a){let e;t[3]===a?e=t[4]:(e=e=>a.has(e.id),t[3]=a,t[4]=e),h=i.filter(e),t[0]=i,t[1]=a,t[2]=h}else h=t[2];let g=h.length,_=f,v;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(v=()=>m(Ce),t[5]=v):v=t[5];let y;t[6]===r.name?y=t[7]:(y=(0,B.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:r.name}),t[6]=r.name,t[7]=y);let b;t[8]===r.displayPath?b=t[9]:(b=(0,B.jsx)(`span`,{className:`mt-0.5 block truncate text-xs font-normal text-fg-muted`,children:r.displayPath}),t[8]=r.displayPath,t[9]=b);let x;t[10]!==y||t[11]!==b?(x=(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[y,b]}),t[10]=y,t[11]=b,t[12]=x):x=t[12];let S=i.length>0&&(0,B.jsxs)(`span`,{className:`text-xs font-normal text-fg-muted`,children:[d.projectContents.replace(`{skills}`,String(i.filter(Se).length)).replace(`{context}`,String(i.filter(xe).length)),` · `,d.chosenCount.replace(`{count}`,String(g))]}),C=p&&`rotate-180`,T;t[13]===C?T=t[14]:(T=c(`h-4 w-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,C),t[13]=C,t[14]=T);let E;t[15]===T?E=t[16]:(E=(0,B.jsx)(w,{"aria-hidden":`true`,className:T}),t[15]=T,t[16]=E);let D;t[17]!==_||t[18]!==p||t[19]!==S||t[20]!==E||t[21]!==v||t[22]!==x?(D=(0,B.jsxs)(_,{variant:`ghost`,className:`min-w-0 flex-1 justify-start px-2 text-left`,"aria-expanded":p,onClick:v,children:[x,S,E]}),t[17]=_,t[18]=p,t[19]=S,t[20]=E,t[21]=v,t[22]=x,t[23]=D):D=t[23];let O=r.name,k;t[24]!==r.id||t[25]!==a?(k=a.has(r.id),t[24]=r.id,t[25]=a,t[26]=k):k=t[26];let A;t[27]!==o||t[28]!==r?(A=o||!I(r),t[27]=o,t[28]=r,t[29]=A):A=t[29];let j;t[30]!==l||t[31]!==r?(j=e=>l(r,e.target.checked),t[30]=l,t[31]=r,t[32]=j):j=t[32];let M;t[33]!==r.name||t[34]!==k||t[35]!==A||t[36]!==j?(M=(0,B.jsx)(`input`,{type:`checkbox`,"aria-label":O,checked:k,disabled:A,onChange:j}),t[33]=r.name,t[34]=k,t[35]=A,t[36]=j,t[37]=M):M=t[37];let P;t[38]!==D||t[39]!==M?(P=(0,B.jsxs)(`div`,{className:`flex items-center gap-2 p-2`,children:[D,M]}),t[38]=D,t[39]=M,t[40]=P):P=t[40];let L;t[41]!==i||t[42]!==o||t[43]!==n||t[44]!==l||t[45]!==p||t[46]!==a||t[47]!==d?(L=p&&(0,B.jsx)(`div`,{className:`border-t border-edge p-2`,children:i.length?(0,B.jsx)(`div`,{className:`space-y-1`,children:i.map(e=>(0,B.jsx)(Z,{inventoryId:n,item:e,checked:a.has(e.id),disabled:o,onChange:t=>l(e,t)},e.id))}):(0,B.jsx)(`p`,{className:`p-2 text-xs text-fg-muted`,children:d.directoryOnly})}),t[41]=i,t[42]=o,t[43]=n,t[44]=l,t[45]=p,t[46]=a,t[47]=d,t[48]=L):L=t[48];let R;return t[49]!==P||t[50]!==L?(R=(0,B.jsxs)(`div`,{className:`rounded-xl border border-edge`,children:[P,L]}),t[49]=P,t[50]=L,t[51]=R):R=t[51],R}function xe(e){return e.kind===`context`}function Se(e){return e.kind===`skill`}function Ce(e){return!e}function we(e){return e.language}function J(e){let t=(0,F.c)(13),{value:n,label:r,onChange:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,B.jsx)(S,{"aria-hidden":`true`,className:`h-4 w-4 shrink-0 text-fg-muted`}),t[0]=a):a=t[0];let o;t[1]===r?o=t[2]:(o=(0,B.jsx)(`span`,{className:`sr-only`,children:r}),t[1]=r,t[2]=o);let s=`${r}…`,c;t[3]===i?c=t[4]:(c=e=>i(e.target.value),t[3]=i,t[4]=c);let l;t[5]!==r||t[6]!==s||t[7]!==c||t[8]!==n?(l=(0,B.jsx)(`input`,{type:`search`,autoComplete:`off`,value:n,placeholder:s,"aria-label":r,onChange:c,className:`min-w-0 flex-1 border-0 bg-transparent px-0 py-2 text-sm text-fg placeholder:text-fg-subtle`}),t[5]=r,t[6]=s,t[7]=c,t[8]=n,t[9]=l):l=t[9];let u;return t[10]!==o||t[11]!==l?(u=(0,B.jsxs)(`label`,{className:`flex items-center gap-2 rounded-lg border border-edge bg-surface-panel px-3 focus-within:border-accent focus-within:ring-1 focus-within:ring-accent`,children:[a,o,l]}),t[10]=o,t[11]=l,t[12]=u):u=t[12],u}function Y(e,t,n=()=>[]){let r=t.trim().toLocaleLowerCase();if(!r)return e;let i=e=>`${e.name} ${e.description} ${e.displayPath}`.toLocaleLowerCase().includes(r);return e.filter(e=>i(e)||n(e).some(i))}function X(e){let t=(0,F.c)(10),{label:n,checked:r,indeterminate:i,disabled:a,onChange:o}=e,s=(0,N.useRef)(null),c,l;t[0]===i?(c=t[1],l=t[2]):(c=()=>{s.current&&(s.current.indeterminate=i)},l=[i],t[0]=i,t[1]=c,t[2]=l),(0,N.useEffect)(c,l);let u;t[3]===o?u=t[4]:(u=e=>o(e.target.checked),t[3]=o,t[4]=u);let d;return t[5]!==r||t[6]!==a||t[7]!==n||t[8]!==u?(d=(0,B.jsx)(`input`,{ref:s,type:`checkbox`,"aria-label":n,checked:r,disabled:a,onChange:u}),t[5]=r,t[6]=a,t[7]=n,t[8]=u,t[9]=d):d=t[9],d}function Z(e){let t=(0,F.c)(52),{inventoryId:n,item:r,checked:i,disabled:a,onChange:o}=e,c=u(Te),l;t[0]===c?l=t[1]:(l=s(c),t[0]=c,t[1]=l);let d=l.imports,[p,m]=(0,N.useState)(),[h,g]=(0,N.useState)(``),[_,v]=(0,N.useState)(!1),y;t[2]!==n||t[3]!==r.id||t[4]!==p?(y=async function(){if(v(Q),!p)try{m(await P(`/inventories/${n}/items/${r.id}/preview`))}catch(e){let t=e;g(t instanceof Error?t.message:String(t))}},t[2]=n,t[3]=r.id,t[4]=p,t[5]=y):y=t[5];let b=y,x;t[6]!==a||t[7]!==r?(x=a||!I(r),t[6]=a,t[7]=r,t[8]=x):x=t[8];let S;t[9]===o?S=t[10]:(S=e=>o(e.target.checked),t[9]=o,t[10]=S);let C;t[11]!==i||t[12]!==x||t[13]!==S?(C=(0,B.jsx)(`input`,{type:`checkbox`,className:`mt-0.5`,checked:i,disabled:x,onChange:S}),t[11]=i,t[12]=x,t[13]=S,t[14]=C):C=t[14];let w;t[15]===r.name?w=t[16]:(w=(0,B.jsx)(`span`,{className:`block break-words text-sm font-medium text-fg`,children:r.name}),t[15]=r.name,t[16]=w);let T;t[17]===r.displayPath?T=t[18]:(T=(0,B.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,title:r.displayPath,children:r.displayPath}),t[17]=r.displayPath,t[18]=T);let E;t[19]!==w||t[20]!==T?(E=(0,B.jsxs)(`span`,{className:`min-w-0`,children:[w,T]}),t[19]=w,t[20]=T,t[21]=E):E=t[21];let O;t[22]!==C||t[23]!==E?(O=(0,B.jsxs)(`label`,{className:`flex min-w-0 flex-1 cursor-pointer items-start gap-3 py-1`,children:[C,E]}),t[22]=C,t[23]=E,t[24]=O):O=t[24];let k;t[25]!==r.name||t[26]!==r.status||t[27]!==d||t[28]!==b?(k=r.status!==`blocked`&&(0,B.jsx)(f,{variant:`ghost`,"aria-label":`${d.preview}: ${r.name}`,className:`h-9 shrink-0 px-2`,onClick:()=>void b(),children:d.preview}),t[25]=r.name,t[26]=r.status,t[27]=d,t[28]=b,t[29]=k):k=t[29];let A;t[30]!==O||t[31]!==k?(A=(0,B.jsxs)(`div`,{className:`flex items-start gap-2`,children:[O,k]}),t[30]=O,t[31]=k,t[32]=A):A=t[32];let j;t[33]===r.description?j=t[34]:(j=r.description&&(0,B.jsx)(`p`,{className:`pl-7 text-xs text-fg-muted`,children:r.description}),t[33]=r.description,t[34]=j);let M;t[35]!==r.status||t[36]!==r.targetName||t[37]!==d?(M=r.status!==`ready`&&(0,B.jsxs)(`p`,{className:`pl-7 text-xs text-fg-muted`,children:[d.statuses[r.status],r.status===`conflict`?` → ${r.targetName}`:``]}),t[35]=r.status,t[36]=r.targetName,t[37]=d,t[38]=M):M=t[38];let L;t[39]===r.reason?L=t[40]:(L=r.reason&&(0,B.jsx)(`p`,{className:`break-words pl-7 text-xs text-fg-muted`,children:r.reason}),t[39]=r.reason,t[40]=L);let R;t[41]!==p||t[42]!==h||t[43]!==_||t[44]!==d?(R=_&&(0,B.jsx)(`div`,{className:`ml-7 mt-2 rounded-lg border border-edge bg-surface-inset p-3`,children:h?(0,B.jsx)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:h}):p?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`pre`,{className:`max-h-60 overflow-auto whitespace-pre-wrap break-words text-xs text-fg`,children:p.text}),p.truncated&&(0,B.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:d.previewTruncated})]}):(0,B.jsx)(D,{sections:1})}),t[41]=p,t[42]=h,t[43]=_,t[44]=d,t[45]=R):R=t[45];let z;return t[46]!==A||t[47]!==j||t[48]!==M||t[49]!==L||t[50]!==R?(z=(0,B.jsxs)(`div`,{className:`min-w-0 rounded-lg px-2 py-1.5 hover:bg-surface-hover/60`,children:[A,j,M,L,R]}),t[46]=A,t[47]=j,t[48]=M,t[49]=L,t[50]=R,t[51]=z):z=t[51],z}function Q(e){return!e}function Te(e){return e.language}function $(){let e=s(u(e=>e.language)).imports,[t,n]=(0,N.useState)(),[r,c]=(0,N.useState)(),[l,d]=(0,N.useState)(!1),[p,m]=(0,N.useState)(),[h,g]=(0,N.useState)(new Set),[_,v]=(0,N.useState)(!1),[y,b]=(0,N.useState)(),[x,S]=(0,N.useState)(),[C,w]=(0,N.useState)(``),[T,E]=(0,N.useState)(``),[O,k]=(0,N.useState)(0),A=(0,N.useRef)(null),F=(0,N.useRef)(!1);(0,N.useEffect)(()=>{let e=new AbortController;return w(``),P(`/sources`,void 0,e.signal).then(e=>n(e.sources)).catch(t=>{e.signal.aborted||w(t instanceof Error?t.message:String(t))}),()=>{e.abort(),A.current?.abort()}},[O]);let I=(t?.flatMap(e=>e.lastImport?.status===`running`?[e.lastImport.id]:[])??[]).join(`,`);(0,N.useEffect)(()=>{if(!I)return;let e=new AbortController,t,n=async()=>{for(let t of I.split(`,`))try{let n=await P(`/runs/${t}`,void 0,e.signal);e.signal.aborted||L(n)}catch{}e.signal.aborted||(t=setTimeout(()=>void n(),3e3))};return t=setTimeout(()=>void n(),1500),()=>{e.abort(),clearTimeout(t)}},[I]);function L(e){n(t=>t?.map(t=>t.id===e.source?{...t,lastImport:e}:t)),e.status!==`running`&&b(t=>t?.requestId===e.id?void 0:t)}async function R(e){A.current?.abort();let t=new AbortController;A.current=t,c(e),d(!0),m(void 0),g(new Set),E(``),S(void 0),b(void 0);try{let n=await P(`/sources/${e}/scan`,{},t.signal);t.signal.aborted||(m(n),g(new Set(n.candidates.filter(e=>!e.parentId&&e.suggested).map(e=>e.id))))}catch(e){t.signal.aborted||E(e instanceof Error?e.message:String(e))}}async function z(){if(!p||!h.size||F.current)return;F.current=!0,v(!0),E(``),w(``);let e=y??{inventoryId:p.id,candidateIds:[...h],requestId:crypto.randomUUID(),retryOf:x};b(e);try{L(await P(`/runs`,e)),d(!1)}catch(e){let t=e instanceof Error?e.message:String(e);E(t),w(t);let n=e.body?.code;n&&[`invalid_input`,`inventory_stale`,`invalid_selection`,`missing_parent`,`not_found`,`conflict`].includes(n)&&b(void 0)}finally{F.current=!1,v(!1)}}async function H(e){c(e.source),d(!0),m(void 0),g(new Set),E(``),b(void 0),S(e.id),A.current?.abort();let t=new AbortController;A.current=t;try{let n=await P(`/inventories/${e.inventoryId}`,void 0,t.signal);if(t.signal.aborted)return;let r=new Set(e.items.filter(e=>e.status===`failed`).map(e=>e.candidateId));n.candidates.forEach(e=>{r.has(e.id)&&e.parentId&&r.add(e.parentId)}),m({...n,candidates:n.candidates.filter(e=>r.has(e.id))}),g(r)}catch(e){t.signal.aborted||E(e instanceof Error?e.message:String(e))}}let ee=t?.filter(e=>e.detected||e.lastImport);return(0,B.jsxs)(M,{children:[(0,B.jsx)(j,{title:e.title,subtitle:e.subtitle}),C&&(0,B.jsxs)(`div`,{role:`alert`,className:`rounded-xl bg-danger-soft p-4 text-sm text-danger`,children:[(0,B.jsx)(`p`,{children:C}),!t&&(0,B.jsx)(f,{variant:`ghost`,onClick:()=>k(e=>e+1),children:e.retry})]}),!t&&!C&&(0,B.jsx)(D,{sections:1}),t&&(0,B.jsxs)(`section`,{className:`space-y-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h2`,{className:`text-base font-medium text-fg`,children:e.apps}),(0,B.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.detectedHint})]}),ee?.length?(0,B.jsx)(`div`,{className:`flex flex-col gap-1 overflow-hidden rounded-xl bg-surface-hover/20 p-1 [&>*]:rounded-lg [&>*]:bg-surface-base/45`,children:ee.map(t=>(0,B.jsxs)(`article`,{className:`space-y-3 p-5 sm:p-6`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,B.jsx)(`div`,{"aria-hidden":`true`,className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-xl bg-surface-hover text-fg`,children:(0,B.jsx)(o,{className:`h-5 w-5`})}),(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(`h3`,{className:`font-medium text-fg`,children:t.name}),(0,B.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.includes})]}),(0,B.jsx)(f,{variant:`secondary`,disabled:_||!t.detected||!!y&&r!==t.id||t.lastImport?.status===`running`,onClick:()=>{w(``),y&&r===t.id?d(!0):R(t.id)},children:_&&r===t.id?e.importing:y&&r===t.id?e.retry:t.lastImport?e.importAgain:e.import})]}),t.lastImport&&(0,B.jsxs)(`div`,{role:`status`,className:`space-y-2 text-sm text-fg-muted`,children:[(0,B.jsxs)(`p`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(a,{className:`h-4 w-4 shrink-0`}),t.lastImport.status===`running`?e.importing:t.lastImport.issues.length?e.finishedWithIssues:e.finished]}),(0,B.jsxs)(`p`,{children:[e.summary.replace(`{skills}`,String(t.lastImport.skills)).replace(`{context}`,String(t.lastImport.context)).replace(`{projects}`,String(t.lastImport.projects)),t.lastImport.skipped>0&&` · ${e.skipped.replace(`{count}`,String(t.lastImport.skipped))}`]}),!!t.lastImport.issues.length&&(0,B.jsxs)(`details`,{children:[(0,B.jsxs)(`summary`,{className:`cursor-pointer text-fg`,children:[e.details,` (`,t.lastImport.issues.length,`)`]}),(0,B.jsx)(`ul`,{className:`mt-2 space-y-2`,children:t.lastImport.issues.map((e,t)=>(0,B.jsxs)(`li`,{className:`break-words`,children:[(0,B.jsx)(`span`,{className:`font-medium`,children:e.name}),` — `,e.reason]},t))})]}),t.lastImport.status===`partial`&&(0,B.jsx)(f,{variant:`ghost`,disabled:_||!!y,onClick:()=>void H(t.lastImport),children:e.retryFailed})]})]},t.id))}):(0,B.jsxs)(`div`,{className:`rounded-xl bg-surface-hover/20 p-6 text-sm text-fg-muted`,children:[(0,B.jsx)(`p`,{children:e.empty}),(0,B.jsx)(f,{variant:`ghost`,className:`mt-3`,onClick:()=>k(e=>e+1),children:e.refresh})]}),(0,B.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:e.footnote}),ee?.some(e=>e.lastImport)&&(0,B.jsxs)(`div`,{className:`flex gap-4 text-sm`,children:[(0,B.jsx)(i,{className:`text-accent`,to:`/capabilities/skills`,children:e.openSkills}),(0,B.jsx)(i,{className:`text-accent`,to:`/projects`,children:e.openProjects}),(0,B.jsx)(i,{className:`text-accent`,to:`/capabilities/connectors`,children:e.connections})]})]}),(0,B.jsx)(V,{open:l,sourceName:t?.find(e=>e.id===r)?.name??``,inventory:p,selected:h,onSelected:g,busy:_,locked:_||!!y,error:T,onClose:()=>{A.current?.abort(),d(!1)},onRefresh:()=>{r&&R(r)},onSubmit:()=>void z()})]})}export{$ as ImportsPage};
|