import{bw as m,bx as p,bo as j,r as n,dL as C,dM as b,j as e,D as f,cp as R,b as L,$ as r,bF as h,b1 as v,o as w,q as y,b2 as N,C as E,L as A,bS as F}from"./index-46ma1THH.js";import{R as S}from"./RoleChainingTable-DW3ptTmF.js";import"./useProjectOptions-Cg26SvBL.js";const T=()=>{m(p.iamRole);const d=j(),[i,l]=n.useState(""),{data:a=[],isLoading:t}=C(),{data:o,isLoading:g}=b(),[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(f,{}):o!=null&&o.enabled?e.jsxs(L,{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(v,{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(N,{width:"294px",value:i,icon:E.glass,placeholder:"Find a chaining by project name, cloud role...",onChange:u})}),e.jsx(S,{roleChaining:x,isEditable:!0})]}):e.jsx(A,{my:"40px",children:e.jsx(F,{mainText:"No IAM Role Chaining found"})})]}):e.jsx(R,{})};export{T as default};
