2 lines
394 KiB
JavaScript
2 lines
394 KiB
JavaScript
"use strict";(self.webpackChunktelegram_t=self.webpackChunktelegram_t||[]).push([[5769],{79294:(e,t,n)=>{n.r(t),n.d(t,{LockScreen:()=>Od,Main:()=>xd});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(92387),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 F=350;function O(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})}))}),F)}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)}),F)}})),(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)}),F)}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=O(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}),e={...e,fileUploads:{byMessageLocalId:(0,g.CE)(e.fileUploads.byMessageLocalId,[o.toString()])}};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)}),F))}(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=O(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}}}));const V=new Map,W=(0,I.Ds)((e=>e()),500,!1);async function z(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}=Y(t,s,i);e=(0,p.y9)(e,w,n,a,v)}(0,a.R3)(e)}function Y(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 J(e,t){let n;const o=t.attachment?(t,s)=>{V.has(s)||(n=s,V.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&&V.delete(n))}(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}=Y(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 z(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}=Y(a,t,m.Uq.Around);i&&(e=(0,p.y9)(e,c,d,s,r)),u||(0,I.R3)((()=>{z(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;J(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):(ee(t)===ee(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;J(e,{...s,text:l?t:void 0,entities:l?n:void 0,attachment:o,groupedId:c.length>0?d:void 0}),c.forEach((t=>{J(e,{...s,attachment:t,groupedId:d})}))}}))}else{const{text:t,entities:n,attachments:a,replyingTo:s,...o}=h;t&&J(e,{...o,text:t,entities:n,replyingTo:s}),a?.forEach((t=>{J(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&&V.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;W((()=>{(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,w=(0,f.wV)(e),b=r?(0,f.Z1)(e,r):void 0,y=d?(0,f.Z1)(e,d):void 0,C=r&&c?c.sort(((e,t)=>e-t)).map((t=>(0,f.hj)(e,r,t))).filter(Boolean):void 0;if(!b||!y||!C||p&&!y.isForum)return;const E=(0,f._5)(e,d),S=C.filter((e=>!(0,v.jM)(e)));S.length&&(async()=>{await(0,I.Pn)(),(0,h.t9)("forwardMessages",{fromChat:b,toChat:y,toThreadId:p,messages:S,isSilent:s,scheduledAt:o,sendAs:E,withMyScore:l,noAuthors:m,noCaptions:g,isCurrentUserPremium:w})})(),C.filter((e=>(0,v.jM)(e))).forEach((t=>{const{text:n,entities:a}=t.content.text||{},{sticker:i,poll:r}=t.content;J(e,{chat:y,replyingToTopId:p,currentThreadId:p||u._f,text:n,entities:a,sticker:i,poll:r,isSilent:s,scheduledAt:o,sendAs:E})})),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 K,X={};function Q(){K&&(clearTimeout(K),K=void 0);const{loadMessageViews:e}=(0,a.Sv)();Object.entries(X).forEach((t=>{let[n,a]=t;e({chatId:n,ids:Array.from(a),shouldIncrement:!0})})),X={}}function ee(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;K||setTimeout(Q,1e3),X[s]||(X[s]=new Set),a.forEach((e=>{X[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 te=n(85765),ne=n(9211);const ae=(0,I.P2)((e=>e()),500,!1);async function se(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 oe(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 ie(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||{};se(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||oe(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,ne.M)(e,"savedGifs"),d=(0,ne.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,ne.M)(e,"stickersFaved"),r=(0,ne.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})&&se((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&&ae((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,te.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&&ae((()=>{ie(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&&ae((()=>{ie(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;ae((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 oe(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 re=n(790);const ce=(0,I.P2)((e=>e()),500,!1);async function de(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 le(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||le(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&&ce((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,re.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;de(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,re.IS)(c):c,l=i?.[a]?.nextOffsetId;de(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&&le(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 ue=n(65116),me=n(16974);let he,ge;(0,a.iw)("sync",((e,t)=>{o.eMD&&console.log(">>> START SYNC"),he&&clearTimeout(he),e=(0,a.Rd)(),e={...e,isSyncing:!0},(0,a.R3)(e),he=window.setTimeout((()=>{e=(0,a.Rd)(),e={...e,isSyncing:!1},(0,a.R3)(e),he=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,me.S1)(),n({listType:"archived",shouldReplace:!0}),(0,h.t9)("fetchCurrentUser"),s()}})})),(0,ue.ll)((e=>{const{connectionState:t,authState:n,isSynced:s}=e,{isMasterTab:o}=(0,f.jU)(e);!o||s||ge?.connectionState===t&&ge?.authState===n||"connectionStateReady"===t&&"authorizationStateReady"===n&&(0,a.Sv)().sync(),ge=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 pe=n(82267);const fe=(0,I.P2)((e=>e()),500,!1);function Ie(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 ve(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,pe.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,pe.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&&fe((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 we=n(18629);const be=s.cj||s.wZ;class Ze{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(){be&&(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(!be){const t=window.open(e,void 0,this.features);t?t.focus():this.onFail?.()}}cancelPreOpen(){this.preOpened?.close(),this.preOpened=void 0}}const Pe="https://prizes.gamee.com/",ye=(0,I.Ds)((e=>e()),500,!1);async function Ce(e,t,n,s){await(0,h.t9)("toggleAttachBot",{bot:t,isWriteAllowed:s,isEnabled:n}),e=(0,a.Rd)(),await Ee(e)}async function Ee(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 Se(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 Me(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 Re;async function ke(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&&(Re||(Re=new Ze("popup,width=800,height=600",(()=>{u({message:"Allow browser to open popup window",tabId:d})}))),Re.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(Pe)?Re.open(v):(Re.cancelPreOpen(),g({url:v,chatId:n.id,messageId:a,tabId:d})):m({url:v,tabId:d}))}function Te(e){const t=Object.keys(e).map((t=>`${t}=${e[t]}`)).join("&");return t.length>0?`?${t}`:""}async function Ae(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 Ne(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;ke(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;ke(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,we.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,we.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}),Me(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),Me(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,pe.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,pe.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=Ie(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=Ie(e,o,d,c),(0,a.R3)(e)}(i!==d.query||d.canLoadMore)&&ye((()=>{!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=Ie(e=ve(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=ve(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=Ie(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=Ie(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 Ee(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 Ce(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,we.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 Ce(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),Se(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&&Se(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),Se(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&&Se(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)Ne(e,i,a,s,o);else{const t=(0,f.Z1)(e,i.chatId);if(!t)return;Ne(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 Ae(e,{slug:n.slug},s);else{const t=(0,f.Z1)(e,n.chatId);if(!t)return;o=await Ae(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=Te({"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 xe=n(40647);let Be=0;(0,a.iw)("loadAvailableReactions",(async e=>{const t=await(0,h.t9)("getAvailableReactions");t&&(t.forEach((e=>{e.aroundAnimation&&xe.he(`sticker${e.aroundAnimation.id}`,u.IU.BlobUrl),e.centerIcon&&xe.he(`sticker${e.centerIcon.id}`,u.IU.BlobUrl),e.appearAnimation&&xe.he(`sticker${e.appearAnimation.id}`,u.IU.BlobUrl),e.selectAnimation&&xe.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:Be++,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 Le=n(70735);function Ue(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 Ue(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,Le.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 je=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=Ue(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,je.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 Fe=n(83099),Oe=n(64319),_e=n(996),De=n(42986);const qe=o.ckE+o.fK3;let $e;function He(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,De.Eb)(t),a=n?`${n} `:"",s=(0,_e.X)(t,void 0,void 0,void 0,void 0,void 0,!0)?.join("");return`${a}${(0,De.Kk)(e,t,s,!0)}`}(o,t)}\n`),l.push(a),l.push(`${(0,v.MK)(o,t,!1,0,!0)}\n`)})),(0,Oe.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($e&&(clearTimeout($e),$e=void 0),$e=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?qe: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.44".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,pe.bp)(),content:{text:(0,Fe.ZP)("**Telegram Web A was updated to version 1.61**\n\n[🤩](customEmoji:5373026167722876724) **What’s 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) **What’s 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 world’s 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;He(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&&He(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 Ge=n(91947),Ve=n(69995);function We(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 ze(e){o.D$V?window.electron.setWindowTitle(e):document.title!==e&&(document.title=e)}const Ye=(0,I.Ds)(ze,200,!1);let Je,Ke;(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,Ve.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,Ge.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.44"!==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?(Je&&clearInterval(Je),Je=window.setInterval((()=>{t.updatePageTitle({tabId:s})}),500)):(clearInterval(Je),Je=void 0),e=(0,Z.i)(e,{isBlurred:a},s),{...e,initialUnreadNotifications:a?(0,me.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 We(!1),void ze(`${o.Tih} ${o.ouc}`);if(e.initialUnreadNotifications&&Math.round(Date.now()/1e3)%2==0){const t=(0,me.xW)()-e.initialUnreadNotifications;if(t>0)return ze(`${t} notification${t>1?"s":""}`),void We(!0)}We(!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 Ye(`${e} › ${a.topics[n].title}`):void Ye(e)}}ze(o.D$V?"":o.Tih)}));let Xe,Qe=0;(0,ue.ll)((e=>{const{updatePageTitle:t,updateIsOnline:n}=(0,a.Sv)(),s=e.passcode.isScreenLocked!==Ke,o=Object.values(e.byTabId).filter((e=>e.isBlurred)).length,i=(0,f.jU)(e,(0,P._w)()).isMasterTab;s&&t(),o!==Qe&&i&&(Xe&&clearTimeout(Xe),Xe=window.setTimeout((()=>{e=(0,a.Rd)();const t=Object.values(e.byTabId).filter((e=>e.isBlurred)).length;n(t!==(0,P.s1)().length)}),100)),Ke=e.passcode.isScreenLocked,Qe=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 et=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 tt=n(50214),nt=n(95281),at=n(5872),st=n(35369);let ot=!1;(0,I.Gq)((()=>{(0,a.Rd)().passcode.hasPasscode&&!ot&&1===Object.keys((0,a.Rd)().byTabId).length&&(0,tt.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,nt.AU)(s);const i=JSON.stringify({...(0,tt.K8)(),userId:e.currentUserId});e=(0,a.Rd)();const r=(0,at.Uf)((0,p.vu)(e,{hasPasscode:!0,error:void 0,isLoading:!1}));try{await(0,nt.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,at.jA)(!0)}catch(n){(0,nt.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,nt.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,tt.wX)(r,r.userId);const c=e;(e=JSON.parse(i)).byTabId=c.byTabId,(0,at.nE)(e,(0,g.Xh)(st.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,nt.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",(()=>{ot=!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 it=(0,I.P2)((function(){let e=(0,a.Rd)();e=(0,p.ps)(e,{...e.users.statusesById,...rt}),(0,a.R3)(e),rt={}}),3e3,!0);let rt={};(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,rt[a]=s,void it();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 ct=n(78958),dt=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,ct.dc)(e,n.call.id);const a=(0,dt.$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,ct.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,ct.B6)(e,t,n.id,n,Boolean(o)||i===n.id))})),o&&(e=(0,ct.AH)(e,t,{nextOffset:o}));const r=(0,dt.$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,dt.fu)(e)})})),(0,et.EP)(),(0,et.CW)(e,t,r.isVideo,(0,P._w)()),e={...e,phoneCall:r},(0,Z.i)(e,{isCallPanelVisible:!1},(0,P._w)())}}}));var lt=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,lt.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 ut=n(46752),mt=n(1279),ht=n(53551),gt=n(99203),pt=n(25190),ft=n(45332);function It(e){const t=(0,pt.Z)(e);(0,i.d4)((()=>(0,I.Gq)(t)),[t])}var vt=n(34446);const wt=document.querySelector('meta[name="viewport"]'),bt=wt?.getAttribute("content")||"",Zt="width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover";function Pt(e){e.preventDefault()}var yt=n(65326),Ct=n(31212),Et=n(18674),St=n(62357),Mt=n(36413),Rt=n(28183),kt=n(60706),Tt=n(48778);const At=e=>{const{isOpen:t}=e,n=(0,Tt.Z)(gt.gl.Extra,"StickerSetModal",!t);return n?i.ZP.createElement(n,e):void 0};var Nt=n(2155),xt=n(95616),Bt=n(17358);const Lt=(0,i.X$)((e=>{let{isForAppBadge:t}=e;(0,xt.yi)();const n=(0,me.xW)();if((0,i.d4)((()=>{t&&(0,Bt.w)(n)}),[t,n]),!t&&n)return i.ZP.createElement("div",{className:"unread-count active"},(0,Nt.bi)(n))}));var Ut=n(23989),jt=n(53455),Ft=n(73541),Ot=n(2255),_t=n(59107),Dt=n(54416),qt=n(706);let $t=function(e){return e[e.waitingForNetwork=0]="waitingForNetwork",e[e.syncing=1]="syncing",e[e.online=2]="online",e}({});function Ht(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?$t.syncing:$t.online:$t.waitingForNetwork,c=r===$t.online||o?"none":a?"middleHeader":s?"minimized":"overlay",r===$t.waitingForNetwork?d=e("WaitingForNetwork"):r===$t.syncing&&(d=e("Updating")),"middleHeader"===c&&(d=d.toLowerCase().replace(/\.+$/,"")),{connectionStatus:r,connectionStatusPosition:c,connectionStatusText:d}}var Gt=n(36046),Vt=n(73217),Wt=n(97458),zt=n(53106),Yt=n(58964),Jt=n(231),Kt=n(69589),Xt=n(49187),Qt=n(83321),en=n(40126),tn=n(49204);const nn=(0,i.X$)((e=>{let{connectionStatus:t,connectionStatusText:n,onClick:a}=e;const s=(0,_t.Z)();return i.ZP.createElement("div",{id:"ConnectionStatusOverlay",dir:s.isRtl?"rtl":void 0,onClick:a},i.ZP.createElement(tn.Z,{color:"black"}),i.ZP.createElement("div",{className:"state-text"},i.ZP.createElement(Ot.Z,{activeKey:t,name:"slideFade"},n)),i.ZP.createElement(Jt.Z,{round:!0,size:"tiny",color:"translucent-black"},i.ZP.createElement("span",{className:"icon icon-close"})))}));var an=n(274),sn=n(96459),on=n(4863),rn=n(6202);const cn="HO3tML0GAC9vTH28baKB",dn=(0,i.X$)((e=>{let{reaction:t,isLottie:n,className:a}=e;const o=(0,v.RK)(t.documentId),r=(0,rn.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,ut.Z)("HAg4STRlxDV3frYuABYr",a)},c.map((e=>{const a=`--offset-path: path('${e}');`;return n?i.ZP.createElement(sn.Z,{documentId:t.documentId,className:cn,style:a,withSharedAnimation:!0}):i.ZP.createElement("img",{src:r,alt:"",className:cn,style:a})})))})),ln=e=>{const{isOpen:t}=e,n=(0,Tt.Z)(gt.gl.Extra,"StatusPickerMenu",!t);return n?i.ZP.createElement(n,e):void 0},un=(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,kt.Z)(!1),[u,m,h]=(0,kt.Z)(!1),[g,p,f]=(0,kt.Z)(!1),{isMobile:I}=(0,B.ZP)(),v=t?.until?1e3*t.until-Date.now()+1e3*(0,pe.Qj)():void 0;(0,Rt.Z)(s,v),(0,an.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,Rt.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(dn,{reaction:t,isLottie:!0,className:"emoji-status-effect"}),i.ZP.createElement(Jt.Z,{round:!0,ref:r,ripple:!I,size:"smaller",color:"translucent",className:"emoji-status",onClick:b},t?i.ZP.createElement(sn.Z,{key:t.documentId,documentId:t.documentId,size:24,loopLimit:o.y3O}):i.ZP.createElement(on.Z,null)),i.ZP.createElement(ln,{statusButtonRef:r,isOpen:g,onEmojiStatusSelect:w,onClose:f}))})));var mn=n(79994);const hn={date:void 0},gn={id:void 0},pn=(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,isFetchingDifference:l}=e,{isConnectionStatusMinimized:u,animationLevel:m}=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:m,connectionState:r,isSyncing:c,isFetchingDifference:l,isMessageListOpen:Boolean((0,f.Bt)(e)),isConnectionStatusMinimized:u,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,isFetchingDifference:S,isMessageListOpen:M,isConnectionStatusMinimized:R,areChatsLoaded:k,hasPasscode:T,canSetPasscode:A,canInstall:N,archiveSettings:x}=e;const{openChat:L,setGlobalSearchDate:U,setSettingOption:j,setGlobalSearchChatId:F,openChatByUsername:O,lockScreen:_,requestNextSettingsScreen:D,skipLockOnUnload:q,openUrl:$,updatePerformanceSettings:H}=(0,a.Sv)(),G=(0,_t.Z)(),{isMobile:V}=(0,B.ZP)(),W=n===m.du.ChatList,z=(0,i.Ye)((()=>Z?(0,re.xH)(new Date(1e3*Z)):void 0),[Z]),Y=(0,xt.yi)()[o.WSp]?.chatsCount||0,{connectionStatus:J,connectionStatusText:K,connectionStatusPosition:X}=Ht(G,C,E||S,M,R,!k),Q=(0,pt.Z)((e=>{e.preventDefault(),e.stopPropagation(),T?_():D({screen:m.MT.PasscodeDisabled})}));(0,Ft.y)(A?{"Ctrl+Shift+L":Q,"Alt+Shift+L":Q,"Meta+Shift+L":Q,...s.RM&&{"Mod+L":Q}}:void 0);const ee=window.location.hostname===o.xHY||o.Cgt,te=(0,i.Ye)((()=>e=>{let{onTrigger:t,isOpen:n}=e;return i.ZP.createElement(Jt.Z,{round:!0,ripple:W&&!V,size:"smaller",color:"translucent",className:n?"active":"",onClick:W?t:()=>g(),ariaLabel:W?G("AccDescrOpenMenu2"):"Return to chat list"},i.ZP.createElement("div",{className:(0,ut.Z)("animated-menu-icon",!W&&"state-back",v&&"no-animation")}))}),[W,V,G,g,v]),ne=(0,pt.Z)((()=>{p||c("")})),ae=(0,pt.Z)((()=>{j({isConnectionStatusMinimized:!R})})),se=(0,pt.Z)((()=>{L({id:w,shouldReplaceHistory:!0})})),oe=(0,pt.Z)((e=>{e.stopPropagation(),j({theme:"light"===P?"dark":"light"}),j({shouldUseSystemTheme:!1})})),ie=(0,pt.Z)((e=>{e.stopPropagation();let t=y+1;t>o.zy8&&(t=o.oBh);const n=t===o.oBh?st.ww:t===o.zy8?st.WD:st.LN;j({animationLevel:t}),H(n)})),ce=(0,pt.Z)((()=>{window.open(o.ulW,"_blank","noopener")})),de=(0,pt.Z)((()=>{localStorage.setItem("kz_version",JSON.stringify("K")),(0,qt.W8)(),q()})),le=(0,pt.Z)((()=>{O({username:G("Settings.TipsUsername")})})),ue=(0,pt.Z)((()=>{$({url:o.mUA})})),me=(0,pt.Z)((()=>{_()})),he=Boolean(b)||n===m.du.GlobalSearch||n===m.du.Contacts;(0,i.d4)((()=>he?(0,Ut.Z)((()=>g())):void 0),[he,g]);const ge=n===m.du.Contacts?G("SearchFriends"):G("Search"),pe=o.Tjg?"1.61.44 Beta (master)":o.eMD?"master":"1.61.44",fe=y!==o.oBh?y===o.zy8?"max":"mid":"min",Ie=(0,Mt.Ar)(),{shouldDisableDropdownMenuTransitionRef:ve,handleDropdownMenuTransitionEnd:we}=(0,Vt.Z)(t),be=(0,i.sO)(null);(0,Wt.Z)(be);const Ze=(0,i.Ye)((()=>i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement(Yt.Z,{icon:"saved-messages",onClick:se},G("SavedMessages")),x.isHidden&&i.ZP.createElement(Yt.Z,{icon:"archive",onClick:h},i.ZP.createElement("span",{className:"menu-item-name"},G("ArchivedChats")),Y>0&&i.ZP.createElement("div",{className:"right-badge"},Y)),i.ZP.createElement(Yt.Z,{icon:"user",onClick:u},G("Contacts")),i.ZP.createElement(Yt.Z,{icon:"settings",onClick:l},G("Settings")),i.ZP.createElement(Yt.Z,{icon:"darkmode",onClick:oe},i.ZP.createElement("span",{className:"menu-item-name"},G("lng_menu_night_mode")),i.ZP.createElement(Qt.Z,{id:"darkmode",label:G("dark"===P?"lng_settings_disable_night_theme":"lng_settings_enable_night_theme"),checked:"dark"===P,noAnimation:!0})),i.ZP.createElement(Yt.Z,{icon:"animations",onClick:ie},i.ZP.createElement("span",{className:"menu-item-name capitalize"},G("Appearance.Animations").toLowerCase()),i.ZP.createElement(mn.Z,{value:fe})),i.ZP.createElement(Yt.Z,{icon:"help",onClick:le},G("TelegramFeatures")),i.ZP.createElement(Yt.Z,{icon:"bug",onClick:ue},"Report Bug"),o.Tjg&&i.ZP.createElement(Yt.Z,{icon:"permissions",onClick:ce},"Beta Changelog"),ee&&i.ZP.createElement(Yt.Z,{icon:"K",isCharIcon:!0,href:"https://web.telegram.org/k/",onClick:de},"Switch to K Version"),N&&i.ZP.createElement(Yt.Z,{icon:"install",onClick:(0,Gt.G)()},"Install App"))),[fe,Y,N,ie,ue,G,ce,oe,le,se,de,h,u,l,P,ee,x]),Pe=(0,i.Ye)((()=>i.ZP.createElement(i.ZP.Fragment,null,z&&i.ZP.createElement(Xt.Z,{icon:"calendar",title:z,canClose:!0,isMinimized:Boolean(b),className:"search-date",onClick:U,clickArg:hn}),b&&i.ZP.createElement(Xt.Z,{chatOrUserId:b,onClick:F,canClose:!0,clickArg:gn}))),[b,z]);return i.ZP.createElement("div",{className:"LeftMainHeader"},i.ZP.createElement("div",{id:"LeftMainHeader",className:"left-header",ref:be},G.isRtl&&i.ZP.createElement("div",{className:"DropdownMenuFiller"}),i.ZP.createElement(zt.Z,{trigger:te,footer:`${o.iCi} ${pe}`,className:(0,ut.Z)("main-menu",G.isRtl&&"rtl",t&&G.isRtl&&"right-aligned",ve.current&&G.isRtl&&"disable-transition"),positionX:t&&G.isRtl?"right":"left",transformOriginX:o.D$V&&s.jm&&!Ie?90:void 0,onTransitionEnd:G.isRtl?we:void 0},Ze),i.ZP.createElement(Kt.Z,{inputId:"telegram-search-input",parentContainerClassName:"LeftSearch",className:(0,ut.Z)(b||Z?"with-picker-item":void 0,t&&"SearchInput--hidden"),value:d?void 0:r||p,focused:he,isLoading:f||"minimized"===X,spinnerColor:"minimized"===X?"yellow":void 0,spinnerBackgroundColor:"minimized"===X&&"light"===P?"light":void 0,placeholder:ge,autoComplete:"off",canClose:Boolean(b||Z),onChange:c,onReset:g,onFocus:ne,onSpinnerClick:"minimized"===X?ae:void 0},Pe),I&&i.ZP.createElement(un,null),T&&i.ZP.createElement(Jt.Z,{round:!0,ripple:!V,size:"smaller",color:"translucent",ariaLabel:`${G("ShortcutsController.Others.LockByPasscode")} (Ctrl+Shift+L)`,onClick:me,className:(0,ut.Z)(!I&&"extra-spacing")},i.ZP.createElement("i",{className:"icon icon-lock"})),i.ZP.createElement(en.Z,{isOpen:"overlay"===X,isCustom:!0,className:"connection-state-wrapper"},i.ZP.createElement(nn,{connectionStatus:J,connectionStatusText:K,onClick:ae}))))})));var fn=n(64963),In=n(46590),vn=n(31711),wn=n(64034);const bn=(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,ne.M)(e,"dialogFilters"),maxFolderInvites:(0,ne.M)(e,"chatlistInvites"),maxChatLists:(0,ne.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,_t.Z)();(0,i.d4)((()=>{P()}),[]);const A=(0,i.Ye)((()=>({id:o.NfV,title:d?.[0]===o.NfV?T("FilterAllChatsShort"):T("FilterAllChats"),includedChatIds:Le.D,excludedChatIds:Le.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,xt.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]),F=(0,pt.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,fn.sf)(k.current,{selectorToPreventScroll:".chat-list",onSwipe:(e,t)=>t===fn.eM.Left?(y({activeChatFolder:Math.min(l+1,j.length-1)},{forceOnHeavyAnimation:!0}),!0):t===fn.eM.Right&&(y({activeChatFolder:Math.max(0,l-1)},{forceOnHeavyAnimation:!0}),!0)})}),[l,j,m,y]);const O=(0,i.sO)();O.current=!L,(0,i.d4)((()=>O.current?(0,Ut.Z)((()=>{O.current&&y({activeChatFolder:0})})):void 0),[l,y]),(0,In.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,Ct.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(wn.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,ut.Z)("ChatFolders",$&&I&&"ChatFolders--tabs-hidden")},$?i.ZP.createElement(vn.Z,{contextRootElementSelector:"#LeftColumn",tabs:j,activeTab:l,onSwitchTab:F,areFolders:!0}):_?i.ZP.createElement("div",{className:(0,ut.Z)("tabs-placeholder",D)}):void 0,i.ZP.createElement(Ot.Z,{ref:k,name:h?"none":T.isRtl?"slideOptimizedRtl":"slideOptimized",activeKey:l,renderCount:$?j.length:void 0},q))})));var Zn=n(34288);const Pn=e=>{const t=(0,Tt.Z)(gt.gl.Extra,"LeftSearch");return t?i.ZP.createElement(t,e):i.ZP.createElement(Zn.Z,null)},yn=e=>{const t=(0,Tt.Z)(gt.gl.Extra,"ContactList");return t?i.ZP.createElement(t,e):i.ZP.createElement(Zn.Z,null)};var Cn=n(52328);const En=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,_t.Z)(),d=(0,ut.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(Yt.Z,{icon:"channel",onClick:a},c("NewChannel")),i.ZP.createElement(Yt.Z,{icon:"group",onClick:s},c("NewGroup")),i.ZP.createElement(Yt.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(Jt.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(Cn.Z,{isOpen:o,positionX:c.isRtl?"left":"right",positionY:"bottom",autoClose:!0,onClose:u},m))};var Sn=n(59690);const Mn=Object.keys(m.du).length/2;let Rn;const kn=(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,Dt.Z)(g),M=g&&t===m.du.ChatList,R=M&&S,{shouldRender:k,transitionClassNames:T}=(0,Ct.Z)(h),A=(0,i.sO)(!1),N=(0,pt.Z)((()=>{t===m.du.ChatList&&(A.current=!0,P(!0))})),x=(0,pt.Z)((()=>{A.current=!1,Rn&&(clearTimeout(Rn),Rn=void 0),Rn=window.setTimeout((()=>{A.current||P(!1)}),250)})),B=(0,pt.Z)((()=>{f(m.du.Settings)})),L=(0,pt.Z)((()=>{f(m.du.Contacts)})),U=(0,pt.Z)((()=>{f(m.du.Archived),b()})),j=(0,pt.Z)((()=>{o.D$V?window.electron?.installUpdate():window.location.reload()})),F=(0,pt.Z)((()=>{f(m.du.NewChannelStep1)})),O=(0,pt.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,_t.Z)();return i.ZP.createElement("div",{id:"LeftColumn-main",onMouseEnter:s.$b?void 0:N,onMouseLeave:s.$b?void 0:x},i.ZP.createElement(pn,{shouldHideSearch:R,content:t,contactsFilter:d,onSearchQuery:p,onSelectSettings:B,onSelectContacts:L,onSelectArchived:U,onReset:v,shouldSkipTransition:l,isClosingSearch:c}),i.ZP.createElement(Ot.Z,{name:l?"none":"zoomFade",renderCount:Mn,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(bn,{shouldHideFolderTabs:R,onSettingsScreenSelect:I,onLeftColumnContentChange:f,foldersDispatch:u,isForumPanelOpen:R});case m.du.GlobalSearch:return i.ZP.createElement(Pn,{searchQuery:n,searchDate:r,isActive:e,onReset:v});case m.du.Contacts:return i.ZP.createElement(yn,{filter:d,isActive:e,onReset:v});default:return}})),k&&i.ZP.createElement(Jt.Z,{fluid:!0,pill:!0,className:(0,ut.Z)("btn-update",T),onClick:j},_("lng_update_telegram")),y&&i.ZP.createElement(Sn.Z,{isOpen:g,isHidden:!M,onTopicSearch:w,onOpenAnimationStart:E,onCloseAnimationEnd:C}),i.ZP.createElement(En,{isShown:Z,onNewPrivateChat:L,onNewChannel:F,onNewGroup:O}))})),Tn=e=>{const t=(0,Tt.Z)(gt.gl.Extra,"Settings");return t?i.ZP.createElement(t,e):i.ZP.createElement(Zn.Z,null)},An=e=>{const t=(0,Tt.Z)(gt.gl.Extra,"NewChat");return t?i.ZP.createElement(t,e):i.ZP.createElement(Zn.Z,null)},Nn=e=>{const t=(0,Tt.Z)(gt.gl.Extra,"ArchivedChats");return t?i.ZP.createElement(t,e):i.ZP.createElement(Zn.Z,null)};var xn=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}(xn||{});const Bn=Object.keys(xn).length/2,Ln=(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,jt.ZP)(),[j,F]=(0,i.eJ)(0);let O=xn.Main;switch(k){case m.du.Archived:O=xn.Archived;break;case m.du.Settings:O=xn.Settings;break;case m.du.NewChannelStep1:case m.du.NewChannelStep2:O=xn.NewChannel;break;case m.du.NewGroupStep1:case m.du.NewGroupStep2:O=xn.NewGroup}const _=(0,pt.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}),F(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,pt.Z)((e=>{k!==m.du.Contacts?(T(m.du.GlobalSearch),e!==n&&b({query:e})):B(e)})),q=(0,pt.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,Ut.Z)((()=>{_()})):void 0}),[r,k,_,g,f]);const $=(0,pt.Z)((e=>{k!==m.du.GlobalSearch&&(e.preventDefault(),T(m.du.GlobalSearch))})),H=(0,pt.Z)((e=>{e.preventDefault(),M({id:d,shouldReplaceHistory:!0})})),G=(0,pt.Z)((e=>{e.preventDefault(),T(m.du.Archived)})),V=(0,pt.Z)((e=>{e.preventDefault(),T(m.du.Settings)}));(0,Ft.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,vt.Z)((()=>{void 0!==u&&(T(m.du.Settings),N(u),R({screen:void 0})),h&&U(h)}),[U,h,u,R]);const W=(0,pt.Z)((e=>{T(m.du.Settings),N(e)}));function z(e){switch(O){case xn.Archived:return i.ZP.createElement(Nn,{isActive:e,onReset:_,onTopicSearch:q,foldersDispatch:U,onSettingsScreenSelect:W,onLeftColumnContentChange:T,isForumPanelOpen:f,archiveSettings:w});case xn.Settings:return i.ZP.createElement(Tn,{isActive:e,currentScreen:A,foldersState:L,foldersDispatch:U,onScreenSelect:W,onReset:_,shouldSkipTransition:c});case xn.NewChannel:return i.ZP.createElement(An,{key:j,isActive:e,isChannel:!0,content:k,onContentChange:T,onReset:_});case xn.NewGroup:return i.ZP.createElement(An,{key:j,isActive:e,content:k,onContentChange:T,onReset:_});default:return i.ZP.createElement(kn,{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(Ot.Z,{ref:t,name:c?"none":s.s0,renderCount:Bn,activeKey:O,shouldCleanup:!0,cleanupExceptionKey:xn.Main,shouldWrap:!0,wrapExceptionKey:xn.Main,id:"LeftColumn"},z)})));var Un=n(12420),jn=n(80036),Fn=n(49524),On=n(71394);var _n=n(12255),Dn=n(52678),qn=n(87204),$n=n(28712),Hn=n(3570),Gn=n(33799),Vn=n(39415),Wn=n(75790),zn=n(18360),Yn=n(86203),Jn=n(6058),Kn=n(98799),Xn=n(59188),Qn=n(32340),ea=n(2903),ta=n(17891),na=n(68512),aa=n(17551);const sa={"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 oa(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 ia=(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=oa(0,0,2,t,1)+oa(0,12,2,t+1,1)+oa(0,25,2,t,1);else for(let e=0;e<n;e++)a+=oa(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:sa.pinnedMessageBorder},i.ZP.createElement("div",{className:sa.pinnedMessageBorderWrapper1,ref:a}));const{trackHeight:o,trackTranslateY:r,markHeight:c,markTranslateY:d,clipPathId:l}=s;return i.ZP.createElement("div",{className:(0,ut.Z)(sa.pinnedMessageBorder,t>4&&sa.pinnedMessageBorderMask)},i.ZP.createElement("div",{className:sa.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:sa.pinnedMessageBorderMark,style:`--height: ${c}px; --translate-y: ${d}px; --translate-track: ${r}px;`})))}));var ra=n(45370),ca=n(62230),da=n(34076);const la="DusHAy2Lx0SlaPpVAb_o",ua="jSVbc8Hb7PjitJujB_dQ",ma=1.125*E.Gw,ha=(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,_t.Z)(),f=(0,ea.Z)(t),I=(0,rn.Z)((0,v.Ti)(t,"pictogram")),w=(0,v.NE)(t),b=(0,ta.Z)([m],450)&&m,[Z,P,y]=(0,kt.Z)(),C=(0,pt.Z)((()=>{y(),d&&d(t.id)})),S=(0,v.eH)(t),M=(0,pt.Z)((()=>{S&&g({messageId:t.id,button:S})})),[R,k,T]=(0,kt.Z)(),{handleClick:A,handleMouseDown:N}=(0,Vn.m)(l);return i.ZP.createElement("div",{className:(0,ut.Z)("HeaderPinnedMessageWrapper","TMOjo7XfD1ZiiuRtfpkm",h&&"full-width",c)},(n>1||b)&&i.ZP.createElement(Jt.Z,{round:!0,size:"smaller",color:"translucent",ariaLabel:p("EventLogFilterPinnedMessages"),onClick:b?void 0:u},m&&i.ZP.createElement(tn.Z,{color:"blue",className:(0,ut.Z)("d7XDT4Keip1KHh7mcCv9",la,!b&&ua)}),i.ZP.createElement("i",{className:(0,ut.Z)("icon","icon-pin-list",la,b&&ua)})),d&&i.ZP.createElement(Jt.Z,{round:!0,size:"smaller",color:"translucent",ariaLabel:p("UnpinMessageAlertTitle"),onClick:P},i.ZP.createElement("i",{className:"icon icon-close"})),i.ZP.createElement(aa.Z,{isOpen:Z,onClose:y,text:"Would you like to unpin this message?",confirmLabel:"Unpin",confirmHandler:C}),i.ZP.createElement("div",{className:(0,ut.Z)("uhn_g6FmUELuGJrCm45w",R&&"jeTsUEkDCkzGUVwy6lrL"),onClick:A,onMouseDown:N,dir:p.isRtl?"rtl":void 0},i.ZP.createElement(ia,{count:n,index:o}),i.ZP.createElement(Ot.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(ca.Z,{thumbDataUri:o,isVisible:Boolean(n),width:a,height:s}))}(f,I,w)),i.ZP.createElement("div",{className:(0,ut.Z)("bSvmca5kaTIUh3yJBxnF",f&&"FBCNFm307_rxATSHPSiN")},i.ZP.createElement("div",{className:"q9_FnsHlndM1hZqZjxjM",dir:"auto"},!r&&i.ZP.createElement(da.Z,{text:`${p("PinnedMessage")} ${o>0?"#"+(n-o):""}`}),r&&(0,Qn.Z)(r)),i.ZP.createElement(Ot.Z,{activeKey:t.id,name:"slideVerticalFade",className:"ugsKEK4Xb166oFMP8hHy"},i.ZP.createElement("p",{dir:"auto",className:"WRuyhyQK6mv28Mz8iK28"},i.ZP.createElement(ra.Z,{lang:p,message:t,noEmoji:Boolean(f),emojiSize:ma})))),i.ZP.createElement(na.Z,null),S&&i.ZP.createElement(Jt.Z,{size:"tiny",className:"kXRuktM2s7UN91zOl0Tx",onClick:M,shouldStopPropagation:!0,onMouseEnter:s.$b?void 0:k,onMouseLeave:s.$b?void 0:T},S.text)))}));var ga=n(10396),pa=n(64532),fa=n(23186),Ia=n(75851);const va=240;function wa(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=()=>{ba(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 ba(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"image/png";if(!("createImageBitmap"in window))return Za(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,Ia.ix)(e.src),i=(0,Ia.rZ)(o)<va?"#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 Za(e,t,n,void 0,a)}}async function Za(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,Ia.ix)(e.src),l=(0,Ia.rZ)(d)<va?"#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 Pa=n(77510);const ya=n.p+"telegram-logo-filled.67469f6dc5e301e8e0bd.svg",Ca={width:200,height:200},Ea=115;var Sa=n(17240),Ma=n(18051);const Ra={.5:.66,.75:.8,1:1,1.5:1.4,2:1.8},ka=Object.keys(Ra).sort().map(Number),Ta=(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,_t.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=xe.UV((0,v.Ti)(t,"inline")),A=((e,t,n)=>{const a=(0,_t.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,rn.Z)(m),g=(0,i.Ye)((()=>function(e,t,n){if(!n)return Ca;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,Pa.Z)((()=>function(e,t){if(!e)return Promise.resolve(ya);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=()=>{ba(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,Ea,Ea);const n=Math.min(t.width,t.height);return n<Ea?wa(e,Ea/n):Promise.resolve(e)}(h,g)),[h,g],ya);return(0,i.Ye)((()=>(0,pa.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:F,isLast:O,setVolume:_,toggleMuted:D,setPlaybackRate:q}=(0,fa.Z)((0,ga.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,Sa.Z)(b),z=(0,pt.Z)((()=>{I({chatId:t.chatId,messageId:t.id})})),Y=(0,pt.Z)((()=>{L&&N(),w(),(0,pa.Ay)(),x()})),J=(0,pt.Z)((e=>{g({volume:e/100}),_(e/100)})),K=(0,pt.Z)((()=>{s.$b&&!s.cj||(D(),f({isMuted:!h}))})),X=(0,pt.Z)((function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const n=Ra[e],a=1!==e&&t;p({playbackRate:n,isPlaybackRateActive:a}),q(a?n:1)})),Q=(0,pt.Z)((()=>{V();const e=Number(Object.entries(Ra).find((e=>{let[,t]=e;return t===u}))?.[0])||1,t=!m;X(t&&1===e?2:e,t)})),ee=(0,pt.Z)((()=>{const e=Object.entries(Ra).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(Jt.Z,{round:!0,className:(0,ut.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,ut.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,ut.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,Qn.Z)(t||a)),n&&i.ZP.createElement("div",{className:"subtitle",dir:"auto"},(0,Qn.Z)(n)))}(y):function(e,t){return i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement("div",{className:"title",dir:"auto"},t&&(0,Qn.Z)(t)),i.ZP.createElement("div",{className:"subtitle",dir:"auto"},e))}(Z("AttachAudio"),k),i.ZP.createElement(na.Z,null)),i.ZP.createElement(Jt.Z,{round:!0,ripple:!P,color:"translucent",size:"smaller",className:"player-button",disabled:F(),onClick:j,ariaLabel:"Previous track"},i.ZP.createElement("i",{className:"icon icon-skip-previous"})),i.ZP.createElement(Jt.Z,{round:!0,ripple:!P,color:"translucent",size:"smaller",className:(0,ut.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(Jt.Z,{round:!0,ripple:!P,color:"translucent",size:"smaller",className:"player-button",disabled:O(),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(Jt.Z,{round:!0,className:"player-button volume-button",color:"translucent",size:"smaller",ariaLabel:"Volume",onClick:K,ripple:!P},i.ZP.createElement("i",{className:(0,ut.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(Ma.Z,{bold:!0,value:h?0:100*l,onChange:J})))),R&&i.ZP.createElement(zt.Z,{forceOpen:$,positionX:"right",positionY:"top",className:"playback-rate-menu",trigger:ee,onClose:V,onHide:W,onMouseEnterBackdrop:V},ka.map((e=>function(e,t,n,a){const s=t===Ra[e]&&a||1===e&&!a;return i.ZP.createElement(Yt.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(Jt.Z,{round:!0,className:"player-close",color:"translucent",size:"smaller",onClick:Y,ariaLabel:"Close player"},i.ZP.createElement("i",{className:"icon icon-close"})))}));var Aa=n(4794),Na=n(14605);const xa=(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,_t.Z)(),[b,Z,P]=(0,kt.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,pt.Z)((()=>{d({userId:t}),R&&f({id:t})})),B=(0,pt.Z)((()=>{P(),l({contactId:t,accessHash:M}),k&&y&&u({chatId:t}),E&&m({chatId:t})})),L=(0,pt.Z)((()=>{I({chatId:t})})),U=(0,pt.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,ut.Z)("ChatReportPanel",n),dir:w.isRtl?"rtl":void 0},T&&i.ZP.createElement(Jt.Z,{isText:!0,fluid:!0,size:"tiny",className:"UserReportPanel--Button",onClick:x},w("lng_new_contact_add")),A&&i.ZP.createElement(Jt.Z,{color:"danger",isText:!0,fluid:!0,size:"tiny",className:"UserReportPanel--Button",onClick:Z},w("lng_new_contact_block")),k&&!A&&i.ZP.createElement(Jt.Z,{color:"danger",isText:!0,fluid:!0,size:"tiny",className:"UserReportPanel--Button",onClick:Z},w("lng_report_spam_and_leave")),i.ZP.createElement(Jt.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(aa.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(Na.Z,{label:w("DeleteThisChat"),checked:E,onCheck:S}),o&&k&&i.ZP.createElement(Na.Z,{label:w("ReportChat"),checked:y,onCheck:C})))}))),Ba=(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,isSynced:e.isSynced,isFetchingDifference:e.isFetchingDifference,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,isSynced:T,isFetchingDifference:A,getCurrentPinnedIndexes:N,getLoadingPinnedId:x,onFocusPinnedMessage:L}=e;const{openChatWithInfo:U,pinMessage:j,focusMessage:F,openChat:O,openPreviousChat:_,loadPinnedMessages:D,toggleLeftColumn:q,exitMessageSelectMode:$}=(0,a.Sv)(),H=(0,_t.Z)(),G=(0,i.sO)(!0),{isTablet:V}=(0,B.ZP)(),W=(0,Yn.Z)(N)[`${t}_${n}`]||0,z=(0,Yn.Z)(x),Y=Array.isArray(l)?l[W]:l,J=m&&Y?m[Y]:void 0,K=Array.isArray(l)?l.length:l?1:void 0,X=Z&&(0,v.U)(H,Z).length,Q=g?(0,v.OU)(H,g):void 0,{settings:ee}=Z||{},te=Z?.isForum;(0,i.d4)((()=>{T&&r&&(n===u._f||te)&&D({chatId:t,threadId:n})}),[t,n,T,r,te]),(0,Wn.Z)(t,Y,J);const{width:ne}=(0,_n.Z)(),ae=ne<=o.ksF,se=V&&I,oe=(0,i.sO)(null),ie=(0,i.sO)(!0),{handleClick:re,handleMouseDown:ce}=(0,Vn.m)((()=>{U({id:t,threadId:n})})),de=(0,pt.Z)((e=>{j({messageId:e,isUnpin:!0})})),le=(0,pt.Z)((e=>{const a=e.shiftKey&&Array.isArray(l)?l[(0,Hn.Z)(l.length,l.indexOf(Y)-2)]:Y;L(a)&&F({chatId:t,threadId:n,messageId:a,noForumTopicPanel:!0})})),ue=(0,pt.Z)((()=>{O({id:t,threadId:n,type:"pinned"})})),me=(0,pt.Z)((()=>{setTimeout((()=>{G.current=!0}),450)})),he=(0,pt.Z)((e=>{if(G.current){if(G.current=!1,d&&document.querySelector(o.Edp)?.blur(),f)return $(),void me();if("thread"===s&&0===M)return!V||se?(e.stopPropagation(),O({id:void 0},{forceOnHeavyAnimation:!0})):q(),void me();_(),me()}})),ge=ne>=o.ksF&&ne<o.jT7||ne>o.l35&&ne<o.ksF&&(!X||X>30),pe=ge||ne>o._mX&&ne<o.QU1,fe=Boolean(ee?.canAddContact||ee?.canBlockContact||ee?.canReportSpam),{shouldRender:Ie,transitionClassNames:ve}=(0,Ct.Z)(fe),we=(0,zn.Z)(fe?ee:void 0,!0),{shouldRender:be,transitionClassNames:Ze}=(0,Ct.Z)(Boolean(b)),Pe=(0,zn.Z)(b,!0),{shouldRender:ye,transitionClassNames:Ce}=(0,Ct.Z)(Boolean(J),void 0,!0),Ee=(0,zn.Z)(J,!0),Se=(0,zn.Z)(K,!0),Me=(0,zn.Z)(h,!0),Re=(0,zn.Z)(Q),ke=(0,qn.Z)(M),Te=void 0!==ke&&ke<M?ke:void 0,Ae=ye&&Ee||be&&Pe;(0,i.bt)((()=>{const e=oe.current;if(e)return pe&&Ae?void(w||ge?(ie.current&&(e.classList.add("tools-stacked","animated"),ie.current=!1),setTimeout((()=>{(0,c.WM)((()=>{e.classList.remove("animated")}))}),350)):(e.classList.remove("tools-stacked"),ie.current=!0)):(e.classList.remove("tools-stacked","animated"),void(ie.current=!0))}),[pe,Ae,ge,w]);const{connectionStatusText:Ne}=Ht(H,R,k||A,!0);function xe(){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(Jt.Z,{round:!0,size:"smaller",color:"translucent",onClick:he,ariaLabel:H(e?"Close":"Back")},i.ZP.createElement("div",{className:(0,ut.Z)("animated-close-icon",!e&&"state-back")})),t&&i.ZP.createElement(Lt,null))}const Be=Boolean(be&&Pe),Le=Be||!d&&E&&ne<o.sgm;return(0,Wt.Z)(oe),i.ZP.createElement("div",{className:"MiddleHeader",ref:oe},i.ZP.createElement(Ot.Z,{name:S?"none":"slideFade",activeKey:M,shouldCleanup:!0,cleanupExceptionKey:Te},"thread"!==s||n!==u._f&&!Z?.isForum?i.ZP.createElement(i.ZP.Fragment,null,xe(),i.ZP.createElement("h3",null,void 0!==P?"thread"===s?H(y?"CommentsCount":"Replies",P,"i"):"pinned"===s?H("PinnedMessagesCount",P,"i"):"scheduled"===s?C?H("Reminders"):H("messages",P,"i"):void 0:H("Loading"))):i.ZP.createElement(i.ZP.Fragment,null,(ae||M>0)&&xe(se,!0),i.ZP.createElement("div",{className:"chat-info-wrapper",onClick:re,onMouseDown:ce},(0,v.YC)(t)?i.ZP.createElement(Jn.Z,{key:t,userId:t,typingStatus:p,status:Ne,withDots:Boolean(Ne),withFullInfo:!0,withMediaViewer:!0,withUpdatingStatus:!0,emojiStatusSize:22,noRtl:!0}):i.ZP.createElement(Kn.Z,{key:t,chatId:t,threadId:n,typingStatus:p,status:Ne,withDots:Boolean(Ne),withMediaViewer:n===u._f,withFullInfo:n===u._f,withUpdatingStatus:!0,noRtl:!0})))),n===u._f&&!Z?.isForum&&i.ZP.createElement(Aa.Z,{hasPinnedOffset:ye&&Boolean(Ee)||be&&Boolean(Pe),chatId:t}),ye&&Ee&&i.ZP.createElement(ha,{key:t,message:Ee,count:Se||0,index:W,customTitle:Re,className:Ce,onUnpinMessage:Me?de:void 0,onClick:le,onAllPinnedClick:ue,isLoading:void 0!==z,isFullWidth:Le}),Ie&&i.ZP.createElement(xa,{key:t,chatId:t,settings:we,className:ve}),i.ZP.createElement("div",{className:"header-tools"},Be&&i.ZP.createElement(Ta,{key:(0,v.Tp)(Pe),message:Pe,className:Ze}),i.ZP.createElement(Xn.Z,{chatId:t,threadId:n,messageListType:s,isMobile:d,canExpandActions:!Be})))})));function La(e){return"albumId"in e}function Ua(e,t){let n,a=[],s={originalDate:e[0].date,datetime:(0,re._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,re._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 ja=n(30386),Fa=n(87675),Oa=n(81740),_a=n(70971),Da=n(88957);var qa=n(60998);var $a=n(72645),Ha=n(78722),Ga=n(3657),Va=n(93862),Wa=n(11309);const za=s.wZ?1e3:350;var Ya=n(71790);const Ja=20*E.Gw,Ka=12*E.Gw,Xa=5*E.Gw;function Qa(e,t){var n;return(null!==(n=e?.length)&&void 0!==n?n:0)>40||t?Ja:Ka}function es(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=Qa((0,v.UD)(e));let m=1;d<u&&u-d<12&&(m=u/d),l*m<Xa&&Xa-l*m<12&&(m=Xa/l);const h=Math.round(d*m),g=Math.round(l*m);return{width:h,height:g,isSmall:h<u||g<Xa}}function ts(e,t){return e.reduce(((e,t)=>e+t),t)}function ns(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 as(e,t,n,a,s){const o=function(e,t){return e.map((e=>{const n=es(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,$n.uZ)(e,1,2.75):(0,$n.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=ts(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=ts(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:ns(u)}}var ss=n(55254),os=n(44139);function is(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,Oa.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 rs=n(3858),cs=n(3927);const ds=3*E.Gw,ls=Number(E.Gw),us="data-is-document-group-hover";function ms(e,t,n,o,r,d,l,u,m,h,g,p,f){const{setReplyingToId:I,sendDefaultReaction:v}=(0,a.Sv)(),[w,b,Z]=(0,kt.Z)(),[P,y,C]=(0,kt.Z)(),E=(0,i.sO)(),S=(0,cs.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)<ds,u=Math.abs(d-a)<ls;l&&u?b():Z()}),[g],c.i$);return(0,i.d4)((()=>{if(!s.$b||o||!r||h||!f())return;let e;return(0,fn.sf)(t.current,{selectorToPreventScroll:".MessageList",excludedClosestSelector:".no-word-wrap",onSwipe:(t,n)=>n===fn.eM.Left&&(e||(e=Date.now()),y(),!0),onRelease:()=>{e&&r&&(I({messageId:n}),setTimeout(C,Math.max(0,150-(Date.now()-e))),e=void 0)}})}),[t,o,n,I,y,C,r,h,f]),{handleMouseDown:o?void 0:function(e){(0,ja.q)(e),u(e)},handleClick:function(t){if(o)e(t);else if(s.$b)return E.current?(clearInterval(E.current),E.current=void 0,void v({chatId:m,messageId:n})):void(E.current=setTimeout((()=>{E.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?rs.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&&I({messageId:n})},handleContentDoubleClick:s.$b?void 0:function(e){e.stopPropagation()},handleMouseMove:S,handleSendQuickReaction:function(e){e.stopPropagation(),v({chatId:m,messageId:n})},handleMouseLeave:function(e){(0,c.i$)(Z),p&&function(e){const t=gs(e.currentTarget);t&&t.removeAttribute(us)}(e)},isSwiped:P,isQuickReactionVisible:w,handleDocumentGroupMouseEnter:hs}}function hs(e){const t=gs(e.currentTarget);t&&t.setAttribute(us,"")}function gs(e){let t=e;do{t=t.nextElementSibling}while(t&&!t.classList.contains("last-in-document-group"));return t}const ps=new Map;function fs(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=ps.get(n)||new Map,o=s.get(e)||[];o.includes(t)||(o.push(t),s.set(e,o),ps.set(n,s),(0,a.Sv)().markMessagesTranslationPending({chatId:e,messageIds:o,toLanguageCode:n})),Is()}(t,n,s)}),[t,c,r,n,s]),t&&n?{isPending:r,translatedText:c}:{isPending:!1,translatedText:void 0}}const Is=(0,I.P2)((function(){const{translateMessages:e}=(0,a.Sv)();let t=!1;ps.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=ps.get(n);if(!a?.size)return void ps.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||ps.delete(n));a.set(e,o)}(s,o,a)}))})),t&&Is()}),500);var vs=n(74095),ws=n(46586);let bs;const Zs=new ws.Z;let Ps,ys;function Cs(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,vs.K)(new Worker(new URL(n.p+n.u(4923),n.b))),Zs.resolve())}),4e3),Ps=Symbol.toStringTag,ys=Symbol.iterator;class Es{constructor(e){this.limit=e,Cs(this,"map",void 0),Cs(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[Ps](){return this.map[Symbol.toStringTag]}[ys](){return this.map[Symbol.iterator]()}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}}const Ss=new Map;const Ms=(0,I.P2)((function(e){const{updateChatDetectedLanguage:t}=(0,a.Sv)(),n=Ss.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 Rs=n(70172),ks=n(18005);const Ts=e=>{const{isOpen:t}=e,n=(0,Tt.Z)(gt.gl.Extra,"ContextMenuContainer",!t);return n?i.ZP.createElement(n,e):void 0};var As=n(45601),Ns=n(66735);const xs=(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,_t.Z)(),[l,h]=(0,i.eJ)(),[g,p,f]=(0,kt.Z)(!1),I=(0,rn.Z)((0,v.Ti)(t,"full")),w=t.content.action.photo?.isVideo,b=(0,pt.Z)((()=>{r({title:d("ApplyAvatarHintTitle"),message:d("ApplyAvatarHint"),action:{action:"requestNextSettingsScreen",payload:{screen:m.MT.Main}},actionText:d("Open")})})),Z=(0,pt.Z)((e=>{h(void 0),o({file:e}),b()})),P=(0,pt.Z)((()=>{h(void 0)})),y=(0,pt.Z)((async()=>{f(),b();const e=t.content.action.photo,n=await xe.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(Rs.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(Ns.Z,{file:l,onClose:P,onChange:Z}),i.ZP.createElement(aa.Z,{isOpen:g,title:d("SuggestedVideo"),confirmHandler:y,onClose:f,textParts:n()}))})),Bs=(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,_t.Z)(),k=(0,i.sO)(null);(0,Ga._N)(k,P),(0,Wn.Z)(t.chatId,t.replyToMessageId,u),is(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,kt.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,Ga.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,Ct.Z)(A,void 0,T,!1),F=(0,a.Rd)().users.byId,O=(0,i.Ye)((()=>l?l.map((e=>F?.[e])).filter(Boolean):void 0),[l,F]),_=(0,i.I4)((()=>(0,ks.D)(R,t,c,d,O,u,m,w,{isEmbedded:n},y,C)),[n,R,t,y,C,d,c,m,u,O,w]),{isContextMenuOpen:D,contextMenuPosition:q,handleBeforeContextMenu:$,handleContextMenu:H,handleContextMenuClose:G,handleContextMenuHide:V}=(0,Sa.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,ut.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,ja.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(As.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(xs,{message:t,renderContent:_}),q&&i.ZP.createElement(Ts,{isOpen:D,anchor:q,message:t,messageListType:"thread",onClose:G,onCloseAnimationEnd:V}))}))),Ls=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,Ga.Op)(p,m),I=(0,rn.Z)(n&&(0,v.Ti)(n,"pictogram"),!f),w=(0,ea.Z)(n),b=Boolean(n&&(0,v.Y5)(n)),Z=Boolean(n&&(0,v.NE)(n)),P=n&&(0,v.cT)(n),{translatedText:y}=fs(l,n?.chatId,P?n?.id:void 0,u),C=(0,_t.Z)(),S=a?(0,v.OU)(C,a):n?.forwardInfo?.hiddenUserName,{handleClick:M,handleMouseDown:R}=(0,Vn.m)(g);return i.ZP.createElement("div",{ref:p,className:(0,ut.Z)("EmbeddedMessage",t,a&&!c&&`color-${(0,v.Rs)(a)}`),onClick:n&&M,onMouseDown:n&&R},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,ut.Z)("embedded-thumb",n&&"round")},!s&&i.ZP.createElement("img",{src:c,width:o,height:r,alt:"",className:"pictogram",draggable:!1}),i.ZP.createElement(ca.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(Bs,{message:n,isEmbedded:!0,observeIntersectionForLoading:m,observeIntersectionForPlaying:h}):i.ZP.createElement(ra.Z,{lang:C,message:n,noEmoji:Boolean(w),translatedText:y,observeIntersectionForLoading:m,observeIntersectionForPlaying:h}):o||" "),i.ZP.createElement("div",{className:"message-title",dir:"auto"},(0,Qn.Z)(S||s||" "))),d&&i.ZP.createElement("i",{className:"embedded-more icon icon-more"}))};var Us=n(82535),js=n(54752),Fs=n(8018);const Os=(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,_t.Z)(),[I,v]=(0,kt.Z)();function w(e){e.stopPropagation(),p({message:f("ImportedInfo")})}const b=(0,i.Ye)((()=>{if(!I)return;const e=(0,re.SA)(1e3*t.date,f.code,void 0,f.timeFormat),n=t.isEdited&&(0,re.SA)(1e3*t.editDate,f.code,void 0,f.timeFormat),a=t.forwardInfo&&(0,re.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,ut.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,Nt.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(da.Z,{text:(0,Nt.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,Qn.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,re.SA)(1e3*t.forwardInfo.date,f.code,!0)),i.ZP.createElement("span",{className:"message-imported",onClick:w},f("ImportedMessage"))),t.isEdited&&`${f("EditedMessage")} `,(0,re.mr)(f,1e3*t.date)),n&&i.ZP.createElement(Fs.Z,{status:n}),c&&c())}));var _s=n(36765),Ds=n(97799);const qs=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,_t.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,Ga.Op)(I,n),S=(0,Ga.Op)(I,o),M=`sticker${w.id}?size=f`,R=(0,rn.Z)(M,!C||!P,u.IU.BlobUrl),[k,T,A]=(0,kt.Z)(),N=(0,pt.Z)((()=>{A(),m?.()})),x=(0,qn.Z)(c);(0,i.d4)((()=>{P&&d&&S&&(c||x)&&(T(),l?.())}),[P,S,l,c,x,T,d]);const L=(0,pt.Z)((()=>{g({stickerSetInfo:w.stickerSetInfo})})),U=(0,pt.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:F,height:O}=(0,E.Wr)(w,f),_=(0,ut.Z)("Sticker media-inner",j&&"inactive",P&&!t.isOutgoing&&"reversed");return i.ZP.createElement("div",{ref:I,className:_,style:`width: ${F}px; height: ${O}px;`,onClick:j?void 0:U},i.ZP.createElement(_s.Z,{containerRef:I,sticker:w,fullMediaHash:y,fullMediaClassName:"full-media",size:F,shouldLoop:r,noLoad:!C,noPlay:!S,withSharedAnimation:!0}),P&&d&&C&&k&&i.ZP.createElement(Ds.Z,{key:M,className:"effect-sticker",tgsUrl:R,size:1.49*F,play:!0,isLowPriority:!0,noLoop:!0,onEnded:N}))};var $s=n(74753);const Hs=7*E.Gw;function Gs(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,rn.Z)(n?`document${n}`:void 0,!n),f=d||Hs,I=(0,jn.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,pt.Z)((()=>{h.current&&(u({chatId:e,messageId:t,emoji:c,interactions:v.current}),w.current=void 0,v.current=void 0)})),Z=(0,pt.Z)((()=>{const e=g.current;p&&(e&&(e.pause(),e.remove()),g.current=new Audio,g.current.src=p,(0,$s.Z)(g.current),g.current.addEventListener("ended",(()=>{g.current=void 0}),{once:!0}))})),P=(0,pt.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 Vs=(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}=Gs(o,s,l,r,t,d?.emoji),p=(0,Ga.Op)(u,n);return i.ZP.createElement(As.Z,{sticker:c,size:m,quality:1,noLoad:!p,forcePreview:a,play:p,forceOnHeavyAnimation:!0,ref:u,className:(0,ut.Z)("AnimatedEmoji media-inner",c?.id===E.wB&&"like-sticker-thumb"),style:h,onClick:g})}))),Ws=(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}=Gs(s,a,d,o,t,c?.emoji,(0,os.qo)(1));return i.ZP.createElement(sn.Z,{ref:m,documentId:n,className:(0,ut.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})}))),zs={dark:{outgoing:"rgb(135,116,225)",incoming:"rgb(33,33,33)"},light:{outgoing:"rgb(238,255,222)",incoming:"rgb(255,255,255)"}};function Ys(e,t,n,a){return n?Promise.resolve(zs[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 Js=n(6701),Ks=n(15866);function Xs(e,t,n){const{isMobile:a}=(0,B.ZP)(),o=n||(0,v.DH)(e);return(0,Ks.Z)(o,Boolean(t),a&&!s.vX)}var Qs=n(70692),eo=n(39196);const to=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,Ga.Op)(C,a),{isMobile:R}=(0,B.ZP)(),[k,T]=(0,i.eJ)(r),A=k&&M,{mediaData:N,loadProgress:x}=(0,Js.Z)((0,v.Ti)(n,h),!A),L=S||N,U=Boolean(m),[j]=(0,i.eJ)(!L),F=Boolean(L),O=Xs(n,F),_=Xs(n,!U),D=(0,Qs.Z)(!F),q=(0,v.DH)(n),[$,,H]=(0,kt.Z)(E.isSpoiler),{loadProgress:G}=(0,Js.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,qn.Z)(k),{shouldRender:J,transitionClassNames:K}=(0,Ct.Z)(W,void 0,Y,"slow"),{shouldRender:X,transitionClassNames:Q}=(0,Ct.Z)(!L&&!k),ee=(0,pt.Z)((()=>{V?y?.(n):L?$?H():P?.(n.id):T((e=>!e))})),te=(0,v.B4)(n);(0,$a.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?Ys(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||es(n,p,s,R),oe=(0,ut.Z)("media-inner",!V&&!f&&"interactive",se&&"small-image",ne===ae&&"square-image",ae<Xa&&"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,ut.Z)("full-media",U&&"with-blurred-bg"),alt:"",style:m?`width: ${m}px`:void 0,draggable:!b}),j&&i.ZP.createElement("canvas",{ref:O,className:(0,ut.Z)("thumbnail",D)}),b&&i.ZP.createElement("span",{className:"protector"}),J&&!X&&i.ZP.createElement("div",{className:`media-loading ${K}`},i.ZP.createElement(eo.Z,{progress:z,onClick:V?ee:void 0})),X&&i.ZP.createElement("i",{className:(0,ut.Z)("icon","icon-download",Q)}),i.ZP.createElement(ca.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 no=n(57080);const ao=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,kt.Z)(Z.isSpoiler),S=(0,Ga.Op)(w,s),M=(0,Ga.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&&xe.UV(U))),{mediaData:F,loadProgress:O}=(0,Js.Z)(U,!N,(0,v.kG)(n,"inline")),_=P||F,[D,q]=(0,kt.Z)(),$=(0,v.DH)(n),H=Boolean($),G=Boolean(u),V=(0,v.Ti)(n,"preview"),[W]=(0,i.eJ)(Boolean(V&&xe.UV(V))),z=S,Y=(0,rn.Z)(V,!z),J=(0,Qs.Z)((H||Y)&&!D),K=!H||Y||D,X=Xs(n,K),Q=Xs(n,!G),ee=(0,Qs.Z)(!K),te=_&&R.current,{loadProgress:ne}=(0,Js.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:O),N&&!D&&!j||g),ie=!1===(0,qn.Z)(T),{shouldRender:ce,transitionClassNames:de}=(0,Ct.Z)(se,void 0,ie),{transitionClassNames:le}=(0,Ct.Z)(Boolean((T||_)&&!x&&!ce)),[ue,me]=(0,i.eJ)(0),he=(0,pt.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,pt.Z)((()=>{ae?I?.(n):g?(0,a.Sv)().cancelMessageMediaDownload({message:n}):_?(_&&!x&&L(!0),y?C():f?.(n.id)):A((e=>!e))})),be=(0,ut.Z)("media-inner dark",!ae&&"interactive",ve<Xa&&"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(no.Z,{ref:b,src:_,className:(0,ut.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,ut.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,ut.Z)("thumbnail",ee)}),p&&i.ZP.createElement("span",{className:"protector"}),i.ZP.createElement("i",{className:(0,ut.Z)("icon","icon-large-play",le)}),i.ZP.createElement(ca.Z,{isVisible:y,withAnimation:!0,thumbDataUri:$,width:Ie,height:ve,className:"media-spoiler"}),ce&&i.ZP.createElement("div",{className:(0,ut.Z)("media-loading",de)},i.ZP.createElement(eo.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,re.k9)(Math.max(ge-ue,0))))};var so=n(6272);const oo=(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,pt.Z)((()=>{o({id:l})}));return i.ZP.createElement("div",{className:(0,ut.Z)("Contact",u&&"interactive"),onClick:u?m:void 0},i.ZP.createElement(Rs.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,so.WZ)(s,d))))}));var io=n(20230),ro=n(51218),co=n(14434),lo=n(96937);function uo(e,t){return t>0?(e/t*100).toFixed():0}const mo=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?uo(c.votersCount,a||0):0,[m,h]=(0,i.eJ)(r?0:u),g=c?uo(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,ut.Z)("poll-option-chosen",!d&&"wrong",r&&"animate")},i.ZP.createElement("i",{className:(0,ut.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,Qn.Z)(t.text)),i.ZP.createElement("div",{className:(0,ut.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}))))},ho=12*Math.PI;function go(e){e.stopPropagation()}const po=(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,pe.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*ho;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,pt.Z)((e=>{I([e]),p(!0),Z(!0),o([e])})),j=(0,pt.Z)((e=>{I(e)})),F=(0,pt.Z)((()=>{p(!0),Z(!0),o(f)})),O=(0,pt.Z)((()=>{c({chatId:u,messageId:l})})),_=(0,pt.Z)((()=>{w(!0)})),D=(0,pt.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,_t.Z)();return i.ZP.createElement("div",{className:"Poll",dir:q.isRtl?"auto":"ltr"},v&&n.results.solution&&i.ZP.createElement(lo.Z,{message:(0,io.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,Qn.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(Rs.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,re.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":ho,"stroke-dashoffset":"0"}))),m.quiz&&n.results.solution&&!k&&i.ZP.createElement(Jt.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:go},A?i.ZP.createElement(ro.Z,{options:B,onChange:j,disabled:t.isScheduled||g,loadingOptions:g?f:void 0,round:!0}):i.ZP.createElement(co.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(mo,{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(Jt.Z,{isText:!0,disabled:0===f.length,size:"tiny",onClick:F},q("PollSubmitVotes")),T&&i.ZP.createElement(Jt.Z,{isText:!0,size:"tiny",onClick:O},q("PollViewResults")))})));var fo=n(48035),Io=n(10088);const vo=(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,_t.Z)(),b=(0,pt.Z)((()=>{h()})),Z=(0,pt.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,fo.Z)(S,170),N=Boolean(A||E||P);let x=!1;if(N&&f?.photo&&!f.video){const{width:e,height:n}=es(t,void 0,void 0,I);x=e===n}const L=(M||R)&&h&&!x,U=(0,ut.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(to,{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(Io.Z,{className:"site-name",url:y,text:P||C}),!c&&E&&i.ZP.createElement("p",{className:"site-title"},(0,Qn.Z)(E)),A&&i.ZP.createElement("p",{className:"site-description"},(0,Qn.Z)(A,["emoji","br"]))),!c&&R&&i.ZP.createElement(ao,{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(Jt.Z,{className:"WebPage--quick-button",size:"tiny",color:"translucent-bordered",onClick:Z},w(j))));var j}));var wo=n(17921);const bo=(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,_t.Z)(),u=(0,v.eO)(t),{title:m,text:h,amount:g,currency:p,isTest:f,photo:I}=u,w=(0,rn.Z)((0,v.O9)(I)),b=Boolean(c),Z=Xs(t,!b,w);(0,$a.Z)((e=>{let[t]=e;if(n){if(w){const e=d.current.closest(o.be_);Ys(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,jn.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,Qn.Z)(m)),h&&i.ZP.createElement("div",null,(0,Qn.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(wo.Z,{width:P,height:I.dimensions?.height,forceAspectRatio:!0})),i.ZP.createElement("p",{className:"description-text"},(0,lt.x)(g,p,l.code),f&&i.ZP.createElement("span",null,l("PaymentTestInvoice")))))})),Zo={root:"rwnm0xOh31c2MY4kK2No",duration:"lKSp02aI8WDGX3393nkh",buy:"gxQfWp0jp0_2Z4qWiXKN",spoiler:"z2tB5Vd_jKJ9IYX4Nijd"},Po=(0,i.X$)((e=>{let{message:t,isConnected:n}=e;const{openInvoice:s,loadExtendedMedia:o}=(0,a.Sv)(),r=(0,_t.Z)(),c=(0,v.eO)(t),{chatId:d,id:l}=t,u=(0,pt.Z)((()=>{o({chatId:d,ids:[l]})}));(0,St.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,pt.Z)((()=>{s({chatId:d,messageId:l,isExtendedMedia:!0})}));return i.ZP.createElement("div",{className:(0,ut.Z)(Zo.root,"media-inner"),onClick:b},i.ZP.createElement(ca.Z,{thumbDataUri:I?.dataUri,width:p,height:f,isVisible:!0,className:Zo.spoiler}),Boolean(w)&&i.ZP.createElement("div",{className:Zo.duration},(0,re.k9)(w)),i.ZP.createElement("div",{className:Zo.buy},i.ZP.createElement("i",{className:(0,ut.Z)("icon","icon-lock",Zo.lock)}),r("Checkout.PayPrice",(0,lt.x)(m,h))))})),yo=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"})),Co=["#e56cd5","#f89440","#9986ff","#44b3f5","#6dc139","#ff5d5a","#f87aad","#6e82b3","#f5ba21"],Eo=n.p+"map-pin.899635f6fe777c28998a.svg",So=24*Math.PI,Mo=1e-4,Ro={width:400,height:300,zoom:16,scale:2};function ko(){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 To=(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,_t.Z)(),l=(0,yt.Z)(),u=(0,v.nf)(t),{type:m,geo:h}=u,g=(0,pe.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}=Ro,E=(0,v.k6)(I,Z,P,y,C),S=(0,rn.Z)(E),M=(0,qn.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,pt.Z)((e=>{if("geoLive"!==m)return;const n=e.lastElementChild,a=e.firstElementChild,s=t.date+u.period-(0,pe.bp)(),o=(1-s/u.period)*So,i=(0,re.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)<Mo&&Math.abs(h.long-I.long)<Mo?I.accuracyRadius!==h.accuracyRadius&&w({...I,accuracyRadius:h.accuracyRadius}):w(h)}),[h,I]),(0,Rt.Z)((()=>{l()}),p?void 0:1e3*(f||0)),(0,St.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: ${Ro.width}px; height: ${Ro.height}px;`}):i.ZP.createElement(wo.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,ut.Z)("pin",m,p&&"expired");if("geoLive"===m)return i.ZP.createElement("div",{className:e},i.ZP.createElement(ko,null),i.ZP.createElement(Rs.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?yo.get(e)||yo.get(e.split("/")[0])||Co[(t=e,t.split("").reduce(((e,t)=>(e<<5)-e+t.charCodeAt(0)|0),0)%Co.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(ko,null),i.ZP.createElement("img",{src:n,className:"venue-icon",alt:""}))}return i.ZP.createElement("img",{className:e,src:Eo,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,re.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":So,"stroke-dashoffset":"0"})))):void 0}())})),Ao=(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,rn.Z)(d,!n),m=(0,rn.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(wo.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 No(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,pt.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,ut.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 xo=No(to),Bo=No(ao),Lo=(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,pt.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(xo,{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(Bo,{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})})))})),Uo=E.Rj/2,jo=2*(Uo-6)*Math.PI;let Fo;const Oo=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,Ga.Op)(r,n),[h,g]=(0,i.eJ)(s),p=Boolean(h&&m),{mediaData:f,loadProgress:I}=(0,Js.Z)((0,v.Ti)(t,"inline"),!p,(0,v.kG)(t,"inline")),{loadProgress:w}=(0,Js.Z)((0,v.Ti)(t,"download"),!o,u.IU.BlobUrl),[b,Z]=(0,kt.Z)(),P=!Boolean((0,v.DH)(t))||b,y=Xs(t,P),C=(0,Qs.Z)(!P),S=h&&!b||o,M=!1===(0,qn.Z)(h),{shouldRender:R,transitionClassNames:k}=(0,Ct.Z)(S,void 0,M),[T,A]=(0,i.eJ)(!1),[N,x]=(0,Gn.Z)(0),B=(0,Wa.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=jo-B()*jo;d.current.setAttribute("stroke-dashoffset",e.toString())}),[T,B]);const L=Boolean(f&&m),U=(0,pt.Z)((()=>{c.current&&(A(!1),x(0),(0,$s.Z)(c.current))})),j=(0,pt.Z)((()=>{Fo?.(),Fo=U})),F=(0,pt.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,$s.Z)(e),(0,ga.Es)()):e.pause():(j(),e.pause(),e.currentTime=0,(0,$s.Z)(e),(0,ga.Es)(),A(!0))})),O=(0,pt.Z)((e=>{const t=e.currentTarget;x(t.currentTime/t.duration)}));return i.ZP.createElement("div",{ref:r,className:"RoundVideo media-inner",onClick:F},f&&i.ZP.createElement("div",{className:"video-wrapper"},i.ZP.createElement(no.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?O:void 0,onReady:Z})),i.ZP.createElement("canvas",{ref:y,className:(0,ut.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:Uo,cy:Uo,r:Uo-6,className:"progress-circle",transform:`rotate(-90, ${Uo}, ${Uo})`,"stroke-dasharray":jo,"stroke-dashoffset":jo}))),R&&i.ZP.createElement("div",{className:`media-loading ${k}`},i.ZP.createElement(eo.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,re.k9)(c.current.currentTime):(0,re.k9)(l.duration),(!T||c.current.paused)&&i.ZP.createElement("i",{className:"icon icon-muted"})))},_o=e=>{let{message:t,onClick:n}=e;const a=(0,_t.Z)();return i.ZP.createElement("div",{className:"InlineButtons"},t.inlineButtons.map((e=>i.ZP.createElement("div",{className:"row"},e.map((e=>i.ZP.createElement(Jt.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,Qn.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))))))))},Do=(0,i.X$)((e=>{let{threadInfo:t,disabled:n}=e;const{openComments:s}=(0,a.Sv)(),o=(0,_t.Z)(),{threadId:r,chatId:c,messagesCount:d,lastMessageId:l,lastReadInboxMessageId:u,recentReplierIds:m,originChannelId:h}=t,g=(0,pt.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(da.Z,{text:(0,Nt.bi)(d)}):e)):void 0;return i.ZP.createElement("div",{"data-cnt":(0,Nt.bi)(d),className:(0,ut.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(Rs.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 qo=n(65351),$o=n(60422),Ho=n(48198);const Go={root:"JY0NZH9bysPBqR3sIbLu","animated-icon":"WTrBqa2uxq57nYJAIelk",animatedIcon:"WTrBqa2uxq57nYJAIelk",effect:"z9v8vlAIGxI3ITxuyEG1",animating:"sB0FGOzwkiDvNWHWcVEL"},Vo=2.5*E.Gw,Wo=6.5*E.Gw,zo=(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,$o.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,Ga.Op)(l,r),w=h&&`sticker${h}`,b=f&&`sticker${f}`,Z=(0,rn.Z)(w,!h),P=(0,rn.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,Ct.Z)(C,void 0,!0,"slow"),M=(0,pt.Z)((()=>{y?.messageId&&d({messageId:y.messageId,reaction:t})})),[R,k,T]=(0,kt.Z)(),A=!(u||C&&R),N=(0,ut.Z)(Go.root,E&&Go.animating,u&&Go.isCustomEmoji);return i.ZP.createElement("div",{className:N,ref:l},A&&i.ZP.createElement(Ho.Z,{reaction:t,availableReactions:o}),u&&i.ZP.createElement(sn.Z,{documentId:t.documentId,className:Go.customEmoji,observeIntersectionForPlaying:r}),E&&i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement(Ds.Z,{key:f,className:(0,ut.Z)(Go.effect,S),size:Wo,tgsUrl:P,play:I,noLoop:!0,forceOnHeavyAnimation:!0,onEnded:M}),u?!p&&I&&i.ZP.createElement(dn,{reaction:t}):i.ZP.createElement(Ds.Z,{key:h,className:(0,ut.Z)(Go.animatedIcon,S),size:Vo,tgsUrl:Z,play:I,noLoop:!0,forceOnHeavyAnimation:!0,onLoad:k,onEnded:T})))})),Yo=(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,pt.Z)((()=>{u({reaction:t.reaction,chatId:n.chatId,messageId:n.id})}));return i.ZP.createElement(Jt.Z,{className:(0,ut.Z)((0,v.Bt)(t)&&"chosen"),size:"tiny",onClick:g},i.ZP.createElement(zo,{activeReactions:s,reaction:t.reaction,availableReactions:o,genericEffects:d,observeIntersection:l,withEffects:c}),h?.length?i.ZP.createElement(qo.Z,{size:"mini",peers:h}):i.ZP.createElement(da.Z,{text:(0,Nt.bi)(t.count),className:"counter"}))})),Jo=(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,_t.Z)(),h=(0,i.Ye)((()=>t.reactions.results.reduce(((e,t)=>e+t.count),0)),[t]);return i.ZP.createElement("div",{className:(0,ut.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(Yo,{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)})),Ko=(0,i.X$)((e=>{let{phoneCall:t,message:n,chatId:o}=e;const{requestMasterAndRequestCall:r}=(0,a.Sv)(),c=(0,_t.Z)(),{isOutgoing:d,isVideo:l,reason:u,duration:m}=t,h="missed"===u,g="busy"===u||void 0===m,p=(0,pt.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,re.J_)(c,t.duration):void 0),[c,t.duration]),v=(0,re.mr)(c,1e3*n.date);return i.ZP.createElement("div",{className:"vDeypQzM845_JE14qGId"},i.ZP.createElement(Jt.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,ut.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,ut.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 Xo=n(78780),Qo=n(50685),ei=n(14612),ti=n(98138),ni=n(2995);var ai=n(69123);const si=1.125*E.Gw,oi=(0,i.X$)((e=>{let{topic:t,className:n,onClick:a}=e;const s=(0,_t.Z)();return i.ZP.createElement("div",{className:(0,ut.Z)("wUl1jHjVuMxmGhsdl358",n),style:`--topic-button-accent-color: var(${(0,ti.gZ)(t?.iconColor)})`,onClick:a},t?i.ZP.createElement(ni.Z,{topic:t,size:si}):i.ZP.createElement("img",{src:ai,alt:""}),t?.title?(0,Qn.Z)(t.title):s("Loading"),t?.isClosed&&i.ZP.createElement("i",{className:"icon icon-lock"}),i.ZP.createElement("i",{className:"icon icon-next"}))})),ii=1.75*E.Gw,ri=2.25*E.Gw;function ci(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 di=(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),F=l||m||j,O=(0,f.Ur)(e,c),_=(0,f.cv)(e,c),D=Z?(0,f.dy)(e,Z):void 0,q=O?.id&&x?L?.adminMembersById?.[O?.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:F,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,...(F||ge)&&{sender:O},...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:F,shouldHideReply:O,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:Fe,onPinnedIntersectionChange:Oe,getIsMessageListReady:_e}=e;const{toggleMessageSelection:De,clickBotInlineButton:qe,disableContextMenuHint:$e,animateUnreadReaction:He,focusLastMessage:Ge}=(0,a.Sv)(),Ve=(0,i.sO)(null),We=(0,i.sO)(null),ze=(0,i.sO)(null),Ye=(0,i.sO)(0),Je=(0,_t.Z)(),[Ke,Xe]=(0,i.eJ)(!1),[Qe,et,tt]=(0,kt.Z)(),{isMobile:nt,isTouchScreen:at}=(0,B.ZP)();(0,Ga._N)(We,r);const{isContextMenuOpen:st,contextMenuPosition:ot,contextMenuTarget:it,handleBeforeContextMenu:rt,handleContextMenu:ct,handleContextMenuClose:dt,handleContextMenuHide:lt}=(0,Sa.Z)(Ve,at&&ce,!o.D$V,s.wZ,_e);(0,i.d4)((()=>{st&&$e()}),[st,$e]);const mt=b<=0,[ht,gt]=(0,kt.Z)(mt);(0,i.d4)((()=>{mt||setTimeout(gt,10*b)}),[b,gt,mt]);const{transitionClassNames:ft}=(0,Ct.Z)(ht||Z,void 0,mt&&!Z,!1),{id:It,chatId:vt,forwardInfo:wt,viaBotId:bt,isTranscriptionError:Zt}=t;(0,i.d4)((()=>{if(!we)return;const e=h?h.mainMessage.id:It;return()=>{Oe({viewportPinnedIdsToRemove:[e],isUnmount:!0})}}),[h,we,It,Oe]);const Pt=(0,v.CI)(t),yt=(0,v.B4)(t),St="scheduled"===Ie||t.isScheduled,Mt=(0,v.ss)(t)&&!O,Rt=Boolean(Ee)&&"thread"===Ie,Tt=(0,v.$D)(t),At=Tt&&(se||oe),Nt=me?.reactions&&!(0,v.JE)(me.reactions),xt=wt&&(!X||St)&&!Q&&!wt.isLinkedChannelPost&&!Tt,Bt=Boolean(h)&&h.messages.length>1&&!h?.messages.some((e=>0===Object.keys(e.content).length)),Lt=H&&!S,Ut=H&&!M,jt=void 0!==ot,Ft=!(jt||ce||K||Ut),Ot=ee&&!St&&t.isForwardingAllowed&&!V,Dt=Boolean(ve||wt&&(wt.isChannelPost||X&&!yt||Q)&&wt.fromMessageId),qt=Te||Mt,$t=(0,pt.Z)(((e,t)=>{De({messageId:It,groupedId:t,...e?.shiftKey&&{withShift:!0},...Bt&&{childMessageIds:h.messages.map((e=>{let{id:t}=e;return t}))}})})),Ht=L?x:void 0,Gt=Boolean(!Ke&&(Zt||k)),Vt=wt&&(X||Q||!Ht)?U:Ht,Wt=wt?U:Ht,{handleMouseDown:zt,handleClick:Yt,handleContextMenu:Kt,handleDoubleClick:Xt,handleContentDoubleClick:Qt,handleMouseMove:en,handleSendQuickReaction:tn,handleMouseLeave:nn,isSwiped:an,isQuickReactionVisible:rn,handleDocumentGroupMouseEnter:cn}=ms($t,Ve,It,Boolean(ce),Boolean(ne),Boolean(G),ct,rt,vt,jt,ze,Ut,_e),{handleAvatarClick:dn,handleSenderClick:ln,handleViaBotClick:un,handleReplyClick:mn,handleMediaClick:hn,handleAudioPlay:gn,handleAlbumMediaClick:pn,handleMetaClick:fn,handleTranslationClick:In,handleOpenThread:vn,handleReadMedia:wn,handleCancelUpload:bn,handleVoteSend:Zn,handleGroupForward:Pn,handleForward:yn,handleFocus:Cn,handleFocusForwarded:En,handleDocumentGroupSelectAll:Sn,handleTopicChipClick:Mn}=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,pt.Z)((()=>{h&&v({id:h.id})})),U=(0,pt.Z)((()=>{g?r&&T?.channelPostId?b({chatId:g.id,messageId:T.channelPostId}):v({id:g.id}):w({message:e("HidAccount")})})),j=(0,pt.Z)((()=>{p&&v({id:p.id})})),F=(0,pt.Z)((()=>{b({chatId:d&&N?N:s,threadId:o,messageId:A,replyMessageId:d&&N?void 0:k,noForumTopicPanel:!0})})),O=(0,pt.Z)((()=>{Z({chatId:s,threadId:o,mediaId:k,origin:c?m.bZ.ScheduledInline:m.bZ.Inline})})),_=(0,pt.Z)((()=>{P({chatId:s,messageId:k})})),D=(0,pt.Z)((e=>{Z({chatId:s,threadId:o,mediaId:e,origin:c?m.bZ.ScheduledAlbum:m.bZ.Album})})),q=(0,pt.Z)((()=>{y({messageIds:[k]})})),$=(0,pt.Z)((()=>{C({chatId:s,messageId:k})})),H=(0,pt.Z)((e=>{E({chatId:s,messageId:k,options:e})})),G=(0,pt.Z)((()=>{S({fromChatId:s,groupedId:B})})),V=(0,pt.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,pt.Z)((()=>{b({chatId:s,threadId:u._f,messageId:k})})),z=(0,pt.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,pt.Z)((e=>{e.stopPropagation(),t(e,B)}));return{handleAvatarClick:L,handleSenderClick:U,handleViaBotClick:j,handleReplyClick:F,handleMediaClick:O,handleAudioPlay:_,handleAlbumMediaClick:D,handleMetaClick:Y,handleTranslationClick:(0,pt.Z)((e=>{e.stopPropagation(),R({chatId:s,messageId:I?void 0:k})})),handleOpenThread:(0,pt.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,pt.Z)((()=>{f&&b({chatId:d&&N?N:s,threadId:f.id,messageId:k})}))}}(Je,$t,t,vt,ue,H,xt,St,Q,h,Vt,Wt,j,ke,Boolean(Le));(0,i.d4)((()=>{T&&Gt&&k&&Ge()}),[Ge,T,k,Gt]);const Rn=(0,ut.Z)("Message message-list-item allow-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",yt&&"own",Boolean(t.views)&&"has-views",t.isEdited&&"was-edited",Mt&&"has-reply",st&&"has-menu-open",W&&!Y&&"focused",K&&"is-forwarding",t.isDeleting&&"is-deleting",H&&"is-in-document-group",Bt&&"is-album",t.hasUnreadMention&&"has-unread-mention",de&&"is-selected",ce&&"is-in-selection-mode",F&&!p&&"is-thread-top",Boolean(t.inlineButtons)&&"has-inline-buttons",an&&"is-swiped",ft,Z&&"is-just-added",(Boolean(pe)||Qe)&&"has-active-reaction"),{text:kn,photo:Tn,video:An,audio:Nn,voice:xn,document:Bn,sticker:Ln,contact:Un,poll:jn,webPage:Fn,invoice:On,location:_n,action:Dn,game:$n}=(0,v.qp)(t),Hn=function(e,t,n){const[a,s]=(0,i.eJ)();return(0,i.d4)((()=>{t||n&&!n()||(e?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(s):s(void 0))}),[t,e,n]),a}(kn?.text,!(Ne||xe),_e);!function(e,t,n,a){(0,i.d4)((()=>{if(n||a&&!a())return;const s=Boolean(e.content.text?.text.length);!function(e,t,n,a){const s=Ss.get(e)||new Es(150),o=s.get(t);o&&o.detectedLanguage===a&&o.isTranslatable===n||(s.set(t,{id:t,isTranslatable:n,detectedLanguage:a}),Ss.set(e,s),Ms(e))}(e.chatId,e.id,s,t)}),[e,t,n,a])}(t,Hn,!xe,_e);const Gn=(0,v.cT)(t,!Le),{isPending:Vn,translatedText:zn}=fs(Ae,vt,Gn?It:void 0,Be),Yn=(0,qn.Z)(zn,Boolean(Gn)),Jn=zn||Yn,{phoneCall:Kn}=Dn||{},Xn=(Ee||re&&ee&&Pt)&&!Ut&&"thread"===Ie&&!I,ea=Ee&&!Ut&&"thread"===Ie&&!I,ta=!at&&!Kn&&!ce&&ge&&!Ut,na=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:qt,isCustomShape:Tt,isLastInGroup:C,asForwarded:xt,hasThread:Rt&&!I,forceSenderName:N,hasComments:Ee&&Ee.messagesCount>0,hasActionButton:Ot||Dt,hasReactions:Nt,isGeoLiveActive:"geoLive"===_n?.type&&!(0,v.$R)(t),withVoiceTranscription:Gt}),aa=na.includes("has-appendix"),sa=(0,v.fY)(t),oa=(0,os.qo)(t.emojiOnlyCount);let ia,ra;ia=Kn||Ut?"none":!sa||Fn||oa?"standalone":"in-text",Nt?Tt||(Tn||An||_n&&"geo"===_n.type)&&!sa?ra="outside":xt?(ia="standalone",ra="inside"):ra="inside":ra="none";const ca=Tt?"in-meta":"in-content";(0,Wn.Z)(Q&&t.replyToChatId?t.replyToChatId:vt,Mt?t.replyToMessageId:void 0,_,t.id),is(Ve,vt,W,z,Y,J,Z);const da=ee&&t.postAuthorTitle||!xt&&wt?.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])}(Ve,da);const la=T,ua=(0,pt.Z)((e=>{const t=Ye.current,n=e.contentRect.height;if(Ye.current=n,(0,Oa.Ni)()||!t||n<=t)return;const a=e.target.closest(".MessageList");if(!a)return;(0,Et.YW)(400);const s=n-t,{offsetHeight:o,scrollHeight:i,scrollTop:r}=a;Math.round(i-r-o)-s<=5&&Ge()})),ma=(0,cs.Z)(ua,[ua],300,!1);(0,Ha.Z)(Ve,ma,!la),(0,i.d4)((()=>{const e=We.current;Se&&e&&(0,ss.P)(e)&&He({messageIds:[It]})}),[Se,It,He]);const ha=(0,i.Ye)((()=>Bt?as(yt,Boolean(xt),Boolean(g),h,nt):void 0),[Bt,yt,xt,g,h,nt]),ga=xt?28:0,pa=(0,i.Ye)((()=>{let e,n,a,s=!1,o="";if(!Bt&&(Tn||An||On?.extendedMedia)){let a;if(Tn)a=es(t,xt,g,nt).width;else if(An)a=An.isRound?E.Rj:es(t,xt,g,nt).width;else if(On?.extendedMedia&&On.extendedMedia.width&&On.extendedMedia.height){const{width:e,height:t}=On.extendedMedia;a=(0,E.Kf)({width:e,height:t,fromOwnMessage:yt,asForwarded:xt,noAvatars:g,isMobile:nt}).width}a&&(a<Ja&&(n=a),e=Math.max(Qa(kn?.text,Xn),a),On?.extendedMedia&&e-a>18&&(s=!0))}else ha&&(e=Math.max(Qa(kn?.text,Xn),ha.containerStyle.width),e-ha.containerStyle.width>18&&(s=!0));if(e)o=`width: ${e+ga}px`,a=e+ri;else if(Ln&&!qt){const{width:e}=(0,E.Wr)(Ln,nt);o=`width: ${e+ga}px`,a=e+ri}return{contentWidth:n,noMediaCorners:s,style:o,reactionsMaxWidth:a}}),[ha,xt,ga,qt,On?.extendedMedia,Bt,Xn,nt,yt,t,g,Tn,Ln,kn?.text,An]),{contentWidth:fa,noMediaCorners:Ia,style:va,reactionsMaxWidth:wa}=pa;function ba(e){return i.ZP.createElement(ei.Z,{message:t,translatedText:Be?Jn:void 0,isForAnimation:e,emojiSize:oa,highlight:ae,isProtected:G,observeIntersectionForLoading:d,observeIntersectionForPlaying:l,withTranslucentThumbs:Tt})}const Za=(0,i.I4)((()=>{if(ge)return i.ZP.createElement("div",{className:(0,ut.Z)("quick-reaction",rn&&!pe&&"visible"),onClick:tn,ref:ze},i.ZP.createElement(Ho.Z,{reaction:ge,size:ii,availableReactions:he,observeIntersection:l}))}),[pe,he,ge,tn,rn,l]);function Pa(){const e=i.ZP.createElement(Os,{message:t,isPinned:we,noReplies:w,repliesThreadInfo:Ee,outgoingStatus:q,signature:da,withReactionOffset:"inside"===ra,renderQuickReactionButton:ta&&"in-meta"===ca?Za:void 0,availableReactions:he,isTranslated:Boolean(Be?Jn:void 0),onClick:fn,onTranslationClick:In,onOpenThread:vn});return"inside"!==ra?e:i.ZP.createElement(Jo,{activeReactions:pe,message:me,metaChildren:e,availableReactions:he,genericEffects:ie,observeIntersection:l,noRecentReactors:ee,withEffects:Ue})}const ya=te&&xt?t.postAuthorTitle:void 0,Ca=(0,i.Ye)((()=>n?.find((e=>e.isActive))),[n]);return i.ZP.createElement("div",{ref:Ve,id:(0,v.d0)(t.id),className:Rn,"data-message-id":It,onMouseDown:zt,onClick:Yt,onContextMenu:Kt,onDoubleClick:Xt,onMouseEnter:Ut?cn:void 0,onMouseMove:ta?en:void 0,onMouseLeave:ta||Ut?nn:void 0},i.ZP.createElement("div",{ref:We,className:"bottom-marker","data-message-id":It,"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,ut.Z)("message-select-control group-select",le&&"is-selected"),onClick:Sn},le&&i.ZP.createElement("i",{className:"icon icon-select"})),p&&function(){const e=!Vt&&wt?wt.hiddenUserName:void 0;return i.ZP.createElement(Rs.Z,{size:nt?"small-mobile":"small",peer:Vt,text:e,onClick:Vt?dn:void 0})}(),i.ZP.createElement("div",{className:(0,ut.Z)("message-content-wrapper",na.includes("text")&&"can-select-text")},i.ZP.createElement("div",{className:na,style:va,dir:"auto"},xt&&!Lt&&i.ZP.createElement("div",{className:"message-title"},Je("ForwardedMessage"),ya&&i.ZP.createElement("span",{className:"admin-title",dir:"auto"},ya)),function(){const e=(0,ut.Z)("content-inner",xt&&"forwarded-message",qt&&"with-subheader",Ia&&"no-media-corners"),n=C&&!sa&&!xt&&!ea,a=(0,ut.Z)("text-content","clearfix","in-text"===ia&&"with-meta",q&&"with-outgoing-icon");return i.ZP.createElement("div",{className:e,onDoubleClick:Qt,dir:"auto"},function(){if(Tt&&!bt||!(f&&(!(Tn||An||_n)||Te)||xt||bt||N)||Lt||Mt&&Tt)return;let e,n;!Wt||Tt&&bt?wt?.hiddenUserName&&(e=wt.hiddenUserName):(e=(0,v.OU)(Je,Wt),xt||yt||(n=`color-${(0,v.Rs)(Wt)}`));const a=Wt&&"emojiStatus"in Wt&&Wt.emojiStatus,s=Wt&&"isPremium"in Wt&&Wt.isPremium;return i.ZP.createElement("div",{className:"message-title",dir:"ltr"},e?i.ZP.createElement("span",{className:(0,ut.Z)("message-title-name interactive",n),onClick:ln,dir:"ltr"},(0,Qn.Z)(e),!xt&&a&&i.ZP.createElement(sn.Z,{documentId:a.documentId,loopLimit:o.y3O,observeIntersectionForLoading:d,observeIntersectionForPlaying:l}),!xt&&!a&&s&&i.ZP.createElement(on.Z,null),Wt?.fakeType&&i.ZP.createElement(Qo.Z,{fakeType:Wt.fakeType})):j?void 0:" ",j&&i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement("span",{className:"via"},Je("ViaBot")),i.ZP.createElement("span",{className:"interactive",onClick:un},(0,Qn.Z)(`@${j.usernames[0].username}`))),wt?.isLinkedChannelPost?i.ZP.createElement("span",{className:"admin-title",dir:"auto"},Je("DiscussChannel")):t.forwardInfo?.postAuthorTitle&&te&&xt?i.ZP.createElement("span",{className:"admin-title",dir:"auto"},t.forwardInfo?.postAuthorTitle):t.postAuthorTitle&&te&&!xt?i.ZP.createElement("span",{className:"admin-title",dir:"auto"},t.postAuthorTitle):!Re||xt||bt?void 0:i.ZP.createElement("span",{className:"admin-title",dir:"auto"},Re.customTitle||Je(Re.isOwner?"GroupInfo.LabelOwner":"GroupInfo.LabelAdmin")))}(),qt&&i.ZP.createElement("div",{className:"message-subheader"},Te&&i.ZP.createElement(oi,{topic:ke,onClick:Mn,className:"message-topic"}),Mt&&i.ZP.createElement(Ls,{message:_,noUserColors:yt||ee,isProtected:G,sender:D,chatTranslations:Ae,requestedChatTranslationLanguage:Le,observeIntersectionForLoading:d,observeIntersectionForPlaying:l,onClick:mn})),Ln&&i.ZP.createElement(qs,{message:t,observeIntersection:d,observeIntersectionForPlaying:l,shouldLoop:ye,shouldPlayEffect:Ln.hasEffect&&(Me.current&&It>=Me.current||Pt)||void 0,withEffect:je,onPlayEffect:et,onStopEffect:tt}),At&&oe&&i.ZP.createElement(Ws,{customEmojiId:oe,withEffects:je&&(0,v.YC)(vt),isOwn:yt,observeIntersection:d,forceLoadPreview:Pt,messageId:It,chatId:vt,activeEmojiInteractions:fe}),At&&se&&i.ZP.createElement(Vs,{emoji:se,withEffects:je&&(0,v.YC)(vt),isOwn:yt,observeIntersection:d,forceLoadPreview:Pt,messageId:It,chatId:vt,activeEmojiInteractions:fe}),Bt&&i.ZP.createElement(Lo,{album:h,albumLayout:ha,observeIntersection:d,isOwn:yt,isProtected:G,hasCustomAppendix:n,onMediaClick:pn}),Kn&&i.ZP.createElement(Ko,{message:t,phoneCall:Kn,chatId:vt}),!Bt&&Tn&&i.ZP.createElement(to,{message:t,observeIntersection:d,noAvatars:g,canAutoLoad:Ze,uploadProgress:$,shouldAffectAppendix:n,isDownloading:be,isProtected:G,asForwarded:xt,theme:A,forcedWidth:fa,onClick:hn,onCancelUpload:bn}),!Bt&&An&&An.isRound&&i.ZP.createElement(Oo,{message:t,observeIntersection:d,canAutoLoad:Ze,isDownloading:be}),!Bt&&An&&!An.isRound&&i.ZP.createElement(ao,{message:t,observeIntersectionForLoading:d,observeIntersectionForPlaying:l,forcedWidth:fa,noAvatars:g,canAutoLoad:Ze,canAutoPlay:Pe,uploadProgress:$,isDownloading:be,isProtected:G,asForwarded:xt,onClick:hn,onCancelUpload:bn}),(Nn||xn)&&i.ZP.createElement(js.ZP,{theme:A,message:t,origin:m.Cr.Inline,uploadProgress:$,isSelectable:H,isSelected:de,noAvatars:g,onPlay:gn,onReadMedia:!xn||yt&&!X?void 0:wn,onCancelUpload:bn,isDownloading:be,isTranscribing:R,isTranscriptionHidden:Ke,isTranscribed:Boolean(k),isTranscriptionError:Zt,canDownload:!G,onHideTranscription:Xe,canTranscribe:y}),Bn&&i.ZP.createElement(Us.Z,{message:t,observeIntersection:d,canAutoLoad:Ze,autoLoadFileMaxSizeMb:Ce,uploadProgress:$,isSelectable:H,isSelected:de,onMediaClick:hn,onCancelUpload:bn,isDownloading:be}),Un&&i.ZP.createElement(oo,{contact:Un}),jn&&i.ZP.createElement(po,{message:t,poll:jn,onSendVote:Zn}),$n&&i.ZP.createElement(Ao,{message:t,canAutoLoadMedia:Ze}),On?.extendedMedia&&i.ZP.createElement(Po,{message:t,isConnected:Fe}),Gt&&i.ZP.createElement("p",{className:(0,ut.Z)("transcription",!Ke&&Zt&&"transcription-error"),dir:"auto"},Zt?Je("NoWordsRecognized"):R&&k?i.ZP.createElement(Xo.Z,{content:k}):k),!At&&sa&&i.ZP.createElement("div",{className:a,dir:"auto"},ba(),Vn&&i.ZP.createElement("div",{className:"translation-animation"},i.ZP.createElement("div",{className:"text-loading"},ba(!0))),"in-text"===ia&&Pa()),Fn&&i.ZP.createElement(vo,{message:t,observeIntersection:d,noAvatars:g,canAutoLoad:Ze,canAutoPlay:Pe,asForwarded:xt,isDownloading:be,isProtected:G,theme:A,onMediaClick:hn,onCancelMediaTransfer:bn}),On&&!On.extendedMedia&&i.ZP.createElement(bo,{message:t,shouldAffectAppendix:n&&!Nt,isInSelectMode:ce,isSelected:de,theme:A,forcedWidth:fa}),_n&&i.ZP.createElement(To,{message:t,isInSelectMode:ce,isSelected:de,theme:A,peer:x}))}(),!Ut&&"standalone"===ia&&Pa(),Ft&&Ot?i.ZP.createElement(Jt.Z,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:Je("lng_context_forward_msg"),onClick:M?Pn:yn},i.ZP.createElement("i",{className:"icon icon-share-filled"})):Ft&&Dt?i.ZP.createElement(Jt.Z,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:"Focus message",onClick:ve?Cn:En},i.ZP.createElement("i",{className:"icon icon-arrow-right"})):void 0,ea&&i.ZP.createElement(Do,{threadInfo:Ee,disabled:I}),aa&&i.ZP.createElement(ci,{isOwn:yt}),ta&&"in-content"===ca&&Za()),t.inlineButtons&&i.ZP.createElement(_o,{message:t,onClick:qe}),"outside"===ra&&i.ZP.createElement(Jo,{message:me,isOutside:!0,maxWidth:wa,activeReactions:pe,availableReactions:he,genericEffects:ie,observeIntersection:l,noRecentReactors:ee,withEffects:Ue})),ot&&i.ZP.createElement(Ts,{isOpen:st,anchor:ot,targetHref:it?.matches("a[href]")?it.href:void 0,message:t,album:h,chatUsername:Ca?.username,messageListType:Ie,onClose:dt,onCloseAnimationEnd:lt,repliesThreadInfo:Ee,noReplies:w,detectedLanguage:Hn}))}))),li=e=>{const{isOpen:t}=e,n=(0,Tt.Z)(gt.gl.Extra,"AboutAdsModal",!t);return n?i.ZP.createElement(n,e):void 0},ui=e=>{const{isOpen:t}=e,n=(0,Tt.Z)(gt.gl.Extra,"SponsoredMessageContextMenuContainer",!t);return n?i.ZP.createElement(n,e):void 0},mi=(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,_t.Z)(),p=(0,i.sO)(null),f=(0,i.sO)(null),I=Boolean(n),{observe:w}=(0,Ga.S1)({rootRef:o,debounceMs:200,threshold:1}),{isContextMenuOpen:b,contextMenuPosition:Z,handleBeforeContextMenu:P,handleContextMenu:y,handleContextMenuClose:C,handleContextMenuHide:E}=(0,Sa.Z)(p,s.$b,!0,s.wZ),[S,M,R]=(0,kt.Z)(!1);(0,i.d4)((()=>I?w(f.current,(e=>{e.isIntersecting&&d({chatId:t})})):void 0),[t,I,w,d]);const k=(0,pt.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,ja.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,Qn.Z)((0,v.Js)(r)||""),c&&(0,Qn.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,io.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(Jt.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(ui,{isOpen:b,anchor:Z,message:n,onAboutAds:M,onClose:C,onCloseAnimationEnd:E}),i.ZP.createElement(li,{isOpen:S,onClose:R}))}))),hi=(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,_t.Z)(),r=(0,rn.Z)(t?.photo?(0,v.NF)(t.photo):void 0),c=(0,rn.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,ut.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(no.Z,{canPlay:!0,src:c,loop:!0,disablePictureInPicture:!0,muted:!0,playsInline:!0,style:(0,jn.Z)(Boolean(m)&&`width: ${m}px`,Boolean(h)&&`height: ${h}px`)}),d&&!r&&!c&&i.ZP.createElement(wo.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,Qn.Z)(t.description,["br","emoji","links"]))))}))),gi=(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:F}=(0,a.Sv)(),O=(0,Ya.Z)(R),{observeIntersectionForReading:_,observeIntersectionForLoading:D,observeIntersectionForPlaying:q}=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,Ga.S1)({rootRef:t,throttleMs:150},(t=>{if("thread"!==e||(0,ft.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,ft.Z)(h,g);const{observe:p}=(0,Ga.S1)({rootRef:t,throttleMs:za,margin:u}),{observe:f}=(0,Ga.S1)({rootRef:t,throttleMs:za});return{observeIntersectionForReading:m,observeIntersectionForLoading:p,observeIntersectionForPlaying:f}}(M,y,S,j,n),{withHistoryTriggers:$,backwardsTriggerRef:H,forwardsTriggerRef:G,fabTriggerRef:V}=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,pt.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,Ga.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,Ga._N)(w,C?y:void 0),(0,Ga._N)(b,C?y:void 0);const{observe:E,freeze:S,unfreeze:M}=(0,Ga.S1)({rootRef:t,margin:100,throttleScheduler:c.i$},P);(0,Ga._N)(Z,E);const{observe:R,freeze:k,unfreeze:T}=(0,Ga.S1)({rootRef:t,margin:1,throttleScheduler:c.i$},P);(0,Ga._N)(Z,R),(0,i.d4)((()=>{h&&P()}),[h,P]);const A=(0,pt.Z)((()=>{S(),k(),setTimeout((()=>{T(),M()}),350)}));(0,vt.Z)(A,[A,n]);const N=(0,Wa.Vr)(o,200);return(0,Va.b)(A,[A,N]),{withHistoryTriggers:C,backwardsTriggerRef:w,forwardsTriggerRef:b,fabTriggerRef:Z}}(M,y,d,h,p,f,L,U,R),W=(0,_t.Z)(),z=i.ZP.createElement("div",{className:(0,ut.Z)("unread-divider","local-action-message"),key:"unread-messages"},i.ZP.createElement("span",null,W("UnreadMessages"))),Y=x?0:l.reduce(((e,t)=>e+t.senderGroups.flat().length),0);let J=0;const K=(0,qn.Z)(d),X=Boolean(d&&K&&d[d.length-2]===K[K.length-1]),Q=l.map(((e,t,n)=>{const a=e.senderGroups.map(((e,a,s)=>{if(1===e.length&&!La(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&&z,i.ZP.createElement(Bs,{key:o.id,message:o,threadId:r,messageListType:M,isInsideTopic:Boolean(r&&r!==u._f),observeIntersectionForReading:_,observeIntersectionForLoading:D,observeIntersectionForPlaying:q,memoFirstUnreadIdRef:S,appearanceOrder:Y-++J,isJustAdded:c&&X,isLastInList:c,onPinnedIntersectionChange:j})])}let o;return e.map(((c,d)=>{const l=La(c)?c.mainMessage:c,m=La(c)?c:void 0,h=(0,v.B4)(l),p=La(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&&!La(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&&z,i.ZP.createElement(di,{key:N,message:l,observeIntersectionForBottom:_,observeIntersectionForLoading:D,observeIntersectionForPlaying:q,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:Y-++J,isJustAdded:R.isLastInList&&X,isFirstInGroup:R.isFirstInGroup,isLastInGroup:R.isLastInGroup,isFirstInDocumentGroup:R.isFirstInDocumentGroup,isLastInDocumentGroup:R.isLastInDocumentGroup,isLastInList:R.isLastInList,memoFirstUnreadIdRef:S,onPinnedIntersectionChange:j,getIsMessageListReady:O}),l.id===k&&i.ZP.createElement("div",{className:"local-action-message",key:"discussion-started"},i.ZP.createElement("span",null,W("DiscussionStarted")))])})).flat()}));return i.ZP.createElement("div",{className:"message-date-group",key:e.datetime,onMouseDown:ja.q,teactFastList:!0},i.ZP.createElement("div",{className:(0,ut.Z)("sticky-date",!A&&"interactive"),key:"date-header",onMouseDown:ja.q,onClick:A?void 0:()=>F({selectedAt:e.datetime})},i.ZP.createElement("span",{dir:"auto"},A&&e.originalDate===o.t4X&&W("MessageScheduledUntilOnline"),A&&e.originalDate!==o.t4X&&W("MessageScheduledOn",(0,re.j1)(W,e.datetime,void 0,!0)),!A&&(0,re.j1)(W,e.datetime))),a.flat())}));return i.ZP.createElement("div",{className:"messages-container",teactFastList:!0},$&&i.ZP.createElement("div",{ref:H,key:"backwards-trigger",className:"backwards-trigger"}),N&&i.ZP.createElement(hi,{isInMessageList:!0,key:`bot_info_${n}`,chatId:n}),Q.flat(),!t&&p&&i.ZP.createElement(mi,{key:n,chatId:n,containerRef:y}),$&&i.ZP.createElement("div",{ref:G,key:"forwards-trigger",className:"forwards-trigger"}),i.ZP.createElement("div",{ref:V,key:"fab-trigger",className:"fab-trigger"}))}));var pi=n(73547);const fi=(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,_t.Z)(),u=(0,i.sO)(null),{observe:m}=(0,Ga.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,pt.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(pi.Z,{sticker:t,onClick:h,clickArg:t,observeIntersection:m,size:160,className:"large",noContextMenu:!0,isCurrentUserPremium:!0}))))}))),Ii=3*E.Gw,vi=(0,i.X$)((e=>{let{isChatWithSelf:t,type:n,isGroupChatJustCreated:a,topic:s}=e;const o=(0,_t.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(ni.Z,{topic:t,size:Ii,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,Qn.Z)(e("Chat.EmptyTopicPlaceholder.Text"),["br"]))))}(o,s):i.ZP.createElement("div",{className:"empty"},i.ZP.createElement("span",null,o("NoMessages")))})),wi=(0,I.Ds)((e=>e()),200,!1),bi=(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:F,hasLinkedChat:O,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,vt.Z)((()=>{de&&(0,I.R3)((()=>{ce.current=!1}))}),[de]),(0,vt.Z)((()=>{se.current=T}),[T]),(0,i.d4)((()=>{!p&&b&&y&&Y({chatId:t})}),[p,t,y,b]),(0,vt.Z)((()=>{de&&(oe.current=se.current)}),[de]),(0,vt.Z)((()=>{ie.current=L}),[L]),(e=>{(0,Ft.y)({"Mod+C":function(t){const n=(0,qa.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?Ua((0,g.Xo)(e,t),oe.current):void 0}),[R,k,s,H]);(0,St.Z)((()=>{if(!R||!k||"scheduled"===s)return;const e=R.filter((e=>k[e]?.reactions));e.length&&J({chatId:t,ids:e})}),15e3),(0,St.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,kt.Z)(!1),n=(0,Da.Z)(1e3,!0);return{isScrolled:e,updateStickyDates:(0,pt.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,pt.Z)((()=>{if(re.current)return void(re.current=!1);const e=Q.current;e&&(ie.current||he(e,d),wi((()=>{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,Gn.Z)(),s=(0,pt.Z)((e=>{a(e.contentRect.height)}));(0,Ha.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,_a.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,vt.Z)((()=>(0,c.yn)((()=>Ie.current()))),[R,N,d,Ie]),(0,i.d4)((()=>Ie.current()),[pe,Ie]),(0,$a.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,ft.q)()||!u;(0,Oa.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,Oa.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,Fa.Z)(i,Math.ceil(w)),(0,Oa.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,an.Z)((e=>{let[t]=e;void 0!==t&&(0,Et.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,ut.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:ja.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(hi,{chatId:t}):Ze?i.ZP.createElement(fi,{userId:t}):R&&(!le||Pe||ye)?i.ZP.createElement(vi,{chatId:t,topic:q,type:s,isChatWithSelf:C,isGroupChatJustCreated:Pe}):Ee?i.ZP.createElement(gi,{isCurrentUserPremium:p,chatId:t,isComments:A,isChannelChat:b,messageIds:R||[j.id],messageGroups:le||Ua([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:F,hasLinkedChat:O,isSchedule:!!le&&"scheduled"===s,shouldRenderBotInfo:M,noAppearanceAnimation:!le||!ce.current,onFabToggle:l,onNotchToggle:h,onPinnedIntersectionChange:G}):i.ZP.createElement(Zn.Z,{color:"white",backgroundColor:"dark"}))}))),Zi=(0,i.X$)((e=>{let{icon:t,ariaLabelLang:n,unreadCount:a,onClick:s,onReadAll:o,className:r}=e;const c=(0,_t.Z)(),d=(0,i.sO)(null),{isContextMenuOpen:l,handleContextMenu:u,handleContextMenuClose:m,handleContextMenuHide:h}=(0,Sa.Z)(d,!o);return i.ZP.createElement("div",{className:(0,ut.Z)("KboxtoWkfx23zfklH_Zg",r),ref:d},i.ZP.createElement(Jt.Z,{color:"secondary",round:!0,className:"sgkkv3bmIMAZS9G9BHUz",onClick:s,onContextMenu:u,ariaLabel:c(n)},i.ZP.createElement("i",{className:(0,ut.Z)("AafG9_xBi_2eJ_bFNnNg","icon",`icon-${t}`)})),Boolean(a)&&i.ZP.createElement("div",{className:"yKN1kQ3YXf4SHHIBcotS"},(0,Nt.bi)(a)),o&&i.ZP.createElement(Cn.Z,{isOpen:l,onClose:m,onCloseAnimationEnd:h,autoClose:!0,positionX:"right",positionY:"bottom"},i.ZP.createElement(Yt.Z,{icon:"readchats",onClick:o},c("MarkAllAsRead"))))})),Pi="EcdaljLbQ7DJN9gbQpSC",yi=(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,pt.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,Oa.ZP)(e,n,"end",20)}})),P=(0,ut.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(Zi,{icon:"heart-outline",ariaLabelLang:"AccDescrReactionMentionDown",onClick:m,onReadAll:f,unreadCount:c,className:(0,ut.Z)("wHTB_MNtk9J6I3F_4eVE",!w&&Pi,!b&&"uHEtFnXb6pb14Jf0EsDr")}),i.ZP.createElement(Zi,{icon:"mention",ariaLabelLang:"AccDescrMentionDown",onClick:h,onReadAll:p,unreadCount:d,className:!b&&Pi}),i.ZP.createElement(Zi,{icon:"arrow-down",ariaLabelLang:"AccDescrPageDown",onClick:Z,unreadCount:r,className:"Hoi4yrJrfBHTmvB8TPce"}))})));var Ci=n(65723);const Ei=/\.[^/.]+$/;async function Si(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,On.pt)(s),{width:r,height:d}=n;u=!Ri(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 wa(s,m?1280/Math.max(r,d):1,"image/jpeg");return URL.revokeObjectURL(s),Si(e,t,{compressedBlobUrl:n})}"image/jpeg"===i&&(e=e.replace(Ei,".jpg")),c={width:r,height:d}}l=Math.max(r,d)>40?await wa(s,40/Math.max(r,d),"image/jpeg"):s}else if(o.wGh.has(i)){const{videoWidth:e,videoHeight:t,duration:n}=await(0,On.jj)(s);u=!Ri(e,t),u||(c={width:e,height:t,duration:n}),l=await(0,On.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 Mi(e,t){return e.map((e=>t?e.compressedBlobUrl?{...e,blobUrl:e.compressedBlobUrl}:e:{...e,shouldSendAsFile:!e.voice||void 0,shouldSendAsSpoiler:void 0}))}function Ri(e,t){return Math.max(e,t)/Math.min(e,t)<=20}var ki=n(41098);function Ti(e){const t=document.createElement("div");t.contentEditable="true",t.style.position="absolute",t.style.left="-10000px",t.style.top="-10000px",t.innerHTML=e,t.className="allow-selection",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 Ai=n(96391);let Ni;function xi(e){Ni.focus(),e.focus()}s.cj&&(Ni=document.createElement("input"),Ni.classList.add("for-ios-autocapitalization-fix"),document.body.appendChild(Ni));var Bi=n(74288),Li=n(94462),Ui=n(33681),ji=n(52400);const Fi=new RegExp(`^${o.t8f.source}$`,"g");var Oi=n(56389);const _i={encoderPath:new URL(n(68973),n.b).href,reuseWorker:!0},Di={type:"audio/ogg"};let qi,$i,Hi;async function Gi(){return qi||(qi=n.e(1161).then(n.t.bind(n,1161,23)),$i=(await qi).default,Hi=new $i(_i)),qi}async function Vi(e){await async function(){await Gi(),await Hi.start()}();const t=Date.now();let n;const a=[],s=[];Hi.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}}(Hi);return{stop:()=>new Promise(((e,i)=>{Hi.onstop=()=>{e({blob:new Blob(a,Di),duration:Math.round(((n||Date.now())-t)/1e3),waveform:s})},Hi.onerror=i;const r=Math.max(0,t+1e3-Date.now());setTimeout((()=>{Hi.stop(),o()}),r)})),pause:()=>{const e=Math.max(0,t+1e3-Date.now());setTimeout((()=>{Hi.pause(),n=Date.now(),o()}),e)}}}var Wi=n(21262);const zi=/id="docs-internal-guid/i,Yi=["H1","H2","H3","H4","H5","H6"];function Ji(e){return(new DOMParser).parseFromString(e,"text/html").body}function Ki(e,t){const n=document.createElement("a");return n.href=t,n.appendChild(e.cloneNode(!0)),n}function Xi(e,t){const n=document.createElement(t);return n.appendChild(e.cloneNode(!0)),n}function Qi(e,t){let n=t.cloneNode(!0);return e?(e.style&&"700"===e.style.fontWeight&&(n=Xi(n,"strong")),e.style&&"italic"===e.style.fontStyle&&(n=Xi(n,"em")),e.style&&"underline"===e.style.textDecoration&&(n=Xi(n,"u")),e.style&&"line-through"===e.style.textDecoration&&(n=Xi(n,"del")),e.style&&"super"===e.style.verticalAlign&&(n=Xi(n,"sup")),e.style&&"sub"===e.style.verticalAlign&&(n=Xi(n,"sub")),n):n}function er(e){const t=e.cloneNode(!0);let n=document.createTextNode(t.textContent||""),a=t;return"A"===t.nodeName&&(n=Ki(n,t.href),"style"in t.childNodes[0]&&Boolean(t.childNodes[0].style)&&(a=t.childNodes[0])),n=Qi(a,n),n}function tr(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(...tr(e.childNodes[t]));a.map((e=>n.appendChild(e)))}else-1!==Yi.indexOf(e.nodeName)?(t=document.createElement(e.nodeName),n=er(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=Ki(n.cloneNode(!0),t.childNodes[0].href),a=t.childNodes[0].childNodes[0]),n=Qi(a,n),n}(e)):"BR"===e.nodeName?n=e:(t=document.createElement("span"),n=er(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(...tr(e.childNodes[n]));return t}return[e]}function nr(e){return 8!==e.nodeType}var ar=n(56266);const sr=/<style>(.*?)<\/style>/gs,or=(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,Fe.ZP)(function(e){let t=document.createElement("div");try{e=(n=e).match(zi)?function(e){const t=document.createElement("body"),n=e.childNodes,a=Array.from(n).filter(nr),s=[];for(const e of a)s.push(...tr(e));for(let e=0;e<s.length;e++)t.appendChild(s[e].cloneNode(!0));return t}(Ji(n.replace(/(\r\n|\n|\r)/,""))).innerHTML:Ji(n.replace(/(\r\n|\n|\r)/,"")).innerHTML}catch(e){o.eMD&&console.error(e)}var n;t.innerHTML=e.replace(/\u00a0/g," ").replace(sr,"");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(),Fe.xe[e.tagName]&&e.setAttribute("data-entity-type",Fe.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,ar.Lo)(m)&&r&&(m=(0,ar.If)(m),c?.());const{items:h}=e.clipboardData;let g=[];if(e.preventDefault(),h.length>0&&(g=await(0,Wi.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=>Si(e.name,e))));n((t=>t.concat(e)))}I&&(v?a(p):t(p,i?.id))}}),[t,s,n,e,r,c,a])},ir=new Set([u.Vv.TextUrl,u.Vv.Url]);var rr=n(28353),cr=n(29295),dr=n(16580);const lr=/^@([a-z0-9_]{1,32})[\u00A0\u0020]+(.*)/i,ur=/^@([a-z0-9_]{1,32})[\u00A0\u0020]+\n{2,}/i,mr={username:"",query:"",canShowHelp:!1,usernameLowered:""},hr=document.createElement("div");const gr=(0,dr.Z)(((e,t,n)=>({username:e,query:t,canShowHelp:n,usernameLowered:e.toLowerCase()}))),pr=/^\/([\w@]{1,32})?$/i;var fr=n(33057),Ir=n(60130);function vr(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 wr=n(69156);let br=!1;const Zr=e=>{const{isOpen:t}=e,n=(0,Tt.Z)(gt.gl.Extra,"DeleteMessageModal",!t);return n?i.ZP.createElement(n,e):void 0};var Pr=n(43521),yr=n(85655),Cr=n(30879),Er=n(56503),Sr=n(62898);const Mr="N3E1geoPu1vesCKf545F",Rr=/#fff/gi,kr=(0,i.X$)((e=>{let{icon:t,theme:n}=e;const{isTouchScreen:a}=(0,B.ZP)(),s=(0,rn.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(Rr,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,ut.Z)("vL8HfVVnjTeFmp1ECFj8","icon",!a&&Mr)},i.ZP.createElement("img",{src:o,alt:"",className:(0,ut.Z)("Fb4aIyDYEwOlaqY8oZkV",!a&&Mr)}))})),Tr=(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,_t.Z)(),m=(0,i.Ye)((()=>t.icons.find((e=>{let{name:t}=e;return"default_static"===t}))?.document),[t.icons]),[h,g,p]=(0,kt.Z)(),[f,I]=(0,i.eJ)(void 0),v=(0,pt.Z)((e=>{e.preventDefault();const t=e.currentTarget.getBoundingClientRect();I({x:t.right,y:t.bottom}),r(),g()})),w=(0,pt.Z)((()=>{p(),c()})),b=(0,pt.Z)((()=>{I(void 0)})),Z=(0,pt.Z)((()=>{l({botId:t.id,isEnabled:!1})}));return i.ZP.createElement(Yt.Z,{key:t.id,customIcon:m&&i.ZP.createElement(kr,{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(Sr.Z,null,i.ZP.createElement(Cn.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(Yt.Z,{icon:"stop",destructive:!0,onClick:Z},u("WebApp.RemoveBot")))))})),Ar=(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,kt.Z)(),[y,C,E]=(0,Er.Z)(b,P),S=d&&l,M=d||l,[R,k,T]=(0,kt.Z)();(0,i.d4)((()=>{b&&E()}),[b,E]);const A=(0,pt.Z)((()=>{b?P():Z()})),N=(0,pt.Z)(((e,t)=>{const{files:n}=e.target,a=(0,On.ox)(n);a?.length&&f(a,t)})),x=(0,pt.Z)((()=>{(0,yr.g)(Array.from(S?o.dII:d?o.oGt:o.wGh).join(","),(e=>N(e,!0)))})),B=(0,pt.Z)((()=>{(0,yr.g)(!u&&m?Array.from(o.e74).join(","):"*",(e=>N(e,!1)))})),L=(0,pt.Z)((()=>{const e=new File([(0,Cr.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,_t.Z)();if(a)return i.ZP.createElement("div",{className:"AttachMenu"},i.ZP.createElement(Pr.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(Cn.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(Yt.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(Yt.Z,{icon:"photo",onClick:x},j(S?"AttachmentMenu.PhotoOrVideo":d?"InputAttach.Popover.Photo":"InputAttach.Popover.Video")),(u||m)&&i.ZP.createElement(Yt.Z,{icon:"document",onClick:B},j(!u&&m?"InputAttach.Popover.Music":"AttachDocument")),u&&w&&i.ZP.createElement(Yt.Z,{icon:"bug",onClick:L},j("DebugSendLogs"))),c&&i.ZP.createElement(Yt.Z,{icon:"poll",onClick:I},j("Poll")),r&&!p&&U.map((e=>i.ZP.createElement(Tr,{bot:e,chatId:t,threadId:n,theme:v,onMenuOpened:k,onMenuClosed:T})))))})),Nr=e=>{const{isOpen:t}=e,n=(0,Tt.Z)(gt.gl.Extra,"InlineBotTooltip",!t);return n?i.ZP.createElement(n,e):void 0},xr=e=>{const{isOpen:t}=e,n=(0,Tt.Z)(gt.gl.Extra,"MentionTooltip",!t);return n?i.ZP.createElement(n,e):void 0};var Br=n(67146);const Lr=e=>{const{isOpen:t}=e,n=(0,Tt.Z)(gt.gl.Extra,"StickerTooltip",!t);return n?i.ZP.createElement(n,e):void 0};var Ur=n(93219),jr=n(19830);const Fr=e=>{const{isOpen:t}=e,n=(0,Tt.Z)(gt.gl.Extra,"BotCommandTooltip",!t);return n?i.ZP.createElement(n,e):void 0},Or=(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,Er.Z)(t,o),{isKeyboardSingleUse:l}=n||{};if(n&&n.keyboardButtons)return i.ZP.createElement(Cn.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(Jt.Z,{ripple:!0,disabled:"unsupported"===e.type,onClick:()=>r({messageId:n.id,button:e})},e.text))))))))})));var _r=n(49841),Dr=n(12644),qr=n(66902);const $r=(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,_t.Z)(),E=Boolean(c),S=Boolean((t||n)&&s||o&&c),M=(0,ta.Z)([c],c?300:void 0),{shouldRender:R,transitionClassNames:k}=(0,Ct.Z)(M&&S,void 0,!r,void 0,!r),T=(0,pt.Z)((()=>{t&&!m?p({messageId:void 0}):n?f({messageId:void 0}):c&&P(),g?.()}));(0,i.d4)((()=>S?(0,Ut.Z)(T):void 0),[S,T]);const A=(0,pt.Z)((()=>{E||I({chatId:s.chatId,messageId:s.id,noForumTopicPanel:!0})})),N=(0,pt.Z)((e=>{e.stopPropagation(),T()})),x=(0,pt.Z)((()=>{w()})),{isContextMenuOpen:B,contextMenuPosition:L,handleContextMenu:U,handleContextMenuClose:j,handleContextMenuHide:F}=(0,Sa.Z)(y),O=(0,pt.Z)((()=>y.current)),_=(0,pt.Z)((()=>y.current)),D=(0,pt.Z)((()=>y.current.querySelector(".forward-context-menu .bubble"))),{positionX:q,positionY:$,transformOriginX:H,transformOriginY:G,style:V}=(0,Dr.Z)(L,O,_,D);(0,i.d4)((()=>{R||j()}),[j,R]);const W=(0,ut.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,ut.Z)("icon",z)})),i.ZP.createElement(Ls,{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(Jt.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(Cn.Z,{isOpen:B,transformOriginX:H,transformOriginY:G,positionX:q,positionY:$,style:V,className:"forward-context-menu",onClose:j,onCloseAnimationEnd:F},i.ZP.createElement(Yt.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(Yt.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(qr.Z,null),i.ZP.createElement(Yt.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(Yt.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(qr.Z,null),i.ZP.createElement(Yt.Z,{icon:"replace",onClick:x},C("ChangeRecipient")))))}))),Hr=e=>{const{attachments:t}=e,n=(0,Tt.Z)(gt.gl.Extra,"AttachmentModal",!t.length);return n?i.ZP.createElement(n,e):void 0},Gr=e=>{const{isOpen:t}=e,n=(0,Tt.Z)(gt.gl.Extra,"BotCommandMenu",!t);return n?i.ZP.createElement(n,e):void 0},Vr=e=>{const{isOpen:t}=e,n=(0,Tt.Z)(gt.gl.Extra,"PollModal",!t);return n?i.ZP.createElement(n,e):void 0},Wr=e=>{const{isOpen:t}=e,n=(0,Tt.Z)(gt.gl.Extra,"DropArea",!t);return n?i.ZP.createElement(n,e):void 0},zr=new RegExp(o.FM6,"i"),Yr=(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,Wa.iD)((()=>{const e=(0,Fe.ZP)(s()),t=e.entities?.find((e=>e.type===u.Vv.TextUrl));return g.current=e,t?.url||e.text.match(zr)?.[0]}),[s],300,!0),f=(0,Ya.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,vt.Z)((()=>{m(),h({chatId:t,threadId:n})}),[t,m,n,h]);const I=(0,Yn.Z)((()=>Boolean(r&&s()&&!c&&!o)),[o,s,c,r]),{shouldRender:v,transitionClassNames:w}=(0,Ct.Z)(I),b=(0,zn.Z)(r,!0),Z=(0,pt.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,ut.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(vo,{message:C,inPreview:!0,theme:d}),i.ZP.createElement(Jt.Z,{className:"WebPagePreview-clear",round:!0,faded:!0,color:"translucent",ariaLabel:"Clear Webpage Preview",onClick:Z},i.ZP.createElement("i",{className:"icon icon-close"}))))}))),Jr=e=>{const{isOpen:t}=e,n=(0,Tt.Z)(gt.gl.Extra,"SendAsMenu",!t);return n?i.ZP.createElement(n,e):void 0},Kr=(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(Jt.Z,{className:(0,ut.Z)("bot-menu",t&&"open"),round:!0,color:"translucent",disabled:s,onClick:n,ariaLabel:"Open bot command keyboard"},i.ZP.createElement("i",{className:(0,ut.Z)("bot-menu-icon","icon","icon-webapp",t&&"open")}),i.ZP.createElement("span",{ref:o,className:"bot-menu-text"},a))}));var Xr=n(23522),Qr=function(e){return e.Send="send",e.Record="record",e.Edit="edit",e.Schedule="schedule",e}(Qr||{});const ec="wonderful-voice-message.ogg",tc=(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,F=g?.slowMode,O="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:O,requestedDraftText:N,requestedDraftFiles:x,attachBots:e.attachMenu.bots,attachMenuPeerType:(0,f.t)(e,a),theme:(0,f.Pu)(e),fileSizeLimit:(0,ne.M)(e,"uploadMaxFileparts")*o.pJM,captionLimit:(0,ne.M)(e,"captionLength"),isCurrentUserPremium:(0,f.wV)(e),canSendVoiceByPrivacy:j,attachmentSettings:e.attachmentSettings,slowMode:F,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:F,groupChatMembers:O,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:ce,attachMenuPeerType:de,attachmentSettings:le,theme:ue,slowMode:me,shouldUpdateStickerSetOrder:he,shouldCollectDebugLogs:ge}=e;const{sendMessage:fe,clearDraft:Ie,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,_t.Z)(),xe=(0,i.sO)(null),[Be,Ue]=(0,Gn.Z)(""),[je,Oe]=(0,i.eJ)(!1),_e=(0,wr.Z)(o.Edp),De=(0,i.sO)(),qe=(0,qn.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,kt.Z)(),Ye=(0,Oi.Z)(p,f);(0,i.d4)(Bi.AU,[Be]);const Je=(0,i.sO)(0),[Ke,Xe]=(0,fr.Z)(d,ze);(0,Rt.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,vt.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:mt,canSendAudios:ht,canSendVideos:gt,canSendPhotos:wt,canSendDocuments:bt}=(0,i.Ye)((()=>(0,v.H5)(Z,E)),[Z,E]),Zt=!mt&&!g,Pt=(0,pt.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,Ai.R)(s,t))return(0,ki.tx)(e),void a.dispatchEvent(new Event("input",{bubbles:!0}))}Ue(`${Be()}${e}`),(0,c.Yq)((()=>{(0,Ci.Z)(a)}))})),yt=(0,pt.Z)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.R2F;const n=(0,Qn.Z)(e,["escape_html","emoji_html","br_html"]).join("").replace(/\u200b+/g,"");Pt(n,t)})),Ct=(0,pt.Z)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.R2F;const n=(0,io.z)(e);Pt(n,t)})),Et=(0,pt.Z)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.R2F;Pt((0,os.yR)(e),t)})),Mt=(0,pt.Z)((()=>{at&&(Ct(at,o.R2F),st(void 0))})),{shouldSuggestCompression:Tt,shouldForceCompression:At,shouldForceAsFile:Nt,handleAppendFiles:xt,handleFileSelect:Bt,onCaptionUpdate:Lt,handleClearAttachments:jt,handleSetAttachments:Ft}=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,pt.Z)((()=>{o(Le.D),m()})),P=(0,pt.Z)((e=>{const a="function"==typeof e?e(t):e;if(a.length)if(a.some((e=>{const t=vr(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=vr(e);return"audio"===t&&!c||"video"===t&&!d||"image"===t&&!l}));f(Boolean(e&&u)),v(!u)}else Z()}));return{shouldSuggestCompression:w,handleAppendFiles:(0,pt.Z)((async(e,n)=>{P([...t,...await Promise.all(e.map((e=>Si(e.name,e,{shouldSendAsSpoiler:n||void 0}))))])})),handleFileSelect:(0,pt.Z)((async(e,t)=>{P(await Promise.all(e.map((e=>Si(e.name,e))))),b(t)})),onCaptionUpdate:s,handleClearAttachments:Z,handleSetAttachments:P,shouldForceCompression:I,shouldForceAsFile:p}}({attachments:et,setHtml:Ue,setAttachments:tt,fileSizeLimit:R,chatId:p,canSendAudios:ht,canSendVideos:gt,canSendPhotos:wt,canSendDocuments:bt,insertNextText:Mt}),[Ot,Dt,qt]=(0,kt.Z)(),[$t,Ht,Gt]=(0,kt.Z)(),[Vt,Wt,zt]=(0,kt.Z)(),[Yt,Kt,Xt]=(0,kt.Z)(),[Qt,en,nn]=(0,kt.Z)(),[sn,on,rn]=(0,kt.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&&Gi()}),[]);const d=(0,pt.Z)((async()=>{try{const{stop:t,pause:s}=await Vi((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,pt.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,pt.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,Ut.Z)(u):void 0),[t,u]),{startRecordingVoice:d,pauseRecordingVoice:l,stopRecordingVoice:u,activeVoiceRecording:t,currentRecordTime:o,recordButtonRef:e,startRecordTimeRef:a}})();(0,St.Z)((()=>{Ye({type:"recordAudio"})}),un&&o.o_S),(0,i.d4)((()=>{un||Ye({type:"cancel"})}),[un,Ye]);const pn=(0,_a.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,rr.Z)(Boolean(l&&t&&P&&H&&!nt),Be,Ue,void 0,z,V,W),{isCustomEmojiTooltipOpen:Pn,closeCustomEmojiTooltip:yn,insertCustomEmoji:Cn}=(0,Ir.Z)(Boolean(l&&t&&P&&G&&!nt),Be,Ue,_e,xe,F),{isStickerTooltipOpen:En,closeStickerTooltip:Sn}=function(e,t,n){const{loadStickersForEmoji:r,clearStickersForEmoji:c}=(0,a.Sv)(),[d,l,u]=(0,kt.Z)(!1),m=(0,Ya.Z)((()=>{const n=t();if(!e||!n||s.op&&n.length>8)return;if(!n.match(s.op?Ui.Z:o.t8f))return;const a=(0,ji._)(n);return a&&(s.op&&1===(0,Li.Z)(a)||!s.op&&Boolean(n.match(Fi)))?s.op?a:a.match(/alt="(.+)"/)?.[1]:void 0}),[t,e]),h=(0,Yn.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,cr.Z)(Boolean(l&&P&&!nt),Be,Ue,_e,xe,O,_,D),{isOpen:An,botId:Nn,isGallery:xn,switchPm:Bn,switchWebview:Ln,results:jn,closeTooltip:Fn,help:On,loadMore:_n}=function(e,t,n,s){const{queryInlineBot:o,resetInlineBot:r,resetAllInlineBots:c}=(0,a.Sv)(),[d,l,u]=(0,kt.Z)(!1),m=(0,Wa.CH)((()=>{const t=n();return e&&t.startsWith("@")?function(e){if(!e.startsWith("@"))return mr;const t=function(e){return hr.innerHTML=e.replace(/<br>/g,"\n"),hr.querySelectorAll("[alt]").forEach((e=>{e.innerText||(e.innerText=e.getAttribute("alt"))})),hr.innerText}(e),n=t.match(lr);return n?gr(n[1],n[2],""===n[2]&&!t.match(ur)):mr}(t):mr}),[n,e],300),{username:h,query:g,canShowHelp:p,usernameLowered:f}=(0,Yn.Z)(m,[m,n],!0);(0,vt.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,pt.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:$n,filteredBotCommands:Hn}=function(e,t,n,a){const[s,o]=(0,i.eJ)(),[r,c,d]=(0,kt.Z)(!1),l=(0,Wa.CH)((()=>{const n=t();return e&&n.startsWith("/")?(0,ji._)(n).match(pr)?.[0].trim():void 0}),[t,e],300),u=(0,Ya.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,pt.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,Fe.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,_a.Y)(f),v=(0,Da.Z)(o.r_R,!0,void 0,[t,n]);(0,an.Z)((a=>{let[i,r,m]=a;if(t===i&&n===r&&(!e&&m&&d(""),!e?.shouldForce))return;if(l||!e)return;d((0,io.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,Ci.Z)(e,!0)}))}),[t,n,e,d,l,g]),(0,i.d4)((()=>()=>{p||I.current({chatId:t,threadId:n}),br=!0,(0,c.i$)((()=>{br=!1}))}),[t,n,p,I]);const w=(0,_a.Y)(t),b=(0,_a.Y)(n);function Z(){f(void 0,!0)}(0,i.d4)((()=>{if(br)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,ft.Z)(Z),It(Z)})(b,p,f,Be,Ue,g);const Vn=(0,pt.Z)((function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e||Ue(""),tt(Le.D),st(void 0),vn(),yn(),Sn(),Rn(),m?setTimeout((()=>zt()),350):zt()})),[Wn,zn,Jn]=((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,an.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,io.z)(i);t(r),b(!0),(0,c.Yq)((()=>{const e=document.querySelector(o.Edp);e&&(0,Ci.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=>ir.has(e.type)));I({chatId:d,threadId:l,noWebPage:e})}),[d,l,n]),(0,i.d4)((()=>{if(n)return()=>{const t=(0,Fe.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,Wa.iD)((()=>{if(!n)return!1;const t=(0,Fe.ZP)(e());return!("webPage"in n.content)&&n.content.text?.entities?.some((e=>ir.has(e.type)))&&!t.entities?.some((e=>ir.has(e.type)))}),[n,e],300,!0),P=(0,Ya.Z)(Z,[Z,e],!0);(0,an.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,pt.Z)((()=>{m&&(0,c.i$)((()=>{t((0,io.z)(m)),(0,c.Yq)((()=>{const e=document.querySelector(o.Edp);e&&(0,Ci.Z)(e,!0)}))}))})),C=(0,pt.Z)((()=>{s(),y()})),E=(0,pt.Z)((()=>{const{text:t,entities:a}=(0,Fe.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,pt.Z)((()=>{if(!n)return;const t=(0,Fe.ZP)(e()),a=t.text.length?t:void 0;f({chatId:d,threadId:l,type:u,text:a})}));return(0,ft.Z)(S),It(S),[E,C,w]})(Be,Ue,g,Vn,en,p,f,w,b,ne,ae),Kn=(0,_a.Y)(Vn),Xn=(0,_a.Y)(dn);(0,i.d4)((()=>()=>{Xn.current(),Kn.current()}),[p,f,Kn,Xn]);const ea=(0,pt.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)})),ta=(0,Yn.Z)((()=>g&&Jn?Qr.Edit:!s.mh||un||N||Be()&&!nt?r?Qr.Schedule:Qr.Send:Qr.Record),[un,g,Be,nt,N,Jn,r]),na=!r,{isContextMenuOpen:aa,handleContextMenu:sa,handleContextMenuClose:oa,handleContextMenuHide:ia}=(0,Sa.Z)(hn,!(ta===Qr.Send&&na));or(P,Ct,Ft,st,g,!y&&!S,ea);const ra=(0,pt.Z)((()=>{g&&zn()})),ca=(0,pt.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,pt.Z)((()=>{if(me&&!fn){const e=document.querySelector(o.Edp),t=(0,pe.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,re.k9)(s)),isSlowMode:!0,hasErrorKey:!1}}),e?.blur(),!1}}return!0})),la=(0,pt.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,Fe.ZP)(Be());(i||t.length)&&ca(i,!0)&&da()&&(fe({messageList:I,text:i,entities:r,scheduledAt:o,isSilent:s,shouldUpdateStickerSetOrder:he,attachments:Mi(t,n),shouldGroupMessages:a}),De.current=(0,pe.bp)(),Ie({chatId:p,localOnly:!0}),(0,c.i$)((()=>{Vn()})))})),ua=(0,pt.Z)(((e,t,n,a)=>{la({attachments:et,sendCompressed:e,sendGrouped:t,isSilent:n,scheduledAt:a})})),ma=(0,pt.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 Si(ec,t,{voice:{duration:a,waveform:s}})]}}const{text:a,entities:i}=(0,Fe.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;fe({messageList:I,text:a,entities:i,scheduledAt:t,isSilent:e,shouldUpdateStickerSetOrder:he})}N&&we({scheduledAt:t,isSilent:e}),De.current=(0,pe.bp)(),Ie({chatId:p,localOnly:!0}),s.cj&&r&&r===document.activeElement&&xi(r),(0,c.i$)((()=>{Vn()}))})),ha=(0,pt.Z)((()=>{"webApp"===ie?.type&&Re({chatId:p,url:ie.url,threadId:f})})),ga=(0,pt.Z)((()=>{zt(),Ht()})),pa=(0,pt.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 fe({...e,messageList:n,scheduledAt:t});else ma(Boolean(a),t)}));(0,an.Z)((e=>{let[t]=e;I&&$&&$!==t&&Ke((e=>{pa($,e,I)}))}),[$,I,pa,Ke]),(0,i.d4)((()=>{se&&(Ue(se),Me(),(0,c.Yq)((()=>{const e=document.getElementById(o.R2F);(0,Ci.Z)(e,!0)})))}),[se,Me,Ue]),(0,i.d4)((()=>{oe?.length&&(Bt(oe),Me())}),[Bt,oe,Me]);const fa=(0,pt.Z)(((e,t)=>{e.isFree||y||S?Et(e,t):ea()})),Ia=(0,pt.Z)((e=>{fa(e,o.nYf)})),va=(0,pt.Z)(((e,t,n)=>{I&&(r||n?(We(),Ke((n=>{ze(),pa({gif:e,isSilent:t},n,I),(0,c.i$)((()=>{Vn(!0)}))}))):(fe({messageList:I,gif:e,isSilent:t}),(0,c.i$)((()=>{Vn(!0)}))))})),wa=(0,pt.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$)((()=>{Vn(a)}))}))):(fe({messageList:I,sticker:e,isSilent:t,shouldUpdateStickerSetOrder:he&&s}),(0,c.i$)((()=>{Vn(a)}))))})),ba=(0,pt.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&&xi(a),Ie({chatId:p,localOnly:!0}),(0,c.i$)((()=>{Vn()}))})),Za=(0,pt.Z)((()=>{Ie({chatId:p,localOnly:!0}),(0,c.i$)((()=>{Vn()}))})),Pa=(0,pt.Z)((e=>{I&&(r?(Ke((t=>{pa({poll:e},t,I)})),Ze()):(fe({messageList:I,poll:e}),Ze()))})),ya=(0,pt.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,pt.Z)((()=>{const e=document.querySelector(o.Edp);if(!m||e!==document.activeElement)return Gt(),zt(),void Kt();e?.blur(),setTimeout((()=>{Gt(),zt(),Kt()}),100)}));(0,i.d4)((()=>{Zt&&Ue("")}),[Zt,Ue,et]);const Ea=(0,pt.Z)((e=>{yt(e,o.nYf)})),Ma=(0,pt.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,Ai.R)(n,e))return void document.execCommand("delete",!1)}Ue(Ti(Be()))})),Ra=(0,pt.Z)((()=>{Ma(o.nYf)})),ka=(0,pt.Z)((()=>{ye({id:p,threadId:f,type:"scheduled",noForumTopicPanel:!0})}));(0,i.d4)((()=>{k&&m&&zt()}),[k,zt,m]),(0,i.d4)((()=>{l&&(T?on():setTimeout((()=>{rn()}),200))}),[T,rn,on,l]);const Ta=!(ta!==Qr.Record||rt&&C&<),Aa=(0,pt.Z)((()=>{switch(ta){case Qr.Send:ma();break;case Qr.Record:Ta?C?lt||Ae({chatId:p}):Te({message:Ne("VoiceMessagesRestrictedByPrivacy",Z?.title)}):cn();break;case Qr.Edit:Wn();break;case Qr.Schedule:if(un&&ln(),!I)return;Ke((e=>{pa({},e,I)}))}})),Na=(0,qn.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(ta){case Qr.Edit:Ua="Save edited message";break;case Qr.Record:Ua=rt?"AccDescrVoiceMessage":"Conversation.DefaultRestrictedMedia"}const ja=(0,ut.Z)("Composer",!T&&"shown",sn&&"hover-disabled",je&&"mounted"),Fa=(0,pt.Z)((()=>{Ke((e=>{pa({},e,I)}))})),Oa=(0,pt.Z)((()=>{ya()})),qa=(0,pt.Z)((()=>{pa({},o.t4X,I)})),$a=(0,pt.Z)(((e,t)=>{Ke((n=>{pa({sendCompressed:e,sendGrouped:t},n,I)}))})),Ha=(0,pt.Z)(((e,t)=>{ya({sendCompressed:e,sendGrouped:t})})),Ga=ta===Qr.Edit?Wn:ta===Qr.Schedule?Fa:ma,Va=E&&"webApp"===ie?.type&&!g,za=(0,Yn.Z)((()=>Va&&!Be()&&!un),[Va,Be,un]),Ja=E&&"commands"===ie?.type&&!g&&!1!==K&&!un;return i.ZP.createElement("div",{className:ja},rt&&l&&i.ZP.createElement(Wr,{isOpen:n!==Un.t.None,withQuick:n===Un.t.QuickFile||qe===Un.t.QuickFile,onHide:h,onFileSelect:Bt}),i.ZP.createElement(Hr,{chatId:p,threadId:f,canShowCustomSendMenu:na,attachments:et,getHtml:Be,isReady:l,shouldSuggestCompression:Tt,shouldForceCompression:At,shouldForceAsFile:Nt,isForCurrentMessageList:P,shouldSchedule:r,onCaptionUpdate:Lt,onSendSilent:Ha,onSend:ua,onSendScheduled:$a,onFileAppend:xt,onClear:jt,onAttachmentsUpdate:Ft,onCustomEmojiSelect:Ia,onRemoveSymbol:Ra,onEmojiSelect:Ea}),i.ZP.createElement(Vr,{isOpen:x.isOpen,isQuiz:x.isQuiz,shouldBeAnonymous:M,onClear:Ze,onSend:Pa}),xa&&i.ZP.createElement(Zr,{isOpen:Qt,isSchedule:"scheduled"===w,onClose:nn,message:xa}),i.ZP.createElement(Jr,{isOpen:Yt,onClose:Xt,chatId:p,selectedSendAsId:te,sendAsPeerIds:He,isCurrentUserPremium:y}),i.ZP.createElement(xr,{isOpen:Mn,filteredUsers:Tn,onInsertUserName:kn,onClose:Rn}),i.ZP.createElement(Fr,{isOpen:Dn,withUsername:Boolean(X),botCommands:Hn,getHtml:Be,onClick:Za,onClose:$n}),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(Nr,{isOpen:An,botId:Nn,isGallery:xn,inlineBotResults:jn,switchPm:Bn,switchWebview:Ln,loadMore:_n,isSavedMessages:S,canSendGifs:it,isCurrentUserPremium:y,onSelectResult:ba,onClose:Fn}),i.ZP.createElement($r,{onClear:ra,shouldForceShowEditing:Boolean(Jn&&g)}),i.ZP.createElement(Yr,{chatId:p,threadId:f,getHtml:Be,isDisabled:!dt||nt}),i.ZP.createElement("div",{className:"message-input-wrapper"},Va&&i.ZP.createElement(Kr,{isOpen:za,text:ie.text,isDisabled:Boolean(un),onClick:ha}),Ja&&i.ZP.createElement(Pr.Z,{className:(0,ut.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(Jt.Z,{round:!0,color:"translucent",onClick:Yt?Xt:Ca,ariaLabel:Ne("SendMessageAsTitle"),className:(0,ut.Z)("send-as-button",Qe.current&&"appear-animation")},i.ZP.createElement(Rs.Z,{peer:Q||ee,size:"tiny"})),(!Zt||it||ot)&&i.ZP.createElement(Xr.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:Ma,onEmojiSelect:yt,closeBotCommandMenu:Gt,closeSendAsMenu:Xt,isSymbolMenuForced:Ve,canSendPlainText:!Zt}),i.ZP.createElement(_r.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:On,canAutoFocus:l&&P&&!nt,noFocusInterception:nt,shouldSuppressFocus:m&&Vt,shouldSuppressTextFormatter:In||Mn||An,onUpdate:Ue,onSend:Ga,onSuppressedFocus:zt}),J&&Boolean(Nn)&&i.ZP.createElement(tn.Z,{color:"gray"}),U&&i.ZP.createElement(Jt.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(Pr.Z,{className:Ot?"activated":"",round:!0,color:"translucent",onActivate:Dt,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,re.rM)(mn-gn.current)),i.ZP.createElement(Ar,{chatId:p,threadId:f,isButtonVisible:!un&&!g,canAttachMedia:rt,canAttachPolls:ct,canSendPhotos:wt,canSendVideos:gt,canSendDocuments:bt,canSendAudios:ht,onFileSelect:Bt,onPollCreate:be,isScheduled:r,attachBots:ce,peerType:de,shouldCollectDebugLogs:ge,theme:ue}),Boolean(B)&&i.ZP.createElement(Or,{messageId:B,isOpen:Ot,onClose:qt}),K&&i.ZP.createElement(Gr,{isOpen:$t,botCommands:K,onClose:Gt}),i.ZP.createElement(Ur.Z,{chatId:p,isOpen:Pn,onCustomEmojiSelect:Cn,addRecentCustomEmoji:ke,onClose:yn}),i.ZP.createElement(Lr,{chatId:p,threadId:f,isOpen:En,onStickerSelect:wa,onClose:Sn}),i.ZP.createElement(jr.Z,{isOpen:In,emojis:wn,customEmojis:bn,addRecentEmoji:Ce,addRecentCustomEmoji:ke,onEmojiSelect:Zn,onCustomEmojiSelect:Zn,onClose:vn}))),un&&i.ZP.createElement(Jt.Z,{round:!0,color:"danger",className:"cancel",onClick:dn,ariaLabel:"Cancel voice recording"},i.ZP.createElement("i",{className:"icon icon-delete"})),i.ZP.createElement(Jt.Z,{ref:hn,round:!0,color:"secondary",className:(0,ut.Z)(ta,!l&&"not-ready",un&&"recording"),disabled:Ta,allowDisabledClick:!0,noFastClick:!0,ariaLabel:Ne(Ua),onClick:Aa,onContextMenu:ta===Qr.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(Br.Z,{isOpen:aa,canScheduleUntilOnline:d,onSendSilent:S?void 0:Oa,onSendSchedule:r?void 0:Fa,onSendWhenOnline:qa,onClose:oa,onCloseAnimationEnd:ia,isSavedMessages:S}),Xe)}))),nc=e=>{const{isActive:t}=e,n=(0,Tt.Z)(gt.gl.Extra,"MobileSearch",!t,!0);return n?i.ZP.createElement(n,e):void 0},ac=e=>{const{isActive:t}=e,n=(0,Tt.Z)(gt.gl.Extra,"MessageSelectToolbar",!t);return n?i.ZP.createElement(n,e):void 0},sc=e=>{const{isOpen:t}=e,n=(0,Tt.Z)(gt.gl.Extra,"UnpinAllMessagesModal",!t);return n?i.ZP.createElement(n,e):void 0},oc=e=>{const{isOpen:t}=e,n=(0,Tt.Z)(gt.gl.Extra,"SeenByModal",!t);return n?i.ZP.createElement(n,e):void 0},ic=e=>{const{activeEmojiInteraction:t}=e,n=(0,Tt.Z)(gt.gl.Extra,"EmojiInteractionAnimation",!t);return n?i.ZP.createElement(n,e):void 0},rc=e=>{const{isOpen:t}=e,n=(0,Tt.Z)(gt.gl.Extra,"ReactorListModal",!t);return n?i.ZP.createElement(n,e):void 0},cc=e=>{const{isOpen:t}=e,n=(0,Tt.Z)(gt.gl.Extra,"GiftPremiumModal",!t);return n?i.ZP.createElement(n,e):void 0},dc=e=>{const{isOpen:t}=e,n=(0,Tt.Z)(gt.gl.Extra,"ChatLanguageModal",!t);return n?i.ZP.createElement(n,e):void 0};function lc(e){return"file"===e.kind&&e.type&&o.oGt.has(e.type)}const uc=450+o.fK3,mc=(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,F="thread"===S&&E===u._f,O=Boolean(R&&(0,v.eA)(R)),_=Boolean(R&&F&&(O||(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||!O&&!(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:O,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:F,leftColumnWidth:O,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,_n.Z)(),{isTablet:Pe,isDesktop:ye}=(0,B.ZP)(),Ce=(0,_t.Z)(),[Ee,Se]=(0,i.eJ)(Un.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,Gn.Z)({}),[c,d]=(0,Gn.Z)(),l=(0,i.sO)(),[u,m]=(0,Gn.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,pt.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,$n.uZ)(n.indexOf(y[0])+R,0,n.length-1):0;r({...o(),[h]:k})})),onFocusPinnedMessage:(0,pt.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,Hn.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),Fe=l&&_,Oe=l?uc:void 0,_e=Z&&(Ze<o.l35||P||j&&Ze>o._mX&&Ze<o.QU1||!l&&y&&Ze<o.sgm),De=(0,Dn.Z)(n,Oe),qe=(0,Dn.Z)(r,Oe),$e=(0,Dn.Z)(d,Oe),He=(0,Dn.Z)(K,Oe),Ge=(0,Dn.Z)(X,Oe),Ve=(0,Dn.Z)(Q,Oe),We=(0,Dn.Z)(I,Oe)&&!Ve&&!Ge&&!He&&n!==o.mzl,ze=(0,Dn.Z)(_e,Oe),Ye=(0,Dn.Z)(Me,Oe)&&n!==o.mzl,Je=(0,Dn.Z)(Y,Oe),Ke=(0,Dn.Z)(te,Oe),Xe=(0,Dn.Z)(ne,Oe),Qe=(0,Dn.Z)(n?xe:void 0,Oe),et=(0,qn.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,yt.Z)(),d=void 0!==n&&n!==t;return d&&(e?(r(!1),setTimeout((()=>{r(!0)}),uc)):c()),(0,vt.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,Ut.Z)((()=>{re({id:void 0})})):void 0),[n,re]),(0,vt.Z)((()=>{Se(Un.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,kt.Z)(),[l,u]=(0,i.eJ)(0),[m,h]=(0,i.eJ)(0),g=(0,pt.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,O,"--left-column-width"),ct=(0,pt.Z)((e=>{const{items:t}=e.dataTransfer||{},n=t&&t.length>0&&Array.from(t).filter((e=>"text/uri-list"!==e.type)).every(lc);Se(n?Un.t.QuickFile:Un.t.Document)})),dt=(0,pt.Z)((()=>{Se(Un.t.None)})),lt=(0,pt.Z)((()=>{Ne(!0)})),mt=(0,pt.Z)((()=>{Ne(!1)})),ht=(0,pt.Z)((()=>{de({chatId:n,threadId:r}),mt(),ce()})),gt=(0,pt.Z)((()=>{re({id:n})})),ft=(0,pt.Z)((()=>{ge({chatId:n}),Xe&&Ie({message:Ce(Y?"RequestToJoinChannelSentDescription":"RequestToJoinGroupSentDescription")})})),It=(0,pt.Z)((()=>{pe({command:"/start"})})),wt=(0,pt.Z)((()=>{fe({chatId:n})})),bt=((e,t)=>{const[n,a]=(0,i.eJ)(t);return(0,i.d4)((()=>{t&&(t.startsWith("#")?a(t):Fn.fetch(o.foQ,e,Fn.Type.Blob).then((e=>{const t=URL.createObjectURL(e);(0,On.pt)(t).then((()=>{a(`url(${t})`)}))})))}),[t,e]),t?n:void 0})(N,A),Zt=(0,ut.Z)(ze&&"has-header-tools",s.aZ?"mask-image-disabled":"mask-image-enabled"),Pt=(0,ut.Z)("ON5E8MkEVA1mAlkuIxhG","OWFg9Wf1uioPWDz_IgS8",A&&"Ik9ZZlj3eKtKXRrUZKVk",x&&"avVozLQe3SaWcSkIt6pG",A&&F&&"Tipa66fYcSvl6w0587Xz",j&&"vhOr8s3T_LCKSt2BF7fs"),Ct=(0,ut.Z)("messaging-disabled",!D&&"shown"),Et=(0,v.q8)(Ce,w,b),St=(0,v.mt)(Ce,u,r,Boolean(m)),Mt=Et||St,{composerHiddenScale:Rt,toolbarHiddenScale:Tt,composerTranslateX:At,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,ut.Z)("middle-column-footer",!We&&"no-composer",We&&ke&&!D&&"with-notch");(0,In.Z)({isActive:D,onBack:he}),(0,In.Z)({isActive:Fe,onBack:me});const jt=Boolean(!p&&!We&&!Ve&&!Ge&&!He&&Mt),Ft=Boolean(Ve||He||Xe||Ge||p),Dt=Boolean(jt||D||p);return i.ZP.createElement("div",{id:"MiddleColumn",className:Zt,onTransitionEnd:at,style:(0,jn.Z)(`--composer-hidden-scale: ${Rt}`,`--toolbar-hidden-scale: ${Tt}`,`--unpin-hidden-scale: ${xt}`,`--toolbar-unpin-hidden-scale: ${Bt},`,`--composer-translate-x: ${At}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:bt?`--custom-background: ${bt}`: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(Ba,{chatId:De,threadId:qe,messageListType:$e,isReady:nt,isMobile:l,getCurrentPinnedIndexes:Le,getLoadingPinnedId:Ue,onFocusPinnedMessage:Be}),i.ZP.createElement(Ot.Z,{name:W?"none":V?"slide":"fade",activeKey:z,shouldCleanup:!0,cleanupExceptionKey:tt,onStop:st},i.ZP.createElement(bi,{key:`${De}-${qe}-${$e}`,chatId:De,threadId:qe,type:$e,canPost:We,hasTools:ze,onFabToggle:Re,onNotchToggle:Te,isReady:nt,withBottomShift:Ft,withDefaultBg:Boolean(!A&&!x),onPinnedIntersectionChange:Qe,getForceNextPinnedInHeader:je}),i.ZP.createElement("div",{className:Lt},We&&i.ZP.createElement(tc,{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(Jt.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")))),jt&&i.ZP.createElement("div",{className:Ct},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(Jt.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:ft},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(Jt.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:ft},Ce("ChannelJoinRequest"))),l&&Ge&&i.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:Ce.isRtl?"rtl":void 0},i.ZP.createElement(Jt.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:It},Ce("BotStart"))),l&&Ve&&i.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:Ce.isRtl?"rtl":void 0},i.ZP.createElement(Jt.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:wt},Ce("BotRestart"))),i.ZP.createElement(ac,{messageListType:$e,isActive:D,canPost:We}),i.ZP.createElement(oc,{isOpen:q}),i.ZP.createElement(rc,{isOpen:$}),s.SX&&i.ZP.createElement(dc,{isOpen:G}))),i.ZP.createElement(yi,{isShown:Ye,canPost:We,withExtraShift:Dt})),l&&i.ZP.createElement(nc,{isActive:Boolean(Fe)})),n&&i.ZP.createElement(sc,{isOpen:Ae,chatId:n,pinnedMessagesCount:C,onClose:mt,onUnpin:ht}),i.ZP.createElement("div",{teactFastList:!0},ee?.map(((e,t)=>i.ZP.createElement(ic,{teactOrderKey:t,key:e.id,activeEmojiInteraction:e})))),i.ZP.createElement(cc,{isOpen:H}))}))),hc=450+o.fK3,gc=(0,I.Ds)((e=>e()),200,!1);var pc=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}(pc||{});const fc=(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:F,setStickerSearchQuery:O,setGifSearchQuery:_,searchTextMessagesLocal:D,toggleManagement:q,openHistoryCalendar:$,openAddContactDialog:H,toggleStatistics:G,setEditingExportedInvite:V,deleteExportedChatInvite:W,openEditTopicPanel:z}=(0,a.Sv)(),[Y,J,K]=(0,kt.Z)(),{isMobile:X}=(0,B.ZP)(),Q=(0,pt.Z)((()=>{V({chatId:n,invite:N}),S(m.u1.EditInvite)})),ee=(0,pt.Z)((()=>{W({chatId:n,link:N.link}),S(m.u1.Invites),K()})),te=(0,pt.Z)((e=>{F({query:e}),e.length&&gc(D)})),ne=(0,pt.Z)((e=>{O({query:e})})),ae=(0,pt.Z)((e=>{_({query:e})})),se=(0,pt.Z)((()=>{H({userId:P})})),oe=(0,pt.Z)((()=>{n&&s&&z({chatId:n,topicId:s})})),ie=(0,pt.Z)((()=>{q()})),ce=(0,pt.Z)((()=>{G()})),[de,le]=(0,i.eJ)(!o);(0,i.d4)((()=>{setTimeout((()=>{le(!o)}),hc)}),[o]);const ue=(0,_t.Z)(),me=r?w===m.vi.Profile?pc.Profile:w===m.vi.SharedMedia?pc.SharedMedia:w===m.vi.MemberList?pc.MemberList:-1:c?pc.Search:p?pc.PollResults:h?pc.StickerSearch:g?pc.GifSearch:v?pc.AddingMembers:d?b===m.u1.Initial?pc.ManageInitial:b===m.u1.ChatPrivacyType?pc.ManageChatPrivacyType:b===m.u1.Discussion?pc.ManageDiscussion:b===m.u1.ChannelSubscribers?pc.ManageChannelSubscribers:b===m.u1.GroupPermissions?pc.ManageGroupPermissions:b===m.u1.ChatAdministrators?pc.ManageChatAdministrators:b===m.u1.GroupRemovedUsers?pc.ManageGroupRemovedUsers:b===m.u1.ChannelRemovedUsers?pc.ManageChannelRemovedUsers:b===m.u1.GroupUserPermissionsCreate?pc.ManageGroupUserPermissionsCreate:b===m.u1.GroupUserPermissions?pc.ManageGroupUserPermissions:b===m.u1.GroupRecentActions?pc.ManageGroupRecentActions:b===m.u1.ChatAdminRights?pc.ManageGroupAdminRights:b===m.u1.ChatNewAdminRights?pc.ManageGroupNewAdminRights:b===m.u1.GroupMembers?pc.ManageGroupMembers:b===m.u1.Invites?pc.ManageInvites:b===m.u1.EditInvite?pc.ManageEditInvite:b===m.u1.GroupAddAdmins?pc.ManageGroupAddAdmins:b===m.u1.Reactions?pc.ManageReactions:b===m.u1.InviteInfo?pc.ManageInviteInfo:b===m.u1.JoinRequests?pc.ManageJoinRequests:void 0:l?pc.Statistics:u?pc.MessageStatistics:f?pc.CreateTopic:I?pc.EditTopic:void 0,he=null!==(t=(0,zn.Z)(me,!0))&&void 0!==t?t:-1,ge=X||me===pc.SharedMedia||me===pc.MemberList||me===pc.AddingMembers||me===pc.MessageStatistics||d,pe=(0,ut.Z)("animated-close-icon",ge&&"state-back",(de||x)&&"no-transition"),fe=(0,i.sO)(null);return(0,Wt.Z)(fe),i.ZP.createElement("div",{className:"RightHeader",ref:fe},i.ZP.createElement(Jt.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(Ot.Z,{name:de||x?"none":"slideFade",activeKey:he},function(){if(-1!==he)switch(he){case pc.PollResults:return i.ZP.createElement("h3",null,ue("PollResults"));case pc.Search:return i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement(Kt.Z,{parentContainerClassName:"RightSearch",value:M,onChange:te}),i.ZP.createElement(Jt.Z,{round:!0,size:"smaller",color:"translucent",onClick:()=>$({selectedAt:(0,re._F)(Date.now())}),ariaLabel:"Search messages by date"},i.ZP.createElement("i",{className:"icon icon-calendar"})));case pc.AddingMembers:return i.ZP.createElement("h3",null,ue(C?"ChannelAddSubscribers":"GroupAddMembers"));case pc.ManageInitial:return i.ZP.createElement("h3",null,ue("Edit"));case pc.ManageChatPrivacyType:return i.ZP.createElement("h3",null,ue(C?"ChannelTypeHeader":"GroupTypeHeader"));case pc.ManageDiscussion:return i.ZP.createElement("h3",null,ue("Discussion"));case pc.ManageChatAdministrators:return i.ZP.createElement("h3",null,ue("ChannelAdministrators"));case pc.ManageGroupRecentActions:return i.ZP.createElement("h3",null,ue("Group.Info.AdminLog"));case pc.ManageGroupAdminRights:return i.ZP.createElement("h3",null,ue("EditAdminRights"));case pc.ManageGroupNewAdminRights:return i.ZP.createElement("h3",null,ue("SetAsAdmin"));case pc.ManageGroupPermissions:return i.ZP.createElement("h3",null,ue("ChannelPermissions"));case pc.ManageGroupRemovedUsers:return i.ZP.createElement("h3",null,ue("BlockedUsers"));case pc.ManageChannelRemovedUsers:return i.ZP.createElement("h3",null,ue("ChannelBlockedUsers"));case pc.ManageGroupUserPermissionsCreate:return i.ZP.createElement("h3",null,ue("ChannelAddException"));case pc.ManageGroupUserPermissions:return i.ZP.createElement("h3",null,ue("UserRestrictions"));case pc.ManageInvites:return i.ZP.createElement("h3",null,ue("lng_group_invite_title"));case pc.ManageEditInvite:return i.ZP.createElement("h3",null,ue(T?"EditLink":"NewLink"));case pc.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(Jt.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(Jt.Z,{round:!0,color:"danger",size:"smaller",ariaLabel:ue("Delete"),onClick:J},i.ZP.createElement("i",{className:"icon icon-delete"})),i.ZP.createElement(aa.Z,{isOpen:Y,onClose:K,title:ue("DeleteLink"),text:ue("DeleteLinkHelp"),confirmIsDestructive:!0,confirmLabel:ue("Delete"),confirmHandler:ee}))));case pc.ManageJoinRequests:return i.ZP.createElement("h3",null,ue(C?"SubscribeRequests":"MemberRequests"));case pc.ManageGroupAddAdmins:return i.ZP.createElement("h3",null,ue("Channel.Management.AddModerator"));case pc.StickerSearch:return i.ZP.createElement(Kt.Z,{value:R,placeholder:ue("SearchStickersHint"),autoFocusSearch:!0,onChange:ne});case pc.GifSearch:return i.ZP.createElement(Kt.Z,{value:k,placeholder:ue("SearchGifsTitle"),autoFocusSearch:!0,onChange:ae});case pc.Statistics:return i.ZP.createElement("h3",null,ue(C?"ChannelStats.Title":"GroupStats.Title"));case pc.MessageStatistics:return i.ZP.createElement("h3",null,ue("Stats.MessageTitle"));case pc.SharedMedia:return i.ZP.createElement("h3",null,ue("SharedMedia"));case pc.ManageChannelSubscribers:return i.ZP.createElement("h3",null,ue("ChannelSubscribers"));case pc.MemberList:case pc.ManageGroupMembers:return i.ZP.createElement("h3",null,ue("GroupMembers"));case pc.ManageReactions:return i.ZP.createElement("h3",null,ue("Reactions"));case pc.CreateTopic:return i.ZP.createElement("h3",null,ue("NewTopic"));case pc.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(Jt.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(Jt.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:ue("Edit"),onClick:ie},i.ZP.createElement("i",{className:"icon icon-edit"})),j&&i.ZP.createElement(Jt.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:ue("EditTopic"),onClick:oe},i.ZP.createElement("i",{className:"icon icon-edit"})),A&&i.ZP.createElement(Jt.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:ue("Statistics"),onClick:ce},i.ZP.createElement("i",{className:"icon icon-stats"}))))}}()))}));var Ic=n(91);var vc=n(27407);function wc(e,t){const[n,a]=(0,vc.Z)(e,t,void 0,o.Vk);return[n,a,!(!n||!t||n[0]===t[0])]}function bc(e,t,n,a,s,r){const c=(0,i.sO)();(0,vt.Z)((()=>{c.current=void 0}),[r]),(0,vt.Z)((()=>{t===e&&a&&s&&(c.current=(0,v.R5)(a,s,e))}),[a,s,t,e]);const[d,l]=(0,vc.Z)(n,c.current,void 0,"media"===e?o.ENB:o.pnA);return[d,l,!(!d||!c.current||d[0]===c.current[0])]}const Zc=(0,I.P2)((e=>e()),250,!1);let Pc=!1;var yc=n(21273),Cc=n(31876),Ec=n(16568),Sc=n(70180),Mc=n(13709),Rc=n(45418),kc=n(47262),Tc=n(41151),Ac=n(22275);const Nc=[{type:"media",title:"SharedMediaTab2"},{type:"documents",title:"SharedFilesTab2"},{type:"links",title:"SharedLinksTab2"},{type:"audio",title:"SharedMusicTab2"}],xc=(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:F,searchMediaMessagesLocal:O,openMediaViewer:_,openAudioPlayer:D,focusMessage:q,loadProfilePhotos:$,setNewChatMembersDialogState:H}=(0,a.Sv)(),G=(0,i.sO)(null),V=(0,i.sO)(null),W=(0,_t.Z)(),[z,Y]=(0,i.eJ)(0),[J,K]=(0,i.eJ)(),X=(0,i.Ye)((()=>[...Z?[{type:"members",title:h?"ChannelSubscribers":"GroupMembers"}]:[],...Nc,...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]=wc(e,p),[Z,P,y]=bc("media",g,n,u,m,h),[C,E,S]=bc("documents",g,n,u,m,h),[M,R,k]=bc("links",g,n,u,m,h),[T,A,N]=bc("audio",g,n,u,m,h),[x,B,L]=bc("voice",g,n,u,m,h),[U,j,F]=wc(t,f);let O,_,D=!1;switch(g){case"members":O=I,_=w,D=b;break;case"commonChats":O=U,_=j,D=F;break;case"media":O=Z,_=P,D=y;break;case"documents":O=C,_=E,D=S;break;case"links":O=M,_=R,D=k;break;case"audio":O=T,_=A,D=N;break;case"voice":O=x,_=B,D=L}return[g,O,_,D]}(U,j,O,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,an.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),Pc=!0,(0,Oa.ZP)(n,s,"start",void 0,void 0,void 0,300),setTimeout((()=>{Pc=!1}),350))}}),[t,a,e]),(0,an.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||(Pc=!0,(0,Oa.ZP)(o,o.firstElementChild,"start",void 0,2*o.offsetHeight),setTimeout((()=>{Pc=!1}),350),a(n))}),[n,e,a]);const s=(0,pt.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)((()=>{Pc||s()}),[s,t]),{handleScroll:(0,pt.Z)((()=>{Pc||Zc(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,pt.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,pt.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,Ga.S1)({rootRef:G,throttleMs:500}),he=(0,pt.Z)((()=>{de(),ue()})),ge=(0,pt.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,pt.Z)((e=>{_({chatId:pe,threadId:u._f,mediaId:e,origin:m.bZ.SharedMedia})})),Ie=(0,pt.Z)((e=>{D({chatId:pe,messageId:e})})),ve=(0,pt.Z)((e=>{F({id:e})})),we=(0,pt.Z)((e=>{q({chatId:pe,messageId:e})})),be=(0,pt.Z)((()=>{K(void 0)}));let Ze;(0,an.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,fn.sf)(V.current,{selectorToPreventScroll:".Profile",onSwipe:(e,t)=>t===fn.eM.Left?(Y(Math.min(Q+1,X.length-1)),!0):t===fn.eM.Right&&(Y(Math.max(0,Q-1)),!0)})}),[Q,X.length]),oe?Ze=A?0:1e3:ne||(Ze=o.Yan);const Pe=(0,ta.Z)([t,n,te,Q],Ze);return i.ZP.createElement(yc.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(Ec.Z,{userId:t||e,canPlayVideo:n}),i.ZP.createElement(Sc.Z,{chatOrUserId:t||e}))}(t,g,A&&Pe),!N&&i.ZP.createElement("div",{className:"shared-media"},i.ZP.createElement(Ot.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(tn.Z,null),t&&i.ZP.createElement(kc.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(kc.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(Mc.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(Us.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(Rc.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(js.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(js.ZP,{key:e,theme:l,message:f[e],senderTitle:(0,Ic.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(Cc.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(Jn.Z,{userId:e,adminMember:M?.[e],forceShowSelf:!0}));var n})):"commonChats"===te?ne.map(((e,t)=>i.ZP.createElement(Cc.Z,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item small-icon",onClick:()=>F({id:e})},i.ZP.createElement(Kn.Z,{chatId:e})))):void 0)}()),i.ZP.createElement(vn.Z,{big:!0,activeTab:Q,tabs:X,onSwitchTab:Y})),y&&i.ZP.createElement(Tc.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(Ac.Z,{isOpen:Boolean(J),userId:J,onClose:be}))}))),Bc=e=>{const t=(0,Tt.Z)(gt.gl.Extra,"RightSearch");return t?i.ZP.createElement(t,e):i.ZP.createElement(Zn.Z,null)},Lc=e=>{const t=(0,Tt.Z)(gt.gl.Extra,"Management");return t?i.ZP.createElement(t,e):i.ZP.createElement(Zn.Z,null)},Uc=e=>{const t=(0,Tt.Z)(gt.gl.Extra,"Statistics");return t?i.ZP.createElement(t,e):i.ZP.createElement(Zn.Z,null)},jc=e=>{const t=(0,Tt.Z)(gt.gl.Extra,"MessageStatistics");return t?i.ZP.createElement(t,e):i.ZP.createElement(Zn.Z,null)},Fc=()=>{const e=(0,Tt.Z)(gt.gl.Extra,"StickerSearch");return e?i.ZP.createElement(e,null):i.ZP.createElement(Zn.Z,null)},Oc=()=>{const e=(0,Tt.Z)(gt.gl.Extra,"GifSearch");return e?i.ZP.createElement(e,null):i.ZP.createElement(Zn.Z,null)},_c=()=>{const e=(0,Tt.Z)(gt.gl.Extra,"PollResults");return e?i.ZP.createElement(e,null):i.ZP.createElement(Zn.Z,null)};var Dc=n(11820);const qc=(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,_t.Z)(),[b,Z]=(0,i.eJ)([]),P=(0,qn.Z)(b)===b;(0,In.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(Dc.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(Tc.Z,{isShown:Boolean(b.length),disabled:d,ariaLabel:w("lng_channel_add_users"),onClick:S},d?i.ZP.createElement(tn.Z,{color:"white"}):i.ZP.createElement("i",{className:"icon icon-arrow-right"}))))}))),$c=e=>{const t=(0,Tt.Z)(gt.gl.Extra,"CreateTopic");return t?i.ZP.createElement(t,e):i.ZP.createElement(Zn.Z,null)},Hc=e=>{const t=(0,Tt.Z)(gt.gl.Extra,"EditTopic");return t?i.ZP.createElement(t,e):i.ZP.createElement(Zn.Z,null)},Gc=450+o.fK3,Vc=Object.keys(m.qt).length/2,Wc=Object.keys(m.u1).length/2;function zc(){const e=document.querySelector(".RightHeader .SearchInput input");e&&e.blur()}const Yc=(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,_n.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)(),F=T!==m.vi.Profile,O=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)(!O),ee=null!==(t=(0,zn.Z)(n,!0,!l))&&void 0!==t?t:-1,te=(0,pt.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(F&&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:zc(),f();break;case m.qt.StickerSearch:zc(),I({query:void 0});break;case m.qt.GifSearch:zc(),v({query:void 0});break;case m.qt.PollResults:w();break;case m.qt.CreateTopic:M();break;case m.qt.EditTopic:R()}})),ne=(0,pt.Z)(((e,t)=>{L(e),j(t)})),ae=(0,pt.Z)((e=>{b({chatId:s,memberIds:e})}));function se(e){if(-1!==ee)switch(ee){case m.qt.AddingMembers:return i.ZP.createElement(qc,{key:`add_chat_members_${s}`,chatId:s,isActive:O&&e,onNextStep:ae,onClose:te});case m.qt.ChatInfo:return i.ZP.createElement(xc,{key:`profile_${s}`,chatId:s,topicId:d?r:void 0,profileState:T,isMobile:c,onProfileStateChange:A});case m.qt.Search:return i.ZP.createElement(Bc,{key:`right_search_${s}`,chatId:s,threadId:r,onClose:te,isActive:O&&e});case m.qt.Management:return i.ZP.createElement(Lc,{key:`management_${s}_${N}`,chatId:s,currentScreen:N,isPromotedByCurrentUser:U,selectedChatMemberId:B,isActive:O&&e,onScreenSelect:x,onChatMemberSelect:ne,onClose:te});case m.qt.Statistics:return i.ZP.createElement(Uc,{chatId:s});case m.qt.MessageStatistics:return i.ZP.createElement(jc,{chatId:s,isActive:O&&e});case m.qt.StickerSearch:return i.ZP.createElement(Fc,{onClose:te,isActive:O&&e});case m.qt.GifSearch:return i.ZP.createElement(Oc,{onClose:te,isActive:O&&e});case m.qt.PollResults:return i.ZP.createElement(_c,{onClose:te,isActive:O&&e});case m.qt.CreateTopic:return i.ZP.createElement($c,{onClose:te,isActive:O&&e});case m.qt.EditTopic:return i.ZP.createElement(Hc,{onClose:te,isActive:O&&e})}}return(0,i.d4)((()=>O?(0,Ut.Z)(te):void 0),[O,te]),(0,i.d4)((()=>{setTimeout((()=>{Q(!O)}),Gc)}),[O]),(0,i.d4)((()=>{h&&(x(h),S(void 0))}),[h,S]),(0,i.d4)((()=>{O&&K&&te()}),[K]),(0,$a.Z)((e=>{let[t]=e;t!==s&&(A(m.vi.Profile),x(m.u1.Initial))}),[s]),(0,In.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(fc,{chatId:s,threadId:r,isColumnOpen:O,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(Ot.Z,{name:X||u?"none":"zoomFade",renderCount:Vc+Wc,activeKey:q?Vc+N:ee,shouldCleanup:!0,cleanupExceptionKey:ee===m.qt.MessageStatistics?m.qt.Statistics:void 0},se)))}))),Jc=e=>{let{isOpen:t}=e;const n=(0,Tt.Z)(gt.gl.Extra,"MediaViewer",!t);return n?i.ZP.createElement(n,null):void 0};var Kc=n(6562);const Xc=new Set,Qc=new Set,ed=(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,Da.Z)(1e3,!0),c=(0,pt.Z)((e=>{Qc.add(e),r((()=>{Qc.size&&(n({messages:Array.from(Qc)}),Qc.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(Xc.has(e))return;Xc.add(e);const t=(0,v.Ti)(e,"download");if(!t)return void c(e);const n=xe.UV(t);if(n)return(0,Kc.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");xe.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,Kc.Z)(t,(0,v.w6)(e));c(e)}))})):Xc.clear()}),[t,n,c,o])})));var td=n(34563);const nd=(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,ue.Sv)(),r=(0,_t.Z)(),{url:c,chatId:d,messageId:l}=t||{},u=Boolean(c),m=(0,Oi.Z)(d);(0,St.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(td.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"}))}))),ad=e=>{let{isOpen:t}=e;const n=(0,Tt.Z)(gt.gl.Extra,"Notifications",!t);return n?i.ZP.createElement(n,null):void 0},sd=e=>{let{isOpen:t}=e;const n=(0,Tt.Z)(gt.gl.Extra,"Dialogs",!t);return n?i.ZP.createElement(n,null):void 0},od=e=>{const{isOpen:t}=e,n=(0,Tt.Z)(gt.gl.Extra,"ForwardRecipientPicker",!t);return n?i.ZP.createElement(n,e):void 0},id=e=>{const{url:t}=e,n=(0,Tt.Z)(gt.gl.Extra,"SafeLinkModal",!t);return n?i.ZP.createElement(n,e):void 0},rd=e=>{const{isOpen:t}=e,n=(0,Tt.Z)(gt.gl.Extra,"HistoryCalendar",!t);return n?i.ZP.createElement(n,e):void 0},cd=e=>{const{groupCallId:t}=e,n=(0,Tt.Z)(gt.gl.Calls,"GroupCall",!t);return n?i.ZP.createElement(n,e):void 0},dd=e=>{const{isActive:t}=e,n=(0,Tt.Z)(gt.gl.Calls,"ActiveCallHeader",!t);return n?i.ZP.createElement(n,null):void 0},ld=e=>{const{isActive:t}=e,n=(0,Tt.Z)(gt.gl.Calls,"PhoneCall",!t);return n?i.ZP.createElement(n,null):void 0};function ud(){return ud=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},ud.apply(this,arguments)}const md=(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,In.Z)({isActive:!0,hash:(0,je.tB)(t,n,a),onBack:s})};return i.ZP.createElement("div",null,t?.map(((e,t)=>i.ZP.createElement(o,ud({key:`${e.chatId}_${e.threadId}_${e.type}_${t}`},e)))))}))),hd=e=>{const{isOpen:t}=e,n=(0,Tt.Z)(gt.gl.Extra,"NewContactModal",!t);return n?i.ZP.createElement(n,e):void 0},gd=e=>{const{isOpen:t}=e,n=(0,Tt.Z)(gt.gl.Calls,"RatePhoneCallModal",!t);return n?i.ZP.createElement(n,e):void 0},pd=e=>{const{webApp:t}=e,n=(0,Tt.Z)(gt.gl.Extra,"WebAppModal",!t);return n?i.ZP.createElement(n,e):void 0},fd=e=>{const{bot:t}=e,n=(0,Tt.Z)(gt.gl.Extra,"BotTrustModal",!t);return n?i.ZP.createElement(n,e):void 0},Id=e=>{const{bot:t}=e,n=(0,Tt.Z)(gt.gl.Extra,"AttachBotInstallModal",!t);return n?i.ZP.createElement(n,e):void 0},vd={root:"vfd0Bo1X6k19aaxQ577t"},wd=["#E8BC2C","#D0049E","#02CBFE","#5723FD","#FE8C27","#6CB859"],bd=(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,_n.Z)(),r=(0,yt.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=wd[Math.floor(Math.random()*wd.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,vt.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,jn.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:vd.root,style:v},i.ZP.createElement("canvas",{ref:n,className:vd.canvas,width:o.width,height:o.height}))}))),Zd=e=>{const{urlAuth:t}=e,n=(0,Tt.Z)(gt.gl.Extra,"UrlAuthModal",!t);return n?i.ZP.createElement(n,e):void 0},Pd=e=>{const{isOpen:t}=e,n=(0,Tt.Z)(gt.gl.Extra,"PremiumMainModal",!t);return n?i.ZP.createElement(n,e):void 0},yd=e=>{const{isOpen:t}=e,n=(0,Tt.Z)(gt.gl.Extra,"PaymentModal",!t);return n?i.ZP.createElement(n,e):void 0},Cd=e=>{const{isOpen:t}=e,n=(0,Tt.Z)(gt.gl.Extra,"ReceiptModal",!t);return n?i.ZP.createElement(n,e):void 0},Ed=e=>{const{limit:t}=e,n=(0,Tt.Z)(gt.gl.Extra,"PremiumLimitReachedModal",!t);return n?i.ZP.createElement(n,e):void 0},Sd=e=>{const{folder:t}=e,n=(0,Tt.Z)(gt.gl.Extra,"DeleteFolderDialog",!t);return n?i.ZP.createElement(n,e):void 0},Md=e=>{const{customEmojiSetIds:t}=e,n=(0,Tt.Z)(gt.gl.Extra,"CustomEmojiSetsModal",!t);return n?i.ZP.createElement(n,e):void 0},Rd=e=>{const{requestedDraft:t}=e,n=(0,Tt.Z)(gt.gl.Extra,"DraftRecipientPicker",!t);return n?i.ZP.createElement(n,e):void 0},kd=e=>{const{requestedAttachBotInChat:t}=e,n=(0,Tt.Z)(gt.gl.Extra,"AttachBotRecipientPicker",!t);return n?i.ZP.createElement(n,e):void 0},Td=e=>{const{isOpen:t,shouldLoad:n}=e,a=(0,Tt.Z)(gt.gl.Extra,"ReactionPicker",!t&&!n);return a?i.ZP.createElement(a,e):void 0},Ad=e=>{const{info:t}=e,n=(0,Tt.Z)(gt.gl.Extra,"ChatlistModal",!t);return n?i.ZP.createElement(n,e):void 0};let Nd=!1;const xd=(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),F=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:F,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:F,attachBotToInstall:O,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:Fe}=(0,a.Sv)();o.eMD&&!Nd&&(Nd=!0,console.log(">>> RENDER MAIN")),(0,Rt.Z)((()=>{(0,gt.Pb)(gt.gl.Calls)}),5e3);const[Oe,_e]=(0,kt.Z)(!1);(0,Rt.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,St.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,(()=>{Fe(!0)})),t=window.electron.on(d.I.UPDATE_ERROR,(()=>{Fe(!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,je.dx)();e?.tgaddr&&(0,ht.ou)(decodeURIComponent(e.tgaddr))}),[]),(0,i.d4)((()=>{const e=(0,je.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,Ct.Z)(n,void 0,!0,void 0,b,void 0,!0),Ge=(0,i.sO)(!1),Ve=(0,yt.Z)();(0,vt.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,Et.YW)();(0,mt.L)(document.getElementById("MiddleColumn"),(()=>{a(),Ge.current=!1,Ve()}))}),[n,E,Ve]);const ze=(0,Ct.Z)(u,void 0,!0,void 0,b,void 0,!0),Ye=(0,i.sO)(!1),[Je,Ke]=(0,i.eJ)(u),Xe=(0,Mt.Ar)();(0,vt.Z)((e=>{let[t,n]=e;if(void 0===n||u===n)return;if(!t||Q)return void Ke(u);Ye.current=!0;const a=(0,Et.YW)();(0,mt.L)(document.getElementById("RightColumn"),(()=>{a(),Ye.current=!1,Ve(),Ke(u)}))}),[l,u,Q,Ve]);const Qe=(0,ut.Z)(He.hasShownClass&&"left-column-shown",He.hasOpenClass&&"left-column-open",Ge.current&&"left-column-animating",ze.hasShownClass&&"right-column-shown",ze.hasOpenClass&&"right-column-open",Ye.current&&"right-column-animating",Je&&"narrow-message-list",b&&"history-animation-disabled",Xe&&"is-fullscreen"),et=(0,pt.Z)((()=>{ie({isBlurred:!0})})),tt=(0,pt.Z)((()=>{ie({isBlurred:!1}),document.title.includes(o.ouc)||xe(),We(!1)})),nt=(0,pt.Z)((()=>{ve()})),at=(0,pt.Z)((()=>{we()}));return(0,ft.Z)(et,tt,!!o.D$V),It(et),function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];(0,i.d4)((()=>{if(s.$b){if(!e)return wt?.setAttribute("content",bt),s.cj&&!s.fl&&document.addEventListener("gesturestart",Pt),()=>{wt?.setAttribute("content","width=device-width, initial-scale=1, shrink-to-fit=no"),s.cj&&!s.fl&&document.removeEventListener("gesturestart",Pt)};wt?.setAttribute("content",Zt)}}),[e])}(m),i.ZP.createElement("div",{ref:De,id:"Main",className:Qe},i.ZP.createElement(Ln,{ref:qe}),i.ZP.createElement(mc,{leftColumnRef:qe,isMobile:t}),i.ZP.createElement(Yc,{isMobile:t}),i.ZP.createElement(Jc,{isOpen:m}),i.ZP.createElement(od,{isOpen:h}),i.ZP.createElement(Rd,{requestedDraft:D}),i.ZP.createElement(ad,{isOpen:g}),i.ZP.createElement(sd,{isOpen:p}),f&&i.ZP.createElement(Ta,{key:f.id,message:f,noUi:!0}),i.ZP.createElement(id,{url:v}),i.ZP.createElement(Zd,{urlAuth:H,currentUserName:$}),i.ZP.createElement(rd,{isOpen:w}),i.ZP.createElement(At,{isOpen:Boolean(P),onClose:nt,stickerSetShortName:P}),i.ZP.createElement(Md,{customEmojiSetIds:y,onClose:at}),I&&i.ZP.createElement(cd,{groupCallId:I}),i.ZP.createElement(dd,{isActive:Boolean(I||T)}),i.ZP.createElement(hd,{isOpen:Boolean(A||N),userId:A,isByPhoneNumber:N}),i.ZP.createElement(Ad,{info:X}),i.ZP.createElement(nd,{openedGame:x,gameTitle:L}),i.ZP.createElement(pd,{webApp:q}),i.ZP.createElement(ed,null),i.ZP.createElement(bd,null),i.ZP.createElement(ld,{isActive:T}),i.ZP.createElement(Lt,{isForAppBadge:!0}),i.ZP.createElement(gd,{isOpen:U}),i.ZP.createElement(fd,{bot:F,type:j?.type,shouldRequestWriteAccess:j?.shouldRequestWriteAccess}),i.ZP.createElement(Id,{bot:O}),i.ZP.createElement(kd,{requestedAttachBotInChat:_}),i.ZP.createElement(md,null),G&&i.ZP.createElement(Pd,{isOpen:G}),i.ZP.createElement(Ed,{limit:Z}),i.ZP.createElement(yd,{isOpen:V,onClose:Me}),i.ZP.createElement(Cd,{isOpen:W,onClose:Re}),i.ZP.createElement(Sd,{folder:J}),i.ZP.createElement(Td,{isOpen:z,shouldLoad:Oe}))})));var Bd=n(57773),Ld=n(21179),Ud=n(99364),jd=n(8337);var Fd=n(2092);const Od=(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,_t.Z)(),[h,g]=(0,i.eJ)(""),[p,f]=(0,i.eJ)(!1),[I,v,w]=(0,kt.Z)(!1),{shouldRender:b}=(0,Ct.Z)(t);(0,Rt.Z)(c,l?l-Date.now():void 0);const Z=(0,i.I4)((()=>{g("")}),[]),P=(0,i.I4)((e=>{void 0===l?(g(""),(0,nt.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(Ld.Z,{tgsUrl:Bd.l.Lock,previewUrl:Fd,size:160,className:"ar9YdQbWJreREHmnZa9m"}),i.ZP.createElement(Ud.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(jd.Z,{onClick:v},"Log out")," ","if you don't remember your passcode."),i.ZP.createElement("p",null,i.ZP.createElement(Jt.Z,{color:"translucent",size:"tiny",isText:!0,onClick:v},m("AccountSettings.Logout"))))),i.ZP.createElement(aa.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:_d},connectionState:Dd}=(0,a.Rd)();Dd||_d||s.Eo||(0,a.Sv)().initApi()},68973:(e,t,n)=>{e.exports=n.p+"encoderWorker.min.8ea62f6317fbac7d4558.js"}}]);
|
||
//# sourceMappingURL=5769.5a55067ce71024a0c4bd.js.map
|