import{P as g,Q as o,dI as u,T as d,bo as p,u as c,dM as h,ck as m,j as i,D as R,cp as C,b as x,$ as j,gQ as f,o as y,q as L,L as A,bS as T}from"./index-46ma1THH.js";import{R as b}from"./RoleChainingTable-DW3ptTmF.js";import"./useProjectOptions-Cg26SvBL.js";const v=g.injectEndpoints({endpoints:t=>({getRoleChainingList:t.query({query:({id:e})=>({url:`/project/${e}/cloud/role-mappings?sort_by=ID`}),providesTags:d.providesList(o.IAMRoleChainingTags.RoleChainingList),transformResponse:e=>e.count>0?e.items:[]}),updateRoleChainingDefault:t.mutation({query:({projectId:e,id:a,defaultRole:n})=>{const s=u.stringify({defaultRole:n});return{url:`/project/${e}/cloud/role-mappings/${a}?${s}`,method:"put"}},invalidatesTags:(e,a)=>[{type:o.IAMRoleChainingTags.RoleChainingAdminList},{type:o.IAMRoleChainingTags.RoleChainingList}]})})}),{useGetRoleChainingListQuery:I}=v,D=()=>{const t=p(),{id:e}=c(),{data:a,isLoading:n}=h(),{data:s=[],isLoading:r}=I({id:+e}),{isAdmin:l}=m();return r||n?i.jsx(R,{}):a!=null&&a.enabled?i.jsxs(x,{title:"IAM Role Chaining",maxHeight:"calc(100vh - 215px)",contentProps:{pb:0,overflow:"auto"},children:[i.jsx(j,{flexDirection:"row",mb:"28px",children:l&&i.jsx(f,{onClick:()=>{t(y(L.settings.iamRoleChaining.list))},mode:"default",children:"edit cloud role ->"})}),s&&s.length>0?i.jsx(b,{roleChaining:s,isEditable:!1}):i.jsx(A,{my:"40px",children:i.jsx(T,{mainText:"No IAM Role Chaining found"})})]}):i.jsx(C,{})};export{D as default};
