import{a as h,b as y}from"./chunk-BTRJFY27.js";import{a as f,b}from"./chunk-LWGELDFM.js";import{c as u,d as R}from"./chunk-DUQZGOF7.js";import{Qb as S,Rb as x}from"./chunk-BPZQKZKD.js";import{a as m,b as v}from"./chunk-QGVT6DPT.js";import{Sa as g,be as A,g as p,ha as d,na as U,ta as n,x as o,xa as l}from"./chunk-WL5U2YIT.js";import{e as I}from"./chunk-ADEKKGI2.js";var M,j=I(()=>{U();g();v();x();A();b();R();y();M=(()=>{let r=class r extends m{constructor(e,t,i){super(),this.roleService=e,this.userService=t,this.applicationService=i,this.grantAccessSelectionSelectionSource=new p,this.grantAccessSelectionSelection=this.grantAccessSelectionSelectionSource.asObservable()}select(e){this.roleService.getAllRoleSummaries().pipe(d(t=>(e.allRoles=t||[],this.applicationService.getAllSummaries())),d(t=>(e.allApplications=t,this.userService.getUsersList())),o(t=>e.showReadOnlyUsers??!0?t:t.filter(i=>i.userTypeValue!==S.ReadOnly)),o(t=>e.excludedUserIds&&e.excludedUserIds.length>0?t.filter(i=>!e.excludedUserIds.find(a=>a===i.id)):t)).subscribe(t=>{e.allUsers=t||[],e.permission&&(e.allSelected=e.permission.allowedUsersAndRoles),e.allSelected&&(e.users=this.getSelectedUserIds(e),e.roles=this.getSelectedRoleIds(e),e.applications=this.getSelectedApplicationIds(e)),this.grantAccessSelectionSelectionSource.next(e)})}consolidate(e){let t=e.roles.map(s=>s.id),i=e.users.map(s=>s.id),a=e.applications.map(s=>s.id);return i.concat(t).concat(a)}getSelectedUserIds(e){return e.allUsers.filter(i=>e.allSelected.indexOf(i.id)>-1).map(i=>i.id)}getSelectedRoleIds(e){return e.allRoles.filter(i=>e.allSelected.indexOf(i.id)>-1).map(i=>i.id)}getSelectedApplicationIds(e){return e.allApplications.filter(i=>e.allSelected.indexOf(i.id)>-1).map(i=>i.id)}};r.\u0275fac=function(t){return new(t||r)(l(f),l(u),l(h))},r.\u0275prov=n({token:r,factory:r.\u0275fac,providedIn:"root"});let c=r;return c})()});export{M as a,j as b};
