@xopcai/xopc 0.0.196 → 0.0.197
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-B1oxPli_.js → agent-avatar-dicebear-C5st7lt5.js} +1 -1
- package/dist/gateway/static/root/assets/agents-Baxfj44y.js +68 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-vmuJ_Z6i.js → app-management-settings-panel-S8LhoD6G.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-BMlEoe-G.js → appearance-settings-D8Cd5vDP.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-0uCxKyE5.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-BdE4Mati.js → archive-plugin-qL07mwnY.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-CTzaQcLV.js → attachment-load-CqSobpdi.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-XyDat125.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-B25zTNxl.js → binary-plugins-DBRPyLYE.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-Cdrf2awF.js → block-editor-6wG1LU7t.js} +46 -46
- package/dist/gateway/static/root/assets/{browser-settings-page-BMTmGMM6.js → browser-settings-page-CrYNMR4w.js} +4 -4
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-BsmHy0ks.js → browser-workflow-inputs-Abil4puY.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-Wx9FrbK-.js → browser-workflows-page-BEu3E0et.js} +1 -1
- package/dist/gateway/static/root/assets/capabilities-settings-panel-CvMcDhGf.js +7 -0
- package/dist/gateway/static/root/assets/{capability-presets-settings-panel-9T2KXAs1.js → capability-presets-settings-panel-CHJDY-Ih.js} +2 -2
- package/dist/gateway/static/root/assets/{channels-settings-DquD4BPQ.js → channels-settings-Ds9BJbcY.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-api-BC-4ftOM.js → connectors-api-CgWjgPSI.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-NUs-Zf7F.js +2 -0
- package/dist/gateway/static/root/assets/{cron-expression-BycQlU8Q.js → cron-expression-ZdDBAoqA.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-BvYqHRz0.js → dependency-picker-BGeB1jpn.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-BOb8sEhN.js → desktop-pet-CsLR4pWB.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-DStgPb82.js → desktop-pet-settings-CCjT1bdo.js} +1 -1
- package/dist/gateway/static/root/assets/directory-picker-path-field-C-Te1QN3.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-p83TmZFd.js → extension-debug-page-CD73euAM.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DMQ3ovxA.js → extension-page-DAKjpNwd.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-BcSKEU8s.js → extension-settings-page-BLSNdlgd.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-C-MmtCc7.js → gateway-config-api-CQrf0k3D.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-CuaRDWbg.js → gateway-settings-CvgH8IJI.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-Dm8TrfGa.js → heartbeat-settings-SPpnqbjl.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-BFoD6047.js +3 -0
- package/dist/gateway/static/root/assets/index-84ys9u-K.js +152 -0
- package/dist/gateway/static/root/assets/index-D-srnucP.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BQb06_jl.js → keyboard-shortcuts-settings-HMhxgOuD.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-D5uL2_Fd.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-DQtsxjGs.js → local-apps-page-DIWkFa3g.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-CDqIY72S.js → logs-page--6v8qq6y.js} +2 -2
- package/dist/gateway/static/root/assets/{management-settings-D7itDEHl.js → management-settings-DtEuS-kR.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-Db-KrpOQ.js → markdown-split-DvVBewS4.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-CHN66qs0.js → media-plugins-YVj7NVzD.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-CJtKZM0P.js → notes-page-BDzuL2I9.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-IdjuNXvH.js +4 -0
- package/dist/gateway/static/root/assets/{page-tabs-HXweXqYE.js → page-tabs-7bSEWfSX.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-Dob6Oe2l.js → preview-open-alternatives-tgLbHgcV.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page--RnCc9bb.js → product-open-page-Bwx_CQht.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-DnJXSuM4.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-DckZKlBI.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-CfbUHBUH.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-Bg1W2__k.js → runtime-tools-settings-panel-Fe05Nus6.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-BI4rVt3u.js → schema-form-CFfyC4CB.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-BCfCh4My.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-Cbi4FvzO.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-C7rzhi7x.js → settings-form-section-gEnEYT_3.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-BS36Mjzz.js → settings-loading-skeleton-BRE_-7Da.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-BDSd7F9Y.js → settings-page-C1zxCpqB.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-CTMmZcwj.js → settings-page-layout-CRpXF_05.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BcHdpmFf.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-BeCxg6eb.js → share-preview-page-DU8L68A5.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-CXL1EldF.js → shares-settings-kjTqH9yY.js} +1 -1
- package/dist/gateway/static/root/assets/skill-reload-api-QAGpwzIM.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-CyfjEM4D.js → skills-page-lE1-YRdK.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-CnbJncdL.js → skills-page.utils-CYwFWTso.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-CAv0Yk0Y.js → system-settings-panel-CVDsiPKn.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-DsM13-cy.js +1 -0
- package/dist/gateway/static/root/assets/{typed-models-lib-DomX3Szl.js → typed-models-lib-DelyYgoc.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-BLc4gfG0.js → use-autosave-C50Mq5yQ.js} +1 -1
- package/dist/gateway/static/root/assets/{user-context-page-C2kQENTK.js → user-context-page-D-VEOt2A.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-BijmpPjb.js → voice-api-key-field-DYfgTe3Y.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-D7w2JFFq.js → work-discovery-overlay-DPbujsp3.js} +1 -1
- package/dist/gateway/static/root/assets/work-discovery-page-D77opady.js +1 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BEmugHfL.js → workflow-run-setup-panel-DqIb1oBB.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-B9-PLmlX.js +5 -0
- package/dist/gateway/static/root/index.html +2 -2
- package/dist/package.js +1 -1
- package/dist/src/agent/embedded/execution-context.d.ts +2 -0
- package/dist/src/agent/embedded/execution-context.js +11 -0
- package/dist/src/agent/embedded/index.d.ts +3 -1
- package/dist/src/agent/embedded/index.js +5 -3
- package/dist/src/agent/embedded/run-turn.js +15 -9
- package/dist/src/agent/embedded/session-runner.d.ts +6 -11
- package/dist/src/agent/embedded/session-runner.js +25 -36
- package/dist/src/agent/embedded/transcript-runtime.d.ts +35 -0
- package/dist/src/agent/embedded/transcript-runtime.js +66 -0
- package/dist/src/agent/embedded/types.d.ts +3 -1
- package/dist/src/agent/service.d.ts +15 -0
- package/dist/src/agent/service.js +30 -0
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/hono/routes/home.d.ts +1 -1
- package/dist/src/gateway/hono/routes/home.js +2 -2
- package/dist/src/gateway/hono/routes/index.js +2 -0
- package/dist/src/gateway/hono/routes/projects.js +12 -1
- package/dist/src/gateway/hono/routes/side-chats.d.ts +3 -0
- package/dist/src/gateway/hono/routes/side-chats.js +173 -0
- package/dist/src/gateway/service/agent-runner.d.ts +4 -0
- package/dist/src/gateway/service/agent-runner.js +15 -1
- package/dist/src/gateway/service/run-gateway-agent.js +1 -1
- package/dist/src/gateway/service.d.ts +4 -0
- package/dist/src/gateway/service.js +33 -7
- package/dist/src/gateway/side-chat/context-snapshot.d.ts +11 -0
- package/dist/src/gateway/side-chat/context-snapshot.js +108 -0
- package/dist/src/gateway/side-chat/index.d.ts +5 -0
- package/dist/src/gateway/side-chat/index.js +4 -0
- package/dist/src/gateway/side-chat/manager.d.ts +45 -0
- package/dist/src/gateway/side-chat/manager.js +198 -0
- package/dist/src/gateway/side-chat/run-service.d.ts +22 -0
- package/dist/src/gateway/side-chat/run-service.js +110 -0
- package/dist/src/gateway/side-chat/types.d.ts +61 -0
- package/dist/src/gateway/side-chat/types.js +1 -0
- package/dist/src/routing/session-key-utils.d.ts +0 -1
- package/dist/src/routing/session-key-utils.js +1 -6
- package/dist/src/routing/session-key.js +2 -2
- package/dist/src/tasks/home-query-service.d.ts +24 -0
- package/dist/src/tasks/home-query-service.js +284 -5
- package/dist/src/tasks/index.js +3 -3
- package/dist/src/tasks/project-operating-view-service.d.ts +2 -1
- package/dist/src/tasks/project-operating-view-service.js +27 -4
- package/package.json +2 -2
- package/dist/gateway/static/root/assets/agents-VoFNMGL3.js +0 -68
- package/dist/gateway/static/root/assets/apps-page-CsNB6mv_.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-CW1YWgiX.js +0 -6
- package/dist/gateway/static/root/assets/capabilities-settings-panel-C5l85__e.js +0 -7
- package/dist/gateway/static/root/assets/connectors-page-7zUxVHQg.js +0 -2
- package/dist/gateway/static/root/assets/directory-picker-path-field-DUUr9sq0.js +0 -1
- package/dist/gateway/static/root/assets/home-page-BYhDbUvI.js +0 -3
- package/dist/gateway/static/root/assets/index-BzPwnXho.js +0 -150
- package/dist/gateway/static/root/assets/index-CFFYvilx.css +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-CHk4x0kR.js +0 -2
- package/dist/gateway/static/root/assets/notes-workbench-epHGeKd5.js +0 -4
- package/dist/gateway/static/root/assets/project-detail-page-BxOD5-zj.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-D-9AhrH5.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CSUNXLKM.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-BxOUBMca.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-DAvTIbgw.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-D1v-2Ci-.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-BxwkKgVw.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-DGTVJs_N.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-page-XtoPgPUS.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-D_K2xOWq.js +0 -5
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,l as a}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as o}from"./check-DUBLcKHA.js";import{t as s}from"./cn-JdwAhgNB.js";import{n as c}from"./copy-to-clipboard-HOJ79TWv.js";import{t as l}from"./messages-DQ5X6cXp.js";import{l as u,n as d,r as f,s as p}from"./locale-store-Bjvw7jtg.js";import{$r as m,Bo as h,Cc as g,Cs as _,Ds as v,Fo as y,Hl as b,Ho as x,Io as S,Kc as C,Ll as w,Lo as T,Ml as E,Ms as D,Os as O,Pc as k,Ql as A,Qo as j,Qr as M,Ro as N,Sc as P,Tc as F,Ua as I,Vo as ee,Vs as L,Xo as R,Xs as z,Zl as B,Zo as V,_i as H,ac as U,bi as te,bo as ne,cc as re,cu as ie,dc as ae,ei as oe,fc as se,hc as ce,hs as le,is as ue,lc as de,pu as fe,qs as pe,ri as me,rs as he,sl as ge,ti as _e,uu as ve,vi as ye,vs as be,ws as W,xi as xe,xo as Se,yi as Ce,zi as we,zo as G}from"./index-BzPwnXho.js";import{t as Te}from"./page-tabs-HXweXqYE.js";import{A as K,C as q,D as J,E as Ee,F as Y,M as De,N as Oe,O as ke,P as Ae,S as je,T as Me,_ as Ne,a as Pe,b as Fe,c as Ie,d as Le,f as Re,g as ze,h as Be,i as Ve,j as He,k as Ue,l as We,m as Ge,n as Ke,o as qe,p as Je,r as Ye,s as Xe,t as Ze,u as Qe,v as $e,w as et,x as tt,y as nt}from"./connectors-api-BC-4ftOM.js";var X=e(t(),1),Z=n(),Q=r();function rt(e){let t=(0,Z.c)(74),{connector:n,installed:r,onInstall:i,onOpenDetails:a,t:o}=e,c,l,u,d,f,p,m,h,g,_;if(t[0]!==n||t[1]!==r||t[2]!==i||t[3]!==a||t[4]!==o.connect||t[5]!==o.connectedBadge||t[6]!==o.connectorBeta||t[7]!==o.connectorCapabilityLabels||t[8]!==o.connectorExperimental||t[9]!==o.connectorVerified){let e=n.capabilities.filter(it),v=e.slice(0,3),y=Math.max(0,e.length-v.length),b=o.connect,x=n.verificationLevel===`verified`?o.connectorVerified:n.verificationLevel===`beta`?o.connectorBeta:n.verificationLevel===`experimental`?o.connectorExperimental:null,S;t[20]!==b||t[21]!==n||t[22]!==i?(S=e=>(0,Q.jsxs)(W,{type:`button`,variant:`primary`,className:s(`h-8 justify-center px-2.5 text-xs font-medium`,e),onClick:e=>{e.stopPropagation(),i(n)},children:[(0,Q.jsx)(k,{className:`size-4`}),b]}),t[20]=b,t[21]=n,t[22]=i,t[23]=S):S=t[23],c=S;let C;t[24]!==n||t[25]!==a?(C=e=>{!a||e.currentTarget!==e.target||e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),a(n))},t[24]=n,t[25]=a,t[26]=C):C=t[26];let w=C,T=a?`cursor-pointer`:null;t[27]===T?p=t[28]:(p=s(`group flex min-h-[9.5rem] flex-col rounded-lg bg-surface-panel p-4 shadow-surface transition-colors hover:bg-surface-hover/45 focus-within:ring-2 focus-within:ring-accent/30`,T),t[27]=T,t[28]=p),m=a?`button`:void 0,h=a?0:void 0,t[29]!==n||t[30]!==a?(g=()=>a?.(n),t[29]=n,t[30]=a,t[31]=g):g=t[31],_=w,l=`flex min-w-0 flex-1 flex-col`;let E;t[32]===n?E=t[33]:(E=(0,Q.jsx)(Y,{connector:n}),t[32]=n,t[33]=E);let D;t[34]===n.displayName?D=t[35]:(D=(0,Q.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:n.displayName}),t[34]=n.displayName,t[35]=D);let O;t[36]===x?O=t[37]:(O=x?(0,Q.jsx)(`span`,{className:`mt-1 inline-flex rounded-full border border-edge px-1.5 py-0.5 text-[10px] font-medium text-fg-subtle`,children:x}):null,t[36]=x,t[37]=O);let A;t[38]!==D||t[39]!==O?(A=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[D,O]}),t[38]=D,t[39]=O,t[40]=A):A=t[40];let j;t[41]!==E||t[42]!==A?(j=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[E,A]}),t[41]=E,t[42]=A,t[43]=j):j=t[43];let M;t[44]!==r||t[45]!==c?(M=r?null:(0,Q.jsx)(`div`,{className:`hidden shrink-0 items-center gap-1 transition-opacity sm:pointer-events-none sm:flex sm:opacity-0 sm:group-hover:pointer-events-auto sm:group-hover:opacity-100 sm:group-focus-within:pointer-events-auto sm:group-focus-within:opacity-100`,children:c()}),t[44]=r,t[45]=c,t[46]=M):M=t[46];let N;t[47]!==r||t[48]!==o.connectedBadge?(N=r?(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-emerald-500/30 bg-emerald-500/10 px-2 py-0.5 text-[11px] font-medium text-emerald-700 dark:text-emerald-300`,children:[(0,Q.jsx)(ie,{className:`size-3`,"aria-hidden":!0}),o.connectedBadge]}):null,t[47]=r,t[48]=o.connectedBadge,t[49]=N):N=t[49];let P;t[50]!==M||t[51]!==N?(P=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start gap-2`,children:[M,N]}),t[50]=M,t[51]=N,t[52]=P):P=t[52],t[53]!==j||t[54]!==P?(u=(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[j,P]}),t[53]=j,t[54]=P,t[55]=u):u=t[55],t[56]===n.description?d=t[57]:(d=(0,Q.jsx)(`p`,{className:`mt-4 line-clamp-2 text-sm leading-6 text-fg-muted`,title:n.description,children:n.description}),t[56]=n.description,t[57]=d),f=v.length>0?(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-1.5`,children:[v.map(e=>(0,Q.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-0.5 text-[11px] text-fg-muted`,children:o.connectorCapabilityLabels[e]??e},e)),y>0?(0,Q.jsxs)(`span`,{className:`rounded-md bg-surface-base px-2 py-0.5 text-[11px] text-fg-subtle`,children:[`+`,y]}):null]}):null,t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o.connect,t[5]=o.connectedBadge,t[6]=o.connectorBeta,t[7]=o.connectorCapabilityLabels,t[8]=o.connectorExperimental,t[9]=o.connectorVerified,t[10]=c,t[11]=l,t[12]=u,t[13]=d,t[14]=f,t[15]=p,t[16]=m,t[17]=h,t[18]=g,t[19]=_}else c=t[10],l=t[11],u=t[12],d=t[13],f=t[14],p=t[15],m=t[16],h=t[17],g=t[18],_=t[19];let v;t[58]!==l||t[59]!==u||t[60]!==d||t[61]!==f?(v=(0,Q.jsxs)(`div`,{className:l,children:[u,d,f]}),t[58]=l,t[59]=u,t[60]=d,t[61]=f,t[62]=v):v=t[62];let y;t[63]!==r||t[64]!==c?(y=r?null:(0,Q.jsx)(`div`,{className:`mt-4 flex flex-col gap-2 border-t border-edge pt-3 sm:hidden`,children:c(`w-full`)}),t[63]=r,t[64]=c,t[65]=y):y=t[65];let b;return t[66]!==v||t[67]!==y||t[68]!==p||t[69]!==m||t[70]!==h||t[71]!==g||t[72]!==_?(b=(0,Q.jsxs)(`div`,{className:p,role:m,tabIndex:h,onClick:g,onKeyDown:_,children:[v,y]}),t[66]=v,t[67]=y,t[68]=p,t[69]=m,t[70]=h,t[71]=g,t[72]=_,t[73]=b):b=t[73],b}function it(e){return!e.startsWith(`runtime.`)&&!e.startsWith(`auth.`)}var at=[`c0`,`c1`,`c2`,`c3`,`c4`,`c5`];function ot(e,t){return t.some(t=>t.connectorId===e.id)}var st=`animate-pulse motion-reduce:animate-none rounded-md bg-surface-hover dark:bg-surface-active/50`;function ct(){let e=(0,Z.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(`div`,{className:s(`size-10 shrink-0 rounded-xl`,st)}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(`div`,{className:`flex h-full min-h-[9.5rem] flex-col rounded-xl bg-surface-panel p-4 shadow-surface`,"aria-hidden":!0,children:(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 items-start gap-3`,children:[t,(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,Q.jsx)(`div`,{className:s(`h-4 min-w-0 flex-1`,st)}),(0,Q.jsx)(`div`,{className:s(`h-8 w-[4.5rem] shrink-0 rounded-lg`,st)})]}),(0,Q.jsx)(`div`,{className:s(`h-3 w-full`,st)}),(0,Q.jsx)(`div`,{className:s(`h-3 w-[88%]`,st)})]})]})}),e[1]=n):n=e[1],n}var lt=`animate-pulse motion-reduce:animate-none rounded-md bg-surface-hover dark:bg-surface-active/50`;function ut(){let e=(0,Z.c)(4),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(`div`,{className:s(`size-10 shrink-0 rounded-xl`,lt)}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[(0,Q.jsx)(`div`,{className:s(`h-4 w-48 max-w-full`,lt)}),(0,Q.jsx)(`div`,{className:s(`h-3 w-72 max-w-full`,lt)})]}),e[1]=n):n=e[1];let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[t,(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-start justify-between gap-3`,children:[n,(0,Q.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[(0,Q.jsx)(`div`,{className:s(`h-9 w-20 rounded-lg`,lt)}),(0,Q.jsx)(`div`,{className:s(`h-9 w-20 rounded-lg`,lt)})]})]})]}),e[2]=r):r=e[2];let i;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsxs)(`div`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,"aria-hidden":!0,children:[r,(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,Q.jsx)(`div`,{className:s(`h-8 w-20 rounded-md`,lt)}),(0,Q.jsx)(`div`,{className:s(`h-8 w-24 rounded-md`,lt)}),(0,Q.jsx)(`div`,{className:s(`h-8 w-28 rounded-md`,lt)})]}),(0,Q.jsx)(`div`,{className:s(`mt-3 h-20 rounded-xl`,lt)})]}),e[3]=i):i=e[3],i}function dt(e,t){return Object.entries(t).reduce((e,[t,n])=>e.replaceAll(`{{${t}}}`,String(n)),e)}function ft(e,t){return t.connectorCapabilityLabels[e]??e}function pt(e,t){if(e.runtime.type===`mcp`)return dt(t.connectorRuntimeMcp,{serverId:e.runtime.serverId});let n=e.runtime.type===`composio`?e.runtime.toolkit:e.runtime.type===`channel`?e.runtime.channelId:e.runtime.type===`nativeTool`?e.runtime.toolsetId:e.runtime.sourceKind;return dt(t.connectorRuntimeGeneric,{runtime:e.runtime.type,id:n??e.runtime.type})}function mt(e,t){return e.auth.mode===`oauth`?t.connectorAuthOAuth:e.auth.mode===`apiKey`?t.connectorAuthApiKey:t.connectorAuthNone}function ht(e){return(e.setup.secrets??[]).filter(e=>e.required).length+(e.setup.config??[]).filter(e=>e.required).length}function gt(e){let t=(0,Z.c)(12),{title:n,items:r}=e;if(r.length===0)return null;let i;t[0]===n?i=t[1]:(i=(0,Q.jsx)(`div`,{className:`border-b border-edge px-3 py-2 text-xs font-semibold text-fg`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=r.slice(0,16).map(_t),t[2]=r,t[3]=a);let o;t[4]===r.length?o=t[5]:(o=r.length>16?(0,Q.jsxs)(`div`,{className:`px-3 py-2 text-xs text-fg-subtle`,children:[`+`,r.length-16]}):null,t[4]=r.length,t[5]=o);let s;t[6]!==a||t[7]!==o?(s=(0,Q.jsxs)(`div`,{className:`max-h-48 overflow-y-auto`,children:[a,o]}),t[6]=a,t[7]=o,t[8]=s):s=t[8];let c;return t[9]!==i||t[10]!==s?(c=(0,Q.jsxs)(`section`,{className:`rounded-lg border border-edge bg-surface-base`,children:[i,s]}),t[9]=i,t[10]=s,t[11]=c):c=t[11],c}function _t(e){return(0,Q.jsxs)(`div`,{className:`border-b border-edge-subtle px-3 py-2 last:border-b-0`,children:[(0,Q.jsx)(`div`,{className:`break-words font-mono text-xs font-medium text-fg`,children:e.title}),e.description?(0,Q.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description}):null]},e.id)}function vt({connector:e,installed:t,onClose:n,onInstall:r,t:i}){let[a,o]=(0,X.useState)(!1),[c,l]=(0,X.useState)(null),[u,d]=(0,X.useState)(null),f=ht(e),p=e.capabilities.slice(0,8),m=Math.max(0,e.capabilities.length-p.length),g=[...(e.setup.secrets??[]).map(e=>({key:`secret:${e.key}`,label:e.label,description:e.description,required:e.required,kind:i.connectorSetupSecret})),...(e.setup.config??[]).map(e=>({key:`config:${e.key}`,label:e.label,description:e.description,required:!!e.required,kind:i.connectorSetupConfig}))],_=async()=>{o(!0),d(null);try{l(await Fe(e))}catch(e){l(null),d(e instanceof Error?e.message:String(e))}finally{o(!1)}};return(0,Q.jsx)(y,{open:!0,onOpenChange:e=>{e||n()},children:(0,Q.jsxs)(h,{children:[(0,Q.jsx)(G,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,Q.jsxs)(T,{className:s(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex h-[min(100vh-2rem,44rem)] w-[min(100%-2rem,min(92vw,52rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,`rounded-2xl border border-edge bg-surface-panel shadow-float outline-none dark:border-edge`),children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-6 py-5`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Q.jsx)(Y,{connector:e,size:`lg`}),(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[t?(0,Q.jsx)(`div`,{className:`mb-2 flex flex-wrap items-center gap-2`,children:(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-emerald-500/30 bg-emerald-500/10 px-2 py-0.5 text-[11px] font-medium text-emerald-700 dark:text-emerald-300`,children:[(0,Q.jsx)(ie,{className:`size-3`,"aria-hidden":!0}),i.connectedBadge]})}):null,(0,Q.jsx)(ee,{className:`text-base font-semibold text-fg`,children:e.displayName}),(0,Q.jsx)(N,{className:`mt-1 line-clamp-3 text-sm leading-6 text-fg-muted`,children:e.description})]})]}),(0,Q.jsx)(S,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:s(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,be.focusRingPanel),"aria-label":i.modalClose,children:[(0,Q.jsx)(v,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`sr-only`,children:i.modalClose})]})})]}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-5`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,Q.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[(0,Q.jsx)(O,{className:`size-3.5`,"aria-hidden":!0}),i.detailTools]}),(0,Q.jsx)(`p`,{className:`mt-2 text-sm font-semibold text-fg`,children:c?dt(i.connectorPreviewToolsCount,{count:c.toolCount}):i.connectorPreviewUnknown})]}),(0,Q.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[(0,Q.jsx)(ge,{className:`size-3.5`,"aria-hidden":!0}),i.detailPermissions]}),(0,Q.jsx)(`p`,{className:`mt-2 text-sm font-semibold text-fg`,children:mt(e,i)})]}),(0,Q.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[(0,Q.jsx)(b,{className:`size-3.5`,"aria-hidden":!0}),i.connectorRequiredInputs]}),(0,Q.jsx)(`p`,{className:`mt-2 text-sm font-semibold text-fg`,children:dt(i.connectorRequiredInputsCount,{count:f})})]})]}),(0,Q.jsxs)(`div`,{className:`mt-5 grid gap-5 lg:grid-cols-[minmax(0,1fr)_18rem]`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 space-y-5`,children:[(0,Q.jsxs)(`section`,{children:[(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i.connectorCapabilitiesTitle}),(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,children:[p.map(e=>(0,Q.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-base px-2 py-1 text-xs text-fg-muted`,children:ft(e,i)},e)),m>0?(0,Q.jsxs)(`span`,{className:`rounded-md border border-edge bg-surface-base px-2 py-1 text-xs text-fg-subtle`,children:[`+`,m]}):null]})]}),u?(0,Q.jsx)(`p`,{className:`rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:u}):null,c?(0,Q.jsxs)(`section`,{children:[(0,Q.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i.connectorPreviewTitle}),(0,Q.jsx)(`span`,{className:s(`rounded-full px-2 py-0.5 text-xs font-medium`,c.ok?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-amber-500/10 text-amber-700 dark:text-amber-300`),children:c.ok?i.healthStatusHealthy:i.healthStatusLabels[c.status]??c.status})]}),(0,Q.jsxs)(`div`,{className:`mb-3 grid gap-2 text-xs sm:grid-cols-3`,children:[(0,Q.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base px-3 py-2`,children:[(0,Q.jsx)(`div`,{className:`font-semibold text-fg`,children:c.toolCount}),(0,Q.jsx)(`div`,{className:`text-fg-muted`,children:i.toolsMetric})]}),(0,Q.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base px-3 py-2`,children:[(0,Q.jsx)(`div`,{className:`font-semibold text-fg`,children:c.resourceCount}),(0,Q.jsx)(`div`,{className:`text-fg-muted`,children:i.resourcesMetric})]}),(0,Q.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base px-3 py-2`,children:[(0,Q.jsx)(`div`,{className:`font-semibold text-fg`,children:c.promptCount}),(0,Q.jsx)(`div`,{className:`text-fg-muted`,children:i.promptsMetric})]})]}),(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(gt,{title:i.detailTools,items:c.tools.map(e=>({id:e.name,title:e.shortName??e.name,description:e.description}))}),(0,Q.jsx)(gt,{title:i.detailResources,items:c.resources.map(e=>({id:e.uri,title:e.title??e.name??e.uri,description:e.description??e.uri}))}),(0,Q.jsx)(gt,{title:i.detailPrompts,items:c.prompts.map(e=>({id:e.name,title:e.title??e.name,description:e.description??dt(i.promptArgumentCount,{count:e.argumentCount})}))})]}),c.error?(0,Q.jsx)(`p`,{className:`mt-3 text-xs leading-5 text-fg-subtle`,children:c.error}):null,c.action?(0,Q.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-subtle`,children:c.action}):null]}):null]}),(0,Q.jsxs)(`aside`,{className:`space-y-3`,children:[(0,Q.jsxs)(`section`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,Q.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,Q.jsx)(ge,{className:`size-4 text-accent`,"aria-hidden":!0}),i.detailPermissions]}),(0,Q.jsx)(`p`,{className:`mt-2 text-sm font-medium text-fg`,children:mt(e,i)})]}),(0,Q.jsxs)(`section`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,Q.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,Q.jsx)(b,{className:`size-4 text-accent`,"aria-hidden":!0}),i.connectorSetupTitle]}),g.length>0?(0,Q.jsx)(`div`,{className:`mt-3 divide-y divide-edge overflow-hidden rounded-lg border border-edge`,children:g.map(e=>(0,Q.jsxs)(`div`,{className:`bg-surface-panel px-3 py-2.5`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.label}),(0,Q.jsx)(`span`,{className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[11px] text-fg-muted`,children:e.kind}),e.required?(0,Q.jsx)(`span`,{className:`rounded-md bg-amber-500/10 px-1.5 py-0.5 text-[11px] font-medium text-amber-700 dark:text-amber-300`,children:i.connectorSetupRequired}):null]}),e.description?(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:e.description}):null]},e.key))}):(0,Q.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:i.connectorSetupNone})]}),(0,Q.jsxs)(`section`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,Q.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,Q.jsx)(de,{className:`size-4 text-accent`,"aria-hidden":!0}),i.connectorRuntimeTitle]}),(0,Q.jsx)(`p`,{className:`mt-2 break-words text-xs leading-5 text-fg-muted`,children:pt(e,i)})]})]})]})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-2 border-t border-edge-subtle px-6 py-4`,children:[(0,Q.jsx)(S,{asChild:!0,children:(0,Q.jsx)(W,{variant:`secondary`,children:i.modalClose})}),(0,Q.jsxs)(W,{variant:`secondary`,disabled:a,onClick:()=>void _(),children:[a?(0,Q.jsx)(C,{className:`size-4 animate-spin`}):(0,Q.jsx)(O,{className:`size-4`}),i.connectorPreviewButton]}),t?(0,Q.jsxs)(W,{variant:`secondary`,disabled:!0,children:[(0,Q.jsx)(F,{className:`size-4`}),i.connectedBadge]}):(0,Q.jsxs)(W,{variant:`primary`,onClick:()=>{r(e),n()},children:[(0,Q.jsx)(k,{className:`size-4`}),i.connect]})]})]})]})})}var yt=s(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,_);function bt(e){let t=(0,Z.c)(58),{open:n,sessionIdleTtlMinutes:r,saving:i,onChange:a,onSave:o,onClose:c,t:l,mcp:u}=e,d;t[0]===c?d=t[1]:(d=e=>{e||c()},t[0]=c,t[1]=d);let f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(G,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),t[2]=f):f=t[2];let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=s(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex h-[min(32rem,calc(100vh-2rem))] w-[min(100%-2rem,38rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,`rounded-2xl border border-edge bg-surface-panel shadow-float dark:border-edge`),t[3]=p):p=t[3];let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(`span`,{className:`flex size-10 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,Q.jsx)(g,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),t[4]=m):m=t[4];let _;t[5]===l.runtimeSettingsTitle?_=t[6]:(_=(0,Q.jsx)(ee,{className:`text-base font-semibold text-fg`,children:l.runtimeSettingsTitle}),t[5]=l.runtimeSettingsTitle,t[6]=_);let b;t[7]===l.runtimeSettingsHint?b=t[8]:(b=(0,Q.jsx)(N,{className:`mt-1 text-sm text-fg-muted`,children:l.runtimeSettingsHint}),t[7]=l.runtimeSettingsHint,t[8]=b);let x;t[9]!==_||t[10]!==b?(x=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[m,(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[_,b]})]}),t[9]=_,t[10]=b,t[11]=x):x=t[11];let w;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(w=s(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,be.focusRingPanel),t[12]=w):w=t[12];let E;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsx)(v,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),t[13]=E):E=t[13];let D;t[14]===l.modalClose?D=t[15]:(D=(0,Q.jsx)(S,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:w,"aria-label":l.modalClose,children:E})}),t[14]=l.modalClose,t[15]=D);let O;t[16]!==D||t[17]!==x?(O=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-6 py-5`,children:[x,D]}),t[16]=D,t[17]=x,t[18]=O):O=t[18];let k;t[19]===u.idleTtlLabel?k=t[20]:(k=(0,Q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:u.idleTtlLabel}),t[19]=u.idleTtlLabel,t[20]=k);let A;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(A=s(yt,`w-40 flex-none`),t[21]=A):A=t[21];let j=r??``,M;t[22]===a?M=t[23]:(M=e=>{let t=e.currentTarget.value.trim();a(t===``?void 0:Number.parseInt(t,10))},t[22]=a,t[23]=M);let P;t[24]!==u.idleTtlPlaceholder||t[25]!==j||t[26]!==M?(P=(0,Q.jsx)(`input`,{type:`number`,min:0,className:A,value:j,placeholder:u.idleTtlPlaceholder,onChange:M}),t[24]=u.idleTtlPlaceholder,t[25]=j,t[26]=M,t[27]=P):P=t[27];let F;t[28]===u.idleTtlHint?F=t[29]:(F=(0,Q.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:u.idleTtlHint}),t[28]=u.idleTtlHint,t[29]=F);let I;t[30]!==k||t[31]!==P||t[32]!==F?(I=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-5`,children:(0,Q.jsxs)(`label`,{className:`flex max-w-xl flex-col gap-1.5`,children:[k,P,F]})}),t[30]=k,t[31]=P,t[32]=F,t[33]=I):I=t[33];let L;t[34]!==c||t[35]!==i||t[36]!==l.modalCancel?(L=(0,Q.jsx)(W,{type:`button`,variant:`secondary`,disabled:i,onClick:c,children:l.modalCancel}),t[34]=c,t[35]=i,t[36]=l.modalCancel,t[37]=L):L=t[37];let R;t[38]===o?R=t[39]:(R=()=>void o(),t[38]=o,t[39]=R);let z;t[40]===i?z=t[41]:(z=i?(0,Q.jsx)(C,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,t[40]=i,t[41]=z);let B;t[42]!==u.save||t[43]!==i||t[44]!==R||t[45]!==z?(B=(0,Q.jsxs)(W,{type:`button`,variant:`primary`,disabled:i,onClick:R,children:[z,u.save]}),t[42]=u.save,t[43]=i,t[44]=R,t[45]=z,t[46]=B):B=t[46];let V;t[47]!==L||t[48]!==B?(V=(0,Q.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle px-6 py-4`,children:[L,B]}),t[47]=L,t[48]=B,t[49]=V):V=t[49];let H;t[50]!==O||t[51]!==I||t[52]!==V?(H=(0,Q.jsxs)(h,{children:[f,(0,Q.jsxs)(T,{className:p,children:[O,I,V]})]}),t[50]=O,t[51]=I,t[52]=V,t[53]=H):H=t[53];let U;return t[54]!==n||t[55]!==d||t[56]!==H?(U=(0,Q.jsx)(y,{open:n,onOpenChange:d,children:H}),t[54]=n,t[55]=d,t[56]=H,t[57]=U):U=t[57],U}var xt=(0,X.memo)(function(e){let t=(0,Z.c)(12),{value:n,onChange:r,placeholder:i,className:a}=e,o;t[0]===a?o=t[1]:(o=s(`relative flex min-h-9 min-w-0 flex-1 cursor-text items-center rounded-pill border border-edge bg-surface-panel py-1.5 pl-9 pr-3 shadow-surface`,a),t[0]=a,t[1]=o);let c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(ae,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,strokeWidth:1.75,"aria-hidden":!0}),t[2]=c):c=t[2];let l;t[3]===r?l=t[4]:(l=e=>r(e.currentTarget.value),t[3]=r,t[4]=l);let u;t[5]!==i||t[6]!==l||t[7]!==n?(u=(0,Q.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:n,onChange:l,placeholder:i,autoComplete:`off`,spellCheck:!1,className:`min-w-0 flex-1 appearance-none border-0 bg-transparent py-0.5 text-sm leading-normal text-fg caret-current placeholder:text-fg-disabled focus:border-0 focus:shadow-none focus:outline-none focus:ring-0 focus-visible:outline-none`}),t[5]=i,t[6]=l,t[7]=n,t[8]=u):u=t[8];let d;return t[9]!==o||t[10]!==u?(d=(0,Q.jsxs)(`label`,{className:o,children:[c,u]}),t[9]=o,t[10]=u,t[11]=d):d=t[11],d}),St=(0,X.memo)(function(e){let t=(0,Z.c)(30),{onBrowseCatalog:n,onAddCustomServer:r,onOpenRuntimeSettings:i,addLabel:a,browseLabel:o,customLabel:c,settingsLabel:l}=e,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(re,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[0]=u):u=t[0];let d;t[1]===l?d=t[2]:(d=(0,Q.jsx)(`span`,{className:`hidden sm:inline`,children:l}),t[1]=l,t[2]=d);let f;t[3]!==i||t[4]!==l||t[5]!==d?(f=(0,Q.jsxs)(W,{type:`button`,variant:`secondary`,className:`shrink-0 gap-2`,"aria-label":l,title:l,onClick:i,children:[u,d]}),t[3]=i,t[4]=l,t[5]=d,t[6]=f):f=t[6];let p;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(P,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[7]=p):p=t[7];let h;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Q.jsx)(fe,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[8]=h):h=t[8];let g;t[9]===a?g=t[10]:(g=(0,Q.jsx)(me,{asChild:!0,children:(0,Q.jsxs)(W,{type:`button`,variant:`primary`,className:`shrink-0 gap-2`,children:[p,a,h]})}),t[9]=a,t[10]=g);let _;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(_=s(`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,be.transition),t[11]=_):_=t[11];let v;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(pe,{className:`size-4 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),t[12]=v):v=t[12];let y;t[13]!==o||t[14]!==n?(y=(0,Q.jsxs)(m,{className:_,onSelect:n,children:[v,o]}),t[13]=o,t[14]=n,t[15]=y):y=t[15];let b;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(b=s(`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,be.transition),t[16]=b):b=t[16];let x;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Q.jsx)(O,{className:`size-4 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),t[17]=x):x=t[17];let S;t[18]!==c||t[19]!==r?(S=(0,Q.jsxs)(m,{className:b,onSelect:r,children:[x,c]}),t[18]=c,t[19]=r,t[20]=S):S=t[20];let C;t[21]!==S||t[22]!==y?(C=(0,Q.jsx)(oe,{children:(0,Q.jsxs)(M,{className:`z-50 min-w-[14rem] rounded-xl border border-edge bg-surface-panel p-1 shadow-popover dark:border-edge`,sideOffset:6,align:`end`,children:[y,S]})}),t[21]=S,t[22]=y,t[23]=C):C=t[23];let w;t[24]!==C||t[25]!==g?(w=(0,Q.jsxs)(_e,{children:[g,C]}),t[24]=C,t[25]=g,t[26]=w):w=t[26];let T;return t[27]!==w||t[28]!==f?(T=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:[f,w]}),t[27]=w,t[28]=f,t[29]=T):T=t[29],T}),Ct=/^([^:=]+)[:=](.*)$/;function wt(e){let t=e.trim();if(!t)return null;try{let e=JSON.parse(t);if(e&&typeof e==`object`&&!Array.isArray(e))return Object.entries(e).map(([e,t])=>({key:e,value:t==null?``:String(t)}))}catch{}let n=[];for(let e of t.split(/\r?\n/)){let t=e.trim();if(!t)continue;let r=Ct.exec(t);r&&n.push({key:r[1].trim(),value:r[2].trim()})}return n.length>0?n:null}function Tt(e){let t={};for(let n of e){let e=n.key.trim();e&&(t[e]=n.value)}return Object.keys(t).length>0?t:void 0}function Et(e){if(!e||typeof e!=`object`)return[{key:``,value:``}];let t=Object.entries(e).map(([e,t])=>({key:e,value:t==null?``:String(t)}));return t.length>0?t:[{key:``,value:``}]}function Dt(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e.xopcConnector;return!!(t&&typeof t==`object`&&!Array.isArray(t)&&t.managed===!0)}function Ot(e){let t=e&&typeof e==`object`&&`mcp`in e?e.mcp:void 0,n=(t&&typeof t==`object`?t:{}).servers,r={};if(!n||typeof n!=`object`||Array.isArray(n))return r;for(let[e,t]of Object.entries(n))!t||typeof t!=`object`||Array.isArray(t)||Dt(t)&&(r[e]=t);return r}function kt(e){let t=e.trim();if(t)return t.split(/\s+/).filter(Boolean)}function At(e){let t=e.trim();if(!t)return;let n=JSON.parse(t);if(!n||typeof n!=`object`||Array.isArray(n))throw Error(`Expected a JSON object`);return n}function jt(e){if(e.transport===`stdio`){let t={command:e.command.trim()},n=kt(e.argsText);return n?.length&&(t.args=n),e.cwd.trim()&&(t.cwd=e.cwd.trim()),e.envJson.trim()&&(t.env=At(e.envJson)),e.connectionTimeoutMs!=null&&Number.isFinite(e.connectionTimeoutMs)&&(t.connectionTimeoutMs=e.connectionTimeoutMs),e.requestTimeoutMs!=null&&Number.isFinite(e.requestTimeoutMs)&&(t.requestTimeoutMs=e.requestTimeoutMs),t}let t={url:e.url.trim(),transport:e.transport},n=Tt(e.headers);return n&&(t.headers=n),e.connectionTimeoutMs!=null&&Number.isFinite(e.connectionTimeoutMs)&&(t.connectionTimeoutMs=e.connectionTimeoutMs),e.requestTimeoutMs!=null&&Number.isFinite(e.requestTimeoutMs)&&(t.requestTimeoutMs=e.requestTimeoutMs),t}function Mt(e,t){let n=typeof t.url==`string`&&t.url.trim().length>0,r=typeof t.transport==`string`?t.transport.trim().toLowerCase():``,i=n?r===`sse`?`sse`:`streamable-http`:`stdio`,a=t.headers&&typeof t.headers==`object`&&!Array.isArray(t.headers)?t.headers:void 0;return{clientKey:e,id:e,transport:i,command:typeof t.command==`string`?t.command:``,argsText:Array.isArray(t.args)?t.args.map(String).join(` `):``,envJson:t.env&&typeof t.env==`object`?JSON.stringify(t.env,null,2):``,cwd:typeof t.cwd==`string`?t.cwd:typeof t.workingDirectory==`string`?t.workingDirectory:``,url:typeof t.url==`string`?t.url:``,headers:Et(a),connectionTimeoutMs:typeof t.connectionTimeoutMs==`number`&&Number.isFinite(t.connectionTimeoutMs)?t.connectionTimeoutMs:void 0,requestTimeoutMs:typeof t.requestTimeoutMs==`number`&&Number.isFinite(t.requestTimeoutMs)?t.requestTimeoutMs:void 0}}function Nt(e=``){return{clientKey:crypto.randomUUID(),id:e,transport:`stdio`,command:``,argsText:``,envJson:``,cwd:``,url:``,headers:[{key:`Authorization`,value:``}],connectionTimeoutMs:void 0,requestTimeoutMs:void 0}}function Pt(e){let t=e&&typeof e==`object`&&`mcp`in e?e.mcp:void 0,n=t&&typeof t==`object`?t:{},r=n.servers,i=r&&typeof r==`object`&&!Array.isArray(r)?Object.entries(r).flatMap(([e,t])=>!t||typeof t!=`object`||Array.isArray(t)||Dt(t)?[]:[Mt(e,t)]).sort((e,t)=>e.id.localeCompare(t.id)):[],a=typeof n.sessionIdleTtlMs==`number`?n.sessionIdleTtlMs:void 0;return{sessionIdleTtlMinutes:a==null?void 0:a===0?0:Math.round(a/6e4),servers:i}}function Ft(e){return jt(e)}async function It(e,t={}){let n={};for(let r of e.servers){let e=r.id.trim();if(e){if(t[e])throw Error(`Server id "${e}" is reserved by an installed connector.`);n[e]=jt(r)}}let r={servers:{...t,...n}};e.sessionIdleTtlMinutes!=null&&Number.isFinite(e.sessionIdleTtlMinutes)&&(r.sessionIdleTtlMs=e.sessionIdleTtlMinutes===0?0:Math.round(e.sessionIdleTtlMinutes*6e4)),await p(f(`/api/config`),{method:`PATCH`,body:JSON.stringify({mcp:r})}),ne()}function Lt(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(typeof n==`string`){let e=n.trim();e&&t.push({name:e});continue}if(!n||typeof n!=`object`)continue;let e=n;if(typeof e.name!=`string`)continue;let r=e.name.trim();if(!r)continue;let i=typeof e.shortName==`string`&&e.shortName.trim()?e.shortName.trim():void 0,a=typeof e.description==`string`&&e.description.trim()?e.description.trim():void 0;t.push({name:r,shortName:i,description:a})}return t}function Rt(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(!n||typeof n!=`object`)continue;let e=n;if(typeof e.uri!=`string`||typeof e.name!=`string`)continue;let r=e.uri.trim(),i=e.name.trim();!r||!i||t.push({uri:r,name:i,title:typeof e.title==`string`&&e.title.trim()?e.title.trim():void 0,description:typeof e.description==`string`&&e.description.trim()?e.description.trim():void 0,mimeType:typeof e.mimeType==`string`&&e.mimeType.trim()?e.mimeType.trim():void 0})}return t}function zt(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(!n||typeof n!=`object`)continue;let e=n;if(typeof e.name!=`string`)continue;let r=e.name.trim();r&&t.push({name:r,title:typeof e.title==`string`&&e.title.trim()?e.title.trim():void 0,description:typeof e.description==`string`&&e.description.trim()?e.description.trim():void 0,argumentCount:typeof e.argumentCount==`number`?e.argumentCount:0})}return t}async function Bt(e,t){let n=await p(f(`/api/mcp/servers/${encodeURIComponent(e)}/test`),{method:`POST`,body:t?JSON.stringify({server:t}):void 0});if(!n.payload)throw Error(n.error??`MCP test failed`);let r=Lt(n.payload.tools),i=Rt(n.payload.resources),a=zt(n.payload.prompts);return{serverId:n.payload.serverId??e,toolCount:typeof n.payload.toolCount==`number`?n.payload.toolCount:r.length,resourceCount:typeof n.payload.resourceCount==`number`?n.payload.resourceCount:i.length,promptCount:typeof n.payload.promptCount==`number`?n.payload.promptCount:a.length,tools:r,resources:i,prompts:a}}function Vt(e){return e.connectionTimeoutMs==null||!Number.isFinite(e.connectionTimeoutMs)?``:String(Math.round(e.connectionTimeoutMs/1e3))}function Ht(e){let t=e.trim();if(!t)return;let n=Number.parseInt(t,10);if(!(!Number.isFinite(n)||n<1||n>600))return n*1e3}function Ut(e){return e.requestTimeoutMs==null||!Number.isFinite(e.requestTimeoutMs)?``:String(Math.round(e.requestTimeoutMs/1e3))}function Wt(e){let t=e.trim();if(!t)return;let n=Number.parseInt(t,10);if(!(!Number.isFinite(n)||n<1||n>14400))return n*1e3}function Gt(e){if(e.transport===`stdio`){let t=e.command.trim();if(!t)return``;let n=e.argsText.trim();return n?`${t} ${n}`:t}return e.url.trim()}function $(e,t){return Object.entries(t).reduce((e,[t,n])=>e.replaceAll(`{{${t}}}`,n),e)}function Kt({row:e,t,cs:n,onEdit:r,onRemove:i}){let[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)(!1),[l,u]=(0,X.useState)(null),[d,f]=(0,X.useState)(null),p=Gt(e),m=(0,X.useCallback)(async()=>{o(!0),f(null);try{let t=await Bt(e.id.trim());u({toolCount:t.toolCount,resourceCount:t.resourceCount,promptCount:t.promptCount})}catch(e){f(e instanceof Error?e.message:String(e))}finally{o(!1)}},[e.id]),h=(0,X.useCallback)(async()=>{c(!0),f(null);try{await i()}catch(e){f(e instanceof Error?e.message:String(e)),c(!1)}},[i]);return(0,Q.jsxs)(`div`,{className:`flex h-full min-h-[10.5rem] cursor-pointer flex-col rounded-lg bg-surface-panel p-4 shadow-surface transition-colors hover:bg-surface-hover/45`,onClick:r,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:e.id.trim()||t.cardUntitled}),(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-base px-2 py-0.5 text-[11px] text-fg-muted`,children:n.customBadge}),(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:t.transportLabels[e.transport]})]}),p?(0,Q.jsx)(`p`,{className:`mt-3 line-clamp-2 break-all font-mono text-xs leading-5 text-fg-subtle`,title:p,children:p}):null,d?(0,Q.jsx)(`p`,{className:`mt-3 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:d}):null,l?(0,Q.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,children:$(n.customCapabilitySummary,{tools:String(l.toolCount),resources:String(l.resourceCount),prompts:String(l.promptCount)})}):null]}),(0,Q.jsxs)(`div`,{className:`mt-4 flex items-center justify-between gap-2 border-t border-edge pt-3`,onClick:e=>e.stopPropagation(),children:[(0,Q.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:n.connectorDetails}),(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsxs)(W,{variant:`secondary`,disabled:a,onClick:()=>void m(),children:[a?(0,Q.jsx)(C,{className:`size-4 animate-spin`}):(0,Q.jsx)(F,{className:`size-4`}),t.testConnection]}),(0,Q.jsxs)(W,{variant:`ghost`,disabled:s,onClick:()=>void h(),children:[s?(0,Q.jsx)(C,{className:`size-4 animate-spin`}):(0,Q.jsx)(L,{className:`size-4`}),t.removeServer]})]})]})]})}function qt(e,t){return e?t&&e.startsWith(t)?e.slice(t.length):e:``}function Jt(e,t,n){let r=t.trim().toLowerCase();if(!r)return!0;let i=e.shortName||qt(e.name,n);return[e.name,i,e.description].filter(Boolean).join(`
|
|
2
|
-
`).toLowerCase().includes(r)}function Yt(e,t){return e?t&&e.startsWith(t)?e.slice(t.length):e:``}function Xt(e){let t=(0,Z.c)(29),{tools:n,stripPrefix:r,searchPlaceholder:i,searchEmptyLabel:a}=e,[o,c]=(0,X.useState)(``),l;if(t[0]!==o||t[1]!==r||t[2]!==n){let e;t[4]!==o||t[5]!==r?(e=e=>Jt(e,o,r),t[4]=o,t[5]=r,t[6]=e):e=t[6],l=n.filter(e),t[0]=o,t[1]=r,t[2]=n,t[3]=l}else l=t[3];let u=l,d;t[7]===o?d=t[8]:(d=o.trim(),t[7]=o,t[8]=d);let f=d.length>0,p;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(ae,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),t[9]=p):p=t[9];let m,h;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(m=s(`w-full rounded-lg border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg`,`placeholder:text-fg-subtle`,_),h=e=>c(e.target.value),t[10]=m,t[11]=h):(m=t[10],h=t[11]);let g;t[12]!==o||t[13]!==i?(g=(0,Q.jsxs)(`div`,{className:`relative`,children:[p,(0,Q.jsx)(`input`,{type:`search`,value:o,placeholder:i,"aria-label":i,className:m,onChange:h})]}),t[12]=o,t[13]=i,t[14]=g):g=t[14];let v;t[15]!==u.length||t[16]!==f||t[17]!==n.length?(v=f?(0,Q.jsxs)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:[u.length,` / `,n.length]}):null,t[15]=u.length,t[16]=f,t[17]=n.length,t[18]=v):v=t[18];let y;t[19]!==g||t[20]!==v?(y=(0,Q.jsxs)(`div`,{className:`border-b border-edge px-5 py-3`,children:[g,v]}),t[19]=g,t[20]=v,t[21]=y):y=t[21];let b;t[22]!==u||t[23]!==a||t[24]!==r?(b=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:u.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:a}):(0,Q.jsx)(`ul`,{className:`flex flex-col gap-2`,children:u.map((e,t)=>{let n=e.shortName||Yt(e.name,r)||e.name||`?`,i=e.name||`tool-${t}`;return(0,Q.jsxs)(`li`,{className:`min-w-0 rounded-lg border border-edge bg-surface-base px-3 py-2.5`,children:[(0,Q.jsx)(`div`,{className:`truncate font-mono text-sm font-medium text-fg`,title:e.name===n?n:e.name,children:n}),e.description?(0,Q.jsx)(`p`,{className:`mt-1 truncate text-xs leading-relaxed text-fg-muted`,title:e.description,children:e.description}):null]},i)})})}),t[22]=u,t[23]=a,t[24]=r,t[25]=b):b=t[25];let x;return t[26]!==y||t[27]!==b?(x=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[y,b]}),t[26]=y,t[27]=b,t[28]=x):x=t[28],x}function Zt(e){let t=(0,Z.c)(38),{open:n,onOpenChange:r,serverId:i,title:a,subtitle:o,searchPlaceholder:c,searchEmptyLabel:l,emptyLabel:u,closeLabel:d,tools:f,stripPrefix:p}=e,m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(G,{className:s(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,ue)}),t[0]=m):m=t[0];let g;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(g=s(`fixed left-1/2 top-1/2 flex max-h-[min(88vh,40rem)] w-[min(100%-2rem,min(92vw,36rem))] -translate-x-1/2 -translate-y-1/2 flex-col`,he,`rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none dark:border-edge`),t[1]=g):g=t[1];let _;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsx)(O,{className:`size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[2]=_):_=t[2];let b;t[3]===a?b=t[4]:(b=(0,Q.jsxs)(ee,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[_,a]}),t[3]=a,t[4]=b);let x;t[5]!==i||t[6]!==o||t[7]!==f.length?(x=o.replace(`{{serverId}}`,i).replace(`{{count}}`,String(f.length)),t[5]=i,t[6]=o,t[7]=f.length,t[8]=x):x=t[8];let C;t[9]===x?C=t[10]:(C=(0,Q.jsx)(N,{className:`mt-1 text-sm text-fg-muted`,children:x}),t[9]=x,t[10]=C);let w;t[11]!==b||t[12]!==C?(w=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[b,C]}),t[11]=b,t[12]=C,t[13]=w):w=t[13];let E;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsx)(v,{className:`size-4`,"aria-hidden":!0}),t[14]=E):E=t[14];let D;t[15]===d?D=t[16]:(D=(0,Q.jsx)(S,{asChild:!0,children:(0,Q.jsx)(W,{type:`button`,variant:`ghost`,className:`size-8 shrink-0 px-0`,"aria-label":d,children:E})}),t[15]=d,t[16]=D);let k;t[17]!==w||t[18]!==D?(k=(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[w,D]}),t[17]=w,t[18]=D,t[19]=k):k=t[19];let A;t[20]!==u||t[21]!==n||t[22]!==l||t[23]!==c||t[24]!==i||t[25]!==p||t[26]!==f?(A=f.length>0?(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,Q.jsx)(Xt,{tools:f,stripPrefix:p,searchPlaceholder:c,searchEmptyLabel:l},`${i}-${n?`open`:`closed`}`)}):(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:u})}),t[20]=u,t[21]=n,t[22]=l,t[23]=c,t[24]=i,t[25]=p,t[26]=f,t[27]=A):A=t[27];let j;t[28]===d?j=t[29]:(j=(0,Q.jsx)(`div`,{className:`flex justify-end border-t border-edge px-5 py-3`,children:(0,Q.jsx)(S,{asChild:!0,children:(0,Q.jsx)(W,{type:`button`,variant:`secondary`,children:d})})}),t[28]=d,t[29]=j);let M;t[30]!==k||t[31]!==A||t[32]!==j?(M=(0,Q.jsxs)(h,{children:[m,(0,Q.jsxs)(T,{className:g,children:[k,A,j]})]}),t[30]=k,t[31]=A,t[32]=j,t[33]=M):M=t[33];let P;return t[34]!==r||t[35]!==n||t[36]!==M?(P=(0,Q.jsx)(y,{open:n,onOpenChange:r,children:M}),t[34]=r,t[35]=n,t[36]=M,t[37]=P):P=t[37],P}function Qt(e){let t=e.connectedAt?Date.parse(e.connectedAt):0;return Number.isFinite(t)?t:0}function $t(e,t){return e.status===`active`&&t.status!==`active`?-1:e.status!==`active`&&t.status===`active`?1:e.isCurrentAuthorization===t.isCurrentAuthorization?e.isDefault===t.isDefault?Qt(t)-Qt(e):e.isDefault?-1:1:e.isCurrentAuthorization?-1:1}function en(e){let t=new Map;for(let n of e){let e=n.accountId??n.identityKey??`authorization:${n.id}`;t.set(e,[...t.get(e)??[],n])}return[...t.entries()].map(([e,t])=>{let n=[...t].sort($t);return{key:e,primary:n[0],authorizations:n}}).sort((e,t)=>$t(e.primary,t.primary))}var tn=s(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,_);function nn(e){return e.materialized.type===`composio`?e.materialized.toolkit:null}function rn(e,t){return e===`write`?t.composioScopeWrite:e===`admin`?t.composioScopeAdmin:t.composioScopeRead}function an(e,t){return e.errorCode===`missing_credential`?t.composioHealthMissingCredential:e.errorCode===`unauthorized`?t.composioHealthUnauthorized:e.errorCode===`forbidden`?t.composioHealthForbidden:e.errorCode===`network`?t.composioHealthNetwork:e.errorCode===`timeout`?t.composioHealthTimeout:t.composioHealthDegraded}function on(e,t){return e===`active`?t.composioConnectionHealthy:e===`pending`?t.composioConnectionPending:e===`expired`?t.composioConnectionExpired:e===`failed`?t.composioConnectionFailed:e===`revoked`||e===`disabled`?t.composioConnectionRevoked:t.composioConnectionUnknown}function sn(e,t,n){return e.status===`paused`?t?.scanEnabled===!1?n.connectorLearningPausedByPolicy:n.connectorLearningPausedByFailure:e.status===`queued`?n.connectorLearningQueued:e.status===`running`?n.connectorLearningRunning:e.status===`completed`?n.connectorLearningCompleted:n.connectorLearningFailed}function cn({instance:e,t,onChanged:n}){let r=nn(e),[i,a]=(0,X.useState)([]),[c,l]=(0,X.useState)([]),[u,d]=(0,X.useState)([]),[f,p]=(0,X.useState)([]),[m,h]=(0,X.useState)(null),[g,_]=(0,X.useState)([]),[y,b]=(0,X.useState)(null),[S,w]=(0,X.useState)([]),[T,E]=(0,X.useState)({}),[D,O]=(0,X.useState)(`read`),[k,A]=(0,X.useState)(!1),[M,N]=(0,X.useState)(null),P=(0,X.useMemo)(()=>en(i),[i]),F=(0,X.useCallback)(async()=>{if(!(!r||e.materialized.type!==`composio`||e.materialized.role===`credential`)){A(!0),N(null);try{let[t,n,i,o,s,c,u,f]=await Promise.all([Be().catch(()=>[]),ze(r).catch(()=>[]),Ne(20).catch(()=>[]),Qe(r).catch(()=>`read`),$e().catch(()=>[]),We(r).catch(()=>null),Ie(r).catch(()=>null),nt().catch(()=>[])]);a(t.filter(e=>e.toolkit.toLowerCase()===r.toLowerCase())),l(n),d(i.filter(e=>!e.toolkit||e.toolkit.toLowerCase()===r.toLowerCase())),O(o),p(s.filter(t=>t.connectorId===e.connectorId)),h(c?.policy??null),_(c?.agents??[]),b(u),w(f);let m=en(t.filter(e=>e.toolkit.toLowerCase()===r.toLowerCase())).map(e=>e.primary).filter(e=>!!e.accountId),g=await Promise.all(m.map(async e=>[e.accountId,await Re(e.accountId)]).map(e=>e.catch(()=>null)));E(Object.fromEntries(g.filter(e=>e!==null)))}catch(e){N(e instanceof Error?e.message:String(e))}finally{A(!1)}}},[e.connectorId,e.materialized,r]);(0,X.useEffect)(()=>{F()},[F]);let I=(0,X.useCallback)(async()=>{if(r){A(!0),N(null);try{let t=await J(e.connectorId);if(!t.authorizationUrl)throw Error(`The authorization provider did not return an authorization URL.`);if(x()){let e=await window.electronAPI?.shell?.openExternalUrl(t.authorizationUrl);if(!e?.ok)throw Error(e?.error??`Could not open the system browser.`)}else window.open(t.authorizationUrl,`_blank`,`noopener,noreferrer`);let i=await Ae(r,t.connectionId);if(!i.accountId)throw Error(`Connector account is unavailable.`);await Ee(i.accountId),await n?.(),await F()}catch(e){N(e instanceof Error?e.message:String(e))}finally{A(!1)}}},[e.connectorId,F,n,r]),ee=(0,X.useCallback)(async e=>{if(r){O(e);try{await Me(r,e),await F()}catch(e){N(e instanceof Error?e.message:String(e))}}},[F,r]),R=(0,X.useCallback)(async(e,t)=>{A(!0),N(null);try{await q(e,t),await F()}catch(e){N(e instanceof Error?e.message:String(e))}finally{A(!1)}},[F]),B=(0,X.useCallback)(async e=>{if(r){N(null);try{h(await He(r,e))}catch(e){N(e instanceof Error?e.message:String(e))}}},[e.connectorId,r]),H=(0,X.useCallback)(e=>{m&&B({allowedAgentIds:m.allowedAgentIds.includes(e)?m.allowedAgentIds.filter(t=>t!==e):[...m.allowedAgentIds,e]})},[B,m]),U=(0,X.useCallback)(async e=>{A(!0),N(null);try{await e(),await F()}catch(e){N(e instanceof Error?e.message:String(e))}finally{A(!1)}},[F]);return r?e.materialized.type===`composio`&&e.materialized.role===`credential`?(0,Q.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,children:t.composioApiKeyStored}):(0,Q.jsxs)(`div`,{className:`mt-4 rounded-xl border border-edge bg-surface-base p-3 text-sm`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`font-medium text-fg`,children:$(t.composioToolkitTitle,{toolkit:r})}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:t.composioScopeHint})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsxs)(W,{variant:`secondary`,disabled:k,onClick:()=>void I(),children:[k?(0,Q.jsx)(C,{className:`size-4 animate-spin`}):(0,Q.jsx)(ge,{className:`size-4`}),t.connectOAuth]}),(0,Q.jsx)(W,{variant:`ghost`,disabled:k,onClick:()=>void F(),children:t.refresh})]})]}),M?(0,Q.jsx)(`p`,{className:`mt-3 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:M}):null,y?(0,Q.jsxs)(`div`,{className:s(`mt-3 flex flex-wrap items-center justify-between gap-2 rounded-lg border px-3 py-2 text-xs`,y.status===`connected`?`border-emerald-500/30 bg-emerald-500/5 text-emerald-700`:`border-amber-500/30 bg-amber-500/5 text-amber-700`),children:[(0,Q.jsx)(`span`,{children:y.status===`connected`?$(t.composioHealthConnected,{count:String(P.filter(e=>e.primary.status===`active`).length)}):y.status===`reauthorization_required`?t.composioHealthReconnect:y.status===`degraded`?an(y,t):t.composioHealthDisconnected}),y.recovery===`none`?null:(0,Q.jsx)(W,{variant:`ghost`,disabled:k,onClick:()=>void(y.recovery===`retry`?F():I()),children:y.recovery===`retry`?t.composioRetry:t.connectOAuth}),y.status===`degraded`&&y.message?(0,Q.jsx)(`p`,{className:`basis-full break-words text-[11px] opacity-80`,children:y.message}):null]}):null,m?(0,Q.jsxs)(`div`,{className:`mt-4 grid gap-3 rounded-lg border border-edge bg-surface-panel p-3 md:grid-cols-3`,children:[(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-subtle`,children:[t.composioAccessTitle,(0,Q.jsxs)(V,{className:s(tn,`mt-1 h-9 py-1`),value:D,onChange:e=>void ee(e.currentTarget.value),children:[(0,Q.jsx)(j,{value:`read`,children:t.composioAccessReadOnly}),(0,Q.jsx)(j,{value:`write`,children:t.composioAccessReadWrite}),D===`admin`?(0,Q.jsx)(j,{value:`admin`,children:t.composioAccessAdminCurrent}):null]}),(0,Q.jsx)(`span`,{className:`mt-1 block font-normal leading-4 text-fg-muted`,children:D===`read`?t.composioAccessReadHint:D===`admin`?t.composioAccessAdminHint:t.composioAccessWriteHint})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-subtle`,children:[t.composioConfirmationPolicy,(0,Q.jsxs)(V,{className:s(tn,`mt-1 h-9 py-1`),value:m.confirmationPolicy,onChange:e=>void B({confirmationPolicy:e.currentTarget.value}),children:[(0,Q.jsx)(j,{value:`writes`,children:t.composioConfirmWrites}),(0,Q.jsx)(j,{value:`always`,children:t.composioConfirmAlways}),m.confirmationPolicy===`never`?(0,Q.jsx)(j,{value:`never`,children:t.composioConfirmNever}):null]})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium text-fg-subtle`,children:t.composioAllowedAgents}),(0,Q.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:m.allowedAgentIds.length?t.composioAllowedAgentsSelected:t.composioAllowedAgentsAll}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:g.map(e=>(0,Q.jsx)(`button`,{type:`button`,className:s(`rounded-full border px-2.5 py-1 text-xs transition-colors`,m.allowedAgentIds.includes(e.id)?`border-accent bg-accent/10 text-accent`:`border-edge text-fg-muted hover:text-fg`),onClick:()=>H(e.id),children:e.name},e.id))})]})]}):null,f.length?(0,Q.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:t.composioPendingApprovals}),f.map(e=>(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-lg border border-amber-500/30 bg-amber-500/5 p-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`p`,{className:`truncate font-mono text-xs font-medium text-fg`,children:e.actionId}),(0,Q.jsx)(`p`,{className:`mt-1 break-all font-mono text-xs text-fg-subtle`,children:JSON.stringify(e.argumentsPreview)}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:$(t.composioApprovalExpires,{time:new Date(e.expiresAt).toLocaleTimeString()})})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[(0,Q.jsxs)(W,{variant:`secondary`,disabled:k,onClick:()=>void R(e.id,`denied`),children:[(0,Q.jsx)(v,{className:`size-4`}),t.composioDeny]}),(0,Q.jsxs)(W,{disabled:k,onClick:()=>void R(e.id,`approved`),children:[(0,Q.jsx)(o,{className:`size-4`}),t.approve]})]})]},e.id))]}):null,(0,Q.jsx)(`div`,{className:`mt-4`,children:(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:t.composioConnections}),P.length?[{title:t.composioConnectedAccounts,items:P.filter(e=>e.primary.status===`active`)},{title:t.composioNeedsAttention,items:P.filter(e=>e.primary.status!==`active`)}].filter(e=>e.items.length>0).map(e=>(0,Q.jsxs)(`section`,{className:`mb-3 space-y-2`,children:[(0,Q.jsxs)(`h4`,{className:`text-xs font-medium text-fg-muted`,children:[e.title,` · `,e.items.length]}),e.items.map(e=>{let i=e.primary,a=S.find(e=>i.accountId?e.accountId===i.accountId:e.connectionId===i.id),o=i.accountId?T[i.accountId]:void 0;return(0,Q.jsxs)(`div`,{className:`space-y-3 rounded-xl border border-edge bg-surface-panel p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:i.alias??i.workspace??i.accountEmail??i.username??t.composioUnnamedAuthorization}),i.connectedAt?(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:$(t.composioAuthorizedAt,{time:new Date(i.connectedAt).toLocaleString()})}):null,(0,Q.jsxs)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:[$(t.composioAuthorizationCount,{count:String(e.authorizations.length)}),e.authorizations.length>1?` · ${$(t.composioDuplicateAuthorizations,{count:String(e.authorizations.length-1)})}`:``]})]}),(0,Q.jsxs)(`span`,{className:s(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,i.status===`active`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-amber-500/10 text-amber-700 dark:text-amber-300`),children:[on(i.status,t),i.isDefault?` · ${t.composioDefaultAccount}`:``]})]}),a||i.status===`active`?(0,Q.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:t.connectorLearningTitle}),(0,Q.jsx)(`p`,{className:s(`mt-1 text-xs`,a?.status===`failed`?`text-red-600`:`text-fg-subtle`),children:a?$(t.connectorLearningStatus,{status:sn(a,o,t),count:String(a.candidatesCreated)}):t.connectorLearningEmpty}),o?(0,Q.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-fg-subtle`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:o.scanEnabled,disabled:k,onChange:e=>void U(()=>Oe(i.accountId,{scanEnabled:e.currentTarget.checked}))}),t.connectorScheduledScan]}),(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-fg-subtle`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:o.proactiveEnabled,disabled:k||!o.scanEnabled,onChange:e=>void U(()=>Oe(i.accountId,{proactiveEnabled:e.currentTarget.checked}))}),t.connectorProactiveUse]}),o.scanEnabled?(0,Q.jsxs)(`label`,{className:`text-xs text-fg-subtle sm:col-span-2`,children:[t.connectorScanInterval,(0,Q.jsxs)(V,{className:s(tn,`mt-1 h-8 py-1 text-xs`),value:String(o.intervalMinutes??30),disabled:k,onChange:e=>void U(()=>Oe(i.accountId,{intervalMinutes:Number(e.currentTarget.value)})),children:[(0,Q.jsxs)(j,{value:`5`,children:[`5 `,t.connectorMinutes]}),(0,Q.jsxs)(j,{value:`15`,children:[`15 `,t.connectorMinutes]}),(0,Q.jsxs)(j,{value:`30`,children:[`30 `,t.connectorMinutes]}),(0,Q.jsxs)(j,{value:`60`,children:[`60 `,t.connectorMinutes]})]})]}):null]}):null]}):null,(0,Q.jsxs)(`details`,{className:`text-xs text-fg-subtle`,children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer`,children:t.composioAdvancedSettings}),(0,Q.jsxs)(`div`,{className:`mt-2 space-y-2 rounded-lg bg-surface-base p-2`,children:[e.authorizations.map(e=>(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsxs)(`p`,{className:`min-w-0 break-all font-mono`,children:[t.composioAuthorizationId,`: `,e.providerConnectionId]}),(0,Q.jsx)(W,{variant:`ghost`,className:`size-7 shrink-0 p-0`,title:t.composioRevoke,disabled:k,onClick:()=>{window.confirm(t.composioRevokeConfirm)&&U(()=>et(e.id))},children:(0,Q.jsx)(L,{className:`size-3.5 text-red-500`})})]},e.id)),(0,Q.jsx)(`input`,{className:s(tn,`h-8 py-1 text-xs`),defaultValue:i.alias??``,placeholder:t.composioAccountAlias,onBlur:e=>{e.currentTarget.value!==(i.alias??``)&&U(()=>K(i.id,{alias:e.currentTarget.value}))}})]})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-1`,children:[(0,Q.jsx)(W,{variant:`ghost`,className:`size-8 p-0`,title:t.composioMakeDefault,disabled:k||i.isDefault||i.status!==`active`,onClick:()=>void U(async()=>{await K(i.id,{isDefault:!0}),r&&await He(r,{selectedConnectionIds:[i.id]})}),children:(0,Q.jsx)(z,{className:s(`size-4`,i.isDefault&&`fill-current`)})}),(0,Q.jsx)(W,{variant:`ghost`,className:`size-8 p-0`,title:t.refresh,disabled:k,onClick:()=>void U(()=>tt(i.id)),children:(0,Q.jsx)(ce,{className:`size-4`})}),i.status===`active`?(0,Q.jsxs)(W,{variant:`secondary`,disabled:k,onClick:()=>void U(async()=>{if(!i.accountId)throw Error(`Connector account is unavailable.`);await Ee(i.accountId),await n?.()}),children:[k?(0,Q.jsx)(C,{className:`size-4 animate-spin`}):(0,Q.jsx)(ce,{className:`size-4`}),t.composioSyncNow]}):null]})]},e.key)})]},e.title)):(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.composioConnectionsEmpty})]})}),(0,Q.jsxs)(`details`,{className:`mt-4 rounded-lg border border-edge bg-surface-panel p-3`,children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer text-xs font-medium text-fg-muted`,children:t.composioAdvancedSettings}),(0,Q.jsxs)(`div`,{className:`mt-4 grid gap-4 lg:grid-cols-2`,children:[(0,Q.jsx)(`div`,{className:`space-y-3`,children:(0,Q.jsxs)(`label`,{className:`block text-xs text-fg-subtle`,children:[t.composioAdvancedScope,(0,Q.jsxs)(V,{className:s(tn,`mt-1 h-9 py-1`),value:D,onChange:e=>void ee(e.currentTarget.value),children:[(0,Q.jsx)(j,{value:`read`,children:t.composioScopeRead}),(0,Q.jsx)(j,{value:`write`,children:t.composioScopeWrite}),(0,Q.jsx)(j,{value:`admin`,children:t.composioScopeAdmin})]})]})}),(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:t.composioAgentTools}),c.length?c.slice(0,8).map(e=>(0,Q.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base p-2`,children:[(0,Q.jsx)(`p`,{className:`truncate font-mono text-xs text-fg`,children:e.slug}),(0,Q.jsxs)(`p`,{className:`text-xs text-fg-subtle`,children:[rn(e.scope,t),e.curated?``:` ${t.composioUncuratedSuffix}`]})]},e.slug)):(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.composioToolsEmpty})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:t.composioRecentTriggers}),u.length?u.slice(0,5).map(e=>(0,Q.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base p-2`,children:[(0,Q.jsx)(`p`,{className:`truncate text-xs text-fg`,children:e.trigger??e.id}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:new Date(e.at).toLocaleString()})]},`${e.id}-${e.at}`)):(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.composioTriggersEmpty})]})]})]})]})]}):null}var ln=s(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,_);function un(e,t){return e?t.healthStatusLabels[e]??e:t.healthNotTested}function dn(e,t){let n={};for(let r of e?.setup.config??[]){let e=t.config?.[r.key]??r.defaultValue??``;n[r.key]=typeof e==`string`?e:JSON.stringify(e,null,2)}return n}function fn(e,t){let n=t.trim();return e===`json`?n?JSON.parse(n):void 0:e===`number`?n?Number(n):void 0:e===`boolean`?n===`true`:n||void 0}function pn(e){let t=(0,Z.c)(12),{title:n,description:r,meta:i}=e,a;t[0]===r?a=t[1]:(a=r?(0,Q.jsx)(Ce,{delayDuration:300,skipDelayDuration:100,children:(0,Q.jsxs)(te,{children:[(0,Q.jsx)(xe,{asChild:!0,children:(0,Q.jsx)(`p`,{tabIndex:0,title:r,className:s(`mt-1 line-clamp-3 cursor-help text-xs leading-5 text-fg-muted`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`),children:r})}),(0,Q.jsx)(ye,{children:(0,Q.jsx)(H,{side:`top`,align:`start`,sideOffset:6,collisionPadding:12,className:`!z-[10000] max-h-[min(16rem,45vh)] max-w-[min(32rem,calc(100vw-2rem))] overflow-y-auto rounded-md border border-edge bg-surface-panel px-2.5 py-2 text-left text-xs leading-5 text-fg shadow-popover`,children:(0,Q.jsx)(`span`,{className:`whitespace-pre-wrap break-words`,children:r})})})]})}):null,t[0]=r,t[1]=a);let o=a,c;t[2]===n?c=t[3]:(c=(0,Q.jsx)(`p`,{className:`min-w-0 break-all font-mono text-xs font-medium leading-5 text-fg`,children:n}),t[2]=n,t[3]=c);let l;t[4]===i?l=t[5]:(l=i?(0,Q.jsx)(`span`,{className:`shrink-0 rounded-md bg-surface-hover px-1.5 py-0.5 text-[11px] leading-4 text-fg-subtle`,children:i}):null,t[4]=i,t[5]=l);let u;t[6]!==c||t[7]!==l?(u=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;return t[9]!==o||t[10]!==u?(d=(0,Q.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2.5`,children:[u,o]}),t[9]=o,t[10]=u,t[11]=d):d=t[11],d}function mn({instance:e,definition:t,onClose:n,onChanged:r,t:i,mcp:a}){let[o,c]=(0,X.useState)(!1),[l,u]=(0,X.useState)(!1),[d,f]=(0,X.useState)(!1),[p,m]=(0,X.useState)(!1),[g,_]=(0,X.useState)(null),[x,w]=(0,X.useState)(null),[D,k]=(0,X.useState)(e.materialized.type===`mcp`?`health`:`permissions`),[A,j]=(0,X.useState)(!1),[M,P]=(0,X.useState)(()=>dn(t,e)),[I,R]=(0,X.useState)(null),z=t?.setup.config??[],B=(e.materialized.type===`mcp`||e.materialized.type===`memorySource`)&&z.length>0&&(t?.setup.secrets??[]).length===0,V=x?x.toolCount:e.usage.lastToolCount,H=(0,X.useMemo)(()=>{let t=e.materialized.type===`mcp`?[[`health`,U,i.detailHealth],[`tools`,O,`${i.detailTools} ${x?x.toolCount:e.usage.lastToolCount??``}`],[`resources`,b,`${i.detailResources} ${x?x.resourceCount:e.usage.lastResourceCount??``}`],[`prompts`,E,`${i.detailPrompts} ${x?x.promptCount:e.usage.lastPromptCount??``}`],[`permissions`,ge,i.detailPermissions]]:[[`permissions`,ge,i.detailPermissions]];return B?[...t,[`config`,b,i.connectorConfigLabel]]:t},[x,e.materialized.type,e.usage.lastPromptCount,e.usage.lastResourceCount,e.usage.lastToolCount,B,i]),te=(0,X.useCallback)(async()=>{c(!0),R(null);try{let t=await Ue(e.instanceId);w(t),t.toolCount>0&&k(`tools`),r()}catch(e){R(e instanceof Error?e.message:String(e))}finally{c(!1)}},[e.instanceId,r]),ne=(0,X.useCallback)(async()=>{u(!0),R(null);try{await je(e.instanceId),await r(),n()}catch(e){R(e instanceof Error?e.message:String(e)),u(!1)}},[e.instanceId,r,n]),re=(0,X.useCallback)(async()=>{if(!(!t||!B)){f(!0),R(null);try{let n={};for(let e of t.setup.config??[]){let t=fn(e.type,M[e.key]??``);t!==void 0&&(n[e.key]=t)}await De(e.instanceId,{config:n}),await r(),k(`health`)}catch(e){R(e instanceof Error?e.message:String(e))}finally{f(!1)}}},[M,t,e.instanceId,r,B]),ie=(0,X.useCallback)(async()=>{m(!0),_(null),R(null);try{_((await ke(e.connectorId)).recordIds.length),await r()}catch(e){R(e instanceof Error?e.message:String(e))}finally{m(!1)}},[e.connectorId,r]);return(0,Q.jsxs)(y,{open:!0,onOpenChange:e=>{e||n()},children:[(0,Q.jsxs)(h,{children:[(0,Q.jsx)(G,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,Q.jsxs)(T,{className:s(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex h-[min(100vh-2rem,44rem)] w-[min(100%-2rem,min(92vw,54rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,`rounded-2xl border border-edge bg-surface-panel shadow-float outline-none dark:border-edge`),children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-6 py-5`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Q.jsx)(Y,{connector:t,size:`lg`}),(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(ee,{className:`text-base font-semibold text-fg`,children:e.displayName}),(0,Q.jsx)(N,{className:`mt-1 text-sm text-fg-muted`,children:t?.description??(e.materialized.type===`mcp`?$(i.mcpServerRuntime,{serverId:e.materialized.serverId}):$(i.runtimeLabel,{runtime:e.materialized.type}))})]})]}),(0,Q.jsx)(S,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:s(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,be.focusRingPanel),"aria-label":i.modalClose,children:[(0,Q.jsx)(v,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`sr-only`,children:i.modalClose})]})})]}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-5`,children:[I?(0,Q.jsx)(`p`,{className:`mb-4 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:I}):null,(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:H.map(([e,t,n])=>(0,Q.jsxs)(`button`,{type:`button`,className:s(`inline-flex h-8 items-center gap-1.5 rounded-md border px-2.5 text-xs`,D===e?`border-accent bg-accent-soft text-accent-fg`:`border-edge bg-surface-base text-fg-muted hover:text-fg`),onClick:()=>k(e),children:[(0,Q.jsx)(t,{className:`size-3.5`,"aria-hidden":!0}),n]},e))}),(0,Q.jsxs)(`div`,{className:`mt-4 rounded-xl border border-edge bg-surface-base p-3 text-sm`,children:[D===`health`?(0,Q.jsxs)(`div`,{className:`space-y-1 text-fg-muted`,children:[(0,Q.jsxs)(`p`,{children:[i.statusLabel,` `,(0,Q.jsx)(`span`,{className:x?.ok?`font-medium text-emerald-700 dark:text-emerald-300`:`font-medium text-fg`,children:un(x?.status??e.usage.lastHealthStatus,i)})]}),(0,Q.jsxs)(`p`,{children:[i.lastCheckLabel,` `,e.usage.lastHealthCheckAt?new Date(e.usage.lastHealthCheckAt).toLocaleString():i.never]}),x?.action?(0,Q.jsx)(`p`,{children:x.action}):null]}):null,D===`tools`?x?.tools.length?(0,Q.jsxs)(`div`,{className:`grid gap-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:$(i.toolsAvailable,{count:String(x.tools.length)})}),(0,Q.jsx)(W,{type:`button`,variant:`ghost`,className:`h-7 text-xs`,onClick:()=>j(!0),children:a.viewAllTools})]}),(0,Q.jsx)(`div`,{className:`grid gap-2`,children:x.tools.slice(0,8).map(e=>(0,Q.jsx)(pn,{title:e.shortName??e.name,description:e.description},e.name))})]}):(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsx)(`p`,{className:`text-fg-muted`,children:V?$(i.toolsLastCheckSummary,{count:String(V)}):i.toolsRunTestHint}),(0,Q.jsxs)(W,{type:`button`,variant:`secondary`,disabled:o,onClick:()=>void te(),children:[o?(0,Q.jsx)(C,{className:`size-4 animate-spin`}):(0,Q.jsx)(F,{className:`size-4`}),i.test]})]}):null,D===`resources`?x?.resources.length?(0,Q.jsx)(`div`,{className:`grid gap-2`,children:x.resources.slice(0,8).map(e=>(0,Q.jsx)(pn,{title:e.title??e.name,description:e.uri,meta:e.mimeType},e.uri))}):(0,Q.jsx)(`p`,{className:`text-fg-muted`,children:i.resourcesRunTestHint}):null,D===`prompts`?x?.prompts.length?(0,Q.jsx)(`div`,{className:`grid gap-2`,children:x.prompts.slice(0,8).map(e=>(0,Q.jsx)(pn,{title:e.title??e.name,description:e.description,meta:e.argumentCount?$(i.promptArgumentCount,{count:String(e.argumentCount)}):void 0},e.name))}):(0,Q.jsx)(`p`,{className:`text-fg-muted`,children:i.promptsRunTestHint}):null,D===`permissions`?(0,Q.jsxs)(`div`,{className:`space-y-1 text-fg-muted`,children:[(0,Q.jsx)(`p`,{children:$(i.secretsConfigured,{count:String(Object.values(e.secretStatus).filter(Boolean).length)})}),(0,Q.jsx)(`p`,{children:e.materialized.type===`mcp`?$(i.runtimeServerLabel,{runtime:e.materialized.type.toUpperCase(),serverId:e.materialized.serverId}):$(i.runtimeLabel,{runtime:e.materialized.type.toUpperCase()})}),(0,Q.jsx)(`p`,{children:e.materialized.type===`mcp`?i.mcpPolicyHint:i.connectorPolicyHint})]}):null,D===`config`&&B?(0,Q.jsx)(`div`,{className:`grid gap-3`,children:z.map(e=>(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.label}),e.description?(0,Q.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:e.description}):null,(0,Q.jsx)(`input`,{className:ln,value:M[e.key]??``,placeholder:e.placeholder,onChange:t=>P(n=>({...n,[e.key]:t.currentTarget.value}))})]},e.key))}):null]}),e.materialized.type===`composio`?(0,Q.jsx)(cn,{instance:e,t:i,onChanged:r}):null,e.materialized.type===`memorySource`?(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-between gap-3 rounded-xl border border-edge bg-surface-base p-3 text-sm`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`font-medium text-fg`,children:i.connectedSourceSync}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t?.description}),g===null?null:(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-emerald-600`,children:$(i.connectedSourceSynced,{count:String(g)})})]}),(0,Q.jsxs)(W,{disabled:p,onClick:()=>void ie(),children:[p?(0,Q.jsx)(C,{className:`size-4 animate-spin`}):(0,Q.jsx)(b,{className:`size-4`}),i.composioSyncNow]})]}):null]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-2 border-t border-edge-subtle px-6 py-4`,children:[(0,Q.jsx)(W,{variant:`secondary`,onClick:n,children:i.modalClose}),D===`config`&&B?(0,Q.jsxs)(W,{variant:`primary`,disabled:d,onClick:()=>void re(),children:[d?(0,Q.jsx)(C,{className:`size-4 animate-spin`}):(0,Q.jsx)(se,{className:`size-4`}),i.modalSave]}):null,e.materialized.type===`mcp`?(0,Q.jsxs)(W,{variant:`secondary`,disabled:o,onClick:()=>void te(),children:[o?(0,Q.jsx)(C,{className:`size-4 animate-spin`}):(0,Q.jsx)(F,{className:`size-4`}),i.test]}):null,(0,Q.jsxs)(W,{variant:`ghost`,disabled:l,onClick:()=>void ne(),children:[l?(0,Q.jsx)(C,{className:`size-4 animate-spin`}):(0,Q.jsx)(L,{className:`size-4`}),i.remove]})]})]})]}),e.materialized.type===`mcp`?(0,Q.jsx)(Zt,{open:A,onOpenChange:j,serverId:e.materialized.serverId,title:$(i.installedToolsDialogTitle,{name:e.displayName}),subtitle:i.installedToolsDialogSubtitle,searchPlaceholder:a.toolsDialogSearchPlaceholder,searchEmptyLabel:a.toolsDialogSearchEmpty,emptyLabel:i.toolsRunTestHint,closeLabel:a.toolsDialogClose,tools:x?.tools??[],stripPrefix:`${e.materialized.serverId}__`}):null]})}var hn=[`understand`,`act`,`reach`];function gn(e){if(e.benefits?.length)return[...new Set(e.benefits)];let t=new Set(e.capabilities),n=[e.id,e.displayName,...e.tags??[]].join(` `).toLowerCase(),r=[];return(t.has(`context`)||t.has(`memory_source`)||t.has(`resources`)||e.category===`docs`||e.category===`data`||/notion|drive|document|confluence|airtable|database|knowledge|wiki/.test(n))&&r.push(`understand`),t.has(`tools`)&&r.push(`act`),(t.has(`channel`)||/slack|telegram|discord|teams|mail|message|wechat|weixin/.test(n))&&r.push(`reach`),r.length?[...new Set(r)]:[`act`]}function _n(e){return gn(e)[0]??`act`}function vn(e,t){let n=t?_n(t):`act`,r=e.connectionStatus===`connected`||e.status===`connected`||e.usage.lastHealthStatus===`ok`,i=e.status===`not_configured`||e.status===`failed`||e.status===`degraded`||e.status===`unauthorized`||e.connectionStatus===`unauthorized`||e.connectionStatus===`error`,a=n===`understand`?e.usage.lastResourceCount:n===`act`?e.usage.lastToolCount:void 0;return{benefit:n,state:r?`ready`:i?`needs_setup`:`checking`,availableCount:a}}function yn({instance:e,definition:t,highlighted:n=!1,onOpenDetails:r,onChanged:i,t:a}){let[o,c]=(0,X.useState)(!1),[l,u]=(0,X.useState)(!1),[d,f]=(0,X.useState)(null),p=(0,X.useCallback)(async()=>{c(!0),f(null);try{await Ue(e.instanceId),await i()}catch(e){f(e instanceof Error?e.message:String(e))}finally{c(!1)}},[e.instanceId,i]),m=(0,X.useCallback)(async()=>{u(!0),f(null);try{await je(e.instanceId),await i()}catch(e){f(e instanceof Error?e.message:String(e)),u(!1)}},[e.instanceId,i]),h=e.usage.lastHealthStatus?a.healthStatusLabels[e.usage.lastHealthStatus]??e.usage.lastHealthStatus:a.healthNotTested,g=e.usage.lastToolCount??0,_=!!(t?.setup.config?.length&&!t.setup.secrets?.length&&e.materialized.type===`mcp`),v=vn(e,t).state,y=v===`ready`?{label:a.connectionReady,Icon:ie,className:`border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`}:v===`needs_setup`?{label:a.connectionNeedsSetup,Icon:ve,className:`border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300`}:{label:a.connectionChecking,Icon:B,className:`border-edge bg-surface-base text-fg-muted`};return(0,Q.jsxs)(`div`,{className:s(`flex h-full min-h-[10.5rem] cursor-pointer flex-col rounded-lg bg-surface-panel p-4 shadow-surface transition-colors hover:bg-surface-hover/45`,n&&`ring-2 ring-accent/45 ring-offset-2 ring-offset-surface-panel`),onClick:()=>r(e),children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start gap-3`,children:[(0,Q.jsx)(Y,{connector:t}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:e.displayName}),(0,Q.jsxs)(`span`,{className:s(`inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[11px] font-medium`,y.className),children:[(0,Q.jsx)(y.Icon,{className:`size-3`,"aria-hidden":!0}),y.label]}),_?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-base px-2 py-0.5 text-[11px] text-fg-muted`,children:a.connectorConfigLabel}):null]}),t?.description?(0,Q.jsx)(`p`,{className:`mt-3 line-clamp-2 text-sm leading-5 text-fg-muted`,children:t.description}):null,(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:[a.statusLabel,` `,h]}),(0,Q.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:$(a.toolsAvailable,{count:String(g)})})]}),d?(0,Q.jsx)(`p`,{className:`mt-3 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:d}):null]})]}),(0,Q.jsxs)(`div`,{className:`mt-4 flex items-center justify-between gap-2 border-t border-edge pt-3`,onClick:e=>e.stopPropagation(),children:[(0,Q.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:a.connectorDetails}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[v===`needs_setup`?(0,Q.jsxs)(W,{variant:`primary`,onClick:()=>r(e),children:[(0,Q.jsx)(ve,{className:`size-4`}),a.connectionResolveAction]}):null,e.materialized.type===`mcp`?(0,Q.jsxs)(W,{variant:`secondary`,disabled:o,onClick:()=>void p(),children:[o?(0,Q.jsx)(C,{className:`size-4 animate-spin`}):(0,Q.jsx)(F,{className:`size-4`}),a.test]}):null,(0,Q.jsxs)(W,{variant:`ghost`,disabled:l,onClick:()=>void m(),children:[l?(0,Q.jsx)(C,{className:`size-4 animate-spin`}):(0,Q.jsx)(L,{className:`size-4`}),a.remove]})]})]})]})}var bn=s(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,_),xn=s(bn,`min-h-28 font-mono`);function Sn(e,t){return e?t.healthStatusLabels[e]??e:t.healthStatusPending}function Cn(e,t){let n=t.trim();return e===`json`?n?JSON.parse(n):void 0:e===`number`?n?Number(n):void 0:e===`boolean`?n===`true`:n||void 0}function wn(e){let t=(0,Z.c)(12),{title:n,items:r}=e;if(r.length===0)return null;let i;t[0]===n?i=t[1]:(i=(0,Q.jsx)(`div`,{className:`border-b border-edge px-3 py-2 text-xs font-semibold text-fg`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=r.slice(0,12).map(Tn),t[2]=r,t[3]=a);let o;t[4]===r.length?o=t[5]:(o=r.length>12?(0,Q.jsxs)(`div`,{className:`px-3 py-2 text-xs text-fg-subtle`,children:[`+`,r.length-12]}):null,t[4]=r.length,t[5]=o);let s;t[6]!==a||t[7]!==o?(s=(0,Q.jsxs)(`div`,{className:`max-h-40 overflow-y-auto`,children:[a,o]}),t[6]=a,t[7]=o,t[8]=s):s=t[8];let c;return t[9]!==i||t[10]!==s?(c=(0,Q.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-panel`,children:[i,s]}),t[9]=i,t[10]=s,t[11]=c):c=t[11],c}function Tn(e){return(0,Q.jsxs)(`div`,{className:`border-b border-edge-subtle px-3 py-2 last:border-b-0`,children:[(0,Q.jsx)(`div`,{className:`break-words font-mono text-xs font-medium text-fg`,children:e.title}),e.description?(0,Q.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description}):null]},e.id)}function En({draft:e,onChange:t,onClose:n,onInstalled:r,t:i}){let{connector:a}=e,o=a.runtime.type===`composio`&&a.runtime.role===`toolkit`,c=a.runtime.type===`composio`&&a.runtime.role===`toolkit`?a.runtime.toolkit:null,l=a.understanding!=null,[u,d]=(0,X.useState)(!o),[f,p]=(0,X.useState)(o),[m,g]=(0,X.useState)(``),[_,b]=(0,X.useState)(null),[E,D]=(0,X.useState)(l);(0,X.useEffect)(()=>{if(!o)return;let e=!1;return Le().then(({configured:t})=>{e||d(t)}).catch(t=>{e||b(t instanceof Error?t.message:String(t))}).finally(()=>{e||p(!1)}),()=>{e=!0}},[a.id,o]);let O=e.result?`complete`:e.installing?`health`:`configure`,A=[{id:`configure`,label:i.connectStepConfigure},{id:`health`,label:i.connectStepVerify},{id:`complete`,label:i.connectStepReady}],j=(0,X.useCallback)(async()=>{let n=x(),i=o&&!n?window.open(``,`_blank`):null;i&&(i.opener=null),b(null),t({...e,installing:!0,error:null,result:null,health:null});try{o&&!u&&(await Ze(m),d(!0));let s={};for(let t of a.setup.config??[]){let n=Cn(t.type,e.config[t.key]??``);n!==void 0&&(s[t.key]=n)}let f=e.store?await Ge(e.store.packageName,{secrets:e.secrets,config:s},e.store.version):await Je(a.id,{secrets:e.secrets,config:s,definition:a.source===`registry`?a:void 0}),p=null;try{if(o)if((c?await Ie(c).catch(()=>null):null)?.status===`connected`){i?.close();let e=await Ae(c);if(l&&E){if(!e.accountId)throw Error(`Connector account is unavailable.`);await Ee(e.accountId)}}else{let e=await J(a.id);if(!e.authorizationUrl)throw Error(`The connection service did not return an authorization URL.`);if(n){let t=await window.electronAPI?.shell?.openExternalUrl(e.authorizationUrl);if(!t?.ok)throw Error(t?.error??`Could not open the system browser.`)}else i?i.location.href=e.authorizationUrl:window.open(e.authorizationUrl,`_blank`,`noopener,noreferrer`);let t=await Ae(c,e.connectionId);if(i?.close(),l&&E){if(!t.accountId)throw Error(`Connector account is unavailable.`);await Ee(t.accountId)}}}catch(n){i?.close(),t({...e,installing:!1,result:f,health:null,error:n instanceof Error?n.message:String(n)}),await r(f);return}if(!o)try{p=await Ue(f.instanceId)}catch{p=null}t({...e,installing:!1,result:f,health:p}),await r(f)}catch(n){i?.close(),t({...e,installing:!1,error:n instanceof Error?n.message:String(n)})}},[l,m,u,c,a,e,o,E,t,r]);return(0,Q.jsx)(y,{open:!0,onOpenChange:e=>{e||n()},children:(0,Q.jsxs)(h,{children:[(0,Q.jsx)(G,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,Q.jsxs)(T,{className:s(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex h-[min(100vh-2rem,44rem)] w-[min(100%-2rem,min(92vw,48rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,`rounded-2xl border border-edge bg-surface-panel shadow-float dark:border-edge`),children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-6 py-5`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Q.jsx)(Y,{connector:a,size:`lg`}),(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(ee,{className:`text-base font-semibold text-fg`,children:$(i.connectDialogTitle,{name:a.displayName})}),(0,Q.jsx)(N,{className:`mt-1 line-clamp-3 text-sm text-fg-muted`,children:a.description})]})]}),(0,Q.jsx)(S,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:s(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,be.focusRingPanel),"aria-label":i.modalClose,children:[(0,Q.jsx)(v,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`sr-only`,children:i.modalClose})]})})]}),(0,Q.jsxs)(`div`,{className:`min-h-0 overflow-y-auto px-6 py-5`,children:[(0,Q.jsx)(`div`,{className:`mb-5 grid grid-cols-3 gap-2`,"aria-label":i.connectProgressAria,children:A.map((e,t)=>{let n=A.findIndex(e=>e.id===O);return(0,Q.jsxs)(`div`,{className:s(`rounded-xl border px-3 py-2 text-xs font-medium`,t===n?`border-accent bg-accent-soft text-accent-fg`:t<n?`border-emerald-200 bg-emerald-50 text-emerald-800 dark:border-emerald-900/40 dark:bg-emerald-950/40 dark:text-emerald-200`:`border-edge bg-surface-base text-fg-muted`),children:[(0,Q.jsxs)(`span`,{className:`mr-1 tabular-nums`,children:[t+1,`.`]}),e.label]},e.id)})}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[o&&!u?(0,Q.jsxs)(`section`,{className:`rounded-2xl border border-accent/25 bg-accent-soft/50 p-4`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i.composioSetupTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:i.composioSetupHint}),(0,Q.jsxs)(`ol`,{className:`mt-3 list-inside list-decimal space-y-1 text-xs text-fg-muted`,children:[(0,Q.jsx)(`li`,{children:i.composioSetupStepProject}),(0,Q.jsx)(`li`,{children:i.composioSetupStepKey}),(0,Q.jsx)(`li`,{children:i.composioSetupStepPaste})]}),(0,Q.jsxs)(`a`,{className:`mt-3 inline-flex items-center gap-1 text-xs font-medium text-accent-fg hover:underline`,href:`https://app.composio.dev`,target:`_blank`,rel:`noreferrer`,children:[i.composioSetupOpenDashboard,(0,Q.jsx)(w,{className:`size-3.5`,"aria-hidden":!0})]}),(0,Q.jsx)(le,{className:`mt-3`,value:m,onChange:g,labels:i.secretInputLabels,placeholder:i.composioSetupKeyPlaceholder}),(0,Q.jsx)(`p`,{className:`mt-2 text-[11px] text-fg-subtle`,children:i.composioSetupStorageHint})]}):null,o&&l?(0,Q.jsxs)(`label`,{className:`flex items-start gap-3 rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 size-4 accent-accent`,checked:E,onChange:e=>D(e.currentTarget.checked)}),(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:i.learnAfterConnect}),(0,Q.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:i.learnAfterConnectHint})]})]}):null,e.store?(0,Q.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i.detailPermissions}),(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,children:[(e.store.permissions.data??[]).map(e=>(0,Q.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-panel px-2 py-1 text-xs text-fg-muted`,children:e},e)),(e.store.permissions.networkDomains??[]).map(e=>(0,Q.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-panel px-2 py-1 text-xs text-fg-muted`,children:e},e)),(0,Q.jsx)(`span`,{className:`rounded-md border border-emerald-500/30 bg-emerald-500/10 px-2 py-1 text-xs text-emerald-700 dark:text-emerald-300`,children:i.storeLocalExecDenied})]})]}):null,(a.setup.secrets??[]).map(n=>(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.label}),n.description?(0,Q.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:n.description}):null,(0,Q.jsx)(le,{value:e.secrets[n.key]??``,onChange:r=>t({...e,secrets:{...e.secrets,[n.key]:r},error:null}),labels:i.secretInputLabels,placeholder:n.required?i.requiredPlaceholder:i.optionalPlaceholder})]},n.key)),(a.setup.config??[]).map(n=>(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.label}),n.type===`json`?(0,Q.jsx)(`textarea`,{className:xn,value:e.config[n.key]??``,placeholder:n.placeholder,onChange:r=>t({...e,config:{...e.config,[n.key]:r.currentTarget.value},error:null})}):(0,Q.jsx)(`input`,{className:bn,value:e.config[n.key]??``,placeholder:n.placeholder,onChange:r=>t({...e,config:{...e.config,[n.key]:r.currentTarget.value},error:null})})]},n.key)),e.installing?(0,Q.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4 text-sm text-fg-muted`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 font-medium text-fg`,children:[(0,Q.jsx)(C,{className:`size-4 animate-spin text-accent`,"aria-hidden":!0}),i.connectingTitle]}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:i.connectingHint})]}):null,e.error?(0,Q.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:e.error}):null,_?(0,Q.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:_}):null,e.result?(0,Q.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4 text-sm text-fg-muted`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsx)(`div`,{children:(0,Q.jsx)(`p`,{className:`font-medium text-fg`,children:i.connectedBadge})}),(0,Q.jsx)(`span`,{className:s(`rounded-full px-2 py-0.5 text-xs font-medium`,e.health?.ok?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e.health?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:`bg-surface-hover text-fg-muted`),children:e.health?.ok?i.healthStatusHealthy:Sn(e.health?.status,i)})]}),e.health?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`mt-3 grid gap-2 text-xs sm:grid-cols-3`,children:[(0,Q.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2`,children:[(0,Q.jsx)(`div`,{className:`font-semibold text-fg`,children:e.health.toolCount}),(0,Q.jsx)(`div`,{children:i.toolsMetric})]}),(0,Q.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2`,children:[(0,Q.jsx)(`div`,{className:`font-semibold text-fg`,children:e.health.resourceCount}),(0,Q.jsx)(`div`,{children:i.resourcesMetric})]}),(0,Q.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2`,children:[(0,Q.jsx)(`div`,{className:`font-semibold text-fg`,children:e.health.promptCount}),(0,Q.jsx)(`div`,{children:i.promptsMetric})]})]}),(0,Q.jsxs)(`div`,{className:`mt-3 grid gap-2`,children:[(0,Q.jsx)(wn,{title:i.detailTools,items:e.health.tools.map(e=>({id:e.name,title:e.shortName??e.name,description:e.description}))}),(0,Q.jsx)(wn,{title:i.detailResources,items:e.health.resources.map(e=>({id:e.uri,title:e.title??e.name??e.uri,description:e.description??e.uri}))}),(0,Q.jsx)(wn,{title:i.detailPrompts,items:e.health.prompts.map(e=>({id:e.name,title:e.title??e.name,description:e.description??$(i.promptArgumentCount,{count:String(e.argumentCount)})}))})]})]}):(0,Q.jsx)(`p`,{className:`mt-3`,children:i.installedWithoutHealth}),e.health?.action?(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:e.health.action}):null]}):null]})]}),(0,Q.jsx)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle px-6 py-4`,children:(0,Q.jsxs)(W,{variant:`primary`,disabled:!!e.result||e.installing||f||o&&!u&&!m.trim(),onClick:()=>void j(),children:[e.installing?(0,Q.jsx)(C,{className:`size-4 animate-spin`}):e.result?(0,Q.jsx)(ie,{className:`size-4`}):(0,Q.jsx)(k,{className:`size-4`}),e.result?i.connectedBadge:i.connect]})})]})]})})}function Dn(e,t){let n={};for(let t of e.setup.secrets??[])n[t.key]=``;let r={};for(let t of e.setup.config??[])r[t.key]=t.defaultValue===void 0?``:typeof t.defaultValue==`string`?t.defaultValue:JSON.stringify(t.defaultValue,null,2);return{connector:e,secrets:n,config:r,installing:!1,error:null,result:null,health:null,...t?{store:t}:{}}}function On(e,t){let n=e.length+1,r=`server-${n}`,i=new Set([...e.map(e=>e.id.trim()),...t]);for(;i.has(r);)n+=1,r=`server-${n}`;return Nt(r)}function kn(e,t,n){let r=e.key.trim();if(r)return`key:${r}`;let i=e.value.trim();return i?`value:${i}`:`empty:${n.slice(0,t).filter(e=>!e.key.trim()&&!e.value.trim()).length}`}function An(){return s(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,_)}function jn({label:e,optionalLabel:t,addLabel:n,removeHeaderAria:r,pasteLabel:i,pasteFailed:a,keyPlaceholder:o,valuePlaceholder:l,headers:u,onChange:d}){let f=(e,t)=>{d(u.map((n,r)=>r===e?{...n,...t}:n))},p=()=>{d([...u,{key:``,value:``}])},m=e=>{let t=u.filter((t,n)=>n!==e);d(t.length>0?t:[{key:``,value:``}])},h=async()=>{try{let e=await c();if(!e){window.alert(a);return}let t=wt(e);if(!t?.length){window.alert(a);return}d(t)}catch{window.alert(a)}};return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 md:col-span-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm font-medium text-fg`,children:[(0,Q.jsx)(`span`,{children:e}),t?(0,Q.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:t}):null]}),(0,Q.jsxs)(W,{type:`button`,variant:`ghost`,className:`h-8 gap-1.5 px-2 text-xs`,onClick:()=>void h(),children:[(0,Q.jsx)(A,{className:`size-3.5`,"aria-hidden":!0}),i]})]}),(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:u.map((e,t)=>(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`input`,{className:s(An(),`min-w-0 flex-1 font-mono text-xs`),value:e.key,placeholder:o,onChange:e=>f(t,{key:e.target.value})}),(0,Q.jsx)(`input`,{className:s(An(),`min-w-0 flex-[1.4] font-mono text-xs`),value:e.value,placeholder:l,onChange:e=>f(t,{value:e.target.value})}),(0,Q.jsx)(W,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 px-0`,disabled:u.length<=1&&!e.key&&!e.value,onClick:()=>m(t),"aria-label":r,children:(0,Q.jsx)(L,{className:`size-4 text-fg-subtle`,"aria-hidden":!0})})]},kn(e,t,u)))}),(0,Q.jsxs)(`button`,{type:`button`,className:s(`self-start text-sm text-accent hover:underline`,be.press),onClick:p,children:[`+ `,n]})]})}var Mn=[`stdio`,`sse`,`streamable-http`];function Nn(e){let t=(0,Z.c)(11),{label:n,description:r,required:i,children:a}=e,o;t[0]===i?o=t[1]:(o=i?(0,Q.jsx)(`span`,{className:`ml-0.5 text-danger`,children:`*`}):null,t[0]=i,t[1]=o);let s;t[2]!==n||t[3]!==o?(s=(0,Q.jsxs)(`div`,{className:`text-sm font-medium text-fg`,children:[n,o]}),t[2]=n,t[3]=o,t[4]=s):s=t[4];let c;t[5]===r?c=t[6]:(c=r?(0,Q.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-subtle`,children:r}):null,t[5]=r,t[6]=c);let l;return t[7]!==a||t[8]!==s||t[9]!==c?(l=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[s,a,c]}),t[7]=a,t[8]=s,t[9]=c,t[10]=l):l=t[10],l}function Pn(){return s(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,_)}function Fn(e){let t=(0,Z.c)(35),{row:n,t:r,onUpdate:i,idConflictMessage:a,variant:o}=e,c=o===void 0?`all`:o,l=c===`all`||c===`basic`,u=c===`all`||c===`advanced`,d;t[0]!==a||t[1]!==i||t[2]!==n.id||t[3]!==n.transport||t[4]!==l||t[5]!==r?(d=l?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Nn,{label:r.transportLabel,required:!0,children:(0,Q.jsx)(V,{className:Pn(),value:n.transport,onChange:e=>i({transport:e.target.value}),children:Mn.map(e=>(0,Q.jsx)(j,{value:e,children:r.transportLabels[e]},e))})}),(0,Q.jsxs)(Nn,{label:r.serverIdLabel,required:!0,children:[(0,Q.jsx)(`input`,{className:Pn(),value:n.id,placeholder:r.serverIdPlaceholder,onChange:e=>i({id:e.target.value})}),a?(0,Q.jsx)(`p`,{className:`text-xs text-red-600 dark:text-red-300`,children:a}):null]})]}):null,t[0]=a,t[1]=i,t[2]=n.id,t[3]=n.transport,t[4]=l,t[5]=r,t[6]=d):d=t[6];let f;t[7]!==i||t[8]!==n.argsText||t[9]!==n.command||t[10]!==n.cwd||t[11]!==n.envJson||t[12]!==n.headers||t[13]!==n.transport||t[14]!==n.url||t[15]!==u||t[16]!==l||t[17]!==r||t[18]!==c?(f=n.transport===`stdio`?(0,Q.jsxs)(Q.Fragment,{children:[l?(0,Q.jsx)(`div`,{className:c===`basic`?`md:col-span-2`:void 0,children:(0,Q.jsx)(Nn,{label:r.commandLabel,required:!0,children:(0,Q.jsx)(`input`,{className:Pn(),value:n.command,onChange:e=>i({command:e.target.value})})})}):null,u?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Nn,{label:r.argsLabel,description:r.argsHint,children:(0,Q.jsx)(`input`,{className:Pn(),value:n.argsText,onChange:e=>i({argsText:e.target.value})})}),(0,Q.jsx)(Nn,{label:r.cwdLabel,children:(0,Q.jsx)(`input`,{className:Pn(),value:n.cwd,onChange:e=>i({cwd:e.target.value})})}),(0,Q.jsx)(Nn,{label:r.envLabel,description:r.envHint,children:(0,Q.jsx)(`textarea`,{className:s(Pn(),`min-h-[4rem] font-mono text-xs`),value:n.envJson,onChange:e=>i({envJson:e.target.value})})})]}):null]}):(0,Q.jsxs)(Q.Fragment,{children:[l?(0,Q.jsx)(`div`,{className:`md:col-span-2`,children:(0,Q.jsx)(Nn,{label:r.urlLabel,required:!0,children:(0,Q.jsx)(`input`,{className:s(Pn(),`font-mono text-xs`),value:n.url,placeholder:`https://example.com/mcp`,onChange:e=>i({url:e.target.value})})})}):null,u?(0,Q.jsx)(jn,{label:r.headersLabel,optionalLabel:r.optionalSuffix,addLabel:r.addHeader,removeHeaderAria:r.removeHeader,pasteLabel:r.pasteHeaders,pasteFailed:r.pasteHeadersFailed,keyPlaceholder:r.headerKeyPlaceholder,valuePlaceholder:r.headerValuePlaceholder,headers:n.headers,onChange:e=>i({headers:e})}):null]}),t[7]=i,t[8]=n.argsText,t[9]=n.command,t[10]=n.cwd,t[11]=n.envJson,t[12]=n.headers,t[13]=n.transport,t[14]=n.url,t[15]=u,t[16]=l,t[17]=r,t[18]=c,t[19]=f):f=t[19];let p;t[20]!==i||t[21]!==n||t[22]!==u||t[23]!==r?(p=u?(0,Q.jsx)(Nn,{label:r.timeoutLabel,description:r.timeoutHint,children:(0,Q.jsx)(`input`,{type:`number`,min:1,max:600,className:Pn(),value:Vt(n),placeholder:r.timeoutPlaceholder,onChange:e=>i({connectionTimeoutMs:Ht(e.target.value)})})}):null,t[20]=i,t[21]=n,t[22]=u,t[23]=r,t[24]=p):p=t[24];let m;t[25]!==i||t[26]!==n||t[27]!==u||t[28]!==r?(m=u?(0,Q.jsx)(Nn,{label:r.requestTimeoutLabel,description:r.requestTimeoutHint,children:(0,Q.jsx)(`input`,{type:`number`,min:1,max:14400,className:Pn(),value:Ut(n),placeholder:r.requestTimeoutPlaceholder,onChange:e=>i({requestTimeoutMs:Wt(e.target.value)})})}):null,t[25]=i,t[26]=n,t[27]=u,t[28]=r,t[29]=m):m=t[29];let h;return t[30]!==d||t[31]!==f||t[32]!==p||t[33]!==m?(h=(0,Q.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[d,f,p,m]}),t[30]=d,t[31]=f,t[32]=p,t[33]=m,t[34]=h):h=t[34],h}function In(e,t){if(e.shortName)return e.shortName;let n=`${t.trim()}__`;return n&&e.name.startsWith(n)?e.name.slice(n.length):e.name}function Ln(e){let t=(0,Z.c)(13),{tool:n,serverId:r}=e,i;t[0]!==r||t[1]!==n?(i=In(n,r),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a=i,o=n.name===a?a:n.name,c;t[3]===n.description?c=t[4]:(c=n.description?.trim(),t[3]=n.description,t[4]=c);let l=c,u;t[5]!==a||t[6]!==o?(u=(0,Q.jsx)(`p`,{className:`break-all font-mono text-xs font-medium leading-5 text-fg`,title:o,children:a}),t[5]=a,t[6]=o,t[7]=u):u=t[7];let d;t[8]===l?d=t[9]:(d=l?(0,Q.jsx)(Ce,{delayDuration:300,skipDelayDuration:100,children:(0,Q.jsxs)(te,{children:[(0,Q.jsx)(xe,{asChild:!0,children:(0,Q.jsx)(`p`,{tabIndex:0,title:l,className:s(`mt-1 line-clamp-3 cursor-help text-xs leading-5 text-fg-muted`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`),children:l})}),(0,Q.jsx)(ye,{children:(0,Q.jsx)(H,{side:`top`,align:`start`,sideOffset:6,collisionPadding:12,className:`!z-[10000] max-h-[min(16rem,45vh)] max-w-[min(32rem,calc(100vw-2rem))] overflow-y-auto rounded-md border border-edge bg-surface-panel px-2.5 py-2 text-left text-xs leading-5 text-fg shadow-popover`,children:(0,Q.jsx)(`span`,{className:`whitespace-pre-wrap break-words`,children:l})})})]})}):null,t[8]=l,t[9]=d);let f;return t[10]!==u||t[11]!==d?(f=(0,Q.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-edge bg-surface-panel px-3 py-2.5`,children:[u,d]}),t[10]=u,t[11]=d,t[12]=f):f=t[12],f}function Rn({open:e,mode:t,initialRow:n,existingCustomServers:r,sessionIdleTtlMinutes:i,config:a,managedServerIds:o,t:c,cs:l,onClose:u,onSaved:d}){let[f,p]=(0,X.useState)(n),[m,g]=(0,X.useState)(!1),[_,b]=(0,X.useState)(!1),[x,w]=(0,X.useState)(null),[E,D]=(0,X.useState)(!1),[k,A]=(0,X.useState)({status:`idle`}),[j,M]=(0,X.useState)(null),P=n.id.trim(),I=f.id.trim()!==P&&o.has(f.id.trim())||o.has(f.id.trim())&&t===`add`?c.reservedServerId:void 0,L=f.id.trim()&&r.some(e=>e.clientKey!==n.clientKey&&e.id.trim()===f.id.trim())?l.duplicateServerId:void 0,R=f.id.trim().length>0&&!I&&!L&&(f.transport===`stdio`?f.command.trim().length>0:f.url.trim().length>0),z=Gt(f),B=(0,X.useCallback)(async()=>{if(f.id.trim()){b(!0),w(null),A({status:`loading`});try{A({status:`ok`,tools:(await Bt(f.id.trim(),Ft(f))).tools})}catch(e){A({status:`error`,message:e instanceof Error?e.message:String(e)})}finally{b(!1)}}},[f]),V=(0,X.useCallback)(async()=>{if(!(!R||m)){g(!0),w(null);try{let e=r.filter(e=>!(t===`edit`&&e.clientKey===n.clientKey));e.push(f),await It({sessionIdleTtlMinutes:i,servers:e.sort((e,t)=>e.id.localeCompare(t.id))},Ot(a)),await d(),u()}catch(e){w(e instanceof Error?e.message:String(e))}finally{g(!1)}}},[R,a,r,n.clientKey,t,u,d,P,f,m,i]);return e?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(y,{open:e,onOpenChange:e=>{e||u()},children:(0,Q.jsxs)(h,{children:[(0,Q.jsx)(G,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,Q.jsxs)(T,{className:s(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex h-[min(100vh-2rem,44rem)] w-[min(100%-2rem,min(92vw,48rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,`rounded-2xl border border-edge bg-surface-panel shadow-float dark:border-edge`),children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-6 py-5`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(ee,{className:`text-base font-semibold text-fg`,children:t===`add`?l.addCustomServerTitle:l.editCustomServerTitle}),(0,Q.jsx)(N,{className:`mt-1 text-sm text-fg-muted`,children:t===`add`?l.addCustomServerHint:l.editCustomServerHint})]}),(0,Q.jsx)(S,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:s(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,be.focusRingPanel),"aria-label":l.modalClose,children:[(0,Q.jsx)(v,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`sr-only`,children:l.modalClose})]})})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-5`,children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,Q.jsx)(`section`,{className:`rounded-xl border border-edge bg-surface-base p-4`,children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,Q.jsx)(de,{className:`size-4 text-accent`,"aria-hidden":!0}),f.id.trim()||c.cardUntitled]}),(0,Q.jsx)(`p`,{className:`mt-1 break-all font-mono text-xs leading-5 text-fg-muted`,children:z||(f.transport===`stdio`?c.commandLabel:c.urlLabel)})]}),(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:c.transportLabels[f.transport]})]})}),(0,Q.jsxs)(`section`,{children:[(0,Q.jsxs)(`div`,{className:`mb-3`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:l.connectorBasicConfigTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:l.connectorBasicConfigHint})]}),(0,Q.jsx)(Fn,{row:f,t:c,variant:`basic`,onUpdate:e=>{p(t=>({...t,...e})),w(null)},idConflictMessage:I??L})]}),k.status===`ok`?(0,Q.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-base p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,Q.jsx)(O,{className:`size-4 text-accent`,"aria-hidden":!0}),k.tools.length===0?c.toolsEmpty:c.toolsTitle.replace(`{{count}}`,String(k.tools.length))]}),k.tools.length>0?(0,Q.jsx)(W,{type:`button`,variant:`ghost`,className:`h-8 text-xs`,onClick:()=>M(k.tools),children:c.viewAllTools}):null]}),k.tools.length>0?(0,Q.jsx)(`div`,{className:`mt-3 grid gap-2`,children:k.tools.slice(0,6).map((e,t)=>(0,Q.jsx)(Ln,{tool:e,serverId:f.id},e.name||`tool-${t}`))}):null]}):null,k.status===`error`?(0,Q.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:k.message}):null,x?(0,Q.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:x}):null,(0,Q.jsxs)(`details`,{open:E,onToggle:e=>D(e.currentTarget.open),className:`group rounded-xl border border-edge bg-surface-base`,children:[(0,Q.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-4 py-3 text-sm font-medium text-fg hover:text-fg [&::-webkit-details-marker]:hidden`,children:[(0,Q.jsx)(fe,{className:`size-4 text-fg-muted transition-transform group-open:rotate-180`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`group-open:hidden`,children:l.connectorShowAdvancedConfig}),(0,Q.jsx)(`span`,{className:`hidden group-open:inline`,children:l.connectorHideAdvancedConfig})]}),(0,Q.jsx)(`div`,{className:`border-t border-edge p-4`,children:(0,Q.jsx)(Fn,{row:f,t:c,variant:`advanced`,onUpdate:e=>{p(t=>({...t,...e})),w(null)}})})]})]})}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-2 border-t border-edge-subtle px-6 py-4`,children:[(0,Q.jsxs)(W,{variant:`secondary`,disabled:!f.id.trim()||_,onClick:()=>void B(),children:[_?(0,Q.jsx)(C,{className:`size-4 animate-spin`}):(0,Q.jsx)(F,{className:`size-4`}),c.testConnection]}),(0,Q.jsx)(S,{asChild:!0,children:(0,Q.jsx)(W,{variant:`secondary`,children:l.modalCancel})}),(0,Q.jsxs)(W,{variant:`primary`,disabled:!R||m,onClick:()=>void V(),children:[m?(0,Q.jsx)(C,{className:`size-4 animate-spin`}):(0,Q.jsx)(ie,{className:`size-4`}),m?c.saving:l.modalSave]})]})]})]})}),j?(0,Q.jsx)(Zt,{open:!0,onOpenChange:e=>{e||M(null)},serverId:f.id,title:c.toolsDialogTitle,subtitle:c.toolsDialogSubtitle,searchPlaceholder:c.toolsDialogSearchPlaceholder,searchEmptyLabel:c.toolsDialogSearchEmpty,emptyLabel:c.toolsEmpty,closeLabel:c.toolsDialogClose,tools:j,stripPrefix:`${f.id.trim()}__`}):null]}):null}var zn=`builtin`,Bn=`composio`,Vn=`xopc-store`;function Hn(e){return zn}function Un(e){return!(e.runtime.type===`composio`&&e.runtime.role===`credential`)}function Wn(e,t){let n=t.trim().toLowerCase();return n?[e.displayName,e.description,e.category,e.kind,e.source,...e.tags??[]].some(e=>e.toLowerCase().includes(n)):!0}function Gn(e,t,n){return e.filter(e=>Wn(e,t)).toSorted((e,t)=>n===`source`&&e.source!==t.source?e.source.localeCompare(t.source):e.displayName.localeCompare(t.displayName))}function Kn(e,t){let n=t.trim().toLowerCase();return n?[e.displayName,e.connectorId,e.instanceId,e.status,e.connectionStatus??``,e.materialized.type,e.materialized.type===`mcp`?e.materialized.serverId:e.materialized.id].some(e=>e.toLowerCase().includes(n)):!0}function qn(e,t){let n=t.trim().toLowerCase();return n?[e.id,e.command??``,e.url??``,e.transport].some(e=>e.toLowerCase().includes(n)):!0}function Jn(e){let t=[`code`,`docs`,`browser`,`data`,`automation`,`custom`].includes(e.category??``)?e.category:`custom`;return{id:e.name,version:e.latestVersion??`store`,displayName:e.name,description:e.description,category:t,kind:`mcp`,source:`store`,capabilities:[`tools`,`runtime.mcp.streamableHttp`],tags:[`store`],auth:{mode:`none`},setup:{},runtime:{type:`mcp`,serverId:`store-${e.name}`.slice(0,64)}}}function Yn(e){return e.filter((e,t,n)=>n.findIndex(t=>t.id===e.id)===t)}function Xn(e){return e?.startsWith(`/`)&&!e.startsWith(`//`)?e:`/you?tab=sources`}function Zn(){let e=l(d(e=>e.language)),t=e.connectorsSettings,n=e.mcpSettings,r=u(e=>e.token),o=!!r,c=a(),[f,p]=i(),m=f.get(`understanding`)===`1`,h=Xn(f.get(`returnTo`)),g=f.get(`tab`),[_,v]=(0,X.useState)(!m&&g===`connected`?`connected`:`discover`),y=(0,X.useRef)(!1),[b,x]=(0,X.useState)({catalog:[],registryCatalog:[],instances:[],loading:!0,error:null,peopleGraph:null}),[S,w]=(0,X.useState)(!1),[T,E]=(0,X.useState)(!1),[O,k]=(0,X.useState)(1),[A,j]=(0,X.useState)(void 0),[M,N]=(0,X.useState)(``),[P,F]=(0,X.useState)(``),[ee,L]=(0,X.useState)(!1),[z,B]=(0,X.useState)(m?f.get(`connector`)??``:``),[V,H]=(0,X.useState)(Hn(m?`understanding`:`default`)),[U,te]=(0,X.useState)(`name`),[ne,re]=(0,X.useState)(m?`understand`:`all`),[ie,ae]=(0,X.useState)(null),[oe,se]=(0,X.useState)(null),[ce,le]=(0,X.useState)(null),[ue,de]=(0,X.useState)(null),[fe,pe]=(0,X.useState)(null),[me,he]=(0,X.useState)(null),[ge,_e]=(0,X.useState)(!1),[ve,ye]=(0,X.useState)(void 0),[be,xe]=(0,X.useState)(!1),{data:Ce,mutate:G}=Se(o),K=Ce?.payload?.config,q=(0,X.useMemo)(()=>K===void 0?null:Pt(K),[K]),J=q?.servers??[],Ee=b.instances.length+J.length;(0,X.useEffect)(()=>{q&&ye(q.sessionIdleTtlMinutes)},[q]);let Y=(0,X.useCallback)(async()=>{if(!r){x({catalog:[],registryCatalog:[],instances:[],loading:!1,error:null,peopleGraph:null});return}x(e=>({...e,loading:!0,error:null}));try{let[e,t,n]=await Promise.all([Ve(),Pe(),Ye(``,12).catch(()=>null)]);x(r=>({catalog:e,registryCatalog:r.registryCatalog,instances:t,loading:!1,error:null,peopleGraph:n}))}catch(e){x({catalog:[],registryCatalog:[],instances:[],loading:!1,error:e instanceof Error?e.message:String(e),peopleGraph:null})}},[r]);(0,X.useEffect)(()=>{Y()},[Y]),(0,X.useEffect)(()=>{if(!o||_!==`connected`)return;let e=!1,t=window.setTimeout(()=>{L(!0),Ye(P,50).then(t=>{e||x(e=>({...e,peopleGraph:t}))}).catch(()=>{}).finally(()=>{e||L(!1)})},250);return()=>{e=!0,window.clearTimeout(t)}},[o,P,_]),(0,X.useEffect)(()=>{y.current||b.loading||o&&!q||(v(m?`discover`:Ee>0?`connected`:`discover`),y.current=!0)},[o,Ee,q,m,b.loading]);let De=(0,X.useCallback)(e=>{y.current=!0,v(e)},[]),Oe=(0,X.useMemo)(()=>[{id:Bn,displayName:t.composioSourceName},{id:Vn,displayName:t.storeSourceName}],[t.composioSourceName,t.storeSourceName]),ke=(0,X.useCallback)(async e=>{if(!o||V===`builtin`){x(e=>({...e,registryCatalog:[]})),k(1),j(void 0);return}let t=z.trim(),n=Math.max(e?.page??1,1),r=e?.append??!1,i=V===`all`?Oe:Oe.filter(e=>e.id===V);if(i.length!==0){w(!0),r?x(e=>({...e,error:null})):(k(1),j(void 0),x(e=>({...e,registryCatalog:[],error:null})));try{let e=await Promise.all(i.map(async e=>{if(e.id===`composio`){let e=await Ke({q:t||void 0,page:n,pageSize:24,verification:`experimental`});return{connectors:e.connectors,totalPages:e.meta.totalPages}}let r=await qe({q:t||void 0,page:n,pageSize:24,sort:U===`source`?`newest`:`downloads`});return{connectors:r.items.map(Jn),totalPages:r.meta.totalPages}})),a=Yn(e.flatMap(e=>e.connectors)),o=Math.max(1,...e.map(e=>e.totalPages??1));k(n),j(o),x(e=>({...e,registryCatalog:r?Yn([...e.registryCatalog,...a]):a}))}catch(e){x(t=>({...t,error:e instanceof Error?e.message:String(e)}))}finally{w(!1)}}},[U,z,V,o,Oe]);(0,X.useEffect)(()=>{if(_!==`discover`||b.loading)return;if(V===`builtin`){x(e=>({...e,registryCatalog:[]})),k(1),j(void 0);return}let e=window.setTimeout(()=>{ke()},z.trim()?350:0);return()=>window.clearTimeout(e)},[z,V,ke,b.loading,_]);let Ae=(0,X.useMemo)(()=>new Set(b.instances.map(e=>e.connectorId)),[b.instances]),je=(0,X.useMemo)(()=>new Map([...b.catalog,...b.registryCatalog].map(e=>[e.id,e])),[b.catalog,b.registryCatalog]);(0,X.useEffect)(()=>{if(b.loading)return;let e=f.get(`connector`),t=f.get(`instance`);if(!e&&!t)return;let n=b.instances.find(n=>t?n.instanceId===t:n.connectorId===e);if(n)y.current=!0,N(``),le(n.instanceId),de(n),v(`connected`);else if(e){let t=je.get(e);if(!t)return;y.current=!0,H(Hn(m?`understanding`:`default`)),B(``),se(t),v(`discover`)}let r=new URLSearchParams(f);r.delete(`connector`),r.delete(`instance`),r.set(`tab`,n?`connected`:`discover`),p(r,{replace:!0})},[je,m,f,p,b.instances,b.loading]);let Me=(0,X.useCallback)(async e=>{E(!0),x(e=>({...e,error:null}));try{let t=await Xe(e);ae(Dn(t.definition,{packageName:t.packageName,version:t.version,permissions:t.permissions}))}catch(e){x(t=>({...t,error:e instanceof Error?e.message:String(e)}))}finally{E(!1)}},[]),Ne=(0,X.useMemo)(()=>new Set(b.instances.flatMap(e=>e.materialized.type===`mcp`?[e.materialized.serverId]:[])),[b.instances]),Fe=(0,X.useCallback)(async e=>{if(!q||K===void 0)return;let t=J.filter(t=>t.clientKey!==e.clientKey);await It({sessionIdleTtlMinutes:q.sessionIdleTtlMinutes,servers:t},Ot(K)),await G(),await Y()},[K,J,Y,q,G]),Ie=(0,X.useCallback)(()=>{he({mode:`add`,row:On(J,Ne)})},[J,Ne]),Le=(0,X.useCallback)(async()=>{if(!(!q||K===void 0||be)){xe(!0);try{await It({sessionIdleTtlMinutes:ve,servers:J},Ot(K)),await G(),_e(!1)}finally{xe(!1)}}},[K,J,n.saved,q,G,ve,be]),Re=I(e=>e.setPageHeader),ze=I(e=>e.clearPageHeader),Be=(0,X.useMemo)(()=>(0,Q.jsx)(St,{onBrowseCatalog:()=>De(`discover`),onAddCustomServer:Ie,onOpenRuntimeSettings:()=>_e(!0),addLabel:t.addConnection,browseLabel:t.addFromCatalog,customLabel:t.addCustomServerAdvanced,settingsLabel:t.runtimeSettings}),[t,Ie,De]);(0,X.useLayoutEffect)(()=>(Re({startExtra:null,main:(0,Q.jsx)(`div`,{className:`min-w-0`,children:(0,Q.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.title})}),end:Be}),()=>ze()),[ze,t.title,Be,Re]);let He=(0,X.useMemo)(()=>b.instances.map(e=>({instance:e,value:vn(e,je.get(e.connectorId))})),[je,b.instances]),Ue=(0,X.useMemo)(()=>new Map(He.map(({instance:e,value:t})=>[e.instanceId,t])),[He]),We=(0,X.useMemo)(()=>b.instances.filter(e=>Kn(e,M)).sort((e,t)=>{let n={needs_setup:0,checking:1,ready:2},r=Ue.get(e.instanceId)?.state??`checking`,i=Ue.get(t.instanceId)?.state??`checking`;return n[r]-n[i]||e.displayName.localeCompare(t.displayName)}),[M,Ue,b.instances]),Ge=(0,X.useMemo)(()=>J.filter(e=>qn(e,M)),[M,J]),Je=We.length+Ge.length,Ze=(0,X.useMemo)(()=>b.catalog.filter(e=>e.source===`builtin`&&e.integrationStrategy?.preferred!==!1&&Un(e)),[b.catalog]),Qe=(0,X.useMemo)(()=>V===`builtin`?Ze:V===`all`?Yn([...Ze,...b.registryCatalog]):b.registryCatalog,[Ze,V,b.registryCatalog]),$e=(0,X.useMemo)(()=>{let e=m?Qe.filter(e=>e.understanding?.mode===`activity`):Qe;return Gn(ne===`all`?e:e.filter(e=>gn(e).includes(ne)),z,U)},[U,z,Qe,m,ne]),et=(0,X.useMemo)(()=>hn.filter(e=>Qe.some(t=>gn(t).includes(e))),[Qe]);(0,X.useEffect)(()=>{ne!==`all`&&!et.includes(ne)&&re(`all`)},[et,ne]);let tt=_===`discover`&&V!==`builtin`&&!!(A&&O<A),nt=(0,X.useMemo)(()=>b.instances.find(e=>e.instanceId===ce)??ue,[ce,ue,b.instances]),Z=(0,X.useMemo)(()=>[{value:`all`,label:t.discoverSourceAll},{value:zn,label:t.discoverSourceBuiltin},...Oe.map(e=>({value:e.id,label:e.displayName}))],[t.discoverSourceAll,t.discoverSourceBuiltin,Oe]),it=[{id:`connected`,label:t.tabConnected,count:Ee},{id:`discover`,label:t.tabDiscover}];return(0,Q.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:(0,Q.jsxs)(`div`,{className:`flex w-full flex-col gap-6 px-3 py-6 sm:px-5 xl:px-6`,children:[o?null:(0,Q.jsx)(`p`,{className:`rounded-xl border border-edge bg-surface-panel px-4 py-3 text-sm text-fg-muted`,children:t.tokenHint}),m?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl border border-accent/25 bg-accent-soft px-4 py-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:t.understandingSetupTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.understandingSetupHint})]}),(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`shrink-0`,onClick:()=>c(h),children:t.understandingSetupDone})]}):null,(0,Q.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge-subtle pb-3 dark:border-edge-subtle`,children:(0,Q.jsx)(Te,{items:it,activeTab:_,onChange:De,ariaLabel:t.navAria,tabIdPrefix:`connectors-tab`,panelIdPrefix:`connectors-panel`,className:`flex-wrap`})}),b.error?(0,Q.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:b.error}):null,_===`connected`&&o?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center`,children:[(0,Q.jsx)(xt,{value:M,onChange:N,placeholder:t.connectedSearchPlaceholder,className:`max-w-xl`}),(0,Q.jsx)(we,{className:`size-9 shrink-0 p-0`,loading:b.loading,label:t.refreshConnections,title:t.refreshConnections,onClick:Y})]}),b.peopleGraph&&(b.peopleGraph.people.length>0||P)?(0,Q.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsx)(`div`,{className:`rounded-lg bg-accent-soft p-2 text-accent-fg`,children:(0,Q.jsx)(D,{className:`size-4`,"aria-hidden":!0})}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.peopleGraphTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.peopleGraphHint.replace(`{{people}}`,String(b.peopleGraph.people.length)).replace(`{{sources}}`,String(new Set(b.peopleGraph.sourceEdges.map(e=>e.sourceInstanceId)).size))})]})]}),(0,Q.jsxs)(`div`,{className:`relative w-full max-w-xs`,children:[(0,Q.jsx)(xt,{value:P,onChange:F,placeholder:t.peopleGraphSearchPlaceholder}),ee?(0,Q.jsx)(C,{className:`absolute right-3 top-2.5 size-4 animate-spin text-fg-subtle`,"aria-hidden":!0}):null]})]}),b.peopleGraph.people.length?(0,Q.jsx)(`div`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,children:b.peopleGraph.people.slice(0,10).map(e=>{let t=[...new Set(b.peopleGraph.sourceEdges.filter(t=>t.personId===e.id).map(e=>e.toolkit??e.connectorId??e.sourceInstanceId))];return(0,Q.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-panel px-3 py-2.5`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,Q.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:e.label}),(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:e.mentionCount})]}),(0,Q.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:e.emails[0]??e.usernames[0]??e.roles.join(` · `)}),(0,Q.jsx)(`p`,{className:`mt-1 truncate text-[11px] text-fg-subtle`,children:t.join(` · `)})]},e.id)})}):(0,Q.jsx)(`p`,{className:`mt-4 text-sm text-fg-muted`,children:t.peopleGraphSearchEmpty})]}):null,b.loading?(0,Q.jsx)(`div`,{className:`grid gap-3`,"aria-busy":`true`,"aria-label":t.loading,children:at.slice(0,3).map(e=>(0,Q.jsx)(ut,{},e))}):Ee===0?(0,Q.jsxs)(`div`,{className:`rounded-2xl border border-dashed border-edge p-8 text-center`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.connectionsEmpty}),(0,Q.jsx)(W,{type:`button`,variant:`primary`,className:`mt-4`,onClick:()=>De(`discover`),children:t.addFromCatalog})]}):Je===0?(0,Q.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge p-8 text-center text-sm text-fg-muted`,children:t.connectionsSearchEmpty}):(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`,children:[We.map(e=>(0,Q.jsx)(yn,{instance:e,definition:je.get(e.connectorId),highlighted:e.instanceId===fe,onOpenDetails:e=>{pe(null),le(e.instanceId),de(e)},onChanged:Y,t},e.instanceId)),Ge.map(e=>(0,Q.jsx)(Kt,{row:e,t:n,cs:t,onEdit:()=>he({mode:`edit`,row:structuredClone(e)}),onRemove:async()=>Fe(e)},e.clientKey))]})]}):null,_===`discover`&&o?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[m?null:(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,role:`group`,"aria-label":t.taskFilterAria,children:[`all`,...et].map(e=>(0,Q.jsx)(`button`,{type:`button`,className:s(`rounded-full border px-3 py-1.5 text-xs font-medium transition-colors`,ne===e?`border-accent/40 bg-accent-soft text-accent-fg`:`border-edge bg-surface-panel text-fg-muted hover:bg-surface-hover hover:text-fg`),"aria-pressed":ne===e,onClick:()=>re(e),children:e===`all`?t.taskAll:t.connectorBenefitHeadings[e]},e))}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 lg:flex-row lg:items-center`,children:[(0,Q.jsx)(xt,{value:z,onChange:B,placeholder:t.discoverSearchPlaceholder,className:`max-w-xl`}),(0,Q.jsxs)(`div`,{className:s(`grid min-w-0 grid-cols-1 gap-2 lg:ml-auto`,m?`lg:w-52`:`sm:grid-cols-2 lg:w-[26rem]`),children:[m?null:(0,Q.jsx)(R,{value:V,options:Z,placeholder:t.discoverSourceAll,allowEmpty:!1,ariaLabel:t.registrySourceAria,triggerClassName:`h-9 bg-surface-panel text-xs`,onChange:H}),(0,Q.jsx)(R,{value:U,options:[{value:`name`,label:t.sortName},{value:`source`,label:t.sortSource}],placeholder:t.sortName,allowEmpty:!1,ariaLabel:t.sortAria,triggerClassName:`h-9 bg-surface-panel text-xs`,onChange:e=>te(e)})]})]}),(b.loading||S)&&$e.length===0?(0,Q.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`,"aria-busy":`true`,"aria-label":t.loading,children:at.map(e=>(0,Q.jsx)(ct,{},e))}):$e.length===0?(0,Q.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge p-8 text-center text-sm text-fg-muted`,children:t.discoverEmpty}):(0,Q.jsxs)(`div`,{className:`relative`,children:[S?(0,Q.jsx)(`div`,{className:`pointer-events-none absolute inset-0 z-[1] flex justify-center bg-surface-panel/40 pt-[min(28vh,7.5rem)] backdrop-blur-[1px] motion-reduce:backdrop-blur-none dark:bg-surface-base/35`,"aria-busy":`true`,"aria-label":t.loading,children:(0,Q.jsx)(C,{className:`size-8 shrink-0 animate-spin text-accent motion-reduce:animate-none`,strokeWidth:2,"aria-hidden":!0})}):null,(0,Q.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`,children:$e.map(e=>(0,Q.jsx)(rt,{connector:e,installed:Ae.has(e.id)||ot(e,b.instances),onInstall:e=>{if(e.source===`store`){Me(e.id);return}ae(Dn(e))},onOpenDetails:e.source===`store`?void 0:se,t},e.id))}),tt?(0,Q.jsx)(`div`,{className:`mt-4 flex justify-center`,children:(0,Q.jsxs)(W,{type:`button`,variant:`secondary`,disabled:S||T,onClick:()=>void ke({page:O+1,append:!0}),children:[S?(0,Q.jsx)(C,{className:`size-4 animate-spin`}):null,t.loadMore]})}):null]})]}):null]}),ie?(0,Q.jsx)(En,{draft:ie,onChange:ae,onClose:()=>ae(null),t,onInstalled:async e=>{await Y(),await G(),pe(e.instanceId),De(`connected`)}}):null,oe?(0,Q.jsx)(vt,{connector:oe,installed:Ae.has(oe.id)||ot(oe,b.instances),onClose:()=>se(null),onInstall:e=>ae(Dn(e)),t}):null,nt?(0,Q.jsx)(mn,{instance:nt,definition:je.get(nt.connectorId),onClose:()=>{le(null),de(null)},onChanged:Y,t,mcp:n}):null,me?(0,Q.jsx)(Rn,{open:!0,mode:me.mode,initialRow:me.row,existingCustomServers:J,sessionIdleTtlMinutes:ve,config:K,managedServerIds:Ne,t:n,cs:t,onClose:()=>he(null),onSaved:async()=>{await G(),await Y(),De(`connected`)}},`${me.mode}-${me.row.clientKey}`):null,(0,Q.jsx)(bt,{open:ge,sessionIdleTtlMinutes:ve,saving:be,onChange:ye,onSave:Le,onClose:()=>_e(!1),t,mcp:n})]})})}export{Zn as ConnectorsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-JdwAhgNB.js";import{Dt as r,Mt as i,jt as a}from"./index-BzPwnXho.js";var o=e(),s=t();function c(e){let t=(0,o.c)(38),{value:c,onChange:l,disabled:u,wd:d,placeholder:f,inputClassName:p,autoFocus:m,trailing:h}=e,g;t[0]!==l||t[1]!==c?(g={initialPath:c,onPicked:l},t[0]=l,t[1]=c,t[2]=g):g=t[2];let _=a(g),v;t[3]===c?v=t[4]:(v=c.trim(),t[3]=c,t[4]=v);let y=v,b=y?`${y}\n${d.chooseFolder}`:`${f??d.notSet}\n${d.selectWorkingDirectory}`,x;t[5]===p?x=t[6]:(x=n(`min-w-0 flex-1`,p),t[5]=p,t[6]=x);let S=u||_.picking,C;t[7]===l?C=t[8]:(C=e=>void l(e.target.value),t[7]=l,t[8]=C);let w=f??d.pathInputPlaceholder,T;t[9]!==m||t[10]!==x||t[11]!==S||t[12]!==C||t[13]!==w||t[14]!==c?(T=(0,s.jsx)(`input`,{type:`text`,className:x,value:c,disabled:S,onChange:C,placeholder:w,autoFocus:m,autoComplete:`off`,spellCheck:!1}),t[9]=m,t[10]=x,t[11]=S,t[12]=C,t[13]=w,t[14]=c,t[15]=T):T=t[15];let E=u||_.picking,D;t[16]!==b||t[17]!==_.pick||t[18]!==E||t[19]!==c||t[20]!==d.selectWorkingDirectory?(D=(0,s.jsx)(i,{compact:!0,value:c,onPick:_.pick,disabled:E,title:b,"aria-label":d.selectWorkingDirectory}),t[16]=b,t[17]=_.pick,t[18]=E,t[19]=c,t[20]=d.selectWorkingDirectory,t[21]=D):D=t[21];let O;t[22]!==D||t[23]!==h?(O=(0,s.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[D,h]}),t[22]=D,t[23]=h,t[24]=O):O=t[24];let k;t[25]!==O||t[26]!==T?(k=(0,s.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[T,O]}),t[25]=O,t[26]=T,t[27]=k):k=t[27];let A;t[28]!==_.confirmPick||t[29]!==_.hasNativePicker||t[30]!==_.modalOpen||t[31]!==_.setModalOpen||t[32]!==y||t[33]!==d?(A=_.hasNativePicker?null:(0,s.jsx)(r,{open:_.modalOpen,onOpenChange:_.setModalOpen,initialAbsolutePath:y||void 0,onConfirm:_.confirmPick,wd:d}),t[28]=_.confirmPick,t[29]=_.hasNativePicker,t[30]=_.modalOpen,t[31]=_.setModalOpen,t[32]=y,t[33]=d,t[34]=A):A=t[34];let j;return t[35]!==k||t[36]!==A?(j=(0,s.jsxs)(s.Fragment,{children:[k,A]}),t[35]=k,t[36]=A,t[37]=j):j=t[37],j}export{c as t};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{c as i,l as a,t as o}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as s}from"./check-DUBLcKHA.js";import{t as c}from"./cn-JdwAhgNB.js";import{t as l}from"./messages-DQ5X6cXp.js";import{n as u,o as d,r as f}from"./locale-store-Bjvw7jtg.js";import{n as p}from"./activity-store-BwmdJ5pv.js";import{Bo as m,Bs as h,Dn as g,Ds as _,Fo as v,Io as y,Kc as b,Lo as x,Na as S,On as C,Pu as w,Ro as T,Sc as E,St as D,Ua as O,Vo as k,Vs as A,Wc as j,Zl as M,_t as N,bt as P,cu as F,du as I,ec as ee,gt as te,ll as L,mt as ne,mu as re,pt as ie,rt as ae,uu as oe,vt as se,ws as R,wt as ce,xt as le,zo as ue}from"./index-BzPwnXho.js";var z=e(t(),1),B=n();function V(e){try{return decodeURIComponent(e).trim()||null}catch{return null}}function H(e){if(!e)return null;let t=e.split(/[?#]/,1)[0],n=/^\/chat\/([^/]+)\/?$/.exec(t);if(n){let e=V(n[1]);return!e||e===`new`?null:{kind:`session`,id:e}}return null}async function U(e,t){let n=`/api/sessions/${encodeURIComponent(e.id)}?limit=1`;try{return(await d(f(n),{signal:t})).status===404?`missing`:`available`}catch(e){if(t?.aborted)throw e;return`available`}}var W=r(),G=3,K={info:{Icon:L,className:`text-accent-fg bg-accent-soft`},success:{Icon:F,className:`text-success bg-success-soft`},warning:{Icon:h,className:`text-warning bg-warning-soft`},error:{Icon:oe,className:`text-danger bg-danger-soft`}};function de(e,t){let n=Math.max(0,Math.round((Date.now()-e)/1e3));if(n<60)return t===`zh`?`刚刚`:`Just now`;let r=Math.round(n/60);if(r<60)return t===`zh`?`${r} 分钟前`:`${r}m ago`;let i=Math.round(r/60);if(i<24)return t===`zh`?`${i} 小时前`:`${i}h ago`;let a=Math.round(i/24);return t===`zh`?`${a} 天前`:`${a}d ago`}function q(e){let t=(0,B.c)(55),{item:n,targetAvailability:r}=e,i=u(pe),a;t[0]===i?a=t[1]:(a=l(i),t[0]=i,t[1]=a);let s=a.projectsPage.home,d=p(fe),{Icon:f,className:m}=K[n.tone],h;t[2]===m?h=t[3]:(h=c(`mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-lg`,m),t[2]=m,t[3]=h);let g;t[4]!==f||t[5]!==n.status?(g=n.status===`running`?(0,W.jsx)(b,{className:`size-3.5 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):(0,W.jsx)(f,{className:`size-3.5`,"aria-hidden":!0}),t[4]=f,t[5]=n.status,t[6]=g):g=t[6];let v;t[7]!==h||t[8]!==g?(v=(0,W.jsx)(`div`,{className:h,children:g}),t[7]=h,t[8]=g,t[9]=v):v=t[9];let y;t[10]===n.title?y=t[11]:(y=(0,W.jsx)(`h3`,{className:`min-w-0 flex-1 text-sm font-medium leading-5 text-fg`,children:n.title}),t[10]=n.title,t[11]=y);let x;t[12]!==s.activityUnread||t[13]!==n.read?(x=n.read?null:(0,W.jsx)(`span`,{className:`mt-1.5 size-1.5 shrink-0 rounded-full bg-accent`,"aria-label":s.activityUnread}),t[12]=s.activityUnread,t[13]=n.read,t[14]=x):x=t[14];let C;t[15]!==y||t[16]!==x?(C=(0,W.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[y,x]}),t[15]=y,t[16]=x,t[17]=C):C=t[17];let w;t[18]===n.message?w=t[19]:(w=n.message?(0,W.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs leading-5 text-fg-muted`,children:n.message}):null,t[18]=n.message,t[19]=w);let T;t[20]===n.source?T=t[21]:(T=n.source?(0,W.jsx)(`span`,{className:`max-w-48 truncate`,children:n.source}):null,t[20]=n.source,t[21]=T);let E;t[22]!==n.updatedAt||t[23]!==i?(E=de(n.updatedAt,i),t[22]=n.updatedAt,t[23]=i,t[24]=E):E=t[24];let D;t[25]===E?D=t[26]:(D=(0,W.jsx)(`span`,{children:E}),t[25]=E,t[26]=D);let O;t[27]===n.occurrences?O=t[28]:(O=n.occurrences>1?(0,W.jsxs)(`span`,{children:[`×`,n.occurrences]}):null,t[27]=n.occurrences,t[28]=O);let k;t[29]!==s.activityCheckingRelated||t[30]!==s.activityRelatedMissing||t[31]!==s.activityViewRelated||t[32]!==n.href||t[33]!==r?(k=n.href&&r===`available`?(0,W.jsxs)(o,{to:n.href,className:`inline-flex items-center gap-0.5 font-medium text-accent-fg hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[s.activityViewRelated,(0,W.jsx)(I,{className:`size-3`,"aria-hidden":!0})]}):n.href&&r===`checking`?(0,W.jsx)(S,{className:`h-3 w-20 rounded`,"aria-label":s.activityCheckingRelated}):n.href&&r===`missing`?(0,W.jsx)(`span`,{className:`font-medium text-fg-subtle`,role:`status`,children:s.activityRelatedMissing}):null,t[29]=s.activityCheckingRelated,t[30]=s.activityRelatedMissing,t[31]=s.activityViewRelated,t[32]=n.href,t[33]=r,t[34]=k):k=t[34];let A;t[35]!==D||t[36]!==O||t[37]!==k||t[38]!==T?(A=(0,W.jsxs)(`div`,{className:`mt-1.5 flex min-w-0 flex-wrap items-center gap-x-2 text-[11px] text-fg-subtle`,children:[T,D,O,k]}),t[35]=D,t[36]=O,t[37]=k,t[38]=T,t[39]=A):A=t[39];let j;t[40]!==A||t[41]!==C||t[42]!==w?(j=(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[C,w,A]}),t[40]=A,t[41]=C,t[42]=w,t[43]=j):j=t[43];let M;t[44]!==n.id||t[45]!==d?(M=()=>d(n.id),t[44]=n.id,t[45]=d,t[46]=M):M=t[46];let N;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,W.jsx)(_,{className:`size-3.5`,"aria-hidden":!0}),t[47]=N):N=t[47];let P;t[48]!==s.activityRemove||t[49]!==M?(P=(0,W.jsx)(`button`,{type:`button`,className:`rounded-md p-1 text-fg-subtle opacity-0 transition-opacity hover:bg-surface-hover hover:text-fg group-hover:opacity-100 focus:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":s.activityRemove,onClick:M,children:N}),t[48]=s.activityRemove,t[49]=M,t[50]=P):P=t[50];let F;return t[51]!==j||t[52]!==P||t[53]!==v?(F=(0,W.jsxs)(`article`,{className:`group flex items-start gap-3 border-t border-edge-subtle px-1 py-3 first:border-t-0`,children:[v,j,P]}),t[51]=j,t[52]=P,t[53]=v,t[54]=F):F=t[54],F}function fe(e){return e.remove}function pe(e){return e.language}function me(){let e=(0,B.c)(14),t=l(u(xe)).projectsPage.home,n=p(be),r=p(ye),i=p(ve),[a,o]=(0,z.useState)(!1),c;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(c={},e[0]=c):c=e[0];let[d,f]=(0,z.useState)(c),m;e[1]===n?m=e[2]:(m=n.filter(Q),e[1]=n,e[2]=m);let h=m.length,g;e[3]===n?g=e[4]:(g=n.filter(Z),e[3]=n,e[4]=g);let _=g.length,v;e[5]!==a||e[6]!==n?(v=a?n:n.slice(0,G),e[5]=a,e[6]=n,e[7]=v):v=e[7];let y=v,x;e[8]===n?x=e[9]:(x=[...new Set(n.flatMap(_e))].sort().join(`
|
|
2
|
-
`),e[8]=n,e[9]=x);let S=x,C,T;e[10]===S?(C=e[11],T=e[12]):(C=()=>{let e=new AbortController,t=new Map((S?S.split(`
|
|
3
|
-
`):[]).flatMap(ge));return f(Object.fromEntries([...t.keys()].map(he))),Promise.all([...t].map(async t=>{let[n,r]=t,i=await U(r,e.signal);e.signal.aborted||f(e=>({...e,[n]:i}))})).catch(X),()=>e.abort()},T=[S],e[10]=S,e[11]=C,e[12]=T),(0,z.useEffect)(C,T);let E;return e[13]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,W.jsx)(w,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),e[13]=E):E=e[13],(0,W.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-4 shadow-surface`,"aria-labelledby":`workbench-activity-title`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,W.jsx)(`div`,{children:(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[E,(0,W.jsx)(`h2`,{id:`workbench-activity-title`,className:`text-sm font-semibold text-fg`,children:t.activityTitle}),h>0?(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,children:[(0,W.jsx)(b,{className:`size-3 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}),h,` `,t.running]}):_>0?(0,W.jsxs)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:[_,` `,t.activityNew]}):null]})}),a&&n.length>0?(0,W.jsxs)(`div`,{className:`flex items-center gap-1`,children:[_>0?(0,W.jsxs)(R,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:r,children:[(0,W.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),t.activityMarkRead]}):null,n.some(Y)?(0,W.jsxs)(R,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs text-fg-muted`,onClick:i,children:[(0,W.jsx)(A,{className:`size-3.5`,"aria-hidden":!0}),t.activityClearFinished]}):null]}):null]}),n.length>0?(0,W.jsxs)(`div`,{className:`mt-3 px-1`,children:[y.map(e=>(0,W.jsx)(q,{item:e,targetAvailability:e.href&&H(e.href)?d[e.href]??`checking`:`available`},e.id)),n.length>G?(0,W.jsx)(`div`,{className:`border-t border-edge-subtle py-2 text-center`,children:(0,W.jsx)(R,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>o(J),children:a?t.activityShowLess:t.activityShowAll.replace(`{{count}}`,String(n.length))})}):null]}):(0,W.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 text-sm text-fg-muted`,children:[(0,W.jsx)(M,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),(0,W.jsx)(`p`,{children:t.activityEmpty})]})]})}function J(e){return!e}function Y(e){return e.status===`done`}function X(){}function he(e){return[e,`checking`]}function ge(e){let t=H(e);return t?[[e,t]]:[]}function _e(e){return e.href&&H(e.href)?[e.href]:[]}function Z(e){return!e.read}function Q(e){return e.status===`running`}function ve(e){return e.clearFinished}function ye(e){return e.markAllRead}function be(e){return e.items}function xe(e){return e.language}function Se(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function Ce(e,t){if(e==null)return t;let n=new Date(e);return Number.isNaN(n.getTime())?t:ae(n)}function $(e){let t=(0,B.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,W.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=r),r}function we(e){let t=(0,B.c)(18),{task:n,statusLabel:r,backgroundPath:i}=e,a;t[0]!==i||t[1]!==n.id?(a=C(i,n.id),t[0]=i,t[1]=n.id,t[2]=a):a=t[2];let s;t[3]===n.title?s=t[4]:(s=(0,W.jsx)(`h3`,{className:`line-clamp-2 text-sm font-semibold text-fg`,children:n.title}),t[3]=n.title,t[4]=s);let c;t[5]===n.updatedAt?c=t[6]:(c=Ce(n.updatedAt,``),t[5]=n.updatedAt,t[6]=c);let l;t[7]===c?l=t[8]:(l=(0,W.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:c}),t[7]=c,t[8]=l);let u;t[9]!==s||t[10]!==l?(u=(0,W.jsxs)(`div`,{className:`min-w-0`,children:[s,l]}),t[9]=s,t[10]=l,t[11]=u):u=t[11];let d;t[12]===r?d=t[13]:(d=(0,W.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-muted px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:r}),t[12]=r,t[13]=d);let f;return t[14]!==a||t[15]!==u||t[16]!==d?(f=(0,W.jsxs)(o,{to:a,className:`group flex items-start justify-between gap-3 rounded-xl border border-edge-subtle bg-surface-panel p-4 transition-colors hover:bg-surface-hover/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[u,d]}),t[14]=a,t[15]=u,t[16]=d,t[17]=f):f=t[17],f}function Te(e){let t=(0,B.c)(12),{receipt:n,evidenceLabel:r,remainingLabel:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,W.jsx)(F,{className:`mt-0.5 size-4 shrink-0 text-success`,"aria-hidden":!0}),t[0]=a):a=t[0];let o,s;t[1]===n.summary?(o=t[2],s=t[3]):(o=(0,W.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:n.summary}),s=(0,W.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:n.summary}),t[1]=n.summary,t[2]=o,t[3]=s);let c=n.remainingWork.length>0?` · ${n.remainingWork.length} ${i}`:``,l;t[4]!==r||t[5]!==n.evidence.length||t[6]!==c?(l=(0,W.jsxs)(`p`,{className:`mt-2 text-[11px] text-fg-subtle`,children:[n.evidence.length,` `,r,c]}),t[4]=r,t[5]=n.evidence.length,t[6]=c,t[7]=l):l=t[7];let u;return t[8]!==o||t[9]!==s||t[10]!==l?(u=(0,W.jsx)(`div`,{className:`block rounded-xl border border-edge-subtle px-3 py-3`,children:(0,W.jsxs)(`div`,{className:`flex items-start gap-2`,children:[a,(0,W.jsxs)(`div`,{className:`min-w-0`,children:[o,s,l]})]})}),t[8]=o,t[9]=s,t[10]=l,t[11]=u):u=t[11],u}function Ee(){let e=(0,B.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,W.jsxs)(`div`,{className:`space-y-5`,"aria-busy":!0,children:[(0,W.jsx)(S,{className:`h-20 rounded-2xl`}),(0,W.jsx)(S,{className:`h-72 rounded-2xl`}),(0,W.jsx)(S,{className:`h-44 rounded-2xl`})]}),e[0]=t):t=e[0],t}function De(e){let t=(0,B.c)(15),{chat:n,statusLabel:r}=e,i=`/chat/${encodeURIComponent(n.key)}`,a;t[0]===n.name?a=t[1]:(a=(0,W.jsx)(`h3`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:n.name}),t[0]=n.name,t[1]=a);let s;t[2]===r?s=t[3]:(s=(0,W.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-muted px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:r}),t[2]=r,t[3]=s);let c;t[4]!==a||t[5]!==s?(c=(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[a,s]}),t[4]=a,t[5]=s,t[6]=c):c=t[6];let l;t[7]===n.updatedAt?l=t[8]:(l=Ce(n.updatedAt,``),t[7]=n.updatedAt,t[8]=l);let u;t[9]===l?u=t[10]:(u=(0,W.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:l}),t[9]=l,t[10]=u);let d;return t[11]!==i||t[12]!==c||t[13]!==u?(d=(0,W.jsxs)(o,{to:i,className:`group block rounded-xl border border-edge-subtle bg-surface-panel p-4 transition-colors hover:bg-surface-hover/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[c,u]}),t[11]=i,t[12]=c,t[13]=u,t[14]=d):d=t[14],d}function Oe(e){let t=(0,B.c)(27),{item:n,href:r,kindLabel:i,reasonLabel:a,approveLabel:s,denyLabel:c,busy:l,onRespond:u}=e,d;t[0]===n.title?d=t[1]:(d=(0,W.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:n.title}),t[0]=n.title,t[1]=d);let f=n.projectName||i,p;t[2]===f?p=t[3]:(p=(0,W.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:f}),t[2]=f,t[3]=p);let m;t[4]!==d||t[5]!==p?(m=(0,W.jsxs)(`div`,{className:`min-w-0`,children:[d,p]}),t[4]=d,t[5]=p,t[6]=m):m=t[6];let h;t[7]===a?h=t[8]:(h=(0,W.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-panel/80 px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:a}),t[7]=a,t[8]=h);let g;t[9]!==m||t[10]!==h?(g=(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[m,h]}),t[9]=m,t[10]=h,t[11]=g):g=t[11];let _;t[12]===n.detail?_=t[13]:(_=n.detail?(0,W.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-5 text-fg-muted`,children:n.detail}):null,t[12]=n.detail,t[13]=_);let v;t[14]!==r||t[15]!==g||t[16]!==_?(v=(0,W.jsxs)(o,{to:r,className:`group block focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[g,_]}),t[14]=r,t[15]=g,t[16]=_,t[17]=v):v=t[17];let y;t[18]!==s||t[19]!==l||t[20]!==c||t[21]!==n.response||t[22]!==u?(y=n.response?(0,W.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2 border-t border-warning/20 pt-3`,children:[(0,W.jsx)(R,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:l,onClick:()=>u(`deny`),children:c}),(0,W.jsx)(R,{type:`button`,variant:`primary`,className:`h-8 px-2`,disabled:l,onClick:()=>u(`approve`),children:s})]}):null,t[18]=s,t[19]=l,t[20]=c,t[21]=n.response,t[22]=u,t[23]=y):y=t[23];let b;return t[24]!==v||t[25]!==y?(b=(0,W.jsxs)(`article`,{className:`rounded-xl border border-warning/35 bg-warning-soft/25 p-3.5 transition-colors hover:bg-warning-soft/40`,children:[v,y]}),t[24]=v,t[25]=y,t[26]=b):b=t[26],b}function ke(e){let t=(0,B.c)(65),{item:n,labels:r,busy:i,onDecide:a,onSnooze:o,onDismiss:s,onInstruct:c}=e,[l,u]=(0,z.useState)(``),d=n.judgment,f;t[0]===n.title?f=t[1]:(f=(0,W.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.title}),t[0]=n.title,t[1]=f);let p;t[2]===n.detail?p=t[3]:(p=(0,W.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:n.detail}),t[2]=n.detail,t[3]=p);let m;t[4]!==f||t[5]!==p?(m=(0,W.jsxs)(`div`,{className:`min-w-0`,children:[f,p]}),t[4]=f,t[5]=p,t[6]=m):m=t[6];let h;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,W.jsx)(ee,{className:`size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[7]=h):h=t[7];let g;t[8]===m?g=t[9]:(g=(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[m,h]}),t[8]=m,t[9]=g);let _;t[10]!==d.whyNow||t[11]!==r.whyNow?(_=[r.whyNow,d.whyNow],t[10]=d.whyNow,t[11]=r.whyNow,t[12]=_):_=t[12];let v;t[13]!==d.impact||t[14]!==r.impact?(v=[r.impact,d.impact],t[13]=d.impact,t[14]=r.impact,t[15]=v):v=t[15];let y;t[16]!==d.workDone||t[17]!==r.workDone?(y=[r.workDone,d.workDone],t[16]=d.workDone,t[17]=r.workDone,t[18]=y):y=t[18];let b;t[19]!==d.recommendation||t[20]!==r.recommendation?(b=[r.recommendation,d.recommendation],t[19]=d.recommendation,t[20]=r.recommendation,t[21]=b):b=t[21];let x;t[22]!==_||t[23]!==v||t[24]!==y||t[25]!==b?(x=(0,W.jsx)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[_,v,y,b].map(Ae)}),t[22]=_,t[23]=v,t[24]=y,t[25]=b,t[26]=x):x=t[26];let S;t[27]!==i||t[28]!==d.decision||t[29]!==a?(S=d.decision?(0,W.jsxs)(`div`,{className:`mt-4`,children:[(0,W.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:d.decision.question}),(0,W.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:d.decision.options.map(e=>(0,W.jsxs)(R,{type:`button`,variant:`secondary`,className:`h-auto min-h-9 flex-col items-start px-3 py-2 text-left`,disabled:i,title:e.consequence,onClick:()=>a(e.id),children:[(0,W.jsx)(`span`,{children:e.label}),(0,W.jsx)(`span`,{className:`text-[10px] font-normal text-fg-muted`,children:e.consequence})]},e.id))})]}):null,t[27]=i,t[28]=d.decision,t[29]=a,t[30]=S):S=t[30];let C;t[31]!==i||t[32]!==r.snooze||t[33]!==o?(C=(0,W.jsx)(R,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:i,onClick:o,children:r.snooze}),t[31]=i,t[32]=r.snooze,t[33]=o,t[34]=C):C=t[34];let w;t[35]!==i||t[36]!==r.dismiss||t[37]!==s?(w=(0,W.jsx)(R,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:i,onClick:s,children:r.dismiss}),t[35]=i,t[36]=r.dismiss,t[37]=s,t[38]=w):w=t[38];let T;t[39]!==C||t[40]!==w?(T=(0,W.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2 border-t border-edge-subtle pt-3`,children:[C,w]}),t[39]=C,t[40]=w,t[41]=T):T=t[41];let E;t[42]!==l||t[43]!==c?(E=e=>{e.preventDefault();let t=l.trim();t&&(c(t),u(``))},t[42]=l,t[43]=c,t[44]=E):E=t[44];let D;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>u(e.target.value),t[45]=D):D=t[45];let O;t[46]!==l||t[47]!==r.feedbackPlaceholder?(O=(0,W.jsx)(`input`,{className:`min-w-0 flex-1 rounded-lg border border-edge bg-surface-base px-3 py-2 text-xs text-fg outline-none focus:border-accent`,value:l,onChange:D,placeholder:r.feedbackPlaceholder}),t[46]=l,t[47]=r.feedbackPlaceholder,t[48]=O):O=t[48];let k;t[49]!==i||t[50]!==l?(k=i||!l.trim(),t[49]=i,t[50]=l,t[51]=k):k=t[51];let A;t[52]!==r.applyFeedback||t[53]!==k?(A=(0,W.jsx)(R,{type:`submit`,variant:`secondary`,className:`h-9 px-3`,disabled:k,children:r.applyFeedback}),t[52]=r.applyFeedback,t[53]=k,t[54]=A):A=t[54];let j;t[55]!==E||t[56]!==O||t[57]!==A?(j=(0,W.jsxs)(`form`,{className:`mt-3 flex gap-2`,onSubmit:E,children:[O,A]}),t[55]=E,t[56]=O,t[57]=A,t[58]=j):j=t[58];let M;return t[59]!==x||t[60]!==S||t[61]!==T||t[62]!==j||t[63]!==g?(M=(0,W.jsxs)(`article`,{className:`rounded-xl border border-accent/25 bg-accent-soft/15 p-4`,children:[g,x,S,T,j]}),t[59]=x,t[60]=S,t[61]=T,t[62]=j,t[63]=g,t[64]=M):M=t[64],M}function Ae(e){let[t,n]=e;return(0,W.jsxs)(`div`,{className:`rounded-lg bg-surface-panel/80 p-3`,children:[(0,W.jsx)(`p`,{className:`text-[11px] font-medium text-fg-subtle`,children:t}),(0,W.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg`,children:n})]},t)}function je(e){let t=(0,B.c)(32),{item:n,href:r,statusLabel:i,retryLabel:a,viewLabel:s,acknowledgeLabel:c,busy:l,onView:u,onRetry:d,onAcknowledge:f}=e,p;t[0]===n.title?p=t[1]:(p=(0,W.jsx)(`h3`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:n.title}),t[0]=n.title,t[1]=p);let m;t[2]===i?m=t[3]:(m=(0,W.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-panel/80 px-2 py-0.5 text-[11px] font-medium text-danger`,children:i}),t[2]=i,t[3]=m);let h;t[4]!==p||t[5]!==m?(h=(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[p,m]}),t[4]=p,t[5]=m,t[6]=h):h=t[6];let g;t[7]===n.detail?g=t[8]:(g=(0,W.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:n.detail}),t[7]=n.detail,t[8]=g);let _;t[9]!==r||t[10]!==h||t[11]!==g?(_=(0,W.jsxs)(o,{to:r,className:`block focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[h,g]}),t[9]=r,t[10]=h,t[11]=g,t[12]=_):_=t[12];let v;t[13]!==c||t[14]!==l||t[15]!==f?(v=(0,W.jsx)(R,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:l,onClick:f,children:c}),t[13]=c,t[14]=l,t[15]=f,t[16]=v):v=t[16];let y;t[17]!==l||t[18]!==u||t[19]!==s?(y=(0,W.jsx)(R,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:l,onClick:u,children:s}),t[17]=l,t[18]=u,t[19]=s,t[20]=y):y=t[20];let b;t[21]!==l||t[22]!==d||t[23]!==a?(b=(0,W.jsx)(R,{type:`button`,variant:`primary`,className:`h-8 px-2`,disabled:l,onClick:d,children:a}),t[21]=l,t[22]=d,t[23]=a,t[24]=b):b=t[24];let x;t[25]!==v||t[26]!==y||t[27]!==b?(x=(0,W.jsxs)(`div`,{className:`mt-3 flex flex-wrap justify-end gap-2 border-t border-danger/15 pt-3`,children:[v,y,b]}),t[25]=v,t[26]=y,t[27]=b,t[28]=x):x=t[28];let S;return t[29]!==_||t[30]!==x?(S=(0,W.jsxs)(`article`,{className:`rounded-xl border border-danger/25 bg-danger-soft/35 p-3.5`,children:[_,x]}),t[29]=_,t[30]=x,t[31]=S):S=t[31],S}function Me(){let e=u(e=>e.language),t=l(e).projectsPage,n=ie(e),r=a(),s=i(),c=`${s.pathname}${s.search}`,d=O(e=>e.setPageHeader),f=O(e=>e.clearPageHeader),[p,h]=(0,z.useState)(null),[b,S]=(0,z.useState)(!0),[w,A]=(0,z.useState)(null),[M,I]=(0,z.useState)(!1),[L,ae]=(0,z.useState)(``),[B,V]=(0,z.useState)(()=>crypto.randomUUID()),[H,U]=(0,z.useState)(!1),[G,K]=(0,z.useState)(null),[de,q]=(0,z.useState)(null),[fe,pe]=(0,z.useState)(null),J=(0,z.useCallback)(async(t=!1)=>{t&&S(!0),A(null);try{h(await se(e))}catch(e){A(e instanceof Error?e.message:String(e))}finally{S(!1)}},[e]);(0,z.useEffect)(()=>{J(!0)},[J]),(0,z.useEffect)(()=>{let e,t=t=>{e!==void 0&&window.clearTimeout(e),e=window.setTimeout(()=>{e=void 0,J()},t)},n=()=>t(100),r=()=>t(750),i=[`session-created`,`agent-run-started`,`agent-run-ended`,`automation-run-completed`,`workflow-run-updated`,`workflow-run-error`],a=[`session-updated`,`session-transcript-updated`];return i.forEach(e=>window.addEventListener(e,n)),a.forEach(e=>window.addEventListener(e,r)),()=>{i.forEach(e=>window.removeEventListener(e,n)),a.forEach(e=>window.removeEventListener(e,r)),e!==void 0&&window.clearTimeout(e)}},[J]);let Y=(0,z.useMemo)(()=>p?.decisions??[],[p]),X=(0,z.useMemo)(()=>p?.attention??[],[p]),he=(0,z.useCallback)(async t=>{t.preventDefault();let n=L.trim();if(!(!n||H)){U(!0),K(null);try{let t=await te({idempotencyKey:B,title:n,locale:e,priority:`normal`,contract:{objective:n,expectedOutputs:[],acceptanceCriteria:[],constraints:[],approvalRequired:[],assumptions:[],risks:[],acceptancePolicy:`manual`,outputDestinations:[]},dependencies:[],context:[],authorityGrants:[],activation:{mode:`start`,executor:{kind:`agent`,agentId:`main`}}});I(!1),ae(``),V(crypto.randomUUID()),r(C(c,t.task.id))}catch(e){K(e instanceof Error?e.message:String(e))}finally{U(!1)}}},[c,B,H,e,r,L]),ge=(0,z.useMemo)(()=>(0,W.jsxs)(R,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>I(!0),children:[(0,W.jsx)(E,{className:`size-4`,"aria-hidden":!0}),n.newWork]}),[n.newWork]),_e=(0,z.useCallback)(async(e,t)=>{if(e.response){q(e.id),A(null);try{await le(e.response,t),await J()}catch(e){A(e instanceof Error?e.message:String(e))}finally{q(null)}}},[J]),Z=(0,z.useCallback)(async(e,t)=>{q(e.id),A(null);try{await t(),await J()}catch(e){A(e instanceof Error?e.message:String(e))}finally{q(null)}},[J]),Q=(0,z.useCallback)(async(e,t)=>{pe(e.id),A(null);try{await t({kind:e.kind,runId:e.runId}),await J()}catch(e){A(e instanceof Error?e.message:String(e))}finally{pe(null)}},[J]);return(0,z.useLayoutEffect)(()=>(d({startExtra:null,main:(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.title}),(0,W.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:t.home.subtitle})]}),end:ge}),()=>f()),[f,ge,d,t.title,t.home.subtitle]),(0,W.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[1200px] flex-1 flex-col gap-7 px-4 py-7 sm:px-6 lg:px-8 lg:py-9`,children:[(0,W.jsx)(v,{open:M,onOpenChange:e=>{H||I(e),e&&(K(null),V(crypto.randomUUID()))},children:(0,W.jsxs)(m,{children:[(0,W.jsx)(ue,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,W.jsxs)(x,{className:`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-panel shadow-float focus:outline-none`,children:[(0,W.jsxs)(`div`,{className:`flex shrink-0 items-start gap-4 border-b border-edge px-5 py-4`,children:[(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsx)(k,{className:`text-base font-semibold text-fg`,children:n.dialogTitle}),(0,W.jsx)(T,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:n.dialogDescription})]}),(0,W.jsx)(y,{asChild:!0,children:(0,W.jsx)(R,{type:`button`,variant:`ghost`,className:`-mr-2 -mt-1 size-8 shrink-0 rounded-lg p-0`,title:t.cancel,"aria-label":t.cancel,children:(0,W.jsx)(_,{className:`size-4`,"aria-hidden":!0})})})]}),(0,W.jsxs)(`form`,{onSubmit:he,className:`flex min-h-0 flex-1 flex-col`,children:[(0,W.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto px-5 py-4`,children:[(0,W.jsx)(`label`,{htmlFor:`new-work-task`,className:`mb-2 shrink-0 text-sm font-medium text-fg`,children:n.intentLabel}),(0,W.jsx)(`textarea`,{id:`new-work-task`,className:`min-h-32 w-full flex-1 resize-none rounded-xl border border-edge bg-surface-base p-3 text-sm font-normal leading-6 text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`,value:L,onChange:e=>{ae(e.target.value),V(crypto.randomUUID())},onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())},placeholder:n.intentPlaceholder,maxLength:12e3,autoFocus:!0}),(0,W.jsxs)(`div`,{className:`mt-2 flex shrink-0 items-center justify-between gap-3 text-[11px] text-fg-subtle`,children:[(0,W.jsx)(`span`,{children:t.home.submitShortcut}),(0,W.jsxs)(`span`,{className:`tabular-nums`,children:[L.length.toLocaleString(),` / `,12e3.toLocaleString()]})]}),G?(0,W.jsx)(`p`,{className:`mt-3 text-sm text-danger`,children:G}):null]}),(0,W.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,W.jsx)(y,{asChild:!0,children:(0,W.jsx)(R,{type:`button`,variant:`ghost`,disabled:H,children:t.cancel})}),(0,W.jsxs)(R,{type:`submit`,variant:`primary`,className:`min-w-32`,disabled:!L.trim()||H,children:[(0,W.jsx)(ee,{className:`size-4`,"aria-hidden":!0}),H?n.starting:n.submit]})]})]})]})]})}),w?(0,W.jsxs)(`div`,{className:`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,W.jsx)(`span`,{children:w}),(0,W.jsx)(R,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void J(),children:t.home.retry})]}):null,b?(0,W.jsx)(Ee,{}):p?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`section`,{className:`border-b border-edge-subtle pb-5`,children:[(0,W.jsx)(`p`,{className:`text-xs font-medium text-fg-subtle`,children:t.home.briefingTitle}),(0,W.jsx)(`h2`,{className:`mt-1 text-xl font-semibold tracking-tight text-fg`,children:p.decisions.length+p.attention.length>0?Se(t.home.todaySummary,{attention:p.decisions.length+p.attention.length,moving:p.briefing.progress.movingCount+p.chats.running.length}):Se(t.home.todaySummaryClear,{moving:p.briefing.progress.movingCount+p.chats.running.length})}),p.briefing.summary?(0,W.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm leading-6 text-fg-muted`,children:p.briefing.summary}):null]}),p.tasks.running.length===0&&p.workflowRuns.active.length===0&&p.decisions.length===0&&p.attention.length===0&&p.chats.running.length===0&&p.chats.recent.length===0&&p.upcomingAutomations.length===0?(0,W.jsxs)(`section`,{className:`rounded-2xl border border-dashed border-edge p-8 text-center`,children:[(0,W.jsx)(j,{className:`mx-auto size-6 text-accent`,"aria-hidden":!0}),(0,W.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-fg`,children:t.home.emptyTitle}),(0,W.jsx)(`p`,{className:`mx-auto mt-1 max-w-lg text-sm leading-6 text-fg-muted`,children:t.home.emptyBody}),(0,W.jsxs)(`div`,{className:`mt-4 flex justify-center gap-2`,children:[(0,W.jsx)(R,{type:`button`,variant:`primary`,onClick:()=>r(`/chat/new`),children:t.home.startChat}),(0,W.jsx)(R,{type:`button`,variant:`secondary`,onClick:()=>I(!0),children:n.newWork})]})]}):null,(0,W.jsxs)(`div`,{className:`grid items-start gap-6 xl:grid-cols-[minmax(0,2fr)_minmax(18rem,1fr)]`,children:[(0,W.jsxs)(`div`,{className:`min-w-0 space-y-6`,children:[X.length>0?(0,W.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(oe,{className:`size-4 text-danger`,"aria-hidden":!0}),(0,W.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.runAttention}),(0,W.jsx)($,{children:X.length.toLocaleString()})]}),(0,W.jsx)(`div`,{className:`mt-4 space-y-2`,children:X.map(e=>(0,W.jsx)(je,{item:e,href:g(c,e.href),statusLabel:e.reason===`run_timeout`?t.home.attentionTimeout:t.home.attentionFailed,retryLabel:t.home.attentionRetry,viewLabel:t.home.attentionView,acknowledgeLabel:t.home.attentionAcknowledge,busy:fe===e.id,onView:()=>r(g(c,e.href)),onRetry:()=>void Q(e,D),onAcknowledge:()=>void Q(e,ne)},e.id))})]}):null,Y.length>0?(0,W.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(oe,{className:`size-4 text-warning`,"aria-hidden":!0}),(0,W.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.needsAttention}),(0,W.jsx)($,{children:Y.length.toLocaleString()})]}),(0,W.jsx)(`div`,{className:`mt-4 space-y-2`,children:Y.map(e=>e.kind===`agent_judgment`&&e.judgment?(0,W.jsx)(ke,{item:e,labels:n,busy:de===e.id,onDecide:t=>void Z(e,()=>N(e.judgment.inboxItemId,t)),onSnooze:()=>void Z(e,()=>ce(e.judgment.inboxItemId,`snoozed`)),onDismiss:()=>void Z(e,()=>ce(e.judgment.inboxItemId,`resolved`)),onInstruct:t=>void Z(e,()=>P(e.judgment.inboxItemId,t))},e.id):(0,W.jsx)(Oe,{item:e,href:g(c,e.href),kindLabel:t.home.decisionKinds[e.kind],reasonLabel:t.home.decisionReasons[e.reason],approveLabel:t.home.approve,denyLabel:t.home.deny,busy:de===e.id,onRespond:t=>void _e(e,t)},e.id))})]}):(0,W.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-fg-muted`,children:[(0,W.jsx)(`span`,{className:`flex size-5 items-center justify-center rounded-full bg-success-soft text-xs text-success`,"aria-hidden":!0,children:`✓`}),t.home.nothingNeedsYou]}),(0,W.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(ee,{className:`size-4 text-accent`,"aria-hidden":!0}),(0,W.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.running}),(0,W.jsx)($,{children:p.tasks.running.length.toLocaleString()})]}),(0,W.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[p.tasks.running.map(e=>(0,W.jsx)(we,{task:e,statusLabel:n.taskStatuses.running,backgroundPath:c},e.id)),p.tasks.running.length===0?(0,W.jsx)(`p`,{className:`py-6 text-center text-sm text-fg-muted`,children:n.emptyRunning}):null]})]}),p.chats.recent.length>0?(0,W.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,W.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,W.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.recent})}),(0,W.jsx)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:p.chats.recent.slice(0,6).map(e=>(0,W.jsx)(De,{chat:e,statusLabel:n.openChat},e.key))})]}):null]}),(0,W.jsxs)(`aside`,{className:`min-w-0 space-y-4`,"aria-label":t.home.nowTitle,children:[(0,W.jsx)(`div`,{className:`px-1`,children:(0,W.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.home.nowTitle})}),p.upcomingAutomations.length>0?(0,W.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-4 shadow-surface`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(re,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),(0,W.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.home.scheduled})]}),(0,W.jsx)(`div`,{className:`mt-2 divide-y divide-edge-subtle`,children:p.upcomingAutomations.slice(0,3).map(e=>(0,W.jsxs)(o,{to:`/automations`,className:`flex items-center justify-between gap-3 rounded-lg px-1 py-3 text-sm hover:bg-surface-hover/55`,children:[(0,W.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.name||e.action}),(0,W.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,children:Ce(e.nextRunAt,t.never)})]},e.id))})]}):null,p.recentTasks.length>0?(0,W.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-4 shadow-surface`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(F,{className:`size-4 text-success`,"aria-hidden":!0}),(0,W.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.recentTasks})]}),(0,W.jsx)(`div`,{className:`mt-3 space-y-2`,children:p.recentTasks.slice(0,3).map(e=>(0,W.jsx)(Te,{receipt:e,evidenceLabel:n.evidenceCount,remainingLabel:n.remainingCount},e.runId))})]}):null,(0,W.jsx)(me,{}),p.briefing.wins.length>0?(0,W.jsxs)(o,{to:p.briefing.wins[0].href,className:`flex items-center justify-between gap-3 rounded-xl px-2 py-2 text-sm text-fg-muted hover:bg-surface-hover/55 hover:text-fg`,children:[(0,W.jsx)(`span`,{children:Se(t.home.completedSummary,{count:p.briefing.wins.length})}),(0,W.jsxs)(`span`,{className:`shrink-0 text-xs font-medium text-accent`,children:[t.home.viewLatestResult,` →`]})]}):null]})]})]}):null]})}export{Me as HomePage};
|