import{j as t,ej as h,bi as v,o as d,es as p}from"./app-BgLa5dit.js";import{D as y}from"./C4BcftDO.chunk.js";import{T as x}from"./lZO4aq5x.chunk.js";import{C as U}from"./c3I67AiW.chunk.js";import{g as N}from"./nb6O6S6P.chunk.js";import{C as T,a as I}from"./8iu0vnCW.chunk.js";import{C as k}from"./B20c1N-e.chunk.js";import{C as A}from"./q-IBKcuF.chunk.js";import"./C8_78Eqq.chunk.js";import"./m4aqaK_l.chunk.js";import"./KUnagq9Z.chunk.js";import"./DULWIWQR.chunk.js";import"./CCcwLDvu.chunk.js";import"./DDfKZ_ng.chunk.js";import"./3nM7jLnE.chunk.js";import"./CPXlV0fg.chunk.js";import"./ChrB5FYK.chunk.js";import"./DR2FaZH9.chunk.js";import"./DUpYPoLs.chunk.js";import"./EZim8aq-.chunk.js";import"./BD9MrUJP.chunk.js";import"./s6cGcwlA.chunk.js";import"./Zwjmkasg.chunk.js";import"./4qGb1BIY.chunk.js";import"./DnXDEnAR.chunk.js";import"./DpUpv6rY.chunk.js";import"./CG7zbly5.chunk.js";import"./MEkA24R1.chunk.js";import"./C53kfXmd.chunk.js";const g=h(),V=[g.accessor("name",{id:"name",header:"Name",cell:e=>t.jsx("div",{className:"text-wrap",children:e.getValue()}),size:250}),g.accessor("videoCount",{id:"videoCount",header:"Number of videos",cell:e=>`${e.getValue()} videos`,size:200})];function S(e){if(!e.playlists||e.playlists.length===0)return null;const l=e.playlists.map(s=>{var o;return{name:s.name,videoCount:((o=s.videos)==null?void 0:o.count)??0}}),a={...U,row:""};return t.jsx(x,{data:l,columns:V,theme:a})}const C=h(),z={label:()=>C.accessor("label",{id:"label",header:"",cell:e=>e.getValue(),size:250}),value:()=>C.accessor("value",{id:"value",header:"",cell:e=>e.getValue(),size:200})};function D(e){var b;const{userWorkspaceUsage:l,user:a}=e;if(!l)return null;const{allocationInBytes:s=0,sizeInBytes:o=0}=l.workspaceSizeAllocation||{},i=s===Number.MAX_SAFE_INTEGER,r=(s/1024/1024/1024).toFixed(0),u=(o/1024/1024/1024).toFixed(2),n=s?(o/s*100).toFixed(2):"0.00",c=a.dateCreated?v.fromNow(a.dateCreated):"-",m=a.dateModified?v.fromNow(a.dateModified):"-",f=[{label:"Number of videos",value:l.videoCount??"-"},{label:"Number of clips",value:l.clipCount??"-"},{label:"Number of interactives",value:l.interactiveCount??"-"},{label:"Allocation",value:i?"Unlimited":`${r} GB`},{label:"Allocation used",value:`${u} GB`},{label:"Last active",value:N((b=a==null?void 0:a.metadata)==null?void 0:b.lastSignInTime,a==null?void 0:a.status)??"-"},{label:"Date user created",value:c??"-"},{label:"Date user modified",value:m??"-"}];i||f.push({label:"Percentage of allocation used",value:`${n}%`});const j={...U,header:"d-none"};return t.jsx(x,{data:f,columns:Object.values(z).map(w=>w()),theme:j})}function ce(e){var n,c,m;const a=(c=(n=d(p.getCustomers(e.id)).data)==null?void 0:n.data[0])==null?void 0:c.id,s=d(p.userWorkspaceUsage(a,e.id)),o=d(p.userPlaylistsAll(e.id)),i=A.getUser(a,e.id),r=d(i),u=s.hasCompleted&&r.hasCompleted&&o.hasCompleted;return t.jsx(T,{view:I.Users,children:t.jsx(k,{title:"User Usage",currentTabId:"usage",id:e.id,loading:!u,children:t.jsxs("div",{className:"d-flex flex-column gap-3",children:[t.jsx(D,{userWorkspaceUsage:s.data,user:r.data}),o.data&&t.jsx(y,{heading:"Playlists",disableCollapse:!0,children:t.jsx("div",{className:"d-flex flex-column",children:(m=o.data)!=null&&m.length?t.jsx(S,{playlists:o.data}):t.jsx("p",{className:"p-3 mb-0",children:"User has no playlists."})})})]})})})}export{ce as UserWorkspaceUsageView};
//# sourceMappingURL=DdHM5ZxW.chunk.js.map
