TelegramPWA/dist/5769.1eeed5fc47e8e4ef7301.js
Alexander Zinchuk 534d6548b7 [Build]
2023-07-20 17:55:19 +02:00

2 lines
394 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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

"use strict";(self.webpackChunktelegram_t=self.webpackChunktelegram_t||[]).push([[5769],{79294:(e,t,n)=>{n.r(t),n.d(t,{LockScreen:()=>Dd,Main:()=>Ld});var a=n(33555),s=n(601),o=n(83716),i=n(60748),r=n(31664),c=n(57710),d=n(73760),l=(n(65456),n(27225)),u=n(6137),m=n(91713),h=n(71226),g=n(60782),p=n(25260),f=n(11192),I=n(69118),v=n(48670),w=n(59692),b=n(81396),Z=n(44271),P=n(65054),y=n(84112),C=n(28406),E=n(74399);const S=32*E.Gw,M=45.5*E.Gw,R=26.5*E.Gw,k=16*E.Gw,T=16.125*E.Gw;var A=n(43858),N=n(53475),x=n(4907),B=n(42797);function L(e,t){return t-((0,f.jU)(e).isLeftColumnShown&&!(0,B.W7)()?e.leftColumnWidth||((n=A.Z.get().width)>o._mX?Math.min(Math.max(.25*n,k),.33*n):n>o.ksF?Math.min(Math.max(.33*n,k),.4*n):R):0);var n}function U(e,t,n){const a=t.reactions||{results:[]},s=(0,f._5)(e,t.chatId),o=a.results.map((e=>(0,v.Bt)(e)?{...e,chosenOrder:void 0,count:e.count-1}:e)).filter((e=>{let{count:t}=e;return t>0}));n.forEach(((e,t)=>{const n=o.findIndex((t=>(0,v.Hl)(t.reaction,e)));n>-1?o[n]={...o[n],chosenOrder:t,count:o[n].count+1}:o.push({reaction:e,chosenOrder:t,count:1})}));let{recentReactions:i=[]}=a;return i.length&&(i=i.filter((t=>{let{isOwn:n,peerId:a}=t;return!n&&a!==e.currentUserId}))),n.forEach((t=>{const{currentUserId:n}=e;i.unshift({peerId:s?.id||n,reaction:t,addedDate:Math.floor(Date.now()/1e3),isOwn:!0})})),(0,x.cY)(e,t.chatId,t.id,{reactions:{...a,results:o,recentReactions:i}})}function j(e,t,n){return(0,N.a4)(e,t,n,void 0,!0)}const O=350;function F(e,t,n,a,s,o,i){const r=i?.reactions;if(r&&(0,y.A)(a,r))return e;if(e=(0,p.cY)(e,t,n,{reactions:a}),!o)return e;const c=s.unreadReactions?.includes(n);if((0,v.yL)(e,a)&&!c){e=j(e,t,{unreadReactionsCount:(s?.unreadReactionsCount||0)+1,unreadReactions:[...s?.unreadReactions||[],n]});const a=(0,f.hj)(e,t,n);if(!s||!a)return e;(0,I.R3)((()=>{(0,C.rh)({chat:s,message:a,isReaction:!0})}))}else c&&(e=j(e,t,{unreadReactionsCount:(s?.unreadReactionsCount||1)-1,unreadReactions:s?.unreadReactions?.filter((e=>e!==n))}));return e}function _(e,t,n,a){let s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const o=s?(0,f.Tm)(e,t,n):(0,f.hj)(e,t,n);if(o&&a.content){const{photo:e,video:t,sticker:n,document:s}=(0,v.qp)(o);e&&a.content.photo?(a.content.photo.blobUrl=e.blobUrl,a.content.photo.thumbnail=e.thumbnail):t&&a.content.video?a.content.video.blobUrl=t.blobUrl:n&&a.content.sticker?a.content.sticker.isPreloadedGlobally=n.isPreloadedGlobally:s&&a.content.document&&(a.content.document.previewBlobUrl=s.previewBlobUrl)}const i=o?{...o,...a}:a;return s?(0,p.P4)(e,t,n,i):(0,p.cY)(e,t,n,i)}function D(e,t,n,a){const{chatId:s}=n,{threadInfo:o}=(0,f.Db)(e,n)||{};if(!o&&n.replyToMessageId){const o=(0,f.hj)(e,s,n.replyToMessageId);o?e=(0,p.lG)(e,o,s,n.id,a):t.loadMessage({chatId:s,messageId:n.replyToMessageId,threadUpdate:{isDeleting:a,lastMessageId:n.id}})}return e}function q(e,t,n){const{id:a,chatId:s}=n,{threadInfo:o,firstMessageId:i}=(0,f.Db)(e,n)||{},r=(0,f.Z1)(e,s)?.unreadCount&&!(0,f.gb)(e,s,u._f);return e=D(e,t,n),o&&(!i&&(0,v.CI)(n)||(e=(0,p.xj)(e,s,o.threadId,[a]),Object.values(e.byTabId).forEach((t=>{let{id:r}=t;(0,f.b9)(e,s,o.threadId,r)&&(e=(0,p.$S)(e,s,o.threadId,a,r),i||(e=(0,p.pf)(e,s,o.threadId,"firstMessageId",n.id)))}))),e=(0,p.pf)(e,s,o.threadId,"threadInfo",{...o,lastMessageId:n.id}),(0,v.CI)(n)||(0,v.FT)(n)||(e=(0,p.Xg)(e,s,o.threadId,{messagesCount:(o.messagesCount||0)+1}))),r||(e=(0,p.xj)(e,s,u._f,[a]),Object.values(e.byTabId).forEach((t=>{let{id:n}=t;if((0,f.b9)(e,s,u._f,n)){const t=(0,f.It)(e,s,u._f),o=(0,p.$S)(e,s,u._f,a,n),i=(0,f.Cb)(o,s,u._f,n);t&&!i.includes(t)||(e=o)}}))),e}function $(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{chats:s}=e,o=s.byId[t],i=o?.lastMessage,r=o?.isForum?(0,f.p$)(e,n):void 0;return r&&(e=(0,p.Cn)(e,t,r.id,{lastMessageId:n.id})),!i||a||i.id===n.id||i.id===n.previousLocalId||n.id>i.id?(0,p.a4)(e,t,{lastMessage:n}):e}function H(e,t){const n=(0,f.Zw)(e,t),a=(0,f.gb)(e,t,u._f);if(!n||!a)return;let s=a.length;for(;s--;){const e=n[a[s]];if(!e.isDeleting)return e}}function G(e,t,n,s){if(t){const o=(0,f.Z1)(e,t);if(!o)return;n.forEach((n=>{e=(0,p.cY)(e,t,n,{isDeleting:!0});const a=H(e=(0,p.CE)(e,t,n),t);a&&(e=$(e,t,a,!0)),o.topics?.[n]&&(e=(0,p.BK)(e,t,n))})),s.requestChatUpdate({chatId:t});const i=[];return n.forEach((n=>{const a=(0,f.hj)(e,t,n);if(!a)return;e=D(e,s,a,!0);const o=(0,f.nr)(e,a);o&&i.push(o)})),(0,a.R3)(e),void setTimeout((()=>{e=(0,a.Rd)(),e=(0,p.K4)(e,t,n),(0,a.R3)(e),(0,g.Tw)(i).forEach((e=>{s.requestThreadInfoUpdate({chatId:t,threadId:e})}))}),O)}const o=[];n.forEach((t=>{const n=(0,f.X5)(e,t);if(n){o.push(n);const s=H(e=(0,p.cY)(e,n,t,{isDeleting:!0}),n);s&&(e=$(e,n,s,!0)),setTimeout((()=>{e=(0,a.Rd)(),e=(0,p.K4)(e,n,[t]),(0,a.R3)(e)}),O)}})),(0,a.R3)(e),(0,g.Tw)(o).forEach((e=>{s.requestChatUpdate({chatId:e})}))}(0,a.iw)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"newMessage":{const{chatId:s,id:o,message:i,shouldForceReply:r}=n;e=q(e=_(e,s,o,i),t,i),i.repliesThreadInfo&&(e=(0,p.Xg)(e,i.repliesThreadInfo.chatId,i.repliesThreadInfo.threadId,i.repliesThreadInfo));const c=(0,f.hj)(e,s,o);(0,f.Z1)(e,s)?.isForum&&c.isTopicReply&&!(0,f.p$)(e,c)&&c.replyToMessageId&&t.loadTopicById({chatId:s,topicId:c.replyToMessageId}),Object.values(e.byTabId).forEach((n=>{let{id:d}=n;const l=(0,v.CI)(i);if((0,f.KA)(e,s,i,d)){if(l&&i.isOutgoing&&!i.content?.action){const n=(0,f.Bt)(e,d);n&&t.focusMessage({chatId:s,threadId:n.threadId,messageId:i.id,noHighlight:!0,isResizingContainer:!0,tabId:d})}const{threadInfo:n}=(0,f.Db)(e,i)||{};n&&!l&&t.requestThreadInfoUpdate({chatId:s,threadId:n.threadId}),l||setTimeout((()=>{e=(0,a.Rd)(),r&&(e=(0,p.pf)(e,s,u._f,"replyingToId",o)),e=$(e,s,c),(0,a.R3)(e)}),O)}else e=$(e,s,c)})),(0,a.R3)(e),(0,f.N)(e,s)||t.loadTopChats();break}case"updateStartEmojiInteraction":Object.values(e.byTabId).forEach((t=>{let{id:a}=t;const{chatId:s}=(0,f.Bt)(e,a)||{};if(s!==n.id)return;const o=(0,f.hj)(e,s,n.messageId);if(!o)return;if((0,v.UD)(o)!==n.emoji)return;const i=(0,f.jU)(e,a);e=(0,Z.i)(e,{activeEmojiInteractions:[...i.activeEmojiInteractions||[],{id:i.activeEmojiInteractions?.length||0,animatedEffect:n.emoji,messageId:n.messageId}]},a)})),(0,a.R3)(e);break;case"newScheduledMessage":{const{chatId:t,id:s,message:o}=n;e=_(e,t,s,o,!0);const i=(0,f.qy)(e,t,u._f)||[];e=(0,p.pf)(e,t,u._f,"scheduledIds",(0,g.Tw)([...i,s]));const r=(0,f.nr)(e,o);if(r!==u._f){const n=(0,f.qy)(e,t,r)||[];e=(0,p.pf)(e,t,r,"scheduledIds",(0,g.Tw)([...n,s]))}(0,a.R3)(e);break}case"updateMessage":{const{chatId:t,id:s,message:o}=n,i=(0,f.hj)(e,t,s),r=(0,f.Z1)(e,t);e=_(e,t,s,o);const c=(0,f.hj)(e,t,s);o.repliesThreadInfo&&(e=(0,p.Xg)(e,o.repliesThreadInfo.chatId,o.repliesThreadInfo.threadId,o.repliesThreadInfo)),i&&(e=$(e,t,c)),o.reactions&&r&&(e=F(e,t,s,o.reactions,r,c.isOutgoing,i)),o.content?.text?.text!==i?.content?.text?.text&&(e=(0,p.CE)(e,t,s)),(0,a.R3)(e);break}case"updateScheduledMessage":{const{chatId:t,id:s,message:o}=n,i=(0,f.Tm)(e,t,s);if(!i)return;e=_(e,t,s,o,!0);const r=Object.keys((0,f.yB)(e,t)||{}).map(Number).sort(((e,t)=>t-e));e=(0,p.pf)(e,t,u._f,"scheduledIds",r);const c=(0,f.nr)(e,i);if(c!==u._f){const n=(0,f.qy)(e,t,c)||[];e=(0,p.pf)(e,t,c,"scheduledIds",n.sort(((e,t)=>t-e)))}(0,a.R3)(e);break}case"updateMessageSendSucceeded":{const{chatId:s,localId:o,message:i}=n;e=q(e,t,i);const r=(0,f.hj)(e,s,o);e=(0,p.K4)(e,s,[o]),i.isScheduled&&(e=(0,p.bV)(e,s,[o])),e=(0,p.cY)(e,s,i.id,{...r,...i,previousLocalId:o});const c=(0,f.hj)(e,s,i.id);e=$(e,s,c);const d=(0,f.Db)(e,i);Object.values(e.byTabId).forEach((n=>{let{id:a}=n;const{chatId:o,threadId:r}=(0,f.Bt)(e,a)||{};o===s&&(d?.threadInfo?.threadId||u._f)===r&&t.markMessageListRead({maxId:i.id,tabId:a})})),d?.threadInfo&&(e=(0,p.pf)(e,s,d.threadInfo.threadId,"threadInfo",{...d.threadInfo,lastMessageId:i.id,lastReadInboxMessageId:i.id})),e=(0,p.a4)(e,s,{lastReadInboxMessageId:i.id}),(0,a.R3)(e);break}case"updateScheduledMessageSendSucceeded":{const{chatId:t,localId:s,message:o}=n,i=(0,f.qy)(e,t,u._f)||[];e=(0,p.pf)(e,t,u._f,"scheduledIds",[...i,o.id]);const r=(0,f.nr)(e,o);if(r!==u._f){const n=(0,f.qy)(e,t,r)||[];e=(0,p.pf)(e,t,r,"scheduledIds",[...n,o.id])}const c=(0,f.Tm)(e,t,s);e=(0,p.bV)(e,t,[s]),e=(0,p.P4)(e,t,o.id,{...c,...o,previousLocalId:s}),(0,a.R3)(e);break}case"updatePinnedIds":{const{chatId:t,isPinned:s,messageIds:o}=n,i=(0,g.q0)((0,f.Zw)(e,t),o),r={[u._f]:o};Object.values(i).forEach((n=>{const a=(0,f.nr)(e,n);if(e=(0,p.cY)(e,t,n.id,{isPinned:s}),a===u._f)return;const o=r[a]||[];o.push(n.id),r[a]=o})),Object.entries(r).forEach((n=>{let[a,o]=n;const i=(0,f.KB)(e,t,u._f)||[],r=s?(0,g.Tw)(i.concat(o)).sort(((e,t)=>t-e)):i.filter((e=>!o.includes(e)));e=(0,p.pf)(e,t,Number(a),"pinnedIds",r)})),(0,a.R3)(e);break}case"updateThreadInfo":{const{chatId:s,threadId:o,threadInfo:i,firstMessageId:r}=n,c=(0,f.tZ)(e,s,o),d={...c,...i};if(!d.threadId)return;e=(0,p.Xg)(e,s,o,d),r&&(e=(0,p.pf)(e,s,o,"firstMessageId",r));const l=(0,f.Z1)(e,s);if(l?.isForum&&i.lastReadInboxMessageId!==c?.lastReadInboxMessageId&&t.loadTopicById({chatId:s,topicId:o}),i.topMessageId===o&&!l?.isForum){const t=l?.lastReadInboxMessageId,n=d.lastReadInboxMessageId||t;t&&n&&(e=(0,p.Xg)(e,s,o,{lastReadInboxMessageId:Math.max(n,t)}))}(0,a.R3)(e);break}case"resetMessages":{const{id:s}=n,o=(0,f.Zw)(e,s);if(o&&!(0,v.YC)(s)){const n=(0,P._w)();e=(0,p.K4)(e,s,Object.keys(o).map(Number)),(0,a.R3)(e),t.loadFullChat({chatId:s,force:!0,tabId:n}),t.loadViewportMessages({chatId:s,threadId:u._f,tabId:n})}break}case"deleteMessages":{const{ids:a,chatId:s}=n;G(e,s,a,t);break}case"deleteScheduledMessages":{const{ids:t,chatId:s}=n;!function(e,t,n,s){e&&(t.forEach((t=>{s=(0,p.P4)(s,e,t,{isDeleting:!0})})),(0,a.R3)(s),setTimeout((()=>{s=(0,a.Rd)(),s=(0,p.bV)(s,e,t);const n=(0,f.yB)(s,e);s=(0,p.pf)(s,e,u._f,"scheduledIds",Object.keys(n||{}).map(Number)),(0,a.R3)(s)}),O))}(s,t,0,e);break}case"deleteHistory":{const{chatId:s}=n,i=e.messages.byChatId[s];if(s===o.awM&&(e={...e,serviceNotifications:e.serviceNotifications.map((e=>({...e,isDeleted:!0})))},(0,a.R3)(e)),i){const n=Object.keys(i.byId).map(Number);G(e=(0,a.Rd)(),s,n,t)}else t.requestChatUpdate({chatId:s});e=(0,a.Rd)(),e=(0,p.kq)(e,s),(0,a.R3)(e);break}case"updateCommonBoxMessages":{const{ids:t,messageUpdate:s}=n;t.forEach((t=>{const n=(0,f.X5)(e,t);n&&(e=(0,p.cY)(e,n,t,s))})),(0,a.R3)(e);break}case"updateChannelMessages":{const{channelId:t,ids:s,messageUpdate:o}=n;s.forEach((n=>{e=(0,p.cY)(e,t,n,o)})),(0,a.R3)(e);break}case"updateMessagePoll":{const{pollId:t,pollUpdate:s}=n,o=(0,f.ZB)(e,t);if(o?.content.poll){const t=o.content.poll.results;let n=t;s.results?.results&&(t.results&&s.results.isMin?t.results&&(n={...s.results,results:s.results.results.map((e=>({...e,isChosen:t.results.find((t=>t.option===e.option))?.isChosen}))),isMin:void 0}):n=s.results);const i={...o.content.poll,...s,results:n};e=(0,p.cY)(e,o.chatId,o.id,{content:{...o.content,poll:i}}),(0,a.R3)(e)}break}case"updateMessagePollVote":{const{pollId:t,peerId:s,options:o}=n,i=(0,f.ZB)(e,t);if(!i||!i.content.poll||!i.content.poll.results)break;const{poll:r}=i.content,c=(0,f._5)(e,i.chatId),{recentVoterIds:d,totalVoters:l,results:u}=r.results,m=d?[...d]:[],h=l?l+1:1,g=u?[...u]:[];m.push(s),o.forEach((t=>{const n=g.findIndex((e=>e.option===t)),a=g[n],o=a?{...a}:{option:t,votersCount:0};o.votersCount+=1,c?.id!==s&&s!==e.currentUserId||(o.isChosen=!0),n?g[n]=o:g.push(o)})),e=(0,p.cY)(e,i.chatId,i.id,{content:{...i.content,poll:{...r,results:{...r.results,recentVoterIds:m,totalVoters:h,results:g}}}}),(0,a.R3)(e);break}case"updateServiceNotification":{const{message:a}=n;(0,f.UW)(e)&&t.createServiceNotification({message:a});break}case"updateMessageReactions":{const{chatId:t,id:s,reactions:o}=n,i=(0,f.hj)(e,t,s),r=(0,f.Z1)(e,n.chatId);if(!r||!i)return;e=F(e,t,s,o,r,i.isOutgoing,i),(0,a.R3)(e);break}case"updateMessageExtendedMedia":{const{chatId:t,id:s,media:o,preview:i}=n,r=(0,f.hj)(e,t,s);if(!(0,f.Z1)(e,n.chatId)||!r)return;if(i){if(!r.content.invoice)return;e=(0,p.cY)(e,t,s,{content:{...r.content,invoice:{...r.content.invoice,extendedMedia:i}}}),(0,a.R3)(e)}else o&&(e=(0,p.cY)(e,t,s,{content:{...o}}),(0,a.R3)(e));break}case"updateTranscribedAudio":{const{transcriptionId:t,text:s,isPending:o}=n;e={...e,transcriptions:{...e.transcriptions,[t]:{...e.transcriptions[t]||{},transcriptionId:t,text:s,isPending:o}}},(0,a.R3)(e);break}case"updateMessageSendFailed":{const{chatId:s,localId:o,error:i}=n;i.match(/CHAT_SEND_.+?FORBIDDEN/)&&Object.values(e.byTabId).forEach((e=>{let{id:n}=e;t.showAllowedMessageTypesNotification({chatId:s,tabId:n})})),e=(0,p.cY)(e,s,o,{sendingState:"messageSendingStateFailed"}),(0,a.R3)(e);break}case"updateMessageTranslations":{const{chatId:t,messageIds:s,toLanguageCode:o,translations:i}=n;e=(0,p.TD)(e,t,s,o,i),(0,a.R3)(e);break}}}));var V=n(46586);const W=new Map;let z=V.Z.resolved();const Y=(0,I.Ds)((e=>e()),500,!1);async function J(e,t,n,s,i){let r=arguments.length>5&&void 0!==arguments[5]&&arguments[5],c=arguments.length>6&&void 0!==arguments[6]&&arguments[6];for(var d=arguments.length,l=new Array(d>7?d-7:0),I=7;I<d;I++)l[I-7]=arguments[I];let[v=(0,P._w)()]=l;const w=t.id;let b,Z=o.hT6;switch(i){case m.Uq.Backwards:s?(b=-1,Z+=1):b=void 0;break;case m.Uq.Around:b=-(Math.round(o.hT6/2)+1);break;case m.Uq.Forwards:b=-(o.hT6+1),s&&(Z+=1)}e=(0,a.Rd)();const y=await(0,h.t9)("fetchMessages",{chat:(0,f.Z1)(e,w),offsetId:s,addOffset:b,limit:Z,threadId:n});if(!y)return;const{messages:C,users:E,chats:S,repliesThreadInfos:M}=y;e=(0,a.Rd)();const R=w===o.awM?e.serviceNotifications.filter((e=>{let{isDeleted:t}=e;return!t})).map((e=>{let{message:t}=e;return t})):[],k=[].concat(C,R),T=(0,g.ee)(k,"id"),A=Object.keys(T).map(Number);if(n!==u._f){const t=(0,f.yZ)(e,w,n)||{};A[0]&&t!==A[0]||t===n||A.unshift(n)}e=(0,p.c_)(e,w,T),e=r?(0,p.hv)(e,w,n,A):(0,p.xj)(e,w,n,A),e=(0,p.Sh)(e,(0,g.ee)(E,"id")),e=(0,p.fZ)(e,(0,g.ee)(S,"id")),e=(0,p.j6)(e,M);let N=(0,f.gb)(e,w,n);const x=s?(0,f.of)(e,w,n,s):void 0;if(r&&N&&x&&(x.length&&!(0,g.YE)(N,x)||(e=(0,p.xj)(e,w,n,x),N=(0,f.gb)(e,w,n),e=(0,p.IU)(e,w,n,x),r=!1)),!c){const t=r?x:N,{newViewportIds:a}=K(t,s,i);e=(0,p.y9)(e,w,n,a,v)}(0,a.R3)(e)}function K(e,t,n){const{length:a}=e,s=t?function(e,t){return t<e[0]?0:t>e[e.length-1]?e.length-1:e.findIndex(((n,a)=>n===t||n<t&&e[a+1]>t))}(e,t):-1,i=n===m.Uq.Backwards?s:s+1||a,r=n===m.Uq.Around?Math.round(o.hT6/2):o.hT6,c=i-r,d=i+r-1,l=e.slice(Math.max(0,c),d+1);let u,h;switch(n){case m.Uq.Backwards:u=i>=0,h=c>=0;break;case m.Uq.Forwards:u=i<a,h=d<=a-1;break;case m.Uq.Around:default:u=l.length>0,h=l.length===o.hT6}return{newViewportIds:l,areSomeLocal:u,areAllLocal:h}}async function X(e,t){let n;z=new V.Z;const o=t.attachment?(t,s)=>{W.has(s)||(n=s,W.set(s,o)),e=(0,a.Rd)(),e={...e,fileUploads:{byMessageLocalId:{...e.fileUploads.byMessageLocalId,[s]:{progress:t}}}},(0,a.R3)(e)}:void 0;(t.replyingTo||s.cj)&&await(0,I.Pn)(),e=(0,a.Rd)(),void 0!==t.currentThreadId&&(t.replyingTo||t.currentThreadId===u._f||(t.replyingTo=(0,f.qS)(e,t.chat.id,t.currentThreadId)),t.replyingTo&&!t.replyingToTopId&&t.currentThreadId!==u._f&&(t.replyingToTopId=(0,f.qS)(e,t.chat.id,t.currentThreadId)),await(0,h.t9)("sendMessage",t,o),o&&n&&W.delete(n),z.resolve())}(0,a.iw)("loadViewportMessages",((e,t,n)=>{const{direction:s=m.Uq.Around,isBudgetPreload:o=!1,shouldForceRender:i=!1,tabId:r=(0,P._w)()}=n||{};let{chatId:c,threadId:d}=n||{};if(!c||!d){const t=(0,f.Bt)(e,r);if(!t)return;c=t.chatId,d=t.threadId}const l=(0,f.Z1)(e,c);if(!l||l.isRestricted)return;const u=(0,f.Cb)(e,c,d,r),h=(0,f.gb)(e,c,d);if(u&&u.length&&s!==m.Uq.Around){const n=s===m.Uq.Backwards?u[0]:u[u.length-1],a=Boolean(h&&!h.includes(n)),i=a?(0,f.of)(e,c,d,n):h,{newViewportIds:g,areSomeLocal:v,areAllLocal:w}=K(i,n,s);if(v&&(e=(0,p.y9)(e,c,d,g,r)),(0,I.R3)((()=>{!async function(e,t,n,a,s,o,i,r,c){for(var d=arguments.length,l=new Array(d>9?d-9:0),u=9;u<d;u++)l[u-9]=arguments[u];let[m=(0,P._w)()]=l;n||await J(e,o,i,c,r,a,s,m),s||t.loadViewportMessages({chatId:o.id,threadId:i,direction:r,isBudgetPreload:!0,tabId:m})}(e,t,w,a,o,l,d,s,n,r)})),o)return}else{const t=(0,f.G$)(e,c,r)||(0,f.rd)(e,c,d),n=Boolean(t&&h&&!h.includes(t)),a=(n?(0,f.of)(e,c,d,t):h)||[],{newViewportIds:s,areSomeLocal:i,areAllLocal:u}=K(a,t,m.Uq.Around);i&&(e=(0,p.y9)(e,c,d,s,r)),u||(0,I.R3)((()=>{J(e,l,d,t,m.Uq.Around,n,o,r)}))}(0,a.R3)(e,{forceOnHeavyAnimation:i})})),(0,a.iw)("loadMessage",(async(e,t,n)=>{const{chatId:s,messageId:o,replyOriginForId:i,threadUpdate:r}=n,c=(0,f.Z1)(e,s);if(!c)return;const d=await async function(e,t,n,s){const o=await(0,h.t9)("fetchMessage",{chat:t,messageId:n});if(o){if(o!==u._Q)return e=(0,a.Rd)(),e=(0,p.cY)(e,t.id,n,o.message),e=(0,p.Sh)(e,(0,g.ee)(o.users,"id")),(0,a.R3)(e),o.message;if(s){e=(0,a.Rd)();const n=(0,f.hj)(e,t.id,s);e=(0,p.cY)(e,t.id,s,{...n,replyToMessageId:void 0}),(0,a.R3)(e)}}}(e,c,o,i);if(d&&r){const{lastMessageId:t,isDeleting:n}=r;e=(0,a.Rd)(),e=(0,p.lG)(e,d,s,t,n),(0,a.R3)(e)}})),(0,a.iw)("sendMessage",((e,t,n)=>{const{messageList:a,tabId:s=(0,P._w)()}=n;if(!a)return;const{chatId:i,threadId:r,type:c}=a;if(n=(0,g.CE)(n,["tabId"]),"scheduled"===c&&!n.scheduledAt)return(0,Z.i)(e,{contentToBeScheduled:n},s);const d=(0,f.Z1)(e,i),l=(0,f.Yy)(e,i,r),u=l?(0,f.hj)(e,i,l):void 0,m=d.isForum?(0,f.qS)(e,i,r):u?.replyToTopMessageId||u?.replyToMessageId,h={...n,chat:d,currentThreadId:a.threadId,replyingTo:l,replyingToTopId:m,noWebPage:(0,f.tV)(e,i,r),sendAs:(0,f._5)(e,i)};t.setReplyingToId({messageId:void 0,tabId:s}),t.clearWebPagePreview({tabId:s});const p=!n.attachments||n.attachments.length<=1,I=!p&&n.shouldGroupMessages;if(p){const{attachments:t,...n}=h;X(e,{...n,attachment:t?t[0]:void 0})}else if(I){const{text:t,entities:n,attachments:a,...s}=h,i=function(e){return e.reduce(((e,t,n,a)=>0===n?(e.push([t]),e):(ne(t)===ne(a[n-1])?e[e.length-1].push(t):e.push([t]),e)),[])}(a);i.forEach(((a,i)=>{const r=(0,g.Vl)(a,o.DUi);for(let a=0;a<r.length;a++){const[o,...c]=r[a],d=`${Date.now()}${i}${a}`,l=0===a&&0===i;X(e,{...s,text:l?t:void 0,entities:l?n:void 0,attachment:o,groupedId:c.length>0?d:void 0}),c.forEach((t=>{X(e,{...s,attachment:t,groupedId:d})}))}}))}else{const{text:t,entities:n,attachments:a,replyingTo:s,...o}=h;t&&X(e,{...o,text:t,entities:n,replyingTo:s}),a?.forEach((t=>{X(e,{...o,attachment:t})}))}})),(0,a.iw)("editMessage",((e,t,n)=>{const{messageList:a,text:s,entities:o,tabId:i=(0,P._w)()}=n;if(!a)return;const{chatId:r,threadId:c,type:d}=a,l=(0,f.Z1)(e,r),u=(0,f.kK)(e,r,c,d);l&&u&&((0,h.t9)("editMessage",{chat:l,message:u,text:s,entities:o,noWebPage:(0,f.tV)(e,r,c)}),t.setEditingId({messageId:void 0,tabId:i}))})),(0,a.iw)("cancelSendingMessage",((e,t,n)=>{const{chatId:a,messageId:s}=n,o=(0,f.hj)(e,a,s),i=o&&W.get((0,v.KK)(o));i&&(0,h.u3)(i),t.apiUpdate({"@type":"deleteMessages",ids:[s],chatId:a})})),(0,a.iw)("saveDraft",(async(e,t,n)=>{const{chatId:s,threadId:o,draft:i,shouldForce:r}=n;if(!i)return;const{text:c,entities:d}=i,l=(0,f.Z1)(e,s),u=(0,f.dy)(e,s);u&&(0,v.NB)(u)||(i.isLocal=!0,i.shouldForce=r,e=(0,p.pf)(e,s,o,"draft",i),e=(0,p.a4)(e,s,{draftDate:Math.round(Date.now()/1e3)}),(0,a.R3)(e),await(0,h.t9)("saveDraft",{chat:l,text:c,entities:d,replyToMsgId:(0,f.Yy)(e,s,o),threadId:(0,f.qS)(e,s,o)})&&(i.isLocal=!1),e=(0,a.Rd)(),e=(0,p.pf)(e,s,o,"draft",i),e=(0,p.a4)(e,s,{draftDate:Math.round(Date.now()/1e3)}),(0,a.R3)(e))})),(0,a.iw)("clearDraft",((e,t,n)=>{const{chatId:a,threadId:s=u._f,localOnly:o,shouldForce:i}=n;if(!(0,f.Ms)(e,a,s))return;const r=(0,f.Z1)(e,a);o||(0,h.t9)("clearDraft",r,(0,f.qS)(e,a,s));const c=i?{shouldForce:i,text:""}:void 0;return e=(0,p.pf)(e,a,s,"draft",c),(0,p.a4)(e,a,{draftDate:void 0})})),(0,a.iw)("toggleMessageWebPage",((e,t,n)=>{const{chatId:a,threadId:s,noWebPage:o}=n;return(0,p.pf)(e,a,s,"noWebPage",o)})),(0,a.iw)("pinMessage",((e,t,n)=>{const{messageId:a,isUnpin:s,isOneSide:o,isSilent:i,tabId:r=(0,P._w)()}=n,c=(0,f.jr)(e,r);c&&(0,h.t9)("pinMessage",{chat:c,messageId:a,isUnpin:s,isOneSide:o,isSilent:i})})),(0,a.iw)("unpinAllMessages",(async(e,t,n)=>{const{chatId:s,threadId:o}=n,i=(0,f.Z1)(e,s);if(!i)return;const r=(0,f.qS)(e,s,o);await(0,h.t9)("unpinAllMessages",{chat:i,threadId:r}),e=(0,a.Rd)(),(0,f.KB)(e,s,o)?.forEach((t=>{e=(0,p.cY)(e,s,t,{isPinned:!1})})),e=(0,p.pf)(e,i.id,u._f,"pinnedIds",[]),(0,a.R3)(e)})),(0,a.iw)("deleteMessages",((e,t,n)=>{const{messageIds:a,shouldDeleteForAll:s,tabId:o=(0,P._w)()}=n,i=(0,f.Bt)(e,o);if(!i)return;const{chatId:r,threadId:c}=i,d=(0,f.Z1)(e,r),l=a.filter((t=>{const n=(0,f.hj)(e,r,t);return n&&!(0,v.CI)(n)}));if(!l.length&&a.length)return void G(e,(0,v.eA)(d)?r:void 0,a,t);(0,h.t9)("deleteMessages",{chat:d,messageIds:l,shouldDeleteForAll:s});const u=(0,f._$)(e,r,c);u&&a.includes(u)&&t.setEditingId({messageId:void 0,tabId:o})})),(0,a.iw)("deleteScheduledMessages",((e,t,n)=>{const{messageIds:a,tabId:s=(0,P._w)()}=n,o=(0,f.Bt)(e,s);if(!o)return;const{chatId:i}=o,r=(0,f.Z1)(e,i);(0,h.t9)("deleteScheduledMessages",{chat:r,messageIds:a});const c=(0,f.wU)(e,i);c&&a.includes(c)&&t.setEditingId({messageId:void 0,tabId:s})})),(0,a.iw)("deleteHistory",(async(e,t,n)=>{const{chatId:s,shouldDeleteForAll:o,tabId:i=(0,P._w)()}=n,r=(0,f.Z1)(e,s);if(!r)return;await(0,h.t9)("deleteHistory",{chat:r,shouldDeleteForAll:o}),e=(0,a.Rd)();const c=(0,f.Bt)(e,i);c&&c.chatId===s&&t.openChat({id:void 0,tabId:i});const d=e.chatFolders.byId;Object.values(d).forEach((e=>{if(e.includedChatIds.includes(s)||e.pinnedChatIds?.includes(s)){const t=e.includedChatIds.filter((e=>e!==s)),n=e.pinnedChatIds?.filter((e=>e!==s)),a={...e,includedChatIds:t,pinnedChatIds:n};(0,h.t9)("editChatFolder",{id:e.id,folderUpdate:a})}}))})),(0,a.iw)("reportMessages",(async(e,t,n)=>{const{messageIds:a,reason:s,description:o,tabId:i=(0,P._w)()}=n,r=(0,f.Bt)(e,i);if(!r)return;const{chatId:c}=r,d=(0,f.Z1)(e,c),l=await(0,h.t9)("reportMessages",{peer:d,messageIds:a,reason:s,description:o});t.showNotification({message:l?(0,w.Iu)("ReportPeer.AlertSuccess"):"An error occurred while submitting your report. Please, try again later.",tabId:i})})),(0,a.iw)("sendMessageAction",(async(e,t,n)=>{const{action:a,chatId:s,threadId:o}=n;if("connectionStateReady"!==e.connectionState)return;if(s===e.currentUserId)return;const i=(0,f.Z1)(e,s);if(!i)return;const r=(0,f.dy)(e,s);r&&((0,v.cS)(r)||(0,v.NB)(r))||await(0,h.t9)("sendMessageAction",{peer:i,threadId:o,action:a})})),(0,a.iw)("markMessageListRead",((e,t,n)=>{const{maxId:a,tabId:s=(0,P._w)()}=n,i=(0,f.Bt)(e,s);if(!i)return;const{chatId:r,threadId:c}=i,d=(0,f.Z1)(e,r);if(!d)return;Y((()=>{(0,h.t9)("markMessageListRead",{chat:d,threadId:c,maxId:a})})),r===o.awM&&(e={...e,serviceNotifications:e.serviceNotifications.map((e=>e.isUnread&&e.id<=a?{...e,isUnread:!1}:e))});const l=(0,f.Cb)(e,r,c,s),m=(0,f.It)(e,r,c);if(!l||!m||!d.unreadCount)return e;const g=function(e,t,n){let a=0;for(let s=0,o=e.length;s<o&&(e[s]>=t&&e[s]<=n&&a++,!(e[s]>=n));s++);return a}(l,m,a);if(!g)return e;if(d.isForum&&d.topics?.[c]){const t=d.topics[c];e=(0,p.Xg)(e,r,c,{lastReadInboxMessageId:a});const n=Math.max(0,t.unreadCount-g);return 0===n&&(e=(0,p.a4)(e,r,{unreadCount:Math.max(0,d.unreadCount-1)})),(0,p.Cn)(e,r,c,{unreadCount:n})}return c===u._f?(0,p.a4)(e,r,{lastReadInboxMessageId:a,unreadCount:Math.max(0,d.unreadCount-g)}):void 0})),(0,a.iw)("markMessagesRead",((e,t,n)=>{const{messageIds:a,tabId:s=(0,P._w)()}=n,o=(0,f.jr)(e,s);o&&(0,h.t9)("markMessagesRead",{chat:o,messageIds:a})})),(0,a.iw)("loadWebPagePreview",(async(e,t,n)=>{const{text:s,tabId:o=(0,P._w)()}=n,i=await(0,h.t9)("fetchWebPagePreview",{text:s});e=(0,a.Rd)(),e=(0,Z.i)(e,{webPagePreview:i},o),(0,a.R3)(e)})),(0,a.iw)("clearWebPagePreview",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{};if((0,f.jU)(e,a).webPagePreview)return(0,Z.i)(e,{webPagePreview:void 0},a)})),(0,a.iw)("sendPollVote",((e,t,n)=>{const{chatId:a,messageId:s,options:o}=n,i=(0,f.Z1)(e,a);i&&(0,h.t9)("sendPollVote",{chat:i,messageId:s,options:o})})),(0,a.iw)("cancelPollVote",((e,t,n)=>{const{chatId:a,messageId:s}=n,o=(0,f.Z1)(e,a);o&&(0,h.t9)("sendPollVote",{chat:o,messageId:s,options:[]})})),(0,a.iw)("closePoll",((e,t,n)=>{const{chatId:a,messageId:s}=n,o=(0,f.Z1)(e,a),i=(0,f.hj)(e,a,s)?.content.poll;o&&i&&(0,h.t9)("closePoll",{chat:o,messageId:s,poll:i})})),(0,a.iw)("loadPollOptionResults",(async(e,t,n)=>{const{chat:s,messageId:o,option:i,offset:r,limit:c,shouldResetVoters:d,tabId:l=(0,P._w)()}=n,u=await(0,h.t9)("loadPollOptionResults",{chat:s,messageId:o,option:i,offset:r,limit:c});if(!u)return;e=(0,a.Rd)(),e=(0,p.Sh)(e,(0,g.ee)(u.users,"id")),e=(0,p.fZ)(e,(0,g.ee)(u.chats,"id"));const m=(0,f.jU)(e,l),{pollResults:I}=m,{voters:v}=m.pollResults;e=(0,Z.i)(e,{pollResults:{...I,voters:{...v,[i]:(0,g.Tw)([...!d&&v?.[i]?v[i]:[],...u.votes.map((e=>e.peerId))])},offsets:{...I.offsets?I.offsets:{},[i]:u.nextOffset||""}}},l),(0,a.R3)(e)})),(0,a.iw)("loadExtendedMedia",((e,t,n)=>{const{chatId:a,ids:s}=n,o=(0,f.Z1)(e,a);o&&(0,h.t9)("fetchExtendedMedia",{chat:o,ids:s})})),(0,a.iw)("forwardMessages",((e,t,n)=>{const{isSilent:s,scheduledAt:o,tabId:i=(0,P._w)()}=n,{fromChatId:r,messageIds:c,toChatId:d,withMyScore:l,noAuthors:m,noCaptions:g,toThreadId:p}=(0,f.jU)(e,i).forwardMessages,I=(0,f.wV)(e),w=r?(0,f.Z1)(e,r):void 0,b=d?(0,f.Z1)(e,d):void 0,y=r&&c?c.sort(((e,t)=>e-t)).map((t=>(0,f.hj)(e,r,t))).filter(Boolean):void 0;if(!w||!b||!y||p&&!b.isForum)return;const C=(0,f._5)(e,d),E=y.filter((e=>!(0,v.jM)(e)));E.length&&(async()=>{await z.promise,await(0,h.t9)("forwardMessages",{fromChat:w,toChat:b,toThreadId:p,messages:E,isSilent:s,scheduledAt:o,sendAs:C,withMyScore:l,noAuthors:m,noCaptions:g,isCurrentUserPremium:I})})(),y.filter((e=>(0,v.jM)(e))).forEach((t=>{const{text:n,entities:a}=t.content.text||{},{sticker:i,poll:r}=t.content;X(e,{chat:b,replyingToTopId:p,currentThreadId:p||u._f,text:n,entities:a,sticker:i,poll:r,isSilent:s,scheduledAt:o,sendAs:C})})),e=(0,a.Rd)(),e=(0,Z.i)(e,{forwardMessages:{}},i),(0,a.R3)(e)})),(0,a.iw)("loadScheduledHistory",(async(e,t,n)=>{const{chatId:s}=n,o=(0,f.Z1)(e,s);if(!o)return;const i=await(0,h.t9)("fetchScheduledHistory",{chat:o});if(!i)return;const{messages:r}=i,c=(0,g.ee)(r,"id"),d=Object.keys(c).map(Number).sort(((e,t)=>t-e));if(e=(0,a.Rd)(),e=(0,p.w3)(e,o.id,c),e=(0,p.pf)(e,o.id,u._f,"scheduledIds",d),o?.isForum){const t={};r.forEach((n=>{const a=(0,f.nr)(e,n),s=t[a]||[];s.push(n.id),t[a]=s})),Object.entries(t).forEach((t=>{let[n,a]=t;e=(0,p.pf)(e,o.id,Number(n),"scheduledIds",a)}))}(0,a.R3)(e)})),(0,a.iw)("sendScheduledMessages",((e,t,n)=>{const{chatId:a,id:s}=n,o=(0,f.Z1)(e,a);o&&(0,h.t9)("sendScheduledMessages",{chat:o,ids:[s]})})),(0,a.iw)("rescheduleMessage",((e,t,n)=>{const{chatId:a,messageId:s,scheduledAt:o}=n,i=(0,f.Z1)(e,a),r=i&&(0,f.Tm)(e,i.id,s);i&&r&&(0,h.t9)("rescheduleMessage",{chat:i,message:r,scheduledAt:o})})),(0,a.iw)("requestThreadInfoUpdate",(async(e,t,n)=>{const{chatId:s,threadId:o}=n,i=(0,f.Z1)(e,s);if(!i)return;const r=(0,f.Cm)(e,s,o)?.id,c=await(0,h.t9)("requestThreadInfoUpdate",{chat:i,threadId:o,originChannelId:r});c&&(e=(0,a.Rd)(),e=(0,p.Sh)(e,(0,g.ee)(c.users,"id")),(0,a.R3)(e))})),(0,a.iw)("transcribeAudio",(async(e,t,n)=>{const{messageId:s,chatId:o}=n,i=(0,f.Z1)(e,o);if(!i)return;e=(0,p.cY)(e,o,s,{transcriptionId:""}),(0,a.R3)(e);const r=await(0,h.t9)("transcribeAudio",{chat:i,messageId:s});e=(0,a.Rd)(),e=(0,p.cY)(e,o,s,{transcriptionId:r,isTranscriptionError:!r}),(0,a.R3)(e)})),(0,a.iw)("loadCustomEmojis",(async(e,t,n)=>{const{ids:s,ignoreCache:o}=n,i=o?s:(0,g.Tw)(s.filter((t=>!e.customEmojis.byId[t]))),r=await(0,h.t9)("fetchCustomEmoji",{documentId:i});r&&(e=(0,a.Rd)(),e={...e,customEmojis:{...e.customEmojis,byId:{...e.customEmojis.byId,...(0,g.ee)(r,"id")}}},(0,a.R3)(e))})),(0,a.iw)("loadPinnedMessages",(async(e,t,n)=>{const{chatId:s,threadId:o}=n,i=(0,f.Z1)(e,s);if(!i)return;const r=await(0,h.t9)("fetchPinnedMessages",{chat:i,threadId:o});if(!r)return;const{messages:c,chats:d,users:l}=r,u=(0,g.ee)(c,"id"),m=Object.keys(u).map(Number).sort(((e,t)=>t-e));e=(0,a.Rd)(),e=(0,p.c_)(e,i.id,u),e=(0,p.HX)(e,i.id,o,m),e=(0,p.Sh)(e,(0,g.ee)(l,"id")),e=(0,p.fZ)(e,(0,g.ee)(d,"id")),(0,a.R3)(e)})),(0,a.iw)("loadSeenBy",(async(e,t,n)=>{const{chatId:s,messageId:o}=n,i=(0,f.Z1)(e,s);if(!i)return;const r=await(0,h.t9)("fetchSeenBy",{chat:i,messageId:o});r&&(e=(0,a.Rd)(),e=(0,p.cY)(e,s,o,{seenByDates:r}),(0,a.R3)(e))})),(0,a.iw)("saveDefaultSendAs",((e,t,n)=>{const{chatId:a,sendAsId:s}=n,o=(0,f.Z1)(e,a),i=(0,f.Z1)(e,s)||(0,f.dy)(e,s);if(o&&i)return(0,h.t9)("saveDefaultSendAs",{sendAs:i,chat:o}),(0,p.US)(e,a,{sendAsId:s})})),(0,a.iw)("loadSendAs",(async(e,t,n)=>{const{chatId:s}=n,o=(0,f.Z1)(e,s);if(!o)return;const i=await(0,h.t9)("fetchSendAs",{chat:o});if(!i)return e=(0,a.Rd)(),e=(0,p.a4)(e,s,{sendAsPeerIds:[]}),void(0,a.R3)(e);e=(0,a.Rd)(),e=(0,p.Sh)(e,(0,g.ee)(i.users,"id")),e=(0,p.fZ)(e,(0,g.ee)(i.chats,"id")),e=(0,p.a4)(e,s,{sendAsPeerIds:i.sendAs}),(0,a.R3)(e)})),(0,a.iw)("loadSponsoredMessages",(async(e,t,n)=>{const{chatId:s}=n,o=(0,f.Z1)(e,s);if(!o)return;const i=await(0,h.t9)("fetchSponsoredMessages",{chat:o});i&&(e=(0,a.Rd)(),e=(0,p.Fn)(e,s,i.messages[0]),e=(0,p.Sh)(e,(0,g.ee)(i.users,"id")),e=(0,p.fZ)(e,(0,g.ee)(i.chats,"id")),(0,a.R3)(e))})),(0,a.iw)("viewSponsoredMessage",((e,t,n)=>{const{chatId:a}=n,s=(0,f.Z1)(e,a),o=(0,f.fS)(e,a);s&&o&&(0,h.t9)("viewSponsoredMessage",{chat:s,random:o.randomId})})),(0,a.iw)("fetchUnreadMentions",(async(e,t,n)=>{const{chatId:s,offsetId:o}=n,i=(0,f.Z1)(e,s);if(!i)return;const r=await(0,h.t9)("fetchUnreadMentions",{chat:i,offsetId:o});if(!r)return;const{messages:c,chats:d,users:l}=r,u=(0,g.ee)(c,"id"),m=Object.keys(u).map(Number);e=(0,a.Rd)(),e=(0,p.c_)(e,i.id,u),e=(0,p.Sh)(e,(0,g.ee)(l,"id")),e=(0,p.fZ)(e,(0,g.ee)(d,"id")),e=(0,p.a4)(e,s,{unreadMentions:[...i.unreadMentions||[],...m]}),(0,a.R3)(e)})),(0,a.iw)("markMentionsRead",((e,t,n)=>{const{messageIds:s,tabId:o=(0,P._w)()}=n,i=(0,f.jr)(e,o);if(!i)return;const r=(i.unreadMentions||[]).filter((e=>!s.includes(e)));e=(0,p.a4)(e,i.id,{unreadMentions:r}),(0,a.R3)(e),t.markMessagesRead({messageIds:s,tabId:o})})),(0,a.iw)("focusNextMention",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{},s=(0,f.jr)(e,a);s?.unreadMentions&&t.focusMessage({chatId:s.id,messageId:s.unreadMentions[0],tabId:a})})),(0,a.iw)("readAllMentions",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{},s=(0,f.jr)(e,a);if(s)return(0,h.t9)("readAllMentions",{chat:s}),(0,p.a4)(e,s.id,{unreadMentionsCount:void 0,unreadMentions:void 0})})),(0,a.iw)("openUrl",((e,t,n)=>{const{url:a,shouldSkipModal:s,tabId:i=(0,P._w)()}=n,r=(0,b.X)(a);if(r.match(o.FSu)||r.match(o.g$l))return void t.openTelegramLink({url:a,tabId:i});const{appConfig:c,config:d}=e;if(c){const e=new URL(r);if(d?.autologinToken&&c.autologinDomains.includes(e.hostname))return e.searchParams.set("autologin_token",d.autologinToken),void window.open(e.href,"_blank","noopener");if(c.urlAuthDomains.includes(e.hostname))return void t.requestLinkUrlAuth({url:a,tabId:i})}r.match(o.jL5)||s?window.open(r,"_blank","noopener"):t.toggleSafeLinkModal({url:r,tabId:i})})),(0,a.iw)("setForwardChatOrTopic",(async(e,t,n)=>{const{chatId:s,topicId:o,tabId:i=(0,P._w)()}=n;let r=(0,f.dy)(e,s);if(r&&(0,f.Nm)(e,i)){let n=(0,f.iF)(e,s);if(!n){const{accessHash:t}=r,o=await(0,h.t9)("fetchFullUser",{id:s,accessHash:t});e=(0,a.Rd)(),r=o?.user,n=o?.fullInfo}if(n.noVoiceMessages)return void t.showDialog({data:{message:(0,w.Iu)("VoiceMessagesRestrictedByPrivacy",(0,v.Js)(r))},tabId:i})}(0,f.GQ)(e,s,i)?(e=(0,Z.i)(e,{forwardMessages:{...(0,f.jU)(e,i).forwardMessages,toChatId:s,toThreadId:o,isModalShown:!1}},i),(0,a.R3)(e),t.openChat({id:s,threadId:o,tabId:i}),t.closeMediaViewer({tabId:i}),t.exitMessageSelectMode({tabId:i})):t.showAllowedMessageTypesNotification({chatId:s,tabId:i})})),(0,a.iw)("forwardToSavedMessages",((e,t,n)=>{const{tabId:s=(0,P._w)()}=n||{};e=(0,Z.i)(e,{forwardMessages:{...(0,f.jU)(e,s).forwardMessages,toChatId:e.currentUserId}},s),(0,a.R3)(e),t.exitMessageSelectMode({tabId:s}),t.forwardMessages({isSilent:!0,tabId:s})})),(0,a.iw)("requestMessageTranslation",((e,t,n)=>{const{chatId:a,id:s,toLanguageCode:o=(0,f.Mc)(e),tabId:i=(0,P._w)()}=n;return e=(0,p.ql)(e,a,s,o,i),(0,p.BI)(e,{translationLanguage:o})})),(0,a.iw)("showOriginalMessage",((e,t,n)=>{const{chatId:a,id:s,tabId:o=(0,P._w)()}=n;return(0,p.IR)(e,a,s,o)})),(0,a.iw)("markMessagesTranslationPending",((e,t,n)=>{const{chatId:a,messageIds:s,toLanguageCode:o=(0,f.rB)(e)}=n;return s.forEach((t=>{e=(0,p.qt)(e,a,t,o,{isPending:!0})})),e})),(0,a.iw)("translateMessages",((e,t,n)=>{const{chatId:a,messageIds:s,toLanguageCode:o=(0,f.rB)(e)}=n,i=(0,f.Z1)(e,a);if(i)return t.markMessagesTranslationPending({chatId:a,messageIds:s,toLanguageCode:o}),(0,h.t9)("translateText",{chat:i,messageIds:s,toLanguageCode:o}),e}));let Q,ee={};function te(){Q&&(clearTimeout(Q),Q=void 0);const{loadMessageViews:e}=(0,a.Sv)();Object.entries(ee).forEach((t=>{let[n,a]=t;e({chatId:n,ids:Array.from(a),shouldIncrement:!0})})),ee={}}function ne(e){const{shouldSendAsFile:t,mimeType:n}=e;return t?"file":n===o.s11?"gif":o.oGt.has(n)||o.wGh.has(n)?"media":o.e74.has(n)?"audio":e.voice?"voice":"file"}(0,a.iw)("scheduleForViewsIncrement",((e,t,n)=>{const{ids:a,chatId:s}=n;Q||setTimeout(te,1e3),ee[s]||(ee[s]=new Set),a.forEach((e=>{ee[s].add(e)}))})),(0,a.iw)("loadMessageViews",(async(e,t,n)=>{const{chatId:s,ids:o,shouldIncrement:i}=n,r=(0,f.Z1)(e,s);if(!r)return;const c=await(0,h.t9)("fetchMessageViews",{chat:r,ids:o,shouldIncrement:i});c&&(e=(0,a.Rd)(),c.forEach((t=>{e=(0,p.cY)(e,s,t.id,{views:t.views,forwards:t.forwards});const n=(0,f.hj)(e,s,t.id);if(!n)return;const a=n.repliesThreadInfo?.chatId,o=n.repliesThreadInfo?.threadId;a&&o&&(e=(0,p.Xg)(e,a,o,{messagesCount:t.messagesCount,recentReplierIds:t.recentReplierIds,lastMessageId:t.maxId,lastReadInboxMessageId:t.readMaxId}))})),(0,a.R3)(e))}));var ae=n(85765),se=n(9211);const oe=(0,I.P2)((e=>e()),500,!1);async function ie(e,t){const n=await(0,h.t9)("fetchRecentStickers",{hash:t});n&&(e=(0,a.Rd)(),e={...e,stickers:{...e.stickers,recent:n}},(0,a.R3)(e))}async function re(e,t,n){for(var s=arguments.length,o=new Array(s>3?s-3:0),i=3;i<s;i++)o[i-3]=arguments[i];let r,[c=(0,P._w)()]=o;try{r=await(0,h.t9)("fetchStickers",{stickerSetInfo:n})}catch(s){if("STICKERSET_INVALID"===s.message)return t.showNotification({message:(0,w.Iu)("StickerPack.ErrorNotFound"),tabId:c}),void("shortName"in n&&(0,f.jU)(e,c).openedStickerSetShortName===n.shortName&&(e=(0,Z.i)(e,{openedStickerSetShortName:void 0},c),(0,a.R3)(e)))}if(e=(0,a.Rd)(),!r)return;const{set:d,stickers:l,packs:u}=r,m=(e=(0,p.Rg)(e,d.id,{...d,stickers:l,packs:u})).stickers.forEmoji.emoji;m&&u[m]&&(e=(0,p.vy)(e)),(0,a.R3)(e)}async function ce(e,t,n,s){for(var o=arguments.length,i=new Array(o>4?o-4:0),r=4;r<o;r++)i[r-4]=arguments[r];let[c=(0,P._w)()]=i;const d=await(0,h.t9)("searchGifs",{query:t,offset:s,username:n});d&&(e=(0,a.Rd)(),e=(0,p.rq)(e,!s,d.gifs,d.nextOffset,c),(0,a.R3)(e))}(0,a.iw)("loadStickerSets",(async(e,t)=>{const[n,s]=await Promise.all([(0,h.t9)("fetchStickerSets",{hash:e.stickers.added.hash}),(0,h.t9)("fetchCustomEmojiSets",{hash:e.customEmojis.added.hash})]);s&&n&&(e=(0,a.Rd)(),e=(0,p.z3)(e,"added",n.hash,n.sets),e=(0,p.cU)(e,s.hash,s.sets),(0,a.R3)(e),t.loadCustomEmojis({ids:e.recentCustomEmojis}))})),(0,a.iw)("loadAddedStickers",(async(e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{},{added:{setIds:s=[]},setsById:o}=e.stickers,{added:{setIds:i=[]}}=e.customEmojis,r=[...s,...i];if(r.length)for(let e=0;e<r.length;e++){const n=r[e];o[n]?.stickers||(t.loadStickers({stickerSetInfo:{id:n,accessHash:o[n].accessHash},tabId:a}),e%10==0&&e>0&&await(0,I.wO)(200))}})),(0,a.iw)("loadRecentStickers",(e=>{const{hash:t}=e.stickers.recent||{};ie(e,t)})),(0,a.iw)("loadFavoriteStickers",(async e=>{const{hash:t}=e.stickers.favorite||{},n=await(0,h.t9)("fetchFavoriteStickers",{hash:t});n&&(e=(0,a.Rd)(),e={...e,stickers:{...e.stickers,favorite:n}},(0,a.R3)(e))})),(0,a.iw)("loadPremiumStickers",(async e=>{const{hash:t}=e.stickers.premium||{},n=await(0,h.t9)("fetchStickersForEmoji",{emoji:"⭐️⭐️",hash:t});n&&(e=(0,a.Rd)(),e={...e,stickers:{...e.stickers,premium:{hash:n.hash,stickers:n.stickers}}},(0,a.R3)(e))})),(0,a.iw)("loadPremiumSetStickers",(async e=>{const{hash:t}=e.stickers.premium||{},n=await(0,h.t9)("fetchStickersForEmoji",{emoji:"📂⭐️",hash:t});n&&(e=(0,a.Rd)(),e={...e,stickers:{...e.stickers,premiumSet:{hash:n.hash,stickers:n.stickers}}},(0,a.R3)(e))})),(0,a.iw)("loadGreetingStickers",(async e=>{const{hash:t}=e.stickers.greeting||{},n=await(0,h.t9)("fetchStickersForEmoji",{emoji:"👋⭐️",hash:t});n&&(e=(0,a.Rd)(),e={...e,stickers:{...e.stickers,greeting:{hash:n.hash,stickers:n.stickers.filter((e=>"👋"===e.emoji))}}},(0,a.R3)(e))})),(0,a.iw)("loadFeaturedStickers",(async e=>{const{hash:t}=e.stickers.featured||{},n=await(0,h.t9)("fetchFeaturedStickers",{hash:t});n&&(e=(0,a.Rd)(),e=(0,p.z3)(e,"featured",n.hash,n.sets),(0,a.R3)(e))})),(0,a.iw)("loadPremiumGifts",(async e=>{const t=await(0,h.t9)("fetchPremiumGifts");if(!t)return;const{set:n,stickers:s}=t;e=(0,a.Rd)(),e={...e,premiumGifts:{...n,stickers:s}},(0,a.R3)(e)})),(0,a.iw)("loadDefaultTopicIcons",(async e=>{const t=await(0,h.t9)("fetchDefaultTopicIcons");if(!t)return;e=(0,a.Rd)();const{set:n,stickers:s}=t,o={...n,stickers:s};e=(0,p.Rg)(e,o.id,o),e={...e,defaultTopicIconsId:o.id},(0,a.R3)(e)})),(0,a.iw)("loadDefaultStatusIcons",(async e=>{const t=await(0,h.t9)("fetchDefaultStatusEmojis");if(!t)return;e=(0,a.Rd)();const{set:n,stickers:s}=t,o={...n,stickers:s};e=(0,p.Rg)(e,o.id,o),e={...e,defaultStatusIconsId:o.id},(0,a.R3)(e)})),(0,a.iw)("loadStickers",((e,t,n)=>{const{stickerSetInfo:a,tabId:s=(0,P._w)()}=n,o=(0,f.Ny)(e,a);o&&o.count===o?.stickers?.length||re(e,t,a,s)})),(0,a.iw)("loadAnimatedEmojis",(async e=>{const[t,n]=await Promise.all([(0,h.t9)("fetchAnimatedEmojis"),(0,h.t9)("fetchAnimatedEmojiEffects")]);t&&n&&(e=(0,a.Rd)(),e=(0,p.g_)(e,{...t.set,stickers:t.stickers}),e={...e,animatedEmojiEffects:{...n.set,stickers:n.stickers}},(0,a.R3)(e))})),(0,a.iw)("loadGenericEmojiEffects",(async e=>{const t=await(0,h.t9)("fetchGenericEmojiEffects");if(!t)return;e=(0,a.Rd)();const{set:n,stickers:s}=t;e={...e,genericEmojiEffects:{...n,stickers:s}},(0,a.R3)(e)})),(0,a.iw)("loadSavedGifs",(async e=>{const{hash:t}=e.gifs.saved,n=await(0,h.t9)("fetchSavedGifs",{hash:t});n&&(e=(0,a.Rd)(),e={...e,gifs:{...e.gifs,saved:n}},(0,a.R3)(e))})),(0,a.iw)("saveGif",(async(e,t,n)=>{const{gif:s,shouldUnsave:o,tabId:i=(0,P._w)()}=n,r=e.gifs.saved.gifs?.length,c=(0,se.M)(e,"savedGifs"),d=(0,se.P)(e,"savedGifs"),l=(0,f.wV)(e);if(!o&&r&&r>=c&&t.showNotification({title:w.Iu("LimitReachedFavoriteGifs",c.toString()),message:l?w.Iu("LimitReachedFavoriteGifsSubtitlePremium"):w.Iu("LimitReachedFavoriteGifsSubtitle",d.toString()),...!l&&{action:{action:"openPremiumModal",payload:{tabId:i}}},className:"bold-link",tabId:i}),!await(0,h.t9)("saveGif",{gif:s,shouldUnsave:o}))return;const u=(e=(0,a.Rd)()).gifs.saved.gifs?.filter((e=>{let{id:t}=e;return t!==s.id}))||[],m=o?u:[s,...u];e={...e,gifs:{...e.gifs,saved:{...e.gifs.saved,gifs:m}}},(0,a.R3)(e)})),(0,a.iw)("faveSticker",((e,t,n)=>{const{sticker:a,tabId:s=(0,P._w)()}=n,o=e.stickers.favorite.stickers.length,i=(0,se.M)(e,"stickersFaved"),r=(0,se.P)(e,"stickersFaved"),c=(0,f.wV)(e);o>=i&&t.showNotification({title:w.Iu("LimitReachedFavoriteStickers",i.toString()),message:c?w.Iu("LimitReachedFavoriteStickersSubtitlePremium"):w.Iu("LimitReachedFavoriteStickersSubtitle",r.toString()),...!c&&{action:{action:"openPremiumModal",payload:{tabId:s}}},className:"bold-link",tabId:s}),a&&(0,h.t9)("faveSticker",{sticker:a})})),(0,a.iw)("unfaveSticker",((e,t,n)=>{const{sticker:s}=n;s&&(e=(0,a.Rd)(),e={...e,stickers:{...e.stickers,favorite:{...e.stickers.favorite,stickers:e.stickers.favorite.stickers.filter((e=>{let{id:t}=e;return t!==s.id}))}}},(0,a.R3)(e),(0,h.t9)("faveSticker",{sticker:s,unfave:!0}))})),(0,a.iw)("removeRecentSticker",(async(e,t,n)=>{const{sticker:s}=n;await(0,h.t9)("removeRecentSticker",{sticker:s})&&ie((0,a.Rd)())})),(0,a.iw)("clearRecentStickers",(async e=>{await(0,h.t9)("clearRecentStickers")&&(e=(0,a.Rd)(),e={...e,stickers:{...e.stickers,recent:{stickers:[]}}},(0,a.R3)(e))})),(0,a.iw)("toggleStickerSet",((e,t,n)=>{const{stickerSetId:a}=n,s=(0,f.Ny)(e,a);if(!s)return;const{accessHash:o,installedDate:i,isArchived:r}=s,c=!r&&Boolean(i);(0,h.t9)(c?"uninstallStickerSet":"installStickerSet",{stickerSetId:a,accessHash:o})})),(0,a.iw)("loadEmojiKeywords",(async(e,t,n)=>{const{language:s}=n;let o=e.emojiKeywords[s];if(o?.isLoading)return;e={...e,emojiKeywords:{...e.emojiKeywords,[s]:{...o,isLoading:!0}}},(0,a.R3)(e);const i=await(0,h.t9)("fetchEmojiKeywords",{language:s,fromVersion:o?o.version:0});if(o=(e=(0,a.Rd)()).emojiKeywords[s],!i)return e={...e,emojiKeywords:{...e.emojiKeywords,[s]:{...o,isLoading:!1}}},void(0,a.R3)(e);e={...e,emojiKeywords:{...e.emojiKeywords,[s]:{isLoading:!1,version:i.version,keywords:{...o?.keywords,...i.keywords}}}},(0,a.R3)(e)})),(0,a.iw)("setStickerSearchQuery",((e,t,n)=>{const{query:s,tabId:o=(0,P._w)()}=n;s&&oe((async()=>{const t=await(0,h.t9)("searchStickers",{query:s});if(!t)return;e=(0,a.Rd)();const{setsById:n,added:i}=e.stickers,r=t.sets.map((e=>{let{id:t}=e;return t}));i.setIds&&i.setIds.forEach((e=>{if(!r.includes(e)){const{title:t}=n[e]||{};t&&(0,ae.Z)(t,s)&&r.unshift(e)}})),e=(0,p.z3)(e,"search",t.hash,t.sets),e=(0,p.fH)(e,t.hash,r,o),(0,a.R3)(e)}))})),(0,a.iw)("setGifSearchQuery",((e,t,n)=>{const{query:s,tabId:o=(0,P._w)()}=n;"string"==typeof s&&oe((()=>{ce(e=(0,a.Rd)(),s,e.config?.gifSearchUsername,void 0,o)}))})),(0,a.iw)("searchMoreGifs",((e,t,n)=>{const{tabId:s=(0,P._w)()}=n||{},{query:o,offset:i}=(0,f.jU)(e,s).gifSearch;"string"==typeof o&&oe((()=>{ce(e=(0,a.Rd)(),o,e.config?.gifSearchUsername,i,s)}))})),(0,a.iw)("loadStickersForEmoji",((e,t,n)=>{const{emoji:s}=n,{hash:o}=e.stickers.forEmoji;oe((async()=>{e=(0,a.Rd)(),e={...e,stickers:{...e.stickers,forEmoji:{...e.stickers.forEmoji,emoji:s}}},(0,a.R3)(e);const t=await(0,h.t9)("fetchStickersForEmoji",{emoji:s,hash:o});e=(0,a.Rd)(),t&&e.stickers.forEmoji.emoji===s&&(e=(0,p.IM)(e,s,t.stickers,t.hash),(0,a.R3)(e))}))})),(0,a.iw)("clearStickersForEmoji",(e=>({...e,stickers:{...e.stickers,forEmoji:{}}}))),(0,a.iw)("loadCustomEmojiForEmoji",((e,t,n)=>{const{emoji:a}=n;return(0,p.AA)(e,a)})),(0,a.iw)("clearCustomEmojiForEmoji",(e=>({...e,customEmojis:{...e.customEmojis,forEmoji:{}}}))),(0,a.iw)("loadFeaturedEmojiStickers",(async e=>{const t=await(0,h.t9)("fetchFeaturedEmojiStickers");t&&(e=(0,a.Rd)(),e={...e,customEmojis:{...e.customEmojis,featuredIds:t.sets.map((e=>{let{id:t}=e;return t})),byId:{...e.customEmojis.byId,...(0,g.ee)(t.sets.flatMap((e=>e.stickers||[])),"id")}},stickers:{...e.stickers,setsById:{...e.stickers.setsById,...(0,g.ee)(t.sets,"id")}}},(0,a.R3)(e))})),(0,a.iw)("openStickerSet",(async(e,t,n)=>{const{stickerSetInfo:s,tabId:o=(0,P._w)()}=n;(0,f.Ny)(e,s)||await re(e,t,s,o),e=(0,a.Rd)();const i=(0,f.Ny)(e,s);i?.shortName&&(e=(0,Z.i)(e,{openedStickerSetShortName:i.shortName},o),(0,a.R3)(e))})),(0,a.iw)("loadRecentEmojiStatuses",(async e=>{const t=await(0,h.t9)("fetchRecentEmojiStatuses");t&&(e=(0,a.Rd)(),e=(0,p.et)(e,t.hash,t.emojiStatuses),(0,a.R3)(e))}));var de=n(790);const le=(0,I.P2)((e=>e()),500,!1);async function ue(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0,s=arguments.length>3?arguments[3]:void 0,i=arguments.length>4?arguments[4]:void 0,r=arguments.length>5?arguments[5]:void 0,c=arguments.length>6?arguments[6]:void 0;for(var d=arguments.length,l=new Array(d>7?d-7:0),u=7;u<d;u++)l[u-7]=arguments[u];let m,[I=(0,P._w)()]=l;if(i){const e=(0,h.t9)("searchMessagesLocal",{chat:i,query:t,type:n,limit:o.Hkl,offsetId:s,minDate:c,maxDate:r}),a=i.isForum?(0,h.t9)("fetchTopics",{chat:i,query:t,limit:o.XM3}):void 0,[d,l]=await Promise.all([e,a]);if(d){const{messages:e,users:t,totalCount:n,nextOffsetId:a}=d,{topics:s,count:o}=l||{};m={topics:s,totalTopicsCount:o,messages:e,users:t,chats:[],totalCount:n,nextRate:a}}}else m=await(0,h.t9)("searchMessagesGlobal",{query:t,offsetRate:s,limit:o.Hkl,type:n,maxDate:r,minDate:c});e=(0,a.Rd)();const v=(0,f.JX)(e,I);if(!m||""!==t&&t!==v)return e=(0,p.xv)(e,{messages:!1},I),void(0,a.R3)(e);const{messages:w,users:b,chats:Z,totalCount:y,nextRate:C}=m;Z.length&&(e=(0,p.fZ)(e,(0,g.ee)(Z,"id"))),b.length&&(e=(0,p.Sh)(e,(0,g.ee)(b,"id"))),w.length&&(e=(0,p.m6)(e,w)),e=(0,p.px)(e,w,y,n,C,I),m.topics&&(e=(0,p.XG)(e,i.id,m.totalTopicsCount,m.topics));const E=m.topics?.map((e=>{let{id:t}=e;return t})).sort(((e,t)=>t-e));e=(0,p.No)(e,{foundTopicIds:E},I),(0,a.R3)(e)}async function me(e,t,n,s,i){let r=arguments.length>5&&void 0!==arguments[5]&&arguments[5];for(var c=arguments.length,d=new Array(c>6?c-6:0),l=6;l<c;l++)d[l-6]=arguments[l];let[m=(0,P._w)()]=d;const I=await(0,h.t9)("searchMessagesLocal",{chat:t,type:s,limit:2*o.ENB,topMessageId:n===u._f?void 0:n,offsetId:i});if(!I)return;const{chats:v,users:w,messages:b,totalCount:Z,nextOffsetId:y}=I,C=(0,g.ee)(b,"id"),E=Object.keys(C).map(Number);e=(0,a.Rd)();const S=(0,f.we)(e,m);S&&(e=(0,p.fZ)(e,(0,g.ee)(v,"id")),e=(0,p.Sh)(e,(0,g.ee)(w,"id")),e=(0,p.c_)(e,t.id,C),e=(0,p.c1)(e,t.id,n,s,E,Z,y,m),(0,a.R3)(e),r||me(e,t,n,s,y,!0,m))}(0,a.iw)("setGlobalSearchQuery",((e,t,n)=>{const{query:s,tabId:o=(0,P._w)()}=n,{chatId:i}=(0,f.jU)(e,o).globalSearch;s&&!i&&le((async()=>{const t=await(0,h.t9)("searchChats",{query:s});e=(0,a.Rd)();const n=(0,f.JX)(e,o);if(!t||!n||s!==n)return e=(0,p.xv)(e,{chats:!1},o),void(0,a.R3)(e);const{localChats:i,localUsers:r,globalChats:c,globalUsers:d}=t;(i.length||c.length)&&(e=(0,p.fZ)(e,(0,g.ee)([...i,...c],"id"))),(r.length||d.length)&&(e=(0,p.Sh)(e,(0,g.ee)([...r,...d],"id"))),e=(0,p.xv)(e,{chats:!1},o),e=(0,p.No)(e,{localResults:{chatIds:i.map((e=>{let{id:t}=e;return t})),userIds:r.map((e=>{let{id:t}=e;return t}))},globalResults:{...(0,f.jU)(e,o).globalSearch.globalResults,chatIds:c.map((e=>{let{id:t}=e;return t})),userIds:d.map((e=>{let{id:t}=e;return t}))}},o),(0,a.R3)(e)}))})),(0,a.iw)("setGlobalSearchDate",((e,t,n)=>{const{date:s,tabId:o=(0,P._w)()}=n,i=s?(0,de.IS)(s):s;e=(0,p.No)(e,{date:s,query:"",resultsByType:{...(0,f.jU)(e,o).globalSearch.resultsByType,text:{totalCount:void 0,foundIds:[],nextOffsetId:0}}},o),(0,a.R3)(e);const{chatId:r}=(0,f.jU)(e,o).globalSearch;ue(e,"","text",void 0,r?(0,f.Z1)(e,r):void 0,i,s,o)})),(0,a.iw)("searchMessagesGlobal",((e,t,n)=>{const{type:a,tabId:s=(0,P._w)()}=n,{query:o,resultsByType:i,chatId:r,date:c}=(0,f.jU)(e,s).globalSearch,d=c?(0,de.IS)(c):c,l=i?.[a]?.nextOffsetId;ue(e,o,a,l,r?(0,f.Z1)(e,r):void 0,d,c,s)})),(0,a.iw)("searchTextMessagesLocal",(async(e,t,n)=>{const{tabId:s=(0,P._w)()}=n||{},{chatId:i,threadId:r}=(0,f.Bt)(e,s)||{},c=i?(0,f.Z1)(e,i):void 0;let d=(0,f.n5)(e,s);if(!c||!d||!r)return;const{query:l,results:m}=d,I=m?.nextOffsetId;let v;if(r!==u._f&&(v=(0,f.tZ)(e,i,r)?.topMessageId),!l)return;const w=await(0,h.t9)("searchMessagesLocal",{chat:c,type:"text",query:l,topMessageId:v,limit:o.pnA,offsetId:I});if(!w)return;const{chats:b,users:Z,messages:y,totalCount:C,nextOffsetId:E}=w,S=(0,g.ee)(y,"id"),M=Object.keys(S).map(Number);e=(0,a.Rd)(),d=(0,f.n5)(e,s),d&&l===d.query&&(e=(0,p.fZ)(e,(0,g.ee)(b,"id")),e=(0,p.Sh)(e,(0,g.ee)(Z,"id")),e=(0,p.c_)(e,c.id,S),e=(0,p.dx)(e,c.id,r,M,C,E,s),(0,a.R3)(e))})),(0,a.iw)("searchMediaMessagesLocal",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{},{chatId:s,threadId:o}=(0,f.Bt)(e,a)||{};if(!s||!o)return;const i=(0,f.Z1)(e,s),r=(0,f.we)(e,a);if(!i||!r)return;const{currentType:c,resultsByType:d}=r,l=(c&&d&&d[c])?.nextOffsetId;c&&me(e,i,o,c,l,void 0,a)})),(0,a.iw)("searchMessagesByDate",(async(e,t,n)=>{const{timestamp:a,tabId:s=(0,P._w)()}=n,{chatId:o}=(0,f.Bt)(e,s)||{};if(!o)return;const i=(0,f.Z1)(e,o);if(!i)return;const r=await(0,h.t9)("findFirstMessageIdAfterDate",{chat:i,timestamp:a});r&&t.focusMessage({chatId:i.id,messageId:r,tabId:s})})),(0,a.iw)("checkPublicLink",(async(e,t,n)=>{const{username:s,tabId:o=(0,P._w)()}=n,{chatId:i}=(0,f.Bt)(e,o)||{};if(!i)return;if((0,f.jU)(e,o).management.progress===m.wv.InProgress)return;e=(0,p.fw)(e,i,{isUsernameAvailable:void 0,checkedUsername:void 0},o),(0,a.R3)(e);const{result:r,error:c}=await(0,h.t9)("checkChatUsername",{username:s});e=(0,a.Rd)(),e=(0,p.H9)(e,!0===r?m.wv.Complete:m.wv.Error,o),e=(0,p.fw)(e,i,{isUsernameAvailable:!0===r,checkedUsername:s,error:c},o),(0,a.R3)(e),void 0===r&&t.openLimitReachedModal({limit:"channelsPublic",tabId:o})})),(0,a.iw)("updatePublicLink",(async(e,t,n)=>{const{username:s,shouldDisableUsernames:o,tabId:i=(0,P._w)()}=n,{chatId:r}=(0,f.Bt)(e,i)||{};if(!r)return;const c=await(0,l.X9)(e,t,r,i);if(!c)return;e=(0,a.Rd)(),e=(0,p.H9)(e,m.wv.InProgress,i),(0,a.R3)(e);const d=await(0,h.t9)("setChatUsername",{chat:c,username:s});o&&await(0,h.t9)("deactivateAllUsernames",{chat:c}),e=(0,a.Rd)(),e=(0,p.H9)(e,d?m.wv.Complete:m.wv.Error,i),e=(0,p.fw)(e,r,{isUsernameAvailable:void 0,checkedUsername:void 0,error:void 0},i),(0,a.R3)(e)})),(0,a.iw)("updatePrivateLink",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{},{chatId:s}=(0,f.Bt)(e,a)||{},o=s&&(0,f.Z1)(e,s);s&&o&&(0,h.t9)("updatePrivateLink",{chat:o})})),(0,a.iw)("setEditingExportedInvite",((e,t,n)=>{const{chatId:s,invite:o,tabId:i=(0,P._w)()}=n;e=(0,p.fw)(e,s,{editingInvite:o},i),(0,a.R3)(e)})),(0,a.iw)("setOpenedInviteInfo",((e,t,n)=>{const{chatId:s,invite:o,tabId:i=(0,P._w)()}=n,r=o?{inviteInfo:{invite:o}}:{inviteInfo:void 0};e=(0,p.fw)(e,s,r,i),(0,a.R3)(e)})),(0,a.iw)("loadExportedChatInvites",(async(e,t,n)=>{const{chatId:s,adminId:o,isRevoked:i,limit:r,tabId:c=(0,P._w)()}=n,d=(0,f.Z1)(e,s),l=(0,f.dy)(e,o||e.currentUserId);if(!d||!l)return;const u=await(0,h.t9)("fetchExportedChatInvites",{peer:d,admin:l,isRevoked:i,limit:r});if(!u)return;e=(0,a.Rd)();const{invites:m,users:I}=u;e=(0,p.Sh)(e,(0,g.ee)(I,"id"));const v=i?{revokedInvites:m}:{invites:m};e=(0,p.fw)(e,s,v,c),(0,a.R3)(e)})),(0,a.iw)("editExportedChatInvite",(async(e,t,n)=>{const{chatId:s,link:o,isRevoked:i,expireDate:r,usageLimit:c,isRequestNeeded:d,title:l,tabId:u=(0,P._w)()}=n,m=(0,f.Z1)(e,s);if(!m)return;const I=await(0,h.t9)("editExportedChatInvite",{peer:m,link:o,isRevoked:i,expireDate:r,usageLimit:c,isRequestNeeded:d,title:l});if(!I)return;const{oldInvite:v,newInvite:w,users:b}=I;e=(0,a.Rd)();const{management:Z}=(0,f.jU)(e,u),y=(Z.byChatId[s].invites||[]).filter((e=>e.link!==v.link)),C=[...Z.byChatId[s].revokedInvites||[]];w.isRevoked?C.unshift(w):y.push(w),e=(0,p.Sh)(e,(0,g.ee)(b,"id")),e=(0,p.fw)(e,s,{invites:y,revokedInvites:C},u),(0,a.R3)(e)})),(0,a.iw)("exportChatInvite",(async(e,t,n)=>{const{chatId:s,expireDate:o,usageLimit:i,isRequestNeeded:r,title:c,tabId:d=(0,P._w)()}=n,l=(0,f.Z1)(e,s);if(!l)return;const u=await(0,h.t9)("exportChatInvite",{peer:l,expireDate:o,usageLimit:i,isRequestNeeded:r,title:c});if(!u)return;e=(0,a.Rd)();const m=(0,f.jU)(e,d).management.byChatId[s].invites||[];e=(0,p.fw)(e,s,{invites:[...m,u]},d),(0,a.R3)(e)})),(0,a.iw)("deleteExportedChatInvite",(async(e,t,n)=>{const{chatId:s,link:o,tabId:i=(0,P._w)()}=n,r=(0,f.Z1)(e,s);if(!r)return;if(!await(0,h.t9)("deleteExportedChatInvite",{peer:r,link:o}))return;e=(0,a.Rd)();const c=(0,f.jU)(e,i).management.byChatId[s];e=(0,p.fw)(e,s,{invites:c?.invites?.filter((e=>e.link!==o)),revokedInvites:c?.revokedInvites?.filter((e=>e.link!==o))},i),(0,a.R3)(e)})),(0,a.iw)("deleteRevokedExportedChatInvites",(async(e,t,n)=>{const{chatId:s,adminId:o,tabId:i=(0,P._w)()}=n,r=(0,f.Z1)(e,s),c=(0,f.dy)(e,o||e.currentUserId);r&&c&&await(0,h.t9)("deleteRevokedExportedChatInvites",{peer:r,admin:c})&&(e=(0,a.Rd)(),e=(0,p.fw)(e,s,{revokedInvites:[]},i),(0,a.R3)(e))})),(0,a.iw)("loadChatInviteImporters",(async(e,t,n)=>{const{chatId:s,link:o,offsetDate:i,offsetUserId:r,limit:c,tabId:d=(0,P._w)()}=n,l=(0,f.Z1)(e,s),u=r?(0,f.dy)(e,r):void 0;if(!l||r&&!u)return;const m=await(0,h.t9)("fetchChatInviteImporters",{peer:l,link:o,offsetDate:i,offsetUser:u,limit:c});if(!m)return;const{importers:g,users:I}=m;e=(0,a.Rd)();const v=(0,f.jU)(e,d).management.byChatId[s]?.inviteInfo;v?.invite&&v.invite.link===o&&(e=(0,p.fw)(e,s,{inviteInfo:{...v,importers:g}},d),e=(0,p.Sh)(e,I),(0,a.R3)(e))})),(0,a.iw)("loadChatInviteRequesters",(async(e,t,n)=>{const{chatId:s,link:o,offsetDate:i,offsetUserId:r,limit:c,tabId:d=(0,P._w)()}=n,l=(0,f.Z1)(e,s),u=r?(0,f.dy)(e,r):void 0;if(!l||r&&!u)return;const m=await(0,h.t9)("fetchChatInviteImporters",{peer:l,link:o,offsetDate:i,offsetUser:u,limit:c,isRequested:!0});if(!m)return;const{importers:g,users:I}=m;e=(0,a.Rd)();const v=(0,f.jU)(e,d).management.byChatId[s]?.inviteInfo;v?.invite&&v.invite.link===o&&(e=(0,p.fw)(e,s,{inviteInfo:{...v,requesters:g}},d),e=(0,p.Sh)(e,I),(0,a.R3)(e))})),(0,a.iw)("loadChatJoinRequests",(async(e,t,n)=>{const{chatId:s,offsetDate:o=0,offsetUserId:i,limit:r=0}=n,c=(0,f.Z1)(e,s),d=i?(0,f.dy)(e,i):void 0;if(!c||i&&!d)return;const l=await(0,h.t9)("fetchChatInviteImporters",{peer:c,offsetDate:o,offsetUser:d,limit:r,isRequested:!0});if(!l)return;const{importers:u,users:m}=l;e=(0,a.Rd)(),e=(0,p.a4)(e,s,{joinRequests:u}),e=(0,p.Sh)(e,m),(0,a.R3)(e)})),(0,a.iw)("hideChatJoinRequest",(async(e,t,n)=>{const{chatId:s,userId:o,isApproved:i}=n,r=(0,f.Z1)(e,s),c=(0,f.dy)(e,o);if(!r||!c)return;if(!await(0,h.t9)("hideChatJoinRequest",{peer:r,user:c,isApproved:i}))return;e=(0,a.Rd)();const d=(0,f.Z1)(e,s);d&&(e=(0,p.a4)(e,s,{joinRequests:d.joinRequests?.filter((e=>e.userId!==o))}),(0,a.R3)(e))})),(0,a.iw)("hideAllChatJoinRequests",(async(e,t,n)=>{const{chatId:s,isApproved:o,link:i}=n,r=(0,f.Z1)(e,s);r&&await(0,h.t9)("hideAllChatJoinRequests",{peer:r,isApproved:o,link:i})&&(e=(0,a.Rd)(),(0,f.Z1)(e,s)&&(e=(0,p.a4)(e,s,{joinRequests:[]}),e=(0,p.US)(e,s,{recentRequesterIds:[],requestsPending:0}),(0,a.R3)(e)))})),(0,a.iw)("hideChatReportPanel",(async(e,t,n)=>{const{chatId:s}=n,o=(0,f.Z1)(e,s);o&&await(0,h.t9)("hideChatReportPanel",o)&&(e=(0,a.Rd)(),e=(0,p.a4)(e,s,{settings:void 0}),(0,a.R3)(e))})),(0,a.iw)("uploadContactProfilePhoto",(async(e,t,n)=>{const{userId:s,file:o,isSuggest:i,tabId:r=(0,P._w)()}=n,c=(0,f.dy)(e,s);if(!c)return;e=(0,p.H9)(e,m.wv.InProgress,r),(0,a.R3)(e);const d=await(0,h.t9)("uploadContactProfilePhoto",{user:c,file:o,isSuggest:i});if(!d)return e=(0,a.Rd)(),e=(0,p.H9)(e,m.wv.Error,r),void(0,a.R3)(e);e=(0,a.Rd)(),e=(0,p.Sh)(e,(0,g.ee)(d.users,"id")),(0,a.R3)(e);const{id:l,accessHash:u}=c;if(!await(0,h.t9)("fetchFullUser",{id:l,accessHash:u}))return e=(0,a.Rd)(),e=(0,p.H9)(e,m.wv.Error,r),void(0,a.R3)(e);t.loadProfilePhotos({profileId:s}),e=(0,a.Rd)(),e=(0,p.H9)(e,m.wv.Complete,r),(0,a.R3)(e),o&&!i&&t.showNotification({message:w.Iu("UserInfo.SetCustomPhoto.SuccessPhotoText",(0,v.Vl)(c)),tabId:r})})),(0,a.iw)("resetManagementError",((e,t,n)=>{const{chatId:a,tabId:s=(0,P._w)()}=n||{};return(0,p.fw)(e,a,{error:void 0},s)}));var he=n(65116),ge=n(16974);let pe,fe;(0,a.iw)("sync",((e,t)=>{o.eMD&&console.log(">>> START SYNC"),pe&&clearTimeout(pe),e=(0,a.Rd)(),e={...e,isSyncing:!0},(0,a.R3)(e),pe=window.setTimeout((()=>{e=(0,a.Rd)(),e={...e,isSyncing:!1},(0,a.R3)(e),pe=void 0}),15e3);const{loadAllChats:n,preloadTopChatMessages:s}=t;n({listType:"active",shouldReplace:!0,onReplace:async()=>{await async function(e,t){let n=!1;e=(0,a.Rd)();let s=!1;const i=Object.keys(e.messages.byChatId).reduce(((t,n)=>(t[n]=Object.keys(e.messages.byChatId[n].threadsById).reduce(((t,a)=>(t[Number(a)]={draft:(0,f.Ms)(e,n,Number(a)),editingId:(0,f._$)(e,n,Number(a)),editingDraft:(0,f.s)(e,n,Number(a)),replyingToId:(0,f.Yy)(e,n,Number(a))},t)),{}),t)),{});for(const{id:i}of Object.values(e.byTabId)){e=(0,a.Rd)();const{chatId:l,threadId:m}=(0,f.Bt)(e,i)||{},I=m||u._f,v=m&&l?(0,f.tZ)(e,l,m):void 0,w=l?e.chats.byId[l]:void 0;if(l&&w){const t=await(r=w,c=I,d=v?.lastReadInboxMessageId,(0,h.t9)("fetchMessages",{chat:r,threadId:c,offsetId:d||r.lastReadInboxMessageId,addOffset:-(Math.round(o.hT6/2)+1),limit:o.hT6}));e=(0,a.Rd)();const{chatId:u}=(0,f.Bt)(e,i)||{};if(t&&u===l){const a=(0,f.Zw)(e,l),i=l===o.awM?e.serviceNotifications.filter((e=>{let{isDeleted:t}=e;return!t})).map((e=>{let{message:t}=e;return t})):[],r=w.isForum&&w.topics?Object.values(w.topics).map((e=>{let{lastMessageId:t}=e;return a[t]})).filter(Boolean):[],c=[].concat(t.messages,i),d=c.concat(r),u=(0,g.ee)(d,"id"),m=c.map((e=>{let{id:t}=e;return t}));s||(e={...e,messages:{...e.messages,byChatId:{}}},Object.values(e.byTabId).forEach((t=>{let{id:n}=t;e=(0,Z.i)(e,{tabThreads:{}},n)})),s=!0),e=(0,p.c_)(e,l,u),e=(0,p.xj)(e,l,I,m),v?.originChannelId&&(e=(0,p.Xg)(e,l,I,v)),Object.values(e.byTabId).forEach((t=>{let{id:n}=t;const{chatId:a,threadId:s}=(0,f.Bt)(e,n)||{};a===l&&s===I&&(e=(0,p.y9)(e,l,I,m,n))})),e=(0,p.GL)(e,(0,g.ee)(t.chats,"id")),e=(0,p.eD)(e,(0,g.ee)(t.users,"id")),t.repliesThreadInfos.length&&(e=(0,p.j6)(e,t.repliesThreadInfos)),n=!0}}(0,a.R3)(e),w?.isForum&&(t.loadTopics({chatId:l,force:!0}),m&&m!==u._f&&t.loadTopicById({chatId:l,topicId:m,shouldCloseChatOnError:!0}))}var r,c,d;e=(0,a.Rd)(),n||(e={...e,messages:{...e.messages,byChatId:{}}},Object.values(e.byTabId).forEach((t=>{let{id:n}=t;e=(0,Z.i)(e,{tabThreads:{}},n)}))),Object.keys(i).forEach((t=>{const n=i[t];Object.keys(n).forEach((n=>{e=(0,p.sN)(e,t,Number(n),i[t][Number(n)])}))})),(0,a.R3)(e),Object.values(e.byTabId).forEach((n=>{let{id:a}=n;const{chatId:s,messageId:o}=(0,f.jU)(e,a).audioPlayer;s&&o&&!(0,f.hj)(e,s,o)&&t.closeAudioPlayer({tabId:a})}))}(e,t),e=(0,a.Rd)(),e={...e,isSyncing:!1,isSynced:!0},(0,a.R3)(e),o.eMD&&console.log(">>> FINISH SYNC"),(0,ge.S1)(),n({listType:"archived",shouldReplace:!0}),(0,h.t9)("fetchCurrentUser"),s()}})})),(0,he.ll)((e=>{const{connectionState:t,authState:n,isSynced:s}=e,{isMasterTab:o}=(0,f.jU)(e);!o||s||fe?.connectionState===t&&fe?.authState===n||"connectionStateReady"===t&&"authorizationStateReady"===n&&(0,a.Sv)().sync(),fe=e})),(0,a.iw)("reportPeer",(async(e,t,n)=>{const{chatId:a,reason:s,description:o,tabId:i=(0,P._w)()}=n;if(!a)return;const r=(0,f.Z1)(e,a);if(!r)return;const c=await(0,h.t9)("reportPeer",{peer:r,reason:s,description:o});t.showNotification({message:c?(0,w.Iu)("ReportPeer.AlertSuccess"):"An error occurred while submitting your report. Please, try again later.",tabId:i})})),(0,a.iw)("reportProfilePhoto",(async(e,t,n)=>{const{chatId:a,reason:s,description:o,photo:i,tabId:r=(0,P._w)()}=n;if(!a)return;const c=(0,f.Z1)(e,a);if(!c||!i)return;const d=await(0,h.t9)("reportProfilePhoto",{peer:c,photo:i,reason:s,description:o});t.showNotification({message:d?(0,w.Iu)("ReportPeer.AlertSuccess"):"An error occurred while submitting your report. Please, try again later.",tabId:r})})),(0,a.iw)("loadAuthorizations",(async e=>{const t=await(0,h.t9)("fetchAuthorizations");t&&(e=(0,a.Rd)(),e={...e,activeSessions:{byHash:t.authorizations,orderedHashes:Object.keys(t.authorizations),ttlDays:t.ttlDays}},(0,a.R3)(e))})),(0,a.iw)("terminateAuthorization",(async(e,t,n)=>{const{hash:s}=n;if(!await(0,h.t9)("terminateAuthorization",s))return;e=(0,a.Rd)();const{[s]:o,...i}=e.activeSessions.byHash;e={...e,activeSessions:{byHash:i,orderedHashes:e.activeSessions.orderedHashes.filter((e=>e!==s))}},(0,a.R3)(e)})),(0,a.iw)("terminateAllAuthorizations",(async e=>{if(!await(0,h.t9)("terminateAllAuthorizations"))return;const t=(e=(0,a.Rd)()).activeSessions.orderedHashes.find((t=>e.activeSessions.byHash[t].isCurrent));if(!t)return;const n=e.activeSessions.byHash[t];e={...e,activeSessions:{byHash:{[t]:n},orderedHashes:[t]}},(0,a.R3)(e)})),(0,a.iw)("changeSessionSettings",(async(e,t,n)=>{const{hash:s,areCallsEnabled:o,areSecretChatsEnabled:i}=n;await(0,h.t9)("changeSessionSettings",{hash:s,areCallsEnabled:o,areSecretChatsEnabled:i})&&(e=(0,a.Rd)(),e={...e,activeSessions:{...e.activeSessions,byHash:{...e.activeSessions.byHash,[s]:{...e.activeSessions.byHash[s],...void 0!==o?{areCallsEnabled:o}:void 0,...void 0!==i?{areSecretChatsEnabled:i}:void 0}}}},(0,a.R3)(e))})),(0,a.iw)("changeSessionTtl",(async(e,t,n)=>{const{days:s}=n;await(0,h.t9)("changeSessionTtl",{days:s})&&(e=(0,a.Rd)(),e={...e,activeSessions:{...e.activeSessions,ttlDays:s}},(0,a.R3)(e))})),(0,a.iw)("loadWebAuthorizations",(async e=>{const t=await(0,h.t9)("fetchWebAuthorizations");if(!t)return;const{users:n,webAuthorizations:s}=t;e=(0,a.Rd)(),e=(0,p.Sh)(e,(0,g.ee)(n,"id")),e={...e,activeWebSessions:{byHash:s,orderedHashes:Object.keys(s)}},(0,a.R3)(e)})),(0,a.iw)("terminateWebAuthorization",(async(e,t,n)=>{const{hash:s}=n;if(!await(0,h.t9)("terminateWebAuthorization",s))return;e=(0,a.Rd)();const{[s]:o,...i}=e.activeWebSessions.byHash;e={...e,activeWebSessions:{byHash:i,orderedHashes:e.activeWebSessions.orderedHashes.filter((e=>e!==s))}},(0,a.R3)(e)})),(0,a.iw)("terminateAllWebAuthorizations",(async e=>{await(0,h.t9)("terminateAllWebAuthorizations")&&(e=(0,a.Rd)(),e={...e,activeWebSessions:{byHash:{},orderedHashes:[]}},(0,a.R3)(e))}));var Ie=n(82267);const ve=(0,I.P2)((e=>e()),500,!1);function we(e,t,n){for(var a=arguments.length,s=new Array(a>3?a-3:0),o=3;o<a;o++)s[o-3]=arguments[o];let[i=(0,P._w)()]=s;const r=(0,f.jU)(e,i);return(0,Z.i)(e,{inlineBots:{...r.inlineBots,byUsername:{...r.inlineBots.byUsername,[t]:n}}},i)}function be(e,t){for(var n=arguments.length,a=new Array(n>2?n-2:0),s=2;s<n;s++)a[s-2]=arguments[s];let[o=(0,P._w)()]=a;return(0,Z.i)(e,{inlineBots:{...(0,f.jU)(e,o).inlineBots,isLoading:t}},o)}(0,a.iw)("loadFullUser",(async(e,t,n)=>{const{userId:s}=n,o=(0,f.dy)(e,s);if(!o)return;const{id:i,accessHash:r}=o,c=await(0,h.t9)("fetchFullUser",{id:i,accessHash:r});if(!c?.user)return;e=(0,a.Rd)();const d=(0,f.iF)(e,s),{user:l,fullInfo:u}=c;(o.avatarHash!==l.avatarHash||d?.profilePhoto?.id!==u?.profilePhoto?.id||d?.fallbackPhoto?.id!==u?.fallbackPhoto?.id||d?.personalPhoto?.id!==u?.personalPhoto?.id)&&o.photos?.length&&t.loadProfilePhotos({profileId:s})})),(0,a.iw)("loadUser",(async(e,t,n)=>{const{userId:s}=n,o=(0,f.dy)(e,s);if(!o)return;const i=await(0,h.t9)("fetchUsers",{users:[o]});if(!i)return;const{users:r,userStatusesById:c}=i;e=(0,a.Rd)(),e=(0,p.eD)(e,(0,g.ee)(r,"id")),e=(0,p.ps)(e,{...e.users.statusesById,...c}),(0,a.R3)(e)})),(0,a.iw)("loadTopUsers",(async e=>{const{topPeers:{lastRequestedAt:t}}=e;if(t&&!((0,Ie.bp)()-t>60))return;const n=await(0,h.t9)("fetchTopUsers");if(!n)return;const{ids:s,users:o}=n;e=(0,a.Rd)(),e=(0,p.Sh)(e,(0,g.ee)(o,"id")),e={...e,topPeers:{...e.topPeers,userIds:s,lastRequestedAt:(0,Ie.bp)()}},(0,a.R3)(e)})),(0,a.iw)("loadContactList",(async e=>{const t=await(0,h.t9)("fetchContactList");if(!t)return;e=(0,a.Rd)(),e=(0,p.Sh)(e,(0,g.ee)(t.users,"id")),e=(0,p.fZ)(e,(0,g.ee)(t.chats,"id")),e=(0,p.zn)(e,t.userStatusesById);const n=e=>e.lastName||e.firstName||"",s=new Intl.Collator("en-US"),o=t.users.sort(((e,t)=>s.compare(n(e),n(t)))).filter((e=>!e.isSelf));e={...e,contactList:{userIds:o.map((e=>e.id))}},(0,a.R3)(e)})),(0,a.iw)("loadCurrentUser",(()=>{(0,h.t9)("fetchCurrentUser")})),(0,a.iw)("loadCommonChats",(async(e,t,n)=>{const{tabId:s=(0,P._w)()}=n||{},{chatId:o}=(0,f.Bt)(e,s)||{},i=o?(0,f.dy)(e,o):void 0;if(!i||(0,v.cS)(i)||i.commonChats?.isFullyLoaded)return;const r=i.commonChats?.maxId,c=await(0,h.t9)("fetchCommonChats",i.id,i.accessHash,r);if(!c)return;const{chats:d,chatIds:l,isFullyLoaded:u}=c;e=(0,a.Rd)(),d.length&&(e=(0,p.fZ)(e,(0,g.ee)(d,"id"))),e=(0,p.Nq)(e,i.id,{commonChats:{maxId:l.length?l[l.length-1]:"0",ids:(0,g.Tw)((i.commonChats?.ids||[]).concat(l)),isFullyLoaded:u}}),(0,a.R3)(e)})),(0,a.iw)("updateContact",(async(e,t,n)=>{const{userId:s,isMuted:o=!1,firstName:i,lastName:r,shouldSharePhoneNumber:c,tabId:d=(0,P._w)()}=n,l=(0,f.dy)(e,s);if(!l)return;let u;if(t.updateChatMutedState({chatId:s,isMuted:o}),e=(0,a.Rd)(),e=(0,p.H9)(e,m.wv.InProgress,d),(0,a.R3)(e),!l.isContact&&l.phoneNumber)u=await(0,h.t9)("importContact",{phone:l.phoneNumber,firstName:i,lastName:r});else{const{id:e,accessHash:t}=l;u=await(0,h.t9)("updateContact",{id:e,accessHash:t,phoneNumber:"",firstName:i,lastName:r,shouldSharePhoneNumber:c})}u&&(t.loadChatSettings({chatId:s}),e=(0,a.Rd)(),e=(0,p.Nq)(e,l.id,{firstName:i,lastName:r}),(0,a.R3)(e)),e=(0,a.Rd)(),e=(0,p.H9)(e,m.wv.Complete,d),e=(0,p.ft)(e,d),(0,a.R3)(e)})),(0,a.iw)("deleteContact",(async(e,t,n)=>{const{userId:a}=n,s=(0,f.dy)(e,a);if(!s)return;const{id:o,accessHash:i}=s;await(0,h.t9)("deleteContact",{id:o,accessHash:i})})),(0,a.iw)("loadProfilePhotos",(async(e,t,n)=>{const{profileId:s}=n,o=(0,v.YC)(s);let i=o?(0,f.dy)(e,s):void 0;const r=o?void 0:(0,f.Z1)(e,s);if(!i&&!r)return;let c=(0,f.iF)(e,s);if(i&&!c?.profilePhoto){const{id:e,accessHash:t}=i,n=await(0,h.t9)("fetchFullUser",{id:e,accessHash:t});if(!n?.user)return;i=n.user,c=n.fullInfo}const d=await(0,h.t9)("fetchProfilePhotos",i,r);if(!d||!d.photos)return;e=(0,a.Rd)();const l=i||r,{photos:u,users:m}=d;u.sort((e=>e.id===l?.avatarHash?-1:1));const I=c?.fallbackPhoto,w=c?.personalPhoto;I&&u.push(I),w&&u.unshift(w),e=(0,p.Sh)(e,(0,g.ee)(m,"id")),e=o?(0,p.Nq)(e,s,{photos:u}):(0,p.a4)(e,s,{photos:u}),(0,a.R3)(e)})),(0,a.iw)("setUserSearchQuery",((e,t,n)=>{const{query:s,tabId:o=(0,P._w)()}=n;s&&ve((async()=>{const t=await(0,h.t9)("searchChats",{query:s});e=(0,a.Rd)();const n=(0,f.jU)(e,o).userSearch.query;if(!t||!n||s!==n)return e=(0,p.Q3)(e,!1,o),void(0,a.R3)(e);const{localUsers:i,globalUsers:r}=t;let c,d;i.length&&(e=(0,p.Sh)(e,(0,g.ee)(i,"id")),c=i.map((e=>{let{id:t}=e;return t}))),r.length&&(e=(0,p.Sh)(e,(0,g.ee)(r,"id")),d=r.map((e=>{let{id:t}=e;return t}))),e=(0,p.Q3)(e,!1,o),e=(0,p.Lm)(e,{localUserIds:c,globalUserIds:d},o),(0,a.R3)(e)}))})),(0,a.iw)("importContact",(async(e,t,n)=>{const{phoneNumber:s,firstName:o,lastName:i,tabId:r=(0,P._w)()}=n,c=await(0,h.t9)("importContact",{phone:s,firstName:o,lastName:i});c?(t.openChat({id:c,tabId:r}),e=(0,a.Rd)(),e=(0,p.ft)(e,r),(0,a.R3)(e)):t.showNotification({message:w.Iu("Contacts.PhoneNumber.NotRegistred"),tabId:r})})),(0,a.iw)("reportSpam",((e,t,n)=>{const{chatId:a}=n,s=(0,v.YC)(a)?(0,f.dy)(e,a):(0,f.Z1)(e,a);s&&(0,h.t9)("reportSpam",s)})),(0,a.iw)("setEmojiStatus",((e,t,n)=>{const{emojiStatus:a,expires:s}=n;(0,h.t9)("updateEmojiStatus",a,s)}));var Ze=n(18629);const Pe=s.cj||s.wZ;class ye{constructor(e,t){var n,a,s;this.features=e,this.onFail=t,n=this,s=void 0,(a=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,t);if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(a="preOpened"))in n?Object.defineProperty(n,a,{value:s,enumerable:!0,configurable:!0,writable:!0}):n[a]=s}preOpenIfNeeded(){Pe&&(this.preOpened=window.open("about:blank",void 0,this.features),this.preOpened?this.preOpened.blur():this.onFail?.())}open(e){if(this.preOpened)return this.preOpened.location.href=e,this.preOpened.focus(),void(this.preOpened=void 0);if(!Pe){const t=window.open(e,void 0,this.features);t?t.focus():this.onFail?.()}}cancelPreOpen(){this.preOpened?.close(),this.preOpened=void 0}}const Ce="https://prizes.gamee.com/",Ee=(0,I.Ds)((e=>e()),500,!1);async function Se(e,t,n,s){await(0,h.t9)("toggleAttachBot",{bot:t,isWriteAllowed:s,isEnabled:n}),e=(0,a.Rd)(),await Me(e)}async function Me(e,t){const n=await(0,h.t9)("loadAttachBots",{hash:t});n&&(e=(0,a.Rd)(),e=(0,p.Sh)(e,(0,g.ee)(n.users,"id")),e={...e,attachMenu:{hash:n.hash,bots:n.bots}},(0,a.R3)(e))}function Re(e,t,n,s){for(var o=arguments.length,i=new Array(o>4?o-4:0),r=4;r<o;r++)i[r-4]=arguments[r];let[c=(0,P._w)()]=i;if("request"===s.type){e=(0,a.Rd)();const t=(0,f.jU)(e,c);if(!t.urlAuth)return;const{domain:n,bot:o,shouldRequestWriteAccess:i}=s;return e=(0,Z.i)(e,{urlAuth:{...t.urlAuth,request:{domain:n,botId:o.id,shouldRequestWriteAccess:i}}},c),void(0,a.R3)(e)}const d="accepted"===s.type?s.url:n;window.open(d,"_blank","noopener"),t.closeUrlAuthModal({tabId:c})}async function ke(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:u._f,n=arguments.length>2?arguments[2]:void 0,a=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0;await(0,h.t9)("sendMessage",{chat:e,replyingToTopId:t,text:n,replyingTo:a,sendAs:s})}let Te;async function Ae(e,t,n,a,s){let o=arguments.length>5&&void 0!==arguments[5]&&arguments[5];for(var i=arguments.length,r=new Array(i>6?i-6:0),c=6;c<i;c++)r[c-6]=arguments[c];let[d=(0,P._w)()]=r;const{showDialog:l,showNotification:u,openUrl:m,openGame:g}=t;o&&(Te||(Te=new ye("popup,width=800,height=600",(()=>{u({message:"Allow browser to open popup window",tabId:d})}))),Te.preOpenIfNeeded());const p=await(0,h.t9)("answerCallbackButton",{chatId:n.id,accessHash:n.accessHash,messageId:a,data:s,isGame:o});if(!p)return;const{message:f,alert:I,url:v}=p;I?l({data:{message:f||"Error"},tabId:d}):f?u({message:f,tabId:d}):v&&(o?v.includes(Ce)?Te.open(v):(Te.cancelPreOpen(),g({url:v,chatId:n.id,messageId:a,tabId:d})):m({url:v,tabId:d}))}function Ne(e){const t=Object.keys(e).map((t=>`${t}=${e[t]}`)).join("&");return t.length>0?`?${t}`:""}async function xe(e,t){for(var n=arguments.length,s=new Array(n>2?n-2:0),o=2;o<n;o++)s[o-2]=arguments[o];let[i=(0,P._w)()]=s;const r=await(0,h.t9)("getPaymentForm",t);if(!r)return;const{form:c,invoice:d,users:l}=r;return e=(0,a.Rd)(),e=(0,p._7)(e,c,i),e=(0,p.Q$)(e,m.KB.Checkout,i),e=(0,p.Sh)(e,(0,g.ee)(l,"id")),(0,a.R3)(e),d}async function Be(e,t,n,s){for(var o=arguments.length,i=new Array(o>4?o-4:0),r=4;r<o;r++)i[r-4]=arguments[r];let[c=(0,P._w)()]=i;const d=await(0,h.t9)("validateRequestedInfo",{inputInvoice:t,requestInfo:n,shouldSave:s});if(!d)return;const{id:l,shippingOptions:u}=d;e=(0,a.Rd)(),e=(0,p.vT)(e,l,c),u?(e=(0,p.TM)(e,u,c),e=(0,p.Q$)(e,m.KB.Shipping,c)):e=(0,p.Q$)(e,m.KB.Checkout,c),(0,a.R3)(e)}(0,a.iw)("clickBotInlineButton",((e,t,n)=>{const{messageId:a,button:s,tabId:o=(0,P._w)()}=n;switch(s.type){case"command":t.sendBotCommand({command:s.text,tabId:o});break;case"url":{const{url:e}=s;t.openUrl({url:e,tabId:o});break}case"callback":{const n=(0,f.jr)(e,o);if(!n)return;Ae(e,t,n,a,s.data,void 0,o);break}case"requestPoll":t.openPollModal({isQuiz:s.isQuiz,tabId:o});break;case"requestPhone":{const n=e.currentUserId?(0,f.dy)(e,e.currentUserId):void 0;if(!n)return;t.showDialog({data:{phoneNumber:n.phoneNumber,firstName:n.firstName||"",lastName:n.lastName||"",userId:n.id},tabId:o});break}case"receipt":{const n=(0,f.jr)(e,o);if(!n)return;const{receiptMessageId:i}=s;t.getReceipt({receiptMessageId:i,chatId:n.id,messageId:a,tabId:o});break}case"buy":{const n=(0,f.jr)(e,o);if(!n)return;t.openInvoice({chatId:n.id,messageId:a,tabId:o});break}case"game":{const n=(0,f.jr)(e,o);if(!n)return;Ae(e,t,n,a,void 0,!0,o);break}case"switchBotInline":{const{query:e,isSamePeer:n}=s;t.switchBotInline({query:e,isSamePeer:n,messageId:a,tabId:o});break}case"userProfile":{const{userId:e}=s;t.openChatWithInfo({id:e,tabId:o});break}case"simpleWebView":{const{url:n}=s,{chatId:i}=(0,f.Bt)(e,o)||{};if(!i)return;const r=(0,f.hj)(e,i,a);if(!r?.senderId)return;const c=(0,Ze.BS)();t.requestSimpleWebView({url:n,botId:r?.senderId,theme:c,buttonText:s.text,tabId:o});break}case"webView":{const{url:n}=s,i=(0,f.jr)(e,o);if(!i)return;const r=(0,f.hj)(e,i.id,a);if(!r)return;const c=r.viaBotId||r.senderId;if(!c)return;const d=(0,Ze.BS)();t.requestWebView({url:n,botId:c,peerId:i.id,theme:d,buttonText:s.text,tabId:o});break}case"urlAuth":{const{url:n}=s,i=(0,f.jr)(e,o);if(!i)return;t.requestBotUrlAuth({chatId:i.id,messageId:a,buttonId:s.buttonId,url:n,tabId:o});break}}})),(0,a.iw)("sendBotCommand",((e,t,n)=>{const{command:a,chatId:s,tabId:o=(0,P._w)()}=n,i=s?(0,f.Z1)(e,s):(0,f.jr)(e,o),r=(0,f.Bt)(e,o);if(!i||!r)return;const{threadId:c}=r;t.setReplyingToId({messageId:void 0,tabId:o}),t.clearWebPagePreview({tabId:o}),ke(i,c,a,(0,f.Yy)(e,i.id,c),(0,f._5)(e,i.id))})),(0,a.iw)("restartBot",(async(e,t,n)=>{const{chatId:s,tabId:o=(0,P._w)()}=n,{currentUserId:i}=e,r=(0,f.jr)(e,o),c=i&&(0,f.kB)(e,s);i&&r&&c&&await(0,h.t9)("unblockContact",c.id,c.accessHash)&&(e=(0,a.Rd)(),e=(0,p.rB)(e,c.id),(0,a.R3)(e),ke(r,u._f,"/start",void 0,(0,f._5)(e,s)))})),(0,a.iw)("loadTopInlineBots",(async e=>{const{lastRequestedAt:t}=e.topInlineBots;if(t&&(0,Ie.bp)()-t<60)return;const n=await(0,h.t9)("fetchTopInlineBots");if(!n)return;const{ids:s,users:o}=n;e=(0,a.Rd)(),e=(0,p.Sh)(e,(0,g.ee)(o,"id")),e={...e,topInlineBots:{...e.topInlineBots,userIds:s,lastRequestedAt:(0,Ie.bp)()}},(0,a.R3)(e)})),(0,a.iw)("queryInlineBot",(async(e,t,n)=>{const{chatId:s,username:o,query:i,offset:r,tabId:c=(0,P._w)()}=n;let d=(0,f.jU)(e,c).inlineBots.byUsername[o];if(!1!==d){if(void 0===d){const{user:t,chat:n}=await(0,h.t9)("fetchInlineBot",{username:o})||{};if(e=(0,a.Rd)(),!t||!n)return e=we(e,o,!1,c),void(0,a.R3)(e);e=(0,p.Sh)(e,{[t.id]:t}),e=(0,p.fZ)(e,{[n.id]:n}),d={id:t.id,query:"",offset:"",switchPm:void 0,canLoadMore:!0,results:[],cacheTime:0},e=we(e,o,d,c),(0,a.R3)(e)}(i!==d.query||d.canLoadMore)&&Ee((()=>{!async function(e,t){let{username:n,inlineBotData:s,chatId:o,query:i,offset:r}=t;for(var c=arguments.length,d=new Array(c>2?c-2:0),l=2;l<c;l++)d[l-2]=arguments[l];let[u=(0,P._w)()]=d;e=(0,a.Rd)();const m=(0,f.dy)(e,s.id),g=(0,f.Z1)(e,o);if(!m||!g)return;const p=s.query!==i;e=we(e=be(e,!0,u),n,{...s,query:i,...p&&{offset:void 0,results:[]}},u),(0,a.R3)(e);const I=await(0,h.t9)("fetchInlineBotResults",{bot:m,chat:g,query:i,offset:p?void 0:r});e=(0,a.Rd)();const v=(0,f.jU)(e,u).inlineBots.byUsername[n];if(e=be(e,!1,u),!I||!v||i!==v.query)return void(0,a.R3)(e);const w=new Set((v.results||[]).map((e=>e.id))),b=I.results.filter((e=>!w.has(e.id)));e=we(e,n,{...v,help:I.help,cacheTime:Date.now()+1e3*I.cacheTime,...b.length&&{isGallery:I.isGallery},...I.switchPm&&{switchPm:I.switchPm},...I.switchWebview&&{switchWebview:I.switchWebview},canLoadMore:I.results.length>0&&Boolean(I.nextOffset),results:""===v.offset||v.offset===I.nextOffset?I.results:(v.results||[]).concat(b),offset:b.length?I.nextOffset:""},u),(0,a.R3)(e)}(e,{username:o,inlineBotData:d,chatId:s,query:i,offset:r},c)}))}})),(0,a.iw)("switchBotInline",((e,t,n)=>{const{query:a,isSamePeer:s,messageId:o,filter:i,tabId:r=(0,P._w)()}=n;let{botId:c}=n;const d=(0,f.jr)(e,r);if(!d)return;if(!c&&o){const t=(0,f.hj)(e,d.id,o);if(!t)return;c=t.viaBotId||t.senderId}if(!c)return;const l=(0,f.dy)(e,c);l&&t.openChatWithDraft({text:`@${l.usernames[0].username} ${a}`,chatId:s?d.id:void 0,filter:i,tabId:r})})),(0,a.iw)("sendInlineBotResult",((e,t,n)=>{const{id:a,queryId:s,isSilent:o,scheduledAt:i,messageList:r,tabId:c=(0,P._w)()}=n;if(!a)return;const{chatId:d,threadId:l}=r,m=(0,f.Z1)(e,d),g=(0,f.Yy)(e,d,l),p=g?(0,f.hj)(e,d,g):void 0,I=m.isForum||l!==u._f?(0,f.qS)(e,d,l):p?.replyToTopMessageId||p?.replyToMessageId;t.setReplyingToId({messageId:void 0,tabId:c}),t.clearWebPagePreview({tabId:c}),(0,h.t9)("sendInlineBotResult",{chat:m,resultId:a,queryId:s,replyingTo:g||I,replyingToTopId:I,sendAs:(0,f._5)(e,d),isSilent:o,scheduleDate:i})})),(0,a.iw)("resetInlineBot",((e,t,n)=>{const{username:s,force:o,tabId:i=(0,P._w)()}=n;let r=(0,f.jU)(e,i).inlineBots.byUsername[s];r&&(!o&&Date.now()<r.cacheTime||(r={id:r.id,query:"",offset:"",switchPm:void 0,canLoadMore:!0,results:[],cacheTime:0},e=we(e,s,r,i),(0,a.R3)(e)))})),(0,a.iw)("resetAllInlineBots",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{},s=(0,f.jU)(e,a).inlineBots.byUsername;Object.keys(s).forEach((e=>{t.resetInlineBot({username:e,tabId:a})}))})),(0,a.iw)("startBot",(async(e,t,n)=>{const{botId:a,param:s}=n,o=(0,f.dy)(e,a);if(!o)return;let i=(0,f.iF)(e,a);i||(i=(await(0,h.t9)("fetchFullUser",{id:o.id,accessHash:o.accessHash}))?.fullInfo),i?.isBlocked&&await(0,h.t9)("unblockContact",o.id,o.accessHash),await(0,h.t9)("startBot",{bot:o,startParam:s})})),(0,a.iw)("requestSimpleWebView",(async(e,t,n)=>{const{url:s,botId:o,theme:i,buttonText:r,tabId:c=(0,P._w)()}=n,d=(0,f.dy)(e,o);if(!d)return;if(!(0,f.LM)(e,o))return e=(0,Z.i)(e,{botTrustRequest:{botId:o,type:"webApp",onConfirm:{action:"requestSimpleWebView",payload:n}}},c),void(0,a.R3)(e);const l=await(0,h.t9)("requestSimpleWebView",{url:s,bot:d,theme:i});l&&(e=(0,a.Rd)(),e=(0,Z.i)(e,{webApp:{url:l,botId:o,buttonText:r}},c),(0,a.R3)(e))})),(0,a.iw)("requestWebView",(async(e,t,n)=>{const{url:s,botId:o,peerId:i,theme:r,isSilent:c,buttonText:d,isFromBotMenu:l,startParam:u,tabId:m=(0,P._w)()}=n,g=(0,f.dy)(e,o);if(!g)return;const p=(0,f.Z1)(e,i);if(!p)return;if(!(0,f.LM)(e,o))return e=(0,Z.i)(e,{botTrustRequest:{botId:o,type:"webApp",onConfirm:{action:"requestWebView",payload:n}}},m),void(0,a.R3)(e);const I=(0,f.Bt)(e,m);if(!I)return;const{chatId:v,threadId:w}=I,b=v&&(0,f.Yy)(e,v,w),y=(0,f._5)(e,v),C=await(0,h.t9)("requestWebView",{url:s,bot:g,peer:p,theme:r,isSilent:c,replyToMessageId:b||void 0,threadId:w,isFromBotMenu:l,startParam:u,sendAs:y});if(!C)return;const{url:E,queryId:S}=C;e=(0,a.Rd)(),e=(0,Z.i)(e,{webApp:{url:E,botId:o,queryId:S,replyToMessageId:b||void 0,threadId:w,buttonText:d}},m),(0,a.R3)(e)})),(0,a.iw)("requestAppWebView",(async(e,t,n)=>{const{botId:s,appName:o,startApp:i,theme:r,isWriteAllowed:c,tabId:d=(0,P._w)()}=n,l=(0,f.dy)(e,s);if(!l)return;const u=await(0,h.t9)("fetchBotApp",{bot:l,appName:o});if(e=(0,a.Rd)(),!u)return void t.showNotification({message:(0,w.Iu)("lng_username_app_not_found"),tabId:d});if(u.isInactive&&!(0,f.LM)(e,s))return e=(0,Z.i)(e,{botTrustRequest:{botId:s,shouldRequestWriteAccess:u.shouldRequestWriteAccess,type:"botApp",onConfirm:{action:"requestAppWebView",payload:n}}},d),void(0,a.R3)(e);const m=(0,f.jr)(e,d),g=await(0,h.t9)("requestAppWebView",{peer:m||l,app:u,startParam:i,isWriteAllowed:c,theme:r});e=(0,a.Rd)(),g&&(e=(0,Z.i)(e,{webApp:{url:g,botId:s,buttonText:""}},d),(0,a.R3)(e))})),(0,a.iw)("prolongWebView",(async(e,t,n)=>{const{botId:a,peerId:s,isSilent:o,replyToMessageId:i,queryId:r,threadId:c,tabId:d=(0,P._w)()}=n,l=(0,f.dy)(e,a);if(!l)return;const u=(0,f.Z1)(e,s);if(!u)return;const m=(0,f._5)(e,s);await(0,h.t9)("prolongWebView",{bot:l,peer:u,isSilent:o,replyToMessageId:i,threadId:c,queryId:r,sendAs:m})||t.closeWebApp({tabId:d})})),(0,a.iw)("sendWebViewData",((e,t,n)=>{const{bot:a,data:s,buttonText:o}=n;(0,h.t9)("sendWebViewData",{bot:a,data:s,buttonText:o})})),(0,a.iw)("closeWebApp",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{};return(0,Z.i)(e,{webApp:void 0},a)})),(0,a.iw)("setWebAppPaymentSlug",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n,s=(0,f.jU)(e,a);if(s.webApp?.url)return(0,Z.i)(e,{webApp:{...s.webApp,slug:n.slug}},a)})),(0,a.iw)("cancelBotTrustRequest",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{};return(0,Z.i)(e,{botTrustRequest:void 0},a)})),(0,a.iw)("markBotTrusted",((e,t,n)=>{const{botId:s,isWriteAllowed:o,tabId:i=(0,P._w)()}=n,{trustedBotIds:r}=e,c=new Set(r);c.add(s),e={...e,trustedBotIds:Array.from(c)};const d=(0,f.jU)(e,i);if(d.botTrustRequest?.onConfirm){const{action:e,payload:n}=d.botTrustRequest.onConfirm;t[e]({...n,isWriteAllowed:o})}e=(0,Z.i)(e,{botTrustRequest:void 0},i),(0,a.R3)(e)})),(0,a.iw)("loadAttachBots",(async(e,t,n)=>{const{hash:a}=n||{};await Me(e,a)})),(0,a.iw)("toggleAttachBot",(async(e,t,n)=>{const{botId:a,isWriteAllowed:s,isEnabled:o}=n,i=(0,f.dy)(e,a);i&&await Se(e,i,o,s)})),(0,a.iw)("callAttachBot",((e,t,n)=>{const{chatId:a,bot:s,url:o,startParam:i,threadId:r,tabId:c=(0,P._w)()}=n,d=!s;if(!d&&!e.attachMenu.bots[s.id])return(0,Z.i)(e,{requestedAttachBotInstall:{bot:s,onConfirm:{action:"callAttachBot",payload:n}}},c);const l=(0,Ze.BS)();t.openChat({id:a,threadId:r,tabId:c}),t.requestWebView({url:o,peerId:a,botId:d?a:s.id,theme:l,buttonText:"",isFromBotMenu:d,startParam:i,tabId:c})})),(0,a.iw)("confirmAttachBotInstall",(async(e,t,n)=>{const{isWriteAllowed:s,tabId:o=(0,P._w)()}=n,{requestedAttachBotInstall:i}=(0,f.jU)(e,o),{bot:r,onConfirm:c}=i;e=(0,Z.i)(e,{requestedAttachBotInstall:void 0},o),(0,a.R3)(e);const d=(0,f.dy)(e,r.id);if(d&&(await Se(e,d,!0,s),c)){const{action:e,payload:n}=c;t[e](n)}})),(0,a.iw)("cancelAttachBotInstall",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{};return(0,Z.i)(e,{requestedAttachBotInstall:void 0},a)})),(0,a.iw)("requestAttachBotInChat",((e,t,n)=>{const{bot:s,filter:o,startParam:i,tabId:r=(0,P._w)()}=n,c=(0,f.Bt)(e,r)?.chatId,d=s.peerTypes.filter((e=>"self"!==e&&o.includes(e)));d.length?(e=(0,Z.i)(e,{requestedAttachBotInChat:{bot:s,filter:d,startParam:i}},r),(0,a.R3)(e)):t.callAttachBot({chatId:c||s.id,bot:s,startParam:i,tabId:r})})),(0,a.iw)("cancelAttachBotInChat",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{};return(0,Z.i)(e,{requestedAttachBotInChat:void 0},a)})),(0,a.iw)("requestBotUrlAuth",(async(e,t,n)=>{const{chatId:s,buttonId:o,messageId:i,url:r,tabId:c=(0,P._w)()}=n,d=(0,f.Z1)(e,s);if(!d)return;const l=await(0,h.t9)("requestBotUrlAuth",{chat:d,buttonId:o,messageId:i});l&&(e=(0,a.Rd)(),e=(0,Z.i)(e,{urlAuth:{url:r,button:{buttonId:o,messageId:i,chatId:d.id}}},c),(0,a.R3)(e),Re(e,t,r,l,c))})),(0,a.iw)("acceptBotUrlAuth",(async(e,t,n)=>{const{isWriteAllowed:s,tabId:o=(0,P._w)()}=n,i=(0,f.jU)(e,o);if(!i.urlAuth?.button)return;const{button:r,url:c}=i.urlAuth,{chatId:d,messageId:l,buttonId:u}=r,m=(0,f.Z1)(e,d);if(!m)return;const g=await(0,h.t9)("acceptBotUrlAuth",{chat:m,messageId:l,buttonId:u,isWriteAllowed:s});g&&Re(e=(0,a.Rd)(),t,c,g,o)})),(0,a.iw)("requestLinkUrlAuth",(async(e,t,n)=>{const{url:s,tabId:o=(0,P._w)()}=n,i=await(0,h.t9)("requestLinkUrlAuth",{url:s});i&&(e=(0,a.Rd)(),e=(0,Z.i)(e,{urlAuth:{url:s}},o),(0,a.R3)(e),Re(e,t,s,i,o))})),(0,a.iw)("acceptLinkUrlAuth",(async(e,t,n)=>{const{isWriteAllowed:s,tabId:o=(0,P._w)()}=n,i=(0,f.jU)(e,o);if(!i.urlAuth?.url)return;const{url:r}=i.urlAuth,c=await(0,h.t9)("acceptLinkUrlAuth",{url:r,isWriteAllowed:s});c&&Re(e=(0,a.Rd)(),t,r,c,o)})),(0,a.iw)("closeUrlAuthModal",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{};return(0,Z.i)(e,{urlAuth:void 0},a)})),n(55282),(0,a.iw)("loadPasswordInfo",(async e=>{const t=await(0,h.t9)("getPasswordInfo");t&&(e=(0,a.Rd)(),e=(0,p.BI)(e,{hasPassword:t.hasPassword}),e=(0,p.IE)(e,{hint:t.hint}),(0,a.R3)(e))})),(0,a.iw)("checkPassword",(async(e,t,n)=>{const{currentPassword:s,onSuccess:o}=n;e=(0,p.IE)(e,{isLoading:!0,error:void 0}),(0,a.R3)(e);const i=await(0,h.t9)("checkPassword",s);e=(0,a.Rd)(),e=(0,p.IE)(e,{isLoading:!1}),(0,a.R3)(e),i&&o()})),(0,a.iw)("clearPassword",(async(e,t,n)=>{const{currentPassword:s,onSuccess:o}=n;e=(0,p.IE)(e,{isLoading:!0,error:void 0}),(0,a.R3)(e);const i=await(0,h.t9)("clearPassword",s);e=(0,a.Rd)(),e=(0,p.IE)(e,{isLoading:!1}),(0,a.R3)(e),i&&o()})),(0,a.iw)("updatePassword",(async(e,t,n)=>{const{currentPassword:s,password:o,hint:i,email:r,onSuccess:c}=n;e=(0,p.IE)(e,{isLoading:!0,error:void 0}),(0,a.R3)(e);const d=await(0,h.t9)("updatePassword",s,o,i,r);e=(0,a.Rd)(),e=(0,p.IE)(e,{isLoading:!1}),(0,a.R3)(e),d&&c()})),(0,a.iw)("updateRecoveryEmail",(async(e,t,n)=>{const{currentPassword:s,email:o,onSuccess:i}=n;e=(0,p.IE)(e,{isLoading:!0,error:void 0}),(0,a.R3)(e);const r=await(0,h.t9)("updateRecoveryEmail",s,o);e=(0,a.Rd)(),e=(0,p.IE)(e,{isLoading:!1,waitingEmailCodeLength:void 0}),(0,a.R3)(e),r&&i()})),(0,a.iw)("provideTwoFaEmailCode",((e,t,n)=>{const{code:a}=n;(0,h.t9)("provideRecoveryEmailCode",a)})),(0,a.iw)("clearTwoFaError",(e=>(0,p.IE)(e,{error:void 0}))),(0,a.iw)("validateRequestedInfo",((e,t,n)=>{const{requestInfo:a,saveInfo:s,tabId:o=(0,P._w)()}=n,i=(0,f.kb)(e,o);if(i)if("slug"in i)Be(e,i,a,s,o);else{const t=(0,f.Z1)(e,i.chatId);if(!t)return;Be(e,{chat:t,messageId:i.messageId},a,s,o)}})),(0,a.iw)("openInvoice",(async(e,t,n)=>{const{tabId:s=(0,P._w)()}=n;let o;if("slug"in n)o=await xe(e,{slug:n.slug},s);else{const t=(0,f.Z1)(e,n.chatId);if(!t)return;o=await xe(e,{chat:t,messageId:n.messageId},s)}o&&(e=(0,a.Rd)(),e=(0,p.bs)(e,o,s),e=(0,Z.i)(e,{payment:{...(0,f.jU)(e,s).payment,inputInvoice:n,isPaymentModalOpen:!0,status:"cancelled",isExtendedMedia:n.isExtendedMedia}},s),(0,a.R3)(e))})),(0,a.iw)("getReceipt",(async(e,t,n)=>{const{receiptMessageId:s,chatId:o,messageId:i,tabId:r=(0,P._w)()}=n,c=o&&(0,f.Z1)(e,o);if(!i||!s||!c)return;const d=await(0,h.t9)("getReceipt",c,s);if(!d)return;e=(0,a.Rd)();const l=(0,f.hj)(e,c.id,i);e=(0,p.Sh)(e,(0,g.ee)(d.users,"id")),e=(0,p.Dq)(e,d.receipt,l,r),(0,a.R3)(e)})),(0,a.iw)("clearPaymentError",((e,t,n)=>{const{tabId:s=(0,P._w)()}=n||{};e=(0,Z.i)(e,{payment:{...(0,f.jU)(e,s).payment,error:void 0}},s),(0,a.R3)(e)})),(0,a.iw)("clearReceipt",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{};return(0,Z.i)(e,{payment:{...(0,f.jU)(e,a).payment,receipt:void 0}},a)})),(0,a.iw)("sendCredentialsInfo",((e,t,n)=>{const{credentials:s,tabId:i=(0,P._w)()}=n,{nativeProvider:r}=(0,f.jU)(e,i).payment,{data:c}=s;if("stripe"===r){const t=(0,f.$$)(e,i);if(!t)return;!async function(e,t,n){for(var s=arguments.length,o=new Array(s>3?s-3:0),i=3;i<s;i++)o[i-3]=arguments[i];let[r=(0,P._w)()]=o;const c=Ne({"card[number]":t.cardNumber,"card[exp_month]":t.expiryMonth,"card[exp_year]":t.expiryYear,"card[cvc]":t.cvv,"card[address_zip]":t.zip,"card[address_country]":t.country}),d=await fetch(`https://api.stripe.com/v1/tokens${c}`,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/x-www-form-urlencoded",Authorization:`Bearer ${n}`}}),l=await d.json();if(l.error){const t=(0,v.Ow)(l.error);return e=(0,a.Rd)(),e=(0,Z.i)(e,{payment:{...(0,f.jU)(e,r).payment,status:"failed",error:{...t}}},r),void(0,a.R3)(e)}e=(0,a.Rd)(),e=(0,p.QH)(e,{type:l.type,id:l.id},r),e=(0,p.Q$)(e,m.KB.Checkout,r),(0,a.R3)(e)}(e,c,t,i)}else if("smartglocal"===r){const t=(0,f.EB)(e,i);if(!t)return;!async function(e,t,n){for(var s=arguments.length,i=new Array(s>3?s-3:0),r=3;r<s;r++)i[r-3]=arguments[r];let[c=(0,P._w)()]=i;const d={card:{number:t.cardNumber.replace(/\D+/g,""),expiration_month:t.expiryMonth,expiration_year:t.expiryYear,security_code:t.cvv.replace(/\D+/g,"")}},l=o.eAU?"https://tgb-playground.smart-glocal.com/cds/v1/tokenize/card":"https://tgb.smart-glocal.com/cds/v1/tokenize/card",u=await fetch(l,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json","X-PUBLIC-TOKEN":n},body:JSON.stringify(d)}),h=await u.json();if("ok"!==h.status){const t={description:"payment error"};return e=(0,a.Rd)(),e=(0,Z.i)(e,{payment:{...(0,f.jU)(e,c).payment,status:"failed",error:{...t}}},c),void(0,a.R3)(e)}e=(0,a.Rd)(),e=(0,p.QD)(e,{type:"card",token:h.data.token},c),e=(0,p.Q$)(e,m.KB.Checkout,c),(0,a.R3)(e)}(e,c,t,i)}})),(0,a.iw)("sendPaymentForm",(async(e,t,n)=>{const{shippingOptionId:s,saveCredentials:o,savedCredentialId:i,tipAmount:r,tabId:c=(0,P._w)()}=n,d=(0,f.kb)(e,c),l=(0,f.eh)(e,c),u=(0,f.sp)(e,c),{nativeProvider:m,temporaryPassword:g}=(0,f.jU)(e,c).payment,I="stripe"===m?(0,f.$$)(e,c):(0,f.EB)(e,c);if(!(d&&I&&l&&m))return;let v;if("slug"in d)v={slug:d.slug};else{const t=(0,f.Z1)(e,d.chatId);if(!t)return;v={chat:t,messageId:d.messageId}}e=(0,p.cQ)(e,{status:"pending"},c),(0,a.R3)(e);const w={save:o,data:"stripe"===m?(0,f.i3)(e,c):(0,f.Jg)(e,c)};await(0,h.t9)("sendPaymentForm",{inputInvoice:v,formId:l,credentials:w,requestedInfoId:u,shippingOptionId:s,savedCredentialId:i,temporaryPassword:g?.value,tipAmount:r})&&(e=(0,a.Rd)(),e=(0,p.cQ)(e,{status:"paid"},c),e=(0,p.WY)(e,c),(0,a.R3)(e))})),(0,a.iw)("setPaymentStep",((e,t,n)=>{const{step:a,tabId:s=(0,P._w)()}=n;return(0,p.Q$)(e,null!=a?a:m.KB.Checkout,s)})),(0,a.iw)("closePremiumModal",((e,t,n)=>{const{isClosed:a,tabId:s=(0,P._w)()}=n||{},o=(0,f.jU)(e,s);if(o.premiumModal)return(0,Z.i)(e,{premiumModal:{...o.premiumModal,...a&&{isOpen:!1},isClosing:!a}},s)})),(0,a.iw)("openPremiumModal",(async(e,t,n)=>{const{initialSection:s,fromUserId:o,isSuccess:i,isGift:r,monthsAmount:c,toUserId:d,tabId:l=(0,P._w)()}=n||{};t.loadPremiumStickers();const u=await(0,h.t9)("fetchPremiumPromo");u&&(e=(0,a.Rd)(),e=(0,p.Sh)(e,(0,g.ee)(u.users,"id")),e=(0,Z.i)(e,{premiumModal:{promo:u.promo,initialSection:s,isOpen:!0,fromUserId:o,toUserId:d,isGift:r,monthsAmount:c,isSuccess:i}},l),(0,a.R3)(e))})),(0,a.iw)("openGiftPremiumModal",(async(e,t,n)=>{const{forUserId:s,tabId:o=(0,P._w)()}=n||{},i=await(0,h.t9)("fetchPremiumPromo");if(!i)return;e=(0,a.Rd)(),e=(0,p.Sh)(e,(0,g.ee)(i.users,"id"));const r=i.promo.options.find((e=>1===e.months));e=(0,Z.i)(e,{giftPremiumModal:{isOpen:!0,forUserId:s,monthlyCurrency:r.currency,monthlyAmount:r.amount}},o),(0,a.R3)(e)})),(0,a.iw)("closeGiftPremiumModal",((e,t,n)=>{const{tabId:s=(0,P._w)()}=n||{};e=(0,Z.i)(e,{giftPremiumModal:{isOpen:!1}},s),(0,a.R3)(e)})),(0,a.iw)("validatePaymentPassword",(async(e,t,n)=>{const{password:s,tabId:o=(0,P._w)()}=n,i=await(0,h.t9)("fetchTemporaryPaymentPassword",s);e=(0,a.Rd)(),e=i?"error"in i?(0,p.cQ)(e,{error:{message:i.error,field:"password"}},o):(0,p.cQ)(e,{temporaryPassword:i,step:m.KB.Checkout},o):(0,p.cQ)(e,{error:{message:"Unknown Error",field:"password"}},o),(0,a.R3)(e)}));var Le=n(40647);let Ue=0;(0,a.iw)("loadAvailableReactions",(async e=>{const t=await(0,h.t9)("getAvailableReactions");t&&(t.forEach((e=>{e.aroundAnimation&&Le.he(`sticker${e.aroundAnimation.id}`,u.IU.BlobUrl),e.centerIcon&&Le.he(`sticker${e.centerIcon.id}`,u.IU.BlobUrl),e.appearAnimation&&Le.he(`sticker${e.appearAnimation.id}`,u.IU.BlobUrl),e.selectAnimation&&Le.he((0,v.ym)(e.selectAnimation),u.IU.BlobUrl)})),e=(0,a.Rd)(),e={...e,availableReactions:t},(0,a.R3)(e))})),(0,a.iw)("interactWithAnimatedEmoji",((e,t,n)=>{const{emoji:a,x:s,y:o,startSize:i,isReversed:r,tabId:c=(0,P._w)()}=n,d={id:Ue++,animatedEffect:a,x:L(e,s)+40*Math.random()-20,y:o+40*Math.random()-20,startSize:i,isReversed:r};return(0,Z.i)(e,{activeEmojiInteractions:[...(0,f.jU)(e,c).activeEmojiInteractions||[],d]},c)})),(0,a.iw)("sendEmojiInteraction",((e,t,n)=>{const{messageId:a,chatId:s,emoji:o,interactions:i}=n;if("connectionStateReady"!==e.connectionState)return;const r=(0,f.Z1)(e,s);r&&o&&s!==e.currentUserId&&(0,h.t9)("sendEmojiInteraction",{chat:r,messageId:a,emoticon:o,timestamps:i})})),(0,a.iw)("sendDefaultReaction",((e,t,n)=>{const{chatId:a,messageId:s,tabId:o=(0,P._w)()}=n,i=(0,f.q6)(e,a),r=(0,f.hj)(e,a,s);i&&r&&!(0,v.CI)(r)&&t.toggleReaction({chatId:a,messageId:s,reaction:i,tabId:o})})),(0,a.iw)("toggleReaction",(async(e,t,n)=>{const{chatId:s,reaction:o,shouldAddToRecent:i,tabId:r=(0,P._w)()}=n;let{messageId:c}=n;const d=(0,f.Z1)(e,s);let l=(0,f.hj)(e,s,c);if(!d||!l)return;const u=Boolean(l.groupedId)&&!l.isInAlbum,m=u?(0,f.xH)(e,s,l.groupedId)[0]:void 0;l=u&&(0,f.hj)(e,s,m)||l,c=l?.id||c;const p=(0,v.UZ)(l),I=p.some((e=>(0,v.Hl)(e,o))),w=I?p.filter((e=>!(0,v.Hl)(e,o))):[...p,o],b=(0,f.oC)(e),y=w.slice(-b),C=(0,f.jU)(e,r);if((0,f.$Y)(e,"reactionEffects")){const t=I?(0,g.CE)(C.activeReactions,[c]):{...C.activeReactions,[c]:[...C.activeReactions[c]||[],{messageId:c,reaction:o}]};e=(0,Z.i)(e,{activeReactions:t},r)}e=U(e,l,y),(0,a.R3)(e);try{await(0,h.t9)("sendReaction",{chat:d,messageId:c,reactions:y,shouldAddToRecent:i})}catch(t){e=U(e=(0,a.Rd)(),l,p),(0,a.R3)(e)}})),(0,a.iw)("stopActiveReaction",((e,t,n)=>{const{messageId:a,reaction:s,tabId:o=(0,P._w)()}=n,i=(0,f.jU)(e,o);if(!i.activeReactions[a]?.some((e=>(0,v.Hl)(e.reaction,s))))return e;const r=i.activeReactions[a].filter((e=>!(0,v.Hl)(e.reaction,s))),c=r.length?{...i.activeReactions,[a]:r}:(0,g.CE)(i.activeReactions,[a]);return(0,Z.i)(e,{activeReactions:c},o)})),(0,a.iw)("setDefaultReaction",(async(e,t,n)=>{const{reaction:s}=n;await(0,h.t9)("setDefaultReaction",{reaction:s})&&((e=(0,a.Rd)()).config?(e={...e,config:{...e.config,defaultReaction:s}},(0,a.R3)(e)):t.loadConfig())})),(0,a.iw)("stopActiveEmojiInteraction",((e,t,n)=>{const{id:a,tabId:s=(0,P._w)()}=n;return(0,Z.i)(e,{activeEmojiInteractions:(0,f.jU)(e,s).activeEmojiInteractions?.filter((e=>e.id!==a))},s)})),(0,a.iw)("loadReactors",(async(e,t,n)=>{const{chatId:s,messageId:o,reaction:i}=n,r=(0,f.Z1)(e,s),c=(0,f.hj)(e,s,o);if(!r||!c)return;const d=c.reactors?.nextOffset,l=await(0,h.t9)("fetchMessageReactionsList",{reaction:i,chat:r,messageId:o,offset:d});l&&(e=(0,a.Rd)(),e=(0,p.Sh)(e,(0,g.ee)(l.users,"id")),e=(0,p.fZ)(e,(0,g.ee)(l.chats,"id")),e=(0,p.cY)(e,s,o,{reactors:l}),(0,a.R3)(e))})),(0,a.iw)("loadMessageReactions",((e,t,n)=>{const{ids:a,chatId:s}=n,o=(0,f.Z1)(e,s);o&&"connectionStateReady"===e.connectionState&&(0,h.t9)("fetchMessageReactions",{ids:a,chat:o})})),(0,a.iw)("sendWatchingEmojiInteraction",((e,t,n)=>{const{chatId:a,emoticon:s,x:o,y:i,startSize:r,isReversed:c,id:d,tabId:l=(0,P._w)()}=n,u=(0,f.Z1)(e,a),m=(0,f.jU)(e,l);if(u&&m.activeEmojiInteractions?.some((e=>e.id===d))&&a!==e.currentUserId)return"connectionStateReady"===e.connectionState&&(0,h.t9)("sendWatchingEmojiInteraction",{chat:u,emoticon:s}),(0,Z.i)(e,{activeEmojiInteractions:m.activeEmojiInteractions.map((t=>t.id===d?{...t,x:L(e,o),y:i,startSize:r,isReversed:c}:t))},l)})),(0,a.iw)("fetchUnreadReactions",(async(e,t,n)=>{const{chatId:s,offsetId:o}=n,i=(0,f.Z1)(e,s);if(!i)return;const r=await(0,h.t9)("fetchUnreadReactions",{chat:i,offsetId:o,addOffset:o?-1:void 0});if(!r||!r.messages.length)return e=j(e=(0,a.Rd)(),s,{unreadReactionsCount:0}),void(0,a.R3)(e);const{messages:c,chats:d,users:l}=r,u=(0,g.ee)(c,"id"),m=Object.keys(u).map(Number);e=(0,a.Rd)(),e=(0,p.c_)(e,i.id,u),e=(0,p.Sh)(e,(0,g.ee)(l,"id")),e=j(e=(0,p.fZ)(e,(0,g.ee)(d,"id")),s,{unreadReactions:[...i.unreadReactions||[],...m]}),(0,a.R3)(e)})),(0,a.iw)("animateUnreadReaction",((e,t,n)=>{const{messageIds:s,tabId:o=(0,P._w)()}=n,i=(0,f.jr)(e,o);if(i){if(i.unreadReactionsCount){const n=i.unreadReactionsCount-s.length,o=(i.unreadReactions||[]).filter((e=>!s.includes(e)));e=j(e,i.id,{unreadReactions:o}),(0,a.R3)(e),!o.length&&n&&t.fetchUnreadReactions({chatId:i.id,offsetId:Math.min(...s)})}if(t.markMessagesRead({messageIds:s,tabId:o}),(0,f.$Y)(e,"reactionEffects"))return e=(0,a.Rd)(),(0,Z.i)(e,{activeReactions:{...(0,f.jU)(e,o).activeReactions,...Object.fromEntries(s.map((t=>{const n=(0,f.hj)(e,i.id,t);if(!n)return;const a=n.reactions?.recentReactions?.filter((e=>{let{isUnread:t}=e;return t}));if(!a)return;const s=a.map((e=>e.reaction));return[t,s.map((e=>({messageId:t,reaction:e})))]})).filter(Boolean))}},o)}})),(0,a.iw)("focusNextReaction",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{},s=(0,f.jr)(e,a);s?.unreadReactions&&t.focusMessage({chatId:s.id,messageId:s.unreadReactions[0],tabId:a})})),(0,a.iw)("readAllReactions",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{},s=(0,f.jr)(e,a);if(s)return(0,h.t9)("readAllReactions",{chat:s}),j(e,s.id,{unreadReactionsCount:void 0,unreadReactions:void 0})})),(0,a.iw)("loadTopReactions",(async e=>{const t=await(0,h.t9)("fetchTopReactions",{});t&&(e=(0,a.Rd)(),e={...e,topReactions:t.reactions},(0,a.R3)(e))})),(0,a.iw)("loadRecentReactions",(async e=>{const t=await(0,h.t9)("fetchRecentReactions",{});t&&(e=(0,a.Rd)(),e={...e,recentReactions:t.reactions},(0,a.R3)(e))})),(0,a.iw)("clearRecentReactions",(async e=>{await(0,h.t9)("clearRecentReactions")&&(e=(0,a.Rd)(),e={...e,recentReactions:[]},(0,a.R3)(e))})),(0,a.iw)("loadStatistics",(async(e,t,n)=>{const{chatId:s,isGroup:o,tabId:i=(0,P._w)()}=n,r=(0,f.Z1)(e,s),c=(0,f.x6)(e,s);if(!r||!c)return;const d=await(0,h.t9)(o?"fetchGroupStatistics":"fetchChannelStatistics",{chat:r,dcId:c.statisticsDcId});if(!d)return;e=(0,a.Rd)();const{stats:l,users:u}=d;if(e=(0,p.Sh)(e,(0,g.ee)(u,"id")),"recentTopMessages"in l&&l.recentTopMessages.length){const t=(0,f.Zw)(e,s);l.recentTopMessages=l.recentTopMessages.map((e=>({...e,...t[e.msgId]})))}e=(0,p.ze)(e,s,l,i),(0,a.R3)(e)})),(0,a.iw)("loadMessageStatistics",(async(e,t,n)=>{const{chatId:s,messageId:o,tabId:i=(0,P._w)()}=n,r=(0,f.Z1)(e,s),c=(0,f.x6)(e,s);if(!r||!c)return;const d=c.statisticsDcId;let l=await(0,h.t9)("fetchMessageStatistics",{chat:r,messageId:o,dcId:d});l||(l={}),e=(0,a.Rd)();const{views:u,forwards:m}=(0,f.Zw)(e,s)[o];l.views=u,l.forwards=m;const g=await(0,h.t9)("fetchMessagePublicForwards",{chat:r,messageId:o,dcId:d});l.publicForwards=g?.length,l.publicForwardsData=g,e=(0,a.Rd)(),e=(0,p.kM)(e,l,i),(0,a.R3)(e)})),(0,a.iw)("loadStatisticsAsyncGraph",(async(e,t,n)=>{const{chatId:s,token:o,name:i,isPercentage:r,tabId:c=(0,P._w)()}=n,d=(0,f.x6)(e,s);if(!d)return;const l=d.statisticsDcId,u=await(0,h.t9)("fetchStatisticsAsyncGraph",{token:o,dcId:l,isPercentage:r});u&&(e=(0,a.Rd)(),e=(0,p.yC)(e,s,i,u,c),(0,a.R3)(e))})),n(89005);var je=n(70735);function Oe(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];let[s=(0,P._w)()]=n;const{chatId:o,threadId:i}=(0,f.Bt)(e,s)||{};return o&&i?(e=(0,p.qr)(e,o,i,!1,void 0,s),e=(0,p.Pb)(e,o,i,void 0,void 0,void 0,s)):e}(0,a.iw)("openLocalTextSearch",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{},{chatId:s,threadId:o}=(0,f.Bt)(e,a)||{};if(s&&o)return(0,p.qr)(e,s,o,!0,void 0,a)})),(0,a.iw)("closeLocalTextSearch",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{};return Oe(e,a)})),(0,a.iw)("setLocalTextSearchQuery",((e,t,n)=>{const{query:a,tabId:s=(0,P._w)()}=n,{chatId:o,threadId:i}=(0,f.Bt)(e,s)||{};if(!o||!i)return;const r=(0,v.uw)(o,i),{query:c}=(0,f.jU)(e,s).localTextSearch.byChatThreadKey[r]||{};return a!==c&&(e=(0,p.Pb)(e,o,i,je.D,void 0,void 0,s)),(0,p.qr)(e,o,i,!0,a,s)})),(0,a.iw)("setLocalMediaSearchType",((e,t,n)=>{const{mediaType:a,tabId:s=(0,P._w)()}=n,{chatId:o,threadId:i}=(0,f.Bt)(e,s)||{};if(o&&i)return(0,p.z5)(e,o,i,a,s)}));var Fe=n(15780);(0,a.iw)("openChat",((e,t,n)=>{const{id:a,threadId:s=u._f,type:o="thread",shouldReplaceHistory:i=!1,shouldReplaceLast:r=!1,noForumTopicPanel:c,tabId:d=(0,P._w)()}=n,l=(0,f.Bt)(e,d),m=(0,f.jU)(e,d);return m.premiumModal?.promo&&m.premiumModal?.isOpen&&(e=(0,Z.i)(e,{premiumModal:{...m.premiumModal,isOpen:!1}},d)),l&&l.chatId===a&&l.threadId===s&&l.type===o||(a&&(e=(0,p.O8)(e,a,s,"replyStack",[],d),e=(0,Z.i)(e,{activeReactions:{}},d)),e=Oe(e=(0,p.i9)(e,d),d),e=(0,Z.i)(e,{isStatisticsShown:!1,contentToBeScheduled:void 0,...a!==(0,f.jU)(e,d).forwardMessages.toChatId&&{forwardMessages:{}}},d)),a&&((0,f.Z1)(e,a)?.isForum&&!c?t.openForumPanel({chatId:a,tabId:d}):a!==(0,f.jU)(e,d).forumPanelChatId&&t.closeForumPanel({tabId:d})),t.updatePageTitle({tabId:d}),(0,p.Wy)(e,a,s,o,i,r,d)})),(0,a.iw)("openChatInNewTab",((e,t,n)=>{const{chatId:a,threadId:s=u._f}=n,i=(0,Fe.Ex)(a,"thread",s);o.D$V?window.electron.openNewWindow(i):window.open(i,"_blank")})),(0,a.iw)("openPreviousChat",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{};return t.updatePageTitle({tabId:a}),(0,p.Wy)(e,void 0,void 0,void 0,void 0,void 0,a)})),(0,a.iw)("openChatWithInfo",((e,t,n)=>{const{tabId:s=(0,P._w)()}=n;e=(0,Z.i)(e,{...(0,f.jU)(e,s),isChatInfoShown:!0},s),e={...e,lastIsChatInfoShown:!0},(0,a.R3)(e),t.openChat({...n,tabId:s})})),(0,a.iw)("openChatWithDraft",((e,t,n)=>{const{chatId:a,text:s,threadId:o,files:i,filter:r,tabId:c=(0,P._w)()}=n;return a&&t.openChat({id:a,threadId:o,tabId:c}),(0,Z.i)(e,{requestedDraft:{chatId:a,text:s,files:i,filter:r}},c)})),(0,a.iw)("resetChatCreation",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{};return(0,Z.i)(e,{chatCreation:void 0},a)})),(0,a.iw)("setNewChatMembersDialogState",((e,t,n)=>{const{newChatMembersProgress:a,tabId:s=(0,P._w)()}=n;return(0,Z.i)(e,{newChatMembersProgress:a},s)})),(0,a.iw)("openNextChat",((e,t,n)=>{const{targetIndexDelta:a,orderedIds:s,tabId:o=(0,P._w)()}=n,{chatId:i}=(0,f.Bt)(e,o)||{};if(!i)return void t.openChat({id:s[0],tabId:o});const r=s.indexOf(i);if(-1===r)return;const c=s[r+a];t.openChat({id:c,shouldReplaceHistory:!0,tabId:o})})),(0,a.iw)("closeDeleteChatFolderModal",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{};return(0,Z.i)(e,{deleteFolderDialogModal:void 0},a)})),(0,a.iw)("closeChatlistModal",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{};return(0,Z.i)(e,{chatlistModal:void 0},a)})),(0,a.iw)("requestChatTranslation",((e,t,n)=>{const{chatId:a,toLanguageCode:s,tabId:o=(0,P._w)()}=n;return(0,p.LV)(e,a,s,o)}));var _e=n(83099),De=n(64319),qe=n(996),$e=n(42986);const He=o.ckE+o.fK3;let Ge;function Ve(e,t,n){const{type:a,threadId:s}=(0,f.Bt)(e)||{},o=w.Iu,i=(0,f.Z1)(e,t),r="scheduled"===a?(0,f.yB)(e,t):(0,f.Zw)(e,t);if(!i||!r||!s)return;const c=n.map((e=>r[e])).filter((t=>(0,f._k)(e,t,s).canCopy)).sort(((e,t)=>e.id-t.id)),d=[],l=[];c.forEach((t=>{const n=(0,v.eA)(i)?i:(0,f.Ur)(e,t),a=`> ${n?(0,v.OU)(o,n):t.forwardInfo?.hiddenUserName||""}:`;d.push(a),d.push(`${function(e,t){const n=(0,$e.Eb)(t),a=n?`${n} `:"",s=(0,qe.X)(t,void 0,void 0,void 0,void 0,void 0,!0)?.join("");return`${a}${(0,$e.Kk)(e,t,s,!0)}`}(o,t)}\n`),l.push(a),l.push(`${(0,v.MK)(o,t,!1,0,!0)}\n`)})),(0,De.qN)(d.join("\n"),l.join("\n"))}(0,a.iw)("setScrollOffset",((e,t,n)=>{const{chatId:a,threadId:s,scrollOffset:o,tabId:i=(0,P._w)()}=n;return e=(0,p.pf)(e,a,s,"lastScrollOffset",o),(0,p.O8)(e,a,s,"scrollOffset",o,i)})),(0,a.iw)("setReplyingToId",((e,t,n)=>{const{messageId:a,tabId:s=(0,P._w)()}=n,o=(0,f.Bt)(e,s);if(!o)return;const{chatId:i,threadId:r}=o;return(0,p.pf)(e,i,r,"replyingToId",a)})),(0,a.iw)("setEditingId",((e,t,n)=>{const{messageId:a,tabId:s=(0,P._w)()}=n,o=(0,f.Bt)(e,s);if(!o)return;const{chatId:i,threadId:r,type:c}=o,d="scheduled"===c?"editingScheduledId":"editingId";return(0,p.pf)(e,i,r,d,a)})),(0,a.iw)("setEditingDraft",((e,t,n)=>{const{text:a,chatId:s,threadId:o,type:i}=n,r="scheduled"===i?"editingScheduledDraft":"editingDraft";return(0,p.pf)(e,s,o,r,a)})),(0,a.iw)("editLastMessage",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{},{chatId:s,threadId:o}=(0,f.Bt)(e,a)||{};if(!s||!o)return;const i=(0,f.Zw)(e,s),r=(0,f.Cb)(e,s,o,a);if(!i||!r)return;const c=(0,g.dF)(r,(t=>Boolean(i[t]&&(0,f._k)(e,i[t],o).canEdit)));return c?(0,p.pf)(e,s,o,"editingId",c):void 0})),(0,a.iw)("replyToNextMessage",((e,t,n)=>{const{targetIndexDelta:a,tabId:s=(0,P._w)()}=n,{chatId:o,threadId:i}=(0,f.Bt)(e,s)||{};if(!o||!i)return;const r=(0,f.Zw)(e,o),c=(0,f.Cb)(e,o,i,s);if(!r||!c)return;const d=(0,f.Yy)(e,o,i);let l;if((0,f.b9)(e,o,i,s)&&d){const e=Object.keys(r),t=e.indexOf(d.toString())+a;l=t<=e.length+1&&t>=0?Number(e[t]):void 0}else l=i===u._f?(0,f.Z1)(e,o)?.lastMessage?.id:(0,f.tZ)(e,o,i)?.lastMessageId;t.setReplyingToId({messageId:l,tabId:s}),t.focusMessage({chatId:o,threadId:i,messageId:l,tabId:s})})),(0,a.iw)("openAudioPlayer",((e,t,n)=>{const{chatId:a,threadId:s,messageId:o,origin:i,volume:r,playbackRate:c,isMuted:d,tabId:l=(0,P._w)()}=n,u=(0,f.jU)(e,l);return(0,Z.i)(e,{audioPlayer:{chatId:a,threadId:s,messageId:o,origin:null!=i?i:u.audioPlayer.origin,volume:null!=r?r:u.audioPlayer.volume,playbackRate:c||u.audioPlayer.playbackRate||e.audioPlayer.lastPlaybackRate,isPlaybackRateActive:void 0===u.audioPlayer.isPlaybackRateActive?e.audioPlayer.isLastPlaybackRateActive:u.audioPlayer.isPlaybackRateActive,isMuted:d||u.audioPlayer.isMuted}},l)})),(0,a.iw)("setAudioPlayerVolume",((e,t,n)=>{const{volume:a,tabId:s=(0,P._w)()}=n;return(0,Z.i)(e,{audioPlayer:{...(0,f.jU)(e,s).audioPlayer,volume:a,isMuted:!1}},s)})),(0,a.iw)("setAudioPlayerPlaybackRate",((e,t,n)=>{const{playbackRate:a,isPlaybackRateActive:s,tabId:o=(0,P._w)()}=n;return e={...e,audioPlayer:{...e.audioPlayer,lastPlaybackRate:a,isLastPlaybackRateActive:s}},(0,Z.i)(e,{audioPlayer:{...(0,f.jU)(e,o).audioPlayer,playbackRate:a,isPlaybackRateActive:s}},o)})),(0,a.iw)("setAudioPlayerMuted",((e,t,n)=>{const{isMuted:a,tabId:s=(0,P._w)()}=n;return(0,Z.i)(e,{audioPlayer:{...(0,f.jU)(e,s).audioPlayer,isMuted:a}},s)})),(0,a.iw)("setAudioPlayerOrigin",((e,t,n)=>{const{origin:a,tabId:s=(0,P._w)()}=n;return(0,Z.i)(e,{audioPlayer:{...(0,f.jU)(e,s).audioPlayer,origin:a}},s)})),(0,a.iw)("closeAudioPlayer",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{},s=(0,f.jU)(e,a);return(0,Z.i)(e,{audioPlayer:{volume:s.audioPlayer.volume,playbackRate:s.audioPlayer.playbackRate,isPlaybackRateActive:s.audioPlayer.isPlaybackRateActive,isMuted:s.audioPlayer.isMuted}},a)})),(0,a.iw)("openPollResults",((e,t,n)=>{const{chatId:s,messageId:o,tabId:i=(0,P._w)()}=n,r=(0,f.Jf)(e,(0,B.W7)(),i),c=(0,f.jU)(e,i);if(r){if(s!==c.pollResults.chatId||o!==c.pollResults.messageId)return(0,Z.i)(e,{pollResults:{chatId:s,messageId:o,voters:{}}},i)}else window.setTimeout((()=>{e=(0,a.Rd)(),e=(0,Z.i)(e,{pollResults:{chatId:s,messageId:o,voters:{}}},i),(0,a.R3)(e)}),450)})),(0,a.iw)("closePollResults",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{};return(0,Z.i)(e,{pollResults:{}},a)})),(0,a.iw)("focusLastMessage",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{},s=(0,f.Bt)(e,a);if(!s)return;const{chatId:o,threadId:i,type:r}=s;let c;if(i===u._f)if("pinned"===r){const t=(0,f.KB)(e,o,u._f);if(!t?.length)return;c=t[t.length-1]}else c=(0,f.Z1)(e,o)?.lastMessage?.id;else c=(0,f.tZ)(e,o,i)?.lastMessageId;c&&t.focusMessage({chatId:o,threadId:i,messageListType:r,messageId:c,noHighlight:!0,noForumTopicPanel:!0,tabId:a})})),(0,a.iw)("focusNextReply",((e,t,n)=>{const{tabId:s=(0,P._w)()}=n||{},o=(0,f.Bt)(e,s);if(!o)return;const{chatId:i,threadId:r}=o,c=(0,f.p9)(e,i,r,s);if(c&&0!==c.length){const n=c.pop();e=(0,p.O8)(e,i,r,"replyStack",[...c],s),(0,a.R3)(e),t.focusMessage({chatId:i,threadId:r,messageId:n,tabId:s,noForumTopicPanel:!0})}else t.focusLastMessage({tabId:s})})),(0,a.iw)("focusMessage",((e,t,n)=>{const{chatId:s,threadId:o=u._f,messageListType:i="thread",noHighlight:r,groupedId:c,groupedChatId:d,replyMessageId:l,isResizingContainer:h,shouldReplaceHistory:I,noForumTopicPanel:v,tabId:w=(0,P._w)()}=n;let{messageId:b}=n;if(void 0!==c){const t=(0,f.y8)(e,d,c);t?.length&&([b]=(0,g.oA)(t))}const Z=(0,f.Bt)(e,w),y=!Z||s!==Z.chatId||o!==Z.threadId||i!==Z.type;if(Ge&&(clearTimeout(Ge),Ge=void 0),Ge=window.setTimeout((()=>{e=(0,a.Rd)(),e=(0,p.cq)(e,void 0,void 0,void 0,void 0,void 0,w),e=(0,p.wV)(e,void 0,w),(0,a.R3)(e)}),r?He:1500),e=(0,p.cq)(e,s,b,o,r,h,w),e=(0,p.wV)(e,void 0,w),l){const t=(0,f.p9)(e,s,o,w)||[];e=(0,p.O8)(e,s,o,"replyStack",[...t,l],w)}y&&(e=(0,p.wV)(e,m.fo.Static,w));const C=(0,f.Cb)(e,s,o,w);if(C&&C.includes(b))return(0,a.R3)(e,{forceOnHeavyAnimation:!0}),void t.openChat({id:s,threadId:o,type:i,shouldReplaceHistory:I,noForumTopicPanel:v,tabId:w});if(y&&(e=(0,p.O8)(e,s,o,"viewportIds",void 0,w)),C&&!y){const t=b>C[0]?m.fo.Down:m.fo.Up;e=(0,p.wV)(e,t,w)}(0,a.R3)(e,{forceOnHeavyAnimation:!0}),t.openChat({id:s,threadId:o,type:i,shouldReplaceHistory:I,noForumTopicPanel:v,tabId:w}),t.loadViewportMessages({tabId:w,shouldForceRender:!0})})),(0,a.iw)("openForwardMenu",((e,t,n)=>{const{fromChatId:a,messageIds:s,groupedId:o,withMyScore:i,tabId:r=(0,P._w)()}=n;let c;return o&&(c=(0,f.xH)(e,a,o)),(0,Z.i)(e,{forwardMessages:{fromChatId:a,messageIds:c||s,isModalShown:!0,withMyScore:i}},r)})),(0,a.iw)("changeForwardRecipient",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{};return(0,Z.i)(e,{forwardMessages:{...(0,f.jU)(e,a).forwardMessages,toChatId:void 0,isModalShown:!0,noAuthors:!1,noCaptions:!1}},a)})),(0,a.iw)("setForwardNoAuthors",((e,t,n)=>{const{noAuthors:a,tabId:s=(0,P._w)()}=n,o=(0,f.jU)(e,s);return(0,Z.i)(e,{forwardMessages:{...o.forwardMessages,noAuthors:a,noCaptions:a&&o.forwardMessages.noCaptions}},s)})),(0,a.iw)("setForwardNoCaptions",((e,t,n)=>{const{noCaptions:a,tabId:s=(0,P._w)()}=n;return(0,Z.i)(e,{forwardMessages:{...(0,f.jU)(e,s).forwardMessages,noCaptions:a,noAuthors:a}},s)})),(0,a.iw)("exitForwardMode",((e,t,n)=>{const{tabId:s=(0,P._w)()}=n||{};e=(0,Z.i)(e,{forwardMessages:{}},s),(0,a.R3)(e)})),(0,a.iw)("openForwardMenuForSelectedMessages",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{},s=(0,f.jU)(e,a);if(!s.selectedMessages)return;const{chatId:o,messageIds:i}=s.selectedMessages;t.openForwardMenu({fromChatId:o,messageIds:i,tabId:a})})),(0,a.iw)("cancelMessageMediaDownload",((e,t,n)=>{const{message:a,tabId:s=(0,P._w)()}=n;return(0,p.wI)(e,a,s)})),(0,a.iw)("cancelMessagesMediaDownload",((e,t,n)=>{const{messages:a,tabId:s=(0,P._w)()}=n;for(const t of a)e=(0,p.wI)(e,t,s);return e})),(0,a.iw)("downloadMessageMedia",((e,t,n)=>{const{message:a,tabId:s=(0,P._w)()}=n;return(0,p.fC)(e,a,s)})),(0,a.iw)("downloadSelectedMessages",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{},s=(0,f.jU)(e,a);if(!s.selectedMessages)return;const{chatId:o,messageIds:i}=s.selectedMessages,{threadId:r}=(0,f.Bt)(e,a)||{},c=(0,f.Zw)(e,o);c&&r&&i.map((e=>c[e])).filter((t=>(0,f._k)(e,t,r).canDownload)).forEach((e=>t.downloadMessageMedia({message:e,tabId:a})))})),(0,a.iw)("enterMessageSelectMode",((e,t,n)=>{const{messageId:a,tabId:s=(0,P._w)()}=n||{},o=(0,f.jr)(e,s);return o?(0,p.M6)(e,o.id,a,s):e})),(0,a.iw)("toggleMessageSelection",((e,t,n)=>{const{messageId:o,groupedId:i,childMessageIds:r,withShift:c,tabId:d=(0,P._w)()}=n,l=(0,f.Bt)(e,d);if(!l)return;const{chatId:u,threadId:m,type:h}=l;e=(0,p.Ob)(e,u,m,h,o,i,r,c,d),(0,a.R3)(e),e.shouldShowContextMenuHint&&(t.disableContextMenuHint(),t.showNotification({message:`To **edit** or **reply**, close this menu. Then ${s.$b?"long tap":"right click"} on a message.`,tabId:d}))})),(0,a.iw)("disableContextMenuHint",(e=>{if(e.shouldShowContextMenuHint)return{...e,shouldShowContextMenuHint:!1}})),(0,a.iw)("exitMessageSelectMode",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{};return(0,p.i9)(e,a)})),(0,a.iw)("openPollModal",((e,t,n)=>{const{isQuiz:a,tabId:s=(0,P._w)()}=n||{};return(0,Z.i)(e,{pollModal:{isOpen:!0,isQuiz:a}},s)})),(0,a.iw)("closePollModal",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{};return(0,Z.i)(e,{pollModal:{isOpen:!1}},a)})),(0,a.iw)("checkVersionNotification",((e,t)=>{if(o.V61&&Date.now()>Number(o.V61)+2592e5)return;const n="1.61.36".split(".").slice(0,2).join("."),{serviceNotifications:a}=e;if(a.find((e=>{let{version:t}=e;return t===n})))return;const s={chatId:o.awM,date:(0,Ie.bp)(),content:{text:(0,_e.ZP)("**Telegram Web A was updated to version 1.61**\n\n[🤩](customEmoji:5373026167722876724) **Whats New**\n\n• Shareable Chat Folders Your chat folders can now be shared with friends or colleagues adding the folder and **joining all its chats** in one tap.\n\n• Power Saving Mode You can **extend battery life** and **improve performance** by turning on Power Saving Mode or individually disabling autoplay, animations and effects in __Settings > Animations and Performance__.\n\n• Better Bots Telegram bots can completely replace any website. These bots can now be launched **in any chat** try typing [@DurgerKingBot](https://t.me/DurgerKingBot) (followed by a space) in any chat, or posting [this link](https://t.me/DurgerKingBot/menu).\n\n• Enhanced Design Enjoy transparent layers with **beautiful blur effects** when selecting emoji, stickers, reactions and statuses. Sending messages also has a satisfying **new animation**.\n\n• Infinite Reactions Telegram Premium users can pick reactions from an infinite selection of custom emoji. They can also use **up to 3 reactions** on any message to combine multiple emotions. [👍](customEmoji:5469770542288478598)[🔥](customEmoji:5420315771991497307)[❤️](customEmoji:5449505950283078474)\n\n• Preview in Media Viewer Scrubbing through videos now shows a **thumbnail preview** to easily find specific scenes.\n\n• Group Chat Improvements Create groups with **only yourself** or restrict anyone from adding you directly to groups (via __Settings > Privacy and Security > Group and Channels > Nobody__).\n\n• Send When Online By right-clicking the Send button, you can schedule a message to be sent when the recipient comes online.\n\n[😍](customEmoji:5372886001465170842) **Whats Better**\n\n• As usual, we've added a pack of optimizations and performance improvements. If you ever run into an issue with the app, be sure to [report it](https://bugs.telegram.org/?tag_ids=41&sort=time) on the Bugs and Suggestions Platform.\n\n🦄 **We also welcome** you to join our official channels in **[English](https://t.me/webachannel)** and **[Russian](https://t.me/webachannelru)** — where we post app updates and share our experiences building one of the worlds most feature-rich web applications.\n",!0)},isOutgoing:!1};t.createServiceNotification({message:s,version:n})})),(0,a.iw)("createServiceNotification",((e,t,n)=>{const{message:s,version:i}=n,{serviceNotifications:r}=e,c=(0,f.Z1)(e,o.awM),d=Math.max(c.lastMessage?.id||0,...r.map((e=>{let{id:t}=e;return t}))),l=(r.length+1)/1e3,u=Math.floor(d)+l;s.previousLocalId=s.id,s.id=u;const m={id:u,message:s,version:i,isUnread:!0};e={...e,serviceNotifications:[...r.slice(-1e3),m]},(0,a.R3)(e),t.apiUpdate({"@type":"newMessage",id:s.id,chatId:s.chatId,message:s})})),(0,a.iw)("openReactorListModal",((e,t,n)=>{const{chatId:a,messageId:s,tabId:o=(0,P._w)()}=n;return(0,Z.i)(e,{reactorModal:{chatId:a,messageId:s}},o)})),(0,a.iw)("closeReactorListModal",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{};return(0,Z.i)(e,{reactorModal:void 0},a)})),(0,a.iw)("openSeenByModal",((e,t,n)=>{const{chatId:a,messageId:s,tabId:o=(0,P._w)()}=n;return(0,Z.i)(e,{seenByModal:{chatId:a,messageId:s}},o)})),(0,a.iw)("closeSeenByModal",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{};return(0,Z.i)(e,{seenByModal:void 0},a)})),(0,a.iw)("openChatLanguageModal",((e,t,n)=>{const{chatId:a,messageId:s,tabId:o=(0,P._w)()}=n,i=s?(0,f.Bd)(e,a,s,o):(0,f.lp)(e,a,o);return(0,Z.i)(e,{chatLanguageModal:{chatId:a,messageId:s,activeLanguage:i}},o)})),(0,a.iw)("closeChatLanguageModal",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{};return(0,Z.i)(e,{chatLanguageModal:void 0},a)})),(0,a.iw)("copySelectedMessages",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{},s=(0,f.jU)(e,a);if(!s.selectedMessages)return;const{chatId:o,messageIds:i}=s.selectedMessages;Ve(e,o,i)})),(0,a.iw)("copyMessagesByIds",((e,t,n)=>{const{messageIds:a,tabId:s=(0,P._w)()}=n,o=(0,f.jr)(e,s);a&&0!==a.length&&o&&Ve(e,o.id,a)})),(0,a.iw)("setGlobalSearchQuery",((e,t,n)=>{const{query:a,tabId:s=(0,P._w)()}=n,{chatId:o}=(0,f.jU)(e,s).globalSearch;return(0,p.No)(e,{globalResults:{},localResults:{},resultsByType:void 0,...a?{fetchingStatus:{chats:!o,messages:!0}}:{fetchingStatus:void 0},query:a},s)})),(0,a.iw)("setGlobalSearchClosing",((e,t,n)=>{const{tabId:a=(0,P._w)(),isClosing:s}=n||{};return(0,p.No)(e,{isClosing:s},a)})),(0,a.iw)("addRecentlyFoundChatId",((e,t,n)=>{const{id:a}=n,{recentlyFoundChatIds:s}=e;if(!s)return{...e,recentlyFoundChatIds:[a]};const o=s.filter((e=>e!==a));return o.unshift(a),o.length>10&&o.pop(),{...e,recentlyFoundChatIds:o}})),(0,a.iw)("clearRecentlyFoundChats",(e=>({...e,recentlyFoundChatIds:void 0}))),(0,a.iw)("setGlobalSearchContent",((e,t,n)=>{const{content:a,tabId:s=(0,P._w)()}=n;return(0,p.Og)(e,a,s)})),(0,a.iw)("setGlobalSearchChatId",((e,t,n)=>{const{id:a,tabId:s=(0,P._w)()}=n;return(0,p.No)(e,{chatId:a,query:void 0,resultsByType:void 0},s)})),(0,a.iw)("setStickerSearchQuery",((e,t,n)=>{const{query:a,tabId:s=(0,P._w)()}=n;return(0,Z.i)(e,{stickerSearch:{query:a,resultIds:void 0}},s)})),(0,a.iw)("setGifSearchQuery",((e,t,n)=>{const{query:a,tabId:s=(0,P._w)()}=n;return(0,Z.i)(e,{gifSearch:{query:a,offset:void 0,results:void 0}},s)})),(0,a.iw)("setUserSearchQuery",((e,t,n)=>{const{query:a,tabId:s=(0,P._w)()}=n;return(0,p.Lm)(e,{globalUserIds:void 0,localUserIds:void 0,fetchingStatus:Boolean(a),query:a},s)})),(0,a.iw)("openAddContactDialog",((e,t,n)=>{const{userId:a,tabId:s=(0,P._w)()}=n;return(0,Z.i)(e,{newContact:{userId:a}},s)})),(0,a.iw)("openNewContactDialog",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{};return(0,Z.i)(e,{newContact:{isByPhoneNumber:!0}},a)})),(0,a.iw)("closeNewContactDialog",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{};return(0,p.ft)(e,a)})),n(73456);var We=n(91947),ze=n(69995);function Ye(e){document.querySelectorAll('link[rel="icon"], link[rel="alternate icon"]').forEach((t=>{e?t.href.includes("favicon-unread")||(t.href=t.href.replace("favicon","favicon-unread")):t.href=t.href.replace("favicon-unread","favicon")}))}function Je(e){o.D$V?window.electron.setWindowTitle(e):document.title!==e&&(document.title=e)}const Ke=(0,I.Ds)(Je,200,!1);let Xe,Qe;(0,a.iw)("toggleChatInfo",((e,t,n)=>{const{force:a,tabId:s=(0,P._w)()}=n||{},o=void 0!==a?a:!(0,f.jU)(e,s).isChatInfoShown;return e=(0,Z.i)(e,{isChatInfoShown:o},s),{...e,lastIsChatInfoShown:o}})),(0,a.iw)("setLeftColumnWidth",((e,t,n)=>{const{leftColumnWidth:a}=n;return{...e,leftColumnWidth:a}})),(0,a.iw)("resetLeftColumnWidth",(e=>({...e,leftColumnWidth:void 0}))),(0,a.iw)("toggleManagement",((e,t,n)=>{const{force:a,tabId:s=(0,P._w)()}=n||{},{chatId:o}=(0,f.Bt)(e,s)||{};if(!o)return;const i=(0,f.jU)(e,s);return(0,Z.i)(e,{management:{byChatId:{...i.management.byChatId,[o]:{...i.management.byChatId[o],isActive:void 0!==a?a:!(i.management.byChatId[o]||{}).isActive}}}},s)})),(0,a.iw)("requestNextManagementScreen",((e,t,n)=>{const{screen:a,tabId:s=(0,P._w)()}=n||{},{chatId:o}=(0,f.Bt)(e,s)||{};if(!o)return;const i=(0,f.jU)(e,s);return(0,Z.i)(e,{management:{byChatId:{...i.management.byChatId,[o]:{...i.management.byChatId[o],isActive:!0,nextScreen:a}}}},s)})),(0,a.iw)("closeManagement",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{},{chatId:s}=(0,f.Bt)(e,a)||{};if(!s)return;const o=(0,f.jU)(e,a);return(0,Z.i)(e,{management:{byChatId:{...o.management.byChatId,[s]:{...o.management.byChatId[s],isActive:!1}}}},a)})),(0,a.iw)("openChat",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n;if((0,B.W7)()||(0,B.c9)())return(0,Z.i)(e,{isLeftColumnShown:0===(0,f.jU)(e,a).messageLists.length},a)})),(0,a.iw)("toggleStatistics",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{},s=(0,f.jU)(e,a);return(0,Z.i)(e,{isStatisticsShown:!s.isStatisticsShown,statistics:{...s.statistics,currentMessageId:void 0}},a)})),(0,a.iw)("toggleMessageStatistics",((e,t,n)=>{const{tabId:a=(0,P._w)(),messageId:s}=n||{};return(0,Z.i)(e,{statistics:{...(0,f.jU)(e,a).statistics,currentMessageId:s}},a)})),(0,a.iw)("toggleLeftColumn",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{};return(0,Z.i)(e,{isLeftColumnShown:!(0,f.jU)(e,a).isLeftColumnShown},a)})),(0,a.iw)("addRecentEmoji",((e,t,n)=>{const{emoji:a}=n,{recentEmojis:s}=e;if(!s)return{...e,recentEmojis:[a]};const o=s.filter((e=>e!==a));return o.unshift(a),o.length>32&&o.pop(),{...e,recentEmojis:o}})),(0,a.iw)("addRecentSticker",((e,t,n)=>{const{sticker:a}=n,{recent:s}=e.stickers;if(!s)return{...e,stickers:{...e.stickers,recent:{hash:"0",stickers:[a]}}};const o=s.stickers.filter((e=>e.id!==a.id));return o.unshift(a),{...e,stickers:{...e.stickers,recent:{...s,stickers:o}}}})),(0,a.iw)("addRecentCustomEmoji",((e,t,n)=>{const{documentId:a}=n,{recentCustomEmojis:s}=e;if(!s)return{...e,recentCustomEmojis:[a]};const o=s.filter((e=>e!==a));return o.unshift(a),o.length>32&&o.pop(),{...e,recentCustomEmojis:o}})),(0,a.iw)("clearRecentCustomEmoji",(e=>({...e,recentCustomEmojis:[]}))),(0,a.iw)("reorderStickerSets",((e,t,n)=>{const{order:a,isCustomEmoji:s}=n;return{...e,stickers:{...e.stickers,added:{setIds:s?e.stickers.added.setIds:a}},customEmojis:{...e.customEmojis,added:{setIds:s?a:e.customEmojis.added.setIds}}}})),(0,a.iw)("showNotification",((e,t,n)=>{const{tabId:a=(0,P._w)(),...s}=n;s.localId=(0,ze.Z)();const o=[...(0,f.jU)(e,a).notifications],i=o.findIndex((e=>e.message===s.message));return-1!==i&&o.splice(i,1),o.push(s),(0,Z.i)(e,{notifications:o},a)})),(0,a.iw)("showAllowedMessageTypesNotification",((e,t,n)=>{const{chatId:a,tabId:s=(0,P._w)()}=n,o=(0,f.Z1)(e,a);if(!o)return;const{canSendPlainText:i,canSendPhotos:r,canSendVideos:c,canSendDocuments:d,canSendAudios:l,canSendStickers:u,canSendRoundVideos:m,canSendVoices:h}=(0,v.H5)(o),p=(0,g.oA)([i?"Chat.SendAllowedContentTypeText":void 0,r?"Chat.SendAllowedContentTypePhoto":void 0,c?"Chat.SendAllowedContentTypeVideo":void 0,h?"Chat.SendAllowedContentTypeVoiceMessage":void 0,m?"Chat.SendAllowedContentTypeVideoMessage":void 0,d?"Chat.SendAllowedContentTypeFile":void 0,l?"Chat.SendAllowedContentTypeMusic":void 0,u?"Chat.SendAllowedContentTypeSticker":void 0]).map((e=>w.Iu(e)));if(!p.length)return void t.showNotification({message:w.Iu("Chat.SendNotAllowedText"),tabId:s});const I=w.Iu("AutoDownloadSettings.LastDelimeter"),b=p.join(", ").replace(/,([^,]*)$/,`${I}$1`);t.showNotification({message:w.Iu("Chat.SendAllowedContentText",b),tabId:s})})),(0,a.iw)("dismissNotification",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n,s=(0,f.jU)(e,a).notifications.filter((e=>{let{localId:t}=e;return t!==n.localId}));return(0,Z.i)(e,{notifications:s},a)})),(0,a.iw)("showDialog",((e,t,n)=>{const{data:a,tabId:s=(0,P._w)()}=n;if("message"in a&&a.hasErrorKey&&!(0,We.ZP)(a))return e;const o=[...(0,f.jU)(e,s).dialogs];if("message"in a){const e=o.findIndex((e=>e.message===a.message));-1!==e&&o.splice(e,1)}return o.push(a),(0,Z.i)(e,{dialogs:o},s)})),(0,a.iw)("dismissDialog",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{},s=[...(0,f.jU)(e,a).dialogs];return s.pop(),(0,Z.i)(e,{dialogs:s},a)})),(0,a.iw)("toggleSafeLinkModal",((e,t,n)=>{const{url:a,tabId:s=(0,P._w)()}=n;return(0,Z.i)(e,{safeLinkModalUrl:a},s)})),(0,a.iw)("openHistoryCalendar",((e,t,n)=>{const{selectedAt:a,tabId:s=(0,P._w)()}=n;return(0,Z.i)(e,{historyCalendarSelectedAt:a},s)})),(0,a.iw)("closeHistoryCalendar",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{};return(0,Z.i)(e,{historyCalendarSelectedAt:void 0},a)})),(0,a.iw)("openGame",((e,t,n)=>{const{url:s,chatId:o,messageId:i,tabId:r=(0,P._w)()}=n,c=(0,f.hj)(e,o,i);if(!c)return;const d=c.viaBotId||c.senderId;if(d){if(!(0,f.LM)(e,d))return e=(0,Z.i)(e,{botTrustRequest:{botId:d,type:"game",onConfirm:{action:"openGame",payload:n}}},r),void(0,a.R3)(e);e=(0,Z.i)(e,{openedGame:{url:s,chatId:o,messageId:i}},r),(0,a.R3)(e)}})),(0,a.iw)("closeGame",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{};return(0,Z.i)(e,{openedGame:void 0},a)})),(0,a.iw)("requestConfetti",((e,t,n)=>{const{top:a,left:s,width:o,height:i,tabId:r=(0,P._w)()}=n||{};if((0,f.FO)(e))return(0,Z.i)(e,{confetti:{lastConfettiTime:Date.now(),top:a,left:s,width:o,height:i}},r)})),(0,a.iw)("updateAttachmentSettings",((e,t,n)=>{const{shouldCompress:a,shouldSendGrouped:s}=n;return{...e,attachmentSettings:{shouldCompress:null!=a?a:e.attachmentSettings.shouldCompress,shouldSendGrouped:null!=s?s:e.attachmentSettings.shouldSendGrouped}}})),(0,a.iw)("openLimitReachedModal",((e,t,n)=>{const{limit:a,tabId:s=(0,P._w)()}=n;return(0,Z.i)(e,{limitReachedModal:{limit:a}},s)})),(0,a.iw)("closeLimitReachedModal",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{};return(0,Z.i)(e,{limitReachedModal:void 0},a)})),(0,a.iw)("closeStickerSetModal",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{};return(0,Z.i)(e,{openedStickerSetShortName:void 0},a)})),(0,a.iw)("openCustomEmojiSets",((e,t,n)=>{const{setIds:a,tabId:s=(0,P._w)()}=n;return(0,Z.i)(e,{openedCustomEmojiSetIds:a},s)})),(0,a.iw)("closeCustomEmojiSets",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{};return(0,Z.i)(e,{openedCustomEmojiSetIds:void 0},a)})),(0,a.iw)("updateLastRenderedCustomEmojis",((e,t,n)=>{const{ids:a}=n,{lastRendered:s}=e.customEmojis;return{...e,customEmojis:{...e.customEmojis,lastRendered:(0,g.Tw)([...s,...a]).slice(0,o.j7i)}}})),(0,a.iw)("openCreateTopicPanel",((e,t,n)=>{const{chatId:a,tabId:s=(0,P._w)()}=n;return(0,f.jr)(e,s)||t.openChat({id:a,threadId:u._f,tabId:s}),(0,Z.i)(e,{createTopicPanel:{chatId:a}},s)})),(0,a.iw)("closeCreateTopicPanel",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{};return(0,Z.i)(e,{createTopicPanel:void 0},a)})),(0,a.iw)("openEditTopicPanel",((e,t,n)=>{const{chatId:a,topicId:s,tabId:o=(0,P._w)()}=n;return(0,f.jr)(e,o)||t.openChat({id:a,tabId:o}),(0,Z.i)(e,{editTopicPanel:{chatId:a,topicId:s}},o)})),(0,a.iw)("closeEditTopicPanel",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{};return(0,Z.i)(e,{editTopicPanel:void 0},a)})),(0,a.iw)("updateArchiveSettings",((e,t,n)=>{const{archiveSettings:a}=e,{isHidden:s=a.isHidden,isMinimized:o=a.isMinimized}=n;return{...e,archiveSettings:{isHidden:s,isMinimized:o}}})),(0,a.iw)("checkAppVersion",(e=>{if(o.D$V)return;const t=/^\d+\.\d+(\.\d+)?$/;fetch(`version.txt?${Date.now()}`).then((e=>e.text())).then((n=>{n=n.trim(),t.test(n)&&"1.61.36"!==n&&(e=(0,a.Rd)(),e={...e,isUpdateAvailable:!0},(0,a.R3)(e))})).catch((e=>{o.eMD&&console.error("[checkAppVersion failed] ",e)}))})),(0,a.iw)("setIsAppUpdateAvailable",((e,t,n)=>{e=(0,a.Rd)(),e={...e,isUpdateAvailable:Boolean(n)},(0,a.R3)(e)})),(0,a.iw)("afterHangUp",(e=>{(0,f.jU)(e,(0,P._w)()).multitabNextAction&&(0,P.g)()})),(0,a.iw)("onTabFocusChange",((e,t,n)=>{const{isBlurred:a,tabId:s=(0,P._w)()}=n;return a?(Xe&&clearInterval(Xe),Xe=window.setInterval((()=>{t.updatePageTitle({tabId:s})}),500)):(clearInterval(Xe),Xe=void 0),e=(0,Z.i)(e,{isBlurred:a},s),{...e,initialUnreadNotifications:a?(0,ge.xW)():void 0}})),(0,a.iw)("updatePageTitle",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{},{canDisplayChatInTitle:s}=e.settings.byKey,i=e.currentUserId;if(document.title.includes(o.ouc))return Ye(!1),void Je(`${o.Tih} ${o.ouc}`);if(e.initialUnreadNotifications&&Math.round(Date.now()/1e3)%2==0){const t=(0,ge.xW)()-e.initialUnreadNotifications;if(t>0)return Je(`${t} notification${t>1?"s":""}`),void Ye(!0)}Ye(!1);const r=(0,f.Bt)(e,a);if(r&&s&&!e.passcode.isScreenLocked){const{chatId:t,threadId:n}=r,a=(0,f.Z1)(e,t);if(a){const e=(0,v.U)(w.Iu,a,t===i);return a.isForum&&a.topics?.[n]?void Ke(`${e} ${a.topics[n].title}`):void Ke(e)}}Je(o.D$V?"":o.Tih)}));let et,tt=0;(0,he.ll)((e=>{const{updatePageTitle:t,updateIsOnline:n}=(0,a.Sv)(),s=e.passcode.isScreenLocked!==Qe,o=Object.values(e.byTabId).filter((e=>e.isBlurred)).length,i=(0,f.jU)(e,(0,P._w)()).isMasterTab;s&&t(),o!==tt&&i&&(et&&clearTimeout(et),et=window.setTimeout((()=>{e=(0,a.Rd)();const t=Object.values(e.byTabId).filter((e=>e.isBlurred)).length;n(t!==(0,P.s1)().length)}),100)),Qe=e.passcode.isScreenLocked,tt=o})),(0,a.iw)("closePaymentModal",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{},s=(0,f.jU)(e,a).payment.status;return e=(0,p.bp)(e,a),e=(0,p.WY)(e,a),(0,Z.i)(e,{payment:{...(0,f.jU)(e,a).payment,status:s}},a)})),(0,a.iw)("addPaymentError",((e,t,n)=>{const{error:a,tabId:s=(0,P._w)()}=n;return(0,Z.i)(e,{payment:{...(0,f.jU)(e,s).payment,status:"failed",error:a}},s)}));var nt=n(88422);(0,a.iw)("openMediaViewer",((e,t,n)=>{const{chatId:a,threadId:s,mediaId:o,avatarOwnerId:i,profilePhotoIndex:r,origin:c,volume:d,playbackRate:l,isMuted:u,tabId:m=(0,P._w)()}=n,h=(0,f.jU)(e,m);return(0,Z.i)(e,{mediaViewer:{...h.mediaViewer,chatId:a,threadId:s,mediaId:o,avatarOwnerId:i,profilePhotoIndex:r,origin:c,isHidden:!1,volume:null!=d?d:h.mediaViewer.volume,playbackRate:l||h.mediaViewer.playbackRate||e.mediaViewer.lastPlaybackRate,isMuted:u||h.mediaViewer.isMuted},forwardMessages:{}},m)})),(0,a.iw)("closeMediaViewer",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{},{volume:s,isMuted:o,playbackRate:i,isHidden:r}=(0,f.jU)(e,a).mediaViewer;return(0,Z.i)(e,{mediaViewer:{volume:s,isMuted:o,isHidden:r,playbackRate:i}},a)})),(0,a.iw)("setMediaViewerVolume",((e,t,n)=>{const{volume:a,tabId:s=(0,P._w)()}=n;return(0,Z.i)(e,{mediaViewer:{...(0,f.jU)(e,s).mediaViewer,volume:a,isMuted:!1}},s)})),(0,a.iw)("setMediaViewerPlaybackRate",((e,t,n)=>{const{playbackRate:a,tabId:s=(0,P._w)()}=n;return e={...e,mediaViewer:{...e.mediaViewer,lastPlaybackRate:a}},(0,Z.i)(e,{mediaViewer:{...(0,f.jU)(e,s).mediaViewer,playbackRate:a}},s)})),(0,a.iw)("setMediaViewerMuted",((e,t,n)=>{const{isMuted:a,tabId:s=(0,P._w)()}=n;return(0,Z.i)(e,{mediaViewer:{...(0,f.jU)(e,s).mediaViewer,isMuted:a}},s)})),(0,a.iw)("setMediaViewerHidden",((e,t,n)=>{const{isHidden:a,tabId:s=(0,P._w)()}=n;return(0,Z.i)(e,{mediaViewer:{...(0,f.jU)(e,s).mediaViewer,isHidden:a}},s)}));var at=n(50214),st=n(95281),ot=n(5872),it=n(35369);let rt=!1;(0,I.Gq)((()=>{(0,a.Rd)().passcode.hasPasscode&&!rt&&1===Object.keys((0,a.Rd)().byTabId).length&&(0,at.jv)()})),(0,a.iw)("setPasscode",(async(e,t,n)=>{const{passcode:s,tabId:o=(0,P._w)()}=n;e=(0,p.vu)(e,{isLoading:!0}),(0,a.R3)(e),await(0,st.AU)(s);const i=JSON.stringify({...(0,at.K8)(),userId:e.currentUserId});e=(0,a.Rd)();const r=(0,ot.Uf)((0,p.vu)(e,{hasPasscode:!0,error:void 0,isLoading:!1}));try{await(0,st.H4)(i,r),(0,P.Z6)(),e=(0,a.Rd)(),e=(0,p.vu)(e,{hasPasscode:!0,error:void 0,isLoading:!1}),(0,a.R3)(e),(0,ot.jA)(!0)}catch(n){(0,st.J9)(),e=(0,a.Rd)(),e=(0,p.vu)(e,{isLoading:!1}),(0,a.R3)(e),t.showNotification({message:"Failed to set passcode",tabId:o}),t.requestNextSettingsScreen({screen:m.MT.PasscodeDisabled,tabId:o})}})),(0,a.iw)("clearPasscode",(e=>((0,st.C8)(),(0,p.Kn)(e)))),(0,a.iw)("unlockScreen",((e,t,n)=>{const s=Object.values(e.byTabId),{sessionJson:o,globalJson:i}=n,r=JSON.parse(o);(0,at.wX)(r,r.userId);const c=e;(e=JSON.parse(i)).byTabId=c.byTabId,(0,ot.nE)(e,(0,g.Xh)(it.g9)),e=(0,p.vu)(e,{isScreenLocked:!1,error:void 0,invalidAttemptsCount:0}),(0,a.R3)(e),(0,P.Z6)(),s.forEach((e=>{let{id:n,isMasterTab:a}=e;return t.init({tabId:n,isMasterTab:a})})),t.initApi()})),(0,a.iw)("decryptSession",((e,t,n)=>{const{passcode:a}=n;(0,st.so)(a).then(t.unlockScreen,(()=>{t.logInvalidUnlockAttempt()}))})),(0,a.iw)("logInvalidUnlockAttempt",(e=>{var t;const n=(null!==(t=e.passcode?.invalidAttemptsCount)&&void 0!==t?t:0)+1;return(0,p.vu)(e,{invalidAttemptsCount:n,timeoutUntil:n>=5?Date.now()+15e3:void 0})})),(0,a.iw)("resetInvalidUnlockAttempts",(e=>(0,p.vu)(e,{invalidAttemptsCount:0,timeoutUntil:void 0}))),(0,a.iw)("setPasscodeError",((e,t,n)=>{const{error:a}=n;return(0,p.vu)(e,{error:a})})),(0,a.iw)("clearPasscodeError",(e=>(0,p.vu)(e,{error:void 0}))),(0,a.iw)("skipLockOnUnload",(()=>{rt=!0})),(0,a.iw)("openChat",((e,t,n)=>{const{id:a,tabId:s=(0,P._w)()}=n;return a?(0,Z.i)(e,{reactionPicker:{chatId:a,messageId:void 0,position:void 0}},s):(0,Z.i)(e,{reactionPicker:void 0},s)})),(0,a.iw)("openReactionPicker",((e,t,n)=>{const{chatId:a,messageId:s,position:o,tabId:i=(0,P._w)()}=n;return(0,Z.i)(e,{reactionPicker:{chatId:a,messageId:s,position:o}},i)})),(0,a.iw)("closeReactionPicker",((e,t,n)=>{const{tabId:a=(0,P._w)()}=n||{},s=(0,f.jU)(e,a);return(0,Z.i)(e,{reactionPicker:{...s.reactionPicker,messageId:void 0,position:void 0}},a)})),n(28304),(0,a.iw)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"updateChat":{const{isForum:s,lastReadOutboxMessageId:o}=(0,f.Z1)(e,n.id)||{};return n.chat.lastReadOutboxMessageId&&o&&n.chat.lastReadOutboxMessageId<o&&(n={...n,chat:(0,g.CE)(n.chat,["lastReadInboxMessageId"])}),e=(0,p.a4)(e,n.id,n.chat,n.newProfilePhoto),(0,a.R3)(e),n.noTopChatsRequest||(0,f.N)(e,n.id)||t.loadTopChats(),n.chat.id&&(0,C.Vr)({chatId:n.chat.id,lastReadInboxMessageId:n.chat.lastReadInboxMessageId}),void Object.values(e.byTabId).forEach((a=>{let{id:o}=a;const{chatId:i}=(0,f.Bt)(e,o)||{},r=n;i===r.id&&"isForum"in r.chat&&s!==r.chat.isForum&&(s&&t.closeForumPanel({tabId:o}),t.openChat({id:i,tabId:o}))}))}case"updateChatJoin":{const s=(0,f.Ek)(e,n.id);if(!s)return;e=(0,p.B1)(e,s,[n.id]),e=(0,p.a4)(e,n.id,{isNotJoined:!1}),(0,a.R3)(e);const o=(0,f.Z1)(e,n.id);return void(o&&t.requestChatUpdate({chatId:o.id}))}case"updateChatLeave":return(0,p.Dd)(e,n.id);case"updateChatInbox":return(0,p.a4)(e,n.id,n.chat);case"updateChatTypingStatus":{const{id:t,threadId:s=u._f,typingStatus:o}=n;return e=(0,p.pf)(e,t,s,"typingStatus",o),(0,a.R3)(e),void setTimeout((()=>{e=(0,a.Rd)();const n=(0,f.WP)(e,t,s,"typingStatus");o&&n&&o.timestamp===n.timestamp&&(e=(0,p.pf)(e,t,s,"typingStatus",void 0),(0,a.R3)(e))}),6e3)}case"newMessage":{const{message:t}=n;if(t.senderId===e.currentUserId&&!t.isFromScheduled)return;const s=(0,f.Z1)(e,n.chatId);if(!s)return;const o=Boolean(n.message.id&&n.message.hasUnreadMention);return e=(0,p.a4)(e,n.chatId,{unreadCount:s.unreadCount?s.unreadCount+1:1,...o&&{unreadMentionsCount:(s.unreadMentionsCount||0)+1}}),o&&(e=(0,p.a4)(e,n.chatId,{unreadMentions:[...s.unreadMentions||[],n.message.id]})),(0,a.R3)(e),void(0,C.rh)({chat:s,message:t})}case"updateCommonBoxMessages":case"updateChannelMessages":{const{ids:t,messageUpdate:a}=n;if(!1!==a.hasUnreadMention)return;return t.forEach((t=>{const a="channelId"in n?n.channelId:(0,f.X5)(e,t),s=(0,f.Z1)(e,a);s?.unreadReactionsCount&&(e=j(e,a,{unreadReactionsCount:s.unreadReactionsCount-1||void 0,unreadReactions:s.unreadReactions?.filter((e=>e!==t))})),s?.unreadMentionsCount&&(e=(0,p.a4)(e,a,{unreadMentionsCount:s.unreadMentionsCount-1||void 0,unreadMentions:s.unreadMentions?.filter((e=>e!==t))}))})),e}case"updateChatFullInfo":return(0,p.US)(e,n.id,n.fullInfo);case"updatePinnedChatIds":{const{ids:t,folderId:a}=n,s=a===o.WSp?"archived":"active";return{...e,chats:{...e.chats,orderedPinnedIds:{...e.chats.orderedPinnedIds,[s]:t.length?t:void 0}}}}case"updateChatPinned":{const{id:t,isPinned:a}=n,s=(0,f.Ek)(e,t);if(!s)return;const{[s]:i}=e.chats.orderedPinnedIds;let r=i||[];if(a){if(!r.includes(t)){if("active"===s&&r.length>=o.EGK){const t=e.chats.listIds.active;r=r.filter((e=>t&&t.includes(e)))}r=[t,...r]}}else r=r.filter((e=>e!==t));return{...e,chats:{...e.chats,orderedPinnedIds:{...e.chats.orderedPinnedIds,[s]:r.length?r:void 0}}}}case"updateChatListType":{const{id:t,folderId:a}=n;return(0,p.Pi)(e,t,a)}case"updateChatFolder":{const{id:t,folder:a}=n,{byId:s,orderedIds:o}=e.chatFolders,i=void 0===a;Object.values(e.byTabId).forEach((n=>{let{id:a}=n;const o=(0,f.jU)(e,a);Object.values(s)[o.activeChatFolder-1]?.id===t&&(e=(0,Z.i)(e,{activeChatFolder:0},a))}));const r=i?(0,g.CE)(s,[t]):{...s,[t]:a},c=i?o?.filter((e=>e!==t)):o?.includes(t)?o:[...o||[],t];return{...e,chatFolders:{...e.chatFolders,byId:r,orderedIds:c,invites:(0,g.CE)(e.chatFolders.invites,[t])}}}case"updateChatFoldersOrder":{const{orderedIds:t}=n;return{...e,chatFolders:{...e.chatFolders,orderedIds:t}}}case"updateRecommendedChatFolders":{const{folders:t}=n;return{...e,chatFolders:{...e.chatFolders,recommended:t}}}case"updateChatMembers":{const t=(0,f.x6)(e,n.id),{replacedMembers:a,addedMember:s,deletedMemberId:o}=n;if(!t)return;let i=!1,r=t?.members?[...t.members]:[];if(a)r=a,i=!0;else if(s)r.length&&r.some((e=>e.userId===s.userId))||(r.push(s),i=!0);else if(r.length&&o){const e=r.findIndex((e=>e.userId===o));e>-1&&(r.slice(e,1),i=!0)}if(i){const t=r.filter((e=>{let{isOwner:t,isAdmin:n}=e;return t||n}));return e=(0,p.a4)(e,n.id,{membersCount:r.length}),e=(0,p.US)(e,n.id,{members:r,adminMembersById:(0,g.ee)(t,"userId")})}return}case"deleteProfilePhotos":{const{chatId:t,ids:a}=n,s=e.chats.byId[t];return s?.photos?(0,p.a4)(e,t,{photos:s.photos.filter((e=>!a.includes(e.id)))}):void 0}case"draftMessage":{const{chatId:t,formattedText:a,date:s,replyingToId:o,threadId:i}=n;if(!e.chats.byId[t])return;return e=(0,p.pf)(e,t,i||u._f,"draft",a),e=(0,p.pf)(e,t,i||u._f,"replyingToId",o),e=(0,p.a4)(e,t,{draftDate:s})}case"showInvite":{const{data:a}=n;return void Object.values(e.byTabId).forEach((e=>{let{id:n}=e;t.showDialog({data:a,tabId:n})}))}case"updatePendingJoinRequests":{const{chatId:s,requestsPending:o,recentRequesterIds:i}=n;if(!e.chats.byId[s])return;return e=(0,p.US)(e,s,{requestsPending:o,recentRequesterIds:i}),(0,a.R3)(e),void t.loadChatJoinRequests({chatId:s})}case"updatePinnedTopic":{const{chatId:t,topicId:s,isPinned:o}=n;if(!e.chats.byId[t])return;return e=(0,p.Cn)(e,t,s,{isPinned:o}),void(0,a.R3)(e)}case"updatePinnedTopicsOrder":{const{chatId:t,order:s}=n;if(!e.chats.byId[t])return;return e=(0,p.a4)(e,t,{orderedPinnedTopicIds:s}),void(0,a.R3)(e)}case"updateTopic":{const{chatId:a,topicId:s}=n;if(!(0,f.Z1)(e,a)?.isForum)return;return void t.loadTopicById({chatId:a,topicId:s})}case"updateTopics":{const{chatId:a}=n;if(!(0,f.Z1)(e,a)?.isForum)return;return void t.loadTopics({chatId:a,force:!0})}}}));const ct=(0,I.P2)((function(){let e=(0,a.Rd)();e=(0,p.ps)(e,{...e.users.statusesById,...dt}),(0,a.R3)(e),dt={}}),3e3,!0);let dt={};(0,a.iw)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"deleteContact":return(0,p.GK)(e,n.id);case"updateUser":return Object.values(e.byTabId).forEach((a=>{let{id:s}=a;n.id===e.currentUserId&&n.user.isPremium!==(0,f.wV)(e)&&(n.user.isPremium&&t.openPremiumModal({isSuccess:!0,tabId:s}),e={...e,translations:{byChatId:{}}})})),e=(0,p.Nq)(e,n.id,n.user),n.fullInfo&&(e=(0,p.ap)(e,n.id,n.fullInfo)),e;case"updateRequestUserUpdate":t.loadFullUser({userId:n.id});break;case"updateUserEmojiStatus":return(0,p.Nq)(e,n.userId,{emojiStatus:n.emojiStatus});case"updateUserStatus":return a=n.userId,s=n.status,dt[a]=s,void ct();case"updateUserFullInfo":{const{id:t,fullInfo:a}=n;return(0,p.ap)(e,t,a)}case"updateBotMenuButton":{const{botId:t,button:a}=n,s=(0,f.iF)(e,t);if(!s?.botInfo)return;return(0,p.ap)(e,t,{botInfo:{...s.botInfo,menuButton:a}})}}var a,s})),(0,a.iw)("apiUpdate",((e,t,n)=>{if("updateStickerSet"===n["@type"])return(0,p.Rg)(e,n.id,n.stickerSet)})),(0,a.iw)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"updatePeerBlocked":return n.isBlocked?(0,p.O4)(e,n.id):(0,p.rB)(e,n.id);case"updateResetContactList":e={...e,contactList:{userIds:[]}},(0,a.R3)(e);break;case"updateConfig":t.loadConfig();break;case"updateFavoriteStickers":t.loadFavoriteStickers();break;case"updateRecentStickers":t.loadRecentStickers();break;case"updateRecentReactions":t.loadRecentReactions();break;case"updateRecentEmojiStatuses":t.loadRecentEmojiStatuses();break;case"updateMoveStickerSetToTop":{const a=n.isCustomEmoji?e.customEmojis.added.setIds:e.stickers.added.setIds;if(!a)return e;const s=[n.id,...a.filter((e=>e!==n.id))];t.reorderStickerSets({order:s,isCustomEmoji:n.isCustomEmoji});break}case"updateStickerSets":t.loadStickerSets();break;case"updateStickerSetsOrder":{const a=n.order.filter((t=>Boolean(e.stickers.setsById[t])));t.reorderStickerSets({order:a,isCustomEmoji:n.isCustomEmoji});break}case"updateSavedGifs":t.loadSavedGifs();break;case"updatePrivacy":e={...e,settings:{...e.settings,privacy:{...e.settings.privacy,[n.key]:n.rules}}},(0,a.R3)(e);break;case"updatePaymentVerificationNeeded":Object.values(e.byTabId).forEach((t=>{let{id:a}=t;e=(0,p.fS)(e,n.url,a),e=(0,p.Q$)(e,m.KB.ConfirmPayment,a)})),(0,a.R3)(e);break;case"updateWebViewResultSent":Object.values(e.byTabId).forEach((e=>{e.webApp?.queryId===n.queryId&&(t.setReplyingToId({messageId:void 0,tabId:e.id}),t.closeWebApp({tabId:e.id}))}))}})),(0,a.iw)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"updateNotifySettings":return(0,p.HN)(e,n.peerType,n.isSilent,n.shouldShowPreviews);case"updateNotifyExceptions":{const{chatId:t,isMuted:s,isSilent:o,shouldShowPreviews:i}=n;e.chats.byId[t]&&(e=(0,p.a4)(e,t,{isMuted:s})),e=(0,p.aK)(e,t,{isMuted:s,isSilent:o,shouldShowPreviews:i}),(0,a.R3)(e);break}case"updateTopicNotifyExceptions":{const{chatId:t,topicId:s,isMuted:o}=n;e=(0,p.Cn)(e,t,s,{isMuted:o}),(0,a.R3)(e);break}}})),(0,a.iw)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"updateTwoFaStateWaitCode":return{...e,twoFaSettings:{...e.twoFaSettings,isLoading:!1,waitingEmailCodeLength:n.length}};case"updateTwoFaError":return{...e,twoFaSettings:{...e.twoFaSettings,error:n.message}}}}));var lt=n(78958),ut=n(42431);(0,a.iw)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"updateGroupCall":{if("discarded"===n.call.connectionState)return e.groupCalls.activeGroupCallId?void("leaveGroupCall"in t&&t.leaveGroupCall({shouldRemove:!0,tabId:(0,P._w)()})):(0,lt.dc)(e,n.call.id);const a=(0,ut.$5)(e,n.call.id),s=a?.chatId;return s&&(e=(0,p.a4)(e,s,{isCallNotEmpty:a.participantsCount>0||Boolean(a.participants?.length)})),(0,lt.AH)(e,n.call.id,(0,g.CE)(n.call,["connectionState"]),void 0,n.call.participantsCount)}case"updateGroupCallChatId":return(0,f.Z1)(e,n.chatId)&&(e=(0,p.US)(e,n.chatId,{groupCallId:n.call.id})),e;case"updateGroupCallParticipants":{const{groupCallId:t,participants:s,nextOffset:o}=n,{currentUserId:i}=e;e=(0,a.Rd)(),s.forEach((n=>{n.id&&(e=(0,lt.B6)(e,t,n.id,n,Boolean(o)||i===n.id))})),o&&(e=(0,lt.AH)(e,t,{nextOffset:o}));const r=(0,ut.$5)(e,t),c=r?.chatId;return c&&(e=(0,p.a4)(e,c,{isCallNotEmpty:r.participantsCount>0||Boolean(r.participants?.length)})),e}case"updatePhoneCall":{if(!s.Bi)return;const{phoneCall:o,currentUserId:i}=e,{call:r}=n;if(o)return"discarded"===r.state?(t.playGroupCallSound({sound:"end"}),"hangUp"in t&&t.hangUp({tabId:(0,P._w)()}),{...e,...r.needRating&&{ratingPhoneCall:r}}):void 0;if(r?.adminId!==i&&"requested"===r.state)return(0,I.R3)((()=>{e=(0,a.Rd)(),(0,C.TO)({call:r,user:(0,ut.fu)(e)})})),(0,nt.EP)(),(0,nt.CW)(e,t,r.isVideo,(0,P._w)()),e={...e,phoneCall:r},(0,Z.i)(e,{isCallPanelVisible:!1},(0,P._w)())}}}));var mt=n(9937);(0,a.iw)("apiUpdate",((e,t,n)=>{"updatePaymentStateCompleted"===n["@type"]&&Object.values(e.byTabId).forEach((a=>{let{id:o}=a;const{inputInvoice:i}=(0,f.jU)(e,o).payment;if(i&&"chatId"in i&&"messageId"in i){const n=(0,f.hj)(e,i.chatId,i.messageId);if(n&&n.content.invoice){const{amount:e,currency:a,title:s}=n.content.invoice;t.showNotification({tabId:o,message:w.Iu("PaymentInfoHint",[(0,mt.x)(e,a,w.QO().code),s])})}}s.Xp||(e=(0,p.WY)(e,o)),n.slug&&i&&"slug"in i&&i.slug!==n.slug||(e=(0,Z.i)(e,{payment:{...(0,f.jU)(e,o).payment,status:"paid"}},o))}))}));var ht=n(46752),gt=n(1279),pt=n(53551),ft=n(99203),It=n(25190),vt=n(45332);function wt(e){const t=(0,It.Z)(e);(0,i.d4)((()=>(0,I.Gq)(t)),[t])}var bt=n(34446);const Zt=document.querySelector('meta[name="viewport"]'),Pt=Zt?.getAttribute("content")||"",yt="width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover";function Ct(e){e.preventDefault()}var Et=n(65326),St=n(31212),Mt=n(18674),Rt=n(62357),kt=n(36413),Tt=n(28183),At=n(60706),Nt=n(48778);const xt=e=>{const{isOpen:t}=e,n=(0,Nt.Z)(ft.gl.Extra,"StickerSetModal",!t);return n?i.ZP.createElement(n,e):void 0};var Bt=n(2155),Lt=n(95616),Ut=n(17358);const jt=(0,i.X$)((e=>{let{isForAppBadge:t}=e;(0,Lt.yi)();const n=(0,ge.xW)();if((0,i.d4)((()=>{t&&(0,Ut.w)(n)}),[t,n]),!t&&n)return i.ZP.createElement("div",{className:"unread-count active"},(0,Bt.bi)(n))}));var Ot=n(23989),Ft=n(53455),_t=n(73541),Dt=n(2255),qt=n(59107),$t=n(54416),Ht=n(706);let Gt=function(e){return e[e.waitingForNetwork=0]="waitingForNetwork",e[e.syncing=1]="syncing",e[e.online=2]="online",e}({});function Vt(e,t,n,a,s,o){let r,c,d;return r=function(){const[e,t]=(0,i.eJ)(window.navigator.onLine);return(0,i.d4)((()=>{function e(){t(window.navigator.onLine)}return window.addEventListener("online",e),window.addEventListener("offline",e),()=>{window.removeEventListener("offline",e),window.removeEventListener("online",e)}}),[]),e}()&&"connectionStateConnecting"!==t?n?Gt.syncing:Gt.online:Gt.waitingForNetwork,c=r===Gt.online||o?"none":a?"middleHeader":s?"minimized":"overlay",r===Gt.waitingForNetwork?d=e("WaitingForNetwork"):r===Gt.syncing&&(d=e("Updating")),"middleHeader"===c&&(d=d.toLowerCase().replace(/\.+$/,"")),{connectionStatus:r,connectionStatusPosition:c,connectionStatusText:d}}var Wt=n(36046),zt=n(73217),Yt=n(97458),Jt=n(53106),Kt=n(58964),Xt=n(231),Qt=n(69589),en=n(49187),tn=n(83321),nn=n(40126),an=n(49204);const sn=(0,i.X$)((e=>{let{connectionStatus:t,connectionStatusText:n,onClick:a}=e;const s=(0,qt.Z)();return i.ZP.createElement("div",{id:"ConnectionStatusOverlay",dir:s.isRtl?"rtl":void 0,onClick:a},i.ZP.createElement(an.Z,{color:"black"}),i.ZP.createElement("div",{className:"state-text"},i.ZP.createElement(Dt.Z,{activeKey:t,name:"slideFade"},n)),i.ZP.createElement(Xt.Z,{round:!0,size:"tiny",color:"translucent-black"},i.ZP.createElement("span",{className:"icon icon-close"})))}));var on=n(274),rn=n(96459),cn=n(4863),dn=n(6202);const ln="HO3tML0GAC9vTH28baKB",un=(0,i.X$)((e=>{let{reaction:t,isLottie:n,className:a}=e;const o=(0,v.RK)(t.documentId),r=(0,dn.Z)(n?void 0:o),c=(0,i.Ye)((()=>s._G?Array.from({length:7}).map((()=>function(){const e=(10+60*Math.random())*(Math.random()>.5?1:-1),t=20+80*Math.random();return`M 0 0 C 0 0 ${e} ${-t-20} ${e} ${t}`}())):[]),[]);if(r||n)return i.ZP.createElement("div",{className:(0,ht.Z)("HAg4STRlxDV3frYuABYr",a)},c.map((e=>{const a=`--offset-path: path('${e}');`;return n?i.ZP.createElement(rn.Z,{documentId:t.documentId,className:ln,style:a,withSharedAnimation:!0}):i.ZP.createElement("img",{src:r,alt:"",className:ln,style:a})})))})),mn=e=>{const{isOpen:t}=e,n=(0,Nt.Z)(ft.gl.Extra,"StatusPickerMenu",!t);return n?i.ZP.createElement(n,e):void 0},hn=(0,i.X$)((0,a.c$)((e=>{const{currentUserId:t}=e;return{emojiStatus:(t?(0,f.dy)(e,t):void 0)?.emojiStatus}}))((e=>{let{emojiStatus:t}=e;const{setEmojiStatus:n,loadCurrentUser:s}=(0,a.Sv)(),r=(0,i.sO)(null),[c,d,l]=(0,At.Z)(!1),[u,m,h]=(0,At.Z)(!1),[g,p,f]=(0,At.Z)(!1),{isMobile:I}=(0,B.ZP)(),v=t?.until?1e3*t.until-Date.now()+1e3*(0,Ie.Qj)():void 0;(0,Tt.Z)(s,v),(0,on.Z)((e=>{let[n]=e;c&&t&&n&&t.documentId!==n.documentId&&(m(),l())}),[t,c,m,l]);const w=(0,i.I4)((e=>{d(),n({emojiStatus:e})}),[d,n]);(0,Tt.Z)(h,u?1500:void 0);const b=(0,i.I4)((()=>{p()}),[p]);return i.ZP.createElement("div",{className:"extra-spacing"},Boolean(u&&t)&&i.ZP.createElement(un,{reaction:t,isLottie:!0,className:"emoji-status-effect"}),i.ZP.createElement(Xt.Z,{round:!0,ref:r,ripple:!I,size:"smaller",color:"translucent",className:"emoji-status",onClick:b},t?i.ZP.createElement(rn.Z,{key:t.documentId,documentId:t.documentId,size:24,loopLimit:o.y3O}):i.ZP.createElement(cn.Z,null)),i.ZP.createElement(mn,{statusButtonRef:r,isOpen:g,onEmojiStatusSelect:w,onClose:f}))})));var gn=n(79994);const pn={date:void 0},fn={id:void 0},In=(0,i.X$)((0,a.c$)((e=>{const t=(0,f.jU)(e),{query:n,fetchingStatus:a,chatId:s,date:o}=t.globalSearch,{currentUserId:i,connectionState:r,isSyncing:c,archiveSettings:d}=e,{isConnectionStatusMinimized:l,animationLevel:u}=e.settings.byKey;return{searchQuery:n,isLoading:!!a&&Boolean(a.chats||a.messages),currentUserId:i,globalSearchChatId:s,searchDate:o,theme:(0,f.Pu)(e),animationLevel:u,connectionState:r,isSyncing:c,isMessageListOpen:Boolean((0,f.Bt)(e)),isConnectionStatusMinimized:l,isCurrentUserPremium:(0,f.wV)(e),areChatsLoaded:Boolean(e.chats.listIds.active),hasPasscode:Boolean(e.passcode.hasPasscode),canInstall:Boolean(t.canInstall),archiveSettings:d,canSetPasscode:(0,f.eB)(e)}}))((e=>{let{shouldHideSearch:t,content:n,contactsFilter:r,onSearchQuery:c,isClosingSearch:d,onSelectSettings:l,onSelectContacts:u,onSelectArchived:h,onReset:g,searchQuery:p,isLoading:f,isCurrentUserPremium:I,shouldSkipTransition:v,currentUserId:w,globalSearchChatId:b,searchDate:Z,theme:P,animationLevel:y,connectionState:C,isSyncing:E,isMessageListOpen:S,isConnectionStatusMinimized:M,areChatsLoaded:R,hasPasscode:k,canSetPasscode:T,canInstall:A,archiveSettings:N}=e;const{openChat:x,setGlobalSearchDate:L,setSettingOption:U,setGlobalSearchChatId:j,openChatByUsername:O,lockScreen:F,requestNextSettingsScreen:_,skipLockOnUnload:D,openUrl:q,updatePerformanceSettings:$}=(0,a.Sv)(),H=(0,qt.Z)(),{isMobile:G}=(0,B.ZP)(),V=n===m.du.ChatList,W=(0,i.Ye)((()=>Z?(0,de.xH)(new Date(1e3*Z)):void 0),[Z]),z=(0,Lt.yi)()[o.WSp]?.chatsCount||0,{connectionStatus:Y,connectionStatusText:J,connectionStatusPosition:K}=Vt(H,C,E,S,M,!R),X=(0,It.Z)((e=>{e.preventDefault(),e.stopPropagation(),k?F():_({screen:m.MT.PasscodeDisabled})}));(0,_t.y)(T?{"Ctrl+Shift+L":X,"Alt+Shift+L":X,"Meta+Shift+L":X,...s.RM&&{"Mod+L":X}}:void 0);const Q=window.location.hostname===o.xHY||o.Cgt,ee=(0,i.Ye)((()=>e=>{let{onTrigger:t,isOpen:n}=e;return i.ZP.createElement(Xt.Z,{round:!0,ripple:V&&!G,size:"smaller",color:"translucent",className:n?"active":"",onClick:V?t:()=>g(),ariaLabel:V?H("AccDescrOpenMenu2"):"Return to chat list"},i.ZP.createElement("div",{className:(0,ht.Z)("animated-menu-icon",!V&&"state-back",v&&"no-animation")}))}),[V,G,H,g,v]),te=(0,It.Z)((()=>{p||c("")})),ne=(0,It.Z)((()=>{U({isConnectionStatusMinimized:!M})})),ae=(0,It.Z)((()=>{x({id:w,shouldReplaceHistory:!0})})),se=(0,It.Z)((e=>{e.stopPropagation(),U({theme:"light"===P?"dark":"light"}),U({shouldUseSystemTheme:!1})})),oe=(0,It.Z)((e=>{e.stopPropagation();let t=y+1;t>o.zy8&&(t=o.oBh);const n=t===o.oBh?it.ww:t===o.zy8?it.WD:it.LN;U({animationLevel:t}),$(n)})),ie=(0,It.Z)((()=>{window.open(o.ulW,"_blank","noopener")})),re=(0,It.Z)((()=>{localStorage.setItem("kz_version",JSON.stringify("K")),(0,Ht.W8)(),D()})),ce=(0,It.Z)((()=>{O({username:H("Settings.TipsUsername")})})),le=(0,It.Z)((()=>{q({url:o.mUA})})),ue=(0,It.Z)((()=>{F()})),me=Boolean(b)||n===m.du.GlobalSearch||n===m.du.Contacts;(0,i.d4)((()=>me?(0,Ot.Z)((()=>g())):void 0),[me,g]);const he=n===m.du.Contacts?H("SearchFriends"):H("Search"),ge=o.Tjg?"1.61.36 Beta (master)":o.eMD?"master":"1.61.36",pe=y!==o.oBh?y===o.zy8?"max":"mid":"min",fe=(0,kt.Ar)(),{shouldDisableDropdownMenuTransitionRef:Ie,handleDropdownMenuTransitionEnd:ve}=(0,zt.Z)(t),we=(0,i.sO)(null);(0,Yt.Z)(we);const be=(0,i.Ye)((()=>i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement(Kt.Z,{icon:"saved-messages",onClick:ae},H("SavedMessages")),N.isHidden&&i.ZP.createElement(Kt.Z,{icon:"archive",onClick:h},i.ZP.createElement("span",{className:"menu-item-name"},H("ArchivedChats")),z>0&&i.ZP.createElement("div",{className:"right-badge"},z)),i.ZP.createElement(Kt.Z,{icon:"user",onClick:u},H("Contacts")),i.ZP.createElement(Kt.Z,{icon:"settings",onClick:l},H("Settings")),i.ZP.createElement(Kt.Z,{icon:"darkmode",onClick:se},i.ZP.createElement("span",{className:"menu-item-name"},H("lng_menu_night_mode")),i.ZP.createElement(tn.Z,{id:"darkmode",label:H("dark"===P?"lng_settings_disable_night_theme":"lng_settings_enable_night_theme"),checked:"dark"===P,noAnimation:!0})),i.ZP.createElement(Kt.Z,{icon:"animations",onClick:oe},i.ZP.createElement("span",{className:"menu-item-name capitalize"},H("Appearance.Animations").toLowerCase()),i.ZP.createElement(gn.Z,{value:pe})),i.ZP.createElement(Kt.Z,{icon:"help",onClick:ce},H("TelegramFeatures")),i.ZP.createElement(Kt.Z,{icon:"bug",onClick:le},"Report Bug"),o.Tjg&&i.ZP.createElement(Kt.Z,{icon:"permissions",onClick:ie},"Beta Changelog"),Q&&i.ZP.createElement(Kt.Z,{icon:"K",isCharIcon:!0,href:"https://web.telegram.org/k/",onClick:re},"Switch to K Version"),A&&i.ZP.createElement(Kt.Z,{icon:"install",onClick:(0,Wt.G)()},"Install App"))),[pe,z,A,oe,le,H,ie,se,ce,ae,re,h,u,l,P,Q,N]),Ze=(0,i.Ye)((()=>i.ZP.createElement(i.ZP.Fragment,null,W&&i.ZP.createElement(en.Z,{icon:"calendar",title:W,canClose:!0,isMinimized:Boolean(b),className:"search-date",onClick:L,clickArg:pn}),b&&i.ZP.createElement(en.Z,{chatOrUserId:b,onClick:j,canClose:!0,clickArg:fn}))),[b,W]);return i.ZP.createElement("div",{className:"LeftMainHeader"},i.ZP.createElement("div",{id:"LeftMainHeader",className:"left-header",ref:we},H.isRtl&&i.ZP.createElement("div",{className:"DropdownMenuFiller"}),i.ZP.createElement(Jt.Z,{trigger:ee,footer:`${o.iCi} ${ge}`,className:(0,ht.Z)("main-menu",H.isRtl&&"rtl",t&&H.isRtl&&"right-aligned",Ie.current&&H.isRtl&&"disable-transition"),positionX:t&&H.isRtl?"right":"left",transformOriginX:o.D$V&&s.jm&&!fe?90:void 0,onTransitionEnd:H.isRtl?ve:void 0},be),i.ZP.createElement(Qt.Z,{inputId:"telegram-search-input",parentContainerClassName:"LeftSearch",className:(0,ht.Z)(b||Z?"with-picker-item":void 0,t&&"SearchInput--hidden"),value:d?void 0:r||p,focused:me,isLoading:f||"minimized"===K,spinnerColor:"minimized"===K?"yellow":void 0,spinnerBackgroundColor:"minimized"===K&&"light"===P?"light":void 0,placeholder:he,autoComplete:"off",canClose:Boolean(b||Z),onChange:c,onReset:g,onFocus:te,onSpinnerClick:"minimized"===K?ne:void 0},Ze),I&&i.ZP.createElement(hn,null),k&&i.ZP.createElement(Xt.Z,{round:!0,ripple:!G,size:"smaller",color:"translucent",ariaLabel:`${H("ShortcutsController.Others.LockByPasscode")} (Ctrl+Shift+L)`,onClick:ue,className:(0,ht.Z)(!I&&"extra-spacing")},i.ZP.createElement("i",{className:"icon icon-lock"})),i.ZP.createElement(nn.Z,{isOpen:"overlay"===K,isCustom:!0,className:"connection-state-wrapper"},i.ZP.createElement(sn,{connectionStatus:Y,connectionStatusText:J,onClick:ne}))))})));var vn=n(64963),wn=n(46590),bn=n(31711),Zn=n(64034);const Pn=(0,i.X$)((0,a.c$)((e=>{const{chatFolders:{byId:t,orderedIds:n,invites:a},chats:{listIds:{archived:s}},currentUserId:o,archiveSettings:i}=e,{shouldSkipHistoryAnimations:r,activeChatFolder:c}=(0,f.jU)(e);return{chatFoldersById:t,folderInvitesById:a,orderedFolderIds:n,activeChatFolder:c,currentUserId:o,shouldSkipHistoryAnimations:r,hasArchivedChats:Boolean(s?.length),maxFolders:(0,se.M)(e,"dialogFilters"),maxFolderInvites:(0,se.M)(e,"chatlistInvites"),maxChatLists:(0,se.M)(e,"chatlistJoined"),archiveSettings:i}}))((e=>{let{foldersDispatch:t,onSettingsScreenSelect:n,onLeftColumnContentChange:r,chatFoldersById:c,orderedFolderIds:d,activeChatFolder:l,currentUserId:u,isForumPanelOpen:m,shouldSkipHistoryAnimations:h,maxFolders:g,maxChatLists:p,shouldHideFolderTabs:I,folderInvitesById:v,maxFolderInvites:w,hasArchivedChats:b,archiveSettings:Z}=e;const{loadChatFolders:P,setActiveChatFolder:y,openChat:C,openShareChatFolderModal:E,openDeleteChatFolderModal:S,openEditChatFolder:M,openLimitReachedModal:R}=(0,a.Sv)(),k=(0,i.sO)(null),T=(0,qt.Z)();(0,i.d4)((()=>{P()}),[]);const A=(0,i.Ye)((()=>({id:o.NfV,title:d?.[0]===o.NfV?T("FilterAllChatsShort"):T("FilterAllChats"),includedChatIds:je.D,excludedChatIds:je.D})),[d,T]),N=(0,i.Ye)((()=>d?d.map((e=>e===o.NfV?A:c[e]||{})).filter(Boolean):void 0),[c,A,d]),x=N?.findIndex((e=>e.id===o.NfV)),B=x===l,L=0===l,U=(0,Lt.yi)(),j=(0,i.Ye)((()=>{if(N&&N.length)return N.map(((e,t)=>{const{id:n,title:s}=e,i=n!==o.NfV&&t>g-1,r=[];return(0,f.yE)((0,a.Rd)(),n)&&r.push({title:T("ChatList.ContextMenuShare"),icon:"link",handler:()=>{Object.values(c).reduce(((e,t)=>e+(t.isChatList?1:0)),0)>=p&&!e.isChatList?R({limit:"chatlistJoined"}):v[n]?.length>=w?R({limit:"chatlistInvites"}):E({folderId:n})}}),n!==o.NfV&&(r.push({title:T("FilterEdit"),icon:"edit",handler:()=>{M({folderId:n})}}),r.push({title:T("FilterDeleteItem"),icon:"delete",destructive:!0,handler:()=>{S({folderId:n})}})),{id:n,title:s,badgeCount:U[n]?.chatsCount,isBadgeActive:Boolean(U[n]?.notificationsCount),isBlocked:i,contextActions:r?.length?r:void 0}}))}),[N,g,U,T,c,p,v,w]),O=(0,It.Z)((e=>{y({activeChatFolder:e},{forceOnHeavyAnimation:!0})}));(0,i.d4)((()=>{j?.length&&l>=j.length&&y({activeChatFolder:0})}),[l,j,y]),(0,i.d4)((()=>{if(s.$b&&j?.length&&!m)return(0,vn.sf)(k.current,{selectorToPreventScroll:".chat-list",onSwipe:(e,t)=>t===vn.eM.Left?(y({activeChatFolder:Math.min(l+1,j.length-1)},{forceOnHeavyAnimation:!0}),!0):t===vn.eM.Right&&(y({activeChatFolder:Math.max(0,l-1)},{forceOnHeavyAnimation:!0}),!0)})}),[l,j,m,y]);const F=(0,i.sO)();F.current=!L,(0,i.d4)((()=>F.current?(0,Ot.Z)((()=>{F.current&&y({activeChatFolder:0})})):void 0),[l,y]),(0,wn.Z)({isActive:!L,onBack:()=>y({activeChatFolder:0},{forceOnHeavyAnimation:!0})}),(0,i.d4)((()=>{const e=e=>{if(e.ctrlKey&&e.shiftKey&&e.code.startsWith("Digit")&&j){const[,t]=e.code.match(/Digit(\d)/)||[];if(!t)return;if("0"===t)return void C({id:u,shouldReplaceHistory:!0});const n=Number(t)-1;if(n>j.length-1)return;y({activeChatFolder:n},{forceOnHeavyAnimation:!0}),e.preventDefault()}};return document.addEventListener("keydown",e,!0),()=>{document.removeEventListener("keydown",e,!0)}}),[u,j,C,y]);const{shouldRender:_,transitionClassNames:D}=(0,St.Z)(!d,void 0,!0);function q(e){const a=Object.values(c).find((e=>{let{id:t}=e;return t===j[l].id})),s=a&&!B;return i.ZP.createElement(Zn.Z,{folderType:s?"folder":"all",folderId:s?a.id:void 0,isActive:e,isForumPanelOpen:m,foldersDispatch:t,onSettingsScreenSelect:n,onLeftColumnContentChange:r,canDisplayArchive:b&&!Z.isHidden,archiveSettings:Z})}const $=j&&j.length>1;return i.ZP.createElement("div",{className:(0,ht.Z)("ChatFolders",$&&I&&"ChatFolders--tabs-hidden")},$?i.ZP.createElement(bn.Z,{contextRootElementSelector:"#LeftColumn",tabs:j,activeTab:l,onSwitchTab:O,areFolders:!0}):_?i.ZP.createElement("div",{className:(0,ht.Z)("tabs-placeholder",D)}):void 0,i.ZP.createElement(Dt.Z,{ref:k,name:h?"none":T.isRtl?"slideOptimizedRtl":"slideOptimized",activeKey:l,renderCount:$?j.length:void 0},q))})));var yn=n(34288);const Cn=e=>{const t=(0,Nt.Z)(ft.gl.Extra,"LeftSearch");return t?i.ZP.createElement(t,e):i.ZP.createElement(yn.Z,null)},En=e=>{const t=(0,Nt.Z)(ft.gl.Extra,"ContactList");return t?i.ZP.createElement(t,e):i.ZP.createElement(yn.Z,null)};var Sn=n(52328);const Mn=e=>{let{isShown:t,onNewPrivateChat:n,onNewChannel:a,onNewGroup:s}=e;const[o,r]=(0,i.eJ)(!1);(0,i.d4)((()=>{t||r(!1)}),[t]);const c=(0,qt.Z)(),d=(0,ht.Z)("NewChatButton",t&&"revealed",o&&"menu-is-open"),l=(0,i.I4)((()=>{r(!o)}),[o]),u=(0,i.I4)((()=>{r(!1)}),[]),m=(0,i.Ye)((()=>i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement(Kt.Z,{icon:"channel",onClick:a},c("NewChannel")),i.ZP.createElement(Kt.Z,{icon:"group",onClick:s},c("NewGroup")),i.ZP.createElement(Kt.Z,{icon:"user",onClick:n},c("NewMessageTitle")))),[c,a,s,n]);return i.ZP.createElement("div",{className:d,dir:c.isRtl?"rtl":void 0},i.ZP.createElement(Xt.Z,{round:!0,color:"primary",className:o?"active":"",onClick:l,ariaLabel:c(o?"Close":"NewMessageTitle"),tabIndex:-1},i.ZP.createElement("i",{className:"icon icon-new-chat-filled"}),i.ZP.createElement("i",{className:"icon icon-close"})),i.ZP.createElement(Sn.Z,{isOpen:o,positionX:c.isRtl?"left":"right",positionY:"bottom",autoClose:!0,onClose:u},m))};var Rn=n(59690);const kn=Object.keys(m.du).length/2;let Tn;const An=(0,i.X$)((e=>{let{content:t,searchQuery:n,searchDate:r,isClosingSearch:c,contactsFilter:d,shouldSkipTransition:l,foldersDispatch:u,isUpdateAvailable:h,isForumPanelOpen:g,onSearchQuery:p,onContentChange:f,onSettingsScreenSelect:I,onReset:v,onTopicSearch:w}=e;const{closeForumPanel:b}=(0,a.Sv)(),[Z,P]=(0,i.eJ)(s.$b),{shouldRenderForumPanel:y,handleForumPanelAnimationEnd:C,handleForumPanelAnimationStart:E,isAnimationStarted:S}=(0,$t.Z)(g),M=g&&t===m.du.ChatList,R=M&&S,{shouldRender:k,transitionClassNames:T}=(0,St.Z)(h),A=(0,i.sO)(!1),N=(0,It.Z)((()=>{t===m.du.ChatList&&(A.current=!0,P(!0))})),x=(0,It.Z)((()=>{A.current=!1,Tn&&(clearTimeout(Tn),Tn=void 0),Tn=window.setTimeout((()=>{A.current||P(!1)}),250)})),B=(0,It.Z)((()=>{f(m.du.Settings)})),L=(0,It.Z)((()=>{f(m.du.Contacts)})),U=(0,It.Z)((()=>{f(m.du.Archived),b()})),j=(0,It.Z)((()=>{o.D$V?window.electron?.installUpdate():window.location.reload()})),O=(0,It.Z)((()=>{f(m.du.NewChannelStep1)})),F=(0,It.Z)((()=>{f(m.du.NewGroupStep1)}));(0,i.d4)((()=>{let e;return t!==m.du.ChatList?e=window.setTimeout((()=>{P(!1)}),250):(A.current||s.$b)&&P(!0),()=>{e&&(clearTimeout(e),e=void 0)}}),[t]);const _=(0,qt.Z)();return i.ZP.createElement("div",{id:"LeftColumn-main",onMouseEnter:s.$b?void 0:N,onMouseLeave:s.$b?void 0:x},i.ZP.createElement(In,{shouldHideSearch:R,content:t,contactsFilter:d,onSearchQuery:p,onSelectSettings:B,onSelectContacts:L,onSelectArchived:U,onReset:v,shouldSkipTransition:l,isClosingSearch:c}),i.ZP.createElement(Dt.Z,{name:l?"none":"zoomFade",renderCount:kn,activeKey:t,shouldCleanup:!0,cleanupExceptionKey:m.du.ChatList,shouldWrap:!0,wrapExceptionKey:m.du.ChatList},(e=>{switch(t){case m.du.ChatList:return i.ZP.createElement(Pn,{shouldHideFolderTabs:R,onSettingsScreenSelect:I,onLeftColumnContentChange:f,foldersDispatch:u,isForumPanelOpen:R});case m.du.GlobalSearch:return i.ZP.createElement(Cn,{searchQuery:n,searchDate:r,isActive:e,onReset:v});case m.du.Contacts:return i.ZP.createElement(En,{filter:d,isActive:e,onReset:v});default:return}})),k&&i.ZP.createElement(Xt.Z,{fluid:!0,pill:!0,className:(0,ht.Z)("btn-update",T),onClick:j},_("lng_update_telegram")),y&&i.ZP.createElement(Rn.Z,{isOpen:g,isHidden:!M,onTopicSearch:w,onOpenAnimationStart:E,onCloseAnimationEnd:C}),i.ZP.createElement(Mn,{isShown:Z,onNewPrivateChat:L,onNewChannel:O,onNewGroup:F}))})),Nn=e=>{const t=(0,Nt.Z)(ft.gl.Extra,"Settings");return t?i.ZP.createElement(t,e):i.ZP.createElement(yn.Z,null)},xn=e=>{const t=(0,Nt.Z)(ft.gl.Extra,"NewChat");return t?i.ZP.createElement(t,e):i.ZP.createElement(yn.Z,null)},Bn=e=>{const t=(0,Nt.Z)(ft.gl.Extra,"ArchivedChats");return t?i.ZP.createElement(t,e):i.ZP.createElement(yn.Z,null)};var Ln=function(e){return e[e.Main=0]="Main",e[e.Settings=1]="Settings",e[e.Archived=2]="Archived",e[e.NewGroup=3]="NewGroup",e[e.NewChannel=4]="NewChannel",e}(Ln||{});const Un=Object.keys(Ln).length/2,jn=(0,i.X$)((0,a.c$)((e=>{const t=(0,f.jU)(e),{globalSearch:{query:n,date:a},shouldSkipHistoryAnimations:s,activeChatFolder:o,nextSettingsScreen:i,nextFoldersAction:r}=t,{currentUserId:c,passcode:{hasPasscode:d},isUpdateAvailable:l,archiveSettings:u}=e,m=(0,f.jr)(e);return{searchQuery:n,searchDate:a,isFirstChatFolderActive:0===o,shouldSkipHistoryAnimations:s,currentUserId:c,hasPasscode:d,nextSettingsScreen:i,nextFoldersAction:r,isChatOpen:Boolean(m?.id),isUpdateAvailable:l,isForumPanelOpen:(0,f.nd)(e),forumPanelChatId:t.forumPanelChatId,isClosingSearch:t.globalSearch.isClosing,archiveSettings:u}}))((function(e){let{ref:t,searchQuery:n,searchDate:o,isFirstChatFolderActive:r,shouldSkipHistoryAnimations:c,currentUserId:d,hasPasscode:l,nextSettingsScreen:u,nextFoldersAction:h,isChatOpen:g,isUpdateAvailable:p,isForumPanelOpen:f,forumPanelChatId:I,isClosingSearch:v,archiveSettings:w}=e;const{setGlobalSearchQuery:b,setGlobalSearchClosing:Z,setGlobalSearchChatId:P,resetChatCreation:y,setGlobalSearchDate:C,loadPasswordInfo:E,clearTwoFaError:S,openChat:M,requestNextSettingsScreen:R}=(0,a.Sv)(),[k,T]=(0,i.eJ)(m.du.ChatList),[A,N]=(0,i.eJ)(m.MT.Main),[x,B]=(0,i.eJ)(""),[L,U]=(0,Ft.ZP)(),[j,O]=(0,i.eJ)(0);let F=Ln.Main;switch(k){case m.du.Archived:F=Ln.Archived;break;case m.du.Settings:F=Ln.Settings;break;case m.du.NewChannelStep1:case m.du.NewChannelStep2:F=Ln.NewChannel;break;case m.du.NewGroupStep1:case m.du.NewGroupStep2:F=Ln.NewGroup}const _=(0,It.Z)((e=>{function t(){T(m.du.ChatList),N(m.MT.Main),B(""),Z({isClosing:!0}),y(),setTimeout((()=>{b({query:""}),C({date:void 0}),P({id:void 0}),Z({isClosing:!1}),O(Date.now())}),250)}if(!0!==e)if(k!==m.du.NewGroupStep2)if(k!==m.du.NewChannelStep2){if(k===m.du.NewGroupStep1){const e=document.getElementById("new-group-picker-search");e&&e.blur()}if(k===m.du.Settings)switch(A){case m.MT.EditProfile:case m.MT.Folders:case m.MT.General:case m.MT.Notifications:case m.MT.DataStorage:case m.MT.Privacy:case m.MT.Performance:case m.MT.ActiveSessions:case m.MT.Language:case m.MT.Stickers:case m.MT.Experimental:return void N(m.MT.Main);case m.MT.GeneralChatBackground:return void N(m.MT.General);case m.MT.GeneralChatBackgroundColor:return void N(m.MT.GeneralChatBackground);case m.MT.PrivacyPhoneNumber:case m.MT.PrivacyLastSeen:case m.MT.PrivacyProfilePhoto:case m.MT.PrivacyPhoneCall:case m.MT.PrivacyPhoneP2P:case m.MT.PrivacyForwarding:case m.MT.PrivacyGroupChats:case m.MT.PrivacyVoiceMessages:case m.MT.PrivacyBlockedUsers:case m.MT.ActiveWebsites:case m.MT.TwoFaDisabled:case m.MT.TwoFaEnabled:case m.MT.TwoFaCongratulations:case m.MT.PasscodeDisabled:case m.MT.PasscodeEnabled:case m.MT.PasscodeCongratulations:return void N(m.MT.Privacy);case m.MT.PasscodeNewPasscode:return void N(l?m.MT.PasscodeEnabled:m.MT.PasscodeDisabled);case m.MT.PasscodeChangePasscodeCurrent:case m.MT.PasscodeTurnOff:return void N(m.MT.PasscodeEnabled);case m.MT.PasscodeNewPasscodeConfirm:return void N(m.MT.PasscodeNewPasscode);case m.MT.PasscodeChangePasscodeNew:return void N(m.MT.PasscodeChangePasscodeCurrent);case m.MT.PasscodeChangePasscodeConfirm:return void N(m.MT.PasscodeChangePasscodeNew);case m.MT.PrivacyPhoneNumberAllowedContacts:case m.MT.PrivacyPhoneNumberDeniedContacts:return void N(m.MT.PrivacyPhoneNumber);case m.MT.PrivacyLastSeenAllowedContacts:case m.MT.PrivacyLastSeenDeniedContacts:return void N(m.MT.PrivacyLastSeen);case m.MT.PrivacyProfilePhotoAllowedContacts:case m.MT.PrivacyProfilePhotoDeniedContacts:return void N(m.MT.PrivacyProfilePhoto);case m.MT.PrivacyPhoneCallAllowedContacts:case m.MT.PrivacyPhoneCallDeniedContacts:return void N(m.MT.PrivacyPhoneCall);case m.MT.PrivacyPhoneP2PAllowedContacts:case m.MT.PrivacyPhoneP2PDeniedContacts:return void N(m.MT.PrivacyPhoneP2P);case m.MT.PrivacyForwardingAllowedContacts:case m.MT.PrivacyForwardingDeniedContacts:return void N(m.MT.PrivacyForwarding);case m.MT.PrivacyVoiceMessagesAllowedContacts:case m.MT.PrivacyVoiceMessagesDeniedContacts:return void N(m.MT.PrivacyVoiceMessages);case m.MT.PrivacyGroupChatsAllowedContacts:case m.MT.PrivacyGroupChatsDeniedContacts:return void N(m.MT.PrivacyGroupChats);case m.MT.TwoFaNewPassword:return void N(m.MT.TwoFaDisabled);case m.MT.TwoFaNewPasswordConfirm:return void N(m.MT.TwoFaNewPassword);case m.MT.TwoFaNewPasswordHint:return void N(m.MT.TwoFaNewPasswordConfirm);case m.MT.TwoFaNewPasswordEmail:return void N(m.MT.TwoFaNewPasswordHint);case m.MT.TwoFaNewPasswordEmailCode:return void N(m.MT.TwoFaNewPasswordEmail);case m.MT.TwoFaChangePasswordCurrent:case m.MT.TwoFaTurnOff:case m.MT.TwoFaRecoveryEmailCurrentPassword:return void N(m.MT.TwoFaEnabled);case m.MT.TwoFaChangePasswordNew:return void N(m.MT.TwoFaChangePasswordCurrent);case m.MT.TwoFaChangePasswordConfirm:return void N(m.MT.TwoFaChangePasswordNew);case m.MT.TwoFaChangePasswordHint:return void N(m.MT.TwoFaChangePasswordConfirm);case m.MT.TwoFaRecoveryEmail:return void N(m.MT.TwoFaRecoveryEmailCurrentPassword);case m.MT.TwoFaRecoveryEmailCode:return void N(m.MT.TwoFaRecoveryEmail);case m.MT.FoldersCreateFolder:case m.MT.FoldersEditFolder:return void N(m.MT.Folders);case m.MT.FoldersShare:return void N(m.MT.FoldersEditFolder);case m.MT.FoldersIncludedChatsFromChatList:case m.MT.FoldersExcludedChatsFromChatList:return void N(m.MT.FoldersEditFolderFromChatList);case m.MT.FoldersEditFolderFromChatList:case m.MT.FoldersEditFolderInvites:return T(m.du.ChatList),void N(m.MT.Main);case m.MT.QuickReaction:case m.MT.CustomEmoji:return void N(m.MT.Stickers);case m.MT.DoNotTranslate:return void N(m.MT.Language)}k===m.du.ChatList&&r?T(m.du.GlobalSearch):t()}else T(m.du.NewChannelStep1);else T(m.du.NewGroupStep1);else t()})),D=(0,It.Z)((e=>{k!==m.du.Contacts?(T(m.du.GlobalSearch),e!==n&&b({query:e})):B(e)})),q=(0,It.Z)((()=>{T(m.du.GlobalSearch),b({query:""}),P({id:I})}));(0,i.d4)((()=>{const e=k===m.du.Archived,t=k===m.du.ChatList,n=!g&&!f;return e&&n||!t&&!e||r&&n?(0,Ot.Z)((()=>{_()})):void 0}),[r,k,_,g,f]);const $=(0,It.Z)((e=>{k!==m.du.GlobalSearch&&(e.preventDefault(),T(m.du.GlobalSearch))})),H=(0,It.Z)((e=>{e.preventDefault(),M({id:d,shouldReplaceHistory:!0})})),G=(0,It.Z)((e=>{e.preventDefault(),T(m.du.Archived)})),V=(0,It.Z)((e=>{e.preventDefault(),T(m.du.Settings)}));(0,_t.y)({"Mod+Shift+F":$,"Mod+Shift+S":H,...s.RM&&{"Mod+0":H,"Mod+9":G},...s.jm&&s.RM&&{"Mod+,":V}}),(0,i.d4)((()=>{S(),A===m.MT.Privacy&&E()}),[S,E,A]),(0,bt.Z)((()=>{void 0!==u&&(T(m.du.Settings),N(u),R({screen:void 0})),h&&U(h)}),[U,h,u,R]);const W=(0,It.Z)((e=>{T(m.du.Settings),N(e)}));function z(e){switch(F){case Ln.Archived:return i.ZP.createElement(Bn,{isActive:e,onReset:_,onTopicSearch:q,foldersDispatch:U,onSettingsScreenSelect:W,onLeftColumnContentChange:T,isForumPanelOpen:f,archiveSettings:w});case Ln.Settings:return i.ZP.createElement(Nn,{isActive:e,currentScreen:A,foldersState:L,foldersDispatch:U,onScreenSelect:W,onReset:_,shouldSkipTransition:c});case Ln.NewChannel:return i.ZP.createElement(xn,{key:j,isActive:e,isChannel:!0,content:k,onContentChange:T,onReset:_});case Ln.NewGroup:return i.ZP.createElement(xn,{key:j,isActive:e,content:k,onContentChange:T,onReset:_});default:return i.ZP.createElement(An,{content:k,isClosingSearch:v,searchQuery:n,searchDate:o,contactsFilter:x,foldersDispatch:U,onContentChange:T,onSearchQuery:D,onSettingsScreenSelect:W,onReset:_,shouldSkipTransition:c,isUpdateAvailable:p,isForumPanelOpen:f,onTopicSearch:q})}}return i.ZP.createElement(Dt.Z,{ref:t,name:c?"none":s.s0,renderCount:Un,activeKey:F,shouldCleanup:!0,cleanupExceptionKey:Ln.Main,shouldWrap:!0,wrapExceptionKey:Ln.Main,id:"LeftColumn"},z)})));var On=n(12420),Fn=n(80036),_n=n(49524),Dn=n(71394);var qn=n(12255),$n=n(52678),Hn=n(87204),Gn=n(28712),Vn=n(3570),Wn=n(33799),zn=n(39415),Yn=n(75790),Jn=n(18360),Kn=n(86203),Xn=n(6058),Qn=n(98799),ea=n(59188),ta=n(32340),na=n(2903),aa=n(17891),sa=n(68512),oa=n(17551);const ia={"pinned-message-border":"II9Qj_b_XQlgwGAOoy7u",pinnedMessageBorder:"II9Qj_b_XQlgwGAOoy7u","pinned-message-border-wrapper-1":"QpNjYZM0KJrGrocs69__",pinnedMessageBorderWrapper1:"QpNjYZM0KJrGrocs69__","pinned-message-border-wrapper":"sNpxwL0ihB0aXnfphNmp",pinnedMessageBorderWrapper:"sNpxwL0ihB0aXnfphNmp","pinned-message-border-mark":"YX_iyQuDtga6uKXRQqR0",pinnedMessageBorderMark:"YX_iyQuDtga6uKXRQqR0"};function ra(e,t,n,a,s){return`M${e},${t+s}a${s},${s},0,0,1,\n ${n},0v${a-2*s}a${s},${s},0,0,1,${-n},0Z`}const ca=(0,i.X$)((e=>{let{count:t,index:n}=e;const a=(0,i.sO)(null),s=(0,i.Ye)((()=>function(e,t){const n=e-t-1,a=function(e){let t=8;return 1===e?t=36:2===e?t=17:3===e?t=11:(4===e||e>3)&&(t=7.5),t}(e),s=function(e,t){let n=36;return 1===e?n=36:2===e?n=17:3===e?n=1===t?12:11:(4===e||e>3)&&(n=7.5),n}(e,n),o=function(e,t){return e<=3?36:t*e+2*(e-1)}(e,a),i=`clipPath${e}`,r=function(e,t,n){let a="";if(3===n)a=ra(0,0,2,t,1)+ra(0,12,2,t+1,1)+ra(0,25,2,t,1);else for(let e=0;e<n;e++)a+=ra(0,(t+2)*e,2,t,1);return`<clipPath id="${e}">\n <path d="${a}" />\n </clipPath>`}(i,a,e),c=function(e,t,n){return 1===n?0:2===n?0===e?0:t+2:3===n?0===e?0:1===e?12:25:(t+2)*e}(n,a,e),d=function(e,t,n,a){return t<=4||e<=1?0:e>=t-2?a-36:(n+4)/2+(e-2)*(n+2)}(n,e,a,o);return{markHeight:s,clipPath:r,markTranslateY:c,trackTranslateY:d,trackHeight:o,clipPathId:i}}(t,n)),[t,n]);if((0,i.bt)((()=>{if(!a.current)return;const{trackHeight:e,trackTranslateY:t,markHeight:n,markTranslateY:o,clipPathId:i,clipPath:r}=s,c=a.current.firstElementChild;if(a?.current){const s=a.current,{style:d}=s;d.height=`${e}px`,d.transform=`translateY(-${t}px)`,d.clipPath=`url("#${i}")`;const l=s.querySelector("svg"),u=s.querySelector("div"),m=s.querySelector("defs");l||c&&(c.innerHTML=`<svg height="0" width="0"><defs> ${r} </defs></svg>`),m&&(m.innerHTML=r),u&&(u.style.height=`${n}px`,u.style.transform=`translateY(${o}px)`)}}),[s]),1===t)return i.ZP.createElement("div",{className:ia.pinnedMessageBorder},i.ZP.createElement("div",{className:ia.pinnedMessageBorderWrapper1,ref:a}));const{trackHeight:o,trackTranslateY:r,markHeight:c,markTranslateY:d,clipPathId:l}=s;return i.ZP.createElement("div",{className:(0,ht.Z)(ia.pinnedMessageBorder,t>4&&ia.pinnedMessageBorderMask)},i.ZP.createElement("div",{className:ia.pinnedMessageBorderWrapper,ref:a,style:`clip-path: url("#${l}"); width: 2px;\n height: ${o}px; transform: translateY(-${r}px);`},i.ZP.createElement("span",null),i.ZP.createElement("div",{className:ia.pinnedMessageBorderMark,style:`--height: ${c}px; --translate-y: ${d}px; --translate-track: ${r}px;`})))}));var da=n(45370),la=n(62230),ua=n(34076);const ma="DusHAy2Lx0SlaPpVAb_o",ha="jSVbc8Hb7PjitJujB_dQ",ga=1.125*E.Gw,pa=(0,i.X$)((e=>{let{message:t,count:n,index:o,customTitle:r,className:c,onUnpinMessage:d,onClick:l,onAllPinnedClick:u,isLoading:m,isFullWidth:h}=e;const{clickBotInlineButton:g}=(0,a.Sv)(),p=(0,qt.Z)(),f=(0,na.Z)(t),I=(0,dn.Z)((0,v.Ti)(t,"pictogram")),w=(0,v.NE)(t),b=(0,aa.Z)([m],450)&&m,[Z,P,y]=(0,At.Z)(),C=(0,It.Z)((()=>{y(),d&&d(t.id)})),S=(0,v.eH)(t),M=(0,It.Z)((()=>{S&&g({messageId:t.id,button:S})})),[R,k,T]=(0,At.Z)(),{handleClick:A,handleMouseDown:N}=(0,zn.m)(l);return i.ZP.createElement("div",{className:(0,ht.Z)("HeaderPinnedMessageWrapper","TMOjo7XfD1ZiiuRtfpkm",h&&"full-width",c)},(n>1||b)&&i.ZP.createElement(Xt.Z,{round:!0,size:"smaller",color:"translucent",ariaLabel:p("EventLogFilterPinnedMessages"),onClick:b?void 0:u},m&&i.ZP.createElement(an.Z,{color:"blue",className:(0,ht.Z)("d7XDT4Keip1KHh7mcCv9",ma,!b&&ha)}),i.ZP.createElement("i",{className:(0,ht.Z)("icon","icon-pin-list",ma,b&&ha)})),d&&i.ZP.createElement(Xt.Z,{round:!0,size:"smaller",color:"translucent",ariaLabel:p("UnpinMessageAlertTitle"),onClick:P},i.ZP.createElement("i",{className:"icon icon-close"})),i.ZP.createElement(oa.Z,{isOpen:Z,onClose:y,text:"Would you like to unpin this message?",confirmLabel:"Unpin",confirmHandler:C}),i.ZP.createElement("div",{className:(0,ht.Z)("uhn_g6FmUELuGJrCm45w",R&&"jeTsUEkDCkzGUVwy6lrL"),onClick:A,onMouseDown:N,dir:p.isRtl?"rtl":void 0},i.ZP.createElement(ca,{count:n,index:o}),i.ZP.createElement(Dt.Z,{activeKey:t.id,name:"slideVertical",className:"EK6juGhJwhsLLm4Aag2F"},function(e,t,n){const{width:a,height:s}=(0,E.W7)(),o=t||e;return i.ZP.createElement("div",{className:"RFnmHP92f6CwfuR2Upaw"},e&&!n&&i.ZP.createElement("img",{className:"JfPOYkOcaMjS7Y5rsHZ4",src:o,width:a,height:s,alt:""}),e&&i.ZP.createElement(la.Z,{thumbDataUri:o,isVisible:Boolean(n),width:a,height:s}))}(f,I,w)),i.ZP.createElement("div",{className:(0,ht.Z)("bSvmca5kaTIUh3yJBxnF",f&&"FBCNFm307_rxATSHPSiN")},i.ZP.createElement("div",{className:"q9_FnsHlndM1hZqZjxjM",dir:"auto"},!r&&i.ZP.createElement(ua.Z,{text:`${p("PinnedMessage")} ${o>0?"#"+(n-o):""}`}),r&&(0,ta.Z)(r)),i.ZP.createElement(Dt.Z,{activeKey:t.id,name:"slideVerticalFade",className:"ugsKEK4Xb166oFMP8hHy"},i.ZP.createElement("p",{dir:"auto",className:"WRuyhyQK6mv28Mz8iK28"},i.ZP.createElement(da.Z,{lang:p,message:t,noEmoji:Boolean(f),emojiSize:ga})))),i.ZP.createElement(sa.Z,null),S&&i.ZP.createElement(Xt.Z,{size:"tiny",className:"kXRuktM2s7UN91zOl0Tx",onClick:M,shouldStopPropagation:!0,onMouseEnter:s.$b?void 0:k,onMouseLeave:s.$b?void 0:T},S.text)))}));var fa=n(10396),Ia=n(64532),va=n(23186),wa=n(75851);const ba=240;function Za(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"image/png";const a=e instanceof Blob?URL.createObjectURL(e):e,s=new Image;return new Promise((o=>{s.onload=()=>{Pa(s,s.width*t,s.height*t,n).then((e=>{if(!e)throw new Error("Image resize failed!");return URL.createObjectURL(e)})).then(o).finally((()=>{e instanceof Blob&&URL.revokeObjectURL(a)}))},s.src=a}))}async function Pa(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"image/png";if(!("createImageBitmap"in window))return ya(e,t,n,void 0,a);try{const s=await window.createImageBitmap(e,{resizeWidth:t,resizeHeight:n,resizeQuality:"high"});if(s.height!==n||s.width!==t)throw new Error("Image bitmap resize not supported!");const o=await(0,wa.ix)(e.src),i=(0,wa.rZ)(o)<ba?"#fff":"#000";return await new Promise((e=>{const t=document.createElement("canvas");t.width=s.width,t.height=s.height;const n=t.getContext("2d");n.fillStyle=i,n.fillRect(0,0,t.width,t.height);const o=t.getContext("bitmaprenderer");o?o.transferFromImageBitmap(s):n.drawImage(s,0,0),t.toBlob(e,a)}))}catch(s){return ya(e,t,n,void 0,a)}}async function ya(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.5,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"image/png";const o=document.createElement("canvas"),i=o.getContext("2d"),r=document.createElement("canvas"),c=r.getContext("2d");if(o.width=t,o.height=n,e.width*a>t){const n=1/a;let s={width:Math.floor(e.width*a),height:Math.floor(e.height*a)};for(r.width=s.width,r.height=s.height,c.drawImage(e,0,0,s.width,s.height);s.width*a>t;)s={width:Math.floor(s.width*a),height:Math.floor(s.height*a)},c.drawImage(r,0,0,s.width*n,s.height*n,0,0,s.width,s.height);i.drawImage(r,0,0,s.width,s.height,0,0,o.width,o.height)}else i.drawImage(e,0,0,o.width,o.height);const d=await(0,wa.ix)(e.src),l=(0,wa.rZ)(d)<ba?"#fff":"#000";return i.fillStyle=l,i.globalCompositeOperation="destination-over",i.fillRect(0,0,o.width,o.height),new Promise((e=>{o.toBlob(e,s)}))}var Ca=n(77510);const Ea=n.p+"telegram-logo-filled.67469f6dc5e301e8e0bd.svg",Sa={width:200,height:200},Ma=115;var Ra=n(17240),ka=n(18051);const Ta={.5:.66,.75:.8,1:1,1.5:1.4,2:1.8},Aa=Object.keys(Ta).sort().map(Number),Na=(0,a.c$)(((e,t)=>{let{message:n}=t;const a=(0,f.Ur)(e,n),s=(0,f.Z1)(e,n.chatId),{volume:o,playbackRate:i,isMuted:r,isPlaybackRateActive:c}=(0,f.jU)(e).audioPlayer;return{sender:a,chat:s,volume:o,playbackRate:i,isPlaybackRateActive:c,isMuted:r}}))((e=>{let{message:t,className:n,noUi:r,sender:c,chat:d,volume:l,playbackRate:u,isPlaybackRateActive:m,isMuted:h}=e;const{setAudioPlayerVolume:g,setAudioPlayerPlaybackRate:p,setAudioPlayerMuted:f,focusMessage:I,closeAudioPlayer:w}=(0,a.Sv)(),b=(0,i.sO)(null),Z=(0,qt.Z)(),{isMobile:P}=(0,B.ZP)(),{audio:y,voice:C,video:S}=(0,v.qp)(t),M=Boolean(C||S),R=M||(y?.duration||0)>o.J0S,k=c?(0,v.OU)(Z,c):void 0,T=Le.UV((0,v.Ti)(t,"inline")),A=((e,t,n)=>{const a=(0,qt.Z)(),{audio:s,voice:o}=(0,v.qp)(e),r=s?s.title||s.fileName:o?"Voice message":"",c=s?.performer||t&&(0,v.OU)(a,t),d=n&&(0,v.U)(a,n)||"Telegram",l=s&&(0,v.MR)(s)&&(0,v.Ti)(e,"pictogram"),u=t&&(0,v.RT)(t,"big"),m=s&&l||o&&u,h=(0,dn.Z)(m),g=(0,i.Ye)((()=>function(e,t,n){if(!n)return Sa;if(e){if(!e.thumbnailSizes?.length)return;const t=e.thumbnailSizes.find((e=>"m"===e.type));return t||e.thumbnailSizes[0]}return t?E.vY:void 0}(s,o,h)),[s,h,o]),{result:p}=(0,Ca.Z)((()=>function(e,t){if(!e)return Promise.resolve(Ea);if(!t)return function(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"image/png";const s=e instanceof Blob?URL.createObjectURL(e):e,o=new Image;return new Promise((i=>{o.onload=()=>{Pa(o,t,n,a).then((e=>{if(!e)throw new Error("Image resize failed!");return URL.createObjectURL(e)})).then(i).finally((()=>{e instanceof Blob&&URL.revokeObjectURL(s)}))},o.src=s}))}(e,Ma,Ma);const n=Math.min(t.width,t.height);return n<Ma?Za(e,Ma/n):Promise.resolve(e)}(h,g)),[h,g],Ea);return(0,i.Ye)((()=>(0,Ia.Of)({title:r,artist:c,album:d,artwork:[{src:p}]})),[d,c,r,p])})(t,c,d),{playPause:N,stop:x,isPlaying:L,requestNextTrack:U,requestPreviousTrack:j,isFirst:O,isLast:F,setVolume:_,toggleMuted:D,setPlaybackRate:q}=(0,va.Z)((0,fa.An)(t),(0,v.XV)(t),M?"voice":"audio",T,void 0,A,void 0,!0,void 0,void 0,(0,v.CI)(t),!0),{isContextMenuOpen:$,handleBeforeContextMenu:H,handleContextMenu:G,handleContextMenuClose:V,handleContextMenuHide:W}=(0,Ra.Z)(b),z=(0,It.Z)((()=>{I({chatId:t.chatId,messageId:t.id})})),Y=(0,It.Z)((()=>{L&&N(),w(),(0,Ia.Ay)(),x()})),J=(0,It.Z)((e=>{g({volume:e/100}),_(e/100)})),K=(0,It.Z)((()=>{s.$b&&!s.cj||(D(),f({isMuted:!h}))})),X=(0,It.Z)((function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const n=Ta[e],a=1!==e&&t;p({playbackRate:n,isPlaybackRateActive:a}),q(a?n:1)})),Q=(0,It.Z)((()=>{V();const e=Number(Object.entries(Ta).find((e=>{let[,t]=e;return t===u}))?.[0])||1,t=!m;X(t&&1===e?2:e,t)})),ee=(0,It.Z)((()=>{const e=Object.entries(Ta).find((e=>{let[,t]=e;return t===u}))?.[0]||1,t=`${1===u?2:e}Х`;return i.ZP.createElement("div",{className:"playback-wrapper"},$&&i.ZP.createElement("div",{className:"playback-backdrop",onClick:V}),i.ZP.createElement(Xt.Z,{round:!0,className:(0,ht.Z)("playback-button",m&&"applied",$&&"on-top"),color:"translucent",size:"smaller",ariaLabel:"Playback Rate",ripple:!P,onMouseEnter:G,onClick:Q,onMouseDown:H,onContextMenu:G},i.ZP.createElement("span",{className:(0,ht.Z)("playback-button-inner",4===t.length&&"small",5===t.length&&"tiny")},t)))})),te=(0,i.Ye)((()=>0===l||h?"icon-muted":l<.3?"icon-volume-1":l<.6?"icon-volume-2":"icon-volume-3"),[l,h]);if(!r)return i.ZP.createElement("div",{className:(0,ht.Z)("AudioPlayer",n),dir:Z.isRtl?"rtl":void 0,ref:b},i.ZP.createElement("div",{className:"AudioPlayer-content",onClick:z},y?function(e){const{title:t,performer:n,fileName:a}=e;return i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement("div",{className:"title",dir:"auto"},(0,ta.Z)(t||a)),n&&i.ZP.createElement("div",{className:"subtitle",dir:"auto"},(0,ta.Z)(n)))}(y):function(e,t){return i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement("div",{className:"title",dir:"auto"},t&&(0,ta.Z)(t)),i.ZP.createElement("div",{className:"subtitle",dir:"auto"},e))}(Z("AttachAudio"),k),i.ZP.createElement(sa.Z,null)),i.ZP.createElement(Xt.Z,{round:!0,ripple:!P,color:"translucent",size:"smaller",className:"player-button",disabled:O(),onClick:j,ariaLabel:"Previous track"},i.ZP.createElement("i",{className:"icon icon-skip-previous"})),i.ZP.createElement(Xt.Z,{round:!0,ripple:!P,color:"translucent",size:"smaller",className:(0,ht.Z)("toggle-play","player-button",L?"pause":"play"),onClick:N,ariaLabel:L?"Pause audio":"Play audio"},i.ZP.createElement("i",{className:"icon icon-play"}),i.ZP.createElement("i",{className:"icon icon-pause"})),i.ZP.createElement(Xt.Z,{round:!0,ripple:!P,color:"translucent",size:"smaller",className:"player-button",disabled:F(),onClick:U,ariaLabel:"Next track"},i.ZP.createElement("i",{className:"icon icon-skip-next"})),i.ZP.createElement("div",{className:"volume-button-wrapper"},i.ZP.createElement(Xt.Z,{round:!0,className:"player-button volume-button",color:"translucent",size:"smaller",ariaLabel:"Volume",onClick:K,ripple:!P},i.ZP.createElement("i",{className:(0,ht.Z)("icon",te)})),!s.cj&&i.ZP.createElement("div",{className:"volume-slider-wrapper"},i.ZP.createElement("div",{className:"volume-slider-spacer"}),i.ZP.createElement("div",{className:"volume-slider"},i.ZP.createElement(ka.Z,{bold:!0,value:h?0:100*l,onChange:J})))),R&&i.ZP.createElement(Jt.Z,{forceOpen:$,positionX:"right",positionY:"top",className:"playback-rate-menu",trigger:ee,onClose:V,onHide:W,onMouseEnterBackdrop:V},Aa.map((e=>function(e,t,n,a){const s=t===Ta[e]&&a||1===e&&!a;return i.ZP.createElement(Kt.Z,{key:e,onClick:()=>n(e),icon:s?"check":void 0,customIcon:s?void 0:i.ZP.createElement("i",{className:"icon icon-placeholder"})},e,"X")}(e,u,X,m)))),i.ZP.createElement(Xt.Z,{round:!0,className:"player-close",color:"translucent",size:"smaller",onClick:Y,ariaLabel:"Close player"},i.ZP.createElement("i",{className:"icon icon-close"})))}));var xa=n(4794),Ba=n(14605);const La=(0,i.X$)((0,a.c$)(((e,t)=>{let{chatId:n}=t;return{currentUserId:e.currentUserId,chat:(0,f.Z1)(e,n),user:(0,v.YC)(n)?(0,f.dy)(e,n):void 0}}))((e=>{let{chatId:t,className:n,chat:s,user:o,settings:r,currentUserId:c}=e;const{openAddContactDialog:d,blockContact:l,reportSpam:u,deleteChat:m,leaveChannel:h,deleteChatUser:g,deleteHistory:p,toggleChatArchived:f,hideChatReportPanel:I}=(0,a.Sv)(),w=(0,qt.Z)(),[b,Z,P]=(0,At.Z)(),[y,C]=(0,i.eJ)(!0),[E,S]=(0,i.eJ)(!0),{accessHash:M}=s||{},{isAutoArchived:R,canReportSpam:k,canAddContact:T,canBlockContact:A}=r||{},N=s&&(0,v.G9)(s),x=(0,It.Z)((()=>{d({userId:t}),R&&f({id:t})})),B=(0,It.Z)((()=>{P(),l({contactId:t,accessHash:M}),k&&y&&u({chatId:t}),E&&m({chatId:t})})),L=(0,It.Z)((()=>{I({chatId:t})})),U=(0,It.Z)((()=>{P(),u({chatId:t}),N?(g({chatId:t,userId:c}),p({chatId:t,shouldDeleteForAll:!1})):h({chatId:t})}));if(r&&(s||o))return i.ZP.createElement("div",{className:(0,ht.Z)("ChatReportPanel",n),dir:w.isRtl?"rtl":void 0},T&&i.ZP.createElement(Xt.Z,{isText:!0,fluid:!0,size:"tiny",className:"UserReportPanel--Button",onClick:x},w("lng_new_contact_add")),A&&i.ZP.createElement(Xt.Z,{color:"danger",isText:!0,fluid:!0,size:"tiny",className:"UserReportPanel--Button",onClick:Z},w("lng_new_contact_block")),k&&!A&&i.ZP.createElement(Xt.Z,{color:"danger",isText:!0,fluid:!0,size:"tiny",className:"UserReportPanel--Button",onClick:Z},w("lng_report_spam_and_leave")),i.ZP.createElement(Xt.Z,{round:!0,ripple:!0,size:"tiny",color:"translucent",onClick:L,ariaLabel:w("Close")},i.ZP.createElement("i",{className:"icon icon-close"})),i.ZP.createElement(oa.Z,{isOpen:b,onClose:P,title:w("BlockUserTitle",o?(0,v.Vl)(o):(0,v.U)(w,s)),text:o?w("UserInfo.BlockConfirmationTitle",(0,v.Js)(o)):w("Chat.Confirm.ReportSpam.Channel"),confirmIsDestructive:!0,confirmLabel:w("Block"),confirmHandler:o?B:U},o&&i.ZP.createElement(Ba.Z,{label:w("DeleteThisChat"),checked:E,onCheck:S}),o&&k&&i.ZP.createElement(Ba.Z,{label:w("ReportChat"),checked:y,onCheck:C})))}))),Ua=(0,i.X$)((0,a.c$)(((e,t)=>{let{chatId:n,threadId:a,messageListType:s,isMobile:o}=t;const{isLeftColumnShown:i,shouldSkipHistoryAnimations:r,audioPlayer:c,messageLists:d}=(0,f.jU)(e),l=(0,f.Z1)(e,n),{chatId:m,messageId:h}=c,g=m&&h?(0,f.hj)(e,m,h):void 0;let p;"pinned"===s?p=(0,f.KB)(e,n,a)?.length:"scheduled"===s?p=(0,f.qy)(e,n,a)?.length:"thread"===s&&a!==u._f&&(p=(0,f.tZ)(e,n,a)?.messagesCount||0);const I="thread"===s&&a===u._f,w=l&&(0,f.xo)(e,l),b=Boolean(w&&(0,f.s4)(e,n)),Z=w&&!b&&Boolean((0,f.pk)(e,n)),P=Boolean(l&&(I||l.isForum)&&((0,v.eA)(l)||(0,v.ZV)(l))&&l.isNotJoined),y=Boolean(l?.isNotJoined&&l.isJoinRequest),C={typingStatus:(0,f.WP)(e,n,a,"typingStatus"),isLeftColumnShown:i,isRightColumnShown:(0,f.Jf)(e,o),isSelectModeActive:(0,f.CA)(e),audioMessage:g,chat:l,messagesCount:p,isChatWithSelf:(0,f.FM)(e,n),shouldSkipHistoryAnimations:r,currentTransitionKey:Math.max(0,d.length-1),connectionState:e.connectionState,isSyncing:e.isSyncing,hasButtonInHeader:Z||b||P||y},E=(0,f.Zw)(e,n);if("thread"!==s||!E)return C;if(a!==u._f&&!l?.isForum){const t=(0,f.qS)(e,n,a),s=t?(0,f.hj)(e,n,t):void 0,o=s?(0,f.cv)(e,s):void 0,i=(0,f.tZ)(e,n,a);return{...C,pinnedMessageIds:t,messagesById:E,canUnpin:!1,topMessageSender:o,isComments:Boolean(i?.originChannelId)}}const S=(0,f.KB)(e,n,a);if(S?.length){const t=E[S[0]],{canUnpin:n}=t&&(0,f._k)(e,t,a)||{};return{...C,pinnedMessageIds:S,messagesById:E,canUnpin:n}}return C}))((e=>{let{chatId:t,threadId:n,messageListType:s,isReady:r,isMobile:d,pinnedMessageIds:l,messagesById:m,canUnpin:h,topMessageSender:g,typingStatus:p,isSelectModeActive:f,isLeftColumnShown:I,isRightColumnShown:w,audioMessage:b,chat:Z,messagesCount:P,isComments:y,isChatWithSelf:C,hasButtonInHeader:E,shouldSkipHistoryAnimations:S,currentTransitionKey:M,connectionState:R,isSyncing:k,getCurrentPinnedIndexes:T,getLoadingPinnedId:A,onFocusPinnedMessage:N}=e;const{openChatWithInfo:x,pinMessage:L,focusMessage:U,openChat:j,openPreviousChat:O,loadPinnedMessages:F,toggleLeftColumn:_,exitMessageSelectMode:D}=(0,a.Sv)(),q=(0,qt.Z)(),$=(0,i.sO)(!0),{isTablet:H}=(0,B.ZP)(),G=(0,Kn.Z)(T)[`${t}_${n}`]||0,V=(0,Kn.Z)(A),W=Array.isArray(l)?l[G]:l,z=m&&W?m[W]:void 0,Y=Array.isArray(l)?l.length:l?1:void 0,J=Z&&(0,v.U)(q,Z).length,K=g?(0,v.OU)(q,g):void 0,{settings:X}=Z||{},Q=Z?.isForum;(0,i.d4)((()=>{r&&(n===u._f||Q)&&F({chatId:t,threadId:n})}),[t,n,r,Q]),(0,Yn.Z)(t,W,z);const{width:ee}=(0,qn.Z)(),te=ee<=o.ksF,ne=H&&I,ae=(0,i.sO)(null),se=(0,i.sO)(!0),{handleClick:oe,handleMouseDown:ie}=(0,zn.m)((()=>{x({id:t,threadId:n})})),re=(0,It.Z)((e=>{L({messageId:e,isUnpin:!0})})),ce=(0,It.Z)((e=>{const a=e.shiftKey&&Array.isArray(l)?l[(0,Vn.Z)(l.length,l.indexOf(W)-2)]:W;N(a)&&U({chatId:t,threadId:n,messageId:a,noForumTopicPanel:!0})})),de=(0,It.Z)((()=>{j({id:t,threadId:n,type:"pinned"})})),le=(0,It.Z)((()=>{setTimeout((()=>{$.current=!0}),450)})),ue=(0,It.Z)((e=>{if($.current){if($.current=!1,d&&document.querySelector(o.Edp)?.blur(),f)return D(),void le();if("thread"===s&&0===M)return!H||ne?(e.stopPropagation(),j({id:void 0},{forceOnHeavyAnimation:!0})):_(),void le();O(),le()}})),me=ee>=o.ksF&&ee<o.jT7||ee>o.l35&&ee<o.ksF&&(!J||J>30),he=me||ee>o._mX&&ee<o.QU1,ge=Boolean(X?.canAddContact||X?.canBlockContact||X?.canReportSpam),{shouldRender:pe,transitionClassNames:fe}=(0,St.Z)(ge),Ie=(0,Jn.Z)(ge?X:void 0,!0),{shouldRender:ve,transitionClassNames:we}=(0,St.Z)(Boolean(b)),be=(0,Jn.Z)(b,!0),{shouldRender:Ze,transitionClassNames:Pe}=(0,St.Z)(Boolean(z),void 0,!0),ye=(0,Jn.Z)(z,!0),Ce=(0,Jn.Z)(Y,!0),Ee=(0,Jn.Z)(h,!0),Se=(0,Jn.Z)(K),Me=(0,Hn.Z)(M),Re=void 0!==Me&&Me<M?Me:void 0,ke=Ze&&ye||ve&&be;(0,i.bt)((()=>{const e=ae.current;if(e)return he&&ke?void(w||me?(se.current&&(e.classList.add("tools-stacked","animated"),se.current=!1),setTimeout((()=>{(0,c.WM)((()=>{e.classList.remove("animated")}))}),350)):(e.classList.remove("tools-stacked"),se.current=!0)):(e.classList.remove("tools-stacked","animated"),void(se.current=!0))}),[he,ke,me,w]);const{connectionStatusText:Te}=Vt(q,R,k,!0);function Ae(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return i.ZP.createElement("div",{className:"back-button"},i.ZP.createElement(Xt.Z,{round:!0,size:"smaller",color:"translucent",onClick:ue,ariaLabel:q(e?"Close":"Back")},i.ZP.createElement("div",{className:(0,ht.Z)("animated-close-icon",!e&&"state-back")})),t&&i.ZP.createElement(jt,null))}const Ne=Boolean(ve&&be),xe=Ne||!d&&E&&ee<o.sgm;return(0,Yt.Z)(ae),i.ZP.createElement("div",{className:"MiddleHeader",ref:ae},i.ZP.createElement(Dt.Z,{name:S?"none":"slideFade",activeKey:M,shouldCleanup:!0,cleanupExceptionKey:Re},"thread"!==s||n!==u._f&&!Z?.isForum?i.ZP.createElement(i.ZP.Fragment,null,Ae(),i.ZP.createElement("h3",null,void 0!==P?"thread"===s?q(y?"CommentsCount":"Replies",P,"i"):"pinned"===s?q("PinnedMessagesCount",P,"i"):"scheduled"===s?C?q("Reminders"):q("messages",P,"i"):void 0:q("Loading"))):i.ZP.createElement(i.ZP.Fragment,null,(te||M>0)&&Ae(ne,!0),i.ZP.createElement("div",{className:"chat-info-wrapper",onClick:oe,onMouseDown:ie},(0,v.YC)(t)?i.ZP.createElement(Xn.Z,{key:t,userId:t,typingStatus:p,status:Te,withDots:Boolean(Te),withFullInfo:!0,withMediaViewer:!0,withUpdatingStatus:!0,emojiStatusSize:22,noRtl:!0}):i.ZP.createElement(Qn.Z,{key:t,chatId:t,threadId:n,typingStatus:p,status:Te,withDots:Boolean(Te),withMediaViewer:n===u._f,withFullInfo:n===u._f,withUpdatingStatus:!0,noRtl:!0})))),n===u._f&&!Z?.isForum&&i.ZP.createElement(xa.Z,{hasPinnedOffset:Ze&&Boolean(ye)||ve&&Boolean(be),chatId:t}),Ze&&ye&&i.ZP.createElement(pa,{key:t,message:ye,count:Ce||0,index:G,customTitle:Se,className:Pe,onUnpinMessage:Ee?re:void 0,onClick:ce,onAllPinnedClick:de,isLoading:void 0!==V,isFullWidth:xe}),pe&&i.ZP.createElement(La,{key:t,chatId:t,settings:Ie,className:fe}),i.ZP.createElement("div",{className:"header-tools"},Ne&&i.ZP.createElement(Na,{key:(0,v.Tp)(be),message:be,className:we}),i.ZP.createElement(ea.Z,{chatId:t,threadId:n,messageListType:s,isMobile:d,canExpandActions:!Ne})))})));function ja(e){return"albumId"in e}function Oa(e,t){let n,a=[],s={originalDate:e[0].date,datetime:(0,de._F)(1e3*e[0].date),senderGroups:[a]};const o=[s];return e.forEach(((i,r)=>{i.isInAlbum?n?(n.messages.push(i),i.content.text&&(n.mainMessage=i)):n={albumId:i.groupedId,messages:[i],mainMessage:i}:a.push(i);const c=e[r+1];if(!n||c&&c.groupedId&&c.groupedId===n.albumId||(a.push(n),n=void 0),c){const e=(0,de._F)(1e3*c.date);s.datetime!==e?(s={originalDate:c.date,datetime:e,senderGroups:[]},o.push(s),a=[],s.senderGroups.push(a)):(c.id===t||i.senderId!==c.senderId||i.isOutgoing!==c.isOutgoing||(0,v.FT)(i)&&!i.content.action?.phoneCall||(0,v.FT)(c)&&!c.content.action?.phoneCall||i.forwardInfo&&c.forwardInfo&&(i.forwardInfo.senderUserId!==c.forwardInfo.senderUserId||i.forwardInfo.fromChatId!==c.forwardInfo.fromChatId||i.forwardInfo.hiddenUserName!==c.forwardInfo.hiddenUserName)||i.inlineButtons||c.inlineButtons||c.date-i.date>600)&&(a=[],s.senderGroups.push(a))}})),o}var Fa=n(30386),_a=n(87675),Da=n(81740),qa=n(70971),$a=n(88957);var Ha=n(60998);var Ga=n(72645),Va=n(78722),Wa=n(3657),za=n(93862),Ya=n(11309);const Ja=s.wZ?1e3:350,Ka=20*E.Gw,Xa=12*E.Gw,Qa=5*E.Gw;function es(e,t){var n;return(null!==(n=e?.length)&&void 0!==n?n:0)>40||t?Ka:Xa}function ts(e,t,n,a){const s=(0,v.B4)(e),o=(0,v.O$)(e)||(0,v.F$)(e),i=(0,v.b7)(e),r=Boolean((0,v.F$)(e)),c=Boolean((0,v.Cg)(e)),{width:d,height:l}=o?(0,E.Eh)(o,s,t,r,n,a):(0,E.GC)(i,s,t,c,n,a),u=es((0,v.UD)(e));let m=1;d<u&&u-d<12&&(m=u/d),l*m<Qa&&Qa-l*m<12&&(m=Qa/l);const h=Math.round(d*m),g=Math.round(l*m);return{width:h,height:g,isSmall:h<u||g<Qa}}function ns(e,t){return e.reduce(((e,t)=>e+t),t)}function as(e){const t={width:0,height:0};return e.forEach((e=>{let{dimensions:n,sides:a}=e;2&a&&(t.width=n.width+n.x),4&a&&(t.height=n.height+n.y)})),t}function ss(e,t,n,a,s){const o=function(e,t){return e.map((e=>{const n=ts(e,void 0,void 0,t);return n.width/n.height}))}(a.messages,s),i=function(e){return e.map((e=>e>1.2?"w":e<.8?"n":"q")).join("")}(o),r=function(e){return e.reduce(((e,t)=>t+e),1)/e.length}(o),c=o.length,d=o.some((e=>e>2)),l=(0,E.kc)(e,t,!1,n,s)-(t?2.5:0)*E.Gw;let u;const m={ratios:o,proportions:i,averageRatio:r,maxWidth:l,minWidth:100,maxHeight:l,spacing:2};return u=c>=5||d?function(e){let{ratios:t,averageRatio:n,maxWidth:a,minWidth:s,spacing:o,maxHeight:i=4*a/3}=e;const r=function(e,t){return e.map((e=>t>1.1?(0,Gn.uZ)(e,1,2.75):(0,Gn.uZ)(e,.6667,1)))}(t,n),c=t.length,d=new Array(c),l=[],u=e=>{const t=[];let n=0;e.forEach((e=>{t.push(((e,t)=>{const n=ns(r.slice(e,e+t),0);return(a-(t-1)*o)/n})(n,e)),n+=e})),l.push({lineCounts:e,heights:t})};for(let e=1;e!==c;++e){const t=c-e;e<=3&&t<=3&&u([e,t])}for(let e=1;e!==c-1;++e)for(let t=1;t!==c-e;++t){const a=c-e-t;e<=3&&t<=(n<.85?4:3)&&a<=3&&u([e,t,a])}for(let e=1;e!==c-1;++e)for(let t=1;t!==c-e;++t)for(let n=1;n!==c-e-t;++n){const a=c-e-t-n;e<=3&&t<=3&&n<=3&&a<=4&&u([e,t,n,a])}let m,h=0;for(let e=0;e<l.length;e++){const{heights:t,lineCounts:n}=l[e],a=n.length,r=ns(t,0)+o*(a-1),c=Math.min(...t)<s?1.5:1,d=(()=>{for(let e=1;e!==a;++e)if(n[e-1]>n[e])return 1.5;return 1})(),u=Math.abs(r-i)*c*d;(!m||u<h)&&(m=l[e],h=u)}const g=m.lineCounts,p=m.heights,f=g.length;let I=0,v=0;for(let e=0;e!==f;++e){const t=g[e],n=p[e],s=Math.round(n);let i=0;for(let c=0;c!==t;++c){const l=0|(0===e?1:0)|(e===f-1?4:0)|(0===c?8:0)|(c===t-1?2:0),u=r[I],m=c===t-1?a-i:Math.round(u*n);d[I]={dimensions:{x:i,y:v,width:m,height:s},sides:l},i+=m+o,++I}v+=s+o}return d}(m):2===c?function(e){const{ratios:t,proportions:n,averageRatio:a}=e;return"ww"===n&&a>1.4&&t[1]-t[0]<.2?function(e){const{ratios:t,maxWidth:n,spacing:a,maxHeight:s}=e,o=Math.round(Math.min(n/t[0],Math.min(n/t[1],(s-a)/2)));return[{dimensions:{x:0,y:0,width:n,height:o},sides:11},{dimensions:{x:0,y:o+a,width:n,height:o},sides:14}]}(e):"ww"===n||"qq"===n?function(e){const{ratios:t,maxWidth:n,spacing:a,maxHeight:s}=e,o=(n-a)/2,i=Math.round(Math.min(o/t[0],Math.min(o/t[1],s)));return[{dimensions:{x:0,y:0,width:o,height:i},sides:13},{dimensions:{x:o+a,y:0,width:o,height:i},sides:7}]}(e):function(e){const{ratios:t,minWidth:n,maxWidth:a,spacing:s,maxHeight:o}=e,i=Math.round(1.5*n),r=Math.min(Math.round(Math.max(.4*(a-s),(a-s)/t[0]/(1/t[0]+1/t[1]))),a-s-i),c=a-r-s,d=Math.min(o,Math.round(Math.min(c/t[0],r/t[1])));return[{dimensions:{x:0,y:0,width:c,height:d},sides:13},{dimensions:{x:c+s,y:0,width:r,height:d},sides:7}]}(e)}(m):3===c?function(e){const{proportions:t}=e;return"n"===t[0]?function(e){const{maxHeight:t,spacing:n,ratios:a,maxWidth:s,minWidth:o}=e,i=t,r=Math.round(Math.min((t-n)/2,a[1]*(s-n)/(a[2]+a[1]))),c=i-r-n,d=Math.max(o,Math.round(Math.min((s-n)/2,Math.min(r*a[2],c*a[1])))),l=Math.min(Math.round(i*a[0]),s-n-d);return[{dimensions:{x:0,y:0,width:l,height:i},sides:13},{dimensions:{x:l+n,y:0,width:d,height:c},sides:3},{dimensions:{x:l+n,y:c+n,width:d,height:r},sides:6}]}(e):function(e){const{maxWidth:t,ratios:n,maxHeight:a,spacing:s}=e,o=t,i=Math.round(Math.min(o/n[0],.66*(a-s))),r=(t-s)/2,c=Math.min(a-i-s,Math.round(Math.min(r/n[1],r/n[2])));return[{dimensions:{x:0,y:0,width:o,height:i},sides:11},{dimensions:{x:0,y:i+s,width:r,height:c},sides:12},{dimensions:{x:r+s,y:i+s,width:o-r-s,height:c},sides:6}]}(e)}(m):function(e){const{proportions:t}=e;return"w"===t[0]?function(e){let{maxWidth:t,ratios:n,spacing:a,maxHeight:s,minWidth:o}=e;const i=t,r=Math.round(Math.min(i/n[0],.66*(s-a))),c=Math.round((t-2*a)/(n[1]+n[2]+n[3])),d=Math.max(o,Math.round(Math.min(.4*(t-2*a),c*n[1]))),l=Math.round(Math.max(Math.max(o,.33*(t-2*a)),c*n[3])),u=i-d-l-2*a,m=Math.min(s-r-a,c);return[{dimensions:{x:0,y:0,width:i,height:r},sides:11},{dimensions:{x:0,y:r+a,width:d,height:m},sides:12},{dimensions:{x:d+a,y:r+a,width:u,height:m},sides:4},{dimensions:{x:d+a+u+a,y:r+a,width:l,height:m},sides:6}]}(e):function(e){let{maxHeight:t,ratios:n,maxWidth:a,spacing:s,minWidth:o}=e;const i=t,r=Math.round(Math.min(i*n[0],.6*(a-s))),c=Math.round((t-2*s)/(1/n[1]+1/n[2]+1/n[3])),d=Math.round(c/n[1]),l=Math.round(c/n[2]),u=i-d-l-2*s,m=Math.max(o,Math.min(a-r-s,c));return[{dimensions:{x:0,y:0,width:r,height:i},sides:13},{dimensions:{x:r+s,y:0,width:m,height:d},sides:3},{dimensions:{x:r+s,y:d+s,width:m,height:l},sides:2},{dimensions:{x:r+s,y:d+l+2*s,width:m,height:u},sides:6}]}(e)}(m),{layout:u,containerStyle:as(u)}}var os=n(55254),is=n(44139);function rs(e,t,n,a,s,o,r){const d=(0,i.sO)(!r);(0,i.bt)((()=>{const t=d.current;if(d.current=!1,n&&e.current){const n=e.current.closest(".MessageList"),i=s,r=()=>(0,Da.ZP)(n,e.current,i?"end":"centerOrTop",20,void 0!==a?i?500:750:void 0,a,void 0,o,!0);t?(0,c.lT)(r):(0,c.i$)((()=>{(0,c.WM)(r())}))}}),[e,t,n,a,s,o])}var cs=n(3858),ds=n(3927);const ls=3*E.Gw,us=Number(E.Gw),ms="data-is-document-group-hover";function hs(e,t,n,o,r,d,l,u,m,h,g,p){const{setReplyingToId:f,sendDefaultReaction:I}=(0,a.Sv)(),[v,w,b]=(0,At.Z)(),[Z,P,y]=(0,At.Z)(),C=(0,i.sO)(),E=(0,ds.Z)((e=>{const t=g.current;if(!t)return;const{clientX:n,clientY:a}=e,{x:s,width:o,y:i,height:r}=t.getBoundingClientRect(),c=s+o/2,d=i+r/2,l=Math.abs(c-n)<ls,u=Math.abs(d-a)<us;l&&u?w():b()}),[g],c.i$);return(0,i.d4)((()=>{if(!s.$b||o||!r||h)return;let e;return(0,vn.sf)(t.current,{selectorToPreventScroll:".MessageList",excludedClosestSelector:".no-word-wrap",onSwipe:(t,n)=>n===vn.eM.Left&&(e||(e=Date.now()),P(),!0),onRelease:()=>{e&&r&&(f({messageId:n}),setTimeout(y,Math.max(0,150-(Date.now()-e))),e=void 0)}})}),[t,o,n,f,P,y,r,h]),{handleMouseDown:o?void 0:function(e){(0,Fa.q)(e),u(e)},handleClick:function(t){if(o)e(t);else if(s.$b)return C.current?(clearInterval(C.current),C.current=void 0,void I({chatId:m,messageId:n})):void(C.current=setTimeout((()=>{C.current=void 0,function(e){if(s.wZ){const t=e.target;if(!t.classList.contains("text-content")&&!t.classList.contains("Message"))return;A.Z.getIsKeyboardVisible()?setTimeout((()=>{l(e)}),350):l(e)}}(t)}),200))},handleContextMenu:o?d?cs.Z:void 0:function(t){if(s.wZ){if(t.target.matches("a[href]")||h)return;t.preventDefault(),e()}else l(t)},handleDoubleClick:o?void 0:function(){!s.$b&&r&&f({messageId:n})},handleContentDoubleClick:s.$b?void 0:function(e){e.stopPropagation()},handleMouseMove:E,handleSendQuickReaction:function(e){e.stopPropagation(),I({chatId:m,messageId:n})},handleMouseLeave:function(e){(0,c.i$)(b),p&&function(e){const t=ps(e.currentTarget);t&&t.removeAttribute(ms)}(e)},isSwiped:Z,isQuickReactionVisible:v,handleDocumentGroupMouseEnter:gs}}function gs(e){const t=ps(e.currentTarget);t&&t.setAttribute(ms,"")}function ps(e){let t=e;do{t=t.nextElementSibling}while(t&&!t.classList.contains("last-in-document-group"));return t}const fs=new Map;function Is(e,t,n,s){const o=s&&n?e?.byLangCode[s]?.[n]:void 0,{isPending:r,text:c}=o||{};return(0,i.d4)((()=>{t&&n&&!c&&void 0===r&&s&&function(e,t,n){const s=fs.get(n)||new Map,o=s.get(e)||[];o.includes(t)||(o.push(t),s.set(e,o),fs.set(n,s),(0,a.Sv)().markMessagesTranslationPending({chatId:e,messageIds:o,toLanguageCode:n})),vs()}(t,n,s)}),[t,c,r,n,s]),t&&n?{isPending:r,translatedText:c}:{isPending:!1,translatedText:void 0}}const vs=(0,I.P2)((function(){const{translateMessages:e}=(0,a.Sv)();let t=!1;fs.forEach(((n,a)=>{n.forEach(((n,s)=>{const o=n.slice(0,20);o.length<n.length&&(t=!0),e({chatId:s,messageIds:o,toLanguageCode:a}),function(e,t,n){const a=fs.get(n);if(!a?.size)return void fs.delete(n);const s=a.get(e);if(!s?.length)return void a.delete(e);const o=s.filter((e=>!t.includes(e)));if(!o?.length)return a.delete(e),void(a.size||fs.delete(n));a.set(e,o)}(s,o,a)}))})),t&&vs()}),500);var ws=n(74095);let bs;const Zs=new V.Z;function Ps(e,t){const[n,a]=(0,i.eJ)();return(0,bt.Z)((()=>{e&&!t?async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.2;return bs||await Zs.promise,await bs.request({name:"detectLanguage",args:[e,t]})}(e).then(a):a(void 0)}),[t,e]),n}let ys,Cs;function Es(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,t);if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}s.SX&&setTimeout((function(){bs||(bs=(0,ws.K)(new Worker(new URL(n.p+n.u(4923),n.b))),Zs.resolve())}),4e3),ys=Symbol.toStringTag,Cs=Symbol.iterator;class Ss{constructor(e){this.limit=e,Es(this,"map",void 0),Es(this,"insertionQueue",void 0),this.map=new Map,this.insertionQueue=new Set}get(e){return this.map.get(e)}set(e,t){if(this.map.size===this.limit){const e=Array.from(this.insertionQueue).shift();e&&(this.map.delete(e),this.insertionQueue.delete(e))}return this.map.set(e,t),this.insertionQueue.add(e),this}delete(e){const t=this.map.delete(e);return t&&this.insertionQueue.delete(e),t}clear(){this.map.clear(),this.insertionQueue.clear()}forEach(e,t){this.map.forEach(e,t)}get size(){return this.map.size}get[ys](){return this.map[Symbol.toStringTag]}[Cs](){return this.map[Symbol.iterator]()}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}}const Ms=new Map;const Rs=(0,I.P2)((function(e){const{updateChatDetectedLanguage:t}=(0,a.Sv)(),n=Ms.get(e);if(!n)return;const s=n.size;if(s<8)return;let o=0,i=0;const r=new Map;for(const e of n.values()){e.isTranslatable&&o++,e.detectedLanguage&&i++;const t=e.detectedLanguage;if(t){const e=r.get(t)||0;r.set(t,e+1)}}if(o/s<.3||i/s<.6)return;t({chatId:e,detectedLanguage:Array.from(r.entries()).sort(((e,t)=>{let[,n]=e,[,a]=t;return a-n}))[0][0]})}),1e3);var ks=n(70172),Ts=n(18005);const As=e=>{const{isOpen:t}=e,n=(0,Nt.Z)(ft.gl.Extra,"ContextMenuContainer",!t);return n?i.ZP.createElement(n,e):void 0};var Ns=n(45601),xs=n(66735);const Bs=(0,i.X$)((e=>{let{message:t,renderContent:n}=e;const{openMediaViewer:s,uploadProfilePhoto:o,showNotification:r}=(0,a.Sv)(),{isOutgoing:c}=t,d=(0,qt.Z)(),[l,h]=(0,i.eJ)(),[g,p,f]=(0,At.Z)(!1),I=(0,dn.Z)((0,v.Ti)(t,"full")),w=t.content.action.photo?.isVideo,b=(0,It.Z)((()=>{r({title:d("ApplyAvatarHintTitle"),message:d("ApplyAvatarHint"),action:{action:"requestNextSettingsScreen",payload:{screen:m.MT.Main}},actionText:d("Open")})})),Z=(0,It.Z)((e=>{h(void 0),o({file:e}),b()})),P=(0,It.Z)((()=>{h(void 0)})),y=(0,It.Z)((async()=>{f(),b();const e=t.content.action.photo,n=await Le.he(`videoAvatar${e.id}?size=u`,u.IU.BlobUrl),a=await fetch(n).then((e=>e.blob()));o({file:new File([a],"avatar.mp4"),isVideo:!0,videoTs:e.videoSizes?.find((e=>void 0!==e.videoStartTs))?.videoStartTs})}));return i.ZP.createElement("span",{className:"action-message-suggested-avatar",tabIndex:0,role:"button",onClick:async()=>{!c&&I?w?p():h(await fetch(I).then((e=>e.blob()))):s({chatId:t.chatId,mediaId:t.id,threadId:u._f,origin:m.bZ.SuggestedAvatar})}},i.ZP.createElement(ks.Z,{photo:t.content.action.photo,loopIndefinitely:!0,withVideo:w,size:"jumbo"}),i.ZP.createElement("span",null,n()),i.ZP.createElement("span",{className:"action-message-button"},d(w?"ViewVideoAction":"ViewPhotoAction")),i.ZP.createElement(xs.Z,{file:l,onClose:P,onChange:Z}),i.ZP.createElement(oa.Z,{isOpen:g,title:d("SuggestedVideo"),confirmHandler:y,onClose:f,textParts:n()}))})),Ls=(0,i.X$)((0,a.c$)(((e,t)=>{let{message:n,threadId:a}=t;const{chatId:s,senderId:o,replyToMessageId:i,content:r}=n,c=o,{targetUserIds:d,targetChatId:l}=r.action||{},u=i,m=u?(0,f.hj)(e,s,u):void 0,h=!!a&&(0,f._X)(e,n,a),{direction:g,noHighlight:p}=h&&(0,f.jU)(e).focusedMessage||{},I=(0,f.Z1)(e,s),w=I&&((0,v.eA)(I)||c===s),b=!w&&c?(0,f.dy)(e,c):void 0,Z=w?I:void 0,P=e.premiumGifts?.stickers?.[0];return{senderUser:b,senderChat:Z,targetChatId:l,targetUserIds:d,targetMessage:m,isFocused:h,premiumGiftSticker:P,topic:(0,f.p$)(e,n),canPlayAnimatedEmojis:(0,f.W9)(e),...h&&{focusDirection:g,noFocusHighlight:p}}}))((e=>{let{message:t,isEmbedded:n,appearanceOrder:s=0,isJustAdded:o,isLastInList:r,senderUser:c,senderChat:d,targetUserIds:l,targetMessage:u,targetChatId:m,isFocused:h,focusDirection:g,noFocusHighlight:p,premiumGiftSticker:f,isInsideTopic:I,topic:w,memoFirstUnreadIdRef:b,canPlayAnimatedEmojis:Z,observeIntersectionForReading:P,observeIntersectionForLoading:y,observeIntersectionForPlaying:C,onPinnedIntersectionChange:E}=e;const{openPremiumModal:S,requestConfetti:M}=(0,a.Sv)(),R=(0,qt.Z)(),k=(0,i.sO)(null);(0,Wa._N)(k,P),(0,Yn.Z)(t.chatId,t.replyToMessageId,u),rs(k,t.chatId,h,g,p,o),(0,i.d4)((()=>{if(t.isPinned)return()=>{E?.({viewportPinnedIdsToRemove:[t.id],isUnmount:!0})}}),[E,t.isPinned,t.id]);const T=s<=0,[A,N]=(0,At.Z)(T),x=Boolean(t.content.action?.text.startsWith("ActionGift")),B="suggestProfilePhoto"===t.content.action?.type&&t.content.action.photo;(0,i.d4)((()=>{T||setTimeout(N,10*s)}),[s,N,T]);const L=(0,Wa.Op)(k,C),U=(0,i.sO)((()=>{const e=b?.current&&t.id>=b.current;return x&&!t.isOutgoing&&e})());(0,i.d4)((()=>{L&&U.current&&(U.current=!1,M())}),[L,M]);const{transitionClassNames:j}=(0,St.Z)(A,void 0,T,!1),O=(0,a.Rd)().users.byId,F=(0,i.Ye)((()=>l?l.map((e=>O?.[e])).filter(Boolean):void 0),[l,O]),_=(0,i.I4)((()=>(0,Ts.D)(R,t,c,d,F,u,m,w,{isEmbedded:n},y,C)),[n,R,t,y,C,d,c,m,u,F,w]),{isContextMenuOpen:D,contextMenuPosition:q,handleBeforeContextMenu:$,handleContextMenu:H,handleContextMenuClose:G,handleContextMenuHide:V}=(0,Ra.Z)(k),W=void 0!==q;if(I&&"TopicWasCreatedAction"===t.content.action?.text)return i.ZP.createElement("span",{ref:k});if(n)return i.ZP.createElement("span",{ref:k,className:"embedded-action-message"},_());const z=(0,ht.Z)("ActionMessage message-list-item",h&&!p&&"focused",(x||B)&&"centered-action",W&&"has-menu-open",r&&"last-in-list",!x&&!B&&"in-one-row",j);return i.ZP.createElement("div",{ref:k,id:(0,v.d0)(t.id),className:z,"data-message-id":t.id,"data-is-pinned":t.isPinned||void 0,onMouseDown:e=>{(0,Fa.q)(e),$(e)},onContextMenu:H},!B&&i.ZP.createElement("span",{className:"action-message-content"},_()),x&&i.ZP.createElement("span",{className:"action-message-gift",tabIndex:0,role:"button",onClick:()=>{S({isGift:!0,fromUserId:c?.id,toUserId:l?.[0],monthsAmount:t.content.action?.months||0})}},i.ZP.createElement(Ns.Z,{key:t.id,sticker:f,play:Z,noLoop:!0,nonInteractive:!0}),i.ZP.createElement("strong",null,R("ActionGiftPremiumTitle")),i.ZP.createElement("span",null,R("ActionGiftPremiumSubtitle",R("Months",t.content.action?.months,"i"))),i.ZP.createElement("span",{className:"action-message-button"},R("ActionGiftPremiumView"))),B&&i.ZP.createElement(Bs,{message:t,renderContent:_}),q&&i.ZP.createElement(As,{isOpen:D,anchor:q,message:t,messageListType:"thread",onClose:G,onCloseAnimationEnd:V}))})));var Us=n(17921);const js=e=>{let{className:t,message:n,sender:a,title:s,customText:o,isProtected:r,noUserColors:c,hasContextMenu:d,chatTranslations:l,requestedChatTranslationLanguage:u,observeIntersectionForLoading:m,observeIntersectionForPlaying:h,onClick:g}=e;const p=(0,i.sO)(null),f=(0,Wa.Op)(p,m),I=(0,dn.Z)(n&&(0,v.Ti)(n,"pictogram"),!f),w=(0,na.Z)(n),b=Boolean(n&&(0,v.Y5)(n)),Z=Boolean(n&&(0,v.NE)(n)),P=n&&(0,v.cT)(n),{isPending:y,translatedText:C}=Is(l,n?.chatId,P?n?.id:void 0,u),{shouldRender:S,transitionClassNames:M}=(0,St.Z)(y||!n&&!o),R=(0,qt.Z)(),k=a?(0,v.OU)(R,a):n?.forwardInfo?.hiddenUserName,{handleClick:T,handleMouseDown:A}=(0,zn.m)(g);return i.ZP.createElement("div",{ref:p,className:(0,ht.Z)("EmbeddedMessage",t,a&&!c&&`color-${(0,v.Rs)(a)}`),onClick:n&&T,onMouseDown:n&&A},S&&i.ZP.createElement(Us.Z,{className:(0,ht.Z)("embed-loading",M)}),w&&function(e,t,n,a,s){const{width:o,height:r}=(0,E.W7)(),c=t||e;return i.ZP.createElement("div",{className:(0,ht.Z)("embedded-thumb",n&&"round")},!s&&i.ZP.createElement("img",{src:c,width:o,height:r,alt:"",className:"pictogram",draggable:!1}),i.ZP.createElement(la.Z,{thumbDataUri:c,isVisible:Boolean(s),width:o,height:r}),a&&i.ZP.createElement("span",{className:"protector"}))}(w,I,b,r,Z),i.ZP.createElement("div",{className:"message-text"},i.ZP.createElement("p",{dir:"auto"},n?(0,v.FT)(n)?i.ZP.createElement(Ls,{message:n,isEmbedded:!0,observeIntersectionForLoading:m,observeIntersectionForPlaying:h}):i.ZP.createElement(da.Z,{lang:R,message:n,noEmoji:Boolean(w),translatedText:C,observeIntersectionForLoading:m,observeIntersectionForPlaying:h}):o||" "),i.ZP.createElement("div",{className:"message-title",dir:"auto"},(0,ta.Z)(k||s||" "))),d&&i.ZP.createElement("i",{className:"embedded-more icon icon-more"}))};var Os=n(82535),Fs=n(54752),_s=n(8018);const Ds=(0,i.X$)((e=>{let{message:t,outgoingStatus:n,signature:s,withReactionOffset:o,repliesThreadInfo:r,renderQuickReactionButton:c,noReplies:d,isTranslated:l,isPinned:u,onClick:m,onTranslationClick:h,onOpenThread:g}=e;const{showNotification:p}=(0,a.Sv)(),f=(0,qt.Z)(),[I,v]=(0,At.Z)();function w(e){e.stopPropagation(),p({message:f("ImportedInfo")})}const b=(0,i.Ye)((()=>{if(!I)return;const e=(0,de.SA)(1e3*t.date,f.code,void 0,f.timeFormat),n=t.isEdited&&(0,de.SA)(1e3*t.editDate,f.code,void 0,f.timeFormat),a=t.forwardInfo&&(0,de.SA)(1e3*t.forwardInfo.date,f.code,void 0,f.timeFormat);let s=e;return n&&(s+="\n",s+=f("lng_edited_date").replace("{date}",n)),a&&(s+="\n",s+=f("lng_forwarded_date").replace("{date}",a)),s}),[I,f,t,f.timeFormat]),Z=(0,ht.Z)("MessageMeta",o&&"reactions-offset",t.forwardInfo?.isImported&&"is-imported");return i.ZP.createElement("span",{className:Z,dir:f.isRtl?"rtl":"ltr",onClick:m,"data-ignore-on-paste":!0},l&&i.ZP.createElement("i",{className:"icon icon-language message-translated",onClick:h}),Boolean(t.views)&&i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement("span",{className:"message-views"},(0,Bt.bi)(t.views)),i.ZP.createElement("i",{className:"icon icon-channelviews"})),!d&&Boolean(r?.messagesCount)&&i.ZP.createElement("span",{onClick:function(e){e.stopPropagation(),g()},className:"message-replies-wrapper"},i.ZP.createElement("span",{className:"message-replies"},i.ZP.createElement(ua.Z,{text:(0,Bt.bi)(r.messagesCount)})),i.ZP.createElement("i",{className:"icon icon-reply-filled"})),u&&i.ZP.createElement("i",{className:"icon icon-pinned-message message-pinned"}),s&&i.ZP.createElement("span",{className:"message-signature"},(0,ta.Z)(s)),i.ZP.createElement("span",{className:"message-time",title:b,onMouseEnter:v},t.forwardInfo?.isImported&&i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement("span",{className:"message-imported",onClick:w},(0,de.SA)(1e3*t.forwardInfo.date,f.code,!0)),i.ZP.createElement("span",{className:"message-imported",onClick:w},f("ImportedMessage"))),t.isEdited&&`${f("EditedMessage")} `,(0,de.mr)(f,1e3*t.date)),n&&i.ZP.createElement(_s.Z,{status:n}),c&&c())}));var qs=n(36765),$s=n(97799);const Hs=e=>{let{message:t,observeIntersection:n,observeIntersectionForPlaying:o,shouldLoop:r,shouldPlayEffect:c,withEffect:d,onPlayEffect:l,onStopEffect:m}=e;const{showNotification:h,openStickerSet:g}=(0,a.Sv)(),p=(0,qt.Z)(),{isMobile:f}=(0,B.ZP)(),I=(0,i.sO)(null),w=t.content.sticker,{stickerSetInfo:b,isVideo:Z,hasEffect:P}=w,y=w.isPreloadedGlobally?void 0:(0,v.Ti)(t,Z&&!s.Hh?"pictogram":"inline"),C=(0,Wa.Op)(I,n),S=(0,Wa.Op)(I,o),M=`sticker${w.id}?size=f`,R=(0,dn.Z)(M,!C||!P,u.IU.BlobUrl),[k,T,A]=(0,At.Z)(),N=(0,It.Z)((()=>{A(),m?.()})),x=(0,Hn.Z)(c);(0,i.d4)((()=>{P&&d&&S&&(c||x)&&(T(),l?.())}),[P,S,l,c,x,T,d]);const L=(0,It.Z)((()=>{g({stickerSetInfo:w.stickerSetInfo})})),U=(0,It.Z)((()=>{if(P){if(k||!d)return void h({message:p("PremiumStickerTooltip"),action:{action:"openStickerSet",payload:{stickerSetInfo:w.stickerSetInfo}},actionText:p("ViewAction")});if(d)return T(),void l?.()}L()})),j="isMissing"in b,{width:O,height:F}=(0,E.Wr)(w,f),_=(0,ht.Z)("Sticker media-inner",j&&"inactive",P&&!t.isOutgoing&&"reversed");return i.ZP.createElement("div",{ref:I,className:_,style:`width: ${O}px; height: ${F}px;`,onClick:j?void 0:U},i.ZP.createElement(qs.Z,{containerRef:I,sticker:w,fullMediaHash:y,fullMediaClassName:"full-media",size:O,shouldLoop:r,noLoad:!C,noPlay:!S,withSharedAnimation:!0}),P&&d&&C&&k&&i.ZP.createElement($s.Z,{key:M,className:"effect-sticker",tgsUrl:R,size:1.49*O,play:!0,isLowPriority:!0,noLoop:!0,onEnded:N}))};var Gs=n(74753);const Vs=7*E.Gw;function Ws(e,t,n,s,r,c,d){const{interactWithAnimatedEmoji:l,sendEmojiInteraction:u,sendWatchingEmojiInteraction:m}=(0,a.Sv)(),h=(0,i.sO)(null),g=(0,i.sO)(null),p=(0,dn.Z)(n?`document${n}`:void 0,!n),f=d||Vs,I=(0,Fn.Z)(`width: ${f}px`,`height: ${f}px`,c&&!o.D$V&&"cursor: pointer"),v=(0,i.sO)(void 0),w=(0,i.sO)(void 0),b=(0,It.Z)((()=>{h.current&&(u({chatId:e,messageId:t,emoji:c,interactions:v.current}),w.current=void 0,v.current=void 0)})),Z=(0,It.Z)((()=>{const e=g.current;p&&(e&&(e.pause(),e.remove()),g.current=new Audio,g.current.src=p,(0,Gs.Z)(g.current),g.current.addEventListener("ended",(()=>{g.current=void 0}),{once:!0}))})),P=(0,It.Z)((()=>{Z();const n=h.current;if(!(c&&n&&t&&e))return;const{x:a,y:s}=n.getBoundingClientRect();l({emoji:c,x:a,y:s,startSize:f,isReversed:!r}),v.current||(v.current=[],w.current=performance.now(),setTimeout(b,1e3)),v.current.push(w.current?(performance.now()-w.current)/1e3:0)}));return(0,i.d4)((()=>{const n=h.current;n&&s&&s.forEach((a=>{let{id:s,startSize:o,messageId:i}=a;if(o||t!==i)return;const{x:d,y:l}=n.getBoundingClientRect();m({id:s,chatId:e,emoticon:c,startSize:f,x:d,y:l,isReversed:!r}),Z()}))}),[s,e,c,r,t,Z,m,f]),{ref:h,size:f,style:I,handleClick:P}}const zs=(0,i.X$)((0,a.c$)(((e,t)=>{let{emoji:n,withEffects:a}=t;return{sticker:(0,f.zB)(e,n),effect:a?(0,f.tH)(e,n):void 0,soundId:(0,f.Oh)(e,n)}}))((e=>{let{isOwn:t,observeIntersection:n,forceLoadPreview:a,messageId:s,chatId:o,activeEmojiInteractions:r,sticker:c,effect:d,soundId:l}=e;const{ref:u,size:m,style:h,handleClick:g}=Ws(o,s,l,r,t,d?.emoji),p=(0,Wa.Op)(u,n);return i.ZP.createElement(Ns.Z,{sticker:c,size:m,quality:1,noLoad:!p,forcePreview:a,play:p,forceOnHeavyAnimation:!0,ref:u,className:(0,ht.Z)("AnimatedEmoji media-inner",c?.id===E.wB&&"like-sticker-thumb"),style:h,onClick:g})}))),Ys=(0,i.X$)((0,a.c$)(((e,t)=>{let{customEmojiId:n,withEffects:a}=t;const s=e.customEmojis.byId[n];return{sticker:s,effect:s?.emoji&&a?(0,f.tH)(e,s.emoji):void 0,soundId:s?.emoji&&(0,f.Oh)(e,s.emoji),noPlay:!(0,f.W9)(e)}}))((e=>{let{isOwn:t,customEmojiId:n,messageId:a,chatId:s,activeEmojiInteractions:o,sticker:r,effect:c,soundId:d,noPlay:l,observeIntersection:u}=e;const{ref:m,size:h,style:g,handleClick:p}=Ws(s,a,d,o,t,c?.emoji,(0,is.qo)(1));return i.ZP.createElement(rn.Z,{ref:m,documentId:n,className:(0,ht.Z)("AnimatedEmoji media-inner",r?.id===E.wB&&"like-sticker-thumb"),style:g,size:h,isBig:!0,noPlay:l,withSharedAnimation:!0,forceOnHeavyAnimation:!0,observeIntersectionForLoading:u,onClick:p})}))),Js={dark:{outgoing:"rgb(135,116,225)",incoming:"rgb(33,33,33)"},light:{outgoing:"rgb(238,255,222)",incoming:"rgb(255,255,255)"}};function Ks(e,t,n,a){return n?Promise.resolve(Js[a||"light"][t?"outgoing":"incoming"]):async function(e,t){const n=new Image;n.src=e,n.crossOrigin="anonymous",n.width||await new Promise((e=>{n.onload=e}));const a=document.createElement("canvas"),s=a.getContext("2d");a.width=n.width,a.height=n.height,s.drawImage(n,0,0,n.width,n.height);const o=t?n.width-1:0,i=n.height-1;return`rgba(${Array.from(s.getImageData(o,i,1,1).data).join(",")})`}(e,t)}var Xs=n(6701),Qs=n(15866);function eo(e,t,n){const{isMobile:a}=(0,B.ZP)(),o=n||(0,v.DH)(e);return(0,Qs.Z)(o,Boolean(t),a&&!s.vX)}var to=n(70692),no=n(39196);const ao=e=>{let{id:t,message:n,observeIntersection:a,noAvatars:s,canAutoLoad:r,isInSelectMode:d,isSelected:l,uploadProgress:u,forcedWidth:m,size:h="inline",dimensions:g,asForwarded:p,nonInteractive:f,shouldAffectAppendix:I,isDownloading:w,isProtected:b,theme:Z,onClick:P,onCancelUpload:y}=e;const C=(0,i.sO)(null),E=(0,v.O$)(n)||(0,v.F$)(n),S=E.blobUrl,M=(0,Wa.Op)(C,a),{isMobile:R}=(0,B.ZP)(),[k,T]=(0,i.eJ)(r),A=k&&M,{mediaData:N,loadProgress:x}=(0,Xs.Z)((0,v.Ti)(n,h),!A),L=S||N,U=Boolean(m),[j]=(0,i.eJ)(!L),O=Boolean(L),F=eo(n,O),_=eo(n,!U),D=(0,to.Z)(!O),q=(0,v.DH)(n),[$,,H]=(0,At.Z)(E.isSpoiler),{loadProgress:G}=(0,Xs.Z)((0,v.Ti)(n,"download"),!w,(0,v.kG)(n,"download")),{isUploading:V,isTransferring:W,transferProgress:z}=(0,v.Sc)(n,u||(w?G:x),A&&!L),Y=!1===(0,Hn.Z)(k),{shouldRender:J,transitionClassNames:K}=(0,St.Z)(W,void 0,Y,"slow"),{shouldRender:X,transitionClassNames:Q}=(0,St.Z)(!L&&!k),ee=(0,It.Z)((()=>{V?y?.(n):L?$?H():P?.(n.id):T((e=>!e))})),te=(0,v.B4)(n);(0,Ga.Z)((e=>{let[t]=e;if(!I)return void(t&&C.current.closest(o.be_).removeAttribute(o.s22));const n=C.current.closest(o.be_);L?Ks(L,te,l,Z).then((e=>{(0,c.WM)((()=>{n.style.setProperty("--appendix-bg",e),n.setAttribute(o.s22,"")}))})):n.classList.add("has-appendix-thumb")}),[I,L,te,d,l,Z]);const{width:ne,height:ae,isSmall:se}=g||ts(n,p,s,R),oe=(0,ht.Z)("media-inner",!V&&!f&&"interactive",se&&"small-image",ne===ae&&"square-image",ae<Qa&&"fix-min-height"),ie=g?` width: ${ne}px; left: ${g.x}px; top: ${g.y}px;`:"",re="inline"===h?`height: ${ae}px;${ie}`:void 0;return i.ZP.createElement("div",{id:t,ref:C,className:oe,style:re,onClick:V?void 0:ee},U&&i.ZP.createElement("canvas",{ref:_,className:"thumbnail blurred-bg"}),i.ZP.createElement("img",{src:L,className:(0,ht.Z)("full-media",U&&"with-blurred-bg"),alt:"",style:m?`width: ${m}px`:void 0,draggable:!b}),j&&i.ZP.createElement("canvas",{ref:F,className:(0,ht.Z)("thumbnail",D)}),b&&i.ZP.createElement("span",{className:"protector"}),J&&!X&&i.ZP.createElement("div",{className:`media-loading ${K}`},i.ZP.createElement(no.Z,{progress:z,onClick:V?ee:void 0})),X&&i.ZP.createElement("i",{className:(0,ht.Z)("icon","icon-download",Q)}),i.ZP.createElement(la.Z,{isVisible:$,withAnimation:!0,thumbDataUri:q,width:ne,height:ae,className:"media-spoiler"}),W&&i.ZP.createElement("span",{className:"message-transfer-progress"},Math.round(100*z),"%"))};var so=n(57080);const oo=e=>{let{id:t,message:n,observeIntersectionForLoading:s,observeIntersectionForPlaying:o,noAvatars:r,canAutoLoad:c,canAutoPlay:d,uploadProgress:l,forcedWidth:u,dimensions:m,asForwarded:h,isDownloading:g,isProtected:p,onClick:f,onCancelUpload:I}=e;const w=(0,i.sO)(null),b=(0,i.sO)(null),Z=(0,v.b7)(n)||(0,v.Cg)(n),P=Z.blobUrl,[y,,C]=(0,At.Z)(Z.isSpoiler),S=(0,Wa.Op)(w,s),M=(0,Wa.Op)(w,o)&&S,R=(0,i.sO)(S);M&&!R.current&&(R.current=!0);const{isMobile:k}=(0,B.ZP)(),[T,A]=(0,i.eJ)(c),N=Boolean(T&&S),[x,L]=(0,i.eJ)(Boolean(d&&!y)),U=(0,v.Ti)(n,"inline"),[j]=(0,i.eJ)(Boolean(U&&Le.UV(U))),{mediaData:O,loadProgress:F}=(0,Xs.Z)(U,!N,(0,v.kG)(n,"inline")),_=P||O,[D,q]=(0,At.Z)(),$=(0,v.DH)(n),H=Boolean($),G=Boolean(u),V=(0,v.Ti)(n,"preview"),[W]=(0,i.eJ)(Boolean(V&&Le.UV(V))),z=S,Y=(0,dn.Z)(V,!z),J=(0,to.Z)((H||Y)&&!D),K=!H||Y||D,X=eo(n,K),Q=eo(n,!G),ee=(0,to.Z)(!K),te=_&&R.current,{loadProgress:ne}=(0,Xs.Z)((0,v.Ti)(n,"download"),!g,(0,v.kG)(n,"download")),{isUploading:ae,isTransferring:se,transferProgress:oe}=(0,v.Sc)(n,l||(g?ne:F),N&&!D&&!j||g),ie=!1===(0,Hn.Z)(T),{shouldRender:re,transitionClassNames:ce}=(0,St.Z)(se,void 0,ie),{transitionClassNames:le}=(0,St.Z)(Boolean((T||_)&&!x&&!re)),[ue,me]=(0,i.eJ)(0),he=(0,It.Z)((e=>{me(Math.max(0,e.currentTarget.currentTime-1))})),ge=b.current?.duration||Z.duration||0,pe=(0,v.B4)(n),fe=Boolean((0,v.Cg)(n)),{width:Ie,height:ve}=m||(0,E.GC)(Z,pe,h,fe,r,k),we=(0,It.Z)((()=>{ae?I?.(n):g?(0,a.Sv)().cancelMessageMediaDownload({message:n}):_?(_&&!x&&L(!0),y?C():f?.(n.id)):A((e=>!e))})),be=(0,ht.Z)("media-inner dark",!ae&&"interactive",ve<Qa&&"fix-min-height"),Ze=`height: ${ve}px;${m?` width: ${Ie}px; left: ${m.x}px; top: ${m.y}px;`:""}`;return i.ZP.createElement("div",{ref:w,id:t,className:be,style:Ze,onClick:ae?void 0:we},G&&i.ZP.createElement("canvas",{ref:Q,className:"thumbnail blurred-bg"}),te&&i.ZP.createElement(so.Z,{ref:b,src:_,className:(0,ht.Z)("full-media",G&&"with-blurred-bg"),canPlay:x&&M,muted:!0,loop:!0,playsInline:!0,draggable:!p,onTimeUpdate:he,onReady:q,style:u?`width: ${u}px`:void 0}),i.ZP.createElement("img",{src:Y,className:(0,ht.Z)("thumbnail",J,G&&"with-blurred-bg"),alt:"",style:u?`width: ${u}px;`:void 0,draggable:!p}),H&&!W&&i.ZP.createElement("canvas",{ref:X,className:(0,ht.Z)("thumbnail",ee)}),p&&i.ZP.createElement("span",{className:"protector"}),i.ZP.createElement("i",{className:(0,ht.Z)("icon","icon-large-play",le)}),i.ZP.createElement(la.Z,{isVisible:y,withAnimation:!0,thumbDataUri:$,width:Ie,height:ve,className:"media-spoiler"}),re&&i.ZP.createElement("div",{className:(0,ht.Z)("media-loading",ce)},i.ZP.createElement(no.Z,{progress:oe,onClick:we})),!T&&!_&&i.ZP.createElement("i",{className:"icon icon-download"}),se?i.ZP.createElement("span",{className:"message-transfer-progress"},ae||g?`${Math.round(100*oe)}%`:"..."):i.ZP.createElement("div",{className:"message-media-duration"},Z.isGif?"GIF":(0,de.k9)(Math.max(ge-ue,0))))};var io=n(6272);const ro=(0,a.c$)(((e,t)=>{let{contact:n}=t;const{countryList:{phoneCodes:a}}=e;return{user:(0,f.dy)(e,n.userId),phoneCodeList:a}}))((e=>{let{contact:t,user:n,phoneCodeList:s}=e;const{openChat:o}=(0,a.Sv)(),{firstName:r,lastName:c,phoneNumber:d,userId:l}=t,u="0"!==l,m=(0,It.Z)((()=>{o({id:l})}));return i.ZP.createElement("div",{className:(0,ht.Z)("Contact",u&&"interactive"),onClick:u?m:void 0},i.ZP.createElement(ks.Z,{size:"large",peer:n,text:r||c}),i.ZP.createElement("div",{className:"contact-info"},i.ZP.createElement("div",{className:"contact-name"},r," ",c),i.ZP.createElement("div",{className:"contact-phone"},(0,io.WZ)(s,d))))}));var co=n(20230),lo=n(51218),uo=n(14434),mo=n(96937);function ho(e,t){return t>0?(e/t*100).toFixed():0}const go=e=>{let{answer:t,voteResults:n,totalVoters:a,maxVotersCount:s,correctResults:o,shouldAnimate:r}=e;const c=n&&n.find((e=>e.option===t.option)),d=0===o.length||-1!==o.indexOf(t.option),l=o.length>0&&d||c?.isChosen,u=c?ho(c.votersCount,a||0):0,[m,h]=(0,i.eJ)(r?0:u),g=c?ho(c.votersCount,s||0):0,p=m!==u;if((0,i.d4)((()=>{r&&h(u)}),[r,u]),!n||!c)return;const f=`width: ${g}%; transform:scaleX(${p?0:1})`;return i.ZP.createElement("div",{className:"PollOption",dir:"ltr"},i.ZP.createElement("div",{className:"poll-option-share "+("100"===u?"limit-width":"")},u,"%",l&&i.ZP.createElement("span",{className:(0,ht.Z)("poll-option-chosen",!d&&"wrong",r&&"animate")},i.ZP.createElement("i",{className:(0,ht.Z)("icon",d?"icon-check":"icon-close")}))),i.ZP.createElement("div",{className:"poll-option-right"},i.ZP.createElement("div",{className:"poll-option-text",dir:"auto"},(0,ta.Z)(t.text)),i.ZP.createElement("div",{className:(0,ht.Z)("poll-option-answer",l&&!d&&"wrong")},r&&i.ZP.createElement("svg",{className:"poll-line",style:p?"":"stroke-dasharray: 100% 200%; stroke-dashoffset: -44"},i.ZP.createElement("path",{d:"M4.47 5.33v13.6a9 9 0 009 9h13"})),i.ZP.createElement("div",{className:"poll-option-line",style:f}))))},po=12*Math.PI;function fo(e){e.stopPropagation()}const Io=(0,i.X$)((0,a.c$)(((e,t)=>{let{poll:n}=t;const{recentVoterIds:a}=n.results,{users:{byId:s}}=e;return a&&0!==a.length?{recentVoterIds:a,usersById:s}:{}}))((e=>{let{message:t,poll:n,recentVoterIds:s,onSendVote:o}=e;const{loadMessage:r,openPollResults:c,requestConfetti:d}=(0,a.Sv)(),{id:l,chatId:u}=t,{summary:m,results:h}=n,[g,p]=(0,i.eJ)(!1),[f,I]=(0,i.eJ)([]),[v,w]=(0,i.eJ)(!1),[b,Z]=(0,i.eJ)(!1),[P,y]=(0,i.eJ)(!m.closed&&m.closeDate&&m.closeDate>0?Math.min(m.closeDate-(0,Ie.bp)(),m.closePeriod):0),C=(0,i.sO)(null),E=(0,i.sO)(null),{results:S,totalVoters:M}=h,R=S&&S.some((e=>e.isChosen)),k=!m.closed&&!R,T=!k&&m.isPublic&&Number(h.totalVoters)>0,A=k&&m.multipleChoice,N=S?Math.max(...S.map((e=>e.votersCount))):M,x=(0,i.Ye)((()=>S?.filter((e=>e.isCorrect)).map((e=>e.option))||[]),[S]),B=(0,i.Ye)((()=>m.answers.map((e=>({label:e.text,value:e.option,hidden:Boolean(m.quiz&&m.closePeriod&&P<=0)})))),[P,m]);(0,i.d4)((()=>{const e=n.results.results?.find((e=>e.isChosen));g&&e&&(e.isCorrect&&d(),p(!1))}),[g,n.results.results,d]),(0,i.bt)((()=>{if(P>0&&setTimeout((()=>y(P-1)),1e3),!E.current)return;P<=5&&C.current.classList.add("hurry-up");const e=(m.closePeriod-P)/m.closePeriod*po;E.current.setAttribute("stroke-dashoffset",`-${e}`)}),[P,m.closePeriod]),(0,i.d4)((()=>{m.quiz&&(P<=0||R&&!m.closed)&&r({chatId:u,messageId:l})}),[u,P,R,r,l,m.closed,m.quiz]),(0,i.d4)((()=>{let e;return m.quiz&&!m.closed&&m.closePeriod&&m.closePeriod>0&&(e=window.setTimeout((()=>{r({chatId:u,messageId:l})}),1e3*m.closePeriod)),()=>{e&&window.clearTimeout(e)}}),[k,u,r,l,m.closePeriod,m.closed,m.quiz]);const L=(0,i.Ye)((()=>{const e=(0,a.Rd)().chats.byId,t=(0,a.Rd)().users.byId;return s?s.reduce(((n,a)=>{const s=e[a],o=t[a];return o?n.push(o):s&&n.push(s),n}),[]):[]}),[s]),U=(0,It.Z)((e=>{I([e]),p(!0),Z(!0),o([e])})),j=(0,It.Z)((e=>{I(e)})),O=(0,It.Z)((()=>{p(!0),Z(!0),o(f)})),F=(0,It.Z)((()=>{c({chatId:u,messageId:l})})),_=(0,It.Z)((()=>{w(!0)})),D=(0,It.Z)((()=>{w(!1),Z(!1)}));(0,i.d4)((()=>{b&&R&&m.quiz&&h.results&&n.results.solution&&(h.results.find((e=>e.isChosen&&e.isCorrect))||w(!0))}),[R,b,h.results,m.quiz,n.results.solution]);const q=(0,qt.Z)();return i.ZP.createElement("div",{className:"Poll",dir:q.isRtl?"auto":"ltr"},v&&n.results.solution&&i.ZP.createElement(mo.Z,{message:(0,co.H)({text:n.results.solution,entities:n.results.solutionEntities}),duration:5e3,onDismiss:D,containerId:"#middle-column-portals"}),i.ZP.createElement("div",{className:"poll-question"},(0,ta.Z)(m.question,["emoji","br"])),i.ZP.createElement("div",{className:"poll-type"},q(function(e){return void 0===e.isPublic?" ":e.closed?"FinalResults":e.quiz?e.isPublic?"QuizPoll":"AnonymousQuizPoll":e.isPublic?"PublicPoll":"AnonymousPoll"}(m)),L.length>0&&i.ZP.createElement("div",{className:"poll-recent-voters"},L.map((e=>i.ZP.createElement(ks.Z,{key:e.id,size:"micro",peer:e})))),P>0&&k&&i.ZP.createElement("div",{ref:C,className:"poll-countdown"},i.ZP.createElement("span",null,(0,de.k9)(P)),i.ZP.createElement("svg",{width:"16px",height:"16px"},i.ZP.createElement("circle",{ref:E,cx:"8",cy:"8",r:6,className:"poll-countdown-progress",transform:"rotate(-90, 8, 8)","stroke-dasharray":po,"stroke-dashoffset":"0"}))),m.quiz&&n.results.solution&&!k&&i.ZP.createElement(Xt.Z,{round:!0,size:"tiny",color:"translucent",className:"poll-quiz-help",disabled:v,onClick:_,ariaLabel:"Show Solution"},i.ZP.createElement("i",{className:"icon icon-lamp"}))),k&&i.ZP.createElement("div",{className:"poll-answers",onClick:fo},A?i.ZP.createElement(lo.Z,{options:B,onChange:j,disabled:t.isScheduled||g,loadingOptions:g?f:void 0,round:!0}):i.ZP.createElement(uo.Z,{name:`poll-${l}`,options:B,onChange:U,disabled:t.isScheduled||g,loadingOption:g?f[0]:void 0})),!k&&i.ZP.createElement("div",{className:"poll-results"},m.answers.map((function(e){return i.ZP.createElement(go,{key:e.option,shouldAnimate:b||!k,answer:e,voteResults:S,totalVoters:M,maxVotersCount:N,correctResults:x})}))),!T&&!A&&i.ZP.createElement("div",{className:"poll-voters-count"},function(e,t,n){return n?e(t?"Answer":"Vote",n,"i"):e(t?"Chat.Quiz.TotalVotesEmpty":"Chat.Poll.TotalVotesResultEmpty")}(q,m.quiz,h.totalVoters)),A&&i.ZP.createElement(Xt.Z,{isText:!0,disabled:0===f.length,size:"tiny",onClick:O},q("PollSubmitVotes")),T&&i.ZP.createElement(Xt.Z,{isText:!0,size:"tiny",onClick:F},q("PollViewResults")))})));var vo=n(48035),wo=n(10088);const bo=(0,i.X$)((e=>{let{message:t,observeIntersection:n,noAvatars:s,canAutoLoad:o,canAutoPlay:r,inPreview:c,asForwarded:d,isDownloading:l=!1,isProtected:u,theme:m,onMediaClick:h,onCancelMediaTransfer:g}=e;const{openTelegramLink:p}=(0,a.Sv)(),f=(0,v.s1)(t),{isMobile:I}=(0,B.ZP)(),w=(0,qt.Z)(),b=(0,It.Z)((()=>{h()})),Z=(0,It.Z)((()=>{f&&p({url:f.url})}));if(!f)return;const{siteName:P,url:y,displayUrl:C,title:E,description:S,photo:M,video:R,type:k}=f,T=c?void 0:function(e){switch(e){case"telegram_channel_request":case"telegram_megagroup_request":case"telegram_chat_request":return"lng_view_button_request_join";case"telegram_message":return"lng_view_button_message";case"telegram_bot":return"lng_view_button_bot";case"telegram_voicechat":return"lng_view_button_voice_chat";case"telegram_livestream":return"lng_view_button_voice_chat_channel";case"telegram_megagroup":case"telegram_chat":return"lng_view_button_group";case"telegram_channel":return"lng_view_button_channel";case"telegram_user":return"lng_view_button_user";case"telegram_botapp":return"lng_view_button_bot_app";case"telegram_chatlist":return"ViewChatList";default:return}}(k),A=(0,vo.Z)(S,170),N=Boolean(A||E||P);let x=!1;if(N&&f?.photo&&!f.video){const{width:e,height:n}=ts(t,void 0,void 0,I);x=e===n}const L=(M||R)&&h&&!x,U=(0,ht.Z)("WebPage",c&&"in-preview",x&&"with-square-photo",!M&&!R&&!c&&"without-media",R&&"with-video",!N&&"no-article",T&&"with-quick-button");return i.ZP.createElement("div",{className:U,"data-initial":(P||C)[0],dir:"auto"},i.ZP.createElement("div",{className:"WebPage--content"},M&&!R&&i.ZP.createElement(ao,{message:t,observeIntersection:n,noAvatars:s,canAutoLoad:o,size:x?"pictogram":"inline",asForwarded:d,nonInteractive:!L,isDownloading:l,isProtected:u,theme:m,onClick:L?b:void 0,onCancelUpload:g}),N&&i.ZP.createElement("div",{className:"WebPage-text"},i.ZP.createElement(wo.Z,{className:"site-name",url:y,text:P||C}),!c&&E&&i.ZP.createElement("p",{className:"site-title"},(0,ta.Z)(E)),A&&i.ZP.createElement("p",{className:"site-description"},(0,ta.Z)(A,["emoji","br"]))),!c&&R&&i.ZP.createElement(oo,{message:t,observeIntersectionForLoading:n,noAvatars:s,canAutoLoad:o,canAutoPlay:r,asForwarded:d,isDownloading:l,isProtected:u,onClick:L?b:void 0,onCancelUpload:g})),T&&(j=T,i.ZP.createElement(Xt.Z,{className:"WebPage--quick-button",size:"tiny",color:"translucent-bordered",onClick:Z},w(j))));var j})),Zo=(0,i.X$)((e=>{let{message:t,shouldAffectAppendix:n,isInSelectMode:a,isSelected:s,theme:r,forcedWidth:c}=e;const d=(0,i.sO)(null),l=(0,qt.Z)(),u=(0,v.eO)(t),{title:m,text:h,amount:g,currency:p,isTest:f,photo:I}=u,w=(0,dn.Z)((0,v.O9)(I)),b=Boolean(c),Z=eo(t,!b,w);(0,Ga.Z)((e=>{let[t]=e;if(n){if(w){const e=d.current.closest(o.be_);Ks(w,!1,s,r).then((t=>{e.style.setProperty("--appendix-bg",t),e.setAttribute(o.s22,"")}))}}else t&&d.current.closest(o.be_).removeAttribute(o.s22)}),[n,w,a,s,r]);const P=c||I?.dimensions?.width,y=(0,Fn.Z)(I?.dimensions&&`width: ${P}px`,I?.dimensions&&`aspect-ratio: ${I.dimensions.width} / ${I.dimensions.height}`,Boolean(!I?.dimensions&&c)&&`width: ${c}px`);return i.ZP.createElement("div",{ref:d,className:"Invoice"},m&&i.ZP.createElement("p",{className:"title"},(0,ta.Z)(m)),h&&i.ZP.createElement("div",null,(0,ta.Z)(h,["emoji","br"])),i.ZP.createElement("div",{className:"description "+(I?"has-image":"")},Boolean(I)&&i.ZP.createElement("div",{className:"invoice-image-container"},b&&i.ZP.createElement("canvas",{ref:Z,className:"thumbnail blurred-bg"}),w&&i.ZP.createElement("img",{className:"invoice-image",src:w,alt:"",style:y,crossOrigin:"anonymous"}),!w&&I&&i.ZP.createElement(Us.Z,{width:P,height:I.dimensions?.height,forceAspectRatio:!0})),i.ZP.createElement("p",{className:"description-text"},(0,mt.x)(g,p,l.code),f&&i.ZP.createElement("span",null,l("PaymentTestInvoice")))))})),Po={root:"rwnm0xOh31c2MY4kK2No",duration:"lKSp02aI8WDGX3393nkh",buy:"gxQfWp0jp0_2Z4qWiXKN",spoiler:"z2tB5Vd_jKJ9IYX4Nijd"},yo=(0,i.X$)((e=>{let{message:t,isConnected:n}=e;const{openInvoice:s,loadExtendedMedia:o}=(0,a.Sv)(),r=(0,qt.Z)(),c=(0,v.eO)(t),{chatId:d,id:l}=t,u=(0,It.Z)((()=>{o({chatId:d,ids:[l]})}));(0,Rt.Z)(u,n?3e4:void 0);const{amount:m,currency:h,extendedMedia:g}=c,{width:p,height:f,thumbnail:I,duration:w}=g,b=(0,It.Z)((()=>{s({chatId:d,messageId:l,isExtendedMedia:!0})}));return i.ZP.createElement("div",{className:(0,ht.Z)(Po.root,"media-inner"),onClick:b},i.ZP.createElement(la.Z,{thumbDataUri:I?.dataUri,width:p,height:f,isVisible:!0,className:Po.spoiler}),Boolean(w)&&i.ZP.createElement("div",{className:Po.duration},(0,de.k9)(w)),i.ZP.createElement("div",{className:Po.buy},i.ZP.createElement("i",{className:(0,ht.Z)("icon","icon-lock",Po.lock)}),r("Checkout.PayPrice",(0,mt.x)(m,h))))})),Co=new Map(Object.entries({"building/medical":"#43b3f4","building/gym":"#43b3f4","education/cafeteria":"#f7943f","travel/bedandbreakfast":"#9987ff","travel/hotel":"#9987ff","travel/hostel":"#9987ff","travel/resort":"#9987ff","travel/hotel_bar":"#e56dd6",arts_entertainment:"#e56dd6",building:"#6e81b2",education:"#a57348",event:"#959595",food:"#f7943f",home:"#00aeef",nightlife:"#e56dd6",parks_outdoors:"#6cc039",shops:"#ffb300",travel:"#1c9fff",work:"#ad7854"})),Eo=["#e56cd5","#f89440","#9986ff","#44b3f5","#6dc139","#ff5d5a","#f87aad","#6e82b3","#f5ba21"],So=n.p+"map-pin.899635f6fe777c28998a.svg",Mo=24*Math.PI,Ro=1e-4,ko={width:400,height:300,zoom:16,scale:2};function To(){return i.ZP.createElement("svg",{className:"round-pin",style:"enable-background:new 0 0 64 64",viewBox:"0 0 64 64"},i.ZP.createElement("circle",{cx:"32",cy:"32",r:"24.5"}),i.ZP.createElement("path",{d:"M32 8c13.23 0 24 10.77 24 24S45.23 56 32 56 8 45.23 8 32 18.77 8 32 8m0-1C18.19 7 7 18.19 7 32s11.19 25 25 25 25-11.19 25-25S45.81 7 32 7z"}),i.ZP.createElement("path",{d:"m29.38 57.67-1.98-1.59 3.02-1.66L32 51.54l1.58 2.88 3.02 1.66-1.91 1.53L32 60.73z"}),i.ZP.createElement("path",{d:"m32 52.58 1.07 1.95.14.26.26.14 2.24 1.22-1.33 1.06-.07.06-.06.07L32 59.96l-2.24-2.61-.06-.07-.07-.06-1.33-1.06 2.24-1.22.26-.14.14-.26L32 52.58m0-2.08-1.94 3.56L26.5 56l2.5 2 3 3.5 3-3.5 2.5-2-3.56-1.94L32 50.5z"}))}const Ao=(0,i.X$)((e=>{let{message:t,peer:n}=e;const{openUrl:s}=(0,a.Sv)(),o=(0,i.sO)(null),r=(0,i.sO)(null),d=(0,qt.Z)(),l=(0,Et.Z)(),u=(0,v.nf)(t),{type:m,geo:h}=u,g=(0,Ie.bp)(),p=(0,v.$R)(t),f="geoLive"!==m||p?void 0:t.date+u.period-g,[I,w]=(0,i.eJ)(h),b="venue"===m||"geoLive"===m&&!p,{width:Z,height:P,zoom:y,scale:C}=ko,E=(0,v.k6)(I,Z,P,y,C),S=(0,dn.Z)(E),M=(0,Hn.Z)(S,!0),R=S||M,k=(0,i.Ye)((()=>{if("geoLive"!==m||!I.accuracyRadius)return 0;const{lat:e,accuracyRadius:t}=I;return t/function(e,t){return 156543.03392*Math.cos(e*(Math.PI/180))/2**t}(e,y)}),[m,I,y]),T=(0,It.Z)((e=>{if("geoLive"!==m)return;const n=e.lastElementChild,a=e.firstElementChild,s=t.date+u.period-(0,Ie.bp)(),o=(1-s/u.period)*Mo,i=(0,de.mB)(d,1e3*s);a.textContent=i,n.firstElementChild.setAttribute("stroke-dashoffset",`-${o}`)}));return(0,i.bt)((()=>{r.current&&T(r.current)}),[T]),(0,i.d4)((()=>{Math.abs(h.lat-I.lat)<Ro&&Math.abs(h.long-I.long)<Ro?I.accuracyRadius!==h.accuracyRadius&&w({...I,accuracyRadius:h.accuracyRadius}):w(h)}),[h,I]),(0,Tt.Z)((()=>{l()}),p?void 0:1e3*(f||0)),(0,Rt.Z)((()=>{(0,c.WM)((()=>{const e=r.current;e&&T(e)}))}),f?1e3:void 0),i.ZP.createElement("div",{ref:o,className:"Location media-inner interactive",onClick:()=>{const e=function(e,t,n){return`https://maps.google.com/maps/place/${e}+${t}/@${e},${t},${n}z`}(I.lat,I.long,y);s({url:e})}},i.ZP.createElement("div",{className:"map-wrapper"},R?i.ZP.createElement("img",{className:"full-media map",src:R,alt:"Location on a map",style:`width: ${ko.width}px; height: ${ko.height}px;`}):i.ZP.createElement(Us.Z,{width:Z,height:P}),function(){if(R)return i.ZP.createElement(i.ZP.Fragment,null,Boolean(k)&&!p&&i.ZP.createElement("div",{className:"location-accuracy",style:`width: ${2*k}px; height: ${2*k}px`}),function(){const e=(0,ht.Z)("pin",m,p&&"expired");if("geoLive"===m)return i.ZP.createElement("div",{className:e},i.ZP.createElement(To,null),i.ZP.createElement(ks.Z,{peer:n,className:"location-avatar"}),void 0!==u.heading&&i.ZP.createElement("div",{className:"direction",style:`--direction: ${u.heading}deg`}));if("venue"===m){const t=function(e){return e?Co.get(e)||Co.get(e.split("/")[0])||Eo[(t=e,t.split("").reduce(((e,t)=>(e<<5)-e+t.charCodeAt(0)|0),0)%Eo.length)]:"#008df2";var t}(u.venueType),n=function(e){return e?`https://ss3.4sqi.net/img/categories_v2/${e}_88.png`:""}(u.venueType);if(n)return i.ZP.createElement("div",{className:e,style:`--pin-color: ${t}`},i.ZP.createElement(To,null),i.ZP.createElement("img",{src:n,className:"venue-icon",alt:""}))}return i.ZP.createElement("img",{className:e,src:So,alt:""})}())}()),function(){if(b)return"venue"===m?i.ZP.createElement("div",{className:"location-info"},i.ZP.createElement("div",{className:"location-info-title"},u.title),i.ZP.createElement("div",{className:"location-info-subtitle"},u.address)):"geoLive"===m?i.ZP.createElement("div",{className:"location-info"},i.ZP.createElement("div",{className:"location-info-title"},d("AttachLiveLocation")),i.ZP.createElement("div",{className:"location-info-subtitle"},(0,de.dJ)(d,g,t.editDate)),!p&&i.ZP.createElement("div",{className:"geo-countdown",ref:r},i.ZP.createElement("span",{className:"geo-countdown-text"}),i.ZP.createElement("svg",{width:"32px",height:"32px"},i.ZP.createElement("circle",{cx:"16",cy:"16",r:12,className:"geo-countdown-progress",transform:"rotate(-90, 16, 16)","stroke-dasharray":Mo,"stroke-dashoffset":"0"})))):void 0}())})),No=(0,i.X$)((e=>{let{message:t,canAutoLoadMedia:n}=e;const{clickBotInlineButton:s}=(0,a.Sv)(),o=t.content.game,{title:r,description:c}=o,d=(0,v.N)(o),l=(0,v.Wc)(o),u=(0,dn.Z)(d,!n),m=(0,dn.Z)(l,!n);return i.ZP.createElement("div",{className:"Game"},i.ZP.createElement("div",{className:"preview",style:"width: 480px; height: 270px",onClick:()=>{s({messageId:t.id,button:t.inlineButtons[0][0]})}},!u&&!m&&i.ZP.createElement(Us.Z,{className:"skeleton preview-content"}),u&&i.ZP.createElement("img",{className:"preview-content",src:u,alt:r}),m&&i.ZP.createElement("video",{className:"preview-content",playsInline:!0,muted:!0,disablePictureInPicture:!0,autoPlay:!0,loop:!0,src:m})),i.ZP.createElement("div",{className:"title"},r),!(0,v.UD)(t)&&i.ZP.createElement("div",{className:"description"},c))}));function xo(e){return(0,i.X$)((0,a.c$)(((e,t)=>{const{message:n}=t;return{isInSelectMode:(0,f.CA)(e),isSelected:(0,f.vk)(e,n.id)}}))((t=>{const{isInSelectMode:n,isSelected:s,message:o,dimensions:r}=t,{toggleMessageSelection:c}=(0,a.Sv)(),d=(0,It.Z)((e=>{e.stopPropagation(),c({messageId:o.id,withShift:e?.shiftKey})})),l=(0,i.Ye)((()=>{const{dimensions:e,onClick:a}=t;return{...t,isInSelectMode:n,isSelected:s,dimensions:{...e,x:0,y:0},onClick:n?void 0:a}}),[t,n,s]);return i.ZP.createElement("div",{className:(0,ht.Z)("album-item-select-wrapper",s&&"is-selected"),style:r?`left: ${r.x}px; top: ${r.y}px;`:"",onClick:n?d:void 0},n&&i.ZP.createElement("div",{className:"message-select-control"},s&&i.ZP.createElement("i",{className:"icon icon-select"})),i.ZP.createElement(e,l))})))}const Bo=xo(ao),Lo=xo(oo),Uo=(0,a.c$)(((e,t)=>{let{album:n}=t;const{chatId:a}=n.mainMessage,s=(0,f.Pu)(e),o=(0,f.f2)(e,a),i=n.mainMessage.isScheduled;return{theme:s,uploadsById:e.fileUploads.byMessageLocalId,activeDownloadIds:i?o?.scheduledIds:o?.ids}}))((e=>{let{album:t,observeIntersection:n,hasCustomAppendix:s,isOwn:o,isProtected:r,albumLayout:c,onMediaClick:d,uploadsById:l,activeDownloadIds:u,theme:m}=e;const{cancelSendingMessage:h}=(0,a.Sv)(),g=t.messages.length,p=(0,It.Z)((e=>{h({chatId:e.chatId,messageId:e.id})})),{width:I,height:w}=c.containerStyle;return i.ZP.createElement("div",{className:"Album",style:`width: ${I}px; height: ${w}px;`},t.messages.map((function(e,t){const{photo:h,video:I}=(0,v.qp)(e),w=l[(0,v.KK)(e)]?.progress,{dimensions:b,sides:Z}=c.layout[t],P=(0,f.bH)((0,a.Rd)(),e),y=(0,f.__)((0,a.Rd)(),e);if(h){const a=s&&(o?t===g-1:Boolean(8&Z&&4&Z));return i.ZP.createElement(Bo,{id:`album-media-${(0,v.d0)(e.id)}`,message:e,observeIntersectionForLoading:n,canAutoLoad:P,shouldAffectAppendix:a,uploadProgress:w,dimensions:b,isProtected:r,onClick:d,onCancelUpload:p,isDownloading:u?.includes(e.id),theme:m})}if(I)return i.ZP.createElement(Lo,{id:`album-media-${(0,v.d0)(e.id)}`,message:e,observeIntersectionForLoading:n,canAutoLoad:P,canAutoPlay:y,uploadProgress:w,dimensions:b,isProtected:r,onClick:d,onCancelUpload:p,isDownloading:u?.includes(e.id),theme:m})})))})),jo=E.Rj/2,Oo=2*(jo-6)*Math.PI;let Fo;const _o=e=>{let{message:t,observeIntersection:n,canAutoLoad:s,isDownloading:o}=e;const r=(0,i.sO)(null),c=(0,i.sO)(null),d=(0,i.sO)(null),l=t.content.video,m=(0,Wa.Op)(r,n),[h,g]=(0,i.eJ)(s),p=Boolean(h&&m),{mediaData:f,loadProgress:I}=(0,Xs.Z)((0,v.Ti)(t,"inline"),!p,(0,v.kG)(t,"inline")),{loadProgress:w}=(0,Xs.Z)((0,v.Ti)(t,"download"),!o,u.IU.BlobUrl),[b,Z]=(0,At.Z)(),P=!Boolean((0,v.DH)(t))||b,y=eo(t,P),C=(0,to.Z)(!P),S=h&&!b||o,M=!1===(0,Hn.Z)(h),{shouldRender:R,transitionClassNames:k}=(0,St.Z)(S,void 0,M),[T,A]=(0,i.eJ)(!1),[N,x]=(0,Wn.Z)(0),B=(0,Ya.WR)(N,16);(0,i.d4)((()=>{if(!T)return;const e=c.current;x(e.currentTime/e.duration)}),[x,T,B]),(0,i.bt)((()=>{if(!T||!d.current)return;const e=Oo-B()*Oo;d.current.setAttribute("stroke-dashoffset",e.toString())}),[T,B]);const L=Boolean(f&&m),U=(0,It.Z)((()=>{c.current&&(A(!1),x(0),(0,Gs.Z)(c.current))})),j=(0,It.Z)((()=>{Fo?.(),Fo=U})),O=(0,It.Z)((()=>{if(!f)return void g((e=>!e));if(o)return void(0,a.Sv)().cancelMessageMediaDownload({message:t});const e=c.current;T?e.paused?((0,Gs.Z)(e),(0,fa.Es)()):e.pause():(j(),e.pause(),e.currentTime=0,(0,Gs.Z)(e),(0,fa.Es)(),A(!0))})),F=(0,It.Z)((e=>{const t=e.currentTarget;x(t.currentTime/t.duration)}));return i.ZP.createElement("div",{ref:r,className:"RoundVideo media-inner",onClick:O},f&&i.ZP.createElement("div",{className:"video-wrapper"},i.ZP.createElement(so.Z,{canPlay:L,ref:c,src:f,className:"full-media",width:E.Rj,height:E.Rj,autoPlay:!0,disablePictureInPicture:!0,muted:!T,loop:!T,playsInline:!0,onEnded:T?U:void 0,onTimeUpdate:T?F:void 0,onReady:Z})),i.ZP.createElement("canvas",{ref:y,className:(0,ht.Z)("thumbnail",C),style:`width: ${E.Rj}px; height: ${E.Rj}px`}),i.ZP.createElement("div",{className:"progress"},T&&i.ZP.createElement("svg",{width:E.Rj,height:E.Rj},i.ZP.createElement("circle",{ref:d,cx:jo,cy:jo,r:jo-6,className:"progress-circle",transform:`rotate(-90, ${jo}, ${jo})`,"stroke-dasharray":Oo,"stroke-dashoffset":Oo}))),R&&i.ZP.createElement("div",{className:`media-loading ${k}`},i.ZP.createElement(no.Z,{progress:o?w:I})),!f&&!h&&i.ZP.createElement("i",{className:"icon icon-download"}),i.ZP.createElement("div",{className:"message-media-duration"},T?(0,de.k9)(c.current.currentTime):(0,de.k9)(l.duration),(!T||c.current.paused)&&i.ZP.createElement("i",{className:"icon icon-muted"})))},Do=e=>{let{message:t,onClick:n}=e;const a=(0,qt.Z)();return i.ZP.createElement("div",{className:"InlineButtons"},t.inlineButtons.map((e=>i.ZP.createElement("div",{className:"row"},e.map((e=>i.ZP.createElement(Xt.Z,{size:"tiny",ripple:!0,disabled:"unsupported"===e.type,onClick:()=>n({messageId:t.id,button:e})},i.ZP.createElement("span",{className:"inline-button-text"},(0,ta.Z)(a(e.text))),(e=>{const{type:t}=e;switch(t){case"url":if(!o.FSu.test(e.url))return i.ZP.createElement("i",{className:"icon icon-arrow-right"});break;case"urlAuth":return i.ZP.createElement("i",{className:"icon icon-arrow-right"});case"buy":case"receipt":return i.ZP.createElement("i",{className:"icon icon-cart"});case"switchBotInline":return i.ZP.createElement("i",{className:"icon icon-share-filled"});case"webView":case"simpleWebView":return i.ZP.createElement("i",{className:"icon icon-webapp"})}})(e))))))))},qo=(0,i.X$)((e=>{let{threadInfo:t,disabled:n}=e;const{openComments:s}=(0,a.Sv)(),o=(0,qt.Z)(),{threadId:r,chatId:c,messagesCount:d,lastMessageId:l,lastReadInboxMessageId:u,recentReplierIds:m,originChannelId:h}=t,g=(0,It.Z)((()=>{s({id:c,threadId:r,originChannelId:h})})),p=(0,i.Ye)((()=>{if(!m?.length)return;const{users:{byId:e},chats:{byId:t}}=(0,a.Rd)();return m.map((n=>(0,v.YC)(n)?e[n]:t[n])).filter(Boolean)}),[m]);if(void 0===d)return;const f=Boolean(u&&l&&u<l),I=d?o("Comments","%COMMENTS_COUNT%",void 0,d).split("%").map((e=>"COMMENTS_COUNT"===e?i.ZP.createElement(ua.Z,{text:(0,Bt.bi)(d)}):e)):void 0;return i.ZP.createElement("div",{"data-cnt":(0,Bt.bi)(d),className:(0,ht.Z)("CommentButton",f&&"has-unread",n&&"disabled"),dir:o.isRtl?"rtl":"ltr",onClick:g},i.ZP.createElement("i",{className:"icon icon-comments-sticker"}),(!p||0===p.length)&&i.ZP.createElement("i",{className:"icon icon-comments"}),Boolean(p?.length)&&i.ZP.createElement("div",{className:"recent-repliers",dir:o.isRtl?"rtl":"ltr"},p.map((e=>i.ZP.createElement(ks.Z,{key:e.id,size:"small",peer:e})))),i.ZP.createElement("div",{className:"label",dir:"auto"},d?I:o("LeaveAComment")),i.ZP.createElement("i",{className:"icon icon-next"}))}));var $o=n(65351),Ho=n(60422),Go=n(48198);const Vo={root:"JY0NZH9bysPBqR3sIbLu","animated-icon":"WTrBqa2uxq57nYJAIelk",animatedIcon:"WTrBqa2uxq57nYJAIelk",effect:"z9v8vlAIGxI3ITxuyEG1",animating:"sB0FGOzwkiDvNWHWcVEL"},Wo=2.5*E.Gw,zo=6.5*E.Gw,Yo=(0,i.X$)((e=>{let{reaction:t,genericEffects:n,activeReactions:s,availableReactions:o,observeIntersection:r,withEffects:c}=e;const{stopActiveReaction:d}=(0,a.Sv)(),l=(0,i.sO)(null),u="documentId"in t,m=(0,i.Ye)((()=>o?.find((e=>(0,v.Hl)(e.reaction,t)))),[o,t]),h=m?.centerIcon?.id,{customEmoji:g}=(0,Ho.Z)(u?t.documentId:void 0),p=(0,i.Ye)((()=>{if(!u)return m?.aroundAnimation?.id;if(!g)return;const e=o?.find((e=>e.reaction.emoticon===g.emoji))?.aroundAnimation?.id;return e}),[m,o,g,u]),f=(0,i.Ye)((()=>{if(p)return p;if(!n?.stickers)return;const{stickers:e}=n;return e[Math.floor(Math.random()*e.length)].id}),[p,n]),I=(0,Wa.Op)(l,r),w=h&&`sticker${h}`,b=f&&`sticker${f}`,Z=(0,dn.Z)(w,!h),P=(0,dn.Z)(b,!f),y=(0,i.Ye)((()=>s?.find((e=>(0,v.Hl)(e.reaction,t)))),[s,t]),C=Boolean(c&&y&&(u||Z)&&P),{shouldRender:E,transitionClassNames:S}=(0,St.Z)(C,void 0,!0,"slow"),M=(0,It.Z)((()=>{y?.messageId&&d({messageId:y.messageId,reaction:t})})),[R,k,T]=(0,At.Z)(),A=!(u||C&&R),N=(0,ht.Z)(Vo.root,E&&Vo.animating,u&&Vo.isCustomEmoji);return i.ZP.createElement("div",{className:N,ref:l},A&&i.ZP.createElement(Go.Z,{reaction:t,availableReactions:o}),u&&i.ZP.createElement(rn.Z,{documentId:t.documentId,className:Vo.customEmoji,observeIntersectionForPlaying:r}),E&&i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement($s.Z,{key:f,className:(0,ht.Z)(Vo.effect,S),size:zo,tgsUrl:P,play:I,noLoop:!0,forceOnHeavyAnimation:!0,onEnded:M}),u?!p&&I&&i.ZP.createElement(un,{reaction:t}):i.ZP.createElement($s.Z,{key:h,className:(0,ht.Z)(Vo.animatedIcon,S),size:Wo,tgsUrl:Z,play:I,noLoop:!0,forceOnHeavyAnimation:!0,onLoad:k,onEnded:T})))})),Jo=(0,i.X$)((e=>{let{reaction:t,message:n,activeReactions:s,availableReactions:o,withRecentReactors:r,withEffects:c,genericEffects:d,observeIntersection:l}=e;const{toggleReaction:u}=(0,a.Sv)(),{recentReactions:m}=n.reactions,h=(0,i.Ye)((()=>{if(!r||!m)return;const e=(0,a.Rd)().chats.byId,n=(0,a.Rd)().users.byId;return m.filter((e=>(0,v.Hl)(e.reaction,t.reaction))).map((t=>n[t.peerId]||e[t.peerId])).filter(Boolean)}),[t.reaction,m,r]),g=(0,It.Z)((()=>{u({reaction:t.reaction,chatId:n.chatId,messageId:n.id})}));return i.ZP.createElement(Xt.Z,{className:(0,ht.Z)((0,v.Bt)(t)&&"chosen"),size:"tiny",onClick:g},i.ZP.createElement(Yo,{activeReactions:s,reaction:t.reaction,availableReactions:o,genericEffects:d,observeIntersection:l,withEffects:c}),h?.length?i.ZP.createElement($o.Z,{size:"mini",peers:h}):i.ZP.createElement(ua.Z,{text:(0,Bt.bi)(t.count),className:"counter"}))})),Ko=(0,i.X$)((e=>{let{message:t,isOutside:n,maxWidth:a,activeReactions:s,availableReactions:o,metaChildren:r,genericEffects:c,observeIntersection:d,noRecentReactors:l,withEffects:u}=e;const m=(0,qt.Z)(),h=(0,i.Ye)((()=>t.reactions.results.reduce(((e,t)=>e+t.count),0)),[t]);return i.ZP.createElement("div",{className:(0,ht.Z)("Reactions",n&&"is-outside"),style:a?`max-width: ${a}px`:void 0,dir:m.isRtl?"rtl":"ltr"},t.reactions.results.map((e=>i.ZP.createElement(Jo,{key:(0,v.$d)(e.reaction),reaction:e,message:t,activeReactions:s,availableReactions:o,withRecentReactors:h<=3&&!l,genericEffects:c,observeIntersection:d,withEffects:u}))),r)})),Xo=(0,i.X$)((e=>{let{phoneCall:t,message:n,chatId:o}=e;const{requestMasterAndRequestCall:r}=(0,a.Sv)(),c=(0,qt.Z)(),{isOutgoing:d,isVideo:l,reason:u,duration:m}=t,h="missed"===u,g="busy"===u||void 0===m,p=(0,It.Z)((()=>{r({isVideo:l,userId:o})})),f=(0,i.Ye)((()=>l?h?d?"CallMessageVideoOutgoingMissed":"CallMessageVideoIncomingMissed":g?"CallMessageVideoIncomingDeclined":d?"CallMessageVideoOutgoing":"CallMessageVideoIncoming":h?d?"CallMessageOutgoingMissed":"CallMessageIncomingMissed":g?"CallMessageIncomingDeclined":d?"CallMessageOutgoing":"CallMessageIncoming"),[g,h,d,l]),I=(0,i.Ye)((()=>t.duration?(0,de.J_)(c,t.duration):void 0),[c,t.duration]),v=(0,de.mr)(c,1e3*n.date);return i.ZP.createElement("div",{className:"vDeypQzM845_JE14qGId"},i.ZP.createElement(Xt.Z,{size:"smaller",color:"translucent",round:!0,ripple:!0,onClick:p,className:"OtJi45yywgt1n_y6VPkE",disabled:!s.Bi,ariaLabel:c(d?"CallAgain":"CallBack")},i.ZP.createElement("i",{className:(0,ht.Z)("icon",l?"icon-video-outlined":"icon-phone")})),i.ZP.createElement("div",{className:"_0BG8sziTJQ_NYrsspMg"},i.ZP.createElement("div",{className:"LWVSvxVjeEyHPBrCb2sD"},c(f)),i.ZP.createElement("div",{className:"nuIsoCP15iD4ETadJ44R"},i.ZP.createElement("i",{className:(0,ht.Z)("icon","icon-arrow-right","wrUkWet7enyh9L1iPKvA",h&&"V5tKkKZpcY5yq_f5nO8l",g&&"Q7dh9ssyXXCzatPRmIDv",!d&&"e0Vhbj8gfzQn1zJQoFLK")}),i.ZP.createElement("span",{className:"TJ2lYkLxYUie3A0JqtMR"},I?c("CallMessageWithDuration",[v,I]):v))))}));var Qo=n(78780),ei=n(50685),ti=n(14612),ni=n(98138),ai=n(2995);var si=n(69123);const oi=1.125*E.Gw,ii=(0,i.X$)((e=>{let{topic:t,className:n,onClick:a}=e;const s=(0,qt.Z)();return i.ZP.createElement("div",{className:(0,ht.Z)("wUl1jHjVuMxmGhsdl358",n),style:`--topic-button-accent-color: var(${(0,ni.gZ)(t?.iconColor)})`,onClick:a},t?i.ZP.createElement(ai.Z,{topic:t,size:oi}):i.ZP.createElement("img",{src:si,alt:""}),t?.title?(0,ta.Z)(t.title):s("Loading"),t?.isClosed&&i.ZP.createElement("i",{className:"icon icon-lock"}),i.ZP.createElement("i",{className:"icon icon-next"}))})),ri=1.75*E.Gw,ci=2.25*E.Gw;function di(e){let{isOwn:t}=e;const n=t?"M6 17H0V0c.193 2.84.876 5.767 2.05 8.782.904 2.325 2.446 4.485 4.625 6.48A1 1 0 016 17z":"M3 17h6V0c-.193 2.84-.876 5.767-2.05 8.782-.904 2.325-2.446 4.485-4.625 6.48A1 1 0 003 17z";return i.ZP.createElement("svg",{width:"9",height:"20",className:"svg-appendix"},i.ZP.createElement("defs",null,i.ZP.createElement("filter",{x:"-50%",y:"-14.7%",width:"200%",height:"141.2%",filterUnits:"objectBoundingBox",id:"messageAppendix"},i.ZP.createElement("feOffset",{dy:"1",in:"SourceAlpha",result:"shadowOffsetOuter1"}),i.ZP.createElement("feGaussianBlur",{stdDeviation:"1",in:"shadowOffsetOuter1",result:"shadowBlurOuter1"}),i.ZP.createElement("feColorMatrix",{values:"0 0 0 0 0.0621962482 0 0 0 0 0.138574144 0 0 0 0 0.185037364 0 0 0 0.15 0",in:"shadowBlurOuter1"}))),i.ZP.createElement("g",{fill:"none","fill-rule":"evenodd"},i.ZP.createElement("path",{d:n,fill:"#000",filter:"url(#messageAppendix)"}),i.ZP.createElement("path",{d:n,fill:t?"#EEFFDE":"FFF",className:"corner"})))}const li=(0,i.X$)((0,a.c$)(((e,t)=>{const{focusedMessage:n,forwardMessages:a,activeReactions:i,activeEmojiInteractions:r}=(0,f.jU)(e),{message:c,album:d,withSenderName:l,withAvatar:m,threadId:h,messageListType:g,isLastInDocumentGroup:p,isFirstInGroup:I}=t,{id:w,chatId:b,viaBotId:Z,replyToChatId:P,replyToMessageId:y,isOutgoing:C,repliesThreadInfo:E,forwardInfo:S,transcriptionId:M,isPinned:R}=c,k=(0,f.Z1)(e,b),T=(0,f.FM)(e,b),A=(0,v.pK)(b),N=k&&(0,v.eA)(k),x=k&&(0,v.Bf)(k),B=k?.usernames,L=(0,v.YC)(b)?void 0:(0,f.x6)(e,b),U=a.messageIds&&a.messageIds.includes(w),j=!T&&(0,v.Ul)(c),O=l||m||j,F=(0,f.Ur)(e,c),_=(0,f.cv)(e,c),D=Z?(0,f.dy)(e,Z):void 0,q=F?.id&&x?L?.adminMembersById?.[F?.id]:void 0,$=h?(0,f.qS)(e,b,h):void 0,H=c.id===$,G=y===$,V=y&&!G?(0,f.hj)(e,A&&P?P:b,y):void 0,W=V&&(0,f.Bz)(e,V,Boolean(S)),z="topicCreate"===V?.content.action?.type,Y=(0,f.uZ)(e,c),J="thread"===g&&(d?d.messages.some((t=>(0,f._X)(e,t,h))):(0,f._X)(e,c,h)),{direction:K,noHighlight:X,isResizingContainer:Q}=J&&n||{},{query:ee}=(0,f.n5)(e)||{},te=(0,v.h_)(c),ne=te&&(0,f.zB)(e,te)?te:void 0,ae=(0,v.HW)(c);let se;se=d?.messages?d.messages.every((t=>{let{id:n}=t;return(0,f.vk)(e,n)})):(0,f.vk)(e,w);const{canReply:oe}="thread"===g&&(0,f._k)(e,c,h)||{},ie=(0,f.te)(e,c),re=E?(0,f.tZ)(e,E.chatId,E.threadId)||E:void 0,ce=Boolean(c.groupedId)&&!c.isInAlbum,de=ce?(0,f.xH)(e,b,c.groupedId)[0]:void 0,le=ce?p?(0,f.hj)(e,b,de):void 0:c,ue=k?.unreadReactions?.includes(c.id),me=h===u._f&&k?.isForum&&I,he=me?(0,f.p$)(e,c)||k?.topics?.[o.OxA]:void 0,ge=Boolean((0,v.nf)(c)),pe=(0,f.xf)(e,b),fe=(0,f.Bd)(e,b,c.id),Ie=(0,f.lp)(e,b),ve=s.SX&&e.settings.byKey.canTranslate&&!Ie,we="connectionStateReady"===e.connectionState;return{theme:(0,f.Pu)(e),chatUsernames:B,forceSenderName:j,canShowSender:O,originSender:_,botSender:D,shouldHideReply:G||z,isThreadTop:H,replyMessage:V,replyMessageSender:W,isInDocumentGroup:ce,isProtected:(0,f.EV)(e,c),isChatProtected:(0,f.Am)(e,b),isFocused:J,isForwarding:U,reactionMessage:le,isChatWithSelf:T,isRepliesChat:A,isChannel:N,isGroup:x,canReply:oe,highlight:ee,animatedEmoji:ne,animatedCustomEmoji:ae,isInSelectMode:(0,f.CA)(e),isSelected:se,isGroupSelected:Boolean(c.groupedId)&&!c.isInAlbum&&(0,f.a6)(e,b,c.groupedId),threadId:h,isDownloading:ie,isPinnedList:"pinned"===g,isPinned:R,canAutoLoadMedia:(0,f.bH)(e,c),canAutoPlayMedia:(0,f.__)(e,c),autoLoadFileMaxSizeMb:e.settings.byKey.autoLoadFileMaxSizeMb,shouldLoopStickers:(0,f.Cy)(e),repliesThreadInfo:re,availableReactions:e.availableReactions,defaultReaction:(0,v.CI)(c)||"scheduled"===g?void 0:(0,f.q6)(e,b),activeReactions:le&&i[le.id],activeEmojiInteractions:r,hasUnreadReaction:ue,isTranscribing:void 0!==M&&e.transcriptions[M]?.isPending,transcribedText:void 0!==M?e.transcriptions[M]?.text:void 0,isPremium:(0,f.wV)(e),senderAdminMember:q,messageTopic:he,genericEffects:e.genericEmojiEffects,hasTopicChip:me,chatTranslations:pe,areTranslationsEnabled:ve,shouldDetectChatLanguage:(0,f.J1)(e,b),requestedTranslationLanguage:fe,requestedChatTranslationLanguage:Ie,hasLinkedChat:Boolean(L?.linkedChatId),withReactionEffects:(0,f.$Y)(e,"reactionEffects"),withStickerEffects:(0,f.$Y)(e,"stickerEffects"),isConnected:we,...(O||ge)&&{sender:F},...C&&{outgoingStatus:(0,f.dT)(e,c,"scheduled"===g)},..."number"==typeof Y&&{uploadProgress:Y},...J&&{focusDirection:K,noFocusHighlight:X,isResizingContainer:Q}}}))((e=>{let{message:t,chatUsernames:n,observeIntersectionForBottom:r,observeIntersectionForLoading:d,observeIntersectionForPlaying:l,album:h,noAvatars:g,withAvatar:p,withSenderName:f,noComments:I,noReplies:w,appearanceOrder:b,isJustAdded:Z,isFirstInGroup:P,isPremium:y,isLastInGroup:C,isFirstInDocumentGroup:S,isLastInDocumentGroup:M,isTranscribing:R,transcribedText:k,isLastInList:T,theme:A,forceSenderName:N,sender:x,canShowSender:L,originSender:U,botSender:j,isThreadTop:O,shouldHideReply:F,replyMessage:_,replyMessageSender:D,outgoingStatus:q,uploadProgress:$,isInDocumentGroup:H,isProtected:G,isChatProtected:V,isFocused:W,focusDirection:z,noFocusHighlight:Y,isResizingContainer:J,isForwarding:K,isChatWithSelf:X,isRepliesChat:Q,isChannel:ee,isGroup:te,canReply:ne,highlight:ae,animatedEmoji:se,animatedCustomEmoji:oe,genericEffects:ie,hasLinkedChat:re,isInSelectMode:ce,isSelected:de,isGroupSelected:le,threadId:ue,reactionMessage:me,availableReactions:he,defaultReaction:ge,activeReactions:pe,activeEmojiInteractions:fe,messageListType:Ie,isPinnedList:ve,isPinned:we,isDownloading:be,canAutoLoadMedia:Ze,canAutoPlayMedia:Pe,shouldLoopStickers:ye,autoLoadFileMaxSizeMb:Ce,repliesThreadInfo:Ee,hasUnreadReaction:Se,memoFirstUnreadIdRef:Me,senderAdminMember:Re,messageTopic:ke,hasTopicChip:Te,chatTranslations:Ae,areTranslationsEnabled:Ne,shouldDetectChatLanguage:xe,requestedTranslationLanguage:Be,requestedChatTranslationLanguage:Le,withReactionEffects:Ue,withStickerEffects:je,isConnected:Oe,onPinnedIntersectionChange:Fe}=e;const{toggleMessageSelection:_e,clickBotInlineButton:De,disableContextMenuHint:qe,animateUnreadReaction:$e,focusLastMessage:He}=(0,a.Sv)(),Ge=(0,i.sO)(null),Ve=(0,i.sO)(null),We=(0,i.sO)(null),ze=(0,i.sO)(0),Ye=(0,qt.Z)(),[Je,Ke]=(0,i.eJ)(!1),[Xe,Qe,et]=(0,At.Z)(),{isMobile:tt,isTouchScreen:nt}=(0,B.ZP)();(0,Wa._N)(Ve,r);const{isContextMenuOpen:at,contextMenuPosition:st,contextMenuTarget:ot,handleBeforeContextMenu:it,handleContextMenu:rt,handleContextMenuClose:ct,handleContextMenuHide:dt}=(0,Ra.Z)(Ge,nt&&ce,!o.D$V,s.wZ);(0,i.d4)((()=>{at&&qe()}),[at,qe]);const lt=b<=0,[ut,mt]=(0,At.Z)(lt);(0,i.d4)((()=>{lt||setTimeout(mt,10*b)}),[b,mt,lt]);const{transitionClassNames:gt}=(0,St.Z)(ut||Z,void 0,lt&&!Z,!1),{id:pt,chatId:ft,forwardInfo:vt,viaBotId:wt,isTranscriptionError:bt}=t;(0,i.d4)((()=>{if(!we)return;const e=h?h.mainMessage.id:pt;return()=>{Fe({viewportPinnedIdsToRemove:[e],isUnmount:!0})}}),[h,we,pt,Fe]);const Zt=(0,v.CI)(t),Pt=(0,v.B4)(t),yt="scheduled"===Ie||t.isScheduled,Ct=(0,v.ss)(t)&&!F,Et=Boolean(Ee)&&"thread"===Ie,Rt=(0,v.$D)(t),kt=Rt&&(se||oe),Tt=me?.reactions&&!(0,v.JE)(me.reactions),Nt=vt&&(!X||yt)&&!Q&&!vt.isLinkedChannelPost&&!Rt,xt=Boolean(h)&&h.messages.length>1&&!h?.messages.some((e=>0===Object.keys(e.content).length)),Bt=H&&!S,Lt=H&&!M,Ut=void 0!==st,jt=!(Ut||ce||K||Lt),Ot=ee&&!yt&&t.isForwardingAllowed&&!V,Ft=Boolean(ve||vt&&(vt.isChannelPost||X&&!Pt||Q)&&vt.fromMessageId),_t=Te||Ct,Dt=(0,It.Z)(((e,t)=>{_e({messageId:pt,groupedId:t,...e?.shiftKey&&{withShift:!0},...xt&&{childMessageIds:h.messages.map((e=>{let{id:t}=e;return t}))}})})),$t=L?x:void 0,Ht=Boolean(!Je&&(bt||k)),Gt=vt&&(X||Q||!$t)?U:$t,Vt=vt?U:$t,{handleMouseDown:Wt,handleClick:zt,handleContextMenu:Yt,handleDoubleClick:Jt,handleContentDoubleClick:Kt,handleMouseMove:Qt,handleSendQuickReaction:en,handleMouseLeave:tn,isSwiped:nn,isQuickReactionVisible:an,handleDocumentGroupMouseEnter:sn}=hs(Dt,Ge,pt,Boolean(ce),Boolean(ne),Boolean(G),rt,it,ft,Ut,We,Lt),{handleAvatarClick:on,handleSenderClick:dn,handleViaBotClick:ln,handleReplyClick:un,handleMediaClick:mn,handleAudioPlay:hn,handleAlbumMediaClick:gn,handleMetaClick:pn,handleTranslationClick:fn,handleOpenThread:In,handleReadMedia:vn,handleCancelUpload:wn,handleVoteSend:bn,handleGroupForward:Zn,handleForward:Pn,handleFocus:yn,handleFocusForwarded:Cn,handleDocumentGroupSelectAll:En,handleTopicChipClick:Sn}=function(e,t,n,s,o,i,r,c,d,l,h,g,p,f,I){const{openChat:v,showNotification:w,focusMessage:b,openMediaViewer:Z,openAudioPlayer:P,markMessagesRead:y,cancelSendingMessage:C,sendPollVote:E,openForwardMenu:S,focusMessageInComments:M,openChatLanguageModal:R}=(0,a.Sv)(),{id:k,forwardInfo:T,replyToMessageId:A,replyToChatId:N,replyToTopMessageId:x,groupedId:B}=n,L=(0,It.Z)((()=>{h&&v({id:h.id})})),U=(0,It.Z)((()=>{g?r&&T?.channelPostId?b({chatId:g.id,messageId:T.channelPostId}):v({id:g.id}):w({message:e("HidAccount")})})),j=(0,It.Z)((()=>{p&&v({id:p.id})})),O=(0,It.Z)((()=>{b({chatId:d&&N?N:s,threadId:o,messageId:A,replyMessageId:d&&N?void 0:k,noForumTopicPanel:!0})})),F=(0,It.Z)((()=>{Z({chatId:s,threadId:o,mediaId:k,origin:c?m.bZ.ScheduledInline:m.bZ.Inline})})),_=(0,It.Z)((()=>{P({chatId:s,messageId:k})})),D=(0,It.Z)((e=>{Z({chatId:s,threadId:o,mediaId:e,origin:c?m.bZ.ScheduledAlbum:m.bZ.Album})})),q=(0,It.Z)((()=>{y({messageIds:[k]})})),$=(0,It.Z)((()=>{C({chatId:s,messageId:k})})),H=(0,It.Z)((e=>{E({chatId:s,messageId:k,options:e})})),G=(0,It.Z)((()=>{S({fromChatId:s,groupedId:B})})),V=(0,It.Z)((()=>{if(l&&l.messages){const e=l.messages.map((e=>{let{id:t}=e;return t}));S({fromChatId:s,messageIds:e})}else S({fromChatId:s,messageIds:[k]})})),W=(0,It.Z)((()=>{b({chatId:s,threadId:u._f,messageId:k})})),z=(0,It.Z)((()=>{i?b({chatId:T.fromChatId,groupedId:B,groupedChatId:s,messageId:T.fromMessageId}):d&&N?M({chatId:N,threadId:x,messageId:T.fromMessageId}):b({chatId:T.fromChatId,messageId:T.fromMessageId})})),Y=(0,It.Z)((e=>{e.stopPropagation(),t(e,B)}));return{handleAvatarClick:L,handleSenderClick:U,handleViaBotClick:j,handleReplyClick:O,handleMediaClick:F,handleAudioPlay:_,handleAlbumMediaClick:D,handleMetaClick:Y,handleTranslationClick:(0,It.Z)((e=>{e.stopPropagation(),R({chatId:s,messageId:I?void 0:k})})),handleOpenThread:(0,It.Z)((()=>{v({id:n.chatId,threadId:n.id})})),handleReadMedia:q,handleCancelUpload:$,handleVoteSend:H,handleGroupForward:G,handleForward:V,handleFocus:W,handleFocusForwarded:z,handleDocumentGroupSelectAll:Y,handleTopicChipClick:(0,It.Z)((()=>{f&&b({chatId:d&&N?N:s,threadId:f.id,messageId:k})}))}}(Ye,Dt,t,ft,ue,H,Nt,yt,Q,h,Gt,Vt,j,ke,Boolean(Le));(0,i.d4)((()=>{T&&Ht&&k&&He()}),[He,T,k,Ht]);const Mn=(0,ht.Z)("Message message-list-item text-selection",P&&"first-in-group",G&&"is-protected",C&&"last-in-group",S&&"first-in-document-group",M&&"last-in-document-group",T&&"last-in-list",Pt&&"own",Boolean(t.views)&&"has-views",t.isEdited&&"was-edited",Ct&&"has-reply",at&&"has-menu-open",W&&!Y&&"focused",K&&"is-forwarding",t.isDeleting&&"is-deleting",H&&"is-in-document-group",xt&&"is-album",t.hasUnreadMention&&"has-unread-mention",de&&"is-selected",ce&&"is-in-selection-mode",O&&!p&&"is-thread-top",Boolean(t.inlineButtons)&&"has-inline-buttons",nn&&"is-swiped",gt,Z&&"is-just-added",(Boolean(pe)||Xe)&&"has-active-reaction"),{text:Rn,photo:kn,video:Tn,audio:An,voice:Nn,document:xn,sticker:Bn,contact:Ln,poll:Un,webPage:jn,invoice:On,location:Fn,action:_n,game:Dn}=(0,v.qp)(t);!function(e,t){const n=!t&&e.chatId!==o.awM,a=Boolean(e.content.text?.text.length),s=Ps(e.content.text?.text,!n);n&&function(e,t,n,a){const s=Ms.get(e)||new Ss(150),o=s.get(t);o&&o.detectedLanguage===a&&o.isTranslatable===n||(s.set(t,{id:t,isTranslatable:n,detectedLanguage:a}),Ms.set(e,s),Rs(e))}(e.chatId,e.id,a,s)}(t,!xe);const qn=Ps(Ne?Rn?.text:void 0),$n=(0,v.cT)(t,!Le),{isPending:Gn,translatedText:Vn}=Is(Ae,ft,$n?pt:void 0,Be),Wn=(0,Hn.Z)(Vn,Boolean($n)),zn=Vn||Wn,{phoneCall:Jn}=_n||{},Kn=(Ee||re&&ee&&Zt)&&!Lt&&"thread"===Ie&&!I,Xn=Ee&&!Lt&&"thread"===Ie&&!I,Qn=!nt&&!Jn&&!ce&&ge&&!Lt,ea=function(e){let{hasSubheader:t,isCustomShape:n,isLastInGroup:a,asForwarded:s,hasThread:i,forceSenderName:r,hasComments:c,hasActionButton:d,hasReactions:l,isGeoLiveActive:u,withVoiceTranscription:m}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{text:h,photo:g,video:p,audio:f,voice:I,document:w,poll:b,webPage:Z,contact:P,location:y,invoice:C}=(0,v.qp)(e),E=[o.gnl],S=g||p||y||C?.extendedMedia,M=h||"venue"===y?.type||u,R=S&&!M,k=Boolean(e.viaBotId);return!S&&e.emojiOnlyCount?(E.push("emoji-only"),e.emojiOnlyCount<=o.L5X&&E.push(`emoji-only-${e.emojiOnlyCount}`)):M?E.push("text"):E.push("no-text"),d&&E.push("has-action-button"),n&&(E.push("custom-shape"),p?.isRound&&E.push("round"),c&&E.push("has-comments")),S?E.push("media"):f?E.push("audio"):I?(E.push("voice"),m&&E.push("with-voice-transcription")):w?E.push("document"):P?E.push("contact"):b?E.push("poll"):Z&&(E.push("web-page"),(Z.photo||Z.video)&&E.push("media")),C&&!C.extendedMedia&&E.push("invoice"),s&&E.push("is-forwarded"),t&&E.push("has-subheader"),i&&E.push("has-replies"),l&&E.push("has-reactions"),k&&E.push("is-via-bot"),r&&E.push("force-sender-name"),n||(E.push("has-shadow"),S&&c&&E.push("has-background"),(t||s||k||!R||r)&&E.push("has-solid-background"),a&&(g||!R||y&&s)&&E.push("has-appendix")),E.join(" ")}(t,{hasSubheader:_t,isCustomShape:Rt,isLastInGroup:C,asForwarded:Nt,hasThread:Et&&!I,forceSenderName:N,hasComments:Ee&&Ee.messagesCount>0,hasActionButton:Ot||Ft,hasReactions:Tt,isGeoLiveActive:"geoLive"===Fn?.type&&!(0,v.$R)(t),withVoiceTranscription:Ht}),na=ea.includes("has-appendix"),aa=(0,v.fY)(t),sa=(0,is.qo)(t.emojiOnlyCount);let oa,ia;oa=Jn||Lt?"none":!aa||jn||sa?"standalone":"in-text",Tt?Rt||(kn||Tn||Fn&&"geo"===Fn.type)&&!aa?ia="outside":Nt?(oa="standalone",ia="inside"):ia="inside":ia="none";const ra=Rt?"in-meta":"in-content";(0,Yn.Z)(Q&&t.replyToChatId?t.replyToChatId:ft,Ct?t.replyToMessageId:void 0,_,t.id),rs(Ge,ft,W,z,Y,J,Z);const ca=ee&&t.postAuthorTitle||!Nt&&vt?.postAuthorTitle||void 0;!function(e,t){(0,i.bt)((()=>{t&&(0,c.lT)((()=>{const t=e.current.querySelector(".message-signature")?.offsetWidth;if(t)return()=>{e.current.style.setProperty("--meta-safe-author-width",`${t}px`)}}))}),[e,t])}(Ge,ca);const da=T,la=(0,It.Z)((e=>{const t=ze.current,n=e.contentRect.height;if(ze.current=n,(0,Da.Ni)()||!t||n<=t)return;const a=e.target.closest(".MessageList");if(!a)return;(0,Mt.YW)(400);const s=n-t,{offsetHeight:o,scrollHeight:i,scrollTop:r}=a;Math.round(i-r-o)-s<=5&&He()})),ua=(0,ds.Z)(la,[la],300,!1);(0,Va.Z)(Ge,ua,!da),(0,i.d4)((()=>{const e=Ve.current;Se&&e&&(0,os.P)(e)&&$e({messageIds:[pt]})}),[Se,pt,$e]);let ma,ha,ga,pa="",fa=!1;const Ia=(0,i.Ye)((()=>xt?ss(Pt,Boolean(Nt),Boolean(g),h,tt):void 0),[xt,Pt,Nt,g,h,tt]),va=Nt?28:0;if(!xt&&(kn||Tn||On?.extendedMedia)){let e;if(kn)e=ts(t,Nt,g,tt).width;else if(Tn)e=Tn.isRound?E.Rj:ts(t,Nt,g,tt).width;else if(On?.extendedMedia&&On.extendedMedia.width&&On.extendedMedia.height){const{width:t,height:n}=On.extendedMedia;e=(0,E.Kf)({width:t,height:n,fromOwnMessage:Pt,asForwarded:Nt,noAvatars:g,isMobile:tt}).width}e&&(e<Ka&&(ga=e),ma=Math.max(es(Rn?.text,Kn),e),On?.extendedMedia&&ma-e>18&&(fa=!0))}else Ia&&(ma=Math.max(es(Rn?.text,Kn),Ia.containerStyle.width),ma-Ia.containerStyle.width>18&&(fa=!0));if(ma)pa=`width: ${ma+va}px`,ha=ma+ci;else if(Bn&&!_t){const{width:e}=(0,E.Wr)(Bn,tt);pa=`width: ${e+va}px`,ha=e+ci}function wa(e){return i.ZP.createElement(ti.Z,{message:t,translatedText:Be?zn:void 0,isForAnimation:e,emojiSize:sa,highlight:ae,isProtected:G,observeIntersectionForLoading:d,observeIntersectionForPlaying:l,withTranslucentThumbs:Rt})}const ba=(0,i.I4)((()=>{if(ge)return i.ZP.createElement("div",{className:(0,ht.Z)("quick-reaction",an&&!pe&&"visible"),onClick:en,ref:We},i.ZP.createElement(Go.Z,{reaction:ge,size:ri,availableReactions:he,observeIntersection:l}))}),[pe,he,ge,en,an,l]);function Za(){const e=i.ZP.createElement(Ds,{message:t,isPinned:we,noReplies:w,repliesThreadInfo:Ee,outgoingStatus:q,signature:ca,withReactionOffset:"inside"===ia,renderQuickReactionButton:Qn&&"in-meta"===ra?ba:void 0,availableReactions:he,isTranslated:Boolean(Be?zn:void 0),onClick:pn,onTranslationClick:fn,onOpenThread:In});return"inside"!==ia?e:i.ZP.createElement(Ko,{activeReactions:pe,message:me,metaChildren:e,availableReactions:he,genericEffects:ie,observeIntersection:l,noRecentReactors:ee,withEffects:Ue})}const Pa=te&&Nt?t.postAuthorTitle:void 0,ya=(0,i.Ye)((()=>n?.find((e=>e.isActive))),[n]);return i.ZP.createElement("div",{ref:Ge,id:(0,v.d0)(t.id),className:Mn,"data-message-id":pt,onMouseDown:Wt,onClick:zt,onContextMenu:Yt,onDoubleClick:Jt,onMouseEnter:Lt?sn:void 0,onMouseMove:Qn?Qt:void 0,onMouseLeave:Qn||Lt?tn:void 0},i.ZP.createElement("div",{ref:Ve,className:"bottom-marker","data-message-id":pt,"data-last-message-id":h?h.messages[h.messages.length-1].id:void 0,"data-album-main-id":h?h.mainMessage.id:void 0,"data-has-unread-mention":t.hasUnreadMention||void 0,"data-has-unread-reaction":Se||void 0,"data-is-pinned":we||void 0,"data-should-update-views":void 0!==t.views}),!H&&i.ZP.createElement("div",{className:"message-select-control"},de&&i.ZP.createElement("i",{className:"icon icon-select"})),M&&i.ZP.createElement("div",{className:(0,ht.Z)("message-select-control group-select",le&&"is-selected"),onClick:En},le&&i.ZP.createElement("i",{className:"icon icon-select"})),p&&function(){const e=!Gt&&vt?vt.hiddenUserName:void 0;return i.ZP.createElement(ks.Z,{size:tt?"small-mobile":"small",peer:Gt,text:e,onClick:Gt?on:void 0})}(),i.ZP.createElement("div",{className:(0,ht.Z)("message-content-wrapper",ea.includes("text")&&"can-select-text")},i.ZP.createElement("div",{className:ea,style:pa,dir:"auto"},Nt&&!Bt&&i.ZP.createElement("div",{className:"message-title"},Ye("ForwardedMessage"),Pa&&i.ZP.createElement("span",{className:"admin-title",dir:"auto"},Pa)),function(){const e=(0,ht.Z)("content-inner",Nt&&"forwarded-message",_t&&"with-subheader",fa&&"no-media-corners"),n=C&&!aa&&!Nt&&!Xn,a=(0,ht.Z)("text-content","clearfix","in-text"===oa&&"with-meta",q&&"with-outgoing-icon");return i.ZP.createElement("div",{className:e,onDoubleClick:Kt,dir:"auto"},function(){if(Rt&&!wt||!(f&&(!(kn||Tn||Fn)||Te)||Nt||wt||N)||Bt||Ct&&Rt)return;let e,n;!Vt||Rt&&wt?vt?.hiddenUserName&&(e=vt.hiddenUserName):(e=(0,v.OU)(Ye,Vt),Nt||Pt||(n=`color-${(0,v.Rs)(Vt)}`));const a=Vt&&"emojiStatus"in Vt&&Vt.emojiStatus,s=Vt&&"isPremium"in Vt&&Vt.isPremium;return i.ZP.createElement("div",{className:"message-title",dir:"ltr"},e?i.ZP.createElement("span",{className:(0,ht.Z)("message-title-name interactive",n),onClick:dn,dir:"ltr"},(0,ta.Z)(e),!Nt&&a&&i.ZP.createElement(rn.Z,{documentId:a.documentId,loopLimit:o.y3O,observeIntersectionForLoading:d,observeIntersectionForPlaying:l}),!Nt&&!a&&s&&i.ZP.createElement(cn.Z,null),Vt?.fakeType&&i.ZP.createElement(ei.Z,{fakeType:Vt.fakeType})):j?void 0:" ",j&&i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement("span",{className:"via"},Ye("ViaBot")),i.ZP.createElement("span",{className:"interactive",onClick:ln},(0,ta.Z)(`@${j.usernames[0].username}`))),vt?.isLinkedChannelPost?i.ZP.createElement("span",{className:"admin-title",dir:"auto"},Ye("DiscussChannel")):t.forwardInfo?.postAuthorTitle&&te&&Nt?i.ZP.createElement("span",{className:"admin-title",dir:"auto"},t.forwardInfo?.postAuthorTitle):t.postAuthorTitle&&te&&!Nt?i.ZP.createElement("span",{className:"admin-title",dir:"auto"},t.postAuthorTitle):!Re||Nt||wt?void 0:i.ZP.createElement("span",{className:"admin-title",dir:"auto"},Re.customTitle||Ye(Re.isOwner?"GroupInfo.LabelOwner":"GroupInfo.LabelAdmin")))}(),_t&&i.ZP.createElement("div",{className:"message-subheader"},Te&&i.ZP.createElement(ii,{topic:ke,onClick:Sn,className:"message-topic"}),Ct&&i.ZP.createElement(js,{message:_,noUserColors:Pt||ee,isProtected:G,sender:D,chatTranslations:Ae,requestedChatTranslationLanguage:Le,observeIntersectionForLoading:d,observeIntersectionForPlaying:l,onClick:un})),Bn&&i.ZP.createElement(Hs,{message:t,observeIntersection:d,observeIntersectionForPlaying:l,shouldLoop:ye,shouldPlayEffect:Bn.hasEffect&&(Me.current&&pt>=Me.current||Zt)||void 0,withEffect:je,onPlayEffect:Qe,onStopEffect:et}),kt&&oe&&i.ZP.createElement(Ys,{customEmojiId:oe,withEffects:je&&(0,v.YC)(ft),isOwn:Pt,observeIntersection:d,forceLoadPreview:Zt,messageId:pt,chatId:ft,activeEmojiInteractions:fe}),kt&&se&&i.ZP.createElement(zs,{emoji:se,withEffects:je&&(0,v.YC)(ft),isOwn:Pt,observeIntersection:d,forceLoadPreview:Zt,messageId:pt,chatId:ft,activeEmojiInteractions:fe}),xt&&i.ZP.createElement(Uo,{album:h,albumLayout:Ia,observeIntersection:d,isOwn:Pt,isProtected:G,hasCustomAppendix:n,onMediaClick:gn}),Jn&&i.ZP.createElement(Xo,{message:t,phoneCall:Jn,chatId:ft}),!xt&&kn&&i.ZP.createElement(ao,{message:t,observeIntersection:d,noAvatars:g,canAutoLoad:Ze,uploadProgress:$,shouldAffectAppendix:n,isDownloading:be,isProtected:G,asForwarded:Nt,theme:A,forcedWidth:ga,onClick:mn,onCancelUpload:wn}),!xt&&Tn&&Tn.isRound&&i.ZP.createElement(_o,{message:t,observeIntersection:d,canAutoLoad:Ze,isDownloading:be}),!xt&&Tn&&!Tn.isRound&&i.ZP.createElement(oo,{message:t,observeIntersectionForLoading:d,observeIntersectionForPlaying:l,forcedWidth:ga,noAvatars:g,canAutoLoad:Ze,canAutoPlay:Pe,uploadProgress:$,isDownloading:be,isProtected:G,asForwarded:Nt,onClick:mn,onCancelUpload:wn}),(An||Nn)&&i.ZP.createElement(Fs.ZP,{theme:A,message:t,origin:m.Cr.Inline,uploadProgress:$,isSelectable:H,isSelected:de,noAvatars:g,onPlay:hn,onReadMedia:!Nn||Pt&&!X?void 0:vn,onCancelUpload:wn,isDownloading:be,isTranscribing:R,isTranscriptionHidden:Je,isTranscribed:Boolean(k),isTranscriptionError:bt,canDownload:!G,onHideTranscription:Ke,canTranscribe:y}),xn&&i.ZP.createElement(Os.Z,{message:t,observeIntersection:d,canAutoLoad:Ze,autoLoadFileMaxSizeMb:Ce,uploadProgress:$,isSelectable:H,isSelected:de,onMediaClick:mn,onCancelUpload:wn,isDownloading:be}),Ln&&i.ZP.createElement(ro,{contact:Ln}),Un&&i.ZP.createElement(Io,{message:t,poll:Un,onSendVote:bn}),Dn&&i.ZP.createElement(No,{message:t,canAutoLoadMedia:Ze}),On?.extendedMedia&&i.ZP.createElement(yo,{message:t,isConnected:Oe}),Ht&&i.ZP.createElement("p",{className:(0,ht.Z)("transcription",!Je&&bt&&"transcription-error"),dir:"auto"},bt?Ye("NoWordsRecognized"):R&&k?i.ZP.createElement(Qo.Z,{content:k}):k),!kt&&aa&&i.ZP.createElement("div",{className:a,dir:"auto"},wa(),Gn&&i.ZP.createElement("div",{className:"translation-animation"},i.ZP.createElement("div",{className:"text-loading"},wa(!0))),"in-text"===oa&&Za()),jn&&i.ZP.createElement(bo,{message:t,observeIntersection:d,noAvatars:g,canAutoLoad:Ze,canAutoPlay:Pe,asForwarded:Nt,isDownloading:be,isProtected:G,theme:A,onMediaClick:mn,onCancelMediaTransfer:wn}),On&&!On.extendedMedia&&i.ZP.createElement(Zo,{message:t,shouldAffectAppendix:n&&!Tt,isInSelectMode:ce,isSelected:de,theme:A,forcedWidth:ga}),Fn&&i.ZP.createElement(Ao,{message:t,isInSelectMode:ce,isSelected:de,theme:A,peer:x}))}(),!Lt&&"standalone"===oa&&Za(),jt&&Ot?i.ZP.createElement(Xt.Z,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:Ye("lng_context_forward_msg"),onClick:M?Zn:Pn},i.ZP.createElement("i",{className:"icon icon-share-filled"})):jt&&Ft?i.ZP.createElement(Xt.Z,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:"Focus message",onClick:ve?yn:Cn},i.ZP.createElement("i",{className:"icon icon-arrow-right"})):void 0,Xn&&i.ZP.createElement(qo,{threadInfo:Ee,disabled:I}),na&&i.ZP.createElement(di,{isOwn:Pt}),Qn&&"in-content"===ra&&ba()),t.inlineButtons&&i.ZP.createElement(Do,{message:t,onClick:De}),"outside"===ia&&i.ZP.createElement(Ko,{message:me,isOutside:!0,maxWidth:ha,activeReactions:pe,availableReactions:he,genericEffects:ie,observeIntersection:l,noRecentReactors:ee,withEffects:Ue})),st&&i.ZP.createElement(As,{isOpen:at,anchor:st,targetHref:ot?.matches("a[href]")?ot.href:void 0,message:t,album:h,chatUsername:ya?.username,messageListType:Ie,onClose:ct,onCloseAnimationEnd:dt,repliesThreadInfo:Ee,noReplies:w,detectedLanguage:qn}))}))),ui=e=>{const{isOpen:t}=e,n=(0,Nt.Z)(ft.gl.Extra,"AboutAdsModal",!t);return n?i.ZP.createElement(n,e):void 0},mi=e=>{const{isOpen:t}=e,n=(0,Nt.Z)(ft.gl.Extra,"SponsoredMessageContextMenuContainer",!t);return n?i.ZP.createElement(n,e):void 0},hi=(0,i.X$)((0,a.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,f.fS)(e,n),{chatId:s,isBot:o}=a||{};return{message:a,bot:s&&o?(0,f.dy)(e,s):void 0,channel:!o&&s?(0,f.Z1)(e,s):void 0}}))((e=>{let{chatId:t,message:n,containerRef:o,bot:r,channel:c}=e;const{viewSponsoredMessage:d,openChat:l,openChatByInvite:u,startBot:m,focusMessage:h}=(0,a.Sv)(),g=(0,qt.Z)(),p=(0,i.sO)(null),f=(0,i.sO)(null),I=Boolean(n),{observe:w}=(0,Wa.S1)({rootRef:o,debounceMs:200,threshold:1}),{isContextMenuOpen:b,contextMenuPosition:Z,handleBeforeContextMenu:P,handleContextMenu:y,handleContextMenuClose:C,handleContextMenuHide:E}=(0,Ra.Z)(p,s.$b,!0,s.wZ),[S,M,R]=(0,At.Z)(!1);(0,i.d4)((()=>I?w(f.current,(e=>{e.isIntersecting&&d({chatId:t})})):void 0),[t,I,w,d]);const k=(0,It.Z)((()=>{n&&(n.chatInviteHash?u({hash:n.chatInviteHash}):n.channelPostId?h({chatId:n.chatId,messageId:n.channelPostId}):(l({id:n.chatId}),n.startParam&&m({botId:n.chatId,param:n.startParam})))}));if(n)return i.ZP.createElement("div",{ref:p,key:"sponsored-message",className:"SponsoredMessage Message open",onMouseDown:e=>{(0,Fa.q)(e),P(e)},onContextMenu:y},i.ZP.createElement("div",{className:"message-content has-shadow has-solid-background",dir:"auto"},i.ZP.createElement("div",{className:"content-inner",dir:"auto"},i.ZP.createElement("div",{className:"message-title",dir:"ltr"},r&&(0,ta.Z)((0,v.Js)(r)||""),c&&(0,ta.Z)(n.chatInviteTitle||(0,v.U)(g,c)||"")),i.ZP.createElement("div",{className:"text-content with-meta",dir:"auto",ref:f},i.ZP.createElement("span",{className:"text-content-inner",dir:"auto"},(0,co.H)({text:n.text.text,entities:n.text.entities})),i.ZP.createElement("span",{className:"MessageMeta",dir:"ltr"},i.ZP.createElement("span",{className:"message-signature"},n.isRecommended?g("Message.RecommendedLabel"):g("SponsoredMessage")))),i.ZP.createElement(Xt.Z,{color:"secondary",size:"tiny",ripple:!0,onClick:k,className:"SponsoredMessage__button"},g(n.isBot?"Conversation.ViewBot":n.channelPostId?"Conversation.ViewPost":"Conversation.ViewChannel")))),Z&&i.ZP.createElement(mi,{isOpen:b,anchor:Z,message:n,onAboutAds:M,onClose:C,onCloseAnimationEnd:E}),i.ZP.createElement(ui,{isOpen:S,onClose:R}))}))),gi=(0,i.X$)((0,a.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,f.kB)(e,n);let s,o=!1;if(a){const t=(0,f.iF)(e,a.id);t?s=t.botInfo:o=!0}return{botInfo:s,isLoadingBotInfo:o}}))((e=>{let{botInfo:t,isLoadingBotInfo:n,isInMessageList:a}=e;const o=(0,qt.Z)(),r=(0,dn.Z)(t?.photo?(0,v.NF)(t.photo):void 0),c=(0,dn.Z)(t?.gif?(0,v.ym)(t.gif):void 0),d=t?.photo?(0,v.bV)(t.photo):t?.gif?(0,v.jC)(t.gif):void 0,l=d&&{width:d.width/s.cL,height:d.height/s.cL},u=t&&!t.description&&!t.gif&&!t.photo,{width:m,height:h}=l||{};if(!u&&!n||!a)return i.ZP.createElement("div",{className:(0,ht.Z)("Lsq8MNpDNQOesVld_hE2","empty")},n&&i.ZP.createElement("span",null,o("Loading")),u&&!n&&i.ZP.createElement("span",null,o("NoMessages")),t&&i.ZP.createElement("div",{className:"QDlMH9oNVNDnHBMnbvhw",style:l&&`width: ${l.width}px`},r&&i.ZP.createElement("img",{src:r,width:l?.width,height:l?.height,alt:"Bot info"}),c&&i.ZP.createElement(so.Z,{canPlay:!0,src:c,loop:!0,disablePictureInPicture:!0,muted:!0,playsInline:!0,style:(0,Fn.Z)(Boolean(m)&&`width: ${m}px`,Boolean(h)&&`height: ${h}px`)}),d&&!r&&!c&&i.ZP.createElement(Us.Z,{width:l?.width,height:l?.height}),t.description&&i.ZP.createElement("div",{className:"qhxnNXJM8_CyuUQ0pxo7"},i.ZP.createElement("p",{className:"mdOWgfW0GwJTT3vqO5_M"},o("BotInfoTitle")),(0,ta.Z)(t.description,["br","emoji","links"]))))}))),pi=(0,i.X$)((e=>{let{isCurrentUserPremium:t,chatId:n,threadId:r,messageIds:d,messageGroups:l,getContainerHeight:h,isViewportNewest:p,isUnread:f,isComments:w,withUsers:b,isChannelChat:Z,noAvatars:P,containerRef:y,anchorIdRef:C,memoUnreadDividerBeforeIdRef:E,memoFirstUnreadIdRef:S,type:M,isReady:R,threadTopMessageId:k,hasLinkedChat:T,isSchedule:A,shouldRenderBotInfo:N,noAppearanceAnimation:x,onFabToggle:L,onNotchToggle:U,onPinnedIntersectionChange:j}=e;const{openHistoryCalendar:O}=(0,a.Sv)(),{observeIntersectionForReading:F,observeIntersectionForLoading:_,observeIntersectionForPlaying:D}=function(e,t,n,s,o){const{markMessageListRead:i,markMentionsRead:r,animateUnreadReaction:c,scheduleForViewsIncrement:d}=(0,a.Sv)(),{isMobile:l}=(0,B.ZP)(),u=l?300:500,{observe:m,freeze:h,unfreeze:g}=(0,Wa.S1)({rootRef:t,throttleMs:150},(t=>{if("thread"!==e||(0,vt.q)())return;let a=0;const l=[],u=[],m=[],h=[],g=[];let p=!1;t.forEach((e=>{const{isIntersecting:t,target:n,boundingClientRect:s,rootBounds:o}=e,{dataset:i}=n,r=Number(i.lastMessageId||i.messageId),c="true"===i.shouldUpdateViews,d=i.albumMainId?Number(i.albumMainId):void 0;t?(r>a&&(a=r),i.hasUnreadMention&&l.push(r),i.hasUnreadReaction&&u.push(r),i.isPinned&&m.push(d||r),c&&g.push(d||r)):i.isPinned&&(o&&s.bottom<o.top&&(p=!0),h.push(d||r))})),n.current&&a>=n.current&&i({maxId:a}),l.length&&r({messageIds:l}),u.length&&c({messageIds:u}),(m.length||h.length)&&s({viewportPinnedIdsToAdd:m,viewportPinnedIdsToRemove:h,isReversed:p}),g.length&&d({chatId:o,ids:g})}));(0,vt.Z)(h,g);const{observe:p}=(0,Wa.S1)({rootRef:t,throttleMs:Ja,margin:u}),{observe:f}=(0,Wa.S1)({rootRef:t,throttleMs:Ja});return{observeIntersectionForReading:m,observeIntersectionForLoading:p,observeIntersectionForPlaying:f}}(M,y,S,j,n),{withHistoryTriggers:q,backwardsTriggerRef:$,forwardsTriggerRef:H,fabTriggerRef:G}=function(e,t,n,o,r,d,l,u,h){const{loadViewportMessages:g}=(0,a.Sv)(),[p,f]=(0,i.Ye)((()=>"thread"===e?[(0,I.Ds)((()=>g({direction:m.Uq.Backwards})),1e3,!0,!1),(0,I.Ds)((()=>g({direction:m.Uq.Forwards})),1e3,!0,!1)]:[]),[g,n]),w=(0,i.sO)(null),b=(0,i.sO)(null),Z=(0,i.sO)(null),P=(0,It.Z)((()=>{if(!h)return;if(!n?.length)return l(!1),void u(!1);if(!r)return l(!0),void u(!0);const e=t.current;if(!e)return;const{offsetHeight:a,scrollHeight:s,scrollTop:o}=e,i=Math.round(s-o-a),c=i<=1;0!==s&&(l(d?!c:!(i<=50)),u(!c))})),{observe:y}=(0,Wa.S1)({rootRef:t,margin:s.gZ},(e=>{f&&p&&((0,v.AJ)(n[0])||e.forEach((e=>{let{isIntersecting:t,target:n}=e;t&&("backwards-trigger"===n.className&&p(),"forwards-trigger"===n.className&&f())})))})),C=n&&n.length>1;(0,Wa._N)(w,C?y:void 0),(0,Wa._N)(b,C?y:void 0);const{observe:E,freeze:S,unfreeze:M}=(0,Wa.S1)({rootRef:t,margin:100,throttleScheduler:c.i$},P);(0,Wa._N)(Z,E);const{observe:R,freeze:k,unfreeze:T}=(0,Wa.S1)({rootRef:t,margin:1,throttleScheduler:c.i$},P);(0,Wa._N)(Z,R),(0,i.d4)((()=>{h&&P()}),[h,P]);const A=(0,It.Z)((()=>{S(),k(),setTimeout((()=>{T(),M()}),350)}));(0,bt.Z)(A,[A,n]);const N=(0,Ya.Vr)(o,200);return(0,za.b)(A,[A,N]),{withHistoryTriggers:C,backwardsTriggerRef:w,forwardsTriggerRef:b,fabTriggerRef:Z}}(M,y,d,h,p,f,L,U,R),V=(0,qt.Z)(),W=i.ZP.createElement("div",{className:(0,ht.Z)("unread-divider","local-action-message"),key:"unread-messages"},i.ZP.createElement("span",null,V("UnreadMessages"))),z=x?0:l.reduce(((e,t)=>e+t.senderGroups.flat().length),0);let Y=0;const J=(0,Hn.Z)(d),K=Boolean(d&&J&&d[d.length-2]===J[J.length-1]),X=l.map(((e,t,n)=>{const a=e.senderGroups.map(((e,a,s)=>{if(1===e.length&&!ja(e[0])&&(0,v.FT)(e[0])&&!e[0].content.action?.phoneCall){const o=e[0],c=a===s.length-1&&t===n.length-1;return(0,g.oA)([o.id===E.current&&W,i.ZP.createElement(Ls,{key:o.id,message:o,threadId:r,messageListType:M,isInsideTopic:Boolean(r&&r!==u._f),observeIntersectionForReading:F,observeIntersectionForLoading:_,observeIntersectionForPlaying:D,memoFirstUnreadIdRef:S,appearanceOrder:z-++Y,isJustAdded:c&&K,isLastInList:c,onPinnedIntersectionChange:j})])}let o;return e.map(((c,d)=>{const l=ja(c)?c.mainMessage:c,m=ja(c)?c:void 0,h=(0,v.B4)(l),p=ja(c),f=e[d+1];l.previousLocalId&&C.current===(0,v.d0)(l.previousLocalId)&&(C.current=(0,v.d0)(l.id));const I=!p&&l.groupedId?l.groupedId:void 0,y=f&&!ja(f)?f.groupedId:void 0,R={isFirstInGroup:0===d,isLastInGroup:d===e.length-1,isFirstInDocumentGroup:Boolean(I&&I!==o),isLastInDocumentGroup:Boolean(I&&I!==y),isLastInList:d===e.length-1&&a===s.length-1&&t===n.length-1};o=I;const A=(0,v.KK)(l),N=(0,v.jM)(l)?`${l.date}_${A}`:A,x=!1===T||!Z,B=l.id===k;return(0,g.oA)([l.id===E.current&&W,i.ZP.createElement(li,{key:N,message:l,observeIntersectionForBottom:F,observeIntersectionForLoading:_,observeIntersectionForPlaying:D,album:m,noAvatars:P,withAvatar:R.isLastInGroup&&b&&!h&&(!B||!w),withSenderName:R.isFirstInGroup&&b&&!h,threadId:r,messageListType:M,noComments:x,noReplies:!x||r!==u._f||"scheduled"===M,appearanceOrder:z-++Y,isJustAdded:R.isLastInList&&K,isFirstInGroup:R.isFirstInGroup,isLastInGroup:R.isLastInGroup,isFirstInDocumentGroup:R.isFirstInDocumentGroup,isLastInDocumentGroup:R.isLastInDocumentGroup,isLastInList:R.isLastInList,memoFirstUnreadIdRef:S,onPinnedIntersectionChange:j}),l.id===k&&i.ZP.createElement("div",{className:"local-action-message",key:"discussion-started"},i.ZP.createElement("span",null,V("DiscussionStarted")))])})).flat()}));return i.ZP.createElement("div",{className:"message-date-group",key:e.datetime,onMouseDown:Fa.q,teactFastList:!0},i.ZP.createElement("div",{className:(0,ht.Z)("sticky-date",!A&&"interactive"),key:"date-header",onMouseDown:Fa.q,onClick:A?void 0:()=>O({selectedAt:e.datetime})},i.ZP.createElement("span",{dir:"auto"},A&&e.originalDate===o.t4X&&V("MessageScheduledUntilOnline"),A&&e.originalDate!==o.t4X&&V("MessageScheduledOn",(0,de.j1)(V,e.datetime,void 0,!0)),!A&&(0,de.j1)(V,e.datetime))),a.flat())}));return i.ZP.createElement("div",{className:"messages-container",teactFastList:!0},q&&i.ZP.createElement("div",{ref:$,key:"backwards-trigger",className:"backwards-trigger"}),N&&i.ZP.createElement(gi,{isInMessageList:!0,key:`bot_info_${n}`,chatId:n}),X.flat(),!t&&p&&i.ZP.createElement(hi,{key:n,chatId:n,containerRef:y}),q&&i.ZP.createElement("div",{ref:H,key:"forwards-trigger",className:"forwards-trigger"}),i.ZP.createElement("div",{ref:G,key:"fab-trigger",className:"fab-trigger"}))}));var fi=n(73547);const Ii=(0,i.X$)((0,a.c$)(((e,t)=>{let{userId:n}=t;const{stickers:a}=e.stickers.greeting,s=(0,v.db)(n)+(0,v.db)(e.currentUserId),o=a?.length?a[s%a.length]:void 0,i=(0,f.Z1)(e,n);return i?{sticker:o,lastUnreadMessageId:i.lastMessage&&i.lastMessage.id!==i.lastReadInboxMessageId?i.lastMessage.id:void 0,connectionState:e.connectionState,currentMessageList:(0,f.Bt)(e)}:{}}))((e=>{let{sticker:t,connectionState:n,lastUnreadMessageId:s,currentMessageList:o}=e;const{loadGreetingStickers:r,sendMessage:c,markMessageListRead:d}=(0,a.Sv)(),l=(0,qt.Z)(),u=(0,i.sO)(null),{observe:m}=(0,Wa.S1)({rootRef:u,debounceMs:200});(0,i.d4)((()=>{t||"connectionStateReady"!==n||r()}),[n,r,t]),(0,i.d4)((()=>{"connectionStateReady"===n&&s&&d({maxId:s})}),[n,d,s]);const h=(0,It.Z)((e=>{o&&(e={...e,isPreloadedGlobally:!0},c({sticker:e,messageList:o}))}));return i.ZP.createElement("div",{className:"ContactGreeting",ref:u},i.ZP.createElement("div",{className:"wrapper"},i.ZP.createElement("p",{className:"title",dir:"auto"},l("Conversation.EmptyPlaceholder")),i.ZP.createElement("p",{className:"description",dir:"auto"},l("Conversation.GreetingText")),i.ZP.createElement("div",{className:"sticker"},t&&i.ZP.createElement(fi.Z,{sticker:t,onClick:h,clickArg:t,observeIntersection:m,size:160,className:"large",noContextMenu:!0,isCurrentUserPremium:!0}))))}))),vi=3*E.Gw,wi=(0,i.X$)((e=>{let{isChatWithSelf:t,type:n,isGroupChatJustCreated:a,topic:s}=e;const o=(0,qt.Z)();return"scheduled"===n?function(e){return i.ZP.createElement("div",{className:"empty"},i.ZP.createElement("span",null,e("ScheduledMessages.EmptyPlaceholder")))}(o):t?function(e){return i.ZP.createElement("div",{className:"NoMessages"},i.ZP.createElement("div",{className:"wrapper"},i.ZP.createElement("i",{className:"icon no-messages-icon icon-cloud-download"}),i.ZP.createElement("h3",{className:"title"},e("Conversation.CloudStorageInfo.Title")),i.ZP.createElement("ul",{className:"description"},i.ZP.createElement("li",null,e("Conversation.ClousStorageInfo.Description1")),i.ZP.createElement("li",null,e("Conversation.ClousStorageInfo.Description2")),i.ZP.createElement("li",null,e("Conversation.ClousStorageInfo.Description3")),i.ZP.createElement("li",null,e("Conversation.ClousStorageInfo.Description4")))))}(o):a?function(e){return i.ZP.createElement("div",{className:"NoMessages"},i.ZP.createElement("div",{className:"wrapper",dir:e.isRtl?"rtl":void 0},i.ZP.createElement("h3",{className:"title"},e("EmptyGroupInfo.Title")),i.ZP.createElement("p",{className:"description"},e("EmptyGroupInfo.Subtitle")),i.ZP.createElement("ul",{className:"list-checkmarks"},i.ZP.createElement("li",null,e("EmptyGroupInfo.Line1")),i.ZP.createElement("li",null,e("EmptyGroupInfo.Line2")),i.ZP.createElement("li",null,e("EmptyGroupInfo.Line3")),i.ZP.createElement("li",null,e("EmptyGroupInfo.Line4")))))}(o):s?function(e,t){return i.ZP.createElement("div",{className:"NoMessages"},i.ZP.createElement("div",{className:"wrapper"},i.ZP.createElement(ai.Z,{topic:t,size:vi,className:"no-messages-icon topic-icon"}),i.ZP.createElement("h3",{className:"title"},e("Chat.EmptyTopicPlaceholder.Title")),i.ZP.createElement("p",{className:"description topic-description"},(0,ta.Z)(e("Chat.EmptyTopicPlaceholder.Text"),["br"]))))}(o,s):i.ZP.createElement("div",{className:"empty"},i.ZP.createElement("span",null,o("NoMessages")))})),bi=(0,I.Ds)((e=>e()),200,!1),Zi=(0,i.X$)((0,a.c$)(((e,t)=>{let{chatId:n,threadId:a,type:s}=t;const i=(0,f.Z1)(e,n);if(!i)return{};const r=(0,f.$W)(e,n,a,s),c="scheduled"===s?(0,f.yB)(e,n):(0,f.Zw)(e,n),d=(0,f.qS)(e,n,a),l=(0,f.tZ)(e,n,a);if(!(a===u._f||i?.isForum||c&&d&&c[d]))return{};const{isRestricted:m,restrictionReason:h,lastMessage:g}=i,p=(0,f.G$)(e,n),I=a===u._f&&!r&&!i.unreadCount&&!p&&g&&!g.groupedId,w=(0,f.kB)(e,n),b=i.topics?.[a],Z=(0,v.YC)(n)?void 0:(0,f.x6)(e,n);return{isCurrentUserPremium:(0,f.wV)(e),isChatLoaded:!0,isRestricted:m,restrictionReason:h,isChannelChat:(0,v.eA)(i),isGroupChat:(0,v.Bf)(i),isCreator:i.isCreator,isChatWithSelf:(0,f.FM)(e,n),isRepliesChat:(0,v.pK)(n),isBot:Boolean(w),messageIds:r,messagesById:c,isComments:Boolean(l?.originChannelId),firstUnreadId:(0,f.It)(e,n,a),isViewportNewest:"thread"!==s||(0,f.b9)(e,n,a),focusingId:p,isSelectModeActive:(0,f.CA)(e),threadTopMessageId:d,hasLinkedChat:Z?Boolean(Z.linkedChatId):void 0,topic:b,noMessageSendingAnimation:!(0,f.$Y)(e,"messageSendingAnimations"),isServiceNotificationsChat:n===o.awM,...I&&{lastMessage:g}}}))((e=>{let{chatId:t,threadId:n,type:s,hasTools:d,onFabToggle:l,onNotchToggle:h,isCurrentUserPremium:p,isChatLoaded:w,isChannelChat:b,isGroupChat:Z,canPost:P,isReady:y,isChatWithSelf:C,isRepliesChat:E,isCreator:S,isBot:M,messageIds:R,messagesById:k,firstUnreadId:T,isComments:A,isViewportNewest:N,isRestricted:x,restrictionReason:B,focusingId:L,isSelectModeActive:U,lastMessage:j,threadTopMessageId:O,hasLinkedChat:F,withBottomShift:_,withDefaultBg:D,topic:q,noMessageSendingAnimation:$,isServiceNotificationsChat:H,onPinnedIntersectionChange:G,getForceNextPinnedInHeader:V}=e;const{loadViewportMessages:W,setScrollOffset:z,loadSponsoredMessages:Y,loadMessageReactions:J,copyMessagesByIds:K,loadMessageViews:X}=(0,a.Sv)(),Q=(0,i.sO)(null),ee=(0,i.sO)("thread"===s&&(0,f.Vt)((0,a.Rd)(),t,n)||(0,f.T6)((0,a.Rd)(),t,n)||0),te=(0,i.sO)(),ne=(0,i.sO)(),ae=(0,i.sO)(),se=(0,i.sO)(),oe=(0,i.sO)(),ie=(0,i.sO)(),re=(0,i.sO)(!1),ce=(0,i.sO)(Boolean(j)),de=Boolean(R);(0,bt.Z)((()=>{de&&(0,I.R3)((()=>{ce.current=!1}))}),[de]),(0,bt.Z)((()=>{se.current=T}),[T]),(0,i.d4)((()=>{!p&&b&&y&&Y({chatId:t})}),[p,t,y,b]),(0,bt.Z)((()=>{de&&(oe.current=se.current)}),[de]),(0,bt.Z)((()=>{ie.current=L}),[L]),(e=>{(0,_t.y)({"Mod+C":function(t){const n=(0,Ha.Z)();n&&n.length>1&&(t.preventDefault(),e({messageIds:n}))}})})(K);const le=(0,i.Ye)((()=>{if(!R?.length||!k)return;const e=R.map((e=>k[e])).filter(Boolean),t="scheduled"===s||H?["date","id"]:["id"];return e.length?Oa((0,g.Xo)(e,t),oe.current):void 0}),[R,k,s,H]);(0,Rt.Z)((()=>{if(!R||!k||"scheduled"===s)return;const e=R.filter((e=>k[e]?.reactions));e.length&&J({chatId:t,ids:e})}),15e3),(0,Rt.Z)((()=>{if(!R||!k||n!==u._f||"scheduled"===s)return;const e=R.filter((e=>k[e]?.repliesThreadInfo?.isComments||void 0!==k[e]?.views));e.length&&X({chatId:t,ids:e})}),15e3);const ue=(0,i.Ye)((()=>{if("thread"===s)return(0,I.Ds)((()=>W({direction:m.Uq.Around})),1e3,!0,!1)}),[W,R]),{isScrolled:me,updateStickyDates:he}=function(){const[e,t]=(0,At.Z)(!1),n=(0,$a.Z)(1e3,!0);return{isScrolled:e,updateStickyDates:(0,It.Z)(((e,a)=>{t(),document.body.classList.contains("is-scrolling-messages")||(0,c.WM)((()=>{document.body.classList.add("is-scrolling-messages")})),n((()=>{const t=function(e,t){const n=e.querySelectorAll(".sticky-date"),a=e.scrollTop;return Array.from(n).find((e=>{const{offsetTop:n,offsetHeight:s}=e,o=n-a;return-s<=o&&o<=(t?60:10)}))}(e,a);t&&(0,c.WM)((()=>{t.classList.add("stuck")})),(0,c.WM)((()=>{const e=document.querySelector(".stuck");e&&e.classList.remove("stuck"),document.body.classList.remove("is-scrolling-messages")}))}))}))}}(),ge=(0,It.Z)((()=>{if(re.current)return void(re.current=!1);const e=Q.current;e&&(ie.current||he(e,d),bi((()=>{const o=(0,a.Rd)();V()&&!(0,f.jU)(o).focusedMessage?.chatId&&G({hasScrolled:!0}),e.parentElement&&(ee.current=e.scrollHeight-e.scrollTop,"thread"===s&&z({chatId:t,threadId:n,scrollOffset:ee.current}))})))})),[pe,fe]=function(e,t){const[n,a]=(0,Wn.Z)(),s=(0,It.Z)((e=>{a(e.contentRect.height)}));(0,Va.Z)(e,s),(0,i.d4)((()=>{const a=Number(e.current.dataset.normalHeight)||0,s=n();s&&s>a&&t&&(e.current.dataset.normalHeight=String(s))}),[t,e,n]);const o=(0,i.sO)();return[n,o]}(Q,P&&!U);(0,i.d4)((()=>{if(!ue||!w||x||L)return;if(R&&(0,v.AJ)(R[R.length-1]))return;const e=Q.current;(!R||R.length<o.hT6/2&&e.firstElementChild.clientHeight<=e.offsetHeight)&&ue()}),[w,R,ue,L,x]);const Ie=(0,qa.Y)((()=>{if(!R||!ae.current)return;const e=ae.current.filter((e=>R.includes(Number(e.dataset.messageId)))),t=e[1]||e[0];t&&(te.current=t.id,ne.current=t.getBoundingClientRect().top)}));(0,bt.Z)((()=>(0,c.yn)((()=>Ie.current()))),[R,N,d,Ie]),(0,i.d4)((()=>Ie.current()),[pe,Ie]),(0,Ga.Z)((e=>{let[t,n]=e;const a=pe(),s=fe.current;if(fe.current=a,R===t&&N===n&&a!==s&&void 0===s)return;const i=Q.current;ae.current=Array.from(i.querySelectorAll(".message-list-item"));const l=ae.current[ae.current.length-1],u=se.current?i.querySelector(`#${(0,v.d0)(se.current)}`):void 0,m=R&&t&&R[R.length-1]!==t[t.length-1],h=R?.[0]!==t?.[0]&&R?.length===o.hT6/2+1,g=m&&!h;N&&g&&R&&R.length<o.hT6/2&&!i.parentElement.classList.contains("force-messages-scroll")&&(0,c.yn)((()=>i.firstElementChild.clientHeight<=2*i.offsetHeight))&&((0,r.D_)(i.parentElement,"force-messages-scroll"),i.parentElement.classList.add("force-messages-scroll"),setTimeout((()=>{i.parentElement&&(0,r.mC)(i.parentElement,"force-messages-scroll")}),500)),(0,c.lT)((()=>{const{scrollTop:e,scrollHeight:t,offsetHeight:o}=i,r=ee.current;let m=r-(s||o);g&&(m-=l?l.offsetHeight:0);const h=N&&n&&m<=50,p=R&&ie.current===R[R.length-1];g&&h&&!p&&(0,c.i$)((()=>{const e=!(0,vt.q)()||!u;(0,Da.ZP)(i,e?l:u,e?"end":"start",20,void 0,void 0,$?0:void 0)}));const f=void 0!==s&&s!==a;if(f&&(0,Da.Ni)())return;const I=te.current&&i.querySelector(`#${te.current}`),v=!I&&oe.current&&i.querySelector(".unread-divider");let w;if(h&&f)w=t-o;else if(I){const t=I.getBoundingClientRect().top;w=e+(t-(ne.current||0))}else w=v?Math.min(v.offsetTop-(d?60:10),t-r):t-r;return()=>{(0,_a.Z)(i,Math.ceil(w)),(0,Da.wA)(),ee.current=Math.max(Math.ceil(t-w),o),ie.current||(re.current=!0,(0,c.i$)((()=>{re.current=!1})))}}))}),[R,N,d,pe,fe,$]),(0,on.Z)((e=>{let[t]=e;void 0!==t&&(0,Mt.YW)(200+o.fK3)}),[U]);const ve=Boolean(t&&(0,v.YC)(t)),we=Boolean(!ve&&!b||C||E),be=Boolean(!we||b),Ze=(0,v.YC)(t)&&!C&&!M&&(!le&&!j&&R&&(!ae.current||0===ae.current.length)||1===R?.length&&"contactSignUp"===k?.[R[0]]?.content.action?.type||"contactSignUp"===j?.content?.action?.type),Pe=Z&&S&&1===R?.length&&"chatCreate"===k?.[R[0]]?.content.action?.type,ye=1===R?.length&&"topicCreate"===k?.[R[0]]?.content.action?.type,Ce=(0,ht.Z)("MessageList custom-scroll",be&&"no-avatars",!P&&"no-composer","pinned"===s&&"type-pinned",_&&"with-bottom-shift",D&&"with-default-bg",U&&"select-mode-active",me&&"scrolled",!y&&"is-animating"),Ee=R&&le||j;return i.ZP.createElement("div",{ref:Q,className:Ce,onScroll:ge,onMouseDown:Fa.q},x?i.ZP.createElement("div",{className:"empty"},i.ZP.createElement("span",null,B?B.text:"This is a private "+(b?"channel":"chat"))):M&&!Ee?i.ZP.createElement(gi,{chatId:t}):Ze?i.ZP.createElement(Ii,{userId:t}):R&&(!le||Pe||ye)?i.ZP.createElement(wi,{chatId:t,topic:q,type:s,isChatWithSelf:C,isGroupChatJustCreated:Pe}):Ee?i.ZP.createElement(pi,{isCurrentUserPremium:p,chatId:t,isComments:A,isChannelChat:b,messageIds:R||[j.id],messageGroups:le||Oa([j]),getContainerHeight:pe,isViewportNewest:Boolean(N),isUnread:Boolean(T),withUsers:we,noAvatars:be,containerRef:Q,anchorIdRef:te,memoUnreadDividerBeforeIdRef:oe,memoFirstUnreadIdRef:se,threadId:n,type:s,isReady:y,threadTopMessageId:O,hasLinkedChat:F,isSchedule:!!le&&"scheduled"===s,shouldRenderBotInfo:M,noAppearanceAnimation:!le||!ce.current,onFabToggle:l,onNotchToggle:h,onPinnedIntersectionChange:G}):i.ZP.createElement(yn.Z,{color:"white",backgroundColor:"dark"}))}))),Pi=(0,i.X$)((e=>{let{icon:t,ariaLabelLang:n,unreadCount:a,onClick:s,onReadAll:o,className:r}=e;const c=(0,qt.Z)(),d=(0,i.sO)(null),{isContextMenuOpen:l,handleContextMenu:u,handleContextMenuClose:m,handleContextMenuHide:h}=(0,Ra.Z)(d,!o);return i.ZP.createElement("div",{className:(0,ht.Z)("KboxtoWkfx23zfklH_Zg",r),ref:d},i.ZP.createElement(Xt.Z,{color:"secondary",round:!0,className:"sgkkv3bmIMAZS9G9BHUz",onClick:s,onContextMenu:u,ariaLabel:c(n)},i.ZP.createElement("i",{className:(0,ht.Z)("AafG9_xBi_2eJ_bFNnNg","icon",`icon-${t}`)})),Boolean(a)&&i.ZP.createElement("div",{className:"yKN1kQ3YXf4SHHIBcotS"},(0,Bt.bi)(a)),o&&i.ZP.createElement(Sn.Z,{isOpen:l,onClose:m,onCloseAnimationEnd:h,autoClose:!0,positionX:"right",positionY:"bottom"},i.ZP.createElement(Kt.Z,{icon:"readchats",onClick:o},c("MarkAllAsRead"))))})),yi="EcdaljLbQ7DJN9gbQpSC",Ci=(0,i.X$)((0,a.c$)((e=>{const t=(0,f.Bt)(e);if(!t)return{};const{chatId:n,threadId:a,type:s}=t,o=(0,f.Z1)(e,n),i=o&&a===u._f&&"thread"===s;return{messageListType:s,chatId:n,reactionsCount:i?o.unreadReactionsCount:void 0,mentionsCount:i?o.unreadMentionsCount:void 0,unreadCount:i?o.unreadCount:void 0}}))((e=>{let{isShown:t,canPost:n,messageListType:s,chatId:o,unreadCount:r,reactionsCount:c,mentionsCount:d,withExtraShift:l}=e;const{focusNextReply:u,focusNextReaction:m,focusNextMention:h,fetchUnreadReactions:g,readAllMentions:p,readAllReactions:f,fetchUnreadMentions:I}=(0,a.Sv)(),v=(0,i.sO)(null),w=Boolean(c),b=Boolean(d);(0,i.d4)((()=>{w&&o&&g({chatId:o})}),[o,g,w]),(0,i.d4)((()=>{b&&o&&I({chatId:o})}),[o,I,b]);const Z=(0,It.Z)((()=>{if(t)if("thread"===s)u();else{const e=v.current.parentElement.querySelector(".MessageList"),t=e.querySelectorAll(".message-list-item"),n=t[t.length-1];if(!n)return;(0,Da.ZP)(e,n,"end",20)}})),P=(0,ht.Z)("quM3aP53TOfurCEOYgOE",(t||Boolean(c)||Boolean(d))&&"Gutr8PrNAFFTnrIdgK_l",(Boolean(c)||Boolean(d))&&!t&&"bHOz3QboabL0RvHuj3ku",!n&&"r7RXnwv5TF4Cf2V0d5Mf",!l&&"S98OqutuQVCNVHgTrKv4");return i.ZP.createElement("div",{ref:v,className:P},i.ZP.createElement(Pi,{icon:"heart-outline",ariaLabelLang:"AccDescrReactionMentionDown",onClick:m,onReadAll:f,unreadCount:c,className:(0,ht.Z)("wHTB_MNtk9J6I3F_4eVE",!w&&yi,!b&&"uHEtFnXb6pb14Jf0EsDr")}),i.ZP.createElement(Pi,{icon:"mention",ariaLabelLang:"AccDescrMentionDown",onClick:h,onReadAll:p,unreadCount:d,className:!b&&yi}),i.ZP.createElement(Pi,{icon:"arrow-down",ariaLabelLang:"AccDescrPageDown",onClick:Z,unreadCount:r,className:"Hoi4yrJrfBHTmvB8TPce"}))})));var Ei=n(65723);const Si=/\.[^/.]+$/;async function Mi(e,t,a){const s=URL.createObjectURL(t),{type:i,size:r}=t;let c,d,l,u;if(o.oGt.has(i)){const n=await(0,Dn.pt)(s),{width:r,height:d}=n;u=!ki(r,d);const m=Math.max(r,d)>1280,h=i===o.s11;if(!u){if(!a?.compressedBlobUrl&&!h&&(m||"image/jpeg"!==i)){const n=await Za(s,m?1280/Math.max(r,d):1,"image/jpeg");return URL.revokeObjectURL(s),Mi(e,t,{compressedBlobUrl:n})}"image/jpeg"===i&&(e=e.replace(Si,".jpg")),c={width:r,height:d}}l=Math.max(r,d)>40?await Za(s,40/Math.max(r,d),"image/jpeg"):s}else if(o.wGh.has(i)){const{videoWidth:e,videoHeight:t,duration:n}=await(0,Dn.jj)(s);u=!ki(e,t),u||(c={width:e,height:t,duration:n}),l=await(0,Dn.ud)(s)}else if(o.e74.has(i)){const{duration:e,title:t,performer:a,coverUrl:o}=await async function(e){const{fetchFromUrl:t,selectCover:a}=await n.e(8505).then(n.t.bind(n,38505,23)),s=await t(e),{common:{title:o,artist:i,picture:r},format:{duration:c}}=s,d=a(r);return{title:o,performer:i,duration:c,coverUrl:d?`data:${d.format};base64,${d.data.toString("base64")}`:void 0}}(s);d={duration:e||0,title:t,performer:a},l=o}return{blobUrl:s,filename:e,mimeType:i,size:r,quick:c,audio:d,previewBlobUrl:l,shouldSendAsFile:u||void 0,uniqueId:`${Date.now()}-${Math.random()}`,...a}}function Ri(e,t){return e.map((e=>t?e.compressedBlobUrl?{...e,blobUrl:e.compressedBlobUrl}:e:{...e,shouldSendAsFile:!e.voice||void 0,shouldSendAsSpoiler:void 0}))}function ki(e,t){return Math.max(e,t)/Math.min(e,t)<=20}var Ti=n(41098);function Ai(e){const t=document.createElement("div");t.contentEditable="true",t.style.position="absolute",t.style.left="-10000px",t.style.top="-10000px",t.innerHTML=e,document.body.appendChild(t);let n=t.lastChild;if(n.lastChild)for(;n.lastChild;)n=n.lastChild;const a=n.textContent.length,s=document.createRange(),o=window.getSelection();s.setStart(n,a),s.setEnd(n,a),o.removeAllRanges(),o.addRange(s),document.execCommand("delete",!1);const i=t.innerHTML;return document.body.removeChild(t),i}var Ni=n(96391);let xi;function Bi(e){xi.focus(),e.focus()}s.cj&&(xi=document.createElement("input"),xi.classList.add("for-ios-autocapitalization-fix"),document.body.appendChild(xi));var Li=n(74288),Ui=n(94462),ji=n(33681),Oi=n(52400),Fi=n(71790);const _i=new RegExp(`^${o.t8f.source}$`,"g");var Di=n(56389);const qi={encoderPath:new URL(n(68973),n.b).href,reuseWorker:!0},$i={type:"audio/ogg"};let Hi,Gi,Vi;async function Wi(){return Hi||(Hi=n.e(1161).then(n.t.bind(n,1161,23)),Gi=(await Hi).default,Vi=new Gi(qi)),Hi}async function zi(e){await async function(){await Wi(),await Vi.start()}();const t=Date.now();let n;const a=[],s=[];Vi.ondataavailable=e=>{a.push(e)};const o=function(t,n){const a=t.sourceNode,o=a.context.createAnalyser();o.fftSize=64,a.connect(o);const i=o.frequencyBinCount,r=new Uint8Array(i);let d=!1;return function t(){if(d)return;o.getByteFrequencyData(r);const n=r.reduce(((e,t)=>e+t),0)/i/255;(t=>{s.push(255*t),e(t)})(n<.1?0:n),(0,c.i$)(t)}(),()=>{d=!0}}(Vi);return{stop:()=>new Promise(((e,i)=>{Vi.onstop=()=>{e({blob:new Blob(a,$i),duration:Math.round(((n||Date.now())-t)/1e3),waveform:s})},Vi.onerror=i;const r=Math.max(0,t+1e3-Date.now());setTimeout((()=>{Vi.stop(),o()}),r)})),pause:()=>{const e=Math.max(0,t+1e3-Date.now());setTimeout((()=>{Vi.pause(),n=Date.now(),o()}),e)}}}var Yi=n(21262);const Ji=/id="docs-internal-guid/i,Ki=["H1","H2","H3","H4","H5","H6"];function Xi(e){return(new DOMParser).parseFromString(e,"text/html").body}function Qi(e,t){const n=document.createElement("a");return n.href=t,n.appendChild(e.cloneNode(!0)),n}function er(e,t){const n=document.createElement(t);return n.appendChild(e.cloneNode(!0)),n}function tr(e,t){let n=t.cloneNode(!0);return e?(e.style&&"700"===e.style.fontWeight&&(n=er(n,"strong")),e.style&&"italic"===e.style.fontStyle&&(n=er(n,"em")),e.style&&"underline"===e.style.textDecoration&&(n=er(n,"u")),e.style&&"line-through"===e.style.textDecoration&&(n=er(n,"del")),e.style&&"super"===e.style.verticalAlign&&(n=er(n,"sup")),e.style&&"sub"===e.style.verticalAlign&&(n=er(n,"sub")),n):n}function nr(e){const t=e.cloneNode(!0);let n=document.createTextNode(t.textContent||""),a=t;return"A"===t.nodeName&&(n=Qi(n,t.href),"style"in t.childNodes[0]&&Boolean(t.childNodes[0].style)&&(a=t.childNodes[0])),n=tr(a,n),n}function ar(e){if(e.childNodes&&(e.childNodes.length<=1||"OL"===e.nodeName||"UL"===e.nodeName)){let t,n=document.createTextNode(e.textContent||"");if("UL"===e.nodeName||"OL"===e.nodeName||"LI"===e.nodeName){t=document.createElement(e.nodeName),n=document.createDocumentFragment();const a=[];for(let t=0;t<e.childNodes.length;t++)a.push(...ar(e.childNodes[t]));a.map((e=>n.appendChild(e)))}else-1!==Ki.indexOf(e.nodeName)?(t=document.createElement(e.nodeName),n=nr(e.childNodes[0])):"P"===e.nodeName?(t=document.createElement("p"),n=function(e){const t=e.cloneNode(!0);let n=document.createTextNode(t.textContent||""),a=document.createTextNode("");return"style"in t.childNodes[0]&&Boolean(t.childNodes[0].style)&&(a=t.childNodes[0]),t.childNodes[0]&&"A"===t.childNodes[0].nodeName&&(n=Qi(n.cloneNode(!0),t.childNodes[0].href),a=t.childNodes[0].childNodes[0]),n=tr(a,n),n}(e)):"BR"===e.nodeName?n=e:(t=document.createElement("span"),n=nr(e));return t?(t.appendChild(n),[t]):[e.cloneNode(!0)]}if(e.childNodes){const t=[];for(let n=0;n<e.childNodes.length;n++)t.push(...ar(e.childNodes[n]));return t}return[e]}function sr(e){return 8!==e.nodeType}var or=n(56266);const ir=/<style>(.*?)<\/style>/gs,rr=(e,t,n,a,s,r,c)=>{(0,i.d4)((()=>{if(e)return document.addEventListener("paste",i,!1),()=>{document.removeEventListener("paste",i,!1)};async function i(e){if(!e.clipboardData)return;const i=document.activeElement;if(i&&![o.R2F,o.nYf].includes(i.id))return;const d=e.clipboardData.getData("text").substring(0,4096),l=e.clipboardData.getData("text/html");let m=l?(0,_e.ZP)(function(e){let t=document.createElement("div");try{e=(n=e).match(Ji)?function(e){const t=document.createElement("body"),n=e.childNodes,a=Array.from(n).filter(sr),s=[];for(const e of a)s.push(...ar(e));for(let e=0;e<s.length;e++)t.appendChild(s[e].cloneNode(!0));return t}(Xi(n.replace(/(\r\n|\n|\r)/,""))).innerHTML:Xi(n.replace(/(\r\n|\n|\r)/,"")).innerHTML}catch(e){o.eMD&&console.error(e)}var n;t.innerHTML=e.replace(/\u00a0/g," ").replace(ir,"");const a=t.querySelectorAll(".text-content");return a.length&&(t=a[a.length-1]),Array.from(t.getElementsByTagName("*")).forEach((e=>{if(e instanceof HTMLElement)switch(e.removeAttribute("style"),"BR"===e.tagName&&e.replaceWith("\n"),"P"===e.tagName&&e.appendChild(document.createTextNode("\n")),"IMG"!==e.tagName||e.dataset.entityType||e.replaceWith(e.getAttribute("alt")||""),e.dataset.ignoreOnPaste&&e.remove(),_e.xe[e.tagName]&&e.setAttribute("data-entity-type",_e.xe[e.tagName]),e.dataset.entityType||e.textContent!==e.innerText||e.replaceWith(e.textContent),e.dataset.alt&&e.setAttribute("alt",e.dataset.alt),e.dataset.entityType){case u.Vv.MentionName:e.replaceWith(e.textContent||"");break;case u.Vv.CustomEmoji:e.textContent=e.dataset.alt||""}})),t.innerHTML.trimEnd()}(l),void 0,!0):void 0;m&&(0,or.Lo)(m)&&r&&(m=(0,or.If)(m),c?.());const{items:h}=e.clipboardData;let g=[];if(e.preventDefault(),h.length>0&&(g=await(0,Yi.Z)(h)),!g?.length&&!d)return;const p=m?.entities?.length?m:{text:d};let f=!1;try{f="urn:schemas-microsoft-com:office:word"===(new DOMParser).parseFromString(l,"text/html").documentElement.getAttribute("xmlns:w")}catch(e){}const I=p&&p.text,v=g?.length&&!s&&!f;if(v){const e=await Promise.all(g.map((e=>Mi(e.name,e))));n((t=>t.concat(e)))}I&&(v?a(p):t(p,i?.id))}}),[t,s,n,e,r,c,a])},cr=new Set([u.Vv.TextUrl,u.Vv.Url]);var dr=n(28353),lr=n(29295),ur=n(16580);const mr=/^@([a-z0-9_]{1,32})[\u00A0\u0020]+(.*)/i,hr=/^@([a-z0-9_]{1,32})[\u00A0\u0020]+\n{2,}/i,gr={username:"",query:"",canShowHelp:!1,usernameLowered:""},pr=document.createElement("div");const fr=(0,ur.Z)(((e,t,n)=>({username:e,query:t,canShowHelp:n,usernameLowered:e.toLowerCase()}))),Ir=/^\/([\w@]{1,32})?$/i;var vr=n(33057),wr=n(60130);function br(e){return e.shouldSendAsFile?"file":o.oGt.has(e.mimeType)?"image":o.wGh.has(e.mimeType)?"video":o.e74.has(e.mimeType)?"audio":"file"}var Zr=n(69156);let Pr=!1;const yr=e=>{const{isOpen:t}=e,n=(0,Nt.Z)(ft.gl.Extra,"DeleteMessageModal",!t);return n?i.ZP.createElement(n,e):void 0};var Cr=n(43521),Er=n(85655),Sr=n(30879),Mr=n(56503),Rr=n(62898);const kr="N3E1geoPu1vesCKf545F",Tr=/#fff/gi,Ar=(0,i.X$)((e=>{let{icon:t,theme:n}=e;const{isTouchScreen:a}=(0,B.ZP)(),s=(0,dn.Z)((0,v.ym)(t),!1,u.IU.Text),o=(0,i.Ye)((()=>{if(!s)return"";const e="dark"===n?"rgb(170, 170, 170)":"rgb(112, 117, 121)",t=s.replace(Tr,e),a=(new DOMParser).parseFromString(t,"image/svg+xml");return a.querySelectorAll("path").forEach((t=>{t.style.stroke=e,t.style.strokeWidth="0.5px"})),`data:image/svg+xml;utf8,${a.documentElement.outerHTML}`}),[s,n]);return i.ZP.createElement("i",{className:(0,ht.Z)("vL8HfVVnjTeFmp1ECFj8","icon",!a&&kr)},i.ZP.createElement("img",{src:o,alt:"",className:(0,ht.Z)("Fb4aIyDYEwOlaqY8oZkV",!a&&kr)}))})),Nr=(0,i.X$)((e=>{let{bot:t,theme:n,chatId:s,threadId:o,onMenuOpened:r,onMenuClosed:c}=e;const{callAttachBot:d,toggleAttachBot:l}=(0,a.Sv)(),u=(0,qt.Z)(),m=(0,i.Ye)((()=>t.icons.find((e=>{let{name:t}=e;return"default_static"===t}))?.document),[t.icons]),[h,g,p]=(0,At.Z)(),[f,I]=(0,i.eJ)(void 0),v=(0,It.Z)((e=>{e.preventDefault();const t=e.currentTarget.getBoundingClientRect();I({x:t.right,y:t.bottom}),r(),g()})),w=(0,It.Z)((()=>{p(),c()})),b=(0,It.Z)((()=>{I(void 0)})),Z=(0,It.Z)((()=>{l({botId:t.id,isEnabled:!1})}));return i.ZP.createElement(Kt.Z,{key:t.id,customIcon:m&&i.ZP.createElement(Ar,{icon:m,theme:n}),icon:m?void 0:"bots",onClick:()=>d({bot:t,chatId:s,threadId:o}),onContextMenu:v},t.shortName,f&&i.ZP.createElement(Rr.Z,null,i.ZP.createElement(Sn.Z,{isOpen:h,positionX:"right",style:`left: ${f.x}px;top: ${f.y}px;`,className:"bot-attach-context-menu",autoClose:!0,onClose:w,onCloseAnimationEnd:b},i.ZP.createElement(Kt.Z,{icon:"stop",destructive:!0,onClick:Z},u("WebApp.RemoveBot")))))})),xr=(0,i.X$)((e=>{let{chatId:t,threadId:n,isButtonVisible:a,canAttachMedia:r,canAttachPolls:c,canSendPhotos:d,canSendVideos:l,canSendDocuments:u,canSendAudios:m,attachBots:h,peerType:g,isScheduled:p,onFileSelect:f,onPollCreate:I,theme:v,shouldCollectDebugLogs:w}=e;const[b,Z,P]=(0,At.Z)(),[y,C,E]=(0,Mr.Z)(b,P),S=d&&l,M=d||l,[R,k,T]=(0,At.Z)();(0,i.d4)((()=>{b&&E()}),[b,E]);const A=(0,It.Z)((()=>{b?P():Z()})),N=(0,It.Z)(((e,t)=>{const{files:n}=e.target,a=(0,Dn.ox)(n);a?.length&&f(a,t)})),x=(0,It.Z)((()=>{(0,Er.g)(Array.from(S?o.dII:d?o.oGt:o.wGh).join(","),(e=>N(e,!0)))})),B=(0,It.Z)((()=>{(0,Er.g)(!u&&m?Array.from(o.e74).join(","):"*",(e=>N(e,!1)))})),L=(0,It.Z)((()=>{const e=new File([(0,Sr.aZ)()],o.Wpe,{type:"text/plain"});f([e])})),U=(0,i.Ye)((()=>Object.values(h).filter((e=>!!g&&(!("bots"!==g||e.id!==t||!e.peerTypes.includes("self"))||e.peerTypes.includes(g))))),[h,t,g]),j=(0,qt.Z)();if(a)return i.ZP.createElement("div",{className:"AttachMenu"},i.ZP.createElement(Cr.Z,{id:"attach-menu-button",className:b?"AttachMenu--button activated":"AttachMenu--button",round:!0,color:"translucent",onActivate:A,ariaLabel:"Add an attachment",ariaControls:"attach-menu-controls",hasPopup:!0},i.ZP.createElement("i",{className:"icon icon-attach"})),i.ZP.createElement(Sn.Z,{id:"attach-menu-controls",isOpen:b||R,autoClose:!0,positionX:"right",positionY:"bottom",onClose:P,className:"AttachMenu--menu fluid",onCloseAnimationEnd:P,onMouseEnter:s.$b?void 0:y,onMouseLeave:s.$b?void 0:C,noCloseOnBackdrop:!s.$b,ariaLabelledBy:"attach-menu-button"},!r&&i.ZP.createElement(Kt.Z,{className:"media-disabled",disabled:!0},"Posting media content is not allowed in this group."),r&&i.ZP.createElement(i.ZP.Fragment,null,M&&i.ZP.createElement(Kt.Z,{icon:"photo",onClick:x},j(S?"AttachmentMenu.PhotoOrVideo":d?"InputAttach.Popover.Photo":"InputAttach.Popover.Video")),(u||m)&&i.ZP.createElement(Kt.Z,{icon:"document",onClick:B},j(!u&&m?"InputAttach.Popover.Music":"AttachDocument")),u&&w&&i.ZP.createElement(Kt.Z,{icon:"bug",onClick:L},j("DebugSendLogs"))),c&&i.ZP.createElement(Kt.Z,{icon:"poll",onClick:I},j("Poll")),r&&!p&&U.map((e=>i.ZP.createElement(Nr,{bot:e,chatId:t,threadId:n,theme:v,onMenuOpened:k,onMenuClosed:T})))))})),Br=e=>{const{isOpen:t}=e,n=(0,Nt.Z)(ft.gl.Extra,"InlineBotTooltip",!t);return n?i.ZP.createElement(n,e):void 0},Lr=e=>{const{isOpen:t}=e,n=(0,Nt.Z)(ft.gl.Extra,"MentionTooltip",!t);return n?i.ZP.createElement(n,e):void 0};var Ur=n(67146);const jr=e=>{const{isOpen:t}=e,n=(0,Nt.Z)(ft.gl.Extra,"StickerTooltip",!t);return n?i.ZP.createElement(n,e):void 0};var Or=n(93219),Fr=n(19830);const _r=e=>{const{isOpen:t}=e,n=(0,Nt.Z)(ft.gl.Extra,"BotCommandTooltip",!t);return n?i.ZP.createElement(n,e):void 0},Dr=(0,i.X$)((0,a.c$)(((e,t)=>{let{messageId:n}=t;const{chatId:a}=(0,f.Bt)(e)||{};return a?{message:(0,f.hj)(e,a,n)}:{}}))((e=>{let{isOpen:t,message:n,onClose:o}=e;const{clickBotInlineButton:r}=(0,a.Sv)(),[c,d]=(0,Mr.Z)(t,o),{isKeyboardSingleUse:l}=n||{};if(n&&n.keyboardButtons)return i.ZP.createElement(Sn.Z,{isOpen:t,autoClose:l,positionX:"right",positionY:"bottom",onClose:o,className:"BotKeyboardMenu",onCloseAnimationEnd:o,onMouseEnter:s.$b?void 0:c,onMouseLeave:s.$b?void 0:d,noCompact:!0},i.ZP.createElement("div",{className:"content"},n.keyboardButtons.map((e=>i.ZP.createElement("div",{className:"row"},e.map((e=>i.ZP.createElement(Xt.Z,{ripple:!0,disabled:"unsupported"===e.type,onClick:()=>r({messageId:n.id,button:e})},e.text))))))))})));var qr=n(49841),$r=n(12644),Hr=n(66902);const Gr=(0,i.X$)((0,a.c$)(((e,t)=>{let{shouldForceShowEditing:n}=t;const{chatId:a,threadId:s,type:o}=(0,f.Bt)(e)||{};if(!a||!s||!o)return{};const{forwardMessages:{fromChatId:i,toChatId:r,messageIds:c,noAuthors:d,noCaptions:l}}=(0,f.jU)(e),u=(0,f.Yy)(e,a,s),m="scheduled"===o?(0,f.wU)(e,a):(0,f._$)(e,a,s),h=(0,f.FO)(e),g=r===a,p=c?.map((t=>(0,f.hj)(e,i,t)));let I,w;if(u&&!n?I=(0,f.hj)(e,a,u):m?I=(0,f.kK)(e,a,s,o):g&&1===c.length&&(I=p?.[0]),u&&I&&!n){const{forwardInfo:t}=I,n=(0,f.FM)(e,a);t&&(t.isChannelPost||n)&&(w=(0,f.cv)(e,I)),w||t?.hiddenUserName||(w=(0,f.Ur)(e,I))}else g&&(I&&(w=(0,f.cv)(e,I),w||(w=(0,f.Ur)(e,I))),w||(w=(0,v.YC)(i)?(0,f.dy)(e,i):(0,f.Z1)(e,i)));const b=p?.some((e=>e?.content.text&&Object.keys(e.content).length>1));return{replyingToId:u,editingId:m,message:I,sender:w,shouldAnimate:h,forwardedMessagesCount:g?c.length:void 0,noAuthors:d,noCaptions:l,forwardsHaveCaptions:b,isCurrentUserPremium:(0,f.wV)(e)}}))((e=>{let{replyingToId:t,editingId:n,message:s,sender:o,shouldAnimate:r,forwardedMessagesCount:c,noAuthors:d,noCaptions:l,forwardsHaveCaptions:u,shouldForceShowEditing:m,isCurrentUserPremium:h,onClear:g}=e;const{setReplyingToId:p,setEditingId:f,focusMessage:I,changeForwardRecipient:w,setForwardNoAuthors:b,setForwardNoCaptions:Z,exitForwardMode:P}=(0,a.Sv)(),y=(0,i.sO)(null),C=(0,qt.Z)(),E=Boolean(c),S=Boolean((t||n)&&s||o&&c),M=(0,aa.Z)([c],c?300:void 0),{shouldRender:R,transitionClassNames:k}=(0,St.Z)(M&&S,void 0,!r,void 0,!r),T=(0,It.Z)((()=>{t&&!m?p({messageId:void 0}):n?f({messageId:void 0}):c&&P(),g?.()}));(0,i.d4)((()=>S?(0,Ot.Z)(T):void 0),[S,T]);const A=(0,It.Z)((()=>{E||I({chatId:s.chatId,messageId:s.id,noForumTopicPanel:!0})})),N=(0,It.Z)((e=>{e.stopPropagation(),T()})),x=(0,It.Z)((()=>{w()})),{isContextMenuOpen:B,contextMenuPosition:L,handleContextMenu:U,handleContextMenuClose:j,handleContextMenuHide:O}=(0,Ra.Z)(y),F=(0,It.Z)((()=>y.current)),_=(0,It.Z)((()=>y.current)),D=(0,It.Z)((()=>y.current.querySelector(".forward-context-menu .bubble"))),{positionX:q,positionY:$,transformOriginX:H,transformOriginY:G,style:V}=(0,$r.Z)(L,F,_,D);(0,i.d4)((()=>{R||j()}),[j,R]);const W=(0,ht.Z)("ComposerEmbeddedMessage",k),z=(0,i.Ye)((()=>t&&!m?"icon-reply":n?"icon-edit":E?"icon-forward":void 0),[n,E,t,m]),Y=c&&c>1?C("ForwardedMessageCount",c):void 0,J=(0,i.Ye)((()=>{if(!s||!E||!s.content.text||!d||h)return s;const e=(0,v.If)(s.content.text);return{...s,content:{...s.content,text:e}}}),[h,E,s,d]);if(R)return i.ZP.createElement("div",{className:W,ref:y,onContextMenu:U,onClick:U},i.ZP.createElement("div",{className:"ComposerEmbeddedMessage_inner"},i.ZP.createElement("div",{className:"embedded-left-icon"},i.ZP.createElement("i",{className:(0,ht.Z)("icon",z)})),i.ZP.createElement(js,{className:"inside-input",message:J,sender:d?void 0:o,customText:Y,title:n?C("EditMessage"):d?C("HiddenSendersNameDescription"):void 0,onClick:A,hasContextMenu:E}),i.ZP.createElement(Xt.Z,{className:"embedded-cancel",round:!0,faded:!0,color:"translucent",ariaLabel:C("Cancel"),onClick:N},i.ZP.createElement("i",{className:"icon icon-close"})),E&&i.ZP.createElement(Sn.Z,{isOpen:B,transformOriginX:H,transformOriginY:G,positionX:q,positionY:$,style:V,className:"forward-context-menu",onClose:j,onCloseAnimationEnd:O},i.ZP.createElement(Kt.Z,{icon:d?void 0:"message-succeeded",customIcon:d?i.ZP.createElement("i",{className:"icon icon-placeholder"}):void 0,onClick:()=>b({noAuthors:!1})},C(c>1?"ShowSenderNames":"ShowSendersName")),i.ZP.createElement(Kt.Z,{icon:d?"message-succeeded":void 0,customIcon:d?void 0:i.ZP.createElement("i",{className:"icon icon-placeholder"}),onClick:()=>b({noAuthors:!0})},C(c>1?"HideSenderNames":"HideSendersName")),u&&i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement(Hr.Z,null),i.ZP.createElement(Kt.Z,{icon:l?void 0:"message-succeeded",customIcon:l?i.ZP.createElement("i",{className:"icon icon-placeholder"}):void 0,onClick:()=>Z({noCaptions:!1})},C(c>1?"Conversation.ForwardOptions.ShowCaption":"ShowCaption")),i.ZP.createElement(Kt.Z,{icon:l?"message-succeeded":void 0,customIcon:l?void 0:i.ZP.createElement("i",{className:"icon icon-placeholder"}),onClick:()=>Z({noCaptions:!0})},C(c>1?"Conversation.ForwardOptions.HideCaption":"HideCaption"))),i.ZP.createElement(Hr.Z,null),i.ZP.createElement(Kt.Z,{icon:"replace",onClick:x},C("ChangeRecipient")))))}))),Vr=e=>{const{attachments:t}=e,n=(0,Nt.Z)(ft.gl.Extra,"AttachmentModal",!t.length);return n?i.ZP.createElement(n,e):void 0},Wr=e=>{const{isOpen:t}=e,n=(0,Nt.Z)(ft.gl.Extra,"BotCommandMenu",!t);return n?i.ZP.createElement(n,e):void 0},zr=e=>{const{isOpen:t}=e,n=(0,Nt.Z)(ft.gl.Extra,"PollModal",!t);return n?i.ZP.createElement(n,e):void 0},Yr=e=>{const{isOpen:t}=e,n=(0,Nt.Z)(ft.gl.Extra,"DropArea",!t);return n?i.ZP.createElement(n,e):void 0},Jr=new RegExp(o.FM6,"i"),Kr=(0,i.X$)((0,a.c$)(((e,t)=>{let{chatId:n,threadId:a}=t;const s=(0,f.tV)(e,n,a);return{theme:(0,f.Pu)(e),webPagePreview:(0,f.jU)(e).webPagePreview,noWebPage:s}}))((e=>{let{chatId:t,threadId:n,getHtml:s,isDisabled:o,webPagePreview:r,noWebPage:c,theme:d}=e;const{loadWebPagePreview:l,clearWebPagePreview:m,toggleMessageWebPage:h}=(0,a.Sv)(),g=(0,i.sO)(),p=(0,Ya.iD)((()=>{const e=(0,_e.ZP)(s()),t=e.entities?.find((e=>e.type===u.Vv.TextUrl));return g.current=e,t?.url||e.text.match(Jr)?.[0]}),[s],300,!0),f=(0,Fi.Z)(p,[p,s],!0);(0,i.d4)((()=>{const e=f(),a=g.current;e?l({text:a}):(m(),h({chatId:t,threadId:n}))}),[f,t,n]),(0,bt.Z)((()=>{m(),h({chatId:t,threadId:n})}),[t,m,n,h]);const I=(0,Kn.Z)((()=>Boolean(r&&s()&&!c&&!o)),[o,s,c,r]),{shouldRender:v,transitionClassNames:w}=(0,St.Z)(I),b=(0,Jn.Z)(r,!0),Z=(0,It.Z)((()=>{h({chatId:t,threadId:n,noWebPage:!0})}));if(!v||!b)return;const{photo:P,...y}=b,C={content:{webPage:y}};return i.ZP.createElement("div",{className:(0,ht.Z)("WebPagePreview",w)},i.ZP.createElement("div",{className:"WebPagePreview_inner"},i.ZP.createElement("div",{className:"WebPagePreview-left-icon"},i.ZP.createElement("i",{className:"icon icon-link"})),i.ZP.createElement(bo,{message:C,inPreview:!0,theme:d}),i.ZP.createElement(Xt.Z,{className:"WebPagePreview-clear",round:!0,faded:!0,color:"translucent",ariaLabel:"Clear Webpage Preview",onClick:Z},i.ZP.createElement("i",{className:"icon icon-close"}))))}))),Xr=e=>{const{isOpen:t}=e,n=(0,Nt.Z)(ft.gl.Extra,"SendAsMenu",!t);return n?i.ZP.createElement(n,e):void 0},Qr=(0,i.X$)((e=>{let{isOpen:t,onClick:n,text:a,isDisabled:s}=e;const o=(0,i.sO)(null);return(0,i.d4)((()=>{const e=o.current;if(!e)return;const t=e.scrollWidth+1;e.closest(".Composer").style.setProperty("--bot-menu-text-width",`${t}px`)}),[t,a]),(0,i.d4)((()=>{const e=o.current;if(!e)return;const t=e.closest(".Composer");return()=>{t.style.removeProperty("--bot-menu-text-width")}}),[]),i.ZP.createElement(Xt.Z,{className:(0,ht.Z)("bot-menu",t&&"open"),round:!0,color:"translucent",disabled:s,onClick:n,ariaLabel:"Open bot command keyboard"},i.ZP.createElement("i",{className:(0,ht.Z)("bot-menu-icon","icon","icon-webapp",t&&"open")}),i.ZP.createElement("span",{ref:o,className:"bot-menu-text"},a))}));var ec=n(23522),tc=function(e){return e.Send="send",e.Record="record",e.Edit="edit",e.Schedule="schedule",e}(tc||{});const nc="wonderful-voice-message.ogg",ac=(0,i.X$)((0,a.c$)(((e,t)=>{var n;let{chatId:a,threadId:s,messageListType:i,isMobile:r}=t;const c=(0,f.Z1)(e,a),d=a!==o.FVh?(0,f.kB)(e,a):void 0,l=Boolean(d),u=(0,f.FM)(e,a),m=(0,v.YC)(a),h=l?(0,f.iF)(e,d.id):void 0,g=m?void 0:(0,f.x6)(e,a),p=(l||!m)&&(0,f.FT)(e,a,s),I=(0,f.qy)(e,a,s),{language:w,shouldSuggestStickers:b,shouldSuggestCustomEmoji:Z,shouldUpdateStickerSetOrder:P}=e.settings.byKey,y=e.emojiKeywords[o.pRL],C=w!==o.pRL?e.emojiKeywords[w]:void 0,E=p?p.id:void 0,S=E?(0,f.hj)(e,a,E):void 0,{currentUserId:M}=e,R=g?g?.sendAsId||M:void 0,k=c?.sendAsPeerIds&&R&&(c.sendAsPeerIds.some((e=>e.id===R))?R:c?.adminRights?.anonymous?c?.id:void 0),T=k?(0,f.dy)(e,k):void 0,A=!T&&k?(0,f.Z1)(e,k):void 0,N=(0,f.uH)(e,a),x=(0,f.nA)(e,a),B=(0,f.Bt)(e),L=a===B?.chatId&&s===B?.threadId&&i===B?.type,U=(0,f.dy)(e,a),j=null===(n=U&&!(0,f.iF)(e,U.id)?.noVoiceMessages)||void 0===n||n,O=g?.slowMode,F="scheduled"===i?(0,f.hI)(e,a):(0,f.s)(e,a,s),_=(0,f.Yy)(e,a,s),D=(0,f.jU)(e);return{isOnActiveTab:!D.isBlurred,editingMessage:(0,f.kK)(e,a,s,i),replyingToId:_,draft:(0,f.Ms)(e,a,s),chat:c,isChatWithBot:l,isChatWithSelf:u,isForCurrentMessageList:L,canScheduleUntilOnline:(0,f.Eh)(e,a),isChannel:c?(0,v.eA)(c):void 0,isRightColumnShown:(0,f.Jf)(e,r),isSelectModeActive:(0,f.CA)(e),withScheduledButton:"thread"===i&&Boolean(I?.length),shouldSchedule:"scheduled"===i,botKeyboardMessageId:E,botKeyboardPlaceholder:S?.keyboardPlaceholder,isForwarding:a===D.forwardMessages.toChatId,pollModal:D.pollModal,stickersForEmoji:e.stickers.forEmoji.stickers,customEmojiForEmoji:e.customEmojis.forEmoji.stickers,groupChatMembers:g?.members,topInlineBotIds:e.topInlineBots?.userIds,currentUserId:M,contentToBeScheduled:D.contentToBeScheduled,shouldSuggestStickers:b,shouldSuggestCustomEmoji:Z,shouldUpdateStickerSetOrder:P,recentEmojis:e.recentEmojis,baseEmojiKeywords:y?.keywords,emojiKeywords:C?.keywords,inlineBots:D.inlineBots.byUsername,isInlineBotLoading:D.inlineBots.isLoading,chatBotCommands:g?.botCommands,botCommands:h?h.botInfo?.commands||!1:void 0,botMenuButton:h?.botInfo?.menuButton,sendAsUser:T,sendAsChat:A,sendAsId:k,editingDraft:F,requestedDraftText:N,requestedDraftFiles:x,attachBots:e.attachMenu.bots,attachMenuPeerType:(0,f.t)(e,a),theme:(0,f.Pu)(e),fileSizeLimit:(0,se.M)(e,"uploadMaxFileparts")*o.pJM,captionLimit:(0,se.M)(e,"captionLength"),isCurrentUserPremium:(0,f.wV)(e),canSendVoiceByPrivacy:j,attachmentSettings:e.attachmentSettings,slowMode:O,currentMessageList:B,shouldCollectDebugLogs:e.settings.byKey.shouldCollectDebugLogs}}))((e=>{let{isOnActiveTab:t,dropAreaState:n,shouldSchedule:r,canScheduleUntilOnline:d,isReady:l,isMobile:m,onDropHide:h,editingMessage:g,chatId:p,threadId:f,currentMessageList:I,messageListType:w,draft:b,chat:Z,isForCurrentMessageList:P,isCurrentUserPremium:y,canSendVoiceByPrivacy:C,isChatWithBot:E,isChatWithSelf:S,isChannel:M,fileSizeLimit:R,isRightColumnShown:k,isSelectModeActive:T,isForwarding:N,pollModal:x,botKeyboardMessageId:B,botKeyboardPlaceholder:L,withScheduledButton:U,stickersForEmoji:j,customEmojiForEmoji:O,groupChatMembers:F,topInlineBotIds:_,currentUserId:D,captionLimit:q,contentToBeScheduled:$,shouldSuggestStickers:H,shouldSuggestCustomEmoji:G,baseEmojiKeywords:V,emojiKeywords:W,recentEmojis:z,inlineBots:Y,isInlineBotLoading:J,botCommands:K,chatBotCommands:X,sendAsUser:Q,sendAsChat:ee,sendAsId:te,editingDraft:ne,replyingToId:ae,requestedDraftText:se,requestedDraftFiles:oe,botMenuButton:ie,attachBots:re,attachMenuPeerType:ce,attachmentSettings:le,theme:ue,slowMode:me,shouldUpdateStickerSetOrder:he,shouldCollectDebugLogs:ge}=e;const{sendMessage:pe,clearDraft:fe,showDialog:ve,forwardMessages:we,openPollModal:be,closePollModal:Ze,loadScheduledHistory:Pe,openChat:ye,addRecentEmoji:Ce,sendInlineBotResult:Ee,loadSendAs:Se,resetOpenChatWithDraft:Me,callAttachBot:Re,addRecentCustomEmoji:ke,showNotification:Te,showAllowedMessageTypesNotification:Ae}=(0,a.Sv)(),Ne=(0,qt.Z)(),xe=(0,i.sO)(null),[Be,Le]=(0,Wn.Z)(""),[Ue,Oe]=(0,i.eJ)(!1),Fe=(0,Zr.Z)(o.Edp),De=(0,i.sO)(),qe=(0,Hn.Z)(n),{width:$e}=A.Z.get(),He=Z?.sendAsPeerIds,Ge=He&&(He.length>1||!He.some((e=>e.id===D))),[Ve,We,ze]=(0,At.Z)(),Ye=(0,Di.Z)(p,f);(0,i.d4)(Li.AU,[Be]);const Je=(0,i.sO)(0),[Ke,Xe]=(0,vr.Z)(d,ze);(0,Tt.Z)((()=>{Oe(!0)}),430),(0,i.d4)((()=>{De.current=void 0}),[p]),(0,i.d4)((()=>{p&&l&&Pe({chatId:p})}),[l,p,Pe,f]),(0,i.d4)((()=>{p&&Z&&!He&&l&&(0,v.ZV)(Z)&&Se({chatId:p})}),[Z,p,l,Se,He]);const Qe=(0,i.sO)(!1);(0,bt.Z)((e=>{let[t,n]=e;Qe.current=Boolean(p===t&&He&&!n)}),[p,He]);const[et,tt]=(0,i.eJ)([]),nt=Boolean(et.length),[at,st]=(0,i.eJ)(void 0),{canSendStickers:ot,canSendGifs:it,canAttachMedia:rt,canAttachPolls:ct,canAttachEmbedLinks:dt,canSendVoices:lt,canSendPlainText:ut,canSendAudios:mt,canSendVideos:gt,canSendPhotos:pt,canSendDocuments:ft}=(0,i.Ye)((()=>(0,v.H5)(Z,E)),[Z,E]),Zt=!ut&&!g,Pt=(0,It.Z)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.R2F;if(t===o.R2F&&Zt)return;const n=window.getSelection();let a;if(a=t===o.R2F?document.querySelector(o.Edp):document.getElementById(t),n.rangeCount){const s=n.getRangeAt(0);if((0,Ni.R)(s,t))return(0,Ti.tx)(e),void a.dispatchEvent(new Event("input",{bubbles:!0}))}Le(`${Be()}${e}`),(0,c.Yq)((()=>{(0,Ei.Z)(a)}))})),yt=(0,It.Z)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.R2F;const n=(0,ta.Z)(e,["escape_html","emoji_html","br_html"]).join("").replace(/\u200b+/g,"");Pt(n,t)})),Ct=(0,It.Z)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.R2F;const n=(0,co.z)(e);Pt(n,t)})),Et=(0,It.Z)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.R2F;Pt((0,is.yR)(e),t)})),St=(0,It.Z)((()=>{at&&(Ct(at,o.R2F),st(void 0))})),{shouldSuggestCompression:Mt,shouldForceCompression:kt,shouldForceAsFile:Nt,handleAppendFiles:xt,handleFileSelect:Bt,onCaptionUpdate:Lt,handleClearAttachments:Ut,handleSetAttachments:jt}=function(e){let{attachments:t,fileSizeLimit:n,setHtml:s,setAttachments:o,chatId:r,canSendAudios:c,canSendVideos:d,canSendPhotos:l,canSendDocuments:u,insertNextText:m}=e;const{openLimitReachedModal:h,showAllowedMessageTypesNotification:g}=(0,a.Sv)(),[p,f]=(0,i.eJ)(!1),[I,v]=(0,i.eJ)(!1),[w,b]=(0,i.eJ)(void 0),Z=(0,It.Z)((()=>{o(je.D),m()})),P=(0,It.Z)((e=>{const a="function"==typeof e?e(t):e;if(a.length)if(a.some((e=>{const t=br(e);return"audio"===t&&!c&&!u||"video"===t&&!d&&!u||"image"===t&&!l&&!u||"file"===t&&!u})))g({chatId:r});else if(a.some((e=>{let{size:t}=e;return t>n})))h({limit:"uploadMaxFileparts"});else{o(a);const e=a.some((e=>{const t=br(e);return"audio"===t&&!c||"video"===t&&!d||"image"===t&&!l}));f(Boolean(e&&u)),v(!u)}else Z()}));return{shouldSuggestCompression:w,handleAppendFiles:(0,It.Z)((async(e,n)=>{P([...t,...await Promise.all(e.map((e=>Mi(e.name,e,{shouldSendAsSpoiler:n||void 0}))))])})),handleFileSelect:(0,It.Z)((async(e,t)=>{P(await Promise.all(e.map((e=>Mi(e.name,e))))),b(t)})),onCaptionUpdate:s,handleClearAttachments:Z,handleSetAttachments:P,shouldForceCompression:I,shouldForceAsFile:p}}({attachments:et,setHtml:Le,setAttachments:tt,fileSizeLimit:R,chatId:p,canSendAudios:mt,canSendVideos:gt,canSendPhotos:pt,canSendDocuments:ft,insertNextText:St}),[Ft,_t,Dt]=(0,At.Z)(),[$t,Ht,Gt]=(0,At.Z)(),[Vt,Wt,zt]=(0,At.Z)(),[Yt,Jt,Kt]=(0,At.Z)(),[Qt,en,tn]=(0,At.Z)(),[nn,sn,rn]=(0,At.Z)(),{startRecordingVoice:cn,stopRecordingVoice:dn,pauseRecordingVoice:ln,activeVoiceRecording:un,currentRecordTime:mn,recordButtonRef:hn,startRecordTimeRef:gn}=(()=>{const e=(0,i.sO)(null),[t,n]=(0,i.eJ)(),a=(0,i.sO)(),[o,r]=(0,i.eJ)();(0,i.d4)((()=>{s.s$&&s.mh&&Wi()}),[]);const d=(0,It.Z)((async()=>{try{const{stop:t,pause:s}=await zi((t=>{e.current&&(a.current&&Date.now()%4==0&&(0,c.WM)((()=>{e.current.style.boxShadow=`0 0 0 ${50*(t||0)}px rgba(0,0,0,.15)`})),r(Date.now()))}));a.current=Date.now(),r(Date.now()),n({stop:t,pause:s})}catch(e){console.error(e)}})),l=(0,It.Z)((()=>{if(t){(0,c.WM)((()=>{e.current&&(e.current.style.boxShadow="none")}));try{return t.pause()}catch(e){return void console.error(e)}}})),u=(0,It.Z)((()=>{if(t){n(void 0),a.current=void 0,r(void 0),(0,c.WM)((()=>{e.current&&(e.current.style.boxShadow="none")}));try{return t.stop()}catch(e){return void console.error(e)}}}));return(0,i.d4)((()=>t?(0,Ot.Z)(u):void 0),[t,u]),{startRecordingVoice:d,pauseRecordingVoice:l,stopRecordingVoice:u,activeVoiceRecording:t,currentRecordTime:o,recordButtonRef:e,startRecordTimeRef:a}})();(0,Rt.Z)((()=>{Ye({type:"recordAudio"})}),un&&o.o_S),(0,i.d4)((()=>{un||Ye({type:"cancel"})}),[un,Ye]);const pn=(0,qa.Y)(Boolean(g));(0,i.d4)((()=>{Be()&&!pn.current&&Ye({type:"typing"})}),[Be,pn,Ye]);const fn=Z&&(0,v.Nl)(Z),{isEmojiTooltipOpen:In,closeEmojiTooltip:vn,filteredEmojis:wn,filteredCustomEmojis:bn,insertEmoji:Zn}=(0,dr.Z)(Boolean(l&&t&&P&&H&&!nt),Be,Le,void 0,z,V,W),{isCustomEmojiTooltipOpen:Pn,closeCustomEmojiTooltip:yn,insertCustomEmoji:Cn}=(0,wr.Z)(Boolean(l&&t&&P&&G&&!nt),Be,Le,Fe,xe,O),{isStickerTooltipOpen:En,closeStickerTooltip:Sn}=function(e,t,n){const{loadStickersForEmoji:r,clearStickersForEmoji:c}=(0,a.Sv)(),[d,l,u]=(0,At.Z)(!1),m=(0,Fi.Z)((()=>{const n=t();if(!e||!n||s.op&&n.length>8)return;if(!n.match(s.op?ji.Z:o.t8f))return;const a=(0,Oi._)(n);return a&&(s.op&&1===(0,Ui.Z)(a)||!s.op&&Boolean(n.match(_i)))?s.op?a:a.match(/alt="(.+)"/)?.[1]:void 0}),[t,e]),h=(0,Kn.Z)((()=>Boolean(m())),[m]),g=Boolean(n?.length);return(0,i.d4)((()=>{if(!e)return;const t=m();t?g||r({emoji:t}):c()}),[e,m,g,r,c]),(0,i.d4)(u,[u,t]),{isStickerTooltipOpen:Boolean(h&&g&&!d),closeStickerTooltip:l}}(Boolean(l&&t&&P&&H&&ot&&!nt),Be,j),{isMentionTooltipOpen:Mn,closeMentionTooltip:Rn,insertMention:kn,mentionFilteredUsers:Tn}=(0,lr.Z)(Boolean(l&&P&&!nt),Be,Le,Fe,xe,F,_,D),{isOpen:An,botId:Nn,isGallery:xn,switchPm:Bn,switchWebview:Ln,results:Un,closeTooltip:jn,help:Fn,loadMore:_n}=function(e,t,n,s){const{queryInlineBot:o,resetInlineBot:r,resetAllInlineBots:c}=(0,a.Sv)(),[d,l,u]=(0,At.Z)(!1),m=(0,Ya.CH)((()=>{const t=n();return e&&t.startsWith("@")?function(e){if(!e.startsWith("@"))return gr;const t=function(e){return pr.innerHTML=e.replace(/<br>/g,"\n"),pr.querySelectorAll("[alt]").forEach((e=>{e.innerText||(e.innerText=e.getAttribute("alt"))})),pr.innerText}(e),n=t.match(mr);return n?fr(n[1],n[2],""===n[2]&&!t.match(hr)):gr}(t):gr}),[n,e],300),{username:h,query:g,canShowHelp:p,usernameLowered:f}=(0,Kn.Z)(m,[m,n],!0);(0,bt.Z)((e=>{let[t]=e;t&&r({username:t})}),[h,r]),(0,i.d4)((()=>{f&&o({chatId:t,username:f,query:g})}),[t,g,o,f]),(0,i.d4)(u,[u,n]);const{id:I,switchPm:v,switchWebview:w,offset:b,results:Z,isGallery:P,help:y}=f&&s?.[f]||{},C=Boolean((Z?.length||v)&&!d);(0,i.d4)((()=>{C||h||c()}),[C,c,h]);const E=(0,It.Z)((()=>{f&&o({chatId:t,username:f,query:g,offset:b})}));return{isOpen:C,botId:I,isGallery:P,switchPm:v,switchWebview:w,results:Z,closeTooltip:l,help:p&&y?`@${h} ${y}`:void 0,loadMore:E}}(Boolean(l&&P&&!nt),p,Be,Y),{isOpen:Dn,close:qn,filteredBotCommands:$n}=function(e,t,n,a){const[s,o]=(0,i.eJ)(),[r,c,d]=(0,At.Z)(!1),l=(0,Ya.CH)((()=>{const n=t();return e&&n.startsWith("/")?(0,Oi._)(n).match(Ir)?.[0].trim():void 0}),[t,e],300),u=(0,Fi.Z)(l,[l,t],!0);return(0,i.d4)((()=>{const e=u(),t=n||a;if(!e||!t)return void o(void 0);const s=e.substring(1),i=t.filter((e=>!s||e.command.startsWith(s)));o(i?.length?i:void 0)}),[u,n,a]),(0,i.d4)(d,[d,t]),{isOpen:Boolean(s?.length&&!r),close:c,filteredBotCommands:s}}(Boolean(l&&P&&(K&&K?.length||X?.length)),Be,K,X);((e,t,n,r,d,l)=>{const{saveDraft:m,clearDraft:h,loadCustomEmojis:g}=(0,a.Sv)(),p=Boolean(l),f=(0,It.Z)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(p)return;const s=r();var o,i,c,d;s?m({chatId:null!==(o=e.chatId)&&void 0!==o?o:t,threadId:null!==(i=e.threadId)&&void 0!==i?i:n,draft:(0,_e.ZP)(s),shouldForce:a}):h({chatId:null!==(c=e.chatId)&&void 0!==c?c:t,threadId:null!==(d=e.threadId)&&void 0!==d?d:n,shouldForce:a})})),I=(0,qa.Y)(f),v=(0,$a.Z)(o.r_R,!0,void 0,[t,n]);(0,on.Z)((a=>{let[i,r,m]=a;if(t===i&&n===r&&(!e&&m&&d(""),!e?.shouldForce))return;if(l||!e)return;d((0,co.z)(e));const h=e.entities?.map((e=>e.type===u.Vv.CustomEmoji&&e.documentId)).filter(Boolean)||[];h.length&&g({ids:h}),s.$b||(0,c.Yq)((()=>{const e=document.querySelector(o.Edp);e&&(0,Ei.Z)(e,!0)}))}),[t,n,e,d,l,g]),(0,i.d4)((()=>()=>{p||I.current({chatId:t,threadId:n}),Pr=!0,(0,c.i$)((()=>{Pr=!1}))}),[t,n,p,I]);const w=(0,qa.Y)(t),b=(0,qa.Y)(n);function Z(){f(void 0,!0)}(0,i.d4)((()=>{if(Pr)return;if(!r())return void I.current();const e=w.current,t=b.current;v((()=>{w.current===e&&b.current===t&&I.current()}))}),[w,r,v,b,I]),(0,vt.Z)(Z),wt(Z)})(b,p,f,Be,Le,g);const Gn=(0,It.Z)((function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e||Le(""),tt(je.D),st(void 0),vn(),yn(),Sn(),Rn(),m?setTimeout((()=>zt()),350):zt()})),[Vn,zn,Yn]=((e,t,n,s,r,d,l,u,m,h,g)=>{const{editMessage:p,setEditingDraft:f,toggleMessageWebPage:I}=(0,a.Sv)(),[w,b]=(0,i.eJ)(!1);(0,on.Z)((e=>{let[a,s]=e;if(!n)return;if(g&&s!==g)return t(""),void b(!1);if(a?.id===n.id&&g===s)return;const i=!a&&h?.text.length?h:n.content.text,r=(0,co.z)(i);t(r),b(!0),(0,c.Yq)((()=>{const e=document.querySelector(o.Edp);e&&(0,Ei.Z)(e,!0)}))}),[n,g,h,t]),(0,i.d4)((()=>{if(!n)return;const e=!("webPage"in n.content)&&n.content.text?.entities?.some((e=>cr.has(e.type)));I({chatId:d,threadId:l,noWebPage:e})}),[d,l,n]),(0,i.d4)((()=>{if(n)return()=>{const t=(0,_e.ZP)(e()),n=t.text.length?t:void 0;f({chatId:d,threadId:l,type:u,text:n})}}),[d,n,e,f,l,u]);const Z=(0,Ya.iD)((()=>{if(!n)return!1;const t=(0,_e.ZP)(e());return!("webPage"in n.content)&&n.content.text?.entities?.some((e=>cr.has(e.type)))&&!t.entities?.some((e=>cr.has(e.type)))}),[n,e],300,!0),P=(0,Fi.Z)(Z,[Z,e],!0);(0,on.Z)((e=>{let[t]=e;n&&t?.id===n.id&&P()&&I({chatId:d,threadId:l,noWebPage:!1})}),[n,d,e,l,P]);const y=(0,It.Z)((()=>{m&&(0,c.i$)((()=>{t((0,co.z)(m)),(0,c.Yq)((()=>{const e=document.querySelector(o.Edp);e&&(0,Ei.Z)(e,!0)}))}))})),C=(0,It.Z)((()=>{s(),y()})),E=(0,It.Z)((()=>{const{text:t,entities:a}=(0,_e.ZP)(e());n&&(t||(0,v.u8)(n)?(p({messageList:{chatId:d,threadId:l,type:u},text:t,entities:a}),s(),y()):r())})),S=(0,It.Z)((()=>{if(!n)return;const t=(0,_e.ZP)(e()),a=t.text.length?t:void 0;f({chatId:d,threadId:l,type:u,text:a})}));return(0,vt.Z)(S),wt(S),[E,C,w]})(Be,Le,g,Gn,en,p,f,w,b,ne,ae),Jn=(0,qa.Y)(Gn),Xn=(0,qa.Y)(dn);(0,i.d4)((()=>()=>{Xn.current(),Jn.current()}),[p,f,Jn,Xn]);const Qn=(0,It.Z)((()=>{const e=Je.current;Te(e?{message:Ne("UnlockPremiumEmojiHint2"),action:{action:"openChat",payload:{id:D,shouldReplaceHistory:!0}},actionText:Ne("Open")}:{message:Ne("UnlockPremiumEmojiHint"),action:{action:"openPremiumModal",payload:{initialSection:"animated_emoji"}},actionText:Ne("PremiumMore")}),Je.current=Number(!e)})),ea=(0,Kn.Z)((()=>g&&Yn?tc.Edit:!s.mh||un||N||Be()&&!nt?r?tc.Schedule:tc.Send:tc.Record),[un,g,Be,nt,N,Yn,r]),na=!r,{isContextMenuOpen:aa,handleContextMenu:sa,handleContextMenuClose:oa,handleContextMenuHide:ia}=(0,Ra.Z)(hn,!(ea===tc.Send&&na));rr(P,Ct,jt,st,g,!y&&!S,Qn);const ra=(0,It.Z)((()=>{g&&zn()})),ca=(0,It.Z)(((e,t)=>{const n=t?q:4096;if(e?.length>n){const t=e.length-n;return ve({data:{message:"MESSAGE_TOO_LONG_PLEASE_REMOVE_CHARACTERS",textParams:{"{EXTRA_CHARS_COUNT}":t.toString(),"{PLURAL_S}":t>1?"s":""},hasErrorKey:!0}}),!1}return!0})),da=(0,It.Z)((()=>{if(me&&!fn){const e=document.querySelector(o.Edp),t=(0,Ie.bp)(),n=De.current&&Math.floor(t-De.current),a=me.nextSendDate&&me.nextSendDate>t;if(n&&n<me.seconds||a){const s=a?me.nextSendDate-t:me.seconds-n;return ve({data:{message:Ne("SlowModeHint",(0,de.k9)(s)),isSlowMode:!0,hasErrorKey:!1}}),e?.blur(),!1}}return!0})),la=(0,It.Z)((e=>{let{attachments:t,sendCompressed:n=le.shouldCompress,sendGrouped:a=le.shouldSendGrouped,isSilent:s,scheduledAt:o}=e;if(!I)return;const{text:i,entities:r}=(0,_e.ZP)(Be());(i||t.length)&&ca(i,!0)&&da()&&(pe({messageList:I,text:i,entities:r,scheduledAt:o,isSilent:s,shouldUpdateStickerSetOrder:he,attachments:Ri(t,n),shouldGroupMessages:a}),De.current=(0,Ie.bp)(),fe({chatId:p,localOnly:!0}),(0,c.i$)((()=>{Gn()})))})),ua=(0,It.Z)(((e,t,n,a)=>{la({attachments:et,sendCompressed:e,sendGrouped:t,isSilent:n,scheduledAt:a})})),ma=(0,It.Z)((async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0;if(!I)return;let n=et;if(un){const e=await dn();if(e){const{blob:t,duration:a,waveform:s}=e;n=[await Mi(nc,t,{voice:{duration:a,waveform:s}})]}}const{text:a,entities:i}=(0,_e.ZP)(Be());if(n.length)return void la({attachments:n});if(!a&&!N)return;if(!ca(a))return;const r=document.querySelector(o.Edp);if(a){if(!da())return;pe({messageList:I,text:a,entities:i,scheduledAt:t,isSilent:e,shouldUpdateStickerSetOrder:he})}N&&we({scheduledAt:t,isSilent:e}),De.current=(0,Ie.bp)(),fe({chatId:p,localOnly:!0}),s.cj&&r&&r===document.activeElement&&Bi(r),(0,c.i$)((()=>{Gn()}))})),ha=(0,It.Z)((()=>{"webApp"===ie?.type&&Re({chatId:p,url:ie.url,threadId:f})})),ga=(0,It.Z)((()=>{zt(),Ht()})),pa=(0,It.Z)(((e,t,n)=>{if(e&&"queryId"in e){const{id:a,queryId:s,isSilent:o}=e;return void Ee({id:a,queryId:s,scheduledAt:t,isSilent:o,messageList:n})}const{isSilent:a,...s}=e||{};if(e&&0!==Object.keys(s).length)if(void 0!==e.sendCompressed||void 0!==e.sendGrouped){const{sendCompressed:n=!1,sendGrouped:s=!1}=e;ua(n,s,a,t)}else pe({...e,messageList:n,scheduledAt:t});else ma(Boolean(a),t)}));(0,on.Z)((e=>{let[t]=e;I&&$&&$!==t&&Ke((e=>{pa($,e,I)}))}),[$,I,pa,Ke]),(0,i.d4)((()=>{se&&(Le(se),Me(),(0,c.Yq)((()=>{const e=document.getElementById(o.R2F);(0,Ei.Z)(e,!0)})))}),[se,Me,Le]),(0,i.d4)((()=>{oe?.length&&(Bt(oe),Me())}),[Bt,oe,Me]);const fa=(0,It.Z)(((e,t)=>{e.isFree||y||S?Et(e,t):Qn()})),Ia=(0,It.Z)((e=>{fa(e,o.nYf)})),va=(0,It.Z)(((e,t,n)=>{I&&(r||n?(We(),Ke((n=>{ze(),pa({gif:e,isSilent:t},n,I),(0,c.i$)((()=>{Gn(!0)}))}))):(pe({messageList:I,gif:e,isSilent:t}),(0,c.i$)((()=>{Gn(!0)}))))})),wa=(0,It.Z)((function(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4?arguments[4]:void 0;I&&(e={...e,isPreloadedGlobally:!0},r||n?(We(),Ke((n=>{ze(),pa({sticker:e,isSilent:t},n,I),(0,c.i$)((()=>{Gn(a)}))}))):(pe({messageList:I,sticker:e,isSilent:t,shouldUpdateStickerSetOrder:he&&s}),(0,c.i$)((()=>{Gn(a)}))))})),ba=(0,It.Z)(((e,t,n)=>{if(!I)return;r||n?Ke((n=>{pa({id:e.id,queryId:e.queryId,isSilent:t},n,I)})):Ee({id:e.id,queryId:e.queryId,isSilent:t,messageList:I});const a=document.querySelector(o.Edp);s.cj&&a&&a===document.activeElement&&Bi(a),fe({chatId:p,localOnly:!0}),(0,c.i$)((()=>{Gn()}))})),Za=(0,It.Z)((()=>{fe({chatId:p,localOnly:!0}),(0,c.i$)((()=>{Gn()}))})),Pa=(0,It.Z)((e=>{I&&(r?(Ke((t=>{pa({poll:e},t,I)})),Ze()):(pe({messageList:I,poll:e}),Ze()))})),ya=(0,It.Z)((e=>{if(r)Ke((t=>{pa({...e,isSilent:!0},t,I)}));else if(e&&("sendCompressed"in e||"sendGrouped"in e)){const{sendCompressed:t=!1,sendGrouped:n=!1}=e;ua(t,n,!0)}else ma(!0)})),Ca=(0,It.Z)((()=>{const e=document.querySelector(o.Edp);if(!m||e!==document.activeElement)return Gt(),zt(),void Jt();e?.blur(),setTimeout((()=>{Gt(),zt(),Jt()}),100)}));(0,i.d4)((()=>{Zt&&Le("")}),[Zt,Le,et]);const Ea=(0,It.Z)((e=>{yt(e,o.nYf)})),Sa=(0,It.Z)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:o.R2F;const t=window.getSelection();if(t.rangeCount){const n=t.getRangeAt(0);if((0,Ni.R)(n,e))return void document.execCommand("delete",!1)}Le(Ai(Be()))})),Ma=(0,It.Z)((()=>{Sa(o.nYf)})),ka=(0,It.Z)((()=>{ye({id:p,threadId:f,type:"scheduled",noForumTopicPanel:!0})}));(0,i.d4)((()=>{k&&m&&zt()}),[k,zt,m]),(0,i.d4)((()=>{l&&(T?sn():setTimeout((()=>{rn()}),200))}),[T,rn,sn,l]);const Ta=!(ea!==tc.Record||rt&&C&&lt),Aa=(0,It.Z)((()=>{switch(ea){case tc.Send:ma();break;case tc.Record:Ta?C?lt||Ae({chatId:p}):Te({message:Ne("VoiceMessagesRestrictedByPrivacy",Z?.title)}):cn();break;case tc.Edit:Vn();break;case tc.Schedule:if(un&&ln(),!I)return;Ke((e=>{pa({},e,I)}))}})),Na=(0,Hn.Z)(g,!0),xa=g||Na,Ba=new Date;Ba.setSeconds(0),Ba.setMilliseconds(0);const La=new Date;La.setFullYear(La.getFullYear()+1);let Ua="SendMessage";switch(ea){case tc.Edit:Ua="Save edited message";break;case tc.Record:Ua=rt?"AccDescrVoiceMessage":"Conversation.DefaultRestrictedMedia"}const ja=(0,ht.Z)("Composer",!T&&"shown",nn&&"hover-disabled",Ue&&"mounted"),Oa=(0,It.Z)((()=>{Ke((e=>{pa({},e,I)}))})),Fa=(0,It.Z)((()=>{ya()})),_a=(0,It.Z)((()=>{pa({},o.t4X,I)})),Da=(0,It.Z)(((e,t)=>{Ke((n=>{pa({sendCompressed:e,sendGrouped:t},n,I)}))})),Ha=(0,It.Z)(((e,t)=>{ya({sendCompressed:e,sendGrouped:t})})),Ga=ea===tc.Edit?Vn:ea===tc.Schedule?Oa:ma,Va=E&&"webApp"===ie?.type&&!g,Wa=(0,Kn.Z)((()=>Va&&!Be()&&!un),[Va,Be,un]),za=E&&"commands"===ie?.type&&!g&&!1!==K&&!un;return i.ZP.createElement("div",{className:ja},rt&&l&&i.ZP.createElement(Yr,{isOpen:n!==On.t.None,withQuick:n===On.t.QuickFile||qe===On.t.QuickFile,onHide:h,onFileSelect:Bt}),i.ZP.createElement(Vr,{chatId:p,threadId:f,canShowCustomSendMenu:na,attachments:et,getHtml:Be,isReady:l,shouldSuggestCompression:Mt,shouldForceCompression:kt,shouldForceAsFile:Nt,isForCurrentMessageList:P,shouldSchedule:r,onCaptionUpdate:Lt,onSendSilent:Ha,onSend:ua,onSendScheduled:Da,onFileAppend:xt,onClear:Ut,onAttachmentsUpdate:jt,onCustomEmojiSelect:Ia,onRemoveSymbol:Ma,onEmojiSelect:Ea}),i.ZP.createElement(zr,{isOpen:x.isOpen,isQuiz:x.isQuiz,shouldBeAnonymous:M,onClear:Ze,onSend:Pa}),xa&&i.ZP.createElement(yr,{isOpen:Qt,isSchedule:"scheduled"===w,onClose:tn,message:xa}),i.ZP.createElement(Xr,{isOpen:Yt,onClose:Kt,chatId:p,selectedSendAsId:te,sendAsPeerIds:He,isCurrentUserPremium:y}),i.ZP.createElement(Lr,{isOpen:Mn,filteredUsers:Tn,onInsertUserName:kn,onClose:Rn}),i.ZP.createElement(_r,{isOpen:Dn,withUsername:Boolean(X),botCommands:$n,getHtml:Be,onClick:Za,onClose:qn}),i.ZP.createElement("div",{id:"message-compose"},i.ZP.createElement("svg",{className:"svg-appendix",width:"9",height:"20"},i.ZP.createElement("defs",null,i.ZP.createElement("filter",{x:"-50%",y:"-14.7%",width:"200%",height:"141.2%",filterUnits:"objectBoundingBox",id:"composerAppendix"},i.ZP.createElement("feOffset",{dy:"1",in:"SourceAlpha",result:"shadowOffsetOuter1"}),i.ZP.createElement("feGaussianBlur",{stdDeviation:"1",in:"shadowOffsetOuter1",result:"shadowBlurOuter1"}),i.ZP.createElement("feColorMatrix",{values:"0 0 0 0 0.0621962482 0 0 0 0 0.138574144 0 0 0 0 0.185037364 0 0 0 0.15 0",in:"shadowBlurOuter1"}))),i.ZP.createElement("g",{fill:"none","fill-rule":"evenodd"},i.ZP.createElement("path",{d:"M6 17H0V0c.193 2.84.876 5.767 2.05 8.782.904 2.325 2.446 4.485 4.625 6.48A1 1 0 016 17z",fill:"#000",filter:"url(#composerAppendix)"}),i.ZP.createElement("path",{d:"M6 17H0V0c.193 2.84.876 5.767 2.05 8.782.904 2.325 2.446 4.485 4.625 6.48A1 1 0 016 17z",fill:"#FFF",className:"corner"}))),i.ZP.createElement(Br,{isOpen:An,botId:Nn,isGallery:xn,inlineBotResults:Un,switchPm:Bn,switchWebview:Ln,loadMore:_n,isSavedMessages:S,canSendGifs:it,isCurrentUserPremium:y,onSelectResult:ba,onClose:jn}),i.ZP.createElement(Gr,{onClear:ra,shouldForceShowEditing:Boolean(Yn&&g)}),i.ZP.createElement(Kr,{chatId:p,threadId:f,getHtml:Be,isDisabled:!dt||nt}),i.ZP.createElement("div",{className:"message-input-wrapper"},Va&&i.ZP.createElement(Qr,{isOpen:Wa,text:ie.text,isDisabled:Boolean(un),onClick:ha}),za&&i.ZP.createElement(Cr.Z,{className:(0,ht.Z)("bot-commands",$t&&"activated"),round:!0,disabled:void 0===K,color:"translucent",onActivate:ga,ariaLabel:"Open bot command keyboard"},i.ZP.createElement("i",{className:"icon icon-bot-commands-filled"})),Ge&&(Q||ee)&&i.ZP.createElement(Xt.Z,{round:!0,color:"translucent",onClick:Yt?Kt:Ca,ariaLabel:Ne("SendMessageAsTitle"),className:(0,ht.Z)("send-as-button",Qe.current&&"appear-animation")},i.ZP.createElement(ks.Z,{peer:Q||ee,size:"tiny"})),(!Zt||it||ot)&&i.ZP.createElement(ec.Z,{chatId:p,threadId:f,isMobile:m,isReady:l,isSymbolMenuOpen:Vt,openSymbolMenu:Wt,closeSymbolMenu:zt,canSendStickers:ot,canSendGifs:it,onGifSelect:va,onStickerSelect:wa,onCustomEmojiSelect:fa,onRemoveSymbol:Sa,onEmojiSelect:yt,closeBotCommandMenu:Gt,closeSendAsMenu:Kt,isSymbolMenuForced:Ve,canSendPlainText:!Zt}),i.ZP.createElement(qr.Z,{ref:xe,id:"message-input-text",editableInputId:o.R2F,chatId:p,canSendPlainText:!Zt,threadId:f,isReady:l,isActive:!nt,getHtml:Be,placeholder:un&&$e<=600?"":Zt?Ne("Chat.PlaceholderTextNotAllowed"):L||Ne("Message"),forcedPlaceholder:Fn,canAutoFocus:l&&P&&!nt,noFocusInterception:nt,shouldSuppressFocus:m&&Vt,shouldSuppressTextFormatter:In||Mn||An,onUpdate:Le,onSend:Ga,onSuppressedFocus:zt}),J&&Boolean(Nn)&&i.ZP.createElement(an.Z,{color:"gray"}),U&&i.ZP.createElement(Xt.Z,{round:!0,faded:!0,className:"scheduled-button",color:"translucent",onClick:ka,ariaLabel:"Open scheduled messages"},i.ZP.createElement("i",{className:"icon icon-schedule"})),Boolean(B)&&!un&&!g&&i.ZP.createElement(Cr.Z,{className:Ft?"activated":"",round:!0,color:"translucent",onActivate:_t,ariaLabel:"Open bot command keyboard"},i.ZP.createElement("i",{className:"icon icon-bot-command"})),un&&Boolean(mn)&&i.ZP.createElement("span",{className:"recording-state"},(0,de.rM)(mn-gn.current)),i.ZP.createElement(xr,{chatId:p,threadId:f,isButtonVisible:!un&&!g,canAttachMedia:rt,canAttachPolls:ct,canSendPhotos:pt,canSendVideos:gt,canSendDocuments:ft,canSendAudios:mt,onFileSelect:Bt,onPollCreate:be,isScheduled:r,attachBots:re,peerType:ce,shouldCollectDebugLogs:ge,theme:ue}),Boolean(B)&&i.ZP.createElement(Dr,{messageId:B,isOpen:Ft,onClose:Dt}),K&&i.ZP.createElement(Wr,{isOpen:$t,botCommands:K,onClose:Gt}),i.ZP.createElement(Or.Z,{chatId:p,isOpen:Pn,onCustomEmojiSelect:Cn,addRecentCustomEmoji:ke,onClose:yn}),i.ZP.createElement(jr,{chatId:p,threadId:f,isOpen:En,onStickerSelect:wa,onClose:Sn}),i.ZP.createElement(Fr.Z,{isOpen:In,emojis:wn,customEmojis:bn,addRecentEmoji:Ce,addRecentCustomEmoji:ke,onEmojiSelect:Zn,onCustomEmojiSelect:Zn,onClose:vn}))),un&&i.ZP.createElement(Xt.Z,{round:!0,color:"danger",className:"cancel",onClick:dn,ariaLabel:"Cancel voice recording"},i.ZP.createElement("i",{className:"icon icon-delete"})),i.ZP.createElement(Xt.Z,{ref:hn,round:!0,color:"secondary",className:(0,ht.Z)(ea,!l&&"not-ready",un&&"recording"),disabled:Ta,allowDisabledClick:!0,noFastClick:!0,ariaLabel:Ne(Ua),onClick:Aa,onContextMenu:ea===tc.Send&&na?sa:void 0},i.ZP.createElement("i",{className:"icon icon-send"}),i.ZP.createElement("i",{className:"icon icon-schedule"}),i.ZP.createElement("i",{className:"icon icon-microphone-alt"}),i.ZP.createElement("i",{className:"icon icon-check"})),na&&i.ZP.createElement(Ur.Z,{isOpen:aa,canScheduleUntilOnline:d,onSendSilent:S?void 0:Fa,onSendSchedule:r?void 0:Oa,onSendWhenOnline:_a,onClose:oa,onCloseAnimationEnd:ia,isSavedMessages:S}),Xe)}))),sc=e=>{const{isActive:t}=e,n=(0,Nt.Z)(ft.gl.Extra,"MobileSearch",!t,!0);return n?i.ZP.createElement(n,e):void 0},oc=e=>{const{isActive:t}=e,n=(0,Nt.Z)(ft.gl.Extra,"MessageSelectToolbar",!t);return n?i.ZP.createElement(n,e):void 0},ic=e=>{const{isOpen:t}=e,n=(0,Nt.Z)(ft.gl.Extra,"UnpinAllMessagesModal",!t);return n?i.ZP.createElement(n,e):void 0},rc=e=>{const{isOpen:t}=e,n=(0,Nt.Z)(ft.gl.Extra,"SeenByModal",!t);return n?i.ZP.createElement(n,e):void 0},cc=e=>{const{activeEmojiInteraction:t}=e,n=(0,Nt.Z)(ft.gl.Extra,"EmojiInteractionAnimation",!t);return n?i.ZP.createElement(n,e):void 0},dc=e=>{const{isOpen:t}=e,n=(0,Nt.Z)(ft.gl.Extra,"ReactorListModal",!t);return n?i.ZP.createElement(n,e):void 0},lc=e=>{const{isOpen:t}=e,n=(0,Nt.Z)(ft.gl.Extra,"GiftPremiumModal",!t);return n?i.ZP.createElement(n,e):void 0},uc=e=>{const{isOpen:t}=e,n=(0,Nt.Z)(ft.gl.Extra,"ChatLanguageModal",!t);return n?i.ZP.createElement(n,e):void 0};function mc(e){return"file"===e.kind&&e.type&&o.oGt.has(e.type)}const hc=450+o.fK3,gc=(0,i.X$)((0,a.c$)(((e,t)=>{let{isMobile:n}=t;const a=(0,f.Pu)(e),{isBlurred:s,background:i,backgroundColor:r,patternColor:c}=e.settings.themes[a]||{},{messageLists:d,isLeftColumnShown:l,activeEmojiInteractions:m,seenByModal:h,giftPremiumModal:g,reactorModal:p,audioPlayer:I,shouldSkipHistoryAnimations:w,chatLanguageModal:b}=(0,f.jU)(e),Z=(0,f.Bt)(e),{leftColumnWidth:P}=e,y={theme:a,customBackground:i,backgroundColor:r,patternColor:c,isLeftColumnShown:l,isRightColumnShown:(0,f.Jf)(e,n),isBackgroundBlurred:s,hasCurrentTextSearch:Boolean((0,f.n5)(e)),isSelectModeActive:(0,f.CA)(e),isSeenByModalOpen:Boolean(h),isReactorListModalOpen:Boolean(p),isGiftPremiumModalOpen:g?.isOpen,isChatLanguageModalOpen:Boolean(b),withInterfaceAnimations:(0,f.FO)(e),currentTransitionKey:Math.max(0,d.length-1),activeEmojiInteractions:m,leftColumnWidth:P};if(!Z)return y;const{chatId:C,threadId:E,type:S}=Z,M=(0,v.YC)(C),R=(0,f.Z1)(e,C),k=(0,f.kB)(e,C),T=(0,f.KB)(e,C,E),{chatId:A,messageId:N}=I,x=(0,f.tZ)(e,C,E),B=Boolean(x?.originChannelId),L=R&&(0,v.Qm)(R,E,B),U=(0,f.pk)(e,C),j="pinned"===S,O="thread"===S&&E===u._f,F=Boolean(R&&(0,v.eA)(R)),_=Boolean(R&&O&&(F||(0,v.ZV)(R))&&R.isNotJoined&&!R.joinRequests),D=Boolean(R?.isNotJoined&&R.isJoinToSend),q=Boolean(R?.isNotJoined&&R.isJoinRequest),$=Boolean(k&&(0,f.s4)(e,k.id)),H=!$&&U,G=Boolean(R&&(0,v.Bf)(R)&&!(0,f.x6)(e,R.id)),V=(0,f.Yy)(e,C,E),W=!!R?.isForum&&E===u._f&&!V&&R.topics?.[o.OxA]?.isClosed,z=A&&N?(0,f.hj)(e,A,N):void 0,Y=E!==u._f&&!R?.isForum,J=Y?(0,f.qS)(e,C,E):void 0,K=R&&(M||R?.isCreator||!F&&!(0,v.Mg)(R,"pinMessages")||(0,v.VE)(R,"pinMessages"));return{...y,chatId:C,threadId:E,messageListType:S,chat:R,replyingToId:V,isPrivate:M,areChatSettingsLoaded:Boolean(R?.settings),canPost:!j&&(!R||L)&&!U&&!(D&&R?.isNotJoined)&&!W,isPinnedMessageList:j,currentUserBannedRights:R?.currentUserBannedRights,defaultBannedRights:R?.defaultBannedRights,hasPinned:Y||Boolean(!j&&T?.length),hasAudioPlayer:Boolean(z),hasButtonInHeader:H||$||_||q,pinnedMessagesCount:T?T.length:0,shouldSkipHistoryAnimations:w,isChannel:F,canSubscribe:_,canStartBot:H,canRestartBot:$,shouldJoinToSend:D,shouldSendJoinRequest:q,shouldLoadFullChat:G,pinnedIds:T,topMessageId:J,canUnpin:K}}))((function(e){let{leftColumnRef:t,chatId:n,threadId:r,messageListType:d,isMobile:l,chat:u,replyingToId:m,isPrivate:h,isPinnedMessageList:p,canPost:I,currentUserBannedRights:w,defaultBannedRights:b,hasPinned:Z,hasAudioPlayer:P,hasButtonInHeader:y,pinnedMessagesCount:C,customBackground:A,theme:N,backgroundColor:x,patternColor:L,isLeftColumnShown:U,isRightColumnShown:j,isBackgroundBlurred:O,leftColumnWidth:F,hasCurrentTextSearch:_,isSelectModeActive:D,isSeenByModalOpen:q,isReactorListModalOpen:$,isGiftPremiumModalOpen:H,isChatLanguageModalOpen:G,withInterfaceAnimations:V,shouldSkipHistoryAnimations:W,currentTransitionKey:z,isChannel:Y,areChatSettingsLoaded:J,canSubscribe:K,canStartBot:X,canRestartBot:Q,activeEmojiInteractions:ee,shouldJoinToSend:te,shouldSendJoinRequest:ne,shouldLoadFullChat:ae,pinnedIds:se,topMessageId:oe,canUnpin:ie}=e;const{openChat:re,openPreviousChat:ce,unpinAllMessages:de,loadUser:le,loadChatSettings:ue,closeLocalTextSearch:me,exitMessageSelectMode:he,joinChannel:ge,sendBotCommand:pe,restartBot:fe,showNotification:Ie,loadFullChat:ve,setLeftColumnWidth:we,resetLeftColumnWidth:be}=(0,a.Sv)(),{width:Ze}=(0,qn.Z)(),{isTablet:Pe,isDesktop:ye}=(0,B.ZP)(),Ce=(0,qt.Z)(),[Ee,Se]=(0,i.eJ)(On.t.None),[Me,Re]=(0,i.eJ)(),[ke,Te]=(0,i.eJ)(),[Ae,Ne]=(0,i.eJ)(!1),{onIntersectionChanged:xe,onFocusPinnedMessage:Be,getCurrentPinnedIndexes:Le,getLoadingPinnedId:Ue,getForceNextPinnedInHeader:je}=function(e,t,n,s){const[o,r]=(0,Wn.Z)({}),[c,d]=(0,Wn.Z)(),l=(0,i.sO)(),[u,m]=(0,Wn.Z)(),h=e?`${e}_${t}`:void 0;return(0,i.d4)((()=>{d(void 0),l.current=void 0,m(void 0)}),[e,r,d,m,t]),(0,i.d4)((()=>{if(!h)return;const e=o()[h],t=n?.length||0;e>=t&&r({...o(),[h]:Math.max(0,t-1)})}),[o,h,n?.length,r]),{onIntersectionChanged:(0,It.Z)((s=>{let{viewportPinnedIdsToAdd:i=[],viewportPinnedIdsToRemove:p=[],isReversed:I,hasScrolled:v,isUnmount:w}=s;if(!e||!t||!h)return;const b=(0,a.Rd)();if(!n?.length||!n)return;const Z=u();if(Z&&!v){const e=n.indexOf(Z);r({...o(),[h]:e}),m(void 0)}v&&(d(void 0),m(void 0));const P=c(),y=l.current;if(w&&0===i.length&&1===p.length&&!y?.includes(p[0]))return;const C=(0,g.Tw)((y?.filter((e=>!p.includes(e)))||[]).concat(i));l.current=C;const E=(0,f.G$)(b,e);if(!C.length&&w&&E&&!n.includes(E)){const e=n.find((e=>e<E));if(e){const t=n.indexOf(e);r({...o(),[h]:t})}}if(P||w)return;const S=Math.max(...C),M=n.findIndex((e=>e===S)),R=I?0:1,k=C.length?M:y?.length?(0,Gn.uZ)(n.indexOf(y[0])+R,0,n.length-1):0;r({...o(),[h]:k})})),onFocusPinnedMessage:(0,It.Z)((i=>{if(!e||!t||!h||u())return!1;const c=(0,a.Rd)();if(!n?.length)return s===i;const l=n.indexOf(i),g=(0,Vn.Z)(n.length,l+1);return d(!0),(0,f.gb)(c,e,t)?.includes(i)||(0,f.of)(c,e,t,i)?(r({...o(),[h]:g}),!0):(m(n[g]),!0)})),getCurrentPinnedIndexes:o,getLoadingPinnedId:u,getForceNextPinnedInHeader:c}}(n,r,se,oe),Oe=l&&_,Fe=l?hc:void 0,_e=Z&&(Ze<o.l35||P||j&&Ze>o._mX&&Ze<o.QU1||!l&&y&&Ze<o.sgm),De=(0,$n.Z)(n,Fe),qe=(0,$n.Z)(r,Fe),$e=(0,$n.Z)(d,Fe),He=(0,$n.Z)(K,Fe),Ge=(0,$n.Z)(X,Fe),Ve=(0,$n.Z)(Q,Fe),We=(0,$n.Z)(I,Fe)&&!Ve&&!Ge&&!He&&n!==o.mzl,ze=(0,$n.Z)(_e,Fe),Ye=(0,$n.Z)(Me,Fe)&&n!==o.mzl,Je=(0,$n.Z)(Y,Fe),Ke=(0,$n.Z)(te,Fe),Xe=(0,$n.Z)(ne,Fe),Qe=(0,$n.Z)(n?xe:void 0,Fe),et=(0,Hn.Z)(z),tt=void 0!==et&&et<z?et:void 0,{isReady:nt,handleCssTransitionEnd:at,handleSlideTransitionStop:st}=function(e,t,n,a,s){const[o,r]=(0,i.eJ)(!s),c=(0,Et.Z)(),d=void 0!==n&&n!==t;return d&&(e?(r(!1),setTimeout((()=>{r(!0)}),hc)):c()),(0,bt.Z)((()=>{e||r(!0)}),[e]),{isReady:o&&!d,handleCssTransitionEnd:e?function(e){"transform"===e.propertyName&&e.target===e.currentTarget&&r(Boolean(a))}:void 0,handleSlideTransitionStop:e?function(){r(!0)}:void 0}}(!W&&V,z,et,n,l);(0,i.d4)((()=>n?(0,Ot.Z)((()=>{re({id:void 0})})):void 0),[n,re]),(0,bt.Z)((()=>{Se(On.t.None),Te(void 0)}),[n]),(0,i.d4)((()=>{if(!s.cj&&!s.wZ)return;const{visualViewport:e}=window;if(!e)return;const t=()=>{const t=e.height!==document.documentElement.clientHeight;(0,c.WM)((()=>{document.body.classList.toggle("keyboard-visible",t),(0,c.i$)((()=>{!t&&e.offsetTop&&(0,c.WM)((()=>{window.scrollTo({top:0})}))}))}))};return e.addEventListener("resize",t),()=>{e.removeEventListener("resize",t)}})),(0,i.d4)((()=>{h&&le({userId:n})}),[n,h,le]),(0,i.d4)((()=>{J||ue({chatId:n})}),[n,h,J]),(0,i.d4)((()=>{n&&ae&&nt&&ve({chatId:n})}),[ae,n,nt,ve]);const{initResize:ot,resetResize:it,handleMouseUp:rt}=function(e,t,n,a,s){const[o,r,d]=(0,At.Z)(),[l,u]=(0,i.eJ)(0),[m,h]=(0,i.eJ)(0),g=(0,It.Z)((t=>{(0,c.WM)((()=>{if(!e.current)return;const n=t?`${t}px`:"";e.current.style.width=n,e.current.style.setProperty(s,n)}))}));function p(){(0,c.WM)((()=>{document.body.classList.remove("cursor-ew-resize")}))}return(0,i.bt)((()=>{e.current&&a&&g(a)}),[s,e,a,g]),(0,i.d4)((()=>{if(!o)return;const n=e=>{const t=Math.ceil(m+e.clientX-l);g(t)};function a(){s(),t(e.current.offsetWidth)}function s(){p(),document.removeEventListener("mousemove",n,!1),document.removeEventListener("mouseup",a,!1),document.removeEventListener("blur",a,!1),d()}return document.addEventListener("mousemove",n,!1),document.addEventListener("mouseup",a,!1),document.addEventListener("blur",a,!1),s}),[m,l,e,t,o,d,g]),{initResize:function(t){t.preventDefault(),(0,c.WM)((()=>{document.body.classList.add("cursor-ew-resize")})),u(t.clientX),h(e.current.offsetWidth),r()},resetResize:function(e){e.preventDefault(),g(void 0),n()},handleMouseUp:p}}(t,(e=>we({leftColumnWidth:e})),be,F,"--left-column-width"),ct=(0,It.Z)((e=>{const{items:t}=e.dataTransfer||{},n=t&&t.length>0&&Array.from(t).filter((e=>"text/uri-list"!==e.type)).every(mc);Se(n?On.t.QuickFile:On.t.Document)})),dt=(0,It.Z)((()=>{Se(On.t.None)})),lt=(0,It.Z)((()=>{Ne(!0)})),ut=(0,It.Z)((()=>{Ne(!1)})),mt=(0,It.Z)((()=>{de({chatId:n,threadId:r}),ut(),ce()})),gt=(0,It.Z)((()=>{re({id:n})})),pt=(0,It.Z)((()=>{ge({chatId:n}),Xe&&Ie({message:Ce(Y?"RequestToJoinChannelSentDescription":"RequestToJoinGroupSentDescription")})})),ft=(0,It.Z)((()=>{pe({command:"/start"})})),vt=(0,It.Z)((()=>{fe({chatId:n})})),wt=((e,t)=>{const[n,a]=(0,i.eJ)(t);return(0,i.d4)((()=>{t&&(t.startsWith("#")?a(t):_n.fetch(o.foQ,e,_n.Type.Blob).then((e=>{const t=URL.createObjectURL(e);(0,Dn.pt)(t).then((()=>{a(`url(${t})`)}))})))}),[t,e]),t?n:void 0})(N,A),Zt=(0,ht.Z)(ze&&"has-header-tools",s.aZ?"mask-image-disabled":"mask-image-enabled"),Pt=(0,ht.Z)("ON5E8MkEVA1mAlkuIxhG","OWFg9Wf1uioPWDz_IgS8",A&&"Ik9ZZlj3eKtKXRrUZKVk",x&&"avVozLQe3SaWcSkIt6pG",A&&O&&"Tipa66fYcSvl6w0587Xz",j&&"vhOr8s3T_LCKSt2BF7fs"),yt=(0,ht.Z)("messaging-disabled",!D&&"shown"),Ct=(0,v.q8)(Ce,w,b),St=(0,v.mt)(Ce,u,r,Boolean(m)),Mt=Ct||St,{composerHiddenScale:Rt,toolbarHiddenScale:kt,composerTranslateX:Tt,toolbarTranslateX:Nt,unpinHiddenScale:xt,toolbarForUnpinHiddenScale:Bt}=(0,i.Ye)((()=>function(e,t){const n=e<=o.l35?E.Gw:2*E.Gw,a=function(e){if(e>o._mX){const t=Math.min(Math.max(.25*e,k),R),n=Math.min(.25*e,R);return Math.min(e-t-n,M)}if(e>o.ksF){const t=Math.min(Math.max(.4*e,k),R);return Math.min(e-t,M)}return e>M?M:e}(e),s=e<=o.l35?3.375*E.Gw:4*E.Gw,i=t?a-n-s:a-n,r=e>o.l35?Math.min(a-n,S):a-n,c=r/i,d=i/r;return{composerHiddenScale:c,toolbarHiddenScale:d,composerTranslateX:t?s/2*d:0,toolbarTranslateX:t?s/2*-1*c:0,unpinHiddenScale:r/T,toolbarForUnpinHiddenScale:T/r}}(Ze,We)),[We,Ze]),Lt=(0,ht.Z)("middle-column-footer",!We&&"no-composer",We&&ke&&!D&&"with-notch");(0,wn.Z)({isActive:D,onBack:he}),(0,wn.Z)({isActive:Oe,onBack:me});const Ut=Boolean(!p&&!We&&!Ve&&!Ge&&!He&&Mt),jt=Boolean(Ve||He||Xe||Ge||p),Ft=Boolean(Ut||D||p);return i.ZP.createElement("div",{id:"MiddleColumn",className:Zt,onTransitionEnd:at,style:(0,Fn.Z)(`--composer-hidden-scale: ${Rt}`,`--toolbar-hidden-scale: ${kt}`,`--unpin-hidden-scale: ${xt}`,`--toolbar-unpin-hidden-scale: ${Bt},`,`--composer-translate-x: ${Tt}px`,`--toolbar-translate-x: ${Nt}px`,`--pattern-color: ${L}`,x&&`--theme-background-color: ${x}`),onClick:Pe&&U?gt:void 0},ye&&i.ZP.createElement("div",{className:"resize-handle",onMouseDown:ot,onMouseUp:rt,onDoubleClick:it}),i.ZP.createElement("div",{className:Pt,style:wt?`--custom-background: ${wt}`:void 0}),i.ZP.createElement("div",{id:"middle-column-portals"}),Boolean(De&&qe)&&i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement("div",{className:"messages-layout",onDragEnter:We?ct:void 0},i.ZP.createElement(Ua,{chatId:De,threadId:qe,messageListType:$e,isReady:nt,isMobile:l,getCurrentPinnedIndexes:Le,getLoadingPinnedId:Ue,onFocusPinnedMessage:Be}),i.ZP.createElement(Dt.Z,{name:W?"none":V?"slide":"fade",activeKey:z,shouldCleanup:!0,cleanupExceptionKey:tt,onStop:st},i.ZP.createElement(Zi,{key:`${De}-${qe}-${$e}`,chatId:De,threadId:qe,type:$e,canPost:We,hasTools:ze,onFabToggle:Re,onNotchToggle:Te,isReady:nt,withBottomShift:jt,withDefaultBg:Boolean(!A&&!x),onPinnedIntersectionChange:Qe,getForceNextPinnedInHeader:je}),i.ZP.createElement("div",{className:Lt},We&&i.ZP.createElement(ac,{chatId:De,threadId:qe,messageListType:$e,dropAreaState:Ee,onDropHide:dt,isReady:nt,isMobile:l}),p&&ie&&i.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:Ce.isRtl?"rtl":void 0},i.ZP.createElement(Xt.Z,{size:"tiny",fluid:!0,color:"secondary",className:"unpin-all-button",onClick:lt},i.ZP.createElement("i",{className:"icon icon-unpin"}),i.ZP.createElement("span",null,Ce("Chat.Pinned.UnpinAll",C,"i")))),Ut&&i.ZP.createElement("div",{className:yt},i.ZP.createElement("div",{className:"messaging-disabled-inner"},i.ZP.createElement("span",null,Mt))),l&&(He||Ke&&!Xe)&&i.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:Ce.isRtl?"rtl":void 0},i.ZP.createElement(Xt.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:pt},Ce(Je?"ProfileJoinChannel":"ProfileJoinGroup"))),l&&Xe&&i.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:Ce.isRtl?"rtl":void 0},i.ZP.createElement(Xt.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:pt},Ce("ChannelJoinRequest"))),l&&Ge&&i.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:Ce.isRtl?"rtl":void 0},i.ZP.createElement(Xt.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:ft},Ce("BotStart"))),l&&Ve&&i.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:Ce.isRtl?"rtl":void 0},i.ZP.createElement(Xt.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:vt},Ce("BotRestart"))),i.ZP.createElement(oc,{messageListType:$e,isActive:D,canPost:We}),i.ZP.createElement(rc,{isOpen:q}),i.ZP.createElement(dc,{isOpen:$}),s.SX&&i.ZP.createElement(uc,{isOpen:G}))),i.ZP.createElement(Ci,{isShown:Ye,canPost:We,withExtraShift:Ft})),l&&i.ZP.createElement(sc,{isActive:Boolean(Oe)})),n&&i.ZP.createElement(ic,{isOpen:Ae,chatId:n,pinnedMessagesCount:C,onClose:ut,onUnpin:mt}),i.ZP.createElement("div",{teactFastList:!0},ee?.map(((e,t)=>i.ZP.createElement(cc,{teactOrderKey:t,key:e.id,activeEmojiInteraction:e})))),i.ZP.createElement(lc,{isOpen:H}))}))),pc=450+o.fK3,fc=(0,I.Ds)((e=>e()),200,!1);var Ic=function(e){return e[e.Profile=0]="Profile",e[e.MemberList=1]="MemberList",e[e.SharedMedia=2]="SharedMedia",e[e.Search=3]="Search",e[e.Statistics=4]="Statistics",e[e.MessageStatistics=5]="MessageStatistics",e[e.Management=6]="Management",e[e.ManageInitial=7]="ManageInitial",e[e.ManageChannelSubscribers=8]="ManageChannelSubscribers",e[e.ManageChatAdministrators=9]="ManageChatAdministrators",e[e.ManageChatPrivacyType=10]="ManageChatPrivacyType",e[e.ManageDiscussion=11]="ManageDiscussion",e[e.ManageGroupPermissions=12]="ManageGroupPermissions",e[e.ManageGroupRemovedUsers=13]="ManageGroupRemovedUsers",e[e.ManageChannelRemovedUsers=14]="ManageChannelRemovedUsers",e[e.ManageGroupUserPermissionsCreate=15]="ManageGroupUserPermissionsCreate",e[e.ManageGroupUserPermissions=16]="ManageGroupUserPermissions",e[e.ManageGroupRecentActions=17]="ManageGroupRecentActions",e[e.ManageGroupAdminRights=18]="ManageGroupAdminRights",e[e.ManageGroupNewAdminRights=19]="ManageGroupNewAdminRights",e[e.ManageGroupMembers=20]="ManageGroupMembers",e[e.ManageGroupAddAdmins=21]="ManageGroupAddAdmins",e[e.StickerSearch=22]="StickerSearch",e[e.GifSearch=23]="GifSearch",e[e.PollResults=24]="PollResults",e[e.AddingMembers=25]="AddingMembers",e[e.ManageInvites=26]="ManageInvites",e[e.ManageEditInvite=27]="ManageEditInvite",e[e.ManageReactions=28]="ManageReactions",e[e.ManageInviteInfo=29]="ManageInviteInfo",e[e.ManageJoinRequests=30]="ManageJoinRequests",e[e.CreateTopic=31]="CreateTopic",e[e.EditTopic=32]="EditTopic",e}(Ic||{});const vc=(0,a.c$)(((e,t)=>{let{chatId:n,isProfile:a,isManagement:s,threadId:o}=t;const i=(0,f.jU)(e),{query:r}=(0,f.n5)(e)||{},{query:c}=(0,f.y5)(e)||{},{query:d}=(0,f.yN)(e)||{},l=n?(0,f.Z1)(e,n):void 0,m=a&&n&&(0,v.YC)(n)?(0,f.dy)(e,n):void 0,h=l&&(0,v.eA)(l),g=l?.isForum&&Boolean(o&&o!==u._f),p=g?l.topics?.[o]:void 0,I=g&&p&&(0,v.GU)(l,p),w=m&&(0,v.cS)(m),b=m&&(0,v.kw)(m),Z=Boolean(!s&&a&&n&&(0,f.Yo)(e,n)),P=Boolean(n&&i.management.byChatId[n]?.editingInvite),y=!g&&n?(0,f.x6)(e,n)?.canViewStatistics:void 0,C=n?i.management.byChatId[n]?.inviteInfo?.invite:void 0;return{canManage:Z,canAddContact:b,canViewStatistics:y,isChannel:h,isBot:w,isInsideTopic:g,canEditTopic:I,userId:m?.id,messageSearchQuery:r,stickerSearchQuery:c,gifSearchQuery:d,isEditingInvite:P,currentInviteInfo:C,shouldSkipHistoryAnimations:i.shouldSkipHistoryAnimations}}))((e=>{var t;let{chatId:n,threadId:s,isColumnOpen:o,isProfile:r,isSearch:c,isManagement:d,isStatistics:l,isMessageStatistics:u,isStickerSearch:h,isGifSearch:g,isPollResults:p,isCreatingTopic:f,isEditingTopic:I,isAddingChatMembers:v,profileState:w,managementScreen:b,canAddContact:Z,userId:P,canManage:y,isChannel:C,onClose:E,onScreenSelect:S,messageSearchQuery:M,stickerSearchQuery:R,gifSearchQuery:k,isEditingInvite:T,canViewStatistics:A,currentInviteInfo:N,shouldSkipHistoryAnimations:x,isBot:L,isInsideTopic:U,canEditTopic:j}=e;const{setLocalTextSearchQuery:O,setStickerSearchQuery:F,setGifSearchQuery:_,searchTextMessagesLocal:D,toggleManagement:q,openHistoryCalendar:$,openAddContactDialog:H,toggleStatistics:G,setEditingExportedInvite:V,deleteExportedChatInvite:W,openEditTopicPanel:z}=(0,a.Sv)(),[Y,J,K]=(0,At.Z)(),{isMobile:X}=(0,B.ZP)(),Q=(0,It.Z)((()=>{V({chatId:n,invite:N}),S(m.u1.EditInvite)})),ee=(0,It.Z)((()=>{W({chatId:n,link:N.link}),S(m.u1.Invites),K()})),te=(0,It.Z)((e=>{O({query:e}),e.length&&fc(D)})),ne=(0,It.Z)((e=>{F({query:e})})),ae=(0,It.Z)((e=>{_({query:e})})),se=(0,It.Z)((()=>{H({userId:P})})),oe=(0,It.Z)((()=>{n&&s&&z({chatId:n,topicId:s})})),ie=(0,It.Z)((()=>{q()})),re=(0,It.Z)((()=>{G()})),[ce,le]=(0,i.eJ)(!o);(0,i.d4)((()=>{setTimeout((()=>{le(!o)}),pc)}),[o]);const ue=(0,qt.Z)(),me=r?w===m.vi.Profile?Ic.Profile:w===m.vi.SharedMedia?Ic.SharedMedia:w===m.vi.MemberList?Ic.MemberList:-1:c?Ic.Search:p?Ic.PollResults:h?Ic.StickerSearch:g?Ic.GifSearch:v?Ic.AddingMembers:d?b===m.u1.Initial?Ic.ManageInitial:b===m.u1.ChatPrivacyType?Ic.ManageChatPrivacyType:b===m.u1.Discussion?Ic.ManageDiscussion:b===m.u1.ChannelSubscribers?Ic.ManageChannelSubscribers:b===m.u1.GroupPermissions?Ic.ManageGroupPermissions:b===m.u1.ChatAdministrators?Ic.ManageChatAdministrators:b===m.u1.GroupRemovedUsers?Ic.ManageGroupRemovedUsers:b===m.u1.ChannelRemovedUsers?Ic.ManageChannelRemovedUsers:b===m.u1.GroupUserPermissionsCreate?Ic.ManageGroupUserPermissionsCreate:b===m.u1.GroupUserPermissions?Ic.ManageGroupUserPermissions:b===m.u1.GroupRecentActions?Ic.ManageGroupRecentActions:b===m.u1.ChatAdminRights?Ic.ManageGroupAdminRights:b===m.u1.ChatNewAdminRights?Ic.ManageGroupNewAdminRights:b===m.u1.GroupMembers?Ic.ManageGroupMembers:b===m.u1.Invites?Ic.ManageInvites:b===m.u1.EditInvite?Ic.ManageEditInvite:b===m.u1.GroupAddAdmins?Ic.ManageGroupAddAdmins:b===m.u1.Reactions?Ic.ManageReactions:b===m.u1.InviteInfo?Ic.ManageInviteInfo:b===m.u1.JoinRequests?Ic.ManageJoinRequests:void 0:l?Ic.Statistics:u?Ic.MessageStatistics:f?Ic.CreateTopic:I?Ic.EditTopic:void 0,he=null!==(t=(0,Jn.Z)(me,!0))&&void 0!==t?t:-1,ge=X||me===Ic.SharedMedia||me===Ic.MemberList||me===Ic.AddingMembers||me===Ic.MessageStatistics||d,pe=(0,ht.Z)("animated-close-icon",ge&&"state-back",(ce||x)&&"no-transition"),fe=(0,i.sO)(null);return(0,Yt.Z)(fe),i.ZP.createElement("div",{className:"RightHeader",ref:fe},i.ZP.createElement(Xt.Z,{className:"close-button",round:!0,color:"translucent",size:"smaller",onClick:E,ariaLabel:ue(ge?"Common.Back":"Common.Close")},i.ZP.createElement("div",{className:pe})),i.ZP.createElement(Dt.Z,{name:ce||x?"none":"slideFade",activeKey:he},function(){if(-1!==he)switch(he){case Ic.PollResults:return i.ZP.createElement("h3",null,ue("PollResults"));case Ic.Search:return i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement(Qt.Z,{parentContainerClassName:"RightSearch",value:M,onChange:te}),i.ZP.createElement(Xt.Z,{round:!0,size:"smaller",color:"translucent",onClick:()=>$({selectedAt:(0,de._F)(Date.now())}),ariaLabel:"Search messages by date"},i.ZP.createElement("i",{className:"icon icon-calendar"})));case Ic.AddingMembers:return i.ZP.createElement("h3",null,ue(C?"ChannelAddSubscribers":"GroupAddMembers"));case Ic.ManageInitial:return i.ZP.createElement("h3",null,ue("Edit"));case Ic.ManageChatPrivacyType:return i.ZP.createElement("h3",null,ue(C?"ChannelTypeHeader":"GroupTypeHeader"));case Ic.ManageDiscussion:return i.ZP.createElement("h3",null,ue("Discussion"));case Ic.ManageChatAdministrators:return i.ZP.createElement("h3",null,ue("ChannelAdministrators"));case Ic.ManageGroupRecentActions:return i.ZP.createElement("h3",null,ue("Group.Info.AdminLog"));case Ic.ManageGroupAdminRights:return i.ZP.createElement("h3",null,ue("EditAdminRights"));case Ic.ManageGroupNewAdminRights:return i.ZP.createElement("h3",null,ue("SetAsAdmin"));case Ic.ManageGroupPermissions:return i.ZP.createElement("h3",null,ue("ChannelPermissions"));case Ic.ManageGroupRemovedUsers:return i.ZP.createElement("h3",null,ue("BlockedUsers"));case Ic.ManageChannelRemovedUsers:return i.ZP.createElement("h3",null,ue("ChannelBlockedUsers"));case Ic.ManageGroupUserPermissionsCreate:return i.ZP.createElement("h3",null,ue("ChannelAddException"));case Ic.ManageGroupUserPermissions:return i.ZP.createElement("h3",null,ue("UserRestrictions"));case Ic.ManageInvites:return i.ZP.createElement("h3",null,ue("lng_group_invite_title"));case Ic.ManageEditInvite:return i.ZP.createElement("h3",null,ue(T?"EditLink":"NewLink"));case Ic.ManageInviteInfo:return i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement("h3",null,ue("InviteLink")),i.ZP.createElement("section",{className:"tools"},N&&!N.isRevoked&&i.ZP.createElement(Xt.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:ue("Edit"),onClick:Q},i.ZP.createElement("i",{className:"icon icon-edit"})),N&&N.isRevoked&&i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement(Xt.Z,{round:!0,color:"danger",size:"smaller",ariaLabel:ue("Delete"),onClick:J},i.ZP.createElement("i",{className:"icon icon-delete"})),i.ZP.createElement(oa.Z,{isOpen:Y,onClose:K,title:ue("DeleteLink"),text:ue("DeleteLinkHelp"),confirmIsDestructive:!0,confirmLabel:ue("Delete"),confirmHandler:ee}))));case Ic.ManageJoinRequests:return i.ZP.createElement("h3",null,ue(C?"SubscribeRequests":"MemberRequests"));case Ic.ManageGroupAddAdmins:return i.ZP.createElement("h3",null,ue("Channel.Management.AddModerator"));case Ic.StickerSearch:return i.ZP.createElement(Qt.Z,{value:R,placeholder:ue("SearchStickersHint"),autoFocusSearch:!0,onChange:ne});case Ic.GifSearch:return i.ZP.createElement(Qt.Z,{value:k,placeholder:ue("SearchGifsTitle"),autoFocusSearch:!0,onChange:ae});case Ic.Statistics:return i.ZP.createElement("h3",null,ue(C?"ChannelStats.Title":"GroupStats.Title"));case Ic.MessageStatistics:return i.ZP.createElement("h3",null,ue("Stats.MessageTitle"));case Ic.SharedMedia:return i.ZP.createElement("h3",null,ue("SharedMedia"));case Ic.ManageChannelSubscribers:return i.ZP.createElement("h3",null,ue("ChannelSubscribers"));case Ic.MemberList:case Ic.ManageGroupMembers:return i.ZP.createElement("h3",null,ue("GroupMembers"));case Ic.ManageReactions:return i.ZP.createElement("h3",null,ue("Reactions"));case Ic.CreateTopic:return i.ZP.createElement("h3",null,ue("NewTopic"));case Ic.EditTopic:return i.ZP.createElement("h3",null,ue("EditTopic"));default:return i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement("h3",null,ue(U?"AccDescrTopic":C?"Channel.TitleInfo":P?L?"lng_info_bot_title":"lng_info_user_title":"GroupInfo.Title")),i.ZP.createElement("section",{className:"tools"},Z&&i.ZP.createElement(Xt.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:ue("AddContact"),onClick:se},i.ZP.createElement("i",{className:"icon icon-add-user"})),y&&!U&&i.ZP.createElement(Xt.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:ue("Edit"),onClick:ie},i.ZP.createElement("i",{className:"icon icon-edit"})),j&&i.ZP.createElement(Xt.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:ue("EditTopic"),onClick:oe},i.ZP.createElement("i",{className:"icon icon-edit"})),A&&i.ZP.createElement(Xt.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:ue("Statistics"),onClick:re},i.ZP.createElement("i",{className:"icon icon-stats"}))))}}()))}));var wc=n(91);var bc=n(27407);function Zc(e,t){const[n,a]=(0,bc.Z)(e,t,void 0,o.Vk);return[n,a,!(!n||!t||n[0]===t[0])]}function Pc(e,t,n,a,s,r){const c=(0,i.sO)();(0,bt.Z)((()=>{c.current=void 0}),[r]),(0,bt.Z)((()=>{t===e&&a&&s&&(c.current=(0,v.R5)(a,s,e))}),[a,s,t,e]);const[d,l]=(0,bc.Z)(n,c.current,void 0,"media"===e?o.ENB:o.pnA);return[d,l,!(!d||!c.current||d[0]===c.current[0])]}const yc=(0,I.P2)((e=>e()),250,!1);let Cc=!1;var Ec=n(21273),Sc=n(31876),Mc=n(16568),Rc=n(70180),kc=n(13709),Tc=n(45418),Ac=n(47262),Nc=n(41151),xc=n(22275);const Bc=[{type:"media",title:"SharedMediaTab2"},{type:"documents",title:"SharedFilesTab2"},{type:"links",title:"SharedLinksTab2"},{type:"audio",title:"SharedMusicTab2"}],Lc=(0,i.X$)((0,a.c$)(((e,t)=>{let{chatId:n,topicId:a,isMobile:s}=t;const o=(0,f.Z1)(e,n),i=(0,f.x6)(e,n),r=(0,f.Zw)(e,n),{currentType:c,resultsByType:d}=(0,f.we)(e)||{},{foundIds:l}=d&&c&&d[c]||{},{byId:u,statusesById:m}=e.users,{byId:h}=e.chats,g=o&&(0,v.Bf)(o),p=o&&(0,v.eA)(o),I=!a&&(g||p&&(0,v.Nl)(o)),w=i?.members,b=i?.adminMembersById,Z=I&&o&&(o.isForbidden||i&&!i.canViewMembers),P=I&&o&&((0,v.VE)(o,"inviteUsers")||!(0,v.Mg)(o,"inviteUsers")||o.isCreator),y=I&&o&&((0,v.VE)(o,"banUsers")||o.isCreator),C=(0,f.f2)(e,n);let E,S,M;return(0,v.YC)(n)&&(S=n,M=(0,f.dy)(e,S),E=M&&!M.isSelf&&!(0,v.cS)(M)),{theme:(0,f.Pu)(e),isChannel:p,resolvedUserId:S,messagesById:r,foundIds:l,mediaSearchType:c,hasCommonChatsTab:E,hasMembersTab:I,areMembersHidden:Z,canAddMembers:P,canDeleteMembers:y,currentUserId:e.currentUserId,isRightColumnShown:(0,f.Jf)(e,s),isRestricted:o?.isRestricted,activeDownloadIds:C?.ids,usersById:u,userStatusesById:m,chatsById:h,isChatProtected:o?.isProtected,...I&&w&&{members:w,adminMembersById:b},...E&&M&&{commonChatIds:M.commonChats?.ids}}}))((e=>{let{chatId:t,topicId:n,profileState:r,onProfileStateChange:d,theme:l,isChannel:h,resolvedUserId:g,currentUserId:p,messagesById:f,foundIds:I,mediaSearchType:w,hasCommonChatsTab:b,hasMembersTab:Z,areMembersHidden:P,canAddMembers:y,canDeleteMembers:C,commonChatIds:E,members:S,adminMembersById:M,usersById:R,userStatusesById:k,chatsById:T,isRightColumnShown:A,isRestricted:N,activeDownloadIds:x,isChatProtected:B}=e;const{setLocalMediaSearchType:L,loadMoreMembers:U,loadCommonChats:j,openChat:O,searchMediaMessagesLocal:F,openMediaViewer:_,openAudioPlayer:D,focusMessage:q,loadProfilePhotos:$,setNewChatMembersDialogState:H}=(0,a.Sv)(),G=(0,i.sO)(null),V=(0,i.sO)(null),W=(0,qt.Z)(),[z,Y]=(0,i.eJ)(0),[J,K]=(0,i.eJ)(),X=(0,i.Ye)((()=>[...Z?[{type:"members",title:h?"ChannelSubscribers":"GroupMembers"}]:[],...Bc,...n?[]:[{type:"voice",title:"SharedVoiceTab2"}],...b?[{type:"commonChats",title:"SharedGroupsTab2"}]:[]]),[b,Z,h,n]),Q=z>X.length-1?X.length-1:z,ee=X[Q].type,[te,ne,ae,se]=function(e,t,n,a,s,o,r,c,d,l,u,m,h){const g="members"!==a&&s?s:a,p=(0,i.Ye)((()=>{if(o&&c&&d)return(0,v.Z0)(o.map((e=>{let{userId:t}=e;return t})),c,d)}),[o,c,d]),f=(0,i.Ye)((()=>{if(r&&l)return(0,v.ih)(r,l,!0)}),[l,r]),[I,w,b]=Zc(e,p),[Z,P,y]=Pc("media",g,n,u,m,h),[C,E,S]=Pc("documents",g,n,u,m,h),[M,R,k]=Pc("links",g,n,u,m,h),[T,A,N]=Pc("audio",g,n,u,m,h),[x,B,L]=Pc("voice",g,n,u,m,h),[U,j,O]=Zc(t,f);let F,_,D=!1;switch(g){case"members":F=I,_=w,D=b;break;case"commonChats":F=U,_=j,D=O;break;case"media":F=Z,_=P,D=y;break;case"documents":F=C,_=E,D=S;break;case"links":F=M,_=R,D=k;break;case"audio":F=T,_=A,D=N;break;case"voice":F=x,_=B,D=L}return[g,F,_,D]}(U,j,F,ee,w,S,E,R,k,T,f,I,n),oe="members"===te||!Z&&"media"===te,ie=X.findIndex((e=>{let{type:t}=e;return t===te})),{handleScroll:re}=function(e,t,n,a){(0,on.Z)((n=>{let[s]=n;if(s&&s!==t){const n=e.current,s=n.querySelector(".TabList");n.scrollTop<s.offsetTop&&(a("members"===t?m.vi.MemberList:m.vi.SharedMedia),Cc=!0,(0,Da.ZP)(n,s,"start",void 0,void 0,void 0,300),setTimeout((()=>{Cc=!1}),350))}}),[t,a,e]),(0,on.Z)((t=>{let[s]=t;if(n!==m.vi.Profile||n===s)return;const o=e.current;if(!o)return;const i=o.querySelector(".TabList");!i||i.offsetTop>o.scrollTop||(Cc=!0,(0,Da.ZP)(o,o.firstElementChild,"start",void 0,2*o.offsetHeight),setTimeout((()=>{Cc=!1}),350),a(n))}),[n,e,a]);const s=(0,It.Z)((()=>{const n=e.current;if(!n)return;const s=n.querySelector(".TabList");if(!s)return;let o=m.vi.Profile;n.scrollTop>=s.offsetTop&&(o="members"===t?m.vi.MemberList:m.vi.SharedMedia),a(o)}));return(0,i.d4)((()=>{Cc||s()}),[s,t]),{handleScroll:(0,It.Z)((()=>{Cc||yc(s)}))}}(G,te,r,d),{applyTransitionFix:ce,releaseTransitionFix:de}=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:".Transition.shared-media-transition";(0,i.d4)((()=>{function n(){const n=e.current,a=n.querySelector(t),s=n.querySelector(".TabList");if(a&&s){const e=n.offsetHeight-s.offsetHeight;(0,c.WM)((()=>{a.style.minHeight=`${e}px`}))}}return n(),window.addEventListener("resize",n,!1),()=>{window.removeEventListener("resize",n,!1)}}),[e,t]);const n=(0,It.Z)((()=>{(0,c.i$)((()=>{const t=e.current;if("hidden"===t.style.overflowY)return;const n=t.offsetWidth-t.clientWidth;(0,c.WM)((()=>{t.style.overflowY="hidden",t.style.paddingRight=`${n}px`}))}))})),a=(0,It.Z)((()=>{const t=e.current;t.style.overflowY="scroll",t.style.paddingRight="0"}));return{applyTransitionFix:n,releaseTransitionFix:a}}(G),[le,ue]=(()=>{const[e,t]=(0,i.eJ)(0);return[e,(0,i.I4)((()=>{t((e=>e+1))}),[])]})(),{observe:me}=(0,Wa.S1)({rootRef:G,throttleMs:500}),he=(0,It.Z)((()=>{de(),ue()})),ge=(0,It.Z)((()=>{H({newChatMembersProgress:m.WB.InProgress})}));(0,i.d4)((()=>{L({mediaType:ee})}),[L,ee,n]);const pe=g||t;(0,i.d4)((()=>{$({profileId:pe})}),[pe]);const fe=(0,It.Z)((e=>{_({chatId:pe,threadId:u._f,mediaId:e,origin:m.bZ.SharedMedia})})),Ie=(0,It.Z)((e=>{D({chatId:pe,messageId:e})})),ve=(0,It.Z)((e=>{O({id:e})})),we=(0,It.Z)((e=>{q({chatId:pe,messageId:e})})),be=(0,It.Z)((()=>{K(void 0)}));let Ze;(0,on.Z)((e=>{let[t]=e;if(0===z||t===Z)return;const n=z+(Z?1:-1);Y(Math.min(n,X.length-1))}),[Z,z,X]),(0,i.d4)((()=>{if(V.current&&s.$b)return(0,vn.sf)(V.current,{selectorToPreventScroll:".Profile",onSwipe:(e,t)=>t===vn.eM.Left?(Y(Math.min(Q+1,X.length-1)),!0):t===vn.eM.Right&&(Y(Math.max(0,Q-1)),!0)})}),[Q,X.length]),oe?Ze=A?0:1e3:ne||(Ze=o.Yan);const Pe=(0,aa.Z)([t,n,te,Q],Ze);return i.ZP.createElement(Ec.Z,{ref:G,className:"Profile custom-scroll",itemSelector:`.shared-media-transition > .Transition_slide-active.${te}-list > .scroll-item`,items:Pe?ne:void 0,cacheBuster:le,sensitiveArea:o.qUX,preloadBackwards:Pe?"members"===te?o.Vk:o.ENB:0,noScrollRestoreOnTop:!0,noFastList:!0,onLoadMore:ae,onScroll:re},!se&&function(e,t,n){return i.ZP.createElement("div",{className:"profile-info"},i.ZP.createElement(Mc.Z,{userId:t||e,canPlayVideo:n}),i.ZP.createElement(Rc.Z,{chatOrUserId:t||e}))}(t,g,A&&Pe),!N&&i.ZP.createElement("div",{className:"shared-media"},i.ZP.createElement(Dt.Z,{ref:V,name:W.isRtl?"slideOptimizedRtl":"slideOptimized",activeKey:ie,renderCount:X.length,shouldRestoreHeight:!0,className:"shared-media-transition",onStart:ce,onStop:he},function(){if(!ne||!Pe||!f){const e=oe&&!Pe,t=Boolean("members"===te&&P);return i.ZP.createElement("div",{className:"content empty-list"},!e&&!t&&i.ZP.createElement(an.Z,null),t&&i.ZP.createElement(Ac.Z,{text:"You have no access to group members list."}))}if(!ne.length){let e;switch(te){case"members":e=P?"You have no access to group members list.":"No members found";break;case"commonChats":e=W("NoGroupsInCommon");break;case"documents":e=W("lng_media_file_empty");break;case"links":e=W("lng_media_link_empty");break;case"audio":e=W("lng_media_song_empty");break;case"voice":e=W("lng_media_audio_empty");break;default:e=W("SharedMedia.EmptyTitle")}return i.ZP.createElement("div",{className:"content empty-list"},i.ZP.createElement(Ac.Z,{text:e}))}return i.ZP.createElement("div",{className:`content ${te}-list`,dir:W.isRtl&&"media"===te?"rtl":void 0,teactFastList:!0},"media"===te?ne.map((e=>f[e]&&i.ZP.createElement(kc.Z,{key:e,message:f[e],isProtected:B||f[e].isProtected,observeIntersection:me,onClick:fe}))):"documents"===te?ne.map((e=>f[e]&&i.ZP.createElement(Os.Z,{key:e,message:f[e],withDate:!0,smaller:!0,className:"scroll-item",isDownloading:x?.includes(e),observeIntersection:me,onDateClick:we}))):"links"===te?ne.map((e=>f[e]&&i.ZP.createElement(Tc.Z,{key:e,message:f[e],isProtected:B||f[e].isProtected,observeIntersection:me,onMessageClick:we}))):"audio"===te?ne.map((e=>f[e]&&i.ZP.createElement(Fs.ZP,{key:e,theme:l,message:f[e],origin:m.Cr.SharedMedia,date:f[e].date,className:"scroll-item",onPlay:Ie,onDateClick:we,canDownload:!B&&!f[e].isProtected,isDownloading:x?.includes(e)}))):"voice"===te?ne.map((e=>f[e]&&i.ZP.createElement(Fs.ZP,{key:e,theme:l,message:f[e],senderTitle:(0,wc.F)(W,f[e],T,R),origin:m.Cr.SharedMedia,date:f[e].date,className:"scroll-item",onPlay:Ie,onDateClick:we,canDownload:!B&&!f[e].isProtected,isDownloading:x?.includes(e)}))):"members"===te?ne.map(((e,t)=>{return i.ZP.createElement(Sc.Z,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item small-icon",onClick:()=>ve(e),contextActions:(n=e,n!==p&&C?[{title:W("lng_context_remove_from_group"),icon:"stop",handler:()=>{K(n)}}]:void 0)},i.ZP.createElement(Xn.Z,{userId:e,adminMember:M?.[e],forceShowSelf:!0}));var n})):"commonChats"===te?ne.map(((e,t)=>i.ZP.createElement(Sc.Z,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item small-icon",onClick:()=>O({id:e})},i.ZP.createElement(Qn.Z,{chatId:e})))):void 0)}()),i.ZP.createElement(bn.Z,{big:!0,activeTab:Q,tabs:X,onSwitchTab:Y})),y&&i.ZP.createElement(Nc.Z,{isShown:"members"===te,onClick:ge,ariaLabel:W("lng_channel_add_users")},i.ZP.createElement("i",{className:"icon icon-add-user-filled"})),C&&i.ZP.createElement(xc.Z,{isOpen:Boolean(J),userId:J,onClose:be}))}))),Uc=e=>{const t=(0,Nt.Z)(ft.gl.Extra,"RightSearch");return t?i.ZP.createElement(t,e):i.ZP.createElement(yn.Z,null)},jc=e=>{const t=(0,Nt.Z)(ft.gl.Extra,"Management");return t?i.ZP.createElement(t,e):i.ZP.createElement(yn.Z,null)},Oc=e=>{const t=(0,Nt.Z)(ft.gl.Extra,"Statistics");return t?i.ZP.createElement(t,e):i.ZP.createElement(yn.Z,null)},Fc=e=>{const t=(0,Nt.Z)(ft.gl.Extra,"MessageStatistics");return t?i.ZP.createElement(t,e):i.ZP.createElement(yn.Z,null)},_c=()=>{const e=(0,Nt.Z)(ft.gl.Extra,"StickerSearch");return e?i.ZP.createElement(e,null):i.ZP.createElement(yn.Z,null)},Dc=()=>{const e=(0,Nt.Z)(ft.gl.Extra,"GifSearch");return e?i.ZP.createElement(e,null):i.ZP.createElement(yn.Z,null)},qc=()=>{const e=(0,Nt.Z)(ft.gl.Extra,"PollResults");return e?i.ZP.createElement(e,null):i.ZP.createElement(yn.Z,null)};var $c=n(11820);const Hc=(0,i.X$)((0,a.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,f.Z1)(e,n),{userIds:s}=e.contactList||{},{byId:o}=e.chats,{newChatMembersProgress:i}=(0,f.jU)(e),{currentUserId:r}=e,c=a&&(0,v.eA)(a),{query:d,fetchingStatus:l,globalUserIds:u,localUserIds:h}=(0,f.jU)(e).userSearch;return{isChannel:c,members:(0,f.x6)(e,n)?.members,currentUserId:r,chatsById:o,localContactIds:s,searchQuery:d,isSearching:l,isLoading:i===m.WB.Loading,globalUserIds:u,localUserIds:h}}))((e=>{let{isChannel:t,members:n,onNextStep:s,currentUserId:o,chatsById:r,localContactIds:c,isLoading:d,searchQuery:l,isSearching:u,localUserIds:m,globalUserIds:h,onClose:p,isActive:f}=e;const{setUserSearchQuery:I}=(0,a.Sv)(),w=(0,qt.Z)(),[b,Z]=(0,i.eJ)([]),P=(0,Hn.Z)(b)===b;(0,wn.Z)({isActive:f,onBack:p});const y=(0,i.Ye)((()=>n?n.map((e=>e.userId)):[]),[n]),C=(0,i.I4)((e=>{I({query:e})}),[I]),E=(0,i.Ye)((()=>{const e=(0,a.Rd)().users.byId,n=c?(0,v.kK)(c,e,l):[];return(0,v.ih)((0,g.Tw)([...n,...m||[],...h||[]]).filter((n=>{const a=e[n];return!y.includes(n)&&n!==o&&(!a||!(0,v.cS)(a)||!t&&a.canBeInvitedToGroup)})),r)}),[c,r,l,m,h,o,y,t]),S=(0,i.I4)((()=>{b.length&&(I({query:""}),s(b))}),[b,I,s]);return i.ZP.createElement("div",{className:"AddChatMembers"},i.ZP.createElement("div",{className:"AddChatMembers-inner"},i.ZP.createElement($c.Z,{itemIds:E,selectedIds:b,filterValue:l,filterPlaceholder:w("lng_channel_add_users"),searchInputId:"new-members-picker-search",isLoading:u,onSelectedIdsChange:Z,onFilterChange:C,isSearchable:!0,noScrollRestore:P}),i.ZP.createElement(Nc.Z,{isShown:Boolean(b.length),disabled:d,ariaLabel:w("lng_channel_add_users"),onClick:S},d?i.ZP.createElement(an.Z,{color:"white"}):i.ZP.createElement("i",{className:"icon icon-arrow-right"}))))}))),Gc=e=>{const t=(0,Nt.Z)(ft.gl.Extra,"CreateTopic");return t?i.ZP.createElement(t,e):i.ZP.createElement(yn.Z,null)},Vc=e=>{const t=(0,Nt.Z)(ft.gl.Extra,"EditTopic");return t?i.ZP.createElement(t,e):i.ZP.createElement(yn.Z,null)},Wc=450+o.fK3,zc=Object.keys(m.qt).length/2,Yc=Object.keys(m.u1).length/2;function Jc(){const e=document.querySelector(".RightHeader .SearchInput input");e&&e.blur()}const Kc=(0,i.X$)((0,a.c$)(((e,t)=>{let{isMobile:n}=t;const{chatId:a,threadId:s}=(0,f.Bt)(e)||{},o=(0,f.g4)(e),{management:i,shouldSkipHistoryAnimations:r}=(0,f.jU)(e),c=a?i.byChatId[a]?.nextScreen:void 0,d=(a?(0,f.Z1)(e,a)?.isForum:void 0)&&Boolean(s&&s!==u._f);return{contentKey:(0,f.Wq)(e,n),chatId:a,threadId:s,isInsideTopic:d,isChatSelected:Boolean(a&&o),shouldSkipHistoryAnimations:r,nextManagementScreen:c}}))((e=>{var t;let{contentKey:n,chatId:s,threadId:r,isMobile:c,isInsideTopic:d,isChatSelected:l,shouldSkipHistoryAnimations:u,nextManagementScreen:h}=e;const{toggleChatInfo:g,toggleManagement:p,closeLocalTextSearch:f,setStickerSearchQuery:I,setGifSearchQuery:v,closePollResults:w,addChatMembers:b,setNewChatMembersDialogState:Z,setEditingExportedInvite:P,toggleStatistics:y,toggleMessageStatistics:C,setOpenedInviteInfo:E,requestNextManagementScreen:S,closeCreateTopicPanel:M,closeEditTopicPanel:R}=(0,a.Sv)(),{width:k}=(0,qn.Z)(),[T,A]=(0,i.eJ)(m.vi.Profile),[N,x]=(0,i.eJ)(m.u1.Initial),[B,L]=(0,i.eJ)(),[U,j]=(0,i.eJ)(),O=T!==m.vi.Profile,F=void 0!==n,_=n===m.qt.ChatInfo,D=n===m.qt.Search,q=n===m.qt.Management,$=n===m.qt.Statistics,H=n===m.qt.MessageStatistics,G=n===m.qt.StickerSearch,V=n===m.qt.GifSearch,W=n===m.qt.PollResults,z=n===m.qt.AddingMembers,Y=n===m.qt.CreateTopic,J=n===m.qt.EditTopic,K=k<=o._mX,[X,Q]=(0,i.eJ)(!F),ee=null!==(t=(0,Jn.Z)(n,!0,!l))&&void 0!==t?t:-1,te=(0,It.Z)((function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];switch(n){case m.qt.AddingMembers:Z({newChatMembersProgress:m.WB.Closed});break;case m.qt.ChatInfo:if(O&&e){A(m.vi.Profile);break}g({force:!1},{forceSyncOnIOs:!0});break;case m.qt.Management:switch(N){case m.u1.Initial:p();break;case m.u1.ChatPrivacyType:case m.u1.Discussion:case m.u1.GroupPermissions:case m.u1.GroupType:case m.u1.ChatAdministrators:case m.u1.ChannelSubscribers:case m.u1.GroupMembers:case m.u1.Invites:case m.u1.Reactions:case m.u1.JoinRequests:case m.u1.ChannelRemovedUsers:x(m.u1.Initial);break;case m.u1.GroupUserPermissionsCreate:case m.u1.GroupRemovedUsers:case m.u1.GroupUserPermissions:x(m.u1.GroupPermissions),L(void 0),j(void 0);break;case m.u1.ChatAdminRights:case m.u1.ChatNewAdminRights:case m.u1.GroupAddAdmins:case m.u1.GroupRecentActions:x(m.u1.ChatAdministrators);break;case m.u1.EditInvite:case m.u1.InviteInfo:x(m.u1.Invites),E({chatId:s,invite:void 0}),P({chatId:s,invite:void 0})}break;case m.qt.MessageStatistics:C();break;case m.qt.Statistics:y();break;case m.qt.Search:Jc(),f();break;case m.qt.StickerSearch:Jc(),I({query:void 0});break;case m.qt.GifSearch:Jc(),v({query:void 0});break;case m.qt.PollResults:w();break;case m.qt.CreateTopic:M();break;case m.qt.EditTopic:R()}})),ne=(0,It.Z)(((e,t)=>{L(e),j(t)})),ae=(0,It.Z)((e=>{b({chatId:s,memberIds:e})}));function se(e){if(-1!==ee)switch(ee){case m.qt.AddingMembers:return i.ZP.createElement(Hc,{key:`add_chat_members_${s}`,chatId:s,isActive:F&&e,onNextStep:ae,onClose:te});case m.qt.ChatInfo:return i.ZP.createElement(Lc,{key:`profile_${s}`,chatId:s,topicId:d?r:void 0,profileState:T,isMobile:c,onProfileStateChange:A});case m.qt.Search:return i.ZP.createElement(Uc,{key:`right_search_${s}`,chatId:s,threadId:r,onClose:te,isActive:F&&e});case m.qt.Management:return i.ZP.createElement(jc,{key:`management_${s}_${N}`,chatId:s,currentScreen:N,isPromotedByCurrentUser:U,selectedChatMemberId:B,isActive:F&&e,onScreenSelect:x,onChatMemberSelect:ne,onClose:te});case m.qt.Statistics:return i.ZP.createElement(Oc,{chatId:s});case m.qt.MessageStatistics:return i.ZP.createElement(Fc,{chatId:s,isActive:F&&e});case m.qt.StickerSearch:return i.ZP.createElement(_c,{onClose:te,isActive:F&&e});case m.qt.GifSearch:return i.ZP.createElement(Dc,{onClose:te,isActive:F&&e});case m.qt.PollResults:return i.ZP.createElement(qc,{onClose:te,isActive:F&&e});case m.qt.CreateTopic:return i.ZP.createElement(Gc,{onClose:te,isActive:F&&e});case m.qt.EditTopic:return i.ZP.createElement(Vc,{onClose:te,isActive:F&&e})}}return(0,i.d4)((()=>F?(0,Ot.Z)(te):void 0),[F,te]),(0,i.d4)((()=>{setTimeout((()=>{Q(!F)}),Wc)}),[F]),(0,i.d4)((()=>{h&&(x(h),S(void 0))}),[h,S]),(0,i.d4)((()=>{F&&K&&te()}),[K]),(0,Ga.Z)((e=>{let[t]=e;t!==s&&(A(m.vi.Profile),x(m.u1.Initial))}),[s]),(0,wn.Z)({isActive:l&&(n===m.qt.ChatInfo||n===m.qt.Management||n===m.qt.AddingMembers||n===m.qt.CreateTopic||n===m.qt.EditTopic),onBack:()=>te(!1)}),i.ZP.createElement("div",{id:"RightColumn-wrapper",className:l?void 0:"is-hidden"},K&&i.ZP.createElement("div",{className:"overlay-backdrop",onClick:te}),i.ZP.createElement("div",{id:"RightColumn"},i.ZP.createElement(vc,{chatId:s,threadId:r,isColumnOpen:F,isProfile:_,isSearch:D,isManagement:q,isStatistics:$,isMessageStatistics:H,isStickerSearch:G,isGifSearch:V,isPollResults:W,isCreatingTopic:Y,isEditingTopic:J,isAddingChatMembers:z,profileState:T,managementScreen:N,onClose:te,onScreenSelect:x}),i.ZP.createElement(Dt.Z,{name:X||u?"none":"zoomFade",renderCount:zc+Yc,activeKey:q?zc+N:ee,shouldCleanup:!0,cleanupExceptionKey:ee===m.qt.MessageStatistics?m.qt.Statistics:void 0},se)))}))),Xc=e=>{let{isOpen:t}=e;const n=(0,Nt.Z)(ft.gl.Extra,"MediaViewer",!t);return n?i.ZP.createElement(n,null):void 0};var Qc=n(6562);const ed=new Set,td=new Set,nd=(0,i.X$)((0,a.c$)((e=>({activeDownloads:(0,f.jU)(e).activeDownloads.byChatId})))((e=>{let{activeDownloads:t}=e;const{cancelMessagesMediaDownload:n,showNotification:o}=(0,a.Sv)(),r=(0,$a.Z)(1e3,!0),c=(0,It.Z)((e=>{td.add(e),r((()=>{td.size&&(n({messages:Array.from(td)}),td.clear())}))}));(0,i.d4)((()=>{const e=(0,a.Rd)().messages.byChatId,n=(0,a.Rd)().scheduledMessages.byChatId,i=Object.entries(t).map((t=>{let[a,s]=t;const o=s.ids?.map((t=>e[a]?.byId[t])),i=s.scheduledIds?.map((e=>n[a]?.byId[e]));return(0,g.oA)([...o||[],...i||[]])})).flat();i.length?i.forEach((e=>{if(ed.has(e))return;ed.add(e);const t=(0,v.Ti)(e,"download");if(!t)return void c(e);const n=Le.UV(t);if(n)return(0,Qc.Z)(n,(0,v.w6)(e)),void c(e);const{document:a,video:i,audio:r}=e.content;if(((a||i||r)?.size||0)>s.l0&&!s.rT&&!s.Mc)return o({message:"Downloading files bigger than 2GB is not supported in your browser."}),void c(e);const d=(0,v.kG)(e,"download");Le.he(t,d,!0).then((t=>{if(d===u.IU.DownloadUrl){const n=new URL(t,window.document.baseURI),a=(0,v.w6)(e);n.searchParams.set("filename",encodeURIComponent(a)),window.open(n.toString())?.addEventListener("beforeunload",(()=>{o({message:"Download started. Please, do not close the app before it is finished."})}))}else t&&(0,Qc.Z)(t,(0,v.w6)(e));c(e)}))})):ed.clear()}),[t,n,c,o])})));var ad=n(34563);const sd=(0,i.X$)((0,a.c$)(((e,t)=>{let{openedGame:n}=t;const{chatId:a}=n||{},s=a&&(0,f.Z1)(e,a);return{canPost:Boolean(s)&&(0,v.Qm)(s,u._f)}}))((e=>{let{openedGame:t,gameTitle:n,canPost:a}=e;const{closeGame:s,openForwardMenu:o}=(0,he.Sv)(),r=(0,qt.Z)(),{url:c,chatId:d,messageId:l}=t||{},u=Boolean(c),m=(0,Di.Z)(d);(0,Rt.Z)((()=>{m({type:"playingGame"})}),u&&a?5e3:void 0);const h=(0,i.I4)((e=>{try{const t=JSON.parse(e.data);"share_score"===t.eventType&&(o({fromChatId:d,messageIds:[l],withMyScore:!0}),s()),"share_game"===t.eventType&&(o({fromChatId:d,messageIds:[l]}),s())}catch(e){}}),[d,s,l,o]),g=(0,i.I4)((e=>{e.currentTarget.focus()}),[]);return(0,i.d4)((()=>(window.addEventListener("message",h),()=>window.removeEventListener("message",h))),[h]),i.ZP.createElement(ad.Z,{className:"GameModal",isOpen:u,onClose:s,title:n,hasCloseButton:!0},u&&i.ZP.createElement("iframe",{className:"game-frame",onLoad:g,src:c,title:r("AttachGame"),sandbox:"allow-scripts allow-same-origin allow-orientation-lock",allow:"fullscreen"}))}))),od=e=>{let{isOpen:t}=e;const n=(0,Nt.Z)(ft.gl.Extra,"Notifications",!t);return n?i.ZP.createElement(n,null):void 0},id=e=>{let{isOpen:t}=e;const n=(0,Nt.Z)(ft.gl.Extra,"Dialogs",!t);return n?i.ZP.createElement(n,null):void 0},rd=e=>{const{isOpen:t}=e,n=(0,Nt.Z)(ft.gl.Extra,"ForwardRecipientPicker",!t);return n?i.ZP.createElement(n,e):void 0},cd=e=>{const{url:t}=e,n=(0,Nt.Z)(ft.gl.Extra,"SafeLinkModal",!t);return n?i.ZP.createElement(n,e):void 0},dd=e=>{const{isOpen:t}=e,n=(0,Nt.Z)(ft.gl.Extra,"HistoryCalendar",!t);return n?i.ZP.createElement(n,e):void 0},ld=e=>{const{groupCallId:t}=e,n=(0,Nt.Z)(ft.gl.Calls,"GroupCall",!t);return n?i.ZP.createElement(n,e):void 0},ud=e=>{const{isActive:t}=e,n=(0,Nt.Z)(ft.gl.Calls,"ActiveCallHeader",!t);return n?i.ZP.createElement(n,null):void 0},md=e=>{const{isActive:t}=e,n=(0,Nt.Z)(ft.gl.Calls,"PhoneCall",!t);return n?i.ZP.createElement(n,null):void 0};function hd(){return hd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},hd.apply(this,arguments)}const gd=(0,i.X$)((0,a.c$)((e=>({messageLists:(0,f.jU)(e).messageLists})))((e=>{let{messageLists:t}=e;const{openChat:n}=(0,a.Sv)(),s=()=>{n({id:void 0},{forceSyncOnIOs:!0})},o=e=>{let{chatId:t,type:n,threadId:a}=e;(0,wn.Z)({isActive:!0,hash:(0,Fe.tB)(t,n,a),onBack:s})};return i.ZP.createElement("div",null,t?.map(((e,t)=>i.ZP.createElement(o,hd({key:`${e.chatId}_${e.threadId}_${e.type}_${t}`},e)))))}))),pd=e=>{const{isOpen:t}=e,n=(0,Nt.Z)(ft.gl.Extra,"NewContactModal",!t);return n?i.ZP.createElement(n,e):void 0},fd=e=>{const{isOpen:t}=e,n=(0,Nt.Z)(ft.gl.Calls,"RatePhoneCallModal",!t);return n?i.ZP.createElement(n,e):void 0},Id=e=>{const{webApp:t}=e,n=(0,Nt.Z)(ft.gl.Extra,"WebAppModal",!t);return n?i.ZP.createElement(n,e):void 0},vd=e=>{const{bot:t}=e,n=(0,Nt.Z)(ft.gl.Extra,"BotTrustModal",!t);return n?i.ZP.createElement(n,e):void 0},wd=e=>{const{bot:t}=e,n=(0,Nt.Z)(ft.gl.Extra,"AttachBotInstallModal",!t);return n?i.ZP.createElement(n,e):void 0},bd={root:"vfd0Bo1X6k19aaxQ577t"},Zd=["#E8BC2C","#D0049E","#02CBFE","#5723FD","#FE8C27","#6CB859"],Pd=(0,i.X$)((0,a.c$)((e=>(0,g.ei)((0,f.jU)(e),["confetti"])))((e=>{let{confetti:t}=e;const n=(0,i.sO)(null),a=(0,i.sO)([]),s=(0,i.sO)(!1),o=(0,qn.Z)(),r=(0,Et.Z)(),{isMobile:d}=(0,B.ZP)(),l=d?50:100,{lastConfettiTime:u,top:m,width:h,left:g,height:p}=t||{},f=(0,i.I4)((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:l;for(let s=0;s<n;s++){const n=s%2,o={x:e*(n?-.1:1.1),y:.75*t},i=Math.random()*e*1.5,r={x:n?i:-1*i,y:-t/2-Math.random()*t},c=Zd[Math.floor(Math.random()*Zd.length)],d=10;a.current.push({pos:o,size:d,color:c,velocity:r,flicker:d,flickerFrequency:.2*Math.random(),rotation:0,lastDrawnAt:Date.now(),frameCount:0})}}),[l]),I=(0,i.I4)((()=>{if(!n.current||!s.current)return;const e=n.current,t=e.getContext("2d");if(!t)return;const{width:o,height:i}=e;t.clearRect(0,0,o,i);const r=[];a.current.forEach(((e,n)=>{const{pos:s,velocity:o,size:c,color:d,flicker:l,flickerFrequency:u,rotation:m,lastDrawnAt:h,frameCount:g}=e,p=(Date.now()-h)/1e3,f={x:s.x+o.x*p,y:s.y+o.y*p},I={x:.98*o.x,y:o.y+=1e3*p},v=c*Math.abs(Math.sin(g*u)),w=5*g*u*(Math.PI/180),b=g+1,Z=Date.now();if(f.y>i+e.size)return void r.push(e);const P={...e,pos:f,velocity:I,flicker:v,rotation:w,lastDrawnAt:Z,frameCount:b};a.current[n]=P,t.fillStyle=d,t.beginPath(),t.ellipse(s.x,s.y,c,l,m,0,2*Math.PI),t.fill()})),a.current=a.current.filter((e=>!r.includes(e))),a.current.length?(0,c.i$)(I):s.current=!1}),[]);if((0,bt.Z)((e=>{let t,[n]=e;return n!==u&&(f(h||o.width,p||o.height),t=setTimeout(r,1e4),s.current||(s.current=!0,(0,c.i$)(I))),()=>{clearTimeout(t)}}),[u,r,I]),!u||Date.now()-u>1e4)return;const v=(0,Fn.Z)(Boolean(m)&&`top: ${m}px`,Boolean(g)&&`left: ${g}px`,Boolean(h)&&`width: ${h}px`,Boolean(p)&&`height: ${p}px`);return i.ZP.createElement("div",{id:"Confetti",className:bd.root,style:v},i.ZP.createElement("canvas",{ref:n,className:bd.canvas,width:o.width,height:o.height}))}))),yd=e=>{const{urlAuth:t}=e,n=(0,Nt.Z)(ft.gl.Extra,"UrlAuthModal",!t);return n?i.ZP.createElement(n,e):void 0},Cd=e=>{const{isOpen:t}=e,n=(0,Nt.Z)(ft.gl.Extra,"PremiumMainModal",!t);return n?i.ZP.createElement(n,e):void 0},Ed=e=>{const{isOpen:t}=e,n=(0,Nt.Z)(ft.gl.Extra,"PaymentModal",!t);return n?i.ZP.createElement(n,e):void 0},Sd=e=>{const{isOpen:t}=e,n=(0,Nt.Z)(ft.gl.Extra,"ReceiptModal",!t);return n?i.ZP.createElement(n,e):void 0},Md=e=>{const{limit:t}=e,n=(0,Nt.Z)(ft.gl.Extra,"PremiumLimitReachedModal",!t);return n?i.ZP.createElement(n,e):void 0},Rd=e=>{const{folder:t}=e,n=(0,Nt.Z)(ft.gl.Extra,"DeleteFolderDialog",!t);return n?i.ZP.createElement(n,e):void 0},kd=e=>{const{customEmojiSetIds:t}=e,n=(0,Nt.Z)(ft.gl.Extra,"CustomEmojiSetsModal",!t);return n?i.ZP.createElement(n,e):void 0},Td=e=>{const{requestedDraft:t}=e,n=(0,Nt.Z)(ft.gl.Extra,"DraftRecipientPicker",!t);return n?i.ZP.createElement(n,e):void 0},Ad=e=>{const{requestedAttachBotInChat:t}=e,n=(0,Nt.Z)(ft.gl.Extra,"AttachBotRecipientPicker",!t);return n?i.ZP.createElement(n,e):void 0},Nd=e=>{const{isOpen:t,shouldLoad:n}=e,a=(0,Nt.Z)(ft.gl.Extra,"ReactionPicker",!t&&!n);return a?i.ZP.createElement(a,e):void 0},xd=e=>{const{info:t}=e,n=(0,Nt.Z)(ft.gl.Extra,"ChatlistModal",!t);return n?i.ZP.createElement(n,e):void 0};let Bd=!1;const Ld=(0,i.X$)((0,a.c$)(((e,t)=>{let{isMobile:n}=t;const{settings:{byKey:{language:a,wasTimeFormatSetManually:s}}}=e,{botTrustRequest:o,requestedAttachBotInstall:i,requestedAttachBotInChat:r,requestedDraft:c,urlAuth:d,webApp:l,safeLinkModalUrl:u,openedStickerSetShortName:m,openedCustomEmojiSetIds:h,shouldSkipHistoryAnimations:g,openedGame:p,audioPlayer:I,isLeftColumnShown:w,historyCalendarSelectedAt:b,notifications:Z,dialogs:P,newContact:y,ratingPhoneCall:C,premiumModal:E,isMasterTab:S,payment:M,limitReachedModal:R,deleteFolderDialogModal:k,chatlistModal:T}=(0,f.jU)(e),{chatId:A,messageId:N}=I,x=A&&N?(0,f.hj)(e,A,N):void 0,B=(p&&(0,f.hj)(e,p.chatId,p.messageId))?.content.game?.title,L=e.currentUserId?(0,f.dy)(e,e.currentUserId):void 0,{chatId:U}=(0,f.Bt)(e)||{},j=!(0,f.$Y)(e,"rightColumnAnimations")||!(0,f.FO)(e),O=k?(0,f.Mw)(e,k):void 0;return{isLeftColumnOpen:w,isMiddleColumnOpen:Boolean(U),isRightColumnOpen:(0,f.Jf)(e,n),isMediaViewerOpen:(0,f.zQ)(e),isForwardModalOpen:(0,f.Ev)(e),isReactionPickerOpen:(0,f.Io)(e),hasNotifications:Boolean(Z.length),hasDialogs:Boolean(P.length),audioMessage:x,safeLinkModalUrl:u,isHistoryCalendarOpen:Boolean(b),shouldSkipHistoryAnimations:g,openedStickerSetShortName:m,openedCustomEmojiSetIds:h,isServiceChatReady:(0,f.UW)(e),activeGroupCallId:S?e.groupCalls.activeGroupCallId:void 0,withInterfaceAnimations:(0,f.FO)(e),language:a,wasTimeFormatSetManually:s,isPhoneCallActive:S?Boolean(e.phoneCall):void 0,addedSetIds:e.stickers.added.setIds,addedCustomEmojiIds:e.customEmojis.added.setIds,newContactUserId:y?.userId,newContactByPhoneNumber:y?.isByPhoneNumber,openedGame:p,gameTitle:B,isRatePhoneCallModalOpen:Boolean(C),botTrustRequest:o,botTrustRequestBot:o&&(0,f.dy)(e,o.botId),attachBotToInstall:i?.bot,requestedAttachBotInChat:r,webApp:l,currentUserName:(0,v.Js)(L),urlAuth:d,isCurrentUserPremium:(0,f.wV)(e),isPremiumModalOpen:E?.isOpen,limitReached:R?.limit,isPaymentModalOpen:M.isPaymentModalOpen,isReceiptModalOpen:Boolean(M.receipt),deleteFolderDialog:O,isMasterTab:S,requestedDraft:c,chatlistModal:T,noRightColumnAnimation:j,isSynced:e.isSynced}}))((e=>{let{isMobile:t,isLeftColumnOpen:n,isMiddleColumnOpen:l,isRightColumnOpen:u,isMediaViewerOpen:m,isForwardModalOpen:h,hasNotifications:g,hasDialogs:p,audioMessage:f,activeGroupCallId:I,safeLinkModalUrl:v,isHistoryCalendarOpen:w,shouldSkipHistoryAnimations:b,limitReached:Z,openedStickerSetShortName:P,openedCustomEmojiSetIds:y,isServiceChatReady:C,withInterfaceAnimations:E,language:S,wasTimeFormatSetManually:M,addedSetIds:R,addedCustomEmojiIds:k,isPhoneCallActive:T,newContactUserId:A,newContactByPhoneNumber:N,openedGame:x,gameTitle:L,isRatePhoneCallModalOpen:U,botTrustRequest:j,botTrustRequestBot:O,attachBotToInstall:F,requestedAttachBotInChat:_,requestedDraft:D,webApp:q,currentUserName:$,urlAuth:H,isPremiumModalOpen:G,isPaymentModalOpen:V,isReceiptModalOpen:W,isReactionPickerOpen:z,isCurrentUserPremium:Y,deleteFolderDialog:J,isMasterTab:K,chatlistModal:X,noRightColumnAnimation:Q,isSynced:ee}=e;const{initMain:te,loadAnimatedEmojis:ne,loadNotificationSettings:ae,loadNotificationExceptions:se,updateIsOnline:oe,onTabFocusChange:ie,loadTopInlineBots:re,loadEmojiKeywords:ce,loadCountryList:de,loadAvailableReactions:le,loadStickerSets:ue,loadPremiumGifts:me,loadDefaultTopicIcons:he,loadAddedStickers:ge,loadFavoriteStickers:pe,loadDefaultStatusIcons:fe,ensureTimeFormat:Ie,closeStickerSetModal:ve,closeCustomEmojiSets:we,checkVersionNotification:be,loadConfig:Ze,loadAppConfig:Pe,loadAttachBots:ye,loadContactList:Ce,loadCustomEmojis:Ee,loadGenericEmojiEffects:Se,closePaymentModal:Me,clearReceipt:Re,checkAppVersion:ke,openChat:Te,toggleLeftColumn:Ae,loadRecentEmojiStatuses:Ne,updatePageTitle:xe,loadTopReactions:Be,loadRecentReactions:Le,loadFeaturedEmojiStickers:Ue,setIsAppUpdateAvailable:je}=(0,a.Sv)();o.eMD&&!Bd&&(Bd=!0,console.log(">>> RENDER MAIN")),(0,Tt.Z)((()=>{(0,ft.Pb)(ft.gl.Calls)}),5e3);const[Oe,_e]=(0,At.Z)(!1);(0,Tt.Z)(_e,7e3);const De=(0,i.sO)(null),qe=(0,i.sO)(null),{isDesktop:$e}=(0,B.ZP)();(0,i.d4)((()=>{n||l||$e?n&&l&&t&&Ae():Ae()}),[$e,n,l,t,Ae]),(0,Rt.Z)(ke,K&&!o.D$V?3e5:void 0,!0),(0,i.d4)((()=>{if(!o.D$V)return;const e=window.electron.on(d.I.UPDATE_DOWNLOADED,(()=>{je(!0)})),t=window.electron.on(d.I.UPDATE_ERROR,(()=>{je(!1),e?.()}));return()=>{t?.(),e?.()}}),[]),(0,i.d4)((()=>{K&&ee&&(oe(!0),Ze(),Pe(),te(),le(),ne(),Se(),ae(),se(),re(),ce({language:o.pRL}),ye(),Ce(),me(),he(),ke(),Be(),Le(),Ue())}),[K,ee]),(0,i.d4)((()=>{K&&Y&&(fe(),Ne())}),[Y,K]),(0,i.d4)((()=>{K&&(S!==o.pRL&&ce({language:S}),de({langCode:S}))}),[S,K]),(0,i.d4)((()=>{K&&Ee({ids:Object.keys((0,a.Rd)().customEmojis.byId),ignoreCache:!0})}),[K]),(0,i.d4)((()=>{K&&ee&&(R&&k||(ue(),pe()),R&&k&&ge())}),[R,k,K,ee]),(0,i.d4)((()=>{C&&K&&be()}),[C,K]),(0,i.d4)((()=>{M||Ie()}),[M]),(0,i.d4)((()=>{const e=(0,Fe.dx)();e?.tgaddr&&(0,pt.ou)(decodeURIComponent(e.tgaddr))}),[]),(0,i.d4)((()=>{const e=(0,Fe.VX)();e&&Te({id:e.chatId,threadId:e.threadId,type:e.type})}),[]),(0,i.bt)((()=>{const e=De.current;1===e.parentNode.childElementCount&&(0,r.D_)(e,"Transition_slide-active")}),[]);const He=(0,St.Z)(n,void 0,!0,void 0,b,void 0,!0),Ge=(0,i.sO)(!1),Ve=(0,Et.Z)();(0,bt.Z)((e=>{let[t]=e;if(void 0===t||n===t||!E)return;Ge.current=!0,s.wZ&&(0,c.Yq)((()=>{document.body.classList.toggle("android-left-blackout-open",!n)}));const a=(0,Mt.YW)();(0,gt.L)(document.getElementById("MiddleColumn"),(()=>{a(),Ge.current=!1,Ve()}))}),[n,E,Ve]);const We=(0,St.Z)(u,void 0,!0,void 0,b,void 0,!0),ze=(0,i.sO)(!1),[Je,Ke]=(0,i.eJ)(u),Xe=(0,kt.Ar)();(0,bt.Z)((e=>{let[t,n]=e;if(void 0===n||u===n)return;if(!t||Q)return void Ke(u);ze.current=!0;const a=(0,Mt.YW)();(0,gt.L)(document.getElementById("RightColumn"),(()=>{a(),ze.current=!1,Ve(),Ke(u)}))}),[l,u,Q,Ve]);const Qe=(0,ht.Z)(He.hasShownClass&&"left-column-shown",He.hasOpenClass&&"left-column-open",Ge.current&&"left-column-animating",We.hasShownClass&&"right-column-shown",We.hasOpenClass&&"right-column-open",ze.current&&"right-column-animating",Je&&"narrow-message-list",b&&"history-animation-disabled",Xe&&"is-fullscreen"),et=(0,It.Z)((()=>{ie({isBlurred:!0})})),tt=(0,It.Z)((()=>{ie({isBlurred:!1}),document.title.includes(o.ouc)||xe(),Ye(!1)})),nt=(0,It.Z)((()=>{ve()})),at=(0,It.Z)((()=>{we()}));return(0,vt.Z)(et,tt,!!o.D$V),wt(et),function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];(0,i.d4)((()=>{if(s.$b){if(!e)return Zt?.setAttribute("content",Pt),s.cj&&!s.fl&&document.addEventListener("gesturestart",Ct),()=>{Zt?.setAttribute("content","width=device-width, initial-scale=1, shrink-to-fit=no"),s.cj&&!s.fl&&document.removeEventListener("gesturestart",Ct)};Zt?.setAttribute("content",yt)}}),[e])}(m),i.ZP.createElement("div",{ref:De,id:"Main",className:Qe},i.ZP.createElement(jn,{ref:qe}),i.ZP.createElement(gc,{leftColumnRef:qe,isMobile:t}),i.ZP.createElement(Kc,{isMobile:t}),i.ZP.createElement(Xc,{isOpen:m}),i.ZP.createElement(rd,{isOpen:h}),i.ZP.createElement(Td,{requestedDraft:D}),i.ZP.createElement(od,{isOpen:g}),i.ZP.createElement(id,{isOpen:p}),f&&i.ZP.createElement(Na,{key:f.id,message:f,noUi:!0}),i.ZP.createElement(cd,{url:v}),i.ZP.createElement(yd,{urlAuth:H,currentUserName:$}),i.ZP.createElement(dd,{isOpen:w}),i.ZP.createElement(xt,{isOpen:Boolean(P),onClose:nt,stickerSetShortName:P}),i.ZP.createElement(kd,{customEmojiSetIds:y,onClose:at}),I&&i.ZP.createElement(ld,{groupCallId:I}),i.ZP.createElement(ud,{isActive:Boolean(I||T)}),i.ZP.createElement(pd,{isOpen:Boolean(A||N),userId:A,isByPhoneNumber:N}),i.ZP.createElement(xd,{info:X}),i.ZP.createElement(sd,{openedGame:x,gameTitle:L}),i.ZP.createElement(Id,{webApp:q}),i.ZP.createElement(nd,null),i.ZP.createElement(Pd,null),i.ZP.createElement(md,{isActive:T}),i.ZP.createElement(jt,{isForAppBadge:!0}),i.ZP.createElement(fd,{isOpen:U}),i.ZP.createElement(vd,{bot:O,type:j?.type,shouldRequestWriteAccess:j?.shouldRequestWriteAccess}),i.ZP.createElement(wd,{bot:F}),i.ZP.createElement(Ad,{requestedAttachBotInChat:_}),i.ZP.createElement(gd,null),G&&i.ZP.createElement(Cd,{isOpen:G}),i.ZP.createElement(Md,{limit:Z}),i.ZP.createElement(Ed,{isOpen:V,onClose:Me}),i.ZP.createElement(Sd,{isOpen:W,onClose:Re}),i.ZP.createElement(Rd,{folder:J}),i.ZP.createElement(Nd,{isOpen:z,shouldLoad:Oe}))})));var Ud=n(57773),jd=n(21179),Od=n(99364),Fd=n(8337);var _d=n(2092);const Dd=(0,i.X$)((0,a.c$)((e=>({passcodeSettings:e.passcode})))((e=>{let{isLocked:t,passcodeSettings:n}=e;const{unlockScreen:s,signOut:o,logInvalidUnlockAttempt:r,resetInvalidUnlockAttempts:c}=(0,a.Sv)(),{invalidAttemptsCount:d,timeoutUntil:l,isLoading:u}=n,m=(0,qt.Z)(),[h,g]=(0,i.eJ)(""),[p,f]=(0,i.eJ)(!1),[I,v,w]=(0,At.Z)(!1),{shouldRender:b}=(0,St.Z)(t);(0,Tt.Z)(c,l?l-Date.now():void 0);const Z=(0,i.I4)((()=>{g("")}),[]),P=(0,i.I4)((e=>{void 0===l?(g(""),(0,st.so)(e).then(s,(()=>{r(),g(m("lng_passcode_wrong"))}))):g(m("FloodWait"))}),[m,l]);(0,i.d4)((()=>{void 0!==l?g(m("FloodWait")):0===d&&g("")}),[l,m,d]);const y=(0,i.I4)((()=>{w(),o({forceInitApi:!0})}),[w,o]);if(b)return i.ZP.createElement("div",{className:"sY59IPNwkaRsrfYPhEJc"},i.ZP.createElement("div",{className:"DlErQEIDwmZ0duQgO_2b",dir:m.isRtl?"rtl":void 0},i.ZP.createElement(jd.Z,{tgsUrl:Ud.l.Lock,previewUrl:_d,size:160,className:"ar9YdQbWJreREHmnZa9m"}),i.ZP.createElement(Od.Z,{key:"password-form",shouldShowSubmit:!0,shouldDisablePasswordManager:!0,isLoading:u,error:h,placeholder:m("Passcode.EnterPasscodePlaceholder"),submitLabel:m("Next"),clearError:Z,isPasswordVisible:p,noRipple:!0,onChangePasswordVisibility:f,onSubmit:P}),i.ZP.createElement("div",{className:"uOmdTQr_cJEvuTkQipx7"},i.ZP.createElement("p",null,i.ZP.createElement(Fd.Z,{onClick:v},"Log out")," ","if you don't remember your passcode."),i.ZP.createElement("p",null,i.ZP.createElement(Xt.Z,{color:"translucent",size:"tiny",isText:!0,onClick:v},m("AccountSettings.Logout"))))),i.ZP.createElement(oa.Z,{isOpen:I,onClose:w,text:m("lng_sure_logout"),confirmLabel:m("AccountSettings.Logout"),confirmHandler:y,confirmIsDestructive:!0}))})));o.eMD&&console.log(">>> FINISH LOAD MAIN BUNDLE");const{passcode:{isScreenLocked:qd},connectionState:$d}=(0,a.Rd)();$d||qd||s.Eo||(0,a.Sv)().initApi()},68973:(e,t,n)=>{e.exports=n.p+"encoderWorker.min.8ea62f6317fbac7d4558.js"}}]);
//# sourceMappingURL=5769.1eeed5fc47e8e4ef7301.js.map