const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/UserForm-xe85Y6kS.js","assets/render-C1-Vvny8.js","assets/Box-BbbSuncO.js","assets/Button-DTVoBv0Y.js","assets/MenuItem-o3cI38L0.js","assets/Select-DMnB-FxS.js","assets/formControlState-C86DeWc0.js","assets/Paper-CNxaRlIm.js","assets/utils-DRjCtyoU.js","assets/Grow-CU7wvVf-.js","assets/TextField-CTe-SAnO.js","assets/isMuiElement-BP9xBIVK.js","assets/isMuiElement-Dar41GHE.js","assets/Typography-CZowogrb.js","assets/utils-CF94S7_6.js","assets/DeleteUserDialog-DN6PaZXU.js","assets/Warning-DC_j4KpI.js","assets/Alert-C8jEdKQG.js","assets/IconButton-DuqO9anE.js","assets/DialogActions-CSfNi6Fl.js","assets/DialogTitle-3xkF2gTa.js","assets/DialogContext-BL0M8m88.js","assets/DialogContentText-B3tPnlAQ.js"])))=>i.map(i=>d[i]);
import{_t as s,lt as e,n as r,t as o,yt as i}from"./render-C1-Vvny8.js";import"./modulepreload-polyfill-BSERo6Ae.js";import{t as n}from"./Grid-D9hUDpXa.js";import{t as a}from"./Box-BbbSuncO.js";import{t}from"./Base-CZ-AF-9U.js";import{t as l}from"./Typography-CZowogrb.js";import{t as d}from"./Button-DTVoBv0Y.js";import{t as c}from"./IconButton-DuqO9anE.js";import{t as h}from"./Dialog-q61FLv9_.js";import{t as j}from"./LinearProgress-DUnIJMrN.js";import{t as m}from"./TableContainer-CVhPwe5E.js";import{a as x,i as p,n as f,r as u,t as g}from"./TableCell-Df7cTnCH.js";import{t as b}from"./utils-CF94S7_6.js";import{t as _}from"./Delete-B5t7gZgU.js";import{t as z}from"./Edit-BkK4o9Vu.js";import{t as C}from"./preload-helper-Cwct_fkR.js";var S=i(s(),1),k=e(),y=(0,S.lazy)(()=>C(()=>import("./UserForm-xe85Y6kS.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]))),T=(0,S.lazy)(()=>C(()=>import("./DeleteUserDialog-DN6PaZXU.js"),__vite__mapDeps([15,1,16,7,17,18,2,3,19,20,21,13,22,14])));o({children:(0,k.jsx)(function(){const[s,e]=(0,S.useState)(null),[o,i]=(0,S.useState)([]),[C,E]=(0,S.useState)(!1),[D,$]=(0,S.useState)(null),{localeMessages:w,direction:B,userRole:I,apiBaseUrl:R,platformBaseUrl:U,organizationId:v}=r(),L=()=>{fetch(`${R}/organizations/${v}/users/`,{method:"GET",headers:{"Content-Type":"application/json","X-CSRFToken":b("csrftoken")}}).then(s=>s.json()).then(s=>{i(s.organization_users)}).catch(s=>{})};return(0,S.useEffect)(()=>{fetch(`${R}/organizations/${v}/`,{method:"GET",headers:{"Content-Type":"application/json","X-CSRFToken":b("csrftoken")}}).then(s=>s.json()).then(s=>{e(s)}).catch(s=>{}),L()},[]),(0,k.jsxs)(t,{breadCrumbList:[{label:w.organizations,href:`${U}/organizations`,index:0},{label:s?s.name:"",href:"#",index:1}],showOrganizationSwitcher:!1,children:[(0,k.jsx)(n,{size:12,py:2,px:4,children:(0,k.jsxs)(a,{sx:{p:2,border:"1px solid",borderColor:"border.main",backgroundColor:"background.box",borderRadius:2,minHeight:300},children:[(0,k.jsx)(d,{variant:"contained",color:"secondary",onClick:()=>{$((0,k.jsx)(S.Suspense,{fallback:(0,k.jsx)(a,{sx:{p:2},children:(0,k.jsx)(j,{})}),children:(0,k.jsx)(y,{organizationId:v,onClose:()=>E(!1),refreshUsers:L})})),E(!0)},children:w.add_user}),(0,k.jsx)(a,{sx:{mt:2,width:"100%"},children:o.length>0?(0,k.jsx)(m,{children:(0,k.jsxs)(x,{children:[(0,k.jsx)(p,{children:(0,k.jsxs)(u,{children:[(0,k.jsx)(g,{children:w.user}),(0,k.jsx)(g,{children:w.role}),"viewer"!==I&&(0,k.jsx)(g,{align:"rtl"===B?"left":"right",children:w.actions})]})}),(0,k.jsx)(f,{children:o.map(s=>(0,k.jsxs)(u,{children:[(0,k.jsx)(g,{children:s.email}),(0,k.jsx)(g,{children:s.role}),"viewer"!==I&&(0,k.jsxs)(g,{align:"rtl"===B?"left":"right",children:[(0,k.jsx)(c,{onClick:()=>{(s=>{$((0,k.jsx)(S.Suspense,{fallback:(0,k.jsx)(a,{sx:{p:2},children:(0,k.jsx)(j,{})}),children:(0,k.jsx)(y,{organizationId:v,onClose:()=>E(!1),refreshUsers:L,user:s})})),E(!0)})(s)},children:(0,k.jsx)(z,{fontSize:"small"})}),(0,k.jsx)(c,{"aria-label":`Delete ${s.email}`,onClick:()=>{$((0,k.jsx)(S.Suspense,{fallback:(0,k.jsx)(a,{sx:{p:2},children:(0,k.jsx)(j,{})}),children:(0,k.jsx)(T,{user:s,handleClose:()=>E(!1),handleSuccess:()=>{L(),E(!1)}})})),E(!0)},children:(0,k.jsx)(_,{fontSize:"small"})})]})]},s.user_id))})]})}):(0,k.jsx)(l,{variant:"body1",children:w.no_users_in_organization})})]})}),(0,k.jsx)(h,{open:C,onClose:()=>E(!1),fullWidth:!0,maxWidth:"sm",children:D})]})},{})});