import{bG as m,bH as p,bx as j,r as n,e1 as f,e2 as C,j as e,L as R,cE as b,f as v,q as r,bl as h,aJ as L,t as w,x as y,aH as E,v as N,F,c5 as A}from"./index-C6OVXshM.js";import{R as H}from"./RoleChainingTable-Lx3VOUjl.js";import"./useProjectOptions-fOgrzMyU.js";const S=()=>{m(p.iamRole);const d=j(),[i,l]=n.useState(""),{data:a=[],isLoading:t}=f(),{data:o,isLoading:g}=C(),[x,c]=n.useState([]);n.useEffect(()=>{!t&&a.length>0&&c(i?a.filter(s=>s.projectName.toLowerCase().includes(i)||s.cloudRole.toLowerCase().includes(i)):a)},[t,a,i]);const u=n.useCallback(({target:s})=>{l(s.value)},[l]);return t||g?e.jsx(R,{}):o!=null&&o.enabled?e.jsxs(v,{title:"IAM Role Chaining",maxHeight:"calc(100vh - 215px)",contentProps:{pb:0,overflow:"auto"},children:[e.jsxs(r,{mb:"28px",children:[e.jsxs(r,{width:4/5,children:[e.jsx(h,{color:"primary",mr:"5px",children:a.length}),e.jsx(h,{children:"role chaining"})]}),e.jsx(L,{onClick:()=>{d(w(y.settings.iamRoleChaining.create))},intent:"primary",ml:"auto",mt:-10,children:"New role chaining"})]}),a&&a.length>0?e.jsxs(e.Fragment,{children:[e.jsx(r,{mt:"10px",children:e.jsx(E,{width:"294px",value:i,icon:N.glass,placeholder:"Find a chaining by project name, cloud role...",onChange:u})}),e.jsx(H,{roleChaining:x,isEditable:!0})]}):e.jsx(F,{my:"40px",children:e.jsx(A,{mainText:"No IAM Role Chaining found"})})]}):e.jsx(b,{})};export{S as default};
