import{c as g,u as C,n as W,K as x,t as _,j as i,B as I}from"./index-U8yTDca7.js";import{a as w,u as L}from"./constants-DTB7OETZ.js";import{C as k}from"./collection-tab-BLToEStc.js";import{E as O}from"./collection-search-CMCsOI1D.js";import{u as S}from"./useMutation-DytEPkqh.js";import{P as u}from"./index-DBJYDzwg.js";import{B as b,a as h,b as P,c as y}from"./breadcrumb-CuW3e8GL.js";import{e as T}from"./Dataflow03-CNb2zbZ8.js";import"./generate-id-Dyweu44Y.js";import"./collection-display-button-D82Yvie2.js";import"./dropdown-menu-CP9xXuMG.js";import"./Check-CL49s9Bl.js";import"./ChevronRight-CnhF2HVf.js";import"./ArrowDown-BwyMmnDN.js";import"./ArrowUp-D8OfF8a6.js";import"./Grid01-BHDXELtU.js";import"./List-CrYUBNgo.js";import"./tooltip-Az0qqeXN.js";import"./index-Ds-_NbMX.js";import"./badge-1CDBdXDs.js";import"./card-CQC-kucr.js";import"./integration-icon-CQ1n5ppJ.js";import"./Container-dYTfUn5d.js";import"./Copy01-DKWM3-Cd.js";import"./DotsVertical-xAnpD2pG.js";import"./Edit01-DiGe0rMV.js";import"./Eye-HqhkOMp3.js";import"./Trash01-BLyORFpw.js";import"./collection-table-wrapper-C_-CT2vX.js";import"./table-CyqFhKGg.js";import"./empty-state-DSGwk3an.js";import"./Inbox01-tTi_MD7z.js";import"./user-DTHzV6e9.js";import"./avatar-BTrmVIKy.js";import"./useQuery-5ZDNJc1s.js";import"./use-list-state-BIZVgxIL.js";import"./use-view-mode-DqFqGCRy.js";import"./use-mobile-Bfs8r2XW.js";import"./constants-15nJD0dE.js";import"./alert-dialog-1fpppHI8.js";import"./use-collections-CN2TJbh7.js";import"./Plus-7bvNbAWU.js";import"./layout-CCrpUJR-.js";import"./Loading01-BqZPjLUL.js";import"./SearchMd-D3THAFfu.js";import"./input-DOiflCWe.js";import"./localstorage-keys-BqiTN_31.js";function B(){const e=g.c(12),{org:t,project:r}=C(),a=W();let c;e[0]!==t.id?(c={connectionId:w,orgId:t.id},e[0]=t.id,e[1]=c):c=e[1];const l=L(c);let o;e[2]!==l||e[3]!==r?(o=async d=>{const m=r.enabledPlugins??[];if(m.includes(d))return;const p=[...m,d],j=await l.callTool({name:"PROJECT_UPDATE",arguments:{projectId:r.id,enabledPlugins:p}});return j.structuredContent??j},e[2]=l,e[3]=r,e[4]=o):o=e[4];let n;e[5]!==t.id||e[6]!==r||e[7]!==a?(n=()=>{a.invalidateQueries({queryKey:x.project(t.id,r.slug)}),a.invalidateQueries({queryKey:x.projects(t.id)})},e[5]=t.id,e[6]=r,e[7]=a,e[8]=n):n=e[8];let s;return e[9]!==o||e[10]!==n?(s={mutationFn:o,onSuccess:n,onError:K},e[9]=o,e[10]=n,e[11]=s):s=e[11],S(s)}function K(e){_.error("Failed to enable plugin: "+(e instanceof Error?e.message:"Unknown error"))}function N(e){const t=g.c(12),{pluginId:r,title:a,description:c,icon:l}=e,o=B();let n;t[0]!==o||t[1]!==r?(n=async()=>{try{await o.mutateAsync(r),_.success("Plugin enabled!")}catch{}},t[0]=o,t[1]=r,t[2]=n):n=t[2];const s=n,f=l??null,d=o.isPending?"Enabling…":"Enable plugin";let m;t[3]!==o.isPending||t[4]!==s||t[5]!==d?(m=i.jsx(I,{onClick:s,disabled:o.isPending,children:d}),t[3]=o.isPending,t[4]=s,t[5]=d,t[6]=m):m=t[6];let p;return t[7]!==c||t[8]!==f||t[9]!==m||t[10]!==a?(p=i.jsx(O,{image:f,title:a,description:c,actions:m}),t[7]=c,t[8]=f,t[9]=m,t[10]=a,t[11]=p):p=t[11],p}const E="workflows",F={name:"WORKFLOW",displayName:"Workflow",hasCreateTool:!0,hasUpdateTool:!0,hasDeleteTool:!0};function Se(){const e=g.c(5),{project:t,org:r}=C();if(!(t.enabledPlugins??[]).includes(E)){let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=i.jsx(u.Header,{children:i.jsx(u.Header.Left,{children:i.jsx(b,{children:i.jsx(h,{children:i.jsx(P,{children:i.jsx(y,{children:"Workflows"})})})})})}),e[0]=n):n=e[0];let s;return e[1]===Symbol.for("react.memo_cache_sentinel")?(s=i.jsxs(u,{children:[n,i.jsx(u.Content,{children:i.jsx("div",{className:"flex flex-col items-center justify-center h-full",children:i.jsx(N,{pluginId:E,title:"Enable Workflows",description:"Automate multi-step processes by enabling the Workflows plugin. Once enabled you can create, run, and monitor workflows.",icon:i.jsx("div",{className:"bg-muted p-4 rounded-full",children:i.jsx(T,{className:"size-8 text-muted-foreground"})})})})})]}),e[1]=s):s=e[1],s}let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=i.jsx(u.Header,{children:i.jsx(u.Header.Left,{children:i.jsx(b,{children:i.jsx(h,{children:i.jsx(P,{children:i.jsx(y,{children:"Workflows"})})})})})}),e[2]=l):l=e[2];let o;return e[3]!==r.slug?(o=i.jsxs(u,{children:[l,i.jsx(u.Content,{children:i.jsx(k,{connectionId:w,org:r.slug,activeCollection:F})})]}),e[3]=r.slug,e[4]=o):o=e[4],o}export{Se as default};
