TelegramPWA/dist/5769.492f92c50d42b25061bc.js
Alexander Zinchuk 18fe9abbc2 [Build]
2023-04-10 00:55:46 +02:00

2 lines
385 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

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

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

"use strict";(self.webpackChunktelegram_t=self.webpackChunktelegram_t||[]).push([[5769],{23069:(e,t,n)=>{n.r(t),n.d(t,{LockScreen:()=>Fd,Main:()=>xd});var a=n(33555),s=n(863),o=n(83716),i=n(60748),r=(n(89005),n(6137)),c=n(25260),d=n(11192),l=n(70735),u=n(18010),m=n(65054);function h(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,m._w)()]=n;const{chatId:o,threadId:i}=(0,d.Bt)(e,s)||{};return o&&i?(e=(0,c.qr)(e,o,i,!1,void 0,s),e=(0,c.Pb)(e,o,i,void 0,void 0,void 0,s)):e}(0,a.iw)("openLocalTextSearch",((e,t,n)=>{const{tabId:a=(0,m._w)()}=n||{},{chatId:s,threadId:o}=(0,d.Bt)(e,a)||{};if(s&&o)return(0,c.qr)(e,s,o,!0,void 0,a)})),(0,a.iw)("closeLocalTextSearch",((e,t,n)=>{const{tabId:a=(0,m._w)()}=n||{};return h(e,a)})),(0,a.iw)("setLocalTextSearchQuery",((e,t,n)=>{const{query:a,tabId:s=(0,m._w)()}=n,{chatId:o,threadId:i}=(0,d.Bt)(e,s)||{};if(!o||!i)return;const r=(0,u.uw)(o,i),{query:h}=(0,d.jU)(e,s).localTextSearch.byChatThreadKey[r]||{};return a!==h&&(e=(0,c.Pb)(e,o,i,l.D,void 0,void 0,s)),(0,c.qr)(e,o,i,!0,a,s)})),(0,a.iw)("setLocalMediaSearchType",((e,t,n)=>{const{mediaType:a,tabId:s=(0,m._w)()}=n,{chatId:o,threadId:i}=(0,d.Bt)(e,s)||{};if(o&&i)return(0,c.z5)(e,o,i,a,s)}));var g=n(44271),p=n(15780);(0,a.iw)("openChat",((e,t,n)=>{const{id:a,threadId:s=r._f,type:o="thread",shouldReplaceHistory:i=!1,shouldReplaceLast:l=!1,noForumTopicPanel:u,tabId:p=(0,m._w)()}=n,f=(0,d.Bt)(e,p),I=(0,d.jU)(e,p);if(I.premiumModal?.promo&&I.premiumModal?.isOpen&&(e=(0,g.i)(e,{premiumModal:{...I.premiumModal,isOpen:!1}},p)),f&&f.chatId===a&&f.threadId===s&&f.type===o||(a&&(e=(0,c.O8)(e,a,s,"replyStack",[],p),e=(0,g.i)(e,{activeReactions:{}},p)),e=h(e=(0,c.i9)(e,p),p),e=(0,g.i)(e,{isStatisticsShown:!1,contentToBeScheduled:void 0,...a!==(0,d.jU)(e,p).forwardMessages.toChatId&&{forwardMessages:{}}},p)),a){const n=(0,d.Z1)(e,a);n?.isForum&&!u?t.openForumPanel({chatId:a,tabId:p}):a!==(0,d.jU)(e,p).forumPanelChatId&&t.closeForumPanel({tabId:p})}return t.updatePageTitle({tabId:p}),(0,c.Wy)(e,a,s,o,i,l,p)})),(0,a.iw)("openChatInNewTab",((e,t,n)=>{const{chatId:a,threadId:s=r._f}=n;window.open((0,p.Ex)(a,"thread",s),"_blank")})),(0,a.iw)("openPreviousChat",((e,t,n)=>{const{tabId:a=(0,m._w)()}=n||{};return t.updatePageTitle({tabId:a}),(0,c.Wy)(e,void 0,void 0,void 0,void 0,void 0,a)})),(0,a.iw)("openChatWithInfo",((e,t,n)=>{const{tabId:s=(0,m._w)()}=n;e=(0,g.i)(e,{...(0,d.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,tabId:r=(0,m._w)()}=n;return a&&t.openChat({id:a,threadId:o,tabId:r}),(0,g.i)(e,{requestedDraft:{chatId:a,text:s,files:i}},r)})),(0,a.iw)("resetChatCreation",((e,t,n)=>{const{tabId:a=(0,m._w)()}=n||{};return(0,g.i)(e,{chatCreation:void 0},a)})),(0,a.iw)("setNewChatMembersDialogState",((e,t,n)=>{const{newChatMembersProgress:a,tabId:s=(0,m._w)()}=n;return(0,g.i)(e,{newChatMembersProgress:a},s)})),(0,a.iw)("openNextChat",((e,t,n)=>{const{targetIndexDelta:a,orderedIds:s,tabId:o=(0,m._w)()}=n,{chatId:i}=(0,d.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)("openDeleteChatFolderModal",((e,t,n)=>{const{folderId:a,tabId:s=(0,m._w)()}=n;return(0,g.i)(e,{deleteFolderDialogModal:a},s)})),(0,a.iw)("closeDeleteChatFolderModal",((e,t,n)=>{const{tabId:a=(0,m._w)()}=n||{};return(0,g.i)(e,{deleteFolderDialogModal:void 0},a)}));var f=n(91713),I=n(60782),v=n(82267),w=n(83099),b=n(59692),P=n(64319),y=n(996),Z=n(42986),C=n(42797);const S=o.ckE+o.fK3;let E;function M(e,t,n){const{type:a,threadId:s}=(0,d.Bt)(e)||{},o=b.Iu,i="scheduled"===a?(0,d.yB)(e,t):(0,d.Zw)(e,t);if(!i||!s)return;const r=n.map((e=>i[e])).filter((t=>(0,d._k)(e,t,s).canCopy)).sort(((e,t)=>e.id-t.id)),c=r.reduce(((t,n)=>{const a=(0,d.Ur)(e,n);return t.push(`> ${a?(0,u.OU)(o,a):""}:`),t.push(`${function(e,t){const n=(0,Z.Eb)(t),a=n?`${n} `:"",s=(0,y.X)(t,void 0,void 0,void 0,void 0,void 0,!0)?.join("");return`${a}${(0,Z.Kk)(e,t,s,!0)}`}(o,n)}\n`),t}),[]),l=r.reduce(((t,n)=>{const a=(0,d.Ur)(e,n);return t.push(`> ${a?(0,u.OU)(o,a):""}:`),t.push(`${(0,u.MK)(o,n,!1,0,!0)}\n`),t}),[]);(0,P.qN)(c.join("\n"),l.join("\n"))}(0,a.iw)("setScrollOffset",((e,t,n)=>{const{chatId:a,threadId:s,scrollOffset:o,tabId:i=(0,m._w)()}=n;return e=(0,c.pf)(e,a,s,"lastScrollOffset",o),(0,c.O8)(e,a,s,"scrollOffset",o,i)})),(0,a.iw)("setReplyingToId",((e,t,n)=>{const{messageId:a,tabId:s=(0,m._w)()}=n,o=(0,d.Bt)(e,s);if(!o)return;const{chatId:i,threadId:r}=o;return(0,c.pf)(e,i,r,"replyingToId",a)})),(0,a.iw)("setEditingId",((e,t,n)=>{const{messageId:a,tabId:s=(0,m._w)()}=n,o=(0,d.Bt)(e,s);if(!o)return;const{chatId:i,threadId:r,type:l}=o,u="scheduled"===l?"editingScheduledId":"editingId";return(0,c.pf)(e,i,r,u,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,c.pf)(e,s,o,r,a)})),(0,a.iw)("editLastMessage",((e,t,n)=>{const{tabId:a=(0,m._w)()}=n||{},{chatId:s,threadId:o}=(0,d.Bt)(e,a)||{};if(!s||!o)return;const i=(0,d.Zw)(e,s),r=(0,d.Cb)(e,s,o,a);if(!i||!r)return;const l=(0,I.dF)(r,(t=>Boolean(i[t]&&(0,d._k)(e,i[t],o).canEdit)));return l?(0,c.pf)(e,s,o,"editingId",l):void 0})),(0,a.iw)("replyToNextMessage",((e,t,n)=>{const{targetIndexDelta:a,tabId:s=(0,m._w)()}=n,{chatId:o,threadId:i}=(0,d.Bt)(e,s)||{};if(!o||!i)return;const c=(0,d.Zw)(e,o),l=(0,d.Cb)(e,o,i,s);if(!c||!l)return;const u=(0,d.Yy)(e,o,i);let h;if((0,d.b9)(e,o,i,s)&&u){const e=Object.keys(c),t=e.indexOf(u.toString())+a;h=t<=e.length+1&&t>=0?Number(e[t]):void 0}else if(i===r._f){const t=(0,d.Z1)(e,o);h=t?.lastMessage?.id}else{const t=(0,d.tZ)(e,o,i);h=t?.lastMessageId}t.setReplyingToId({messageId:h,tabId:s}),t.focusMessage({chatId:o,threadId:i,messageId:h,tabId:s})})),(0,a.iw)("openAudioPlayer",((e,t,n)=>{const{chatId:a,threadId:s,messageId:o,origin:i,volume:r,playbackRate:c,isMuted:l,tabId:u=(0,m._w)()}=n,h=(0,d.jU)(e,u);return(0,g.i)(e,{audioPlayer:{chatId:a,threadId:s,messageId:o,origin:null!=i?i:h.audioPlayer.origin,volume:null!=r?r:h.audioPlayer.volume,playbackRate:c||h.audioPlayer.playbackRate||e.audioPlayer.lastPlaybackRate,isPlaybackRateActive:void 0===h.audioPlayer.isPlaybackRateActive?e.audioPlayer.isLastPlaybackRateActive:h.audioPlayer.isPlaybackRateActive,isMuted:l||h.audioPlayer.isMuted}},u)})),(0,a.iw)("setAudioPlayerVolume",((e,t,n)=>{const{volume:a,tabId:s=(0,m._w)()}=n;return(0,g.i)(e,{audioPlayer:{...(0,d.jU)(e,s).audioPlayer,volume:a,isMuted:!1}},s)})),(0,a.iw)("setAudioPlayerPlaybackRate",((e,t,n)=>{const{playbackRate:a,isPlaybackRateActive:s,tabId:o=(0,m._w)()}=n;return e={...e,audioPlayer:{...e.audioPlayer,lastPlaybackRate:a,isLastPlaybackRateActive:s}},(0,g.i)(e,{audioPlayer:{...(0,d.jU)(e,o).audioPlayer,playbackRate:a,isPlaybackRateActive:s}},o)})),(0,a.iw)("setAudioPlayerMuted",((e,t,n)=>{const{isMuted:a,tabId:s=(0,m._w)()}=n;return(0,g.i)(e,{audioPlayer:{...(0,d.jU)(e,s).audioPlayer,isMuted:a}},s)})),(0,a.iw)("setAudioPlayerOrigin",((e,t,n)=>{const{origin:a,tabId:s=(0,m._w)()}=n;return(0,g.i)(e,{audioPlayer:{...(0,d.jU)(e,s).audioPlayer,origin:a}},s)})),(0,a.iw)("closeAudioPlayer",((e,t,n)=>{const{tabId:a=(0,m._w)()}=n||{},s=(0,d.jU)(e,a);return(0,g.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,m._w)()}=n,r=(0,d.Jf)(e,(0,C.W7)(),i),c=(0,d.jU)(e,i);if(r){if(s!==c.pollResults.chatId||o!==c.pollResults.messageId)return(0,g.i)(e,{pollResults:{chatId:s,messageId:o,voters:{}}},i)}else window.setTimeout((()=>{e=(0,a.Rd)(),e=(0,g.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,m._w)()}=n||{};return(0,g.i)(e,{pollResults:{}},a)})),(0,a.iw)("focusLastMessage",((e,t,n)=>{const{tabId:a=(0,m._w)()}=n||{},s=(0,d.Bt)(e,a);if(!s)return;const{chatId:o,threadId:i}=s;let c;if(i===r._f){const t=(0,d.Z1)(e,o);c=t?.lastMessage?.id}else{const t=(0,d.tZ)(e,o,i);c=t?.lastMessageId}c&&t.focusMessage({chatId:o,threadId:i,messageId:c,noHighlight:!0,noForumTopicPanel:!0,tabId:a})})),(0,a.iw)("focusNextReply",((e,t,n)=>{const{tabId:s=(0,m._w)()}=n||{},o=(0,d.Bt)(e,s);if(!o)return;const{chatId:i,threadId:r}=o,l=(0,d.p9)(e,i,r,s);if(l&&0!==l.length){const n=l.pop();e=(0,c.O8)(e,i,r,"replyStack",[...l],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=r._f,messageListType:i="thread",noHighlight:l,groupedId:u,groupedChatId:h,replyMessageId:g,isResizingContainer:p,shouldReplaceHistory:v,noForumTopicPanel:w,tabId:b=(0,m._w)()}=n;let{messageId:P}=n;if(void 0!==u){const t=(0,d.y8)(e,h,u);t?.length&&([P]=(0,I.oA)(t))}const y=(0,d.Bt)(e,b),Z=!y||s!==y.chatId||o!==y.threadId||i!==y.type;if(E&&(clearTimeout(E),E=void 0),E=window.setTimeout((()=>{e=(0,a.Rd)(),e=(0,c.cq)(e,void 0,void 0,void 0,void 0,void 0,b),e=(0,c.wV)(e,void 0,b),(0,a.R3)(e)}),l?S:1500),e=(0,c.cq)(e,s,P,o,l,p,b),e=(0,c.wV)(e,void 0,b),g){const t=(0,d.p9)(e,s,o,b)||[];e=(0,c.O8)(e,s,o,"replyStack",[...t,g],b)}Z&&(e=(0,c.wV)(e,f.fo.Static,b));const C=(0,d.Cb)(e,s,o,b);if(C&&C.includes(P))return(0,a.R3)(e,{forceOnHeavyAnimation:!0}),void t.openChat({id:s,threadId:o,shouldReplaceHistory:v,noForumTopicPanel:w,tabId:b});if(Z&&(e=(0,c.O8)(e,s,o,"viewportIds",void 0,b)),C&&!Z){const t=P>C[0]?f.fo.Down:f.fo.Up;e=(0,c.wV)(e,t,b)}(0,a.R3)(e,{forceOnHeavyAnimation:!0}),t.openChat({id:s,threadId:o,shouldReplaceHistory:v,noForumTopicPanel:w,tabId:b}),t.loadViewportMessages({tabId:b,shouldForceRender:!0})})),(0,a.iw)("openForwardMenu",((e,t,n)=>{const{fromChatId:a,messageIds:s,groupedId:o,withMyScore:i,tabId:r=(0,m._w)()}=n;let c;return o&&(c=(0,d.xH)(e,a,o)),(0,g.i)(e,{forwardMessages:{fromChatId:a,messageIds:c||s,isModalShown:!0,withMyScore:i}},r)})),(0,a.iw)("changeForwardRecipient",((e,t,n)=>{const{tabId:a=(0,m._w)()}=n||{};return(0,g.i)(e,{forwardMessages:{...(0,d.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,m._w)()}=n,o=(0,d.jU)(e,s);return(0,g.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,m._w)()}=n;return(0,g.i)(e,{forwardMessages:{...(0,d.jU)(e,s).forwardMessages,noCaptions:a,noAuthors:a}},s)})),(0,a.iw)("exitForwardMode",((e,t,n)=>{const{tabId:s=(0,m._w)()}=n||{};e=(0,g.i)(e,{forwardMessages:{}},s),(0,a.R3)(e)})),(0,a.iw)("openForwardMenuForSelectedMessages",((e,t,n)=>{const{tabId:a=(0,m._w)()}=n||{},s=(0,d.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:s,tabId:o=(0,m._w)()}=n,i=(0,d.jU)(e,o),r=i.activeDownloads.byChatId[s.chatId];r&&r.length&&(e=(0,g.i)(e,{activeDownloads:{byChatId:{...i.activeDownloads.byChatId,[s.chatId]:r.filter((e=>e!==s.id))}}},o),(0,a.R3)(e))})),(0,a.iw)("cancelMessagesMediaDownload",((e,t,n)=>{const{messages:a,tabId:s=(0,m._w)()}=n,o=(0,d.jU)(e,s).activeDownloads.byChatId,i={};return Object.keys(o).forEach((e=>{i[e]=o[e].filter((e=>!a.find((t=>t.id===e))))})),(0,g.i)(e,{activeDownloads:{byChatId:i}},s)})),(0,a.iw)("downloadMessageMedia",((e,t,n)=>{const{message:s,tabId:o=(0,m._w)()}=n,i=(0,d.jU)(e,o);e=(0,g.i)(e,{activeDownloads:{byChatId:{...i.activeDownloads.byChatId,[s.chatId]:[...i.activeDownloads.byChatId[s.chatId]||[],s.id]}}},o),(0,a.R3)(e)})),(0,a.iw)("downloadSelectedMessages",((e,t,n)=>{const{tabId:a=(0,m._w)()}=n||{},s=(0,d.jU)(e,a);if(!s.selectedMessages)return;const{chatId:o,messageIds:i}=s.selectedMessages,{threadId:r}=(0,d.Bt)(e,a)||{},c=(0,d.Zw)(e,o);c&&r&&i.map((e=>c[e])).filter((t=>(0,d._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,m._w)()}=n||{},o=(0,d.jr)(e,s);return o?(0,c.M6)(e,o.id,a,s):e})),(0,a.iw)("toggleMessageSelection",((e,t,n)=>{const{messageId:o,groupedId:i,childMessageIds:r,withShift:l,tabId:u=(0,m._w)()}=n,h=(0,d.Bt)(e,u);if(!h)return;const{chatId:g,threadId:p,type:f}=h;e=(0,c.Ob)(e,g,p,f,o,i,r,l,u),(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:u}))})),(0,a.iw)("disableContextMenuHint",(e=>{if(e.shouldShowContextMenuHint)return{...e,shouldShowContextMenuHint:!1}})),(0,a.iw)("exitMessageSelectMode",((e,t,n)=>{const{tabId:a=(0,m._w)()}=n||{};return(0,c.i9)(e,a)})),(0,a.iw)("openPollModal",((e,t,n)=>{const{isQuiz:a,tabId:s=(0,m._w)()}=n||{};return(0,g.i)(e,{pollModal:{isOpen:!0,isQuiz:a}},s)})),(0,a.iw)("closePollModal",((e,t,n)=>{const{tabId:a=(0,m._w)()}=n||{};return(0,g.i)(e,{pollModal:{isOpen:!1}},a)})),(0,a.iw)("checkVersionNotification",((e,t)=>{if(o.V61&&Date.now()>Number(o.V61)+2592e5)return;const n=o.JiC.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,v.bp)(),content:{text:(0,w.ZP)("**Telegram Web A was updated to version 1.60**\n\n[🤩](customEmoji:5373026167722876724) **Whats New**\n\n• Archived Chats Header - Archived Chats are now accessible from the chat list in a collapsable header.\n\n• Reply Threads - You can tap to view all replies to a message in a separate window.\n\n• Emoji In Captions - You can now open the emoji panel [🙂](customEmoji:5971928678198676594) when adding a caption to media.\n\n• Message Translation - You can translate any message into another language from the context menu. To show this option, enable Translation in _Settings > Language_.\n\n• Emoji Statuses - Premium users can update their animated emoji status from the [🌟](customEmoji:6046154264353442824) at the top of their chat list.\n\n• Granular Media Permissions - Admins can choose which media types are allowed in their groups, each with separate toggles.\n\n[😍](customEmoji:5372886001465170842) **Whats Better**\n\n• Multiple tabs can be opened by holding <Ctrl> (⌘ on macOS) and clicking on a chat.\n\n• Opening a chat changes the title of your browser tab to the chat name. This can be modified in _Settings > Privacy and Security_.\n\n• Bot reply keyboards are now supported in groups and channels.\n\n• The video and audio players always remember your last playback speed.\n\n• Opening topics has an improved animation.\n\n• Performance when typing messages has been drastically improved.\n\n• Fixed disappearing drafts.\n\n• Fixed missing results in Global Search.\n\n• Fixed rare issues with opening text format options.\n\n• Fixed pasting text from Google Docs.\n\n• Fixed auto-closing context menu on iOS PWA.\n\n• Fixed changing group and channel admin rights.\n\n• Various layout and performance improvements.\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,d.Z1)(e,o.awM),l=Math.max(c.lastMessage?.id||0,...r.map((e=>{let{id:t}=e;return t}))),u=(r.length+1)/1e3,m=Math.floor(l)+u;s.previousLocalId=s.id,s.id=m;const h={id:m,message:s,version:i,isUnread:!0};e={...e,serviceNotifications:[...r.slice(-1e3),h]},(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,m._w)()}=n;return(0,g.i)(e,{reactorModal:{chatId:a,messageId:s}},o)})),(0,a.iw)("closeReactorListModal",((e,t,n)=>{const{tabId:a=(0,m._w)()}=n||{};return(0,g.i)(e,{reactorModal:void 0},a)})),(0,a.iw)("openSeenByModal",((e,t,n)=>{const{chatId:a,messageId:s,tabId:o=(0,m._w)()}=n;return(0,g.i)(e,{seenByModal:{chatId:a,messageId:s}},o)})),(0,a.iw)("closeSeenByModal",((e,t,n)=>{const{tabId:a=(0,m._w)()}=n||{};return(0,g.i)(e,{seenByModal:void 0},a)})),(0,a.iw)("openMessageLanguageModal",((e,t,n)=>{const{chatId:a,id:s,tabId:o=(0,m._w)()}=n,i=(0,d.xx)(e,a,s,o);return(0,g.i)(e,{messageLanguageModal:{chatId:a,messageId:s,activeLanguage:i}},o)})),(0,a.iw)("closeMessageLanguageModal",((e,t,n)=>{const{tabId:a=(0,m._w)()}=n||{};return(0,g.i)(e,{messageLanguageModal:void 0},a)})),(0,a.iw)("copySelectedMessages",((e,t,n)=>{const{tabId:a=(0,m._w)()}=n||{},s=(0,d.jU)(e,a);if(!s.selectedMessages)return;const{chatId:o,messageIds:i}=s.selectedMessages;M(e,o,i)})),(0,a.iw)("copyMessagesByIds",((e,t,n)=>{const{messageIds:a,tabId:s=(0,m._w)()}=n,o=(0,d.jr)(e,s);a&&0!==a.length&&o&&M(e,o.id,a)})),(0,a.iw)("setGlobalSearchQuery",((e,t,n)=>{const{query:a,tabId:s=(0,m._w)()}=n,{chatId:o}=(0,d.jU)(e,s).globalSearch;return(0,c.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,m._w)(),isClosing:s}=n||{};return(0,c.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,m._w)()}=n;return(0,c.Og)(e,a,s)})),(0,a.iw)("setGlobalSearchChatId",((e,t,n)=>{const{id:a,tabId:s=(0,m._w)()}=n;return(0,c.No)(e,{chatId:a,query:void 0,resultsByType:void 0},s)})),(0,a.iw)("setStickerSearchQuery",((e,t,n)=>{const{query:a,tabId:s=(0,m._w)()}=n;return(0,g.i)(e,{stickerSearch:{query:a,resultIds:void 0}},s)})),(0,a.iw)("setGifSearchQuery",((e,t,n)=>{const{query:a,tabId:s=(0,m._w)()}=n;return(0,g.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,m._w)()}=n;return(0,c.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,m._w)()}=n;return(0,g.i)(e,{newContact:{userId:a}},s)})),(0,a.iw)("openNewContactDialog",((e,t,n)=>{const{tabId:a=(0,m._w)()}=n||{};return(0,g.i)(e,{newContact:{isByPhoneNumber:!0}},a)})),(0,a.iw)("closeNewContactDialog",((e,t,n)=>{const{tabId:a=(0,m._w)()}=n||{};return(0,c.ft)(e,a)})),n(73456);var R=n(91947),k=n(26926),T=n(16974);function N(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")}))}var A=n(69118);function x(e){document.title!==e&&(document.title=e)}const B=(0,A.Ds)(x,200,!1);var L=n(65116);let U,j;(0,a.iw)("toggleChatInfo",((e,t,n)=>{const{force:a,tabId:s=(0,m._w)()}=n||{},o=void 0!==a?a:!(0,d.jU)(e,s).isChatInfoShown;return e=(0,g.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{tabId:a=(0,m._w)()}=n||{},{chatId:s}=(0,d.Bt)(e,a)||{};if(!s)return;const o=(0,d.jU)(e,a);return(0,g.i)(e,{management:{byChatId:{...o.management.byChatId,[s]:{...o.management.byChatId[s],isActive:!(o.management.byChatId[s]||{}).isActive}}}},a)})),(0,a.iw)("requestNextManagementScreen",((e,t,n)=>{const{screen:a,tabId:s=(0,m._w)()}=n||{},{chatId:o}=(0,d.Bt)(e,s)||{};if(!o)return;const i=(0,d.jU)(e,s);return(0,g.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,m._w)()}=n||{},{chatId:s}=(0,d.Bt)(e,a)||{};if(!s)return;const o=(0,d.jU)(e,a);return(0,g.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,m._w)()}=n;if((0,C.W7)()||(0,C.c9)())return(0,g.i)(e,{isLeftColumnShown:0===(0,d.jU)(e,a).messageLists.length},a)})),(0,a.iw)("toggleStatistics",((e,t,n)=>{const{tabId:a=(0,m._w)()}=n||{},s=(0,d.jU)(e,a);return(0,g.i)(e,{isStatisticsShown:!s.isStatisticsShown,statistics:{...s.statistics,currentMessageId:void 0}},a)})),(0,a.iw)("toggleMessageStatistics",((e,t,n)=>{const{tabId:a=(0,m._w)(),messageId:s}=n||{};return(0,g.i)(e,{statistics:{...(0,d.jU)(e,a).statistics,currentMessageId:s}},a)})),(0,a.iw)("toggleLeftColumn",((e,t,n)=>{const{tabId:a=(0,m._w)()}=n||{};return(0,g.i)(e,{isLeftColumnShown:!(0,d.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,m._w)(),...s}=n;s.localId=(0,k.Z)({});const o=[...(0,d.jU)(e,a).notifications],i=o.findIndex((e=>e.message===s.message));return-1!==i&&o.splice(i,1),o.push(s),(0,g.i)(e,{notifications:o},a)})),(0,a.iw)("showAllowedMessageTypesNotification",((e,t,n)=>{const{chatId:a,tabId:s=(0,m._w)()}=n,o=(0,d.Z1)(e,a);if(!o)return;const{canSendPlainText:i,canSendPhotos:r,canSendVideos:c,canSendDocuments:l,canSendAudios:h,canSendStickers:g,canSendRoundVideos:p,canSendVoices:f}=(0,u.H5)(o),v=(0,I.oA)([i?"Chat.SendAllowedContentTypeText":void 0,r?"Chat.SendAllowedContentTypePhoto":void 0,c?"Chat.SendAllowedContentTypeVideo":void 0,f?"Chat.SendAllowedContentTypeVoiceMessage":void 0,p?"Chat.SendAllowedContentTypeVideoMessage":void 0,l?"Chat.SendAllowedContentTypeFile":void 0,h?"Chat.SendAllowedContentTypeMusic":void 0,g?"Chat.SendAllowedContentTypeSticker":void 0]).map((e=>b.Iu(e)));if(!v.length)return void t.showNotification({message:b.Iu("Chat.SendNotAllowedText"),tabId:s});const w=b.Iu("AutoDownloadSettings.LastDelimeter"),P=v.join(", ").replace(/,([^,]*)$/,`${w}$1`);t.showNotification({message:b.Iu("Chat.SendAllowedContentText",P),tabId:s})})),(0,a.iw)("dismissNotification",((e,t,n)=>{const{tabId:a=(0,m._w)()}=n,s=(0,d.jU)(e,a).notifications.filter((e=>{let{localId:t}=e;return t!==n.localId}));return(0,g.i)(e,{notifications:s},a)})),(0,a.iw)("showDialog",((e,t,n)=>{const{data:a,tabId:s=(0,m._w)()}=n;if("message"in a&&a.hasErrorKey&&!(0,R.ZP)(a))return e;const o=[...(0,d.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,g.i)(e,{dialogs:o},s)})),(0,a.iw)("dismissDialog",((e,t,n)=>{const{tabId:a=(0,m._w)()}=n||{},s=[...(0,d.jU)(e,a).dialogs];return s.pop(),(0,g.i)(e,{dialogs:s},a)})),(0,a.iw)("toggleSafeLinkModal",((e,t,n)=>{const{url:a,tabId:s=(0,m._w)()}=n;return(0,g.i)(e,{safeLinkModalUrl:a},s)})),(0,a.iw)("openHistoryCalendar",((e,t,n)=>{const{selectedAt:a,tabId:s=(0,m._w)()}=n;return(0,g.i)(e,{historyCalendarSelectedAt:a},s)})),(0,a.iw)("closeHistoryCalendar",((e,t,n)=>{const{tabId:a=(0,m._w)()}=n||{};return(0,g.i)(e,{historyCalendarSelectedAt:void 0},a)})),(0,a.iw)("openGame",((e,t,n)=>{const{url:s,chatId:o,messageId:i,tabId:r=(0,m._w)()}=n,c=(0,d.hj)(e,o,i);if(!c)return;const l=c.viaBotId||c.senderId;if(l){if(!(0,d.LM)(e,l))return e=(0,g.i)(e,{botTrustRequest:{botId:l,type:"game",onConfirm:{action:"openGame",payload:n}}},r),void(0,a.R3)(e);e=(0,g.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,m._w)()}=n||{};return(0,g.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,m._w)()}=n||{},{animationLevel:c}=e.settings.byKey;if(0!==c)return(0,g.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,m._w)()}=n;return(0,g.i)(e,{limitReachedModal:{limit:a}},s)})),(0,a.iw)("closeLimitReachedModal",((e,t,n)=>{const{tabId:a=(0,m._w)()}=n||{};return(0,g.i)(e,{limitReachedModal:void 0},a)})),(0,a.iw)("closeStickerSetModal",((e,t,n)=>{const{tabId:a=(0,m._w)()}=n||{};return(0,g.i)(e,{openedStickerSetShortName:void 0},a)})),(0,a.iw)("openCustomEmojiSets",((e,t,n)=>{const{setIds:a,tabId:s=(0,m._w)()}=n;return(0,g.i)(e,{openedCustomEmojiSetIds:a},s)})),(0,a.iw)("closeCustomEmojiSets",((e,t,n)=>{const{tabId:a=(0,m._w)()}=n||{};return(0,g.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,I.Tw)([...s,...a]).slice(0,o.j7i)}}})),(0,a.iw)("openCreateTopicPanel",((e,t,n)=>{const{chatId:a,tabId:s=(0,m._w)()}=n;return(0,d.jr)(e,s)||t.openChat({id:a,threadId:r._f,tabId:s}),(0,g.i)(e,{createTopicPanel:{chatId:a}},s)})),(0,a.iw)("closeCreateTopicPanel",((e,t,n)=>{const{tabId:a=(0,m._w)()}=n||{};return(0,g.i)(e,{createTopicPanel:void 0},a)})),(0,a.iw)("openEditTopicPanel",((e,t,n)=>{const{chatId:a,topicId:s,tabId:o=(0,m._w)()}=n;return(0,d.jr)(e,o)||t.openChat({id:a,tabId:o}),(0,g.i)(e,{editTopicPanel:{chatId:a,topicId:s}},o)})),(0,a.iw)("closeEditTopicPanel",((e,t,n)=>{const{tabId:a=(0,m._w)()}=n||{};return(0,g.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=>{const t=/^\d+\.\d+(\.\d+)?$/;fetch(`version.txt?${Date.now()}`).then((e=>e.text())).then((n=>{n=n.trim(),t.test(n)&&n!==o.JiC&&(e=(0,a.Rd)(),e={...e,isUpdateAvailable:!0},(0,a.R3)(e))})).catch((e=>{o.eMD&&console.error("[checkAppVersion failed] ",e)}))})),(0,a.iw)("afterHangUp",(e=>{(0,d.jU)(e,(0,m._w)()).multitabNextAction&&(0,m.g)()})),(0,a.iw)("onTabFocusChange",((e,t,n)=>{const{isBlurred:a,tabId:s=(0,m._w)()}=n;return a?(U&&clearInterval(U),U=window.setInterval((()=>{t.updatePageTitle({tabId:s})}),500)):(clearInterval(U),U=void 0),e=(0,g.i)(e,{isBlurred:a},s),{...e,initialUnreadNotifications:a?(0,T.xW)():void 0}})),(0,a.iw)("updatePageTitle",((e,t,n)=>{const{tabId:a=(0,m._w)()}=n||{},{canDisplayChatInTitle:s}=e.settings.byKey,i=e.currentUserId;if(document.title.includes(o.ouc))return N(!1),void x(`${o.Tih} ${o.ouc}`);if(e.initialUnreadNotifications&&Math.round(Date.now()/1e3)%2==0){const t=(0,T.xW)()-e.initialUnreadNotifications;if(t>0)return x(`${t} notification${t>1?"s":""}`),void N(!0)}N(!1);const r=(0,d.Bt)(e,a);if(r&&s&&!e.passcode.isScreenLocked){const{chatId:t,threadId:n}=r,a=(0,d.Z1)(e,t);if(a){const e=(0,u.U)(b.Iu,a,t===i);return a.isForum&&a.topics?.[n]?void B(`${e} ${a.topics[n].title}`):void B(e)}}x(o.Tih)}));let O,F=0;(0,L.ll)((e=>{const{updatePageTitle:t,updateIsOnline:n}=(0,a.Sv)(),s=e.passcode.isScreenLocked!==j,o=Object.values(e.byTabId).filter((e=>e.isBlurred)).length,i=(0,d.jU)(e,(0,m._w)()).isMasterTab;s&&t(),o!==F&&i&&(O&&clearTimeout(O),O=window.setTimeout((()=>{e=(0,a.Rd)();const t=Object.values(e.byTabId).filter((e=>e.isBlurred)).length;n(t!==(0,m.s1)().length)}),100)),j=e.passcode.isScreenLocked,F=o})),(0,a.iw)("closePaymentModal",((e,t,n)=>{const{tabId:a=(0,m._w)()}=n||{},s=(0,d.jU)(e,a).payment.status;return e=(0,c.bp)(e,a),e=(0,c.WY)(e,a),(0,g.i)(e,{payment:{...(0,d.jU)(e,a).payment,status:s}},a)})),(0,a.iw)("addPaymentError",((e,t,n)=>{const{error:a,tabId:s=(0,m._w)()}=n;return(0,g.i)(e,{payment:{...(0,d.jU)(e,s).payment,status:"failed",error:a}},s)}));var _=n(88422);(0,a.iw)("openMediaViewer",((e,t,n)=>{const{chatId:a,threadId:s,mediaId:o,avatarOwnerId:i,profilePhotoIndex:r,origin:c,volume:l,playbackRate:u,isMuted:h,tabId:p=(0,m._w)()}=n,f=(0,d.jU)(e,p);return(0,g.i)(e,{mediaViewer:{...f.mediaViewer,chatId:a,threadId:s,mediaId:o,avatarOwnerId:i,profilePhotoIndex:r,origin:c,isHidden:!1,volume:null!=l?l:f.mediaViewer.volume,playbackRate:u||f.mediaViewer.playbackRate||e.mediaViewer.lastPlaybackRate,isMuted:h||f.mediaViewer.isMuted},forwardMessages:{}},p)})),(0,a.iw)("closeMediaViewer",((e,t,n)=>{const{tabId:a=(0,m._w)()}=n||{},{volume:s,isMuted:o,playbackRate:i,isHidden:r}=(0,d.jU)(e,a).mediaViewer;return(0,g.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,m._w)()}=n;return(0,g.i)(e,{mediaViewer:{...(0,d.jU)(e,s).mediaViewer,volume:a,isMuted:!1}},s)})),(0,a.iw)("setMediaViewerPlaybackRate",((e,t,n)=>{const{playbackRate:a,tabId:s=(0,m._w)()}=n;return e={...e,mediaViewer:{...e.mediaViewer,lastPlaybackRate:a}},(0,g.i)(e,{mediaViewer:{...(0,d.jU)(e,s).mediaViewer,playbackRate:a}},s)})),(0,a.iw)("setMediaViewerMuted",((e,t,n)=>{const{isMuted:a,tabId:s=(0,m._w)()}=n;return(0,g.i)(e,{mediaViewer:{...(0,d.jU)(e,s).mediaViewer,isMuted:a}},s)})),(0,a.iw)("setMediaViewerHidden",((e,t,n)=>{const{isHidden:a,tabId:s=(0,m._w)()}=n;return(0,g.i)(e,{mediaViewer:{...(0,d.jU)(e,s).mediaViewer,isHidden:a}},s)}));var D=n(50214),q=n(95281),$=n(5872),H=n(35369);let G=!1;(0,A.Gq)((()=>{(0,a.Rd)().passcode.hasPasscode&&!G&&1===Object.keys((0,a.Rd)().byTabId).length&&(0,D.jv)()})),(0,a.iw)("setPasscode",(async(e,t,n)=>{const{passcode:s}=n;e=(0,c.vu)(e,{isLoading:!0}),(0,a.R3)(e),await(0,q.AU)(s);const o=JSON.stringify({...(0,D.K8)(),userId:e.currentUserId});e=(0,a.Rd)();const i=(0,$.Uf)((0,c.vu)(e,{hasPasscode:!0,error:void 0,isLoading:!1}));await(0,q.H4)(o,i),(0,m.Z6)(),e=(0,a.Rd)(),e=(0,c.vu)(e,{hasPasscode:!0,error:void 0,isLoading:!1}),(0,a.R3)(e),(0,$.jA)(!0)})),(0,a.iw)("clearPasscode",(e=>((0,q.C8)(),(0,c.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,D.wX)(r,r.userId);const d=e;(e=JSON.parse(i)).byTabId=d.byTabId,(0,$.nE)(e,(0,I.Xh)(H.g)),e=(0,c.vu)(e,{isScreenLocked:!1,error:void 0,invalidAttemptsCount:0}),(0,a.R3)(e),(0,m.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,q.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,c.vu)(e,{invalidAttemptsCount:n,timeoutUntil:n>=5?Date.now()+15e3:void 0})})),(0,a.iw)("resetInvalidUnlockAttempts",(e=>(0,c.vu)(e,{invalidAttemptsCount:0,timeoutUntil:void 0}))),(0,a.iw)("setPasscodeError",((e,t,n)=>{const{error:a}=n;return(0,c.vu)(e,{error:a})})),(0,a.iw)("clearPasscodeError",(e=>(0,c.vu)(e,{error:void 0}))),(0,a.iw)("skipLockOnUnload",(()=>{G=!0})),n(65456);var V=n(27225),z=n(71226),W=n(81396);const X=new Map,Y=(0,A.Ds)((e=>e()),500,!1);async function K(e,t,n,s,i){let r=arguments.length>5&&void 0!==arguments[5]&&arguments[5],l=arguments.length>6&&void 0!==arguments[6]&&arguments[6];for(var u=arguments.length,h=new Array(u>7?u-7:0),g=7;g<u;g++)h[g-7]=arguments[g];let[p=(0,m._w)()]=h;const v=t.id;let w;switch(i){case f.Uq.Backwards:w=void 0;break;case f.Uq.Around:w=-(Math.round(o.hT6/2)+1);break;case f.Uq.Forwards:w=-(o.hT6+1)}e=(0,a.Rd)();const b=await(0,z.t9)("fetchMessages",{chat:(0,d.Z1)(e,v),offsetId:s,addOffset:w,limit:o.hT6,threadId:n});if(!b)return;const{messages:P,users:y,chats:Z,repliesThreadInfos:C}=b;e=(0,a.Rd)();const S=v===o.awM?e.serviceNotifications.filter((e=>{let{isDeleted:t}=e;return!t})).map((e=>{let{message:t}=e;return t})):[],E=[].concat(P,S),M=(0,I.ee)(E,"id"),R=Object.keys(M).map(Number);e=(0,c.c_)(e,v,M),e=r?(0,c.hv)(e,v,n,R):(0,c.xj)(e,v,n,R),e=(0,c.Sh)(e,(0,I.ee)(y,"id")),e=(0,c.fZ)(e,(0,I.ee)(Z,"id")),e=(0,c.j6)(e,v,C);let k=(0,d.gb)(e,v,n);const T=s?(0,d.of)(e,v,n,s):void 0;if(r&&k&&T&&(T.length&&!(0,I.YE)(k,T)||(e=(0,c.xj)(e,v,n,T),k=(0,d.gb)(e,v,n),e=(0,c.IU)(e,v,n,T),r=!1)),!l){const t=r?T:k,{newViewportIds:a}=J(t,s,i);e=(0,c.y9)(e,v,n,a,p)}(0,a.R3)(e)}function J(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===f.Uq.Backwards?s:s+1||a,r=n===f.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,m;switch(n){case f.Uq.Backwards:u=i>0,m=c>=0;break;case f.Uq.Forwards:u=i<a,m=d<=a-1;break;case f.Uq.Around:default:u=l.length>0,m=l.length===o.hT6}return{newViewportIds:l,areSomeLocal:u,areAllLocal:m}}async function Q(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];let c,[l=(0,m._w)()]=o;const u=t.attachment?(t,n)=>{X.has(n)||(c=n,X.set(n,u)),e=(0,a.Rd)(),e={...e,fileUploads:{byMessageLocalId:{...e.fileUploads.byMessageLocalId,[n]:{progress:t}}}},(0,a.R3)(e)}:void 0;(t.replyingTo||s.cj)&&await(0,A.Pn)(),e=(0,a.Rd)();const h=(0,d.Bt)(e,l);if(!h)return;const{threadId:g}=h;t.replyingTo||g===r._f||(t.replyingTo=(0,d.qS)(e,t.chat.id,g)),t.replyingTo&&!t.replyingToTopId&&g!==r._f&&(t.replyingToTopId=(0,d.qS)(e,t.chat.id,g)),await(0,z.t9)("sendMessage",t,u),u&&c&&X.delete(c)}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)("loadViewportMessages",((e,t,n)=>{const{direction:s=f.Uq.Around,isBudgetPreload:i=!1,shouldForceRender:r=!1,tabId:l=(0,m._w)()}=n||{};let{chatId:u,threadId:h}=n||{};if(!u||!h){const t=(0,d.Bt)(e,l);if(!t)return;u=t.chatId,h=t.threadId}const g=(0,d.Z1)(e,u);if(!g||g.isRestricted)return;const p=(0,d.Cb)(e,u,h,l),I=(0,d.gb)(e,u,h);if(p&&p.length&&s!==f.Uq.Around){const n=s===f.Uq.Backwards?p[0]:p[p.length-1],a=Boolean(I&&!I.includes(n)),o=a?(0,d.of)(e,u,h,n):I,{newViewportIds:r,areSomeLocal:v,areAllLocal:w}=J(o,n,s);if(v&&(e=(0,c.y9)(e,u,h,r,l)),(0,A.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[h=(0,m._w)()]=l;n||await K(e,o,i,c,r,a,s,h),s||t.loadViewportMessages({chatId:o.id,threadId:i,direction:r,isBudgetPreload:!0,tabId:h})}(e,t,w,a,i,g,h,s,n,l)})),i)return}else{const t=(0,d.G$)(e,u,l)||(0,d.rd)(e,u,h),n=Boolean(t&&I&&!I.includes(t)),a=(n?(0,d.of)(e,u,h,t):I)||[],{newViewportIds:s,areSomeLocal:r,areAllLocal:m}=J(a,t,f.Uq.Around);r&&s.length>=o.hT6&&(e=(0,c.y9)(e,u,h,s,l)),m||(0,A.R3)((()=>{K(e,g,h,t,f.Uq.Around,n,i,l)}))}(0,a.R3)(e,{forceOnHeavyAnimation:r})})),(0,a.iw)("loadMessage",(async(e,t,n)=>{const{chatId:s,messageId:o,replyOriginForId:i,threadUpdate:l}=n,u=(0,d.Z1)(e,s);if(!u)return;const m=await async function(e,t,n,s){const o=await(0,z.t9)("fetchMessage",{chat:t,messageId:n});if(o){if(o!==r._Q)return e=(0,a.Rd)(),e=(0,c.cY)(e,t.id,n,o.message),e=(0,c.Sh)(e,(0,I.ee)(o.users,"id")),(0,a.R3)(e),o.message;if(s){e=(0,a.Rd)();const n=(0,d.hj)(e,t.id,s);e=(0,c.cY)(e,t.id,s,{...n,replyToMessageId:void 0}),(0,a.R3)(e)}}}(e,u,o,i);if(m&&l){const{lastMessageId:t,isDeleting:n}=l;e=(0,a.Rd)(),e=(0,c.lG)(e,m,s,t,n),(0,a.R3)(e)}})),(0,a.iw)("sendMessage",((e,t,n)=>{const{tabId:a=(0,m._w)()}=n,s=(0,d.Bt)(e,a);if(!s)return;const{chatId:i,threadId:r,type:c}=s;if(n=(0,I.CE)(n,["tabId"]),"scheduled"===c&&!n.scheduledAt)return(0,g.i)(e,{contentToBeScheduled:n},a);const l=(0,d.Z1)(e,i),u=(0,d.Yy)(e,i,r),h=u?(0,d.hj)(e,i,u):void 0,p=l.isForum?(0,d.qS)(e,i,r):h?.replyToTopMessageId||h?.replyToMessageId,f={...n,chat:l,replyingTo:u,replyingToTopId:p,noWebPage:(0,d.tV)(e,i,r),sendAs:(0,d._5)(e,i)};t.setReplyingToId({messageId:void 0,tabId:a}),t.clearWebPagePreview({tabId:a});const v=!n.attachments||n.attachments.length<=1,w=!v&&n.shouldGroupMessages;if(v){const{attachments:t,...n}=f;Q(e,{...n,attachment:t?t[0]:void 0},a)}else if(w){const{text:t,entities:n,attachments:s,...i}=f,r=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)),[])}(s);r.forEach(((s,r)=>{const c=(0,I.Vl)(s,o.DUi);for(let s=0;s<c.length;s++){const[o,...d]=c[s],l=`${Date.now()}${r}${s}`,u=0===s&&0===r;Q(e,{...i,text:u?t:void 0,entities:u?n:void 0,attachment:o,groupedId:d.length>0?l:void 0},a),d.forEach((t=>{Q(e,{...i,attachment:t,groupedId:l},a)}))}}))}else{const{text:t,entities:n,attachments:s,replyingTo:o,...i}=f;t&&Q(e,{...i,text:t,entities:n,replyingTo:o},a),s?.forEach((t=>{Q(e,{...i,attachment:t},a)}))}})),(0,a.iw)("editMessage",((e,t,n)=>{const{text:a,entities:s,tabId:o=(0,m._w)()}=n,i=(0,d.Bt)(e,o);if(!i)return;const{chatId:r,threadId:c,type:l}=i,u=(0,d.Z1)(e,r),h=(0,d.kK)(e,r,c,l);u&&h&&((0,z.t9)("editMessage",{chat:u,message:h,text:a,entities:s,noWebPage:(0,d.tV)(e,r,c)}),t.setEditingId({messageId:void 0,tabId:o}))})),(0,a.iw)("cancelSendingMessage",((e,t,n)=>{const{chatId:a,messageId:s}=n,o=(0,d.hj)(e,a,s),i=o&&X.get((0,u.KK)(o));i&&(0,z.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:l,entities:m}=i,h=(0,d.Z1)(e,s),g=(0,d.dy)(e,s);g&&(0,u.NB)(g)||(i.isLocal=!0,i.shouldForce=r,e=(0,c.pf)(e,s,o,"draft",i),e=(0,c.a4)(e,s,{draftDate:Math.round(Date.now()/1e3)}),(0,a.R3)(e),await(0,z.t9)("saveDraft",{chat:h,text:l,entities:m,replyToMsgId:(0,d.Yy)(e,s,o),threadId:(0,d.qS)(e,s,o)})&&(i.isLocal=!1),e=(0,a.Rd)(),e=(0,c.pf)(e,s,o,"draft",i),e=(0,c.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=r._f,localOnly:o,shouldForce:i}=n;if(!(0,d.Ms)(e,a,s))return;const l=(0,d.Z1)(e,a);o||(0,z.t9)("clearDraft",l,(0,d.qS)(e,a,s));const u=i?{shouldForce:i,text:""}:void 0;return e=(0,c.pf)(e,a,s,"draft",u),(0,c.a4)(e,a,{draftDate:void 0})})),(0,a.iw)("toggleMessageWebPage",((e,t,n)=>{const{chatId:a,threadId:s,noWebPage:o}=n;return(0,c.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,m._w)()}=n,c=(0,d.jr)(e,r);c&&(0,z.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,d.Z1)(e,s);if(!i)return;const l=(0,d.qS)(e,s,o);await(0,z.t9)("unpinAllMessages",{chat:i,threadId:l}),e=(0,a.Rd)();const u=(0,d.KB)(e,s,o);u?.forEach((t=>{e=(0,c.cY)(e,s,t,{isPinned:!1})})),e=(0,c.pf)(e,i.id,r._f,"pinnedIds",[]),(0,a.R3)(e)})),(0,a.iw)("deleteMessages",((e,t,n)=>{const{messageIds:a,shouldDeleteForAll:s,tabId:o=(0,m._w)()}=n,i=(0,d.Bt)(e,o);if(!i)return;const{chatId:r,threadId:c}=i,l=(0,d.Z1)(e,r);(0,z.t9)("deleteMessages",{chat:l,messageIds:a,shouldDeleteForAll:s});const u=(0,d._$)(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,m._w)()}=n,o=(0,d.Bt)(e,s);if(!o)return;const{chatId:i}=o,r=(0,d.Z1)(e,i);(0,z.t9)("deleteScheduledMessages",{chat:r,messageIds:a});const c=(0,d.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,m._w)()}=n,r=(0,d.Z1)(e,s);if(!r)return;await(0,z.t9)("deleteHistory",{chat:r,shouldDeleteForAll:o}),e=(0,a.Rd)();const c=(0,d.Bt)(e,i);c&&c.chatId===s&&t.openChat({id:void 0,tabId:i})})),(0,a.iw)("reportMessages",(async(e,t,n)=>{const{messageIds:a,reason:s,description:o,tabId:i=(0,m._w)()}=n,r=(0,d.Bt)(e,i);if(!r)return;const{chatId:c}=r,l=(0,d.Z1)(e,c),u=await(0,z.t9)("reportMessages",{peer:l,messageIds:a,reason:s,description:o});t.showNotification({message:u?(0,b.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(s===e.currentUserId)return;const i=(0,d.Z1)(e,s);if(!i)return;const r=(0,d.dy)(e,s);r&&((0,u.cS)(r)||(0,u.NB)(r))||await(0,z.t9)("sendMessageAction",{peer:i,threadId:o,action:a})})),(0,a.iw)("markMessageListRead",((e,t,n)=>{const{maxId:a,tabId:s=(0,m._w)()}=n,i=(0,d.Bt)(e,s);if(!i)return;const{chatId:l,threadId:u}=i,h=(0,d.Z1)(e,l);if(!h)return;Y((()=>{(0,z.t9)("markMessageListRead",{chat:h,threadId:u,maxId:a})})),l===o.awM&&(e={...e,serviceNotifications:e.serviceNotifications.map((e=>e.isUnread&&e.id<=a?{...e,isUnread:!1}:e))});const g=(0,d.Cb)(e,l,u,s),p=(0,d.It)(e,l,u);if(!g||!p||!h.unreadCount)return e;const f=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}(g,p,a);if(!f)return e;if(h.isForum&&h.topics?.[u]){const t=h.topics[u];e=(0,c.Xg)(e,l,u,{lastReadInboxMessageId:a});const n=Math.max(0,t.unreadCount-f);return 0===n&&(e=(0,c.a4)(e,l,{unreadCount:Math.max(0,h.unreadCount-1)})),(0,c.Cn)(e,l,u,{unreadCount:n})}return u===r._f?(0,c.a4)(e,l,{lastReadInboxMessageId:a,unreadCount:Math.max(0,h.unreadCount-f)}):void 0})),(0,a.iw)("markMessagesRead",((e,t,n)=>{const{messageIds:a,tabId:s=(0,m._w)()}=n,o=(0,d.jr)(e,s);o&&(0,z.t9)("markMessagesRead",{chat:o,messageIds:a})})),(0,a.iw)("loadWebPagePreview",(async(e,t,n)=>{const{text:s,tabId:o=(0,m._w)()}=n,i=await(0,z.t9)("fetchWebPagePreview",{message:s});e=(0,a.Rd)(),e=(0,g.i)(e,{webPagePreview:i},o),(0,a.R3)(e)})),(0,a.iw)("clearWebPagePreview",((e,t,n)=>{const{tabId:a=(0,m._w)()}=n||{};if((0,d.jU)(e,a).webPagePreview)return(0,g.i)(e,{webPagePreview:void 0},a)})),(0,a.iw)("sendPollVote",((e,t,n)=>{const{chatId:a,messageId:s,options:o}=n,i=(0,d.Z1)(e,a);i&&(0,z.t9)("sendPollVote",{chat:i,messageId:s,options:o})})),(0,a.iw)("cancelPollVote",((e,t,n)=>{const{chatId:a,messageId:s}=n,o=(0,d.Z1)(e,a);o&&(0,z.t9)("sendPollVote",{chat:o,messageId:s,options:[]})})),(0,a.iw)("closePoll",((e,t,n)=>{const{chatId:a,messageId:s}=n,o=(0,d.Z1)(e,a),i=(0,d.hj)(e,a,s)?.content.poll;o&&i&&(0,z.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:l,shouldResetVoters:u,tabId:h=(0,m._w)()}=n,p=await(0,z.t9)("loadPollOptionResults",{chat:s,messageId:o,option:i,offset:r,limit:l});if(!p)return;e=(0,a.Rd)(),e=(0,c.Sh)(e,(0,I.ee)(p.users,"id"));const f=(0,d.jU)(e,h),{pollResults:v}=f,{voters:w}=f.pollResults;e=(0,g.i)(e,{pollResults:{...v,voters:{...w,[i]:(0,I.Tw)([...!u&&w&&w[i]?w[i]:[],...p&&p.users.map((e=>e.id))])},offsets:{...v.offsets?v.offsets:{},[i]:p.nextOffset||""}}},h),(0,a.R3)(e)})),(0,a.iw)("loadExtendedMedia",((e,t,n)=>{const{chatId:a,ids:s}=n,o=(0,d.Z1)(e,a);o&&(0,z.t9)("fetchExtendedMedia",{chat:o,ids:s})})),(0,a.iw)("forwardMessages",((e,t,n)=>{const{isSilent:s,scheduledAt:o,tabId:i=(0,m._w)()}=n,{fromChatId:r,messageIds:c,toChatId:l,withMyScore:h,noAuthors:p,noCaptions:f,toThreadId:I}=(0,d.jU)(e,i).forwardMessages,v=(0,d.wV)(e),w=r?(0,d.Z1)(e,r):void 0,b=l?(0,d.Z1)(e,l):void 0,P=r&&c?c.sort(((e,t)=>e-t)).map((t=>(0,d.hj)(e,r,t))).filter(Boolean):void 0;if(!w||!b||!P||I&&!b.isForum)return;const y=(0,d._5)(e,l),Z=P.filter((e=>!(0,u.jM)(e)));Z.length&&(0,z.t9)("forwardMessages",{fromChat:w,toChat:b,toThreadId:I,messages:Z,isSilent:s,scheduledAt:o,sendAs:y,withMyScore:h,noAuthors:p,noCaptions:f,isCurrentUserPremium:v}),P.filter((e=>(0,u.jM)(e))).forEach((t=>{const{text:n,entities:a}=t.content.text||{},{sticker:r,poll:c}=t.content;Q(e,{chat:b,replyingToTopId:I,text:n,entities:a,sticker:r,poll:c,isSilent:s,scheduledAt:o,sendAs:y},i)})),e=(0,a.Rd)(),e=(0,g.i)(e,{forwardMessages:{}},i),(0,a.R3)(e)})),(0,a.iw)("loadScheduledHistory",(async(e,t,n)=>{const{chatId:s}=n,o=(0,d.Z1)(e,s);if(!o)return;const i=await(0,z.t9)("fetchScheduledHistory",{chat:o});if(!i)return;const{messages:l}=i,u=(0,I.ee)(l,"id"),m=Object.keys(u).map(Number).sort(((e,t)=>t-e));if(e=(0,a.Rd)(),e=(0,c.w3)(e,o.id,u),e=(0,c.pf)(e,o.id,r._f,"scheduledIds",m),o?.isForum){const t={};l.forEach((n=>{const a=(0,d.nr)(e,n),s=t[a]||[];s.push(n.id),t[a]=s})),Object.entries(t).forEach((t=>{let[n,a]=t;e=(0,c.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,d.Z1)(e,a);o&&(0,z.t9)("sendScheduledMessages",{chat:o,ids:[s]})})),(0,a.iw)("rescheduleMessage",((e,t,n)=>{const{chatId:a,messageId:s,scheduledAt:o}=n,i=(0,d.Z1)(e,a),r=i&&(0,d.Tm)(e,i.id,s);i&&r&&(0,z.t9)("rescheduleMessage",{chat:i,message:r,scheduledAt:o})})),(0,a.iw)("requestThreadInfoUpdate",(async(e,t,n)=>{const{chatId:s,threadId:o}=n,i=(0,d.Z1)(e,s);if(!i)return;const r=(0,d.Cm)(e,s,o)?.id,l=await(0,z.t9)("requestThreadInfoUpdate",{chat:i,threadId:o,originChannelId:r});l&&(e=(0,a.Rd)(),e=(0,c.Sh)(e,(0,I.ee)(l.users,"id")),(0,a.R3)(e))})),(0,a.iw)("transcribeAudio",(async(e,t,n)=>{const{messageId:s,chatId:o}=n,i=(0,d.Z1)(e,o);if(!i)return;e=(0,c.cY)(e,o,s,{transcriptionId:""}),(0,a.R3)(e);const r=await(0,z.t9)("transcribeAudio",{chat:i,messageId:s});e=(0,a.Rd)(),e=(0,c.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,I.Tw)(s.filter((t=>!e.customEmojis.byId[t]))),r=await(0,z.t9)("fetchCustomEmoji",{documentId:i});r&&(e=(0,a.Rd)(),e={...e,customEmojis:{...e.customEmojis,byId:{...e.customEmojis.byId,...(0,I.ee)(r,"id")}}},(0,a.R3)(e))})),(0,a.iw)("loadPinnedMessages",(async(e,t,n)=>{const{chatId:s,threadId:o}=n,i=(0,d.Z1)(e,s);if(!i)return;const r=await(0,z.t9)("fetchPinnedMessages",{chat:i,threadId:o});if(!r)return;const{messages:l,chats:u,users:m}=r,h=(0,I.ee)(l,"id"),g=Object.keys(h).map(Number).sort(((e,t)=>t-e));e=(0,a.Rd)(),e=(0,c.c_)(e,i.id,h),e=(0,c.pf)(e,i.id,o,"pinnedIds",g),e=(0,c.Sh)(e,(0,I.ee)(m,"id")),e=(0,c.fZ)(e,(0,I.ee)(u,"id")),(0,a.R3)(e)})),(0,a.iw)("loadSeenBy",(async(e,t,n)=>{const{chatId:s,messageId:o}=n,i=(0,d.Z1)(e,s);if(!i)return;const r=await(0,z.t9)("fetchSeenBy",{chat:i,messageId:o});r&&(e=(0,a.Rd)(),e=(0,c.cY)(e,s,o,{seenByUserIds:r}),(0,a.R3)(e))})),(0,a.iw)("saveDefaultSendAs",((e,t,n)=>{const{chatId:a,sendAsId:s}=n,o=(0,d.Z1)(e,a),i=(0,d.Z1)(e,s)||(0,d.dy)(e,s);if(o&&i)return(0,z.t9)("saveDefaultSendAs",{sendAs:i,chat:o}),(0,c.a4)(e,a,{fullInfo:{...o.fullInfo,sendAsId:s}})})),(0,a.iw)("loadSendAs",(async(e,t,n)=>{const{chatId:s}=n,o=(0,d.Z1)(e,s);if(!o)return;const i=await(0,z.t9)("fetchSendAs",{chat:o});if(!i)return e=(0,a.Rd)(),e=(0,c.a4)(e,s,{sendAsPeerIds:[]}),void(0,a.R3)(e);e=(0,a.Rd)(),e=(0,c.Sh)(e,(0,I.ee)(i.users,"id")),e=(0,c.fZ)(e,(0,I.ee)(i.chats,"id")),e=(0,c.a4)(e,s,{sendAsPeerIds:i.sendAs}),(0,a.R3)(e)})),(0,a.iw)("loadSponsoredMessages",(async(e,t,n)=>{const{chatId:s}=n,o=(0,d.Z1)(e,s);if(!o)return;const i=await(0,z.t9)("fetchSponsoredMessages",{chat:o});i&&(e=(0,a.Rd)(),e=(0,c.Fn)(e,s,i.messages[0]),e=(0,c.Sh)(e,(0,I.ee)(i.users,"id")),e=(0,c.fZ)(e,(0,I.ee)(i.chats,"id")),(0,a.R3)(e))})),(0,a.iw)("viewSponsoredMessage",((e,t,n)=>{const{chatId:a}=n,s=(0,d.Z1)(e,a),o=(0,d.fS)(e,a);s&&o&&(0,z.t9)("viewSponsoredMessage",{chat:s,random:o.randomId})})),(0,a.iw)("fetchUnreadMentions",(async(e,t,n)=>{const{chatId:s,offsetId:o}=n,i=(0,d.Z1)(e,s);if(!i)return;const r=await(0,z.t9)("fetchUnreadMentions",{chat:i,offsetId:o});if(!r)return;const{messages:l,chats:u,users:m}=r,h=(0,I.ee)(l,"id"),g=Object.keys(h).map(Number);e=(0,a.Rd)(),e=(0,c.c_)(e,i.id,h),e=(0,c.Sh)(e,(0,I.ee)(m,"id")),e=(0,c.fZ)(e,(0,I.ee)(u,"id")),e=(0,c.a4)(e,s,{unreadMentions:[...i.unreadMentions||[],...g]}),(0,a.R3)(e)})),(0,a.iw)("markMentionsRead",((e,t,n)=>{const{messageIds:s,tabId:o=(0,m._w)()}=n,i=(0,d.jr)(e,o);if(!i)return;const r=(i.unreadMentions||[]).filter((e=>!s.includes(e)));e=(0,c.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,m._w)()}=n||{},s=(0,d.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,m._w)()}=n||{},s=(0,d.jr)(e,a);if(s)return(0,z.t9)("readAllMentions",{chat:s}),(0,c.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,m._w)()}=n,r=(0,W.X)(a);if(r.match(o.FSu)||r.match(o.g$l))return void t.openTelegramLink({url:a,tabId:i});const{appConfig:c}=e;if(c){const e=new URL(r);if(c.autologinDomains.includes(e.hostname))return e.searchParams.set("autologin_token",c.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,m._w)()}=n;let r=(0,d.dy)(e,s);if(r&&(0,d.Nm)(e,i)){if(!r.fullInfo){const{accessHash:t}=r;r=await(0,z.t9)("fetchFullUser",{id:s,accessHash:t}),e=(0,a.Rd)()}if(r?.fullInfo.noVoiceMessages)return void t.showDialog({data:{message:(0,b.Iu)("VoiceMessagesRestrictedByPrivacy",(0,u.Js)(r))},tabId:i})}(0,d.GQ)(e,s,i)?(e=(0,g.i)(e,{forwardMessages:{...(0,d.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,m._w)()}=n||{};e=(0,g.i)(e,{forwardMessages:{...(0,d.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,d.rB)(e),tabId:i=(0,m._w)()}=n;return(0,c.ql)(e,a,s,o,i)})),(0,a.iw)("showOriginalMessage",((e,t,n)=>{const{chatId:a,id:s,tabId:o=(0,m._w)()}=n;return(0,c.IR)(e,a,s,o)})),(0,a.iw)("translateMessages",((e,t,n)=>{const{chatId:a,messageIds:s,toLanguageCode:o=(0,d.rB)(e)}=n,i=(0,d.Z1)(e,a);if(i)return s.forEach((t=>{e=(0,c.qt)(e,a,t,o,{isPending:!0})})),(0,z.t9)("translateText",{chat:i,messageIds:s,toLanguageCode:o}),e})),(0,a.iw)("loadMessageViews",(async(e,t,n)=>{const{chatId:s,ids:o}=n,i=(0,d.Z1)(e,s);if(!i)return;const r=await(0,z.t9)("fetchMessageViews",{chat:i,ids:o});r&&(e=(0,a.Rd)(),r.forEach((t=>{e=(0,c.cY)(e,s,t.id,{views:t.views,forwards:t.forwards});const n=(0,d.hj)(e,s,t.id);if(!n)return;const a=n.repliesThreadInfo?.chatId,o=n.repliesThreadInfo?.threadId;a&&o&&(e=(0,c.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,A.P2)((e=>e()),500,!1);async function se(e,t){const n=await(0,z.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,[l=(0,m._w)()]=o;try{r=await(0,z.t9)("fetchStickers",{stickerSetInfo:n})}catch(s){if("STICKERSET_INVALID"===s.message)return t.showNotification({message:(0,b.Iu)("StickerPack.ErrorNotFound"),tabId:l}),void("shortName"in n&&(0,d.jU)(e,l).openedStickerSetShortName===n.shortName&&(e=(0,g.i)(e,{openedStickerSetShortName:void 0},l),(0,a.R3)(e)))}if(e=(0,a.Rd)(),!r)return;const{set:u,stickers:h,packs:p}=r,f=(e=(0,c.Rg)(e,u.id,{...u,stickers:h,packs:p})).stickers.forEmoji.emoji;f&&p[f]&&(e=(0,c.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[d=(0,m._w)()]=i;const l=await(0,z.t9)("searchGifs",{query:t,offset:s,username:n});l&&(e=(0,a.Rd)(),e=(0,c.rq)(e,!s,l.gifs,l.nextOffset,d),(0,a.R3)(e))}(0,a.iw)("loadStickerSets",(async(e,t)=>{const[n,s]=await Promise.all([(0,z.t9)("fetchStickerSets",{hash:e.stickers.added.hash}),(0,z.t9)("fetchCustomEmojiSets",{hash:e.customEmojis.added.hash})]);s&&n&&(e=(0,a.Rd)(),e=(0,c.z3)(e,"added",n.hash,n.sets),e=(0,c.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,m._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,A.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,z.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,z.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,z.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,z.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,z.t9)("fetchFeaturedStickers",{hash:t});n&&(e=(0,a.Rd)(),e=(0,c.z3)(e,"featured",n.hash,n.sets),(0,a.R3)(e))})),(0,a.iw)("loadPremiumGifts",(async e=>{const t=await(0,z.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,z.t9)("fetchDefaultTopicIcons");if(!t)return;e=(0,a.Rd)();const{set:n,stickers:s}=t,o={...n,stickers:s};e=(0,c.Rg)(e,o.id,o),e={...e,defaultTopicIconsId:o.id},(0,a.R3)(e)})),(0,a.iw)("loadDefaultStatusIcons",(async e=>{const t=await(0,z.t9)("fetchDefaultStatusEmojis");if(!t)return;e=(0,a.Rd)();const{set:n,stickers:s}=t,o={...n,stickers:s};e=(0,c.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,m._w)()}=n,o=(0,d.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,z.t9)("fetchAnimatedEmojis"),(0,z.t9)("fetchAnimatedEmojiEffects")]);t&&n&&(e=(0,a.Rd)(),e=(0,c.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,z.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,z.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,m._w)()}=n,r=e.gifs.saved.gifs?.length,c=(0,ne.M)(e,"savedGifs"),l=(0,ne.P)(e,"savedGifs"),u=(0,d.wV)(e);if(!o&&r&&r>=c&&t.showNotification({title:b.Iu("LimitReachedFavoriteGifs",c.toString()),message:u?b.Iu("LimitReachedFavoriteGifsSubtitlePremium"):b.Iu("LimitReachedFavoriteGifsSubtitle",l.toString()),...!u&&{action:{action:"openPremiumModal",payload:{tabId:i}}},className:"bold-link",tabId:i}),!await(0,z.t9)("saveGif",{gif:s,shouldUnsave:o}))return;e=(0,a.Rd)();const h=e.gifs.saved.gifs?.filter((e=>{let{id:t}=e;return t!==s.id}))||[],g=o?h:[s,...h];e={...e,gifs:{...e.gifs,saved:{...e.gifs.saved,gifs:g}}},(0,a.R3)(e)})),(0,a.iw)("faveSticker",((e,t,n)=>{const{sticker:a,tabId:s=(0,m._w)()}=n,o=e.stickers.favorite.stickers.length,i=(0,ne.M)(e,"stickersFaved"),r=(0,ne.P)(e,"stickersFaved"),c=(0,d.wV)(e);o>=i&&t.showNotification({title:b.Iu("LimitReachedFavoriteStickers",i.toString()),message:c?b.Iu("LimitReachedFavoriteStickersSubtitlePremium"):b.Iu("LimitReachedFavoriteStickersSubtitle",r.toString()),...!c&&{action:{action:"openPremiumModal",payload:{tabId:s}}},className:"bold-link",tabId:s}),a&&(0,z.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,z.t9)("faveSticker",{sticker:s,unfave:!0}))})),(0,a.iw)("removeRecentSticker",(async(e,t,n)=>{const{sticker:s}=n;await(0,z.t9)("removeRecentSticker",{sticker:s})&&se((0,a.Rd)())})),(0,a.iw)("clearRecentStickers",(async e=>{await(0,z.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,d.Ny)(e,a);if(!s)return;const{accessHash:o,installedDate:i,isArchived:r}=s,c=!r&&Boolean(i);(0,z.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,z.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,m._w)()}=n;s&&ae((async()=>{const t=await(0,z.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,c.z3)(e,"search",t.hash,t.sets),e=(0,c.fH)(e,t.hash,r,o),(0,a.R3)(e)}))})),(0,a.iw)("setGifSearchQuery",((e,t,n)=>{const{query:a,tabId:s=(0,m._w)()}=n;"string"==typeof a&&ae((()=>{ie(e,a,e.config?.gifSearchUsername,void 0,s)}))})),(0,a.iw)("searchMoreGifs",((e,t,n)=>{const{tabId:a=(0,m._w)()}=n||{},{query:s,offset:o}=(0,d.jU)(e,a).gifSearch;"string"==typeof s&&ae((()=>{ie(e,s,e.config?.gifSearchUsername,o,a)}))})),(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,z.t9)("fetchStickersForEmoji",{emoji:s,hash:o});e=(0,a.Rd)(),t&&e.stickers.forEmoji.emoji===s&&(e=(0,c.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,c.AA)(e,a)})),(0,a.iw)("clearCustomEmojiForEmoji",(e=>({...e,customEmojis:{...e.customEmojis,forEmoji:{}}}))),(0,a.iw)("loadFeaturedEmojiStickers",(async e=>{const t=await(0,z.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,I.ee)(t.sets.flatMap((e=>e.stickers||[])),"id")}},stickers:{...e.stickers,setsById:{...e.stickers.setsById,...(0,I.ee)(t.sets,"id")}}},(0,a.R3)(e))})),(0,a.iw)("openStickerSet",(async(e,t,n)=>{const{stickerSetInfo:s,tabId:o=(0,m._w)()}=n;(0,d.Ny)(e,s)||await oe(e,t,s,o),e=(0,a.Rd)();const i=(0,d.Ny)(e,s);i?.shortName&&(e=(0,g.i)(e,{openedStickerSetShortName:i.shortName},o),(0,a.R3)(e))})),(0,a.iw)("loadRecentEmojiStatuses",(async e=>{const t=await(0,z.t9)("fetchRecentEmojiStatuses");t&&(e=(0,a.Rd)(),e=(0,c.et)(e,t.hash,t.emojiStatuses),(0,a.R3)(e))}));var re=n(790);const ce=(0,A.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,l=arguments.length>6?arguments[6]:void 0;for(var u=arguments.length,h=new Array(u>7?u-7:0),g=7;g<u;g++)h[g-7]=arguments[g];let p,[f=(0,m._w)()]=h;if(i){const e=(0,z.t9)("searchMessagesLocal",{chat:i,query:t,type:n,limit:o.Hkl,offsetId:s,minDate:l,maxDate:r}),a=i.isForum?(0,z.t9)("fetchTopics",{chat:i,query:t,limit:o.XM3}):void 0,[c,d]=await Promise.all([e,a]);if(c){const{messages:e,users:t,totalCount:n,nextOffsetId:a}=c,{topics:s,count:o}=d||{};p={topics:s,totalTopicsCount:o,messages:e,users:t,chats:[],totalCount:n,nextRate:a}}}else p=await(0,z.t9)("searchMessagesGlobal",{query:t,offsetRate:s,limit:o.Hkl,type:n,maxDate:r,minDate:l});e=(0,a.Rd)();const v=(0,d.JX)(e,f);if(!p||""!==t&&t!==v)return e=(0,c.xv)(e,{messages:!1},f),void(0,a.R3)(e);const{messages:w,users:b,chats:P,totalCount:y,nextRate:Z}=p;P.length&&(e=(0,c.fZ)(e,(0,I.ee)(P,"id"))),b.length&&(e=(0,c.Sh)(e,(0,I.ee)(b,"id"))),w.length&&(e=(0,c.m6)(e,w)),e=(0,c.px)(e,w,y,n,Z,f),p.topics&&(e=(0,c.XG)(e,i.id,p.totalTopicsCount,p.topics));const C=p.topics?.map((e=>{let{id:t}=e;return t})).sort(((e,t)=>t-e));e=(0,c.No)(e,{foundTopicIds:C},f),(0,a.R3)(e)}async function le(e,t,n,s,i){let l=arguments.length>5&&void 0!==arguments[5]&&arguments[5];for(var u=arguments.length,h=new Array(u>6?u-6:0),g=6;g<u;g++)h[g-6]=arguments[g];let[p=(0,m._w)()]=h;const f=await(0,z.t9)("searchMessagesLocal",{chat:t,type:s,limit:2*o.ENB,topMessageId:n===r._f?void 0:n,offsetId:i});if(!f)return;const{chats:v,users:w,messages:b,totalCount:P,nextOffsetId:y}=f,Z=(0,I.ee)(b,"id"),C=Object.keys(Z).map(Number);e=(0,a.Rd)(),(0,d.we)(e,p)&&(e=(0,c.fZ)(e,(0,I.ee)(v,"id")),e=(0,c.Sh)(e,(0,I.ee)(w,"id")),e=(0,c.c_)(e,t.id,Z),e=(0,c.c1)(e,t.id,n,s,C,P,y,p),(0,a.R3)(e),l||le(e,t,n,s,y,!0,p))}let ue,me;(0,a.iw)("setGlobalSearchQuery",((e,t,n)=>{const{query:s,tabId:o=(0,m._w)()}=n,{chatId:i}=(0,d.jU)(e,o).globalSearch;s&&!i&&ce((async()=>{const t=await(0,z.t9)("searchChats",{query:s});e=(0,a.Rd)();const n=(0,d.JX)(e,o);if(!t||!n||s!==n)return e=(0,c.xv)(e,{chats:!1},o),void(0,a.R3)(e);const{localChats:i,localUsers:r,globalChats:l,globalUsers:u}=t;(i.length||l.length)&&(e=(0,c.fZ)(e,(0,I.ee)([...i,...l],"id"))),(r.length||u.length)&&(e=(0,c.Sh)(e,(0,I.ee)([...r,...u],"id"))),e=(0,c.xv)(e,{chats:!1},o),e=(0,c.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,d.jU)(e,o).globalSearch.globalResults,chatIds:l.map((e=>{let{id:t}=e;return t})),userIds:u.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,m._w)()}=n,i=s?(0,re.IS)(s):s;e=(0,c.No)(e,{date:s,query:"",resultsByType:{...(0,d.jU)(e,o).globalSearch.resultsByType,text:{totalCount:void 0,foundIds:[],nextOffsetId:0}}},o),(0,a.R3)(e);const{chatId:r}=(0,d.jU)(e,o).globalSearch;de(e,"","text",void 0,r?(0,d.Z1)(e,r):void 0,i,s,o)})),(0,a.iw)("searchMessagesGlobal",((e,t,n)=>{const{type:a,tabId:s=(0,m._w)()}=n,{query:o,resultsByType:i,chatId:r,date:c}=(0,d.jU)(e,s).globalSearch,l=c?(0,re.IS)(c):c,u=i?.[a]?.nextOffsetId;de(e,o,a,u,r?(0,d.Z1)(e,r):void 0,l,c,s)})),(0,a.iw)("searchTextMessagesLocal",(async(e,t,n)=>{const{tabId:s=(0,m._w)()}=n||{},{chatId:i,threadId:l}=(0,d.Bt)(e,s)||{},u=i?(0,d.Z1)(e,i):void 0;let h=(0,d.n5)(e,s);if(!u||!h||!l)return;const{query:g,results:p}=h,f=p?.nextOffsetId;let v;if(l!==r._f){const t=(0,d.tZ)(e,i,l);v=t?.topMessageId}if(!g)return;const w=await(0,z.t9)("searchMessagesLocal",{chat:u,type:"text",query:g,topMessageId:v,limit:o.pnA,offsetId:f});if(!w)return;const{chats:b,users:P,messages:y,totalCount:Z,nextOffsetId:C}=w,S=(0,I.ee)(y,"id"),E=Object.keys(S).map(Number);e=(0,a.Rd)(),h=(0,d.n5)(e,s),h&&g===h.query&&(e=(0,c.fZ)(e,(0,I.ee)(b,"id")),e=(0,c.Sh)(e,(0,I.ee)(P,"id")),e=(0,c.c_)(e,u.id,S),e=(0,c.dx)(e,u.id,l,E,Z,C,s),(0,a.R3)(e))})),(0,a.iw)("searchMediaMessagesLocal",((e,t,n)=>{const{tabId:a=(0,m._w)()}=n||{},{chatId:s,threadId:o}=(0,d.Bt)(e,a)||{};if(!s||!o)return;const i=(0,d.Z1)(e,s),r=(0,d.we)(e,a);if(!i||!r)return;const{currentType:c,resultsByType:l}=r,u=c&&l&&l[c],h=u?.nextOffsetId;c&&le(e,i,o,c,h,void 0,a)})),(0,a.iw)("searchMessagesByDate",(async(e,t,n)=>{const{timestamp:a,tabId:s=(0,m._w)()}=n,{chatId:o}=(0,d.Bt)(e,s)||{};if(!o)return;const i=(0,d.Z1)(e,o);if(!i)return;const r=await(0,z.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,m._w)()}=n,{chatId:i}=(0,d.Bt)(e,o)||{};if(!i)return;if((0,d.jU)(e,o).management.progress===f.wv.InProgress)return;e=(0,c.fw)(e,i,{isUsernameAvailable:void 0,checkedUsername:void 0},o),(0,a.R3)(e);const{result:r,error:l}=await(0,z.t9)("checkChatUsername",{username:s});e=(0,a.Rd)(),e=(0,c.H9)(e,!0===r?f.wv.Complete:f.wv.Error,o),e=(0,c.fw)(e,i,{isUsernameAvailable:!0===r,checkedUsername:s,error:l},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,tabId:o=(0,m._w)()}=n,{chatId:i}=(0,d.Bt)(e,o)||{};if(!i)return;const r=await(0,V.X9)(e,t,i,o);if(!r)return;e=(0,a.Rd)(),e=(0,c.H9)(e,f.wv.InProgress,o),(0,a.R3)(e);const l=await(0,z.t9)("setChatUsername",{chat:r,username:s});e=(0,a.Rd)(),e=(0,c.H9)(e,l?f.wv.Complete:f.wv.Error,o),e=(0,c.fw)(e,i,{isUsernameAvailable:void 0,checkedUsername:void 0,error:void 0},o),(0,a.R3)(e)})),(0,a.iw)("updatePrivateLink",((e,t,n)=>{const{tabId:a=(0,m._w)()}=n||{},{chatId:s}=(0,d.Bt)(e,a)||{},o=s&&(0,d.Z1)(e,s);s&&o&&(0,z.t9)("updatePrivateLink",{chat:o})})),(0,a.iw)("setEditingExportedInvite",((e,t,n)=>{const{chatId:s,invite:o,tabId:i=(0,m._w)()}=n;e=(0,c.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,m._w)()}=n,r=o?{inviteInfo:{invite:o}}:{inviteInfo:void 0};e=(0,c.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:l=(0,m._w)()}=n,u=(0,d.Z1)(e,s),h=(0,d.dy)(e,o||e.currentUserId);if(!u||!h)return;const g=await(0,z.t9)("fetchExportedChatInvites",{peer:u,admin:h,isRevoked:i,limit:r});if(!g)return;e=(0,a.Rd)();const{invites:p,users:f}=g;e=(0,c.Sh)(e,(0,I.ee)(f,"id"));const v=i?{revokedInvites:p}:{invites:p};e=(0,c.fw)(e,s,v,l),(0,a.R3)(e)})),(0,a.iw)("editExportedChatInvite",(async(e,t,n)=>{const{chatId:s,link:o,isRevoked:i,expireDate:r,usageLimit:l,isRequestNeeded:u,title:h,tabId:g=(0,m._w)()}=n,p=(0,d.Z1)(e,s);if(!p)return;const f=await(0,z.t9)("editExportedChatInvite",{peer:p,link:o,isRevoked:i,expireDate:r,usageLimit:l,isRequestNeeded:u,title:h});if(!f)return;const{oldInvite:v,newInvite:w,users:b}=f;e=(0,a.Rd)();const{management:P}=(0,d.jU)(e,g),y=(P.byChatId[s].invites||[]).filter((e=>e.link!==v.link)),Z=[...P.byChatId[s].revokedInvites||[]];w.isRevoked?Z.unshift(w):y.push(w),e=(0,c.Sh)(e,(0,I.ee)(b,"id")),e=(0,c.fw)(e,s,{invites:y,revokedInvites:Z},g),(0,a.R3)(e)})),(0,a.iw)("exportChatInvite",(async(e,t,n)=>{const{chatId:s,expireDate:o,usageLimit:i,isRequestNeeded:r,title:l,tabId:u=(0,m._w)()}=n,h=(0,d.Z1)(e,s);if(!h)return;const g=await(0,z.t9)("exportChatInvite",{peer:h,expireDate:o,usageLimit:i,isRequestNeeded:r,title:l});if(!g)return;e=(0,a.Rd)();const p=(0,d.jU)(e,u).management.byChatId[s].invites||[];e=(0,c.fw)(e,s,{invites:[...p,g]},u),(0,a.R3)(e)})),(0,a.iw)("deleteExportedChatInvite",(async(e,t,n)=>{const{chatId:s,link:o,tabId:i=(0,m._w)()}=n,r=(0,d.Z1)(e,s);if(!r)return;if(!await(0,z.t9)("deleteExportedChatInvite",{peer:r,link:o}))return;e=(0,a.Rd)();const l=(0,d.jU)(e,i).management.byChatId[s];e=(0,c.fw)(e,s,{invites:l?.invites?.filter((e=>e.link!==o)),revokedInvites:l?.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,m._w)()}=n,r=(0,d.Z1)(e,s),l=(0,d.dy)(e,o||e.currentUserId);r&&l&&await(0,z.t9)("deleteRevokedExportedChatInvites",{peer:r,admin:l})&&(e=(0,a.Rd)(),e=(0,c.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:l,tabId:u=(0,m._w)()}=n,h=(0,d.Z1)(e,s),g=r?(0,d.dy)(e,r):void 0;if(!h||r&&!g)return;const p=await(0,z.t9)("fetchChatInviteImporters",{peer:h,link:o,offsetDate:i,offsetUser:g,limit:l});if(!p)return;const{importers:f,users:I}=p;e=(0,a.Rd)();const v=(0,d.jU)(e,u).management.byChatId[s]?.inviteInfo;v?.invite&&v.invite.link===o&&(e=(0,c.fw)(e,s,{inviteInfo:{...v,importers:f}},u),e=(0,c.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:l,tabId:u=(0,m._w)()}=n,h=(0,d.Z1)(e,s),g=r?(0,d.dy)(e,r):void 0;if(!h||r&&!g)return;const p=await(0,z.t9)("fetchChatInviteImporters",{peer:h,link:o,offsetDate:i,offsetUser:g,limit:l,isRequested:!0});if(!p)return;const{importers:f,users:I}=p;e=(0,a.Rd)();const v=(0,d.jU)(e,u).management.byChatId[s]?.inviteInfo;v?.invite&&v.invite.link===o&&(e=(0,c.fw)(e,s,{inviteInfo:{...v,requesters:f}},u),e=(0,c.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,l=(0,d.Z1)(e,s),u=i?(0,d.dy)(e,i):void 0;if(!l||i&&!u)return;const m=await(0,z.t9)("fetchChatInviteImporters",{peer:l,offsetDate:o,offsetUser:u,limit:r,isRequested:!0});if(!m)return;const{importers:h,users:g}=m;e=(0,a.Rd)(),e=(0,c.a4)(e,s,{joinRequests:h}),e=(0,c.Sh)(e,g),(0,a.R3)(e)})),(0,a.iw)("hideChatJoinRequest",(async(e,t,n)=>{const{chatId:s,userId:o,isApproved:i}=n,r=(0,d.Z1)(e,s),l=(0,d.dy)(e,o);if(!r||!l)return;if(!await(0,z.t9)("hideChatJoinRequest",{peer:r,user:l,isApproved:i}))return;e=(0,a.Rd)();const u=(0,d.Z1)(e,s);u&&(e=(0,c.a4)(e,s,{joinRequests:u.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,d.Z1)(e,s);if(!r)return;if(!await(0,z.t9)("hideAllChatJoinRequests",{peer:r,isApproved:o,link:i}))return;e=(0,a.Rd)();const l=(0,d.Z1)(e,s);l&&(e=(0,c.a4)(e,s,{joinRequests:[],fullInfo:{...l.fullInfo,recentRequesterIds:[],requestsPending:0}}),(0,a.R3)(e))})),(0,a.iw)("hideChatReportPanel",(async(e,t,n)=>{const{chatId:s}=n,o=(0,d.Z1)(e,s);o&&await(0,z.t9)("hideChatReportPanel",o)&&(e=(0,a.Rd)(),e=(0,c.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,m._w)()}=n,l=(0,d.dy)(e,s);if(!l)return;e=(0,c.H9)(e,f.wv.InProgress,r),(0,a.R3)(e);const h=await(0,z.t9)("uploadContactProfilePhoto",{user:l,file:o,isSuggest:i});if(!h)return e=(0,a.Rd)(),e=(0,c.H9)(e,f.wv.Error,r),void(0,a.R3)(e);e=(0,a.Rd)(),e=(0,c.Sh)(e,(0,I.ee)(h.users,"id")),(0,a.R3)(e);const{id:g,accessHash:p}=l;if(!await(0,z.t9)("fetchFullUser",{id:g,accessHash:p}))return e=(0,a.Rd)(),e=(0,c.H9)(e,f.wv.Error,r),void(0,a.R3)(e);t.loadProfilePhotos({profileId:s}),e=(0,a.Rd)(),e=(0,c.H9)(e,f.wv.Complete,r),(0,a.R3)(e),o&&!i&&t.showNotification({message:b.Iu("UserInfo.SetCustomPhoto.SuccessPhotoText",(0,u.Vl)(l)),tabId:r})})),(0,a.iw)("sync",((e,t)=>{o.eMD&&console.log(">>> START SYNC"),ue&&clearTimeout(ue),e=(0,a.Rd)(),e={...e,isSyncing:!0},(0,a.R3)(e),ue=window.setTimeout((()=>{e=(0,a.Rd)(),e={...e,isSyncing:!1},(0,a.R3)(e),ue=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,d.Ms)(e,n,Number(a)),editingId:(0,d._$)(e,n,Number(a)),editingDraft:(0,d.s)(e,n,Number(a)),replyingToId:(0,d.Yy)(e,n,Number(a))},t)),{}),t)),{});for(const{id:i}of Object.values(e.byTabId)){e=(0,a.Rd)();const{chatId:h,threadId:p}=(0,d.Bt)(e,i)||{},f=p||r._f,v=p&&h?(0,d.tZ)(e,h,p):void 0,w=h?e.chats.byId[h]:void 0;if(h&&w){const t=await(l=w,u=f,m=v?.lastReadInboxMessageId,(0,z.t9)("fetchMessages",{chat:l,threadId:u,offsetId:m||l.lastReadInboxMessageId,addOffset:-(Math.round(o.hT6/2)+1),limit:o.hT6}));e=(0,a.Rd)();const{chatId:r}=(0,d.Bt)(e,i)||{};if(t&&r===h){const a=(0,d.Zw)(e,h),i=h===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):[],l=[].concat(t.messages,i),u=l.concat(r),m=(0,I.ee)(u,"id"),p=l.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,g.i)(e,{tabThreads:{}},n)})),s=!0),e=(0,c.c_)(e,h,m),e=(0,c.xj)(e,h,f,p),v?.originChannelId&&(e=(0,c.Xg)(e,h,f,v)),Object.values(e.byTabId).forEach((t=>{let{id:n}=t;const{chatId:a,threadId:s}=(0,d.Bt)(e,n)||{};a===h&&s===f&&(e=(0,c.y9)(e,h,f,p,n))})),e=(0,c.GL)(e,(0,I.ee)(t.chats,"id")),e=(0,c.eD)(e,(0,I.ee)(t.users,"id")),t.repliesThreadInfos.length&&(e=(0,c.j6)(e,h,t.repliesThreadInfos)),n=!0}}(0,a.R3)(e),w?.isForum&&(t.loadTopics({chatId:h,force:!0}),p&&p!==r._f&&t.loadTopicById({chatId:h,topicId:p,shouldCloseChatOnError:!0}))}var l,u,m;e=(0,a.Rd)(),n||(e={...e,messages:{...e.messages,byChatId:{}}},Object.values(e.byTabId).forEach((t=>{let{id:n}=t;e=(0,g.i)(e,{tabThreads:{}},n)}))),Object.keys(i).forEach((t=>{const n=i[t];Object.keys(n).forEach((n=>{e=(0,c.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,d.jU)(e,a).audioPlayer;s&&o&&!(0,d.hj)(e,s,o)&&t.closeAudioPlayer({tabId:a})}))}(e,t),e=(0,a.Rd)(),e={...e,lastSyncTime:Date.now(),isSyncing:!1},(0,a.R3)(e),o.eMD&&console.log(">>> FINISH SYNC"),(0,T.S1)(),n({listType:"archived",shouldReplace:!0}),(0,z.t9)("fetchCurrentUser"),s()}})})),(0,L.ll)((e=>{const{connectionState:t,authState:n}=e,{isMasterTab:s}=(0,d.jU)(e);!s||me?.connectionState===t&&me?.authState===n||"connectionStateReady"===t&&"authorizationStateReady"===n&&(0,a.Sv)().sync(),me=e})),(0,a.iw)("reportPeer",(async(e,t,n)=>{const{chatId:a,reason:s,description:o,tabId:i=(0,m._w)()}=n;if(!a)return;const r=(0,d.Z1)(e,a);if(!r)return;const c=await(0,z.t9)("reportPeer",{peer:r,reason:s,description:o});t.showNotification({message:c?(0,b.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,m._w)()}=n;if(!a)return;const c=(0,d.Z1)(e,a);if(!c||!i)return;const l=await(0,z.t9)("reportProfilePhoto",{peer:c,photo:i,reason:s,description:o});t.showNotification({message:l?(0,b.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,z.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,z.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,z.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,z.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,z.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,z.t9)("fetchWebAuthorizations");if(!t)return;const{users:n,webAuthorizations:s}=t;e=(0,a.Rd)(),e=(0,c.Sh)(e,(0,I.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,z.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,z.t9)("terminateAllWebAuthorizations")&&(e=(0,a.Rd)(),e={...e,activeWebSessions:{byHash:{},orderedHashes:[]}},(0,a.R3)(e))}));const he=(0,A.P2)((e=>e()),500,!1);function ge(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,m._w)()]=s;const r=(0,d.jU)(e,i);return(0,g.i)(e,{inlineBots:{...r.inlineBots,byUsername:{...r.inlineBots.byUsername,[t]:n}}},i)}function pe(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,m._w)()]=a;return(0,g.i)(e,{inlineBots:{...(0,d.jU)(e,o).inlineBots,isLoading:t}},o)}(0,a.iw)("loadFullUser",(async(e,t,n)=>{const{userId:a}=n,s=(0,d.dy)(e,a);if(!s)return;const{id:o,accessHash:i}=s,r=await(0,z.t9)("fetchFullUser",{id:o,accessHash:i});if(!r)return;const c=s.avatarHash!==r.avatarHash,l=s.fullInfo?.profilePhoto?.id!==r.fullInfo?.profilePhoto?.id,u=s.fullInfo?.fallbackPhoto?.id!==r.fullInfo?.fallbackPhoto?.id,m=s.fullInfo?.personalPhoto?.id!==r.fullInfo?.personalPhoto?.id;(c||l||u||m)&&s.photos?.length&&t.loadProfilePhotos({profileId:a})})),(0,a.iw)("loadUser",(async(e,t,n)=>{const{userId:s}=n,o=(0,d.dy)(e,s);if(!o)return;const i=await(0,z.t9)("fetchUsers",{users:[o]});if(!i)return;const{users:r,userStatusesById:l}=i;e=(0,a.Rd)(),e=(0,c.eD)(e,(0,I.ee)(r,"id")),e=(0,c.ps)(e,{...e.users.statusesById,...l}),(0,a.R3)(e)})),(0,a.iw)("loadTopUsers",(async e=>{const{topPeers:{lastRequestedAt:t}}=e;if(t&&!((0,v.bp)()-t>60))return;const n=await(0,z.t9)("fetchTopUsers");if(!n)return;const{ids:s,users:o}=n;e=(0,a.Rd)(),e=(0,c.Sh)(e,(0,I.ee)(o,"id")),e={...e,topPeers:{...e.topPeers,userIds:s,lastRequestedAt:(0,v.bp)()}},(0,a.R3)(e)})),(0,a.iw)("loadContactList",(async e=>{const t=await(0,z.t9)("fetchContactList");if(!t)return;e=(0,a.Rd)(),e=(0,c.Sh)(e,(0,I.ee)(t.users,"id")),e=(0,c.fZ)(e,(0,I.ee)(t.chats,"id")),e=(0,c.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,z.t9)("fetchCurrentUser")})),(0,a.iw)("loadCommonChats",(async(e,t,n)=>{const{tabId:s=(0,m._w)()}=n||{},{chatId:o}=(0,d.Bt)(e,s)||{},i=o?(0,d.dy)(e,o):void 0;if(!i||(0,u.cS)(i)||i.commonChats?.isFullyLoaded)return;const r=i.commonChats?.maxId,l=await(0,z.t9)("fetchCommonChats",i.id,i.accessHash,r);if(!l)return;const{chats:h,chatIds:g,isFullyLoaded:p}=l;e=(0,a.Rd)(),h.length&&(e=(0,c.fZ)(e,(0,I.ee)(h,"id"))),e=(0,c.Nq)(e,i.id,{commonChats:{maxId:g.length?g[g.length-1]:"0",ids:(0,I.Tw)((i.commonChats?.ids||[]).concat(g)),isFullyLoaded:p}}),(0,a.R3)(e)})),(0,a.iw)("updateContact",(async(e,t,n)=>{const{userId:s,isMuted:o=!1,firstName:i,lastName:r,shouldSharePhoneNumber:l,tabId:u=(0,m._w)()}=n,h=(0,d.dy)(e,s);if(!h)return;let g;if(t.updateChatMutedState({chatId:s,isMuted:o}),e=(0,a.Rd)(),e=(0,c.H9)(e,f.wv.InProgress,u),(0,a.R3)(e),!h.isContact&&h.phoneNumber)g=await(0,z.t9)("importContact",{phone:h.phoneNumber,firstName:i,lastName:r});else{const{id:e,accessHash:t}=h;g=await(0,z.t9)("updateContact",{id:e,accessHash:t,phoneNumber:"",firstName:i,lastName:r,shouldSharePhoneNumber:l})}g&&(t.loadChatSettings({chatId:s}),e=(0,a.Rd)(),e=(0,c.Nq)(e,h.id,{firstName:i,lastName:r}),(0,a.R3)(e)),e=(0,a.Rd)(),e=(0,c.H9)(e,f.wv.Complete,u),e=(0,c.ft)(e,u),(0,a.R3)(e)})),(0,a.iw)("deleteContact",(async(e,t,n)=>{const{userId:a}=n,s=(0,d.dy)(e,a);if(!s)return;const{id:o,accessHash:i}=s;await(0,z.t9)("deleteContact",{id:o,accessHash:i})})),(0,a.iw)("loadProfilePhotos",(async(e,t,n)=>{const{profileId:s}=n,o=(0,u.YC)(s);let i=o?(0,d.dy)(e,s):void 0;const r=o?void 0:(0,d.Z1)(e,s);if(!i&&!r)return;if(i&&!i.fullInfo?.profilePhoto){const{id:e,accessHash:t}=i;if(i=await(0,z.t9)("fetchFullUser",{id:e,accessHash:t}),!i)return}const l=await(0,z.t9)("fetchProfilePhotos",i,r);if(!l||!l.photos)return;e=(0,a.Rd)();const m=i||r,{photos:h,users:g}=l;h.sort((e=>e.id===m?.avatarHash?-1:1));const p=i?.fullInfo?.fallbackPhoto,f=i?.fullInfo?.personalPhoto;p&&h.push(p),f&&h.unshift(f),e=(0,c.Sh)(e,(0,I.ee)(g,"id")),e=o?(0,c.Nq)(e,s,{photos:h}):(0,c.a4)(e,s,{photos:h}),(0,a.R3)(e)})),(0,a.iw)("setUserSearchQuery",((e,t,n)=>{const{query:s,tabId:o=(0,m._w)()}=n;s&&he((async()=>{const t=await(0,z.t9)("searchChats",{query:s});e=(0,a.Rd)();const n=(0,d.jU)(e,o).userSearch.query;if(!t||!n||s!==n)return e=(0,c.Q3)(e,!1,o),void(0,a.R3)(e);const{localUsers:i,globalUsers:r}=t;let l,u;i.length&&(e=(0,c.Sh)(e,(0,I.ee)(i,"id")),l=i.map((e=>{let{id:t}=e;return t}))),r.length&&(e=(0,c.Sh)(e,(0,I.ee)(r,"id")),u=r.map((e=>{let{id:t}=e;return t}))),e=(0,c.Q3)(e,!1,o),e=(0,c.Lm)(e,{localUserIds:l,globalUserIds:u},o),(0,a.R3)(e)}))})),(0,a.iw)("importContact",(async(e,t,n)=>{const{phoneNumber:s,firstName:o,lastName:i,tabId:r=(0,m._w)()}=n,d=await(0,z.t9)("importContact",{phone:s,firstName:o,lastName:i});d?(t.openChat({id:d,tabId:r}),e=(0,a.Rd)(),e=(0,c.ft)(e,r),(0,a.R3)(e)):t.showNotification({message:b.Iu("Contacts.PhoneNumber.NotRegistred"),tabId:r})})),(0,a.iw)("reportSpam",((e,t,n)=>{const{chatId:a}=n,s=(0,u.YC)(a)?(0,d.dy)(e,a):(0,d.Z1)(e,a);s&&(0,z.t9)("reportSpam",s)})),(0,a.iw)("setEmojiStatus",((e,t,n)=>{const{emojiStatus:a,expires:s}=n;(0,z.t9)("updateEmojiStatus",a,s)}));var fe=n(18629);const Ie=s.cj||s.wZ;class ve{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,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);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(){Ie&&(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(!Ie){const t=window.open(e,void 0,this.features);t?t.focus():this.onFail?.()}}cancelPreOpen(){this.preOpened?.close(),this.preOpened=void 0}}const we="https://prizes.gamee.com/",be=(0,A.Ds)((e=>e()),500,!1);async function Pe(e,t,n,s){await(0,z.t9)("toggleAttachBot",{bot:t,isWriteAllowed:s,isEnabled:n}),e=(0,a.Rd)(),await ye(e)}async function ye(e,t){const n=await(0,z.t9)("loadAttachBots",{hash:t});n&&(e=(0,a.Rd)(),e=(0,c.Sh)(e,(0,I.ee)(n.users,"id")),e={...e,attachMenu:{hash:n.hash,bots:n.bots}},(0,a.R3)(e))}function Ze(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,m._w)()]=i;if("request"===s.type){e=(0,a.Rd)();const t=(0,d.jU)(e,c);if(!t.urlAuth)return;const{domain:n,bot:o,shouldRequestWriteAccess:i}=s;return e=(0,g.i)(e,{urlAuth:{...t.urlAuth,request:{domain:n,botId:o.id,shouldRequestWriteAccess:i}}},c),void(0,a.R3)(e)}const l="accepted"===s.type?s.url:n;window.open(l,"_blank","noopener"),t.closeUrlAuthModal({tabId:c})}async function Ce(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r._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,z.t9)("sendMessage",{chat:e,replyingToTopId:t,text:n,replyingTo:a,sendAs:s})}let Se;async function Ee(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,m._w)()]=r;const{showDialog:l,showNotification:u,openUrl:h,openGame:g}=t;o&&(Se||(Se=new ve("popup,width=800,height=600",(()=>{u({message:"Allow browser to open popup window",tabId:d})}))),Se.preOpenIfNeeded());const p=await(0,z.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(we)?Se.open(v):(Se.cancelPreOpen(),g({url:v,chatId:n.id,messageId:a,tabId:d})):h({url:v,tabId:d}))}async function Me(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,m._w)()]=s;const r=await(0,z.t9)("getPaymentForm",t);if(!r)return;const{form:d,invoice:l,users:u}=r;return e=(0,a.Rd)(),e=(0,c._7)(e,d,i),e=(0,c.Q$)(e,f.KB.Checkout,i),e=(0,c.Sh)(e,(0,I.ee)(u,"id")),(0,a.R3)(e),l}async function Re(e,t,n,s){for(var o=arguments.length,i=new Array(o>4?o-4:0),r=4;r<o;r++)i[r-4]=arguments[r];let[d=(0,m._w)()]=i;const l=await(0,z.t9)("validateRequestedInfo",{inputInvoice:t,requestInfo:n,shouldSave:s});if(!l)return;const{id:u,shippingOptions:h}=l;e=(0,a.Rd)(),e=(0,c.vT)(e,u,d),h?(e=(0,c.TM)(e,h,d),e=(0,c.Q$)(e,f.KB.Shipping,d)):e=(0,c.Q$)(e,f.KB.Checkout,d),(0,a.R3)(e)}(0,a.iw)("clickBotInlineButton",((e,t,n)=>{const{messageId:a,button:s,tabId:o=(0,m._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,d.jr)(e,o);if(!n)return;Ee(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,d.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,d.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,d.jr)(e,o);if(!n)return;t.openInvoice({chatId:n.id,messageId:a,tabId:o});break}case"game":{const n=(0,d.jr)(e,o);if(!n)return;Ee(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,d.Bt)(e,o)||{};if(!i)return;const r=(0,d.hj)(e,i,a);if(!r?.senderId)return;const c=(0,fe.BS)();t.requestSimpleWebView({url:n,botId:r?.senderId,theme:c,buttonText:s.text,tabId:o});break}case"webView":{const{url:n}=s,i=(0,d.jr)(e,o);if(!i)return;const r=(0,d.hj)(e,i.id,a);if(!r)return;const c=r.viaBotId||r.senderId;if(!c)return;const l=(0,fe.BS)();t.requestWebView({url:n,botId:c,peerId:i.id,theme:l,buttonText:s.text,tabId:o});break}case"urlAuth":{const{url:n}=s,i=(0,d.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,m._w)()}=n,i=s?(0,d.Z1)(e,s):(0,d.jr)(e,o),r=(0,d.Bt)(e,o);if(!i||!r)return;const{threadId:c}=r;t.setReplyingToId({messageId:void 0,tabId:o}),t.clearWebPagePreview({tabId:o}),Ce(i,c,a,(0,d.Yy)(e,i.id,c),(0,d._5)(e,i.id))})),(0,a.iw)("restartBot",(async(e,t,n)=>{const{chatId:s,tabId:o=(0,m._w)()}=n,{currentUserId:i}=e,l=(0,d.jr)(e,o),u=i&&(0,d.IK)(e,s);i&&l&&u&&await(0,z.t9)("unblockContact",u.id,u.accessHash)&&(e=(0,a.Rd)(),e=(0,c.rB)(e,u.id),(0,a.R3)(e),Ce(l,r._f,"/start",void 0,(0,d._5)(e,s)))})),(0,a.iw)("loadTopInlineBots",(async e=>{const{lastRequestedAt:t}=e.topInlineBots;if(t&&(0,v.bp)()-t<60)return;const n=await(0,z.t9)("fetchTopInlineBots");if(!n)return;const{ids:s,users:o}=n;e=(0,a.Rd)(),e=(0,c.Sh)(e,(0,I.ee)(o,"id")),e={...e,topInlineBots:{...e.topInlineBots,userIds:s,lastRequestedAt:(0,v.bp)()}},(0,a.R3)(e)})),(0,a.iw)("queryInlineBot",(async(e,t,n)=>{const{chatId:s,username:o,query:i,offset:r,tabId:l=(0,m._w)()}=n;let u=(0,d.jU)(e,l).inlineBots.byUsername[o];if(!1!==u){if(void 0===u){const{user:t,chat:n}=await(0,z.t9)("fetchInlineBot",{username:o})||{};if(e=(0,a.Rd)(),!t||!n)return e=ge(e,o,!1,l),void(0,a.R3)(e);e=(0,c.Sh)(e,{[t.id]:t}),e=(0,c.fZ)(e,{[n.id]:n}),u={id:t.id,query:"",offset:"",switchPm:void 0,canLoadMore:!0,results:[],cacheTime:0},e=ge(e,o,u,l),(0,a.R3)(e)}(i!==u.query||u.canLoadMore)&&be((()=>{!async function(e,t){let{username:n,inlineBotData:s,chatId:o,query:i,offset:r}=t;for(var c=arguments.length,l=new Array(c>2?c-2:0),u=2;u<c;u++)l[u-2]=arguments[u];let[h=(0,m._w)()]=l;e=(0,a.Rd)();const g=(0,d.dy)(e,s.id),p=(0,d.Z1)(e,o);if(!g||!p)return;const f=s.query!==i;e=ge(e=pe(e,!0,h),n,{...s,query:i,...f&&{offset:void 0,results:[]}},h),(0,a.R3)(e);const I=await(0,z.t9)("fetchInlineBotResults",{bot:g,chat:p,query:i,offset:f?void 0:r});e=(0,a.Rd)();const v=(0,d.jU)(e,h).inlineBots.byUsername[n];if(e=pe(e,!1,h),!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=ge(e,n,{...v,help:I.help,cacheTime:Date.now()+1e3*I.cacheTime,...b.length&&{isGallery:I.isGallery},...I.switchPm&&{switchPm:I.switchPm},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:""},h),(0,a.R3)(e)}(e,{username:o,inlineBotData:u,chatId:s,query:i,offset:r},l)}))}})),(0,a.iw)("switchBotInline",((e,t,n)=>{const{query:a,isSamePeer:s,messageId:o,tabId:i=(0,m._w)()}=n,r=(0,d.jr)(e,i);if(!r)return;const c=(0,d.hj)(e,r.id,o);if(!c)return;const l=(0,d.dy)(e,c.viaBotId||c.senderId);l&&t.openChatWithDraft({text:`@${l.usernames[0].username} ${a}`,chatId:s?r.id:void 0,tabId:i})})),(0,a.iw)("sendInlineBotResult",((e,t,n)=>{const{id:a,queryId:s,isSilent:o,scheduledAt:i,tabId:c=(0,m._w)()}=n,l=(0,d.Bt)(e,c);if(!l||!a)return;const{chatId:u,threadId:h}=l,g=(0,d.Z1)(e,u),p=(0,d.Yy)(e,u,h);let f;p&&h!==r._f&&(f=(0,d.qS)(e,u,h)),t.setReplyingToId({messageId:void 0,tabId:c}),t.clearWebPagePreview({tabId:c}),(0,z.t9)("sendInlineBotResult",{chat:g,resultId:a,queryId:s,replyingTo:p,replyingToTopId:f,sendAs:(0,d._5)(e,u),isSilent:o,scheduleDate:i})})),(0,a.iw)("resetInlineBot",((e,t,n)=>{const{username:s,force:o,tabId:i=(0,m._w)()}=n;let r=(0,d.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=ge(e,s,r,i),(0,a.R3)(e)))})),(0,a.iw)("resetAllInlineBots",((e,t,n)=>{const{tabId:a=(0,m._w)()}=n||{},s=(0,d.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:s,param:o}=n;let i=(0,d.dy)(e,s);i&&(i.fullInfo||await(0,z.t9)("fetchFullUser",{id:i.id,accessHash:i.accessHash}),e=(0,a.Rd)(),i=(0,d.dy)(e,s),i.fullInfo?.isBlocked&&await(0,z.t9)("unblockContact",i.id,i.accessHash),await(0,z.t9)("startBot",{bot:i,startParam:o}))})),(0,a.iw)("requestSimpleWebView",(async(e,t,n)=>{const{url:s,botId:o,theme:i,buttonText:r,tabId:c=(0,m._w)()}=n,l=(0,d.dy)(e,o);if(!l)return;if(!(0,d.LM)(e,o))return e=(0,g.i)(e,{botTrustRequest:{botId:o,type:"webApp",onConfirm:{action:"requestSimpleWebView",payload:n}}},c),void(0,a.R3)(e);const u=await(0,z.t9)("requestSimpleWebView",{url:s,bot:l,theme:i});u&&(e=(0,a.Rd)(),e=(0,g.i)(e,{webApp:{url:u,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:l,isFromBotMenu:u,startParam:h,tabId:p=(0,m._w)()}=n,f=(0,d.dy)(e,o);if(!f)return;const I=(0,d.Z1)(e,i);if(!I)return;if(!(0,d.LM)(e,o))return e=(0,g.i)(e,{botTrustRequest:{botId:o,type:"webApp",onConfirm:{action:"requestWebView",payload:n}}},p),void(0,a.R3)(e);const v=(0,d.Bt)(e,p);if(!v)return;const{chatId:w,threadId:b}=v,P=w&&(0,d.Yy)(e,w,b),y=(0,d._5)(e,w),Z=await(0,z.t9)("requestWebView",{url:s,bot:f,peer:I,theme:r,isSilent:c,replyToMessageId:P||void 0,threadId:b,isFromBotMenu:u,startParam:h,sendAs:y});if(!Z)return;const{url:C,queryId:S}=Z;e=(0,a.Rd)(),e=(0,g.i)(e,{webApp:{url:C,botId:o,queryId:S,replyToMessageId:P||void 0,threadId:b,buttonText:l}},p),(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:l=(0,m._w)()}=n,u=(0,d.dy)(e,a);if(!u)return;const h=(0,d.Z1)(e,s);if(!h)return;const g=(0,d._5)(e,s);await(0,z.t9)("prolongWebView",{bot:u,peer:h,isSilent:o,replyToMessageId:i,threadId:c,queryId:r,sendAs:g})||t.closeWebApp({tabId:l})})),(0,a.iw)("sendWebViewData",((e,t,n)=>{const{bot:a,data:s,buttonText:o}=n;(0,z.t9)("sendWebViewData",{bot:a,data:s,buttonText:o})})),(0,a.iw)("closeWebApp",((e,t,n)=>{const{tabId:a=(0,m._w)()}=n||{};return(0,g.i)(e,{webApp:void 0},a)})),(0,a.iw)("setWebAppPaymentSlug",((e,t,n)=>{const{tabId:a=(0,m._w)()}=n,s=(0,d.jU)(e,a);if(s.webApp?.url)return(0,g.i)(e,{webApp:{...s.webApp,slug:n.slug}},a)})),(0,a.iw)("cancelBotTrustRequest",((e,t,n)=>{const{tabId:a=(0,m._w)()}=n||{};return(0,g.i)(e,{botTrustRequest:void 0},a)})),(0,a.iw)("markBotTrusted",((e,t,n)=>{const{botId:s,tabId:o=(0,m._w)()}=n,{trustedBotIds:i}=e,r=new Set(i);r.add(s),e={...e,trustedBotIds:Array.from(r)};const c=(0,d.jU)(e,o);if(c.botTrustRequest?.onConfirm){const{action:e,payload:n}=c.botTrustRequest.onConfirm;t[e](n)}e=(0,g.i)(e,{botTrustRequest:void 0},o),(0,a.R3)(e)})),(0,a.iw)("loadAttachBots",(async(e,t,n)=>{const{hash:a}=n||{};await ye(e,a)})),(0,a.iw)("toggleAttachBot",(async(e,t,n)=>{const{botId:a,isWriteAllowed:s,isEnabled:o}=n,i=(0,d.dy)(e,a);i&&await Pe(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,m._w)()}=n,d=!s;if(!d&&!e.attachMenu.bots[s.id])return(0,g.i)(e,{requestedAttachBotInstall:{bot:s,onConfirm:{action:"callAttachBot",payload:n}}},c);const l=(0,fe.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,m._w)()}=n,{requestedAttachBotInstall:i}=(0,d.jU)(e,o),{bot:r,onConfirm:c}=i;e=(0,g.i)(e,{requestedAttachBotInstall:void 0},o),(0,a.R3)(e);const l=(0,d.dy)(e,r.id);if(l&&(await Pe(e,l,!0,s),c)){const{action:e,payload:n}=c;t[e](n)}})),(0,a.iw)("cancelAttachBotInstall",((e,t,n)=>{const{tabId:a=(0,m._w)()}=n||{};return(0,g.i)(e,{requestedAttachBotInstall:void 0},a)})),(0,a.iw)("requestAttachBotInChat",((e,t,n)=>{const{bot:s,filter:o,startParam:i,tabId:r=(0,m._w)()}=n,c=(0,d.Bt)(e,r)?.chatId,l=s.peerTypes.filter((e=>"self"!==e&&o.includes(e)));l.length?(e=(0,g.i)(e,{requestedAttachBotInChat:{bot:s,filter:l,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,m._w)()}=n||{};return(0,g.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,m._w)()}=n,l=(0,d.Z1)(e,s);if(!l)return;const u=await(0,z.t9)("requestBotUrlAuth",{chat:l,buttonId:o,messageId:i});u&&(e=(0,a.Rd)(),e=(0,g.i)(e,{urlAuth:{url:r,button:{buttonId:o,messageId:i,chatId:l.id}}},c),(0,a.R3)(e),Ze(e,t,r,u,c))})),(0,a.iw)("acceptBotUrlAuth",(async(e,t,n)=>{const{isWriteAllowed:s,tabId:o=(0,m._w)()}=n,i=(0,d.jU)(e,o);if(!i.urlAuth?.button)return;const{button:r,url:c}=i.urlAuth,{chatId:l,messageId:u,buttonId:h}=r,g=(0,d.Z1)(e,l);if(!g)return;const p=await(0,z.t9)("acceptBotUrlAuth",{chat:g,messageId:u,buttonId:h,isWriteAllowed:s});p&&Ze(e=(0,a.Rd)(),t,c,p,o)})),(0,a.iw)("requestLinkUrlAuth",(async(e,t,n)=>{const{url:s,tabId:o=(0,m._w)()}=n,i=await(0,z.t9)("requestLinkUrlAuth",{url:s});i&&(e=(0,a.Rd)(),e=(0,g.i)(e,{urlAuth:{url:s}},o),(0,a.R3)(e),Ze(e,t,s,i,o))})),(0,a.iw)("acceptLinkUrlAuth",(async(e,t,n)=>{const{isWriteAllowed:s,tabId:o=(0,m._w)()}=n,i=(0,d.jU)(e,o);if(!i.urlAuth?.url)return;const{url:r}=i.urlAuth,c=await(0,z.t9)("acceptLinkUrlAuth",{url:r,isWriteAllowed:s});c&&Ze(e=(0,a.Rd)(),t,r,c,o)})),(0,a.iw)("closeUrlAuthModal",((e,t,n)=>{const{tabId:a=(0,m._w)()}=n||{};return(0,g.i)(e,{urlAuth:void 0},a)})),n(55282),(0,a.iw)("loadPasswordInfo",(async e=>{const t=await(0,z.t9)("getPasswordInfo");t&&(e=(0,a.Rd)(),e=(0,c.BI)(e,{hasPassword:t.hasPassword}),e=(0,c.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,c.IE)(e,{isLoading:!0,error:void 0}),(0,a.R3)(e);const i=await(0,z.t9)("checkPassword",s);e=(0,a.Rd)(),e=(0,c.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,c.IE)(e,{isLoading:!0,error:void 0}),(0,a.R3)(e);const i=await(0,z.t9)("clearPassword",s);e=(0,a.Rd)(),e=(0,c.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:d}=n;e=(0,c.IE)(e,{isLoading:!0,error:void 0}),(0,a.R3)(e);const l=await(0,z.t9)("updatePassword",s,o,i,r);e=(0,a.Rd)(),e=(0,c.IE)(e,{isLoading:!1}),(0,a.R3)(e),l&&d()})),(0,a.iw)("updateRecoveryEmail",(async(e,t,n)=>{const{currentPassword:s,email:o,onSuccess:i}=n;e=(0,c.IE)(e,{isLoading:!0,error:void 0}),(0,a.R3)(e);const r=await(0,z.t9)("updateRecoveryEmail",s,o);e=(0,a.Rd)(),e=(0,c.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,z.t9)("provideRecoveryEmailCode",a)})),(0,a.iw)("clearTwoFaError",(e=>(0,c.IE)(e,{error:void 0}))),(0,a.iw)("validateRequestedInfo",((e,t,n)=>{const{requestInfo:a,saveInfo:s,tabId:o=(0,m._w)()}=n,i=(0,d.kb)(e,o);if(i)if("slug"in i)Re(e,i,a,s,o);else{const t=(0,d.Z1)(e,i.chatId);if(!t)return;Re(e,{chat:t,messageId:i.messageId},a,s,o)}})),(0,a.iw)("openInvoice",(async(e,t,n)=>{const{tabId:s=(0,m._w)()}=n;let o;if("slug"in n)o=await Me(e,{slug:n.slug},s);else{const t=(0,d.Z1)(e,n.chatId);if(!t)return;o=await Me(e,{chat:t,messageId:n.messageId},s)}o&&(e=(0,a.Rd)(),e=(0,c.bs)(e,o,s),e=(0,g.i)(e,{payment:{...(0,d.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,m._w)()}=n,l=o&&(0,d.Z1)(e,o);if(!i||!s||!l)return;const u=await(0,z.t9)("getReceipt",l,s);if(!u)return;e=(0,a.Rd)();const h=(0,d.hj)(e,l.id,i);e=(0,c.Sh)(e,(0,I.ee)(u.users,"id")),e=(0,c.Dq)(e,u.receipt,h,r),(0,a.R3)(e)})),(0,a.iw)("clearPaymentError",((e,t,n)=>{const{tabId:s=(0,m._w)()}=n||{};e=(0,g.i)(e,{payment:{...(0,d.jU)(e,s).payment,error:void 0}},s),(0,a.R3)(e)})),(0,a.iw)("clearReceipt",((e,t,n)=>{const{tabId:a=(0,m._w)()}=n||{};return(0,g.i)(e,{payment:{...(0,d.jU)(e,a).payment,receipt:void 0}},a)})),(0,a.iw)("sendCredentialsInfo",((e,t,n)=>{const{credentials:s,tabId:i=(0,m._w)()}=n,{nativeProvider:r}=(0,d.jU)(e,i).payment,{data:l}=s;if("stripe"===r){const t=(0,d.$$)(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,m._w)()]=o;const l=function(e){const t=Object.keys(e).map((t=>`${t}=${e[t]}`)).join("&");return t.length>0?`?${t}`:""}({"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}),h=await fetch(`https://api.stripe.com/v1/tokens${l}`,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/x-www-form-urlencoded",Authorization:`Bearer ${n}`}}),p=await h.json();if(p.error){const t=(0,u.Ow)(p.error);return e=(0,a.Rd)(),e=(0,g.i)(e,{payment:{...(0,d.jU)(e,r).payment,status:"failed",error:{...t}}},r),void(0,a.R3)(e)}e=(0,a.Rd)(),e=(0,c.QH)(e,{type:p.type,id:p.id},r),e=(0,c.Q$)(e,f.KB.Checkout,r),(0,a.R3)(e)}(e,l,t,i)}else if("smartglocal"===r){const t=(0,d.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[l=(0,m._w)()]=i;const u={card:{number:t.cardNumber.replace(/\D+/g,""),expiration_month:t.expiryMonth,expiration_year:t.expiryYear,security_code:t.cvv.replace(/\D+/g,"")}},h=o.eAU?"https://tgb-playground.smart-glocal.com/cds/v1/tokenize/card":"https://tgb.smart-glocal.com/cds/v1/tokenize/card",p=await fetch(h,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json","X-PUBLIC-TOKEN":n},body:JSON.stringify(u)}),I=await p.json();if("ok"!==I.status){const t={description:"payment error"};return e=(0,a.Rd)(),e=(0,g.i)(e,{payment:{...(0,d.jU)(e,l).payment,status:"failed",error:{...t}}},l),void(0,a.R3)(e)}e=(0,a.Rd)(),e=(0,c.QD)(e,{type:"card",token:I.data.token},l),e=(0,c.Q$)(e,f.KB.Checkout,l),(0,a.R3)(e)}(e,l,t,i)}})),(0,a.iw)("sendPaymentForm",(async(e,t,n)=>{const{shippingOptionId:s,saveCredentials:o,savedCredentialId:i,tipAmount:r,tabId:l=(0,m._w)()}=n,u=(0,d.kb)(e,l),h=(0,d.eh)(e,l),g=(0,d.sp)(e,l),{nativeProvider:p,temporaryPassword:f}=(0,d.jU)(e,l).payment,I="stripe"===p?(0,d.$$)(e,l):(0,d.EB)(e,l);if(!(u&&I&&h&&p))return;let v;if("slug"in u)v={slug:u.slug};else{const t=(0,d.Z1)(e,u.chatId);if(!t)return;v={chat:t,messageId:u.messageId}}e=(0,c.cQ)(e,{status:"pending"},l),(0,a.R3)(e);const w={save:o,data:"stripe"===p?(0,d.i3)(e,l):(0,d.Jg)(e,l)};await(0,z.t9)("sendPaymentForm",{inputInvoice:v,formId:h,credentials:w,requestedInfoId:g,shippingOptionId:s,savedCredentialId:i,temporaryPassword:f?.value,tipAmount:r})&&(e=(0,a.Rd)(),e=(0,c.cQ)(e,{status:"paid"},l),e=(0,c.WY)(e,l),(0,a.R3)(e))})),(0,a.iw)("setPaymentStep",((e,t,n)=>{const{step:a,tabId:s=(0,m._w)()}=n;return(0,c.Q$)(e,null!=a?a:f.KB.Checkout,s)})),(0,a.iw)("closePremiumModal",((e,t,n)=>{const{isClosed:a,tabId:s=(0,m._w)()}=n||{},o=(0,d.jU)(e,s);if(o.premiumModal)return(0,g.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:d,toUserId:l,tabId:u=(0,m._w)()}=n||{};t.loadPremiumStickers();const h=await(0,z.t9)("fetchPremiumPromo");h&&(e=(0,a.Rd)(),e=(0,c.Sh)(e,(0,I.ee)(h.users,"id")),e=(0,g.i)(e,{premiumModal:{promo:h.promo,initialSection:s,isOpen:!0,fromUserId:o,toUserId:l,isGift:r,monthsAmount:d,isSuccess:i}},u),(0,a.R3)(e))})),(0,a.iw)("openGiftPremiumModal",(async(e,t,n)=>{const{forUserId:s,tabId:o=(0,m._w)()}=n||{},i=await(0,z.t9)("fetchPremiumPromo");if(!i)return;e=(0,a.Rd)(),e=(0,c.Sh)(e,(0,I.ee)(i.users,"id"));const r=i.promo.options.find((e=>1===e.months));e=(0,g.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,m._w)()}=n||{};e=(0,g.i)(e,{giftPremiumModal:{isOpen:!1}},s),(0,a.R3)(e)})),(0,a.iw)("validatePaymentPassword",(async(e,t,n)=>{const{password:s,tabId:o=(0,m._w)()}=n,i=await(0,z.t9)("fetchTemporaryPaymentPassword",s);e=(0,a.Rd)(),e=i?"error"in i?(0,c.cQ)(e,{error:{message:i.error,field:"password"}},o):(0,c.cQ)(e,{temporaryPassword:i,step:f.KB.Checkout},o):(0,c.cQ)(e,{error:{message:"Unknown Error",field:"password"}},o),(0,a.R3)(e)}));var ke=n(40647),Te=n(74399);const Ne=32*Te.Gw,Ae=45.5*Te.Gw,xe=26.5*Te.Gw,Be=16*Te.Gw,Le=16.125*Te.Gw;var Ue=n(43858),je=n(53475),Oe=n(4907);function Fe(e,t){return t-((0,d.jU)(e).isLeftColumnShown&&!(0,C.W7)()?e.leftColumnWidth||((n=Ue.Z.get().width)>o._mX?Math.min(Math.max(.25*n,Be),.33*n):n>o.ksF?Math.min(Math.max(.33*n,Be),.4*n):xe):0);var n}function _e(e,t,n){return(0,je.a4)(e,t,n,void 0,!0)}let De=0;(0,a.iw)("loadAvailableReactions",(async e=>{const t=await(0,z.t9)("getAvailableReactions");t&&(t.forEach((e=>{e.aroundAnimation&&ke.he(`sticker${e.aroundAnimation.id}`,r.IU.BlobUrl),e.centerIcon&&ke.he(`sticker${e.centerIcon.id}`,r.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,m._w)()}=n,l={id:De++,animatedEffect:a,x:Fe(e,s)+40*Math.random()-20,y:o+40*Math.random()-20,startSize:i,isReversed:r};return(0,g.i)(e,{activeEmojiInteractions:[...(0,d.jU)(e,c).activeEmojiInteractions||[],l]},c)})),(0,a.iw)("sendEmojiInteraction",((e,t,n)=>{const{messageId:a,chatId:s,emoji:o,interactions:i}=n,r=(0,d.Z1)(e,s);r&&o&&s!==e.currentUserId&&(0,z.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,m._w)()}=n,i=(0,d.q6)(e,a),r=(0,d.hj)(e,a,s);i&&r&&!(0,u.CI)(r)&&t.toggleReaction({chatId:a,messageId:s,reaction:i,tabId:o})})),(0,a.iw)("toggleReaction",((e,t,n)=>{const{chatId:a,reaction:s,tabId:i=(0,m._w)()}=n;let{messageId:r}=n;const c=(0,d.Z1)(e,a);let l=(0,d.hj)(e,a,r);if(!c||!l)return;const h=Boolean(l.groupedId)&&!l.isInAlbum,p=h?(0,d.xH)(e,a,l.groupedId)[0]:void 0;l=h&&(0,d.hj)(e,a,p)||l,r=l?.id||r;const f=(0,u.UZ)(l),v=f.some((e=>(0,u.Hl)(e,s))),w=v?f.filter((e=>!(0,u.Hl)(e,s))):[...f,s],b=(0,d.oC)(e),P=w.slice(-b);(0,z.t9)("sendReaction",{chat:c,messageId:r,reactions:P});const{animationLevel:y}=e.settings.byKey,Z=(0,d.jU)(e,i);if(y===o.zy8){const t=v?(0,I.CE)(Z.activeReactions,[r]):{...Z.activeReactions,[r]:[...Z.activeReactions[r]||[],{messageId:r,reaction:s}]};e=(0,g.i)(e,{activeReactions:t},i)}return function(e,t,n){const a=t.reactions||{results:[]},s=a.results.map((e=>(0,u.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=s.findIndex((t=>(0,u.Hl)(t.reaction,e)));n>-1?s[n]={...s[n],chosenOrder:t,count:s[n].count+1}:s.push({reaction:e,chosenOrder:t,count:1})}));let{recentReactions:o=[]}=a;return o.length&&(o=o.filter((t=>{let{userId:n}=t;return n!==e.currentUserId}))),n.forEach((t=>{const{currentUserId:n}=e;o.unshift({userId:n,reaction:t})})),(0,Oe.cY)(e,t.chatId,t.id,{reactions:{...a,results:s,recentReactions:o}})}(e,l,P)})),(0,a.iw)("stopActiveReaction",((e,t,n)=>{const{messageId:a,reaction:s,tabId:o=(0,m._w)()}=n,i=(0,d.jU)(e,o);if(!i.activeReactions[a]?.some((e=>(0,u.Hl)(e.reaction,s))))return e;const r=i.activeReactions[a].filter((e=>!(0,u.Hl)(e.reaction,s))),c=r.length?{...i.activeReactions,[a]:r}:(0,I.CE)(i.activeReactions,[a]);return(0,g.i)(e,{activeReactions:c},o)})),(0,a.iw)("setDefaultReaction",(async(e,t,n)=>{const{reaction:s}=n;await(0,z.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,m._w)()}=n;return(0,g.i)(e,{activeEmojiInteractions:(0,d.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,d.Z1)(e,s),l=(0,d.hj)(e,s,o);if(!r||!l)return;const u=l.reactors?.nextOffset,m=await(0,z.t9)("fetchMessageReactionsList",{reaction:i,chat:r,messageId:o,offset:u});m&&(e=(0,a.Rd)(),m.users?.length&&(e=(0,c.Sh)(e,(0,I.ee)(m.users,"id"))),e=(0,c.cY)(e,s,o,{reactors:m}),(0,a.R3)(e))})),(0,a.iw)("loadMessageReactions",((e,t,n)=>{const{ids:a,chatId:s}=n,o=(0,d.Z1)(e,s);o&&(0,z.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:l,tabId:u=(0,m._w)()}=n,h=(0,d.Z1)(e,a),p=(0,d.jU)(e,u);if(h&&p.activeEmojiInteractions?.some((e=>e.id===l))&&a!==e.currentUserId)return(0,z.t9)("sendWatchingEmojiInteraction",{chat:h,emoticon:s}),(0,g.i)(e,{activeEmojiInteractions:p.activeEmojiInteractions.map((t=>t.id===l?{...t,x:Fe(e,o),y:i,startSize:r,isReversed:c}:t))},u)})),(0,a.iw)("fetchUnreadReactions",(async(e,t,n)=>{const{chatId:s,offsetId:o}=n,i=(0,d.Z1)(e,s);if(!i)return;const r=await(0,z.t9)("fetchUnreadReactions",{chat:i,offsetId:o,addOffset:o?-1:void 0});if(!r||!r.messages.length)return e=_e(e=(0,a.Rd)(),s,{unreadReactionsCount:0}),void(0,a.R3)(e);const{messages:l,chats:u,users:m}=r,h=(0,I.ee)(l,"id"),g=Object.keys(h).map(Number);e=(0,a.Rd)(),e=(0,c.c_)(e,i.id,h),e=(0,c.Sh)(e,(0,I.ee)(m,"id")),e=_e(e=(0,c.fZ)(e,(0,I.ee)(u,"id")),s,{unreadReactions:[...i.unreadReactions||[],...g]}),(0,a.R3)(e)})),(0,a.iw)("animateUnreadReaction",((e,t,n)=>{const{messageIds:s,tabId:i=(0,m._w)()}=n,{animationLevel:r}=e.settings.byKey,c=(0,d.jr)(e,i);if(c){if(c.unreadReactionsCount){const n=c.unreadReactionsCount-s.length,o=(c.unreadReactions||[]).filter((e=>!s.includes(e)));e=_e(e,c.id,{unreadReactions:o}),(0,a.R3)(e),!o.length&&n&&t.fetchUnreadReactions({chatId:c.id,offsetId:Math.min(...s)})}if(t.markMessagesRead({messageIds:s,tabId:i}),r===o.zy8)return e=(0,a.Rd)(),(0,g.i)(e,{activeReactions:{...(0,d.jU)(e,i).activeReactions,...Object.fromEntries(s.map((t=>{const n=(0,d.hj)(e,c.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))}},i)}})),(0,a.iw)("focusNextReaction",((e,t,n)=>{const{tabId:a=(0,m._w)()}=n||{},s=(0,d.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,m._w)()}=n||{},s=(0,d.jr)(e,a);if(s)return(0,z.t9)("readAllReactions",{chat:s}),_e(e,s.id,{unreadReactionsCount:void 0,unreadReactions:void 0})})),(0,a.iw)("loadStatistics",(async(e,t,n)=>{const{chatId:s,isGroup:o,tabId:i=(0,m._w)()}=n,r=(0,d.Z1)(e,s);if(!r?.fullInfo)return;const l=await(0,z.t9)(o?"fetchGroupStatistics":"fetchChannelStatistics",{chat:r});if(!l)return;e=(0,a.Rd)();const{stats:u,users:h}=l;if(e=(0,c.Sh)(e,(0,I.ee)(h,"id")),"recentTopMessages"in u&&u.recentTopMessages.length){const t=(0,d.Zw)(e,s);u.recentTopMessages=u.recentTopMessages.map((e=>({...e,...t[e.msgId]})))}e=(0,c.ze)(e,s,u,i),(0,a.R3)(e)})),(0,a.iw)("loadMessageStatistics",(async(e,t,n)=>{const{chatId:s,messageId:o,tabId:i=(0,m._w)()}=n,r=(0,d.Z1)(e,s);if(!r?.fullInfo)return;let l=await(0,z.t9)("fetchMessageStatistics",{chat:r,messageId:o});l||(l={}),e=(0,a.Rd)();const{views:u,forwards:h}=(0,d.Zw)(e,s)[o];l.views=u,l.forwards=h;const g=r.fullInfo.statisticsDcId,p=await(0,z.t9)("fetchMessagePublicForwards",{chat:r,messageId:o,dcId:g});l.publicForwards=p?.length,l.publicForwardsData=p,e=(0,a.Rd)(),e=(0,c.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:l=(0,m._w)()}=n,u=(0,d.Z1)(e,s);if(!u?.fullInfo)return;const h=u.fullInfo.statisticsDcId,g=await(0,z.t9)("fetchStatisticsAsyncGraph",{token:o,dcId:h,isPercentage:r});g&&(e=(0,a.Rd)(),e=(0,c.yC)(e,s,i,g,l),(0,a.R3)(e))})),n(28304);var qe=n(28406);(0,a.iw)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"updateChat":{const{isForum:s,lastReadOutboxMessageId:o}=(0,d.Z1)(e,n.id)||{};return n.chat.lastReadOutboxMessageId&&o&&n.chat.lastReadOutboxMessageId<o&&(n={...n,chat:(0,I.CE)(n.chat,["lastReadInboxMessageId"])}),e=(0,c.a4)(e,n.id,n.chat,n.newProfilePhoto),(0,a.R3)(e),n.noTopChatsRequest||(0,d.N)(e,n.id)||t.loadTopChats(),n.chat.id&&(0,qe.Vr)({chatId:n.chat.id,lastReadInboxMessageId:n.chat.lastReadInboxMessageId}),void Object.values(e.byTabId).forEach((a=>{let{id:o}=a;const{chatId:i}=(0,d.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,d.Ek)(e,n.id);if(!s)return;e=(0,c.B1)(e,s,[n.id]),e=(0,c.a4)(e,n.id,{isNotJoined:!1}),(0,a.R3)(e);const o=(0,d.Z1)(e,n.id);return void(o&&t.requestChatUpdate({chatId:o.id}))}case"updateChatLeave":return(0,c.Dd)(e,n.id);case"updateChatInbox":return(0,c.a4)(e,n.id,n.chat);case"updateChatTypingStatus":{const{id:t,threadId:s=r._f,typingStatus:o}=n;return e=(0,c.pf)(e,t,s,"typingStatus",o),(0,a.R3)(e),void setTimeout((()=>{e=(0,a.Rd)();const n=(0,d.WP)(e,t,s,"typingStatus");o&&n&&o.timestamp===n.timestamp&&(e=(0,c.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,d.Z1)(e,n.chatId);if(!s)return;const o=Boolean(n.message.id&&n.message.hasUnreadMention);return e=(0,c.a4)(e,n.chatId,{unreadCount:s.unreadCount?s.unreadCount+1:1,...o&&{unreadMentionsCount:(s.unreadMentionsCount||0)+1}}),o&&(e=(0,c.a4)(e,n.chatId,{unreadMentions:[...s.unreadMentions||[],n.message.id]})),(0,a.R3)(e),void(0,qe.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,d.X5)(e,t),s=(0,d.Z1)(e,a);s?.unreadReactionsCount&&(e=_e(e,a,{unreadReactionsCount:s.unreadReactionsCount-1||void 0,unreadReactions:s.unreadReactions?.filter((e=>e!==t))})),s?.unreadMentionsCount&&(e=(0,c.a4)(e,a,{unreadMentionsCount:s.unreadMentionsCount-1||void 0,unreadMentions:s.unreadMentions?.filter((e=>e!==t))}))})),e}case"updateChatFullInfo":{const{fullInfo:t}=n,a=e.chats.byId[n.id];if(!a)return;return(0,c.a4)(e,n.id,{fullInfo:{...a.fullInfo,...t}})}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,d.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,c.Pi)(e,t,a)}case"updateChatFolder":{const{id:t,folder:a}=n,{byId:s,orderedIds:o}=e.chatFolders,i=a?{...s,[t]:a}:(0,I.ei)(s,Object.keys(s).map(Number).filter((e=>e!==t))),r=a?o&&o.includes(t)?o:[...o||[],t]:o?o.filter((e=>e!==t)):void 0;return{...e,chatFolders:{...e.chatFolders,byId:i,orderedIds:r}}}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=e.chats.byId[n.id],{replacedMembers:a,addedMember:s,deletedMemberId:o}=n;if(!t)return;let i=!1,r=t.fullInfo?.members?[...t.fullInfo.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 a=r.filter((e=>{let{isOwner:t,isAdmin:n}=e;return t||n}));return(0,c.a4)(e,n.id,{membersCount:r.length,fullInfo:{...t.fullInfo,members:r,adminMembersById:(0,I.ee)(a,"userId")}})}return}case"deleteProfilePhotos":{const{chatId:t,ids:a}=n,s=e.chats.byId[t];return s?.photos?(0,c.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,c.pf)(e,t,i||r._f,"draft",a),e=(0,c.pf)(e,t,i||r._f,"replyingToId",o),e=(0,c.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,r=e.chats.byId[s];if(!r)return;return e=(0,c.a4)(e,s,{fullInfo:{...r.fullInfo,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,c.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,c.a4)(e,t,{orderedPinnedTopicIds:s}),void(0,a.R3)(e)}case"updateTopic":{const{chatId:a,topicId:s}=n,o=(0,d.Z1)(e,a);if(!o?.isForum)return;return void t.loadTopicById({chatId:a,topicId:s})}case"updateTopics":{const{chatId:a}=n,s=(0,d.Z1)(e,a);if(!s?.isForum)return;return void t.loadTopics({chatId:a,force:!0})}}}));var $e=n(84112);const He=350;function Ge(e,t,n,a,s,o,i){const r=i?.reactions;if(r&&(0,$e.A)(a,r))return e;if(e=(0,c.cY)(e,t,n,{reactions:a}),!o)return e;const l=s.unreadReactions?.includes(n);if((0,u.yL)(e,a)&&!l){e=_e(e,t,{unreadReactionsCount:(s?.unreadReactionsCount||0)+1,unreadReactions:[...s?.unreadReactions||[],n]});const a=(0,d.hj)(e,t,n);if(!s||!a)return e;(0,A.R3)((()=>{(0,qe.rh)({chat:s,message:a,isReaction:!0})}))}else l&&(e=_e(e,t,{unreadReactionsCount:(s?.unreadReactionsCount||1)-1,unreadReactions:s?.unreadReactions?.filter((e=>e!==n))}));return e}function Ve(e,t,n,a){let s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const o=s?(0,d.Tm)(e,t,n):(0,d.hj)(e,t,n);if(o&&a.content){const{photo:e,video:t,sticker:n,document:s}=(0,u.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,c.P4)(e,t,n,i):(0,c.cY)(e,t,n,i)}function ze(e,t,n,a){const{chatId:s}=n,{threadInfo:o}=(0,d.Db)(e,n)||{};if(!o&&n.replyToMessageId){const o=(0,d.hj)(e,s,n.replyToMessageId);o?e=(0,c.lG)(e,o,s,n.id,a):t.loadMessage({chatId:s,messageId:n.replyToMessageId,threadUpdate:{isDeleting:a,lastMessageId:n.id}})}return e}function We(e,t,n){const{id:a,chatId:s}=n,{threadInfo:o,firstMessageId:i}=(0,d.Db)(e,n)||{},l=(0,d.Z1)(e,s),m=l?.unreadCount&&!(0,d.gb)(e,s,r._f);return e=ze(e,t,n),o&&(!i&&(0,u.CI)(n)||(e=(0,c.xj)(e,s,o.threadId,[a]),Object.values(e.byTabId).forEach((t=>{let{id:r}=t;(0,d.b9)(e,s,o.threadId,r)&&(e=(0,c.$S)(e,s,o.threadId,a,r),i||(e=(0,c.pf)(e,s,o.threadId,"firstMessageId",n.id)))}))),e=(0,c.pf)(e,s,o.threadId,"threadInfo",{...o,lastMessageId:n.id}),(0,u.CI)(n)||(e=(0,c.Xg)(e,s,o.threadId,{messagesCount:(o.messagesCount||0)+1}))),m||(e=(0,c.xj)(e,s,r._f,[a]),Object.values(e.byTabId).forEach((t=>{let{id:n}=t;if((0,d.b9)(e,s,r._f,n)){const t=(0,d.It)(e,s,r._f),o=(0,c.$S)(e,s,r._f,a,n),i=(0,d.Cb)(o,s,r._f,n);t&&!i.includes(t)||(e=o)}}))),e}function Xe(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,d.p$)(e,n):void 0;return r&&(e=(0,c.Cn)(e,t,r.id,{lastMessageId:n.id})),!i||a||i.id===n.id||i.id===n.previousLocalId||n.id>i.id?(0,c.a4)(e,t,{lastMessage:n}):e}function Ye(e,t){const n=(0,d.Zw)(e,t),a=(0,d.gb)(e,t,r._f);if(!n||!a)return;let s=a.length;for(;s--;){const e=n[a[s]];if(!e.isDeleting)return e}}function Ke(e,t,n,s){if(t){const o=(0,d.Z1)(e,t);if(!o)return;n.forEach((n=>{e=(0,c.cY)(e,t,n,{isDeleting:!0});const a=Ye(e=(0,c.CE)(e,t,n),t);a&&(e=Xe(e,t,a,!0)),o.topics?.[n]&&(e=(0,c.BK)(e,t,n))})),s.requestChatUpdate({chatId:t});const i=[];return n.forEach((n=>{const a=(0,d.hj)(e,t,n);if(!a)return;e=ze(e,s,a,!0);const o=(0,d.nr)(e,a);o&&i.push(o)})),(0,a.R3)(e),void setTimeout((()=>{e=(0,a.Rd)(),e=(0,c.K4)(e,t,n),(0,a.R3)(e),(0,I.Tw)(i).forEach((e=>{s.requestThreadInfoUpdate({chatId:t,threadId:e})}))}),He)}const o=[];n.forEach((t=>{const n=(0,d.X5)(e,t);if(n){o.push(n);const s=Ye(e=(0,c.cY)(e,n,t,{isDeleting:!0}),n);s&&(e=Xe(e,n,s,!0)),setTimeout((()=>{e=(0,a.Rd)(),e=(0,c.K4)(e,n,[t]),(0,a.R3)(e)}),He)}})),(0,a.R3)(e),(0,I.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:l}=n;e=We(e=Ve(e,s,o,i),t,i),i.repliesThreadInfo&&(e=(0,c.Xg)(e,i.repliesThreadInfo.chatId,i.repliesThreadInfo.threadId,i.repliesThreadInfo));const m=(0,d.hj)(e,s,o),h=(0,d.Z1)(e,s);h?.isForum&&m.isTopicReply&&!(0,d.p$)(e,m)&&m.replyToMessageId&&t.loadTopicById({chatId:s,topicId:m.replyToMessageId}),Object.values(e.byTabId).forEach((n=>{let{id:h}=n;const g=(0,u.CI)(i);if((0,d.KA)(e,s,i,h)){if(g&&i.isOutgoing&&!i.content?.action){const n=(0,d.Bt)(e,h);n&&t.focusMessage({chatId:s,threadId:n.threadId,messageId:i.id,noHighlight:!0,isResizingContainer:!0,tabId:h})}const{threadInfo:n}=(0,d.Db)(e,i)||{};n&&!g&&t.requestThreadInfoUpdate({chatId:s,threadId:n.threadId}),g||setTimeout((()=>{e=(0,a.Rd)(),l&&(e=(0,c.pf)(e,s,r._f,"replyingToId",o)),e=Xe(e,s,m),(0,a.R3)(e)}),He)}else e=Xe(e,s,m)})),(0,a.R3)(e),(0,d.N)(e,s)||t.loadTopChats();break}case"updateStartEmojiInteraction":Object.values(e.byTabId).forEach((t=>{let{id:a}=t;const{chatId:s}=(0,d.Bt)(e,a)||{};if(s!==n.id)return;const o=(0,d.hj)(e,s,n.messageId);if(!o)return;if((0,u.UD)(o)!==n.emoji)return;const i=(0,d.jU)(e,a);e=(0,g.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=Ve(e,t,s,o,!0);const i=(0,d.qy)(e,t,r._f)||[];e=(0,c.pf)(e,t,r._f,"scheduledIds",(0,I.Tw)([...i,s]));const l=(0,d.nr)(e,o);if(l!==r._f){const n=(0,d.qy)(e,t,l)||[];e=(0,c.pf)(e,t,l,"scheduledIds",(0,I.Tw)([...n,s]))}(0,a.R3)(e);break}case"updateMessage":{const{chatId:t,id:s,message:o}=n,i=(0,d.hj)(e,t,s),r=(0,d.Z1)(e,t);e=Ve(e,t,s,o);const l=(0,d.hj)(e,t,s);o.repliesThreadInfo&&(e=(0,c.Xg)(e,o.repliesThreadInfo.chatId,o.repliesThreadInfo.threadId,o.repliesThreadInfo)),i&&(e=Xe(e,t,l)),o.reactions&&r&&(e=Ge(e,t,s,o.reactions,r,l.isOutgoing,i)),o.content?.text?.text!==i?.content?.text?.text&&(e=(0,c.CE)(e,t,s)),(0,a.R3)(e);break}case"updateScheduledMessage":{const{chatId:t,id:s,message:o}=n,i=(0,d.Tm)(e,t,s);if(!i)return;e=Ve(e,t,s,o,!0);const l=Object.keys((0,d.yB)(e,t)||{}).map(Number).sort(((e,t)=>t-e));e=(0,c.pf)(e,t,r._f,"scheduledIds",l);const u=(0,d.nr)(e,i);if(u!==r._f){const n=(0,d.qy)(e,t,u)||[];e=(0,c.pf)(e,t,u,"scheduledIds",n.sort(((e,t)=>t-e)))}(0,a.R3)(e);break}case"updateMessageSendSucceeded":{const{chatId:s,localId:o,message:i}=n;e=We(e,t,i);const l=(0,d.hj)(e,s,o);e=(0,c.K4)(e,s,[o]),i.isScheduled&&(e=(0,c.bV)(e,s,[o])),e=(0,c.cY)(e,s,i.id,{...l,...i,previousLocalId:o});const u=(0,d.hj)(e,s,i.id);e=Xe(e,s,u);const m=(0,d.Db)(e,i);Object.values(e.byTabId).forEach((n=>{let{id:a}=n;const{chatId:o,threadId:c}=(0,d.Bt)(e,a)||{};o===s&&(m?.threadInfo?.threadId||r._f)===c&&t.markMessageListRead({maxId:i.id,tabId:a})})),m?.threadInfo&&(e=(0,c.pf)(e,s,m.threadInfo.threadId,"threadInfo",{...m.threadInfo,lastMessageId:i.id,lastReadInboxMessageId:i.id})),(0,a.R3)(e);break}case"updateScheduledMessageSendSucceeded":{const{chatId:t,localId:s,message:o}=n,i=(0,d.qy)(e,t,r._f)||[];e=(0,c.pf)(e,t,r._f,"scheduledIds",[...i,o.id]);const l=(0,d.nr)(e,o);if(l!==r._f){const n=(0,d.qy)(e,t,l)||[];e=(0,c.pf)(e,t,l,"scheduledIds",[...n,o.id])}const u=(0,d.Tm)(e,t,s);e=(0,c.bV)(e,t,[s]),e=(0,c.P4)(e,t,o.id,{...u,...o,previousLocalId:s}),(0,a.R3)(e);break}case"updatePinnedIds":{const{chatId:t,isPinned:s,messageIds:o}=n,i=(0,I.q0)((0,d.Zw)(e,t),o),l={[r._f]:o};Object.values(i).forEach((n=>{const a=(0,d.nr)(e,n);if(e=(0,c.cY)(e,t,n.id,{isPinned:s}),a===r._f)return;const o=l[a]||[];o.push(n.id),l[a]=o})),Object.entries(l).forEach((n=>{let[a,o]=n;const i=(0,d.KB)(e,t,r._f)||[],l=s?(0,I.Tw)(i.concat(o)).sort(((e,t)=>t-e)):i.filter((e=>!o.includes(e)));e=(0,c.pf)(e,t,Number(a),"pinnedIds",l)})),(0,a.R3)(e);break}case"updateThreadInfo":{const{chatId:s,threadId:o,threadInfo:i,firstMessageId:r}=n,l=(0,d.tZ)(e,s,o),u={...l,...i};if(!u.threadId)return;e=(0,c.Xg)(e,s,o,u),r&&(e=(0,c.pf)(e,s,o,"firstMessageId",r));const m=(0,d.Z1)(e,s);if(m?.isForum&&i.lastReadInboxMessageId!==l?.lastReadInboxMessageId&&t.loadTopicById({chatId:s,topicId:o}),i.topMessageId===o&&!m?.isForum){const t=m?.lastReadInboxMessageId,n=u.lastReadInboxMessageId||t;t&&n&&(e=(0,c.Xg)(e,s,o,{lastReadInboxMessageId:Math.max(n,t)}))}(0,a.R3)(e);break}case"resetMessages":{const{id:s}=n,o=(0,d.Zw)(e,s);o&&!(0,u.YC)(s)&&(e=(0,c.K4)(e,s,Object.keys(o).map(Number)),(0,a.R3)(e),t.loadFullChat({chatId:s,force:!0,tabId:(0,m._w)()}));break}case"deleteMessages":{const{ids:a,chatId:s}=n;Ke(e,s,a,t);break}case"deleteScheduledMessages":{const{ids:t,chatId:s}=n;!function(e,t,n,s){e&&(t.forEach((t=>{s=(0,c.P4)(s,e,t,{isDeleting:!0})})),(0,a.R3)(s),setTimeout((()=>{s=(0,a.Rd)(),s=(0,c.bV)(s,e,t);const n=(0,d.yB)(s,e);s=(0,c.pf)(s,e,r._f,"scheduledIds",Object.keys(n||{}).map(Number)),(0,a.R3)(s)}),He))}(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);Ke(e=(0,a.Rd)(),s,n,t)}else t.requestChatUpdate({chatId:s});break}case"updateCommonBoxMessages":{const{ids:t,messageUpdate:s}=n;t.forEach((t=>{const n=(0,d.X5)(e,t);n&&(e=(0,c.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,c.cY)(e,t,n,o)})),(0,a.R3)(e);break}case"updateMessagePoll":{const{pollId:t,pollUpdate:s}=n,o=(0,d.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,c.cY)(e,o.chatId,o.id,{content:{...o.content,poll:i}}),(0,a.R3)(e)}break}case"updateMessagePollVote":{const{pollId:t,userId:s,options:o}=n,i=(0,d.ZB)(e,t);if(!i||!i.content.poll||!i.content.poll.results)break;const{poll:r}=i.content,{recentVoterIds:l,totalVoters:u,results:m}=r.results,h=l?[...l]:[],g=u?u+1:1,p=m?[...m]:[];h.push(s),o.forEach((t=>{const n=p.findIndex((e=>e.option===t)),a=p[n],o=a?{...a}:{option:t,votersCount:0};o.votersCount+=1,s===e.currentUserId&&(o.isChosen=!0),n?p[n]=o:p.push(o)})),e=(0,c.cY)(e,i.chatId,i.id,{content:{...i.content,poll:{...r,results:{...r.results,recentVoterIds:h,totalVoters:g,results:p}}}}),(0,a.R3)(e);break}case"updateServiceNotification":{const{message:a}=n;(0,d.UW)(e)&&t.createServiceNotification({message:a});break}case"updateMessageReactions":{const{chatId:t,id:s,reactions:o}=n,i=(0,d.hj)(e,t,s),r=(0,d.Z1)(e,n.chatId);if(!r||!i)return;e=Ge(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,d.hj)(e,t,s);if(!(0,d.Z1)(e,n.chatId)||!r)return;if(i){if(!r.content.invoice)return;e=(0,c.cY)(e,t,s,{content:{...r.content,invoice:{...r.content.invoice,extendedMedia:i}}}),(0,a.R3)(e)}else o&&(e=(0,c.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,c.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,c.TD)(e,t,s,o,i),(0,a.R3)(e);break}}}));const Je=(0,A.P2)((function(){let e=(0,a.Rd)();e=(0,c.ps)(e,{...e.users.statusesById,...Qe}),(0,a.R3)(e),Qe={}}),3e3,!0);let Qe={};(0,a.iw)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"deleteContact":return(0,c.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,d.wV)(e)&&(n.user.isPremium&&t.openPremiumModal({isSuccess:!0,tabId:s}),e={...e,translations:{byChatId:{}}})})),(0,c.Nq)(e,n.id,n.user);case"updateRequestUserUpdate":t.loadFullUser({userId:n.id});break;case"updateUserEmojiStatus":return(0,c.Nq)(e,n.userId,{emojiStatus:n.emojiStatus});case"updateUserStatus":return a=n.userId,s=n.status,Qe[a]=s,void Je();case"updateUserFullInfo":{const{id:t,fullInfo:a}=n,s=e.users.byId[t];if(!s)return;return(0,c.Nq)(e,t,{fullInfo:{...s.fullInfo,...a}})}case"updateBotMenuButton":{const{botId:t,button:a}=n,s=(0,d.dy)(e,t);if(!s?.fullInfo?.botInfo)return;return(0,c.Nq)(e,t,{fullInfo:{...s.fullInfo,botInfo:{...s.fullInfo.botInfo,menuButton:a}}})}}var a,s})),(0,a.iw)("apiUpdate",((e,t,n)=>{if("updateStickerSet"===n["@type"])return(0,c.Rg)(e,n.id,n.stickerSet)})),(0,a.iw)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"updatePeerBlocked":return n.isBlocked?(0,c.O4)(e,n.id):(0,c.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"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":t.reorderStickerSets({order:n.order,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,c.fS)(e,n.url,a),e=(0,c.Q$)(e,f.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,c.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,c.a4)(e,t,{isMuted:s})),e=(0,c.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,c.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 et=n(78958),tt=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,m._w)()})):(0,et.dc)(e,n.call.id);const a=(0,tt.$5)(e,n.call.id),s=a?.chatId;return s&&(e=(0,c.a4)(e,s,{isCallNotEmpty:a.participantsCount>0||Boolean(a.participants?.length)})),(0,et.AH)(e,n.call.id,(0,I.CE)(n.call,["connectionState"]),void 0,n.call.participantsCount)}case"updateGroupCallChatId":{const t=(0,d.Z1)(e,n.chatId);return t&&(e=(0,c.a4)(e,n.chatId,{fullInfo:{...t.fullInfo,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,et.B6)(e,t,n.id,n,Boolean(o)||i===n.id))})),o&&(e=(0,et.AH)(e,t,{nextOffset:o}));const r=(0,tt.$5)(e,t),d=r?.chatId;return d&&(e=(0,c.a4)(e,d,{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,m._w)()}),{...e,...r.needRating&&{ratingPhoneCall:r}}):void 0;if(r?.adminId!==i&&"requested"===r.state)return(0,A.R3)((()=>{e=(0,a.Rd)(),(0,qe.TO)({call:r,user:(0,tt.fu)(e)})})),(0,_.EP)(),(0,_.CW)(e,t,r.isVideo,(0,m._w)()),e={...e,phoneCall:r},(0,g.i)(e,{isCallPanelVisible:!1},(0,m._w)())}}}));var nt=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,d.jU)(e,o).payment;if(i&&"chatId"in i&&"messageId"in i){const n=(0,d.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:b.Iu("PaymentInfoHint",[(0,nt.x)(e,a,b.QO().code),s])})}}s.Xp||(e=(0,c.WY)(e,o)),n.slug&&i&&"slug"in i&&i.slug!==n.slug||(e=(0,g.i)(e,{payment:{...(0,d.jU)(e,o).payment,status:"paid"}},o))}))}));var at=n(46752),st=n(1279),ot=n(53551),it=n(99203),rt=n(274),ct=n(45332);function dt(e){(0,i.d4)((()=>(0,A.Gq)(e)),[e])}var lt=n(34446);const ut=document.querySelector('meta[name="viewport"]'),mt=ut?.getAttribute("content")||"";function ht(e){e.preventDefault()}var gt=n(65326),pt=n(31212),ft=n(18674),It=n(62357),vt=n(28183),wt=n(48778);const bt=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,wt.Z)(it.gl.Extra,"StickerSetModal",!t);return n?i.ZP.createElement(n,e):void 0}));var Pt=n(2155),yt=n(95616),Zt=n(17358);const Ct=(0,i.X$)((e=>{let{isForAppBadge:t}=e;(0,yt.yi)();const n=(0,T.xW)();if((0,i.d4)((()=>{t&&(0,Zt.w)(n)}),[t,n]),!t&&n)return i.ZP.createElement("div",{className:"unread-count active"},(0,Pt.bi)(n))}));var St=n(23989),Et=n(53455),Mt=n(60706),Rt=n(73541),kt=n(2255),Tt=n(59107),Nt=n(54416),At=n(27370);var xt=n(706);let Bt=function(e){return e[e.waitingForNetwork=0]="waitingForNetwork",e[e.syncing=1]="syncing",e[e.online=2]="online",e}({});function Lt(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?Bt.syncing:Bt.online:Bt.waitingForNetwork,c=r===Bt.online||o?"none":a?"middleHeader":s?"minimized":"overlay",r===Bt.waitingForNetwork?d=e("WaitingForNetwork"):r===Bt.syncing&&(d=e("Updating")),"middleHeader"===c&&(d=d.toLowerCase().replace(/\.+$/,"")),{connectionStatus:r,connectionStatusPosition:c,connectionStatusText:d}}var Ut=n(36046),jt=n(73217),Ot=n(53106),Ft=n(58964),_t=n(231),Dt=n(69589),qt=n(49187),$t=n(83321),Ht=n(40126),Gt=n(49204);const Vt=(0,i.X$)((e=>{let{connectionStatus:t,connectionStatusText:n,onClick:a}=e;const s=(0,Tt.Z)();return i.ZP.createElement("div",{id:"ConnectionStatusOverlay",dir:s.isRtl?"rtl":void 0,onClick:a},i.ZP.createElement(Gt.Z,{color:"black"}),i.ZP.createElement("div",{className:"state-text"},i.ZP.createElement(kt.Z,{activeKey:t,name:"slide-fade"},n)),i.ZP.createElement(_t.Z,{round:!0,size:"tiny",color:"translucent-black"},i.ZP.createElement("span",{className:"icon-close"})))}));var zt=n(96459),Wt=n(4863),Xt=n(6202);const Yt="HO3tML0GAC9vTH28baKB",Kt=(0,i.X$)((e=>{let{reaction:t,isLottie:n,className:a}=e;const o=(0,u.RK)(t.documentId),r=(0,Xt.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,at.Z)("HAg4STRlxDV3frYuABYr",a)},c.map((e=>{const a=`--offset-path: path('${e}');`;return n?i.ZP.createElement(zt.Z,{documentId:t.documentId,className:Yt,style:a,withSharedAnimation:!0}):i.ZP.createElement("img",{src:r,alt:"",className:Yt,style:a})})))})),Jt=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,wt.Z)(it.gl.Extra,"StatusPickerMenu",!t);return n?i.ZP.createElement(n,e):void 0})),Qt=(0,i.X$)((0,a.c$)((e=>{const{currentUserId:t}=e,n=t?(0,d.dy)(e,t):void 0;return{emojiStatus:n?.emojiStatus}}))((e=>{let{emojiStatus:t}=e;const{setEmojiStatus:n,loadCurrentUser:s}=(0,a.Sv)(),r=(0,i.sO)(null),[c,d,l]=(0,Mt.Z)(!1),[u,m,h]=(0,Mt.Z)(!1),[g,p,f]=(0,Mt.Z)(!1),{isMobile:I}=(0,C.ZP)(),w=t?.until?1e3*t.until-Date.now()+1e3*(0,v.Qj)():void 0;(0,vt.Z)(s,w),(0,rt.Z)((e=>{let[n]=e;c&&t&&n&&t.documentId!==n.documentId&&(m(),l())}),[t,c,m,l]);const b=(0,i.I4)((e=>{d(),n({emojiStatus:e})}),[d,n]);(0,vt.Z)(h,u?1500:void 0);const P=(0,i.I4)((()=>{p()}),[p]);return i.ZP.createElement("div",{className:"extra-spacing"},Boolean(u&&t)&&i.ZP.createElement(Kt,{reaction:t,isLottie:!0,className:"emoji-status-effect"}),i.ZP.createElement(_t.Z,{round:!0,ref:r,ripple:!I,size:"smaller",color:"translucent",className:"emoji-status",onClick:P},t?i.ZP.createElement(zt.Z,{key:t.documentId,documentId:t.documentId,size:24,loopLimit:o.y3O}):i.ZP.createElement(Wt.Z,null)),i.ZP.createElement(Jt,{statusButtonRef:r,isOpen:g,onEmojiStatusSelect:b,onClose:f}))}))),en=[0,1,2],tn=(0,i.X$)((0,a.c$)((e=>{const t=(0,d.jU)(e),{query:n,fetchingStatus:a,chatId:s,date:o}=t.globalSearch,{currentUserId:i,connectionState:r,isSyncing:c,archiveSettings:l}=e,{byId:u}=e.chats,{isConnectionStatusMinimized:m,animationLevel:h}=e.settings.byKey;return{searchQuery:n,isLoading:!!a&&Boolean(a.chats||a.messages),currentUserId:i,chatsById:u,globalSearchChatId:s,searchDate:o,theme:(0,d.Pu)(e),animationLevel:h,connectionState:r,isSyncing:c,isMessageListOpen:Boolean((0,d.Bt)(e)),isConnectionStatusMinimized:m,isCurrentUserPremium:(0,d.wV)(e),areChatsLoaded:Boolean(e.chats.listIds.active),hasPasscode:Boolean(e.passcode.hasPasscode),canInstall:Boolean(t.canInstall),archiveSettings:l,isAuthRememberMe:e.authRememberMe}}))((e=>{let{shouldHideSearch:t,content:n,contactsFilter:r,onSearchQuery:c,isClosingSearch:d,onSelectSettings:l,onSelectContacts:m,onSelectArchived:h,onReset:g,searchQuery:p,isLoading:I,isCurrentUserPremium:v,shouldSkipTransition:w,currentUserId:b,globalSearchChatId:P,searchDate:y,theme:Z,animationLevel:S,chatsById:E,connectionState:M,isSyncing:R,isMessageListOpen:k,isConnectionStatusMinimized:T,areChatsLoaded:N,hasPasscode:A,isAuthRememberMe:x,canInstall:B,archiveSettings:L}=e;const{openChat:U,setGlobalSearchDate:j,setSettingOption:O,setGlobalSearchChatId:F,openChatByUsername:_,lockScreen:D,requestNextSettingsScreen:q,skipLockOnUnload:$,openUrl:H}=(0,a.Sv)(),G=(0,Tt.Z)(),{isMobile:V}=(0,C.ZP)(),z=n===f.du.ChatList,W=(0,i.Ye)((()=>y?(0,re.xH)(new Date(1e3*y)):void 0),[y]),X=(0,i.Ye)((()=>z&&E?Object.values(E).reduce(((e,t)=>(0,u.pE)(t)&&t.unreadCount?e+1:e),0):0),[z,E]),{connectionStatus:Y,connectionStatusText:K,connectionStatusPosition:J}=Lt(G,M,R,k,T,!N),Q=(0,i.I4)((e=>{e.preventDefault(),e.stopPropagation(),A?D():q({screen:f.MT.PasscodeDisabled})}),[A]);(0,Rt.y)(x?{"Ctrl+Shift+L":Q,"Alt+Shift+L":Q,"Meta+Shift+L":Q,...s.fl&&{"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(_t.Z,{round:!0,ripple:z&&!V,size:"smaller",color:"translucent",className:n?"active":"",onClick:z?t:()=>g(),ariaLabel:z?G("AccDescrOpenMenu2"):"Return to chat list"},i.ZP.createElement("div",{className:(0,at.Z)("animated-menu-icon",!z&&"state-back",w&&"no-animation")}))}),[z,V,G,g,w]),ne=(0,i.I4)((()=>{p||c("")}),[p,c]),ae=(0,i.I4)((()=>{O({isConnectionStatusMinimized:!T})}),[T,O]),se=(0,i.I4)((()=>{U({id:b,shouldReplaceHistory:!0})}),[b,U]),oe=(0,i.I4)((e=>{e.stopPropagation();const t="light"===Z?"dark":"light";O({theme:t}),O({shouldUseSystemTheme:!1}),(0,At.Z)(t,S===o.zy8)}),[S,O,Z]),ie=(0,i.I4)((e=>{e.stopPropagation();const t=0===S?2:0;en.forEach(((e,n)=>{document.body.classList.toggle(`animation-level-${n}`,t===n)})),O({animationLevel:t})}),[S,O]),ce=(0,i.I4)((()=>{window.open(o.ulW,"_blank","noopener")}),[]),de=(0,i.I4)((()=>{localStorage.setItem("kz_version",JSON.stringify("K")),(0,xt.W8)(),$()}),[$]),le=(0,i.I4)((()=>{_({username:G("Settings.TipsUsername")})}),[G,_]),ue=(0,i.I4)((()=>{H({url:o.mUA})}),[H]),me=(0,i.I4)((()=>{D()}),[D]),he=Boolean(P)||n===f.du.GlobalSearch||n===f.du.Contacts;(0,i.d4)((()=>he?(0,St.Z)((()=>g())):void 0),[he,g]);const ge=n===f.du.Contacts?G("SearchFriends"):G("Search"),pe=o.Tjg?`${o.JiC} Beta (master)`:o.eMD?"master":o.JiC,{shouldDisableDropdownMenuTransitionRef:fe,handleDropdownMenuTransitionEnd:Ie}=(0,jt.Z)(t),ve=(0,i.Ye)((()=>i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement(Ft.Z,{icon:"saved-messages",onClick:se},G("SavedMessages")),L.isHidden&&i.ZP.createElement(Ft.Z,{icon:"archive",onClick:h},i.ZP.createElement("span",{className:"menu-item-name"},G("ArchivedChats")),X>0&&i.ZP.createElement("div",{className:"right-badge"},X)),i.ZP.createElement(Ft.Z,{icon:"user",onClick:m},G("Contacts")),i.ZP.createElement(Ft.Z,{icon:"settings",onClick:l},G("Settings")),i.ZP.createElement(Ft.Z,{icon:"darkmode",onClick:oe},i.ZP.createElement("span",{className:"menu-item-name"},G("lng_menu_night_mode")),i.ZP.createElement($t.Z,{id:"darkmode",label:G("dark"===Z?"lng_settings_disable_night_theme":"lng_settings_enable_night_theme"),checked:"dark"===Z,noAnimation:!0})),i.ZP.createElement(Ft.Z,{icon:"animations",onClick:ie},i.ZP.createElement("span",{className:"menu-item-name capitalize"},G("Appearance.Animations").toLowerCase()),i.ZP.createElement($t.Z,{id:"animations",label:"Toggle Animations",checked:S>0})),i.ZP.createElement(Ft.Z,{icon:"help",onClick:le},G("TelegramFeatures")),i.ZP.createElement(Ft.Z,{icon:"bug",onClick:ue},"Report Bug"),o.Tjg&&i.ZP.createElement(Ft.Z,{icon:"permissions",onClick:ce},"Beta Changelog"),ee&&i.ZP.createElement(Ft.Z,{icon:"char-K",href:"https://web.telegram.org/k/",onClick:de},"Switch to K Version"),B&&i.ZP.createElement(Ft.Z,{icon:"install",onClick:(0,Ut.G)()},"Install App"))),[S,X,B,ie,ue,G,ce,oe,le,se,de,h,m,l,Z,ee,L]);return i.ZP.createElement("div",{className:"LeftMainHeader"},i.ZP.createElement("div",{id:"LeftMainHeader",className:"left-header"},G.isRtl&&i.ZP.createElement("div",{className:"DropdownMenuFiller"}),i.ZP.createElement(Ot.Z,{trigger:te,footer:`${o.iCi} ${pe}`,className:(0,at.Z)(G.isRtl&&"rtl",t&&G.isRtl&&"right-aligned",fe.current&&G.isRtl&&"disable-transition"),positionX:t&&G.isRtl?"right":"left",onTransitionEnd:G.isRtl?Ie:void 0},ve),i.ZP.createElement(Dt.Z,{inputId:"telegram-search-input",parentContainerClassName:"LeftSearch",className:(0,at.Z)(P||y?"with-picker-item":void 0,t&&"SearchInput--hidden"),value:d?void 0:r||p,focused:he,isLoading:I||"minimized"===J,spinnerColor:"minimized"===J?"yellow":void 0,spinnerBackgroundColor:"minimized"===J&&"light"===Z?"light":void 0,placeholder:ge,autoComplete:"off",canClose:Boolean(P||y),onChange:c,onReset:g,onFocus:ne,onSpinnerClick:"minimized"===J?ae:void 0},W&&i.ZP.createElement(qt.Z,{icon:"calendar",title:W,canClose:!0,isMinimized:Boolean(P),className:"search-date",onClick:j,clickArg:{date:void 0}}),P&&i.ZP.createElement(qt.Z,{chatOrUserId:P,onClick:F,canClose:!0,clickArg:{id:void 0}})),v&&i.ZP.createElement(Qt,null),A&&i.ZP.createElement(_t.Z,{round:!0,ripple:!V,size:"smaller",color:"translucent",ariaLabel:`${G("ShortcutsController.Others.LockByPasscode")} (Ctrl+Shift+L)`,onClick:me,className:(0,at.Z)(!v&&"extra-spacing")},i.ZP.createElement("i",{className:"icon-lock"})),i.ZP.createElement(Ht.Z,{isOpen:"overlay"===J,isCustom:!0,className:"connection-state-wrapper"},i.ZP.createElement(Vt,{connectionStatus:Y,connectionStatusText:K,onClick:ae}))))})));var nn=n(64963),an=n(46590),sn=n(93133),on=n(46915);const rn=(0,i.X$)((0,a.c$)((e=>{const{chatFolders:{byId:t,orderedIds:n},chats:{listIds:{archived:a}},currentUserId:s,lastSyncTime:o,archiveSettings:i}=e,{shouldSkipHistoryAnimations:r,activeChatFolder:c}=(0,d.jU)(e);return{chatFoldersById:t,orderedFolderIds:n,activeChatFolder:c,currentUserId:s,lastSyncTime:o,shouldSkipHistoryAnimations:r,hasArchivedChats:Boolean(a?.length),maxFolders:(0,ne.M)(e,"dialogFilters"),archiveSettings:i}}))((e=>{let{foldersDispatch:t,onSettingsScreenSelect:n,onLeftColumnContentChange:r,chatFoldersById:c,orderedFolderIds:d,activeChatFolder:l,currentUserId:u,isForumPanelOpen:m,lastSyncTime:h,shouldSkipHistoryAnimations:g,maxFolders:p,shouldHideFolderTabs:f,hasArchivedChats:I,archiveSettings:v}=e;const{loadChatFolders:w,setActiveChatFolder:b,openChat:P}=(0,a.Sv)(),y=(0,i.sO)(null),Z=(0,Tt.Z)();(0,i.d4)((()=>{h&&w()}),[h,w]);const C=(0,i.Ye)((()=>({id:o.NfV,title:d?.[0]===o.NfV?Z("FilterAllChatsShort"):Z("FilterAllChats")})),[d,Z]),S=(0,i.Ye)((()=>d?d.map((e=>e===o.NfV?C:c[e]||{})).filter(Boolean):void 0),[c,C,d]),E=S?.findIndex((e=>e.id===o.NfV)),M=E===l,R=0===l,k=(0,yt.yi)(),T=(0,i.Ye)((()=>{if(S&&S.length)return S.map(((e,t)=>{let{id:n,title:a}=e;const s=n!==o.NfV&&t>p-1;return{id:n,title:a,badgeCount:k[n]?.chatsCount,isBadgeActive:Boolean(k[n]?.notificationsCount),isBlocked:s}}))}),[S,k,p]),N=(0,i.I4)((e=>{b({activeChatFolder:e},{forceOnHeavyAnimation:!0})}),[b]);(0,i.d4)((()=>{T?.length&&l>=T.length&&b({activeChatFolder:0})}),[l,T,b]),(0,i.d4)((()=>{if(s.$b&&T?.length&&!m)return(0,nn.sf)(y.current,{selectorToPreventScroll:".chat-list",onSwipe:(e,t)=>t===nn.eM.Left?(b({activeChatFolder:Math.min(l+1,T.length-1)},{forceOnHeavyAnimation:!0}),!0):t===nn.eM.Right&&(b({activeChatFolder:Math.max(0,l-1)},{forceOnHeavyAnimation:!0}),!0)})}),[l,T,m,b]);const A=(0,i.sO)();A.current=!R,(0,i.d4)((()=>A.current?(0,St.Z)((()=>{A.current&&b({activeChatFolder:0})})):void 0),[l,b]),(0,an.Z)({isActive:!R,onBack:()=>b({activeChatFolder:0},{forceOnHeavyAnimation:!0})}),(0,i.d4)((()=>{const e=e=>{if(e.ctrlKey&&e.shiftKey&&e.code.startsWith("Digit")&&T){const[,t]=e.code.match(/Digit(\d)/)||[];if(!t)return;if("0"===t)return void P({id:u,shouldReplaceHistory:!0});const n=Number(t)-1;if(n>T.length-1)return;b({activeChatFolder:n},{forceOnHeavyAnimation:!0}),e.preventDefault()}};return document.addEventListener("keydown",e,!0),()=>{document.removeEventListener("keydown",e,!0)}}),[u,T,P,b]);const{shouldRender:x,transitionClassNames:B}=(0,pt.Z)(!d,void 0,!0);function L(e){const a=Object.values(c).find((e=>{let{id:t}=e;return t===T[l].id})),s=a&&!M;return i.ZP.createElement(on.Z,{folderType:s?"folder":"all",folderId:s?a.id:void 0,isActive:e,isForumPanelOpen:m,lastSyncTime:h,foldersDispatch:t,onSettingsScreenSelect:n,onLeftColumnContentChange:r,canDisplayArchive:I&&!v.isHidden,archiveSettings:v})}const U=T&&T.length>1;return i.ZP.createElement("div",{className:(0,at.Z)("ChatFolders",U&&f&&"ChatFolders--tabs-hidden")},U?i.ZP.createElement(sn.Z,{tabs:T,activeTab:l,onSwitchTab:N,areFolders:!0}):x?i.ZP.createElement("div",{className:(0,at.Z)("tabs-placeholder",B)}):void 0,i.ZP.createElement(kt.Z,{ref:y,name:g?"none":Z.isRtl?"slide-optimized-rtl":"slide-optimized",activeKey:l,renderCount:U?T.length:void 0},L))})));var cn=n(34288);const dn=(0,i.X$)((e=>{const t=(0,wt.Z)(it.gl.Extra,"LeftSearch");return t?i.ZP.createElement(t,e):i.ZP.createElement(cn.Z,null)})),ln=(0,i.X$)((e=>{const t=(0,wt.Z)(it.gl.Extra,"ContactList");return t?i.ZP.createElement(t,e):i.ZP.createElement(cn.Z,null)}));var un=n(52328);const mn=(0,i.X$)((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,Tt.Z)(),d=(0,at.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(Ft.Z,{icon:"channel",onClick:a},c("NewChannel")),i.ZP.createElement(Ft.Z,{icon:"group",onClick:s},c("NewGroup")),i.ZP.createElement(Ft.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(_t.Z,{round:!0,color:"primary",className:o?"active":"",onClick:l,ariaLabel:c(o?"Close":"NewMessageTitle"),tabIndex:-1},i.ZP.createElement("i",{className:"icon-new-chat-filled"}),i.ZP.createElement("i",{className:"icon-close"})),i.ZP.createElement(un.Z,{isOpen:o,positionX:c.isRtl?"left":"right",positionY:"bottom",autoClose:!0,onClose:u},m))}));var hn=n(59690);const gn=Object.keys(f.du).length/2;let pn;const fn=(0,i.X$)((e=>{let{content:t,searchQuery:n,searchDate:o,isClosingSearch:r,contactsFilter:c,shouldSkipTransition:d,foldersDispatch:l,isUpdateAvailable:u,isForumPanelOpen:m,onSearchQuery:h,onContentChange:g,onSettingsScreenSelect:p,onReset:I,onTopicSearch:v}=e;const{closeForumPanel:w}=(0,a.Sv)(),[b,P]=(0,i.eJ)(s.$b),{shouldRenderForumPanel:y,handleForumPanelAnimationEnd:Z,handleForumPanelAnimationStart:C,isAnimationStarted:S}=(0,Nt.Z)(m),E=m&&t===f.du.ChatList,M=E&&S,{shouldRender:R,transitionClassNames:k}=(0,pt.Z)(u),T=(0,i.sO)(!1),N=(0,i.I4)((()=>{t===f.du.ChatList&&(T.current=!0,P(!0))}),[t]),A=(0,i.I4)((()=>{T.current=!1,pn&&(clearTimeout(pn),pn=void 0),pn=window.setTimeout((()=>{T.current||P(!1)}),250)}),[]),x=(0,i.I4)((()=>{g(f.du.Settings)}),[g]),B=(0,i.I4)((()=>{g(f.du.Contacts)}),[g]),L=(0,i.I4)((()=>{g(f.du.Archived),w()}),[w,g]),U=(0,i.I4)((()=>{window.location.reload()}),[]),j=(0,i.I4)((()=>{g(f.du.NewChannelStep1)}),[g]),O=(0,i.I4)((()=>{g(f.du.NewGroupStep1)}),[g]);(0,i.d4)((()=>{let e;return t!==f.du.ChatList?e=window.setTimeout((()=>{P(!1)}),250):(T.current||s.$b)&&P(!0),()=>{e&&(clearTimeout(e),e=void 0)}}),[t]);const F=(0,Tt.Z)();return i.ZP.createElement("div",{id:"LeftColumn-main",onMouseEnter:s.$b?void 0:N,onMouseLeave:s.$b?void 0:A},i.ZP.createElement(tn,{shouldHideSearch:M,content:t,contactsFilter:c,onSearchQuery:h,onSelectSettings:x,onSelectContacts:B,onSelectArchived:L,onReset:I,shouldSkipTransition:d,isClosingSearch:r}),i.ZP.createElement(kt.Z,{name:d?"none":"zoom-fade",renderCount:gn,activeKey:t,shouldCleanup:!0,cleanupExceptionKey:f.du.ChatList},(e=>{switch(t){case f.du.ChatList:return i.ZP.createElement(rn,{shouldHideFolderTabs:M,onSettingsScreenSelect:p,onLeftColumnContentChange:g,foldersDispatch:l,isForumPanelOpen:M});case f.du.GlobalSearch:return i.ZP.createElement(dn,{searchQuery:n,searchDate:o,isActive:e,onReset:I});case f.du.Contacts:return i.ZP.createElement(ln,{filter:c,isActive:e,onReset:I});default:return}})),R&&i.ZP.createElement(_t.Z,{fluid:!0,pill:!0,className:(0,at.Z)("btn-update",k),onClick:U},F("lng_update_telegram")),y&&i.ZP.createElement(hn.Z,{isOpen:m,isHidden:!E,onTopicSearch:v,onOpenAnimationStart:C,onCloseAnimationEnd:Z}),i.ZP.createElement(mn,{isShown:b,onNewPrivateChat:B,onNewChannel:j,onNewGroup:O}))})),In=(0,i.X$)((e=>{const t=(0,wt.Z)(it.gl.Extra,"Settings");return t?i.ZP.createElement(t,e):i.ZP.createElement(cn.Z,null)})),vn=(0,i.X$)((e=>{const t=(0,wt.Z)(it.gl.Extra,"NewChat");return t?i.ZP.createElement(t,e):i.ZP.createElement(cn.Z,null)})),wn=(0,i.X$)((e=>{const t=(0,wt.Z)(it.gl.Extra,"ArchivedChats");return t?i.ZP.createElement(t,e):i.ZP.createElement(cn.Z,null)}));var bn=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}(bn||{});const Pn=Object.keys(bn).length/2,yn=(0,i.X$)((0,a.c$)((e=>{const t=(0,d.jU)(e),{globalSearch:{query:n,date:a},shouldSkipHistoryAnimations:s,activeChatFolder:o,nextSettingsScreen:i}=t,{leftColumnWidth:r,currentUserId:c,passcode:{hasPasscode:l},isUpdateAvailable:u,archiveSettings:m}=e,h=(0,d.jr)(e);return{searchQuery:n,searchDate:a,isFirstChatFolderActive:0===o,shouldSkipHistoryAnimations:s,leftColumnWidth:r,currentUserId:c,hasPasscode:l,nextSettingsScreen:i,isChatOpen:Boolean(h?.id),isUpdateAvailable:u,isForumPanelOpen:(0,d.nd)(e),forumPanelChatId:t.forumPanelChatId,isClosingSearch:t.globalSearch.isClosing,archiveSettings:m}}))((e=>{let{searchQuery:t,searchDate:n,isFirstChatFolderActive:o,shouldSkipHistoryAnimations:r,leftColumnWidth:c,currentUserId:d,hasPasscode:l,nextSettingsScreen:u,isChatOpen:m,isUpdateAvailable:h,isForumPanelOpen:g,forumPanelChatId:p,isClosingSearch:I,archiveSettings:v}=e;const{setGlobalSearchQuery:w,setGlobalSearchClosing:b,setGlobalSearchChatId:P,resetChatCreation:y,setGlobalSearchDate:Z,loadPasswordInfo:C,clearTwoFaError:S,setLeftColumnWidth:E,resetLeftColumnWidth:M,openChat:R,requestNextSettingsScreen:k}=(0,a.Sv)(),T=(0,i.sO)(null),[N,A]=(0,i.eJ)(f.du.ChatList),[x,B]=(0,i.eJ)(f.MT.Main),[L,U]=(0,i.eJ)(""),[j,O]=(0,Et.ZP)(),[F,_]=(0,i.eJ)(0);let D=bn.Main;switch(N){case f.du.Archived:D=bn.Archived;break;case f.du.Settings:D=bn.Settings;break;case f.du.NewChannelStep1:case f.du.NewChannelStep2:D=bn.NewChannel;break;case f.du.NewGroupStep1:case f.du.NewGroupStep2:D=bn.NewGroup}const q=(0,i.I4)((e=>{function t(){A(f.du.ChatList),U(""),b({isClosing:!0}),y(),setTimeout((()=>{w({query:""}),Z({date:void 0}),P({id:void 0}),b({isClosing:!1}),_(Date.now())}),250)}if(!0!==e)if(N!==f.du.NewGroupStep2)if(N!==f.du.NewChannelStep2){if(N===f.du.NewGroupStep1){const e=document.getElementById("new-group-picker-search");e&&e.blur()}if(N===f.du.Settings)switch(x){case f.MT.EditProfile:case f.MT.Folders:case f.MT.General:case f.MT.Notifications:case f.MT.DataStorage:case f.MT.Privacy:case f.MT.ActiveSessions:case f.MT.Language:case f.MT.Stickers:case f.MT.Experimental:return void B(f.MT.Main);case f.MT.GeneralChatBackground:return void B(f.MT.General);case f.MT.GeneralChatBackgroundColor:return void B(f.MT.GeneralChatBackground);case f.MT.PrivacyPhoneNumber:case f.MT.PrivacyLastSeen:case f.MT.PrivacyProfilePhoto:case f.MT.PrivacyPhoneCall:case f.MT.PrivacyPhoneP2P:case f.MT.PrivacyForwarding:case f.MT.PrivacyGroupChats:case f.MT.PrivacyVoiceMessages:case f.MT.PrivacyBlockedUsers:case f.MT.ActiveWebsites:case f.MT.TwoFaDisabled:case f.MT.TwoFaEnabled:case f.MT.TwoFaCongratulations:case f.MT.PasscodeDisabled:case f.MT.PasscodeEnabled:case f.MT.PasscodeCongratulations:return void B(f.MT.Privacy);case f.MT.PasscodeNewPasscode:return void B(l?f.MT.PasscodeEnabled:f.MT.PasscodeDisabled);case f.MT.PasscodeChangePasscodeCurrent:case f.MT.PasscodeTurnOff:return void B(f.MT.PasscodeEnabled);case f.MT.PasscodeNewPasscodeConfirm:return void B(f.MT.PasscodeNewPasscode);case f.MT.PasscodeChangePasscodeNew:return void B(f.MT.PasscodeChangePasscodeCurrent);case f.MT.PasscodeChangePasscodeConfirm:return void B(f.MT.PasscodeChangePasscodeNew);case f.MT.PrivacyPhoneNumberAllowedContacts:case f.MT.PrivacyPhoneNumberDeniedContacts:return void B(f.MT.PrivacyPhoneNumber);case f.MT.PrivacyLastSeenAllowedContacts:case f.MT.PrivacyLastSeenDeniedContacts:return void B(f.MT.PrivacyLastSeen);case f.MT.PrivacyProfilePhotoAllowedContacts:case f.MT.PrivacyProfilePhotoDeniedContacts:return void B(f.MT.PrivacyProfilePhoto);case f.MT.PrivacyPhoneCallAllowedContacts:case f.MT.PrivacyPhoneCallDeniedContacts:return void B(f.MT.PrivacyPhoneCall);case f.MT.PrivacyPhoneP2PAllowedContacts:case f.MT.PrivacyPhoneP2PDeniedContacts:return void B(f.MT.PrivacyPhoneP2P);case f.MT.PrivacyForwardingAllowedContacts:case f.MT.PrivacyForwardingDeniedContacts:return void B(f.MT.PrivacyForwarding);case f.MT.PrivacyVoiceMessagesAllowedContacts:case f.MT.PrivacyVoiceMessagesDeniedContacts:return void B(f.MT.PrivacyVoiceMessages);case f.MT.PrivacyGroupChatsAllowedContacts:case f.MT.PrivacyGroupChatsDeniedContacts:return void B(f.MT.PrivacyGroupChats);case f.MT.TwoFaNewPassword:return void B(f.MT.TwoFaDisabled);case f.MT.TwoFaNewPasswordConfirm:return void B(f.MT.TwoFaNewPassword);case f.MT.TwoFaNewPasswordHint:return void B(f.MT.TwoFaNewPasswordConfirm);case f.MT.TwoFaNewPasswordEmail:return void B(f.MT.TwoFaNewPasswordHint);case f.MT.TwoFaNewPasswordEmailCode:return void B(f.MT.TwoFaNewPasswordEmail);case f.MT.TwoFaChangePasswordCurrent:case f.MT.TwoFaTurnOff:case f.MT.TwoFaRecoveryEmailCurrentPassword:return void B(f.MT.TwoFaEnabled);case f.MT.TwoFaChangePasswordNew:return void B(f.MT.TwoFaChangePasswordCurrent);case f.MT.TwoFaChangePasswordConfirm:return void B(f.MT.TwoFaChangePasswordNew);case f.MT.TwoFaChangePasswordHint:return void B(f.MT.TwoFaChangePasswordConfirm);case f.MT.TwoFaRecoveryEmail:return void B(f.MT.TwoFaRecoveryEmailCurrentPassword);case f.MT.TwoFaRecoveryEmailCode:return void B(f.MT.TwoFaRecoveryEmail);case f.MT.FoldersCreateFolder:case f.MT.FoldersEditFolder:return void B(f.MT.Folders);case f.MT.FoldersIncludedChatsFromChatList:case f.MT.FoldersExcludedChatsFromChatList:return void B(f.MT.FoldersEditFolderFromChatList);case f.MT.FoldersEditFolderFromChatList:return A(f.du.ChatList),void B(f.MT.Main);case f.MT.QuickReaction:case f.MT.CustomEmoji:return void B(f.MT.Stickers);case f.MT.DoNotTranslate:return void B(f.MT.Language)}N===f.du.ChatList&&o?A(f.du.GlobalSearch):t()}else A(f.du.NewChannelStep1);else A(f.du.NewGroupStep1);else t()}),[N,o,b,y,w,Z,P,x,l]),$=(0,i.I4)((e=>{N!==f.du.Contacts?(A(f.du.GlobalSearch),e!==t&&w({query:e})):U(e)}),[N,t,w]),H=(0,i.I4)((()=>{A(f.du.GlobalSearch),w({query:""}),P({id:p})}),[p,P,w]);(0,i.d4)((()=>N!==f.du.ChatList||o&&!m&&!g?(0,St.Z)((()=>q())):void 0),[o,N,q,m,g]);const G=(0,i.I4)((e=>{N!==f.du.GlobalSearch&&(e.preventDefault(),A(f.du.GlobalSearch))}),[N]),V=(0,i.I4)((e=>{e.preventDefault(),R({id:d,shouldReplaceHistory:!0})}),[d,R]),z=(0,i.I4)((e=>{e.preventDefault(),A(f.du.Archived)}),[]),W=(0,i.I4)((e=>{e.preventDefault(),A(f.du.Settings)}),[]);(0,Rt.y)({"Mod+Shift+F":G,"Mod+Shift+S":V,...s.fl&&{"Mod+0":V,"Mod+9":z},...s.jm&&s.fl&&{"Mod+,":W}}),(0,i.d4)((()=>{S(),x===f.MT.Privacy&&C()}),[S,C,x]),(0,lt.Z)((()=>{void 0!==u&&(A(f.du.Settings),B(u),k({screen:void 0}))}),[u,k]);const{initResize:X,resetResize:Y,handleMouseUp:K}=function(e,t,n,a,s){const[o,r,c]=(0,Mt.Z)(),[d,l]=(0,i.eJ)(0),[u,m]=(0,i.eJ)(0),h=(0,i.I4)((t=>{if(!e.current)return;const n=t?`${t}px`:"";e.current.style.width=n,s&&e.current.style.setProperty(s,n)}),[s,e]);function g(){document.body.classList.remove("cursor-ew-resize")}return(0,i.bt)((()=>{e.current&&a&&h(a)}),[s,e,a,h]),(0,i.d4)((()=>{if(!o)return;const n=e=>{const t=Math.ceil(u+e.clientX-d);h(t)};function a(){s(),t(e.current.offsetWidth)}function s(){g(),document.removeEventListener("mousemove",n,!1),document.removeEventListener("mouseup",a,!1),document.removeEventListener("blur",a,!1),c()}return document.addEventListener("mousemove",n,!1),document.addEventListener("mouseup",a,!1),document.addEventListener("blur",a,!1),s}),[u,d,e,t,o,c,h]),{initResize:function(t){t.preventDefault(),document.body.classList.add("cursor-ew-resize"),l(t.clientX),m(e.current.offsetWidth),r()},resetResize:function(e){e.preventDefault(),h(void 0),n()},handleMouseUp:g}}(T,(e=>E({leftColumnWidth:e})),M,c,"--left-column-width"),J=(0,i.I4)((e=>{A(f.du.Settings),B(e)}),[]);return i.ZP.createElement("div",{id:"LeftColumn",ref:T},i.ZP.createElement(kt.Z,{name:r?"none":s.s0,renderCount:Pn,activeKey:D,shouldCleanup:!0,cleanupExceptionKey:bn.Main},(e=>{switch(D){case bn.Archived:return i.ZP.createElement(wn,{isActive:e,onReset:q,onTopicSearch:H,foldersDispatch:O,onSettingsScreenSelect:J,onLeftColumnContentChange:A,isForumPanelOpen:g,archiveSettings:v});case bn.Settings:return i.ZP.createElement(In,{isActive:e,currentScreen:x,foldersState:j,foldersDispatch:O,onScreenSelect:J,onReset:q,shouldSkipTransition:r});case bn.NewChannel:return i.ZP.createElement(vn,{key:F,isActive:e,isChannel:!0,content:N,onContentChange:A,onReset:q});case bn.NewGroup:return i.ZP.createElement(vn,{key:F,isActive:e,content:N,onContentChange:A,onReset:q});default:return i.ZP.createElement(fn,{content:N,isClosingSearch:I,searchQuery:t,searchDate:n,contactsFilter:L,foldersDispatch:O,onContentChange:A,onSearchQuery:$,onSettingsScreenSelect:J,onReset:q,shouldSkipTransition:r,isUpdateAvailable:h,isForumPanelOpen:g,onTopicSearch:H})}})),i.ZP.createElement("div",{className:"resize-handle",onMouseDown:X,onMouseUp:K,onDoubleClick:Y}))})));var Zn=n(12420),Cn=n(49524),Sn=n(71394);var En=n(12255),Mn=n(52678),Rn=n(87204),kn=n(28712),Tn=n(3570),Nn=n(33799),An=n(75790),xn=n(18360),Bn=n(86203),Ln=n(6058),Un=n(98799),jn=n(59188),On=n(32340),Fn=n(2903),_n=n(17891),Dn=n(68512),qn=n(17551);const $n={"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 Hn(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 Gn=(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=Hn(0,0,2,t,1)+Hn(0,12,2,t+1,1)+Hn(0,25,2,t,1);else for(let e=0;e<n;e++)a+=Hn(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.d4)((()=>{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:$n.pinnedMessageBorder},i.ZP.createElement("div",{className:$n.pinnedMessageBorderWrapper1,ref:a}));const{trackHeight:o,trackTranslateY:r,markHeight:c,markTranslateY:d,clipPathId:l}=s;return i.ZP.createElement("div",{className:(0,at.Z)($n.pinnedMessageBorder,t>4&&$n.pinnedMessageBorderMask)},i.ZP.createElement("div",{className:$n.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:$n.pinnedMessageBorderMark,style:`--height: ${c}px; --translate-y: ${d}px; --translate-track: ${r}px;`})))}));var Vn=n(45370),zn=n(62230),Wn=n(34076);const Xn="DusHAy2Lx0SlaPpVAb_o",Yn="jSVbc8Hb7PjitJujB_dQ",Kn=(0,i.X$)((e=>{let{message:t,count:n,index:o,customTitle:r,className:c,onUnpinMessage:d,onClick:l,onAllPinnedClick:m,isLoading:h,isFullWidth:g}=e;const{clickBotInlineButton:p}=(0,a.Sv)(),f=(0,Tt.Z)(),I=(0,Fn.Z)(t),v=(0,Xt.Z)((0,u.Ti)(t,"pictogram")),w=(0,u.NE)(t),b=(0,_n.Z)([h],450)&&h,[P,y,Z]=(0,Mt.Z)(),C=(0,i.I4)((()=>{Z(),d&&d(t.id)}),[Z,d,t.id]),S=(0,u.eH)(t),E=(0,i.I4)((()=>{S&&p({messageId:t.id,button:S})}),[p,S,t.id]),[M,R,k]=(0,Mt.Z)();return i.ZP.createElement("div",{className:(0,at.Z)("HeaderPinnedMessageWrapper","TMOjo7XfD1ZiiuRtfpkm",g&&"full-width",c)},(n>1||b)&&i.ZP.createElement(_t.Z,{round:!0,size:"smaller",color:"translucent",ariaLabel:f("EventLogFilterPinnedMessages"),onClick:b?void 0:m},i.ZP.createElement(Gt.Z,{color:"blue",className:(0,at.Z)("d7XDT4Keip1KHh7mcCv9",Xn,!b&&Yn)}),i.ZP.createElement("i",{className:(0,at.Z)("icon-pin-list",Xn,b&&Yn)})),d&&i.ZP.createElement(_t.Z,{round:!0,size:"smaller",color:"translucent",ariaLabel:f("UnpinMessageAlertTitle"),onClick:y},i.ZP.createElement("i",{className:"icon-close"})),i.ZP.createElement(qn.Z,{isOpen:P,onClose:Z,text:"Would you like to unpin this message?",confirmLabel:"Unpin",confirmHandler:C}),i.ZP.createElement("div",{className:(0,at.Z)("uhn_g6FmUELuGJrCm45w",M&&"jeTsUEkDCkzGUVwy6lrL"),onClick:l,dir:f.isRtl?"rtl":void 0},i.ZP.createElement(Gn,{count:n,index:o}),i.ZP.createElement(kt.Z,{activeKey:t.id,name:"slide-vertical",className:"EK6juGhJwhsLLm4Aag2F"},function(e,t,n){const{width:a,height:s}=(0,Te.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(zn.Z,{thumbDataUri:o,isVisible:Boolean(n),width:a,height:s}))}(I,v,w)),i.ZP.createElement("div",{className:(0,at.Z)("bSvmca5kaTIUh3yJBxnF",I&&"FBCNFm307_rxATSHPSiN")},i.ZP.createElement("div",{className:"q9_FnsHlndM1hZqZjxjM",dir:"auto"},!r&&i.ZP.createElement(Wn.Z,{text:`${f("PinnedMessage")} ${o>0?"#"+(n-o):""}`}),r&&(0,On.Z)(r)),i.ZP.createElement(kt.Z,{activeKey:t.id,name:"slide-vertical-fade",className:"ugsKEK4Xb166oFMP8hHy"},i.ZP.createElement("p",{dir:"auto",className:"WRuyhyQK6mv28Mz8iK28"},i.ZP.createElement(Vn.Z,{lang:f,message:t,noEmoji:Boolean(I)})))),i.ZP.createElement(Dn.Z,null),S&&i.ZP.createElement(_t.Z,{size:"tiny",className:"kXRuktM2s7UN91zOl0Tx",onClick:E,shouldStopPropagation:!0,onMouseEnter:s.$b?void 0:R,onMouseLeave:s.$b?void 0:k},S.text)))}));var Jn=n(10396),Qn=n(64532),ea=n(23186),ta=n(75851);const na=240;function aa(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=()=>{sa(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 sa(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"image/png";if(!("createImageBitmap"in window))return oa(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,ta.ix)(e.src),i=(0,ta.rZ)(o)<na?"#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 oa(e,t,n,void 0,a)}}async function oa(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,ta.ix)(e.src),l=(0,ta.rZ)(d)<na?"#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 ia=n(77510);const ra=n.p+"telegram-logo-filled.67469f6dc5e301e8e0bd.svg",ca={width:200,height:200},da=115;var la=n(17240),ua=n(18051);const ma={.5:.66,.75:.8,1:1,1.5:1.4,2:1.8},ha=Object.keys(ma).sort().map(Number),ga=(0,a.c$)(((e,t)=>{let{message:n}=t;const a=(0,d.Ur)(e,n),s=(0,d.Z1)(e,n.chatId),{volume:o,playbackRate:i,isMuted:r,isPlaybackRateActive:c}=(0,d.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:m,isPlaybackRateActive:h,isMuted:g}=e;const{setAudioPlayerVolume:p,setAudioPlayerPlaybackRate:f,setAudioPlayerMuted:I,focusMessage:v,closeAudioPlayer:w}=(0,a.Sv)(),b=(0,i.sO)(null),P=(0,Tt.Z)(),{isMobile:y}=(0,C.ZP)(),{audio:Z,voice:S,video:E}=(0,u.qp)(t),M=Boolean(S||E),R=M||(Z?.duration||0)>o.J0S,k=c?(0,u.OU)(P,c):void 0,T=ke.UV((0,u.Ti)(t,"inline")),N=((e,t,n)=>{const a=(0,Tt.Z)(),{audio:s,voice:o}=(0,u.qp)(e),r=s?s.title||s.fileName:o?"Voice message":"",c=s?.performer||t&&(0,u.OU)(a,t),d=n&&(0,u.U)(a,n)||"Telegram",l=s&&(0,u.MR)(s)&&(0,u.Ti)(e,"pictogram"),m=t&&(0,u.RT)(t,"big"),h=s&&l||o&&m,g=(0,Xt.Z)(h),p=(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?Te.vY:void 0}(s,o,g)),[s,g,o]),{result:f}=(0,ia.Z)((()=>function(e,t){if(!e)return Promise.resolve(ra);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=()=>{sa(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,da,da);const n=Math.min(t.width,t.height);return n<da?aa(e,da/n):Promise.resolve(e)}(g,p)),[g,p],ra);return(0,i.Ye)((()=>(0,Qn.Of)({title:r,artist:c,album:d,artwork:[{src:f}]})),[d,c,r,f])})(t,c,d),{playPause:A,stop:x,isPlaying:B,requestNextTrack:L,requestPreviousTrack:U,isFirst:j,isLast:O,setVolume:F,toggleMuted:_,setPlaybackRate:D}=(0,ea.Z)((0,Jn.An)(t),(0,u.XV)(t),M?"voice":"audio",T,void 0,N,void 0,!0,void 0,void 0,(0,u.CI)(t),!0),{isContextMenuOpen:q,handleBeforeContextMenu:$,handleContextMenu:H,handleContextMenuClose:G,handleContextMenuHide:V}=(0,la.Z)(b),z=(0,i.I4)((()=>{v({chatId:t.chatId,messageId:t.id})}),[v,t.chatId,t.id]),W=(0,i.I4)((()=>{B&&A(),w(),(0,Qn.Ay)(),x()}),[w,B,A,x]),X=(0,i.I4)((e=>{p({volume:e/100}),F(e/100)}),[p,F]),Y=(0,i.I4)((()=>{s.$b&&!s.cj||(_(),I({isMuted:!g}))}),[g,I,_]),K=(0,i.I4)((function(e){const t=ma[e],n=1!==e&&(!(arguments.length>1&&void 0!==arguments[1])||arguments[1]);f({playbackRate:t,isPlaybackRateActive:n}),D(n?t:1)}),[f,D]),J=(0,i.I4)((()=>{G();const e=Number(Object.entries(ma).find((e=>{let[,t]=e;return t===m}))?.[0])||1,t=!h;K(t&&1===e?2:e,t)}),[G,h,m,K]),Q=(0,i.I4)((()=>{const e=Object.entries(ma).find((e=>{let[,t]=e;return t===m}))?.[0]||1,t=`${1===m?2:e}Х`;return i.ZP.createElement("div",{className:"playback-wrapper"},q&&i.ZP.createElement("div",{className:"playback-backdrop",onClick:G}),i.ZP.createElement(_t.Z,{round:!0,className:(0,at.Z)("playback-button",h&&"applied",q&&"on-top"),color:"translucent",size:"smaller",ariaLabel:"Playback Rate",ripple:!y,onMouseEnter:H,onClick:J,onMouseDown:$,onContextMenu:H},i.ZP.createElement("span",{className:(0,at.Z)("playback-button-inner",4===t.length&&"small",5===t.length&&"tiny")},t)))}),[$,H,G,J,q,y,h,m]),ee=(0,i.Ye)((()=>0===l||g?"icon-muted":l<.3?"icon-volume-1":l<.6?"icon-volume-2":"icon-volume-3"),[l,g]);if(!r)return i.ZP.createElement("div",{className:(0,at.Z)("AudioPlayer",n),dir:P.isRtl?"rtl":void 0,ref:b},i.ZP.createElement("div",{className:"AudioPlayer-content",onClick:z},Z?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,On.Z)(t||a)),n&&i.ZP.createElement("div",{className:"subtitle",dir:"auto"},(0,On.Z)(n)))}(Z):function(e,t){return i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement("div",{className:"title",dir:"auto"},t&&(0,On.Z)(t)),i.ZP.createElement("div",{className:"subtitle",dir:"auto"},e))}(P("AttachAudio"),k),i.ZP.createElement(Dn.Z,null)),i.ZP.createElement(_t.Z,{round:!0,ripple:!y,color:"translucent",size:"smaller",className:"player-button",disabled:j(),onClick:U,ariaLabel:"Previous track"},i.ZP.createElement("i",{className:"icon-skip-previous"})),i.ZP.createElement(_t.Z,{round:!0,ripple:!y,color:"translucent",size:"smaller",className:(0,at.Z)("toggle-play","player-button",B?"pause":"play"),onClick:A,ariaLabel:B?"Pause audio":"Play audio"},i.ZP.createElement("i",{className:"icon-play"}),i.ZP.createElement("i",{className:"icon-pause"})),i.ZP.createElement(_t.Z,{round:!0,ripple:!y,color:"translucent",size:"smaller",className:"player-button",disabled:O(),onClick:L,ariaLabel:"Next track"},i.ZP.createElement("i",{className:"icon-skip-next"})),i.ZP.createElement("div",{className:"volume-button-wrapper"},i.ZP.createElement(_t.Z,{round:!0,className:"player-button volume-button",color:"translucent",size:"smaller",ariaLabel:"Volume",onClick:Y,ripple:!y},i.ZP.createElement("i",{className:ee})),!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(ua.Z,{bold:!0,value:g?0:100*l,onChange:X})))),R&&i.ZP.createElement(Ot.Z,{forceOpen:q,positionX:"right",positionY:"top",className:"playback-rate-menu",trigger:Q,onClose:G,onHide:V,onMouseEnterBackdrop:G},ha.map((e=>function(e,t,n,a){const s=t===ma[e]&&a||1===e&&!a;return i.ZP.createElement(Ft.Z,{key:e,onClick:()=>n(e),icon:s?"check":void 0,customIcon:s?void 0:i.ZP.createElement("i",{className:"icon-placeholder"})},e,"X")}(e,m,K,h)))),i.ZP.createElement(_t.Z,{round:!0,className:"player-close",color:"translucent",size:"smaller",onClick:W,ariaLabel:"Close player"},i.ZP.createElement("i",{className:"icon-close"})))}));var pa=n(4794),fa=n(14605);const Ia=(0,i.X$)((0,a.c$)(((e,t)=>{let{chatId:n}=t;return{currentUserId:e.currentUserId,chat:(0,d.Z1)(e,n),user:(0,u.YC)(n)?(0,d.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:m,deleteChat:h,leaveChannel:g,deleteChatUser:p,deleteHistory:f,toggleChatArchived:I,hideChatReportPanel:v}=(0,a.Sv)(),w=(0,Tt.Z)(),[b,P,y]=(0,Mt.Z)(),[Z,C]=(0,i.eJ)(!0),[S,E]=(0,i.eJ)(!0),{accessHash:M}=s||{},{isAutoArchived:R,canReportSpam:k,canAddContact:T,canBlockContact:N}=r||{},A=s&&(0,u.G9)(s),x=(0,i.I4)((()=>{d({userId:t}),R&&I({id:t})}),[d,R,I,t]),B=(0,i.I4)((()=>{y(),l({contactId:t,accessHash:M}),k&&Z&&m({chatId:t}),S&&h({chatId:t})}),[M,l,y,h,m,k,S,Z,t]),L=(0,i.I4)((()=>{v({chatId:t})}),[t,v]),U=(0,i.I4)((()=>{y(),m({chatId:t}),A?(p({chatId:t,userId:c}),f({chatId:t,shouldDeleteForAll:!1})):g({chatId:t})}),[t,y,c,p,f,A,g,m]);if(r)return i.ZP.createElement("div",{className:(0,at.Z)("ChatReportPanel",n),dir:w.isRtl?"rtl":void 0},T&&i.ZP.createElement(_t.Z,{isText:!0,fluid:!0,size:"tiny",className:"UserReportPanel--Button",onClick:x},w("lng_new_contact_add")),N&&i.ZP.createElement(_t.Z,{color:"danger",isText:!0,fluid:!0,size:"tiny",className:"UserReportPanel--Button",onClick:P},w("lng_new_contact_block")),k&&!N&&i.ZP.createElement(_t.Z,{color:"danger",isText:!0,fluid:!0,size:"tiny",className:"UserReportPanel--Button",onClick:P},w("lng_report_spam_and_leave")),i.ZP.createElement(_t.Z,{round:!0,ripple:!0,size:"tiny",color:"translucent",onClick:L,ariaLabel:w("Close")},i.ZP.createElement("i",{className:"icon-close"})),i.ZP.createElement(qn.Z,{isOpen:b,onClose:y,title:w("BlockUserTitle",o?(0,u.Vl)(o):(0,u.U)(w,s)),text:o?w("UserInfo.BlockConfirmationTitle",(0,u.Js)(o)):w("Chat.Confirm.ReportSpam.Channel"),confirmIsDestructive:!0,confirmLabel:w("Block"),confirmHandler:o?B:U},o&&i.ZP.createElement(fa.Z,{label:w("DeleteThisChat"),checked:S,onCheck:E}),o&&k&&i.ZP.createElement(fa.Z,{label:w("ReportChat"),checked:Z,onCheck:C})))}))),va=(0,i.X$)((0,a.c$)(((e,t)=>{let{chatId:n,threadId:a,messageListType:s,isMobile:o}=t;const{isLeftColumnShown:i,shouldSkipHistoryAnimations:c,audioPlayer:l,messageLists:m}=(0,d.jU)(e),{lastSyncTime:h}=e,g=(0,d.Z1)(e,n),{chatId:p,messageId:f}=l,I=p&&f?(0,d.hj)(e,p,f):void 0;let v;if("pinned"===s){const t=(0,d.KB)(e,n,a);v=t?.length}else if("scheduled"===s){const t=(0,d.qy)(e,n,a);v=t?.length}else if("thread"===s&&a!==r._f){const t=(0,d.tZ)(e,n,a);v=t?.messagesCount||0}const w="thread"===s&&a===r._f,b=g&&(0,d.xo)(e,g),P=Boolean(b&&(0,d.s4)(e,n)),y=b&&!P&&Boolean((0,d.pk)(e,n)),Z=Boolean(g&&(w||g.isForum)&&((0,u.eA)(g)||(0,u.ZV)(g))&&g.isNotJoined),C=Boolean(g?.isNotJoined&&g.isJoinRequest),S={typingStatus:(0,d.WP)(e,n,a,"typingStatus"),isLeftColumnShown:i,isRightColumnShown:(0,d.Jf)(e,o),isSelectModeActive:(0,d.CA)(e),audioMessage:I,chat:g,messagesCount:v,isChatWithSelf:(0,d.FM)(e,n),lastSyncTime:h,shouldSkipHistoryAnimations:c,currentTransitionKey:Math.max(0,m.length-1),connectionState:e.connectionState,isSyncing:e.isSyncing,hasButtonInHeader:y||P||Z||C},E=(0,d.Zw)(e,n);if("thread"!==s||!E)return S;if(Object.assign(S,{messagesById:E}),a!==r._f&&!g?.isForum){const t=(0,d.qS)(e,n,a),s=t?(0,d.hj)(e,n,t):void 0,o=s?(0,d.cv)(e,s):void 0,i=(0,d.tZ)(e,n,a);return{...S,pinnedMessageIds:t,canUnpin:!1,topMessageSender:o,isComments:Boolean(i?.originChannelId)}}const M=(0,d.KB)(e,n,a);if(M?.length){const t=E[M[0]],{canUnpin:n}=t&&(0,d._k)(e,t,a)||{};return{...S,pinnedMessageIds:M,canUnpin:n}}return S}))((e=>{let{chatId:t,threadId:n,messageListType:s,isReady:c,isMobile:d,pinnedMessageIds:l,messagesById:m,canUnpin:h,topMessageSender:g,typingStatus:p,isSelectModeActive:f,isLeftColumnShown:I,isRightColumnShown:v,audioMessage:w,chat:b,messagesCount:P,isComments:y,isChatWithSelf:Z,lastSyncTime:S,hasButtonInHeader:E,shouldSkipHistoryAnimations:M,currentTransitionKey:R,connectionState:k,isSyncing:T,getCurrentPinnedIndexes:N,getLoadingPinnedId:A,onFocusPinnedMessage:x}=e;const{openChatWithInfo:B,pinMessage:L,focusMessage:U,openChat:j,openPreviousChat:O,loadPinnedMessages:F,toggleLeftColumn:_,exitMessageSelectMode:D}=(0,a.Sv)(),q=(0,Tt.Z)(),$=(0,i.sO)(!0),{isTablet:H}=(0,C.ZP)(),G=(0,Bn.Z)(N)[`${t}_${n}`]||0,V=(0,Bn.Z)(A),z=Array.isArray(l)?l[G]:l,W=m&&z?m[z]:void 0,X=Array.isArray(l)?l.length:l?1:void 0,Y=b&&(0,u.U)(q,b).length,K=g?(0,u.OU)(q,g):void 0,{settings:J}=b||{},Q=b?.isForum;(0,i.d4)((()=>{S&&c&&(n===r._f||Q)&&F({chatId:t,threadId:n})}),[t,F,S,n,c,Q]),(0,An.Z)(t,z,W);const{width:ee}=(0,En.Z)(),te=ee<=o.ksF,ne=H&&I,ae=(0,i.sO)(null),se=(0,i.sO)(!0),oe=(0,i.I4)((()=>{B({id:t,threadId:n})}),[B,t,n]),ie=(0,i.I4)((e=>{L({messageId:e,isUnpin:!0})}),[L]),re=(0,i.I4)((()=>{W&&x(W.id)&&U({chatId:W.chatId,threadId:n,messageId:W.id,noForumTopicPanel:!0})}),[W,n,x]),ce=(0,i.I4)((()=>{j({id:t,threadId:n,type:"pinned"})}),[j,t,n]),de=(0,i.I4)((()=>{setTimeout((()=>{$.current=!0}),450)}),[]),le=(0,i.I4)((e=>{if($.current){if($.current=!1,d){const e=document.querySelector(o.Edp);e?.blur()}if(f)return D(),void de();if("thread"===s&&0===R)return!H||ne?(e.stopPropagation(),j({id:void 0},{forceOnHeavyAnimation:!0})):_(),void de();O(),de()}}),[d,f,s,R,de,H,ne]),ue=ee>=o.ksF&&ee<o.jT7||ee>o.l35&&ee<o.ksF&&(!Y||Y>30),me=ue||ee>o._mX&&ee<o.QU1,he=Boolean(J?.canAddContact||J?.canBlockContact||J?.canReportSpam),{shouldRender:ge,transitionClassNames:pe}=(0,pt.Z)(he),fe=(0,xn.Z)(he?J:void 0,!0),{shouldRender:Ie,transitionClassNames:ve}=(0,pt.Z)(Boolean(w)),we=(0,xn.Z)(w,!0),{shouldRender:be,transitionClassNames:Pe}=(0,pt.Z)(Boolean(W)),ye=(0,xn.Z)(W,!0),Ze=(0,xn.Z)(X,!0),Ce=(0,xn.Z)(h,!0),Se=(0,xn.Z)(K),Ee=(0,Rn.Z)(R),Me=void 0!==Ee&&Ee<R?Ee:void 0,Re=be&&ye||Ie&&we;(0,i.d4)((()=>{const e=ae.current;if(e)return me&&Re?void(v||ue?(se.current&&(e.classList.add("tools-stacked","animated"),se.current=!1),setTimeout((()=>{e.classList.remove("animated")}),350)):(e.classList.remove("tools-stacked"),se.current=!0)):(e.classList.remove("tools-stacked","animated"),void(se.current=!0))}),[me,Re,ue,v]);const{connectionStatusText:ke}=Lt(q,k,T,!0);function Te(){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(_t.Z,{round:!0,size:"smaller",color:"translucent",onClick:le,ariaLabel:q(e?"Close":"Back")},i.ZP.createElement("div",{className:(0,at.Z)("animated-close-icon",!e&&"state-back")})),t&&i.ZP.createElement(Ct,null))}const Ne=Boolean(Ie&&we),Ae=Ne||!d&&E&&ee<o.sgm;return i.ZP.createElement("div",{className:"MiddleHeader",ref:ae},i.ZP.createElement(kt.Z,{name:M?"none":"slide-fade",activeKey:R,shouldCleanup:!0,cleanupExceptionKey:Me},"thread"!==s||n!==r._f&&!b?.isForum?i.ZP.createElement(i.ZP.Fragment,null,Te(),i.ZP.createElement("h3",null,void 0!==P?"thread"===s?q(y?"CommentsCount":"Replies",P,"i"):"pinned"===s?q("PinnedMessagesCount",P,"i"):"scheduled"===s?Z?q("Reminders"):q("messages",P,"i"):void 0:q("Loading"))):i.ZP.createElement(i.ZP.Fragment,null,(te||R>0)&&Te(ne,!0),i.ZP.createElement("div",{className:"chat-info-wrapper",onClick:oe},(0,u.YC)(t)?i.ZP.createElement(Ln.Z,{key:t,userId:t,typingStatus:p,status:ke,withDots:Boolean(ke),withFullInfo:!0,withMediaViewer:!0,withUpdatingStatus:!0,withVideoAvatar:c,emojiStatusSize:22,noRtl:!0}):i.ZP.createElement(Un.Z,{key:t,chatId:t,threadId:n,typingStatus:p,status:ke,withDots:Boolean(ke),withMediaViewer:n===r._f,withFullInfo:n===r._f,withUpdatingStatus:!0,withVideoAvatar:c,noRtl:!0})))),n===r._f&&!b?.isForum&&i.ZP.createElement(pa.Z,{hasPinnedOffset:be&&Boolean(ye)||Ie&&Boolean(we),chatId:t}),be&&ye&&i.ZP.createElement(Kn,{key:t,message:ye,count:Ze||0,index:G,customTitle:Se,className:Pe,onUnpinMessage:Ce?ie:void 0,onClick:re,onAllPinnedClick:ce,isLoading:void 0!==V,isFullWidth:Ae}),ge&&i.ZP.createElement(Ia,{key:t,chatId:t,settings:fe,className:pe}),i.ZP.createElement("div",{className:"header-tools"},Ne&&i.ZP.createElement(ga,{key:(0,u.Tp)(we),message:we,className:ve}),i.ZP.createElement(jn.Z,{chatId:t,threadId:n,messageListType:s,isMobile:d,canExpandActions:!Ne})))}))),wa=600;function ba(e){return"albumId"in e}function Pa(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,u.FT)(i)||(0,u.FT)(c)||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>wa)&&(a=[],s.senderGroups.push(a))}})),o}var ya=n(30386),Za=n(87675),Ca=n(60539),Sa=n(88957);const Ea=1e3,Ma=10,Ra=60;var ka=n(60998);const Ta=(e,t,n)=>{const a=(0,Rn.Z)(t);return(0,i.bt)((()=>e(a||[])),t,n)};var Na=n(78722),Aa=n(3657);const xa=s.wZ?1e3:350,Ba=20*Te.Gw,La=15*Te.Gw,Ua=20*Te.Gw,ja=7*Te.Gw,Oa=5*Te.Gw,Fa=12;function _a(e,t){return e?t?Ua:La:t?Ba:ja}function Da(e,t,n,a){const s=(0,u.B4)(e),o=(0,u.O$)(e)||(0,u.F$)(e),i=(0,u.b7)(e),r=Boolean((0,u.F$)(e)),c=Boolean((0,u.Cg)(e)),{width:d,height:l}=o?(0,Te.Eh)(o,s,t,r,n,a):(0,Te.GC)(i,s,t,c,n,a),m=_a(Boolean((0,u.UD)(e)));let h=1;d<m&&m-d<Fa&&(h=m/d),l*h<Oa&&Oa-l*h<Fa&&(h=Oa/l);const g=Math.round(d*h),p=Math.round(l*h);return{width:g,height:p,isSmall:g<m||p<Oa}}const qa={None:0,Top:1,Right:2,Bottom:4,Left:8};function $a(e,t){return e.reduce(((e,t)=>e+t),t)}function Ha(e){const t={width:0,height:0};return e.forEach((e=>{let{dimensions:n,sides:a}=e;a&qa.Right&&(t.width=n.width+n.x),a&qa.Bottom&&(t.height=n.height+n.y)})),t}function Ga(e,t,n,a,s){const o=function(e,t){return e.map((e=>{const n=Da(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,Te.kc)(e,t,!1,n,s)-(t?2.5:0)*Te.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,kn.uZ)(e,1,2.75):(0,kn.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=$a(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=$a(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=qa.None|(0===e?qa.Top:qa.None)|(e===f-1?qa.Bottom:qa.None)|(0===c?qa.Left:qa.None)|(c===t-1?qa.Right:qa.None),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:qa.Left|qa.Top|qa.Right},{dimensions:{x:0,y:o+a,width:n,height:o},sides:qa.Left|qa.Bottom|qa.Right}]}(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:qa.Top|qa.Left|qa.Bottom},{dimensions:{x:o+a,y:0,width:o,height:i},sides:qa.Top|qa.Right|qa.Bottom}]}(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:qa.Top|qa.Left|qa.Bottom},{dimensions:{x:c+s,y:0,width:r,height:d},sides:qa.Top|qa.Right|qa.Bottom}]}(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:qa.Top|qa.Left|qa.Bottom},{dimensions:{x:l+n,y:0,width:d,height:c},sides:qa.Top|qa.Right},{dimensions:{x:l+n,y:c+n,width:d,height:r},sides:qa.Bottom|qa.Right}]}(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]))),d=o-r-s;return[{dimensions:{x:0,y:0,width:o,height:i},sides:qa.Left|qa.Top|qa.Right},{dimensions:{x:0,y:i+s,width:r,height:c},sides:qa.Bottom|qa.Left},{dimensions:{x:r+s,y:i+s,width:d,height:c},sides:qa.Bottom|qa.Right}]}(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:qa.Left|qa.Top|qa.Right},{dimensions:{x:0,y:r+a,width:d,height:m},sides:qa.Bottom|qa.Left},{dimensions:{x:d+a,y:r+a,width:u,height:m},sides:qa.Bottom},{dimensions:{x:d+a+u+a,y:r+a,width:l,height:m},sides:qa.Right|qa.Bottom}]}(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:qa.Top|qa.Left|qa.Bottom},{dimensions:{x:r+s,y:0,width:m,height:d},sides:qa.Top|qa.Right},{dimensions:{x:r+s,y:d+s,width:m,height:l},sides:qa.Right},{dimensions:{x:r+s,y:d+l+2*s,width:m,height:u},sides:qa.Bottom|qa.Right}]}(e)}(m),{layout:u,containerStyle:Ha(u)}}let Va,za;function Wa(e){return za||(za=getComputedStyle(document.documentElement).getPropertyValue("--font-family")),Va||(Va=document.createElement("span"),Va.style.font=`400 12px ${za}`,Va.style.whiteSpace="nowrap",Va.style.position="absolute",Va.style.left="-999px",Va.style.opacity=".01",document.body.appendChild(Va)),Va.textContent=e,Va.offsetWidth}var Xa=n(55254),Ya=n(44139);const Ka=1e3,Ja=20;function Qa(e,t,n,a,s,o,r,c){const d=(0,i.Ye)((()=>{if(!r)return 0;const e=r.indexOf(t);return Math.min(e,r.length-e-1)}),[t,r]);(0,i.bt)((()=>{if(a&&e.current){const t=e.current.closest(".MessageList");(0,Ca.Z)(t,e.current,o?"end":"centerOrTop",Ja,void 0!==s?Ka:void 0,s,void 0,c)}}),[e,n,a,s,o,c,d])}var es=n(3858);const ts=350,ns=150,as=200,ss=3*Te.Gw,os=Number(Te.Gw),is="data-is-document-group-hover";function rs(e,t,n,o,r,c,d,l,u,m,h,g,p,f){const{setReplyingToId:I,sendDefaultReaction:v}=(0,a.Sv)(),[w,b,P]=(0,Mt.Z)(),[y,Z,C]=(0,Mt.Z)(),S=(0,i.sO)();return(0,i.d4)((()=>{if(!s.$b||r||!c||h)return;let e;return(0,nn.sf)(t.current,{selectorToPreventScroll:".MessageList",excludedClosestSelector:".no-word-wrap",onSwipe:(t,n)=>n===nn.eM.Left&&(e||(e=Date.now()),Z(),!0),onRelease:()=>{e&&c&&(I({messageId:n}),setTimeout(C,Math.max(0,ns-(Date.now()-e))),e=void 0)}})}),[t,r,n,I,Z,C,c,h]),{handleMouseDown:r?void 0:function(e){(0,ya.q)(e),u(e)},handleClick:function(t){if(r)e(t);else if(s.$b)return S.current?(clearInterval(S.current),S.current=void 0,void v({chatId:m,messageId:n})):void(S.current=setTimeout((()=>{S.current=void 0,function(e){if(s.wZ){const t=e.target;if(!t.classList.contains("text-content")&&!t.classList.contains("Message"))return;Ue.Z.getIsKeyboardVisible()?setTimeout((()=>{l(e)}),ts):l(e)}}(t)}),as))},handleContextMenu:r?d?es.Z:void 0:function(t){if(s.wZ){if(t.target.matches("a[href]")||h)return;t.preventDefault(),e()}else l(t)},handleDoubleClick:r?void 0:function(){!s.$b&&c&&I({messageId:n})},handleContentDoubleClick:s.$b?void 0:function(e){e.stopPropagation()},handleMouseMove:function(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=Math.abs(p?n-s:s+o-n)<ss,d=Math.abs(i+r-a)<os;c&&d?b():P()},handleSendQuickReaction:function(){v({chatId:m,messageId:n})},handleMouseLeave:function(e){P(),f&&function(e){const t=ds(e.currentTarget);t&&t.removeAttribute(is)}(e)},isSwiped:y,isQuickReactionVisible:w,handleDocumentGroupMouseEnter:cs}}function cs(e){const t=ds(e.currentTarget);t&&t.setAttribute(is,"")}function ds(e){let t=e;do{t=t.nextElementSibling}while(t&&!t.classList.contains("last-in-document-group"));return t}var ls=n(3927),us=n(74095);function ms(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,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);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}const hs=.2;let gs;const ps=new class{constructor(){ms(this,"promise",void 0),ms(this,"reject",void 0),ms(this,"resolve",void 0),this.promise=new Promise(((e,t)=>{this.reject=t,this.resolve=e}))}};setTimeout((function(){gs||(gs=(0,us.K)(new Worker(new URL(n.p+n.u(1275),n.b))),ps.resolve())}),4e3);var fs=n(70172),Is=n(18005);const vs=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,wt.Z)(it.gl.Extra,"ContextMenuContainer",!t);return n?i.ZP.createElement(n,e):void 0}));var ws=n(45601),bs=n(66735);const Ps=(0,i.X$)((e=>{let{message:t,content:n}=e;const{openMediaViewer:s,uploadProfilePhoto:o,showNotification:c}=(0,a.Sv)(),{isOutgoing:d}=t,l=(0,Tt.Z)(),[m,h]=(0,i.eJ)(),[g,p,I]=(0,Mt.Z)(!1),v=(0,Xt.Z)((0,u.Ti)(t,"full")),w=t.content.action.photo?.isVideo,b=(0,i.I4)((()=>{c({title:l("ApplyAvatarHintTitle"),message:l("ApplyAvatarHint"),action:{action:"requestNextSettingsScreen",payload:{screen:f.MT.Main}},actionText:l("Open")})}),[l,c]),P=(0,i.I4)((e=>{h(void 0),o({file:e}),b()}),[b,o]),y=(0,i.I4)((()=>{h(void 0)}),[]),Z=(0,i.I4)((async()=>{I(),b();const e=t.content.action.photo,n=await ke.he(`videoAvatar${e.id}?size=u`,r.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})}),[I,t.content.action,b,o]);return i.ZP.createElement("span",{className:"action-message-suggested-avatar",tabIndex:0,role:"button",onClick:async()=>{!d&&v?w?p():h(await fetch(v).then((e=>e.blob()))):s({chatId:t.chatId,mediaId:t.id,threadId:r._f,origin:f.bZ.SuggestedAvatar})}},i.ZP.createElement(fs.Z,{photo:t.content.action.photo,showVideoOverwrite:!0,loopIndefinitely:!0,withVideo:w,size:"jumbo"}),i.ZP.createElement("span",null,n),i.ZP.createElement("span",{className:"action-message-button"},l(w?"ViewVideoAction":"ViewPhotoAction")),i.ZP.createElement(bs.Z,{file:m,onClose:y,onChange:P}),i.ZP.createElement(qn.Z,{isOpen:g,title:l("SuggestedVideo"),confirmHandler:Z,onClose:I,textParts:n}))})),ys=(0,i.X$)((0,a.c$)(((e,t)=>{let{message:n,threadId:a,messageListType:s}=t;const{chatId:o,senderId:i,replyToMessageId:r,content:c}=n,{byId:l}=e.users,m=i,{targetUserIds:h,targetChatId:g}=c.action||{},p=r,f=p?(0,d.hj)(e,o,p):void 0,I=!!a&&(0,d._X)(e,n,a),{direction:v,noHighlight:w}=I&&(0,d.jU)(e).focusedMessage||{},b=(0,d.Z1)(e,o),P=b&&((0,u.eA)(b)||m===o),y=!P&&m?(0,d.dy)(e,m):void 0,Z=P?b:void 0,C=e.premiumGifts?.stickers?.[0];return{usersById:l,senderUser:y,senderChat:Z,targetChatId:g,targetUserIds:h,targetMessage:f,isFocused:I,premiumGiftSticker:C,topic:(0,d.p$)(e,n),...I&&{focusDirection:v,noFocusHighlight:w,viewportIds:a&&s?(0,d.$W)(e,o,a,s):void 0}}}))((e=>{let{message:t,isEmbedded:n,appearanceOrder:s=0,isLastInList:o,usersById:r,senderUser:c,senderChat:d,targetUserIds:l,targetMessage:m,targetChatId:h,isFocused:g,focusDirection:p,noFocusHighlight:f,viewportIds:I,premiumGiftSticker:v,isInsideTopic:w,topic:b,memoFirstUnreadIdRef:P,observeIntersectionForReading:y,observeIntersectionForLoading:Z,observeIntersectionForPlaying:C,onPinnedIntersectionChange:S}=e;const{openPremiumModal:E,requestConfetti:M}=(0,a.Sv)(),R=(0,Tt.Z)(),k=(0,i.sO)(null);(0,Aa._N)(k,y),(0,An.Z)(t.chatId,t.replyToMessageId,m),Qa(k,t.id,t.chatId,g,p,f,I),(0,i.d4)((()=>{if(t.isPinned)return()=>{S?.({viewportPinnedIdsToRemove:[t.id],isUnmount:!0})}}),[S,t.isPinned,t.id]);const T=s<=0,[N,A]=(0,Mt.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(A,10*s)}),[s,A,T]);const L=(0,Aa.Op)(k,C),U=(0,i.sO)((()=>{const e=P?.current&&t.id>=P.current;return x&&!t.isOutgoing&&e})());(0,i.d4)((()=>{L&&U.current&&(U.current=!1,M())}),[L,M]);const{transitionClassNames:j}=(0,pt.Z)(N,void 0,T,!1),O=(0,i.Ye)((()=>l?l.map((e=>r?.[e])).filter(Boolean):void 0),[l,r]),F=(0,Is.D)(R,t,c,d,O,m,h,b,{isEmbedded:n},Z,C),{isContextMenuOpen:_,contextMenuPosition:D,handleBeforeContextMenu:q,handleContextMenu:$,handleContextMenuClose:H,handleContextMenuHide:G}=(0,la.Z)(k),V=void 0!==D;if(w&&"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"},F);const z=(0,at.Z)("ActionMessage message-list-item",g&&!f&&"focused",(x||B)&&"centered-action",V&&"has-menu-open",o&&"last-in-list",!x&&!B&&"in-one-row",j);return i.ZP.createElement("div",{ref:k,id:(0,u.d0)(t.id),className:z,"data-message-id":t.id,"data-is-pinned":t.isPinned||void 0,onMouseDown:e=>{(0,ya.q)(e),q(e)},onContextMenu:$},!B&&i.ZP.createElement("span",{className:"action-message-content"},F),x&&i.ZP.createElement("span",{className:"action-message-gift",tabIndex:0,role:"button",onClick:()=>{E({isGift:!0,fromUserId:c?.id,toUserId:l?.[0],monthsAmount:t.content.action?.months||0})}},i.ZP.createElement(ws.Z,{key:t.id,sticker:v,play:!0,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(Ps,{message:t,content:F}),D&&i.ZP.createElement(vs,{isOpen:_,anchor:D,message:t,messageListType:"thread",onClose:H,onCloseAnimationEnd:G}))}))),Zs=e=>{let{className:t,message:n,sender:a,title:s,customText:o,isProtected:r,noUserColors:c,hasContextMenu:d,observeIntersectionForLoading:l,observeIntersectionForPlaying:m,onClick:h}=e;const g=(0,i.sO)(null),p=(0,Aa.Op)(g,l),f=(0,Xt.Z)(n&&(0,u.Ti)(n,"pictogram"),!p),I=(0,Fn.Z)(n),v=Boolean(n&&(0,u.Y5)(n)),w=Boolean(n&&(0,u.NE)(n)),b=(0,Tt.Z)(),P=a?(0,u.OU)(b,a):n?.forwardInfo?.hiddenUserName;return i.ZP.createElement("div",{ref:g,className:(0,at.Z)("EmbeddedMessage",t,a&&!c&&`color-${(0,u.Rs)(a)}`),onClick:n?h:void 0},I&&function(e,t,n,a,s){const{width:o,height:r}=(0,Te.W7)(),c=t||e;return i.ZP.createElement("div",{className:(0,at.Z)("embedded-thumb",n&&"round")},!s&&i.ZP.createElement("img",{src:c,width:o,height:r,alt:"",className:"pictogram",draggable:!1}),i.ZP.createElement(zn.Z,{thumbDataUri:c,isVisible:Boolean(s),width:o,height:r}),a&&i.ZP.createElement("span",{className:"protector"}))}(I,f,v,r,w),i.ZP.createElement("div",{className:"message-text"},i.ZP.createElement("p",{dir:"auto"},n?(0,u.FT)(n)?i.ZP.createElement(ys,{message:n,isEmbedded:!0,observeIntersectionForLoading:l,observeIntersectionForPlaying:m}):i.ZP.createElement(Vn.Z,{lang:b,message:n,noEmoji:Boolean(I),observeIntersectionForLoading:l,observeIntersectionForPlaying:m}):o||" "),i.ZP.createElement("div",{className:"message-title",dir:"auto"},(0,On.Z)(P||s||" "))),d&&i.ZP.createElement("i",{className:"embedded-more icon-more"}))};var Cs=n(82535),Ss=n(54752),Es=n(8018);const Ms=(0,i.X$)((e=>{let{message:t,outgoingStatus:n,signature:s,withReactionOffset:o,repliesThreadInfo:r,noReplies:c,isTranslated:d,isPinned:l,onClick:u,onTranslationClick:m,onOpenThread:h}=e;const{showNotification:g}=(0,a.Sv)(),p=(0,Tt.Z)(),[f,I]=(0,Mt.Z)(),v=e=>{e.stopPropagation(),g({message:p("ImportedInfo")})},w=(0,i.Ye)((()=>{if(!f)return;const e=(0,re.SA)(1e3*t.date,p.code,void 0,p.timeFormat),n=t.isEdited&&(0,re.SA)(1e3*t.editDate,p.code,void 0,p.timeFormat),a=t.forwardInfo&&(0,re.SA)(1e3*t.forwardInfo.date,p.code,void 0,p.timeFormat);let s=e;return n&&(s+="\n",s+=p("lng_edited_date").replace("{date}",n)),a&&(s+="\n",s+=p("lng_forwarded_date").replace("{date}",a)),s}),[f,p,t,p.timeFormat]),b=(0,at.Z)("MessageMeta",o&&"reactions-offset",t.forwardInfo?.isImported&&"is-imported");return i.ZP.createElement("span",{className:b,dir:p.isRtl?"rtl":"ltr",onClick:u,"data-ignore-on-paste":!0},d&&i.ZP.createElement("i",{className:"icon-language message-translated",onClick:m}),Boolean(t.views)&&i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement("span",{className:"message-views"},(0,Pt.bi)(t.views)),i.ZP.createElement("i",{className:"icon-channelviews"})),!c&&Boolean(r?.messagesCount)&&i.ZP.createElement("span",{onClick:function(e){e.stopPropagation(),h()},className:"message-replies-wrapper"},i.ZP.createElement("span",{className:"message-replies"},i.ZP.createElement(Wn.Z,{text:(0,Pt.bi)(r.messagesCount)})),i.ZP.createElement("i",{className:"icon-reply-filled"})),l&&i.ZP.createElement("i",{className:"icon-pinned-message message-pinned"}),s&&i.ZP.createElement("span",{className:"message-signature"},(0,On.Z)(s)),i.ZP.createElement("span",{className:"message-time",title:w,onMouseEnter:I},t.forwardInfo?.isImported&&i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement("span",{className:"message-imported",onClick:v},(0,re.SA)(1e3*t.forwardInfo.date,p.code,!0)),i.ZP.createElement("span",{className:"message-imported",onClick:v},p("ImportedMessage"))),t.isEdited&&`${p("EditedMessage")} `,(0,re.mr)(p,1e3*t.date)),n&&i.ZP.createElement(Es.Z,{status:n}))}));var Rs=n(36765),ks=n(97799);const Ts=e=>{let{message:t,observeIntersection:n,observeIntersectionForPlaying:o,shouldLoop:c,lastSyncTime:d,shouldPlayEffect:l,onPlayEffect:m,onStopEffect:h}=e;const{showNotification:g,openStickerSet:p}=(0,a.Sv)(),f=(0,Tt.Z)(),{isMobile:I}=(0,C.ZP)(),v=(0,i.sO)(null),w=t.content.sticker,{stickerSetInfo:b,isVideo:P,hasEffect:y}=w,Z=w.isPreloadedGlobally?void 0:(0,u.Ti)(t,P&&!s.Hh?"pictogram":"inline"),S=(0,Aa.Op)(v,n),E=(0,Aa.Op)(v,o),M=`sticker${w.id}?size=f`,R=(0,Xt.Z)(M,!S||!y,r.IU.BlobUrl,d),[k,T,N]=(0,Mt.Z)(),A=(0,i.I4)((()=>{N(),h?.()}),[h,N]),x=(0,Rn.Z)(l);(0,i.d4)((()=>{y&&E&&(l||x)&&(T(),m?.())}),[y,E,m,l,x,T]);const B=(0,i.I4)((()=>{p({stickerSetInfo:w.stickerSetInfo})}),[p,w]),L=(0,i.I4)((()=>{if(y)return k?void g({message:f("PremiumStickerTooltip"),action:{action:"openStickerSet",payload:{stickerSetInfo:w.stickerSetInfo}},actionText:f("ViewAction")}):(T(),void m?.());B()}),[y,k,f,m,B,g,T,w.stickerSetInfo]),U="isMissing"in b,{width:j,height:O}=(0,Te.Wr)(w,I),F=(0,at.Z)("Sticker media-inner",U&&"inactive",y&&!t.isOutgoing&&"reversed");return i.ZP.createElement("div",{ref:v,className:F,style:`width: ${j}px; height: ${O}px;`,onClick:U?void 0:L},i.ZP.createElement(Rs.Z,{containerRef:v,sticker:w,fullMediaHash:Z,fullMediaClassName:"full-media",size:j,shouldLoop:c,noLoad:!S,noPlay:!E,withSharedAnimation:!0,cacheBuster:d}),y&&S&&k&&i.ZP.createElement(ks.Z,{key:M,className:"effect-sticker",tgsUrl:R,size:1.49*j,play:!0,isLowPriority:!0,noLoop:!0,onEnded:A}))};var Ns=n(74753),As=n(80036);const xs=7*Te.Gw,Bs=1e3,Ls=1e3,Us=0;function js(e,t,n,s,o,r,c){const{interactWithAnimatedEmoji:d,sendEmojiInteraction:l,sendWatchingEmojiInteraction:u}=(0,a.Sv)(),m=(0,i.sO)(null),h=(0,i.sO)(null),g=(0,Xt.Z)(n?`document${n}`:void 0,!n),p=c||xs,f=(0,As.Z)(`width: ${p}px`,`height: ${p}px`,r&&"cursor: pointer"),I=(0,i.sO)(void 0),v=(0,i.sO)(void 0),w=(0,i.I4)((()=>{m.current&&(l({chatId:e,messageId:t,emoji:r,interactions:I.current}),v.current=void 0,I.current=void 0)}),[l,e,t,r]),b=(0,i.I4)((()=>{const e=h.current;g&&(e&&(e.pause(),e.remove()),h.current=new Audio,h.current.src=g,(0,Ns.Z)(h.current),h.current.addEventListener("ended",(()=>{h.current=void 0}),{once:!0}))}),[g]),P=(0,i.I4)((()=>{b();const n=m.current;if(!(r&&n&&t&&e))return;const{x:a,y:s}=n.getBoundingClientRect();d({emoji:r,x:a,y:s,startSize:p,isReversed:!o}),I.current||(I.current=[],v.current=performance.now(),setTimeout(w,Bs)),I.current.push(v.current?(performance.now()-v.current)/Ls:Us)}),[e,r,d,o,t,b,w,p]);return(0,i.d4)((()=>{const n=m.current;n&&s&&s.forEach((a=>{let{id:s,startSize:i,messageId:c}=a;if(i||t!==c)return;const{x:d,y:l}=n.getBoundingClientRect();u({id:s,chatId:e,emoticon:r,startSize:p,x:d,y:l,isReversed:!o}),b()}))}),[s,e,r,o,t,b,u,p]),{ref:m,size:p,style:f,handleClick:P}}const Os=(0,i.X$)((0,a.c$)(((e,t)=>{let{emoji:n,withEffects:a}=t;return{sticker:(0,d.zB)(e,n),effect:a?(0,d.tH)(e,n):void 0,soundId:(0,d.Oh)(e,n)}}))((e=>{let{isOwn:t,observeIntersection:n,lastSyncTime:a,forceLoadPreview:s,messageId:o,chatId:r,activeEmojiInteractions:c,sticker:d,effect:l,soundId:u}=e;const{ref:m,size:h,style:g,handleClick:p}=js(r,o,u,c,t,l?.emoji),f=(0,Aa.Op)(m,n);return i.ZP.createElement(ws.Z,{sticker:d,size:h,quality:1,noLoad:!f,forcePreview:s,lastSyncTime:a,play:f,forceOnHeavyAnimation:!0,ref:m,className:(0,at.Z)("AnimatedEmoji media-inner",d?.id===Te.wB&&"like-sticker-thumb"),style:g,onClick:p})}))),Fs=(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,d.tH)(e,s.emoji):void 0,soundId:s?.emoji&&(0,d.Oh)(e,s.emoji)}}))((e=>{let{isOwn:t,customEmojiId:n,messageId:a,chatId:s,activeEmojiInteractions:o,sticker:r,effect:c,soundId:d,observeIntersection:l}=e;const{ref:u,size:m,style:h,handleClick:g}=js(s,a,d,o,t,c?.emoji,(0,Ya.qo)(1));return i.ZP.createElement(zt.Z,{ref:u,documentId:n,className:(0,at.Z)("AnimatedEmoji media-inner",r?.id===Te.wB&&"like-sticker-thumb"),style:h,size:m,isBig:!0,withSharedAnimation:!0,forceOnHeavyAnimation:!0,observeIntersectionForLoading:l,onClick:g})}))),_s={dark:{outgoing:"rgb(135,116,225)",incoming:"rgb(33,33,33)"},light:{outgoing:"rgb(238,255,222)",incoming:"rgb(255,255,255)"}};function Ds(e,t,n,a,s){return a?Promise.resolve(_s[s||"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 qs=n(92566),$s=n(15866);function Hs(e,t,n){const{isMobile:a}=(0,C.ZP)(),o=n||(0,u.DH)(e);return(0,$s.Z)(o,Boolean(t),a&&!s.vX)}var Gs=n(70692),Vs=n(39196);const zs=e=>{let{id:t,message:n,observeIntersection:a,noAvatars:s,canAutoLoad:r,isInSelectMode:c,isSelected:d,uploadProgress:l,forcedWidth:m,size:h="inline",dimensions:g,asForwarded:p,nonInteractive:f,shouldAffectAppendix:I,isDownloading:v,isProtected:w,theme:b,onClick:P,onCancelUpload:y}=e;const Z=(0,i.sO)(null),S=(0,u.O$)(n)||(0,u.F$)(n),E=S.blobUrl,M=(0,Aa.Op)(Z,a),{isMobile:R}=(0,C.ZP)(),[k,T]=(0,i.eJ)(r),N=k&&M,{mediaData:A,loadProgress:x}=(0,qs.Z)((0,u.Ti)(n,h),!N),B=E||A,L=Boolean(m),[U]=(0,i.eJ)(!B),j=Boolean(B),O=Hs(n,j),F=Hs(n,!L),_=(0,Gs.Z)(!j),D=(0,u.DH)(n),[q,,$]=(0,Mt.Z)(S.isSpoiler),{loadProgress:H}=(0,qs.Z)((0,u.Ti)(n,"download"),!v,(0,u.kG)(n,"download")),{isUploading:G,isTransferring:V,transferProgress:z}=(0,u.Sc)(n,l||(v?H:x),N&&!B),W=!1===(0,Rn.Z)(k),{shouldRender:X,transitionClassNames:Y}=(0,pt.Z)(V,void 0,W,"slow"),{shouldRender:K,transitionClassNames:J}=(0,pt.Z)(!B&&!k),Q=(0,i.I4)((()=>{G?y?.(n):B?q?$():P?.(n.id):T((e=>!e))}),[B,$,q,G,n,y,P]),ee=(0,u.B4)(n);Ta((e=>{let[t]=e;if(!I)return void(t&&Z.current.closest(o.be_).removeAttribute(o.s22));const n=Z.current.closest(o.be_);B?Ds(B,ee,0,d,b).then((e=>{n.style.setProperty("--appendix-bg",e),n.setAttribute(o.s22,"")})):n.classList.add("has-appendix-thumb")}),[I,B,ee,c,d,b]);const{width:te,height:ne,isSmall:ae}=g||Da(n,p,s,R),se=(0,at.Z)("media-inner",!G&&!f&&"interactive",ae&&"small-image",te===ne&&"square-image",ne<Oa&&"fix-min-height"),oe=g?` width: ${te}px; left: ${g.x}px; top: ${g.y}px;`:"",ie="inline"===h?`height: ${ne}px;${oe}`:void 0;return i.ZP.createElement("div",{id:t,ref:Z,className:se,style:ie,onClick:G?void 0:Q},L&&i.ZP.createElement("canvas",{ref:F,className:"thumbnail blurred-bg"}),i.ZP.createElement("img",{src:B,className:(0,at.Z)("full-media",L&&"with-blurred-bg"),alt:"",style:m?`width: ${m}px`:void 0,draggable:!w}),U&&i.ZP.createElement("canvas",{ref:O,className:(0,at.Z)("thumbnail",_)}),w&&i.ZP.createElement("span",{className:"protector"}),X&&!K&&i.ZP.createElement("div",{className:`media-loading ${Y}`},i.ZP.createElement(Vs.Z,{progress:z,onClick:G?Q:void 0})),K&&i.ZP.createElement("i",{className:(0,at.Z)("icon-download",J)}),i.ZP.createElement(zn.Z,{isVisible:q,withAnimation:!0,thumbDataUri:D,width:te,height:ne,className:"media-spoiler"}),V&&i.ZP.createElement("span",{className:"message-transfer-progress"},Math.round(100*z),"%"))};var Ws=n(35148);const Xs=e=>{let{id:t,message:n,observeIntersectionForLoading:s,observeIntersectionForPlaying:o,noAvatars:r,canAutoLoad:c,canAutoPlay:d,uploadProgress:l,forcedWidth:m,lastSyncTime:h,dimensions:g,asForwarded:p,isDownloading:f,isProtected:I,onClick:v,onCancelUpload:w}=e;const b=(0,i.sO)(null),P=(0,i.sO)(null),y=(0,u.b7)(n)||(0,u.Cg)(n),Z=y.blobUrl,[S,,E]=(0,Mt.Z)(y.isSpoiler),M=(0,Aa.Op)(b,s),R=(0,Aa.Op)(b,o)&&M,k=(0,i.sO)(M);R&&!k.current&&(k.current=!0);const{isMobile:T}=(0,C.ZP)(),[N,A]=(0,i.eJ)(c),x=Boolean(N&&M&&h),[B,L]=(0,i.eJ)(Boolean(d&&!S)),U=(0,u.Ti)(n,"inline"),[j]=(0,i.eJ)(Boolean(U&&ke.UV(U))),{mediaData:O,loadProgress:F}=(0,qs.Z)(U,!x,(0,u.kG)(n,"inline"),h),_=Z||O,[D,q]=(0,Mt.Z)(),$=(0,u.DH)(n),H=Boolean($),G=Boolean(m),V=(0,u.Ti)(n,"preview"),[z]=(0,i.eJ)(Boolean(V&&ke.UV(V))),W=M&&h,X=(0,Xt.Z)(V,!W,void 0,h),Y=(0,Gs.Z)((H||X)&&!D),K=!H||X||D,J=Hs(n,K),Q=Hs(n,!G),ee=(0,Gs.Z)(!K),te=_&&k.current,{loadProgress:ne}=(0,qs.Z)((0,u.Ti)(n,"download"),!f,(0,u.kG)(n,"download"),h),{isUploading:ae,isTransferring:se,transferProgress:oe}=(0,u.Sc)(n,l||(f?ne:F),x&&!D&&!j||f),ie=!1===(0,Rn.Z)(N),{shouldRender:ce,transitionClassNames:de}=(0,pt.Z)(se,void 0,ie),{transitionClassNames:le}=(0,pt.Z)(Boolean((N||_)&&!B&&!ce)),[ue,me]=(0,i.eJ)(0),he=(0,i.I4)((e=>{me(Math.max(0,e.currentTarget.currentTime-1))}),[]),ge=P.current?.duration||y.duration||0,pe=(0,u.B4)(n),fe=Boolean((0,u.Cg)(n)),{width:Ie,height:ve}=g||(0,Te.GC)(y,pe,p,fe,r,T),we=(0,i.I4)((()=>{ae?w?.(n):f?(0,a.Sv)().cancelMessageMediaDownload({message:n}):_?(_&&!B&&L(!0),S?E():v?.(n.id)):A((e=>!e))}),[ae,f,_,B,S,v,n,w,E]),be=(0,at.Z)("media-inner dark",!ae&&"interactive",ve<Oa&&"fix-min-height"),Pe=`height: ${ve}px;${g?` width: ${Ie}px; left: ${g.x}px; top: ${g.y}px;`:""}`;return i.ZP.createElement("div",{ref:b,id:t,className:be,style:Pe,onClick:ae?void 0:we},G&&i.ZP.createElement("canvas",{ref:Q,className:"thumbnail blurred-bg"}),te&&i.ZP.createElement(Ws.Z,{ref:P,src:_,className:(0,at.Z)("full-media",G&&"with-blurred-bg"),canPlay:B&&R,muted:!0,loop:!0,playsInline:!0,draggable:!I,onTimeUpdate:he,onReady:q,style:m?`width: ${m}px`:void 0}),i.ZP.createElement("img",{src:X,className:(0,at.Z)("thumbnail",Y,G&&"with-blurred-bg"),alt:"",style:m?`width: ${m}px;`:void 0,draggable:!I}),H&&!z&&i.ZP.createElement("canvas",{ref:J,className:(0,at.Z)("thumbnail",ee)}),I&&i.ZP.createElement("span",{className:"protector"}),i.ZP.createElement("i",{className:(0,at.Z)("icon-large-play",le)}),i.ZP.createElement(zn.Z,{isVisible:S,withAnimation:!0,thumbDataUri:$,width:Ie,height:ve,className:"media-spoiler"}),ce&&i.ZP.createElement("div",{className:(0,at.Z)("media-loading",de)},i.ZP.createElement(Vs.Z,{progress:oe,onClick:we})),!N&&!_&&i.ZP.createElement("i",{className:"icon-download"}),se?i.ZP.createElement("span",{className:"message-transfer-progress"},ae||f?`${Math.round(100*oe)}%`:"..."):i.ZP.createElement("div",{className:"message-media-duration"},y.isGif?"GIF":(0,re.k9)(Math.max(ge-ue,0))))};var Ys=n(6272);const Ks=(0,a.c$)(((e,t)=>{let{contact:n}=t;const{countryList:{phoneCodes:a}}=e;return{user:(0,d.dy)(e,n.userId),phoneCodeList:a,animationLevel:e.settings.byKey.animationLevel}}))((e=>{let{contact:t,user:n,phoneCodeList:s,animationLevel:o}=e;const{openChat:r}=(0,a.Sv)(),{firstName:c,lastName:d,phoneNumber:l,userId:u}=t,m="0"!==u,h=(0,i.I4)((()=>{r({id:u})}),[r,u]);return i.ZP.createElement("div",{className:(0,at.Z)("Contact",m&&"interactive"),onClick:m?h:void 0},i.ZP.createElement(fs.Z,{size:"large",user:n,text:c||d,animationLevel:o,withVideo:!0}),i.ZP.createElement("div",{className:"contact-info"},i.ZP.createElement("div",{className:"contact-name"},c," ",d),i.ZP.createElement("div",{className:"contact-phone"},(0,Ys.WZ)(s,l))))}));var Js=n(20230),Qs=n(51218),eo=n(14434),to=n(96937);function no(e,t){return t>0?(e/t*100).toFixed():0}const ao=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?no(c.votersCount,a||0):0,[m,h]=(0,i.eJ)(r?0:u),g=(0,i.sO)(null),p=c?no(c.votersCount,s||0):0,f=m!==u;if((0,i.d4)((()=>{r&&h(u)}),[r,u]),(0,i.d4)((()=>{const e=g.current;if(e&&r){const t=e.firstElementChild,n=f?"":"stroke-dasharray: 100% 200%; stroke-dashoffset: -44";t?t.setAttribute("style",n):e.innerHTML=`\n <svg class="poll-line" xmlns="http://www.w3.org/2000/svg" style="${n}">\n <path d="M4.47 5.33v13.6a9 9 0 009 9h13"/>\n </svg>`}}),[f,r]),!n||!c)return;const I=`width: ${p}%; transform:scaleX(${f?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,at.Z)("poll-option-chosen",!d&&"wrong",r&&"animate")},i.ZP.createElement("i",{className:d?"icon-check":"icon-close"}))),i.ZP.createElement("div",{className:"poll-option-right"},i.ZP.createElement("div",{className:"poll-option-text",dir:"auto"},(0,On.Z)(t.text)),i.ZP.createElement("div",{className:(0,at.Z)("poll-option-answer",l&&!d&&"wrong")},i.ZP.createElement("div",{className:"poll-option-corner",ref:g}),i.ZP.createElement("div",{className:"poll-option-line",style:I}))))};function so(e){e.stopPropagation()}const oo=(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,usersById:o,onSendVote:r}=e;const{loadMessage:c,openPollResults:d,requestConfetti:l}=(0,a.Sv)(),{id:u,chatId:m}=t,{summary:h,results:g}=n,[p,f]=(0,i.eJ)(!1),[I,w]=(0,i.eJ)([]),[b,P]=(0,i.eJ)(!1),[y,Z]=(0,i.eJ)(!1),[C,S]=(0,i.eJ)(!h.closed&&h.closeDate&&h.closeDate>0?Math.min(h.closeDate-Math.floor(Date.now()/1e3)+(0,v.Qj)(),h.closePeriod):0),E=(0,i.sO)(null),{results:M,totalVoters:R}=g,k=M&&M.some((e=>e.isChosen)),T=!h.closed&&!k,N=!T&&h.isPublic&&Number(g.totalVoters)>0,A=T&&h.multipleChoice,x=M?Math.max(...M.map((e=>e.votersCount))):R,B=M?M.reduce(((e,t)=>(t.isCorrect&&e.push(t.option),e)),[]):[],L=h.answers.map((e=>({label:e.text,value:e.option,hidden:Boolean(h.quiz&&h.closePeriod&&C<=0)})));(0,i.d4)((()=>{const e=n.results.results?.find((e=>e.isChosen));p&&e&&(e.isCorrect&&l(),f(!1))}),[p,n.results.results,l]),(0,i.d4)((()=>{C>0&&setTimeout((()=>S(C-1)),1e3);const e=E.current;if(e){const t=12*Math.PI,n=e.lastElementChild,a=e.firstElementChild;if(C<=5&&e.classList.add("hurry-up"),n&&a){const e=(h.closePeriod-C)/h.closePeriod*t;a.textContent=(0,re.k9)(C),n.firstElementChild.setAttribute("stroke-dashoffset",`-${e}`)}else e.innerHTML=`\n <span>${(0,re.k9)(C)}</span>\n <svg width="16px" height="16px">\n <circle cx="8" cy="8" r="6" class="poll-countdown-progress" transform="rotate(-90, 8, 8)"\n stroke-dasharray="${t} ${t}"\n stroke-dashoffset="0"\n />\n </svg>`}}),[C,h.closePeriod]),(0,i.d4)((()=>{h.quiz&&(C<=0||k&&!h.closed)&&c({chatId:m,messageId:u})}),[m,C,k,c,u,h.closed,h.quiz]),(0,i.d4)((()=>{let e;return h.quiz&&!h.closed&&h.closePeriod&&h.closePeriod>0&&(e=window.setTimeout((()=>{c({chatId:m,messageId:u})}),1e3*h.closePeriod)),()=>{e&&window.clearTimeout(e)}}),[T,m,c,u,h.closePeriod,h.closed,h.quiz]);const U=(0,i.Ye)((()=>s?s.reduce(((e,t)=>{const n=o[t];return n&&e.push(n),e}),[]):[]),[o,s]),j=(0,i.I4)((e=>{w([e]),f(!0),Z(!0),r([e])}),[r]),O=(0,i.I4)((e=>{w(e)}),[]),F=(0,i.I4)((()=>{f(!0),Z(!0),r(I)}),[r,I]),_=(0,i.I4)((()=>{d({chatId:m,messageId:u})}),[m,u,d]),D=(0,i.I4)((()=>{P(!0)}),[]),q=(0,i.I4)((()=>{P(!1),Z(!1)}),[]);(0,i.d4)((()=>{y&&k&&h.quiz&&g.results&&n.results.solution&&(g.results.find((e=>e.isChosen&&e.isCorrect))||P(!0))}),[k,y,g.results,h.quiz,n.results.solution]);const $=(0,Tt.Z)();return i.ZP.createElement("div",{className:"Poll",dir:$.isRtl?"auto":"ltr"},b&&n.results.solution&&i.ZP.createElement(to.Z,{message:(0,Js.H)(n.results.solution,n.results.solutionEntities),duration:5e3,onDismiss:q,containerId:"#middle-column-portals"}),i.ZP.createElement("div",{className:"poll-question"},(0,On.Z)(h.question,["emoji","br"])),i.ZP.createElement("div",{className:"poll-type"},$(function(e){return void 0===e.isPublic?" ":e.closed?"FinalResults":e.quiz?e.isPublic?"QuizPoll":"AnonymousQuizPoll":e.isPublic?"PublicPoll":"AnonymousPoll"}(h)),U.length>0&&i.ZP.createElement("div",{className:"poll-recent-voters"},U.map((e=>i.ZP.createElement(fs.Z,{size:"micro",user:e})))),C>0&&T&&i.ZP.createElement("div",{ref:E,className:"poll-countdown"}),h.quiz&&n.results.solution&&!T&&i.ZP.createElement(_t.Z,{round:!0,size:"tiny",color:"translucent",className:"poll-quiz-help",disabled:b,onClick:D,ariaLabel:"Show Solution"},i.ZP.createElement("i",{className:"icon-lamp"}))),T&&i.ZP.createElement("div",{className:"poll-answers",onClick:so},A?i.ZP.createElement(Qs.Z,{options:L,onChange:O,disabled:t.isScheduled||p,loadingOptions:p?I:void 0,round:!0}):i.ZP.createElement(eo.Z,{name:`poll-${u}`,options:L,onChange:j,disabled:t.isScheduled||p,loadingOption:p?I[0]:void 0})),!T&&i.ZP.createElement("div",{className:"poll-results"},h.answers.map((function(e){return i.ZP.createElement(ao,{key:e.option,shouldAnimate:y||!T,answer:e,voteResults:M,totalVoters:R,maxVotersCount:x,correctResults:B})}))),!N&&!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")}($,h.quiz,g.totalVoters)),A&&i.ZP.createElement(_t.Z,{isText:!0,disabled:0===I.length,size:"tiny",onClick:F},$("PollSubmitVotes")),N&&i.ZP.createElement(_t.Z,{isText:!0,size:"tiny",onClick:_},$("PollViewResults")))})));var io=n(48035),ro=n(10088);const co=(0,i.X$)((e=>{let{message:t,observeIntersection:n,noAvatars:a,canAutoLoad:s,canAutoPlay:o,inPreview:r,asForwarded:c,lastSyncTime:d,isDownloading:l=!1,isProtected:m,theme:h,onMediaClick:g,onCancelMediaTransfer:p}=e;const f=(0,u.s1)(t),{isMobile:I}=(0,C.ZP)(),v=(0,i.I4)((()=>{g()}),[g]);if(!f)return;const{siteName:w,url:b,displayUrl:P,title:y,description:Z,photo:S,video:E}=f,M=(0,io.Z)(Z,170),R=Boolean(M||y||w);let k=!1;if(R&&f?.photo&&!f.video){const{width:e,height:n}=Da(t,void 0,void 0,I);k=e===n}const T=(S||E)&&g&&!k,N=(0,at.Z)("WebPage",r&&"in-preview",k&&"with-square-photo",!S&&!E&&!r&&"without-media",E&&"with-video",!R&&"no-article");return i.ZP.createElement("div",{className:N,"data-initial":(w||P)[0],dir:"auto"},S&&!E&&i.ZP.createElement(zs,{message:t,observeIntersection:n,noAvatars:a,canAutoLoad:s,size:k?"pictogram":"inline",asForwarded:c,nonInteractive:!T,isDownloading:l,isProtected:m,theme:h,onClick:T?v:void 0,onCancelUpload:p}),R&&i.ZP.createElement("div",{className:"WebPage-text"},i.ZP.createElement(ro.Z,{className:"site-name",url:b,text:w||P}),!r&&y&&i.ZP.createElement("p",{className:"site-title"},(0,On.Z)(y)),M&&i.ZP.createElement("p",{className:"site-description"},(0,On.Z)(M,["emoji","br"]))),!r&&E&&i.ZP.createElement(Xs,{message:t,observeIntersectionForLoading:n,noAvatars:a,canAutoLoad:s,canAutoPlay:o,lastSyncTime:d,asForwarded:c,isDownloading:l,isProtected:m,onClick:T?v:void 0,onCancelUpload:p}))}));var lo=n(17921);const uo=(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,Tt.Z)(),m=(0,u.eO)(t),{title:h,text:g,amount:p,currency:f,isTest:I,photo:v}=m,w=(0,Xt.Z)((0,u.O9)(v)),b=Boolean(c),P=Hs(t,!b,w);return Ta((e=>{let[t]=e;if(n){if(w){const e=d.current.closest(o.be_);Ds(w,!1,0,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]),i.ZP.createElement("div",{ref:d,className:"Invoice"},h&&i.ZP.createElement("p",{className:"title"},(0,On.Z)(h)),g&&i.ZP.createElement("div",null,(0,On.Z)(g,["emoji","br"])),i.ZP.createElement("div",{className:"description "+(v?"has-image":"")},Boolean(v)&&i.ZP.createElement("div",{className:"invoice-image-container"},b&&i.ZP.createElement("canvas",{ref:P,className:"thumbnail blurred-bg"}),w&&i.ZP.createElement("img",{className:"invoice-image",src:w,alt:"",style:c?`width: ${c}px`:void 0,crossOrigin:"anonymous"}),!w&&v&&i.ZP.createElement(lo.Z,{width:c||v.dimensions?.width,height:v.dimensions?.height,forceAspectRatio:!0})),i.ZP.createElement("p",{className:"description-text"},(0,nt.x)(p,f,l.code),I&&i.ZP.createElement("span",null,l("PaymentTestInvoice")))))})),mo={root:"rwnm0xOh31c2MY4kK2No",duration:"lKSp02aI8WDGX3393nkh",buy:"gxQfWp0jp0_2Z4qWiXKN",spoiler:"z2tB5Vd_jKJ9IYX4Nijd"},ho=(0,i.X$)((e=>{let{message:t,lastSyncTime:n}=e;const{openInvoice:s,loadExtendedMedia:o}=(0,a.Sv)(),r=(0,Tt.Z)(),c=(0,u.eO)(t),{chatId:d,id:l}=t,m=(0,i.I4)((()=>{o({chatId:d,ids:[l]})}),[d,l,o]);(0,It.Z)(m,n?3e4:void 0);const{amount:h,currency:g,extendedMedia:p}=c,{width:f,height:I,thumbnail:v,duration:w}=p,b=(0,i.I4)((()=>{s({chatId:d,messageId:l,isExtendedMedia:!0})}),[d,l,s]);return i.ZP.createElement("div",{className:(0,at.Z)(mo.root,"media-inner"),onClick:b},i.ZP.createElement(zn.Z,{thumbDataUri:v?.dataUri,width:f,height:I,isVisible:!0,className:mo.spoiler}),Boolean(w)&&i.ZP.createElement("div",{className:mo.duration},(0,re.k9)(w)),i.ZP.createElement("div",{className:mo.buy},i.ZP.createElement("i",{className:(0,at.Z)("icon-lock",mo.lock)}),r("Checkout.PayPrice",(0,nt.x)(h,g))))})),go=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"})),po=["#e56cd5","#f89440","#9986ff","#44b3f5","#6dc139","#ff5d5a","#f87aad","#6e82b3","#f5ba21"],fo=n.p+"map-pin.7b3c3e60ee24795e4bd2.svg",Io=1e-4,vo={width:400,height:300,zoom:16,scale:2},wo={__html:'<svg version="1.1" class="round-pin" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 64 64" style="enable-background:new 0 0 64 64;" xml:space="preserve"><g><circle cx="32" cy="32" r="24.5"/><path d="M32,8c13.23,0,24,10.77,24,24S45.23,56,32,56S8,45.23,8,32S18.77,8,32,8 M32,7C18.19,7,7,18.19,7,32s11.19,25,25,25 s25-11.19,25-25S45.81,7,32,7L32,7z"/></g><g><polygon points="29.38,57.67 27.4,56.08 30.42,54.42 32,51.54 33.58,54.42 36.6,56.08 34.69,57.61 32,60.73"/><path d="M32,52.58l1.07,1.95l0.14,0.26l0.26,0.14l2.24,1.22l-1.33,1.06l-0.07,0.06l-0.06,0.07L32,59.96l-2.24-2.61l-0.06-0.07 l-0.07-0.06l-1.33-1.06l2.24-1.22l0.26-0.14l0.14-0.26L32,52.58 M32,50.5l-1.94,3.56L26.5,56l2.5,2l3,3.5l3-3.5l2.5-2l-3.56-1.94 L32,50.5L32,50.5z"/></g></svg>'},bo=(0,i.X$)((e=>{let{message:t,peer:n,lastSyncTime:s,isInSelectMode:r,isSelected:c,theme:d}=e;const{openUrl:l}=(0,a.Sv)(),m=(0,i.sO)(null),h=(0,i.sO)(null),g=(0,Tt.Z)(),p=(0,gt.Z)(),f=(0,u.nf)(t),{type:I,geo:w}=f,b=(0,v.bp)(),P=(0,u.$R)(t,b),y="geoLive"!==I||P?void 0:t.date+f.period-b,[Z,C]=(0,i.eJ)(w),S="venue"===I||"geoLive"===I&&!P,{width:E,height:M,zoom:R,scale:k}=vo,T=Boolean(s)&&(0,u.k6)(Z,E,M,R,k),N=(0,Xt.Z)(T),A=(0,Rn.Z)(N),x=N||A,B=n&&(0,u.YC)(n.id),L=n&&B?n:void 0,U=n&&!B?n:void 0,j=(0,u.B4)(t),O=(0,i.Ye)((()=>{if("geoLive"!==I||!Z.accuracyRadius)return 0;const{lat:e,accuracyRadius:t}=Z;return t/function(e,t){return 156543.03392*Math.cos(e*(Math.PI/180))/2**t}(e,R)}),[I,Z,R]),F=(0,i.I4)((e=>{if("geoLive"!==I)return;const n=24*Math.PI,a=e.lastElementChild,s=e.firstElementChild,o=t.date+f.period-(0,v.bp)(),i=(1-o/f.period)*n,r=(0,re.mB)(g,1e3*o);a&&s?(s.textContent=r,a.firstElementChild.setAttribute("stroke-dashoffset",`-${i}`)):e.innerHTML=`\n <span class="geo-countdown-text">${r}</span>\n <svg width="32px" height="32px">\n <circle cx="16" cy="16" r="12" class="geo-countdown-progress" transform="rotate(-90, 16, 16)"\n stroke-dasharray="${n} ${n}"\n stroke-dashoffset="-${i}"\n />\n </svg>`}),[I,t.date,f,g]);return(0,i.bt)((()=>{h.current&&F(h.current)}),[F]),Ta((e=>{let[t]=e;if(S)t||m.current.closest(o.be_).removeAttribute(o.s22);else if(x){const e=m.current.closest(o.be_);Ds(x,j,0,c,d).then((t=>{e.style.setProperty("--appendix-bg",t),e.classList.add("has-appendix-thumb"),e.setAttribute(o.s22,"")}))}}),[S,j,r,c,d,x]),(0,i.d4)((()=>{Math.abs(w.lat-Z.lat)<Io&&Math.abs(w.long-Z.long)<Io?Z.accuracyRadius!==w.accuracyRadius&&C({...Z,accuracyRadius:w.accuracyRadius}):C(w)}),[w,Z]),(0,vt.Z)((()=>{p()}),P?void 0:1e3*(y||0)),(0,It.Z)((()=>{const e=h.current;e&&F(e)}),y?1e3:void 0),i.ZP.createElement("div",{ref:m,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`}(Z.lat,Z.long,R);l({url:e})}},i.ZP.createElement("div",{className:"map-wrapper"},x?i.ZP.createElement("img",{className:"full-media map",src:x,alt:"Location on a map",style:`width: ${vo.width}px; height: ${vo.height}px;`}):i.ZP.createElement(lo.Z,{width:E,height:M}),function(){if(x)return i.ZP.createElement(i.ZP.Fragment,null,Boolean(O)&&!P&&i.ZP.createElement("div",{className:"location-accuracy",style:`width: ${2*O}px; height: ${2*O}px`}),function(){const e=(0,at.Z)("pin",I,P&&"expired");if("geoLive"===I)return i.ZP.createElement("div",{className:e,dangerouslySetInnerHTML:wo},i.ZP.createElement(fs.Z,{chat:U,user:L,className:"location-avatar"}),void 0!==f.heading&&i.ZP.createElement("div",{className:"direction",style:`--direction: ${f.heading}deg`}));if("venue"===I){const t=function(e){return e?go.get(e)||go.get(e.split("/")[0])||po[(t=e,t.split("").reduce(((e,t)=>(e<<5)-e+t.charCodeAt(0)|0),0)%po.length)]:"#008df2";var t}(f.venueType),n=function(e){return e?`https://ss3.4sqi.net/img/categories_v2/${e}_88.png`:""}(f.venueType);return i.ZP.createElement("div",{className:e,dangerouslySetInnerHTML:wo,style:`--pin-color: ${t}`},i.ZP.createElement("img",{src:n,className:"venue-icon",alt:""}))}return i.ZP.createElement("img",{className:e,src:fo,alt:""})}())}()),function(){if(S)return"venue"===I?i.ZP.createElement("div",{className:"location-info"},i.ZP.createElement("div",{className:"location-info-title"},f.title),i.ZP.createElement("div",{className:"location-info-subtitle"},f.address)):"geoLive"===I?i.ZP.createElement("div",{className:"location-info"},i.ZP.createElement("div",{className:"location-info-title"},g("AttachLiveLocation")),i.ZP.createElement("div",{className:"location-info-subtitle"},(0,re.dJ)(g,b,t.editDate)),!P&&i.ZP.createElement("div",{className:"geo-countdown",ref:h})):void 0}())})),Po=(0,i.X$)((e=>{let{message:t,canAutoLoadMedia:n,lastSyncTime:s}=e;const{clickBotInlineButton:o}=(0,a.Sv)(),r=t.content.game,{title:c,description:d}=r,l=Boolean(s)&&(0,u.N)(r),m=Boolean(s)&&(0,u.Wc)(r),h=(0,Xt.Z)(l,!n),g=(0,Xt.Z)(m,!n);return i.ZP.createElement("div",{className:"Game"},i.ZP.createElement("div",{className:"preview",style:"width: 480px; height: 270px",onClick:()=>{o({messageId:t.id,button:t.inlineButtons[0][0]})}},!h&&!g&&i.ZP.createElement(lo.Z,{className:"skeleton preview-content"}),h&&i.ZP.createElement("img",{className:"preview-content",src:h,alt:c}),g&&i.ZP.createElement("video",{className:"preview-content",playsInline:!0,muted:!0,disablePictureInPicture:!0,autoPlay:!0,loop:!0,src:g})),i.ZP.createElement("div",{className:"title"},c),!(0,u.UD)(t)&&i.ZP.createElement("div",{className:"description"},d))}));function yo(e){return(0,i.X$)((0,a.c$)(((e,t)=>{const{message:n}=t;return{isInSelectMode:(0,d.CA)(e),isSelected:(0,d.vk)(e,n.id)}}))((t=>{const{isInSelectMode:n,isSelected:s,message:o,dimensions:r}=t,{toggleMessageSelection:c}=(0,a.Sv)(),d=(0,i.I4)((e=>{e.stopPropagation(),c({messageId:o.id,withShift:e?.shiftKey})}),[c,o]),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,at.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-select"})),i.ZP.createElement(e,l))})))}const Zo=yo(zs),Co=yo(Xs),So=(0,a.c$)(((e,t)=>{let{album:n}=t;const{chatId:a}=n.mainMessage,s=(0,d.Pu)(e),o=(0,d.xs)(e,a);return{theme:s,uploadsById:e.fileUploads.byMessageLocalId,activeDownloadIds:o}}))((e=>{let{album:t,observeIntersection:n,hasCustomAppendix:s,lastSyncTime:o,isOwn:r,isProtected:c,albumLayout:l,onMediaClick:m,uploadsById:h,activeDownloadIds:g,theme:p}=e;const{cancelSendingMessage:f}=(0,a.Sv)(),I=t.messages.length,v=(0,i.I4)((e=>{f({chatId:e.chatId,messageId:e.id})}),[f]),{width:w,height:b}=l.containerStyle;return i.ZP.createElement("div",{className:"Album",style:`width: ${w}px; height: ${b}px;`},t.messages.map((function(e,t){const{photo:f,video:w}=(0,u.qp)(e),b=h[(0,u.KK)(e)],P=b?.progress,{dimensions:y,sides:Z}=l.layout[t],C=(0,d.bH)((0,a.Rd)(),e),S=(0,d.__)((0,a.Rd)(),e);if(f){const a=s&&(r?t===I-1:Boolean(Z&qa.Left&&Z&qa.Bottom));return i.ZP.createElement(Zo,{id:`album-media-${(0,u.d0)(e.id)}`,message:e,observeIntersectionForLoading:n,canAutoLoad:C,shouldAffectAppendix:a,uploadProgress:P,dimensions:y,isProtected:c,onClick:m,onCancelUpload:v,isDownloading:g.includes(e.id),theme:p})}if(w)return i.ZP.createElement(Co,{id:`album-media-${(0,u.d0)(e.id)}`,message:e,observeIntersectionForLoading:n,canAutoLoad:C,canAutoPlay:S,uploadProgress:P,lastSyncTime:o,dimensions:y,isProtected:c,onClick:m,onCancelUpload:v,isDownloading:g.includes(e.id),theme:p})})))}));let Eo;const Mo=e=>{let{message:t,observeIntersection:n,canAutoLoad:s,lastSyncTime:o,isDownloading:c}=e;const d=(0,i.sO)(null),l=(0,i.sO)(null),m=(0,i.sO)(null),h=t.content.video,g=(0,Aa.Op)(d,n),[p,f]=(0,i.eJ)(s),I=Boolean(p&&g&&o),{mediaData:v,loadProgress:w}=(0,qs.Z)((0,u.Ti)(t,"inline"),!I,(0,u.kG)(t,"inline"),o),{loadProgress:b}=(0,qs.Z)((0,u.Ti)(t,"download"),!c,r.IU.BlobUrl,o),[P,y]=(0,Mt.Z)(),Z=!Boolean((0,u.DH)(t))||P,C=Hs(t,Z),S=(0,Gs.Z)(!Z),E=p&&!P||c,M=!1===(0,Rn.Z)(p),{shouldRender:R,transitionClassNames:k}=(0,pt.Z)(E,void 0,M),[T,N]=(0,i.eJ)(!1),[x,B]=(0,i.eJ)(0);(0,i.d4)((()=>{if(!T)return;const e=Te.Rj/2,t=2*(e-6)*Math.PI,n=t-x*t,a=m.current,s=l.current,o=s.firstElementChild;o?o.firstElementChild.setAttribute("stroke-dashoffset",n.toString()):s.innerHTML=`\n <svg width="${Te.Rj}px" height="${Te.Rj}px">\n <circle cx="${e}" cy="${e}" r="${e-6}" class="progress-circle"\n transform="rotate(-90, ${e}, ${e})"\n stroke-dasharray="${t} ${t}"\n stroke-dashoffset="${t}"\n />\n </svg>`,B(a.currentTime/a.duration)}),[T,x]);const L=Boolean(v&&g),U=(0,i.I4)((()=>{m.current&&(N(!1),B(0),(0,Ns.Z)(m.current),(0,A.T2)((()=>{l.current.innerHTML=""})))}),[]),j=(0,i.I4)((()=>{Eo?.(),Eo=U}),[U]),O=(0,i.I4)((()=>{if(!v)return void f((e=>!e));if(c)return void(0,a.Sv)().cancelMessageMediaDownload({message:t});const e=m.current;T?e.paused?((0,Ns.Z)(e),(0,Jn.Es)()):e.pause():(j(),e.pause(),e.currentTime=0,(0,Ns.Z)(e),(0,Jn.Es)(),N(!0))}),[j,T,c,v,t]),F=(0,i.I4)((e=>{const t=e.currentTarget;B(t.currentTime/t.duration)}),[]);return i.ZP.createElement("div",{ref:d,className:"RoundVideo media-inner",onClick:O},v&&i.ZP.createElement("div",{className:"video-wrapper"},i.ZP.createElement(Ws.Z,{canPlay:L,ref:m,src:v,className:"full-media",width:Te.Rj,height:Te.Rj,autoPlay:!0,disablePictureInPicture:!0,muted:!T,loop:!T,playsInline:!0,onEnded:T?U:void 0,onTimeUpdate:T?F:void 0,onReady:y})),i.ZP.createElement("canvas",{ref:C,className:(0,at.Z)("thumbnail",S),style:`width: ${Te.Rj}px; height: ${Te.Rj}px`}),i.ZP.createElement("div",{className:"progress",ref:l}),R&&i.ZP.createElement("div",{className:`media-loading ${k}`},i.ZP.createElement(Vs.Z,{progress:c?b:w})),!v&&!p&&i.ZP.createElement("i",{className:"icon-download"}),i.ZP.createElement("div",{className:"message-media-duration"},T?(0,re.k9)(m.current.currentTime):(0,re.k9)(h.duration),(!T||m.current.paused)&&i.ZP.createElement("i",{className:"icon-muted"})))},Ro=e=>{let{message:t,onClick:n}=e;const a=(0,Tt.Z)();return i.ZP.createElement("div",{className:"InlineButtons"},t.inlineButtons.map((e=>i.ZP.createElement("div",{className:"row"},e.map((e=>i.ZP.createElement(_t.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,On.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-arrow-right"});break;case"urlAuth":return i.ZP.createElement("i",{className:"icon-arrow-right"});case"buy":case"receipt":return i.ZP.createElement("i",{className:"icon-cart"});case"switchBotInline":return i.ZP.createElement("i",{className:"icon-share-filled"});case"webView":case"simpleWebView":return i.ZP.createElement("i",{className:"icon-webapp"})}})(e))))))))},ko=(0,i.X$)((e=>{let{threadInfo:t,disabled:n}=e;const{openComments:s}=(0,a.Sv)(),o=(0,Tt.Z)(),{threadId:r,chatId:c,messagesCount:d,lastMessageId:l,lastReadInboxMessageId:m,recentReplierIds:h,originChannelId:g}=t,p=(0,i.I4)((()=>{s({id:c,threadId:r,originChannelId:g})}),[s,c,r,g]),f=(0,i.Ye)((()=>{if(!h?.length)return;const{users:{byId:e},chats:{byId:t}}=(0,a.Rd)();return h.map((n=>(0,u.YC)(n)?e[n]:t[n])).filter(Boolean)}),[h]);if(void 0===d)return;const I=Boolean(m&&l&&m<l),v=d?o("Comments","%COMMENTS_COUNT%",void 0,d).split("%").map((e=>"COMMENTS_COUNT"===e?i.ZP.createElement(Wn.Z,{text:(0,Pt.bi)(d)}):e)):void 0;return i.ZP.createElement("div",{"data-cnt":(0,Pt.bi)(d),className:(0,at.Z)("CommentButton",I&&"has-unread",n&&"disabled"),dir:o.isRtl?"rtl":"ltr",onClick:p},i.ZP.createElement("i",{className:"icon-comments-sticker"}),(!f||0===f.length)&&i.ZP.createElement("i",{className:"icon-comments"}),f&&f.length>0&&i.ZP.createElement("div",{className:"recent-repliers",dir:o.isRtl?"rtl":"ltr"},f.map((e=>i.ZP.createElement(fs.Z,{key:e.id,size:"small",user:(0,u.YC)(e.id)?e:void 0,chat:(0,u.YC)(e.id)?void 0:e})))),i.ZP.createElement("div",{className:"label",dir:"auto"},d?v:o("LeaveAComment")),i.ZP.createElement("i",{className:"icon-next"}))}));var To=n(78046),No=n(48198);const Ao={root:"JY0NZH9bysPBqR3sIbLu","is-custom-emoji":"T1R9OVCwcfQHR4vN8cx_",isCustomEmoji:"T1R9OVCwcfQHR4vN8cx_","animated-icon":"WTrBqa2uxq57nYJAIelk",animatedIcon:"WTrBqa2uxq57nYJAIelk",effect:"z9v8vlAIGxI3ITxuyEG1",animating:"sB0FGOzwkiDvNWHWcVEL"},xo=2.5*Te.Gw,Bo=6.5*Te.Gw,Lo=(0,i.X$)((e=>{let{reaction:t,genericEffects:n,activeReactions:s,availableReactions:o,observeIntersection:r}=e;const{stopActiveReaction:c}=(0,a.Sv)(),d=(0,i.sO)(null),l="documentId"in t,m=(0,i.Ye)((()=>o?.find((e=>(0,u.Hl)(e.reaction,t)))),[o,t]),h=m?.centerIcon?.id,g=(0,To.Z)(l?t.documentId:void 0),p=(0,i.Ye)((()=>{if(!l)return m?.aroundAnimation?.id;if(!g)return;const e=o?.find((e=>e.reaction.emoticon===g.emoji))?.aroundAnimation?.id;return e}),[m,o,g,l]),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,Aa.Op)(d,r),v=h&&`sticker${h}`,w=f&&`sticker${f}`,b=(0,Xt.Z)(v,!h),P=(0,Xt.Z)(w,!f),y=(0,i.Ye)((()=>s?.find((e=>(0,u.Hl)(e.reaction,t)))),[s,t]),Z=Boolean(y&&(l||b)&&P),{shouldRender:C,transitionClassNames:S}=(0,pt.Z)(Z,void 0,!0,"slow"),E=(0,i.I4)((()=>{y?.messageId&&c({messageId:y.messageId,reaction:t})}),[y?.messageId,t,c]),[M,R,k]=(0,Mt.Z)(),T=!(l||Z&&M),N=(0,at.Z)(Ao.root,C&&Ao.animating,l&&Ao.isCustomEmoji);return i.ZP.createElement("div",{className:N,ref:d},T&&i.ZP.createElement(No.Z,{reaction:t,availableReactions:o}),l&&i.ZP.createElement(zt.Z,{documentId:t.documentId,className:Ao.customEmoji,observeIntersectionForPlaying:r}),C&&i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement(ks.Z,{key:f,className:(0,at.Z)(Ao.effect,S),size:Bo,tgsUrl:P,play:I,noLoop:!0,forceOnHeavyAnimation:!0,onEnded:E}),l?!p&&I&&i.ZP.createElement(Kt,{reaction:t}):i.ZP.createElement(ks.Z,{key:h,className:(0,at.Z)(Ao.animatedIcon,S),size:xo,tgsUrl:b,play:I,noLoop:!0,forceOnHeavyAnimation:!0,onLoad:R,onEnded:k})))})),Uo=(0,i.X$)((e=>{let{reaction:t,message:n,activeReactions:s,availableReactions:o,withRecentReactors:r,genericEffects:c,observeIntersection:d}=e;const{toggleReaction:l}=(0,a.Sv)(),{recentReactions:m}=n.reactions,h=(0,i.Ye)((()=>{if(!r||!m)return;const e=(0,a.Rd)().users.byId;return m.filter((e=>(0,u.Hl)(e.reaction,t.reaction))).map((t=>e[t.userId])).filter(Boolean)}),[t.reaction,m,r]),g=(0,i.I4)((()=>{l({reaction:t.reaction,chatId:n.chatId,messageId:n.id})}),[n,t,l]);return i.ZP.createElement(_t.Z,{className:(0,at.Z)((0,u.Bt)(t)&&"chosen"),size:"tiny",onClick:g},i.ZP.createElement(Lo,{activeReactions:s,reaction:t.reaction,availableReactions:o,genericEffects:c,observeIntersection:d}),h?.length?i.ZP.createElement("div",{className:"avatars"},h.map((e=>i.ZP.createElement(fs.Z,{user:e,size:"micro"})))):i.ZP.createElement(Wn.Z,{text:(0,Pt.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}=e;const m=(0,Tt.Z)(),h=(0,i.Ye)((()=>t.reactions.results.reduce(((e,t)=>e+t.count),0)),[t]);return i.ZP.createElement("div",{className:(0,at.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(Uo,{key:(0,u.$d)(e.reaction),reaction:e,message:t,activeReactions:s,availableReactions:o,withRecentReactors:h<=3&&!l,genericEffects:c,observeIntersection:d}))),r)})),Oo=(0,i.X$)((e=>{let{phoneCall:t,message:n,chatId:o}=e;const{requestMasterAndRequestCall:r}=(0,a.Sv)(),c=(0,Tt.Z)(),{isOutgoing:d,isVideo:l,reason:u}=t,m="missed"===u,h="busy"===u&&!d,g=(0,i.I4)((()=>{r({isVideo:l,userId:o})}),[o,l,r]),p=(0,i.Ye)((()=>l?h?"CallMessageVideoIncomingDeclined":m?d?"CallMessageVideoOutgoingMissed":"CallMessageVideoIncomingMissed":d?"CallMessageVideoOutgoing":"CallMessageVideoIncoming":h?"CallMessageIncomingDeclined":m?d?"CallMessageOutgoingMissed":"CallMessageIncomingMissed":d?"CallMessageOutgoing":"CallMessageIncoming"),[h,m,d,l]),f=(0,i.Ye)((()=>t.duration?(0,re.J_)(c,t.duration):void 0),[c,t.duration]),I=(0,re.mr)(c,1e3*n.date);return i.ZP.createElement("div",{className:"vDeypQzM845_JE14qGId"},i.ZP.createElement(_t.Z,{size:"smaller",color:"translucent",round:!0,ripple:!0,onClick:g,className:"OtJi45yywgt1n_y6VPkE",disabled:!s.Bi,ariaLabel:c(d?"CallAgain":"CallBack")},i.ZP.createElement("i",{className:l?"icon-video-outlined":"icon-phone"})),i.ZP.createElement("div",{className:"_0BG8sziTJQ_NYrsspMg"},i.ZP.createElement("div",{className:"LWVSvxVjeEyHPBrCb2sD"},c(p)),i.ZP.createElement("div",{className:"nuIsoCP15iD4ETadJ44R"},i.ZP.createElement("i",{className:(0,at.Z)("icon-arrow-right","wrUkWet7enyh9L1iPKvA",m&&"V5tKkKZpcY5yq_f5nO8l",!d&&"e0Vhbj8gfzQn1zJQoFLK")}),i.ZP.createElement("span",{className:"TJ2lYkLxYUie3A0JqtMR"},f?c("CallMessageWithDuration",[I,f]):I))))}));var Fo=n(78780),_o=n(50685),Do=n(14612),qo=n(98138),$o=n(2995);var Ho=n(69123);const Go=1.125*Te.Gw,Vo=(0,i.X$)((e=>{let{topic:t,className:n,onClick:a}=e;const s=(0,Tt.Z)();return i.ZP.createElement("div",{className:(0,at.Z)("wUl1jHjVuMxmGhsdl358",n),style:`--topic-button-accent-color: var(${(0,qo.gZ)(t?.iconColor)})`,onClick:a},t?i.ZP.createElement($o.Z,{topic:t,size:Go}):i.ZP.createElement("img",{src:Ho,alt:""}),t?.title?(0,On.Z)(t.title):s("Loading"),t?.isClosed&&i.ZP.createElement("i",{className:"icon-lock"}),i.ZP.createElement("i",{className:"icon-next"}))})),zo={__html:'<svg width="9" height="20" xmlns="http://www.w3.org/2000/svg"><defs><filter x="-50%" y="-14.7%" width="200%" height="141.2%" filterUnits="objectBoundingBox" id="a"><feOffset dy="1" in="SourceAlpha" result="shadowOffsetOuter1"/><feGaussianBlur stdDeviation="1" in="shadowOffsetOuter1" result="shadowBlurOuter1"/><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"/></filter></defs><g fill="none" fill-rule="evenodd"><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(#a)"/><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="#EEFFDE" class="corner"/></g></svg>'},Wo={__html:'<svg width="9" height="20" xmlns="http://www.w3.org/2000/svg"><defs><filter x="-50%" y="-14.7%" width="200%" height="141.2%" filterUnits="objectBoundingBox" id="a"><feOffset dy="1" in="SourceAlpha" result="shadowOffsetOuter1"/><feGaussianBlur stdDeviation="1" in="shadowOffsetOuter1" result="shadowBlurOuter1"/><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"/></filter></defs><g fill="none" fill-rule="evenodd"><path d="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" fill="#000" filter="url(#a)"/><path d="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" fill="#FFF" class="corner"/></g></svg>'},Xo=1.75*Te.Gw,Yo=2.25*Te.Gw,Ko=(0,i.X$)((0,a.c$)(((e,t)=>{const{focusedMessage:n,forwardMessages:a,activeReactions:s,activeEmojiInteractions:i}=(0,d.jU)(e),{lastSyncTime:c}=e,{message:l,album:m,withSenderName:h,withAvatar:g,threadId:p,messageListType:f,isLastInDocumentGroup:I,isFirstInGroup:v}=t,{id:w,chatId:b,viaBotId:P,replyToChatId:y,replyToMessageId:Z,isOutgoing:C,repliesThreadInfo:S,forwardInfo:E,transcriptionId:M,isPinned:R}=l,k=(0,d.Z1)(e,b),T=(0,d.FM)(e,b),N=(0,u.pK)(b),A=k&&(0,u.eA)(k),x=k&&(0,u.Bf)(k),B=k?.usernames,L=a.messageIds&&a.messageIds.includes(w),U=!T&&(0,u.Ul)(l),j=h||g||U,O=(0,d.Ur)(e,l),F=(0,d.cv)(e,l),_=P?(0,d.dy)(e,P):void 0,D=O?.id&&x?k.fullInfo?.adminMembersById?.[O?.id]:void 0,q=p?(0,d.qS)(e,b,p):void 0,$=l.id===q,H=Z===q,G=Z&&!H?(0,d.hj)(e,N&&y?y:b,Z):void 0,V=G&&(0,d.Bz)(e,G,Boolean(E)),z="topicCreate"===G?.content.action?.type,W=(0,d.uZ)(e,l),X="thread"===f&&(m?m.messages.some((t=>(0,d._X)(e,t,p))):(0,d._X)(e,l,p)),{direction:Y,noHighlight:K,isResizingContainer:J}=X&&n||{},{query:Q}=(0,d.n5)(e)||{},ee=(0,u.h_)(l),te=ee&&(0,d.zB)(e,ee)?ee:void 0,ne=(0,u.HW)(l);let ae;ae=m?.messages?m.messages.every((t=>{let{id:n}=t;return(0,d.vk)(e,n)})):(0,d.vk)(e,w);const{canReply:se}="thread"===f&&(0,d._k)(e,l,p)||{},oe=(0,d.te)(e,l),ie=S?(0,d.tZ)(e,S.chatId,S.threadId)||S:void 0,re=Boolean(l.groupedId)&&!l.isInAlbum,ce=re?(0,d.xH)(e,b,l.groupedId)[0]:void 0,de=re?I?(0,d.hj)(e,b,ce):void 0:l,le=k?.unreadReactions?.includes(l.id),ue=p===r._f&&k?.isForum&&v,me=ue?(0,d.p$)(e,l)||k?.topics?.[o.OxA]:void 0,he=Boolean((0,u.nf)(l)),ge=(0,d.xf)(e,b),pe=(0,d.xx)(e,b,l.id);return{theme:(0,d.Pu)(e),chatUsernames:B,forceSenderName:U,canShowSender:j,originSender:F,botSender:_,shouldHideReply:H||z,isThreadTop:$,replyMessage:G,replyMessageSender:V,isInDocumentGroup:re,isProtected:(0,d.EV)(e,l),isChatProtected:(0,d.Am)(e,b),isFocused:X,isForwarding:L,reactionMessage:de,isChatWithSelf:T,isRepliesChat:N,isChannel:A,isGroup:x,canReply:se,lastSyncTime:c,highlight:Q,animatedEmoji:te,animatedCustomEmoji:ne,isInSelectMode:(0,d.CA)(e),isSelected:ae,isGroupSelected:Boolean(l.groupedId)&&!l.isInAlbum&&(0,d.a6)(e,b,l.groupedId),threadId:p,isDownloading:oe,isPinnedList:"pinned"===f,isPinned:R,canAutoLoadMedia:(0,d.bH)(e,l),canAutoPlayMedia:(0,d.__)(e,l),autoLoadFileMaxSizeMb:e.settings.byKey.autoLoadFileMaxSizeMb,shouldLoopStickers:(0,d.Cy)(e),repliesThreadInfo:ie,availableReactions:e.availableReactions,defaultReaction:(0,u.CI)(l)?void 0:(0,d.q6)(e,b),activeReactions:de&&s[de.id],activeEmojiInteractions:i,hasUnreadReaction:le,isTranscribing:void 0!==M&&e.transcriptions[M]?.isPending,transcribedText:void 0!==M?e.transcriptions[M]?.text:void 0,isPremium:(0,d.wV)(e),animationLevel:e.settings.byKey.animationLevel,senderAdminMember:D,messageTopic:me,genericEffects:e.genericEmojiEffects,hasTopicChip:ue,chatTranslations:ge,areTranslationsEnabled:e.settings.byKey.canTranslate,requestedTranslationLanguage:pe,hasLinkedChat:Boolean(k?.fullInfo?.linkedChatId),...(j||he)&&{sender:O},...C&&{outgoingStatus:(0,d.dT)(e,l,"scheduled"===f)},..."number"==typeof W&&{uploadProgress:W},...X&&{focusDirection:Y,noFocusHighlight:K,isResizingContainer:J,viewportIds:(0,d.$W)(e,b,p,f)}}}))((e=>{let{message:t,chatUsernames:n,observeIntersectionForBottom:c,observeIntersectionForLoading:d,observeIntersectionForPlaying:l,album:m,noAvatars:h,withAvatar:g,withSenderName:p,noComments:I,noReplies:w,appearanceOrder:b,isFirstInGroup:P,isPremium:y,isLastInGroup:Z,isFirstInDocumentGroup:S,isLastInDocumentGroup:E,isTranscribing:M,transcribedText:R,isLastInList:k,theme:T,forceSenderName:N,sender:A,canShowSender:x,originSender:B,botSender:L,isThreadTop:U,shouldHideReply:j,replyMessage:O,replyMessageSender:F,outgoingStatus:_,uploadProgress:D,isInDocumentGroup:q,isProtected:$,isChatProtected:H,isFocused:G,focusDirection:V,noFocusHighlight:z,isResizingContainer:W,viewportIds:X,isForwarding:Y,isChatWithSelf:K,isRepliesChat:J,isChannel:Q,isGroup:ee,canReply:te,lastSyncTime: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:Pe,canAutoPlayMedia:ye,shouldLoopStickers:Ze,autoLoadFileMaxSizeMb:Ce,repliesThreadInfo:Se,hasUnreadReaction:Ee,memoFirstUnreadIdRef:Me,animationLevel:Re,senderAdminMember:ke,messageTopic:Ne,hasTopicChip:Ae,chatTranslations:xe,areTranslationsEnabled:Be,requestedTranslationLanguage:Le,onPinnedIntersectionChange:Ue}=e;const{toggleMessageSelection:je,clickBotInlineButton:Oe,disableContextMenuHint:Fe,animateUnreadReaction:_e,focusLastMessage:De}=(0,a.Sv)(),qe=(0,i.sO)(null),$e=(0,i.sO)(null),He=(0,i.sO)(null),Ge=(0,i.sO)(0),Ve=(0,Tt.Z)(),[ze,We]=(0,i.eJ)(!1),[Xe,Ye,Ke]=(0,Mt.Z)(),{isMobile:Je}=(0,C.ZP)();(0,Aa._N)($e,c);const{isContextMenuOpen:Qe,contextMenuPosition:et,handleBeforeContextMenu:tt,handleContextMenu:nt,handleContextMenuClose:st,handleContextMenuHide:ot}=(0,la.Z)(qe,s.$b&&ce,!0,s.wZ);(0,i.d4)((()=>{Qe&&Fe()}),[Qe,Fe]);const it=b<=0,[rt,ct]=(0,Mt.Z)(it);(0,i.d4)((()=>{it||setTimeout(ct,10*b)}),[b,ct,it]);const{transitionClassNames:dt}=(0,pt.Z)(rt,void 0,it,!1),{id:lt,chatId:ut,forwardInfo:mt,viaBotId:ht,isTranscriptionError:gt}=t;(0,i.d4)((()=>{if(!we)return;const e=m?m.mainMessage.id:lt;return()=>{Ue({viewportPinnedIdsToRemove:[e],isUnmount:!0})}}),[m,we,lt,Ue]);const ft=(0,u.CI)(t),It=(0,u.B4)(t),vt="scheduled"===Ie||t.isScheduled,wt=(0,u.ss)(t)&&!j,bt=Boolean(Se)&&"thread"===Ie,Pt=(0,u.$D)(t),yt=Pt&&(se||oe),Zt=me?.reactions&&!(0,u.JE)(me.reactions),Ct=mt&&(!K||vt)&&!J&&!mt.isLinkedChannelPost&&!Pt,St=Boolean(m)&&m.messages.length>1&&!m?.messages.some((e=>0===Object.keys(e.content).length)),Et=q&&!S,Rt=q&&!E,kt=void 0!==et,Nt=!(kt||ce||Y||Rt),At=Q&&!vt&&t.isForwardingAllowed&&!H,xt=Boolean(ve||mt&&(mt.isChannelPost||K&&!It||J)&&mt.fromMessageId),Bt=Ae||wt,Lt=(0,i.I4)(((e,t)=>{je({messageId:lt,groupedId:t,...e?.shiftKey&&{withShift:!0},...St&&{childMessageIds:m.messages.map((e=>{let{id:t}=e;return t}))}})}),[je,lt,St,m]),Ut=x?A:void 0,jt=Boolean(!ze&&(gt||R)),Ot=mt&&(K||J||!Ut)?B:Ut,Ft=mt?B:Ut,{handleMouseDown:Dt,handleClick:qt,handleContextMenu:$t,handleDoubleClick:Ht,handleContentDoubleClick:Gt,handleMouseMove:Vt,handleSendQuickReaction:Xt,handleMouseLeave:Yt,isSwiped:Kt,isQuickReactionVisible:Jt,handleDocumentGroupMouseEnter:Qt}=rs(Lt,qe,lt,0,Boolean(ce),Boolean(te),Boolean($),nt,tt,ut,kt,He,It,Rt),{handleAvatarClick:en,handleSenderClick:tn,handleViaBotClick:nn,handleReplyClick:an,handleMediaClick:sn,handleAudioPlay:on,handleAlbumMediaClick:rn,handleMetaClick:cn,handleTranslationClick:dn,handleOpenThread:ln,handleReadMedia:un,handleCancelUpload:mn,handleVoteSend:hn,handleGroupForward:gn,handleForward:pn,handleFocus:fn,handleFocusForwarded:In,handleDocumentGroupSelectAll:vn,handleTopicChipClick:wn}=function(e,t,n,s,o,c,d,l,u,m,h,g,p,I){const{openChat:v,showNotification:w,focusMessage:b,openMediaViewer:P,openAudioPlayer:y,markMessagesRead:Z,cancelSendingMessage:C,sendPollVote:S,openForwardMenu:E,focusMessageInComments:M,openMessageLanguageModal:R}=(0,a.Sv)(),{id:k,forwardInfo:T,replyToMessageId:N,replyToChatId:A,replyToTopMessageId:x,groupedId:B}=n,L=(0,i.I4)((()=>{h&&v({id:h.id})}),[h,v]),U=(0,i.I4)((()=>{g?d&&T?.channelPostId?b({chatId:g.id,messageId:T.channelPostId}):v({id:g.id}):w({message:e("HidAccount")})}),[d,b,T,e,v,g,w]),j=(0,i.I4)((()=>{p&&v({id:p.id})}),[p,v]),O=(0,i.I4)((()=>{b({chatId:u&&A?A:s,threadId:o,messageId:N,replyMessageId:u&&A?void 0:k,noForumTopicPanel:!0})}),[b,u,A,s,o,N,k]),F=(0,i.I4)((()=>{P({chatId:s,threadId:o,mediaId:k,origin:l?f.bZ.ScheduledInline:f.bZ.Inline})}),[s,o,k,P,l]),_=(0,i.I4)((()=>{y({chatId:s,messageId:k})}),[s,k,y]),D=(0,i.I4)((e=>{P({chatId:s,threadId:o,mediaId:e,origin:l?f.bZ.ScheduledAlbum:f.bZ.Album})}),[s,o,P,l]),q=(0,i.I4)((()=>{Z({messageIds:[k]})}),[k,Z]),$=(0,i.I4)((()=>{C({chatId:s,messageId:k})}),[C,s,k]),H=(0,i.I4)((e=>{S({chatId:s,messageId:k,options:e})}),[s,k,S]),G=(0,i.I4)((()=>{E({fromChatId:s,groupedId:B})}),[E,s,B]),V=(0,i.I4)((()=>{if(m&&m.messages){const e=m.messages.map((e=>{let{id:t}=e;return t}));E({fromChatId:s,messageIds:e})}else E({fromChatId:s,messageIds:[k]})}),[m,E,s,k]),z=(0,i.I4)((()=>{b({chatId:s,threadId:r._f,messageId:k})}),[b,s,k]),W=(0,i.I4)((()=>{c?b({chatId:T.fromChatId,groupedId:B,groupedChatId:s,messageId:T.fromMessageId}):u&&A?M({chatId:A,threadId:x,messageId:T.fromMessageId}):b({chatId:T.fromChatId,messageId:T.fromMessageId})}),[c,u,A,b,T,B,s,M,x]),X=(0,i.I4)((e=>{e.stopPropagation(),t(e,B)}),[t,B]);return{handleAvatarClick:L,handleSenderClick:U,handleViaBotClick:j,handleReplyClick:O,handleMediaClick:F,handleAudioPlay:_,handleAlbumMediaClick:D,handleMetaClick:X,handleTranslationClick:(0,i.I4)((e=>{e.stopPropagation(),R({chatId:s,id:k})}),[s,k,R]),handleOpenThread:(0,i.I4)((()=>{v({id:n.chatId,threadId:n.id})}),[n.chatId,n.id,v]),handleReadMedia:q,handleCancelUpload:$,handleVoteSend:H,handleGroupForward:G,handleForward:V,handleFocus:z,handleFocusForwarded:W,handleDocumentGroupSelectAll:X,handleTopicChipClick:(0,i.I4)((()=>{I&&b({chatId:u&&A?A:s,threadId:I.id,messageId:k})}),[s,b,u,I,k,A])}}(Ve,Lt,t,ut,ue,q,Ct,vt,J,m,Ot,Ft,L,Ne);(0,i.d4)((()=>{k&&jt&&R&&De()}),[De,k,R,jt]);const bn=(0,at.Z)("Message message-list-item",P&&"first-in-group",$&&"is-protected",Z&&"last-in-group",S&&"first-in-document-group",E&&"last-in-document-group",k&&"last-in-list",It&&"own",Boolean(t.views)&&"has-views",t.isEdited&&"was-edited",wt&&"has-reply",kt&&"has-menu-open",G&&!z&&"focused",Y&&"is-forwarding",t.isDeleting&&"is-deleting",q&&"is-in-document-group",St&&"is-album",t.hasUnreadMention&&"has-unread-mention",de&&"is-selected",ce&&"is-in-selection-mode",U&&!g&&"is-thread-top",Boolean(t.inlineButtons)&&"has-inline-buttons",Kt&&"is-swiped",dt,(Boolean(pe)||Xe)&&"has-active-reaction"),{text:Pn,photo:yn,video:Zn,audio:Cn,voice:Sn,document:En,sticker:Mn,contact:kn,poll:Tn,webPage:Nn,invoice:xn,location:Bn,action:Ln,game:Un}=(0,u.qp)(t),{result:jn}=function(e){const t=(0,ia.Z)((()=>e?async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:hs;return gs||await ps.promise,await gs.request({name:"detectLanguage",args:[e,t]})}(e):Promise.resolve(void 0)),[e],void 0);return t}(Be?Pn?.text:void 0),{isPending:Fn,translatedText:_n}=function(e,t,n,s){const{translateMessages:o}=(0,a.Sv)(),r=s?e?.byLangCode[s]?.[n]:void 0,{isPending:c,text:d}=r||{};return(0,i.d4)((()=>{d||c||!s||o({chatId:t,messageIds:[n],toLanguageCode:s})}),[t,d,c,n,s,o]),{isPending:c,translatedText:d}}(xe,ut,lt,Le),Dn=(0,Rn.Z)(_n,!0),qn=Fn?Dn||Pn:_n,$n=_n||Dn,{phoneCall:Hn}=Ln||{},Gn=(Se||re&&Q&&ft)&&!Rt&&"thread"===Ie&&!I,Vn=Se&&!Rt&&"thread"===Ie&&!I,zn=!s.$b&&!Hn&&!ce&&ge&&!Rt,Wn=function(e){let{hasSubheader:t,isCustomShape:n,isLastInGroup:a,asForwarded:s,hasThread:i,forceSenderName:r,hasComments:c,hasActionButton:d,hasReactions:l,isGeoLiveActive:m,withVoiceTranscription:h}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{text:g,photo:p,video:f,audio:I,voice:v,document:w,poll:b,webPage:P,contact:y,location:Z,invoice:C}=(0,u.qp)(e),S=[o.gnl],E=p||f||Z||C?.extendedMedia,M=g||"venue"===Z?.type||m,R=E&&!M,k=Boolean(e.viaBotId);return!E&&e.emojiOnlyCount?(S.push("emoji-only"),e.emojiOnlyCount<=o.L5X&&S.push(`emoji-only-${e.emojiOnlyCount}`)):M&&S.push("text"),d&&S.push("has-action-button"),n&&(S.push("custom-shape"),f?.isRound&&S.push("round"),c&&S.push("has-comments")),E?S.push("media"):I?S.push("audio"):v?(S.push("voice"),h&&S.push("with-voice-transcription")):w?S.push("document"):y?S.push("contact"):b?S.push("poll"):P&&(S.push("web-page"),(P.photo||P.video)&&S.push("media")),C&&!C.extendedMedia&&S.push("invoice"),s&&S.push("is-forwarded"),t&&S.push("has-subheader"),i&&S.push("has-replies"),l&&S.push("has-reactions"),k&&S.push("is-via-bot"),r&&S.push("force-sender-name"),n||(S.push("has-shadow"),E&&c&&S.push("has-background"),(t||s||k||!R||r)&&S.push("has-solid-background"),a&&(p||Z&&!M||!R)&&S.push("has-appendix")),S.join(" ")}(t,{hasSubheader:Bt,isCustomShape:Pt,isLastInGroup:Z,asForwarded:Ct,hasThread:bt&&!I,forceSenderName:N,hasComments:Se&&Se.messagesCount>0,hasActionButton:At||xt,hasReactions:Zt,isGeoLiveActive:"geoLive"===Bn?.type&&!(0,u.$R)(t,(0,v.bp)()),withVoiceTranscription:jt}),Xn=Wn.includes("has-appendix"),Yn=(0,u.fY)(t),Kn=(0,Ya.qo)(t.emojiOnlyCount);let Jn,Qn;Jn=Hn||Rt?"none":!Yn||Nn||yt?"standalone":"in-text",Zt?Pt||(yn||Zn)&&!Yn?Qn="outside":Ct?(Jn="standalone",Qn="inside"):Qn="inside":Qn="none",(0,An.Z)(J&&t.replyToChatId?t.replyToChatId:ut,wt?t.replyToMessageId:void 0,O,t.id),Qa(qe,lt,ut,G,V,z,X,W);const ea=Z,ta=(0,i.I4)((e=>{const t=Ge.current,n=e.target.clientHeight;if(Ge.current=n,(0,Ca.N)()||!t||n<=t)return;const a=e.target.closest(".MessageList");if(!a)return;const s=n-t,{offsetHeight:o,scrollHeight:i,scrollTop:r}=a;Math.round(i-r-o)-s<=5&&De()}),[De]),na=(0,ls.Z)(ta,[ta],300,!1);(0,Na.Z)(ea?qe:void 0,na),(0,i.d4)((()=>{const e=$e.current;Ee&&e&&(0,Xa.P)(e)&&_e({messageIds:[lt]})}),[Ee,lt,_e]);let aa,sa,oa,ra="",ca=!1;const da=(0,i.Ye)((()=>St?Ga(It,Boolean(Ct),Boolean(h),m,Je):void 0),[St,It,Ct,h,m,Je]),ua=Ct?28:0;if(!St&&(yn||Zn||xn?.extendedMedia)){let e;if(yn)e=Da(t,Ct,h,Je).width;else if(Zn)e=Zn.isRound?Te.Rj:Da(t,Ct,h,Je).width;else if(xn?.extendedMedia&&xn.extendedMedia.width&&xn.extendedMedia.height){const{width:t,height:n}=xn.extendedMedia;e=(0,Te.Kf)({width:t,height:n,fromOwnMessage:It,asForwarded:Ct,noAvatars:h,isMobile:Je}).width}e&&(e<(Gn?Ba:La)&&(oa=e),aa=Math.max(_a(Boolean(qn),Gn),e),xn?.extendedMedia&&aa-e>18&&(ca=!0))}else da&&(aa=Math.max(_a(Boolean(qn),Gn),da.containerStyle.width),aa-da.containerStyle.width>18&&(ca=!0));aa&&(ra=`width: ${aa+ua}px`,sa=aa+Yo);const ma=Q&&t.postAuthorTitle||!Ct&&mt?.postAuthorTitle||void 0,ha=(0,i.Ye)((()=>ma?Wa(ma):void 0),[ma]);function ga(e){return i.ZP.createElement(Do.Z,{message:t,translatedText:Le?$n:void 0,isForAnimation:e,emojiSize:Kn,highlight:ae,isProtected:$,observeIntersectionForLoading:d,observeIntersectionForPlaying:l,withTranslucentThumbs:Pt})}function pa(){const e=i.ZP.createElement(Ms,{message:t,isPinned:we,noReplies:w,repliesThreadInfo:Se,outgoingStatus:_,signature:ma,withReactionOffset:"inside"===Qn,availableReactions:he,isTranslated:Boolean(Le?$n:void 0),onClick:cn,onTranslationClick:dn,onOpenThread:ln});return"inside"!==Qn?e:i.ZP.createElement(jo,{activeReactions:pe,message:me,metaChildren:e,availableReactions:he,genericEffects:ie,observeIntersection:l,noRecentReactors:Q})}const fa=ee&&Ct?t.postAuthorTitle:void 0,Ia=(0,i.Ye)((()=>n?.find((e=>e.isActive))),[n]);return i.ZP.createElement("div",{ref:qe,id:(0,u.d0)(t.id),className:bn,style:ha?`--meta-safe-author-width: ${ha}px`:void 0,"data-message-id":lt,onMouseDown:Dt,onClick:qt,onContextMenu:$t,onDoubleClick:Ht,onMouseEnter:Rt?Qt:void 0,onMouseMove:zn?Vt:void 0,onMouseLeave:zn||Rt?Yt:void 0},i.ZP.createElement("div",{ref:$e,className:"bottom-marker","data-message-id":lt,"data-last-message-id":m?m.messages[m.messages.length-1].id:void 0,"data-album-main-id":m?m.mainMessage.id:void 0,"data-has-unread-mention":t.hasUnreadMention||void 0,"data-has-unread-reaction":Ee||void 0,"data-is-pinned":we||void 0}),!q&&i.ZP.createElement("div",{className:"message-select-control"},de&&i.ZP.createElement("i",{className:"icon-select"})),E&&i.ZP.createElement("div",{className:(0,at.Z)("message-select-control group-select",le&&"is-selected"),onClick:vn},le&&i.ZP.createElement("i",{className:"icon-select"})),g&&function(){const e=Ot&&(0,u.YC)(Ot.id),t=Ot&&e?Ot:void 0,n=Ot&&!e?Ot:void 0,a=!Ot&&mt?mt.hiddenUserName:void 0;return i.ZP.createElement(fs.Z,{size:Je?"small-mobile":"small",user:t,chat:n,text:a,lastSyncTime:ne,onClick:t||n?en:void 0,observeIntersection:d,animationLevel:Re,withVideo:!0})}(),i.ZP.createElement("div",{className:(0,at.Z)("message-content-wrapper",Wn.includes("text")&&"can-select-text")},i.ZP.createElement("div",{ref:He,className:Wn,style:ra,dir:"auto"},Ct&&!Et&&i.ZP.createElement("div",{className:"message-title"},Ve("ForwardedMessage"),fa&&i.ZP.createElement("span",{className:"admin-title",dir:"auto"},fa)),function(){const e=(0,at.Z)("content-inner",Ct&&"forwarded-message",Bt&&"with-subheader",ca&&"no-media-corners"),n=Z&&!Yn&&!Ct&&!Vn,a=(0,at.Z)("text-content","clearfix","in-text"===Jn&&"with-meta",_&&"with-outgoing-icon");return i.ZP.createElement("div",{className:e,onDoubleClick:Gt,dir:"auto"},function(){if(Pt&&!ht||!(p&&(!(yn||Zn||Bn)||Ae)||Ct||ht||N)||Et||wt&&Pt)return;let e,n;!Ft||Pt&&ht?mt?.hiddenUserName&&(e=mt.hiddenUserName):(e=(0,u.OU)(Ve,Ft),Ct||It||(n=`color-${(0,u.Rs)(Ft)}`));const a=Ft&&"emojiStatus"in Ft&&Ft.emojiStatus,s=Ft&&"isPremium"in Ft&&Ft.isPremium;return i.ZP.createElement("div",{className:"message-title",dir:"ltr"},e?i.ZP.createElement("span",{className:(0,at.Z)("message-title-name interactive",n),onClick:tn,dir:"ltr"},(0,On.Z)(e),!Ct&&a&&i.ZP.createElement(zt.Z,{documentId:a.documentId,loopLimit:o.y3O,observeIntersectionForLoading:d,observeIntersectionForPlaying:l}),!Ct&&!a&&s&&i.ZP.createElement(Wt.Z,null),Ft?.fakeType&&i.ZP.createElement(_o.Z,{fakeType:Ft.fakeType})):L?void 0:" ",L&&i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement("span",{className:"via"},Ve("ViaBot")),i.ZP.createElement("span",{className:"interactive",onClick:nn},(0,On.Z)(`@${L.usernames[0].username}`))),mt?.isLinkedChannelPost?i.ZP.createElement("span",{className:"admin-title",dir:"auto"},Ve("DiscussChannel")):t.forwardInfo?.postAuthorTitle&&ee&&Ct?i.ZP.createElement("span",{className:"admin-title",dir:"auto"},t.forwardInfo?.postAuthorTitle):t.postAuthorTitle&&ee&&!Ct?i.ZP.createElement("span",{className:"admin-title",dir:"auto"},t.postAuthorTitle):ke&&!Ct?i.ZP.createElement("span",{className:"admin-title",dir:"auto"},ke.customTitle||Ve(ke.isOwner?"GroupInfo.LabelOwner":"GroupInfo.LabelAdmin")):void 0)}(),Bt&&i.ZP.createElement("div",{className:"message-subheader"},Ae&&i.ZP.createElement(Vo,{topic:Ne,onClick:wn,className:"message-topic"}),wt&&i.ZP.createElement(Zs,{message:O,noUserColors:It||Q,isProtected:$,sender:F,observeIntersectionForLoading:d,observeIntersectionForPlaying:l,onClick:an})),Mn&&i.ZP.createElement(Ts,{message:t,observeIntersection:d,observeIntersectionForPlaying:l,shouldLoop:Ze,lastSyncTime:ne,shouldPlayEffect:Mn.hasEffect&&(Me.current&&lt>=Me.current||ft)||void 0,onPlayEffect:Ye,onStopEffect:Ke}),yt&&oe&&i.ZP.createElement(Fs,{customEmojiId:oe,withEffects:(0,u.YC)(ut),isOwn:It,observeIntersection:d,lastSyncTime:ne,forceLoadPreview:ft,messageId:lt,chatId:ut,activeEmojiInteractions:fe}),yt&&se&&i.ZP.createElement(Os,{emoji:se,withEffects:(0,u.YC)(ut),isOwn:It,observeIntersection:d,lastSyncTime:ne,forceLoadPreview:ft,messageId:lt,chatId:ut,activeEmojiInteractions:fe}),St&&i.ZP.createElement(So,{album:m,albumLayout:da,observeIntersection:d,isOwn:It,isProtected:$,hasCustomAppendix:n,lastSyncTime:ne,onMediaClick:rn}),Hn&&i.ZP.createElement(Oo,{message:t,phoneCall:Hn,chatId:ut}),!St&&yn&&i.ZP.createElement(zs,{message:t,observeIntersection:d,noAvatars:h,canAutoLoad:Pe,uploadProgress:D,shouldAffectAppendix:n,isDownloading:be,isProtected:$,asForwarded:Ct,theme:T,forcedWidth:oa,onClick:sn,onCancelUpload:mn}),!St&&Zn&&Zn.isRound&&i.ZP.createElement(Mo,{message:t,observeIntersection:d,canAutoLoad:Pe,lastSyncTime:ne,isDownloading:be}),!St&&Zn&&!Zn.isRound&&i.ZP.createElement(Xs,{message:t,observeIntersectionForLoading:d,observeIntersectionForPlaying:l,forcedWidth:oa,noAvatars:h,canAutoLoad:Pe,canAutoPlay:ye,uploadProgress:D,lastSyncTime:ne,isDownloading:be,isProtected:$,asForwarded:Ct,onClick:sn,onCancelUpload:mn}),(Cn||Sn)&&i.ZP.createElement(Ss.ZP,{theme:T,message:t,origin:f.Cr.Inline,uploadProgress:D,lastSyncTime:ne,isSelectable:q,isSelected:de,noAvatars:h,onPlay:on,onReadMedia:!Sn||It&&!K?void 0:un,onCancelUpload:mn,isDownloading:be,isTranscribing:M,isTranscriptionHidden:ze,isTranscribed:Boolean(R),isTranscriptionError:gt,canDownload:!$,onHideTranscription:We,canTranscribe:y}),En&&i.ZP.createElement(Cs.Z,{message:t,observeIntersection:d,canAutoLoad:Pe,autoLoadFileMaxSizeMb:Ce,uploadProgress:D,isSelectable:q,isSelected:de,onMediaClick:sn,onCancelUpload:mn,isDownloading:be}),kn&&i.ZP.createElement(Ks,{contact:kn}),Tn&&i.ZP.createElement(oo,{message:t,poll:Tn,onSendVote:hn}),Un&&i.ZP.createElement(Po,{message:t,canAutoLoadMedia:Pe,lastSyncTime:ne}),xn?.extendedMedia&&i.ZP.createElement(ho,{message:t,lastSyncTime:ne}),jt&&i.ZP.createElement("p",{className:(0,at.Z)("transcription",!ze&&gt&&"transcription-error"),dir:"auto"},gt?Ve("NoWordsRecognized"):M&&R?i.ZP.createElement(Fo.Z,{content:R}):R),!yt&&Yn&&i.ZP.createElement("div",{className:a,dir:"auto"},ga(),Fn&&i.ZP.createElement("div",{className:"translation-animation"},i.ZP.createElement("div",{className:"text-loading"},ga(!0))),"in-text"===Jn&&pa()),Nn&&i.ZP.createElement(co,{message:t,observeIntersection:d,noAvatars:h,canAutoLoad:Pe,canAutoPlay:ye,asForwarded:Ct,lastSyncTime:ne,isDownloading:be,isProtected:$,theme:T,onMediaClick:sn,onCancelMediaTransfer:mn}),xn&&!xn.extendedMedia&&i.ZP.createElement(uo,{message:t,shouldAffectAppendix:n,isInSelectMode:ce,isSelected:de,theme:T,forcedWidth:oa}),Bn&&i.ZP.createElement(bo,{message:t,lastSyncTime:ne,isInSelectMode:ce,isSelected:de,theme:T,peer:A}))}(),!Rt&&"standalone"===Jn&&pa(),Nt&&At?i.ZP.createElement(_t.Z,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:Ve("lng_context_forward_msg"),onClick:E?gn:pn},i.ZP.createElement("i",{className:"icon-share-filled"})):Nt&&xt?i.ZP.createElement(_t.Z,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:"Focus message",onClick:ve?fn:In},i.ZP.createElement("i",{className:"icon-arrow-right"})):void 0,Vn&&i.ZP.createElement(ko,{threadInfo:Se,disabled:I}),Xn&&i.ZP.createElement("div",{className:"svg-appendix",dangerouslySetInnerHTML:It?zo:Wo}),zn&&i.ZP.createElement("div",{className:(0,at.Z)("quick-reaction",Jt&&!pe&&"visible"),onClick:Xt},i.ZP.createElement(No.Z,{reaction:ge,size:Xo,availableReactions:he,observeIntersection:l}))),t.inlineButtons&&i.ZP.createElement(Ro,{message:t,onClick:Oe}),"outside"===Qn&&i.ZP.createElement(jo,{message:me,isOutside:!0,maxWidth:sa,activeReactions:pe,availableReactions:he,genericEffects:ie,observeIntersection:l,noRecentReactors:Q})),et&&i.ZP.createElement(vs,{isOpen:Qe,anchor:et,message:t,album:m,chatUsername:Ia?.username,messageListType:Ie,onClose:st,onCloseAnimationEnd:ot,repliesThreadInfo:Se,noReplies:w,detectedLanguage:jn}))}))),Jo=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,wt.Z)(it.gl.Extra,"AboutAdsModal",!t);return n?i.ZP.createElement(n,e):void 0})),Qo=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,wt.Z)(it.gl.Extra,"SponsoredMessageContextMenuContainer",!t);return n?i.ZP.createElement(n,e):void 0})),ei=(0,i.X$)((0,a.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,d.fS)(e,n),{chatId:s,isBot:o}=a||{};return{message:a,bot:s&&o?(0,d.dy)(e,s):void 0,channel:!o&&s?(0,d.Z1)(e,s):void 0}}))((e=>{let{chatId:t,message:n,containerRef:o,bot:r,channel:c}=e;const{viewSponsoredMessage:d,openChat:l,openChatByInvite:m,startBot:h,focusMessage:g}=(0,a.Sv)(),p=(0,Tt.Z)(),f=(0,i.sO)(null),I=(0,i.sO)(null),v=Boolean(n),{observe:w}=(0,Aa.S1)({rootRef:o,debounceMs:200,threshold:1}),{isContextMenuOpen:b,contextMenuPosition:P,handleBeforeContextMenu:y,handleContextMenu:Z,handleContextMenuClose:C,handleContextMenuHide:S}=(0,la.Z)(f,s.$b,!0,s.wZ),[E,M,R]=(0,Mt.Z)(!1);(0,i.d4)((()=>v?w(I.current,(e=>{e.isIntersecting&&d({chatId:t})})):void 0),[t,v,w,d]);const k=(0,i.I4)((()=>{n&&(n.chatInviteHash?m({hash:n.chatInviteHash}):n.channelPostId?g({chatId:n.chatId,messageId:n.channelPostId}):(l({id:n.chatId}),n.startParam&&h({botId:n.chatId,param:n.startParam})))}),[g,n,l,m,h]);if(n)return i.ZP.createElement("div",{ref:f,key:"sponsored-message",className:"SponsoredMessage Message open",onMouseDown:e=>{(0,ya.q)(e),y(e)},onContextMenu:Z},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,On.Z)((0,u.Js)(r)||""),c&&(0,On.Z)(n.chatInviteTitle||(0,u.U)(p,c)||"")),i.ZP.createElement("div",{className:"text-content with-meta",dir:"auto",ref:I},i.ZP.createElement("span",{className:"text-content-inner",dir:"auto"},(0,Js.H)(n.text.text,n.text.entities)),i.ZP.createElement("span",{className:"MessageMeta",dir:"ltr"},i.ZP.createElement("span",{className:"message-signature"},n.isRecommended?p("Message.RecommendedLabel"):p("SponsoredMessage")))),i.ZP.createElement(_t.Z,{color:"secondary",size:"tiny",ripple:!0,onClick:k,className:"SponsoredMessage__button"},p(n.isBot?"Conversation.ViewBot":n.channelPostId?"Conversation.ViewPost":"Conversation.ViewChannel")))),P&&i.ZP.createElement(Qo,{isOpen:b,anchor:P,message:n,onAboutAds:M,onClose:C,onCloseAnimationEnd:S}),i.ZP.createElement(Jo,{isOpen:E,onClose:R}))}))),ti=(0,i.X$)((e=>{let{isCurrentUserPremium:t,chatId:n,threadId:c,messageIds:d,messageGroups:l,isViewportNewest:m,isUnread:h,isComments:g,withUsers:p,isChannelChat:v,noAvatars:w,containerRef:b,anchorIdRef:P,memoUnreadDividerBeforeIdRef:y,memoFirstUnreadIdRef:Z,type:S,isReady:E,isScrollingRef:M,isScrollPatchNeededRef:R,threadTopMessageId:k,hasLinkedChat:T,isSchedule:N,noAppearanceAnimation:x,onFabToggle:B,onNotchToggle:L,onPinnedIntersectionChange:U}=e;const{openHistoryCalendar:j}=(0,a.Sv)(),{observeIntersectionForReading:O,observeIntersectionForLoading:F,observeIntersectionForPlaying:_}=function(e,t,n,s){const{markMessageListRead:o,markMentionsRead:i,animateUnreadReaction:r}=(0,a.Sv)(),{isMobile:c}=(0,C.ZP)(),d=c?300:500,{observe:l,freeze:u,unfreeze:m}=(0,Aa.S1)({rootRef:t,throttleMs:150},(t=>{if("thread"!==e)return;let a=0;const c=[],d=[],l=[],u=[];let m=!1;t.forEach((e=>{const{isIntersecting:t,target:n,boundingClientRect:s,rootBounds:o}=e,{dataset:i}=n,r=Number(i.lastMessageId||i.messageId),h=i.albumMainId?Number(i.albumMainId):void 0;t?(r>a&&(a=r),i.hasUnreadMention&&c.push(r),i.hasUnreadReaction&&d.push(r),i.isPinned&&l.push(h||r)):i.isPinned&&(o&&s.bottom<o.top&&(m=!0),u.push(h||r))})),n.current&&a>=n.current&&o({maxId:a}),c.length&&i({messageIds:c}),d.length&&r({messageIds:d}),(l.length||u.length)&&s({viewportPinnedIdsToAdd:l,viewportPinnedIdsToRemove:u,isReversed:m})}));(0,ct.Z)(u,m);const{observe:h}=(0,Aa.S1)({rootRef:t,throttleMs:xa,margin:d}),{observe:g}=(0,Aa.S1)({rootRef:t,throttleMs:xa});return{observeIntersectionForReading:l,observeIntersectionForLoading:h,observeIntersectionForPlaying:g}}(S,b,Z,U),{backwardsTriggerRef:D,forwardsTriggerRef:q,fabTriggerRef:$}=function(e,t,n,r,c,d,l,u,m,h){const{loadViewportMessages:g}=(0,a.Sv)(),[p,I]=(0,i.Ye)((()=>"thread"===e?[(0,A.Ds)((()=>g({direction:f.Uq.Backwards})),1e3,!0,!1),(0,A.Ds)((()=>g({direction:f.Uq.Forwards})),1e3,!0,!1)]:[]),[g,n]),v=(0,i.sO)(null),w=(0,i.sO)(null),b=(0,i.sO)(null);function P(){if(!u)return;if(!n||!n.length)return d(!1),void l(!1);if(!r)return d(!0),void l(!0);if(!t.current)return;const{offsetHeight:e,scrollHeight:a,scrollTop:s}=t.current,o=Math.round(a-s-e),i=o<=1;0!==a&&(d(c?!i:!(o<=50)),l(!i))}const{observe:y}=(0,Aa.S1)({rootRef:t,margin:s.gZ},(e=>{if(!I||!p)return;if(n[0]>o.MPN)return;const t=e.find((e=>{let{isIntersecting:t}=e;return t}));if(!t)return;const{target:a}=t;"backwards-trigger"===a.className?(s.i4&&m.current&&n.length<=o.hT6&&(h.current=!0),p()):"forwards-trigger"===a.className&&I()}));(0,Aa._N)(v,y),(0,Aa._N)(w,y);const{observe:Z,freeze:C,unfreeze:S}=(0,Aa.S1)({rootRef:t,margin:100},P);(0,Aa._N)(b,Z);const{observe:E,freeze:M,unfreeze:R}=(0,Aa.S1)({rootRef:t,margin:1},P);(0,Aa._N)(b,E);const k=(0,i.sO)();return k.current=P,(0,lt.Z)((()=>{u&&k.current()}),[u]),(0,lt.Z)((()=>{C(),M(),setTimeout((()=>{R(),S()}),250)}),[C,M,n,S,R]),{backwardsTriggerRef:v,forwardsTriggerRef:w,fabTriggerRef:b}}(S,b,d,m,h,B,L,E,M,R),H=(0,Tt.Z)(),G=i.ZP.createElement("div",{className:(0,at.Z)("unread-divider","local-action-message"),key:"unread-messages"},i.ZP.createElement("span",null,H("UnreadMessages"))),V=x?0:l.reduce(((e,t)=>e+t.senderGroups.flat().length),0);let z=0;const W=l.map(((e,t,n)=>{const a=e.senderGroups.map(((e,a,s)=>{if(1===e.length&&!ba(e[0])&&(0,u.FT)(e[0])&&!e[0].content.action?.phoneCall){const o=e[0],d=a===s.length-1&&t===n.length-1;return(0,I.oA)([o.id===y.current&&G,i.ZP.createElement(ys,{key:o.id,message:o,threadId:c,messageListType:S,isInsideTopic:Boolean(c&&c!==r._f),observeIntersectionForReading:O,observeIntersectionForLoading:F,observeIntersectionForPlaying:_,memoFirstUnreadIdRef:Z,appearanceOrder:V-++z,isLastInList:d,onPinnedIntersectionChange:U})])}let o;return e.map(((d,l)=>{const m=ba(d)?d.mainMessage:d,h=ba(d)?d:void 0,f=(0,u.B4)(m),b=ba(d),C=e[l+1];m.previousLocalId&&P.current===(0,u.d0)(m.previousLocalId)&&(P.current=(0,u.d0)(m.id));const E=!b&&m.groupedId?m.groupedId:void 0,M=C&&!ba(C)?C.groupedId:void 0,R={isFirstInGroup:0===l,isLastInGroup:l===e.length-1,isFirstInDocumentGroup:Boolean(E&&E!==o),isLastInDocumentGroup:Boolean(E&&E!==M),isLastInList:l===e.length-1&&a===s.length-1&&t===n.length-1};o=E;const N=(0,u.KK)(m),A=(0,u.jM)(m)?`${m.date}_${N}`:N,x=!1===T||!v,B=m.id===k;return(0,I.oA)([m.id===y.current&&G,i.ZP.createElement(Ko,{key:A,message:m,observeIntersectionForBottom:O,observeIntersectionForLoading:F,observeIntersectionForPlaying:_,album:h,noAvatars:w,withAvatar:R.isLastInGroup&&p&&!f&&(!B||!g),withSenderName:R.isFirstInGroup&&p&&!f,threadId:c,messageListType:S,noComments:x,noReplies:!x||c!==r._f,appearanceOrder:V-++z,isFirstInGroup:R.isFirstInGroup,isLastInGroup:R.isLastInGroup,isFirstInDocumentGroup:R.isFirstInDocumentGroup,isLastInDocumentGroup:R.isLastInDocumentGroup,isLastInList:R.isLastInList,memoFirstUnreadIdRef:Z,onPinnedIntersectionChange:U}),m.id===k&&i.ZP.createElement("div",{className:"local-action-message",key:"discussion-started"},i.ZP.createElement("span",null,H("DiscussionStarted")))])})).flat()}));return i.ZP.createElement("div",{className:"message-date-group",key:e.datetime,onMouseDown:ya.q,teactFastList:!0},i.ZP.createElement("div",{className:(0,at.Z)("sticky-date",!N&&"interactive"),key:"date-header",onMouseDown:ya.q,onClick:N?void 0:()=>j({selectedAt:e.datetime})},i.ZP.createElement("span",{dir:"auto"},N&&e.originalDate===o.t4X&&H("MessageScheduledUntilOnline"),N&&e.originalDate!==o.t4X&&H("MessageScheduledOn",(0,re.j1)(H,e.datetime,void 0,!0)),!N&&(0,re.j1)(H,e.datetime))),a.flat())}));return i.ZP.createElement("div",{className:"messages-container",teactFastList:!0},i.ZP.createElement("div",{ref:D,key:"backwards-trigger",className:"backwards-trigger"}),W.flat(),!t&&m&&i.ZP.createElement(ei,{key:n,chatId:n,containerRef:b}),i.ZP.createElement("div",{ref:q,key:"forwards-trigger",className:"forwards-trigger"}),i.ZP.createElement("div",{ref:$,key:"fab-trigger",className:"fab-trigger"}))}));var ni=n(73547);const ai=(0,i.X$)((0,a.c$)(((e,t)=>{let{userId:n}=t;const{stickers:a}=e.stickers.greeting,s=(0,u.db)(n)+(0,u.db)(e.currentUserId),o=a?.length?a[s%a.length]:void 0,i=(0,d.Z1)(e,n);return i?{sticker:o,lastUnreadMessageId:i.lastMessage&&i.lastMessage.id!==i.lastReadInboxMessageId?i.lastMessage.id:void 0,connectionState:e.connectionState}:{}}))((e=>{let{sticker:t,connectionState:n,lastUnreadMessageId:s}=e;const{loadGreetingStickers:o,sendMessage:r,markMessageListRead:c}=(0,a.Sv)(),d=(0,Tt.Z)(),l=(0,i.sO)(null),{observe:u}=(0,Aa.S1)({rootRef:l,debounceMs:200});(0,i.d4)((()=>{t||"connectionStateReady"!==n||o()}),[n,o,t]),(0,i.d4)((()=>{"connectionStateReady"===n&&s&&c({maxId:s})}),[n,c,s]);const m=(0,i.I4)((e=>{e={...e,isPreloadedGlobally:!0},r({sticker:e})}),[r]);return i.ZP.createElement("div",{className:"ContactGreeting",ref:l},i.ZP.createElement("div",{className:"wrapper"},i.ZP.createElement("p",{className:"title",dir:"auto"},d("Conversation.EmptyPlaceholder")),i.ZP.createElement("p",{className:"description",dir:"auto"},d("Conversation.GreetingText")),i.ZP.createElement("div",{className:"sticker"},t&&i.ZP.createElement(ni.Z,{sticker:t,onClick:m,clickArg:t,observeIntersection:u,size:160,className:"large",noContextMenu:!0,isCurrentUserPremium:!0}))))}))),si=3*Te.Gw,oi=(0,i.X$)((e=>{let{isChatWithSelf:t,type:n,isGroupChatJustCreated:a,topic:s}=e;const o=(0,Tt.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 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($o.Z,{topic:t,size:si,className:"icon topic-icon"}),i.ZP.createElement("h3",{className:"title"},e("Chat.EmptyTopicPlaceholder.Title")),i.ZP.createElement("p",{className:"description topic-description"},(0,On.Z)(e("Chat.EmptyTopicPlaceholder.Text"),["br"]))))}(o,s):i.ZP.createElement("div",{className:"empty"},i.ZP.createElement("span",null,o("NoMessages")))})),ii=(0,A.Ds)((e=>e()),200,!1),ri=(0,i.X$)((0,a.c$)(((e,t)=>{let{chatId:n,threadId:a,type:s}=t;const o=(0,d.Z1)(e,n);if(!o)return{};const i=(0,d.$W)(e,n,a,s),c="scheduled"===s?(0,d.yB)(e,n):(0,d.Zw)(e,n),l=(0,d.qS)(e,n,a),m=(0,d.tZ)(e,n,a);if(!(a===r._f||o?.isForum||c&&l&&c[l]))return{};const{isRestricted:h,restrictionReason:g,lastMessage:p}=o,f=(0,d.G$)(e,n),I=a===r._f&&!i&&!o.unreadCount&&!f&&p&&!p.groupedId,v=(0,d.IK)(e,n);let w,b=!1;(0,d.pk)(e,n)&&(v.fullInfo?w=v.fullInfo.botInfo:b=!0);const P=o.topics?.[a];return{isCurrentUserPremium:(0,d.wV)(e),isChatLoaded:!0,isRestricted:h,restrictionReason:g,isChannelChat:(0,u.eA)(o),isGroupChat:(0,u.Bf)(o),isCreator:o.isCreator,isChatWithSelf:(0,d.FM)(e,n),isRepliesChat:(0,u.pK)(n),isBot:Boolean(v),messageIds:i,messagesById:c,isComments:Boolean(m?.originChannelId),firstUnreadId:(0,d.It)(e,n,a),isViewportNewest:"thread"!==s||(0,d.b9)(e,n,a),threadFirstMessageId:(0,d.yZ)(e,n,a),focusingId:f,isSelectModeActive:(0,d.CA)(e),isLoadingBotInfo:b,botInfo:w,threadTopMessageId:l,hasLinkedChat:o.fullInfo&&"linkedChatId"in o.fullInfo?Boolean(o.fullInfo.linkedChatId):void 0,lastSyncTime:e.lastSyncTime,topic:P,...I&&{lastMessage:p}}}))((e=>{let{chatId:t,threadId:n,type:c,hasTools:l,onFabToggle:m,onNotchToggle:h,isCurrentUserPremium:g,isChatLoaded:p,isChannelChat:v,isGroupChat:w,canPost:b,isReady:P,isChatWithSelf:y,isRepliesChat:Z,isCreator:C,isBot:S,messageIds:E,messagesById:M,firstUnreadId:R,isComments:k,isViewportNewest:T,threadFirstMessageId:N,isRestricted:x,restrictionReason:B,focusingId:L,isSelectModeActive:U,lastMessage:j,isLoadingBotInfo:O,botInfo:F,threadTopMessageId:_,hasLinkedChat:D,lastSyncTime:q,withBottomShift:$,withDefaultBg:H,topic:G,onPinnedIntersectionChange:V,getForceNextPinnedInHeader:z}=e;const{loadViewportMessages:W,setScrollOffset:X,loadSponsoredMessages:Y,loadMessageReactions:K,copyMessagesByIds:J,loadMessageViews:Q}=(0,a.Sv)(),ee=(0,i.sO)(null),te=(0,i.sO)("thread"===c&&(0,d.Vt)((0,a.Rd)(),t,n)||(0,d.T6)((0,a.Rd)(),t,n)||0),ne=(0,i.sO)(),ae=(0,i.sO)(),se=(0,i.sO)(),oe=(0,i.sO)(),ie=(0,i.sO)(),re=(0,i.sO)(),ce=(0,i.sO)(!1),de=(0,i.sO)(Boolean(j)),[le,ue]=(0,i.eJ)(),me=(0,Xt.Z)(F?.photo?(0,u.NF)(F.photo):void 0),he=(0,Xt.Z)(F?.gif?(0,u.ym)(F.gif):void 0),ge=F?.photo?(0,u.bV)(F.photo):F?.gif?(0,u.jC)(F.gif):void 0,pe=ge&&{width:ge.width/s.cL,height:ge.height/s.cL},fe=Boolean(E);(0,lt.Z)((()=>{fe&&(0,A.R3)((()=>{de.current=!1}))}),[fe]),(0,lt.Z)((()=>{oe.current=R}),[R]),(0,i.d4)((()=>{!g&&v&&P&&q&&Y({chatId:t})}),[g,t,P,v,q,Y]),(0,lt.Z)((()=>{fe&&(ie.current=oe.current)}),[fe]),(0,lt.Z)((()=>{re.current=L}),[L]),(e=>{(0,Rt.y)({"Mod+C":function(t){const n=(0,ka.Z)();n&&n.length>1&&(t.preventDefault(),e({messageIds:n}))}})})(J);const Ie=(0,i.Ye)((()=>{if(!E||!M)return;const e=!_||N===_||E[0]&&N!==E[0]?E:[_,...E];if(!e.length)return;const t=e.map((e=>M[e])).filter(Boolean),n="scheduled"===c?["date","id"]:["id"];return t.length?Pa((0,I.Xo)(t,n),ie.current):void 0}),[E,M,N,_,c]);(0,It.Z)((()=>{if(!E||!M)return;const e=E.filter((e=>M[e]?.reactions));e.length&&K({chatId:t,ids:e})}),15e3),(0,It.Z)((()=>{if(!E||!M||n!==r._f)return;const e=E.filter((e=>M[e]?.repliesThreadInfo?.isComments));e.length&&Q({chatId:t,ids:e})}),15e3);const ve=(0,i.Ye)((()=>{if("thread"===c)return(0,A.Ds)((()=>W({direction:f.Uq.Around})),1e3,!0,!1)}),[W,E]),{isScrolled:we,updateStickyDates:be}=function(){const[e,t]=(0,Mt.Z)(!1),n=(0,Sa.Z)(Ea,!0);return{isScrolled:e,updateStickyDates:(0,i.I4)(((e,a)=>{t(),document.body.classList.contains("is-scrolling-messages")||(0,A.T2)((()=>{document.body.classList.add("is-scrolling-messages")})),n((()=>{(0,A.T2)((()=>{const t=document.querySelector(".stuck");t&&t.classList.remove("stuck");const n=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?Ra:Ma)}))}(e,a);n&&n.classList.add("stuck"),document.body.classList.remove("is-scrolling-messages")}))}))}),[t,n])}}(),Pe=(0,i.sO)(),ye=(0,i.sO)(),Ze=(0,i.I4)((()=>{if(ce.current)return void(ce.current=!1);const e=ee.current;e&&(Pe.current=!0,re.current||be(e,l),ii((()=>{const s=(0,a.Rd)();z()&&!(0,d.jU)(s).focusedMessage?.chatId&&V({hasScrolled:!0}),Pe.current=!1,(0,A.T2)((()=>{e.parentElement&&(te.current=e.scrollHeight-e.scrollTop,"thread"===c&&X({chatId:t,threadId:n,scrollOffset:te.current}))}))})))}),[be,l,z,V,c,t,n]),Ce=(0,i.I4)((e=>{ue(e.contentRect.height)}),[]);(0,Na.Z)(ee,Ce);const{height:Se}=(0,En.Z)();(0,i.d4)((()=>{ee.current.dataset.normalHeight=String(ee.current.offsetHeight)}),[Se,b]),(0,i.d4)((()=>{if(!ve||!p||x||L)return;if(E&&E[E.length-1]>o.MPN)return;const e=ee.current;(!E||E.length<o.hT6/2&&e.firstElementChild.clientHeight<=e.offsetHeight)&&ve()}),[p,E,ve,L,x]),(0,lt.Z)((()=>{if(!E||!se.current)return;const e=se.current.filter((e=>E.includes(Number(e.dataset.messageId)))),t=e[1]||e[0];t&&(ne.current=t.id,ae.current=t.getBoundingClientRect().top)}),[E,T,le,l]),Ta((e=>{let[t,n,a]=e;const s=ee.current;se.current=Array.from(s.querySelectorAll(".message-list-item"));const i=E&&t&&E[E.length-1]!==t[t.length-1],r=E?.[0]!==t?.[0]&&E?.length===o.hT6/2+1,c=i&&!r,d=E&&re.current===E[E.length-1],u=T&&c&&E&&E.length<o.hT6/2&&!s.parentElement.classList.contains("force-messages-scroll")&&s.firstElementChild.clientHeight<=2*s.offsetHeight;u&&(s.parentElement.classList.add("force-messages-scroll"),setTimeout((()=>{s.parentElement&&s.parentElement.classList.remove("force-messages-scroll")}),500));const{scrollTop:m,scrollHeight:h,offsetHeight:g}=s,p=te.current,f=se.current[se.current.length-1];let I=p-(a||g);c&&(I-=f?f.offsetHeight:0);const v=T&&n&&I<=50;let w;if(c&&v&&!d&&(f&&(0,A.T2)((()=>{(0,Ca.Z)(s,f,"end",20)})),w=h-g,te.current=Math.max(Math.ceil(h-w),g),!u))return;const b=void 0!==a&&a!==le,P=ne.current&&s.querySelector(`#${ne.current}`),y=!P&&ie.current&&s.querySelector(".unread-divider");if(v&&b){if((0,Ca.N)())return;w=h-g}else P?(ye.current&&(ye.current=!1,(0,Za.z)(s)),w=m+(P.getBoundingClientRect().top-(ae.current||0))):w=y?Math.min(y.offsetTop-(l?60:10),h-p):h-p;(0,Za.Z)(s,Math.ceil(w)),re.current||(ce.current=!0,(0,A.T2)((()=>{ce.current=!1}))),te.current=Math.max(Math.ceil(h-w),g)}),[E,T,le,l]),(0,rt.Z)((e=>{let[t]=e;void 0!==t&&(0,ft.YW)(200+o.fK3)}),[U]);const Ee=(0,Tt.Z)(),Me=Boolean(t&&(0,u.YC)(t)),Re=Boolean(!Me&&!v||y||Z),ke=Boolean(!Re||v),Te=(0,u.YC)(t)&&!y&&!S&&(!Ie&&!j&&E&&(!se.current||0===se.current.length)||1===E?.length&&"contactSignUp"===M?.[E[0]]?.content.action?.type||"contactSignUp"===j?.content?.action?.type),Ne=w&&C&&1===E?.length&&"chatCreate"===M?.[E[0]]?.content.action?.type,Ae=1===E?.length&&"topicCreate"===M?.[E[0]]?.content.action?.type,xe=F&&!F.description&&!F.gif&&!F.photo,Be=(0,at.Z)("MessageList custom-scroll",ke&&"no-avatars",!b&&"no-composer","pinned"===c&&"type-pinned",$&&"with-bottom-shift",H&&"with-default-bg",U&&"select-mode-active",we&&"scrolled",!P&&"is-animating");return i.ZP.createElement("div",{ref:ee,className:Be,onScroll:Ze,onMouseDown:ya.q},x?i.ZP.createElement("div",{className:"empty"},i.ZP.createElement("span",null,B?B.text:"This is a private "+(v?"channel":"chat"))):F?i.ZP.createElement("div",{className:"empty"},O&&i.ZP.createElement("span",null,Ee("Loading")),xe&&!O&&i.ZP.createElement("span",null,Ee("NoMessages")),F&&i.ZP.createElement("div",{className:"bot-info",style:pe&&`width: ${pe.width}px`},me&&i.ZP.createElement("img",{src:me,width:pe?.width,height:pe?.height,alt:"Bot info"}),he&&i.ZP.createElement(Ws.Z,{canPlay:!0,src:he,loop:!0,disablePictureInPicture:!0,muted:!0,playsInline:!0}),ge&&!me&&!he&&i.ZP.createElement(lo.Z,{width:pe?.width,height:pe?.height}),F.description&&i.ZP.createElement("div",{className:"bot-info-description"},i.ZP.createElement("p",{className:"bot-info-title"},Ee("BotInfoTitle")),(0,On.Z)(F.description,["br","emoji","links"])))):Te?i.ZP.createElement(ai,{userId:t}):E&&(!Ie||Ne||Ae)?i.ZP.createElement(oi,{chatId:t,topic:G,type:c,isChatWithSelf:y,isGroupChatJustCreated:Ne}):E&&Ie||j?i.ZP.createElement(ti,{isCurrentUserPremium:g,chatId:t,isComments:k,isChannelChat:v,messageIds:E||[j.id],messageGroups:Ie||Pa([j]),isViewportNewest:Boolean(T),isUnread:Boolean(R),withUsers:Re,noAvatars:ke,containerRef:ee,anchorIdRef:ne,memoUnreadDividerBeforeIdRef:ie,memoFirstUnreadIdRef:oe,threadId:n,type:c,isReady:P,isScrollingRef:Pe,isScrollPatchNeededRef:ye,threadTopMessageId:_,hasLinkedChat:D,isSchedule:!!Ie&&"scheduled"===c,noAppearanceAnimation:!Ie||!de.current,onFabToggle:m,onNotchToggle:h,onPinnedIntersectionChange:V}):i.ZP.createElement(cn.Z,{color:"white",backgroundColor:"dark"}))}))),ci=(0,i.X$)((e=>{let{icon:t,ariaLabelLang:n,unreadCount:a,onClick:s,onReadAll:o,className:r}=e;const c=(0,Tt.Z)(),d=(0,i.sO)(null),{isContextMenuOpen:l,handleContextMenu:u,handleContextMenuClose:m,handleContextMenuHide:h}=(0,la.Z)(d,!o);return i.ZP.createElement("div",{className:(0,at.Z)("KboxtoWkfx23zfklH_Zg",r),ref:d},i.ZP.createElement(_t.Z,{color:"secondary",round:!0,className:"sgkkv3bmIMAZS9G9BHUz",onClick:s,onContextMenu:u,ariaLabel:c(n)},i.ZP.createElement("i",{className:(0,at.Z)("AafG9_xBi_2eJ_bFNnNg",`icon-${t}`)})),Boolean(a)&&i.ZP.createElement("div",{className:"yKN1kQ3YXf4SHHIBcotS"},(0,Pt.bi)(a)),o&&i.ZP.createElement(un.Z,{isOpen:l,onClose:m,onCloseAnimationEnd:h,autoClose:!0,positionX:"right",positionY:"bottom"},i.ZP.createElement(Ft.Z,{icon:"readchats",onClick:o},c("MarkAllAsRead"))))})),di="EcdaljLbQ7DJN9gbQpSC",li=(0,i.X$)((0,a.c$)((e=>{const t=(0,d.Bt)(e);if(!t)return{};const{chatId:n,threadId:a,type:s}=t,o=(0,d.Z1)(e,n),i=o&&a===r._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 P=(0,i.I4)((()=>{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,Ca.Z)(e,n,"end",20)}}),[t,s,u]),y=(0,at.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:y},i.ZP.createElement(ci,{icon:"heart-outline",ariaLabelLang:"AccDescrReactionMentionDown",onClick:m,onReadAll:f,unreadCount:c,className:(0,at.Z)("wHTB_MNtk9J6I3F_4eVE",!w&&di,!b&&"uHEtFnXb6pb14Jf0EsDr")}),i.ZP.createElement(ci,{icon:"mention",ariaLabelLang:"AccDescrMentionDown",onClick:h,onReadAll:p,unreadCount:d,className:!b&&di}),i.ZP.createElement(ci,{icon:"arrow-down",ariaLabelLang:"AccDescrPageDown",onClick:P,unreadCount:r,className:"Hoi4yrJrfBHTmvB8TPce"}))})));var ui=n(65723);const mi=1280,hi=20,gi=/\.[^/.]+$/;async function pi(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,Sn.pt)(s),{width:r,height:d}=n;u=!Ii(r,d);const m=Math.max(r,d)>mi,h=i===o.s11;if(!u){if(!a?.compressedBlobUrl&&!h&&(m||"image/jpeg"!==i)){const n=await aa(s,m?mi/Math.max(r,d):1,"image/jpeg");return URL.revokeObjectURL(s),pi(e,t,{compressedBlobUrl:n})}"image/jpeg"===i&&(e=e.replace(gi,".jpg")),c={width:r,height:d}}l=s}else if(o.wGh.has(i)){const{videoWidth:e,videoHeight:t,duration:n}=await(0,Sn.jj)(s);u=!Ii(e,t),u||(c={width:e,height:t,duration:n}),l=await(0,Sn.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 fi(e,t){return e.map((e=>t?e.compressedBlobUrl?{...e,blobUrl:e.compressedBlobUrl}:e:{...e,shouldSendAsFile:!e.voice||void 0,shouldSendAsSpoiler:void 0}))}function Ii(e,t){return Math.max(e,t)/Math.min(e,t)<=hi}var vi=n(41098),wi=n(96391);let bi;function Pi(e){bi.focus(),e.focus()}s.cj&&(bi=document.createElement("input"),bi.classList.add("for-ios-autocapitalization-fix"),document.body.appendChild(bi));var yi=n(74288),Zi=n(94462),Ci=n(33681),Si=n(52400),Ei=n(71790);const Mi=new RegExp(`^${o.t8f.source}$`,"g");var Ri=n(56389);const ki=new URL(n(68973),n.b).href,Ti=1e3,Ni={encoderPath:ki,reuseWorker:!0},Ai={type:"audio/ogg"},xi=64,Bi=.1;let Li,Ui,ji;async function Oi(){return Li||(Li=n.e(1161).then(n.t.bind(n,1161,23)),Ui=(await Li).default,ji=new Ui(Ni)),Li}async function Fi(e){await async function(){await Oi(),await ji.start()}();const t=Date.now();let n;const a=[],s=[];ji.ondataavailable=e=>{a.push(e)};const o=function(t,n){const a=t.sourceNode,o=a.context.createAnalyser();o.fftSize=xi,a.connect(o);const i=o.frequencyBinCount,r=new Uint8Array(i);let c=!1;return function t(){if(c)return;o.getByteFrequencyData(r);const n=r.reduce(((e,t)=>e+t),0)/i/255;(t=>{s.push(255*t),e(t)})(n<Bi?0:n),requestAnimationFrame(t)}(),()=>{c=!0}}(ji);return{stop:()=>new Promise(((e,i)=>{ji.onstop=()=>{e({blob:new Blob(a,Ai),duration:Math.round(((n||Date.now())-t)/1e3),waveform:s})},ji.onerror=i;const r=Math.max(0,t+Ti-Date.now());setTimeout((()=>{ji.stop(),o()}),r)})),pause:()=>{const e=Math.max(0,t+Ti-Date.now());setTimeout((()=>{ji.pause(),n=Date.now(),o()}),e)}}}var _i=n(21262);const Di=/id="docs-internal-guid/i,qi={BOLD:"700",ITALIC:"italic",UNDERLINE:"underline",STRIKETHROUGH:"line-through",SUPERSCRIPT:"super",SUBSCRIPT:"sub"},$i={ANCHOR:"a",BOLD:"strong",ITALIC:"em",UNDERLINE:"u",STRIKETHROUGH:"del",SUPERSCRIPT:"sup",SUBSCRIPT:"sub"},Hi=["H1","H2","H3","H4","H5","H6"];function Gi(e){return(new DOMParser).parseFromString(e,"text/html").body}function Vi(e,t){const n=document.createElement($i.ANCHOR);return n.href=t,n.appendChild(e.cloneNode(!0)),n}function zi(e,t){const n=document.createElement(t);return n.appendChild(e.cloneNode(!0)),n}function Wi(e,t){let n=t.cloneNode(!0);return e?(e.style&&e.style.fontWeight===qi.BOLD&&(n=zi(n,$i.BOLD)),e.style&&e.style.fontStyle===qi.ITALIC&&(n=zi(n,$i.ITALIC)),e.style&&e.style.textDecoration===qi.UNDERLINE&&(n=zi(n,$i.UNDERLINE)),e.style&&e.style.textDecoration===qi.STRIKETHROUGH&&(n=zi(n,$i.STRIKETHROUGH)),e.style&&e.style.verticalAlign===qi.SUPERSCRIPT&&(n=zi(n,$i.SUPERSCRIPT)),e.style&&e.style.verticalAlign===qi.SUBSCRIPT&&(n=zi(n,$i.SUBSCRIPT)),n):n}function Xi(e){const t=e.cloneNode(!0);let n=document.createTextNode(t.textContent||""),a=t;return"A"===t.nodeName&&(n=Vi(n,t.href),"style"in t.childNodes[0]&&Boolean(t.childNodes[0].style)&&(a=t.childNodes[0])),n=Wi(a,n),n}function Yi(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(...Yi(e.childNodes[t]));a.map((e=>n.appendChild(e)))}else-1!==Hi.indexOf(e.nodeName)?(t=document.createElement(e.nodeName),n=Xi(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=Vi(n.cloneNode(!0),t.childNodes[0].href),a=t.childNodes[0].childNodes[0]),n=Wi(a,n),n}(e)):"BR"===e.nodeName?n=e:(t=document.createElement("span"),n=Xi(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(...Yi(e.childNodes[n]));return t}return[e]}function Ki(e){return 8!==e.nodeType}var Ji=n(56266);const Qi=/<style>(.*?)<\/style>/gs,er=(e,t,n,a,s,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 u=l?(0,w.ZP)(function(e){let t=document.createElement("div");try{e=(n=e).match(Di)?function(e){const t=document.createElement("body"),n=e.childNodes,a=Array.from(n).filter(Ki),s=[];for(const e of a)s.push(...Yi(e));for(let e=0;e<s.length;e++)t.appendChild(s[e].cloneNode(!0));return t}(Gi(n.replace(/(\r\n|\n|\r)/,""))).innerHTML:Gi(n.replace(/(\r\n|\n|\r)/,"")).innerHTML}catch(e){o.eMD&&console.error(e)}var n;t.innerHTML=e.replace(/\u00a0/g," ").replace(Qi,"");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(),w.xe[e.tagName]&&e.setAttribute("data-entity-type",w.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 r.Vv.MentionName:e.replaceWith(e.textContent||"");break;case r.Vv.CustomEmoji:e.textContent=e.dataset.alt||""}})),t.innerHTML.trimEnd()}(l),void 0,!0):void 0;u&&(0,Ji.Lo)(u)&&s&&(u=(0,Ji.If)(u),c?.());const{items:m}=e.clipboardData;let h=[];if(e.preventDefault(),m.length>0&&(h=await(0,_i.Z)(m)),!h?.length&&!d)return;if(h?.length&&!a){const e=await Promise.all(h.map((e=>pi(e.name,e))));n((t=>t.concat(e)))}const g=u?.entities?.length?u:{text:d};g&&t(g,i?.id)}}),[t,a,n,e,s,c])};var tr=n(11309);const nr=new Set([r.Vv.TextUrl,r.Vv.Url]);var ar=n(28353),sr=n(29295),or=n(16580);const ir=300,rr=/^@([a-z0-9_]{1,32})[\u00A0\u0020]+(.*)/i,cr=/^@([a-z0-9_]{1,32})[\u00A0\u0020]+\n{2,}/i,dr={username:"",query:"",canShowHelp:!1,usernameLowered:""},lr=document.createElement("div");const ur=(0,or.Z)(((e,t,n)=>({username:e,query:t,canShowHelp:n,usernameLowered:e.toLowerCase()}))),mr=/^\/([\w@]{1,32})?$/i;var hr=n(33057),gr=n(60130);function pr(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 fr=n(69156),Ir=n(70971);let vr=!1;const wr=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,wt.Z)(it.gl.Extra,"DeleteMessageModal",!t);return n?i.ZP.createElement(n,e):void 0}));var br=n(43521),Pr=n(85655),yr=n(56503),Zr=n(62898);const Cr="N3E1geoPu1vesCKf545F",Sr=/#fff/gi,Er=(0,i.X$)((e=>{let{icon:t,theme:n}=e;const a=(0,Xt.Z)((0,u.ym)(t),!1,r.IU.Text),o=(0,i.Ye)((()=>{if(!a)return"";const e="dark"===n?"rgb(170, 170, 170)":"rgb(112, 117, 121)",t=a.replace(Sr,e),s=(new DOMParser).parseFromString(t,"image/svg+xml");return s.querySelectorAll("path").forEach((t=>{t.style.stroke=e,t.style.strokeWidth="0.5px"})),`data:image/svg+xml;utf8,${s.documentElement.outerHTML}`}),[a,n]);return i.ZP.createElement("i",{className:(0,at.Z)("vL8HfVVnjTeFmp1ECFj8",s.FW&&Cr)},i.ZP.createElement("img",{src:o,alt:"",className:(0,at.Z)("Fb4aIyDYEwOlaqY8oZkV",s.FW&&Cr)}))})),Mr=(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,Tt.Z)(),m=(0,i.Ye)((()=>t.icons.find((e=>{let{name:t}=e;return"default_static"===t}))?.document),[t.icons]),[h,g,p]=(0,Mt.Z)(),[f,I]=(0,i.eJ)(void 0),v=(0,i.I4)((e=>{e.preventDefault();const t=e.currentTarget.getBoundingClientRect();I({x:t.right,y:t.bottom}),r(),g()}),[r,g]),w=(0,i.I4)((()=>{p(),c()}),[p,c]),b=(0,i.I4)((()=>{I(void 0)}),[]),P=(0,i.I4)((()=>{l({botId:t.id,isEnabled:!1})}),[t.id,l]);return i.ZP.createElement(Ft.Z,{key:t.id,customIcon:m&&i.ZP.createElement(Er,{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(Zr.Z,null,i.ZP.createElement(un.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(Ft.Z,{icon:"stop",destructive:!0,onClick:P},u("WebApp.RemoveBot")))))})),Rr=(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}=e;const[w,b,P]=(0,Mt.Z)(),[y,Z,C]=(0,yr.Z)(w,P),S=d&&l,E=d||l,[M,R,k]=(0,Mt.Z)();(0,i.d4)((()=>{w&&C()}),[w,C]);const T=(0,i.I4)((()=>{w?P():b()}),[w,b,P]),N=(0,i.I4)(((e,t)=>{const{files:n}=e.target,a=(0,Sn.ox)(n);a?.length&&f(a,t)}),[f]),A=(0,i.I4)((()=>{(0,Pr.g)(Array.from(S?o.dII:d?o.oGt:o.wGh).join(","),(e=>N(e,!0)))}),[d,S,N]),x=(0,i.I4)((()=>{(0,Pr.g)(!u&&m?Array.from(o.e74).join(","):"*",(e=>N(e,!1)))}),[m,u,N]),B=(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]),L=(0,Tt.Z)();if(a)return i.ZP.createElement("div",{className:"AttachMenu"},i.ZP.createElement(br.Z,{id:"attach-menu-button",className:w?"AttachMenu--button activated":"AttachMenu--button",round:!0,color:"translucent",onActivate:T,ariaLabel:"Add an attachment",ariaControls:"attach-menu-controls",hasPopup:!0},i.ZP.createElement("i",{className:"icon-attach"})),i.ZP.createElement(un.Z,{id:"attach-menu-controls",isOpen:w||M,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:Z,noCloseOnBackdrop:!s.$b,ariaLabelledBy:"attach-menu-button"},!r&&i.ZP.createElement(Ft.Z,{className:"media-disabled",disabled:!0},"Posting media content is not allowed in this group."),r&&i.ZP.createElement(i.ZP.Fragment,null,E&&i.ZP.createElement(Ft.Z,{icon:"photo",onClick:A},L(S?"AttachmentMenu.PhotoOrVideo":d?"InputAttach.Popover.Photo":"InputAttach.Popover.Video")),(u||m)&&i.ZP.createElement(Ft.Z,{icon:"document",onClick:x},L(!u&&m?"InputAttach.Popover.Music":"AttachDocument"))),c&&i.ZP.createElement(Ft.Z,{icon:"poll",onClick:I},L("Poll")),r&&!p&&B.map((e=>i.ZP.createElement(Mr,{bot:e,chatId:t,threadId:n,theme:v,onMenuOpened:R,onMenuClosed:k})))))})),kr=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,wt.Z)(it.gl.Extra,"InlineBotTooltip",!t);return n?i.ZP.createElement(n,e):void 0})),Tr=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,wt.Z)(it.gl.Extra,"MentionTooltip",!t);return n?i.ZP.createElement(n,e):void 0}));var Nr=n(67146);const Ar=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,wt.Z)(it.gl.Extra,"StickerTooltip",!t);return n?i.ZP.createElement(n,e):void 0}));var xr=n(93219),Br=n(19830);const Lr=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,wt.Z)(it.gl.Extra,"BotCommandTooltip",!t);return n?i.ZP.createElement(n,e):void 0})),Ur=(0,i.X$)((0,a.c$)(((e,t)=>{let{messageId:n}=t;const{chatId:a}=(0,d.Bt)(e)||{};return a?{message:(0,d.hj)(e,a,n)}:{}}))((e=>{let{isOpen:t,message:n,onClose:o}=e;const{clickBotInlineButton:r}=(0,a.Sv)(),[c,d]=(0,yr.Z)(t,o),{isKeyboardSingleUse:l}=n||{};if(n&&n.keyboardButtons)return i.ZP.createElement(un.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(_t.Z,{ripple:!0,disabled:"unsupported"===e.type,onClick:()=>r({messageId:n.id,button:e})},e.text))))))))})));var jr=n(49841),Or=n(63394),Fr=n(66902);const _r=(0,i.X$)((0,a.c$)(((e,t)=>{let{shouldForceShowEditing:n}=t;const{chatId:a,threadId:s,type:o}=(0,d.Bt)(e)||{};if(!a||!s||!o)return{};const{forwardMessages:{fromChatId:i,toChatId:r,messageIds:c,noAuthors:l,noCaptions:m}}=(0,d.jU)(e),h=(0,d.Yy)(e,a,s),g="scheduled"===o?(0,d.wU)(e,a):(0,d._$)(e,a,s),p=e.settings.byKey.animationLevel>=1,f=r===a,I=c?.map((t=>(0,d.hj)(e,i,t)));let v,w;if(h&&!n?v=(0,d.hj)(e,a,h):g?v=(0,d.kK)(e,a,s,o):f&&1===c.length&&(v=I?.[0]),h&&v&&!n){const{forwardInfo:t}=v,n=(0,d.FM)(e,a);t&&(t.isChannelPost||n)&&(w=(0,d.cv)(e,v)),w||t?.hiddenUserName||(w=(0,d.Ur)(e,v))}else f&&(v&&(w=(0,d.cv)(e,v),w||(w=(0,d.Ur)(e,v))),w||(w=(0,u.YC)(i)?(0,d.dy)(e,i):(0,d.Z1)(e,i)));const b=I?.some((e=>e?.content.text&&Object.keys(e.content).length>1));return{replyingToId:h,editingId:g,message:v,sender:w,shouldAnimate:p,forwardedMessagesCount:f?c.length:void 0,noAuthors:l,noCaptions:m,forwardsHaveCaptions:b,isCurrentUserPremium:(0,d.wV)(e)}}))((e=>{let{replyingToId:t,editingId:n,message:s,sender:o,shouldAnimate:r,forwardedMessagesCount:c,noAuthors:d,noCaptions:l,forwardsHaveCaptions:m,shouldForceShowEditing:h,isCurrentUserPremium:g,onClear:p}=e;const{setReplyingToId:f,setEditingId:I,focusMessage:v,changeForwardRecipient:w,setForwardNoAuthors:b,setForwardNoCaptions:P,exitForwardMode:y}=(0,a.Sv)(),Z=(0,i.sO)(null),C=(0,Tt.Z)(),S=Boolean(c),E=Boolean((t||n)&&s||o&&c),M=(0,_n.Z)([c],c?300:void 0),{shouldRender:R,transitionClassNames:k}=(0,pt.Z)(M&&E,void 0,!r,void 0,!r),T=(0,i.I4)((()=>{t&&!h?f({messageId:void 0}):n?I({messageId:void 0}):c&&y(),p?.()}),[t,h,n,c,p,f,I,y]);(0,i.d4)((()=>E?(0,St.Z)(T):void 0),[E,T]);const N=(0,i.I4)((()=>{S||v({chatId:s.chatId,messageId:s.id,noForumTopicPanel:!0})}),[v,S,s]),A=(0,i.I4)((e=>{e.stopPropagation(),T()}),[T]),x=(0,i.I4)((()=>{w()}),[w]),{isContextMenuOpen:B,contextMenuPosition:L,handleContextMenu:U,handleContextMenuClose:j,handleContextMenuHide:O}=(0,la.Z)(Z),F=(0,i.I4)((()=>Z.current),[]),_=(0,i.I4)((()=>Z.current),[]),D=(0,i.I4)((()=>Z.current.querySelector(".forward-context-menu .bubble")),[]),{positionX:q,positionY:$,transformOriginX:H,transformOriginY:G,style:V}=(0,Or.Z)(L,F,_,D),z=(0,at.Z)("ComposerEmbeddedMessage",k),W=(0,i.Ye)((()=>t&&!h?"icon-reply":n?"icon-edit":S?"icon-forward":void 0),[n,S,t,h]),X=c&&c>1?C("ForwardedMessageCount",c):void 0,Y=(0,i.Ye)((()=>{if(!s||!S||!s.content.text||!d||g)return s;const e=(0,u.If)(s.content.text);return{...s,content:{...s.content,text:e}}}),[g,S,s,d]);if(R)return i.ZP.createElement("div",{className:z,ref:Z,onContextMenu:U,onClick:U},i.ZP.createElement("div",null,i.ZP.createElement("div",{className:"embedded-left-icon"},i.ZP.createElement("i",{className:W})),i.ZP.createElement(Zs,{className:"inside-input",message:Y,sender:d?void 0:o,customText:X,title:n?C("EditMessage"):d?C("HiddenSendersNameDescription"):void 0,onClick:N,hasContextMenu:S}),i.ZP.createElement(_t.Z,{className:"embedded-cancel",round:!0,faded:!0,color:"translucent",ariaLabel:C("Cancel"),onClick:A},i.ZP.createElement("i",{className:"icon-close"})),S&&i.ZP.createElement(un.Z,{isOpen:B,transformOriginX:H,transformOriginY:G,positionX:q,positionY:$,style:V,className:"forward-context-menu",onClose:j,onCloseAnimationEnd:O},i.ZP.createElement(Ft.Z,{icon:d?void 0:"message-succeeded",customIcon:d?i.ZP.createElement("i",{className:"icon-placeholder"}):void 0,onClick:()=>b({noAuthors:!1})},C(c>1?"ShowSenderNames":"ShowSendersName")),i.ZP.createElement(Ft.Z,{icon:d?"message-succeeded":void 0,customIcon:d?void 0:i.ZP.createElement("i",{className:"icon-placeholder"}),onClick:()=>b({noAuthors:!0})},C(c>1?"HideSenderNames":"HideSendersName")),m&&i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement(Fr.Z,null),i.ZP.createElement(Ft.Z,{icon:l?void 0:"message-succeeded",customIcon:l?i.ZP.createElement("i",{className:"icon-placeholder"}):void 0,onClick:()=>P({noCaptions:!1})},C(c>1?"Conversation.ForwardOptions.ShowCaption":"ShowCaption")),i.ZP.createElement(Ft.Z,{icon:l?"message-succeeded":void 0,customIcon:l?void 0:i.ZP.createElement("i",{className:"icon-placeholder"}),onClick:()=>P({noCaptions:!0})},C(c>1?"Conversation.ForwardOptions.HideCaption":"HideCaption"))),i.ZP.createElement(Fr.Z,null),i.ZP.createElement(Ft.Z,{icon:"replace",onClick:x},C("ChangeRecipient")))))}))),Dr=(0,i.X$)((e=>{const{attachments:t}=e,n=(0,wt.Z)(it.gl.Extra,"AttachmentModal",!t.length);return n?i.ZP.createElement(n,e):void 0})),qr=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,wt.Z)(it.gl.Extra,"BotCommandMenu",!t);return n?i.ZP.createElement(n,e):void 0})),$r=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,wt.Z)(it.gl.Extra,"PollModal",!t);return n?i.ZP.createElement(n,e):void 0})),Hr=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,wt.Z)(it.gl.Extra,"DropArea",!t);return n?i.ZP.createElement(n,e):void 0})),Gr=new RegExp(o.FM6,"i"),Vr=(0,i.X$)((0,a.c$)(((e,t)=>{let{chatId:n,threadId:a}=t;const s=(0,d.tV)(e,n,a);return{theme:(0,d.Pu)(e),webPagePreview:(0,d.jU)(e).webPagePreview,noWebPage:s}}))((e=>{let{chatId:t,threadId:n,getHtml:s,isDisabled:o,webPagePreview:c,noWebPage:d,theme:l}=e;const{loadWebPagePreview:u,clearWebPagePreview:m,toggleMessageWebPage:h}=(0,a.Sv)(),g=(0,tr.i)((()=>{const{text:e,entities:t}=(0,w.ZP)(s()),n=t?.find((e=>e.type===r.Vv.TextUrl));return n?.url||e.match(Gr)?.[0]}),[s],300,!0),p=(0,Ei.Z)(g,[g,s],!0);(0,i.d4)((()=>{const e=p();e?u({text:e}):(m(),h({chatId:t,threadId:n}))}),[p,t,n,m,u,h]),(0,lt.Z)((()=>{m(),h({chatId:t,threadId:n})}),[t,m,n,h]);const f=(0,Bn.Z)((()=>Boolean(c&&s()&&!d&&!o)),[o,s,d,c]),{shouldRender:I,transitionClassNames:v}=(0,pt.Z)(f),b=(0,xn.Z)(c,!0),P=(0,i.I4)((()=>{h({chatId:t,threadId:n,noWebPage:!0})}),[t,n,h]);if(!I||!b)return;const{photo:y,...Z}=b,C={content:{webPage:Z}};return i.ZP.createElement("div",{className:(0,at.Z)("WebPagePreview",v)},i.ZP.createElement("div",null,i.ZP.createElement("div",{className:"WebPagePreview-left-icon"},i.ZP.createElement("i",{className:"icon-link"})),i.ZP.createElement(co,{message:C,inPreview:!0,theme:l}),i.ZP.createElement(_t.Z,{className:"WebPagePreview-clear",round:!0,faded:!0,color:"translucent",ariaLabel:"Clear Webpage Preview",onClick:P},i.ZP.createElement("i",{className:"icon-close"}))))}))),zr=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,wt.Z)(it.gl.Extra,"SendAsMenu",!t);return n?i.ZP.createElement(n,e):void 0})),Wr=(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(_t.Z,{className:(0,at.Z)("bot-menu",t&&"open"),round:!0,color:"translucent",disabled:s,onClick:n,ariaLabel:"Open bot command keyboard"},i.ZP.createElement("i",{className:(0,at.Z)("bot-menu-icon","icon-webapp",t&&"open")}),i.ZP.createElement("span",{ref:o,className:"bot-menu-text"},a))}));var Xr=n(23522),Yr=function(e){return e.Send="send",e.Record="record",e.Edit="edit",e.Schedule="schedule",e}(Yr||{});const Kr=(0,i.X$)((0,a.c$)(((e,t)=>{var n;let{chatId:a,threadId:s,messageListType:i,isMobile:r}=t;const c=(0,d.Z1)(e,a),l=a!==o.FVh?(0,d.IK)(e,a):void 0,m=Boolean(l),h=(0,d.FM)(e,a),g=(0,u.YC)(a),p=(m||!g)&&(0,d.FT)(e,a,s),f=(0,d.qy)(e,a,s),{language:I,shouldSuggestStickers:v,shouldSuggestCustomEmoji:w}=e.settings.byKey,b=e.emojiKeywords[o.pRL],P=I!==o.pRL?e.emojiKeywords[I]:void 0,y=p?p.id:void 0,Z=y?(0,d.hj)(e,a,y):void 0,{currentUserId:C}=e,S=c?.fullInfo?c?.fullInfo?.sendAsId||C:void 0,E=c?.sendAsPeerIds&&S&&(c.sendAsPeerIds.some((e=>e.id===S))?S:c?.adminRights?.anonymous?c?.id:void 0),M=E?(0,d.dy)(e,E):void 0,R=!M&&E?(0,d.Z1)(e,E):void 0,k=(0,d.uH)(e,a),T=(0,d.nA)(e,a),N=(0,d.Bt)(e),A=a===N?.chatId&&s===N?.threadId&&i===N?.type,x=(0,d.dy)(e,a),B=null===(n=x&&!x.fullInfo?.noVoiceMessages)||void 0===n||n,L="scheduled"===i?(0,d.hI)(e,a):(0,d.s)(e,a,s),U=(0,d.Yy)(e,a,s),j=(0,d.jU)(e);return{editingMessage:(0,d.kK)(e,a,s,i),connectionState:e.connectionState,replyingToId:U,draft:(0,d.Ms)(e,a,s),chat:c,isChatWithBot:m,isChatWithSelf:h,isForCurrentMessageList:A,canScheduleUntilOnline:(0,d.Eh)(e,a),isChannel:c?(0,u.eA)(c):void 0,isRightColumnShown:(0,d.Jf)(e,r),isSelectModeActive:(0,d.CA)(e),withScheduledButton:"thread"===i&&Boolean(f?.length),shouldSchedule:"scheduled"===i,botKeyboardMessageId:y,botKeyboardPlaceholder:Z?.keyboardPlaceholder,isForwarding:a===j.forwardMessages.toChatId,pollModal:j.pollModal,stickersForEmoji:e.stickers.forEmoji.stickers,customEmojiForEmoji:e.customEmojis.forEmoji.stickers,groupChatMembers:c?.fullInfo?.members,topInlineBotIds:e.topInlineBots?.userIds,currentUserId:C,lastSyncTime:e.lastSyncTime,contentToBeScheduled:j.contentToBeScheduled,shouldSuggestStickers:v,shouldSuggestCustomEmoji:w,recentEmojis:e.recentEmojis,baseEmojiKeywords:b?.keywords,emojiKeywords:P?.keywords,inlineBots:j.inlineBots.byUsername,isInlineBotLoading:j.inlineBots.isLoading,chatBotCommands:c?.fullInfo&&c.fullInfo.botCommands,botCommands:l?.fullInfo?l.fullInfo.botInfo?.commands||!1:void 0,botMenuButton:l?.fullInfo?.botInfo?.menuButton,sendAsUser:M,sendAsChat:R,sendAsId:E,editingDraft:L,requestedDraftText:k,requestedDraftFiles:T,attachBots:e.attachMenu.bots,attachMenuPeerType:(0,d.t)(e,a),theme:(0,d.Pu)(e),fileSizeLimit:(0,ne.M)(e,"uploadMaxFileparts")*o.pJM,captionLimit:(0,ne.M)(e,"captionLength"),isCurrentUserPremium:(0,d.wV)(e),canSendVoiceByPrivacy:B,attachmentSettings:e.attachmentSettings}}))((e=>{let{dropAreaState:t,shouldSchedule:n,canScheduleUntilOnline:c,isReady:d,isMobile:m,onDropHide:h,editingMessage:g,chatId:p,threadId:f,messageListType:I,draft:b,chat:P,isForCurrentMessageList:y,isCurrentUserPremium:Z,canSendVoiceByPrivacy:C,connectionState:S,isChatWithBot:E,isChatWithSelf:M,isChannel:R,fileSizeLimit:k,isRightColumnShown:T,isSelectModeActive:N,isForwarding:x,pollModal:B,botKeyboardMessageId:L,botKeyboardPlaceholder:U,withScheduledButton:j,stickersForEmoji:O,customEmojiForEmoji:F,groupChatMembers:_,topInlineBotIds:D,currentUserId:q,captionLimit:$,lastSyncTime:H,contentToBeScheduled:G,shouldSuggestStickers:V,shouldSuggestCustomEmoji:z,baseEmojiKeywords:W,emojiKeywords:X,recentEmojis:Y,inlineBots:K,isInlineBotLoading:J,botCommands:Q,chatBotCommands:ee,sendAsUser:te,sendAsChat:ne,sendAsId:ae,editingDraft:se,replyingToId:oe,requestedDraftText:ie,requestedDraftFiles:ce,botMenuButton:de,attachBots:le,attachMenuPeerType:ue,attachmentSettings:me,theme:he}=e;const{sendMessage:ge,clearDraft:pe,showDialog:fe,forwardMessages:Ie,openPollModal:ve,closePollModal:we,loadScheduledHistory:be,openChat:Pe,addRecentEmoji:ye,sendInlineBotResult:Ze,loadSendAs:Ce,resetOpenChatWithDraft:Se,callAttachBot:Ee,addRecentCustomEmoji:Me,showNotification:Re,showAllowedMessageTypesNotification:ke}=(0,a.Sv)(),Te=(0,Tt.Z)(),Ne=(0,i.sO)(null),Ae=(0,i.sO)(null),[xe,Be]=(0,Nn.Z)(""),Le=(0,fr.Z)(o.Edp),je=(0,i.sO)(),Oe=(0,Rn.Z)(t),{width:Fe}=Ue.Z.get(),_e=P?.sendAsPeerIds,De=_e&&(_e.length>1||!_e.some((e=>e.id===q))),[qe,$e,He]=(0,Mt.Z)(),Ge=(0,Ri.Z)(p,f);(0,i.d4)(yi.AU,[xe]);const Ve=(0,i.sO)(0),ze=(0,i.I4)((()=>{He()}),[He]),[We,Xe]=(0,hr.Z)(c,ze);(0,i.d4)((()=>{je.current=void 0}),[p]),(0,i.d4)((()=>{p&&H&&d&&be({chatId:p})}),[d,p,be,H,f]),(0,i.d4)((()=>{p&&P&&H&&!_e&&d&&(0,u.ZV)(P)&&Ce({chatId:p})}),[P,p,d,H,Ce,_e]);const Ye=(0,i.sO)(!1);(0,lt.Z)((e=>{let[t,n]=e;Ye.current=Boolean(p===t&&_e&&!n)}),[p,_e]),(0,i.bt)((()=>{Ne.current&&(Ne.current.innerHTML='<svg width="9" height="20" xmlns="http://www.w3.org/2000/svg"><defs><filter x="-50%" y="-14.7%" width="200%" height="141.2%" filterUnits="objectBoundingBox" id="a"><feOffset dy="1" in="SourceAlpha" result="shadowOffsetOuter1"/><feGaussianBlur stdDeviation="1" in="shadowOffsetOuter1" result="shadowBlurOuter1"/><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"/></filter></defs><g fill="none" fill-rule="evenodd"><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(#a)"/><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" class="corner"/></g></svg>')}),[]);const[Ke,Je]=(0,i.eJ)([]),Qe=Boolean(Ke.length),{canSendStickers:et,canSendGifs:tt,canAttachMedia:nt,canAttachPolls:st,canAttachEmbedLinks:ot,canSendVoices:it,canSendPlainText:ut,canSendAudios:mt,canSendVideos:ht,canSendPhotos:gt,canSendDocuments:pt}=(0,i.Ye)((()=>(0,u.H5)(P,E)),[P,E]),ft=!ut&&!g,{shouldSuggestCompression:vt,shouldForceCompression:wt,shouldForceAsFile:bt,handleAppendFiles:Pt,handleFileSelect:yt,onCaptionUpdate:Zt,handleClearAttachments:Ct,handleSetAttachments:Et}=function(e){let{attachments:t,fileSizeLimit:n,setHtml:s,setAttachments:o,chatId:r,canSendAudios:c,canSendVideos:d,canSendPhotos:u,canSendDocuments: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),P=(0,i.I4)((()=>{o(l.D)}),[o]),y=(0,i.I4)((e=>{const a="function"==typeof e?e(t):e;if(a.length)if(a.some((e=>{const t=pr(e);return"audio"===t&&!c&&!m||"video"===t&&!d&&!m||"image"===t&&!u&&!m||"file"===t&&!m})))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=pr(e);return"audio"===t&&!c||"video"===t&&!d||"image"===t&&!u}));f(Boolean(e&&m)),v(!m)}else P()}),[t,c,m,u,d,r,n,P,h,o,g]);return{shouldSuggestCompression:w,handleAppendFiles:(0,i.I4)((async(e,n)=>{y([...t,...await Promise.all(e.map((e=>pi(e.name,e,{shouldSendAsSpoiler:n||void 0}))))])}),[t,y]),handleFileSelect:(0,i.I4)((async(e,t)=>{y(await Promise.all(e.map((e=>pi(e.name,e))))),b(t)}),[y]),onCaptionUpdate:s,handleClearAttachments:P,handleSetAttachments:y,shouldForceCompression:I,shouldForceAsFile:p}}({attachments:Ke,setHtml:Be,setAttachments:Je,fileSizeLimit:k,chatId:p,canSendAudios:mt,canSendVideos:ht,canSendPhotos:gt,canSendDocuments:pt}),[Rt,kt,Nt]=(0,Mt.Z)(),[At,xt,Bt]=(0,Mt.Z)(),[Lt,Ut,jt]=(0,Mt.Z)(),[Ot,Ft,Dt]=(0,Mt.Z)(),[qt,$t,Ht]=(0,Mt.Z)(),[Vt,zt,Wt]=(0,Mt.Z)(),{startRecordingVoice:Xt,stopRecordingVoice:Yt,pauseRecordingVoice:Kt,activeVoiceRecording:Jt,currentRecordTime:Qt,recordButtonRef:en,startRecordTimeRef:tn}=(()=>{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&&Oi()}),[]);const c=(0,i.I4)((async()=>{try{const{stop:t,pause:s}=await Fi((t=>{e.current&&(a.current&&Date.now()%4==0&&(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)}}),[]),d=(0,i.I4)((()=>{if(t){e.current&&(e.current.style.boxShadow="none");try{return t.pause()}catch(e){return void console.error(e)}}}),[t]),l=(0,i.I4)((()=>{if(t){n(void 0),a.current=void 0,r(void 0),e.current&&(e.current.style.boxShadow="none");try{return t.stop()}catch(e){return void console.error(e)}}}),[t]);return(0,i.d4)((()=>t?(0,St.Z)(l):void 0),[t,l]),{startRecordingVoice:c,pauseRecordingVoice:d,stopRecordingVoice:l,activeVoiceRecording:t,currentRecordTime:o,recordButtonRef:e,startRecordTimeRef:a}})();(0,It.Z)((()=>{Ge({type:"recordAudio"})}),Jt&&o.o_S),(0,i.d4)((()=>{Jt||Ge({type:"cancel"})}),[Jt,Ge]);const nn=(0,Ir.Y)(Boolean(g));(0,i.d4)((()=>{xe()&&!nn.current&&Ge({type:"typing"})}),[xe,nn,Ge]);const an=P&&(0,u.Nl)(P),sn=(0,u.Hd)(P),{isEmojiTooltipOpen:on,closeEmojiTooltip:rn,filteredEmojis:cn,filteredCustomEmojis:dn,insertEmoji:ln}=(0,ar.Z)(Boolean(d&&y&&V&&!Qe),xe,Be,void 0,Y,W,X),{isCustomEmojiTooltipOpen:un,closeCustomEmojiTooltip:mn,insertCustomEmoji:hn}=(0,gr.Z)(Boolean(d&&y&&z&&!Qe),xe,Be,Le,Ae,F),{isStickerTooltipOpen:gn,closeStickerTooltip:pn}=function(e,t,n){const{loadStickersForEmoji:r,clearStickersForEmoji:c}=(0,a.Sv)(),[d,l,u]=(0,Mt.Z)(!1),m=(0,Ei.Z)((()=>{const n=t();if(!e||!n||s.op&&n.length>8)return;if(!n.match(s.op?Ci.Z:o.t8f))return;const a=(0,Si._)(n);return a&&(s.op&&1===(0,Zi.Z)(a)||!s.op&&Boolean(n.match(Mi)))?s.op?a:a.match(/alt="(.+)"/)?.[1]:void 0}),[t,e]),h=(0,Bn.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(d&&y&&V&&et&&!Qe),xe,O),{isMentionTooltipOpen:fn,closeMentionTooltip:In,insertMention:vn,mentionFilteredUsers:wn}=(0,sr.Z)(Boolean(d&&y&&!Qe),xe,Be,Le,Ae,_,D,q),{isOpen:bn,botId:Pn,isGallery:yn,switchPm:Cn,results:Sn,closeTooltip:En,help:Mn,loadMore:kn}=function(e,t,n,s){const{queryInlineBot:o,resetInlineBot:r,resetAllInlineBots:c}=(0,a.Sv)(),[d,l,u]=(0,Mt.Z)(!1),m=(0,tr.C)((()=>{const t=n();return e&&t.startsWith("@")?function(e){if(!e.startsWith("@"))return dr;const t=function(e){return lr.innerHTML=e.replace(/<br>/g,"\n"),lr.querySelectorAll("[alt]").forEach((e=>{e.innerText||(e.innerText=e.getAttribute("alt"))})),lr.innerText}(e),n=t.match(rr);return n?ur(n[1],n[2],""===n[2]&&!t.match(cr)):dr}(t):dr}),[n,e],ir),{username:h,query:g,canShowHelp:p,usernameLowered:f}=(0,Bn.Z)(m,[m,n],!0);(0,lt.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,offset:w,results:b,isGallery:P,help:y}=f&&s?.[f]||{},Z=Boolean((b?.length||v)&&!d);(0,i.d4)((()=>{Z||h||c()}),[Z,c,h]);const C=(0,i.I4)((()=>{f&&o({chatId:t,username:f,query:g,offset:w})}),[t,w,g,o,f]);return{isOpen:Z,botId:I,isGallery:P,switchPm:v,results:b,closeTooltip:l,help:p&&y?`@${h} ${y}`:void 0,loadMore:C}}(Boolean(d&&y&&!Qe&&H),p,xe,K),{isOpen:Tn,close:An,filteredBotCommands:xn}=function(e,t,n,a){const[s,o]=(0,i.eJ)(),[r,c,d]=(0,Mt.Z)(!1),l=(0,tr.C)((()=>{const n=t();return e&&n.startsWith("/")?(0,Si._)(n).match(mr)?.[0].trim():void 0}),[t,e],300),u=(0,Ei.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(d&&y&&(Q&&Q?.length||ee?.length)),xe,Q,ee),Ln=(0,i.I4)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.R2F;if(t===o.R2F&&ft)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,wi.R)(s,t))return(0,vi.tx)(e),void a.dispatchEvent(new Event("input",{bubbles:!0}))}Be(`${xe()}${e}`),requestAnimationFrame((()=>{(0,ui.Z)(a)}))}),[ft,xe,Be]),Un=(0,i.I4)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.R2F;const n=(0,Js.z)(e);Ln(n,t)}),[Ln]),jn=(0,i.I4)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.R2F;Ln((0,Ya.yR)(e),t)}),[Ln]);((e,t,n,c,d,l,u)=>{const{saveDraft:m,clearDraft:h,loadCustomEmojis:g}=(0,a.Sv)(),p=Boolean(l),f=(0,i.I4)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(p||!u)return;const s=c();var o,i,r,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,w.ZP)(s),shouldForce:a}):h({chatId:null!==(r=e.chatId)&&void 0!==r?r:t,threadId:null!==(d=e.threadId)&&void 0!==d?d:n,shouldForce:a})}),[t,n,p,u,c,m,h]),I=(0,i.I4)((()=>{f(void 0,!0)}),[f]),v=(0,Ir.Y)(f),b=(0,Sa.Z)(o.r_R,!0,void 0,[t,n]);(0,rt.Z)((a=>{let[i,c,u]=a;if(t===i&&n===c&&(!e&&u&&d(""),!e?.shouldForce))return;if(l||!e)return;d((0,Js.z)(e));const m=e.entities?.map((e=>e.type===r.Vv.CustomEmoji&&e.documentId)).filter(Boolean)||[];m.length&&g({ids:m}),s.$b||requestAnimationFrame((()=>{const e=document.querySelector(o.Edp);e&&(0,ui.Z)(e,!0)}))}),[t,n,e,d,l,g]),(0,i.d4)((()=>()=>{p||v.current({chatId:t,threadId:n}),vr=!0,requestAnimationFrame((()=>{vr=!1}))}),[t,n,p,v]);const P=(0,Ir.Y)(t),y=(0,Ir.Y)(n);(0,i.d4)((()=>{if(vr)return;if(!c())return void v.current();const e=P.current,t=y.current;b((()=>{P.current===e&&y.current===t&&v.current()}))}),[P,c,b,y,v]),(0,ct.Z)(I),dt(I)})(b,p,f,xe,Be,g,H);const Fn=(0,i.I4)((function(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]||Be(""),Je(l.D),rn(),mn(),pn(),In(),m?setTimeout((()=>jt()),350):jt()}),[Be,m,pn,mn,In,rn,jt]),[_n,Dn,qn]=((e,t,n,s,r,c,d,l,m,h,g)=>{const{editMessage:p,setEditingDraft:f,toggleMessageWebPage:I}=(0,a.Sv)(),[v,b]=(0,i.eJ)(!1);(0,rt.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,Js.z)(i);t(r),b(!0),requestAnimationFrame((()=>{const e=document.querySelector(o.Edp);e&&(0,ui.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=>nr.has(e.type)));I({chatId:c,threadId:d,noWebPage:e})}),[c,d,n]),(0,i.d4)((()=>{if(n)return()=>{const t=(0,w.ZP)(e()),n=t.text.length?t:void 0;f({chatId:c,threadId:d,type:l,text:n})}}),[c,n,e,f,d,l]);const P=(0,tr.i)((()=>{if(!n)return!1;const t=(0,w.ZP)(e());return!("webPage"in n.content)&&n.content.text?.entities?.some((e=>nr.has(e.type)))&&!t.entities?.some((e=>nr.has(e.type)))}),[n,e],300,!0),y=(0,Ei.Z)(P,[P,e],!0);(0,rt.Z)((e=>{let[t]=e;n&&t?.id===n.id&&y()&&I({chatId:c,threadId:d,noWebPage:!1})}),[n,c,e,d,y]);const Z=(0,i.I4)((()=>{m&&(0,A.T2)((()=>{t((0,Js.z)(m));const e=document.querySelector(o.Edp);e&&requestAnimationFrame((()=>{(0,ui.Z)(e,!0)}))}))}),[m,t]),C=(0,i.I4)((()=>{s(),Z()}),[s,Z]),S=(0,i.I4)((()=>{const{text:t,entities:a}=(0,w.ZP)(e());n&&(t||(0,u.u8)(n)?(p({text:t,entities:a}),s(),Z()):r())}),[p,n,e,r,s,Z]),E=(0,i.I4)((()=>{if(!n)return;const t=(0,w.ZP)(e()),a=t.text.length?t:void 0;f({chatId:c,threadId:d,type:l,text:a})}),[c,n,e,f,d,l]);return(0,ct.Z)(E),dt(E),[S,C,v]})(xe,Be,g,Fn,$t,p,f,I,b,se,oe),$n=(0,Ir.Y)(Fn),Hn=(0,Ir.Y)(Yt);(0,i.d4)((()=>()=>{Hn.current(),$n.current()}),[p,f,$n,Hn]);const Gn=(0,i.I4)((()=>{const e=Ve.current;Re(e?{message:Te("UnlockPremiumEmojiHint2"),action:{action:"openChat",payload:{id:q,shouldReplaceHistory:!0}},actionText:Te("Open")}:{message:Te("UnlockPremiumEmojiHint"),action:{action:"openPremiumModal",payload:{initialSection:"animated_emoji"}},actionText:Te("PremiumMore")}),Ve.current=Number(!e)}),[q,Te,Re]),Vn=(0,Bn.Z)((()=>g&&qn?Yr.Edit:!s.mh||Jt||x||xe()&&!Qe?n?Yr.Schedule:Yr.Send:Yr.Record),[Jt,g,xe,Qe,x,qn,n]),zn=!n,{isContextMenuOpen:Wn,handleContextMenu:Xn,handleContextMenuClose:Yn,handleContextMenuHide:Kn}=(0,la.Z)(en,!(Vn===Yr.Send&&zn));er(y,Un,Et,g,!Z&&!M,Gn);const Jn=(0,i.I4)((()=>{g&&Dn()}),[g,Dn]),Qn=(0,i.I4)(((e,t)=>{const n=t?$:4096;if(e?.length>n){const t=e.length-n;return fe({data:{message:"MESSAGE_TOO_LONG_PLEASE_REMOVE_CHARACTERS",textParams:{"{EXTRA_CHARS_COUNT}":t.toString(),"{PLURAL_S}":t>1?"s":""},hasErrorKey:!0}}),!1}return!0}),[$,fe]),ea=(0,i.I4)((()=>{if(sn&&!an){const e=document.querySelector(o.Edp),t=(0,v.bp)(),n=je.current&&Math.floor(t-je.current),a=sn.nextSendDate&&sn.nextSendDate>t;if(n&&n<sn.seconds||a){const s=a?sn.nextSendDate-t:sn.seconds-n;return fe({data:{message:Te("SlowModeHint",(0,re.k9)(s)),isSlowMode:!0,hasErrorKey:!1}}),e?.blur(),!1}}return!0}),[an,Te,fe,sn]),ta=(0,i.I4)((e=>{let{attachments:t,sendCompressed:n=me.shouldCompress,sendGrouped:a=me.shouldSendGrouped,isSilent:s,scheduledAt:o}=e;if("connectionStateReady"!==S)return;const{text:i,entities:r}=(0,w.ZP)(xe());(i||t.length)&&Qn(i,!0)&&ea()&&(ge({text:i,entities:r,scheduledAt:o,isSilent:s,shouldUpdateStickerSetsOrder:!0,attachments:fi(t,n),shouldGroupMessages:a}),je.current=(0,v.bp)(),pe({chatId:p,localOnly:!0}),requestAnimationFrame((()=>{Fn()})))}),[me.shouldCompress,me.shouldSendGrouped,S,xe,Qn,ea,ge,pe,p,Fn]),na=(0,i.I4)(((e,t,n,a)=>{ta({attachments:Ke,sendCompressed:e,sendGrouped:t,isSilent:n,scheduledAt:a})}),[Ke,ta]),aa=(0,i.I4)((async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0;if("connectionStateReady"!==S)return;let n=Ke;if(Jt){const e=await Yt();if(e){const{blob:t,duration:a,waveform:s}=e;n=[await pi("wonderful-voice-message.ogg",t,{voice:{duration:a,waveform:s}})]}}const{text:a,entities:i}=(0,w.ZP)(xe());if(n.length)return void ta({attachments:n});if(!a&&!x)return;if(!Qn(a))return;const r=document.querySelector(o.Edp);if(a){if(!ea())return;ge({text:a,entities:i,scheduledAt:t,isSilent:e,shouldUpdateStickerSetsOrder:!0})}x&&Ie({scheduledAt:t,isSilent:e}),je.current=(0,v.bp)(),pe({chatId:p,localOnly:!0}),s.cj&&r&&r===document.activeElement&&Pi(r),requestAnimationFrame((()=>{Fn()}))}),[S,Ke,Jt,xe,x,Qn,pe,p,Yt,ta,ea,ge,Ie,Fn]),sa=(0,i.I4)((()=>{"webApp"===de?.type&&Ee({chatId:p,url:de.url,threadId:f})}),[de,Ee,p,f]),oa=(0,i.I4)((()=>{jt(),xt()}),[jt,xt]),ia=(0,i.I4)(((e,t)=>{if(e&&"queryId"in e){const{id:n,queryId:a,isSilent:s}=e;return void Ze({id:n,queryId:a,scheduledAt:t,isSilent:s})}const{isSilent:n,...a}=e||{};if(e&&0!==Object.keys(a).length)if(void 0!==e.sendCompressed||void 0!==e.sendGrouped){const{sendCompressed:a=!1,sendGrouped:s=!1}=e;na(a,s,n,t)}else ge({...e,scheduledAt:t});else aa(Boolean(n),t)}),[na,aa,Ze,ge]);(0,rt.Z)((e=>{let[t]=e;G&&G!==t&&We((e=>{ia(G,e)}))}),[G,ia,We]),(0,i.d4)((()=>{ie&&(Be(ie),Se(),requestAnimationFrame((()=>{const e=document.getElementById(o.R2F);(0,ui.Z)(e,!0)})))}),[ie,Se,Be]),(0,i.d4)((()=>{ce?.length&&(yt(ce),Se())}),[yt,ce,Se]);const ra=(0,i.I4)(((e,t)=>{e.isFree||Z||M?jn(e,t):Gn()}),[jn,M,Z,Gn]),ca=(0,i.I4)((e=>{ra(e,o.nYf)}),[ra]),da=(0,i.I4)(((e,t,a)=>{n||a?($e(),We((n=>{He(),ia({gif:e,isSilent:t},n),requestAnimationFrame((()=>{Fn(!0)}))}))):(ge({gif:e,isSilent:t}),requestAnimationFrame((()=>{Fn(!0)})))}),[n,$e,We,He,ia,Fn,ge]),ua=(0,i.I4)((function(e,t,a){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=arguments.length>4?arguments[4]:void 0;e={...e,isPreloadedGlobally:!0},n||a?($e(),We((n=>{He(),ia({sticker:e,isSilent:t},n),requestAnimationFrame((()=>{Fn(s)}))}))):(ge({sticker:e,isSilent:t,shouldUpdateStickerSetsOrder:o}),requestAnimationFrame((()=>{Fn(s)})))}),[n,$e,We,He,ia,Fn,ge]),ma=(0,i.I4)(((e,t,a)=>{if("connectionStateReady"!==S)return;n||a?We((n=>{ia({id:e.id,queryId:e.queryId,isSilent:t},n)})):Ze({id:e.id,queryId:e.queryId,isSilent:t});const i=document.querySelector(o.Edp);s.cj&&i&&i===document.activeElement&&Pi(i),pe({chatId:p,localOnly:!0}),requestAnimationFrame((()=>{Fn()}))}),[p,pe,S,ia,We,Fn,Ze,n]),ha=(0,i.I4)((()=>{pe({chatId:p,localOnly:!0}),requestAnimationFrame((()=>{Fn()}))}),[p,pe,Fn]),ga=(0,i.I4)((e=>{n?(We((t=>{ia({poll:e},t)})),we()):(ge({poll:e}),we())}),[we,ia,We,ge,n]),pa=(0,i.I4)((e=>{if(n)We((t=>{ia({...e,isSilent:!0},t)}));else if(e&&("sendCompressed"in e||"sendGrouped"in e)){const{sendCompressed:t=!1,sendGrouped:n=!1}=e;na(t,n,!0)}else aa(!0)}),[ia,aa,na,We,n]),fa=(0,i.I4)((()=>{const e=document.querySelector(o.Edp);if(!m||e!==document.activeElement)return Bt(),jt(),void Ft();e?.blur(),setTimeout((()=>{Bt(),jt(),Ft()}),100)}),[Bt,jt,Ft,m]),Ia=(0,i.I4)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.R2F;const n=(0,On.Z)(e,["escape_html","emoji_html","br_html"]).join("").replace(/\u200b+/g,"");Ln(n,t)}),[Ln]);(0,i.d4)((()=>{ft&&Be("")}),[ft,Be,Ke]);const va=(0,i.I4)((e=>{Ia(e,o.nYf)}),[Ia]),wa=(0,i.I4)((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,wi.R)(n,e))return void document.execCommand("delete",!1)}Be(function(e){const t=document.createElement("div");t.contentEditable="true",t.style.position="absolute",t.style.left="-10000px",t.style.top="-10000px",t.innerHTML=e,document.body.appendChild(t);let n=t.lastChild;if(n.lastChild)for(;n.lastChild;)n=n.lastChild;const a=n.textContent.length,s=document.createRange(),o=window.getSelection();s.setStart(n,a),s.setEnd(n,a),o.removeAllRanges(),o.addRange(s),document.execCommand("delete",!1);const i=t.innerHTML;return document.body.removeChild(t),i}(xe()))}),[xe,Be]),ba=(0,i.I4)((()=>{wa(o.nYf)}),[wa]),Pa=(0,i.I4)((()=>{Pe({id:p,threadId:f,type:"scheduled",noForumTopicPanel:!0})}),[Pe,p,f]);(0,i.d4)((()=>{T&&m&&jt()}),[T,jt,m]),(0,i.d4)((()=>{d&&(N?zt():setTimeout((()=>{Wt()}),200))}),[N,Wt,zt,d]);const ya=!(Vn!==Yr.Record||nt&&C&&it),Za=(0,i.I4)((()=>{switch(Vn){case Yr.Send:aa();break;case Yr.Record:ya?C?it||ke({chatId:p}):Re({message:Te("VoiceMessagesRestrictedByPrivacy",P?.title)}):Xt();break;case Yr.Edit:_n();break;case Yr.Schedule:Jt&&Kt(),We((e=>{ia({},e)}))}}),[Vn,aa,_n,Jt,We,ya,C,Re,Te,P?.title,Xt,Kt,ia,p,ke,it]),Ca=(0,Rn.Z)(g,!0),Ea=g||Ca,Ma=new Date;Ma.setSeconds(0),Ma.setMilliseconds(0);const Ra=new Date;Ra.setFullYear(Ra.getFullYear()+1);let ka="SendMessage";switch(Vn){case Yr.Edit:ka="Save edited message";break;case Yr.Record:ka=nt?"AccDescrVoiceMessage":"Conversation.DefaultRestrictedMedia"}const Ta=(0,at.Z)("Composer",!N&&"shown",Vt&&"hover-disabled"),Na=(0,i.I4)((()=>{We((e=>{ia({},e)}))}),[ia,We]),Aa=(0,i.I4)((()=>{pa()}),[pa]),xa=(0,i.I4)(((e,t)=>{We((n=>{ia({sendCompressed:e,sendGrouped:t},n)}))}),[ia,We]),Ba=(0,i.I4)(((e,t)=>{pa({sendCompressed:e,sendGrouped:t})}),[pa]),La=Vn===Yr.Edit?_n:Vn===Yr.Schedule?Na:aa,Ua=E&&"webApp"===de?.type&&!g,ja=(0,Bn.Z)((()=>Ua&&!xe()&&!Jt),[Ua,xe,Jt]),Oa=E&&"commands"===de?.type&&!g&&!1!==Q&&!Jt;return i.ZP.createElement("div",{className:Ta},nt&&d&&i.ZP.createElement(Hr,{isOpen:t!==Zn.t.None,withQuick:t===Zn.t.QuickFile||Oe===Zn.t.QuickFile,onHide:h,onFileSelect:yt}),i.ZP.createElement(Dr,{chatId:p,threadId:f,canShowCustomSendMenu:zn,attachments:Ke,getHtml:xe,isReady:d,shouldSuggestCompression:vt,shouldForceCompression:wt,shouldForceAsFile:bt,isForCurrentMessageList:y,shouldSchedule:n,onCaptionUpdate:Zt,onSendSilent:Ba,onSend:na,onSendScheduled:xa,onFileAppend:Pt,onClear:Ct,onAttachmentsUpdate:Et,onCustomEmojiSelect:ca,onRemoveSymbol:ba,onEmojiSelect:va}),i.ZP.createElement($r,{isOpen:B.isOpen,isQuiz:B.isQuiz,shouldBeAnonymous:R,onClear:we,onSend:ga}),Ea&&i.ZP.createElement(wr,{isOpen:qt,isSchedule:"scheduled"===I,onClose:Ht,message:Ea}),i.ZP.createElement(zr,{isOpen:Ot,onClose:Dt,chatId:p,selectedSendAsId:ae,sendAsPeerIds:_e,isCurrentUserPremium:Z}),i.ZP.createElement(Tr,{isOpen:fn,filteredUsers:wn,onInsertUserName:vn,onClose:In}),i.ZP.createElement(Lr,{isOpen:Tn,withUsername:Boolean(ee),botCommands:xn,getHtml:xe,onClick:ha,onClose:An}),i.ZP.createElement("div",{id:"message-compose"},i.ZP.createElement("div",{className:"svg-appendix",ref:Ne}),i.ZP.createElement(kr,{isOpen:bn,botId:Pn,isGallery:yn,inlineBotResults:Sn,switchPm:Cn,loadMore:kn,isSavedMessages:M,canSendGifs:tt,isCurrentUserPremium:Z,onSelectResult:ma,onClose:En}),i.ZP.createElement(_r,{onClear:Jn,shouldForceShowEditing:Boolean(qn&&g)}),i.ZP.createElement(Vr,{chatId:p,threadId:f,getHtml:xe,isDisabled:!ot||Qe}),i.ZP.createElement("div",{className:"message-input-wrapper"},Ua&&i.ZP.createElement(Wr,{isOpen:ja,text:de.text,isDisabled:Boolean(Jt),onClick:sa}),Oa&&i.ZP.createElement(br.Z,{className:(0,at.Z)("bot-commands",At&&"activated"),round:!0,disabled:void 0===Q,color:"translucent",onActivate:oa,ariaLabel:"Open bot command keyboard"},i.ZP.createElement("i",{className:"icon-bot-commands-filled"})),De&&(te||ne)&&i.ZP.createElement(_t.Z,{round:!0,color:"translucent",onClick:Ot?Dt:fa,ariaLabel:Te("SendMessageAsTitle"),className:(0,at.Z)("send-as-button",Ye.current&&"appear-animation")},i.ZP.createElement(fs.Z,{user:te,chat:ne,size:"tiny"})),(!ft||tt||et)&&i.ZP.createElement(Xr.Z,{chatId:p,threadId:f,isMobile:m,isReady:d,isSymbolMenuOpen:Lt,openSymbolMenu:Ut,closeSymbolMenu:jt,canSendStickers:et,canSendGifs:tt,onGifSelect:da,onStickerSelect:ua,onCustomEmojiSelect:ra,onRemoveSymbol:wa,onEmojiSelect:Ia,closeBotCommandMenu:Bt,closeSendAsMenu:Dt,isSymbolMenuForced:qe,canSendPlainText:!ft}),i.ZP.createElement(jr.Z,{ref:Ae,id:"message-input-text",editableInputId:o.R2F,chatId:p,canSendPlainText:!ft,threadId:f,isActive:!Qe,getHtml:xe,placeholder:Jt&&Fe<=600?"":ft?Te("Chat.PlaceholderTextNotAllowed"):U||Te("Message"),forcedPlaceholder:Mn,canAutoFocus:d&&y&&!Qe,noFocusInterception:Qe,shouldSuppressFocus:m&&Lt,shouldSuppressTextFormatter:on||fn||bn,onUpdate:Be,onSend:La,onSuppressedFocus:jt}),J&&Boolean(Pn)&&i.ZP.createElement(Gt.Z,{color:"gray"}),j&&i.ZP.createElement(_t.Z,{round:!0,faded:!0,className:"scheduled-button",color:"translucent",onClick:Pa,ariaLabel:"Open scheduled messages"},i.ZP.createElement("i",{className:"icon-schedule"})),Boolean(L)&&!Jt&&!g&&i.ZP.createElement(br.Z,{className:Rt?"activated":"",round:!0,color:"translucent",onActivate:kt,ariaLabel:"Open bot command keyboard"},i.ZP.createElement("i",{className:"icon-bot-command"})),Jt&&Boolean(Qt)&&i.ZP.createElement("span",{className:"recording-state"},(0,re.rM)(Qt-tn.current)),i.ZP.createElement(Rr,{chatId:p,threadId:f,isButtonVisible:!Jt&&!g,canAttachMedia:nt,canAttachPolls:st,canSendPhotos:gt,canSendVideos:ht,canSendDocuments:pt,canSendAudios:mt,onFileSelect:yt,onPollCreate:ve,isScheduled:n,attachBots:le,peerType:ue,theme:he}),Boolean(L)&&i.ZP.createElement(Ur,{messageId:L,isOpen:Rt,onClose:Nt}),Q&&i.ZP.createElement(qr,{isOpen:At,botCommands:Q,onClose:Bt}),i.ZP.createElement(xr.Z,{chatId:p,isOpen:un,onCustomEmojiSelect:hn,addRecentCustomEmoji:Me,onClose:mn}),i.ZP.createElement(Ar,{chatId:p,threadId:f,isOpen:gn,onStickerSelect:ua,onClose:pn}),i.ZP.createElement(Br.Z,{isOpen:on,emojis:cn,customEmojis:dn,addRecentEmoji:ye,addRecentCustomEmoji:Me,onEmojiSelect:ln,onCustomEmojiSelect:ln,onClose:rn}))),Jt&&i.ZP.createElement(_t.Z,{round:!0,color:"danger",className:"cancel",onClick:Yt,ariaLabel:"Cancel voice recording"},i.ZP.createElement("i",{className:"icon-delete"})),i.ZP.createElement(_t.Z,{ref:en,round:!0,color:"secondary",className:(0,at.Z)(Vn,!d&&"not-ready",Jt&&"recording"),disabled:ya,allowDisabledClick:!0,ariaLabel:Te(ka),onClick:Za,onContextMenu:Vn===Yr.Send&&zn?Xn:void 0},i.ZP.createElement("i",{className:"icon-send"}),i.ZP.createElement("i",{className:"icon-schedule"}),i.ZP.createElement("i",{className:"icon-microphone-alt"}),i.ZP.createElement("i",{className:"icon-check"})),zn&&i.ZP.createElement(Nr.Z,{isOpen:Wn,onSendSilent:M?void 0:Aa,onSendSchedule:n?void 0:Na,onClose:Yn,onCloseAnimationEnd:Kn,isSavedMessages:M}),Xe)}))),Jr=(0,i.X$)((e=>{const{isActive:t}=e,n=(0,wt.Z)(it.gl.Extra,"MobileSearch",!t,!0);return n?i.ZP.createElement(n,e):void 0})),Qr=(0,i.X$)((e=>{const{isActive:t}=e,n=(0,wt.Z)(it.gl.Extra,"MessageSelectToolbar",!t);return n?i.ZP.createElement(n,e):void 0})),ec=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,wt.Z)(it.gl.Extra,"UnpinAllMessagesModal",!t);return n?i.ZP.createElement(n,e):void 0})),tc=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,wt.Z)(it.gl.Extra,"SeenByModal",!t);return n?i.ZP.createElement(n,e):void 0})),nc=(0,i.X$)((e=>{const{activeEmojiInteraction:t}=e,n=(0,wt.Z)(it.gl.Extra,"EmojiInteractionAnimation",!t);return n?i.ZP.createElement(n,e):void 0})),ac=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,wt.Z)(it.gl.Extra,"ReactorListModal",!t);return n?i.ZP.createElement(n,e):void 0})),sc=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,wt.Z)(it.gl.Extra,"GiftPremiumModal",!t);return n?i.ZP.createElement(n,e):void 0})),oc=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,wt.Z)(it.gl.Extra,"MessageLanguageModal",!t);return n?i.ZP.createElement(n,e):void 0}));function ic(e){return"file"===e.kind&&e.type&&o.oGt.has(e.type)}const rc=450+o.fK3,cc=(0,i.X$)((0,a.c$)(((e,t)=>{let{isMobile:n}=t;const a=(0,d.Pu)(e),{isBlurred:s,background:i,backgroundColor:c,patternColor:l}=e.settings.themes[a]||{},{messageLists:m,isLeftColumnShown:h,activeEmojiInteractions:g,seenByModal:p,giftPremiumModal:f,reactorModal:I,audioPlayer:v,shouldSkipHistoryAnimations:w,messageLanguageModal:b}=(0,d.jU)(e),P=(0,d.Bt)(e),{chats:{listIds:y},lastSyncTime:Z}=e,C={theme:a,customBackground:i,backgroundColor:c,patternColor:l,isLeftColumnShown:h,isRightColumnShown:(0,d.Jf)(e,n),isBackgroundBlurred:s,hasCurrentTextSearch:Boolean((0,d.n5)(e)),isSelectModeActive:(0,d.CA)(e),isSeenByModalOpen:Boolean(p),isReactorListModalOpen:Boolean(I),isGiftPremiumModalOpen:f?.isOpen,isMessageLanguageModalOpen:Boolean(b),animationLevel:e.settings.byKey.animationLevel,currentTransitionKey:Math.max(0,m.length-1),activeEmojiInteractions:g,lastSyncTime:Z};if(!P||!y.active)return C;const{chatId:S,threadId:E,type:M}=P,R=(0,u.YC)(S),k=(0,d.Z1)(e,S),T=(0,d.IK)(e,S),N=(0,d.KB)(e,S,E),{chatId:A,messageId:x}=v,B=(0,d.tZ)(e,S,E),L=Boolean(B?.originChannelId),U=k&&(0,u.Qm)(k,E,L),j=(0,d.pk)(e,S),O="pinned"===M,F="scheduled"===M,_="thread"===M&&E===r._f,D=Boolean(k&&(0,u.eA)(k)),q=Boolean(k&&_&&(D||(0,u.ZV)(k))&&k.isNotJoined&&!k.joinRequests),$=Boolean(k?.isNotJoined&&k.isJoinToSend),H=Boolean(k?.isNotJoined&&k.isJoinRequest),G=Boolean(T&&(0,d.s4)(e,T.id)),V=!G&&j,z=Boolean(k&&(0,u.Bf)(k)&&!k.fullInfo&&Z),W=(0,d.Yy)(e,S,E),X=!!k?.isForum&&E===r._f&&!W&&k.topics?.[o.OxA]?.isClosed,Y=A&&x?(0,d.hj)(e,A,x):void 0;return{...C,chatId:S,threadId:E,messageListType:M,chat:k,replyingToId:W,isPrivate:R,areChatSettingsLoaded:Boolean(k?.settings),canPost:!O&&(!k||U)&&!j&&!($&&k?.isNotJoined)&&!X,isPinnedMessageList:O,isScheduledMessageList:F,currentUserBannedRights:k?.currentUserBannedRights,defaultBannedRights:k?.defaultBannedRights,hasPinned:E!==r._f&&!k?.isForum||Boolean(!O&&N?.length),hasAudioPlayer:Boolean(Y),pinnedMessagesCount:N?N.length:0,shouldSkipHistoryAnimations:w,isChannel:D,canSubscribe:q,canStartBot:V,canRestartBot:G,shouldJoinToSend:$,shouldSendJoinRequest:H,shouldLoadFullChat:z,pinnedIds:N}}))((e=>{let{chatId:t,threadId:n,messageListType:r,isMobile:c,chat:l,replyingToId:m,isPrivate:h,isPinnedMessageList:g,canPost:p,currentUserBannedRights:f,defaultBannedRights:v,hasPinned:w,hasAudioPlayer:b,pinnedMessagesCount:P,customBackground:y,theme:Z,backgroundColor:S,patternColor:E,isLeftColumnShown:M,isRightColumnShown:R,isBackgroundBlurred:k,hasCurrentTextSearch:T,isSelectModeActive:N,isSeenByModalOpen:A,isReactorListModalOpen:x,isGiftPremiumModalOpen:B,isMessageLanguageModalOpen:L,animationLevel:U,shouldSkipHistoryAnimations:j,currentTransitionKey:O,isChannel:F,areChatSettingsLoaded:_,canSubscribe:D,canStartBot:q,canRestartBot:$,activeEmojiInteractions:H,shouldJoinToSend:G,shouldSendJoinRequest:V,shouldLoadFullChat:z,lastSyncTime:W,pinnedIds:X}=e;const{openChat:Y,openPreviousChat:K,unpinAllMessages:J,loadUser:Q,loadChatSettings:ee,closeLocalTextSearch:te,exitMessageSelectMode:ne,joinChannel:ae,sendBotCommand:se,restartBot:oe,showNotification:ie,loadFullChat:re}=(0,a.Sv)(),{width:ce}=(0,En.Z)(),{isTablet:de}=(0,C.ZP)(),le=(0,Tt.Z)(),[ue,me]=(0,i.eJ)(Zn.t.None),[he,ge]=(0,i.eJ)(),[pe,fe]=(0,i.eJ)(),[Ie,ve]=(0,i.eJ)(!1),we=c&&T,be=c?rc:void 0,Pe=w&&(ce<o.l35||R&&ce>o._mX&&ce<o.QU1||ce>=o.ksF&&ce<o.jT7&&b),ye=(0,Mn.Z)(t,be),Ze=(0,Mn.Z)(n,be),Ce=(0,Mn.Z)(r,be),Se=(0,Mn.Z)(D,be),Ee=(0,Mn.Z)(q,be),Me=(0,Mn.Z)($,be),Re=(0,Mn.Z)(p,be)&&!Me&&!Ee&&!Se&&t!==o.mzl,ke=(0,Mn.Z)(Pe,be),Ue=(0,Mn.Z)(he,be)&&t!==o.mzl,je=(0,Mn.Z)(F,be),Oe=(0,Mn.Z)(G,be),Fe=(0,Mn.Z)(V,be),_e=(0,Rn.Z)(O),De=void 0!==_e&&_e<O?_e:void 0,{isReady:qe,handleOpenEnd:$e,handleSlideStop:He}=function(e,t,n,a,s){const[o,r]=(0,i.eJ)(!s),c=(0,gt.Z)(),d=void 0!==n&&n!==t;return d&&(e?r(!1):c()),(0,lt.Z)((()=>{e||r(!0)}),[e]),(0,vt.Z)((()=>{o||r(!0)}),rc),{isReady:o&&!d,handleOpenEnd:e?function(e){"transform"===e.propertyName&&e.target===e.currentTarget&&r(Boolean(a))}:void 0,handleSlideStop:e?function(){r(!0)}:void 0}}(!j&&U!==o.oBh,O,_e,t,c);(0,i.d4)((()=>t?(0,St.Z)((()=>{Y({id:void 0})})):void 0),[t,Y]),(0,lt.Z)((()=>{me(Zn.t.None),fe(void 0)}),[t]),(0,i.d4)((()=>{const{visualViewport:e}=window;if(!e)return;const t=()=>{e.height!==document.documentElement.clientHeight?document.body.classList.add("keyboard-visible"):document.body.classList.remove("keyboard-visible")};return e.addEventListener("resize",t),()=>{e.removeEventListener("resize",t)}}),[]),(0,i.d4)((()=>{h&&Q({userId:t})}),[t,h,Q]),(0,i.d4)((()=>{!_&&W&&ee({chatId:t})}),[t,h,_,W,ee]),(0,i.d4)((()=>{t&&z&&qe&&re({chatId:t})}),[z,t,qe,re]);const Ge=(0,i.I4)((e=>{const{items:t}=e.dataTransfer||{},n=t&&t.length>0&&Array.from(t).filter((e=>"text/uri-list"!==e.type)).every(ic);me(n?Zn.t.QuickFile:Zn.t.Document)}),[]),Ve=(0,i.I4)((()=>{me(Zn.t.None)}),[]),ze=(0,i.I4)((()=>{ve(!0)}),[]),We=(0,i.I4)((()=>{ve(!1)}),[]),Xe=(0,i.I4)((()=>{J({chatId:t,threadId:n}),We(),K()}),[J,t,n,We,K]),Ye=(0,i.I4)((()=>{Y({id:t})}),[Y,t]),Ke=(0,i.I4)((()=>{ae({chatId:t}),Fe&&ie({message:le(F?"RequestToJoinChannelSentDescription":"RequestToJoinGroupSentDescription")})}),[ae,t,Fe,ie,F,le]),Je=(0,i.I4)((()=>{se({command:"/start"})}),[se]),Qe=(0,i.I4)((()=>{oe({chatId:t})}),[t,oe]),et=((e,t)=>{const[n,a]=(0,i.eJ)(t);return(0,i.d4)((()=>{t&&(t.startsWith("#")?a(t):Cn.fetch(o.foQ,e,Cn.Type.Blob).then((e=>{const t=URL.createObjectURL(e);(0,Sn.pt)(t).then((()=>{a(`url(${t})`)}))})))}),[t,e]),t?n:void 0})(Z,y),{onIntersectionChanged:tt,onFocusPinnedMessage:nt,getCurrentPinnedIndexes:st,getLoadingPinnedId:ot,getForceNextPinnedInHeader:it}=function(e,t,n){const[s,o]=(0,Nn.Z)({}),[r,c]=(0,Nn.Z)(),l=(0,i.sO)(),[u,m]=(0,Nn.Z)(),h=e?`${e}_${t}`:void 0;return(0,i.d4)((()=>{c(void 0),l.current=void 0,m(void 0)}),[e,o,c,m,t]),(0,i.d4)((()=>{if(!h)return;const e=s()[h],t=n?.length||0;e>=t&&o({...s(),[h]:Math.max(0,t-1)})}),[s,h,n?.length,o]),{onIntersectionChanged:(0,i.I4)((i=>{let{viewportPinnedIdsToAdd:g=[],viewportPinnedIdsToRemove:p=[],isReversed:f,hasScrolled:v,isUnmount:w}=i;if(!e||!t||!h)return;const b=(0,a.Rd)();if(!n?.length||!n)return;const P=u();if(P&&!v){const e=n.indexOf(P);o({...s(),[h]:e}),m(void 0)}v&&(c(void 0),m(void 0));const y=r(),Z=l.current;if(w&&0===g.length&&1===p.length&&!Z?.includes(p[0]))return;const C=(0,I.Tw)((Z?.filter((e=>!p.includes(e)))||[]).concat(g));l.current=C;const S=(0,d.G$)(b,e);if(!C.length&&w&&S&&!n.includes(S)){const e=n.find((e=>e<S));if(e){const t=n.indexOf(e);o({...s(),[h]:t})}}if(y||w)return;const E=Math.max(...C),M=n.findIndex((e=>e===E)),R=f?0:1,k=C.length?M:Z?.length?(0,kn.uZ)(n.indexOf(Z[0])+R,0,n.length-1):0;o({...s(),[h]:k})}),[e,t,h,n,u,r,o,s,m,c]),onFocusPinnedMessage:(0,i.I4)((i=>{if(!e||!t||!h||u())return!1;const r=(0,a.Rd)();if(!n?.length)return!1;const l=n.indexOf(i),g=(0,Tn.Z)(n.length,l+1);c(!0);const p=(0,d.gb)(r,e,t);return p?.includes(i)||(0,d.of)(r,e,t,i)?(o({...s(),[h]:g}),!0):(m(n[g]),!0)}),[e,s,u,h,n,o,c,m,t]),getCurrentPinnedIndexes:s,getLoadingPinnedId:u,getForceNextPinnedInHeader:r}}(t,n,X),rt=(0,at.Z)(ke&&"has-header-tools",s.aZ?"mask-image-disabled":"mask-image-enabled"),ct=(0,at.Z)("ON5E8MkEVA1mAlkuIxhG","OWFg9Wf1uioPWDz_IgS8",y&&"Ik9ZZlj3eKtKXRrUZKVk",S&&"avVozLQe3SaWcSkIt6pG",y&&k&&"Tipa66fYcSvl6w0587Xz",R&&"vhOr8s3T_LCKSt2BF7fs"),dt=(0,at.Z)("messaging-disabled",!N&&"shown"),ut=(0,u.q8)(le,f,v),mt=(0,u.mt)(le,l,n,Boolean(m)),ht=ut||mt,{composerHiddenScale:pt,toolbarHiddenScale:ft,composerTranslateX:It,toolbarTranslateX:wt,unpinHiddenScale:bt,toolbarForUnpinHiddenScale:Pt}=(0,i.Ye)((()=>function(e,t){const n=e<=o.l35?Te.Gw:2*Te.Gw,a=function(e){if(e>o._mX){const t=Math.min(Math.max(.25*e,Be),xe),n=Math.min(.25*e,xe);return Math.min(e-t-n,Ae)}if(e>o.ksF){const t=Math.min(Math.max(.4*e,Be),xe);return Math.min(e-t,Ae)}return e>Ae?Ae:e}(e),s=e<=o.l35?3.375*Te.Gw:4*Te.Gw,i=t?a-n-s:a-n,r=e>o.l35?Math.min(a-n,Ne):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/Le,toolbarForUnpinHiddenScale:Le/r}}(ce,Re)),[Re,ce]),yt=(0,at.Z)("middle-column-footer",!Re&&"no-composer",Re&&pe&&!N&&"with-notch");(0,an.Z)({isActive:N,onBack:ne}),(0,an.Z)({isActive:we,onBack:te});const Zt=Boolean(!g&&!Re&&!Me&&!Ee&&!Se&&ht),Ct=Boolean(Me||Se||Fe||Ee||g),Et=Boolean(Zt||N||g);return i.ZP.createElement("div",{id:"MiddleColumn",className:rt,onTransitionEnd:$e,style:`\n --composer-hidden-scale: ${pt};\n --toolbar-hidden-scale: ${ft};\n --unpin-hidden-scale: ${bt};\n --toolbar-unpin-hidden-scale: ${Pt};\n --composer-translate-x: ${It}px;\n --toolbar-translate-x: ${wt}px;\n --pattern-color: ${E};\n --theme-background-color:\n ${S||("dark"===Z?o.Itv:o.p3h)};\n `,onClick:de&&M?Ye:void 0},i.ZP.createElement("div",{className:ct,style:et?`--custom-background: ${et}`:void 0}),i.ZP.createElement("div",{id:"middle-column-portals"}),ye&&Ze&&i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement("div",{className:"messages-layout",onDragEnter:Re?Ge:void 0},i.ZP.createElement(va,{chatId:ye,threadId:Ze,messageListType:Ce,isReady:qe,isMobile:c,getCurrentPinnedIndexes:st,getLoadingPinnedId:ot,onFocusPinnedMessage:nt}),i.ZP.createElement(kt.Z,{name:j?"none":U===o.zy8?"slide":"fade",activeKey:O,shouldCleanup:!0,cleanupExceptionKey:De,onStop:He},i.ZP.createElement(ri,{key:`${ye}-${Ze}-${Ce}`,chatId:ye,threadId:Ze,type:Ce,canPost:Re,hasTools:ke,onFabToggle:ge,onNotchToggle:fe,isReady:qe,withBottomShift:Ct,withDefaultBg:Boolean(!y&&!S),onPinnedIntersectionChange:tt,getForceNextPinnedInHeader:it}),i.ZP.createElement("div",{className:yt},Re&&i.ZP.createElement(Kr,{chatId:ye,threadId:Ze,messageListType:Ce,dropAreaState:ue,onDropHide:Ve,isReady:qe,isMobile:c}),g&&i.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:le.isRtl?"rtl":void 0},i.ZP.createElement(_t.Z,{size:"tiny",fluid:!0,color:"secondary",className:"unpin-all-button",onClick:ze},i.ZP.createElement("i",{className:"icon-unpin"}),i.ZP.createElement("span",null,le("Chat.Pinned.UnpinAll",P,"i")))),Zt&&i.ZP.createElement("div",{className:dt},i.ZP.createElement("div",{className:"messaging-disabled-inner"},i.ZP.createElement("span",null,ht))),c&&(Se||Oe&&!Fe)&&i.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:le.isRtl?"rtl":void 0},i.ZP.createElement(_t.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:Ke},le(je?"ProfileJoinChannel":"ProfileJoinGroup"))),c&&Fe&&i.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:le.isRtl?"rtl":void 0},i.ZP.createElement(_t.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:Ke},le("ChannelJoinRequest"))),c&&Ee&&i.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:le.isRtl?"rtl":void 0},i.ZP.createElement(_t.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:Je},le("BotStart"))),c&&Me&&i.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:le.isRtl?"rtl":void 0},i.ZP.createElement(_t.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:Qe},le("BotRestart"))),i.ZP.createElement(Qr,{messageListType:Ce,isActive:N,canPost:Re}),i.ZP.createElement(tc,{isOpen:A}),i.ZP.createElement(ac,{isOpen:x}),i.ZP.createElement(oc,{isOpen:L}))),i.ZP.createElement(li,{isShown:Ue,canPost:Re,withExtraShift:Et})),c&&i.ZP.createElement(Jr,{isActive:Boolean(we)})),t&&i.ZP.createElement(ec,{isOpen:Ie,chatId:t,pinnedMessagesCount:P,onClose:We,onUnpin:Xe}),i.ZP.createElement("div",{teactFastList:!0},H?.map(((e,t)=>i.ZP.createElement(nc,{teactOrderKey:t,key:e.id,activeEmojiInteraction:e})))),i.ZP.createElement(sc,{isOpen:B}))}))),dc=450+o.fK3,lc=(0,A.Ds)((e=>e()),200,!1);var uc=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}(uc||{});const mc=(0,i.X$)((0,a.c$)(((e,t)=>{let{chatId:n,isProfile:a,isManagement:s,threadId:o}=t;const i=(0,d.jU)(e),{query:c}=(0,d.n5)(e)||{},{query:l}=(0,d.y5)(e)||{},{query:m}=(0,d.yN)(e)||{},h=n?(0,d.Z1)(e,n):void 0,g=a&&n&&(0,u.YC)(n)?(0,d.dy)(e,n):void 0,p=h&&(0,u.eA)(h),f=h?.isForum&&Boolean(o&&o!==r._f),I=f?h.topics?.[o]:void 0,v=f&&I&&(0,u.GU)(h,I),w=g&&(0,u.cS)(g),b=g&&(0,u.kw)(g),P=Boolean(!s&&a&&!b&&h&&!(0,d.FM)(e,h.id)&&((0,u.YC)(h.id)||((0,u.Nl)(h)||h.isCreator)&&!h.isNotJoined)),y=Boolean(n&&i.management.byChatId[n]?.editingInvite),Z=!f&&h?.fullInfo?.canViewStatistics,C=n?i.management.byChatId[n]?.inviteInfo?.invite:void 0;return{canManage:P,canAddContact:b,canViewStatistics:Z,isChannel:p,isBot:w,isInsideTopic:f,canEditTopic:v,userId:g?.id,messageSearchQuery:c,stickerSearchQuery:l,gifSearchQuery:m,isEditingInvite:y,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:m,isGifSearch:h,isPollResults:g,isCreatingTopic:p,isEditingTopic:I,isAddingChatMembers:v,profileState:w,managementScreen:b,canAddContact:P,userId:y,canManage:Z,isChannel:S,onClose:E,onScreenSelect:M,messageSearchQuery:R,stickerSearchQuery:k,gifSearchQuery:T,isEditingInvite:N,canViewStatistics:A,currentInviteInfo:x,shouldSkipHistoryAnimations:B,isBot:L,isInsideTopic:U,canEditTopic:j}=e;const{setLocalTextSearchQuery:O,setStickerSearchQuery:F,setGifSearchQuery:_,searchTextMessagesLocal:D,toggleManagement:q,openHistoryCalendar:$,openAddContactDialog:H,toggleStatistics:G,setEditingExportedInvite:V,deleteExportedChatInvite:z,openEditTopicPanel:W}=(0,a.Sv)(),[X,Y,K]=(0,Mt.Z)(),{isMobile:J}=(0,C.ZP)(),Q=(0,i.I4)((()=>{V({chatId:n,invite:x}),M(f.u1.EditInvite)}),[n,x,M,V]),ee=(0,i.I4)((()=>{z({chatId:n,link:x.link}),M(f.u1.Invites),K()}),[n,K,x,z,M]),te=(0,i.I4)((e=>{O({query:e}),e.length&&lc(D)}),[D,O]),ne=(0,i.I4)((e=>{F({query:e})}),[F]),ae=(0,i.I4)((e=>{_({query:e})}),[_]),se=(0,i.I4)((()=>{H({userId:y})}),[H,y]),oe=(0,i.I4)((()=>{n&&s&&W({chatId:n,topicId:s})}),[n,W,s]),ie=(0,i.I4)((()=>{q()}),[q]),ce=(0,i.I4)((()=>{G()}),[G]),[de,le]=(0,i.eJ)(!o);(0,i.d4)((()=>{setTimeout((()=>{le(!o)}),dc)}),[o]);const ue=(0,Tt.Z)(),me=r?w===f.vi.Profile?uc.Profile:w===f.vi.SharedMedia?uc.SharedMedia:w===f.vi.MemberList?uc.MemberList:-1:c?uc.Search:g?uc.PollResults:m?uc.StickerSearch:h?uc.GifSearch:v?uc.AddingMembers:d?b===f.u1.Initial?uc.ManageInitial:b===f.u1.ChatPrivacyType?uc.ManageChatPrivacyType:b===f.u1.Discussion?uc.ManageDiscussion:b===f.u1.ChannelSubscribers?uc.ManageChannelSubscribers:b===f.u1.GroupPermissions?uc.ManageGroupPermissions:b===f.u1.ChatAdministrators?uc.ManageChatAdministrators:b===f.u1.GroupRemovedUsers?uc.ManageGroupRemovedUsers:b===f.u1.ChannelRemovedUsers?uc.ManageChannelRemovedUsers:b===f.u1.GroupUserPermissionsCreate?uc.ManageGroupUserPermissionsCreate:b===f.u1.GroupUserPermissions?uc.ManageGroupUserPermissions:b===f.u1.GroupRecentActions?uc.ManageGroupRecentActions:b===f.u1.ChatAdminRights?uc.ManageGroupAdminRights:b===f.u1.ChatNewAdminRights?uc.ManageGroupNewAdminRights:b===f.u1.GroupMembers?uc.ManageGroupMembers:b===f.u1.Invites?uc.ManageInvites:b===f.u1.EditInvite?uc.ManageEditInvite:b===f.u1.GroupAddAdmins?uc.ManageGroupAddAdmins:b===f.u1.Reactions?uc.ManageReactions:b===f.u1.InviteInfo?uc.ManageInviteInfo:b===f.u1.JoinRequests?uc.ManageJoinRequests:void 0:l?uc.Statistics:u?uc.MessageStatistics:p?uc.CreateTopic:I?uc.EditTopic:void 0,he=null!==(t=(0,xn.Z)(me,!0))&&void 0!==t?t:-1,ge=J||me===uc.SharedMedia||me===uc.MemberList||me===uc.AddingMembers||me===uc.MessageStatistics||d,pe=(0,at.Z)("animated-close-icon",ge&&"state-back",(de||B)&&"no-transition");return i.ZP.createElement("div",{className:"RightHeader"},i.ZP.createElement(_t.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(kt.Z,{name:de||B?"none":"slide-fade",activeKey:he},function(){if(-1!==he)switch(he){case uc.PollResults:return i.ZP.createElement("h3",null,ue("PollResults"));case uc.Search:return i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement(Dt.Z,{parentContainerClassName:"RightSearch",value:R,onChange:te}),i.ZP.createElement(_t.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-calendar"})));case uc.AddingMembers:return i.ZP.createElement("h3",null,ue(S?"ChannelAddSubscribers":"GroupAddMembers"));case uc.ManageInitial:return i.ZP.createElement("h3",null,ue("Edit"));case uc.ManageChatPrivacyType:return i.ZP.createElement("h3",null,ue(S?"ChannelTypeHeader":"GroupTypeHeader"));case uc.ManageDiscussion:return i.ZP.createElement("h3",null,ue("Discussion"));case uc.ManageChatAdministrators:return i.ZP.createElement("h3",null,ue("ChannelAdministrators"));case uc.ManageGroupRecentActions:return i.ZP.createElement("h3",null,ue("Group.Info.AdminLog"));case uc.ManageGroupAdminRights:return i.ZP.createElement("h3",null,ue("EditAdminRights"));case uc.ManageGroupNewAdminRights:return i.ZP.createElement("h3",null,ue("SetAsAdmin"));case uc.ManageGroupPermissions:return i.ZP.createElement("h3",null,ue("ChannelPermissions"));case uc.ManageGroupRemovedUsers:return i.ZP.createElement("h3",null,ue("BlockedUsers"));case uc.ManageChannelRemovedUsers:return i.ZP.createElement("h3",null,ue("ChannelBlockedUsers"));case uc.ManageGroupUserPermissionsCreate:return i.ZP.createElement("h3",null,ue("ChannelAddException"));case uc.ManageGroupUserPermissions:return i.ZP.createElement("h3",null,ue("UserRestrictions"));case uc.ManageInvites:return i.ZP.createElement("h3",null,ue("lng_group_invite_title"));case uc.ManageEditInvite:return i.ZP.createElement("h3",null,ue(N?"EditLink":"NewLink"));case uc.ManageInviteInfo:return i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement("h3",null,ue("InviteLink")),i.ZP.createElement("section",{className:"tools"},x&&!x.isRevoked&&i.ZP.createElement(_t.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:ue("Edit"),onClick:Q},i.ZP.createElement("i",{className:"icon-edit"})),x&&x.isRevoked&&i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement(_t.Z,{round:!0,color:"danger",size:"smaller",ariaLabel:ue("Delete"),onClick:Y},i.ZP.createElement("i",{className:"icon-delete"})),i.ZP.createElement(qn.Z,{isOpen:X,onClose:K,title:ue("DeleteLink"),text:ue("DeleteLinkHelp"),confirmIsDestructive:!0,confirmLabel:ue("Delete"),confirmHandler:ee}))));case uc.ManageJoinRequests:return i.ZP.createElement("h3",null,ue(S?"SubscribeRequests":"MemberRequests"));case uc.ManageGroupAddAdmins:return i.ZP.createElement("h3",null,ue("Channel.Management.AddModerator"));case uc.StickerSearch:return i.ZP.createElement(Dt.Z,{value:k,placeholder:ue("SearchStickersHint"),autoFocusSearch:!0,onChange:ne});case uc.GifSearch:return i.ZP.createElement(Dt.Z,{value:T,placeholder:ue("SearchGifsTitle"),autoFocusSearch:!0,onChange:ae});case uc.Statistics:return i.ZP.createElement("h3",null,ue(S?"ChannelStats.Title":"GroupStats.Title"));case uc.MessageStatistics:return i.ZP.createElement("h3",null,ue("Stats.MessageTitle"));case uc.SharedMedia:return i.ZP.createElement("h3",null,ue("SharedMedia"));case uc.ManageChannelSubscribers:return i.ZP.createElement("h3",null,ue("ChannelSubscribers"));case uc.MemberList:case uc.ManageGroupMembers:return i.ZP.createElement("h3",null,ue("GroupMembers"));case uc.ManageReactions:return i.ZP.createElement("h3",null,ue("Reactions"));case uc.CreateTopic:return i.ZP.createElement("h3",null,ue("NewTopic"));case uc.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":S?"Channel.TitleInfo":y?L?"lng_info_bot_title":"lng_info_user_title":"GroupInfo.Title")),i.ZP.createElement("section",{className:"tools"},P&&i.ZP.createElement(_t.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:ue("AddContact"),onClick:se},i.ZP.createElement("i",{className:"icon-add-user"})),Z&&!U&&i.ZP.createElement(_t.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:ue("Edit"),onClick:ie},i.ZP.createElement("i",{className:"icon-edit"})),j&&i.ZP.createElement(_t.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:ue("EditTopic"),onClick:oe},i.ZP.createElement("i",{className:"icon-edit"})),A&&i.ZP.createElement(_t.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:ue("Statistics"),onClick:ce},i.ZP.createElement("i",{className:"icon-stats"}))))}}()))})));var hc=n(91);var gc=n(27407);function pc(e,t,n,a){const[s,i]=(0,gc.Z)(n?t:void 0,a,void 0,o.Vk);return[s,i,!(!s||!a||s[0]===a[0])]}function fc(e,t,n,a,s,r,c){const d=(0,i.sO)();(0,lt.Z)((()=>{d.current=void 0}),[c]),(0,lt.Z)((()=>{t===e&&s&&r&&(d.current=(0,u.R5)(s,r,e))}),[s,r,t,e]);const[l,m]=(0,gc.Z)(a?n:void 0,d.current,void 0,"media"===e?o.ENB:o.pnA);return[l,m,!(!l||!d.current||l[0]===d.current[0])]}const Ic=(0,A.P2)((e=>e()),250,!1);let vc=!1;var wc=n(21273),bc=n(31876),Pc=n(16568),yc=n(70180),Zc=n(13709),Cc=n(45418),Sc=n(47262),Ec=n(41151),Mc=n(22275);const Rc=[{type:"media",title:"SharedMediaTab2"},{type:"documents",title:"SharedFilesTab2"},{type:"links",title:"SharedLinksTab2"},{type:"audio",title:"SharedMusicTab2"}];function kc(e){return[`.shared-media-transition > div:only-child > .${e}-list > .scroll-item`,`.shared-media-transition > .Transition__slide--active > .${e}-list > .scroll-item`].join(", ")}const Tc=(0,i.X$)((0,a.c$)(((e,t)=>{let{chatId:n,topicId:a,isMobile:s}=t;const o=(0,d.Z1)(e,n),i=(0,d.Zw)(e,n),{currentType:r,resultsByType:c}=(0,d.we)(e)||{},{foundIds:l}=c&&r&&c[r]||{},{byId:m,statusesById:h}=e.users,{byId:g}=e.chats,p=o&&(0,u.Bf)(o),f=o&&(0,u.eA)(o),I=!a&&(p||f&&(0,u.Nl)(o)),v=o?.fullInfo?.members,w=o?.fullInfo?.adminMembersById,b=I&&o&&(o.isForbidden||o.fullInfo&&!o.fullInfo.canViewMembers),P=I&&o&&((0,u.VE)(o,"inviteUsers")||!(0,u.Mg)(o,"inviteUsers")||o.isCreator),y=I&&o&&((0,u.VE)(o,"banUsers")||o.isCreator),Z=(0,d.xs)(e,n);let C,S,E;return(0,u.YC)(n)&&(S=n,E=(0,d.dy)(e,S),C=E&&!E.isSelf&&!(0,u.cS)(E)),{theme:(0,d.Pu)(e),isChannel:f,resolvedUserId:S,messagesById:i,foundIds:l,mediaSearchType:r,hasCommonChatsTab:C,hasMembersTab:I,areMembersHidden:b,canAddMembers:P,canDeleteMembers:y,currentUserId:e.currentUserId,isRightColumnShown:(0,d.Jf)(e,s),isRestricted:o?.isRestricted,lastSyncTime:e.lastSyncTime,activeDownloadIds:Z,usersById:m,userStatusesById:h,chatsById:g,isChatProtected:o?.isProtected,...I&&v&&{members:v,adminMembersById:w},...C&&E&&{commonChatIds:E.commonChats?.ids}}}))((e=>{let{chatId:t,topicId:n,profileState:c,onProfileStateChange:d,theme:l,isChannel:m,resolvedUserId:h,currentUserId:g,messagesById:p,foundIds:I,mediaSearchType:v,hasCommonChatsTab:w,hasMembersTab:b,areMembersHidden:P,canAddMembers:y,canDeleteMembers:Z,commonChatIds:C,members:S,adminMembersById:E,usersById:M,userStatusesById:R,chatsById:k,isRightColumnShown:T,isRestricted:N,lastSyncTime:A,activeDownloadIds:x,isChatProtected:B}=e;const{setLocalMediaSearchType:L,loadMoreMembers:U,loadCommonChats:j,openChat:O,searchMediaMessagesLocal:F,openMediaViewer:_,openAudioPlayer:D,focusMessage:q,loadProfilePhotos:$,setNewChatMembersDialogState:H}=(0,a.Sv)(),G=(0,i.sO)(null),V=(0,i.sO)(null),z=(0,Tt.Z)(),[W,X]=(0,i.eJ)(0),[Y,K]=(0,i.eJ)(),J=(0,i.Ye)((()=>[...b?[{type:"members",title:m?"ChannelSubscribers":"GroupMembers"}]:[],...Rc,...n?[]:[{type:"voice",title:"SharedVoiceTab2"}],...w?[{type:"commonChats",title:"SharedGroupsTab2"}]:[]]),[w,b,m,n]),Q=W>J.length-1?J.length-1:W,ee=J[Q].type,[te,ne,ae,se]=function(e,t,n,a,s,o,r,c,d,l,m,h,g,p){const f="members"!==a&&s?s:a,I=(0,i.Ye)((()=>{if(o&&c&&d)return(0,u.Z0)(o.map((e=>{let{userId:t}=e;return t})),c,d)}),[o,c,d]),v=(0,i.Ye)((()=>{if(r&&l)return(0,u.ih)(r,l,!0)}),[l,r]),[w,b,P]=pc(0,e,g,I),[y,Z,C]=fc("media",f,n,g,m,h,p),[S,E,M]=fc("documents",f,n,g,m,h,p),[R,k,T]=fc("links",f,n,g,m,h,p),[N,A,x]=fc("audio",f,n,g,m,h,p),[B,L,U]=fc("voice",f,n,g,m,h,p),[j,O,F]=pc(0,t,g,v);let _,D,q=!1;switch(f){case"members":_=w,D=b,q=P;break;case"commonChats":_=j,D=O,q=F;break;case"media":_=y,D=Z,q=C;break;case"documents":_=S,D=E,q=M;break;case"links":_=R,D=k,q=T;break;case"audio":_=N,D=A,q=x;break;case"voice":_=B,D=L,q=U}return[f,_,D,q]}(U,j,F,ee,v,S,C,M,R,k,p,I,A,n),oe="members"===te||!b&&"media"===te,ie=J.findIndex((e=>{let{type:t}=e;return t===te})),{handleScroll:re}=function(e,t,n,a){(0,rt.Z)((n=>{let[s]=n;if(s&&s!==t){const n=e.current,s=n.querySelector(".TabList");n.scrollTop<s.offsetTop&&(a("members"===t?f.vi.MemberList:f.vi.SharedMedia),vc=!0,(0,Ca.Z)(n,s,"start",void 0,void 0,void 0,300),setTimeout((()=>{vc=!1}),350))}}),[t,a,e]),(0,rt.Z)((t=>{let[s]=t;if(n!==f.vi.Profile||n===s)return;const o=e.current;if(!o)return;const i=o.querySelector(".TabList");!i||i.offsetTop>o.scrollTop||(vc=!0,(0,Ca.Z)(o,o.firstElementChild,"start",void 0,2*o.offsetHeight),setTimeout((()=>{vc=!1}),350),a(n))}),[n,e,a]);const s=(0,i.I4)((()=>{const n=e.current;if(!n)return;const s=n.querySelector(".TabList");if(!s)return;let o=f.vi.Profile;n.scrollTop>=s.offsetTop&&(o="members"===t?f.vi.MemberList:f.vi.SharedMedia),a(o)}),[e,a,t]);return(0,i.d4)((()=>{vc||s()}),[s,t]),{handleScroll:(0,i.I4)((()=>{vc||Ic(s)}),[s])}}(G,te,c,d),{applyTransitionFix:ce,releaseTransitionFix:de}=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:".Transition.shared-media-transition";return(0,i.d4)((()=>{function n(){const n=e.current,a=n.querySelector(t),s=n.querySelector(".TabList");a&&s&&(a.style.minHeight=n.offsetHeight-s.offsetHeight+"px")}return n(),window.addEventListener("resize",n,!1),()=>{window.removeEventListener("resize",n,!1)}}),[e,t]),{applyTransitionFix:(0,i.I4)((()=>{const t=e.current;if("hidden"!==t.style.overflowY){const e=t.offsetWidth-t.clientWidth;t.style.overflowY="hidden",t.style.marginRight=`${e}px`}}),[e]),releaseTransitionFix:(0,i.I4)((()=>{const t=e.current;t.style.overflowY="scroll",t.style.marginRight="0"}),[e])}}(G),[le,ue]=(()=>{const[e,t]=(0,i.eJ)(0);return[e,(0,i.I4)((()=>{t((e=>e+1))}),[])]})(),{observe:me}=(0,Aa.S1)({rootRef:G,throttleMs:500}),he=(0,i.I4)((()=>{de(),ue()}),[de,ue]),ge=(0,i.I4)((()=>{H({newChatMembersProgress:f.WB.InProgress})}),[H]);(0,i.d4)((()=>{L({mediaType:ee})}),[L,ee,n]);const pe=h||t;(0,i.d4)((()=>{A&&$({profileId:pe})}),[$,pe,A]);const fe=(0,i.I4)((e=>{_({chatId:pe,threadId:r._f,mediaId:e,origin:f.bZ.SharedMedia})}),[pe,_]),Ie=(0,i.I4)((e=>{D({chatId:pe,messageId:e})}),[pe,D]),ve=(0,i.I4)((e=>{O({id:e})}),[O]),we=(0,i.I4)((e=>{q({chatId:pe,messageId:e})}),[pe,q]),be=(0,i.I4)((()=>{K(void 0)}),[]);let Pe;(0,rt.Z)((e=>{let[t]=e;if(0===W||t===b)return;const n=W+(b?1:-1);X(Math.min(n,J.length-1))}),[b,W,J]),(0,i.d4)((()=>{if(V.current&&s.$b)return(0,nn.sf)(V.current,{selectorToPreventScroll:".Profile",onSwipe:(e,t)=>t===nn.eM.Left?(X(Math.min(Q+1,J.length-1)),!0):t===nn.eM.Right&&(X(Math.max(0,Q-1)),!0)})}),[Q,J.length]),oe?Pe=T?0:1e3:ne||(Pe=o.Yan);const ye=(0,_n.Z)([t,n,te,Q],Pe);return i.ZP.createElement(wc.Z,{ref:G,className:"Profile custom-scroll",itemSelector:kc(te),items:ye?ne:void 0,cacheBuster:le,sensitiveArea:o.qUX,preloadBackwards:ye?"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(Pc.Z,{userId:t||e,canPlayVideo:n}),i.ZP.createElement(yc.Z,{chatOrUserId:t||e}))}(t,h,T&&ye),!N&&i.ZP.createElement("div",{className:"shared-media"},i.ZP.createElement(kt.Z,{ref:V,name:z.isRtl?"slide-optimized-rtl":"slide-optimized",activeKey:ie,renderCount:J.length,shouldRestoreHeight:!0,className:"shared-media-transition",onStart:ce,onStop:he},function(){if(!ne||!ye||!p){const e=oe&&!ye,t=Boolean("members"===te&&P);return i.ZP.createElement("div",{className:"content empty-list"},!e&&!t&&i.ZP.createElement(Gt.Z,null),t&&i.ZP.createElement(Sc.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=z("NoGroupsInCommon");break;case"documents":e=z("lng_media_file_empty");break;case"links":e=z("lng_media_link_empty");break;case"audio":e=z("lng_media_song_empty");break;case"voice":e=z("lng_media_audio_empty");break;default:e=z("SharedMedia.EmptyTitle")}return i.ZP.createElement("div",{className:"content empty-list"},i.ZP.createElement(Sc.Z,{text:e}))}return i.ZP.createElement("div",{className:`content ${te}-list`,dir:z.isRtl&&"media"===te?"rtl":void 0,teactFastList:!0},"media"===te?ne.map((e=>p[e]&&i.ZP.createElement(Zc.Z,{key:e,message:p[e],isProtected:B||p[e].isProtected,observeIntersection:me,onClick:fe}))):"documents"===te?ne.map((e=>p[e]&&i.ZP.createElement(Cs.Z,{key:e,message:p[e],withDate:!0,smaller:!0,className:"scroll-item",isDownloading:x.includes(e),observeIntersection:me,onDateClick:we}))):"links"===te?ne.map((e=>p[e]&&i.ZP.createElement(Cc.Z,{key:e,message:p[e],isProtected:B||p[e].isProtected,observeIntersection:me,onMessageClick:we}))):"audio"===te?ne.map((e=>p[e]&&i.ZP.createElement(Ss.ZP,{key:e,theme:l,message:p[e],origin:f.Cr.SharedMedia,date:p[e].date,lastSyncTime:A,className:"scroll-item",onPlay:Ie,onDateClick:we,canDownload:!B&&!p[e].isProtected,isDownloading:x.includes(e)}))):"voice"===te?ne.map((e=>p[e]&&i.ZP.createElement(Ss.ZP,{key:e,theme:l,message:p[e],senderTitle:(0,hc.F)(z,p[e],k,M),origin:f.Cr.SharedMedia,date:p[e].date,lastSyncTime:A,className:"scroll-item",onPlay:Ie,onDateClick:we,canDownload:!B&&!p[e].isProtected,isDownloading:x.includes(e)}))):"members"===te?ne.map(((e,t)=>{return i.ZP.createElement(bc.Z,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item small-icon",onClick:()=>ve(e),contextActions:(n=e,n!==g&&Z?[{title:z("lng_context_remove_from_group"),icon:"stop",handler:()=>{K(n)}}]:void 0)},i.ZP.createElement(Ln.Z,{userId:e,adminMember:E?.[e],forceShowSelf:!0}));var n})):"commonChats"===te?ne.map(((e,t)=>i.ZP.createElement(bc.Z,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item small-icon",onClick:()=>O({id:e})},i.ZP.createElement(Un.Z,{chatId:e})))):void 0)}()),i.ZP.createElement(sn.Z,{big:!0,activeTab:Q,tabs:J,onSwitchTab:X})),y&&i.ZP.createElement(Ec.Z,{isShown:"members"===te,onClick:ge,ariaLabel:z("lng_channel_add_users")},i.ZP.createElement("i",{className:"icon-add-user-filled"})),Z&&i.ZP.createElement(Mc.Z,{isOpen:Boolean(Y),userId:Y,onClose:be}))}))),Nc=(0,i.X$)((e=>{const t=(0,wt.Z)(it.gl.Extra,"RightSearch");return t?i.ZP.createElement(t,e):i.ZP.createElement(cn.Z,null)})),Ac=(0,i.X$)((e=>{const t=(0,wt.Z)(it.gl.Extra,"Management");return t?i.ZP.createElement(t,e):i.ZP.createElement(cn.Z,null)})),xc=e=>{const t=(0,wt.Z)(it.gl.Extra,"Statistics");return t?i.ZP.createElement(t,e):i.ZP.createElement(cn.Z,null)},Bc=e=>{const t=(0,wt.Z)(it.gl.Extra,"MessageStatistics");return t?i.ZP.createElement(t,e):i.ZP.createElement(cn.Z,null)},Lc=(0,i.X$)((()=>{const e=(0,wt.Z)(it.gl.Extra,"StickerSearch");return e?i.ZP.createElement(e,null):i.ZP.createElement(cn.Z,null)})),Uc=(0,i.X$)((()=>{const e=(0,wt.Z)(it.gl.Extra,"GifSearch");return e?i.ZP.createElement(e,null):i.ZP.createElement(cn.Z,null)})),jc=(0,i.X$)((()=>{const e=(0,wt.Z)(it.gl.Extra,"PollResults");return e?i.ZP.createElement(e,null):i.ZP.createElement(cn.Z,null)}));var Oc=n(11820);const Fc=(0,i.X$)((0,a.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,d.Z1)(e,n),{userIds:s}=e.contactList||{},{byId:o}=e.chats,{newChatMembersProgress:i}=(0,d.jU)(e),{currentUserId:r}=e,c=a&&(0,u.eA)(a),{query:l,fetchingStatus:m,globalUserIds:h,localUserIds:g}=(0,d.jU)(e).userSearch;return{isChannel:c,members:a?.fullInfo?.members,currentUserId:r,chatsById:o,localContactIds:s,searchQuery:l,isSearching:m,isLoading:i===f.WB.Loading,globalUserIds:h,localUserIds:g}}))((e=>{let{isChannel:t,members:n,onNextStep:s,currentUserId:o,chatsById:r,localContactIds:c,isLoading:d,searchQuery:l,isSearching:m,localUserIds:h,globalUserIds:g,onClose:p,isActive:f}=e;const{setUserSearchQuery:v}=(0,a.Sv)(),w=(0,Tt.Z)(),[b,P]=(0,i.eJ)([]),y=(0,Rn.Z)(b)===b;(0,an.Z)({isActive:f,onBack:p});const Z=(0,i.Ye)((()=>n?n.map((e=>e.userId)):[]),[n]),C=(0,i.I4)((e=>{v({query:e})}),[v]),S=(0,i.Ye)((()=>{const e=(0,a.Rd)().users.byId,n=c?(0,u.kK)(c,e,l):[];return(0,u.ih)((0,I.Tw)([...n,...h||[],...g||[]]).filter((n=>{const a=e[n];return!Z.includes(n)&&n!==o&&(!a||!(0,u.cS)(a)||!t&&a.canBeInvitedToGroup)})),r)}),[c,r,l,h,g,o,Z,t]),E=(0,i.I4)((()=>{b.length&&(v({query:""}),s(b))}),[b,v,s]);return i.ZP.createElement("div",{className:"AddChatMembers"},i.ZP.createElement("div",{className:"AddChatMembers-inner"},i.ZP.createElement(Oc.Z,{itemIds:S,selectedIds:b,filterValue:l,filterPlaceholder:w("lng_channel_add_users"),searchInputId:"new-members-picker-search",isLoading:m,onSelectedIdsChange:P,onFilterChange:C,noScrollRestore:y}),i.ZP.createElement(Ec.Z,{isShown:Boolean(b.length),disabled:d,ariaLabel:w("lng_channel_add_users"),onClick:E},d?i.ZP.createElement(Gt.Z,{color:"white"}):i.ZP.createElement("i",{className:"icon-arrow-right"}))))}))),_c=(0,i.X$)((e=>{const t=(0,wt.Z)(it.gl.Extra,"CreateTopic");return t?i.ZP.createElement(t,e):i.ZP.createElement(cn.Z,null)})),Dc=(0,i.X$)((e=>{const t=(0,wt.Z)(it.gl.Extra,"EditTopic");return t?i.ZP.createElement(t,e):i.ZP.createElement(cn.Z,null)})),qc=450+o.fK3,$c=Object.keys(f.qt).length/2,Hc=Object.keys(f.u1).length/2;function Gc(){const e=document.querySelector(".RightHeader .SearchInput input");e&&e.blur()}const Vc=(0,i.X$)((0,a.c$)(((e,t)=>{let{isMobile:n}=t;const{chatId:a,threadId:s}=(0,d.Bt)(e)||{},o=(0,d.g4)(e),{management:i,shouldSkipHistoryAnimations:c}=(0,d.jU)(e),l=a?i.byChatId[a]?.nextScreen:void 0,u=(a?(0,d.Z1)(e,a)?.isForum:void 0)&&Boolean(s&&s!==r._f);return{contentKey:(0,d.Wq)(e,n),chatId:a,threadId:s,isInsideTopic:u,isChatSelected:Boolean(a&&o),shouldSkipHistoryAnimations:c,nextManagementScreen:l}}))((e=>{var t;let{contentKey:n,chatId:s,threadId:r,isMobile:c,isInsideTopic:d,isChatSelected:l,shouldSkipHistoryAnimations:u,nextManagementScreen:m}=e;const{toggleChatInfo:h,toggleManagement:g,closeLocalTextSearch:p,setStickerSearchQuery:I,setGifSearchQuery:v,closePollResults:w,addChatMembers:b,setNewChatMembersDialogState:P,setEditingExportedInvite:y,toggleStatistics:Z,toggleMessageStatistics:C,setOpenedInviteInfo:S,requestNextManagementScreen:E,closeCreateTopicPanel:M,closeEditTopicPanel:R}=(0,a.Sv)(),{width:k}=(0,En.Z)(),[T,N]=(0,i.eJ)(f.vi.Profile),[A,x]=(0,i.eJ)(f.u1.Initial),[B,L]=(0,i.eJ)(),[U,j]=(0,i.eJ)(),O=T!==f.vi.Profile,F=void 0!==n,_=n===f.qt.ChatInfo,D=n===f.qt.Search,q=n===f.qt.Management,$=n===f.qt.Statistics,H=n===f.qt.MessageStatistics,G=n===f.qt.StickerSearch,V=n===f.qt.GifSearch,z=n===f.qt.PollResults,W=n===f.qt.AddingMembers,X=n===f.qt.CreateTopic,Y=n===f.qt.EditTopic,K=k<=o._mX,[J,Q]=(0,i.eJ)(!F),ee=null!==(t=(0,xn.Z)(n,!0,!l))&&void 0!==t?t:-1,te=(0,i.I4)((function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];switch(n){case f.qt.AddingMembers:P({newChatMembersProgress:f.WB.Closed});break;case f.qt.ChatInfo:if(O&&e){N(f.vi.Profile);break}h({force:!1},{forceSyncOnIOs:!0});break;case f.qt.Management:switch(A){case f.u1.Initial:g();break;case f.u1.ChatPrivacyType:case f.u1.Discussion:case f.u1.GroupPermissions:case f.u1.GroupType:case f.u1.ChatAdministrators:case f.u1.ChannelSubscribers:case f.u1.GroupMembers:case f.u1.Invites:case f.u1.Reactions:case f.u1.JoinRequests:case f.u1.ChannelRemovedUsers:x(f.u1.Initial);break;case f.u1.GroupUserPermissionsCreate:case f.u1.GroupRemovedUsers:case f.u1.GroupUserPermissions:x(f.u1.GroupPermissions),L(void 0),j(void 0);break;case f.u1.ChatAdminRights:case f.u1.ChatNewAdminRights:case f.u1.GroupAddAdmins:case f.u1.GroupRecentActions:x(f.u1.ChatAdministrators);break;case f.u1.EditInvite:case f.u1.InviteInfo:x(f.u1.Invites),S({chatId:s,invite:void 0}),y({chatId:s,invite:void 0})}break;case f.qt.MessageStatistics:C();break;case f.qt.Statistics:Z();break;case f.qt.Search:Gc(),p();break;case f.qt.StickerSearch:Gc(),I({query:void 0});break;case f.qt.GifSearch:Gc(),v({query:void 0});break;case f.qt.PollResults:w();break;case f.qt.CreateTopic:M();break;case f.qt.EditTopic:R()}}),[n,O,h,w,P,A,g,p,I,v,y,s,S,Z,C,M,R]),ne=(0,i.I4)(((e,t)=>{L(e),j(t)}),[]),ae=(0,i.I4)((e=>{b({chatId:s,memberIds:e})}),[b,s]);function se(e){if(-1!==ee)switch(ee){case f.qt.AddingMembers:return i.ZP.createElement(Fc,{key:s,chatId:s,isActive:F&&e,onNextStep:ae,onClose:te});case f.qt.ChatInfo:return i.ZP.createElement(Tc,{key:s,chatId:s,topicId:d?r:void 0,profileState:T,isMobile:c,onProfileStateChange:N});case f.qt.Search:return i.ZP.createElement(Nc,{chatId:s,threadId:r,onClose:te,isActive:F&&e});case f.qt.Management:return i.ZP.createElement(Ac,{key:s,chatId:s,currentScreen:A,isPromotedByCurrentUser:U,selectedChatMemberId:B,isActive:F&&e,onScreenSelect:x,onChatMemberSelect:ne,onClose:te});case f.qt.Statistics:return i.ZP.createElement(xc,{chatId:s});case f.qt.MessageStatistics:return i.ZP.createElement(Bc,{chatId:s,isActive:F&&e});case f.qt.StickerSearch:return i.ZP.createElement(Lc,{onClose:te,isActive:F&&e});case f.qt.GifSearch:return i.ZP.createElement(Uc,{onClose:te,isActive:F&&e});case f.qt.PollResults:return i.ZP.createElement(jc,{onClose:te,isActive:F&&e});case f.qt.CreateTopic:return i.ZP.createElement(_c,{onClose:te,isActive:F&&e});case f.qt.EditTopic:return i.ZP.createElement(Dc,{onClose:te,isActive:F&&e})}}return(0,i.d4)((()=>F?(0,St.Z)(te):void 0),[F,te]),(0,i.d4)((()=>{setTimeout((()=>{Q(!F)}),qc)}),[F]),(0,i.d4)((()=>{m&&(x(m),E(void 0))}),[m,E]),(0,i.d4)((()=>{F&&K&&te()}),[K]),Ta((e=>{let[t]=e;t!==s&&(N(f.vi.Profile),x(f.u1.Initial))}),[s]),(0,an.Z)({isActive:l&&(n===f.qt.ChatInfo||n===f.qt.Management||n===f.qt.AddingMembers||n===f.qt.CreateTopic||n===f.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(mc,{chatId:s,threadId:r,isColumnOpen:F,isProfile:_,isSearch:D,isManagement:q,isStatistics:$,isMessageStatistics:H,isStickerSearch:G,isGifSearch:V,isPollResults:z,isCreatingTopic:X,isEditingTopic:Y,isAddingChatMembers:W,profileState:T,managementScreen:A,onClose:te,onScreenSelect:x}),i.ZP.createElement(kt.Z,{name:J||u?"none":"zoom-fade",renderCount:$c+Hc,activeKey:q?$c+A:ee,shouldCleanup:!0,cleanupExceptionKey:ee===f.qt.MessageStatistics?f.qt.Statistics:void 0},se)))}))),zc=(0,i.X$)((e=>{let{isOpen:t}=e;const n=(0,wt.Z)(it.gl.Extra,"MediaViewer",!t);return n?i.ZP.createElement(n,null):void 0})),Wc=10,Xc=1e3;let Yc=[],Kc=!1;function Jc(e,t){Yc.push({url:e,filename:t}),Kc||(Kc=!0,setTimeout((async()=>{await async function(){let e=0;for(const t of Yc)Qc(t),e++,e===Wc&&(await(0,A.wO)(Xc),e=0);Yc=[]}(),Kc=!1}),Xc))}function Qc(e){let{url:t,filename:n}=e;const a=document.createElement("a");a.href=t,a.download=n;try{a.click()}catch(e){console.error(e)}}const ed=new Set,td=new Set,nd=(0,i.X$)((0,a.c$)((e=>({activeDownloads:(0,d.jU)(e).activeDownloads.byChatId,messages:e.messages.byChatId})))((e=>{let{activeDownloads:t,messages:n}=e;const{cancelMessagesMediaDownload:o,showNotification:c}=(0,a.Sv)(),d=(0,Sa.Z)(1e3,!0),l=(0,i.I4)((e=>{td.add(e),d((()=>{td.size&&(o({messages:Array.from(td)}),td.clear())}))}),[o,d]);(0,i.d4)((()=>{const e=Object.entries(t).map((e=>{let[t,a]=e;return a.map((e=>n[t].byId[e]))})).flat();e.length?e.forEach((e=>{if(ed.has(e))return;ed.add(e);const t=(0,u.Ti)(e,"download");if(!t)return void l(e);const n=ke.UV(t);if(n)return Jc(n,(0,u.w6)(e)),void l(e);const{document:a,video:o,audio:i}=e.content;if(((a||o||i)?.size||0)>s.l0&&!s.rT&&!s.Mc)return c({message:"Downloading files bigger than 2GB is not supported in your browser."}),void l(e);const d=(0,u.kG)(e,"download");ke.he(t,d,!0).then((t=>{if(d===r.IU.DownloadUrl){const n=new URL(t,window.document.baseURI),a=(0,u.w6)(e);n.searchParams.set("filename",encodeURIComponent(a));const s=window.open(n.toString());s?.addEventListener("beforeunload",(()=>{c({message:"Download started. Please, do not close the app before it is finished."})}))}else t&&Jc(t,(0,u.w6)(e));l(e)}))})):ed.clear()}),[n,t,o,l,c])})));var ad=n(13103);const sd=(0,i.X$)((0,a.c$)(((e,t)=>{let{openedGame:n}=t;const{chatId:a}=n||{},s=a&&(0,d.Z1)(e,a);return{canPost:Boolean(s)&&(0,u.Qm)(s,r._f)}}))((e=>{let{openedGame:t,gameTitle:n,canPost:a}=e;const{closeGame:s,openForwardMenu:o}=(0,L.Sv)(),r=(0,Tt.Z)(),{url:c,chatId:d,messageId:l}=t||{},u=Boolean(c),m=(0,Ri.Z)(d);(0,It.Z)((()=>{m({type:"playingGame"})}),u&&a?5e3:void 0);const h=(0,i.I4)((e=>{try{const t=JSON.parse(e.data);"share_score"===t.eventType&&(o({fromChatId:d,messageIds:[l],withMyScore:!0}),s()),"share_game"===t.eventType&&(o({fromChatId:d,messageIds:[l]}),s())}catch(e){}}),[d,s,l,o]),g=(0,i.I4)((e=>{e.currentTarget.focus()}),[]);return(0,i.d4)((()=>(window.addEventListener("message",h),()=>window.removeEventListener("message",h))),[h]),i.ZP.createElement(ad.Z,{className:"GameModal",isOpen:u,onClose:s,title:n,hasCloseButton:!0},u&&i.ZP.createElement("iframe",{className:"game-frame",onLoad:g,src:c,title:r("AttachGame"),sandbox:"allow-scripts allow-same-origin allow-orientation-lock",allow:"fullscreen"}))}))),od=(0,i.X$)((e=>{let{isOpen:t}=e;const n=(0,wt.Z)(it.gl.Extra,"Notifications",!t);return n?i.ZP.createElement(n,null):void 0})),id=(0,i.X$)((e=>{let{isOpen:t}=e;const n=(0,wt.Z)(it.gl.Extra,"Dialogs",!t);return n?i.ZP.createElement(n,null):void 0})),rd=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,wt.Z)(it.gl.Extra,"ForwardRecipientPicker",!t);return n?i.ZP.createElement(n,e):void 0})),cd=(0,i.X$)((e=>{const{url:t}=e,n=(0,wt.Z)(it.gl.Extra,"SafeLinkModal",!t);return n?i.ZP.createElement(n,e):void 0})),dd=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,wt.Z)(it.gl.Extra,"HistoryCalendar",!t);return n?i.ZP.createElement(n,e):void 0})),ld=(0,i.X$)((e=>{const{groupCallId:t}=e,n=(0,wt.Z)(it.gl.Calls,"GroupCall",!t);return n?i.ZP.createElement(n,e):void 0})),ud=(0,i.X$)((e=>{const{isActive:t}=e,n=(0,wt.Z)(it.gl.Calls,"ActiveCallHeader",!t);return n?i.ZP.createElement(n,null):void 0})),md=(0,i.X$)((e=>{const{isActive:t}=e,n=(0,wt.Z)(it.gl.Calls,"PhoneCall",!t);return n?i.ZP.createElement(n,null):void 0}));function hd(){return hd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},hd.apply(this,arguments)}const gd=(0,i.X$)((0,a.c$)((e=>({messageLists:(0,d.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,an.Z)({isActive:!0,hash:(0,p.tB)(t,n,a),onBack:s})};return i.ZP.createElement("div",null,t?.map(((e,t)=>i.ZP.createElement(o,hd({key:`${e.chatId}_${e.threadId}_${e.type}_${t}`},e)))))}))),pd=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,wt.Z)(it.gl.Extra,"NewContactModal",!t);return n?i.ZP.createElement(n,e):void 0})),fd=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,wt.Z)(it.gl.Calls,"RatePhoneCallModal",!t);return n?i.ZP.createElement(n,e):void 0})),Id=(0,i.X$)((e=>{const{webApp:t}=e,n=(0,wt.Z)(it.gl.Extra,"WebAppModal",!t);return n?i.ZP.createElement(n,e):void 0})),vd=(0,i.X$)((e=>{const{bot:t}=e,n=(0,wt.Z)(it.gl.Extra,"BotTrustModal",!t);return n?i.ZP.createElement(n,e):void 0})),wd=(0,i.X$)((e=>{const{bot:t}=e,n=(0,wt.Z)(it.gl.Extra,"AttachBotInstallModal",!t);return n?i.ZP.createElement(n,e):void 0})),bd={root:"vfd0Bo1X6k19aaxQ577t"},Pd=["#E8BC2C","#D0049E","#02CBFE","#5723FD","#FE8C27","#6CB859"],yd=(0,i.X$)((0,a.c$)((e=>(0,I.ei)((0,d.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,En.Z)(),r=(0,gt.Z)(),{isMobile:c}=(0,C.ZP)(),d=c?50:100,{lastConfettiTime:l,top:u,width:m,left:h,height:g}=t||{},p=(0,i.I4)((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:d;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=Pd[Math.floor(Math.random()*Pd.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})}}),[d]),f=(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,P=Date.now();if(f.y>i+e.size)return void r.push(e);const y={...e,pos:f,velocity:I,flicker:v,rotation:w,lastDrawnAt:P,frameCount:b};a.current[n]=y,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?requestAnimationFrame(f):s.current=!1}),[]);if((0,lt.Z)((e=>{let t,[n]=e;return n!==l&&(p(m||o.width,g||o.height),t=setTimeout(r,1e4),s.current||(s.current=!0,requestAnimationFrame(f))),()=>{clearTimeout(t)}}),[l,r,f]),!l||Date.now()-l>1e4)return;const I=(0,As.Z)(Boolean(u)&&`top: ${u}px`,Boolean(h)&&`left: ${h}px`,Boolean(m)&&`width: ${m}px`,Boolean(g)&&`height: ${g}px`);return i.ZP.createElement("div",{id:"Confetti",className:bd.root,style:I},i.ZP.createElement("canvas",{ref:n,className:bd.canvas,width:o.width,height:o.height}))}))),Zd=(0,i.X$)((e=>{const{urlAuth:t}=e,n=(0,wt.Z)(it.gl.Extra,"UrlAuthModal",!t);return n?i.ZP.createElement(n,e):void 0})),Cd=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,wt.Z)(it.gl.Extra,"PremiumMainModal",!t);return n?i.ZP.createElement(n,e):void 0})),Sd=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,wt.Z)(it.gl.Extra,"PaymentModal",!t);return n?i.ZP.createElement(n,e):void 0})),Ed=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,wt.Z)(it.gl.Extra,"ReceiptModal",!t);return n?i.ZP.createElement(n,e):void 0})),Md=(0,i.X$)((e=>{const{limit:t}=e,n=(0,wt.Z)(it.gl.Extra,"PremiumLimitReachedModal",!t);return n?i.ZP.createElement(n,e):void 0})),Rd=(0,i.X$)((e=>{const{deleteFolderDialogId:t}=e,n=(0,wt.Z)(it.gl.Extra,"DeleteFolderDialog",!t);return n?i.ZP.createElement(n,e):void 0})),kd=(0,i.X$)((e=>{const{customEmojiSetIds:t}=e,n=(0,wt.Z)(it.gl.Extra,"CustomEmojiSetsModal",!t);return n?i.ZP.createElement(n,e):void 0})),Td=(0,i.X$)((e=>{const{requestedDraft:t}=e,n=(0,wt.Z)(it.gl.Extra,"DraftRecipientPicker",!t);return n?i.ZP.createElement(n,e):void 0})),Nd=(0,i.X$)((e=>{const{requestedAttachBotInChat:t}=e,n=(0,wt.Z)(it.gl.Extra,"AttachBotRecipientPicker",!t);return n?i.ZP.createElement(n,e):void 0}));let Ad=!1;const xd=(0,i.X$)((0,a.c$)(((e,t)=>{let{isMobile:n}=t;const{settings:{byKey:{animationLevel:a,language:s,wasTimeFormatSetManually:o}},lastSyncTime:i}=e,{botTrustRequest:r,requestedAttachBotInstall:c,requestedAttachBotInChat:l,requestedDraft:u,urlAuth:m,webApp:h,safeLinkModalUrl:g,openedStickerSetShortName:p,openedCustomEmojiSetIds:f,shouldSkipHistoryAnimations:I,openedGame:v,audioPlayer:w,isLeftColumnShown:b,historyCalendarSelectedAt:P,notifications:y,dialogs:Z,newContact:C,ratingPhoneCall:S,premiumModal:E,isMasterTab:M,payment:R,limitReachedModal:k,deleteFolderDialogModal:T}=(0,d.jU)(e),{chatId:N,messageId:A}=w,x=N&&A?(0,d.hj)(e,N,A):void 0,B=v&&(0,d.hj)(e,v.chatId,v.messageId),L=B?.content.game?.title,U=e.currentUserId?(0,d.dy)(e,e.currentUserId):void 0,{chatId:j}=(0,d.Bt)(e)||{};return{lastSyncTime:i,isLeftColumnOpen:b,isMiddleColumnOpen:Boolean(j),isRightColumnOpen:(0,d.Jf)(e,n),isMediaViewerOpen:(0,d.zQ)(e),isForwardModalOpen:(0,d.Ev)(e),hasNotifications:Boolean(y.length),hasDialogs:Boolean(Z.length),audioMessage:x,safeLinkModalUrl:g,isHistoryCalendarOpen:Boolean(P),shouldSkipHistoryAnimations:I,openedStickerSetShortName:p,openedCustomEmojiSetIds:f,isServiceChatReady:(0,d.UW)(e),activeGroupCallId:M?e.groupCalls.activeGroupCallId:void 0,animationLevel:a,language:s,wasTimeFormatSetManually:o,isPhoneCallActive:M?Boolean(e.phoneCall):void 0,addedSetIds:e.stickers.added.setIds,addedCustomEmojiIds:e.customEmojis.added.setIds,newContactUserId:C?.userId,newContactByPhoneNumber:C?.isByPhoneNumber,openedGame:v,gameTitle:L,isRatePhoneCallModalOpen:Boolean(S),botTrustRequest:r,botTrustRequestBot:r&&(0,d.dy)(e,r.botId),attachBotToInstall:c?.bot,requestedAttachBotInChat:l,webApp:h,currentUser:U,urlAuth:m,isCurrentUserPremium:(0,d.wV)(e),isPremiumModalOpen:E?.isOpen,limitReached:k?.limit,isPaymentModalOpen:R.isPaymentModalOpen,isReceiptModalOpen:Boolean(R.receipt),deleteFolderDialogId:T,isMasterTab:M,requestedDraft:u}}))((e=>{let{lastSyncTime:t,isMobile:n,isLeftColumnOpen:r,isMiddleColumnOpen:c,isRightColumnOpen:d,isMediaViewerOpen:l,isForwardModalOpen:u,hasNotifications:m,hasDialogs:h,audioMessage:g,activeGroupCallId:f,safeLinkModalUrl:I,isHistoryCalendarOpen:v,shouldSkipHistoryAnimations:w,limitReached:b,openedStickerSetShortName:P,openedCustomEmojiSetIds:y,isServiceChatReady:Z,animationLevel:S,language:E,wasTimeFormatSetManually:M,addedSetIds:R,addedCustomEmojiIds:k,isPhoneCallActive:T,newContactUserId:x,newContactByPhoneNumber:B,openedGame:L,gameTitle:U,isRatePhoneCallModalOpen:j,botTrustRequest:O,botTrustRequestBot:F,attachBotToInstall:_,requestedAttachBotInChat:D,requestedDraft:q,webApp:$,currentUser:H,urlAuth:G,isPremiumModalOpen:V,isPaymentModalOpen:z,isReceiptModalOpen:W,isCurrentUserPremium:X,deleteFolderDialogId:Y,isMasterTab:K}=e;const{initMain:J,loadAnimatedEmojis:Q,loadNotificationSettings:ee,loadNotificationExceptions:te,updateIsOnline:ne,onTabFocusChange:ae,loadTopInlineBots:se,loadEmojiKeywords:oe,loadCountryList:ie,loadAvailableReactions:re,loadStickerSets:ce,loadPremiumGifts:de,loadDefaultTopicIcons:le,loadAddedStickers:ue,loadFavoriteStickers:me,loadDefaultStatusIcons:he,ensureTimeFormat:ge,closeStickerSetModal:pe,closeCustomEmojiSets:fe,checkVersionNotification:Ie,loadConfig:ve,loadAppConfig:we,loadAttachBots:be,loadContactList:Pe,loadCustomEmojis:ye,loadGenericEmojiEffects:Ze,closePaymentModal:Ce,clearReceipt:Se,checkAppVersion:Ee,openChat:Me,toggleLeftColumn:Re,loadRecentEmojiStatuses:ke,updatePageTitle:Te}=(0,a.Sv)();o.eMD&&!Ad&&(Ad=!0,console.log(">>> RENDER MAIN")),(0,vt.Z)((()=>{(0,it.Pb)(it.gl.Calls)}),5e3);const{isDesktop:Ne}=(0,C.ZP)();(0,i.d4)((()=>{r||c||Ne?r&&c&&n&&Re():Re()}),[Ne,r,c,n,Re]),(0,It.Z)(Ee,K?3e5:void 0,!0),(0,i.d4)((()=>{t&&K&&(ne(!0),ve(),we(),J(),re(),Q(),Ze(),ee(),te(),se(),oe({language:o.pRL}),be(),Pe(),de(),le(),he(),Ee(),X&&ke())}),[t,Q,oe,te,ee,se,ne,re,we,be,Pe,de,Ee,ve,Ze,le,he,ke,X,K,J]),(0,i.d4)((()=>{t&&K&&(E!==o.pRL&&oe({language:E}),ie({langCode:E}))}),[E,t,ie,oe,K]),(0,rt.Z)((e=>{let[n]=e;!n&&t&&K&&ye({ids:Object.keys((0,a.Rd)().customEmojis.byId),ignoreCache:!0})}),[t,K,ye]),(0,i.d4)((()=>{t&&K&&(R&&k||(ce(),me()),R&&k&&ue())}),[t,R,ce,me,ue,k,K]),(0,i.d4)((()=>{t&&Z&&K&&Ie()}),[t,Z,Ie,K]),(0,i.d4)((()=>{t&&!M&&ge()}),[t,M,ge]),(0,i.d4)((()=>{const e=(0,p.dx)();t&&e?.tgaddr&&(0,ot.ou)(decodeURIComponent(e.tgaddr))}),[t]),(0,rt.Z)((e=>{let[n]=e;const a=(0,p.VX)();a&&!n&&t&&Me({id:a.chatId,threadId:a.threadId,type:a.type})}),[t,Me]);const Ae=(0,pt.Z)(r,void 0,!0,void 0,w,void 0,!0),xe=(0,i.sO)(!1),Be=(0,gt.Z)();(0,lt.Z)((e=>{let[t]=e;if(void 0===t||r===t||0===S)return;xe.current=!0,s.wZ&&(0,A.T2)((()=>{document.body.classList.toggle("android-left-blackout-open",!r)}));const n=(0,ft.YW)();(0,st.L)(document.getElementById("MiddleColumn"),(()=>{n(),xe.current=!1,Be()}))}),[r,S,Be]);const Le=(0,pt.Z)(d,void 0,!0,void 0,w,void 0,!0),Ue=(0,i.sO)(!1),[je,Oe]=(0,i.eJ)(d);(0,lt.Z)((e=>{let[t]=e;if(void 0===t||d===t)return;if(0===S)return void Oe(d);Ue.current=!0;const n=(0,ft.YW)();(0,st.L)(document.getElementById("RightColumn"),(()=>{n(),Ue.current=!1,Be(),Oe(d)}))}),[d,S,Be]);const Fe=(0,at.Z)(Ae.hasShownClass&&"left-column-shown",Ae.hasOpenClass&&"left-column-open",xe.current&&"left-column-animating",Le.hasShownClass&&"right-column-shown",Le.hasOpenClass&&"right-column-open",Ue.current&&"right-column-animating",je&&"narrow-message-list",w&&"history-animation-disabled"),_e=(0,i.I4)((()=>{ae({isBlurred:!0})}),[ae]),De=(0,i.I4)((()=>{ae({isBlurred:!1}),document.title.includes(o.ouc)||Te(),N(!1)}),[ae,Te]),qe=(0,i.I4)((()=>{pe()}),[pe]),$e=(0,i.I4)((()=>{fe()}),[fe]);return(0,ct.Z)(_e,De),dt(_e),function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];(0,i.d4)((()=>{if(s.$b){if(!e)return ut?.setAttribute("content",mt),s.cj&&!s.fl&&document.addEventListener("gesturestart",ht),()=>{ut?.setAttribute("content","width=device-width, initial-scale=1, shrink-to-fit=no"),s.cj&&!s.fl&&document.removeEventListener("gesturestart",ht)};ut?.setAttribute("content","width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover")}}),[e])}(l),i.ZP.createElement("div",{id:"Main",className:Fe},i.ZP.createElement(yn,null),i.ZP.createElement(cc,{isMobile:n}),i.ZP.createElement(Vc,{isMobile:n}),i.ZP.createElement(zc,{isOpen:l}),i.ZP.createElement(rd,{isOpen:u}),i.ZP.createElement(Td,{requestedDraft:q}),i.ZP.createElement(od,{isOpen:m}),i.ZP.createElement(id,{isOpen:h}),g&&i.ZP.createElement(ga,{key:g.id,message:g,noUi:!0}),i.ZP.createElement(cd,{url:I}),i.ZP.createElement(Zd,{urlAuth:G,currentUser:H}),i.ZP.createElement(dd,{isOpen:v}),i.ZP.createElement(bt,{isOpen:Boolean(P),onClose:qe,stickerSetShortName:P}),i.ZP.createElement(kd,{customEmojiSetIds:y,onClose:$e}),f&&i.ZP.createElement(ld,{groupCallId:f}),i.ZP.createElement(ud,{isActive:Boolean(f||T)}),i.ZP.createElement(pd,{isOpen:Boolean(x||B),userId:x,isByPhoneNumber:B}),i.ZP.createElement(sd,{openedGame:L,gameTitle:U}),i.ZP.createElement(Id,{webApp:$}),i.ZP.createElement(nd,null),i.ZP.createElement(yd,null),i.ZP.createElement(md,{isActive:T}),i.ZP.createElement(Ct,{isForAppBadge:!0}),i.ZP.createElement(fd,{isOpen:j}),i.ZP.createElement(vd,{bot:F,type:O?.type}),i.ZP.createElement(wd,{bot:_}),i.ZP.createElement(Nd,{requestedAttachBotInChat:D}),i.ZP.createElement(gd,null),V&&i.ZP.createElement(Cd,{isOpen:V}),i.ZP.createElement(Md,{limit:b}),i.ZP.createElement(Sd,{isOpen:z,onClose:Ce}),i.ZP.createElement(Ed,{isOpen:W,onClose:Se}),i.ZP.createElement(Rd,{deleteFolderDialogId:Y}))})));var Bd=n(62821),Ld=n(21179),Ud=n(99364),jd=n(8337);var Od=n(2092);const Fd=(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,Tt.Z)(),[h,g]=(0,i.eJ)(""),[p,f]=(0,i.eJ)(!1),[I,v,w]=(0,Mt.Z)(!1),{shouldRender:b}=(0,pt.Z)(t);(0,vt.Z)(c,l?l-Date.now():void 0);const P=(0,i.I4)((()=>{g("")}),[]),y=(0,i.I4)((e=>{void 0===l?(g(""),(0,q.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 Z=(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:Od,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:P,isPasswordVisible:p,noRipple:!0,onChangePasswordVisibility:f,onSubmit:y}),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(_t.Z,{color:"translucent",size:"tiny",isText:!0,onClick:v},m("AccountSettings.Logout"))))),i.ZP.createElement(qn.Z,{isOpen:I,onClose:w,text:m("lng_sure_logout"),confirmLabel:m("AccountSettings.Logout"),confirmHandler:Z,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.492f92c50d42b25061bc.js.map