tweb/public/18.c4f2c09f20164ea40c0d.chunk.js
morethanwords 3c4c960531 Build
2021-09-24 19:42:41 +04:00

2 lines
16 KiB
JavaScript

(this.webpackJsonp=this.webpackJsonp||[]).push([[18],{17:function(e,t,n){"use strict";n.r(t),n.d(t,"ripple",(function(){return c}));var i=n(5),o=n(52),s=n(1),a=n(15);let r=0;function c(e,t=(()=>Promise.resolve()),n=null,c=!1){if(e.querySelector(".c-ripple"))return;e.classList.add("rp");let d=document.createElement("div");d.classList.add("c-ripple");let l;e.classList.contains("rp-square")&&d.classList.add("is-square"),e[c?"prepend":"append"](d);const u=(e,i)=>{const a=Date.now(),c=document.createElement("div"),u=r++,h=1e3*+window.getComputedStyle(d).getPropertyValue("--ripple-duration").replace("s","");l=()=>{let e=Date.now()-a;const t=()=>{o.a.mutate(()=>{c.remove()}),n&&n(u)};if(e<h){let n=Math.max(h-e,h/2);setTimeout(()=>c.classList.add("hiding"),Math.max(n-h/2,0)),setTimeout(t,n)}else c.classList.add("hiding"),setTimeout(t,h/2);s.isTouchSupported||window.removeEventListener("contextmenu",l),l=null,p=!1},t&&t(u),window.requestAnimationFrame(()=>{const t=d.getBoundingClientRect();c.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)),a=n-s/2,r=o-s/2;c.style.width=c.style.height=s+"px",c.style.left=a+"px",c.style.top=r+"px",d.append(c)})},h=t=>t.target!==e&&(["BUTTON","A"].includes(t.target.tagName)||Object(i.a)(t.target,"c-ripple")!==d);let p=!1;if(s.isTouchSupported){let t=()=>{l&&l()};e.addEventListener("touchstart",n=>{if(!a.default.settings.animationsEnabled)return;if(n.touches.length>1||p||h(n))return;p=!0;let{clientX:i,clientY:o}=n.touches[0];u(i,o),e.addEventListener("touchend",t,{once:!0}),window.addEventListener("touchmove",n=>{n.cancelBubble=!0,n.stopPropagation(),t(),e.removeEventListener("touchend",t)},{once:!0})},{passive:!0})}else e.addEventListener("mousedown",t=>{if(![0,2].includes(t.button))return;if(!a.default.settings.animationsEnabled)return;if("0"===e.dataset.ripple||h(t))return;if(p)return void(p=!1);let{clientX:n,clientY:i}=t;u(n,i),window.addEventListener("mouseup",l,{once:!0,passive:!0}),window.addEventListener("contextmenu",l,{once:!0,passive:!0})},{passive:!0})}},21:function(e,t,n){"use strict";n.r(t);var i=n(30),o=n(57),s=n(59),a=n(71),r=n(7),c=n(31),d=n(14),l=n(16),u=n(15),h=n(33),p=n(88),m=n(76),g=function(e,t,n,i){return new(n||(n=Promise))((function(o,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function r(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(a,r)}c((i=i.apply(e,t||[])).next())}))};let f;const v=new o.a("page-signQR",!0,()=>f,()=>{f||(f=g(void 0,void 0,void 0,(function*(){const e=v.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 w=e.parentElement,b=document.createElement("h4");Object(d._i18n)(b,"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(Object(d.i18n)(e)),y.append(t)}),w.append(b,y,o),l.addEventListener("click",()=>{Promise.all([n.e(4),n.e(30)]).then(n.bind(null,19)).then(e=>e.default.mount()),E=!0});const L=(yield Promise.all([n.e(11).then(n.t.bind(null,125,7))]))[0].default;let E=!1;u.default.addEventListener("user_auth",()=>{E=!0,f=null},{once:!0});let S,O={ignoreErrors:!0};const T=o=>g(void 0,void 0,void 0,(function*(){try{let c=yield i.a.invokeApi("auth.exportLoginToken",{api_id:r.a.id,api_hash:r.a.hash,except_ids:[]},{ignoreErrors:!0});if("auth.loginTokenMigrateTo"===c._&&(O.dcId||(O.dcId=c.dc_id,i.a.setBaseDcId(c.dc_id)),c=yield i.a.invokeApi("auth.importLoginToken",{token:c.token},O)),"auth.loginTokenSuccess"===c._){const e=c.authorization;return i.a.setUserAuth(e.user.id),n.e(5).then(n.bind(null,18)).then(e=>e.default.mount()),!0}if(!S||!Object(a.b)(S,c.token)){S=c.token;let n="tg://login?token="+Object(a.d)(c.token).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=+$/,"");const i=window.getComputedStyle(document.documentElement),o=i.getPropertyValue("--surface-color").trim(),s=i.getPropertyValue("--primary-text-color").trim(),r=i.getPropertyValue("--primary-color").trim(),d=yield fetch("assets/img/logo_padded.svg").then(e=>e.text()).then(e=>{e=e.replace(/(fill:).+?(;)/,`$1${r}$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:o},qrOptions:{errorCorrectionLevel:"L"}});let u;l.append(e),e.lastChild.classList.add("qr-canvas"),u=l._drawingPromise?l._drawingPromise:Promise.race([Object(m.a)(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(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,Promise.all([n.e(3),n.e(16)]).then(n.bind(null,20)).then(e=>e.default.mount()),E=!0,f=null;break;default:console.error("pageSignQR: default error:",e),E=!0}return!0}return!1}));return()=>g(void 0,void 0,void 0,(function*(){for(E=!1;!E&&!(yield T(!0)););}))}))),f.then(e=>{e()}),l.default.pushToState("authState",{_:"authStateSignQr"})});t.default=v},28:function(e,t,n){"use strict";n.d(t,"a",(function(){return s})),n.d(t,"b",(function(){return a})),n.d(t,"c",(function(){return r})),n.d(t,"d",(function(){return c}));var i=n(1),o=n(46);const s=i.isTouchSupported?"mousedown":"click";function a(e,t,n={}){const i=n.listenerSetter?n.listenerSetter.add(e):e.addEventListener.bind(e);n.touchMouseDown=!0,i(s,t,n)}function r(e,t,n){e.removeEventListener(s,t,n)}function c(e){Object(o.a)(e,s)}},31:function(e,t,n){"use strict";var i=n(14),o=n(17);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}},33: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 g})),n.d(t,"d",(function(){return b})),n.d(t,"e",(function(){return y})),n.d(t,"b",(function(){return S})),n.d(t,"a",(function(){return O}));var i=n(27),o=n(4),s=n(28),a=n(38),r=n(1),c=n(0),d=n(15),l=n(44);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=f.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)&&g()};const m=e=>{g()},g=()=>{f&&(f.classList.remove("active"),f.parentElement.classList.remove("menu-open"),w&&w.remove(),f=null,d.default.dispatchEvent("context_menu_toggle",!1)),v&&(v(),v=null),r.isTouchSupported||(window.removeEventListener("mousemove",p),window.removeEventListener("contextmenu",m)),document.removeEventListener(s.a,m),c.isMobileSafari||l.a.removeByType("menu")};window.addEventListener("resize",()=>{f&&g()});let f=null,v=null,w=null;function b(e,t){g(),c.isMobileSafari||l.a.pushItem({type:"menu",onPop:e=>{g()}}),f=e,f.classList.add("active"),f.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()})),f.parentElement.insertBefore(w,f),v=t,r.isTouchSupported||(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 r=document.body.getBoundingClientRect(),c=r.width,d=r.height;i=a.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 L=!1,E=0;function S(){E&&clearTimeout(E),E=window.setTimeout(()=>{E=0,L=!1},400),L=!0}function O(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.isApple&&r.isTouchSupported){let n;const a={capture:!0},r=()=>{clearTimeout(n),s("touchmove",r,a),s("touchend",r,a),s("touchcancel",r,a)};i("touchstart",s=>{s.touches.length>1?r():(i("touchmove",r,a),i("touchend",r,a),i("touchcancel",r,a),n=window.setTimeout(()=>{L?r():(t(s.touches[0]),r(),f&&e.addEventListener("touchend",o.a,{once:!0}))},400))})}else i("contextmenu",r.isTouchSupported?n=>{t(n),f&&e.addEventListener("touchend",o.a,{once:!0})}:t)}},44:function(e,t,n){"use strict";var i=n(27),o=n(0),s=n(40),a=n(36),r=n(6),c=n(4);const d=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(c.a)(e),this.back(t.type)))},{capture:!0,passive:!1}),o.isMobileSafari){const t={passive:!0};window.addEventListener("touchstart",n=>{if(n.touches.length>1)return;this.debug&&this.log("touchstart");const i=()=>{window.removeEventListener("touchend",r),window.removeEventListener("touchmove",s)};let o=!1;const s=e=>{this.debug&&this.log("touchmove"),e.touches.length>1?i():o=!0},r=t=>{this.debug&&this.log("touchend"),t.touches.length>1||!o||(e=!0,Object(a.a)().then(()=>{e=!1})),i()};window.addEventListener("touchend",r,t),window.addEventListener("touchmove",s,t)},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 this.manual=!0,this.navigations.splice(t.index,1),void this.handleItem(t.item)}history.back()}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){this.navigations.findAndSplice(t=>t===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=d,t.a=d},46: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}))},52:function(e,t,n){"use strict";var i=n(36),o=n(41),s=n(27),a=n(55);const r=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(a.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=r),t.a=r},59:function(e,t,n){"use strict";var i=n(27),o=n(56),s=n(30);const a=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=a),t.a=a},71:function(e,t,n){"use strict";function i(e){const t=new Array(e.length);for(let n=0;n<e.length;++n)t[n]=(e[n]<16?"0":"")+(e[n]||0).toString(16);return t.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(a(o>>>18&63),a(o>>>12&63),a(o>>>6&63),a(63&o)),o=0);return n.replace(/A(?=A$|$)/g,"=")}function a(e){return e<26?e+65:e<52?e+71:e<62?e-4:62===e?43:63===e?47:65}function r(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){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}n.d(t,"e",(function(){return i})),n.d(t,"c",(function(){return o})),n.d(t,"d",(function(){return s})),n.d(t,"b",(function(){return r})),n.d(t,"a",(function(){return c}))},88:function(e,t,n){"use strict";n.d(t,"a",(function(){return p}));var i=n(4),o=n(28),s=n(8),a=n(14),r=n(30),c=n(15),d=n(31),l=n(33);let u,h=!1;function p(e){h||(u||(u=r.a.getConfig().then(e=>e.suggested_lang_code!==a.default.lastRequestedLangCode?Promise.all([e,a.default.getStrings(e.suggested_lang_code,["Login.ContinueOnLanguage"]),a.default.getCacheLangPack()]):[]))).then(([t,n])=>{if(!t)return;const r=[];n.forEach(e=>{const t=a.default.strings.get(e.key);t&&(r.push(t),a.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}),r.forEach(e=>{a.default.strings.set(e.key,e)}),Object(o.b)(u,e=>{Object(i.a)(e),h=!0,u.disabled=!0,Object(l.f)(u),a.default.getLangPack(t.suggested_lang_code)})})}}}]);
//# sourceMappingURL=18.c4f2c09f20164ea40c0d.chunk.js.map