80t0mj.xyz
Open in
urlscan Pro
2606:4700:3031::6815:3a05
Public Scan
Submitted URL: http://80t0mj.xyz/index-b7419775.js
Effective URL: https://80t0mj.xyz/index-b7419775.js
Submission: On July 15 via api from US — Scanned from DE
Effective URL: https://80t0mj.xyz/index-b7419775.js
Submission: On July 15 via api from US — Scanned from DE
Form analysis
0 forms found in the DOMText Content
(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))r(n);new MutationObserver(n=>{for(const o of n)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function s(n){const o={};return n.integrity&&(o.integrity=n.integrity),n.referrerPolicy&&(o.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?o.credentials="include":n.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(n){if(n.ep)return;n.ep=!0;const o=s(n);fetch(n.href,o)}})();const Nr="modulepreload",Ur=function(t,e){return new URL(t,e).href},is={},U=function(e,s,r){if(!s||s.length===0)return e();const n=document.getElementsByTagName("link");return Promise.all(s.map(o=>{if(o=Ur(o,r),o in is)return;is[o]=!0;const i=o.endsWith(".css"),a=i?'[rel="stylesheet"]':"";if(!!r)for(let l=n.length-1;l>=0;l--){const d=n[l];if(d.href===o&&(!i||d.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${a}`))return;const u=document.createElement("link");if(u.rel=i?"stylesheet":Nr,i||(u.as="script",u.crossOrigin=""),u.href=o,document.head.appendChild(u),i)return new Promise((l,d)=>{u.addEventListener("load",l),u.addEventListener("error",()=>d(new Error(`Unable to preload CSS for ${o}`)))})})).then(()=>e()).catch(o=>{const i=new Event("vite:preloadError",{cancelable:!0});if(i.payload=o,window.dispatchEvent(i),!i.defaultPrevented)throw o})},as=["web.telegram.org","webk.telegram.org"],ji="pattern",cs=Math.min(4,navigator.hardwareConcurrency??4),B={id:+"1025907",hash:"452b0359b988148995f22ff0f4229750",version:"1.9.7",versionFull:"1.9.7 (427)",build:+"427",langPackVersion:"3.1.2",langPack:"webk",langPackCode:"en",domains:as,baseDcId:2,isMainDomain:as.includes(location.hostname),suffix:"K",threads:cs,cryptoWorkers:cs};B.isMainDomain&&(B.id=2496,B.hash="8da85b0d5bfe62527e5b244c209159c3");function Wr(){return document.activeElement?.blur?(document.activeElement.blur(),!0):!1}function us(t){if(t||(t=window.event),t){t=t.originalEvent||t;try{t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),t.returnValue=!1,t.cancelBubble=!0}catch{}}return!1}const ce="ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch,Gt=typeof window<"u"?window:self,we=navigator?navigator.userAgent:null,Tt=navigator.userAgent.search(/OS X|iPhone|iPad|iOS/i)!==-1,Ms=navigator.userAgent.toLowerCase().indexOf("android")!==-1,Is=/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor),Rs=(()=>{try{return+navigator.userAgent.match(/Chrom(?:e|ium)\/(.+?)(?:\s|\.)/)[1]}catch{}})(),Fe=(/iPad|iPhone|iPod/.test(navigator.platform)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)&&!Gt.MSStream,$="safari"in Gt||!!(we&&(/\b(iPad|iPhone|iPod)\b/.test(we)||we.match("Safari")&&!we.match("Chrome"))),Ee=navigator.userAgent.toLowerCase().indexOf("firefox")>-1,Yt=$&&Fe,Q=(navigator.maxTouchPoints===void 0||navigator.maxTouchPoints>0)&&navigator.userAgent.search(/iOS|iPhone OS|Android|BlackBerry|BB10|Series ?[64]0|J2ME|MIDP|opera mini|opera mobi|mobi.+Gecko|Windows Phone/i)!=-1,Vr=Object.freeze(Object.defineProperty({__proto__:null,CHROMIUM_VERSION:Rs,IS_ANDROID:Ms,IS_APPLE:Tt,IS_APPLE_MOBILE:Fe,IS_CHROMIUM:Is,IS_FIREFOX:Ee,IS_MOBILE:Q,IS_MOBILE_SAFARI:Yt,IS_SAFARI:$,USER_AGENT:we},Symbol.toStringTag,{value:"Module"}));function jr(t,e){return t.closest("."+e)}let Se;function Lt(t){Se?Se.push(t):(Se=[t],requestAnimationFrame(()=>{const e=Se;Se=void 0,e.forEach(s=>s())}))}let me,mt=!1;function Gi(t){me?mt?t():me.push(t):(me=[t],requestAnimationFrame(()=>{mt=!0;for(let e=0;e<me.length;++e)me[e]();me=void 0,mt=!1}))}let De;function Yi(){return De||(De=new Promise(t=>Lt(()=>t())),De.then(()=>{De=void 0}),De)}function Gr(){return new Promise(t=>{Lt(()=>{Lt(t)})})}function ls(t){t.style.transform="translateY(-99999px)",t.focus(),Gr().then(()=>{t.style.transform=""})}const He=$&&Q&&ce&&!1;if(He){const t="clientY";let e=0;const s={capture:!0,passive:!1},r=o=>{const i=o.touches[0],a=jr(i.target,"scrollable-y");if(a){const c=i[t],u=e-c,l=a.scrollTop,d=a.scrollHeight,F=a.clientHeight,g=l?Math.round(l+a.clientHeight+u):l+u;(d===F||g>=d||g<=0)&&o.preventDefault()}else o.preventDefault()};let n=0;document.addEventListener("focusin",o=>{!o.target.classList.contains("is-sticky-input-bugged")||o.timeStamp-n<50||(ls(o.target),document.addEventListener("touchmove",r,s),document.addEventListener("touchstart",i=>{if(i.touches.length>1)return;e=i.touches[0][t]}))},{passive:!0}),document.addEventListener("focusout",o=>{document.removeEventListener("touchmove",r,s),n=o.timeStamp},{passive:!0}),document.addEventListener("visibilitychange",()=>{document.activeElement&&document.activeElement.classList.contains("is-sticky-input-bugged")&&document.activeElement.blur&&ls(document.activeElement)},{passive:!0})}function zi(t){He&&t.classList.add("is-sticky-input-bugged")}const Os="Roboto",Yr=Os+', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif',zr="16px",Hr="400",Hi=`${Hr} ${zr} ${Yr}`;function $e(){}function zt(t){return new Promise(e=>{setTimeout(e,t)})}const xs="tgico";function $i(t){return xs+"-"+t}const Dt=["b","б"],pt={},$r={text:Os,icons:xs,monospace:"Roboto Mono"};function qr(t={text:Dt,icons:void 0,monospace:Dt}){if(!("fonts"in document))return Promise.resolve();const e=[];for(const s in t){let r=t[s];r==="all"&&(r=Dt);const n=$r[s],o=s==="icons"?[500]:[400,500];for(const i of o){const a=(r||[void 0]).map(c=>{var d,F;const u=[i,"1rem",n].join(" ");return(d=pt[u]??(pt[u]={}))[F=c||""]??(d[F]=document.fonts.load(u,c))});e.push(...a)}}return Promise.race([Promise.all(e).catch($e),zt(1e3)])}const Mt=navigator.userAgent.search(/OS X|iPhone|iPad|iOS/i)!==-1;function Bs(t){return t instanceof URL||(t=new URL(t+"",location.href)),location.search&&t.protocol!=="blob:"&&new URLSearchParams(location.search).forEach((s,r)=>{t.searchParams.set(r,s)}),t.searchParams.delete("swfix"),t}function Kr(){const t={construct(e,s){return s[0]=Bs(s[0]),new e(...s)}};[Worker,typeof SharedWorker<"u"&&SharedWorker].filter(Boolean).forEach(e=>{window[e.name]=new Proxy(e,t)})}Kr();function Jr(){Element.prototype.toggleAttribute||(Element.prototype.toggleAttribute=function(t,e){return e!==void 0&&(e=!!e),this.hasAttribute(t)?e?!0:(this.removeAttribute(t),!1):e===!1?!1:(this.setAttribute(t,""),!0)})}const Ns=0,qi=1271266957,Ki=777,Ji=777e3,Xi=2147483647,Zi="",Qi=20*1024*1024,Xr="",ea=[7322096,16766590,13338331,9367192,16749490,16478047],ta="default_static",qe=4294967296,sa=qe+1,Zr=new Set(["web","k","z","a"]),ra=2147483646,Qr=0,en=1,tn=new Set([Qr,en]);Math.max(...Array.from(tn))+1;const na=!1;function sn(t,e){const s=t.findIndex(e);return s!==-1?t.splice(s,1)[0]:void 0}class de{constructor(e){this._constructor(e)}_constructor(e){this.reuseResults=e,this.listeners={},this.listenerResults={}}addEventListener(e,s,r){var n;if(((n=this.listeners)[e]??(n[e]=[])).push({callback:s,options:r}),this.listenerResults.hasOwnProperty(e)&&(s(...this.listenerResults[e]),r?.once)){this.listeners[e].pop();return}}addMultipleEventsListeners(e){for(const s in e)this.addEventListener(s,e[s])}removeEventListener(e,s,r){this.listeners[e]&&sn(this.listeners[e],n=>n.callback===s)}invokeListenerCallback(e,s,...r){let n,o;try{n=s.callback(...r)}catch(i){o=i}if(s.options?.once&&this.removeEventListener(e,s.callback),o)throw o;return n}_dispatchEvent(e,s,...r){this.reuseResults&&(this.listenerResults[e]=r);const n=s&&[],o=this.listeners[e];return o&&o.slice().forEach(a=>{if(o.findIndex(l=>l.callback===a.callback)===-1)return;const u=this.invokeListenerCallback(e,a,...r);n&&n.push(u)}),n}dispatchResultableEvent(e,...s){return this._dispatchEvent(e,!0,...s)}dispatchEvent(e,...s){this._dispatchEvent(e,!1,...s)}cleanup(){this.listeners={},this.listenerResults={}}}const q={test:location.search.indexOf("test=1")>0,debug:location.search.indexOf("debug=1")>0,http:!1,ssl:!0,multipleConnections:!0,asServiceWorker:!1,transport:"websocket",noSharedWorker:location.search.indexOf("noSharedWorker=1")>0};q.http=location.search.indexOf("http=1")>0;q.http=!0;q.http&&(q.transport="https");const rn=!1,ue=q.debug,nn=typeof window<"u"?window:self,b=nn,Us=Date.now()%Math.random()*1e8|0;function Ft(t,e){const s=t.indexOf(e);return(s===-1?void 0:t.splice(s,1))?.[0]}const Me=typeof ServiceWorkerGlobalScope<"u"&&self instanceof ServiceWorkerGlobalScope,at=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&!Me,le=at||Me,on=()=>self.clients.matchAll({includeUncontrolled:!1,type:"window"}),Ws=(t,...e)=>{try{t.postMessage(...e)}catch(s){console.error("[worker] postMessage error:",s,e)}},Vs=(t,...e)=>{on().then(s=>{s.length&&s.slice(t?0:-1).forEach(r=>{Ws(r,...e)})})},js=(...t)=>{Ws(self,...t)},Gs=()=>{};Me&&Vs.bind(null,!1);Me&&Vs.bind(null,!0);const Et={};function Ke(t){return Et[t]??(Et[t]={type:t})}const an=Date.now();function Je(){return"["+((Date.now()-an)/1e3).toFixed(3)+"]"}var Ht=(t=>(t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Log=4]="Log",t[t.Debug=8]="Debug",t))(Ht||{});const cn=[0,1,2,4,8],un=$||Ee,ln=!un,hs={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",fg:{black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m"},bg:{black:"\x1B[40m",red:"\x1B[41m",green:"\x1B[42m",yellow:"\x1B[43m",blue:"\x1B[44m",magenta:"\x1B[45m",cyan:"\x1B[46m",white:"\x1B[47m"}},hn=[["debug",8],["info",4],["warn",2],["error",1],["assert",1],["trace",4],["group",4],["groupCollapsed",4],["groupEnd",4]];function ee(t,e=7,s=!1,r=""){let n;!ue&&!s&&(e=1),ln?r||(Me?r=hs.fg.yellow:at&&(r=hs.fg.cyan)):r="";const o=r;r?r=`%s ${r}%s`:r="%s";const i=function(...a){return e&4&&console.log(r,Je(),t,...a)};return hn.forEach(([a,c])=>{i[a]=function(...u){return e&c&&console[a](r,Je(),t,...u)}}),i.setPrefix=function(a){n=a,t="["+a+"]"},i.setPrefix(t),i.setLevel=function(a){e=cn.slice(0,a+1).reduce((c,u)=>c|u,0)},i.bindPrefix=function(a,c=e){return ee(`${n}] [${a}`,c,s,o)},i}const dn=!0;class $t extends de{constructor(e){super(!1),this.logSuffix=e,this.onMessage=s=>{const r=s.data,n=s.source||s.currentTarget;this.processTaskMap[r.type](r,n,s)},this.processResultTask=s=>{const{taskId:r,result:n,error:o}=s.payload,i=this.awaiting[r];i&&(this.debug&&this.log.debug("done",i.taskType,n,o),"error"in s.payload?i.reject(o):i.resolve(n),delete this.awaiting[r])},this.processAckTask=s=>{const r=s.payload,n=this.awaiting[r.taskId];if(!n)return;const o=n.resolve,i={cached:r.cached,result:r.cached?"result"in r?Promise.resolve(r.result):Promise.reject(r.error):new Promise((a,c)=>{n.resolve=a,n.reject=c})};o(i),r.cached&&delete this.awaiting[r.taskId]},this.processPingTask=(s,r,n)=>{this.pushTask(this.createTask("pong",void 0),n.source)},this.processPongTask=(s,r,n)=>{const o=this.pingResolves.get(r);o&&(this.pingResolves.delete(r),o())},this.processCloseTask=(s,r,n)=>{this.detachPort(r)},this.processBatchTask=(s,r,n)=>{const o={data:n.data,source:n.source,currentTarget:n.currentTarget};s.payload.forEach(i=>{o.data=i,this.onMessage(o)})},this.processLockTask=(s,r,n)=>{const o=s.payload;this.requestedLocks.has(o)||(this.requestedLocks.set(o,r),navigator.locks.request(o,()=>{this.processCloseTask(void 0,r,void 0),this.requestedLocks.delete(o)}))},this.processInvokeTask=async(s,r,n)=>{const o=s.id,i=s.payload;let a,c,u;i.void||(a={taskId:o},c=this.createTask("result",a)),i.withAck&&(u=this.createTask("ack",{taskId:o,cached:!0}));let l;try{const d=this.listeners[i.type];if(!d?.length)throw new Error("no listener");const F=d[0];let g=this.invokeListenerCallback(i.type,F,i.payload,r,n);if(i.void)return;if(l=g instanceof Promise,u){const C=!l;if(u.payload.cached=C,C&&(u.payload.result=g),this.pushTask(u,r),C)return}l&&(g=await g),a.result=g}catch(d){if(this.log.error("worker task error:",d,s),i.void)return;if(u&&u.payload.cached){u.payload.error=d,this.pushTask(u,r);return}a.error=d}this.pushTask(c,r)},this.listenPorts=[],this.sendPorts=[],this.pingResolves=new Map,this.taskId=0,this.awaiting={},this.pending=new Map,this.log=ee("MP"+(e?"-"+e:"")),this.debug=ue,this.heldLocks=new Map,this.requestedLocks=new Map,this.processTaskMap={result:this.processResultTask,ack:this.processAckTask,invoke:this.processInvokeTask,ping:this.processPingTask,pong:this.processPongTask,close:this.processCloseTask,lock:this.processLockTask,batch:this.processBatchTask}}setOnPortDisconnect(e){this.onPortDisconnect=e}attachPort(e){this.attachListenPort(e),this.attachSendPort(e)}attachListenPort(e){this.listenPorts.push(e),e.addEventListener("message",this.onMessage)}attachSendPort(e){if(this.log.warn("attaching send port"),e.start?.(),this.sendPorts.push(e),typeof window<"u"&&dn)if("locks"in navigator){const s=["lock",Us,this.logSuffix||"",Math.random()*2147483647|0].join("-");this.log.warn("created lock",s);const r=new Promise(n=>this.heldLocks.set(e,{resolve:n,id:s})).then(()=>this.heldLocks.delete(e));navigator.locks.request(s,()=>(this.resendLockTask(e),r))}else window.addEventListener("beforeunload",()=>{const s=this.createTask("close",void 0);this.postMessage(void 0,s)});this.releasePending()}resendLockTask(e){const s=this.heldLocks.get(e);s&&this.pushTask(this.createTask("lock",s.id),e)}detachPort(e){this.log.warn("disconnecting port"),Ft(this.listenPorts,e),Ft(this.sendPorts,e),e.removeEventListener?.("message",this.onMessage),e.close?.(),this.onPortDisconnect?.(e),this.heldLocks.get(e)?.resolve();const r=Ke("PORT_DISCONNECTED");for(const n in this.awaiting){const o=this.awaiting[n];o.port===e&&(o.reject(r),delete this.awaiting[n])}}postMessage(e,s){(Array.isArray(e)?e:e?[e]:this.sendPorts).forEach(n=>{n.postMessage(s,s.transfer)})}async releasePending(){this.releasingPending||(this.releasingPending=!0,await Promise.resolve(),this.debug&&this.log.debug("releasing tasks, length:",this.pending.size),this.pending.forEach((e,s)=>{let r=e;{let o;r=[],e.forEach(i=>{i.transfer?(o=void 0,r.push(i)):(o||(o=this.createTask("batch",[]),r.push(o)),o.payload.push(i))})}const n=s?[s]:this.sendPorts;n.length&&(r.forEach(o=>{try{this.postMessage(n,o)}catch(i){this.log.error("postMessage error:",i,o,n)}}),this.pending.delete(s))}),this.debug&&this.log.debug("released tasks"),this.releasingPending=!1)}createTask(e,s,r){return{type:e,payload:s,id:this.taskId++,transfer:r}}createInvokeTask(e,s,r,n,o){return this.createTask("invoke",{type:e,payload:s,withAck:r,void:n},o)}pushTask(e,s){let r=this.pending.get(s);r||this.pending.set(s,r=[]),r.push(e),this.releasePending()}invokeVoid(e,s,r,n){const o=this.createInvokeTask(e,s,void 0,!0,n);this.pushTask(o,r)}invoke(e,s,r,n,o){this.debug&&this.log.debug("start",e,s);let i;const a=new Promise((c,u)=>{i=this.createInvokeTask(e,s,r,void 0,o),this.awaiting[i.id]={resolve:c,reject:u,taskType:e,port:n},this.pushTask(i,n)});if(le){a.finally(()=>{clearInterval(c)});const c=Gt.setInterval(()=>{this.log.error("task still has no result",i,n)},6e4)}return a}invokeExceptSource(e,s,r){const n=this.sendPorts.slice();Ft(n,r),n.forEach(o=>{this.invokeVoid(e,s,o)})}}class Ie extends $t{constructor(){super("MTPROTO"),Ie.INSTANCE=this,b&&(b.mtprotoMessagePort=this)}static getInstance(){return this.INSTANCE}}class fn extends de{constructor(){super(),this.myId=Ns,this.connectionStatus={},this.premium=!1,this.addEventListener("user_auth",({id:e})=>{this.myId=e.toPeerId()}),this.addEventListener("premium_toggle_private",({isNew:e,isPremium:s})=>{this.premium=s,this.dispatchEventSingle("premium_toggle",s)}),this.addEventListener("connection_status_change",e=>{this.connectionStatus[e.name]=e}),this.dispatchEvent=(e,...s)=>{super.dispatchEvent(e,...s),Ie.getInstance().invokeVoid("event",{name:e,args:s})},le||this.addEventListener("settings_updated",({settings:e})=>{this.settings=e})}getConnectionStatus(){return this.connectionStatus}getPremium(){return this.premium}dispatchEventSingle(...e){super.dispatchEvent(...e)}}const S=new fn;b.rootScope=S;const gn={isFulfilled:!1,isRejected:!1,notify:()=>{},notifyAll:function(...t){this.lastNotify=t,this.listeners?.forEach(e=>e(...t))},addNotifyListener:function(t){this.lastNotify&&t(...this.lastNotify),(this.listeners??(this.listeners=[])).push(t)},resolve:function(t){this.isFulfilled||this.isRejected||(this.isFulfilled=!0,this._resolve(t),this.onFinish())},reject:function(...t){this.isRejected||this.isFulfilled||(this.isRejected=!0,this._reject(...t),this.onFinish())},onFinish:function(){this.notify=this.notifyAll=this.lastNotify=null,this.listeners&&(this.listeners.length=0),this.cancel&&(this.cancel=$e)}};function X(){let t,e;const s=new Promise((r,n)=>{t=r,e=n});return Object.assign(s,gn),s._resolve=t,s._reject=e,s}self.deferredPromise=X;function vt(t,e,s=!0){let r=null,n,o;const i=()=>{clearInterval(r),r=null},a=(...c)=>{n=!0,o=c,r||(s&&(n=!1,t(...o)),r=setInterval(()=>{if(!n){i();return}n=!1,t(...o)},e))};return a.clear=i,a}function It(t,e){if(e)for(const s in e)e[s]!==void 0&&(t[s]=e[s]);return t}const Ys=class Rt{constructor(e){It(this,e),q.test&&(this.name+="_test"),this.storageIsAvailable=!0,this.log=ee(["IDB",e.name].join("-")),this.log("constructor"),this.openDatabase(!0),Rt.INSTANCES.push(this)}isAvailable(){return this.storageIsAvailable}openDatabase(e=!1){if(this.openDbPromise&&!e)return this.openDbPromise;const s=(i,a)=>{const c=Array.from(i.indexNames);for(const u of c)i.deleteIndex(u);if(a.indexes?.length)for(const u of a.indexes)i.indexNames.contains(u.indexName)||i.createIndex(u.indexName,u.keyPath,u.objectParameters)},r=(i,a)=>{const c=i.createObjectStore(a.name);s(c,a)};try{var n=indexedDB.open(this.name,this.version);if(!n)return Promise.reject()}catch(i){return this.log.error("error opening db",i.message),this.storageIsAvailable=!1,Promise.reject(i)}let o=!1;return setTimeout(()=>{o||n.onerror(Ke("IDB_CREATE_TIMEOUT"))},3e3),this.openDbPromise=new Promise((i,a)=>{n.onsuccess=c=>{o=!0;const u=n.result;let l=!1;this.log("Opened"),u.onerror=d=>{this.storageIsAvailable=!1,this.log.error("Error creating/accessing IndexedDB database",d),a(d)},u.onclose=d=>{this.log.error("closed:",d),!l&&this.openDatabase()},u.onabort=d=>{this.log.error("abort:",d);const F=d.target;this.openDatabase(l=!0),F.onerror&&F.onerror(d),u.close()},u.onversionchange=d=>{this.log.error("onversionchange, lol?")},i(this.db=u)},n.onerror=c=>{o=!0,this.storageIsAvailable=!1,this.log.error("Error creating/accessing IndexedDB database",c),a(c)},n.onupgradeneeded=c=>{o=!0,this.log.warn("performing idb upgrade from",c.oldVersion,"to",c.newVersion);const u=c.target,l=u.result;this.stores.forEach(d=>{if(!l.objectStoreNames.contains(d.name))r(l,d);else{const g=u.transaction.objectStore(d.name);s(g,d)}})}})}static create(e){return this.INSTANCES.find(s=>s.name===e.name)??new Rt(e)}static closeDatabases(e){this.INSTANCES.forEach(s=>{if(e&&e===s)return;const r=s.db;r&&(r.onclose=()=>{},r.close())})}};Ys.INSTANCES=[];let mn=Ys;class Dn{constructor(e,s){this.storeName=s,this.log=ee(["IDB",e.name,s].join("-")),this.idb=mn.create(e)}delete(e,s){const r=Array.isArray(e);return r||(e=[].concat(e)),this.getObjectStore("readwrite",n=>{const o=e.map(i=>n.delete(i));return r?o:o[0]},"",s)}clear(e){return this.getObjectStore("readwrite",s=>s.clear(),"",e)}save(e,s,r){const n=Array.isArray(e);return n||(e=[].concat(e),s=[].concat(s)),this.getObjectStore("readwrite",o=>{const i=e.map((a,c)=>o.put(s[c],a));return n?i:i[0]},"",r)}get(e,s){const r=Array.isArray(e);if(r){if(!e.length)return Promise.resolve([])}else{if(!e)return;e=[].concat(e)}return this.getObjectStore("readonly",n=>{const o=e.map(i=>n.get(i));return r?o:o[0]},"",s)}getObjectStore(e,s,r,n=this.storeName){let o;return r&&(o=performance.now(),this.log(r+": start")),this.idb.openDatabase().then(i=>new Promise((a,c)=>{const u=i.transaction([n],e),l=()=>{clearTimeout(g),c(u.error)},d=()=>{clearTimeout(g),r&&this.log(r+": end",performance.now()-o);const w=_.map(m=>m.result);a(T?w:w[0])};u.onerror=l;const F=e==="readwrite";F&&(u.oncomplete=()=>d());const g=setTimeout(()=>{this.log.error("transaction not finished",u,r)},1e4),C=s(u.objectStore(n)),T=Array.isArray(C),_=T?C:[].concat(C);if(F)return;const I=_.length;let L=I;const R=()=>{u.error||--L||d()};for(let w=0;w<I;++w){const m=_[w];m.onerror=l,m.onsuccess=R}}))}getAll(e){return this.getObjectStore("readonly",s=>s.getAll(),"",e)}}function ds(){}const yt=16,zs=class Ve{constructor(e,s){this.db=e,this.storeName=s,this.cache={},this.getPromises=new Map,this.keysToSet=new Set,this.saveDeferred=X(),this.keysToDelete=new Set,this.deleteDeferred=X(),this.storage=new Dn(e,s),Ve.STORAGES.length?this.useStorage=Ve.STORAGES[0].useStorage:this.useStorage=!0,this.savingFreezed=!1,Ve.STORAGES.push(this),this.saveThrottled=vt(async()=>{const r=this.saveDeferred;this.saveDeferred=X();const n=this.keysToSet;if(n.size){const o=Array.from(n.values());n.clear();const i=o.map(a=>this.cache[a]);try{await this.storage.save(o,i)}catch(a){console.error("[AS]: set error:",a,o,i)}}r.resolve(),n.size&&this.saveThrottled()},yt,!1),this.deleteThrottled=vt(async()=>{const r=this.deleteDeferred;this.deleteDeferred=X();const n=this.keysToDelete;if(n.size){const o=Array.from(n.values());n.clear();try{await this.storage.delete(o)}catch(i){console.error("[AS]: delete error:",i,o)}}r.resolve(),n.size&&this.deleteThrottled()},yt,!1),this.getThrottled=vt(async()=>{const r=Array.from(this.getPromises.keys());this.storage.get(r).then(n=>{for(let o=0,i=r.length;o<i;++o){const a=r[o],c=this.getPromises.get(a);c&&(c.resolve(this.cache[a]=n[o]),this.getPromises.delete(a))}},n=>{new Set(["NO_ENTRY_FOUND","STORAGE_OFFLINE"]).has(n.type)||(this.useStorage=!1,console.error("[AS]: get error:",n,r,s));for(let i=0,a=r.length;i<a;++i){const c=r[i],u=this.getPromises.get(c);u&&(u.resolve(void 0),this.getPromises.delete(c))}}).finally(()=>{this.getPromises.size&&this.getThrottled()})},yt,!1)}isAvailable(){return this.useStorage}getCache(){return this.cache}getFromCache(e){return this.cache[e]}setToCache(e,s){return this.cache[e]=s}async get(e,s=!0){if(this.cache.hasOwnProperty(e)&&s)return this.getFromCache(e);if(this.useStorage){const r=this.getPromises.get(e);if(r)return r;const n=X();return this.getPromises.set(e,n),this.getThrottled(),n}}getAll(){return this.storage.getAll().catch(()=>[])}set(e,s=!1){const r=this.useStorage&&!s&&!this.savingFreezed;for(const n in e)if(e.hasOwnProperty(n)){const o=e[n];this.setToCache(n,o),r&&(this.keysToSet.add(n),this.keysToDelete.delete(n),this.saveThrottled())}return r?this.saveDeferred:Promise.resolve()}delete(e,s=!1){return e=""+e,s||delete this.cache[e],this.useStorage&&(this.keysToSet.delete(e),this.keysToDelete.add(e),this.deleteThrottled()),this.useStorage?this.deleteDeferred:Promise.resolve()}clear(e=!1){if(!e)for(const s in this.cache)delete this.cache[s];return this.storage.clear().catch(ds)}static toggleStorage(e,s){return Promise.all(this.STORAGES.map(r=>{if(r.useStorage=e,!(!le||!s))return e?r.set(r.cache):(r.keysToSet.clear(),r.keysToDelete.clear(),r.getPromises.forEach(n=>n.resolve(void 0)),r.getPromises.clear(),r.clear(!0))})).catch(ds)}static freezeSaving(e,s){this.STORAGES.forEach(r=>r.savingFreezed=!0);try{e()}catch(r){console.error("freezeSaving callback error:",r)}this.STORAGES.forEach(r=>r.savingFreezed=!1)}};zs.STORAGES=[];let qt=zs;b&&(b.AppStorage=qt);const pn={name:"tweb",version:7,stores:[{name:"session"},{name:"stickerSets"},{name:"users"},{name:"chats"},{name:"dialogs"},{name:"messages"}]};class Fn extends qt{constructor(){super(pn,"session")}}const pe=new Fn;b.stateStorage=pe;function Hs(t,e,s){const r=s&&new Set(s),n=c=>Object.keys(c).filter(u=>c[u]!==void 0),o=s?c=>n(c).filter(u=>!r.has(u)):n,i=typeof t;return t&&e&&i==="object"&&i===typeof e?o(t).length===o(e).length&&o(t).every(c=>Hs(t[c],e[c],s)):t===e}function ct(t){return t.charAt(0).toUpperCase()+t.slice(1)}const En=new Set(["javascript:"]);function $s(t){if(!t)return null;try{const e=new URL(t).protocol;return En.has(e)?null:e}catch{return null}}const vn="((?:👨ðŸ»â€â¤ï¸?â€ðŸ’‹â€ðŸ‘¨\uD83C[\uDFFB-\uDFFF]|👨ðŸ¼â€â¤ï¸?â€ðŸ’‹â€ðŸ‘¨\uD83C[\uDFFB-\uDFFF]|👨ðŸ½â€â¤ï¸?â€ðŸ’‹â€ðŸ‘¨\uD83C[\uDFFB-\uDFFF]|👨ðŸ¾â€â¤ï¸?â€ðŸ’‹â€ðŸ‘¨\uD83C[\uDFFB-\uDFFF]|👨ðŸ¿â€â¤ï¸?â€ðŸ’‹â€ðŸ‘¨\uD83C[\uDFFB-\uDFFF]|👩ðŸ»â€â¤ï¸?â€ðŸ’‹â€ðŸ‘¨\uD83C[\uDFFB-\uDFFF]|👩ðŸ»â€â¤ï¸?â€ðŸ’‹â€ðŸ‘©\uD83C[\uDFFB-\uDFFF]|👩ðŸ¼â€â¤ï¸?â€ðŸ’‹â€ðŸ‘¨\uD83C[\uDFFB-\uDFFF]|👩ðŸ¼â€â¤ï¸?â€ðŸ’‹â€ðŸ‘©\uD83C[\uDFFB-\uDFFF]|👩ðŸ½â€â¤ï¸?â€ðŸ’‹â€ðŸ‘¨\uD83C[\uDFFB-\uDFFF]|👩ðŸ½â€â¤ï¸?â€ðŸ’‹â€ðŸ‘©\uD83C[\uDFFB-\uDFFF]|👩ðŸ¾â€â¤ï¸?â€ðŸ’‹â€ðŸ‘¨\uD83C[\uDFFB-\uDFFF]|👩ðŸ¾â€â¤ï¸?â€ðŸ’‹â€ðŸ‘©\uD83C[\uDFFB-\uDFFF]|👩ðŸ¿â€â¤ï¸?â€ðŸ’‹â€ðŸ‘¨\uD83C[\uDFFB-\uDFFF]|👩ðŸ¿â€â¤ï¸?â€ðŸ’‹â€ðŸ‘©\uD83C[\uDFFB-\uDFFF]|🧑ðŸ»â€â¤ï¸?â€ðŸ’‹â€ðŸ§‘\uD83C[\uDFFC-\uDFFF]|🧑ðŸ¼â€â¤ï¸?â€ðŸ’‹â€ðŸ§‘\uD83C[\uDFFB\uDFFD-\uDFFF]|🧑ðŸ½â€â¤ï¸?â€ðŸ’‹â€ðŸ§‘\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|🧑ðŸ¾â€â¤ï¸?â€ðŸ’‹â€ðŸ§‘\uD83C[\uDFFB-\uDFFD\uDFFF]|🧑ðŸ¿â€â¤ï¸?â€ðŸ’‹â€ðŸ§‘\uD83C[\uDFFB-\uDFFE]|👨ðŸ»â€â¤ï¸?â€ðŸ‘¨\uD83C[\uDFFB-\uDFFF]|👨ðŸ»â€ðŸ¤â€ðŸ‘¨\uD83C[\uDFFC-\uDFFF]|👨ðŸ¼â€â¤ï¸?â€ðŸ‘¨\uD83C[\uDFFB-\uDFFF]|👨ðŸ¼â€ðŸ¤â€ðŸ‘¨\uD83C[\uDFFB\uDFFD-\uDFFF]|👨ðŸ½â€â¤ï¸?â€ðŸ‘¨\uD83C[\uDFFB-\uDFFF]|👨ðŸ½â€ðŸ¤â€ðŸ‘¨\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|👨ðŸ¾â€â¤ï¸?â€ðŸ‘¨\uD83C[\uDFFB-\uDFFF]|👨ðŸ¾â€ðŸ¤â€ðŸ‘¨\uD83C[\uDFFB-\uDFFD\uDFFF]|👨ðŸ¿â€â¤ï¸?â€ðŸ‘¨\uD83C[\uDFFB-\uDFFF]|👨ðŸ¿â€ðŸ¤â€ðŸ‘¨\uD83C[\uDFFB-\uDFFE]|👩ðŸ»â€â¤ï¸?â€ðŸ‘¨\uD83C[\uDFFB-\uDFFF]|👩ðŸ»â€â¤ï¸?â€ðŸ‘©\uD83C[\uDFFB-\uDFFF]|👩ðŸ»â€ðŸ¤â€ðŸ‘¨\uD83C[\uDFFC-\uDFFF]|👩ðŸ»â€ðŸ¤â€ðŸ‘©\uD83C[\uDFFC-\uDFFF]|👩ðŸ¼â€â¤ï¸?â€ðŸ‘¨\uD83C[\uDFFB-\uDFFF]|👩ðŸ¼â€â¤ï¸?â€ðŸ‘©\uD83C[\uDFFB-\uDFFF]|👩ðŸ¼â€ðŸ¤â€ðŸ‘¨\uD83C[\uDFFB\uDFFD-\uDFFF]|👩ðŸ¼â€ðŸ¤â€ðŸ‘©\uD83C[\uDFFB\uDFFD-\uDFFF]|👩ðŸ½â€â¤ï¸?â€ðŸ‘¨\uD83C[\uDFFB-\uDFFF]|👩ðŸ½â€â¤ï¸?â€ðŸ‘©\uD83C[\uDFFB-\uDFFF]|👩ðŸ½â€ðŸ¤â€ðŸ‘¨\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|👩ðŸ½â€ðŸ¤â€ðŸ‘©\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|👩ðŸ¾â€â¤ï¸?â€ðŸ‘¨\uD83C[\uDFFB-\uDFFF]|👩ðŸ¾â€â¤ï¸?â€ðŸ‘©\uD83C[\uDFFB-\uDFFF]|👩ðŸ¾â€ðŸ¤â€ðŸ‘¨\uD83C[\uDFFB-\uDFFD\uDFFF]|👩ðŸ¾â€ðŸ¤â€ðŸ‘©\uD83C[\uDFFB-\uDFFD\uDFFF]|👩ðŸ¿â€â¤ï¸?â€ðŸ‘¨\uD83C[\uDFFB-\uDFFF]|👩ðŸ¿â€â¤ï¸?â€ðŸ‘©\uD83C[\uDFFB-\uDFFF]|👩ðŸ¿â€ðŸ¤â€ðŸ‘¨\uD83C[\uDFFB-\uDFFE]|👩ðŸ¿â€ðŸ¤â€ðŸ‘©\uD83C[\uDFFB-\uDFFE]|🧑ðŸ»â€â¤ï¸?â€ðŸ§‘\uD83C[\uDFFC-\uDFFF]|🧑ðŸ»â€ðŸ¤â€ðŸ§‘\uD83C[\uDFFB-\uDFFF]|🧑ðŸ¼â€â¤ï¸?â€ðŸ§‘\uD83C[\uDFFB\uDFFD-\uDFFF]|🧑ðŸ¼â€ðŸ¤â€ðŸ§‘\uD83C[\uDFFB-\uDFFF]|🧑ðŸ½â€â¤ï¸?â€ðŸ§‘\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|🧑ðŸ½â€ðŸ¤â€ðŸ§‘\uD83C[\uDFFB-\uDFFF]|🧑ðŸ¾â€â¤ï¸?â€ðŸ§‘\uD83C[\uDFFB-\uDFFD\uDFFF]|🧑ðŸ¾â€ðŸ¤â€ðŸ§‘\uD83C[\uDFFB-\uDFFF]|🧑ðŸ¿â€â¤ï¸?â€ðŸ§‘\uD83C[\uDFFB-\uDFFE]|🧑ðŸ¿â€ðŸ¤â€ðŸ§‘\uD83C[\uDFFB-\uDFFF]|👨â€â¤ï¸?â€ðŸ’‹â€ðŸ‘¨|👩â€â¤ï¸?â€ðŸ’‹â€\uD83D[\uDC68\uDC69]|🫱ðŸ»â€ðŸ«²\uD83C[\uDFFC-\uDFFF]|🫱ðŸ¼â€ðŸ«²\uD83C[\uDFFB\uDFFD-\uDFFF]|🫱ðŸ½â€ðŸ«²\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|🫱ðŸ¾â€ðŸ«²\uD83C[\uDFFB-\uDFFD\uDFFF]|🫱ðŸ¿â€ðŸ«²\uD83C[\uDFFB-\uDFFE]|👨â€â¤ï¸?â€ðŸ‘¨|👩â€â¤ï¸?â€\uD83D[\uDC68\uDC69]|🧑â€ðŸ¤â€ðŸ§‘|👫\uD83C[\uDFFB-\uDFFF]|👬\uD83C[\uDFFB-\uDFFF]|ðŸ‘\uD83C[\uDFFB-\uDFFF]|ðŸ’\uD83C[\uDFFB-\uDFFF]|💑\uD83C[\uDFFB-\uDFFF]|ðŸ¤\uD83C[\uDFFB-\uDFFF]|\uD83D[\uDC6B-\uDC6D\uDC8F\uDC91]|ðŸ¤)|(?:\uD83D[\uDC68\uDC69]|🧑)(?:\uD83C[\uDFFB-\uDFFF])?â€(?:âš•ï¸?|âš–ï¸?|✈ï¸?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C[\uDFCB\uDFCC]|\uD83D[\uDD74\uDD75]|⛹)(?:(?:\uD83C[\uDFFB-\uDFFF]|ï¸?)â€[♀♂]ï¸?)|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])?â€[♀♂]ï¸?|(?:👨â€ðŸ‘¨â€ðŸ‘¦â€ðŸ‘¦|👨â€ðŸ‘¨â€ðŸ‘§â€\uD83D[\uDC66\uDC67]|👨â€ðŸ‘©â€ðŸ‘¦â€ðŸ‘¦|👨â€ðŸ‘©â€ðŸ‘§â€\uD83D[\uDC66\uDC67]|👩â€ðŸ‘©â€ðŸ‘¦â€ðŸ‘¦|👩â€ðŸ‘©â€ðŸ‘§â€\uD83D[\uDC66\uDC67]|👨â€ðŸ‘¦â€ðŸ‘¦|👨â€ðŸ‘§â€\uD83D[\uDC66\uDC67]|👨â€ðŸ‘¨â€\uD83D[\uDC66\uDC67]|👨â€ðŸ‘©â€\uD83D[\uDC66\uDC67]|👩â€ðŸ‘¦â€ðŸ‘¦|👩â€ðŸ‘§â€\uD83D[\uDC66\uDC67]|👩â€ðŸ‘©â€\uD83D[\uDC66\uDC67]|ðŸ³ï¸?â€âš§ï¸?|ðŸ³ï¸?â€ðŸŒˆ|😶â€ðŸŒ«ï¸?|â¤ï¸?â€ðŸ”¥|â¤ï¸?â€ðŸ©¹|ðŸ´â€â˜ ï¸?|ðŸ•â€ðŸ¦º|ðŸ»â€â„ï¸?|ðŸ‘â€ðŸ—¨|👨â€\uD83D[\uDC66\uDC67]|👩â€\uD83D[\uDC66\uDC67]|👯â€â™€ï¸?|👯â€â™‚ï¸?|😮â€ðŸ’¨|😵â€ðŸ’«|🤼â€â™€ï¸?|🤼â€â™‚ï¸?|🧞â€â™€ï¸?|🧞â€â™‚ï¸?|🧟â€â™€ï¸?|🧟â€â™‚ï¸?|ðŸˆâ€â¬›)|[#*0-9]ï¸??⃣|(?:[©®™♟]ï¸?)|(?:\uD83C[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE1A\uDE2F\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF3\uDFF5\uDFF7]|\uD83D[\uDC3F\uDC41\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]|[‼â‰â„¹â†”-↙↩↪⌚⌛⌨ââ-â¯â±â²â¸-âºâ“‚▪▫▶◀◻-◾☀-☄☎☑☔☕☘☠☢☣☦☪☮☯☸-☺♀♂♈-♓♠♣♥♦♨♻♿⚒-⚗⚙⚛⚜⚠⚡⚧⚪⚫⚰⚱⚽⚾⛄⛅⛈â›â›‘⛓⛔⛩⛪⛰-⛵⛸⛺⛽✂✈✉âœâœ’✔✖âœâœ¡âœ³âœ´â„â‡â—â£â¤âž¡â¤´â¤µâ¬…-⬇⬛⬜ââ•ã€°ã€½ãŠ—㊙])(?:ï¸?|(?!︎))|(?:(?:\uD83C[\uDFCB\uDFCC]|\uD83D[\uDD74\uDD75\uDD90]|[â˜â›·â›¹âœŒâœ])(?:ï¸?|(?!︎))|(?:\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC69\uDC6E\uDC70-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDCAA\uDD7A\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD26\uDD30-\uDD39\uDD3D\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD\uDEC3-\uDEC5\uDEF0-\uDEF6]|[✊✋]))(?:\uD83C[\uDFFB-\uDFFF])?|(?:ðŸ´ó §ó ¢ó ¥ó ®ó §ó ¿|ðŸ´ó §ó ¢ó ³ó £ó ´ó ¿|ðŸ´ó §ó ¢ó ·ó ¬ó ³ó ¿|🇦\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|🇧\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|🇨\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF]|🇩\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|🇪\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|🇫\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|🇬\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|ðŸ‡\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|🇮\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|🇯\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|🇰\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|🇱\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|🇲\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|🇳\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|🇴🇲|🇵\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|🇶🇦|🇷\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|🇸\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|🇹\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|🇺\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|🇻\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|🇼\uD83C[\uDDEB\uDDF8]|🇽🇰|🇾\uD83C[\uDDEA\uDDF9]|🇿\uD83C[\uDDE6\uDDF2\uDDFC]|\uD83C[\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC6F\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDD-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3C\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDDE-\uDDFF\uDE70-\uDE74\uDE78-\uDE7C\uDE80-\uDE86\uDE90-\uDEAC\uDEB0-\uDEBA\uDEC0-\uDEC2\uDED0-\uDED9\uDEE0-\uDEE7]|[â©-â¬â°â³â™¾â›Žâœ…✨âŒâŽâ“-â•âž•-➗➰➿])|ï¸)",Pe="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",yn="0-9_"+Pe,fs="·",Oe="["+Pe+"0-9]",Sn="((?:https?|ftp)://|mailto:)?",Cn=Sn+"(?:"+Oe+"{1,64}(?::"+Oe+"{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}|"+Oe+"["+Pe+fs+"0-9-]{0,64}(?:\\."+Oe+"["+Pe+fs+"0-9-]{0,64}){0,10}(?:\\.(xn--[0-9a-z]{2,16}|["+Pe+`]{2,24})))(?::\\d{2,5})?(?:/(?:\\S{0,255}[^\\s.;,(\\[\\]{}<>"'])?)?`,qs="[a-zA-Z\\d_]{5,32}",bn="(?:\\s|^)((?:\\d{1,2}:)?(?:[0-5]?[0-9]):(?:[0-5][0-9]))(?:\\s|$)",_n="\\/([a-zA-Z\\d_]{1,32})(?:@("+qs+"))?(\\b|$)",oa=new RegExp("(^| )(@)("+qs+")|("+Cn+")|(\\n)|("+vn+")|(^|[\\s\\(\\]])(#["+yn+"]{2,64})|(^|\\s)"+_n+"|"+bn,"i"),ia=/^(([^<>()[\]\\.,;:\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,}))$/,aa=/(^|\s|\n)(````?)([\s\S]+?)(````?)([\s\n\.,:?!;]|$)|(^|\s|\x01)(`|~~|\*\*|__|_-_|\|\|)([^\n]+?)\7([\x01\s\.,:?!;]|$)|@(\d+)\s*\((.+?)\)|(\[(.+?)\]\((.+?)\))/m,ca={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}"},Ot={"`":"messageEntityCode","``":"messageEntityPre","**":"messageEntityBold",__:"messageEntityItalic","~~":"messageEntityStrike","_-_":"messageEntityUnderline","||":"messageEntitySpoiler"};new Set(Object.values(Ot));const Ks=new Set(["messageEntityEmoji","messageEntityLinebreak","messageEntityCaret"]),ua=new Set(Ks);for(const t in Ot)Ks.add(Ot[t]);const wn=/^\+\d+$/;function Js(t,e){$s(t)||(t="https://"+t);const s={url:t};let r,n,o;if(r=t.match(/^(?:https?:\/\/)?(?:(.+?)\.)?(?:(?:web|k|z|a)\.)?t(?:elegram)?\.me(?:\/(.+))?/)){const i=new URL(t);let a=r[1];a&&Zr.has(r[1])&&(a=void 0),a&&(i.pathname=a+(i.pathname==="/"?"":i.pathname));const c=i.pathname.slice(1),u=c.split("/");if(u[0]&&u[0][0]==="$"&&u[0].length>1)o="invoice";else if(/^\+/.test(c)&&!wn.test(c))o="joinchat";else if(u[0])switch(u[0]){case"addlist":case"joinchat":case"addstickers":case"addemoji":case"voicechat":case"invoice":case"boost":case"giftcode":if(u.length!==1&&!a){o=u[0];break}default:if(u.length<=2||u[1]?.match(/^\d+(?:\?(?:comment|thread)=\d+)?$/)||u[1]==="s"){o="im";break}break}}else t.match(/^(?:https?:\/\/)?telesco\.pe\/([^/?]+)\/(\d+)/)?o="im":(n=t.match(/tg:(?:\/\/)?(.+?)(?:\?|$)/))&&(o="tg_"+n[1]);return window[o]||(o=void 0),s.onclick=o,s}b&&(b.wrapUrl=Js);function la(t,e){Xs(t),e===void 0?t.replaceChildren():typeof e=="string"?e?t.textContent=e:t.replaceChildren():t.replaceChildren(e)}function Xs(t){t.setAttribute("dir","auto")}const ha={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",messageActionGiveawayLaunch:"BoostingGiveawayJustStarted",messageActionGiftCode:"BoostingReceivedGiftNoName",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"},da=Q?"Message.Unsupported.Mobile":"Message.Unsupported.Desktop";var ne;(t=>{t.strings=new Map,t.countriesList=[];let e,s;t.requestedServerLanguage=!1,t.isRTL=!1;function r(h){t.isRTL=h}t.setRTL=r;function n(h){t.lastRequestedLangCode=h,t.lastRequestedNormalizedLangCode=h.split("-")[0]}function o(){return s||(s=Promise.all([pe.get("langPack"),t.polyfillPromise]).then(([h])=>h?(t.lastRequestedLangCode||n(h.lang_code),C(h),h):c()).finally(()=>{s=void 0}))}t.getCacheLangPack=o;function i(){if(t.timeFormat==="h12")try{const h=m({hour:"numeric",minute:"numeric",hour12:!0}),f=new Date;f.setHours(0);const y=h.format(f);t.amPmCache.am=y.split(/\s/)[1],f.setHours(12);const p=h.format(f);t.amPmCache.pm=p.split(/\s/)[1]}catch(h){console.error("cannot get am/pm",h),t.amPmCache={am:"AM",pm:"PM"}}}function a(h,f=!!t.timeFormat&&t.timeFormat!==h){t.timeFormat=h,i(),f&&(w.clear(),Array.from(document.querySelectorAll(".i18n")).forEach(p=>{const O=t.weakMap.get(p);O instanceof D&&O.update()}))}t.setTimeFormat=a;function c(){const h=B.langPackCode;return n(h),Promise.all([U(()=>import("./lang-28d42960.js"),[],import.meta.url),U(()=>import("./langSign-6704fa93.js"),[],import.meta.url),U(()=>import("./countries-5301fc59.js"),[],import.meta.url)]).then(([f,y,p])=>{const O=[];d(f.default,O),d(y.default,O);const H={_:"langPackDifference",from_version:0,lang_code:h,strings:O,version:0,local:!0,countries:p.default};return g(H)})}t.loadLocalLangPack=c;function u(h,f){f=!0,t.requestedServerLanguage=!0;const y=S.managers;return Promise.all([y.apiManager.invokeApiCacheable("langpack.getLangPack",{lang_code:h,lang_pack:f?"web":B.langPack}),!f&&y.apiManager.invokeApiCacheable("langpack.getLangPack",{lang_code:h,lang_pack:"android"}),U(()=>import("./lang-28d42960.js"),[],import.meta.url),U(()=>import("./langSign-6704fa93.js"),[],import.meta.url),y.apiManager.invokeApiCacheable("help.getCountriesList",{lang_code:h,hash:0}),t.polyfillPromise])}t.loadLangPack=u;function l(h,f){return S.managers.apiManager.invokeApi("langpack.getStrings",{lang_pack:B.langPack,lang_code:h,keys:f})}t.getStrings=l;function d(h,f=[]){for(const y in h){const p=h[y];typeof p=="string"?f.push({_:"langPackString",key:y,value:p}):f.push({_:"langPackStringPluralized",key:y,...p})}return f}t.formatLocalStrings=d;function F(h,f){return n(h),u(h,f).then(([y,p,O,H,Y,ve])=>{let ge=[];return[O,H].forEach(dt=>{d(dt.default,ge)}),ge=ge.concat(...[y.strings,p.strings].filter(Boolean)),y.strings=ge,y.countries=Y,g(y)})}t.getLangPack=F;function g(h){return h.appVersion=B.langPackVersion,pe.set({langPack:h}).then(()=>(C(h),h))}t.saveLangPack=g,t.polyfillPromise=function(){return typeof Intl<"u"&&typeof Intl.PluralRules<"u"?Promise.resolve():U(()=>import("./pluralPolyfill-61f068d6.js"),[],import.meta.url).then(f=>{window.Intl=Object.assign(typeof Intl<"u"?Intl:{},f.default)})}();function C(h){const f=t.lastRequestedLangCode;if(h.lang_code!==f)return;try{e=new Intl.PluralRules(t.lastRequestedNormalizedLangCode)}catch(p){console.error("pluralRules error",p),e=new Intl.PluralRules(t.lastRequestedNormalizedLangCode.split("-",1)[0])}try{e=new Intl.PluralRules(h.lang_code)}catch(p){console.error("pluralRules error",p),e=new Intl.PluralRules(h.lang_code.split("-",1)[0])}t.strings.clear();for(const p of h.strings)t.strings.set(p.key,p);h.countries&&(t.countriesList.length=0,t.countriesList.push(...h.countries.countries),h.countries.countries.forEach(p=>{if(p.name){const O=p.default_name;t.strings.set(O,{_:"langPackString",key:O,value:p.name})}})),t.lastAppliedLangCode!==f&&(t.lastAppliedLangCode&&S.myId&&(S.managers.appReactionsManager.resetAvailableReactions(),S.managers.appUsersManager.indexMyself(),S.managers.dialogsStorage.indexMyDialog()),t.lastAppliedLangCode=f,w.clear(),i(),S.dispatchEvent("language_change",f)),Array.from(document.querySelectorAll(".i18n")).forEach(p=>{const O=t.weakMap.get(p);O&&O.update()})}t.applyLangPack=C;function T(h,f,y){const p=f[y.i++];Array.isArray(p)?h.push(...p):h.push(p)}function _(h,f,y={i:0}){const p=[],O=/(\*\*|__)(.+?)\1|(\n)|(\[.+?\]\(.*?\))|un\d|%\d\$.|%./g;let H=0;return h.replace(O,(Y,ve,ge,dt,ye,ns,xr)=>{if(p.push(xr.slice(H,ns)),ve){let oe;switch(ve){case"**":{oe=document.createElement("b");break}case"__":{oe=document.createElement("i");break}}oe.append(..._(ge,f,y)),p.push(oe)}else if(dt)p.push(document.createElement("br"));else if(ye){const oe=ye.lastIndexOf("]"),Br=ye.slice(1,oe),ft=ye.slice(oe+2,ye.length-1);let j;if(ft&&$s(ft)){j=document.createElement("a");const gt=Js(ft);j.href=gt.url,gt.onclick&&j.setAttribute("onclick",gt.onclick+"(this)"),j.target="_blank"}else j=f[y.i++],j instanceof DocumentFragment&&(j=j.firstChild),typeof j!="string"&&(j.textContent="");const os=_(Br,f,y);typeof j=="string"?p.push(...os):(j.append(...os),p.push(j))}else f&&T(p,f,y);return H=ns+Y.length,""}),H!==h.length&&p.push(h.slice(H)),p}t.superFormatter=_;function I(h,f=!1,y){const p=t.strings.get(h);let O;if(p)if(p._==="langPackStringPluralized"&&y?.length){let Y=y[0];typeof Y=="string"&&(Y=+Y.replace(/\D/g,""));const ve=e.select(Y);O=p[ve+"_value"]||p.other_value}else p._==="langPackString"?O=p.value:O=h;else O=h;const H=_(O,y);return f?H.map(Y=>Y instanceof Node?Y.textContent:Y).join(""):H}t.format=I,t.weakMap=new WeakMap;class L{constructor(f){this.element=f?.element||document.createElement("span"),this.element.classList.add("i18n"),this.property=f?.property,t.weakMap.set(this.element,this)}}class R extends L{constructor(f={}){super({...f,property:f.property??"innerHTML"}),f?.key&&this.update(f)}update(f){if(It(this,f),this.property==="innerHTML")this.element.textContent="",this.element.append(...I(this.key,!1,this.args));else{const y=this.element[this.property],p=I(this.key,!0,this.args);y===void 0?this.element.dataset[this.property]=p:this.element[this.property]=p}}compareAndUpdate(f){if(!(this.key===f.key&&Hs(this.args,f.args)))return this.update(f)}}t.IntlElement=R;const w=new Map;function m(h={}){const f=JSON.stringify(h);let y=w.get(f);return y||(y=new Intl.DateTimeFormat(t.lastRequestedNormalizedLangCode+"-u-hc-"+t.timeFormat,h),w.set(f,y)),y}t.getDateTimeFormat=m,t.amPmCache={am:"AM",pm:"PM"};class D extends L{constructor(f){super({...f,property:f.property??"textContent"}),Xs(this.element),f?.date&&this.update(f)}update(f){It(this,f);let y;if(this.options.hour&&this.options.minute&&Object.keys(this.options).length===2){const p=this.date.getHours();y=("0"+(t.timeFormat==="h12"?p%12||12:p)).slice(-2)+":"+("0"+this.date.getMinutes()).slice(-2),t.timeFormat==="h12"&&(y+=" "+(p<12?t.amPmCache.am:t.amPmCache.pm))}else{const p=m(this.options);y=ct(p.format(this.date))}this.element[this.property]=y}}t.IntlDateElement=D;function k(h,f){return new R({key:h,args:f}).element}t.i18n=k;function v(h){return new R(h).element}t.i18n_=v;function E(h,f,y,p){return new R({element:h,key:f,args:y,property:p}).element}t._i18n=E})(ne||(ne={}));const W=ne,Ae=ne.i18n,fa=ne.i18n_,ga=ne._i18n;function kn(t,e){const s=t.slice(0,1);for(let r=1;r<t.length;++r){const n=t.length-1===r;s.push(typeof e=="function"?e(n):e),s.push(t[r])}return s}function ma(t,e=!0,s){const r=kn(t,n=>{const o=n&&e?"AutoDownloadSettings.LastDelimeter":"AutoDownloadSettings.Delimeter";return s?ne.format(o,!0):Ae(o)});return s?r.join(""):r}b&&(b.I18n=ne);function Pn(t){return+t<0}function An(t){return+t>=0}String.prototype.toUserId=function(){return(+this).toUserId()};String.prototype.toChatId=function(){return(+this).toChatId()};String.prototype.toPeerId=function(t){return(+this).toPeerId(t)};String.prototype.isPeerId=function(){return/^[\d-]/.test(this.toString())};Number.prototype.toUserId=function(){return+this};Number.prototype.toChatId=function(){return Math.abs(this)};Number.prototype.toPeerId=function(t){return t===void 0?+this:t?-Math.abs(this):+this};Number.prototype.isPeerId=function(){return!0};[["isUser",An],["isAnyChat",Pn]].forEach(t=>{const e=Array.isArray(t)?t[0]:t,s=Array.isArray(t)?t[1]:t;String.prototype[e]=function(){return s.call(null,this.toString())},Number.prototype[e]=function(){return s.call(null,+this)}});function Tn(...t){const e=t.reduce((n,o)=>n+(o.byteLength||o.length),0),s=new Uint8Array(e);let r=0;return t.forEach(n=>{s.set(n instanceof ArrayBuffer?new Uint8Array(n):n,r),r+=n.byteLength||n.length}),s}Uint8Array.prototype.concat=function(...t){return Tn(this,...t)};Uint8Array.prototype.toJSON=function(){return[...this]};Promise.prototype.finally=Promise.prototype.finally||function(t){const e=s=>Promise.resolve(t()).then(s);return this.then(s=>e(()=>s),s=>e(()=>Promise.reject(s)))};class Ln{constructor(){this.convertPromises={}}init(){this.worker=new Worker(new URL(""+new URL("webp.worker-1d9d3eac.js",import.meta.url).href,self.location)),this.worker.addEventListener("message",e=>{const r=e.data.payload,n=this.convertPromises[r.fileName];n&&(r.bytes?n.resolve(r.bytes):n.reject(),delete this.convertPromises[r.fileName])})}postMessage(e){this.init&&(this.init(),this.init=null),this.worker.postMessage(e)}convert(e,s){if(this.convertPromises.hasOwnProperty(e))return this.convertPromises[e];const r=X();return this.postMessage({type:"convertWebp",payload:{fileName:e,bytes:s}}),this.convertPromises[e]=r}}const Zs=new Ln;b.webpWorkerController=Zs;class Mn{constructor(){this.prefix="",this.cache={},this.useStorage=!0,q.test&&(this.prefix="t_")}get(e,s=!0){if(this.cache.hasOwnProperty(e)&&s)return this.cache[e];if(this.useStorage){let r;try{r=localStorage.getItem(this.prefix+e)}catch{this.useStorage=!1}if(r!==null)try{r=JSON.parse(r)}catch{}else r=void 0;return r}}set(e,s=!1){for(const r in e)if(e.hasOwnProperty(r)){const n=e[r];if(this.cache[r]=n,this.useStorage&&!s)try{const o=JSON.stringify(n);localStorage.setItem(this.prefix+r,o)}catch{this.useStorage=!1}}}delete(e,s=!1){e=""+e,s||delete this.cache[e];try{localStorage.removeItem(this.prefix+e)}catch{}}clear(){const e=["dc","server_time_offset","xt_instance","user_auth","state_id","k_build"];for(let s=1;s<=5;++s)e.push(`dc${s}_server_salt`),e.push(`dc${s}_auth_key`);for(const s of e)this.delete(s,!0)}toggleStorage(e,s){if(this.useStorage=e,!!s)if(!e)this.clear();else return this.set(this.cache)}}const Qs=class er{constructor(){er.STORAGES.push(this),le||(this.storage=new Mn)}async proxy(e,...s){return le?Ie.getInstance().invoke("localStorageProxy",{type:e,args:s}):(s=Array.prototype.slice.call(s),this.storage[e].apply(this.storage,s))}get(e,s){return this.proxy("get",e,s)}set(e,s){return this.proxy("set",e,s)}delete(e,s){return this.proxy("delete",e,s)}clear(){return this.proxy("clear")}toggleStorage(e,s){return this.proxy("toggleStorage",e,s)}};Qs.STORAGES=[];let In=Qs;const x=new In;b.appStorage=x;class Rn{reload(){try{location.reload()}catch{}}close(){try{window.close()}catch{}}focus(){window.focus()}}const tr=new Rn;function V(t){if(t===null||typeof t!="object")return t;if(t instanceof Date)return new Date(t.getTime());if(Array.isArray(t))return t.map(n=>V(n));if(ArrayBuffer.isView(t))return t.slice();const e=new t.constructor;for(var s in t)t.hasOwnProperty(s)&&(e[s]=V(t[s]));return e}const Xe=typeof SharedWorker<"u"&&!q.noSharedWorker,On=ce?"touchstart":"mousemove";class xn extends de{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(On,()=>{this.isIdle=!1},{once:!0,passive:!0}),this.addEventListener("change",e=>{e?this.focusPromise=new Promise(s=>{this.focusResolve=s}):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 Ze=new xn,Bn=5e3,Nn=3e4,Un=2e4,Wn=Xe;class Vn extends de{constructor(){super(!1),this.log=ee("INSTANCE"),this.clearInstance=()=>{this.masterInstance&&!this.deactivated&&(this.log.warn("clear master instance"),x.delete("xt_instance"))},this.checkInstance=async(e=Ze.isIdle)=>{if(this.deactivated)return;const s=Date.now(),r={id:this.instanceId,idle:e,time:s},[n,o=B.build]=await Promise.all([x.get("xt_instance",!1),x.get("k_build",!1)]);if(o>B.build){this.masterInstance=!1,S.managers.networkerFactory.stopAll(),this.deactivateInstance("version"),ut.toggleStorages(!1,!1);return}else if(Wn){x.set({xt_instance:r});return}!e||!n||n.id===this.instanceId||n.time<s-Un?(x.set({xt_instance:r}),this.masterInstance||(this.masterInstance=!0,S.managers.networkerFactory.startAll(),this.log.warn("now master instance",r)),this.clearDeactivateTimeout()):this.masterInstance&&(this.masterInstance=!1,S.managers.networkerFactory.stopAll(),this.log.warn("now idle instance",r),this.deactivateTimeout||(this.deactivateTimeout=window.setTimeout(()=>this.deactivateInstance("tabs"),Nn)))},this.log=ee("INSTANCE"),this.instanceId=Us}get deactivatedReason(){return this.deactivated}start(){if(this.reset(),!this.started){this.started=!0,Ze.addEventListener("change",this.checkInstance),setInterval(this.checkInstance,Bn),this.checkInstance();try{document.documentElement.addEventListener("beforeunload",this.clearInstance)}catch{}}}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 Qe=new Vn;b&&(b.singleInstance=Qe);function jn(t,e){if(t!==void 0)return t=+t.toFixed(0),e?t<qe?t:t%qe:t}function Gn(t){return jn(t,!0)}const Yn=1e4;class sr extends de{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=ee("PUSH-API"),this.subscribe=()=>{this.isAvailable&&navigator.serviceWorker.ready.then(e=>{e.pushManager.subscribe({userVisibleOnly:this.userVisibleOnly}).then(s=>{this.isPushEnabled=!0,this.pushSubscriptionNotify("subscribe",s)}).catch(s=>{Notification.permission==="denied"?this.log("Permission for Notifications was denied"):(this.log("Unable to subscribe to push.",s),this.userVisibleOnly||(this.userVisibleOnly=!0,setTimeout(this.subscribe,0)))})})},this.isAliveNotify=()=>{if(!this.isAvailable||Qe.deactivatedReason)return;this.settings.baseUrl=(location.href||"").replace(/#.*$/,"");const e={},s={push_action_mute1d:Q?"PushNotification.Action.Mute1d.Mobile":"PushNotification.Action.Mute1d",push_action_settings:Q?"PushNotification.Action.Settings.Mobile":"PushNotification.Action.Settings",push_message_nopreview:"PushNotification.Message.NoPreview"};for(const r in s)e[r]=W.format(s[r],!0);this.serviceMessagePort.invokeVoid("pushPing",{localNotifications:this.localNotificationsAvailable,lang:e,settings:this.settings}),this.isAliveTO=setTimeout(this.isAliveNotify,Yn)},(!("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&&Notification.permission==="denied"&&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(s=>{this.isPushEnabled=!!s,this.pushSubscriptionNotify("init",s)}).catch(s=>{this.log.error("Error during getSubscription()",s)})})}unsubscribe(){this.isAvailable&&navigator.serviceWorker.ready.then(e=>{e.pushManager.getSubscription().then(s=>{this.isPushEnabled=!1,s&&(this.pushSubscriptionNotify("unsubscribe",s),setTimeout(()=>{s.unsubscribe().then(r=>{this.isPushEnabled=!1}).catch(r=>{this.log.error("Unsubscription error: ",r)})},3e3))}).catch(s=>{this.log.error("Error thrown while unsubscribing from push messaging.",s)})})}forceUnsubscribe(){this.isAvailable&&navigator.serviceWorker.ready.then(e=>{e.pushManager.getSubscription().then(s=>{this.log.warn("force unsubscribe",s),s&&s.unsubscribe().then(r=>{this.log.warn("force unsubscribe successful",r),this.isPushEnabled=!1}).catch(r=>{this.log.error("Unsubscription error: ",r)})}).catch(s=>{this.log.error("Error thrown while unsubscribing from push messaging.",s)})})}setSettings(e){this.settings=V(e),clearTimeout(this.isAliveTO),this.isAliveNotify()}hidePushNotifications(){this.isAvailable&&this.serviceMessagePort.invokeVoid("notificationsClear",void 0)}setUpServiceWorkerChannel(){this.isAvailable&&(this.serviceMessagePort.addEventListener("pushClick",e=>{if(Qe.deactivatedReason){tr.reload();return}this.dispatchEvent("push_notification_click",e)}),navigator.serviceWorker.ready.then(this.isAliveNotify))}pushSubscriptionNotify(e,s){if(s){const r=s.toJSON();if(!r||!r.endpoint||!r.keys||!r.keys.p256dh||!r.keys.auth){this.log.warn("Invalid push subscription",r),this.unsubscribe(),this.isAvailable=!1,this.pushSubscriptionNotify(e);return}this.log.warn("Push",e,r),this.dispatchEvent("push_"+e,{tokenType:10,tokenValue:JSON.stringify(r)})}else this.log.warn("Push",e,!1),this.dispatchEvent("push_"+e,!1)}ignorePushByMid(e,s){this.isAvailable&&this.serviceMessagePort.invokeVoid("shownNotification",e+"_"+Gn(s))}}const et=new sr;b&&(b.webPushApiManager=et);const zn=Object.freeze(Object.defineProperty({__proto__:null,WebPushApiManager:sr,default:et},Symbol.toStringTag,{value:"Module"}));function Hn(t){const e=document.createElement("script"),s=new Promise(r=>{e.onload=e.onerror=()=>{r(e)}});return e.src=t,document.body.appendChild(e),s}function $n(t){const e=Date.now();return t?e/1e3|0:e}class rr{constructor(){this.disabled=q.test||!B.domains.includes(location.hostname)}setAuthorized(e){if(!this.disabled)return x.get("tgme_sync").then(s=>{const r=$n(!0);if(e&&s?.canRedirect===e&&s.ts+86400>r)return;x.set({tgme_sync:{canRedirect:e,ts:r}});const n=`_websync_?authed=${e?"1":"0"}&version=${encodeURIComponent(B.version+" "+B.suffix)}`,i=["//telegram.me/"+n,"//t.me/"+n].map(a=>Hn(a).then(c=>{c.remove()}));return Promise.all(i)})}}const Kt=new rr;b&&(b.telegramMeWebManager=Kt);const qn=Object.freeze(Object.defineProperty({__proto__:null,TelegramMeWebManager:rr,default:Kt},Symbol.toStringTag,{value:"Module"})),Jt=typeof RTCPeerConnection<"u"&&!Ee,Kn=Jt;let je;if(!$)je=!0;else try{je=+navigator.userAgent.match(/Version\/(.+?) /)[1]>=14}catch{je=!1}const Jn=je,Xn="filter"in(document.createElement("canvas").getContext("2d")||{}),Zn=!!navigator?.geolocation?.getCurrentPosition&&!1,Qn=Jt,nr=document.createElement("canvas").toDataURL("image/webp").startsWith("data:image/webp"),Xt=new Set(["image/jpeg","image/png","image/bmp"]);nr&&Xt.add("image/webp");const Zt=document.createElement("video"),eo=!!Zt.canPlayType("video/webm")&&!$&&!Fe,or=!!Zt.canPlayType("video/quicktime")||$||Fe,to=!!Zt.canPlayType('video/mp4; codecs="hev1"'),so=Object.freeze(Object.defineProperty({__proto__:null,IS_H265_SUPPORTED:to,IS_MOV_SUPPORTED:or,IS_WEBM_SUPPORTED:eo},Symbol.toStringTag,{value:"Module"})),Qt=new Set(["image/gif","video/mp4","video/webm"]);or&&Qt.add("video/quicktime");const ro=[...Xt].concat([...Qt]),no=new Set(ro),oo=!Ee&&!1,io="getDisplayMedia"in(navigator?.mediaDevices||{}),ao=!!navigator?.vibrate,gs=document.createElement("audio"),ir=!!(gs.canPlayType&&gs.canPlayType("audio/ogg;").replace(/no/,""));let ar=!1;try{const t=document.createElement("canvas").getContext("webgl"),e=t.getExtension("WEBGL_debug_renderer_info"),s=e&&t.getParameter(e.UNMASKED_RENDERER_WEBGL)||"";(s.match(/Apple/)&&!s.match(/Apple GPU/)||t.getSupportedExtensions().indexOf("WEBGL_compressed_texture_s3tc_srgb")===-1)&&(ar=!0)}catch{}const co=ar,ms={CAN_USE_TRANSFERABLES:Jn,IS_APPLE_MX:co,IS_CALL_SUPPORTED:Kn,IS_CANVAS_FILTER_SUPPORTED:Xn,IS_EMOJI_SUPPORTED:Mt,IS_GEOLOCATION_SUPPORTED:Zn,IS_GROUP_CALL_SUPPORTED:Qn,IS_PARALLAX_SUPPORTED:oo,IS_SCREEN_SHARING_SUPPORTED:io,IS_TOUCH_SUPPORTED:ce,...so,IS_VIBRATE_SUPPORTED:ao,IS_OPUS_SUPPORTED:ir,IS_SHARED_WORKER_SUPPORTED:Xe,IS_WEBP_SUPPORTED:nr,IS_WEBRTC_SUPPORTED:Jt,IMAGE_MIME_TYPES_SUPPORTED:Xt,MEDIA_MIME_TYPES_SUPPORTED:no,VIDEO_MIME_TYPES_SUPPORTED:Qt,...Vr};function uo(){const t=document.createElement("input");t.type="time",t.value="15:00",t.style.visibility="hidden",document.body.append(t);const e=t.offsetWidth;return t.remove(),e>110?"h12":"h23"}const lo={8:new Uint8Array(1),16:new Uint16Array(1),32:new Uint32Array(1)};function tt(t){const e=lo[t];return crypto.getRandomValues(e),e[0]}function Da(){return""+tt(32)+tt(32)%16777215}const ho=B.version,fo=B.build,Ds={_:"theme",access_hash:"",id:"",settings:[{_:"themeSettings",pFlags:{},base_theme:{_:"baseThemeClassic"},accent_color:3379436,message_colors:[6072403],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}},ps=(t,e,s)=>({...Ds,name:t,settings:{...Ds.settings.find(r=>r.base_theme._===e),highlightningColor:s}}),G={allDialogsLoaded:{},pinnedOrders:{},contactsListCachedTime:0,updates:{},filtersArr:[],maxSeenMsgId:0,stateCreatedTime:Date.now(),recentEmoji:[],recentCustomEmoji:[],topPeersCache:{},recentSearch:[],version:ho,build:fo,authState:{_:Q?"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,small_queue_active_operations_max:0,large_queue_active_operations_max:0},stickers:{suggest:"all",dynamicPackOrder:!0,loop:!0},emoji:{suggest:!0,big:!0},themes:[ps("day","baseThemeClassic","hsla(86.4, 43.846153%, 45.117647%, .4)"),ps("night","baseThemeNight","hsla(299.142857, 44.166666%, 37.470588%, .4)")],theme:"system",notifications:{sound:!1},timeFormat:uo(),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,hideChatJoinRequests:{},stateId:tt(32),notifySettings:{},confirmedWebViews:[],seenTooltips:{storySound:!1}};function xe(t,e){t=t.split(" ",1)[0],e=e.split(" ",1)[0];const s=t.split("."),r=e.split(".");for(let n=0;n<s.length;++n){const o=+s[n],i=+r[n];if(o>i)return 1;if(o<i)return-1}return 0}function go(t){return typeof t=="object"&&t!==null}function cr(t,e,s,r,n,o){for(const i in t){const a=o?`${o}.${i}`:i;n?.has(a)||(typeof e[i]!=typeof t[i]?(e[i]=V(t[i]),s?.(r||i)):go(t[i])&&cr(t[i],e[i],s,r||i,n,a))}}function mo(t,e,s){const r=performance.now();return(s||console).warn(Je(),"start",e),t.then(()=>{(s||console).warn(Je(),"end",e,performance.now()-r)}),t}function Do(t){return(...e)=>mo(...e,t)}const po=24*60*60*1e3,Be=G.version,Ce=G.build,Ne=Object.keys(G),Fo=["contactsListCachedTime","stateCreatedTime","maxSeenMsgId","filtersArr"];async function Eo(){const t=ee("STATE-LOADER",Ht.Error),e=performance.now(),s=Do(t),r=Ne.map(D=>s(pe.get(D),"state "+D)).concat(s(x.get("user_auth"),"auth"),s(x.get("state_id"),"auth"),s(x.get("k_build"),"auth"),s(x.get("auth_key_fingerprint"),"auth"),s(x.get(`dc${B.baseDcId}_auth_key`),"auth")).concat(s(pe.get("user_auth"),"old auth")),n=await Promise.all(r);t.warn("promises",performance.now()-e);const o=[],i=(D,k)=>{c[D]=k,o.push(D)},a=D=>{o.length=0,c=D,o.push(...Object.keys(c))};let c={};for(let D=0,k=Ne.length;D<k;++D){const v=Ne[D],E=n[D];E!==void 0?c[v]=E:i(v,V(G[v]))}n.splice(0,Ne.length);let u=n.shift();const l=n.shift(),d=n.shift(),F=n.shift(),g=n.shift(),C=n.shift();if(!u&&C){u=C;const D=["dc","server_time_offset","xt_instance"];for(let E=1;E<=5;++E)D.push(`dc${E}_server_salt`),D.push(`dc${E}_auth_key`);const k=await Promise.all(D.map(E=>pe.get(E)));D.push("user_auth"),k.push(typeof u=="number"||typeof u=="string"?{dcID:k[0]||B.baseDcId,date:Date.now()/1e3|0,id:u.toPeerId(!1)}:u);const v={};D.forEach((E,h)=>{v[E]=k[h]}),await x.set(v)}u&&(c.authState={_:"authStateSignedIn"},S.dispatchEvent("user_auth",typeof u=="number"||typeof u=="string"?{dcID:0,date:Date.now()/1e3|0,id:u.toPeerId(!1)}:u));const T=new Set,_=D=>{D.push("authState","stateId");const k=new Map(D.map(E=>[E,c[E]]));c=V(G),k.forEach((E,h)=>{c[h]=E});const v=["chats","dialogs","users"];for(const E of v)T.add(E);a(c)};if(c.stateId!==l&&(l!==void 0&&_([]),await x.set({state_id:c.stateId})),g){const D=g.slice(0,8);F?F!==D&&_([]):_(["settings"]),F!==D&&await x.set({auth_key_fingerprint:D})}const I=Date.now();c.stateCreatedTime+po<I&&(ue&&t("will refresh state",c.stateCreatedTime,I),(k=>{k.forEach(v=>{i(v,V(G[v]))})})(Fo));const L=c.settings.autoDownload;if(L?.private!==void 0){const D=["contacts","private","groups","channels"];["photo","video","file"].forEach(v=>{const E=L[v]={};D.forEach(h=>{E[h]=L[h]})}),D.forEach(v=>{delete L[v]}),i("settings",c.settings)}cr(G,c,D=>{i(D,c[D])},void 0,new Set(["settings.themes"]));let w,m;if(c.version!==Be||c.build!==Ce){if(c.build<322&&(i("allDialogsLoaded",V(G.allDialogsLoaded)),i("pinnedOrders",V(G.pinnedOrders)),i("filtersArr",V(G.filtersArr)),T.add("dialogs")),xe(c.version,"1.7.1")===-1){let D=!1;if(xe(c.version,"1.3.0")===-1)D=!0,c.settings.theme=V(G.settings.theme),c.settings.themes=V(G.settings.themes);else if(xe(c.version,"1.7.1")===-1){D=!0;const k=c.settings.themes;c.settings.themes=V(G.settings.themes);try{k.forEach(v=>{const E=v.background;if(!E)return;const h=c.settings.themes.find(p=>p.name===v.name);h.settings.highlightningColor=E.highlightningColor;const f=p=>p&&parseInt(p.slice(1),16),y=(E.color||"").split(",").map(f);if(E.color&&!E.slug)h.settings.wallpaper={_:"wallPaperNoFile",id:0,pFlags:{},settings:{_:"wallPaperSettings",pFlags:{}}};else{const p={_:"wallPaper",id:0,access_hash:0,slug:E.slug,document:{},pFlags:{},settings:{_:"wallPaperSettings",pFlags:{}}},O=p.settings;h.settings.wallpaper=p,E.slug&&!E.color?O.pFlags.blur=E.blur||void 0:E.intensity&&(O.intensity=E.intensity,p.pFlags.pattern=!0,p.pFlags.dark=E.intensity<0||void 0)}if(y.length){const p=h.settings.wallpaper.settings;p.background_color=y[0],p.second_background_color=y[1],p.third_background_color=y[2],p.fourth_background_color=y[3]}})}catch(v){console.error("migrating themes error",v)}}D&&i("settings",c.settings)}c.build<309&&(c.settings.liteMode.animations=!c.settings.animationsEnabled,c.settings.liteMode.video=!c.settings.autoPlay.videos,c.settings.liteMode.gif=!c.settings.autoPlay.gifs),c.build<312&&typeof c.settings.stickers.suggest=="boolean"&&(c.settings.stickers.suggest=c.settings.stickers.suggest?"all":"none"),xe(c.version,Be)!==0&&(w=Be,m=c.version),i("version",Be),i("build",Ce)}return d!==Ce&&(!d||d<Ce)&&x.set({k_build:Ce}),S.settings=c.settings,ue&&t("state res",c,V(c)),t.warn("total",performance.now()-e),{state:c,resetStorages:T,newVersion:w,oldVersion:m,pushedKeys:o}}let vo;function yo(){return vo??(vo=Eo())}class So{constructor(){this.sampleRate=48e3,this.tasks=[],this.keepAlive=!1,this.log=ee("OPUS",Ht.Error)}isPlaySupported(){return ir}loadWavWorker(){this.wavWorker||(this.wavWorker=new Worker("waveWorker.min.js"),this.wavWorker.addEventListener("message",e=>{const s=e.data;if(this.log("[WAV] got message:",s),s&&s.page){const r=s.page;this.onTaskEnd(this.tasks.shift(),r)}}))}loadWorker(){this.worker||(this.worker=new Worker("decoderWorker.min.js"),this.worker.addEventListener("message",e=>{const s=e.data;this.log("[DECODER] got message",s),s.type==="done"?(this.wavWorker.postMessage({command:"done"}),s.waveform&&(this.tasks[0].waveform=s.waveform)):this.wavWorker.postMessage({command:"encode",buffers:e.data},$?void 0:s.map(r=>r.buffer))}))}setKeepAlive(e){this.keepAlive=e,this.keepAlive?(this.loadWorker(),this.loadWavWorker()):this.tasks.length||this.terminateWorkers()}onTaskEnd(e,s){s?(clearTimeout(e.timeout),e.callback.resolve({bytes:s,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},$?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,s){return new Promise((r,n)=>{const o={pages:e,withWaveform:s,callback:{resolve:r,reject:n},timeout:0};this.loadWorker(),this.loadWavWorker(),this.tasks.push(o)===1&&this.executeNewTask(o)})}async decode(e,s=!1){return this.pushDecodeTask(e,s).then(async r=>{const n=new Blob([r.bytes],{type:"audio/wav"});return{url:await ut.invoke("createObjectURL",n),waveform:r.waveform}})}}const ur=new So;b.opusDecodeController=ur;class Co extends $t{constructor(){super("CRYPTO"),this.lastIndex=-1}invokeCryptoNew({method:e,args:s,transfer:r}){const n={method:e,args:s},o=this.listeners.invoke;if(o?.length){let a=o[0].callback(n);return!le&&!(a instanceof Promise)&&(a=Promise.resolve(a)),a}const i=e==="aes-encrypt"||e==="aes-decrypt"?this.lastIndex=(this.lastIndex+1)%this.sendPorts.length:0;return this.invoke("invoke",n,void 0,this.sendPorts[i],r)}invokeCrypto(e,...s){return this.invokeCryptoNew({method:e,args:s})}}const Ge=new Co;b&&(b.cryptoMessagePort=Ge);function bo(t){return["image/jpeg","image/png","image/gif","image/svg+xml","image/webp","image/bmp","video/mp4","video/webm","video/quicktime","audio/ogg","audio/mpeg","audio/mp4","audio/wav","application/json","application/pdf"].indexOf(t)===-1?"application/octet-stream":t}function lr(t,e=""){Array.isArray(t)||(t=[t]);const s=bo(e);return new Blob(t,{type:s})}class _o{constructor(e,s,r){this.mimeType=e,this.size=s,this.saveFileCallback=r,this.bytes=new Uint8Array(s)}async write(e,s){const r=s+e.byteLength;if(r>this.bytes.byteLength){const n=new Uint8Array(r);n.set(this.bytes,0),this.bytes=n}this.bytes.set(e,s)}truncate(){this.bytes=new Uint8Array}trim(e){this.bytes=this.bytes.slice(0,e)}finalize(e=!0){const s=lr(this.bytes,this.mimeType);return e&&this.saveFileCallback&&this.saveFileCallback(s),s}getParts(){return this.bytes}replaceParts(e){this.bytes=e}}const hr=class Ye{constructor(e){this.dbName=e,this.useStorage=!0,q.test&&(this.dbName+="_test"),Ye.STORAGES.length&&(this.useStorage=Ye.STORAGES[0].useStorage),this.openDatabase(),Ye.STORAGES.push(this)}openDatabase(){return this.openDbPromise??(this.openDbPromise=caches.open(this.dbName))}delete(e){return this.timeoutOperation(s=>s.delete("/"+e))}deleteAll(){return caches.delete(this.dbName)}get(e){return this.timeoutOperation(s=>s.match("/"+e))}save(e,s){return this.timeoutOperation(r=>r.put("/"+e,s))}getFile(e,s="blob"){return this.get(e).then(r=>{if(!r)throw Ke("NO_ENTRY_FOUND");return r[s]()})}saveFile(e,s){s instanceof Blob||(s=lr(s));const r=new Response(s,{headers:{"Content-Length":""+s.size}});return this.save(e,r).then(()=>s)}timeoutOperation(e){return this.useStorage?new Promise(async(s,r)=>{let n=!1;const o=setTimeout(()=>{r(),n=!0},15e3);try{const i=await this.openDatabase();if(!i)throw this.useStorage=!1,this.openDbPromise=void 0,"no cache?";const a=await e(i);if(n)return;s(a)}catch(i){r(i)}clearTimeout(o)}):Promise.reject(Ke("STORAGE_OFFLINE"))}prepareWriting(e,s,r){return{deferred:X(),getWriter:()=>new _o(r,s,o=>this.saveFile(e,o).catch(()=>o))}}static toggleStorage(e,s){return Promise.all(this.STORAGES.map(r=>{if(r.useStorage=e,!!s&&!e)return r.deleteAll()}))}};hr.STORAGES=[];let wo=hr;function Fs(t,e){return Promise.all([qt.toggleStorage(t,e),wo.toggleStorage(t,e),x.toggleStorage(t,e)]).then($e,$e)}class ko extends $t{constructor(){super("SERVICE"),b&&(b.serviceMessagePort=this)}}const Po=""+new URL("sw-12f1d2a0.js",import.meta.url).href,dr="";function Es(...t){return t.join(dr)}function Ao(t,e,s,r){const n=e.split(dr),o=n.length;let i=t;for(let c=0;c<o-1;++c){const u=n[c];i=i[u]??(i[u]={})}const a=n[o-1];s===void 0&&r?delete i[a]:i[a]=s}const ie="_";function To(t,e){const s="",r=s[s.length-1]||"";let n;switch(t._){case"inputPhotoFileLocation":{n=["photo",s[0],t.id,t.thumb_size].filter(Boolean).join(ie);break}case"inputDocumentFileLocation":{n=["document",s[0],t.id,t.thumb_size].filter(Boolean).join(ie);break}case"inputPeerPhotoFileLocation":n=["peerPhoto",t.photo_id,t.pFlags.big?"big":"small"].join(ie);break;case"inputStickerSetThumb":{n=["stickerSetThumb",t.stickerset.id||t.stickerset.short_name||t.stickerset.emoticon||t.stickerset._,t.thumb_version].join(ie);break}case"inputFileLocation":{n=[t.volume_id,t.local_id].join(ie);break}case"inputWebFileLocation":{n=["webFile",t.url].join(ie);break}case"inputWebFileGeoPointLocation":{const o=t.geo_point;n=["geoPoint",o.lat,o.long,t.w,t.h,t.zoom,t.scale].join(ie);break}default:{console.error("Unrecognized location:",t),n="";break}}return n+(e?.downloadId?"_download":"")+(r&&"."+r)}function Lo(t){return t?._.includes("inputWebFile")}function Mo(t){return Lo(t)?To(t):t._+(t.id??t.url)}function Io(t){return{downloaded:0,url:"",type:t}}function Ro(t,e){return t+(e!==void 0?"-"+e:"")}function Oo(t,e){return t instanceof Promise?t.then(e):e(t)}function vs(t){return typeof t=="number"&&t<qe}class xo extends Ie{constructor(){super(),this.onMirrorTask=e=>{var i;const{name:s,key:r,value:n}=e;if(this.processMirrorTaskMap[s]?.(e),!e.hasOwnProperty("key")){this.mirrors[s]=n;return}const o=(i=this.mirrors)[s]??(i[s]={});Ao(o,r,n,!0)},this.mirrors={state:void 0,thumbs:{},stickerThumbs:{},availableReactions:void 0,messages:{},groupedMessages:{},peers:{},avatars:{}},this.processMirrorTaskMap={messages:e=>{var i;const s=e.value;let r,n;if(s)r=s.mid,n=s.grouped_id;else{const[a,c]=e.key.split(".");r=+c;const u=this.mirrors.messages[a]?.[r];if(!u)return;n=u.grouped_id}if(!n)return;const o=(i=this.mirrors.groupedMessages)[n]??(i[n]=new Map);e.value?o.set(r,s):(o.delete(r),o.size||delete this.mirrors.groupedMessages[n])}},this.tabState={chatPeerIds:[],idleStartTime:0},this.log("constructor"),this.registerWorker(),this.registerServiceWorker(),this.registerCryptoWorker(),this.addMultipleEventsListeners({convertWebp:({fileName:e,bytes:s})=>Zs.convert(e,s),convertOpus:({fileName:e,bytes:s})=>ur.pushDecodeTask(s,!1).then(r=>r.bytes),event:({name:e,args:s})=>{S.dispatchEventSingle(e,...s)},localStorageProxy:e=>{const s=e;return x[s.type](...s.args)},mirror:this.onMirrorTask}),S.addEventListener("language_change",e=>{S.managers.networkerFactory.setLanguage(e),S.managers.appAttachMenuBotsManager.onLanguageChange()}),window.addEventListener("online",()=>{S.managers.networkerFactory.forceReconnectTimeout()}),S.addEventListener("logging_out",()=>{const e=["cachedFiles","cachedStreamChunks"];Promise.all([Fs(!1,!0),x.clear(),Promise.race([Kt.setAuthorized(!1),zt(3e3)]),et.forceUnsubscribe(),Promise.all(e.map(s=>caches.delete(s)))]).finally(()=>{tr.reload()})}),Ze.addEventListener("change",e=>{this.updateTabStateIdle(e)}),this.updateTabStateIdle(Ze.isIdle),this.log("Passing environment:",ms),this.invoke("environment",ms)}pingServiceWorkerWithIframe(){if(this.pingServiceWorkerPromise)return this.pingServiceWorkerPromise;const e=this.pingServiceWorkerPromise=X(),s=document.createElement("iframe");s.hidden=!0;const r=()=>{setTimeout(()=>{this.pingServiceWorkerPromise=void 0},1e4),clearTimeout(n),s.remove(),s.removeEventListener("load",r),s.removeEventListener("error",r),e.resolve()};s.addEventListener("load",r),s.addEventListener("error",r),s.src="ping/"+(Math.random()*4294967295|0)+".nocache",document.body.append(s);const n=window.setTimeout(r,1e3);return e}attachServiceWorker(e){if(this.lastServiceWorker===e){this.log.warn("trying to attach same service worker");return}this.lastServiceWorker&&this.serviceMessagePort.detachPort(this.lastServiceWorker),this.serviceMessagePort.attachSendPort(this.lastServiceWorker=e),this.serviceMessagePort.invokeVoid("hello",void 0)}_registerServiceWorker(){navigator.serviceWorker.register(Po,{type:"module",scope:"./"}).then(e=>{this.log("SW registered",e);const s=new URL(window.location.href),r="swfix",n=+s.searchParams.get(r)||0;if(e.active&&!navigator.serviceWorker.controller){if(n>=3)throw new Error("no controller");return e.unregister().then(()=>{s.searchParams.set(r,""+(n+1)),window.location.href=s.toString()})}n&&(s.searchParams.delete(r),history.pushState(void 0,"",s)),(e.installing||e.waiting||e.active).addEventListener("statechange",a=>{this.log("SW statechange",a)});const i=navigator.serviceWorker.controller||e.installing||e.waiting||e.active;this.attachServiceWorker(i)}).catch(e=>{this.log.error("SW registration failed!",e),this.invokeVoid("serviceWorkerOnline",!1)})}registerServiceWorker(){if(!("serviceWorker"in navigator))return;this.serviceMessagePort=et.serviceMessagePort=new ko;const e=navigator.serviceWorker;this._registerServiceWorker(),e.addEventListener("controllerchange",()=>{this.log.warn("controllerchange");const s=e.controller;this.attachServiceWorker(s),s.addEventListener("error",r=>{this.log.error("controller error:",r)})}),this.serviceMessagePort.attachListenPort(e),this.serviceMessagePort.addMultipleEventsListeners({port:(s,r,n)=>{this.invokeVoid("serviceWorkerPort",void 0,void 0,[n.ports[0]])},hello:(s,r)=>{this.serviceMessagePort.resendLockTask(r)},share:s=>{this.log("will try to share something"),this.share=s}}),e.addEventListener("messageerror",s=>{this.log.error("SW messageerror:",s)})}async registerCryptoWorker(){const e=g=>fetch(g).then(C=>C.text()).then(C=>{const T=location.pathname.split("/");T[T.length-1]="";const _=location.origin+T.join("/");return C=C.replace(/(import (?:.+? from )?['"])\//g,"$1"+_),new Blob([C],{type:"application/javascript"})}),s={construct(g,C){return{url:Bs(C[0]).toString()}}},r=[Worker,typeof SharedWorker<"u"&&SharedWorker].filter(Boolean);r.forEach(g=>window[g.name]=new Proxy(g,s));const n=new Worker(new URL(""+new URL("crypto.worker-6a71e9eb.js",import.meta.url).href,self.location),{type:"module"});r.forEach(g=>window[g.name]=g);const o=n.url,i=g=>new c(g,{type:"module"}),a=g=>this.attachWorkerToPort(g,Ge,"crypto"),c=Xe?SharedWorker:Worker;Ge.addEventListener("port",(g,C,T)=>{this.invokeVoid("cryptoPort",void 0,void 0,[T.ports[0]])});const u=i(o);a(u);const l=await e(o);(await this.invoke("createProxyWorkerURLs",{originalUrl:o,blob:l})).slice(1).map(i).forEach(a)}registerWorker(){let e;Xe?e=new SharedWorker(new URL(""+new URL("mtproto.worker-ed5d72e3.js",import.meta.url).href,self.location),{type:"module"}):e=new Worker(new URL(""+new URL("mtproto.worker-ed5d72e3.js",import.meta.url).href,self.location),{type:"module"}),this.onWorkerFirstMessage(e)}attachWorkerToPort(e,s,r){const n=e.port||e;s.attachPort(n),e.addEventListener("error",o=>{this.log.error(r,"worker error",o)})}onWorkerFirstMessage(e){this.log("set webWorker"),this.attachWorkerToPort(e,this,"mtproto")}loadState(){return Promise.all([yo().then(e=>(this.newVersion=e.newVersion,this.oldVersion=e.oldVersion,this.mirrors.state=e.state,e))])}sendState(){return this.loadState().then(e=>{const[s]=e;return this.invoke("state",{...s,userId:S.myId.toUserId()}),e})}invokeCrypto(e,...s){return Ge.invokeCrypto(e,...s)}async toggleStorages(e,s){await Fs(e,s),this.invoke("toggleStorages",{enabled:e,clearWrite:s}),this.serviceMessagePort?.invokeVoid("toggleStorages",{enabled:e,clearWrite:s})}async getMirror(e){return this.mirrors[e]}getState(){return this.getMirror("state")}getCacheContext(e,s=Xr,r=Mo(e)){return this.mirrors.thumbs[r]?.[s]||Io(s)}getStickerCachedThumb(e,s){const r=Ro(e,s);return this.mirrors.stickerThumbs[r]}getAvailableReactions(){var e;return(e=this.mirrors).availableReactions||(e.availableReactions=S.managers.appReactionsManager.getAvailableReactions())}getReaction(e){return Oo(this.getAvailableReactions(),s=>s.find(r=>r.reaction===e))}async getMessageFromStorage(e,s){return e.endsWith("history")&&vs(s)&&(e=this.getGlobalHistoryMessagesStorage()),this.mirrors.messages[e]?.[s]}getGroupsFirstMessage(e){if(!e?.grouped_id)return e;const s=this.mirrors.groupedMessages[e.grouped_id];let r=Number.MAX_SAFE_INTEGER;for(const[n,o]of s)o.mid<r&&(r=o.mid);return s.get(r)}getHistoryMessagesStorage(e){return`${e}_history`}getGlobalHistoryMessagesStorage(){return this.getHistoryMessagesStorage(Ns)}getMessageById(e){if(vs(e))return this.getMessageFromStorage(this.getGlobalHistoryMessagesStorage(),e)}getMessageByPeer(e,s){return e?this.getMessageFromStorage(this.getHistoryMessagesStorage(e),s):this.getMessageById(s)}getPeer(e){return this.mirrors.peers[e]}getUser(e){return this.mirrors.peers[e.toPeerId(!1)]}getChat(e){return this.mirrors.peers[e.toPeerId(!0)]}isForum(e){return!!this.getPeer(e)?.pFlags?.forum}isAvatarCached(e,s){const r=this.mirrors.avatars[e];return s===void 0?!!r:!!(r&&r[s]&&!(r[s]instanceof Promise))}loadAvatar(e,s,r){var o;const n=(o=this.mirrors.avatars)[e]??(o[e]={});return n[r]??(n[r]=S.managers.appAvatarsManager.loadAvatar(e,s,r))}updateTabState(e,s){this.tabState[e]=s,this.invokeVoid("tabState",this.tabState)}updateTabStateIdle(e){this.updateTabState("idleStartTime",e?Date.now():0)}}const fr=new xo;b.apiManagerProxy=fr;const ut=fr,Bo={};function No(t,e){return new Proxy({},{get:(r,n,o)=>(...i)=>{const a=ut.invoke("manager",{name:t,method:n,args:i},e);return ue&&Bo[t]?.has(n)&&console.warn("manager request",t,n,i,e),a}})}function ys(t,e){return new Proxy(t,{get:(s,r,n)=>s[r]??(s[r]=No(r,e))})}let be;function Uo(){return be||(be=ys({},!1),be.acknowledged=ys({},!0),be)}function gr(t,e,s){return Math.min(s,Math.max(e,t))}function re(t,e,s){t/=255,e/=255,s/=255;const r=Math.max(t,e,s),n=r-Math.min(t,e,s),o=n&&(r===t?(e-s)/n:r==e?2+(s-t)/n:4+(t-e)/n);return[60*(o<0?o+6:o),r&&n/r,r]}function es(t,e,s){const r=(n,o=(n+t/60)%6)=>Math.round((s-s*e*Math.max(Math.min(o,4-o,1),0))*255);return[r(5),r(3),r(1)]}function xt(t,e,s,r=1){t/=255,e/=255,s/=255;const n=Math.max(t,e,s),o=Math.min(t,e,s);let i,a;const c=(n+o)/2;if(n===o)i=a=0;else{const u=n-o;switch(a=c>.5?u/(2-n-o):u/(n+o),n){case t:i=(e-s)/u+(e<s?6:0);break;case e:i=(s-t)/u+2;break;case s:i=(t-e)/u+4;break}i/=6}return{h:i*360,s:a*100,l:c*100,a:r}}function mr(t,e,s,r){t/=360,e/=100,s/=100;let n,o,i;if(e===0)n=o=i=s;else{const a=function(d,F,g){return g<0&&(g+=1),g>1&&(g-=1),g<.16666666666666666?d+(F-d)*6*g:g<.5?F:g<.6666666666666666?d+(F-d)*(.6666666666666666-g)*6:d},c=s<.5?s*(1+e):s+e-s*e,u=2*s-c;n=a(u,c,t+1/3),o=a(u,c,t),i=a(u,c,t-1/3)}return[n,o,i,r].map(a=>Math.round(a*255))}function Dr(t){const e=t.slice(5,-1).split(", "),s=+e.pop(),r=e.map(n=>n.endsWith("%")?+n.slice(0,-1):+n);return mr(r[0],r[1],r[2],s)}function pr(t){const e=[],s=t[0]==="#"?1:0;if(t.length===5+s&&(t=(s?"#":"")+"0"+t.slice(s)),t.length===3+s)for(let r=s;r<t.length;++r)e.push(parseInt(t[r]+t[r],16));else if(t.length===4+s){for(let r=s;r<t.length-1;++r)e.push(parseInt(t[r]+t[r],16));e.push(parseInt(t[t.length-1],16))}else for(let r=s;r<t.length;r+=2)e.push(parseInt(t.slice(r,r+2),16));return e}function se(t){return pr(t.slice(0,7))}function pa(t){const e=pr(t);return xt(e[0],e[1],e[2],e[3])}function ke(t){return"#"+t.map(e=>("0"+e.toString(16)).slice(-2)).join("")}function Wo(t){return ke(Dr(t))}function Vo(t){return Wo(t).slice(0,-2)}function St(t,e,s){const r=new Array(3);for(let n=0;n<3;++n){const o=t[n],i=e[n];r[n]=Math.floor(i+(o-i)*s)}return r}function Ss(t){return(t[0]*.2126+t[1]*.7152+t[2]*.0722)/255}function jo(t,e){return t.map((s,r)=>Math.round((s+e[r])/2))}function Go(t,e,s){const r=re(...e),n=re(...s),o=Math.min(1.5*r[1]/t[1],1);return r[0]=Math.min(360,n[0]-r[0]+t[0]),r[1]=Math.min(1,n[1]*t[1]/r[1]),r[2]=Math.min(1,(n[2]/r[2]+o-1)*t[2]/o),r[2]<.3?s:es(...r)}function Yo(t,e,s,r){const n=re(...s);if(Math.min(Math.abs(n[0]-t[0]),Math.abs(n[0]-t[0]-360))>30)return s;const i=t[1]?Math.min(1.5*n[1]/t[1],1):0;n[0]=Math.min(360,n[0]+e[0]-t[0]),n[1]=t[1]?Math.min(1,n[1]*e[1]/t[1]):0,n[2]=t[2]?Math.min(1,n[2]*(1-i+i*e[2]/t[2])):0;let a=es(...n);const c=Ss(s),u=Ss(a);if(r?c>u:c<u){const F=.4*c/u+.6;a=zo(a,F)}return a}function zo(t,e){return t.map(s=>gr(Math.round(s*e),0,255))}function Fr(t){const e=(t<0?16777215+t:t).toString(16);return"#"+(e.length>=6?e:"0".repeat(6-e.length)+e)}function Ue(t){return se(Fr(t))}function Fa(t){return t.settings?[t.settings.background_color,t.settings.second_background_color,t.settings.third_background_color,t.settings.fourth_background_color].filter(Boolean).map(Fr).join(","):""}function Ea(t,e){const s=t[3];return t.slice(0,3).map((r,n)=>gr(Math.round((s*(r/255)+s*(e[n]/255))*255),0,255))}function va(t){const[e,s,r]=t;return .2126*e/255+.7152*s/255+.0722*r/255}function ya(t){return t>.5?[0,0,0]:[255,255,255]}function Sa(t,e){const s=t>.5?0:1,r=(t-s+e)/e;return+Math.max(.5,Math.min(.64,r)).toFixed(2)}function Er(t,e,s,r,n=!0){if(t<s&&e<r&&n)return A(t,e);let o=s,i=r;return t/e>s/r?i=e*s/t|0:(o=t*r/e|0,o>s&&(i=i*s/o|0,o=s)),n&&o>=t&&i>=e&&(o=t,i=e),A(o,i)}b.calcImageInBox=Er;class Ho{constructor(e=0,s=e){this.width=e,this.height=s}aspect(e,s){return Er(this.width,this.height,e.width,e.height,s)}aspectFitted(e){return this.aspect(e,!0)}aspectCovered(e){return this.aspect(e,!1)}}function A(t,e){return new Ho(t,e)}var $o=(t=>(t[t.mobile=0]="mobile",t[t.medium=1]="medium",t[t.large=2]="large",t))($o||{});const qo=600,Ko=1275,Jo=1680,Cs=A(20,20),bs=A(36,36),_s=A(18,18);class Xo extends de{constructor(){super(),this.screenSizes=[{key:0,value:qo},{key:1,value:Ko},{key:2,value:Jo}],this.sizes={handhelds:{regular:A(270,270),webpage:A(270,200),album:A(270,0),esgSticker:A(68,68),animatedSticker:A(180,180),staticSticker:A(180,180),emojiSticker:A(112,112),poll:A(240,0),round:A(240,240),documentName:A(200,0),invoice:A(270,270),extendedInvoice:A(270,270),customEmoji:Cs,esgCustomEmoji:bs,emojiStatus:_s,popupSticker:A(68,68)},desktop:{regular:A(420,340),webpage:A(420,340),album:A(420,0),esgSticker:A(72,72),animatedSticker:A(200,200),staticSticker:A(200,200),emojiSticker:A(112,112),poll:A(330,0),round:A(280,280),documentName:A(240,0),invoice:A(320,320),extendedInvoice:A(420,340),customEmoji:Cs,esgCustomEmoji:bs,emojiStatus:_s,popupSticker:A(80,80)}},this.isMobile=!1,this.handleResize=()=>{const e=window.innerWidth;let s=this.screenSizes[0].key;for(let n=this.screenSizes.length-1;n>=0;--n)if(this.screenSizes[n].value<e){s=(this.screenSizes[n+1]||this.screenSizes[n]).key;break}const r=this.activeScreen;this.activeScreen=s,this.isMobile=this.activeScreen===0,this.active=this.isMobile?this.sizes.handhelds:this.sizes.desktop,r!==s&&r!==void 0&&this.dispatchEvent("changeScreen",r,s),r!==void 0&&this.dispatchEvent("resize")},window.addEventListener("resize",()=>{this.rAF&&window.cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{this.handleResize(),this.rAF=0})}),this.handleResize()}}const vr=new Xo;b.mediaSizes=vr;class Zo{constructor(){this.resetCache=()=>{this.computedStyle=void 0;const e=this.cache;this.cache={};for(const s in e)this.getProperty(s)},this.cache={},this.nightElement=document.createElement("div"),this.nightElement.className="night",this.nightElement.style.display="none",document.body.append(this.nightElement),S.addEventListener("theme_changed",this.resetCache),vr.addEventListener("resize",this.resetCache)}getProperty(e,s){const r=this.cache[e],n=s?1:0;if(r?.[n])return r[n];this.computedStyle??(this.computedStyle=window.getComputedStyle(document.documentElement)),this.nightComputedStyle??(this.nightComputedStyle=window.getComputedStyle(this.nightElement));const o=(s?this.nightComputedStyle:this.computedStyle).getPropertyValue("--"+e).trim();return this.setPropertyCache(e,o,s)}getPropertyAsSize(e){const s=this.getProperty(e);let r;return s[s.length-1]==="%"||(s.indexOf("rem")?r=+s.replace("rem","")*16:r=+s.replace("px","")),r}setPropertyCache(e,s,r){var n;return((n=this.cache)[e]??(n[e]=[]))[r?1:0]=s}}const Bt=new Zo;b&&(b.customProperties=Bt);const Ca={context:void 0,registry:void 0},Qo=(t,e)=>t===e,st=Symbol("solid-proxy"),ei=Symbol("solid-track"),rt={equals:Qo};let yr=_r;const te=1,nt=2,Sr={owned:null,cleanups:null,context:null,owner:null},Ct={};var P=null;let bt=null,M=null,N=null,Z=null,lt=0;const[ti,ba]=ae(!1);function _t(t,e){const s=M,r=P,n=t.length===0,o=e===void 0?r:e,i=n?Sr:{owned:null,cleanups:null,context:o?o.context:null,owner:o},a=n?t:()=>t(()=>z(()=>ht(i)));P=i,M=null;try{return J(a,!0)}finally{M=s,P=r}}function ae(t,e){e=e?Object.assign({},rt,e):rt;const s={value:t,observers:null,observerSlots:null,comparator:e.equals||void 0},r=n=>(typeof n=="function"&&(n=n(s.value)),br(s,n));return[Cr.bind(s),r]}function ws(t,e,s){const r=Re(t,e,!0,te);fe(r)}function si(t,e,s){const r=Re(t,e,!1,te);fe(r)}function ri(t,e,s){yr=hi;const r=Re(t,e,!1,te);(!s||!s.render)&&(r.user=!0),Z?Z.push(r):fe(r)}function _a(t,e){let s;const r=Re(()=>{s?s():z(t),s=void 0},void 0,!1,0);return r.user=!0,n=>{s=n,fe(r)}}function he(t,e,s){s=s?Object.assign({},rt,s):rt;const r=Re(t,e,!0,0);return r.observers=null,r.observerSlots=null,r.comparator=s.equals||void 0,fe(r),Cr.bind(r)}function ni(t){return t&&typeof t=="object"&&"then"in t}function wa(t,e,s){let r,n,o;arguments.length===2&&typeof e=="object"||arguments.length===1?(r=!0,n=t,o=e||{}):(r=t,n=e,o=s||{});let i=null,a=Ct,c=!1,u="initialValue"in o,l=typeof r=="function"&&he(r);const d=new Set,[F,g]=(o.storage||ae)(o.initialValue),[C,T]=ae(void 0),[_,I]=ae(void 0,{equals:!1}),[L,R]=ae(u?"ready":"unresolved");function w(v,E,h,f){return i===v&&(i=null,f!==void 0&&(u=!0),(v===a||E===a)&&o.onHydrated&&queueMicrotask(()=>o.onHydrated(f,{value:E})),a=Ct,m(E,h)),E}function m(v,E){J(()=>{E===void 0&&g(()=>v),R(E!==void 0?"errored":u?"ready":"unresolved"),T(E);for(const h of d.keys())h.decrement();d.clear()},!1)}function D(){const v=ci,E=F(),h=C();if(h!==void 0&&!i)throw h;return M&&!M.user&&v&&ws(()=>{_(),i&&(v.resolved||d.has(v)||(v.increment(),d.add(v)))}),E}function k(v=!0){if(v!==!1&&c)return;c=!1;const E=l?l():r;if(E==null||E===!1){w(i,z(F));return}const h=a!==Ct?a:z(()=>n(E,{value:F(),refetching:v}));return ni(h)?(i=h,c=!0,queueMicrotask(()=>c=!1),J(()=>{R(u?"refreshing":"pending"),I()},!1),h.then(f=>w(h,f,void 0,E),f=>w(h,void 0,kr(f),E))):(w(i,h,void 0,E),h)}return Object.defineProperties(D,{state:{get:()=>L()},error:{get:()=>C()},loading:{get(){const v=L();return v==="pending"||v==="refreshing"}},latest:{get(){if(!u)return D();const v=C();if(v&&!i)throw v;return F()}}}),l?ws(()=>k(!1)):k(!1),[D,{refetch:k,mutate:g}]}function ka(t){return J(t,!1)}function z(t){if(M===null)return t();const e=M;M=null;try{return t()}finally{M=e}}function Pa(t,e,s){const r=Array.isArray(t);let n,o=s&&s.defer;return i=>{let a;if(r){a=Array(t.length);for(let u=0;u<t.length;u++)a[u]=t[u]()}else a=t();if(o){o=!1;return}const c=z(()=>e(a,n,i));return n=a,c}}function Aa(t){ri(()=>z(t))}function oi(t){return P===null||(P.cleanups===null?P.cleanups=[t]:P.cleanups.push(t)),t}function Ta(){return M}function La(){return P}function Ma(t,e){const s=P,r=M;P=t,M=null;try{return J(e,!0)}catch(n){ts(n)}finally{P=s,M=r}}function ii(t){const e=M,s=P;return Promise.resolve().then(()=>{M=e,P=s;let r;return J(t,!1),M=P=null,r?r.done:void 0})}function Ia(){return[ti,ii]}function Ra(t,e){const s=Symbol("context");return{id:s,Provider:di(s),defaultValue:t}}function Oa(t){return P&&P.context&&P.context[t.id]!==void 0?P.context[t.id]:t.defaultValue}function ai(t){const e=he(t),s=he(()=>Nt(e()));return s.toArray=()=>{const r=s();return Array.isArray(r)?r:r!=null?[r]:[]},s}let ci;function Cr(){if(this.sources&&this.state)if(this.state===te)fe(this);else{const t=N;N=null,J(()=>it(this),!1),N=t}if(M){const t=this.observers?this.observers.length:0;M.sources?(M.sources.push(this),M.sourceSlots.push(t)):(M.sources=[this],M.sourceSlots=[t]),this.observers?(this.observers.push(M),this.observerSlots.push(M.sources.length-1)):(this.observers=[M],this.observerSlots=[M.sources.length-1])}return this.value}function br(t,e,s){let r=t.value;return(!t.comparator||!t.comparator(r,e))&&(t.value=e,t.observers&&t.observers.length&&J(()=>{for(let n=0;n<t.observers.length;n+=1){const o=t.observers[n],i=bt&&bt.running;i&&bt.disposed.has(o),(i?!o.tState:!o.state)&&(o.pure?N.push(o):Z.push(o),o.observers&&wr(o)),i||(o.state=te)}if(N.length>1e6)throw N=[],new Error},!1)),e}function fe(t){if(!t.fn)return;ht(t);const e=P,s=M,r=lt;M=P=t,ui(t,t.value,r),M=s,P=e}function ui(t,e,s){let r;try{r=t.fn(e)}catch(n){return t.pure&&(t.state=te,t.owned&&t.owned.forEach(ht),t.owned=null),t.updatedAt=s+1,ts(n)}(!t.updatedAt||t.updatedAt<=s)&&(t.updatedAt!=null&&"observers"in t?br(t,r):t.value=r,t.updatedAt=s)}function Re(t,e,s,r=te,n){const o={fn:t,state:r,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:e,owner:P,context:P?P.context:null,pure:s};return P===null||P!==Sr&&(P.owned?P.owned.push(o):P.owned=[o]),o}function ot(t){if(t.state===0)return;if(t.state===nt)return it(t);if(t.suspense&&z(t.suspense.inFallback))return t.suspense.effects.push(t);const e=[t];for(;(t=t.owner)&&(!t.updatedAt||t.updatedAt<lt);)t.state&&e.push(t);for(let s=e.length-1;s>=0;s--)if(t=e[s],t.state===te)fe(t);else if(t.state===nt){const r=N;N=null,J(()=>it(t,e[0]),!1),N=r}}function J(t,e){if(N)return t();let s=!1;e||(N=[]),Z?s=!0:Z=[],lt++;try{const r=t();return li(s),r}catch(r){s||(Z=null),N=null,ts(r)}}function li(t){if(N&&(_r(N),N=null),t)return;const e=Z;Z=null,e.length&&J(()=>yr(e),!1)}function _r(t){for(let e=0;e<t.length;e++)ot(t[e])}function hi(t){let e,s=0;for(e=0;e<t.length;e++){const r=t[e];r.user?t[s++]=r:ot(r)}for(e=0;e<s;e++)ot(t[e])}function it(t,e){t.state=0;for(let s=0;s<t.sources.length;s+=1){const r=t.sources[s];if(r.sources){const n=r.state;n===te?r!==e&&(!r.updatedAt||r.updatedAt<lt)&&ot(r):n===nt&&it(r,e)}}}function wr(t){for(let e=0;e<t.observers.length;e+=1){const s=t.observers[e];s.state||(s.state=nt,s.pure?N.push(s):Z.push(s),s.observers&&wr(s))}}function ht(t){let e;if(t.sources)for(;t.sources.length;){const s=t.sources.pop(),r=t.sourceSlots.pop(),n=s.observers;if(n&&n.length){const o=n.pop(),i=s.observerSlots.pop();r<n.length&&(o.sourceSlots[i]=r,n[r]=o,s.observerSlots[r]=i)}}if(t.owned){for(e=t.owned.length-1;e>=0;e--)ht(t.owned[e]);t.owned=null}if(t.cleanups){for(e=t.cleanups.length-1;e>=0;e--)t.cleanups[e]();t.cleanups=null}t.state=0}function kr(t){return t instanceof Error?t:new Error(typeof t=="string"?t:"Unknown error",{cause:t})}function ts(t,e=P){const s=kr(t);{console.error("solid error",s);return}}function Nt(t){if(typeof t=="function"&&!t.length)return Nt(t());if(Array.isArray(t)){const e=[];for(let s=0;s<t.length;s++){const r=Nt(t[s]);Array.isArray(r)?e.push.apply(e,r):e.push(r)}return e}return t}function di(t,e){return function(r){let n;return si(()=>n=z(()=>(P.context={...P.context,[t]:r.value},ai(()=>r.children))),void 0),n}}const fi=Symbol("fallback");function ks(t){for(let e=0;e<t.length;e++)t[e]()}function gi(t,e,s={}){let r=[],n=[],o=[],i=0,a=e.length>1?[]:null;return oi(()=>ks(o)),()=>{let c=t()||[],u,l;return c[ei],z(()=>{let F=c.length,g,C,T,_,I,L,R,w,m;if(F===0)i!==0&&(ks(o),o=[],r=[],n=[],i=0,a&&(a=[])),s.fallback&&(r=[fi],n[0]=_t(D=>(o[0]=D,s.fallback())),i=1);else if(i===0){for(n=new Array(F),l=0;l<F;l++)r[l]=c[l],n[l]=_t(d);i=F}else{for(T=new Array(F),_=new Array(F),a&&(I=new Array(F)),L=0,R=Math.min(i,F);L<R&&r[L]===c[L];L++);for(R=i-1,w=F-1;R>=L&&w>=L&&r[R]===c[w];R--,w--)T[w]=n[R],_[w]=o[R],a&&(I[w]=a[R]);for(g=new Map,C=new Array(w+1),l=w;l>=L;l--)m=c[l],u=g.get(m),C[l]=u===void 0?-1:u,g.set(m,l);for(u=L;u<=R;u++)m=r[u],l=g.get(m),l!==void 0&&l!==-1?(T[l]=n[u],_[l]=o[u],a&&(I[l]=a[u]),l=C[l],g.set(m,l)):o[u]();for(l=L;l<F;l++)l in T?(n[l]=T[l],o[l]=_[l],a&&(a[l]=I[l],a[l](l))):n[l]=_t(d);n=n.slice(0,i=F),r=c.slice(0)}return n});function d(F){if(o[l]=F,a){const[g,C]=ae(l);return a[l]=C,e(c[l],g)}return e(c[l])}}}function xa(t,e){return z(()=>t(e||{}))}function We(){return!0}const Ut={get(t,e,s){return e===st?s:t.get(e)},has(t,e){return e===st?!0:t.has(e)},set:We,deleteProperty:We,getOwnPropertyDescriptor(t,e){return{configurable:!0,enumerable:!0,get(){return t.get(e)},set:We,deleteProperty:We}},ownKeys(t){return t.keys()}};function wt(t){return(t=typeof t=="function"?t():t)?t:{}}function mi(){for(let t=0,e=this.length;t<e;++t){const s=this[t]();if(s!==void 0)return s}}function Ba(...t){let e=!1;for(let o=0;o<t.length;o++){const i=t[o];e=e||!!i&&st in i,t[o]=typeof i=="function"?(e=!0,he(i)):i}if(e)return new Proxy({get(o){for(let i=t.length-1;i>=0;i--){const a=wt(t[i])[o];if(a!==void 0)return a}},has(o){for(let i=t.length-1;i>=0;i--)if(o in wt(t[i]))return!0;return!1},keys(){const o=[];for(let i=0;i<t.length;i++)o.push(...Object.keys(wt(t[i])));return[...new Set(o)]}},Ut);const s={},r={},n=new Set;for(let o=t.length-1;o>=0;o--){const i=t[o];if(!i)continue;const a=Object.getOwnPropertyNames(i);for(let c=0,u=a.length;c<u;c++){const l=a[c];if(l==="__proto__"||l==="constructor")continue;const d=Object.getOwnPropertyDescriptor(i,l);if(!n.has(l))d.get?(n.add(l),Object.defineProperty(s,l,{enumerable:!0,configurable:!0,get:mi.bind(r[l]=[d.get.bind(i)])})):(d.value!==void 0&&n.add(l),s[l]=d.value);else{const F=r[l];F?d.get?F.push(d.get.bind(i)):d.value!==void 0&&F.push(()=>d.value):s[l]===void 0&&(s[l]=d.value)}}}return s}function Na(t,...e){if(st in t){const n=new Set(e.length>1?e.flat():e[0]),o=e.map(i=>new Proxy({get(a){return i.includes(a)?t[a]:void 0},has(a){return i.includes(a)&&a in t},keys(){return i.filter(a=>a in t)}},Ut));return o.push(new Proxy({get(i){return n.has(i)?void 0:t[i]},has(i){return n.has(i)?!1:i in t},keys(){return Object.keys(t).filter(i=>!n.has(i))}},Ut)),o}const s={},r=e.map(()=>({}));for(const n of Object.getOwnPropertyNames(t)){const o=Object.getOwnPropertyDescriptor(t,n),i=!o.get&&!o.set&&o.enumerable&&o.writable&&o.configurable;let a=!1,c=0;for(const u of e)u.includes(n)&&(a=!0,i?r[c][n]=o.value:Object.defineProperty(r[c],n,o)),++c;a||(i?s[n]=o.value:Object.defineProperty(s,n,o))}return[...r,s]}const Di=t=>`Stale read from <${t}>.`;function Ua(t){const e="fallback"in t&&{fallback:()=>t.fallback};return he(gi(()=>t.each,t.children,e||void 0))}function Wa(t){const e=t.keyed,s=he(()=>t.when,void 0,{equals:(r,n)=>e?r===n:!r==!n});return he(()=>{const r=s();if(r){const n=t.children;return typeof n=="function"&&n.length>0?z(()=>n(e?r:()=>{if(!z(s))throw Di("Show");return t.when})):n}return t.fallback},void 0,void 0)}function Ps(...t){const[e,s]=ae(...t);return(...r)=>r.length===0?e():s(...r)}class pi{constructor(){if(le)return;this._width=Ps(),this._height=Ps(),this.viewport=window;const e=()=>{this.setDimensions()};this.viewport.addEventListener("resize",e),e()}setDimensions(){const e=this.viewport;this._width(e.width||e.innerWidth),this._height(e.height||e.innerHeight)}get width(){return this._width()}get height(){return this._height()}}const Wt=new pi;b&&(b.windowSize=Wt);class Fi{isEnabled(){return!!(S.settings&&S.settings.liteMode.all)}isAvailable(e){return!!(S.settings&&!S.settings.liteMode.all&&!S.settings.liteMode[e])}}const Pr=new Fi;b&&(b.liteMode=Pr);const As={"primary-color":{rgb:!0,light:!0,lightFilled:!0,dark:!0,darkRgb:!0},"message-out-primary-color":{lightFilled:!0,rgb:!0},"surface-color":{rgb:!0},"danger-color":{rgb:!0,light:!0,dark:!0},"primary-text-color":{rgb:!0},"secondary-text-color":{light:!0,lightFilled:!0},"message-background-color":{light:!0,lightFilled:!0,dark:!0,darkFilled:!0},"message-out-background-color":{light:!0,lightFilled:!0,dark:!0,darkFilled:!0},"saved-color":{lightFilled:!0},"green-color":{}},kt={day:{"primary-color":"#3390ec","message-out-primary-color":"#5CA853","message-background-color":"#ffffff","surface-color":"#ffffff","danger-color":"#df3f40","primary-text-color":"#000000","secondary-text-color":"#707579","saved-color":"#359AD4","green-color":"#70b768"},night:{"primary-color":"#8774E1","message-out-primary-color":"#8774E1","message-background-color":"#212121","surface-color":"#212121","danger-color":"#ff595a","primary-text-color":"#ffffff","secondary-text-color":"#aaaaaa","saved-color":"#8774E1","green-color":"#5CC85E"}};class Ei{constructor(){S.addEventListener("theme_change",e=>{this.setTheme(typeof e=="object"?e:void 0)})}get themeColorElem(){return this._themeColorElem!==void 0?this._themeColorElem:this._themeColorElem=document.head.querySelector('[name="theme-color"]')||null}setThemeColor(e=this.themeColor){e||(e=this.isNight()?"#212121":"#ffffff");const s=this.themeColorElem;s&&s.setAttribute("content",e)}setThemeListener(){try{const e=window.matchMedia("(prefers-color-scheme: dark)"),s=()=>{this.systemTheme=e.matches?"night":"day",S.myId?S.dispatchEvent("theme_change"):this.setTheme()};"addEventListener"in e?e.addEventListener("change",s):"addListener"in e&&e.addListener(s),s()}catch{}}applyHighlightningColor(){let e="hsla(85.5319, 36.9171%, 40.402%, .4)";const s=this.getTheme();s.settings?.highlightningColor&&(e=s.settings.highlightningColor);const r=Dr(e);document.documentElement.style.setProperty("--message-highlightning-color",e),document.documentElement.style.setProperty("--message-highlightning-color-rgb",r.slice(0,3).join(",")),document.documentElement.style.setProperty("--message-highlightning-alpha",""+r[3]/255),!ce&&e&&(this.themeColor=Vo(e))}_setTheme(e){const s=this.isNight();document.head.querySelector('[name="color-scheme"]')?.setAttribute("content",s?"dark":"light"),document.documentElement.classList.toggle("night",s),this.setThemeColor();const n=this.getTheme();this.applyTheme(n);let o=this.styleElement;o||(o=this.styleElement=document.createElement("style"),document.head.append(o));const i=document.createElement("div");this.applyTheme(S.settings.themes.find(a=>a.name==="night"),i,!0),o.textContent=`.night {${i.style.cssText}}`,this.applyHighlightningColor(),!e&&S.dispatchEventSingle("theme_changed")}setTheme(e){if(!("startViewTransition"in document)||!this.applied){const a=!this.applied;this.applied=!0,this._setTheme(a);return}Pr.isAvailable("animations")||(e=void 0);const s=!this.isNight();e&&(document.documentElement.classList.add("no-view-transition"),document.documentElement.classList.toggle("reverse",s),document.documentElement.offsetLeft);const r=document.startViewTransition(()=>{this._setTheme()});if(!e)return;const{x:n,y:o}=e,i=Math.hypot(Math.max(n,Wt.width-n),Math.max(o,Wt.height-o));r.ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0 at ${n}px ${o}px)`,`circle(${i}px at ${n}px ${o}px)`]},{duration:500,easing:"ease-in-out",pseudoElement:`::view-transition-${s?"old":"new"}(root)`,direction:s?"reverse":"normal"})}),r.finished.finally(()=>{document.documentElement.classList.remove("no-view-transition","reverse")})}async switchTheme(e,s){await S.managers.appStateManager.setByKey(Es("settings","theme"),e),S.dispatchEvent("theme_change",s)}isNight(){return this.getTheme().name==="night"}getTheme(e=S.settings.theme==="system"?this.systemTheme:S.settings.theme){return S.settings.themes.find(s=>s.name===e)}bindColorApplier(e){const s=new Set;return{applyAppColor:r=>(s.add(r.name),this.applyAppColor({...r,...e})),finalize:()=>{const r=e.isNight;for(const n in As)s.has(n)||this.applyAppColor({name:n,hex:kt[r?"night":"day"][n],...e})}}}applyAppColor({name:e,hex:s,element:r,lightenAlpha:n=.08,darkenAlpha:o=n,mixColor:i,isNight:a=this.isNight(),saveToCache:c}){const u=As[e],l=se(s),d=xt(...l);i??(i=se(kt[a?"night":"day"]["surface-color"]));const F=St(l,i,n),g={...d,l:d.l-o*100},C=[[e,s],u.rgb&&[e+"-rgb",l.join(",")],u.light&&["light-"+e,`rgba(${l[0]}, ${l[1]}, ${l[2]}, ${n})`],u.lightFilled&&["light-filled-"+e,ke(F)],u.dark&&["dark-"+e,`hsl(${g.h}, ${g.s}%, ${g.l}%)`]];c??(c=r===document.documentElement),C.filter(Boolean).forEach(([T,_])=>{r.style.setProperty("--"+T,_),c&&Bt.setPropertyCache(T,_,a)})}async applyNewTheme(e){const s=this.isNightTheme(e),r=this.getTheme(),n=S.settings.themes,o=e.settings.find(a=>a.base_theme._===(s?"baseThemeNight":"baseThemeClassic")),i={...e,name:r.name,settings:{...o,highlightningColor:""}};await this.AppBackgroundTab.setBackgroundDocument(o.wallpaper,i.settings),n[n.indexOf(r)]=i,await S.managers.appStateManager.setByKey(Es("settings","themes"),S.settings.themes),S.dispatchEvent("theme_change")}isNightTheme(e){return e.name==="night"||this.isNight()}applyTheme(e,s=document.documentElement,r){const n=this.isNightTheme(e),o=Array.isArray(e.settings)?e.settings.find(m=>m.base_theme._===(n?"baseThemeNight":"baseThemeClassic")):e.settings,i=kt[n?"night":"day"];let a=re(...se(i["primary-color"])),c=re(...Ue(o.accent_color));const u=Yo(a,c,se(i["primary-color"]),!n),l=ke(u),{applyAppColor:d,finalize:F}=this.bindColorApplier({element:s,isNight:n,saveToCache:r});if(d({name:"primary-color",hex:l,darkenAlpha:.04}),d({name:"saved-color",hex:l,lightenAlpha:.64,mixColor:[255,255,255]}),!o.message_colors?.length)return;const g=n?1:.12,C=se(i["message-out-primary-color"]);a=re(...C);const T=St(C,se(i["surface-color"]),g);let I=Ue(o.message_colors[0]);o.message_colors.length>1&&(o.message_colors.slice(1).forEach(m=>{I=jo(I,Ue(m))}),I=Go(a,T,I)),c=re(...I);const R=o.outbox_accent_color!==void 0&&re(...Ue(o.outbox_accent_color));let w=St(I,se(i["surface-color"]),g);if(!n){const m=xt(...w);m.s=Math.min(m.s+(n?8:63),100),w=mr(m.h,m.s,m.l,m.a).slice(0,3)}d({name:"message-out-background-color",hex:ke(w),lightenAlpha:g}),d({name:"message-out-primary-color",hex:n?"#ffffff":ke(R?es(...R):I),mixColor:w}),F()}getThemeParamsForWebView(){const e={bg_color:"surface-color",button_color:"primary-color",button_text_color:"#ffffff",hint_color:"secondary-text-color",link_color:"link-color",secondary_bg_color:"background-color-true",text_color:"primary-text-color",header_bg_color:"surface-color",accent_text_color:"primary-color",section_bg_color:"surface-color",section_header_text_color:"primary-color",subtitle_text_color:"secondary-text-color",destructive_text_color:"danger-color"},s={};for(const r in e){const n=e[r];s[r]=n[0]==="#"?n:Bt.getProperty(n)}return s}}const Ar=new Ei;b&&(b.themeController=Ar);class vi extends de{constructor(){super(...arguments),this.overlaysActive=0,this.hasDarkOverlays=0}get isOverlayActive(){return this.overlaysActive>0}set isOverlayActive(e){this.overlaysActive+=e?1:-1,this.dispatchEvent("change",this.isOverlayActive)}get isDarkOverlayActive(){return this.hasDarkOverlays>0}set isDarkOverlayActive(e){this.hasDarkOverlays+=e?1:-1,this.isOverlayActive=e}}const ze=new vi;b&&(b.overlayCounter=ze);function Va(t,e=t.split("?")){return Tr(e?.[1])}function Tr(t){const e={};return t&&t.split("&").forEach(s=>{const[r,n=""]=s.split("=");e[r]=decodeURIComponent(n)}),e}const yi="onbeforeinstallprompt"in window;let Vt;function Si(){window.addEventListener("beforeinstallprompt",t=>{Vt=async()=>{t.prompt();const{outcome:e}=await t.userChoice;e==="accepted"&&(Vt=void 0)}})}function ja(){return Vt}const ss=["January","February","March","April","May","June","July","August","September","October","November","December"],Ci=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],Te=ss.slice(),jt=Ci.slice(),Le=86400;function bi(){const t=W.getDateTimeFormat({weekday:"long"}),e=new Date(Date.UTC(2017,0,2)),s=[];for(let r=0;r<7;++r)s.push(ct(t.format(e))),e.setDate(e.getDate()+1);return s}function _i(){const t=W.getDateTimeFormat({month:"long"}),e=new Date(Date.UTC(2017,0,1)),s=[];for(let r=0;r<12;++r)s.push(ct(t.format(e))),e.setMonth(e.getMonth()+1);return s}function Ts(){Te.splice(0,Te.length,..._i()),jt.splice(0,jt.length,...bi())}const Ls=t=>{const e=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate())),s=e.getUTCDay()||7;e.setUTCDate(e.getUTCDate()+4-s);const r=new Date(Date.UTC(e.getUTCFullYear(),0,1));return Math.ceil(((e.getTime()-r.getTime())/Le+1)/7)};function Ga(t,e){e||(e=new Date,e.setHours(0,0,0,0));const s={day:"numeric",month:"long"};return t.getFullYear()!==e.getFullYear()&&(s.year="numeric"),new W.IntlDateElement({date:t,options:s}).element}function wi(t){const e=new Date,s=e.getTime()/1e3|0,r=t.getTime()/1e3|0,n={};return s-r<Le&&e.getDate()===t.getDate()?n.hour=n.minute="2-digit":e.getFullYear()!==t.getFullYear()?(n.year=n.day="numeric",n.month="2-digit"):s-r<Le*7&&Ls(e)===Ls(t)?n.weekday="short":(n.month="short",n.day="numeric"),new W.IntlDateElement({date:t,options:n}).element}function ki(t,e={}){const s=new Date,r=new Date(t*1e3),n=s.getTime()/1e3,o=Pi(r);let i;return n-t<Le&&s.getDate()===r.getDate()&&!e.noToday?i=Ae(e.capitalize?"Date.Today":"Peer.Status.Today"):n-t<Le*2&&s.getDate()-1===r.getDate()&&!e.noToday?(i=Ae(e.capitalize?"Yesterday":"Peer.Status.Yesterday"),e.capitalize&&(i.style.textTransform="capitalize")):s.getFullYear()!==r.getFullYear()?i=new W.IntlDateElement({date:r,options:{month:"short",day:"numeric",year:"numeric"}}).element:i=new W.IntlDateElement({date:r,options:{month:"short",day:"numeric"}}).element,{dateEl:i,timeEl:o}}function Ya(t,e=!0,s=!1){const{dateEl:r,timeEl:n}=ki(t,{capitalize:e,noToday:s}),o=document.createDocumentFragment();return o.append(r," ",Ae("ScheduleController.at")," ",n),o}function Pi(t){return new W.IntlDateElement({date:t,options:{hour:"2-digit",minute:"2-digit"}}).element}b&&(b.formatDateAccordingToTodayNew=wi);const za=(t,e={})=>{const s=e.monthAsNumber?".":" ",r=("0"+t.getHours()).slice(-2)+":"+("0"+t.getMinutes()).slice(-2)+(e.noSeconds?"":":"+("0"+t.getSeconds()).slice(-2)),n=t.getFullYear();return(e.leadingZero?("0"+t.getDate()).slice(-2):t.getDate())+s+(e.monthAsNumber?("0"+(t.getMonth()+1)).slice(-2):ss[t.getMonth()])+s+(""+n).slice(e.shortYear?2:0)+(e.noTime?"":", "+r)};function Ha(t,e){const s=t>=12&&!(t%12);return Ae(e?s?"BoldYears":"BoldMonths":s?"Years":"Months",[s?t/12:t])}const K=2013,Ai=new RegExp("20[0-9]{1,2}"),rs="\\p{L}",Ti=new RegExp(`(${rs}{3,})`,"iu"),Li=new RegExp(`(${rs}{3,}) ([0-9]{0,4})`,"iu"),Mi=new RegExp(`([0-9]{0,4}) (${rs}{2,})`,"iu"),Ii=new RegExp("^([0-9]{1,4})(\\.| |/|\\-)([0-9]{1,4})$","i"),Ri=new RegExp("^([0-9]{1,2})(\\.| |/|\\-)([0-9]{1,2})(\\.| |/|\\-)([0-9]{1,4})$","i"),Oi=[31,29,31,30,31,30,31,31,30,31,30,31];function xi(t,e){const s=t.trim().toLowerCase();if(s.length<3)return;if(["today",W.format("Peer.Status.Today",!0)].some(o=>o.indexOf(s)===0)){const o=new Date,i=o.getFullYear(),a=o.getMonth(),c=o.getDate();o.setFullYear(i,a,c),o.setHours(0,0,0);const u=o.getTime();o.setFullYear(i,a,c+1),o.setHours(0,0,0);const l=o.getTime()-1;e.push({title:W.format("Date.Today",!0),minDate:u,maxDate:l});return}if(["yesterday",W.format("Peer.Status.Yesterday",!0)].some(o=>o.indexOf(s)===0)){const o=new Date,i=o.getFullYear(),a=o.getMonth(),c=o.getDate();o.setFullYear(i,a,c),o.setHours(0,0,0);const u=o.getTime()-864e5;o.setFullYear(i,a,c+1),o.setHours(0,0,0);const l=o.getTime()-86400001;e.push({title:ct(W.format("Yesterday",!0)),minDate:u,maxDate:l});return}const r=Wi(s);if(r>=0){const o=new Date,i=o.getTime(),a=o.getDay(),c=r-a;o.setDate(o.getDate()+c),o.getTime()>i&&o.setTime(o.getTime()-6048e5);const u=o.getFullYear(),l=o.getMonth(),d=o.getDate();o.setFullYear(u,l,d),o.setHours(0,0,0);const F=o.getTime();o.setFullYear(u,l,d+1),o.setHours(0,0,0);const g=o.getTime()-1;e.push({title:Mr(F),minDate:F,maxDate:g});return}let n;if((n=Ii.exec(s))!==null){const o=n[1],i=n[3],a=parseInt(o),c=parseInt(i);if(a>0&&a<=31){if(c>=K&&a<=12){const u=c,l=a-1;_e(e,l,u);return}else if(c<=12){const u=a-1,l=c-1;Pt(e,u,l)}}else if(a>=K&&c<=12){const u=a,l=c-1;_e(e,l,u)}return}if((n=Ri.exec(s))!==null){const o=n[1],i=n[3],a=n[5];if(!n[2]===n[4])return;const c=parseInt(o),u=parseInt(i)-1;let l=parseInt(a);l>=10&&l<=99&&(l+=2e3);const d=new Date().getFullYear();if(Ir(c-1,u)&&l>=K&&l<=d){const F=new Date;F.setFullYear(l,u,c),F.setHours(0,0,0);const g=F.getTime();F.setFullYear(l,u,c+1),F.setHours(0,0,0);const C=F.getTime()-1;e.push({title:Lr(g),minDate:g,maxDate:C});return}return}if((n=Li.exec(s))!==null){const o=n[1],i=n[2],a=At(o);if(a>=0){const c=+i||new Date().getUTCFullYear();if(c>0&&c<=31){const u=c-1;Pt(e,u,a);return}else if(c>=K){_e(e,a,c);return}}}if((n=Mi.exec(s))!==null){const o=n[1],i=n[2],a=At(i);if(a>=0){const c=+o;if(c>0&&c<=31){const u=c-1;Pt(e,u,a);return}else c>=K&&_e(e,a,c)}}if((n=Ti.exec(s))!==null){const o=n[1],i=At(o);if(i>=0){const a=new Date().getFullYear();for(let c=a;c>=K;--c)_e(e,i,c)}}if((n=Ai.exec(s))!==null){let o=+n[0];const i=new Date().getFullYear();if(o<K){o=K;for(let a=i;a>=o;a--){const c=new Date;c.setFullYear(a,0,1),c.setHours(0,0,0);const u=c.getTime();c.setFullYear(a+1,0,1),c.setHours(0,0,0);const l=c.getTime()-1;e.push({title:""+a,minDate:u,maxDate:l})}}else if(o<=i){const a=new Date;a.setFullYear(o,0,1),a.setHours(0,0,0);const c=a.getTime();a.setFullYear(o+1,0,1),a.setHours(0,0,0);const u=a.getTime()-1;e.push({title:""+o,minDate:c,maxDate:u})}return}}function _e(t,e,s){const r=new Date().getFullYear(),n=Date.now();if(s>=K&&s<=r){const o=new Date;o.setFullYear(s,e,1),o.setHours(0,0,0);const i=o.getTime();if(i>n)return;o.setMonth(o.getMonth()+1);const a=o.getTime()-1;t.push({title:Bi(i),minDate:i,maxDate:a})}}function Pt(t,e,s){if(Ir(e,s)){const r=new Date().getFullYear(),n=Date.now();for(let o=r;o>=K;o--){if(s===1&&e===28&&!Ui(o))continue;const i=new Date;i.setFullYear(o,s,e+1),i.setHours(0,0,0);const a=i.getTime();if(a>n)continue;i.setFullYear(o,s,e+2),i.setHours(0,0,0);const c=i.getTime()-1;o===r?t.push({title:Ni(a),minDate:a,maxDate:c}):t.push({title:Lr(a),minDate:a,maxDate:c})}}}function Bi(t){const e=new Date(t);return Te[e.getMonth()]+" "+e.getFullYear()}function Ni(t){const e=new Date(t);return Te[e.getMonth()]+" "+e.getDate()}function Lr(t){const e=new Date(t);return("0"+e.getDate()).slice(-2)+"."+("0"+(e.getMonth()+1)).slice(-2)+"."+e.getFullYear()}function Mr(t){const e=new Date(t);return jt[e.getDay()]}function Ir(t,e){return e>=0&&e<12&&t>=0&&t<Oi[e]}function Ui(t){return t%4===0&&t%100!==0||t%400===0}function At(t){t=t.toLowerCase();for(let e=0;e<12;e++)if([ss[e],Te[e]].some(s=>s.toLowerCase().indexOf(t)===0))return e;return-1}function Wi(t){const e=new Date;if(t.length<=3)return-1;for(let s=0;s<7;s++)if(e.setDate(e.getDate()+1),Mr(e.getTime()).toLowerCase().indexOf(t)===0)return e.getDay();return-1}b.fillTipDates=xi;const Rr=Q,Or=Q||!Is&&(!$||Yt)||Rs<113,Vi=!Rr&&!Or;document.addEventListener("DOMContentLoaded",async()=>{try{B.isMainDomain&&document.referrer&&/(^|\.)(google|bing|duckduckgo|ya|yandex)\./i.test(new URL(document.referrer).host)&&(localStorage.getItem("kz_version")==="Z"||tt(8)>127?(localStorage.setItem("kz_version","Z"),location.href="https://web.telegram.org/a/"):localStorage.setItem("kz_version","K"))}catch{}Jr(),Node.prototype.replaceChildren===void 0&&(Node.prototype.replaceChildren=function(...m){this.textContent="",m&&this.append(...m)}),S.managers=Uo();const t=document.getElementById("manifest");t&&(t.href=`site${Tt&&!Fe?"_apple":""}.webmanifest?v=jw3mK7G9Aq`),Qe.start();const e=window.visualViewport||window;let s=!1,r;const n=()=>{let m=(s&&!ze.isOverlayActive?e.height||e.innerHeight:window.innerHeight)*.01;m=+m.toFixed(2),r!==m&&(ce&&r<m&&m-r>1&&Wr(),r=m,document.documentElement.style.setProperty("--vh",`${m}px`))};window.addEventListener("resize",n),n();const o=()=>{const m=document.querySelector(".chat.active");if(!m)return;const D=m.cloneNode(!0);D.querySelectorAll(".chat-input, .chat-background").forEach(f=>f.remove());const k=D.querySelector(".bubbles"),v=k.querySelector(".bubbles-inner");k.replaceChildren(v),k.querySelectorAll("video").forEach(f=>f.muted=!0);const h=document.createElement("div");h.setAttribute("id","printable"),h.append(D),document.body.append(h)},i=()=>{document.getElementById("printable")?.remove()};if(window.addEventListener("beforeprint",o),window.addEventListener("afterprint",i),He){const m=()=>{s=D===1&&He&&!ze.isOverlayActive,n(),e!==window&&(s?(window.removeEventListener("resize",n),e.addEventListener("resize",n)):(e.removeEventListener("resize",n),window.addEventListener("resize",n)))};let D;window.onImTabChange=k=>{const v=D!==void 0;D=k,(v||D===1)&&m()},ze.addEventListener("change",()=>{m()})}Ee&&!Mt&&document.addEventListener("dragstart",m=>{const D=m.target;if(D.tagName==="IMG"&&D.classList.contains("emoji"))return us(m),!1}),Mt&&document.documentElement.classList.add("native-emoji"),Rr?document.documentElement.classList.add("native-scroll"):Or?document.documentElement.classList.add("overlay-scroll"):Vi&&document.documentElement.classList.add("custom-scroll"),document.addEventListener("dragstart",m=>{if(m.target?.tagName==="IMG")return m.preventDefault(),!1}),document.addEventListener("contextmenu",m=>{m.target.tagName==="IMG"&&!window.appMediaViewer&&us(m)}),Ee&&document.documentElement.classList.add("is-firefox","no-backdrop"),Q&&document.documentElement.classList.add("is-mobile"),Tt?($&&document.documentElement.classList.add("is-safari"),Fe?document.documentElement.classList.add("is-ios"):document.documentElement.classList.add("is-mac")):Ms&&document.documentElement.classList.add("is-android"),ce?document.documentElement.classList.add("is-touch"):document.documentElement.classList.add("no-touch"),yi&&Si();const a=performance.now(),c=W.getCacheLangPack(),[u,l]=await Promise.all([ut.sendState().then(([m])=>m),c]);W.setTimeFormat(u.state.settings.timeFormat),S.managers.rootScope.getPremium().then(m=>{S.premium=m}),Ar.setThemeListener(),l.appVersion!==B.langPackVersion?W.getLangPack(l.lang_code):Ts(),S.addEventListener("language_change",()=>{Ts()});function d(m,D){m.style.opacity="0",D.then(()=>{window.requestAnimationFrame(()=>{m.style.opacity=""})})}console.log("got state, time:",performance.now()-a),l.lang_code,document.documentElement.dir="ltr";const F=location.search.split("=")[1];F&&localStorage.setItem("i",F);let g=u.state.authState;const T=location.hash.split("?"),_=Tr(T[1]??T[0].slice(1)),I=_.t,L=_.d,R=_.s,w=_.id;if(I&&L&&R&&w&&(S.managers.appStoragesManager.clear(),S.managers.appStoriesManager.clear(),localStorage.setItem("dc",L),localStorage.setItem("dc"+L+"_server_salt",`"${R}"`),localStorage.setItem("dc"+L+"_auth_key",`"${I}"`),localStorage.setItem("user_auth",JSON.stringify({dcID:Number(L),id:Number(w)})),location.href=location.origin),_.tgWebAuthToken&&g._!=="authStateSignedIn"){const m={token:_.tgWebAuthToken,dcId:+_.tgWebAuthDcId,userId:_.tgWebAuthUserId.toUserId(),isTest:_.tgWebAuthTest!==void 0&&!!+_.tgWebAuthTest,tgAddr:_.tgaddr};if(m.isTest!==q.test){const D=new URLSearchParams(location.search);+_.tgWebAuthTest?D.set("test","1"):D.delete("test"),location.search=D.toString();return}S.managers.appStateManager.pushToState("authState",g={_:"authStateSignImport",data:m})}if(g._!=="authStateSignedIn"){console.log("Will mount auth page:",g._,Date.now()/1e3);const m=document.getElementById("auth-pages");let D;if(m){D=m.querySelector(".scrollable"),(!ce||Yt)&&D.classList.add("no-scrollbar"),D.style.opacity="0";const v=document.createElement("div");v.classList.add("auth-placeholder"),D.prepend(v),D.append(v.cloneNode())}try{await Promise.all([U(()=>Promise.resolve().then(()=>qn),void 0,import.meta.url),U(()=>Promise.resolve().then(()=>zn),void 0,import.meta.url)]).then(([v,E])=>{v.default.setAuthorized(!1),E.default.forceUnsubscribe()})}catch{}let k;switch(g._){case"authStateSignIn":k=(await U(()=>import("./pageSignIn-c846692e.js"),["./pageSignIn-c846692e.js","./putPreloader-43d1421b.js","./page-d8631be9.js","./countryInputField-fd5e91a8.js","./wrapEmojiText-a4cac8f5.js","./scrollable-c329200a.js","./pageSignQR-4aa2f9aa.js"],import.meta.url)).default.mount();break;case"authStateSignQr":k=(await U(()=>import("./pageSignIn-c846692e.js"),["./pageSignIn-c846692e.js","./putPreloader-43d1421b.js","./page-d8631be9.js","./countryInputField-fd5e91a8.js","./wrapEmojiText-a4cac8f5.js","./scrollable-c329200a.js","./pageSignQR-4aa2f9aa.js"],import.meta.url)).default.mount();break;case"authStateAuthCode":k=(await U(()=>import("./pageAuthCode-d8455163.js"),["./pageAuthCode-d8455163.js","./page-d8631be9.js","./pageSignIn-c846692e.js","./putPreloader-43d1421b.js","./countryInputField-fd5e91a8.js","./wrapEmojiText-a4cac8f5.js","./scrollable-c329200a.js","./pageSignQR-4aa2f9aa.js","./codeInputField-8ed56a26.js"],import.meta.url)).default.mount(g.sentCode);break;case"authStatePassword":k=(await U(()=>import("./pagePassword-978634f4.js"),["./pagePassword-978634f4.js","./putPreloader-43d1421b.js","./page-d8631be9.js","./wrapEmojiText-a4cac8f5.js","./htmlToSpan-0b4d798f.js","./loginPage-166192c4.js"],import.meta.url)).default.mount();break;case"authStateSignUp":k=(await U(()=>import("./pageSignUp-f268f2d1.js"),["./pageSignUp-f268f2d1.js","./loginPage-166192c4.js","./page-d8631be9.js","./wrapEmojiText-a4cac8f5.js","./avatar-e4035c6f.js","./scrollable-c329200a.js","./putPreloader-43d1421b.js"],import.meta.url)).default.mount(g.authCode);break;case"authStateSignImport":k=(await U(()=>import("./pageSignImport-4b1b63e6.js"),["./pageSignImport-4b1b63e6.js","./putPreloader-43d1421b.js","./page-d8631be9.js"],import.meta.url)).default.mount(g.data);break}if(D){k&&await k;const v="fonts"in document?Promise.race([zt(1e3),document.fonts.ready]):Promise.resolve();d(D,v)}}else console.log("Will mount IM page:",Date.now()/1e3),d(document.getElementById("main-columns"),qr()),(await U(()=>import("./pageIm-b0ef9866.js"),["./pageIm-b0ef9866.js","./page-d8631be9.js"],import.meta.url)).default.mount()});export{se as $,B as A,Pi as B,Ft as C,ue as D,de as E,Xs as F,sa as G,It as H,ce as I,_t as J,si as K,z as L,b as M,Ns as N,Le as O,ri as P,Ma as Q,ae as R,G as S,ea as T,da as U,oi as V,Ca as W,he as X,La as Y,Ar as Z,U as _,S as a,Ia as a$,Xr as a0,A as a1,Ki as a2,Lo as a3,$e as a4,jr as a5,xa as a6,Wa as a7,Ba as a8,Bt as a9,Yr as aA,Hi as aB,$i as aC,ra as aD,St as aE,xt as aF,Fe as aG,oo as aH,Gn as aI,Hr as aJ,wi as aK,$o as aL,to as aM,vt as aN,no as aO,Qi as aP,Er as aQ,Xt as aR,Qt as aS,za as aT,Zr as aU,Va as aV,st as aW,ei as aX,Ta as aY,ka as aZ,ws as a_,qi as aa,Oo as ab,Yt as ac,ze as ad,Q as ae,Tt as af,Xi as ag,$n as ah,Gr as ai,gr as aj,ki as ak,fa as al,kn as am,Ke as an,Ht as ao,ee as ap,Gt as aq,Wt as ar,V as as,sn as at,Hs as au,Ya as av,$ as aw,Ms as ax,ia as ay,zr as az,ut as b,lr as b$,Ee as b0,Qn as b1,Kn as b2,Qr as b3,Fa as b4,Pa as b5,Na as b6,Oa as b7,Ra as b8,Ua as b9,Zn as bA,tn as bB,en as bC,na as bD,ja as bE,xi as bF,io as bG,Tn as bH,ao as bI,et as bJ,Qe as bK,tr as bL,Sa as bM,Ea as bN,ya as bO,va as bP,wo as bQ,xe as bR,Kt as bS,Xe as bT,Uo as bU,Gi as bV,dr as bW,Or as bX,xs as bY,co as bZ,Jn as b_,Ze as ba,Aa as bb,Ps as bc,_a as bd,Es as be,wa as bf,Ha as bg,wn as bh,Zi as bi,aa as bj,Ot as bk,ta as bl,Cn as bm,$s as bn,Os as bo,ur as bp,He as bq,zi as br,ls as bs,Mt as bt,mr as bu,ke as bv,pr as bw,Ho as bx,ji as by,Ds as bz,us as c,Xn as c0,Ro as c1,Us as c2,To as c3,Is as c4,nr as c5,Zs as c6,eo as c7,oa as c8,ca as c9,ua as ca,Ks as cb,ga as d,W as e,x as f,Wr as g,X as h,Ae as i,Pr as j,Lt as k,qr as l,vr as m,Yi as n,ma as o,zt as p,go as q,Da as r,pe as s,vn as t,pa as u,Ga as v,Js as w,Ji as x,la as y,ha as z};