import{j as i}from"./vendor-react-wBh_31cN.js";import{C as p,a as l,b as d,c as u}from"./card-BeQtvmcJ.js";import{a7 as g,a4 as s,aT as c,aQ as h,$ as C,aq as f,G as R,g as j,r as x}from"./index-dNe6i2rS.js";import{R as v}from"./RoleChainingTable-TppHGVrY.js";import{N as y}from"./NoData-BtM2pAIA.js";import{E as T}from"./Error404-DQ9qHPOM.js";import{u as A}from"./index-Cs_VUG1d.js";import{u as L,c as N}from"./vendor-router-D1GqFWiT.js";import"./vendor-redux-CJZrIb6x.js";import"./vendor-utils-OeoE2qq_.js";import"./vendor-icons-BUUmD6ht.js";import"./vendor-radix-BRyWS4bQ.js";import"./vendor-grid-CeFlDWv4.js";import"./table-a0YeQrHM.js";import"./icon-button-BZeFL7T7.js";import"./input-DFI7JniT.js";import"./label-gPWmc6ow.js";import"./combobox-QqI9aNup.js";import"./input-group-gxy3DSmS.js";import"./textarea-BJVuSob1.js";import"./vendor-recharts-DmJlpLaF.js";import"./tooltip-DFFgUYh6.js";import"./confirmation-dialog-C7dws5K4.js";import"./useCopyToClipboard-DfzwgDFE.js";import"./useNotifier-BGMn6HaH.js";import"./notifications-5miqOdlG.js";import"./toast-wiGcevcF.js";import"./useProjectOptions-DNIvu1Mu.js";import"./project-eQY1xQe-.js";import"./index-DIs5Kizm.js";import"./Error-Cui9k53k.js";import"./useLastProject-Du1ajmeV.js";import"./useSortedProjects-DPrT0V3d.js";import"./index-DURBtSjL.js";import"./apply-CIuXDHQi.js";import"./concat-CTXo1gGM.js";import"./sortBy-COer1Ia5.js";import"./juxt-B5kKHsyp.js";import"./converge-D7u3m7i4.js";import"./includes-ucXR_9jq.js";const I=g.injectEndpoints({endpoints:a=>({getRoleChainingList:a.query({query:({id:t})=>({url:`/project/${t}/cloud/role-mappings?sort_by=ID`}),providesTags:h.providesList(s.IAMRoleChainingTags.RoleChainingList),transformResponse:t=>t.count>0?t.items:[]}),updateRoleChainingDefault:a.mutation({query:({projectId:t,id:o,defaultRole:e})=>{const r=c.stringify({defaultRole:e});return{url:`/project/${t}/cloud/role-mappings/${o}?${r}`,method:"put"}},invalidatesTags:(t,o)=>[{type:s.IAMRoleChainingTags.RoleChainingAdminList},{type:s.IAMRoleChainingTags.RoleChainingList}]})})}),{useGetRoleChainingListQuery:M,useUpdateRoleChainingDefaultMutation:hi}=I,Ci=()=>{const a=L(),{id:t}=N(),{data:o,isLoading:e}=A(),{data:r=[],isLoading:n}=M({id:+t}),{isAdmin:m}=C();return n||e?i.jsx(f,{}):o!=null&&o.enabled?i.jsxs(p,{className:"max-h-[calc(100vh-215px)] overflow-hidden",children:[i.jsx(l,{children:i.jsx(d,{children:"IAM Role Chaining"})}),i.jsxs(u,{className:"overflow-auto",children:[i.jsx("div",{className:"mb-7 flex flex-row",children:m&&i.jsx(R,{variant:"outline",size:"sm",onClick:()=>{a(j(x.settings.iamRoleChaining.list))},children:"edit cloud role ->"})}),r&&r.length>0?i.jsx(v,{roleChaining:r,isEditable:!1}):i.jsx("div",{className:"my-10",children:i.jsx(y,{mainText:"No IAM Role Chaining found"})})]})]}):i.jsx(T,{})};export{Ci as default};
