(self.webpackChunktelegram_t=self.webpackChunktelegram_t||[]).push([[7768],{49434:(e,t,a)=>{"use strict";a.r(t),a.d(t,{LockScreen:()=>cd,Main:()=>od});var s=a(13439),n=a(31481),o=a(82393),i=(a(48544),a(42347)),r=a(97335),c=a(89925),d=a(85982),l=a(46275),u=a(62076),m=a(14487),h=a(87894),p=a(50140),g=a(47985),y=a(37836),f=a(4875),I=a(59589),A=a(46205),v=a(32989),b=a(29807),w=a(22986),S=a(97312),C=a(26129),E=a(43503),M=a(76023);const k=32*M.$,P=45.5*M.$,T=26.5*M.$,N=16*M.$,x=16.125*M.$;var U=a(16350),R=a(26149),F=a(43874);function B(e,t){return t-((0,b.nTw)(e).isLeftColumnShown&&!(0,F.Ny)()?e.leftColumnWidth||((a=E.A.get().width)>n.gQx?Math.min(Math.max(.25*a,N),.33*a):a>n.j7z?Math.min(Math.max(.33*a,N),.4*a):T):0);var a}function L(e,t,a){const s=(0,b.nZ4)(e,t.chatId),n=t.reactions||{results:[],areTags:s},o=(0,b.VF$)(e,t.chatId),i=(0,I.AK)(n.results,a);let{recentReactions:r=[]}=n;return r.length&&(r=r.filter((t=>{let{isOwn:a,peerId:s}=t;return!a&&s!==e.currentUserId}))),a.forEach((t=>{const{currentUserId:a}=e;r.unshift({peerId:o?.id||a,reaction:t,addedDate:Math.floor(Date.now()/1e3),isOwn:!0})})),(0,R.r3)(e,t.chatId,t.id,{reactions:{...n,results:i,recentReactions:r}})}function J(e,t,a){return(0,U.wi)(e,t,a,void 0,!0)}const O=350;function D(e,t,a,s,n,o,i,r){const c=r?.reactions;if(c&&(0,w.T)(n,c))return e;if(e=(0,A.r3)(e,a,s,{reactions:n}),!i)return e;const{reaction:d,isOwn:l,isUnread:u}=n.recentReactions?.[0]??{};if((0,b.xYJ)(e,"reactionEffects")&&r&&d&&u&&!l){const e=(0,p.bj)(r);t.startActiveReaction({containerId:e,reaction:d,tabId:(0,m.g0)()})}const h=o.unreadReactions?.includes(s),g=(0,I.pU)(e,n);if(g&&!h){e=J(e,a,{unreadReactionsCount:(o?.unreadReactionsCount||0)+1,unreadReactions:[...o?.unreadReactions||[],s].sort(((e,t)=>t-e))});const t=(0,b.O5q)(e,a,s);if(!o||!t)return e;(0,y.aj)((()=>{(0,S.Oq)({chat:o,message:t,isReaction:!0})}))}return!g&&h&&(e=J(e,a,{unreadReactionsCount:(o?.unreadReactionsCount||1)-1,unreadReactions:o?.unreadReactions?.filter((e=>e!==s))})),e}function V(e,t,a,s){let n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const o=n?(0,b.Jl6)(e,t,a):(0,b.O5q)(e,t,a);if(o&&s.content&&!(0,p.iL)(a)){const{photo:e,video:t,sticker:a,document:n}=(0,I.r_)(o);var i,r;if(e&&s.content.photo)(i=s.content.photo).blobUrl??(i.blobUrl=e.blobUrl),(r=s.content.photo).thumbnail??(r.thumbnail=e.thumbnail);else if(t&&s.content.video){var c;(c=s.content.video).blobUrl??(c.blobUrl=t.blobUrl)}else if(a&&s.content.sticker){var d;(d=s.content.sticker).isPreloadedGlobally??(d.isPreloadedGlobally=a.isPreloadedGlobally)}else if(n&&s.content.document){var l;(l=s.content.document).previewBlobUrl??(l.previewBlobUrl=n.previewBlobUrl)}}const u=o?{...o,...s}:s;return n?(0,A.Eg)(e,t,a,u):(0,A.r3)(e,t,a,u)}function j(e,t,a,s){const{chatId:n}=a,o=(0,C.Q)(a),{threadInfo:i}=(0,b.Tac)(e,a)||{};if(!i&&o?.replyToMsgId){const i=(0,b.O5q)(e,n,o.replyToMsgId);i?e=(0,A.Ww)(e,i,n,a.id,s):t.loadMessage({chatId:n,messageId:o.replyToMsgId,threadUpdate:{isDeleting:s,lastMessageId:a.id}})}return e}function G(e,t,a){const{id:s,chatId:n}=a,o=(0,b.QP5)(e,a),{threadInfo:i}=(0,b.Tac)(e,a)||{},c=(0,b.hds)(e,n),d=c?.unreadCount&&!(0,b.gCU)(e,n,r.l3);e=j(e,t,a);const{threadId:l}=i??{threadId:o};return l&&(e=(0,A.d4)(e,n,l,[s]),Object.values(e.byTabId).forEach((t=>{let{id:a}=t;if((0,b.haw)(e,n,l,a)){const t=(0,b.RjD)(e,n,l),o=(0,A.fg)(e,n,l,s,a),i=(0,b.rA3)(o,n,l,a);t&&!i.includes(t)||(e=o)}})),i&&(e=(0,A.ew)(e,n,l,"threadInfo",{...i,lastMessageId:a.id}),(0,I.Nb)(a)||(0,I._P)(a)||(e=(0,A.eA)(e,n,l,{messagesCount:(i.messagesCount||0)+1})))),d||(e=(0,A.d4)(e,n,r.l3,[s]),Object.values(e.byTabId).forEach((t=>{let{id:a}=t;if((0,b.haw)(e,n,r.l3,a)){const t=(0,b.RjD)(e,n,r.l3),o=(0,A.fg)(e,n,r.l3,s,a),i=(0,b.rA3)(o,n,r.l3,a);t&&!i.includes(t)||(e=o)}}))),e}function q(e,t,a){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{chats:n}=e,o=n.byId[t],i=(0,b.ZZX)(e,t),r=o?.isForum?(0,b.nkm)(e,a):void 0;r&&(e=(0,A.Tw)(e,t,r.id,{lastMessageId:a.id}));const c=(0,b.QP5)(e,a);return c&&(e=(0,A.yK)(e,c,a.id,"saved")),!i||s||i===a.id||i===a.previousLocalId||a.id>i?(0,A.yK)(e,t,a.id):e}function z(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:r.l3;const s=(0,b.zeq)(e,t),n=(0,b.gCU)(e,t,a);if(!s||!n)return;let o=n.length;for(;o--;){const e=s[n[o]];if(e&&!e.isDeleting)return e}}function H(e,t,a,n){if(t){const o=(0,b.hds)(e,t);if(!o)return;const i=new Set;i.add(r.l3),a.forEach((a=>{e=(0,A.r3)(e,t,a,{isDeleting:!0}),o.topics?.[a]&&(e=(0,A.do)(e,t,a));const s=(0,b.O5q)(e,t,a);if(!s)return;e=j(e,n,s,!0);const r=(0,b.L_2)(e,s);r&&i.add(r)})),n.requestChatUpdate({chatId:t});const c=new Set(a);return i.forEach((a=>{const s=(0,b.Vw0)(e,t,a);if(!s?.lastMessageId||!c.has(s.lastMessageId))return;const n=z(e,t,a);n&&(a===r.l3&&(e=q(e,t,n,!0)),e=(0,A.eA)(e,t,a,{lastMessageId:n.id}),o.isForum&&(e=(0,A.Tw)(e,t,Number(a),{lastMessageId:n.id})))})),(0,s.UF)(e),void setTimeout((()=>{e=(0,s.mS)(),e=(0,A.AH)(e,t,a),(0,s.UF)(e)}),O)}const o=[];a.forEach((t=>{const a=(0,b.Egn)(e,t);if(a){o.push(a);const i=z(e=(0,A.r3)(e,a,t,{isDeleting:!0}),a);i&&(e=q(e,a,i,!0));const r=(0,b.O5q)(e,a,t);if((0,b.nZ4)(e,a)&&r){const t=(0,b.L_2)(e,r);if((0,I.cG)(a,t,e.currentUserId)){const s=z(e,a,t);n.requestSavedDialogUpdate({chatId:String(t)}),s&&(e=(0,A.yK)(e,a,s.id,"saved"))}}setTimeout((()=>{e=(0,s.mS)(),e=(0,A.AH)(e,a,[t]),(0,s.UF)(e)}),O)}})),(0,s.UF)(e),(0,h.Am)(o).forEach((e=>{n.requestChatUpdate({chatId:e})}))}(0,s.aJ)("apiUpdate",((e,t,a)=>{switch(a["@type"]){case"newMessage":{const{chatId:n,id:o,message:i,shouldForceReply:r,wasDrafted:c}=a;e=G(e=V(e,n,o,i),t,i);const d=(0,b.O5q)(e,n,o),l=(0,C.Q)(d),u=(0,C.W)(d),m=(0,b.hds)(e,n);m?.isForum&&l?.isForumTopic&&!(0,b.nkm)(e,d)&&l.replyToMsgId&&t.loadTopicById({chatId:n,topicId:l.replyToMsgId});const h=(0,I.Nb)(i);if(Object.values(e.byTabId).forEach((a=>{let{id:l}=a;h&&c&&(e=q(e,n,d));const m=(0,b.L_2)(e,d);if(e=(0,A.PK)(e,d,n,m,l),(0,b.fo$)(e,n,i,l)){if(h&&i.isOutgoing&&!i.content?.action&&!u?.storyId&&!i.content?.storyData){const a=(0,b.Xf0)(e,l);a&&t.focusMessage({chatId:n,threadId:a.threadId,messageId:i.id,noHighlight:!0,isResizingContainer:!0,tabId:l})}h||setTimeout((()=>{e=(0,s.mS)(),r&&t.updateDraftReplyInfo({replyToMsgId:o,tabId:l}),e=q(e,n,d),(0,s.UF)(e)}),O)}else e=q(e,n,d)})),(0,s.UF)(e),(0,b.mJZ)(e,n)||t.loadTopChats(),(0,b.nZ4)(e,n)&&!h){const a=(0,b.QP5)(e,d);a&&!(0,b.mJZ)(e,a,"saved")&&t.requestSavedDialogUpdate({chatId:a})}break}case"updateChatLastMessage":{const{id:t,lastMessage:n}=a;e=q(e,t,n,!0),e=(0,A.Kc)(e,[n]),(0,s.UF)(e);break}case"updateStartEmojiInteraction":Object.values(e.byTabId).forEach((t=>{let{id:s}=t;const{chatId:n}=(0,b.Xf0)(e,s)||{};if(n!==a.id)return;const o=(0,b.O5q)(e,n,a.messageId);if(!o)return;if((0,I.P5)(o)!==a.emoji)return;const i=(0,b.nTw)(e,s);e=(0,v.w)(e,{activeEmojiInteractions:[...i.activeEmojiInteractions||[],{id:Math.random(),animatedEffect:a.emoji,messageId:a.messageId}]},s)})),(0,s.UF)(e);break;case"newScheduledMessage":{const{chatId:t,id:n,message:o}=a;e=V(e,t,n,o,!0);const i=(0,b.K3w)(e,t,r.l3)||[];e=(0,A.ew)(e,t,r.l3,"scheduledIds",(0,h.Am)([...i,n]));const c=(0,b.L_2)(e,o);if(c!==r.l3){const a=(0,b.K3w)(e,t,c)||[];e=(0,A.ew)(e,t,c,"scheduledIds",(0,h.Am)([...a,n]))}(0,s.UF)(e);break}case"updateMessage":{const{chatId:n,id:o,message:i}=a,r=(0,b.O5q)(e,n,o),c=(0,b.hds)(e,n);e=V(e,n,o,i);const d=(0,b.O5q)(e,n,o);i.reactions&&c&&(e=D(e,t,n,o,i.reactions,c,d.isOutgoing,r)),i.content?.text?.text!==r?.content?.text?.text&&(e=(0,A.gt)(e,n,o)),(0,s.UF)(e);break}case"updateScheduledMessage":{const{chatId:t,id:n,message:o}=a,i=(0,b.Jl6)(e,t,n);if(!i)return;e=V(e,t,n,o,!0);const c=Object.keys((0,b.yFI)(e,t)||{}).map(Number).sort(((e,t)=>t-e));e=(0,A.ew)(e,t,r.l3,"scheduledIds",c);const d=(0,b.L_2)(e,i);if(d!==r.l3){const a=(0,b.K3w)(e,t,d)||[];e=(0,A.ew)(e,t,d,"scheduledIds",a.sort(((e,t)=>t-e)))}(0,s.UF)(e);break}case"updateQuickReplyMessage":{const{id:t,message:n}=a;e=(0,A.QN)(e,t,n),(0,s.UF)(e);break}case"deleteQuickReplyMessages":{const{messageIds:t}=a;e=(0,A.v)(e,t),(0,s.UF)(e);break}case"updateQuickReplies":{const{quickReplies:t}=a,n=(0,h.dU)(t,"id");e=(0,A.xA)(e,n),(0,s.UF)(e);break}case"deleteQuickReply":e=(0,A.hj)(e,a.quickReplyId),(0,s.UF)(e);break;case"updateMessageSendSucceeded":{const{chatId:n,localId:o,message:i}=a;e=G(e,t,i);const c=(0,b.O5q)(e,n,o);e=(0,A.AH)(e,n,[o]),i.isScheduled&&(e=(0,A.XA)(e,n,[o])),e=(0,A.r3)(e,n,i.id,{...c,...i,previousLocalId:o}),e={...e,fileUploads:{byMessageKey:(0,h.cJ)(e.fileUploads.byMessageKey,[(0,p.bj)(i)])}};const d=(0,b.O5q)(e,n,i.id);e=q(e,n,d);const l=(0,b.Tac)(e,i);if(Object.values(e.byTabId).forEach((a=>{let{id:s}=a;const{chatId:o,threadId:c}=(0,b.Xf0)(e,s)||{};o===n&&(l?.threadInfo?.threadId||r.l3)===c&&t.markMessageListRead({maxId:i.id,tabId:s})})),l?.threadInfo?.threadId&&(e=(0,A.ew)(e,n,l.threadInfo.threadId,"threadInfo",{...l.threadInfo,lastMessageId:i.id,lastReadInboxMessageId:i.id})),e=(0,A.wi)(e,n,{lastReadInboxMessageId:i.id}),(0,b.nZ4)(e,n)){const a=(0,b.QP5)(e,d);a&&!(0,b.mJZ)(e,a,"saved")&&t.requestSavedDialogUpdate({chatId:a})}(0,s.UF)(e);break}case"updateScheduledMessageSendSucceeded":{const{chatId:t,localId:n,message:o}=a,i=(0,b.K3w)(e,t,r.l3)||[];e=(0,A.ew)(e,t,r.l3,"scheduledIds",[...i,o.id]);const c=(0,b.L_2)(e,o);if(c!==r.l3){const a=(0,b.K3w)(e,t,c)||[];e=(0,A.ew)(e,t,c,"scheduledIds",[...a,o.id])}const d=(0,b.Jl6)(e,t,n);e=(0,A.XA)(e,t,[n]),e=(0,A.Eg)(e,t,o.id,{...d,...o,previousLocalId:n}),(0,s.UF)(e);break}case"updatePinnedIds":{const{chatId:t,isPinned:n,messageIds:o}=a,i=(0,h._E)((0,b.zeq)(e,t),o),c={[r.l3]:o};Object.values(i).forEach((a=>{const s=(0,b.L_2)(e,a);if(e=(0,A.r3)(e,t,a.id,{isPinned:n}),s===r.l3)return;const o=c[s]||[];o.push(a.id),c[s]=o})),Object.entries(c).forEach((a=>{let[s,o]=a;const i=(0,b.fcC)(e,t,r.l3)||[],c=n?(0,h.Am)(i.concat(o)).sort(((e,t)=>t-e)):i.filter((e=>!o.includes(e)));e=(0,A.ew)(e,t,Number(s),"pinnedIds",c)})),(0,s.UF)(e);break}case"updateThreadInfos":{const{threadInfoUpdates:n}=a;e=(0,A.Ng)(e,n),n.forEach((a=>{const{chatId:s,threadId:n}=a;if(!s||!n)return;const o=(0,b.hds)(e,s),i=(0,b.Vw0)(e,s,n);if(o?.isForum&&a.lastReadInboxMessageId!==i?.lastReadInboxMessageId&&t.loadTopicById({chatId:s,topicId:Number(n)}),!o?.isForum){const t=o?.lastReadInboxMessageId,i=a.lastReadInboxMessageId||t;t&&i&&(e=(0,A.eA)(e,s,n,{lastReadInboxMessageId:Math.max(i,t)}))}})),(0,s.UF)(e);break}case"resetMessages":{const{id:n}=a,o=(0,b.zeq)(e,n);if(o&&!(0,I.L8)(n)){const a=(0,m.g0)();e=(0,A.AH)(e,n,Object.keys(o).map(Number)),(0,s.UF)(e),t.loadFullChat({chatId:n,force:!0,tabId:a}),t.loadViewportMessages({chatId:n,threadId:r.l3,tabId:a})}break}case"deleteMessages":{const{ids:s,chatId:n}=a;H(e,n,s,t);break}case"deleteScheduledMessages":{const{ids:t,chatId:n}=a;!function(e,t,a,n){e&&(t.forEach((t=>{n=(0,A.Eg)(n,e,t,{isDeleting:!0})})),(0,s.UF)(n),setTimeout((()=>{n=(0,s.mS)(),n=(0,A.XA)(n,e,t);const a=(0,b.yFI)(n,e);n=(0,A.ew)(n,e,r.l3,"scheduledIds",Object.keys(a||{}).map(Number)),(0,s.UF)(n)}),O))}(n,t,0,e);break}case"deleteHistory":{const{chatId:o}=a,i=e.messages.byChatId[o];if(o===n.zv8&&(e={...e,serviceNotifications:e.serviceNotifications.map((e=>({...e,isDeleted:!0})))},(0,s.UF)(e)),i){const a=Object.keys(i.byId).map(Number);H(e=(0,s.mS)(),o,a,t)}else t.requestChatUpdate({chatId:o});e=(0,s.mS)(),e=(0,A.SJ)(e,o),(0,s.UF)(e);break}case"deleteSavedHistory":{const{chatId:n}=a,o=e.currentUserId;e=(0,A.SJ)(e,n,"saved"),(0,s.UF)(e),function(e,t,a,s){const n=(0,b.zeq)(e,t);if(!n)return;const o=Object.values(n).filter((t=>(0,b.L_2)(e,t)===a)).map((e=>e.id));o.length&&H(e,t,o,s)}(e=(0,s.mS)(),o,n,t);break}case"updateCommonBoxMessages":{const{ids:t,messageUpdate:n}=a;t.forEach((t=>{const a=(0,b.Egn)(e,t);a&&(e=(0,A.r3)(e,a,t,n))})),(0,s.UF)(e);break}case"updateChannelMessages":{const{channelId:t,ids:n,messageUpdate:o}=a;n.forEach((a=>{e=(0,A.r3)(e,t,a,o)})),(0,s.UF)(e);break}case"updateMessagePoll":{const{pollId:t,pollUpdate:n}=a,o=(0,b.zg4)(e,t);if(o?.content.poll){const t=o.content.poll.results;let a=t;n.results?.results&&(t.results&&n.results.isMin?t.results&&(a={...n.results,results:n.results.results.map((e=>({...e,isChosen:t.results.find((t=>t.option===e.option))?.isChosen}))),isMin:void 0}):a=n.results);const i={...o.content.poll,...n,results:a};e=(0,A.r3)(e,o.chatId,o.id,{content:{...o.content,poll:i}}),(0,s.UF)(e)}break}case"updateMessagePollVote":{const{pollId:t,peerId:n,options:o}=a,i=(0,b.zg4)(e,t);if(!i||!i.content.poll||!i.content.poll.results)break;const{poll:r}=i.content,c=(0,b.VF$)(e,i.chatId),{recentVoterIds:d,totalVoters:l,results:u}=r.results,m=d?[...d]:[],h=l?l+1:1,p=u?[...u]:[];m.push(n),o.forEach((t=>{const a=p.findIndex((e=>e.option===t)),s=p[a],o=s?{...s}:{option:t,votersCount:0};o.votersCount+=1,c?.id!==n&&n!==e.currentUserId||(o.isChosen=!0),a?p[a]=o:p.push(o)})),e=(0,A.r3)(e,i.chatId,i.id,{content:{...i.content,poll:{...r,results:{...r.results,recentVoterIds:m,totalVoters:h,results:p}}}}),(0,s.UF)(e);break}case"updateServiceNotification":{const{message:s}=a;(0,b.dqr)(e)&&t.createServiceNotification({message:s});break}case"updateMessageReactions":{const{chatId:n,id:o,reactions:i}=a,r=(0,b.O5q)(e,n,o),c=(0,b.hds)(e,a.chatId);if(!c||!r)return;e=D(e,t,n,o,i,c,r.isOutgoing,r),(0,s.UF)(e);break}case"updateMessageExtendedMedia":{const{chatId:t,id:n,media:o,preview:i}=a,r=(0,b.O5q)(e,t,n);if(!(0,b.hds)(e,a.chatId)||!r)return;if(i){if(!r.content.invoice)return;e=(0,A.r3)(e,t,n,{content:{...r.content,invoice:{...r.content.invoice,extendedMedia:i}}}),(0,s.UF)(e)}else o&&(e=(0,A.r3)(e,t,n,{content:{...o}}),(0,s.UF)(e));break}case"updateTranscribedAudio":{const{transcriptionId:t,text:n,isPending:o}=a;e={...e,transcriptions:{...e.transcriptions,[t]:{...e.transcriptions[t]||{},transcriptionId:t,text:n,isPending:o}}},(0,s.UF)(e);break}case"updateMessageSendFailed":{const{chatId:n,localId:o,error:i}=a;i.match(/CHAT_SEND_.+?FORBIDDEN/)&&Object.values(e.byTabId).forEach((e=>{let{id:a}=e;t.showAllowedMessageTypesNotification({chatId:n,tabId:a})})),e=(0,A.r3)(e,n,o,{sendingState:"messageSendingStateFailed"}),(0,s.UF)(e);break}case"updateMessageTranslations":{const{chatId:t,messageIds:n,toLanguageCode:o,translations:i}=a;e=(0,A.rm)(e,t,n,o,i),(0,s.UF)(e);break}}}));const _=new Map,W=(0,y.sg)((e=>e()),500,!1);async function K(e){let{global:t,chatId:a,threadId:n,draft:o,isLocalOnly:i,noLocalTimeUpdate:r}=e;const c=(0,b.hds)(t,a),d=(0,b.mBe)(t,a);if(!c||d&&(0,I.PL)(d))return;const l=(0,b.OEv)(t,a,n,o?.replyInfo),u=o?{...o,replyInfo:l,date:Math.floor(Date.now()/1e3),isLocal:!0}:void 0;t=(0,A.ew)(t,a,n,"draft",u),r||(t=(0,A.wi)(t,a,{draftDate:u?.date})),(0,s.UF)(t),i||(await(0,f.px)("saveDraft",{chat:c,draft:u})&&u&&(u.isLocal=!1),t=(0,s.mS)(),t=(0,A.ew)(t,a,n,"draft",u),t=(0,A.wi)(t,a,{draftDate:u?.date}),(0,s.UF)(t))}async function $(e,t,a,o,i){let d=arguments.length>5&&void 0!==arguments[5]&&arguments[5],l=arguments.length>6&&void 0!==arguments[6]&&arguments[6],u=arguments.length>7?arguments[7]:void 0;for(var p=arguments.length,g=new Array(p>8?p-8:0),y=8;y
{let{isDeleted:t}=e;return!t})).map((e=>{let{message:t}=e;return t})):[],F=[].concat(T,R),B=(0,h.dU)(F,"id"),L=Object.keys(B).map(Number);if(a!==r.l3&&!(0,I.cG)(w,a,e.currentUserId)){const t=(0,b.dU3)(e,w,a);L[0]&&t!==L[0]||t===a||L.unshift(Number(a))}e=(0,A.o4)(e,w,B),e=d?(0,A.E0)(e,w,a,L):(0,A.d4)(e,w,a,L),e=(0,A.g1)(e,(0,h.dU)(N,"id")),e=(0,A.Nl)(e,(0,h.dU)(x,"id"));let J=(0,b.gCU)(e,w,a);const O=o?(0,b.Lzh)(e,w,a,o):void 0;if(d&&J&&O&&(O.length&&!(0,h.h8)(J,O)||(e=(0,A.d4)(e,w,a,O),J=(0,b.gCU)(e,w,a),e=(0,A.qK)(e,w,a,O),d=!1)),!l){const t=d&&O?O:J;if(t){const{newViewportIds:s}=X(t,o,i);e=(0,A.s3)(e,w,a,s,v)}}U&&(e=(0,A.eA)(e,t.id,a,{messagesCount:U})),(0,s.UF)(e),u?.()}function X(e,t,a){const{length:s}=e,o=t?function(e,t){return t0,h=u.length===n.yo2}return{newViewportIds:u,areSomeLocal:m,areAllLocal:h}}async function Q(e,t){let a;const n=t.attachment?(t,o)=>{_.has(o)||(a=o,_.set(o,n)),e=(0,s.mS)(),e=(0,A.mR)(e,o,t),(0,s.UF)(e)}:void 0;(t.replyInfo||o.pz)&&await(0,y.P_)(),await(0,f.px)("sendMessage",t,n),n&&a&&(e=(0,s.mS)(),e=(0,A.mR)(e,a,void 0),(0,s.UF)(e),_.delete(a))}async function Z(e,t,a){const n=(0,b.hds)(e,t);if(!n)return;const o=await(0,f.px)("fetchUnreadMentions",{chat:n,offsetId:a});if(!o)return;const{messages:i,chats:r,users:c}=o,d=(0,h.dU)(i,"id"),l=Object.keys(d).map(Number);e=(0,s.mS)(),e=(0,A.o4)(e,n.id,d),e=(0,A.g1)(e,(0,h.dU)(c,"id")),e=(0,A.Nl)(e,(0,h.dU)(r,"id")),e=(0,A.wi)(e,t,{unreadMentions:[...n.unreadMentions||[],...l]}),(0,s.UF)(e)}(0,s.aJ)("loadViewportMessages",((e,t,a)=>{const{direction:n=c.TN.Around,isBudgetPreload:o=!1,shouldForceRender:i=!1,onLoaded:r,onError:d,tabId:l=(0,m.g0)()}=a||{};let{chatId:u,threadId:h}=a||{};if(!u||!h){const t=(0,b.Xf0)(e,l);if(!t)return void d?.();u=t.chatId,h=t.threadId}const g=(0,b.hds)(e,u);if(!g||g.isRestricted)return void d?.();const f=(0,b.rA3)(e,u,h,l),I=(0,b.gCU)(e,u,h);if(f&&f.length&&n!==c.TN.Around){const a=n===c.TN.Backwards?f[0]:f[f.length-1];if((0,p.iL)(a))return;if(a===h&&n===c.TN.Backwards)return;const s=Boolean(I&&!I.includes(a)),i=s?(0,b.Lzh)(e,u,h,a):I,{newViewportIds:d,areSomeLocal:v,areAllLocal:w}=X(i,a,n);if(v&&(e=(0,A.s3)(e,u,h,d,l)),(0,y.aj)((()=>{!async function(e,t,a,s,n,o,i,r,c,d){for(var l=arguments.length,u=new Array(l>10?l-10:0),h=10;h2?a-2:0),n=2;ne()),500,!1);let Te,Ne;function xe(e,t,a,n){for(var o=arguments.length,i=new Array(o>4?o-4:0),r=4;r{r({peerId:a.peerId,storyId:a.id,isSinglePeer:!0,isSingleStory:!0})})),u=a&&"isDeleted"in a,m=a&&"content"in a,h=m?a.content.video:void 0,p=m?(0,I.EN)(a,"pictogram"):void 0,g=(0,Cs.A)(p)||h?.thumbnail?.dataUri;return(0,Fn.A)(d.peerId,d.id,a),Ut.Ay.createElement("div",{className:(0,Lt.A)("action-message-story-mention",o&&"is-unread",m&&"with-preview"),tabIndex:0,role:"button",onClick:m?l:void 0},m&&Ut.Ay.createElement("span",{className:"story-media-wrapper"},g&&Ut.Ay.createElement("img",{src:g,alt:"",className:"story-media"})),Ut.Ay.createElement("span",{className:"story-title"},(0,As.A)(n&&"isSelf"in n&&n.isSelf?c(u?"ExpiredStoryMentioned":"StoryYouMentionedTitle",(0,I.u0)(i)):u?c("ExpiredStoryMention"):c("StoryMentionedTitle",(0,I.qg)(c,n)),["emoji","simple_markdown"])))})));var Vi=a(70314);const ji=1.75*M.$,Gi=2.25*M.$,qi=(0,Ut.ph)((0,s.EK)(((e,t)=>{const{focusedMessage:a,forwardMessages:s,activeReactions:i,activeEmojiInteractions:c,loadingThread:d}=(0,b.nTw)(e),{message:l,album:u,withSenderName:m,withAvatar:h,threadId:g,messageListType:y,isLastInDocumentGroup:f,isFirstInGroup:A}=t,{id:v,chatId:w,viaBotId:S,isOutgoing:E,forwardInfo:M,transcriptionId:k,isPinned:P,viaBusinessBotId:T}=l,N=(0,b.hds)(e,w),x=(0,b.nZ4)(e,w),U=(0,I.kE)(w),R=(0,I.Qe)(w),F=N&&(0,I.WX)(N),B=N&&(0,I.YE)(N),L=(0,I.L8)(w)?void 0:(0,b.AWZ)(e,w),J=l.content.webPage?.story,O=J?(0,b.Msb)(e,J.peerId,J.id):void 0,D=s.messageIds&&s.messageIds.includes(v),V=!x&&(0,I.zP)(l),j=m||h||V,G=(0,b.Y7C)(e,l),q=(0,b.Szq)(e,l),z=S?(0,b.mBe)(e,S):void 0,H=G?.id&&B?L?.adminMembersById?.[G?.id]:void 0,_=l.id===g,{replyToMsgId:W,replyToPeerId:K,replyFrom:$}=(0,C.Q)(l)||{},{peerId:X,storyId:Q}=(0,C.W)(l)||{},Z=W&&W===g,Y=W?(0,b.O5q)(e,K||w,W):void 0,ee=M||$,te=Y?(0,b.As8)(e,Y):!ee||U||R?void 0:(0,b.HdA)(e,ee),ae=Y&&(0,b.Szq)(e,Y),se=K?(0,b.hds)(e,K):void 0,ne=!U&&!R&&se&&!(0,I.gA)(se)&&(se.isNotJoined||se.isRestricted),oe="topicCreate"===Y?.content.action?.type,ie=Q&&X?(0,b.Msb)(e,X,Q):void 0,re=X?(0,b.PVB)(e,X):void 0,ce=(0,b.ldX)(e,l),de="thread"===y&&(u?u.messages.some((t=>(0,b.nJv)(e,t,g))):(0,b.nJv)(e,l,g)),{direction:le,noHighlight:ue,isResizingContainer:me,quote:he}=de&&a||{},{query:pe}=(0,b.REO)(e)||{},ge=(0,I.wb)(l),ye=ge&&(0,b.oei)(e,ge)?ge:void 0,fe=(0,I.Jw)(l);let Ie;Ie=u?.messages?u.messages.every((t=>{let{id:a}=t;return(0,b.H1_)(e,a)})):(0,b.H1_)(e,v);const{canReply:Ae}="thread"===y&&(0,b.Plp)(e,l,g)||{},ve=(0,b.Tip)(e,l),be=(0,b.Vw0)(e,w,u?.commentsMessage?.id||v),we=Boolean(l.groupedId)&&!l.isInAlbum,Se=we?(0,b.D_S)(e,w,l.groupedId)[0]:void 0,Ce=we?f?(0,b.O5q)(e,w,Se):void 0:l,Ee=N?.unreadReactions?.includes(l.id),Me=g===r.l3&&N?.isForum&&A,ke=Me?(0,b.nkm)(e,l)||N?.topics?.[n.HxB]:void 0,Pe=(0,b.RnX)(e,w),Te=(0,b.Rny)(e,w,l.id),Ne=(0,b.qZq)(e,w),xe=o.CM&&e.settings.byKey.canTranslate&&!Ne,Ue="connectionStateReady"===e.connectionState,Re=Boolean(Ce&&i[(0,p.bj)(Ce)]?.length),Fe=(0,b.g29)(e),Be=G&&(0,b.nZ4)(e,G.id)?L?.boostsApplied??l.senderBoosts:l.senderBoosts,Le=N?.boostLevel||0,Je=e.appConfig?.groupTranscribeLevelMin,Oe=Fe||Boolean(Je&&Le>=Je),De=T?(0,b.mBe)(e,T):void 0;return{theme:(0,b.SJA)(e),forceSenderName:V,sender:G,canShowSender:j,originSender:q,botSender:z,shouldHideReply:Z||oe,isThreadTop:_,replyMessage:Y,replyMessageSender:te,replyMessageForwardSender:ae,replyMessageChat:se,replyStory:ie,isReplyPrivate:ne,storySender:re,isInDocumentGroup:we,isProtected:(0,b.ynf)(e,l),isChatProtected:(0,b.ryq)(e,w),isFocused:de,isForwarding:D,reactionMessage:Ce,isChatWithSelf:x,isRepliesChat:U,isAnonymousForwards:R,isChannel:F,isGroup:B,canReply:Ae,highlight:pe,animatedEmoji:ye,animatedCustomEmoji:fe,isInSelectMode:(0,b.rTV)(e),isSelected:Ie,isGroupSelected:Boolean(l.groupedId)&&!l.isInAlbum&&(0,b.SLS)(e,w,l.groupedId),threadId:g,isDownloading:ve,isPinnedList:"pinned"===y,isPinned:P,canAutoLoadMedia:(0,b.wwb)(e,l),canAutoPlayMedia:(0,b.OEt)(e,l),autoLoadFileMaxSizeMb:e.settings.byKey.autoLoadFileMaxSizeMb,shouldLoopStickers:(0,b.ML4)(e),repliesThreadInfo:be,availableReactions:e.reactions.availableReactions,defaultReaction:(0,I.Nb)(l)||"scheduled"===y?void 0:(0,b.nTJ)(e,w),hasActiveReactions:Re,activeEmojiInteractions:c,hasUnreadReaction:Ee,isTranscribing:void 0!==k&&e.transcriptions[k]?.isPending,transcribedText:void 0!==k?e.transcriptions[k]?.text:void 0,isPremium:Fe,senderAdminMember:H,messageTopic:ke,hasTopicChip:Me,chatTranslations:Pe,areTranslationsEnabled:xe,shouldDetectChatLanguage:(0,b.LRV)(e,w),requestedTranslationLanguage:Te,requestedChatTranslationLanguage:Ne,hasLinkedChat:Boolean(L?.linkedChatId),withStickerEffects:(0,b.xYJ)(e,"stickerEffects"),webPageStory:O,isConnected:Ue,isLoadingComments:be?.isCommentsInfo&&d?.loadingChatId===be?.originChannelId&&d?.loadingMessageId===be?.originMessageId,shouldWarnAboutSvg:e.settings.byKey.shouldWarnAboutSvg,...E&&{outgoingStatus:(0,b.Tl2)(e,l,"scheduled"===y)},..."number"==typeof ce&&{uploadProgress:ce},...de&&{focusDirection:le,noFocusHighlight:ue,isResizingContainer:me,focusedQuote:he},senderBoosts:Be,tags:e.savedReactionTags?.byKey,canTranscribeVoice:Oe,viaBusinessBot:De}}))((e=>{let{message:t,observeIntersectionForBottom:a,observeIntersectionForLoading:i,observeIntersectionForPlaying:d,album:l,noAvatars:u,withAvatar:m,withSenderName:h,noComments:p,noReplies:g,appearanceOrder:y,isJustAdded:f,isFirstInGroup:A,isPremium:v,isLastInGroup:b,isFirstInDocumentGroup:w,isLastInDocumentGroup:S,isTranscribing:E,transcribedText:k,isLastInList:P,theme:T,forceSenderName:N,sender:x,canShowSender:U,originSender:R,botSender:B,isThreadTop:L,shouldHideReply:J,replyMessage:O,replyMessageSender:D,replyMessageForwardSender:V,replyMessageChat:j,replyStory:G,isReplyPrivate:q,storySender:z,outgoingStatus:H,uploadProgress:_,isInDocumentGroup:W,isLoadingComments:K,isProtected:$,isChatProtected:X,isFocused:Q,focusDirection:Z,focusedQuote:Y,noFocusHighlight:ee,isResizingContainer:te,isForwarding:ae,isChatWithSelf:se,isRepliesChat:ne,isAnonymousForwards:oe,isChannel:ie,isGroup:re,canReply:ce,highlight:de,animatedEmoji:le,animatedCustomEmoji:ue,hasActiveReactions:me,hasLinkedChat:he,isInSelectMode:pe,isSelected:ge,isGroupSelected:ye,threadId:fe,reactionMessage:Ie,availableReactions:Ae,defaultReaction:ve,activeEmojiInteractions:be,messageListType:we,isPinnedList:Se,isPinned:Ce,isDownloading:Ee,canAutoLoadMedia:Me,canAutoPlayMedia:ke,shouldLoopStickers:Pe,autoLoadFileMaxSizeMb:Te,repliesThreadInfo:Ne,hasUnreadReaction:xe,memoFirstUnreadIdRef:Ue,senderAdminMember:Re,messageTopic:Fe,hasTopicChip:Be,chatTranslations:Le,areTranslationsEnabled:Je,shouldDetectChatLanguage:Oe,requestedTranslationLanguage:De,requestedChatTranslationLanguage:Ve,withStickerEffects:je,webPageStory:Ge,isConnected:qe,getIsMessageListReady:ze,shouldWarnAboutSvg:He,senderBoosts:_e,tags:We,canTranscribeVoice:Ke,viaBusinessBot:$e,onPinnedIntersectionChange:Xe}=e;const{toggleMessageSelection:Qe,clickBotInlineButton:Ze,disableContextMenuHint:Ye,animateUnreadReaction:et,focusLastMessage:tt,markMentionsRead:at}=(0,s.ko)(),st=(0,Ut.li)(null),nt=(0,Ut.li)(null),ot=(0,Ut.li)(null),it=(0,Ut.li)(0),rt=(0,Aa.A)(),[ct,dt]=(0,Ut.J0)(!1),[lt,ut,mt]=(0,La.A)(),{isMobile:ht,isTouchScreen:pt}=(0,F.Ay)();(0,An.mv)(nt,a);const{isContextMenuOpen:gt,contextMenuPosition:yt,contextMenuTarget:ft,handleBeforeContextMenu:It,handleContextMenu:At,handleContextMenuClose:vt,handleContextMenuHide:bt}=(0,bs.A)(st,pt&&pe,!o.cp,o.Ni,ze);(0,Ut.vJ)((()=>{gt&&Ye()}),[gt,Ye]);const wt=y<=0,[St,Ct]=(0,La.A)(wt);(0,Ut.vJ)((()=>{wt||setTimeout(Ct,10*y)}),[y,Ct,wt]);const{transitionClassNames:Et}=(0,Kt.A)(St||f,void 0,wt&&!f,!1),{id:Mt,chatId:kt,forwardInfo:Pt,viaBotId:Tt,isTranscriptionError:Nt,factCheck:xt}=t;(0,Ut.vJ)((()=>{if(!Ce)return;const e=l?l.mainMessage.id:Mt;return()=>{Xe({viewportPinnedIdsToRemove:[e],isUnmount:!0})}}),[l,Ce,Mt,Xe]);const Rt=(0,I.Nb)(t),Ft=(0,I.Ie)(t),Bt="scheduled"===we||t.isScheduled,Jt=(0,I.Tv)(t)&&!J,Ot=(0,C.Q)(t),Dt=(0,C.W)(t),Vt=Boolean(Dt),jt=Boolean(Ne)&&"thread"===we,Gt=(0,I.aN)(t),Ht=Gt&&(le||ue),_t=Ie?.reactions&&!(0,I.G)(Ie.reactions),Wt=Pt&&(!se||Bt)&&!ne&&!oe&&!Pt.isLinkedChannelPost&&!Gt||Boolean(t.content.storyData&&!t.content.storyData.isMention),$t=Boolean(_e)&&!Wt&&A,Xt=t.content.storyData?.isMention,Qt=Boolean(l)&&l.messages.length>1&&!l?.messages.some((e=>0===Object.keys(e.content).length)),Zt=W&&!w,Yt=W&&!S,ea=void 0!==yt,ta=!(ea||pe||ae||Yt||Xt),aa=ie&&!Bt&&t.isForwardingAllowed&&!X,sa=Boolean(Se||Pt&&(Pt.isChannelPost||se&&!Ft||ne||oe)&&Pt.fromMessageId),na=Ft&&!Gt,oa=Boolean(xt?.text),ia=Be||Jt||Vt,ra=(0,zt.A)(((e,t)=>{Qe({messageId:Mt,groupedId:t,...e?.shiftKey&&{withShift:!0},...Qt&&{childMessageIds:l.messages.map((e=>{let{id:t}=e;return t}))}})})),ca=U?x:void 0,da=Boolean(!ct&&(Nt||k)),la=Pt&&(se||ne||oe||!ca)?R:ca,ua=R||x,ma=Pt||t.content.storyData?R:ca,ha=(0,I.G5)(t),{handleMouseDown:pa,handleClick:ga,handleContextMenu:ya,handleDoubleClick:fa,handleContentDoubleClick:Ia,handleMouseMove:ba,handleSendQuickReaction:wa,handleMouseLeave:Sa,isSwiped:Ca,isQuickReactionVisible:Ea,handleDocumentGroupMouseEnter:Ma}=Kn(ra,st,Mt,Boolean(pe),Boolean(ce),Boolean($),At,It,kt,ea,ot,Yt,ze),{handleAvatarClick:ka,handleSenderClick:Pa,handleViaBotClick:Ta,handleReplyClick:Na,handleMediaClick:xa,handleAudioPlay:Ua,handleAlbumMediaClick:Ra,handlePhotoMediaClick:Fa,handleVideoMediaClick:Ba,handleMetaClick:Ja,handleTranslationClick:Oa,handleOpenThread:Da,handleReadMedia:Va,handleCancelUpload:ja,handleVoteSend:Ga,handleGroupForward:qa,handleForward:za,handleFocus:Ha,handleFocusForwarded:_a,handleDocumentGroupSelectAll:Wa,handleTopicChipClick:Ka,handleStoryClick:$a}=function(e,t,a,n,o,i,d,l,u,m,h,p,g,y,f,I,A){const{openChat:v,showNotification:b,focusMessage:w,openMediaViewer:S,openAudioPlayer:E,markMessagesRead:M,cancelUploadMedia:k,sendPollVote:P,openForwardMenu:T,openChatLanguageModal:N,openThread:x,openStoryViewer:U,searchChatMediaMessages:R}=(0,s.ko)(),{id:F,forwardInfo:B,groupedId:L}=a,{replyToMsgId:J,replyToPeerId:O,replyToTopId:D,isQuote:V,quoteText:j}=(0,C.Q)(a)||{},G=(0,zt.A)((()=>{m&&v({id:m.id})})),q=(0,zt.A)((()=>{h?d&&B?.channelPostId?w({chatId:h.id,messageId:B.channelPostId}):v({id:h.id}):b({message:e("HidAccount")})})),z=(0,zt.A)((()=>{p&&v({id:p.id})})),H=(0,zt.A)((()=>{J&&!I?w({chatId:O||n,threadId:A?D:o,messageId:J,replyMessageId:O?void 0:F,noForumTopicPanel:!O,...V&&{quote:j?.text}}):b({message:e(V?"QuotePrivate":"ReplyPrivate")})})),_=(0,zt.A)((()=>{S({chatId:n,threadId:o,mediaId:F,origin:l?c.TQ.ScheduledInline:c.TQ.Inline})})),W=(0,zt.A)((e=>{e&&R({chatId:n,threadId:o,currentMediaMessageId:F}),S({chatId:n,threadId:o,mediaId:F,origin:l?c.TQ.ScheduledInline:c.TQ.Inline,withDynamicLoading:e})})),K=(0,zt.A)((()=>{W(!l)})),$=(0,zt.A)(((e,t)=>{W(!t&&!l)})),X=(0,zt.A)((()=>{E({chatId:n,messageId:F})})),Q=(0,zt.A)((e=>{R({chatId:n,threadId:o,currentMediaMessageId:F}),S({chatId:n,threadId:o,mediaId:e,origin:l?c.TQ.ScheduledAlbum:c.TQ.Album,withDynamicLoading:!0})})),Z=(0,zt.A)((()=>{M({messageIds:[F]})})),Y=(0,zt.A)((()=>{k({chatId:n,messageId:F})})),ee=(0,zt.A)((e=>{P({chatId:n,messageId:F,options:e})})),te=(0,zt.A)((()=>{T({fromChatId:n,groupedId:L})})),ae=(0,zt.A)((()=>{if(u&&u.messages){const e=u.messages.map((e=>{let{id:t}=e;return t}));T({fromChatId:n,messageIds:e})}else T({fromChatId:n,messageIds:[F]})})),se=(0,zt.A)((()=>{w({chatId:n,threadId:r.l3,messageId:F})})),ne=(0,zt.A)((()=>{w(i?{chatId:B.fromChatId,groupedId:L,groupedChatId:n,messageId:B.fromMessageId}:O&&D?{chatId:O,threadId:D,messageId:B.fromMessageId}:{chatId:B.fromChatId,messageId:B.fromMessageId})})),oe=(0,zt.A)((e=>{e.stopPropagation(),t(e,L)}));return{handleAvatarClick:G,handleSenderClick:q,handleViaBotClick:z,handleReplyClick:H,handleMediaClick:_,handleAudioPlay:X,handleAlbumMediaClick:Q,handlePhotoMediaClick:K,handleVideoMediaClick:$,handleMetaClick:oe,handleTranslationClick:(0,zt.A)((e=>{e.stopPropagation(),N({chatId:n,messageId:y?void 0:F})})),handleOpenThread:(0,zt.A)((()=>{x({chatId:a.chatId,threadId:a.id})})),handleReadMedia:Z,handleCancelUpload:Y,handleVoteSend:ee,handleGroupForward:te,handleForward:ae,handleFocus:se,handleFocusForwarded:ne,handleDocumentGroupSelectAll:oe,handleTopicChipClick:(0,zt.A)((()=>{g&&w({chatId:O||n,threadId:g.id,messageId:F})})),handleStoryClick:(0,zt.A)((()=>{f&&U({peerId:f.peerId,storyId:f.id,isSingleStory:!0})}))}}(rt,ra,t,kt,fe,W,Wt,Bt,l,la,ma,B,Fe,Boolean(Ve),G&&"content"in G?G:void 0,q,ne);(0,Ut.vJ)((()=>{P&&da&&k&&tt()}),[tt,P,k,da]);const Xa=l?.hasMultipleCaptions?void 0:l?.captionMessage||t,Qa=Xa&&(0,I.XR)(Xa),Za=Qa||oa,Ya=(0,Lt.A)("Message message-list-item",A&&"first-in-group",$&&!Qa?"is-protected":"allow-selection",b&&"last-in-group",w&&"first-in-document-group",S&&"last-in-document-group",P&&"last-in-list",Ft&&"own",Boolean(t.viewsCount)&&"has-views",t.isEdited&&"was-edited",Jt&&"has-reply",gt&&"has-menu-open",Q&&!ee&&"focused",ae&&"is-forwarding",t.isDeleting&&"is-deleting",W&&"is-in-document-group",Qt&&"is-album",t.hasUnreadMention&&"has-unread-mention",ge&&"is-selected",pe&&"is-in-selection-mode",L&&!m&&"is-thread-top",Boolean(t.inlineButtons)&&"has-inline-buttons",Ca&&"is-swiped",Et,f&&"is-just-added",(me||lt)&&"has-active-reaction",Xt&&"is-story-mention"),{photo:as,video:ss,audio:ns,voice:os,document:is,sticker:rs,contact:cs,poll:ds,webPage:ls,invoice:us,location:ms,action:hs,game:ps,storyData:gs,giveaway:ys,giveawayResults:fs}=(0,I.r_)(t),Is=Xa&&(0,I.r_)(Xa).text,vs=Boolean(t.isInvertedMedia),{replyToMsgId:ws,replyToPeerId:Ss,isQuote:Cs}=Ot||{},{peerId:Es,storyId:Ms}=Dt||{},ks=function(e,t,a){const[s,n]=(0,Ut.J0)();return(0,Ut.vJ)((()=>{t||a&&!a()||(e?async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.2;return Jn||await On.promise,await Jn.request({name:"detectLanguage",args:[e,t]})}(e).then(n):n(void 0))}),[t,e,a]),s}(Is?.text,!(Je||Oe),ze);!function(e,t,a,s){(0,Ut.vJ)((()=>{if(a||s&&!s())return;const n=Boolean(e.content.text?.text.length);!function(e,t,a,s){const n=jn.get(e)||new Vn.A(150),o=n.get(t);o&&o.detectedLanguage===s&&o.isTranslatable===a||(n.set(t,{id:t,isTranslatable:a,detectedLanguage:s}),jn.set(e,n),Gn(e))}(e.chatId,e.id,n,t)}),[e,t,a,s])}(t,ks,!Oe,ze);const Ps=(0,I.ZR)(t,!Ve),{isPending:Ts,translatedText:Ns}=(0,zn.A)(Le,kt,Ps?Mt:void 0,De),xs=(0,Vs.A)(Ns,Boolean(Ps)),Us=Ns||xs,{phoneCall:Rs}=hs||{},Fs=(Ne||he&&ie&&Rt)&&!Yt&&"thread"===we&&!p,Bs=Ne?.isCommentsInfo&&!Yt&&"thread"===we&&!p,Ls=!pt&&!Rs&&!pe&&ve&&!Yt&&!Xt&&!ha,Js=_t&&(Gt||(as||ss||gs||"geo"===ms?.type)&&!Za),Os=function(e,t){let{hasSubheader:a,isCustomShape:s,isLastInGroup:o,asForwarded:i,hasThread:r,forceSenderName:c,hasCommentCounter:d,hasActionButton:l,hasReactions:u,isGeoLiveActive:m,withVoiceTranscription:h,peerColorClass:p,hasOutsideReactions:g}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{photo:y,video:f,audio:A,voice:v,document:b,poll:w,webPage:S,contact:C,location:E,invoice:M,storyData:k,giveaway:P,giveawayResults:T}=(0,I.r_)(e),N=t?.hasMultipleCaptions?void 0:(0,I.r_)(t?.captionMessage||e).text,x=Boolean(e.factCheck?.text),U=e.isInvertedMedia,R=y||f&&!f?.isRound||t||S,F=[n.zPk],B=k||y||f||E||M?.extendedMedia,L=N||"venue"===E?.type||m||x,J=B&&!L,O=Boolean(e.viaBotId),D=U&&R?!(!u||g)||!!x||!(!S||!L):L;return p&&F.push(p),!B&&e.emojiOnlyCount?(F.push("emoji-only"),e.emojiOnlyCount<=n.Apc&&F.push(`emoji-only-${e.emojiOnlyCount}`)):L?F.push("text"):F.push("no-text"),l&&F.push("has-action-button"),s&&(F.push("custom-shape"),f?.isRound&&F.push("round"),d&&F.push("has-comment-counter")),B?F.push("media"):A?F.push("audio"):v?(F.push("voice"),h&&F.push("with-voice-transcription")):b?F.push("document"):C?F.push("contact"):w?F.push("poll"):P||T?F.push("giveaway"):S&&(F.push("web-page"),(S.photo||S.video)&&F.push("media"),S.document&&F.push("document")),M&&!M.extendedMedia&&F.push("invoice"),k&&F.push("story"),i&&F.push("is-forwarded"),a&&F.push("has-subheader"),r&&F.push("has-replies"),u&&F.push("has-reactions"),g&&F.push("has-outside-reactions"),O&&F.push("is-via-bot"),c&&F.push("force-sender-name"),s||(F.push("has-shadow"),B&&r&&F.push("has-background"),(a||i||O||!J||c||x)&&F.push("has-solid-background"),x&&F.push("has-fact-check"),o&&(y||!J||E&&i)&&F.push("has-appendix")),R&&U&&F.push("is-inverted-media"),D?F.push("has-footer"):F.push("no-footer"),F.join(" ")}(t,l,{hasSubheader:ia,isCustomShape:Gt,isLastInGroup:b,asForwarded:Wt,hasThread:jt&&!p,forceSenderName:N,hasCommentCounter:jt&&Ne.messagesCount>0,hasActionButton:aa||sa,hasReactions:_t,isGeoLiveActive:"geoLive"===ms?.type&&!(0,I.vz)(t),withVoiceTranscription:da,peerColorClass:(0,Mn.y)(ua,na),hasOutsideReactions:Js}),Ds=Os.includes("has-appendix"),js=(0,kn.Rr)(t.emojiOnlyCount);let Gs,qs;Gs=Rs||Yt?"none":!Za||ls||js||vs?vs&&!js&&(oa||ls)?"in-text":"standalone":"in-text",_t?Js?qs="outside":Wt?(Gs="standalone",qs="inside"):qs="inside":qs="none";const zs=Gt?"in-meta":"in-content";(0,Rn.A)(Ss||kt,ws,O,t.id,J||Cs||q),(0,Fn.A)(Es||kt,Ms,G),(0,qn.A)(st,kt,Q,Z,ee,te,f,Boolean(Y));const Hs=($e?(0,I.qg)(rt,$e):void 0)||ie&&t.postAuthorTitle||(Wt||se)&&Pt?.postAuthorTitle||void 0,_s=P,Ws=(0,zt.A)((e=>{const t=it.current,a=e.contentRect.height;if(it.current=a,(0,Zs.o8)()||!t||a<=t)return;const s=e.target.closest(".MessageList");if(!s)return;(0,qt.UH)(400);const n=a-t,{offsetHeight:o,scrollHeight:i,scrollTop:r}=s;Math.round(i-r-o)-n<=5&&tt()})),Ks=(0,Dn.A)(Ws,[Ws],300,!1);(0,dn.A)(st,Ks,!_s),(0,Ut.vJ)((()=>{const e=nt.current;e&&(0,Cn.Y)(e)&&(xe&&et({messageIds:[Mt]}),t.hasUnreadMention&&at({messageIds:[Mt]}))}),[xe,Mt,et,t.hasUnreadMention]);const $s=(0,Ut.Kr)((()=>Qt?Un(Ft,Boolean(Wt),Boolean(u),l,ht):void 0),[Qt,Ft,Wt,u,l,ht]),Xs=Wt?28:0,Qs=(0,Ut.Kr)((()=>{let e,a,s,n=!1,o="";if(!Qt&&(as||ss||us?.extendedMedia)){let s;if(as)s=(0,Pn.yA)(t,Wt,u,ht).width;else if(ss)s=ss.isRound?M.Wd:(0,Pn.yA)(t,Wt,u,ht).width;else if(us?.extendedMedia&&us.extendedMedia.width&&us.extendedMedia.height){const{width:e,height:t}=us.extendedMedia;s=(0,M.kn)({width:e,height:t,fromOwnMessage:Ft,asForwarded:Wt,noAvatars:u,isMobile:ht}).width}s&&(s