tweb/public/main.f2043db1df6d2dbc91cc.b...

2 lines
70 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(()=>{"use strict";var e,t,n,s,i,o={410:(e,t,n)=>{n.d(t,{GO:()=>r,Tj:()=>i,ZP:()=>a});var s=n(1267);const i=!1,o=i||s.Z.debug,r="undefined"!=typeof window?window:self,a=o},236:(e,t,n)=>{n.d(t,{t:()=>c,h:()=>d});var s=n(4762),i=n(144),o=n(4159);const r=o.Z.version,a=o.Z.build,c={_:"theme",access_hash:"",id:"",settings:[{_:"themeSettings",pFlags:{},base_theme:{_:"baseThemeClassic"},accent_color:3379436,message_colors:[5221966],wallpaper:{_:"wallPaper",pFlags:{default:!0,pattern:!0},access_hash:"",document:void 0,id:"",slug:"pattern",settings:{_:"wallPaperSettings",pFlags:{},intensity:50,background_color:14409147,second_background_color:7054727,third_background_color:14014605,fourth_background_color:8960132}}},{_:"themeSettings",pFlags:{},base_theme:{_:"baseThemeNight"},accent_color:8877281,message_colors:[8877281],wallpaper:{_:"wallPaper",pFlags:{default:!0,pattern:!0,dark:!0},access_hash:"",document:void 0,id:"",slug:"pattern",settings:{_:"wallPaperSettings",pFlags:{},intensity:-50,background_color:16696470,second_background_color:14511289,third_background_color:9842623,fourth_background_color:5200853}}}],slug:"",title:"",emoticon:"🏠",pFlags:{default:!0}},l=(e,t,n)=>Object.assign(Object.assign({},c),{name:e,settings:Object.assign(Object.assign({},c.settings.find((e=>e.base_theme._===t))),{highlightningColor:n})}),d={allDialogsLoaded:{},pinnedOrders:{},contactsListCachedTime:0,updates:{},filtersArr:[],maxSeenMsgId:0,stateCreatedTime:Date.now(),recentEmoji:[],recentCustomEmoji:[],topPeersCache:{},recentSearch:[],version:r,build:a,authState:{_:s.IS_MOBILE?"authStateSignIn":"authStateSignQr"},hiddenPinnedMessages:{},settings:{messagesTextSize:16,distanceUnit:"kilometers",sendShortcut:"enter",autoDownload:{photo:{contacts:!0,private:!0,groups:!0,channels:!0},video:{contacts:!0,private:!0,groups:!0,channels:!0},file:{contacts:!0,private:!0,groups:!0,channels:!0}},autoDownloadNew:{_:"autoDownloadSettings",file_size_max:3145728,pFlags:{video_preload_large:!0,audio_preload_next:!0},photo_size_max:1048576,video_size_max:15728640,video_upload_maxbitrate:100},stickers:{suggest:"all",dynamicPackOrder:!0,loop:!0},emoji:{suggest:!0,big:!0},themes:[l("day","baseThemeClassic","hsla(86.4, 43.846153%, 45.117647%, .4)"),l("night","baseThemeNight","hsla(299.142857, 44.166666%, 37.470588%, .4)")],theme:"system",notifications:{sound:!1},timeFormat:(new Date).toLocaleString().match(/\s(AM|PM)/)?"h12":"h23",liteMode:{all:!1,animations:!1,chat:!1,chat_background:!1,chat_spoilers:!1,effects:!1,effects_premiumstickers:!1,effects_reactions:!1,effects_emoji:!1,emoji:!1,emoji_messages:!1,emoji_panel:!1,gif:!1,stickers:!1,stickers_chat:!1,stickers_panel:!1,video:!1}},playbackParams:{volume:1,muted:!1,playbackRate:1,playbackRates:{voice:1,video:1,audio:1},loop:!1,round:!1},keepSigned:!0,chatContextMenuHintWasShown:!1,stateId:(0,i.d)(32),notifySettings:{}}},8189:(e,t,n)=>{n.d(t,{Z:()=>i});let s=!1;try{const e=document.createElement("canvas").getContext("webgl"),t=e.getExtension("WEBGL_debug_renderer_info"),n=t&&e.getParameter(t.UNMASKED_RENDERER_WEBGL)||"";(n.match(/Apple/)&&!n.match(/Apple GPU/)||-1===e.getSupportedExtensions().indexOf("WEBGL_compressed_texture_s3tc_srgb"))&&(s=!0)}catch(e){}const i=s},993:(e,t,n)=>{n.d(t,{Z:()=>s});const s=n(4089).Z},7328:(e,t,n)=>{let s;if(n.d(t,{Z:()=>i}),n(4762).IS_SAFARI)try{s=+navigator.userAgent.match(/Version\/(.+?) /)[1]>=14}catch(e){s=!1}else s=!0;const i=s},6663:(e,t,n)=>{n.d(t,{Z:()=>s});const s="filter"in(document.createElement("canvas").getContext("2d")||{})},9976:(e,t,n)=>{n.d(t,{Z:()=>s});const s=-1!==navigator.userAgent.search(/OS X|iPhone|iPad|iOS/i)},3731:(e,t,n)=>{var s;n.d(t,{Z:()=>i});const i=!!(null===(s=null===navigator||void 0===navigator?void 0:navigator.geolocation)||void 0===s?void 0:s.getCurrentPosition)&&!1},6818:(e,t,n)=>{n.d(t,{Z:()=>s});const s=n(4089).Z},1174:(e,t,n)=>{n.d(t,{Z:()=>o});var s=n(5269);const i=new Set(["image/jpeg","image/png","image/bmp"]);s.Z&&i.add("image/webp");const o=i},2341:(e,t,n)=>{n.d(t,{Z:()=>r});var s=n(1174),i=n(554);const o=[...s.Z].concat([...i.Z]),r=new Set(o)},9030:(e,t,n)=>{n.d(t,{Z:()=>i});var s=n(4762);const i=!!document.createElement("video").canPlayType("video/quicktime")||s.IS_SAFARI||s.IS_APPLE_MOBILE},5783:(e,t,n)=>{n.d(t,{Z:()=>i});const s=document.createElement("audio"),i=!(!s.canPlayType||!s.canPlayType("audio/ogg;").replace(/no/,""))},2365:(e,t,n)=>{n.d(t,{Z:()=>s});const s=!n(4762).IS_FIREFOX&&!1},2820:(e,t,n)=>{n.d(t,{Z:()=>s});const s=!!("getDisplayMedia"in((null===navigator||void 0===navigator?void 0:navigator.mediaDevices)||{}))},2045:(e,t,n)=>{n.d(t,{Z:()=>i});var s=n(1267);const i="undefined"!=typeof SharedWorker&&!s.Z.noSharedWorker},5432:(e,t,n)=>{n.d(t,{Z:()=>s});const s="ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch},4762:(e,t,n)=>{n.r(t),n.d(t,{IS_ANDROID:()=>r,IS_APPLE:()=>o,IS_APPLE_MOBILE:()=>c,IS_CHROMIUM:()=>a,IS_FIREFOX:()=>d,IS_MOBILE:()=>u,IS_MOBILE_SAFARI:()=>h,IS_SAFARI:()=>l,USER_AGENT:()=>i});var s=n(6761);const i=navigator?navigator.userAgent:null,o=-1!==navigator.userAgent.search(/OS X|iPhone|iPad|iOS/i),r=-1!==navigator.userAgent.toLowerCase().indexOf("android"),a=/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor),c=(/iPad|iPhone|iPod/.test(navigator.platform)||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1)&&!s.Z.MSStream,l=!!("safari"in s.Z)||!(!i||!(/\b(iPad|iPhone|iPod)\b/.test(i)||i.match("Safari")&&!i.match("Chrome"))),d=navigator.userAgent.toLowerCase().indexOf("firefox")>-1,h=l&&c,u=(void 0===navigator.maxTouchPoints||navigator.maxTouchPoints>0)&&-1!=navigator.userAgent.search(/iOS|iPhone OS|Android|BlackBerry|BB10|Series ?[64]0|J2ME|MIDP|opera mini|opera mobi|mobi.+Gecko|Windows Phone/i)},2131:(e,t,n)=>{n.d(t,{Z:()=>s});const s=!!(null===navigator||void 0===navigator?void 0:navigator.vibrate)},554:(e,t,n)=>{n.d(t,{Z:()=>o});var s=n(9030);const i=new Set(["image/gif","video/mp4","video/webm"]);s.Z&&i.add("video/quicktime");const o=i},393:(e,t,n)=>{n.d(t,{Z:()=>i});var s=n(4762);const i=!!document.createElement("video").canPlayType("video/webm")&&!s.IS_SAFARI&&!s.IS_APPLE_MOBILE},5269:(e,t,n)=>{n.d(t,{Z:()=>s});const s=document.createElement("canvas").toDataURL("image/webp").startsWith("data:image/webp")},4089:(e,t,n)=>{n.d(t,{Z:()=>i});var s=n(4762);const i=!("undefined"==typeof RTCPeerConnection||s.IS_FIREFOX)},2064:(e,t,n)=>{n.d(t,{Dk:()=>g,EM:()=>w,K5:()=>u,Pi:()=>c,WE:()=>o,Y6:()=>a,cw:()=>d,dI:()=>r,e9:()=>f,ix:()=>p,oo:()=>l,py:()=>i,t1:()=>h,tB:()=>y,uY:()=>v});var s=n(3228);function i(e,t,n){e/=255,t/=255,n/=255;const s=Math.max(e,t,n),i=s-Math.min(e,t,n),o=i&&(s===e?(t-n)/i:s==t?2+(n-e)/i:4+(e-t)/i);return[60*(o<0?o+6:o),s&&i/s,s]}function o(e,t,n){const s=(s,i=(s+e/60)%6)=>Math.round(255*(n-n*t*Math.max(Math.min(i,4-i,1),0)));return[s(5),s(3),s(1)]}function r(e,t,n,s=1){e/=255,t/=255,n/=255;const i=Math.max(e,t,n),o=Math.min(e,t,n);let r,a;const c=(i+o)/2;if(i===o)r=a=0;else{const s=i-o;switch(a=c>.5?s/(2-i-o):s/(i+o),i){case e:r=(t-n)/s+(t<n?6:0);break;case t:r=(n-e)/s+2;break;case n:r=(e-t)/s+4}r/=6}return{h:360*r,s:100*a,l:100*c,a:s}}function a(e,t,n,s){let i,o,r;if(e/=360,n/=100,0==(t/=100))i=o=r=n;else{const s=function(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e},a=n<.5?n*(1+t):n+t-n*t,c=2*n-a;i=s(c,a,e+1/3),o=s(c,a,e),r=s(c,a,e-1/3)}return[i,o,r,s].map((e=>Math.round(255*e)))}function c(e){const t=[],n="#"===e[0]?1:0;if(e.length===5+n&&(e=(n?"#":"")+"0"+e.slice(n)),e.length===3+n)for(let s=n;s<e.length;++s)t.push(parseInt(e[s]+e[s],16));else if(e.length===4+n){for(let s=n;s<e.length-1;++s)t.push(parseInt(e[s]+e[s],16));t.push(parseInt(e[e.length-1],16))}else for(let s=n;s<e.length;s+=2)t.push(parseInt(e.slice(s,s+2),16));return t}function l(e){return c(e.slice(0,7))}function d(e){const t=c(e);return r(t[0],t[1],t[2],t[3])}function h(e){return"#"+e.map((e=>("0"+e.toString(16)).slice(-2))).join("")}function u(e){return function(e){return h(function(e){const t=e.slice(5,-1).split(", "),n=+t.pop(),s=t.map((e=>e.endsWith("%")?+e.slice(0,-1):+e));return a(s[0],s[1],s[2],n)}(e))}(e).slice(0,-2)}function g(e,t,n){const s=new Array(3);for(let i=0;i<3;++i){const o=e[i],r=t[i];s[i]=Math.floor(r+(o-r)*n)}return s}function m(e){return(.2126*e[0]+.7152*e[1]+.0722*e[2])/255}function p(e,t){return e.map(((e,n)=>Math.round((e+t[n])/2)))}function f(e,t,n){const s=i(...t),r=i(...n),a=Math.min(1.5*s[1]/e[1],1);return s[0]=Math.min(360,r[0]-s[0]+e[0]),s[1]=Math.min(1,r[1]*e[1]/s[1]),s[2]=Math.min(1,(r[2]/s[2]+a-1)*e[2]/a),s[2]<.3?n:o(...s)}function v(e,t,n,r){const a=i(...n);if(Math.min(Math.abs(a[0]-e[0]),Math.abs(a[0]-e[0]-360))>30)return n;const c=Math.min(1.5*a[1]/e[1],1);a[0]=Math.min(360,a[0]+t[0]-e[0]),a[1]=Math.min(1,a[1]*t[1]/e[1]),a[2]=Math.min(1,a[2]*(1-c+c*t[2]/e[2]));let l=o(...a);const d=m(n),h=m(l);if(r?d>h:d<h){const e=.6;l=function(e,t){return e.map((e=>(0,s.Z)(Math.round(e*t),0,255)))}(l,(1-e)*d/h+e)}return l}function b(e){const t=(e<0?16777215+e:e).toString(16);return"#"+(t.length>=6?t:"0".repeat(6-t.length)+t)}function y(e){return l(b(e))}function w(e){return e.settings?[e.settings.background_color,e.settings.second_background_color,e.settings.third_background_color,e.settings.fourth_background_color].filter(Boolean).map(b).join(","):""}},6009:(e,t,n)=>{function s(e,t){e=e.split(" ",1)[0],t=t.split(" ",1)[0];const n=e.split("."),s=t.split(".");for(let e=0;e<n.length;++e){const t=+n[e],i=+s[e];if(t>i)return 1;if(t<i)return-1}return 0}n.d(t,{Z:()=>s})},8799:(e,t,n)=>{function s(){var e;return!!(null===(e=document.activeElement)||void 0===e?void 0:e.blur)&&(document.activeElement.blur(),!0)}n.d(t,{Z:()=>s})},3910:(e,t,n)=>{function s(e){if(e||(e=window.event),e){e=e.originalEvent||e;try{e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault(),e.returnValue=!1,e.cancelBubble=!0}catch(e){}}return!1}n.d(t,{Z:()=>s})},8497:(e,t,n)=>{function s(e,t){return e.closest("."+t)}n.d(t,{Z:()=>s})},5494:(e,t,n)=>{n.d(t,{Z:()=>i});var s=n(3035);function i(e){e.style.transform="translateY(-99999px)",e.focus(),(0,s.d1)().then((()=>{e.style.transform=""}))}},8090:(e,t,n)=>{n.d(t,{T:()=>a,Z:()=>c});var s=n(5432),i=n(4762),o=n(8497),r=n(5494);const a=i.IS_SAFARI&&i.IS_MOBILE&&s.Z;if(a){const e="clientY";let t=0;const n={capture:!0,passive:!1},s=n=>{const s=n.touches[0],i=(0,o.Z)(s.target,"scrollable-y");if(i){const o=s[e],r=t-o,a=i.scrollTop,c=i.scrollHeight,l=i.clientHeight,d=a?Math.round(a+i.clientHeight+r):a+r;(c===l||d>=c||d<=0)&&n.preventDefault()}else n.preventDefault()};let i=0;document.addEventListener("focusin",(o=>{!o.target.classList.contains("is-sticky-input-bugged")||o.timeStamp-i<50||((0,r.Z)(o.target),document.addEventListener("touchmove",s,n),document.addEventListener("touchstart",(n=>{if(n.touches.length>1)return;const s=n.touches[0];t=s[e]})))}),{passive:!0}),document.addEventListener("focusout",(e=>{document.removeEventListener("touchmove",s,n),i=e.timeStamp}),{passive:!0}),document.addEventListener("visibilitychange",(()=>{document.activeElement&&document.activeElement.classList.contains("is-sticky-input-bugged")&&document.activeElement.blur&&(0,r.Z)(document.activeElement)}),{passive:!0})}function c(e){a&&e.classList.add("is-sticky-input-bugged")}},6472:(e,t,n)=>{n.d(t,{B:()=>o,Z:()=>i});let s;function i(){window.addEventListener("beforeinstallprompt",(e=>{s=()=>{return t=this,n=void 0,o=function*(){e.prompt();const{outcome:t}=yield e.userChoice;"accepted"===t&&(s=void 0)},new((i=void 0)||(i=Promise))((function(e,s){function r(e){try{c(o.next(e))}catch(e){s(e)}}function a(e){try{c(o.throw(e))}catch(e){s(e)}}function c(t){var n;t.done?e(t.value):(n=t.value,n instanceof i?n:new i((function(e){e(n)}))).then(r,a)}c((o=o.apply(t,n||[])).next())}));var t,n,i,o}}))}function o(){return s}},4541:(e,t,n)=>{n.d(t,{Z:()=>c});var s=n(319),i=n(5418);const o=["b","б"],r={},a={text:"Roboto",icons:"tgico",monospace:"Roboto Mono"};function c(e={text:o,icons:void 0,monospace:o}){if(!("fonts"in document))return Promise.resolve();const t=[];for(const n in e){let s=e[n];"all"===s&&(s=o);const i=a[n],c="icons"===n?[500]:[400,500];for(const e of c){const n=(s||[void 0]).map((t=>{var n,s,o,a;const c=[e,"1rem",i].join(" ");return null!==(s=(o=null!==(n=r[c])&&void 0!==n?n:r[c]={})[a=t||""])&&void 0!==s?s:o[a]=document.fonts.load(c,t)}));t.push(...n)}}return Promise.race([Promise.all(t).catch(s.Z),(0,i.Z)(1e3)])}},130:(e,t,n)=>{function s(e,t){i(e),void 0===t?e.replaceChildren():"string"==typeof t?t?e.textContent=t:e.replaceChildren():e.replaceChildren(t)}function i(e){e.setAttribute("dir","auto")}n.d(t,{Z:()=>s,m:()=>i})},2586:(e,t,n)=>{n.d(t,{Z:()=>a});var s=n(5432),i=n(3241);const o=s.Z?"touchstart":"mousemove";class r extends i.Z{constructor(){super(),this._isIdle=!0,this.focusPromise=Promise.resolve(),this.focusResolve=()=>{},window.addEventListener("blur",(()=>{this.isIdle=!0,window.addEventListener("focus",(()=>{this.isIdle=!1}),{once:!0})})),window.addEventListener(o,(()=>{this.isIdle=!1}),{once:!0,passive:!0}),this.addEventListener("change",(e=>{e?this.focusPromise=new Promise((e=>{this.focusResolve=e})):this.focusResolve()}))}getFocusPromise(){return this.focusPromise}get isIdle(){return this._isIdle}set isIdle(e){this._isIdle!==e&&(this._isIdle=e,this.dispatchEvent("change",e))}}const a=new r},3228:(e,t,n)=>{function s(e,t,n){return Math.min(n,Math.max(t,e))}n.d(t,{Z:()=>s})},3815:(e,t,n)=>{n.d(t,{Z:()=>o});var s=n(3241);class i extends s.Z{constructor(){super(...arguments),this.overlaysActive=0}get isOverlayActive(){return this.overlaysActive>0}set isOverlayActive(e){this.overlaysActive+=e?1:-1,this.dispatchEvent("change",this.isOverlayActive)}}const o=new i},3035:(e,t,n)=>{let s;function i(e){s?s.push(e):(s=[e],requestAnimationFrame((()=>{const e=s;s=void 0,e.forEach((e=>e()))})))}n.d(t,{AD:()=>l,T2:()=>i,TR:()=>c,d1:()=>d});let o,r,a=!1;function c(e){o?a?e():o.push(e):(o=[e],requestAnimationFrame((()=>{a=!0;for(let e=0;e<o.length;++e)o[e]();o=void 0,a=!1})))}function l(){return r||(r=new Promise((e=>i((()=>e())))),r.then((()=>{r=void 0})),r)}function d(){return new Promise((e=>{i((()=>{i(e)}))}))}},764:(e,t,n)=>{function s(e,t=e.split("?")){return i(null==t?void 0:t[1])}function i(e){const t={};return e?(e.split("&").forEach((e=>{const[n,s=""]=e.split("=");t[n]=decodeURIComponent(s)})),t):t}n.d(t,{V:()=>i,Z:()=>s})},6714:(e,t,n)=>{n.d(t,{Z:()=>h});var s=n(5432),i=n(3512),o=n(2064),r=n(410),a=function(e,t,n,s){return new(n||(n=Promise))((function(i,o){function r(e){try{c(s.next(e))}catch(e){o(e)}}function a(e){try{c(s.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,a)}c((s=s.apply(e,t||[])).next())}))};const c={"primary-color":{rgb:!0,light:!0,lightFilled:!0,dark:!0,darkRgb:!0},"message-out-primary-color":{lightFilled:!0},"surface-color":{rgb:!0},"danger-color":{light:!0,dark:!0},"primary-text-color":{rgb:!0},"secondary-text-color":{light:!0,lightFilled:!0},"message-out-background-color":{light:!0,lightFilled:!0,dark:!0,darkFilled:!0},"saved-color":{lightFilled:!0}},l={day:{"primary-color":"#3390ec","message-out-primary-color":"#4fae4e","surface-color":"#ffffff","danger-color":"#df3f40","primary-text-color":"#000000","secondary-text-color":"#707579","saved-color":"#359AD4"},night:{"primary-color":"#8774E1","message-out-primary-color":"#8774E1","surface-color":"#212121","danger-color":"#ff595a","primary-text-color":"#ffffff","secondary-text-color":"#aaaaaa","saved-color":"#8774E1"}},d=new class{constructor(){i.Z.addEventListener("theme_change",(()=>{this.setTheme()}))}get themeColorElem(){return void 0!==this._themeColorElem?this._themeColorElem:this._themeColorElem=document.head.querySelector('[name="theme-color"]')||null}setThemeColor(e=this.themeColor){e||(e=this.isNight()?"#212121":"#ffffff");const t=this.themeColorElem;t&&t.setAttribute("content",e)}setThemeListener(){try{const e=window.matchMedia("(prefers-color-scheme: dark)"),t=()=>{this.systemTheme=e.matches?"night":"day",i.Z.myId?i.Z.dispatchEvent("theme_change"):this.setTheme()};"addEventListener"in e?e.addEventListener("change",t):"addListener"in e&&e.addListener(t),t()}catch(e){}}applyHighlightningColor(){var e;let t;const n=this.getTheme();(null===(e=n.settings)||void 0===e?void 0:e.highlightningColor)?(t=n.settings.highlightningColor,document.documentElement.style.setProperty("--message-highlightning-color",t)):document.documentElement.style.removeProperty("--message-highlightning-color"),!s.Z&&t&&(this.themeColor=(0,o.K5)(t))}setTheme(){const e=this.isNight(),t=document.head.querySelector('[name="color-scheme"]');t&&t.setAttribute("content",e?"dark":"light"),document.documentElement.classList.toggle("night",e),this.setThemeColor();const n=this.getTheme();this.applyTheme(n);let s=this.styleElement;s||(s=this.styleElement=document.createElement("style"),document.head.append(s));const o=document.createElement("div");this.applyTheme(i.Z.settings.themes.find((e=>"night"===e.name)),o),s.textContent=`.night {${o.style.cssText}}`,this.applyHighlightningColor()}switchTheme(e){return a(this,void 0,void 0,(function*(){yield i.Z.managers.appStateManager.setByKey("settings.theme",e),i.Z.dispatchEvent("theme_change")}))}isNight(){return"night"===this.getTheme().name}getTheme(e=("system"===i.Z.settings.theme?this.systemTheme:i.Z.settings.theme)){return i.Z.settings.themes.find((t=>t.name===e))}bindColorApplier(e){const t=new Set;return{applyAppColor:n=>(t.add(n.name),this.applyAppColor(Object.assign(Object.assign({},n),e))),finalize:()=>{const n=e.isNight;for(const s in c)t.has(s)||this.applyAppColor(Object.assign({name:s,hex:l[n?"night":"day"][s]},e))}}}applyAppColor({name:e,hex:t,element:n,lightenAlpha:s=.08,darkenAlpha:i=s,mixColor:r,isNight:a}){const d=c[e],h=(0,o.oo)(t),u=(0,o.dI)(...h);null!=r||(r=(0,o.oo)(l[a?"night":"day"]["surface-color"]));const g=(0,o.Dk)(h,r,s),m=Object.assign(Object.assign({},u),{l:u.l-100*i});[[e,t],d.rgb&&[e+"-rgb",h.join(",")],d.light&&["light-"+e,`rgba(${h[0]}, ${h[1]}, ${h[2]}, ${s})`],d.lightFilled&&["light-filled-"+e,(0,o.t1)(g)],d.dark&&["dark-"+e,`hsl(${m.h}, ${m.s}%, ${m.l}%)`]].filter(Boolean).forEach((([e,t])=>{n.style.setProperty("--"+e,t)}))}applyNewTheme(e){return a(this,void 0,void 0,(function*(){const t=this.isNightTheme(e),n=this.getTheme(),s=i.Z.settings.themes,o=e.settings.find((e=>e.base_theme._===(t?"baseThemeNight":"baseThemeClassic"))),r=Object.assign(Object.assign({},e),{name:n.name,settings:Object.assign(Object.assign({},o),{highlightningColor:""})});yield this.AppBackgroundTab.setBackgroundDocument(o.wallpaper,r.settings),s[s.indexOf(n)]=r,yield i.Z.managers.appStateManager.setByKey("settings.themes",i.Z.settings.themes),i.Z.dispatchEvent("theme_change")}))}isNightTheme(e){return"night"===e.name||this.isNight()}applyTheme(e,t=document.documentElement){var n;const s=this.isNightTheme(e),i=Array.isArray(e.settings)?e.settings.find((e=>e.base_theme._===(s?"baseThemeNight":"baseThemeClassic"))):e.settings,r=l[s?"night":"day"];let a=(0,o.py)(...(0,o.oo)(r["primary-color"])),c=(0,o.py)(...(0,o.tB)(i.accent_color));const d=(0,o.uY)(a,c,(0,o.oo)(r["primary-color"]),!s),h=(0,o.t1)(d),{applyAppColor:u,finalize:g}=this.bindColorApplier({element:t,isNight:s});if(u({name:"primary-color",hex:h,darkenAlpha:.04}),u({name:"saved-color",hex:h,lightenAlpha:.64,mixColor:[255,255,255]}),!(null===(n=i.message_colors)||void 0===n?void 0:n.length))return;const m=s?.92:.12,p=(0,o.oo)(r["message-out-primary-color"]);a=(0,o.py)(...p);const f=(0,o.Dk)(p,(0,o.oo)(r["surface-color"]),m);let v=(0,o.tB)(i.message_colors[0]);i.message_colors.length>1&&(i.message_colors.slice(1).forEach((e=>{v=(0,o.ix)(v,(0,o.tB)(e))})),v=(0,o.e9)(a,f,v));const b=v;c=(0,o.py)(...b);const y=void 0!==i.outbox_accent_color&&(0,o.py)(...(0,o.tB)(i.outbox_accent_color)),w=(0,o.Dk)(v,(0,o.oo)(r["surface-color"]),m);u({name:"message-out-background-color",hex:(0,o.t1)(w),lightenAlpha:m}),u({name:"message-out-primary-color",hex:s?"#ffffff":(0,o.t1)(y?(0,o.WE)(...y):v),mixColor:w}),g()}};r.GO&&(r.GO.themeController=d);const h=d},2938:(e,t,n)=>{var s=n(4159),i=n(8799),o=n(3910),r=n(8090),a=n(4541),c=n(9976),l=n(4762),d=n(5418);!function(){const e={construct(e,t){let n=t[0]+"";return 0!==n.indexOf("blob:")&&(n+=location.search),new e(n)}};[Worker,"undefined"!=typeof SharedWorker&&SharedWorker].filter(Boolean).forEach((t=>{window[t.name]=new Proxy(t,e)}))}();var h=n(3512),u=n(5432),g=n(2325),m=(n(4110),n(690),n(3855)),p=n(2554),f=n(6714),v=n(3815),b=n(490),y=n(764),w=n(1267),S=n(410);const k="onbeforeinstallprompt"in window;var P=n(6472);document.addEventListener("DOMContentLoaded",(()=>{return e=void 0,t=void 0,E=function*(){var e;Element.prototype.toggleAttribute||(Element.prototype.toggleAttribute=function(e,t){return void 0!==t&&(t=!!t),this.hasAttribute(e)?!!t||(this.removeAttribute(e),!1):!1!==t&&(this.setAttribute(e,""),!0)}),void 0===Node.prototype.replaceChildren&&(Node.prototype.replaceChildren=function(...e){this.textContent="",e&&this.append(...e)}),h.Z.managers=(0,p.Z)(),document.getElementById("manifest").href=`site${l.IS_APPLE&&!l.IS_APPLE_MOBILE?"_apple":""}.webmanifest?v=jw3mK7G9Aq`,b.Z.start();const t=window.visualViewport||window;let _,E=!1;const A=()=>{const e=.01*(E&&!v.Z.isOverlayActive?t.height||t.innerHeight:window.innerHeight);_!==e&&(u.Z&&_<e&&e-_>1&&(0,i.Z)(),_=e,document.documentElement.style.setProperty("--vh",`${e}px`))};if(window.addEventListener("resize",A),A(),r.T){const e=()=>{E=1===n&&r.T&&!v.Z.isOverlayActive,A(),t!==window&&(E?(window.removeEventListener("resize",A),t.addEventListener("resize",A)):(t.removeEventListener("resize",A),window.addEventListener("resize",A)))};let n;window.onImTabChange=t=>{const s=void 0!==n;n=t,(s||1===n)&&e()},v.Z.addEventListener("change",(()=>{e()}))}if(l.IS_FIREFOX&&!c.Z&&document.addEventListener("dragstart",(e=>{const t=e.target;if("IMG"===t.tagName&&t.classList.contains("emoji"))return(0,o.Z)(e),!1})),c.Z&&document.documentElement.classList.add("native-emoji"),document.addEventListener("dragstart",(e=>{var t;if("IMG"===(null===(t=e.target)||void 0===t?void 0:t.tagName))return e.preventDefault(),!1})),document.addEventListener("contextmenu",(e=>{"IMG"!==e.target.tagName||window.appMediaViewer||(0,o.Z)(e)})),l.IS_FIREFOX&&document.documentElement.classList.add("is-firefox","no-backdrop"),l.IS_MOBILE&&document.documentElement.classList.add("is-mobile"),l.IS_APPLE)l.IS_SAFARI&&document.documentElement.classList.add("is-safari"),l.IS_APPLE_MOBILE?document.documentElement.classList.add("is-ios"):document.documentElement.classList.add("is-mac");else if(l.IS_ANDROID){document.documentElement.classList.add("is-android");const e=()=>{n=!0,window.addEventListener("resize",t,{once:!0})},t=()=>{n=!1,(0,i.Z)()};let n=!1;document.addEventListener("touchend",(t=>{const s=t.target.closest('[contenteditable="true"], input');s&&(document.activeElement===s||n||(console.log("input click",t,document.activeElement,s,s.matches(":focus")),window.addEventListener("resize",e,{once:!0})))}))}u.Z?document.documentElement.classList.add("is-touch"):document.documentElement.classList.add("no-touch"),k&&(0,P.Z)();const Z=performance.now(),C=g.ZP.getCacheLangPack(),[I,L]=yield Promise.all([m.Z.sendState().then((([e])=>e)),C]);function T(e,t){e.style.opacity="0",t.then((()=>{window.requestAnimationFrame((()=>{e.style.opacity=""}))}))}g.ZP.setTimeFormat(I.state.settings.timeFormat),h.Z.managers.rootScope.getPremium().then((e=>{h.Z.premium=e})),f.Z.setThemeListener(),L.appVersion!==s.Z.langPackVersion&&g.ZP.getLangPack(L.lang_code),console.log("got state, time:",performance.now()-Z),"ar"===L.lang_code&&S.Tj,document.documentElement.dir="ltr";let O=I.state.authState;const M=location.hash.split("?"),x=(0,y.V)(null!==(e=M[1])&&void 0!==e?e:M[0].slice(1));if(x.tgWebAuthToken&&"authStateSignedIn"!==O._){const e={token:x.tgWebAuthToken,dcId:+x.tgWebAuthDcId,userId:x.tgWebAuthUserId.toUserId(),isTest:void 0!==x.tgWebAuthTest&&!!+x.tgWebAuthTest,tgAddr:x.tgaddr};if(e.isTest!==w.Z.test){const e=new URLSearchParams(location.search);return+x.tgWebAuthTest?e.set("test","1"):e.delete("test"),void(location.search=e.toString())}h.Z.managers.appStateManager.pushToState("authState",O={_:"authStateSignImport",data:e})}if("authStateSignedIn"!==O._){console.log("Will mount auth page:",O._,Date.now()/1e3);const e=document.getElementById("auth-pages");let t,s;if(e){t=e.querySelector(".scrollable"),u.Z&&!l.IS_MOBILE_SAFARI||t.classList.add("no-scrollbar"),t.style.opacity="0";const n=document.createElement("div");n.classList.add("auth-placeholder"),t.prepend(n),t.append(n.cloneNode())}try{yield Promise.all([Promise.resolve().then(n.bind(n,2831)),Promise.resolve().then(n.bind(n,6702))]).then((([e,t])=>{e.default.setAuthorized(!1),t.default.forceUnsubscribe()}))}catch(e){}switch(O._){case"authStateSignIn":s=(yield Promise.all([n.e(147),n.e(297),n.e(63)]).then(n.bind(n,810))).default.mount();break;case"authStateSignQr":s=(yield Promise.all([n.e(147),n.e(297),n.e(709)]).then(n.bind(n,9709))).default.mount();break;case"authStateAuthCode":s=(yield Promise.all([n.e(147),n.e(297),n.e(53)]).then(n.bind(n,6392))).default.mount(O.sentCode);break;case"authStatePassword":s=(yield Promise.all([n.e(147),n.e(297),n.e(437)]).then(n.bind(n,9437))).default.mount();break;case"authStateSignUp":s=(yield Promise.all([n.e(147),n.e(297),n.e(339)]).then(n.bind(n,8339))).default.mount(O.authCode);break;case"authStateSignImport":s=(yield Promise.all([n.e(147),n.e(297),n.e(231)]).then(n.bind(n,3231))).default.mount(O.data)}t&&(s&&(yield s),T(t,"fonts"in document?Promise.race([(0,d.Z)(1e3),document.fonts.ready]):Promise.resolve()))}else console.log("Will mount IM page:",Date.now()/1e3),T(document.getElementById("main-columns"),(0,a.Z)()),(yield Promise.all([n.e(147),n.e(297),n.e(436)]).then(n.bind(n,5436))).default.mount()},new((_=void 0)||(_=Promise))((function(n,s){function i(e){try{r(E.next(e))}catch(e){s(e)}}function o(e){try{r(E.throw(e))}catch(e){s(e)}}function r(e){var t;e.done?n(e.value):(t=e.value,t instanceof _?t:new _((function(e){e(t)}))).then(i,o)}r((E=E.apply(e,t||[])).next())}));var e,t,_,E}))},1722:(e,t,n)=>{n.d(t,{Z:()=>s});const s=new class{reload(){try{location.reload()}catch(e){}}close(){try{window.close()}catch(e){}}focus(){window.focus()}}},2554:(e,t,n)=>{n.d(t,{Z:()=>c});var s=n(3855),i=n(410);const o={};function r(e,t){return new Proxy(e,{get:(e,n,r)=>{var a;return null!==(a=e[n])&&void 0!==a?a:e[n]=function(e,t){return new Proxy({},{get:(n,r,a)=>(...n)=>{var a;const c=s.Z.invoke("manager",{name:e,method:r,args:n},t);return i.ZP&&(null===(a=o[e])||void 0===a?void 0:a.has(r))&&console.warn("manager request",e,r,n,t),c}})}(n,t)}})}let a;function c(){return a||(a=r({},!1),a.acknowledged=r({},!0),a)}i.ZP&&(window.DEBUG_MANAGER_REQUESTS=o)},6666:(e,t,n)=>{n.d(t,{Z:()=>c});var s=n(1267),i=n(5471),o=n(5953),r=n(5003);class a{constructor(e){(0,o.Z)(this,e),s.Z.test&&(this.name+="_test"),this.storageIsAvailable=!0,this.log=(0,r.kg)(["IDB",e.name].join("-")),this.log("constructor"),this.openDatabase(!0),a.INSTANCES.push(this)}isAvailable(){return this.storageIsAvailable}openDatabase(e=!1){if(this.openDbPromise&&!e)return this.openDbPromise;const t=(e,t)=>{var n;const s=Array.from(e.indexNames);for(const t of s)e.deleteIndex(t);if(null===(n=t.indexes)||void 0===n?void 0:n.length)for(const n of t.indexes)e.indexNames.contains(n.indexName)||e.createIndex(n.indexName,n.keyPath,n.objectParameters)};try{var n=indexedDB.open(this.name,this.version);if(!n)return Promise.reject()}catch(e){return this.log.error("error opening db",e.message),this.storageIsAvailable=!1,Promise.reject(e)}let s=!1;return setTimeout((()=>{s||n.onerror((0,i.Z)("IDB_CREATE_TIMEOUT"))}),3e3),this.openDbPromise=new Promise(((e,i)=>{n.onsuccess=t=>{s=!0;const o=n.result;let r=!1;this.log("Opened"),o.onerror=e=>{this.storageIsAvailable=!1,this.log.error("Error creating/accessing IndexedDB database",e),i(e)},o.onclose=e=>{this.log.error("closed:",e),!r&&this.openDatabase()},o.onabort=e=>{this.log.error("abort:",e);const t=e.target;this.openDatabase(r=!0),t.onerror&&t.onerror(e),o.close()},o.onversionchange=e=>{this.log.error("onversionchange, lol?")},e(this.db=o)},n.onerror=e=>{s=!0,this.storageIsAvailable=!1,this.log.error("Error creating/accessing IndexedDB database",e),i(e)},n.onupgradeneeded=e=>{s=!0,this.log.warn("performing idb upgrade from",e.oldVersion,"to",e.newVersion);const n=e.target,i=n.result;this.stores.forEach((e=>{if(i.objectStoreNames.contains(e.name)){const s=n.transaction.objectStore(e.name);t(s,e)}else((e,n)=>{const s=e.createObjectStore(n.name);t(s,n)})(i,e)}))}}))}static create(e){var t;return null!==(t=this.INSTANCES.find((t=>t.name===e.name)))&&void 0!==t?t:new a(e)}static closeDatabases(e){this.INSTANCES.forEach((t=>{if(e&&e===t)return;const n=t.db;n&&(n.onclose=()=>{},n.close())}))}}a.INSTANCES=[];class c{constructor(e,t){this.storeName=t,this.log=(0,r.kg)(["IDB",e.name,t].join("-")),this.idb=a.create(e)}delete(e,t){const n=Array.isArray(e);return n||(e=[].concat(e)),this.getObjectStore("readwrite",(t=>{const s=e.map((e=>t.delete(e)));return n?s:s[0]}),"",t)}clear(e){return this.getObjectStore("readwrite",(e=>e.clear()),"",e)}save(e,t,n){const s=Array.isArray(e);return s||(e=[].concat(e),t=[].concat(t)),this.getObjectStore("readwrite",(n=>{const i=e.map(((e,s)=>n.put(t[s],e)));return s?i:i[0]}),"",n)}get(e,t){const n=Array.isArray(e);if(n){if(!e.length)return Promise.resolve([])}else{if(!e)return;e=[].concat(e)}return this.getObjectStore("readonly",(t=>{const s=e.map((e=>t.get(e)));return n?s:s[0]}),"",t)}getObjectStore(e,t,n,s=this.storeName){let i;return n&&(i=performance.now(),this.log(n+": start")),this.idb.openDatabase().then((o=>new Promise(((r,a)=>{const c=o.transaction([s],e),l=()=>{clearTimeout(u),a(c.error)},d=()=>{clearTimeout(u),n&&this.log(n+": end",performance.now()-i);const e=p.map((e=>e.result));r(m?e:e[0])};c.onerror=l;const h="readwrite"===e;h&&(c.oncomplete=()=>d());const u=setTimeout((()=>{this.log.error("transaction not finished",c,n)}),1e4),g=t(c.objectStore(s)),m=Array.isArray(g),p=m?g:[].concat(g);if(h)return;const f=p.length;let v=f;const b=()=>{c.error||--v||d()};for(let e=0;e<f;++e){const t=p[e];t.onerror=l,t.onsuccess=b}}))))}getAll(e){return this.getObjectStore("readonly",(e=>e.getAll()),"",e)}}},2325:(e,t,n)=>{n.d(t,{$d:()=>w,A1:()=>S,Hz:()=>m,XZ:()=>y,ZP:()=>v,ag:()=>b,nK:()=>p,v_:()=>k});var s=n(410),i=n(7922),o=n(4159),r=n(3512),a=n(4762),c=n(6848),l=n(5953),d=n(9005),h=n(6637),u=n(3591),g=n(130);const m={messageActionChatCreate:"ActionCreateGroup",messageActionChatCreateYou:"ActionYouCreateGroup",messageActionChatEditTitle:"ActionChangedTitle",messageActionChatEditPhoto:"ActionChangedPhoto",messageActionChatEditVideo:"ActionChangedVideo",messageActionChatDeletePhoto:"ActionRemovedPhoto",messageActionChatReturn:"ActionAddUserSelf",messageActionChatReturnYou:"ActionAddUserSelfYou",messageActionChatJoined:"ActionAddUserSelfMega",messageActionChatJoinedYou:"ChannelMegaJoined",messageActionChatAddUser:"ActionAddUser",messageActionChatAddUsers:"ActionAddUser",messageActionChatLeave:"ActionLeftUser",messageActionChatLeaveYou:"YouLeft",messageActionChatDeleteUser:"ActionKickUser",messageActionChatJoinedByLink:"ActionInviteUser",messageActionPinMessage:"Chat.Service.Group.UpdatedPinnedMessage",messageActionContactSignUp:"Chat.Service.PeerJoinedTelegram",messageActionChannelCreate:"ActionCreateChannel",messageActionChannelEditTitle:"Chat.Service.Channel.UpdatedTitle",messageActionChannelEditPhoto:"Chat.Service.Channel.UpdatedPhoto",messageActionChannelEditVideo:"Chat.Service.Channel.UpdatedVideo",messageActionChannelDeletePhoto:"Chat.Service.Channel.RemovedPhoto",messageActionHistoryClear:"HistoryCleared",messageActionDiscussionStarted:"DiscussionStarted",messageActionChannelMigrateFrom:"ActionMigrateFromGroup","messageActionPhoneCall.video_in_ok":"ChatList.Service.VideoCall.incoming","messageActionPhoneCall.video_out_ok":"ChatList.Service.VideoCall.outgoing","messageActionPhoneCall.video_missed":"ChatList.Service.VideoCall.Missed","messageActionPhoneCall.video_cancelled":"ChatList.Service.VideoCall.Cancelled","messageActionPhoneCall.in_ok":"ChatList.Service.Call.incoming","messageActionPhoneCall.out_ok":"ChatList.Service.Call.outgoing","messageActionPhoneCall.missed":"ChatList.Service.Call.Missed","messageActionPhoneCall.cancelled":"ChatList.Service.Call.Cancelled","messageActionGroupCall.started":"Chat.Service.VoiceChatStarted.Channel","messageActionGroupCall.started_by":"Chat.Service.VoiceChatStarted","messageActionGroupCall.started_byYou":"Chat.Service.VoiceChatStartedYou","messageActionGroupCall.ended":"Chat.Service.VoiceChatFinished.Channel","messageActionGroupCall.ended_by":"Chat.Service.VoiceChatFinished","messageActionGroupCall.ended_byYou":"Chat.Service.VoiceChatFinishedYou",messageActionBotAllowed:"Chat.Service.BotPermissionAllowed"},p=a.IS_MOBILE?"Message.Unsupported.Mobile":"Message.Unsupported.Desktop";var f;!function(e){let t,a;function m(t){e.lastRequestedLangCode=t,e.lastRequestedNormalizedLangCode=t.split("-")[0]}function p(){if("h12"===e.timeFormat)try{const t=A({hour:"numeric",minute:"numeric",hour12:!0}),n=new Date;n.setHours(0);const s=t.format(n);e.amPmCache.am=s.split(/\s/)[1],n.setHours(12);const i=t.format(n);e.amPmCache.pm=i.split(/\s/)[1]}catch(t){console.error("cannot get am/pm",t),e.amPmCache={am:"AM",pm:"PM"}}}function f(){const e=o.Z.langPackCode;return m(e),Promise.all([n.e(104).then(n.bind(n,9104)),n.e(301).then(n.bind(n,9301)),n.e(8).then(n.bind(n,9179))]).then((([t,n,s])=>{const i=[];return b(t.default,i),b(n.default,i),y({_:"langPackDifference",from_version:0,lang_code:e,strings:i,version:0,local:!0,countries:s.default})}))}function v(t,s){e.requestedServerLanguage=!0;const i=r.Z.managers;return Promise.all([i.apiManager.invokeApiCacheable("langpack.getLangPack",{lang_code:t,lang_pack:"web"}),!1,n.e(104).then(n.bind(n,9104)),n.e(301).then(n.bind(n,9301)),i.apiManager.invokeApiCacheable("help.getCountriesList",{lang_code:t,hash:0}),e.polyfillPromise])}function b(e,t=[]){for(const n in e){const s=e[n];"string"==typeof s?t.push({_:"langPackString",key:n,value:s}):t.push(Object.assign({_:"langPackStringPluralized",key:n},s))}return t}function y(e){return e.appVersion=o.Z.langPackVersion,i.Z.set({langPack:e}).then((()=>(w(e),e)))}function w(n){const s=e.lastRequestedLangCode;if(n.lang_code===s){try{t=new Intl.PluralRules(e.lastRequestedNormalizedLangCode)}catch(n){console.error("pluralRules error",n),t=new Intl.PluralRules(e.lastRequestedNormalizedLangCode.split("-",1)[0])}try{t=new Intl.PluralRules(n.lang_code)}catch(e){console.error("pluralRules error",e),t=new Intl.PluralRules(n.lang_code.split("-",1)[0])}e.strings.clear();for(const t of n.strings)e.strings.set(t.key,t);n.countries&&(e.countriesList.length=0,e.countriesList.push(...n.countries.countries),n.countries.countries.forEach((t=>{if(t.name){const n=t.default_name;e.strings.set(n,{_:"langPackString",key:n,value:t.name})}}))),e.lastAppliedLangCode!==s&&(r.Z.dispatchEvent("language_change",s),e.lastAppliedLangCode=s,E.clear(),p()),Array.from(document.querySelectorAll(".i18n")).forEach((t=>{const n=e.weakMap.get(t);n&&n.update()}))}}function S(e,t,n={i:0}){const s=[];let i=0;return e.replace(/(\*\*|__)(.+?)\1|(\n)|(\[.+?\]\(.*?\))|un\d|%\d\$.|%./g,((e,o,r,a,c,l,d)=>{if(s.push(d.slice(i,l)),o){let e;switch(o){case"**":e=document.createElement("b");break;case"__":e=document.createElement("i")}e.append(...S(r,t,n)),s.push(e)}else if(a)s.push(document.createElement("br"));else if(c){const e=c.lastIndexOf("]"),i=c.slice(1,e),o=c.slice(e+2,c.length-1);let r;if(o&&(0,h.Z)(o)){r=document.createElement("a");const e=(0,u.Z)(o);r.href=e.url,e.onclick&&r.setAttribute("onclick",e.onclick),r.target="_blank"}else r=t[n.i++],r instanceof DocumentFragment&&(r=r.firstChild),"string"!=typeof r&&(r.textContent="");const a=S(i,t,n);"string"==typeof r?s.push(...a):(r.append(...a),s.push(r))}else t&&function(e,t,n){const s=t[n.i++];Array.isArray(s)?e.push(...s):e.push(s)}(s,t,n);return i=l+e.length,""})),i!==e.length&&s.push(e.slice(i)),s}function k(n,s=!1,i){const o=e.strings.get(n);let r;if(o)if("langPackStringPluralized"===o._&&(null==i?void 0:i.length)){let e=i[0];"string"==typeof e&&(e=+e.replace(/\D/g,"")),r=o[t.select(e)+"_value"]||o.other_value}else r="langPackString"===o._?o.value:n;else r=n;const a=S(r,i);return s?a.map((e=>e instanceof Node?e.textContent:e)).join(""):a}e.strings=new Map,e.countriesList=[],e.requestedServerLanguage=!1,e.isRTL=!1,e.setRTL=function(t){e.isRTL=t},e.getCacheLangPack=function(){return a||(a=Promise.all([i.Z.get("langPack"),e.polyfillPromise]).then((([t])=>t?(s.ZP,e.lastRequestedLangCode||m(t.lang_code),w(t),t):f())).finally((()=>{a=void 0})))},e.setTimeFormat=function(t,n=!!e.timeFormat&&e.timeFormat!==t){e.timeFormat=t,p(),n&&(E.clear(),Array.from(document.querySelectorAll(".i18n")).forEach((t=>{const n=e.weakMap.get(t);n instanceof Z&&n.update()})))},e.loadLocalLangPack=f,e.loadLangPack=v,e.getStrings=function(e,t){return r.Z.managers.apiManager.invokeApi("langpack.getStrings",{lang_pack:o.Z.langPack,lang_code:e,keys:t})},e.formatLocalStrings=b,e.getLangPack=function(e,t){return m(e),v(e).then((([e,t,n,s,i,o])=>{let r=[];return[n,s].forEach((e=>{b(e.default,r)})),r=r.concat(...[e.strings,t.strings].filter(Boolean)),e.strings=r,e.countries=i,y(e)}))},e.saveLangPack=y,e.polyfillPromise="undefined"!=typeof Intl&&void 0!==Intl.PluralRules?Promise.resolve():n.e(642).then(n.bind(n,4642)).then((e=>{window.Intl=Object.assign("undefined"!=typeof Intl?Intl:{},e.default)})),e.applyLangPack=w,e.superFormatter=S,e.format=k,e.weakMap=new WeakMap;class P{constructor(t){this.element=(null==t?void 0:t.element)||document.createElement("span"),this.element.classList.add("i18n"),this.property=null==t?void 0:t.property,t&&(t.key||t.date)&&this.update(t),e.weakMap.set(this.element,this)}}class _ extends P{constructor(e={}){var t;super(Object.assign(Object.assign({},e),{property:null!==(t=e.property)&&void 0!==t?t:"innerHTML"}))}update(e){if((0,l.Z)(this,e),"innerHTML"===this.property)this.element.textContent="",this.element.append(...k(this.key,!1,this.args));else{const e=this.element[this.property],t=k(this.key,!0,this.args);void 0===e?this.element.dataset[this.property]=t:this.element[this.property]=t}}compareAndUpdate(e){if(this.key!==e.key||!(0,c.Z)(this.args,e.args))return this.update(e)}}e.IntlElement=_;const E=new Map;function A(t={}){const n=JSON.stringify(t);let s=E.get(n);return s||(s=new Intl.DateTimeFormat(e.lastRequestedNormalizedLangCode+"-u-hc-"+e.timeFormat,t),E.set(n,s)),s}e.amPmCache={am:"AM",pm:"PM"};class Z extends P{constructor(e){var t;super(Object.assign(Object.assign({},e),{property:null!==(t=e.property)&&void 0!==t?t:"textContent"})),(0,g.m)(this.element)}update(t){let n;if((0,l.Z)(this,t),this.options.hour&&this.options.minute&&2===Object.keys(this.options).length){const t=this.date.getHours();n=("0"+("h12"===e.timeFormat?t%12||12:t)).slice(-2)+":"+("0"+this.date.getMinutes()).slice(-2),"h12"===e.timeFormat&&(n+=" "+(t<12?e.amPmCache.am:e.amPmCache.pm))}else{const e=A(this.options);n=(0,d.Z)(e.format(this.date))}this.element[this.property]=n}}e.IntlDateElement=Z,e.i18n=function(e,t){return new _({key:e,args:t}).element},e.i18n_=function(e){return new _(e).element},e._i18n=function(e,t,n,s){return new _({element:e,key:t,args:n,property:s}).element}}(f||(f={}));const v=f,b=f.i18n,y=f.i18n_,w=f._i18n;function S(e,t){const n=e.slice(0,1);for(let s=1;s<e.length;++s){const i=e.length-1===s;n.push("function"==typeof t?t(i):t),n.push(e[s])}return n}function k(e,t=!0,n){const s=S(e,(e=>{const s=e&&t?"AutoDownloadSettings.LastDelimeter":"AutoDownloadSettings.Delimeter";return n?f.format(s,!0):b(s)}));return n?s.join(""):s}s.GO.I18n=f},1507:(e,t,n)=>{n.d(t,{BP:()=>u,BX:()=>m,DZ:()=>v,IA:()=>o,Iw:()=>l,J$:()=>p,NM:()=>s,OS:()=>h,Ox:()=>g,Pt:()=>d,Zi:()=>f,gZ:()=>c,hj:()=>i,rU:()=>a,yF:()=>r});const s=0,i=1271266957,o=777,r=777e3,a=2147483647,c="",l=20971520,d="",h=[7322096,16766590,13338331,9367192,16749490,16478047],u="default_static",g=4295032831,m=new Set(["web","k","z"]),p=0,f=1,v=new Set([p,f]);Math.max(...Array.from(v))},3855:(e,t,n)=>{n.d(t,{Z:()=>se});var s=n(3512),i=n(7730),o=n(410),r=n(7487),a=n(6702),c=n(1722),l=n(2831),d=n(5418),h=n(993),u=n(7328),g=n(6663),m=n(9976),p=n(3731),f=n(6818),v=n(1174),b=n(2341),y=n(9030),w=n(2365),S=n(2820),k=n(5432),P=n(2131),_=n(554),E=n(393),A=n(5269),Z=n(4089),C=n(4762),I=n(5783),L=n(2045),T=n(8189);const O=Object.assign({CAN_USE_TRANSFERABLES:u.Z,IS_APPLE_MX:T.Z,IS_CALL_SUPPORTED:h.Z,IS_CANVAS_FILTER_SUPPORTED:g.Z,IS_EMOJI_SUPPORTED:m.Z,IS_GEOLOCATION_SUPPORTED:p.Z,IS_GROUP_CALL_SUPPORTED:f.Z,IS_MOV_SUPPORTED:y.Z,IS_PARALLAX_SUPPORTED:w.Z,IS_SCREEN_SHARING_SUPPORTED:S.Z,IS_TOUCH_SUPPORTED:k.Z,IS_VIBRATE_SUPPORTED:P.Z,IS_OPUS_SUPPORTED:I.Z,IS_SHARED_WORKER_SUPPORTED:L.Z,IS_WEBM_SUPPORTED:E.Z,IS_WEBP_SUPPORTED:A.Z,IS_WEBRTC_SUPPORTED:Z.Z,IMAGE_MIME_TYPES_SUPPORTED:v.Z,MEDIA_MIME_TYPES_SUPPORTED:b.Z,VIDEO_MIME_TYPES_SUPPORTED:_.Z},C);var M=n(4159),x=n(236),W=n(6009),D=n(8479),R=n(946),N=n(7922),j=n(5466),F=n(5003);const U=x.h.version,B=x.h.build,V=Object.keys(x.h),G=["contactsListCachedTime","stateCreatedTime","maxSeenMsgId","filtersArr"];function $(){return e=this,t=void 0,i=function*(){const e=(0,F.kg)("STATE-LOADER"),t=performance.now(),n=(0,j.$)(e),i=V.map((e=>n(N.Z.get(e),"state "+e))).concat(n(r.Z.get("user_auth"),"auth"),n(r.Z.get("state_id"),"auth"),n(r.Z.get("k_build"),"auth")).concat(n(N.Z.get("user_auth"),"old auth")),a=yield Promise.all(i);e.warn("promises",performance.now()-t);const c=[],l=(e,t)=>{d[e]=t,c.push(e)};let d={};for(let e=0,t=V.length;e<t;++e){const t=V[e],n=a[e];void 0!==n?d[t]=n:l(t,(0,D.Z)(x.h[t]))}a.splice(0,V.length);let h=a.shift();const u=a.shift(),g=a.shift(),m=a.shift();if(!h&&m){h=m;const e=["dc","server_time_offset","xt_instance"];for(let t=1;t<=5;++t)e.push(`dc${t}_server_salt`),e.push(`dc${t}_auth_key`);const t=yield Promise.all(e.map((e=>N.Z.get(e))));e.push("user_auth"),t.push("number"==typeof h||"string"==typeof h?{dcID:t[0]||M.Z.baseDcId,date:Date.now()/1e3|0,id:h.toPeerId(!1)}:h);const n={};e.forEach(((e,s)=>{n[e]=t[s]})),yield r.Z.set(n)}h&&(d.authState={_:"authStateSignedIn"},s.Z.dispatchEvent("user_auth","number"==typeof h||"string"==typeof h?{dcID:0,date:Date.now()/1e3|0,id:h.toPeerId(!1)}:h));const p=new Set;if(d.stateId!==u){if(void 0!==u){const e=new Map([["authState",void 0],["stateId",void 0]]);e.forEach(((t,n)=>{e.set(n,(0,D.Z)(d[n]))})),d=(0,D.Z)(x.h),e.forEach(((e,t)=>{d[t]=e}));const t={chats:1,dialogs:1,users:1};for(const e in t)p.add(e);f=d,c.length=0,d=f,c.push(...Object.keys(d))}yield r.Z.set({state_id:d.stateId})}var f;const v=Date.now();d.stateCreatedTime+864e5<v&&(o.ZP&&e("will refresh state",d.stateCreatedTime,v),G.forEach((e=>{l(e,(0,D.Z)(x.h[e]))})));const b=d.settings.autoDownload;if(void 0!==(null==b?void 0:b.private)){const e=["contacts","private","groups","channels"];["photo","video","file"].forEach((t=>{const n=b[t]={};e.forEach((e=>{n[e]=b[e]}))})),e.forEach((e=>{delete b[e]})),l("settings",d.settings)}const y=new Set(["settings.themes"]);let w,S;if((0,R.Z)(x.h,d,(e=>{l(e,d[e])}),void 0,y),d.version!==U||d.build!==B){if(d.build<217&&(d.allDialogsLoaded=(0,D.Z)(x.h.allDialogsLoaded),d.pinnedOrders=(0,D.Z)(x.h.pinnedOrders),d.filtersArr=(0,D.Z)(x.h.filtersArr),p.add("dialogs")),-1===(0,W.Z)(d.version,"1.7.1")){let e=!1;if(-1===(0,W.Z)(d.version,"1.3.0"))e=!0,d.settings.theme=(0,D.Z)(x.h.settings.theme),d.settings.themes=(0,D.Z)(x.h.settings.themes);else if(-1===(0,W.Z)(d.version,"1.7.1")){e=!0;const t=d.settings.themes;d.settings.themes=(0,D.Z)(x.h.settings.themes);try{t.forEach((e=>{const t=e.background;if(!t)return;const n=d.settings.themes.find((t=>t.name===e.name));n.settings.highlightningColor=t.highlightningColor;const s=(t.color||"").split(",").map((e=>e&&parseInt(e.slice(1),16)));if(t.color&&!t.slug)n.settings.wallpaper={_:"wallPaperNoFile",id:0,pFlags:{},settings:{_:"wallPaperSettings",pFlags:{}}};else{const e={_:"wallPaper",id:0,access_hash:0,slug:t.slug,document:{},pFlags:{},settings:{_:"wallPaperSettings",pFlags:{}}},s=e.settings;n.settings.wallpaper=e,t.slug&&!t.color?s.pFlags.blur=t.blur||void 0:t.intensity&&(s.intensity=t.intensity,e.pFlags.pattern=!0,e.pFlags.dark=t.intensity<0||void 0)}if(s.length){const e=n.settings.wallpaper.settings;e.background_color=s[0],e.second_background_color=s[1],e.third_background_color=s[2],e.fourth_background_color=s[3]}}))}catch(e){console.error("migrating themes error",e)}}e&&l("settings",d.settings)}d.build<309&&(d.settings.liteMode.animations=!d.settings.animationsEnabled,d.settings.liteMode.video=!d.settings.autoPlay.videos,d.settings.liteMode.gif=!d.settings.autoPlay.gifs),d.build<312&&"boolean"==typeof d.settings.stickers.suggest&&(d.settings.stickers.suggest=d.settings.stickers.suggest?"all":"none"),0!==(0,W.Z)(d.version,U)&&(w=U,S=d.version),l("version",U),l("build",B)}return g!==B&&(!g||g<B)&&r.Z.set({k_build:B}),s.Z.settings=d.settings,o.ZP&&e("state res",d,(0,D.Z)(d)),e.warn("total",performance.now()-t),{state:d,resetStorages:p,newVersion:w,oldVersion:S,pushedKeys:c}},new((n=void 0)||(n=Promise))((function(s,o){function r(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?s(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())}));var e,t,n,i}let z;var q=n(9043),H=n(3206),Y=n(8630),X=n(8453),J=n(2586),K=n(3655),Q=n(3725),ee=function(e,t,n,s){return new(n||(n=Promise))((function(i,o){function r(e){try{c(s.next(e))}catch(e){o(e)}}function a(e){try{c(s.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,a)}c((s=s.apply(e,t||[])).next())}))};class te extends H.Z{constructor(){super(),this.onMirrorTask=e=>{var t,n;const{name:s,key:i,value:o}=e;if(!e.hasOwnProperty("key"))return void(this.mirrors[s]=o);const r=null!==(t=(n=this.mirrors)[s])&&void 0!==t?t:n[s]={};void 0===o?delete r[i]:r[i]=o},this.mirrors={},this.tabState={chatPeerIds:[],idleStartTime:0},this.log("constructor"),this.registerWorker(),this.registerServiceWorker(),this.registerCryptoWorker(),this.addMultipleEventsListeners({convertWebp:({fileName:e,bytes:t})=>i.Z.convert(e,t),convertOpus:({fileName:e,bytes:t})=>q.Z.pushDecodeTask(t,!1).then((e=>e.bytes)),event:({name:e,args:t})=>{s.Z.dispatchEventSingle(e,...t)},localStorageProxy:e=>{const t=e;return r.Z[t.type](...t.args)},mirror:this.onMirrorTask}),s.Z.addEventListener("language_change",(e=>{s.Z.managers.networkerFactory.setLanguage(e)})),window.addEventListener("online",(()=>{s.Z.managers.networkerFactory.forceReconnectTimeout()})),s.Z.addEventListener("logging_out",(()=>{Promise.all([(0,X.Z)(!1,!0),r.Z.clear(),Promise.race([l.default.setAuthorized(!1),(0,d.Z)(3e3)]),a.default.forceUnsubscribe(),Promise.all(["cachedFiles","cachedStreamChunks"].map((e=>caches.delete(e))))]).finally((()=>{c.Z.reload()}))})),J.Z.addEventListener("change",(e=>{this.updateTabStateIdle(e)})),this.updateTabStateIdle(J.Z.isIdle),this.log("Passing environment:",O),this.invoke("environment",O)}pingServiceWorkerWithIframe(){if(this.pingServiceWorkerPromise)return this.pingServiceWorkerPromise;const e=this.pingServiceWorkerPromise=(0,Q.Z)(),t=document.createElement("iframe");t.hidden=!0;const n=()=>{setTimeout((()=>{this.pingServiceWorkerPromise=void 0}),1e4),clearTimeout(s),t.remove(),t.removeEventListener("load",n),t.removeEventListener("error",n),e.resolve()};t.addEventListener("load",n),t.addEventListener("error",n),t.src="ping/"+(4294967295*Math.random()|0),document.body.append(t);const s=window.setTimeout(n,1e3);return e}attachServiceWorker(e){this.lastServiceWorker&&this.serviceMessagePort.detachPort(this.lastServiceWorker),this.serviceMessagePort.attachSendPort(this.lastServiceWorker=e),this.serviceMessagePort.invokeVoid("hello",void 0)}_registerServiceWorker(){navigator.serviceWorker.register(new URL(n.p+n.u(670),n.b),{scope:"./"}).then((e=>{if(this.log("SW registered",e),e.active&&!navigator.serviceWorker.controller)return e.unregister().then((()=>{window.location.reload()}));(e.installing||e.waiting||e.active).addEventListener("statechange",(e=>{this.log("SW statechange",e)}));const t=navigator.serviceWorker.controller||e.installing||e.waiting||e.active;this.attachServiceWorker(t)}),(e=>{this.log.error("SW registration failed!",e),this.invokeVoid("serviceWorkerOnline",!1)}))}registerServiceWorker(){if(!("serviceWorker"in navigator))return;this.serviceMessagePort=new K.Z;const e=navigator.serviceWorker;this._registerServiceWorker(),e.addEventListener("controllerchange",(()=>{this.log.warn("controllerchange");const t=e.controller;this.attachServiceWorker(t),t.addEventListener("error",(e=>{this.log.error("controller error:",e)}))})),this.serviceMessagePort.attachListenPort(e),this.serviceMessagePort.addMultipleEventsListeners({port:(e,t,n)=>{this.invokeVoid("serviceWorkerPort",void 0,void 0,[n.ports[0]])},hello:(e,t)=>{this.serviceMessagePort.resendLockTask(t)},share:e=>{this.log("will try to share something"),this.share=e}}),e.addEventListener("messageerror",(e=>{this.log.error("SW messageerror:",e)}))}registerCryptoWorker(){return ee(this,void 0,void 0,(function*(){const e={construct:(e,t)=>({url:t[0]+location.search})},t=[Worker,"undefined"!=typeof SharedWorker&&SharedWorker].filter(Boolean);t.forEach((t=>window[t.name]=new Proxy(t,e)));const s=new Worker(new URL(n.p+n.u(589),n.b),{type:void 0});t.forEach((e=>window[e.name]=e));const i=s.url,o=e=>new a(e,{type:"module"}),r=e=>this.attachWorkerToPort(e,Y.Z,"crypto"),a=L.Z?SharedWorker:Worker;Y.Z.addEventListener("port",((e,t,n)=>{this.invokeVoid("cryptoPort",void 0,void 0,[n.ports[0]])})),r(o(i));const c=yield(l=i,fetch(l).then((e=>e.text())).then((e=>{const t=location.pathname.split("/");return t[t.length-1]="",e=`\n var originalImportScripts = importScripts; \n importScripts = (url) => {\n console.log('importScripts', url);\n var newUrl = '${location.origin+t.join("/")}' + url.split('/').pop();\n return originalImportScripts(newUrl);\n };\n ${e}`,new Blob([e],{type:"application/javascript"})})));var l;(yield this.invoke("createProxyWorkerURLs",{originalUrl:i,blob:c})).slice(1).map(o).forEach(r)}))}registerWorker(){let e;e=L.Z?new SharedWorker(new URL(n.p+n.u(678),n.b),{type:void 0}):new Worker(new URL(n.p+n.u(678),n.b),{type:void 0}),this.onWorkerFirstMessage(e)}attachWorkerToPort(e,t,n){const s=e.port||e;t.attachPort(s),e.addEventListener("error",(e=>{this.log.error(n,"worker error",e)}))}onWorkerFirstMessage(e){this.log("set webWorker"),this.attachWorkerToPort(e,this,"mtproto")}loadState(){return Promise.all([(null!=z?z:z=$()).then((e=>(this.newVersion=e.newVersion,this.oldVersion=e.oldVersion,this.mirrors.state=e.state,e)))])}sendState(){return this.loadState().then((e=>{const[t]=e;return this.invoke("state",Object.assign(Object.assign({},t),{userId:s.Z.myId.toUserId()})),e}))}invokeCrypto(e,...t){return Y.Z.invokeCrypto(e,...t)}toggleStorages(e,t){return ee(this,void 0,void 0,(function*(){yield(0,X.Z)(e,t),this.invoke("toggleStorages",{enabled:e,clearWrite:t}),this.serviceMessagePort.invokeVoid("toggleStorages",{enabled:e,clearWrite:t})}))}getMirror(e){return ee(this,void 0,void 0,(function*(){return this.mirrors[e]}))}getState(){return this.getMirror("state")}updateTabState(e,t){this.tabState[e]=t,this.invokeVoid("tabState",this.tabState)}updateTabStateIdle(e){this.updateTabState("idleStartTime",e?Date.now():0)}}const ne=new te;o.GO.apiManagerProxy=ne;const se=ne},490:(e,t,n)=>{n.d(t,{Z:()=>f});var s=n(4159),i=n(410),o=n(2219),r=n(2045),a=n(3241),c=n(2586),l=n(5003),d=n(3512),h=n(7487),u=n(3855);const g=r.Z;class m extends a.Z{constructor(){super(!1),this.log=(0,l.kg)("INSTANCE"),this.clearInstance=()=>{this.masterInstance&&!this.deactivated&&(this.log.warn("clear master instance"),h.Z.delete("xt_instance"))},this.checkInstance=(e=c.Z.isIdle)=>{return t=this,n=void 0,o=function*(){if(this.deactivated)return;const t=Date.now(),n={id:this.instanceId,idle:e,time:t},[i,o=s.Z.build]=yield Promise.all([h.Z.get("xt_instance",!1),h.Z.get("k_build",!1)]);if(o>s.Z.build)return this.masterInstance=!1,d.Z.managers.networkerFactory.stopAll(),this.deactivateInstance("version"),void u.Z.toggleStorages(!1,!1);g?h.Z.set({xt_instance:n}):!e||!i||i.id===this.instanceId||i.time<t-2e4?(h.Z.set({xt_instance:n}),this.masterInstance||(this.masterInstance=!0,d.Z.managers.networkerFactory.startAll(),this.log.warn("now master instance",n)),this.clearDeactivateTimeout()):this.masterInstance&&(this.masterInstance=!1,d.Z.managers.networkerFactory.stopAll(),this.log.warn("now idle instance",n),this.deactivateTimeout||(this.deactivateTimeout=window.setTimeout((()=>this.deactivateInstance("tabs")),3e4)))},new((i=void 0)||(i=Promise))((function(e,s){function r(e){try{c(o.next(e))}catch(e){s(e)}}function a(e){try{c(o.throw(e))}catch(e){s(e)}}function c(t){var n;t.done?e(t.value):(n=t.value,n instanceof i?n:new i((function(e){e(n)}))).then(r,a)}c((o=o.apply(t,n||[])).next())}));var t,n,i,o},this.log=(0,l.kg)("INSTANCE"),this.instanceId=o.Z}get deactivatedReason(){return this.deactivated}start(){if(this.reset(),!this.started){this.started=!0,c.Z.addEventListener("change",this.checkInstance),setInterval(this.checkInstance,5e3),this.checkInstance();try{document.documentElement.addEventListener("beforeunload",this.clearInstance)}catch(e){}}}reset(){this.masterInstance=!1,this.clearDeactivateTimeout(),this.deactivated=void 0}activateInstance(){this.deactivated&&(this.reset(),this.checkInstance(!1),this.dispatchEvent("activated"))}deactivateInstance(e){this.masterInstance||this.deactivated||(this.log.warn("deactivate",e),this.clearDeactivateTimeout(),this.deactivated=e,this.dispatchEvent("deactivated",e))}clearDeactivateTimeout(){this.deactivateTimeout&&(clearTimeout(this.deactivateTimeout),this.deactivateTimeout=0)}}const p=new m;i.GO&&(i.GO.singleInstance=p);const f=p},2831:(e,t,n)=>{n.r(t),n.d(t,{TelegramMeWebManager:()=>c,default:()=>d});var s=n(4159),i=n(410),o=n(1267),r=n(7298),a=n(7487);class c{constructor(){this.disabled=o.Z.test||!s.Z.domains.includes(location.hostname)}setAuthorized(e){if(!this.disabled)return a.Z.get("tgme_sync").then((t=>{const n=(0,r.Z)(!0);if(e&&(null==t?void 0:t.canRedirect)===e&&t.ts+86400>n)return;a.Z.set({tgme_sync:{canRedirect:e,ts:n}});const i=`_websync_?authed=${e?"1":"0"}&version=${encodeURIComponent(s.Z.version+" "+s.Z.suffix)}`,o=["//telegram.me/"+i,"//t.me/"+i].map((e=>function(e){const t=document.createElement("script"),n=new Promise((e=>{t.onload=t.onerror=()=>{e(t)}}));return t.src=e,document.body.appendChild(t),n}(e).then((e=>{e.remove()}))));return Promise.all(o)}))}}const l=new c;i.GO&&(i.GO.telegramMeWebManager=l);const d=l},6702:(e,t,n)=>{n.r(t),n.d(t,{WebPushApiManager:()=>g,default:()=>p});var s=n(410),i=n(5003),o=n(3855),r=n(2325),a=n(4762),c=n(1722),l=n(8479),d=n(490),h=n(3241),u=n(2790);class g extends h.Z{constructor(){super(!1),this.isAvailable=!0,this.isPushEnabled=!1,this.localNotificationsAvailable=!0,this.started=!1,this.settings={},this.isFirefox=navigator.userAgent.toLowerCase().indexOf("firefox")>-1,this.userVisibleOnly=!this.isFirefox,this.log=(0,i.kg)("PM"),this.subscribe=()=>{this.isAvailable&&navigator.serviceWorker.ready.then((e=>{e.pushManager.subscribe({userVisibleOnly:this.userVisibleOnly}).then((e=>{this.isPushEnabled=!0,this.pushSubscriptionNotify("subscribe",e)})).catch((e=>{"denied"===Notification.permission?this.log("Permission for Notifications was denied"):(this.log("Unable to subscribe to push.",e),this.userVisibleOnly||(this.userVisibleOnly=!0,setTimeout(this.subscribe,0)))}))}))},this.isAliveNotify=()=>{if(!this.isAvailable||d.Z.deactivatedReason)return;this.settings.baseUrl=(location.href||"").replace(/#.*$/,"");const e={},t={push_action_mute1d:a.IS_MOBILE?"PushNotification.Action.Mute1d.Mobile":"PushNotification.Action.Mute1d",push_action_settings:a.IS_MOBILE?"PushNotification.Action.Settings.Mobile":"PushNotification.Action.Settings",push_message_nopreview:"PushNotification.Message.NoPreview"};for(const n in t)e[n]=r.ZP.format(t[n],!0);o.Z.serviceMessagePort.invokeVoid("pushPing",{localNotifications:this.localNotificationsAvailable,lang:e,settings:this.settings}),this.isAliveTO=setTimeout(this.isAliveNotify,1e4)},"PushManager"in window&&"Notification"in window&&"serviceWorker"in navigator||(this.log.warn("Push messaging is not supported."),this.isAvailable=!1,this.localNotificationsAvailable=!1),this.isAvailable&&"denied"===Notification.permission&&this.log.warn("The user has blocked notifications.")}start(){this.started||(this.started=!0,this.getSubscription(),this.setUpServiceWorkerChannel())}setLocalNotificationsDisabled(){this.localNotificationsAvailable=!1}getSubscription(){this.isAvailable&&navigator.serviceWorker.ready.then((e=>{e.pushManager.getSubscription().then((e=>{this.isPushEnabled=!!e,this.pushSubscriptionNotify("init",e)})).catch((e=>{this.log.error("Error during getSubscription()",e)}))}))}unsubscribe(){this.isAvailable&&navigator.serviceWorker.ready.then((e=>{e.pushManager.getSubscription().then((e=>{this.isPushEnabled=!1,e&&(this.pushSubscriptionNotify("unsubscribe",e),setTimeout((()=>{e.unsubscribe().then((e=>{this.isPushEnabled=!1})).catch((e=>{this.log.error("Unsubscription error: ",e)}))}),3e3))})).catch((e=>{this.log.error("Error thrown while unsubscribing from push messaging.",e)}))}))}forceUnsubscribe(){this.isAvailable&&navigator.serviceWorker.ready.then((e=>{e.pushManager.getSubscription().then((e=>{this.log.warn("force unsubscribe",e),e&&e.unsubscribe().then((e=>{this.log.warn("force unsubscribe successful",e),this.isPushEnabled=!1})).catch((e=>{this.log.error("Unsubscription error: ",e)}))})).catch((e=>{this.log.error("Error thrown while unsubscribing from push messaging.",e)}))}))}setSettings(e){this.settings=(0,l.Z)(e),clearTimeout(this.isAliveTO),this.isAliveNotify()}hidePushNotifications(){this.isAvailable&&o.Z.serviceMessagePort.invokeVoid("notificationsClear",void 0)}setUpServiceWorkerChannel(){this.isAvailable&&(o.Z.serviceMessagePort.addEventListener("pushClick",(e=>{d.Z.deactivatedReason?c.Z.reload():this.dispatchEvent("push_notification_click",e)})),navigator.serviceWorker.ready.then(this.isAliveNotify))}pushSubscriptionNotify(e,t){if(t){const n=t.toJSON();if(!(n&&n.endpoint&&n.keys&&n.keys.p256dh&&n.keys.auth))return this.log.warn("Invalid push subscription",n),this.unsubscribe(),this.isAvailable=!1,void this.pushSubscriptionNotify(e);this.log.warn("Push",e,n),this.dispatchEvent("push_"+e,{tokenType:10,tokenValue:JSON.stringify(n)})}else this.log.warn("Push",e,!1),this.dispatchEvent("push_"+e,!1)}ignorePushByMid(e,t){this.isAvailable&&o.Z.serviceMessagePort.invokeVoid("shownNotification",e+"_"+(0,u.Z)(t))}}const m=new g;s.GO&&(s.GO.webPushApiManager=m);const p=m},9043:(e,t,n)=>{n.d(t,{Z:()=>d});var s=n(410),i=n(5783),o=n(4762),r=n(5003),a=n(3855),c=function(e,t,n,s){return new(n||(n=Promise))((function(i,o){function r(e){try{c(s.next(e))}catch(e){o(e)}}function a(e){try{c(s.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,a)}c((s=s.apply(e,t||[])).next())}))};const l=new class{constructor(){this.sampleRate=48e3,this.tasks=[],this.keepAlive=!1,this.log=(0,r.kg)("OPUS",r.v9.Error)}isPlaySupported(){return i.Z}loadWavWorker(){this.wavWorker||(this.wavWorker=new Worker("waveWorker.min.js"),this.wavWorker.addEventListener("message",(e=>{const t=e.data;if(this.log("[WAV] got message:",t),t&&t.page){const e=t.page;this.onTaskEnd(this.tasks.shift(),e)}})))}loadWorker(){this.worker||(this.worker=new Worker("decoderWorker.min.js"),this.worker.addEventListener("message",(e=>{const t=e.data;this.log("[DECODER] got message",t),"done"===t.type?(this.wavWorker.postMessage({command:"done"}),t.waveform&&(this.tasks[0].waveform=t.waveform)):this.wavWorker.postMessage({command:"encode",buffers:e.data},o.IS_SAFARI?void 0:t.map((e=>e.buffer)))})))}setKeepAlive(e){this.keepAlive=e,this.keepAlive?(this.loadWorker(),this.loadWavWorker()):this.tasks.length||this.terminateWorkers()}onTaskEnd(e,t){t?(clearTimeout(e.timeout),e.callback.resolve({bytes:t,waveform:e.waveform})):e.callback.reject("timeout"),this.tasks.length&&this.executeNewTask(this.tasks[0]),this.terminateWorkers()}terminateWorkers(e=!1){(!this.keepAlive&&!this.tasks.length||e)&&(this.worker&&(this.worker.terminate(),this.worker=null),this.wavWorker&&(this.wavWorker.terminate(),this.wavWorker=null))}executeNewTask(e){this.worker.postMessage({command:"init",decoderSampleRate:this.sampleRate,outputBufferSampleRate:this.sampleRate}),this.wavWorker.postMessage({command:"init",wavBitDepth:16,wavSampleRate:this.sampleRate}),this.log("[DECODER] send decode"),this.worker.postMessage({command:"decode",pages:e.pages,waveform:e.withWaveform},o.IS_SAFARI?void 0:[e.pages.buffer]),e.timeout=window.setTimeout((()=>{this.log.error("decode timeout"),this.terminateWorkers(!0),this.tasks.length&&(this.loadWorker(),this.loadWavWorker()),this.onTaskEnd(this.tasks.shift())}),1e4)}pushDecodeTask(e,t){return new Promise(((n,s)=>{const i={pages:e,withWaveform:t,callback:{resolve:n,reject:s},timeout:0};this.loadWorker(),this.loadWavWorker(),1===this.tasks.push(i)&&this.executeNewTask(i)}))}decode(e,t=!1){return c(this,void 0,void 0,(function*(){return this.pushDecodeTask(e,t).then((e=>c(this,void 0,void 0,(function*(){const t=new Blob([e.bytes],{type:"audio/wav"});return{url:yield a.Z.invoke("createObjectURL",t),waveform:e.waveform}}))))}))}};s.GO.opusDecodeController=l;const d=l},2423:(e,t,n)=>{n.d(t,{$2:()=>u,E:()=>g,He:()=>b,Hk:()=>p,QB:()=>m,SC:()=>f,bu:()=>l,it:()=>c,kO:()=>y,tY:()=>v});var s=n(1229);const i="a-z\\u00c0-\\u00d6\\u00d8-\\u00f6\\u00f8-\\u00ff\\u0100-\\u024f\\u0253\\u0254\\u0256\\u0257\\u0259\\u025b\\u0263\\u0268\\u026f\\u0272\\u0289\\u028b\\u02bb\\u0300-\\u036f\\u1e00-\\u1eff\\u0400-\\u04ff\\u0500-\\u0527\\u2de0-\\u2dff\\ua640-\\ua69f\\u0591-\\u05bf\\u05c1-\\u05c2\\u05c4-\\u05c5\\u05c7\\u05d0-\\u05ea\\u05f0-\\u05f4\\ufb1d-\\ufb28\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40-\\ufb41\\ufb43-\\ufb44\\ufb46-\\ufb4f\\u0610-\\u061a\\u0620-\\u065f\\u066e-\\u06d3\\u06d5-\\u06dc\\u06de-\\u06e8\\u06ea-\\u06ef\\u06fa-\\u06fc\\u06ff\\u0750-\\u077f\\u08a0\\u08a2-\\u08ac\\u08e4-\\u08fe\\ufb50-\\ufbb1\\ufbd3-\\ufd3d\\ufd50-\\ufd8f\\ufd92-\\ufdc7\\ufdf0-\\ufdfb\\ufe70-\\ufe74\\ufe76-\\ufefc\\u200c\\u0e01-\\u0e3a\\u0e40-\\u0e4e\\u1100-\\u11ff\\u3130-\\u3185\\uA960-\\uA97F\\uAC00-\\uD7AF\\uD7B0-\\uD7FF\\u3003\\u3005\\u303b\\uff21-\\uff3a\\uff41-\\uff5a\\uff66-\\uff9f\\uffa1-\\uffdc",o="0-9_"+i,r="["+i+"0-9]",a="((?:https?|ftp)://|mailto:)?",c=a+"(?:"+r+"{1,64}(?::"+r+"{0,64})?@)?(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])(?:\\.(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])){3}|"+r+"["+i+"·0-9-]{0,64}(?:\\."+r+"["+i+"·0-9-]{0,64}){0,10}(?:\\.(xn--[0-9a-z]{2,16}|["+i+"]{2,24})))(?::\\d{2,5})?(?:/(?:\\S{0,255}[^\\s.;,(\\[\\]{}<>\"'])?)?",l=(new RegExp("^"+a.slice(0,-1),"i"),/^((?:[^\/]+?):\/\/|mailto:)/),d="[a-zA-Z\\d_]{5,32}",h="\\/([a-zA-Z\\d_]{1,32})(?:@("+d+"))?(\\b|$)",u=new RegExp("(^| )(@)("+d+")|("+c+")|(\\n)|("+s.Z+")|(^|[\\s\\(\\]])(#["+o+"]{2,64})|(^|\\s)"+h+"|(?:\\s|^)((?:\\d{1,2}:)?(?:[0-5]?[0-9]):(?:[0-5][0-9]))(?:\\s|$)","i"),g=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,m=/(^|\s|\n)(````?)([\s\S]+?)(````?)([\s\n\.,:?!;]|$)|(^|\s|\x01)(`|~~|\*\*|__|_-_|\|\|)([^\n]+?)\7([\x01\s\.,:?!;]|$)|@(\d+)\s*\((.+?)\)|(\[(.+?)\]\((.+?)\))/m,p={Telegram:"tg://search_hashtag?hashtag={1}",Twitter:"https://twitter.com/hashtag/{1}",Instagram:"https://instagram.com/explore/tags/{1}/","Google Plus":"https://plus.google.com/explore/{1}"},f={"`":"messageEntityCode","``":"messageEntityPre","**":"messageEntityBold",__:"messageEntityItalic","~~":"messageEntityStrike","_-_":"messageEntityUnderline","||":"messageEntitySpoiler"},v=(new Set(Object.values(f)),new Set(["messageEntityEmoji","messageEntityLinebreak","messageEntityCaret"])),b=new Set(v);for(const e in f)v.add(f[e]);const y=/^\+\d+$/},3591:(e,t,n)=>{n.d(t,{Z:()=>a});var s=n(2423),i=n(410),o=n(6637),r=n(1507);function a(e,t){(0,o.Z)(e)||(e="https://"+e);const n={url:e};let i,a,c,l;if(i=e.match(/^(?:https?:\/\/)?(?:(.+?)\.)?(?:(?:web|k|z)\.)?t(?:elegram)?\.me(?:\/(.+))?/)){const t=new URL(e);let n=i[1];n&&r.BX.has(i[1])&&(n=void 0),n&&(t.pathname=n+("/"===t.pathname?"":t.pathname));const o=t.pathname.slice(1),a=o.split("/");if(a[0]&&"$"===a[0][0]&&a[0].length>1)l="invoice";else if(/^\W/.test(o)&&!s.kO.test(o))l="joinchat";else switch(a[0]){case"joinchat":case"addstickers":case"addemoji":case"voicechat":case"invoice":if(1!==a.length&&!n){l=a[0];break}default:if(a[1]&&a[1].match(/^\d+(?:\?(?:comment|thread)=\d+)?$/)||1===a.length){l="im";break}}}else(a=e.match(/^(?:https?:\/\/)?telesco\.pe\/([^/?]+)\/(\d+)/))?l="im":(c=e.match(/tg:(?:\/\/)?(.+?)(?:\?|$)/))&&(l="tg_"+c[1]);return window[l]||(l=void 0),n.onclick=l,n}i.GO&&(i.GO.wrapUrl=a)},3512:(e,t,n)=>{n.d(t,{Z:()=>d});var s=n(1507),i=n(3241),o=n(410),r=n(3206),a=n(1352);class c extends i.Z{constructor(){super(),this.myId=s.NM,this.connectionStatus={},this.premium=!1,this.addEventListener("user_auth",(({id:e})=>{this.myId=e.toPeerId()})),this.addEventListener("premium_toggle_private",(({isNew:e,isPremium:t})=>{this.premium=t,this.dispatchEventSingle("premium_toggle",t)})),this.addEventListener("connection_status_change",(e=>{this.connectionStatus[e.name]=e})),this.dispatchEvent=(e,...t)=>{super.dispatchEvent(e,...t),r.Z.getInstance().invokeVoid("event",{name:e,args:t})},a.kC||this.addEventListener("settings_updated",(({settings:e})=>{this.settings=e}))}getConnectionStatus(){return this.connectionStatus}getPremium(){return this.premium}dispatchEventSingle(...e){super.dispatchEvent(...e)}}const l=new c;o.GO.rootScope=l;const d=l},7730:(e,t,n)=>{n.d(t,{Z:()=>r});var s=n(410),i=n(3725);const o=new class{constructor(){this.convertPromises={}}init(){this.worker=new Worker(new URL(n.p+n.u(61),n.b)),this.worker.addEventListener("message",(e=>{const t=e.data.payload,n=this.convertPromises[t.fileName];n&&(t.bytes?n.resolve(t.bytes):n.reject(),delete this.convertPromises[t.fileName])}))}postMessage(e){this.init&&(this.init(),this.init=null),this.worker.postMessage(e)}convert(e,t){if(this.convertPromises.hasOwnProperty(e))return this.convertPromises[e];const n=(0,i.Z)();return this.postMessage({type:"convertWebp",payload:{fileName:e,bytes:t}}),this.convertPromises[e]=n}};s.GO.webpWorkerController=o;const r=o}},r={};function a(e){var t=r[e];if(void 0!==t)return t.exports;var n=r[e]={exports:{}};return o[e].call(n.exports,n,n.exports,a),n.exports}a.m=o,e=[],a.O=(t,n,s,i)=>{if(!n){var o=1/0;for(d=0;d<e.length;d++){for(var[n,s,i]=e[d],r=!0,c=0;c<n.length;c++)(!1&i||o>=i)&&Object.keys(a.O).every((e=>a.O[e](n[c])))?n.splice(c--,1):(r=!1,i<o&&(o=i));if(r){e.splice(d--,1);var l=s();void 0!==l&&(t=l)}}return t}i=i||0;for(var d=e.length;d>0&&e[d-1][2]>i;d--)e[d]=e[d-1];e[d]=[n,s,i]},a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},n=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,a.t=function(e,s){if(1&s&&(e=this(e)),8&s)return e;if("object"==typeof e&&e){if(4&s&&e.__esModule)return e;if(16&s&&"function"==typeof e.then)return e}var i=Object.create(null);a.r(i);var o={};t=t||[null,n({}),n([]),n(n)];for(var r=2&s&&e;"object"==typeof r&&!~t.indexOf(r);r=n(r))Object.getOwnPropertyNames(r).forEach((t=>o[t]=()=>e[t]));return o.default=()=>e,a.d(i,o),i},a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.f={},a.e=e=>Promise.all(Object.keys(a.f).reduce(((t,n)=>(a.f[n](e,t),t)),[])),a.u=e=>(({589:"crypto.worker",630:"npm.qr-code-styling",670:"sw",678:"mtproto.worker"}[e]||e)+"."+{8:"93d2f33af815eb0455aa",53:"40d79ab9d14e8d83cf01",61:"1d9d1c1804ddef811ae0",63:"7ac6657334217aaadb5b",77:"b8cf11d2b5dca36479ca",104:"2ce072b250d3677d1571",147:"40d5eeb3e14bc4686ebc",231:"f4d1bfe6ff7f14577f96",297:"1bdbe4d3952a46b0e184",301:"95838a8203f23dd1ce8f",339:"12bdbede82465e666965",392:"6ce981ebdcbba9b6fd04",436:"9e54c5e9f3feccf9d736",437:"37bcbe9db9cbb8d8a753",442:"54c010363ba1cdea7bce",508:"108437b214c507c44cb2",589:"b0045a30f964b72ba240",630:"f8f57a1c721e03c3f699",641:"527b52a7a5052f57e455",642:"be93122d1116ecdc9322",670:"b6087986ef46df86e5e8",678:"30655ba40dd5e29892dd",709:"c5451446b3485d2557e8",776:"444edaecf4b03894ef8e",781:"c527d73f348ae695f21a",783:"949e247466ad3ebe82d6",810:"aad7a584f7c8c739c66e",813:"315ffd640c7d6013a536"}[e]+".chunk.js"),a.miniCssF=e=>{},a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s={},i="tweb:",a.l=(e,t,n,o)=>{if(s[e])s[e].push(t);else{var r,c;if(void 0!==n)for(var l=document.getElementsByTagName("script"),d=0;d<l.length;d++){var h=l[d];if(h.getAttribute("src")==e||h.getAttribute("data-webpack")==i+n){r=h;break}}r||(c=!0,(r=document.createElement("script")).charset="utf-8",r.timeout=120,a.nc&&r.setAttribute("nonce",a.nc),r.setAttribute("data-webpack",i+n),r.src=e),s[e]=[t];var u=(t,n)=>{r.onerror=r.onload=null,clearTimeout(g);var i=s[e];if(delete s[e],r.parentNode&&r.parentNode.removeChild(r),i&&i.forEach((e=>e(n))),t)return t(n)},g=setTimeout(u.bind(null,void 0,{type:"timeout",target:r}),12e4);r.onerror=u.bind(null,r.onerror),r.onload=u.bind(null,r.onload),c&&document.head.appendChild(r)}},a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;a.g.importScripts&&(e=a.g.location+"");var t=a.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var n=t.getElementsByTagName("script");n.length&&(e=n[n.length-1].src)}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a.p=e})(),(()=>{if(void 0!==a){var e=a.u,t=a.e,n={},s={};a.u=function(t){return e(t)+(n.hasOwnProperty(t)?"?"+n[t]:"")},a.e=function(i){return t(i).catch((function(t){var o=s.hasOwnProperty(i)?s[i]:999999;if(o<1){var r=e(i);throw t.message="Loading chunk "+i+" failed after 999999 retries.\n("+r+")",t.request=r,t}return new Promise((function(e){setTimeout((function(){var t=Date.now();n[i]=t,s[i]=o-1,e(a.e(i))}),3e3)}))}))}}})(),(()=>{a.b=document.baseURI||self.location.href;var e={179:0};a.f.j=(t,n)=>{var s=a.o(e,t)?e[t]:void 0;if(0!==s)if(s)n.push(s[2]);else{var i=new Promise(((n,i)=>s=e[t]=[n,i]));n.push(s[2]=i);var o=a.p+a.u(t),r=new Error;a.l(o,(n=>{if(a.o(e,t)&&(0!==(s=e[t])&&(e[t]=void 0),s)){var i=n&&("load"===n.type?"missing":n.type),o=n&&n.target&&n.target.src;r.message="Loading chunk "+t+" failed.\n("+i+": "+o+")",r.name="ChunkLoadError",r.type=i,r.request=o,s[1](r)}}),"chunk-"+t,t)}},a.O.j=t=>0===e[t];var t=(t,n)=>{var s,i,[o,r,c]=n,l=0;if(o.some((t=>0!==e[t]))){for(s in r)a.o(r,s)&&(a.m[s]=r[s]);if(c)var d=c(a)}for(t&&t(n);l<o.length;l++)i=o[l],a.o(e,i)&&e[i]&&e[i][0](),e[i]=0;return a.O(d)},n=this.webpackChunktweb=this.webpackChunktweb||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();var c=a.O(void 0,[85,110],(()=>a(2938)));c=a.O(c)})();
//# sourceMappingURL=main.f2043db1df6d2dbc91cc.bundle.js.map