1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[15917],{7853:(e,t,s)=>{"use strict";s.d(t,{d:()=>D});var a=s(95155),l=s(12115),r=s(3998),i=s(51834),n=s(65142),o=s(76444),d=s(18332),c=s(11186),u=s(20508),m=s(6191),x=s(93499),f=s(5917),h=s(57828),g=s(15870),p=s(27937),v=s(86651),j=s(65229),b=s(35626),N=s(6132),y=s(89566),w=s(82699),k=s(77874),C=s(18720),_=s(64269),z=s(26210),P=s(26497),S=s(86948),F=s(44846),L=s(17037),q=s(20243),T=s(80344),O=s(61535),A=function(e){return e.ProfileSelect="profile-select",e.ProfileCreate="profile-create",e.Connecting="connecting",e.Success="success",e}(A||{});let I=[{id:"profile-select",title:"Connect & Preview",description:"Choose profile and explore available tools",icon:(0,a.jsx)(u.default,{className:"w-4 h-4"}),showInProgress:!0},{id:"profile-create",title:"Create Profile",icon:(0,a.jsx)(m.default,{className:"h-4 w-4"}),showInProgress:!0},{id:"connecting",title:"Authenticate",icon:(0,a.jsx)(x.default,{className:"h-4 w-4"}),showInProgress:!0},{id:"success",title:"Complete",description:"Successfully connected",icon:(0,a.jsx)(f.default,{className:"h-4 w-4"}),showInProgress:!1}],E=e=>I.findIndex(t=>t.id===e),M=e=>{let{currentStep:t,mode:s}=e,l=E(t),r="profile-only"===s?I.filter(e=>"profile-select"!==e.id):I,i=r.findIndex(e=>e.id===t);return(0,a.jsx)("div",{className:"px-6 py-3",children:(0,a.jsxs)("div",{className:"flex items-center justify-between relative",children:[(0,a.jsx)("div",{className:"absolute left-0 right-0 top-[10px] h-[1px] bg-muted-foreground/20 -z-10"}),(0,a.jsx)(z.P.div,{className:"absolute left-0 top-[10px] h-[1px] bg-primary -z-10",initial:{width:0},animate:{width:"".concat(i/(r.length-1)*100,"%")},transition:{duration:.5,ease:"easeInOut"}}),r.map((e,s)=>{let r=E(e.id),i=r<l,n=e.id===t;return(0,a.jsx)(z.P.div,{className:"flex flex-col items-center gap-1 relative",initial:{scale:.8,opacity:0}
1,animate:{scale:1,opacity:1},transition:{delay:.1*s},children:(0,a.jsx)("div",{className:"bg-background p-0.5 rounded-full",children:(0,a.jsx)("div",{className:(0,_.cn)("w-5 h-5 rounded-full flex items-center justify-center transition-all duration-300 relative",i&&"bg-primary text-primary-foreground",n&&"bg-primary text-primary-foreground shadow-lg shadow-primary/25",r>l&&"bg-muted-foreground/20 text-muted-foreground",n&&"ring-2 ring-primary/20"),children:i?(0,a.jsx)(f.default,{className:"h-2.5 w-2.5"}):(0,a.jsx)("div",{className:"h-2.5 w-2.5 flex items-center justify-center",children:e.icon})})})},e.id)})]})})},U=["zendesk"],$=e=>{let{tool:t,searchTerm:s}=e;return(0,a.jsx)("div",{className:"border rounded-2xl p-2 hover:bg-muted/30 transition-colors group cursor-pointer",title:t.description,children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"flex-shrink-0",children:(e=>{let t=e.toLowerCase();return t.includes("create")||t.includes("add")||t.includes("new")?(0,a.jsx)(m.default,{className:"w-3 h-3"}):t.includes("get")||t.includes("fetch")||t.includes("read")||t.includes("view")?(0,a.jsx)(h.default,{className:"w-3 h-3"}):t.includes("update")||t.includes("edit")||t.includes("modify")?(0,a.jsx)(g.default,{className:"w-3 h-3"}):t.includes("send")||t.includes("post")||t.includes("message")?(0,a.jsx)(p.default,{className:"w-3 h-3"}):t.includes("search")||t.includes("find")?(0,a.jsx)(v.default,{className:"w-3 h-3"}):t.includes("user")||t.includes("profile")||t.includes("account")?(0,a.jsx)(u.default,{className:"w-3 h-3"}):(0,a.jsx)("div",{className:"w-3 h-3 rounded-sm bg-primary/10 flex items-center justify-center text-[8px] font-semibold text-primary",children:e.charAt(0).toUpperCase()})})(t.name)}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("div",{className:"text-xs font-medium truncate",children:((e,t)=>{if(!t)return e;let s=RegExp("(".concat(t,")"),"gi");return e.split(s).map((e,t)=>s.test(e)?(0,a.jsx)("mark",{className:"bg-yellow-200 dark:bg-yellow-900 px-0.5",children:e},t):e)})(t.name,s)}),t.tags&&t.tags.length>0&&(0,a.jsx)("div",{className:"text-[10px] text-muted-foreground truncate",children:t.tags[0]})]})]})})},D=e=>{var t,s,u,h,A,E,D,J,V;let{app:K,open:Z,onOpenChange:G,onComplete:H,mode:R="full",agentId:W}=e,[Y,B]=(0,l.useState)("profile-select"),[X,Q]=(0,l.useState)("".concat(K.name," Profile")),[ee,et]=(0,l.useState)(""),[es,ea]=(0,l.useState)(null),[el,er]=(0,l.useState)(null),[ei,en]=(0,l.useState)(null),[eo,ed]=(0,l.useState)(!1),[ec,eu]=(0,l.useState)(null),[em,ex]=(0,l.useState)({}),[ef,eh]=(0,l.useState)({}),[eg,ep]=(0,l.useState)(!1),[ev,ej]=(0,l.useState)({}),[eb,eN]=(0,l.useState)({}),[ey,ew]=(0,l.useState)([]),[ek,eC]=(0,l.useState)(!1),{mutate:e_,isPending:ez}=(0,y.M2)(),{data:eP,isLoading:eS}=(0,w.lj)(),{data:eF,isLoading:eL}=(0,y.RY)(K.slug,{enabled:Z&&"profile-create"===Y}),{data:eq,isLoading:eT}=(0,y.ts)(K.slug,X,{enabled:Z&&"profile-create"===Y&&X.length>0,debounceMs:500}),eO=(null==eP?void 0:eP.filter(e=>e.toolkit_slug===K.slug&&e.is_connected))||[],[eA,eI]=(0,l.useState)(""),{data:eE,isLoading:eM}=(0,y.MJ)(K.slug,{enabled:Z&&"profile-select"===Y,limit:50}),eU=(null==eE?void 0:eE.tools)||[];(0,l.useEffect)(()=>{if(Z){let e=U.includes(K.slug);B("profile-only"===R?"profile-create":"profile-select"),Q("".concat(K.name," Profile")),et(""),er(null),ea(null),en(null),ed(!1),eu(null),ew([]),ex({}),eh({}),ep(e),ej({}),eN({})}},[Z,K.name,K.slug,R]);let e$=(e,t)=>{ex(s=>({...s,[e]:t})),ef[e]&&eh(t=>({...t,[e]:""}))},eD=async(e,t)=>{if(W){eC(!0);try{let s=await k.o.getMcpConfigForProfile(e),a=t||ey;(await T.H.put("/agents/".concat(W,"/custom-mcp-tools"),{custom_mcps:[{...s.mcp_config,enabledTools:a}]})).data.success&&(C.toast.success("Added ".concat(a.length," ").concat(K.name," tool").concat(1===a.length?"":"s"," to your agent!")),H(e,K.name,K.slug),G(!1))}catch(e){C.toast.error(e.message||"Failed to save tools")}finally{eC(!1)}}},eJ=e=>{if("profile-create"===e){let e=U.includes(K.slug);ex({}),eh({}),ej({}),eN({}),ep(e),Q("".concat(K.name," Profile"))}B(e)},eV=async()=>
1{if("new"===ee)eJ("profile-create");else if(ee){let t=eO.find(e=>e.profile_id===ee);if(t)if(er(t),ea(t.profile_id),"full"===R&&W){eC(!0);try{var e;let s=(null==(e=(await k.o.getTools(t.toolkit_slug,1e3)).tools)?void 0:e.map(e=>e.slug))||[];await eD(t.profile_id,s)}catch(e){eC(!1),C.toast.error(e.message||"Failed to fetch tools")}}else H(t.profile_id,K.name,K.slug),G(!1)}},eK=async()=>{if(es&&"full"===R&&W){eC(!0);try{var e;let t=(null==(e=(await k.o.getTools(K.slug,1e3)).tools)?void 0:e.map(e=>e.slug))||[];await eD(es,t)}catch(e){eC(!1),C.toast.error(e.message||"Failed to fetch and save tools")}}else es&&(eJ("success"),setTimeout(()=>{H(es,K.name,K.slug),G(!1)},1500))},eZ=eU.filter(e=>{var t;return!eA||e.name.toLowerCase().includes(eA.toLowerCase())||e.description.toLowerCase().includes(eA.toLowerCase())||(null==(t=e.tags)?void 0:t.some(e=>e.toLowerCase().includes(eA.toLowerCase())))});return(0,a.jsx)(i.lG,{open:Z,onOpenChange:G,children:(0,a.jsxs)(i.Cf,{hideCloseButton:!0,className:(0,_.cn)("overflow-hidden gap-0","profile-select"===Y?"max-w-2xl p-0":"max-w-lg p-0"),children:[(0,a.jsx)(M,{currentStep:Y,mode:R}),ek?(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 px-6",children:[(0,a.jsx)("div",{className:"mb-4",children:(0,a.jsx)(O.v,{size:"large"})}),(0,a.jsx)("h3",{className:"font-semibold text-lg mb-2",children:"Adding Tools..."}),(0,a.jsxs)("p",{className:"text-sm text-muted-foreground text-center",children:["Please wait while we add all ",K.name," tools to your agent"]})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(i.c7,{className:"px-6 pb-3",children:(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[K.logo?(0,a.jsx)("img",{src:K.logo,alt:K.name,className:"w-10 h-10 rounded-lg object-contain bg-muted p-1.5 border"}):(0,a.jsx)("div",{className:"w-10 h-10 rounded-lg bg-gradient-to-br from-primary/20 to-primary/10 flex items-center justify-center text-primary font-semibold text-sm",children:K.name.charAt(0)}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)(i.L3,{className:"text-base font-semibold",children:null==(t=I.find(e=>e.id===Y))?void 0:t.title}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:null==(s=I.find(e=>e.id===Y))?void 0:s.description})]})]})}),(0,a.jsxs)("div",{className:(0,_.cn)("flex-1 overflow-hidden","profile-select"===Y?"px-0 pb-0 pt-0":"px-8 pb-8 pt-6"),children:["profile-select"===Y&&(0,a.jsxs)("div",{className:"flex flex-col h-full max-h-[500px]",children:[(0,a.jsx)("div",{className:"flex-1 overflow-y-auto scrollbar-thin scrollbar-thumb-primary/20 scrollbar-track-transparent",children:(0,a.jsxs)("div",{className:"p-6 space-y-6",children:[(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[K.logo?(0,a.jsx)("img",{src:K.logo,alt:K.name,className:"w-8 h-8 rounded-lg object-contain bg-muted p-1 border flex-shrink-0"}):(0,a.jsx)("div",{className:"w-8 h-8 rounded-lg bg-gradient-to-br from-primary/20 to-primary/10 flex items-center justify-center text-primary font-semibold text-sm flex-shrink-0",children:K.name.charAt(0)}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("h4",{className:"font-medium text-foreground",children:["Connect to ",K.name]}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"Choose an existing profile or create a new connection"})]}),(0,a.jsxs)(r.$,{variant:"outline",size:"sm",onClick:()=>ed(!eo),children:[eo?"Hide":"View"," Tools"]})]}),(0,a.jsxs)("div",{className:"grid gap-3",children:[eO.length>0&&(0,a.jsx)(S.Zp,{className:(0,_.cn)("cursor-pointer p-0 transition-all","existing"===ec?"border-primary bg-primary/5":"border-border hover:border-border/80"),onClick:()=>{if("existing"===ec)eu(null),et("");else{var e;eu("existing"),et((null==(e=eO[0])?void 0:e.profile_id)||"")}},children:(0,a.jsxs)(S.Wu,{className:"p-2",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"w-10 h-10 rounded-xl bg-green-200 dark:bg-green-900/20 flex items-center justify-center",children:(0,a.jsx)(f.default,{className:"w-5 h-5 text-green-600 dark:text-green-400"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h5",{className:"font-medium text-sm",children:"Use Existing Connection"}),(0,a.jsxs)("p",{className:"text-xs text-muted-foreground",children:[eO.length," profile",eO.length>
11?"s":""," ","already connected"]})]})]}),(0,a.jsx)(p.default,{className:(0,_.cn)("w-4 h-4 text-muted-foreground transition-transform","existing"===ec&&"rotate-90")})]}),(0,a.jsx)(P.N,{children:"existing"===ec&&(0,a.jsx)(z.P.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2,ease:"easeInOut"},className:"overflow-hidden",children:(0,a.jsx)("div",{className:"mt-3 pt-3 border-t border-border/50",children:(0,a.jsxs)(c.l6,{value:ee,onValueChange:et,children:[(0,a.jsx)(c.bq,{className:"w-full h-10",children:(0,a.jsx)(c.yv,{placeholder:"Select a profile..."})}),(0,a.jsx)(c.gC,{children:eO.map(e=>(0,a.jsx)(c.eb,{value:e.profile_id,children:(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[K.logo?(0,a.jsx)("img",{src:K.logo,alt:K.name,className:"w-5 h-5 rounded-lg object-contain bg-muted p-0.5 border flex-shrink-0"}):(0,a.jsx)("div",{className:"w-5 h-5 rounded-lg bg-gradient-to-br from-primary/20 to-primary/10 flex items-center justify-center text-primary text-xs font-semibold flex-shrink-0",children:K.name.charAt(0)}),(0,a.jsx)("div",{children:(0,a.jsx)("div",{className:"text-sm font-medium",children:e.profile_name})})]})},e.profile_id))})]})})})})]})}),(0,a.jsx)(S.Zp,{className:(0,_.cn)("cursor-pointer p-0 transition-all","new"===ec?"border-primary bg-primary/5":"border-border hover:border-border/80"),onClick:()=>{if("new"===ec)eu(null),et("");else{eu("new"),et("new");let e=U.includes(K.slug);ex({}),eh({}),ej({}),eN({}),ep(e),Q("".concat(K.name," Profile"))}},children:(0,a.jsx)(S.Wu,{className:"p-2",children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"w-10 h-10 rounded-xl bg-primary/10 flex items-center justify-center",children:(0,a.jsx)(m.default,{className:"w-5 h-5 text-primary"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h5",{className:"font-medium text-sm",children:"Create New Connection"}),(0,a.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Connect a new ",K.name," account"]})]})]}),(0,a.jsx)(p.default,{className:"w-4 h-4 text-muted-foreground"})]})})})]})]}),(0,a.jsx)(P.N,{children:eo&&(0,a.jsx)(z.P.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.3,ease:"easeInOut"},className:"overflow-hidden",children:(0,a.jsx)("div",{className:"space-y-3",children:(0,a.jsx)(L.F,{className:"h-[200px] border rounded-md bg-muted/10",children:(0,a.jsx)("div",{className:"p-2",children:eM?(0,a.jsx)("div",{className:"grid grid-cols-2 gap-1",children:[...Array(8)].map((e,t)=>(0,a.jsxs)("div",{className:"border rounded-md p-2 animate-pulse bg-background/50",children:[(0,a.jsx)("div",{className:"h-2 bg-muted rounded w-3/4 mb-1"}),(0,a.jsx)("div",{className:"h-2 bg-muted rounded w-1/2"})]},t))}):eZ.length>0?(0,a.jsx)("div",{className:"grid grid-cols-2 gap-1",children:eZ.map(e=>(0,a.jsx)($,{tool:e,searchTerm:eA},e.slug))}):(0,a.jsxs)("div",{className:"text-center py-6 text-muted-foreground",children:[(0,a.jsx)(v.default,{className:"h-4 w-4 mx-auto mb-2"}),(0,a.jsx)("p",{className:"text-xs",children:eA?"No matches":"No tools available"})]})})})})})})]})}),(0,a.jsx)("div",{className:"px-6 py-4 border-t border-border/50 bg-muted/20 flex-shrink-0",children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("div",{className:"text-sm text-muted-foreground",children:"new"===ec?"Ready to create new connection":"existing"===ec&&ee?"Profile selected":"existing"===ec?"Select a profile to continue":"Choose how you want to connect"}),(0,a.jsxs)("div",{className:"flex gap-3",children:[(0,a.jsx)(r.$,{variant:"outline",onClick:()=>G(!1),className:"px-6",children:"Cancel"}),(0,a.jsx)(r.$,{onClick:()=>{"new"===ec?eJ("profile-create"):eV()},disabled:!ec||"existing"===ec&&!ee||ek,className:"px-8 min-w-[120px]",children:ek?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(O.v,{customSize:16}),"Adding Tools..."]}):"new"===ec?(0,a.jsxs)(a.Fragment,{children:["Create Connection",(0,a.jsx)(p.default,{className:"h-4 w-4 ml-1"})]}):"existing"===ec&&ee?(0,a.jsxs)(a.Fragment,{children:["full"===R&&W?"Add All Tools":"Use Profile",(0,a.jsx)(p.default,{className:"h-4 w-4 ml-1"})]}):"Continue"})]})]})})]}),"profile-create"===Y&&(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[(0,a.jsx)("div",{className:"flex-1 overflow-y-auto",children:(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsx)(o.J,{htmlFor:"profileName",className:"text-sm font-medium",children:"Profile Name"}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)(n.p,{id:"profileName",value:X,onChange:e=>Q(e.target.value),placeholder:"e.g., ".concat(K.name," Production"),className:(0,_.cn)("pr-10 h-9",eq&&!eq.available&&"border-destructive",eq&&eq.available&&X.length>0&&"border-green-500")}),(0,a.jsxs)("div",{className:"absolute right-2 top-1/2 -translate-y-1/2",children:[eT&&X.length>0&&(0,a.jsx)(O.v,{customSize:14}),!eT&&eq&&X.length>0&&(0,a.jsx)(a.Fragment,{children:eq.available?(0,a.jsx)(f.default,{className:"h-3.5 w-3.5 text-green-500"}):(0,a.jsx)(j.default,{className:"h-3.5 w-3.5 text-destructive"})})]})]}),eq&&!eq.available&&(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)("p",{className:"text-xs text-destructive",children:"This name is already in use"}),eq.suggestions.length>0&&(0,a.jsx)("div",{className:"flex flex-wrap gap-1",children:eq.suggestions.map(e=>(0,a.jsx)("button",{type:"button",onClick:()=>Q(e),className:"text-xs px-2 py-0.5 rounded bg-muted hover:bg-muted/80 transition-colors",children:e},e))})]}),eq&&eq.available&&X.length>0&&(0,a.jsx)("p",{className:"text-xs text-green-600 dark:text-green-400",children:"Name available"})]}),!eL&&(null!=(V=null==eF||null==(A=eF.toolkit)||null==(h=A.connected_account_initiation_fields)||null==(u=h.required)?void 0:u.length)?V:0)>0&&(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)(g.default,{className:"h-3.5 w-3.5 text-muted-foreground"}),(0,a.jsx)(o.J,{className:"text-sm font-medium",children:"Connection Details"})]}),null==eF||null==(J=eF.toolkit)||null==(D=J.connected_account_initiation_fields)||null==(E=D.required)?void 0:E.map(e=>{var t;let s=(null==(t=e.type)?void 0:t.toLowerCase())||"string",l="boolean"===s,r="number"===s||"double"===s;return(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)(o.J,{htmlFor:e.name,className:"text-xs",children:[e.displayName,e.required&&(0,a.jsx)("span",{className:"text-destructive ml-1",children:"*"})]}),l?(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(F.d,{id:e.name,checked:"true"===em[e.name],onCheckedChange:t=>e$(e.name,t?"true":"false")}),(0,a.jsx)(o.J,{htmlFor:e.name,className:"text-xs font-normal",children:e.description||"Enable"})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.p,{id:e.name,type:"password"===s?"password":"email"===s?"email":"url"===s?"url":r?"number":"text",value:em[e.name]||"",onChange:t=>e$(e.name,t.target.value),placeholder:e.default||e.description||"Enter ".concat(e.displayName.toLowerCase()),className:(0,_.cn)("h-8",ef[e.name]&&"border-destructive"),step:r?"any":void 0}),e.description&&!l&&(0,a.jsx)("p",{className:"text-[10px] text-muted-foreground",children:e.description})]}),ef[e.name]&&(0,a.jsx)("p",{className:"text-[10px] text-destructive",children:ef[e.name]})]},e.name)})]}),eL&&(0,a.jsx)("div",{className:"space-y-3",children:(0,a.jsx)(q.Skeleton,{className:"h-4 w-32"})})]})}),(0,a.jsx)("div",{className:"mt-4",children:(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsxs)(r.$,{variant:"outline",size:"sm",onClick:()=>{switch(Y){case"profile-create":if("profile-only"===R)G(!1);else{let e=U.includes(K.slug);ex({}),eh({}),ej({}),eN({}),ep(e),Q("".concat(K.name," Profile")),eJ("profile-select")}break;case"connecting":eJ("profile-create")}},disabled:ez,className:"flex-1 h-8",children:[(0,a.jsx)(b.default,{className:"h-3.5 w-3.5 mr-1"}),"Back"]}),(0,a.jsx)(r.$,{size:"sm",onClick:()=>X.trim()?eq&&!eq.available?void C.toast.error("This profile name is already in use. Please choose a different name."):(()=>{var e,t;if(!eg)return!0;let s={},a=null==eF||null==(e=eF.toolkit.auth_config_details)?void 0:e[0],l=null==a||null==(t=a.fields)?void 0:t.auth_config_creation;if(null==l?void 0:l.required){for(let e of l.required)if(e.required){let t=ev[e.name];t&&""!==t.trim()||(s[e.name]="".concat(e.displayName," is required"))}}return eN(s),0===Object.keys(s).length})()?(()=>{let e={},t=null==eF?void 0:eF.toolkit.connected_account_initiation_fields;if(null==t?void 0:t.required){for(let s of t.required)if(s.required){let t=em[s.name],a=!t||""===t.trim();if("boolean"===s.type.toLowerCase())continue;if(("number"===s.type.toLowerCase()||"double"===s.type.toLowerCase())&&t&&isNaN(Number(t))){e[s.name]="".concat(s.displayName," must be a valid number");continue}a&&(e[s.name]="".concat(s.displayName," is required"))}}return eh(e),0===Object.keys(e).length})()?void e_({toolkit_slug:K.slug,profile_name:X,initiation_fields:Object.keys(em).length>0?em:void 0,custom_auth_config:eg&&Object.keys(ev).length>0?ev:void 0,use_custom_auth:eg},{onSuccess:async e=>{if(ea(e.profile_id),e.redirect_url)en(e.redirect_url),eJ("connecting"),window.open(e.redirect_url,"_blank","width=600,height=700");else if("full"===R&&W){eC(!0);try{var t;let s=(null==(t=(await k.o.getTools(K.slug,1e3)).tools)?void 0:t.map(e=>e.slug))||[];await eD(e.profile_id,s)}catch(e){eC(!1),C.toast.error(e.message||"Failed to fetch and save tools")}}else eJ("success"),setTimeout(()=>{H(e.profile_id,K.name,K.slug),G(!1)},1500)},onError:e=>{C.toast.error(e.message||"Failed to create profile")}}):void C.toast.error("Please fill in all required fields"):void C.toast.error("Please fill in all required OAuth configuration fields"):void C.toast.error("Profile name is required"),disabled:ez||eL||!X.trim()||eT||eq&&!eq.available,className:"flex-1 h-8",children:ez?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(O.v,{customSize:14,className:"mr-1"}),"Creating..."]}):(0,a.jsxs)(a.Fragment,{children:["Connect",(0,a.jsx)(p.default,{className:"h-3.5 w-3.5 ml-1"})]})})]})})]}),"connecting"===Y&&(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{className:"text-center space-y-6 py-8",children:[(0,a.jsx)("div",{className:"w-20 h-20 mx-auto border rounded-2xl bg-primary/10 flex items-center justify-center",children:(0,a.jsx)(x.default,{className:"h-10 w-10 text-primary animate-pulse"})}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)("h3",{className:"font-semibold text-lg",children:"Complete Authentication"}),(0,a.jsxs)("p",{className:"text-sm text-muted-foreground max-w-sm mx-auto",children:["A new window has opened for you to authorize your"," ",K.name," connection. Complete the process there and return here."]})]})]}),ei&&(0,a.jsxs)(d.Fc,{className:"bg-muted/50 border-muted",children:[(0,a.jsx)(N.default,{className:"h-4 w-4"}),(0,a.jsxs)(d.TN,{className:"text-sm",children:["If the window didn't open,"," ",(0,a.jsx)("button",{onClick:()=>window.open(ei,"_blank"),className:"underline font-medium hover:no-underline",children:"click here to authenticate"})]})]}),(0,a.jsx)(r.$,{onClick:eK,className:"w-full",disabled:ek,children:ek?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(O.v,{customSize:16}),"Adding Tools..."]}):(0,a.jsxs)(a.Fragment,{children:["I've Completed Authentication",(0,a.jsx)(p.default,{className:"h-4 w-4"})]})})]}),"success"===Y&&(0,a.jsx)("div",{className:"text-center py-8",children:(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsx)("div",{className:"w-18 h-18 mx-auto rounded-full bg-green-400 dark:bg-green-600 flex items-center justify-center",children:(0,a.jsx)(f.default,{className:"h-10 w-10 text-white"})}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)("h3",{className:"font-semibold text-lg",children:"Successfully Connected!"}),(0,a.jsxs)("p",{className:"text-sm text-muted-foreground",children:["Your ",K.name," integration is ready."]})]})]})})]})]})]})})}},11186:(e,t,s)=>{"use strict";s.d(t,{bq:()=>u,eb:()=>x,gC:()=>m,l6:()=>d,yv:()=>c});var a=s(95155);s(12115);var l=s(4729),r=s(24033),i=s(5917),n=s(12108),o=s(64269);function d(e){let{...t}=e;return(0,a.jsx)(l.bL,{"data-slot":"select",...t})}function c(e){let{...t}=e;return(0,a.jsx)(l.WT,{"data-slot":"select-value",...t})}function u(e){let{className:t,size:s="default",children:i,...n}=e;return(0,a.jsxs)(l.l9,{"data-slot":"select-trigger","data-size":s,className:(0,o.cn)("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-2xl border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...n,children:[i,(0,a.jsx)(l.In,{asChild:!0,children:(0,a.jsx)(r.default,{className:"size-4 opacity-50"})})]})}function m(e){let{className:t,children:s,position:r="popper",...i}=e;return(0,a.jsx)(l.ZL,{children:(0,a.jsxs)(l.UC,{"data-slot":"select-content",className:(0,o.cn)("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:sli
1de-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-2xl border shadow-md","popper"===r&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:r,...i,children:[(0,a.jsx)(f,{}),(0,a.jsx)(l.LM,{className:(0,o.cn)("p-1","popper"===r&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:s}),(0,a.jsx)(h,{})]})})}function x(e){let{className:t,children:s,...r}=e;return(0,a.jsxs)(l.q7,{"data-slot":"select-item",className:(0,o.cn)("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-2xl py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",t),...r,children:[(0,a.jsx)("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:(0,a.jsx)(l.VF,{children:(0,a.jsx)(i.default,{className:"size-4"})})}),(0,a.jsx)(l.p4,{children:s})]})}function f(e){let{className:t,...s}=e;return(0,a.jsx)(l.PP,{"data-slot":"select-scroll-up-button",className:(0,o.cn)("flex cursor-default items-center justify-center py-1",t),...s,children:(0,a.jsx)(n.default,{className:"size-4"})})}function h(e){let{className:t,...s}=e;return(0,a.jsx)(l.wn,{"data-slot":"select-scroll-down-button",className:(0,o.cn)("flex cursor-default items-center justify-center py-1",t),...s,children:(0,a.jsx)(r.default,{className:"size-4"})})}},17037:(e,t,s)=>{"use strict";s.d(t,{$:()=>n,F:()=>i});var a=s(95155);s(12115);var l=s(59034),r=s(64269);function i(e){let{className:t,children:s,...i}=e;return(0,a.jsxs)(l.bL,{"data-slot":"scroll-area",className:(0,r.cn)("relative",t),...i,children:[(0,a.jsx)(l.LM,{"data-slot":"scroll-area-viewport",className:"focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1 [&>div]:!block",children:s}),(0,a.jsx)(n,{}),(0,a.jsx)(n,{orientation:"horizontal"}),(0,a.jsx)(l.OK,{})]})}function n(e){let{className:t,orientation:s="vertical",...i}=e;return(0,a.jsx)(l.VM,{"data-slot":"scroll-area-scrollbar",orientation:s,className:(0,r.cn)("flex touch-none p-px transition-colors select-none","vertical"===s&&"h-full w-2.5 border-l border-l-transparent","horizontal"===s&&"h-2.5 flex-col border-t border-t-transparent",t),...i,children:(0,a.jsx)(l.lr,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}},18332:(e,t,s)=>{"use strict";s.d(t,{Fc:()=>n,TN:()=>d,XL:()=>o});var a=s(95155);s(12115);var l=s(83101),r=s(64269);let i=(0,l.F)("relative w-full rounded-2xl border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90",warning:"text-amber-600 border-amber-600/50 bg-amber-200/10 dark:bg-amber-900/10 dark:border-amber-600/50 dark:text-amber-400 [&>svg]:text-current *:data-[slot=alert-description]:text-amber-500/90"}},defaultVariants:{variant:"default"}});function n(e){let{className:t,variant:s,...l}=e;return(0,a.jsx)("div",{"data-slot":"alert",role:"alert",className:(0,r.cn)(i({variant:s}),t),...l})}function o(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"alert-title",className:(0,r.cn)("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",t),...s})}function d(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"alert-description",className:(0,r.cn)("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",t),...s})}},44846:(e,t,s)=>{"use strict";s.d(t,{d:()=>i});var a=s(95155);s(12115);var l=s(27599),r=s(64269);function i(e){let{className:t,...s}=e;return(0,a.jsx)(l.bL,{"data-slot":"switch",className:(0,r.cn)("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",t),...s,children:(0,a.jsx)(l.zi,{"data-slot":"switch-thumb",className:(0,r.cn)("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}},50259:(e,t,s)=>{var a={"./loading-black-old.json":[88002,88002],"./loading-black.json":[21462,21462],"./loading-white-old.json":[69380,69380],"./loading-white.json":[71548,71548]};function l(e){if(!s.o(a,e))return Promise.resolve().then(()=>{var t=Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t});var t=a[e],l=t[0];return s.e(t[1]).then(()=>s.t(l,19))}l.keys=()=>Object.keys(a),l.id=50259,e.exports=l},51834:(e,t,s)=>{"use strict";s.d(t,{Cf:()=>m,Es:()=>f,HM:()=>c,L3:()=>h,c7:()=>x,lG:()=>n,rr:()=>g,zM:()=>o});var a=s(95155);s(12115);var l=s(93409),r=s(65229),i=s(64269);function n(e){let{...t}=e;return(0,a.jsx)(l.bL,{"data-slot":"dialog",...t})}function o(e){let{...t}=e;return(0,a.jsx)(l.l9,{"data-slot":"dialog-trigger",...t})}function d(e){let{...t}=e;return(0,a.jsx)(l.ZL,{"data-slot":"dialog-portal",...t})}function c(e){let{...t}=e;return(0,a.jsx)(l.bm,{"data-slot":"dialog-close",...t})}function u(e){let{className:t,...s}=e;return(0,a.jsx)(l.hJ,{"data-slot":"dialog-overlay",className:(0,i.cn)("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-[9998] bg-black/50 backdrop-blur-xs",t),...s})}function m(e){var t;let{className:s,children:n,hideCloseButton:o=!1,...c}=e;return(0,a.jsxs)(d,{"data-slot":"dialog-portal",children:[(0,a.jsx)(u,{}),(0,a.jsxs)(l.UC,{"data-slot":"dialog-content","aria-describedby":null!=(t=c["aria-describedby"])?t:void 0,className:(0,i.cn)("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-[9999] grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 roun
1ded-2xl border p-6 shadow-lg duration-200",s),...c,children:[n,!o&&(0,a.jsxs)(l.bm,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[(0,a.jsx)(r.default,{}),(0,a.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function x(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"dialog-header",className:(0,i.cn)("flex flex-col gap-2 text-center sm:text-left",t),...s})}function f(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"dialog-footer",className:(0,i.cn)("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...s})}function h(e){let{className:t,...s}=e;return(0,a.jsx)(l.hE,{"data-slot":"dialog-title",className:(0,i.cn)("text-lg leading-none font-semibold",t),...s})}function g(e){let{className:t,...s}=e;return(0,a.jsx)(l.VY,{"data-slot":"dialog-description",className:(0,i.cn)("text-muted-foreground text-sm",t),...s})}},61535:(e,t,s)=>{"use strict";s.d(t,{D:()=>u,v:()=>u});var a=s(95155),l=s(12115),r=s(67909),i=s(5379),n=s(64269);let o=(0,r.default)(()=>Promise.all([s.e(69066),s.e(67853)]).then(s.t.bind(s,67853,23)),{loadableGenerated:{webpack:()=>[67853]},ssr:!1}),d={small:14,medium:24,large:40,xlarge:80},c={};function u(e){let t,{size:r="medium",speed:u=1.2,customSize:m,className:x,style:f,autoPlay:h=!0,loop:g=!0,variant:p="auto",forceTheme:v}=e,{resolvedTheme:j}=(0,i.D)(),b=m||d[r],[N,y]=l.useState(!1),[w,k]=l.useState(null);return(t="auto"!==p?p:v?"dark"===v?"white":"black":"dark"===(j||"dark")?"white":"black",l.useEffect(()=>{y(!0)},[]),l.useEffect(()=>{N&&(c[t]?Promise.resolve(c[t]):s(50259)("./loading-".concat(t,".json")).then(e=>(c[t]=e.default,e.default))).then(k)},[N,t]),N&&w)?(0,a.jsx)("div",{className:(0,n.cn)("flex items-center justify-center",x),style:f,children:(0,a.jsx)(o,{animationData:w,loop:g,autoplay:h,style:{width:b,height:b}})}):(0,a.jsx)("div",{className:(0,n.cn)("flex items-center justify-center",x),style:f,children:(0,a.jsx)("div",{style:{width:b,height:b}})})}},73457:(e,t,s)=>{"use strict";s.d(t,{S:()=>n});var a=s(95155);s(12115);var l=s(38162),r=s(5917),i=s(64269);function n(e){let{className:t,...s}=e;return(0,a.jsx)(l.bL,{"data-slot":"checkbox",className:(0,i.cn)("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-2xl border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",t),...s,children:(0,a.jsx)(l.C1,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:(0,a.jsx)(r.default,{className:"size-3.5"})})})}},82699:(e,t,s)=>{"use strict";s.d(t,{Fv:()=>n,kP:()=>o,lj:()=>i});var a=s(53455),l=s(77874),r=s(82289);let i=e=>(0,a.I)({queryKey:r.O.profiles.list(e),queryFn:()=>l.o.getProfiles(e),staleTime:3e5}),n=()=>(0,a.I)({queryKey:r.O.profiles.all(),queryFn:()=>l.o.getCredentialsProfiles(),staleTime:3e5}),o=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return(0,a.I)({queryKey:r.O.profiles.mcpConfig(e),queryFn:()=>l.o.getMcpUrl(e),enabled:t&&!!e,staleTime:0,gcTime:0})}}}]);
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.