@xopcai/xopc 0.0.157 → 0.0.158
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/{action-boundary-settings-panel-zQ_w0sPl.js → action-boundary-settings-panel-2p1f4-KA.js} +1 -1
- package/dist/gateway/static/root/assets/{activity-store-CddlQHam.js → activity-store-C-57rvkX.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DOfTopIk.js → agent-avatar-dicebear-BIl6X2b_.js} +1 -1
- package/dist/gateway/static/root/assets/agents-bnkKH9EI.js +2 -0
- package/dist/gateway/static/root/assets/{api-NUlcaaV9.js → api-BjcBIV2O.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-J0-z_uc1.js → app-management-settings-panel-CZxw161D.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-CMaQOx2C.js → appearance-settings-CRXNlDhH.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-l4ripRNG.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-BVwE70GV.js → archive-plugin-CpVshjXu.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-aj5U56K9.js → attachment-load-M9WqqJnQ.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-suggestion-card-CKz8rxAb.js → automation-suggestion-card-CYMsAsYf.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-Kny7tLiF.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-Ie6owbEw.js → binary-plugins-Cjn3zb4u.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-BaDrd5GJ.js → block-editor-BPKdquaV.js} +3 -3
- package/dist/gateway/static/root/assets/browser-settings-page-vr1tXAab.js +8 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-BjO4YD-O.js → capability-presets-api-Bzkcsyzn.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-settings-panel-bwezWQpF.js → capability-presets-settings-panel-D4rH4Dax.js} +2 -2
- package/dist/gateway/static/root/assets/{channel-recipient-api-BisDU_DH.js → channel-recipient-api-CFqrSi5K.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-Tlhbi5eh.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-vooEF4lG.js +1 -0
- package/dist/gateway/static/root/assets/{connector-logo-DGjjzBIH.js → connector-logo-ljPKdYKh.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-_XfvjXoY.js +2 -0
- package/dist/gateway/static/root/assets/{desktop-pet-CoQ4Edck.js → desktop-pet-DKUlAgm7.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings--sjUYeNX.js → desktop-pet-settings-aWWzjdza.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-CpmfFDx3.js → directory-picker-path-field-Dmy1035j.js} +1 -1
- package/dist/gateway/static/root/assets/{dreaming-settings-D7rRROE7.js → dreaming-settings-tT4WkBkd.js} +3 -3
- package/dist/gateway/static/root/assets/{extension-debug-page-BzqW3ssG.js → extension-debug-page-CL79q8AH.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-CKDbBzVR.js → extension-page-hq80wkFI.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-DjNMSdRz.js → extension-settings-page-BV-9GDfT.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-CUEAZEld.js → gateway-config-api-CFqoN2NW.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-DzR-kM91.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-CbMPgpHX.js → gateway-startup-retry-cxQ94qMm.js} +1 -1
- package/dist/gateway/static/root/assets/goal-create-dialog-BLjHRtqe.js +1 -0
- package/dist/gateway/static/root/assets/goal-detail-page-BRxeujXh.js +4 -0
- package/dist/gateway/static/root/assets/{goals-config-api-C-Vq8VR9.js → goals-config-api--qJ4qlRq.js} +1 -1
- package/dist/gateway/static/root/assets/goals-page-BaZ3aw4u.js +2 -0
- package/dist/gateway/static/root/assets/{goals-settings-DVrTDWYS.js → goals-settings-h7x9h5lb.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-Dv8qA4E7.js → heartbeat-settings-71IhhM3s.js} +1 -1
- package/dist/gateway/static/root/assets/{index-DHRxn7Sy.js → index-EXa_i6BT.js} +7 -7
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DEKtMZbg.js → keyboard-shortcuts-settings-BZGmHvLu.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-lUpd6lSo.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-DQT2lZk7.js → local-apps-page-CiLqrMIh.js} +1 -1
- package/dist/gateway/static/root/assets/locale-store-C_M71MK9.js +1 -0
- package/dist/gateway/static/root/assets/logs-page-FPDTmcWe.js +7 -0
- package/dist/gateway/static/root/assets/{markdown-split-Cp6NxQJr.js → markdown-split-r1HPWfCU.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-Dv1cQK2J.js → media-plugins-D74kd3hn.js} +1 -1
- package/dist/gateway/static/root/assets/{messages-Bwu1tG3T.js → messages-BuT0SR1R.js} +4 -4
- package/dist/gateway/static/root/assets/models-hub-panel-BXrdePhv.js +2 -0
- package/dist/gateway/static/root/assets/{notes-page-CePZ2we1.js → notes-page-Dgu02514.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-D-EAhXv1.js +4 -0
- package/dist/gateway/static/root/assets/{page-tabs-C1jBfKTZ.js → page-tabs-hinRdDy3.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-Cl9anbg0.js → preview-open-alternatives-C7fw3oGy.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-BjpB1wrp.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-BxyjqOfC.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-BFv6Upke.js +1 -0
- package/dist/gateway/static/root/assets/{save-bar-controls-CWu_o1ta.js → save-bar-controls-C3aU8-vO.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-DuZbqL7X.js → schedule-field-DjegExFD.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-Bixut-2d.js → schema-form-DLubnsql.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-BX4DH8J7.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-CJ9MbRP8.js +1 -0
- package/dist/gateway/static/root/assets/{settings-collapsible-section-C_7lCtCp.js → settings-collapsible-section-3syQHsNR.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-form-section-D0DPTbO0.js → settings-form-section-D4DCZzKg.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-tN-9u8dj.js → settings-loading-skeleton-c5K85ylS.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-C2L9g3kd.js → settings-page-DNiDlaRq.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-CBUOPmx_.js → settings-page-layout-iTRY1Hy-.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BH4xQKM9.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-BiSh0nLu.js → share-preview-page-B88Afrhe.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-B6kKkvOb.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-DtjS-nUK.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-CQEoPv0u.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-h7uqbQ-n.js → system-settings-panel-DtpTq837.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-DjYRaF0J.js → theme-store-C8ohIHhw.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-BkqBD32C.js → typed-models-lib-ndEnUP3b.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-DiWtF12K.js → use-channel-catalog-BWzou5ar.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-Dn2T3itn.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-C4770AsA.js → voice-api-key-field-wtWc3SfN.js} +1 -1
- package/dist/gateway/static/root/assets/work-discovery-page-Ckxhj66e.js +1 -0
- package/dist/gateway/static/root/assets/work-item-detail-page-_1QgGPNw.js +1 -0
- package/dist/gateway/static/root/assets/work-page-BPdf2iuv.js +1 -0
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-ukmpkj66.js +3 -0
- package/dist/gateway/static/root/assets/workflows-page-DdKTx0Hs.js +11 -0
- package/dist/gateway/static/root/index.html +6 -6
- package/dist/package.js +1 -1
- package/dist/src/connectors/catalog.js +2 -3
- package/dist/src/connectors/composio-catalog.d.ts +11 -1
- package/dist/src/connectors/composio-catalog.js +37 -7
- package/dist/src/connectors/composio.js +2 -1
- package/dist/src/gateway/hono/routes/connectors.js +10 -22
- package/dist/src/storage/sqlite/connector-repository.d.ts +1 -0
- package/dist/src/storage/sqlite/connector-repository.js +12 -1
- package/dist/src/storage/sqlite/index.d.ts +1 -1
- package/dist/src/storage/sqlite/index.js +2 -2
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/agents-RZNd9xMI.js +0 -2
- package/dist/gateway/static/root/assets/apps-page-BOeTZgdL.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-wYN1N-Il.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-DD3djQtX.js +0 -8
- package/dist/gateway/static/root/assets/channels-settings-Bohv9YRy.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-h3VHD5Uq.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-LIAkMlN-.js +0 -2
- package/dist/gateway/static/root/assets/gateway-settings-h1wWBrxD.js +0 -1
- package/dist/gateway/static/root/assets/goal-create-dialog-xfO0R5Bx.js +0 -1
- package/dist/gateway/static/root/assets/goal-detail-page-CVVKF2hY.js +0 -4
- package/dist/gateway/static/root/assets/goals-page-W666NFIU.js +0 -2
- package/dist/gateway/static/root/assets/local-app-workbench-page-y5WmNSyZ.js +0 -2
- package/dist/gateway/static/root/assets/locale-store-d9Cylz62.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-DMQaC4Jn.js +0 -7
- package/dist/gateway/static/root/assets/models-hub-panel-CoYDJvX_.js +0 -2
- package/dist/gateway/static/root/assets/notes-workbench-C9B-7EsK.js +0 -4
- package/dist/gateway/static/root/assets/project-detail-page-DG_P8S7e.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-C1pro-bG.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-DDj6t0SQ.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-C1aZFTTX.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-CwRP1Nsl.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-DFjG5i48.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-Bh2T05Hp.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-ppRtNzpM.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-Dnw1xKKm.js +0 -2
- package/dist/gateway/static/root/assets/user-context-page-09T5O8lO.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-page-D__GQy1R.js +0 -1
- package/dist/gateway/static/root/assets/work-item-detail-page-CAIgG4im.js +0 -1
- package/dist/gateway/static/root/assets/work-page-CkZvIUpT.js +0 -1
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-qqixrSRL.js +0 -3
- package/dist/gateway/static/root/assets/workflows-page-THxdPWzb.js +0 -11
- package/dist/src/connectors/registries/modelscope.d.ts +0 -2
- package/dist/src/connectors/registries/modelscope.js +0 -228
- package/dist/src/connectors/registries/official-mcp.d.ts +0 -2
- package/dist/src/connectors/registries/official-mcp.js +0 -140
- package/dist/src/connectors/registries/search.d.ts +0 -12
- package/dist/src/connectors/registries/search.js +0 -87
- package/dist/src/connectors/registries/smithery.d.ts +0 -2
- package/dist/src/connectors/registries/smithery.js +0 -97
- package/dist/src/connectors/registries/types.d.ts +0 -20
- package/dist/src/connectors/registries/types.js +0 -1
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{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-Bwu1tG3T.js";import{l,n as u,r as d,s as f}from"./locale-store-d9Cylz62.js";import{$s as p,Ao as m,Bc as h,Ci as g,Cl as _,Di as v,Fo as y,Gi as b,Go as x,Hi as S,Hl as C,Hs as w,Io as T,Mo as E,Ms as D,Nl as O,No as k,Oc as A,Po as j,Si as M,Ti as N,Ui as P,Vi as F,Wi as I,Wo as L,Xo as R,Xs as z,Yo as B,Zl as V,_c as H,ac as U,bs as ee,ec as te,gc as ne,hs as W,io as re,jo as ie,kl as ae,ko as oe,lc as se,ls as ce,ms as le,nc as ue,os as de,qo as G,ro as fe,sa as pe,tl as me,tu as he,wi as ge,ws as _e,yc as ve,ys as ye,zs as be}from"./index-DHRxn7Sy.js";import{t as xe}from"./page-tabs-C1jBfKTZ.js";import{t as K}from"./connector-logo-DGjjzBIH.js";var q=e(t(),1),J=n(),Y=r();function Se(e){let t=(0,J.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(Ce),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,Y.jsxs)(W,{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,Y.jsx)(A,{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,Y.jsx)(K,{connector:n}),t[35]=n,t[36]=D);let O;t[37]===n.displayName?O=t[38]:(O=(0,Y.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,Y.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 j;t[41]===S?j=t[42]:(j=S?(0,Y.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]=j);let M;t[43]!==O||t[44]!==k||t[45]!==j?(M=(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[O,k,j]}),t[43]=O,t[44]=k,t[45]=j,t[46]=M):M=t[46];let N;t[47]!==D||t[48]!==M?(N=(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[D,M]}),t[47]=D,t[48]=M,t[49]=N):N=t[49];let P;t[50]!==r||t[51]!==c?(P=r?null:(0,Y.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]=P):P=t[52];let F;t[53]!==r||t[54]!==s.connectedBadge?(F=r?(0,Y.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,Y.jsx)(V,{className:`size-3`,"aria-hidden":!0}),s.connectedBadge]}):null,t[53]=r,t[54]=s.connectedBadge,t[55]=F):F=t[55];let I;t[56]!==P||t[57]!==F?(I=(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-start gap-2`,children:[P,F]}),t[56]=P,t[57]=F,t[58]=I):I=t[58],t[59]!==N||t[60]!==I?(u=(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[N,I]}),t[59]=N,t[60]=I,t[61]=u):u=t[61],t[62]===n.description?d=t[63]:(d=(0,Y.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,Y.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-1.5`,children:[v.map(e=>(0,Y.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,Y.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,Y.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,Y.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,Y.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 Ce(e){return!e.startsWith(`runtime.`)&&!e.startsWith(`auth.`)}var we=[`c0`,`c1`,`c2`,`c3`,`c4`,`c5`];function Te(e,t){return t.some(t=>t.connectorId===e.id)}var X=`animate-pulse motion-reduce:animate-none rounded-md bg-surface-hover dark:bg-surface-active/50`;function Ee(){let e=(0,J.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Y.jsx)(`div`,{className:a(`size-10 shrink-0 rounded-xl`,X)}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Y.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,Y.jsxs)(`div`,{className:`flex min-h-0 flex-1 items-start gap-3`,children:[t,(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,Y.jsx)(`div`,{className:a(`h-4 min-w-0 flex-1`,X)}),(0,Y.jsx)(`div`,{className:a(`h-8 w-[4.5rem] shrink-0 rounded-lg`,X)})]}),(0,Y.jsx)(`div`,{className:a(`h-3 w-full`,X)}),(0,Y.jsx)(`div`,{className:a(`h-3 w-[88%]`,X)})]})]})}),e[1]=n):n=e[1],n}var Z=`animate-pulse motion-reduce:animate-none rounded-md bg-surface-hover dark:bg-surface-active/50`;function De(){let e=(0,J.c)(4),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Y.jsx)(`div`,{className:a(`size-10 shrink-0 rounded-xl`,Z)}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[(0,Y.jsx)(`div`,{className:a(`h-4 w-48 max-w-full`,Z)}),(0,Y.jsx)(`div`,{className:a(`h-3 w-72 max-w-full`,Z)})]}),e[1]=n):n=e[1];let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[t,(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-start justify-between gap-3`,children:[n,(0,Y.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[(0,Y.jsx)(`div`,{className:a(`h-9 w-20 rounded-lg`,Z)}),(0,Y.jsx)(`div`,{className:a(`h-9 w-20 rounded-lg`,Z)})]})]})]}),e[2]=r):r=e[2];let i;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Y.jsxs)(`div`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,"aria-hidden":!0,children:[r,(0,Y.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,Y.jsx)(`div`,{className:a(`h-8 w-20 rounded-md`,Z)}),(0,Y.jsx)(`div`,{className:a(`h-8 w-24 rounded-md`,Z)}),(0,Y.jsx)(`div`,{className:a(`h-8 w-28 rounded-md`,Z)})]}),(0,Y.jsx)(`div`,{className:a(`mt-3 h-20 rounded-xl`,Z)})]}),e[3]=i):i=e[3],i}function Q(e,t){if(!e.payload)throw Error(e.error??t);return e.payload}async function Oe(){let[e,t]=await Promise.all([f(d(`/api/connectors/catalog`)),ke().catch(()=>[])]),n=Q(e,`Could not load connector catalog.`).connectors;return[...new Map([...t,...n].map(e=>[e.id,e])).values()]}async function ke(e=!1){return Q(await f(d(`/api/connectors/composio/catalog${e?`?refresh=1`:``}`)),`Could not load Composio catalog.`).connectors}async function Ae(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 je(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 Me(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 Ne(){return Q(await f(d(`/api/connectors/catalog`)),`Could not load connector registries.`).registries??[]}async function Pe(){return Q(await f(d(`/api/connectors/installed`)),`Could not load installed connectors.`).instances}var Fe=new Map,Ie=300*1e3;async function Le(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=Fe.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}});Fe.set(c,{expiresAt:l+Ie,promise:m});try{return await m}catch(e){throw Fe.delete(c),e}}async function Re(e){return Q(await f(d(`/api/connectors/${encodeURIComponent(e)}/auth/start`),{method:`POST`}),`Could not start connector authorization.`).authorization}async function ze(){return Q(await f(d(`/api/connectors/composio/setup-status`)),`Could not check the connection service.`)}async function Be(e){Q(await f(d(`/api/connectors/composio/setup`),{method:`POST`,body:JSON.stringify({apiKey:e})}),`Could not enable the connection service.`)}async function Ve(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 He(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 Ue(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 We(e){await f(d(`/api/connectors/${encodeURIComponent(e)}`),{method:`DELETE`}),fe()}async function Ge(e){return Q(await f(d(`/api/connectors/${encodeURIComponent(e)}/test`),{method:`POST`}),`Connector test failed.`)}async function Ke(){return Q(await f(d(`/api/connectors/composio/connections`)),`Could not load Composio connections.`).connections}async function qe(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 Je(e){return Q(await f(d(`/api/connectors/composio/${encodeURIComponent(e)}/health`)),`Could not check Composio connector health.`).health}async function Ye(e){await f(d(`/api/connectors/composio/connections/${encodeURIComponent(e)}/refresh`),{method:`POST`})}async function Xe(e){await f(d(`/api/connectors/composio/connections/${encodeURIComponent(e)}`),{method:`DELETE`})}async function Ze(e){return Q(await f(d(`/api/connectors/composio/${encodeURIComponent(e)}/scope`)),`Could not load Composio scope.`).scope}async function Qe(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 $e(e){return Q(await f(d(`/api/connectors/composio/${encodeURIComponent(e)}/policy`)),`Could not load Composio policy.`)}async function et(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 tt(e){return Q(await f(d(`/api/connectors/composio/${encodeURIComponent(e)}/tools`)),`Could not load Composio tools.`).tools}async function nt(e=50){return Q(await f(d(`/api/connectors/composio/triggers?limit=${encodeURIComponent(String(e))}`)),`Could not load Composio trigger events.`).events}async function rt(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 it(e){return Q(await f(d(`/api/connectors/${encodeURIComponent(e)}/memory-sync-profile`)),`Could not load memory sync settings.`).profile}async function at(e,t){return Q(await f(d(`/api/connectors/${encodeURIComponent(e)}/memory-sync-profile`),{method:`PATCH`,body:JSON.stringify(t)}),`Could not save memory sync settings.`).profile}async function ot(e){return Q(await f(d(`/api/connectors/${encodeURIComponent(e)}/memory-sync`),{method:`POST`,body:JSON.stringify({})}),`Could not sync connector data to memory.`)}async function st(e=``,t=100){return Q(await f(d(`/api/connectors/people?${new URLSearchParams({q:e,limit:String(t)}).toString()}`)),`Could not load the connected people graph.`)}async function ct(e=`pending`){return Q(await f(d(`/api/connectors/approvals?status=${encodeURIComponent(e)}`)),`Could not load connector approvals.`).approvals}async function lt(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 ut(e,t){return Object.entries(t).reduce((e,[t,n])=>e.replaceAll(`{{${t}}}`,String(n)),e)}function dt(e,t){return t.connectorCapabilityLabels[e]??e}function ft(e,t){if(e.runtime.type===`mcp`)return ut(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 ut(t.connectorRuntimeGeneric,{runtime:e.runtime.type,id:n??e.runtime.type})}function pt(e,t){return e.auth.mode===`oauth`?t.connectorAuthOAuth:e.auth.mode===`apiKey`?t.connectorAuthApiKey:t.connectorAuthNone}function mt(e){return(e.setup.secrets??[]).filter(e=>e.required).length+(e.setup.config??[]).filter(e=>e.required).length}function ht(e){let t=(0,J.c)(12),{title:n,items:r}=e;if(r.length===0)return null;let i;t[0]===n?i=t[1]:(i=(0,Y.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(gt),t[2]=r,t[3]=a);let o;t[4]===r.length?o=t[5]:(o=r.length>16?(0,Y.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,Y.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,Y.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 gt(e){return(0,Y.jsxs)(`div`,{className:`border-b border-edge-subtle px-3 py-2 last:border-b-0`,children:[(0,Y.jsx)(`div`,{className:`break-words font-mono text-xs font-medium text-fg`,children:e.title}),e.description?(0,Y.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description}):null]},e.id)}function _t({connector:e,installed:t,onClose:n,onInstall:r,t:i}){let[o,s]=(0,q.useState)(!1),[c,l]=(0,q.useState)(null),[u,d]=(0,q.useState)(null),f=mt(e),p=e.capabilities.slice(0,8),g=Math.max(0,e.capabilities.length-p.length),_=[...(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}))],v=async()=>{s(!0),d(null);try{l(await He(e))}catch(e){l(null),d(e instanceof Error?e.message:String(e))}finally{s(!1)}};return(0,Y.jsx)(oe,{open:!0,onOpenChange:e=>{e||n()},children:(0,Y.jsxs)(j,{children:[(0,Y.jsx)(k,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,Y.jsxs)(ie,{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,Y.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-6 py-5`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Y.jsx)(K,{connector:e,size:`lg`}),(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center gap-2`,children:[(0,Y.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,Y.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,Y.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,Y.jsx)(V,{className:`size-3`,"aria-hidden":!0}),i.connectedBadge]}):null]}),(0,Y.jsx)(y,{className:`text-base font-semibold text-fg`,children:e.displayName}),(0,Y.jsx)(E,{className:`mt-1 line-clamp-3 text-sm leading-6 text-fg-muted`,children:e.description})]})]}),(0,Y.jsx)(m,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,className:a(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,ce.focusRingPanel),"aria-label":i.modalClose,children:[(0,Y.jsx)(ye,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`sr-only`,children:i.modalClose})]})})]}),(0,Y.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-5`,children:[(0,Y.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,Y.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[(0,Y.jsx)(ee,{className:`size-3.5`,"aria-hidden":!0}),i.detailTools]}),(0,Y.jsx)(`p`,{className:`mt-2 text-sm font-semibold text-fg`,children:c?ut(i.connectorPreviewToolsCount,{count:c.toolCount}):i.connectorPreviewUnknown})]}),(0,Y.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[(0,Y.jsx)(me,{className:`size-3.5`,"aria-hidden":!0}),i.detailPermissions]}),(0,Y.jsx)(`p`,{className:`mt-2 text-sm font-semibold text-fg`,children:pt(e,i)})]}),(0,Y.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[(0,Y.jsx)(O,{className:`size-3.5`,"aria-hidden":!0}),i.connectorRequiredInputs]}),(0,Y.jsx)(`p`,{className:`mt-2 text-sm font-semibold text-fg`,children:ut(i.connectorRequiredInputsCount,{count:f})})]})]}),(0,Y.jsxs)(`div`,{className:`mt-5 grid gap-5 lg:grid-cols-[minmax(0,1fr)_18rem]`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 space-y-5`,children:[(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i.connectorCapabilitiesTitle}),(0,Y.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,children:[p.map(e=>(0,Y.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-base px-2 py-1 text-xs text-fg-muted`,children:dt(e,i)},e)),g>0?(0,Y.jsxs)(`span`,{className:`rounded-md border border-edge bg-surface-base px-2 py-1 text-xs text-fg-subtle`,children:[`+`,g]}):null]}),(0,Y.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:i.connectorCapabilitiesHint})]}),u?(0,Y.jsx)(`p`,{className:`rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:u}):null,c?(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-2`,children:[(0,Y.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i.connectorPreviewTitle}),(0,Y.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,Y.jsxs)(`div`,{className:`mb-3 grid gap-2 text-xs sm:grid-cols-3`,children:[(0,Y.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base px-3 py-2`,children:[(0,Y.jsx)(`div`,{className:`font-semibold text-fg`,children:c.toolCount}),(0,Y.jsx)(`div`,{className:`text-fg-muted`,children:i.toolsMetric})]}),(0,Y.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base px-3 py-2`,children:[(0,Y.jsx)(`div`,{className:`font-semibold text-fg`,children:c.resourceCount}),(0,Y.jsx)(`div`,{className:`text-fg-muted`,children:i.resourcesMetric})]}),(0,Y.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base px-3 py-2`,children:[(0,Y.jsx)(`div`,{className:`font-semibold text-fg`,children:c.promptCount}),(0,Y.jsx)(`div`,{className:`text-fg-muted`,children:i.promptsMetric})]})]}),(0,Y.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Y.jsx)(ht,{title:i.detailTools,items:c.tools.map(e=>({id:e.name,title:e.shortName??e.name,description:e.description}))}),(0,Y.jsx)(ht,{title:i.detailResources,items:c.resources.map(e=>({id:e.uri,title:e.title??e.name??e.uri,description:e.description??e.uri}))}),(0,Y.jsx)(ht,{title:i.detailPrompts,items:c.prompts.map(e=>({id:e.name,title:e.title??e.name,description:e.description??ut(i.promptArgumentCount,{count:e.argumentCount})}))})]}),c.error?(0,Y.jsx)(`p`,{className:`mt-3 text-xs leading-5 text-fg-subtle`,children:c.error}):null,c.action?(0,Y.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-subtle`,children:c.action}):null]}):null]}),(0,Y.jsxs)(`aside`,{className:`space-y-3`,children:[(0,Y.jsxs)(`section`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,Y.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,Y.jsx)(me,{className:`size-4 text-accent`,"aria-hidden":!0}),i.detailPermissions]}),(0,Y.jsx)(`p`,{className:`mt-2 text-sm font-medium text-fg`,children:pt(e,i)})]}),(0,Y.jsxs)(`section`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,Y.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,Y.jsx)(O,{className:`size-4 text-accent`,"aria-hidden":!0}),i.connectorSetupTitle]}),_.length>0?(0,Y.jsx)(`div`,{className:`mt-3 divide-y divide-edge overflow-hidden rounded-lg border border-edge`,children:_.map(e=>(0,Y.jsxs)(`div`,{className:`bg-surface-panel px-3 py-2.5`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.label}),(0,Y.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,Y.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,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:e.description}):null]},e.key))}):(0,Y.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:i.connectorSetupNone})]}),(0,Y.jsxs)(`section`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,Y.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,Y.jsx)(te,{className:`size-4 text-accent`,"aria-hidden":!0}),i.connectorRuntimeTitle]}),(0,Y.jsx)(`p`,{className:`mt-2 break-words text-xs leading-5 text-fg-muted`,children:ft(e,i)})]})]})]})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-2 border-t border-edge-subtle px-6 py-4`,children:[(0,Y.jsx)(m,{asChild:!0,children:(0,Y.jsx)(W,{variant:`secondary`,children:i.modalClose})}),(0,Y.jsxs)(W,{variant:`secondary`,disabled:o,onClick:()=>void v(),children:[o?(0,Y.jsx)(h,{className:`size-4 animate-spin`}):(0,Y.jsx)(ee,{className:`size-4`}),i.connectorPreviewButton]}),t?(0,Y.jsxs)(W,{variant:`secondary`,disabled:!0,children:[(0,Y.jsx)(ve,{className:`size-4`}),i.connectedBadge]}):(0,Y.jsxs)(W,{variant:`primary`,onClick:()=>{r(e),n()},children:[(0,Y.jsx)(A,{className:`size-4`}),i.connect]})]})]})]})})}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`,le);function yt(e){let t=(0,J.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,Y.jsx)(k,{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 g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Y.jsx)(`span`,{className:`flex size-10 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,Y.jsx)(H,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),t[4]=g):g=t[4];let _;t[5]===l.runtimeSettingsTitle?_=t[6]:(_=(0,Y.jsx)(y,{className:`text-base font-semibold text-fg`,children:l.runtimeSettingsTitle}),t[5]=l.runtimeSettingsTitle,t[6]=_);let v;t[7]===l.runtimeSettingsHint?v=t[8]:(v=(0,Y.jsx)(E,{className:`mt-1 text-sm text-fg-muted`,children:l.runtimeSettingsHint}),t[7]=l.runtimeSettingsHint,t[8]=v);let b;t[9]!==_||t[10]!==v?(b=(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[g,(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[_,v]})]}),t[9]=_,t[10]=v,t[11]=b):b=t[11];let x;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(x=a(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,ce.focusRingPanel),t[12]=x):x=t[12];let S;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Y.jsx)(ye,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),t[13]=S):S=t[13];let C;t[14]===l.modalClose?C=t[15]:(C=(0,Y.jsx)(m,{asChild:!0,children:(0,Y.jsx)(`button`,{type:`button`,className:x,"aria-label":l.modalClose,children:S})}),t[14]=l.modalClose,t[15]=C);let w;t[16]!==C||t[17]!==b?(w=(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-6 py-5`,children:[b,C]}),t[16]=C,t[17]=b,t[18]=w):w=t[18];let T;t[19]===u.idleTtlLabel?T=t[20]:(T=(0,Y.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:u.idleTtlLabel}),t[19]=u.idleTtlLabel,t[20]=T);let D;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(D=a(vt,`w-40 flex-none`),t[21]=D):D=t[21];let O=r??``,A;t[22]===o?A=t[23]:(A=e=>{let t=e.currentTarget.value.trim();o(t===``?void 0:Number.parseInt(t,10))},t[22]=o,t[23]=A);let M;t[24]!==u.idleTtlPlaceholder||t[25]!==O||t[26]!==A?(M=(0,Y.jsx)(`input`,{type:`number`,min:0,className:D,value:O,placeholder:u.idleTtlPlaceholder,onChange:A}),t[24]=u.idleTtlPlaceholder,t[25]=O,t[26]=A,t[27]=M):M=t[27];let N;t[28]===u.idleTtlHint?N=t[29]:(N=(0,Y.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:u.idleTtlHint}),t[28]=u.idleTtlHint,t[29]=N);let P;t[30]!==T||t[31]!==M||t[32]!==N?(P=(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-5`,children:(0,Y.jsxs)(`label`,{className:`flex max-w-xl flex-col gap-1.5`,children:[T,M,N]})}),t[30]=T,t[31]=M,t[32]=N,t[33]=P):P=t[33];let F;t[34]!==c||t[35]!==i||t[36]!==l.modalCancel?(F=(0,Y.jsx)(W,{type:`button`,variant:`secondary`,disabled:i,onClick:c,children:l.modalCancel}),t[34]=c,t[35]=i,t[36]=l.modalCancel,t[37]=F):F=t[37];let I;t[38]===s?I=t[39]:(I=()=>void s(),t[38]=s,t[39]=I);let L;t[40]===i?L=t[41]:(L=i?(0,Y.jsx)(h,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,t[40]=i,t[41]=L);let R;t[42]!==u.save||t[43]!==i||t[44]!==I||t[45]!==L?(R=(0,Y.jsxs)(W,{type:`button`,variant:`primary`,disabled:i,onClick:I,children:[L,u.save]}),t[42]=u.save,t[43]=i,t[44]=I,t[45]=L,t[46]=R):R=t[46];let z;t[47]!==F||t[48]!==R?(z=(0,Y.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle px-6 py-4`,children:[F,R]}),t[47]=F,t[48]=R,t[49]=z):z=t[49];let B;t[50]!==w||t[51]!==P||t[52]!==z?(B=(0,Y.jsxs)(j,{children:[f,(0,Y.jsxs)(ie,{className:p,children:[w,P,z]})]}),t[50]=w,t[51]=P,t[52]=z,t[53]=B):B=t[53];let V;return t[54]!==n||t[55]!==d||t[56]!==B?(V=(0,Y.jsx)(oe,{open:n,onOpenChange:d,children:B}),t[54]=n,t[55]=d,t[56]=B,t[57]=V):V=t[57],V}var bt=(0,q.memo)(function(e){let t=(0,J.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,Y.jsx)(ue,{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,Y.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,Y.jsxs)(`label`,{className:s,children:[c,u]}),t[9]=s,t[10]=u,t[11]=d):d=t[11],d}),xt=(0,q.memo)(function(e){let t=(0,J.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,Y.jsx)(p,{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,Y.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,Y.jsxs)(W,{type:`button`,variant:`secondary`,className:`shrink-0 gap-2`,"aria-label":l,title:l,onClick:i,children:[u,d]}),t[3]=i,t[4]=l,t[5]=d,t[6]=f):f=t[6];let m;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Y.jsx)(ne,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[7]=m):m=t[7];let h;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Y.jsx)(he,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[8]=h):h=t[8];let _;t[9]===o?_=t[10]:(_=(0,Y.jsx)(v,{asChild:!0,children:(0,Y.jsxs)(W,{type:`button`,variant:`primary`,className:`shrink-0 gap-2`,children:[m,o,h]})}),t[9]=o,t[10]=_);let y;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(y=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`,ce.transition),t[11]=y):y=t[11];let b;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Y.jsx)(be,{className:`size-4 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),t[12]=b):b=t[12];let x;t[13]!==s||t[14]!==n?(x=(0,Y.jsxs)(g,{className:y,onSelect:n,children:[b,s]}),t[13]=s,t[14]=n,t[15]=x):x=t[15];let S;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(S=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`,ce.transition),t[16]=S):S=t[16];let C;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Y.jsx)(ee,{className:`size-4 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),t[17]=C):C=t[17];let w;t[18]!==c||t[19]!==r?(w=(0,Y.jsxs)(g,{className:S,onSelect:r,children:[C,c]}),t[18]=c,t[19]=r,t[20]=w):w=t[20];let T;t[21]!==w||t[22]!==x?(T=(0,Y.jsx)(ge,{children:(0,Y.jsxs)(M,{className:`z-50 min-w-[14rem] rounded-xl border border-edge bg-surface-panel p-1 shadow-popover dark:border-edge`,sideOffset:6,align:`end`,children:[x,w]})}),t[21]=w,t[22]=x,t[23]=T):T=t[23];let E;t[24]!==T||t[25]!==_?(E=(0,Y.jsxs)(N,{children:[_,T]}),t[24]=T,t[25]=_,t[26]=E):E=t[26];let D;return t[27]!==E||t[28]!==f?(D=(0,Y.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}),St=/^([^:=]+)[:=](.*)$/;function Ct(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=St.exec(t);r&&n.push({key:r[1].trim(),value:r[2].trim()})}return n.length>0?n:null}function wt(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 Tt(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 Et(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 Dt(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)||Et(t)&&(r[e]=t);return r}function Ot(e){let t=e.trim();if(t)return t.split(/\s+/).filter(Boolean)}function kt(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 At(e){if(e.transport===`stdio`){let t={command:e.command.trim()},n=Ot(e.argsText);return n?.length&&(t.args=n),e.cwd.trim()&&(t.cwd=e.cwd.trim()),e.envJson.trim()&&(t.env=kt(e.envJson)),e.connectionTimeoutMs!=null&&Number.isFinite(e.connectionTimeoutMs)&&(t.connectionTimeoutMs=e.connectionTimeoutMs),t}let t={url:e.url.trim(),transport:e.transport},n=wt(e.headers);return n&&(t.headers=n),e.connectionTimeoutMs!=null&&Number.isFinite(e.connectionTimeoutMs)&&(t.connectionTimeoutMs=e.connectionTimeoutMs),t}function jt(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:Tt(a),connectionTimeoutMs:typeof t.connectionTimeoutMs==`number`&&Number.isFinite(t.connectionTimeoutMs)?t.connectionTimeoutMs:void 0}}function Mt(e=``){return{clientKey:crypto.randomUUID(),id:e,transport:`stdio`,command:``,argsText:``,envJson:``,cwd:``,url:``,headers:[{key:`Authorization`,value:``}],connectionTimeoutMs:void 0}}function Nt(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)||Et(t)?[]:[jt(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 Pt(e){return At(e)}async function Ft(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]=At(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 It(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 Lt(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 Rt(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(!n||typeof n!=`object`)continue;let e=n;if(typeof e.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 zt(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=It(n.payload.tools),i=Lt(n.payload.resources),a=Rt(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 Bt(e){return e.connectionTimeoutMs==null||!Number.isFinite(e.connectionTimeoutMs)?``:String(Math.round(e.connectionTimeoutMs/1e3))}function Vt(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 Ht(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 Ut({row:e,t,cs:n,onEdit:r,onRemove:i}){let[a,o]=(0,q.useState)(!1),[s,c]=(0,q.useState)(!1),[l,u]=(0,q.useState)(null),[d,f]=(0,q.useState)(null),p=Ht(e),m=(0,q.useCallback)(async()=>{o(!0),f(null);try{let t=await zt(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]),g=(0,q.useCallback)(async()=>{c(!0),f(null);try{await i()}catch(e){f(e instanceof Error?e.message:String(e)),c(!1)}},[i]);return(0,Y.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,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:e.id.trim()||t.cardUntitled}),(0,Y.jsx)(`span`,{className:`rounded-full bg-surface-base px-2 py-0.5 text-[11px] text-fg-muted`,children:n.customBadge}),(0,Y.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,Y.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,Y.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,Y.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,Y.jsxs)(`div`,{className:`mt-4 flex items-center justify-between gap-2 border-t border-edge pt-3`,onClick:e=>e.stopPropagation(),children:[(0,Y.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:n.connectorDetails}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsxs)(W,{variant:`secondary`,disabled:a,onClick:()=>void m(),children:[a?(0,Y.jsx)(h,{className:`size-4 animate-spin`}):(0,Y.jsx)(ve,{className:`size-4`}),t.testConnection]}),(0,Y.jsxs)(W,{variant:`ghost`,disabled:s,onClick:()=>void g(),children:[s?(0,Y.jsx)(h,{className:`size-4 animate-spin`}):(0,Y.jsx)(D,{className:`size-4`}),t.removeServer]})]})]})]})}function Wt(e,t){return e?t&&e.startsWith(t)?e.slice(t.length):e:``}function Gt(e,t,n){let r=t.trim().toLowerCase();if(!r)return!0;let i=e.shortName||Wt(e.name,n);return[e.name,i,e.description].filter(Boolean).join(`
|
|
2
|
-
`).toLowerCase().includes(r)}function Kt(e,t){return e?t&&e.startsWith(t)?e.slice(t.length):e:``}function qt(e){let t=(0,J.c)(29),{tools:n,stripPrefix:r,searchPlaceholder:i,searchEmptyLabel:o}=e,[s,c]=(0,q.useState)(``),l;if(t[0]!==s||t[1]!==r||t[2]!==n){let e;t[4]!==s||t[5]!==r?(e=e=>Gt(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,Y.jsx)(ue,{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`,le),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,Y.jsxs)(`div`,{className:`relative`,children:[p,(0,Y.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,Y.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,Y.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,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:u.length===0?(0,Y.jsx)(`p`,{className:`text-sm text-fg-muted`,children:o}):(0,Y.jsx)(`ul`,{className:`flex flex-col gap-2`,children:u.map((e,t)=>{let n=e.shortName||Kt(e.name,r)||e.name||`?`,i=e.name||`tool-${t}`;return(0,Y.jsxs)(`li`,{className:`min-w-0 rounded-lg border border-edge bg-surface-base px-3 py-2.5`,children:[(0,Y.jsx)(`div`,{className:`truncate font-mono text-sm font-medium text-fg`,title:e.name===n?n:e.name,children:n}),e.description?(0,Y.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,Y.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 Jt(e){let t=(0,J.c)(38),{open:n,onOpenChange:r,serverId:i,title:o,subtitle:s,searchPlaceholder:c,searchEmptyLabel:l,emptyLabel:u,closeLabel:d,tools:f,stripPrefix:p}=e,h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Y.jsx)(k,{className:a(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,R)}),t[0]=h):h=t[0];let g;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(g=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`,B,`rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none dark:border-edge`),t[1]=g):g=t[1];let _;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Y.jsx)(ee,{className:`size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[2]=_):_=t[2];let v;t[3]===o?v=t[4]:(v=(0,Y.jsxs)(y,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[_,o]}),t[3]=o,t[4]=v);let b;t[5]!==i||t[6]!==s||t[7]!==f.length?(b=s.replace(`{{serverId}}`,i).replace(`{{count}}`,String(f.length)),t[5]=i,t[6]=s,t[7]=f.length,t[8]=b):b=t[8];let x;t[9]===b?x=t[10]:(x=(0,Y.jsx)(E,{className:`mt-1 text-sm text-fg-muted`,children:b}),t[9]=b,t[10]=x);let S;t[11]!==v||t[12]!==x?(S=(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[v,x]}),t[11]=v,t[12]=x,t[13]=S):S=t[13];let C;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Y.jsx)(ye,{className:`size-4`,"aria-hidden":!0}),t[14]=C):C=t[14];let w;t[15]===d?w=t[16]:(w=(0,Y.jsx)(m,{asChild:!0,children:(0,Y.jsx)(W,{type:`button`,variant:`ghost`,className:`size-8 shrink-0 px-0`,"aria-label":d,children:C})}),t[15]=d,t[16]=w);let T;t[17]!==S||t[18]!==w?(T=(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[S,w]}),t[17]=S,t[18]=w,t[19]=T):T=t[19];let D;t[20]!==u||t[21]!==n||t[22]!==l||t[23]!==c||t[24]!==i||t[25]!==p||t[26]!==f?(D=f.length>0?(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,Y.jsx)(qt,{tools:f,stripPrefix:p,searchPlaceholder:c,searchEmptyLabel:l},`${i}-${n?`open`:`closed`}`)}):(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:(0,Y.jsx)(`p`,{className:`text-sm text-fg-muted`,children:u})}),t[20]=u,t[21]=n,t[22]=l,t[23]=c,t[24]=i,t[25]=p,t[26]=f,t[27]=D):D=t[27];let O;t[28]===d?O=t[29]:(O=(0,Y.jsx)(`div`,{className:`flex justify-end border-t border-edge px-5 py-3`,children:(0,Y.jsx)(m,{asChild:!0,children:(0,Y.jsx)(W,{type:`button`,variant:`secondary`,children:d})})}),t[28]=d,t[29]=O);let A;t[30]!==T||t[31]!==D||t[32]!==O?(A=(0,Y.jsxs)(j,{children:[h,(0,Y.jsxs)(ie,{className:g,children:[T,D,O]})]}),t[30]=T,t[31]=D,t[32]=O,t[33]=A):A=t[33];let M;return t[34]!==r||t[35]!==n||t[36]!==A?(M=(0,Y.jsx)(oe,{open:n,onOpenChange:r,children:A}),t[34]=r,t[35]=n,t[36]=A,t[37]=M):M=t[37],M}var Yt=a(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,le);function Xt(e){return e.materialized.type===`composio`?e.materialized.toolkit:null}function Zt(e,t){return e===`write`?t.composioScopeWrite:e===`admin`?t.composioScopeAdmin:t.composioScopeRead}function Qt(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 $t({instance:e,t,onChanged:n}){let r=Xt(e),[i,s]=(0,q.useState)([]),[c,l]=(0,q.useState)([]),[u,d]=(0,q.useState)([]),[f,p]=(0,q.useState)([]),[m,g]=(0,q.useState)(null),[_,v]=(0,q.useState)([]),[y,b]=(0,q.useState)(``),[S,C]=(0,q.useState)(`{}`),[T,E]=(0,q.useState)(null),[k,A]=(0,q.useState)(!1),[j,M]=(0,q.useState)(!0),[N,P]=(0,q.useState)(`15`),[F,I]=(0,q.useState)(null),[L,R]=(0,q.useState)(`read`),[z,B]=(0,q.useState)(!1),[V,H]=(0,q.useState)(null),U=(0,q.useCallback)(async()=>{if(!(!r||e.materialized.type!==`composio`||e.materialized.role===`credential`)){B(!0),H(null);try{let[t,n,i,a,o,c,u,f]=await Promise.all([Ke().catch(()=>[]),tt(r).catch(()=>[]),nt(20).catch(()=>[]),Ze(r).catch(()=>`read`),ct().catch(()=>[]),$e(r).catch(()=>null),Je(r).catch(()=>null),it(e.connectorId).catch(()=>null)]);s(t.filter(e=>e.toolkit.toLowerCase()===r.toLowerCase())),l(n),d(i.filter(e=>!e.toolkit||e.toolkit.toLowerCase()===r.toLowerCase())),R(a),p(o.filter(t=>t.connectorId===e.connectorId)),g(c?.policy??null),v(c?.agents??[]),b(f?.actionId??n.find(e=>e.scope===`read`&&e.curated)?.slug??``),C(f?JSON.stringify(f.arguments):`{}`),A(f?.enabled??!1),M(f?.triggerSync??!0),P(String(f?.intervalMinutes??15)),I(u)}catch(e){H(e instanceof Error?e.message:String(e))}finally{B(!1)}}},[e.connectorId,e.materialized,r]);(0,q.useEffect)(()=>{U()},[U]);let ee=(0,q.useCallback)(async()=>{if(r){B(!0),H(null);try{let t=await Re(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){H(e instanceof Error?e.message:String(e))}finally{B(!1)}}},[e.connectorId,r]),te=(0,q.useCallback)(async e=>{if(r){R(e);try{await Qe(r,e),await U()}catch(e){H(e instanceof Error?e.message:String(e))}}},[U,r]),ne=(0,q.useCallback)(async(e,t)=>{B(!0),H(null);try{await lt(e,t),await U()}catch(e){H(e instanceof Error?e.message:String(e))}finally{B(!1)}},[U]),re=(0,q.useCallback)(async e=>{if(r){H(null);try{g(await et(r,e))}catch(e){H(e instanceof Error?e.message:String(e))}}},[e.connectorId,r]),ie=(0,q.useCallback)(e=>{m&&re({allowedAgentIds:m.allowedAgentIds.includes(e)?m.allowedAgentIds.filter(t=>t!==e):[...m.allowedAgentIds,e]})},[re,m]),ae=(0,q.useCallback)(async e=>{B(!0),H(null);try{await e(),await U()}catch(e){H(e instanceof Error?e.message:String(e))}finally{B(!1)}},[U]),oe=(0,q.useCallback)(async()=>{if(!(!r||!y)){B(!0),H(null),E(null);try{let r=JSON.parse(S);if(!r||typeof r!=`object`||Array.isArray(r))throw Error(t.composioMemoryArgumentsObject);let a=m?.allowedAgentIds[0]??_[0]?.id;if(!a)throw Error(t.composioMemoryAgentMissing);E((await rt({connectorId:e.connectorId,actionId:y,agentId:a,connectionId:i.find(e=>e.isDefault)?.id,arguments:r})).recordId),await n?.()}catch(e){H(e instanceof Error?e.message:String(e))}finally{B(!1)}}},[_,i,e.connectorId,y,S,n,m,t,r]),ce=(0,q.useCallback)(async()=>{if(!(!r||!y)){B(!0),H(null);try{let r=JSON.parse(S);if(!r||typeof r!=`object`||Array.isArray(r))throw Error(t.composioMemoryArgumentsObject);let a=m?.allowedAgentIds[0]??_[0]?.id;if(!a)throw Error(t.composioMemoryAgentMissing);let o=await at(e.connectorId,{enabled:k,actionId:y,arguments:r,agentId:a,connectionId:i.find(e=>e.isDefault)?.id,intervalMinutes:Number(N),triggerSync:j});P(String(o.intervalMinutes)),await n?.()}catch(e){H(e instanceof Error?e.message:String(e))}finally{B(!1)}}},[_,i,e.connectorId,y,S,k,N,j,n,m,t,r]);return r?e.materialized.type===`composio`&&e.materialized.role===`credential`?(0,Y.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,children:t.composioApiKeyStored}):(0,Y.jsxs)(`div`,{className:`mt-4 rounded-xl border border-edge bg-surface-base p-3 text-sm`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`font-medium text-fg`,children:$(t.composioToolkitTitle,{toolkit:r})}),(0,Y.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:t.composioScopeHint})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Y.jsxs)(W,{variant:`secondary`,disabled:z,onClick:()=>void ee(),children:[z?(0,Y.jsx)(h,{className:`size-4 animate-spin`}):(0,Y.jsx)(me,{className:`size-4`}),t.connectOAuth]}),(0,Y.jsx)(W,{variant:`ghost`,disabled:z,onClick:()=>void U(),children:t.refresh})]})]}),V?(0,Y.jsx)(`p`,{className:`mt-3 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:V}):null,F?(0,Y.jsxs)(`div`,{className:a(`mt-3 flex flex-wrap items-center justify-between gap-2 rounded-lg border px-3 py-2 text-xs`,F.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,Y.jsx)(`span`,{children:F.status===`connected`?$(t.composioHealthConnected,{count:String(F.activeConnections)}):F.status===`reauthorization_required`?t.composioHealthReconnect:F.status===`degraded`?Qt(F,t):t.composioHealthDisconnected}),F.recovery===`none`?null:(0,Y.jsx)(W,{variant:`ghost`,disabled:z,onClick:()=>void(F.recovery===`retry`?U():ee()),children:F.recovery===`retry`?t.composioRetry:t.connectOAuth}),F.status===`degraded`&&F.message?(0,Y.jsx)(`p`,{className:`basis-full break-words text-[11px] opacity-80`,children:F.message}):null]}):null,m?(0,Y.jsxs)(`div`,{className:`mt-4 grid gap-3 rounded-lg border border-edge bg-surface-panel p-3 md:grid-cols-3`,children:[(0,Y.jsxs)(`label`,{className:`text-xs font-medium text-fg-subtle`,children:[t.composioAccessTitle,(0,Y.jsxs)(x,{className:a(Yt,`mt-1 h-9 py-1`),value:L,onChange:e=>void te(e.currentTarget.value),children:[(0,Y.jsx)(G,{value:`read`,children:t.composioAccessReadOnly}),(0,Y.jsx)(G,{value:`write`,children:t.composioAccessReadWrite}),L===`admin`?(0,Y.jsx)(G,{value:`admin`,children:t.composioAccessAdminCurrent}):null]}),(0,Y.jsx)(`span`,{className:`mt-1 block font-normal leading-4 text-fg-muted`,children:L===`read`?t.composioAccessReadHint:L===`admin`?t.composioAccessAdminHint:t.composioAccessWriteHint})]}),(0,Y.jsxs)(`label`,{className:`text-xs font-medium text-fg-subtle`,children:[t.composioConfirmationPolicy,(0,Y.jsxs)(x,{className:a(Yt,`mt-1 h-9 py-1`),value:m.confirmationPolicy,onChange:e=>void re({confirmationPolicy:e.currentTarget.value}),children:[(0,Y.jsx)(G,{value:`writes`,children:t.composioConfirmWrites}),(0,Y.jsx)(G,{value:`always`,children:t.composioConfirmAlways}),m.confirmationPolicy===`never`?(0,Y.jsx)(G,{value:`never`,children:t.composioConfirmNever}):null]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-xs font-medium text-fg-subtle`,children:t.composioAllowedAgents}),(0,Y.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:m.allowedAgentIds.length?t.composioAllowedAgentsSelected:t.composioAllowedAgentsAll}),(0,Y.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:_.map(e=>(0,Y.jsx)(`button`,{type:`button`,className:a(`rounded-full border px-2.5 py-1 text-xs transition-colors`,m.allowedAgentIds.includes(e.id)?`border-accent bg-accent/10 text-accent`:`border-edge text-fg-muted hover:text-fg`),onClick:()=>ie(e.id),children:e.name},e.id))})]})]}):null,[`gmail`,`googlecalendar`,`googledrive`,`googledocs`,`googlesheets`,`notion`,`slack`,`github`,`linear`,`jira`,`outlook`,`microsoft_teams`,`one_drive`,`excel`].includes(r)&&c.some(e=>e.scope===`read`&&e.curated)?(0,Y.jsxs)(`div`,{className:`mt-4 rounded-lg border border-edge bg-surface-panel p-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,Y.jsx)(O,{className:`mt-0.5 size-4 text-accent`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.composioMemorySync}),(0,Y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.composioMemorySyncHint})]})]}),(0,Y.jsx)(`div`,{className:`mt-3 flex flex-wrap items-center gap-3`,children:(0,Y.jsxs)(W,{disabled:z||!y,onClick:()=>void oe(),children:[z?(0,Y.jsx)(h,{className:`size-4 animate-spin`}):(0,Y.jsx)(O,{className:`size-4`}),t.composioSyncNow]})}),T?(0,Y.jsx)(`p`,{className:`mt-2 text-xs text-emerald-600`,children:t.composioMemorySyncedSimple}):null,(0,Y.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-end gap-3 border-t border-edge-subtle pt-3`,children:[(0,Y.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:k,onChange:e=>A(e.currentTarget.checked)}),t.composioMemoryAutoSync]}),(0,Y.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:j,onChange:e=>M(e.currentTarget.checked)}),t.composioMemoryTriggerSync]}),(0,Y.jsxs)(W,{variant:`secondary`,disabled:z||!y,onClick:()=>void ce(),children:[z?(0,Y.jsx)(h,{className:`size-4 animate-spin`}):(0,Y.jsx)(O,{className:`size-4`}),t.composioMemorySaveSchedule]})]})]}):null,f.length?(0,Y.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,Y.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:t.composioPendingApprovals}),f.map(e=>(0,Y.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,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`p`,{className:`truncate font-mono text-xs font-medium text-fg`,children:e.actionId}),(0,Y.jsx)(`p`,{className:`mt-1 break-all font-mono text-xs text-fg-subtle`,children:JSON.stringify(e.argumentsPreview)}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:$(t.composioApprovalExpires,{time:new Date(e.expiresAt).toLocaleTimeString()})})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[(0,Y.jsxs)(W,{variant:`secondary`,disabled:z,onClick:()=>void ne(e.id,`denied`),children:[(0,Y.jsx)(ye,{className:`size-4`}),t.composioDeny]}),(0,Y.jsxs)(W,{disabled:z,onClick:()=>void ne(e.id,`approved`),children:[(0,Y.jsx)(o,{className:`size-4`}),t.approve]})]})]},e.id))]}):null,(0,Y.jsx)(`div`,{className:`mt-4`,children:(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:t.composioConnections}),i.length?i.map(e=>(0,Y.jsxs)(`div`,{className:`space-y-2 rounded-lg border border-edge bg-surface-panel p-2`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`truncate font-mono text-xs text-fg`,children:e.accountEmail??e.username??e.workspace??e.providerConnectionId}),(0,Y.jsxs)(`p`,{className:`text-xs text-fg-subtle`,children:[e.status,e.isDefault?` · ${t.composioDefaultAccount}`:``]})]}),(0,Y.jsx)(`input`,{className:a(Yt,`h-8 py-1 text-xs`),defaultValue:e.alias??``,placeholder:t.composioAccountAlias,onBlur:t=>{t.currentTarget.value!==(e.alias??``)&&ae(()=>qe(e.id,{alias:t.currentTarget.value}))}}),(0,Y.jsxs)(`div`,{className:`flex gap-1`,children:[(0,Y.jsx)(W,{variant:`ghost`,className:`size-8 p-0`,title:t.composioMakeDefault,disabled:z||e.isDefault,onClick:()=>void ae(async()=>{await qe(e.id,{isDefault:!0}),r&&await et(r,{selectedConnectionIds:[e.id]})}),children:(0,Y.jsx)(w,{className:a(`size-4`,e.isDefault&&`fill-current`)})}),(0,Y.jsx)(W,{variant:`ghost`,className:`size-8 p-0`,title:t.refresh,disabled:z,onClick:()=>void ae(()=>Ye(e.id)),children:(0,Y.jsx)(se,{className:`size-4`})}),(0,Y.jsx)(W,{variant:`ghost`,className:`size-8 p-0`,title:t.composioRevoke,disabled:z,onClick:()=>{window.confirm(t.composioRevokeConfirm)&&ae(()=>Xe(e.id))},children:(0,Y.jsx)(D,{className:`size-4 text-red-500`})})]})]},e.id)):(0,Y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.composioConnectionsEmpty})]})}),(0,Y.jsxs)(`details`,{className:`mt-4 rounded-lg border border-edge bg-surface-panel p-3`,children:[(0,Y.jsx)(`summary`,{className:`cursor-pointer text-xs font-medium text-fg-muted`,children:t.composioAdvancedSettings}),(0,Y.jsxs)(`div`,{className:`mt-4 grid gap-4 lg:grid-cols-2`,children:[(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsxs)(`label`,{className:`block text-xs text-fg-subtle`,children:[t.composioAdvancedScope,(0,Y.jsxs)(x,{className:a(Yt,`mt-1 h-9 py-1`),value:L,onChange:e=>void te(e.currentTarget.value),children:[(0,Y.jsx)(G,{value:`read`,children:t.composioScopeRead}),(0,Y.jsx)(G,{value:`write`,children:t.composioScopeWrite}),(0,Y.jsx)(G,{value:`admin`,children:t.composioScopeAdmin})]})]}),(0,Y.jsxs)(`label`,{className:`block text-xs text-fg-subtle`,children:[t.composioMemoryReadAction,(0,Y.jsx)(x,{className:a(Yt,`mt-1 h-9 py-1`),value:y,onChange:e=>b(e.currentTarget.value),children:c.filter(e=>e.scope===`read`&&e.curated).map(e=>(0,Y.jsx)(G,{value:e.slug,children:e.name??e.slug},e.slug))})]}),(0,Y.jsxs)(`label`,{className:`block text-xs text-fg-subtle`,children:[t.composioMemoryArguments,(0,Y.jsx)(`input`,{className:a(Yt,`mt-1 h-9 py-1 font-mono text-xs`),value:S,onChange:e=>C(e.currentTarget.value)})]}),(0,Y.jsxs)(`label`,{className:`block text-xs text-fg-subtle`,children:[t.composioMemoryInterval,(0,Y.jsx)(`input`,{type:`number`,min:5,max:1440,className:a(Yt,`mt-1 h-9 w-28 py-1`),value:N,onChange:e=>P(e.currentTarget.value)})]})]}),(0,Y.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:t.composioAgentTools}),c.length?c.slice(0,8).map(e=>(0,Y.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base p-2`,children:[(0,Y.jsx)(`p`,{className:`truncate font-mono text-xs text-fg`,children:e.slug}),(0,Y.jsxs)(`p`,{className:`text-xs text-fg-subtle`,children:[Zt(e.scope,t),e.curated?``:` ${t.composioUncuratedSuffix}`]})]},e.slug)):(0,Y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.composioToolsEmpty})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:t.composioRecentTriggers}),u.length?u.slice(0,5).map(e=>(0,Y.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base p-2`,children:[(0,Y.jsx)(`p`,{className:`truncate text-xs text-fg`,children:e.trigger??e.id}),(0,Y.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:new Date(e.at).toLocaleString()})]},`${e.id}-${e.at}`)):(0,Y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.composioTriggersEmpty})]})]})]})]})]}):null}var en=a(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,le);function tn(e,t){return e?t.healthStatusLabels[e]??e:t.healthNotTested}function nn(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 rn(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 an(e){let t=(0,J.c)(12),{title:n,description:r,meta:i}=e,o;t[0]===r?o=t[1]:(o=r?(0,Y.jsx)(P,{delayDuration:300,skipDelayDuration:100,children:(0,Y.jsxs)(I,{children:[(0,Y.jsx)(b,{asChild:!0,children:(0,Y.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,Y.jsx)(S,{children:(0,Y.jsx)(F,{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,Y.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,Y.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,Y.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,Y.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,Y.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 on({instance:e,definition:t,onClose:n,onChanged:r,t:i,mcp:o}){let[s,c]=(0,q.useState)(!1),[l,u]=(0,q.useState)(!1),[d,f]=(0,q.useState)(!1),[p,g]=(0,q.useState)(!1),[v,b]=(0,q.useState)(null),[x,S]=(0,q.useState)(null),[C,w]=(0,q.useState)(e.materialized.type===`mcp`?`health`:`permissions`),[T,A]=(0,q.useState)(!1),[M,N]=(0,q.useState)(()=>nn(t,e)),[P,F]=(0,q.useState)(null),I=t?.setup.config??[],L=(e.materialized.type===`mcp`||e.materialized.type===`memorySource`)&&I.length>0&&(t?.setup.secrets??[]).length===0,R=x?x.toolCount:e.usage.lastToolCount,B=(0,q.useMemo)(()=>{let t=e.materialized.type===`mcp`?[[`health`,z,i.detailHealth],[`tools`,ee,`${i.detailTools} ${x?x.toolCount:e.usage.lastToolCount??``}`],[`resources`,O,`${i.detailResources} ${x?x.resourceCount:e.usage.lastResourceCount??``}`],[`prompts`,_,`${i.detailPrompts} ${x?x.promptCount:e.usage.lastPromptCount??``}`],[`permissions`,me,i.detailPermissions]]:[[`permissions`,me,i.detailPermissions]];return L?[...t,[`config`,O,i.connectorConfigLabel]]:t},[x,e.materialized.type,e.usage.lastPromptCount,e.usage.lastResourceCount,e.usage.lastToolCount,L,i]),V=(0,q.useCallback)(async()=>{c(!0),F(null);try{let t=await Ge(e.instanceId);S(t),t.toolCount>0&&w(`tools`),r()}catch(e){F(e instanceof Error?e.message:String(e))}finally{c(!1)}},[e.instanceId,r]),H=(0,q.useCallback)(async()=>{u(!0),F(null);try{await We(e.instanceId),await r(),n()}catch(e){F(e instanceof Error?e.message:String(e)),u(!1)}},[e.instanceId,r,n]),te=(0,q.useCallback)(async()=>{if(!(!t||!L)){f(!0),F(null);try{let n={};for(let e of t.setup.config??[]){let t=rn(e.type,M[e.key]??``);t!==void 0&&(n[e.key]=t)}await Ue(e.instanceId,{config:n}),await r(),w(`health`)}catch(e){F(e instanceof Error?e.message:String(e))}finally{f(!1)}}},[M,t,e.instanceId,r,L]),ne=(0,q.useCallback)(async()=>{g(!0),b(null),F(null);try{b((await ot(e.connectorId)).recordIds.length),await r()}catch(e){F(e instanceof Error?e.message:String(e))}finally{g(!1)}},[e.connectorId,r]);return(0,Y.jsxs)(oe,{open:!0,onOpenChange:e=>{e||n()},children:[(0,Y.jsxs)(j,{children:[(0,Y.jsx)(k,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,Y.jsxs)(ie,{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,Y.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-6 py-5`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Y.jsx)(K,{connector:t,size:`lg`}),(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(y,{className:`text-base font-semibold text-fg`,children:e.displayName}),(0,Y.jsx)(E,{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,Y.jsx)(m,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,className:a(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,ce.focusRingPanel),"aria-label":i.modalClose,children:[(0,Y.jsx)(ye,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`sr-only`,children:i.modalClose})]})})]}),(0,Y.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-5`,children:[P?(0,Y.jsx)(`p`,{className:`mb-4 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:P}):null,(0,Y.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:B.map(([e,t,n])=>(0,Y.jsxs)(`button`,{type:`button`,className:a(`inline-flex h-8 items-center gap-1.5 rounded-md border px-2.5 text-xs`,C===e?`border-accent bg-accent-soft text-accent-fg`:`border-edge bg-surface-base text-fg-muted hover:text-fg`),onClick:()=>w(e),children:[(0,Y.jsx)(t,{className:`size-3.5`,"aria-hidden":!0}),n]},e))}),(0,Y.jsxs)(`div`,{className:`mt-4 rounded-xl border border-edge bg-surface-base p-3 text-sm`,children:[C===`health`?(0,Y.jsxs)(`div`,{className:`space-y-1 text-fg-muted`,children:[(0,Y.jsxs)(`p`,{children:[i.statusLabel,` `,(0,Y.jsx)(`span`,{className:x?.ok?`font-medium text-emerald-700 dark:text-emerald-300`:`font-medium text-fg`,children:tn(x?.status??e.usage.lastHealthStatus,i)})]}),(0,Y.jsxs)(`p`,{children:[i.lastCheckLabel,` `,e.usage.lastHealthCheckAt?new Date(e.usage.lastHealthCheckAt).toLocaleString():i.never]}),x?.action?(0,Y.jsx)(`p`,{children:x.action}):null]}):null,C===`tools`?x?.tools.length?(0,Y.jsxs)(`div`,{className:`grid gap-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:$(i.toolsAvailable,{count:String(x.tools.length)})}),(0,Y.jsx)(W,{type:`button`,variant:`ghost`,className:`h-7 text-xs`,onClick:()=>A(!0),children:o.viewAllTools})]}),(0,Y.jsx)(`div`,{className:`grid gap-2`,children:x.tools.slice(0,8).map(e=>(0,Y.jsx)(an,{title:e.shortName??e.name,description:e.description},e.name))})]}):(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Y.jsx)(`p`,{className:`text-fg-muted`,children:R?$(i.toolsLastCheckSummary,{count:String(R)}):i.toolsRunTestHint}),(0,Y.jsxs)(W,{type:`button`,variant:`secondary`,disabled:s,onClick:()=>void V(),children:[s?(0,Y.jsx)(h,{className:`size-4 animate-spin`}):(0,Y.jsx)(ve,{className:`size-4`}),i.test]})]}):null,C===`resources`?x?.resources.length?(0,Y.jsx)(`div`,{className:`grid gap-2`,children:x.resources.slice(0,8).map(e=>(0,Y.jsx)(an,{title:e.title??e.name,description:e.uri,meta:e.mimeType},e.uri))}):(0,Y.jsx)(`p`,{className:`text-fg-muted`,children:i.resourcesRunTestHint}):null,C===`prompts`?x?.prompts.length?(0,Y.jsx)(`div`,{className:`grid gap-2`,children:x.prompts.slice(0,8).map(e=>(0,Y.jsx)(an,{title:e.title??e.name,description:e.description,meta:e.argumentCount?$(i.promptArgumentCount,{count:String(e.argumentCount)}):void 0},e.name))}):(0,Y.jsx)(`p`,{className:`text-fg-muted`,children:i.promptsRunTestHint}):null,C===`permissions`?(0,Y.jsxs)(`div`,{className:`space-y-1 text-fg-muted`,children:[(0,Y.jsx)(`p`,{children:$(i.secretsConfigured,{count:String(Object.values(e.secretStatus).filter(Boolean).length)})}),(0,Y.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,Y.jsx)(`p`,{children:e.materialized.type===`mcp`?i.mcpPolicyHint:i.connectorPolicyHint})]}):null,C===`config`&&L?(0,Y.jsx)(`div`,{className:`grid gap-3`,children:I.map(e=>(0,Y.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.label}),e.description?(0,Y.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:e.description}):null,(0,Y.jsx)(`input`,{className:en,value:M[e.key]??``,placeholder:e.placeholder,onChange:t=>N(n=>({...n,[e.key]:t.currentTarget.value}))})]},e.key))}):null]}),e.materialized.type===`composio`?(0,Y.jsx)($t,{instance:e,t:i,onChanged:r}):null,e.materialized.type===`memorySource`?(0,Y.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-between gap-3 rounded-xl border border-edge bg-surface-base p-3 text-sm`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`font-medium text-fg`,children:i.memorySourceSync}),(0,Y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t?.description}),v===null?null:(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-emerald-600`,children:$(i.memorySourceSynced,{count:String(v)})})]}),(0,Y.jsxs)(W,{disabled:p,onClick:()=>void ne(),children:[p?(0,Y.jsx)(h,{className:`size-4 animate-spin`}):(0,Y.jsx)(O,{className:`size-4`}),i.composioSyncNow]})]}):null]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-2 border-t border-edge-subtle px-6 py-4`,children:[(0,Y.jsx)(W,{variant:`secondary`,onClick:n,children:i.modalClose}),C===`config`&&L?(0,Y.jsxs)(W,{variant:`primary`,disabled:d,onClick:()=>void te(),children:[d?(0,Y.jsx)(h,{className:`size-4 animate-spin`}):(0,Y.jsx)(U,{className:`size-4`}),i.modalSave]}):null,e.materialized.type===`mcp`?(0,Y.jsxs)(W,{variant:`secondary`,disabled:s,onClick:()=>void V(),children:[s?(0,Y.jsx)(h,{className:`size-4 animate-spin`}):(0,Y.jsx)(ve,{className:`size-4`}),i.test]}):null,(0,Y.jsxs)(W,{variant:`ghost`,disabled:l,onClick:()=>void H(),children:[l?(0,Y.jsx)(h,{className:`size-4 animate-spin`}):(0,Y.jsx)(D,{className:`size-4`}),i.remove]})]})]})]}),e.materialized.type===`mcp`?(0,Y.jsx)(Jt,{open:T,onOpenChange:A,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:x?.tools??[],stripPrefix:`${e.materialized.serverId}__`}):null]})}function sn({instance:e,definition:t,highlighted:n=!1,onOpenDetails:r,onChanged:i,t:o}){let[s,c]=(0,q.useState)(!1),[l,u]=(0,q.useState)(!1),[d,f]=(0,q.useState)(null),p=(0,q.useCallback)(async()=>{c(!0),f(null);try{await Ge(e.instanceId),await i()}catch(e){f(e instanceof Error?e.message:String(e))}finally{c(!1)}},[e.instanceId,i]),m=(0,q.useCallback)(async()=>{u(!0),f(null);try{await We(e.instanceId),await i()}catch(e){f(e instanceof Error?e.message:String(e)),u(!1)}},[e.instanceId,i]),g=e.usage.lastHealthStatus?o.healthStatusLabels[e.usage.lastHealthStatus]??e.usage.lastHealthStatus:o.healthNotTested,_=e.usage.lastToolCount??0,v=!!(t?.setup.config?.length&&!t.setup.secrets?.length&&e.materialized.type===`mcp`);return(0,Y.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,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start gap-3`,children:[(0,Y.jsx)(K,{connector:t}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:e.displayName}),(0,Y.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,Y.jsx)(V,{className:`size-3`,"aria-hidden":!0}),o.connectedBadge]}),v?(0,Y.jsx)(`span`,{className:`rounded-full bg-surface-base px-2 py-0.5 text-[11px] text-fg-muted`,children:o.connectorConfigLabel}):null]}),(0,Y.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,Y.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 text-xs text-fg-muted`,children:[(0,Y.jsxs)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:[o.statusLabel,` `,g]}),(0,Y.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:$(o.toolsAvailable,{count:String(_)})})]}),d?(0,Y.jsx)(`p`,{className:`mt-3 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:d}):null]})]}),(0,Y.jsxs)(`div`,{className:`mt-4 flex items-center justify-between gap-2 border-t border-edge pt-3`,onClick:e=>e.stopPropagation(),children:[(0,Y.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:o.connectorDetails}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[e.materialized.type===`mcp`?(0,Y.jsxs)(W,{variant:`secondary`,disabled:s,onClick:()=>void p(),children:[s?(0,Y.jsx)(h,{className:`size-4 animate-spin`}):(0,Y.jsx)(ve,{className:`size-4`}),o.test]}):null,(0,Y.jsxs)(W,{variant:`ghost`,disabled:l,onClick:()=>void m(),children:[l?(0,Y.jsx)(h,{className:`size-4 animate-spin`}):(0,Y.jsx)(D,{className:`size-4`}),o.remove]})]})]})]})}var cn=a(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,le),ln=a(cn,`min-h-28 font-mono`);function un(e,t){return e?t.healthStatusLabels[e]??e:t.healthStatusPending}function dn(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 fn(e){let t=(0,J.c)(12),{title:n,items:r}=e;if(r.length===0)return null;let i;t[0]===n?i=t[1]:(i=(0,Y.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(pn),t[2]=r,t[3]=a);let o;t[4]===r.length?o=t[5]:(o=r.length>12?(0,Y.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,Y.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,Y.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 pn(e){return(0,Y.jsxs)(`div`,{className:`border-b border-edge-subtle px-3 py-2 last:border-b-0`,children:[(0,Y.jsx)(`div`,{className:`break-words font-mono text-xs font-medium text-fg`,children:e.title}),e.description?(0,Y.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description}):null]},e.id)}function mn({draft:e,onChange:t,onClose:n,onInstalled:r,t:i}){let{connector:o}=e,s=o.runtime.type===`composio`&&o.runtime.role===`toolkit`,c=o.runtime.type===`composio`&&o.runtime.role===`toolkit`?o.runtime.toolkit:null,[l,u]=(0,q.useState)(!s),[d,f]=(0,q.useState)(s),[p,g]=(0,q.useState)(``),[_,v]=(0,q.useState)(null);(0,q.useEffect)(()=>{if(!s)return;let e=!1;return ze().then(({configured:t})=>{e||u(t)}).catch(t=>{e||v(t instanceof Error?t.message:String(t))}).finally(()=>{e||f(!1)}),()=>{e=!0}},[o.id,s]);let b=e.result?`complete`:e.installing?`health`:`configure`,x=[{id:`configure`,label:i.connectStepConfigure},{id:`health`,label:i.connectStepVerify},{id:`complete`,label:i.connectStepReady}],S=(0,q.useCallback)(async()=>{let n=s?window.open(``,`_blank`):null;n&&(n.opener=null),v(null),t({...e,installing:!0,error:null,result:null,health:null});try{s&&!l&&(await Be(p),u(!0));let i={};for(let t of o.setup.config??[]){let n=dn(t.type,e.config[t.key]??``);n!==void 0&&(i[t.key]=n)}let a=e.store?await Me(e.store.packageName,{secrets:e.secrets,config:i},e.store.version):await Ve(o.id,{secrets:e.secrets,config:i,definition:o.source===`registry`?o:void 0}),d=null;try{if(s)if((c?await Je(c).catch(()=>null):null)?.status===`connected`)n?.close();else{let e=await Re(o.id);if(!e.authorizationUrl)throw Error(`The connection service did not return an authorization URL.`);n?n.location.href=e.authorizationUrl:window.open(e.authorizationUrl,`_blank`,`noopener,noreferrer`)}}catch(i){n?.close(),t({...e,installing:!1,result:a,health:null,error:i instanceof Error?i.message:String(i)}),await r(a);return}if(!s)try{d=await Ge(a.instanceId)}catch{d=null}t({...e,installing:!1,result:a,health:d}),await r(a)}catch(r){n?.close(),t({...e,installing:!1,error:r instanceof Error?r.message:String(r)})}},[p,l,c,o,e,s,t,r]);return(0,Y.jsx)(oe,{open:!0,onOpenChange:e=>{e||n()},children:(0,Y.jsxs)(j,{children:[(0,Y.jsx)(k,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,Y.jsxs)(ie,{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,Y.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-6 py-5`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Y.jsx)(K,{connector:o,size:`lg`}),(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(y,{className:`text-base font-semibold text-fg`,children:$(i.connectDialogTitle,{name:o.displayName})}),(0,Y.jsx)(E,{className:`mt-1 line-clamp-3 text-sm text-fg-muted`,children:o.description})]})]}),(0,Y.jsx)(m,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,className:a(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,ce.focusRingPanel),"aria-label":i.modalClose,children:[(0,Y.jsx)(ye,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`sr-only`,children:i.modalClose})]})})]}),(0,Y.jsxs)(`div`,{className:`min-h-0 overflow-y-auto px-6 py-5`,children:[(0,Y.jsx)(`div`,{className:`mb-5 grid grid-cols-3 gap-2`,"aria-label":i.connectProgressAria,children:x.map((e,t)=>{let n=x.findIndex(e=>e.id===b);return(0,Y.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,Y.jsxs)(`span`,{className:`mr-1 tabular-nums`,children:[t+1,`.`]}),e.label]},e.id)})}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[o.integrationStrategy?(0,Y.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,s&&!l?(0,Y.jsxs)(`section`,{className:`rounded-2xl border border-accent/25 bg-accent-soft/50 p-4`,children:[(0,Y.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i.composioSetupTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:i.composioSetupHint}),(0,Y.jsxs)(`ol`,{className:`mt-3 list-inside list-decimal space-y-1 text-xs text-fg-muted`,children:[(0,Y.jsx)(`li`,{children:i.composioSetupStepProject}),(0,Y.jsx)(`li`,{children:i.composioSetupStepKey}),(0,Y.jsx)(`li`,{children:i.composioSetupStepPaste})]}),(0,Y.jsxs)(`a`,{className:`mt-3 inline-flex items-center gap-1 text-xs font-medium text-accent-fg hover:underline`,href:`https://app.composio.dev`,target:`_blank`,rel:`noreferrer`,children:[i.composioSetupOpenDashboard,(0,Y.jsx)(ae,{className:`size-3.5`,"aria-hidden":!0})]}),(0,Y.jsx)(de,{className:`mt-3`,value:p,onChange:g,labels:i.secretInputLabels,placeholder:i.composioSetupKeyPlaceholder}),(0,Y.jsx)(`p`,{className:`mt-2 text-[11px] text-fg-subtle`,children:i.composioSetupStorageHint})]}):null,e.store?(0,Y.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,Y.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i.detailPermissions}),(0,Y.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,children:[(e.store.permissions.data??[]).map(e=>(0,Y.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,Y.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-panel px-2 py-1 text-xs text-fg-muted`,children:e},e)),(0,Y.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,Y.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.label}),n.description?(0,Y.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:n.description}):null,(0,Y.jsx)(de,{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,Y.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.label}),n.type===`json`?(0,Y.jsx)(`textarea`,{className:ln,value:e.config[n.key]??``,placeholder:n.placeholder,onChange:r=>t({...e,config:{...e.config,[n.key]:r.currentTarget.value},error:null})}):(0,Y.jsx)(`input`,{className:cn,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,Y.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4 text-sm text-fg-muted`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 font-medium text-fg`,children:[(0,Y.jsx)(h,{className:`size-4 animate-spin text-accent`,"aria-hidden":!0}),i.connectingTitle]}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:i.connectingHint})]}):null,e.error?(0,Y.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:e.error}):null,_?(0,Y.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:_}):null,e.result?(0,Y.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4 text-sm text-fg-muted`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`font-medium text-fg`,children:$(i.connectedAs,{target:e.result.materialized.type===`mcp`?e.result.materialized.serverId:e.result.instanceId})}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:$(i.runtimeLabel,{runtime:e.result.materialized.type.toUpperCase()})})]}),(0,Y.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:un(e.health?.status,i)})]}),e.health?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`mt-3 grid gap-2 text-xs sm:grid-cols-3`,children:[(0,Y.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2`,children:[(0,Y.jsx)(`div`,{className:`font-semibold text-fg`,children:e.health.toolCount}),(0,Y.jsx)(`div`,{children:i.toolsMetric})]}),(0,Y.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2`,children:[(0,Y.jsx)(`div`,{className:`font-semibold text-fg`,children:e.health.resourceCount}),(0,Y.jsx)(`div`,{children:i.resourcesMetric})]}),(0,Y.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2`,children:[(0,Y.jsx)(`div`,{className:`font-semibold text-fg`,children:e.health.promptCount}),(0,Y.jsx)(`div`,{children:i.promptsMetric})]})]}),(0,Y.jsxs)(`div`,{className:`mt-3 grid gap-2`,children:[(0,Y.jsx)(fn,{title:i.detailTools,items:e.health.tools.map(e=>({id:e.name,title:e.shortName??e.name,description:e.description}))}),(0,Y.jsx)(fn,{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,Y.jsx)(fn,{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,Y.jsx)(`p`,{className:`mt-3`,children:i.installedWithoutHealth}),e.health?.action?(0,Y.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:e.health.action}):null]}):null]})]}),(0,Y.jsx)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle px-6 py-4`,children:(0,Y.jsxs)(W,{variant:`primary`,disabled:!!e.result||e.installing||d||s&&!l&&!p.trim(),onClick:()=>void S(),children:[e.installing?(0,Y.jsx)(h,{className:`size-4 animate-spin`}):e.result?(0,Y.jsx)(V,{className:`size-4`}):(0,Y.jsx)(A,{className:`size-4`}),e.result?i.connectedBadge:i.connect]})})]})]})})}function hn(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 gn(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 Mt(r)}function _n(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 vn(){return a(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,le)}function yn({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=Ct(e);if(!t?.length){window.alert(o);return}d(t)}catch{window.alert(o)}};return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2 md:col-span-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm font-medium text-fg`,children:[(0,Y.jsx)(`span`,{children:e}),t?(0,Y.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:t}):null]}),(0,Y.jsxs)(W,{type:`button`,variant:`ghost`,className:`h-8 gap-1.5 px-2 text-xs`,onClick:()=>void h(),children:[(0,Y.jsx)(C,{className:`size-3.5`,"aria-hidden":!0}),i]})]}),(0,Y.jsx)(`div`,{className:`flex flex-col gap-2`,children:u.map((e,t)=>(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`input`,{className:a(vn(),`min-w-0 flex-1 font-mono text-xs`),value:e.key,placeholder:c,onChange:e=>f(t,{key:e.target.value})}),(0,Y.jsx)(`input`,{className:a(vn(),`min-w-0 flex-[1.4] font-mono text-xs`),value:e.value,placeholder:l,onChange:e=>f(t,{value:e.target.value})}),(0,Y.jsx)(W,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 px-0`,disabled:u.length<=1&&!e.key&&!e.value,onClick:()=>m(t),"aria-label":r,children:(0,Y.jsx)(D,{className:`size-4 text-fg-subtle`,"aria-hidden":!0})})]},_n(e,t,u)))}),(0,Y.jsxs)(`button`,{type:`button`,className:a(`self-start text-sm text-accent hover:underline`,ce.press),onClick:p,children:[`+ `,n]})]})}var bn=[`stdio`,`sse`,`streamable-http`];function xn(e){let t=(0,J.c)(11),{label:n,description:r,required:i,children:a}=e,o;t[0]===i?o=t[1]:(o=i?(0,Y.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,Y.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,Y.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,Y.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 Sn(){return a(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,le)}function Cn(e){let t=(0,J.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,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(xn,{label:r.transportLabel,required:!0,children:(0,Y.jsx)(x,{className:Sn(),value:n.transport,onChange:e=>i({transport:e.target.value}),children:bn.map(e=>(0,Y.jsx)(G,{value:e,children:r.transportLabels[e]},e))})}),(0,Y.jsxs)(xn,{label:r.serverIdLabel,required:!0,children:[(0,Y.jsx)(`input`,{className:Sn(),value:n.id,placeholder:r.serverIdPlaceholder,onChange:e=>i({id:e.target.value})}),o?(0,Y.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,Y.jsxs)(Y.Fragment,{children:[l?(0,Y.jsx)(`div`,{className:c===`basic`?`md:col-span-2`:void 0,children:(0,Y.jsx)(xn,{label:r.commandLabel,required:!0,children:(0,Y.jsx)(`input`,{className:Sn(),value:n.command,onChange:e=>i({command:e.target.value})})})}):null,u?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(xn,{label:r.argsLabel,description:r.argsHint,children:(0,Y.jsx)(`input`,{className:Sn(),value:n.argsText,onChange:e=>i({argsText:e.target.value})})}),(0,Y.jsx)(xn,{label:r.cwdLabel,children:(0,Y.jsx)(`input`,{className:Sn(),value:n.cwd,onChange:e=>i({cwd:e.target.value})})}),(0,Y.jsx)(xn,{label:r.envLabel,description:r.envHint,children:(0,Y.jsx)(`textarea`,{className:a(Sn(),`min-h-[4rem] font-mono text-xs`),value:n.envJson,onChange:e=>i({envJson:e.target.value})})})]}):null]}):(0,Y.jsxs)(Y.Fragment,{children:[l?(0,Y.jsx)(`div`,{className:`md:col-span-2`,children:(0,Y.jsx)(xn,{label:r.urlLabel,required:!0,children:(0,Y.jsx)(`input`,{className:a(Sn(),`font-mono text-xs`),value:n.url,placeholder:`https://example.com/mcp`,onChange:e=>i({url:e.target.value})})})}):null,u?(0,Y.jsx)(yn,{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,Y.jsx)(xn,{label:r.timeoutLabel,description:r.timeoutHint,children:(0,Y.jsx)(`input`,{type:`number`,min:1,max:600,className:Sn(),value:Bt(n),placeholder:r.timeoutPlaceholder,onChange:e=>i({connectionTimeoutMs:Vt(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,Y.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 wn(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 Tn(e){let t=(0,J.c)(13),{tool:n,serverId:r}=e,i;t[0]!==r||t[1]!==n?(i=wn(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,Y.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,Y.jsx)(P,{delayDuration:300,skipDelayDuration:100,children:(0,Y.jsxs)(I,{children:[(0,Y.jsx)(b,{asChild:!0,children:(0,Y.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,Y.jsx)(S,{children:(0,Y.jsx)(F,{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,Y.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,Y.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 En({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,q.useState)(n),[g,_]=(0,q.useState)(!1),[v,b]=(0,q.useState)(!1),[x,S]=(0,q.useState)(null),[C,w]=(0,q.useState)(!1),[T,D]=(0,q.useState)({status:`idle`}),[O,A]=(0,q.useState)(null),M=n.id.trim(),N=f.id.trim()!==M&&s.has(f.id.trim())||s.has(f.id.trim())&&t===`add`?c.reservedServerId:void 0,P=f.id.trim()&&r.some(e=>e.clientKey!==n.clientKey&&e.id.trim()===f.id.trim())?l.duplicateServerId:void 0,F=f.id.trim().length>0&&!N&&!P&&(f.transport===`stdio`?f.command.trim().length>0:f.url.trim().length>0),I=Ht(f),L=(0,q.useCallback)(async()=>{if(f.id.trim()){b(!0),S(null),D({status:`loading`});try{D({status:`ok`,tools:(await zt(f.id.trim(),Pt(f))).tools})}catch(e){D({status:`error`,message:e instanceof Error?e.message:String(e)})}finally{b(!1)}}},[f]),R=(0,q.useCallback)(async()=>{if(!(!F||g)){_(!0),S(null);try{let e=r.filter(e=>!(t===`edit`&&e.clientKey===n.clientKey));e.push(f),await Ft({sessionIdleTtlMinutes:i,servers:e.sort((e,t)=>e.id.localeCompare(t.id))},Dt(o)),await d(),u()}catch(e){S(e instanceof Error?e.message:String(e))}finally{_(!1)}}},[F,o,r,n.clientKey,t,u,d,M,f,g,i]);return e?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(oe,{open:e,onOpenChange:e=>{e||u()},children:(0,Y.jsxs)(j,{children:[(0,Y.jsx)(k,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,Y.jsxs)(ie,{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,Y.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-6 py-5`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(y,{className:`text-base font-semibold text-fg`,children:t===`add`?l.addCustomServerTitle:l.editCustomServerTitle}),(0,Y.jsx)(E,{className:`mt-1 text-sm text-fg-muted`,children:t===`add`?l.addCustomServerHint:l.editCustomServerHint})]}),(0,Y.jsx)(m,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,className:a(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,ce.focusRingPanel),"aria-label":l.modalClose,children:[(0,Y.jsx)(ye,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`sr-only`,children:l.modalClose})]})})]}),(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-5`,children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,Y.jsx)(`section`,{className:`rounded-xl border border-edge bg-surface-base p-4`,children:(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,Y.jsx)(te,{className:`size-4 text-accent`,"aria-hidden":!0}),f.id.trim()||c.cardUntitled]}),(0,Y.jsx)(`p`,{className:`mt-1 break-all font-mono text-xs leading-5 text-fg-muted`,children:I||(f.transport===`stdio`?c.commandLabel:c.urlLabel)})]}),(0,Y.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,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`div`,{className:`mb-3`,children:[(0,Y.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:l.connectorBasicConfigTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:l.connectorBasicConfigHint})]}),(0,Y.jsx)(Cn,{row:f,t:c,variant:`basic`,onUpdate:e=>{p(t=>({...t,...e})),S(null)},idConflictMessage:N??P})]}),T.status===`ok`?(0,Y.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-base p-3`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,Y.jsx)(ee,{className:`size-4 text-accent`,"aria-hidden":!0}),T.tools.length===0?c.toolsEmpty:c.toolsTitle.replace(`{{count}}`,String(T.tools.length))]}),T.tools.length>0?(0,Y.jsx)(W,{type:`button`,variant:`ghost`,className:`h-8 text-xs`,onClick:()=>A(T.tools),children:c.viewAllTools}):null]}),T.tools.length>0?(0,Y.jsx)(`div`,{className:`mt-3 grid gap-2`,children:T.tools.slice(0,6).map((e,t)=>(0,Y.jsx)(Tn,{tool:e,serverId:f.id},e.name||`tool-${t}`))}):null]}):null,T.status===`error`?(0,Y.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:T.message}):null,x?(0,Y.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:x}):null,(0,Y.jsxs)(`details`,{open:C,onToggle:e=>w(e.currentTarget.open),className:`group rounded-xl border border-edge bg-surface-base`,children:[(0,Y.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,Y.jsx)(he,{className:`size-4 text-fg-muted transition-transform group-open:rotate-180`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`group-open:hidden`,children:l.connectorShowAdvancedConfig}),(0,Y.jsx)(`span`,{className:`hidden group-open:inline`,children:l.connectorHideAdvancedConfig})]}),(0,Y.jsx)(`div`,{className:`border-t border-edge p-4`,children:(0,Y.jsx)(Cn,{row:f,t:c,variant:`advanced`,onUpdate:e=>{p(t=>({...t,...e})),S(null)}})})]})]})}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-2 border-t border-edge-subtle px-6 py-4`,children:[(0,Y.jsxs)(W,{variant:`secondary`,disabled:!f.id.trim()||v,onClick:()=>void L(),children:[v?(0,Y.jsx)(h,{className:`size-4 animate-spin`}):(0,Y.jsx)(ve,{className:`size-4`}),c.testConnection]}),(0,Y.jsx)(m,{asChild:!0,children:(0,Y.jsx)(W,{variant:`secondary`,children:l.modalCancel})}),(0,Y.jsxs)(W,{variant:`primary`,disabled:!F||g,onClick:()=>void R(),children:[g?(0,Y.jsx)(h,{className:`size-4 animate-spin`}):(0,Y.jsx)(V,{className:`size-4`}),g?c.saving:l.modalSave]})]})]})]})}),O?(0,Y.jsx)(Jt,{open:!0,onOpenChange:e=>{e||A(null)},serverId:f.id,title:c.toolsDialogTitle,subtitle:c.toolsDialogSubtitle,searchPlaceholder:c.toolsDialogSearchPlaceholder,searchEmptyLabel:c.toolsDialogSearchEmpty,emptyLabel:c.toolsEmpty,closeLabel:c.toolsDialogClose,tools:O,stripPrefix:`${f.id.trim()}__`}):null]}):null}var Dn=[`understand`,`act`,`reach`];function On(e){if(e.benefits?.length)return[...new Set(e.benefits)];let t=new Set(e.capabilities),n=[e.id,e.displayName,...e.tags??[]].join(` `).toLowerCase(),r=[];return(t.has(`context`)||t.has(`memory_source`)||t.has(`resources`)||e.category===`docs`||e.category===`data`||/notion|drive|document|confluence|airtable|database|knowledge|wiki/.test(n))&&r.push(`understand`),t.has(`tools`)&&r.push(`act`),(t.has(`channel`)||/slack|telegram|discord|teams|mail|message|wechat|weixin/.test(n))&&r.push(`reach`),r.length?[...new Set(r)]:[`act`]}function kn(e){return On(e)[0]??`act`}function An(e,t){let n=t?kn(t):`act`,r=e.connectionStatus===`connected`||e.status===`connected`||e.usage.lastHealthStatus===`ok`,i=e.status===`not_configured`||e.status===`failed`||e.status===`degraded`||e.status===`unauthorized`||e.connectionStatus===`unauthorized`||e.connectionStatus===`error`,a=n===`understand`?e.usage.lastResourceCount:n===`act`?e.usage.lastToolCount:void 0;return{benefit:n,state:r?`ready`:i?`needs_setup`:`checking`,availableCount:a}}function jn(e){return!(e.runtime.type===`composio`&&e.runtime.role===`credential`)}function Mn(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 Nn(e,t,n){return e.filter(e=>Mn(e,t)).toSorted((e,t)=>n===`source`&&e.source!==t.source?e.source.localeCompare(t.source):e.displayName.localeCompare(t.displayName))}function Pn(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 Fn(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 In=`all`,Ln=`builtin`,Rn=`xopc-store`;function zn(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 Bn(e){return e.filter((e,t,n)=>n.findIndex(t=>t.id===e.id)===t)}function Vn(){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,q.useState)(s.get(`tab`)===`connected`?`connected`:`discover`),m=(0,q.useRef)(!1),[g,_]=(0,q.useState)({catalog:[],registryCatalog:[],instances:[],registries:[],loading:!0,error:null,peopleGraph:null}),[v,y]=(0,q.useState)(!1),[b,x]=(0,q.useState)(!1),[S,C]=(0,q.useState)(1),[w,E]=(0,q.useState)(void 0),[D,O]=(0,q.useState)(``),[k,A]=(0,q.useState)(``),[j,M]=(0,q.useState)(!1),[N,P]=(0,q.useState)(``),[F,I]=(0,q.useState)(Ln),[R,z]=(0,q.useState)(`name`),[B,V]=(0,q.useState)(`all`),[H,U]=(0,q.useState)(null),[ee,te]=(0,q.useState)(null),[ne,ie]=(0,q.useState)(null),[ae,oe]=(0,q.useState)(null),[se,ce]=(0,q.useState)(null),[le,ue]=(0,q.useState)(null),[de,G]=(0,q.useState)(!1),[fe,me]=(0,q.useState)(void 0),[he,ge]=(0,q.useState)(!1),{data:ve,mutate:ye}=re(o),be=ve?.payload?.config,K=(0,q.useMemo)(()=>be===void 0?null:Nt(be),[be]),J=K?.servers??[],Ce=g.instances.length+J.length;(0,q.useEffect)(()=>{K&&me(K.sessionIdleTtlMinutes)},[K]);let X=(0,q.useCallback)(async()=>{if(!r){_({catalog:[],registryCatalog:[],instances:[],registries:[],loading:!1,error:null,peopleGraph:null});return}_(e=>({...e,loading:!0,error:null}));try{let[e,t,n,r]=await Promise.all([Oe(),Pe(),Ne(),st(``,12).catch(()=>null)]);_(i=>({catalog:e,registryCatalog:i.registryCatalog,instances:t,registries:n,loading:!1,error:null,peopleGraph:r}))}catch(e){_({catalog:[],registryCatalog:[],instances:[],registries:[],loading:!1,error:e instanceof Error?e.message:String(e),peopleGraph:null})}},[r]);(0,q.useEffect)(()=>{X()},[X]),(0,q.useEffect)(()=>{if(!o||f!==`connected`)return;let e=!1,t=window.setTimeout(()=>{M(!0),st(k,50).then(t=>{e||_(e=>({...e,peopleGraph:t}))}).catch(()=>{}).finally(()=>{e||M(!1)})},250);return()=>{e=!0,window.clearTimeout(t)}},[o,k,f]),(0,q.useEffect)(()=>{m.current||g.loading||o&&!K||(p(Ce>0?`connected`:`discover`),m.current=!0)},[o,Ce,K,g.loading]);let Z=(0,q.useCallback)(e=>{m.current=!0,p(e)},[]),Q=(0,q.useMemo)(()=>[{id:Rn,displayName:t.storeSourceName},...g.registries],[t.storeSourceName,g.registries]),ke=(0,q.useCallback)(async e=>{if(!o||F===Ln){_(e=>({...e,registryCatalog:[]})),C(1),E(void 0);return}let t=N.trim(),n=e?.browse??!1,r=Math.max(e?.page??1,1),i=e?.append??!1,a=F===In?Q:Q.filter(e=>e.id===F);if(a.length!==0){y(!0),i?_(e=>({...e,error:null})):(C(1),E(void 0),_(e=>({...e,registryCatalog:[],error:null})));try{let e=await Promise.all(a.map(async e=>{if(e.id===Rn){let e=await Ae({q:t||void 0,page:r,pageSize:24,sort:R===`source`?`newest`:`downloads`});return{connectors:e.items.map(zn),totalPages:e.meta.totalPages}}return Le(t,e.id,{browse:n,page:r})})),o=Bn(e.flatMap(e=>e.connectors)),s=Math.max(1,...e.map(e=>e.totalPages??1));C(r),E(s),_(e=>({...e,registryCatalog:i?Bn([...e.registryCatalog,...o]):o}))}catch(e){_(t=>({...t,error:e instanceof Error?e.message:String(e)}))}finally{y(!1)}}},[R,N,F,o,Q]);(0,q.useEffect)(()=>{if(f!==`discover`||g.loading)return;if(F===Ln){_(e=>({...e,registryCatalog:[]})),C(1),E(void 0);return}let e=window.setTimeout(()=>{ke({browse:!N.trim()})},N.trim()?350:0);return()=>window.clearTimeout(e)},[N,F,ke,g.loading,f]);let Me=(0,q.useMemo)(()=>new Set(g.instances.map(e=>e.connectorId)),[g.instances]),Fe=(0,q.useMemo)(()=>new Map([...g.catalog,...g.registryCatalog].map(e=>[e.id,e])),[g.catalog,g.registryCatalog]);(0,q.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,O(``),ie(n.instanceId),oe(n),p(`connected`);else if(e){let t=Fe.get(e);if(!t)return;m.current=!0,I(Ln),P(``),te(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})},[Fe,s,d,g.instances,g.loading]);let Ie=(0,q.useCallback)(async e=>{x(!0),_(e=>({...e,error:null}));try{let t=await je(e);U(hn(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)}},[]),Re=(0,q.useMemo)(()=>new Set(g.instances.flatMap(e=>e.materialized.type===`mcp`?[e.materialized.serverId]:[])),[g.instances]),ze=(0,q.useCallback)(async e=>{if(!K||be===void 0)return;let t=J.filter(t=>t.clientKey!==e.clientKey);await Ft({sessionIdleTtlMinutes:K.sessionIdleTtlMinutes,servers:t},Dt(be)),await ye(),await X()},[be,J,X,K,ye]),Be=(0,q.useCallback)(()=>{ue({mode:`add`,row:gn(J,Re)})},[J,Re]),Ve=(0,q.useCallback)(async()=>{if(!(!K||be===void 0||he)){ge(!0);try{await Ft({sessionIdleTtlMinutes:fe,servers:J},Dt(be)),await ye(),G(!1)}finally{ge(!1)}}},[be,J,n.saved,K,ye,fe,he]),He=T(e=>e.setPageHeader),Ue=T(e=>e.clearPageHeader),We=(0,q.useMemo)(()=>(0,Y.jsx)(xt,{onBrowseCatalog:()=>Z(`discover`),onAddCustomServer:Be,onOpenRuntimeSettings:()=>G(!0),addLabel:t.addConnection,browseLabel:t.addFromCatalog,customLabel:t.addCustomServerAdvanced,settingsLabel:t.runtimeSettings}),[t,Be,Z]);(0,q.useLayoutEffect)(()=>(He({startExtra:null,main:(0,Y.jsx)(`div`,{className:`min-w-0`,children:(0,Y.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.title})}),end:We}),()=>Ue()),[Ue,t.title,We,He]);let Ge=(0,q.useMemo)(()=>g.instances.map(e=>({instance:e,value:An(e,Fe.get(e.connectorId))})),[Fe,g.instances]),Ke=(0,q.useMemo)(()=>new Map(Ge.map(({instance:e,value:t})=>[e.instanceId,t])),[Ge]),qe=(0,q.useMemo)(()=>({ready:Ge.filter(({value:e})=>e.state===`ready`).length,needsSetup:Ge.filter(({value:e})=>e.state===`needs_setup`).length,checking:Ge.filter(({value:e})=>e.state===`checking`).length}),[Ge]),Je=(0,q.useMemo)(()=>g.instances.filter(e=>Pn(e,D)).sort((e,t)=>{let n={needs_setup:0,checking:1,ready:2},r=Ke.get(e.instanceId)?.state??`checking`,i=Ke.get(t.instanceId)?.state??`checking`;return n[r]-n[i]||e.displayName.localeCompare(t.displayName)}),[D,Ke,g.instances]),Ye=(0,q.useMemo)(()=>J.filter(e=>Fn(e,D)),[D,J]),Xe=Je.length+Ye.length,Ze=(0,q.useMemo)(()=>g.catalog.filter(e=>e.source===`builtin`&&e.integrationStrategy?.preferred!==!1&&jn(e)),[g.catalog]),Qe=(0,q.useMemo)(()=>F===Ln?Ze:F===In?Bn([...Ze,...g.registryCatalog]):g.registryCatalog,[Ze,F,g.registryCatalog]),$e=(0,q.useMemo)(()=>Nn(B===`all`?Qe:Qe.filter(e=>On(e).includes(B)),N,R),[R,N,Qe,B]),et=(0,q.useMemo)(()=>Dn.filter(e=>Qe.some(t=>On(t).includes(e))),[Qe]);(0,q.useEffect)(()=>{B!==`all`&&!et.includes(B)&&V(`all`)},[et,B]);let tt=f===`discover`&&F!==Ln&&!!(w&&S<w),nt=(0,q.useMemo)(()=>g.instances.find(e=>e.instanceId===ne)??ae,[ne,ae,g.instances]),rt=(0,q.useMemo)(()=>[{value:In,label:t.discoverSourceAll},{value:Ln,label:t.discoverSourceBuiltin},...Q.map(e=>({value:e.id,label:e.displayName}))],[t.discoverSourceAll,t.discoverSourceBuiltin,Q]),it=[{id:`connected`,label:t.tabConnected,count:Ce},{id:`discover`,label:t.tabDiscover}];return(0,Y.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:(0,Y.jsxs)(`div`,{className:`flex w-full flex-col gap-6 px-3 py-6 sm:px-5 xl:px-6`,children:[o?null:(0,Y.jsx)(`p`,{className:`rounded-xl border border-edge bg-surface-panel px-4 py-3 text-sm text-fg-muted`,children:t.tokenHint}),(0,Y.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[(0,Y.jsx)(`div`,{className:`border-b border-edge-subtle pb-3 dark:border-edge-subtle`,children:(0,Y.jsx)(xe,{items:it,activeTab:f,onChange:Z,ariaLabel:t.navAria,tabIdPrefix:`connectors-tab`,panelIdPrefix:`connectors-panel`,className:`flex-wrap`})}),g.error?(0,Y.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,Y.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center`,children:[(0,Y.jsx)(bt,{value:D,onChange:O,placeholder:t.connectedSearchPlaceholder,className:`max-w-xl`}),(0,Y.jsx)(pe,{className:`size-9 shrink-0 p-0`,loading:g.loading,label:t.refreshConnections,title:t.refreshConnections,onClick:X})]}),Ge.length>0?(0,Y.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.connectionSummaryTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.connectionSummaryHint}),(0,Y.jsxs)(`div`,{className:`mt-4 grid gap-2 sm:grid-cols-3`,children:[(0,Y.jsxs)(`div`,{className:`rounded-xl bg-surface-panel p-3`,children:[(0,Y.jsx)(`div`,{className:`text-xl font-semibold tabular-nums text-success`,children:qe.ready}),(0,Y.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:t.connectionReady})]}),(0,Y.jsxs)(`div`,{className:`rounded-xl bg-surface-panel p-3`,children:[(0,Y.jsx)(`div`,{className:a(`text-xl font-semibold tabular-nums`,qe.needsSetup>0?`text-warning`:`text-fg`),children:qe.needsSetup}),(0,Y.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:t.connectionNeedsSetup})]}),(0,Y.jsxs)(`div`,{className:`rounded-xl bg-surface-panel p-3`,children:[(0,Y.jsx)(`div`,{className:`text-xl font-semibold tabular-nums text-fg`,children:qe.checking}),(0,Y.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:t.connectionChecking})]})]})]}):null,g.peopleGraph&&(g.peopleGraph.scannedItems>0||k)?(0,Y.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Y.jsx)(`div`,{className:`rounded-lg bg-accent-soft p-2 text-accent-fg`,children:(0,Y.jsx)(_e,{className:`size-4`,"aria-hidden":!0})}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.peopleGraphTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.peopleGraphHint.replace(`{{people}}`,String(g.peopleGraph.people.length)).replace(`{{sources}}`,String(new Set(g.peopleGraph.sourceEdges.map(e=>e.sourceInstanceId)).size))})]})]}),(0,Y.jsxs)(`div`,{className:`relative w-full max-w-xs`,children:[(0,Y.jsx)(bt,{value:k,onChange:A,placeholder:t.peopleGraphSearchPlaceholder}),j?(0,Y.jsx)(h,{className:`absolute right-3 top-2.5 size-4 animate-spin text-fg-subtle`,"aria-hidden":!0}):null]})]}),g.peopleGraph.people.length?(0,Y.jsx)(`div`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,children:g.peopleGraph.people.slice(0,10).map(e=>{let t=[...new Set(g.peopleGraph.sourceEdges.filter(t=>t.personId===e.id).map(e=>e.toolkit??e.connectorId??e.sourceInstanceId))];return(0,Y.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-panel px-3 py-2.5`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,Y.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:e.label}),(0,Y.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:e.mentionCount})]}),(0,Y.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:e.emails[0]??e.usernames[0]??e.roles.join(` · `)}),(0,Y.jsx)(`p`,{className:`mt-1 truncate text-[11px] text-fg-subtle`,children:t.join(` · `)})]},e.id)})}):(0,Y.jsx)(`p`,{className:`mt-4 text-sm text-fg-muted`,children:t.peopleGraphSearchEmpty})]}):null,(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.connectionsTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.connectionsHint})]}),g.loading?(0,Y.jsx)(`div`,{className:`grid gap-3`,"aria-busy":`true`,"aria-label":t.loading,children:we.slice(0,3).map(e=>(0,Y.jsx)(De,{},e))}):Ce===0?(0,Y.jsxs)(`div`,{className:`rounded-2xl border border-dashed border-edge p-8 text-center`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.connectionsEmpty}),(0,Y.jsx)(W,{type:`button`,variant:`primary`,className:`mt-4`,onClick:()=>Z(`discover`),children:t.addFromCatalog})]}):Xe===0?(0,Y.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge p-8 text-center text-sm text-fg-muted`,children:t.connectionsSearchEmpty}):(0,Y.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`,children:[Je.map(e=>(0,Y.jsx)(sn,{instance:e,definition:Fe.get(e.connectorId),highlighted:e.instanceId===se,onOpenDetails:e=>{ce(null),ie(e.instanceId),oe(e)},onChanged:X,t},e.instanceId)),Ye.map(e=>(0,Y.jsx)(Ut,{row:e,t:n,cs:t,onEdit:()=>ue({mode:`edit`,row:structuredClone(e)}),onRemove:async()=>ze(e)},e.clientKey))]}),(0,Y.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.disableHint})]}):null,f===`discover`&&o?(0,Y.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.discoverTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.discoverHint})]}),(0,Y.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,Y.jsx)(`div`,{className:`flex flex-wrap gap-2`,role:`group`,"aria-label":t.outcomeFilterAria,children:[`all`,...et].map(e=>(0,Y.jsx)(`button`,{type:`button`,className:a(`rounded-full border px-3 py-1.5 text-xs font-medium transition-colors`,B===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":B===e,onClick:()=>V(e),children:e===`all`?t.outcomeAll:t.connectorBenefitHeadings[e]},e))}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2 lg:flex-row lg:items-center`,children:[(0,Y.jsx)(bt,{value:N,onChange:P,placeholder:t.discoverSearchPlaceholder,className:`max-w-xl`}),(0,Y.jsxs)(`div`,{className:`grid min-w-0 grid-cols-1 gap-2 sm:grid-cols-2 lg:ml-auto lg:w-[26rem]`,children:[(0,Y.jsx)(L,{value:F,options:rt,placeholder:t.discoverSourceAll,allowEmpty:!1,ariaLabel:t.registrySourceAria,triggerClassName:`h-9 bg-surface-panel text-xs`,onChange:I}),(0,Y.jsx)(L,{value:R,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=>z(e)})]})]}),(g.loading||v)&&$e.length===0?(0,Y.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`,"aria-busy":`true`,"aria-label":t.loading,children:we.map(e=>(0,Y.jsx)(Ee,{},e))}):$e.length===0?(0,Y.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge p-8 text-center text-sm text-fg-muted`,children:t.discoverEmpty}):(0,Y.jsxs)(`div`,{className:`relative`,children:[v?(0,Y.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,Y.jsx)(h,{className:`size-8 shrink-0 animate-spin text-accent motion-reduce:animate-none`,strokeWidth:2,"aria-hidden":!0})}):null,(0,Y.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`,children:$e.map(e=>(0,Y.jsx)(Se,{connector:e,installed:Me.has(e.id)||Te(e,g.instances),onInstall:e=>{if(e.source===`store`){Ie(e.id);return}U(hn(e))},onOpenDetails:e.source===`store`?void 0:te,t},e.id))}),tt?(0,Y.jsx)(`div`,{className:`mt-4 flex justify-center`,children:(0,Y.jsxs)(W,{type:`button`,variant:`secondary`,disabled:v||b,onClick:()=>void ke({browse:!N.trim(),page:S+1,append:!0}),children:[v?(0,Y.jsx)(h,{className:`size-4 animate-spin`}):null,t.loadMore]})}):null]})]}):null]}),H?(0,Y.jsx)(mn,{draft:H,onChange:U,onClose:()=>U(null),t,onInstalled:async e=>{await X(),await ye(),ce(e.instanceId),Z(`connected`)}}):null,ee?(0,Y.jsx)(_t,{connector:ee,installed:Me.has(ee.id)||Te(ee,g.instances),onClose:()=>te(null),onInstall:e=>U(hn(e)),t}):null,nt?(0,Y.jsx)(on,{instance:nt,definition:Fe.get(nt.connectorId),onClose:()=>{ie(null),oe(null)},onChanged:X,t,mcp:n}):null,le?(0,Y.jsx)(En,{open:!0,mode:le.mode,initialRow:le.row,existingCustomServers:J,sessionIdleTtlMinutes:fe,config:be,managedServerIds:Re,t:n,cs:t,onClose:()=>ue(null),onSaved:async()=>{await ye(),await X(),Z(`connected`)}},`${le.mode}-${le.row.clientKey}`):null,(0,Y.jsx)(yt,{open:de,sessionIdleTtlMinutes:fe,saving:he,onChange:me,onSave:Ve,onClose:()=>G(!1),t,mcp:n})]})})}export{Vn as ConnectorsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d 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-Bwu1tG3T.js";import{l as c,n as l,r as u,s as d}from"./locale-store-d9Cylz62.js";import{i as f,o as p}from"./vendor-swr-BIWyz7Rc.js";import{Bc as m,Bo as h,Go as g,Js as _,Nt as v,Ro as y,Xs as b,Ys as x,ao as S,as as C,hs as w,io as T,js as E,kc as D,lc as O,ls as k,ms as A,ni as j,oc as M,os as N,qo as P,rl as F,rr as I,si as L,tl as R}from"./index-DHRxn7Sy.js";import{n as ee,r as te,t as z}from"./settings-page-layout-CBUOPmx_.js";import{n as ne}from"./settings-loading-skeleton-tN-9u8dj.js";import{t as re}from"./settings-advanced-gate-CwRP1Nsl.js";import{n as B,t as ie}from"./settings-form-section-D0DPTbO0.js";import{t as ae}from"./page-tabs-C1jBfKTZ.js";import{a as oe,c as se,d as ce,n as le,o as ue,r as de,t as fe}from"./gateway-config-api-CUEAZEld.js";var V=e(t(),1),H=n(),pe={critical:3,warn:2,info:1};function U(){return u(`/api/doctor?security=true`)}function W(e){return e.toSorted((e,t)=>pe[t.severity]-pe[e.severity]||e.checkId.localeCompare(t.checkId))}function G(e){let t=e?.checks?.find(e=>e.id===`security-audit`);if(!t)return{status:`skip`,message:`Security audit unavailable.`,hints:[],findings:[]};let n=W((t.findings??[]).filter(e=>typeof e.checkId==`string`&&(e.severity===`critical`||e.severity===`warn`||e.severity===`info`)&&typeof e.title==`string`&&typeof e.detail==`string`));return{status:t.status,message:t.message,hints:Array.isArray(t.hints)?t.hints.filter(e=>typeof e==`string`):[],findings:n}}async function K(){return G(await d(U()))}var q=r();function me(e){let t=(0,H.c)(39),{enabled:n,refreshToken:r}=e,i=r===void 0?0:r,a=l(he),o;t[0]===a?o=t[1]:(o=s(a),t[0]=a,t[1]=o);let c=o.gatewaySettings,u;t[2]!==n||t[3]!==i?(u=n?[U(),i]:null,t[2]=n,t[3]=i,t[4]=u):u=t[4];let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d={revalidateOnFocus:!1},t[5]=d):d=t[5];let{data:h,error:g,isLoading:_,isValidating:v,mutate:y}=f(u,J,d),x=h??null,C=g instanceof Error?g.message:g?String(g):null,T=_||v,E;t[6]===y?E=t[7]:(E=()=>{y(),p(U())},t[6]=y,t[7]=E);let D=E,k=!n||T,A;t[8]===T?A=t[9]:(A=T?(0,q.jsx)(m,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,q.jsx)(O,{className:`size-3.5`,"aria-hidden":!0}),t[8]=T,t[9]=A);let j;t[10]===c.securityAuditRefresh?j=t[11]:(j=(0,q.jsx)(`span`,{className:`ml-1.5`,children:c.securityAuditRefresh}),t[10]=c.securityAuditRefresh,t[11]=j);let M;t[12]!==D||t[13]!==k||t[14]!==A||t[15]!==j?(M=(0,q.jsxs)(w,{type:`button`,variant:`secondary`,className:`px-2.5 py-1.5 text-xs`,disabled:k,onClick:D,children:[A,j]}),t[12]=D,t[13]=k,t[14]=A,t[15]=j,t[16]=M):M=t[16];let N;t[17]!==c.securityAuditSubtitle||t[18]!==c.securityAuditTitle||t[19]!==M?(N=(0,q.jsx)(B,{icon:b,title:c.securityAuditTitle,subtitle:c.securityAuditSubtitle,trailing:M}),t[17]=c.securityAuditSubtitle,t[18]=c.securityAuditTitle,t[19]=M,t[20]=N):N=t[20];let P;t[21]===c.securityAuditSavedConfigHint?P=t[22]:(P=(0,q.jsx)(`p`,{className:`mb-4 text-xs text-fg-subtle`,children:c.securityAuditSavedConfigHint}),t[21]=c.securityAuditSavedConfigHint,t[22]=P);let F;t[23]!==C||t[24]!==c.securityAuditLoadError?(F=C?(0,q.jsxs)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,role:`alert`,children:[c.securityAuditLoadError,`: `,C]}):null,t[23]=C,t[24]=c.securityAuditLoadError,t[25]=F):F=t[25];let I;t[26]!==x||t[27]!==C||t[28]!==T?(I=!C&&T&&!x?(0,q.jsxs)(`div`,{className:`space-y-2`,"aria-busy":`true`,children:[(0,q.jsx)(S,{className:`h-11 w-full rounded-lg`}),(0,q.jsx)(S,{className:`h-10 w-full rounded-lg`})]}):null,t[26]=x,t[27]=C,t[28]=T,t[29]=I):I=t[29];let L;t[30]!==x||t[31]!==c?(L=x?(0,q.jsx)(ge,{g:c,audit:x}):null,t[30]=x,t[31]=c,t[32]=L):L=t[32];let R;return t[33]!==N||t[34]!==P||t[35]!==F||t[36]!==I||t[37]!==L?(R=(0,q.jsxs)(ie,{children:[N,P,F,I,L]}),t[33]=N,t[34]=P,t[35]=F,t[36]=I,t[37]=L,t[38]=R):R=t[38],R}function J(){return K()}function he(e){return e.language}function ge(e){let t=(0,H.c)(40),{g:n,audit:r}=e,i,o,s,c,l,u,d;t[0]!==r.findings||t[1]!==r.status||t[2]!==n?(o=ye(n,r.status,r.findings),d=`space-y-4`,l=a(`rounded-lg border px-3 py-2.5 text-sm`,o.bannerClass),u=`status`,c=`flex items-start gap-2`,i=o.icon,s=a(`mt-0.5 size-4 shrink-0`,o.iconClass),t[0]=r.findings,t[1]=r.status,t[2]=n,t[3]=i,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d):(i=t[3],o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9]);let f;t[10]!==i||t[11]!==s?(f=(0,q.jsx)(i,{className:s,"aria-hidden":!0}),t[10]=i,t[11]=s,t[12]=f):f=t[12];let p;t[13]===o.title?p=t[14]:(p=(0,q.jsx)(`p`,{className:`font-medium`,children:o.title}),t[13]=o.title,t[14]=p);let m;t[15]===r.message?m=t[16]:(m=(0,q.jsx)(`p`,{className:`mt-0.5 text-xs opacity-90`,children:r.message}),t[15]=r.message,t[16]=m);let h;t[17]!==p||t[18]!==m?(h=(0,q.jsxs)(`div`,{children:[p,m]}),t[17]=p,t[18]=m,t[19]=h):h=t[19];let g;t[20]!==c||t[21]!==f||t[22]!==h?(g=(0,q.jsxs)(`div`,{className:c,children:[f,h]}),t[20]=c,t[21]=f,t[22]=h,t[23]=g):g=t[23];let _;t[24]!==g||t[25]!==l||t[26]!==u?(_=(0,q.jsx)(`div`,{className:l,role:u,children:g}),t[24]=g,t[25]=l,t[26]=u,t[27]=_):_=t[27];let v;t[28]!==r.findings||t[29]!==r.status||t[30]!==n?(v=r.findings.length>0?(0,q.jsx)(`ul`,{className:`space-y-2`,children:r.findings.map(e=>(0,q.jsx)(_e,{g:n,finding:e},e.checkId))}):r.status===`pass`||r.status===`skip`?(0,q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.securityAuditNoFindings}):null,t[28]=r.findings,t[29]=r.status,t[30]=n,t[31]=v):v=t[31];let y;t[32]!==r.hints||t[33]!==n?(y=r.hints.length>0?(0,q.jsxs)(`div`,{className:`space-y-1 rounded-lg bg-surface-panel/50 px-3 py-2.5`,children:[(0,q.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:n.securityAuditHintsTitle}),(0,q.jsx)(`ul`,{className:`space-y-1 text-xs text-fg-subtle`,children:r.hints.map(Y)})]}):null,t[32]=r.hints,t[33]=n,t[34]=y):y=t[34];let b;return t[35]!==_||t[36]!==v||t[37]!==y||t[38]!==d?(b=(0,q.jsxs)(`div`,{className:d,children:[_,v,y]}),t[35]=_,t[36]=v,t[37]=y,t[38]=d,t[39]=b):b=t[39],b}function Y(e){return(0,q.jsx)(`li`,{className:`font-mono`,children:e},e)}function _e(e){let t=(0,H.c)(31),{g:n,finding:r}=e,i,o,s,c;if(t[0]!==r.severity){let e=ve(r.severity);c=`rounded-lg bg-surface-panel/70 px-3 py-2.5 shadow-surface`,s=`flex items-start gap-2`,i=e.icon,o=a(`mt-0.5 size-4 shrink-0`,e.iconClass),t[0]=r.severity,t[1]=i,t[2]=o,t[3]=s,t[4]=c}else i=t[1],o=t[2],s=t[3],c=t[4];let l;t[5]!==i||t[6]!==o?(l=(0,q.jsx)(i,{className:o,"aria-hidden":!0}),t[5]=i,t[6]=o,t[7]=l):l=t[7];let u;t[8]===r.title?u=t[9]:(u=(0,q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:r.title}),t[8]=r.title,t[9]=u);let d;t[10]===r.checkId?d=t[11]:(d=(0,q.jsx)(`span`,{className:`font-mono text-[0.65rem] text-fg-subtle`,children:r.checkId}),t[10]=r.checkId,t[11]=d);let f;t[12]!==u||t[13]!==d?(f=(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-0.5`,children:[u,d]}),t[12]=u,t[13]=d,t[14]=f):f=t[14];let p;t[15]===r.detail?p=t[16]:(p=(0,q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:r.detail}),t[15]=r.detail,t[16]=p);let m;t[17]!==r.remediation||t[18]!==n?(m=r.remediation?(0,q.jsxs)(`p`,{className:`mt-1.5 text-xs text-fg-subtle`,children:[(0,q.jsx)(`span`,{className:`text-fg-muted`,children:n.securityAuditRemediation}),` `,r.remediation]}):null,t[17]=r.remediation,t[18]=n,t[19]=m):m=t[19];let h;t[20]!==f||t[21]!==p||t[22]!==m?(h=(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[f,p,m]}),t[20]=f,t[21]=p,t[22]=m,t[23]=h):h=t[23];let g;t[24]!==h||t[25]!==s||t[26]!==l?(g=(0,q.jsxs)(`div`,{className:s,children:[l,h]}),t[24]=h,t[25]=s,t[26]=l,t[27]=g):g=t[27];let _;return t[28]!==g||t[29]!==c?(_=(0,q.jsx)(`li`,{className:c,children:g}),t[28]=g,t[29]=c,t[30]=_):_=t[30],_}function ve(e){switch(e){case`critical`:return{icon:o,iconClass:`text-red-600 dark:text-red-400`};case`warn`:return{icon:E,iconClass:`text-amber-600 dark:text-amber-400`};default:return{icon:F,iconClass:`text-fg-muted`}}}function ye(e,t,n){let r=n.filter(e=>e.severity===`critical`).length,i=n.filter(e=>e.severity===`warn`).length;return t===`fail`||r>0?{icon:o,iconClass:`text-red-600 dark:text-red-400`,title:e.securityAuditStatusFail,bannerClass:`border-red-200 bg-red-50 text-red-950 dark:border-red-900/50 dark:bg-red-950/40 dark:text-red-100`}:t===`warn`||i>0?{icon:E,iconClass:`text-amber-600 dark:text-amber-400`,title:e.securityAuditStatusWarn,bannerClass:`border-amber-200 bg-amber-50 text-amber-950 dark:border-amber-800 dark:bg-amber-950/40 dark:text-amber-100`}:t===`skip`?{icon:F,iconClass:`text-fg-muted`,title:e.securityAuditStatusSkip,bannerClass:`border-edge bg-surface-panel/60 text-fg`}:{icon:b,iconClass:`text-emerald-600 dark:text-emerald-400`,title:e.securityAuditStatusPass,bannerClass:`border-emerald-200 bg-emerald-50 text-emerald-950 dark:border-emerald-900/50 dark:bg-emerald-950/40 dark:text-emerald-100`}}function X(){return a(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,A,`dark:border-edge`)}var be=[`network`,`access`,`updates`,`security`,`advanced`],xe={network:D,access:R,updates:O,security:x,advanced:_};function Se(e){return e&&be.includes(e)?e:`network`}function Z(e,t){return t===`network`?e.tabNetwork:t===`access`?e.tabAccess:t===`updates`?e.tabUpdates:t===`security`?e.tabSecurity:e.tabAdvanced}function Ce(e,t){return t===`network`?e.networkTabHint:t===`access`?e.accessTabHint:t===`updates`?e.updatesTabHint:t===`security`?e.securitySectionHint:e.advancedSectionHint}function we(e,t){switch(t.type){case`reset`:return{form:null,baseline:null,appliedBaseline:null};case`init-applied`:return{...e,appliedBaseline:structuredClone(t.value)};case`sync`:{let n=structuredClone(t.value);return{form:n,baseline:structuredClone(n),appliedBaseline:e.appliedBaseline}}case`set-form`:return e.form?{...e,form:t.updater(e.form)}:e;case`discard`:return e.baseline?{...e,form:structuredClone(e.baseline)}:e;case`saved`:{let n=structuredClone(t.value);return{form:n,baseline:structuredClone(n),appliedBaseline:e.appliedBaseline}}}}var Te={saving:!1,error:null,saveOk:!1,auditRefreshToken:0,restarting:!1,restartConfirmOpen:!1};function Ee(){let e=l(e=>e.language),t=s(e),n=t.gatewaySettings,[r,u]=i(),d=j(e=>e.mode),f=d===`advanced`,p=Se(r.get(`tab`)),_=(0,V.useMemo)(()=>ce(be,d),[d]),b=(0,V.useCallback)(e=>{u(t=>{let n=new URLSearchParams(t);return e===`network`?n.delete(`tab`):n.set(`tab`,e),n},{replace:!0})},[u]);se(p,b);let x=c(e=>e.token),S=c(e=>e.tokenExpired),E=c(e=>e.openTokenDialog),D=!!x,[O,k]=(0,V.useReducer)(we,{form:null,baseline:null,appliedBaseline:null}),A=O.form,N=O.baseline,F=O.appliedBaseline,[R,z]=(0,V.useReducer)(v,Te),{saving:B,error:ie,auditRefreshToken:ae,restarting:H,restartConfirmOpen:pe}=R,U=(0,V.useRef)(!1),W=(0,V.useRef)(null),G=(0,V.useRef)(!1),{data:K,error:J,isLoading:he,mutate:ge}=T(D),Y=(0,V.useMemo)(()=>K?.payload?.config===void 0?null:structuredClone(le(K.payload.config)),[K]);D?Y!==null&&(G.current||(G.current=!0,k({type:`init-applied`,value:Y})),!U.current&&W.current!==Y&&(W.current=Y,k({type:`sync`,value:Y}),z({type:`patch`,patch:{saveOk:!1}}))):(W.current!==null||G.current)&&(W.current=null,G.current=!1,k({type:`reset`}),U.current=!1);let _e=!!(D&&he&&K===void 0&&!J),ve=J instanceof Error?J.message:J?String(J):null,ye=(0,V.useMemo)(()=>!A||!N?!1:JSON.stringify(A)!==JSON.stringify(N),[A,N]),xe=(0,V.useMemo)(()=>!N||!F?!1:fe(F,N),[F,N]),Z=(0,V.useCallback)(e=>{U.current=!0,k({type:`set-form`,updater:t=>({...t,auth:{...t.auth,...e}})})},[]),Ce=(0,V.useCallback)(e=>{U.current=!0,k({type:`set-form`,updater:t=>({...t,updateChannel:e})})},[]),Ee=(0,V.useCallback)(e=>{U.current=!0,k({type:`set-form`,updater:t=>({...t,corsOrigins:e})})},[]),$=(0,V.useCallback)(e=>{U.current=!0,k({type:`set-form`,updater:t=>({...t,bind:e})})},[]),Pe=(0,V.useCallback)(e=>{U.current=!0,k({type:`set-form`,updater:t=>({...t,customBindHost:e,bind:`custom`})})},[]),Fe=(0,V.useCallback)(e=>{U.current=!0,k({type:`set-form`,updater:t=>({...t,port:e})})},[]),Ie=(0,V.useCallback)(e=>{U.current=!0,k({type:`set-form`,updater:t=>({...t,auth:{...t.auth,rateLimit:{...t.auth.rateLimit,...e}}})})},[]),Le=(0,V.useCallback)(e=>{U.current=!0,k({type:`set-form`,updater:t=>({...t,maxSseConnections:e})})},[]),Re=(0,V.useCallback)(e=>{U.current=!0,k({type:`set-form`,updater:t=>({...t,channelConnectDeferMode:e})})},[]),ze=(0,V.useCallback)(e=>{U.current=!0,k({type:`set-form`,updater:t=>({...t,channelConnectDeferIds:e})})},[]),Be=(0,V.useCallback)(e=>{U.current=!0,k({type:`set-form`,updater:t=>({...t,channelConnectDeferSkipIds:e})})},[]),Ve=(0,V.useCallback)(e=>{U.current=!0,k({type:`set-form`,updater:t=>({...t,trustedProxies:e})})},[]),He=(0,V.useCallback)(e=>{U.current=!0,k({type:`set-form`,updater:t=>({...t,auth:{...t.auth,trustedProxy:{...t.auth.trustedProxy,...e}}})})},[]),Ue=(0,V.useCallback)(e=>{U.current=!0,k({type:`set-form`,updater:t=>({...t,securityStrict:e})})},[]),We=(0,V.useCallback)(e=>{U.current=!0,k({type:`set-form`,updater:t=>({...t,allowRealIpFallback:e})})},[]),Ge=(0,V.useCallback)(e=>{U.current=!0,k({type:`set-form`,updater:t=>({...t,dangerouslyAllowHostHeaderOriginFallback:e})})},[]),Ke=(0,V.useCallback)(async()=>{if(!A||B)return;let e=ue(A);if(e){z({type:`patch`,patch:{error:e}});return}z({type:`patch`,patch:{saving:!0,error:null,saveOk:!1}});try{await de(A),U.current=!1,k({type:`saved`,value:A}),z({type:`patch`,patch:{saveOk:!0,auditRefreshToken:ae+1}})}catch(e){z({type:`patch`,patch:{error:e instanceof Error?e.message:n.saveError}})}finally{z({type:`patch`,patch:{saving:!1}})}},[A,B,n.saveError]),qe=(0,V.useCallback)(()=>{N&&(U.current=!1,k({type:`discard`}),z({type:`patch`,patch:{error:null,saveOk:!1}}))},[N]),Je=C(n),Ye=(0,V.useCallback)(async()=>{if(!H){z({type:`patch`,patch:{restarting:!0,restartConfirmOpen:!1}});try{let e=await L();e.ok?window.dispatchEvent(new Event(`gateway-restart-initiated`)):y({type:`error`,title:n.restartGatewayFailed,message:e.message??``})}catch(e){y({type:`error`,title:n.restartGatewayFailed,message:e instanceof Error?e.message:String(e)})}finally{z({type:`patch`,patch:{restarting:!1}})}}},[H,n.restartGatewayFailed]);return D?_e?(0,q.jsx)(te,{gap:`gap-6`,padding:`px-3 py-8 sm:px-5 xl:px-6`,children:(0,q.jsx)(ne,{sections:3})}):A?(0,q.jsxs)(te,{gap:`gap-6`,children:[(0,q.jsx)(ee,{title:t.settingsSections.gateway,subtitle:n.subtitle,docsLink:h(e,`gateway`),docsLabel:n.docsLink,actions:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(w,{type:`button`,variant:`secondary`,disabled:!ye||B,onClick:qe,children:n.discard}),(0,q.jsx)(w,{type:`button`,variant:`primary`,disabled:!ye||B,onClick:()=>void Ke(),children:B?n.saving:n.save})]})}),S?(0,q.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-lg border border-red-200 bg-red-50 px-4 py-3 dark:border-red-900/50 dark:bg-red-950/40`,role:`alert`,children:[(0,q.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,q.jsx)(o,{className:`mt-0.5 size-4 shrink-0 text-red-600 dark:text-red-400`}),(0,q.jsx)(`p`,{className:`text-sm text-red-900 dark:text-red-100`,children:n.tokenExpired})]}),(0,q.jsx)(`div`,{children:(0,q.jsx)(w,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:()=>E(),children:n.updateToken})})]}):null,ye?(0,q.jsx)(`p`,{className:`text-xs text-amber-800 dark:text-amber-200`,children:n.unsavedHint}):null,ie?(0,q.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:ie}):null,xe?(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 dark:border-amber-800 dark:bg-amber-950/40`,children:[(0,q.jsx)(`p`,{className:`text-xs text-amber-950 dark:text-amber-100`,children:n.restartHint}),(0,q.jsxs)(w,{type:`button`,variant:`secondary`,className:`shrink-0 gap-1.5 border-red-300 bg-red-50 text-xs text-red-700 hover:bg-red-100 dark:border-red-800 dark:bg-red-950/50 dark:text-red-300 dark:hover:bg-red-900/60`,disabled:H,onClick:()=>z({type:`patch`,patch:{restartConfirmOpen:!0}}),children:[H?(0,q.jsx)(m,{className:`size-3.5 animate-spin`}):(0,q.jsx)(M,{className:`size-3.5`}),n.restartGatewayButton]})]}):null,(0,q.jsx)(I,{open:pe,title:n.restartGatewayButton,description:n.restartGatewayConfirm,confirmLabel:n.restartGatewayButton,cancelLabel:n.discard,destructive:!0,onConfirm:()=>void Ye(),onCancel:()=>z({type:`patch`,patch:{restartConfirmOpen:!1}})}),(0,q.jsx)(De,{g:n,activeTab:p,visibleTabs:_,onChange:b}),(0,q.jsxs)(Q,{g:n,id:`network`,activeTab:p,children:[(0,q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:`gateway-bind-mode`,children:n.bindMode}),(0,q.jsxs)(g,{id:`gateway-bind-mode`,className:X(),value:A.bind,onChange:e=>$(e.target.value),children:[(0,q.jsx)(P,{value:`loopback`,children:n.bindLoopback}),f?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(P,{value:`lan`,children:n.bindLan}),(0,q.jsx)(P,{value:`auto`,children:n.bindAuto}),(0,q.jsx)(P,{value:`custom`,children:n.bindCustom}),(0,q.jsx)(P,{value:`tailnet`,children:n.bindTailnet})]}):null]})]}),A.bind===`custom`?(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:`gateway-custom-bind-host`,children:n.customBindHost}),(0,q.jsx)(`input`,{id:`gateway-custom-bind-host`,className:a(X(),`font-mono text-xs`),value:A.customBindHost,onChange:e=>Pe(e.target.value),placeholder:n.customBindHostPlaceholder,autoComplete:`off`})]}):null,(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:`gateway-listen-port`,children:n.listenPort}),(0,q.jsx)(`input`,{id:`gateway-listen-port`,type:`number`,min:1,max:65535,className:a(X(),`font-mono text-xs`),value:A.port,onChange:e=>{let t=Number(e.target.value);Fe(Number.isFinite(t)?Math.max(1,Math.min(65535,Math.floor(t))):A.port)}})]}),(0,q.jsx)(`p`,{className:`text-xs text-fg-subtle sm:col-span-2`,children:n.listenHint})]}),(0,q.jsx)(re,{children:(0,q.jsx)(je,{g:n,origins:A.corsOrigins,onChange:Ee})})]}),(0,q.jsxs)(Q,{g:n,id:`access`,activeTab:p,children:[A.auth.mode===`none`?(0,q.jsx)(`p`,{className:`rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:border-amber-800 dark:bg-amber-950/40 dark:text-amber-100`,children:n.authModeNone}):null,(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`gateway-auth-mode`,children:n.authMode}),(0,q.jsxs)(g,{id:`gateway-auth-mode`,value:A.auth.mode,onChange:e=>Z({mode:e.target.value}),className:X(),children:[(0,q.jsx)(P,{value:`token`,children:n.authModeToken}),(0,q.jsx)(P,{value:`password`,children:n.authModePassword}),f?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(P,{value:`trusted-proxy`,children:n.authModeTrustedProxy}),(0,q.jsx)(P,{value:`none`,children:n.authModeNoneLabel})]}):null]})]}),(0,q.jsx)(re,{children:A.auth.mode===`trusted-proxy`?(0,q.jsx)(ke,{g:n,form:A,onTrustedProxyChange:He,onTrustedProxiesChange:Ve,onAllowRealIpFallbackChange:We}):null}),A.auth.mode===`token`?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Ne,{id:`gateway-access-token`,label:n.accessToken,help:n.tokenHelp,placeholder:n.tokenPlaceholder,value:A.auth.token,labels:Je,reveal:()=>oe(`token`).then(e=>e.secret),loadFailedLabel:n.saveError,onChange:e=>Z({token:e})}),(0,q.jsx)(w,{type:`button`,variant:`secondary`,className:`w-full sm:w-auto`,onClick:()=>E(),children:n.changeToken})]}):null,A.auth.mode===`password`?(0,q.jsx)(Ne,{id:`gateway-auth-password`,label:n.authPassword,help:n.authPasswordHelp,placeholder:n.authPasswordPlaceholder,value:A.auth.password,labels:Je,reveal:()=>oe(`password`).then(e=>e.secret),loadFailedLabel:n.saveError,onChange:e=>Z({password:e})}):null,(0,q.jsx)(re,{children:A.auth.mode===`none`?null:(0,q.jsx)(Me,{g:n,rateLimit:A.auth.rateLimit,onChange:Ie})})]}),(0,q.jsxs)(Q,{g:n,id:`updates`,activeTab:p,children:[(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`gateway-update-channel`,children:n.updateChannel}),(0,q.jsxs)(g,{id:`gateway-update-channel`,value:A.updateChannel,onChange:e=>Ce(e.target.value),className:X(),children:[(0,q.jsx)(P,{value:`stable`,children:n.channelStable}),(0,q.jsx)(P,{value:`beta`,children:n.channelBeta}),(0,q.jsx)(P,{value:`dev`,children:n.channelDev})]}),(0,q.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.updateChannelHint})]}),(0,q.jsxs)(`div`,{className:`space-y-4 border-t border-edge pt-4`,children:[(0,q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n.updateAutoSection}),(0,q.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.updateAutoSectionHint}),(0,q.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:A.updateCheckOnStart,onChange:e=>{U.current=!0,k({type:`set-form`,updater:t=>({...t,updateCheckOnStart:e.target.checked})})}}),(0,q.jsxs)(`span`,{children:[(0,q.jsx)(`span`,{className:`font-medium`,children:n.updateCheckOnStart}),(0,q.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-subtle`,children:n.updateCheckOnStartHint})]})]}),(0,q.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:A.updateAutoEnabled,onChange:e=>{U.current=!0,k({type:`set-form`,updater:t=>({...t,updateAutoEnabled:e.target.checked})})}}),(0,q.jsxs)(`span`,{children:[(0,q.jsx)(`span`,{className:`font-medium`,children:n.updateAutoEnabled}),(0,q.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-subtle`,children:n.updateAutoEnabledHint})]})]}),(0,q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:`update-auto-stable-delay`,children:n.updateAutoStableDelayHours}),(0,q.jsx)(`input`,{id:`update-auto-stable-delay`,type:`number`,min:0,disabled:!A.updateAutoEnabled,className:X(),value:A.updateAutoStableDelayHours,onChange:e=>{U.current=!0,k({type:`set-form`,updater:t=>({...t,updateAutoStableDelayHours:Math.max(0,Math.floor(Number(e.target.value)||0))})})}}),(0,q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:n.updateAutoStableDelayHoursHint})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:`update-auto-stable-jitter`,children:n.updateAutoStableJitterHours}),(0,q.jsx)(`input`,{id:`update-auto-stable-jitter`,type:`number`,min:0,disabled:!A.updateAutoEnabled,className:X(),value:A.updateAutoStableJitterHours,onChange:e=>{U.current=!0,k({type:`set-form`,updater:t=>({...t,updateAutoStableJitterHours:Math.max(0,Math.floor(Number(e.target.value)||0))})})}}),(0,q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:n.updateAutoStableJitterHoursHint})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:`update-auto-beta-interval`,children:n.updateAutoBetaCheckIntervalHours}),(0,q.jsx)(`input`,{id:`update-auto-beta-interval`,type:`number`,min:.25,step:.25,disabled:!A.updateAutoEnabled,className:X(),value:A.updateAutoBetaCheckIntervalHours,onChange:e=>{U.current=!0,k({type:`set-form`,updater:t=>({...t,updateAutoBetaCheckIntervalHours:Math.max(.25,Number(e.target.value)||1)})})}}),(0,q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:n.updateAutoBetaCheckIntervalHoursHint})]})]})]})]}),(0,q.jsxs)(Q,{g:n,id:`security`,activeTab:p,children:[(0,q.jsx)(me,{enabled:D,refreshToken:ae}),(0,q.jsx)(Oe,{g:n,form:A,onSecurityStrictChange:Ue,onDangerouslyAllowHostHeaderOriginFallbackChange:Ge})]}),(0,q.jsx)(Q,{g:n,id:`advanced`,activeTab:p,children:(0,q.jsx)(Ae,{g:n,form:A,onMaxSseConnectionsChange:Le,onDeferModeChange:Re,onDeferIdsChange:ze,onSkipIdsChange:Be})})]}):(0,q.jsxs)(te,{gap:`gap-3`,padding:`px-3 py-8 sm:px-5 xl:px-6`,children:[(0,q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:ie??ve??n.loadError}),(0,q.jsx)(w,{type:`button`,variant:`secondary`,onClick:()=>void ge(),children:n.retry})]}):(0,q.jsxs)(te,{gap:`gap-3`,padding:`px-3 py-8 sm:px-5 xl:px-6`,children:[(0,q.jsx)(ee,{title:t.settingsSections.gateway}),(0,q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.needToken})]})}function De(e){let t=(0,H.c)(10),{g:n,activeTab:r,visibleTabs:i,onChange:a}=e,o;if(t[0]!==n||t[1]!==i){let e;t[3]===n?e=t[4]:(e=e=>({id:e,label:Z(n,e),icon:xe[e]}),t[3]=n,t[4]=e),o=i.map(e),t[0]=n,t[1]=i,t[2]=o}else o=t[2];let s=o,c;return t[5]!==r||t[6]!==n.tabsAriaLabel||t[7]!==s||t[8]!==a?(c=(0,q.jsx)(ae,{items:s,activeTab:r,onChange:a,ariaLabel:n.tabsAriaLabel,tabIdPrefix:`gateway-settings-tab`,panelIdPrefix:`gateway-settings-panel`}),t[5]=r,t[6]=n.tabsAriaLabel,t[7]=s,t[8]=a,t[9]=c):c=t[9],c}function Q(e){let t=(0,H.c)(14),{g:n,id:r,activeTab:i,children:a}=e,o;t[0]!==n||t[1]!==r?(o=Z(n,r),t[0]=n,t[1]=r,t[2]=o):o=t[2];let s;t[3]!==n||t[4]!==r?(s=Ce(n,r),t[3]=n,t[4]=r,t[5]=s):s=t[5];let c;t[6]===a?c=t[7]:(c=(0,q.jsx)(`div`,{className:`space-y-4`,children:a}),t[6]=a,t[7]=c);let l;return t[8]!==i||t[9]!==r||t[10]!==o||t[11]!==s||t[12]!==c?(l=(0,q.jsx)(z,{id:r,activeTab:i,tabIdPrefix:`gateway-settings-tab`,panelIdPrefix:`gateway-settings-panel`,title:o,hint:s,children:c}),t[8]=i,t[9]=r,t[10]=o,t[11]=s,t[12]=c,t[13]=l):l=t[13],l}function Oe(e){let t=(0,H.c)(37),{g:n,form:r,onSecurityStrictChange:i,onDangerouslyAllowHostHeaderOriginFallbackChange:a}=e,o;t[0]===i?o=t[1]:(o=e=>i(e.target.checked),t[0]=i,t[1]=o);let s;t[2]!==r.securityStrict||t[3]!==o?(s=(0,q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:r.securityStrict,onChange:o}),t[2]=r.securityStrict,t[3]=o,t[4]=s):s=t[4];let c;t[5]===n.securityStrict?c=t[6]:(c=(0,q.jsx)(`span`,{className:`font-medium`,children:n.securityStrict}),t[5]=n.securityStrict,t[6]=c);let l;t[7]===n.securityStrictHint?l=t[8]:(l=(0,q.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-subtle`,children:n.securityStrictHint}),t[7]=n.securityStrictHint,t[8]=l);let u;t[9]!==c||t[10]!==l?(u=(0,q.jsxs)(`span`,{children:[c,l]}),t[9]=c,t[10]=l,t[11]=u):u=t[11];let d;t[12]!==s||t[13]!==u?(d=(0,q.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[s,u]}),t[12]=s,t[13]=u,t[14]=d):d=t[14];let f;t[15]===a?f=t[16]:(f=e=>a(e.target.checked),t[15]=a,t[16]=f);let p;t[17]!==r.dangerouslyAllowHostHeaderOriginFallback||t[18]!==f?(p=(0,q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:r.dangerouslyAllowHostHeaderOriginFallback,onChange:f}),t[17]=r.dangerouslyAllowHostHeaderOriginFallback,t[18]=f,t[19]=p):p=t[19];let m;t[20]===n.dangerouslyAllowHostHeaderOriginFallback?m=t[21]:(m=(0,q.jsx)(`span`,{className:`font-medium`,children:n.dangerouslyAllowHostHeaderOriginFallback}),t[20]=n.dangerouslyAllowHostHeaderOriginFallback,t[21]=m);let h;t[22]===n.dangerouslyAllowHostHeaderOriginFallbackHint?h=t[23]:(h=(0,q.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-subtle`,children:n.dangerouslyAllowHostHeaderOriginFallbackHint}),t[22]=n.dangerouslyAllowHostHeaderOriginFallbackHint,t[23]=h);let g;t[24]!==h||t[25]!==m?(g=(0,q.jsxs)(`span`,{children:[m,h]}),t[24]=h,t[25]=m,t[26]=g):g=t[26];let _;t[27]!==g||t[28]!==p?(_=(0,q.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[p,g]}),t[27]=g,t[28]=p,t[29]=_):_=t[29];let v;t[30]!==r.dangerouslyAllowHostHeaderOriginFallback||t[31]!==n.dangerouslyAllowHostHeaderOriginFallbackWarning?(v=r.dangerouslyAllowHostHeaderOriginFallback?(0,q.jsx)(`p`,{className:`rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:border-amber-800 dark:bg-amber-950/40 dark:text-amber-100`,children:n.dangerouslyAllowHostHeaderOriginFallbackWarning}):null,t[30]=r.dangerouslyAllowHostHeaderOriginFallback,t[31]=n.dangerouslyAllowHostHeaderOriginFallbackWarning,t[32]=v):v=t[32];let y;return t[33]!==_||t[34]!==v||t[35]!==d?(y=(0,q.jsxs)(`div`,{className:`space-y-4`,children:[d,_,v]}),t[33]=_,t[34]=v,t[35]=d,t[36]=y):y=t[36],y}function ke(e){let t=(0,H.c)(80),{g:n,form:r,onTrustedProxyChange:i,onTrustedProxiesChange:o,onAllowRealIpFallbackChange:s}=e,c=r.auth.trustedProxy,l;t[0]===n.authModeTrustedProxyHint?l=t[1]:(l=(0,q.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.authModeTrustedProxyHint}),t[0]=n.authModeTrustedProxyHint,t[1]=l);let u;t[2]===n.trustedProxyUserHeader?u=t[3]:(u=(0,q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:`gateway-trusted-proxy-user-header`,children:n.trustedProxyUserHeader}),t[2]=n.trustedProxyUserHeader,t[3]=u);let d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=a(X(),`font-mono text-xs`),t[4]=d):d=t[4];let f;t[5]===i?f=t[6]:(f=e=>i({userHeader:e.target.value}),t[5]=i,t[6]=f);let p;t[7]!==n.trustedProxyUserHeaderPlaceholder||t[8]!==f||t[9]!==c.userHeader?(p=(0,q.jsx)(`input`,{id:`gateway-trusted-proxy-user-header`,className:d,value:c.userHeader,onChange:f,placeholder:n.trustedProxyUserHeaderPlaceholder,autoComplete:`off`}),t[7]=n.trustedProxyUserHeaderPlaceholder,t[8]=f,t[9]=c.userHeader,t[10]=p):p=t[10];let m;t[11]===n.trustedProxyUserHeaderHint?m=t[12]:(m=(0,q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:n.trustedProxyUserHeaderHint}),t[11]=n.trustedProxyUserHeaderHint,t[12]=m);let h;t[13]!==u||t[14]!==p||t[15]!==m?(h=(0,q.jsxs)(`div`,{children:[u,p,m]}),t[13]=u,t[14]=p,t[15]=m,t[16]=h):h=t[16];let g;t[17]===i?g=t[18]:(g=e=>i({requiredHeaders:e}),t[17]=i,t[18]=g);let _;t[19]!==n.channelIdListEmpty||t[20]!==n.trustedProxyRequiredHeaders||t[21]!==n.trustedProxyRequiredHeadersHint||t[22]!==n.trustedProxyUserHeaderPlaceholder||t[23]!==g||t[24]!==c.requiredHeaders?(_=(0,q.jsx)($,{title:n.trustedProxyRequiredHeaders,hint:n.trustedProxyRequiredHeadersHint,emptyText:n.channelIdListEmpty,placeholder:n.trustedProxyUserHeaderPlaceholder,values:c.requiredHeaders,maxItems:32,onChange:g}),t[19]=n.channelIdListEmpty,t[20]=n.trustedProxyRequiredHeaders,t[21]=n.trustedProxyRequiredHeadersHint,t[22]=n.trustedProxyUserHeaderPlaceholder,t[23]=g,t[24]=c.requiredHeaders,t[25]=_):_=t[25];let v;t[26]===i?v=t[27]:(v=e=>i({allowUsers:e}),t[26]=i,t[27]=v);let y;t[28]!==n.channelIdListEmpty||t[29]!==n.trustedProxyAllowUsers||t[30]!==n.trustedProxyAllowUsersHint||t[31]!==n.trustedProxyUserHeaderPlaceholder||t[32]!==v||t[33]!==c.allowUsers?(y=(0,q.jsx)($,{title:n.trustedProxyAllowUsers,hint:n.trustedProxyAllowUsersHint,emptyText:n.channelIdListEmpty,placeholder:n.trustedProxyUserHeaderPlaceholder,values:c.allowUsers,maxItems:128,onChange:v}),t[28]=n.channelIdListEmpty,t[29]=n.trustedProxyAllowUsers,t[30]=n.trustedProxyAllowUsersHint,t[31]=n.trustedProxyUserHeaderPlaceholder,t[32]=v,t[33]=c.allowUsers,t[34]=y):y=t[34];let b;t[35]===i?b=t[36]:(b=e=>i({allowLoopback:e.target.checked}),t[35]=i,t[36]=b);let x;t[37]!==b||t[38]!==c.allowLoopback?(x=(0,q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:c.allowLoopback,onChange:b}),t[37]=b,t[38]=c.allowLoopback,t[39]=x):x=t[39];let S;t[40]===n.trustedProxyAllowLoopback?S=t[41]:(S=(0,q.jsx)(`span`,{className:`font-medium`,children:n.trustedProxyAllowLoopback}),t[40]=n.trustedProxyAllowLoopback,t[41]=S);let C;t[42]===n.trustedProxyAllowLoopbackHint?C=t[43]:(C=(0,q.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-subtle`,children:n.trustedProxyAllowLoopbackHint}),t[42]=n.trustedProxyAllowLoopbackHint,t[43]=C);let w;t[44]!==S||t[45]!==C?(w=(0,q.jsxs)(`span`,{children:[S,C]}),t[44]=S,t[45]=C,t[46]=w):w=t[46];let T;t[47]!==x||t[48]!==w?(T=(0,q.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[x,w]}),t[47]=x,t[48]=w,t[49]=T):T=t[49];let E;t[50]!==r.trustedProxies||t[51]!==n.trustedProxies||t[52]!==n.trustedProxiesEmpty||t[53]!==n.trustedProxiesHint||t[54]!==n.trustedProxiesPlaceholder||t[55]!==o?(E=(0,q.jsx)($,{title:n.trustedProxies,hint:n.trustedProxiesHint,emptyText:n.trustedProxiesEmpty,placeholder:n.trustedProxiesPlaceholder,values:r.trustedProxies,maxItems:64,onChange:o}),t[50]=r.trustedProxies,t[51]=n.trustedProxies,t[52]=n.trustedProxiesEmpty,t[53]=n.trustedProxiesHint,t[54]=n.trustedProxiesPlaceholder,t[55]=o,t[56]=E):E=t[56];let D;t[57]===s?D=t[58]:(D=e=>s(e.target.checked),t[57]=s,t[58]=D);let O;t[59]!==r.allowRealIpFallback||t[60]!==D?(O=(0,q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:r.allowRealIpFallback,onChange:D}),t[59]=r.allowRealIpFallback,t[60]=D,t[61]=O):O=t[61];let k;t[62]===n.allowRealIpFallback?k=t[63]:(k=(0,q.jsx)(`span`,{className:`font-medium`,children:n.allowRealIpFallback}),t[62]=n.allowRealIpFallback,t[63]=k);let A;t[64]===n.allowRealIpFallbackHint?A=t[65]:(A=(0,q.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-subtle`,children:n.allowRealIpFallbackHint}),t[64]=n.allowRealIpFallbackHint,t[65]=A);let j;t[66]!==k||t[67]!==A?(j=(0,q.jsxs)(`span`,{children:[k,A]}),t[66]=k,t[67]=A,t[68]=j):j=t[68];let M;t[69]!==O||t[70]!==j?(M=(0,q.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[O,j]}),t[69]=O,t[70]=j,t[71]=M):M=t[71];let N;return t[72]!==l||t[73]!==y||t[74]!==T||t[75]!==E||t[76]!==M||t[77]!==h||t[78]!==_?(N=(0,q.jsxs)(`div`,{className:`space-y-4 border-t border-edge pt-4`,children:[l,h,_,y,T,E,M]}),t[72]=l,t[73]=y,t[74]=T,t[75]=E,t[76]=M,t[77]=h,t[78]=_,t[79]=N):N=t[79],N}function Ae(e){let t=(0,H.c)(58),{g:n,form:r,onMaxSseConnectionsChange:i,onDeferModeChange:o,onDeferIdsChange:s,onSkipIdsChange:c}=e,l;t[0]===n.maxSseConnections?l=t[1]:(l=(0,q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:`gateway-max-sse`,children:n.maxSseConnections}),t[0]=n.maxSseConnections,t[1]=l);let u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=a(X(),`max-w-xs font-mono text-xs`),t[2]=u):u=t[2];let d;t[3]===i?d=t[4]:(d=e=>{let t=Number(e.target.value);Number.isFinite(t)&&i(Math.max(1,Math.floor(t)))},t[3]=i,t[4]=d);let f;t[5]!==r.maxSseConnections||t[6]!==d?(f=(0,q.jsx)(`input`,{id:`gateway-max-sse`,type:`number`,min:1,className:u,value:r.maxSseConnections,onChange:d}),t[5]=r.maxSseConnections,t[6]=d,t[7]=f):f=t[7];let p;t[8]===n.maxSseConnectionsHint?p=t[9]:(p=(0,q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:n.maxSseConnectionsHint}),t[8]=n.maxSseConnectionsHint,t[9]=p);let m;t[10]!==l||t[11]!==f||t[12]!==p?(m=(0,q.jsxs)(`div`,{children:[l,f,p]}),t[10]=l,t[11]=f,t[12]=p,t[13]=m):m=t[13];let h;t[14]===n.channelConnectDeferMode?h=t[15]:(h=(0,q.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`gateway-channel-defer-mode`,children:n.channelConnectDeferMode}),t[14]=n.channelConnectDeferMode,t[15]=h);let _=r.channelConnectDeferMode,v;t[16]===o?v=t[17]:(v=e=>o(e.target.value),t[16]=o,t[17]=v);let y;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(y=X(),t[18]=y):y=t[18];let b;t[19]===n.channelConnectDeferModeAuto?b=t[20]:(b=(0,q.jsx)(P,{value:`auto`,children:n.channelConnectDeferModeAuto}),t[19]=n.channelConnectDeferModeAuto,t[20]=b);let x;t[21]===n.channelConnectDeferModeOff?x=t[22]:(x=(0,q.jsx)(P,{value:`off`,children:n.channelConnectDeferModeOff}),t[21]=n.channelConnectDeferModeOff,t[22]=x);let S;t[23]===n.channelConnectDeferModeExplicit?S=t[24]:(S=(0,q.jsx)(P,{value:`explicit`,children:n.channelConnectDeferModeExplicit}),t[23]=n.channelConnectDeferModeExplicit,t[24]=S);let C;t[25]!==r.channelConnectDeferMode||t[26]!==b||t[27]!==x||t[28]!==S||t[29]!==v?(C=(0,q.jsxs)(g,{id:`gateway-channel-defer-mode`,value:_,onChange:v,className:y,children:[b,x,S]}),t[25]=r.channelConnectDeferMode,t[26]=b,t[27]=x,t[28]=S,t[29]=v,t[30]=C):C=t[30];let w;t[31]===n.channelConnectDeferModeHint?w=t[32]:(w=(0,q.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.channelConnectDeferModeHint}),t[31]=n.channelConnectDeferModeHint,t[32]=w);let T;t[33]!==C||t[34]!==w||t[35]!==h?(T=(0,q.jsxs)(`div`,{className:`space-y-2 border-t border-edge pt-4`,children:[h,C,w]}),t[33]=C,t[34]=w,t[35]=h,t[36]=T):T=t[36];let E;t[37]!==r.channelConnectDeferIds||t[38]!==r.channelConnectDeferMode||t[39]!==n.channelConnectDeferIds||t[40]!==n.channelConnectDeferIdsHint||t[41]!==n.channelIdListEmpty||t[42]!==n.channelIdListPlaceholder||t[43]!==s?(E=r.channelConnectDeferMode===`explicit`?(0,q.jsx)($,{title:n.channelConnectDeferIds,hint:n.channelConnectDeferIdsHint,emptyText:n.channelIdListEmpty,placeholder:n.channelIdListPlaceholder,values:r.channelConnectDeferIds,maxItems:24,onChange:s}):null,t[37]=r.channelConnectDeferIds,t[38]=r.channelConnectDeferMode,t[39]=n.channelConnectDeferIds,t[40]=n.channelConnectDeferIdsHint,t[41]=n.channelIdListEmpty,t[42]=n.channelIdListPlaceholder,t[43]=s,t[44]=E):E=t[44];let D;t[45]!==r.channelConnectDeferMode||t[46]!==r.channelConnectDeferSkipIds||t[47]!==n.channelConnectDeferSkipIds||t[48]!==n.channelConnectDeferSkipIdsHint||t[49]!==n.channelIdListEmpty||t[50]!==n.channelIdListPlaceholder||t[51]!==c?(D=r.channelConnectDeferMode===`off`?null:(0,q.jsx)($,{title:n.channelConnectDeferSkipIds,hint:n.channelConnectDeferSkipIdsHint,emptyText:n.channelIdListEmpty,placeholder:n.channelIdListPlaceholder,values:r.channelConnectDeferSkipIds,maxItems:24,onChange:c}),t[45]=r.channelConnectDeferMode,t[46]=r.channelConnectDeferSkipIds,t[47]=n.channelConnectDeferSkipIds,t[48]=n.channelConnectDeferSkipIdsHint,t[49]=n.channelIdListEmpty,t[50]=n.channelIdListPlaceholder,t[51]=c,t[52]=D):D=t[52];let O;return t[53]!==T||t[54]!==E||t[55]!==D||t[56]!==m?(O=(0,q.jsxs)(`div`,{className:`space-y-4`,children:[m,T,E,D]}),t[53]=T,t[54]=E,t[55]=D,t[56]=m,t[57]=O):O=t[57],O}function $(e){let t=(0,H.c)(25),{title:n,hint:r,emptyText:i,placeholder:o,values:s,maxItems:c,onChange:l,children:u}=e,d;t[0]!==c||t[1]!==l||t[2]!==s?(d=e=>{let t=e.trim();!t||s.includes(t)||s.length>=c||l([...s,t])},t[0]=c,t[1]=l,t[2]=s,t[3]=d):d=t[3];let f=d,p;t[4]===n?p=t[5]:(p=(0,q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n}),t[4]=n,t[5]=p);let m;t[6]===r?m=t[7]:(m=(0,q.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:r}),t[6]=r,t[7]=m);let h;t[8]!==i||t[9]!==l||t[10]!==s?(h=s.length===0?(0,q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i}):(0,q.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:s.map(e=>(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-edge bg-surface-panel px-2 py-0.5 font-mono text-xs text-fg`,children:[e,(0,q.jsx)(`button`,{type:`button`,className:a(`text-fg-muted hover:text-fg`,k.press),"aria-label":`Remove ${e}`,onClick:()=>l(s.filter(t=>t!==e)),children:`×`})]},e))}),t[8]=i,t[9]=l,t[10]=s,t[11]=h):h=t[11];let g;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(g=a(X(),`font-mono text-xs`),t[12]=g):g=t[12];let _=s.length>=c,v;t[13]===f?v=t[14]:(v=e=>{e.key===`Enter`&&(e.preventDefault(),f(e.target.value),e.target.value=``)},t[13]=f,t[14]=v);let y;t[15]!==o||t[16]!==_||t[17]!==v?(y=(0,q.jsx)(`input`,{className:g,placeholder:o,disabled:_,onKeyDown:v}),t[15]=o,t[16]=_,t[17]=v,t[18]=y):y=t[18];let b;return t[19]!==u||t[20]!==p||t[21]!==m||t[22]!==h||t[23]!==y?(b=(0,q.jsxs)(`div`,{className:`space-y-2 border-t border-edge pt-4`,children:[p,m,h,y,u]}),t[19]=u,t[20]=p,t[21]=m,t[22]=h,t[23]=y,t[24]=b):b=t[24],b}function je(e){let t=(0,H.c)(13),{g:n,origins:r,onChange:i}=e,a;t[0]===r?a=t[1]:(a=r.includes(`*`),t[0]=r,t[1]=a);let o=a,s;t[2]!==n.corsOriginsWildcardWarning||t[3]!==o?(s=o?(0,q.jsx)(`p`,{className:`rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:border-amber-800 dark:bg-amber-950/40 dark:text-amber-100`,children:n.corsOriginsWildcardWarning}):null,t[2]=n.corsOriginsWildcardWarning,t[3]=o,t[4]=s):s=t[4];let c;return t[5]!==n.corsOrigins||t[6]!==n.corsOriginsEmpty||t[7]!==n.corsOriginsHint||t[8]!==n.corsOriginsPlaceholder||t[9]!==i||t[10]!==r||t[11]!==s?(c=(0,q.jsx)($,{title:n.corsOrigins,hint:n.corsOriginsHint,emptyText:n.corsOriginsEmpty,placeholder:n.corsOriginsPlaceholder,values:r,maxItems:128,onChange:i,children:s}),t[5]=n.corsOrigins,t[6]=n.corsOriginsEmpty,t[7]=n.corsOriginsHint,t[8]=n.corsOriginsPlaceholder,t[9]=i,t[10]=r,t[11]=s,t[12]=c):c=t[12],c}function Me(e){let t=(0,H.c)(73),{g:n,rateLimit:r,onChange:i}=e,a;t[0]===n.rateLimitTitle?a=t[1]:(a=(0,q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n.rateLimitTitle}),t[0]=n.rateLimitTitle,t[1]=a);let o;t[2]===n.rateLimitHint?o=t[3]:(o=(0,q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:n.rateLimitHint}),t[2]=n.rateLimitHint,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,q.jsxs)(`div`,{children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;t[7]===i?c=t[8]:(c=e=>i({enabled:e.target.checked}),t[7]=i,t[8]=c);let l;t[9]!==r.enabled||t[10]!==c?(l=(0,q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:r.enabled,onChange:c}),t[9]=r.enabled,t[10]=c,t[11]=l):l=t[11];let u;t[12]!==n.rateLimitEnabled||t[13]!==l?(u=(0,q.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[l,n.rateLimitEnabled]}),t[12]=n.rateLimitEnabled,t[13]=l,t[14]=u):u=t[14];let d=!r.enabled,f;t[15]===i?f=t[16]:(f=e=>i({exemptLoopback:e.target.checked}),t[15]=i,t[16]=f);let p;t[17]!==r.exemptLoopback||t[18]!==d||t[19]!==f?(p=(0,q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:r.exemptLoopback,disabled:d,onChange:f}),t[17]=r.exemptLoopback,t[18]=d,t[19]=f,t[20]=p):p=t[20];let m;t[21]!==n.rateLimitExemptLoopback||t[22]!==p?(m=(0,q.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[p,n.rateLimitExemptLoopback]}),t[21]=n.rateLimitExemptLoopback,t[22]=p,t[23]=m):m=t[23];let h;t[24]===n.rateLimitMaxAttempts?h=t[25]:(h=(0,q.jsx)(`label`,{className:`mb-1 block text-xs font-medium text-fg-muted`,htmlFor:`gateway-rate-max`,children:n.rateLimitMaxAttempts}),t[24]=n.rateLimitMaxAttempts,t[25]=h);let g;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(g=X(),t[26]=g):g=t[26];let _=!r.enabled,v;t[27]===i?v=t[28]:(v=e=>{let t=Number(e.target.value);Number.isFinite(t)&&i({maxAttempts:Math.max(1,Math.floor(t))})},t[27]=i,t[28]=v);let y;t[29]!==r.maxAttempts||t[30]!==_||t[31]!==v?(y=(0,q.jsx)(`input`,{id:`gateway-rate-max`,type:`number`,min:1,className:g,value:r.maxAttempts,disabled:_,onChange:v}),t[29]=r.maxAttempts,t[30]=_,t[31]=v,t[32]=y):y=t[32];let b;t[33]!==h||t[34]!==y?(b=(0,q.jsxs)(`div`,{children:[h,y]}),t[33]=h,t[34]=y,t[35]=b):b=t[35];let x;t[36]===n.rateLimitWindowMinutes?x=t[37]:(x=(0,q.jsx)(`label`,{className:`mb-1 block text-xs font-medium text-fg-muted`,htmlFor:`gateway-rate-window`,children:n.rateLimitWindowMinutes}),t[36]=n.rateLimitWindowMinutes,t[37]=x);let S;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(S=X(),t[38]=S):S=t[38];let C;t[39]===r.windowMs?C=t[40]:(C=Math.round(r.windowMs/6e4),t[39]=r.windowMs,t[40]=C);let w=!r.enabled,T;t[41]===i?T=t[42]:(T=e=>{let t=Number(e.target.value);Number.isFinite(t)&&t>0&&i({windowMs:Math.floor(t)*6e4})},t[41]=i,t[42]=T);let E;t[43]!==C||t[44]!==w||t[45]!==T?(E=(0,q.jsx)(`input`,{id:`gateway-rate-window`,type:`number`,min:1,className:S,value:C,disabled:w,onChange:T}),t[43]=C,t[44]=w,t[45]=T,t[46]=E):E=t[46];let D;t[47]!==x||t[48]!==E?(D=(0,q.jsxs)(`div`,{children:[x,E]}),t[47]=x,t[48]=E,t[49]=D):D=t[49];let O;t[50]===n.rateLimitBlockMinutes?O=t[51]:(O=(0,q.jsx)(`label`,{className:`mb-1 block text-xs font-medium text-fg-muted`,htmlFor:`gateway-rate-block`,children:n.rateLimitBlockMinutes}),t[50]=n.rateLimitBlockMinutes,t[51]=O);let k;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(k=X(),t[52]=k):k=t[52];let A;t[53]===r.blockDurationMs?A=t[54]:(A=Math.round(r.blockDurationMs/6e4),t[53]=r.blockDurationMs,t[54]=A);let j=!r.enabled,M;t[55]===i?M=t[56]:(M=e=>{let t=Number(e.target.value);Number.isFinite(t)&&t>0&&i({blockDurationMs:Math.floor(t)*6e4})},t[55]=i,t[56]=M);let N;t[57]!==A||t[58]!==j||t[59]!==M?(N=(0,q.jsx)(`input`,{id:`gateway-rate-block`,type:`number`,min:1,className:k,value:A,disabled:j,onChange:M}),t[57]=A,t[58]=j,t[59]=M,t[60]=N):N=t[60];let P;t[61]!==O||t[62]!==N?(P=(0,q.jsxs)(`div`,{children:[O,N]}),t[61]=O,t[62]=N,t[63]=P):P=t[63];let F;t[64]!==b||t[65]!==D||t[66]!==P?(F=(0,q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[b,D,P]}),t[64]=b,t[65]=D,t[66]=P,t[67]=F):F=t[67];let I;return t[68]!==m||t[69]!==s||t[70]!==F||t[71]!==u?(I=(0,q.jsxs)(`div`,{className:`space-y-3 border-t border-edge pt-4`,children:[s,u,m,F]}),t[68]=m,t[69]=s,t[70]=F,t[71]=u,t[72]=I):I=t[72],I}function Ne(e){let t=(0,H.c)(17),{id:n,label:r,help:i,placeholder:a,value:o,labels:s,reveal:c,loadFailedLabel:l,onChange:u}=e,d;t[0]!==n||t[1]!==r?(d=(0,q.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:n,children:r}),t[0]=n,t[1]=r,t[2]=d):d=t[2];let f;t[3]!==n||t[4]!==s||t[5]!==l||t[6]!==u||t[7]!==a||t[8]!==c||t[9]!==o?(f=(0,q.jsx)(N,{id:n,value:o,onChange:u,placeholder:a,labels:s,reveal:c,loadFailedLabel:l,inputClassName:`text-xs`}),t[3]=n,t[4]=s,t[5]=l,t[6]=u,t[7]=a,t[8]=c,t[9]=o,t[10]=f):f=t[10];let p;t[11]===i?p=t[12]:(p=(0,q.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:i}),t[11]=i,t[12]=p);let m;return t[13]!==d||t[14]!==f||t[15]!==p?(m=(0,q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[d,f,p]}),t[13]=d,t[14]=f,t[15]=p,t[16]=m):m=t[16],m}export{Ee as GatewaySettingsPanel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./cn-BQ_8x0bT.js";import{t as i}from"./messages-Bwu1tG3T.js";import{n as a}from"./locale-store-d9Cylz62.js";import{$s as ee,Fo as o,Go as s,Ko as c,Ks as l,Lt as u,Mo as d,Ms as f,No as p,Po as m,Rr as h,Tc as g,dt as _,gc as v,hs as y,jo as b,ko as x,qo as S,tu as C,ys as w,zr as T}from"./index-DHRxn7Sy.js";var E=e(t(),1);function D(){return{title:``,objective:``,description:``,attachments:[],checklist:[``],scopeBoundary:``,evidencePlan:[``],priority:`normal`,deadlineMode:`none`,deadline:``,maxTurns:`10`,agentId:``,judgeModelRef:``}}function O(e){let t=new Set,n=[];for(let r of e){let e=r.trim(),i=e.toLowerCase();!e||t.has(i)||(t.add(i),n.push(e))}return n}var k=n();function A(e,t){return Object.entries(t).reduce((e,[t,n])=>e.replaceAll(`{{${t}}}`,String(n)),e)}function j(e){let t=e=>String(e).padStart(2,`0`);return[e.getFullYear(),`-`,t(e.getMonth()+1),`-`,t(e.getDate()),`T`,t(e.getHours()),`:`,t(e.getMinutes())].join(``)}function M(e){let t=new Date;return t.setDate(t.getDate()+e),t.setHours(23,59,0,0),j(t)}function N(){let e=new Date,t=e.getDay(),n=t<=5?5-t:7-t+5;return e.setDate(e.getDate()+n),e.setHours(23,59,0,0),j(e)}function P(e){if(e===`today`)return M(0);if(e===`tomorrow`)return M(1);if(e===`friday`)return N();if(e===`custom`){let e=new Date;return e.setHours(e.getHours()+1,0,0,0),j(e)}return``}function F({open:e,t,chat:n,busy:j,options:M,onClose:N,onCreate:F,onDraftContract:I}){let L=i(a(e=>e.language)).agentsSettings,[R,z]=(0,E.useState)(()=>D()),[B,V]=(0,E.useState)(!1),[H,U]=(0,E.useState)(!1),[W,G]=(0,E.useState)(null),[K,q]=(0,E.useState)(!1),J=_({chat:n});(0,E.useEffect)(()=>{e||(z(D()),V(!1),U(!1),G(null),q(!1),J.clearAttachments())},[J.clearAttachments,e]),(0,E.useEffect)(()=>{!e||!M.defaultAgentId||z(e=>e.agentId?e:{...e,agentId:M.defaultAgentId})},[e,M.defaultAgentId]);let Y=e=>z(t=>({...t,...e})),X=M.agents.length?M.agents:[{id:M.defaultAgentId||`main`,workspace:``,profileDir:``,typedModels:{defaultRole:`deep`,preset:[],effective:[]},extends:[],isDefault:!0,skills:{preset:[]},tools:{presetDenied:[],entryDisable:[],effectiveDisable:[]}}],Z=X.find(e=>e.id===R.agentId)??X.find(e=>e.id===M.defaultAgentId)??X[0],Q=Z?h(Z,L):``,te=R.agentId||Z?.id||`main`,$=[...Z?.typedModels.effective??[]].sort((e,t)=>e.id===`judge`?-1:t.id===`judge`?1:e.id.localeCompare(t.id)),ne=M.models.filter((e,t,n)=>n.findIndex(t=>t.id===e.id)===t),re=e=>{Y({deadlineMode:e,deadline:P(e)})},ie=(e,t)=>{z(n=>({...n,checklist:n.checklist.map((n,r)=>r===e?t:n)}))},ae=e=>{z(t=>({...t,checklist:t.checklist.filter((t,n)=>n!==e)}))},oe=(e,t)=>{z(n=>({...n,evidencePlan:n.evidencePlan.map((n,r)=>r===e?t:n)}))},se=e=>{z(t=>({...t,evidencePlan:t.evidencePlan.filter((t,n)=>n!==e)}))},ce=async()=>{G(null),q(!0);try{Y(I?await I({...R,attachments:J.wireAttachmentsPayload()}):{objective:R.objective||R.title,scopeBoundary:R.scopeBoundary,evidencePlan:O(R.evidencePlan).length?R.evidencePlan:[...t.createDialog.defaultEvidencePlan],checklist:R.checklist}),V(!0)}catch(e){G(e instanceof Error?e.message:t.createDialog.draftFailed)}finally{q(!1)}},le=async()=>{if(G(null),!R.title.trim()){G(t.createDialog.titleRequired);return}try{await F({...R,attachments:J.wireAttachmentsPayload(),checklist:O(R.checklist)}),N()}catch(e){G(e instanceof Error?e.message:t.errors.create)}};return(0,k.jsx)(x,{open:e,onOpenChange:e=>!e&&N(),children:(0,k.jsxs)(m,{children:[(0,k.jsx)(p,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),(0,k.jsxs)(b,{className:`fixed left-1/2 top-1/2 z-66 flex h-[min(92vh,46rem)] w-[min(100%-2rem,44rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:[(0,k.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-5 py-4`,children:[(0,k.jsxs)(`div`,{className:`min-w-0`,children:[(0,k.jsx)(o,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.createDialog.title}),(0,k.jsx)(d,{className:`mt-1 truncate text-sm text-fg-muted`,children:t.createDialog.description})]}),(0,k.jsx)(y,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":t.closeDetails,onClick:N,children:(0,k.jsx)(w,{className:`size-5`,"aria-hidden":!0})})]}),(0,k.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:(0,k.jsxs)(`div`,{className:`grid gap-4`,children:[(0,k.jsx)(`section`,{className:`rounded-lg border border-accent/25 bg-accent-soft/50 p-3`,children:(0,k.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,k.jsxs)(`div`,{className:`min-w-0`,children:[(0,k.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.createDialog.simpleStartTitle}),(0,k.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.createDialog.simpleStartHint})]}),(0,k.jsxs)(y,{type:`button`,variant:`secondary`,className:`h-8 shrink-0 rounded-lg text-xs`,onClick:()=>void ce(),disabled:K||!R.title.trim()&&!R.description.trim(),children:[(0,k.jsx)(l,{className:`size-3.5`,"aria-hidden":!0}),K?t.createDialog.drafting:t.createDialog.aiDraft]})]})}),(0,k.jsxs)(`label`,{className:`grid gap-1.5`,children:[(0,k.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:t.createDialog.goalTitle}),(0,k.jsx)(`input`,{value:R.title,onChange:e=>Y({title:e.target.value}),placeholder:t.newGoalPlaceholder,className:`rounded-lg border border-edge bg-surface-muted px-3 py-2 text-sm text-fg placeholder:text-fg-muted focus-visible:border-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent`})]}),(0,k.jsxs)(`label`,{className:`grid gap-1.5`,children:[(0,k.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,k.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:t.createDialog.goalDescription}),(0,k.jsxs)(y,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:()=>J.fileInputRef.current?.click(),children:[(0,k.jsx)(g,{className:`size-3.5`,"aria-hidden":!0}),t.createDialog.addAttachment]})]}),(0,k.jsx)(`textarea`,{value:R.description,onChange:e=>Y({description:e.target.value}),placeholder:t.createDialog.descriptionPlaceholder,rows:4,className:`resize-none rounded-lg border border-edge bg-surface-muted px-3 py-2 text-sm text-fg placeholder:text-fg-muted focus-visible:border-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent`}),(0,k.jsx)(`input`,{ref:J.fileInputRef,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{let t=Array.from(e.currentTarget.files??[]);e.currentTarget.value=``,J.processFiles(t)}}),(0,k.jsx)(u,{attachments:J.attachments,topPadded:!1,onRemove:J.removeAttachment})]}),(0,k.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base/60`,children:[(0,k.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between gap-3 px-4 py-3 text-left`,onClick:()=>V(e=>!e),children:[(0,k.jsxs)(`span`,{className:`min-w-0`,children:[(0,k.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:t.createDialog.completionPlan}),(0,k.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:t.createDialog.completionPlanHint})]}),(0,k.jsx)(C,{className:r(`size-4 shrink-0 text-fg-muted transition-transform`,B&&`rotate-180`),"aria-hidden":!0})]}),B?(0,k.jsxs)(`div`,{className:`grid gap-4 border-t border-edge-subtle p-4`,children:[(0,k.jsxs)(`section`,{className:`rounded-lg border border-edge-subtle bg-surface-panel/70 p-3`,children:[(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.createDialog.criteriaTitle}),(0,k.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.createDialog.criteriaHint}),(0,k.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:M.checklistDecomposePolicy===`supplement_existing`?t.createDialog.checklistPolicySupplementExisting:t.createDialog.checklistPolicyEmptyOnly})]}),(0,k.jsxs)(`div`,{className:`mt-3 grid gap-2`,children:[R.checklist.map((e,n)=>(0,k.jsxs)(`div`,{className:`flex gap-2`,children:[(0,k.jsx)(`input`,{value:e,onChange:e=>ie(n,e.target.value),placeholder:A(t.createDialog.criteriaPlaceholder,{index:n+1}),className:`min-w-0 flex-1 rounded-lg border border-edge bg-surface-muted px-3 py-2 text-sm text-fg placeholder:text-fg-muted focus-visible:border-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent`}),(0,k.jsx)(y,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 rounded-lg p-0`,"aria-label":t.createDialog.removeCriteria,onClick:()=>ae(n),children:(0,k.jsx)(f,{className:`size-4`,"aria-hidden":!0})})]},n)),(0,k.jsxs)(y,{type:`button`,variant:`ghost`,className:`h-8 justify-start rounded-lg text-xs`,onClick:()=>Y({checklist:[...R.checklist,``]}),children:[(0,k.jsx)(v,{className:`size-3.5`,"aria-hidden":!0}),t.createDialog.addCriteria]})]})]}),(0,k.jsxs)(`section`,{className:`rounded-lg border border-edge-subtle bg-surface-panel/70 p-3`,children:[(0,k.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.createDialog.contractTitle}),(0,k.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.createDialog.contractHint}),(0,k.jsxs)(`label`,{className:`mt-3 grid gap-1.5`,children:[(0,k.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:t.createDialog.objective}),(0,k.jsx)(`textarea`,{value:R.objective,onChange:e=>Y({objective:e.target.value}),placeholder:t.createDialog.objectivePlaceholder,rows:2,className:`resize-none rounded-lg border border-edge bg-surface-muted px-3 py-2 text-sm text-fg placeholder:text-fg-muted focus-visible:border-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent`})]}),(0,k.jsxs)(`label`,{className:`mt-3 grid gap-1.5`,children:[(0,k.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:t.createDialog.scopeBoundary}),(0,k.jsx)(`textarea`,{value:R.scopeBoundary,onChange:e=>Y({scopeBoundary:e.target.value}),placeholder:t.createDialog.scopeBoundaryPlaceholder,rows:2,className:`resize-none rounded-lg border border-edge bg-surface-muted px-3 py-2 text-sm text-fg placeholder:text-fg-muted focus-visible:border-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent`})]}),(0,k.jsxs)(`div`,{className:`mt-3 grid gap-1.5`,children:[(0,k.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:t.createDialog.evidencePlan}),(0,k.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.createDialog.evidencePlanHint}),R.evidencePlan.map((e,n)=>(0,k.jsxs)(`div`,{className:`flex gap-2`,children:[(0,k.jsx)(`input`,{value:e,onChange:e=>oe(n,e.target.value),placeholder:A(t.createDialog.evidencePlanPlaceholder,{index:n+1}),className:`min-w-0 flex-1 rounded-lg border border-edge bg-surface-muted px-3 py-2 text-sm text-fg placeholder:text-fg-muted focus-visible:border-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent`}),(0,k.jsx)(y,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 rounded-lg p-0`,"aria-label":t.createDialog.removeEvidence,onClick:()=>se(n),children:(0,k.jsx)(f,{className:`size-4`,"aria-hidden":!0})})]},n)),(0,k.jsxs)(y,{type:`button`,variant:`ghost`,className:`h-8 justify-start rounded-lg text-xs`,onClick:()=>Y({evidencePlan:[...R.evidencePlan,``]}),children:[(0,k.jsx)(v,{className:`size-3.5`,"aria-hidden":!0}),t.createDialog.addEvidence]})]})]})]}):null]}),(0,k.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base/60`,children:[(0,k.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between gap-3 px-4 py-3 text-left`,onClick:()=>U(e=>!e),children:[(0,k.jsxs)(`span`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,k.jsx)(ee,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),t.createDialog.advanced]}),(0,k.jsx)(C,{className:r(`size-4 text-fg-muted transition-transform`,H&&`rotate-180`),"aria-hidden":!0})]}),H?(0,k.jsxs)(`div`,{className:`grid gap-3 border-t border-edge-subtle p-4 sm:grid-cols-2`,children:[(0,k.jsxs)(`label`,{className:`grid gap-1.5 sm:col-span-2`,children:[(0,k.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:t.createDialog.agentId}),(0,k.jsx)(s,{value:te,onChange:e=>Y({agentId:e.target.value}),className:`rounded-lg border border-edge bg-surface-muted px-3 py-2 text-sm text-fg focus-visible:border-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent`,children:X.map(e=>(0,k.jsx)(S,{value:e.id,children:T(e,L)+(e.isDefault?` · ${t.createDialog.defaultAgent}`:` · ${e.id}`)},e.id))}),Q?(0,k.jsx)(`span`,{className:`line-clamp-2 text-xs text-fg-muted`,children:Q}):Z?.model?.primary?(0,k.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:A(t.createDialog.agentPrimaryModel,{model:Z.model.primary})}):null]}),(0,k.jsxs)(`label`,{className:`grid gap-1.5`,children:[(0,k.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:t.createDialog.priority}),(0,k.jsxs)(s,{value:R.priority,onChange:e=>Y({priority:e.target.value}),className:`rounded-lg border border-edge bg-surface-muted px-3 py-2 text-sm text-fg focus-visible:border-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent`,children:[(0,k.jsx)(S,{value:`normal`,children:t.priorities.normal}),(0,k.jsx)(S,{value:`high`,children:t.priorities.high}),(0,k.jsx)(S,{value:`low`,children:t.priorities.low})]})]}),(0,k.jsxs)(`label`,{className:`grid gap-1.5`,children:[(0,k.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:t.createDialog.deadline}),(0,k.jsxs)(s,{value:R.deadlineMode,onChange:e=>re(e.target.value),className:`rounded-lg border border-edge bg-surface-muted px-3 py-2 text-sm text-fg focus-visible:border-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent`,children:[(0,k.jsx)(S,{value:`none`,children:t.createDialog.deadlineNone}),(0,k.jsx)(S,{value:`today`,children:t.createDialog.deadlineToday}),(0,k.jsx)(S,{value:`tomorrow`,children:t.createDialog.deadlineTomorrow}),(0,k.jsx)(S,{value:`friday`,children:t.createDialog.deadlineFriday}),(0,k.jsx)(S,{value:`custom`,children:t.createDialog.deadlineCustom})]})]}),R.deadlineMode===`none`?null:(0,k.jsxs)(`label`,{className:`grid gap-1.5`,children:[(0,k.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:t.createDialog.deadlineAt}),(0,k.jsx)(`input`,{type:`datetime-local`,value:R.deadline,onChange:e=>Y({deadline:e.target.value,deadlineMode:`custom`}),className:`rounded-lg border border-edge bg-surface-muted px-3 py-2 text-sm text-fg focus-visible:border-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent`})]}),(0,k.jsxs)(`label`,{className:`grid gap-1.5`,children:[(0,k.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:t.createDialog.maxTurns}),(0,k.jsx)(`input`,{type:`number`,min:1,max:500,value:R.maxTurns,onChange:e=>Y({maxTurns:e.target.value}),className:`rounded-lg border border-edge bg-surface-muted px-3 py-2 text-sm text-fg focus-visible:border-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent`})]}),(0,k.jsxs)(`label`,{className:`grid gap-1.5 sm:col-span-2`,children:[(0,k.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:t.createDialog.judgeModel}),(0,k.jsxs)(s,{value:R.judgeModelRef,onChange:e=>Y({judgeModelRef:e.target.value}),className:`rounded-lg border border-edge bg-surface-muted px-3 py-2 text-sm text-fg focus-visible:border-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent`,children:[(0,k.jsx)(S,{value:``,children:t.createDialog.judgeModelPlaceholder}),$.length?(0,k.jsx)(c,{label:t.createDialog.agentModelRoles,children:$.map(e=>(0,k.jsxs)(S,{value:e.model,children:[e.id===`judge`?t.createDialog.judgeRole:e.id,` · `,e.model]},`${e.id}:${e.model}`))}):null,(0,k.jsx)(c,{label:t.createDialog.configuredModels,children:ne.map(e=>(0,k.jsxs)(S,{value:e.id,children:[e.name,` · `,e.id]},e.id))})]})]})]}):null]}),W?(0,k.jsx)(`p`,{className:`rounded-lg border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:W}):null]})}),(0,k.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,k.jsx)(y,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:N,children:t.createDialog.cancel}),(0,k.jsxs)(y,{type:`button`,variant:`primary`,className:`rounded-lg`,disabled:j||!R.title.trim(),onClick:()=>void le(),children:[(0,k.jsx)(v,{className:`size-4`,"aria-hidden":!0}),t.createDialog.create]})]})]})]})})}export{O as n,F as t};
|