import{b0 as v,bc as A,az as R,aI as q,ao as e,aF as y,L as N,aq as c,bU as i}from"./app-k0jcl5PQ.js";import{J as m}from"./CYLKJSfE.chunk.js";import{U as b}from"./9ls1F1Ve.chunk.js";import"./fstW5ZQE.chunk.js";const n="userManager.inviteRequestsPopup",r=N.encloseNamespace(n),a={[m.Approved]:{heading:"approveHeading",body:"approveBody",buttonLabel:"approveButton",buttonVariant:"dark",successAlert:"approveSuccessAlert",errorAlert:"approveErrorAlert"},[m.Denied]:{heading:"rejectHeading",body:"rejectBody",buttonLabel:"rejectButton",buttonVariant:"danger",successAlert:"rejectSuccessAlert",errorAlert:"rejectErrorAlert"}};function F(l){const{id:j,status:t,closePopup:u}=l,h=v(),p=A(),o=R(b.joinRequests()),s=!!o.data.length&&o.data.find(g=>g.id===j),[x,d]=q.useState(!1);async function f(){try{d(!0),await h(b.resolveJoinRequest(s.id,t)),p.success(r(a[t].successAlert,{user:s.fullName||s.email}))}catch{p.error(r(a[t].errorAlert,{user:s.fullName||s.email}))}finally{d(!1),u()}}return o.hasCompleted?e.jsx(y,{title:r(a[t].heading),closePopup:l.closePopup,children:e.jsxs(e.Fragment,{children:[e.jsx("p",{children:e.jsx(c,{namespace:n,phrase:a[t].body})}),s.fullName?e.jsxs("div",{className:"mb-2",children:[e.jsx("div",{className:"fw-semibold",children:e.jsx(c,{namespace:n,phrase:"nameLabel"})}),s.fullName]}):e.jsx(e.Fragment,{}),e.jsxs("div",{className:"mb-3",children:[e.jsx("div",{className:"fw-semibold",children:e.jsx(c,{namespace:n,phrase:"emailLabel"})}),s.email]}),e.jsxs(i,{children:[e.jsx(i.Cancel,{onClick:u}),e.jsx(i.Submit,{variant:a[t].buttonVariant,onClick:()=>f(),text:r(a[t].buttonLabel),showSpinner:x})]})]})}):e.jsx(e.Fragment,{})}export{F as AccessRequestsPopupView};
//# sourceMappingURL=DMs2BPzN.chunk.js.map
