1import{A as f}from"./chunk-QBKSJLGR.js";import{Bb as v,Hd as C,Qc as w,Ub as k,Vb as L,Yb as I,_b as p,ac as D,na as P,yb as S}from"./chunk-CQ5D4WCL.js";import{A as h,B as c,G as a,S as b,V as u,Y as A,Z as j,a as d,b as y,j as T,ka as s,na as g,s as U,ta as m,ya as t}from"./chunk-G2MBAB6T.js";var R=(()=>{class r{constructor(e,i,o,n){this.simpleStorageService=e,this.asyncStorageService=i,this.configService=o,this.providerApiService=n}initProviderPermissions(){return this.asyncStorageService.get("loginData").pipe(b(e=>e?.id&&e.memberType===v.DOCTOR),s(({id:e})=>this.providerApiService.getProviderResourceList(e)),g(e=>{this.simpleStorageService.set("providerPermissions",e),this.providerPermissions=e}),a(()=>!0))}isPermissionApplied(e){let i=this.providerPermissions||this.simpleStorageService.get("providerPermissions");return i?i.includes(e):!1}isFeatureAllowed(e){let i;return e==="biometricLogin"?i=this.configService.isCareManagerApp():i=!1,i}static{this.\u0275fac=function(i){return new(i||r)(t(k),t(p),t(f),t(w))}}static{this.\u0275prov=m({token:r,factory:r.\u0275fac,providedIn:"root"})}}return r})();var F=(()=>{class r{constructor(e){this.asyncStorageService=e}updateImage(e){return h(this.getUser(e.memberId,e.memberType)).pipe(g(i=>i.image=e.image),s(i=>this.setUser(i)))}setUser(e){let i=this.getPrimaryKey(e.memberId,e.memberType);return this.asyncStorageService.set(i,e)}removeUser(e,i){let o=this.getPrimaryKey(e,i);return this.asyncStorageService.remove(o).pipe(j(!0))}getUser(e,i){return T(this,null,function*(){if(!e||!i)return Promise.resolve(void 0);let o=this.getPrimaryKey(e,i);return this.asyncStorageService.get(o).pipe(u(()=>c(void 0))).toPromise()})}getPrimaryKey(e,i){return`${i}:${e}`}ngOnDestroy(){this.clearAll().subscribe()}clearAll(){return this.asyncStorageService.clear()}static{this.\u0275fac=function(i){return new(i||r)(t(p))}}static{this.\u0275prov=m({token:r,factory:r.\u0275fac})}}return r})();var E=(()=>{class r{constructor(e,i,o,n,x,M,N,O){this.asyncStorageService=e,this.configService=i,this.oauth2TokenService=o,this.basicAppService=n,this.userStorageService=x,this.userApiService=M,this.fileLoaderService=N,this.translateService=O,this.appConfig=this.configService.getAppConfig(),this.loginData=new U(1)}initUserLoginData(){return this.asyncStorageService.get("loginData").pipe(g(e=>{this.loginData.next(e)}),a(()=>!0))}setUserLoginData(){return this.loginData.pipe(A(1),s(e=>this.asyncStorageService.set("loginData",e)))}getUser(e,i){let o={email:"",gender:"",birthdate:"",prefixName:"",firstName:"",middleName:"",lastName:"",suffixName:"",username:"",preferredName:"",status:1,memberId:0,memberType:v.EMPTY,id:0,name:"",image:"",timezone:"",role:S.GUEST};return h(this.userStorageService.getUser(e,i)).pipe(a(n=>n??o),u(()=>c(o)))}processUserAfterLogin(e){return!e||this.oauth2TokenService.getTwoFactorAuthToken()||this.oauth2TokenService.isTwoFactorLogin?c(void 0):this.updateUser(e).pipe(s(()=>this.saveLoginData("id",e.memberId??0)),s(()=>this.saveLoginData("memberType",e.memberType??"")),a(()=>e))}updateUser(e){return e.role=this.getUserRole(),this.randomizeUserImage(e,!0),this.userStorageService.setUser(e)}removeUser(){return this.asyncStorageService.get("loginData").pipe(s(({id:e,memberType:i})=>this.userStorageService.removeUser(e,i)),s(()=>this.removeUserLoginData()))}removeUserLoginData(){return this.asyncStorageService.remove("loginData").pipe(g(()=>this.loginData.next(null)),a(()=>!0))}getUserRole(){return this.appConfig.defaultUserRole}isDefaultUserRoleProvider(){return this.getUserRole()===S.PROVIDER}isDefaultUserRoleUser(){return this.getUserRole()===S.USER}getTwoFactorAuthToken(){return this.oauth2TokenService.getTwoFactorAuthToken()}getTwoFactorLoginAuthCode(){return this.oauth2TokenService.getTwoFactorAuthCode()}isTwoFactorLogin(){return this.oauth2TokenService.isTwoFactorLogin}initProviderPermissions(){return this.basicAppService.initProviderPermissions()}randomizeUserImage(e,i){let o=e.image?P(e.image):"";o&&(e.image=o,i||this.userStorageService.updateImage(e).subscribe())}uploadUserPhoto(e,i,o){this.fileLoaderService.loadFile(e.files).pipe(s(n=>this.userApiService.postImage(i.id??0,n,e.files[0].name))).subscribe(({href:n})=>{i.image=n,this.randomizeUserImage(i),o?.()})}saveLoginData(e,i){return this.asyncStorageService.get("loginData").pipe(s(o=>this.asyncStorageService.set("loginData",y(d({},o),{[e]:i}))))}handleCommunicationLanguage(e){if(this.isDefaultUserRoleUser()){let i=this.translateService.getLanguage();return i&&e.id&&e.communicationLanguage?.isoCode&&i!==e.communicationLanguage.isoCode?this.userApiService.patchCommunicationLanguage(e.id,i).pipe(a(()=>!0)):c(!1)}return this.translateService.applyCommunicationLanguage(e.communicationLanguage)}static{this.\u0275fac=function(i){return new(i||r)(t(p),t(f),t(D),t(R),t(F),t(I),t(C),t(L))}}static{this.\u0275prov=m({token:r,factory:r.\u0275fac})}}return r})();var de=(()=>
1{class r{constructor(e,i){this.userService=e,this.asyncStorageService=i}getModel(){return this.asyncStorageService.get("loginData").pipe(s(e=>e?.id&&e?.memberType?this.userService.getUser(e.id,e.memberType):c(void 0)))}getRole(){return this.getModel().pipe(a(e=>e?.role??S.GUEST))}static{this.\u0275fac=function(i){return new(i||r)(t(E),t(p))}}static{this.\u0275prov=m({token:r,factory:r.\u0275fac})}}return r})();export{F as a,E as b,de as c};
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.