tweb/public/18.33a13d3129fb705afcd7.chunk.js
Eduard Kuzmenko 10b7307141 Build
2022-01-25 10:36:42 +04:00

2 lines
16 KiB
JavaScript

(this.webpackJsonp=this.webpackJsonp||[]).push([[18],{102:function(e,t,n){"use strict";n.d(t,"a",(function(){return p}));var i=n(5),o=n(30),s=n(9),r=n(16),a=n(33),c=n(15),d=n(34),l=n(35);let u,h=!1;function p(e){h||(u||(u=a.a.getConfig().then(e=>e.suggested_lang_code!==r.default.lastRequestedLangCode?Promise.all([e,r.default.getStrings(e.suggested_lang_code,["Login.ContinueOnLanguage"]),r.default.getCacheLangPack()]):[]))).then(([t,n])=>{if(!t)return;const a=[];n.forEach(e=>{const t=r.default.strings.get(e.key);t&&(a.push(t),r.default.strings.set(e.key,e))});const u=Object(d.a)("btn-primary btn-secondary btn-primary-transparent primary",{text:"Login.ContinueOnLanguage"});u.lastElementChild.classList.remove("i18n"),Object(s.a)().then(()=>{window.requestAnimationFrame(()=>{e.append(u)})}),c.default.addEventListener("language_change",()=>{u.remove()},{once:!0}),a.forEach(e=>{r.default.strings.set(e.key,e)}),Object(o.b)(u,e=>{Object(i.a)(e),h=!0,u.disabled=!0,Object(l.f)(u),r.default.getLangPack(t.suggested_lang_code)})})}},108:function(e,t,n){"use strict";function i(e,t){return t?e.replace(/\+/g,"-").replace(/\//g,"_").replace(/\=+$/,""):e.replace(/-/g,"+").replace(/_/g,"/")}n.d(t,"a",(function(){return i}))},18:function(e,t,n){"use strict";n.r(t),n.d(t,"ripple",(function(){return d}));var i=n(6),o=n(66),s=n(1),r=n(15),a=n(72);let c=0;function d(e,t=(()=>Promise.resolve()),n=null,d=!1,l=e){if(e.querySelector(".c-ripple"))return;e.classList.add("rp");let u=document.createElement("div");u.classList.add("c-ripple");let h;e.classList.contains("rp-square")&&u.classList.add("is-square"),e[d?"prepend":"append"](u);const p=(e,i)=>{const r=Date.now(),a=document.createElement("div"),d=c++,l=1e3*+window.getComputedStyle(u).getPropertyValue("--ripple-duration").replace("s","");h=()=>{let e=Date.now()-r;const t=()=>{o.a.mutate(()=>{a.remove()}),n&&n(d)};if(e<l){let n=Math.max(l-e,l/2);setTimeout(()=>a.classList.add("hiding"),Math.max(n-l/2,0)),setTimeout(t,n)}else a.classList.add("hiding"),setTimeout(t,l/2);s.IS_TOUCH_SUPPORTED||window.removeEventListener("contextmenu",h),h=null,f=!1},t&&t(d),window.requestAnimationFrame(()=>{const t=u.getBoundingClientRect();a.classList.add("c-ripple__circle");const n=e-t.left,o=i-t.top,s=Math.sqrt(Math.pow(Math.abs(o-t.height/2)+t.height/2,2)+Math.pow(Math.abs(n-t.width/2)+t.width/2,2)),r=n-s/2,c=o-s/2;a.style.width=a.style.height=s+"px",a.style.left=r+"px",a.style.top=c+"px",u.append(a)})},m=t=>t.target!==e&&(["BUTTON","A"].includes(t.target.tagName)||Object(i.a)(t.target,"c-ripple")!==u)&&(l===e||!Object(a.a)(t.target,l));let f=!1;if(s.IS_TOUCH_SUPPORTED){let e=()=>{h&&h()};l.addEventListener("touchstart",t=>{if(!r.default.settings.animationsEnabled)return;if(t.touches.length>1||f||m(t))return;f=!0;let{clientX:n,clientY:i}=t.touches[0];p(n,i),l.addEventListener("touchend",e,{once:!0}),window.addEventListener("touchmove",t=>{t.cancelBubble=!0,t.stopPropagation(),e(),l.removeEventListener("touchend",e)},{once:!0})},{passive:!0})}else l.addEventListener("mousedown",e=>{if(![0,2].includes(e.button))return;if(!r.default.settings.animationsEnabled)return;if("0"===l.dataset.ripple||m(e))return;if(f)return void(f=!1);let{clientX:t,clientY:n}=e;p(t,n),window.addEventListener("mouseup",h,{once:!0,passive:!0}),window.addEventListener("contextmenu",h,{once:!0,passive:!0})},{passive:!0})}},22:function(e,t,n){"use strict";n.r(t);var i=n(33),o=n(69),s=n(78),r=n(56),a=n(7),c=n(34),d=n(16),l=n(17),u=n(15),h=n(35),p=n(102),m=n(81),f=n(108),g=function(e,t,n,i){return new(n||(n=Promise))((function(o,s){function r(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,a)}c((i=i.apply(e,t||[])).next())}))};let v;const w=new o.a("page-signQR",!0,()=>v,()=>{v||(v=g(void 0,void 0,void 0,(function*(){const e=w.pageEl.querySelector(".auth-image");let t=Object(h.f)(e,!0);const o=document.createElement("div");o.classList.add("input-wrapper");const l=Object(c.a)("btn-primary btn-secondary btn-primary-transparent primary",{text:"Login.QR.Cancel"});o.append(l),Object(p.a)(o);const b=e.parentElement,y=document.createElement("h4");Object(d._i18n)(y,"Login.QR.Title");const E=document.createElement("ol");E.classList.add("qr-description"),["Login.QR.Help1","Login.QR.Help2","Login.QR.Help3"].forEach(e=>{const t=document.createElement("li");t.append(Object(d.i18n)(e)),E.append(t)}),b.append(y,E,o),l.addEventListener("click",()=>{Promise.all([n.e(3),n.e(20)]).then(n.bind(null,20)).then(e=>e.default.mount()),O=!0});const L=(yield Promise.all([n.e(11).then(n.t.bind(null,144,7))]))[0].default;let O=!1;u.default.addEventListener("user_auth",()=>{O=!0,v=null},{once:!0});let S,_={ignoreErrors:!0};const T=o=>g(void 0,void 0,void 0,(function*(){try{let c=yield i.a.invokeApi("auth.exportLoginToken",{api_id:a.a.id,api_hash:a.a.hash,except_ids:[]},{ignoreErrors:!0});if("auth.loginTokenMigrateTo"===c._&&(_.dcId||(_.dcId=c.dc_id,i.a.setBaseDcId(c.dc_id)),c=yield i.a.invokeApi("auth.importLoginToken",{token:c.token},_)),"auth.loginTokenSuccess"===c._){const e=c.authorization;return i.a.setUser(e.user),n.e(4).then(n.bind(null,19)).then(e=>e.default.mount()),!0}if(!S||!Object(r.b)(S,c.token)){S=c.token;let n=Object(r.e)(c.token),i="tg://login?token="+Object(f.a)(n,!0);const o=window.getComputedStyle(document.documentElement),s=o.getPropertyValue("--surface-color").trim(),a=o.getPropertyValue("--primary-text-color").trim(),d=o.getPropertyValue("--primary-color").trim(),l=yield fetch("assets/img/logo_padded.svg").then(e=>e.text()).then(e=>{e=e.replace(/(fill:).+?(;)/,`$1${d}$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)})}),u=new L({width:240*window.devicePixelRatio,height:240*window.devicePixelRatio,data:i,image:l,dotsOptions:{color:a,type:"rounded"},cornersSquareOptions:{type:"extra-rounded"},imageOptions:{imageSize:1,margin:0},backgroundOptions:{color:s},qrOptions:{errorCorrectionLevel:"L"}});let h;u.append(e),e.lastChild.classList.add("qr-canvas"),h=u._drawingPromise?u._drawingPromise:Promise.race([Object(m.a)(1e3),new Promise(e=>{u._canvas._image.addEventListener("load",()=>{window.requestAnimationFrame(()=>e())},{once:!0})})]),yield h.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(o){let e=Date.now()/1e3,t=c.expires-e-s.a.serverTimeOffset;yield Object(m.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(17).then(n.bind(null,21)).then(e=>e.default.mount()),O=!0,v=null;break;default:console.error("pageSignQR: default error:",e),O=!0}return!0}return!1}));return()=>g(void 0,void 0,void 0,(function*(){for(O=!1;!O&&!(yield T(!0)););}))}))),v.then(e=>{e()}),l.default.pushToState("authState",{_:"authStateSignQr"})});t.default=w},30:function(e,t,n){"use strict";n.d(t,"a",(function(){return s})),n.d(t,"b",(function(){return r})),n.d(t,"c",(function(){return a})),n.d(t,"d",(function(){return c}));var i=n(1),o=n(57);const s=i.IS_TOUCH_SUPPORTED?"mousedown":"click";function r(e,t,n={}){const i=n.listenerSetter?n.listenerSetter.add(e):e.addEventListener.bind(e);n.touchMouseDown=!0,i(s,t,n)}function a(e,t,n){e.removeEventListener(s,t,n)}function c(e){Object(o.a)(e,s)}},34:function(e,t,n){"use strict";var i=n(16),o=n(18);t.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"),Object(o.ripple)(n)),t.onlyMobile&&n.classList.add("only-handhelds"),t.disabled&&n.setAttribute("disabled","true"),t.text&&n.append(Object(i.i18n)(t.text)),n}},35:function(e,t,n){"use strict";n.d(t,"f",(function(){return u})),n.d(t,"g",(function(){return h})),n.d(t,"c",(function(){return f})),n.d(t,"d",(function(){return b})),n.d(t,"e",(function(){return y})),n.d(t,"b",(function(){return O})),n.d(t,"a",(function(){return S}));var i=n(29),o=n(5),s=n(30),r=n(38),a=n(1),c=n(0),d=n(15),l=n(49);function u(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 h(e,t="check"){return e.classList.remove("tgico-"+t),e.disabled=!0,u(e),()=>{e.innerHTML="",e.classList.add("tgico-"+t),e.removeAttribute("disabled")}}i.a.putPreloader=u;let p=e=>{let t=g.getBoundingClientRect(),{clientX:n,clientY:i}=e,o=n>=t.right?n-t.right:t.left-n,s=i>=t.bottom?i-t.bottom:t.top-i;(o>=100||s>=100)&&f()};const m=e=>{f()},f=()=>{g&&(g.classList.remove("active"),g.parentElement.classList.remove("menu-open"),w&&w.remove(),g=null,d.default.dispatchEvent("context_menu_toggle",!1)),v&&(v(),v=null),a.IS_TOUCH_SUPPORTED||(window.removeEventListener("mousemove",p),window.removeEventListener("contextmenu",m)),document.removeEventListener(s.a,m),c.IS_MOBILE_SAFARI||l.a.removeByType("menu")};window.addEventListener("resize",()=>{g&&f()});let g=null,v=null,w=null;function b(e,t){f(),c.IS_MOBILE_SAFARI||l.a.pushItem({type:"menu",onPop:e=>{f()}}),g=e,g.classList.add("active"),g.parentElement.classList.add("menu-open"),w||(w=document.createElement("div"),w.classList.add("btn-menu-overlay"),w.addEventListener(s.a,e=>{Object(o.a)(e),m()})),g.parentElement.insertBefore(w,g),v=t,a.IS_TOUCH_SUPPORTED||(window.addEventListener("mousemove",p),window.addEventListener("contextmenu",m,{once:!0})),document.addEventListener(s.a,m),d.default.dispatchEvent("context_menu_toggle",!0)}function y({pageX:e,pageY:t},n,i){let{scrollWidth:o,scrollHeight:s}=n;const a=document.body.getBoundingClientRect(),c=a.width,d=a.height;i=r.b.isMobile?"right":"left";let l="top";const u={x:{left:e,right:e-o},intermediateX:"right"===i?8:c-o-8,y:{top:t,bottom:t-s},intermediateY:t<d/2?8:d-s-8},h={left:u.x.left+o+8<=c,right:u.x.right>=8},p={top:u.y.top+s+8<=d,bottom:u.y.bottom-8>=8};{let e;e=h[i]?u.x[i]:(i="center",u.intermediateX),n.style.left=e+"px"}{let e;e=p[l]?u.y[l]:(l="center",u.intermediateY),n.style.top=e+"px"}n.className=n.className.replace(/(top|center|bottom)-(left|center|right)/g,""),n.classList.add(("center"===l?l:"bottom")+"-"+("center"===i?i:"left"===i?"right":"left"))}let E=!1,L=0;function O(){L&&clearTimeout(L),L=window.setTimeout(()=>{L=0,E=!1},400),E=!0}function S(e,t,n){const i=n?n.add(e):e.addEventListener.bind(e),s=n?n.removeManual.bind(n,e):e.removeEventListener.bind(e);if(c.IS_APPLE&&a.IS_TOUCH_SUPPORTED){let n;const r={capture:!0},a=()=>{clearTimeout(n),s("touchmove",a,r),s("touchend",a,r),s("touchcancel",a,r)};i("touchstart",s=>{s.touches.length>1?a():(i("touchmove",a,r),i("touchend",a,r),i("touchcancel",a,r),n=window.setTimeout(()=>{E?a():(t(s.touches[0]),a(),g&&e.addEventListener("touchend",o.a,{once:!0}))},400))})}else i("contextmenu",a.IS_TOUCH_SUPPORTED?n=>{t(n),g&&e.addEventListener("touchend",o.a,{once:!0})}:t)}},49:function(e,t,n){"use strict";var i=n(29),o=n(0),s=n(37),r=n(8),a=n(5),c=n(39),d=n(82);const l=new class{constructor(){this.navigations=[],this.id=Date.now(),this.manual=!1,this.log=Object(s.b)("NC"),this.debug=!0,this.currentHash=window.location.hash;let e=!1;if(window.addEventListener("popstate",t=>{if(this.debug&&this.log("popstate",t,e),window.location.hash!==this.currentHash)return this.onHashChange&&this.onHashChange(),void this.replaceState();this.currentHash=window.location.hash;if(t.state!==this.id)return void this.pushState();const n=this.navigations.pop();n?(this.manual=!e,this.handleItem(n)):this.pushState()}),window.addEventListener("keydown",e=>{const t=this.navigations[this.navigations.length-1];t&&("Escape"!==e.key||t.onEscape&&!t.onEscape()||(Object(a.a)(e),this.back(t.type)))},{capture:!0,passive:!1}),o.IS_MOBILE_SAFARI){const t={passive:!0};window.addEventListener("touchstart",t=>{t.touches.length>1||(this.debug&&this.log("touchstart"),Object(d.a)(t)&&(e=!0,window.addEventListener("touchend",()=>{setTimeout(()=>{e=!1},100)},{passive:!0,once:!0})))},t)}history.scrollRestoration="manual",this.pushState()}handleItem(e){const t=e.onPop(!!this.manual&&void 0);this.debug&&this.log("popstate, navigation:",e,this.navigations),!1===t?this.pushItem(e):e.noBlurOnPop||Object(r.a)(),this.manual=!1}findItemByType(e){for(let t=this.navigations.length-1;t>=0;--t){const n=this.navigations[t];if(n.type===e)return{item:n,index:t}}}back(e){if(e){const t=this.findItemByType(e);if(t)return void this.backByItem(t.item,t.index)}history.back()}backByItem(e,t=this.navigations.indexOf(e)){this.manual=!0,this.navigations.splice(t,1),this.handleItem(e)}pushItem(e){this.navigations.push(e),this.debug&&this.log("pushstate",e,this.navigations),e.noHistory||this.pushState()}pushState(){this.manual=!1,history.pushState(this.id,"")}replaceState(){history.replaceState(this.id,"",location.origin+location.pathname)}removeItem(e){e&&Object(c.e)(this.navigations,e)}removeByType(e,t=!1){for(let n=this.navigations.length-1;n>=0;--n){if(this.navigations[n].type===e&&(this.navigations.splice(n,1),t))break}}};i.a.appNavigationController=l,t.a=l},56:function(e,t,n){"use strict";function i(e){const t=e.length,n=new Array(t);for(let i=0;i<t;++i)n[i]=(e[i]<16?"0":"")+(e[i]||0).toString(16);return n.join("")}function o(e){const t=e.length,n=new Uint8Array(Math.ceil(t/2));let i=0;t%2&&(n[i++]=parseInt(e.charAt(0),16));for(let o=i;o<t;o+=2)n[i++]=parseInt(e.substr(o,2),16);return n}function s(e){let t,n="";for(let i=e.length,o=0,s=0;s<i;++s)t=s%3,o|=e[s]<<(16>>>t&24),2!==t&&i-s!=1||(n+=String.fromCharCode(r(o>>>18&63),r(o>>>12&63),r(o>>>6&63),r(63&o)),o=0);return n.replace(/A(?=A$|$)/g,"=")}function r(e){return e<26?e+65:e<52?e+71:e<62?e-4:62===e?43:63===e?47:65}function a(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}function c(e,t){const n=e.length,i=new Uint8Array(n);for(let o=0;o<n;++o)i[o]=e[o]^t[o];return i}function d(e){return e instanceof Uint8Array?e:"string"==typeof e?(new TextEncoder).encode(e):new Uint8Array(e)}function l(...e){const t=e.reduce((e,t)=>e+(t.byteLength||t.length),0),n=new Uint8Array(t);let i=0;return e.forEach(e=>{n.set(e instanceof ArrayBuffer?new Uint8Array(e):e,i),i+=e.byteLength||e.length}),n}function u(e){const t=new Uint8Array(e.byteLength);for(let n=0,i=4*e.length;n<i;++n)t[n]=e[n>>>2]>>>24-n%4*8&255;return t}function h(e){const t=d(e),n=[];for(let e=0,i=t.length;e<i;++e)n[e>>>2]|=t[e]<<24-e%4*8;return new Uint32Array(n)}n.d(t,"f",(function(){return i})),n.d(t,"c",(function(){return o})),n.d(t,"e",(function(){return s})),n.d(t,"b",(function(){return a})),n.d(t,"h",(function(){return c})),n.d(t,"i",(function(){return d})),n.d(t,"a",(function(){return l})),n.d(t,"d",(function(){return u})),n.d(t,"g",(function(){return h}))},57:function(e,t,n){"use strict";function i(e,t){const n=new Event(t,{bubbles:!0,cancelable:!0});e.dispatchEvent(n)}n.d(t,"a",(function(){return i}))},66:function(e,t,n){"use strict";var i=n(44),o=n(45),s=n(29),r=n(68);const a=new class{constructor(){this.promises={},this.raf=i.b.bind(null),this.scheduled=!1}do(e,t){let n=this.promises[e];return n||(this.scheduleFlush(),n=this.promises[e]=Object(o.a)()),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=Object(r.a)(e)?this.mutate():Promise.resolve();return void 0!==t&&n.then(()=>t()),n}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={}}))}};s.a&&(s.a.sequentialDom=a),t.a=a},78:function(e,t,n){"use strict";var i=n(29),o=n(62),s=n(33);const r=new class{constructor(){this.serverTimeOffset=0,o.a.get("server_time_offset").then(e=>{e&&(this.serverTimeOffset=e)}),s.a.addTaskListener("applyServerTimeOffset",e=>{this.serverTimeOffset=e.payload})}};i.a&&(i.a.serverTimeManager=r),t.a=r},82:function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var i=n(0);function o(e){return i.IS_MOBILE_SAFARI&&e instanceof TouchEvent&&e.touches[0].clientX<30}}}]);
//# sourceMappingURL=18.33a13d3129fb705afcd7.chunk.js.map