tweb/public/53.40d79ab9d14e8d83cf01.chu...

2 lines
12 KiB
JavaScript

"use strict";(this.webpackChunktweb=this.webpackChunktweb||[]).push([[53,63,709,392,810,641,776],{9638:(e,t,n)=>{n.d(t,{Z:()=>p});var a=n(3910),o=n(2738),r=n(4541),i=n(2325),s=n(3512),d=n(4494),l=n(279);let c,u=!1;function p(e){u||(c||(c=s.Z.managers.apiManager.getConfig().then((e=>e.suggested_lang_code!==i.ZP.lastRequestedLangCode?Promise.all([e,i.ZP.getStrings(e.suggested_lang_code,["Login.ContinueOnLanguage"]),i.ZP.getCacheLangPack()]):[])))).then((([t,n])=>{if(!t)return;const c=[];n.forEach((e=>{const t=i.ZP.strings.get(e.key);t&&(c.push(t),i.ZP.strings.set(e.key,e))}));const p="Login.ContinueOnLanguage",h=(0,d.Z)("btn-primary btn-secondary btn-primary-transparent primary",{text:p});h.lastElementChild.classList.remove("i18n"),(0,r.Z)({text:[i.ZP.format(p,!0)]}).then((()=>{window.requestAnimationFrame((()=>{e.append(h)}))})),s.Z.addEventListener("language_change",(()=>{h.remove()}),{once:!0}),c.forEach((e=>{i.ZP.strings.set(e.key,e)})),(0,o.fc)(h,(e=>{(0,a.Z)(e),u=!0,h.disabled=!0,(0,l.y)(h),i.ZP.getLangPack(t.suggested_lang_code)}))}))}},6392:(e,t,n)=>{n.r(t),n.d(t,{default:()=>L});var a=n(4755),o=n(4874),r=n(810),i=n(3083),s=n(4489),d=n(2325),l=n(144),c=n(5565),u=n(3512),p=n(1447),h=n(2521),g=n(2738);let m,y,v,f,_=null,Z=null,E=null;const b=()=>{setTimeout((()=>{null==v||v.remove(),null==f||f.remove()}),300)},S=new o.Z("page-authCode",!0,(()=>{S.pageEl.querySelector(".input-wrapper").append(y.container);const e=S.pageEl.querySelector(".phone-edit");(0,g.fc)(e,(()=>r.default.mount()))}),(e=>{if(_=e,Z){m.value="";const e=document.createEvent("HTMLEvents");e.initEvent("input",!1,!0),m.dispatchEvent(e)}else Z=S.pageEl.getElementsByClassName("phone")[0],E=S.pageEl.getElementsByClassName("sent-type")[0];const t=_.type.length;let o,r;y||(y=new s.Z({label:"Code",name:(0,l.a)(),length:t,onFill:e=>{(e=>{m.setAttribute("disabled","true");const t={phone_number:_.phone_number,phone_code_hash:_.phone_code_hash,phone_code:e};u.Z.managers.apiManager.invokeApi("auth.signIn",t,{ignoreErrors:!0}).then((e=>{switch(e._){case"auth.authorization":u.Z.managers.apiManager.setUser(e.user),n.e(781).then(n.bind(n,5436)).then((e=>{e.default.mount()})),b();break;case"auth.authorizationSignUpRequired":n.e(813).then(n.bind(n,8339)).then((e=>{e.default.mount({phone_number:_.phone_number,phone_code_hash:_.phone_code_hash})})),b()}})).catch((e=>{return t=void 0,a=void 0,r=function*(){let t=!1;switch(e.type){case"SESSION_PASSWORD_NEEDED":t=!0,e.handled=!0,yield(yield n.e(442).then(n.bind(n,9437))).default.mount(),setTimeout((()=>{m.value=""}),300);break;case"PHONE_CODE_EXPIRED":m.classList.add("error"),(0,c.Z)(y.label,(0,d.ag)("PHONE_CODE_EXPIRED"));break;case"PHONE_CODE_EMPTY":case"PHONE_CODE_INVALID":m.classList.add("error"),(0,c.Z)(y.label,(0,d.ag)("PHONE_CODE_INVALID"));break;default:y.label.innerText=e.type}t||y.select(),m.removeAttribute("disabled")},new((o=void 0)||(o=Promise))((function(e,n){function i(e){try{d(r.next(e))}catch(e){n(e)}}function s(e){try{d(r.throw(e))}catch(e){n(e)}}function d(t){var n;t.done?e(t.value):(n=t.value,n instanceof o?n:new o((function(e){e(n)}))).then(i,s)}d((r=r.apply(t,a||[])).next())}));var t,a,o,r}))})(e)}}),m=y.input),y.options.length=t,Z.innerText=_.phone_number;const g=_.type;switch(g._){case"auth.sentCodeTypeSms":o="Login.Code.SentSms";break;case"auth.sentCodeTypeApp":o="Login.Code.SentInApp";break;case"auth.sentCodeTypeCall":o="Login.Code.SentCall";break;case"auth.sentCodeTypeFragmentSms":o="PhoneNumber.Code.Fragment.Info";const e=document.createElement("a");(0,h.Z)(e),e.href=g.url,r=[e];break;default:o="Login.Code.SentUnknown",r=[g._]}return(0,c.Z)(E,(0,d.ag)(o,r)),u.Z.managers.appStateManager.pushToState("authState",{_:"authStateAuthCode",sentCode:e}),(()=>{const e=S.pageEl.querySelector(".auth-image"),t=a.Z.isMobile?100:166;if("auth.sentCodeTypeFragmentSms"===_.type._){e.firstElementChild&&(null==v||v.remove(),v=void 0,e.replaceChildren());const n=document.createElement("div");return n.classList.add("media-sticker-wrapper"),e.append(n),p.Z.loadAnimationAsAsset({container:n,loop:!0,autoplay:!0,width:t,height:t},"jolly_roger").then((e=>(f=e,p.Z.waitForFirstFrame(e)))).then((()=>{}))}return e.firstElementChild&&(null==f||f.remove(),f=void 0,e.replaceChildren()),v=new i.Z(y,t),e.append(v.container),v.load()})()}),(()=>{m.focus()})),L=S},810:(e,t,n)=>{n.r(t),n.d(t,{default:()=>P});var a=n(279),o=n(4874),r=n(9807),i=n(4494),s=n(5432),d=n(4159),l=n(2325),c=n(1447),u=n(1405),p=n(9709),h=n(9638),g=n(3910),m=n(2738),y=n(5565),v=n(1656),f=n(7487),_=n(2398),Z=n(7922),E=n(3512),b=n(709),S=n(3855),L=n(5431);let w,k=null;const C=new o.Z("page-sign",!0,(()=>{const e=document.createElement("div");let t,o;e.classList.add("input-wrapper");const u=new L.Z({onCountryChange:(e,n)=>{t=e,o=n,n&&(P.value=P.lastValue="+"+n.country_code,setTimeout((()=>{x.focus(),(0,_.Z)(x,!0)}),0))}}),P=new b.Z({onInput:e=>{c.Z.loadLottieWorkers();const{country:n,code:a}=e||{},r=n?n.name||n.default_name:"";r===u.value||t&&n&&a&&(t===n||o.country_code===a.country_code)||u.override(n,a,r),n||P.value.length-1>1?k.style.visibility="":k.style.visibility="hidden"}}),x=P.input;x.addEventListener("keypress",(e=>{if(!k.style.visibility&&"Enter"===e.key)return A()}));const T=new r.Z({text:"Login.KeepSigned",name:"keepSession",withRipple:!0,checked:!0});T.input.addEventListener("change",(()=>{const e=T.checked;E.Z.managers.appStateManager.pushToState("keepSigned",e),S.Z.toggleStorages(e,!0)})),S.Z.getState().then((e=>{Z.Z.isAvailable()?T.checked=e.keepSigned:(T.checked=!1,T.label.classList.add("checkbox-disabled"))})),k=(0,i.Z)("btn-primary btn-color-primary",{text:"Login.Next"}),k.style.visibility="hidden";const A=e=>{e&&(0,g.Z)(e);const t=(0,v.Z)([k,w],!0);(0,y.Z)(k,(0,l.ag)("PleaseWait")),(0,a.y)(k);const o=P.value;E.Z.managers.apiManager.invokeApi("auth.sendCode",{phone_number:o,api_id:d.Z.id,api_hash:d.Z.hash,settings:{_:"codeSettings",pFlags:{}}}).then((e=>{if("auth.sentCodeSuccess"===e._){const{authorization:t}=e;"auth.authorization"===t._&&(E.Z.managers.apiManager.setUser(t.user),n.e(781).then(n.bind(n,5436)).then((e=>{e.default.mount()})))}n.e(392).then(n.bind(n,6392)).then((t=>t.default.mount(Object.assign(e,{phone_number:o}))))})).catch((e=>{t(),"PHONE_NUMBER_INVALID"===e.type?(P.setError(),(0,y.Z)(P.label,(0,l.ag)("Login.PhoneLabelInvalid")),x.classList.add("error"),(0,y.Z)(k,(0,l.ag)("Login.Next"))):(console.error("auth.sendCode error:",e),k.innerText=e.type)}))};(0,m.fc)(k,A),w=(0,i.Z)("btn-primary btn-secondary btn-primary-transparent primary",{text:"Login.QR.Login"}),w.addEventListener("click",(()=>{p.default.mount()})),e.append(u.container,P.container,T.label,k,w);const O=document.createElement("h4");O.classList.add("text-center"),(0,l.$d)(O,"Login.Title");const N=document.createElement("div");N.classList.add("subtitle","text-center"),(0,l.$d)(N,"Login.StartText"),C.pageEl.querySelector(".container").append(O,N,e),s.Z||setTimeout((()=>{x.focus()}),0),(0,h.Z)(e),E.Z.managers.apiManager.invokeApi("help.getNearestDc").then((e=>{var t;const n=Z.Z.getFromCache("langPack");n&&!(null===(t=n.countries)||void 0===t?void 0:t.hash)&&l.ZP.getLangPack(n.lang_code).then((()=>{P.simulateInputEvent()}));const a=new Set([1,2,3,4,5]),o=[e.this_dc];let r;return e.nearest_dc!==e.this_dc&&(r=E.Z.managers.apiManager.getNetworkerVoid(e.nearest_dc).then((()=>{o.push(e.nearest_dc)}))),(r||Promise.resolve()).then((()=>{o.forEach((e=>{a.delete(e)}));const e=[...a],t=()=>{return n=void 0,a=void 0,r=function*(){const n=e.shift();if(!n)return;const a=`dc${n}_auth_key`;if(yield f.Z.get(a))return t();setTimeout((()=>{E.Z.managers.apiManager.getNetworkerVoid(n).finally(t)}),3e3)},new((o=void 0)||(o=Promise))((function(e,t){function i(e){try{d(r.next(e))}catch(e){t(e)}}function s(e){try{d(r.throw(e))}catch(e){t(e)}}function d(t){var n;t.done?e(t.value):(n=t.value,n instanceof o?n:new o((function(e){e(n)}))).then(i,s)}d((r=r.apply(n,a||[])).next())}));var n,a,o,r};t()})),e})).then((e=>{u.value.length||P.value.length||u.selectCountryByIso2(e.country)}))}),(()=>{k&&((0,y.Z)(k,(0,l.ag)("Login.Next")),(0,u.Z)(k,void 0,void 0,!0),k.removeAttribute("disabled")),w&&w.removeAttribute("disabled"),E.Z.managers.appStateManager.pushToState("authState",{_:"authStateSignIn"})})),P=C},9709:(e,t,n)=>{n.r(t),n.d(t,{default:()=>v});var a=n(4874),o=n(4159),r=n(4494),i=n(2325),s=n(3512),d=n(279),l=n(9638),c=n(5418),u=n(9895);function p(e){return e<26?e+65:e<52?e+71:e<62?e-4:62===e?43:63===e?47:65}var h=n(8812),g=function(e,t,n,a){return new(n||(n=Promise))((function(o,r){function i(e){try{d(a.next(e))}catch(e){r(e)}}function s(e){try{d(a.throw(e))}catch(e){r(e)}}function d(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,s)}d((a=a.apply(e,t||[])).next())}))};let m;const y=new a.Z("page-signQR",!0,(()=>m),(()=>{m||(m=g(void 0,void 0,void 0,(function*(){const e=y.pageEl.querySelector(".auth-image");let t=(0,d.y)(e,!0);const a=document.createElement("div");a.classList.add("input-wrapper");const v=(0,r.Z)("btn-primary btn-secondary btn-primary-transparent primary",{text:"Login.QR.Cancel"});a.append(v),(0,l.Z)(a);const f=e.parentElement,_=document.createElement("h4");(0,i.$d)(_,"Login.QR.Title");const Z=document.createElement("ol");Z.classList.add("qr-description"),["Login.QR.Help1","Login.QR.Help2","Login.QR.Help3"].forEach((e=>{const t=document.createElement("li");t.append((0,i.ag)(e)),Z.append(t)})),f.append(_,Z,a),v.addEventListener("click",(()=>{n.e(810).then(n.bind(n,810)).then((e=>e.default.mount())),b=!0}));const E=(yield Promise.all([n.e(630).then(n.t.bind(n,1915,23))]))[0].default;let b=!1;s.Z.addEventListener("user_auth",(()=>{b=!0,m=null}),{once:!0});const S={ignoreErrors:!0};let L;const w=a=>g(void 0,void 0,void 0,(function*(){try{let r=yield s.Z.managers.apiManager.invokeApi("auth.exportLoginToken",{api_id:o.Z.id,api_hash:o.Z.hash,except_ids:[]},{ignoreErrors:!0});if("auth.loginTokenMigrateTo"===r._&&(S.dcId||(S.dcId=r.dc_id,s.Z.managers.apiManager.setBaseDcId(r.dc_id)),r=yield s.Z.managers.apiManager.invokeApi("auth.importLoginToken",{token:r.token},S)),"auth.loginTokenSuccess"===r._){const e=r.authorization;return s.Z.managers.apiManager.setUser(e.user),n.e(781).then(n.bind(n,5436)).then((e=>e.default.mount())),!0}if(!L||!(0,u.Z)(L,r.token)){L=r.token;const n="tg://login?token="+function(e){let t,n="";for(let a=e.length,o=0,r=0;r<a;++r)t=r%3,o|=e[r]<<(16>>>t&24),2!==t&&a-r!=1||(n+=String.fromCharCode(p(o>>>18&63),p(o>>>12&63),p(o>>>6&63),p(63&o)),o=0);return n.replace(/A(?=A$|$)/g,"=")}(r.token).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=+$/,""),a=window.getComputedStyle(document.documentElement),o=a.getPropertyValue("--surface-color").trim(),i=a.getPropertyValue("--primary-text-color").trim(),s=a.getPropertyValue("--primary-color").trim(),d=yield fetch("assets/img/logo_padded.svg").then((e=>e.text())).then((e=>(e=e.replace(/(fill:).+?(;)/,`$1${s}$2`),(0,h.Z)(e)))),l=new E({width:240*window.devicePixelRatio,height:240*window.devicePixelRatio,data:n,image:d,dotsOptions:{color:i,type:"rounded"},cornersSquareOptions:{type:"extra-rounded"},imageOptions:{imageSize:1,margin:0},backgroundOptions:{color:o},qrOptions:{errorCorrectionLevel:"L"}});let u;l.append(e),e.lastChild.classList.add("qr-canvas"),u=l._drawingPromise?l._drawingPromise:Promise.race([(0,c.Z)(1e3),new Promise((e=>{l._canvas._image.addEventListener("load",(()=>{window.requestAnimationFrame((()=>e()))}),{once:!0})}))]),yield u.then((()=>{if(t){t.style.animation="hide-icon .4s forwards";const n=e.children[1];n.style.display="none",n.style.animation="grow-icon .4s forwards",setTimeout((()=>{n.style.display=""}),150),setTimeout((()=>{n.style.animation=""}),500),t=void 0}else Array.from(e.children).slice(0,-1).forEach((e=>{e.remove()}))}))}if(a){const e=Date.now()/1e3,t=r.expires-e-(yield s.Z.managers.timeManager.getServerTimeOffset());yield(0,c.Z)(t>3?3e3:1e3*t|0)}}catch(e){return"SESSION_PASSWORD_NEEDED"===e.type?(e.handled=!0,n.e(442).then(n.bind(n,9437)).then((e=>e.default.mount())),b=!0,m=null):(console.error("pageSignQR: default error:",e),b=!0),!0}return!1}));return()=>g(void 0,void 0,void 0,(function*(){for(b=!1;!b&&!(yield w(!0)););}))}))),m.then((e=>{e()})),s.Z.managers.appStateManager.pushToState("authState",{_:"authStateSignQr"})})),v=y}}]);
//# sourceMappingURL=53.40d79ab9d14e8d83cf01.chunk.js.map