1import{C as c,D as Y,J as v,y as n,H as J,ae as L,F as Q,E as q,r as m,K as o,bH as G}from"./index.4f047985.js";import{u as V,a as X}from"./useSiteEnrollmentsBiomarkers.7c983f5e.js";import{S as Z,B as $,E as D}from"./index.7684a90f.js";import{u as y}from"./AuthenticatedUserRouter.74773764.js";import{m as S,y as tt,g as at}from"./useTableQueryState.efd4e0a7.js";import{T as rt}from"./Trans.a0fb5360.js";import{S as et}from"./SleepMonitoring.3037e640.js";import{l as nt,x as ot,B as st,z as it}from"./biomarkers.b1bb693a.js";import"./SystemStatusInfo.92a8d41a.js";import"./steps.95a9c18c.js";import"./useMutation.99780cbb.js";import"./TextField.599ccd97.js";import"./createSvgIcon.d191021b.js";import"./ListItemText.42472e90.js";import"./IconButton.aabf4fb2.js";import"./AppBar.09ed1729.js";import"./workbox-window.prod.es5.47c6b59a.js";import"./TableRow.f8a77a83.js";import"./TablePlaceholder.21d247f5.js";import"./Path.34b8688e.js";import"./SiteSelector.7151c19b.js";import"./TableContainer.83bd5d35.js";import"./EnrollmentStatusLabel.726c9980.js";import"./LastDataSyncBiomarker.16905a6c.js";const mt=c("div")({display:"flex",alignItems:"center",justifyContent:"space-between"}),lt=c("label")(({theme:s})=>({marginRight:s.spacing(2),fontWeight:200,"& strong":{fontWeight:400}})),pt=c(Y)(({theme:s})=>({padding:s.spacing(1.5,2),display:"flex",alignItems:"center"})),ct=c("div")({display:"flex",alignItems:"center"}),ut=({totalUsers:s,loading:u})=>{const{t:g}=v(),f=()=>n.createElement(rt,{t:g,i18nKey:"participants_on_site",values:{total:s},components:{strong:n.createElement("strong",null)}}),p=()=>n.createElement(lt,{htmlFor:"selection-summary"},f()),b=()=>n.createElement(Z,{variant:"text",width:"10em"});return n.createElement(mt,null,n.createElement(ct,null,n.createElement(pt,null,u?b():p())))},gt=100,U=500,jt=({search:s,tableState:{page:u,rowsPerPage:g,rowsPerPageOptions:f,setPage:p,resetPage:b,setRowsPerPage:R,sortInfo:E,setSortInfo:F},onEnrollmentsLoaded:h})=>{var d,w,B;const{checkPermissions:A}=J(),{t:x}=v(),{selectedSite:a,selectedStudy:t}=y(),C=L(),[N]=Q(),{addSearchParams:k}=q(),{data:r}=V(Number(a==null?void 0:a.id),{enabled:Boolean(a)}),O=m.exports.useMemo(()=>{const{to:e,timeRange:i}=it(7),l=e(nt);return{from:l.subtract(i-ot,"s"),to:l,include:[$.SLEEP],precision:st.DAY}},[]),{data:P}=X(Number(a==null?void 0:a.id),O,{enabled:Boolean(a)}),M=A(o.admin(),o.enrollmentCreator(),o.operationsManager(),o.orgs.owner.of(Number((d=t==null?void 0:t.organization)==null?void 0:d.id)),o.orgs.admin.of(Number((w=t==null?void 0:t.organization)==null?void 0:w.id)),o.orgs.manager.of(Number((B=t==null?void 0:t.organization)==null?void 0:B.id)),o.studies.owner.of(Number(t==null?void 0:t.id)),o.studies.admin.of(Number(t==null?void 0:t.id)),o.studies.manager.of(Number(t==null?void 0:t.id)),o.sites.manager.of(Number(a==null?void 0:a.id)),o.sites.admin.of(Number(a==null?void 0:a.id)),o.sites.owner.of(Number(a==null?void 0:a.id))),z=m.exports.useMemo(()=>{if(!r)return 0;const e=r.filter(({status:l})=>l!==D.EARLY_TERM&&l!==D.ENDED),i=U-e.length;return Math.min(i,gt)},[r]);m.exports.useEffect(()=>{r&&(h==null||h(r))},[r]),m.exports.useEffect(()=>{!N.has("site")&&(t==null?void 0:t.sites)&&t.sites.length>0&&C(k({site:t.sites[0].id}),{replace:!0})},[k,C,N,t==null?void 0:t.sites]),m.exports.useEffect(()=>{p(0)},[a==null?void 0:a.id,t==null?void 0:t.id,p]);const I=m.exports.useMemo(()=>{const e=S(x);return Object.entries(e).sort(([,i],[,l])=>i.label<l.label?-1:1).map(([i])=>i)},[x]),T=m.exports.useMemo(()=>tt(r,P,E,I),[I,r,E,P]),W=m.exports.useMemo(()=>s?T.filter(e=>at(e).toLowerCase().includes(s.toLowerCase())):T,[s,T]),_=M&&z>0,j=e=>F(e),H=e=>p(e),K=e=>{b(),R(e)};return n.createElement(n.Fragment,null,n.createElement(G,null,n.createElement("title",null,x("sleep_title"))),n.createElement(ut,{totalUsers:(r==null?void 0:r.length)||0,loading:!r,canOnboardUsers:M,onboardingEnabled:_,maxTotalParticipants:U}),n.createElement(et,{loading:!r,enrollments:W,totalEnrollments:(r==null?void 0:r.length)||0,biomarkers:P,sortInfo:E,page:u,rowsPerPage:g,rowsPerPageOptions:f,onSortInfoChange:j,onPageChange:H,onRowsPerPageChange:K}))};export{jt as default}; 2//# sourceMappingURL=SleepSummary.cbfc0b1c.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.