@xopcai/xopc 0.0.151 → 0.0.153
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/{activity-store-uu1xu9Pl.js → activity-store-XA9328eM.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BuO-OVfD.js → agent-avatar-dicebear-E09Jv6kW.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-Bpv3h31T.js → agents-BA46Lyc7.js} +1 -1
- package/dist/gateway/static/root/assets/{api-CwL38LEV.js → api-kQEpNIa-.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-B6OU3Eol.js → app-management-settings-panel-BzrND8g7.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-BaP4GFvN.js → appearance-settings-CKMCWf75.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-DZKNIMRg.js → apps-page-DPP_gFCc.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-CJX3zIh_.js → archive-plugin-DNOroxSq.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-CI1ejk_l.js → attachment-load-PtKuOOfL.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-suggestion-card-CjmhICbv.js → automation-suggestion-card-C7HQ5bAK.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-BtZl3B8m.js → automations-page-BuMTtTYy.js} +1 -1
- package/dist/gateway/static/root/assets/{binary-plugins-CZ8nOXqK.js → binary-plugins-DDFoTNKm.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-BoSfyS_j.js → block-editor-CH_e8EXF.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-CL1UiPcb.js → browser-settings-page-43uOCSrE.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-api-XzDKxPZ8.js → capability-presets-api-Cby6Utaf.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-settings-panel-Dc_uHYgl.js → capability-presets-settings-panel-BZvp3H2p.js} +1 -1
- package/dist/gateway/static/root/assets/{channel-recipient-api-DYLBAhFF.js → channel-recipient-api-COdmaOO4.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-settings-mALvXpJj.js → channels-settings-BAPRTSF4.js} +1 -1
- package/dist/gateway/static/root/assets/channels-status-swr-DvB_8J5B.js +1 -0
- package/dist/gateway/static/root/assets/chunk-KS7C4IRE-uQ0fehio.js +4 -0
- package/dist/gateway/static/root/assets/{connector-logo-BSjlInHT.js → connector-logo-CinEws2y.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-Cm_E3mmI.js → connectors-page-P-Ur9mlf.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-DcJc91-C.js → desktop-pet-O3wyOYRG.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-CdeqTa3Q.js → desktop-pet-settings-nbvEKluo.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-Cp3fpm0k.js → directory-picker-path-field-DyZJo5xz.js} +1 -1
- package/dist/gateway/static/root/assets/{dreaming-settings-Bwj1O3zr.js → dreaming-settings-CruD-NNs.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-D_1xpKbZ.js → extension-debug-page-CV7SDe48.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-CqZNCj96.js → extension-page-DJCYwgB_.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-5MWbtQaQ.js → extension-settings-page-6kJQVKbq.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-Co_IaS34.js → gateway-config-api-DOewYtbP.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-kmeWm2Pt.js → gateway-settings-BjjXod61.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-BM_xvzl0.js → gateway-startup-retry-ewVb05iS.js} +1 -1
- package/dist/gateway/static/root/assets/{goal-create-dialog-FoO-R4_U.js → goal-create-dialog-BStw0m9M.js} +1 -1
- package/dist/gateway/static/root/assets/{goal-detail-page-CkJq7N5g.js → goal-detail-page-BOChQ7i7.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-config-api-DrtsYjXz.js → goals-config-api-CYNvVerg.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-page-DRAN-R64.js → goals-page-BrNRDv8T.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-settings-wq9TKhIZ.js → goals-settings-CHZcm6es.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-B5zDoHbo.js → heartbeat-settings-B5oMLvbo.js} +1 -1
- package/dist/gateway/static/root/assets/index-B5cSZcER.js +196 -0
- package/dist/gateway/static/root/assets/index-CNr0KWZU.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-3tC9iD21.js → keyboard-shortcuts-settings-Eb8IqcMd.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-CT-vDTLK.js → local-app-workbench-page-L-MQ_dJY.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-B9ruF9GV.js → local-apps-page-Zb0f5eNc.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-GfSwnwIZ.js → locale-store-CQDaFvDN.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-Ca1X8X2P.js → logs-page-ToUMpW7t.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-CzuhSQAB.js → markdown-split-RnzQRPvB.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-a3R4y-EL.js → media-plugins-BoX0SWrl.js} +1 -1
- package/dist/gateway/static/root/assets/messages--cnUi8Ld.js +5 -0
- package/dist/gateway/static/root/assets/{models-hub-panel-CbTlz9Of.js → models-hub-panel-BQuynkNz.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-BCxDy2dV.js → notes-page-CSOXTk0P.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-workbench-z6sBX9B2.js → notes-workbench-B7NIQBqd.js} +2 -2
- package/dist/gateway/static/root/assets/{page-tabs-CJfk6M78.js → page-tabs-Dl9G6Pm3.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-MFopTSgF.js → preview-open-alternatives-B8R5o1uN.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-DU29deIr.js → project-detail-page-DoN-qkzc.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-Ck3DLTlZ.js → projects-page-BBOW0A-s.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-gLsLyAyi.js → remote-access-hub-BzXHX9bU.js} +1 -1
- package/dist/gateway/static/root/assets/{save-bar-controls-D0uhU3Z8.js → save-bar-controls-D6OGeVDa.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-NGOH-7wV.js → schedule-field-CKrch41X.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-BJz5LoqG.js → schema-form-FroNrvKO.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-TmNoWpa_.js → sessions-page-c4n4TLc2.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BEsX3iAM.js +1 -0
- package/dist/gateway/static/root/assets/{settings-collapsible-section-oDnUHnX_.js → settings-collapsible-section-1SeKT26L.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-form-section-DND90dDt.js → settings-form-section-Cz4xOOt4.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-CEJtaoQp.js → settings-loading-skeleton-rBI7xqmM.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-B1LJlRi9.js → settings-page-7SlGFgmR.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-CsrLuDsW.js → settings-page-layout-C7B19AHf.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-BPCJPHHY.js → setup-status-panel-_x53a0I_.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-C1PwLh-p.js → share-preview-page-DwcX1sXG.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-DCuqr7js.js → shares-settings-BwfS4kkk.js} +1 -1
- package/dist/gateway/static/root/assets/skill-reload-api-BkjO4n_a.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-k6VIqTkK.js → skills-page-sCuywwN5.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-BEsrEkSx.js → system-settings-panel-CZkASLIv.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-Bi6hMBDb.js → theme-store-DP5WlsZg.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-dOypdlMf.js → typed-models-lib-C2TbyW3H.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-f8A-PVuq.js → use-channel-catalog-4WYXfEXk.js} +1 -1
- package/dist/gateway/static/root/assets/{user-context-page-B9Y_Ciav.js → user-context-page-0MO96b3-.js} +1 -1
- package/dist/gateway/static/root/assets/{user-profile-fields-editor-DGC38Lx7.js → user-profile-fields-editor-Cqalx8iJ.js} +1 -1
- package/dist/gateway/static/root/assets/{user-profile-settings-panel-DFkZ-tan.js → user-profile-settings-panel-CVbTC44o.js} +1 -1
- package/dist/gateway/static/root/assets/{utils-CEIYZihF.js → utils-DOvyuYat.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-DK6gaQsA.js → voice-api-key-field-ClOb2PfC.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-page-DSJb9Kq7.js → work-discovery-page-Ci_rGhsb.js} +1 -1
- package/dist/gateway/static/root/assets/{work-item-detail-page-DVavwV3D.js → work-item-detail-page-DnJeDqJB.js} +1 -1
- package/dist/gateway/static/root/assets/{work-page-foJDp0nz.js → work-page-n9XZM9PY.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BYqZpFCC.js → workflow-run-setup-panel-pNCz37MS.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-DgO0WAzs.js → workflows-page-BFTxMEH6.js} +1 -1
- package/dist/gateway/static/root/index.html +8 -8
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/product-delivery.js +63 -0
- package/dist/src/agent/code-intelligence/tool-gating.d.ts +5 -0
- package/dist/src/agent/code-intelligence/tool-gating.js +6 -0
- package/dist/src/agent/tools/automation-tool.js +1 -1
- package/dist/src/agent/tools/factory.js +2 -1
- package/dist/src/agent/tools/goal-tool.js +1 -1
- package/dist/src/agent/tools/workflow-tool.js +1 -1
- package/dist/src/agent/tools/write.js +1 -1
- package/dist/src/agent/tools/xopc-use-tool.js +1 -1
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/config/index.js +2 -2
- package/dist/src/config/paths.d.ts +1 -0
- package/dist/src/config/paths.js +10 -3
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/heartbeat/service.js +1 -1
- package/dist/src/gateway/hono/routes/status.d.ts +8 -0
- package/dist/src/gateway/hono/routes/status.js +71 -1
- package/dist/src/heartbeat/index.js +1 -1
- package/package.json +15 -6
- package/dist/gateway/static/root/assets/channels-status-swr-CZuEsO5b.js +0 -1
- package/dist/gateway/static/root/assets/chunk-QUQL4437-DXsxWP7r.js +0 -4
- package/dist/gateway/static/root/assets/index-DIlxvrlG.css +0 -1
- package/dist/gateway/static/root/assets/index-apLU0Hun.js +0 -196
- package/dist/gateway/static/root/assets/messages-B0B40tpO.js +0 -5
- package/dist/gateway/static/root/assets/settings-advanced-gate-CtPhh2m9.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-kn1Vypcy.js +0 -1
package/dist/gateway/static/root/assets/{connectors-page-Cm_E3mmI.js → connectors-page-P-Ur9mlf.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i}from"./chunk-QUQL4437-DXsxWP7r.js";import{t as a}from"./cn-BQ_8x0bT.js";import{t as o}from"./check-BODqo66o.js";import{n as s}from"./copy-to-clipboard-HOJ79TWv.js";import{t as c}from"./messages-B0B40tpO.js";import{l,n as u,r as d,s as f}from"./locale-store-GfSwnwIZ.js";import{$o as p,$s as m,Bo as h,Cs as g,Di as _,Ei as v,El as y,Fo as b,Fs as x,Gi as S,Gl as C,Gs as w,Hs as T,Il as E,Io as D,Ji as O,Jo as k,Ki as A,Lo as j,No as M,Oi as N,Po as P,Ro as F,Sc as I,Uc as L,Yi as R,Yo as z,Zo as B,ac as V,au as H,bc as ee,cc as U,co as te,da as ne,es as re,fc as ie,il as ae,jc as oe,ji as se,ki as ce,nc as le,ps as W,qi as ue,rc as de,so as fe,tu as pe,us as me,vs as G,ws as K,yc as he,ys as q,zo as ge}from"./index-apLU0Hun.js";import{t as _e}from"./page-tabs-CJfk6M78.js";import{t as J}from"./connector-logo-BSjlInHT.js";var Y=e(t(),1),X=n(),Z=r();function ve(e){let t=(0,X.c)(80),{connector:n,installed:r,onInstall:i,onOpenDetails:o,t:s}=e,c,l,u,d,f,p,m,h,g,_;if(t[0]!==n||t[1]!==r||t[2]!==i||t[3]!==o||t[4]!==s.connect||t[5]!==s.connectedBadge||t[6]!==s.connectorBeta||t[7]!==s.connectorCapabilityLabels||t[8]!==s.connectorExperimental||t[9]!==s.connectorVerified||t[10]!==s.integrationStrategyComposio||t[11]!==s.integrationStrategyMcp||t[12]!==s.integrationStrategyNative){let e=n.capabilities.filter(ye),v=e.slice(0,3),y=Math.max(0,e.length-v.length),b=s.connect,x=n.verificationLevel===`verified`?s.connectorVerified:n.verificationLevel===`beta`?s.connectorBeta:n.verificationLevel===`experimental`?s.connectorExperimental:null,S=n.integrationStrategy?.lane===`native`?s.integrationStrategyNative:n.integrationStrategy?.lane===`mcp`?s.integrationStrategyMcp:n.integrationStrategy?.lane===`composio`?s.integrationStrategyComposio:null,C;t[23]!==b||t[24]!==n||t[25]!==i?(C=e=>(0,Z.jsxs)(q,{type:`button`,variant:`primary`,className:a(`h-8 justify-center px-2.5 text-xs font-medium`,e),onClick:e=>{e.stopPropagation(),i(n)},children:[(0,Z.jsx)(oe,{className:`size-4`}),b]}),t[23]=b,t[24]=n,t[25]=i,t[26]=C):C=t[26],c=C;let w;t[27]!==n||t[28]!==o?(w=e=>{!o||e.currentTarget!==e.target||e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),o(n))},t[27]=n,t[28]=o,t[29]=w):w=t[29];let T=w,E=o?`cursor-pointer`:null;t[30]===E?p=t[31]:(p=a(`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`,E),t[30]=E,t[31]=p),m=o?`button`:void 0,h=o?0:void 0,t[32]!==n||t[33]!==o?(g=()=>o?.(n),t[32]=n,t[33]=o,t[34]=g):g=t[34],_=T,l=`flex min-w-0 flex-1 flex-col`;let D;t[35]===n?D=t[36]:(D=(0,Z.jsx)(J,{connector:n}),t[35]=n,t[36]=D);let O;t[37]===n.displayName?O=t[38]:(O=(0,Z.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:n.displayName}),t[37]=n.displayName,t[38]=O);let k;t[39]===x?k=t[40]:(k=x?(0,Z.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[39]=x,t[40]=k);let A;t[41]===S?A=t[42]:(A=S?(0,Z.jsx)(`span`,{className:`ml-1 mt-1 inline-flex rounded-full border border-accent/20 bg-accent-soft px-1.5 py-0.5 text-[10px] font-medium text-accent-fg`,children:S}):null,t[41]=S,t[42]=A);let j;t[43]!==O||t[44]!==k||t[45]!==A?(j=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[O,k,A]}),t[43]=O,t[44]=k,t[45]=A,t[46]=j):j=t[46];let M;t[47]!==D||t[48]!==j?(M=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[D,j]}),t[47]=D,t[48]=j,t[49]=M):M=t[49];let N;t[50]!==r||t[51]!==c?(N=r?null:(0,Z.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[50]=r,t[51]=c,t[52]=N):N=t[52];let P;t[53]!==r||t[54]!==s.connectedBadge?(P=r?(0,Z.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,Z.jsx)(pe,{className:`size-3`,"aria-hidden":!0}),s.connectedBadge]}):null,t[53]=r,t[54]=s.connectedBadge,t[55]=P):P=t[55];let F;t[56]!==N||t[57]!==P?(F=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-start gap-2`,children:[N,P]}),t[56]=N,t[57]=P,t[58]=F):F=t[58],t[59]!==M||t[60]!==F?(u=(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[M,F]}),t[59]=M,t[60]=F,t[61]=u):u=t[61],t[62]===n.description?d=t[63]:(d=(0,Z.jsx)(`p`,{className:`mt-4 line-clamp-2 text-sm leading-6 text-fg-muted`,title:n.description,children:n.description}),t[62]=n.description,t[63]=d),f=v.length>0?(0,Z.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-1.5`,children:[v.map(e=>(0,Z.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-0.5 text-[11px] text-fg-muted`,children:s.connectorCapabilityLabels[e]??e},e)),y>0?(0,Z.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]=o,t[4]=s.connect,t[5]=s.connectedBadge,t[6]=s.connectorBeta,t[7]=s.connectorCapabilityLabels,t[8]=s.connectorExperimental,t[9]=s.connectorVerified,t[10]=s.integrationStrategyComposio,t[11]=s.integrationStrategyMcp,t[12]=s.integrationStrategyNative,t[13]=c,t[14]=l,t[15]=u,t[16]=d,t[17]=f,t[18]=p,t[19]=m,t[20]=h,t[21]=g,t[22]=_}else c=t[13],l=t[14],u=t[15],d=t[16],f=t[17],p=t[18],m=t[19],h=t[20],g=t[21],_=t[22];let v;t[64]!==l||t[65]!==u||t[66]!==d||t[67]!==f?(v=(0,Z.jsxs)(`div`,{className:l,children:[u,d,f]}),t[64]=l,t[65]=u,t[66]=d,t[67]=f,t[68]=v):v=t[68];let y;t[69]!==r||t[70]!==c?(y=r?null:(0,Z.jsx)(`div`,{className:`mt-4 flex flex-col gap-2 border-t border-edge pt-3 sm:hidden`,children:c(`w-full`)}),t[69]=r,t[70]=c,t[71]=y):y=t[71];let b;return t[72]!==v||t[73]!==y||t[74]!==p||t[75]!==m||t[76]!==h||t[77]!==g||t[78]!==_?(b=(0,Z.jsxs)(`div`,{className:p,role:m,tabIndex:h,onClick:g,onKeyDown:_,children:[v,y]}),t[72]=v,t[73]=y,t[74]=p,t[75]=m,t[76]=h,t[77]=g,t[78]=_,t[79]=b):b=t[79],b}function ye(e){return!e.startsWith(`runtime.`)&&!e.startsWith(`auth.`)}var be=[`c0`,`c1`,`c2`,`c3`,`c4`,`c5`];function xe(e,t){return t.some(t=>t.connectorId===e.id)}var Se=`animate-pulse motion-reduce:animate-none rounded-md bg-surface-hover dark:bg-surface-active/50`;function Ce(){let e=(0,X.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`div`,{className:a(`size-10 shrink-0 rounded-xl`,Se)}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.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,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 items-start gap-3`,children:[t,(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,Z.jsx)(`div`,{className:a(`h-4 min-w-0 flex-1`,Se)}),(0,Z.jsx)(`div`,{className:a(`h-8 w-[4.5rem] shrink-0 rounded-lg`,Se)})]}),(0,Z.jsx)(`div`,{className:a(`h-3 w-full`,Se)}),(0,Z.jsx)(`div`,{className:a(`h-3 w-[88%]`,Se)})]})]})}),e[1]=n):n=e[1],n}var we=`animate-pulse motion-reduce:animate-none rounded-md bg-surface-hover dark:bg-surface-active/50`;function Te(){let e=(0,X.c)(4),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`div`,{className:a(`size-10 shrink-0 rounded-xl`,we)}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[(0,Z.jsx)(`div`,{className:a(`h-4 w-48 max-w-full`,we)}),(0,Z.jsx)(`div`,{className:a(`h-3 w-72 max-w-full`,we)})]}),e[1]=n):n=e[1];let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(`div`,{className:`flex items-start gap-3`,children:[t,(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-start justify-between gap-3`,children:[n,(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[(0,Z.jsx)(`div`,{className:a(`h-9 w-20 rounded-lg`,we)}),(0,Z.jsx)(`div`,{className:a(`h-9 w-20 rounded-lg`,we)})]})]})]}),e[2]=r):r=e[2];let i;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsxs)(`div`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,"aria-hidden":!0,children:[r,(0,Z.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,Z.jsx)(`div`,{className:a(`h-8 w-20 rounded-md`,we)}),(0,Z.jsx)(`div`,{className:a(`h-8 w-24 rounded-md`,we)}),(0,Z.jsx)(`div`,{className:a(`h-8 w-28 rounded-md`,we)})]}),(0,Z.jsx)(`div`,{className:a(`mt-3 h-20 rounded-xl`,we)})]}),e[3]=i):i=e[3],i}function Q(e,t){if(!e.payload)throw Error(e.error??t);return e.payload}async function Ee(){let[e,t]=await Promise.all([f(d(`/api/connectors/catalog`)),De().catch(()=>[])]),n=Q(e,`Could not load connector catalog.`).connectors;return[...new Map([...t,...n].map(e=>[e.id,e])).values()]}async function De(e=!1){return Q(await f(d(`/api/connectors/composio/catalog${e?`?refresh=1`:``}`)),`Could not load Composio catalog.`).connectors}async function Oe(e){let t=new URLSearchParams;return e?.q?.trim()&&t.set(`q`,e.q.trim()),e?.page&&t.set(`page`,String(e.page)),e?.pageSize&&t.set(`pageSize`,String(e.pageSize)),e?.category?.trim()&&t.set(`category`,e.category.trim()),e?.sort&&t.set(`sort`,e.sort),Q(await f(d(`/api/capabilities/connectors${t.size?`?${t.toString()}`:``}`)),`Could not load Store connector capabilities.`)}async function ke(e,t){return Q(await f(d(`/api/capabilities/connectors/${encodeURIComponent(e)}/install-plan`),{method:`POST`,body:JSON.stringify({version:t})}),`Could not prepare connector installation.`).plan}async function Ae(e,t,n){let r=await f(d(`/api/capabilities/connectors/${encodeURIComponent(e)}/install`),{method:`POST`,body:JSON.stringify({...t,version:n})});return fe(),Q(r,`Could not install Store connector.`).instance}async function je(){return Q(await f(d(`/api/connectors/catalog`)),`Could not load connector registries.`).registries??[]}async function Me(){return Q(await f(d(`/api/connectors/installed`)),`Could not load installed connectors.`).instances}var Ne=new Map,Pe=300*1e3;async function Fe(e,t=`all`,n){let r=e.trim(),i=t.trim()||`all`,a=n?.browse??!1,o=Math.max(n?.page??1,1),s=Math.max(n?.pageSize??24,1),c=`${i}:${r}:${a?`browse`:`search`}:${o}:${s}`,l=Date.now(),u=Ne.get(c);if(u&&u.expiresAt>l)return u.promise;let p=new URLSearchParams;r&&p.set(`q`,r),i!==`all`&&p.set(`source`,i),a&&p.set(`browse`,`1`),p.set(`page`,String(o)),p.set(`pageSize`,String(s));let m=f(d(`/api/connectors/registry/search?${p.toString()}`)).then(e=>{let t=Q(e,`Could not search connector registries.`),n=Math.max(0,...(t.results??[]).map(e=>e.totalPages??0))||void 0;return{connectors:t.connectors,totalPages:n}});Ne.set(c,{expiresAt:l+Pe,promise:m});try{return await m}catch(e){throw Ne.delete(c),e}}async function Ie(e){return Q(await f(d(`/api/connectors/${encodeURIComponent(e)}/auth/start`),{method:`POST`}),`Could not start connector authorization.`).authorization}async function Le(e,t){let n=await f(d(`/api/connectors/${encodeURIComponent(e)}/install`),{method:`POST`,body:JSON.stringify(t)});return fe(),Q(n,`Could not install connector.`).instance}async function Re(e,t={}){return Q(await f(d(`/api/connectors/preview`),{method:`POST`,body:JSON.stringify({...t,definition:e})}),`Could not preview connector capabilities.`).preview}async function ze(e,t){return Q(await f(d(`/api/connectors/${encodeURIComponent(e)}/config`),{method:`POST`,body:JSON.stringify(t)}),`Could not update connector config.`).instance}async function Be(e){await f(d(`/api/connectors/${encodeURIComponent(e)}`),{method:`DELETE`}),fe()}async function Ve(e){return Q(await f(d(`/api/connectors/${encodeURIComponent(e)}/test`),{method:`POST`}),`Connector test failed.`)}async function He(){return Q(await f(d(`/api/connectors/composio/connections`)),`Could not load Composio connections.`).connections}async function Ue(e,t){return Q(await f(d(`/api/connectors/composio/connections/${encodeURIComponent(e)}`),{method:`PATCH`,body:JSON.stringify(t)}),`Could not update Composio connection.`).connection}async function We(e){return Q(await f(d(`/api/connectors/composio/${encodeURIComponent(e)}/health`)),`Could not check Composio connector health.`).health}async function Ge(e){await f(d(`/api/connectors/composio/connections/${encodeURIComponent(e)}/refresh`),{method:`POST`})}async function Ke(e){await f(d(`/api/connectors/composio/connections/${encodeURIComponent(e)}`),{method:`DELETE`})}async function qe(e){return Q(await f(d(`/api/connectors/composio/${encodeURIComponent(e)}/scope`)),`Could not load Composio scope.`).scope}async function Je(e,t){let n=await f(d(`/api/connectors/composio/${encodeURIComponent(e)}/scope`),{method:`POST`,body:JSON.stringify({scope:t})});return fe(),Q(n,`Could not update Composio scope.`).scope}async function Ye(e){return Q(await f(d(`/api/connectors/composio/${encodeURIComponent(e)}/policy`)),`Could not load Composio policy.`)}async function Xe(e,t){return Q(await f(d(`/api/connectors/composio/${encodeURIComponent(e)}/policy`),{method:`PATCH`,body:JSON.stringify(t)}),`Could not update Composio policy.`).policy}async function Ze(e){return Q(await f(d(`/api/connectors/composio/${encodeURIComponent(e)}/tools`)),`Could not load Composio tools.`).tools}async function Qe(e=50){return Q(await f(d(`/api/connectors/composio/triggers?limit=${encodeURIComponent(String(e))}`)),`Could not load Composio trigger events.`).events}async function $e(e){return Q(await f(d(`/api/connectors/${encodeURIComponent(e.connectorId)}/memory-sync`),{method:`POST`,body:JSON.stringify(e)}),`Could not sync connector data to memory.`)}async function et(e=`pending`){return Q(await f(d(`/api/connectors/approvals?status=${encodeURIComponent(e)}`)),`Could not load connector approvals.`).approvals}async function tt(e,t){return Q(await f(d(`/api/connectors/approvals/respond`),{method:`POST`,body:JSON.stringify({id:e,decision:t})}),`Could not update connector approval.`).approval}function nt(e,t){return Object.entries(t).reduce((e,[t,n])=>e.replaceAll(`{{${t}}}`,String(n)),e)}function rt(e,t){return t.connectorCapabilityLabels[e]??e}function it(e,t){if(e.runtime.type===`mcp`)return nt(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 nt(t.connectorRuntimeGeneric,{runtime:e.runtime.type,id:n??e.runtime.type})}function at(e,t){return e.auth.mode===`oauth`?t.connectorAuthOAuth:e.auth.mode===`apiKey`?t.connectorAuthApiKey:t.connectorAuthNone}function ot(e){return(e.setup.secrets??[]).filter(e=>e.required).length+(e.setup.config??[]).filter(e=>e.required).length}function st(e){let t=(0,X.c)(12),{title:n,items:r}=e;if(r.length===0)return null;let i;t[0]===n?i=t[1]:(i=(0,Z.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(ct),t[2]=r,t[3]=a);let o;t[4]===r.length?o=t[5]:(o=r.length>16?(0,Z.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,Z.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,Z.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 ct(e){return(0,Z.jsxs)(`div`,{className:`border-b border-edge-subtle px-3 py-2 last:border-b-0`,children:[(0,Z.jsx)(`div`,{className:`break-words font-mono text-xs font-medium text-fg`,children:e.title}),e.description?(0,Z.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description}):null]},e.id)}function lt({connector:e,installed:t,onClose:n,onInstall:r,t:i}){let[o,s]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(null),[u,d]=(0,Y.useState)(null),f=ot(e),p=e.capabilities.slice(0,8),m=Math.max(0,e.capabilities.length-p.length),h=[...(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()=>{s(!0),d(null);try{l(await Re(e))}catch(e){l(null),d(e instanceof Error?e.message:String(e))}finally{s(!1)}};return(0,Z.jsx)(M,{open:!0,onOpenChange:e=>{e||n()},children:(0,Z.jsxs)(F,{children:[(0,Z.jsx)(j,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,Z.jsxs)(b,{className:a(`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,Z.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-6 py-5`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Z.jsx)(J,{connector:e,size:`lg`}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-base px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:e.source}),(0,Z.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-base px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:e.kind}),t?(0,Z.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,Z.jsx)(pe,{className:`size-3`,"aria-hidden":!0}),i.connectedBadge]}):null]}),(0,Z.jsx)(ge,{className:`text-base font-semibold text-fg`,children:e.displayName}),(0,Z.jsx)(D,{className:`mt-1 line-clamp-3 text-sm leading-6 text-fg-muted`,children:e.description})]})]}),(0,Z.jsx)(P,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:a(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,W.focusRingPanel),"aria-label":i.modalClose,children:[(0,Z.jsx)(g,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`sr-only`,children:i.modalClose})]})})]}),(0,Z.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-5`,children:[(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,Z.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[(0,Z.jsx)(K,{className:`size-3.5`,"aria-hidden":!0}),i.detailTools]}),(0,Z.jsx)(`p`,{className:`mt-2 text-sm font-semibold text-fg`,children:c?nt(i.connectorPreviewToolsCount,{count:c.toolCount}):i.connectorPreviewUnknown})]}),(0,Z.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[(0,Z.jsx)(ae,{className:`size-3.5`,"aria-hidden":!0}),i.detailPermissions]}),(0,Z.jsx)(`p`,{className:`mt-2 text-sm font-semibold text-fg`,children:at(e,i)})]}),(0,Z.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[(0,Z.jsx)(E,{className:`size-3.5`,"aria-hidden":!0}),i.connectorRequiredInputs]}),(0,Z.jsx)(`p`,{className:`mt-2 text-sm font-semibold text-fg`,children:nt(i.connectorRequiredInputsCount,{count:f})})]})]}),(0,Z.jsxs)(`div`,{className:`mt-5 grid gap-5 lg:grid-cols-[minmax(0,1fr)_18rem]`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 space-y-5`,children:[(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i.connectorCapabilitiesTitle}),(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,children:[p.map(e=>(0,Z.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-base px-2 py-1 text-xs text-fg-muted`,children:rt(e,i)},e)),m>0?(0,Z.jsxs)(`span`,{className:`rounded-md border border-edge bg-surface-base px-2 py-1 text-xs text-fg-subtle`,children:[`+`,m]}):null]}),(0,Z.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:i.connectorCapabilitiesHint})]}),u?(0,Z.jsx)(`p`,{className:`rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:u}):null,c?(0,Z.jsxs)(`section`,{children:[(0,Z.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i.connectorPreviewTitle}),(0,Z.jsx)(`span`,{className:a(`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,Z.jsxs)(`div`,{className:`mb-3 grid gap-2 text-xs sm:grid-cols-3`,children:[(0,Z.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base px-3 py-2`,children:[(0,Z.jsx)(`div`,{className:`font-semibold text-fg`,children:c.toolCount}),(0,Z.jsx)(`div`,{className:`text-fg-muted`,children:i.toolsMetric})]}),(0,Z.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base px-3 py-2`,children:[(0,Z.jsx)(`div`,{className:`font-semibold text-fg`,children:c.resourceCount}),(0,Z.jsx)(`div`,{className:`text-fg-muted`,children:i.resourcesMetric})]}),(0,Z.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base px-3 py-2`,children:[(0,Z.jsx)(`div`,{className:`font-semibold text-fg`,children:c.promptCount}),(0,Z.jsx)(`div`,{className:`text-fg-muted`,children:i.promptsMetric})]})]}),(0,Z.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Z.jsx)(st,{title:i.detailTools,items:c.tools.map(e=>({id:e.name,title:e.shortName??e.name,description:e.description}))}),(0,Z.jsx)(st,{title:i.detailResources,items:c.resources.map(e=>({id:e.uri,title:e.title??e.name??e.uri,description:e.description??e.uri}))}),(0,Z.jsx)(st,{title:i.detailPrompts,items:c.prompts.map(e=>({id:e.name,title:e.title??e.name,description:e.description??nt(i.promptArgumentCount,{count:e.argumentCount})}))})]}),c.error?(0,Z.jsx)(`p`,{className:`mt-3 text-xs leading-5 text-fg-subtle`,children:c.error}):null,c.action?(0,Z.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-subtle`,children:c.action}):null]}):null]}),(0,Z.jsxs)(`aside`,{className:`space-y-3`,children:[(0,Z.jsxs)(`section`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,Z.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,Z.jsx)(ae,{className:`size-4 text-accent`,"aria-hidden":!0}),i.detailPermissions]}),(0,Z.jsx)(`p`,{className:`mt-2 text-sm font-medium text-fg`,children:at(e,i)})]}),(0,Z.jsxs)(`section`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,Z.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,Z.jsx)(E,{className:`size-4 text-accent`,"aria-hidden":!0}),i.connectorSetupTitle]}),h.length>0?(0,Z.jsx)(`div`,{className:`mt-3 divide-y divide-edge overflow-hidden rounded-lg border border-edge`,children:h.map(e=>(0,Z.jsxs)(`div`,{className:`bg-surface-panel px-3 py-2.5`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.label}),(0,Z.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,Z.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,Z.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:e.description}):null]},e.key))}):(0,Z.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:i.connectorSetupNone})]}),(0,Z.jsxs)(`section`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,Z.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,Z.jsx)(de,{className:`size-4 text-accent`,"aria-hidden":!0}),i.connectorRuntimeTitle]}),(0,Z.jsx)(`p`,{className:`mt-2 break-words text-xs leading-5 text-fg-muted`,children:it(e,i)})]})]})]})]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-2 border-t border-edge-subtle px-6 py-4`,children:[(0,Z.jsx)(P,{asChild:!0,children:(0,Z.jsx)(q,{variant:`secondary`,children:i.modalClose})}),(0,Z.jsxs)(q,{variant:`secondary`,disabled:o,onClick:()=>void _(),children:[o?(0,Z.jsx)(L,{className:`size-4 animate-spin`}):(0,Z.jsx)(K,{className:`size-4`}),i.connectorPreviewButton]}),t?(0,Z.jsxs)(q,{variant:`secondary`,disabled:!0,children:[(0,Z.jsx)(I,{className:`size-4`}),i.connectedBadge]}):(0,Z.jsxs)(q,{variant:`primary`,onClick:()=>{r(e),n()},children:[(0,Z.jsx)(oe,{className:`size-4`}),i.connect]})]})]})]})})}var ut=a(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,G);function dt(e){let t=(0,X.c)(58),{open:n,sessionIdleTtlMinutes:r,saving:i,onChange:o,onSave:s,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,Z.jsx)(j,{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=a(`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,Z.jsx)(`span`,{className:`flex size-10 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,Z.jsx)(ee,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),t[4]=m):m=t[4];let h;t[5]===l.runtimeSettingsTitle?h=t[6]:(h=(0,Z.jsx)(ge,{className:`text-base font-semibold text-fg`,children:l.runtimeSettingsTitle}),t[5]=l.runtimeSettingsTitle,t[6]=h);let _;t[7]===l.runtimeSettingsHint?_=t[8]:(_=(0,Z.jsx)(D,{className:`mt-1 text-sm text-fg-muted`,children:l.runtimeSettingsHint}),t[7]=l.runtimeSettingsHint,t[8]=_);let v;t[9]!==h||t[10]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[m,(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[h,_]})]}),t[9]=h,t[10]=_,t[11]=v):v=t[11];let y;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(y=a(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,W.focusRingPanel),t[12]=y):y=t[12];let x;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(g,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),t[13]=x):x=t[13];let S;t[14]===l.modalClose?S=t[15]:(S=(0,Z.jsx)(P,{asChild:!0,children:(0,Z.jsx)(`button`,{type:`button`,className:y,"aria-label":l.modalClose,children:x})}),t[14]=l.modalClose,t[15]=S);let C;t[16]!==S||t[17]!==v?(C=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-6 py-5`,children:[v,S]}),t[16]=S,t[17]=v,t[18]=C):C=t[18];let w;t[19]===u.idleTtlLabel?w=t[20]:(w=(0,Z.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:u.idleTtlLabel}),t[19]=u.idleTtlLabel,t[20]=w);let T;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(T=a(ut,`w-40 flex-none`),t[21]=T):T=t[21];let E=r??``,O;t[22]===o?O=t[23]:(O=e=>{let t=e.currentTarget.value.trim();o(t===``?void 0:Number.parseInt(t,10))},t[22]=o,t[23]=O);let k;t[24]!==u.idleTtlPlaceholder||t[25]!==E||t[26]!==O?(k=(0,Z.jsx)(`input`,{type:`number`,min:0,className:T,value:E,placeholder:u.idleTtlPlaceholder,onChange:O}),t[24]=u.idleTtlPlaceholder,t[25]=E,t[26]=O,t[27]=k):k=t[27];let A;t[28]===u.idleTtlHint?A=t[29]:(A=(0,Z.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:u.idleTtlHint}),t[28]=u.idleTtlHint,t[29]=A);let N;t[30]!==w||t[31]!==k||t[32]!==A?(N=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-5`,children:(0,Z.jsxs)(`label`,{className:`flex max-w-xl flex-col gap-1.5`,children:[w,k,A]})}),t[30]=w,t[31]=k,t[32]=A,t[33]=N):N=t[33];let I;t[34]!==c||t[35]!==i||t[36]!==l.modalCancel?(I=(0,Z.jsx)(q,{type:`button`,variant:`secondary`,disabled:i,onClick:c,children:l.modalCancel}),t[34]=c,t[35]=i,t[36]=l.modalCancel,t[37]=I):I=t[37];let R;t[38]===s?R=t[39]:(R=()=>void s(),t[38]=s,t[39]=R);let z;t[40]===i?z=t[41]:(z=i?(0,Z.jsx)(L,{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,Z.jsxs)(q,{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]!==I||t[48]!==B?(V=(0,Z.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle px-6 py-4`,children:[I,B]}),t[47]=I,t[48]=B,t[49]=V):V=t[49];let H;t[50]!==C||t[51]!==N||t[52]!==V?(H=(0,Z.jsxs)(F,{children:[f,(0,Z.jsxs)(b,{className:p,children:[C,N,V]})]}),t[50]=C,t[51]=N,t[52]=V,t[53]=H):H=t[53];let U;return t[54]!==n||t[55]!==d||t[56]!==H?(U=(0,Z.jsx)(M,{open:n,onOpenChange:d,children:H}),t[54]=n,t[55]=d,t[56]=H,t[57]=U):U=t[57],U}var ft=(0,Y.memo)(function(e){let t=(0,X.c)(12),{value:n,onChange:r,placeholder:i,className:o}=e,s;t[0]===o?s=t[1]:(s=a(`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`,o),t[0]=o,t[1]=s);let c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(V,{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,Z.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]!==s||t[10]!==u?(d=(0,Z.jsxs)(`label`,{className:s,children:[c,u]}),t[9]=s,t[10]=u,t[11]=d):d=t[11],d}),pt=(0,Y.memo)(function(e){let t=(0,X.c)(30),{onBrowseCatalog:n,onAddCustomServer:r,onOpenRuntimeSettings:i,addLabel:o,browseLabel:s,customLabel:c,settingsLabel:l}=e,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(le,{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,Z.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,Z.jsxs)(q,{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,Z.jsx)(he,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[7]=p):p=t[7];let m;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(H,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[8]=m):m=t[8];let h;t[9]===o?h=t[10]:(h=(0,Z.jsx)(se,{asChild:!0,children:(0,Z.jsxs)(q,{type:`button`,variant:`primary`,className:`shrink-0 gap-2`,children:[p,o,m]})}),t[9]=o,t[10]=h);let g;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(g=a(`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,W.transition),t[11]=g):g=t[11];let y;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(T,{className:`size-4 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),t[12]=y):y=t[12];let b;t[13]!==s||t[14]!==n?(b=(0,Z.jsxs)(_,{className:g,onSelect:n,children:[y,s]}),t[13]=s,t[14]=n,t[15]=b):b=t[15];let x;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(x=a(`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,W.transition),t[16]=x):x=t[16];let S;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(K,{className:`size-4 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),t[17]=S):S=t[17];let C;t[18]!==c||t[19]!==r?(C=(0,Z.jsxs)(_,{className:x,onSelect:r,children:[S,c]}),t[18]=c,t[19]=r,t[20]=C):C=t[20];let w;t[21]!==C||t[22]!==b?(w=(0,Z.jsx)(N,{children:(0,Z.jsxs)(v,{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:[b,C]})}),t[21]=C,t[22]=b,t[23]=w):w=t[23];let E;t[24]!==w||t[25]!==h?(E=(0,Z.jsxs)(ce,{children:[h,w]}),t[24]=w,t[25]=h,t[26]=E):E=t[26];let D;return t[27]!==E||t[28]!==f?(D=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:[f,E]}),t[27]=E,t[28]=f,t[29]=D):D=t[29],D}),mt=/^([^:=]+)[:=](.*)$/;function ht(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=mt.exec(t);r&&n.push({key:r[1].trim(),value:r[2].trim()})}return n.length>0?n:null}function gt(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 _t(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 vt(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 yt(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)||vt(t)&&(r[e]=t);return r}function bt(e){let t=e.trim();if(t)return t.split(/\s+/).filter(Boolean)}function xt(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 St(e){if(e.transport===`stdio`){let t={command:e.command.trim()},n=bt(e.argsText);return n?.length&&(t.args=n),e.cwd.trim()&&(t.cwd=e.cwd.trim()),e.envJson.trim()&&(t.env=xt(e.envJson)),e.connectionTimeoutMs!=null&&Number.isFinite(e.connectionTimeoutMs)&&(t.connectionTimeoutMs=e.connectionTimeoutMs),t}let t={url:e.url.trim(),transport:e.transport},n=gt(e.headers);return n&&(t.headers=n),e.connectionTimeoutMs!=null&&Number.isFinite(e.connectionTimeoutMs)&&(t.connectionTimeoutMs=e.connectionTimeoutMs),t}function Ct(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:_t(a),connectionTimeoutMs:typeof t.connectionTimeoutMs==`number`&&Number.isFinite(t.connectionTimeoutMs)?t.connectionTimeoutMs:void 0}}function wt(e=``){return{clientKey:crypto.randomUUID(),id:e,transport:`stdio`,command:``,argsText:``,envJson:``,cwd:``,url:``,headers:[{key:`Authorization`,value:``}],connectionTimeoutMs:void 0}}function Tt(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)||vt(t)?[]:[Ct(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 Et(e){return St(e)}async function Dt(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]=St(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 f(d(`/api/config`),{method:`PATCH`,body:JSON.stringify({mcp:r})}),fe()}function Ot(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 kt(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 At(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 jt(e,t){let n=await f(d(`/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=Ot(n.payload.tools),i=kt(n.payload.resources),a=At(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 Mt(e){return e.connectionTimeoutMs==null||!Number.isFinite(e.connectionTimeoutMs)?``:String(Math.round(e.connectionTimeoutMs/1e3))}function Nt(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 Pt(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 Ft({row:e,t,cs:n,onEdit:r,onRemove:i}){let[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(null),[d,f]=(0,Y.useState)(null),p=Pt(e),m=(0,Y.useCallback)(async()=>{o(!0),f(null);try{let t=await jt(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,Y.useCallback)(async()=>{c(!0),f(null);try{await i()}catch(e){f(e instanceof Error?e.message:String(e)),c(!1)}},[i]);return(0,Z.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,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:e.id.trim()||t.cardUntitled}),(0,Z.jsx)(`span`,{className:`rounded-full bg-surface-base px-2 py-0.5 text-[11px] text-fg-muted`,children:n.customBadge}),(0,Z.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,Z.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,Z.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,Z.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,Z.jsxs)(`div`,{className:`mt-4 flex items-center justify-between gap-2 border-t border-edge pt-3`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:n.connectorDetails}),(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsxs)(q,{variant:`secondary`,disabled:a,onClick:()=>void m(),children:[a?(0,Z.jsx)(L,{className:`size-4 animate-spin`}):(0,Z.jsx)(I,{className:`size-4`}),t.testConnection]}),(0,Z.jsxs)(q,{variant:`ghost`,disabled:s,onClick:()=>void h(),children:[s?(0,Z.jsx)(L,{className:`size-4 animate-spin`}):(0,Z.jsx)(x,{className:`size-4`}),t.removeServer]})]})]})]})}function It(e,t){return e?t&&e.startsWith(t)?e.slice(t.length):e:``}function Lt(e,t,n){let r=t.trim().toLowerCase();if(!r)return!0;let i=e.shortName||It(e.name,n);return[e.name,i,e.description].filter(Boolean).join(`
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i}from"./chunk-KS7C4IRE-uQ0fehio.js";import{t as a}from"./cn-BQ_8x0bT.js";import{t as o}from"./check-BODqo66o.js";import{n as s}from"./copy-to-clipboard-HOJ79TWv.js";import{t as c}from"./messages--cnUi8Ld.js";import{l,n as u,r as d,s as f}from"./locale-store-CQDaFvDN.js";import{$o as p,$s as m,Bo as h,Cs as g,Di as _,Ei as v,El as y,Fo as b,Fs as x,Gi as S,Gl as C,Gs as w,Hs as T,Il as E,Io as D,Ji as O,Jo as k,Ki as A,Lo as j,No as M,Oi as N,Po as P,Ro as F,Sc as I,Uc as L,Yi as R,Yo as z,Zo as B,ac as V,au as H,bc as ee,cc as U,co as te,da as ne,es as re,fc as ie,il as ae,jc as oe,ji as se,ki as ce,nc as le,ps as W,qi as ue,rc as de,so as fe,tu as pe,us as me,vs as G,ws as K,yc as he,ys as q,zo as ge}from"./index-B5cSZcER.js";import{t as _e}from"./page-tabs-Dl9G6Pm3.js";import{t as J}from"./connector-logo-CinEws2y.js";var Y=e(t(),1),X=n(),Z=r();function ve(e){let t=(0,X.c)(80),{connector:n,installed:r,onInstall:i,onOpenDetails:o,t:s}=e,c,l,u,d,f,p,m,h,g,_;if(t[0]!==n||t[1]!==r||t[2]!==i||t[3]!==o||t[4]!==s.connect||t[5]!==s.connectedBadge||t[6]!==s.connectorBeta||t[7]!==s.connectorCapabilityLabels||t[8]!==s.connectorExperimental||t[9]!==s.connectorVerified||t[10]!==s.integrationStrategyComposio||t[11]!==s.integrationStrategyMcp||t[12]!==s.integrationStrategyNative){let e=n.capabilities.filter(ye),v=e.slice(0,3),y=Math.max(0,e.length-v.length),b=s.connect,x=n.verificationLevel===`verified`?s.connectorVerified:n.verificationLevel===`beta`?s.connectorBeta:n.verificationLevel===`experimental`?s.connectorExperimental:null,S=n.integrationStrategy?.lane===`native`?s.integrationStrategyNative:n.integrationStrategy?.lane===`mcp`?s.integrationStrategyMcp:n.integrationStrategy?.lane===`composio`?s.integrationStrategyComposio:null,C;t[23]!==b||t[24]!==n||t[25]!==i?(C=e=>(0,Z.jsxs)(q,{type:`button`,variant:`primary`,className:a(`h-8 justify-center px-2.5 text-xs font-medium`,e),onClick:e=>{e.stopPropagation(),i(n)},children:[(0,Z.jsx)(oe,{className:`size-4`}),b]}),t[23]=b,t[24]=n,t[25]=i,t[26]=C):C=t[26],c=C;let w;t[27]!==n||t[28]!==o?(w=e=>{!o||e.currentTarget!==e.target||e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),o(n))},t[27]=n,t[28]=o,t[29]=w):w=t[29];let T=w,E=o?`cursor-pointer`:null;t[30]===E?p=t[31]:(p=a(`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`,E),t[30]=E,t[31]=p),m=o?`button`:void 0,h=o?0:void 0,t[32]!==n||t[33]!==o?(g=()=>o?.(n),t[32]=n,t[33]=o,t[34]=g):g=t[34],_=T,l=`flex min-w-0 flex-1 flex-col`;let D;t[35]===n?D=t[36]:(D=(0,Z.jsx)(J,{connector:n}),t[35]=n,t[36]=D);let O;t[37]===n.displayName?O=t[38]:(O=(0,Z.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:n.displayName}),t[37]=n.displayName,t[38]=O);let k;t[39]===x?k=t[40]:(k=x?(0,Z.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[39]=x,t[40]=k);let A;t[41]===S?A=t[42]:(A=S?(0,Z.jsx)(`span`,{className:`ml-1 mt-1 inline-flex rounded-full border border-accent/20 bg-accent-soft px-1.5 py-0.5 text-[10px] font-medium text-accent-fg`,children:S}):null,t[41]=S,t[42]=A);let j;t[43]!==O||t[44]!==k||t[45]!==A?(j=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[O,k,A]}),t[43]=O,t[44]=k,t[45]=A,t[46]=j):j=t[46];let M;t[47]!==D||t[48]!==j?(M=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[D,j]}),t[47]=D,t[48]=j,t[49]=M):M=t[49];let N;t[50]!==r||t[51]!==c?(N=r?null:(0,Z.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[50]=r,t[51]=c,t[52]=N):N=t[52];let P;t[53]!==r||t[54]!==s.connectedBadge?(P=r?(0,Z.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,Z.jsx)(pe,{className:`size-3`,"aria-hidden":!0}),s.connectedBadge]}):null,t[53]=r,t[54]=s.connectedBadge,t[55]=P):P=t[55];let F;t[56]!==N||t[57]!==P?(F=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-start gap-2`,children:[N,P]}),t[56]=N,t[57]=P,t[58]=F):F=t[58],t[59]!==M||t[60]!==F?(u=(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[M,F]}),t[59]=M,t[60]=F,t[61]=u):u=t[61],t[62]===n.description?d=t[63]:(d=(0,Z.jsx)(`p`,{className:`mt-4 line-clamp-2 text-sm leading-6 text-fg-muted`,title:n.description,children:n.description}),t[62]=n.description,t[63]=d),f=v.length>0?(0,Z.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-1.5`,children:[v.map(e=>(0,Z.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-0.5 text-[11px] text-fg-muted`,children:s.connectorCapabilityLabels[e]??e},e)),y>0?(0,Z.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]=o,t[4]=s.connect,t[5]=s.connectedBadge,t[6]=s.connectorBeta,t[7]=s.connectorCapabilityLabels,t[8]=s.connectorExperimental,t[9]=s.connectorVerified,t[10]=s.integrationStrategyComposio,t[11]=s.integrationStrategyMcp,t[12]=s.integrationStrategyNative,t[13]=c,t[14]=l,t[15]=u,t[16]=d,t[17]=f,t[18]=p,t[19]=m,t[20]=h,t[21]=g,t[22]=_}else c=t[13],l=t[14],u=t[15],d=t[16],f=t[17],p=t[18],m=t[19],h=t[20],g=t[21],_=t[22];let v;t[64]!==l||t[65]!==u||t[66]!==d||t[67]!==f?(v=(0,Z.jsxs)(`div`,{className:l,children:[u,d,f]}),t[64]=l,t[65]=u,t[66]=d,t[67]=f,t[68]=v):v=t[68];let y;t[69]!==r||t[70]!==c?(y=r?null:(0,Z.jsx)(`div`,{className:`mt-4 flex flex-col gap-2 border-t border-edge pt-3 sm:hidden`,children:c(`w-full`)}),t[69]=r,t[70]=c,t[71]=y):y=t[71];let b;return t[72]!==v||t[73]!==y||t[74]!==p||t[75]!==m||t[76]!==h||t[77]!==g||t[78]!==_?(b=(0,Z.jsxs)(`div`,{className:p,role:m,tabIndex:h,onClick:g,onKeyDown:_,children:[v,y]}),t[72]=v,t[73]=y,t[74]=p,t[75]=m,t[76]=h,t[77]=g,t[78]=_,t[79]=b):b=t[79],b}function ye(e){return!e.startsWith(`runtime.`)&&!e.startsWith(`auth.`)}var be=[`c0`,`c1`,`c2`,`c3`,`c4`,`c5`];function xe(e,t){return t.some(t=>t.connectorId===e.id)}var Se=`animate-pulse motion-reduce:animate-none rounded-md bg-surface-hover dark:bg-surface-active/50`;function Ce(){let e=(0,X.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`div`,{className:a(`size-10 shrink-0 rounded-xl`,Se)}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.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,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 items-start gap-3`,children:[t,(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,Z.jsx)(`div`,{className:a(`h-4 min-w-0 flex-1`,Se)}),(0,Z.jsx)(`div`,{className:a(`h-8 w-[4.5rem] shrink-0 rounded-lg`,Se)})]}),(0,Z.jsx)(`div`,{className:a(`h-3 w-full`,Se)}),(0,Z.jsx)(`div`,{className:a(`h-3 w-[88%]`,Se)})]})]})}),e[1]=n):n=e[1],n}var we=`animate-pulse motion-reduce:animate-none rounded-md bg-surface-hover dark:bg-surface-active/50`;function Te(){let e=(0,X.c)(4),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`div`,{className:a(`size-10 shrink-0 rounded-xl`,we)}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[(0,Z.jsx)(`div`,{className:a(`h-4 w-48 max-w-full`,we)}),(0,Z.jsx)(`div`,{className:a(`h-3 w-72 max-w-full`,we)})]}),e[1]=n):n=e[1];let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(`div`,{className:`flex items-start gap-3`,children:[t,(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-start justify-between gap-3`,children:[n,(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[(0,Z.jsx)(`div`,{className:a(`h-9 w-20 rounded-lg`,we)}),(0,Z.jsx)(`div`,{className:a(`h-9 w-20 rounded-lg`,we)})]})]})]}),e[2]=r):r=e[2];let i;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsxs)(`div`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,"aria-hidden":!0,children:[r,(0,Z.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,Z.jsx)(`div`,{className:a(`h-8 w-20 rounded-md`,we)}),(0,Z.jsx)(`div`,{className:a(`h-8 w-24 rounded-md`,we)}),(0,Z.jsx)(`div`,{className:a(`h-8 w-28 rounded-md`,we)})]}),(0,Z.jsx)(`div`,{className:a(`mt-3 h-20 rounded-xl`,we)})]}),e[3]=i):i=e[3],i}function Q(e,t){if(!e.payload)throw Error(e.error??t);return e.payload}async function Ee(){let[e,t]=await Promise.all([f(d(`/api/connectors/catalog`)),De().catch(()=>[])]),n=Q(e,`Could not load connector catalog.`).connectors;return[...new Map([...t,...n].map(e=>[e.id,e])).values()]}async function De(e=!1){return Q(await f(d(`/api/connectors/composio/catalog${e?`?refresh=1`:``}`)),`Could not load Composio catalog.`).connectors}async function Oe(e){let t=new URLSearchParams;return e?.q?.trim()&&t.set(`q`,e.q.trim()),e?.page&&t.set(`page`,String(e.page)),e?.pageSize&&t.set(`pageSize`,String(e.pageSize)),e?.category?.trim()&&t.set(`category`,e.category.trim()),e?.sort&&t.set(`sort`,e.sort),Q(await f(d(`/api/capabilities/connectors${t.size?`?${t.toString()}`:``}`)),`Could not load Store connector capabilities.`)}async function ke(e,t){return Q(await f(d(`/api/capabilities/connectors/${encodeURIComponent(e)}/install-plan`),{method:`POST`,body:JSON.stringify({version:t})}),`Could not prepare connector installation.`).plan}async function Ae(e,t,n){let r=await f(d(`/api/capabilities/connectors/${encodeURIComponent(e)}/install`),{method:`POST`,body:JSON.stringify({...t,version:n})});return fe(),Q(r,`Could not install Store connector.`).instance}async function je(){return Q(await f(d(`/api/connectors/catalog`)),`Could not load connector registries.`).registries??[]}async function Me(){return Q(await f(d(`/api/connectors/installed`)),`Could not load installed connectors.`).instances}var Ne=new Map,Pe=300*1e3;async function Fe(e,t=`all`,n){let r=e.trim(),i=t.trim()||`all`,a=n?.browse??!1,o=Math.max(n?.page??1,1),s=Math.max(n?.pageSize??24,1),c=`${i}:${r}:${a?`browse`:`search`}:${o}:${s}`,l=Date.now(),u=Ne.get(c);if(u&&u.expiresAt>l)return u.promise;let p=new URLSearchParams;r&&p.set(`q`,r),i!==`all`&&p.set(`source`,i),a&&p.set(`browse`,`1`),p.set(`page`,String(o)),p.set(`pageSize`,String(s));let m=f(d(`/api/connectors/registry/search?${p.toString()}`)).then(e=>{let t=Q(e,`Could not search connector registries.`),n=Math.max(0,...(t.results??[]).map(e=>e.totalPages??0))||void 0;return{connectors:t.connectors,totalPages:n}});Ne.set(c,{expiresAt:l+Pe,promise:m});try{return await m}catch(e){throw Ne.delete(c),e}}async function Ie(e){return Q(await f(d(`/api/connectors/${encodeURIComponent(e)}/auth/start`),{method:`POST`}),`Could not start connector authorization.`).authorization}async function Le(e,t){let n=await f(d(`/api/connectors/${encodeURIComponent(e)}/install`),{method:`POST`,body:JSON.stringify(t)});return fe(),Q(n,`Could not install connector.`).instance}async function Re(e,t={}){return Q(await f(d(`/api/connectors/preview`),{method:`POST`,body:JSON.stringify({...t,definition:e})}),`Could not preview connector capabilities.`).preview}async function ze(e,t){return Q(await f(d(`/api/connectors/${encodeURIComponent(e)}/config`),{method:`POST`,body:JSON.stringify(t)}),`Could not update connector config.`).instance}async function Be(e){await f(d(`/api/connectors/${encodeURIComponent(e)}`),{method:`DELETE`}),fe()}async function Ve(e){return Q(await f(d(`/api/connectors/${encodeURIComponent(e)}/test`),{method:`POST`}),`Connector test failed.`)}async function He(){return Q(await f(d(`/api/connectors/composio/connections`)),`Could not load Composio connections.`).connections}async function Ue(e,t){return Q(await f(d(`/api/connectors/composio/connections/${encodeURIComponent(e)}`),{method:`PATCH`,body:JSON.stringify(t)}),`Could not update Composio connection.`).connection}async function We(e){return Q(await f(d(`/api/connectors/composio/${encodeURIComponent(e)}/health`)),`Could not check Composio connector health.`).health}async function Ge(e){await f(d(`/api/connectors/composio/connections/${encodeURIComponent(e)}/refresh`),{method:`POST`})}async function Ke(e){await f(d(`/api/connectors/composio/connections/${encodeURIComponent(e)}`),{method:`DELETE`})}async function qe(e){return Q(await f(d(`/api/connectors/composio/${encodeURIComponent(e)}/scope`)),`Could not load Composio scope.`).scope}async function Je(e,t){let n=await f(d(`/api/connectors/composio/${encodeURIComponent(e)}/scope`),{method:`POST`,body:JSON.stringify({scope:t})});return fe(),Q(n,`Could not update Composio scope.`).scope}async function Ye(e){return Q(await f(d(`/api/connectors/composio/${encodeURIComponent(e)}/policy`)),`Could not load Composio policy.`)}async function Xe(e,t){return Q(await f(d(`/api/connectors/composio/${encodeURIComponent(e)}/policy`),{method:`PATCH`,body:JSON.stringify(t)}),`Could not update Composio policy.`).policy}async function Ze(e){return Q(await f(d(`/api/connectors/composio/${encodeURIComponent(e)}/tools`)),`Could not load Composio tools.`).tools}async function Qe(e=50){return Q(await f(d(`/api/connectors/composio/triggers?limit=${encodeURIComponent(String(e))}`)),`Could not load Composio trigger events.`).events}async function $e(e){return Q(await f(d(`/api/connectors/${encodeURIComponent(e.connectorId)}/memory-sync`),{method:`POST`,body:JSON.stringify(e)}),`Could not sync connector data to memory.`)}async function et(e=`pending`){return Q(await f(d(`/api/connectors/approvals?status=${encodeURIComponent(e)}`)),`Could not load connector approvals.`).approvals}async function tt(e,t){return Q(await f(d(`/api/connectors/approvals/respond`),{method:`POST`,body:JSON.stringify({id:e,decision:t})}),`Could not update connector approval.`).approval}function nt(e,t){return Object.entries(t).reduce((e,[t,n])=>e.replaceAll(`{{${t}}}`,String(n)),e)}function rt(e,t){return t.connectorCapabilityLabels[e]??e}function it(e,t){if(e.runtime.type===`mcp`)return nt(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 nt(t.connectorRuntimeGeneric,{runtime:e.runtime.type,id:n??e.runtime.type})}function at(e,t){return e.auth.mode===`oauth`?t.connectorAuthOAuth:e.auth.mode===`apiKey`?t.connectorAuthApiKey:t.connectorAuthNone}function ot(e){return(e.setup.secrets??[]).filter(e=>e.required).length+(e.setup.config??[]).filter(e=>e.required).length}function st(e){let t=(0,X.c)(12),{title:n,items:r}=e;if(r.length===0)return null;let i;t[0]===n?i=t[1]:(i=(0,Z.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(ct),t[2]=r,t[3]=a);let o;t[4]===r.length?o=t[5]:(o=r.length>16?(0,Z.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,Z.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,Z.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 ct(e){return(0,Z.jsxs)(`div`,{className:`border-b border-edge-subtle px-3 py-2 last:border-b-0`,children:[(0,Z.jsx)(`div`,{className:`break-words font-mono text-xs font-medium text-fg`,children:e.title}),e.description?(0,Z.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description}):null]},e.id)}function lt({connector:e,installed:t,onClose:n,onInstall:r,t:i}){let[o,s]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(null),[u,d]=(0,Y.useState)(null),f=ot(e),p=e.capabilities.slice(0,8),m=Math.max(0,e.capabilities.length-p.length),h=[...(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()=>{s(!0),d(null);try{l(await Re(e))}catch(e){l(null),d(e instanceof Error?e.message:String(e))}finally{s(!1)}};return(0,Z.jsx)(M,{open:!0,onOpenChange:e=>{e||n()},children:(0,Z.jsxs)(F,{children:[(0,Z.jsx)(j,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,Z.jsxs)(b,{className:a(`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,Z.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-6 py-5`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Z.jsx)(J,{connector:e,size:`lg`}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-base px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:e.source}),(0,Z.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-base px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:e.kind}),t?(0,Z.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,Z.jsx)(pe,{className:`size-3`,"aria-hidden":!0}),i.connectedBadge]}):null]}),(0,Z.jsx)(ge,{className:`text-base font-semibold text-fg`,children:e.displayName}),(0,Z.jsx)(D,{className:`mt-1 line-clamp-3 text-sm leading-6 text-fg-muted`,children:e.description})]})]}),(0,Z.jsx)(P,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:a(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,W.focusRingPanel),"aria-label":i.modalClose,children:[(0,Z.jsx)(g,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`sr-only`,children:i.modalClose})]})})]}),(0,Z.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-5`,children:[(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,Z.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[(0,Z.jsx)(K,{className:`size-3.5`,"aria-hidden":!0}),i.detailTools]}),(0,Z.jsx)(`p`,{className:`mt-2 text-sm font-semibold text-fg`,children:c?nt(i.connectorPreviewToolsCount,{count:c.toolCount}):i.connectorPreviewUnknown})]}),(0,Z.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[(0,Z.jsx)(ae,{className:`size-3.5`,"aria-hidden":!0}),i.detailPermissions]}),(0,Z.jsx)(`p`,{className:`mt-2 text-sm font-semibold text-fg`,children:at(e,i)})]}),(0,Z.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[(0,Z.jsx)(E,{className:`size-3.5`,"aria-hidden":!0}),i.connectorRequiredInputs]}),(0,Z.jsx)(`p`,{className:`mt-2 text-sm font-semibold text-fg`,children:nt(i.connectorRequiredInputsCount,{count:f})})]})]}),(0,Z.jsxs)(`div`,{className:`mt-5 grid gap-5 lg:grid-cols-[minmax(0,1fr)_18rem]`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 space-y-5`,children:[(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i.connectorCapabilitiesTitle}),(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,children:[p.map(e=>(0,Z.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-base px-2 py-1 text-xs text-fg-muted`,children:rt(e,i)},e)),m>0?(0,Z.jsxs)(`span`,{className:`rounded-md border border-edge bg-surface-base px-2 py-1 text-xs text-fg-subtle`,children:[`+`,m]}):null]}),(0,Z.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:i.connectorCapabilitiesHint})]}),u?(0,Z.jsx)(`p`,{className:`rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:u}):null,c?(0,Z.jsxs)(`section`,{children:[(0,Z.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i.connectorPreviewTitle}),(0,Z.jsx)(`span`,{className:a(`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,Z.jsxs)(`div`,{className:`mb-3 grid gap-2 text-xs sm:grid-cols-3`,children:[(0,Z.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base px-3 py-2`,children:[(0,Z.jsx)(`div`,{className:`font-semibold text-fg`,children:c.toolCount}),(0,Z.jsx)(`div`,{className:`text-fg-muted`,children:i.toolsMetric})]}),(0,Z.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base px-3 py-2`,children:[(0,Z.jsx)(`div`,{className:`font-semibold text-fg`,children:c.resourceCount}),(0,Z.jsx)(`div`,{className:`text-fg-muted`,children:i.resourcesMetric})]}),(0,Z.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base px-3 py-2`,children:[(0,Z.jsx)(`div`,{className:`font-semibold text-fg`,children:c.promptCount}),(0,Z.jsx)(`div`,{className:`text-fg-muted`,children:i.promptsMetric})]})]}),(0,Z.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Z.jsx)(st,{title:i.detailTools,items:c.tools.map(e=>({id:e.name,title:e.shortName??e.name,description:e.description}))}),(0,Z.jsx)(st,{title:i.detailResources,items:c.resources.map(e=>({id:e.uri,title:e.title??e.name??e.uri,description:e.description??e.uri}))}),(0,Z.jsx)(st,{title:i.detailPrompts,items:c.prompts.map(e=>({id:e.name,title:e.title??e.name,description:e.description??nt(i.promptArgumentCount,{count:e.argumentCount})}))})]}),c.error?(0,Z.jsx)(`p`,{className:`mt-3 text-xs leading-5 text-fg-subtle`,children:c.error}):null,c.action?(0,Z.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-subtle`,children:c.action}):null]}):null]}),(0,Z.jsxs)(`aside`,{className:`space-y-3`,children:[(0,Z.jsxs)(`section`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,Z.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,Z.jsx)(ae,{className:`size-4 text-accent`,"aria-hidden":!0}),i.detailPermissions]}),(0,Z.jsx)(`p`,{className:`mt-2 text-sm font-medium text-fg`,children:at(e,i)})]}),(0,Z.jsxs)(`section`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,Z.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,Z.jsx)(E,{className:`size-4 text-accent`,"aria-hidden":!0}),i.connectorSetupTitle]}),h.length>0?(0,Z.jsx)(`div`,{className:`mt-3 divide-y divide-edge overflow-hidden rounded-lg border border-edge`,children:h.map(e=>(0,Z.jsxs)(`div`,{className:`bg-surface-panel px-3 py-2.5`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.label}),(0,Z.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,Z.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,Z.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:e.description}):null]},e.key))}):(0,Z.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:i.connectorSetupNone})]}),(0,Z.jsxs)(`section`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,Z.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,Z.jsx)(de,{className:`size-4 text-accent`,"aria-hidden":!0}),i.connectorRuntimeTitle]}),(0,Z.jsx)(`p`,{className:`mt-2 break-words text-xs leading-5 text-fg-muted`,children:it(e,i)})]})]})]})]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-2 border-t border-edge-subtle px-6 py-4`,children:[(0,Z.jsx)(P,{asChild:!0,children:(0,Z.jsx)(q,{variant:`secondary`,children:i.modalClose})}),(0,Z.jsxs)(q,{variant:`secondary`,disabled:o,onClick:()=>void _(),children:[o?(0,Z.jsx)(L,{className:`size-4 animate-spin`}):(0,Z.jsx)(K,{className:`size-4`}),i.connectorPreviewButton]}),t?(0,Z.jsxs)(q,{variant:`secondary`,disabled:!0,children:[(0,Z.jsx)(I,{className:`size-4`}),i.connectedBadge]}):(0,Z.jsxs)(q,{variant:`primary`,onClick:()=>{r(e),n()},children:[(0,Z.jsx)(oe,{className:`size-4`}),i.connect]})]})]})]})})}var ut=a(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,G);function dt(e){let t=(0,X.c)(58),{open:n,sessionIdleTtlMinutes:r,saving:i,onChange:o,onSave:s,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,Z.jsx)(j,{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=a(`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,Z.jsx)(`span`,{className:`flex size-10 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,Z.jsx)(ee,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),t[4]=m):m=t[4];let h;t[5]===l.runtimeSettingsTitle?h=t[6]:(h=(0,Z.jsx)(ge,{className:`text-base font-semibold text-fg`,children:l.runtimeSettingsTitle}),t[5]=l.runtimeSettingsTitle,t[6]=h);let _;t[7]===l.runtimeSettingsHint?_=t[8]:(_=(0,Z.jsx)(D,{className:`mt-1 text-sm text-fg-muted`,children:l.runtimeSettingsHint}),t[7]=l.runtimeSettingsHint,t[8]=_);let v;t[9]!==h||t[10]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[m,(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[h,_]})]}),t[9]=h,t[10]=_,t[11]=v):v=t[11];let y;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(y=a(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,W.focusRingPanel),t[12]=y):y=t[12];let x;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(g,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),t[13]=x):x=t[13];let S;t[14]===l.modalClose?S=t[15]:(S=(0,Z.jsx)(P,{asChild:!0,children:(0,Z.jsx)(`button`,{type:`button`,className:y,"aria-label":l.modalClose,children:x})}),t[14]=l.modalClose,t[15]=S);let C;t[16]!==S||t[17]!==v?(C=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-6 py-5`,children:[v,S]}),t[16]=S,t[17]=v,t[18]=C):C=t[18];let w;t[19]===u.idleTtlLabel?w=t[20]:(w=(0,Z.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:u.idleTtlLabel}),t[19]=u.idleTtlLabel,t[20]=w);let T;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(T=a(ut,`w-40 flex-none`),t[21]=T):T=t[21];let E=r??``,O;t[22]===o?O=t[23]:(O=e=>{let t=e.currentTarget.value.trim();o(t===``?void 0:Number.parseInt(t,10))},t[22]=o,t[23]=O);let k;t[24]!==u.idleTtlPlaceholder||t[25]!==E||t[26]!==O?(k=(0,Z.jsx)(`input`,{type:`number`,min:0,className:T,value:E,placeholder:u.idleTtlPlaceholder,onChange:O}),t[24]=u.idleTtlPlaceholder,t[25]=E,t[26]=O,t[27]=k):k=t[27];let A;t[28]===u.idleTtlHint?A=t[29]:(A=(0,Z.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:u.idleTtlHint}),t[28]=u.idleTtlHint,t[29]=A);let N;t[30]!==w||t[31]!==k||t[32]!==A?(N=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-5`,children:(0,Z.jsxs)(`label`,{className:`flex max-w-xl flex-col gap-1.5`,children:[w,k,A]})}),t[30]=w,t[31]=k,t[32]=A,t[33]=N):N=t[33];let I;t[34]!==c||t[35]!==i||t[36]!==l.modalCancel?(I=(0,Z.jsx)(q,{type:`button`,variant:`secondary`,disabled:i,onClick:c,children:l.modalCancel}),t[34]=c,t[35]=i,t[36]=l.modalCancel,t[37]=I):I=t[37];let R;t[38]===s?R=t[39]:(R=()=>void s(),t[38]=s,t[39]=R);let z;t[40]===i?z=t[41]:(z=i?(0,Z.jsx)(L,{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,Z.jsxs)(q,{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]!==I||t[48]!==B?(V=(0,Z.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle px-6 py-4`,children:[I,B]}),t[47]=I,t[48]=B,t[49]=V):V=t[49];let H;t[50]!==C||t[51]!==N||t[52]!==V?(H=(0,Z.jsxs)(F,{children:[f,(0,Z.jsxs)(b,{className:p,children:[C,N,V]})]}),t[50]=C,t[51]=N,t[52]=V,t[53]=H):H=t[53];let U;return t[54]!==n||t[55]!==d||t[56]!==H?(U=(0,Z.jsx)(M,{open:n,onOpenChange:d,children:H}),t[54]=n,t[55]=d,t[56]=H,t[57]=U):U=t[57],U}var ft=(0,Y.memo)(function(e){let t=(0,X.c)(12),{value:n,onChange:r,placeholder:i,className:o}=e,s;t[0]===o?s=t[1]:(s=a(`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`,o),t[0]=o,t[1]=s);let c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(V,{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,Z.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]!==s||t[10]!==u?(d=(0,Z.jsxs)(`label`,{className:s,children:[c,u]}),t[9]=s,t[10]=u,t[11]=d):d=t[11],d}),pt=(0,Y.memo)(function(e){let t=(0,X.c)(30),{onBrowseCatalog:n,onAddCustomServer:r,onOpenRuntimeSettings:i,addLabel:o,browseLabel:s,customLabel:c,settingsLabel:l}=e,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(le,{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,Z.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,Z.jsxs)(q,{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,Z.jsx)(he,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[7]=p):p=t[7];let m;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(H,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[8]=m):m=t[8];let h;t[9]===o?h=t[10]:(h=(0,Z.jsx)(se,{asChild:!0,children:(0,Z.jsxs)(q,{type:`button`,variant:`primary`,className:`shrink-0 gap-2`,children:[p,o,m]})}),t[9]=o,t[10]=h);let g;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(g=a(`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,W.transition),t[11]=g):g=t[11];let y;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(T,{className:`size-4 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),t[12]=y):y=t[12];let b;t[13]!==s||t[14]!==n?(b=(0,Z.jsxs)(_,{className:g,onSelect:n,children:[y,s]}),t[13]=s,t[14]=n,t[15]=b):b=t[15];let x;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(x=a(`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,W.transition),t[16]=x):x=t[16];let S;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(K,{className:`size-4 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),t[17]=S):S=t[17];let C;t[18]!==c||t[19]!==r?(C=(0,Z.jsxs)(_,{className:x,onSelect:r,children:[S,c]}),t[18]=c,t[19]=r,t[20]=C):C=t[20];let w;t[21]!==C||t[22]!==b?(w=(0,Z.jsx)(N,{children:(0,Z.jsxs)(v,{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:[b,C]})}),t[21]=C,t[22]=b,t[23]=w):w=t[23];let E;t[24]!==w||t[25]!==h?(E=(0,Z.jsxs)(ce,{children:[h,w]}),t[24]=w,t[25]=h,t[26]=E):E=t[26];let D;return t[27]!==E||t[28]!==f?(D=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:[f,E]}),t[27]=E,t[28]=f,t[29]=D):D=t[29],D}),mt=/^([^:=]+)[:=](.*)$/;function ht(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=mt.exec(t);r&&n.push({key:r[1].trim(),value:r[2].trim()})}return n.length>0?n:null}function gt(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 _t(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 vt(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 yt(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)||vt(t)&&(r[e]=t);return r}function bt(e){let t=e.trim();if(t)return t.split(/\s+/).filter(Boolean)}function xt(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 St(e){if(e.transport===`stdio`){let t={command:e.command.trim()},n=bt(e.argsText);return n?.length&&(t.args=n),e.cwd.trim()&&(t.cwd=e.cwd.trim()),e.envJson.trim()&&(t.env=xt(e.envJson)),e.connectionTimeoutMs!=null&&Number.isFinite(e.connectionTimeoutMs)&&(t.connectionTimeoutMs=e.connectionTimeoutMs),t}let t={url:e.url.trim(),transport:e.transport},n=gt(e.headers);return n&&(t.headers=n),e.connectionTimeoutMs!=null&&Number.isFinite(e.connectionTimeoutMs)&&(t.connectionTimeoutMs=e.connectionTimeoutMs),t}function Ct(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:_t(a),connectionTimeoutMs:typeof t.connectionTimeoutMs==`number`&&Number.isFinite(t.connectionTimeoutMs)?t.connectionTimeoutMs:void 0}}function wt(e=``){return{clientKey:crypto.randomUUID(),id:e,transport:`stdio`,command:``,argsText:``,envJson:``,cwd:``,url:``,headers:[{key:`Authorization`,value:``}],connectionTimeoutMs:void 0}}function Tt(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)||vt(t)?[]:[Ct(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 Et(e){return St(e)}async function Dt(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]=St(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 f(d(`/api/config`),{method:`PATCH`,body:JSON.stringify({mcp:r})}),fe()}function Ot(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 kt(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 At(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 jt(e,t){let n=await f(d(`/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=Ot(n.payload.tools),i=kt(n.payload.resources),a=At(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 Mt(e){return e.connectionTimeoutMs==null||!Number.isFinite(e.connectionTimeoutMs)?``:String(Math.round(e.connectionTimeoutMs/1e3))}function Nt(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 Pt(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 Ft({row:e,t,cs:n,onEdit:r,onRemove:i}){let[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(null),[d,f]=(0,Y.useState)(null),p=Pt(e),m=(0,Y.useCallback)(async()=>{o(!0),f(null);try{let t=await jt(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,Y.useCallback)(async()=>{c(!0),f(null);try{await i()}catch(e){f(e instanceof Error?e.message:String(e)),c(!1)}},[i]);return(0,Z.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,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:e.id.trim()||t.cardUntitled}),(0,Z.jsx)(`span`,{className:`rounded-full bg-surface-base px-2 py-0.5 text-[11px] text-fg-muted`,children:n.customBadge}),(0,Z.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,Z.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,Z.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,Z.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,Z.jsxs)(`div`,{className:`mt-4 flex items-center justify-between gap-2 border-t border-edge pt-3`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:n.connectorDetails}),(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsxs)(q,{variant:`secondary`,disabled:a,onClick:()=>void m(),children:[a?(0,Z.jsx)(L,{className:`size-4 animate-spin`}):(0,Z.jsx)(I,{className:`size-4`}),t.testConnection]}),(0,Z.jsxs)(q,{variant:`ghost`,disabled:s,onClick:()=>void h(),children:[s?(0,Z.jsx)(L,{className:`size-4 animate-spin`}):(0,Z.jsx)(x,{className:`size-4`}),t.removeServer]})]})]})]})}function It(e,t){return e?t&&e.startsWith(t)?e.slice(t.length):e:``}function Lt(e,t,n){let r=t.trim().toLowerCase();if(!r)return!0;let i=e.shortName||It(e.name,n);return[e.name,i,e.description].filter(Boolean).join(`
|
|
2
2
|
`).toLowerCase().includes(r)}function Rt(e,t){return e?t&&e.startsWith(t)?e.slice(t.length):e:``}function zt(e){let t=(0,X.c)(29),{tools:n,stripPrefix:r,searchPlaceholder:i,searchEmptyLabel:o}=e,[s,c]=(0,Y.useState)(``),l;if(t[0]!==s||t[1]!==r||t[2]!==n){let e;t[4]!==s||t[5]!==r?(e=e=>Lt(e,s,r),t[4]=s,t[5]=r,t[6]=e):e=t[6],l=n.filter(e),t[0]=s,t[1]=r,t[2]=n,t[3]=l}else l=t[3];let u=l,d;t[7]===s?d=t[8]:(d=s.trim(),t[7]=s,t[8]=d);let f=d.length>0,p;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(V,{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=a(`w-full rounded-lg border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg`,`placeholder:text-fg-subtle`,G),h=e=>c(e.target.value),t[10]=m,t[11]=h):(m=t[10],h=t[11]);let g;t[12]!==s||t[13]!==i?(g=(0,Z.jsxs)(`div`,{className:`relative`,children:[p,(0,Z.jsx)(`input`,{type:`search`,value:s,placeholder:i,"aria-label":i,className:m,onChange:h})]}),t[12]=s,t[13]=i,t[14]=g):g=t[14];let _;t[15]!==u.length||t[16]!==f||t[17]!==n.length?(_=f?(0,Z.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]=_):_=t[18];let v;t[19]!==g||t[20]!==_?(v=(0,Z.jsxs)(`div`,{className:`border-b border-edge px-5 py-3`,children:[g,_]}),t[19]=g,t[20]=_,t[21]=v):v=t[21];let y;t[22]!==u||t[23]!==o||t[24]!==r?(y=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:u.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:o}):(0,Z.jsx)(`ul`,{className:`flex flex-col gap-2`,children:u.map((e,t)=>{let n=e.shortName||Rt(e.name,r)||e.name||`?`,i=e.name||`tool-${t}`;return(0,Z.jsxs)(`li`,{className:`min-w-0 rounded-lg border border-edge bg-surface-base px-3 py-2.5`,children:[(0,Z.jsx)(`div`,{className:`truncate font-mono text-sm font-medium text-fg`,title:e.name===n?n:e.name,children:n}),e.description?(0,Z.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]=o,t[24]=r,t[25]=y):y=t[25];let b;return t[26]!==v||t[27]!==y?(b=(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[v,y]}),t[26]=v,t[27]=y,t[28]=b):b=t[28],b}function Bt(e){let t=(0,X.c)(38),{open:n,onOpenChange:r,serverId:i,title:o,subtitle:s,searchPlaceholder:c,searchEmptyLabel:l,emptyLabel:u,closeLabel:d,tools:f,stripPrefix:m}=e,h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(j,{className:a(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,re)}),t[0]=h):h=t[0];let _;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(_=a(`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`,p,`rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none dark:border-edge`),t[1]=_):_=t[1];let v;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(K,{className:`size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[2]=v):v=t[2];let y;t[3]===o?y=t[4]:(y=(0,Z.jsxs)(ge,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[v,o]}),t[3]=o,t[4]=y);let x;t[5]!==i||t[6]!==s||t[7]!==f.length?(x=s.replace(`{{serverId}}`,i).replace(`{{count}}`,String(f.length)),t[5]=i,t[6]=s,t[7]=f.length,t[8]=x):x=t[8];let S;t[9]===x?S=t[10]:(S=(0,Z.jsx)(D,{className:`mt-1 text-sm text-fg-muted`,children:x}),t[9]=x,t[10]=S);let C;t[11]!==y||t[12]!==S?(C=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[y,S]}),t[11]=y,t[12]=S,t[13]=C):C=t[13];let w;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(g,{className:`size-4`,"aria-hidden":!0}),t[14]=w):w=t[14];let T;t[15]===d?T=t[16]:(T=(0,Z.jsx)(P,{asChild:!0,children:(0,Z.jsx)(q,{type:`button`,variant:`ghost`,className:`size-8 shrink-0 px-0`,"aria-label":d,children:w})}),t[15]=d,t[16]=T);let E;t[17]!==C||t[18]!==T?(E=(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[C,T]}),t[17]=C,t[18]=T,t[19]=E):E=t[19];let O;t[20]!==u||t[21]!==n||t[22]!==l||t[23]!==c||t[24]!==i||t[25]!==m||t[26]!==f?(O=f.length>0?(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,Z.jsx)(zt,{tools:f,stripPrefix:m,searchPlaceholder:c,searchEmptyLabel:l},`${i}-${n?`open`:`closed`}`)}):(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:(0,Z.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]=m,t[26]=f,t[27]=O):O=t[27];let k;t[28]===d?k=t[29]:(k=(0,Z.jsx)(`div`,{className:`flex justify-end border-t border-edge px-5 py-3`,children:(0,Z.jsx)(P,{asChild:!0,children:(0,Z.jsx)(q,{type:`button`,variant:`secondary`,children:d})})}),t[28]=d,t[29]=k);let A;t[30]!==E||t[31]!==O||t[32]!==k?(A=(0,Z.jsxs)(F,{children:[h,(0,Z.jsxs)(b,{className:_,children:[E,O,k]})]}),t[30]=E,t[31]=O,t[32]=k,t[33]=A):A=t[33];let N;return t[34]!==r||t[35]!==n||t[36]!==A?(N=(0,Z.jsx)(M,{open:n,onOpenChange:r,children:A}),t[34]=r,t[35]=n,t[36]=A,t[37]=N):N=t[37],N}var Vt=a(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,G);function Ht(e){return e.materialized.type===`composio`?e.materialized.toolkit:null}function Ut(e,t){return e===`write`?t.composioScopeWrite:e===`admin`?t.composioScopeAdmin:t.composioScopeRead}function Wt(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 Gt({instance:e,t}){let n=Ht(e),[r,i]=(0,Y.useState)([]),[s,c]=(0,Y.useState)([]),[l,u]=(0,Y.useState)([]),[d,f]=(0,Y.useState)([]),[p,m]=(0,Y.useState)(null),[h,_]=(0,Y.useState)([]),[v,y]=(0,Y.useState)(``),[b,S]=(0,Y.useState)(`{}`),[C,T]=(0,Y.useState)(null),[D,O]=(0,Y.useState)(null),[k,A]=(0,Y.useState)(`read`),[j,M]=(0,Y.useState)(!1),[N,P]=(0,Y.useState)(null),F=(0,Y.useCallback)(async()=>{if(!(!n||e.materialized.type!==`composio`||e.materialized.role===`credential`)){M(!0),P(null);try{let[t,r,a,o,s,l,d]=await Promise.all([He().catch(()=>[]),Ze(n).catch(()=>[]),Qe(20).catch(()=>[]),qe(n).catch(()=>`read`),et().catch(()=>[]),Ye(n).catch(()=>null),We(n).catch(()=>null)]);i(t.filter(e=>e.toolkit.toLowerCase()===n.toLowerCase())),c(r),u(a.filter(e=>!e.toolkit||e.toolkit.toLowerCase()===n.toLowerCase())),A(o),f(s.filter(t=>t.connectorId===e.connectorId)),m(l?.policy??null),_(l?.agents??[]),y(e=>e||r.find(e=>e.scope===`read`&&e.curated)?.slug||``),O(d)}catch(e){P(e instanceof Error?e.message:String(e))}finally{M(!1)}}},[e.connectorId,e.materialized,n]);(0,Y.useEffect)(()=>{F()},[F]);let I=(0,Y.useCallback)(async()=>{if(n){M(!0),P(null);try{let t=await Ie(e.connectorId);if(!t.authorizationUrl)throw Error(`The authorization provider did not return an authorization URL.`);window.open(t.authorizationUrl,`_blank`,`noopener,noreferrer`)}catch(e){P(e instanceof Error?e.message:String(e))}finally{M(!1)}}},[e.connectorId,n]),R=(0,Y.useCallback)(async e=>{if(n){A(e);try{await Je(n,e),await F()}catch(e){P(e instanceof Error?e.message:String(e))}}},[F,n]),V=(0,Y.useCallback)(async(e,t)=>{M(!0),P(null);try{await tt(e,t),await F()}catch(e){P(e instanceof Error?e.message:String(e))}finally{M(!1)}},[F]),H=(0,Y.useCallback)(async e=>{if(n){P(null);try{m(await Xe(n,e))}catch(e){P(e instanceof Error?e.message:String(e))}}},[e.connectorId,n]),ee=(0,Y.useCallback)(e=>{p&&H({allowedAgentIds:p.allowedAgentIds.includes(e)?p.allowedAgentIds.filter(t=>t!==e):[...p.allowedAgentIds,e]})},[H,p]),U=(0,Y.useCallback)(async e=>{M(!0),P(null);try{await e(),await F()}catch(e){P(e instanceof Error?e.message:String(e))}finally{M(!1)}},[F]),te=(0,Y.useCallback)(async()=>{if(!(!n||!v)){M(!0),P(null),T(null);try{let n=JSON.parse(b);if(!n||typeof n!=`object`||Array.isArray(n))throw Error(t.composioMemoryArgumentsObject);let i=p?.allowedAgentIds[0]??h[0]?.id;if(!i)throw Error(t.composioMemoryAgentMissing);T((await $e({connectorId:e.connectorId,actionId:v,agentId:i,connectionId:r.find(e=>e.isDefault)?.id,arguments:n})).recordId)}catch(e){P(e instanceof Error?e.message:String(e))}finally{M(!1)}}},[h,r,e.connectorId,v,b,p,t,n]);return n?e.materialized.type===`composio`&&e.materialized.role===`credential`?(0,Z.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,children:t.composioApiKeyStored}):(0,Z.jsxs)(`div`,{className:`mt-4 rounded-xl border border-edge bg-surface-base p-3 text-sm`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`p`,{className:`font-medium text-fg`,children:$(t.composioToolkitTitle,{toolkit:n})}),(0,Z.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:t.composioScopeHint})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Z.jsxs)(z,{className:a(Vt,`h-9 w-28 py-1`),value:k,onChange:e=>void R(e.currentTarget.value),children:[(0,Z.jsx)(B,{value:`read`,children:t.composioScopeRead}),(0,Z.jsx)(B,{value:`write`,children:t.composioScopeWrite}),(0,Z.jsx)(B,{value:`admin`,children:t.composioScopeAdmin})]}),(0,Z.jsxs)(q,{variant:`secondary`,disabled:j,onClick:()=>void I(),children:[j?(0,Z.jsx)(L,{className:`size-4 animate-spin`}):(0,Z.jsx)(ae,{className:`size-4`}),t.connectOAuth]}),(0,Z.jsx)(q,{variant:`ghost`,disabled:j,onClick:()=>void F(),children:t.refresh})]})]}),N?(0,Z.jsx)(`p`,{className:`mt-3 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:N}):null,D?(0,Z.jsxs)(`div`,{className:a(`mt-3 flex flex-wrap items-center justify-between gap-2 rounded-lg border px-3 py-2 text-xs`,D.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,Z.jsx)(`span`,{children:D.status===`connected`?$(t.composioHealthConnected,{count:String(D.activeConnections)}):D.status===`reauthorization_required`?t.composioHealthReconnect:D.status===`degraded`?Wt(D,t):t.composioHealthDisconnected}),D.recovery===`none`?null:(0,Z.jsx)(q,{variant:`ghost`,disabled:j,onClick:()=>void(D.recovery===`retry`?F():I()),children:D.recovery===`retry`?t.composioRetry:t.connectOAuth}),D.status===`degraded`&&D.message?(0,Z.jsx)(`p`,{className:`basis-full break-words text-[11px] opacity-80`,children:D.message}):null]}):null,p?(0,Z.jsxs)(`div`,{className:`mt-4 grid gap-3 rounded-lg border border-edge bg-surface-panel p-3 md:grid-cols-[minmax(0,180px)_1fr]`,children:[(0,Z.jsxs)(`label`,{className:`text-xs font-medium text-fg-subtle`,children:[t.composioConfirmationPolicy,(0,Z.jsxs)(z,{className:a(Vt,`mt-1 h-9 py-1`),value:p.confirmationPolicy,onChange:e=>void H({confirmationPolicy:e.currentTarget.value}),children:[(0,Z.jsx)(B,{value:`writes`,children:t.composioConfirmWrites}),(0,Z.jsx)(B,{value:`always`,children:t.composioConfirmAlways}),(0,Z.jsx)(B,{value:`never`,children:t.composioConfirmNever})]})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`p`,{className:`text-xs font-medium text-fg-subtle`,children:t.composioAllowedAgents}),(0,Z.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:p.allowedAgentIds.length?t.composioAllowedAgentsSelected:t.composioAllowedAgentsAll}),(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:h.map(e=>(0,Z.jsx)(`button`,{type:`button`,className:a(`rounded-full border px-2.5 py-1 text-xs transition-colors`,p.allowedAgentIds.includes(e.id)?`border-accent bg-accent/10 text-accent`:`border-edge text-fg-muted hover:text-fg`),onClick:()=>ee(e.id),children:e.name},e.id))})]})]}):null,[`gmail`,`googledrive`,`notion`,`slack`].includes(n)&&s.some(e=>e.scope===`read`&&e.curated)?(0,Z.jsxs)(`div`,{className:`mt-4 rounded-lg border border-edge bg-surface-panel p-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,Z.jsx)(E,{className:`mt-0.5 size-4 text-accent`}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.composioMemorySync}),(0,Z.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.composioMemorySyncHint})]})]}),(0,Z.jsxs)(`div`,{className:`mt-3 grid gap-2 md:grid-cols-[minmax(0,240px)_1fr_auto] md:items-end`,children:[(0,Z.jsxs)(`label`,{className:`text-xs text-fg-subtle`,children:[t.composioMemoryReadAction,(0,Z.jsx)(z,{className:a(Vt,`mt-1 h-9 py-1`),value:v,onChange:e=>y(e.currentTarget.value),children:s.filter(e=>e.scope===`read`&&e.curated).map(e=>(0,Z.jsx)(B,{value:e.slug,children:e.name??e.slug},e.slug))})]}),(0,Z.jsxs)(`label`,{className:`text-xs text-fg-subtle`,children:[t.composioMemoryArguments,(0,Z.jsx)(`input`,{className:a(Vt,`mt-1 h-9 py-1 font-mono text-xs`),value:b,onChange:e=>S(e.currentTarget.value)})]}),(0,Z.jsxs)(q,{disabled:j||!v,onClick:()=>void te(),children:[j?(0,Z.jsx)(L,{className:`size-4 animate-spin`}):(0,Z.jsx)(E,{className:`size-4`}),t.composioSyncNow]})]}),C?(0,Z.jsx)(`p`,{className:`mt-2 text-xs text-emerald-600`,children:$(t.composioMemorySynced,{id:C})}):null]}):null,d.length?(0,Z.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,Z.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:t.composioPendingApprovals}),d.map(e=>(0,Z.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,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`p`,{className:`truncate font-mono text-xs font-medium text-fg`,children:e.actionId}),(0,Z.jsx)(`p`,{className:`mt-1 break-all font-mono text-xs text-fg-subtle`,children:JSON.stringify(e.argumentsPreview)}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:$(t.composioApprovalExpires,{time:new Date(e.expiresAt).toLocaleTimeString()})})]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[(0,Z.jsxs)(q,{variant:`secondary`,disabled:j,onClick:()=>void V(e.id,`denied`),children:[(0,Z.jsx)(g,{className:`size-4`}),t.composioDeny]}),(0,Z.jsxs)(q,{disabled:j,onClick:()=>void V(e.id,`approved`),children:[(0,Z.jsx)(o,{className:`size-4`}),t.approve]})]})]},e.id))]}):null,(0,Z.jsxs)(`div`,{className:`mt-4 grid gap-3 lg:grid-cols-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`p`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:t.composioConnections}),r.length?r.map(e=>(0,Z.jsxs)(`div`,{className:`space-y-2 rounded-lg border border-edge bg-surface-panel p-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`p`,{className:`truncate font-mono text-xs text-fg`,children:e.accountEmail??e.username??e.workspace??e.providerConnectionId}),(0,Z.jsxs)(`p`,{className:`text-xs text-fg-subtle`,children:[e.status,e.isDefault?` · ${t.composioDefaultAccount}`:``]})]}),(0,Z.jsx)(`input`,{className:a(Vt,`h-8 py-1 text-xs`),defaultValue:e.alias??``,placeholder:t.composioAccountAlias,onBlur:t=>{t.currentTarget.value!==(e.alias??``)&&U(()=>Ue(e.id,{alias:t.currentTarget.value}))}}),(0,Z.jsxs)(`div`,{className:`flex gap-1`,children:[(0,Z.jsx)(q,{variant:`ghost`,className:`size-8 p-0`,title:t.composioMakeDefault,disabled:j||e.isDefault,onClick:()=>void U(async()=>{await Ue(e.id,{isDefault:!0}),n&&await Xe(n,{selectedConnectionIds:[e.id]})}),children:(0,Z.jsx)(w,{className:a(`size-4`,e.isDefault&&`fill-current`)})}),(0,Z.jsx)(q,{variant:`ghost`,className:`size-8 p-0`,title:t.refresh,disabled:j,onClick:()=>void U(()=>Ge(e.id)),children:(0,Z.jsx)(ie,{className:`size-4`})}),(0,Z.jsx)(q,{variant:`ghost`,className:`size-8 p-0`,title:t.composioRevoke,disabled:j,onClick:()=>{window.confirm(t.composioRevokeConfirm)&&U(()=>Ke(e.id))},children:(0,Z.jsx)(x,{className:`size-4 text-red-500`})})]})]},e.id)):(0,Z.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.composioConnectionsEmpty})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`p`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:t.composioAgentTools}),s.length?s.slice(0,8).map(e=>(0,Z.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-panel p-2`,children:[(0,Z.jsx)(`p`,{className:`truncate font-mono text-xs text-fg`,children:e.slug}),(0,Z.jsxs)(`p`,{className:`text-xs text-fg-subtle`,children:[Ut(e.scope,t),e.curated?``:` ${t.composioUncuratedSuffix}`]})]},e.slug)):(0,Z.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.composioToolsEmpty})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`p`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:t.composioRecentTriggers}),l.length?l.slice(0,5).map(e=>(0,Z.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-panel p-2`,children:[(0,Z.jsx)(`p`,{className:`truncate text-xs text-fg`,children:e.trigger??e.id}),(0,Z.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:new Date(e.at).toLocaleString()})]},`${e.id}-${e.at}`)):(0,Z.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.composioTriggersEmpty})]})]})]}):null}var Kt=a(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,G);function qt(e,t){return e?t.healthStatusLabels[e]??e:t.healthNotTested}function Jt(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 Yt(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 Xt(e){let t=(0,X.c)(12),{title:n,description:r,meta:i}=e,o;t[0]===r?o=t[1]:(o=r?(0,Z.jsx)(ue,{delayDuration:300,skipDelayDuration:100,children:(0,Z.jsxs)(O,{children:[(0,Z.jsx)(R,{asChild:!0,children:(0,Z.jsx)(`p`,{tabIndex:0,title:r,className:a(`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,Z.jsx)(A,{children:(0,Z.jsx)(S,{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,Z.jsx)(`span`,{className:`whitespace-pre-wrap break-words`,children:r})})})]})}):null,t[0]=r,t[1]=o);let s=o,c;t[2]===n?c=t[3]:(c=(0,Z.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,Z.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,Z.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]!==s||t[10]!==u?(d=(0,Z.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2.5`,children:[u,s]}),t[9]=s,t[10]=u,t[11]=d):d=t[11],d}function Zt({instance:e,definition:t,onClose:n,onChanged:r,t:i,mcp:o}){let[s,c]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)(!1),[p,h]=(0,Y.useState)(null),[_,v]=(0,Y.useState)(`health`),[S,C]=(0,Y.useState)(!1),[w,T]=(0,Y.useState)(()=>Jt(t,e)),[O,k]=(0,Y.useState)(null),A=t?.setup.config??[],N=e.materialized.type===`mcp`&&A.length>0&&(t?.setup.secrets??[]).length===0,R=p?p.toolCount:e.usage.lastToolCount,z=(0,Y.useMemo)(()=>{let t=[[`health`,m,i.detailHealth],[`tools`,K,`${i.detailTools} ${p?p.toolCount:e.usage.lastToolCount??``}`],[`resources`,E,`${i.detailResources} ${p?p.resourceCount:e.usage.lastResourceCount??``}`],[`prompts`,y,`${i.detailPrompts} ${p?p.promptCount:e.usage.lastPromptCount??``}`],[`permissions`,ae,i.detailPermissions]];return N?[...t,[`config`,E,i.connectorConfigLabel]]:t},[p,e.usage.lastPromptCount,e.usage.lastResourceCount,e.usage.lastToolCount,N,i]),B=(0,Y.useCallback)(async()=>{c(!0),k(null);try{let t=await Ve(e.instanceId);h(t),t.toolCount>0&&v(`tools`),r()}catch(e){k(e instanceof Error?e.message:String(e))}finally{c(!1)}},[e.instanceId,r]),V=(0,Y.useCallback)(async()=>{u(!0),k(null);try{await Be(e.instanceId),await r(),n()}catch(e){k(e instanceof Error?e.message:String(e)),u(!1)}},[e.instanceId,r,n]),H=(0,Y.useCallback)(async()=>{if(!(!t||!N)){f(!0),k(null);try{let n={};for(let e of t.setup.config??[]){let t=Yt(e.type,w[e.key]??``);t!==void 0&&(n[e.key]=t)}await ze(e.instanceId,{config:n}),await r(),v(`health`)}catch(e){k(e instanceof Error?e.message:String(e))}finally{f(!1)}}},[w,t,e.instanceId,r,N]);return(0,Z.jsxs)(M,{open:!0,onOpenChange:e=>{e||n()},children:[(0,Z.jsxs)(F,{children:[(0,Z.jsx)(j,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,Z.jsxs)(b,{className:a(`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,Z.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-6 py-5`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Z.jsx)(J,{connector:t,size:`lg`}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(ge,{className:`text-base font-semibold text-fg`,children:e.displayName}),(0,Z.jsx)(D,{className:`mt-1 text-sm text-fg-muted`,children:e.materialized.type===`mcp`?$(i.mcpServerRuntime,{serverId:e.materialized.serverId}):$(i.runtimeLabel,{runtime:e.materialized.type})})]})]}),(0,Z.jsx)(P,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:a(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,W.focusRingPanel),"aria-label":i.modalClose,children:[(0,Z.jsx)(g,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`sr-only`,children:i.modalClose})]})})]}),(0,Z.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-5`,children:[O?(0,Z.jsx)(`p`,{className:`mb-4 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:O}):null,(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:z.map(([e,t,n])=>(0,Z.jsxs)(`button`,{type:`button`,className:a(`inline-flex h-8 items-center gap-1.5 rounded-md border px-2.5 text-xs`,_===e?`border-accent bg-accent-soft text-accent-fg`:`border-edge bg-surface-base text-fg-muted hover:text-fg`),onClick:()=>v(e),children:[(0,Z.jsx)(t,{className:`size-3.5`,"aria-hidden":!0}),n]},e))}),(0,Z.jsxs)(`div`,{className:`mt-4 rounded-xl border border-edge bg-surface-base p-3 text-sm`,children:[_===`health`?(0,Z.jsxs)(`div`,{className:`space-y-1 text-fg-muted`,children:[(0,Z.jsxs)(`p`,{children:[i.statusLabel,` `,(0,Z.jsx)(`span`,{className:p?.ok?`font-medium text-emerald-700 dark:text-emerald-300`:`font-medium text-fg`,children:qt(p?.status??e.usage.lastHealthStatus,i)})]}),(0,Z.jsxs)(`p`,{children:[i.lastCheckLabel,` `,e.usage.lastHealthCheckAt?new Date(e.usage.lastHealthCheckAt).toLocaleString():i.never]}),p?.action?(0,Z.jsx)(`p`,{children:p.action}):null]}):null,_===`tools`?p?.tools.length?(0,Z.jsxs)(`div`,{className:`grid gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Z.jsx)(`p`,{className:`text-xs text-fg-muted`,children:$(i.toolsAvailable,{count:String(p.tools.length)})}),(0,Z.jsx)(q,{type:`button`,variant:`ghost`,className:`h-7 text-xs`,onClick:()=>C(!0),children:o.viewAllTools})]}),(0,Z.jsx)(`div`,{className:`grid gap-2`,children:p.tools.slice(0,8).map(e=>(0,Z.jsx)(Xt,{title:e.shortName??e.name,description:e.description},e.name))})]}):(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsx)(`p`,{className:`text-fg-muted`,children:R?$(i.toolsLastCheckSummary,{count:String(R)}):i.toolsRunTestHint}),(0,Z.jsxs)(q,{type:`button`,variant:`secondary`,disabled:s,onClick:()=>void B(),children:[s?(0,Z.jsx)(L,{className:`size-4 animate-spin`}):(0,Z.jsx)(I,{className:`size-4`}),i.test]})]}):null,_===`resources`?p?.resources.length?(0,Z.jsx)(`div`,{className:`grid gap-2`,children:p.resources.slice(0,8).map(e=>(0,Z.jsx)(Xt,{title:e.title??e.name,description:e.uri,meta:e.mimeType},e.uri))}):(0,Z.jsx)(`p`,{className:`text-fg-muted`,children:i.resourcesRunTestHint}):null,_===`prompts`?p?.prompts.length?(0,Z.jsx)(`div`,{className:`grid gap-2`,children:p.prompts.slice(0,8).map(e=>(0,Z.jsx)(Xt,{title:e.title??e.name,description:e.description,meta:e.argumentCount?$(i.promptArgumentCount,{count:String(e.argumentCount)}):void 0},e.name))}):(0,Z.jsx)(`p`,{className:`text-fg-muted`,children:i.promptsRunTestHint}):null,_===`permissions`?(0,Z.jsxs)(`div`,{className:`space-y-1 text-fg-muted`,children:[(0,Z.jsx)(`p`,{children:$(i.secretsConfigured,{count:String(Object.values(e.secretStatus).filter(Boolean).length)})}),(0,Z.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,Z.jsx)(`p`,{children:e.materialized.type===`mcp`?i.mcpPolicyHint:i.connectorPolicyHint})]}):null,_===`config`&&N?(0,Z.jsx)(`div`,{className:`grid gap-3`,children:A.map(e=>(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.label}),e.description?(0,Z.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:e.description}):null,(0,Z.jsx)(`input`,{className:Kt,value:w[e.key]??``,placeholder:e.placeholder,onChange:t=>T(n=>({...n,[e.key]:t.currentTarget.value}))})]},e.key))}):null]}),e.materialized.type===`composio`?(0,Z.jsx)(Gt,{instance:e,t:i}):null]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-2 border-t border-edge-subtle px-6 py-4`,children:[(0,Z.jsx)(q,{variant:`secondary`,onClick:n,children:i.modalClose}),_===`config`&&N?(0,Z.jsxs)(q,{variant:`primary`,disabled:d,onClick:()=>void H(),children:[d?(0,Z.jsx)(L,{className:`size-4 animate-spin`}):(0,Z.jsx)(U,{className:`size-4`}),i.modalSave]}):null,e.materialized.type===`mcp`?(0,Z.jsxs)(q,{variant:`secondary`,disabled:s,onClick:()=>void B(),children:[s?(0,Z.jsx)(L,{className:`size-4 animate-spin`}):(0,Z.jsx)(I,{className:`size-4`}),i.test]}):null,(0,Z.jsxs)(q,{variant:`ghost`,disabled:l,onClick:()=>void V(),children:[l?(0,Z.jsx)(L,{className:`size-4 animate-spin`}):(0,Z.jsx)(x,{className:`size-4`}),i.remove]})]})]})]}),e.materialized.type===`mcp`?(0,Z.jsx)(Bt,{open:S,onOpenChange:C,serverId:e.materialized.serverId,title:$(i.installedToolsDialogTitle,{name:e.displayName}),subtitle:i.installedToolsDialogSubtitle,searchPlaceholder:o.toolsDialogSearchPlaceholder,searchEmptyLabel:o.toolsDialogSearchEmpty,emptyLabel:i.toolsRunTestHint,closeLabel:o.toolsDialogClose,tools:p?.tools??[],stripPrefix:`${e.materialized.serverId}__`}):null]})}function Qt({instance:e,definition:t,highlighted:n=!1,onOpenDetails:r,onChanged:i,t:o}){let[s,c]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)(null),p=(0,Y.useCallback)(async()=>{c(!0),f(null);try{await Ve(e.instanceId),await i()}catch(e){f(e instanceof Error?e.message:String(e))}finally{c(!1)}},[e.instanceId,i]),m=(0,Y.useCallback)(async()=>{u(!0),f(null);try{await Be(e.instanceId),await i()}catch(e){f(e instanceof Error?e.message:String(e)),u(!1)}},[e.instanceId,i]),h=e.usage.lastHealthStatus?o.healthStatusLabels[e.usage.lastHealthStatus]??e.usage.lastHealthStatus:o.healthNotTested,g=e.usage.lastToolCount??0,_=!!(t?.setup.config?.length&&!t.setup.secrets?.length&&e.materialized.type===`mcp`);return(0,Z.jsxs)(`div`,{className:a(`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,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start gap-3`,children:[(0,Z.jsx)(J,{connector:t}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:e.displayName}),(0,Z.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,Z.jsx)(pe,{className:`size-3`,"aria-hidden":!0}),o.connectedBadge]}),_?(0,Z.jsx)(`span`,{className:`rounded-full bg-surface-base px-2 py-0.5 text-[11px] text-fg-muted`,children:o.connectorConfigLabel}):null]}),(0,Z.jsx)(`p`,{className:`mt-3 line-clamp-2 break-all text-sm leading-5 text-fg-muted`,children:e.materialized.type===`mcp`?$(o.mcpServerRuntime,{serverId:e.materialized.serverId}):$(o.runtimeLabel,{runtime:e.materialized.type})}),(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 text-xs text-fg-muted`,children:[(0,Z.jsxs)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:[o.statusLabel,` `,h]}),(0,Z.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:$(o.toolsAvailable,{count:String(g)})})]}),d?(0,Z.jsx)(`p`,{className:`mt-3 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:d}):null]})]}),(0,Z.jsxs)(`div`,{className:`mt-4 flex items-center justify-between gap-2 border-t border-edge pt-3`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:o.connectorDetails}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[e.materialized.type===`mcp`?(0,Z.jsxs)(q,{variant:`secondary`,disabled:s,onClick:()=>void p(),children:[s?(0,Z.jsx)(L,{className:`size-4 animate-spin`}):(0,Z.jsx)(I,{className:`size-4`}),o.test]}):null,(0,Z.jsxs)(q,{variant:`ghost`,disabled:l,onClick:()=>void m(),children:[l?(0,Z.jsx)(L,{className:`size-4 animate-spin`}):(0,Z.jsx)(x,{className:`size-4`}),o.remove]})]})]})]})}var $t=a(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,G),en=a($t,`min-h-28 font-mono`);function tn(e,t){return e?t.healthStatusLabels[e]??e:t.healthStatusPending}function nn(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 rn(e){let t=(0,X.c)(12),{title:n,items:r}=e;if(r.length===0)return null;let i;t[0]===n?i=t[1]:(i=(0,Z.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(an),t[2]=r,t[3]=a);let o;t[4]===r.length?o=t[5]:(o=r.length>12?(0,Z.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,Z.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,Z.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 an(e){return(0,Z.jsxs)(`div`,{className:`border-b border-edge-subtle px-3 py-2 last:border-b-0`,children:[(0,Z.jsx)(`div`,{className:`break-words font-mono text-xs font-medium text-fg`,children:e.title}),e.description?(0,Z.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description}):null]},e.id)}function on({draft:e,onChange:t,onClose:n,onInstalled:r,t:i}){let{connector:o}=e,s=e.result?`complete`:e.installing?`health`:`configure`,c=[{id:`configure`,label:i.connectStepConfigure},{id:`health`,label:i.connectStepVerify},{id:`complete`,label:i.connectStepReady}],l=(0,Y.useCallback)(async()=>{t({...e,installing:!0,error:null,result:null,health:null});try{let n={};for(let t of o.setup.config??[]){let r=nn(t.type,e.config[t.key]??``);r!==void 0&&(n[t.key]=r)}let i=e.store?await Ae(e.store.packageName,{secrets:e.secrets,config:n},e.store.version):await Le(o.id,{secrets:e.secrets,config:n,definition:o.source===`registry`?o:void 0}),a=null;try{a=await Ve(i.instanceId)}catch{a=null}t({...e,installing:!1,result:i,health:a}),await r(i)}catch(n){t({...e,installing:!1,error:n instanceof Error?n.message:String(n)})}},[o,e,t,r]);return(0,Z.jsx)(M,{open:!0,onOpenChange:e=>{e||n()},children:(0,Z.jsxs)(F,{children:[(0,Z.jsx)(j,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,Z.jsxs)(b,{className:a(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex max-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,Z.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-6 py-5`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Z.jsx)(J,{connector:o,size:`lg`}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(ge,{className:`text-base font-semibold text-fg`,children:$(i.connectDialogTitle,{name:o.displayName})}),(0,Z.jsx)(D,{className:`mt-1 line-clamp-3 text-sm text-fg-muted`,children:o.description})]})]}),(0,Z.jsx)(P,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:a(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,W.focusRingPanel),"aria-label":i.modalClose,children:[(0,Z.jsx)(g,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`sr-only`,children:i.modalClose})]})})]}),(0,Z.jsxs)(`div`,{className:`min-h-0 overflow-y-auto px-6 py-5`,children:[(0,Z.jsx)(`div`,{className:`mb-5 grid grid-cols-3 gap-2`,"aria-label":i.connectProgressAria,children:c.map((e,t)=>{let n=c.findIndex(e=>e.id===s);return(0,Z.jsxs)(`div`,{className:a(`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,Z.jsxs)(`span`,{className:`mr-1 tabular-nums`,children:[t+1,`.`]}),e.label]},e.id)})}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[o.integrationStrategy?(0,Z.jsx)(`div`,{className:`rounded-xl border border-accent/20 bg-accent-soft/60 px-4 py-3 text-sm text-accent-fg`,children:o.integrationStrategy.lane===`mcp`?i.integrationStrategyMcpHint:o.integrationStrategy.lane===`native`?i.integrationStrategyNativeHint:i.integrationStrategyComposioHint}):null,e.store?(0,Z.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i.detailPermissions}),(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,children:[(e.store.permissions.data??[]).map(e=>(0,Z.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,Z.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-panel px-2 py-1 text-xs text-fg-muted`,children:e},e)),(0,Z.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,(o.setup.secrets??[]).map(n=>(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.label}),n.description?(0,Z.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:n.description}):null,(0,Z.jsx)(me,{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)),(o.setup.config??[]).map(n=>(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.label}),n.type===`json`?(0,Z.jsx)(`textarea`,{className:en,value:e.config[n.key]??``,placeholder:n.placeholder,onChange:r=>t({...e,config:{...e.config,[n.key]:r.currentTarget.value},error:null})}):(0,Z.jsx)(`input`,{className:$t,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,Z.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4 text-sm text-fg-muted`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 font-medium text-fg`,children:[(0,Z.jsx)(L,{className:`size-4 animate-spin text-accent`,"aria-hidden":!0}),i.connectingTitle]}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:i.connectingHint})]}):null,e.error?(0,Z.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:e.error}):null,e.result?(0,Z.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4 text-sm text-fg-muted`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`p`,{className:`font-medium text-fg`,children:$(i.connectedAs,{target:e.result.materialized.type===`mcp`?e.result.materialized.serverId:e.result.instanceId})}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:$(i.runtimeLabel,{runtime:e.result.materialized.type.toUpperCase()})})]}),(0,Z.jsx)(`span`,{className:a(`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:tn(e.health?.status,i)})]}),e.health?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`mt-3 grid gap-2 text-xs sm:grid-cols-3`,children:[(0,Z.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2`,children:[(0,Z.jsx)(`div`,{className:`font-semibold text-fg`,children:e.health.toolCount}),(0,Z.jsx)(`div`,{children:i.toolsMetric})]}),(0,Z.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2`,children:[(0,Z.jsx)(`div`,{className:`font-semibold text-fg`,children:e.health.resourceCount}),(0,Z.jsx)(`div`,{children:i.resourcesMetric})]}),(0,Z.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2`,children:[(0,Z.jsx)(`div`,{className:`font-semibold text-fg`,children:e.health.promptCount}),(0,Z.jsx)(`div`,{children:i.promptsMetric})]})]}),(0,Z.jsxs)(`div`,{className:`mt-3 grid gap-2`,children:[(0,Z.jsx)(rn,{title:i.detailTools,items:e.health.tools.map(e=>({id:e.name,title:e.shortName??e.name,description:e.description}))}),(0,Z.jsx)(rn,{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,Z.jsx)(rn,{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,Z.jsx)(`p`,{className:`mt-3`,children:i.installedWithoutHealth}),e.health?.action?(0,Z.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:e.health.action}):null]}):null]})]}),(0,Z.jsx)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle px-6 py-4`,children:(0,Z.jsxs)(q,{variant:`primary`,disabled:!!e.result||e.installing,onClick:()=>void l(),children:[e.installing?(0,Z.jsx)(L,{className:`size-4 animate-spin`}):e.result?(0,Z.jsx)(pe,{className:`size-4`}):(0,Z.jsx)(oe,{className:`size-4`}),e.result?i.connectedBadge:i.connect]})})]})]})})}function sn(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 cn(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 wt(r)}function ln(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 un(){return a(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,G)}function dn({label:e,optionalLabel:t,addLabel:n,removeHeaderAria:r,pasteLabel:i,pasteFailed:o,keyPlaceholder:c,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 s();if(!e){window.alert(o);return}let t=ht(e);if(!t?.length){window.alert(o);return}d(t)}catch{window.alert(o)}};return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2 md:col-span-2`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm font-medium text-fg`,children:[(0,Z.jsx)(`span`,{children:e}),t?(0,Z.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:t}):null]}),(0,Z.jsxs)(q,{type:`button`,variant:`ghost`,className:`h-8 gap-1.5 px-2 text-xs`,onClick:()=>void h(),children:[(0,Z.jsx)(C,{className:`size-3.5`,"aria-hidden":!0}),i]})]}),(0,Z.jsx)(`div`,{className:`flex flex-col gap-2`,children:u.map((e,t)=>(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`input`,{className:a(un(),`min-w-0 flex-1 font-mono text-xs`),value:e.key,placeholder:c,onChange:e=>f(t,{key:e.target.value})}),(0,Z.jsx)(`input`,{className:a(un(),`min-w-0 flex-[1.4] font-mono text-xs`),value:e.value,placeholder:l,onChange:e=>f(t,{value:e.target.value})}),(0,Z.jsx)(q,{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,Z.jsx)(x,{className:`size-4 text-fg-subtle`,"aria-hidden":!0})})]},ln(e,t,u)))}),(0,Z.jsxs)(`button`,{type:`button`,className:a(`self-start text-sm text-accent hover:underline`,W.press),onClick:p,children:[`+ `,n]})]})}var fn=[`stdio`,`sse`,`streamable-http`];function pn(e){let t=(0,X.c)(11),{label:n,description:r,required:i,children:a}=e,o;t[0]===i?o=t[1]:(o=i?(0,Z.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,Z.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,Z.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,Z.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 mn(){return a(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,G)}function hn(e){let t=(0,X.c)(29),{row:n,t:r,onUpdate:i,idConflictMessage:o,variant:s}=e,c=s===void 0?`all`:s,l=c===`all`||c===`basic`,u=c===`all`||c===`advanced`,d;t[0]!==o||t[1]!==i||t[2]!==n.id||t[3]!==n.transport||t[4]!==l||t[5]!==r?(d=l?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(pn,{label:r.transportLabel,required:!0,children:(0,Z.jsx)(z,{className:mn(),value:n.transport,onChange:e=>i({transport:e.target.value}),children:fn.map(e=>(0,Z.jsx)(B,{value:e,children:r.transportLabels[e]},e))})}),(0,Z.jsxs)(pn,{label:r.serverIdLabel,required:!0,children:[(0,Z.jsx)(`input`,{className:mn(),value:n.id,placeholder:r.serverIdPlaceholder,onChange:e=>i({id:e.target.value})}),o?(0,Z.jsx)(`p`,{className:`text-xs text-red-600 dark:text-red-300`,children:o}):null]})]}):null,t[0]=o,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,Z.jsxs)(Z.Fragment,{children:[l?(0,Z.jsx)(`div`,{className:c===`basic`?`md:col-span-2`:void 0,children:(0,Z.jsx)(pn,{label:r.commandLabel,required:!0,children:(0,Z.jsx)(`input`,{className:mn(),value:n.command,onChange:e=>i({command:e.target.value})})})}):null,u?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(pn,{label:r.argsLabel,description:r.argsHint,children:(0,Z.jsx)(`input`,{className:mn(),value:n.argsText,onChange:e=>i({argsText:e.target.value})})}),(0,Z.jsx)(pn,{label:r.cwdLabel,children:(0,Z.jsx)(`input`,{className:mn(),value:n.cwd,onChange:e=>i({cwd:e.target.value})})}),(0,Z.jsx)(pn,{label:r.envLabel,description:r.envHint,children:(0,Z.jsx)(`textarea`,{className:a(mn(),`min-h-[4rem] font-mono text-xs`),value:n.envJson,onChange:e=>i({envJson:e.target.value})})})]}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[l?(0,Z.jsx)(`div`,{className:`md:col-span-2`,children:(0,Z.jsx)(pn,{label:r.urlLabel,required:!0,children:(0,Z.jsx)(`input`,{className:a(mn(),`font-mono text-xs`),value:n.url,placeholder:`https://example.com/mcp`,onChange:e=>i({url:e.target.value})})})}):null,u?(0,Z.jsx)(dn,{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,Z.jsx)(pn,{label:r.timeoutLabel,description:r.timeoutHint,children:(0,Z.jsx)(`input`,{type:`number`,min:1,max:600,className:mn(),value:Mt(n),placeholder:r.timeoutPlaceholder,onChange:e=>i({connectionTimeoutMs:Nt(e.target.value)})})}):null,t[20]=i,t[21]=n,t[22]=u,t[23]=r,t[24]=p):p=t[24];let m;return t[25]!==d||t[26]!==f||t[27]!==p?(m=(0,Z.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[d,f,p]}),t[25]=d,t[26]=f,t[27]=p,t[28]=m):m=t[28],m}function gn(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 _n(e){let t=(0,X.c)(13),{tool:n,serverId:r}=e,i;t[0]!==r||t[1]!==n?(i=gn(n,r),t[0]=r,t[1]=n,t[2]=i):i=t[2];let o=i,s=n.name===o?o: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]!==o||t[6]!==s?(u=(0,Z.jsx)(`p`,{className:`break-all font-mono text-xs font-medium leading-5 text-fg`,title:s,children:o}),t[5]=o,t[6]=s,t[7]=u):u=t[7];let d;t[8]===l?d=t[9]:(d=l?(0,Z.jsx)(ue,{delayDuration:300,skipDelayDuration:100,children:(0,Z.jsxs)(O,{children:[(0,Z.jsx)(R,{asChild:!0,children:(0,Z.jsx)(`p`,{tabIndex:0,title:l,className:a(`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,Z.jsx)(A,{children:(0,Z.jsx)(S,{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,Z.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,Z.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 vn({open:e,mode:t,initialRow:n,existingCustomServers:r,sessionIdleTtlMinutes:i,config:o,managedServerIds:s,t:c,cs:l,onClose:u,onSaved:d}){let[f,p]=(0,Y.useState)(n),[m,h]=(0,Y.useState)(!1),[_,v]=(0,Y.useState)(!1),[y,x]=(0,Y.useState)(null),[S,C]=(0,Y.useState)(!1),[w,T]=(0,Y.useState)({status:`idle`}),[E,O]=(0,Y.useState)(null),k=n.id.trim(),A=f.id.trim()!==k&&s.has(f.id.trim())||s.has(f.id.trim())&&t===`add`?c.reservedServerId:void 0,N=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&&!A&&!N&&(f.transport===`stdio`?f.command.trim().length>0:f.url.trim().length>0),z=Pt(f),B=(0,Y.useCallback)(async()=>{if(f.id.trim()){v(!0),x(null),T({status:`loading`});try{T({status:`ok`,tools:(await jt(f.id.trim(),Et(f))).tools})}catch(e){T({status:`error`,message:e instanceof Error?e.message:String(e)})}finally{v(!1)}}},[f]),V=(0,Y.useCallback)(async()=>{if(!(!R||m)){h(!0),x(null);try{let e=r.filter(e=>!(t===`edit`&&e.clientKey===n.clientKey));e.push(f),await Dt({sessionIdleTtlMinutes:i,servers:e.sort((e,t)=>e.id.localeCompare(t.id))},yt(o)),await d(),u()}catch(e){x(e instanceof Error?e.message:String(e))}finally{h(!1)}}},[R,o,r,n.clientKey,t,u,d,k,f,m,i]);return e?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(M,{open:e,onOpenChange:e=>{e||u()},children:(0,Z.jsxs)(F,{children:[(0,Z.jsx)(j,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,Z.jsxs)(b,{className:a(`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,Z.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-6 py-5`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(ge,{className:`text-base font-semibold text-fg`,children:t===`add`?l.addCustomServerTitle:l.editCustomServerTitle}),(0,Z.jsx)(D,{className:`mt-1 text-sm text-fg-muted`,children:t===`add`?l.addCustomServerHint:l.editCustomServerHint})]}),(0,Z.jsx)(P,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:a(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,W.focusRingPanel),"aria-label":l.modalClose,children:[(0,Z.jsx)(g,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`sr-only`,children:l.modalClose})]})})]}),(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-5`,children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,Z.jsx)(`section`,{className:`rounded-xl border border-edge bg-surface-base p-4`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,Z.jsx)(de,{className:`size-4 text-accent`,"aria-hidden":!0}),f.id.trim()||c.cardUntitled]}),(0,Z.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,Z.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,Z.jsxs)(`section`,{children:[(0,Z.jsxs)(`div`,{className:`mb-3`,children:[(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:l.connectorBasicConfigTitle}),(0,Z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:l.connectorBasicConfigHint})]}),(0,Z.jsx)(hn,{row:f,t:c,variant:`basic`,onUpdate:e=>{p(t=>({...t,...e})),x(null)},idConflictMessage:A??N})]}),w.status===`ok`?(0,Z.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-base p-3`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,Z.jsx)(K,{className:`size-4 text-accent`,"aria-hidden":!0}),w.tools.length===0?c.toolsEmpty:c.toolsTitle.replace(`{{count}}`,String(w.tools.length))]}),w.tools.length>0?(0,Z.jsx)(q,{type:`button`,variant:`ghost`,className:`h-8 text-xs`,onClick:()=>O(w.tools),children:c.viewAllTools}):null]}),w.tools.length>0?(0,Z.jsx)(`div`,{className:`mt-3 grid gap-2`,children:w.tools.slice(0,6).map((e,t)=>(0,Z.jsx)(_n,{tool:e,serverId:f.id},e.name||`tool-${t}`))}):null]}):null,w.status===`error`?(0,Z.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:w.message}):null,y?(0,Z.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:y}):null,(0,Z.jsxs)(`details`,{open:S,onToggle:e=>C(e.currentTarget.open),className:`group rounded-xl border border-edge bg-surface-base`,children:[(0,Z.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,Z.jsx)(H,{className:`size-4 text-fg-muted transition-transform group-open:rotate-180`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`group-open:hidden`,children:l.connectorShowAdvancedConfig}),(0,Z.jsx)(`span`,{className:`hidden group-open:inline`,children:l.connectorHideAdvancedConfig})]}),(0,Z.jsx)(`div`,{className:`border-t border-edge p-4`,children:(0,Z.jsx)(hn,{row:f,t:c,variant:`advanced`,onUpdate:e=>{p(t=>({...t,...e})),x(null)}})})]})]})}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-2 border-t border-edge-subtle px-6 py-4`,children:[(0,Z.jsxs)(q,{variant:`secondary`,disabled:!f.id.trim()||_,onClick:()=>void B(),children:[_?(0,Z.jsx)(L,{className:`size-4 animate-spin`}):(0,Z.jsx)(I,{className:`size-4`}),c.testConnection]}),(0,Z.jsx)(P,{asChild:!0,children:(0,Z.jsx)(q,{variant:`secondary`,children:l.modalCancel})}),(0,Z.jsxs)(q,{variant:`primary`,disabled:!R||m,onClick:()=>void V(),children:[m?(0,Z.jsx)(L,{className:`size-4 animate-spin`}):(0,Z.jsx)(pe,{className:`size-4`}),m?c.saving:l.modalSave]})]})]})]})}),E?(0,Z.jsx)(Bt,{open:!0,onOpenChange:e=>{e||O(null)},serverId:f.id,title:c.toolsDialogTitle,subtitle:c.toolsDialogSubtitle,searchPlaceholder:c.toolsDialogSearchPlaceholder,searchEmptyLabel:c.toolsDialogSearchEmpty,emptyLabel:c.toolsEmpty,closeLabel:c.toolsDialogClose,tools:E,stripPrefix:`${f.id.trim()}__`}):null]}):null}var yn=[`understand`,`act`,`reach`];function bn(e){let t=new Set(e.capabilities),n=[e.id,e.displayName,...e.tags??[]].join(` `).toLowerCase();return t.has(`channel`)||t.has(`events`)||/slack|telegram|discord|teams|mail|message|wechat|weixin/.test(n)?`reach`: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)?`understand`:`act`}function xn(e,t){let n=t?bn(t):`act`,r=e.connectionStatus===`connected`||e.status===`connected`||e.usage.lastHealthStatus===`ok`,i=e.status===`not_configured`||e.status===`failed`||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 Sn(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 Cn(e,t,n){return e.filter(e=>Sn(e,t)).toSorted((e,t)=>n===`source`&&e.source!==t.source?e.source.localeCompare(t.source):e.displayName.localeCompare(t.displayName))}function wn(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 Tn(e,t){let n=t.trim().toLowerCase();return n?[e.id,e.command??``,e.url??``,e.transport].some(e=>e.toLowerCase().includes(n)):!0}var En=`all`,Dn=`builtin`,On=`xopc-store`;function kn(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 An(e){return e.filter((e,t,n)=>n.findIndex(t=>t.id===e.id)===t)}function jn(){let e=c(u(e=>e.language)),t=e.connectorsSettings,n=e.mcpSettings,r=l(e=>e.token),o=!!r,[s,d]=i(),[f,p]=(0,Y.useState)(s.get(`tab`)===`connected`?`connected`:`discover`),m=(0,Y.useRef)(!1),[g,_]=(0,Y.useState)({catalog:[],registryCatalog:[],instances:[],registries:[],loading:!0,error:null}),[v,y]=(0,Y.useState)(!1),[b,x]=(0,Y.useState)(!1),[S,C]=(0,Y.useState)(1),[w,T]=(0,Y.useState)(void 0),[E,D]=(0,Y.useState)(``),[O,A]=(0,Y.useState)(``),[j,M]=(0,Y.useState)(Dn),[N,P]=(0,Y.useState)(`name`),[F,I]=(0,Y.useState)(`all`),[R,z]=(0,Y.useState)(null),[B,V]=(0,Y.useState)(null),[H,ee]=(0,Y.useState)(null),[U,re]=(0,Y.useState)(null),[ie,ae]=(0,Y.useState)(null),[oe,se]=(0,Y.useState)(null),[ce,le]=(0,Y.useState)(!1),[W,ue]=(0,Y.useState)(void 0),[de,fe]=(0,Y.useState)(!1),{data:pe,mutate:me}=te(o),G=pe?.payload?.config,K=(0,Y.useMemo)(()=>G===void 0?null:Tt(G),[G]),he=K?.servers??[],ge=g.instances.length+he.length;(0,Y.useEffect)(()=>{K&&ue(K.sessionIdleTtlMinutes)},[K]);let J=(0,Y.useCallback)(async()=>{if(!r){_({catalog:[],registryCatalog:[],instances:[],registries:[],loading:!1,error:null});return}_(e=>({...e,loading:!0,error:null}));try{let[e,t,n]=await Promise.all([Ee(),Me(),je()]);_(r=>({catalog:e,registryCatalog:r.registryCatalog,instances:t,registries:n,loading:!1,error:null}))}catch(e){_({catalog:[],registryCatalog:[],instances:[],registries:[],loading:!1,error:e instanceof Error?e.message:String(e)})}},[r]);(0,Y.useEffect)(()=>{J()},[J]),(0,Y.useEffect)(()=>{m.current||g.loading||o&&!K||(p(ge>0?`connected`:`discover`),m.current=!0)},[o,ge,K,g.loading]);let X=(0,Y.useCallback)(e=>{m.current=!0,p(e)},[]),ye=(0,Y.useMemo)(()=>[{id:On,displayName:t.storeSourceName},...g.registries],[t.storeSourceName,g.registries]),Se=(0,Y.useCallback)(async e=>{if(!o||j===Dn){_(e=>({...e,registryCatalog:[]})),C(1),T(void 0);return}let t=O.trim(),n=e?.browse??!1,r=Math.max(e?.page??1,1),i=e?.append??!1,a=j===En?ye:ye.filter(e=>e.id===j);if(a.length!==0){y(!0),i?_(e=>({...e,error:null})):(C(1),T(void 0),_(e=>({...e,registryCatalog:[],error:null})));try{let e=await Promise.all(a.map(async e=>{if(e.id===On){let e=await Oe({q:t||void 0,page:r,pageSize:24,sort:N===`source`?`newest`:`downloads`});return{connectors:e.items.map(kn),totalPages:e.meta.totalPages}}return Fe(t,e.id,{browse:n,page:r})})),o=An(e.flatMap(e=>e.connectors)),s=Math.max(1,...e.map(e=>e.totalPages??1));C(r),T(s),_(e=>({...e,registryCatalog:i?An([...e.registryCatalog,...o]):o}))}catch(e){_(t=>({...t,error:e instanceof Error?e.message:String(e)}))}finally{y(!1)}}},[N,O,j,o,ye]);(0,Y.useEffect)(()=>{if(f!==`discover`||g.loading)return;if(j===Dn){_(e=>({...e,registryCatalog:[]})),C(1),T(void 0);return}let e=window.setTimeout(()=>{Se({browse:!O.trim()})},O.trim()?350:0);return()=>window.clearTimeout(e)},[O,j,Se,g.loading,f]);let we=(0,Y.useMemo)(()=>new Set(g.instances.map(e=>e.connectorId)),[g.instances]),Q=(0,Y.useMemo)(()=>new Map([...g.catalog,...g.registryCatalog].map(e=>[e.id,e])),[g.catalog,g.registryCatalog]);(0,Y.useEffect)(()=>{if(g.loading)return;let e=s.get(`connector`),t=s.get(`instance`);if(!e&&!t)return;let n=g.instances.find(n=>t?n.instanceId===t:n.connectorId===e);if(n)m.current=!0,D(``),ee(n.instanceId),re(n),p(`connected`);else if(e){let t=Q.get(e);if(!t)return;m.current=!0,M(Dn),A(``),V(t),p(`discover`)}let r=new URLSearchParams(s);r.delete(`connector`),r.delete(`instance`),r.delete(`personalContext`),r.set(`tab`,n?`connected`:`discover`),d(r,{replace:!0})},[Q,s,d,g.instances,g.loading]);let De=(0,Y.useCallback)(async e=>{x(!0),_(e=>({...e,error:null}));try{let t=await ke(e);z(sn(t.definition,{packageName:t.packageName,version:t.version,permissions:t.permissions}))}catch(e){_(t=>({...t,error:e instanceof Error?e.message:String(e)}))}finally{x(!1)}},[]),Ae=(0,Y.useMemo)(()=>new Set(g.instances.flatMap(e=>e.materialized.type===`mcp`?[e.materialized.serverId]:[])),[g.instances]),Ne=(0,Y.useCallback)(async e=>{if(!K||G===void 0)return;let t=he.filter(t=>t.clientKey!==e.clientKey);await Dt({sessionIdleTtlMinutes:K.sessionIdleTtlMinutes,servers:t},yt(G)),await me(),await J()},[G,he,J,K,me]),Pe=(0,Y.useCallback)(()=>{se({mode:`add`,row:cn(he,Ae)})},[he,Ae]),Ie=(0,Y.useCallback)(async()=>{if(!(!K||G===void 0||de)){fe(!0);try{await Dt({sessionIdleTtlMinutes:W,servers:he},yt(G)),await me(),le(!1)}finally{fe(!1)}}},[G,he,n.saved,K,me,W,de]),Le=h(e=>e.setPageHeader),Re=h(e=>e.clearPageHeader),ze=(0,Y.useMemo)(()=>(0,Z.jsx)(pt,{onBrowseCatalog:()=>X(`discover`),onAddCustomServer:Pe,onOpenRuntimeSettings:()=>le(!0),addLabel:t.addConnection,browseLabel:t.addFromCatalog,customLabel:t.addCustomServerAdvanced,settingsLabel:t.runtimeSettings}),[t,Pe,X]);(0,Y.useLayoutEffect)(()=>(Le({startExtra:null,main:(0,Z.jsx)(`div`,{className:`min-w-0`,children:(0,Z.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.title})}),end:ze}),()=>Re()),[Re,t.title,ze,Le]);let Be=(0,Y.useMemo)(()=>g.instances.map(e=>({instance:e,value:xn(e,Q.get(e.connectorId))})),[Q,g.instances]),Ve=(0,Y.useMemo)(()=>new Map(Be.map(({instance:e,value:t})=>[e.instanceId,t])),[Be]),He=(0,Y.useMemo)(()=>({ready:Be.filter(({value:e})=>e.state===`ready`).length,needsSetup:Be.filter(({value:e})=>e.state===`needs_setup`).length,checking:Be.filter(({value:e})=>e.state===`checking`).length}),[Be]),Ue=(0,Y.useMemo)(()=>g.instances.filter(e=>wn(e,E)).sort((e,t)=>{let n={needs_setup:0,checking:1,ready:2},r=Ve.get(e.instanceId)?.state??`checking`,i=Ve.get(t.instanceId)?.state??`checking`;return n[r]-n[i]||e.displayName.localeCompare(t.displayName)}),[E,Ve,g.instances]),We=(0,Y.useMemo)(()=>he.filter(e=>Tn(e,E)),[E,he]),Ge=Ue.length+We.length,Ke=(0,Y.useMemo)(()=>g.catalog.filter(e=>e.source===`builtin`&&e.integrationStrategy?.preferred!==!1),[g.catalog]),qe=(0,Y.useMemo)(()=>{let e=j===Dn?Ke:j===En?An([...Ke,...g.registryCatalog]):g.registryCatalog;return Cn(F===`all`?e:e.filter(e=>bn(e)===F),O,N)},[Ke,N,O,j,F,g.registryCatalog]),Je=f===`discover`&&j!==Dn&&!!(w&&S<w),Ye=(0,Y.useMemo)(()=>g.instances.find(e=>e.instanceId===H)??U,[H,U,g.instances]),Xe=(0,Y.useMemo)(()=>[{value:En,label:t.discoverSourceAll},{value:Dn,label:t.discoverSourceBuiltin},...ye.map(e=>({value:e.id,label:e.displayName}))],[t.discoverSourceAll,t.discoverSourceBuiltin,ye]),Ze=[{id:`connected`,label:t.tabConnected,count:ge},{id:`discover`,label:t.tabDiscover}];return(0,Z.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-6 px-3 py-6 sm:px-5 xl:px-6`,children:[o?null:(0,Z.jsx)(`p`,{className:`rounded-xl border border-edge bg-surface-panel px-4 py-3 text-sm text-fg-muted`,children:t.tokenHint}),(0,Z.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[(0,Z.jsx)(`div`,{className:`border-b border-edge-subtle pb-3 dark:border-edge-subtle`,children:(0,Z.jsx)(_e,{items:Ze,activeTab:f,onChange:X,ariaLabel:t.navAria,tabIdPrefix:`connectors-tab`,panelIdPrefix:`connectors-panel`,className:`flex-wrap`})}),g.error?(0,Z.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:g.error}):null,f===`connected`&&o?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center`,children:[(0,Z.jsx)(ft,{value:E,onChange:D,placeholder:t.connectedSearchPlaceholder,className:`max-w-xl`}),(0,Z.jsx)(ne,{className:`size-9 shrink-0 p-0`,loading:g.loading,label:t.refreshConnections,title:t.refreshConnections,onClick:J})]}),Be.length>0?(0,Z.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,Z.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.connectionSummaryTitle}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.connectionSummaryHint}),(0,Z.jsxs)(`div`,{className:`mt-4 grid gap-2 sm:grid-cols-3`,children:[(0,Z.jsxs)(`div`,{className:`rounded-xl bg-surface-panel p-3`,children:[(0,Z.jsx)(`div`,{className:`text-xl font-semibold tabular-nums text-success`,children:He.ready}),(0,Z.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:t.connectionReady})]}),(0,Z.jsxs)(`div`,{className:`rounded-xl bg-surface-panel p-3`,children:[(0,Z.jsx)(`div`,{className:a(`text-xl font-semibold tabular-nums`,He.needsSetup>0?`text-warning`:`text-fg`),children:He.needsSetup}),(0,Z.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:t.connectionNeedsSetup})]}),(0,Z.jsxs)(`div`,{className:`rounded-xl bg-surface-panel p-3`,children:[(0,Z.jsx)(`div`,{className:`text-xl font-semibold tabular-nums text-fg`,children:He.checking}),(0,Z.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:t.connectionChecking})]})]})]}):null,(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.connectionsTitle}),(0,Z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.connectionsHint})]}),g.loading?(0,Z.jsx)(`div`,{className:`grid gap-3`,"aria-busy":`true`,"aria-label":t.loading,children:be.slice(0,3).map(e=>(0,Z.jsx)(Te,{},e))}):ge===0?(0,Z.jsxs)(`div`,{className:`rounded-2xl border border-dashed border-edge p-8 text-center`,children:[(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.connectionsEmpty}),(0,Z.jsx)(q,{type:`button`,variant:`primary`,className:`mt-4`,onClick:()=>X(`discover`),children:t.addFromCatalog})]}):Ge===0?(0,Z.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge p-8 text-center text-sm text-fg-muted`,children:t.connectionsSearchEmpty}):(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`,children:[Ue.map(e=>(0,Z.jsx)(Qt,{instance:e,definition:Q.get(e.connectorId),highlighted:e.instanceId===ie,onOpenDetails:e=>{ae(null),ee(e.instanceId),re(e)},onChanged:J,t},e.instanceId)),We.map(e=>(0,Z.jsx)(Ft,{row:e,t:n,cs:t,onEdit:()=>se({mode:`edit`,row:structuredClone(e)}),onRemove:async()=>Ne(e)},e.clientKey))]}),(0,Z.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.disableHint})]}):null,f===`discover`&&o?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.discoverTitle}),(0,Z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.discoverHint})]}),(0,Z.jsx)(`div`,{className:`rounded-xl border border-accent/20 bg-accent-soft/60 px-4 py-3 text-sm text-accent-fg`,children:t.integrationStrategyHint}),(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-2`,role:`group`,"aria-label":t.outcomeFilterAria,children:[`all`,...yn].map(e=>(0,Z.jsx)(`button`,{type:`button`,className:a(`rounded-full border px-3 py-1.5 text-xs font-medium transition-colors`,F===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":F===e,onClick:()=>I(e),children:e===`all`?t.outcomeAll:t.connectorBenefitHeadings[e]},e))}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2 lg:flex-row lg:items-center`,children:[(0,Z.jsx)(ft,{value:O,onChange:A,placeholder:t.discoverSearchPlaceholder,className:`max-w-xl`}),(0,Z.jsxs)(`div`,{className:`grid min-w-0 grid-cols-1 gap-2 sm:grid-cols-2 lg:ml-auto lg:w-[26rem]`,children:[(0,Z.jsx)(k,{value:j,options:Xe,placeholder:t.discoverSourceAll,allowEmpty:!1,ariaLabel:t.registrySourceAria,triggerClassName:`h-9 bg-surface-panel text-xs`,onChange:M}),(0,Z.jsx)(k,{value:N,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=>P(e)})]})]}),(g.loading||v)&&qe.length===0?(0,Z.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`,"aria-busy":`true`,"aria-label":t.loading,children:be.map(e=>(0,Z.jsx)(Ce,{},e))}):qe.length===0?(0,Z.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge p-8 text-center text-sm text-fg-muted`,children:t.discoverEmpty}):(0,Z.jsxs)(`div`,{className:`relative`,children:[v?(0,Z.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,Z.jsx)(L,{className:`size-8 shrink-0 animate-spin text-accent motion-reduce:animate-none`,strokeWidth:2,"aria-hidden":!0})}):null,(0,Z.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`,children:qe.map(e=>(0,Z.jsx)(ve,{connector:e,installed:we.has(e.id)||xe(e,g.instances),onInstall:e=>{if(e.source===`store`){De(e.id);return}z(sn(e))},onOpenDetails:e.source===`store`?void 0:V,t},e.id))}),Je?(0,Z.jsx)(`div`,{className:`mt-4 flex justify-center`,children:(0,Z.jsxs)(q,{type:`button`,variant:`secondary`,disabled:v||b,onClick:()=>void Se({browse:!O.trim(),page:S+1,append:!0}),children:[v?(0,Z.jsx)(L,{className:`size-4 animate-spin`}):null,t.loadMore]})}):null]})]}):null]}),R?(0,Z.jsx)(on,{draft:R,onChange:z,onClose:()=>z(null),t,onInstalled:async e=>{await J(),await me(),ae(e.instanceId),X(`connected`)}}):null,B?(0,Z.jsx)(lt,{connector:B,installed:we.has(B.id)||xe(B,g.instances),onClose:()=>V(null),onInstall:e=>z(sn(e)),t}):null,Ye?(0,Z.jsx)(Zt,{instance:Ye,definition:Q.get(Ye.connectorId),onClose:()=>{ee(null),re(null)},onChanged:J,t,mcp:n}):null,oe?(0,Z.jsx)(vn,{open:!0,mode:oe.mode,initialRow:oe.row,existingCustomServers:he,sessionIdleTtlMinutes:W,config:G,managedServerIds:Ae,t:n,cs:t,onClose:()=>se(null),onSaved:async()=>{await me(),await J(),X(`connected`)}},`${oe.mode}-${oe.row.clientKey}`):null,(0,Z.jsx)(dt,{open:ce,sessionIdleTtlMinutes:W,saving:de,onChange:ue,onSave:Ie,onClose:()=>le(!1),t,mcp:n})]})})}export{jn as ConnectorsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./messages
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./messages--cnUi8Ld.js";import{n as a}from"./locale-store-CQDaFvDN.js";import{Cs as o,au as s,t as c}from"./index-B5cSZcER.js";import{t as l}from"./desktop-pet-sprite-DqZ6fbIj.js";var u=e(t(),1),d=n(),f=9e4,p=3e4,m=20*6e4,h=45e3,g=45*6e4,_=58;function v(e,t){return e.state===`running`&&t-(e.startedAt??e.timestamp)>=f}function y(e,t){return e.state===`running`&&t-e.timestamp>=p}function b(e,t,n){if(e.progress){let t=`${e.progress.completed}/${e.progress.total}`;return e.action.includes(t)?``:` · ${t}`}return e.detail&&!e.action.includes(e.detail)?n.replace(/\{\{detail\}\}/g,e.detail):e.state===`running`?` · ${Math.max(1,Math.floor((t-e.timestamp)/1e3))}s`:``}function x(e,t){if(e.state!==`success`||!e.publicSummary)return;let n=e.publicSummary.replace(/\s+/g,` `).trim(),r=n.length>_?`${n.slice(0,_-1)}…`:n;return t.replace(/\{\{summary\}\}/g,r)}function S(e,t,n){if(y(e,t))return n.stale;if(v(e,t))return n.longRunning}function C(e,t){let n=e.feedback?.reassurance;return n?t[n]:void 0}function w(e){let t=e.now-e.lastActivityAt,n=t>=m?(t-m)%g:1/0;return e.bubbleEnabled&&e.feedbackLevel!==`quiet`&&!e.collapsed&&e.queuedCount===0&&e.activeCount===0&&n<=h&&e.now>=e.dismissedUntil}var T=8e3;function E(e,t){let n=e?.runId===t.runId,r=t.feedback?.sensitivity===`private`;return{...n?e:void 0,...t,startedAt:n?e.startedAt??e.timestamp:t.timestamp,publicSummary:r?void 0:t.publicSummary??(n?e.publicSummary:void 0),feedback:t.feedback??(n?e.feedback:void 0),expiresAt:t.state===`success`?t.timestamp+T:void 0}}function D(e,t){let n={...e};for(let e of t){let t=n[e.sessionKey];t?.runId===e.runId&&e.sequence<=t.sequence||(n[e.sessionKey]=E(t,e))}return n}function O(e,t){return t?.runId===e.runId&&t.state===e.state}function k(e,t){let n={error:0,waiting:1,running:2,success:3};return e.filter(e=>!e.expiresAt||e.expiresAt>t).sort((e,t)=>n[e.state]-n[t.state]||t.timestamp-e.timestamp).slice(0,3)}function A(e){return e?`/chat/${e.sessionKey}`:void 0}var j=r();function M(e,t,n){return y(e,n)||t===`chatty`||v(e,n)&&t===`normal`?!0:t===`quiet`?e.priority===`high`||e.state===`waiting`||e.state===`error`:e.priority!==`low`}function N(e){return e?e.state===`error`?`error`:e.state===`success`?`success`:e.animation??c(e.phase):`idle`}function P(e,t){if(!e?.length)return;let n=t.sequence;for(let e of`${t.sessionKey}:${t.runId}`)n=n*31+e.charCodeAt(0)>>>0;return e[n%e.length]}function F(e,t,n){let r=e.persona?.phrases??n;if(t.state===`success`)return P(r?.success,t);if(t.state===`waiting`)return P(r?.waiting,t);if(t.state===`error`)return P(r?.error,t)}function I(e,t,n){return e?n?`${e} · ${t}`:e:t}function L(e,t){let n=e.feedback?.nextAction?.type;if(n===`confirm`)return t.needsInput;if(n===`review_error`)return t.reviewIssue;if(n===`open_session`)return t.open;if(e.state===`waiting`)return t.needsInput;if(e.state===`error`)return t.reviewIssue;if(e.state===`success`)return t.open}function R(){return{prefs:{enabled:!0,showOnStartup:!1,selectedPetId:`ember`,alwaysOnTop:!0,bubbleEnabled:!0,clickThroughWhenIdle:!1,muted:!1,feedbackLevel:`normal`,sizePercent:100,collapsed:!1},pets:[],visible:!0,customPetsDir:``,petIssues:[],activities:[]}}function z(){let e=i(a(e=>e.language)).desktopPet,[t,n]=(0,u.useState)(R),[r,c]=(0,u.useState)({}),[d,f]=(0,u.useState)({}),[p,m]=(0,u.useState)(Date.now()),[h,_]=(0,u.useState)(()=>Date.now()),[v,y]=(0,u.useState)(0),T=(0,u.useRef)(null),E=(0,u.useRef)(!1),z=(0,u.useRef)(null),B=(0,u.useRef)(null),V=(0,u.useRef)(null),H=(0,u.useMemo)(()=>t.pets.find(e=>e.id===t.prefs.selectedPetId)??t.pets[0],[t]),U=Math.min(1.4,Math.max(.7,t.prefs.sizePercent/100)),W=(0,u.useMemo)(()=>k(Object.values(r),p),[r,p]),G=(0,u.useMemo)(()=>t.prefs.bubbleEnabled?W.filter(e=>!O(e,d[e.sessionKey])&&M(e,t.prefs.feedbackLevel,p)):[],[W,d,p,t.prefs.bubbleEnabled,t.prefs.feedbackLevel]),K=(0,u.useMemo)(()=>t.prefs.bubbleEnabled?W.filter(e=>O(e,d[e.sessionKey])&&M(e,t.prefs.feedbackLevel,p)).length:0,[W,d,p,t.prefs.bubbleEnabled,t.prefs.feedbackLevel]),q=G[0]??W[0],J=N(q),Y=e.personaPhrases[H?.persona?.tone??`calm`],X=w({bubbleEnabled:t.prefs.bubbleEnabled,feedbackLevel:t.prefs.feedbackLevel,collapsed:t.prefs.collapsed,queuedCount:G.length,activeCount:W.length,now:p,lastActivityAt:h,dismissedUntil:v});(0,u.useEffect)(()=>{document.documentElement.dataset.desktopPet=`true`;let e=window.electronAPI?.pet;if(!e)return;let t=e=>{n(e),c(t=>D(t,e.activities))};e.getState().then(t).catch(()=>{});let r=e.onStateChanged(t),i=e.onEvent(e=>c(t=>(_(Date.now()),D(t,[e])))),a=window.setInterval(()=>m(Date.now()),1e3);return()=>{delete document.documentElement.dataset.desktopPet,r(),i(),window.clearInterval(a)}},[]),(0,u.useLayoutEffect)(()=>{let e=z.current,t=window.electronAPI?.pet;if(!e||!t)return;let n=()=>{let e=[B.current,V.current].filter(e=>e!==null).map(e=>e.getBoundingClientRect());if(!e.length)return;let n=Math.min(...e.map(e=>e.left)),r=Math.min(...e.map(e=>e.top)),i=Math.max(...e.map(e=>e.right)),a=Math.max(...e.map(e=>e.bottom));t.setContentSize({width:Math.ceil(i-n),height:Math.ceil(a-r)})},r=new ResizeObserver(n);return r.observe(e),B.current&&r.observe(B.current),V.current&&r.observe(V.current),n(),()=>r.disconnect()},[X,G.length,t.prefs.collapsed,U]);let Z=(e=q)=>{e&&e.state!==`running`&&(window.electronAPI?.pet?.acknowledgeEvent(e.sessionKey,e.runId),c(t=>{let{[e.sessionKey]:n,...r}=t;return r})),window.electronAPI?.pet?.openMainWindow(A(e))},ee=async()=>{if(Object.keys(d).length>0&&(f({}),!t.prefs.collapsed))return;let e=await window.electronAPI?.pet?.setPrefs({collapsed:!t.prefs.collapsed});e&&n(e)},te=(0,u.useCallback)(e=>{e.button===0&&(T.current={pointerId:e.pointerId,x:e.clientX,y:e.clientY,moved:!1},e.currentTarget.setPointerCapture(e.pointerId),window.electronAPI?.pet?.startDrag({screenX:e.screenX,screenY:e.screenY}))},[]),ne=(0,u.useCallback)(e=>{let t=T.current;!t||t.pointerId!==e.pointerId||Math.abs(e.clientX-t.x)+Math.abs(e.clientY-t.y)>4&&(t.moved=!0,window.electronAPI?.pet?.drag({screenX:e.screenX,screenY:e.screenY}))},[]),Q=(0,u.useCallback)(e=>{let t=T.current;!t||t.pointerId!==e.pointerId||(T.current=null,window.electronAPI?.pet?.endDrag(),t.moved&&(E.current=!0,window.setTimeout(()=>{E.current=!1},0)))},[]),re=()=>{E.current||Z()};if(!H)return null;let ie={"--desktop-pet-stage-size":`${Math.round(132*U)}px`,"--desktop-pet-menu-size":`${Math.round(28*U)}px`,"--desktop-pet-menu-left":`0px`,"--desktop-pet-menu-bottom":`${Math.round(12*U)}px`},$=t.prefs.collapsed?G.length:K;return(0,j.jsxs)(`div`,{ref:z,className:`desktop-pet-window`,style:ie,children:[!t.prefs.collapsed&&G.length>0?(0,j.jsx)(`div`,{ref:B,className:`desktop-pet-bubble desktop-pet-queue`,children:G.map(t=>{let n=S(t,p,{longRunning:e.tipLongRunning,stale:e.tipStaleSignal}),r=x(t,e.tipCompleteSummary),i=C(t,{making_progress:e.petReassuranceMakingProgress,waiting_safely:e.petReassuranceWaitingSafely,completed:e.petReassuranceCompleted,work_preserved:e.petReassuranceWorkPreserved,details_available:e.petReassuranceDetailsAvailable}),a=r??n??i??t.action,s=I(F(H,t,Y),a,!!(r||n||i)),c=L(t,{open:e.viewSession,needsInput:e.petCtaNeedsInput,reviewIssue:e.petCtaReviewIssue});return(0,j.jsxs)(`div`,{className:`desktop-pet-session desktop-pet-session--${t.state}${n?` desktop-pet-session--health`:``}`,children:[(0,j.jsxs)(`button`,{type:`button`,className:`desktop-pet-session-open`,onClick:()=>Z(t),children:[(0,j.jsx)(`span`,{className:`desktop-pet-session-dot`}),(0,j.jsxs)(`span`,{className:`desktop-pet-session-main`,children:[(0,j.jsx)(`strong`,{children:t.sessionLabel}),(0,j.jsxs)(`span`,{children:[s,r||n?``:b(t,p,e.tipTargetSuffix)]})]}),c?(0,j.jsx)(`span`,{className:`desktop-pet-session-cta`,children:c}):null]}),(0,j.jsx)(`button`,{type:`button`,className:`desktop-pet-session-close`,"aria-label":e.dismissSession,onClick:()=>{window.electronAPI?.pet?.acknowledgeEvent(t.sessionKey,t.runId),f(e=>({...e,[t.sessionKey]:{runId:t.runId,state:t.state}}))},children:(0,j.jsx)(o,{size:12})})]},t.sessionKey)})}):null,X?(0,j.jsx)(`div`,{ref:B,className:`desktop-pet-bubble desktop-pet-queue desktop-pet-idle-tip`,children:(0,j.jsxs)(`div`,{className:`desktop-pet-session desktop-pet-session--idle`,children:[(0,j.jsxs)(`button`,{type:`button`,className:`desktop-pet-session-open`,onClick:()=>Z(),children:[(0,j.jsx)(`span`,{className:`desktop-pet-session-dot`}),(0,j.jsxs)(`span`,{className:`desktop-pet-session-main`,children:[(0,j.jsx)(`strong`,{children:e.idleTipTitle}),(0,j.jsx)(`span`,{children:P(H.persona?.phrases?.greeting??Y.greeting,{sessionKey:`idle`,runId:`idle`,sessionLabel:``,sequence:0,timestamp:h,state:`running`,phase:`waiting`,action:e.idleTipBody})??e.idleTipBody})]})]}),(0,j.jsx)(`button`,{type:`button`,className:`desktop-pet-session-close`,"aria-label":e.dismissSession,onClick:()=>y(p+g),children:(0,j.jsx)(o,{size:12})})]})}):null,(0,j.jsxs)(`div`,{ref:V,className:`desktop-pet-stage`,children:[(0,j.jsx)(`button`,{type:`button`,className:`desktop-pet-menu-button`,onClick:()=>void ee(),"aria-label":e.menu,children:$>0?(0,j.jsx)(`span`,{className:`desktop-pet-tip-count`,children:Math.min(99,$)}):(0,j.jsx)(s,{className:`desktop-pet-menu-chevron size-4`})}),(0,j.jsx)(`button`,{type:`button`,className:`desktop-pet-hit-area`,onClick:re,onPointerDown:te,onPointerMove:ne,onPointerUp:Q,onPointerCancel:Q,title:e.openApp,children:(0,j.jsx)(l,{pet:H,action:J,displayHeight:Math.round(112*U)})})]})]})}function B(){let e=(0,d.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,j.jsx)(z,{}),e[0]=t):t=e[0],t}export{B as DesktopPetPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{l as i}from"./chunk-QUQL4437-DXsxWP7r.js";import{t as a}from"./cn-BQ_8x0bT.js";import{t as o}from"./circle-alert-RzVebuX2.js";import{t as s}from"./messages-B0B40tpO.js";import{n as c}from"./locale-store-GfSwnwIZ.js";import{Ec as l,Es as u,Ml as d,Rc as f,Vo as p,Yo as m,Zo as h,fc as g,lo as _,ps as v,uc as y}from"./index-apLU0Hun.js";import{t as b}from"./desktop-pet-sprite-DqZ6fbIj.js";import{n as x,r as S}from"./settings-page-layout-CsrLuDsW.js";var C=n(),w=e(t(),1),T=r();function E(e){let t=(0,C.c)(16),{title:n,desc:r,checked:i,disabled:a,onChange:o}=e,s;t[0]===n?s=t[1]:(s=(0,T.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n}),t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c=(0,T.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r}),t[2]=r,t[3]=c);let l;t[4]!==s||t[5]!==c?(l=(0,T.jsxs)(`div`,{className:`min-w-0`,children:[s,c]}),t[4]=s,t[5]=c,t[6]=l):l=t[6];let u;t[7]===o?u=t[8]:(u=e=>o(e.target.checked),t[7]=o,t[8]=u);let d;t[9]!==i||t[10]!==a||t[11]!==u?(d=(0,T.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:a,checked:i,onChange:u}),t[9]=i,t[10]=a,t[11]=u,t[12]=d):d=t[12];let f;return t[13]!==l||t[14]!==d?(f=(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[l,d]}),t[13]=l,t[14]=d,t[15]=f):f=t[15],f}function D(){let e=s(c(e=>e.language)).desktopPetSettings,t=i(),[n,r]=(0,w.useState)(null),[C,D]=(0,w.useState)(!1),[O,k]=(0,w.useState)(null),A=typeof window<`u`?window.electronAPI?.pet:void 0,j=(0,w.useMemo)(()=>n?.pets.find(e=>e.id===n.prefs.selectedPetId)??n?.pets[0],[n]),M=(0,w.useCallback)(async()=>{if(A){D(!0);try{r(await A.getState())}finally{D(!1)}}},[A]);if((0,w.useEffect)(()=>{if(A)return M(),A.onStateChanged(r)},[A,M]),!p()||!A)return null;if(!n)return(0,T.jsxs)(S,{gap:`gap-4`,children:[(0,T.jsx)(x,{title:e.title,subtitle:e.subtitle}),(0,T.jsx)(`section`,{className:`rounded-xl border border-edge bg-surface-base p-4`,"aria-busy":!0,"aria-label":e.loading,children:(0,T.jsxs)(`div`,{className:`space-y-3`,children:[(0,T.jsx)(_,{className:`h-14 rounded-xl`}),(0,T.jsx)(_,{className:`h-14 rounded-xl`}),(0,T.jsx)(_,{className:`h-24 rounded-xl`}),(0,T.jsx)(`div`,{className:`space-y-2 pt-2`,children:Array.from({length:3}).map((e,t)=>(0,T.jsx)(_,{className:`h-16 rounded-xl`},t))})]})})]});let N=async e=>{D(!0);try{r(await A.setPrefs(e))}finally{D(!1)}},P=async e=>{e?(await A.show(),r(await A.getState())):r(await A.setPrefs({enabled:!1}))},F=e=>{N({selectedPetId:e})},I=t=>{if(t.builtin&&t.i18nKey){let n=e.builtinPets[t.i18nKey];if(n)return n}return{name:t.name,description:t.description}},L=e=>{t({pathname:`/chat/new`,search:`?draft=${encodeURIComponent(e)}`})},R=e=>{if(e.sourcePrompt?.trim())return e.sourcePrompt.trim();let{description:t}=I(e);return t.replace(/^Custom pet generated from:\s*/i,``).trim()||t},z=(e,t)=>Object.entries(t).reduce((e,[t,n])=>e.split(`{${t}}`).join(n),e),B=()=>{L(e.createChatDraft)},V=t=>{L(z(e.optimizeChatDraft,{id:t.id,name:I(t).name,description:I(t).description,sourcePrompt:R(t)}))},H=t=>{L(z(e.fixChatDraft,{dir:t.dir,reason:t.reason,details:t.details?.join(`; `)||e.noIssueDetails}))},U=O??n.prefs.sizePercent,W=async(e=U)=>{let t=Math.min(140,Math.max(70,Math.round(e/5)*5));k(null),t!==n.prefs.sizePercent&&await N({sizePercent:t})};return(0,T.jsxs)(S,{gap:`gap-4`,children:[(0,T.jsx)(x,{title:e.title,subtitle:e.subtitle,actions:(0,T.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[(0,T.jsxs)(`button`,{type:`button`,className:a(`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,v.press),disabled:C,onClick:()=>void M(),children:[(0,T.jsx)(g,{className:a(`size-3.5`,C&&`animate-spin`),strokeWidth:1.75}),e.refresh]}),(0,T.jsxs)(`button`,{type:`button`,className:a(`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover`,v.press),onClick:()=>void A.openCustomPetsDir(),children:[(0,T.jsx)(d,{className:`size-3.5`,strokeWidth:1.75}),e.openFolder]})]})}),(0,T.jsxs)(`section`,{className:`rounded-xl border border-edge bg-surface-base p-4 shadow-surface`,children:[(0,T.jsxs)(`div`,{className:`space-y-2`,children:[(0,T.jsx)(E,{title:e.enable,desc:e.enableDesc,checked:n.prefs.enabled,disabled:C,onChange:e=>void P(e)}),(0,T.jsx)(E,{title:e.showOnStartup,desc:e.showOnStartupDesc,checked:n.prefs.showOnStartup,disabled:C,onChange:e=>void N({showOnStartup:e})})]}),(0,T.jsx)(`div`,{className:`mt-5 rounded-xl border border-edge-subtle bg-surface-panel p-3`,children:(0,T.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,T.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[(0,T.jsx)(u,{className:`mt-0.5 size-4 text-accent-fg`,strokeWidth:1.8}),(0,T.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,T.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:e.createTitle}),(0,T.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.createDesc})]})]}),(0,T.jsxs)(`button`,{type:`button`,className:a(`inline-flex h-9 shrink-0 items-center justify-center gap-1.5 rounded-lg bg-accent px-3 text-xs font-semibold text-white hover:bg-accent/90`,v.press),onClick:B,children:[(0,T.jsx)(f,{className:`size-3.5`,strokeWidth:1.75}),e.createInChat]})]})}),(0,T.jsxs)(`div`,{className:`mt-5`,children:[(0,T.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:e.petList}),(0,T.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.petListDesc})]}),j?(0,T.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2.5 py-1 text-xs font-medium text-accent-fg`,children:I(j).name}):null]}),(0,T.jsxs)(`div`,{className:`divide-y divide-edge-subtle rounded-xl border border-edge bg-surface-base`,children:[n.pets.map(t=>{let r=t.id===n.prefs.selectedPetId,i=I(t);return(0,T.jsxs)(`div`,{className:`flex items-center gap-3 p-3`,children:[(0,T.jsx)(b,{pet:t,action:`idle`,size:`tiny`}),(0,T.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(`p`,{className:`truncate text-sm font-semibold text-fg`,children:i.name}),t.builtin?null:(0,T.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:e.customBadge})]}),(0,T.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:i.description})]}),(0,T.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[t.builtin?null:(0,T.jsxs)(`button`,{type:`button`,className:a(`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover`,v.press),onClick:()=>V(t),children:[(0,T.jsx)(l,{className:`size-3.5`,strokeWidth:1.75}),e.optimizeInChat]}),(0,T.jsx)(`button`,{type:`button`,className:a(`rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors`,r?`bg-surface-hover text-fg-muted`:`bg-surface-panel text-fg hover:bg-surface-hover`,v.press),disabled:r||C,onClick:()=>F(t.id),children:r?e.selected:e.select})]})]},t.id)}),(0,T.jsxs)(`div`,{className:`flex flex-col gap-1 p-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`p`,{className:`text-xs font-semibold text-fg`,children:e.customPets}),(0,T.jsx)(`p`,{className:`font-mono text-xs text-fg-muted`,children:n.customPetsDir})]}),(0,T.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 text-xs font-medium text-fg-muted hover:text-fg`,onClick:()=>void A.openCustomPetsDir(),children:[e.openFolder,(0,T.jsx)(d,{className:`size-3.5`,strokeWidth:1.75})]})]})]}),n.petIssues.length>0?(0,T.jsxs)(`div`,{className:`mt-2 rounded-xl border border-danger/30 bg-danger/5 p-3`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-semibold text-danger`,children:[(0,T.jsx)(o,{className:`size-3.5`,strokeWidth:1.8}),e.invalidPets]}),(0,T.jsx)(`div`,{className:`mt-2 space-y-2`,children:n.petIssues.map(t=>(0,T.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-base/70 p-2 text-xs text-fg-muted sm:flex-row sm:items-start sm:justify-between`,children:[(0,T.jsxs)(`div`,{className:`min-w-0`,children:[(0,T.jsx)(`p`,{className:`truncate font-mono text-[11px] text-fg`,children:t.dir}),(0,T.jsx)(`p`,{children:t.reason}),t.details?.length?(0,T.jsx)(`p`,{className:`line-clamp-2`,children:t.details.join(`; `)}):null]}),(0,T.jsxs)(`button`,{type:`button`,className:a(`inline-flex h-8 shrink-0 items-center justify-center gap-1.5 rounded-lg border border-danger/30 bg-surface-base px-2.5 text-xs font-medium text-danger hover:bg-danger/10`,v.press),onClick:()=>H(t),children:[(0,T.jsx)(f,{className:`size-3.5`,strokeWidth:1.75}),e.fixInChat]})]},`${t.dir}-${t.reason}`))})]}):null]}),(0,T.jsxs)(`div`,{className:`mt-5 grid gap-2`,children:[(0,T.jsxs)(`div`,{className:`rounded-xl bg-surface-hover/50 p-3 dark:bg-surface-hover/35`,children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e.size}),(0,T.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.sizeDesc})]}),(0,T.jsxs)(`span`,{className:`text-xs font-medium text-fg-muted`,children:[U,`%`]})]}),(0,T.jsx)(`input`,{type:`range`,min:70,max:140,step:5,className:`mt-3 w-full accent-accent`,value:U,onChange:e=>k(Number(e.target.value)),onBlur:()=>void W(),onKeyUp:e=>{(e.key===`Enter`||e.key===` `||e.key.startsWith(`Arrow`))&&W()},onPointerUp:()=>void W()})]}),(0,T.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,T.jsx)(E,{title:e.alwaysOnTop,desc:e.alwaysOnTopDesc,checked:n.prefs.alwaysOnTop,disabled:C,onChange:e=>void N({alwaysOnTop:e})}),(0,T.jsx)(E,{title:e.bubbles,desc:e.bubblesDesc,checked:n.prefs.bubbleEnabled,disabled:C,onChange:e=>void N({bubbleEnabled:e})})]}),(0,T.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-hover/50 p-3 dark:bg-surface-hover/35 sm:flex-row sm:items-center sm:justify-between`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e.feedbackLevel}),(0,T.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.feedbackLevelDesc})]}),(0,T.jsxs)(m,{className:`w-full sm:w-40`,triggerClassName:`h-9 bg-surface-panel`,value:n.prefs.feedbackLevel,onChange:e=>void N({feedbackLevel:e.target.value}),children:[(0,T.jsx)(h,{value:`quiet`,children:e.feedbackQuiet}),(0,T.jsx)(h,{value:`normal`,children:e.feedbackNormal}),(0,T.jsx)(h,{value:`chatty`,children:e.feedbackChatty})]})]}),(0,T.jsxs)(`button`,{type:`button`,className:a(`inline-flex w-fit items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-3 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,v.press),disabled:C,onClick:()=>void A.resetPosition().then(r),children:[(0,T.jsx)(y,{className:`size-3.5`,strokeWidth:1.75}),e.resetPosition]})]})]})]})}export{D as DesktopPetSettings};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{l as i}from"./chunk-KS7C4IRE-uQ0fehio.js";import{t as a}from"./cn-BQ_8x0bT.js";import{t as o}from"./circle-alert-RzVebuX2.js";import{t as s}from"./messages--cnUi8Ld.js";import{n as c}from"./locale-store-CQDaFvDN.js";import{Ec as l,Es as u,Ml as d,Rc as f,Vo as p,Yo as m,Zo as h,fc as g,lo as _,ps as v,uc as y}from"./index-B5cSZcER.js";import{t as b}from"./desktop-pet-sprite-DqZ6fbIj.js";import{n as x,r as S}from"./settings-page-layout-C7B19AHf.js";var C=n(),w=e(t(),1),T=r();function E(e){let t=(0,C.c)(16),{title:n,desc:r,checked:i,disabled:a,onChange:o}=e,s;t[0]===n?s=t[1]:(s=(0,T.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n}),t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c=(0,T.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r}),t[2]=r,t[3]=c);let l;t[4]!==s||t[5]!==c?(l=(0,T.jsxs)(`div`,{className:`min-w-0`,children:[s,c]}),t[4]=s,t[5]=c,t[6]=l):l=t[6];let u;t[7]===o?u=t[8]:(u=e=>o(e.target.checked),t[7]=o,t[8]=u);let d;t[9]!==i||t[10]!==a||t[11]!==u?(d=(0,T.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:a,checked:i,onChange:u}),t[9]=i,t[10]=a,t[11]=u,t[12]=d):d=t[12];let f;return t[13]!==l||t[14]!==d?(f=(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[l,d]}),t[13]=l,t[14]=d,t[15]=f):f=t[15],f}function D(){let e=s(c(e=>e.language)).desktopPetSettings,t=i(),[n,r]=(0,w.useState)(null),[C,D]=(0,w.useState)(!1),[O,k]=(0,w.useState)(null),A=typeof window<`u`?window.electronAPI?.pet:void 0,j=(0,w.useMemo)(()=>n?.pets.find(e=>e.id===n.prefs.selectedPetId)??n?.pets[0],[n]),M=(0,w.useCallback)(async()=>{if(A){D(!0);try{r(await A.getState())}finally{D(!1)}}},[A]);if((0,w.useEffect)(()=>{if(A)return M(),A.onStateChanged(r)},[A,M]),!p()||!A)return null;if(!n)return(0,T.jsxs)(S,{gap:`gap-4`,children:[(0,T.jsx)(x,{title:e.title,subtitle:e.subtitle}),(0,T.jsx)(`section`,{className:`rounded-xl border border-edge bg-surface-base p-4`,"aria-busy":!0,"aria-label":e.loading,children:(0,T.jsxs)(`div`,{className:`space-y-3`,children:[(0,T.jsx)(_,{className:`h-14 rounded-xl`}),(0,T.jsx)(_,{className:`h-14 rounded-xl`}),(0,T.jsx)(_,{className:`h-24 rounded-xl`}),(0,T.jsx)(`div`,{className:`space-y-2 pt-2`,children:Array.from({length:3}).map((e,t)=>(0,T.jsx)(_,{className:`h-16 rounded-xl`},t))})]})})]});let N=async e=>{D(!0);try{r(await A.setPrefs(e))}finally{D(!1)}},P=async e=>{e?(await A.show(),r(await A.getState())):r(await A.setPrefs({enabled:!1}))},F=e=>{N({selectedPetId:e})},I=t=>{if(t.builtin&&t.i18nKey){let n=e.builtinPets[t.i18nKey];if(n)return n}return{name:t.name,description:t.description}},L=e=>{t({pathname:`/chat/new`,search:`?draft=${encodeURIComponent(e)}`})},R=e=>{if(e.sourcePrompt?.trim())return e.sourcePrompt.trim();let{description:t}=I(e);return t.replace(/^Custom pet generated from:\s*/i,``).trim()||t},z=(e,t)=>Object.entries(t).reduce((e,[t,n])=>e.split(`{${t}}`).join(n),e),B=()=>{L(e.createChatDraft)},V=t=>{L(z(e.optimizeChatDraft,{id:t.id,name:I(t).name,description:I(t).description,sourcePrompt:R(t)}))},H=t=>{L(z(e.fixChatDraft,{dir:t.dir,reason:t.reason,details:t.details?.join(`; `)||e.noIssueDetails}))},U=O??n.prefs.sizePercent,W=async(e=U)=>{let t=Math.min(140,Math.max(70,Math.round(e/5)*5));k(null),t!==n.prefs.sizePercent&&await N({sizePercent:t})};return(0,T.jsxs)(S,{gap:`gap-4`,children:[(0,T.jsx)(x,{title:e.title,subtitle:e.subtitle,actions:(0,T.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[(0,T.jsxs)(`button`,{type:`button`,className:a(`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,v.press),disabled:C,onClick:()=>void M(),children:[(0,T.jsx)(g,{className:a(`size-3.5`,C&&`animate-spin`),strokeWidth:1.75}),e.refresh]}),(0,T.jsxs)(`button`,{type:`button`,className:a(`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover`,v.press),onClick:()=>void A.openCustomPetsDir(),children:[(0,T.jsx)(d,{className:`size-3.5`,strokeWidth:1.75}),e.openFolder]})]})}),(0,T.jsxs)(`section`,{className:`rounded-xl border border-edge bg-surface-base p-4 shadow-surface`,children:[(0,T.jsxs)(`div`,{className:`space-y-2`,children:[(0,T.jsx)(E,{title:e.enable,desc:e.enableDesc,checked:n.prefs.enabled,disabled:C,onChange:e=>void P(e)}),(0,T.jsx)(E,{title:e.showOnStartup,desc:e.showOnStartupDesc,checked:n.prefs.showOnStartup,disabled:C,onChange:e=>void N({showOnStartup:e})})]}),(0,T.jsx)(`div`,{className:`mt-5 rounded-xl border border-edge-subtle bg-surface-panel p-3`,children:(0,T.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,T.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[(0,T.jsx)(u,{className:`mt-0.5 size-4 text-accent-fg`,strokeWidth:1.8}),(0,T.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,T.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:e.createTitle}),(0,T.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.createDesc})]})]}),(0,T.jsxs)(`button`,{type:`button`,className:a(`inline-flex h-9 shrink-0 items-center justify-center gap-1.5 rounded-lg bg-accent px-3 text-xs font-semibold text-white hover:bg-accent/90`,v.press),onClick:B,children:[(0,T.jsx)(f,{className:`size-3.5`,strokeWidth:1.75}),e.createInChat]})]})}),(0,T.jsxs)(`div`,{className:`mt-5`,children:[(0,T.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:e.petList}),(0,T.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.petListDesc})]}),j?(0,T.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2.5 py-1 text-xs font-medium text-accent-fg`,children:I(j).name}):null]}),(0,T.jsxs)(`div`,{className:`divide-y divide-edge-subtle rounded-xl border border-edge bg-surface-base`,children:[n.pets.map(t=>{let r=t.id===n.prefs.selectedPetId,i=I(t);return(0,T.jsxs)(`div`,{className:`flex items-center gap-3 p-3`,children:[(0,T.jsx)(b,{pet:t,action:`idle`,size:`tiny`}),(0,T.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(`p`,{className:`truncate text-sm font-semibold text-fg`,children:i.name}),t.builtin?null:(0,T.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:e.customBadge})]}),(0,T.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:i.description})]}),(0,T.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[t.builtin?null:(0,T.jsxs)(`button`,{type:`button`,className:a(`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover`,v.press),onClick:()=>V(t),children:[(0,T.jsx)(l,{className:`size-3.5`,strokeWidth:1.75}),e.optimizeInChat]}),(0,T.jsx)(`button`,{type:`button`,className:a(`rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors`,r?`bg-surface-hover text-fg-muted`:`bg-surface-panel text-fg hover:bg-surface-hover`,v.press),disabled:r||C,onClick:()=>F(t.id),children:r?e.selected:e.select})]})]},t.id)}),(0,T.jsxs)(`div`,{className:`flex flex-col gap-1 p-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`p`,{className:`text-xs font-semibold text-fg`,children:e.customPets}),(0,T.jsx)(`p`,{className:`font-mono text-xs text-fg-muted`,children:n.customPetsDir})]}),(0,T.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 text-xs font-medium text-fg-muted hover:text-fg`,onClick:()=>void A.openCustomPetsDir(),children:[e.openFolder,(0,T.jsx)(d,{className:`size-3.5`,strokeWidth:1.75})]})]})]}),n.petIssues.length>0?(0,T.jsxs)(`div`,{className:`mt-2 rounded-xl border border-danger/30 bg-danger/5 p-3`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-semibold text-danger`,children:[(0,T.jsx)(o,{className:`size-3.5`,strokeWidth:1.8}),e.invalidPets]}),(0,T.jsx)(`div`,{className:`mt-2 space-y-2`,children:n.petIssues.map(t=>(0,T.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-base/70 p-2 text-xs text-fg-muted sm:flex-row sm:items-start sm:justify-between`,children:[(0,T.jsxs)(`div`,{className:`min-w-0`,children:[(0,T.jsx)(`p`,{className:`truncate font-mono text-[11px] text-fg`,children:t.dir}),(0,T.jsx)(`p`,{children:t.reason}),t.details?.length?(0,T.jsx)(`p`,{className:`line-clamp-2`,children:t.details.join(`; `)}):null]}),(0,T.jsxs)(`button`,{type:`button`,className:a(`inline-flex h-8 shrink-0 items-center justify-center gap-1.5 rounded-lg border border-danger/30 bg-surface-base px-2.5 text-xs font-medium text-danger hover:bg-danger/10`,v.press),onClick:()=>H(t),children:[(0,T.jsx)(f,{className:`size-3.5`,strokeWidth:1.75}),e.fixInChat]})]},`${t.dir}-${t.reason}`))})]}):null]}),(0,T.jsxs)(`div`,{className:`mt-5 grid gap-2`,children:[(0,T.jsxs)(`div`,{className:`rounded-xl bg-surface-hover/50 p-3 dark:bg-surface-hover/35`,children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e.size}),(0,T.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.sizeDesc})]}),(0,T.jsxs)(`span`,{className:`text-xs font-medium text-fg-muted`,children:[U,`%`]})]}),(0,T.jsx)(`input`,{type:`range`,min:70,max:140,step:5,className:`mt-3 w-full accent-accent`,value:U,onChange:e=>k(Number(e.target.value)),onBlur:()=>void W(),onKeyUp:e=>{(e.key===`Enter`||e.key===` `||e.key.startsWith(`Arrow`))&&W()},onPointerUp:()=>void W()})]}),(0,T.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,T.jsx)(E,{title:e.alwaysOnTop,desc:e.alwaysOnTopDesc,checked:n.prefs.alwaysOnTop,disabled:C,onChange:e=>void N({alwaysOnTop:e})}),(0,T.jsx)(E,{title:e.bubbles,desc:e.bubblesDesc,checked:n.prefs.bubbleEnabled,disabled:C,onChange:e=>void N({bubbleEnabled:e})})]}),(0,T.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-hover/50 p-3 dark:bg-surface-hover/35 sm:flex-row sm:items-center sm:justify-between`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e.feedbackLevel}),(0,T.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.feedbackLevelDesc})]}),(0,T.jsxs)(m,{className:`w-full sm:w-40`,triggerClassName:`h-9 bg-surface-panel`,value:n.prefs.feedbackLevel,onChange:e=>void N({feedbackLevel:e.target.value}),children:[(0,T.jsx)(h,{value:`quiet`,children:e.feedbackQuiet}),(0,T.jsx)(h,{value:`normal`,children:e.feedbackNormal}),(0,T.jsx)(h,{value:`chatty`,children:e.feedbackChatty})]})]}),(0,T.jsxs)(`button`,{type:`button`,className:a(`inline-flex w-fit items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-3 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,v.press),disabled:C,onClick:()=>void A.resetPosition().then(r),children:[(0,T.jsx)(y,{className:`size-3.5`,strokeWidth:1.75}),e.resetPosition]})]})]})]})}export{D as DesktopPetSettings};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-BQ_8x0bT.js";import{At as r,Ft as i,Pt as a}from"./index-
|
|
1
|
+
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-BQ_8x0bT.js";import{At as r,Ft as i,Pt as a}from"./index-B5cSZcER.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};
|