import{a as G}from"./chunk-GAFOTJIM.js";import{b as L}from"./chunk-XMYCMRMC.js";import{h as b}from"./chunk-WO36EOJQ.js";import{b as h}from"./chunk-JRPZV2OL.js";import"./chunk-QYZO4RSP.js";import{C as $,D,d as A,g as O,h as M,o as N,r as w,u as v}from"./chunk-AWFGIQSJ.js";import{$h as W,Cb as T,Gh as I,Ha as _,Sa as P,Wa as c,aa as i,eb as a,eh as y,la as u,ob as S,pb as s,pd as g,qb as d,td as C,yb as m}from"./chunk-GKQGDBUU.js";import{i as E}from"./chunk-QVFSZZWQ.js";var F={VALIDATORS:[A.required],MESSAGES:{required:"\u041F\u0456\u0434\u0442\u0432\u0435\u0440\u0434\u0436\u0435\u043D\u043D\u044F \u043F\u0430\u0440\u043E\u043B\u044F \u043E\u0431\u043E\u0432'\u044F\u0437\u043A\u043E\u0432\u0435."}};var X=(()=>{let t=class t extends G{formReactiveService=i(h);userService=i(W);serverService=i(I);notifier=i(y);router=i(C);route=i(g);userId;verificationString;ngOnInit(){let{minLength:e,maxLength:r}=this.serverService.getHTMLConfig().fieldsConstraints.users.password;this.buildForm({password:b(e,r),"password-confirm":F}),this.userId=this.route.snapshot.queryParams.userId,this.verificationString=this.route.snapshot.queryParams.verificationString,(!this.userId||!this.verificationString)&&(this.notifier.error("\u041D\u0435 \u0432\u0434\u0430\u043B\u043E\u0441\u044F \u0437\u043D\u0430\u0439\u0442\u0438 id \u043A\u043E\u0440\u0438\u0441\u0442\u0443\u0432\u0430\u0447\u0430 \u0430\u0431\u043E \u0440\u044F\u0434\u043E\u043A \u043F\u0435\u0440\u0435\u0432\u0456\u0440\u043A\u0438."),this.router.navigate(["/"]));}resetPassword(){this.userService.resetPassword(this.userId,this.verificationString,this.form.value.password).subscribe({next:()=>{this.notifier.success("\u0412\u0430\u0448 \u043F\u0430\u0440\u043E\u043B\u044C \u0431\u0443\u043B\u043E \u0443\u0441\u043F\u0456\u0448\u043D\u043E \u0441\u043A\u0438\u043D\u0443\u0442\u043E!"),this.router.navigate(["/login"]);},error:e=>this.notifier.error(e.message)});}isConfirmedPasswordValid(){let e=this.form.value;return e.password===e["password-confirm"];}};E(t,"\u0275fac",(()=>{let e;return function(o){return(e||(e=u(t)))(o||t);};})()),E(t,"\u0275cmp",P({type:t,selectors:[["ng-component"]],features:[c],decls:13,vars:4,consts:()=>{let e;e="\u041F\u0430\u0440\u043E\u043B\u044C";let r;r="\u041F\u0456\u0434\u0442\u0432\u0435\u0440\u0434\u0436\u0435\u043D\u0438\u0439 \u043F\u0430\u0440\u043E\u043B\u044C";let o;o="\u0412\u0456\u0434\u043D\u043E\u0432\u0438\u0442\u0438 \u043F\u0430\u0440\u043E\u043B\u044C";let p;p="\u0412\u0456\u0434\u043D\u043E\u0432\u0438\u0442\u0438 \u043F\u0430\u0440\u043E\u043B\u044C";let R;R="\u041F\u0430\u0440\u043E\u043B\u044C";let f;return f="\u041F\u0456\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u0438 \u043F\u0430\u0440\u043E\u043B\u044C",[p,R,f,[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&&(S(0,"div",3)(1,"h1",4),m(2,0),s(),S(3,"form",5),T("ngSubmit",function(){return o.resetPassword();}),S(4,"div",6)(5,"label",7),m(6,1),s(),d(7,"my-input-text",8),s(),S(8,"div",6)(9,"label",9),m(10,2),s(),d(11,"my-input-text",10),s(),d(12,"input",11),s()()),r&2&&(_(3),a("formGroup",o.form),_(4),a("formError",o.formErrors.password),_(4),a("formError",o.formErrors["password-confirm"]),_(),a("disabled",!o.form.valid||!o.isConfirmedPasswordValid()));},dependencies:[$,N,O,M,D,w,v,L],styles:[`my-input-text[_ngcontent-%COMP%]{max-width:340px;display:block}
/*# sourceMappingURL=reset-password.component-ZMNUSJ3U.css.map */`]}));let l=t;return l;})();var te=[{path:"",component:X,data:{meta:{title:"\u0421\u043A\u0438\u043D\u0443\u0442\u0438 \u043F\u0430\u0440\u043E\u043B\u044C"}}}];export{te as default};/**i18n:42345378061bf3c93df67acfa161b751a7b03cc91f3ede7c1f1cdf2bba62fe26*///# sourceMappingURL=chunk-A6MNNAUT.js.map