1import{a as mt,d as pt}from"./chunk-TZNGONXI.js";import{a as ht,b as gt,c as ft,d as Ct,e as _t}from"./chunk-TGBHAH6G.js";import"./chunk-OPWY626C.js";import{a as U}from"./chunk-X5N2NGED.js";import{Ab as $,Cc as nt,Da as Y,Ge as B,Lb as tt,Mb as et,Ob as it,Pb as ot,Sc as rt,Ta as F,Va as R,Zc as at,he as st,rb as X,re as ut,sa as K,se as lt,tb as J,te as dt,vb as Q,xb as Z,ya as k,zb as D,ze as ct}from"./chunk-QTOL2PZP.js";import{a as M,b as A}from"./chunk-XSIU2MV4.js";import{c as v,e as x}from"./chunk-URAVB64G.js";import"./chunk-HL3YTUYI.js";import{A as z}from"./chunk-TPRAWJNE.js";import{g as H,i as P,j as W,l as O}from"./chunk-HKPEFYMC.js";import"./chunk-Q5SEFB5K.js";import{Dd as q,Mb as l,Nb as d,Sb as p,Tb as r,Ub as a,Vb as h,ac as T,fa as L,fb as n,gc as C,ic as c,j as b,ka as s,pa as g,qa as f,tc as S,uc as m,vc as j,wb as y,xb as w}from"./chunk-CKM5Y3KG.js";import"./chunk-WM23LMYA.js";import"./chunk-4XV7XKDA.js";var E=class I{constructor(){this.http=s(Y),this.router=s(P),this.authService=s(B),this.userService=s(R),this.cookieService=s(k),this.code="",this.codeIsIncorrect=!1,this.isLoading=!1}onInput(e){let t=e.target;this.code=t.value=t.value.replace(/\D/g,""),this.codeIsIncorrect=!1,t.value.length===6&&(this.isLoading=!0,this.checkCode().pipe(A(this)).subscribe({next:()=>{this.code="",this.isLoading=!1,this.userService.updateUserModel(),this.authService.restartRefreshTokenTimer(),this.router.navigate([x.main]),this.userService.userFromMobileApp&&F.saveAuthKey({authKey:this.cookieService.get("auth_key_for_mobile_app")}).then(()=>F.updateNow())},error:o=>{o.status===404&&(this.codeIsIncorrect=!0),this.isLoading=!1}}))}checkCode(){let e={code:this.code,isMobileApp:this.userService.userFromMobileApp};return this.http.post("mobile-application/auth-by-code",e,[404])}static{this.\u0275fac=function(t){return new(t||I)}}static{this.\u0275cmp=y({type:I,selectors:[["app-login-by-code"]],standalone:!1,decls:6,vars:4,consts:[[1,"d-flex","flex-column","align-items-center","gap-4","mt-4"],["for","code",1,"medium-text","gray-text"],["id","code","type","text","maxlength","6","inputmode","numeric","pattern","\\d*",1,"code-input",3,"input","ngModel","disabled"],[1,"text-center","mt-2","text-danger"]],template:function(t,o){t&1&&(r(0,"div",0)(1,"label",1),m(2,"\u041A\u043E\u0434 \u0438\u0437 \u0432\u0430\u0448\u0435\u0433\u043E \u0430\u043A\u043A\u0430\u0443\u043D\u0442\u0430:"),a(),r(3,"input",2),C("input",function(_){return o.onInput(_)}),a(),r(4,"p",3),m(5," \u0412\u0432\u0435\u0434\u0451\u043D \u043D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0438\u043B\u0438 \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0438\u0439 \u043A\u043E\u0434"),a()()),t&2&&(n(3),p("ngModel",o.code)("disabled",o.isLoading),n(),S(o.codeIsIncorrect?"":"opacity-0"))},dependencies:[X,Q,tt,et,$],encapsulation:2})}};E=b([M()],E);function bt(i,e){if(i&1&&(r(0,"p",2),m(1," \u0415\u0449\u0451 \u043D\u0435\u0442 \u0430\u043A\u043A\u0430\u0443\u043D\u0442\u0430? "),r(2,"a",4),m(3,"\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044F"),a()()),i&2){let t=c();n(2),p("routerLink",t.RoutesConsts.signup)}}function Lt(i,e){if(i&1){let t=T();r(0,"a",5),C("click",function(){g(t);let u=c();return f(u.toggleCodeAuth())}),m(1),a()}if(i&2){let t=c();n(),j(t.authOptionsButtonText())}}function yt(i,e){i&1&&h(0,"app-login-by-code")}function wt(i,e){i&1&&h(0,"app-divider-with-or",11)}function St(i,e){i&1&&h(0,"app-loader",12)}function Pt(i,e){i&1&&h(0,"app-button-google-auth",14)}function kt(i,e){i&1&&h(0,"app-button-yandex-auth",15)}function Mt(i,e){i&1&&h(0,"app-button-vk-auth",15)}function At(i,e){i&1&&h(0,"app-button-tg-auth",15)}function Rt(i,e){if(i&1&&(r(0,"div",13),l(1,Pt,1,0,"app-button-google-auth",14),l(2,kt,1,0,"app-button-yandex-auth",15),l(3,Mt,1,0,"app-button-vk-auth",15),l(4,At,1,0,"app-button-tg-auth",15),a()),i&2){let t=c(2);n(),d(t.isLoginProviderAvailable(t.OAuthProvider.GOOGLE)?1:-1),n(),d(t.isLoginProviderAvailable(t.OAuthProvider.YANDEX)?2:-1),n(),d(t.isLoginProviderAvailable(t.OAuthProvider.VK)?3:-1),n(),d(t.isLoginProviderAvailable(t.OAuthProvider.TELEGRAM)?4:-1)}}function Bt(i,e){if(i&1){let t=T();r(0,"app-input-unauth",6),C("valueChange",function(u){g(t);let _=c();return f(_.usernameChanged(u))})("clickEnter",function(){g(t);let u=c();return f(u.onSubmit())}),a(),r(1,"app-input-unauth",7),C("valueChange",function(u){g(t);let _=c();return f(_.passwordChanged(u))})("clickEnter",function(){g(t);let u=c();return f(u.onSubmit())}),a(),r(2,"div",8)(3,"a",9),m(4,"\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C \u043F\u0430\u0440\u043E\u043B\u044C"),a()(),r(5,"app-button-common",10),C("clickButton",function(){g(t);let u=c();return f(u.onSubmit())}),m(6," \u0412\u041E\u0419\u0422\u0418 "),a(),l(7,wt,1,0,"app-divider-with-or",11),l(8,St,1,0,"app-loader",12),l(9,Rt,5,4,"div",13)}if(i&2){let t=c();p("placeholder","\u0418\u043C\u044F \u0438\u043B\u0438 Email")("value",t.form.value.username)("validationResults",t.getValidationResUsername()),n(),p("placeholder","\u041F\u0430\u0440\u043E\u043B\u044C")("isPassword",!0)("value",t.form.value.password)("validationResults",t.getValidationResPassword()),n(2),p("routerLink",t.RoutesConsts.resetPassword),n(2),p("isLoading",t.isLoading),n(2),d(t.isLoadingRegistrationProviders||t.availableRegistrationProviders.length?7:-1),n(),d(t.isLoadingRegistrationProviders?8:-1),n(),d(t.availableRegistrationProviders.length?9:-1)}}var V=class N{constructor(){this.authService=s(B),this.toastr=s(K),this.router=s(P),this.route=s(H),this.cookieService=s(k),this.userService=s(R),this.class="d-flex flex-column flex-grow-1",this.submitted=!1,this.isLoading=!1,this.isLoadingRegistrationProviders=!1,this.RoutesConsts=x,this.OAuthProvider=z,this.authByCode=!1,this.availableRegistrationProviders=[]}ngOnInit(){this.updateRedirectCookie(),this.route.queryParams.subscribe(e=>
1{e.googleUserNotFound==="true"&&this.toastr.warning("\u041F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C Google \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D","\u041E\u0448\u0438\u0431\u043A\u0430 \u0432\u0445\u043E\u0434\u0430")}),this.form=new Z({username:new D("",{validators:pt()}),password:new D("",{validators:[J.required]})}),this.userService.userFromMobileApp&&(this.authByCode=!0),this.loadAvailableLoginProviders()}loadAvailableLoginProviders(){this.isLoadingRegistrationProviders=!0,this.authService.getAvailableLoginProviders().pipe(A(this)).subscribe({next:e=>{this.isLoadingRegistrationProviders=!1,this.availableRegistrationProviders=e},error:()=>{this.isLoadingRegistrationProviders=!1,this.toastr.warning("\u041D\u0435 \u043F\u043E\u043B\u0443\u0447\u0438\u043B\u043E\u0441\u044C \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u0434\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0435 \u0441\u043F\u043E\u0441\u043E\u0431\u044B \u0432\u0445\u043E\u0434\u0430")}})}isLoginProviderAvailable(e){return!!this.availableRegistrationProviders.includes(e)}usernameChanged(e){this.form.patchValue({username:e})}passwordChanged(e){this.form.patchValue({password:e})}updateRedirectCookie(){this.cookieService.delete(v,"/");let e=this.route.snapshot.queryParams.redirectUrl;e&&U(e)&&this.cookieService.set(v,e,1,"/")}getValidationResUsername(){return mt(this.form.controls.username,this.submitted)}getValidationResPassword(){let e=this.form.controls.password;return[{kind:"error",text:"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043F\u0430\u0440\u043E\u043B\u044C",isFailed:(this.submitted?e.errors:{})?.required}]}onSubmit(){if(this.submitted=!0,this.form.invalid)return;let e=this.form.value;this.isLoading=!0,this.authService.login({username:e.username,password:e.password}).subscribe({next:()=>{this.toastr.clear(),this.isLoading=!1;let t=this.cookieService.get(v);t&&!U(t)&&this.cookieService.delete(v,"/"),this.router.navigate([x.main])},error:t=>{this.isLoading=!1,t.status===409||t.status===401?this.toastr.warning("\u041F\u043E\u0436\u0430\u043B\u0443\u0439\u0441\u0442\u0430, \u0443\u0447\u0442\u0438\u0442\u0435, \u0447\u0442\u043E \u043F\u0430\u0440\u043E\u043B\u044C \u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043B\u0435\u043D \u043A \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0443","\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043B\u043E\u0433\u0438\u043D \u0438\u043B\u0438 \u043F\u0430\u0440\u043E\u043B\u044C"):t.error?.message&&this.toastr.warning(t.error.message)}})}authOptionsButtonText(){return this.authByCode?"\u0412\u043E\u0439\u0442\u0438 \u043F\u043E \u043B\u043E\u0433\u0438\u043D\u0443 \u0438 \u043F\u0430\u0440\u043E\u043B\u044E":"\u0412\u043E\u0439\u0442\u0438 \u043F\u043E \u043A\u043E\u0434\u0443"}toggleCodeAuth(){this.authByCode=!this.authByCode}static{this.\u0275fac=function(t){return new(t||N)}}static{this.\u0275cmp=y({type:N,selectors:[["app-login"]],hostVars:2,hostBindings:function(t,o){t&2&&S(o.class)},standalone:!1,decls:7,vars:4,consts:[["size","sm",1,"d-flex","flex-grow-1"],[1,"text-center","text-lg","text-bold"],[1,"register-text","text-center","text-xsm","text-grey","m-0"],[1,"text-xsm","text-center","cursor-pointer","mb-3"],[1,"text-xsm",3,"routerLink"],[1,"text-xsm","text-center","cursor-pointer","mb-3",3,"click"],["data-testid","login",1,"d-block","mb-2",3,"valueChange","clickEnter","placeholder","value","validationResults"],["data-testid","password",1,"d-block","mb-3",3,"valueChange","clickEnter","placeholder","isPassword","value","validationResults"],[1,"d-flex","justify-content-end","mb-3","text-xsm","text-bold"],[3,"routerLink"],["data-testid","button-login","kind","gradient",1,"d-block","mb-4",3,"clickButton","isLoading"],[1,"d-block","mb-4"],["height","60px"],[1,"d-flex","flex-column","align-items-center","gap-3"],["title","\u0412\u043E\u0439\u0442\u0438 \u0441 Google",1,"d-block","w-100"],[1,"w-100"]],template:function(t,o){t&1&&(r(0,"app-unauth-page-container",0)(1,"h1",1),m(2,"\u0412\u0445\u043E\u0434"),a(),l(3,bt,4,1,"p",2),l(4,Lt,2,1,"a",3),l(5,yt,1,0,"app-login-by-code"),l(6,Bt,10,12),a()),t&2&&(n(3),d(o.userService.userFromMobileApp?-1:3),n(),d(o.userService.userFromMobileApp?-1:4),n(),d(o.authByCode?5:-1),n(),d(o.authByCode?-1:6))},dependencies:[at,W,nt,ut,st,lt,ht,gt,ft,Ct,E],styles:[".text-fade[_ngcontent-%COMP%]{color:var(--color-text-placeholder)}.text-grey[_ngcontent-%COMP%]{color:var(--color-text-muted)}a[_ngcontent-%COMP%]{color:var(--color-accent);text-decoration:none}.text-xsm[_ngcontent-%COMP%]{font-size:14px}.text-sm[_ngcontent-%COMP%]{font-size:18px}.text-md[_ngcontent-%COMP%]{font-size:24px}.text-lg[_ngcontent-%COMP%]{font-size:32px}.text-bold[_ngcontent-%COMP%]{font-weight:600}.cursor-pointer[_ngcontent-%COMP%]{cursor:pointer}"]})}};V=b([M()],V);var Et=[{path:"",component:V}],vt=(()=>
1{class i{static{this.\u0275fac=function(o){return new(o||i)}}static{this.\u0275mod=w({type:i})}static{this.\u0275inj=L({imports:[O.forChild(Et),O]})}}return i})();var Ae=(()=>{class i{static{this.\u0275fac=function(o){return new(o||i)}}static{this.\u0275mod=w({type:i})}static{this.\u0275inj=L({imports:[ct,q,it,ot,vt,rt,dt,_t]})}}return i})();export{Ae as LoginModule};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.