import{b as j,r as T,j as t}from"./vendor-react-wBh_31cN.js";import{G as u}from"./index-dNe6i2rS.js";import{T as m}from"./tooltip-DFFgUYh6.js";import{P as o}from"./project-eQY1xQe-.js";import{u as E}from"./useProjectRole-DpUIGfh9.js";const l=j.forwardRef(({children:r,className:e,allowedRoles:n=[o.DATA_OWNER,o.DATA_SCIENTIST,o.FEATURE_STORE_RESTRICTED],tooltip:d,isLoading:x,loading:R,...i},s)=>{const{userProjectRole:f}=E(),c=T.useMemo(()=>n.indexOf(o.ALL)>-1?!1:n.indexOf(f)<0,[n,f]),a=x??R;return c?t.jsx(m,{content:"Your role is not allowed to perform this action.",children:t.jsx(u,{ref:s,...i,loading:a,className:e,disabled:!0,children:r})}):d?t.jsx(m,{content:d,children:t.jsx(u,{ref:s,...i,loading:a,className:e,children:r})}):t.jsx(u,{ref:s,...i,loading:a,className:e,children:r})});l.displayName="ButtonWithRole";export{l as B};
