2 lines
392 KiB
JavaScript
2 lines
392 KiB
JavaScript
"use strict";(self.webpackChunktelegram_t=self.webpackChunktelegram_t||[]).push([[5769],{59851:(e,t,n)=>{n.r(t),n.d(t,{LockScreen:()=>Md,Main:()=>Zd});var a=n(33555),s=n(863),i=n(83716),o=n(60748),r=n(31664),c=n(57710),d=n(73760),l=(n(89005),n(6137)),u=n(25260),m=n(11192),h=n(70735),g=n(48670),p=n(65054);function f(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];let[s=(0,p._w)()]=n;const{chatId:i,threadId:o}=(0,m.Bt)(e,s)||{};return i&&o?(e=(0,u.qr)(e,i,o,!1,void 0,s),e=(0,u.Pb)(e,i,o,void 0,void 0,void 0,s)):e}(0,a.iw)("openLocalTextSearch",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{},{chatId:s,threadId:i}=(0,m.Bt)(e,a)||{};if(s&&i)return(0,u.qr)(e,s,i,!0,void 0,a)})),(0,a.iw)("closeLocalTextSearch",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{};return f(e,a)})),(0,a.iw)("setLocalTextSearchQuery",((e,t,n)=>{const{query:a,tabId:s=(0,p._w)()}=n,{chatId:i,threadId:o}=(0,m.Bt)(e,s)||{};if(!i||!o)return;const r=(0,g.uw)(i,o),{query:c}=(0,m.jU)(e,s).localTextSearch.byChatThreadKey[r]||{};return a!==c&&(e=(0,u.Pb)(e,i,o,h.D,void 0,void 0,s)),(0,u.qr)(e,i,o,!0,a,s)})),(0,a.iw)("setLocalMediaSearchType",((e,t,n)=>{const{mediaType:a,tabId:s=(0,p._w)()}=n,{chatId:i,threadId:o}=(0,m.Bt)(e,s)||{};if(i&&o)return(0,u.z5)(e,i,o,a,s)}));var I=n(44271),v=n(15780);(0,a.iw)("openChat",((e,t,n)=>{const{id:a,threadId:s=l._f,type:i="thread",shouldReplaceHistory:o=!1,shouldReplaceLast:r=!1,noForumTopicPanel:c,tabId:d=(0,p._w)()}=n,h=(0,m.Bt)(e,d),g=(0,m.jU)(e,d);return g.premiumModal?.promo&&g.premiumModal?.isOpen&&(e=(0,I.i)(e,{premiumModal:{...g.premiumModal,isOpen:!1}},d)),h&&h.chatId===a&&h.threadId===s&&h.type===i||(a&&(e=(0,u.O8)(e,a,s,"replyStack",[],d),e=(0,I.i)(e,{activeReactions:{}},d)),e=f(e=(0,u.i9)(e,d),d),e=(0,I.i)(e,{isStatisticsShown:!1,contentToBeScheduled:void 0,...a!==(0,m.jU)(e,d).forwardMessages.toChatId&&{forwardMessages:{}}},d)),a&&((0,m.Z1)(e,a)?.isForum&&!c?t.openForumPanel({chatId:a,tabId:d}):a!==(0,m.jU)(e,d).forumPanelChatId&&t.closeForumPanel({tabId:d})),t.updatePageTitle({tabId:d}),(0,u.Wy)(e,a,s,i,o,r,d)})),(0,a.iw)("openChatInNewTab",((e,t,n)=>{const{chatId:a,threadId:s=l._f}=n,o=(0,v.Ex)(a,"thread",s);i.D$V?window.electron.openNewWindow(o):window.open(o,"_blank")})),(0,a.iw)("openPreviousChat",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{};return t.updatePageTitle({tabId:a}),(0,u.Wy)(e,void 0,void 0,void 0,void 0,void 0,a)})),(0,a.iw)("openChatWithInfo",((e,t,n)=>{const{tabId:s=(0,p._w)()}=n;e=(0,I.i)(e,{...(0,m.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:i,files:o,filter:r,tabId:c=(0,p._w)()}=n;return a&&t.openChat({id:a,threadId:i,tabId:c}),(0,I.i)(e,{requestedDraft:{chatId:a,text:s,files:o,filter:r}},c)})),(0,a.iw)("resetChatCreation",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{};return(0,I.i)(e,{chatCreation:void 0},a)})),(0,a.iw)("setNewChatMembersDialogState",((e,t,n)=>{const{newChatMembersProgress:a,tabId:s=(0,p._w)()}=n;return(0,I.i)(e,{newChatMembersProgress:a},s)})),(0,a.iw)("openNextChat",((e,t,n)=>{const{targetIndexDelta:a,orderedIds:s,tabId:i=(0,p._w)()}=n,{chatId:o}=(0,m.Bt)(e,i)||{};if(!o)return void t.openChat({id:s[0],tabId:i});const r=s.indexOf(o);if(-1===r)return;const c=s[r+a];t.openChat({id:c,shouldReplaceHistory:!0,tabId:i})})),(0,a.iw)("closeDeleteChatFolderModal",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{};return(0,I.i)(e,{deleteFolderDialogModal:void 0},a)})),(0,a.iw)("closeChatlistModal",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{};return(0,I.i)(e,{chatlistModal:void 0},a)}));var w=n(91713),b=n(60782),Z=n(82267),P=n(83099),y=n(59692),C=n(64319),S=n(996),E=n(42986),M=n(42797);const R=i.ckE+i.fK3;let k;function T(e,t,n){const{type:a,threadId:s}=(0,m.Bt)(e)||{},i=y.Iu,o="scheduled"===a?(0,m.yB)(e,t):(0,m.Zw)(e,t);if(!o||!s)return;const r=n.map((e=>o[e])).filter((t=>(0,m._k)(e,t,s).canCopy)).sort(((e,t)=>e.id-t.id)),c=r.reduce(((t,n)=>{const a=(0,m.Ur)(e,n);return t.push(`> ${a?(0,g.OU)(i,a):""}:`),t.push(`${function(e,t){const n=(0,E.Eb)(t),a=n?`${n} `:"",s=(0,S.X)(t,void 0,void 0,void 0,void 0,void 0,!0)?.join("");return`${a}${(0,E.Kk)(e,t,s,!0)}`}(i,n)}\n`),t}),[]),d=r.reduce(((t,n)=>{const a=(0,m.Ur)(e,n);return t.push(`> ${a?(0,g.OU)(i,a):""}:`),t.push(`${(0,g.MK)(i,n,!1,0,!0)}\n`),t}),[]);(0,C.qN)(c.join("\n"),d.join("\n"))}(0,a.iw)("setScrollOffset",((e,t,n)=>{const{chatId:a,threadId:s,scrollOffset:i,tabId:o=(0,p._w)()}=n;return e=(0,u.pf)(e,a,s,"lastScrollOffset",i),(0,u.O8)(e,a,s,"scrollOffset",i,o)})),(0,a.iw)("setReplyingToId",((e,t,n)=>{const{messageId:a,tabId:s=(0,p._w)()}=n,i=(0,m.Bt)(e,s);if(!i)return;const{chatId:o,threadId:r}=i;return(0,u.pf)(e,o,r,"replyingToId",a)})),(0,a.iw)("setEditingId",((e,t,n)=>{const{messageId:a,tabId:s=(0,p._w)()}=n,i=(0,m.Bt)(e,s);if(!i)return;const{chatId:o,threadId:r,type:c}=i,d="scheduled"===c?"editingScheduledId":"editingId";return(0,u.pf)(e,o,r,d,a)})),(0,a.iw)("setEditingDraft",((e,t,n)=>{const{text:a,chatId:s,threadId:i,type:o}=n,r="scheduled"===o?"editingScheduledDraft":"editingDraft";return(0,u.pf)(e,s,i,r,a)})),(0,a.iw)("editLastMessage",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{},{chatId:s,threadId:i}=(0,m.Bt)(e,a)||{};if(!s||!i)return;const o=(0,m.Zw)(e,s),r=(0,m.Cb)(e,s,i,a);if(!o||!r)return;const c=(0,b.dF)(r,(t=>Boolean(o[t]&&(0,m._k)(e,o[t],i).canEdit)));return c?(0,u.pf)(e,s,i,"editingId",c):void 0})),(0,a.iw)("replyToNextMessage",((e,t,n)=>{const{targetIndexDelta:a,tabId:s=(0,p._w)()}=n,{chatId:i,threadId:o}=(0,m.Bt)(e,s)||{};if(!i||!o)return;const r=(0,m.Zw)(e,i),c=(0,m.Cb)(e,i,o,s);if(!r||!c)return;const d=(0,m.Yy)(e,i,o);let u;if((0,m.b9)(e,i,o,s)&&d){const e=Object.keys(r),t=e.indexOf(d.toString())+a;u=t<=e.length+1&&t>=0?Number(e[t]):void 0}else u=o===l._f?(0,m.Z1)(e,i)?.lastMessage?.id:(0,m.tZ)(e,i,o)?.lastMessageId;t.setReplyingToId({messageId:u,tabId:s}),t.focusMessage({chatId:i,threadId:o,messageId:u,tabId:s})})),(0,a.iw)("openAudioPlayer",((e,t,n)=>{const{chatId:a,threadId:s,messageId:i,origin:o,volume:r,playbackRate:c,isMuted:d,tabId:l=(0,p._w)()}=n,u=(0,m.jU)(e,l);return(0,I.i)(e,{audioPlayer:{chatId:a,threadId:s,messageId:i,origin:null!=o?o:u.audioPlayer.origin,volume:null!=r?r:u.audioPlayer.volume,playbackRate:c||u.audioPlayer.playbackRate||e.audioPlayer.lastPlaybackRate,isPlaybackRateActive:void 0===u.audioPlayer.isPlaybackRateActive?e.audioPlayer.isLastPlaybackRateActive:u.audioPlayer.isPlaybackRateActive,isMuted:d||u.audioPlayer.isMuted}},l)})),(0,a.iw)("setAudioPlayerVolume",((e,t,n)=>{const{volume:a,tabId:s=(0,p._w)()}=n;return(0,I.i)(e,{audioPlayer:{...(0,m.jU)(e,s).audioPlayer,volume:a,isMuted:!1}},s)})),(0,a.iw)("setAudioPlayerPlaybackRate",((e,t,n)=>{const{playbackRate:a,isPlaybackRateActive:s,tabId:i=(0,p._w)()}=n;return e={...e,audioPlayer:{...e.audioPlayer,lastPlaybackRate:a,isLastPlaybackRateActive:s}},(0,I.i)(e,{audioPlayer:{...(0,m.jU)(e,i).audioPlayer,playbackRate:a,isPlaybackRateActive:s}},i)})),(0,a.iw)("setAudioPlayerMuted",((e,t,n)=>{const{isMuted:a,tabId:s=(0,p._w)()}=n;return(0,I.i)(e,{audioPlayer:{...(0,m.jU)(e,s).audioPlayer,isMuted:a}},s)})),(0,a.iw)("setAudioPlayerOrigin",((e,t,n)=>{const{origin:a,tabId:s=(0,p._w)()}=n;return(0,I.i)(e,{audioPlayer:{...(0,m.jU)(e,s).audioPlayer,origin:a}},s)})),(0,a.iw)("closeAudioPlayer",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{},s=(0,m.jU)(e,a);return(0,I.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:i,tabId:o=(0,p._w)()}=n,r=(0,m.Jf)(e,(0,M.W7)(),o),c=(0,m.jU)(e,o);if(r){if(s!==c.pollResults.chatId||i!==c.pollResults.messageId)return(0,I.i)(e,{pollResults:{chatId:s,messageId:i,voters:{}}},o)}else window.setTimeout((()=>{e=(0,a.Rd)(),e=(0,I.i)(e,{pollResults:{chatId:s,messageId:i,voters:{}}},o),(0,a.R3)(e)}),450)})),(0,a.iw)("closePollResults",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{};return(0,I.i)(e,{pollResults:{}},a)})),(0,a.iw)("focusLastMessage",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{},s=(0,m.Bt)(e,a);if(!s)return;const{chatId:i,threadId:o,type:r}=s;let c;if(o===l._f)if("pinned"===r){const t=(0,m.KB)(e,i,l._f);if(!t?.length)return;c=t[t.length-1]}else c=(0,m.Z1)(e,i)?.lastMessage?.id;else c=(0,m.tZ)(e,i,o)?.lastMessageId;c&&t.focusMessage({chatId:i,threadId:o,messageListType:r,messageId:c,noHighlight:!0,noForumTopicPanel:!0,tabId:a})})),(0,a.iw)("focusNextReply",((e,t,n)=>{const{tabId:s=(0,p._w)()}=n||{},i=(0,m.Bt)(e,s);if(!i)return;const{chatId:o,threadId:r}=i,c=(0,m.p9)(e,o,r,s);if(c&&0!==c.length){const n=c.pop();e=(0,u.O8)(e,o,r,"replyStack",[...c],s),(0,a.R3)(e),t.focusMessage({chatId:o,threadId:r,messageId:n,tabId:s,noForumTopicPanel:!0})}else t.focusLastMessage({tabId:s})})),(0,a.iw)("focusMessage",((e,t,n)=>{const{chatId:s,threadId:i=l._f,messageListType:o="thread",noHighlight:r,groupedId:c,groupedChatId:d,replyMessageId:h,isResizingContainer:g,shouldReplaceHistory:f,noForumTopicPanel:I,tabId:v=(0,p._w)()}=n;let{messageId:Z}=n;if(void 0!==c){const t=(0,m.y8)(e,d,c);t?.length&&([Z]=(0,b.oA)(t))}const P=(0,m.Bt)(e,v),y=!P||s!==P.chatId||i!==P.threadId||o!==P.type;if(k&&(clearTimeout(k),k=void 0),k=window.setTimeout((()=>{e=(0,a.Rd)(),e=(0,u.cq)(e,void 0,void 0,void 0,void 0,void 0,v),e=(0,u.wV)(e,void 0,v),(0,a.R3)(e)}),r?R:1500),e=(0,u.cq)(e,s,Z,i,r,g,v),e=(0,u.wV)(e,void 0,v),h){const t=(0,m.p9)(e,s,i,v)||[];e=(0,u.O8)(e,s,i,"replyStack",[...t,h],v)}y&&(e=(0,u.wV)(e,w.fo.Static,v));const C=(0,m.Cb)(e,s,i,v);if(C&&C.includes(Z))return(0,a.R3)(e,{forceOnHeavyAnimation:!0}),void t.openChat({id:s,threadId:i,type:o,shouldReplaceHistory:f,noForumTopicPanel:I,tabId:v});if(y&&(e=(0,u.O8)(e,s,i,"viewportIds",void 0,v)),C&&!y){const t=Z>C[0]?w.fo.Down:w.fo.Up;e=(0,u.wV)(e,t,v)}(0,a.R3)(e,{forceOnHeavyAnimation:!0}),t.openChat({id:s,threadId:i,type:o,shouldReplaceHistory:f,noForumTopicPanel:I,tabId:v}),t.loadViewportMessages({tabId:v,shouldForceRender:!0})})),(0,a.iw)("openForwardMenu",((e,t,n)=>{const{fromChatId:a,messageIds:s,groupedId:i,withMyScore:o,tabId:r=(0,p._w)()}=n;let c;return i&&(c=(0,m.xH)(e,a,i)),(0,I.i)(e,{forwardMessages:{fromChatId:a,messageIds:c||s,isModalShown:!0,withMyScore:o}},r)})),(0,a.iw)("changeForwardRecipient",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{};return(0,I.i)(e,{forwardMessages:{...(0,m.jU)(e,a).forwardMessages,toChatId:void 0,isModalShown:!0,noAuthors:!1,noCaptions:!1}},a)})),(0,a.iw)("setForwardNoAuthors",((e,t,n)=>{const{noAuthors:a,tabId:s=(0,p._w)()}=n,i=(0,m.jU)(e,s);return(0,I.i)(e,{forwardMessages:{...i.forwardMessages,noAuthors:a,noCaptions:a&&i.forwardMessages.noCaptions}},s)})),(0,a.iw)("setForwardNoCaptions",((e,t,n)=>{const{noCaptions:a,tabId:s=(0,p._w)()}=n;return(0,I.i)(e,{forwardMessages:{...(0,m.jU)(e,s).forwardMessages,noCaptions:a,noAuthors:a}},s)})),(0,a.iw)("exitForwardMode",((e,t,n)=>{const{tabId:s=(0,p._w)()}=n||{};e=(0,I.i)(e,{forwardMessages:{}},s),(0,a.R3)(e)})),(0,a.iw)("openForwardMenuForSelectedMessages",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{},s=(0,m.jU)(e,a);if(!s.selectedMessages)return;const{chatId:i,messageIds:o}=s.selectedMessages;t.openForwardMenu({fromChatId:i,messageIds:o,tabId:a})})),(0,a.iw)("cancelMessageMediaDownload",((e,t,n)=>{const{message:a,tabId:s=(0,p._w)()}=n;return(0,u.wI)(e,a,s)})),(0,a.iw)("cancelMessagesMediaDownload",((e,t,n)=>{const{messages:a,tabId:s=(0,p._w)()}=n;for(const t of a)e=(0,u.wI)(e,t,s);return e})),(0,a.iw)("downloadMessageMedia",((e,t,n)=>{const{message:a,tabId:s=(0,p._w)()}=n;return(0,u.fC)(e,a,s)})),(0,a.iw)("downloadSelectedMessages",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{},s=(0,m.jU)(e,a);if(!s.selectedMessages)return;const{chatId:i,messageIds:o}=s.selectedMessages,{threadId:r}=(0,m.Bt)(e,a)||{},c=(0,m.Zw)(e,i);c&&r&&o.map((e=>c[e])).filter((t=>(0,m._k)(e,t,r).canDownload)).forEach((e=>t.downloadMessageMedia({message:e,tabId:a})))})),(0,a.iw)("enterMessageSelectMode",((e,t,n)=>{const{messageId:a,tabId:s=(0,p._w)()}=n||{},i=(0,m.jr)(e,s);return i?(0,u.M6)(e,i.id,a,s):e})),(0,a.iw)("toggleMessageSelection",((e,t,n)=>{const{messageId:i,groupedId:o,childMessageIds:r,withShift:c,tabId:d=(0,p._w)()}=n,l=(0,m.Bt)(e,d);if(!l)return;const{chatId:h,threadId:g,type:f}=l;e=(0,u.Ob)(e,h,g,f,i,o,r,c,d),(0,a.R3)(e),e.shouldShowContextMenuHint&&(t.disableContextMenuHint(),t.showNotification({message:`To **edit** or **reply**, close this menu. Then ${s.$b?"long tap":"right click"} on a message.`,tabId:d}))})),(0,a.iw)("disableContextMenuHint",(e=>{if(e.shouldShowContextMenuHint)return{...e,shouldShowContextMenuHint:!1}})),(0,a.iw)("exitMessageSelectMode",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{};return(0,u.i9)(e,a)})),(0,a.iw)("openPollModal",((e,t,n)=>{const{isQuiz:a,tabId:s=(0,p._w)()}=n||{};return(0,I.i)(e,{pollModal:{isOpen:!0,isQuiz:a}},s)})),(0,a.iw)("closePollModal",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{};return(0,I.i)(e,{pollModal:{isOpen:!1}},a)})),(0,a.iw)("checkVersionNotification",((e,t)=>{if(i.V61&&Date.now()>Number(i.V61)+2592e5)return;const n="1.61.24".split(".").slice(0,2).join("."),{serviceNotifications:a}=e;if(a.find((e=>{let{version:t}=e;return t===n})))return;const s={chatId:i.awM,date:(0,Z.bp)(),content:{text:(0,P.ZP)("**Telegram Web A was updated to version 1.61**\n\n[🤩](customEmoji:5373026167722876724) **What’s New**\n\n• Shareable Chat Folders – Your chat folders can now be shared with friends or colleagues – adding the folder and **joining all its chats** in one tap.\n\n• Power Saving Mode – You can **extend battery life** and **improve performance** by turning on Power Saving Mode or individually disabling autoplay, animations and effects in __Settings > Animations and Performance__.\n\n• Better Bots – Telegram bots can completely replace any website. These bots can now be launched **in any chat** – try typing [@DurgerKingBot](https://t.me/DurgerKingBot) (followed by a space) in any chat, or posting [this link](https://t.me/DurgerKingBot/menu).\n\n• Enhanced Design – Enjoy transparent layers with **beautiful blur effects** when selecting emoji, stickers, reactions and statuses. Sending messages also has a satisfying **new animation**.\n\n• Infinite Reactions – Telegram Premium users can pick reactions from an infinite selection of custom emoji. They can also use **up to 3 reactions** on any message to combine multiple emotions. [👍](customEmoji:5469770542288478598)[🔥](customEmoji:5420315771991497307)[❤️](customEmoji:5449505950283078474)\n\n• Preview in Media Viewer – Scrubbing through videos now shows a **thumbnail preview** to easily find specific scenes.\n\n• Group Chat Improvements – Create groups with **only yourself** or restrict anyone from adding you directly to groups (via __Settings > Privacy and Security > Group and Channels > Nobody__).\n\n• Send When Online – By right-clicking the Send button, you can schedule a message to be sent when the recipient comes online.\n\n[😍](customEmoji:5372886001465170842) **What’s Better**\n\n• As usual, we've added a pack of optimizations and performance improvements. If you ever run into an issue with the app, be sure to [report it](https://bugs.telegram.org/?tag_ids=41&sort=time) on the Bugs and Suggestions Platform.\n\n🦄 **We also welcome** you to join our official channels in **[English](https://t.me/webachannel)** and **[Russian](https://t.me/webachannelru)** — where we post app updates and share our experiences building one of the world’s most feature-rich web applications.\n",!0)},isOutgoing:!1};t.createServiceNotification({message:s,version:n})})),(0,a.iw)("createServiceNotification",((e,t,n)=>{const{message:s,version:o}=n,{serviceNotifications:r}=e,c=(0,m.Z1)(e,i.awM),d=Math.max(c.lastMessage?.id||0,...r.map((e=>{let{id:t}=e;return t}))),l=(r.length+1)/1e3,u=Math.floor(d)+l;s.previousLocalId=s.id,s.id=u;const h={id:u,message:s,version:o,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:i=(0,p._w)()}=n;return(0,I.i)(e,{reactorModal:{chatId:a,messageId:s}},i)})),(0,a.iw)("closeReactorListModal",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{};return(0,I.i)(e,{reactorModal:void 0},a)})),(0,a.iw)("openSeenByModal",((e,t,n)=>{const{chatId:a,messageId:s,tabId:i=(0,p._w)()}=n;return(0,I.i)(e,{seenByModal:{chatId:a,messageId:s}},i)})),(0,a.iw)("closeSeenByModal",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{};return(0,I.i)(e,{seenByModal:void 0},a)})),(0,a.iw)("openMessageLanguageModal",((e,t,n)=>{const{chatId:a,id:s,tabId:i=(0,p._w)()}=n,o=(0,m.xx)(e,a,s,i);return(0,I.i)(e,{messageLanguageModal:{chatId:a,messageId:s,activeLanguage:o}},i)})),(0,a.iw)("closeMessageLanguageModal",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{};return(0,I.i)(e,{messageLanguageModal:void 0},a)})),(0,a.iw)("copySelectedMessages",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{},s=(0,m.jU)(e,a);if(!s.selectedMessages)return;const{chatId:i,messageIds:o}=s.selectedMessages;T(e,i,o)})),(0,a.iw)("copyMessagesByIds",((e,t,n)=>{const{messageIds:a,tabId:s=(0,p._w)()}=n,i=(0,m.jr)(e,s);a&&0!==a.length&&i&&T(e,i.id,a)})),(0,a.iw)("setGlobalSearchQuery",((e,t,n)=>{const{query:a,tabId:s=(0,p._w)()}=n,{chatId:i}=(0,m.jU)(e,s).globalSearch;return(0,u.No)(e,{globalResults:{},localResults:{},resultsByType:void 0,...a?{fetchingStatus:{chats:!i,messages:!0}}:{fetchingStatus:void 0},query:a},s)})),(0,a.iw)("setGlobalSearchClosing",((e,t,n)=>{const{tabId:a=(0,p._w)(),isClosing:s}=n||{};return(0,u.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 i=s.filter((e=>e!==a));return i.unshift(a),i.length>10&&i.pop(),{...e,recentlyFoundChatIds:i}})),(0,a.iw)("clearRecentlyFoundChats",(e=>({...e,recentlyFoundChatIds:void 0}))),(0,a.iw)("setGlobalSearchContent",((e,t,n)=>{const{content:a,tabId:s=(0,p._w)()}=n;return(0,u.Og)(e,a,s)})),(0,a.iw)("setGlobalSearchChatId",((e,t,n)=>{const{id:a,tabId:s=(0,p._w)()}=n;return(0,u.No)(e,{chatId:a,query:void 0,resultsByType:void 0},s)})),(0,a.iw)("setStickerSearchQuery",((e,t,n)=>{const{query:a,tabId:s=(0,p._w)()}=n;return(0,I.i)(e,{stickerSearch:{query:a,resultIds:void 0}},s)})),(0,a.iw)("setGifSearchQuery",((e,t,n)=>{const{query:a,tabId:s=(0,p._w)()}=n;return(0,I.i)(e,{gifSearch:{query:a,offset:void 0,results:void 0}},s)})),(0,a.iw)("setUserSearchQuery",((e,t,n)=>{const{query:a,tabId:s=(0,p._w)()}=n;return(0,u.Lm)(e,{globalUserIds:void 0,localUserIds:void 0,fetchingStatus:Boolean(a),query:a},s)})),(0,a.iw)("openAddContactDialog",((e,t,n)=>{const{userId:a,tabId:s=(0,p._w)()}=n;return(0,I.i)(e,{newContact:{userId:a}},s)})),(0,a.iw)("openNewContactDialog",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{};return(0,I.i)(e,{newContact:{isByPhoneNumber:!0}},a)})),(0,a.iw)("closeNewContactDialog",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{};return(0,u.ft)(e,a)})),n(73456);var A=n(91947),N=n(26926),x=n(16974);function B(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 L=n(69118);function U(e){document.title!==e&&(document.title=e)}const j=(0,L.Ds)(U,200,!1);var O=n(65116);let F,_;(0,a.iw)("toggleChatInfo",((e,t,n)=>{const{force:a,tabId:s=(0,p._w)()}=n||{},i=void 0!==a?a:!(0,m.jU)(e,s).isChatInfoShown;return e=(0,I.i)(e,{isChatInfoShown:i},s),{...e,lastIsChatInfoShown:i}})),(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,p._w)()}=n||{},{chatId:s}=(0,m.Bt)(e,a)||{};if(!s)return;const i=(0,m.jU)(e,a);return(0,I.i)(e,{management:{byChatId:{...i.management.byChatId,[s]:{...i.management.byChatId[s],isActive:!(i.management.byChatId[s]||{}).isActive}}}},a)})),(0,a.iw)("requestNextManagementScreen",((e,t,n)=>{const{screen:a,tabId:s=(0,p._w)()}=n||{},{chatId:i}=(0,m.Bt)(e,s)||{};if(!i)return;const o=(0,m.jU)(e,s);return(0,I.i)(e,{management:{byChatId:{...o.management.byChatId,[i]:{...o.management.byChatId[i],isActive:!0,nextScreen:a}}}},s)})),(0,a.iw)("closeManagement",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{},{chatId:s}=(0,m.Bt)(e,a)||{};if(!s)return;const i=(0,m.jU)(e,a);return(0,I.i)(e,{management:{byChatId:{...i.management.byChatId,[s]:{...i.management.byChatId[s],isActive:!1}}}},a)})),(0,a.iw)("openChat",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n;if((0,M.W7)()||(0,M.c9)())return(0,I.i)(e,{isLeftColumnShown:0===(0,m.jU)(e,a).messageLists.length},a)})),(0,a.iw)("toggleStatistics",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{},s=(0,m.jU)(e,a);return(0,I.i)(e,{isStatisticsShown:!s.isStatisticsShown,statistics:{...s.statistics,currentMessageId:void 0}},a)})),(0,a.iw)("toggleMessageStatistics",((e,t,n)=>{const{tabId:a=(0,p._w)(),messageId:s}=n||{};return(0,I.i)(e,{statistics:{...(0,m.jU)(e,a).statistics,currentMessageId:s}},a)})),(0,a.iw)("toggleLeftColumn",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{};return(0,I.i)(e,{isLeftColumnShown:!(0,m.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 i=s.filter((e=>e!==a));return i.unshift(a),i.length>32&&i.pop(),{...e,recentEmojis:i}})),(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 i=s.stickers.filter((e=>e.id!==a.id));return i.unshift(a),{...e,stickers:{...e.stickers,recent:{...s,stickers:i}}}})),(0,a.iw)("addRecentCustomEmoji",((e,t,n)=>{const{documentId:a}=n,{recentCustomEmojis:s}=e;if(!s)return{...e,recentCustomEmojis:[a]};const i=s.filter((e=>e!==a));return i.unshift(a),i.length>32&&i.pop(),{...e,recentCustomEmojis:i}})),(0,a.iw)("clearRecentCustomEmoji",(e=>({...e,recentCustomEmojis:[]}))),(0,a.iw)("reorderStickerSets",((e,t,n)=>{const{order:a,isCustomEmoji:s}=n;return{...e,stickers:{...e.stickers,added:{setIds:s?e.stickers.added.setIds:a}},customEmojis:{...e.customEmojis,added:{setIds:s?a:e.customEmojis.added.setIds}}}})),(0,a.iw)("showNotification",((e,t,n)=>{const{tabId:a=(0,p._w)(),...s}=n;s.localId=(0,N.Z)({});const i=[...(0,m.jU)(e,a).notifications],o=i.findIndex((e=>e.message===s.message));return-1!==o&&i.splice(o,1),i.push(s),(0,I.i)(e,{notifications:i},a)})),(0,a.iw)("showAllowedMessageTypesNotification",((e,t,n)=>{const{chatId:a,tabId:s=(0,p._w)()}=n,i=(0,m.Z1)(e,a);if(!i)return;const{canSendPlainText:o,canSendPhotos:r,canSendVideos:c,canSendDocuments:d,canSendAudios:l,canSendStickers:u,canSendRoundVideos:h,canSendVoices:f}=(0,g.H5)(i),I=(0,b.oA)([o?"Chat.SendAllowedContentTypeText":void 0,r?"Chat.SendAllowedContentTypePhoto":void 0,c?"Chat.SendAllowedContentTypeVideo":void 0,f?"Chat.SendAllowedContentTypeVoiceMessage":void 0,h?"Chat.SendAllowedContentTypeVideoMessage":void 0,d?"Chat.SendAllowedContentTypeFile":void 0,l?"Chat.SendAllowedContentTypeMusic":void 0,u?"Chat.SendAllowedContentTypeSticker":void 0]).map((e=>y.Iu(e)));if(!I.length)return void t.showNotification({message:y.Iu("Chat.SendNotAllowedText"),tabId:s});const v=y.Iu("AutoDownloadSettings.LastDelimeter"),w=I.join(", ").replace(/,([^,]*)$/,`${v}$1`);t.showNotification({message:y.Iu("Chat.SendAllowedContentText",w),tabId:s})})),(0,a.iw)("dismissNotification",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n,s=(0,m.jU)(e,a).notifications.filter((e=>{let{localId:t}=e;return t!==n.localId}));return(0,I.i)(e,{notifications:s},a)})),(0,a.iw)("showDialog",((e,t,n)=>{const{data:a,tabId:s=(0,p._w)()}=n;if("message"in a&&a.hasErrorKey&&!(0,A.ZP)(a))return e;const i=[...(0,m.jU)(e,s).dialogs];if("message"in a){const e=i.findIndex((e=>e.message===a.message));-1!==e&&i.splice(e,1)}return i.push(a),(0,I.i)(e,{dialogs:i},s)})),(0,a.iw)("dismissDialog",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{},s=[...(0,m.jU)(e,a).dialogs];return s.pop(),(0,I.i)(e,{dialogs:s},a)})),(0,a.iw)("toggleSafeLinkModal",((e,t,n)=>{const{url:a,tabId:s=(0,p._w)()}=n;return(0,I.i)(e,{safeLinkModalUrl:a},s)})),(0,a.iw)("openHistoryCalendar",((e,t,n)=>{const{selectedAt:a,tabId:s=(0,p._w)()}=n;return(0,I.i)(e,{historyCalendarSelectedAt:a},s)})),(0,a.iw)("closeHistoryCalendar",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{};return(0,I.i)(e,{historyCalendarSelectedAt:void 0},a)})),(0,a.iw)("openGame",((e,t,n)=>{const{url:s,chatId:i,messageId:o,tabId:r=(0,p._w)()}=n,c=(0,m.hj)(e,i,o);if(!c)return;const d=c.viaBotId||c.senderId;if(d){if(!(0,m.LM)(e,d))return e=(0,I.i)(e,{botTrustRequest:{botId:d,type:"game",onConfirm:{action:"openGame",payload:n}}},r),void(0,a.R3)(e);e=(0,I.i)(e,{openedGame:{url:s,chatId:i,messageId:o}},r),(0,a.R3)(e)}})),(0,a.iw)("closeGame",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{};return(0,I.i)(e,{openedGame:void 0},a)})),(0,a.iw)("requestConfetti",((e,t,n)=>{const{top:a,left:s,width:i,height:o,tabId:r=(0,p._w)()}=n||{};if((0,m.FO)(e))return(0,I.i)(e,{confetti:{lastConfettiTime:Date.now(),top:a,left:s,width:i,height:o}},r)})),(0,a.iw)("updateAttachmentSettings",((e,t,n)=>{const{shouldCompress:a,shouldSendGrouped:s}=n;return{...e,attachmentSettings:{shouldCompress:null!=a?a:e.attachmentSettings.shouldCompress,shouldSendGrouped:null!=s?s:e.attachmentSettings.shouldSendGrouped}}})),(0,a.iw)("openLimitReachedModal",((e,t,n)=>{const{limit:a,tabId:s=(0,p._w)()}=n;return(0,I.i)(e,{limitReachedModal:{limit:a}},s)})),(0,a.iw)("closeLimitReachedModal",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{};return(0,I.i)(e,{limitReachedModal:void 0},a)})),(0,a.iw)("closeStickerSetModal",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{};return(0,I.i)(e,{openedStickerSetShortName:void 0},a)})),(0,a.iw)("openCustomEmojiSets",((e,t,n)=>{const{setIds:a,tabId:s=(0,p._w)()}=n;return(0,I.i)(e,{openedCustomEmojiSetIds:a},s)})),(0,a.iw)("closeCustomEmojiSets",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{};return(0,I.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,b.Tw)([...s,...a]).slice(0,i.j7i)}}})),(0,a.iw)("openCreateTopicPanel",((e,t,n)=>{const{chatId:a,tabId:s=(0,p._w)()}=n;return(0,m.jr)(e,s)||t.openChat({id:a,threadId:l._f,tabId:s}),(0,I.i)(e,{createTopicPanel:{chatId:a}},s)})),(0,a.iw)("closeCreateTopicPanel",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{};return(0,I.i)(e,{createTopicPanel:void 0},a)})),(0,a.iw)("openEditTopicPanel",((e,t,n)=>{const{chatId:a,topicId:s,tabId:i=(0,p._w)()}=n;return(0,m.jr)(e,i)||t.openChat({id:a,tabId:i}),(0,I.i)(e,{editTopicPanel:{chatId:a,topicId:s}},i)})),(0,a.iw)("closeEditTopicPanel",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{};return(0,I.i)(e,{editTopicPanel:void 0},a)})),(0,a.iw)("updateArchiveSettings",((e,t,n)=>{const{archiveSettings:a}=e,{isHidden:s=a.isHidden,isMinimized:i=a.isMinimized}=n;return{...e,archiveSettings:{isHidden:s,isMinimized:i}}})),(0,a.iw)("checkAppVersion",(e=>{if(i.D$V)return;const t=/^\d+\.\d+(\.\d+)?$/;fetch(`version.txt?${Date.now()}`).then((e=>e.text())).then((n=>{n=n.trim(),t.test(n)&&"1.61.24"!==n&&(e=(0,a.Rd)(),e={...e,isUpdateAvailable:!0},(0,a.R3)(e))})).catch((e=>{i.eMD&&console.error("[checkAppVersion failed] ",e)}))})),(0,a.iw)("setIsAppUpdateAvailable",((e,t,n)=>{e=(0,a.Rd)(),e={...e,isUpdateAvailable:Boolean(n)},(0,a.R3)(e)})),(0,a.iw)("afterHangUp",(e=>{(0,m.jU)(e,(0,p._w)()).multitabNextAction&&(0,p.g)()})),(0,a.iw)("onTabFocusChange",((e,t,n)=>{const{isBlurred:a,tabId:s=(0,p._w)()}=n;return a?(F&&clearInterval(F),F=window.setInterval((()=>{t.updatePageTitle({tabId:s})}),500)):(clearInterval(F),F=void 0),e=(0,I.i)(e,{isBlurred:a},s),{...e,initialUnreadNotifications:a?(0,x.xW)():void 0}})),(0,a.iw)("updatePageTitle",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{},{canDisplayChatInTitle:s}=e.settings.byKey,o=e.currentUserId;if(document.title.includes(i.ouc))return B(!1),void U(`${i.Tih} ${i.ouc}`);if(e.initialUnreadNotifications&&Math.round(Date.now()/1e3)%2==0){const t=(0,x.xW)()-e.initialUnreadNotifications;if(t>0)return U(`${t} notification${t>1?"s":""}`),void B(!0)}B(!1);const r=(0,m.Bt)(e,a);if(r&&s&&!e.passcode.isScreenLocked){const{chatId:t,threadId:n}=r,a=(0,m.Z1)(e,t);if(a){const e=(0,g.U)(y.Iu,a,t===o);return a.isForum&&a.topics?.[n]?void j(`${e} › ${a.topics[n].title}`):void j(e)}}U(i.Tih)}));let D,$=0;(0,O.ll)((e=>{const{updatePageTitle:t,updateIsOnline:n}=(0,a.Sv)(),s=e.passcode.isScreenLocked!==_,i=Object.values(e.byTabId).filter((e=>e.isBlurred)).length,o=(0,m.jU)(e,(0,p._w)()).isMasterTab;s&&t(),i!==$&&o&&(D&&clearTimeout(D),D=window.setTimeout((()=>{e=(0,a.Rd)();const t=Object.values(e.byTabId).filter((e=>e.isBlurred)).length;n(t!==(0,p.s1)().length)}),100)),_=e.passcode.isScreenLocked,$=i})),(0,a.iw)("closePaymentModal",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{},s=(0,m.jU)(e,a).payment.status;return e=(0,u.bp)(e,a),e=(0,u.WY)(e,a),(0,I.i)(e,{payment:{...(0,m.jU)(e,a).payment,status:s}},a)})),(0,a.iw)("addPaymentError",((e,t,n)=>{const{error:a,tabId:s=(0,p._w)()}=n;return(0,I.i)(e,{payment:{...(0,m.jU)(e,s).payment,status:"failed",error:a}},s)}));var q=n(88422);(0,a.iw)("openMediaViewer",((e,t,n)=>{const{chatId:a,threadId:s,mediaId:i,avatarOwnerId:o,profilePhotoIndex:r,origin:c,volume:d,playbackRate:l,isMuted:u,tabId:h=(0,p._w)()}=n,g=(0,m.jU)(e,h);return(0,I.i)(e,{mediaViewer:{...g.mediaViewer,chatId:a,threadId:s,mediaId:i,avatarOwnerId:o,profilePhotoIndex:r,origin:c,isHidden:!1,volume:null!=d?d:g.mediaViewer.volume,playbackRate:l||g.mediaViewer.playbackRate||e.mediaViewer.lastPlaybackRate,isMuted:u||g.mediaViewer.isMuted},forwardMessages:{}},h)})),(0,a.iw)("closeMediaViewer",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{},{volume:s,isMuted:i,playbackRate:o,isHidden:r}=(0,m.jU)(e,a).mediaViewer;return(0,I.i)(e,{mediaViewer:{volume:s,isMuted:i,isHidden:r,playbackRate:o}},a)})),(0,a.iw)("setMediaViewerVolume",((e,t,n)=>{const{volume:a,tabId:s=(0,p._w)()}=n;return(0,I.i)(e,{mediaViewer:{...(0,m.jU)(e,s).mediaViewer,volume:a,isMuted:!1}},s)})),(0,a.iw)("setMediaViewerPlaybackRate",((e,t,n)=>{const{playbackRate:a,tabId:s=(0,p._w)()}=n;return e={...e,mediaViewer:{...e.mediaViewer,lastPlaybackRate:a}},(0,I.i)(e,{mediaViewer:{...(0,m.jU)(e,s).mediaViewer,playbackRate:a}},s)})),(0,a.iw)("setMediaViewerMuted",((e,t,n)=>{const{isMuted:a,tabId:s=(0,p._w)()}=n;return(0,I.i)(e,{mediaViewer:{...(0,m.jU)(e,s).mediaViewer,isMuted:a}},s)})),(0,a.iw)("setMediaViewerHidden",((e,t,n)=>{const{isHidden:a,tabId:s=(0,p._w)()}=n;return(0,I.i)(e,{mediaViewer:{...(0,m.jU)(e,s).mediaViewer,isHidden:a}},s)}));var H=n(50214),G=n(95281),V=n(5872),W=n(35369);let z=!1;(0,L.Gq)((()=>{(0,a.Rd)().passcode.hasPasscode&&!z&&1===Object.keys((0,a.Rd)().byTabId).length&&(0,H.jv)()})),(0,a.iw)("setPasscode",(async(e,t,n)=>{const{passcode:s,tabId:i=(0,p._w)()}=n;e=(0,u.vu)(e,{isLoading:!0}),(0,a.R3)(e),await(0,G.AU)(s);const o=JSON.stringify({...(0,H.K8)(),userId:e.currentUserId});e=(0,a.Rd)();const r=(0,V.Uf)((0,u.vu)(e,{hasPasscode:!0,error:void 0,isLoading:!1}));try{await(0,G.H4)(o,r),(0,p.Z6)(),e=(0,a.Rd)(),e=(0,u.vu)(e,{hasPasscode:!0,error:void 0,isLoading:!1}),(0,a.R3)(e),(0,V.jA)(!0)}catch(n){(0,G.J9)(),e=(0,a.Rd)(),e=(0,u.vu)(e,{isLoading:!1}),(0,a.R3)(e),t.showNotification({message:"Failed to set passcode",tabId:i}),t.requestNextSettingsScreen({screen:w.MT.PasscodeDisabled,tabId:i})}})),(0,a.iw)("clearPasscode",(e=>((0,G.C8)(),(0,u.Kn)(e)))),(0,a.iw)("unlockScreen",((e,t,n)=>{const s=Object.values(e.byTabId),{sessionJson:i,globalJson:o}=n,r=JSON.parse(i);(0,H.wX)(r,r.userId);const c=e;(e=JSON.parse(o)).byTabId=c.byTabId,(0,V.nE)(e,(0,b.Xh)(W.g9)),e=(0,u.vu)(e,{isScreenLocked:!1,error:void 0,invalidAttemptsCount:0}),(0,a.R3)(e),(0,p.Z6)(),s.forEach((e=>{let{id:n,isMasterTab:a}=e;return t.init({tabId:n,isMasterTab:a})})),t.initApi()})),(0,a.iw)("decryptSession",((e,t,n)=>{const{passcode:a}=n;(0,G.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,u.vu)(e,{invalidAttemptsCount:n,timeoutUntil:n>=5?Date.now()+15e3:void 0})})),(0,a.iw)("resetInvalidUnlockAttempts",(e=>(0,u.vu)(e,{invalidAttemptsCount:0,timeoutUntil:void 0}))),(0,a.iw)("setPasscodeError",((e,t,n)=>{const{error:a}=n;return(0,u.vu)(e,{error:a})})),(0,a.iw)("clearPasscodeError",(e=>(0,u.vu)(e,{error:void 0}))),(0,a.iw)("skipLockOnUnload",(()=>{z=!0})),(0,a.iw)("openChat",((e,t,n)=>{const{id:a,tabId:s=(0,p._w)()}=n;return a?(0,I.i)(e,{reactionPicker:{chatId:a,messageId:void 0,position:void 0}},s):(0,I.i)(e,{reactionPicker:void 0},s)})),(0,a.iw)("openReactionPicker",((e,t,n)=>{const{chatId:a,messageId:s,position:i,tabId:o=(0,p._w)()}=n;return(0,I.i)(e,{reactionPicker:{chatId:a,messageId:s,position:i}},o)})),(0,a.iw)("closeReactionPicker",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{},s=(0,m.jU)(e,a);return(0,I.i)(e,{reactionPicker:{...s.reactionPicker,messageId:void 0,position:void 0}},a)})),n(65456);var X=n(27225),Y=n(71226),J=n(81396);const K=new Map,Q=(0,L.Ds)((e=>e()),500,!1);async function ee(e,t,n,s,o){let r=arguments.length>5&&void 0!==arguments[5]&&arguments[5],c=arguments.length>6&&void 0!==arguments[6]&&arguments[6];for(var d=arguments.length,l=new Array(d>7?d-7:0),h=7;h<d;h++)l[h-7]=arguments[h];let[g=(0,p._w)()]=l;const f=t.id;let I,v=i.hT6;switch(o){case w.Uq.Backwards:s?(I=-1,v+=1):I=void 0;break;case w.Uq.Around:I=-(Math.round(i.hT6/2)+1);break;case w.Uq.Forwards:I=-(i.hT6+1),s&&(v+=1)}e=(0,a.Rd)();const Z=await(0,Y.t9)("fetchMessages",{chat:(0,m.Z1)(e,f),offsetId:s,addOffset:I,limit:v,threadId:n});if(!Z)return;const{messages:P,users:y,chats:C,repliesThreadInfos:S}=Z;e=(0,a.Rd)();const E=f===i.awM?e.serviceNotifications.filter((e=>{let{isDeleted:t}=e;return!t})).map((e=>{let{message:t}=e;return t})):[],M=[].concat(P,E),R=(0,b.ee)(M,"id"),k=Object.keys(R).map(Number);e=(0,u.c_)(e,f,R),e=r?(0,u.hv)(e,f,n,k):(0,u.xj)(e,f,n,k),e=(0,u.Sh)(e,(0,b.ee)(y,"id")),e=(0,u.fZ)(e,(0,b.ee)(C,"id")),e=(0,u.j6)(e,f,S);let T=(0,m.gb)(e,f,n);const A=s?(0,m.of)(e,f,n,s):void 0;if(r&&T&&A&&(A.length&&!(0,b.YE)(T,A)||(e=(0,u.xj)(e,f,n,A),T=(0,m.gb)(e,f,n),e=(0,u.IU)(e,f,n,A),r=!1)),!c){const t=r?A:T,{newViewportIds:a}=te(t,s,o);e=(0,u.y9)(e,f,n,a,g)}(0,a.R3)(e)}function te(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,o=n===w.Uq.Backwards?s:s+1||a,r=n===w.Uq.Around?Math.round(i.hT6/2):i.hT6,c=o-r,d=o+r-1,l=e.slice(Math.max(0,c),d+1);let u,m;switch(n){case w.Uq.Backwards:u=o>=0,m=c>=0;break;case w.Uq.Forwards:u=o<a,m=d<=a-1;break;case w.Uq.Around:default:u=l.length>0,m=l.length===i.hT6}return{newViewportIds:l,areSomeLocal:u,areAllLocal:m}}async function ne(e,t){let n;const i=t.attachment?(t,s)=>{K.has(s)||(n=s,K.set(s,i)),e=(0,a.Rd)(),e={...e,fileUploads:{byMessageLocalId:{...e.fileUploads.byMessageLocalId,[s]:{progress:t}}}},(0,a.R3)(e)}:void 0;(t.replyingTo||s.cj)&&await(0,L.Pn)(),e=(0,a.Rd)(),void 0!==t.currentThreadId&&(t.replyingTo||t.currentThreadId===l._f||(t.replyingTo=(0,m.qS)(e,t.chat.id,t.currentThreadId)),t.replyingTo&&!t.replyingToTopId&&t.currentThreadId!==l._f&&(t.replyingToTopId=(0,m.qS)(e,t.chat.id,t.currentThreadId)),await(0,Y.t9)("sendMessage",t,i),i&&n&&K.delete(n))}(0,a.iw)("loadViewportMessages",((e,t,n)=>{const{direction:s=w.Uq.Around,isBudgetPreload:i=!1,shouldForceRender:o=!1,tabId:r=(0,p._w)()}=n||{};let{chatId:c,threadId:d}=n||{};if(!c||!d){const t=(0,m.Bt)(e,r);if(!t)return;c=t.chatId,d=t.threadId}const l=(0,m.Z1)(e,c);if(!l||l.isRestricted)return;const h=(0,m.Cb)(e,c,d,r),g=(0,m.gb)(e,c,d);if(h&&h.length&&s!==w.Uq.Around){const n=s===w.Uq.Backwards?h[0]:h[h.length-1],a=Boolean(g&&!g.includes(n)),o=a?(0,m.of)(e,c,d,n):g,{newViewportIds:f,areSomeLocal:I,areAllLocal:v}=te(o,n,s);if(I&&(e=(0,u.y9)(e,c,d,f,r)),(0,L.R3)((()=>{!async function(e,t,n,a,s,i,o,r,c){for(var d=arguments.length,l=new Array(d>9?d-9:0),u=9;u<d;u++)l[u-9]=arguments[u];let[m=(0,p._w)()]=l;n||await ee(e,i,o,c,r,a,s,m),s||t.loadViewportMessages({chatId:i.id,threadId:o,direction:r,isBudgetPreload:!0,tabId:m})}(e,t,v,a,i,l,d,s,n,r)})),i)return}else{const t=(0,m.G$)(e,c,r)||(0,m.rd)(e,c,d),n=Boolean(t&&g&&!g.includes(t)),a=(n?(0,m.of)(e,c,d,t):g)||[],{newViewportIds:s,areSomeLocal:o,areAllLocal:h}=te(a,t,w.Uq.Around);o&&(e=(0,u.y9)(e,c,d,s,r)),h||(0,L.R3)((()=>{ee(e,l,d,t,w.Uq.Around,n,i,r)}))}(0,a.R3)(e,{forceOnHeavyAnimation:o})})),(0,a.iw)("loadMessage",(async(e,t,n)=>{const{chatId:s,messageId:i,replyOriginForId:o,threadUpdate:r}=n,c=(0,m.Z1)(e,s);if(!c)return;const d=await async function(e,t,n,s){const i=await(0,Y.t9)("fetchMessage",{chat:t,messageId:n});if(i){if(i!==l._Q)return e=(0,a.Rd)(),e=(0,u.cY)(e,t.id,n,i.message),e=(0,u.Sh)(e,(0,b.ee)(i.users,"id")),(0,a.R3)(e),i.message;if(s){e=(0,a.Rd)();const n=(0,m.hj)(e,t.id,s);e=(0,u.cY)(e,t.id,s,{...n,replyToMessageId:void 0}),(0,a.R3)(e)}}}(e,c,i,o);if(d&&r){const{lastMessageId:t,isDeleting:n}=r;e=(0,a.Rd)(),e=(0,u.lG)(e,d,s,t,n),(0,a.R3)(e)}})),(0,a.iw)("sendMessage",((e,t,n)=>{const{messageList:a,tabId:s=(0,p._w)()}=n;if(!a)return;const{chatId:o,threadId:r,type:c}=a;if(n=(0,b.CE)(n,["tabId"]),"scheduled"===c&&!n.scheduledAt)return(0,I.i)(e,{contentToBeScheduled:n},s);const d=(0,m.Z1)(e,o),l=(0,m.Yy)(e,o,r),u=l?(0,m.hj)(e,o,l):void 0,h=d.isForum?(0,m.qS)(e,o,r):u?.replyToTopMessageId||u?.replyToMessageId,g={...n,chat:d,currentThreadId:a.threadId,replyingTo:l,replyingToTopId:h,noWebPage:(0,m.tV)(e,o,r),sendAs:(0,m._5)(e,o)};t.setReplyingToId({messageId:void 0,tabId:s}),t.clearWebPagePreview({tabId:s});const f=!n.attachments||n.attachments.length<=1,v=!f&&n.shouldGroupMessages;if(f){const{attachments:t,...n}=g;ne(e,{...n,attachment:t?t[0]:void 0})}else if(v){const{text:t,entities:n,attachments:a,...s}=g,o=function(e){return e.reduce(((e,t,n,a)=>0===n?(e.push([t]),e):(oe(t)===oe(a[n-1])?e[e.length-1].push(t):e.push([t]),e)),[])}(a);o.forEach(((a,o)=>{const r=(0,b.Vl)(a,i.DUi);for(let a=0;a<r.length;a++){const[i,...c]=r[a],d=`${Date.now()}${o}${a}`,l=0===a&&0===o;ne(e,{...s,text:l?t:void 0,entities:l?n:void 0,attachment:i,groupedId:c.length>0?d:void 0}),c.forEach((t=>{ne(e,{...s,attachment:t,groupedId:d})}))}}))}else{const{text:t,entities:n,attachments:a,replyingTo:s,...i}=g;t&&ne(e,{...i,text:t,entities:n,replyingTo:s}),a?.forEach((t=>{ne(e,{...i,attachment:t})}))}})),(0,a.iw)("editMessage",((e,t,n)=>{const{messageList:a,text:s,entities:i,tabId:o=(0,p._w)()}=n;if(!a)return;const{chatId:r,threadId:c,type:d}=a,l=(0,m.Z1)(e,r),u=(0,m.kK)(e,r,c,d);l&&u&&((0,Y.t9)("editMessage",{chat:l,message:u,text:s,entities:i,noWebPage:(0,m.tV)(e,r,c)}),t.setEditingId({messageId:void 0,tabId:o}))})),(0,a.iw)("cancelSendingMessage",((e,t,n)=>{const{chatId:a,messageId:s}=n,i=(0,m.hj)(e,a,s),o=i&&K.get((0,g.KK)(i));o&&(0,Y.u3)(o),t.apiUpdate({"@type":"deleteMessages",ids:[s],chatId:a})})),(0,a.iw)("saveDraft",(async(e,t,n)=>{const{chatId:s,threadId:i,draft:o,shouldForce:r}=n;if(!o)return;const{text:c,entities:d}=o,l=(0,m.Z1)(e,s),h=(0,m.dy)(e,s);h&&(0,g.NB)(h)||(o.isLocal=!0,o.shouldForce=r,e=(0,u.pf)(e,s,i,"draft",o),e=(0,u.a4)(e,s,{draftDate:Math.round(Date.now()/1e3)}),(0,a.R3)(e),await(0,Y.t9)("saveDraft",{chat:l,text:c,entities:d,replyToMsgId:(0,m.Yy)(e,s,i),threadId:(0,m.qS)(e,s,i)})&&(o.isLocal=!1),e=(0,a.Rd)(),e=(0,u.pf)(e,s,i,"draft",o),e=(0,u.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=l._f,localOnly:i,shouldForce:o}=n;if(!(0,m.Ms)(e,a,s))return;const r=(0,m.Z1)(e,a);i||(0,Y.t9)("clearDraft",r,(0,m.qS)(e,a,s));const c=o?{shouldForce:o,text:""}:void 0;return e=(0,u.pf)(e,a,s,"draft",c),(0,u.a4)(e,a,{draftDate:void 0})})),(0,a.iw)("toggleMessageWebPage",((e,t,n)=>{const{chatId:a,threadId:s,noWebPage:i}=n;return(0,u.pf)(e,a,s,"noWebPage",i)})),(0,a.iw)("pinMessage",((e,t,n)=>{const{messageId:a,isUnpin:s,isOneSide:i,isSilent:o,tabId:r=(0,p._w)()}=n,c=(0,m.jr)(e,r);c&&(0,Y.t9)("pinMessage",{chat:c,messageId:a,isUnpin:s,isOneSide:i,isSilent:o})})),(0,a.iw)("unpinAllMessages",(async(e,t,n)=>{const{chatId:s,threadId:i}=n,o=(0,m.Z1)(e,s);if(!o)return;const r=(0,m.qS)(e,s,i);await(0,Y.t9)("unpinAllMessages",{chat:o,threadId:r}),e=(0,a.Rd)(),(0,m.KB)(e,s,i)?.forEach((t=>{e=(0,u.cY)(e,s,t,{isPinned:!1})})),e=(0,u.pf)(e,o.id,l._f,"pinnedIds",[]),(0,a.R3)(e)})),(0,a.iw)("deleteMessages",((e,t,n)=>{const{messageIds:a,shouldDeleteForAll:s,tabId:i=(0,p._w)()}=n,o=(0,m.Bt)(e,i);if(!o)return;const{chatId:r,threadId:c}=o,d=(0,m.Z1)(e,r);(0,Y.t9)("deleteMessages",{chat:d,messageIds:a,shouldDeleteForAll:s});const l=(0,m._$)(e,r,c);l&&a.includes(l)&&t.setEditingId({messageId:void 0,tabId:i})})),(0,a.iw)("deleteScheduledMessages",((e,t,n)=>{const{messageIds:a,tabId:s=(0,p._w)()}=n,i=(0,m.Bt)(e,s);if(!i)return;const{chatId:o}=i,r=(0,m.Z1)(e,o);(0,Y.t9)("deleteScheduledMessages",{chat:r,messageIds:a});const c=(0,m.wU)(e,o);c&&a.includes(c)&&t.setEditingId({messageId:void 0,tabId:s})})),(0,a.iw)("deleteHistory",(async(e,t,n)=>{const{chatId:s,shouldDeleteForAll:i,tabId:o=(0,p._w)()}=n,r=(0,m.Z1)(e,s);if(!r)return;await(0,Y.t9)("deleteHistory",{chat:r,shouldDeleteForAll:i}),e=(0,a.Rd)();const c=(0,m.Bt)(e,o);c&&c.chatId===s&&t.openChat({id:void 0,tabId:o});const d=e.chatFolders.byId;Object.values(d).forEach((e=>{if(e.includedChatIds.includes(s)||e.pinnedChatIds?.includes(s)){const t=e.includedChatIds.filter((e=>e!==s)),n=e.pinnedChatIds?.filter((e=>e!==s)),a={...e,includedChatIds:t,pinnedChatIds:n};(0,Y.t9)("editChatFolder",{id:e.id,folderUpdate:a})}}))})),(0,a.iw)("reportMessages",(async(e,t,n)=>{const{messageIds:a,reason:s,description:i,tabId:o=(0,p._w)()}=n,r=(0,m.Bt)(e,o);if(!r)return;const{chatId:c}=r,d=(0,m.Z1)(e,c),l=await(0,Y.t9)("reportMessages",{peer:d,messageIds:a,reason:s,description:i});t.showNotification({message:l?(0,y.Iu)("ReportPeer.AlertSuccess"):"An error occurred while submitting your report. Please, try again later.",tabId:o})})),(0,a.iw)("sendMessageAction",(async(e,t,n)=>{const{action:a,chatId:s,threadId:i}=n;if(s===e.currentUserId)return;const o=(0,m.Z1)(e,s);if(!o)return;const r=(0,m.dy)(e,s);r&&((0,g.cS)(r)||(0,g.NB)(r))||await(0,Y.t9)("sendMessageAction",{peer:o,threadId:i,action:a})})),(0,a.iw)("markMessageListRead",((e,t,n)=>{const{maxId:a,tabId:s=(0,p._w)()}=n,o=(0,m.Bt)(e,s);if(!o)return;const{chatId:r,threadId:c}=o,d=(0,m.Z1)(e,r);if(!d)return;Q((()=>{(0,Y.t9)("markMessageListRead",{chat:d,threadId:c,maxId:a})})),r===i.awM&&(e={...e,serviceNotifications:e.serviceNotifications.map((e=>e.isUnread&&e.id<=a?{...e,isUnread:!1}:e))});const h=(0,m.Cb)(e,r,c,s),g=(0,m.It)(e,r,c);if(!h||!g||!d.unreadCount)return e;const f=function(e,t,n){let a=0;for(let s=0,i=e.length;s<i&&(e[s]>=t&&e[s]<=n&&a++,!(e[s]>=n));s++);return a}(h,g,a);if(!f)return e;if(d.isForum&&d.topics?.[c]){const t=d.topics[c];e=(0,u.Xg)(e,r,c,{lastReadInboxMessageId:a});const n=Math.max(0,t.unreadCount-f);return 0===n&&(e=(0,u.a4)(e,r,{unreadCount:Math.max(0,d.unreadCount-1)})),(0,u.Cn)(e,r,c,{unreadCount:n})}return c===l._f?(0,u.a4)(e,r,{lastReadInboxMessageId:a,unreadCount:Math.max(0,d.unreadCount-f)}):void 0})),(0,a.iw)("markMessagesRead",((e,t,n)=>{const{messageIds:a,tabId:s=(0,p._w)()}=n,i=(0,m.jr)(e,s);i&&(0,Y.t9)("markMessagesRead",{chat:i,messageIds:a})})),(0,a.iw)("loadWebPagePreview",(async(e,t,n)=>{const{text:s,tabId:i=(0,p._w)()}=n,o=await(0,Y.t9)("fetchWebPagePreview",{text:s});e=(0,a.Rd)(),e=(0,I.i)(e,{webPagePreview:o},i),(0,a.R3)(e)})),(0,a.iw)("clearWebPagePreview",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{};if((0,m.jU)(e,a).webPagePreview)return(0,I.i)(e,{webPagePreview:void 0},a)})),(0,a.iw)("sendPollVote",((e,t,n)=>{const{chatId:a,messageId:s,options:i}=n,o=(0,m.Z1)(e,a);o&&(0,Y.t9)("sendPollVote",{chat:o,messageId:s,options:i})})),(0,a.iw)("cancelPollVote",((e,t,n)=>{const{chatId:a,messageId:s}=n,i=(0,m.Z1)(e,a);i&&(0,Y.t9)("sendPollVote",{chat:i,messageId:s,options:[]})})),(0,a.iw)("closePoll",((e,t,n)=>{const{chatId:a,messageId:s}=n,i=(0,m.Z1)(e,a),o=(0,m.hj)(e,a,s)?.content.poll;i&&o&&(0,Y.t9)("closePoll",{chat:i,messageId:s,poll:o})})),(0,a.iw)("loadPollOptionResults",(async(e,t,n)=>{const{chat:s,messageId:i,option:o,offset:r,limit:c,shouldResetVoters:d,tabId:l=(0,p._w)()}=n,h=await(0,Y.t9)("loadPollOptionResults",{chat:s,messageId:i,option:o,offset:r,limit:c});if(!h)return;e=(0,a.Rd)(),e=(0,u.Sh)(e,(0,b.ee)(h.users,"id"));const g=(0,m.jU)(e,l),{pollResults:f}=g,{voters:v}=g.pollResults;e=(0,I.i)(e,{pollResults:{...f,voters:{...v,[o]:(0,b.Tw)([...!d&&v&&v[o]?v[o]:[],...h&&h.users.map((e=>e.id))])},offsets:{...f.offsets?f.offsets:{},[o]:h.nextOffset||""}}},l),(0,a.R3)(e)})),(0,a.iw)("loadExtendedMedia",((e,t,n)=>{const{chatId:a,ids:s}=n,i=(0,m.Z1)(e,a);i&&(0,Y.t9)("fetchExtendedMedia",{chat:i,ids:s})})),(0,a.iw)("forwardMessages",((e,t,n)=>{const{isSilent:s,scheduledAt:i,tabId:o=(0,p._w)()}=n,{fromChatId:r,messageIds:c,toChatId:d,withMyScore:u,noAuthors:h,noCaptions:f,toThreadId:v}=(0,m.jU)(e,o).forwardMessages,w=(0,m.wV)(e),b=r?(0,m.Z1)(e,r):void 0,Z=d?(0,m.Z1)(e,d):void 0,P=r&&c?c.sort(((e,t)=>e-t)).map((t=>(0,m.hj)(e,r,t))).filter(Boolean):void 0;if(!b||!Z||!P||v&&!Z.isForum)return;const y=(0,m._5)(e,d),C=P.filter((e=>!(0,g.jM)(e)));C.length&&(0,Y.t9)("forwardMessages",{fromChat:b,toChat:Z,toThreadId:v,messages:C,isSilent:s,scheduledAt:i,sendAs:y,withMyScore:u,noAuthors:h,noCaptions:f,isCurrentUserPremium:w}),P.filter((e=>(0,g.jM)(e))).forEach((t=>{const{text:n,entities:a}=t.content.text||{},{sticker:o,poll:r}=t.content;ne(e,{chat:Z,replyingToTopId:v,currentThreadId:v||l._f,text:n,entities:a,sticker:o,poll:r,isSilent:s,scheduledAt:i,sendAs:y})})),e=(0,a.Rd)(),e=(0,I.i)(e,{forwardMessages:{}},o),(0,a.R3)(e)})),(0,a.iw)("loadScheduledHistory",(async(e,t,n)=>{const{chatId:s}=n,i=(0,m.Z1)(e,s);if(!i)return;const o=await(0,Y.t9)("fetchScheduledHistory",{chat:i});if(!o)return;const{messages:r}=o,c=(0,b.ee)(r,"id"),d=Object.keys(c).map(Number).sort(((e,t)=>t-e));if(e=(0,a.Rd)(),e=(0,u.w3)(e,i.id,c),e=(0,u.pf)(e,i.id,l._f,"scheduledIds",d),i?.isForum){const t={};r.forEach((n=>{const a=(0,m.nr)(e,n),s=t[a]||[];s.push(n.id),t[a]=s})),Object.entries(t).forEach((t=>{let[n,a]=t;e=(0,u.pf)(e,i.id,Number(n),"scheduledIds",a)}))}(0,a.R3)(e)})),(0,a.iw)("sendScheduledMessages",((e,t,n)=>{const{chatId:a,id:s}=n,i=(0,m.Z1)(e,a);i&&(0,Y.t9)("sendScheduledMessages",{chat:i,ids:[s]})})),(0,a.iw)("rescheduleMessage",((e,t,n)=>{const{chatId:a,messageId:s,scheduledAt:i}=n,o=(0,m.Z1)(e,a),r=o&&(0,m.Tm)(e,o.id,s);o&&r&&(0,Y.t9)("rescheduleMessage",{chat:o,message:r,scheduledAt:i})})),(0,a.iw)("requestThreadInfoUpdate",(async(e,t,n)=>{const{chatId:s,threadId:i}=n,o=(0,m.Z1)(e,s);if(!o)return;const r=(0,m.Cm)(e,s,i)?.id,c=await(0,Y.t9)("requestThreadInfoUpdate",{chat:o,threadId:i,originChannelId:r});c&&(e=(0,a.Rd)(),e=(0,u.Sh)(e,(0,b.ee)(c.users,"id")),(0,a.R3)(e))})),(0,a.iw)("transcribeAudio",(async(e,t,n)=>{const{messageId:s,chatId:i}=n,o=(0,m.Z1)(e,i);if(!o)return;e=(0,u.cY)(e,i,s,{transcriptionId:""}),(0,a.R3)(e);const r=await(0,Y.t9)("transcribeAudio",{chat:o,messageId:s});e=(0,a.Rd)(),e=(0,u.cY)(e,i,s,{transcriptionId:r,isTranscriptionError:!r}),(0,a.R3)(e)})),(0,a.iw)("loadCustomEmojis",(async(e,t,n)=>{const{ids:s,ignoreCache:i}=n,o=i?s:(0,b.Tw)(s.filter((t=>!e.customEmojis.byId[t]))),r=await(0,Y.t9)("fetchCustomEmoji",{documentId:o});r&&(e=(0,a.Rd)(),e={...e,customEmojis:{...e.customEmojis,byId:{...e.customEmojis.byId,...(0,b.ee)(r,"id")}}},(0,a.R3)(e))})),(0,a.iw)("loadPinnedMessages",(async(e,t,n)=>{const{chatId:s,threadId:i}=n,o=(0,m.Z1)(e,s);if(!o)return;const r=await(0,Y.t9)("fetchPinnedMessages",{chat:o,threadId:i});if(!r)return;const{messages:c,chats:d,users:l}=r,h=(0,b.ee)(c,"id"),g=Object.keys(h).map(Number).sort(((e,t)=>t-e));e=(0,a.Rd)(),e=(0,u.c_)(e,o.id,h),e=(0,u.HX)(e,o.id,i,g),e=(0,u.Sh)(e,(0,b.ee)(l,"id")),e=(0,u.fZ)(e,(0,b.ee)(d,"id")),(0,a.R3)(e)})),(0,a.iw)("loadSeenBy",(async(e,t,n)=>{const{chatId:s,messageId:i}=n,o=(0,m.Z1)(e,s);if(!o)return;const r=await(0,Y.t9)("fetchSeenBy",{chat:o,messageId:i});r&&(e=(0,a.Rd)(),e=(0,u.cY)(e,s,i,{seenByDates:r}),(0,a.R3)(e))})),(0,a.iw)("saveDefaultSendAs",((e,t,n)=>{const{chatId:a,sendAsId:s}=n,i=(0,m.Z1)(e,a),o=(0,m.Z1)(e,s)||(0,m.dy)(e,s);if(i&&o)return(0,Y.t9)("saveDefaultSendAs",{sendAs:o,chat:i}),(0,u.US)(e,a,{sendAsId:s})})),(0,a.iw)("loadSendAs",(async(e,t,n)=>{const{chatId:s}=n,i=(0,m.Z1)(e,s);if(!i)return;const o=await(0,Y.t9)("fetchSendAs",{chat:i});if(!o)return e=(0,a.Rd)(),e=(0,u.a4)(e,s,{sendAsPeerIds:[]}),void(0,a.R3)(e);e=(0,a.Rd)(),e=(0,u.Sh)(e,(0,b.ee)(o.users,"id")),e=(0,u.fZ)(e,(0,b.ee)(o.chats,"id")),e=(0,u.a4)(e,s,{sendAsPeerIds:o.sendAs}),(0,a.R3)(e)})),(0,a.iw)("loadSponsoredMessages",(async(e,t,n)=>{const{chatId:s}=n,i=(0,m.Z1)(e,s);if(!i)return;const o=await(0,Y.t9)("fetchSponsoredMessages",{chat:i});o&&(e=(0,a.Rd)(),e=(0,u.Fn)(e,s,o.messages[0]),e=(0,u.Sh)(e,(0,b.ee)(o.users,"id")),e=(0,u.fZ)(e,(0,b.ee)(o.chats,"id")),(0,a.R3)(e))})),(0,a.iw)("viewSponsoredMessage",((e,t,n)=>{const{chatId:a}=n,s=(0,m.Z1)(e,a),i=(0,m.fS)(e,a);s&&i&&(0,Y.t9)("viewSponsoredMessage",{chat:s,random:i.randomId})})),(0,a.iw)("fetchUnreadMentions",(async(e,t,n)=>{const{chatId:s,offsetId:i}=n,o=(0,m.Z1)(e,s);if(!o)return;const r=await(0,Y.t9)("fetchUnreadMentions",{chat:o,offsetId:i});if(!r)return;const{messages:c,chats:d,users:l}=r,h=(0,b.ee)(c,"id"),g=Object.keys(h).map(Number);e=(0,a.Rd)(),e=(0,u.c_)(e,o.id,h),e=(0,u.Sh)(e,(0,b.ee)(l,"id")),e=(0,u.fZ)(e,(0,b.ee)(d,"id")),e=(0,u.a4)(e,s,{unreadMentions:[...o.unreadMentions||[],...g]}),(0,a.R3)(e)})),(0,a.iw)("markMentionsRead",((e,t,n)=>{const{messageIds:s,tabId:i=(0,p._w)()}=n,o=(0,m.jr)(e,i);if(!o)return;const r=(o.unreadMentions||[]).filter((e=>!s.includes(e)));e=(0,u.a4)(e,o.id,{unreadMentions:r}),(0,a.R3)(e),t.markMessagesRead({messageIds:s,tabId:i})})),(0,a.iw)("focusNextMention",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{},s=(0,m.jr)(e,a);s?.unreadMentions&&t.focusMessage({chatId:s.id,messageId:s.unreadMentions[0],tabId:a})})),(0,a.iw)("readAllMentions",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{},s=(0,m.jr)(e,a);if(s)return(0,Y.t9)("readAllMentions",{chat:s}),(0,u.a4)(e,s.id,{unreadMentionsCount:void 0,unreadMentions:void 0})})),(0,a.iw)("openUrl",((e,t,n)=>{const{url:a,shouldSkipModal:s,tabId:o=(0,p._w)()}=n,r=(0,J.X)(a);if(r.match(i.FSu)||r.match(i.g$l))return void t.openTelegramLink({url:a,tabId:o});const{appConfig:c,config:d}=e;if(c){const e=new URL(r);if(d?.autologinToken&&c.autologinDomains.includes(e.hostname))return e.searchParams.set("autologin_token",d.autologinToken),void window.open(e.href,"_blank","noopener");if(c.urlAuthDomains.includes(e.hostname))return void t.requestLinkUrlAuth({url:a,tabId:o})}r.match(i.jL5)||s?window.open(r,"_blank","noopener"):t.toggleSafeLinkModal({url:r,tabId:o})})),(0,a.iw)("setForwardChatOrTopic",(async(e,t,n)=>{const{chatId:s,topicId:i,tabId:o=(0,p._w)()}=n;let r=(0,m.dy)(e,s);if(r&&(0,m.Nm)(e,o)){let n=(0,m.iF)(e,s);if(!n){const{accessHash:t}=r,i=await(0,Y.t9)("fetchFullUser",{id:s,accessHash:t});e=(0,a.Rd)(),r=i?.user,n=i?.fullInfo}if(n.noVoiceMessages)return void t.showDialog({data:{message:(0,y.Iu)("VoiceMessagesRestrictedByPrivacy",(0,g.Js)(r))},tabId:o})}(0,m.GQ)(e,s,o)?(e=(0,I.i)(e,{forwardMessages:{...(0,m.jU)(e,o).forwardMessages,toChatId:s,toThreadId:i,isModalShown:!1}},o),(0,a.R3)(e),t.openChat({id:s,threadId:i,tabId:o}),t.closeMediaViewer({tabId:o}),t.exitMessageSelectMode({tabId:o})):t.showAllowedMessageTypesNotification({chatId:s,tabId:o})})),(0,a.iw)("forwardToSavedMessages",((e,t,n)=>{const{tabId:s=(0,p._w)()}=n||{};e=(0,I.i)(e,{forwardMessages:{...(0,m.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:i=(0,m.rB)(e),tabId:o=(0,p._w)()}=n;return(0,u.ql)(e,a,s,i,o)})),(0,a.iw)("showOriginalMessage",((e,t,n)=>{const{chatId:a,id:s,tabId:i=(0,p._w)()}=n;return(0,u.IR)(e,a,s,i)})),(0,a.iw)("translateMessages",((e,t,n)=>{const{chatId:a,messageIds:s,toLanguageCode:i=(0,m.rB)(e)}=n,o=(0,m.Z1)(e,a);if(o)return s.forEach((t=>{e=(0,u.qt)(e,a,t,i,{isPending:!0})})),(0,Y.t9)("translateText",{chat:o,messageIds:s,toLanguageCode:i}),e}));let ae,se={};function ie(){ae&&(clearTimeout(ae),ae=void 0);const{loadMessageViews:e}=(0,a.Sv)();Object.entries(se).forEach((t=>{let[n,a]=t;e({chatId:n,ids:Array.from(a),shouldIncrement:!0})})),se={}}function oe(e){const{shouldSendAsFile:t,mimeType:n}=e;return t?"file":n===i.s11?"gif":i.oGt.has(n)||i.wGh.has(n)?"media":i.e74.has(n)?"audio":e.voice?"voice":"file"}(0,a.iw)("scheduleForViewsIncrement",((e,t,n)=>{const{ids:a,chatId:s}=n;ae||setTimeout(ie,1e3),se[s]||(se[s]=new Set),a.forEach((e=>{se[s].add(e)}))})),(0,a.iw)("loadMessageViews",(async(e,t,n)=>{const{chatId:s,ids:i,shouldIncrement:o}=n,r=(0,m.Z1)(e,s);if(!r)return;const c=await(0,Y.t9)("fetchMessageViews",{chat:r,ids:i,shouldIncrement:o});c&&(e=(0,a.Rd)(),c.forEach((t=>{e=(0,u.cY)(e,s,t.id,{views:t.views,forwards:t.forwards});const n=(0,m.hj)(e,s,t.id);if(!n)return;const a=n.repliesThreadInfo?.chatId,i=n.repliesThreadInfo?.threadId;a&&i&&(e=(0,u.Xg)(e,a,i,{messagesCount:t.messagesCount,recentReplierIds:t.recentReplierIds,lastMessageId:t.maxId,lastReadInboxMessageId:t.readMaxId}))})),(0,a.R3)(e))}));var re=n(85765),ce=n(9211);const de=(0,L.P2)((e=>e()),500,!1);async function le(e,t){const n=await(0,Y.t9)("fetchRecentStickers",{hash:t});n&&(e=(0,a.Rd)(),e={...e,stickers:{...e.stickers,recent:n}},(0,a.R3)(e))}async function ue(e,t,n){for(var s=arguments.length,i=new Array(s>3?s-3:0),o=3;o<s;o++)i[o-3]=arguments[o];let r,[c=(0,p._w)()]=i;try{r=await(0,Y.t9)("fetchStickers",{stickerSetInfo:n})}catch(s){if("STICKERSET_INVALID"===s.message)return t.showNotification({message:(0,y.Iu)("StickerPack.ErrorNotFound"),tabId:c}),void("shortName"in n&&(0,m.jU)(e,c).openedStickerSetShortName===n.shortName&&(e=(0,I.i)(e,{openedStickerSetShortName:void 0},c),(0,a.R3)(e)))}if(e=(0,a.Rd)(),!r)return;const{set:d,stickers:l,packs:h}=r,g=(e=(0,u.Rg)(e,d.id,{...d,stickers:l,packs:h})).stickers.forEmoji.emoji;g&&h[g]&&(e=(0,u.vy)(e)),(0,a.R3)(e)}async function me(e,t,n,s){for(var i=arguments.length,o=new Array(i>4?i-4:0),r=4;r<i;r++)o[r-4]=arguments[r];let[c=(0,p._w)()]=o;const d=await(0,Y.t9)("searchGifs",{query:t,offset:s,username:n});d&&(e=(0,a.Rd)(),e=(0,u.rq)(e,!s,d.gifs,d.nextOffset,c),(0,a.R3)(e))}(0,a.iw)("loadStickerSets",(async(e,t)=>{const[n,s]=await Promise.all([(0,Y.t9)("fetchStickerSets",{hash:e.stickers.added.hash}),(0,Y.t9)("fetchCustomEmojiSets",{hash:e.customEmojis.added.hash})]);s&&n&&(e=(0,a.Rd)(),e=(0,u.z3)(e,"added",n.hash,n.sets),e=(0,u.cU)(e,s.hash,s.sets),(0,a.R3)(e),t.loadCustomEmojis({ids:e.recentCustomEmojis}))})),(0,a.iw)("loadAddedStickers",(async(e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{},{added:{setIds:s=[]},setsById:i}=e.stickers,{added:{setIds:o=[]}}=e.customEmojis,r=[...s,...o];if(r.length)for(let e=0;e<r.length;e++){const n=r[e];i[n]?.stickers||(t.loadStickers({stickerSetInfo:{id:n,accessHash:i[n].accessHash},tabId:a}),e%10==0&&e>0&&await(0,L.wO)(200))}})),(0,a.iw)("loadRecentStickers",(e=>{const{hash:t}=e.stickers.recent||{};le(e,t)})),(0,a.iw)("loadFavoriteStickers",(async e=>{const{hash:t}=e.stickers.favorite||{},n=await(0,Y.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,Y.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,Y.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,Y.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,Y.t9)("fetchFeaturedStickers",{hash:t});n&&(e=(0,a.Rd)(),e=(0,u.z3)(e,"featured",n.hash,n.sets),(0,a.R3)(e))})),(0,a.iw)("loadPremiumGifts",(async e=>{const t=await(0,Y.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,Y.t9)("fetchDefaultTopicIcons");if(!t)return;e=(0,a.Rd)();const{set:n,stickers:s}=t,i={...n,stickers:s};e=(0,u.Rg)(e,i.id,i),e={...e,defaultTopicIconsId:i.id},(0,a.R3)(e)})),(0,a.iw)("loadDefaultStatusIcons",(async e=>{const t=await(0,Y.t9)("fetchDefaultStatusEmojis");if(!t)return;e=(0,a.Rd)();const{set:n,stickers:s}=t,i={...n,stickers:s};e=(0,u.Rg)(e,i.id,i),e={...e,defaultStatusIconsId:i.id},(0,a.R3)(e)})),(0,a.iw)("loadStickers",((e,t,n)=>{const{stickerSetInfo:a,tabId:s=(0,p._w)()}=n,i=(0,m.Ny)(e,a);i&&i.count===i?.stickers?.length||ue(e,t,a,s)})),(0,a.iw)("loadAnimatedEmojis",(async e=>{const[t,n]=await Promise.all([(0,Y.t9)("fetchAnimatedEmojis"),(0,Y.t9)("fetchAnimatedEmojiEffects")]);t&&n&&(e=(0,a.Rd)(),e=(0,u.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,Y.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,Y.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:i,tabId:o=(0,p._w)()}=n,r=e.gifs.saved.gifs?.length,c=(0,ce.M)(e,"savedGifs"),d=(0,ce.P)(e,"savedGifs"),l=(0,m.wV)(e);if(!i&&r&&r>=c&&t.showNotification({title:y.Iu("LimitReachedFavoriteGifs",c.toString()),message:l?y.Iu("LimitReachedFavoriteGifsSubtitlePremium"):y.Iu("LimitReachedFavoriteGifsSubtitle",d.toString()),...!l&&{action:{action:"openPremiumModal",payload:{tabId:o}}},className:"bold-link",tabId:o}),!await(0,Y.t9)("saveGif",{gif:s,shouldUnsave:i}))return;const u=(e=(0,a.Rd)()).gifs.saved.gifs?.filter((e=>{let{id:t}=e;return t!==s.id}))||[],h=i?u:[s,...u];e={...e,gifs:{...e.gifs,saved:{...e.gifs.saved,gifs:h}}},(0,a.R3)(e)})),(0,a.iw)("faveSticker",((e,t,n)=>{const{sticker:a,tabId:s=(0,p._w)()}=n,i=e.stickers.favorite.stickers.length,o=(0,ce.M)(e,"stickersFaved"),r=(0,ce.P)(e,"stickersFaved"),c=(0,m.wV)(e);i>=o&&t.showNotification({title:y.Iu("LimitReachedFavoriteStickers",o.toString()),message:c?y.Iu("LimitReachedFavoriteStickersSubtitlePremium"):y.Iu("LimitReachedFavoriteStickersSubtitle",r.toString()),...!c&&{action:{action:"openPremiumModal",payload:{tabId:s}}},className:"bold-link",tabId:s}),a&&(0,Y.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,Y.t9)("faveSticker",{sticker:s,unfave:!0}))})),(0,a.iw)("removeRecentSticker",(async(e,t,n)=>{const{sticker:s}=n;await(0,Y.t9)("removeRecentSticker",{sticker:s})&&le((0,a.Rd)())})),(0,a.iw)("clearRecentStickers",(async e=>{await(0,Y.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,m.Ny)(e,a);if(!s)return;const{accessHash:i,installedDate:o,isArchived:r}=s,c=!r&&Boolean(o);(0,Y.t9)(c?"uninstallStickerSet":"installStickerSet",{stickerSetId:a,accessHash:i})})),(0,a.iw)("loadEmojiKeywords",(async(e,t,n)=>{const{language:s}=n;let i=e.emojiKeywords[s];if(i?.isLoading)return;e={...e,emojiKeywords:{...e.emojiKeywords,[s]:{...i,isLoading:!0}}},(0,a.R3)(e);const o=await(0,Y.t9)("fetchEmojiKeywords",{language:s,fromVersion:i?i.version:0});if(i=(e=(0,a.Rd)()).emojiKeywords[s],!o)return e={...e,emojiKeywords:{...e.emojiKeywords,[s]:{...i,isLoading:!1}}},void(0,a.R3)(e);e={...e,emojiKeywords:{...e.emojiKeywords,[s]:{isLoading:!1,version:o.version,keywords:{...i?.keywords,...o.keywords}}}},(0,a.R3)(e)})),(0,a.iw)("setStickerSearchQuery",((e,t,n)=>{const{query:s,tabId:i=(0,p._w)()}=n;s&&de((async()=>{const t=await(0,Y.t9)("searchStickers",{query:s});if(!t)return;e=(0,a.Rd)();const{setsById:n,added:o}=e.stickers,r=t.sets.map((e=>{let{id:t}=e;return t}));o.setIds&&o.setIds.forEach((e=>{if(!r.includes(e)){const{title:t}=n[e]||{};t&&(0,re.Z)(t,s)&&r.unshift(e)}})),e=(0,u.z3)(e,"search",t.hash,t.sets),e=(0,u.fH)(e,t.hash,r,i),(0,a.R3)(e)}))})),(0,a.iw)("setGifSearchQuery",((e,t,n)=>{const{query:a,tabId:s=(0,p._w)()}=n;"string"==typeof a&&de((()=>{me(e,a,e.config?.gifSearchUsername,void 0,s)}))})),(0,a.iw)("searchMoreGifs",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{},{query:s,offset:i}=(0,m.jU)(e,a).gifSearch;"string"==typeof s&&de((()=>{me(e,s,e.config?.gifSearchUsername,i,a)}))})),(0,a.iw)("loadStickersForEmoji",((e,t,n)=>{const{emoji:s}=n,{hash:i}=e.stickers.forEmoji;de((async()=>{e=(0,a.Rd)(),e={...e,stickers:{...e.stickers,forEmoji:{...e.stickers.forEmoji,emoji:s}}},(0,a.R3)(e);const t=await(0,Y.t9)("fetchStickersForEmoji",{emoji:s,hash:i});e=(0,a.Rd)(),t&&e.stickers.forEmoji.emoji===s&&(e=(0,u.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,u.AA)(e,a)})),(0,a.iw)("clearCustomEmojiForEmoji",(e=>({...e,customEmojis:{...e.customEmojis,forEmoji:{}}}))),(0,a.iw)("loadFeaturedEmojiStickers",(async e=>{const t=await(0,Y.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,b.ee)(t.sets.flatMap((e=>e.stickers||[])),"id")}},stickers:{...e.stickers,setsById:{...e.stickers.setsById,...(0,b.ee)(t.sets,"id")}}},(0,a.R3)(e))})),(0,a.iw)("openStickerSet",(async(e,t,n)=>{const{stickerSetInfo:s,tabId:i=(0,p._w)()}=n;(0,m.Ny)(e,s)||await ue(e,t,s,i),e=(0,a.Rd)();const o=(0,m.Ny)(e,s);o?.shortName&&(e=(0,I.i)(e,{openedStickerSetShortName:o.shortName},i),(0,a.R3)(e))})),(0,a.iw)("loadRecentEmojiStatuses",(async e=>{const t=await(0,Y.t9)("fetchRecentEmojiStatuses");t&&(e=(0,a.Rd)(),e=(0,u.et)(e,t.hash,t.emojiStatuses),(0,a.R3)(e))}));var he=n(790);const ge=(0,L.P2)((e=>e()),500,!1);async function pe(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,o=arguments.length>4?arguments[4]:void 0,r=arguments.length>5?arguments[5]:void 0,c=arguments.length>6?arguments[6]:void 0;for(var d=arguments.length,l=new Array(d>7?d-7:0),h=7;h<d;h++)l[h-7]=arguments[h];let g,[f=(0,p._w)()]=l;if(o){const e=(0,Y.t9)("searchMessagesLocal",{chat:o,query:t,type:n,limit:i.Hkl,offsetId:s,minDate:c,maxDate:r}),a=o.isForum?(0,Y.t9)("fetchTopics",{chat:o,query:t,limit:i.XM3}):void 0,[d,l]=await Promise.all([e,a]);if(d){const{messages:e,users:t,totalCount:n,nextOffsetId:a}=d,{topics:s,count:i}=l||{};g={topics:s,totalTopicsCount:i,messages:e,users:t,chats:[],totalCount:n,nextRate:a}}}else g=await(0,Y.t9)("searchMessagesGlobal",{query:t,offsetRate:s,limit:i.Hkl,type:n,maxDate:r,minDate:c});e=(0,a.Rd)();const I=(0,m.JX)(e,f);if(!g||""!==t&&t!==I)return e=(0,u.xv)(e,{messages:!1},f),void(0,a.R3)(e);const{messages:v,users:w,chats:Z,totalCount:P,nextRate:y}=g;Z.length&&(e=(0,u.fZ)(e,(0,b.ee)(Z,"id"))),w.length&&(e=(0,u.Sh)(e,(0,b.ee)(w,"id"))),v.length&&(e=(0,u.m6)(e,v)),e=(0,u.px)(e,v,P,n,y,f),g.topics&&(e=(0,u.XG)(e,o.id,g.totalTopicsCount,g.topics));const C=g.topics?.map((e=>{let{id:t}=e;return t})).sort(((e,t)=>t-e));e=(0,u.No)(e,{foundTopicIds:C},f),(0,a.R3)(e)}async function fe(e,t,n,s,o){let r=arguments.length>5&&void 0!==arguments[5]&&arguments[5];for(var c=arguments.length,d=new Array(c>6?c-6:0),h=6;h<c;h++)d[h-6]=arguments[h];let[g=(0,p._w)()]=d;const f=await(0,Y.t9)("searchMessagesLocal",{chat:t,type:s,limit:2*i.ENB,topMessageId:n===l._f?void 0:n,offsetId:o});if(!f)return;const{chats:I,users:v,messages:w,totalCount:Z,nextOffsetId:P}=f,y=(0,b.ee)(w,"id"),C=Object.keys(y).map(Number);e=(0,a.Rd)();const S=(0,m.we)(e,g);S&&(e=(0,u.fZ)(e,(0,b.ee)(I,"id")),e=(0,u.Sh)(e,(0,b.ee)(v,"id")),e=(0,u.c_)(e,t.id,y),e=(0,u.c1)(e,t.id,n,s,C,Z,P,g),(0,a.R3)(e),r||fe(e,t,n,s,P,!0,g))}let Ie,ve;(0,a.iw)("setGlobalSearchQuery",((e,t,n)=>{const{query:s,tabId:i=(0,p._w)()}=n,{chatId:o}=(0,m.jU)(e,i).globalSearch;s&&!o&&ge((async()=>{const t=await(0,Y.t9)("searchChats",{query:s});e=(0,a.Rd)();const n=(0,m.JX)(e,i);if(!t||!n||s!==n)return e=(0,u.xv)(e,{chats:!1},i),void(0,a.R3)(e);const{localChats:o,localUsers:r,globalChats:c,globalUsers:d}=t;(o.length||c.length)&&(e=(0,u.fZ)(e,(0,b.ee)([...o,...c],"id"))),(r.length||d.length)&&(e=(0,u.Sh)(e,(0,b.ee)([...r,...d],"id"))),e=(0,u.xv)(e,{chats:!1},i),e=(0,u.No)(e,{localResults:{chatIds:o.map((e=>{let{id:t}=e;return t})),userIds:r.map((e=>{let{id:t}=e;return t}))},globalResults:{...(0,m.jU)(e,i).globalSearch.globalResults,chatIds:c.map((e=>{let{id:t}=e;return t})),userIds:d.map((e=>{let{id:t}=e;return t}))}},i),(0,a.R3)(e)}))})),(0,a.iw)("setGlobalSearchDate",((e,t,n)=>{const{date:s,tabId:i=(0,p._w)()}=n,o=s?(0,he.IS)(s):s;e=(0,u.No)(e,{date:s,query:"",resultsByType:{...(0,m.jU)(e,i).globalSearch.resultsByType,text:{totalCount:void 0,foundIds:[],nextOffsetId:0}}},i),(0,a.R3)(e);const{chatId:r}=(0,m.jU)(e,i).globalSearch;pe(e,"","text",void 0,r?(0,m.Z1)(e,r):void 0,o,s,i)})),(0,a.iw)("searchMessagesGlobal",((e,t,n)=>{const{type:a,tabId:s=(0,p._w)()}=n,{query:i,resultsByType:o,chatId:r,date:c}=(0,m.jU)(e,s).globalSearch,d=c?(0,he.IS)(c):c,l=o?.[a]?.nextOffsetId;pe(e,i,a,l,r?(0,m.Z1)(e,r):void 0,d,c,s)})),(0,a.iw)("searchTextMessagesLocal",(async(e,t,n)=>{const{tabId:s=(0,p._w)()}=n||{},{chatId:o,threadId:r}=(0,m.Bt)(e,s)||{},c=o?(0,m.Z1)(e,o):void 0;let d=(0,m.n5)(e,s);if(!c||!d||!r)return;const{query:h,results:g}=d,f=g?.nextOffsetId;let I;if(r!==l._f&&(I=(0,m.tZ)(e,o,r)?.topMessageId),!h)return;const v=await(0,Y.t9)("searchMessagesLocal",{chat:c,type:"text",query:h,topMessageId:I,limit:i.pnA,offsetId:f});if(!v)return;const{chats:w,users:Z,messages:P,totalCount:y,nextOffsetId:C}=v,S=(0,b.ee)(P,"id"),E=Object.keys(S).map(Number);e=(0,a.Rd)(),d=(0,m.n5)(e,s),d&&h===d.query&&(e=(0,u.fZ)(e,(0,b.ee)(w,"id")),e=(0,u.Sh)(e,(0,b.ee)(Z,"id")),e=(0,u.c_)(e,c.id,S),e=(0,u.dx)(e,c.id,r,E,y,C,s),(0,a.R3)(e))})),(0,a.iw)("searchMediaMessagesLocal",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{},{chatId:s,threadId:i}=(0,m.Bt)(e,a)||{};if(!s||!i)return;const o=(0,m.Z1)(e,s),r=(0,m.we)(e,a);if(!o||!r)return;const{currentType:c,resultsByType:d}=r,l=(c&&d&&d[c])?.nextOffsetId;c&&fe(e,o,i,c,l,void 0,a)})),(0,a.iw)("searchMessagesByDate",(async(e,t,n)=>{const{timestamp:a,tabId:s=(0,p._w)()}=n,{chatId:i}=(0,m.Bt)(e,s)||{};if(!i)return;const o=(0,m.Z1)(e,i);if(!o)return;const r=await(0,Y.t9)("findFirstMessageIdAfterDate",{chat:o,timestamp:a});r&&t.focusMessage({chatId:o.id,messageId:r,tabId:s})})),(0,a.iw)("checkPublicLink",(async(e,t,n)=>{const{username:s,tabId:i=(0,p._w)()}=n,{chatId:o}=(0,m.Bt)(e,i)||{};if(!o)return;if((0,m.jU)(e,i).management.progress===w.wv.InProgress)return;e=(0,u.fw)(e,o,{isUsernameAvailable:void 0,checkedUsername:void 0},i),(0,a.R3)(e);const{result:r,error:c}=await(0,Y.t9)("checkChatUsername",{username:s});e=(0,a.Rd)(),e=(0,u.H9)(e,!0===r?w.wv.Complete:w.wv.Error,i),e=(0,u.fw)(e,o,{isUsernameAvailable:!0===r,checkedUsername:s,error:c},i),(0,a.R3)(e),void 0===r&&t.openLimitReachedModal({limit:"channelsPublic",tabId:i})})),(0,a.iw)("updatePublicLink",(async(e,t,n)=>{const{username:s,tabId:i=(0,p._w)()}=n,{chatId:o}=(0,m.Bt)(e,i)||{};if(!o)return;const r=await(0,X.X9)(e,t,o,i);if(!r)return;e=(0,a.Rd)(),e=(0,u.H9)(e,w.wv.InProgress,i),(0,a.R3)(e);const c=await(0,Y.t9)("setChatUsername",{chat:r,username:s});e=(0,a.Rd)(),e=(0,u.H9)(e,c?w.wv.Complete:w.wv.Error,i),e=(0,u.fw)(e,o,{isUsernameAvailable:void 0,checkedUsername:void 0,error:void 0},i),(0,a.R3)(e)})),(0,a.iw)("updatePrivateLink",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{},{chatId:s}=(0,m.Bt)(e,a)||{},i=s&&(0,m.Z1)(e,s);s&&i&&(0,Y.t9)("updatePrivateLink",{chat:i})})),(0,a.iw)("setEditingExportedInvite",((e,t,n)=>{const{chatId:s,invite:i,tabId:o=(0,p._w)()}=n;e=(0,u.fw)(e,s,{editingInvite:i},o),(0,a.R3)(e)})),(0,a.iw)("setOpenedInviteInfo",((e,t,n)=>{const{chatId:s,invite:i,tabId:o=(0,p._w)()}=n,r=i?{inviteInfo:{invite:i}}:{inviteInfo:void 0};e=(0,u.fw)(e,s,r,o),(0,a.R3)(e)})),(0,a.iw)("loadExportedChatInvites",(async(e,t,n)=>{const{chatId:s,adminId:i,isRevoked:o,limit:r,tabId:c=(0,p._w)()}=n,d=(0,m.Z1)(e,s),l=(0,m.dy)(e,i||e.currentUserId);if(!d||!l)return;const h=await(0,Y.t9)("fetchExportedChatInvites",{peer:d,admin:l,isRevoked:o,limit:r});if(!h)return;e=(0,a.Rd)();const{invites:g,users:f}=h;e=(0,u.Sh)(e,(0,b.ee)(f,"id"));const I=o?{revokedInvites:g}:{invites:g};e=(0,u.fw)(e,s,I,c),(0,a.R3)(e)})),(0,a.iw)("editExportedChatInvite",(async(e,t,n)=>{const{chatId:s,link:i,isRevoked:o,expireDate:r,usageLimit:c,isRequestNeeded:d,title:l,tabId:h=(0,p._w)()}=n,g=(0,m.Z1)(e,s);if(!g)return;const f=await(0,Y.t9)("editExportedChatInvite",{peer:g,link:i,isRevoked:o,expireDate:r,usageLimit:c,isRequestNeeded:d,title:l});if(!f)return;const{oldInvite:I,newInvite:v,users:w}=f;e=(0,a.Rd)();const{management:Z}=(0,m.jU)(e,h),P=(Z.byChatId[s].invites||[]).filter((e=>e.link!==I.link)),y=[...Z.byChatId[s].revokedInvites||[]];v.isRevoked?y.unshift(v):P.push(v),e=(0,u.Sh)(e,(0,b.ee)(w,"id")),e=(0,u.fw)(e,s,{invites:P,revokedInvites:y},h),(0,a.R3)(e)})),(0,a.iw)("exportChatInvite",(async(e,t,n)=>{const{chatId:s,expireDate:i,usageLimit:o,isRequestNeeded:r,title:c,tabId:d=(0,p._w)()}=n,l=(0,m.Z1)(e,s);if(!l)return;const h=await(0,Y.t9)("exportChatInvite",{peer:l,expireDate:i,usageLimit:o,isRequestNeeded:r,title:c});if(!h)return;e=(0,a.Rd)();const g=(0,m.jU)(e,d).management.byChatId[s].invites||[];e=(0,u.fw)(e,s,{invites:[...g,h]},d),(0,a.R3)(e)})),(0,a.iw)("deleteExportedChatInvite",(async(e,t,n)=>{const{chatId:s,link:i,tabId:o=(0,p._w)()}=n,r=(0,m.Z1)(e,s);if(!r)return;if(!await(0,Y.t9)("deleteExportedChatInvite",{peer:r,link:i}))return;e=(0,a.Rd)();const c=(0,m.jU)(e,o).management.byChatId[s];e=(0,u.fw)(e,s,{invites:c?.invites?.filter((e=>e.link!==i)),revokedInvites:c?.revokedInvites?.filter((e=>e.link!==i))},o),(0,a.R3)(e)})),(0,a.iw)("deleteRevokedExportedChatInvites",(async(e,t,n)=>{const{chatId:s,adminId:i,tabId:o=(0,p._w)()}=n,r=(0,m.Z1)(e,s),c=(0,m.dy)(e,i||e.currentUserId);r&&c&&await(0,Y.t9)("deleteRevokedExportedChatInvites",{peer:r,admin:c})&&(e=(0,a.Rd)(),e=(0,u.fw)(e,s,{revokedInvites:[]},o),(0,a.R3)(e))})),(0,a.iw)("loadChatInviteImporters",(async(e,t,n)=>{const{chatId:s,link:i,offsetDate:o,offsetUserId:r,limit:c,tabId:d=(0,p._w)()}=n,l=(0,m.Z1)(e,s),h=r?(0,m.dy)(e,r):void 0;if(!l||r&&!h)return;const g=await(0,Y.t9)("fetchChatInviteImporters",{peer:l,link:i,offsetDate:o,offsetUser:h,limit:c});if(!g)return;const{importers:f,users:I}=g;e=(0,a.Rd)();const v=(0,m.jU)(e,d).management.byChatId[s]?.inviteInfo;v?.invite&&v.invite.link===i&&(e=(0,u.fw)(e,s,{inviteInfo:{...v,importers:f}},d),e=(0,u.Sh)(e,I),(0,a.R3)(e))})),(0,a.iw)("loadChatInviteRequesters",(async(e,t,n)=>{const{chatId:s,link:i,offsetDate:o,offsetUserId:r,limit:c,tabId:d=(0,p._w)()}=n,l=(0,m.Z1)(e,s),h=r?(0,m.dy)(e,r):void 0;if(!l||r&&!h)return;const g=await(0,Y.t9)("fetchChatInviteImporters",{peer:l,link:i,offsetDate:o,offsetUser:h,limit:c,isRequested:!0});if(!g)return;const{importers:f,users:I}=g;e=(0,a.Rd)();const v=(0,m.jU)(e,d).management.byChatId[s]?.inviteInfo;v?.invite&&v.invite.link===i&&(e=(0,u.fw)(e,s,{inviteInfo:{...v,requesters:f}},d),e=(0,u.Sh)(e,I),(0,a.R3)(e))})),(0,a.iw)("loadChatJoinRequests",(async(e,t,n)=>{const{chatId:s,offsetDate:i=0,offsetUserId:o,limit:r=0}=n,c=(0,m.Z1)(e,s),d=o?(0,m.dy)(e,o):void 0;if(!c||o&&!d)return;const l=await(0,Y.t9)("fetchChatInviteImporters",{peer:c,offsetDate:i,offsetUser:d,limit:r,isRequested:!0});if(!l)return;const{importers:h,users:g}=l;e=(0,a.Rd)(),e=(0,u.a4)(e,s,{joinRequests:h}),e=(0,u.Sh)(e,g),(0,a.R3)(e)})),(0,a.iw)("hideChatJoinRequest",(async(e,t,n)=>{const{chatId:s,userId:i,isApproved:o}=n,r=(0,m.Z1)(e,s),c=(0,m.dy)(e,i);if(!r||!c)return;if(!await(0,Y.t9)("hideChatJoinRequest",{peer:r,user:c,isApproved:o}))return;e=(0,a.Rd)();const d=(0,m.Z1)(e,s);d&&(e=(0,u.a4)(e,s,{joinRequests:d.joinRequests?.filter((e=>e.userId!==i))}),(0,a.R3)(e))})),(0,a.iw)("hideAllChatJoinRequests",(async(e,t,n)=>{const{chatId:s,isApproved:i,link:o}=n,r=(0,m.Z1)(e,s);r&&await(0,Y.t9)("hideAllChatJoinRequests",{peer:r,isApproved:i,link:o})&&(e=(0,a.Rd)(),(0,m.Z1)(e,s)&&(e=(0,u.a4)(e,s,{joinRequests:[]}),e=(0,u.US)(e,s,{recentRequesterIds:[],requestsPending:0}),(0,a.R3)(e)))})),(0,a.iw)("hideChatReportPanel",(async(e,t,n)=>{const{chatId:s}=n,i=(0,m.Z1)(e,s);i&&await(0,Y.t9)("hideChatReportPanel",i)&&(e=(0,a.Rd)(),e=(0,u.a4)(e,s,{settings:void 0}),(0,a.R3)(e))})),(0,a.iw)("uploadContactProfilePhoto",(async(e,t,n)=>{const{userId:s,file:i,isSuggest:o,tabId:r=(0,p._w)()}=n,c=(0,m.dy)(e,s);if(!c)return;e=(0,u.H9)(e,w.wv.InProgress,r),(0,a.R3)(e);const d=await(0,Y.t9)("uploadContactProfilePhoto",{user:c,file:i,isSuggest:o});if(!d)return e=(0,a.Rd)(),e=(0,u.H9)(e,w.wv.Error,r),void(0,a.R3)(e);e=(0,a.Rd)(),e=(0,u.Sh)(e,(0,b.ee)(d.users,"id")),(0,a.R3)(e);const{id:l,accessHash:h}=c;if(!await(0,Y.t9)("fetchFullUser",{id:l,accessHash:h}))return e=(0,a.Rd)(),e=(0,u.H9)(e,w.wv.Error,r),void(0,a.R3)(e);t.loadProfilePhotos({profileId:s}),e=(0,a.Rd)(),e=(0,u.H9)(e,w.wv.Complete,r),(0,a.R3)(e),i&&!o&&t.showNotification({message:y.Iu("UserInfo.SetCustomPhoto.SuccessPhotoText",(0,g.Vl)(c)),tabId:r})})),(0,a.iw)("resetManagementError",((e,t,n)=>{const{chatId:a,tabId:s=(0,p._w)()}=n||{};return(0,u.fw)(e,a,{error:void 0},s)})),(0,a.iw)("sync",((e,t)=>{i.eMD&&console.log(">>> START SYNC"),Ie&&clearTimeout(Ie),e=(0,a.Rd)(),e={...e,isSyncing:!0},(0,a.R3)(e),Ie=window.setTimeout((()=>{e=(0,a.Rd)(),e={...e,isSyncing:!1},(0,a.R3)(e),Ie=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 o=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,m.Ms)(e,n,Number(a)),editingId:(0,m._$)(e,n,Number(a)),editingDraft:(0,m.s)(e,n,Number(a)),replyingToId:(0,m.Yy)(e,n,Number(a))},t)),{}),t)),{});for(const{id:o}of Object.values(e.byTabId)){e=(0,a.Rd)();const{chatId:h,threadId:g}=(0,m.Bt)(e,o)||{},p=g||l._f,f=g&&h?(0,m.tZ)(e,h,g):void 0,v=h?e.chats.byId[h]:void 0;if(h&&v){const t=await(r=v,c=p,d=f?.lastReadInboxMessageId,(0,Y.t9)("fetchMessages",{chat:r,threadId:c,offsetId:d||r.lastReadInboxMessageId,addOffset:-(Math.round(i.hT6/2)+1),limit:i.hT6}));e=(0,a.Rd)();const{chatId:l}=(0,m.Bt)(e,o)||{};if(t&&l===h){const a=(0,m.Zw)(e,h),o=h===i.awM?e.serviceNotifications.filter((e=>{let{isDeleted:t}=e;return!t})).map((e=>{let{message:t}=e;return t})):[],r=v.isForum&&v.topics?Object.values(v.topics).map((e=>{let{lastMessageId:t}=e;return a[t]})).filter(Boolean):[],c=[].concat(t.messages,o),d=c.concat(r),l=(0,b.ee)(d,"id"),g=c.map((e=>{let{id:t}=e;return t}));s||(e={...e,messages:{...e.messages,byChatId:{}}},Object.values(e.byTabId).forEach((t=>{let{id:n}=t;e=(0,I.i)(e,{tabThreads:{}},n)})),s=!0),e=(0,u.c_)(e,h,l),e=(0,u.xj)(e,h,p,g),f?.originChannelId&&(e=(0,u.Xg)(e,h,p,f)),Object.values(e.byTabId).forEach((t=>{let{id:n}=t;const{chatId:a,threadId:s}=(0,m.Bt)(e,n)||{};a===h&&s===p&&(e=(0,u.y9)(e,h,p,g,n))})),e=(0,u.GL)(e,(0,b.ee)(t.chats,"id")),e=(0,u.eD)(e,(0,b.ee)(t.users,"id")),t.repliesThreadInfos.length&&(e=(0,u.j6)(e,h,t.repliesThreadInfos)),n=!0}}(0,a.R3)(e),v?.isForum&&(t.loadTopics({chatId:h,force:!0}),g&&g!==l._f&&t.loadTopicById({chatId:h,topicId:g,shouldCloseChatOnError:!0}))}var r,c,d;e=(0,a.Rd)(),n||(e={...e,messages:{...e.messages,byChatId:{}}},Object.values(e.byTabId).forEach((t=>{let{id:n}=t;e=(0,I.i)(e,{tabThreads:{}},n)}))),Object.keys(o).forEach((t=>{const n=o[t];Object.keys(n).forEach((n=>{e=(0,u.sN)(e,t,Number(n),o[t][Number(n)])}))})),(0,a.R3)(e),Object.values(e.byTabId).forEach((n=>{let{id:a}=n;const{chatId:s,messageId:i}=(0,m.jU)(e,a).audioPlayer;s&&i&&!(0,m.hj)(e,s,i)&&t.closeAudioPlayer({tabId:a})}))}(e,t),e=(0,a.Rd)(),e={...e,lastSyncTime:Date.now(),isSyncing:!1},(0,a.R3)(e),i.eMD&&console.log(">>> FINISH SYNC"),(0,x.S1)(),n({listType:"archived",shouldReplace:!0}),(0,Y.t9)("fetchCurrentUser"),s()}})})),(0,O.ll)((e=>{const{connectionState:t,authState:n}=e,{isMasterTab:s}=(0,m.jU)(e);!s||ve?.connectionState===t&&ve?.authState===n||"connectionStateReady"===t&&"authorizationStateReady"===n&&(0,a.Sv)().sync(),ve=e})),(0,a.iw)("reportPeer",(async(e,t,n)=>{const{chatId:a,reason:s,description:i,tabId:o=(0,p._w)()}=n;if(!a)return;const r=(0,m.Z1)(e,a);if(!r)return;const c=await(0,Y.t9)("reportPeer",{peer:r,reason:s,description:i});t.showNotification({message:c?(0,y.Iu)("ReportPeer.AlertSuccess"):"An error occurred while submitting your report. Please, try again later.",tabId:o})})),(0,a.iw)("reportProfilePhoto",(async(e,t,n)=>{const{chatId:a,reason:s,description:i,photo:o,tabId:r=(0,p._w)()}=n;if(!a)return;const c=(0,m.Z1)(e,a);if(!c||!o)return;const d=await(0,Y.t9)("reportProfilePhoto",{peer:c,photo:o,reason:s,description:i});t.showNotification({message:d?(0,y.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,Y.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,Y.t9)("terminateAuthorization",s))return;e=(0,a.Rd)();const{[s]:i,...o}=e.activeSessions.byHash;e={...e,activeSessions:{byHash:o,orderedHashes:e.activeSessions.orderedHashes.filter((e=>e!==s))}},(0,a.R3)(e)})),(0,a.iw)("terminateAllAuthorizations",(async e=>{if(!await(0,Y.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:i,areSecretChatsEnabled:o}=n;await(0,Y.t9)("changeSessionSettings",{hash:s,areCallsEnabled:i,areSecretChatsEnabled:o})&&(e=(0,a.Rd)(),e={...e,activeSessions:{...e.activeSessions,byHash:{...e.activeSessions.byHash,[s]:{...e.activeSessions.byHash[s],...void 0!==i?{areCallsEnabled:i}:void 0,...void 0!==o?{areSecretChatsEnabled:o}:void 0}}}},(0,a.R3)(e))})),(0,a.iw)("changeSessionTtl",(async(e,t,n)=>{const{days:s}=n;await(0,Y.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,Y.t9)("fetchWebAuthorizations");if(!t)return;const{users:n,webAuthorizations:s}=t;e=(0,a.Rd)(),e=(0,u.Sh)(e,(0,b.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,Y.t9)("terminateWebAuthorization",s))return;e=(0,a.Rd)();const{[s]:i,...o}=e.activeWebSessions.byHash;e={...e,activeWebSessions:{byHash:o,orderedHashes:e.activeWebSessions.orderedHashes.filter((e=>e!==s))}},(0,a.R3)(e)})),(0,a.iw)("terminateAllWebAuthorizations",(async e=>{await(0,Y.t9)("terminateAllWebAuthorizations")&&(e=(0,a.Rd)(),e={...e,activeWebSessions:{byHash:{},orderedHashes:[]}},(0,a.R3)(e))}));const we=(0,L.P2)((e=>e()),500,!1);function be(e,t,n){for(var a=arguments.length,s=new Array(a>3?a-3:0),i=3;i<a;i++)s[i-3]=arguments[i];let[o=(0,p._w)()]=s;const r=(0,m.jU)(e,o);return(0,I.i)(e,{inlineBots:{...r.inlineBots,byUsername:{...r.inlineBots.byUsername,[t]:n}}},o)}function Ze(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[i=(0,p._w)()]=a;return(0,I.i)(e,{inlineBots:{...(0,m.jU)(e,i).inlineBots,isLoading:t}},i)}(0,a.iw)("loadFullUser",(async(e,t,n)=>{const{userId:s}=n,i=(0,m.dy)(e,s);if(!i)return;const{id:o,accessHash:r}=i,c=await(0,Y.t9)("fetchFullUser",{id:o,accessHash:r});if(!c?.user)return;e=(0,a.Rd)();const d=(0,m.iF)(e,s),{user:l,fullInfo:u}=c;(i.avatarHash!==l.avatarHash||d?.profilePhoto?.id!==u?.profilePhoto?.id||d?.fallbackPhoto?.id!==u?.fallbackPhoto?.id||d?.personalPhoto?.id!==u?.personalPhoto?.id)&&i.photos?.length&&t.loadProfilePhotos({profileId:s})})),(0,a.iw)("loadUser",(async(e,t,n)=>{const{userId:s}=n,i=(0,m.dy)(e,s);if(!i)return;const o=await(0,Y.t9)("fetchUsers",{users:[i]});if(!o)return;const{users:r,userStatusesById:c}=o;e=(0,a.Rd)(),e=(0,u.eD)(e,(0,b.ee)(r,"id")),e=(0,u.ps)(e,{...e.users.statusesById,...c}),(0,a.R3)(e)})),(0,a.iw)("loadTopUsers",(async e=>{const{topPeers:{lastRequestedAt:t}}=e;if(t&&!((0,Z.bp)()-t>60))return;const n=await(0,Y.t9)("fetchTopUsers");if(!n)return;const{ids:s,users:i}=n;e=(0,a.Rd)(),e=(0,u.Sh)(e,(0,b.ee)(i,"id")),e={...e,topPeers:{...e.topPeers,userIds:s,lastRequestedAt:(0,Z.bp)()}},(0,a.R3)(e)})),(0,a.iw)("loadContactList",(async e=>{const t=await(0,Y.t9)("fetchContactList");if(!t)return;e=(0,a.Rd)(),e=(0,u.Sh)(e,(0,b.ee)(t.users,"id")),e=(0,u.fZ)(e,(0,b.ee)(t.chats,"id")),e=(0,u.zn)(e,t.userStatusesById);const n=e=>e.lastName||e.firstName||"",s=new Intl.Collator("en-US"),i=t.users.sort(((e,t)=>s.compare(n(e),n(t)))).filter((e=>!e.isSelf));e={...e,contactList:{userIds:i.map((e=>e.id))}},(0,a.R3)(e)})),(0,a.iw)("loadCurrentUser",(()=>{(0,Y.t9)("fetchCurrentUser")})),(0,a.iw)("loadCommonChats",(async(e,t,n)=>{const{tabId:s=(0,p._w)()}=n||{},{chatId:i}=(0,m.Bt)(e,s)||{},o=i?(0,m.dy)(e,i):void 0;if(!o||(0,g.cS)(o)||o.commonChats?.isFullyLoaded)return;const r=o.commonChats?.maxId,c=await(0,Y.t9)("fetchCommonChats",o.id,o.accessHash,r);if(!c)return;const{chats:d,chatIds:l,isFullyLoaded:h}=c;e=(0,a.Rd)(),d.length&&(e=(0,u.fZ)(e,(0,b.ee)(d,"id"))),e=(0,u.Nq)(e,o.id,{commonChats:{maxId:l.length?l[l.length-1]:"0",ids:(0,b.Tw)((o.commonChats?.ids||[]).concat(l)),isFullyLoaded:h}}),(0,a.R3)(e)})),(0,a.iw)("updateContact",(async(e,t,n)=>{const{userId:s,isMuted:i=!1,firstName:o,lastName:r,shouldSharePhoneNumber:c,tabId:d=(0,p._w)()}=n,l=(0,m.dy)(e,s);if(!l)return;let h;if(t.updateChatMutedState({chatId:s,isMuted:i}),e=(0,a.Rd)(),e=(0,u.H9)(e,w.wv.InProgress,d),(0,a.R3)(e),!l.isContact&&l.phoneNumber)h=await(0,Y.t9)("importContact",{phone:l.phoneNumber,firstName:o,lastName:r});else{const{id:e,accessHash:t}=l;h=await(0,Y.t9)("updateContact",{id:e,accessHash:t,phoneNumber:"",firstName:o,lastName:r,shouldSharePhoneNumber:c})}h&&(t.loadChatSettings({chatId:s}),e=(0,a.Rd)(),e=(0,u.Nq)(e,l.id,{firstName:o,lastName:r}),(0,a.R3)(e)),e=(0,a.Rd)(),e=(0,u.H9)(e,w.wv.Complete,d),e=(0,u.ft)(e,d),(0,a.R3)(e)})),(0,a.iw)("deleteContact",(async(e,t,n)=>{const{userId:a}=n,s=(0,m.dy)(e,a);if(!s)return;const{id:i,accessHash:o}=s;await(0,Y.t9)("deleteContact",{id:i,accessHash:o})})),(0,a.iw)("loadProfilePhotos",(async(e,t,n)=>{const{profileId:s}=n,i=(0,g.YC)(s);let o=i?(0,m.dy)(e,s):void 0;const r=i?void 0:(0,m.Z1)(e,s);if(!o&&!r)return;let c=(0,m.iF)(e,s);if(o&&!c?.profilePhoto){const{id:e,accessHash:t}=o,n=await(0,Y.t9)("fetchFullUser",{id:e,accessHash:t});if(!n?.user)return;o=n.user,c=n.fullInfo}const d=await(0,Y.t9)("fetchProfilePhotos",o,r);if(!d||!d.photos)return;e=(0,a.Rd)();const l=o||r,{photos:h,users:p}=d;h.sort((e=>e.id===l?.avatarHash?-1:1));const f=c?.fallbackPhoto,I=c?.personalPhoto;f&&h.push(f),I&&h.unshift(I),e=(0,u.Sh)(e,(0,b.ee)(p,"id")),e=i?(0,u.Nq)(e,s,{photos:h}):(0,u.a4)(e,s,{photos:h}),(0,a.R3)(e)})),(0,a.iw)("setUserSearchQuery",((e,t,n)=>{const{query:s,tabId:i=(0,p._w)()}=n;s&&we((async()=>{const t=await(0,Y.t9)("searchChats",{query:s});e=(0,a.Rd)();const n=(0,m.jU)(e,i).userSearch.query;if(!t||!n||s!==n)return e=(0,u.Q3)(e,!1,i),void(0,a.R3)(e);const{localUsers:o,globalUsers:r}=t;let c,d;o.length&&(e=(0,u.Sh)(e,(0,b.ee)(o,"id")),c=o.map((e=>{let{id:t}=e;return t}))),r.length&&(e=(0,u.Sh)(e,(0,b.ee)(r,"id")),d=r.map((e=>{let{id:t}=e;return t}))),e=(0,u.Q3)(e,!1,i),e=(0,u.Lm)(e,{localUserIds:c,globalUserIds:d},i),(0,a.R3)(e)}))})),(0,a.iw)("importContact",(async(e,t,n)=>{const{phoneNumber:s,firstName:i,lastName:o,tabId:r=(0,p._w)()}=n,c=await(0,Y.t9)("importContact",{phone:s,firstName:i,lastName:o});c?(t.openChat({id:c,tabId:r}),e=(0,a.Rd)(),e=(0,u.ft)(e,r),(0,a.R3)(e)):t.showNotification({message:y.Iu("Contacts.PhoneNumber.NotRegistred"),tabId:r})})),(0,a.iw)("reportSpam",((e,t,n)=>{const{chatId:a}=n,s=(0,g.YC)(a)?(0,m.dy)(e,a):(0,m.Z1)(e,a);s&&(0,Y.t9)("reportSpam",s)})),(0,a.iw)("setEmojiStatus",((e,t,n)=>{const{emojiStatus:a,expires:s}=n;(0,Y.t9)("updateEmojiStatus",a,s)}));var Pe=n(18629);const ye=s.cj||s.wZ;class Ce{constructor(e,t){var n,a,s;this.features=e,this.onFail=t,n=this,s=void 0,(a=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,t);if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(a="preOpened"))in n?Object.defineProperty(n,a,{value:s,enumerable:!0,configurable:!0,writable:!0}):n[a]=s}preOpenIfNeeded(){ye&&(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(!ye){const t=window.open(e,void 0,this.features);t?t.focus():this.onFail?.()}}cancelPreOpen(){this.preOpened?.close(),this.preOpened=void 0}}const Se="https://prizes.gamee.com/",Ee=(0,L.Ds)((e=>e()),500,!1);async function Me(e,t,n,s){await(0,Y.t9)("toggleAttachBot",{bot:t,isWriteAllowed:s,isEnabled:n}),e=(0,a.Rd)(),await Re(e)}async function Re(e,t){const n=await(0,Y.t9)("loadAttachBots",{hash:t});n&&(e=(0,a.Rd)(),e=(0,u.Sh)(e,(0,b.ee)(n.users,"id")),e={...e,attachMenu:{hash:n.hash,bots:n.bots}},(0,a.R3)(e))}function ke(e,t,n,s){for(var i=arguments.length,o=new Array(i>4?i-4:0),r=4;r<i;r++)o[r-4]=arguments[r];let[c=(0,p._w)()]=o;if("request"===s.type){e=(0,a.Rd)();const t=(0,m.jU)(e,c);if(!t.urlAuth)return;const{domain:n,bot:i,shouldRequestWriteAccess:o}=s;return e=(0,I.i)(e,{urlAuth:{...t.urlAuth,request:{domain:n,botId:i.id,shouldRequestWriteAccess:o}}},c),void(0,a.R3)(e)}const d="accepted"===s.type?s.url:n;window.open(d,"_blank","noopener"),t.closeUrlAuthModal({tabId:c})}async function Te(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l._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,Y.t9)("sendMessage",{chat:e,replyingToTopId:t,text:n,replyingTo:a,sendAs:s})}let Ae;async function Ne(e,t,n,a,s){let i=arguments.length>5&&void 0!==arguments[5]&&arguments[5];for(var o=arguments.length,r=new Array(o>6?o-6:0),c=6;c<o;c++)r[c-6]=arguments[c];let[d=(0,p._w)()]=r;const{showDialog:l,showNotification:u,openUrl:m,openGame:h}=t;i&&(Ae||(Ae=new Ce("popup,width=800,height=600",(()=>{u({message:"Allow browser to open popup window",tabId:d})}))),Ae.preOpenIfNeeded());const g=await(0,Y.t9)("answerCallbackButton",{chatId:n.id,accessHash:n.accessHash,messageId:a,data:s,isGame:i});if(!g)return;const{message:f,alert:I,url:v}=g;I?l({data:{message:f||"Error"},tabId:d}):f?u({message:f,tabId:d}):v&&(i?v.includes(Se)?Ae.open(v):(Ae.cancelPreOpen(),h({url:v,chatId:n.id,messageId:a,tabId:d})):m({url:v,tabId:d}))}function xe(e){const t=Object.keys(e).map((t=>`${t}=${e[t]}`)).join("&");return t.length>0?`?${t}`:""}async function Be(e,t){for(var n=arguments.length,s=new Array(n>2?n-2:0),i=2;i<n;i++)s[i-2]=arguments[i];let[o=(0,p._w)()]=s;const r=await(0,Y.t9)("getPaymentForm",t);if(!r)return;const{form:c,invoice:d,users:l}=r;return e=(0,a.Rd)(),e=(0,u._7)(e,c,o),e=(0,u.Q$)(e,w.KB.Checkout,o),e=(0,u.Sh)(e,(0,b.ee)(l,"id")),(0,a.R3)(e),d}async function Le(e,t,n,s){for(var i=arguments.length,o=new Array(i>4?i-4:0),r=4;r<i;r++)o[r-4]=arguments[r];let[c=(0,p._w)()]=o;const d=await(0,Y.t9)("validateRequestedInfo",{inputInvoice:t,requestInfo:n,shouldSave:s});if(!d)return;const{id:l,shippingOptions:m}=d;e=(0,a.Rd)(),e=(0,u.vT)(e,l,c),m?(e=(0,u.TM)(e,m,c),e=(0,u.Q$)(e,w.KB.Shipping,c)):e=(0,u.Q$)(e,w.KB.Checkout,c),(0,a.R3)(e)}(0,a.iw)("clickBotInlineButton",((e,t,n)=>{const{messageId:a,button:s,tabId:i=(0,p._w)()}=n;switch(s.type){case"command":t.sendBotCommand({command:s.text,tabId:i});break;case"url":{const{url:e}=s;t.openUrl({url:e,tabId:i});break}case"callback":{const n=(0,m.jr)(e,i);if(!n)return;Ne(e,t,n,a,s.data,void 0,i);break}case"requestPoll":t.openPollModal({isQuiz:s.isQuiz,tabId:i});break;case"requestPhone":{const n=e.currentUserId?(0,m.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:i});break}case"receipt":{const n=(0,m.jr)(e,i);if(!n)return;const{receiptMessageId:o}=s;t.getReceipt({receiptMessageId:o,chatId:n.id,messageId:a,tabId:i});break}case"buy":{const n=(0,m.jr)(e,i);if(!n)return;t.openInvoice({chatId:n.id,messageId:a,tabId:i});break}case"game":{const n=(0,m.jr)(e,i);if(!n)return;Ne(e,t,n,a,void 0,!0,i);break}case"switchBotInline":{const{query:e,isSamePeer:n}=s;t.switchBotInline({query:e,isSamePeer:n,messageId:a,tabId:i});break}case"userProfile":{const{userId:e}=s;t.openChatWithInfo({id:e,tabId:i});break}case"simpleWebView":{const{url:n}=s,{chatId:o}=(0,m.Bt)(e,i)||{};if(!o)return;const r=(0,m.hj)(e,o,a);if(!r?.senderId)return;const c=(0,Pe.BS)();t.requestSimpleWebView({url:n,botId:r?.senderId,theme:c,buttonText:s.text,tabId:i});break}case"webView":{const{url:n}=s,o=(0,m.jr)(e,i);if(!o)return;const r=(0,m.hj)(e,o.id,a);if(!r)return;const c=r.viaBotId||r.senderId;if(!c)return;const d=(0,Pe.BS)();t.requestWebView({url:n,botId:c,peerId:o.id,theme:d,buttonText:s.text,tabId:i});break}case"urlAuth":{const{url:n}=s,o=(0,m.jr)(e,i);if(!o)return;t.requestBotUrlAuth({chatId:o.id,messageId:a,buttonId:s.buttonId,url:n,tabId:i});break}}})),(0,a.iw)("sendBotCommand",((e,t,n)=>{const{command:a,chatId:s,tabId:i=(0,p._w)()}=n,o=s?(0,m.Z1)(e,s):(0,m.jr)(e,i),r=(0,m.Bt)(e,i);if(!o||!r)return;const{threadId:c}=r;t.setReplyingToId({messageId:void 0,tabId:i}),t.clearWebPagePreview({tabId:i}),Te(o,c,a,(0,m.Yy)(e,o.id,c),(0,m._5)(e,o.id))})),(0,a.iw)("restartBot",(async(e,t,n)=>{const{chatId:s,tabId:i=(0,p._w)()}=n,{currentUserId:o}=e,r=(0,m.jr)(e,i),c=o&&(0,m.IK)(e,s);o&&r&&c&&await(0,Y.t9)("unblockContact",c.id,c.accessHash)&&(e=(0,a.Rd)(),e=(0,u.rB)(e,c.id),(0,a.R3)(e),Te(r,l._f,"/start",void 0,(0,m._5)(e,s)))})),(0,a.iw)("loadTopInlineBots",(async e=>{const{lastRequestedAt:t}=e.topInlineBots;if(t&&(0,Z.bp)()-t<60)return;const n=await(0,Y.t9)("fetchTopInlineBots");if(!n)return;const{ids:s,users:i}=n;e=(0,a.Rd)(),e=(0,u.Sh)(e,(0,b.ee)(i,"id")),e={...e,topInlineBots:{...e.topInlineBots,userIds:s,lastRequestedAt:(0,Z.bp)()}},(0,a.R3)(e)})),(0,a.iw)("queryInlineBot",(async(e,t,n)=>{const{chatId:s,username:i,query:o,offset:r,tabId:c=(0,p._w)()}=n;let d=(0,m.jU)(e,c).inlineBots.byUsername[i];if(!1!==d){if(void 0===d){const{user:t,chat:n}=await(0,Y.t9)("fetchInlineBot",{username:i})||{};if(e=(0,a.Rd)(),!t||!n)return e=be(e,i,!1,c),void(0,a.R3)(e);e=(0,u.Sh)(e,{[t.id]:t}),e=(0,u.fZ)(e,{[n.id]:n}),d={id:t.id,query:"",offset:"",switchPm:void 0,canLoadMore:!0,results:[],cacheTime:0},e=be(e,i,d,c),(0,a.R3)(e)}(o!==d.query||d.canLoadMore)&&Ee((()=>{!async function(e,t){let{username:n,inlineBotData:s,chatId:i,query:o,offset:r}=t;for(var c=arguments.length,d=new Array(c>2?c-2:0),l=2;l<c;l++)d[l-2]=arguments[l];let[u=(0,p._w)()]=d;e=(0,a.Rd)();const h=(0,m.dy)(e,s.id),g=(0,m.Z1)(e,i);if(!h||!g)return;const f=s.query!==o;e=be(e=Ze(e,!0,u),n,{...s,query:o,...f&&{offset:void 0,results:[]}},u),(0,a.R3)(e);const I=await(0,Y.t9)("fetchInlineBotResults",{bot:h,chat:g,query:o,offset:f?void 0:r});e=(0,a.Rd)();const v=(0,m.jU)(e,u).inlineBots.byUsername[n];if(e=Ze(e,!1,u),!I||!v||o!==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=be(e,n,{...v,help:I.help,cacheTime:Date.now()+1e3*I.cacheTime,...b.length&&{isGallery:I.isGallery},...I.switchPm&&{switchPm:I.switchPm},...I.switchWebview&&{switchWebview:I.switchWebview},canLoadMore:I.results.length>0&&Boolean(I.nextOffset),results:""===v.offset||v.offset===I.nextOffset?I.results:(v.results||[]).concat(b),offset:b.length?I.nextOffset:""},u),(0,a.R3)(e)}(e,{username:i,inlineBotData:d,chatId:s,query:o,offset:r},c)}))}})),(0,a.iw)("switchBotInline",((e,t,n)=>{const{query:a,isSamePeer:s,messageId:i,filter:o,tabId:r=(0,p._w)()}=n;let{botId:c}=n;const d=(0,m.jr)(e,r);if(!d)return;if(!c&&i){const t=(0,m.hj)(e,d.id,i);if(!t)return;c=t.viaBotId||t.senderId}if(!c)return;const l=(0,m.dy)(e,c);l&&t.openChatWithDraft({text:`@${l.usernames[0].username} ${a}`,chatId:s?d.id:void 0,filter:o,tabId:r})})),(0,a.iw)("sendInlineBotResult",((e,t,n)=>{const{id:a,queryId:s,isSilent:i,scheduledAt:o,messageList:r,tabId:c=(0,p._w)()}=n;if(!a)return;const{chatId:d,threadId:u}=r,h=(0,m.Z1)(e,d),g=(0,m.Yy)(e,d,u),f=g?(0,m.hj)(e,d,g):void 0,I=h.isForum||u!==l._f?(0,m.qS)(e,d,u):f?.replyToTopMessageId||f?.replyToMessageId;t.setReplyingToId({messageId:void 0,tabId:c}),t.clearWebPagePreview({tabId:c}),(0,Y.t9)("sendInlineBotResult",{chat:h,resultId:a,queryId:s,replyingTo:g||I,replyingToTopId:I,sendAs:(0,m._5)(e,d),isSilent:i,scheduleDate:o})})),(0,a.iw)("resetInlineBot",((e,t,n)=>{const{username:s,force:i,tabId:o=(0,p._w)()}=n;let r=(0,m.jU)(e,o).inlineBots.byUsername[s];r&&(!i&&Date.now()<r.cacheTime||(r={id:r.id,query:"",offset:"",switchPm:void 0,canLoadMore:!0,results:[],cacheTime:0},e=be(e,s,r,o),(0,a.R3)(e)))})),(0,a.iw)("resetAllInlineBots",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{},s=(0,m.jU)(e,a).inlineBots.byUsername;Object.keys(s).forEach((e=>{t.resetInlineBot({username:e,tabId:a})}))})),(0,a.iw)("startBot",(async(e,t,n)=>{const{botId:a,param:s}=n,i=(0,m.dy)(e,a);if(!i)return;let o=(0,m.iF)(e,a);o||(o=(await(0,Y.t9)("fetchFullUser",{id:i.id,accessHash:i.accessHash}))?.fullInfo),o?.isBlocked&&await(0,Y.t9)("unblockContact",i.id,i.accessHash),await(0,Y.t9)("startBot",{bot:i,startParam:s})})),(0,a.iw)("requestSimpleWebView",(async(e,t,n)=>{const{url:s,botId:i,theme:o,buttonText:r,tabId:c=(0,p._w)()}=n,d=(0,m.dy)(e,i);if(!d)return;if(!(0,m.LM)(e,i))return e=(0,I.i)(e,{botTrustRequest:{botId:i,type:"webApp",onConfirm:{action:"requestSimpleWebView",payload:n}}},c),void(0,a.R3)(e);const l=await(0,Y.t9)("requestSimpleWebView",{url:s,bot:d,theme:o});l&&(e=(0,a.Rd)(),e=(0,I.i)(e,{webApp:{url:l,botId:i,buttonText:r}},c),(0,a.R3)(e))})),(0,a.iw)("requestWebView",(async(e,t,n)=>{const{url:s,botId:i,peerId:o,theme:r,isSilent:c,buttonText:d,isFromBotMenu:l,startParam:u,tabId:h=(0,p._w)()}=n,g=(0,m.dy)(e,i);if(!g)return;const f=(0,m.Z1)(e,o);if(!f)return;if(!(0,m.LM)(e,i))return e=(0,I.i)(e,{botTrustRequest:{botId:i,type:"webApp",onConfirm:{action:"requestWebView",payload:n}}},h),void(0,a.R3)(e);const v=(0,m.Bt)(e,h);if(!v)return;const{chatId:w,threadId:b}=v,Z=w&&(0,m.Yy)(e,w,b),P=(0,m._5)(e,w),y=await(0,Y.t9)("requestWebView",{url:s,bot:g,peer:f,theme:r,isSilent:c,replyToMessageId:Z||void 0,threadId:b,isFromBotMenu:l,startParam:u,sendAs:P});if(!y)return;const{url:C,queryId:S}=y;e=(0,a.Rd)(),e=(0,I.i)(e,{webApp:{url:C,botId:i,queryId:S,replyToMessageId:Z||void 0,threadId:b,buttonText:d}},h),(0,a.R3)(e)})),(0,a.iw)("requestAppWebView",(async(e,t,n)=>{const{botId:s,appName:i,startApp:o,theme:r,isWriteAllowed:c,tabId:d=(0,p._w)()}=n,l=(0,m.dy)(e,s);if(!l)return;const u=await(0,Y.t9)("fetchBotApp",{bot:l,appName:i});if(e=(0,a.Rd)(),!u)return void t.showNotification({message:(0,y.Iu)("lng_username_app_not_found"),tabId:d});if(u.isInactive&&!(0,m.LM)(e,s))return e=(0,I.i)(e,{botTrustRequest:{botId:s,shouldRequestWriteAccess:u.shouldRequestWriteAccess,type:"botApp",onConfirm:{action:"requestAppWebView",payload:n}}},d),void(0,a.R3)(e);const h=(0,m.jr)(e,d),g=await(0,Y.t9)("requestAppWebView",{peer:h||l,app:u,startParam:o,isWriteAllowed:c,theme:r});e=(0,a.Rd)(),g&&(e=(0,I.i)(e,{webApp:{url:g,botId:s,buttonText:""}},d),(0,a.R3)(e))})),(0,a.iw)("prolongWebView",(async(e,t,n)=>{const{botId:a,peerId:s,isSilent:i,replyToMessageId:o,queryId:r,threadId:c,tabId:d=(0,p._w)()}=n,l=(0,m.dy)(e,a);if(!l)return;const u=(0,m.Z1)(e,s);if(!u)return;const h=(0,m._5)(e,s);await(0,Y.t9)("prolongWebView",{bot:l,peer:u,isSilent:i,replyToMessageId:o,threadId:c,queryId:r,sendAs:h})||t.closeWebApp({tabId:d})})),(0,a.iw)("sendWebViewData",((e,t,n)=>{const{bot:a,data:s,buttonText:i}=n;(0,Y.t9)("sendWebViewData",{bot:a,data:s,buttonText:i})})),(0,a.iw)("closeWebApp",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{};return(0,I.i)(e,{webApp:void 0},a)})),(0,a.iw)("setWebAppPaymentSlug",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n,s=(0,m.jU)(e,a);if(s.webApp?.url)return(0,I.i)(e,{webApp:{...s.webApp,slug:n.slug}},a)})),(0,a.iw)("cancelBotTrustRequest",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{};return(0,I.i)(e,{botTrustRequest:void 0},a)})),(0,a.iw)("markBotTrusted",((e,t,n)=>{const{botId:s,isWriteAllowed:i,tabId:o=(0,p._w)()}=n,{trustedBotIds:r}=e,c=new Set(r);c.add(s),e={...e,trustedBotIds:Array.from(c)};const d=(0,m.jU)(e,o);if(d.botTrustRequest?.onConfirm){const{action:e,payload:n}=d.botTrustRequest.onConfirm;t[e]({...n,isWriteAllowed:i})}e=(0,I.i)(e,{botTrustRequest:void 0},o),(0,a.R3)(e)})),(0,a.iw)("loadAttachBots",(async(e,t,n)=>{const{hash:a}=n||{};await Re(e,a)})),(0,a.iw)("toggleAttachBot",(async(e,t,n)=>{const{botId:a,isWriteAllowed:s,isEnabled:i}=n,o=(0,m.dy)(e,a);o&&await Me(e,o,i,s)})),(0,a.iw)("callAttachBot",((e,t,n)=>{const{chatId:a,bot:s,url:i,startParam:o,threadId:r,tabId:c=(0,p._w)()}=n,d=!s;if(!d&&!e.attachMenu.bots[s.id])return(0,I.i)(e,{requestedAttachBotInstall:{bot:s,onConfirm:{action:"callAttachBot",payload:n}}},c);const l=(0,Pe.BS)();t.openChat({id:a,threadId:r,tabId:c}),t.requestWebView({url:i,peerId:a,botId:d?a:s.id,theme:l,buttonText:"",isFromBotMenu:d,startParam:o,tabId:c})})),(0,a.iw)("confirmAttachBotInstall",(async(e,t,n)=>{const{isWriteAllowed:s,tabId:i=(0,p._w)()}=n,{requestedAttachBotInstall:o}=(0,m.jU)(e,i),{bot:r,onConfirm:c}=o;e=(0,I.i)(e,{requestedAttachBotInstall:void 0},i),(0,a.R3)(e);const d=(0,m.dy)(e,r.id);if(d&&(await Me(e,d,!0,s),c)){const{action:e,payload:n}=c;t[e](n)}})),(0,a.iw)("cancelAttachBotInstall",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{};return(0,I.i)(e,{requestedAttachBotInstall:void 0},a)})),(0,a.iw)("requestAttachBotInChat",((e,t,n)=>{const{bot:s,filter:i,startParam:o,tabId:r=(0,p._w)()}=n,c=(0,m.Bt)(e,r)?.chatId,d=s.peerTypes.filter((e=>"self"!==e&&i.includes(e)));d.length?(e=(0,I.i)(e,{requestedAttachBotInChat:{bot:s,filter:d,startParam:o}},r),(0,a.R3)(e)):t.callAttachBot({chatId:c||s.id,bot:s,startParam:o,tabId:r})})),(0,a.iw)("cancelAttachBotInChat",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{};return(0,I.i)(e,{requestedAttachBotInChat:void 0},a)})),(0,a.iw)("requestBotUrlAuth",(async(e,t,n)=>{const{chatId:s,buttonId:i,messageId:o,url:r,tabId:c=(0,p._w)()}=n,d=(0,m.Z1)(e,s);if(!d)return;const l=await(0,Y.t9)("requestBotUrlAuth",{chat:d,buttonId:i,messageId:o});l&&(e=(0,a.Rd)(),e=(0,I.i)(e,{urlAuth:{url:r,button:{buttonId:i,messageId:o,chatId:d.id}}},c),(0,a.R3)(e),ke(e,t,r,l,c))})),(0,a.iw)("acceptBotUrlAuth",(async(e,t,n)=>{const{isWriteAllowed:s,tabId:i=(0,p._w)()}=n,o=(0,m.jU)(e,i);if(!o.urlAuth?.button)return;const{button:r,url:c}=o.urlAuth,{chatId:d,messageId:l,buttonId:u}=r,h=(0,m.Z1)(e,d);if(!h)return;const g=await(0,Y.t9)("acceptBotUrlAuth",{chat:h,messageId:l,buttonId:u,isWriteAllowed:s});g&&ke(e=(0,a.Rd)(),t,c,g,i)})),(0,a.iw)("requestLinkUrlAuth",(async(e,t,n)=>{const{url:s,tabId:i=(0,p._w)()}=n,o=await(0,Y.t9)("requestLinkUrlAuth",{url:s});o&&(e=(0,a.Rd)(),e=(0,I.i)(e,{urlAuth:{url:s}},i),(0,a.R3)(e),ke(e,t,s,o,i))})),(0,a.iw)("acceptLinkUrlAuth",(async(e,t,n)=>{const{isWriteAllowed:s,tabId:i=(0,p._w)()}=n,o=(0,m.jU)(e,i);if(!o.urlAuth?.url)return;const{url:r}=o.urlAuth,c=await(0,Y.t9)("acceptLinkUrlAuth",{url:r,isWriteAllowed:s});c&&ke(e=(0,a.Rd)(),t,r,c,i)})),(0,a.iw)("closeUrlAuthModal",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{};return(0,I.i)(e,{urlAuth:void 0},a)})),n(55282),(0,a.iw)("loadPasswordInfo",(async e=>{const t=await(0,Y.t9)("getPasswordInfo");t&&(e=(0,a.Rd)(),e=(0,u.BI)(e,{hasPassword:t.hasPassword}),e=(0,u.IE)(e,{hint:t.hint}),(0,a.R3)(e))})),(0,a.iw)("checkPassword",(async(e,t,n)=>{const{currentPassword:s,onSuccess:i}=n;e=(0,u.IE)(e,{isLoading:!0,error:void 0}),(0,a.R3)(e);const o=await(0,Y.t9)("checkPassword",s);e=(0,a.Rd)(),e=(0,u.IE)(e,{isLoading:!1}),(0,a.R3)(e),o&&i()})),(0,a.iw)("clearPassword",(async(e,t,n)=>{const{currentPassword:s,onSuccess:i}=n;e=(0,u.IE)(e,{isLoading:!0,error:void 0}),(0,a.R3)(e);const o=await(0,Y.t9)("clearPassword",s);e=(0,a.Rd)(),e=(0,u.IE)(e,{isLoading:!1}),(0,a.R3)(e),o&&i()})),(0,a.iw)("updatePassword",(async(e,t,n)=>{const{currentPassword:s,password:i,hint:o,email:r,onSuccess:c}=n;e=(0,u.IE)(e,{isLoading:!0,error:void 0}),(0,a.R3)(e);const d=await(0,Y.t9)("updatePassword",s,i,o,r);e=(0,a.Rd)(),e=(0,u.IE)(e,{isLoading:!1}),(0,a.R3)(e),d&&c()})),(0,a.iw)("updateRecoveryEmail",(async(e,t,n)=>{const{currentPassword:s,email:i,onSuccess:o}=n;e=(0,u.IE)(e,{isLoading:!0,error:void 0}),(0,a.R3)(e);const r=await(0,Y.t9)("updateRecoveryEmail",s,i);e=(0,a.Rd)(),e=(0,u.IE)(e,{isLoading:!1,waitingEmailCodeLength:void 0}),(0,a.R3)(e),r&&o()})),(0,a.iw)("provideTwoFaEmailCode",((e,t,n)=>{const{code:a}=n;(0,Y.t9)("provideRecoveryEmailCode",a)})),(0,a.iw)("clearTwoFaError",(e=>(0,u.IE)(e,{error:void 0}))),(0,a.iw)("validateRequestedInfo",((e,t,n)=>{const{requestInfo:a,saveInfo:s,tabId:i=(0,p._w)()}=n,o=(0,m.kb)(e,i);if(o)if("slug"in o)Le(e,o,a,s,i);else{const t=(0,m.Z1)(e,o.chatId);if(!t)return;Le(e,{chat:t,messageId:o.messageId},a,s,i)}})),(0,a.iw)("openInvoice",(async(e,t,n)=>{const{tabId:s=(0,p._w)()}=n;let i;if("slug"in n)i=await Be(e,{slug:n.slug},s);else{const t=(0,m.Z1)(e,n.chatId);if(!t)return;i=await Be(e,{chat:t,messageId:n.messageId},s)}i&&(e=(0,a.Rd)(),e=(0,u.bs)(e,i,s),e=(0,I.i)(e,{payment:{...(0,m.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:i,messageId:o,tabId:r=(0,p._w)()}=n,c=i&&(0,m.Z1)(e,i);if(!o||!s||!c)return;const d=await(0,Y.t9)("getReceipt",c,s);if(!d)return;e=(0,a.Rd)();const l=(0,m.hj)(e,c.id,o);e=(0,u.Sh)(e,(0,b.ee)(d.users,"id")),e=(0,u.Dq)(e,d.receipt,l,r),(0,a.R3)(e)})),(0,a.iw)("clearPaymentError",((e,t,n)=>{const{tabId:s=(0,p._w)()}=n||{};e=(0,I.i)(e,{payment:{...(0,m.jU)(e,s).payment,error:void 0}},s),(0,a.R3)(e)})),(0,a.iw)("clearReceipt",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{};return(0,I.i)(e,{payment:{...(0,m.jU)(e,a).payment,receipt:void 0}},a)})),(0,a.iw)("sendCredentialsInfo",((e,t,n)=>{const{credentials:s,tabId:o=(0,p._w)()}=n,{nativeProvider:r}=(0,m.jU)(e,o).payment,{data:c}=s;if("stripe"===r){const t=(0,m.$$)(e,o);if(!t)return;!async function(e,t,n){for(var s=arguments.length,i=new Array(s>3?s-3:0),o=3;o<s;o++)i[o-3]=arguments[o];let[r=(0,p._w)()]=i;const c=xe({"card[number]":t.cardNumber,"card[exp_month]":t.expiryMonth,"card[exp_year]":t.expiryYear,"card[cvc]":t.cvv,"card[address_zip]":t.zip,"card[address_country]":t.country}),d=await fetch(`https://api.stripe.com/v1/tokens${c}`,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/x-www-form-urlencoded",Authorization:`Bearer ${n}`}}),l=await d.json();if(l.error){const t=(0,g.Ow)(l.error);return e=(0,a.Rd)(),e=(0,I.i)(e,{payment:{...(0,m.jU)(e,r).payment,status:"failed",error:{...t}}},r),void(0,a.R3)(e)}e=(0,a.Rd)(),e=(0,u.QH)(e,{type:l.type,id:l.id},r),e=(0,u.Q$)(e,w.KB.Checkout,r),(0,a.R3)(e)}(e,c,t,o)}else if("smartglocal"===r){const t=(0,m.EB)(e,o);if(!t)return;!async function(e,t,n){for(var s=arguments.length,o=new Array(s>3?s-3:0),r=3;r<s;r++)o[r-3]=arguments[r];let[c=(0,p._w)()]=o;const d={card:{number:t.cardNumber.replace(/\D+/g,""),expiration_month:t.expiryMonth,expiration_year:t.expiryYear,security_code:t.cvv.replace(/\D+/g,"")}},l=i.eAU?"https://tgb-playground.smart-glocal.com/cds/v1/tokenize/card":"https://tgb.smart-glocal.com/cds/v1/tokenize/card",h=await fetch(l,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json","X-PUBLIC-TOKEN":n},body:JSON.stringify(d)}),g=await h.json();if("ok"!==g.status){const t={description:"payment error"};return e=(0,a.Rd)(),e=(0,I.i)(e,{payment:{...(0,m.jU)(e,c).payment,status:"failed",error:{...t}}},c),void(0,a.R3)(e)}e=(0,a.Rd)(),e=(0,u.QD)(e,{type:"card",token:g.data.token},c),e=(0,u.Q$)(e,w.KB.Checkout,c),(0,a.R3)(e)}(e,c,t,o)}})),(0,a.iw)("sendPaymentForm",(async(e,t,n)=>{const{shippingOptionId:s,saveCredentials:i,savedCredentialId:o,tipAmount:r,tabId:c=(0,p._w)()}=n,d=(0,m.kb)(e,c),l=(0,m.eh)(e,c),h=(0,m.sp)(e,c),{nativeProvider:g,temporaryPassword:f}=(0,m.jU)(e,c).payment,I="stripe"===g?(0,m.$$)(e,c):(0,m.EB)(e,c);if(!(d&&I&&l&&g))return;let v;if("slug"in d)v={slug:d.slug};else{const t=(0,m.Z1)(e,d.chatId);if(!t)return;v={chat:t,messageId:d.messageId}}e=(0,u.cQ)(e,{status:"pending"},c),(0,a.R3)(e);const w={save:i,data:"stripe"===g?(0,m.i3)(e,c):(0,m.Jg)(e,c)};await(0,Y.t9)("sendPaymentForm",{inputInvoice:v,formId:l,credentials:w,requestedInfoId:h,shippingOptionId:s,savedCredentialId:o,temporaryPassword:f?.value,tipAmount:r})&&(e=(0,a.Rd)(),e=(0,u.cQ)(e,{status:"paid"},c),e=(0,u.WY)(e,c),(0,a.R3)(e))})),(0,a.iw)("setPaymentStep",((e,t,n)=>{const{step:a,tabId:s=(0,p._w)()}=n;return(0,u.Q$)(e,null!=a?a:w.KB.Checkout,s)})),(0,a.iw)("closePremiumModal",((e,t,n)=>{const{isClosed:a,tabId:s=(0,p._w)()}=n||{},i=(0,m.jU)(e,s);if(i.premiumModal)return(0,I.i)(e,{premiumModal:{...i.premiumModal,...a&&{isOpen:!1},isClosing:!a}},s)})),(0,a.iw)("openPremiumModal",(async(e,t,n)=>{const{initialSection:s,fromUserId:i,isSuccess:o,isGift:r,monthsAmount:c,toUserId:d,tabId:l=(0,p._w)()}=n||{};t.loadPremiumStickers();const m=await(0,Y.t9)("fetchPremiumPromo");m&&(e=(0,a.Rd)(),e=(0,u.Sh)(e,(0,b.ee)(m.users,"id")),e=(0,I.i)(e,{premiumModal:{promo:m.promo,initialSection:s,isOpen:!0,fromUserId:i,toUserId:d,isGift:r,monthsAmount:c,isSuccess:o}},l),(0,a.R3)(e))})),(0,a.iw)("openGiftPremiumModal",(async(e,t,n)=>{const{forUserId:s,tabId:i=(0,p._w)()}=n||{},o=await(0,Y.t9)("fetchPremiumPromo");if(!o)return;e=(0,a.Rd)(),e=(0,u.Sh)(e,(0,b.ee)(o.users,"id"));const r=o.promo.options.find((e=>1===e.months));e=(0,I.i)(e,{giftPremiumModal:{isOpen:!0,forUserId:s,monthlyCurrency:r.currency,monthlyAmount:r.amount}},i),(0,a.R3)(e)})),(0,a.iw)("closeGiftPremiumModal",((e,t,n)=>{const{tabId:s=(0,p._w)()}=n||{};e=(0,I.i)(e,{giftPremiumModal:{isOpen:!1}},s),(0,a.R3)(e)})),(0,a.iw)("validatePaymentPassword",(async(e,t,n)=>{const{password:s,tabId:i=(0,p._w)()}=n,o=await(0,Y.t9)("fetchTemporaryPaymentPassword",s);e=(0,a.Rd)(),e=o?"error"in o?(0,u.cQ)(e,{error:{message:o.error,field:"password"}},i):(0,u.cQ)(e,{temporaryPassword:o,step:w.KB.Checkout},i):(0,u.cQ)(e,{error:{message:"Unknown Error",field:"password"}},i),(0,a.R3)(e)}));var Ue=n(74399);const je=32*Ue.Gw,Oe=45.5*Ue.Gw,Fe=26.5*Ue.Gw,_e=16*Ue.Gw,De=16.125*Ue.Gw;var $e=n(43858),qe=n(53475),He=n(4907);function Ge(e,t){return t-((0,m.jU)(e).isLeftColumnShown&&!(0,M.W7)()?e.leftColumnWidth||((n=$e.Z.get().width)>i._mX?Math.min(Math.max(.25*n,_e),.33*n):n>i.ksF?Math.min(Math.max(.33*n,_e),.4*n):Fe):0);var n}function Ve(e,t,n){const a=t.reactions||{results:[]},s=a.results.map((e=>(0,g.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,g.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:i=[]}=a;return i.length&&(i=i.filter((t=>{let{userId:n}=t;return n!==e.currentUserId}))),n.forEach((t=>{const{currentUserId:n}=e;i.unshift({userId:n,reaction:t,addedDate:Math.floor(Date.now()/1e3)})})),(0,He.cY)(e,t.chatId,t.id,{reactions:{...a,results:s,recentReactions:i}})}function We(e,t,n){return(0,qe.a4)(e,t,n,void 0,!0)}var ze=n(40647);let Xe=0;(0,a.iw)("loadAvailableReactions",(async e=>{const t=await(0,Y.t9)("getAvailableReactions");t&&(t.forEach((e=>{e.aroundAnimation&&ze.he(`sticker${e.aroundAnimation.id}`,l.IU.BlobUrl),e.centerIcon&&ze.he(`sticker${e.centerIcon.id}`,l.IU.BlobUrl),e.appearAnimation&&ze.he(`sticker${e.appearAnimation.id}`,l.IU.BlobUrl),e.selectAnimation&&ze.he((0,g.ym)(e.selectAnimation),l.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:i,startSize:o,isReversed:r,tabId:c=(0,p._w)()}=n,d={id:Xe++,animatedEffect:a,x:Ge(e,s)+40*Math.random()-20,y:i+40*Math.random()-20,startSize:o,isReversed:r};return(0,I.i)(e,{activeEmojiInteractions:[...(0,m.jU)(e,c).activeEmojiInteractions||[],d]},c)})),(0,a.iw)("sendEmojiInteraction",((e,t,n)=>{const{messageId:a,chatId:s,emoji:i,interactions:o}=n,r=(0,m.Z1)(e,s);r&&i&&s!==e.currentUserId&&(0,Y.t9)("sendEmojiInteraction",{chat:r,messageId:a,emoticon:i,timestamps:o})})),(0,a.iw)("sendDefaultReaction",((e,t,n)=>{const{chatId:a,messageId:s,tabId:i=(0,p._w)()}=n,o=(0,m.q6)(e,a),r=(0,m.hj)(e,a,s);o&&r&&!(0,g.CI)(r)&&t.toggleReaction({chatId:a,messageId:s,reaction:o,tabId:i})})),(0,a.iw)("toggleReaction",(async(e,t,n)=>{const{chatId:s,reaction:i,shouldAddToRecent:o,tabId:r=(0,p._w)()}=n;let{messageId:c}=n;const d=(0,m.Z1)(e,s);let l=(0,m.hj)(e,s,c);if(!d||!l)return;const u=Boolean(l.groupedId)&&!l.isInAlbum,h=u?(0,m.xH)(e,s,l.groupedId)[0]:void 0;l=u&&(0,m.hj)(e,s,h)||l,c=l?.id||c;const f=(0,g.UZ)(l),v=f.some((e=>(0,g.Hl)(e,i))),w=v?f.filter((e=>!(0,g.Hl)(e,i))):[...f,i],Z=(0,m.oC)(e),P=w.slice(-Z),y=(0,m.jU)(e,r);if((0,m.$Y)(e,"reactionEffects")){const t=v?(0,b.CE)(y.activeReactions,[c]):{...y.activeReactions,[c]:[...y.activeReactions[c]||[],{messageId:c,reaction:i}]};e=(0,I.i)(e,{activeReactions:t},r)}e=Ve(e,l,P),(0,a.R3)(e);try{await(0,Y.t9)("sendReaction",{chat:d,messageId:c,reactions:P,shouldAddToRecent:o})}catch(t){e=Ve(e=(0,a.Rd)(),l,f),(0,a.R3)(e)}})),(0,a.iw)("stopActiveReaction",((e,t,n)=>{const{messageId:a,reaction:s,tabId:i=(0,p._w)()}=n,o=(0,m.jU)(e,i);if(!o.activeReactions[a]?.some((e=>(0,g.Hl)(e.reaction,s))))return e;const r=o.activeReactions[a].filter((e=>!(0,g.Hl)(e.reaction,s))),c=r.length?{...o.activeReactions,[a]:r}:(0,b.CE)(o.activeReactions,[a]);return(0,I.i)(e,{activeReactions:c},i)})),(0,a.iw)("setDefaultReaction",(async(e,t,n)=>{const{reaction:s}=n;await(0,Y.t9)("setDefaultReaction",{reaction:s})&&((e=(0,a.Rd)()).config?(e={...e,config:{...e.config,defaultReaction:s}},(0,a.R3)(e)):t.loadConfig())})),(0,a.iw)("stopActiveEmojiInteraction",((e,t,n)=>{const{id:a,tabId:s=(0,p._w)()}=n;return(0,I.i)(e,{activeEmojiInteractions:(0,m.jU)(e,s).activeEmojiInteractions?.filter((e=>e.id!==a))},s)})),(0,a.iw)("loadReactors",(async(e,t,n)=>{const{chatId:s,messageId:i,reaction:o}=n,r=(0,m.Z1)(e,s),c=(0,m.hj)(e,s,i);if(!r||!c)return;const d=c.reactors?.nextOffset,l=await(0,Y.t9)("fetchMessageReactionsList",{reaction:o,chat:r,messageId:i,offset:d});l&&(e=(0,a.Rd)(),l.users?.length&&(e=(0,u.Sh)(e,(0,b.ee)(l.users,"id"))),e=(0,u.cY)(e,s,i,{reactors:l}),(0,a.R3)(e))})),(0,a.iw)("loadMessageReactions",((e,t,n)=>{const{ids:a,chatId:s}=n,i=(0,m.Z1)(e,s);i&&(0,Y.t9)("fetchMessageReactions",{ids:a,chat:i})})),(0,a.iw)("sendWatchingEmojiInteraction",((e,t,n)=>{const{chatId:a,emoticon:s,x:i,y:o,startSize:r,isReversed:c,id:d,tabId:l=(0,p._w)()}=n,u=(0,m.Z1)(e,a),h=(0,m.jU)(e,l);if(u&&h.activeEmojiInteractions?.some((e=>e.id===d))&&a!==e.currentUserId)return(0,Y.t9)("sendWatchingEmojiInteraction",{chat:u,emoticon:s}),(0,I.i)(e,{activeEmojiInteractions:h.activeEmojiInteractions.map((t=>t.id===d?{...t,x:Ge(e,i),y:o,startSize:r,isReversed:c}:t))},l)})),(0,a.iw)("fetchUnreadReactions",(async(e,t,n)=>{const{chatId:s,offsetId:i}=n,o=(0,m.Z1)(e,s);if(!o)return;const r=await(0,Y.t9)("fetchUnreadReactions",{chat:o,offsetId:i,addOffset:i?-1:void 0});if(!r||!r.messages.length)return e=We(e=(0,a.Rd)(),s,{unreadReactionsCount:0}),void(0,a.R3)(e);const{messages:c,chats:d,users:l}=r,h=(0,b.ee)(c,"id"),g=Object.keys(h).map(Number);e=(0,a.Rd)(),e=(0,u.c_)(e,o.id,h),e=(0,u.Sh)(e,(0,b.ee)(l,"id")),e=We(e=(0,u.fZ)(e,(0,b.ee)(d,"id")),s,{unreadReactions:[...o.unreadReactions||[],...g]}),(0,a.R3)(e)})),(0,a.iw)("animateUnreadReaction",((e,t,n)=>{const{messageIds:s,tabId:i=(0,p._w)()}=n,o=(0,m.jr)(e,i);if(o){if(o.unreadReactionsCount){const n=o.unreadReactionsCount-s.length,i=(o.unreadReactions||[]).filter((e=>!s.includes(e)));e=We(e,o.id,{unreadReactions:i}),(0,a.R3)(e),!i.length&&n&&t.fetchUnreadReactions({chatId:o.id,offsetId:Math.min(...s)})}if(t.markMessagesRead({messageIds:s,tabId:i}),(0,m.$Y)(e,"reactionEffects"))return e=(0,a.Rd)(),(0,I.i)(e,{activeReactions:{...(0,m.jU)(e,i).activeReactions,...Object.fromEntries(s.map((t=>{const n=(0,m.hj)(e,o.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,p._w)()}=n||{},s=(0,m.jr)(e,a);s?.unreadReactions&&t.focusMessage({chatId:s.id,messageId:s.unreadReactions[0],tabId:a})})),(0,a.iw)("readAllReactions",((e,t,n)=>{const{tabId:a=(0,p._w)()}=n||{},s=(0,m.jr)(e,a);if(s)return(0,Y.t9)("readAllReactions",{chat:s}),We(e,s.id,{unreadReactionsCount:void 0,unreadReactions:void 0})})),(0,a.iw)("loadTopReactions",(async e=>{const t=await(0,Y.t9)("fetchTopReactions",{});t&&(e=(0,a.Rd)(),e={...e,topReactions:t.reactions},(0,a.R3)(e))})),(0,a.iw)("loadRecentReactions",(async e=>{const t=await(0,Y.t9)("fetchRecentReactions",{});t&&(e=(0,a.Rd)(),e={...e,recentReactions:t.reactions},(0,a.R3)(e))})),(0,a.iw)("clearRecentReactions",(async e=>{await(0,Y.t9)("clearRecentReactions")&&(e=(0,a.Rd)(),e={...e,recentReactions:[]},(0,a.R3)(e))})),(0,a.iw)("loadStatistics",(async(e,t,n)=>{const{chatId:s,isGroup:i,tabId:o=(0,p._w)()}=n,r=(0,m.Z1)(e,s),c=(0,m.x6)(e,s);if(!r||!c)return;const d=await(0,Y.t9)(i?"fetchGroupStatistics":"fetchChannelStatistics",{chat:r,dcId:c.statisticsDcId});if(!d)return;e=(0,a.Rd)();const{stats:l,users:h}=d;if(e=(0,u.Sh)(e,(0,b.ee)(h,"id")),"recentTopMessages"in l&&l.recentTopMessages.length){const t=(0,m.Zw)(e,s);l.recentTopMessages=l.recentTopMessages.map((e=>({...e,...t[e.msgId]})))}e=(0,u.ze)(e,s,l,o),(0,a.R3)(e)})),(0,a.iw)("loadMessageStatistics",(async(e,t,n)=>{const{chatId:s,messageId:i,tabId:o=(0,p._w)()}=n,r=(0,m.Z1)(e,s),c=(0,m.x6)(e,s);if(!r||!c)return;const d=c.statisticsDcId;let l=await(0,Y.t9)("fetchMessageStatistics",{chat:r,messageId:i,dcId:d});l||(l={}),e=(0,a.Rd)();const{views:h,forwards:g}=(0,m.Zw)(e,s)[i];l.views=h,l.forwards=g;const f=await(0,Y.t9)("fetchMessagePublicForwards",{chat:r,messageId:i,dcId:d});l.publicForwards=f?.length,l.publicForwardsData=f,e=(0,a.Rd)(),e=(0,u.kM)(e,l,o),(0,a.R3)(e)})),(0,a.iw)("loadStatisticsAsyncGraph",(async(e,t,n)=>{const{chatId:s,token:i,name:o,isPercentage:r,tabId:c=(0,p._w)()}=n,d=(0,m.x6)(e,s);if(!d)return;const l=d.statisticsDcId,h=await(0,Y.t9)("fetchStatisticsAsyncGraph",{token:i,dcId:l,isPercentage:r});h&&(e=(0,a.Rd)(),e=(0,u.yC)(e,s,o,h,c),(0,a.R3)(e))})),n(28304);var Ye=n(28406);(0,a.iw)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"updateChat":{const{isForum:s,lastReadOutboxMessageId:i}=(0,m.Z1)(e,n.id)||{};return n.chat.lastReadOutboxMessageId&&i&&n.chat.lastReadOutboxMessageId<i&&(n={...n,chat:(0,b.CE)(n.chat,["lastReadInboxMessageId"])}),e=(0,u.a4)(e,n.id,n.chat,n.newProfilePhoto),(0,a.R3)(e),n.noTopChatsRequest||(0,m.N)(e,n.id)||t.loadTopChats(),n.chat.id&&(0,Ye.Vr)({chatId:n.chat.id,lastReadInboxMessageId:n.chat.lastReadInboxMessageId}),void Object.values(e.byTabId).forEach((a=>{let{id:i}=a;const{chatId:o}=(0,m.Bt)(e,i)||{},r=n;o===r.id&&"isForum"in r.chat&&s!==r.chat.isForum&&(s&&t.closeForumPanel({tabId:i}),t.openChat({id:o,tabId:i}))}))}case"updateChatJoin":{const s=(0,m.Ek)(e,n.id);if(!s)return;e=(0,u.B1)(e,s,[n.id]),e=(0,u.a4)(e,n.id,{isNotJoined:!1}),(0,a.R3)(e);const i=(0,m.Z1)(e,n.id);return void(i&&t.requestChatUpdate({chatId:i.id}))}case"updateChatLeave":return(0,u.Dd)(e,n.id);case"updateChatInbox":return(0,u.a4)(e,n.id,n.chat);case"updateChatTypingStatus":{const{id:t,threadId:s=l._f,typingStatus:i}=n;return e=(0,u.pf)(e,t,s,"typingStatus",i),(0,a.R3)(e),void setTimeout((()=>{e=(0,a.Rd)();const n=(0,m.WP)(e,t,s,"typingStatus");i&&n&&i.timestamp===n.timestamp&&(e=(0,u.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,m.Z1)(e,n.chatId);if(!s)return;const i=Boolean(n.message.id&&n.message.hasUnreadMention);return e=(0,u.a4)(e,n.chatId,{unreadCount:s.unreadCount?s.unreadCount+1:1,...i&&{unreadMentionsCount:(s.unreadMentionsCount||0)+1}}),i&&(e=(0,u.a4)(e,n.chatId,{unreadMentions:[...s.unreadMentions||[],n.message.id]})),(0,a.R3)(e),void(0,Ye.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,m.X5)(e,t),s=(0,m.Z1)(e,a);s?.unreadReactionsCount&&(e=We(e,a,{unreadReactionsCount:s.unreadReactionsCount-1||void 0,unreadReactions:s.unreadReactions?.filter((e=>e!==t))})),s?.unreadMentionsCount&&(e=(0,u.a4)(e,a,{unreadMentionsCount:s.unreadMentionsCount-1||void 0,unreadMentions:s.unreadMentions?.filter((e=>e!==t))}))})),e}case"updateChatFullInfo":return(0,u.US)(e,n.id,n.fullInfo);case"updatePinnedChatIds":{const{ids:t,folderId:a}=n,s=a===i.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,m.Ek)(e,t);if(!s)return;const{[s]:o}=e.chats.orderedPinnedIds;let r=o||[];if(a){if(!r.includes(t)){if("active"===s&&r.length>=i.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,u.Pi)(e,t,a)}case"updateChatFolder":{const{id:t,folder:a}=n,{byId:s,orderedIds:i}=e.chatFolders,o=void 0===a;Object.values(e.byTabId).forEach((n=>{let{id:a}=n;const i=(0,m.jU)(e,a);Object.values(s)[i.activeChatFolder-1]?.id===t&&(e=(0,I.i)(e,{activeChatFolder:0},a))}));const r=o?(0,b.CE)(s,[t]):{...s,[t]:a},c=o?i?.filter((e=>e!==t)):i?.includes(t)?i:[...i||[],t];return{...e,chatFolders:{...e.chatFolders,byId:r,orderedIds:c,invites:(0,b.CE)(e.chatFolders.invites,[t])}}}case"updateChatFoldersOrder":{const{orderedIds:t}=n;return{...e,chatFolders:{...e.chatFolders,orderedIds:t}}}case"updateRecommendedChatFolders":{const{folders:t}=n;return{...e,chatFolders:{...e.chatFolders,recommended:t}}}case"updateChatMembers":{const t=(0,m.x6)(e,n.id),{replacedMembers:a,addedMember:s,deletedMemberId:i}=n;if(!t)return;let o=!1,r=t?.members?[...t.members]:[];if(a)r=a,o=!0;else if(s)r.length&&r.some((e=>e.userId===s.userId))||(r.push(s),o=!0);else if(r.length&&i){const e=r.findIndex((e=>e.userId===i));e>-1&&(r.slice(e,1),o=!0)}if(o){const t=r.filter((e=>{let{isOwner:t,isAdmin:n}=e;return t||n}));return e=(0,u.a4)(e,n.id,{membersCount:r.length}),e=(0,u.US)(e,n.id,{members:r,adminMembersById:(0,b.ee)(t,"userId")})}return}case"deleteProfilePhotos":{const{chatId:t,ids:a}=n,s=e.chats.byId[t];return s?.photos?(0,u.a4)(e,t,{photos:s.photos.filter((e=>!a.includes(e.id)))}):void 0}case"draftMessage":{const{chatId:t,formattedText:a,date:s,replyingToId:i,threadId:o}=n;if(!e.chats.byId[t])return;return e=(0,u.pf)(e,t,o||l._f,"draft",a),e=(0,u.pf)(e,t,o||l._f,"replyingToId",i),e=(0,u.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:i,recentRequesterIds:o}=n;if(!e.chats.byId[s])return;return e=(0,u.US)(e,s,{requestsPending:i,recentRequesterIds:o}),(0,a.R3)(e),void t.loadChatJoinRequests({chatId:s})}case"updatePinnedTopic":{const{chatId:t,topicId:s,isPinned:i}=n;if(!e.chats.byId[t])return;return e=(0,u.Cn)(e,t,s,{isPinned:i}),void(0,a.R3)(e)}case"updatePinnedTopicsOrder":{const{chatId:t,order:s}=n;if(!e.chats.byId[t])return;return e=(0,u.a4)(e,t,{orderedPinnedTopicIds:s}),void(0,a.R3)(e)}case"updateTopic":{const{chatId:a,topicId:s}=n;if(!(0,m.Z1)(e,a)?.isForum)return;return void t.loadTopicById({chatId:a,topicId:s})}case"updateTopics":{const{chatId:a}=n;if(!(0,m.Z1)(e,a)?.isForum)return;return void t.loadTopics({chatId:a,force:!0})}}}));var Je=n(84112);const Ke=350;function Qe(e,t,n,a,s,i,o){const r=o?.reactions;if(r&&(0,Je.A)(a,r))return e;if(e=(0,u.cY)(e,t,n,{reactions:a}),!i)return e;const c=s.unreadReactions?.includes(n);if((0,g.yL)(e,a)&&!c){e=We(e,t,{unreadReactionsCount:(s?.unreadReactionsCount||0)+1,unreadReactions:[...s?.unreadReactions||[],n]});const a=(0,m.hj)(e,t,n);if(!s||!a)return e;(0,L.R3)((()=>{(0,Ye.rh)({chat:s,message:a,isReaction:!0})}))}else c&&(e=We(e,t,{unreadReactionsCount:(s?.unreadReactionsCount||1)-1,unreadReactions:s?.unreadReactions?.filter((e=>e!==n))}));return e}function et(e,t,n,a){let s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const i=s?(0,m.Tm)(e,t,n):(0,m.hj)(e,t,n);if(i&&a.content){const{photo:e,video:t,sticker:n,document:s}=(0,g.qp)(i);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 o=i?{...i,...a}:a;return s?(0,u.P4)(e,t,n,o):(0,u.cY)(e,t,n,o)}function tt(e,t,n,a){const{chatId:s}=n,{threadInfo:i}=(0,m.Db)(e,n)||{};if(!i&&n.replyToMessageId){const i=(0,m.hj)(e,s,n.replyToMessageId);i?e=(0,u.lG)(e,i,s,n.id,a):t.loadMessage({chatId:s,messageId:n.replyToMessageId,threadUpdate:{isDeleting:a,lastMessageId:n.id}})}return e}function nt(e,t,n){const{id:a,chatId:s}=n,{threadInfo:i,firstMessageId:o}=(0,m.Db)(e,n)||{},r=(0,m.Z1)(e,s)?.unreadCount&&!(0,m.gb)(e,s,l._f);return e=tt(e,t,n),i&&(!o&&(0,g.CI)(n)||(e=(0,u.xj)(e,s,i.threadId,[a]),Object.values(e.byTabId).forEach((t=>{let{id:r}=t;(0,m.b9)(e,s,i.threadId,r)&&(e=(0,u.$S)(e,s,i.threadId,a,r),o||(e=(0,u.pf)(e,s,i.threadId,"firstMessageId",n.id)))}))),e=(0,u.pf)(e,s,i.threadId,"threadInfo",{...i,lastMessageId:n.id}),(0,g.CI)(n)||(e=(0,u.Xg)(e,s,i.threadId,{messagesCount:(i.messagesCount||0)+1}))),r||(e=(0,u.xj)(e,s,l._f,[a]),Object.values(e.byTabId).forEach((t=>{let{id:n}=t;if((0,m.b9)(e,s,l._f,n)){const t=(0,m.It)(e,s,l._f),i=(0,u.$S)(e,s,l._f,a,n),o=(0,m.Cb)(i,s,l._f,n);t&&!o.includes(t)||(e=i)}}))),e}function at(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{chats:s}=e,i=s.byId[t],o=i?.lastMessage,r=i?.isForum?(0,m.p$)(e,n):void 0;return r&&(e=(0,u.Cn)(e,t,r.id,{lastMessageId:n.id})),!o||a||o.id===n.id||o.id===n.previousLocalId||n.id>o.id?(0,u.a4)(e,t,{lastMessage:n}):e}function st(e,t){const n=(0,m.Zw)(e,t),a=(0,m.gb)(e,t,l._f);if(!n||!a)return;let s=a.length;for(;s--;){const e=n[a[s]];if(!e.isDeleting)return e}}function it(e,t,n,s){if(t){const i=(0,m.Z1)(e,t);if(!i)return;n.forEach((n=>{e=(0,u.cY)(e,t,n,{isDeleting:!0});const a=st(e=(0,u.CE)(e,t,n),t);a&&(e=at(e,t,a,!0)),i.topics?.[n]&&(e=(0,u.BK)(e,t,n))})),s.requestChatUpdate({chatId:t});const o=[];return n.forEach((n=>{const a=(0,m.hj)(e,t,n);if(!a)return;e=tt(e,s,a,!0);const i=(0,m.nr)(e,a);i&&o.push(i)})),(0,a.R3)(e),void setTimeout((()=>{e=(0,a.Rd)(),e=(0,u.K4)(e,t,n),(0,a.R3)(e),(0,b.Tw)(o).forEach((e=>{s.requestThreadInfoUpdate({chatId:t,threadId:e})}))}),Ke)}const i=[];n.forEach((t=>{const n=(0,m.X5)(e,t);if(n){i.push(n);const s=st(e=(0,u.cY)(e,n,t,{isDeleting:!0}),n);s&&(e=at(e,n,s,!0)),setTimeout((()=>{e=(0,a.Rd)(),e=(0,u.K4)(e,n,[t]),(0,a.R3)(e)}),Ke)}})),(0,a.R3)(e),(0,b.Tw)(i).forEach((e=>{s.requestChatUpdate({chatId:e})}))}(0,a.iw)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"newMessage":{const{chatId:s,id:i,message:o,shouldForceReply:r}=n;e=nt(e=et(e,s,i,o),t,o),o.repliesThreadInfo&&(e=(0,u.Xg)(e,o.repliesThreadInfo.chatId,o.repliesThreadInfo.threadId,o.repliesThreadInfo));const c=(0,m.hj)(e,s,i);(0,m.Z1)(e,s)?.isForum&&c.isTopicReply&&!(0,m.p$)(e,c)&&c.replyToMessageId&&t.loadTopicById({chatId:s,topicId:c.replyToMessageId}),Object.values(e.byTabId).forEach((n=>{let{id:d}=n;const h=(0,g.CI)(o);if((0,m.KA)(e,s,o,d)){if(h&&o.isOutgoing&&!o.content?.action){const n=(0,m.Bt)(e,d);n&&t.focusMessage({chatId:s,threadId:n.threadId,messageId:o.id,noHighlight:!0,isResizingContainer:!0,tabId:d})}const{threadInfo:n}=(0,m.Db)(e,o)||{};n&&!h&&t.requestThreadInfoUpdate({chatId:s,threadId:n.threadId}),h||setTimeout((()=>{e=(0,a.Rd)(),r&&(e=(0,u.pf)(e,s,l._f,"replyingToId",i)),e=at(e,s,c),(0,a.R3)(e)}),Ke)}else e=at(e,s,c)})),(0,a.R3)(e),(0,m.N)(e,s)||t.loadTopChats();break}case"updateStartEmojiInteraction":Object.values(e.byTabId).forEach((t=>{let{id:a}=t;const{chatId:s}=(0,m.Bt)(e,a)||{};if(s!==n.id)return;const i=(0,m.hj)(e,s,n.messageId);if(!i)return;if((0,g.UD)(i)!==n.emoji)return;const o=(0,m.jU)(e,a);e=(0,I.i)(e,{activeEmojiInteractions:[...o.activeEmojiInteractions||[],{id:o.activeEmojiInteractions?.length||0,animatedEffect:n.emoji,messageId:n.messageId}]},a)})),(0,a.R3)(e);break;case"newScheduledMessage":{const{chatId:t,id:s,message:i}=n;e=et(e,t,s,i,!0);const o=(0,m.qy)(e,t,l._f)||[];e=(0,u.pf)(e,t,l._f,"scheduledIds",(0,b.Tw)([...o,s]));const r=(0,m.nr)(e,i);if(r!==l._f){const n=(0,m.qy)(e,t,r)||[];e=(0,u.pf)(e,t,r,"scheduledIds",(0,b.Tw)([...n,s]))}(0,a.R3)(e);break}case"updateMessage":{const{chatId:t,id:s,message:i}=n,o=(0,m.hj)(e,t,s),r=(0,m.Z1)(e,t);e=et(e,t,s,i);const c=(0,m.hj)(e,t,s);i.repliesThreadInfo&&(e=(0,u.Xg)(e,i.repliesThreadInfo.chatId,i.repliesThreadInfo.threadId,i.repliesThreadInfo)),o&&(e=at(e,t,c)),i.reactions&&r&&(e=Qe(e,t,s,i.reactions,r,c.isOutgoing,o)),i.content?.text?.text!==o?.content?.text?.text&&(e=(0,u.CE)(e,t,s)),(0,a.R3)(e);break}case"updateScheduledMessage":{const{chatId:t,id:s,message:i}=n,o=(0,m.Tm)(e,t,s);if(!o)return;e=et(e,t,s,i,!0);const r=Object.keys((0,m.yB)(e,t)||{}).map(Number).sort(((e,t)=>t-e));e=(0,u.pf)(e,t,l._f,"scheduledIds",r);const c=(0,m.nr)(e,o);if(c!==l._f){const n=(0,m.qy)(e,t,c)||[];e=(0,u.pf)(e,t,c,"scheduledIds",n.sort(((e,t)=>t-e)))}(0,a.R3)(e);break}case"updateMessageSendSucceeded":{const{chatId:s,localId:i,message:o}=n;e=nt(e,t,o);const r=(0,m.hj)(e,s,i);e=(0,u.K4)(e,s,[i]),o.isScheduled&&(e=(0,u.bV)(e,s,[i])),e=(0,u.cY)(e,s,o.id,{...r,...o,previousLocalId:i});const c=(0,m.hj)(e,s,o.id);e=at(e,s,c);const d=(0,m.Db)(e,o);Object.values(e.byTabId).forEach((n=>{let{id:a}=n;const{chatId:i,threadId:r}=(0,m.Bt)(e,a)||{};i===s&&(d?.threadInfo?.threadId||l._f)===r&&t.markMessageListRead({maxId:o.id,tabId:a})})),d?.threadInfo&&(e=(0,u.pf)(e,s,d.threadInfo.threadId,"threadInfo",{...d.threadInfo,lastMessageId:o.id,lastReadInboxMessageId:o.id})),(0,a.R3)(e);break}case"updateScheduledMessageSendSucceeded":{const{chatId:t,localId:s,message:i}=n,o=(0,m.qy)(e,t,l._f)||[];e=(0,u.pf)(e,t,l._f,"scheduledIds",[...o,i.id]);const r=(0,m.nr)(e,i);if(r!==l._f){const n=(0,m.qy)(e,t,r)||[];e=(0,u.pf)(e,t,r,"scheduledIds",[...n,i.id])}const c=(0,m.Tm)(e,t,s);e=(0,u.bV)(e,t,[s]),e=(0,u.P4)(e,t,i.id,{...c,...i,previousLocalId:s}),(0,a.R3)(e);break}case"updatePinnedIds":{const{chatId:t,isPinned:s,messageIds:i}=n,o=(0,b.q0)((0,m.Zw)(e,t),i),r={[l._f]:i};Object.values(o).forEach((n=>{const a=(0,m.nr)(e,n);if(e=(0,u.cY)(e,t,n.id,{isPinned:s}),a===l._f)return;const i=r[a]||[];i.push(n.id),r[a]=i})),Object.entries(r).forEach((n=>{let[a,i]=n;const o=(0,m.KB)(e,t,l._f)||[],r=s?(0,b.Tw)(o.concat(i)).sort(((e,t)=>t-e)):o.filter((e=>!i.includes(e)));e=(0,u.pf)(e,t,Number(a),"pinnedIds",r)})),(0,a.R3)(e);break}case"updateThreadInfo":{const{chatId:s,threadId:i,threadInfo:o,firstMessageId:r}=n,c=(0,m.tZ)(e,s,i),d={...c,...o};if(!d.threadId)return;e=(0,u.Xg)(e,s,i,d),r&&(e=(0,u.pf)(e,s,i,"firstMessageId",r));const l=(0,m.Z1)(e,s);if(l?.isForum&&o.lastReadInboxMessageId!==c?.lastReadInboxMessageId&&t.loadTopicById({chatId:s,topicId:i}),o.topMessageId===i&&!l?.isForum){const t=l?.lastReadInboxMessageId,n=d.lastReadInboxMessageId||t;t&&n&&(e=(0,u.Xg)(e,s,i,{lastReadInboxMessageId:Math.max(n,t)}))}(0,a.R3)(e);break}case"resetMessages":{const{id:s}=n,i=(0,m.Zw)(e,s);i&&!(0,g.YC)(s)&&(e=(0,u.K4)(e,s,Object.keys(i).map(Number)),(0,a.R3)(e),t.loadFullChat({chatId:s,force:!0,tabId:(0,p._w)()}));break}case"deleteMessages":{const{ids:a,chatId:s}=n;it(e,s,a,t);break}case"deleteScheduledMessages":{const{ids:t,chatId:s}=n;!function(e,t,n,s){e&&(t.forEach((t=>{s=(0,u.P4)(s,e,t,{isDeleting:!0})})),(0,a.R3)(s),setTimeout((()=>{s=(0,a.Rd)(),s=(0,u.bV)(s,e,t);const n=(0,m.yB)(s,e);s=(0,u.pf)(s,e,l._f,"scheduledIds",Object.keys(n||{}).map(Number)),(0,a.R3)(s)}),Ke))}(s,t,0,e);break}case"deleteHistory":{const{chatId:s}=n,o=e.messages.byChatId[s];if(s===i.awM&&(e={...e,serviceNotifications:e.serviceNotifications.map((e=>({...e,isDeleted:!0})))},(0,a.R3)(e)),o){const n=Object.keys(o.byId).map(Number);it(e=(0,a.Rd)(),s,n,t)}else t.requestChatUpdate({chatId:s});e=(0,a.Rd)(),e=(0,u.kq)(e,s),(0,a.R3)(e);break}case"updateCommonBoxMessages":{const{ids:t,messageUpdate:s}=n;t.forEach((t=>{const n=(0,m.X5)(e,t);n&&(e=(0,u.cY)(e,n,t,s))})),(0,a.R3)(e);break}case"updateChannelMessages":{const{channelId:t,ids:s,messageUpdate:i}=n;s.forEach((n=>{e=(0,u.cY)(e,t,n,i)})),(0,a.R3)(e);break}case"updateMessagePoll":{const{pollId:t,pollUpdate:s}=n,i=(0,m.ZB)(e,t);if(i?.content.poll){const t=i.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 o={...i.content.poll,...s,results:n};e=(0,u.cY)(e,i.chatId,i.id,{content:{...i.content,poll:o}}),(0,a.R3)(e)}break}case"updateMessagePollVote":{const{pollId:t,userId:s,options:i}=n,o=(0,m.ZB)(e,t);if(!o||!o.content.poll||!o.content.poll.results)break;const{poll:r}=o.content,{recentVoterIds:c,totalVoters:d,results:l}=r.results,h=c?[...c]:[],g=d?d+1:1,p=l?[...l]:[];h.push(s),i.forEach((t=>{const n=p.findIndex((e=>e.option===t)),a=p[n],i=a?{...a}:{option:t,votersCount:0};i.votersCount+=1,s===e.currentUserId&&(i.isChosen=!0),n?p[n]=i:p.push(i)})),e=(0,u.cY)(e,o.chatId,o.id,{content:{...o.content,poll:{...r,results:{...r.results,recentVoterIds:h,totalVoters:g,results:p}}}}),(0,a.R3)(e);break}case"updateServiceNotification":{const{message:a}=n;(0,m.UW)(e)&&t.createServiceNotification({message:a});break}case"updateMessageReactions":{const{chatId:t,id:s,reactions:i}=n,o=(0,m.hj)(e,t,s),r=(0,m.Z1)(e,n.chatId);if(!r||!o)return;e=Qe(e,t,s,i,r,o.isOutgoing,o),(0,a.R3)(e);break}case"updateMessageExtendedMedia":{const{chatId:t,id:s,media:i,preview:o}=n,r=(0,m.hj)(e,t,s);if(!(0,m.Z1)(e,n.chatId)||!r)return;if(o){if(!r.content.invoice)return;e=(0,u.cY)(e,t,s,{content:{...r.content,invoice:{...r.content.invoice,extendedMedia:o}}}),(0,a.R3)(e)}else i&&(e=(0,u.cY)(e,t,s,{content:{...i}}),(0,a.R3)(e));break}case"updateTranscribedAudio":{const{transcriptionId:t,text:s,isPending:i}=n;e={...e,transcriptions:{...e.transcriptions,[t]:{...e.transcriptions[t]||{},transcriptionId:t,text:s,isPending:i}}},(0,a.R3)(e);break}case"updateMessageSendFailed":{const{chatId:s,localId:i,error:o}=n;o.match(/CHAT_SEND_.+?FORBIDDEN/)&&Object.values(e.byTabId).forEach((e=>{let{id:n}=e;t.showAllowedMessageTypesNotification({chatId:s,tabId:n})})),e=(0,u.cY)(e,s,i,{sendingState:"messageSendingStateFailed"}),(0,a.R3)(e);break}case"updateMessageTranslations":{const{chatId:t,messageIds:s,toLanguageCode:i,translations:o}=n;e=(0,u.TD)(e,t,s,i,o),(0,a.R3)(e);break}}}));const ot=(0,L.P2)((function(){let e=(0,a.Rd)();e=(0,u.ps)(e,{...e.users.statusesById,...rt}),(0,a.R3)(e),rt={}}),3e3,!0);let rt={};(0,a.iw)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"deleteContact":return(0,u.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,m.wV)(e)&&(n.user.isPremium&&t.openPremiumModal({isSuccess:!0,tabId:s}),e={...e,translations:{byChatId:{}}})})),e=(0,u.Nq)(e,n.id,n.user),n.fullInfo&&(e=(0,u.ap)(e,n.id,n.fullInfo)),e;case"updateRequestUserUpdate":t.loadFullUser({userId:n.id});break;case"updateUserEmojiStatus":return(0,u.Nq)(e,n.userId,{emojiStatus:n.emojiStatus});case"updateUserStatus":return a=n.userId,s=n.status,rt[a]=s,void ot();case"updateUserFullInfo":{const{id:t,fullInfo:a}=n;return(0,u.ap)(e,t,a)}case"updateBotMenuButton":{const{botId:t,button:a}=n,s=(0,m.iF)(e,t);if(!s?.botInfo)return;return(0,u.ap)(e,t,{botInfo:{...s.botInfo,menuButton:a}})}}var a,s})),(0,a.iw)("apiUpdate",((e,t,n)=>{if("updateStickerSet"===n["@type"])return(0,u.Rg)(e,n.id,n.stickerSet)})),(0,a.iw)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"updatePeerBlocked":return n.isBlocked?(0,u.O4)(e,n.id):(0,u.rB)(e,n.id);case"updateResetContactList":e={...e,contactList:{userIds:[]}},(0,a.R3)(e);break;case"updateConfig":t.loadConfig();break;case"updateFavoriteStickers":t.loadFavoriteStickers();break;case"updateRecentStickers":t.loadRecentStickers();break;case"updateRecentReactions":t.loadRecentReactions();break;case"updateRecentEmojiStatuses":t.loadRecentEmojiStatuses();break;case"updateMoveStickerSetToTop":{const a=n.isCustomEmoji?e.customEmojis.added.setIds:e.stickers.added.setIds;if(!a)return e;const s=[n.id,...a.filter((e=>e!==n.id))];t.reorderStickerSets({order:s,isCustomEmoji:n.isCustomEmoji});break}case"updateStickerSets":t.loadStickerSets();break;case"updateStickerSetsOrder":{const a=n.order.filter((t=>Boolean(e.stickers.setsById[t])));t.reorderStickerSets({order:a,isCustomEmoji:n.isCustomEmoji});break}case"updateSavedGifs":t.loadSavedGifs();break;case"updatePrivacy":e={...e,settings:{...e.settings,privacy:{...e.settings.privacy,[n.key]:n.rules}}},(0,a.R3)(e);break;case"updatePaymentVerificationNeeded":Object.values(e.byTabId).forEach((t=>{let{id:a}=t;e=(0,u.fS)(e,n.url,a),e=(0,u.Q$)(e,w.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,u.HN)(e,n.peerType,n.isSilent,n.shouldShowPreviews);case"updateNotifyExceptions":{const{chatId:t,isMuted:s,isSilent:i,shouldShowPreviews:o}=n;e.chats.byId[t]&&(e=(0,u.a4)(e,t,{isMuted:s})),e=(0,u.aK)(e,t,{isMuted:s,isSilent:i,shouldShowPreviews:o}),(0,a.R3)(e);break}case"updateTopicNotifyExceptions":{const{chatId:t,topicId:s,isMuted:i}=n;e=(0,u.Cn)(e,t,s,{isMuted:i}),(0,a.R3)(e);break}}})),(0,a.iw)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"updateTwoFaStateWaitCode":return{...e,twoFaSettings:{...e.twoFaSettings,isLoading:!1,waitingEmailCodeLength:n.length}};case"updateTwoFaError":return{...e,twoFaSettings:{...e.twoFaSettings,error:n.message}}}}));var ct=n(78958),dt=n(42431);(0,a.iw)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"updateGroupCall":{if("discarded"===n.call.connectionState)return e.groupCalls.activeGroupCallId?void("leaveGroupCall"in t&&t.leaveGroupCall({shouldRemove:!0,tabId:(0,p._w)()})):(0,ct.dc)(e,n.call.id);const a=(0,dt.$5)(e,n.call.id),s=a?.chatId;return s&&(e=(0,u.a4)(e,s,{isCallNotEmpty:a.participantsCount>0||Boolean(a.participants?.length)})),(0,ct.AH)(e,n.call.id,(0,b.CE)(n.call,["connectionState"]),void 0,n.call.participantsCount)}case"updateGroupCallChatId":return(0,m.Z1)(e,n.chatId)&&(e=(0,u.US)(e,n.chatId,{groupCallId:n.call.id})),e;case"updateGroupCallParticipants":{const{groupCallId:t,participants:s,nextOffset:i}=n,{currentUserId:o}=e;e=(0,a.Rd)(),s.forEach((n=>{n.id&&(e=(0,ct.B6)(e,t,n.id,n,Boolean(i)||o===n.id))})),i&&(e=(0,ct.AH)(e,t,{nextOffset:i}));const r=(0,dt.$5)(e,t),c=r?.chatId;return c&&(e=(0,u.a4)(e,c,{isCallNotEmpty:r.participantsCount>0||Boolean(r.participants?.length)})),e}case"updatePhoneCall":{if(!s.Bi)return;const{phoneCall:i,currentUserId:o}=e,{call:r}=n;if(i)return"discarded"===r.state?(t.playGroupCallSound({sound:"end"}),"hangUp"in t&&t.hangUp({tabId:(0,p._w)()}),{...e,...r.needRating&&{ratingPhoneCall:r}}):void 0;if(r?.adminId!==o&&"requested"===r.state)return(0,L.R3)((()=>{e=(0,a.Rd)(),(0,Ye.TO)({call:r,user:(0,dt.fu)(e)})})),(0,q.EP)(),(0,q.CW)(e,t,r.isVideo,(0,p._w)()),e={...e,phoneCall:r},(0,I.i)(e,{isCallPanelVisible:!1},(0,p._w)())}}}));var lt=n(9937);(0,a.iw)("apiUpdate",((e,t,n)=>{"updatePaymentStateCompleted"===n["@type"]&&Object.values(e.byTabId).forEach((a=>{let{id:i}=a;const{inputInvoice:o}=(0,m.jU)(e,i).payment;if(o&&"chatId"in o&&"messageId"in o){const n=(0,m.hj)(e,o.chatId,o.messageId);if(n&&n.content.invoice){const{amount:e,currency:a,title:s}=n.content.invoice;t.showNotification({tabId:i,message:y.Iu("PaymentInfoHint",[(0,lt.x)(e,a,y.QO().code),s])})}}s.Xp||(e=(0,u.WY)(e,i)),n.slug&&o&&"slug"in o&&o.slug!==n.slug||(e=(0,I.i)(e,{payment:{...(0,m.jU)(e,i).payment,status:"paid"}},i))}))}));var ut=n(46752),mt=n(1279),ht=n(53551),gt=n(99203),pt=n(25190),ft=n(274),It=n(45332);function vt(e){const t=(0,pt.Z)(e);(0,o.d4)((()=>(0,L.Gq)(t)),[t])}var wt=n(34446);const bt=document.querySelector('meta[name="viewport"]'),Zt=bt?.getAttribute("content")||"",Pt="width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover";function yt(e){e.preventDefault()}var Ct=n(65326),St=n(31212),Et=n(18674),Mt=n(62357),Rt=n(36413),kt=n(28183),Tt=n(60706),At=n(48778);const Nt=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,At.Z)(gt.gl.Extra,"StickerSetModal",!t);return n?o.ZP.createElement(n,e):void 0}));var xt=n(2155),Bt=n(95616),Lt=n(17358);const Ut=(0,o.X$)((e=>{let{isForAppBadge:t}=e;(0,Bt.yi)();const n=(0,x.xW)();if((0,o.d4)((()=>{t&&(0,Lt.w)(n)}),[t,n]),!t&&n)return o.ZP.createElement("div",{className:"unread-count active"},(0,xt.bi)(n))}));var jt=n(23989),Ot=n(53455),Ft=n(73541),_t=n(2255),Dt=n(59107),$t=n(54416),qt=n(706);let Ht=function(e){return e[e.waitingForNetwork=0]="waitingForNetwork",e[e.syncing=1]="syncing",e[e.online=2]="online",e}({});function Gt(e,t,n,a,s,i){let r,c,d;return r=function(){const[e,t]=(0,o.eJ)(window.navigator.onLine);return(0,o.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?Ht.syncing:Ht.online:Ht.waitingForNetwork,c=r===Ht.online||i?"none":a?"middleHeader":s?"minimized":"overlay",r===Ht.waitingForNetwork?d=e("WaitingForNetwork"):r===Ht.syncing&&(d=e("Updating")),"middleHeader"===c&&(d=d.toLowerCase().replace(/\.+$/,"")),{connectionStatus:r,connectionStatusPosition:c,connectionStatusText:d}}var Vt=n(36046),Wt=n(73217),zt=n(97458),Xt=n(53106),Yt=n(58964),Jt=n(231),Kt=n(69589),Qt=n(49187),en=n(83321),tn=n(40126),nn=n(49204);const an=(0,o.X$)((e=>{let{connectionStatus:t,connectionStatusText:n,onClick:a}=e;const s=(0,Dt.Z)();return o.ZP.createElement("div",{id:"ConnectionStatusOverlay",dir:s.isRtl?"rtl":void 0,onClick:a},o.ZP.createElement(nn.Z,{color:"black"}),o.ZP.createElement("div",{className:"state-text"},o.ZP.createElement(_t.Z,{activeKey:t,name:"slideFade"},n)),o.ZP.createElement(Jt.Z,{round:!0,size:"tiny",color:"translucent-black"},o.ZP.createElement("span",{className:"icon icon-close"})))}));var sn=n(96459),on=n(4863),rn=n(6202);const cn="HO3tML0GAC9vTH28baKB",dn=(0,o.X$)((e=>{let{reaction:t,isLottie:n,className:a}=e;const i=(0,g.RK)(t.documentId),r=(0,rn.Z)(n?void 0:i),c=(0,o.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 o.ZP.createElement("div",{className:(0,ut.Z)("HAg4STRlxDV3frYuABYr",a)},c.map((e=>{const a=`--offset-path: path('${e}');`;return n?o.ZP.createElement(sn.Z,{documentId:t.documentId,className:cn,style:a,withSharedAnimation:!0}):o.ZP.createElement("img",{src:r,alt:"",className:cn,style:a})})))})),ln=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,At.Z)(gt.gl.Extra,"StatusPickerMenu",!t);return n?o.ZP.createElement(n,e):void 0})),un=(0,o.X$)((0,a.c$)((e=>{const{currentUserId:t}=e;return{emojiStatus:(t?(0,m.dy)(e,t):void 0)?.emojiStatus}}))((e=>{let{emojiStatus:t}=e;const{setEmojiStatus:n,loadCurrentUser:s}=(0,a.Sv)(),r=(0,o.sO)(null),[c,d,l]=(0,Tt.Z)(!1),[u,m,h]=(0,Tt.Z)(!1),[g,p,f]=(0,Tt.Z)(!1),{isMobile:I}=(0,M.ZP)(),v=t?.until?1e3*t.until-Date.now()+1e3*(0,Z.Qj)():void 0;(0,kt.Z)(s,v),(0,ft.Z)((e=>{let[n]=e;c&&t&&n&&t.documentId!==n.documentId&&(m(),l())}),[t,c,m,l]);const w=(0,o.I4)((e=>{d(),n({emojiStatus:e})}),[d,n]);(0,kt.Z)(h,u?1500:void 0);const b=(0,o.I4)((()=>{p()}),[p]);return o.ZP.createElement("div",{className:"extra-spacing"},Boolean(u&&t)&&o.ZP.createElement(dn,{reaction:t,isLottie:!0,className:"emoji-status-effect"}),o.ZP.createElement(Jt.Z,{round:!0,ref:r,ripple:!I,size:"smaller",color:"translucent",className:"emoji-status",onClick:b},t?o.ZP.createElement(sn.Z,{key:t.documentId,documentId:t.documentId,size:24,loopLimit:i.y3O}):o.ZP.createElement(on.Z,null)),o.ZP.createElement(ln,{statusButtonRef:r,isOpen:g,onEmojiStatusSelect:w,onClose:f}))}))),mn={root:"pHTSMORJ7J73wlJmXnNb",widget:"bCgS149_amzM_wXYhOwW",min:"EIngX7JB2IwA5XnGAlpo",mid:"bNWGD8kaT2IHf7HrmLoA",max:"FiCjIrDiSiJDbaafBQ8V",filler:"KAFaJ8frkI3Uu05TmeTH"},hn=(0,o.X$)((function(e){let{value:t}=e;return o.ZP.createElement("div",{className:(0,ut.Z)(mn.root,"Toggle"),"aria-hidden":!0},o.ZP.createElement("i",{className:(0,ut.Z)(mn.filler,mn[t])}),o.ZP.createElement("i",{className:(0,ut.Z)(mn.widget,mn[t])}))})),gn=(0,o.X$)((0,a.c$)((e=>{const t=(0,m.jU)(e),{query:n,fetchingStatus:a,chatId:s,date:i}=t.globalSearch,{currentUserId:o,connectionState:r,isSyncing:c,archiveSettings:d}=e,{isConnectionStatusMinimized:l,animationLevel:u}=e.settings.byKey;return{searchQuery:n,isLoading:!!a&&Boolean(a.chats||a.messages),currentUserId:o,globalSearchChatId:s,searchDate:i,theme:(0,m.Pu)(e),animationLevel:u,connectionState:r,isSyncing:c,isMessageListOpen:Boolean((0,m.Bt)(e)),isConnectionStatusMinimized:l,isCurrentUserPremium:(0,m.wV)(e),areChatsLoaded:Boolean(e.chats.listIds.active),hasPasscode:Boolean(e.passcode.hasPasscode),canInstall:Boolean(t.canInstall),archiveSettings:d,canSetPasscode:(0,m.eB)(e)}}))((e=>{let{shouldHideSearch:t,content:n,contactsFilter:r,onSearchQuery:c,isClosingSearch:d,onSelectSettings:l,onSelectContacts:u,onSelectArchived:m,onReset:h,searchQuery:g,isLoading:p,isCurrentUserPremium:f,shouldSkipTransition:I,currentUserId:v,globalSearchChatId:b,searchDate:Z,theme:P,animationLevel:y,connectionState:C,isSyncing:S,isMessageListOpen:E,isConnectionStatusMinimized:R,areChatsLoaded:k,hasPasscode:T,canSetPasscode:A,canInstall:N,archiveSettings:x}=e;const{openChat:B,setGlobalSearchDate:L,setSettingOption:U,setGlobalSearchChatId:j,openChatByUsername:O,lockScreen:F,requestNextSettingsScreen:_,skipLockOnUnload:D,openUrl:$,updatePerformanceSettings:q}=(0,a.Sv)(),H=(0,Dt.Z)(),{isMobile:G}=(0,M.ZP)(),V=n===w.du.ChatList,z=(0,o.Ye)((()=>Z?(0,he.xH)(new Date(1e3*Z)):void 0),[Z]),X=(0,Bt.yi)()[i.WSp]?.chatsCount||0,{connectionStatus:Y,connectionStatusText:J,connectionStatusPosition:K}=Gt(H,C,S,E,R,!k),Q=(0,pt.Z)((e=>{e.preventDefault(),e.stopPropagation(),T?F():_({screen:w.MT.PasscodeDisabled})}));(0,Ft.y)(A?{"Ctrl+Shift+L":Q,"Alt+Shift+L":Q,"Meta+Shift+L":Q,...s.RM&&{"Mod+L":Q}}:void 0);const ee=window.location.hostname===i.xHY||i.Cgt,te=(0,o.Ye)((()=>e=>{let{onTrigger:t,isOpen:n}=e;return o.ZP.createElement(Jt.Z,{round:!0,ripple:V&&!G,size:"smaller",color:"translucent",className:n?"active":"",onClick:V?t:()=>h(),ariaLabel:V?H("AccDescrOpenMenu2"):"Return to chat list"},o.ZP.createElement("div",{className:(0,ut.Z)("animated-menu-icon",!V&&"state-back",I&&"no-animation")}))}),[V,G,H,h,I]),ne=(0,pt.Z)((()=>{g||c("")})),ae=(0,pt.Z)((()=>{U({isConnectionStatusMinimized:!R})})),se=(0,pt.Z)((()=>{B({id:v,shouldReplaceHistory:!0})})),ie=(0,pt.Z)((e=>{e.stopPropagation(),U({theme:"light"===P?"dark":"light"}),U({shouldUseSystemTheme:!1})})),oe=(0,pt.Z)((e=>{e.stopPropagation();let t=y+1;t>i.zy8&&(t=i.oBh);const n=t===i.oBh?W.ww:t===i.zy8?W.WD:W.LN;U({animationLevel:t}),q(n)})),re=(0,pt.Z)((()=>{window.open(i.ulW,"_blank","noopener")})),ce=(0,pt.Z)((()=>{localStorage.setItem("kz_version",JSON.stringify("K")),(0,qt.W8)(),D()})),de=(0,pt.Z)((()=>{O({username:H("Settings.TipsUsername")})})),le=(0,pt.Z)((()=>{$({url:i.mUA})})),ue=(0,pt.Z)((()=>{F()})),me=Boolean(b)||n===w.du.GlobalSearch||n===w.du.Contacts;(0,o.d4)((()=>me?(0,jt.Z)((()=>h())):void 0),[me,h]);const ge=n===w.du.Contacts?H("SearchFriends"):H("Search"),pe=i.Tjg?"1.61.24 Beta (master)":i.eMD?"master":"1.61.24",fe=y!==i.oBh?y===i.zy8?"max":"mid":"min",Ie=(0,Rt.Ar)(),{shouldDisableDropdownMenuTransitionRef:ve,handleDropdownMenuTransitionEnd:we}=(0,Wt.Z)(t),be=(0,o.sO)(null);(0,zt.Z)(be);const Ze=(0,o.Ye)((()=>o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement(Yt.Z,{icon:"saved-messages",onClick:se},H("SavedMessages")),x.isHidden&&o.ZP.createElement(Yt.Z,{icon:"archive",onClick:m},o.ZP.createElement("span",{className:"menu-item-name"},H("ArchivedChats")),X>0&&o.ZP.createElement("div",{className:"right-badge"},X)),o.ZP.createElement(Yt.Z,{icon:"user",onClick:u},H("Contacts")),o.ZP.createElement(Yt.Z,{icon:"settings",onClick:l},H("Settings")),o.ZP.createElement(Yt.Z,{icon:"darkmode",onClick:ie},o.ZP.createElement("span",{className:"menu-item-name"},H("lng_menu_night_mode")),o.ZP.createElement(en.Z,{id:"darkmode",label:H("dark"===P?"lng_settings_disable_night_theme":"lng_settings_enable_night_theme"),checked:"dark"===P,noAnimation:!0})),o.ZP.createElement(Yt.Z,{icon:"animations",onClick:oe},o.ZP.createElement("span",{className:"menu-item-name capitalize"},H("Appearance.Animations").toLowerCase()),o.ZP.createElement(hn,{value:fe})),o.ZP.createElement(Yt.Z,{icon:"help",onClick:de},H("TelegramFeatures")),o.ZP.createElement(Yt.Z,{icon:"bug",onClick:le},"Report Bug"),i.Tjg&&o.ZP.createElement(Yt.Z,{icon:"permissions",onClick:re},"Beta Changelog"),ee&&o.ZP.createElement(Yt.Z,{icon:"K",isCharIcon:!0,href:"https://web.telegram.org/k/",onClick:ce},"Switch to K Version"),N&&o.ZP.createElement(Yt.Z,{icon:"install",onClick:(0,Vt.G)()},"Install App"))),[fe,X,N,oe,le,H,re,ie,de,se,ce,m,u,l,P,ee,x]);return o.ZP.createElement("div",{className:"LeftMainHeader"},o.ZP.createElement("div",{id:"LeftMainHeader",className:"left-header",ref:be},H.isRtl&&o.ZP.createElement("div",{className:"DropdownMenuFiller"}),o.ZP.createElement(Xt.Z,{trigger:te,footer:`${i.iCi} ${pe}`,className:(0,ut.Z)("main-menu",H.isRtl&&"rtl",t&&H.isRtl&&"right-aligned",ve.current&&H.isRtl&&"disable-transition"),positionX:t&&H.isRtl?"right":"left",transformOriginX:i.D$V&&!Ie?90:void 0,onTransitionEnd:H.isRtl?we:void 0},Ze),o.ZP.createElement(Kt.Z,{inputId:"telegram-search-input",parentContainerClassName:"LeftSearch",className:(0,ut.Z)(b||Z?"with-picker-item":void 0,t&&"SearchInput--hidden"),value:d?void 0:r||g,focused:me,isLoading:p||"minimized"===K,spinnerColor:"minimized"===K?"yellow":void 0,spinnerBackgroundColor:"minimized"===K&&"light"===P?"light":void 0,placeholder:ge,autoComplete:"off",canClose:Boolean(b||Z),onChange:c,onReset:h,onFocus:ne,onSpinnerClick:"minimized"===K?ae:void 0},z&&o.ZP.createElement(Qt.Z,{icon:"calendar",title:z,canClose:!0,isMinimized:Boolean(b),className:"search-date",onClick:L,clickArg:{date:void 0}}),b&&o.ZP.createElement(Qt.Z,{chatOrUserId:b,onClick:j,canClose:!0,clickArg:{id:void 0}})),f&&o.ZP.createElement(un,null),T&&o.ZP.createElement(Jt.Z,{round:!0,ripple:!G,size:"smaller",color:"translucent",ariaLabel:`${H("ShortcutsController.Others.LockByPasscode")} (Ctrl+Shift+L)`,onClick:ue,className:(0,ut.Z)(!f&&"extra-spacing")},o.ZP.createElement("i",{className:"icon icon-lock"})),o.ZP.createElement(tn.Z,{isOpen:"overlay"===K,isCustom:!0,className:"connection-state-wrapper"},o.ZP.createElement(an,{connectionStatus:Y,connectionStatusText:J,onClick:ae}))))})));var pn=n(64963),fn=n(46590),In=n(31711),vn=n(11543);const wn=(0,o.X$)((0,a.c$)((e=>{const{chatFolders:{byId:t,orderedIds:n,invites:a},chats:{listIds:{archived:s}},currentUserId:i,lastSyncTime:o,archiveSettings:r}=e,{shouldSkipHistoryAnimations:c,activeChatFolder:d}=(0,m.jU)(e);return{chatFoldersById:t,folderInvitesById:a,orderedFolderIds:n,activeChatFolder:d,currentUserId:i,lastSyncTime:o,shouldSkipHistoryAnimations:c,hasArchivedChats:Boolean(s?.length),maxFolders:(0,ce.M)(e,"dialogFilters"),maxFolderInvites:(0,ce.M)(e,"chatlistInvites"),archiveSettings:r}}))((e=>{let{foldersDispatch:t,onSettingsScreenSelect:n,onLeftColumnContentChange:r,chatFoldersById:c,orderedFolderIds:d,activeChatFolder:l,currentUserId:u,isForumPanelOpen:g,lastSyncTime:p,shouldSkipHistoryAnimations:f,maxFolders:I,shouldHideFolderTabs:v,folderInvitesById:w,maxFolderInvites:b,hasArchivedChats:Z,archiveSettings:P}=e;const{loadChatFolders:y,setActiveChatFolder:C,openChat:S,openShareChatFolderModal:E,openDeleteChatFolderModal:M,openEditChatFolder:R,openLimitReachedModal:k}=(0,a.Sv)(),T=(0,o.sO)(null),A=(0,Dt.Z)();(0,o.d4)((()=>{p&&y()}),[p,y]);const N=(0,o.Ye)((()=>({id:i.NfV,title:d?.[0]===i.NfV?A("FilterAllChatsShort"):A("FilterAllChats"),includedChatIds:h.D,excludedChatIds:h.D})),[d,A]),x=(0,o.Ye)((()=>d?d.map((e=>e===i.NfV?N:c[e]||{})).filter(Boolean):void 0),[c,N,d]),B=x?.findIndex((e=>e.id===i.NfV)),L=B===l,U=0===l,j=(0,Bt.yi)(),O=(0,o.Ye)((()=>{if(!x||!x.length)return;const e=(0,a.Rd)();return x.map(((t,n)=>{const{id:a,title:s}=t,o=a!==i.NfV&&n>I-1,r=[];return(0,m.yE)(e,a)&&r.push({title:A("ChatList.ContextMenuShare"),icon:"link",handler:()=>{w[a]?.length>=b?k({limit:"chatlistInvites"}):E({folderId:a})}}),a!==i.NfV&&(r.push({title:A("FilterEdit"),icon:"edit",handler:()=>{R({folderId:a})}}),r.push({title:A("FilterDeleteItem"),icon:"delete",destructive:!0,handler:()=>{M({folderId:a})}})),{id:a,title:s,badgeCount:j[a]?.chatsCount,isBadgeActive:Boolean(j[a]?.notificationsCount),isBlocked:o,contextActions:r?.length?r:void 0}}))}),[x,j,A,I,w,b]),F=(0,pt.Z)((e=>{C({activeChatFolder:e},{forceOnHeavyAnimation:!0})}));(0,o.d4)((()=>{O?.length&&l>=O.length&&C({activeChatFolder:0})}),[l,O,C]),(0,o.d4)((()=>{if(s.$b&&O?.length&&!g)return(0,pn.sf)(T.current,{selectorToPreventScroll:".chat-list",onSwipe:(e,t)=>t===pn.eM.Left?(C({activeChatFolder:Math.min(l+1,O.length-1)},{forceOnHeavyAnimation:!0}),!0):t===pn.eM.Right&&(C({activeChatFolder:Math.max(0,l-1)},{forceOnHeavyAnimation:!0}),!0)})}),[l,O,g,C]);const _=(0,o.sO)();_.current=!U,(0,o.d4)((()=>_.current?(0,jt.Z)((()=>{_.current&&C({activeChatFolder:0})})):void 0),[l,C]),(0,fn.Z)({isActive:!U,onBack:()=>C({activeChatFolder:0},{forceOnHeavyAnimation:!0})}),(0,o.d4)((()=>{const e=e=>{if(e.ctrlKey&&e.shiftKey&&e.code.startsWith("Digit")&&O){const[,t]=e.code.match(/Digit(\d)/)||[];if(!t)return;if("0"===t)return void S({id:u,shouldReplaceHistory:!0});const n=Number(t)-1;if(n>O.length-1)return;C({activeChatFolder:n},{forceOnHeavyAnimation:!0}),e.preventDefault()}};return document.addEventListener("keydown",e,!0),()=>{document.removeEventListener("keydown",e,!0)}}),[u,O,S,C]);const{shouldRender:D,transitionClassNames:$}=(0,St.Z)(!d,void 0,!0);function q(e){const a=Object.values(c).find((e=>{let{id:t}=e;return t===O[l].id})),s=a&&!L;return o.ZP.createElement(vn.Z,{folderType:s?"folder":"all",folderId:s?a.id:void 0,isActive:e,isForumPanelOpen:g,lastSyncTime:p,foldersDispatch:t,onSettingsScreenSelect:n,onLeftColumnContentChange:r,canDisplayArchive:Z&&!P.isHidden,archiveSettings:P})}const H=O&&O.length>1;return o.ZP.createElement("div",{className:(0,ut.Z)("ChatFolders",H&&v&&"ChatFolders--tabs-hidden")},H?o.ZP.createElement(In.Z,{contextRootElementSelector:"#LeftColumn",tabs:O,activeTab:l,onSwitchTab:F,areFolders:!0}):D?o.ZP.createElement("div",{className:(0,ut.Z)("tabs-placeholder",$)}):void 0,o.ZP.createElement(_t.Z,{ref:T,name:f?"none":A.isRtl?"slideOptimizedRtl":"slideOptimized",activeKey:l,renderCount:H?O.length:void 0},q))})));var bn=n(34288);const Zn=(0,o.X$)((e=>{const t=(0,At.Z)(gt.gl.Extra,"LeftSearch");return t?o.ZP.createElement(t,e):o.ZP.createElement(bn.Z,null)})),Pn=(0,o.X$)((e=>{const t=(0,At.Z)(gt.gl.Extra,"ContactList");return t?o.ZP.createElement(t,e):o.ZP.createElement(bn.Z,null)}));var yn=n(52328);const Cn=(0,o.X$)((e=>{let{isShown:t,onNewPrivateChat:n,onNewChannel:a,onNewGroup:s}=e;const[i,r]=(0,o.eJ)(!1);(0,o.d4)((()=>{t||r(!1)}),[t]);const c=(0,Dt.Z)(),d=(0,ut.Z)("NewChatButton",t&&"revealed",i&&"menu-is-open"),l=(0,o.I4)((()=>{r(!i)}),[i]),u=(0,o.I4)((()=>{r(!1)}),[]),m=(0,o.Ye)((()=>o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement(Yt.Z,{icon:"channel",onClick:a},c("NewChannel")),o.ZP.createElement(Yt.Z,{icon:"group",onClick:s},c("NewGroup")),o.ZP.createElement(Yt.Z,{icon:"user",onClick:n},c("NewMessageTitle")))),[c,a,s,n]);return o.ZP.createElement("div",{className:d,dir:c.isRtl?"rtl":void 0},o.ZP.createElement(Jt.Z,{round:!0,color:"primary",className:i?"active":"",onClick:l,ariaLabel:c(i?"Close":"NewMessageTitle"),tabIndex:-1},o.ZP.createElement("i",{className:"icon icon-new-chat-filled"}),o.ZP.createElement("i",{className:"icon icon-close"})),o.ZP.createElement(yn.Z,{isOpen:i,positionX:c.isRtl?"left":"right",positionY:"bottom",autoClose:!0,onClose:u},m))}));var Sn=n(59690);const En=Object.keys(w.du).length/2;let Mn;const Rn=(0,o.X$)((e=>{let{content:t,searchQuery:n,searchDate:r,isClosingSearch:c,contactsFilter:d,shouldSkipTransition:l,foldersDispatch:u,isUpdateAvailable:m,isForumPanelOpen:h,onSearchQuery:g,onContentChange:p,onSettingsScreenSelect:f,onReset:I,onTopicSearch:v}=e;const{closeForumPanel:b}=(0,a.Sv)(),[Z,P]=(0,o.eJ)(s.$b),{shouldRenderForumPanel:y,handleForumPanelAnimationEnd:C,handleForumPanelAnimationStart:S,isAnimationStarted:E}=(0,$t.Z)(h),M=h&&t===w.du.ChatList,R=M&&E,{shouldRender:k,transitionClassNames:T}=(0,St.Z)(m),A=(0,o.sO)(!1),N=(0,pt.Z)((()=>{t===w.du.ChatList&&(A.current=!0,P(!0))})),x=(0,pt.Z)((()=>{A.current=!1,Mn&&(clearTimeout(Mn),Mn=void 0),Mn=window.setTimeout((()=>{A.current||P(!1)}),250)})),B=(0,pt.Z)((()=>{p(w.du.Settings)})),L=(0,pt.Z)((()=>{p(w.du.Contacts)})),U=(0,pt.Z)((()=>{p(w.du.Archived),b()})),j=(0,pt.Z)((()=>{i.D$V?window.electron?.installUpdate():window.location.reload()})),O=(0,pt.Z)((()=>{p(w.du.NewChannelStep1)})),F=(0,pt.Z)((()=>{p(w.du.NewGroupStep1)}));(0,o.d4)((()=>{let e;return t!==w.du.ChatList?e=window.setTimeout((()=>{P(!1)}),250):(A.current||s.$b)&&P(!0),()=>{e&&(clearTimeout(e),e=void 0)}}),[t]);const _=(0,Dt.Z)();return o.ZP.createElement("div",{id:"LeftColumn-main",onMouseEnter:s.$b?void 0:N,onMouseLeave:s.$b?void 0:x},o.ZP.createElement(gn,{shouldHideSearch:R,content:t,contactsFilter:d,onSearchQuery:g,onSelectSettings:B,onSelectContacts:L,onSelectArchived:U,onReset:I,shouldSkipTransition:l,isClosingSearch:c}),o.ZP.createElement(_t.Z,{name:l?"none":"zoomFade",renderCount:En,activeKey:t,shouldCleanup:!0,cleanupExceptionKey:w.du.ChatList,shouldWrap:!0,wrapExceptionKey:w.du.ChatList},(e=>{switch(t){case w.du.ChatList:return o.ZP.createElement(wn,{shouldHideFolderTabs:R,onSettingsScreenSelect:f,onLeftColumnContentChange:p,foldersDispatch:u,isForumPanelOpen:R});case w.du.GlobalSearch:return o.ZP.createElement(Zn,{searchQuery:n,searchDate:r,isActive:e,onReset:I});case w.du.Contacts:return o.ZP.createElement(Pn,{filter:d,isActive:e,onReset:I});default:return}})),k&&o.ZP.createElement(Jt.Z,{fluid:!0,pill:!0,className:(0,ut.Z)("btn-update",T),onClick:j},_("lng_update_telegram")),y&&o.ZP.createElement(Sn.Z,{isOpen:h,isHidden:!M,onTopicSearch:v,onOpenAnimationStart:S,onCloseAnimationEnd:C}),o.ZP.createElement(Cn,{isShown:Z,onNewPrivateChat:L,onNewChannel:O,onNewGroup:F}))})),kn=(0,o.X$)((e=>{const t=(0,At.Z)(gt.gl.Extra,"Settings");return t?o.ZP.createElement(t,e):o.ZP.createElement(bn.Z,null)})),Tn=(0,o.X$)((e=>{const t=(0,At.Z)(gt.gl.Extra,"NewChat");return t?o.ZP.createElement(t,e):o.ZP.createElement(bn.Z,null)})),An=(0,o.X$)((e=>{const t=(0,At.Z)(gt.gl.Extra,"ArchivedChats");return t?o.ZP.createElement(t,e):o.ZP.createElement(bn.Z,null)}));var Nn=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}(Nn||{});const xn=Object.keys(Nn).length/2,Bn=(0,o.X$)((0,a.c$)((e=>{const t=(0,m.jU)(e),{globalSearch:{query:n,date:a},shouldSkipHistoryAnimations:s,activeChatFolder:i,nextSettingsScreen:o,nextFoldersAction:r}=t,{currentUserId:c,passcode:{hasPasscode:d},isUpdateAvailable:l,archiveSettings:u}=e,h=(0,m.jr)(e);return{searchQuery:n,searchDate:a,isFirstChatFolderActive:0===i,shouldSkipHistoryAnimations:s,currentUserId:c,hasPasscode:d,nextSettingsScreen:o,nextFoldersAction:r,isChatOpen:Boolean(h?.id),isUpdateAvailable:l,isForumPanelOpen:(0,m.nd)(e),forumPanelChatId:t.forumPanelChatId,isClosingSearch:t.globalSearch.isClosing,archiveSettings:u}}))((function(e){let{ref:t,searchQuery:n,searchDate:i,isFirstChatFolderActive:r,shouldSkipHistoryAnimations:c,currentUserId:d,hasPasscode:l,nextSettingsScreen:u,nextFoldersAction:m,isChatOpen:h,isUpdateAvailable:g,isForumPanelOpen:p,forumPanelChatId:f,isClosingSearch:I,archiveSettings:v}=e;const{setGlobalSearchQuery:b,setGlobalSearchClosing:Z,setGlobalSearchChatId:P,resetChatCreation:y,setGlobalSearchDate:C,loadPasswordInfo:S,clearTwoFaError:E,openChat:M,requestNextSettingsScreen:R}=(0,a.Sv)(),[k,T]=(0,o.eJ)(w.du.ChatList),[A,N]=(0,o.eJ)(w.MT.Main),[x,B]=(0,o.eJ)(""),[L,U]=(0,Ot.ZP)(),[j,O]=(0,o.eJ)(0);let F=Nn.Main;switch(k){case w.du.Archived:F=Nn.Archived;break;case w.du.Settings:F=Nn.Settings;break;case w.du.NewChannelStep1:case w.du.NewChannelStep2:F=Nn.NewChannel;break;case w.du.NewGroupStep1:case w.du.NewGroupStep2:F=Nn.NewGroup}const _=(0,pt.Z)((e=>{function t(){T(w.du.ChatList),N(w.MT.Main),B(""),Z({isClosing:!0}),y(),setTimeout((()=>{b({query:""}),C({date:void 0}),P({id:void 0}),Z({isClosing:!1}),O(Date.now())}),250)}if(!0!==e)if(k!==w.du.NewGroupStep2)if(k!==w.du.NewChannelStep2){if(k===w.du.NewGroupStep1){const e=document.getElementById("new-group-picker-search");e&&e.blur()}if(k===w.du.Settings)switch(A){case w.MT.EditProfile:case w.MT.Folders:case w.MT.General:case w.MT.Notifications:case w.MT.DataStorage:case w.MT.Privacy:case w.MT.Performance:case w.MT.ActiveSessions:case w.MT.Language:case w.MT.Stickers:case w.MT.Experimental:return void N(w.MT.Main);case w.MT.GeneralChatBackground:return void N(w.MT.General);case w.MT.GeneralChatBackgroundColor:return void N(w.MT.GeneralChatBackground);case w.MT.PrivacyPhoneNumber:case w.MT.PrivacyLastSeen:case w.MT.PrivacyProfilePhoto:case w.MT.PrivacyPhoneCall:case w.MT.PrivacyPhoneP2P:case w.MT.PrivacyForwarding:case w.MT.PrivacyGroupChats:case w.MT.PrivacyVoiceMessages:case w.MT.PrivacyBlockedUsers:case w.MT.ActiveWebsites:case w.MT.TwoFaDisabled:case w.MT.TwoFaEnabled:case w.MT.TwoFaCongratulations:case w.MT.PasscodeDisabled:case w.MT.PasscodeEnabled:case w.MT.PasscodeCongratulations:return void N(w.MT.Privacy);case w.MT.PasscodeNewPasscode:return void N(l?w.MT.PasscodeEnabled:w.MT.PasscodeDisabled);case w.MT.PasscodeChangePasscodeCurrent:case w.MT.PasscodeTurnOff:return void N(w.MT.PasscodeEnabled);case w.MT.PasscodeNewPasscodeConfirm:return void N(w.MT.PasscodeNewPasscode);case w.MT.PasscodeChangePasscodeNew:return void N(w.MT.PasscodeChangePasscodeCurrent);case w.MT.PasscodeChangePasscodeConfirm:return void N(w.MT.PasscodeChangePasscodeNew);case w.MT.PrivacyPhoneNumberAllowedContacts:case w.MT.PrivacyPhoneNumberDeniedContacts:return void N(w.MT.PrivacyPhoneNumber);case w.MT.PrivacyLastSeenAllowedContacts:case w.MT.PrivacyLastSeenDeniedContacts:return void N(w.MT.PrivacyLastSeen);case w.MT.PrivacyProfilePhotoAllowedContacts:case w.MT.PrivacyProfilePhotoDeniedContacts:return void N(w.MT.PrivacyProfilePhoto);case w.MT.PrivacyPhoneCallAllowedContacts:case w.MT.PrivacyPhoneCallDeniedContacts:return void N(w.MT.PrivacyPhoneCall);case w.MT.PrivacyPhoneP2PAllowedContacts:case w.MT.PrivacyPhoneP2PDeniedContacts:return void N(w.MT.PrivacyPhoneP2P);case w.MT.PrivacyForwardingAllowedContacts:case w.MT.PrivacyForwardingDeniedContacts:return void N(w.MT.PrivacyForwarding);case w.MT.PrivacyVoiceMessagesAllowedContacts:case w.MT.PrivacyVoiceMessagesDeniedContacts:return void N(w.MT.PrivacyVoiceMessages);case w.MT.PrivacyGroupChatsAllowedContacts:case w.MT.PrivacyGroupChatsDeniedContacts:return void N(w.MT.PrivacyGroupChats);case w.MT.TwoFaNewPassword:return void N(w.MT.TwoFaDisabled);case w.MT.TwoFaNewPasswordConfirm:return void N(w.MT.TwoFaNewPassword);case w.MT.TwoFaNewPasswordHint:return void N(w.MT.TwoFaNewPasswordConfirm);case w.MT.TwoFaNewPasswordEmail:return void N(w.MT.TwoFaNewPasswordHint);case w.MT.TwoFaNewPasswordEmailCode:return void N(w.MT.TwoFaNewPasswordEmail);case w.MT.TwoFaChangePasswordCurrent:case w.MT.TwoFaTurnOff:case w.MT.TwoFaRecoveryEmailCurrentPassword:return void N(w.MT.TwoFaEnabled);case w.MT.TwoFaChangePasswordNew:return void N(w.MT.TwoFaChangePasswordCurrent);case w.MT.TwoFaChangePasswordConfirm:return void N(w.MT.TwoFaChangePasswordNew);case w.MT.TwoFaChangePasswordHint:return void N(w.MT.TwoFaChangePasswordConfirm);case w.MT.TwoFaRecoveryEmail:return void N(w.MT.TwoFaRecoveryEmailCurrentPassword);case w.MT.TwoFaRecoveryEmailCode:return void N(w.MT.TwoFaRecoveryEmail);case w.MT.FoldersCreateFolder:case w.MT.FoldersEditFolder:return void N(w.MT.Folders);case w.MT.FoldersShare:return void N(w.MT.FoldersEditFolder);case w.MT.FoldersIncludedChatsFromChatList:case w.MT.FoldersExcludedChatsFromChatList:return void N(w.MT.FoldersEditFolderFromChatList);case w.MT.FoldersEditFolderFromChatList:case w.MT.FoldersEditFolderInvites:return T(w.du.ChatList),void N(w.MT.Main);case w.MT.QuickReaction:case w.MT.CustomEmoji:return void N(w.MT.Stickers);case w.MT.DoNotTranslate:return void N(w.MT.Language)}k===w.du.ChatList&&r?T(w.du.GlobalSearch):t()}else T(w.du.NewChannelStep1);else T(w.du.NewGroupStep1);else t()})),D=(0,pt.Z)((e=>{k!==w.du.Contacts?(T(w.du.GlobalSearch),e!==n&&b({query:e})):B(e)})),$=(0,pt.Z)((()=>{T(w.du.GlobalSearch),b({query:""}),P({id:f})}));(0,o.d4)((()=>k!==w.du.ChatList||r&&!h&&!p?(0,jt.Z)((()=>_())):void 0),[r,k,_,h,p]);const q=(0,pt.Z)((e=>{k!==w.du.GlobalSearch&&(e.preventDefault(),T(w.du.GlobalSearch))})),H=(0,pt.Z)((e=>{e.preventDefault(),M({id:d,shouldReplaceHistory:!0})})),G=(0,pt.Z)((e=>{e.preventDefault(),T(w.du.Archived)})),V=(0,pt.Z)((e=>{e.preventDefault(),T(w.du.Settings)}));(0,Ft.y)({"Mod+Shift+F":q,"Mod+Shift+S":H,...s.RM&&{"Mod+0":H,"Mod+9":G},...s.jm&&s.RM&&{"Mod+,":V}}),(0,o.d4)((()=>{E(),A===w.MT.Privacy&&S()}),[E,S,A]),(0,wt.Z)((()=>{void 0!==u&&(T(w.du.Settings),N(u),R({screen:void 0})),m&&U(m)}),[U,m,u,R]);const W=(0,pt.Z)((e=>{T(w.du.Settings),N(e)}));function z(e){switch(F){case Nn.Archived:return o.ZP.createElement(An,{isActive:e,onReset:_,onTopicSearch:$,foldersDispatch:U,onSettingsScreenSelect:W,onLeftColumnContentChange:T,isForumPanelOpen:p,archiveSettings:v});case Nn.Settings:return o.ZP.createElement(kn,{isActive:e,currentScreen:A,foldersState:L,foldersDispatch:U,onScreenSelect:W,onReset:_,shouldSkipTransition:c});case Nn.NewChannel:return o.ZP.createElement(Tn,{key:j,isActive:e,isChannel:!0,content:k,onContentChange:T,onReset:_});case Nn.NewGroup:return o.ZP.createElement(Tn,{key:j,isActive:e,content:k,onContentChange:T,onReset:_});default:return o.ZP.createElement(Rn,{content:k,isClosingSearch:I,searchQuery:n,searchDate:i,contactsFilter:x,foldersDispatch:U,onContentChange:T,onSearchQuery:D,onSettingsScreenSelect:W,onReset:_,shouldSkipTransition:c,isUpdateAvailable:g,isForumPanelOpen:p,onTopicSearch:$})}}return o.ZP.createElement(_t.Z,{ref:t,name:c?"none":s.s0,renderCount:xn,activeKey:F,shouldCleanup:!0,cleanupExceptionKey:Nn.Main,shouldWrap:!0,wrapExceptionKey:Nn.Main,id:"LeftColumn"},z)})));var Ln=n(12420),Un=n(49524),jn=n(71394);var On=n(12255),Fn=n(52678),_n=n(87204),Dn=n(28712),$n=n(3570),qn=n(33799),Hn=n(39415),Gn=n(75790),Vn=n(18360),Wn=n(86203),zn=n(6058),Xn=n(98799),Yn=n(59188),Jn=n(32340),Kn=n(2903),Qn=n(17891),ea=n(68512),ta=n(17551);const na={"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 aa(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 sa=(0,o.X$)((e=>{let{count:t,index:n}=e;const a=(0,o.sO)(null),s=(0,o.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),i=function(e,t){return e<=3?36:t*e+2*(e-1)}(e,a),o=`clipPath${e}`,r=function(e,t,n){let a="";if(3===n)a=aa(0,0,2,t,1)+aa(0,12,2,t+1,1)+aa(0,25,2,t,1);else for(let e=0;e<n;e++)a+=aa(0,(t+2)*e,2,t,1);return`<clipPath id="${e}">\n <path d="${a}" />\n </clipPath>`}(o,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,i);return{markHeight:s,clipPath:r,markTranslateY:c,trackTranslateY:d,trackHeight:i,clipPathId:o}}(t,n)),[t,n]);if((0,o.bt)((()=>{if(!a.current)return;const{trackHeight:e,trackTranslateY:t,markHeight:n,markTranslateY:i,clipPathId:o,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("#${o}")`;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(${i}px)`)}}),[s]),1===t)return o.ZP.createElement("div",{className:na.pinnedMessageBorder},o.ZP.createElement("div",{className:na.pinnedMessageBorderWrapper1,ref:a}));const{trackHeight:i,trackTranslateY:r,markHeight:c,markTranslateY:d,clipPathId:l}=s;return o.ZP.createElement("div",{className:(0,ut.Z)(na.pinnedMessageBorder,t>4&&na.pinnedMessageBorderMask)},o.ZP.createElement("div",{className:na.pinnedMessageBorderWrapper,ref:a,style:`clip-path: url("#${l}"); width: 2px;\n height: ${i}px; transform: translateY(-${r}px);`},o.ZP.createElement("span",null),o.ZP.createElement("div",{className:na.pinnedMessageBorderMark,style:`--height: ${c}px; --translate-y: ${d}px; --translate-track: ${r}px;`})))}));var ia=n(45370),oa=n(62230),ra=n(34076);const ca="DusHAy2Lx0SlaPpVAb_o",da="jSVbc8Hb7PjitJujB_dQ",la=(0,o.X$)((e=>{let{message:t,count:n,index:i,customTitle:r,className:c,onUnpinMessage:d,onClick:l,onAllPinnedClick:u,isLoading:m,isFullWidth:h}=e;const{clickBotInlineButton:p}=(0,a.Sv)(),f=(0,Dt.Z)(),I=(0,Kn.Z)(t),v=(0,rn.Z)((0,g.Ti)(t,"pictogram")),w=(0,g.NE)(t),b=(0,Qn.Z)([m],450)&&m,[Z,P,y]=(0,Tt.Z)(),C=(0,pt.Z)((()=>{y(),d&&d(t.id)})),S=(0,g.eH)(t),E=(0,pt.Z)((()=>{S&&p({messageId:t.id,button:S})})),[M,R,k]=(0,Tt.Z)(),{handleClick:T,handleMouseDown:A}=(0,Hn.m)(l);return o.ZP.createElement("div",{className:(0,ut.Z)("HeaderPinnedMessageWrapper","TMOjo7XfD1ZiiuRtfpkm",h&&"full-width",c)},(n>1||b)&&o.ZP.createElement(Jt.Z,{round:!0,size:"smaller",color:"translucent",ariaLabel:f("EventLogFilterPinnedMessages"),onClick:b?void 0:u},m&&o.ZP.createElement(nn.Z,{color:"blue",className:(0,ut.Z)("d7XDT4Keip1KHh7mcCv9",ca,!b&&da)}),o.ZP.createElement("i",{className:(0,ut.Z)("icon","icon-pin-list",ca,b&&da)})),d&&o.ZP.createElement(Jt.Z,{round:!0,size:"smaller",color:"translucent",ariaLabel:f("UnpinMessageAlertTitle"),onClick:P},o.ZP.createElement("i",{className:"icon icon-close"})),o.ZP.createElement(ta.Z,{isOpen:Z,onClose:y,text:"Would you like to unpin this message?",confirmLabel:"Unpin",confirmHandler:C}),o.ZP.createElement("div",{className:(0,ut.Z)("uhn_g6FmUELuGJrCm45w",M&&"jeTsUEkDCkzGUVwy6lrL"),onClick:T,onMouseDown:A,dir:f.isRtl?"rtl":void 0},o.ZP.createElement(sa,{count:n,index:i}),o.ZP.createElement(_t.Z,{activeKey:t.id,name:"slideVertical",className:"EK6juGhJwhsLLm4Aag2F"},function(e,t,n){const{width:a,height:s}=(0,Ue.W7)(),i=t||e;return o.ZP.createElement("div",{className:"RFnmHP92f6CwfuR2Upaw"},e&&!n&&o.ZP.createElement("img",{className:"JfPOYkOcaMjS7Y5rsHZ4",src:i,width:a,height:s,alt:""}),e&&o.ZP.createElement(oa.Z,{thumbDataUri:i,isVisible:Boolean(n),width:a,height:s}))}(I,v,w)),o.ZP.createElement("div",{className:(0,ut.Z)("bSvmca5kaTIUh3yJBxnF",I&&"FBCNFm307_rxATSHPSiN")},o.ZP.createElement("div",{className:"q9_FnsHlndM1hZqZjxjM",dir:"auto"},!r&&o.ZP.createElement(ra.Z,{text:`${f("PinnedMessage")} ${i>0?"#"+(n-i):""}`}),r&&(0,Jn.Z)(r)),o.ZP.createElement(_t.Z,{activeKey:t.id,name:"slideVerticalFade",className:"ugsKEK4Xb166oFMP8hHy"},o.ZP.createElement("p",{dir:"auto",className:"WRuyhyQK6mv28Mz8iK28"},o.ZP.createElement(ia.Z,{lang:f,message:t,noEmoji:Boolean(I)})))),o.ZP.createElement(ea.Z,null),S&&o.ZP.createElement(Jt.Z,{size:"tiny",className:"kXRuktM2s7UN91zOl0Tx",onClick:E,shouldStopPropagation:!0,onMouseEnter:s.$b?void 0:R,onMouseLeave:s.$b?void 0:k},S.text)))}));var ua=n(10396),ma=n(64532),ha=n(23186),ga=n(75851);const pa=240;function fa(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((i=>{s.onload=()=>{Ia(s,s.width*t,s.height*t,n).then((e=>{if(!e)throw new Error("Image resize failed!");return URL.createObjectURL(e)})).then(i).finally((()=>{e instanceof Blob&&URL.revokeObjectURL(a)}))},s.src=a}))}async function Ia(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"image/png";if(!("createImageBitmap"in window))return va(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 i=await(0,ga.ix)(e.src),o=(0,ga.rZ)(i)<pa?"#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=o,n.fillRect(0,0,t.width,t.height);const i=t.getContext("bitmaprenderer");i?i.transferFromImageBitmap(s):n.drawImage(s,0,0),t.toBlob(e,a)}))}catch(s){return va(e,t,n,void 0,a)}}async function va(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 i=document.createElement("canvas"),o=i.getContext("2d"),r=document.createElement("canvas"),c=r.getContext("2d");if(i.width=t,i.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);o.drawImage(r,0,0,s.width,s.height,0,0,i.width,i.height)}else o.drawImage(e,0,0,i.width,i.height);const d=await(0,ga.ix)(e.src),l=(0,ga.rZ)(d)<pa?"#fff":"#000";return o.fillStyle=l,o.globalCompositeOperation="destination-over",o.fillRect(0,0,i.width,i.height),new Promise((e=>{i.toBlob(e,s)}))}var wa=n(77510);const ba=n.p+"telegram-logo-filled.67469f6dc5e301e8e0bd.svg",Za={width:200,height:200},Pa=115;var ya=n(17240),Ca=n(18051);const Sa={.5:.66,.75:.8,1:1,1.5:1.4,2:1.8},Ea=Object.keys(Sa).sort().map(Number),Ma=(0,a.c$)(((e,t)=>{let{message:n}=t;const a=(0,m.Ur)(e,n),s=(0,m.Z1)(e,n.chatId),{volume:i,playbackRate:o,isMuted:r,isPlaybackRateActive:c}=(0,m.jU)(e).audioPlayer;return{sender:a,chat:s,volume:i,playbackRate:o,isPlaybackRateActive:c,isMuted:r}}))((e=>{let{message:t,className:n,noUi:r,sender:c,chat:d,volume:l,playbackRate:u,isPlaybackRateActive:m,isMuted:h}=e;const{setAudioPlayerVolume:p,setAudioPlayerPlaybackRate:f,setAudioPlayerMuted:I,focusMessage:v,closeAudioPlayer:w}=(0,a.Sv)(),b=(0,o.sO)(null),Z=(0,Dt.Z)(),{isMobile:P}=(0,M.ZP)(),{audio:y,voice:C,video:S}=(0,g.qp)(t),E=Boolean(C||S),R=E||(y?.duration||0)>i.J0S,k=c?(0,g.OU)(Z,c):void 0,T=ze.UV((0,g.Ti)(t,"inline")),A=((e,t,n)=>{const a=(0,Dt.Z)(),{audio:s,voice:i}=(0,g.qp)(e),r=s?s.title||s.fileName:i?"Voice message":"",c=s?.performer||t&&(0,g.OU)(a,t),d=n&&(0,g.U)(a,n)||"Telegram",l=s&&(0,g.MR)(s)&&(0,g.Ti)(e,"pictogram"),u=t&&(0,g.RT)(t,"big"),m=s&&l||i&&u,h=(0,rn.Z)(m),p=(0,o.Ye)((()=>function(e,t,n){if(!n)return Za;if(e){if(!e.thumbnailSizes?.length)return;const t=e.thumbnailSizes.find((e=>"m"===e.type));return t||e.thumbnailSizes[0]}return t?Ue.vY:void 0}(s,i,h)),[s,h,i]),{result:f}=(0,wa.Z)((()=>function(e,t){if(!e)return Promise.resolve(ba);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,i=new Image;return new Promise((o=>{i.onload=()=>{Ia(i,t,n,a).then((e=>{if(!e)throw new Error("Image resize failed!");return URL.createObjectURL(e)})).then(o).finally((()=>{e instanceof Blob&&URL.revokeObjectURL(s)}))},i.src=s}))}(e,Pa,Pa);const n=Math.min(t.width,t.height);return n<Pa?fa(e,Pa/n):Promise.resolve(e)}(h,p)),[h,p],ba);return(0,o.Ye)((()=>(0,ma.Of)({title:r,artist:c,album:d,artwork:[{src:f}]})),[d,c,r,f])})(t,c,d),{playPause:N,stop:x,isPlaying:B,requestNextTrack:L,requestPreviousTrack:U,isFirst:j,isLast:O,setVolume:F,toggleMuted:_,setPlaybackRate:D}=(0,ha.Z)((0,ua.An)(t),(0,g.XV)(t),E?"voice":"audio",T,void 0,A,void 0,!0,void 0,void 0,(0,g.CI)(t),!0),{isContextMenuOpen:$,handleBeforeContextMenu:q,handleContextMenu:H,handleContextMenuClose:G,handleContextMenuHide:V}=(0,ya.Z)(b),W=(0,pt.Z)((()=>{v({chatId:t.chatId,messageId:t.id})})),z=(0,pt.Z)((()=>{B&&N(),w(),(0,ma.Ay)(),x()})),X=(0,pt.Z)((e=>{p({volume:e/100}),F(e/100)})),Y=(0,pt.Z)((()=>{s.$b&&!s.cj||(_(),I({isMuted:!h}))})),J=(0,pt.Z)((function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const n=Sa[e],a=1!==e&&t;f({playbackRate:n,isPlaybackRateActive:a}),D(a?n:1)})),K=(0,pt.Z)((()=>{G();const e=Number(Object.entries(Sa).find((e=>{let[,t]=e;return t===u}))?.[0])||1,t=!m;J(t&&1===e?2:e,t)})),Q=(0,pt.Z)((()=>{const e=Object.entries(Sa).find((e=>{let[,t]=e;return t===u}))?.[0]||1,t=`${1===u?2:e}Х`;return o.ZP.createElement("div",{className:"playback-wrapper"},$&&o.ZP.createElement("div",{className:"playback-backdrop",onClick:G}),o.ZP.createElement(Jt.Z,{round:!0,className:(0,ut.Z)("playback-button",m&&"applied",$&&"on-top"),color:"translucent",size:"smaller",ariaLabel:"Playback Rate",ripple:!P,onMouseEnter:H,onClick:K,onMouseDown:q,onContextMenu:H},o.ZP.createElement("span",{className:(0,ut.Z)("playback-button-inner",4===t.length&&"small",5===t.length&&"tiny")},t)))})),ee=(0,o.Ye)((()=>0===l||h?"icon-muted":l<.3?"icon-volume-1":l<.6?"icon-volume-2":"icon-volume-3"),[l,h]);if(!r)return o.ZP.createElement("div",{className:(0,ut.Z)("AudioPlayer",n),dir:Z.isRtl?"rtl":void 0,ref:b},o.ZP.createElement("div",{className:"AudioPlayer-content",onClick:W},y?function(e){const{title:t,performer:n,fileName:a}=e;return o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("div",{className:"title",dir:"auto"},(0,Jn.Z)(t||a)),n&&o.ZP.createElement("div",{className:"subtitle",dir:"auto"},(0,Jn.Z)(n)))}(y):function(e,t){return o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("div",{className:"title",dir:"auto"},t&&(0,Jn.Z)(t)),o.ZP.createElement("div",{className:"subtitle",dir:"auto"},e))}(Z("AttachAudio"),k),o.ZP.createElement(ea.Z,null)),o.ZP.createElement(Jt.Z,{round:!0,ripple:!P,color:"translucent",size:"smaller",className:"player-button",disabled:j(),onClick:U,ariaLabel:"Previous track"},o.ZP.createElement("i",{className:"icon icon-skip-previous"})),o.ZP.createElement(Jt.Z,{round:!0,ripple:!P,color:"translucent",size:"smaller",className:(0,ut.Z)("toggle-play","player-button",B?"pause":"play"),onClick:N,ariaLabel:B?"Pause audio":"Play audio"},o.ZP.createElement("i",{className:"icon icon-play"}),o.ZP.createElement("i",{className:"icon icon-pause"})),o.ZP.createElement(Jt.Z,{round:!0,ripple:!P,color:"translucent",size:"smaller",className:"player-button",disabled:O(),onClick:L,ariaLabel:"Next track"},o.ZP.createElement("i",{className:"icon icon-skip-next"})),o.ZP.createElement("div",{className:"volume-button-wrapper"},o.ZP.createElement(Jt.Z,{round:!0,className:"player-button volume-button",color:"translucent",size:"smaller",ariaLabel:"Volume",onClick:Y,ripple:!P},o.ZP.createElement("i",{className:(0,ut.Z)("icon",ee)})),!s.cj&&o.ZP.createElement("div",{className:"volume-slider-wrapper"},o.ZP.createElement("div",{className:"volume-slider-spacer"}),o.ZP.createElement("div",{className:"volume-slider"},o.ZP.createElement(Ca.Z,{bold:!0,value:h?0:100*l,onChange:X})))),R&&o.ZP.createElement(Xt.Z,{forceOpen:$,positionX:"right",positionY:"top",className:"playback-rate-menu",trigger:Q,onClose:G,onHide:V,onMouseEnterBackdrop:G},Ea.map((e=>function(e,t,n,a){const s=t===Sa[e]&&a||1===e&&!a;return o.ZP.createElement(Yt.Z,{key:e,onClick:()=>n(e),icon:s?"check":void 0,customIcon:s?void 0:o.ZP.createElement("i",{className:"icon icon-placeholder"})},e,"X")}(e,u,J,m)))),o.ZP.createElement(Jt.Z,{round:!0,className:"player-close",color:"translucent",size:"smaller",onClick:z,ariaLabel:"Close player"},o.ZP.createElement("i",{className:"icon icon-close"})))}));var Ra=n(4794),ka=n(14605);const Ta=(0,o.X$)((0,a.c$)(((e,t)=>{let{chatId:n}=t;return{currentUserId:e.currentUserId,chat:(0,m.Z1)(e,n),user:(0,g.YC)(n)?(0,m.dy)(e,n):void 0}}))((e=>{let{chatId:t,className:n,chat:s,user:i,settings:r,currentUserId:c}=e;const{openAddContactDialog:d,blockContact:l,reportSpam:u,deleteChat:m,leaveChannel:h,deleteChatUser:p,deleteHistory:f,toggleChatArchived:I,hideChatReportPanel:v}=(0,a.Sv)(),w=(0,Dt.Z)(),[b,Z,P]=(0,Tt.Z)(),[y,C]=(0,o.eJ)(!0),[S,E]=(0,o.eJ)(!0),{accessHash:M}=s||{},{isAutoArchived:R,canReportSpam:k,canAddContact:T,canBlockContact:A}=r||{},N=s&&(0,g.G9)(s),x=(0,pt.Z)((()=>{d({userId:t}),R&&I({id:t})})),B=(0,pt.Z)((()=>{P(),l({contactId:t,accessHash:M}),k&&y&&u({chatId:t}),S&&m({chatId:t})})),L=(0,pt.Z)((()=>{v({chatId:t})})),U=(0,pt.Z)((()=>{P(),u({chatId:t}),N?(p({chatId:t,userId:c}),f({chatId:t,shouldDeleteForAll:!1})):h({chatId:t})}));if(r&&(s||i))return o.ZP.createElement("div",{className:(0,ut.Z)("ChatReportPanel",n),dir:w.isRtl?"rtl":void 0},T&&o.ZP.createElement(Jt.Z,{isText:!0,fluid:!0,size:"tiny",className:"UserReportPanel--Button",onClick:x},w("lng_new_contact_add")),A&&o.ZP.createElement(Jt.Z,{color:"danger",isText:!0,fluid:!0,size:"tiny",className:"UserReportPanel--Button",onClick:Z},w("lng_new_contact_block")),k&&!A&&o.ZP.createElement(Jt.Z,{color:"danger",isText:!0,fluid:!0,size:"tiny",className:"UserReportPanel--Button",onClick:Z},w("lng_report_spam_and_leave")),o.ZP.createElement(Jt.Z,{round:!0,ripple:!0,size:"tiny",color:"translucent",onClick:L,ariaLabel:w("Close")},o.ZP.createElement("i",{className:"icon icon-close"})),o.ZP.createElement(ta.Z,{isOpen:b,onClose:P,title:w("BlockUserTitle",i?(0,g.Vl)(i):(0,g.U)(w,s)),text:i?w("UserInfo.BlockConfirmationTitle",(0,g.Js)(i)):w("Chat.Confirm.ReportSpam.Channel"),confirmIsDestructive:!0,confirmLabel:w("Block"),confirmHandler:i?B:U},i&&o.ZP.createElement(ka.Z,{label:w("DeleteThisChat"),checked:S,onCheck:E}),i&&k&&o.ZP.createElement(ka.Z,{label:w("ReportChat"),checked:y,onCheck:C})))}))),Aa=(0,o.X$)((0,a.c$)(((e,t)=>{let{chatId:n,threadId:a,messageListType:s,isMobile:i}=t;const{isLeftColumnShown:o,shouldSkipHistoryAnimations:r,audioPlayer:c,messageLists:d}=(0,m.jU)(e),{lastSyncTime:u}=e,h=(0,m.Z1)(e,n),{chatId:p,messageId:f}=c,I=p&&f?(0,m.hj)(e,p,f):void 0;let v;"pinned"===s?v=(0,m.KB)(e,n,a)?.length:"scheduled"===s?v=(0,m.qy)(e,n,a)?.length:"thread"===s&&a!==l._f&&(v=(0,m.tZ)(e,n,a)?.messagesCount||0);const w="thread"===s&&a===l._f,b=h&&(0,m.xo)(e,h),Z=Boolean(b&&(0,m.s4)(e,n)),P=b&&!Z&&Boolean((0,m.pk)(e,n)),y=Boolean(h&&(w||h.isForum)&&((0,g.eA)(h)||(0,g.ZV)(h))&&h.isNotJoined),C=Boolean(h?.isNotJoined&&h.isJoinRequest),S={typingStatus:(0,m.WP)(e,n,a,"typingStatus"),isLeftColumnShown:o,isRightColumnShown:(0,m.Jf)(e,i),isSelectModeActive:(0,m.CA)(e),audioMessage:I,chat:h,messagesCount:v,isChatWithSelf:(0,m.FM)(e,n),lastSyncTime:u,shouldSkipHistoryAnimations:r,currentTransitionKey:Math.max(0,d.length-1),connectionState:e.connectionState,isSyncing:e.isSyncing,hasButtonInHeader:P||Z||y||C},E=(0,m.Zw)(e,n);if("thread"!==s||!E)return S;if(a!==l._f&&!h?.isForum){const t=(0,m.qS)(e,n,a),s=t?(0,m.hj)(e,n,t):void 0,i=s?(0,m.cv)(e,s):void 0,o=(0,m.tZ)(e,n,a);return{...S,pinnedMessageIds:t,messagesById:E,canUnpin:!1,topMessageSender:i,isComments:Boolean(o?.originChannelId)}}const M=(0,m.KB)(e,n,a);if(M?.length){const t=E[M[0]],{canUnpin:n}=t&&(0,m._k)(e,t,a)||{};return{...S,pinnedMessageIds:M,messagesById:E,canUnpin:n}}return S}))((e=>{let{chatId:t,threadId:n,messageListType:s,isReady:r,isMobile:d,pinnedMessageIds:u,messagesById:m,canUnpin:h,topMessageSender:p,typingStatus:f,isSelectModeActive:I,isLeftColumnShown:v,isRightColumnShown:w,audioMessage:b,chat:Z,messagesCount:P,isComments:y,isChatWithSelf:C,lastSyncTime:S,hasButtonInHeader:E,shouldSkipHistoryAnimations:R,currentTransitionKey:k,connectionState:T,isSyncing:A,getCurrentPinnedIndexes:N,getLoadingPinnedId:x,onFocusPinnedMessage:B}=e;const{openChatWithInfo:L,pinMessage:U,focusMessage:j,openChat:O,openPreviousChat:F,loadPinnedMessages:_,toggleLeftColumn:D,exitMessageSelectMode:$}=(0,a.Sv)(),q=(0,Dt.Z)(),H=(0,o.sO)(!0),{isTablet:G}=(0,M.ZP)(),V=(0,Wn.Z)(N)[`${t}_${n}`]||0,W=(0,Wn.Z)(x),z=Array.isArray(u)?u[V]:u,X=m&&z?m[z]:void 0,Y=Array.isArray(u)?u.length:u?1:void 0,J=Z&&(0,g.U)(q,Z).length,K=p?(0,g.OU)(q,p):void 0,{settings:Q}=Z||{},ee=Z?.isForum;(0,o.d4)((()=>{S&&r&&(n===l._f||ee)&&_({chatId:t,threadId:n})}),[t,_,S,n,r,ee]),(0,Gn.Z)(t,z,X);const{width:te}=(0,On.Z)(),ne=te<=i.ksF,ae=G&&v,se=(0,o.sO)(null),ie=(0,o.sO)(!0),{handleClick:oe,handleMouseDown:re}=(0,Hn.m)((()=>{L({id:t,threadId:n})})),ce=(0,pt.Z)((e=>{U({messageId:e,isUnpin:!0})})),de=(0,pt.Z)((e=>{const a=e.shiftKey&&Array.isArray(u)?u[(0,$n.Z)(u.length,u.indexOf(z)-2)]:z;B(a)&&j({chatId:t,threadId:n,messageId:a,noForumTopicPanel:!0})})),le=(0,pt.Z)((()=>{O({id:t,threadId:n,type:"pinned"})})),ue=(0,pt.Z)((()=>{setTimeout((()=>{H.current=!0}),450)})),me=(0,pt.Z)((e=>{if(H.current){if(H.current=!1,d&&document.querySelector(i.Edp)?.blur(),I)return $(),void ue();if("thread"===s&&0===k)return!G||ae?(e.stopPropagation(),O({id:void 0},{forceOnHeavyAnimation:!0})):D(),void ue();F(),ue()}})),he=te>=i.ksF&&te<i.jT7||te>i.l35&&te<i.ksF&&(!J||J>30),ge=he||te>i._mX&&te<i.QU1,pe=Boolean(Q?.canAddContact||Q?.canBlockContact||Q?.canReportSpam),{shouldRender:fe,transitionClassNames:Ie}=(0,St.Z)(pe),ve=(0,Vn.Z)(pe?Q:void 0,!0),{shouldRender:we,transitionClassNames:be}=(0,St.Z)(Boolean(b)),Ze=(0,Vn.Z)(b,!0),{shouldRender:Pe,transitionClassNames:ye}=(0,St.Z)(Boolean(X),void 0,!0),Ce=(0,Vn.Z)(X,!0),Se=(0,Vn.Z)(Y,!0),Ee=(0,Vn.Z)(h,!0),Me=(0,Vn.Z)(K),Re=(0,_n.Z)(k),ke=void 0!==Re&&Re<k?Re:void 0,Te=Pe&&Ce||we&&Ze;(0,o.bt)((()=>{const e=se.current;if(e)return ge&&Te?void(w||he?(ie.current&&(e.classList.add("tools-stacked","animated"),ie.current=!1),setTimeout((()=>{(0,c.WM)((()=>{e.classList.remove("animated")}))}),350)):(e.classList.remove("tools-stacked"),ie.current=!0)):(e.classList.remove("tools-stacked","animated"),void(ie.current=!0))}),[ge,Te,he,w]);const{connectionStatusText:Ae}=Gt(q,T,A,!0);function Ne(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return o.ZP.createElement("div",{className:"back-button"},o.ZP.createElement(Jt.Z,{round:!0,size:"smaller",color:"translucent",onClick:me,ariaLabel:q(e?"Close":"Back")},o.ZP.createElement("div",{className:(0,ut.Z)("animated-close-icon",!e&&"state-back")})),t&&o.ZP.createElement(Ut,null))}const xe=Boolean(we&&Ze),Be=xe||!d&&E&&te<i.sgm;return(0,zt.Z)(se),o.ZP.createElement("div",{className:"MiddleHeader",ref:se},o.ZP.createElement(_t.Z,{name:R?"none":"slideFade",activeKey:k,shouldCleanup:!0,cleanupExceptionKey:ke},"thread"!==s||n!==l._f&&!Z?.isForum?o.ZP.createElement(o.ZP.Fragment,null,Ne(),o.ZP.createElement("h3",null,void 0!==P?"thread"===s?q(y?"CommentsCount":"Replies",P,"i"):"pinned"===s?q("PinnedMessagesCount",P,"i"):"scheduled"===s?C?q("Reminders"):q("messages",P,"i"):void 0:q("Loading"))):o.ZP.createElement(o.ZP.Fragment,null,(ne||k>0)&&Ne(ae,!0),o.ZP.createElement("div",{className:"chat-info-wrapper",onClick:oe,onMouseDown:re},(0,g.YC)(t)?o.ZP.createElement(zn.Z,{key:t,userId:t,typingStatus:f,status:Ae,withDots:Boolean(Ae),withFullInfo:!0,withMediaViewer:!0,withUpdatingStatus:!0,emojiStatusSize:22,noRtl:!0}):o.ZP.createElement(Xn.Z,{key:t,chatId:t,threadId:n,typingStatus:f,status:Ae,withDots:Boolean(Ae),withMediaViewer:n===l._f,withFullInfo:n===l._f,withUpdatingStatus:!0,noRtl:!0})))),n===l._f&&!Z?.isForum&&o.ZP.createElement(Ra.Z,{hasPinnedOffset:Pe&&Boolean(Ce)||we&&Boolean(Ze),chatId:t}),Pe&&Ce&&o.ZP.createElement(la,{key:t,message:Ce,count:Se||0,index:V,customTitle:Me,className:ye,onUnpinMessage:Ee?ce:void 0,onClick:de,onAllPinnedClick:le,isLoading:void 0!==W,isFullWidth:Be}),fe&&o.ZP.createElement(Ta,{key:t,chatId:t,settings:ve,className:Ie}),o.ZP.createElement("div",{className:"header-tools"},xe&&o.ZP.createElement(Ma,{key:(0,g.Tp)(Ze),message:Ze,className:be}),o.ZP.createElement(Yn.Z,{chatId:t,threadId:n,messageListType:s,isMobile:d,canExpandActions:!xe})))})));function Na(e){return"albumId"in e}function xa(e,t){let n,a=[],s={originalDate:e[0].date,datetime:(0,he._F)(1e3*e[0].date),senderGroups:[a]};const i=[s];return e.forEach(((o,r)=>{o.isInAlbum?n?(n.messages.push(o),o.content.text&&(n.mainMessage=o)):n={albumId:o.groupedId,messages:[o],mainMessage:o}:a.push(o);const c=e[r+1];if(!n||c&&c.groupedId&&c.groupedId===n.albumId||(a.push(n),n=void 0),c){const e=(0,he._F)(1e3*c.date);s.datetime!==e?(s={originalDate:c.date,datetime:e,senderGroups:[]},i.push(s),a=[],s.senderGroups.push(a)):(c.id===t||o.senderId!==c.senderId||o.isOutgoing!==c.isOutgoing||(0,g.FT)(o)||(0,g.FT)(c)||o.forwardInfo&&c.forwardInfo&&(o.forwardInfo.senderUserId!==c.forwardInfo.senderUserId||o.forwardInfo.fromChatId!==c.forwardInfo.fromChatId||o.forwardInfo.hiddenUserName!==c.forwardInfo.hiddenUserName)||o.inlineButtons||c.inlineButtons||c.date-o.date>600)&&(a=[],s.senderGroups.push(a))}})),i}var Ba=n(30386),La=n(87675),Ua=n(81740),ja=n(70971),Oa=n(88957);var Fa=n(60998);var _a=n(72645),Da=n(78722),$a=n(3657),qa=n(93862),Ha=n(11309);const Ga=s.wZ?1e3:350,Va=20*Ue.Gw,Wa=15*Ue.Gw,za=20*Ue.Gw,Xa=7*Ue.Gw,Ya=5*Ue.Gw;function Ja(e,t){return e?t?za:Wa:t?Va:Xa}function Ka(e,t,n,a){const s=(0,g.B4)(e),i=(0,g.O$)(e)||(0,g.F$)(e),o=(0,g.b7)(e),r=Boolean((0,g.F$)(e)),c=Boolean((0,g.Cg)(e)),{width:d,height:l}=i?(0,Ue.Eh)(i,s,t,r,n,a):(0,Ue.GC)(o,s,t,c,n,a),u=Ja(Boolean((0,g.UD)(e)));let m=1;d<u&&u-d<12&&(m=u/d),l*m<Ya&&Ya-l*m<12&&(m=Ya/l);const h=Math.round(d*m),p=Math.round(l*m);return{width:h,height:p,isSmall:h<u||p<Ya}}function Qa(e,t){return e.reduce(((e,t)=>e+t),t)}function es(e){const t={width:0,height:0};return e.forEach((e=>{let{dimensions:n,sides:a}=e;2&a&&(t.width=n.width+n.x),4&a&&(t.height=n.height+n.y)})),t}function ts(e,t,n,a,s){const i=function(e,t){return e.map((e=>{const n=Ka(e,void 0,void 0,t);return n.width/n.height}))}(a.messages,s),o=function(e){return e.map((e=>e>1.2?"w":e<.8?"n":"q")).join("")}(i),r=function(e){return e.reduce(((e,t)=>t+e),1)/e.length}(i),c=i.length,d=i.some((e=>e>2)),l=(0,Ue.kc)(e,t,!1,n,s)-(t?2.5:0)*Ue.Gw;let u;const m={ratios:i,proportions:o,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:i,maxHeight:o=4*a/3}=e;const r=function(e,t){return e.map((e=>t>1.1?(0,Dn.uZ)(e,1,2.75):(0,Dn.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=Qa(r.slice(e,e+t),0);return(a-(t-1)*i)/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=Qa(t,0)+i*(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-o)*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 o=0;for(let c=0;c!==t;++c){const l=0|(0===e?1:0)|(e===f-1?4:0)|(0===c?8:0)|(c===t-1?2:0),u=r[I],m=c===t-1?a-o:Math.round(u*n);d[I]={dimensions:{x:o,y:v,width:m,height:s},sides:l},o+=m+i,++I}v+=s+i}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,i=Math.round(Math.min(n/t[0],Math.min(n/t[1],(s-a)/2)));return[{dimensions:{x:0,y:0,width:n,height:i},sides:11},{dimensions:{x:0,y:i+a,width:n,height:i},sides:14}]}(e):"ww"===n||"qq"===n?function(e){const{ratios:t,maxWidth:n,spacing:a,maxHeight:s}=e,i=(n-a)/2,o=Math.round(Math.min(i/t[0],Math.min(i/t[1],s)));return[{dimensions:{x:0,y:0,width:i,height:o},sides:13},{dimensions:{x:i+a,y:0,width:i,height:o},sides:7}]}(e):function(e){const{ratios:t,minWidth:n,maxWidth:a,spacing:s,maxHeight:i}=e,o=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-o),c=a-r-s,d=Math.min(i,Math.round(Math.min(c/t[0],r/t[1])));return[{dimensions:{x:0,y:0,width:c,height:d},sides:13},{dimensions:{x:c+s,y:0,width:r,height:d},sides:7}]}(e)}(m):3===c?function(e){const{proportions:t}=e;return"n"===t[0]?function(e){const{maxHeight:t,spacing:n,ratios:a,maxWidth:s,minWidth:i}=e,o=t,r=Math.round(Math.min((t-n)/2,a[1]*(s-n)/(a[2]+a[1]))),c=o-r-n,d=Math.max(i,Math.round(Math.min((s-n)/2,Math.min(r*a[2],c*a[1])))),l=Math.min(Math.round(o*a[0]),s-n-d);return[{dimensions:{x:0,y:0,width:l,height:o},sides:13},{dimensions:{x:l+n,y:0,width:d,height:c},sides:3},{dimensions:{x:l+n,y:c+n,width:d,height:r},sides:6}]}(e):function(e){const{maxWidth:t,ratios:n,maxHeight:a,spacing:s}=e,i=t,o=Math.round(Math.min(i/n[0],.66*(a-s))),r=(t-s)/2,c=Math.min(a-o-s,Math.round(Math.min(r/n[1],r/n[2])));return[{dimensions:{x:0,y:0,width:i,height:o},sides:11},{dimensions:{x:0,y:o+s,width:r,height:c},sides:12},{dimensions:{x:r+s,y:o+s,width:i-r-s,height:c},sides:6}]}(e)}(m):function(e){const{proportions:t}=e;return"w"===t[0]?function(e){let{maxWidth:t,ratios:n,spacing:a,maxHeight:s,minWidth:i}=e;const o=t,r=Math.round(Math.min(o/n[0],.66*(s-a))),c=Math.round((t-2*a)/(n[1]+n[2]+n[3])),d=Math.max(i,Math.round(Math.min(.4*(t-2*a),c*n[1]))),l=Math.round(Math.max(Math.max(i,.33*(t-2*a)),c*n[3])),u=o-d-l-2*a,m=Math.min(s-r-a,c);return[{dimensions:{x:0,y:0,width:o,height:r},sides:11},{dimensions:{x:0,y:r+a,width:d,height:m},sides:12},{dimensions:{x:d+a,y:r+a,width:u,height:m},sides:4},{dimensions:{x:d+a+u+a,y:r+a,width:l,height:m},sides:6}]}(e):function(e){let{maxHeight:t,ratios:n,maxWidth:a,spacing:s,minWidth:i}=e;const o=t,r=Math.round(Math.min(o*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=o-d-l-2*s,m=Math.max(i,Math.min(a-r-s,c));return[{dimensions:{x:0,y:0,width:r,height:o},sides:13},{dimensions:{x:r+s,y:0,width:m,height:d},sides:3},{dimensions:{x:r+s,y:d+s,width:m,height:l},sides:2},{dimensions:{x:r+s,y:d+l+2*s,width:m,height:u},sides:6}]}(e)}(m),{layout:u,containerStyle:es(u)}}var ns=n(55254),as=n(44139);function ss(e,t,n,a,s,i,r,d){const l=(0,o.sO)(!d);(0,o.bt)((()=>{const t=l.current;if(l.current=!1,a&&e.current){const n=e.current.closest(".MessageList"),a=i,o=()=>(0,Ua.ZP)(n,e.current,a?"end":"centerOrTop",20,void 0!==s?a?500:750:void 0,s,void 0,r,!0);t?(0,c.lT)(o):(0,c.i$)((()=>{(0,c.WM)(o())}))}}),[e,n,a,s,i,r])}var is=n(3858),os=n(3927);const rs=3*Ue.Gw,cs=Number(Ue.Gw),ds="data-is-document-group-hover";function ls(e,t,n,i,r,d,l,u,m,h,g,p,f,I){const{setReplyingToId:v,sendDefaultReaction:w}=(0,a.Sv)(),[b,Z,P]=(0,Tt.Z)(),[y,C,S]=(0,Tt.Z)(),E=(0,o.sO)(),M=(0,os.Z)((e=>{const t=p.current;if(!t)return;const{clientX:n,clientY:a}=e,{x:s,width:i,y:o,height:r}=t.getBoundingClientRect(),c=s+i/2,d=o+r/2,l=Math.abs(c-n)<rs,u=Math.abs(d-a)<cs;l&&u?Z():P()}),[p],c.i$);return(0,o.d4)((()=>{if(!s.$b||r||!d||g)return;let e;return(0,pn.sf)(t.current,{selectorToPreventScroll:".MessageList",excludedClosestSelector:".no-word-wrap",onSwipe:(t,n)=>n===pn.eM.Left&&(e||(e=Date.now()),C(),!0),onRelease:()=>{e&&d&&(v({messageId:n}),setTimeout(S,Math.max(0,150-(Date.now()-e))),e=void 0)}})}),[t,r,n,v,C,S,d,g]),{handleMouseDown:r?void 0:function(e){(0,Ba.q)(e),m(e)},handleClick:function(t){if(r)e(t);else if(s.$b)return E.current?(clearInterval(E.current),E.current=void 0,void w({chatId:h,messageId:n})):void(E.current=setTimeout((()=>{E.current=void 0,function(e){if(s.wZ){const t=e.target;if(!t.classList.contains("text-content")&&!t.classList.contains("Message"))return;$e.Z.getIsKeyboardVisible()?setTimeout((()=>{u(e)}),350):u(e)}}(t)}),200))},handleContextMenu:r?l?is.Z:void 0:function(t){if(s.wZ){if(t.target.matches("a[href]")||g)return;t.preventDefault(),e()}else u(t)},handleDoubleClick:r?void 0:function(){!s.$b&&d&&v({messageId:n})},handleContentDoubleClick:s.$b?void 0:function(e){e.stopPropagation()},handleMouseMove:M,handleSendQuickReaction:function(e){e.stopPropagation(),w({chatId:h,messageId:n})},handleMouseLeave:function(e){(0,c.i$)(P),I&&function(e){const t=ms(e.currentTarget);t&&t.removeAttribute(ds)}(e)},isSwiped:y,isQuickReactionVisible:b,handleDocumentGroupMouseEnter:us}}function us(e){const t=ms(e.currentTarget);t&&t.setAttribute(ds,"")}function ms(e){let t=e;do{t=t.nextElementSibling}while(t&&!t.classList.contains("last-in-document-group"));return t}var hs=n(74095);function gs(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,t);if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let ps;const fs=new class{constructor(){gs(this,"promise",void 0),gs(this,"reject",void 0),gs(this,"resolve",void 0),this.promise=new Promise(((e,t)=>{this.reject=t,this.resolve=e}))}};s.SX&&setTimeout((function(){ps||(ps=(0,hs.K)(new Worker(new URL(n.p+n.u(4923),n.b))),fs.resolve())}),4e3);var Is=n(70172),vs=n(18005);const ws=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,At.Z)(gt.gl.Extra,"ContextMenuContainer",!t);return n?o.ZP.createElement(n,e):void 0}));var bs=n(45601),Zs=n(66735);const Ps=(0,o.X$)((e=>{let{message:t,renderContent:n}=e;const{openMediaViewer:s,uploadProfilePhoto:i,showNotification:r}=(0,a.Sv)(),{isOutgoing:c}=t,d=(0,Dt.Z)(),[u,m]=(0,o.eJ)(),[h,p,f]=(0,Tt.Z)(!1),I=(0,rn.Z)((0,g.Ti)(t,"full")),v=t.content.action.photo?.isVideo,b=(0,pt.Z)((()=>{r({title:d("ApplyAvatarHintTitle"),message:d("ApplyAvatarHint"),action:{action:"requestNextSettingsScreen",payload:{screen:w.MT.Main}},actionText:d("Open")})})),Z=(0,pt.Z)((e=>{m(void 0),i({file:e}),b()})),P=(0,pt.Z)((()=>{m(void 0)})),y=(0,pt.Z)((async()=>{f(),b();const e=t.content.action.photo,n=await ze.he(`videoAvatar${e.id}?size=u`,l.IU.BlobUrl),a=await fetch(n).then((e=>e.blob()));i({file:new File([a],"avatar.mp4"),isVideo:!0,videoTs:e.videoSizes?.find((e=>void 0!==e.videoStartTs))?.videoStartTs})}));return o.ZP.createElement("span",{className:"action-message-suggested-avatar",tabIndex:0,role:"button",onClick:async()=>{!c&&I?v?p():m(await fetch(I).then((e=>e.blob()))):s({chatId:t.chatId,mediaId:t.id,threadId:l._f,origin:w.bZ.SuggestedAvatar})}},o.ZP.createElement(Is.Z,{photo:t.content.action.photo,loopIndefinitely:!0,withVideo:v,size:"jumbo"}),o.ZP.createElement("span",null,n()),o.ZP.createElement("span",{className:"action-message-button"},d(v?"ViewVideoAction":"ViewPhotoAction")),o.ZP.createElement(Zs.Z,{file:u,onClose:P,onChange:Z}),o.ZP.createElement(ta.Z,{isOpen:h,title:d("SuggestedVideo"),confirmHandler:y,onClose:f,textParts:n()}))})),ys=(0,o.X$)((0,a.c$)(((e,t)=>{let{message:n,threadId:a}=t;const{chatId:s,senderId:i,replyToMessageId:o,content:r}=n,c=i,{targetUserIds:d,targetChatId:l}=r.action||{},u=o,h=u?(0,m.hj)(e,s,u):void 0,p=!!a&&(0,m._X)(e,n,a),{direction:f,noHighlight:I}=p&&(0,m.jU)(e).focusedMessage||{},v=(0,m.Z1)(e,s),w=v&&((0,g.eA)(v)||c===s),b=!w&&c?(0,m.dy)(e,c):void 0,Z=w?v:void 0,P=e.premiumGifts?.stickers?.[0];return{senderUser:b,senderChat:Z,targetChatId:l,targetUserIds:d,targetMessage:h,isFocused:p,premiumGiftSticker:P,topic:(0,m.p$)(e,n),canPlayAnimatedEmojis:(0,m.W9)(e),...p&&{focusDirection:f,noFocusHighlight:I}}}))((e=>{let{message:t,isEmbedded:n,appearanceOrder:s=0,isJustAdded:i,isLastInList:r,senderUser:c,senderChat:d,targetUserIds:l,targetMessage:u,targetChatId:m,isFocused:h,focusDirection:p,noFocusHighlight:f,premiumGiftSticker:I,isInsideTopic:v,topic:w,memoFirstUnreadIdRef:b,canPlayAnimatedEmojis:Z,observeIntersectionForReading:P,observeIntersectionForLoading:y,observeIntersectionForPlaying:C,onPinnedIntersectionChange:S}=e;const{openPremiumModal:E,requestConfetti:M}=(0,a.Sv)(),R=(0,Dt.Z)(),k=(0,o.sO)(null);(0,$a._N)(k,P),(0,Gn.Z)(t.chatId,t.replyToMessageId,u),ss(k,t.id,t.chatId,h,p,f,i),(0,o.d4)((()=>{if(t.isPinned)return()=>{S?.({viewportPinnedIdsToRemove:[t.id],isUnmount:!0})}}),[S,t.isPinned,t.id]);const T=s<=0,[A,N]=(0,Tt.Z)(T),x=Boolean(t.content.action?.text.startsWith("ActionGift")),B="suggestProfilePhoto"===t.content.action?.type&&t.content.action.photo;(0,o.d4)((()=>{T||setTimeout(N,10*s)}),[s,N,T]);const L=(0,$a.Op)(k,C),U=(0,o.sO)((()=>{const e=b?.current&&t.id>=b.current;return x&&!t.isOutgoing&&e})());(0,o.d4)((()=>{L&&U.current&&(U.current=!1,M())}),[L,M]);const{transitionClassNames:j}=(0,St.Z)(A,void 0,T,!1),O=(0,a.Rd)().users.byId,F=(0,o.Ye)((()=>l?l.map((e=>O?.[e])).filter(Boolean):void 0),[l,O]),_=(0,pt.Z)((()=>(0,vs.D)(R,t,c,d,F,u,m,w,{isEmbedded:n},y,C))),{isContextMenuOpen:D,contextMenuPosition:$,handleBeforeContextMenu:q,handleContextMenu:H,handleContextMenuClose:G,handleContextMenuHide:V}=(0,ya.Z)(k),W=void 0!==$;if(v&&"TopicWasCreatedAction"===t.content.action?.text)return o.ZP.createElement("span",{ref:k});if(n)return o.ZP.createElement("span",{ref:k,className:"embedded-action-message"},_());const z=(0,ut.Z)("ActionMessage message-list-item",h&&!f&&"focused",(x||B)&&"centered-action",W&&"has-menu-open",r&&"last-in-list",!x&&!B&&"in-one-row",j);return o.ZP.createElement("div",{ref:k,id:(0,g.d0)(t.id),className:z,"data-message-id":t.id,"data-is-pinned":t.isPinned||void 0,onMouseDown:e=>{(0,Ba.q)(e),q(e)},onContextMenu:H},!B&&o.ZP.createElement("span",{className:"action-message-content"},_()),x&&o.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})}},o.ZP.createElement(bs.Z,{key:t.id,sticker:I,play:Z,noLoop:!0,nonInteractive:!0}),o.ZP.createElement("strong",null,R("ActionGiftPremiumTitle")),o.ZP.createElement("span",null,R("ActionGiftPremiumSubtitle",R("Months",t.content.action?.months,"i"))),o.ZP.createElement("span",{className:"action-message-button"},R("ActionGiftPremiumView"))),B&&o.ZP.createElement(Ps,{message:t,renderContent:_}),$&&o.ZP.createElement(ws,{isOpen:D,anchor:$,message:t,messageListType:"thread",onClose:G,onCloseAnimationEnd:V}))}))),Cs=e=>{let{className:t,message:n,sender:a,title:s,customText:i,isProtected:r,noUserColors:c,hasContextMenu:d,observeIntersectionForLoading:l,observeIntersectionForPlaying:u,onClick:m}=e;const h=(0,o.sO)(null),p=(0,$a.Op)(h,l),f=(0,rn.Z)(n&&(0,g.Ti)(n,"pictogram"),!p),I=(0,Kn.Z)(n),v=Boolean(n&&(0,g.Y5)(n)),w=Boolean(n&&(0,g.NE)(n)),b=(0,Dt.Z)(),Z=a?(0,g.OU)(b,a):n?.forwardInfo?.hiddenUserName,{handleClick:P,handleMouseDown:y}=(0,Hn.m)(m);return o.ZP.createElement("div",{ref:h,className:(0,ut.Z)("EmbeddedMessage",t,a&&!c&&`color-${(0,g.Rs)(a)}`),onClick:n&&P,onMouseDown:n&&y},I&&function(e,t,n,a,s){const{width:i,height:r}=(0,Ue.W7)(),c=t||e;return o.ZP.createElement("div",{className:(0,ut.Z)("embedded-thumb",n&&"round")},!s&&o.ZP.createElement("img",{src:c,width:i,height:r,alt:"",className:"pictogram",draggable:!1}),o.ZP.createElement(oa.Z,{thumbDataUri:c,isVisible:Boolean(s),width:i,height:r}),a&&o.ZP.createElement("span",{className:"protector"}))}(I,f,v,r,w),o.ZP.createElement("div",{className:"message-text"},o.ZP.createElement("p",{dir:"auto"},n?(0,g.FT)(n)?o.ZP.createElement(ys,{message:n,isEmbedded:!0,observeIntersectionForLoading:l,observeIntersectionForPlaying:u}):o.ZP.createElement(ia.Z,{lang:b,message:n,noEmoji:Boolean(I),observeIntersectionForLoading:l,observeIntersectionForPlaying:u}):i||" "),o.ZP.createElement("div",{className:"message-title",dir:"auto"},(0,Jn.Z)(Z||s||" "))),d&&o.ZP.createElement("i",{className:"embedded-more icon icon-more"}))};var Ss=n(82535),Es=n(54752),Ms=n(8018);const Rs=(0,o.X$)((e=>{let{message:t,outgoingStatus:n,signature:s,withReactionOffset:i,repliesThreadInfo:r,renderQuickReactionButton:c,noReplies:d,isTranslated:l,isPinned:u,onClick:m,onTranslationClick:h,onOpenThread:g}=e;const{showNotification:p}=(0,a.Sv)(),f=(0,Dt.Z)(),[I,v]=(0,Tt.Z)();function w(e){e.stopPropagation(),p({message:f("ImportedInfo")})}const b=(0,o.Ye)((()=>{if(!I)return;const e=(0,he.SA)(1e3*t.date,f.code,void 0,f.timeFormat),n=t.isEdited&&(0,he.SA)(1e3*t.editDate,f.code,void 0,f.timeFormat),a=t.forwardInfo&&(0,he.SA)(1e3*t.forwardInfo.date,f.code,void 0,f.timeFormat);let s=e;return n&&(s+="\n",s+=f("lng_edited_date").replace("{date}",n)),a&&(s+="\n",s+=f("lng_forwarded_date").replace("{date}",a)),s}),[I,f,t,f.timeFormat]),Z=(0,ut.Z)("MessageMeta",i&&"reactions-offset",t.forwardInfo?.isImported&&"is-imported");return o.ZP.createElement("span",{className:Z,dir:f.isRtl?"rtl":"ltr",onClick:m,"data-ignore-on-paste":!0},l&&o.ZP.createElement("i",{className:"icon icon-language message-translated",onClick:h}),Boolean(t.views)&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("span",{className:"message-views"},(0,xt.bi)(t.views)),o.ZP.createElement("i",{className:"icon icon-channelviews"})),!d&&Boolean(r?.messagesCount)&&o.ZP.createElement("span",{onClick:function(e){e.stopPropagation(),g()},className:"message-replies-wrapper"},o.ZP.createElement("span",{className:"message-replies"},o.ZP.createElement(ra.Z,{text:(0,xt.bi)(r.messagesCount)})),o.ZP.createElement("i",{className:"icon icon-reply-filled"})),u&&o.ZP.createElement("i",{className:"icon icon-pinned-message message-pinned"}),s&&o.ZP.createElement("span",{className:"message-signature"},(0,Jn.Z)(s)),o.ZP.createElement("span",{className:"message-time",title:b,onMouseEnter:v},t.forwardInfo?.isImported&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("span",{className:"message-imported",onClick:w},(0,he.SA)(1e3*t.forwardInfo.date,f.code,!0)),o.ZP.createElement("span",{className:"message-imported",onClick:w},f("ImportedMessage"))),t.isEdited&&`${f("EditedMessage")} `,(0,he.mr)(f,1e3*t.date)),n&&o.ZP.createElement(Ms.Z,{status:n}),c&&c())}));var ks=n(36765),Ts=n(97799);const As=e=>{let{message:t,observeIntersection:n,observeIntersectionForPlaying:i,shouldLoop:r,lastSyncTime:c,shouldPlayEffect:d,withEffect:u,onPlayEffect:m,onStopEffect:h}=e;const{showNotification:p,openStickerSet:f}=(0,a.Sv)(),I=(0,Dt.Z)(),{isMobile:v}=(0,M.ZP)(),w=(0,o.sO)(null),b=t.content.sticker,{stickerSetInfo:Z,isVideo:P,hasEffect:y}=b,C=b.isPreloadedGlobally?void 0:(0,g.Ti)(t,P&&!s.Hh?"pictogram":"inline"),S=(0,$a.Op)(w,n),E=(0,$a.Op)(w,i),R=`sticker${b.id}?size=f`,k=(0,rn.Z)(R,!S||!y,l.IU.BlobUrl,c),[T,A,N]=(0,Tt.Z)(),x=(0,pt.Z)((()=>{N(),h?.()})),B=(0,_n.Z)(d);(0,o.d4)((()=>{y&&u&&E&&(d||B)&&(A(),m?.())}),[y,E,m,d,B,A,u]);const L=(0,pt.Z)((()=>{f({stickerSetInfo:b.stickerSetInfo})})),U=(0,pt.Z)((()=>{if(y){if(T||!u)return void p({message:I("PremiumStickerTooltip"),action:{action:"openStickerSet",payload:{stickerSetInfo:b.stickerSetInfo}},actionText:I("ViewAction")});if(u)return A(),void m?.()}L()})),j="isMissing"in Z,{width:O,height:F}=(0,Ue.Wr)(b,v),_=(0,ut.Z)("Sticker media-inner",j&&"inactive",y&&!t.isOutgoing&&"reversed");return o.ZP.createElement("div",{ref:w,className:_,style:`width: ${O}px; height: ${F}px;`,onClick:j?void 0:U},o.ZP.createElement(ks.Z,{containerRef:w,sticker:b,fullMediaHash:C,fullMediaClassName:"full-media",size:O,shouldLoop:r,noLoad:!S,noPlay:!E,withSharedAnimation:!0,cacheBuster:c}),y&&u&&S&&T&&o.ZP.createElement(Ts.Z,{key:R,className:"effect-sticker",tgsUrl:k,size:1.49*O,play:!0,isLowPriority:!0,noLoop:!0,onEnded:x}))};var Ns=n(74753),xs=n(80036);const Bs=7*Ue.Gw;function Ls(e,t,n,s,i,r,c){const{interactWithAnimatedEmoji:d,sendEmojiInteraction:l,sendWatchingEmojiInteraction:u}=(0,a.Sv)(),m=(0,o.sO)(null),h=(0,o.sO)(null),g=(0,rn.Z)(n?`document${n}`:void 0,!n),p=c||Bs,f=(0,xs.Z)(`width: ${p}px`,`height: ${p}px`,r&&"cursor: pointer"),I=(0,o.sO)(void 0),v=(0,o.sO)(void 0),w=(0,pt.Z)((()=>{m.current&&(l({chatId:e,messageId:t,emoji:r,interactions:I.current}),v.current=void 0,I.current=void 0)})),b=(0,pt.Z)((()=>{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}))})),Z=(0,pt.Z)((()=>{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:!i}),I.current||(I.current=[],v.current=performance.now(),setTimeout(w,1e3)),I.current.push(v.current?(performance.now()-v.current)/1e3:0)}));return(0,o.d4)((()=>{const n=m.current;n&&s&&s.forEach((a=>{let{id:s,startSize:o,messageId:c}=a;if(o||t!==c)return;const{x:d,y:l}=n.getBoundingClientRect();u({id:s,chatId:e,emoticon:r,startSize:p,x:d,y:l,isReversed:!i}),b()}))}),[s,e,r,i,t,b,u,p]),{ref:m,size:p,style:f,handleClick:Z}}const Us=(0,o.X$)((0,a.c$)(((e,t)=>{let{emoji:n,withEffects:a}=t;return{sticker:(0,m.zB)(e,n),effect:a?(0,m.tH)(e,n):void 0,soundId:(0,m.Oh)(e,n)}}))((e=>{let{isOwn:t,observeIntersection:n,lastSyncTime:a,forceLoadPreview:s,messageId:i,chatId:r,activeEmojiInteractions:c,sticker:d,effect:l,soundId:u}=e;const{ref:m,size:h,style:g,handleClick:p}=Ls(r,i,u,c,t,l?.emoji),f=(0,$a.Op)(m,n);return o.ZP.createElement(bs.Z,{sticker:d,size:h,quality:1,noLoad:!f,forcePreview:s,lastSyncTime:a,play:f,forceOnHeavyAnimation:!0,ref:m,className:(0,ut.Z)("AnimatedEmoji media-inner",d?.id===Ue.wB&&"like-sticker-thumb"),style:g,onClick:p})}))),js=(0,o.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,m.tH)(e,s.emoji):void 0,soundId:s?.emoji&&(0,m.Oh)(e,s.emoji),noPlay:!(0,m.W9)(e)}}))((e=>{let{isOwn:t,customEmojiId:n,messageId:a,chatId:s,activeEmojiInteractions:i,sticker:r,effect:c,soundId:d,noPlay:l,observeIntersection:u}=e;const{ref:m,size:h,style:g,handleClick:p}=Ls(s,a,d,i,t,c?.emoji,(0,as.qo)(1));return o.ZP.createElement(sn.Z,{ref:m,documentId:n,className:(0,ut.Z)("AnimatedEmoji media-inner",r?.id===Ue.wB&&"like-sticker-thumb"),style:g,size:h,isBig:!0,noPlay:l,withSharedAnimation:!0,forceOnHeavyAnimation:!0,observeIntersectionForLoading:u,onClick:p})}))),Os={dark:{outgoing:"rgb(135,116,225)",incoming:"rgb(33,33,33)"},light:{outgoing:"rgb(238,255,222)",incoming:"rgb(255,255,255)"}};function Fs(e,t,n,a,s){return a?Promise.resolve(Os[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 i=t?n.width-1:0,o=n.height-1;return`rgba(${Array.from(s.getImageData(i,o,1,1).data).join(",")})`}(e,t)}var _s=n(92566),Ds=n(15866);function $s(e,t,n){const{isMobile:a}=(0,M.ZP)(),i=n||(0,g.DH)(e);return(0,Ds.Z)(i,Boolean(t),a&&!s.vX)}var qs=n(70692),Hs=n(39196);const Gs=e=>{let{id:t,message:n,observeIntersection:a,noAvatars:s,canAutoLoad:r,isInSelectMode:d,isSelected:l,uploadProgress:u,forcedWidth:m,size:h="inline",dimensions:p,asForwarded:f,nonInteractive:I,shouldAffectAppendix:v,isDownloading:w,isProtected:b,theme:Z,onClick:P,onCancelUpload:y}=e;const C=(0,o.sO)(null),S=(0,g.O$)(n)||(0,g.F$)(n),E=S.blobUrl,R=(0,$a.Op)(C,a),{isMobile:k}=(0,M.ZP)(),[T,A]=(0,o.eJ)(r),N=T&&R,{mediaData:x,loadProgress:B}=(0,_s.Z)((0,g.Ti)(n,h),!N),L=E||x,U=Boolean(m),[j]=(0,o.eJ)(!L),O=Boolean(L),F=$s(n,O),_=$s(n,!U),D=(0,qs.Z)(!O),$=(0,g.DH)(n),[q,,H]=(0,Tt.Z)(S.isSpoiler),{loadProgress:G}=(0,_s.Z)((0,g.Ti)(n,"download"),!w,(0,g.kG)(n,"download")),{isUploading:V,isTransferring:W,transferProgress:z}=(0,g.Sc)(n,u||(w?G:B),N&&!L),X=!1===(0,_n.Z)(T),{shouldRender:Y,transitionClassNames:J}=(0,St.Z)(W,void 0,X,"slow"),{shouldRender:K,transitionClassNames:Q}=(0,St.Z)(!L&&!T),ee=(0,pt.Z)((()=>{V?y?.(n):L?q?H():P?.(n.id):A((e=>!e))})),te=(0,g.B4)(n);(0,_a.Z)((e=>{let[t]=e;if(!v)return void(t&&C.current.closest(i.be_).removeAttribute(i.s22));const n=C.current.closest(i.be_);L?Fs(L,te,0,l,Z).then((e=>{(0,c.WM)((()=>{n.style.setProperty("--appendix-bg",e),n.setAttribute(i.s22,"")}))})):n.classList.add("has-appendix-thumb")}),[v,L,te,d,l,Z]);const{width:ne,height:ae,isSmall:se}=p||Ka(n,f,s,k),ie=(0,ut.Z)("media-inner",!V&&!I&&"interactive",se&&"small-image",ne===ae&&"square-image",ae<Ya&&"fix-min-height"),oe=p?` width: ${ne}px; left: ${p.x}px; top: ${p.y}px;`:"",re="inline"===h?`height: ${ae}px;${oe}`:void 0;return o.ZP.createElement("div",{id:t,ref:C,className:ie,style:re,onClick:V?void 0:ee},U&&o.ZP.createElement("canvas",{ref:_,className:"thumbnail blurred-bg"}),o.ZP.createElement("img",{src:L,className:(0,ut.Z)("full-media",U&&"with-blurred-bg"),alt:"",style:m?`width: ${m}px`:void 0,draggable:!b}),j&&o.ZP.createElement("canvas",{ref:F,className:(0,ut.Z)("thumbnail",D)}),b&&o.ZP.createElement("span",{className:"protector"}),Y&&!K&&o.ZP.createElement("div",{className:`media-loading ${J}`},o.ZP.createElement(Hs.Z,{progress:z,onClick:V?ee:void 0})),K&&o.ZP.createElement("i",{className:(0,ut.Z)("icon","icon-download",Q)}),o.ZP.createElement(oa.Z,{isVisible:q,withAnimation:!0,thumbDataUri:$,width:ne,height:ae,className:"media-spoiler"}),W&&o.ZP.createElement("span",{className:"message-transfer-progress"},Math.round(100*z),"%"))};var Vs=n(57080);const Ws=e=>{let{id:t,message:n,observeIntersectionForLoading:s,observeIntersectionForPlaying:i,noAvatars:r,canAutoLoad:c,canAutoPlay:d,uploadProgress:l,forcedWidth:u,lastSyncTime:m,dimensions:h,asForwarded:p,isDownloading:f,isProtected:I,onClick:v,onCancelUpload:w}=e;const b=(0,o.sO)(null),Z=(0,o.sO)(null),P=(0,g.b7)(n)||(0,g.Cg)(n),y=P.blobUrl,[C,,S]=(0,Tt.Z)(P.isSpoiler),E=(0,$a.Op)(b,s),R=(0,$a.Op)(b,i)&&E,k=(0,o.sO)(E);R&&!k.current&&(k.current=!0);const{isMobile:T}=(0,M.ZP)(),[A,N]=(0,o.eJ)(c),x=Boolean(A&&E&&m),[B,L]=(0,o.eJ)(Boolean(d&&!C)),U=(0,g.Ti)(n,"inline"),[j]=(0,o.eJ)(Boolean(U&&ze.UV(U))),{mediaData:O,loadProgress:F}=(0,_s.Z)(U,!x,(0,g.kG)(n,"inline"),m),_=y||O,[D,$]=(0,Tt.Z)(),q=(0,g.DH)(n),H=Boolean(q),G=Boolean(u),V=(0,g.Ti)(n,"preview"),[W]=(0,o.eJ)(Boolean(V&&ze.UV(V))),z=E&&m,X=(0,rn.Z)(V,!z,void 0,m),Y=(0,qs.Z)((H||X)&&!D),J=!H||X||D,K=$s(n,J),Q=$s(n,!G),ee=(0,qs.Z)(!J),te=_&&k.current,{loadProgress:ne}=(0,_s.Z)((0,g.Ti)(n,"download"),!f,(0,g.kG)(n,"download"),m),{isUploading:ae,isTransferring:se,transferProgress:ie}=(0,g.Sc)(n,l||(f?ne:F),x&&!D&&!j||f),oe=!1===(0,_n.Z)(A),{shouldRender:re,transitionClassNames:ce}=(0,St.Z)(se,void 0,oe),{transitionClassNames:de}=(0,St.Z)(Boolean((A||_)&&!B&&!re)),[le,ue]=(0,o.eJ)(0),me=(0,pt.Z)((e=>{ue(Math.max(0,e.currentTarget.currentTime-1))})),ge=Z.current?.duration||P.duration||0,pe=(0,g.B4)(n),fe=Boolean((0,g.Cg)(n)),{width:Ie,height:ve}=h||(0,Ue.GC)(P,pe,p,fe,r,T),we=(0,pt.Z)((()=>{ae?w?.(n):f?(0,a.Sv)().cancelMessageMediaDownload({message:n}):_?(_&&!B&&L(!0),C?S():v?.(n.id)):N((e=>!e))})),be=(0,ut.Z)("media-inner dark",!ae&&"interactive",ve<Ya&&"fix-min-height"),Ze=`height: ${ve}px;${h?` width: ${Ie}px; left: ${h.x}px; top: ${h.y}px;`:""}`;return o.ZP.createElement("div",{ref:b,id:t,className:be,style:Ze,onClick:ae?void 0:we},G&&o.ZP.createElement("canvas",{ref:Q,className:"thumbnail blurred-bg"}),te&&o.ZP.createElement(Vs.Z,{ref:Z,src:_,className:(0,ut.Z)("full-media",G&&"with-blurred-bg"),canPlay:B&&R,muted:!0,loop:!0,playsInline:!0,draggable:!I,onTimeUpdate:me,onReady:$,style:u?`width: ${u}px`:void 0}),o.ZP.createElement("img",{src:X,className:(0,ut.Z)("thumbnail",Y,G&&"with-blurred-bg"),alt:"",style:u?`width: ${u}px;`:void 0,draggable:!I}),H&&!W&&o.ZP.createElement("canvas",{ref:K,className:(0,ut.Z)("thumbnail",ee)}),I&&o.ZP.createElement("span",{className:"protector"}),o.ZP.createElement("i",{className:(0,ut.Z)("icon","icon-large-play",de)}),o.ZP.createElement(oa.Z,{isVisible:C,withAnimation:!0,thumbDataUri:q,width:Ie,height:ve,className:"media-spoiler"}),re&&o.ZP.createElement("div",{className:(0,ut.Z)("media-loading",ce)},o.ZP.createElement(Hs.Z,{progress:ie,onClick:we})),!A&&!_&&o.ZP.createElement("i",{className:"icon icon-download"}),se?o.ZP.createElement("span",{className:"message-transfer-progress"},ae||f?`${Math.round(100*ie)}%`:"..."):o.ZP.createElement("div",{className:"message-media-duration"},P.isGif?"GIF":(0,he.k9)(Math.max(ge-le,0))))};var zs=n(6272);const Xs=(0,a.c$)(((e,t)=>{let{contact:n}=t;const{countryList:{phoneCodes:a}}=e;return{user:(0,m.dy)(e,n.userId),phoneCodeList:a}}))((e=>{let{contact:t,user:n,phoneCodeList:s}=e;const{openChat:i}=(0,a.Sv)(),{firstName:r,lastName:c,phoneNumber:d,userId:l}=t,u="0"!==l,m=(0,pt.Z)((()=>{i({id:l})}));return o.ZP.createElement("div",{className:(0,ut.Z)("Contact",u&&"interactive"),onClick:u?m:void 0},o.ZP.createElement(Is.Z,{size:"large",user:n,text:r||c}),o.ZP.createElement("div",{className:"contact-info"},o.ZP.createElement("div",{className:"contact-name"},r," ",c),o.ZP.createElement("div",{className:"contact-phone"},(0,zs.WZ)(s,d))))}));var Ys=n(20230),Js=n(51218),Ks=n(14434),Qs=n(96937);function ei(e,t){return t>0?(e/t*100).toFixed():0}const ti=e=>{let{answer:t,voteResults:n,totalVoters:a,maxVotersCount:s,correctResults:i,shouldAnimate:r}=e;const c=n&&n.find((e=>e.option===t.option)),d=0===i.length||-1!==i.indexOf(t.option),l=i.length>0&&d||c?.isChosen,u=c?ei(c.votersCount,a||0):0,[m,h]=(0,o.eJ)(r?0:u),g=(0,o.sO)(null),p=c?ei(c.votersCount,s||0):0,f=m!==u;if((0,o.d4)((()=>{r&&h(u)}),[r,u]),(0,o.bt)((()=>{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 o.ZP.createElement("div",{className:"PollOption",dir:"ltr"},o.ZP.createElement("div",{className:"poll-option-share "+("100"===u?"limit-width":"")},u,"%",l&&o.ZP.createElement("span",{className:(0,ut.Z)("poll-option-chosen",!d&&"wrong",r&&"animate")},o.ZP.createElement("i",{className:(0,ut.Z)("icon",d?"icon-check":"icon-close")}))),o.ZP.createElement("div",{className:"poll-option-right"},o.ZP.createElement("div",{className:"poll-option-text",dir:"auto"},(0,Jn.Z)(t.text)),o.ZP.createElement("div",{className:(0,ut.Z)("poll-option-answer",l&&!d&&"wrong")},o.ZP.createElement("div",{className:"poll-option-corner",ref:g}),o.ZP.createElement("div",{className:"poll-option-line",style:I}))))};function ni(e){e.stopPropagation()}const ai=(0,o.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:i,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,o.eJ)(!1),[I,v]=(0,o.eJ)([]),[w,b]=(0,o.eJ)(!1),[P,y]=(0,o.eJ)(!1),[C,S]=(0,o.eJ)(!h.closed&&h.closeDate&&h.closeDate>0?Math.min(h.closeDate-Math.floor(Date.now()/1e3)+(0,Z.Qj)(),h.closePeriod):0),E=(0,o.sO)(null),{results:M,totalVoters:R}=g,k=M&&M.some((e=>e.isChosen)),T=!h.closed&&!k,A=!T&&h.isPublic&&Number(g.totalVoters)>0,N=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,o.d4)((()=>{const e=n.results.results?.find((e=>e.isChosen));p&&e&&(e.isCorrect&&l(),f(!1))}),[p,n.results.results,l]),(0,o.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,he.k9)(C),n.firstElementChild.setAttribute("stroke-dashoffset",`-${e}`)}else e.innerHTML=`\n <span>${(0,he.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,o.d4)((()=>{h.quiz&&(C<=0||k&&!h.closed)&&c({chatId:m,messageId:u})}),[m,C,k,c,u,h.closed,h.quiz]),(0,o.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,o.Ye)((()=>s?s.reduce(((e,t)=>{const n=i[t];return n&&e.push(n),e}),[]):[]),[i,s]),j=(0,pt.Z)((e=>{v([e]),f(!0),y(!0),r([e])})),O=(0,pt.Z)((e=>{v(e)})),F=(0,pt.Z)((()=>{f(!0),y(!0),r(I)})),_=(0,pt.Z)((()=>{d({chatId:m,messageId:u})})),D=(0,pt.Z)((()=>{b(!0)})),$=(0,pt.Z)((()=>{b(!1),y(!1)}));(0,o.d4)((()=>{P&&k&&h.quiz&&g.results&&n.results.solution&&(g.results.find((e=>e.isChosen&&e.isCorrect))||b(!0))}),[k,P,g.results,h.quiz,n.results.solution]);const q=(0,Dt.Z)();return o.ZP.createElement("div",{className:"Poll",dir:q.isRtl?"auto":"ltr"},w&&n.results.solution&&o.ZP.createElement(Qs.Z,{message:(0,Ys.H)({text:n.results.solution,entities:n.results.solutionEntities}),duration:5e3,onDismiss:$,containerId:"#middle-column-portals"}),o.ZP.createElement("div",{className:"poll-question"},(0,Jn.Z)(h.question,["emoji","br"])),o.ZP.createElement("div",{className:"poll-type"},q(function(e){return void 0===e.isPublic?" ":e.closed?"FinalResults":e.quiz?e.isPublic?"QuizPoll":"AnonymousQuizPoll":e.isPublic?"PublicPoll":"AnonymousPoll"}(h)),U.length>0&&o.ZP.createElement("div",{className:"poll-recent-voters"},U.map((e=>o.ZP.createElement(Is.Z,{key:e.id,size:"micro",user:e})))),C>0&&T&&o.ZP.createElement("div",{ref:E,className:"poll-countdown"}),h.quiz&&n.results.solution&&!T&&o.ZP.createElement(Jt.Z,{round:!0,size:"tiny",color:"translucent",className:"poll-quiz-help",disabled:w,onClick:D,ariaLabel:"Show Solution"},o.ZP.createElement("i",{className:"icon icon-lamp"}))),T&&o.ZP.createElement("div",{className:"poll-answers",onClick:ni},N?o.ZP.createElement(Js.Z,{options:L,onChange:O,disabled:t.isScheduled||p,loadingOptions:p?I:void 0,round:!0}):o.ZP.createElement(Ks.Z,{name:`poll-${u}`,options:L,onChange:j,disabled:t.isScheduled||p,loadingOption:p?I[0]:void 0})),!T&&o.ZP.createElement("div",{className:"poll-results"},h.answers.map((function(e){return o.ZP.createElement(ti,{key:e.option,shouldAnimate:P||!T,answer:e,voteResults:M,totalVoters:R,maxVotersCount:x,correctResults:B})}))),!A&&!N&&o.ZP.createElement("div",{className:"poll-voters-count"},function(e,t,n){return n?e(t?"Answer":"Vote",n,"i"):e(t?"Chat.Quiz.TotalVotesEmpty":"Chat.Poll.TotalVotesResultEmpty")}(q,h.quiz,g.totalVoters)),N&&o.ZP.createElement(Jt.Z,{isText:!0,disabled:0===I.length,size:"tiny",onClick:F},q("PollSubmitVotes")),A&&o.ZP.createElement(Jt.Z,{isText:!0,size:"tiny",onClick:_},q("PollViewResults")))})));var si=n(48035),ii=n(10088);const oi=(0,o.X$)((e=>{let{message:t,observeIntersection:n,noAvatars:s,canAutoLoad:i,canAutoPlay:r,inPreview:c,asForwarded:d,lastSyncTime:l,isDownloading:u=!1,isProtected:m,theme:h,onMediaClick:p,onCancelMediaTransfer:f}=e;const{openTelegramLink:I}=(0,a.Sv)(),v=(0,g.s1)(t),{isMobile:w}=(0,M.ZP)(),b=(0,Dt.Z)(),Z=(0,pt.Z)((()=>{p()})),P=(0,pt.Z)((()=>{v&&I({url:v.url})}));if(!v)return;const{siteName:y,url:C,displayUrl:S,title:E,description:R,photo:k,video:T,type:A}=v,N=c?void 0:function(e){switch(e){case"telegram_channel_request":case"telegram_megagroup_request":case"telegram_chat_request":return"lng_view_button_request_join";case"telegram_message":return"lng_view_button_message";case"telegram_bot":return"lng_view_button_bot";case"telegram_voicechat":return"lng_view_button_voice_chat";case"telegram_livestream":return"lng_view_button_voice_chat_channel";case"telegram_megagroup":case"telegram_chat":return"lng_view_button_group";case"telegram_channel":return"lng_view_button_channel";case"telegram_user":return"lng_view_button_user";case"telegram_botapp":return"lng_view_button_bot_app";case"telegram_chatlist":return"ViewChatList";default:return}}(A),x=(0,si.Z)(R,170),B=Boolean(x||E||y);let L=!1;if(B&&v?.photo&&!v.video){const{width:e,height:n}=Ka(t,void 0,void 0,w);L=e===n}const U=(k||T)&&p&&!L,j=(0,ut.Z)("WebPage",c&&"in-preview",L&&"with-square-photo",!k&&!T&&!c&&"without-media",T&&"with-video",!B&&"no-article",N&&"with-quick-button");return o.ZP.createElement("div",{className:j,"data-initial":(y||S)[0],dir:"auto"},o.ZP.createElement("div",{className:"WebPage--content"},k&&!T&&o.ZP.createElement(Gs,{message:t,observeIntersection:n,noAvatars:s,canAutoLoad:i,size:L?"pictogram":"inline",asForwarded:d,nonInteractive:!U,isDownloading:u,isProtected:m,theme:h,onClick:U?Z:void 0,onCancelUpload:f}),B&&o.ZP.createElement("div",{className:"WebPage-text"},o.ZP.createElement(ii.Z,{className:"site-name",url:C,text:y||S}),!c&&E&&o.ZP.createElement("p",{className:"site-title"},(0,Jn.Z)(E)),x&&o.ZP.createElement("p",{className:"site-description"},(0,Jn.Z)(x,["emoji","br"]))),!c&&T&&o.ZP.createElement(Ws,{message:t,observeIntersectionForLoading:n,noAvatars:s,canAutoLoad:i,canAutoPlay:r,lastSyncTime:l,asForwarded:d,isDownloading:u,isProtected:m,onClick:U?Z:void 0,onCancelUpload:f})),N&&(O=N,o.ZP.createElement(Jt.Z,{className:"WebPage--quick-button",size:"tiny",color:"translucent-bordered",onClick:P},b(O))));var O}));var ri=n(17921);const ci=(0,o.X$)((e=>{let{message:t,shouldAffectAppendix:n,isInSelectMode:a,isSelected:s,theme:r,forcedWidth:c}=e;const d=(0,o.sO)(null),l=(0,Dt.Z)(),u=(0,g.eO)(t),{title:m,text:h,amount:p,currency:f,isTest:I,photo:v}=u,w=(0,rn.Z)((0,g.O9)(v)),b=Boolean(c),Z=$s(t,!b,w);return(0,_a.Z)((e=>{let[t]=e;if(n){if(w){const e=d.current.closest(i.be_);Fs(w,!1,0,s,r).then((t=>{e.style.setProperty("--appendix-bg",t),e.setAttribute(i.s22,"")}))}}else t&&d.current.closest(i.be_).removeAttribute(i.s22)}),[n,w,a,s,r]),o.ZP.createElement("div",{ref:d,className:"Invoice"},m&&o.ZP.createElement("p",{className:"title"},(0,Jn.Z)(m)),h&&o.ZP.createElement("div",null,(0,Jn.Z)(h,["emoji","br"])),o.ZP.createElement("div",{className:"description "+(v?"has-image":"")},Boolean(v)&&o.ZP.createElement("div",{className:"invoice-image-container"},b&&o.ZP.createElement("canvas",{ref:Z,className:"thumbnail blurred-bg"}),w&&o.ZP.createElement("img",{className:"invoice-image",src:w,alt:"",style:c?`width: ${c}px`:void 0,crossOrigin:"anonymous"}),!w&&v&&o.ZP.createElement(ri.Z,{width:c||v.dimensions?.width,height:v.dimensions?.height,forceAspectRatio:!0})),o.ZP.createElement("p",{className:"description-text"},(0,lt.x)(p,f,l.code),I&&o.ZP.createElement("span",null,l("PaymentTestInvoice")))))})),di={root:"rwnm0xOh31c2MY4kK2No",duration:"lKSp02aI8WDGX3393nkh",buy:"gxQfWp0jp0_2Z4qWiXKN",spoiler:"z2tB5Vd_jKJ9IYX4Nijd"},li=(0,o.X$)((e=>{let{message:t,lastSyncTime:n}=e;const{openInvoice:s,loadExtendedMedia:i}=(0,a.Sv)(),r=(0,Dt.Z)(),c=(0,g.eO)(t),{chatId:d,id:l}=t,u=(0,pt.Z)((()=>{i({chatId:d,ids:[l]})}));(0,Mt.Z)(u,n?3e4:void 0);const{amount:m,currency:h,extendedMedia:p}=c,{width:f,height:I,thumbnail:v,duration:w}=p,b=(0,pt.Z)((()=>{s({chatId:d,messageId:l,isExtendedMedia:!0})}));return o.ZP.createElement("div",{className:(0,ut.Z)(di.root,"media-inner"),onClick:b},o.ZP.createElement(oa.Z,{thumbDataUri:v?.dataUri,width:f,height:I,isVisible:!0,className:di.spoiler}),Boolean(w)&&o.ZP.createElement("div",{className:di.duration},(0,he.k9)(w)),o.ZP.createElement("div",{className:di.buy},o.ZP.createElement("i",{className:(0,ut.Z)("icon","icon-lock",di.lock)}),r("Checkout.PayPrice",(0,lt.x)(m,h))))})),ui=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"})),mi=["#e56cd5","#f89440","#9986ff","#44b3f5","#6dc139","#ff5d5a","#f87aad","#6e82b3","#f5ba21"],hi=n.p+"map-pin.7b3c3e60ee24795e4bd2.svg",gi=1e-4,pi={width:400,height:300,zoom:16,scale:2},fi={__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>'},Ii=(0,o.X$)((e=>{let{message:t,peer:n,lastSyncTime:s,isInSelectMode:r,isSelected:d,theme:l}=e;const{openUrl:u}=(0,a.Sv)(),m=(0,o.sO)(null),h=(0,o.sO)(null),p=(0,Dt.Z)(),f=(0,Ct.Z)(),I=(0,g.nf)(t),{type:v,geo:w}=I,b=(0,Z.bp)(),P=(0,g.$R)(t,b),y="geoLive"!==v||P?void 0:t.date+I.period-b,[C,S]=(0,o.eJ)(w),E="venue"===v||"geoLive"===v&&!P,{width:M,height:R,zoom:k,scale:T}=pi,A=Boolean(s)&&(0,g.k6)(C,M,R,k,T),N=(0,rn.Z)(A),x=(0,_n.Z)(N),B=N||x,L=n&&(0,g.YC)(n.id),U=n&&L?n:void 0,j=n&&!L?n:void 0,O=(0,g.B4)(t),F=(0,o.Ye)((()=>{if("geoLive"!==v||!C.accuracyRadius)return 0;const{lat:e,accuracyRadius:t}=C;return t/function(e,t){return 156543.03392*Math.cos(e*(Math.PI/180))/2**t}(e,k)}),[v,C,k]),_=(0,pt.Z)((e=>{if("geoLive"!==v)return;const n=24*Math.PI,a=e.lastElementChild,s=e.firstElementChild,i=t.date+I.period-(0,Z.bp)(),o=(1-i/I.period)*n,r=(0,he.mB)(p,1e3*i);a&&s?(s.textContent=r,a.firstElementChild.setAttribute("stroke-dashoffset",`-${o}`)):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="-${o}"\n />\n </svg>`}));return(0,o.bt)((()=>{h.current&&_(h.current)}),[_]),(0,_a.Z)((e=>{let[t]=e;if(E)t||m.current.closest(i.be_).removeAttribute(i.s22);else if(B){const e=m.current.closest(i.be_);Fs(B,O,0,d,l).then((t=>{(0,c.WM)((()=>{e.style.setProperty("--appendix-bg",t),e.classList.add("has-appendix-thumb"),e.setAttribute(i.s22,"")}))}))}}),[E,O,r,d,l,B]),(0,o.d4)((()=>{Math.abs(w.lat-C.lat)<gi&&Math.abs(w.long-C.long)<gi?C.accuracyRadius!==w.accuracyRadius&&S({...C,accuracyRadius:w.accuracyRadius}):S(w)}),[w,C]),(0,kt.Z)((()=>{f()}),P?void 0:1e3*(y||0)),(0,Mt.Z)((()=>{(0,c.WM)((()=>{const e=h.current;e&&_(e)}))}),y?1e3:void 0),o.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`}(C.lat,C.long,k);u({url:e})}},o.ZP.createElement("div",{className:"map-wrapper"},B?o.ZP.createElement("img",{className:"full-media map",src:B,alt:"Location on a map",style:`width: ${pi.width}px; height: ${pi.height}px;`}):o.ZP.createElement(ri.Z,{width:M,height:R}),function(){if(B)return o.ZP.createElement(o.ZP.Fragment,null,Boolean(F)&&!P&&o.ZP.createElement("div",{className:"location-accuracy",style:`width: ${2*F}px; height: ${2*F}px`}),function(){const e=(0,ut.Z)("pin",v,P&&"expired");if("geoLive"===v)return o.ZP.createElement("div",{className:e,dangerouslySetInnerHTML:fi},o.ZP.createElement(Is.Z,{chat:j,user:U,className:"location-avatar"}),void 0!==I.heading&&o.ZP.createElement("div",{className:"direction",style:`--direction: ${I.heading}deg`}));if("venue"===v){const t=function(e){return e?ui.get(e)||ui.get(e.split("/")[0])||mi[(t=e,t.split("").reduce(((e,t)=>(e<<5)-e+t.charCodeAt(0)|0),0)%mi.length)]:"#008df2";var t}(I.venueType),n=function(e){return e?`https://ss3.4sqi.net/img/categories_v2/${e}_88.png`:""}(I.venueType);return o.ZP.createElement("div",{className:e,dangerouslySetInnerHTML:fi,style:`--pin-color: ${t}`},o.ZP.createElement("img",{src:n,className:"venue-icon",alt:""}))}return o.ZP.createElement("img",{className:e,src:hi,alt:""})}())}()),function(){if(E)return"venue"===v?o.ZP.createElement("div",{className:"location-info"},o.ZP.createElement("div",{className:"location-info-title"},I.title),o.ZP.createElement("div",{className:"location-info-subtitle"},I.address)):"geoLive"===v?o.ZP.createElement("div",{className:"location-info"},o.ZP.createElement("div",{className:"location-info-title"},p("AttachLiveLocation")),o.ZP.createElement("div",{className:"location-info-subtitle"},(0,he.dJ)(p,b,t.editDate)),!P&&o.ZP.createElement("div",{className:"geo-countdown",ref:h})):void 0}())})),vi=(0,o.X$)((e=>{let{message:t,canAutoLoadMedia:n,lastSyncTime:s}=e;const{clickBotInlineButton:i}=(0,a.Sv)(),r=t.content.game,{title:c,description:d}=r,l=Boolean(s)&&(0,g.N)(r),u=Boolean(s)&&(0,g.Wc)(r),m=(0,rn.Z)(l,!n),h=(0,rn.Z)(u,!n);return o.ZP.createElement("div",{className:"Game"},o.ZP.createElement("div",{className:"preview",style:"width: 480px; height: 270px",onClick:()=>{i({messageId:t.id,button:t.inlineButtons[0][0]})}},!m&&!h&&o.ZP.createElement(ri.Z,{className:"skeleton preview-content"}),m&&o.ZP.createElement("img",{className:"preview-content",src:m,alt:c}),h&&o.ZP.createElement("video",{className:"preview-content",playsInline:!0,muted:!0,disablePictureInPicture:!0,autoPlay:!0,loop:!0,src:h})),o.ZP.createElement("div",{className:"title"},c),!(0,g.UD)(t)&&o.ZP.createElement("div",{className:"description"},d))}));function wi(e){return(0,o.X$)((0,a.c$)(((e,t)=>{const{message:n}=t;return{isInSelectMode:(0,m.CA)(e),isSelected:(0,m.vk)(e,n.id)}}))((t=>{const{isInSelectMode:n,isSelected:s,message:i,dimensions:r}=t,{toggleMessageSelection:c}=(0,a.Sv)(),d=(0,pt.Z)((e=>{e.stopPropagation(),c({messageId:i.id,withShift:e?.shiftKey})})),l=(0,o.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 o.ZP.createElement("div",{className:(0,ut.Z)("album-item-select-wrapper",s&&"is-selected"),style:r?`left: ${r.x}px; top: ${r.y}px;`:"",onClick:n?d:void 0},n&&o.ZP.createElement("div",{className:"message-select-control"},s&&o.ZP.createElement("i",{className:"icon icon-select"})),o.ZP.createElement(e,l))})))}const bi=wi(Gs),Zi=wi(Ws),Pi=(0,a.c$)(((e,t)=>{let{album:n}=t;const{chatId:a}=n.mainMessage,s=(0,m.Pu)(e),i=(0,m.f2)(e,a),o=n.mainMessage.isScheduled;return{theme:s,uploadsById:e.fileUploads.byMessageLocalId,activeDownloadIds:o?i?.scheduledIds:i?.ids}}))((e=>{let{album:t,observeIntersection:n,hasCustomAppendix:s,lastSyncTime:i,isOwn:r,isProtected:c,albumLayout:d,onMediaClick:l,uploadsById:u,activeDownloadIds:h,theme:p}=e;const{cancelSendingMessage:f}=(0,a.Sv)(),I=t.messages.length,v=(0,pt.Z)((e=>{f({chatId:e.chatId,messageId:e.id})})),{width:w,height:b}=d.containerStyle;return o.ZP.createElement("div",{className:"Album",style:`width: ${w}px; height: ${b}px;`},t.messages.map((function(e,t){const{photo:f,video:w}=(0,g.qp)(e),b=u[(0,g.KK)(e)]?.progress,{dimensions:Z,sides:P}=d.layout[t],y=(0,m.bH)((0,a.Rd)(),e),C=(0,m.__)((0,a.Rd)(),e);if(f){const a=s&&(r?t===I-1:Boolean(8&P&&4&P));return o.ZP.createElement(bi,{id:`album-media-${(0,g.d0)(e.id)}`,message:e,observeIntersectionForLoading:n,canAutoLoad:y,shouldAffectAppendix:a,uploadProgress:b,dimensions:Z,isProtected:c,onClick:l,onCancelUpload:v,isDownloading:h?.includes(e.id),theme:p})}if(w)return o.ZP.createElement(Zi,{id:`album-media-${(0,g.d0)(e.id)}`,message:e,observeIntersectionForLoading:n,canAutoLoad:y,canAutoPlay:C,uploadProgress:b,lastSyncTime:i,dimensions:Z,isProtected:c,onClick:l,onCancelUpload:v,isDownloading:h?.includes(e.id),theme:p})})))}));let yi;const Ci=e=>{let{message:t,observeIntersection:n,canAutoLoad:s,lastSyncTime:i,isDownloading:r}=e;const d=(0,o.sO)(null),u=(0,o.sO)(null),m=(0,o.sO)(null),h=t.content.video,p=(0,$a.Op)(d,n),[f,I]=(0,o.eJ)(s),v=Boolean(f&&p&&i),{mediaData:w,loadProgress:b}=(0,_s.Z)((0,g.Ti)(t,"inline"),!v,(0,g.kG)(t,"inline"),i),{loadProgress:Z}=(0,_s.Z)((0,g.Ti)(t,"download"),!r,l.IU.BlobUrl,i),[P,y]=(0,Tt.Z)(),C=!Boolean((0,g.DH)(t))||P,S=$s(t,C),E=(0,qs.Z)(!C),M=f&&!P||r,R=!1===(0,_n.Z)(f),{shouldRender:k,transitionClassNames:T}=(0,St.Z)(M,void 0,R),[A,N]=(0,o.eJ)(!1),[x,B]=(0,qn.Z)(0),L=(0,Ha.WR)(x,16);(0,o.d4)((()=>{if(!A)return;const e=m.current;B(e.currentTime/e.duration)}),[B,A,L]),(0,o.bt)((()=>{if(!A)return;const e=Ue.Rj/2,t=2*(e-6)*Math.PI,n=t-L()*t,a=u.current,s=a.firstElementChild;s?s.firstElementChild.setAttribute("stroke-dashoffset",n.toString()):a.innerHTML=`\n <svg width="${Ue.Rj}px" height="${Ue.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>`}),[A,L]);const U=Boolean(w&&p),j=(0,pt.Z)((()=>{m.current&&(N(!1),B(0),(0,Ns.Z)(m.current),(0,c.WM)((()=>{u.current.innerHTML=""})))})),O=(0,pt.Z)((()=>{yi?.(),yi=j})),F=(0,pt.Z)((()=>{if(!w)return void I((e=>!e));if(r)return void(0,a.Sv)().cancelMessageMediaDownload({message:t});const e=m.current;A?e.paused?((0,Ns.Z)(e),(0,ua.Es)()):e.pause():(O(),e.pause(),e.currentTime=0,(0,Ns.Z)(e),(0,ua.Es)(),N(!0))})),_=(0,pt.Z)((e=>{const t=e.currentTarget;B(t.currentTime/t.duration)}));return o.ZP.createElement("div",{ref:d,className:"RoundVideo media-inner",onClick:F},w&&o.ZP.createElement("div",{className:"video-wrapper"},o.ZP.createElement(Vs.Z,{canPlay:U,ref:m,src:w,className:"full-media",width:Ue.Rj,height:Ue.Rj,autoPlay:!0,disablePictureInPicture:!0,muted:!A,loop:!A,playsInline:!0,onEnded:A?j:void 0,onTimeUpdate:A?_:void 0,onReady:y})),o.ZP.createElement("canvas",{ref:S,className:(0,ut.Z)("thumbnail",E),style:`width: ${Ue.Rj}px; height: ${Ue.Rj}px`}),o.ZP.createElement("div",{className:"progress",ref:u}),k&&o.ZP.createElement("div",{className:`media-loading ${T}`},o.ZP.createElement(Hs.Z,{progress:r?Z:b})),!w&&!f&&o.ZP.createElement("i",{className:"icon icon-download"}),o.ZP.createElement("div",{className:"message-media-duration"},A?(0,he.k9)(m.current.currentTime):(0,he.k9)(h.duration),(!A||m.current.paused)&&o.ZP.createElement("i",{className:"icon icon-muted"})))},Si=e=>{let{message:t,onClick:n}=e;const a=(0,Dt.Z)();return o.ZP.createElement("div",{className:"InlineButtons"},t.inlineButtons.map((e=>o.ZP.createElement("div",{className:"row"},e.map((e=>o.ZP.createElement(Jt.Z,{size:"tiny",ripple:!0,disabled:"unsupported"===e.type,onClick:()=>n({messageId:t.id,button:e})},o.ZP.createElement("span",{className:"inline-button-text"},(0,Jn.Z)(a(e.text))),(e=>{const{type:t}=e;switch(t){case"url":if(!i.FSu.test(e.url))return o.ZP.createElement("i",{className:"icon icon-arrow-right"});break;case"urlAuth":return o.ZP.createElement("i",{className:"icon icon-arrow-right"});case"buy":case"receipt":return o.ZP.createElement("i",{className:"icon icon-cart"});case"switchBotInline":return o.ZP.createElement("i",{className:"icon icon-share-filled"});case"webView":case"simpleWebView":return o.ZP.createElement("i",{className:"icon icon-webapp"})}})(e))))))))},Ei=(0,o.X$)((e=>{let{threadInfo:t,disabled:n}=e;const{openComments:s}=(0,a.Sv)(),i=(0,Dt.Z)(),{threadId:r,chatId:c,messagesCount:d,lastMessageId:l,lastReadInboxMessageId:u,recentReplierIds:m,originChannelId:h}=t,p=(0,pt.Z)((()=>{s({id:c,threadId:r,originChannelId:h})})),f=(0,o.Ye)((()=>{if(!m?.length)return;const{users:{byId:e},chats:{byId:t}}=(0,a.Rd)();return m.map((n=>(0,g.YC)(n)?e[n]:t[n])).filter(Boolean)}),[m]);if(void 0===d)return;const I=Boolean(u&&l&&u<l),v=d?i("Comments","%COMMENTS_COUNT%",void 0,d).split("%").map((e=>"COMMENTS_COUNT"===e?o.ZP.createElement(ra.Z,{text:(0,xt.bi)(d)}):e)):void 0;return o.ZP.createElement("div",{"data-cnt":(0,xt.bi)(d),className:(0,ut.Z)("CommentButton",I&&"has-unread",n&&"disabled"),dir:i.isRtl?"rtl":"ltr",onClick:p},o.ZP.createElement("i",{className:"icon icon-comments-sticker"}),(!f||0===f.length)&&o.ZP.createElement("i",{className:"icon icon-comments"}),f&&f.length>0&&o.ZP.createElement("div",{className:"recent-repliers",dir:i.isRtl?"rtl":"ltr"},f.map((e=>o.ZP.createElement(Is.Z,{key:e.id,size:"small",user:(0,g.YC)(e.id)?e:void 0,chat:(0,g.YC)(e.id)?void 0:e})))),o.ZP.createElement("div",{className:"label",dir:"auto"},d?v:i("LeaveAComment")),o.ZP.createElement("i",{className:"icon icon-next"}))}));var Mi=n(78046),Ri=n(48198);const ki={root:"JY0NZH9bysPBqR3sIbLu","is-custom-emoji":"T1R9OVCwcfQHR4vN8cx_",isCustomEmoji:"T1R9OVCwcfQHR4vN8cx_","animated-icon":"WTrBqa2uxq57nYJAIelk",animatedIcon:"WTrBqa2uxq57nYJAIelk",effect:"z9v8vlAIGxI3ITxuyEG1",animating:"sB0FGOzwkiDvNWHWcVEL"},Ti=2.5*Ue.Gw,Ai=6.5*Ue.Gw,Ni=(0,o.X$)((e=>{let{reaction:t,genericEffects:n,activeReactions:s,availableReactions:i,observeIntersection:r,withEffects:c}=e;const{stopActiveReaction:d}=(0,a.Sv)(),l=(0,o.sO)(null),u="documentId"in t,m=(0,o.Ye)((()=>i?.find((e=>(0,g.Hl)(e.reaction,t)))),[i,t]),h=m?.centerIcon?.id,{customEmoji:p}=(0,Mi.Z)(u?t.documentId:void 0),f=(0,o.Ye)((()=>{if(!u)return m?.aroundAnimation?.id;if(!p)return;const e=i?.find((e=>e.reaction.emoticon===p.emoji))?.aroundAnimation?.id;return e}),[m,i,p,u]),I=(0,o.Ye)((()=>{if(f)return f;if(!n?.stickers)return;const{stickers:e}=n;return e[Math.floor(Math.random()*e.length)].id}),[f,n]),v=(0,$a.Op)(l,r),w=h&&`sticker${h}`,b=I&&`sticker${I}`,Z=(0,rn.Z)(w,!h),P=(0,rn.Z)(b,!I),y=(0,o.Ye)((()=>s?.find((e=>(0,g.Hl)(e.reaction,t)))),[s,t]),C=Boolean(c&&y&&(u||Z)&&P),{shouldRender:S,transitionClassNames:E}=(0,St.Z)(C,void 0,!0,"slow"),M=(0,pt.Z)((()=>{y?.messageId&&d({messageId:y.messageId,reaction:t})})),[R,k,T]=(0,Tt.Z)(),A=!(u||C&&R),N=(0,ut.Z)(ki.root,S&&ki.animating,u&&ki.isCustomEmoji);return o.ZP.createElement("div",{className:N,ref:l},A&&o.ZP.createElement(Ri.Z,{reaction:t,availableReactions:i}),u&&o.ZP.createElement(sn.Z,{documentId:t.documentId,className:ki.customEmoji,observeIntersectionForPlaying:r}),S&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement(Ts.Z,{key:I,className:(0,ut.Z)(ki.effect,E),size:Ai,tgsUrl:P,play:v,noLoop:!0,forceOnHeavyAnimation:!0,onEnded:M}),u?!f&&v&&o.ZP.createElement(dn,{reaction:t}):o.ZP.createElement(Ts.Z,{key:h,className:(0,ut.Z)(ki.animatedIcon,E),size:Ti,tgsUrl:Z,play:v,noLoop:!0,forceOnHeavyAnimation:!0,onLoad:k,onEnded:T})))})),xi=(0,o.X$)((e=>{let{reaction:t,message:n,activeReactions:s,availableReactions:i,withRecentReactors:r,withEffects:c,genericEffects:d,observeIntersection:l}=e;const{toggleReaction:u}=(0,a.Sv)(),{recentReactions:m}=n.reactions,h=(0,o.Ye)((()=>{if(!r||!m)return;const e=(0,a.Rd)().users.byId;return m.filter((e=>(0,g.Hl)(e.reaction,t.reaction))).map((t=>e[t.userId])).filter(Boolean)}),[t.reaction,m,r]),p=(0,pt.Z)((()=>{u({reaction:t.reaction,chatId:n.chatId,messageId:n.id})}));return o.ZP.createElement(Jt.Z,{className:(0,ut.Z)((0,g.Bt)(t)&&"chosen"),size:"tiny",onClick:p},o.ZP.createElement(Ni,{activeReactions:s,reaction:t.reaction,availableReactions:i,genericEffects:d,observeIntersection:l,withEffects:c}),h?.length?o.ZP.createElement("div",{className:"avatars"},h.map((e=>o.ZP.createElement(Is.Z,{key:e.id,user:e,size:"micro"})))):o.ZP.createElement(ra.Z,{text:(0,xt.bi)(t.count),className:"counter"}))})),Bi=(0,o.X$)((e=>{let{message:t,isOutside:n,maxWidth:a,activeReactions:s,availableReactions:i,metaChildren:r,genericEffects:c,observeIntersection:d,noRecentReactors:l,withEffects:u}=e;const m=(0,Dt.Z)(),h=(0,o.Ye)((()=>t.reactions.results.reduce(((e,t)=>e+t.count),0)),[t]);return o.ZP.createElement("div",{className:(0,ut.Z)("Reactions",n&&"is-outside"),style:a?`max-width: ${a}px`:void 0,dir:m.isRtl?"rtl":"ltr"},t.reactions.results.map((e=>o.ZP.createElement(xi,{key:(0,g.$d)(e.reaction),reaction:e,message:t,activeReactions:s,availableReactions:i,withRecentReactors:h<=3&&!l,genericEffects:c,observeIntersection:d,withEffects:u}))),r)})),Li=(0,o.X$)((e=>{let{phoneCall:t,message:n,chatId:i}=e;const{requestMasterAndRequestCall:r}=(0,a.Sv)(),c=(0,Dt.Z)(),{isOutgoing:d,isVideo:l,reason:u}=t,m="missed"===u,h="busy"===u&&!d,g=(0,pt.Z)((()=>{r({isVideo:l,userId:i})})),p=(0,o.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,o.Ye)((()=>t.duration?(0,he.J_)(c,t.duration):void 0),[c,t.duration]),I=(0,he.mr)(c,1e3*n.date);return o.ZP.createElement("div",{className:"vDeypQzM845_JE14qGId"},o.ZP.createElement(Jt.Z,{size:"smaller",color:"translucent",round:!0,ripple:!0,onClick:g,className:"OtJi45yywgt1n_y6VPkE",disabled:!s.Bi,ariaLabel:c(d?"CallAgain":"CallBack")},o.ZP.createElement("i",{className:(0,ut.Z)("icon",l?"icon-video-outlined":"icon-phone")})),o.ZP.createElement("div",{className:"_0BG8sziTJQ_NYrsspMg"},o.ZP.createElement("div",{className:"LWVSvxVjeEyHPBrCb2sD"},c(p)),o.ZP.createElement("div",{className:"nuIsoCP15iD4ETadJ44R"},o.ZP.createElement("i",{className:(0,ut.Z)("icon","icon-arrow-right","wrUkWet7enyh9L1iPKvA",m&&"V5tKkKZpcY5yq_f5nO8l",!d&&"e0Vhbj8gfzQn1zJQoFLK")}),o.ZP.createElement("span",{className:"TJ2lYkLxYUie3A0JqtMR"},f?c("CallMessageWithDuration",[I,f]):I))))}));var Ui=n(78780),ji=n(50685),Oi=n(14612),Fi=n(98138),_i=n(2995);var Di=n(69123);const $i=1.125*Ue.Gw,qi=(0,o.X$)((e=>{let{topic:t,className:n,onClick:a}=e;const s=(0,Dt.Z)();return o.ZP.createElement("div",{className:(0,ut.Z)("wUl1jHjVuMxmGhsdl358",n),style:`--topic-button-accent-color: var(${(0,Fi.gZ)(t?.iconColor)})`,onClick:a},t?o.ZP.createElement(_i.Z,{topic:t,size:$i}):o.ZP.createElement("img",{src:Di,alt:""}),t?.title?(0,Jn.Z)(t.title):s("Loading"),t?.isClosed&&o.ZP.createElement("i",{className:"icon icon-lock"}),o.ZP.createElement("i",{className:"icon icon-next"}))})),Hi={__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>'},Gi={__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>'},Vi=1.75*Ue.Gw,Wi=2.25*Ue.Gw,zi=(0,o.X$)((0,a.c$)(((e,t)=>{const{focusedMessage:n,forwardMessages:a,activeReactions:s,activeEmojiInteractions:o}=(0,m.jU)(e),{lastSyncTime:r}=e,{message:c,album:d,withSenderName:u,withAvatar:h,threadId:p,messageListType:f,isLastInDocumentGroup:I,isFirstInGroup:v}=t,{id:w,chatId:b,viaBotId:Z,replyToChatId:P,replyToMessageId:y,isOutgoing:C,repliesThreadInfo:S,forwardInfo:E,transcriptionId:M,isPinned:R}=c,k=(0,m.Z1)(e,b),T=(0,m.FM)(e,b),A=(0,g.pK)(b),N=k&&(0,g.eA)(k),x=k&&(0,g.Bf)(k),B=k?.usernames,L=(0,g.YC)(b)?void 0:(0,m.x6)(e,b),U=a.messageIds&&a.messageIds.includes(w),j=!T&&(0,g.Ul)(c),O=u||h||j,F=(0,m.Ur)(e,c),_=(0,m.cv)(e,c),D=Z?(0,m.dy)(e,Z):void 0,$=F?.id&&x?L?.adminMembersById?.[F?.id]:void 0,q=p?(0,m.qS)(e,b,p):void 0,H=c.id===q,G=y===q,V=y&&!G?(0,m.hj)(e,A&&P?P:b,y):void 0,W=V&&(0,m.Bz)(e,V,Boolean(E)),z="topicCreate"===V?.content.action?.type,X=(0,m.uZ)(e,c),Y="thread"===f&&(d?d.messages.some((t=>(0,m._X)(e,t,p))):(0,m._X)(e,c,p)),{direction:J,noHighlight:K,isResizingContainer:Q}=Y&&n||{},{query:ee}=(0,m.n5)(e)||{},te=(0,g.h_)(c),ne=te&&(0,m.zB)(e,te)?te:void 0,ae=(0,g.HW)(c);let se;se=d?.messages?d.messages.every((t=>{let{id:n}=t;return(0,m.vk)(e,n)})):(0,m.vk)(e,w);const{canReply:ie}="thread"===f&&(0,m._k)(e,c,p)||{},oe=(0,m.te)(e,c),re=S?(0,m.tZ)(e,S.chatId,S.threadId)||S:void 0,ce=Boolean(c.groupedId)&&!c.isInAlbum,de=ce?(0,m.xH)(e,b,c.groupedId)[0]:void 0,le=ce?I?(0,m.hj)(e,b,de):void 0:c,ue=k?.unreadReactions?.includes(c.id),me=p===l._f&&k?.isForum&&v,he=me?(0,m.p$)(e,c)||k?.topics?.[i.OxA]:void 0,ge=Boolean((0,g.nf)(c)),pe=(0,m.xf)(e,b),fe=(0,m.xx)(e,b,c.id);return{theme:(0,m.Pu)(e),chatUsernames:B,forceSenderName:j,canShowSender:O,originSender:_,botSender:D,shouldHideReply:G||z,isThreadTop:H,replyMessage:V,replyMessageSender:W,isInDocumentGroup:ce,isProtected:(0,m.EV)(e,c),isChatProtected:(0,m.Am)(e,b),isFocused:Y,isForwarding:U,reactionMessage:le,isChatWithSelf:T,isRepliesChat:A,isChannel:N,isGroup:x,canReply:ie,lastSyncTime:r,highlight:ee,animatedEmoji:ne,animatedCustomEmoji:ae,isInSelectMode:(0,m.CA)(e),isSelected:se,isGroupSelected:Boolean(c.groupedId)&&!c.isInAlbum&&(0,m.a6)(e,b,c.groupedId),threadId:p,isDownloading:oe,isPinnedList:"pinned"===f,isPinned:R,canAutoLoadMedia:(0,m.bH)(e,c),canAutoPlayMedia:(0,m.__)(e,c),autoLoadFileMaxSizeMb:e.settings.byKey.autoLoadFileMaxSizeMb,shouldLoopStickers:(0,m.Cy)(e),repliesThreadInfo:re,availableReactions:e.availableReactions,defaultReaction:(0,g.CI)(c)?void 0:(0,m.q6)(e,b),activeReactions:le&&s[le.id],activeEmojiInteractions:o,hasUnreadReaction:ue,isTranscribing:void 0!==M&&e.transcriptions[M]?.isPending,transcribedText:void 0!==M?e.transcriptions[M]?.text:void 0,isPremium:(0,m.wV)(e),senderAdminMember:$,messageTopic:he,genericEffects:e.genericEmojiEffects,hasTopicChip:me,chatTranslations:pe,areTranslationsEnabled:e.settings.byKey.canTranslate,requestedTranslationLanguage:fe,hasLinkedChat:Boolean(L?.linkedChatId),withReactionEffects:(0,m.$Y)(e,"reactionEffects"),withStickerEffects:(0,m.$Y)(e,"stickerEffects"),...(O||ge)&&{sender:F},...C&&{outgoingStatus:(0,m.dT)(e,c,"scheduled"===f)},..."number"==typeof X&&{uploadProgress:X},...Y&&{focusDirection:J,noFocusHighlight:K,isResizingContainer:Q}}}))((e=>{let{message:t,chatUsernames:n,observeIntersectionForBottom:r,observeIntersectionForLoading:d,observeIntersectionForPlaying:u,album:m,noAvatars:h,withAvatar:p,withSenderName:f,noComments:I,noReplies:v,appearanceOrder:b,isJustAdded:P,isFirstInGroup:y,isPremium:C,isLastInGroup:S,isFirstInDocumentGroup:E,isLastInDocumentGroup:R,isTranscribing:k,transcribedText:T,isLastInList:A,theme:N,forceSenderName:x,sender:B,canShowSender:L,originSender:U,botSender:j,isThreadTop:O,shouldHideReply:F,replyMessage:_,replyMessageSender:D,outgoingStatus:$,uploadProgress:q,isInDocumentGroup:H,isProtected:G,isChatProtected:V,isFocused:W,focusDirection:z,noFocusHighlight:X,isResizingContainer:Y,isForwarding:J,isChatWithSelf:K,isRepliesChat:Q,isChannel:ee,isGroup:te,canReply:ne,lastSyncTime:ae,highlight:se,animatedEmoji:ie,animatedCustomEmoji:oe,genericEffects:re,hasLinkedChat:ce,isInSelectMode:de,isSelected:le,isGroupSelected:ue,threadId:me,reactionMessage:he,availableReactions:ge,defaultReaction:pe,activeReactions:fe,activeEmojiInteractions:Ie,messageListType:ve,isPinnedList:we,isPinned:be,isDownloading:Ze,canAutoLoadMedia:Pe,canAutoPlayMedia:ye,shouldLoopStickers:Ce,autoLoadFileMaxSizeMb:Se,repliesThreadInfo:Ee,hasUnreadReaction:Me,memoFirstUnreadIdRef:Re,senderAdminMember:ke,messageTopic:Te,hasTopicChip:Ae,chatTranslations:Ne,areTranslationsEnabled:xe,requestedTranslationLanguage:Be,withReactionEffects:Le,withStickerEffects:je,onPinnedIntersectionChange:Oe}=e;const{toggleMessageSelection:Fe,clickBotInlineButton:_e,disableContextMenuHint:De,animateUnreadReaction:$e,focusLastMessage:qe}=(0,a.Sv)(),He=(0,o.sO)(null),Ge=(0,o.sO)(null),Ve=(0,o.sO)(null),We=(0,o.sO)(0),ze=(0,Dt.Z)(),[Xe,Ye]=(0,o.eJ)(!1),[Je,Ke,Qe]=(0,Tt.Z)(),{isMobile:et}=(0,M.ZP)();(0,$a._N)(Ge,r);const{isContextMenuOpen:tt,contextMenuPosition:nt,contextMenuTarget:at,handleBeforeContextMenu:st,handleContextMenu:it,handleContextMenuClose:ot,handleContextMenuHide:rt}=(0,ya.Z)(He,s.$b&&de,!i.D$V,s.wZ);(0,o.d4)((()=>{tt&&De()}),[tt,De]);const ct=b<=0,[dt,lt]=(0,Tt.Z)(ct);(0,o.d4)((()=>{ct||setTimeout(lt,10*b)}),[b,lt,ct]);const{transitionClassNames:mt}=(0,St.Z)(dt||P,void 0,ct&&!P,!1),{id:ht,chatId:gt,forwardInfo:ft,viaBotId:It,isTranscriptionError:vt}=t;(0,o.d4)((()=>{if(!be)return;const e=m?m.mainMessage.id:ht;return()=>{Oe({viewportPinnedIdsToRemove:[e],isUnmount:!0})}}),[m,be,ht,Oe]);const bt=(0,g.CI)(t),Zt=(0,g.B4)(t),Pt="scheduled"===ve||t.isScheduled,yt=(0,g.ss)(t)&&!F,Ct=Boolean(Ee)&&"thread"===ve,Mt=(0,g.$D)(t),Rt=Mt&&(ie||oe),kt=he?.reactions&&!(0,g.JE)(he.reactions),At=ft&&(!K||Pt)&&!Q&&!ft.isLinkedChannelPost&&!Mt,Nt=Boolean(m)&&m.messages.length>1&&!m?.messages.some((e=>0===Object.keys(e.content).length)),xt=H&&!E,Bt=H&&!R,Lt=void 0!==nt,Ut=!(Lt||de||J||Bt),jt=ee&&!Pt&&t.isForwardingAllowed&&!V,Ot=Boolean(we||ft&&(ft.isChannelPost||K&&!Zt||Q)&&ft.fromMessageId),Ft=Ae||yt,_t=(0,pt.Z)(((e,t)=>{Fe({messageId:ht,groupedId:t,...e?.shiftKey&&{withShift:!0},...Nt&&{childMessageIds:m.messages.map((e=>{let{id:t}=e;return t}))}})})),$t=L?B:void 0,qt=Boolean(!Xe&&(vt||T)),Ht=ft&&(K||Q||!$t)?U:$t,Gt=ft?U:$t,{handleMouseDown:Vt,handleClick:Wt,handleContextMenu:zt,handleDoubleClick:Xt,handleContentDoubleClick:Yt,handleMouseMove:Kt,handleSendQuickReaction:Qt,handleMouseLeave:en,isSwiped:tn,isQuickReactionVisible:nn,handleDocumentGroupMouseEnter:an}=ls(_t,He,ht,0,Boolean(de),Boolean(ne),Boolean(G),it,st,gt,Lt,Ve,0,Bt),{handleAvatarClick:rn,handleSenderClick:cn,handleViaBotClick:dn,handleReplyClick:ln,handleMediaClick:un,handleAudioPlay:mn,handleAlbumMediaClick:hn,handleMetaClick:gn,handleTranslationClick:pn,handleOpenThread:fn,handleReadMedia:In,handleCancelUpload:vn,handleVoteSend:wn,handleGroupForward:bn,handleForward:Zn,handleFocus:Pn,handleFocusForwarded:yn,handleDocumentGroupSelectAll:Cn,handleTopicChipClick:Sn}=function(e,t,n,s,i,o,r,c,d,u,m,h,g,p){const{openChat:f,showNotification:I,focusMessage:v,openMediaViewer:b,openAudioPlayer:Z,markMessagesRead:P,cancelSendingMessage:y,sendPollVote:C,openForwardMenu:S,focusMessageInComments:E,openMessageLanguageModal:M}=(0,a.Sv)(),{id:R,forwardInfo:k,replyToMessageId:T,replyToChatId:A,replyToTopMessageId:N,groupedId:x}=n,B=(0,pt.Z)((()=>{m&&f({id:m.id})})),L=(0,pt.Z)((()=>{h?r&&k?.channelPostId?v({chatId:h.id,messageId:k.channelPostId}):f({id:h.id}):I({message:e("HidAccount")})})),U=(0,pt.Z)((()=>{g&&f({id:g.id})})),j=(0,pt.Z)((()=>{v({chatId:d&&A?A:s,threadId:i,messageId:T,replyMessageId:d&&A?void 0:R,noForumTopicPanel:!0})})),O=(0,pt.Z)((()=>{b({chatId:s,threadId:i,mediaId:R,origin:c?w.bZ.ScheduledInline:w.bZ.Inline})})),F=(0,pt.Z)((()=>{Z({chatId:s,messageId:R})})),_=(0,pt.Z)((e=>{b({chatId:s,threadId:i,mediaId:e,origin:c?w.bZ.ScheduledAlbum:w.bZ.Album})})),D=(0,pt.Z)((()=>{P({messageIds:[R]})})),$=(0,pt.Z)((()=>{y({chatId:s,messageId:R})})),q=(0,pt.Z)((e=>{C({chatId:s,messageId:R,options:e})})),H=(0,pt.Z)((()=>{S({fromChatId:s,groupedId:x})})),G=(0,pt.Z)((()=>{if(u&&u.messages){const e=u.messages.map((e=>{let{id:t}=e;return t}));S({fromChatId:s,messageIds:e})}else S({fromChatId:s,messageIds:[R]})})),V=(0,pt.Z)((()=>{v({chatId:s,threadId:l._f,messageId:R})})),W=(0,pt.Z)((()=>{o?v({chatId:k.fromChatId,groupedId:x,groupedChatId:s,messageId:k.fromMessageId}):d&&A?E({chatId:A,threadId:N,messageId:k.fromMessageId}):v({chatId:k.fromChatId,messageId:k.fromMessageId})})),z=(0,pt.Z)((e=>{e.stopPropagation(),t(e,x)}));return{handleAvatarClick:B,handleSenderClick:L,handleViaBotClick:U,handleReplyClick:j,handleMediaClick:O,handleAudioPlay:F,handleAlbumMediaClick:_,handleMetaClick:z,handleTranslationClick:(0,pt.Z)((e=>{e.stopPropagation(),M({chatId:s,id:R})})),handleOpenThread:(0,pt.Z)((()=>{f({id:n.chatId,threadId:n.id})})),handleReadMedia:D,handleCancelUpload:$,handleVoteSend:q,handleGroupForward:H,handleForward:G,handleFocus:V,handleFocusForwarded:W,handleDocumentGroupSelectAll:z,handleTopicChipClick:(0,pt.Z)((()=>{p&&v({chatId:d&&A?A:s,threadId:p.id,messageId:R})}))}}(ze,_t,t,gt,me,H,At,Pt,Q,m,Ht,Gt,j,Te);(0,o.d4)((()=>{A&&qt&&T&&qe()}),[qe,A,T,qt]);const En=(0,ut.Z)("Message message-list-item",y&&"first-in-group",G&&"is-protected",S&&"last-in-group",E&&"first-in-document-group",R&&"last-in-document-group",A&&"last-in-list",Zt&&"own",Boolean(t.views)&&"has-views",t.isEdited&&"was-edited",yt&&"has-reply",tt&&"has-menu-open",W&&!X&&"focused",J&&"is-forwarding",t.isDeleting&&"is-deleting",H&&"is-in-document-group",Nt&&"is-album",t.hasUnreadMention&&"has-unread-mention",le&&"is-selected",de&&"is-in-selection-mode",O&&!p&&"is-thread-top",Boolean(t.inlineButtons)&&"has-inline-buttons",tn&&"is-swiped",mt,P&&"is-just-added",(Boolean(fe)||Je)&&"has-active-reaction"),{text:Mn,photo:Rn,video:kn,audio:Tn,voice:An,document:Nn,sticker:xn,contact:Bn,poll:Ln,webPage:Un,invoice:jn,location:On,action:Fn,game:Dn}=(0,g.qp)(t),$n=function(e){const[t,n]=(0,o.eJ)();return(0,wt.Z)((()=>{e&&async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.2;return ps||await fs.promise,await ps.request({name:"detectLanguage",args:[e,t]})}(e).then(n)}),[e]),t}(xe?Mn?.text:void 0),{isPending:qn,translatedText:Hn}=function(e,t,n,s){const{translateMessages:i}=(0,a.Sv)(),r=s?e?.byLangCode[s]?.[n]:void 0,{isPending:c,text:d}=r||{};return(0,o.d4)((()=>{d||c||!s||i({chatId:t,messageIds:[n],toLanguageCode:s})}),[t,d,c,n,s,i]),{isPending:c,translatedText:d}}(Ne,gt,ht,Be),Vn=(0,_n.Z)(Hn,!0),Wn=qn?Vn||Mn:Hn,zn=Hn||Vn,{phoneCall:Xn}=Fn||{},Yn=(Ee||ce&&ee&&bt)&&!Bt&&"thread"===ve&&!I,Kn=Ee&&!Bt&&"thread"===ve&&!I,Qn=!s.$b&&!Xn&&!de&&pe&&!Bt,ea=function(e){let{hasSubheader:t,isCustomShape:n,isLastInGroup:a,asForwarded:s,hasThread:o,forceSenderName:r,hasComments:c,hasActionButton:d,hasReactions:l,isGeoLiveActive:u,withVoiceTranscription:m}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{text:h,photo:p,video:f,audio:I,voice:v,document:w,poll:b,webPage:Z,contact:P,location:y,invoice:C}=(0,g.qp)(e),S=[i.gnl],E=p||f||y||C?.extendedMedia,M=h||"venue"===y?.type||u,R=E&&!M,k=Boolean(e.viaBotId);return!E&&e.emojiOnlyCount?(S.push("emoji-only"),e.emojiOnlyCount<=i.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"),m&&S.push("with-voice-transcription")):w?S.push("document"):P?S.push("contact"):b?S.push("poll"):Z&&(S.push("web-page"),(Z.photo||Z.video)&&S.push("media")),C&&!C.extendedMedia&&S.push("invoice"),s&&S.push("is-forwarded"),t&&S.push("has-subheader"),o&&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||y&&!M||!R)&&S.push("has-appendix")),S.join(" ")}(t,{hasSubheader:Ft,isCustomShape:Mt,isLastInGroup:S,asForwarded:At,hasThread:Ct&&!I,forceSenderName:x,hasComments:Ee&&Ee.messagesCount>0,hasActionButton:jt||Ot,hasReactions:kt,isGeoLiveActive:"geoLive"===On?.type&&!(0,g.$R)(t,(0,Z.bp)()),withVoiceTranscription:qt}),ta=ea.includes("has-appendix"),na=(0,g.fY)(t),aa=(0,as.qo)(t.emojiOnlyCount);let sa,ia;sa=Xn||Bt?"none":!na||Un||Rt?"standalone":"in-text",kt?Mt||(Rn||kn)&&!na?ia="outside":At?(sa="standalone",ia="inside"):ia="inside":ia="none";const oa=Mt?"in-meta":"in-content";(0,Gn.Z)(Q&&t.replyToChatId?t.replyToChatId:gt,yt?t.replyToMessageId:void 0,_,t.id),ss(He,0,gt,W,z,X,Y,P);const ra=ee&&t.postAuthorTitle||!At&&ft?.postAuthorTitle||void 0;!function(e,t){(0,o.bt)((()=>{t&&(0,c.lT)((()=>{const t=e.current.querySelector(".message-signature")?.offsetWidth;if(t)return()=>{e.current.style.setProperty("--meta-safe-author-width",`${t}px`)}}))}),[e,t])}(He,ra);const ca=A,da=(0,pt.Z)((e=>{const t=We.current,n=e.contentRect.height;if(We.current=n,(0,Ua.Ni)()||!t||n<=t)return;const a=e.target.closest(".MessageList");if(!a)return;(0,Et.YW)(400);const s=n-t,{offsetHeight:i,scrollHeight:o,scrollTop:r}=a;Math.round(o-r-i)-s<=5&&qe()})),la=(0,os.Z)(da,[da],300,!1);(0,Da.Z)(He,la,!ca),(0,o.d4)((()=>{const e=Ge.current;Me&&e&&(0,ns.P)(e)&&$e({messageIds:[ht]})}),[Me,ht,$e]);let ua,ma,ha,ga="",pa=!1;const fa=(0,o.Ye)((()=>Nt?ts(Zt,Boolean(At),Boolean(h),m,et):void 0),[Nt,Zt,At,h,m,et]),Ia=At?28:0;if(!Nt&&(Rn||kn||jn?.extendedMedia)){let e;if(Rn)e=Ka(t,At,h,et).width;else if(kn)e=kn.isRound?Ue.Rj:Ka(t,At,h,et).width;else if(jn?.extendedMedia&&jn.extendedMedia.width&&jn.extendedMedia.height){const{width:t,height:n}=jn.extendedMedia;e=(0,Ue.Kf)({width:t,height:n,fromOwnMessage:Zt,asForwarded:At,noAvatars:h,isMobile:et}).width}e&&(e<(Yn?Va:Wa)&&(ha=e),ua=Math.max(Ja(Boolean(Wn),Yn),e),jn?.extendedMedia&&ua-e>18&&(pa=!0))}else fa&&(ua=Math.max(Ja(Boolean(Wn),Yn),fa.containerStyle.width),ua-fa.containerStyle.width>18&&(pa=!0));if(ua)ga=`width: ${ua+Ia}px`,ma=ua+Wi;else if(xn&&!Ft){const{width:e}=(0,Ue.Wr)(xn,et);ga=`width: ${e+Ia}px`,ma=e+Wi}function va(e){return o.ZP.createElement(Oi.Z,{message:t,translatedText:Be?zn:void 0,isForAnimation:e,emojiSize:aa,highlight:se,isProtected:G,observeIntersectionForLoading:d,observeIntersectionForPlaying:u,withTranslucentThumbs:Mt})}function wa(){if(pe)return o.ZP.createElement("div",{className:(0,ut.Z)("quick-reaction",nn&&!fe&&"visible"),onClick:Qt,ref:Ve},o.ZP.createElement(Ri.Z,{reaction:pe,size:Vi,availableReactions:ge,observeIntersection:u}))}function ba(){const e=o.ZP.createElement(Rs,{message:t,isPinned:be,noReplies:v,repliesThreadInfo:Ee,outgoingStatus:$,signature:ra,withReactionOffset:"inside"===ia,renderQuickReactionButton:Qn&&"in-meta"===oa?wa:void 0,availableReactions:ge,isTranslated:Boolean(Be?zn:void 0),onClick:gn,onTranslationClick:pn,onOpenThread:fn});return"inside"!==ia?e:o.ZP.createElement(Bi,{activeReactions:fe,message:he,metaChildren:e,availableReactions:ge,genericEffects:re,observeIntersection:u,noRecentReactors:ee,withEffects:Le})}const Za=te&&At?t.postAuthorTitle:void 0,Pa=(0,o.Ye)((()=>n?.find((e=>e.isActive))),[n]);return o.ZP.createElement("div",{ref:He,id:(0,g.d0)(t.id),className:En,"data-message-id":ht,onMouseDown:Vt,onClick:Wt,onContextMenu:zt,onDoubleClick:Xt,onMouseEnter:Bt?an:void 0,onMouseMove:Qn?Kt:void 0,onMouseLeave:Qn||Bt?en:void 0},o.ZP.createElement("div",{ref:Ge,className:"bottom-marker","data-message-id":ht,"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":Me||void 0,"data-is-pinned":be||void 0,"data-should-update-views":void 0!==t.views}),!H&&o.ZP.createElement("div",{className:"message-select-control"},le&&o.ZP.createElement("i",{className:"icon icon-select"})),R&&o.ZP.createElement("div",{className:(0,ut.Z)("message-select-control group-select",ue&&"is-selected"),onClick:Cn},ue&&o.ZP.createElement("i",{className:"icon icon-select"})),p&&function(){const e=Ht&&(0,g.YC)(Ht.id),t=Ht&&e?Ht:void 0,n=Ht&&!e?Ht:void 0,a=!Ht&&ft?ft.hiddenUserName:void 0;return o.ZP.createElement(Is.Z,{size:et?"small-mobile":"small",user:t,chat:n,text:a,lastSyncTime:ae,onClick:t||n?rn:void 0})}(),o.ZP.createElement("div",{className:(0,ut.Z)("message-content-wrapper",ea.includes("text")&&"can-select-text")},o.ZP.createElement("div",{className:ea,style:ga,dir:"auto"},At&&!xt&&o.ZP.createElement("div",{className:"message-title"},ze("ForwardedMessage"),Za&&o.ZP.createElement("span",{className:"admin-title",dir:"auto"},Za)),function(){const e=(0,ut.Z)("content-inner",At&&"forwarded-message",Ft&&"with-subheader",pa&&"no-media-corners"),n=S&&!na&&!At&&!Kn,a=(0,ut.Z)("text-content","clearfix","in-text"===sa&&"with-meta",$&&"with-outgoing-icon");return o.ZP.createElement("div",{className:e,onDoubleClick:Yt,dir:"auto"},function(){if(Mt&&!It||!(f&&(!(Rn||kn||On)||Ae)||At||It||x)||xt||yt&&Mt)return;let e,n;!Gt||Mt&&It?ft?.hiddenUserName&&(e=ft.hiddenUserName):(e=(0,g.OU)(ze,Gt),At||Zt||(n=`color-${(0,g.Rs)(Gt)}`));const a=Gt&&"emojiStatus"in Gt&&Gt.emojiStatus,s=Gt&&"isPremium"in Gt&&Gt.isPremium;return o.ZP.createElement("div",{className:"message-title",dir:"ltr"},e?o.ZP.createElement("span",{className:(0,ut.Z)("message-title-name interactive",n),onClick:cn,dir:"ltr"},(0,Jn.Z)(e),!At&&a&&o.ZP.createElement(sn.Z,{documentId:a.documentId,loopLimit:i.y3O,observeIntersectionForLoading:d,observeIntersectionForPlaying:u}),!At&&!a&&s&&o.ZP.createElement(on.Z,null),Gt?.fakeType&&o.ZP.createElement(ji.Z,{fakeType:Gt.fakeType})):j?void 0:" ",j&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("span",{className:"via"},ze("ViaBot")),o.ZP.createElement("span",{className:"interactive",onClick:dn},(0,Jn.Z)(`@${j.usernames[0].username}`))),ft?.isLinkedChannelPost?o.ZP.createElement("span",{className:"admin-title",dir:"auto"},ze("DiscussChannel")):t.forwardInfo?.postAuthorTitle&&te&&At?o.ZP.createElement("span",{className:"admin-title",dir:"auto"},t.forwardInfo?.postAuthorTitle):t.postAuthorTitle&&te&&!At?o.ZP.createElement("span",{className:"admin-title",dir:"auto"},t.postAuthorTitle):!ke||At||It?void 0:o.ZP.createElement("span",{className:"admin-title",dir:"auto"},ke.customTitle||ze(ke.isOwner?"GroupInfo.LabelOwner":"GroupInfo.LabelAdmin")))}(),Ft&&o.ZP.createElement("div",{className:"message-subheader"},Ae&&o.ZP.createElement(qi,{topic:Te,onClick:Sn,className:"message-topic"}),yt&&o.ZP.createElement(Cs,{message:_,noUserColors:Zt||ee,isProtected:G,sender:D,observeIntersectionForLoading:d,observeIntersectionForPlaying:u,onClick:ln})),xn&&o.ZP.createElement(As,{message:t,observeIntersection:d,observeIntersectionForPlaying:u,shouldLoop:Ce,lastSyncTime:ae,shouldPlayEffect:xn.hasEffect&&(Re.current&&ht>=Re.current||bt)||void 0,withEffect:je,onPlayEffect:Ke,onStopEffect:Qe}),Rt&&oe&&o.ZP.createElement(js,{customEmojiId:oe,withEffects:je&&(0,g.YC)(gt),isOwn:Zt,observeIntersection:d,lastSyncTime:ae,forceLoadPreview:bt,messageId:ht,chatId:gt,activeEmojiInteractions:Ie}),Rt&&ie&&o.ZP.createElement(Us,{emoji:ie,withEffects:je&&(0,g.YC)(gt),isOwn:Zt,observeIntersection:d,lastSyncTime:ae,forceLoadPreview:bt,messageId:ht,chatId:gt,activeEmojiInteractions:Ie}),Nt&&o.ZP.createElement(Pi,{album:m,albumLayout:fa,observeIntersection:d,isOwn:Zt,isProtected:G,hasCustomAppendix:n,lastSyncTime:ae,onMediaClick:hn}),Xn&&o.ZP.createElement(Li,{message:t,phoneCall:Xn,chatId:gt}),!Nt&&Rn&&o.ZP.createElement(Gs,{message:t,observeIntersection:d,noAvatars:h,canAutoLoad:Pe,uploadProgress:q,shouldAffectAppendix:n,isDownloading:Ze,isProtected:G,asForwarded:At,theme:N,forcedWidth:ha,onClick:un,onCancelUpload:vn}),!Nt&&kn&&kn.isRound&&o.ZP.createElement(Ci,{message:t,observeIntersection:d,canAutoLoad:Pe,lastSyncTime:ae,isDownloading:Ze}),!Nt&&kn&&!kn.isRound&&o.ZP.createElement(Ws,{message:t,observeIntersectionForLoading:d,observeIntersectionForPlaying:u,forcedWidth:ha,noAvatars:h,canAutoLoad:Pe,canAutoPlay:ye,uploadProgress:q,lastSyncTime:ae,isDownloading:Ze,isProtected:G,asForwarded:At,onClick:un,onCancelUpload:vn}),(Tn||An)&&o.ZP.createElement(Es.ZP,{theme:N,message:t,origin:w.Cr.Inline,uploadProgress:q,lastSyncTime:ae,isSelectable:H,isSelected:le,noAvatars:h,onPlay:mn,onReadMedia:!An||Zt&&!K?void 0:In,onCancelUpload:vn,isDownloading:Ze,isTranscribing:k,isTranscriptionHidden:Xe,isTranscribed:Boolean(T),isTranscriptionError:vt,canDownload:!G,onHideTranscription:Ye,canTranscribe:C}),Nn&&o.ZP.createElement(Ss.Z,{message:t,observeIntersection:d,canAutoLoad:Pe,autoLoadFileMaxSizeMb:Se,uploadProgress:q,isSelectable:H,isSelected:le,onMediaClick:un,onCancelUpload:vn,isDownloading:Ze}),Bn&&o.ZP.createElement(Xs,{contact:Bn}),Ln&&o.ZP.createElement(ai,{message:t,poll:Ln,onSendVote:wn}),Dn&&o.ZP.createElement(vi,{message:t,canAutoLoadMedia:Pe,lastSyncTime:ae}),jn?.extendedMedia&&o.ZP.createElement(li,{message:t,lastSyncTime:ae}),qt&&o.ZP.createElement("p",{className:(0,ut.Z)("transcription",!Xe&&vt&&"transcription-error"),dir:"auto"},vt?ze("NoWordsRecognized"):k&&T?o.ZP.createElement(Ui.Z,{content:T}):T),!Rt&&na&&o.ZP.createElement("div",{className:a,dir:"auto"},va(),qn&&o.ZP.createElement("div",{className:"translation-animation"},o.ZP.createElement("div",{className:"text-loading"},va(!0))),"in-text"===sa&&ba()),Un&&o.ZP.createElement(oi,{message:t,observeIntersection:d,noAvatars:h,canAutoLoad:Pe,canAutoPlay:ye,asForwarded:At,lastSyncTime:ae,isDownloading:Ze,isProtected:G,theme:N,onMediaClick:un,onCancelMediaTransfer:vn}),jn&&!jn.extendedMedia&&o.ZP.createElement(ci,{message:t,shouldAffectAppendix:n,isInSelectMode:de,isSelected:le,theme:N,forcedWidth:ha}),On&&o.ZP.createElement(Ii,{message:t,lastSyncTime:ae,isInSelectMode:de,isSelected:le,theme:N,peer:B}))}(),!Bt&&"standalone"===sa&&ba(),Ut&&jt?o.ZP.createElement(Jt.Z,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:ze("lng_context_forward_msg"),onClick:R?bn:Zn},o.ZP.createElement("i",{className:"icon icon-share-filled"})):Ut&&Ot?o.ZP.createElement(Jt.Z,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:"Focus message",onClick:we?Pn:yn},o.ZP.createElement("i",{className:"icon icon-arrow-right"})):void 0,Kn&&o.ZP.createElement(Ei,{threadInfo:Ee,disabled:I}),ta&&o.ZP.createElement("div",{className:"svg-appendix",dangerouslySetInnerHTML:Zt?Hi:Gi}),Qn&&"in-content"===oa&&wa()),t.inlineButtons&&o.ZP.createElement(Si,{message:t,onClick:_e}),"outside"===ia&&o.ZP.createElement(Bi,{message:he,isOutside:!0,maxWidth:ma,activeReactions:fe,availableReactions:ge,genericEffects:re,observeIntersection:u,noRecentReactors:ee,withEffects:Le})),nt&&o.ZP.createElement(ws,{isOpen:tt,anchor:nt,targetHref:at?.matches("a[href]")?at.href:void 0,message:t,album:m,chatUsername:Pa?.username,messageListType:ve,onClose:ot,onCloseAnimationEnd:rt,repliesThreadInfo:Ee,noReplies:v,detectedLanguage:$n}))}))),Xi=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,At.Z)(gt.gl.Extra,"AboutAdsModal",!t);return n?o.ZP.createElement(n,e):void 0})),Yi=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,At.Z)(gt.gl.Extra,"SponsoredMessageContextMenuContainer",!t);return n?o.ZP.createElement(n,e):void 0})),Ji=(0,o.X$)((0,a.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,m.fS)(e,n),{chatId:s,isBot:i}=a||{};return{message:a,bot:s&&i?(0,m.dy)(e,s):void 0,channel:!i&&s?(0,m.Z1)(e,s):void 0}}))((e=>{let{chatId:t,message:n,containerRef:i,bot:r,channel:c}=e;const{viewSponsoredMessage:d,openChat:l,openChatByInvite:u,startBot:m,focusMessage:h}=(0,a.Sv)(),p=(0,Dt.Z)(),f=(0,o.sO)(null),I=(0,o.sO)(null),v=Boolean(n),{observe:w}=(0,$a.S1)({rootRef:i,debounceMs:200,threshold:1}),{isContextMenuOpen:b,contextMenuPosition:Z,handleBeforeContextMenu:P,handleContextMenu:y,handleContextMenuClose:C,handleContextMenuHide:S}=(0,ya.Z)(f,s.$b,!0,s.wZ),[E,M,R]=(0,Tt.Z)(!1);(0,o.d4)((()=>v?w(I.current,(e=>{e.isIntersecting&&d({chatId:t})})):void 0),[t,v,w,d]);const k=(0,pt.Z)((()=>{n&&(n.chatInviteHash?u({hash:n.chatInviteHash}):n.channelPostId?h({chatId:n.chatId,messageId:n.channelPostId}):(l({id:n.chatId}),n.startParam&&m({botId:n.chatId,param:n.startParam})))}));if(n)return o.ZP.createElement("div",{ref:f,key:"sponsored-message",className:"SponsoredMessage Message open",onMouseDown:e=>{(0,Ba.q)(e),P(e)},onContextMenu:y},o.ZP.createElement("div",{className:"message-content has-shadow has-solid-background",dir:"auto"},o.ZP.createElement("div",{className:"content-inner",dir:"auto"},o.ZP.createElement("div",{className:"message-title",dir:"ltr"},r&&(0,Jn.Z)((0,g.Js)(r)||""),c&&(0,Jn.Z)(n.chatInviteTitle||(0,g.U)(p,c)||"")),o.ZP.createElement("div",{className:"text-content with-meta",dir:"auto",ref:I},o.ZP.createElement("span",{className:"text-content-inner",dir:"auto"},(0,Ys.H)({text:n.text.text,entities:n.text.entities})),o.ZP.createElement("span",{className:"MessageMeta",dir:"ltr"},o.ZP.createElement("span",{className:"message-signature"},n.isRecommended?p("Message.RecommendedLabel"):p("SponsoredMessage")))),o.ZP.createElement(Jt.Z,{color:"secondary",size:"tiny",ripple:!0,onClick:k,className:"SponsoredMessage__button"},p(n.isBot?"Conversation.ViewBot":n.channelPostId?"Conversation.ViewPost":"Conversation.ViewChannel")))),Z&&o.ZP.createElement(Yi,{isOpen:b,anchor:Z,message:n,onAboutAds:M,onClose:C,onCloseAnimationEnd:S}),o.ZP.createElement(Xi,{isOpen:E,onClose:R}))}))),Ki=(0,o.X$)((e=>{let{isCurrentUserPremium:t,chatId:n,threadId:r,messageIds:d,messageGroups:u,getContainerHeight:m,isViewportNewest:h,isUnread:p,isComments:f,withUsers:I,isChannelChat:v,noAvatars:Z,containerRef:P,anchorIdRef:y,memoUnreadDividerBeforeIdRef:C,memoFirstUnreadIdRef:S,type:E,isReady:R,threadTopMessageId:k,hasLinkedChat:T,isSchedule:A,noAppearanceAnimation:N,onFabToggle:x,onNotchToggle:B,onPinnedIntersectionChange:U}=e;const{openHistoryCalendar:j}=(0,a.Sv)(),{observeIntersectionForReading:O,observeIntersectionForLoading:F,observeIntersectionForPlaying:_}=function(e,t,n,s,i){const{markMessageListRead:o,markMentionsRead:r,animateUnreadReaction:c,scheduleForViewsIncrement:d}=(0,a.Sv)(),{isMobile:l}=(0,M.ZP)(),u=l?300:500,{observe:m,freeze:h,unfreeze:g}=(0,$a.S1)({rootRef:t,throttleMs:150},(t=>{if("thread"!==e)return;let a=0;const l=[],u=[],m=[],h=[],g=[];let p=!1;t.forEach((e=>{const{isIntersecting:t,target:n,boundingClientRect:s,rootBounds:i}=e,{dataset:o}=n,r=Number(o.lastMessageId||o.messageId),c="true"===o.shouldUpdateViews,d=o.albumMainId?Number(o.albumMainId):void 0;t?(r>a&&(a=r),o.hasUnreadMention&&l.push(r),o.hasUnreadReaction&&u.push(r),o.isPinned&&m.push(d||r),c&&g.push(d||r)):o.isPinned&&(i&&s.bottom<i.top&&(p=!0),h.push(d||r))})),n.current&&a>=n.current&&o({maxId:a}),l.length&&r({messageIds:l}),u.length&&c({messageIds:u}),(m.length||h.length)&&s({viewportPinnedIdsToAdd:m,viewportPinnedIdsToRemove:h,isReversed:p}),g.length&&d({chatId:i,ids:g})}));(0,It.Z)(h,g);const{observe:p}=(0,$a.S1)({rootRef:t,throttleMs:Ga,margin:u}),{observe:f}=(0,$a.S1)({rootRef:t,throttleMs:Ga});return{observeIntersectionForReading:m,observeIntersectionForLoading:p,observeIntersectionForPlaying:f}}(E,P,S,U,n),{backwardsTriggerRef:D,forwardsTriggerRef:$,fabTriggerRef:q}=function(e,t,n,i,r,d,l,u,m){const{loadViewportMessages:h}=(0,a.Sv)(),[p,f]=(0,o.Ye)((()=>"thread"===e?[(0,L.Ds)((()=>h({direction:w.Uq.Backwards})),1e3,!0,!1),(0,L.Ds)((()=>h({direction:w.Uq.Forwards})),1e3,!0,!1)]:[]),[h,n]),I=(0,o.sO)(null),v=(0,o.sO)(null),b=(0,o.sO)(null);function Z(){if(!m)return;if(!n||!n.length)return l(!1),void u(!1);if(!r)return l(!0),void u(!0);const e=t.current;if(!e)return;const{offsetHeight:a,scrollHeight:s,scrollTop:i}=e,o=Math.round(s-i-a),c=o<=1;0!==s&&(l(d?!c:!(o<=50)),u(!c))}const{observe:P}=(0,$a.S1)({rootRef:t,margin:s.gZ},(e=>{if(!f||!p)return;if((0,g.AJ)(n[0]))return;const t=e.find((e=>{let{isIntersecting:t}=e;return t}));if(!t)return;const{target:a}=t;"backwards-trigger"===a.className?p():"forwards-trigger"===a.className&&f()}));(0,$a._N)(I,P),(0,$a._N)(v,P);const{observe:y,freeze:C,unfreeze:S}=(0,$a.S1)({rootRef:t,margin:100,throttleScheduler:c.i$},Z);(0,$a._N)(b,y);const{observe:E,freeze:M,unfreeze:R}=(0,$a.S1)({rootRef:t,margin:1,throttleScheduler:c.i$},Z);(0,$a._N)(b,E);const k=(0,ja.Y)(Z);(0,o.d4)((()=>{m&&k.current()}),[m,k]);const T=(0,pt.Z)((()=>{C(),M(),setTimeout((()=>{R(),S()}),350)}));(0,wt.Z)(T,[T,n]);const A=(0,Ha.Vr)(i,200);return(0,qa.b)(T,[T,A]),{backwardsTriggerRef:I,forwardsTriggerRef:v,fabTriggerRef:b}}(E,P,d,m,h,p,x,B,R),H=(0,Dt.Z)(),G=o.ZP.createElement("div",{className:(0,ut.Z)("unread-divider","local-action-message"),key:"unread-messages"},o.ZP.createElement("span",null,H("UnreadMessages"))),V=N?0:u.reduce(((e,t)=>e+t.senderGroups.flat().length),0);let W=0;const z=(0,_n.Z)(d),X=Boolean(d&&z&&d[d.length-2]===z[z.length-1]),Y=u.map(((e,t,n)=>{const a=e.senderGroups.map(((e,a,s)=>{if(1===e.length&&!Na(e[0])&&(0,g.FT)(e[0])&&!e[0].content.action?.phoneCall){const i=e[0],c=a===s.length-1&&t===n.length-1;return(0,b.oA)([i.id===C.current&&G,o.ZP.createElement(ys,{key:i.id,message:i,threadId:r,messageListType:E,isInsideTopic:Boolean(r&&r!==l._f),observeIntersectionForReading:O,observeIntersectionForLoading:F,observeIntersectionForPlaying:_,memoFirstUnreadIdRef:S,appearanceOrder:V-++W,isJustAdded:c&&X,isLastInList:c,onPinnedIntersectionChange:U})])}let i;return e.map(((c,d)=>{const u=Na(c)?c.mainMessage:c,m=Na(c)?c:void 0,h=(0,g.B4)(u),p=Na(c),w=e[d+1];u.previousLocalId&&y.current===(0,g.d0)(u.previousLocalId)&&(y.current=(0,g.d0)(u.id));const P=!p&&u.groupedId?u.groupedId:void 0,M=w&&!Na(w)?w.groupedId:void 0,R={isFirstInGroup:0===d,isLastInGroup:d===e.length-1,isFirstInDocumentGroup:Boolean(P&&P!==i),isLastInDocumentGroup:Boolean(P&&P!==M),isLastInList:d===e.length-1&&a===s.length-1&&t===n.length-1};i=P;const A=(0,g.KK)(u),N=(0,g.jM)(u)?`${u.date}_${A}`:A,x=!1===T||!v,B=u.id===k;return(0,b.oA)([u.id===C.current&&G,o.ZP.createElement(zi,{key:N,message:u,observeIntersectionForBottom:O,observeIntersectionForLoading:F,observeIntersectionForPlaying:_,album:m,noAvatars:Z,withAvatar:R.isLastInGroup&&I&&!h&&(!B||!f),withSenderName:R.isFirstInGroup&&I&&!h,threadId:r,messageListType:E,noComments:x,noReplies:!x||r!==l._f,appearanceOrder:V-++W,isJustAdded:R.isLastInList&&X,isFirstInGroup:R.isFirstInGroup,isLastInGroup:R.isLastInGroup,isFirstInDocumentGroup:R.isFirstInDocumentGroup,isLastInDocumentGroup:R.isLastInDocumentGroup,isLastInList:R.isLastInList,memoFirstUnreadIdRef:S,onPinnedIntersectionChange:U}),u.id===k&&o.ZP.createElement("div",{className:"local-action-message",key:"discussion-started"},o.ZP.createElement("span",null,H("DiscussionStarted")))])})).flat()}));return o.ZP.createElement("div",{className:"message-date-group",key:e.datetime,onMouseDown:Ba.q,teactFastList:!0},o.ZP.createElement("div",{className:(0,ut.Z)("sticky-date",!A&&"interactive"),key:"date-header",onMouseDown:Ba.q,onClick:A?void 0:()=>j({selectedAt:e.datetime})},o.ZP.createElement("span",{dir:"auto"},A&&e.originalDate===i.t4X&&H("MessageScheduledUntilOnline"),A&&e.originalDate!==i.t4X&&H("MessageScheduledOn",(0,he.j1)(H,e.datetime,void 0,!0)),!A&&(0,he.j1)(H,e.datetime))),a.flat())}));return o.ZP.createElement("div",{className:"messages-container",teactFastList:!0},o.ZP.createElement("div",{ref:D,key:"backwards-trigger",className:"backwards-trigger"}),Y.flat(),!t&&h&&o.ZP.createElement(Ji,{key:n,chatId:n,containerRef:P}),o.ZP.createElement("div",{ref:$,key:"forwards-trigger",className:"forwards-trigger"}),o.ZP.createElement("div",{ref:q,key:"fab-trigger",className:"fab-trigger"}))}));var Qi=n(73547);const eo=(0,o.X$)((0,a.c$)(((e,t)=>{let{userId:n}=t;const{stickers:a}=e.stickers.greeting,s=(0,g.db)(n)+(0,g.db)(e.currentUserId),i=a?.length?a[s%a.length]:void 0,o=(0,m.Z1)(e,n);return o?{sticker:i,lastUnreadMessageId:o.lastMessage&&o.lastMessage.id!==o.lastReadInboxMessageId?o.lastMessage.id:void 0,connectionState:e.connectionState,currentMessageList:(0,m.Bt)(e)}:{}}))((e=>{let{sticker:t,connectionState:n,lastUnreadMessageId:s,currentMessageList:i}=e;const{loadGreetingStickers:r,sendMessage:c,markMessageListRead:d}=(0,a.Sv)(),l=(0,Dt.Z)(),u=(0,o.sO)(null),{observe:m}=(0,$a.S1)({rootRef:u,debounceMs:200});(0,o.d4)((()=>{t||"connectionStateReady"!==n||r()}),[n,r,t]),(0,o.d4)((()=>{"connectionStateReady"===n&&s&&d({maxId:s})}),[n,d,s]);const h=(0,pt.Z)((e=>{i&&(e={...e,isPreloadedGlobally:!0},c({sticker:e,messageList:i}))}));return o.ZP.createElement("div",{className:"ContactGreeting",ref:u},o.ZP.createElement("div",{className:"wrapper"},o.ZP.createElement("p",{className:"title",dir:"auto"},l("Conversation.EmptyPlaceholder")),o.ZP.createElement("p",{className:"description",dir:"auto"},l("Conversation.GreetingText")),o.ZP.createElement("div",{className:"sticker"},t&&o.ZP.createElement(Qi.Z,{sticker:t,onClick:h,clickArg:t,observeIntersection:m,size:160,className:"large",noContextMenu:!0,isCurrentUserPremium:!0}))))}))),to=3*Ue.Gw,no=(0,o.X$)((e=>{let{isChatWithSelf:t,type:n,isGroupChatJustCreated:a,topic:s}=e;const i=(0,Dt.Z)();return"scheduled"===n?function(e){return o.ZP.createElement("div",{className:"empty"},o.ZP.createElement("span",null,e("ScheduledMessages.EmptyPlaceholder")))}(i):t?function(e){return o.ZP.createElement("div",{className:"NoMessages"},o.ZP.createElement("div",{className:"wrapper"},o.ZP.createElement("i",{className:"icon no-messages-icon icon-cloud-download"}),o.ZP.createElement("h3",{className:"title"},e("Conversation.CloudStorageInfo.Title")),o.ZP.createElement("ul",{className:"description"},o.ZP.createElement("li",null,e("Conversation.ClousStorageInfo.Description1")),o.ZP.createElement("li",null,e("Conversation.ClousStorageInfo.Description2")),o.ZP.createElement("li",null,e("Conversation.ClousStorageInfo.Description3")),o.ZP.createElement("li",null,e("Conversation.ClousStorageInfo.Description4")))))}(i):a?function(e){return o.ZP.createElement("div",{className:"NoMessages"},o.ZP.createElement("div",{className:"wrapper",dir:e.isRtl?"rtl":void 0},o.ZP.createElement("h3",{className:"title"},e("EmptyGroupInfo.Title")),o.ZP.createElement("p",{className:"description"},e("EmptyGroupInfo.Subtitle")),o.ZP.createElement("ul",{className:"list-checkmarks"},o.ZP.createElement("li",null,e("EmptyGroupInfo.Line1")),o.ZP.createElement("li",null,e("EmptyGroupInfo.Line2")),o.ZP.createElement("li",null,e("EmptyGroupInfo.Line3")),o.ZP.createElement("li",null,e("EmptyGroupInfo.Line4")))))}(i):s?function(e,t){return o.ZP.createElement("div",{className:"NoMessages"},o.ZP.createElement("div",{className:"wrapper"},o.ZP.createElement(_i.Z,{topic:t,size:to,className:"no-messages-icon topic-icon"}),o.ZP.createElement("h3",{className:"title"},e("Chat.EmptyTopicPlaceholder.Title")),o.ZP.createElement("p",{className:"description topic-description"},(0,Jn.Z)(e("Chat.EmptyTopicPlaceholder.Text"),["br"]))))}(i,s):o.ZP.createElement("div",{className:"empty"},o.ZP.createElement("span",null,i("NoMessages")))})),ao=(0,L.Ds)((e=>e()),200,!1),so=(0,o.X$)((0,a.c$)(((e,t)=>{let{chatId:n,threadId:a,type:s}=t;const o=(0,m.Z1)(e,n);if(!o)return{};const r=(0,m.$W)(e,n,a,s),c="scheduled"===s?(0,m.yB)(e,n):(0,m.Zw)(e,n),d=(0,m.qS)(e,n,a),u=(0,m.tZ)(e,n,a);if(!(a===l._f||o?.isForum||c&&d&&c[d]))return{};const{isRestricted:h,restrictionReason:p,lastMessage:f}=o,I=(0,m.G$)(e,n),v=a===l._f&&!r&&!o.unreadCount&&!I&&f&&!f.groupedId,w=(0,m.IK)(e,n);let b,Z=!1;if((0,m.pk)(e,n)){const t=(0,m.iF)(e,w.id);t?b=t.botInfo:Z=!0}const P=o.topics?.[a],y=(0,g.YC)(n)?void 0:(0,m.x6)(e,n);return{isCurrentUserPremium:(0,m.wV)(e),isChatLoaded:!0,isRestricted:h,restrictionReason:p,isChannelChat:(0,g.eA)(o),isGroupChat:(0,g.Bf)(o),isCreator:o.isCreator,isChatWithSelf:(0,m.FM)(e,n),isRepliesChat:(0,g.pK)(n),isBot:Boolean(w),messageIds:r,messagesById:c,isComments:Boolean(u?.originChannelId),firstUnreadId:(0,m.It)(e,n,a),isViewportNewest:"thread"!==s||(0,m.b9)(e,n,a),threadFirstMessageId:(0,m.yZ)(e,n,a),focusingId:I,isSelectModeActive:(0,m.CA)(e),isLoadingBotInfo:Z,botInfo:b,threadTopMessageId:d,hasLinkedChat:y?Boolean(y.linkedChatId):void 0,lastSyncTime:e.lastSyncTime,topic:P,noMessageSendingAnimation:!(0,m.$Y)(e,"messageSendingAnimations"),isServiceNotificationsChat:n===i.awM,...v&&{lastMessage:f}}}))((e=>{let{chatId:t,threadId:n,type:d,hasTools:u,onFabToggle:h,onNotchToggle:p,isCurrentUserPremium:f,isChatLoaded:I,isChannelChat:v,isGroupChat:Z,canPost:P,isReady:y,isChatWithSelf:C,isRepliesChat:S,isCreator:E,isBot:M,messageIds:R,messagesById:k,firstUnreadId:T,isComments:A,isViewportNewest:N,threadFirstMessageId:x,isRestricted:B,restrictionReason:U,focusingId:j,isSelectModeActive:O,lastMessage:F,isLoadingBotInfo:_,botInfo:D,threadTopMessageId:$,hasLinkedChat:q,lastSyncTime:H,withBottomShift:G,withDefaultBg:V,topic:W,noMessageSendingAnimation:z,isServiceNotificationsChat:X,onPinnedIntersectionChange:Y,getForceNextPinnedInHeader:J}=e;const{loadViewportMessages:K,setScrollOffset:Q,loadSponsoredMessages:ee,loadMessageReactions:te,copyMessagesByIds:ne,loadMessageViews:ae}=(0,a.Sv)(),se=(0,o.sO)(null),ie=(0,o.sO)("thread"===d&&(0,m.Vt)((0,a.Rd)(),t,n)||(0,m.T6)((0,a.Rd)(),t,n)||0),oe=(0,o.sO)(),re=(0,o.sO)(),ce=(0,o.sO)(),de=(0,o.sO)(),le=(0,o.sO)(),ue=(0,o.sO)(),me=(0,o.sO)(!1),he=(0,o.sO)(Boolean(F)),ge=(0,rn.Z)(D?.photo?(0,g.NF)(D.photo):void 0),pe=(0,rn.Z)(D?.gif?(0,g.ym)(D.gif):void 0),fe=D?.photo?(0,g.bV)(D.photo):D?.gif?(0,g.jC)(D.gif):void 0,Ie=fe&&{width:fe.width/s.cL,height:fe.height/s.cL},ve=Boolean(R);(0,wt.Z)((()=>{ve&&(0,L.R3)((()=>{he.current=!1}))}),[ve]),(0,wt.Z)((()=>{de.current=T}),[T]),(0,o.d4)((()=>{!f&&v&&y&&H&&ee({chatId:t})}),[f,t,y,v,H,ee]),(0,wt.Z)((()=>{ve&&(le.current=de.current)}),[ve]),(0,wt.Z)((()=>{ue.current=j}),[j]),(e=>{(0,Ft.y)({"Mod+C":function(t){const n=(0,Fa.Z)();n&&n.length>1&&(t.preventDefault(),e({messageIds:n}))}})})(ne);const we=(0,o.Ye)((()=>{if(!R||!k)return;const e=!$||x===$||R[0]&&x!==R[0]?R:[$,...R];if(!e.length)return;const t=e.map((e=>k[e])).filter(Boolean),n="scheduled"===d||X?["date","id"]:["id"];return t.length?xa((0,b.Xo)(t,n),le.current):void 0}),[R,k,x,$,d,X]);(0,Mt.Z)((()=>{if(!R||!k)return;const e=R.filter((e=>k[e]?.reactions));e.length&&te({chatId:t,ids:e})}),15e3),(0,Mt.Z)((()=>{if(!R||!k||n!==l._f)return;const e=R.filter((e=>k[e]?.repliesThreadInfo?.isComments||void 0!==k[e]?.views));e.length&&ae({chatId:t,ids:e})}),15e3);const be=(0,o.Ye)((()=>{if("thread"===d)return(0,L.Ds)((()=>K({direction:w.Uq.Around})),1e3,!0,!1)}),[K,R]),{isScrolled:Ze,updateStickyDates:Pe}=function(){const[e,t]=(0,Tt.Z)(!1),n=(0,Oa.Z)(1e3,!0);return{isScrolled:e,updateStickyDates:(0,pt.Z)(((e,a)=>{t(),document.body.classList.contains("is-scrolling-messages")||(0,c.WM)((()=>{document.body.classList.add("is-scrolling-messages")})),n((()=>{const t=function(e,t){const n=e.querySelectorAll(".sticky-date"),a=e.scrollTop;return Array.from(n).find((e=>{const{offsetTop:n,offsetHeight:s}=e,i=n-a;return-s<=i&&i<=(t?60:10)}))}(e,a);t&&(0,c.WM)((()=>{t.classList.add("stuck")})),(0,c.WM)((()=>{const e=document.querySelector(".stuck");e&&e.classList.remove("stuck"),document.body.classList.remove("is-scrolling-messages")}))}))}))}}(),ye=(0,pt.Z)((()=>{if(me.current)return void(me.current=!1);const e=se.current;e&&(ue.current||Pe(e,u),ao((()=>{const s=(0,a.Rd)();J()&&!(0,m.jU)(s).focusedMessage?.chatId&&Y({hasScrolled:!0}),e.parentElement&&(ie.current=e.scrollHeight-e.scrollTop,"thread"===d&&Q({chatId:t,threadId:n,scrollOffset:ie.current}))})))})),[Ce,Se]=function(e,t){const[n,a]=(0,qn.Z)(),s=(0,pt.Z)((e=>{a(e.contentRect.height)}));(0,Da.Z)(e,s),(0,o.d4)((()=>{const a=Number(e.current.dataset.normalHeight)||0,s=n();s&&s>a&&t&&(e.current.dataset.normalHeight=String(s))}),[t,e,n]);const i=(0,o.sO)();return[n,i]}(se,P&&!O);(0,o.d4)((()=>{if(!be||!I||B||j)return;if(R&&(0,g.AJ)(R[R.length-1]))return;const e=se.current;(!R||R.length<i.hT6/2&&e.firstElementChild.clientHeight<=e.offsetHeight)&&be()}),[I,R,be,j,B]);const Ee=(0,ja.Y)((()=>{if(!R||!ce.current)return;const e=ce.current.filter((e=>R.includes(Number(e.dataset.messageId)))),t=e[1]||e[0];t&&(oe.current=t.id,re.current=t.getBoundingClientRect().top)}));(0,wt.Z)((()=>(0,c.yn)((()=>Ee.current()))),[R,N,u,Ee]),(0,o.d4)((()=>Ee.current()),[Ce,Ee]),(0,_a.Z)((e=>{let[t,n]=e;const a=Ce(),s=Se.current;if(Se.current=a,R===t&&N===n&&a!==s&&void 0===s)return;const o=se.current;ce.current=Array.from(o.querySelectorAll(".message-list-item"));const d=ce.current[ce.current.length-1],l=R&&t&&R[R.length-1]!==t[t.length-1],m=R?.[0]!==t?.[0]&&R?.length===i.hT6/2+1,h=l&&!m;N&&h&&R&&R.length<i.hT6/2&&!o.parentElement.classList.contains("force-messages-scroll")&&(0,c.yn)((()=>o.firstElementChild.clientHeight<=2*o.offsetHeight))&&((0,r.D_)(o.parentElement,"force-messages-scroll"),o.parentElement.classList.add("force-messages-scroll"),setTimeout((()=>{o.parentElement&&(0,r.mC)(o.parentElement,"force-messages-scroll")}),500)),(0,c.lT)((()=>{const{scrollTop:e,scrollHeight:t,offsetHeight:i}=o,r=ie.current;let l=r-(s||i);h&&(l-=d?d.offsetHeight:0);const m=N&&n&&l<=50,g=R&&ue.current===R[R.length-1];h&&m&&!g&&(0,c.i$)((()=>{(0,Ua.ZP)(o,d,"end",20,void 0,void 0,z?0:void 0)}));const p=void 0!==s&&s!==a;if(p&&(0,Ua.Ni)())return;const f=oe.current&&o.querySelector(`#${oe.current}`),I=!f&&le.current&&o.querySelector(".unread-divider");let v;if(m&&p)v=t-i;else if(f){const t=f.getBoundingClientRect().top;v=e+(t-(re.current||0))}else v=I?Math.min(I.offsetTop-(u?60:10),t-r):t-r;return()=>{(0,La.Z)(o,Math.ceil(v)),(0,Ua.wA)(),ie.current=Math.max(Math.ceil(t-v),i),ue.current||(me.current=!0,(0,c.i$)((()=>{me.current=!1})))}}))}),[R,N,u,Ce,Se,z]),(0,ft.Z)((e=>{let[t]=e;void 0!==t&&(0,Et.YW)(200+i.fK3)}),[O]);const Me=(0,Dt.Z)(),Re=Boolean(t&&(0,g.YC)(t)),ke=Boolean(!Re&&!v||C||S),Te=Boolean(!ke||v),Ae=(0,g.YC)(t)&&!C&&!M&&(!we&&!F&&R&&(!ce.current||0===ce.current.length)||1===R?.length&&"contactSignUp"===k?.[R[0]]?.content.action?.type||"contactSignUp"===F?.content?.action?.type),Ne=Z&&E&&1===R?.length&&"chatCreate"===k?.[R[0]]?.content.action?.type,xe=1===R?.length&&"topicCreate"===k?.[R[0]]?.content.action?.type,Be=D&&!D.description&&!D.gif&&!D.photo,Le=(0,ut.Z)("MessageList custom-scroll",Te&&"no-avatars",!P&&"no-composer","pinned"===d&&"type-pinned",G&&"with-bottom-shift",V&&"with-default-bg",O&&"select-mode-active",Ze&&"scrolled",!y&&"is-animating");return o.ZP.createElement("div",{ref:se,className:Le,onScroll:ye,onMouseDown:Ba.q},B?o.ZP.createElement("div",{className:"empty"},o.ZP.createElement("span",null,U?U.text:"This is a private "+(v?"channel":"chat"))):D?o.ZP.createElement("div",{className:"empty"},_&&o.ZP.createElement("span",null,Me("Loading")),Be&&!_&&o.ZP.createElement("span",null,Me("NoMessages")),D&&o.ZP.createElement("div",{className:"bot-info",style:Ie&&`width: ${Ie.width}px`},ge&&o.ZP.createElement("img",{src:ge,width:Ie?.width,height:Ie?.height,alt:"Bot info"}),pe&&o.ZP.createElement(Vs.Z,{canPlay:!0,src:pe,loop:!0,disablePictureInPicture:!0,muted:!0,playsInline:!0}),fe&&!ge&&!pe&&o.ZP.createElement(ri.Z,{width:Ie?.width,height:Ie?.height}),D.description&&o.ZP.createElement("div",{className:"bot-info-description"},o.ZP.createElement("p",{className:"bot-info-title"},Me("BotInfoTitle")),(0,Jn.Z)(D.description,["br","emoji","links"])))):Ae?o.ZP.createElement(eo,{userId:t}):R&&(!we||Ne||xe)?o.ZP.createElement(no,{chatId:t,topic:W,type:d,isChatWithSelf:C,isGroupChatJustCreated:Ne}):R&&we||F?o.ZP.createElement(Ki,{isCurrentUserPremium:f,chatId:t,isComments:A,isChannelChat:v,messageIds:R||[F.id],messageGroups:we||xa([F]),getContainerHeight:Ce,isViewportNewest:Boolean(N),isUnread:Boolean(T),withUsers:ke,noAvatars:Te,containerRef:se,anchorIdRef:oe,memoUnreadDividerBeforeIdRef:le,memoFirstUnreadIdRef:de,threadId:n,type:d,isReady:y,threadTopMessageId:$,hasLinkedChat:q,isSchedule:!!we&&"scheduled"===d,noAppearanceAnimation:!we||!he.current,onFabToggle:h,onNotchToggle:p,onPinnedIntersectionChange:Y}):o.ZP.createElement(bn.Z,{color:"white",backgroundColor:"dark"}))}))),io=(0,o.X$)((e=>{let{icon:t,ariaLabelLang:n,unreadCount:a,onClick:s,onReadAll:i,className:r}=e;const c=(0,Dt.Z)(),d=(0,o.sO)(null),{isContextMenuOpen:l,handleContextMenu:u,handleContextMenuClose:m,handleContextMenuHide:h}=(0,ya.Z)(d,!i);return o.ZP.createElement("div",{className:(0,ut.Z)("KboxtoWkfx23zfklH_Zg",r),ref:d},o.ZP.createElement(Jt.Z,{color:"secondary",round:!0,className:"sgkkv3bmIMAZS9G9BHUz",onClick:s,onContextMenu:u,ariaLabel:c(n)},o.ZP.createElement("i",{className:(0,ut.Z)("AafG9_xBi_2eJ_bFNnNg","icon",`icon-${t}`)})),Boolean(a)&&o.ZP.createElement("div",{className:"yKN1kQ3YXf4SHHIBcotS"},(0,xt.bi)(a)),i&&o.ZP.createElement(yn.Z,{isOpen:l,onClose:m,onCloseAnimationEnd:h,autoClose:!0,positionX:"right",positionY:"bottom"},o.ZP.createElement(Yt.Z,{icon:"readchats",onClick:i},c("MarkAllAsRead"))))})),oo="EcdaljLbQ7DJN9gbQpSC",ro=(0,o.X$)((0,a.c$)((e=>{const t=(0,m.Bt)(e);if(!t)return{};const{chatId:n,threadId:a,type:s}=t,i=(0,m.Z1)(e,n),o=i&&a===l._f&&"thread"===s;return{messageListType:s,chatId:n,reactionsCount:o?i.unreadReactionsCount:void 0,mentionsCount:o?i.unreadMentionsCount:void 0,unreadCount:o?i.unreadCount:void 0}}))((e=>{let{isShown:t,canPost:n,messageListType:s,chatId:i,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,o.sO)(null),w=Boolean(c),b=Boolean(d);(0,o.d4)((()=>{w&&i&&g({chatId:i})}),[i,g,w]),(0,o.d4)((()=>{b&&i&&I({chatId:i})}),[i,I,b]);const Z=(0,pt.Z)((()=>{if(t)if("thread"===s)u();else{const e=v.current.parentElement.querySelector(".MessageList"),t=e.querySelectorAll(".message-list-item"),n=t[t.length-1];if(!n)return;(0,Ua.ZP)(e,n,"end",20)}})),P=(0,ut.Z)("quM3aP53TOfurCEOYgOE",(t||Boolean(c)||Boolean(d))&&"Gutr8PrNAFFTnrIdgK_l",(Boolean(c)||Boolean(d))&&!t&&"bHOz3QboabL0RvHuj3ku",!n&&"r7RXnwv5TF4Cf2V0d5Mf",!l&&"S98OqutuQVCNVHgTrKv4");return o.ZP.createElement("div",{ref:v,className:P},o.ZP.createElement(io,{icon:"heart-outline",ariaLabelLang:"AccDescrReactionMentionDown",onClick:m,onReadAll:f,unreadCount:c,className:(0,ut.Z)("wHTB_MNtk9J6I3F_4eVE",!w&&oo,!b&&"uHEtFnXb6pb14Jf0EsDr")}),o.ZP.createElement(io,{icon:"mention",ariaLabelLang:"AccDescrMentionDown",onClick:h,onReadAll:p,unreadCount:d,className:!b&&oo}),o.ZP.createElement(io,{icon:"arrow-down",ariaLabelLang:"AccDescrPageDown",onClick:Z,unreadCount:r,className:"Hoi4yrJrfBHTmvB8TPce"}))})));var co=n(65723);const lo=/\.[^/.]+$/;async function uo(e,t,a){const s=URL.createObjectURL(t),{type:o,size:r}=t;let c,d,l,u;if(i.oGt.has(o)){const n=await(0,jn.pt)(s),{width:r,height:d}=n;u=!ho(r,d);const m=Math.max(r,d)>1280,h=o===i.s11;if(!u){if(!a?.compressedBlobUrl&&!h&&(m||"image/jpeg"!==o)){const n=await fa(s,m?1280/Math.max(r,d):1,"image/jpeg");return URL.revokeObjectURL(s),uo(e,t,{compressedBlobUrl:n})}"image/jpeg"===o&&(e=e.replace(lo,".jpg")),c={width:r,height:d}}l=s}else if(i.wGh.has(o)){const{videoWidth:e,videoHeight:t,duration:n}=await(0,jn.jj)(s);u=!ho(e,t),u||(c={width:e,height:t,duration:n}),l=await(0,jn.ud)(s)}else if(i.e74.has(o)){const{duration:e,title:t,performer:a,coverUrl:i}=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:i,artist:o,picture:r},format:{duration:c}}=s,d=a(r);return{title:i,performer:o,duration:c,coverUrl:d?`data:${d.format};base64,${d.data.toString("base64")}`:void 0}}(s);d={duration:e||0,title:t,performer:a},l=i}return{blobUrl:s,filename:e,mimeType:o,size:r,quick:c,audio:d,previewBlobUrl:l,shouldSendAsFile:u||void 0,uniqueId:`${Date.now()}-${Math.random()}`,...a}}function mo(e,t){return e.map((e=>t?e.compressedBlobUrl?{...e,blobUrl:e.compressedBlobUrl}:e:{...e,shouldSendAsFile:!e.voice||void 0,shouldSendAsSpoiler:void 0}))}function ho(e,t){return Math.max(e,t)/Math.min(e,t)<=20}var go=n(41098);function po(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(),i=window.getSelection();s.setStart(n,a),s.setEnd(n,a),i.removeAllRanges(),i.addRange(s),document.execCommand("delete",!1);const o=t.innerHTML;return document.body.removeChild(t),o}var fo=n(96391);let Io;function vo(e){Io.focus(),e.focus()}s.cj&&(Io=document.createElement("input"),Io.classList.add("for-ios-autocapitalization-fix"),document.body.appendChild(Io));var wo=n(74288),bo=n(94462),Zo=n(33681),Po=n(52400),yo=n(71790);const Co=new RegExp(`^${i.t8f.source}$`,"g");var So=n(56389);const Eo={encoderPath:new URL(n(68973),n.b).href,reuseWorker:!0},Mo={type:"audio/ogg"};let Ro,ko,To;async function Ao(){return Ro||(Ro=n.e(1161).then(n.t.bind(n,1161,23)),ko=(await Ro).default,To=new ko(Eo)),Ro}async function No(e){await async function(){await Ao(),await To.start()}();const t=Date.now();let n;const a=[],s=[];To.ondataavailable=e=>{a.push(e)};const i=function(t,n){const a=t.sourceNode,i=a.context.createAnalyser();i.fftSize=64,a.connect(i);const o=i.frequencyBinCount,r=new Uint8Array(o);let d=!1;return function t(){if(d)return;i.getByteFrequencyData(r);const n=r.reduce(((e,t)=>e+t),0)/o/255;(t=>{s.push(255*t),e(t)})(n<.1?0:n),(0,c.i$)(t)}(),()=>{d=!0}}(To);return{stop:()=>new Promise(((e,o)=>{To.onstop=()=>{e({blob:new Blob(a,Mo),duration:Math.round(((n||Date.now())-t)/1e3),waveform:s})},To.onerror=o;const r=Math.max(0,t+1e3-Date.now());setTimeout((()=>{To.stop(),i()}),r)})),pause:()=>{const e=Math.max(0,t+1e3-Date.now());setTimeout((()=>{To.pause(),n=Date.now(),i()}),e)}}}var xo=n(21262);const Bo=/id="docs-internal-guid/i,Lo=["H1","H2","H3","H4","H5","H6"];function Uo(e){return(new DOMParser).parseFromString(e,"text/html").body}function jo(e,t){const n=document.createElement("a");return n.href=t,n.appendChild(e.cloneNode(!0)),n}function Oo(e,t){const n=document.createElement(t);return n.appendChild(e.cloneNode(!0)),n}function Fo(e,t){let n=t.cloneNode(!0);return e?(e.style&&"700"===e.style.fontWeight&&(n=Oo(n,"strong")),e.style&&"italic"===e.style.fontStyle&&(n=Oo(n,"em")),e.style&&"underline"===e.style.textDecoration&&(n=Oo(n,"u")),e.style&&"line-through"===e.style.textDecoration&&(n=Oo(n,"del")),e.style&&"super"===e.style.verticalAlign&&(n=Oo(n,"sup")),e.style&&"sub"===e.style.verticalAlign&&(n=Oo(n,"sub")),n):n}function _o(e){const t=e.cloneNode(!0);let n=document.createTextNode(t.textContent||""),a=t;return"A"===t.nodeName&&(n=jo(n,t.href),"style"in t.childNodes[0]&&Boolean(t.childNodes[0].style)&&(a=t.childNodes[0])),n=Fo(a,n),n}function Do(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(...Do(e.childNodes[t]));a.map((e=>n.appendChild(e)))}else-1!==Lo.indexOf(e.nodeName)?(t=document.createElement(e.nodeName),n=_o(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=jo(n.cloneNode(!0),t.childNodes[0].href),a=t.childNodes[0].childNodes[0]),n=Fo(a,n),n}(e)):"BR"===e.nodeName?n=e:(t=document.createElement("span"),n=_o(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(...Do(e.childNodes[n]));return t}return[e]}function $o(e){return 8!==e.nodeType}var qo=n(56266);const Ho=/<style>(.*?)<\/style>/gs,Go=(e,t,n,a,s,r)=>{(0,o.d4)((()=>{if(e)return document.addEventListener("paste",o,!1),()=>{document.removeEventListener("paste",o,!1)};async function o(e){if(!e.clipboardData)return;const o=document.activeElement;if(o&&![i.R2F,i.nYf].includes(o.id))return;const c=e.clipboardData.getData("text").substring(0,4096),d=e.clipboardData.getData("text/html");let u=d?(0,P.ZP)(function(e){let t=document.createElement("div");try{e=(n=e).match(Bo)?function(e){const t=document.createElement("body"),n=e.childNodes,a=Array.from(n).filter($o),s=[];for(const e of a)s.push(...Do(e));for(let e=0;e<s.length;e++)t.appendChild(s[e].cloneNode(!0));return t}(Uo(n.replace(/(\r\n|\n|\r)/,""))).innerHTML:Uo(n.replace(/(\r\n|\n|\r)/,"")).innerHTML}catch(e){i.eMD&&console.error(e)}var n;t.innerHTML=e.replace(/\u00a0/g," ").replace(Ho,"");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(),P.xe[e.tagName]&&e.setAttribute("data-entity-type",P.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 l.Vv.MentionName:e.replaceWith(e.textContent||"");break;case l.Vv.CustomEmoji:e.textContent=e.dataset.alt||""}})),t.innerHTML.trimEnd()}(d),void 0,!0):void 0;u&&(0,qo.Lo)(u)&&s&&(u=(0,qo.If)(u),r?.());const{items:m}=e.clipboardData;let h=[];if(e.preventDefault(),m.length>0&&(h=await(0,xo.Z)(m)),!h?.length&&!c)return;if(h?.length&&!a){const e=await Promise.all(h.map((e=>uo(e.name,e))));n((t=>t.concat(e)))}const g=u?.entities?.length?u:{text:c};g&&t(g,o?.id)}}),[t,a,n,e,s,r])},Vo=new Set([l.Vv.TextUrl,l.Vv.Url]);var Wo=n(28353),zo=n(29295),Xo=n(16580);const Yo=/^@([a-z0-9_]{1,32})[\u00A0\u0020]+(.*)/i,Jo=/^@([a-z0-9_]{1,32})[\u00A0\u0020]+\n{2,}/i,Ko={username:"",query:"",canShowHelp:!1,usernameLowered:""},Qo=document.createElement("div");const er=(0,Xo.Z)(((e,t,n)=>({username:e,query:t,canShowHelp:n,usernameLowered:e.toLowerCase()}))),tr=/^\/([\w@]{1,32})?$/i;var nr=n(33057),ar=n(60130);function sr(e){return e.shouldSendAsFile?"file":i.oGt.has(e.mimeType)?"image":i.wGh.has(e.mimeType)?"video":i.e74.has(e.mimeType)?"audio":"file"}var ir=n(69156);let or=!1;const rr=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,At.Z)(gt.gl.Extra,"DeleteMessageModal",!t);return n?o.ZP.createElement(n,e):void 0}));var cr=n(43521),dr=n(85655),lr=n(56503),ur=n(62898);const mr="N3E1geoPu1vesCKf545F",hr=/#fff/gi,gr=(0,o.X$)((e=>{let{icon:t,theme:n}=e;const{isTouchScreen:a}=(0,M.ZP)(),s=(0,rn.Z)((0,g.ym)(t),!1,l.IU.Text),i=(0,o.Ye)((()=>{if(!s)return"";const e="dark"===n?"rgb(170, 170, 170)":"rgb(112, 117, 121)",t=s.replace(hr,e),a=(new DOMParser).parseFromString(t,"image/svg+xml");return a.querySelectorAll("path").forEach((t=>{t.style.stroke=e,t.style.strokeWidth="0.5px"})),`data:image/svg+xml;utf8,${a.documentElement.outerHTML}`}),[s,n]);return o.ZP.createElement("i",{className:(0,ut.Z)("vL8HfVVnjTeFmp1ECFj8","icon",!a&&mr)},o.ZP.createElement("img",{src:i,alt:"",className:(0,ut.Z)("Fb4aIyDYEwOlaqY8oZkV",!a&&mr)}))})),pr=(0,o.X$)((e=>{let{bot:t,theme:n,chatId:s,threadId:i,onMenuOpened:r,onMenuClosed:c}=e;const{callAttachBot:d,toggleAttachBot:l}=(0,a.Sv)(),u=(0,Dt.Z)(),m=(0,o.Ye)((()=>t.icons.find((e=>{let{name:t}=e;return"default_static"===t}))?.document),[t.icons]),[h,g,p]=(0,Tt.Z)(),[f,I]=(0,o.eJ)(void 0),v=(0,pt.Z)((e=>{e.preventDefault();const t=e.currentTarget.getBoundingClientRect();I({x:t.right,y:t.bottom}),r(),g()})),w=(0,pt.Z)((()=>{p(),c()})),b=(0,pt.Z)((()=>{I(void 0)})),Z=(0,pt.Z)((()=>{l({botId:t.id,isEnabled:!1})}));return o.ZP.createElement(Yt.Z,{key:t.id,customIcon:m&&o.ZP.createElement(gr,{icon:m,theme:n}),icon:m?void 0:"bots",onClick:()=>d({bot:t,chatId:s,threadId:i}),onContextMenu:v},t.shortName,f&&o.ZP.createElement(ur.Z,null,o.ZP.createElement(yn.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},o.ZP.createElement(Yt.Z,{icon:"stop",destructive:!0,onClick:Z},u("WebApp.RemoveBot")))))})),fr=(0,o.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,Z]=(0,Tt.Z)(),[P,y,C]=(0,lr.Z)(w,Z),S=d&&l,E=d||l,[M,R,k]=(0,Tt.Z)();(0,o.d4)((()=>{w&&C()}),[w,C]);const T=(0,pt.Z)((()=>{w?Z():b()})),A=(0,pt.Z)(((e,t)=>{const{files:n}=e.target,a=(0,jn.ox)(n);a?.length&&f(a,t)})),N=(0,pt.Z)((()=>{(0,dr.g)(Array.from(S?i.dII:d?i.oGt:i.wGh).join(","),(e=>A(e,!0)))})),x=(0,pt.Z)((()=>{(0,dr.g)(!u&&m?Array.from(i.e74).join(","):"*",(e=>A(e,!1)))})),B=(0,o.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,Dt.Z)();if(a)return o.ZP.createElement("div",{className:"AttachMenu"},o.ZP.createElement(cr.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},o.ZP.createElement("i",{className:"icon icon-attach"})),o.ZP.createElement(yn.Z,{id:"attach-menu-controls",isOpen:w||M,autoClose:!0,positionX:"right",positionY:"bottom",onClose:Z,className:"AttachMenu--menu fluid",onCloseAnimationEnd:Z,onMouseEnter:s.$b?void 0:P,onMouseLeave:s.$b?void 0:y,noCloseOnBackdrop:!s.$b,ariaLabelledBy:"attach-menu-button"},!r&&o.ZP.createElement(Yt.Z,{className:"media-disabled",disabled:!0},"Posting media content is not allowed in this group."),r&&o.ZP.createElement(o.ZP.Fragment,null,E&&o.ZP.createElement(Yt.Z,{icon:"photo",onClick:N},L(S?"AttachmentMenu.PhotoOrVideo":d?"InputAttach.Popover.Photo":"InputAttach.Popover.Video")),(u||m)&&o.ZP.createElement(Yt.Z,{icon:"document",onClick:x},L(!u&&m?"InputAttach.Popover.Music":"AttachDocument"))),c&&o.ZP.createElement(Yt.Z,{icon:"poll",onClick:I},L("Poll")),r&&!p&&B.map((e=>o.ZP.createElement(pr,{bot:e,chatId:t,threadId:n,theme:v,onMenuOpened:R,onMenuClosed:k})))))})),Ir=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,At.Z)(gt.gl.Extra,"InlineBotTooltip",!t);return n?o.ZP.createElement(n,e):void 0})),vr=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,At.Z)(gt.gl.Extra,"MentionTooltip",!t);return n?o.ZP.createElement(n,e):void 0}));var wr=n(67146);const br=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,At.Z)(gt.gl.Extra,"StickerTooltip",!t);return n?o.ZP.createElement(n,e):void 0}));var Zr=n(93219),Pr=n(19830);const yr=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,At.Z)(gt.gl.Extra,"BotCommandTooltip",!t);return n?o.ZP.createElement(n,e):void 0})),Cr=(0,o.X$)((0,a.c$)(((e,t)=>{let{messageId:n}=t;const{chatId:a}=(0,m.Bt)(e)||{};return a?{message:(0,m.hj)(e,a,n)}:{}}))((e=>{let{isOpen:t,message:n,onClose:i}=e;const{clickBotInlineButton:r}=(0,a.Sv)(),[c,d]=(0,lr.Z)(t,i),{isKeyboardSingleUse:l}=n||{};if(n&&n.keyboardButtons)return o.ZP.createElement(yn.Z,{isOpen:t,autoClose:l,positionX:"right",positionY:"bottom",onClose:i,className:"BotKeyboardMenu",onCloseAnimationEnd:i,onMouseEnter:s.$b?void 0:c,onMouseLeave:s.$b?void 0:d,noCompact:!0},o.ZP.createElement("div",{className:"content"},n.keyboardButtons.map((e=>o.ZP.createElement("div",{className:"row"},e.map((e=>o.ZP.createElement(Jt.Z,{ripple:!0,disabled:"unsupported"===e.type,onClick:()=>r({messageId:n.id,button:e})},e.text))))))))})));var Sr=n(49841),Er=n(12644),Mr=n(66902);const Rr=(0,o.X$)((0,a.c$)(((e,t)=>{let{shouldForceShowEditing:n}=t;const{chatId:a,threadId:s,type:i}=(0,m.Bt)(e)||{};if(!a||!s||!i)return{};const{forwardMessages:{fromChatId:o,toChatId:r,messageIds:c,noAuthors:d,noCaptions:l}}=(0,m.jU)(e),u=(0,m.Yy)(e,a,s),h="scheduled"===i?(0,m.wU)(e,a):(0,m._$)(e,a,s),p=(0,m.FO)(e),f=r===a,I=c?.map((t=>(0,m.hj)(e,o,t)));let v,w;if(u&&!n?v=(0,m.hj)(e,a,u):h?v=(0,m.kK)(e,a,s,i):f&&1===c.length&&(v=I?.[0]),u&&v&&!n){const{forwardInfo:t}=v,n=(0,m.FM)(e,a);t&&(t.isChannelPost||n)&&(w=(0,m.cv)(e,v)),w||t?.hiddenUserName||(w=(0,m.Ur)(e,v))}else f&&(v&&(w=(0,m.cv)(e,v),w||(w=(0,m.Ur)(e,v))),w||(w=(0,g.YC)(o)?(0,m.dy)(e,o):(0,m.Z1)(e,o)));const b=I?.some((e=>e?.content.text&&Object.keys(e.content).length>1));return{replyingToId:u,editingId:h,message:v,sender:w,shouldAnimate:p,forwardedMessagesCount:f?c.length:void 0,noAuthors:d,noCaptions:l,forwardsHaveCaptions:b,isCurrentUserPremium:(0,m.wV)(e)}}))((e=>{let{replyingToId:t,editingId:n,message:s,sender:i,shouldAnimate:r,forwardedMessagesCount:c,noAuthors:d,noCaptions:l,forwardsHaveCaptions:u,shouldForceShowEditing:m,isCurrentUserPremium:h,onClear:p}=e;const{setReplyingToId:f,setEditingId:I,focusMessage:v,changeForwardRecipient:w,setForwardNoAuthors:b,setForwardNoCaptions:Z,exitForwardMode:P}=(0,a.Sv)(),y=(0,o.sO)(null),C=(0,Dt.Z)(),S=Boolean(c),E=Boolean((t||n)&&s||i&&c),M=(0,Qn.Z)([c],c?300:void 0),{shouldRender:R,transitionClassNames:k}=(0,St.Z)(M&&E,void 0,!r,void 0,!r),T=(0,pt.Z)((()=>{t&&!m?f({messageId:void 0}):n?I({messageId:void 0}):c&&P(),p?.()}));(0,o.d4)((()=>E?(0,jt.Z)(T):void 0),[E,T]);const A=(0,pt.Z)((()=>{S||v({chatId:s.chatId,messageId:s.id,noForumTopicPanel:!0})})),N=(0,pt.Z)((e=>{e.stopPropagation(),T()})),x=(0,pt.Z)((()=>{w()})),{isContextMenuOpen:B,contextMenuPosition:L,handleContextMenu:U,handleContextMenuClose:j,handleContextMenuHide:O}=(0,ya.Z)(y),F=(0,pt.Z)((()=>y.current)),_=(0,pt.Z)((()=>y.current)),D=(0,pt.Z)((()=>y.current.querySelector(".forward-context-menu .bubble"))),{positionX:$,positionY:q,transformOriginX:H,transformOriginY:G,style:V}=(0,Er.Z)(L,F,_,D),W=(0,ut.Z)("ComposerEmbeddedMessage",k),z=(0,o.Ye)((()=>t&&!m?"icon-reply":n?"icon-edit":S?"icon-forward":void 0),[n,S,t,m]),X=c&&c>1?C("ForwardedMessageCount",c):void 0,Y=(0,o.Ye)((()=>{if(!s||!S||!s.content.text||!d||h)return s;const e=(0,g.If)(s.content.text);return{...s,content:{...s.content,text:e}}}),[h,S,s,d]);if(R)return o.ZP.createElement("div",{className:W,ref:y,onContextMenu:U,onClick:U},o.ZP.createElement("div",{className:"ComposerEmbeddedMessage_inner"},o.ZP.createElement("div",{className:"embedded-left-icon"},o.ZP.createElement("i",{className:(0,ut.Z)("icon",z)})),o.ZP.createElement(Cs,{className:"inside-input",message:Y,sender:d?void 0:i,customText:X,title:n?C("EditMessage"):d?C("HiddenSendersNameDescription"):void 0,onClick:A,hasContextMenu:S}),o.ZP.createElement(Jt.Z,{className:"embedded-cancel",round:!0,faded:!0,color:"translucent",ariaLabel:C("Cancel"),onClick:N},o.ZP.createElement("i",{className:"icon icon-close"})),S&&o.ZP.createElement(yn.Z,{isOpen:B,transformOriginX:H,transformOriginY:G,positionX:$,positionY:q,style:V,className:"forward-context-menu",onClose:j,onCloseAnimationEnd:O},o.ZP.createElement(Yt.Z,{icon:d?void 0:"message-succeeded",customIcon:d?o.ZP.createElement("i",{className:"icon icon-placeholder"}):void 0,onClick:()=>b({noAuthors:!1})},C(c>1?"ShowSenderNames":"ShowSendersName")),o.ZP.createElement(Yt.Z,{icon:d?"message-succeeded":void 0,customIcon:d?void 0:o.ZP.createElement("i",{className:"icon icon-placeholder"}),onClick:()=>b({noAuthors:!0})},C(c>1?"HideSenderNames":"HideSendersName")),u&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement(Mr.Z,null),o.ZP.createElement(Yt.Z,{icon:l?void 0:"message-succeeded",customIcon:l?o.ZP.createElement("i",{className:"icon icon-placeholder"}):void 0,onClick:()=>Z({noCaptions:!1})},C(c>1?"Conversation.ForwardOptions.ShowCaption":"ShowCaption")),o.ZP.createElement(Yt.Z,{icon:l?"message-succeeded":void 0,customIcon:l?void 0:o.ZP.createElement("i",{className:"icon icon-placeholder"}),onClick:()=>Z({noCaptions:!0})},C(c>1?"Conversation.ForwardOptions.HideCaption":"HideCaption"))),o.ZP.createElement(Mr.Z,null),o.ZP.createElement(Yt.Z,{icon:"replace",onClick:x},C("ChangeRecipient")))))}))),kr=(0,o.X$)((e=>{const{attachments:t}=e,n=(0,At.Z)(gt.gl.Extra,"AttachmentModal",!t.length);return n?o.ZP.createElement(n,e):void 0})),Tr=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,At.Z)(gt.gl.Extra,"BotCommandMenu",!t);return n?o.ZP.createElement(n,e):void 0})),Ar=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,At.Z)(gt.gl.Extra,"PollModal",!t);return n?o.ZP.createElement(n,e):void 0})),Nr=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,At.Z)(gt.gl.Extra,"DropArea",!t);return n?o.ZP.createElement(n,e):void 0})),xr=new RegExp(i.FM6,"i"),Br=(0,o.X$)((0,a.c$)(((e,t)=>{let{chatId:n,threadId:a}=t;const s=(0,m.tV)(e,n,a);return{theme:(0,m.Pu)(e),webPagePreview:(0,m.jU)(e).webPagePreview,noWebPage:s}}))((e=>{let{chatId:t,threadId:n,getHtml:s,isDisabled:i,webPagePreview:r,noWebPage:c,theme:d}=e;const{loadWebPagePreview:u,clearWebPagePreview:m,toggleMessageWebPage:h}=(0,a.Sv)(),g=(0,o.sO)(),p=(0,Ha.iD)((()=>{const e=(0,P.ZP)(s()),t=e.entities?.find((e=>e.type===l.Vv.TextUrl));return g.current=e,t?.url||e.text.match(xr)?.[0]}),[s],300,!0),f=(0,yo.Z)(p,[p,s],!0);(0,o.d4)((()=>{const e=f(),a=g.current;e?u({text:a}):(m(),h({chatId:t,threadId:n}))}),[f,t,n]),(0,wt.Z)((()=>{m(),h({chatId:t,threadId:n})}),[t,m,n,h]);const I=(0,Wn.Z)((()=>Boolean(r&&s()&&!c&&!i)),[i,s,c,r]),{shouldRender:v,transitionClassNames:w}=(0,St.Z)(I),b=(0,Vn.Z)(r,!0),Z=(0,pt.Z)((()=>{h({chatId:t,threadId:n,noWebPage:!0})}));if(!v||!b)return;const{photo:y,...C}=b,S={content:{webPage:C}};return o.ZP.createElement("div",{className:(0,ut.Z)("WebPagePreview",w)},o.ZP.createElement("div",{className:"WebPagePreview_inner"},o.ZP.createElement("div",{className:"WebPagePreview-left-icon"},o.ZP.createElement("i",{className:"icon icon-link"})),o.ZP.createElement(oi,{message:S,inPreview:!0,theme:d}),o.ZP.createElement(Jt.Z,{className:"WebPagePreview-clear",round:!0,faded:!0,color:"translucent",ariaLabel:"Clear Webpage Preview",onClick:Z},o.ZP.createElement("i",{className:"icon icon-close"}))))}))),Lr=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,At.Z)(gt.gl.Extra,"SendAsMenu",!t);return n?o.ZP.createElement(n,e):void 0})),Ur=(0,o.X$)((e=>{let{isOpen:t,onClick:n,text:a,isDisabled:s}=e;const i=(0,o.sO)(null);return(0,o.d4)((()=>{const e=i.current;if(!e)return;const t=e.scrollWidth+1;e.closest(".Composer").style.setProperty("--bot-menu-text-width",`${t}px`)}),[t,a]),(0,o.d4)((()=>{const e=i.current;if(!e)return;const t=e.closest(".Composer");return()=>{t.style.removeProperty("--bot-menu-text-width")}}),[]),o.ZP.createElement(Jt.Z,{className:(0,ut.Z)("bot-menu",t&&"open"),round:!0,color:"translucent",disabled:s,onClick:n,ariaLabel:"Open bot command keyboard"},o.ZP.createElement("i",{className:(0,ut.Z)("bot-menu-icon","icon","icon-webapp",t&&"open")}),o.ZP.createElement("span",{ref:i,className:"bot-menu-text"},a))}));var jr=n(23522),Or=function(e){return e.Send="send",e.Record="record",e.Edit="edit",e.Schedule="schedule",e}(Or||{});const Fr="wonderful-voice-message.ogg",_r=(0,o.X$)((0,a.c$)(((e,t)=>{var n;let{chatId:a,threadId:s,messageListType:o,isMobile:r}=t;const c=(0,m.Z1)(e,a),d=a!==i.FVh?(0,m.IK)(e,a):void 0,l=Boolean(d),u=(0,m.FM)(e,a),h=(0,g.YC)(a),p=l?(0,m.iF)(e,d.id):void 0,f=h?void 0:(0,m.x6)(e,a),I=(l||!h)&&(0,m.FT)(e,a,s),v=(0,m.qy)(e,a,s),{language:w,shouldSuggestStickers:b,shouldSuggestCustomEmoji:Z,shouldUpdateStickerSetOrder:P}=e.settings.byKey,y=e.emojiKeywords[i.pRL],C=w!==i.pRL?e.emojiKeywords[w]:void 0,S=I?I.id:void 0,E=S?(0,m.hj)(e,a,S):void 0,{currentUserId:M}=e,R=f?f?.sendAsId||M:void 0,k=c?.sendAsPeerIds&&R&&(c.sendAsPeerIds.some((e=>e.id===R))?R:c?.adminRights?.anonymous?c?.id:void 0),T=k?(0,m.dy)(e,k):void 0,A=!T&&k?(0,m.Z1)(e,k):void 0,N=(0,m.uH)(e,a),x=(0,m.nA)(e,a),B=(0,m.Bt)(e),L=a===B?.chatId&&s===B?.threadId&&o===B?.type,U=(0,m.dy)(e,a),j=null===(n=U&&!(0,m.iF)(e,U.id)?.noVoiceMessages)||void 0===n||n,O=f?.slowMode,F="scheduled"===o?(0,m.hI)(e,a):(0,m.s)(e,a,s),_=(0,m.Yy)(e,a,s),D=(0,m.jU)(e);return{isOnActiveTab:!D.isBlurred,editingMessage:(0,m.kK)(e,a,s,o),connectionState:e.connectionState,replyingToId:_,draft:(0,m.Ms)(e,a,s),chat:c,isChatWithBot:l,isChatWithSelf:u,isForCurrentMessageList:L,canScheduleUntilOnline:(0,m.Eh)(e,a),isChannel:c?(0,g.eA)(c):void 0,isRightColumnShown:(0,m.Jf)(e,r),isSelectModeActive:(0,m.CA)(e),withScheduledButton:"thread"===o&&Boolean(v?.length),shouldSchedule:"scheduled"===o,botKeyboardMessageId:S,botKeyboardPlaceholder:E?.keyboardPlaceholder,isForwarding:a===D.forwardMessages.toChatId,pollModal:D.pollModal,stickersForEmoji:e.stickers.forEmoji.stickers,customEmojiForEmoji:e.customEmojis.forEmoji.stickers,groupChatMembers:f?.members,topInlineBotIds:e.topInlineBots?.userIds,currentUserId:M,lastSyncTime:e.lastSyncTime,contentToBeScheduled:D.contentToBeScheduled,shouldSuggestStickers:b,shouldSuggestCustomEmoji:Z,shouldUpdateStickerSetOrder:P,recentEmojis:e.recentEmojis,baseEmojiKeywords:y?.keywords,emojiKeywords:C?.keywords,inlineBots:D.inlineBots.byUsername,isInlineBotLoading:D.inlineBots.isLoading,chatBotCommands:f?.botCommands,botCommands:p?p.botInfo?.commands||!1:void 0,botMenuButton:p?.botInfo?.menuButton,sendAsUser:T,sendAsChat:A,sendAsId:k,editingDraft:F,requestedDraftText:N,requestedDraftFiles:x,attachBots:e.attachMenu.bots,attachMenuPeerType:(0,m.t)(e,a),theme:(0,m.Pu)(e),fileSizeLimit:(0,ce.M)(e,"uploadMaxFileparts")*i.pJM,captionLimit:(0,ce.M)(e,"captionLength"),isCurrentUserPremium:(0,m.wV)(e),canSendVoiceByPrivacy:j,attachmentSettings:e.attachmentSettings,slowMode:O,currentMessageList:B}}))((e=>{let{isOnActiveTab:t,dropAreaState:n,shouldSchedule:r,canScheduleUntilOnline:d,isReady:u,isMobile:m,onDropHide:p,editingMessage:f,chatId:I,threadId:v,currentMessageList:w,messageListType:b,draft:y,chat:C,isForCurrentMessageList:S,isCurrentUserPremium:E,canSendVoiceByPrivacy:M,connectionState:R,isChatWithBot:k,isChatWithSelf:T,isChannel:A,fileSizeLimit:N,isRightColumnShown:x,isSelectModeActive:B,isForwarding:L,pollModal:U,botKeyboardMessageId:j,botKeyboardPlaceholder:O,withScheduledButton:F,stickersForEmoji:_,customEmojiForEmoji:D,groupChatMembers:$,topInlineBotIds:q,currentUserId:H,captionLimit:G,lastSyncTime:V,contentToBeScheduled:W,shouldSuggestStickers:z,shouldSuggestCustomEmoji:X,baseEmojiKeywords:Y,emojiKeywords:J,recentEmojis:K,inlineBots:Q,isInlineBotLoading:ee,botCommands:te,chatBotCommands:ne,sendAsUser:ae,sendAsChat:se,sendAsId:ie,editingDraft:oe,replyingToId:re,requestedDraftText:ce,requestedDraftFiles:de,botMenuButton:le,attachBots:ue,attachMenuPeerType:me,attachmentSettings:ge,theme:pe,slowMode:fe,shouldUpdateStickerSetOrder:Ie}=e;const{sendMessage:ve,clearDraft:we,showDialog:be,forwardMessages:Ze,openPollModal:Pe,closePollModal:ye,loadScheduledHistory:Ce,openChat:Se,addRecentEmoji:Ee,sendInlineBotResult:Me,loadSendAs:Re,resetOpenChatWithDraft:ke,callAttachBot:Te,addRecentCustomEmoji:Ae,showNotification:Ne,showAllowedMessageTypesNotification:xe}=(0,a.Sv)(),Be=(0,Dt.Z)(),Le=(0,o.sO)(null),Ue=(0,o.sO)(null),[je,Oe]=(0,qn.Z)(""),[Fe,_e]=(0,o.eJ)(!1),De=(0,ir.Z)(i.Edp),qe=(0,o.sO)(),He=(0,_n.Z)(n),{width:Ge}=$e.Z.get(),Ve=C?.sendAsPeerIds,We=Ve&&(Ve.length>1||!Ve.some((e=>e.id===H))),[ze,Xe,Ye]=(0,Tt.Z)(),Je=(0,So.Z)(I,v);(0,o.d4)(wo.AU,[je]);const Ke=(0,o.sO)(0),[Qe,et]=(0,nr.Z)(d,Ye);(0,kt.Z)((()=>{_e(!0)}),430),(0,o.d4)((()=>{qe.current=void 0}),[I]),(0,o.d4)((()=>{I&&V&&u&&Ce({chatId:I})}),[u,I,Ce,V,v]),(0,o.d4)((()=>{I&&C&&V&&!Ve&&u&&(0,g.ZV)(C)&&Re({chatId:I})}),[C,I,u,V,Re,Ve]);const tt=(0,o.sO)(!1);(0,wt.Z)((e=>{let[t,n]=e;tt.current=Boolean(I===t&&Ve&&!n)}),[I,Ve]),(0,o.bt)((()=>{Le.current&&(Le.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[nt,at]=(0,o.eJ)([]),st=Boolean(nt.length),{canSendStickers:it,canSendGifs:ot,canAttachMedia:rt,canAttachPolls:ct,canAttachEmbedLinks:dt,canSendVoices:lt,canSendPlainText:mt,canSendAudios:ht,canSendVideos:gt,canSendPhotos:bt,canSendDocuments:Zt}=(0,o.Ye)((()=>(0,g.H5)(C,k)),[C,k]),Pt=!mt&&!f,{shouldSuggestCompression:yt,shouldForceCompression:Ct,shouldForceAsFile:St,handleAppendFiles:Et,handleFileSelect:Rt,onCaptionUpdate:At,handleClearAttachments:Nt,handleSetAttachments:xt}=function(e){let{attachments:t,fileSizeLimit:n,setHtml:s,setAttachments:i,chatId:r,canSendAudios:c,canSendVideos:d,canSendPhotos:l,canSendDocuments:u}=e;const{openLimitReachedModal:m,showAllowedMessageTypesNotification:g}=(0,a.Sv)(),[p,f]=(0,o.eJ)(!1),[I,v]=(0,o.eJ)(!1),[w,b]=(0,o.eJ)(void 0),Z=(0,pt.Z)((()=>{i(h.D)})),P=(0,pt.Z)((e=>{const a="function"==typeof e?e(t):e;if(a.length)if(a.some((e=>{const t=sr(e);return"audio"===t&&!c&&!u||"video"===t&&!d&&!u||"image"===t&&!l&&!u||"file"===t&&!u})))g({chatId:r});else if(a.some((e=>{let{size:t}=e;return t>n})))m({limit:"uploadMaxFileparts"});else{i(a);const e=a.some((e=>{const t=sr(e);return"audio"===t&&!c||"video"===t&&!d||"image"===t&&!l}));f(Boolean(e&&u)),v(!u)}else Z()}));return{shouldSuggestCompression:w,handleAppendFiles:(0,pt.Z)((async(e,n)=>{P([...t,...await Promise.all(e.map((e=>uo(e.name,e,{shouldSendAsSpoiler:n||void 0}))))])})),handleFileSelect:(0,pt.Z)((async(e,t)=>{P(await Promise.all(e.map((e=>uo(e.name,e))))),b(t)})),onCaptionUpdate:s,handleClearAttachments:Z,handleSetAttachments:P,shouldForceCompression:I,shouldForceAsFile:p}}({attachments:nt,setHtml:Oe,setAttachments:at,fileSizeLimit:N,chatId:I,canSendAudios:ht,canSendVideos:gt,canSendPhotos:bt,canSendDocuments:Zt}),[Bt,Lt,Ut]=(0,Tt.Z)(),[Ot,Ft,_t]=(0,Tt.Z)(),[$t,qt,Ht]=(0,Tt.Z)(),[Gt,Vt,Wt]=(0,Tt.Z)(),[zt,Xt,Yt]=(0,Tt.Z)(),[Kt,Qt,en]=(0,Tt.Z)(),{startRecordingVoice:tn,stopRecordingVoice:an,pauseRecordingVoice:sn,activeVoiceRecording:on,currentRecordTime:rn,recordButtonRef:cn,startRecordTimeRef:dn}=(()=>{const e=(0,o.sO)(null),[t,n]=(0,o.eJ)(),a=(0,o.sO)(),[i,r]=(0,o.eJ)();(0,o.d4)((()=>{s.s$&&s.mh&&Ao()}),[]);const d=(0,pt.Z)((async()=>{try{const{stop:t,pause:s}=await No((t=>{e.current&&(a.current&&Date.now()%4==0&&(0,c.WM)((()=>{e.current.style.boxShadow=`0 0 0 ${50*(t||0)}px rgba(0,0,0,.15)`})),r(Date.now()))}));a.current=Date.now(),r(Date.now()),n({stop:t,pause:s})}catch(e){console.error(e)}})),l=(0,pt.Z)((()=>{if(t){(0,c.WM)((()=>{e.current&&(e.current.style.boxShadow="none")}));try{return t.pause()}catch(e){return void console.error(e)}}})),u=(0,pt.Z)((()=>{if(t){n(void 0),a.current=void 0,r(void 0),(0,c.WM)((()=>{e.current&&(e.current.style.boxShadow="none")}));try{return t.stop()}catch(e){return void console.error(e)}}}));return(0,o.d4)((()=>t?(0,jt.Z)(u):void 0),[t,u]),{startRecordingVoice:d,pauseRecordingVoice:l,stopRecordingVoice:u,activeVoiceRecording:t,currentRecordTime:i,recordButtonRef:e,startRecordTimeRef:a}})();(0,Mt.Z)((()=>{Je({type:"recordAudio"})}),on&&i.o_S),(0,o.d4)((()=>{on||Je({type:"cancel"})}),[on,Je]);const ln=(0,ja.Y)(Boolean(f));(0,o.d4)((()=>{je()&&!ln.current&&Je({type:"typing"})}),[je,ln,Je]);const un=C&&(0,g.Nl)(C),{isEmojiTooltipOpen:mn,closeEmojiTooltip:hn,filteredEmojis:gn,filteredCustomEmojis:pn,insertEmoji:fn}=(0,Wo.Z)(Boolean(u&&t&&S&&z&&!st),je,Oe,void 0,K,Y,J),{isCustomEmojiTooltipOpen:In,closeCustomEmojiTooltip:vn,insertCustomEmoji:wn}=(0,ar.Z)(Boolean(u&&t&&S&&X&&!st),je,Oe,De,Ue,D),{isStickerTooltipOpen:bn,closeStickerTooltip:Zn}=function(e,t,n){const{loadStickersForEmoji:r,clearStickersForEmoji:c}=(0,a.Sv)(),[d,l,u]=(0,Tt.Z)(!1),m=(0,yo.Z)((()=>{const n=t();if(!e||!n||s.op&&n.length>8)return;if(!n.match(s.op?Zo.Z:i.t8f))return;const a=(0,Po._)(n);return a&&(s.op&&1===(0,bo.Z)(a)||!s.op&&Boolean(n.match(Co)))?s.op?a:a.match(/alt="(.+)"/)?.[1]:void 0}),[t,e]),h=(0,Wn.Z)((()=>Boolean(m())),[m]),g=Boolean(n?.length);return(0,o.d4)((()=>{if(!e)return;const t=m();t?g||r({emoji:t}):c()}),[e,m,g,r,c]),(0,o.d4)(u,[u,t]),{isStickerTooltipOpen:Boolean(h&&g&&!d),closeStickerTooltip:l}}(Boolean(u&&t&&S&&z&&it&&!st),je,_),{isMentionTooltipOpen:Pn,closeMentionTooltip:yn,insertMention:Cn,mentionFilteredUsers:Sn}=(0,zo.Z)(Boolean(u&&S&&!st),je,Oe,De,Ue,$,q,H),{isOpen:En,botId:Mn,isGallery:Rn,switchPm:kn,switchWebview:Tn,results:An,closeTooltip:Nn,help:xn,loadMore:Bn}=function(e,t,n,s){const{queryInlineBot:i,resetInlineBot:r,resetAllInlineBots:c}=(0,a.Sv)(),[d,l,u]=(0,Tt.Z)(!1),m=(0,Ha.CH)((()=>{const t=n();return e&&t.startsWith("@")?function(e){if(!e.startsWith("@"))return Ko;const t=function(e){return Qo.innerHTML=e.replace(/<br>/g,"\n"),Qo.querySelectorAll("[alt]").forEach((e=>{e.innerText||(e.innerText=e.getAttribute("alt"))})),Qo.innerText}(e),n=t.match(Yo);return n?er(n[1],n[2],""===n[2]&&!t.match(Jo)):Ko}(t):Ko}),[n,e],300),{username:h,query:g,canShowHelp:p,usernameLowered:f}=(0,Wn.Z)(m,[m,n],!0);(0,wt.Z)((e=>{let[t]=e;t&&r({username:t})}),[h,r]),(0,o.d4)((()=>{f&&i({chatId:t,username:f,query:g})}),[t,g,i,f]),(0,o.d4)(u,[u,n]);const{id:I,switchPm:v,switchWebview:w,offset:b,results:Z,isGallery:P,help:y}=f&&s?.[f]||{},C=Boolean((Z?.length||v)&&!d);(0,o.d4)((()=>{C||h||c()}),[C,c,h]);const S=(0,pt.Z)((()=>{f&&i({chatId:t,username:f,query:g,offset:b})}));return{isOpen:C,botId:I,isGallery:P,switchPm:v,switchWebview:w,results:Z,closeTooltip:l,help:p&&y?`@${h} ${y}`:void 0,loadMore:S}}(Boolean(u&&S&&!st&&V),I,je,Q),{isOpen:Un,close:jn,filteredBotCommands:On}=function(e,t,n,a){const[s,i]=(0,o.eJ)(),[r,c,d]=(0,Tt.Z)(!1),l=(0,Ha.CH)((()=>{const n=t();return e&&n.startsWith("/")?(0,Po._)(n).match(tr)?.[0].trim():void 0}),[t,e],300),u=(0,yo.Z)(l,[l,t],!0);return(0,o.d4)((()=>{const e=u(),t=n||a;if(!e||!t)return void i(void 0);const s=e.substring(1),o=t.filter((e=>!s||e.command.startsWith(s)));i(o?.length?o:void 0)}),[u,n,a]),(0,o.d4)(d,[d,t]),{isOpen:Boolean(s?.length&&!r),close:c,filteredBotCommands:s}}(Boolean(u&&S&&(te&&te?.length||ne?.length)),je,te,ne),Fn=(0,pt.Z)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:i.R2F;if(t===i.R2F&&Pt)return;const n=window.getSelection();let a;if(a=t===i.R2F?document.querySelector(i.Edp):document.getElementById(t),n.rangeCount){const s=n.getRangeAt(0);if((0,fo.R)(s,t))return(0,go.tx)(e),void a.dispatchEvent(new Event("input",{bubbles:!0}))}Oe(`${je()}${e}`),(0,c.Yq)((()=>{(0,co.Z)(a)}))})),Dn=(0,pt.Z)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:i.R2F;const n=(0,Ys.z)(e);Fn(n,t)})),$n=(0,pt.Z)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:i.R2F;Fn((0,as.yR)(e),t)}));((e,t,n,r,d,u,m)=>{const{saveDraft:h,clearDraft:g,loadCustomEmojis:p}=(0,a.Sv)(),f=Boolean(u),I=(0,pt.Z)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(f||!m)return;const s=r();var i,o,c,d;s?h({chatId:null!==(i=e.chatId)&&void 0!==i?i:t,threadId:null!==(o=e.threadId)&&void 0!==o?o:n,draft:(0,P.ZP)(s),shouldForce:a}):g({chatId:null!==(c=e.chatId)&&void 0!==c?c:t,threadId:null!==(d=e.threadId)&&void 0!==d?d:n,shouldForce:a})})),v=(0,ja.Y)(I),w=(0,Oa.Z)(i.r_R,!0,void 0,[t,n]);(0,ft.Z)((a=>{let[o,r,m]=a;if(t===o&&n===r&&(!e&&m&&d(""),!e?.shouldForce))return;if(u||!e)return;d((0,Ys.z)(e));const h=e.entities?.map((e=>e.type===l.Vv.CustomEmoji&&e.documentId)).filter(Boolean)||[];h.length&&p({ids:h}),s.$b||(0,c.Yq)((()=>{const e=document.querySelector(i.Edp);e&&(0,co.Z)(e,!0)}))}),[t,n,e,d,u,p]),(0,o.d4)((()=>()=>{f||v.current({chatId:t,threadId:n}),or=!0,(0,c.i$)((()=>{or=!1}))}),[t,n,f,v]);const b=(0,ja.Y)(t),Z=(0,ja.Y)(n);function y(){I(void 0,!0)}(0,o.d4)((()=>{if(or)return;if(!r())return void v.current();const e=b.current,t=Z.current;w((()=>{b.current===e&&Z.current===t&&v.current()}))}),[b,r,w,Z,v]),(0,It.Z)(y),vt(y)})(y,I,v,je,Oe,f,V);const Hn=(0,pt.Z)((function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e||Oe(""),at(h.D),hn(),vn(),Zn(),yn(),m?setTimeout((()=>Ht()),350):Ht()})),[Gn,Vn,zn]=((e,t,n,s,r,d,l,u,m,h,p)=>{const{editMessage:f,setEditingDraft:I,toggleMessageWebPage:v}=(0,a.Sv)(),[w,b]=(0,o.eJ)(!1);(0,ft.Z)((e=>{let[a,s]=e;if(!n)return;if(p&&s!==p)return t(""),void b(!1);if(a?.id===n.id&&p===s)return;const o=!a&&h?.text.length?h:n.content.text,r=(0,Ys.z)(o);t(r),b(!0),(0,c.Yq)((()=>{const e=document.querySelector(i.Edp);e&&(0,co.Z)(e,!0)}))}),[n,p,h,t]),(0,o.d4)((()=>{if(!n)return;const e=!("webPage"in n.content)&&n.content.text?.entities?.some((e=>Vo.has(e.type)));v({chatId:d,threadId:l,noWebPage:e})}),[d,l,n]),(0,o.d4)((()=>{if(n)return()=>{const t=(0,P.ZP)(e()),n=t.text.length?t:void 0;I({chatId:d,threadId:l,type:u,text:n})}}),[d,n,e,I,l,u]);const Z=(0,Ha.iD)((()=>{if(!n)return!1;const t=(0,P.ZP)(e());return!("webPage"in n.content)&&n.content.text?.entities?.some((e=>Vo.has(e.type)))&&!t.entities?.some((e=>Vo.has(e.type)))}),[n,e],300,!0),y=(0,yo.Z)(Z,[Z,e],!0);(0,ft.Z)((e=>{let[t]=e;n&&t?.id===n.id&&y()&&v({chatId:d,threadId:l,noWebPage:!1})}),[n,d,e,l,y]);const C=(0,pt.Z)((()=>{m&&(0,c.i$)((()=>{t((0,Ys.z)(m)),(0,c.Yq)((()=>{const e=document.querySelector(i.Edp);e&&(0,co.Z)(e,!0)}))}))})),S=(0,pt.Z)((()=>{s(),C()})),E=(0,pt.Z)((()=>{const{text:t,entities:a}=(0,P.ZP)(e());n&&(t||(0,g.u8)(n)?(f({messageList:{chatId:d,threadId:l,type:u},text:t,entities:a}),s(),C()):r())})),M=(0,pt.Z)((()=>{if(!n)return;const t=(0,P.ZP)(e()),a=t.text.length?t:void 0;I({chatId:d,threadId:l,type:u,text:a})}));return(0,It.Z)(M),vt(M),[E,S,w]})(je,Oe,f,Hn,Xt,I,v,b,y,oe,re),Xn=(0,ja.Y)(Hn),Yn=(0,ja.Y)(an);(0,o.d4)((()=>()=>{Yn.current(),Xn.current()}),[I,v,Xn,Yn]);const Kn=(0,pt.Z)((()=>{const e=Ke.current;Ne(e?{message:Be("UnlockPremiumEmojiHint2"),action:{action:"openChat",payload:{id:H,shouldReplaceHistory:!0}},actionText:Be("Open")}:{message:Be("UnlockPremiumEmojiHint"),action:{action:"openPremiumModal",payload:{initialSection:"animated_emoji"}},actionText:Be("PremiumMore")}),Ke.current=Number(!e)})),Qn=(0,Wn.Z)((()=>f&&zn?Or.Edit:!s.mh||on||L||je()&&!st?r?Or.Schedule:Or.Send:Or.Record),[on,f,je,st,L,zn,r]),ea=!r,{isContextMenuOpen:ta,handleContextMenu:na,handleContextMenuClose:aa,handleContextMenuHide:sa}=(0,ya.Z)(cn,!(Qn===Or.Send&&ea));Go(S,Dn,xt,f,!E&&!T,Kn);const ia=(0,pt.Z)((()=>{f&&Vn()})),oa=(0,pt.Z)(((e,t)=>{const n=t?G:4096;if(e?.length>n){const t=e.length-n;return be({data:{message:"MESSAGE_TOO_LONG_PLEASE_REMOVE_CHARACTERS",textParams:{"{EXTRA_CHARS_COUNT}":t.toString(),"{PLURAL_S}":t>1?"s":""},hasErrorKey:!0}}),!1}return!0})),ra=(0,pt.Z)((()=>{if(fe&&!un){const e=document.querySelector(i.Edp),t=(0,Z.bp)(),n=qe.current&&Math.floor(t-qe.current),a=fe.nextSendDate&&fe.nextSendDate>t;if(n&&n<fe.seconds||a){const s=a?fe.nextSendDate-t:fe.seconds-n;return be({data:{message:Be("SlowModeHint",(0,he.k9)(s)),isSlowMode:!0,hasErrorKey:!1}}),e?.blur(),!1}}return!0})),ca=(0,pt.Z)((e=>{let{attachments:t,sendCompressed:n=ge.shouldCompress,sendGrouped:a=ge.shouldSendGrouped,isSilent:s,scheduledAt:i}=e;if("connectionStateReady"!==R||!w)return;const{text:o,entities:r}=(0,P.ZP)(je());(o||t.length)&&oa(o,!0)&&ra()&&(ve({messageList:w,text:o,entities:r,scheduledAt:i,isSilent:s,shouldUpdateStickerSetOrder:Ie,attachments:mo(t,n),shouldGroupMessages:a}),qe.current=(0,Z.bp)(),we({chatId:I,localOnly:!0}),(0,c.i$)((()=>{Hn()})))})),da=(0,pt.Z)(((e,t,n,a)=>{ca({attachments:nt,sendCompressed:e,sendGrouped:t,isSilent:n,scheduledAt:a})})),la=(0,pt.Z)((async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0;if("connectionStateReady"!==R||!w)return;let n=nt;if(on){const e=await an();if(e){const{blob:t,duration:a,waveform:s}=e;n=[await uo(Fr,t,{voice:{duration:a,waveform:s}})]}}const{text:a,entities:o}=(0,P.ZP)(je());if(n.length)return void ca({attachments:n});if(!a&&!L)return;if(!oa(a))return;const r=document.querySelector(i.Edp);if(a){if(!ra())return;ve({messageList:w,text:a,entities:o,scheduledAt:t,isSilent:e,shouldUpdateStickerSetOrder:Ie})}L&&Ze({scheduledAt:t,isSilent:e}),qe.current=(0,Z.bp)(),we({chatId:I,localOnly:!0}),s.cj&&r&&r===document.activeElement&&vo(r),(0,c.i$)((()=>{Hn()}))})),ua=(0,pt.Z)((()=>{"webApp"===le?.type&&Te({chatId:I,url:le.url,threadId:v})})),ma=(0,pt.Z)((()=>{Ht(),Ft()})),ha=(0,pt.Z)(((e,t,n)=>{if(e&&"queryId"in e){const{id:a,queryId:s,isSilent:i}=e;return void Me({id:a,queryId:s,scheduledAt:t,isSilent:i,messageList:n})}const{isSilent:a,...s}=e||{};if(e&&0!==Object.keys(s).length)if(void 0!==e.sendCompressed||void 0!==e.sendGrouped){const{sendCompressed:n=!1,sendGrouped:s=!1}=e;da(n,s,a,t)}else ve({...e,messageList:n,scheduledAt:t});else la(Boolean(a),t)}));(0,ft.Z)((e=>{let[t]=e;w&&W&&W!==t&&Qe((e=>{ha(W,e,w)}))}),[W,w,ha,Qe]),(0,o.d4)((()=>{ce&&(Oe(ce),ke(),(0,c.Yq)((()=>{const e=document.getElementById(i.R2F);(0,co.Z)(e,!0)})))}),[ce,ke,Oe]),(0,o.d4)((()=>{de?.length&&(Rt(de),ke())}),[Rt,de,ke]);const ga=(0,pt.Z)(((e,t)=>{e.isFree||E||T?$n(e,t):Kn()})),pa=(0,pt.Z)((e=>{ga(e,i.nYf)})),fa=(0,pt.Z)(((e,t,n)=>{w&&(r||n?(Xe(),Qe((n=>{Ye(),ha({gif:e,isSilent:t},n,w),(0,c.i$)((()=>{Hn(!0)}))}))):(ve({messageList:w,gif:e,isSilent:t}),(0,c.i$)((()=>{Hn(!0)}))))})),Ia=(0,pt.Z)((function(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4?arguments[4]:void 0;w&&(e={...e,isPreloadedGlobally:!0},r||n?(Xe(),Qe((n=>{Ye(),ha({sticker:e,isSilent:t},n,w),(0,c.i$)((()=>{Hn(a)}))}))):(ve({messageList:w,sticker:e,isSilent:t,shouldUpdateStickerSetOrder:Ie&&s}),(0,c.i$)((()=>{Hn(a)}))))})),va=(0,pt.Z)(((e,t,n)=>{if("connectionStateReady"!==R||!w)return;r||n?Qe((n=>{ha({id:e.id,queryId:e.queryId,isSilent:t},n,w)})):Me({id:e.id,queryId:e.queryId,isSilent:t,messageList:w});const a=document.querySelector(i.Edp);s.cj&&a&&a===document.activeElement&&vo(a),we({chatId:I,localOnly:!0}),(0,c.i$)((()=>{Hn()}))})),wa=(0,pt.Z)((()=>{we({chatId:I,localOnly:!0}),(0,c.i$)((()=>{Hn()}))})),ba=(0,pt.Z)((e=>{w&&(r?(Qe((t=>{ha({poll:e},t,w)})),ye()):(ve({messageList:w,poll:e}),ye()))})),Za=(0,pt.Z)((e=>{if(r)Qe((t=>{ha({...e,isSilent:!0},t,w)}));else if(e&&("sendCompressed"in e||"sendGrouped"in e)){const{sendCompressed:t=!1,sendGrouped:n=!1}=e;da(t,n,!0)}else la(!0)})),Pa=(0,pt.Z)((()=>{const e=document.querySelector(i.Edp);if(!m||e!==document.activeElement)return _t(),Ht(),void Vt();e?.blur(),setTimeout((()=>{_t(),Ht(),Vt()}),100)})),Ca=(0,pt.Z)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:i.R2F;const n=(0,Jn.Z)(e,["escape_html","emoji_html","br_html"]).join("").replace(/\u200b+/g,"");Fn(n,t)}));(0,o.d4)((()=>{Pt&&Oe("")}),[Pt,Oe,nt]);const Sa=(0,pt.Z)((e=>{Ca(e,i.nYf)})),Ea=(0,pt.Z)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i.R2F;const t=window.getSelection();if(t.rangeCount){const n=t.getRangeAt(0);if((0,fo.R)(n,e))return void document.execCommand("delete",!1)}Oe(po(je()))})),Ma=(0,pt.Z)((()=>{Ea(i.nYf)})),Ra=(0,pt.Z)((()=>{Se({id:I,threadId:v,type:"scheduled",noForumTopicPanel:!0})}));(0,o.d4)((()=>{x&&m&&Ht()}),[x,Ht,m]),(0,o.d4)((()=>{u&&(B?Qt():setTimeout((()=>{en()}),200))}),[B,en,Qt,u]);const ka=!(Qn!==Or.Record||rt&&M&<),Ta=(0,pt.Z)((()=>{switch(Qn){case Or.Send:la();break;case Or.Record:ka?M?lt||xe({chatId:I}):Ne({message:Be("VoiceMessagesRestrictedByPrivacy",C?.title)}):tn();break;case Or.Edit:Gn();break;case Or.Schedule:if(on&&sn(),!w)return;Qe((e=>{ha({},e,w)}))}})),Aa=(0,_n.Z)(f,!0),Na=f||Aa,xa=new Date;xa.setSeconds(0),xa.setMilliseconds(0);const Ba=new Date;Ba.setFullYear(Ba.getFullYear()+1);let La="SendMessage";switch(Qn){case Or.Edit:La="Save edited message";break;case Or.Record:La=rt?"AccDescrVoiceMessage":"Conversation.DefaultRestrictedMedia"}const Ua=(0,ut.Z)("Composer",!B&&"shown",Kt&&"hover-disabled",Fe&&"mounted"),Fa=(0,pt.Z)((()=>{Qe((e=>{ha({},e,w)}))})),_a=(0,pt.Z)((()=>{Za()})),Da=(0,pt.Z)((()=>{ha({},i.t4X,w)})),$a=(0,pt.Z)(((e,t)=>{Qe((n=>{ha({sendCompressed:e,sendGrouped:t},n,w)}))})),qa=(0,pt.Z)(((e,t)=>{Za({sendCompressed:e,sendGrouped:t})})),Ga=Qn===Or.Edit?Gn:Qn===Or.Schedule?Fa:la,Va=k&&"webApp"===le?.type&&!f,Wa=(0,Wn.Z)((()=>Va&&!je()&&!on),[Va,je,on]),za=k&&"commands"===le?.type&&!f&&!1!==te&&!on;return o.ZP.createElement("div",{className:Ua},rt&&u&&o.ZP.createElement(Nr,{isOpen:n!==Ln.t.None,withQuick:n===Ln.t.QuickFile||He===Ln.t.QuickFile,onHide:p,onFileSelect:Rt}),o.ZP.createElement(kr,{chatId:I,threadId:v,canShowCustomSendMenu:ea,attachments:nt,getHtml:je,isReady:u,shouldSuggestCompression:yt,shouldForceCompression:Ct,shouldForceAsFile:St,isForCurrentMessageList:S,shouldSchedule:r,onCaptionUpdate:At,onSendSilent:qa,onSend:da,onSendScheduled:$a,onFileAppend:Et,onClear:Nt,onAttachmentsUpdate:xt,onCustomEmojiSelect:pa,onRemoveSymbol:Ma,onEmojiSelect:Sa}),o.ZP.createElement(Ar,{isOpen:U.isOpen,isQuiz:U.isQuiz,shouldBeAnonymous:A,onClear:ye,onSend:ba}),Na&&o.ZP.createElement(rr,{isOpen:zt,isSchedule:"scheduled"===b,onClose:Yt,message:Na}),o.ZP.createElement(Lr,{isOpen:Gt,onClose:Wt,chatId:I,selectedSendAsId:ie,sendAsPeerIds:Ve,isCurrentUserPremium:E}),o.ZP.createElement(vr,{isOpen:Pn,filteredUsers:Sn,onInsertUserName:Cn,onClose:yn}),o.ZP.createElement(yr,{isOpen:Un,withUsername:Boolean(ne),botCommands:On,getHtml:je,onClick:wa,onClose:jn}),o.ZP.createElement("div",{id:"message-compose"},o.ZP.createElement("div",{className:"svg-appendix",ref:Le}),o.ZP.createElement(Ir,{isOpen:En,botId:Mn,isGallery:Rn,inlineBotResults:An,switchPm:kn,switchWebview:Tn,loadMore:Bn,isSavedMessages:T,canSendGifs:ot,isCurrentUserPremium:E,onSelectResult:va,onClose:Nn}),o.ZP.createElement(Rr,{onClear:ia,shouldForceShowEditing:Boolean(zn&&f)}),o.ZP.createElement(Br,{chatId:I,threadId:v,getHtml:je,isDisabled:!dt||st}),o.ZP.createElement("div",{className:"message-input-wrapper"},Va&&o.ZP.createElement(Ur,{isOpen:Wa,text:le.text,isDisabled:Boolean(on),onClick:ua}),za&&o.ZP.createElement(cr.Z,{className:(0,ut.Z)("bot-commands",Ot&&"activated"),round:!0,disabled:void 0===te,color:"translucent",onActivate:ma,ariaLabel:"Open bot command keyboard"},o.ZP.createElement("i",{className:"icon icon-bot-commands-filled"})),We&&(ae||se)&&o.ZP.createElement(Jt.Z,{round:!0,color:"translucent",onClick:Gt?Wt:Pa,ariaLabel:Be("SendMessageAsTitle"),className:(0,ut.Z)("send-as-button",tt.current&&"appear-animation")},o.ZP.createElement(Is.Z,{user:ae,chat:se,size:"tiny"})),(!Pt||ot||it)&&o.ZP.createElement(jr.Z,{chatId:I,threadId:v,isMobile:m,isReady:u,isSymbolMenuOpen:$t,openSymbolMenu:qt,closeSymbolMenu:Ht,canSendStickers:it,canSendGifs:ot,onGifSelect:fa,onStickerSelect:Ia,onCustomEmojiSelect:ga,onRemoveSymbol:Ea,onEmojiSelect:Ca,closeBotCommandMenu:_t,closeSendAsMenu:Wt,isSymbolMenuForced:ze,canSendPlainText:!Pt}),o.ZP.createElement(Sr.Z,{ref:Ue,id:"message-input-text",editableInputId:i.R2F,chatId:I,canSendPlainText:!Pt,threadId:v,isReady:u,isActive:!st,getHtml:je,placeholder:on&&Ge<=600?"":Pt?Be("Chat.PlaceholderTextNotAllowed"):O||Be("Message"),forcedPlaceholder:xn,canAutoFocus:u&&S&&!st,noFocusInterception:st,shouldSuppressFocus:m&&$t,shouldSuppressTextFormatter:mn||Pn||En,onUpdate:Oe,onSend:Ga,onSuppressedFocus:Ht}),ee&&Boolean(Mn)&&o.ZP.createElement(nn.Z,{color:"gray"}),F&&o.ZP.createElement(Jt.Z,{round:!0,faded:!0,className:"scheduled-button",color:"translucent",onClick:Ra,ariaLabel:"Open scheduled messages"},o.ZP.createElement("i",{className:"icon icon-schedule"})),Boolean(j)&&!on&&!f&&o.ZP.createElement(cr.Z,{className:Bt?"activated":"",round:!0,color:"translucent",onActivate:Lt,ariaLabel:"Open bot command keyboard"},o.ZP.createElement("i",{className:"icon icon-bot-command"})),on&&Boolean(rn)&&o.ZP.createElement("span",{className:"recording-state"},(0,he.rM)(rn-dn.current)),o.ZP.createElement(fr,{chatId:I,threadId:v,isButtonVisible:!on&&!f,canAttachMedia:rt,canAttachPolls:ct,canSendPhotos:bt,canSendVideos:gt,canSendDocuments:Zt,canSendAudios:ht,onFileSelect:Rt,onPollCreate:Pe,isScheduled:r,attachBots:ue,peerType:me,theme:pe}),Boolean(j)&&o.ZP.createElement(Cr,{messageId:j,isOpen:Bt,onClose:Ut}),te&&o.ZP.createElement(Tr,{isOpen:Ot,botCommands:te,onClose:_t}),o.ZP.createElement(Zr.Z,{chatId:I,isOpen:In,onCustomEmojiSelect:wn,addRecentCustomEmoji:Ae,onClose:vn}),o.ZP.createElement(br,{chatId:I,threadId:v,isOpen:bn,onStickerSelect:Ia,onClose:Zn}),o.ZP.createElement(Pr.Z,{isOpen:mn,emojis:gn,customEmojis:pn,addRecentEmoji:Ee,addRecentCustomEmoji:Ae,onEmojiSelect:fn,onCustomEmojiSelect:fn,onClose:hn}))),on&&o.ZP.createElement(Jt.Z,{round:!0,color:"danger",className:"cancel",onClick:an,ariaLabel:"Cancel voice recording"},o.ZP.createElement("i",{className:"icon icon-delete"})),o.ZP.createElement(Jt.Z,{ref:cn,round:!0,color:"secondary",className:(0,ut.Z)(Qn,!u&&"not-ready",on&&"recording"),disabled:ka,allowDisabledClick:!0,noFastClick:!0,ariaLabel:Be(La),onClick:Ta,onContextMenu:Qn===Or.Send&&ea?na:void 0},o.ZP.createElement("i",{className:"icon icon-send"}),o.ZP.createElement("i",{className:"icon icon-schedule"}),o.ZP.createElement("i",{className:"icon icon-microphone-alt"}),o.ZP.createElement("i",{className:"icon icon-check"})),ea&&o.ZP.createElement(wr.Z,{isOpen:ta,canScheduleUntilOnline:d,onSendSilent:T?void 0:_a,onSendSchedule:r?void 0:Fa,onSendWhenOnline:Da,onClose:aa,onCloseAnimationEnd:sa,isSavedMessages:T}),et)}))),Dr=(0,o.X$)((e=>{const{isActive:t}=e,n=(0,At.Z)(gt.gl.Extra,"MobileSearch",!t,!0);return n?o.ZP.createElement(n,e):void 0})),$r=(0,o.X$)((e=>{const{isActive:t}=e,n=(0,At.Z)(gt.gl.Extra,"MessageSelectToolbar",!t);return n?o.ZP.createElement(n,e):void 0})),qr=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,At.Z)(gt.gl.Extra,"UnpinAllMessagesModal",!t);return n?o.ZP.createElement(n,e):void 0})),Hr=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,At.Z)(gt.gl.Extra,"SeenByModal",!t);return n?o.ZP.createElement(n,e):void 0})),Gr=(0,o.X$)((e=>{const{activeEmojiInteraction:t}=e,n=(0,At.Z)(gt.gl.Extra,"EmojiInteractionAnimation",!t);return n?o.ZP.createElement(n,e):void 0})),Vr=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,At.Z)(gt.gl.Extra,"ReactorListModal",!t);return n?o.ZP.createElement(n,e):void 0})),Wr=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,At.Z)(gt.gl.Extra,"GiftPremiumModal",!t);return n?o.ZP.createElement(n,e):void 0})),zr=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,At.Z)(gt.gl.Extra,"MessageLanguageModal",!t);return n?o.ZP.createElement(n,e):void 0}));function Xr(e){return"file"===e.kind&&e.type&&i.oGt.has(e.type)}const Yr=450+i.fK3,Jr=(0,o.X$)((0,a.c$)(((e,t)=>{let{isMobile:n}=t;const a=(0,m.Pu)(e),{isBlurred:s,background:o,backgroundColor:r,patternColor:c}=e.settings.themes[a]||{},{messageLists:d,isLeftColumnShown:u,activeEmojiInteractions:h,seenByModal:p,giftPremiumModal:f,reactorModal:I,audioPlayer:v,shouldSkipHistoryAnimations:w,messageLanguageModal:b}=(0,m.jU)(e),Z=(0,m.Bt)(e),{leftColumnWidth:P,lastSyncTime:y}=e,C={theme:a,customBackground:o,backgroundColor:r,patternColor:c,isLeftColumnShown:u,isRightColumnShown:(0,m.Jf)(e,n),isBackgroundBlurred:s,hasCurrentTextSearch:Boolean((0,m.n5)(e)),isSelectModeActive:(0,m.CA)(e),isSeenByModalOpen:Boolean(p),isReactorListModalOpen:Boolean(I),isGiftPremiumModalOpen:f?.isOpen,isMessageLanguageModalOpen:Boolean(b),withInterfaceAnimations:(0,m.FO)(e),currentTransitionKey:Math.max(0,d.length-1),activeEmojiInteractions:h,leftColumnWidth:P,lastSyncTime:y};if(!Z)return C;const{chatId:S,threadId:E,type:M}=Z,R=(0,g.YC)(S),k=(0,m.Z1)(e,S),T=(0,m.IK)(e,S),A=(0,m.KB)(e,S,E),{chatId:N,messageId:x}=v,B=(0,m.tZ)(e,S,E),L=Boolean(B?.originChannelId),U=k&&(0,g.Qm)(k,E,L),j=(0,m.pk)(e,S),O="pinned"===M,F="thread"===M&&E===l._f,_=Boolean(k&&(0,g.eA)(k)),D=Boolean(k&&F&&(_||(0,g.ZV)(k))&&k.isNotJoined&&!k.joinRequests),$=Boolean(k?.isNotJoined&&k.isJoinToSend),q=Boolean(k?.isNotJoined&&k.isJoinRequest),H=Boolean(T&&(0,m.s4)(e,T.id)),G=!H&&j,V=Boolean(k&&(0,g.Bf)(k)&&!(0,m.x6)(e,k.id)&&y),W=(0,m.Yy)(e,S,E),z=!!k?.isForum&&E===l._f&&!W&&k.topics?.[i.OxA]?.isClosed,X=N&&x?(0,m.hj)(e,N,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)&&!z,isPinnedMessageList:O,currentUserBannedRights:k?.currentUserBannedRights,defaultBannedRights:k?.defaultBannedRights,hasPinned:E!==l._f&&!k?.isForum||Boolean(!O&&A?.length),hasAudioPlayer:Boolean(X),hasButtonInHeader:G||H||D||q,pinnedMessagesCount:A?A.length:0,shouldSkipHistoryAnimations:w,isChannel:_,canSubscribe:D,canStartBot:G,canRestartBot:H,shouldJoinToSend:$,shouldSendJoinRequest:q,shouldLoadFullChat:V,pinnedIds:A}}))((function(e){let{leftColumnRef:t,chatId:n,threadId:r,messageListType:d,isMobile:l,chat:u,replyingToId:h,isPrivate:p,isPinnedMessageList:f,canPost:I,currentUserBannedRights:v,defaultBannedRights:w,hasPinned:Z,hasAudioPlayer:P,hasButtonInHeader:y,pinnedMessagesCount:C,customBackground:S,theme:E,backgroundColor:R,patternColor:k,isLeftColumnShown:T,isRightColumnShown:A,isBackgroundBlurred:N,leftColumnWidth:x,hasCurrentTextSearch:B,isSelectModeActive:L,isSeenByModalOpen:U,isReactorListModalOpen:j,isGiftPremiumModalOpen:O,isMessageLanguageModalOpen:F,withInterfaceAnimations:_,shouldSkipHistoryAnimations:D,currentTransitionKey:$,isChannel:q,areChatSettingsLoaded:H,canSubscribe:G,canStartBot:V,canRestartBot:W,activeEmojiInteractions:z,shouldJoinToSend:X,shouldSendJoinRequest:Y,shouldLoadFullChat:J,lastSyncTime:K,pinnedIds:Q}=e;const{openChat:ee,openPreviousChat:te,unpinAllMessages:ne,loadUser:ae,loadChatSettings:se,closeLocalTextSearch:ie,exitMessageSelectMode:oe,joinChannel:re,sendBotCommand:ce,restartBot:de,showNotification:le,loadFullChat:ue,setLeftColumnWidth:me,resetLeftColumnWidth:he}=(0,a.Sv)(),{width:ge}=(0,On.Z)(),{isTablet:pe,isDesktop:fe}=(0,M.ZP)(),Ie=(0,Dt.Z)(),[ve,we]=(0,o.eJ)(Ln.t.None),[be,Ze]=(0,o.eJ)(),[Pe,ye]=(0,o.eJ)(),[Ce,Se]=(0,o.eJ)(!1),{onIntersectionChanged:Ee,onFocusPinnedMessage:Me,getCurrentPinnedIndexes:Re,getLoadingPinnedId:ke,getForceNextPinnedInHeader:Te}=function(e,t,n){const[s,i]=(0,qn.Z)({}),[r,c]=(0,qn.Z)(),d=(0,o.sO)(),[l,u]=(0,qn.Z)(),h=e?`${e}_${t}`:void 0;return(0,o.d4)((()=>{c(void 0),d.current=void 0,u(void 0)}),[e,i,c,u,t]),(0,o.d4)((()=>{if(!h)return;const e=s()[h],t=n?.length||0;e>=t&&i({...s(),[h]:Math.max(0,t-1)})}),[s,h,n?.length,i]),{onIntersectionChanged:(0,pt.Z)((o=>{let{viewportPinnedIdsToAdd:g=[],viewportPinnedIdsToRemove:p=[],isReversed:f,hasScrolled:I,isUnmount:v}=o;if(!e||!t||!h)return;const w=(0,a.Rd)();if(!n?.length||!n)return;const Z=l();if(Z&&!I){const e=n.indexOf(Z);i({...s(),[h]:e}),u(void 0)}I&&(c(void 0),u(void 0));const P=r(),y=d.current;if(v&&0===g.length&&1===p.length&&!y?.includes(p[0]))return;const C=(0,b.Tw)((y?.filter((e=>!p.includes(e)))||[]).concat(g));d.current=C;const S=(0,m.G$)(w,e);if(!C.length&&v&&S&&!n.includes(S)){const e=n.find((e=>e<S));if(e){const t=n.indexOf(e);i({...s(),[h]:t})}}if(P||v)return;const E=Math.max(...C),M=n.findIndex((e=>e===E)),R=f?0:1,k=C.length?M:y?.length?(0,Dn.uZ)(n.indexOf(y[0])+R,0,n.length-1):0;i({...s(),[h]:k})})),onFocusPinnedMessage:(0,pt.Z)((o=>{if(!e||!t||!h||l())return!1;const r=(0,a.Rd)();if(!n?.length)return!1;const d=n.indexOf(o),g=(0,$n.Z)(n.length,d+1);return c(!0),(0,m.gb)(r,e,t)?.includes(o)||(0,m.of)(r,e,t,o)?(i({...s(),[h]:g}),!0):(u(n[g]),!0)})),getCurrentPinnedIndexes:s,getLoadingPinnedId:l,getForceNextPinnedInHeader:r}}(n,r,Q),Ae=l&&B,Ne=l?Yr:void 0,xe=Z&&(ge<i.l35||P||A&&ge>i._mX&&ge<i.QU1||!l&&y&&ge<i.sgm),Be=(0,Fn.Z)(n,Ne),Le=(0,Fn.Z)(r,Ne),$e=(0,Fn.Z)(d,Ne),qe=(0,Fn.Z)(G,Ne),He=(0,Fn.Z)(V,Ne),Ge=(0,Fn.Z)(W,Ne),Ve=(0,Fn.Z)(I,Ne)&&!Ge&&!He&&!qe&&n!==i.mzl,We=(0,Fn.Z)(xe,Ne),ze=(0,Fn.Z)(be,Ne)&&n!==i.mzl,Xe=(0,Fn.Z)(q,Ne),Ye=(0,Fn.Z)(X,Ne),Je=(0,Fn.Z)(Y,Ne),Ke=(0,Fn.Z)(n?Ee:void 0,Ne),Qe=(0,_n.Z)($),et=void 0!==Qe&&Qe<$?Qe:void 0,{isReady:tt,handleCssTransitionEnd:nt,handleSlideTransitionStop:at}=function(e,t,n,a,s){const[i,r]=(0,o.eJ)(!s),c=(0,Ct.Z)(),d=void 0!==n&&n!==t;return d&&(e?(r(!1),setTimeout((()=>{r(!0)}),Yr)):c()),(0,wt.Z)((()=>{e||r(!0)}),[e]),{isReady:i&&!d,handleCssTransitionEnd:e?function(e){"transform"===e.propertyName&&e.target===e.currentTarget&&r(Boolean(a))}:void 0,handleSlideTransitionStop:e?function(){r(!0)}:void 0}}(!D&&_,$,Qe,n,l);(0,o.d4)((()=>n?(0,jt.Z)((()=>{ee({id:void 0})})):void 0),[n,ee]),(0,wt.Z)((()=>{we(Ln.t.None),ye(void 0)}),[n]),(0,o.d4)((()=>{if(!s.cj&&!s.wZ)return;const{visualViewport:e}=window;if(!e)return;const t=()=>{const t=e.height!==document.documentElement.clientHeight;(0,c.WM)((()=>{document.body.classList.toggle("keyboard-visible",t)}))};return e.addEventListener("resize",t),()=>{e.removeEventListener("resize",t)}})),(0,o.d4)((()=>{p&&ae({userId:n})}),[n,p,ae]),(0,o.d4)((()=>{!H&&K&&se({chatId:n})}),[n,p,H,K,se]),(0,o.d4)((()=>{n&&J&&tt&&ue({chatId:n})}),[J,n,tt,ue]);const{initResize:st,resetResize:it,handleMouseUp:ot}=function(e,t,n,a,s){const[i,r,d]=(0,Tt.Z)(),[l,u]=(0,o.eJ)(0),[m,h]=(0,o.eJ)(0),g=(0,pt.Z)((t=>{(0,c.WM)((()=>{if(!e.current)return;const n=t?`${t}px`:"";e.current.style.width=n,e.current.style.setProperty(s,n)}))}));function p(){(0,c.WM)((()=>{document.body.classList.remove("cursor-ew-resize")}))}return(0,o.bt)((()=>{e.current&&a&&g(a)}),[s,e,a,g]),(0,o.d4)((()=>{if(!i)return;const n=e=>{const t=Math.ceil(m+e.clientX-l);g(t)};function a(){s(),t(e.current.offsetWidth)}function s(){p(),document.removeEventListener("mousemove",n,!1),document.removeEventListener("mouseup",a,!1),document.removeEventListener("blur",a,!1),d()}return document.addEventListener("mousemove",n,!1),document.addEventListener("mouseup",a,!1),document.addEventListener("blur",a,!1),s}),[m,l,e,t,i,d,g]),{initResize:function(t){t.preventDefault(),(0,c.WM)((()=>{document.body.classList.add("cursor-ew-resize")})),u(t.clientX),h(e.current.offsetWidth),r()},resetResize:function(e){e.preventDefault(),g(void 0),n()},handleMouseUp:p}}(t,(e=>me({leftColumnWidth:e})),he,x,"--left-column-width"),rt=(0,pt.Z)((e=>{const{items:t}=e.dataTransfer||{},n=t&&t.length>0&&Array.from(t).filter((e=>"text/uri-list"!==e.type)).every(Xr);we(n?Ln.t.QuickFile:Ln.t.Document)})),ct=(0,pt.Z)((()=>{we(Ln.t.None)})),dt=(0,pt.Z)((()=>{Se(!0)})),lt=(0,pt.Z)((()=>{Se(!1)})),mt=(0,pt.Z)((()=>{ne({chatId:n,threadId:r}),lt(),te()})),ht=(0,pt.Z)((()=>{ee({id:n})})),gt=(0,pt.Z)((()=>{re({chatId:n}),Je&&le({message:Ie(q?"RequestToJoinChannelSentDescription":"RequestToJoinGroupSentDescription")})})),ft=(0,pt.Z)((()=>{ce({command:"/start"})})),It=(0,pt.Z)((()=>{de({chatId:n})})),vt=((e,t)=>{const[n,a]=(0,o.eJ)(t);return(0,o.d4)((()=>{t&&(t.startsWith("#")?a(t):Un.fetch(i.foQ,e,Un.Type.Blob).then((e=>{const t=URL.createObjectURL(e);(0,jn.pt)(t).then((()=>{a(`url(${t})`)}))})))}),[t,e]),t?n:void 0})(E,S),bt=(0,ut.Z)(We&&"has-header-tools",s.aZ?"mask-image-disabled":"mask-image-enabled"),Zt=(0,ut.Z)("ON5E8MkEVA1mAlkuIxhG","OWFg9Wf1uioPWDz_IgS8",S&&"Ik9ZZlj3eKtKXRrUZKVk",R&&"avVozLQe3SaWcSkIt6pG",S&&N&&"Tipa66fYcSvl6w0587Xz",A&&"vhOr8s3T_LCKSt2BF7fs"),Pt=(0,ut.Z)("messaging-disabled",!L&&"shown"),yt=(0,g.q8)(Ie,v,w),St=(0,g.mt)(Ie,u,r,Boolean(h)),Et=yt||St,{composerHiddenScale:Mt,toolbarHiddenScale:Rt,composerTranslateX:kt,toolbarTranslateX:At,unpinHiddenScale:Nt,toolbarForUnpinHiddenScale:xt}=(0,o.Ye)((()=>function(e,t){const n=e<=i.l35?Ue.Gw:2*Ue.Gw,a=function(e){if(e>i._mX){const t=Math.min(Math.max(.25*e,_e),Fe),n=Math.min(.25*e,Fe);return Math.min(e-t-n,Oe)}if(e>i.ksF){const t=Math.min(Math.max(.4*e,_e),Fe);return Math.min(e-t,Oe)}return e>Oe?Oe:e}(e),s=e<=i.l35?3.375*Ue.Gw:4*Ue.Gw,o=t?a-n-s:a-n,r=e>i.l35?Math.min(a-n,je):a-n,c=r/o,d=o/r;return{composerHiddenScale:c,toolbarHiddenScale:d,composerTranslateX:t?s/2*d:0,toolbarTranslateX:t?s/2*-1*c:0,unpinHiddenScale:r/De,toolbarForUnpinHiddenScale:De/r}}(ge,Ve)),[Ve,ge]),Bt=(0,ut.Z)("middle-column-footer",!Ve&&"no-composer",Ve&&Pe&&!L&&"with-notch");(0,fn.Z)({isActive:L,onBack:oe}),(0,fn.Z)({isActive:Ae,onBack:ie});const Lt=Boolean(!f&&!Ve&&!Ge&&!He&&!qe&&Et),Ut=Boolean(Ge||qe||Je||He||f),Ot=Boolean(Lt||L||f);return o.ZP.createElement("div",{id:"MiddleColumn",className:bt,onTransitionEnd:nt,style:`\n --composer-hidden-scale: ${Mt};\n --toolbar-hidden-scale: ${Rt};\n --unpin-hidden-scale: ${Nt};\n --toolbar-unpin-hidden-scale: ${xt};\n --composer-translate-x: ${kt}px;\n --toolbar-translate-x: ${At}px;\n --pattern-color: ${k};\n --theme-background-color:\n ${R||("dark"===E?i.Itv:i.p3h)};\n `,onClick:pe&&T?ht:void 0},fe&&o.ZP.createElement("div",{className:"resize-handle",onMouseDown:st,onMouseUp:ot,onDoubleClick:it}),o.ZP.createElement("div",{className:Zt,style:vt?`--custom-background: ${vt}`:void 0}),o.ZP.createElement("div",{id:"middle-column-portals"}),Boolean(Be&&Le)&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("div",{className:"messages-layout",onDragEnter:Ve?rt:void 0},o.ZP.createElement(Aa,{chatId:Be,threadId:Le,messageListType:$e,isReady:tt,isMobile:l,getCurrentPinnedIndexes:Re,getLoadingPinnedId:ke,onFocusPinnedMessage:Me}),o.ZP.createElement(_t.Z,{name:D?"none":_?"slide":"fade",activeKey:$,shouldCleanup:!0,cleanupExceptionKey:et,onStop:at},o.ZP.createElement(so,{key:`${Be}-${Le}-${$e}`,chatId:Be,threadId:Le,type:$e,canPost:Ve,hasTools:We,onFabToggle:Ze,onNotchToggle:ye,isReady:tt,withBottomShift:Ut,withDefaultBg:Boolean(!S&&!R),onPinnedIntersectionChange:Ke,getForceNextPinnedInHeader:Te}),o.ZP.createElement("div",{className:Bt},Ve&&o.ZP.createElement(_r,{chatId:Be,threadId:Le,messageListType:$e,dropAreaState:ve,onDropHide:ct,isReady:tt,isMobile:l}),f&&o.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:Ie.isRtl?"rtl":void 0},o.ZP.createElement(Jt.Z,{size:"tiny",fluid:!0,color:"secondary",className:"unpin-all-button",onClick:dt},o.ZP.createElement("i",{className:"icon icon-unpin"}),o.ZP.createElement("span",null,Ie("Chat.Pinned.UnpinAll",C,"i")))),Lt&&o.ZP.createElement("div",{className:Pt},o.ZP.createElement("div",{className:"messaging-disabled-inner"},o.ZP.createElement("span",null,Et))),l&&(qe||Ye&&!Je)&&o.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:Ie.isRtl?"rtl":void 0},o.ZP.createElement(Jt.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:gt},Ie(Xe?"ProfileJoinChannel":"ProfileJoinGroup"))),l&&Je&&o.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:Ie.isRtl?"rtl":void 0},o.ZP.createElement(Jt.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:gt},Ie("ChannelJoinRequest"))),l&&He&&o.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:Ie.isRtl?"rtl":void 0},o.ZP.createElement(Jt.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:ft},Ie("BotStart"))),l&&Ge&&o.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:Ie.isRtl?"rtl":void 0},o.ZP.createElement(Jt.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:It},Ie("BotRestart"))),o.ZP.createElement($r,{messageListType:$e,isActive:L,canPost:Ve}),o.ZP.createElement(Hr,{isOpen:U}),o.ZP.createElement(Vr,{isOpen:j}),s.SX&&o.ZP.createElement(zr,{isOpen:F}))),o.ZP.createElement(ro,{isShown:ze,canPost:Ve,withExtraShift:Ot})),l&&o.ZP.createElement(Dr,{isActive:Boolean(Ae)})),n&&o.ZP.createElement(qr,{isOpen:Ce,chatId:n,pinnedMessagesCount:C,onClose:lt,onUnpin:mt}),o.ZP.createElement("div",{teactFastList:!0},z?.map(((e,t)=>o.ZP.createElement(Gr,{teactOrderKey:t,key:e.id,activeEmojiInteraction:e})))),o.ZP.createElement(Wr,{isOpen:O}))}))),Kr=450+i.fK3,Qr=(0,L.Ds)((e=>e()),200,!1);var ec=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}(ec||{});const tc=(0,o.X$)((0,a.c$)(((e,t)=>{let{chatId:n,isProfile:a,isManagement:s,threadId:i}=t;const o=(0,m.jU)(e),{query:r}=(0,m.n5)(e)||{},{query:c}=(0,m.y5)(e)||{},{query:d}=(0,m.yN)(e)||{},u=n?(0,m.Z1)(e,n):void 0,h=a&&n&&(0,g.YC)(n)?(0,m.dy)(e,n):void 0,p=u&&(0,g.eA)(u),f=u?.isForum&&Boolean(i&&i!==l._f),I=f?u.topics?.[i]:void 0,v=f&&I&&(0,g.GU)(u,I),w=h&&(0,g.cS)(h),b=h&&(0,g.kw)(h),Z=Boolean(!s&&a&&!b&&u&&!(0,m.FM)(e,u.id)&&((0,g.YC)(u.id)||((0,g.Nl)(u)||u.isCreator)&&!u.isNotJoined)),P=Boolean(n&&o.management.byChatId[n]?.editingInvite),y=!f&&n?(0,m.x6)(e,n)?.canViewStatistics:void 0,C=n?o.management.byChatId[n]?.inviteInfo?.invite:void 0;return{canManage:Z,canAddContact:b,canViewStatistics:y,isChannel:p,isBot:w,isInsideTopic:f,canEditTopic:v,userId:h?.id,messageSearchQuery:r,stickerSearchQuery:c,gifSearchQuery:d,isEditingInvite:P,currentInviteInfo:C,shouldSkipHistoryAnimations:o.shouldSkipHistoryAnimations}}))((e=>{var t;let{chatId:n,threadId:s,isColumnOpen:i,isProfile:r,isSearch:c,isManagement:d,isStatistics:l,isMessageStatistics:u,isStickerSearch:m,isGifSearch:h,isPollResults:g,isCreatingTopic:p,isEditingTopic:f,isAddingChatMembers:I,profileState:v,managementScreen:b,canAddContact:Z,userId:P,canManage:y,isChannel:C,onClose:S,onScreenSelect:E,messageSearchQuery:R,stickerSearchQuery:k,gifSearchQuery:T,isEditingInvite:A,canViewStatistics:N,currentInviteInfo:x,shouldSkipHistoryAnimations:B,isBot:L,isInsideTopic:U,canEditTopic:j}=e;const{setLocalTextSearchQuery:O,setStickerSearchQuery:F,setGifSearchQuery:_,searchTextMessagesLocal:D,toggleManagement:$,openHistoryCalendar:q,openAddContactDialog:H,toggleStatistics:G,setEditingExportedInvite:V,deleteExportedChatInvite:W,openEditTopicPanel:z}=(0,a.Sv)(),[X,Y,J]=(0,Tt.Z)(),{isMobile:K}=(0,M.ZP)(),Q=(0,pt.Z)((()=>{V({chatId:n,invite:x}),E(w.u1.EditInvite)})),ee=(0,pt.Z)((()=>{W({chatId:n,link:x.link}),E(w.u1.Invites),J()})),te=(0,pt.Z)((e=>{O({query:e}),e.length&&Qr(D)})),ne=(0,pt.Z)((e=>{F({query:e})})),ae=(0,pt.Z)((e=>{_({query:e})})),se=(0,pt.Z)((()=>{H({userId:P})})),ie=(0,pt.Z)((()=>{n&&s&&z({chatId:n,topicId:s})})),oe=(0,pt.Z)((()=>{$()})),re=(0,pt.Z)((()=>{G()})),[ce,de]=(0,o.eJ)(!i);(0,o.d4)((()=>{setTimeout((()=>{de(!i)}),Kr)}),[i]);const le=(0,Dt.Z)(),ue=r?v===w.vi.Profile?ec.Profile:v===w.vi.SharedMedia?ec.SharedMedia:v===w.vi.MemberList?ec.MemberList:-1:c?ec.Search:g?ec.PollResults:m?ec.StickerSearch:h?ec.GifSearch:I?ec.AddingMembers:d?b===w.u1.Initial?ec.ManageInitial:b===w.u1.ChatPrivacyType?ec.ManageChatPrivacyType:b===w.u1.Discussion?ec.ManageDiscussion:b===w.u1.ChannelSubscribers?ec.ManageChannelSubscribers:b===w.u1.GroupPermissions?ec.ManageGroupPermissions:b===w.u1.ChatAdministrators?ec.ManageChatAdministrators:b===w.u1.GroupRemovedUsers?ec.ManageGroupRemovedUsers:b===w.u1.ChannelRemovedUsers?ec.ManageChannelRemovedUsers:b===w.u1.GroupUserPermissionsCreate?ec.ManageGroupUserPermissionsCreate:b===w.u1.GroupUserPermissions?ec.ManageGroupUserPermissions:b===w.u1.GroupRecentActions?ec.ManageGroupRecentActions:b===w.u1.ChatAdminRights?ec.ManageGroupAdminRights:b===w.u1.ChatNewAdminRights?ec.ManageGroupNewAdminRights:b===w.u1.GroupMembers?ec.ManageGroupMembers:b===w.u1.Invites?ec.ManageInvites:b===w.u1.EditInvite?ec.ManageEditInvite:b===w.u1.GroupAddAdmins?ec.ManageGroupAddAdmins:b===w.u1.Reactions?ec.ManageReactions:b===w.u1.InviteInfo?ec.ManageInviteInfo:b===w.u1.JoinRequests?ec.ManageJoinRequests:void 0:l?ec.Statistics:u?ec.MessageStatistics:p?ec.CreateTopic:f?ec.EditTopic:void 0,me=null!==(t=(0,Vn.Z)(ue,!0))&&void 0!==t?t:-1,ge=K||ue===ec.SharedMedia||ue===ec.MemberList||ue===ec.AddingMembers||ue===ec.MessageStatistics||d,pe=(0,ut.Z)("animated-close-icon",ge&&"state-back",(ce||B)&&"no-transition"),fe=(0,o.sO)(null);return(0,zt.Z)(fe),o.ZP.createElement("div",{className:"RightHeader",ref:fe},o.ZP.createElement(Jt.Z,{className:"close-button",round:!0,color:"translucent",size:"smaller",onClick:S,ariaLabel:le(ge?"Common.Back":"Common.Close")},o.ZP.createElement("div",{className:pe})),o.ZP.createElement(_t.Z,{name:ce||B?"none":"slideFade",activeKey:me},function(){if(-1!==me)switch(me){case ec.PollResults:return o.ZP.createElement("h3",null,le("PollResults"));case ec.Search:return o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement(Kt.Z,{parentContainerClassName:"RightSearch",value:R,onChange:te}),o.ZP.createElement(Jt.Z,{round:!0,size:"smaller",color:"translucent",onClick:()=>q({selectedAt:(0,he._F)(Date.now())}),ariaLabel:"Search messages by date"},o.ZP.createElement("i",{className:"icon icon-calendar"})));case ec.AddingMembers:return o.ZP.createElement("h3",null,le(C?"ChannelAddSubscribers":"GroupAddMembers"));case ec.ManageInitial:return o.ZP.createElement("h3",null,le("Edit"));case ec.ManageChatPrivacyType:return o.ZP.createElement("h3",null,le(C?"ChannelTypeHeader":"GroupTypeHeader"));case ec.ManageDiscussion:return o.ZP.createElement("h3",null,le("Discussion"));case ec.ManageChatAdministrators:return o.ZP.createElement("h3",null,le("ChannelAdministrators"));case ec.ManageGroupRecentActions:return o.ZP.createElement("h3",null,le("Group.Info.AdminLog"));case ec.ManageGroupAdminRights:return o.ZP.createElement("h3",null,le("EditAdminRights"));case ec.ManageGroupNewAdminRights:return o.ZP.createElement("h3",null,le("SetAsAdmin"));case ec.ManageGroupPermissions:return o.ZP.createElement("h3",null,le("ChannelPermissions"));case ec.ManageGroupRemovedUsers:return o.ZP.createElement("h3",null,le("BlockedUsers"));case ec.ManageChannelRemovedUsers:return o.ZP.createElement("h3",null,le("ChannelBlockedUsers"));case ec.ManageGroupUserPermissionsCreate:return o.ZP.createElement("h3",null,le("ChannelAddException"));case ec.ManageGroupUserPermissions:return o.ZP.createElement("h3",null,le("UserRestrictions"));case ec.ManageInvites:return o.ZP.createElement("h3",null,le("lng_group_invite_title"));case ec.ManageEditInvite:return o.ZP.createElement("h3",null,le(A?"EditLink":"NewLink"));case ec.ManageInviteInfo:return o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("h3",null,le("InviteLink")),o.ZP.createElement("section",{className:"tools"},x&&!x.isRevoked&&o.ZP.createElement(Jt.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:le("Edit"),onClick:Q},o.ZP.createElement("i",{className:"icon icon-edit"})),x&&x.isRevoked&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement(Jt.Z,{round:!0,color:"danger",size:"smaller",ariaLabel:le("Delete"),onClick:Y},o.ZP.createElement("i",{className:"icon icon-delete"})),o.ZP.createElement(ta.Z,{isOpen:X,onClose:J,title:le("DeleteLink"),text:le("DeleteLinkHelp"),confirmIsDestructive:!0,confirmLabel:le("Delete"),confirmHandler:ee}))));case ec.ManageJoinRequests:return o.ZP.createElement("h3",null,le(C?"SubscribeRequests":"MemberRequests"));case ec.ManageGroupAddAdmins:return o.ZP.createElement("h3",null,le("Channel.Management.AddModerator"));case ec.StickerSearch:return o.ZP.createElement(Kt.Z,{value:k,placeholder:le("SearchStickersHint"),autoFocusSearch:!0,onChange:ne});case ec.GifSearch:return o.ZP.createElement(Kt.Z,{value:T,placeholder:le("SearchGifsTitle"),autoFocusSearch:!0,onChange:ae});case ec.Statistics:return o.ZP.createElement("h3",null,le(C?"ChannelStats.Title":"GroupStats.Title"));case ec.MessageStatistics:return o.ZP.createElement("h3",null,le("Stats.MessageTitle"));case ec.SharedMedia:return o.ZP.createElement("h3",null,le("SharedMedia"));case ec.ManageChannelSubscribers:return o.ZP.createElement("h3",null,le("ChannelSubscribers"));case ec.MemberList:case ec.ManageGroupMembers:return o.ZP.createElement("h3",null,le("GroupMembers"));case ec.ManageReactions:return o.ZP.createElement("h3",null,le("Reactions"));case ec.CreateTopic:return o.ZP.createElement("h3",null,le("NewTopic"));case ec.EditTopic:return o.ZP.createElement("h3",null,le("EditTopic"));default:return o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("h3",null,le(U?"AccDescrTopic":C?"Channel.TitleInfo":P?L?"lng_info_bot_title":"lng_info_user_title":"GroupInfo.Title")),o.ZP.createElement("section",{className:"tools"},Z&&o.ZP.createElement(Jt.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:le("AddContact"),onClick:se},o.ZP.createElement("i",{className:"icon icon-add-user"})),y&&!U&&o.ZP.createElement(Jt.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:le("Edit"),onClick:oe},o.ZP.createElement("i",{className:"icon icon-edit"})),j&&o.ZP.createElement(Jt.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:le("EditTopic"),onClick:ie},o.ZP.createElement("i",{className:"icon icon-edit"})),N&&o.ZP.createElement(Jt.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:le("Statistics"),onClick:re},o.ZP.createElement("i",{className:"icon icon-stats"}))))}}()))})));var nc=n(91);var ac=n(27407);function sc(e,t,n,a){const[s,o]=(0,ac.Z)(n?t:void 0,a,void 0,i.Vk);return[s,o,!(!s||!a||s[0]===a[0])]}function ic(e,t,n,a,s,r,c){const d=(0,o.sO)();(0,wt.Z)((()=>{d.current=void 0}),[c]),(0,wt.Z)((()=>{t===e&&s&&r&&(d.current=(0,g.R5)(s,r,e))}),[s,r,t,e]);const[l,u]=(0,ac.Z)(a?n:void 0,d.current,void 0,"media"===e?i.ENB:i.pnA);return[l,u,!(!l||!d.current||l[0]===d.current[0])]}const oc=(0,L.P2)((e=>e()),250,!1);let rc=!1;var cc=n(21273),dc=n(31876),lc=n(16568),uc=n(70180),mc=n(13709),hc=n(45418),gc=n(47262),pc=n(41151),fc=n(22275);const Ic=[{type:"media",title:"SharedMediaTab2"},{type:"documents",title:"SharedFilesTab2"},{type:"links",title:"SharedLinksTab2"},{type:"audio",title:"SharedMusicTab2"}],vc=(0,o.X$)((0,a.c$)(((e,t)=>{let{chatId:n,topicId:a,isMobile:s}=t;const i=(0,m.Z1)(e,n),o=(0,m.x6)(e,n),r=(0,m.Zw)(e,n),{currentType:c,resultsByType:d}=(0,m.we)(e)||{},{foundIds:l}=d&&c&&d[c]||{},{byId:u,statusesById:h}=e.users,{byId:p}=e.chats,f=i&&(0,g.Bf)(i),I=i&&(0,g.eA)(i),v=!a&&(f||I&&(0,g.Nl)(i)),w=o?.members,b=o?.adminMembersById,Z=v&&i&&(i.isForbidden||o&&!o.canViewMembers),P=v&&i&&((0,g.VE)(i,"inviteUsers")||!(0,g.Mg)(i,"inviteUsers")||i.isCreator),y=v&&i&&((0,g.VE)(i,"banUsers")||i.isCreator),C=(0,m.f2)(e,n);let S,E,M;return(0,g.YC)(n)&&(E=n,M=(0,m.dy)(e,E),S=M&&!M.isSelf&&!(0,g.cS)(M)),{theme:(0,m.Pu)(e),isChannel:I,resolvedUserId:E,messagesById:r,foundIds:l,mediaSearchType:c,hasCommonChatsTab:S,hasMembersTab:v,areMembersHidden:Z,canAddMembers:P,canDeleteMembers:y,currentUserId:e.currentUserId,isRightColumnShown:(0,m.Jf)(e,s),isRestricted:i?.isRestricted,lastSyncTime:e.lastSyncTime,activeDownloadIds:C?.ids,usersById:u,userStatusesById:h,chatsById:p,isChatProtected:i?.isProtected,...v&&w&&{members:w,adminMembersById:b},...S&&M&&{commonChatIds:M.commonChats?.ids}}}))((e=>{let{chatId:t,topicId:n,profileState:r,onProfileStateChange:d,theme:u,isChannel:m,resolvedUserId:h,currentUserId:p,messagesById:f,foundIds:I,mediaSearchType:v,hasCommonChatsTab:b,hasMembersTab:Z,areMembersHidden:P,canAddMembers:y,canDeleteMembers:C,commonChatIds:S,members:E,adminMembersById:M,usersById:R,userStatusesById:k,chatsById:T,isRightColumnShown:A,isRestricted:N,lastSyncTime:x,activeDownloadIds:B,isChatProtected:L}=e;const{setLocalMediaSearchType:U,loadMoreMembers:j,loadCommonChats:O,openChat:F,searchMediaMessagesLocal:_,openMediaViewer:D,openAudioPlayer:$,focusMessage:q,loadProfilePhotos:H,setNewChatMembersDialogState:G}=(0,a.Sv)(),V=(0,o.sO)(null),W=(0,o.sO)(null),z=(0,Dt.Z)(),[X,Y]=(0,o.eJ)(0),[J,K]=(0,o.eJ)(),Q=(0,o.Ye)((()=>[...Z?[{type:"members",title:m?"ChannelSubscribers":"GroupMembers"}]:[],...Ic,...n?[]:[{type:"voice",title:"SharedVoiceTab2"}],...b?[{type:"commonChats",title:"SharedGroupsTab2"}]:[]]),[b,Z,m,n]),ee=X>Q.length-1?Q.length-1:X,te=Q[ee].type,[ne,ae,se,ie]=function(e,t,n,a,s,i,r,c,d,l,u,m,h,p){const f="members"!==a&&s?s:a,I=(0,o.Ye)((()=>{if(i&&c&&d)return(0,g.Z0)(i.map((e=>{let{userId:t}=e;return t})),c,d)}),[i,c,d]),v=(0,o.Ye)((()=>{if(r&&l)return(0,g.ih)(r,l,!0)}),[l,r]),[w,b,Z]=sc(0,e,h,I),[P,y,C]=ic("media",f,n,h,u,m,p),[S,E,M]=ic("documents",f,n,h,u,m,p),[R,k,T]=ic("links",f,n,h,u,m,p),[A,N,x]=ic("audio",f,n,h,u,m,p),[B,L,U]=ic("voice",f,n,h,u,m,p),[j,O,F]=sc(0,t,h,v);let _,D,$=!1;switch(f){case"members":_=w,D=b,$=Z;break;case"commonChats":_=j,D=O,$=F;break;case"media":_=P,D=y,$=C;break;case"documents":_=S,D=E,$=M;break;case"links":_=R,D=k,$=T;break;case"audio":_=A,D=N,$=x;break;case"voice":_=B,D=L,$=U}return[f,_,D,$]}(j,O,_,te,v,E,S,R,k,T,f,I,x,n),oe="members"===ne||!Z&&"media"===ne,re=Q.findIndex((e=>{let{type:t}=e;return t===ne})),{handleScroll:ce}=function(e,t,n,a){(0,ft.Z)((n=>{let[s]=n;if(s&&s!==t){const n=e.current,s=n.querySelector(".TabList");n.scrollTop<s.offsetTop&&(a("members"===t?w.vi.MemberList:w.vi.SharedMedia),rc=!0,(0,Ua.ZP)(n,s,"start",void 0,void 0,void 0,300),setTimeout((()=>{rc=!1}),350))}}),[t,a,e]),(0,ft.Z)((t=>{let[s]=t;if(n!==w.vi.Profile||n===s)return;const i=e.current;if(!i)return;const o=i.querySelector(".TabList");!o||o.offsetTop>i.scrollTop||(rc=!0,(0,Ua.ZP)(i,i.firstElementChild,"start",void 0,2*i.offsetHeight),setTimeout((()=>{rc=!1}),350),a(n))}),[n,e,a]);const s=(0,pt.Z)((()=>{const n=e.current;if(!n)return;const s=n.querySelector(".TabList");if(!s)return;let i=w.vi.Profile;n.scrollTop>=s.offsetTop&&(i="members"===t?w.vi.MemberList:w.vi.SharedMedia),a(i)}));return(0,o.d4)((()=>{rc||s()}),[s,t]),{handleScroll:(0,pt.Z)((()=>{rc||oc(s)}))}}(V,ne,r,d),{applyTransitionFix:de,releaseTransitionFix:le}=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:".Transition.shared-media-transition";(0,o.d4)((()=>{function n(){const n=e.current,a=n.querySelector(t),s=n.querySelector(".TabList");if(a&&s){const e=n.offsetHeight-s.offsetHeight;(0,c.WM)((()=>{a.style.minHeight=`${e}px`}))}}return n(),window.addEventListener("resize",n,!1),()=>{window.removeEventListener("resize",n,!1)}}),[e,t]);const n=(0,pt.Z)((()=>{(0,c.i$)((()=>{const t=e.current;if("hidden"===t.style.overflowY)return;const n=t.offsetWidth-t.clientWidth;(0,c.WM)((()=>{t.style.overflowY="hidden",t.style.paddingRight=`${n}px`}))}))})),a=(0,pt.Z)((()=>{const t=e.current;t.style.overflowY="scroll",t.style.paddingRight="0"}));return{applyTransitionFix:n,releaseTransitionFix:a}}(V),[ue,me]=(()=>{const[e,t]=(0,o.eJ)(0);return[e,(0,o.I4)((()=>{t((e=>e+1))}),[])]})(),{observe:he}=(0,$a.S1)({rootRef:V,throttleMs:500}),ge=(0,pt.Z)((()=>{le(),me()})),pe=(0,pt.Z)((()=>{G({newChatMembersProgress:w.WB.InProgress})}));(0,o.d4)((()=>{U({mediaType:te})}),[U,te,n]);const fe=h||t;(0,o.d4)((()=>{x&&H({profileId:fe})}),[H,fe,x]);const Ie=(0,pt.Z)((e=>{D({chatId:fe,threadId:l._f,mediaId:e,origin:w.bZ.SharedMedia})})),ve=(0,pt.Z)((e=>{$({chatId:fe,messageId:e})})),we=(0,pt.Z)((e=>{F({id:e})})),be=(0,pt.Z)((e=>{q({chatId:fe,messageId:e})})),Ze=(0,pt.Z)((()=>{K(void 0)}));let Pe;(0,ft.Z)((e=>{let[t]=e;if(0===X||t===Z)return;const n=X+(Z?1:-1);Y(Math.min(n,Q.length-1))}),[Z,X,Q]),(0,o.d4)((()=>{if(W.current&&s.$b)return(0,pn.sf)(W.current,{selectorToPreventScroll:".Profile",onSwipe:(e,t)=>t===pn.eM.Left?(Y(Math.min(ee+1,Q.length-1)),!0):t===pn.eM.Right&&(Y(Math.max(0,ee-1)),!0)})}),[ee,Q.length]),oe?Pe=A?0:1e3:ae||(Pe=i.Yan);const ye=(0,Qn.Z)([t,n,ne,ee],Pe);return o.ZP.createElement(cc.Z,{ref:V,className:"Profile custom-scroll",itemSelector:`.shared-media-transition > .Transition_slide-active.${ne}-list > .scroll-item`,items:ye?ae:void 0,cacheBuster:ue,sensitiveArea:i.qUX,preloadBackwards:ye?"members"===ne?i.Vk:i.ENB:0,noScrollRestoreOnTop:!0,noFastList:!0,onLoadMore:se,onScroll:ce},!ie&&function(e,t,n){return o.ZP.createElement("div",{className:"profile-info"},o.ZP.createElement(lc.Z,{userId:t||e,canPlayVideo:n}),o.ZP.createElement(uc.Z,{chatOrUserId:t||e}))}(t,h,A&&ye),!N&&o.ZP.createElement("div",{className:"shared-media"},o.ZP.createElement(_t.Z,{ref:W,name:z.isRtl?"slideOptimizedRtl":"slideOptimized",activeKey:re,renderCount:Q.length,shouldRestoreHeight:!0,className:"shared-media-transition",onStart:de,onStop:ge},function(){if(!ae||!ye||!f){const e=oe&&!ye,t=Boolean("members"===ne&&P);return o.ZP.createElement("div",{className:"content empty-list"},!e&&!t&&o.ZP.createElement(nn.Z,null),t&&o.ZP.createElement(gc.Z,{text:"You have no access to group members list."}))}if(!ae.length){let e;switch(ne){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 o.ZP.createElement("div",{className:"content empty-list"},o.ZP.createElement(gc.Z,{text:e}))}return o.ZP.createElement("div",{className:`content ${ne}-list`,dir:z.isRtl&&"media"===ne?"rtl":void 0,teactFastList:!0},"media"===ne?ae.map((e=>f[e]&&o.ZP.createElement(mc.Z,{key:e,message:f[e],isProtected:L||f[e].isProtected,observeIntersection:he,onClick:Ie}))):"documents"===ne?ae.map((e=>f[e]&&o.ZP.createElement(Ss.Z,{key:e,message:f[e],withDate:!0,smaller:!0,className:"scroll-item",isDownloading:B?.includes(e),observeIntersection:he,onDateClick:be}))):"links"===ne?ae.map((e=>f[e]&&o.ZP.createElement(hc.Z,{key:e,message:f[e],isProtected:L||f[e].isProtected,observeIntersection:he,onMessageClick:be}))):"audio"===ne?ae.map((e=>f[e]&&o.ZP.createElement(Es.ZP,{key:e,theme:u,message:f[e],origin:w.Cr.SharedMedia,date:f[e].date,lastSyncTime:x,className:"scroll-item",onPlay:ve,onDateClick:be,canDownload:!L&&!f[e].isProtected,isDownloading:B?.includes(e)}))):"voice"===ne?ae.map((e=>f[e]&&o.ZP.createElement(Es.ZP,{key:e,theme:u,message:f[e],senderTitle:(0,nc.F)(z,f[e],T,R),origin:w.Cr.SharedMedia,date:f[e].date,lastSyncTime:x,className:"scroll-item",onPlay:ve,onDateClick:be,canDownload:!L&&!f[e].isProtected,isDownloading:B?.includes(e)}))):"members"===ne?ae.map(((e,t)=>{return o.ZP.createElement(dc.Z,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item small-icon",onClick:()=>we(e),contextActions:(n=e,n!==p&&C?[{title:z("lng_context_remove_from_group"),icon:"stop",handler:()=>{K(n)}}]:void 0)},o.ZP.createElement(zn.Z,{userId:e,adminMember:M?.[e],forceShowSelf:!0}));var n})):"commonChats"===ne?ae.map(((e,t)=>o.ZP.createElement(dc.Z,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item small-icon",onClick:()=>F({id:e})},o.ZP.createElement(Xn.Z,{chatId:e})))):void 0)}()),o.ZP.createElement(In.Z,{big:!0,activeTab:ee,tabs:Q,onSwitchTab:Y})),y&&o.ZP.createElement(pc.Z,{isShown:"members"===ne,onClick:pe,ariaLabel:z("lng_channel_add_users")},o.ZP.createElement("i",{className:"icon icon-add-user-filled"})),C&&o.ZP.createElement(fc.Z,{isOpen:Boolean(J),userId:J,onClose:Ze}))}))),wc=(0,o.X$)((e=>{const t=(0,At.Z)(gt.gl.Extra,"RightSearch");return t?o.ZP.createElement(t,e):o.ZP.createElement(bn.Z,null)})),bc=(0,o.X$)((e=>{const t=(0,At.Z)(gt.gl.Extra,"Management");return t?o.ZP.createElement(t,e):o.ZP.createElement(bn.Z,null)})),Zc=e=>{const t=(0,At.Z)(gt.gl.Extra,"Statistics");return t?o.ZP.createElement(t,e):o.ZP.createElement(bn.Z,null)},Pc=e=>{const t=(0,At.Z)(gt.gl.Extra,"MessageStatistics");return t?o.ZP.createElement(t,e):o.ZP.createElement(bn.Z,null)},yc=(0,o.X$)((()=>{const e=(0,At.Z)(gt.gl.Extra,"StickerSearch");return e?o.ZP.createElement(e,null):o.ZP.createElement(bn.Z,null)})),Cc=(0,o.X$)((()=>{const e=(0,At.Z)(gt.gl.Extra,"GifSearch");return e?o.ZP.createElement(e,null):o.ZP.createElement(bn.Z,null)})),Sc=(0,o.X$)((()=>{const e=(0,At.Z)(gt.gl.Extra,"PollResults");return e?o.ZP.createElement(e,null):o.ZP.createElement(bn.Z,null)}));var Ec=n(11820);const Mc=(0,o.X$)((0,a.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,m.Z1)(e,n),{userIds:s}=e.contactList||{},{byId:i}=e.chats,{newChatMembersProgress:o}=(0,m.jU)(e),{currentUserId:r}=e,c=a&&(0,g.eA)(a),{query:d,fetchingStatus:l,globalUserIds:u,localUserIds:h}=(0,m.jU)(e).userSearch;return{isChannel:c,members:(0,m.x6)(e,n)?.members,currentUserId:r,chatsById:i,localContactIds:s,searchQuery:d,isSearching:l,isLoading:o===w.WB.Loading,globalUserIds:u,localUserIds:h}}))((e=>{let{isChannel:t,members:n,onNextStep:s,currentUserId:i,chatsById:r,localContactIds:c,isLoading:d,searchQuery:l,isSearching:u,localUserIds:m,globalUserIds:h,onClose:p,isActive:f}=e;const{setUserSearchQuery:I}=(0,a.Sv)(),v=(0,Dt.Z)(),[w,Z]=(0,o.eJ)([]),P=(0,_n.Z)(w)===w;(0,fn.Z)({isActive:f,onBack:p});const y=(0,o.Ye)((()=>n?n.map((e=>e.userId)):[]),[n]),C=(0,o.I4)((e=>{I({query:e})}),[I]),S=(0,o.Ye)((()=>{const e=(0,a.Rd)().users.byId,n=c?(0,g.kK)(c,e,l):[];return(0,g.ih)((0,b.Tw)([...n,...m||[],...h||[]]).filter((n=>{const a=e[n];return!y.includes(n)&&n!==i&&(!a||!(0,g.cS)(a)||!t&&a.canBeInvitedToGroup)})),r)}),[c,r,l,m,h,i,y,t]),E=(0,o.I4)((()=>{w.length&&(I({query:""}),s(w))}),[w,I,s]);return o.ZP.createElement("div",{className:"AddChatMembers"},o.ZP.createElement("div",{className:"AddChatMembers-inner"},o.ZP.createElement(Ec.Z,{itemIds:S,selectedIds:w,filterValue:l,filterPlaceholder:v("lng_channel_add_users"),searchInputId:"new-members-picker-search",isLoading:u,onSelectedIdsChange:Z,onFilterChange:C,isSearchable:!0,noScrollRestore:P}),o.ZP.createElement(pc.Z,{isShown:Boolean(w.length),disabled:d,ariaLabel:v("lng_channel_add_users"),onClick:E},d?o.ZP.createElement(nn.Z,{color:"white"}):o.ZP.createElement("i",{className:"icon icon-arrow-right"}))))}))),Rc=(0,o.X$)((e=>{const t=(0,At.Z)(gt.gl.Extra,"CreateTopic");return t?o.ZP.createElement(t,e):o.ZP.createElement(bn.Z,null)})),kc=(0,o.X$)((e=>{const t=(0,At.Z)(gt.gl.Extra,"EditTopic");return t?o.ZP.createElement(t,e):o.ZP.createElement(bn.Z,null)})),Tc=450+i.fK3,Ac=Object.keys(w.qt).length/2,Nc=Object.keys(w.u1).length/2;function xc(){const e=document.querySelector(".RightHeader .SearchInput input");e&&e.blur()}const Bc=(0,o.X$)((0,a.c$)(((e,t)=>{let{isMobile:n}=t;const{chatId:a,threadId:s}=(0,m.Bt)(e)||{},i=(0,m.g4)(e),{management:o,shouldSkipHistoryAnimations:r}=(0,m.jU)(e),c=a?o.byChatId[a]?.nextScreen:void 0,d=(a?(0,m.Z1)(e,a)?.isForum:void 0)&&Boolean(s&&s!==l._f);return{contentKey:(0,m.Wq)(e,n),chatId:a,threadId:s,isInsideTopic:d,isChatSelected:Boolean(a&&i),shouldSkipHistoryAnimations:r,nextManagementScreen:c}}))((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:f,setGifSearchQuery:I,closePollResults:v,addChatMembers:b,setNewChatMembersDialogState:Z,setEditingExportedInvite:P,toggleStatistics:y,toggleMessageStatistics:C,setOpenedInviteInfo:S,requestNextManagementScreen:E,closeCreateTopicPanel:M,closeEditTopicPanel:R}=(0,a.Sv)(),{width:k}=(0,On.Z)(),[T,A]=(0,o.eJ)(w.vi.Profile),[N,x]=(0,o.eJ)(w.u1.Initial),[B,L]=(0,o.eJ)(),[U,j]=(0,o.eJ)(),O=T!==w.vi.Profile,F=void 0!==n,_=n===w.qt.ChatInfo,D=n===w.qt.Search,$=n===w.qt.Management,q=n===w.qt.Statistics,H=n===w.qt.MessageStatistics,G=n===w.qt.StickerSearch,V=n===w.qt.GifSearch,W=n===w.qt.PollResults,z=n===w.qt.AddingMembers,X=n===w.qt.CreateTopic,Y=n===w.qt.EditTopic,J=k<=i._mX,[K,Q]=(0,o.eJ)(!F),ee=null!==(t=(0,Vn.Z)(n,!0,!l))&&void 0!==t?t:-1,te=(0,pt.Z)((function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];switch(n){case w.qt.AddingMembers:Z({newChatMembersProgress:w.WB.Closed});break;case w.qt.ChatInfo:if(O&&e){A(w.vi.Profile);break}h({force:!1},{forceSyncOnIOs:!0});break;case w.qt.Management:switch(N){case w.u1.Initial:g();break;case w.u1.ChatPrivacyType:case w.u1.Discussion:case w.u1.GroupPermissions:case w.u1.GroupType:case w.u1.ChatAdministrators:case w.u1.ChannelSubscribers:case w.u1.GroupMembers:case w.u1.Invites:case w.u1.Reactions:case w.u1.JoinRequests:case w.u1.ChannelRemovedUsers:x(w.u1.Initial);break;case w.u1.GroupUserPermissionsCreate:case w.u1.GroupRemovedUsers:case w.u1.GroupUserPermissions:x(w.u1.GroupPermissions),L(void 0),j(void 0);break;case w.u1.ChatAdminRights:case w.u1.ChatNewAdminRights:case w.u1.GroupAddAdmins:case w.u1.GroupRecentActions:x(w.u1.ChatAdministrators);break;case w.u1.EditInvite:case w.u1.InviteInfo:x(w.u1.Invites),S({chatId:s,invite:void 0}),P({chatId:s,invite:void 0})}break;case w.qt.MessageStatistics:C();break;case w.qt.Statistics:y();break;case w.qt.Search:xc(),p();break;case w.qt.StickerSearch:xc(),f({query:void 0});break;case w.qt.GifSearch:xc(),I({query:void 0});break;case w.qt.PollResults:v();break;case w.qt.CreateTopic:M();break;case w.qt.EditTopic:R()}})),ne=(0,pt.Z)(((e,t)=>{L(e),j(t)})),ae=(0,pt.Z)((e=>{b({chatId:s,memberIds:e})}));function se(e){if(-1!==ee)switch(ee){case w.qt.AddingMembers:return o.ZP.createElement(Mc,{key:`add_chat_members_${s}`,chatId:s,isActive:F&&e,onNextStep:ae,onClose:te});case w.qt.ChatInfo:return o.ZP.createElement(vc,{key:`profile_${s}`,chatId:s,topicId:d?r:void 0,profileState:T,isMobile:c,onProfileStateChange:A});case w.qt.Search:return o.ZP.createElement(wc,{key:`right_search_${s}`,chatId:s,threadId:r,onClose:te,isActive:F&&e});case w.qt.Management:return o.ZP.createElement(bc,{key:`management_${s}`,chatId:s,currentScreen:N,isPromotedByCurrentUser:U,selectedChatMemberId:B,isActive:F&&e,onScreenSelect:x,onChatMemberSelect:ne,onClose:te});case w.qt.Statistics:return o.ZP.createElement(Zc,{chatId:s});case w.qt.MessageStatistics:return o.ZP.createElement(Pc,{chatId:s,isActive:F&&e});case w.qt.StickerSearch:return o.ZP.createElement(yc,{onClose:te,isActive:F&&e});case w.qt.GifSearch:return o.ZP.createElement(Cc,{onClose:te,isActive:F&&e});case w.qt.PollResults:return o.ZP.createElement(Sc,{onClose:te,isActive:F&&e});case w.qt.CreateTopic:return o.ZP.createElement(Rc,{onClose:te,isActive:F&&e});case w.qt.EditTopic:return o.ZP.createElement(kc,{onClose:te,isActive:F&&e})}}return(0,o.d4)((()=>F?(0,jt.Z)(te):void 0),[F,te]),(0,o.d4)((()=>{setTimeout((()=>{Q(!F)}),Tc)}),[F]),(0,o.d4)((()=>{m&&(x(m),E(void 0))}),[m,E]),(0,o.d4)((()=>{F&&J&&te()}),[J]),(0,_a.Z)((e=>{let[t]=e;t!==s&&(A(w.vi.Profile),x(w.u1.Initial))}),[s]),(0,fn.Z)({isActive:l&&(n===w.qt.ChatInfo||n===w.qt.Management||n===w.qt.AddingMembers||n===w.qt.CreateTopic||n===w.qt.EditTopic),onBack:()=>te(!1)}),o.ZP.createElement("div",{id:"RightColumn-wrapper",className:l?void 0:"is-hidden"},J&&o.ZP.createElement("div",{className:"overlay-backdrop",onClick:te}),o.ZP.createElement("div",{id:"RightColumn"},o.ZP.createElement(tc,{chatId:s,threadId:r,isColumnOpen:F,isProfile:_,isSearch:D,isManagement:$,isStatistics:q,isMessageStatistics:H,isStickerSearch:G,isGifSearch:V,isPollResults:W,isCreatingTopic:X,isEditingTopic:Y,isAddingChatMembers:z,profileState:T,managementScreen:N,onClose:te,onScreenSelect:x}),o.ZP.createElement(_t.Z,{name:K||u?"none":"zoomFade",renderCount:Ac+Nc,activeKey:$?Ac+N:ee,shouldCleanup:!0,cleanupExceptionKey:ee===w.qt.MessageStatistics?w.qt.Statistics:void 0},se)))}))),Lc=(0,o.X$)((e=>{let{isOpen:t}=e;const n=(0,At.Z)(gt.gl.Extra,"MediaViewer",!t);return n?o.ZP.createElement(n,null):void 0}));let Uc=[],jc=!1;function Oc(e,t){Uc.push({url:e,filename:t}),jc||(jc=!0,setTimeout((async()=>{await async function(){let e=0;for(const t of Uc)Fc(t),e++,10===e&&(await(0,L.wO)(1e3),e=0);Uc=[]}(),jc=!1}),1e3))}function Fc(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 _c=new Set,Dc=new Set,$c=(0,o.X$)((0,a.c$)((e=>({activeDownloads:(0,m.jU)(e).activeDownloads.byChatId})))((e=>{let{activeDownloads:t}=e;const{cancelMessagesMediaDownload:n,showNotification:i}=(0,a.Sv)(),r=(0,Oa.Z)(1e3,!0),c=(0,pt.Z)((e=>{Dc.add(e),r((()=>{Dc.size&&(n({messages:Array.from(Dc)}),Dc.clear())}))}));(0,o.d4)((()=>{const e=(0,a.Rd)().messages.byChatId,n=(0,a.Rd)().scheduledMessages.byChatId,o=Object.entries(t).map((t=>{let[a,s]=t;const i=s.ids?.map((t=>e[a]?.byId[t])),o=s.scheduledIds?.map((e=>n[a]?.byId[e]));return(0,b.oA)([...i||[],...o||[]])})).flat();o.length?o.forEach((e=>{if(_c.has(e))return;_c.add(e);const t=(0,g.Ti)(e,"download");if(!t)return void c(e);const n=ze.UV(t);if(n)return Oc(n,(0,g.w6)(e)),void c(e);const{document:a,video:o,audio:r}=e.content;if(((a||o||r)?.size||0)>s.l0&&!s.rT&&!s.Mc)return i({message:"Downloading files bigger than 2GB is not supported in your browser."}),void c(e);const d=(0,g.kG)(e,"download");ze.he(t,d,!0).then((t=>{if(d===l.IU.DownloadUrl){const n=new URL(t,window.document.baseURI),a=(0,g.w6)(e);n.searchParams.set("filename",encodeURIComponent(a)),window.open(n.toString())?.addEventListener("beforeunload",(()=>{i({message:"Download started. Please, do not close the app before it is finished."})}))}else t&&Oc(t,(0,g.w6)(e));c(e)}))})):_c.clear()}),[t,n,c,i])})));var qc=n(13103);const Hc=(0,o.X$)((0,a.c$)(((e,t)=>{let{openedGame:n}=t;const{chatId:a}=n||{},s=a&&(0,m.Z1)(e,a);return{canPost:Boolean(s)&&(0,g.Qm)(s,l._f)}}))((e=>{let{openedGame:t,gameTitle:n,canPost:a}=e;const{closeGame:s,openForwardMenu:i}=(0,O.Sv)(),r=(0,Dt.Z)(),{url:c,chatId:d,messageId:l}=t||{},u=Boolean(c),m=(0,So.Z)(d);(0,Mt.Z)((()=>{m({type:"playingGame"})}),u&&a?5e3:void 0);const h=(0,o.I4)((e=>{try{const t=JSON.parse(e.data);"share_score"===t.eventType&&(i({fromChatId:d,messageIds:[l],withMyScore:!0}),s()),"share_game"===t.eventType&&(i({fromChatId:d,messageIds:[l]}),s())}catch(e){}}),[d,s,l,i]),g=(0,o.I4)((e=>{e.currentTarget.focus()}),[]);return(0,o.d4)((()=>(window.addEventListener("message",h),()=>window.removeEventListener("message",h))),[h]),o.ZP.createElement(qc.Z,{className:"GameModal",isOpen:u,onClose:s,title:n,hasCloseButton:!0},u&&o.ZP.createElement("iframe",{className:"game-frame",onLoad:g,src:c,title:r("AttachGame"),sandbox:"allow-scripts allow-same-origin allow-orientation-lock",allow:"fullscreen"}))}))),Gc=(0,o.X$)((e=>{let{isOpen:t}=e;const n=(0,At.Z)(gt.gl.Extra,"Notifications",!t);return n?o.ZP.createElement(n,null):void 0})),Vc=(0,o.X$)((e=>{let{isOpen:t}=e;const n=(0,At.Z)(gt.gl.Extra,"Dialogs",!t);return n?o.ZP.createElement(n,null):void 0})),Wc=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,At.Z)(gt.gl.Extra,"ForwardRecipientPicker",!t);return n?o.ZP.createElement(n,e):void 0})),zc=(0,o.X$)((e=>{const{url:t}=e,n=(0,At.Z)(gt.gl.Extra,"SafeLinkModal",!t);return n?o.ZP.createElement(n,e):void 0})),Xc=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,At.Z)(gt.gl.Extra,"HistoryCalendar",!t);return n?o.ZP.createElement(n,e):void 0})),Yc=(0,o.X$)((e=>{const{groupCallId:t}=e,n=(0,At.Z)(gt.gl.Calls,"GroupCall",!t);return n?o.ZP.createElement(n,e):void 0})),Jc=(0,o.X$)((e=>{const{isActive:t}=e,n=(0,At.Z)(gt.gl.Calls,"ActiveCallHeader",!t);return n?o.ZP.createElement(n,null):void 0})),Kc=(0,o.X$)((e=>{const{isActive:t}=e,n=(0,At.Z)(gt.gl.Calls,"PhoneCall",!t);return n?o.ZP.createElement(n,null):void 0}));function Qc(){return Qc=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},Qc.apply(this,arguments)}const ed=(0,o.X$)((0,a.c$)((e=>({messageLists:(0,m.jU)(e).messageLists})))((e=>{let{messageLists:t}=e;const{openChat:n}=(0,a.Sv)(),s=()=>{n({id:void 0},{forceSyncOnIOs:!0})},i=e=>{let{chatId:t,type:n,threadId:a}=e;(0,fn.Z)({isActive:!0,hash:(0,v.tB)(t,n,a),onBack:s})};return o.ZP.createElement("div",null,t?.map(((e,t)=>o.ZP.createElement(i,Qc({key:`${e.chatId}_${e.threadId}_${e.type}_${t}`},e)))))}))),td=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,At.Z)(gt.gl.Extra,"NewContactModal",!t);return n?o.ZP.createElement(n,e):void 0})),nd=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,At.Z)(gt.gl.Calls,"RatePhoneCallModal",!t);return n?o.ZP.createElement(n,e):void 0})),ad=(0,o.X$)((e=>{const{webApp:t}=e,n=(0,At.Z)(gt.gl.Extra,"WebAppModal",!t);return n?o.ZP.createElement(n,e):void 0})),sd=(0,o.X$)((e=>{const{bot:t}=e,n=(0,At.Z)(gt.gl.Extra,"BotTrustModal",!t);return n?o.ZP.createElement(n,e):void 0})),id=(0,o.X$)((e=>{const{bot:t}=e,n=(0,At.Z)(gt.gl.Extra,"AttachBotInstallModal",!t);return n?o.ZP.createElement(n,e):void 0})),od={root:"vfd0Bo1X6k19aaxQ577t"},rd=["#E8BC2C","#D0049E","#02CBFE","#5723FD","#FE8C27","#6CB859"],cd=(0,o.X$)((0,a.c$)((e=>(0,b.ei)((0,m.jU)(e),["confetti"])))((e=>{let{confetti:t}=e;const n=(0,o.sO)(null),a=(0,o.sO)([]),s=(0,o.sO)(!1),i=(0,On.Z)(),r=(0,Ct.Z)(),{isMobile:d}=(0,M.ZP)(),l=d?50:100,{lastConfettiTime:u,top:m,width:h,left:g,height:p}=t||{},f=(0,o.I4)((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:l;for(let s=0;s<n;s++){const n=s%2,i={x:e*(n?-.1:1.1),y:.75*t},o=Math.random()*e*1.5,r={x:n?o:-1*o,y:-t/2-Math.random()*t},c=rd[Math.floor(Math.random()*rd.length)],d=10;a.current.push({pos:i,size:d,color:c,velocity:r,flicker:d,flickerFrequency:.2*Math.random(),rotation:0,lastDrawnAt:Date.now(),frameCount:0})}}),[l]),I=(0,o.I4)((()=>{if(!n.current||!s.current)return;const e=n.current,t=e.getContext("2d");if(!t)return;const{width:i,height:o}=e;t.clearRect(0,0,i,o);const r=[];a.current.forEach(((e,n)=>{const{pos:s,velocity:i,size:c,color:d,flicker:l,flickerFrequency:u,rotation:m,lastDrawnAt:h,frameCount:g}=e,p=(Date.now()-h)/1e3,f={x:s.x+i.x*p,y:s.y+i.y*p},I={x:.98*i.x,y:i.y+=1e3*p},v=c*Math.abs(Math.sin(g*u)),w=5*g*u*(Math.PI/180),b=g+1,Z=Date.now();if(f.y>o+e.size)return void r.push(e);const P={...e,pos:f,velocity:I,flicker:v,rotation:w,lastDrawnAt:Z,frameCount:b};a.current[n]=P,t.fillStyle=d,t.beginPath(),t.ellipse(s.x,s.y,c,l,m,0,2*Math.PI),t.fill()})),a.current=a.current.filter((e=>!r.includes(e))),a.current.length?(0,c.i$)(I):s.current=!1}),[]);if((0,wt.Z)((e=>{let t,[n]=e;return n!==u&&(f(h||i.width,p||i.height),t=setTimeout(r,1e4),s.current||(s.current=!0,(0,c.i$)(I))),()=>{clearTimeout(t)}}),[u,r,I]),!u||Date.now()-u>1e4)return;const v=(0,xs.Z)(Boolean(m)&&`top: ${m}px`,Boolean(g)&&`left: ${g}px`,Boolean(h)&&`width: ${h}px`,Boolean(p)&&`height: ${p}px`);return o.ZP.createElement("div",{id:"Confetti",className:od.root,style:v},o.ZP.createElement("canvas",{ref:n,className:od.canvas,width:i.width,height:i.height}))}))),dd=(0,o.X$)((e=>{const{urlAuth:t}=e,n=(0,At.Z)(gt.gl.Extra,"UrlAuthModal",!t);return n?o.ZP.createElement(n,e):void 0})),ld=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,At.Z)(gt.gl.Extra,"PremiumMainModal",!t);return n?o.ZP.createElement(n,e):void 0})),ud=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,At.Z)(gt.gl.Extra,"PaymentModal",!t);return n?o.ZP.createElement(n,e):void 0})),md=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,At.Z)(gt.gl.Extra,"ReceiptModal",!t);return n?o.ZP.createElement(n,e):void 0})),hd=(0,o.X$)((e=>{const{limit:t}=e,n=(0,At.Z)(gt.gl.Extra,"PremiumLimitReachedModal",!t);return n?o.ZP.createElement(n,e):void 0})),gd=(0,o.X$)((e=>{const{folder:t}=e,n=(0,At.Z)(gt.gl.Extra,"DeleteFolderDialog",!t);return n?o.ZP.createElement(n,e):void 0})),pd=(0,o.X$)((e=>{const{customEmojiSetIds:t}=e,n=(0,At.Z)(gt.gl.Extra,"CustomEmojiSetsModal",!t);return n?o.ZP.createElement(n,e):void 0})),fd=(0,o.X$)((e=>{const{requestedDraft:t}=e,n=(0,At.Z)(gt.gl.Extra,"DraftRecipientPicker",!t);return n?o.ZP.createElement(n,e):void 0})),Id=(0,o.X$)((e=>{const{requestedAttachBotInChat:t}=e,n=(0,At.Z)(gt.gl.Extra,"AttachBotRecipientPicker",!t);return n?o.ZP.createElement(n,e):void 0})),vd=(0,o.X$)((e=>{const{isOpen:t,shouldLoad:n}=e,a=(0,At.Z)(gt.gl.Extra,"ReactionPicker",!t&&!n);return a?o.ZP.createElement(a,e):void 0})),wd=(0,o.X$)((e=>{const{info:t}=e,n=(0,At.Z)(gt.gl.Extra,"ChatlistModal",!t);return n?o.ZP.createElement(n,e):void 0}));let bd=!1;const Zd=(0,o.X$)((0,a.c$)(((e,t)=>{let{isMobile:n}=t;const{settings:{byKey:{language:a,wasTimeFormatSetManually:s}},lastSyncTime:i}=e,{botTrustRequest:o,requestedAttachBotInstall:r,requestedAttachBotInChat:c,requestedDraft:d,urlAuth:l,webApp:u,safeLinkModalUrl:h,openedStickerSetShortName:g,openedCustomEmojiSetIds:p,shouldSkipHistoryAnimations:f,openedGame:I,audioPlayer:v,isLeftColumnShown:w,historyCalendarSelectedAt:b,notifications:Z,dialogs:P,newContact:y,ratingPhoneCall:C,premiumModal:S,isMasterTab:E,payment:M,limitReachedModal:R,deleteFolderDialogModal:k,chatlistModal:T}=(0,m.jU)(e),{chatId:A,messageId:N}=v,x=A&&N?(0,m.hj)(e,A,N):void 0,B=(I&&(0,m.hj)(e,I.chatId,I.messageId))?.content.game?.title,L=e.currentUserId?(0,m.dy)(e,e.currentUserId):void 0,{chatId:U}=(0,m.Bt)(e)||{},j=!(0,m.$Y)(e,"rightColumnAnimations")||!(0,m.FO)(e),O=k?(0,m.Mw)(e,k):void 0;return{lastSyncTime:i,isLeftColumnOpen:w,isMiddleColumnOpen:Boolean(U),isRightColumnOpen:(0,m.Jf)(e,n),isMediaViewerOpen:(0,m.zQ)(e),isForwardModalOpen:(0,m.Ev)(e),isReactionPickerOpen:(0,m.Io)(e),hasNotifications:Boolean(Z.length),hasDialogs:Boolean(P.length),audioMessage:x,safeLinkModalUrl:h,isHistoryCalendarOpen:Boolean(b),shouldSkipHistoryAnimations:f,openedStickerSetShortName:g,openedCustomEmojiSetIds:p,isServiceChatReady:(0,m.UW)(e),activeGroupCallId:E?e.groupCalls.activeGroupCallId:void 0,withInterfaceAnimations:(0,m.FO)(e),language:a,wasTimeFormatSetManually:s,isPhoneCallActive:E?Boolean(e.phoneCall):void 0,addedSetIds:e.stickers.added.setIds,addedCustomEmojiIds:e.customEmojis.added.setIds,newContactUserId:y?.userId,newContactByPhoneNumber:y?.isByPhoneNumber,openedGame:I,gameTitle:B,isRatePhoneCallModalOpen:Boolean(C),botTrustRequest:o,botTrustRequestBot:o&&(0,m.dy)(e,o.botId),attachBotToInstall:r?.bot,requestedAttachBotInChat:c,webApp:u,currentUser:L,urlAuth:l,isCurrentUserPremium:(0,m.wV)(e),isPremiumModalOpen:S?.isOpen,limitReached:R?.limit,isPaymentModalOpen:M.isPaymentModalOpen,isReceiptModalOpen:Boolean(M.receipt),deleteFolderDialog:O,isMasterTab:E,requestedDraft:d,chatlistModal:T,noRightColumnAnimation:j}}))((e=>{let{lastSyncTime:t,isMobile:n,isLeftColumnOpen:l,isMiddleColumnOpen:u,isRightColumnOpen:m,isMediaViewerOpen:h,isForwardModalOpen:g,hasNotifications:p,hasDialogs:f,audioMessage:I,activeGroupCallId:w,safeLinkModalUrl:b,isHistoryCalendarOpen:Z,shouldSkipHistoryAnimations:P,limitReached:y,openedStickerSetShortName:C,openedCustomEmojiSetIds:S,isServiceChatReady:E,withInterfaceAnimations:R,language:k,wasTimeFormatSetManually:T,addedSetIds:A,addedCustomEmojiIds:N,isPhoneCallActive:x,newContactUserId:L,newContactByPhoneNumber:U,openedGame:j,gameTitle:O,isRatePhoneCallModalOpen:F,botTrustRequest:_,botTrustRequestBot:D,attachBotToInstall:$,requestedAttachBotInChat:q,requestedDraft:H,webApp:G,currentUser:V,urlAuth:W,isPremiumModalOpen:z,isPaymentModalOpen:X,isReceiptModalOpen:Y,isReactionPickerOpen:J,isCurrentUserPremium:K,deleteFolderDialog:Q,isMasterTab:ee,chatlistModal:te,noRightColumnAnimation:ne}=e;const{initMain:ae,loadAnimatedEmojis:se,loadNotificationSettings:ie,loadNotificationExceptions:oe,updateIsOnline:re,onTabFocusChange:ce,loadTopInlineBots:de,loadEmojiKeywords:le,loadCountryList:ue,loadAvailableReactions:me,loadStickerSets:he,loadPremiumGifts:ge,loadDefaultTopicIcons:pe,loadAddedStickers:fe,loadFavoriteStickers:Ie,loadDefaultStatusIcons:ve,ensureTimeFormat:we,closeStickerSetModal:be,closeCustomEmojiSets:Ze,checkVersionNotification:Pe,loadConfig:ye,loadAppConfig:Ce,loadAttachBots:Se,loadContactList:Ee,loadCustomEmojis:Me,loadGenericEmojiEffects:Re,closePaymentModal:ke,clearReceipt:Te,checkAppVersion:Ae,openChat:Ne,toggleLeftColumn:xe,loadRecentEmojiStatuses:Be,updatePageTitle:Le,loadTopReactions:Ue,loadRecentReactions:je,loadFeaturedEmojiStickers:Oe,setIsAppUpdateAvailable:Fe}=(0,a.Sv)();i.eMD&&!bd&&(bd=!0,console.log(">>> RENDER MAIN")),(0,kt.Z)((()=>{(0,gt.Pb)(gt.gl.Calls)}),5e3);const[_e,De]=(0,Tt.Z)(!1);(0,kt.Z)(De,7e3);const $e=(0,o.sO)(null),qe=(0,o.sO)(null),{isDesktop:He}=(0,M.ZP)();(0,o.d4)((()=>{l||u||He?l&&u&&n&&xe():xe()}),[He,l,u,n,xe]),(0,Mt.Z)(Ae,ee&&!i.D$V?3e5:void 0,!0),(0,o.d4)((()=>{if(!i.D$V)return;const e=window.electron?.on(d.I.UPDATE_DOWNLOADED,(()=>{Fe(!0)})),t=window.electron?.on(d.I.UPDATE_ERROR,(()=>{Fe(!1),e?.()}));return()=>{t?.(),e?.()}}),[]),(0,o.d4)((()=>{t&&ee&&(re(!0),ye(),Ce(),ae(),me(),se(),Re(),ie(),oe(),de(),le({language:i.pRL}),Se(),Ee(),ge(),pe(),Ae(),Ue(),je(),Oe())}),[t,se,le,oe,ie,de,re,me,Ce,Se,Ee,ge,Ae,ye,Re,pe,Ue,ve,je,Be,K,ee,ae]),(0,o.d4)((()=>{t&&ee&&K&&(ve(),Be())}),[K,ee,t,ve,Be]),(0,o.d4)((()=>{t&&ee&&(k!==i.pRL&&le({language:k}),ue({langCode:k}))}),[k,t,ue,le,ee]),(0,ft.Z)((e=>{let[n]=e;!n&&t&&ee&&Me({ids:Object.keys((0,a.Rd)().customEmojis.byId),ignoreCache:!0})}),[t,ee,Me]),(0,o.d4)((()=>{t&&ee&&(A&&N||(he(),Ie()),A&&N&&fe())}),[t,A,he,Ie,fe,N,ee]),(0,o.d4)((()=>{t&&E&&ee&&Pe()}),[t,E,Pe,ee]),(0,o.d4)((()=>{t&&!T&&we()}),[t,T,we]),(0,o.d4)((()=>{const e=(0,v.dx)();t&&e?.tgaddr&&(0,ht.ou)(decodeURIComponent(e.tgaddr))}),[t]),(0,ft.Z)((e=>{let[n]=e;const a=(0,v.VX)();a&&!n&&t&&Ne({id:a.chatId,threadId:a.threadId,type:a.type})}),[t,Ne]),(0,o.bt)((()=>{const e=$e.current;1===e.parentNode.childElementCount&&(0,r.D_)(e,"Transition_slide-active")}),[]);const Ge=(0,St.Z)(l,void 0,!0,void 0,P,void 0,!0),Ve=(0,o.sO)(!1),We=(0,Ct.Z)();(0,wt.Z)((e=>{let[t]=e;if(void 0===t||l===t||!R)return;Ve.current=!0,s.wZ&&(0,c.Yq)((()=>{document.body.classList.toggle("android-left-blackout-open",!l)}));const n=(0,Et.YW)();(0,mt.L)(document.getElementById("MiddleColumn"),(()=>{n(),Ve.current=!1,We()}))}),[l,R,We]);const ze=(0,St.Z)(m,void 0,!0,void 0,P,void 0,!0),Xe=(0,o.sO)(!1),[Ye,Je]=(0,o.eJ)(m),Ke=(0,Rt.Ar)();(0,wt.Z)((e=>{let[t]=e;if(void 0===t||m===t)return;if(ne)return void Je(m);Xe.current=!0;const n=(0,Et.YW)();(0,mt.L)(document.getElementById("RightColumn"),(()=>{n(),Xe.current=!1,We(),Je(m)}))}),[m,ne,We]);const Qe=(0,ut.Z)(Ge.hasShownClass&&"left-column-shown",Ge.hasOpenClass&&"left-column-open",Ve.current&&"left-column-animating",ze.hasShownClass&&"right-column-shown",ze.hasOpenClass&&"right-column-open",Xe.current&&"right-column-animating",Ye&&"narrow-message-list",P&&"history-animation-disabled",Ke&&"is-fullscreen"),et=(0,pt.Z)((()=>{ce({isBlurred:!0})})),tt=(0,pt.Z)((()=>{ce({isBlurred:!1}),document.title.includes(i.ouc)||Le(),B(!1)})),nt=(0,pt.Z)((()=>{be()})),at=(0,pt.Z)((()=>{Ze()}));return(0,It.Z)(et,tt),vt(et),function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];(0,o.d4)((()=>{if(s.$b){if(!e)return bt?.setAttribute("content",Zt),s.cj&&!s.fl&&document.addEventListener("gesturestart",yt),()=>{bt?.setAttribute("content","width=device-width, initial-scale=1, shrink-to-fit=no"),s.cj&&!s.fl&&document.removeEventListener("gesturestart",yt)};bt?.setAttribute("content",Pt)}}),[e])}(h),o.ZP.createElement("div",{ref:$e,id:"Main",className:Qe},o.ZP.createElement(Bn,{ref:qe}),o.ZP.createElement(Jr,{leftColumnRef:qe,isMobile:n}),o.ZP.createElement(Bc,{isMobile:n}),o.ZP.createElement(Lc,{isOpen:h}),o.ZP.createElement(Wc,{isOpen:g}),o.ZP.createElement(fd,{requestedDraft:H}),o.ZP.createElement(Gc,{isOpen:p}),o.ZP.createElement(Vc,{isOpen:f}),I&&o.ZP.createElement(Ma,{key:I.id,message:I,noUi:!0}),o.ZP.createElement(zc,{url:b}),o.ZP.createElement(dd,{urlAuth:W,currentUser:V}),o.ZP.createElement(Xc,{isOpen:Z}),o.ZP.createElement(Nt,{isOpen:Boolean(C),onClose:nt,stickerSetShortName:C}),o.ZP.createElement(pd,{customEmojiSetIds:S,onClose:at}),w&&o.ZP.createElement(Yc,{groupCallId:w}),o.ZP.createElement(Jc,{isActive:Boolean(w||x)}),o.ZP.createElement(td,{isOpen:Boolean(L||U),userId:L,isByPhoneNumber:U}),o.ZP.createElement(wd,{info:te}),o.ZP.createElement(Hc,{openedGame:j,gameTitle:O}),o.ZP.createElement(ad,{webApp:G}),o.ZP.createElement($c,null),o.ZP.createElement(cd,null),o.ZP.createElement(Kc,{isActive:x}),o.ZP.createElement(Ut,{isForAppBadge:!0}),o.ZP.createElement(nd,{isOpen:F}),o.ZP.createElement(sd,{bot:D,type:_?.type,shouldRequestWriteAccess:_?.shouldRequestWriteAccess}),o.ZP.createElement(id,{bot:$}),o.ZP.createElement(Id,{requestedAttachBotInChat:q}),o.ZP.createElement(ed,null),z&&o.ZP.createElement(ld,{isOpen:z}),o.ZP.createElement(hd,{limit:y}),o.ZP.createElement(ud,{isOpen:X,onClose:ke}),o.ZP.createElement(md,{isOpen:Y,onClose:Te}),o.ZP.createElement(gd,{folder:Q}),o.ZP.createElement(vd,{isOpen:J,shouldLoad:_e}))})));var Pd=n(57773),yd=n(21179),Cd=n(99364),Sd=n(8337);var Ed=n(2092);const Md=(0,o.X$)((0,a.c$)((e=>({passcodeSettings:e.passcode})))((e=>{let{isLocked:t,passcodeSettings:n}=e;const{unlockScreen:s,signOut:i,logInvalidUnlockAttempt:r,resetInvalidUnlockAttempts:c}=(0,a.Sv)(),{invalidAttemptsCount:d,timeoutUntil:l,isLoading:u}=n,m=(0,Dt.Z)(),[h,g]=(0,o.eJ)(""),[p,f]=(0,o.eJ)(!1),[I,v,w]=(0,Tt.Z)(!1),{shouldRender:b}=(0,St.Z)(t);(0,kt.Z)(c,l?l-Date.now():void 0);const Z=(0,o.I4)((()=>{g("")}),[]),P=(0,o.I4)((e=>{void 0===l?(g(""),(0,G.so)(e).then(s,(()=>{r(),g(m("lng_passcode_wrong"))}))):g(m("FloodWait"))}),[m,l]);(0,o.d4)((()=>{void 0!==l?g(m("FloodWait")):0===d&&g("")}),[l,m,d]);const y=(0,o.I4)((()=>{w(),i({forceInitApi:!0})}),[w,i]);if(b)return o.ZP.createElement("div",{className:"sY59IPNwkaRsrfYPhEJc"},o.ZP.createElement("div",{className:"DlErQEIDwmZ0duQgO_2b",dir:m.isRtl?"rtl":void 0},o.ZP.createElement(yd.Z,{tgsUrl:Pd.l.Lock,previewUrl:Ed,size:160,className:"ar9YdQbWJreREHmnZa9m"}),o.ZP.createElement(Cd.Z,{key:"password-form",shouldShowSubmit:!0,shouldDisablePasswordManager:!0,isLoading:u,error:h,placeholder:m("Passcode.EnterPasscodePlaceholder"),submitLabel:m("Next"),clearError:Z,isPasswordVisible:p,noRipple:!0,onChangePasswordVisibility:f,onSubmit:P}),o.ZP.createElement("div",{className:"uOmdTQr_cJEvuTkQipx7"},o.ZP.createElement("p",null,o.ZP.createElement(Sd.Z,{onClick:v},"Log out")," ","if you don't remember your passcode."),o.ZP.createElement("p",null,o.ZP.createElement(Jt.Z,{color:"translucent",size:"tiny",isText:!0,onClick:v},m("AccountSettings.Logout"))))),o.ZP.createElement(ta.Z,{isOpen:I,onClose:w,text:m("lng_sure_logout"),confirmLabel:m("AccountSettings.Logout"),confirmHandler:y,confirmIsDestructive:!0}))})));i.eMD&&console.log(">>> FINISH LOAD MAIN BUNDLE");const{passcode:{isScreenLocked:Rd},connectionState:kd}=(0,a.Rd)();kd||Rd||s.Eo||(0,a.Sv)().initApi()},68973:(e,t,n)=>{e.exports=n.p+"encoderWorker.min.8ea62f6317fbac7d4558.js"}}]);
|
||
//# sourceMappingURL=5769.bbe7b69ea485346b81ff.js.map
|