import{a as z}from"./chunk-6OP6ITFS.js";import{e as V,p as $,q as j}from"./chunk-SPUEGBWO.js";import{k as F}from"./chunk-3JLWQSYQ.js";import{sb as D,vb as R}from"./chunk-ROXKKVPK.js";import{A as r,C as f,D as u,Fa as C,G as b,Ga as x,Ha as y,Jc as E,Pc as O,Qb as T,Rc as B,S as n,Ta as M,Ua as P,X as h,ad as k,bd as A,fb as U,ga as I,ha as g,ia as v,ja as _,ka as a,la as l,ra as S,ta as m,va as p,xb as w}from"./chunk-ZVAMPSQU.js";import{j as c}from"./chunk-FB5LSH2R.js";function L(i,o){if(i&1){let d=S();a(0,"button",1)(1,"ion-icon",3),m("click",function(){let t=f(d).$implicit,s=p();return u(s.removeCollaborator(t))}),l(),C(2),l()}if(i&2){let d,e=o.$implicit,t=p();n(2),y(" ",((d=t.userProfilesById.get(e))==null?null:d.name)||"--"," ")}}var pe=(()=>{let o=class o{constructor(){this.toastCtrl=r(O),this.modalCtrl=r(E),this.serverActionsService=r($),this.utilService=r(F),this.loadingService=r(V),this.messagingService=r(j),this.translate=r(k),this.selectedCollaboratorIds=[],this.selectedCollaboratorIdsChanged=new b,this.userProfilesById=new Map,R({trashOutline:D})}ngAfterViewInit(){this.loadUserProfiles()}loadUserProfiles(){return c(this,null,function*(){if(!this.selectedCollaboratorIds.length)return;let e=yield this.serverActionsService.users.getUserProfilesById({ids:this.selectedCollaboratorIds});if(e)for(let t of e)this.userProfilesById.set(t.id,t)})}addCollaborator(e){return c(this,null,function*(){e&&(this.selectedCollaboratorIds.includes(e.id)||(this.userProfilesById.set(e.id,e),this.selectedCollaboratorIds.push(e.id),this.selectedCollaboratorIdsChanged.emit(this.selectedCollaboratorIds)))})}removeCollaborator(e){this.selectedCollaboratorIds.splice(this.selectedCollaboratorIds.indexOf(e),1),this.selectedCollaboratorIdsChanged.emit(this.selectedCollaboratorIds)}};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=h({type:o,selectors:[["select-collaborators"]],inputs:{selectedCollaboratorIds:"selectedCollaboratorIds"},outputs:{selectedCollaboratorIdsChanged:"selectedCollaboratorIdsChanged"},decls:8,vars:5,consts:[[1,"labels"],[1,"label"],[3,"selectedUserChange","enableSelectedMode","excludeUserIds"],["name","trash-outline","slot","start",1,"delete-label",3,"click"]],template:function(t,s){t&1&&(a(0,"div")(1,"h6"),C(2),M(3,"translate"),l(),a(4,"div",0),g(5,L,3,1,"button",1,I),l(),a(7,"select-user",2),m("selectedUserChange",function(H){return s.addCollaborator(H)}),l()()),t&2&&(n(2),x(P(3,3,"components.selectCollaborators.title")),n(3),v(s.selectedCollaboratorIds),n(2),_("enableSelectedMode",!1)("excludeUserIds",s.selectedCollaboratorIds))},dependencies:[U,T,w,z,B,A],styles:[".labels[_ngcontent-%COMP%]{padding-left:10px;display:flex;flex-wrap:wrap}.label[_ngcontent-%COMP%]{display:flex;align-items:center;background:var(--ion-color-step-100);color:var(--ion-text-color);border:none;font-size:1rem;border-radius:8px;padding:8px 10px}.label[_ngcontent-%COMP%]   ion-icon[_ngcontent-%COMP%]{margin-right:8px}"]});let i=o;return i})();export{pe as a};
