import{o as p,es as l,e2 as x,j as e,h as f,i as g,ag as j,e9 as y,P as C,f as S,aO as U}from"./app-BgLa5dit.js";import{S as w}from"./1Of0XWgF.chunk.js";import{B as b}from"./3nM7jLnE.chunk.js";import{C as N}from"./WqgNB-L4.chunk.js";import{u as v,R as L}from"./D2PVoBDN.chunk.js";import{U as q}from"./C6-eluIr.chunk.js";import{C as P,a as R}from"./8iu0vnCW.chunk.js";import"./CPXlV0fg.chunk.js";import"./0GREfvNX.chunk.js";import"./itQZri94.chunk.js";import"./Zwjmkasg.chunk.js";import"./Vn1DtJ-y.chunk.js";import"./DG_07YWO.chunk.js";import"./DNClpFKN.chunk.js";import"./DR2FaZH9.chunk.js";import"./q-IBKcuF.chunk.js";import"./DUpYPoLs.chunk.js";import"./EZim8aq-.chunk.js";import"./BD9MrUJP.chunk.js";import"./s6cGcwlA.chunk.js";import"./4qGb1BIY.chunk.js";import"./DnXDEnAR.chunk.js";import"./DpUpv6rY.chunk.js";import"./CG7zbly5.chunk.js";import"./m4aqaK_l.chunk.js";import"./MEkA24R1.chunk.js";import"./C53kfXmd.chunk.js";import"./lZO4aq5x.chunk.js";import"./C8_78Eqq.chunk.js";import"./c3I67AiW.chunk.js";import"./KUnagq9Z.chunk.js";import"./DULWIWQR.chunk.js";import"./CCcwLDvu.chunk.js";import"./DDfKZ_ng.chunk.js";function I(t){var s,r;return p(!!((r=(s=t.data)==null?void 0:s.data)!=null&&r.length)&&l.getById(t.data.data.map(a=>a.id)))}function pe(t){var m,d,c,u;const s=p(!!t.query&&l.searchUsers(t.query,t.cursor)),r=I(s),{isLoading:a}=v("user"),o=(d=(m=s.data)==null?void 0:m.data)!=null&&d.length?r.hasCompleted&&!a:s.hasCompleted&&!a,i=(c=s.data)==null?void 0:c.data,h=(u=s.data)==null?void 0:u.pagination,n=i&&x.convertLegacyPaginatedCollection(s.data).pagination.cursors;return e.jsx(P,{view:R.Users,children:e.jsxs("div",{className:"d-flex flex-column gap-4",children:[e.jsxs("div",{className:"d-flex flex-row justify-content-between",children:[e.jsxs("div",{children:[e.jsx("h1",{children:"Users"}),e.jsx(b,{breadcrumbs:[{name:"Curation Studio"},{name:"Users",active:!0}]})]}),e.jsx("div",{className:"w-50",children:e.jsx(w,{id:"user-search",queryParamName:"query",placeholder:"Enter user by name, username or email",searchAppLink:{application:g.CRM_STUDIO,action:f.CrmStudio.USERS},searchIndices:[]})})]}),(!t.query||t.query.trim()==="")&&e.jsx(L,{entityType:j.User}),t.query&&!o&&e.jsx(y,{}),o&&(i.length>0?e.jsxs("div",{className:"d-flex flex-column gap-2",children:[e.jsxs("div",{className:"d-flex flex-row justify-content-between mt-3",children:[e.jsx("h2",{className:"h6 mb-0",children:"Search results"}),e.jsxs("p",{className:"fw-semibold mb-0",children:["Showing ",i.length," of ",h.totalItems," results"]})]}),e.jsx(q,{data:i}),n&&e.jsx(C,{cursors:n,appLink:S.getCurrentRoute().appLink,buttonVariant:"outline-dark",className:"text-end pe-1 mt-2"})]}):e.jsx(N,{heading:"Oops... no results found :(",info:"It appears that user is not in our system.",imageUrl:U.CrmStudio.NOT_FOUND}))]})})}export{pe as UsersView};
//# sourceMappingURL=BRtYOYig.chunk.js.map
