"use strict";(self.webpackChunk_bitwarden_web_vault=self.webpackChunk_bitwarden_web_vault||[]).push([[825],{33825(e,t,i){i.d(t,{AcceptEmergencyComponent:()=>T});var n=i(5076),c=i(80885),s=i(25065),a=i(9413),r=i(80755),o=i(74208),d=i(33812),u=i(23649),l=i(6056),h=i(37115),m=i(50700),v=i(68455),p=i(69855),y=i(77468),g=i(56898),f=i(58384),b=i(58806),I=i(25740),w=function(e,t,i,n){return new(i||(i=Promise))(function(c,s){function a(e){try{o(n.next(e))}catch(t){s(t)}}function r(e){try{o(n.throw(e))}catch(t){s(t)}}function o(e){var t;e.done?c(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(a,r)}o((n=n.apply(e,t||[])).next())})};const k=e=>({email:e});function A(e,t){1&e&&(d.j41(0,"div",2)(1,"div")(2,"p",3),d.nrm(3,"bit-icon",4),d.nI1(4,"i18n"),d.k0s()()()),2&e&&(d.R7$(3),d.Y8G("ariaLabel",d.bMT(4,1,"loading")))}function S(e,t){if(1&e){const e=d.RV6();d.j41(0,"div")(1,"p",5),d.EFF(2),d.k0s(),d.j41(3,"p",6),d.EFF(4),d.nI1(5,"i18n"),d.k0s(),d.nrm(6,"hr"),d.j41(7,"div",7)(8,"a",8),d.EFF(9),d.nI1(10,"i18n"),d.k0s(),d.j41(11,"button",9),d.bIt("click",function(){o.eBV(e);const t=d.XpG();return o.Njj(t.register())}),d.EFF(12),d.nI1(13,"i18n"),d.k0s()()()}if(2&e){const e=d.XpG();d.R7$(2),d.SpI(" ",e.name," "),d.R7$(2),d.JRh(d.bMT(5,7,"acceptEmergencyAccess")),d.R7$(4),d.Y8G("queryParams",d.eq3(13,k,e.email))("block",!0),d.R7$(),d.SpI(" ",d.bMT(10,9,"logIn")," "),d.R7$(2),d.Y8G("block",!0),d.R7$(),d.SpI(" ",d.bMT(13,11,"createAccount")," ")}}class T extends c.X{constructor(e,t,i,n,c,s,a){super(e,t,i,n,c),this.emergencyAccessService=s,this.toastService=a,this.requiredParameters=["id","name","email","token"],this.failedShortMessage="emergencyInviteAcceptFailedShort",this.failedMessage="emergencyInviteAcceptFailed"}authedHandler(e){return w(this,void 0,void 0,function*(){this.validateIdParam(e)?(this.actionPromise=this.emergencyAccessService.accept(e.id,e.token),yield this.actionPromise,this.toastService.showToast({variant:"success",title:this.i18nService.t("inviteAccepted"),message:this.i18nService.t("emergencyInviteAcceptedDesc"),timeout:1e4}),this.router.navigate(["/vault"])):yield this.handleInvalidInvite()})}unauthedHandler(e){return w(this,void 0,void 0,function*(){this.validateIdParam(e)?(this.name=e.name,null!=this.name&&(this.name=this.name.replace(/\+/g," ")),this.emergencyAccessId=e.id,this.acceptEmergencyAccessInviteToken=e.token):yield this.handleInvalidInvite()})}register(){return w(this,void 0,void 0,function*(){yield this.router.navigate(["/finish-signup"],{queryParams:{email:this.email,acceptEmergencyAccessInviteToken:this.acceptEmergencyAccessInviteToken,emergencyAccessId:this.emergencyAccessId}})})}validateIdParam(e){return(0,n.e)(e.id)}handleInvalidInvite(){return w(this,void 0,void 0,function*(){this.toastService.showToast({message:this.i18nService.t(this.failedMessage),variant:"error",timeout:1e4}),yield this.router.navigate(["/"])})}}T.ɵfac=function(e){return new(e||T)(d.rXU(u.Ix),d.rXU(h.y),d.rXU(m.W),d.rXU(u.nX),d.rXU(v.u),d.rXU(r.p),d.rXU(p.f))},T.ɵcmp=d.VBU({type:T,selectors:[["ng-component"]],features:[d.Vt3],decls:2,vars:2,consts:[["class","tw-mt-5 tw-flex tw-justify-center",4,"ngIf"],[4,"ngIf"],[1,"tw-mt-5","tw-flex","tw-justify-center"],[1,"tw-text-center"],["name","bwi-spinner",1,"bwi-spin","bwi-2x","tw-text-muted",3,"ariaLabel"],["bitTypography","body1",1,"tw-text-center"],["bitTypography","body1"],[1,"tw-flex","tw-gap-2"],["bitButton","","buttonType","primary","routerLink","/login",3,"queryParams","block"],["type","button","bitButton","","buttonType","primary",3,"click","block"]],template:function(e,t){1&e&&d.DNE(0,A,5,3,"div",0)(1,S,14,15,"div",1),2&e&&(d.Y8G("ngIf",t.loading),d.R7$(),d.Y8G("ngIf",!t.loading&&!t.authed))},dependencies:[s.G,y.bT,l.Wk,g.Q,f.R,b.r,a.S,I.$],encapsulation:2})}}]);
//# sourceMappingURL=825.14a474ff6b99440f2efa.js.map