import{b4 as D,am as G,au as I,r as L}from"./index-ktJf6c6X.js";function B(){var N,d;const{data:r}=D({}),i=((N=r==null?void 0:r.userApplicationDTO)==null?void 0:N.userRoleList)??(r==null?void 0:r.userRoleDTOList)??[],S=i.map(e=>String((e==null?void 0:e.roleName)||"").toUpperCase().replace(/[^A-Z0-9]/g,"")).filter(Boolean),A=["ADMIN","MANAGER"],u=((d=i==null?void 0:i[0])==null?void 0:d.roleName)??null,m=S.some(e=>A.some(s=>e.includes(s))),{data:n}=G({roleName:"SalesPerson"}),{data:c}=I({}),t=c==null?void 0:c.userProfileDTO,o=(t==null?void 0:t.userReferenceId)??null,a=((n==null?void 0:n.userList)||[]).find(e=>String(e.id)===String(o)),f=[t==null?void 0:t.firstName,t==null?void 0:t.lastName].filter(Boolean).join(" ").trim()||[a==null?void 0:a.firstName,a==null?void 0:a.lastName].filter(Boolean).join(" ").trim()||(a==null?void 0:a.userName)||"",l=u!=null&&!m,g=L.useMemo(()=>{const e=((n==null?void 0:n.userList)||[]).map(s=>({id:s.id,name:[s.firstName,s.lastName].filter(Boolean).join(" ").trim()||s.userName||"",email:s.email||s.emailId||void 0}));return l?e.filter(s=>String(s.id)===String(o)):e},[n,l,o]);return{role:u,isSalesAdmin:m,myId:o,myName:f,lockSalesPerson:l,filterSalesPersonId:l&&o?o:void 0,salesPersonList:g}}export{B as u};
