import{Hi as Zt,Ja as g,Nr as S$,Ns as rh,Pa as eo,Rr as Si,Zs as th,_o as iu,ai as Vj,br as Qc,gt as Ex,ht as Et,ia as ax,jt as Gj,k as Bb,n as $B,s as $a,yc as wp}from"./chunk-b0nJCs5_.js";import"./chunk-CDRFWLLW.js";import{A as qn,F as ye,I as yn,_ as Zn,p as Vn,s as Jn,t as $n,u as Qn}from"./chunk-Cmet2Nw-.js";import{t as S}from"./chunk-CKCWxqhm.js";import{r as E}from"./chunk-BeduZISV2.js";import{t as oe}from"./chunk-B4yFU5n32.js";import{t as r}from"./chunk-BWkkRYL92.js";var X={VALIDATORS:[ye.required],MESSAGES:{required:"La confirmació de la contrasenya és obligatòria."}};var se=[{path:``,component:class l extends r{formReactiveService=g(S);userService=g(Qc);serverService=g(Zt);notifier=g(Si);router=g(Et);route=g(eo);userId;verificationString;ngOnInit(){let{minLength:e,maxLength:r}=this.serverService.getHTMLConfig().fieldsConstraints.users.password;this.buildForm({password:E(e,r),"password-confirm":X}),this.userId=this.route.snapshot.queryParams.userId,this.verificationString=this.route.snapshot.queryParams.verificationString,(!this.userId||!this.verificationString)&&(this.notifier.error("No es pot trobar l'identificador d'usuari ni la cadena de verificació."),this.router.navigate([`/`]))}resetPassword(){this.userService.resetPassword(this.userId,this.verificationString,this.form.value.password).subscribe({next:()=>{this.notifier.success("La contrasenya s'ha restablit correctament!"),this.router.navigate([`/login`])},error:e=>this.notifier.handleError(e)})}isConfirmedPasswordValid(){let e=this.form.value;return e.password===e[`password-confirm`]}static ɵfac=(()=>{let e;return function(o){return(e||(e=iu(l)))(o||l)}})();static ɵcmp=$a({type:l,selectors:[[`ng-component`]],features:[ax],decls:13,vars:4,consts:()=>{let e;e="Contrasenya";let r;r="Contrasenya confirmada";let o;o="Restablir la meva contrasenya";let p;p="Restablir la meva contrasenya";let f;f="Contrasenya";let u;return u="Confirmeu la contrasenya",[p,f,u,[1,`margin-content`],[1,`title-page`],[3,`ngSubmit`,`formGroup`],[1,`form-group`],[`for`,`password`],[`formControlName`,`password`,`inputId`,`password`,`placeholder`,e,`autocomplete`,`new-password`,3,`formError`],[`for`,`password-confirm`],[`formControlName`,`password-confirm`,`inputId`,`password-confirm`,`placeholder`,r,`autocomplete`,`new-password`,3,`formError`],[`type`,`submit`,`value`,o,1,`peertube-button`,`primary-button`,3,`disabled`]]},template:function(r,o){r&1&&(wp(0,`div`,3)(1,`h1`,4),S$(2,0),Bb(),wp(3,`form`,5),rh(`ngSubmit`,function(){return o.resetPassword()}),wp(4,`div`,6)(5,`label`,7),S$(6,1),Bb(),th(7,`my-input-text`,8),Vj(),Bb(),wp(8,`div`,6)(9,`label`,9),S$(10,2),Bb(),th(11,`my-input-text`,10),Vj(),Bb(),th(12,`input`,11),Bb()()),r&2&&($B(3),Ex(`formGroup`,o.form),$B(4),Ex(`formError`,o.formErrors.password),Gj(),$B(4),Ex(`formError`,o.formErrors[`password-confirm`]),Gj(),$B(),Ex(`disabled`,!o.form.valid||!o.isConfirmedPasswordValid()))},dependencies:[Jn,Zn,qn,$n,Qn,Vn,yn,oe],styles:[`my-input-text[_ngcontent-%COMP%]{max-width:340px;display:block}`],changeDetection:1})},data:{meta:{title:"Restablir la contrasenya"}}}];export{se as default};
//# debugId=9f0fc2df-76c4-5ec2-8902-b947bb2820a9
//# sourceMappingURL=chunk-YyaQc5jJ.js.map