1"use strict";(globalThis.rspackChunknotion_next=globalThis.rspackChunknotion_next||[]).push([[17995],{542758(e,t,r){r(435368),r(499468),r(586042),r(169187),r(726090),r(132457),r(219390),r(73168),r(730330),r(159952),r(765324);var n=r(635790),s=()=>r(610163),l=()=>r(128906);function i(){let e=(0,r(972740).L)(),t=(0,r(83208).X)("space_mcp_registry"),{integrations:i,isLoading:o}=(0,r(805492).S)(),a=(0,r(579993).K8)(()=>(null==e?void 0:e.getMcpConnectionScope())??(0,r(431193).hf)(void 0),[e]),d=(0,n.useMemo)(()=>i.map(e=>({id:e.id,name:e.name,serverUrl:e.serverUrl,spaceMcpRegistryPresetId:e.spaceMcpRegistryPresetId})),[i]),c=(0,n.useMemo)(()=>i.map(e=>({id:e.id,name:e.name,serverUrl:e.serverUrl,serverIconUrl:e.serverIconUrl,officialName:e.officialName,spaceMcpRegistryPresetId:e.spaceMcpRegistryPresetId,hasExternalConnection:e.hasExternalConnection})),[i]),u=(0,n.useMemo)(()=>{let e=new Set;for(let r of c){let n=(0,l().Iz)({source:r,useSpaceMcpRegistryIdentity:t});(null==n?void 0:n.type)==="server_url"&&e.add(n.normalizedServerUrl)}return e},[c,t]),{servers:p,serverUrls:m}=(0,r(602226).z)({agentSurface:"personal_agent"}),g=(0,n.useMemo)(()=>{let e=new Map;if(!p)return e;for(let t of p)t.tagline&&e.set((0,s().Yl)(t.serverUrl),t.tagline);return e},[p]),v=(0,n.useMemo)(()=>{let e=[];
1if(!p)return e;for(let t of p)"hidden"!==t.visibility&&t.serverUrlConfig&&e.push({serverUrlConfig:t.serverUrlConfig,tagline:t.tagline});return e},[p]),M=(0,n.useMemo)(()=>{let e=new Map;if(!p)return e;for(let t of p)t.serverUrl&&e.set((0,s().Yl)(t.serverUrl),t.name);return e},[p]),y=(0,n.useMemo)(()=>{let e=new Map;for(let r of i){let n=(0,l().Iz)({source:r,useSpaceMcpRegistryIdentity:t}),s=(null==n?void 0:n.type)==="server_url"?n.normalizedServerUrl:void 0,i=s?M.get(s):void 0;e.set(r.id,i??r.name)}return e},[i,M,t]),f=(0,n.useMemo)(()=>{let e=new Map,t=new Map;for(let r of i){let n=[...new Set([y.get(r.id)??r.name,r.name])];for(let s of(t.set(r.id,n),n))e.set(s,(e.get(s)??0)+1)}let r=new Map;for(let n of i){let l=(t.get(n.id)??[]).some(t=>(e.get(t)??0)>1),i=n.serverUrl?(0,s().K4)(n.serverUrl):void 0;l&&void 0!==i&&r.set(n.id,i)}return r},[y,i]),h=(0,n.useMemo)(()=>(0,r(692158).m5)({existingMcpServers:c,currentAgentMcpUrls:u,preconfiguredServerUrls:m,preconfiguredServerTaglines:g,preconfiguredFlexibleServerMatches:v,getExistingModuleId:(e,t)=>t,useSpaceMcpRegistryIdentity:t}),[c,u,m,g,v,t]),S=(0,n.useMemo)(()=>new Map(h.items.map(e=>[e.id,e.tagline])),[h.items]),x=(0,n.useMemo)(()=>new Map(h.items.map(e=>[e.id,(0,r(692158).p)({connection:e,scope:a})])),[h.items,a]),b=(0,n.useMemo)(()=>a.allowlistEnforced?[...a.allowedUrls]:void 0,[a.allowlistEnforced,a.allowedUrls]);return{integrations:i,mcpConnectionScope:a,visibilityById:x,taglinesById:S,displayNamesById:y,duplicateNameServerUrlsById:f,existingAgentModules:d,allowedWorkspaceMcpUrls:b,isLoading:o}}r.d(t,{u:()=>i})},971537(e,t,r){r.r(t),r.d(t,{PersonalAgentMcpServersSection:()=>m}),r(159952);var n=r(635790),s=()=>r(646139);r(435368),r(499468),r(586042),r(169187),r(726090),r(132457),r(219390),r(73168),r(730330),r(139583);var l=()=>r(610163),i=()=>r(128906),o=r(440302);let a=(0,r(327219).YK)({title:{id:"aiSettings.personalMcpServers.modal.title",defaultMessage:"Add MCP server"},modalAriaLabel:{id:"aiSettings.personalMcpServers.modal.ariaLabel",defaultMessage:"Add MCP server modal"},customMcpServerName:{id:"aiSettings.personalMcpServers.customMcpServer.name",defaultMessage:"Custom MCP server"}});function d({connection:e,spaceViewStore:t,currentUserPointer:l,existingAgentModules:i,allowedWorkspaceMcpUrls:a,mcpIntegrations:c,onClose:u,isAdded:p}){let m=(0,r(533992).v3)(),g=(0,r(876252).$)(),v=(0,n.useCallback)(e=>{let n=e.existingModuleId;if(!n||!g)return Promise.resolve();let l=c.find(e=>e.id===n),i=l?s().P.createChildStore(g,l.pointer):void 0;return null!=i&&i.getModel()?(0,r(192545).tz)({modulePointer:i.pointer,spaceViewPointer:t.pointer,environment:m}):Promise.resolve()},[g,m,c,t]),M=(0,n.useCallback)(async()=>{u()},[u]);return(0,o.jsx)(r(799818).r,{connection:e,spaceViewStore:t,currentUserPointer:l,existingAgentModules:i,allowedWorkspaceMcpUrls:a,allowWorkspaceApprovalOnConnect:!1,hideHeader:!1,footerVariant:"default",closeOnSuccess:!0,credentialActionLayout:"saved-first",showMcpBetaBadge:!0,onSuccess:M,onClose:u,onDisconnect:v,isAdded:p},e.id)}function c({isOpen:e,onClose:t,isCustomMcpAllowed:u}){let p=(0,r(327219).tz)(),m=(0,r(476743).a)(),g=(0,r(972740).L)(),v=(0,r(876252).$)(),M=null==v?void 0:v.pointer,y=(0,r(579993).K8)(()=>(null==g?void 0:g.getMcpConnectionScope())??(0,r(431193).hf)(void 0),[g]),{integrations:f}=(0,r(805492).S)(),h=(0,r(83208).X)("space_mcp_registry"),S=(0,r(579993).K8)(()=>{let e=[];
1if(!v)return e;for(let t of f){let r=s().P.createChildStore(v,t.pointer).toModuleValue();(null==r?void 0:r.type)==="mcpServer"&&e.push(r)}return e},[v,f]),x=(0,n.useMemo)(()=>new Map(S.map(e=>[e.id,e])),[S]),b=(0,n.useMemo)(()=>f.map(e=>({id:e.id,name:e.name,serverUrl:e.serverUrl,spaceMcpRegistryPresetId:e.spaceMcpRegistryPresetId})),[f]),I=(0,n.useMemo)(()=>f.map(e=>({id:e.id,name:e.name,serverUrl:e.serverUrl,serverIconUrl:e.serverIconUrl,officialName:e.officialName,spaceMcpRegistryPresetId:e.spaceMcpRegistryPresetId,hasExternalConnection:e.hasExternalConnection})),[f]),A=(0,n.useMemo)(()=>{let e=new Set;for(let t of I){let r=(0,i().Iz)({source:t,useSpaceMcpRegistryIdentity:h});(null==r?void 0:r.type)==="server_url"&&e.add(r.normalizedServerUrl)}return e},[I,h]),{servers:U,serverUrls:w}=(0,r(602226).z)({agentSurface:"personal_agent"}),C=(0,n.useMemo)(()=>{let e=new Map;if(!U)return e;for(let t of U)t.tagline&&e.set((0,l().Yl)(t.serverUrl),t.tagline);return e},[U]),j=(0,n.useMemo)(()=>{let e=new Set(I.map(e=>e.id));return(0,r(692158).m5)({existingMcpServers:I,currentAgentMcpUrls:A,preconfiguredServerUrls:w,preconfiguredServerTaglines:C,getExistingModuleId:(t,r)=>e.has(r)?r:void 0,useSpaceMcpRegistryIdentity:h})},[I,A,w,C,h]),P=(0,n.useMemo)(()=>(0,r(326541).q)({servers:U??[],existingServerUrls:j.addedUrls,currentAgentMcpUrls:A}),[U,j.addedUrls,A]),R=(0,n.useMemo)(()=>[...j.items.map(e=>{let t=x.get(e.id);return{id:e.id,type:"mcpServer",name:e.name,url:e.serverUrl,serverIconUrl:e.serverIconUrl,iconVariant:"standard",mcpServerId:e.mcpServerId,existingModuleId:e.existingModuleId,hasExternalConnection:e.hasExternalConnection,hasDuplicateUrl:e.hasDuplicateUrl,isPreconfigured:e.isPreconfigured,visibility:(0,r(692158).p)({connection:e,scope:y}),tagline:e.tagline,spaceMcpRegistryPresetId:e.spaceMcpRegistryPresetId,moduleValue:t}}),...P.map(e=>({id:e.id,type:"mcpServer",name:e.name,url:e.serverUrl,iconUrl:e.iconUrl,iconVariant:"standard",hasDuplicateUrl:e.hasDuplicateUrl,isPreconfigured:!0,tagline:e.tagline}))],[j.items,y,x,P]),[T,k]=(0,n.useState)(void 0),[V,B]=(0,n.useState)(!1),D=[],E=(0,n.useRef)(void 0),L=T?R.find(e=>e.id===T):void 0;L&&(E.current={serverUrl:L.url,spaceMcpRegistryPresetId:L.spaceMcpRegistryPresetId}),(0,r(669370).M)({isOpen:e,items:R,selectedId:T,setSelectedId:k,getItemId:e=>e.id,getDefaultId:e=>{var t;if(V)return;let r=E.current;if(r){let t=e.find(e=>(0,i().gq)({first:r,second:{serverUrl:e.url,spaceMcpRegistryPresetId:e.spaceMcpRegistryPresetId},useSpaceMcpRegistryIdentity:h}));if(t)return t.id}return null==(t=e[0])?void 0:t.id}});let N=(0,n.useMemo)(()=>new Map(R.map(e=>[e.id,e])),[R]),z=(0,n.useMemo)(()=>{if(T)return N.get(T)},[N,T]),W=(0,n.useCallback)(e=>{var t;return!!(null==(t=N.get(e))?void 0:t.existingModuleId)},[N]),K=(0,n.useCallback)(e=>{k(e),B(!1)},[]),O=(0,n.useCallback)(()=>{B(!0),k(void 0)},[]),_=(0,r(899849).d9)({isCustomMcpAllowed:u,isWorkspaceOwner:!1}),F=r(376242).D.addCustomMcp,$=(0,n.useCallback)(e=>{t()},[t]),Y=(()=>{if(V){if(m&&M){let e={id:"custom-mcp-server",type:"mcpServer",name:p.formatMessage(a.customMcpServerName),iconVariant:"standard",mcpServerId:void 0,existingModuleId:void 0,hasExternalConnection:!1,isPreconfigured:!1,tagline:p.formatMessage(r(376242).D.customMcpServerTagline)};return(0,o.jsx)(r(131317).K,{connection:e,spaceViewStore:m,currentUserPointer:M,existingAgentModules:b,allowedWorkspaceMcpUrls:y.allowlistEnforced?[...y.allowedUrls]:void 0,isCustomMcpAllowed:u,allowWorkspaceApprovalOnConnect:!1,forceRunToolsAutomatically:!1,showMcpBetaBadge:!0,onSuccess:$,onClose:t},"custom-mcp-form")}return null}return z&&"mcpServer"===z.type&&m&&M?(0,o.jsx)(d,{connection:z,spaceViewStore:m,currentUserPointer:M,existingAgentModules:b,allowedWorkspaceMcpUrls:y.allowlistEnforced?[...y.allowedUrls]:void 0,onClose:t,mcpIntegrations:f,isAdded:W(z.id)},z.id):null})();return(0,o.jsx)(r(943365).s,{ariaLabel:p.formatMessage(a.modalAriaLabel),isOpen:e,onDismiss:t,areaConstraint:{width:{type:"fixed",length:680},height:{type:"fixed",length:600}},children:()=>(0,o.jsx)(r(671968).q,{isSinglePane:!1,leftPaneWidth:212,title:(0,o.jsx)(r(111010).D,{styleKey:"bodyLgSemibold",colorVariant:"primary",children:p.formatMessage(
1a.title)}),searchAriaLabel:p.formatMessage(r(376242).D.searchAriaLabel),closeSearchAriaLabel:p.formatMessage(r(376242).D.closeSearchAriaLabel),searchPlaceholder:p.formatMessage(r(376242).D.searchPlaceholder),leftPaneContent:({searchQuery:e})=>(0,o.jsx)(r(781368).J,{isAccountTypeEnabled:!1,searchQuery:e,suggestedConnections:D,connections:R,selectedConnectionId:T,onSelect:K,isConnectionAdded:W,customMcpAction:{isVisible:_.isVisible,isEnabled:_.isEnabled,label:(0,o.jsx)(r(327219).sA,{...F}),icon:_.icon,onClick:u?O:()=>{},showDisabledTooltip:_.showDisabledTooltip}}),rightPaneContent:Y})})}let u=(0,r(327219).YK)({addButton:{id:"aiSettings.personalMcpServers.addButton",defaultMessage:"Add MCP server"},addButtonDisabledTooltip:{id:"aiSettings.personalMcpServers.addButtonDisabledTooltip",defaultMessage:"You need to be a member of this workspace to add an MCP server"},connectButton:{id:"aiSettings.personalMcpServers.connectButton",defaultMessage:"Connect"},connectedLabel:{id:"aiSettings.personalMcpServers.connectedLabel",defaultMessage:"Connected"},disconnectButton:{id:"aiSettings.personalMcpServers.disconnectButton",defaultMessage:"Disconnect"},needsAuthLabel:{id:"aiSettings.personalMcpServers.needsAuthLabel",defaultMessage:"Needs authentication"},menuButtonAriaLabel:{id:"aiSettings.personalMcpServers.menuButtonAriaLabel",defaultMessage:"MCP server settings"},settingsButton:{id:"aiSettings.personalMcpServers.settingsButton",defaultMessage:"Settings"},settingsModalTitle:{id:"aiSettings.personalMcpServers.settingsModalTitle",defaultMessage:"MCP server settings"}}),p={display:"flex",alignItems:"center",justifyContent:"flex-end",gap:16,marginBlockStart:8};function m({isCustomMcpAllowed:e}){let t=(0,r(533992).v3)(),l=(0,r(476743).a)(),i=(0,r(876252).$)(),a=null==i?void 0:i.pointer,{integrations:d,visibilityById:g,taglinesById:y,duplicateNameServerUrlsById:f,existingAgentModules:h,allowedWorkspaceMcpUrls:S}
1=(0,r(542758).u)(),[x,b]=(0,n.useState)(!1),[I,A]=(0,n.useState)({isOpen:!1}),[U,w]=(0,n.useState)(),C=(0,n.useMemo)(()=>{if(U&&i)return s().P.createChildStore(i,U.pointer)},[i,U]),j=!!(l&&a),P=!j,R=(0,n.useCallback)(()=>{j&&b(!0)},[j]),T=(0,n.useCallback)(e=>{j&&A({isOpen:!0,existingModuleId:e})},[j]),k=(0,n.useCallback)(()=>{A({isOpen:!1})},[]),V=(0,n.useCallback)(()=>{b(!1)},[]),B=(0,n.useCallback)(e=>{w(e)},[]),D=(0,n.useCallback)(()=>{w(void 0)},[]),E=(0,n.useCallback)(async e=>{if(!l||!i)return;let n=s().P.createChildStore(i,e.pointer);n.getModel()&&await (0,r(192545).tz)({modulePointer:n.pointer,spaceViewPointer:l.pointer,environment:t})},[t,l,i]),L=(0,o.jsx)(r(265779).E,{colorPalette:"gray",iconLeading:{icon:r(223759).plusFillIcon,size:"sm"},onClick:R,disabled:P,size:"md",children:(0,o.jsx)(r(327219).sA,{...u.addButton})});return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(r(971831).d,{id:"aiSettingsAddMcpServer",type:"default",title:(0,o.jsx)(r(327219).sA,{...r(770904).Kr.addMcpServer.title}),byline:(0,o.jsx)(r(327219).sA,{...r(770904).Kr.addMcpServer.description}),buttonLabel:(0,o.jsx)(r(327219).sA,{...u.addButton}),onClick:R,disabled:P,tooltipLabel:P?(0,o.jsx)(r(327219).sA,{...u.addButtonDisabledTooltip}):void 0,modal:(0,o.jsx)(c,{isOpen:x,onClose:V,isCustomMcpAllowed:e})}),d.length>0?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(r(4458).VP,{children:d.map((e,t)=>(0,o.jsx)(v,{integration:e,onOpenModal:T,onDisconnect:E,onOpenSettings:B,showTopBorder:0===t,tagline:y.get(e.id),duplicateNameServerUrl:f.get(e.id),connectionVisibility:g.get(e.id)??"enabled"},e.id))}),(0,o.jsx)("div",{style:p,children:L})]}):null,x?(0,o.jsx)(c,{isOpen:x,onClose:V,isCustomMcpAllowed:e}):void 0,C?(0,o.jsx)(M,{isOpen:!!C,onClose:D,workflowModuleStore:C,existingAgentModules:h,allowedWorkspaceMcpUrls:S}):void 0,I.isOpen&&l&&a?(0,o.jsx)(r(405063).Z,{isOpen:I.isOpen,onClose:k,onSuccess:k,spaceViewStore:l,currentUserPointer:a,existingModuleId:I.existingModuleId,initialName:I.initialName,initialUrl:I.initialUrl,existingAgentModules:h,allowedWorkspaceMcpUrls:S,showMcpBetaBadge:!0,credentialActionLayout:"saved-first"}):void 0]})}let g={status:{display:"flex",alignItems:"center",gap:6,color:r(632079).Tj.text.secondary},needsAuthStatus:{display:"flex",alignItems:"center",gap:6,color:r(632079).Tj.text.secondary},style1:{width:24,height:24},style2:{width:20,height:20}};function v({integration:e,onOpenModal:t,onDisconnect:s,onOpenSettings:l,showTopBorder:i,tagline:a,duplicateNameServerUrl:d,connectionVisibility:c}){let p=(0,r(327219).tz)(),m=(0,r(579993).uB)(void 0,r(510969).A),M=(0,r(579993).uB)(void 0,r(419110).$),y=(0,n.useMemo)(()=>({key:`mcp-server-${e.id}-menu`,items:[{key:"settings",action:()=>{l(e),m.reset()},render:e=>(0,o.jsx)(r(95582).A,{...e,title:p.formatMessage(u.settingsButton)})},{key:"disconnect",action:()=>{s(e).catch(()=>{r(647095).f1((0,o.jsx)(r(327219).sA,{...r(376242).D.disconnectError}))}),m.reset()},render:e=>(0,o.jsx)(r(95582).A,{...e,title:p.formatMessage(u.disconnectButton)})}],render:e=>(0,o.jsx)(r(83743).A,{...e})}),[p,e,s,l,m]),f=(0,r(960253).I)(()=>({contentWrapper:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"16px 0px",borderBottom:`1px solid ${r(632079).Tj.border.secondary}`,borderTop:i?`1px solid ${r(632079).Tj.border.secondary}`:"none",borderRadius:4}}),[i]),h=d??a,S=e.hasExternalConnection?"connected":"needsAuthentication",x="connected"===S?(0,o.jsxs)("div",{style:g.status,children:[(0,o.jsx)(r(16275).I,{icon:r(20413).checkmarkFillSmallIcon,size:"sm"}),(0,o.jsx)(r(111010).D,{styleKey:"bodySmRegular",colorVariant:"secondary",children:(0,o.jsx)(r(327219).sA,{...u.connectedLabel})})]}):"needsAuthentication"===S?(0,o.jsxs)("div",{style:g.needsAuthStatus,children:[(0,o.jsx)(r(16275).I,{icon:r(50171).exclamationMarkTriangleSmallIcon,size:"sm"}),(0,o.jsx)(r(111010).D,{styleKey:"bodySmRegular",colorVariant:"secondary",children:(0,o.jsx)(r(327219).sA,{...u.needsAuthLabel})})]}):null,b="needsAuthentication"===S?"disabled"===c?(0,o.jsx)(r(51831).m_,{placement:"top",content:()=>(0,o.jsx)(r(327219).sA,{...r(376242).D.disabledPreconfiguredMcpTooltip}),children:n=>(0,o.jsx)("div",{...n,children:(0,o.jsx)(r(265779).E,{colorPalette:"blue",onClick:()=>t(e.id),size:"sm",disabled:!0,children:(0,o.jsx)(r(327219).sA,{...u.connectButton})})})}):(0,o.jsx)(r(265779).E,{colorPalette:"blue",onClick:()=>t(e.id),size:"sm",children:(0,o.jsx)(r(327219).sA,{...u.connectButton})}):null;return(0,o.jsxs)("div",{style:f.contentWrapper,children:[(0,o.jsxs)(r(4458).fI,{alignItems:"center",gap:10,children:[(0,o.jsx)(r(4458).fI,{width:24,height:24,alignItems:"center",justifyContent:"center",children:(0,o.jsx)(r(242777).X,{iconUrl:e.serverIconUrl,serverUrl:e.serverUrl,serverName:e.name,size:24})}),(0,o.jsxs)(r(4458).VP,{gap:0,children:[(0,o.jsx)(r(4458).fI,{alignItems:"center",gap:4,children:(0,o.jsx)(r(111010).D,{styleKey:"bodyMedium",colorVariant:"primary",children:e.name})}),h?(0,o.jsx)(r(111010).D,{styleKey:"bodySmRegular",colorVariant:"secondary",children:h}):null]})]}),(0,o.jsxs)(r(4458).fI,{alignItems:"center",gap:12,children:[x,b,(0,o.jsx)(r(656252).d,{buttonPopupStore:m,popupType:r(656252).z.Popup,content:()=>(0,o.jsx)(r(747369).A,{menuType:r(649476).gu.Popup,width:200,children:(0,o.jsx)(r(558045).A,{type:r(558045).O.Vertical,initialFocus:0,sections:[y],store:M})}),children:e=>(0,o.jsx)(r(374533).K,{...e,style:g.style1,iconStyle:g.style2,icon:r(829968).gearIcon,ariaLabel:p.formatMessage(u.menuButtonAriaLabel)})})]})]})}function M({isOpen:e,onClose:t,workflowModuleStore:s,existingAgentModules:l,allowedWorkspaceMcpUrls:i}){var a,d,c,p;let m=(0,r(533992).v3)(),g=(0,r(327219).tz)(),v=(0,r(476743).a)(),y=null==(a=(0,r(876252).$)())?void 0:a.pointer,f=(0,r(579993).K8)(()=>
1s.toModuleValue(),[s]),[h,S]=(0,n.useState)(!1),x=(0,r(579993).K8)(()=>(null==y?void 0:y.table)===s.getCreatedByTable()&&(null==y?void 0:y.id)===s.getCreatedById(),[null==y?void 0:y.table,null==y?void 0:y.id,s]),b=(0,n.useCallback)(()=>{S(!0)},[]),I=(0,n.useCallback)(()=>{S(!1)},[]),A=(0,n.useCallback)(e=>{let t=s.toModuleValue();(null==t?void 0:t.type)==="mcpServer"&&(0,r(192545).IW)({modulePointer:s.pointer,environment:m,currentState:t.state,nextState:e.state})},[m,s]);if(!f||"mcpServer"!==f.type)return null;let U=null==(d=f.state)?void 0:d.serverUrl,w=null==(c=f.state)?void 0:c.serverIconUrl;return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(r(171849).a,{ariaLabel:g.formatMessage(u.settingsModalTitle),open:e,onDismiss:t,children:(0,o.jsxs)(r(4458).VP,{padding:24,gap:16,minWidth:520,children:[(0,o.jsxs)(r(4458).VP,{gap:8,children:[(0,o.jsxs)(r(4458).fI,{alignItems:"center",gap:10,children:[(0,o.jsx)(r(242777).X,{iconUrl:w,serverUrl:U,serverName:f.name,size:28}),(0,o.jsx)(r(111010).D,{styleKey:"titleSm",children:f.name})]}),(0,o.jsxs)(r(4458).VP,{gap:2,children:[(0,o.jsx)(r(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:(0,o.jsx)(r(327219).sA,{...u.settingsModalTitle})}),U?(0,o.jsx)(r(111010).D,{styleKey:"caption",colorVariant:"secondary",children:U}):null]})]}),U?(0,o.jsx)(r(607654).n,{moduleValue:f,saveModule:A,userHasEditAccess:x}):(0,o.jsx)(r(548436).A,{onClick:b,children:(0,o.jsx)(r(327219).sA,{...u.connectButton})})]})}),h&&v&&y?(0,o.jsx)(r(405063).Z,{isOpen:h,onClose:I,onSuccess:I,spaceViewStore:v,currentUserPointer:y,existingModuleId:s.pointer.id,initialName:f.name,initialUrl:null==(p=f.state)?void 0:p.serverUrl,existingAgentModules:l,allowedWorkspaceMcpUrls:i,showMcpBetaBadge:!0,credentialActionLayout:"saved-first"}):void 0]})}},192545(e,t,r){r(533958),r(499468),r(586042),r(169187),r(726090),r(132457),r(219390),r(73168),r(730330),r(976614),r(159952);let n=new Map;function s(e){let t=l(e.currentSelection,e.availableValues),r=l(e.nextSelection,e.availableValues);return{added:r.filter(e=>!t.includes(e)),removed:t.filter(e=>!r.includes(e))}}function l(e,t){return void 0===e?t:e.filter(e=>e!==r(213587).Pc)}function i(e){let t=new Set(l(e.currentSelection,e.availableValues));for(let r of e.change.removed)t.delete(r);for(let r of e.change.added)t.add(r);return 0===t.size?[r(213587).Pc]:Array.from(t)}async function o(e){let{environment:t,modulePointer:r,getSettings:s}=e,l=`${r.spaceId}:${r.id}`,i=(n.get(l)??Promise.resolve()).catch(()=>void 0).then(async()=>{let e=await t.api.callApi({eventName:"updateMcpServerModuleSettings",environment:t,data:{spaceId:r.spaceId,moduleId:r.id,settings:s()}});if("success"!==e.type)throw e.error;await e.handleRecordMapForResponsePromise});n.set(l,i);try{await i}finally{n.get(l)===i&&n.delete(l)}}async function a(e){let{environment:t,modulePointer:r,settings:n}=e;await o({environment:t,modulePointer:r,getSettings:()=>n})}function d(e){var t,n,l,a;let d,c=(t=e.currentState,n=e.nextState,d={},(0,r(931576).n)(null==t?void 0:t.enabledToolNames,null==n?void 0:n.enabledToolNames)||(d.enabledToolNames=s({currentSelection:null==t?void 0:t.enabledToolNames,nextSelection:null==n?void 0:n.enabledToolNames,availableValues:(null==t||null==(l=t.tools)?void 0:l.map(e=>e.name))??[]})),(0,r(931576).n)(null==t?void 0:t.enabledResourceUris,null==n?void 0:n.enabledResourceUris)||(d.enabledResourceUris=s({currentSelection:null==t?void 0:t.enabledResourceUris,nextSelection:null==n?void 0:n.enabledResourceUris,availableValues:(null==t||null==(a=t.resources)?void 0:a.map(e=>e.uri))??[]})),(null==t?void 0:t.runReadToolsAutomatically)!==(null==n?void 0:n.runReadToolsAutomatically)&&(d.runReadToolsAutomatically=null==n?void 0:n.runReadToolsAutomatically),(null==t?void 0:t.runWriteToolsAutomatically)!==(null==n?void 0:n.runWriteToolsAutomatically)&&(d.runWriteToolsAutomatically=null==n?void 0:n.runWriteToolsAutomatically),d);o({modulePointer:e.modulePointer,environment:e.environment,getSettings:()=>{var t,n,s;let l=new(r(646139)).P(e.environment,e.modulePointer).toModuleValue();return t=(null==l?void 0:l.type)==="mcpServer"?l.state:e.currentState,{...void 0===c.enabledToolNames?{}:{enabledToolNames:i({currentSelection:null==t?void 0:t.enabledToolNames,availableValues:(null==t||null==(n=t.tools)?void 0:n.map(e=>e.name))??[],change:c.enabledToolNames})},...void 0===c.enabledResourceUris?{}:{enabledResourceUris:i({currentSelection:null==t?void 0:t.enabledResourceUris,availableValues:(null==t||null==(s=t.resources)?void 0:s.map(e=>e.uri))??[],change:c.enabledResourceUris})},...void 0===c.runReadToolsAutomatically?{}:{runReadToolsAutomatically:c.runReadToolsAutomatically},...void 0===c.runWriteToolsAutomatically?{}:{runWriteToolsAutomatically:c.runWriteToolsAutomatically}}}}).catch(t=>{(0,r(208318).t)().error({from:"saveMcpRunAllToolsAutomatically",type:"saveMcpServerModuleSettingsFailed",error:t,data:{moduleId:e.modulePointer.id}})})}
1async function c(e){let{environment:t,modulePointer:r,spaceViewPointer:n}=e,s=await t.api.callApi({eventName:"disconnectPersonalMcpServerModule",environment:t,data:{spaceId:r.spaceId,spaceViewId:n.id,moduleId:r.id}});if("success"!==s.type)throw s.error;await s.handleRecordMapForResponsePromise}async function u(e){let{environment:t,modulePointer:n}=e,s=new(r(646139)).P(t,n);s.isDefined()||await (0,r(192883).s)({environment:t,inMemoryRecordCache:s.inMemoryRecordCache,pointer:n,userId:t.currentUser.id});let l=s.toModuleValue();if(!l||"mcpServer"!==l.type||!s.canEdit())throw Error("Unable to edit the personal-agent MCP module");await a({modulePointer:n,environment:t,settings:{runReadToolsAutomatically:!0,runWriteToolsAutomatically:!0}})}async function p(e){let{environment:t,moduleId:n,workflowStore:s}=e;if(s.table!==r(832375).C0E||!s.canEdit())throw Error("Unable to edit the custom agent");let l=s.getSpaceId();if(!l)throw Error("Unable to resolve the custom agent space");await t.api.callApi({eventName:"publishCustomAgentVersion",environment:t,data:{workflowId:s.id,spaceId:l,publishedMcpModuleIdToAlwaysAllow:n}}),await (0,r(192883).s)({environment:t,inMemoryRecordCache:s.inMemoryRecordCache,pointer:s.pointer,userId:t.currentUser.id})}r.d(t,{B6:()=>u,F:()=>p,IW:()=>d,tz:()=>c})}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.