2 lines
5.8 KiB
JavaScript
2 lines
5.8 KiB
JavaScript
(this.webpackJsonp=this.webpackJsonp||[]).push([[16,17],{115:function(e,t,n){"use strict";function r(e,t){return t?e.replace(/\+/g,"-").replace(/\//g,"_").replace(/\=+$/,""):e.replace(/-/g,"+").replace(/_/g,"/")}n.d(t,"a",(function(){return r}))},116:function(e,t,n){"use strict";function r(e,t){const n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;++r)if(e[r]!==t[r])return!1;return!0}n.d(t,"a",(function(){return r}))},122:function(e,t,n){"use strict";n.d(t,"a",(function(){return p}));var r=n(32),a=n(56),i=n(41),o=n(7),s=n(8),c=n(0),l=n(57),d=n(60);let u,g=!1;function p(e){g||(u||(u=s.a.getConfig().then(e=>e.suggested_lang_code!==o.c.lastRequestedLangCode?Promise.all([e,o.c.getStrings(e.suggested_lang_code,["Login.ContinueOnLanguage"]),o.c.getCacheLangPack()]):[]))).then(([t,n])=>{if(!t)return;const s=[];n.forEach(e=>{const t=o.c.strings.get(e.key);t&&(s.push(t),o.c.strings.set(e.key,e))});const u="Login.ContinueOnLanguage",p=Object(l.a)("btn-primary btn-secondary btn-primary-transparent primary",{text:u});p.lastElementChild.classList.remove("i18n"),Object(i.a)({text:[o.c.format(u,!0)]}).then(()=>{window.requestAnimationFrame(()=>{e.append(p)})}),c.a.addEventListener("language_change",()=>{p.remove()},{once:!0}),s.forEach(e=>{o.c.strings.set(e.key,e)}),Object(a.b)(p,e=>{Object(r.a)(e),g=!0,p.disabled=!0,Object(d.f)(p),o.c.getLangPack(t.suggested_lang_code)})})}},161:function(e,t,n){"use strict";n.r(t);var r=n(8),a=n(87),i=n(85),o=n(5),s=n(57),c=n(7),l=n(34),d=n(0),u=n(60),g=n(122),p=n(16),f=n(115),m=n(116);function h(e){return e<26?e+65:e<52?e+71:e<62?e-4:62===e?43:63===e?47:65}var y=function(e,t,n,r){return new(n||(n=Promise))((function(a,i){function o(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}c((r=r.apply(e,t||[])).next())}))};let v,b=()=>y(void 0,void 0,void 0,(function*(){const e=w.pageEl.querySelector(".auth-image");let t=Object(u.f)(e,!0);const a=document.createElement("div");a.classList.add("input-wrapper");const l=Object(s.a)("btn-primary btn-secondary btn-primary-transparent primary",{text:"Login.QR.Cancel"});a.append(l),Object(g.a)(a);const b=e.parentElement,O=document.createElement("h4");Object(c.b)(O,"Login.QR.Title");const _=document.createElement("ol");_.classList.add("qr-description"),["Login.QR.Help1","Login.QR.Help2","Login.QR.Help3"].forEach(e=>{const t=document.createElement("li");t.append(Object(c.d)(e)),_.append(t)}),b.append(O,_,a),l.addEventListener("click",()=>{Promise.all([n.e(2),n.e(4)]).then(n.bind(null,164)).then(e=>e.default.mount()),L=!0});const E=(yield Promise.all([n.e(10).then(n.t.bind(null,196,7))]))[0].default;let L=!1;d.a.addEventListener("user_auth",()=>{L=!0,v=null},{once:!0});let k,S={ignoreErrors:!0};const P=a=>y(void 0,void 0,void 0,(function*(){try{let s=yield r.a.invokeApi("auth.exportLoginToken",{api_id:o.a.id,api_hash:o.a.hash,except_ids:[]},{ignoreErrors:!0});if("auth.loginTokenMigrateTo"===s._&&(S.dcId||(S.dcId=s.dc_id,r.a.setBaseDcId(s.dc_id)),s=yield r.a.invokeApi("auth.importLoginToken",{token:s.token},S)),"auth.loginTokenSuccess"===s._){const e=s.authorization;return r.a.setUser(e.user),n.e(3).then(n.bind(null,107)).then(e=>e.default.mount()),!0}if(!k||!Object(m.a)(k,s.token)){k=s.token;let n=function(e){let t,n="";for(let r=e.length,a=0,i=0;i<r;++i)t=i%3,a|=e[i]<<(16>>>t&24),2!==t&&r-i!=1||(n+=String.fromCharCode(h(a>>>18&63),h(a>>>12&63),h(a>>>6&63),h(63&a)),a=0);return n.replace(/A(?=A$|$)/g,"=")}(s.token),r="tg://login?token="+Object(f.a)(n,!0);const a=window.getComputedStyle(document.documentElement),i=a.getPropertyValue("--surface-color").trim(),o=a.getPropertyValue("--primary-text-color").trim(),c=a.getPropertyValue("--primary-color").trim(),l=yield fetch("assets/img/logo_padded.svg").then(e=>e.text()).then(e=>{e=e.replace(/(fill:).+?(;)/,`$1${c}$2`);const t=new Blob([e],{type:"image/svg+xml;charset=utf-8"});return new Promise(e=>{const n=new FileReader;n.onload=t=>{e(t.target.result)},n.readAsDataURL(t)})}),d=new E({width:240*window.devicePixelRatio,height:240*window.devicePixelRatio,data:r,image:l,dotsOptions:{color:o,type:"rounded"},cornersSquareOptions:{type:"extra-rounded"},imageOptions:{imageSize:1,margin:0},backgroundOptions:{color:i},qrOptions:{errorCorrectionLevel:"L"}});let u;d.append(e),e.lastChild.classList.add("qr-canvas"),u=d._drawingPromise?d._drawingPromise:Promise.race([Object(p.a)(1e3),new Promise(e=>{d._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){let e=Date.now()/1e3,t=s.expires-e-i.a.serverTimeOffset;yield Object(p.a)(t>3?3e3:1e3*t|0)}}catch(e){switch(e.type){case"SESSION_PASSWORD_NEEDED":console.warn("pageSignQR: SESSION_PASSWORD_NEEDED"),e.handled=!0,n.e(13).then(n.bind(null,139)).then(e=>e.default.mount()),L=!0,v=null;break;default:console.error("pageSignQR: default error:",e),L=!0}return!0}return!1}));return()=>y(void 0,void 0,void 0,(function*(){for(L=!1;;){if(L)break;if(yield P(!0))break}}))}));const w=new a.a("page-signQR",!0,()=>v,()=>{v||(v=b()),v.then(e=>{e()}),l.c.pushToState("authState",{_:"authStateSignQr"})});t.default=w},85:function(e,t,n){"use strict";var r=n(1),a=n(6),i=n(8);const o=new class{constructor(){this.serverTimeOffset=0,a.a.get("server_time_offset").then(e=>{e&&(this.serverTimeOffset=e)}),i.a.addTaskListener("applyServerTimeOffset",e=>{this.serverTimeOffset=e.payload})}};r.a&&(r.a.serverTimeManager=o),t.a=o}}]);
|
|
//# sourceMappingURL=16.049af2cb2d7656888f47.chunk.js.map
|