import{b as k,d as T,e as L,f as q}from"./chunk-3VU4UGNC.js";import{c as b,f as G}from"./chunk-TKCG4RR3.js";import{Lf as M,Lg as D,N as E,Of as P,Pd as y,Pe as S,Qe as m,Te as F,Ue as R,eg as x,ha as d,ib as U,la as h,pe as A,r as I,ra as a,sa as j,sf as p,ta as u,ua as i,va as g}from"./chunk-5LB5MWMX.js";var te=new u("UserProfileNormalizer"),re=new u("UserProfileSerializer"),ie=new u("UserSerializer"),se=new u("UserSignUpSerializer"),oe=new u("TitleNormalizer"),C=class{},f=(()=>{class r{constructor(e){this.userProfileAdapter=e}update(e,t){return this.userProfileAdapter.update(e,t)}register(e){return this.userProfileAdapter.register(e)}registerGuest(e,t){return this.userProfileAdapter.registerGuest(e,t)}requestForgotPasswordEmail(e){return this.userProfileAdapter.requestForgotPasswordEmail(e)}resetPassword(e,t){return this.userProfileAdapter.resetPassword(e,t)}updateEmail(e,t,o){return this.userProfileAdapter.updateEmail(e,t,o)}updatePassword(e,t,o){return this.userProfileAdapter.updatePassword(e,t,o)}remove(e){return this.userProfileAdapter.close(e)}getTitles(){return this.userProfileAdapter.loadTitles()}static{this.\u0275fac=function(t){return new(t||r)(i(C))}}static{this.\u0275prov=a({token:r,factory:r.\u0275fac})}}return r})(),N=(()=>{class r{constructor(e,t,o){this.userIdService=e,this.userProfileConnector=t,this.command=o,this.updateCommand=this.command.create(s=>this.userIdService.takeUserId(!0).pipe(d(n=>this.userProfileConnector.updateEmail(n,s.password,s.newUid))),{strategy:S.Queue})}update(e,t){return this.updateCommand.execute({password:e,newUid:t})}static{this.\u0275fac=function(t){return new(t||r)(i(p),i(f),i(m))}}static{this.\u0275prov=a({token:r,factory:r.\u0275fac})}}return r})(),z=(()=>{class r{constructor(e,t,o){this.userProfileConnector=e,this.userIdService=t,this.command=o,this.updateCommand=this.command.create(s=>this.userIdService.takeUserId(!0).pipe(E(1),d(n=>this.userProfileConnector.updatePassword(n,s.oldPassword,s.newPassword)))),this.resetCommand=this.command.create(s=>this.userProfileConnector.resetPassword(s.token,s.password)),this.requestForgotPasswordEmailCommand=this.command.create(s=>this.userProfileConnector.requestForgotPasswordEmail(s.email))}update(e,t){return this.updateCommand.execute({oldPassword:e,newPassword:t})}reset(e,t){return this.resetCommand.execute({token:e,password:t})}requestForgotPasswordEmail(e){return this.requestForgotPasswordEmailCommand.execute({email:e})}static{this.\u0275fac=function(t){return new(t||r)(i(f),i(p),i(m))}}static{this.\u0275prov=a({token:r,factory:r.\u0275fac})}}return r})(),w=(()=>{class r{constructor(e,t,o,s,n,c,v){this.userAccountService=e,this.authService=t,this.userProfileConnector=o,this.eventService=s,this.userIdService=n,this.query=c,this.command=v,this.updateCommand=this.command.create(l=>this.userIdService.takeUserId(!0).pipe(d(Q=>this.userProfileConnector.update(Q,l.details).pipe(h(()=>{this.eventService.dispatch({user:l.details},G)})))),{strategy:S.Queue}),this.closeCommand=this.command.create(()=>this.userIdService.takeUserId(!0).pipe(d(l=>this.userProfileConnector.remove(l).pipe(h(()=>this.authService.logout()))))),this.titleQuery=this.query.create(()=>this.userProfileConnector.getTitles(),{reloadOn:[D]})}get(){return this.userAccountService.get()}update(e){return this.updateCommand.execute({details:e})}close(){return this.closeCommand.execute(void 0)}getTitles(){return this.titleQuery.get().pipe(I(e=>e??[]))}static{this.\u0275fac=function(t){return new(t||r)(i(b),i(P),i(f),i(F),i(p),i(R),i(m))}}static{this.\u0275prov=a({token:r,factory:r.\u0275fac})}}return r})(),O=(()=>{class r{constructor(e,t,o,s,n){this.userProfile=e,this.userConnector=t,this.authService=o,this.command=s,this.store=n,this.featureConfigService=g(A),this.routingService=g(M),this.registerCommand=this.command.create(({user:c})=>this.userConnector.register(c).pipe(h(()=>{this.store.dispatch(new x.RegisterUserSuccess)}))),this.registerGuestCommand=this.command.create(c=>this.userConnector.registerGuest(c.guid,c.password).pipe(h(v=>{this.featureConfigService.isEnabled("authorizationCodeFlowByDefault")?this.routingService.go({cxRoute:"login"}):this.authService.loginWithCredentials(v.uid,c.password)})))}register(e){return this.registerCommand.execute({user:e})}registerGuest(e,t){return this.registerGuestCommand.execute({guid:e,password:t})}getTitles(){return this.userProfile.getTitles()}static{this.\u0275fac=function(t){return new(t||r)(i(w),i(f),i(P),i(m),i(y))}}static{this.\u0275prov=a({token:r,factory:r.\u0275fac})}}return r})(),Z=[N,z,w,O,{provide:T,useExisting:N},{provide:L,useExisting:z},{provide:k,useExisting:w},{provide:q,useExisting:O}],ne=(()=>{class r{static{this.\u0275fac=function(t){return new(t||r)}}static{this.\u0275mod=U({type:r})}static{this.\u0275inj=j({providers:[f,...Z]})}}return r})();export{te as a,re as b,ie as c,se as d,oe as e,C as f,f as g,ne as h};