1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[262],{52074:function(e,t,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/dashboard/groups",function(){return s(452)}])},452:function(e,t,s){"use strict";s.r(t),s.d(t,{__N_SSP:function(){return U},default:function(){return B}});var a=s(52322),l=s(92642),n=s(2784),r=s(28535),i=s(77533),o=s(69251),c=s(30523),d=s(35183),u=s(97166),h=s(74008),m=s(62929),p=s(74409),x=s(38035),j=s(43297),v=s(29117),b=s(82554),y=s(14738),f=s(92139),g=s(55199),w=s(2338),C=s(97217),S=s(20437),R=s(85573),E=s(49259),k=s(87436),q=s(95897),A=s(89511),M=s(11121),T=s(50250),I=s(77245),N=s(98078),O=s(5115),z=s(5677),F=s(92253),L=s(28317);let P=e=>{let{data:t,innerRef:s,innerProps:l}=e;return(0,a.jsxs)(r.xu,{ref:s,...l,padding:"4px",width:"100%",children:[(0,a.jsx)(i.x,{fontWeight:"bold",children:t.label}),(0,a.jsx)(i.x,{fontSize:"sm",whiteSpace:"normal",overflow:"hidden",textOverflow:"ellipsis",children:t.description})]})},D=e=>{let{onChange:t}=e,[s,l]=(0,n.useState)("Employee");return(0,n.useEffect)(()=>{t(s)},[s]),(0,a.jsx)(o.r,{autoFlow:"row",rowGap:2,children:(0,a.jsx)(c.P,{children:(0,a.jsx)(o.r,{templateColumns:"1fr 40px",gap:2,children:(0,a.jsx)(o.r,{autoFlow:"row",alignItems:"end",gap:2,children:(0,a.jsx)(c.P,{children:(0,a.jsxs)(d.NI,{isRequired:!0,children:[(0,a.jsx)(u.l,{children:"Role"}),(0,a.jsx)(F.Z,{onChange:e=>{l(e.value)},chakraStyles:{container:e=>({...e,width:"100%",background:"white"})},options:[{value:"Employee",label:"Employee",description:"Employees have limited access to your data, only selected cohorts will be avaliable."},{value:"Manager",label:"Manager",description:"Manager has access to all company data, as well as create action plans for Employees."},{value:"Leader",label:"Company Leader",description:"Leader has access to everything, and can change all companies data."}],formatOptionLabel:(e,t)=>
1{let{context:s}=t;return"menu"===s?(0,a.jsx)(P,{data:e}):e.label}})]})})})})},"invite-row")})},_=e=>{let{onChange:t,isInviting:s=!1}=e,[l,p]=(0,n.useState)([{name:"",email:"",memberRole:"Employee"}]);return(0,n.useEffect)(()=>{t(l)},[l]),(0,a.jsxs)(o.r,{autoFlow:"row",rowGap:2,children:[l.map((e,t)=>(0,a.jsxs)(c.P,{children:[t>0&&(0,a.jsx)(h.i,{my:4}),(0,a.jsxs)(o.r,{templateColumns:"1fr 40px",gap:2,children:[(0,a.jsxs)(o.r,{autoFlow:"row",alignItems:"end",gap:2,children:[(0,a.jsx)(c.P,{children:(0,a.jsxs)(d.NI,{isRequired:!0,children:[(0,a.jsx)(u.l,{children:"Name"}),(0,a.jsx)(O.t7,{value:e.name,onInput:e=>{p(s=>s.map((s,a)=>t===a?{...s,name:e.target.value}:s))}})]})}),(0,a.jsx)(c.P,{children:(0,a.jsxs)(d.NI,{isRequired:!0,children:[(0,a.jsx)(u.l,{children:"Email"}),(0,a.jsx)(O.t7,{type:"email",value:e.email,onInput:e=>{p(s=>s.map((s,a)=>t===a?{...s,email:e.target.value}:s))}})]})}),!s&&(0,a.jsx)(c.P,{children:(0,a.jsxs)(d.NI,{isRequired:!0,children:[(0,a.jsx)(u.l,{children:"Role"}),(0,a.jsx)(F.Z,{onChange:e=>{p(s=>s.map((s,a)=>t===a?{...s,memberRole:e.value}:s))},chakraStyles:{container:e=>({...e,width:"100%",background:"white"})},options:[{value:"Employee",label:"Employee",description:"Employees have limited access to your data, only selected cohorts will be avaliable."},{value:"Manager",label:"Manager",description:"Manager has access to all company data, as well as create action plans for Employees."},{value:"Leader",label:"Company Leader",description:"Leader has access to everything, and can change all companies data."}],formatOptionLabel:(e,t)=>
1{let{context:s}=t;return"menu"===s?(0,a.jsx)(P,{data:e}):e.label}})]})})]}),!s&&(0,a.jsx)(c.P,{children:(0,a.jsx)(O.u,{label:"Remove Member",children:(0,a.jsx)(r.xu,{as:"span",children:(0,a.jsx)(O.hU,{mt:8,icon:(0,a.jsx)(m.J,{as:I.czh,fontSize:"xl"}),"aria-label":"Remove member",isDisabled:1===l.length,isRound:!0,onClick:()=>{p(e=>e.filter((e,s)=>t!==s))}})})})})]})]},"invite-row-".concat(t))),!s&&(0,a.jsx)(c.P,{children:(0,a.jsxs)(O.kq,{width:"100%",onClick:()=>p(e=>[...e,{name:"",email:"",memberRole:"Employee"}]),children:[(0,a.jsx)(i.x,{children:"Add Another Member"}),(0,a.jsx)(m.J,{as:I.poH,fontSize:"xl"})]})})]})},J={Employee:{label:"Employee",description:"Employees have limited access to your data, only selected cohorts will be avaliable."},Manager:{label:"Manager",description:"Manager has access to all company data, as well as create action plans for Employees."},Leader:{label:"Company Leader",description:"Leader has access to everything, and can change all companies data."}};var U=!0;function B(e){var t,s,d,u,h,y,f;let{requests:g,teams:w,allLowiSurveysData:C,cohorts:S,cohortsMerged:R,canManageTeams:E}=e,[k,q]=(0,n.useState)(g),{setModal:A}
1=(0,N.dd)(),[M,T]=(0,n.useState)(void 0),{setNotification:F}=(0,N.lm)(),P=(0,n.useRef)(""),U=(0,n.useRef)([]),[B,Y]=(0,n.useState)(new Set),[Z,H]=(0,n.useState)(()=>{let e=w[0].members.concat(w[1].members),t=Array.from(new Map(e.map(e=>[e.user,e])).values());return t}),$={children:"Invite Members",leftIcon:(0,a.jsx)(m.J,{as:I.poH,fontSize:"1.2rem"}),onClick:()=>{A({title:"Invite Group Members",description:"Send email invitations to group members.",secondaryActionCancel:!0,primaryAction:{text:"Invite"},size:"xl",fields:[()=>(0,a.jsx)(_,{onChange:e=>U.current=e})],async onSubmit(){try{var e,t;let s=await fetch("/api/teams/invite",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({teamMembers:U.current})}),a=await s.json();if(!a.success)throw Error(a.message);(0,L.fS)("invite_email_sent",{recipientCount:null!==(t=null===(e=U.current)||void 0===e?void 0:e.length)&&void 0!==t?t:0}),F({type:"success",title:"Invitations Sent",description:a.message})}catch(e){console.error("Fetch error",e),F({type:"error",title:"Error",description:e.message})}}})}};m.J,I.poH,()=>{A({title:"Request for Member Invite",description:"Request an invitation to the company leader.",secondaryActionCancel:!0,primaryAction:{text:"Invite"},size:"xl",fields:[()=>(0,a.jsx)(_,{isInviting:!0,onChange:e=>U.current=e})],async onSubmit(){try{let e=await fetch("/api/teams/request/invite",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({teamMembers:U.current[0]})}),t=await e.json();if(!t.success)throw Error(t.message);F({type:"success",title:"Invitations Sent",description:t.message})}catch(e){console.error("Fetch error",e),F({type:"error",title:"Error",description:e.message})}}})};let G={children:"Request Role Change",leftIcon:(0,a.jsx)(m.J,{as:I.poH,fontSize:"1.2rem"}),onClick:()=>{A({title:"Request Role Change",description:"Request a role change to the company leader.",secondaryActionCancel:!0,primaryAction:{text:"Request Change"},size:"xl",fields:[()=>(0,a.jsx)(D,{onChange:e=>P.current=e})],async onSubmit(){try{let e=await fetch("/api/teams/request/role",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({role:P.current})}),t=await e.json();if(!t.success)throw Error(t.message);F({type:"success",title:"Role Change Requested",description:"Your role change request has been sent."})}catch(e){console.error("Fetch error",e),F({type:"error",title:"There was an error",description:e.message})}}})}},X={children:"Recreate Teams",leftIcon:(0,a.jsx)(m.J,{as:I.p$$,fontSize:"1.2rem"}),onClick:()=>{A({title:"Recreate Teams",description:"This will search through all tenant users and recreate the team structure. This action cannot be undone.",secondaryActionCancel:!0,primaryAction:{text:"Recreate"},fields:[],async onSubmit(){try{let e=await fetch("/api/teams/recreate",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"}}),t=await e.json();if(!t.success)throw Error(t.message);F({type:"success",title:"Teams Recreated",description:"Team structure has been recreated successfully."}),window.location.reload()}catch(e){console.error("Fetch error",e),F({type:"error",title:"There was an error",description:e.message})}}})}},V=E?[$]:[G],{user:W}=(0,N.b5)();return W.isInternalAccount&&V.push(X),(0,a.jsx)(K,{closeFn:()=>{T(void 0)},editingInvitedUser:M,saveFn:(e,t)=>{Y(e=>new Set(e).add(t));let s={};e.cohorts&&Object.entries(e.cohorts).forEach(e=>{let[t,a]=e;if(t&&a)for(let e of C){let l=S[e.id]||[],n=l.find(e=>e.key===t&&e.value===a);if(n){s[e.id]=[{key:t,value:a}];break}}}),(null==M?void 0:M.user)&&fetch("/api/update-team-member",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({userId:M.user,userChanges:{...e,assignedCohorts:s}})}).then(e=>e.json()).then(t=>{if(!t.success)throw Error("Failed to save changes");F({type:"success",title:"User Updated",description:"User has been updated successfully"}),H(t=>t.map(t=>{if(t.user===(null==M?void 0:M.user)){let a={...t};if(e.firstName||e.lastName){let s=e.firstName||t.name.split(" ")[0],l=e.lastName||t.name.split(" ").slice(1).join(" ");a.name="".concat(s," ").concat(l).trim()}
1return Object.entries(e).forEach(e=>{let[t,s]=e;"firstName"!==t&&"lastName"!==t&&"cohorts"!==t&&"filterYears"!==t&&(a[t]=s)}),e.cohorts&&(a.assignedCohorts=s),a}return t}))}).catch(e=>{console.error(e),(0,l.Tb)(e),F(N.FB)}).finally(()=>{Y(e=>{let s=new Set(e);return s.delete(t),s})})},allLowiSurveysData:C,cohorts:S,cohortsMerged:R,children:(0,a.jsxs)(z.$0,{icon:I.p$$,crumbs:[{children:"Dashboard",path:"/dashboard"},{children:"Team Members",isCurrentPage:!0}],actionsArr:V,children:[k.length>0&&(0,a.jsxs)(z.Zb,{mb:4,overflow:{sm:"auto",lg:"visible"},children:[(0,a.jsx)(p.X,{size:"md",mb:4,children:"Requests"}),k.map(e=>{var t,s;return(0,a.jsxs)(x.k,{mb:4,justifyContent:"space-between",alignItems:"center",p:4,borderBottomWidth:1,children:[(0,a.jsxs)(j.K,{spacing:2,children:[(0,a.jsx)(i.x,{children:"role"===e.type?"Role Upgrade to ".concat(e.request):"".concat(null===(t=e.request)||void 0===t?void 0:t.name," (").concat(null===(s=e.request)||void 0===s?void 0:s.email,")")}),(0,a.jsxs)(i.x,{fontSize:"sm",color:"gray.600",children:["Requested By ",e.requester.name," ",(0,a.jsx)(O.u,{label:e.requester.email,children:(0,a.jsx)(r.xu,{as:"span",position:"relative",children:(0,a.jsx)(m.J,{as:I.Fs0})})})]})]}),(0,a.jsxs)(v.U,{children:[(0,a.jsx)(O.KM,{onClick:()=>{A({title:"Approve Request",description:"Approve the request to join the team.",secondaryActionCancel:!0,primaryAction:{text:"Approve"},fields:[],async onSubmit(){try{let t=await fetch("/api/teams/request/complete",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({requestId:e.id,status:"approve"})}),s=await t.json();if(!s)throw Error("Bad response");return q(t=>t.filter(t=>t.id!==e.id)),"role"===e.type&&H(t=>{let s=t.slice().map(t=>t.user!==e.requester.id?t:{...t,memberRole:e.request});return s}),{type:"success",title:"Request Approved",description:"Request has been approved."}}catch(e){return(0,l.Tb)(e),N.FB}}})},children:"Approve"}),(0,a.jsx)(O.kq,{onClick:()=>{A({title:"Deny Request",description:"Deny the request to join the team.",secondaryActionCancel:!0,primaryAction:{text:"Deny"},fields:[],async onSubmit(){try{let t=await fetch("/api/teams/request/complete",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({requestId:e.id,status:"deny"})}),s=await t.json();if(!s)throw Error("Bad response");return q(t=>t.filter(t=>t.id!==e.id)),{type:"success",title:"Request Denied",description:"Request has been denied."}}
1catch(e){return(0,l.Tb)(e),N.FB}}})},children:"Deny"})]})]},e.id)})]}),(0,a.jsxs)(z.Zb,{overflow:{sm:"auto",lg:"visible"},children:[Z.length>0&&(0,a.jsx)(z.iA,{name:"team-table",headers:["Name","Role","Actions"],overflows:"visible",rows:Z.map(e=>{var n,p;return{name:(0,a.jsxs)(x.k,{gap:2,justifyContent:"flex-start",children:[(0,a.jsx)(i.x,{children:e.name}),(0,a.jsx)(O.u,{label:e.user?"Registered":"Invited",children:(0,a.jsx)(b.C,{rounded:"full",variant:"subtle",colorScheme:e.user?"green":"yellow",w:"16px",h:"16px",children:e.user?(0,a.jsx)(m.J,{ml:"-2px",as:I.hXj}):(0,a.jsx)(m.J,{ml:"-2px",as:I.rng})})}),(0,a.jsx)(O.u,{label:e.email,children:(0,a.jsx)(r.xu,{as:"span",position:"relative",children:(0,a.jsx)(m.J,{as:I.Fs0})})})]}),role:(0,a.jsx)(x.k,{justifyContent:"flex-start",position:"relative",children:(null!==(s=null==e?void 0:e.memberRole)&&void 0!==s?s:(null!==(t=null==e?void 0:e.role)&&void 0!==t?t:"")in J)?(0,a.jsxs)(v.U,{position:"relative",children:[(0,a.jsx)(i.x,{children:null==J?void 0:null===(n=J[null!==(u=null!==(d=null==e?void 0:e.memberRole)&&void 0!==d?d:null==e?void 0:e.role)&&void 0!==u?u:""])||void 0===n?void 0:n.label}),(0,a.jsx)(O.u,{label:null!==(f=null==J?void 0:null===(p=J[null!==(y=null!==(h=null==e?void 0:e.memberRole)&&void 0!==h?h:null==e?void 0:e.role)&&void 0!==y?y:""])||void 0===p?void 0:p.description)&&void 0!==f?f:"-",children:(0,a.jsx)(r.xu,{as:"span",position:"relative",children:(0,a.jsx)(m.J,{as:I.Fs0})})})]}):(0,a.jsx)(i.x,{children:"-"})}),actions:E?(0,a.jsxs)(o.r,{autoFlow:"column",justifyContent:"start",gap:3,children:[(0,a.jsx)(c.P,{children:(0,a.jsx)(O.u,{label:e.default||!e.inviteCode?"This member cannot be edited":B.has(e.user)?"Saving changes...":"Edit User",children:(0,a.jsx)(r.xu,{children:(0,a.jsx)(O.hU,{size:"sm",icon:(0,a.jsx)(I.Hlf,{fontSize:"1.1rem"}),"aria-label":"Edit Team Member",onClick:()=>{T(e)},isDisabled:e.default||!e.inviteCode||B.has(e.user),isRound:!0})})})}),(0,a.jsx)(c.P,{children:(0,a.jsx)(O.u,{label:e.default?"Default team member cannot be deleted":"Delete",children:(0,a.jsx)(r.xu,{children:(0,a.jsx)(O.hU,{size:"sm",icon:(0,a.jsx)(I.SW4,{fontSize:"1.1rem"}),"aria-label":"Delete Member",onClick:()=>{A({title:"Delete Team Member",description:"Are you sure you want to delete ".concat(e.name,"?"),secondaryActionCancel:!0,primaryAction:{text:"Delete"},fields:[],async onSubmit(){try{let t=await fetch("/api/teams/members/delete",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({userId:e.user})}),s=await t.json();if(!s)throw Error("Bad response");return{type:"success",title:"Team Member Deleted",description:"".concat(e.name," has been removed.")}}catch(e){return(0,l.Tb)(e),N.FB}}})},isDisabled:e.default,isRound:!0})})})})]}):(0,a.jsxs)(o.r,{autoFlow:"column",justifyContent:"start",gap:3,children:[(0,a.jsx)(c.P,{children:(0,a.jsx)(O.u,{label:"You do not have access to edit users",children:(0,a.jsx)(r.xu,{children:(0,a.jsx)(O.hU,{size:"sm",icon:(0,a.jsx)(I.Hlf,{fontSize:"1.1rem"}),"aria-label":"Edit Team Member",isDisabled:!0,isRound:!0})})})}),(0,a.jsx)(c.P,{children:(0,a.jsx)(O.u,{label:"You do not have access to remove users",children:(0,a.jsx)(r.xu,{children:(0,a.jsx)(O.hU,{size:"sm",icon:(0,a.jsx)(I.SW4,{fontSize:"1.1rem"}),"aria-label":"Delete Member",isDisabled:!0,isRound:!0})})})})]})}})}),0===Z.length&&(0,a.jsx)(z.Sn,{icon:I.p$$,description:"All members belonging to this group will appear here.",action:$,children:"No Group Members"})]})]})})}function K(e){var t,s,l,c,d,u,m,x,v;let{children:b,editingInvitedUser:L,saveFn:D,closeFn:_,allLowiSurveysData:J,cohorts:U,cohortsMerged:B}=e,[K,Y]=(0,n.useState)(!1),[Z,H]=(0,n.useState)(null),[$,G]=(0,n.useState)({"":""}),[X,V]=(0,n.useState)({}),[W,Q]=(0,n.useState)([]),{setNotification:ee}=(0,N.lm)();return(0,n.useEffect)(()=>{L||(H(null),G({"":""}),V({}),Q([]))},[L]),(0,n.useEffect)(()=>{if(L){let e=L.name.split(" ")[0],t=L.name.split(" ").slice(1).join(" ")||"";H({...L,firstName:e,lastName:t});let s=L.assignedCohorts?Object.entries(L.assignedCohorts).reduce((e,t)=>
1{let[s,a]=t;if(Array.isArray(a)&&a.length>0){let t=U[s]||[],l=t.find(e=>e.value===a[0].value);l&&(e[l.key]=l.value)}return e},{}):{"":""};0===Object.keys(s).length&&(s[""]=""),G(s)}},[L,U]),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(y.u_,{isOpen:!!L,onClose:()=>{_()},scrollBehavior:"outside",size:"md",children:[(0,a.jsx)(f.Z,{}),(0,a.jsxs)(g.h,{children:[(0,a.jsx)(w.o,{_hover:{bgColor:"gray.50"},_focus:{bgColor:"gray.100"},rounded:"full",zIndex:1}),(0,a.jsxs)(C.f,{w:"100%",children:[(0,a.jsx)(r.xu,{py:4,children:(0,a.jsx)(p.X,{size:"md",children:"Edit Team Member"})}),(0,a.jsx)(S.M,{columns:1,rowGap:"3",w:"100%",children:(0,a.jsxs)(j.K,{gap:4,children:[(0,a.jsxs)(r.xu,{children:[(0,a.jsx)(i.x,{children:"Basic Information"}),(0,a.jsx)(h.i,{my:1,mb:4}),(0,a.jsxs)(j.K,{gap:4,children:[(0,a.jsxs)(r.xu,{children:[(0,a.jsx)(i.x,{children:"Email:"}),(0,a.jsx)(R.I,{defaultValue:null!==(t=null==Z?void 0:Z.email)&&void 0!==t?t:"",size:"sm",required:!0,readOnly:!0,isDisabled:!0})]}),(0,a.jsxs)(r.xu,{children:[(0,a.jsx)(i.x,{children:"First Name:"}),(0,a.jsx)(R.I,{defaultValue:null!==(s=null==Z?void 0:Z.firstName)&&void 0!==s?s:"",onChange:e=>V({...X,firstName:e.target.value}),size:"sm",required:!0,placeholder:"First Name"})]}),(0,a.jsxs)(r.xu,{children:[(0,a.jsx)(i.x,{children:"Last Name:"}),(0,a.jsx)(R.I,{defaultValue:null!==(l=null==Z?void 0:Z.lastName)&&void 0!==l?l:"",onChange:e=>V({...X,lastName:e.target.value}),placeholder:"Last Name",size:"sm",required:!0})]}),(0,a.jsxs)(r.xu,{children:[(0,a.jsx)(i.x,{children:"Role:"}),(null!==(c=null==Z?void 0:Z.memberRole)&&void 0!==c?c:null==Z?void 0:Z.role)&&(0,a.jsx)(F.Z,{chakraStyles:{container:e=>({...e,width:"100%",background:"white"})},defaultValue:{value:null!==(d=null==Z?void 0:Z.memberRole)&&void 0!==d?d:null==Z?void 0:Z.role,label:null!==(u=null==Z?void 0:Z.memberRole)&&void 0!==u?u:null==Z?void 0:Z.role,description:""},onChange:e=>V({...X,memberRole:e.value}),options:[{value:"Employee",label:"Employee",description:"Employees have limited access to your data, only selected cohorts will be avaliable."},{value:"Manager",label:"Manager",description:"Manager has access to all company data, as well as create action plans for Employees."},{value:"Leader",label:"Company Leader",description:"Leader has access to everything, and can change all companies data."}],formatOptionLabel:(e,t)=>
1{let{context:s}=t;return"menu"===s?(0,a.jsx)(P,{data:e}):e.label}}),!(null!==(m=null==Z?void 0:Z.memberRole)&&void 0!==m?m:null==Z?void 0:Z.role)&&(0,a.jsx)(F.Z,{chakraStyles:{container:e=>({...e,width:"100%",background:"white"})},onChange:e=>V({...X,memberRole:e.value}),options:[{value:"Employee",label:"Employee",description:"Employees have limited access to your data, only selected cohorts will be avaliable."},{value:"Manager",label:"Manager",description:"Manager has access to all company data, as well as create action plans for Employees."},{value:"Leader",label:"Company Leader",description:"Leader has access to everything, and can change all companies data."}],formatOptionLabel:(e,t)=>{let{context:s}=t;return"menu"===s?(0,a.jsx)(P,{data:e}):e.label}})]})]})]}),(0,a.jsxs)(r.xu,{children:[(0,a.jsx)(i.x,{children:"Cohort Assignment"}),(0,a.jsx)(h.i,{my:1,mb:4}),(0,a.jsxs)(j.K,{gap:4,children:[Object.entries($).map(e=>{var t;let[s,l]=e;return(0,a.jsxs)(o.r,{templateColumns:"1fr 1fr",gap:4,position:"relative",children:[(0,a.jsx)(O.hU,{position:"absolute",rounded:"9999px",top:"-10px",right:0,icon:(0,a.jsx)(I.czh,{}),"aria-label":"Remove Cohort",onClick:()=>{let e=Object.assign({},$);delete e[s],G(e)}}),(0,a.jsxs)(j.K,{alignItems:"center",rounded:"md",children:[(0,a.jsx)(i.x,{children:"Cohort Group"}),(0,a.jsx)(F.Z,{chakraStyles:{container:e=>({...e,width:"100%",background:"white"})},value:{value:""!==s?s:void 0,label:""!==s?s:void 0},options:B.keys.filter(e=>!Object.keys($).includes(e)).map(e=>({value:e,label:e})),onChange:e=>{let t=Object.assign({},$);delete t[s],t[e.value]=l,G(t)},placeholder:"Select a group"})]}),(0,a.jsxs)(j.K,{alignItems:"center",rounded:"md",children:[(0,a.jsx)(i.x,{children:"Cohort"}),(0,a.jsx)(F.Z,{chakraStyles:{container:e=>({...e,width:"100%",background:"white"})},value:{value:""!==l?l:void 0,label:""!==l?l:void 0},options:(null!==(x=null===(t=B.values)||void 0===t?void 0:t[s])&&void 0!==x?x:[]).map(e=>({value:e,label:e})),onChange:e=>{let t=Object.assign({},$);t[s]=e.value,G(t)},placeholder:"Select a cohort"})]})]})}),(0,a.jsx)(O.kq,{isDisabled:Object.keys($).includes(""),onClick:()=>{G({...$,"":""})},children:"Add Cohort"})]})]}),(0,a.jsx)(r.xu,{style:{visibility:"hidden",display:"none"},children:(0,a.jsx)(E.U,{allowMultiple:!0,children:(0,a.jsxs)(k.Q,{children:[(0,a.jsx)("h2",{children:(0,a.jsxs)(q.K,{children:[(0,a.jsx)(r.xu,{as:"span",flex:"1",textAlign:"left",children:(0,a.jsx)(i.x,{children:"Yearly Cohort Assignment"})}),(0,a.jsx)(A.X,{})]})}),(0,a.jsx)(M.H,{pb:4,children:(0,a.jsx)(j.K,{gap:4,children:J.map(e=>(0,a.jsx)(z.Ry,{setYearChanged:e=>{Q([...W,e])},surveyYear:new Date(null!==(v=e.created)&&void 0!==v?v:Date.now()).getFullYear(),surveyId:e.id,cohorts:U[e.id],assignedCohorts:[],teamMember:L},e.id))})})]})})})]})})]}),(0,a.jsxs)(T.m,{pb:6,children:[(0,a.jsx)(O.kq,{mr:3,onClick:()=>_(),children:"Cancel"}),(0,a.jsx)(O.KM,{id:"modal-primary-action",type:"button",onClick:async()=>{var e;Y(!0);let t=X;t.cohorts=$,t.filterYears=W;let s=await D(t,null!==(e=null==L?void 0:L.user)&&void 0!==e?e:"");_(),s&&ee(s),Y(!1)},isLoading:K,children:"Save Changes"})]})]})]}),b]})}B.title="Teams",B.getLayout=e=>(0,a.jsx)(z.cl,{children:e})}},function(e){e.O(0,[4424,8917,5789,6525,2123,8898,2445,1541,8278,4540,2812,5417,9410,6659,8257,9316,7029,6182,9774,2888,179],function(){return e(e.s=52074)}),_N_E=e.O()}]);
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.