import{k as f,l as I}from"./chunk-YKFXM3J7.js";import{D as p,E as j}from"./chunk-I7GW4F3B.js";import{a as d,b as O}from"./chunk-AJ7ODGYR.js";import{m as v,n as q}from"./chunk-SM7EQ7ST.js";import{gc as m,hc as b,wk as a,xk as U}from"./chunk-BPZQKZKD.js";import{D as u,I as T}from"./chunk-HTXYTVN4.js";import{be as D,ta as h,xa as n}from"./chunk-WL5U2YIT.js";import{e as R}from"./chunk-ADEKKGI2.js";var E,z,B,g=R(()=>{O();b();U();D();T();j();I();q();E=(()=>{let r=class r{constructor(e,t,i){this.router=e,this.currentUserService=t,this.repositoryService=i}canActivate(e,t){let i=e.data.permissions,o=e.data.securables,l=e.data.appliesOnlyToPamVaults,A=e.data.isRepositoryDependant,S=e.data.excludePrivateVault,P=e.data.isPamProviderDependant,c=!1;return A&&(l?c=i.some(y=>this.repositoryService.hasRepositoriesWithPermissionSnapshot(y,!1,!0)):c=this.hasAtLeastOneOfTheRequiredRepositoryPermission(i,!S)),P&&(c=this.hasAtLeastOneOfTheRequiredPamProviderPermission(i)),c||(c=o?.length>0?this.hasAtLeastOneOfTheRequiredSecurable(o):this.hasAtLeastOneOfTheRequiredPermission(i)),c||this.router.navigate([d.location+"dashboard"]),c}hasAtLeastOneOfTheRequiredPermission(e){return e?.some(t=>this.currentUserService.hasPermission(t))}hasAtLeastOneOfTheRequiredPamProviderPermission(e){return e?.some(t=>this.currentUserService.hasPermissionGlobalOrAnyScoped(t,m.PamProvider))}hasAtLeastOneOfTheRequiredRepositoryPermission(e,t){return e?.some(i=>this.currentUserService.hasPermissionGlobalOrAnyScoped(i,m.Repository,t))}hasAtLeastOneOfTheRequiredSecurable(e){return e?.some(t=>this.currentUserService.hasAnyPermissionOnSecurable(t))}};r.\u0275fac=function(t){return new(t||r)(n(u),n(p),n(f))},r.\u0275prov=h({token:r,factory:r.\u0275fac,providedIn:"root"});let s=r;return s})(),z=(()=>{let r=class r{constructor(e,t){this.router=e,this.serverInformationService=t}canActivate(e,t){let i=e.data.featureFlag,o=this.serverInformationService.isFeatureFlagEnabled(i);return o||this.router.navigate([d.location+"dashboard"]),o}};r.\u0275fac=function(t){return new(t||r)(n(u),n(v))},r.\u0275prov=h({token:r,factory:r.\u0275fac,providedIn:"root"});let s=r;return s})(),B=(()=>{let r=class r{constructor(e,t){this.router=e,this.currentUserService=t}canActivate(e,t){switch(e.data.page){case a.Dashboard:return!0;case a.Vault:return!0;case a.PrivateVault:return this.redirectToAccessDeniedWhenDenied(this.currentUserService.sectionAccessSnapshot.hasAccessPrivateVault);case a.Reports:return this.redirectToAccessDeniedWhenDenied(this.currentUserService.sectionAccessSnapshot.hasAccessReports);case a.Administration:return this.redirectToAccessDeniedWhenDenied(this.currentUserService.sectionAccessSnapshot.hasAccessAdmin);case a.Pam:return this.redirectToAccessDeniedWhenDenied(this.currentUserService.sectionAccessSnapshot.hasAccessPam);case a.SystemDashboard:return this.redirectToAccessDeniedWhenDenied(this.currentUserService.sectionAccessSnapshot.hasAccessSystemDashboard)}}redirectToAccessDeniedWhenDenied(e){return e?!0:this.router.createUrlTree(["/access-denied"])}};r.\u0275fac=function(t){return new(t||r)(n(u),n(p))},r.\u0275prov=h({token:r,factory:r.\u0275fac,providedIn:"root"});let s=r;return s})()});export{E as a,z as b,B as c,g as d};
