"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(14041),d=i(11217),u=i(26983),l=i(84522),h=i(37115),m=i(50700),v=i(68455),p=i(69855),y=i(46758),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&&(o.j41(0,"div",2)(1,"div")(2,"p",3),o.nrm(3,"bit-icon",4),o.nI1(4,"i18n"),o.k0s()()()),2&e&&(o.R7$(3),o.Y8G("ariaLabel",o.bMT(4,1,"loading")))}function S(e,t){if(1&e){const e=o.RV6();o.j41(0,"div")(1,"p",5),o.EFF(2),o.k0s(),o.j41(3,"p",6),o.EFF(4),o.nI1(5,"i18n"),o.k0s(),o.nrm(6,"hr"),o.j41(7,"div",7)(8,"a",8),o.EFF(9),o.nI1(10,"i18n"),o.k0s(),o.j41(11,"button",9),o.bIt("click",function(){d.eBV(e);const t=o.XpG();return d.Njj(t.register())}),o.EFF(12),o.nI1(13,"i18n"),o.k0s()()()}if(2&e){const e=o.XpG();o.R7$(2),o.SpI(" ",e.name," "),o.R7$(2),o.JRh(o.bMT(5,7,"acceptEmergencyAccess")),o.R7$(4),o.Y8G("queryParams",o.eq3(13,k,e.email))("block",!0),o.R7$(),o.SpI(" ",o.bMT(10,9,"logIn")," "),o.R7$(2),o.Y8G("block",!0),o.R7$(),o.SpI(" ",o.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)(o.rXU(u.Ix),o.rXU(h.y),o.rXU(m.W),o.rXU(u.nX),o.rXU(v.u),o.rXU(r.p),o.rXU(p.f))},T.ɵcmp=o.VBU({type:T,selectors:[["ng-component"]],features:[o.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&&o.DNE(0,A,5,3,"div",0)(1,S,14,15,"div",1),2&e&&(o.Y8G("ngIf",t.loading),o.R7$(),o.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.a77cba01e3c01f59739e.js.map