import{a as n}from"./chunk-EQ67X7AF.js";import{b as _,c as i,d as s,e as I}from"./chunk-KHAMQZND.js";import{c as v}from"./chunk-OBT56KUD.js";import{B as c,K as p,L as f,P as A,ea as S,o as d,p as u,pa as l,ua as a,v as m,va as g}from"./chunk-IYD54RT7.js";var O=(()=>{let e=class e{constructor(o,t,r){this.http=o,this.userHeaderService=t,this.authProvider=r,this._devUser=u({id:"61106791",name:"Joe Smith",guid:null,active:!1,description:null,workTypes:[],tags:[],userId:"61106791",email:"",loginIds:[],savedSearches:[],userGroups:[],artifactId:"",idString:"",idIntValue:0,uuid:0,roles:[{id:n.CI_ADMIN,name:"CI Admin"},{id:n.MIM_ADMIN,name:"MIM Admin"},{id:n.OSEE_ADMIN,name:"Osee Admin"}]}),this._fetchFromApi=c(()=>this.userHeaderService.useCustomHeaders,this.http.get(s,{headers:this.userHeaderService.headers}),this.http.get(s)),this._demoAuth=i.authScheme==="DEMO"?this.http.get(s,{headers:this.userHeaderService.headers}):this.http.get(s),this._noneAuth=i.authScheme==="NONE"?this.http.get(s):u(),this._devAuth=i.authScheme==="DEV"?this._devUser:this._noneAuth,this._forcedSSOAuth=i.authScheme==="FORCED_SSO"?this._fetchFromApi:this._noneAuth,this._user=this.getAuthConfig().pipe(S({bufferSize:1,refCount:!0}))}getAuthConfig(){switch(i.authScheme){case"OKTA":return this.authProvider.getAuth();case"FORCED_SSO":return this._forcedSSOAuth;case"DEV":return this._devAuth;case"DEMO":return this._demoAuth;case"NONE":return this._noneAuth;default:throw new Error("Auth Configuration not defined somehow?")}}userHasRoles(o){return m([this.user,d(o)]).pipe(f(([t,r])=>u(t.roles.map(E=>E.id).includes(r))),A(o.length),p((t,r)=>r=r&&t,!0))}get user(){return this._user}};e.\u0275fac=function(t){return new(t||e)(a(v),a(_),a(I))},e.\u0275prov=l({token:e,factory:e.\u0275fac,providedIn:"root"});let h=e;return h})();var U=(h,e)=>g(O).userHasRoles(h.data.requiredRoles);export{O as a,U as b};
