tweb/public/709.77e1421caf56d9ff127a.chunk.js
Eduard Kuzmenko 5625eda42b Build
2022-08-20 13:32:46 +02:00

2 lines
9.1 KiB
JavaScript

"use strict";(this.webpackChunktweb=this.webpackChunktweb||[]).push([[709],{4494:(e,t,n)=>{n.d(t,{Z:()=>a});var i=n(2325),r=n(1405);const a=(e,t={})=>{const n=document.createElement(t.asDiv?"div":"button");return n.className=e+(t.icon?" tgico-"+t.icon:""),t.noRipple||(t.rippleSquare&&n.classList.add("rp-square"),(0,r.Z)(n)),t.onlyMobile&&n.classList.add("only-handhelds"),t.disabled&&n.setAttribute("disabled","true"),t.text&&n.append((0,i.ag)(t.text)),n}},9638:(e,t,n)=>{n.d(t,{Z:()=>p});var i=n(3910),r=n(2738),a=n(4541),s=n(2325),o=n(3512),d=n(4494),l=n(279);let c,u=!1;function p(e){u||(c||(c=o.Z.managers.apiManager.getConfig().then((e=>e.suggested_lang_code!==s.ZP.lastRequestedLangCode?Promise.all([e,s.ZP.getStrings(e.suggested_lang_code,["Login.ContinueOnLanguage"]),s.ZP.getCacheLangPack()]):[])))).then((([t,n])=>{if(!t)return;const c=[];n.forEach((e=>{const t=s.ZP.strings.get(e.key);t&&(c.push(t),s.ZP.strings.set(e.key,e))}));const p="Login.ContinueOnLanguage",g=(0,d.Z)("btn-primary btn-secondary btn-primary-transparent primary",{text:p});g.lastElementChild.classList.remove("i18n"),(0,a.Z)({text:[s.ZP.format(p,!0)]}).then((()=>{window.requestAnimationFrame((()=>{e.append(g)}))})),o.Z.addEventListener("language_change",(()=>{g.remove()}),{once:!0}),c.forEach((e=>{s.ZP.strings.set(e.key,e)})),(0,r.fc)(g,(e=>{(0,i.Z)(e),u=!0,g.disabled=!0,(0,l.y)(g),s.ZP.getLangPack(t.suggested_lang_code)}))}))}},279:(e,t,n)=>{function i(e,t=!1){const n='\n <svg xmlns="http://www.w3.org/2000/svg" class="preloader-circular" viewBox="25 25 50 50">\n <circle class="preloader-path" cx="50" cy="50" r="20" fill="none" stroke-miterlimit="10"/>\n </svg>';if(t){const t=document.createElement("div");return t.classList.add("preloader"),t.innerHTML=n,e&&e.appendChild(t),t}return e.insertAdjacentHTML("beforeend",n),e.lastElementChild}function r(e,t="check"){return e.classList.remove("tgico-"+t),e.disabled=!0,i(e),()=>{e.innerHTML="",e.classList.add("tgico-"+t),e.removeAttribute("disabled")}}n.d(t,{p:()=>r,y:()=>i}),n(410).GO.putPreloader=i},1405:(e,t,n)=>{n.d(t,{Z:()=>l});var i=n(8497),r=n(9674),a=n(5432),s=n(3512),o=n(5975);let d=0;function l(e,t=(()=>Promise.resolve()),n=null,l=!1,c=e){if(e.querySelector(".c-ripple"))return;e.classList.add("rp");const u=document.createElement("div");let p;u.classList.add("c-ripple"),e.classList.contains("rp-square")&&u.classList.add("is-square"),e[l?"prepend":"append"](u);const g=(e,i)=>{const s=Date.now(),o=document.createElement("div"),l=d++,c=1e3*+window.getComputedStyle(u).getPropertyValue("--ripple-duration").replace("s","");p=()=>{const e=Date.now()-s,t=()=>{r.Z.mutate((()=>{o.remove()})),n&&n(l)};if(e<c){const n=Math.max(c-e,c/2);setTimeout((()=>o.classList.add("hiding")),Math.max(n-c/2,0)),setTimeout(t,n)}else o.classList.add("hiding"),setTimeout(t,c/2);a.Z||window.removeEventListener("contextmenu",p),p=null,h=!1},t&&t(l),window.requestAnimationFrame((()=>{const t=u.getBoundingClientRect();o.classList.add("c-ripple__circle");const n=e-t.left,r=i-t.top,a=Math.sqrt(Math.pow(Math.abs(r-t.height/2)+t.height/2,2)+Math.pow(Math.abs(n-t.width/2)+t.width/2,2)),s=n-a/2,d=r-a/2;o.style.width=o.style.height=a+"px",o.style.left=s+"px",o.style.top=d+"px",u.append(o)}))},m=t=>t.target!==e&&(["BUTTON","A"].includes(t.target.tagName)||(0,i.Z)(t.target,"c-ripple")!==u)&&(c===e||!(0,o.Z)(t.target,c));let h=!1;if(a.Z){const e=()=>{p&&p()};c.addEventListener("touchstart",(t=>{if(!s.Z.settings.animationsEnabled)return;if(t.touches.length>1||h||m(t))return;h=!0;const{clientX:n,clientY:i}=t.touches[0];g(n,i),c.addEventListener("touchend",e,{once:!0}),window.addEventListener("touchmove",(t=>{t.cancelBubble=!0,t.stopPropagation(),e(),c.removeEventListener("touchend",e)}),{once:!0})}),{passive:!0})}else c.addEventListener("mousedown",(e=>{if(![0,2].includes(e.button))return;if(!s.Z.settings.animationsEnabled)return;if("0"===c.dataset.ripple||m(e))return;if(h)return void(h=!1);const{clientX:t,clientY:n}=e;g(t,n),window.addEventListener("mouseup",p,{once:!0,passive:!0}),window.addEventListener("contextmenu",p,{once:!0,passive:!0})}),{passive:!0})}},4484:(e,t,n)=>{function i(e,t){const n=e.length;if(n!==t.length)return!1;for(let i=0;i<n;++i)if(e[i]!==t[i])return!1;return!0}n.d(t,{Z:()=>i})},9674:(e,t,n)=>{n.d(t,{Z:()=>d});var i=n(3035),r=n(3725),a=n(410),s=n(8487);const o=new class{constructor(){this.promises={},this.raf=i.T2.bind(null),this.scheduled=!1}do(e,t){let n=this.promises[e];return n||(this.scheduleFlush(),n=this.promises[e]=(0,r.Z)()),void 0!==t&&n.then((()=>t())),n}measure(e){return this.do("read",e)}mutate(e){return this.do("write",e)}mutateElement(e,t){const n=(0,s.Z)(e),i=n?this.mutate():Promise.resolve();return void 0!==t&&(n?t():i.then((()=>t()))),i}scheduleFlush(){this.scheduled||(this.scheduled=!0,this.raf((()=>{this.promises.read&&this.promises.read.resolve(),this.promises.write&&this.promises.write.resolve(),this.scheduled=!1,this.promises={}})))}};a.GO&&(a.GO.sequentialDom=o);const d=o},9709:(e,t,n)=>{n.r(t),n.d(t,{default:()=>v});var i=n(4874),r=n(4159),a=n(4494),s=n(2325),o=n(3512),d=n(279),l=n(9638),c=n(5418),u=n(4484);function p(e){return e<26?e+65:e<52?e+71:e<62?e-4:62===e?43:63===e?47:65}var g=function(e,t,n,i){return new(n||(n=Promise))((function(r,a){function s(e){try{d(i.next(e))}catch(e){a(e)}}function o(e){try{d(i.throw(e))}catch(e){a(e)}}function d(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,o)}d((i=i.apply(e,t||[])).next())}))};let m;const h=new i.Z("page-signQR",!0,(()=>m),(()=>{m||(m=g(void 0,void 0,void 0,(function*(){const e=h.pageEl.querySelector(".auth-image");let t=(0,d.y)(e,!0);const i=document.createElement("div");i.classList.add("input-wrapper");const v=(0,a.Z)("btn-primary btn-secondary btn-primary-transparent primary",{text:"Login.QR.Cancel"});i.append(v),(0,l.Z)(i);const f=e.parentElement,w=document.createElement("h4");(0,s.$d)(w,"Login.QR.Title");const y=document.createElement("ol");y.classList.add("qr-description"),["Login.QR.Help1","Login.QR.Help2","Login.QR.Help3"].forEach((e=>{const t=document.createElement("li");t.append((0,s.ag)(e)),y.append(t)})),f.append(w,y,i),v.addEventListener("click",(()=>{Promise.all([n.e(458),n.e(665),n.e(53)]).then(n.bind(n,810)).then((e=>e.default.mount())),Z=!0}));const L=(yield Promise.all([n.e(630).then(n.t.bind(n,1915,23))]))[0].default;let Z=!1;o.Z.addEventListener("user_auth",(()=>{Z=!0,m=null}),{once:!0});const E={ignoreErrors:!0};let b;const P=i=>g(void 0,void 0,void 0,(function*(){try{let a=yield o.Z.managers.apiManager.invokeApi("auth.exportLoginToken",{api_id:r.Z.id,api_hash:r.Z.hash,except_ids:[]},{ignoreErrors:!0});if("auth.loginTokenMigrateTo"===a._&&(E.dcId||(E.dcId=a.dc_id,o.Z.managers.apiManager.setBaseDcId(a.dc_id)),a=yield o.Z.managers.apiManager.invokeApi("auth.importLoginToken",{token:a.token},E)),"auth.loginTokenSuccess"===a._){const e=a.authorization;return o.Z.managers.apiManager.setUser(e.user),n.e(781).then(n.bind(n,5436)).then((e=>e.default.mount())),!0}if(!b||!(0,u.Z)(b,a.token)){b=a.token;const n="tg://login?token="+function(e){let t,n="";for(let i=e.length,r=0,a=0;a<i;++a)t=a%3,r|=e[a]<<(16>>>t&24),2!==t&&i-a!=1||(n+=String.fromCharCode(p(r>>>18&63),p(r>>>12&63),p(r>>>6&63),p(63&r)),r=0);return n.replace(/A(?=A$|$)/g,"=")}(a.token).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=+$/,""),i=window.getComputedStyle(document.documentElement),r=i.getPropertyValue("--surface-color").trim(),s=i.getPropertyValue("--primary-text-color").trim(),o=i.getPropertyValue("--primary-color").trim(),d=yield fetch("assets/img/logo_padded.svg").then((e=>e.text())).then((e=>{e=e.replace(/(fill:).+?(;)/,`$1${o}$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)}))})),l=new L({width:240*window.devicePixelRatio,height:240*window.devicePixelRatio,data:n,image:d,dotsOptions:{color:s,type:"rounded"},cornersSquareOptions:{type:"extra-rounded"},imageOptions:{imageSize:1,margin:0},backgroundOptions:{color:r},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(i){const e=Date.now()/1e3,t=a.expires-e-(yield o.Z.managers.timeManager.getServerTimeOffset());yield(0,c.Z)(t>3?3e3:1e3*t|0)}}catch(e){return"SESSION_PASSWORD_NEEDED"===e.type?(console.warn("pageSignQR: SESSION_PASSWORD_NEEDED"),e.handled=!0,Promise.all([n.e(458),n.e(774)]).then(n.bind(n,9437)).then((e=>e.default.mount())),Z=!0,m=null):(console.error("pageSignQR: default error:",e),Z=!0),!0}return!1}));return()=>g(void 0,void 0,void 0,(function*(){for(Z=!1;!Z&&!(yield P(!0)););}))}))),m.then((e=>{e()})),o.Z.managers.appStateManager.pushToState("authState",{_:"authStateSignQr"})})),v=h}}]);
//# sourceMappingURL=709.77e1421caf56d9ff127a.chunk.js.map