TelegramPWA/dist/71.4998fc48600439daeb4d.js
Alexander Zinchuk 6747f229fc [Build]
2022-04-01 21:03:25 +02:00

2 lines
279 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

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

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

(self.webpackChunktelegram_t=self.webpackChunktelegram_t||[]).push([[71],{9071:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Main:()=>ko});var a=n(3555),s=n(3716),i=n(4050),o=(n(9005),n(6137)),r=n(5406),c=n(1192),l=n(735),d=n(5806);function u(e){const{chatId:t,threadId:n}=(0,c.Bt)(e)||{};return t&&n?(e=(0,r.qr)(e,t,n,!1),e=(0,r.Pb)(e,t,n,void 0)):e}(0,a.iw)("openLocalTextSearch",(e=>{const{chatId:t,threadId:n}=(0,c.Bt)(e)||{};if(t&&n)return(0,r.qr)(e,t,n,!0)})),(0,a.iw)("closeLocalTextSearch",u),(0,a.iw)("setLocalTextSearchQuery",((e,t,n)=>{const{chatId:a,threadId:s}=(0,c.Bt)(e)||{};if(!a||!s)return;const{query:i}=n,o=(0,d.uw)(a,s),{query:u}=e.localTextSearch.byChatThreadKey[o]||{};return i!==u&&(e=(0,r.Pb)(e,a,s,l.D)),(0,r.qr)(e,a,s,!0,i)})),(0,a.iw)("setLocalMediaSearchType",((e,t,n)=>{const{chatId:a}=(0,c.Bt)(e)||{};if(!a)return;const{mediaType:s}=n;return(0,r.z5)(e,a,s)})),(0,a.iw)("openChat",((e,t,n)=>{const{id:s,threadId:i=o._f,type:l="thread",shouldReplaceHistory:d=!1}=n,m=(0,c.Bt)(e);return m&&m.chatId===s&&m.threadId===i&&m.type===l||(s&&(e=(0,r.pf)(e,s,i,"replyStack",[])),e=u(e=(0,r.i9)(e)),e={...e,isStatisticsShown:!1,messages:{...e.messages,contentToBeScheduled:void 0},...s!==e.forwardMessages.toChatId&&{forwardMessages:{}}},(0,a.R3)(e)),(0,r.Wy)(e,s,i,l,d)})),(0,a.iw)("openPreviousChat",(e=>(0,r.Wy)(e,void 0))),(0,a.iw)("openChatWithInfo",((e,t,n)=>{(0,a.R3)({...e,isChatInfoShown:!0}),t.openChat(n)})),(0,a.iw)("resetChatCreation",(e=>({...e,chatCreation:void 0}))),(0,a.iw)("setNewChatMembersDialogState",((e,t,n)=>({...e,newChatMembersProgress:n}))),(0,a.iw)("openNextChat",((e,t,n)=>{const{targetIndexDelta:a,orderedIds:s}=n,{chatId:i}=(0,c.Bt)(e)||{};if(!i)return void t.openChat({id:s[0]});const o=s.indexOf(i);if(-1===o)return;const r=s[o+a];t.openChat({id:r,shouldReplaceHistory:!0})}));var m=n(1713),h=n(7361),g=n(782),f=n(2267),p=n(257),v=n(3099),I=n(711),y=n(4319);const w=s.ck+s.fK;let Z;function P(e,t,n){const{threadId:a}=(0,c.Bt)(e)||{},s=I.i0,i=(0,c.Zw)(e,t);if(!i||!a)return;const o=n.map((e=>i[e])).filter((t=>(0,c._k)(e,t,a).canCopy)).sort(((e,t)=>e.id-t.id)).reduce(((t,n)=>{const a=(0,c.Ur)(e,n);return t.push(`> ${a?(0,d.OU)(s,a):""}:`),t.push(`${(0,d.MK)(s,n,!1,0,void 0,!0)}\n`),t}),[]);(0,y.TE)(o.join("\n"))}(0,a.iw)("setScrollOffset",((e,t,n)=>{const{chatId:a,threadId:s,scrollOffset:i}=n;return(0,r.pf)(e,a,s,"scrollOffset",i)})),(0,a.iw)("setReplyingToId",((e,t,n)=>{const{messageId:a}=n,s=(0,c.Bt)(e);if(!s)return;const{chatId:i,threadId:o}=s;return(0,r.pf)(e,i,o,"replyingToId",a)})),(0,a.iw)("setEditingId",((e,t,n)=>{const{messageId:a}=n,s=(0,c.Bt)(e);if(!s)return;const{chatId:i,threadId:o,type:l}=s,d="scheduled"===l?"editingScheduledId":"editingId";return(0,r.pf)(e,i,o,d,a)})),(0,a.iw)("setEditingDraft",((e,t,n)=>{const{text:a,chatId:s,threadId:i,type:o}=n,c="scheduled"===o?"editingScheduledDraft":"editingDraft";return(0,r.pf)(e,s,i,c,a)})),(0,a.iw)("editLastMessage",(e=>{const{chatId:t,threadId:n}=(0,c.Bt)(e)||{};if(!t||!n)return;const a=(0,c.Zw)(e,t),s=(0,c.Cb)(e,t,n);if(!a||!s)return;const i=(0,g.dF)(s,(t=>Boolean(a[t]&&(0,c._k)(e,a[t],n).canEdit)));return i?(0,r.pf)(e,t,n,"editingId",i):void 0})),(0,a.iw)("replyToNextMessage",((e,t,n)=>{const{targetIndexDelta:a}=n,{chatId:s,threadId:i}=(0,c.Bt)(e)||{};if(!s||!i)return;const r=(0,c.Zw)(e,s),l=(0,c.Cb)(e,s,i);if(!r||!l)return;const d=(0,c.Yy)(e,s,i);let u;if((0,c.b9)(e,s,i)&&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 if(i===o._f){var m;const t=(0,c.Z1)(e,s);u=null==t||null===(m=t.lastMessage)||void 0===m?void 0:m.id}else{const t=(0,c.tZ)(e,s,i);u=null==t?void 0:t.lastMessageId}t.setReplyingToId({messageId:u}),t.focusMessage({chatId:s,threadId:i,messageId:u})})),(0,a.iw)("openAudioPlayer",((e,t,n)=>{const{chatId:a,threadId:s,messageId:i,origin:o,volume:r,playbackRate:c,isMuted:l}=n;return{...e,audioPlayer:{chatId:a,threadId:s,messageId:i,origin:null!=o?o:e.audioPlayer.origin,volume:null!=r?r:e.audioPlayer.volume,playbackRate:c||e.audioPlayer.playbackRate,isMuted:l||e.audioPlayer.isMuted}}})),(0,a.iw)("setAudioPlayerVolume",((e,t,n)=>{const{volume:a}=n;return{...e,audioPlayer:{...e.audioPlayer,volume:a,isMuted:!1}}})),(0,a.iw)("setAudioPlayerPlaybackRate",((e,t,n)=>{const{playbackRate:a}=n;return{...e,audioPlayer:{...e.audioPlayer,playbackRate:a}}})),(0,a.iw)("setAudioPlayerMuted",((e,t,n)=>{const{isMuted:a}=n;return{...e,audioPlayer:{...e.audioPlayer,isMuted:a}}})),(0,a.iw)("setAudioPlayerOrigin",((e,t,n)=>{const{origin:a}=n;return{...e,audioPlayer:{...e.audioPlayer,origin:a}}})),(0,a.iw)("closeAudioPlayer",(e=>({...e,audioPlayer:{volume:e.audioPlayer.volume,playbackRate:e.audioPlayer.playbackRate,isMuted:e.audioPlayer.isMuted}}))),(0,a.iw)("openPollResults",((e,t,n)=>{const{chatId:s,messageId:i}=n;if((0,c.Jf)(e)){if(s!==e.pollResults.chatId||i!==e.pollResults.messageId)return{...e,pollResults:{chatId:s,messageId:i,voters:{}}}}else window.setTimeout((()=>{e=(0,a.Rd)(),(0,a.R3)({...e,pollResults:{chatId:s,messageId:i,voters:{}}})}),450)})),(0,a.iw)("closePollResults",(e=>({...e,pollResults:{}}))),(0,a.iw)("focusLastMessage",((e,t)=>{const n=(0,c.Bt)(e);if(!n)return;const{chatId:a,threadId:s}=n;let i;if(s===o._f){var r;const t=(0,c.Z1)(e,a);i=null==t||null===(r=t.lastMessage)||void 0===r?void 0:r.id}else{const t=(0,c.tZ)(e,a,s);i=null==t?void 0:t.lastMessageId}i&&t.focusMessage({chatId:a,threadId:s,messageId:i,noHighlight:!0})})),(0,a.iw)("focusNextReply",((e,t)=>{const n=(0,c.Bt)(e);if(!n)return;const{chatId:s,threadId:i}=n,o=(0,c.p9)(e,s,i);if(o&&0!==o.length){const n=o.pop();e=(0,r.pf)(e,s,i,"replyStack",[...o]),(0,a.R3)(e),t.focusMessage({chatId:s,threadId:i,messageId:n})}else t.focusLastMessage()})),(0,a.iw)("focusMessage",((e,t,n)=>{const{chatId:s,threadId:i=o._f,messageListType:l="thread",noHighlight:d,groupedId:u,groupedChatId:h,replyMessageId:g,isResizingContainer:f}=n;let{messageId:p}=n;if(void 0!==u){const t=(0,c.y8)(e,h,u);null!=t&&t.length&&([p]=t)}const v=(0,c.Bt)(e),I=!v||s!==v.chatId||i!==v.threadId||l!==v.type;if(Z&&(clearTimeout(Z),Z=void 0),Z=window.setTimeout((()=>{let e=(0,a.Rd)();e=(0,r.cq)(e),e=(0,r.wV)(e),(0,a.R3)(e)}),d?w:1500),e=(0,r.cq)(e,s,p,d,f),e=(0,r.wV)(e,void 0),g){const t=(0,c.p9)(e,s,i)||[];e=(0,r.pf)(e,s,i,"replyStack",[...t,g])}I&&(e=(0,r.wV)(e,m.fo.Static));const y=(0,c.Cb)(e,s,i);if(y&&y.includes(p))return(0,a.R3)(e),void t.openChat({id:s,threadId:i});if(I&&(e=(0,r.pf)(e,s,i,"viewportIds",void 0)),e=(0,r.pf)(e,s,i,"outlyingIds",void 0),y&&!I){const t=p>y[0]?m.fo.Down:m.fo.Up;e=(0,r.wV)(e,t)}(0,a.R3)(e),t.openChat({id:s,threadId:i}),t.loadViewportMessages()})),(0,a.iw)("openForwardMenu",((e,t,n)=>{const{fromChatId:a,messageIds:s,groupedId:i}=n;let o;return i&&(o=(0,c.xH)(e,a,i)),{...e,forwardMessages:{fromChatId:a,messageIds:o||s,isModalShown:!0}}})),(0,a.iw)("exitForwardMode",(e=>{(0,a.R3)({...e,forwardMessages:{}})})),(0,a.iw)("setForwardChatId",((e,t,n)=>{const{id:s}=n;(0,a.R3)({...e,forwardMessages:{...e.forwardMessages,toChatId:s,isModalShown:!1}}),t.openChat({id:s}),t.closeMediaViewer(),t.exitMessageSelectMode()})),(0,a.iw)("openForwardMenuForSelectedMessages",((e,t)=>{if(!e.selectedMessages)return;const{chatId:n,messageIds:a}=e.selectedMessages;t.openForwardMenu({fromChatId:n,messageIds:a})})),(0,a.iw)("cancelMessageMediaDownload",((e,t,n)=>{const{message:s}=n,i=e.activeDownloads.byChatId[s.chatId];i&&i.length&&(0,a.R3)({...e,activeDownloads:{byChatId:{...e.activeDownloads.byChatId,[s.chatId]:i.filter((e=>e!==s.id))}}})})),(0,a.iw)("cancelMessagesMediaDownload",((e,t,n)=>{const{messages:a}=n,s=e.activeDownloads.byChatId,i={};return Object.keys(s).forEach((e=>{i[e]=s[e].filter((e=>!a.find((t=>t.id===e))))})),{...e,activeDownloads:{byChatId:i}}})),(0,a.iw)("downloadMessageMedia",((e,t,n)=>{const{message:s}=n;(0,a.R3)({...e,activeDownloads:{byChatId:{...e.activeDownloads.byChatId,[s.chatId]:[...e.activeDownloads.byChatId[s.chatId]||[],s.id]}}})})),(0,a.iw)("downloadSelectedMessages",((e,t)=>{if(!e.selectedMessages)return;const{chatId:n,messageIds:a}=e.selectedMessages,{threadId:s}=(0,c.Bt)(e)||{},i=(0,c.Zw)(e,n);i&&s&&a.map((e=>i[e])).filter((t=>(0,c._k)(e,t,s).canDownload)).forEach((e=>t.downloadMessageMedia({message:e})))})),(0,a.iw)("enterMessageSelectMode",((e,t,n)=>{const{messageId:a}=n||{},s=(0,c.jr)(e);return s?(0,r.M6)(e,s.id,a):e})),(0,a.iw)("toggleMessageSelection",((e,t,n)=>{const{messageId:s,groupedId:i,childMessageIds:o,withShift:l}=n,d=(0,c.Bt)(e);if(!d)return;const{chatId:u,threadId:m,type:g}=d;e=(0,r.Ob)(e,u,m,g,s,i,o,l),(0,a.R3)(e),e.shouldShowContextMenuHint&&(t.disableContextMenuHint(),t.showNotification({message:`To **edit** or **reply**, close this menu. Then ${h.$b?"long tap":"right click"} on a message.`}))})),(0,a.iw)("disableContextMenuHint",(e=>{if(e.shouldShowContextMenuHint)return{...e,shouldShowContextMenuHint:!1}})),(0,a.iw)("exitMessageSelectMode",r.i9),(0,a.iw)("openPollModal",(e=>({...e,isPollModalOpen:!0}))),(0,a.iw)("closePollModal",(e=>({...e,isPollModalOpen:!1}))),(0,a.iw)("checkVersionNotification",((e,t)=>{const n=s.Ji.split(".").slice(0,2).join("."),{serviceNotifications:a}=e;if(a.find((e=>{let{version:t}=e;return t===n})))return;const i={chatId:s.aw,date:(0,f.b)(e.serverTimeOffset),content:{text:(0,v.Z)(p)},isOutgoing:!1};t.createServiceNotification({message:i,version:n})})),(0,a.iw)("createServiceNotification",((e,t,n)=>{var i;const{message:o,version:r}=n,{serviceNotifications:l}=e,d=(0,c.Z1)(e,s.aw),u=Math.max((null===(i=d.lastMessage)||void 0===i?void 0:i.id)||0,...l.map((e=>{let{id:t}=e;return t}))),m=(l.length+1)/1e3,h=Math.floor(u)+m;o.id=h;const g={id:h,message:o,version:r,isUnread:!0};(0,a.R3)({...e,serviceNotifications:[...l.slice(-1e3),g]}),t.apiUpdate({"@type":"newMessage",id:o.id,chatId:o.chatId,message:o})})),(0,a.iw)("openReactorListModal",((e,t,n)=>{const{chatId:a,messageId:s}=n;return{...e,reactorModal:{chatId:a,messageId:s}}})),(0,a.iw)("closeReactorListModal",(e=>({...e,reactorModal:void 0}))),(0,a.iw)("openSeenByModal",((e,t,n)=>{const{chatId:a,messageId:s}=n;return{...e,seenByModal:{chatId:a,messageId:s}}})),(0,a.iw)("closeSeenByModal",(e=>({...e,seenByModal:void 0}))),(0,a.iw)("copySelectedMessages",(e=>{if(!e.selectedMessages)return;const{chatId:t,messageIds:n}=e.selectedMessages;P(e,t,n)})),(0,a.iw)("copyMessagesByIds",((e,t,n)=>{const{messageIds:a}=n,s=(0,c.jr)(e);a&&0!==a.length&&s&&P(e,s.id,a)})),(0,a.iw)("setGlobalSearchQuery",((e,t,n)=>{const{query:a}=n,{chatId:s}=e.globalSearch;return(0,r.No)(e,{globalResults:{},localResults:{},resultsByType:void 0,...a?{fetchingStatus:{chats:!s,messages:!0}}:{fetchingStatus:void 0},query:a})})),(0,a.iw)("addRecentlyFoundChatId",((e,t,n)=>{const{id:a}=n,{recentlyFoundChatIds:s}=e.globalSearch;if(!s)return(0,r.No)(e,{recentlyFoundChatIds:[a]});const i=s.filter((e=>e!==a));return i.unshift(a),i.length>10&&i.pop(),(0,r.No)(e,{recentlyFoundChatIds:i})})),(0,a.iw)("clearRecentlyFoundChats",(e=>(0,r.No)(e,{recentlyFoundChatIds:void 0}))),(0,a.iw)("setGlobalSearchContent",((e,t,n)=>{const{content:a}=n;return(0,r.Og)(e,a)})),(0,a.iw)("setGlobalSearchChatId",((e,t,n)=>{const{id:a}=n;return(0,r.No)(e,{chatId:a,query:void 0,resultsByType:void 0})})),(0,a.iw)("setStickerSearchQuery",((e,t,n)=>{const{query:a}=n;return{...e,stickers:{...e.stickers,search:{query:a,resultIds:void 0}}}})),(0,a.iw)("setGifSearchQuery",((e,t,n)=>{const{query:a}=n;return{...e,gifs:{...e.gifs,search:{query:a,offsetId:void 0,results:void 0}}}})),(0,a.iw)("setUserSearchQuery",((e,t,n)=>{const{query:a}=n;return(0,r.Lm)(e,{globalUserIds:void 0,localUserIds:void 0,fetchingStatus:Boolean(a),query:a})})),(0,a.iw)("openAddContactDialog",((e,t,n)=>{const{userId:a}=n;return{...e,newContact:{userId:a}}})),(0,a.iw)("openNewContactDialog",(e=>({...e,newContact:{isByPhoneNumber:!0}}))),(0,a.iw)("closeNewContactDialog",(e=>(0,r.ft)(e))),n(3456);var C=n(1947),b=n(6926);(0,a.iw)("toggleChatInfo",((e,t,n)=>({...e,isChatInfoShown:void 0!==n?n:!e.isChatInfoShown}))),(0,a.iw)("setLeftColumnWidth",((e,t,n)=>({...e,leftColumnWidth:n}))),(0,a.iw)("resetLeftColumnWidth",(e=>({...e,leftColumnWidth:void 0}))),(0,a.iw)("toggleManagement",(e=>{const{chatId:t}=(0,c.Bt)(e)||{};if(t)return{...e,management:{byChatId:{...e.management.byChatId,[t]:{...e.management.byChatId[t],isActive:!(e.management.byChatId[t]||{}).isActive}}}}})),(0,a.iw)("requestNextManagementScreen",((e,t,n)=>{const{screen:a}=n||{},{chatId:s}=(0,c.Bt)(e)||{};if(s)return{...e,management:{byChatId:{...e.management.byChatId,[s]:{...e.management.byChatId[s],isActive:!0,nextScreen:a}}}}})),(0,a.iw)("closeManagement",(e=>{const{chatId:t}=(0,c.Bt)(e)||{};if(t)return{...e,management:{byChatId:{...e.management.byChatId,[t]:{...e.management.byChatId[t],isActive:!1}}}}})),(0,a.iw)("openChat",(e=>{if(h.wB||h.p7)return{...e,isLeftColumnShown:0===e.messages.messageLists.length}})),(0,a.iw)("toggleStatistics",(e=>({...e,isStatisticsShown:!e.isStatisticsShown}))),(0,a.iw)("toggleLeftColumn",(e=>({...e,isLeftColumnShown:!e.isLeftColumnShown}))),(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>18&&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)("showNotification",((e,t,n)=>{const a=n;a.localId=(0,b.Z)({});const s=[...e.notifications],i=s.findIndex((e=>e.message===a.message));return-1!==i&&s.splice(i,1),s.push(a),{...e,notifications:s}})),(0,a.iw)("dismissNotification",((e,t,n)=>{const a=e.notifications.filter((e=>{let{localId:t}=e;return t!==n.localId}));return{...e,notifications:a}})),(0,a.iw)("showDialog",((e,t,n)=>{const{data:a}=n;if("message"in a&&a.hasErrorKey&&!(0,C.ZP)(a))return e;const s=[...e.dialogs];if("message"in a){const e=s.findIndex((e=>e.message===a.message));-1!==e&&s.splice(e,1)}return s.push(a),{...e,dialogs:s}})),(0,a.iw)("dismissDialog",(e=>{const t=[...e.dialogs];return t.pop(),{...e,dialogs:t}})),(0,a.iw)("toggleSafeLinkModal",((e,t,n)=>{const{url:a}=n;return{...e,safeLinkModalUrl:a}})),(0,a.iw)("openHistoryCalendar",((e,t,n)=>{const{selectedAt:a}=n;return{...e,historyCalendarSelectedAt:a}})),(0,a.iw)("closeHistoryCalendar",(e=>({...e,historyCalendarSelectedAt:void 0}))),(0,a.iw)("openPaymentModal",((e,t,n)=>{const{chatId:a,messageId:s}=n;return{...e,payment:{...e.payment,chatId:a,messageId:s,isPaymentModalOpen:!0}}})),(0,a.iw)("closePaymentModal",(e=>(e=(0,r.bp)(e),(0,r.WY)(e)))),(0,a.iw)("addPaymentError",((e,t,n)=>{const{error:a}=n;return{...e,payment:{...e.payment,error:a}}})),n(8422),(0,a.iw)("openMediaViewer",((e,t,n)=>{const{chatId:a,threadId:s,messageId:i,avatarOwnerId:o,profilePhotoIndex:r,origin:c,volume:l,playbackRate:d,isMuted:u}=n;return{...e,mediaViewer:{...e.mediaViewer,chatId:a,threadId:s,messageId:i,avatarOwnerId:o,profilePhotoIndex:r,origin:c,volume:null!=l?l:e.mediaViewer.volume,playbackRate:d||e.mediaViewer.playbackRate,isMuted:u||e.mediaViewer.isMuted},forwardMessages:{}}})),(0,a.iw)("closeMediaViewer",(e=>{const{volume:t,isMuted:n,playbackRate:a}=e.mediaViewer;return{...e,mediaViewer:{volume:t,isMuted:n,playbackRate:a}}})),(0,a.iw)("setMediaViewerVolume",((e,t,n)=>{const{volume:a}=n;return{...e,mediaViewer:{...e.mediaViewer,volume:a,isMuted:!1}}})),(0,a.iw)("setMediaViewerPlaybackRate",((e,t,n)=>{const{playbackRate:a}=n;return{...e,mediaViewer:{...e.mediaViewer,playbackRate:a}}})),(0,a.iw)("setMediaViewerMuted",((e,t,n)=>{const{isMuted:a}=n;return{...e,mediaViewer:{...e.mediaViewer,isMuted:a}}})),n(5456),n(7225);var S=n(1226),E=n(9118);const M=new Map,R=(0,E.Ds)((e=>e()),500,!1);async function k(e,t,n,i){let o=arguments.length>4&&void 0!==arguments[4]&&arguments[4],l=arguments.length>5&&void 0!==arguments[5]&&arguments[5];const d=e.id;let u;switch(i){case m.Uq.Backwards:u=void 0;break;case m.Uq.Around:u=-(Math.round(s.hT/2)+1);break;case m.Uq.Forwards:u=-(s.hT+1)}const h=await(0,S.t9)("fetchMessages",{chat:(0,c.Cm)((0,a.Rd)(),d,t),offsetId:n,addOffset:u,limit:s.hT,threadId:t});if(!h)return;const{messages:f,users:p,chats:v,threadInfos:I}=h;let y=(0,a.Rd)();const w=d===s.aw?y.serviceNotifications.map((e=>{let{message:t}=e;return t})):[],Z=[].concat(f,w),P=(0,g.ee)(Z,"id"),C=Object.keys(P).map(Number);y=(0,r.c_)(y,d,P),y=o?(0,r.ff)(y,d,t,C):(0,r.xj)(y,d,t,C),y=(0,r.Sh)(y,(0,g.ee)(p,"id")),y=(0,r.fZ)(y,(0,g.ee)(v,"id")),y=(0,r.j6)(y,d,I);let b=(0,c.gb)(y,d,t);const E=(0,c.qC)(y,d,t);if(o&&b&&E&&(E.length&&!(0,g.YE)(b,E)||(y=(0,r.xj)(y,d,t,E),b=(0,c.gb)(y,d,t),y=(0,r.pf)(y,d,t,"outlyingIds",void 0),o=!1)),!l){const e=o?E:b,{newViewportIds:a}=N(e,n,i);y=(0,r.y9)(y,d,t,a)}(0,a.R3)(y)}function N(e,t,n){const{length:a}=e,i=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===m.Uq.Backwards?i:i+1||a,r=o-s.hT,c=o+s.hT-1,l=e.slice(Math.max(0,r),c+1);let d,u;switch(n){case m.Uq.Backwards:d=o>0,u=r>=0;break;case m.Uq.Forwards:d=o<a,u=c<=a-1;break;case m.Uq.Around:default:d=l.length>0,u=l.length===s.hT}return{newViewportIds:l,areSomeLocal:d,areAllLocal:u}}async function T(e){let t;const n=e.attachment?(e,s)=>{M.has(s)||(t=s,M.set(s,n));const i=(0,a.Rd)();(0,a.R3)({...i,fileUploads:{byMessageLocalId:{...i.fileUploads.byMessageLocalId,[s]:{progress:e}}}})}:void 0;(e.replyingTo||h.cj)&&await(0,E.Pn)();const s=(0,a.Rd)();e.serverTimeOffset=s.serverTimeOffset;const i=(0,c.Bt)(s);if(!i)return;const{threadId:r}=i;e.replyingTo||r===o._f||(e.replyingTo=(0,c.qS)(s,e.chat.id,r)),await(0,S.t9)("sendMessage",e,n),n&&t&&M.delete(t)}(0,a.iw)("loadViewportMessages",((e,t,n)=>{const{direction:a=m.Uq.Around,isBudgetPreload:i=!1}=n||{};let{chatId:o,threadId:l}=n||{};if(!o){const t=(0,c.Bt)(e);if(!t)return;o=t.chatId,l=t.threadId}const d=(0,c.Z1)(e,o);if(!d||d.isRestricted)return;const u=(0,c.Cb)(e,o,l),h=(0,c.gb)(e,o,l),g=(0,c.qC)(e,o,l);if(u&&u.length&&a!==m.Uq.Around){const n=a===m.Uq.Backwards?u[0]:u[u.length-1],s=Boolean(g),c=s?g:h,{newViewportIds:f,areSomeLocal:p,areAllLocal:v}=N(c,n,a);if(p&&(e=(0,r.y9)(e,o,l,f)),async function(e,t,n,a,s,i,o,r){t||await k(s,i,r,o,n,a),a||(await Promise.resolve(),e.loadViewportMessages({chatId:s.id,threadId:i,direction:o,isBudgetPreload:!0}))}(t,v,s,i,d,l,a,n),i)return}else{const t=(0,c.G$)(e,o)||(0,c.rd)(e,o,l),n=Boolean(t&&h&&!h.includes(t)),a=(n?g:h)||[],{newViewportIds:u,areSomeLocal:f,areAllLocal:p}=N(a,t,m.Uq.Around);f&&u.length>=s.hT&&(e=(0,r.y9)(e,o,l,u)),p||k(d,l,t,m.Uq.Around,n,i)}return e})),(0,a.iw)("loadMessage",(async(e,t,n)=>{const{chatId:s,messageId:i,replyOriginForId:l,threadUpdate:d}=n,u=(0,c.Z1)(e,s);if(!u)return;const m=await async function(e,t,n){const s=await(0,S.t9)("fetchMessage",{chat:e,messageId:t});if(!s)return;if(s===o._Q){if(n){let t=(0,a.Rd)();const s=(0,c.hj)(t,e.id,n);t=(0,r.cY)(t,e.id,n,{...s,replyToMessageId:void 0}),(0,a.R3)(t)}return}let i=(0,a.Rd)();return i=(0,r.cY)(i,e.id,t,s.message),i=(0,r.Sh)(i,(0,g.ee)(s.users,"id")),(0,a.R3)(i),s.message}(u,i,l);if(m&&d){const{lastMessageId:e,isDeleting:t}=d;return(0,r.lG)((0,a.Rd)(),m,s,e,t)}})),(0,a.iw)("sendMessage",((e,t,n)=>{const a=(0,c.Bt)(e);if(!a)return;const{chatId:i,threadId:o,type:r}=a;if("scheduled"===r&&!n.scheduledAt)return{...e,messages:{...e.messages,contentToBeScheduled:n}};const l=(0,c.Z1)(e,i),d={...n,chat:l,replyingTo:(0,c.Yy)(e,i,o),noWebPage:(0,c.tV)(e,i,o),sendAs:(0,c._5)(e,i)};t.setReplyingToId({messageId:void 0}),t.clearWebPagePreview({chatId:i,threadId:o,value:!1});const u=!n.attachments||n.attachments.length<=1,m=!u&&n.attachments&&n.attachments.length>1;if(u){const{attachments:e,...t}=d;T({...t,attachment:e?e[0]:void 0})}else if(m){const{text:e,entities:t,attachments:n,...a}=d,i=(0,g.Vl)(n,s.DU);for(let n=0;n<i.length;n++){const[s,...o]=i[n],r=`${Date.now()}${n}`;T({...a,text:0===n?e:void 0,entities:0===n?t:void 0,attachment:s,groupedId:o.length>0?r:void 0}),o.forEach((e=>{T({...a,attachment:e,groupedId:r})}))}}else{const{text:e,entities:t,attachments:n,replyingTo:a,...s}=d;e&&T({...s,text:e,entities:t,replyingTo:a}),n.forEach((e=>{T({...s,attachment:e})}))}})),(0,a.iw)("editMessage",((e,t,n)=>{const{serverTimeOffset:a}=e,{text:s,entities:i}=n,o=(0,c.Bt)(e);if(!o)return;const{chatId:r,threadId:l,type:d}=o,u=(0,c.Z1)(e,r),m=(0,c.kK)(e,r,l,d);u&&m&&((0,S.t9)("editMessage",{chat:u,message:m,text:s,entities:i,noWebPage:(0,c.tV)(e,r,l),serverTimeOffset:a}),t.setEditingId({messageId:void 0}))})),(0,a.iw)("cancelSendingMessage",((e,t,n)=>{const{chatId:a,messageId:s}=n,i=(0,c.hj)(e,a,s),o=i&&M.get(i.previousLocalId||i.id);o&&(0,S.u3)(o),t.apiUpdate({"@type":"deleteMessages",ids:[s],chatId:a})})),(0,a.iw)("saveDraft",((e,t,n)=>{const{chatId:a,threadId:s,draft:i}=n;if(!i)return;const{text:l,entities:d}=i,u=(0,c.Z1)(e,a);return s===o._f&&(0,S.t9)("saveDraft",{chat:u,text:l,entities:d,replyToMsgId:(0,c.Yy)(e,a,s)}),e=(0,r.pf)(e,a,s,"draft",i),(0,r.a4)(e,a,{draftDate:Math.round(Date.now()/1e3)})})),(0,a.iw)("clearDraft",((e,t,n)=>{const{chatId:a,threadId:s,localOnly:i}=n;if(!(0,c.Ms)(e,a,s))return;const l=(0,c.Z1)(e,a);return i||s!==o._f||(0,S.t9)("clearDraft",l),e=(0,r.pf)(e,a,s,"draft",void 0),(0,r.a4)(e,a,{draftDate:void 0})})),(0,a.iw)("toggleMessageWebPage",((e,t,n)=>{const{chatId:a,threadId:s,noWebPage:i}=n;return(0,r.pf)(e,a,s,"noWebPage",i)})),(0,a.iw)("pinMessage",((e,t,n)=>{const a=(0,c.jr)(e);if(!a)return;const{messageId:s,isUnpin:i,isOneSide:o,isSilent:r}=n;(0,S.t9)("pinMessage",{chat:a,messageId:s,isUnpin:i,isOneSide:o,isSilent:r})})),(0,a.iw)("unpinAllMessages",((e,t,n)=>{const s=(0,c.Z1)(e,n.chatId);s&&async function(e){await(0,S.t9)("unpinAllMessages",{chat:e});let t=(0,a.Rd)();t=(0,r.pf)(t,e.id,o._f,"pinnedIds",[]),(0,a.R3)(t)}(s)})),(0,a.iw)("deleteMessages",((e,t,n)=>{const{messageIds:a,shouldDeleteForAll:s}=n,i=(0,c.Bt)(e);if(!i)return;const{chatId:o,threadId:r}=i,l=(0,c.Z1)(e,o);(0,S.t9)("deleteMessages",{chat:l,messageIds:a,shouldDeleteForAll:s});const d=(0,c._$)(e,o,r);a.includes(d)&&t.setEditingId({messageId:void 0})})),(0,a.iw)("deleteScheduledMessages",((e,t,n)=>{const{messageIds:a}=n,s=(0,c.Bt)(e);if(!s)return;const{chatId:i}=s,o=(0,c.Z1)(e,i);(0,S.t9)("deleteScheduledMessages",{chat:o,messageIds:a});const r=(0,c.wU)(e,i);a.includes(r)&&t.setEditingId({messageId:void 0})})),(0,a.iw)("deleteHistory",(async(e,t,n)=>{var a;const{chatId:s,shouldDeleteForAll:i}=n,o=(0,c.Z1)(e,s);if(!o)return;const r=null===(a=o.lastMessage)||void 0===a?void 0:a.id;await(0,S.t9)("deleteHistory",{chat:o,shouldDeleteForAll:i,maxId:r});const l=(0,c.Bt)(e);l&&l.chatId===s&&t.openChat({id:void 0})})),(0,a.iw)("reportMessages",(async(e,t,n)=>{const{messageIds:a,reason:s,description:i}=n,o=(0,c.Bt)(e);if(!o)return;const{chatId:r}=o,l=(0,c.Z1)(e,r),d=await(0,S.t9)("reportMessages",{peer:l,messageIds:a,reason:s,description:i});t.showNotification({message:d?"Thank you! Your report will be reviewed by our team.":"Error occured while submiting report. Please, try again later."})})),(0,a.iw)("sendMessageAction",(async(e,t,n)=>{const{action:a,chatId:s,threadId:i}=n;if(s===e.currentUserId)return;const o=(0,c.Z1)(e,s);o&&await(0,S.t9)("sendMessageAction",{peer:o,threadId:i,action:a})})),(0,a.iw)("markMessageListRead",((e,t,n)=>{const{serverTimeOffset:a}=e,i=(0,c.Bt)(e);if(!i)return;const{chatId:l,threadId:d}=i,u=(0,c.Cm)(e,l,d);if(!u)return;const{maxId:m}=n;if(R((()=>{(0,S.t9)("markMessageListRead",{serverTimeOffset:a,chat:u,threadId:d,maxId:m})})),d!==o._f)return;l===s.aw&&(e={...e,serviceNotifications:e.serviceNotifications.map((e=>e.isUnread&&e.id<=m?{...e,isUnread:!1}:e))});const h=(0,c.Cb)(e,l,d),g=(0,c.It)(e,l,d);if(!h||!g||!u.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,m);return f?(0,r.a4)(e,l,{lastReadInboxMessageId:m,unreadCount:Math.max(0,u.unreadCount-f)}):e})),(0,a.iw)("markMessagesRead",((e,t,n)=>{const a=(0,c.jr)(e);if(!a)return;const{messageIds:s}=n;(0,S.t9)("markMessagesRead",{chat:a,messageIds:s})})),(0,a.iw)("loadWebPagePreview",((e,t,n)=>{const{text:s}=n;!async function(e){const t=await(0,S.t9)("fetchWebPagePreview",{message:e});(0,a.R3)({...(0,a.Rd)(),webPagePreview:t})}(s)})),(0,a.iw)("clearWebPagePreview",(e=>{if(e.webPagePreview)return{...e,webPagePreview:void 0}})),(0,a.iw)("sendPollVote",((e,t,n)=>{const{chatId:a,messageId:s,options:i}=n,o=(0,c.Z1)(e,a);o&&(0,S.t9)("sendPollVote",{chat:o,messageId:s,options:i})})),(0,a.iw)("loadPollOptionResults",((e,t,n)=>{const{chat:s,messageId:i,option:o,offset:c,limit:l,shouldResetVoters:d}=n;!async function(e,t,n,s,i,o){const c=await(0,S.t9)("loadPollOptionResults",{chat:e,messageId:t,option:n,offset:s,limit:i});if(!c)return;let l=(0,a.Rd)();l=(0,r.Sh)(l,(0,g.ee)(c.users,"id"));const{voters:d}=l.pollResults;(0,a.R3)({...l,pollResults:{...l.pollResults,voters:{...d,[n]:(0,g.Tw)([...!o&&d&&d[n]?d[n]:[],...c&&c.users.map((e=>e.id))])},offsets:{...l.pollResults.offsets?l.pollResults.offsets:{},[n]:c.nextOffset||""}}})}(s,i,o,c,l,d)})),(0,a.iw)("forwardMessages",((e,t,n)=>{const{fromChatId:s,messageIds:i,toChatId:o}=e.forwardMessages,r=s?(0,c.Z1)(e,s):void 0,l=o?(0,c.Z1)(e,o):void 0,u=s&&i?i.sort(((e,t)=>e-t)).map((t=>(0,c.hj)(e,s,t))).filter(Boolean):void 0;if(!r||!l||!u)return;const{isSilent:m,scheduledAt:h}=n,g=(0,c._5)(e,o),f=u.filter((e=>!(0,d.jM)(e)));f.length&&(0,S.t9)("forwardMessages",{fromChat:r,toChat:l,messages:f,serverTimeOffset:(0,a.Rd)().serverTimeOffset,isSilent:m,scheduledAt:h,sendAs:g}),u.filter((e=>(0,d.jM)(e))).forEach((e=>{const{text:t,entities:n}=e.content.text||{},{sticker:a,poll:s}=e.content;T({chat:l,text:t,entities:n,sticker:a,poll:s,isSilent:m,scheduledAt:h,sendAs:g})})),(0,a.R3)({...(0,a.Rd)(),forwardMessages:{}})})),(0,a.iw)("loadScheduledHistory",((e,t,n)=>{const{chatId:s}=n,i=(0,c.Z1)(e,s);i&&async function(e){const t=await(0,S.t9)("fetchScheduledHistory",{chat:e});if(!t)return;const{messages:n}=t,s=(0,g.ee)(n,"id"),i=Object.keys(s).map(Number).sort(((e,t)=>t-e));let c=(0,a.Rd)();c=(0,r.w3)(c,e.id,s),c=(0,r.pf)(c,e.id,o._f,"scheduledIds",i),(0,a.R3)(c)}(i)})),(0,a.iw)("sendScheduledMessages",((e,t,n)=>{const{chatId:a,id:s}=n,i=(0,c.Z1)(e,a);i&&(0,S.t9)("sendScheduledMessages",{chat:i,ids:[s]})})),(0,a.iw)("rescheduleMessage",((e,t,n)=>{const{chatId:a,messageId:s,scheduledAt:i}=n,o=(0,c.Z1)(e,a),r=o&&(0,c.Tm)(e,o.id,s);o&&r&&(0,S.t9)("rescheduleMessage",{chat:o,message:r,scheduledAt:i})})),(0,a.iw)("requestThreadInfoUpdate",((e,t,n)=>{const{chatId:a,threadId:s}=n,i=(0,c.Cm)(e,a,s);i&&(0,S.t9)("requestThreadInfoUpdate",{chat:i,threadId:s})})),(0,a.iw)("loadPinnedMessages",((e,t,n)=>{const{chatId:s}=n,i=(0,c.Z1)(e,s);i&&async function(e){const t=await(0,S.t9)("fetchPinnedMessages",{chat:e});if(!t)return;const{messages:n,chats:s,users:i}=t,c=(0,g.ee)(n,"id"),l=Object.keys(c).map(Number).sort(((e,t)=>t-e));let d=(0,a.Rd)();d=(0,r.c_)(d,e.id,c),d=(0,r.pf)(d,e.id,o._f,"pinnedIds",l),d=(0,r.Sh)(d,(0,g.ee)(i,"id")),d=(0,r.fZ)(d,(0,g.ee)(s,"id")),(0,a.R3)(d)}(i)})),(0,a.iw)("loadSeenBy",(async(e,t,n)=>{const{chatId:s,messageId:i}=n,o=(0,c.Z1)(e,s);if(!o)return;const l=await(0,S.t9)("fetchSeenBy",{chat:o,messageId:i});return l?(0,r.cY)((0,a.Rd)(),s,i,{seenByUserIds:l}):void 0})),(0,a.iw)("saveDefaultSendAs",((e,t,n)=>{const{chatId:a,sendAsId:s}=n,i=(0,c.Z1)(e,a),o=(0,c.Z1)(e,s)||(0,c.dy)(e,s);if(i&&o)return(0,S.t9)("saveDefaultSendAs",{sendAs:o,chat:i}),(0,r.a4)(e,a,{fullInfo:{...i.fullInfo,sendAsId:s}})})),(0,a.iw)("loadSendAs",(async(e,t,n)=>{const{chatId:s}=n,i=(0,c.Z1)(e,s);if(!i)return;const o=await(0,S.t9)("fetchSendAs",{chat:i});return o?(e=(0,a.Rd)(),e=(0,r.Sh)(e,(0,g.ee)(o.users,"id")),e=(0,r.fZ)(e,(0,g.ee)(o.chats,"id")),e=(0,r.a4)(e,s,{sendAsIds:o.ids})):(0,r.a4)((0,a.Rd)(),s,{sendAsIds:[]})})),(0,a.iw)("loadSponsoredMessages",(async(e,t,n)=>{const{chatId:s}=n,i=(0,c.Z1)(e,s);if(!i)return;const o=await(0,S.t9)("fetchSponsoredMessages",{chat:i});return o?(e=(0,a.Rd)(),e=(0,r.Fn)(e,s,o.messages[0]),e=(0,r.Sh)(e,(0,g.ee)(o.users,"id")),e=(0,r.fZ)(e,(0,g.ee)(o.chats,"id"))):void 0})),(0,a.iw)("viewSponsoredMessage",((e,t,n)=>{const{chatId:a}=n,s=(0,c.Z1)(e,a),i=(0,c.fS)(e,a);s&&i&&(0,S.t9)("viewSponsoredMessage",{chat:s,random:i.randomId})}));var A=n(5765);const B=(0,E.P2)((e=>e()),500,!1);async function x(e,t){const n=await(0,S.t9)("searchGifs",{query:e,offset:t});n&&(0,a.R3)((0,r.rq)((0,a.Rd)(),!t,n.gifs,n.nextOffset))}(0,a.iw)("loadStickerSets",(e=>{const{hash:t}=e.stickers.added||{};!async function(e){const t=await(0,S.t9)("fetchStickerSets",{hash:e});t&&(0,a.R3)((0,r.z3)((0,a.Rd)(),"added",t.hash,t.sets))}(t)})),(0,a.iw)("loadAddedStickers",(async(e,t)=>{const{setIds:n}=e.stickers.added,a=e.stickers.setsById;if(n&&n.length)for(let e=0;e<n.length;e++){const s=n[e];a[s].stickers||(t.loadStickers({stickerSetId:s}),e%10==0&&e>0&&await(0,E.wO)(200))}})),(0,a.iw)("loadRecentStickers",(e=>{const{hash:t}=e.stickers.recent||{};!async function(e){const t=await(0,S.t9)("fetchRecentStickers",{hash:e});if(!t)return;const n=(0,a.Rd)();(0,a.R3)({...n,stickers:{...n.stickers,recent:t}})}(t)})),(0,a.iw)("loadFavoriteStickers",(e=>{const{hash:t}=e.stickers.favorite||{};!async function(e){const t=await(0,S.t9)("fetchFavoriteStickers",{hash:e});if(!t)return;const n=(0,a.Rd)();(0,a.R3)({...n,stickers:{...n.stickers,favorite:t}})}(t)})),(0,a.iw)("loadGreetingStickers",(async e=>{const{hash:t}=e.stickers.greeting||{},n=await(0,S.t9)("fetchStickersForEmoji",{emoji:"👋⭐️",hash:t});if(n)return e=(0,a.Rd)(),{...e,stickers:{...e.stickers,greeting:{hash:n.hash,stickers:n.stickers.filter((e=>"👋"===e.emoji))}}}})),(0,a.iw)("loadFeaturedStickers",(e=>{const{hash:t}=e.stickers.featured||{};!async function(e){const t=await(0,S.t9)("fetchFeaturedStickers",{hash:e});t&&(0,a.R3)((0,r.z3)((0,a.Rd)(),"featured",t.hash,t.sets))}(t)})),(0,a.iw)("loadStickers",((e,t,n)=>{const{stickerSetId:s,stickerSetShortName:i}=n;let{stickerSetAccessHash:o}=n;if(!o&&!i){const t=(0,c.Ny)(e,s);if(!t)return;o=t.accessHash}!async function(e,t,n){const s=await(0,S.t9)("fetchStickers",{stickerSetShortName:n,stickerSetId:e,accessHash:t});if(!s)return;const{set:i,stickers:o,packs:c}=s;let l=(0,a.Rd)();l=(0,r.Rg)(l,i.id,{...i,stickers:o,packs:c});const d=l.stickers.forEmoji.emoji;d&&c[d]&&(l=(0,r.vy)(l)),(0,a.R3)(l)}(s,o,i)})),(0,a.iw)("loadAnimatedEmojis",(()=>{!async function(){const e=await(0,S.t9)("fetchAnimatedEmojis");if(!e)return;const{set:t,stickers:n}=e;(0,a.R3)((0,r.g_)((0,a.Rd)(),{...t,stickers:n}))}(),async function(){const e=await(0,S.t9)("fetchAnimatedEmojiEffects");if(!e)return;const{set:t,stickers:n}=e;(0,a.R3)({...(0,a.Rd)(),animatedEmojiEffects:{...t,stickers:n}})}()})),(0,a.iw)("loadSavedGifs",(e=>{const{hash:t}=e.gifs.saved;!async function(e){const t=await(0,S.t9)("fetchSavedGifs",{hash:e});if(!t)return;const n=(0,a.Rd)();(0,a.R3)({...n,gifs:{...n.gifs,saved:t}})}(t)})),(0,a.iw)("saveGif",(async(e,t,n)=>{var s;const{gif:i,shouldUnsave:o}=n;if(!await(0,S.t9)("saveGif",{gif:i,shouldUnsave:o}))return;const r=(null===(s=(e=(0,a.Rd)()).gifs.saved.gifs)||void 0===s?void 0:s.filter((e=>{let{id:t}=e;return t!==i.id})))||[],c=o?r:[i,...r];return{...e,gifs:{...e.gifs,saved:{...e.gifs.saved,gifs:c}}}})),(0,a.iw)("faveSticker",((e,t,n)=>{const{sticker:a}=n;a&&(0,S.t9)("faveSticker",{sticker:a})})),(0,a.iw)("unfaveSticker",((e,t,n)=>{const{sticker:s}=n;s&&function(e){const t=(0,a.Rd)();(0,a.R3)({...t,stickers:{...t.stickers,favorite:{...t.stickers.favorite,stickers:t.stickers.favorite.stickers.filter((t=>{let{id:n}=t;return n!==e.id}))}}}),(0,S.t9)("faveSticker",{sticker:e,unfave:!0})}(s)})),(0,a.iw)("toggleStickerSet",((e,t,n)=>{const{stickerSetId:a}=n,s=(0,c.Ny)(e,a);if(!s)return;const{accessHash:i,installedDate:o}=s;(0,S.t9)(o?"uninstallStickerSet":"installStickerSet",{stickerSetId:a,accessHash:i})})),(0,a.iw)("loadEmojiKeywords",(async(e,t,n)=>{var s,i;const{language:o}=n;let r=e.emojiKeywords[o];if(null!==(s=r)&&void 0!==s&&s.isLoading)return;(0,a.R3)({...e,emojiKeywords:{...e.emojiKeywords,[o]:{...r,isLoading:!0}}});const c=await(0,S.t9)("fetchEmojiKeywords",{language:o,fromVersion:r?r.version:0});return r=(e=(0,a.Rd)()).emojiKeywords[o],c?{...e,emojiKeywords:{...e.emojiKeywords,[o]:{isLoading:!1,version:c.version,keywords:{...null===(i=r)||void 0===i?void 0:i.keywords,...c.keywords}}}}:{...e,emojiKeywords:{...e.emojiKeywords,[o]:{...r,isLoading:!1}}}})),(0,a.iw)("setStickerSearchQuery",((e,t,n)=>{const{query:s}=n;s&&B((()=>{!async function(e,t){const n=await(0,S.t9)("searchStickers",{query:e,hash:void 0});if(!n)return;const s=(0,a.Rd)(),{setsById:i,added:o}=s.stickers,c=n.sets.map((e=>{let{id:t}=e;return t}));o.setIds&&o.setIds.forEach((t=>{if(!c.includes(t)){const{title:n}=i[t]||{};n&&(0,A.Z)(n,e)&&c.unshift(t)}})),(0,a.R3)((0,r.z3)(s,"search",n.hash,n.sets,c))}(s)}))})),(0,a.iw)("setGifSearchQuery",((e,t,n)=>{const{query:a}=n;"string"==typeof a&&B((()=>{x(a)}))})),(0,a.iw)("searchMoreGifs",(e=>{const{query:t,offset:n}=e.gifs.search;"string"==typeof t&&B((()=>{x(t,n)}))})),(0,a.iw)("loadStickersForEmoji",((e,t,n)=>{const{emoji:s}=n,{hash:i}=e.stickers.forEmoji;B((()=>{!async function(e,t){let n=(0,a.Rd)();(0,a.R3)({...n,stickers:{...n.stickers,forEmoji:{...n.stickers.forEmoji,emoji:e}}});const s=await(0,S.t9)("fetchStickersForEmoji",{emoji:e,hash:t});n=(0,a.Rd)(),s&&n.stickers.forEmoji.emoji===e&&(n=(0,r.IM)(n,e,s.stickers,s.hash),(0,a.R3)(n))}(s,i)}))})),(0,a.iw)("clearStickersForEmoji",(e=>({...e,stickers:{...e.stickers,forEmoji:{}}}))),(0,a.iw)("openStickerSetShortName",((e,t,n)=>{const{stickerSetShortName:a}=n;return{...e,openedStickerSetShortName:a}}));var L=n(790);const O=(0,E.P2)((e=>e()),500,!1);async function U(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1?arguments[1]:void 0,i=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0,l=arguments.length>4?arguments[4]:void 0,d=arguments.length>5?arguments[5]:void 0;if(o){const a=await(0,S.t9)("searchMessagesLocal",{chat:o,query:t,type:n,limit:s.Hk,offsetId:i,minDate:d,maxDate:l});if(a){const{messages:t,users:n,totalCount:s,nextOffsetId:i}=a;e={messages:t,users:n,chats:[],totalCount:s,nextRate:i}}}else e=await(0,S.t9)("searchMessagesGlobal",{query:t,offsetRate:i,limit:s.Hk,type:n,maxDate:l,minDate:d});let u=(0,a.Rd)();const m=(0,c.JX)(u);if(!e||""!==t&&t!==m)return void(0,a.R3)((0,r.xv)(u,{messages:!1}));const{messages:h,users:f,chats:p,totalCount:v,nextRate:I}=e;p.length&&(u=(0,r.fZ)(u,(0,g.ee)(p,"id"))),f.length&&(u=(0,r.Sh)(u,(0,g.ee)(f,"id"))),h.length&&(u=(0,r.m6)(u,h)),u=(0,r.px)(u,h,v,n,I),(0,a.R3)(u)}async function F(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const o=await(0,S.t9)("searchMessagesLocal",{chat:e,type:t,limit:2*s.EN,offsetId:n});if(!o)return;const{chats:l,users:d,messages:u,totalCount:m,nextOffsetId:h}=o,f=(0,g.ee)(u,"id"),p=Object.keys(f).map(Number);let v=(0,a.Rd)();const I=(0,c.we)(v);I&&(v=(0,r.fZ)(v,(0,g.ee)(l,"id")),v=(0,r.Sh)(v,(0,g.ee)(d,"id")),v=(0,r.c_)(v,e.id,f),v=(0,r.c1)(v,e.id,t,p,m,h),(0,a.R3)(v),i||F(e,t,h,!0))}(0,a.iw)("setGlobalSearchQuery",((e,t,n)=>{const{chatId:s}=e.globalSearch,{query:i}=n;i&&!s&&O((()=>{!async function(e){const t=await(0,S.t9)("searchChats",{query:e});let n=(0,a.Rd)();const s=(0,c.JX)(n);if(!t||!s||e!==s)return void(0,a.R3)((0,r.xv)(n,{chats:!1}));const{localChats:i,localUsers:o,globalChats:l,globalUsers:d}=t;(i.length||l.length)&&(n=(0,r.fZ)(n,(0,g.ee)([...i,...l],"id"))),(o.length||d.length)&&(n=(0,r.Sh)(n,(0,g.ee)([...o,...d],"id"))),n=(0,r.xv)(n,{chats:!1}),n=(0,r.No)(n,{localResults:{chatIds:i.map((e=>{let{id:t}=e;return t})),userIds:o.map((e=>{let{id:t}=e;return t}))},globalResults:{...n.globalSearch.globalResults,chatIds:l.map((e=>{let{id:t}=e;return t})),userIds:d.map((e=>{let{id:t}=e;return t}))}}),(0,a.R3)(n)}(i)}))})),(0,a.iw)("setGlobalSearchDate",((e,t,n)=>{const{date:s}=n,i=s?(0,L.IS)(s):s;e=(0,r.No)(e,{date:s,query:"",resultsByType:{...e.globalSearch.resultsByType,text:{totalCount:void 0,foundIds:[],nextOffsetId:0}}}),(0,a.R3)(e);const{chatId:o}=e.globalSearch;U("","text",void 0,o?(0,c.Z1)(e,o):void 0,i,s)})),(0,a.iw)("searchMessagesGlobal",((e,t,n)=>{var a;const{query:s,resultsByType:i,chatId:o,date:r}=e.globalSearch,l=r?(0,L.IS)(r):r,{type:d}=n;U(s,d,null==i||null===(a=i[d])||void 0===a?void 0:a.nextOffsetId,o?(0,c.Z1)(e,o):void 0,l,r)})),(0,a.iw)("searchTextMessagesLocal",(e=>{const{chatId:t,threadId:n}=(0,c.Bt)(e)||{},i=t?(0,c.Z1)(e,t):void 0,l=(0,c.n5)(e);if(!i||!l||!n)return;const{query:d,results:u}=l,m=null==u?void 0:u.nextOffsetId;let h;if(n!==o._f){const a=(0,c.tZ)(e,t,n);h=null==a?void 0:a.topMessageId}!async function(e,t,n,i,o){if(!i)return;const l=await(0,S.t9)("searchMessagesLocal",{chat:e,type:"text",query:i,topMessageId:n,limit:s.pn,offsetId:o});if(!l)return;const{chats:d,users:u,messages:m,totalCount:h,nextOffsetId:f}=l,p=(0,g.ee)(m,"id"),v=Object.keys(p).map(Number);let I=(0,a.Rd)();const y=(0,c.n5)(I);y&&i===y.query&&(I=(0,r.fZ)(I,(0,g.ee)(d,"id")),I=(0,r.Sh)(I,(0,g.ee)(u,"id")),I=(0,r.c_)(I,e.id,p),I=(0,r.dx)(I,e.id,t,v,h,f),(0,a.R3)(I))}(i,n,h,d,m)})),(0,a.iw)("searchMediaMessagesLocal",(e=>{const{chatId:t}=(0,c.Bt)(e)||{};if(!t)return;const n=(0,c.Z1)(e,t),a=(0,c.we)(e);if(!n||!a)return;const{currentType:s,resultsByType:i}=a,o=s&&i&&i[s],r=null==o?void 0:o.nextOffsetId;s&&F(n,s,r)})),(0,a.iw)("searchMessagesByDate",((e,t,n)=>{const{timestamp:s}=n,{chatId:i}=(0,c.Bt)(e)||{};if(!i)return;const o=(0,c.Z1)(e,i);o&&async function(e,t){const n=await(0,S.t9)("findFirstMessageIdAfterDate",{chat:e,timestamp:t});n&&(0,a.Sv)().focusMessage({chatId:e.id,messageId:n})}(o,s)})),(0,a.iw)("checkPublicLink",(async(e,t,n)=>{const{chatId:s}=(0,c.Bt)(e)||{};if(!s)return;if(e.management.progress===m.wv.InProgress)return;const{username:i}=n;e=(0,r.H9)(e,m.wv.InProgress),e=(0,r.fw)(e,s,{isUsernameAvailable:void 0}),(0,a.R3)(e);const o=await(0,S.t9)("checkChatUsername",{username:i});return e=(0,a.Rd)(),e=(0,r.H9)(e,o?m.wv.Complete:m.wv.Error),(0,r.fw)(e,s,{isUsernameAvailable:o})})),(0,a.iw)("updatePublicLink",(async(e,t,n)=>{const{chatId:s}=(0,c.Bt)(e)||{};let i=s&&(0,c.Z1)(e,s);if(!s||!i)return;const{username:o}=n;if(e=(0,r.H9)(e,m.wv.InProgress),(0,a.R3)(e),(0,d.G9)(i)){if(i=await(0,S.t9)("migrateChat",i),!i)return;t.openChat({id:i.id})}const l=await(0,S.t9)("setChatUsername",{chat:i,username:o});return e=(0,a.Rd)(),e=(0,r.H9)(e,l?m.wv.Complete:m.wv.Error),(0,r.fw)(e,s,{isUsernameAvailable:void 0})})),(0,a.iw)("updatePrivateLink",(e=>{const{chatId:t}=(0,c.Bt)(e)||{},n=t&&(0,c.Z1)(e,t);t&&n&&(0,S.t9)("updatePrivateLink",{chat:n})})),(0,a.iw)("setEditingExportedInvite",((e,t,n)=>{const{chatId:s,invite:i}=n;(0,a.R3)((0,r.fw)(e,s,{editingInvite:i}))})),(0,a.iw)("setOpenedInviteInfo",((e,t,n)=>{const{chatId:s,invite:i}=n,o=i?{inviteInfo:{invite:i}}:{inviteInfo:void 0};(0,a.R3)((0,r.fw)(e,s,o))})),(0,a.iw)("loadExportedChatInvites",(async(e,t,n)=>{const{chatId:s,adminId:i,isRevoked:o,limit:l}=n,d=(0,c.Z1)(e,s),u=(0,c.dy)(e,i||e.currentUserId);if(!d||!u)return;const m=await(0,S.t9)("fetchExportedChatInvites",{peer:d,admin:u,isRevoked:o,limit:l});if(!m)return;const h=o?{revokedInvites:m}:{invites:m};return(0,r.fw)((0,a.Rd)(),s,h)})),(0,a.iw)("editExportedChatInvite",(async(e,t,n)=>{const{chatId:s,link:i,isRevoked:o,expireDate:l,usageLimit:d,isRequestNeeded:u,title:m}=n,h=(0,c.Z1)(e,s);if(!h)return;const g=await(0,S.t9)("editExportedChatInvite",{peer:h,link:i,isRevoked:o,expireDate:l,usageLimit:d,isRequestNeeded:u,title:m});if(!g)return;const{oldInvite:f,newInvite:p}=g,v=((e=(0,a.Rd)()).management.byChatId[s].invites||[]).filter((e=>e.link!==f.link)),I=[...e.management.byChatId[s].revokedInvites||[]];return p.isRevoked?I.unshift(p):v.push(p),(0,r.fw)(e,s,{invites:v,revokedInvites:I})})),(0,a.iw)("exportChatInvite",(async(e,t,n)=>{const{chatId:s,expireDate:i,usageLimit:o,isRequestNeeded:l,title:d}=n,u=(0,c.Z1)(e,s);if(!u)return;const m=await(0,S.t9)("exportChatInvite",{peer:u,expireDate:i,usageLimit:o,isRequestNeeded:l,title:d});if(!m)return;const h=(e=(0,a.Rd)()).management.byChatId[s].invites||[];return(0,r.fw)(e,s,{invites:[...h,m]})})),(0,a.iw)("deleteExportedChatInvite",(async(e,t,n)=>{var s,i;const{chatId:o,link:l}=n,d=(0,c.Z1)(e,o);if(!d)return;if(!await(0,S.t9)("deleteExportedChatInvite",{peer:d,link:l}))return;const u=(e=(0,a.Rd)()).management.byChatId[o];return(0,r.fw)(e,o,{invites:null==u||null===(s=u.invites)||void 0===s?void 0:s.filter((e=>e.link!==l)),revokedInvites:null==u||null===(i=u.revokedInvites)||void 0===i?void 0:i.filter((e=>e.link!==l))})})),(0,a.iw)("deleteRevokedExportedChatInvites",(async(e,t,n)=>{const{chatId:s,adminId:i}=n,o=(0,c.Z1)(e,s),l=(0,c.dy)(e,i||e.currentUserId);if(o&&l)return await(0,S.t9)("deleteRevokedExportedChatInvites",{peer:o,admin:l})?(e=(0,a.Rd)(),(0,r.fw)(e,s,{revokedInvites:[]})):void 0})),(0,a.iw)("loadChatInviteImporters",(async(e,t,n)=>{var s;const{chatId:i,link:o,offsetDate:l,offsetUserId:d,limit:u}=n,m=(0,c.Z1)(e,i),h=(0,c.dy)(e,d);if(!m||d&&!h)return;const g=await(0,S.t9)("fetchChatInviteImporters",{peer:m,link:o,offsetDate:l,offsetUser:h,limit:u});if(!g)return;const f=null===(s=(e=(0,a.Rd)()).management.byChatId[i])||void 0===s?void 0:s.inviteInfo;return null!=f&&f.invite&&f.invite.link===o?(0,r.fw)(e,i,{inviteInfo:{...f,importers:g}}):void 0})),(0,a.iw)("loadChatInviteRequesters",(async(e,t,n)=>{var s;const{chatId:i,link:o,offsetDate:l,offsetUserId:d,limit:u}=n,m=(0,c.Z1)(e,i),h=(0,c.dy)(e,d);if(!m||d&&!h)return;const g=await(0,S.t9)("fetchChatInviteImporters",{peer:m,link:o,offsetDate:l,offsetUser:h,limit:u,isRequested:!0});if(!g)return;const f=null===(s=(e=(0,a.Rd)()).management.byChatId[i])||void 0===s?void 0:s.inviteInfo;return null!=f&&f.invite&&f.invite.link===o?(0,r.fw)(e,i,{inviteInfo:{...f,requesters:g}}):void 0})),(0,a.iw)("loadChatJoinRequests",(async(e,t,n)=>{const{chatId:s,offsetDate:i,offsetUserId:o,limit:l}=n,d=(0,c.Z1)(e,s),u=(0,c.dy)(e,o);if(!d||o&&!u)return;const m=await(0,S.t9)("fetchChatInviteImporters",{peer:d,offsetDate:i,offsetUser:u,limit:l,isRequested:!0});return m?(e=(0,a.Rd)(),(0,r.a4)(e,s,{joinRequests:m})):void 0})),(0,a.iw)("hideChatJoinRequest",(async(e,t,n)=>{var s;const{chatId:i,userId:o,isApproved:l}=n,d=(0,c.Z1)(e,i),u=(0,c.dy)(e,o);if(!d||!u)return;if(!await(0,S.t9)("hideChatJoinRequest",{peer:d,user:u,isApproved:l}))return;e=(0,a.Rd)();const m=(0,c.Z1)(e,i);return m?(0,r.a4)(e,i,{joinRequests:null===(s=m.joinRequests)||void 0===s?void 0:s.filter((e=>e.userId!==o))}):void 0})),(0,a.iw)("hideAllChatJoinRequests",(async(e,t,n)=>{const{chatId:s,isApproved:i,link:o}=n,l=(0,c.Z1)(e,s);if(!l)return;if(!await(0,S.t9)("hideAllChatJoinRequests",{peer:l,isApproved:i,link:o}))return;e=(0,a.Rd)();const d=(0,c.Z1)(e,s);return d?(0,r.a4)(e,s,{joinRequests:[],fullInfo:{...d.fullInfo,recentRequesterIds:[],requestsPending:0}}):void 0})),(0,a.iw)("hideChatReportPanel",(async(e,t,n)=>{const{chatId:s}=n,i=(0,c.Z1)(e,s);if(i)return await(0,S.t9)("hideChatReportPanel",i)?(0,r.a4)((0,a.Rd)(),s,{settings:void 0}):void 0}));var D=n(6974);let $;function q(e){return(0,S.t9)("fetchMessages",{chat:e,threadId:o._f,offsetId:e.lastReadInboxMessageId,addOffset:-(Math.round(s.hT/2)+1),limit:s.hT})}(0,a.iw)("sync",(()=>{s.eM&&console.log(">>> START SYNC"),$&&clearTimeout($),(0,a.R3)({...(0,a.Rd)(),isSyncing:!0}),$=window.setTimeout((()=>{(0,a.R3)({...(0,a.Rd)(),isSyncing:!1}),$=void 0}),15e3);const{loadAllChats:e,preloadTopChatMessages:t}=(0,a.Sv)();e({listType:"active",shouldReplace:!0,onReplace:async()=>{await async function(){let e=!1,t=(0,a.Rd)();const n=Object.keys(t.messages.byChatId).reduce(((e,n)=>(e[n]={},e[n].draft=(0,c.Ms)(t,n,o._f),e[n].editingId=(0,c._$)(t,n,o._f),e[n].editingDraft=(0,c.s)(t,n,o._f),e)),{}),{chatId:i,threadId:l}=(0,c.Bt)(t)||{},d=i?t.chats.byId[i]:void 0;if(i&&d){const n=await q(d);t=(0,a.Rd)();const{chatId:u}=(0,c.Bt)(t)||{},m=l&&(0,c.tZ)(t,i,l);if(n&&u===i){const a=t.messages.byChatId[i],c=i===s.aw?t.serviceNotifications.map((e=>{let{message:t}=e;return t})):[],d=[].concat(n.messages,c),u=(0,g.ee)(d,"id"),h=Object.keys(u).map(Number);if(t={...t,messages:{...t.messages,byChatId:{}}},t=(0,r.c_)(t,i,u),t=(0,r.xj)(t,i,o._f,h),t=(0,r.y9)(t,i,o._f,h),l&&m&&m.originChannelId){const{originChannelId:e}=m,n=t.messages.byChatId[e],s=await q(t.chats.byId[e]);if(s){const e=(0,g.ee)(s.messages,"id"),r=Object.keys(e).map(Number);t={...t,messages:{...t.messages,byChatId:{...t.messages.byChatId,[m.originChannelId]:{byId:e,threadsById:{[o._f]:{...null==n?void 0:n.threadsById[o._f],listedIds:r,viewportIds:r,outlyingIds:void 0}}},[i]:{...t.messages.byChatId[i],threadsById:{...t.messages.byChatId[i].threadsById,[l]:{...null==a?void 0:a.threadsById[l],outlyingIds:void 0}}}}}}}}t=(0,r.GL)(t,(0,g.ee)(n.chats,"id")),t=(0,r.eD)(t,(0,g.ee)(n.users,"id")),t=(0,r.j6)(t,i,n.threadInfos),e=!0}}e||(t={...t,messages:{...t.messages,byChatId:{}}}),Object.keys(n).forEach((e=>{t=(0,r.sN)(t,e,o._f,n[e])})),(0,a.R3)(t);const{chatId:u,messageId:m}=t.audioPlayer;u&&m&&!(0,c.hj)(t,u,m)&&(0,a.Sv)().closeAudioPlayer()}(),(0,a.R3)({...(0,a.Rd)(),lastSyncTime:Date.now(),isSyncing:!1}),s.eM&&console.log(">>> FINISH SYNC"),(0,D.S1)(),e({listType:"archived",shouldReplace:!0}),(0,S.t9)("fetchCurrentUser"),t()}})}));const j=(0,E.Ds)((e=>e()),500,!1,!0),G=(0,E.P2)((e=>e()),500,!1);function H(e,t,n){return{...e,inlineBots:{...e.inlineBots,byUsername:{...e.inlineBots.byUsername,[t]:n}}}}function _(e,t){return{...e,inlineBots:{...e.inlineBots,isLoading:t}}}(0,a.iw)("loadFullUser",((e,t,n)=>{const{userId:a}=n,s=(0,c.dy)(e,a);if(!s)return;const{id:i,accessHash:o}=s;j((()=>(0,S.t9)("fetchFullUser",{id:i,accessHash:o})))})),(0,a.iw)("loadUser",(async(e,t,n)=>{const{userId:s}=n,i=(0,c.dy)(e,s);if(!i)return;const o=await(0,S.t9)("fetchUsers",{users:[i]});if(!o)return;const{users:l,userStatusesById:d}=o;return e=(0,a.Rd)(),e=(0,r.eD)(e,(0,g.ee)(l,"id")),(0,r.ps)(e,{...e.users.statusesById,...d})})),(0,a.iw)("loadTopUsers",(e=>{const{topPeers:{lastRequestedAt:t}}=e;(!t||(0,f.b)(e.serverTimeOffset)-t>60)&&async function(){const e=await(0,S.t9)("fetchTopUsers");if(!e)return;const{ids:t,users:n}=e;let s=(0,a.Rd)();s=(0,r.Sh)(s,(0,g.ee)(n,"id")),s={...s,topPeers:{...s.topPeers,userIds:t,lastRequestedAt:(0,f.b)(s.serverTimeOffset)}},(0,a.R3)(s)}()})),(0,a.iw)("loadContactList",(()=>{!async function(){const e=await(0,S.t9)("fetchContactList");if(!e)return;let t=(0,r.Sh)((0,a.Rd)(),(0,g.ee)(e.users,"id"));t=(0,r.fZ)(t,(0,g.ee)(e.chats,"id"));const n=e=>e.lastName||e.firstName||"",s=new Intl.Collator("en-US"),i=e.users.sort(((e,t)=>s.compare(n(e),n(t)))).filter((e=>!e.isSelf));(0,a.R3)({...t,contactList:{userIds:i.map((e=>e.id))}})}()})),(0,a.iw)("loadCurrentUser",(()=>{(0,S.t9)("fetchCurrentUser")})),(0,a.iw)("loadCommonChats",(async e=>{var t,n,s;const{chatId:i}=(0,c.Bt)(e)||{},o=i?(0,c.dy)(e,i):void 0;if(!o||(0,d.cS)(o)||null!==(t=o.commonChats)&&void 0!==t&&t.isFullyLoaded)return;const l=null===(n=o.commonChats)||void 0===n?void 0:n.maxId,u=await(0,S.t9)("fetchCommonChats",o.id,o.accessHash,l);if(!u)return;const{chats:m,chatIds:h,isFullyLoaded:f}=u;return e=(0,a.Rd)(),m.length&&(e=(0,r.fZ)(e,(0,g.ee)(m,"id"))),(0,r.Nq)(e,o.id,{commonChats:{maxId:h.length?h[h.length-1]:"0",ids:(0,g.Tw)(((null===(s=o.commonChats)||void 0===s?void 0:s.ids)||[]).concat(h)),isFullyLoaded:f}})})),(0,a.iw)("updateContact",((e,t,n)=>{const{userId:s,isMuted:i=!1,firstName:o,lastName:l,shouldSharePhoneNumber:d}=n;!async function(e,t,n,s,i){let o=(0,a.Rd)();const l=(0,c.dy)(o,e);if(!l)return;let d;if((0,a.Sv)().updateChatMutedState({chatId:e,isMuted:t}),(0,a.R3)((0,r.H9)((0,a.Rd)(),m.wv.InProgress)),!l.isContact&&l.phoneNumber)d=await(0,S.t9)("importContact",{phone:l.phoneNumber,firstName:n,lastName:s});else{const{id:e,accessHash:t}=l;d=await(0,S.t9)("updateContact",{id:e,accessHash:t,phoneNumber:"",firstName:n,lastName:s,shouldSharePhoneNumber:i})}o=(0,a.Rd)(),d&&((0,a.Sv)().loadChatSettings({chatId:e}),(0,a.R3)((0,r.Nq)(o,l.id,{firstName:n,lastName:s}))),o=(0,r.H9)(o,m.wv.Complete),o=(0,r.ft)(o),(0,a.R3)(o)}(s,i,o,l,d)})),(0,a.iw)("deleteContact",((e,t,n)=>{const{userId:s}=n;!async function(e){const t=(0,a.Rd)(),n=(0,c.dy)(t,e);if(!n)return;const{id:s,accessHash:i}=n;await(0,S.t9)("deleteContact",{id:s,accessHash:i})}(s)})),(0,a.iw)("loadProfilePhotos",(async(e,t,n)=>{const{profileId:s}=n,i=(0,d.YC)(s),o=i?(0,c.dy)(e,s):void 0,l=i?void 0:(0,c.Z1)(e,s);if(!o&&!l)return;const u=await(0,S.t9)("fetchProfilePhotos",o,l);return u&&u.photos?(e=(0,a.Rd)(),i?e=(0,r.Nq)(e,s,{photos:u.photos}):(e=(0,r.Sh)(e,(0,g.ee)(u.users,"id")),e=(0,r.a4)(e,s,{photos:u.photos})),e):void 0})),(0,a.iw)("setUserSearchQuery",((e,t,n)=>{const{query:s}=n;s&&G((()=>{!async function(e){const t=await(0,S.t9)("searchChats",{query:e});let n=(0,a.Rd)();const s=n.userSearch.query;if(!t||!s||e!==s)return void(0,a.R3)((0,r.Q3)(n,!1));const{localUsers:i,globalUsers:o}=t;let c,l;i.length&&(n=(0,r.Sh)(n,(0,g.ee)(i,"id")),c=i.map((e=>{let{id:t}=e;return t}))),o.length&&(n=(0,r.Sh)(n,(0,g.ee)(o,"id")),l=o.map((e=>{let{id:t}=e;return t}))),n=(0,r.Q3)(n,!1),n=(0,r.Lm)(n,{localUserIds:c,globalUserIds:l}),(0,a.R3)(n)}(s)}))})),(0,a.iw)("importContact",(async(e,t,n)=>{const{phoneNumber:s,firstName:i,lastName:o}=n,c=await(0,S.t9)("importContact",{phone:s,firstName:i,lastName:o});if(c)return t.openChat({id:c}),(0,r.ft)((0,a.Rd)());t.showNotification({message:I.i0("Contacts.PhoneNumber.NotRegistred")})})),(0,a.iw)("reportSpam",((e,t,n)=>{const{chatId:a}=n,s=(0,d.YC)(a)?(0,c.dy)(e,a):(0,c.Z1)(e,a);s&&(0,S.t9)("reportSpam",s)}));const z=(0,E.Ds)((e=>e()),500,!1);async function V(e,t,n,a,s){await(0,S.t9)("sendMessage",{chat:e,text:n,replyingTo:a,sendAs:s})}(0,a.iw)("clickInlineButton",((e,t,n)=>{const{button:i}=n;switch(i.type){case"command":t.sendBotCommand({command:i.value});break;case"url":i.value.match(s.FS)||i.value.match(s.g$)?t.openTelegramLink({url:i.value}):t.toggleSafeLinkModal({url:i.value});break;case"callback":{const t=(0,c.jr)(e);if(!t)return;!async function(e,t,n){const s=await(0,S.t9)("answerCallbackButton",{chatId:e.id,accessHash:e.accessHash,messageId:t,data:n});if(!s)return;const{showDialog:i,showNotification:o,toggleSafeLinkModal:r}=(0,a.Sv)(),{message:c,alert:l,url:d}=s;l?i({data:{message:c||"Error"}}):c?o({message:c}):d&&r({url:d})}(t,i.messageId,i.value);break}case"requestPoll":t.openPollModal();break;case"requestSelfContact":{const n=e.currentUserId?(0,c.dy)(e,e.currentUserId):void 0;if(!n)return;t.showDialog({data:{phoneNumber:n.phoneNumber,firstName:n.firstName,lastName:n.lastName,userId:n.id}});break}case"buy":{const n=(0,c.jr)(e),{messageId:a,value:s}=i;if(!n)return;s?t.getReceipt({receiptMessageId:s,chatId:n.id,messageId:a}):(t.getPaymentForm({chat:n,messageId:a}),t.setInvoiceMessageInfo((0,c.hj)(e,n.id,a)),t.openPaymentModal({chatId:n.id,messageId:a}));break}}})),(0,a.iw)("sendBotCommand",((e,t,n)=>{const{command:a,chatId:s}=n,{currentUserId:i}=e,o=s?(0,c.Z1)(e,s):(0,c.jr)(e),r=(0,c.Bt)(e);if(!i||!o||!r)return;const{threadId:l}=r;t.setReplyingToId({messageId:void 0}),t.clearWebPagePreview({chatId:o.id,threadId:l,value:!1}),V(o,0,a,(0,c.Yy)(e,o.id,l),(0,c._5)(e,s))})),(0,a.iw)("restartBot",(async(e,t,n)=>{const{chatId:s}=n,{currentUserId:i}=e,o=(0,c.jr)(e),l=i&&(0,c.IK)(e,s);i&&o&&l&&await(0,S.t9)("unblockContact",l.id,l.accessHash)&&((0,a.R3)((0,r.rB)((0,a.Rd)(),l.id)),V(o,0,"/start",void 0,(0,c._5)(e,s)))})),(0,a.iw)("loadTopInlineBots",(async e=>{const{lastRequestedAt:t}=e.topInlineBots;if(t&&(0,f.b)(e.serverTimeOffset)-t<60)return;const n=await(0,S.t9)("fetchTopInlineBots");if(!n)return;const{ids:s,users:i}=n;return e=(0,a.Rd)(),e=(0,r.Sh)(e,(0,g.ee)(i,"id")),{...e,topInlineBots:{...e.topInlineBots,userIds:s,lastRequestedAt:(0,f.b)(e.serverTimeOffset)}}})),(0,a.iw)("queryInlineBot",(async(e,t,n)=>{const{chatId:s,username:i,query:o,offset:l}=n;let d=e.inlineBots.byUsername[i];if(!1!==d){if(void 0===d){const{user:t,chat:n}=await(0,S.t9)("fetchInlineBot",{username:i})||{};if(e=(0,a.Rd)(),!t||!n)return void(0,a.R3)(H(e,i,!1));e=(0,r.Sh)(e,{[t.id]:t}),e=(0,r.fZ)(e,{[n.id]:n}),d={id:t.id,query:"",offset:"",switchPm:void 0,canLoadMore:!0,results:[]},e=H(e,i,d),(0,a.R3)(e)}(o!==d.query||d.canLoadMore)&&z((()=>{!async function(e){let{username:t,inlineBotData:n,chatId:s,query:i,offset:o}=e,r=(0,a.Rd)();const l=(0,c.dy)(r,n.id),d=(0,c.Z1)(r,s);if(!l||!d)return;const u=n.query!==i;r=_(r,!0),r=H(r,t,{...n,query:i,...u&&{offset:void 0,results:[]}}),(0,a.R3)(r);const m=await(0,S.t9)("fetchInlineBotResults",{bot:l,chat:d,query:i,offset:u?void 0:o}),h=r.inlineBots.byUsername[t];if(r=_((0,a.Rd)(),!1),!m||!h||i!==h.query)return void(0,a.R3)(r);const g=new Set((h.results||[]).map((e=>e.id))),f=m.results.filter((e=>!g.has(e.id)));r=H(r,t,{...h,help:m.help,...f.length&&{isGallery:m.isGallery},...m.switchPm&&{switchPm:m.switchPm},canLoadMore:m.results.length>0&&Boolean(m.nextOffset),results:""===h.offset||h.offset===m.nextOffset?m.results:(h.results||[]).concat(f),offset:f.length?m.nextOffset:""}),(0,a.R3)(r)}({username:i,inlineBotData:d,chatId:s,query:o,offset:l})}))}})),(0,a.iw)("sendInlineBotResult",((e,t,n)=>{const{id:a,queryId:s,isSilent:i,scheduledAt:o}=n,r=(0,c.Bt)(e);if(!r||!a)return;const{chatId:l,threadId:d}=r,u=(0,c.Z1)(e,l);t.setReplyingToId({messageId:void 0}),t.clearWebPagePreview({chatId:l,threadId:d,value:!1}),(0,S.t9)("sendInlineBotResult",{chat:u,resultId:a,queryId:s,replyingTo:(0,c.Yy)(e,l,d),sendAs:(0,c._5)(e,l),isSilent:i,scheduleDate:o})})),(0,a.iw)("resetInlineBot",((e,t,n)=>{const{username:s}=n;let i=e.inlineBots.byUsername[s];i&&(i={id:i.id,query:"",offset:"",switchPm:void 0,canLoadMore:!0,results:[]},(0,a.R3)(H(e,s,i)))})),(0,a.iw)("startBot",(async(e,t,n)=>{const{botId:a,param:s}=n,i=(0,c.dy)(e,a);i&&await(0,S.t9)("startBot",{bot:i,startParam:s})})),n(1371),(0,a.iw)("loadPasswordInfo",(async e=>{const t=await(0,S.t9)("getPasswordInfo");if(t)return e=(0,a.Rd)(),e=(0,r.BI)(e,{hasPassword:t.hasPassword}),(0,r.IE)(e,{hint:t.hint})})),(0,a.iw)("checkPassword",(async(e,t,n)=>{const{currentPassword:s,onSuccess:i}=n;(0,a.R3)((0,r.IE)(e,{isLoading:!0,error:void 0}));const o=await(0,S.t9)("checkPassword",s);(0,a.R3)((0,r.IE)((0,a.Rd)(),{isLoading:!1})),o&&i()})),(0,a.iw)("clearPassword",(async(e,t,n)=>{const{currentPassword:s,onSuccess:i}=n;(0,a.R3)((0,r.IE)(e,{isLoading:!0,error:void 0}));const o=await(0,S.t9)("clearPassword",s);(0,a.R3)((0,r.IE)((0,a.Rd)(),{isLoading:!1})),o&&i()})),(0,a.iw)("updatePassword",(async(e,t,n)=>{const{currentPassword:s,password:i,hint:o,email:c,onSuccess:l}=n;(0,a.R3)((0,r.IE)(e,{isLoading:!0,error:void 0}));const d=await(0,S.t9)("updatePassword",s,i,o,c);(0,a.R3)((0,r.IE)((0,a.Rd)(),{isLoading:!1})),d&&l()})),(0,a.iw)("updateRecoveryEmail",(async(e,t,n)=>{const{currentPassword:s,email:i,onSuccess:o}=n;(0,a.R3)((0,r.IE)(e,{isLoading:!0,error:void 0}));const c=await(0,S.t9)("updateRecoveryEmail",s,i);(0,a.R3)((0,r.IE)((0,a.Rd)(),{isLoading:!1,waitingEmailCodeLength:void 0})),c&&o()})),(0,a.iw)("provideTwoFaEmailCode",((e,t,n)=>{const{code:a}=n;(0,S.t9)("provideRecoveryEmailCode",a)})),(0,a.iw)("clearTwoFaError",(e=>(0,r.IE)(e,{error:void 0}))),(0,a.iw)("validateRequestedInfo",((e,t,n)=>{const{requestInfo:s,saveInfo:i}=n,o=(0,c.gx)(e),l=o&&(0,c.Z1)(e,o),d=(0,c.Mz)(e);l&&d&&async function(e,t,n,s){const i=await(0,S.t9)("validateRequestedInfo",{chat:e,messageId:t,requestInfo:n,shouldSave:s});if(!i)return;const{id:o,shippingOptions:c}=i;if(!o)return;let l=(0,r.vT)((0,a.Rd)(),o);c?(l=(0,r.TM)(l,c),l=(0,r.Q$)(l,m.KB.Shipping)):l=(0,r.Q$)(l,m.KB.PaymentInfo),(0,a.R3)(l)}(l,d,s,i)})),(0,a.iw)("getPaymentForm",((e,t,n)=>{const{chat:s,messageId:i}=n;s&&i&&async function(e,t){const n=await(0,S.t9)("getPaymentForm",{chat:e,messageId:t});if(!n)return;let s=(0,r._7)((0,a.Rd)(),n),i=m.KB.PaymentInfo;s.payment.invoice&&(s.payment.invoice.shippingAddressRequested||s.payment.invoice.nameRequested||s.payment.invoice.phoneRequested||s.payment.invoice.emailRequested)&&(i=m.KB.ShippingInfo),s=(0,r.Q$)(s,i),(0,a.R3)(s)}(s,i)})),(0,a.iw)("getReceipt",((e,t,n)=>{const{receiptMessageId:s,chatId:i,messageId:o}=n,l=i&&(0,c.Z1)(e,i);o&&s&&l&&async function(e,t,n){const s=await(0,S.t9)("getReceipt",e,n);if(!s)return;let i=(0,a.Rd)();const o=(0,c.hj)(i,e.id,t);i=(0,r.Dq)(i,s,o),(0,a.R3)(i)}(l,o,s)})),(0,a.iw)("clearPaymentError",(e=>{(0,a.R3)({...e,payment:{...e.payment,error:void 0}})})),(0,a.iw)("clearReceipt",(e=>{(0,a.R3)({...e,payment:{...e.payment,receipt:void 0}})})),(0,a.iw)("sendCredentialsInfo",((e,t,n)=>{const{nativeProvider:i}=e.payment,{credentials:o}=n,{data:l}=o;if("stripe"===i){const t=(0,c.$$)(e);if(!t)return;!async function(e,t){const n=function(e){const t=Object.keys(e).map((t=>`${t}=${e[t]}`)).join("&");return t.length>0?`?${t}`:""}({"card[number]":e.cardNumber,"card[exp_month]":e.expiryMonth,"card[exp_year]":e.expiryYear,"card[cvc]":e.cvv,"card[address_zip]":e.zip,"card[address_country]":e.country}),s=await fetch(`https://api.stripe.com/v1/tokens${n}`,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/x-www-form-urlencoded",Authorization:`Bearer ${t}`}}),i=await s.json();if(i.error){const e=(0,d.Ow)(i.error),t=(0,a.Rd)();return void(0,a.R3)({...t,payment:{...t.payment,error:{...e}}})}let o=(0,r.QH)((0,a.Rd)(),{type:i.type,id:i.id});o=(0,r.Q$)(o,m.KB.Checkout),(0,a.R3)(o)}(l,t)}else if("smartglocal"===i){const t=(0,c.EB)(e);if(!t)return;!async function(e,t){const n={card:{number:e.cardNumber.replace(/[^\d]+/g,""),expiration_month:e.expiryMonth,expiration_year:e.expiryYear,security_code:e.cvv.replace(/[^\d]+/g,"")}},i=s.eA?"https://tgb-playground.smart-glocal.com/cds/v1/tokenize/card":"https://tgb.smart-glocal.com/cds/v1/tokenize/card",o=await fetch(i,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json","X-PUBLIC-TOKEN":t},body:JSON.stringify(n)}),c=await o.json();if("ok"!==c.status){const e={description:"payment error"},t=(0,a.Rd)();return void(0,a.R3)({...t,payment:{...t.payment,error:{...e}}})}let l=(0,r.QD)((0,a.Rd)(),{type:"card",token:c.data.token});l=(0,r.Q$)(l,m.KB.Checkout),(0,a.R3)(l)}(l,t)}})),(0,a.iw)("sendPaymentForm",((e,t,n)=>{const{shippingOptionId:s,saveCredentials:i}=n,o=(0,c.gx)(e),l=o&&(0,c.Z1)(e,o),d=(0,c.Mz)(e),u=(0,c.eh)(e),m=(0,c.sp)(e),{nativeProvider:h}=e.payment,g="stripe"===h?(0,c.$$)(e):(0,c.EB)(e);l&&d&&g&&u&&h&&async function(e,t,n,s,i,o,c){if(!0===await(0,S.t9)("sendPaymentForm",{chat:e,messageId:t,formId:s,credentials:i,requestedInfoId:o,shippingOptionId:c})){const e=(0,r.bp)((0,a.Rd)());(0,a.R3)((0,r.WY)(e))}}(l,d,0,u,{save:i,data:"stripe"===h?(0,c.i3)(e):(0,c.Jg)(e)},m,s)})),(0,a.iw)("setPaymentStep",(function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return(0,r.Q$)(e,n.step||m.KB.ShippingInfo)})),(0,a.iw)("setInvoiceMessageInfo",((e,t,n)=>(0,r.nA)(e,n)));var K=n(647),X=n(4907);const W=728,Y=424,J=288;var Q=n(3858);function ee(e,t){return t-(e.isLeftColumnShown&&!h.wB?e.leftColumnWidth||((n=Q.Z.get().width)>s._m?Math.min(Math.max(.25*n,J),.33*n):n>s.ks?Math.min(Math.max(.33*n,J),.4*n):Y):0);var n}let te=0;(0,a.iw)("loadAvailableReactions",(async()=>{const e=await(0,S.t9)("getAvailableReactions");if(e)return e.forEach((e=>{e.aroundAnimation&&K.he(`sticker${e.aroundAnimation.id}`,o.IU.Lottie),e.centerIcon&&K.he(`sticker${e.centerIcon.id}`,o.IU.Lottie)})),{...(0,a.Rd)(),availableReactions:e}})),(0,a.iw)("interactWithAnimatedEmoji",((e,t,n)=>{const{emoji:a,x:s,y:i,localEffect:o,startSize:r,isReversed:c}=n,l={id:te++,animatedEffect:a||o,x:ee(e,s)+40*Math.random()-20,y:i+40*Math.random()-20,startSize:r,isReversed:c};return{...e,activeEmojiInteractions:[...e.activeEmojiInteractions||[],l]}})),(0,a.iw)("sendEmojiInteraction",((e,t,n)=>{const{messageId:a,chatId:s,emoji:i,interactions:o,localEffect:r}=n,l=(0,c.Z1)(e,s);l&&(i||r)&&s!==e.currentUserId&&(0,S.t9)("sendEmojiInteraction",{chat:l,messageId:a,emoticon:i||(0,c.ji)(r),timestamps:o})})),(0,a.iw)("sendDefaultReaction",((e,t,n)=>{const{chatId:a,messageId:s,x:i,y:o}=n,r=(0,c.q6)(e,a),l=(0,c.hj)(e,a,s);r&&l&&!(0,d.CI)(l)&&t.sendReaction({chatId:a,messageId:s,reaction:r,x:i,y:o})})),(0,a.iw)("sendReaction",((e,t,n)=>{var a,i,o;const{chatId:r}=n;let{messageId:l}=n,{reaction:d}=n;const u=(0,c.Z1)(e,r);let m=(0,c.hj)(e,r,l);if(!u||!m)return;const h=Boolean(m.groupedId)&&!m.isInAlbum,f=h?(0,c.xH)(e,r,m.groupedId)[0]:void 0;m=h&&(0,c.hj)(e,r,f)||m,l=(null===(a=m)||void 0===a?void 0:a.id)||l,null!==(i=m.reactions)&&void 0!==i&&null!==(o=i.results)&&void 0!==o&&o.some((e=>e.reaction===d&&e.isChosen))&&(d=void 0),(0,S.t9)("sendReaction",{chat:u,messageId:l,reaction:d});const{animationLevel:p}=e.settings.byKey;return p===s.zy&&(e={...e,activeReactions:{...d?e.activeReactions:(0,g.CE)(e.activeReactions,[l]),...d&&{[l]:{reaction:d,messageId:l}}}}),function(e,t,n,a){const{reactions:s}=(0,c.hj)(e,t,n)||{};if(!s)return e;let i=s.results.map((e=>e.reaction===a?{...e,count:e.isChosen?e.count:e.count+1,isChosen:!0}:e.isChosen?{...e,isChosen:!1,count:e.count-1}:e)).filter((e=>e.count>0)),{recentReactions:o}=s;if(a&&!i.some((e=>e.reaction===a))){const{currentUserId:t}=e;i=[...i,{reaction:a,isChosen:!0,count:1}],s.canSeeList&&(o=[...o||[],{userId:t,reaction:a}])}return(0,X.cY)(e,t,n,{reactions:{...s,results:i,recentReactions:o}})}(e,r,l,d)})),(0,a.iw)("openChat",(e=>({...e,activeReactions:{}}))),(0,a.iw)("startActiveReaction",((e,t,n)=>{var a;const{messageId:i,reaction:o}=n,{animationLevel:r}=e.settings.byKey;return r!==s.zy||(null===(a=e.activeReactions[i])||void 0===a?void 0:a.reaction)===o?e:{...e,activeReactions:{...o?e.activeReactions:(0,g.CE)(e.activeReactions,[i]),...o&&{[i]:{reaction:o,messageId:i}}}}})),(0,a.iw)("stopActiveReaction",((e,t,n)=>{var a;const{messageId:s,reaction:i}=n;return(null===(a=e.activeReactions[s])||void 0===a?void 0:a.reaction)!==i?e:{...e,activeReactions:(0,g.CE)(e.activeReactions,[s])}})),(0,a.iw)("setDefaultReaction",(async(e,t,n)=>{const{reaction:s}=n;if(await(0,S.t9)("setDefaultReaction",{reaction:s}))return{...(0,a.Rd)(),appConfig:{...e.appConfig,defaultReaction:s}}})),(0,a.iw)("stopActiveEmojiInteraction",((e,t,n)=>{var a;const{id:s}=n;return{...e,activeEmojiInteractions:null===(a=e.activeEmojiInteractions)||void 0===a?void 0:a.filter((e=>e.id!==s))}})),(0,a.iw)("loadReactors",(async(e,t,n)=>{var s,i,o;const{chatId:l,messageId:d,reaction:u}=n,m=(0,c.Z1)(e,l),h=(0,c.hj)(e,l,d);if(!m||!h)return;const f=null===(s=h.reactors)||void 0===s?void 0:s.nextOffset,p=await(0,S.t9)("fetchMessageReactionsList",{reaction:u,chat:m,messageId:d,offset:f});if(!p)return;e=(0,a.Rd)(),null!==(i=p.users)&&void 0!==i&&i.length&&(e=(0,r.Sh)(e,(0,g.ee)(p.users,"id")));const{nextOffset:v,count:I,reactions:y}=p;return(0,r.cY)(e,l,d,{reactors:{nextOffset:v,count:I,reactions:[...(null===(o=h.reactors)||void 0===o?void 0:o.reactions)||[],...y]}})})),(0,a.iw)("loadMessageReactions",((e,t,n)=>{const{ids:a,chatId:s}=n,i=(0,c.Z1)(e,s);i&&(0,S.t9)("fetchMessageReactions",{ids:a,chat:i})})),(0,a.iw)("sendWatchingEmojiInteraction",((e,t,n)=>{var a;const{chatId:s,emoticon:i,x:o,y:r,startSize:l,isReversed:d,id:u}=n,m=(0,c.Z1)(e,s);if(m&&null!==(a=e.activeEmojiInteractions)&&void 0!==a&&a.some((e=>e.id===u))&&s!==e.currentUserId)return(0,S.t9)("sendWatchingEmojiInteraction",{chat:m,emoticon:i}),{...e,activeEmojiInteractions:e.activeEmojiInteractions.map((t=>t.id===u?{...t,x:ee(e,o),y:r,startSize:l,isReversed:d}:t))}})),(0,a.iw)("loadStatistics",(async(e,t,n)=>{var s;const{chatId:i,isGroup:o}=n,l=(0,c.Z1)(e,i);if(null==l||!l.fullInfo)return;const d=await(0,S.t9)(o?"fetchGroupStatistics":"fetchChannelStatistics",{chat:l});if(d){if(e=(0,a.Rd)(),null!==(s=d.recentTopMessages)&&void 0!==s&&s.length){const t=(0,c.Zw)(e,i);d.recentTopMessages=d.recentTopMessages.map((e=>({...e,...t[e.msgId]})))}return(0,r.ze)(e,i,d)}})),(0,a.iw)("loadStatisticsAsyncGraph",(async(e,t,n)=>{const{chatId:s,token:i,name:o,isPercentage:l}=n,d=(0,c.Z1)(e,s);if(null==d||!d.fullInfo)return;const u=d.fullInfo.statisticsDcId,m=await(0,S.t9)("fetchStatisticsAsyncGraph",{token:i,dcId:u,isPercentage:l});return m?(0,r.yC)((0,a.Rd)(),s,o,m):void 0})),n(8304);var ne=n(8406);function ae(e,t){const n=typeof e;if(n!==typeof t)return!1;if("object"!==n)return e===t;const a=Array.isArray(e);if(a!==Array.isArray(t))return!1;if(a){const n=e,a=t;return n.length===a.length&&n.every(((e,t)=>ae(e,a[t])))}const s=e,i=t;return Object.keys(s).every((e=>ae(s[e],i[e])))}(0,a.iw)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"updateChat":return n.noTopChatsRequest||(0,c.N)(e,n.id)||t.loadTopChats(),(0,a.R3)((0,r.a4)(e,n.id,n.chat,n.newProfilePhoto)),void(n.chat.id&&(0,ne.Vr)({chatId:n.chat.id,lastReadInboxMessageId:n.chat.lastReadInboxMessageId}));case"updateChatJoin":{const s=(0,c.Ek)(e,n.id);if(!s)return;e=(0,r.B1)(e,s,[n.id]),e=(0,r.a4)(e,n.id,{isNotJoined:!1}),(0,a.R3)(e);const i=(0,c.Z1)(e,n.id);return void(i&&t.requestChatUpdate({chatId:i.id}))}case"updateChatLeave":return(0,r.Dd)(e,n.id);case"updateChatInbox":return(0,r.a4)(e,n.id,n.chat);case"updateChatTypingStatus":{const{id:t,typingStatus:s}=n;return(0,a.R3)((0,r.a4)(e,t,{typingStatus:s})),void setTimeout((()=>{e=(0,a.Rd)();const n=(0,c.Z1)(e,t);n&&s&&n.typingStatus&&n.typingStatus.timestamp===s.timestamp&&(0,a.R3)((0,r.a4)(e,t,{typingStatus:void 0}))}),6e3)}case"newMessage":{const{message:s}=n,{chatId:i,threadId:l,type:d}=(0,c.Bt)(e)||{};if(s.senderId===e.currentUserId&&!s.isFromScheduled)return;const u=(0,c.Z1)(e,n.chatId);if(!u)return;return"thread"===d&&l===o._f&&n.chatId===i?setTimeout((()=>{t.requestChatUpdate({chatId:n.chatId})}),1500):(0,a.R3)((0,r.a4)(e,n.chatId,{unreadCount:u.unreadCount?u.unreadCount+1:1,...n.message.hasUnreadMention&&{unreadMentionsCount:u.unreadMentionsCount?u.unreadMentionsCount+1:1}})),void(0,ne.rh)({chat:u,message:s})}case"updateMessage":{const{message:t}=n,a=(0,c.Z1)(e,n.chatId);if(!a)return;return void((0,d.dT)(t)&&(0,ne.rh)({chat:a,message:t,isReaction:!0}))}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,c.X5)(e,t),s=(0,c.Z1)(e,a);null!=s&&s.unreadMentionsCount&&(e=(0,r.a4)(e,a,{unreadMentionsCount:s.unreadMentionsCount-1}))})),e}case"updateChatFullInfo":{const{fullInfo:t}=n,a=e.chats.byId[n.id];if(!a)return;return(0,r.a4)(e,n.id,{fullInfo:{...a.fullInfo,...t}})}case"updatePinnedChatIds":{const{ids:t,folderId:a}=n,i=a===s.WS?"archived":"active";return{...e,chats:{...e.chats,orderedPinnedIds:{...e.chats.orderedPinnedIds,[i]:t.length?t:void 0}}}}case"updateChatPinned":{const{id:t,isPinned:a}=n,i=(0,c.Ek)(e,t);if(!i)return;const{[i]:o}=e.chats.orderedPinnedIds;let r=o||[];if(a){if(!r.includes(t)){if("active"===i&&r.length>=s.EG){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,[i]:r.length?r:void 0}}}}case"updateChatListType":{const{id:t,folderId:a}=n;return(0,r.Pi)(e,t,a)}case"updateChatFolder":{const{id:t,folder:a}=n,{byId:s,orderedIds:i}=e.chatFolders,o=a?{...s,[t]:a}:(0,g.ei)(s,Object.keys(s).map(Number).filter((e=>e!==t))),r=a?i&&i.includes(t)?i:[...i||[],t]:i?i.filter((e=>e!==t)):void 0;return{...e,chatFolders:{...e.chatFolders,byId:o,orderedIds:r}}}case"updateChatFoldersOrder":{const{orderedIds:t}=n;return{...e,chatFolders:{...e.chatFolders,orderedIds:t}}}case"updateRecommendedChatFolders":{const{folders:t}=n;return{...e,chatFolders:{...e.chatFolders,recommended:t}}}case"updateChatMembers":{var i;const t=e.chats.byId[n.id],{replacedMembers:a,addedMember:s,deletedMemberId:o}=n;if(!t)return;let c=!1,l=null!==(i=t.fullInfo)&&void 0!==i&&i.members?[...t.fullInfo.members]:[];if(a)l=a,c=!0;else if(s)l.length&&l.some((e=>e.userId===s.userId))||(l.push(s),c=!0);else if(l.length&&o){const e=l.findIndex((e=>e.userId===o));e>-1&&(l.slice(e,1),c=!0)}if(c){const a=l.filter((e=>{let{isOwner:t,isAdmin:n}=e;return t||n}));return(0,r.a4)(e,n.id,{membersCount:l.length,fullInfo:{...t.fullInfo,members:l,adminMembers:a}})}return}case"deleteProfilePhotos":{const{chatId:t,ids:a}=n,s=e.chats.byId[t];return null!=s&&s.photos?(0,r.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}=n;if(!e.chats.byId[t])return;return e=(0,r.pf)(e,t,o._f,"draft",a),e=(0,r.pf)(e,t,o._f,"replyingToId",i),e=(0,r.a4)(e,t,{draftDate:s})}case"showInvite":{const{data:e}=n;return void t.showDialog({data:e})}case"updatePendingJoinRequests":{const{chatId:s,requestsPending:i,recentRequesterIds:o}=n,c=e.chats.byId[s];if(!c)return;e=(0,r.a4)(e,s,{fullInfo:{...c.fullInfo,requestsPending:i,recentRequesterIds:o}}),(0,a.R3)(e),t.loadChatJoinRequests({chatId:s})}}}));const se=350;function ie(e,t,n,a){let s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const i=s?(0,c.Tm)(e,t,n):(0,c.hj)(e,t,n);if(i&&a.content){const{photo:e,video:t,sticker:n,document:s}=(0,d.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)}return s?(0,r.P4)(e,t,n,a):(0,r.cY)(e,t,n,a)}function oe(e,t,n,a){const{chatId:s}=n,{threadInfo:i}=(0,c.Db)(e,s,n)||{};if(!i&&n.replyToMessageId){const i=(0,c.hj)(e,s,n.replyToMessageId);i?e=(0,r.lG)(e,i,s,n.id,a):t.loadMessage({chatId:s,messageId:n.replyToMessageId,threadUpdate:{isDeleting:a,lastMessageId:n.id}})}return e}function re(e,t,n){const{id:a,chatId:s}=n,{threadInfo:i,firstMessageId:l}=(0,c.Db)(e,s,n)||{},u=(0,c.Z1)(e,s),m=(null==u?void 0:u.unreadCount)&&!(0,c.gb)(e,s,o._f);if(e=oe(e,t,n),i&&(!l&&(0,d.CI)(n)||(e=(0,r.xj)(e,s,i.threadId,[a]),(0,c.b9)(e,s,i.threadId)&&(e=(0,r.$S)(e,s,i.threadId,a),l||(e=(0,r.pf)(e,s,i.threadId,"firstMessageId",n.id)))),e=(0,r.pf)(e,s,i.threadId,"threadInfo",{...i,lastMessageId:n.id,messagesCount:i.messagesCount+1})),m)return e;if(e=(0,r.xj)(e,s,o._f,[a]),(0,c.b9)(e,s,o._f)){const t=(0,c.It)(e,s,o._f),n=(0,r.$S)(e,s,o._f,a),i=(0,c.Cb)(n,s,o._f);t&&!i.includes(t)||(e=n)}return e}function ce(e,t,n){var a;let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{chats:i}=e,o=null===(a=i.byId[t])||void 0===a?void 0:a.lastMessage;return!o||s||o.id===n.id||o.id===n.previousLocalId||n.id>o.id?(0,r.a4)(e,t,{lastMessage:n}):e}function le(e,t){const n=(0,c.Zw)(e,t),a=(0,c.gb)(e,t,o._f);if(!n||!a)return;let s=a.length;for(;s--;){const e=n[a[s]];if(!e.isDeleting)return e}}function de(e,t,n,s){if(e){t.forEach((t=>{const n=le(s=(0,r.cY)(s,e,t,{isDeleting:!0}),e);n&&(s=ce(s,e,n,!0))})),(0,a.R3)(s),n.requestChatUpdate({chatId:e});const i=[];return t.forEach((t=>{const a=(0,c.hj)(s,e,t);if(!a)return;s=oe(s,n,a,!0);const{threadInfo:o}=(0,c.Db)(s,e,a)||{};o&&i.push(o.threadId)})),(0,a.R3)(s),void setTimeout((()=>{(0,a.R3)((0,r.K4)((0,a.Rd)(),e,t)),(0,g.Tw)(i).forEach((t=>{n.requestThreadInfoUpdate({chatId:e,threadId:t})}))}),se)}const i=[];t.forEach((e=>{const t=(0,c.X5)(s,e);if(t){i.push(t);const n=le(s=(0,r.cY)(s,t,e,{isDeleting:!0}),t);n&&(s=ce(s,t,n,!0)),setTimeout((()=>{(0,a.R3)((0,r.K4)((0,a.Rd)(),t,[e]))}),se)}})),(0,a.R3)(s),(0,g.Tw)(i).forEach((e=>{n.requestChatUpdate({chatId:e})}))}(0,a.iw)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"newMessage":{const{chatId:i,id:l,message:u,shouldForceReply:m}=n;e=re(e=ie(e,i,l,u),t,u),u.threadInfo&&(e=(0,r.Xg)(e,u.threadInfo.chatId,u.threadInfo.threadId,u.threadInfo)),(0,a.R3)(e);const h=(0,c.hj)(e,i,l);if((0,c.KA)(e,i,u)){var s;if(u.isOutgoing&&(null===(s=u.content)||void 0===s||!s.action)){const n=(0,c.Bt)(e);n&&t.focusMessage({chatId:i,threadId:n.threadId,messageId:u.id,noHighlight:!0,isResizingContainer:!0})}const{threadInfo:n}=(0,c.Db)(e,i,u)||{};n&&t.requestThreadInfoUpdate({chatId:i,threadId:n.threadId}),(0,d.CI)(u)||setTimeout((()=>{let e=(0,a.Rd)();m&&(e=(0,r.pf)(e,i,o._f,"replyingToId",l)),(0,a.R3)(ce(e,i,h))}),se)}else(0,a.R3)(ce((0,a.Rd)(),i,h));(0,c.N)(e,i)||t.loadTopChats();break}case"updateStartEmojiInteraction":{var i;const{chatId:t}=(0,c.Bt)(e)||{};if(t!==n.id)return;const s=(0,c.hj)(e,t,n.messageId);if(!s)return;if((0,d.UD)(s)!==n.emoji)return;const o=(0,c.CP)(e,n.emoji);e={...e,activeEmojiInteractions:[...e.activeEmojiInteractions||[],{id:(null===(i=e.activeEmojiInteractions)||void 0===i?void 0:i.length)||0,animatedEffect:o?(0,c.cu)(o):n.emoji,messageId:n.messageId}]},(0,a.R3)(e);break}case"newScheduledMessage":{const{chatId:t,id:s,message:i}=n;e=ie(e,t,s,i,!0);const l=(0,c.qy)(e,t)||[];e=(0,r.pf)(e,t,o._f,"scheduledIds",(0,g.Tw)([...l,s])),(0,a.R3)(e);break}case"updateMessage":{var l,u;const{chatId:s,id:i,message:d}=n;if(!(0,c.hj)(e,s,i))return;e=ie(e,s,i,d);const m=(0,c.hj)(e,s,i);d.threadInfo&&(e=(0,r.Xg)(e,d.threadInfo.chatId,d.threadInfo.threadId,d.threadInfo)),e=ce(e,s,m),(0,a.R3)(e);const h=(0,c.Z1)(e,s);h&&!d.isOutgoing&&(null===(l=h.lastMessage)||void 0===l?void 0:l.id)===d.id&&(0,c.xo)(e,h)&&(0,c.KA)(e,s,d)&&(0,c.b9)(e,s,(null===(u=d.threadInfo)||void 0===u?void 0:u.threadId)||o._f)&&t.focusLastMessage();break}case"updateScheduledMessage":{const{chatId:t,id:s,message:i}=n;if(!(0,c.Tm)(e,t,s))return;e=ie(e,t,s,i,!0);const l=Object.keys((0,c.Fn)(e,t)||{}).map(Number).sort(((e,t)=>t-e));e=(0,r.pf)(e,t,o._f,"scheduledIds",l),(0,a.R3)(e);break}case"updateMessageSendSucceeded":{const{chatId:s,localId:i,message:o}=n;e=re(e,t,o);const l=(0,c.hj)(e,s,i);e=(0,r.K4)(e,s,[i]),o.isScheduled&&(e=(0,r.bV)(e,s,[i])),e=(0,r.cY)(e,s,o.id,{...l,...o,previousLocalId:i});const d=(0,c.hj)(e,s,o.id);e=ce(e,s,d);const u=(0,c.Db)(e,s,o);null!=u&&u.threadInfo&&(t.markMessageListRead({maxId:o.id}),e=(0,r.pf)(e,s,u.threadInfo.threadId,"threadInfo",{...u.threadInfo,lastMessageId:o.id,lastReadInboxMessageId:o.id})),(0,a.R3)(e);break}case"updateScheduledMessageSendSucceeded":{const{chatId:t,localId:s,message:i}=n,l=(0,c.qy)(e,t)||[];e=(0,r.pf)(e,t,o._f,"scheduledIds",[...l,i.id]);const d=(0,c.Tm)(e,t,s);e=(0,r.bV)(e,t,[s]),e=(0,r.P4)(e,t,i.id,{...d,...i,previousLocalId:s}),(0,a.R3)(e);break}case"updatePinnedIds":{const{chatId:t,isPinned:s,messageIds:i}=n,l=(0,c.KB)(e,t)||[],d=s?[...l,...i].sort(((e,t)=>t-e)):l.filter((e=>!i.includes(e)));(0,a.R3)((0,r.pf)(e,t,o._f,"pinnedIds",d));break}case"updateThreadInfo":{const{chatId:t,threadId:s,threadInfo:i,firstMessageId:o}=n,l={...(0,c.tZ)(e,t,s),...i};if(!l.threadId)return;e=(0,r.Xg)(e,t,s,l),o&&(e=(0,r.pf)(e,t,s,"firstMessageId",o)),(0,a.R3)(e);break}case"resetMessages":{const{id:s}=n,i=(0,c.Zw)(e,s);i&&!(0,d.YC)(s)&&(e=(0,r.K4)(e,s,Object.keys(i).map(Number)),(0,a.R3)(e),t.loadFullChat({chatId:s,force:!0}));break}case"deleteMessages":{const{ids:a,chatId:s}=n;de(s,a,t,e);break}case"deleteScheduledMessages":{const{ids:t,chatId:s}=n;!function(e,t,n,s){e&&(t.forEach((t=>{s=(0,r.P4)(s,e,t,{isDeleting:!0})})),(0,a.R3)(s),setTimeout((()=>{s=(0,r.bV)((0,a.Rd)(),e,t);const n=(0,c.Fn)(s,e);s=(0,r.pf)(s,e,o._f,"scheduledIds",Object.keys(n||{}).map(Number)),(0,a.R3)(s)}),se))}(s,t,0,e);break}case"deleteHistory":{const{chatId:a}=n,s=e.messages.byChatId[a];s?de(a,Object.keys(s.byId).map(Number),t,e):t.requestChatUpdate({chatId:a});break}case"updateCommonBoxMessages":{const{ids:t,messageUpdate:s}=n;t.forEach((t=>{const n=(0,c.X5)(e,t);n&&(e=(0,r.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,r.cY)(e,t,n,i)})),(0,a.R3)(e);break}case"updateMessagePoll":{const{pollId:t,pollUpdate:s}=n,i=(0,c.ZB)(e,t);if(null!=i&&i.content.poll){const t={...i.content.poll,...s},{results:n}=t.results||{};if(n&&!n.some((e=>e.isChosen))){const{results:e}=i.content.poll.results,a=e&&e.filter((e=>e.isChosen));a&&a.forEach((e=>{const a=n.findIndex((t=>t.option===e.option));a>=0&&(t.results.results[a].isChosen=!0)}))}(0,a.R3)((0,r.cY)(e,i.chatId,i.id,{content:{...i.content,poll:t}}))}break}case"updateMessagePollVote":{const{pollId:t,userId:s,options:i}=n,o=(0,c.ZB)(e,t);if(!o||!o.content.poll||!o.content.poll.results)break;const{poll:l}=o.content,{recentVoterIds:d,totalVoters:u,results:m}=l.results,h=d?[...d]:[],g=u?u+1:1,f=m?[...m]:[];h.push(s),i.forEach((t=>{const n=f.find((e=>e.option===t)),a=f.findIndex((e=>e.option===t)),i=n?{...n}:{option:t,votersCount:0};i.votersCount+=1,s===e.currentUserId&&(i.isChosen=!0),a?f[a]=i:f.push(i)})),(0,a.R3)((0,r.cY)(e,o.chatId,o.id,{content:{...o.content,poll:{...l,results:{...l.results,recentVoterIds:h,totalVoters:g,results:f}}}}));break}case"updateServiceNotification":{const{message:a}=n;(0,c.UW)(e)&&t.createServiceNotification({message:a});break}case"updateMessageReactions":{const{chatId:t,id:s,reactions:i}=n,o=(0,c.hj)(e,t,s),l=(0,c.Z1)(e,n.chatId),u=null==o?void 0:o.reactions;if(u&&ae(i,u))return;const m=(0,d.lb)(u,i,e.currentUserId);if(e=(0,r.cY)(e,t,s,{reactions:n.reactions}),m){const n=(0,c.hj)(e,t,s);if(!l||!n)return;(0,ne.rh)({chat:l,message:n,isReaction:!0})}(0,a.R3)(e);break}}}));const ue=(0,E.P2)((function(){const e=(0,a.Rd)();(0,a.R3)((0,r.ps)(e,{...e.users.statusesById,...me})),me={}}),3e3,!0);let me={};(0,a.iw)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"deleteContact":return(0,r.GK)(e,n.id);case"updateUser":return(0,r.Nq)(e,n.id,n.user);case"updateUserStatus":return a=n.userId,s=n.status,me[a]=s,void ue();case"updateUserFullInfo":{const{id:t,fullInfo:a}=n,s=e.users.byId[t];if(!s)return;return(0,r.Nq)(e,t,{fullInfo:{...s.fullInfo,...a}})}}var a,s})),(0,a.iw)("apiUpdate",((e,t,n)=>{if("updateStickerSet"===n["@type"])return(0,r.Rg)(e,n.id,n.stickerSet)})),(0,a.iw)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"updatePeerBlocked":return n.isBlocked?(0,r.O4)((0,a.Rd)(),n.id):(0,r.rB)((0,a.Rd)(),n.id);case"updateResetContactList":(0,a.R3)({...(0,a.Rd)(),contactList:{userIds:[]}});break;case"updateFavoriteStickers":t.loadFavoriteStickers();break;case"updatePrivacy":e.settings.privacy[n.key]=n.rules;break;case"updatePaymentVerificationNeeded":e=(0,r.fS)((0,a.Rd)(),n.url),e=(0,r.Q$)(e,m.KB.ConfirmPayment),(0,a.R3)(e)}})),(0,a.iw)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"updateNotifySettings":return(0,r.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,r.a4)(e,t,{isMuted:s})),(0,a.R3)((0,r.aK)(e,t,{isMuted:s,isSilent:i,shouldShowPreviews:o}));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 he=n(8958);(0,a.iw)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"updateGroupCall":return"discarded"===n.call.connectionState?e.groupCalls.activeGroupCallId?void t.leaveGroupCall({shouldRemove:!0}):(0,he.dc)(e,n.call.id):(0,he.AH)(e,n.call.id,(0,g.CE)(n.call,["connectionState"]),void 0,n.call.participantsCount);case"updateGroupCallChatId":{const t=(0,c.Z1)(e,n.chatId);return t&&(e=(0,r.a4)(e,n.chatId,{fullInfo:{...t.fullInfo,groupCallId:n.call.id}})),e}case"updateGroupCallParticipants":{const{groupCallId:t,participants:s,nextOffset:i}=n,{currentUserId:o}=e;return e=(0,a.Rd)(),s.forEach((n=>{n.id&&(e=(0,he.B6)(e,t,n.id,n,Boolean(i)||o===n.id))})),i&&(e=(0,he.AH)(e,t,{nextOffset:i})),e}}})),(0,a.iw)("apiUpdate",((e,t,n)=>{if("updatePaymentStateCompleted"===n["@type"])return(0,r.bp)(e)}));var ge=n(8674),fe=n(6752),pe=n(1279),ve=n(3551),Ie=n(3227),ye=n(1212),we=n(5332);function Ze(e){(0,i.d4)((()=>(0,E.Gq)(e)),[e])}var Pe=n(9290);const Ce=document.querySelector('meta[name="viewport"]'),be=(null==Ce?void 0:Ce.getAttribute("content"))||"",Se="width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover";function Ee(e){e.preventDefault()}var Me=n(6590),Re=n(4851),ke=n(2155),Ne=n(5616),Te=n(7358);const Ae=(0,i.X$)((e=>{let{isForAppBadge:t}=e;(0,Ne.yi)();const n=(0,D.xW)();if((0,i.d4)((()=>{t&&(0,Te.w)(n)}),[t,n]),!t&&n)return i.ZP.createElement("div",{className:"unread-count active"},(0,ke.bi)(n))}));var Be=n(3989),xe=n(7529),Le=n(3455),Oe=n(706),Ue=n(2255),Fe=n(9107),De=n(7370),$e=n(7926),qe=n(1622);let je;function Ge(e,t,n,a,s,o){let r,c,l;return r=function(){const[e,t]=(0,i.eJ)(window.navigator.onLine);return(0,i.d4)((()=>{function e(){t(window.navigator.onLine)}return window.addEventListener("online",e),window.addEventListener("offline",e),()=>{window.removeEventListener("offline",e),window.removeEventListener("online",e)}}),[]),e}()&&"connectionStateConnecting"!==t?n?je.syncing:je.online:je.waitingForNetwork,c=r===je.online||o?"none":a?"middleHeader":s?"minimized":"overlay",r===je.waitingForNetwork?l=e("WaitingForNetwork"):r===je.syncing&&(l=e("Updating")),"middleHeader"===c&&(l=l.toLowerCase().replace(/\.+$/,"")),{connectionStatus:r,connectionStatusPosition:c,connectionStatusText:l}}!function(e){e[e.waitingForNetwork=0]="waitingForNetwork",e[e.syncing=1]="syncing",e[e.online=2]="online"}(je||(je={}));var He=n(3106),_e=n(8964),ze=n(231),Ve=n(9589),Ke=n(9187),Xe=n(3321),We=n(126),Ye=n(9204);const Je=(0,i.X$)((e=>{let{connectionStatus:t,connectionStatusText:n,onClick:a}=e;const s=(0,Fe.Z)();return i.ZP.createElement("div",{id:"ConnectionStatusOverlay",dir:s.isRtl?"rtl":void 0,onClick:a},i.ZP.createElement(Ye.Z,{color:"black"}),i.ZP.createElement("div",{className:"state-text"},i.ZP.createElement(Ue.Z,{activeKey:t,name:"slide-fade"},n)),i.ZP.createElement(ze.Z,{round:!0,size:"tiny",color:"translucent-black"},i.ZP.createElement("span",{className:"icon-close"})))})),Qe=(0,i.X$)((0,a.c$)((e=>{const{query:t,fetchingStatus:n,chatId:a,date:s}=e.globalSearch,{currentUserId:i,connectionState:o,isSyncing:r}=e,{byId:l}=e.chats,{isConnectionStatusMinimized:d,animationLevel:u}=e.settings.byKey;return{searchQuery:t,isLoading:!!n&&Boolean(n.chats||n.messages),currentUserId:i,chatsById:l,globalSearchChatId:a,searchDate:s,theme:(0,c.Pu)(e),animationLevel:u,connectionState:o,isSyncing:r,isMessageListOpen:Boolean((0,c.Bt)(e)),isConnectionStatusMinimized:d,areChatsLoaded:Boolean(e.chats.listIds.active)}}))((e=>{let{content:t,contactsFilter:n,onSearchQuery:o,onSelectSettings:r,onSelectContacts:c,onSelectArchived:l,onReset:u,searchQuery:g,isLoading:f,shouldSkipTransition:p,currentUserId:v,globalSearchChatId:I,searchDate:y,theme:w,animationLevel:Z,chatsById:P,connectionState:C,isSyncing:b,isMessageListOpen:S,isConnectionStatusMinimized:E,areChatsLoaded:M}=e;const{openChat:R,openTipsChat:k,setGlobalSearchDate:N,setSettingOption:T,setGlobalSearchChatId:A}=(0,a.Sv)(),B=(0,Fe.Z)(),x=t===m.du.ChatList,O=(0,i.Ye)((()=>y?(0,L.xH)(new Date(1e3*y)):void 0),[y]),U=(0,i.Ye)((()=>x&&P?Object.values(P).reduce(((e,t)=>(0,d.pE)(t)&&t.unreadCount?e+1:e),0):0),[x,P]),{connectionStatus:F,connectionStatusText:D,connectionStatusPosition:$}=Ge(B,C,b,S,E,!M),q="web.telegram.org"===window.location.hostname,j=(0,i.Ye)((()=>e=>{let{onTrigger:t,isOpen:n}=e;return i.ZP.createElement(ze.Z,{round:!0,ripple:x&&!h.wB,size:"smaller",color:"translucent",className:n?"active":"",onClick:x?t:()=>u(),ariaLabel:x?B("AccDescrOpenMenu2"):"Return to chat list"},i.ZP.createElement("div",{className:(0,fe.Z)("animated-menu-icon",!x&&"state-back",p&&"no-animation")}))}),[x,B,u,p]),G=(0,i.I4)((()=>{g||o("")}),[g,o]),H=(0,i.I4)((()=>{T({isConnectionStatusMinimized:!E})}),[E,T]),_=(0,i.I4)((()=>{R({id:v,shouldReplaceHistory:!0})}),[v,R]),z=(0,i.I4)((e=>{e.stopPropagation();const t="light"===w?"dark":"light";T({theme:t}),T({shouldUseSystemTheme:!1}),(0,De.Z)(t,Z===s.zy)}),[Z,T,w]),V=(0,i.I4)((()=>{(0,$e.L)("K"),(0,qe.W8)(),(0,Me.Wv)()}),[]),K=(0,i.I4)((()=>{k({langCode:B.code})}),[B.code,k]),X=Boolean(I)||t===m.du.GlobalSearch||t===m.du.Contacts,W=t===m.du.Contacts?B("SearchFriends"):B("Search");return i.ZP.createElement("div",{className:"LeftMainHeader"},i.ZP.createElement("div",{id:"LeftMainHeader",className:"left-header"},i.ZP.createElement(He.Z,{trigger:j,footer:`${s.iC} ${s.eM?"master":s.Ji}`},i.ZP.createElement(_e.Z,{icon:"saved-messages",onClick:_},B("SavedMessages")),i.ZP.createElement(_e.Z,{icon:"archive",onClick:l},i.ZP.createElement("span",{className:"menu-item-name"},B("ArchivedChats")),U>0&&i.ZP.createElement("div",{className:"archived-badge"},U)),i.ZP.createElement(_e.Z,{icon:"user",onClick:c},B("Contacts")),i.ZP.createElement(_e.Z,{icon:"settings",onClick:r},B("Settings")),i.ZP.createElement(_e.Z,{icon:"darkmode",onClick:z},i.ZP.createElement("span",{className:"menu-item-name"},B("lng_menu_night_mode")),i.ZP.createElement(Xe.Z,{id:"darkmode",label:B("dark"===w?"lng_settings_disable_night_theme":"lng_settings_enable_night_theme"),checked:"dark"===w,noAnimation:!0})),i.ZP.createElement(_e.Z,{icon:"help",onClick:K},B("TelegramFeatures")),i.ZP.createElement(_e.Z,{icon:"bug",href:s.mU},"Report Bug"),q&&i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement(_e.Z,{icon:"char-K",href:"https://web.telegram.org/k/",onClick:V},"Switch to K Version"),i.ZP.createElement(_e.Z,{icon:"char-W",href:"https://web.telegram.org/?legacy=1",onClick:Me.Wv},"Switch to Old Version"))),i.ZP.createElement(Ve.Z,{inputId:"telegram-search-input",parentContainerClassName:"LeftSearch",className:I||y?"with-picker-item":"",value:n||g,focused:X,isLoading:f||"minimized"===$,spinnerColor:"minimized"===$?"yellow":void 0,spinnerBackgroundColor:"minimized"===$&&"light"===w?"light":void 0,placeholder:W,autoComplete:"off",canClose:Boolean(I||y),onChange:o,onReset:u,onFocus:G,onSpinnerClick:"minimized"===$?H:void 0},O&&i.ZP.createElement(Ke.Z,{icon:"calendar",title:O,canClose:!0,isMinimized:Boolean(I),className:"search-date",onClick:N,clickArg:{date:void 0}}),I&&i.ZP.createElement(Ke.Z,{chatOrUserId:I,onClick:A,canClose:!0,clickArg:{id:void 0}})),i.ZP.createElement(We.Z,{isOpen:"overlay"===$,isCustom:!0,className:"connection-state-wrapper"},i.ZP.createElement(Je,{connectionStatus:F,connectionStatusText:D,onClick:H}))))})));var et=n(1174),tt=n(3133),nt=n(1080);const at=(0,i.X$)((0,a.c$)((e=>{const{chatFolders:{byId:t,orderedIds:n,activeChatFolder:a},currentUserId:s,lastSyncTime:i,shouldSkipHistoryAnimations:o}=e;return{chatFoldersById:t,orderedFolderIds:n,activeChatFolder:a,currentUserId:s,lastSyncTime:i,shouldSkipHistoryAnimations:o}}))((e=>{let{foldersDispatch:t,onScreenSelect:n,chatFoldersById:o,orderedFolderIds:r,activeChatFolder:c,currentUserId:l,lastSyncTime:d,shouldSkipHistoryAnimations:u}=e;const{loadChatFolders:m,setActiveChatFolder:g,openChat:f}=(0,a.Sv)(),p=(0,i.sO)(null),v=(0,Fe.Z)();(0,i.d4)((()=>{d&&m()}),[d,m]);const I=(0,i.Ye)((()=>r?r.map((e=>o[e]||{})).filter(Boolean):void 0),[o,r]),y=(0,Ne.yi)(),w=(0,i.Ye)((()=>{if(I&&I.length)return[{id:s.Nf,title:"en"===v.code?"All":v("FilterAllChats")},...I.map((e=>{var t,n;let{id:a,title:s}=e;return{id:a,title:s,badgeCount:null===(t=y[a])||void 0===t?void 0:t.chatsCount,isBadgeActive:Boolean(null===(n=y[a])||void 0===n?void 0:n.notificationsCount)}}))]}),[I,y,v]),Z=(0,i.I4)((e=>{g(e,{forceOnHeavyAnimation:!0})}),[g]);(0,i.d4)((()=>{w&&w.length&&c>=w.length&&g(0)}),[c,w,g]),(0,i.d4)((()=>{if(p.current&&h.$b&&w&&w.length)return(0,et.sf)(p.current,{selectorToPreventScroll:".chat-list",onSwipe:(e,t)=>t===et.eM.Left?(g(Math.min(c+1,w.length-1),{forceOnHeavyAnimation:!0}),!0):t===et.eM.Right&&(g(Math.max(0,c-1),{forceOnHeavyAnimation:!0}),!0)})}),[c,w,g]);const P=(0,i.sO)();P.current=0!==c,(0,i.d4)((()=>P.current?(0,Be.Z)((()=>{P.current&&g(0)})):void 0),[c,g]),(0,Me.ZP)(0!==c,(()=>g(0,{forceOnHeavyAnimation:!0}))),(0,i.d4)((()=>{const e=e=>{if(e.ctrlKey&&e.shiftKey&&e.code.startsWith("Digit")&&w){const[,t]=e.code.match(/Digit(\d)/)||[];if(!t)return;if("0"===t)return void f({id:l,shouldReplaceHistory:!0});const n=Number(t)-1;if(n>w.length-1)return;g(n,{forceOnHeavyAnimation:!0}),e.preventDefault()}};return document.addEventListener("keydown",e,!0),()=>{document.removeEventListener("keydown",e,!0)}}));const{shouldRender:C,transitionClassNames:b}=(0,ye.Z)(!r,void 0,!0);function S(e){const a=Object.values(o).find((e=>{let{id:t}=e;return t===w[c].id}));return a&&0!==c?i.ZP.createElement(nt.Z,{folderType:"folder",folderId:a.id,isActive:e,lastSyncTime:d,onScreenSelect:n,foldersDispatch:t}):i.ZP.createElement(nt.Z,{folderType:"all",isActive:e,lastSyncTime:d,foldersDispatch:t,onScreenSelect:n})}return i.ZP.createElement("div",{className:"ChatFolders"},null!=w&&w.length?i.ZP.createElement(tt.Z,{tabs:w,activeTab:c,onSwitchTab:Z}):C?i.ZP.createElement("div",{className:(0,fe.Z)("tabs-placeholder",b)}):void 0,i.ZP.createElement(Ue.Z,{ref:p,name:u?"none":v.isRtl?"slide-optimized-rtl":"slide-optimized",activeKey:c,renderCount:w?w.length:void 0},S))})));var st=n(9203),it=n(8778),ot=n(4288);const rt=(0,i.X$)((e=>{const t=(0,it.Z)(st.gl.Extra,"LeftSearch");return t?i.ZP.createElement(t,e):i.ZP.createElement(ot.Z,null)})),ct=(0,i.X$)((e=>{const t=(0,it.Z)(st.gl.Extra,"ContactList");return t?i.ZP.createElement(t,e):i.ZP.createElement(ot.Z,null)}));var lt=n(2328);const dt=(0,i.X$)((e=>{let{isShown:t,onNewPrivateChat:n,onNewChannel:a,onNewGroup:s}=e;const[o,r]=(0,i.eJ)(!1);(0,i.d4)((()=>{t||r(!1)}),[t]);const c=(0,Fe.Z)(),l=(0,fe.Z)("NewChatButton",t&&"revealed",o&&"menu-is-open"),d=(0,i.I4)((()=>{r(!o)}),[o]),u=(0,i.I4)((()=>{r(!1)}),[]);return i.ZP.createElement("div",{className:l},i.ZP.createElement(ze.Z,{round:!0,color:"primary",className:o?"active":"",onClick:d,ariaLabel:c(o?"Close":"NewMessageTitle"),tabIndex:-1},i.ZP.createElement("i",{className:"icon-new-chat-filled"}),i.ZP.createElement("i",{className:"icon-close"})),i.ZP.createElement(lt.Z,{isOpen:o,positionX:"right",positionY:"bottom",autoClose:!0,onClose:u},i.ZP.createElement(_e.Z,{icon:"channel",onClick:a},c("NewChannel")),i.ZP.createElement(_e.Z,{icon:"group",onClick:s},c("NewGroup")),i.ZP.createElement(_e.Z,{icon:"user",onClick:n},c("NewMessageTitle"))))})),ut=Object.keys(m.du).length/2;let mt;const ht=(0,i.X$)((e=>{let{content:t,searchQuery:n,searchDate:a,contactsFilter:s,shouldSkipTransition:o,foldersDispatch:r,onSearchQuery:c,onContentChange:l,onScreenSelect:d,onReset:u}=e;const[g,f]=(0,i.eJ)(h.$b),p=(0,i.sO)(!1),v=(0,i.I4)((()=>{l(m.du.Settings)}),[l]),I=(0,i.I4)((()=>{l(m.du.Contacts)}),[l]),y=(0,i.I4)((()=>{l(m.du.NewChannelStep1)}),[l]),w=(0,i.I4)((()=>{l(m.du.NewGroupStep1)}),[l]),Z=(0,i.I4)((()=>{l(m.du.Archived)}),[l]),P=(0,i.I4)((()=>{t===m.du.ChatList&&(p.current=!0,f(!0))}),[t]),C=(0,i.I4)((()=>{p.current=!1,mt&&(clearTimeout(mt),mt=void 0),mt=window.setTimeout((()=>{p.current||f(!1)}),250)}),[]);(0,i.d4)((()=>{let e;return t!==m.du.ChatList?e=window.setTimeout((()=>{f(!1)}),250):(p.current||h.$b)&&f(!0),()=>{e&&(clearTimeout(e),e=void 0)}}),[t]);const[b,S,E]=function(){const[e,t]=(0,Oe.Z)(!1);(0,i.d4)((()=>{const e=window.setTimeout(t,2592e5);return()=>{clearTimeout(e)}}),[t]);const{shouldRender:n,transitionClassNames:a}=(0,ye.Z)(e);return[n,a,()=>{window.location.reload()}]}(),M=(0,Fe.Z)();return i.ZP.createElement("div",{id:"LeftColumn-main",onMouseEnter:h.$b?void 0:P,onMouseLeave:h.$b?void 0:C},i.ZP.createElement(Qe,{content:t,contactsFilter:s,onSearchQuery:c,onSelectSettings:v,onSelectContacts:I,onSelectArchived:Z,onReset:u,shouldSkipTransition:o}),i.ZP.createElement(Ue.Z,{name:o?"none":"zoom-fade",renderCount:ut,activeKey:t,shouldCleanup:!0,cleanupExceptionKey:m.du.ChatList},(e=>{switch(t){case m.du.ChatList:return i.ZP.createElement(at,{onScreenSelect:d,foldersDispatch:r});case m.du.GlobalSearch:return i.ZP.createElement(rt,{searchQuery:n,searchDate:a,isActive:e,onReset:u});case m.du.Contacts:return i.ZP.createElement(ct,{filter:s,isActive:e,onReset:u});default:return}})),b&&i.ZP.createElement(ze.Z,{fluid:!0,pill:!0,className:(0,fe.Z)("btn-update",S),onClick:E},M("lng_update_telegram")),i.ZP.createElement(dt,{isShown:g,onNewPrivateChat:I,onNewChannel:y,onNewGroup:w}))})),gt=(0,i.X$)((e=>{const t=(0,it.Z)(st.gl.Extra,"Settings");return t?i.ZP.createElement(t,e):i.ZP.createElement(ot.Z,null)})),ft=(0,i.X$)((e=>{const t=(0,it.Z)(st.gl.Extra,"NewChat");return t?i.ZP.createElement(t,e):i.ZP.createElement(ot.Z,null)})),pt=(0,i.X$)((e=>{const t=(0,it.Z)(st.gl.Extra,"ArchivedChats");return t?i.ZP.createElement(t,e):i.ZP.createElement(ot.Z,null)}));var vt;!function(e){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"}(vt||(vt={}));const It=Object.keys(vt).length/2,yt=(0,i.X$)((0,a.c$)((e=>{const{globalSearch:{query:t,date:n},chatFolders:{activeChatFolder:a},shouldSkipHistoryAnimations:s,leftColumnWidth:i}=e;return{searchQuery:t,searchDate:n,activeChatFolder:a,shouldSkipHistoryAnimations:s,leftColumnWidth:i}}))((e=>{let{searchQuery:t,searchDate:n,activeChatFolder:s,shouldSkipHistoryAnimations:o,leftColumnWidth:r}=e;const{setGlobalSearchQuery:c,setGlobalSearchChatId:l,resetChatCreation:d,setGlobalSearchDate:u,loadPasswordInfo:g,clearTwoFaError:f,setLeftColumnWidth:p,resetLeftColumnWidth:v}=(0,a.Sv)(),I=(0,i.sO)(null),[y,w]=(0,i.eJ)(m.du.ChatList),[Z,P]=(0,i.eJ)(m.MT.Main),[C,b]=(0,i.eJ)(""),[S,E]=(0,Le.ZP)(),[M,R]=(0,i.eJ)(0);let k=vt.Main;switch(y){case m.du.Archived:k=vt.Archived;break;case m.du.Settings:k=vt.Settings;break;case m.du.NewChannelStep1:case m.du.NewChannelStep2:k=vt.NewChannel;break;case m.du.NewGroupStep1:case m.du.NewGroupStep2:k=vt.NewGroup}const N=(0,i.I4)((e=>{if(y!==m.du.NewGroupStep2||e)if(y!==m.du.NewChannelStep2||e){if(y===m.du.NewGroupStep1){const e=document.getElementById("new-group-picker-search");e&&e.blur()}if(y===m.du.Settings)switch(Z){case m.MT.EditProfile:case m.MT.Folders:case m.MT.General:case m.MT.Notifications:case m.MT.DataStorage:case m.MT.Privacy:case m.MT.ActiveSessions:case m.MT.Language:return void P(m.MT.Main);case m.MT.GeneralChatBackground:case m.MT.QuickReaction:return void P(m.MT.General);case m.MT.GeneralChatBackgroundColor:return void P(m.MT.GeneralChatBackground);case m.MT.PrivacyPhoneNumber:case m.MT.PrivacyLastSeen:case m.MT.PrivacyProfilePhoto:case m.MT.PrivacyForwarding:case m.MT.PrivacyGroupChats:case m.MT.PrivacyBlockedUsers:case m.MT.TwoFaDisabled:case m.MT.TwoFaEnabled:case m.MT.TwoFaCongratulations:return void P(m.MT.Privacy);case m.MT.PrivacyPhoneNumberAllowedContacts:case m.MT.PrivacyPhoneNumberDeniedContacts:return void P(m.MT.PrivacyPhoneNumber);case m.MT.PrivacyLastSeenAllowedContacts:case m.MT.PrivacyLastSeenDeniedContacts:return void P(m.MT.PrivacyLastSeen);case m.MT.PrivacyProfilePhotoAllowedContacts:case m.MT.PrivacyProfilePhotoDeniedContacts:return void P(m.MT.PrivacyProfilePhoto);case m.MT.PrivacyForwardingAllowedContacts:case m.MT.PrivacyForwardingDeniedContacts:return void P(m.MT.PrivacyForwarding);case m.MT.PrivacyGroupChatsAllowedContacts:case m.MT.PrivacyGroupChatsDeniedContacts:return void P(m.MT.PrivacyGroupChats);case m.MT.TwoFaNewPassword:return void P(m.MT.TwoFaDisabled);case m.MT.TwoFaNewPasswordConfirm:return void P(m.MT.TwoFaNewPassword);case m.MT.TwoFaNewPasswordHint:return void P(m.MT.TwoFaNewPasswordConfirm);case m.MT.TwoFaNewPasswordEmail:return void P(m.MT.TwoFaNewPasswordHint);case m.MT.TwoFaNewPasswordEmailCode:return void P(m.MT.TwoFaNewPasswordEmail);case m.MT.TwoFaChangePasswordCurrent:case m.MT.TwoFaTurnOff:case m.MT.TwoFaRecoveryEmailCurrentPassword:return void P(m.MT.TwoFaEnabled);case m.MT.TwoFaChangePasswordNew:return void P(m.MT.TwoFaChangePasswordCurrent);case m.MT.TwoFaChangePasswordConfirm:return void P(m.MT.TwoFaChangePasswordNew);case m.MT.TwoFaChangePasswordHint:return void P(m.MT.TwoFaChangePasswordConfirm);case m.MT.TwoFaRecoveryEmail:return void P(m.MT.TwoFaRecoveryEmailCurrentPassword);case m.MT.TwoFaRecoveryEmailCode:return void P(m.MT.TwoFaRecoveryEmail);case m.MT.FoldersCreateFolder:case m.MT.FoldersEditFolder:return void P(m.MT.Folders);case m.MT.FoldersIncludedChatsFromChatList:case m.MT.FoldersExcludedChatsFromChatList:return void P(m.MT.FoldersEditFolderFromChatList);case m.MT.FoldersEditFolderFromChatList:return w(m.du.ChatList),void P(m.MT.Main)}y!==m.du.ChatList||0!==s?(w(m.du.ChatList),b(""),c({query:""}),u({date:void 0}),l({id:void 0}),d(),setTimeout((()=>{R(Date.now())}),250)):w(m.du.GlobalSearch)}else w(m.du.NewChannelStep1);else w(m.du.NewGroupStep1)}),[y,s,Z,c,u,l,d]),T=(0,i.I4)((e=>{y!==m.du.Contacts?(w(m.du.GlobalSearch),e!==t&&c({query:e})):b(e)}),[y,t,c]);(0,i.d4)((()=>y!==m.du.ChatList||0===s?(0,Be.Z)((()=>N())):void 0),[s,y,N]),(0,i.d4)((()=>{if(y!==m.du.GlobalSearch)return document.addEventListener("keydown",e,!1),()=>{document.removeEventListener("keydown",e,!1)};function e(e){(h.jm&&e.metaKey||!h.jm&&e.ctrlKey)&&e.shiftKey&&"f"===(0,xe.Z)(e)&&(e.preventDefault(),w(m.du.GlobalSearch))}}),[y]),(0,i.d4)((()=>{f(),Z===m.MT.Privacy&&g()}),[f,g,Z]);const{initResize:A,resetResize:B,handleMouseUp:x}=function(e,t,n,a){const[s,o,r]=(0,Oe.Z)(),[c,l]=(0,i.eJ)(),[d,u]=(0,i.eJ)();function m(){document.body.classList.remove("cursor-ew-resize")}return(0,i.d4)((()=>{e.current&&a&&(e.current.style.width=`${a}px`)}),[e,a]),(0,i.d4)((()=>{if(!s)return;const n=t=>{const n=Math.ceil(d+t.clientX-c);e.current.style.width=`${n}px`};function a(){i(),t(e.current.offsetWidth)}function i(){m(),document.removeEventListener("mousemove",n,!1),document.removeEventListener("mouseup",a,!1),document.removeEventListener("blur",a,!1),r()}return document.addEventListener("mousemove",n,!1),document.addEventListener("mouseup",a,!1),document.addEventListener("blur",a,!1),i}),[d,c,e,t,s,r]),{initResize:function(t){t.preventDefault(),document.body.classList.add("cursor-ew-resize"),l(t.clientX),u(e.current.offsetWidth),o()},resetResize:function(t){t.preventDefault(),e.current.style.width="",n()},handleMouseUp:m}}(I,p,v,r),L=(0,i.I4)((e=>{w(m.du.Settings),P(e)}),[]);return i.ZP.createElement("div",{id:"LeftColumn",ref:I},i.ZP.createElement(Ue.Z,{name:o?"none":h.s0,renderCount:It,activeKey:k,shouldCleanup:!0,cleanupExceptionKey:vt.Main},(e=>{switch(k){case vt.Archived:return i.ZP.createElement(pt,{isActive:e,onReset:N,onContentChange:w});case vt.Settings:return i.ZP.createElement(gt,{isActive:e,currentScreen:Z,foldersState:S,foldersDispatch:E,onScreenSelect:L,onReset:N,shouldSkipTransition:o});case vt.NewChannel:return i.ZP.createElement(ft,{key:M,isActive:e,isChannel:!0,content:y,onContentChange:w,onReset:N});case vt.NewGroup:return i.ZP.createElement(ft,{key:M,isActive:e,content:y,onContentChange:w,onReset:N});default:return i.ZP.createElement(ht,{content:y,searchQuery:t,searchDate:n,contactsFilter:C,foldersDispatch:E,onContentChange:w,onSearchQuery:T,onScreenSelect:L,onReset:N,shouldSkipTransition:o})}})),i.ZP.createElement("div",{className:"resize-handle",onMouseDown:A,onMouseUp:x,onDoubleClick:B}))})));var wt=n(2420),Zt=n(5780),Pt=n(9524),Ct=n(1394);const bt=()=>{const[e,t]=(0,i.eJ)(Q.Z.get());return(0,i.d4)((()=>{const e=(0,E.P2)((()=>{t(Q.Z.get())}),250,!1);return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]),e};var St=n(2678),Et=n(7204),Mt=n(5326),Rt=n(3570),kt=n(5790),Nt=n(8360),Tt=n(6058),At=n(8799);const Bt=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,it.Z)(st.gl.Extra,"HeaderMenuContainer",!t);return n?i.ZP.createElement(n,e):void 0})),xt=(0,i.X$)((0,a.c$)(((e,t)=>{var n,a,s;let{chatId:i,threadId:r,messageListType:l}=t;const u=(0,c.Z1)(e,i),m=Boolean(u&&(0,d.eA)(u));if(!u||u.isRestricted||(0,c.CA)(e))return{noMenu:!0};const g=(0,c.IK)(e,i),f=(0,c.FM)(e,i),p="thread"===l&&r===o._f,v="thread"===l&&r!==o._f,I=(0,c.Jf)(e),y=Boolean(g&&(0,c.s4)(e,g.id)),w=!y&&Boolean((0,c.pk)(e,i)),Z=Boolean(p&&(m||(0,d.ZV)(u))&&u.isNotJoined),P=p||v,C=h.Bi&&(0,d.YC)(u.id)&&!f&&!g,b=p&&!f&&!Z,S=p&&!Z,E=h.Bi&&u.isCallActive,M=h.Bi&&!u.isCallActive&&((null===(n=u.adminRights)||void 0===n?void 0:n.manageCall)||u.isCreator&&(0,d.G9)(u));return{noMenu:!1,isChannel:m,isRightColumnShown:I,canStartBot:w,canRestartBot:y,canSubscribe:Z,canSearch:P,canCall:C,canMute:b,canViewStatistics:null===(a=u.fullInfo)||void 0===a?void 0:a.canViewStatistics,canLeave:S,canEnterVoiceChat:E,canCreateVoiceChat:M,pendingJoinRequests:null===(s=u.fullInfo)||void 0===s?void 0:s.requestsPending}}))((e=>{let{chatId:t,threadId:n,noMenu:s,isChannel:o,canStartBot:r,canRestartBot:c,canSubscribe:l,canSearch:d,canCall:u,canMute:g,canViewStatistics:f,canLeave:p,canEnterVoiceChat:v,canCreateVoiceChat:I,pendingJoinRequests:y,isRightColumnShown:w,canExpandActions:Z}=e;const{joinChannel:P,sendBotCommand:C,openLocalTextSearch:b,restartBot:S,openCallFallbackConfirm:E,requestNextManagementScreen:M}=(0,a.Sv)(),R=(0,i.sO)(null),[k,N]=(0,i.eJ)(!1),[T,A]=(0,i.eJ)(void 0),B=(0,i.I4)((()=>{N(!0);const e=R.current.getBoundingClientRect();A({x:e.right,y:e.bottom})}),[]),x=(0,i.I4)((()=>{N(!1)}),[]),L=(0,i.I4)((()=>{A(void 0)}),[]),O=(0,i.I4)((()=>{P({chatId:t})}),[P,t]),U=(0,i.I4)((()=>{C({command:"/start"})}),[C]),F=(0,i.I4)((()=>{S({chatId:t})}),[t,S]),D=(0,i.I4)((()=>{M({screen:m.u1.JoinRequests})}),[M]),$=(0,i.I4)((()=>{b(),h.wB?document.querySelector("#MobileSearch input").focus():setTimeout((()=>{const e=document.querySelector(".RightHeader .SearchInput input");e&&e.focus()}),400)}),[b]);(0,i.d4)((()=>{if(d)return document.addEventListener("keydown",e,!1),()=>{document.removeEventListener("keydown",e,!1)};function e(e){h.fl&&(h.jm&&e.metaKey||!h.jm&&e.ctrlKey)&&!e.shiftKey&&"f"===(0,xe.Z)(e)&&(e.preventDefault(),$())}}),[d,$]);const q=(0,Fe.Z)();return i.ZP.createElement("div",{className:"HeaderActions"},!h.wB&&i.ZP.createElement(i.ZP.Fragment,null,Z&&l&&i.ZP.createElement(ze.Z,{size:"tiny",ripple:!0,fluid:!0,onClick:O},q(o?"ProfileJoinChannel":"ProfileJoinGroup")),Z&&r&&i.ZP.createElement(ze.Z,{size:"tiny",ripple:!0,fluid:!0,onClick:U},q("BotStart")),Z&&c&&i.ZP.createElement(ze.Z,{size:"tiny",ripple:!0,fluid:!0,onClick:F},q("BotRestart")),d&&i.ZP.createElement(ze.Z,{round:!0,ripple:w,color:"translucent",size:"smaller",onClick:$,ariaLabel:"Search in this chat"},i.ZP.createElement("i",{className:"icon-search"})),u&&i.ZP.createElement(ze.Z,{round:!0,color:"translucent",size:"smaller",onClick:E,ariaLabel:"Call"},i.ZP.createElement("i",{className:"icon-phone"}))),Boolean(y)&&i.ZP.createElement(ze.Z,{round:!0,className:"badge-button",ripple:w,color:"translucent",size:"smaller",onClick:D,ariaLabel:q(o?"SubscribeRequests":"MemberRequests")},i.ZP.createElement("i",{className:"icon-user"}),i.ZP.createElement("div",{className:"badge"},y)),i.ZP.createElement(ze.Z,{ref:R,className:k?"active":"",round:!0,ripple:!h.wB,size:"smaller",color:"translucent",disabled:s,ariaLabel:"More actions",onClick:B},i.ZP.createElement("i",{className:"icon-more"})),T&&i.ZP.createElement(Bt,{chatId:t,threadId:n,isOpen:k,anchor:T,withExtraActions:h.wB||!Z,isChannel:o,canStartBot:r,canRestartBot:c,canSubscribe:l,canSearch:d,canCall:u,canMute:g,canViewStatistics:f,canLeave:p,canEnterVoiceChat:v,canCreateVoiceChat:I,onSubscribeChannel:O,onSearchClick:$,onClose:x,onCloseAnimationEnd:L}))})));var Lt=n(4399),Ot=n(6202),Ut=n(862);function Ft(e){var t;const n=e&&(0,d.DH)(e),a=null==e||null===(t=e.content)||void 0===t?void 0:t.sticker,o=n&&a&&!(0,h.on)()&&n.includes("image/webp"),[r,c]=(0,i.eJ)(Ut.Hu),l=null==e?void 0:e.id;return(0,i.bt)((()=>{o&&(0,Ut.p6)(`b64-${l}`,n).then(c).catch((e=>{s.eM&&console.error(e)}))}),[l,o,n]),o?r:n}var Dt=n(7551),$t=n(8512),qt=n(996);function jt(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 Gt=(0,i.X$)((e=>{let{count:t,index:n}=e;const a=(0,i.sO)(null),s=(0,i.Ye)((()=>function(e,t){const n=e-t-1,a=function(e){let t=8;return 1===e?t=36:2===e?t=17:3===e?t=11:(4===e||e>3)&&(t=7.5),t}(e),s=function(e,t){let n=36;return 1===e?n=36:2===e?n=17:3===e?n=1===t?12:11:(4===e||e>3)&&(n=7.5),n}(e,n),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=jt(0,0,2,t,1)+jt(0,12,2,t+1,1)+jt(0,25,2,t,1);else for(let e=0;e<n;e++)a+=jt(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),l=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:l,trackHeight:i,clipPathId:o}}(t,n)),[t,n]);if((0,i.d4)((()=>{if(!a.current)return;const{trackHeight:e,trackTranslateY:t,markHeight:n,markTranslateY:i,clipPathId:o,clipPath:r}=s,c=a.current.firstElementChild;if(null!=a&&a.current){const s=a.current,{style:l}=s;l.height=`${e}px`,l.transform=`translateY(-${t}px)`,l.clipPath=`url("#${o}")`;const d=s.querySelector("svg"),u=s.querySelector("div"),m=s.querySelector("defs");d||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 i.ZP.createElement("div",{className:"pinned-message-border"},i.ZP.createElement("div",{className:"pinned-message-border-wrapper-1",ref:a}));const{trackHeight:o,trackTranslateY:r,markHeight:c,markTranslateY:l,clipPathId:d}=s;return i.ZP.createElement("div",{className:(0,fe.Z)("pinned-message-border",t>4&&"pinned-message-border-mask")},i.ZP.createElement("div",{className:"pinned-message-border-wrapper",ref:a,style:`clip-path: url("#${d}"); width: 2px;\n height: ${o}px; transform: translateY(-${r}px);`},i.ZP.createElement("span",null),i.ZP.createElement("div",{className:"pinned-message-border-mark",style:`height: ${c}px; transform: translateY(${l}px);`})))})),Ht=(0,i.X$)((e=>{let{message:t,count:n,index:a,customTitle:s,className:o,onUnpinMessage:r,onClick:c,onAllPinnedClick:l}=e;const u=(0,Fe.Z)(),m=Ft(t),h=(0,Ot.Z)((0,d.Ti)(t,"pictogram")),g=(0,qt.e)(u,t,Boolean(m)),[f,p,v]=(0,Oe.Z)(),I=(0,i.I4)((()=>{v(),r&&r(t.id)}),[v,r,t.id]);return i.ZP.createElement("div",{className:(0,fe.Z)("HeaderPinnedMessage-wrapper",o)},n>1&&i.ZP.createElement(ze.Z,{round:!0,size:"smaller",color:"translucent",className:"pin-list-button",ariaLabel:u("EventLogFilterPinnedMessages"),onClick:l},i.ZP.createElement("i",{className:"icon-pin-list"})),r&&i.ZP.createElement(ze.Z,{round:!0,size:"smaller",color:"translucent",ariaLabel:u("UnpinMessageAlertTitle"),className:"unpin-button",onClick:p},i.ZP.createElement("i",{className:"icon-close"})),i.ZP.createElement(Dt.Z,{isOpen:f,onClose:v,text:"Would you like to unpin this message?",confirmLabel:"Unpin",confirmHandler:I}),i.ZP.createElement("div",{className:"HeaderPinnedMessage",onClick:c,dir:u.isRtl?"rtl":void 0},i.ZP.createElement(Gt,{count:n,index:a}),m&&function(e,t){const{width:n,height:a}=(0,Lt.W7)();return i.ZP.createElement("img",{src:t||e,width:n,height:a,alt:""})}(m,h),i.ZP.createElement("div",{className:"message-text"},i.ZP.createElement("div",{className:"title",dir:"auto"},s||`${u("PinnedMessage")} ${a>0?"#"+(n-a):""}`),i.ZP.createElement("p",{dir:"auto"},g)),i.ZP.createElement($t.Z,null)))}));var _t=n(396),zt=n(4532),Vt=n(3186);function Kt(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=()=>{Xt(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 Xt(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"image/png";if(!("createImageBitmap"in window))return Wt(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!");return await new Promise((e=>{const t=document.createElement("canvas");t.width=s.width,t.height=s.height;const n=t.getContext("bitmaprenderer");n?n.transferFromImageBitmap(s):t.getContext("2d").drawImage(s,0,0),t.toBlob(e,a)}))}catch(s){return Wt(e,t,n,void 0,a)}}function Wt(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);return new Promise((e=>{i.toBlob(e,s)}))}var Yt=n(4524);const Jt={width:200,height:200},Qt=115,en=(e,t,n)=>{const a=(0,Fe.Z)(),{audio:s,voice:o}=(0,d.qp)(e),r=s?s.title||s.fileName:o?"Voice message":"",c=(null==s?void 0:s.performer)||t&&(0,d.OU)(a,t),l=n&&(0,d.U)(a,n)||"Telegram",u=s&&(0,d.MR)(s)&&(0,d.Ti)(e,"pictogram"),m=t&&(0,d.RT)(t,"big"),h=s&&u||o&&m,g=(0,Ot.Z)(h),f=(0,i.Ye)((()=>function(e,t,n){if(!n)return Jt;if(e){var a;if(null===(a=e.thumbnailSizes)||void 0===a||!a.length)return;const t=e.thumbnailSizes.find((e=>"m"===e.type));return t||e.thumbnailSizes[0]}return t?Lt.vY:void 0}(s,o,g)),[s,g,o]),{result:p}=((e,t,n)=>{const[a,s]=(0,i.eJ)(!1),[o,r]=(0,i.eJ)(),[c,l]=(0,i.eJ)(n);return(0,i.d4)((()=>{s(!0);let t=!1;return e().then((e=>{t||(s(!1),l(e))}),(e=>{t||(s(!1),r(e))})),()=>{t=!0}}),t),{isLoading:a,error:o,result:c}})((()=>function(e,t){if(!e)return Promise.resolve(Yt);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=()=>{Xt(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,Qt,Qt);const n=Math.min(t.width,t.height);return n<Qt?Kt(e,Qt/n):Promise.resolve(e)}(g,f)),[g,f],Yt);return(0,i.Ye)((()=>(0,zt.Of)({title:r,artist:c,album:l,artwork:[{src:p}]})),[l,c,r,p])};var tn=n(2340),nn=n(8051);const an=(0,a.c$)(((e,t)=>{let{message:n}=t;const a=(0,c.Ur)(e,n),s=(0,c.Z1)(e,n.chatId),{volume:i,playbackRate:o,isMuted:r}=e.audioPlayer;return{sender:a,chat:s,volume:i,playbackRate:o,isMuted:r}}))((e=>{let{message:t,className:n,noUi:s,sender:o,chat:r,volume:c,playbackRate:l,isMuted:u}=e;const{setAudioPlayerVolume:m,setAudioPlayerPlaybackRate:g,setAudioPlayerMuted:f,focusMessage:p,closeAudioPlayer:v}=(0,a.Sv)(),I=(0,Fe.Z)(),{audio:y,voice:w,video:Z}=(0,d.qp)(t),P=Boolean(w||Z),C=o?(0,d.OU)(I,o):void 0,b=K.UV((0,d.Ti)(t,"inline")),S=en(t,o,r),{playPause:E,stop:M,isPlaying:R,requestNextTrack:k,requestPreviousTrack:N,isFirst:T,isLast:A,setVolume:B,toggleMuted:x,setPlaybackRate:L}=(0,Vt.Z)((0,_t.An)(t),(0,d.XV)(t),P?"voice":"audio",b,void 0,S,void 0,!0,void 0,void 0,(0,d.CI)(t),!0),O=P&&R;(0,i.d4)((()=>{if(O)return Q.Z.disableRefresh(),()=>{Q.Z.enableRefresh()}}),[O]);const U=(0,i.I4)((()=>{p({chatId:t.chatId,messageId:t.id})}),[p,t.chatId,t.id]),F=(0,i.I4)((()=>{R&&E(),v(),(0,zt.Ay)(),M()}),[v,R,E,M]),D=(0,i.I4)((e=>{m({volume:e/100}),B(e/100)}),[m,B]),$=(0,i.I4)((()=>{h.$b&&!h.cj||(x(),f({isMuted:!u}))}),[u,f,x]),q=(0,i.I4)((()=>{1===l?(L(1.8),g({playbackRate:1.8})):(L(1),g({playbackRate:1}))}),[l,g,L]),j=(0,i.Ye)((()=>0===c||u?"icon-muted":c<.3?"icon-volume-1":c<.6?"icon-volume-2":"icon-volume-3"),[c,u]);if(!s)return i.ZP.createElement("div",{className:(0,fe.Z)("AudioPlayer",n),dir:I.isRtl?"rtl":void 0},i.ZP.createElement(ze.Z,{round:!0,ripple:!h.wB,color:"translucent",size:"smaller",className:"player-button",disabled:T(),onClick:N,ariaLabel:"Previous track"},i.ZP.createElement("i",{className:"icon-skip-previous"})),i.ZP.createElement(ze.Z,{round:!0,ripple:!h.wB,color:"translucent",size:"smaller",className:(0,fe.Z)("toggle-play","player-button",R?"pause":"play"),onClick:E,ariaLabel:R?"Pause audio":"Play audio"},i.ZP.createElement("i",{className:"icon-play"}),i.ZP.createElement("i",{className:"icon-pause"})),i.ZP.createElement(ze.Z,{round:!0,ripple:!h.wB,color:"translucent",size:"smaller",className:"player-button",disabled:A(),onClick:k,ariaLabel:"Next track"},i.ZP.createElement("i",{className:"icon-skip-next"})),i.ZP.createElement("div",{className:"AudioPlayer-content",onClick:U},y?function(e){const{title:t,performer:n,fileName:a}=e;return i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement("div",{className:"title",dir:"auto"},(0,tn.Z)(t||a)),n&&i.ZP.createElement("div",{className:"subtitle",dir:"auto"},(0,tn.Z)(n)))}(y):function(e,t){return i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement("div",{className:"title",dir:"auto"},t&&(0,tn.Z)(t)),i.ZP.createElement("div",{className:"subtitle",dir:"auto"},e))}(I("AttachAudio"),C),i.ZP.createElement($t.Z,null)),i.ZP.createElement(ze.Z,{round:!0,className:"player-button volume-button",color:"translucent",size:"smaller",ariaLabel:"Volume",withClickPropagation:!0},i.ZP.createElement("i",{className:j,onClick:$}),!h.cj&&i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement("div",{className:"volume-slider-spacer"}),i.ZP.createElement("div",{className:"volume-slider"},i.ZP.createElement(nn.Z,{bold:!0,value:u?0:100*c,onChange:D})))),P&&i.ZP.createElement(ze.Z,{round:!0,className:(0,fe.Z)("playback-button",1!==l&&"applied"),color:"translucent",size:"smaller",ariaLabel:"Playback Rate",ripple:!h.wB,onClick:q},i.ZP.createElement("span",{className:"playback-button-inner"},"2Х")),i.ZP.createElement(ze.Z,{round:!0,className:"player-close",color:"translucent",size:"smaller",onClick:F,ariaLabel:"Close player"},i.ZP.createElement("i",{className:"icon-close"})))}));var sn=n(2431),on=n(172);const rn=(0,i.X$)((0,a.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,c.Z1)(e,n),s=(0,sn.Bj)(e,n);return{groupCall:s,usersById:e.users.byId,chatsById:e.chats.byId,activeGroupCallId:e.groupCalls.activeGroupCallId,isActive:(s?s.participantsCount>0&&s.isLoaded:a&&a.isCallNotEmpty&&a.isCallActive)&&e.groupCalls.activeGroupCallId!==(null==s?void 0:s.id)}}))((e=>{let{chatId:t,isActive:n,groupCall:s,hasPinnedOffset:o,usersById:r,chatsById:c}=e;const{joinGroupCall:l,subscribeToGroupCallUpdates:d}=(0,a.Sv)(),u=(0,Fe.Z)(),m=(0,i.I4)((()=>{l({chatId:t})}),[l,t]),h=null==s?void 0:s.participants,g=(0,i.Ye)((()=>h?Object.values(h).filter(((e,t)=>t<3)).map((e=>{let{id:t,isUser:n}=e;if(n){if(!r[t])return;return{user:r[t]}}if(c[t])return{chat:c[t]}})).filter(Boolean):[]),[c,h,r]);if((0,i.d4)((()=>{if(null!=s&&s.id&&(n||!s.isLoaded))return d({id:s.id,subscribed:!0}),()=>{d({id:s.id,subscribed:!1})}}),[null==s?void 0:s.id,null==s?void 0:s.isLoaded,n,d]),s)return i.ZP.createElement("div",{className:(0,fe.Z)("GroupCallTopPane",o&&"has-pinned-offset",!n&&"is-hidden"),onClick:m},i.ZP.createElement("div",{className:"info"},i.ZP.createElement("span",{className:"title"},u("VoipGroupVoiceChat")),i.ZP.createElement("span",{className:"participants"},u("Participants",s.participantsCount||0,"i"))),i.ZP.createElement("div",{className:"avatars"},g.map((e=>{if(e)return e.user?i.ZP.createElement(on.Z,{key:e.user.id,user:e.user}):i.ZP.createElement(on.Z,{key:e.chat.id,chat:e.chat})}))),i.ZP.createElement(ze.Z,{round:!0,className:"join"},u("VoipChatJoin")))})));var cn=n(4605);const ln=(0,i.X$)((0,a.c$)(((e,t)=>{let{chatId:n}=t;return{currentUserId:e.currentUserId,chat:(0,c.Z1)(e,n),user:(0,d.YC)(n)?(0,c.dy)(e,n):void 0}}))((e=>{let{chatId:t,className:n,chat:s,user:o,settings:r,currentUserId:c}=e;const{openAddContactDialog:l,blockContact:u,reportSpam:m,deleteChat:h,leaveChannel:g,deleteChatUser:f,deleteHistory:p,toggleChatArchived:v,hideChatReportPanel:I}=(0,a.Sv)(),y=(0,Fe.Z)(),[w,Z,P]=(0,Oe.Z)(),[C,b]=(0,i.eJ)(!0),[S,E]=(0,i.eJ)(!0),{accessHash:M}=s||{},{isAutoArchived:R,canReportSpam:k,canAddContact:N,canBlockContact:T}=r||{},A=s&&(0,d.G9)(s),B=(0,i.I4)((()=>{l({userId:t}),R&&v({chatId:t})}),[l,R,v,t]),x=(0,i.I4)((()=>{P(),u({contactId:t,accessHash:M}),k&&C&&m({chatId:t}),S&&h({chatId:t})}),[M,u,P,h,m,k,S,C,t]),L=(0,i.I4)((()=>{I({chatId:t})}),[t,I]),O=(0,i.I4)((()=>{P(),m({chatId:t}),A?(f({chatId:t,userId:c}),p({chatId:t,shouldDeleteForAll:!1})):g({chatId:t})}),[t,P,c,f,p,A,g,m]);if(r)return i.ZP.createElement("div",{className:(0,fe.Z)("ChatReportPanel",n),dir:y.isRtl?"rtl":void 0},N&&i.ZP.createElement(ze.Z,{isText:!0,fluid:!0,size:"tiny",className:"UserReportPanel--Button",onClick:B},y("lng_new_contact_add")),T&&i.ZP.createElement(ze.Z,{color:"danger",isText:!0,fluid:!0,size:"tiny",className:"UserReportPanel--Button",onClick:Z},y("lng_new_contact_block")),k&&!T&&i.ZP.createElement(ze.Z,{color:"danger",isText:!0,fluid:!0,size:"tiny",className:"UserReportPanel--Button",onClick:Z},y("lng_report_spam_and_leave")),i.ZP.createElement(ze.Z,{round:!0,ripple:!0,size:"tiny",color:"translucent",onClick:L,ariaLabel:y("Close")},i.ZP.createElement("i",{className:"icon-close"})),i.ZP.createElement(Dt.Z,{isOpen:w,onClose:P,title:y("BlockUserTitle",o?(0,d.Vl)(o):(0,d.U)(y,s)),text:o?y("UserInfo.BlockConfirmationTitle",(0,d.Js)(o)):y("Chat.Confirm.ReportSpam.Channel"),isButtonsInOneRow:!0,confirmIsDestructive:!0,confirmLabel:y("Block"),confirmHandler:o?x:O},o&&i.ZP.createElement(cn.Z,{label:y("DeleteThisChat"),checked:S,onCheck:E}),o&&k&&i.ZP.createElement(cn.Z,{label:y("ReportChat"),checked:C,onCheck:b})))}))),dn=(0,i.X$)((0,a.c$)(((e,t)=>{let{chatId:n,threadId:a,messageListType:s}=t;const{isLeftColumnShown:i,lastSyncTime:r,shouldSkipHistoryAnimations:l}=e,d=(0,c.Z1)(e,n),{typingStatus:u}=d||{},{chatId:m,messageId:h}=e.audioPlayer,g=m&&h?(0,c.hj)(e,m,h):void 0;let f;if("pinned"===s){const t=(0,c.KB)(e,n);f=null==t?void 0:t.length}else if("scheduled"===s){const t=(0,c.qy)(e,n);f=null==t?void 0:t.length}else if("thread"===s&&a!==o._f){const t=(0,c.tZ)(e,n,a);f=(null==t?void 0:t.messagesCount)||0}const p={typingStatus:u,isLeftColumnShown:i,isRightColumnShown:(0,c.Jf)(e),isSelectModeActive:(0,c.CA)(e),audioMessage:g,chat:d,messagesCount:f,isChatWithSelf:(0,c.FM)(e,n),isChatWithBot:d&&(0,c.xo)(e,d),lastSyncTime:r,shouldSkipHistoryAnimations:l,currentTransitionKey:Math.max(0,e.messages.messageLists.length-1),connectionState:e.connectionState,isSyncing:e.isSyncing},v=(0,c.Zw)(e,n);if("thread"!==s||!v)return p;if(Object.assign(p,{messagesById:v}),a!==o._f){const t=(0,c.qS)(e,n,a),s=t?(0,c.hj)(e,n,t):void 0,i=s?(0,c.cv)(e,s):void 0;return{...p,pinnedMessageIds:t,canUnpin:!1,topMessageSender:i}}const I=(0,c.KB)(e,n);if(null!=I&&I.length){const t=v[I[0]],{canUnpin:n}=t&&(0,c._k)(e,t,a)||{};return{...p,pinnedMessageIds:I,canUnpin:n}}return p}))((e=>{let{chatId:t,threadId:n,messageListType:r,isReady:c,pinnedMessageIds:l,messagesById:u,canUnpin:m,topMessageSender:g,typingStatus:f,isSelectModeActive:p,isLeftColumnShown:v,isRightColumnShown:I,audioMessage:y,chat:w,messagesCount:Z,isChatWithSelf:P,isChatWithBot:C,lastSyncTime:b,shouldSkipHistoryAnimations:S,currentTransitionKey:E,connectionState:M,isSyncing:R}=e;const{openChatWithInfo:k,pinMessage:N,focusMessage:T,openChat:A,openPreviousChat:B,loadPinnedMessages:x,toggleLeftColumn:L,exitMessageSelectMode:O}=(0,a.Sv)(),U=(0,Fe.Z)(),F=(0,i.sO)(!0),[D,$]=(0,i.eJ)(0),q=Array.isArray(l)?l[D]:l,j=u&&q?u[q]:void 0,G=Array.isArray(l)?l.length:l?1:void 0,H=w&&(0,d.U)(U,w).length,_=g?(0,d.OU)(U,g):void 0,{settings:z}=w||{};(0,i.d4)((()=>{n===o._f&&b&&c&&x({chatId:t})}),[t,x,b,n,c]),(0,i.d4)((()=>{$(0)}),[l]),(0,kt.Z)(t,q,j);const{width:V}=bt(),K=V<=s.ks,X=h.p7&&v,W=(0,i.sO)(null),Y=(0,i.sO)(!0),J=(0,i.I4)((()=>{k({id:t})}),[k,t]),Q=(0,i.I4)((e=>{N({chatId:t,messageId:e,isUnpin:!0})}),[N,t]),ee=(0,i.I4)((()=>{if(j){T({chatId:j.chatId,threadId:n,messageId:j.id});const e=(0,Rt.Z)(G||1,D+1);$(e)}}),[j,T,n,G,D]),te=(0,i.I4)((()=>{A({id:t,threadId:o._f,type:"pinned"})}),[A,t]),ne=(0,i.I4)((()=>{setTimeout((()=>{F.current=!0}),450)}),[]),ae=(0,i.I4)((e=>{if(F.current){if(F.current=!1,h.wB){const e=document.querySelector(s.Ed);null==e||e.blur()}if(p)return O(),void ne();if(n===o._f&&"thread"===r&&0===E)return h.wB||X?(e.stopPropagation(),A({id:void 0})):L(),void ne();B(),ne()}}),[n,r,E,p,B,X,A,L,O,ne]),se=V>=s.ks&&V<s.jT||V>s.l3&&V<s.ks&&(!H||H>30),ie=se||V>s._m&&V<s.QU,oe=Boolean((null==z?void 0:z.canAddContact)||(null==z?void 0:z.canBlockContact)||(null==z?void 0:z.canReportSpam)),{shouldRender:re,transitionClassNames:ce}=(0,ye.Z)(oe),le=(0,Nt.Z)(oe?z:void 0,!0),{shouldRender:de,transitionClassNames:ue}=(0,ye.Z)(Boolean(y)),me=(0,Nt.Z)(y,!0),{shouldRender:he,transitionClassNames:ge}=(0,ye.Z)(Boolean(j)),pe=(0,Nt.Z)(j,!0),ve=(0,Nt.Z)(G,!0),Ie=(0,Nt.Z)(m,!0),we=(0,Nt.Z)(_),Ze=he&&pe||de&&me;(0,i.d4)((()=>{const e=W.current;if(e)return ie&&Ze?void(I||se?(Y.current&&(e.classList.add("tools-stacked","animated"),Y.current=!1),setTimeout((()=>{e.classList.remove("animated")}),350)):(e.classList.remove("tools-stacked"),Y.current=!0)):(e.classList.remove("tools-stacked","animated"),void(Y.current=!0))}),[ie,Ze,se,I]);const{connectionStatusText:Pe}=Ge(U,M,R,!0);function Ce(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return i.ZP.createElement("div",{className:"back-button"},i.ZP.createElement(ze.Z,{round:!0,size:"smaller",color:"translucent",onClick:ae,ariaLabel:U(e?"Close":"Back")},i.ZP.createElement("div",{className:(0,fe.Z)("animated-close-icon",!e&&"state-back")})),t&&i.ZP.createElement(Ae,null))}const be=Boolean(de&&me);return i.ZP.createElement("div",{className:"MiddleHeader",ref:W},i.ZP.createElement(Ue.Z,{name:S?"none":"slide-fade",activeKey:E},"thread"===r&&n===o._f?i.ZP.createElement(i.ZP.Fragment,null,(K||E>0)&&Ce(X,!0),i.ZP.createElement("div",{className:"chat-info-wrapper",onClick:J},(0,d.YC)(t)?i.ZP.createElement(Tt.Z,{userId:t,typingStatus:f,status:Pe,withDots:Boolean(Pe),withFullInfo:C,withMediaViewer:!0,withUpdatingStatus:!0,noRtl:!0}):i.ZP.createElement(At.Z,{chatId:t,typingStatus:f,status:Pe,withDots:Boolean(Pe),withMediaViewer:!0,withFullInfo:!0,withUpdatingStatus:!0,noRtl:!0}))):"thread"===r?i.ZP.createElement(i.ZP.Fragment,null,Ce(),i.ZP.createElement("h3",null,U("CommentsCount",Z,"i"))):"pinned"===r?i.ZP.createElement(i.ZP.Fragment,null,Ce(),i.ZP.createElement("h3",null,U("PinnedMessagesCount",Z,"i"))):"scheduled"===r?i.ZP.createElement(i.ZP.Fragment,null,Ce(),i.ZP.createElement("h3",null,P?U("Reminders"):U("messages",Z,"i"))):void 0),i.ZP.createElement(rn,{hasPinnedOffset:he&&Boolean(pe)||de&&Boolean(me),chatId:t}),he&&pe&&i.ZP.createElement(Ht,{key:t,message:pe,count:ve||0,index:D,customTitle:we,className:(0,fe.Z)(ge,be&&"full-width"),onUnpinMessage:Ie?Q:void 0,onClick:ee,onAllPinnedClick:te}),re&&i.ZP.createElement(ln,{key:t,chatId:t,settings:le,className:ce}),i.ZP.createElement("div",{className:"header-tools"},be&&i.ZP.createElement(an,{key:(0,d.Tp)(me),message:me,className:ue}),i.ZP.createElement(xt,{chatId:t,threadId:n,messageListType:r,canExpandActions:!be})))})));var un=n(2645),mn=n(274);function hn(e){return"albumId"in e}function gn(e,t){let n,a=[],s={originalDate:e[0].date,datetime:(0,L._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,L._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,d.Lo)(o)||(0,d.Lo)(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 fn=n(386),pn=n(2202);var vn=n(7675),In=n(539),yn=n(2357),wn=n(998);var Zn=n(3657);const Pn=h.wZ?1e3:350,Cn=h.wB?300:500;var bn=n(7240);function Sn(e){return"number"==typeof e}function En(e,t){return e?t?238:175:t?238:100}function Mn(e,t){const n=(0,d.B4)(e),a=(0,d.MF)(e),s=(0,d.O$)(e)||(0,d.F$)(e),i=(0,d.b7)(e),o=Boolean((0,d.F$)(e)),{width:r,height:c}=s?(0,Lt.Eh)(s,n,a,o,t):(0,Lt.GC)(i,n,a,t),l=En(Boolean((0,d.UD)(e)));let u=1;r<l&&l-r<12&&(u=l/r),c*u<90&&90-c*u<12&&(u=90/c);const m=Math.round(r*u),h=Math.round(c*u);return{width:m,height:h,isSmall:m<l||h<90}}function Rn(e,t){return e.reduce(((e,t)=>e+t),t)}function kn(e,t,n){return e<t?t:e>n?n:e}function Nn(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 Tn(e,t,n,a){const s=function(e){return e.map((e=>{const t=Mn(e);return t.width/t.height}))}(a.messages),i=function(e){return e.map((e=>e>1.2?"w":e<.8?"n":"q")).join("")}(s),o=function(e){return e.reduce(((e,t)=>t+e),1)/e.length}(s),r=s.length,c=s.some((e=>e>2)),l=(0,Lt.kc)(e,t,!1,n)-(t?2.5:0)*Lt.Gw;let d;const u={ratios:s,proportions:i,averageRatio:o,maxWidth:l,minWidth:100,maxHeight:l,spacing:2};return d=r>=5||c?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?kn(e,1,2.75):kn(e,.6667,1)))}(t,n),c=t.length,l=new Array(c),d=[],u=e=>{const t=[];let n=0;e.forEach((e=>{t.push(((e,t)=>{const n=Rn(r.slice(e,e+t),0);return(a-(t-1)*i)/n})(n,e)),n+=e})),d.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<d.length;e++){const{heights:t,lineCounts:n}=d[e],a=n.length,r=Rn(t,0)+i*(a-1),c=Math.min(...t)<s?1.5:1,l=(()=>{for(let e=1;e!==a;++e)if(n[e-1]>n[e])return 1.5;return 1})(),u=Math.abs(r-o)*c*l;(!m||u<h)&&(m=d[e],h=u)}const g=m.lineCounts,f=m.heights,p=g.length;let v=0,I=0;for(let e=0;e!==p;++e){const t=g[e],n=f[e],s=Math.round(n);let o=0;for(let c=0;c!==t;++c){const d=0|(0===e?1:0)|(e===p-1?4:0)|(0===c?8:0)|(c===t-1?2:0),u=r[v],m=c===t-1?a-o:Math.round(u*n);l[v]={dimensions:{x:o,y:I,width:m,height:s},sides:d},o+=m+i,++v}I+=s+i}return l}(u):2===r?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,l=Math.min(i,Math.round(Math.min(c/t[0],r/t[1])));return[{dimensions:{x:0,y:0,width:c,height:l},sides:13},{dimensions:{x:c+s,y:0,width:r,height:l},sides:7}]}(e)}(u):3===r?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,l=Math.max(i,Math.round(Math.min((s-n)/2,Math.min(r*a[2],c*a[1])))),d=Math.min(Math.round(o*a[0]),s-n-l);return[{dimensions:{x:0,y:0,width:d,height:o},sides:13},{dimensions:{x:d+n,y:0,width:l,height:c},sides:3},{dimensions:{x:d+n,y:c+n,width:l,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)}(u):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])),l=Math.max(i,Math.round(Math.min(.4*(t-2*a),c*n[1]))),d=Math.round(Math.max(Math.max(i,.33*(t-2*a)),c*n[3])),u=o-l-d-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:l,height:m},sides:12},{dimensions:{x:l+a,y:r+a,width:u,height:m},sides:4},{dimensions:{x:l+a+u+a,y:r+a,width:d,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])),l=Math.round(c/n[1]),d=Math.round(c/n[2]),u=o-l-d-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:l},sides:3},{dimensions:{x:r+s,y:l+s,width:m,height:d},sides:2},{dimensions:{x:r+s,y:l+d+2*s,width:m,height:u},sides:6}]}(e)}(u),{layout:d,containerStyle:Nn(d)}}let An;function Bn(e){return An||(An=document.createElement("span"),An.style.font=h.cj?'400 12px system-ui, -apple-system, BlinkMacSystemFont, "Roboto", "Apple Color Emoji", "Helvetica Neue", sans-serif':'400 12px "Roboto", -apple-system, "Apple Color Emoji", BlinkMacSystemFont, "Helvetica Neue", sans-serif',An.style.whiteSpace="nowrap",An.style.position="absolute",An.style.left="-999px",An.style.opacity=".01",document.body.appendChild(An)),An.innerHTML=e,An.offsetWidth}function xn(e,t,n,a,s,o){(0,i.bt)((()=>{if(n&&e.current){const t=e.current.closest(".MessageList");(0,In.Z)(t,e.current,s?"end":"centerOrTop",20,void 0!==a?1e3:void 0,a,void 0,o)}}),[e,t,n,a,s,o])}const Ln=3*Lt.Gw,On=Number(Lt.Gw),Un="data-is-document-group-hover";function Fn(e,t,n,s,o,r,c,l,d,u,m,g,f,p){const{setReplyingToId:v,sendDefaultReaction:I}=(0,a.Sv)(),[y,w,Z]=(0,Oe.Z)(),[P,C,b]=(0,Oe.Z)(),S=(0,i.sO)();return(0,i.d4)((()=>{if(!h.$b||o||!r||m)return;let e;return(0,et.sf)(t.current,{selectorToPreventScroll:".MessageList",onSwipe:(t,n)=>n===et.eM.Left&&(e||(e=Date.now()),C(),!0),onRelease:()=>{e&&(v({messageId:n}),setTimeout(b,Math.max(0,150-(Date.now()-e))),e=void 0)}})}),[t,o,n,v,C,b,r,m]),{handleMouseDown:o?void 0:function(e){(0,fn.q)(e),d(e)},handleClick:function(t){if(o)e(t);else if(h.$b)return S.current?(clearInterval(S.current),S.current=void 0,void function(e){const{pageX:t,pageY:a}=e;I({chatId:u,messageId:n,x:t,y:a})}(t)):void(S.current=setTimeout((()=>{S.current=void 0,function(e){if(h.wZ){const t=e.target;if(!t.classList.contains("text-content")&&!t.classList.contains("Message"))return;Q.Z.getIsKeyboardVisible()?setTimeout((()=>{l(e)}),350):l(e)}}(t)}),200))},handleContextMenu:o?c?Ie.Z:void 0:function(t){if(h.wZ){if(t.target.matches("a[href]")||m)return;t.preventDefault(),e()}else l(t)},handleDoubleClick:o?void 0:function(){h.$b||v({messageId:n})},handleContentDoubleClick:h.$b?void 0:function(e){e.stopPropagation()},handleMouseMove:function(e){const t=g.current;if(!t)return;const{clientX:n,clientY:a}=e,{x:s,width:i,y:o,height:r}=t.getBoundingClientRect(),c=Math.abs(f?n-s:s+i-n)<Ln,l=Math.abs(o+r-a)<On;c&&l?w():Z()},handleSendQuickReaction:function(e){const{x:t,y:a}=e.currentTarget.getBoundingClientRect();I({chatId:u,messageId:n,x:t,y:a})},handleMouseLeave:function(e){Z(),p&&function(e){const t=$n(e.currentTarget);t&&t.removeAttribute(Un)}(e)},isSwiped:P,isQuickReactionVisible:y,handleDocumentGroupMouseEnter:Dn}}function Dn(e){const t=$n(e.currentTarget);t&&t.setAttribute(Un,"")}function $n(e){let t=e;do{t=t.nextElementSibling}while(t&&!t.classList.contains("last-in-document-group"));return t}var qn=n(8005);const jn=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,it.Z)(st.gl.Extra,"ContextMenuContainer",!t);return n?i.ZP.createElement(n,e):void 0})),Gn=(0,i.X$)((0,a.c$)(((e,t)=>{let{message:n}=t;const{byId:a}=e.users,s=n.senderId,{targetUserIds:i,targetChatId:o}=n.content.action||{},r=n.replyToMessageId,l=r?(0,c.hj)(e,n.chatId,r):void 0,u=(0,c._X)(e,n),{direction:m,noHighlight:h}=u&&e.focusedMessage||{},g=(0,c.Z1)(e,n.chatId),f=g&&((0,d.eA)(g)||s===n.chatId);return{usersById:a,senderUser:!f&&s?(0,c.dy)(e,s):void 0,senderChat:f?g:void 0,targetChatId:o,targetUserIds:i,targetMessage:l,isFocused:u,...u&&{focusDirection:m,noFocusHighlight:h}}}))((e=>{let{message:t,observeIntersection:n,isEmbedded:a,appearanceOrder:s=0,isLastInList:o,usersById:r,senderUser:c,senderChat:l,targetUserIds:u,targetMessage:m,targetChatId:h,isFocused:g,focusDirection:f,noFocusHighlight:p}=e;const v=(0,i.sO)(null);(0,Zn._N)(v,n),(0,kt.Z)(t.chatId,t.replyToMessageId,m),xn(v,t.chatId,g,f,p);const I=(0,Fe.Z)(),y=s<=0,[w,Z]=(0,Oe.Z)(y);(0,i.d4)((()=>{y||setTimeout(Z,10*s)}),[s,Z,y]);const{transitionClassNames:P}=(0,ye.Z)(w,void 0,y,!1),C=(0,i.Ye)((()=>u?u.map((e=>null==r?void 0:r[e])).filter(Boolean):void 0),[u,r]),b=(0,qn.D)(I,t,c,l,C,m,h,{asTextWithSpoilers:a}),{isContextMenuOpen:S,contextMenuPosition:E,handleBeforeContextMenu:M,handleContextMenu:R,handleContextMenuClose:k,handleContextMenuHide:N}=(0,bn.Z)(v),T=void 0!==E;if(a)return i.ZP.createElement("span",{className:"embedded-action-message"},b);const A=(0,fe.Z)("ActionMessage message-list-item",g&&!p&&"focused",T&&"has-menu-open",o&&"last-in-list",P);return i.ZP.createElement("div",{ref:v,id:(0,d.d0)(t.id),className:A,"data-message-id":t.id,onMouseDown:e=>{(0,fn.q)(e),M(e)},onContextMenu:R},i.ZP.createElement("span",null,b),E&&i.ZP.createElement(jn,{isOpen:S,anchor:E,message:t,messageListType:"thread",onClose:k,onCloseAnimationEnd:N}))}))),Hn=e=>{var t;let{className:n,message:a,sender:s,title:o,customText:r,isProtected:c,observeIntersection:l,onClick:u}=e;const m=(0,i.sO)(null),h=(0,Zn.Op)(m,l),g=(0,Ot.Z)(a&&(0,d.Ti)(a,"pictogram"),!h),f=Ft(a),p=Boolean(a&&(0,d.Y5)(a)),v=(0,Fe.Z)(),I=(null==a||null===(t=a.forwardInfo)||void 0===t?void 0:t.hiddenUserName)||s&&(0,d.OU)(v,s);return i.ZP.createElement("div",{ref:m,className:(0,fe.Z)("EmbeddedMessage",n),onClick:a?u:void 0},f&&function(e,t,n,a){const{width:s,height:o}=(0,Lt.W7)();return i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement("img",{src:t||e,width:s,height:o,alt:"",className:n?"round":"",draggable:!a}),a&&i.ZP.createElement("span",{className:"protector"}))}(f,g,p,c),i.ZP.createElement("div",{className:"message-text"},i.ZP.createElement("p",{dir:"auto"},a?(0,d.Lo)(a)?i.ZP.createElement(Gn,{message:a,isEmbedded:!0}):(0,qt.e)(v,a,Boolean(f)):r||" "),i.ZP.createElement("div",{className:"message-title",dir:"auto"},(0,tn.Z)(I||o||" "))))};var _n=n(2535),zn=n(4752),Vn=n(8018),Kn=n(8198),Xn=n(7799);const Wn=(0,i.X$)((e=>{var t,n;let{reaction:s,activeReaction:r,isInMeta:c,availableReactions:l}=e;const{stopActiveReaction:d}=(0,a.Sv)(),u=null==l?void 0:l.find((e=>e.reaction===s)),m=null==u||null===(t=u.centerIcon)||void 0===t?void 0:t.id,h=null==u||null===(n=u.aroundAnimation)||void 0===n?void 0:n.id,g=(0,Ot.Z)(`sticker${m}`,!m,o.IU.Lottie),f=(0,Ot.Z)(`sticker${h}`,!h,o.IU.Lottie),p=Boolean((null==r?void 0:r.reaction)===s&&g&&f),{shouldRender:v,transitionClassNames:I}=(0,ye.Z)(p,void 0,!0,"slow"),y=(0,i.I4)((()=>{d({messageId:null==r?void 0:r.messageId,reaction:s})}),[null==r?void 0:r.messageId,s,d]),[w,Z,P]=(0,Oe.Z)(),C=!p||!w,b=(0,fe.Z)("ReactionAnimatedEmoji",c&&"in-meta",v&&"is-animating");return i.ZP.createElement("div",{className:b},C&&i.ZP.createElement(Kn.Z,{reaction:s}),v&&i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement(Xn.Z,{key:m,id:`reaction_emoji_${m}`,className:I,size:30,animationData:g,play:!0,noLoop:!0,forceOnHeavyAnimation:!0,onLoad:Z,onEnded:P}),i.ZP.createElement(Xn.Z,{key:h,id:`reaction_effect_${h}`,className:(0,fe.Z)("effect",I),size:100,animationData:f,play:!0,noLoop:!0,forceOnHeavyAnimation:!0,onEnded:y})))})),Yn=(0,i.X$)((e=>{var t;let{message:n,outgoingStatus:a,signature:s,onClick:o,withReactions:r,activeReaction:c,withReactionOffset:l,availableReactions:d,reactionMessage:u}=e;const m=(0,Fe.Z)(),[h,g]=(0,Oe.Z)(),f=r&&(null==u||null===(t=u.reactions)||void 0===t?void 0:t.results.filter((e=>e.count>0))),p=(0,i.Ye)((()=>{if(!h)return;const e=(0,L.SA)(1e3*n.date,m.code),t=n.isEdited&&(0,L.SA)(1e3*n.editDate,m.code),a=n.forwardInfo&&(0,L.SA)(1e3*n.forwardInfo.date,m.code);let s=e;return t&&(s+="\n",s+=m("lng_edited_date").replace("{date}",t)),a&&(s+="\n",s+=m("lng_forwarded_date").replace("{date}",a)),s}),[h,m,n]);return i.ZP.createElement("span",{className:(0,fe.Z)("MessageMeta",l&&"reactions-offset"),dir:m.isRtl?"rtl":"ltr",onClick:o},f&&f.map((e=>i.ZP.createElement(Wn,{activeReaction:c,reaction:e.reaction,isInMeta:!0,availableReactions:d}))),Boolean(n.views)&&i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement("span",{className:"message-views"},(0,ke.bi)(n.views)),i.ZP.createElement("i",{className:"icon-channelviews"})),s&&i.ZP.createElement("span",{className:"message-signature"},(0,tn.Z)(s)),i.ZP.createElement("span",{className:"message-time",title:p,onMouseEnter:g},n.isEdited&&`${m("EditedMessage")} `,(0,L.mr)(m,1e3*n.date)),a&&i.ZP.createElement(Vn.Z,{status:a}))}));var Jn=n(692),Qn=n(4753);const ea=e=>{let{message:t,observeIntersection:n,observeIntersectionForPlaying:a,shouldLoop:o,lastSyncTime:r}=e;const c=(0,i.sO)(null),[l,u,m]=(0,Oe.Z)(),g=t.content.sticker,{isLottie:f,stickerSetId:p,isVideo:v}=g,I=h.Hh,y=p===s.$E,w=(0,Zn.Op)(c,n),Z=(0,Zn.Op)(c,a),P=g.isPreloadedGlobally?`sticker${g.id}`:(0,d.Ti)(t,"inline"),C=v&&!I&&(g.isPreloadedGlobally?`sticker${g.id}?size=m`:(0,d.Ti)(t,"pictogram")),b=(0,Ot.Z)(C),S=Ft(t),E=b||S,M=(0,Ot.Z)(P,!w,(0,d.kG)(t,"inline"),r),R=Boolean(M),[k,N]=(0,Oe.Z)(R),T=f?k:R,A=(0,Jn.Z)(T),{width:B,height:x}=(0,Lt.Wr)(g),L=(0,fe.Z)("thumbnail",!S&&"empty"),O=(0,fe.Z)("Sticker media-inner",y&&"inactive");return(0,i.d4)((()=>{if(!v||!c.current)return;const e=c.current.querySelector("video");e&&(Z?(0,Qn.Z)(e):e.pause())}),[v,Z]),i.ZP.createElement("div",{ref:c,className:O,onClick:y?void 0:u},(!T||v&&!I)&&i.ZP.createElement("img",{src:E,width:B,height:x,alt:"",className:L}),!f&&!v&&i.ZP.createElement("img",{src:M,width:B,height:x,alt:"",className:(0,fe.Z)("full-media",A)}),v&&I&&T&&i.ZP.createElement("video",{src:M,width:B,height:x,autoPlay:Z,playsInline:!0,loop:o,muted:!0}),f&&R&&i.ZP.createElement(Xn.Z,{key:P,className:(0,fe.Z)("full-media",A),id:P,animationData:M,size:B,play:Z,noLoop:!o,onLoad:N}),i.ZP.createElement(Re.Z,{isOpen:l,fromSticker:g,onClose:m}))};var ta=n(7854),na=n(2566),aa=n(5866);function sa(e,t){return(0,aa.Z)((0,d.DH)(e),Boolean(t),h.wB&&!h.vX)}const ia={dark:{outgoing:"rgb(135,116,225)",incoming:"rgb(33,33,33)"},light:{outgoing:"rgb(238,255,222)",incoming:"rgb(255,255,255)"}};function oa(e,t,n,a,s){return a?Promise.resolve(ia[s||"light"][t?"outgoing":"incoming"]):async function(e,t){const n=new Image;n.src=e,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 ra=n(9196);const ca=e=>{let{id:t,message:n,observeIntersection:a,noAvatars:o,canAutoLoad:r,isInSelectMode:c,isSelected:l,uploadProgress:u,size:m="inline",dimensions:h,nonInteractive:g,shouldAffectAppendix:f,isDownloading:p,isProtected:v,theme:I,onClick:y,onCancelUpload:w}=e;const Z=(0,i.sO)(null),P=((0,d.O$)(n)||(0,d.F$)(n)).blobUrl,C=(0,Zn.Op)(Z,a),[b,S]=(0,i.eJ)(r),E=b&&C,{mediaData:M,loadProgress:R}=(0,na.Z)((0,d.Ti)(n,m),!E),k=P||M,N=sa(n,k),{loadProgress:T}=(0,na.Z)((0,d.Ti)(n,"download"),!p),{isUploading:A,isTransferring:B,transferProgress:x}=(0,d.Sc)(n,u||(p?T:R),E&&!k),L=!1===(0,Et.Z)(b),O=(0,Jn.Z)(k),{shouldRender:U,transitionClassNames:F}=(0,ye.Z)(B,void 0,L,"slow"),{shouldRender:D,transitionClassNames:$}=(0,ye.Z)(!k&&!b),q=(0,i.I4)((()=>{A?w&&w(n):k?y&&y(n.id):S((e=>!e))}),[k,A,n,w,y]),j=(0,d.B4)(n);(0,i.bt)((()=>{if(!f)return;const e=Z.current.closest(".message-content");k?oa(k,j,0,l,I).then((t=>{e.style.setProperty("--appendix-bg",t),e.setAttribute(s.s2,"")})):e.classList.add("has-appendix-thumb")}),[k,j,f,c,l,I]);const{width:G,height:H,isSmall:_}=h||Mn(n,o),z=(0,fe.Z)("media-inner",!A&&!g&&"interactive",_&&"small-image",G===H&&"square-image"),V=h?`width: ${G}px; height: ${H}px; left: ${h.x}px; top: ${h.y}px;`:"";return i.ZP.createElement("div",{id:t,ref:Z,className:z,style:V,onClick:A?void 0:q},i.ZP.createElement("canvas",{ref:N,className:"thumbnail",style:`width: ${G}px; height: ${H}px`}),i.ZP.createElement("img",{src:k,className:`full-media ${O}`,width:G,height:H,alt:"",draggable:!v}),v&&i.ZP.createElement("span",{className:"protector"}),U&&!D&&i.ZP.createElement("div",{className:`media-loading ${F}`},i.ZP.createElement(ra.Z,{progress:x,onClick:A?q:void 0})),D&&i.ZP.createElement("i",{className:(0,fe.Z)("icon-download",$)}),B&&i.ZP.createElement("span",{className:"message-transfer-progress"},Math.round(100*x),"%"))};var la=n(2019),da=n(6898);function ua(e,t){var n;const a=(0,i.sO)(null===(n=e.current)||void 0===n?void 0:n.paused),s=(0,i.sO)();s.current=t;const o=(0,i.I4)((()=>{e.current&&(a.current=!e.current.paused,a.current&&e.current.pause())}),[e]),r=(0,i.I4)((()=>{e.current&&a.current&&s.current&&document.body.contains(e.current)&&(0,Qn.Z)(e.current)}),[e]),c=(0,i.I4)((()=>{(0,E.T2)(r)}),[r]);(0,we.Z)(o,c),(0,ge.ZP)(o,r)}function ma(){return ma=Object.assign||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},ma.apply(this,arguments)}const ha=e=>{var t;let{id:n,message:s,observeIntersection:r,noAvatars:c,canAutoLoad:l,canAutoPlay:u,uploadProgress:m,lastSyncTime:h,dimensions:g,onClick:f,onCancelUpload:p,isDownloading:v,isProtected:I}=e;const y=(0,i.sO)(null),w=(0,i.sO)(null),Z=(0,d.b7)(s)||(0,d.Cg)(s),P=Z.blobUrl,C=(0,Zn.Op)(y,r),[b,S]=(0,i.eJ)(l),E=Boolean(b&&C&&h),[M,R]=(0,i.eJ)(u),k=(0,Ot.Z)((0,d.Ti)(s,"pictogram"),!(C&&h),(0,d.kG)(s,"pictogram"),h),N=(0,Jn.Z)(k),{mediaData:T,loadProgress:A}=(0,na.Z)((0,d.Ti)(s,"inline"),!E,(0,d.kG)(s,"inline"),h),B=P||T,x=Boolean(C&&B),O=sa(s,k),{loadProgress:U}=(0,na.Z)((0,d.Ti)(s,"download"),!v,o.IU.BlobUrl,h),{isBuffered:F,bufferingHandlers:D}=(0,la.Z)(!l),{isUploading:$,isTransferring:q,transferProgress:j}=(0,d.Sc)(s,m||(v?U:A),E&&!F||v),G=!1===(0,Et.Z)(b),{shouldRender:H,transitionClassNames:_}=(0,ye.Z)(q,void 0,G),{shouldRender:z,transitionClassNames:V}=(0,ye.Z)(b&&!M&&!H),[K,X]=(0,i.eJ)(0),W=(0,i.I4)((e=>{X(Math.max(0,e.currentTarget.currentTime-1))}),[]),Y=(null===(t=w.current)||void 0===t?void 0:t.duration)||Z.duration||0,J=(0,d.B4)(s),Q=(0,d.MF)(s),{width:ee,height:te}=g||(0,Lt.GC)(Z,J,Q,c);ua(w,x),(0,da.Z)(w,[x]);const ne=(0,i.I4)((()=>{$?p&&p(s):v?(0,a.Sv)().cancelMessageMediaDownload({message:s}):B?B&&!M?(R(!0),w.current.play()):f&&f(s.id):S((e=>!e))}),[$,v,B,M,f,p,s]),ae=(0,fe.Z)("media-inner dark",!$&&"interactive"),se=g?`width: ${ee}px; height: ${te}px; left: ${g.x}px; top: ${g.y}px;`:"";return i.ZP.createElement("div",{ref:y,id:n,className:ae,style:se,onClick:$?void 0:ne},i.ZP.createElement("canvas",{ref:O,className:"thumbnail",style:`width: ${ee}px; height: ${te}px;`}),i.ZP.createElement("img",{src:k,className:(0,fe.Z)("thumbnail",N),style:`width: ${ee}px; height: ${te}px;`,alt:"",draggable:!I}),x&&i.ZP.createElement("video",ma({ref:w,className:"full-media",width:ee,height:te,autoPlay:M,muted:!0,loop:!0,playsInline:!0},D,{draggable:!I,onTimeUpdate:W}),i.ZP.createElement("source",{src:B})),I&&i.ZP.createElement("span",{className:"protector"}),z&&i.ZP.createElement("i",{className:(0,fe.Z)("icon-large-play",V)}),H&&i.ZP.createElement("div",{className:(0,fe.Z)("media-loading",_)},i.ZP.createElement(ra.Z,{progress:j,onClick:ne})),!b&&i.ZP.createElement("i",{className:"icon-download"}),q?i.ZP.createElement("span",{className:"message-transfer-progress"},$||v?`${Math.round(100*j)}%`:"..."):i.ZP.createElement("div",{className:"message-media-duration"},Z.isGif?"GIF":(0,L.k9)(Math.max(Y-K,0))))};var ga=n(6272);const fa=(0,a.c$)(((e,t)=>{let{contact:n}=t;const{countryList:{phoneCodes:a}}=e;return{user:(0,c.dy)(e,n.userId),phoneCodeList:a}}))((e=>{let{contact:t,user:n,phoneCodeList:s}=e;const{openChat:o}=(0,a.Sv)(),{firstName:r,lastName:c,phoneNumber:l,userId:d}=t,u=(0,i.I4)((()=>{o({id:d})}),[o,d]);return i.ZP.createElement("div",{className:(0,fe.Z)("Contact",Boolean(d)&&"interactive"),onClick:d?u:void 0},i.ZP.createElement(on.Z,{size:"large",user:n,text:r||c}),i.ZP.createElement("div",{className:"contact-info"},i.ZP.createElement("div",{className:"contact-name"},r," ",c),i.ZP.createElement("div",{className:"contact-phone"},(0,ga.WZ)(s,l))))}));var pa=n(8974),va=n(1218),Ia=n(4434),ya=n(6937);function wa(e,t){return t>0?(e/t*100).toFixed():0}const Za=e=>{let{answer:t,voteResults:n,totalVoters:a,maxVotersCount:s,correctResults:o,shouldAnimate:r}=e;const c=n&&n.find((e=>e.option===t.option)),l=0===o.length||-1!==o.indexOf(t.option),d=o.length>0&&l||(null==c?void 0:c.isChosen),u=c?wa(c.votersCount,a||0):0,[m,h]=(0,i.eJ)(r?0:u),g=(0,i.sO)(null),f=c?wa(c.votersCount,s||0):0,p=m<u;if((0,i.d4)((()=>{r&&h(u)}),[r,u]),(0,i.d4)((()=>{const e=g.current;if(e&&r){const t=e.firstElementChild,n=p?"":"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>`}}),[p,r]),!n||!c)return;const v=`width: ${f}%; transform:scaleX(${p?0:1})`;return i.ZP.createElement("div",{className:"PollOption",dir:"ltr"},i.ZP.createElement("div",{className:"poll-option-share "+("100"===u?"limit-width":"")},u,"%",d&&i.ZP.createElement("span",{className:(0,fe.Z)("poll-option-chosen",!l&&"wrong",r&&"animate")},i.ZP.createElement("i",{className:l?"icon-check":"icon-close"}))),i.ZP.createElement("div",{className:"poll-option-right"},i.ZP.createElement("div",{className:"poll-option-text",dir:"auto"},(0,tn.Z)(t.text)),i.ZP.createElement("div",{className:(0,fe.Z)("poll-option-answer",d&&!l&&"wrong")},i.ZP.createElement("div",{className:"poll-option-corner",ref:g}),i.ZP.createElement("div",{className:"poll-option-line",style:v}))))},Pa=(0,i.X$)((0,a.c$)(((e,t)=>{let{poll:n}=t;const{recentVoterIds:a}=n.results,{serverTimeOffset:s,users:{byId:i}}=e;return a&&0!==a.length?{recentVoterIds:a,usersById:i,serverTimeOffset:s}:{}}))((e=>{let{message:t,poll:n,recentVoterIds:s,usersById:o,onSendVote:r,serverTimeOffset:c}=e;const{loadMessage:l,openPollResults:d}=(0,a.Sv)(),{id:u,chatId:m}=t,{summary:h,results:g}=n,[f,p]=(0,i.eJ)(!1),[v,I]=(0,i.eJ)([]),[y,w]=(0,i.eJ)(!1),[Z,P]=(0,i.eJ)(!1),[C,b]=(0,i.eJ)(!h.closed&&h.closeDate&&h.closeDate>0?Math.min(h.closeDate-Math.floor(Date.now()/1e3)+c,h.closePeriod):0),S=(0,i.sO)(null),{results:E,totalVoters:M}=g,R=E&&E.some((e=>e.isChosen)),k=!h.closed&&!R,N=!k&&h.isPublic&&Number(g.totalVoters)>0,T=k&&h.multipleChoice,A=E?Math.max(...E.map((e=>e.votersCount))):M,B=E?E.reduce(((e,t)=>(t.isCorrect&&e.push(t.option),e)),[]):[],x=h.answers.map((e=>({label:e.text,value:e.option,hidden:Boolean(h.quiz&&h.closePeriod&&C<=0)})));(0,i.d4)((()=>{f&&n.results.results&&n.results.results.some((e=>e.isChosen))&&p(!1)}),[f,n.results.results]),(0,i.d4)((()=>{C>0&&setTimeout((()=>b(C-1)),1e3);const e=S.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,L.k9)(C),n.firstElementChild.setAttribute("stroke-dashoffset",`-${e}`)}else e.innerHTML=`\n <span>${(0,L.k9)(C)}</span>\n <svg width="16px" height="16px">\n <circle cx="8" cy="8" r="6" class="poll-countdown-progress" transform="rotate(-90, 8, 8)"\n stroke-dasharray="${t} ${t}"\n stroke-dashoffset="0"\n />\n </svg>`}}),[C,h.closePeriod]),(0,i.d4)((()=>{h.quiz&&(C<=0||R&&!h.closed)&&l({chatId:m,messageId:u})}),[m,C,R,l,u,h.closed,h.quiz]),(0,i.d4)((()=>{let e;return h.quiz&&!h.closed&&h.closePeriod&&h.closePeriod>0&&(e=window.setTimeout((()=>{l({chatId:m,messageId:u})}),1e3*h.closePeriod)),()=>{e&&window.clearTimeout(e)}}),[k,m,l,u,h.closePeriod,h.closed,h.quiz]);const O=(0,i.Ye)((()=>s?s.reduce(((e,t)=>{const n=o[t];return n&&e.push(n),e}),[]):[]),[o,s]),U=(0,i.I4)((e=>{I([e]),p(!0),P(!0),r([e])}),[r]),F=(0,i.I4)((e=>{I(e)}),[]),D=(0,i.I4)((()=>{p(!0),P(!0),r(v)}),[r,v]),$=(0,i.I4)((()=>{d({chatId:m,messageId:u})}),[m,u,d]),q=(0,i.I4)((()=>{w(!0)}),[]),j=(0,i.I4)((()=>{w(!1),P(!1)}),[]);(0,i.d4)((()=>{Z&&R&&h.quiz&&g.results&&n.results.solution&&(g.results.find((e=>e.isChosen&&e.isCorrect))||w(!0))}),[R,Z,g.results,h.quiz,n.results.solution]);const G=(0,Fe.Z)();return i.ZP.createElement("div",{className:"Poll",dir:G.isRtl?"auto":"ltr"},y&&n.results.solution&&i.ZP.createElement(ya.Z,{message:(0,pa.H)(n.results.solution,n.results.solutionEntities),duration:5e3,onDismiss:j,containerId:"#middle-column-portals"}),i.ZP.createElement("div",{className:"poll-question"},(0,tn.Z)(h.question,["emoji","br"])),i.ZP.createElement("div",{className:"poll-type"},G(function(e){return void 0===e.isPublic?" ":e.quiz?e.isPublic?"QuizPoll":"AnonymousQuizPoll":e.closed?"FinalResults":e.isPublic?"PublicPoll":"AnonymousPoll"}(h)),O.length>0&&i.ZP.createElement("div",{className:"poll-recent-voters"},O.map((e=>i.ZP.createElement(on.Z,{size:"micro",user:e})))),C>0&&k&&i.ZP.createElement("div",{ref:S,className:"poll-countdown"}),h.quiz&&n.results.solution&&!k&&i.ZP.createElement(ze.Z,{round:!0,size:"tiny",color:"translucent",className:"poll-quiz-help",disabled:y,onClick:q,ariaLabel:"Show Solution"},i.ZP.createElement("i",{className:"icon-lamp"}))),k&&i.ZP.createElement("div",{className:"poll-answers"},T?i.ZP.createElement(va.Z,{options:x,onChange:F,disabled:t.isScheduled||f,loadingOptions:f?v:void 0,round:!0}):i.ZP.createElement(Ia.Z,{name:`poll-${u}`,options:x,onChange:U,disabled:t.isScheduled||f,loadingOption:f?v[0]:void 0})),!k&&i.ZP.createElement("div",{className:"poll-results"},h.answers.map((function(e){return i.ZP.createElement(Za,{key:e.option,shouldAnimate:Z,answer:e,voteResults:E,totalVoters:M,maxVotersCount:A,correctResults:B})}))),!N&&!T&&i.ZP.createElement("div",{className:"poll-voters-count"},function(e,t,n){return n?e(t?"Answer":"Vote",n,"i"):e(t?"Chat.Quiz.TotalVotesEmpty":"Chat.Poll.TotalVotesResultEmpty")}(G,h.quiz,g.totalVoters)),T&&i.ZP.createElement(ze.Z,{isText:!0,disabled:0===v.length,size:"tiny",onClick:D},G("PollSubmitVotes")),N&&i.ZP.createElement(ze.Z,{isText:!0,size:"tiny",onClick:$},G("PollViewResults")))})));var Ca=n(8035),ba=n(88);const Sa=(0,i.X$)((e=>{let{message:t,observeIntersection:n,noAvatars:a,canAutoLoad:s,canAutoPlay:o,inPreview:r,lastSyncTime:c,isDownloading:l=!1,isProtected:u,theme:m,onMediaClick:h,onCancelMediaTransfer:g}=e;const f=(0,d.s1)(t);let p=!1;if(null!=f&&f.photo&&!f.video){const{width:e,height:n}=Mn(t);p=e===n}const v=(0,i.I4)((()=>{h()}),[h]);if(!f)return;const{siteName:I,url:y,displayUrl:w,title:Z,description:P,photo:C,video:b}=f,S=(C||b)&&h&&!p,E=(0,Ca.Z)(P,170),M=(0,fe.Z)("WebPage",p&&"with-square-photo",!C&&!b&&!r&&"without-media",b&&"with-video");return i.ZP.createElement("div",{className:M,"data-initial":(I||w)[0],dir:"auto"},C&&!b&&i.ZP.createElement(ca,{message:t,observeIntersection:n,noAvatars:a,canAutoLoad:s,size:p?"pictogram":"inline",nonInteractive:!S,onClick:S?v:void 0,onCancelUpload:g,isDownloading:l,isProtected:u,theme:m}),i.ZP.createElement("div",{className:"WebPage-text"},i.ZP.createElement(ba.Z,{className:"site-name",url:y,text:I||w}),!r&&Z&&i.ZP.createElement("p",{className:"site-title"},(0,tn.Z)(Z)),E&&i.ZP.createElement("p",{className:"site-description"},(0,tn.Z)(E,["emoji","br"]))),!r&&b&&i.ZP.createElement(ha,{message:t,observeIntersection:n,noAvatars:a,canAutoLoad:s,canAutoPlay:o,lastSyncTime:c,onClick:S?v:void 0,onCancelUpload:g,isDownloading:l,isProtected:u}))}));var Ea=n(9937);const Ma=(0,i.X$)((e=>{let{message:t}=e;const n=(0,Fe.Z)(),a=(0,d.eO)(t),{title:s,text:o,amount:r,currency:c,isTest:l,photoUrl:u}=a;return i.ZP.createElement("div",{className:"Invoice"},s&&i.ZP.createElement("p",{className:"title"},(0,tn.Z)(s)),o&&i.ZP.createElement("p",null,(0,tn.Z)(o,["emoji","br"])),i.ZP.createElement("div",{className:"description "+(u?"has-image":"")},u&&i.ZP.createElement("img",{className:"invoice-image",src:u,alt:""}),i.ZP.createElement("p",{className:"description-text"},(0,Ea.x)(r,c,n.code),l&&i.ZP.createElement("span",null,n("PaymentTestInvoice")))))}));var Ra=n(8183);const ka=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"})),Na=["#e56cd5","#f89440","#9986ff","#44b3f5","#6dc139","#ff5d5a","#f87aad","#6e82b3","#f5ba21"],Ta=e=>{let{variant:t="rectangular",animation:n="wave",width:a,height:s,className:o}=e;const r=(0,fe.Z)("Skeleton",t,n,o),c=(a?`width: ${a}px;`:"")+(s?`height: ${s}px;`:"");return i.ZP.createElement("div",{className:r,style:c})};var Aa=n(8226);const Ba=1e-4,xa={width:400,height:300,zoom:16,scale:2},La={__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>'},Oa=(0,i.X$)((e=>{let{message:t,peer:n,lastSyncTime:a,isInSelectMode:o,isSelected:r,theme:c,serverTimeOffset:l}=e;const u=(0,i.sO)(null),m=(0,i.sO)(null),h=(0,Fe.Z)(),g=(0,Mt.Z)(),p=(0,d.nf)(t),{type:v,geo:I}=p,y=(0,f.b)(l),w=(0,d.$R)(t,y),Z="geoLive"!==v||w?void 0:t.date+p.period-y,[P,C]=(0,i.eJ)(I),b="venue"===v||"geoLive"===v&&!w,{width:S,height:E,zoom:M,scale:R}=xa,k=Boolean(a)&&(0,d.k6)(P,S,E,M,R),N=(0,Ot.Z)(k),T=(0,Et.Z)(N),A=N||T,B=n&&(0,d.YC)(n.id),x=n&&B?n:void 0,O=n&&!B?n:void 0,U=(0,d.B4)(t),F=(0,i.Ye)((()=>{if("geoLive"!==v||!P.accuracyRadius)return 0;const{lat:e,accuracyRadius:t}=P;return t/function(e,t){return 156543.03392*Math.cos(e*(Math.PI/180))/2**t}(e,M)}),[v,P,M]),D=(0,i.I4)((e=>{if("geoLive"!==v)return;const n=24*Math.PI,a=e.lastElementChild,s=e.firstElementChild,i=t.date+p.period-(0,f.b)(l),o=(1-i/p.period)*n,r=(0,L.mB)(h,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>`}),[v,t.date,p,l,h]);return(0,i.bt)((()=>{m.current&&D(m.current)}),[D]),(0,i.bt)((()=>{if(b)return;const e=u.current.closest(".message-content");A&&oa(A,U,0,r,c).then((t=>{e.style.setProperty("--appendix-bg",t),e.classList.add("has-appendix-thumb"),e.setAttribute(s.s2,"")}))}),[U,o,r,c,A,b]),(0,i.d4)((()=>{Math.abs(I.lat-P.lat)<Ba&&Math.abs(I.long-P.long)<Ba?P.accuracyRadius!==I.accuracyRadius&&C({...P,accuracyRadius:I.accuracyRadius}):C(I)}),[I,P]),(0,Ra.Z)((()=>{g()}),w?void 0:1e3*(Z||0)),(0,yn.Z)((()=>{const e=m.current;e&&D(e)}),Z?1e3:void 0),i.ZP.createElement("div",{ref:u,className:"Location media-inner interactive",onClick:()=>{var e;const t=function(e,t,n){return`http://maps.google.com/maps/place/${e}+${t}/@${e},${t},${n}z`}(P.lat,P.long,M);null===(e=window.open(t,"_blank"))||void 0===e||e.focus()}},i.ZP.createElement("div",{className:"map-wrapper"},A?i.ZP.createElement("img",{className:"full-media map",src:A,alt:"Location on a map",width:xa.width,height:xa.height}):i.ZP.createElement(Ta,{width:S,height:E}),function(){if(A)return i.ZP.createElement(i.ZP.Fragment,null,Boolean(F)&&!w&&i.ZP.createElement("div",{className:"location-accuracy",style:`width: ${2*F}px; height: ${2*F}px`}),function(){const e=(0,fe.Z)("pin",v,w&&"expired");if("geoLive"===v)return i.ZP.createElement("div",{className:e,dangerouslySetInnerHTML:La},i.ZP.createElement(on.Z,{chat:O,user:x,className:"location-avatar"}),void 0!==p.heading&&i.ZP.createElement("div",{className:"direction",style:`--direction: ${p.heading}deg`}));if("venue"===v){const t=function(e){return e?ka.get(e)||ka.get(e.split("/")[0])||Na[(t=e,t.split("").reduce(((e,t)=>(e<<5)-e+t.charCodeAt(0)|0),0)%Na.length)]:"#008df2";var t}(p.venueType),n=function(e){return e?`https://ss3.4sqi.net/img/categories_v2/${e}_88.png`:""}(p.venueType);return i.ZP.createElement("div",{className:e,dangerouslySetInnerHTML:La,style:`--pin-color: ${t}`},i.ZP.createElement("img",{src:n,className:"venue-icon",alt:""}))}return i.ZP.createElement("img",{className:e,src:Aa,alt:""})}())}()),function(){if(b)return"venue"===v?i.ZP.createElement("div",{className:"location-info"},i.ZP.createElement("div",{className:"location-info-title"},p.title),i.ZP.createElement("div",{className:"location-info-subtitle"},p.address)):"geoLive"===v?i.ZP.createElement("div",{className:"location-info"},i.ZP.createElement("div",{className:"location-info-title"},h("AttachLiveLocation")),i.ZP.createElement("div",{className:"location-info-subtitle"},(0,L.dJ)(h,y,t.editDate)),!w&&i.ZP.createElement("div",{className:"geo-countdown",ref:m})):void 0}())}));function Ua(e){return(0,i.X$)((0,a.c$)(((e,t)=>{const{message:n}=t;return{isInSelectMode:(0,c.CA)(e),isSelected:(0,c.vk)(e,n.id)}}))((t=>{const{isInSelectMode:n,isSelected:s,message:o,dimensions:r}=t,{toggleMessageSelection:c}=(0,a.Sv)(),l=(0,i.I4)((e=>{e.stopPropagation(),c({messageId:o.id,withShift:null==e?void 0:e.shiftKey})}),[c,o]),d=(0,i.Ye)((()=>{const{dimensions:e,onClick:a}=t;return{...t,isInSelectMode:n,isSelected:s,dimensions:{...e,x:0,y:0},onClick:n?void 0:a}}),[t,n,s]);return i.ZP.createElement("div",{className:(0,fe.Z)("album-item-select-wrapper",s&&"is-selected"),style:r?`left: ${r.x}px; top: ${r.y}px;`:"",onClick:n?l:void 0},n&&i.ZP.createElement("div",{className:"message-select-control"},s&&i.ZP.createElement("i",{className:"icon-select"})),i.ZP.createElement(e,d))})))}const Fa=Ua(ca),Da=Ua(ha),$a=(0,a.c$)(((e,t)=>{let{album:n}=t;const{chatId:a}=n.mainMessage,s=(0,c.Pu)(e),i=(0,c.xs)(e,a);return{theme:s,uploadsById:e.fileUploads.byMessageLocalId,activeDownloadIds:i}}))((e=>{let{album:t,observeIntersection:n,hasCustomAppendix:s,lastSyncTime:o,isOwn:r,isProtected:l,albumLayout:u,onMediaClick:m,uploadsById:h,activeDownloadIds:g,theme:f}=e;const{cancelSendingMessage:p}=(0,a.Sv)(),v=t.messages.length,I=(0,i.I4)((e=>{p({chatId:e.chatId,messageId:e.id})}),[p]),{width:y,height:w}=u.containerStyle;return i.ZP.createElement("div",{className:"Album",style:`width: ${y}px; height: ${w}px;`},t.messages.map((function(e,t){const{photo:p,video:y}=(0,d.qp)(e),w=h[e.previousLocalId||e.id],Z=null==w?void 0:w.progress,{dimensions:P,sides:C}=u.layout[t],b=(0,c.bH)((0,a.Rd)(),e),S=(0,c.__)((0,a.Rd)(),e);if(p){const a=s&&(r?t===v-1:Boolean(8&C&&4&C));return i.ZP.createElement(Fa,{id:`album-media-${(0,d.d0)(e.id)}`,message:e,observeIntersection:n,canAutoLoad:b,shouldAffectAppendix:a,uploadProgress:Z,dimensions:P,isProtected:l,onClick:m,onCancelUpload:I,isDownloading:g.includes(e.id),theme:f})}if(y)return i.ZP.createElement(Da,{id:`album-media-${(0,d.d0)(e.id)}`,message:e,observeIntersection:n,canAutoLoad:b,canAutoPlay:S,uploadProgress:Z,lastSyncTime:o,dimensions:P,isProtected:l,onClick:m,onCancelUpload:I,isDownloading:g.includes(e.id),theme:f})})))}));function qa(){return qa=Object.assign||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},qa.apply(this,arguments)}let ja;const Ga=e=>{let{message:t,observeIntersection:n,canAutoLoad:s,lastSyncTime:r,isDownloading:c}=e;const l=(0,i.sO)(null),u=(0,i.sO)(null),m=(0,i.sO)(null),h=t.content.video,g=(0,Zn.Op)(l,n),[f,p]=(0,i.eJ)(s),v=Boolean(f&&g&&r),{mediaData:I,loadProgress:y}=(0,na.Z)((0,d.Ti)(t,"inline"),!v,(0,d.kG)(t,"inline"),r),{loadProgress:w}=(0,na.Z)((0,d.Ti)(t,"download"),!c,o.IU.BlobUrl,r),Z=sa(t,I),{isBuffered:P,bufferingHandlers:C}=(0,la.Z)(),b=f&&!P||c,S=!1===(0,Et.Z)(f),M=(0,Jn.Z)(I),{shouldRender:R,transitionClassNames:k}=(0,ye.Z)(b||!P,void 0,S),[N,T]=(0,i.eJ)(!1),[A,B]=(0,i.eJ)(0);(0,i.d4)((()=>{if(!N)return;const e=Lt.Rj/2,t=2*(e-6)*Math.PI,n=t-A*t,a=m.current,s=u.current,i=s.firstElementChild;i?i.firstElementChild.setAttribute("stroke-dashoffset",n.toString()):s.innerHTML=`\n <svg width="${Lt.Rj}px" height="${Lt.Rj}px">\n <circle cx="${e}" cy="${e}" r="${e-6}" class="progress-circle"\n transform="rotate(-90, ${e}, ${e})"\n stroke-dasharray="${t} ${t}"\n stroke-dashoffset="${t}"\n />\n </svg>`,B(a.currentTime/a.duration)}),[N,A]);const x=Boolean(I&&g),O=(0,i.I4)((()=>{m.current&&(T(!1),B(0),(0,Qn.Z)(m.current),(0,E.T2)((()=>{u.current.innerHTML=""})))}),[]),U=(0,i.I4)((()=>{var e;null===(e=ja)||void 0===e||e(),ja=O}),[O]);(0,i.d4)((()=>{m.current&&(x?(0,Qn.Z)(m.current):m.current.pause())}),[x]),ua(m,x),(0,da.Z)(m,[I]);const F=(0,i.I4)((()=>{if(!I)return void p((e=>!e));if(c)return void(0,a.Sv)().cancelMessageMediaDownload({message:t});const e=m.current;N?e.paused?((0,Qn.Z)(e),(0,_t.Es)()):e.pause():(U(),e.pause(),e.currentTime=0,(0,Qn.Z)(e),(0,_t.Es)(),T(!0))}),[U,N,c,I,t]),D=(0,i.I4)((e=>{const t=e.currentTarget;B(t.currentTime/t.duration)}),[]),$=(0,fe.Z)("full-media",M);return i.ZP.createElement("div",{ref:l,className:"RoundVideo media-inner",onClick:F},i.ZP.createElement("div",{className:"thumbnail-wrapper"},i.ZP.createElement("canvas",{ref:Z,className:"thumbnail",style:`width: ${Lt.Rj}px; height: ${Lt.Rj}px`})),I&&i.ZP.createElement("div",{className:"video-wrapper"},i.ZP.createElement("video",qa({ref:m,className:$,width:Lt.Rj,height:Lt.Rj,autoPlay:!0,muted:!N,loop:!N,playsInline:!0,onEnded:N?O:void 0},C,{onTimeUpdate:N?D:void 0}),i.ZP.createElement("source",{src:I}))),i.ZP.createElement("div",{className:"progress",ref:u}),R&&i.ZP.createElement("div",{className:`media-loading ${k}`},i.ZP.createElement(ra.Z,{progress:c?w:y})),!I&&!f&&i.ZP.createElement("i",{className:"icon-download"}),i.ZP.createElement("div",{className:"message-media-duration"},N?(0,L.k9)(m.current.currentTime):(0,L.k9)(h.duration),(!N||m.current.paused)&&i.ZP.createElement("i",{className:"icon-muted"})))},Ha=e=>{let{message:t,onClick:n}=e;const a=(0,Fe.Z)();return i.ZP.createElement("div",{className:"InlineButtons"},t.inlineButtons.map((e=>i.ZP.createElement("div",{className:"row"},e.map((e=>i.ZP.createElement(ze.Z,{size:"tiny",ripple:!0,disabled:"NOT_SUPPORTED"===e.type,onClick:()=>n({button:e})},(0,tn.Z)(a(e.text)),"buy"===e.type&&i.ZP.createElement("i",{className:"icon-card"}),"url"===e.type&&!e.value.match(s.FS)&&i.ZP.createElement("i",{className:"icon-arrow-right"}))))))))},_a=(0,i.X$)((e=>{let{threadInfo:t,disabled:n}=e;const{openChat:s}=(0,a.Sv)(),o=(0,Fe.Z)(),{threadId:r,chatId:c,messagesCount:l,lastMessageId:u,lastReadInboxMessageId:m,recentReplierIds:h}=t,g=(0,i.I4)((()=>{s({id:c,threadId:r})}),[s,c,r]),f=(0,i.Ye)((()=>{if(null==h||!h.length)return;const{users:{byId:e},chats:{byId:t}}=(0,a.Rd)();return h.map((n=>(0,d.YC)(n)?e[n]:t[n])).filter(Boolean)}),[h]);if(void 0===l)return;const p=Boolean(m&&u&&m<u);return i.ZP.createElement("div",{"data-cnt":(0,ke.bi)(l),className:(0,fe.Z)("CommentButton",p&&"has-unread",n&&"disabled"),dir:o.isRtl?"rtl":"ltr",onClick:g},i.ZP.createElement("i",{className:"icon-comments-sticker"}),(!f||0===f.length)&&i.ZP.createElement("i",{className:"icon-comments"}),f&&f.length>0&&i.ZP.createElement("div",{className:"recent-repliers",dir:o.isRtl?"rtl":"ltr"},f.map((e=>i.ZP.createElement(on.Z,{key:e.id,size:"small",user:(0,d.YC)(e.id)?e:void 0,chat:(0,d.YC)(e.id)?void 0:e})))),i.ZP.createElement("div",{className:"label",dir:"auto"},l?o("Comments",l,"i"):o("LeaveAComment")),i.ZP.createElement("i",{className:"icon-next"}))})),za=(0,i.X$)((e=>{let{reaction:t,message:n,activeReaction:s,availableReactions:o}=e;const{sendReaction:r}=(0,a.Sv)(),{recentReactions:c}=n.reactions,l=(0,i.Ye)((()=>{if(!c||t.count>3)return;const e=(0,a.Rd)().users.byId;return c.filter((e=>e.reaction===t.reaction)).map((t=>e[t.userId])).filter(Boolean)}),[t,c]),d=(0,i.I4)((()=>{r({reaction:t.isChosen?void 0:t.reaction,chatId:n.chatId,messageId:n.id})}),[n,t,r]);return i.ZP.createElement(ze.Z,{className:(0,fe.Z)(t.isChosen&&"chosen"),size:"tiny",onClick:d},i.ZP.createElement(Wn,{activeReaction:s,reaction:t.reaction,availableReactions:o}),null!=l&&l.length?i.ZP.createElement("div",{className:"avatars"},l.map((e=>i.ZP.createElement(on.Z,{user:e,size:"micro"})))):(0,ke.bi)(t.count))})),Va=(0,i.X$)((e=>{let{message:t,isOutside:n,activeReaction:a,availableReactions:s,metaChildren:o}=e;return i.ZP.createElement("div",{className:(0,fe.Z)("Reactions",n&&"is-outside")},t.reactions.results.map((e=>i.ZP.createElement(za,{key:e.reaction,reaction:e,message:t,activeReaction:a,availableReactions:s}))),o)}));var Ka=n(7324),Xa=n(5296);const Wa=(0,i.X$)((e=>{let{localSticker:t,localEffect:n,isOwn:a,soundId:s,size:o="medium",observeIntersection:r,messageId:c,chatId:l,activeEmojiInteractions:d}=e;const{playKey:u,ref:m,style:h,width:g,handleClick:f,markAnimationLoaded:p}=(0,Xa.Z)(o,l,c,s,d,a,n),v=`local_emoji_${t}`,I=(0,Zn.Op)(m,r),[y,w]=(0,i.eJ)();return(0,i.d4)((()=>{t&&(0,Ka.Z)(t).then((e=>{w(e)}))}),[t]),i.ZP.createElement("div",{ref:m,className:"AnimatedEmoji media-inner",style:h,onClick:f},y&&i.ZP.createElement(Xn.Z,{key:v,id:v,animationData:y,size:g,quality:1,play:I&&u,forceOnHeavyAnimation:!0,noLoop:!0,onLoad:p}))})),Ya={__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>'},Ja={__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>'},Qa=(0,i.X$)((0,a.c$)(((e,t)=>{const{focusedMessage:n,forwardMessages:a,lastSyncTime:s,serverTimeOffset:i}=e,{message:o,album:r,withSenderName:l,withAvatar:u,threadId:m,messageListType:h,isLastInDocumentGroup:g}=t,{id:f,chatId:p,viaBotId:v,replyToChatId:I,replyToMessageId:y,isOutgoing:w,threadInfo:Z}=o,P=(0,c.Z1)(e,p),C=(0,c.FM)(e,p),b=(0,d.pK)(p),S=P&&(0,d.eA)(P),E=null==P?void 0:P.username,M=!C&&(0,d.Ul)(o),R=l||u||M,k=(0,c.Ur)(e,o),N=(0,c.cv)(e,o),T=v?(0,c.dy)(e,v):void 0,A=m?(0,c.qS)(e,p,m):void 0,B=o.id===A,x=y===A,L=y&&!x?(0,c.hj)(e,b&&I?I:p,y):void 0,O=L&&(0,c.Ur)(e,L),U=(0,c.uZ)(e,o),F="thread"===h&&(r?r.messages.some((t=>(0,c._X)(e,t))):(0,c._X)(e,o)),{direction:D,noHighlight:$,isResizingContainer:q}=F&&n||{},j=a.messageIds&&a.messageIds.includes(f),{query:G}=(0,c.n5)(e)||{},H=(0,d._O)(o);let _;_=null!=r&&r.messages?r.messages.every((t=>{let{id:n}=t;return(0,c.vk)(e,n)})):(0,c.vk)(e,f);const{canReply:z}="thread"===h&&(0,c._k)(e,o,m)||{},V=(0,c.te)(e,o),K=Z?(0,c.tZ)(e,Z.chatId,Z.threadId)||Z:void 0,X=Boolean(o.groupedId)&&!o.isInAlbum,W=X?(0,c.xH)(e,p,o.groupedId)[0]:void 0,Y=X?g?(0,c.hj)(e,p,W):void 0:o,J=H?(0,c.CP)(e,H):void 0;return{theme:(0,c.Pu)(e),chatUsername:E,forceSenderName:M,sender:k,canShowSender:R,originSender:N,botSender:T,shouldHideReply:x,isThreadTop:B,replyMessage:L,replyMessageSender:O,isInDocumentGroup:X,isProtected:(0,c.EV)(e,o),isFocused:F,isForwarding:j,reactionMessage:Y,isChatWithSelf:C,isRepliesChat:b,isChannel:S,canReply:z,lastSyncTime:s,serverTimeOffset:i,highlight:G,isSingleEmoji:Boolean(H),animatedEmoji:H?(0,c.zB)(e,H):void 0,animatedEmojiEffect:H&&(0,d.YC)(p)?(0,c.tH)(e,H):void 0,animatedEmojiSoundId:H?(0,c.Oh)(e,H):void 0,localSticker:J,localEffect:J&&(0,d.YC)(p)?(0,c.cu)(J):void 0,isInSelectMode:(0,c.CA)(e),isSelected:_,isGroupSelected:Boolean(o.groupedId)&&!o.isInAlbum&&(0,c.a6)(e,p,o.groupedId),threadId:m,isDownloading:V,isPinnedList:"pinned"===h,canAutoLoadMedia:(0,c.bH)(e,o),canAutoPlayMedia:(0,c.__)(e,o),autoLoadFileMaxSizeMb:e.settings.byKey.autoLoadFileMaxSizeMb,shouldLoopStickers:(0,c.yB)(e),threadInfo:K,availableReactions:e.availableReactions,defaultReaction:(0,d.CI)(o)?void 0:(0,c.q6)(e,p),activeReaction:Y&&e.activeReactions[Y.id],activeEmojiInteractions:e.activeEmojiInteractions,...w&&{outgoingStatus:(0,c.dT)(e,o,"scheduled"===h)},..."number"==typeof U&&{uploadProgress:U},...F&&{focusDirection:D,noFocusHighlight:$,isResizingContainer:q}}}))((e=>{let{message:t,chatUsername:n,observeIntersectionForBottom:s,observeIntersectionForMedia:r,observeIntersectionForAnimatedStickers:c,album:l,noAvatars:u,withAvatar:g,withSenderName:p,areReactionsInMeta:v,noComments:I,appearanceOrder:y,isFirstInGroup:w,isLastInGroup:Z,isFirstInDocumentGroup:P,isLastInDocumentGroup:C,isLastInList:b,theme:S,forceSenderName:E,sender:M,canShowSender:R,originSender:k,botSender:N,isThreadTop:T,shouldHideReply:A,replyMessage:B,replyMessageSender:x,outgoingStatus:L,uploadProgress:O,isInDocumentGroup:U,isProtected:F,isFocused:D,focusDirection:$,noFocusHighlight:q,isResizingContainer:j,isForwarding:G,isChatWithSelf:H,isRepliesChat:_,isChannel:z,canReply:V,lastSyncTime:K,serverTimeOffset:X,highlight:W,animatedEmoji:Y,localSticker:J,localEffect:Q,animatedEmojiEffect:ee,animatedEmojiSoundId:te,isInSelectMode:ne,isSelected:ae,isGroupSelected:se,threadId:ie,reactionMessage:oe,availableReactions:re,defaultReaction:ce,activeReaction:le,activeEmojiInteractions:de,messageListType:ue,isPinnedList:me,isDownloading:he,canAutoLoadMedia:ge,canAutoPlayMedia:pe,shouldLoopStickers:ve,autoLoadFileMaxSizeMb:Ie,threadInfo:we}=e;const{toggleMessageSelection:Ze,clickInlineButton:Pe,disableContextMenuHint:Ce}=(0,a.Sv)(),be=(0,i.sO)(null),Se=(0,i.sO)(null),Ee=(0,i.sO)(null),Me=(0,Fe.Z)();(0,Zn._N)(Se,s);const{isContextMenuOpen:Re,contextMenuPosition:ke,handleBeforeContextMenu:Ne,handleContextMenu:Te,handleContextMenuClose:Ae,handleContextMenuHide:Be}=(0,bn.Z)(be,h.$b&&ne,!0,h.wZ);(0,i.d4)((()=>{Re&&Ce()}),[Re,Ce]);const xe=y<=0,[Le,Ue]=(0,Oe.Z)(xe);(0,i.d4)((()=>{xe||setTimeout(Ue,10*y)}),[y,Ue,xe]);const{transitionClassNames:De}=(0,ye.Z)(Le,void 0,xe,!1),{id:$e,chatId:qe,forwardInfo:je,viaBotId:Ge}=t,He=(0,d.CI)(t),_e=(0,d.B4)(t),Ve="scheduled"===ue||t.isScheduled,Ke=(0,d.ss)(t)&&!A,Xe=Boolean(we)&&"thread"===ue,We=(0,d.$D)(t),Ye=J||Y,Je=(null==oe?void 0:oe.reactions)&&!(0,d.JE)(oe.reactions),Qe=je&&(!H||Ve)&&!_&&!je.isLinkedChannelPost&&!We,et=Boolean(l)&&l.messages.length>1,tt=U&&!P,nt=U&&!C,at=void 0!==ke,st=!(at||ne||G||nt),it=z&&!Ve&&!F,ot=Boolean(me||je&&(je.isChannelPost||H&&!_e||_)&&je.fromMessageId),rt=we&&!nt&&"thread"===ue&&!I,ct=!h.$b&&!ne&&ce&&!nt,lt=(0,i.I4)(((e,t)=>{Ze({messageId:$e,groupedId:t,...(null==e?void 0:e.shiftKey)&&{withShift:!0},...et&&{childMessageIds:l.messages.map((e=>{let{id:t}=e;return t}))}})}),[Ze,$e,et,l]),dt=R?M:void 0,ut=je&&(H||_||!dt)?k:dt,mt=je?k:dt,{handleMouseDown:ht,handleClick:gt,handleContextMenu:ft,handleDoubleClick:pt,handleContentDoubleClick:vt,handleMouseMove:It,handleSendQuickReaction:yt,handleMouseLeave:wt,isSwiped:Zt,isQuickReactionVisible:Pt,handleDocumentGroupMouseEnter:Ct}=Fn(lt,be,$e,0,Boolean(ne),Boolean(V),Boolean(F),Te,Ne,qe,at,Ee,_e,nt),{handleAvatarClick:bt,handleSenderClick:St,handleViaBotClick:Et,handleReplyClick:Mt,handleMediaClick:Rt,handleAudioPlay:Nt,handleAlbumMediaClick:Tt,handleMetaClick:At,handleReadMedia:Bt,handleCancelUpload:xt,handleVoteSend:Ot,handleGroupForward:Ut,handleForward:Ft,handleFocus:Dt,handleFocusForwarded:$t,handleDocumentGroupSelectAll:jt}=function(e,t,n,s,r,c,l,d,u,h,g,f,p){const{openChat:v,showNotification:I,focusMessage:y,openMediaViewer:w,openAudioPlayer:Z,markMessagesRead:P,cancelSendingMessage:C,sendPollVote:b,openForwardMenu:S,focusMessageInComments:E}=(0,a.Sv)(),{id:M,forwardInfo:R,replyToMessageId:k,replyToChatId:N,replyToTopMessageId:T,groupedId:A}=n,B=(0,i.I4)((()=>{g&&v({id:g.id})}),[g,v]),x=(0,i.I4)((()=>{f?l&&null!=R&&R.channelPostId?y({chatId:f.id,messageId:R.channelPostId}):v({id:f.id}):I({message:e("HidAccount")})}),[l,y,R,e,v,f,I]),L=(0,i.I4)((()=>{p&&v({id:p.id})}),[p,v]),O=(0,i.I4)((()=>{y({chatId:u&&N?N:s,threadId:r,messageId:k,replyMessageId:u&&N?void 0:M})}),[y,u,N,s,r,k,M]),U=(0,i.I4)((()=>{w({chatId:s,threadId:r,messageId:M,origin:d?m.bZ.ScheduledInline:m.bZ.Inline})}),[s,r,M,w,d]),F=(0,i.I4)((()=>{Z({chatId:s,messageId:M})}),[s,M,Z]),D=(0,i.I4)((e=>{w({chatId:s,threadId:r,messageId:e,origin:d?m.bZ.ScheduledAlbum:m.bZ.Album})}),[s,r,w,d]),$=(0,i.I4)((()=>{P({messageIds:[M]})}),[M,P]),q=(0,i.I4)((()=>{C({chatId:s,messageId:M})}),[C,s,M]),j=(0,i.I4)((e=>{b({chatId:s,messageId:M,options:e})}),[s,M,b]),G=(0,i.I4)((()=>{S({fromChatId:s,groupedId:A})}),[S,s,A]),H=(0,i.I4)((()=>{if(h&&h.messages){const e=h.messages.map((e=>{let{id:t}=e;return t}));S({fromChatId:s,messageIds:e})}else S({fromChatId:s,messageIds:[M]})}),[h,S,s,M]),_=(0,i.I4)((()=>{y({chatId:s,threadId:o._f,messageId:M})}),[y,s,M]),z=(0,i.I4)((()=>{c?y({chatId:R.fromChatId,groupedId:A,groupedChatId:s}):u&&N?E({chatId:N,threadId:T,messageId:R.fromMessageId}):y({chatId:R.fromChatId,messageId:R.fromMessageId})}),[c,u,N,y,R,A,s,E,T]),V=(0,i.I4)((e=>{e.stopPropagation(),t(e,A)}),[t,A]);return{handleAvatarClick:B,handleSenderClick:x,handleViaBotClick:L,handleReplyClick:O,handleMediaClick:U,handleAudioPlay:F,handleAlbumMediaClick:D,handleMetaClick:V,handleReadMedia:$,handleCancelUpload:q,handleVoteSend:j,handleGroupForward:G,handleForward:H,handleFocus:_,handleFocusForwarded:z,handleDocumentGroupSelectAll:V}}(Me,lt,t,qe,ie,U,Qe,Ve,_,l,ut,mt,N),Gt=(0,fe.Z)("Message message-list-item",w&&"first-in-group",F&&"is-protected",Z&&"last-in-group",P&&"first-in-document-group",C&&"last-in-document-group",b&&"last-in-list",_e&&"own",Boolean(t.views)&&"has-views",t.isEdited&&"was-edited",Ke&&"has-reply",at&&"has-menu-open",D&&!q&&"focused",G&&"is-forwarding",t.isDeleting&&"is-deleting",U&&"is-in-document-group",et&&"is-album",t.hasUnreadMention&&"has-unread-mention",ae&&"is-selected",ne&&"is-in-selection-mode",T&&"is-thread-top",Boolean(t.inlineButtons)&&"has-inline-buttons",Zt&&"is-swiped",De,Boolean(le)&&"has-active-reaction"),{text:Ht,photo:_t,video:zt,audio:Vt,voice:Kt,document:Xt,sticker:Wt,contact:Yt,poll:Jt,webPage:Qt,invoice:en,location:nn}=(0,d.qp)(t),an=function(e){let{hasReply:t,customShape:n,isLastInGroup:a,asForwarded:s,hasThread:i,forceSenderName:o,hasComments:r,hasActionButton:c,hasReactions:l,isGeoLiveActive:u}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{text:m,photo:h,video:g,audio:f,voice:p,document:v,poll:I,webPage:y,contact:w,location:Z}=(0,d.qp)(e),P=["message-content"],C=h||g||Z,b=m||"venue"===(null==Z?void 0:Z.type)||u,S=C&&!b,E=Boolean(e.viaBotId);return Sn(n)?P.push(`emoji-only emoji-only-${n}`):b&&P.push("text"),c&&P.push("has-action-button"),n&&(P.push("custom-shape"),null!=g&&g.isRound&&P.push("round"),r&&P.push("has-comments")),C?P.push("media"):f?P.push("audio"):p?P.push("voice"):v?P.push("document"):w?P.push("contact"):I?P.push("poll"):y&&(P.push("web-page"),(y.photo||y.video)&&P.push("media")),s&&P.push("is-forwarded"),t&&P.push("is-reply"),i&&P.push("has-replies"),l&&P.push("has-reactions"),E&&P.push("is-via-bot"),o&&P.push("force-sender-name"),n||(P.push("has-shadow"),C&&r&&P.push("has-background"),(t||s||!S||E||o)&&P.push("has-solid-background"),a&&(h||Z&&!b||!S)&&P.push("has-appendix")),P.join(" ")}(t,{hasReply:Ke,customShape:We,isLastInGroup:Z,asForwarded:Qe,hasThread:Xe,forceSenderName:E,hasComments:we&&(null==we?void 0:we.messagesCount)>0,hasActionButton:it||ot,hasReactions:Je,isGeoLiveActive:"geoLive"===(null==nn?void 0:nn.type)&&!(0,d.$R)(t,(0,f.b)(X))}),sn=an.includes("has-appendix"),rn=(0,qt.X)(t,W,Sn(We));let cn,ln;cn=nt?"none":!rn||Ye||Qt?"standalone":"in-text",v?ln="in-meta":Je?We||(_t||zt||Ye)&&!rn?ln="outside":Qe?(cn="standalone",ln="inside"):ln="inside":ln="none",(0,kt.Z)(_&&t.replyToChatId?t.replyToChatId:qe,Ke?t.replyToMessageId:void 0,B,t.id),xn(be,qe,D,$,q,j);let dn,un="",mn=!1;const hn=(0,i.Ye)((()=>et?Tn(_e,Boolean(Qe),Boolean(u),l):void 0),[et,_e,Qe,u,l]),gn=Qe?28:0;if(et||!_t&&!zt)hn&&(dn=Math.max(En(Boolean(Ht),rt),hn.containerStyle.width),dn-hn.containerStyle.width>18&&(mn=!0));else{let e;_t?e=Mn(t,u).width:zt&&(e=zt.isRound?Lt.Rj:Mn(t,u).width),e&&(dn=Math.max(En(Boolean(Ht),rt),e),dn-e>18&&(mn=!0))}dn&&(un=`width: ${dn+gn}px`);const fn=z&&t.adminTitle||!Qe&&(null==je?void 0:je.adminTitle)||void 0,pn=(0,i.Ye)((()=>fn?Bn(fn):void 0),[fn]);function vn(){const e=i.ZP.createElement(Yn,{message:t,reactionMessage:oe,outgoingStatus:L,signature:fn,withReactions:"in-meta"===ln,withReactionOffset:"inside"===ln,availableReactions:re,activeReaction:le,onClick:At});return"inside"!==ln?e:i.ZP.createElement(Va,{activeReaction:le,message:oe,metaChildren:e,availableReactions:re})}return i.ZP.createElement("div",{ref:be,id:(0,d.d0)(t.id),className:Gt,style:pn?`--meta-safe-author-width: ${pn}px`:void 0,"data-message-id":$e,onMouseDown:ht,onClick:gt,onContextMenu:ft,onDoubleClick:pt,onMouseEnter:nt?Ct:void 0,onMouseMove:ct?It:void 0,onMouseLeave:ct||nt?wt:void 0},i.ZP.createElement("div",{ref:Se,className:"bottom-marker","data-message-id":$e,"data-last-message-id":l?l.messages[l.messages.length-1].id:void 0,"data-has-unread-mention":t.hasUnreadMention}),!U&&i.ZP.createElement("div",{className:"message-select-control"},ae&&i.ZP.createElement("i",{className:"icon-select"})),C&&i.ZP.createElement("div",{className:(0,fe.Z)("message-select-control group-select",se&&"is-selected"),onClick:jt},se&&i.ZP.createElement("i",{className:"icon-select"})),g&&function(){const e=ut&&(0,d.YC)(ut.id),t=ut&&e?ut:void 0,n=ut&&!e?ut:void 0,a=!ut&&je?je.hiddenUserName:void 0;return i.ZP.createElement(on.Z,{size:"small",user:t,chat:n,text:a,lastSyncTime:K,onClick:t||n?bt:void 0})}(),i.ZP.createElement("div",{className:(0,fe.Z)("message-content-wrapper",an.includes("text")&&"can-select-text")},i.ZP.createElement("div",{ref:Ee,className:an,style:un,dir:"auto"},Qe&&!tt&&i.ZP.createElement("div",{className:"message-title"},Me("ForwardedMessage")),function(){const e=(0,fe.Z)("content-inner",Qe&&"forwarded-message",Ke&&"reply-message",mn&&"no-media-corners"),n=Z&&!rn&&!Qe&&!Xe,a=(0,fe.Z)("text-content","in-text"===cn&&"with-meta",L&&"with-outgoing-icon");return i.ZP.createElement("div",{className:e,onDoubleClick:vt,dir:"auto"},function(){if(We&&!Ge||!(p&&!(_t||zt||nn)||Qe||Ge||E)||tt||Ke&&We)return;let e,n;return!mt||We&&Ge?null!=je&&je.hiddenUserName&&(e=je.hiddenUserName):(e=(0,d.OU)(Me,mt),Qe||(n=`color-${(0,d.Rs)(mt)}`)),i.ZP.createElement("div",{className:"message-title",dir:"ltr"},e?i.ZP.createElement("span",{className:(0,fe.Z)("interactive",n),onClick:St,dir:"auto"},(0,tn.Z)(e)):N?void 0:" ",N&&i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement("span",{className:"via"},Me("ViaBot")),i.ZP.createElement("span",{className:"interactive",onClick:Et},(0,tn.Z)(`@${N.username}`))),null!=je&&je.isLinkedChannelPost?i.ZP.createElement("span",{className:"admin-title",dir:"auto"},Me("DiscussChannel")):t.adminTitle&&!z?i.ZP.createElement("span",{className:"admin-title",dir:"auto"},t.adminTitle):void 0)}(),Ke&&i.ZP.createElement(Hn,{message:B,isProtected:F,sender:x,observeIntersection:r,onClick:Mt}),Wt&&i.ZP.createElement(ea,{message:t,observeIntersection:r,observeIntersectionForPlaying:c,shouldLoop:ve,lastSyncTime:K}),Y&&i.ZP.createElement(ta.Z,{size:"small",isOwn:_e,sticker:Y,effect:ee,soundId:te,observeIntersection:r,lastSyncTime:K,forceLoadPreview:He,messageId:$e,chatId:qe,activeEmojiInteractions:de}),J&&i.ZP.createElement(Wa,{size:"small",isOwn:_e,localSticker:J,localEffect:Q,soundId:te,observeIntersection:r,lastSyncTime:K,forceLoadPreview:He,messageId:$e,chatId:qe,activeEmojiInteractions:de}),et&&i.ZP.createElement($a,{album:l,albumLayout:hn,observeIntersection:r,isOwn:_e,isProtected:F,hasCustomAppendix:n,lastSyncTime:K,onMediaClick:Tt}),!et&&_t&&i.ZP.createElement(ca,{message:t,observeIntersection:r,noAvatars:u,canAutoLoad:ge,uploadProgress:O,shouldAffectAppendix:n,onClick:Rt,onCancelUpload:xt,isDownloading:he,isProtected:F,theme:S}),!et&&zt&&zt.isRound&&i.ZP.createElement(Ga,{message:t,observeIntersection:r,canAutoLoad:ge,lastSyncTime:K,isDownloading:he}),!et&&zt&&!zt.isRound&&i.ZP.createElement(ha,{message:t,observeIntersection:r,noAvatars:u,canAutoLoad:ge,canAutoPlay:pe,uploadProgress:O,lastSyncTime:K,onClick:Rt,onCancelUpload:xt,isDownloading:he,isProtected:F}),(Vt||Kt)&&i.ZP.createElement(zn.Z,{theme:S,message:t,origin:m.Cr.Inline,uploadProgress:O,lastSyncTime:K,isSelectable:U,isSelected:ae,onPlay:Nt,onReadMedia:!Kt||_e&&!H?void 0:Bt,onCancelUpload:xt,isDownloading:he}),Xt&&i.ZP.createElement(_n.Z,{message:t,observeIntersection:r,canAutoLoad:ge,autoLoadFileMaxSizeMb:Ie,uploadProgress:O,isSelectable:U,isSelected:ae,onMediaClick:Rt,onCancelUpload:xt,isDownloading:he}),Yt&&i.ZP.createElement(fa,{contact:Yt}),Jt&&i.ZP.createElement(Pa,{message:t,poll:Jt,onSendVote:Ot}),!Ye&&rn&&i.ZP.createElement("p",{className:a,dir:"auto"},rn,"in-text"===cn&&vn()),Qt&&i.ZP.createElement(Sa,{message:t,observeIntersection:r,noAvatars:u,canAutoLoad:ge,canAutoPlay:pe,lastSyncTime:K,onMediaClick:Rt,onCancelMediaTransfer:xt,isDownloading:he,isProtected:F,theme:S}),en&&i.ZP.createElement(Ma,{message:t}),nn&&i.ZP.createElement(Oa,{message:t,lastSyncTime:K,isInSelectMode:ne,isSelected:ae,theme:S,peer:M,serverTimeOffset:X}))}(),!nt&&"standalone"===cn&&vn(),st&&it?i.ZP.createElement(ze.Z,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:Me("lng_context_forward_msg"),onClick:C?Ut:Ft},i.ZP.createElement("i",{className:"icon-share-filled"})):st&&ot?i.ZP.createElement(ze.Z,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:"Focus message",onClick:me?Dt:$t},i.ZP.createElement("i",{className:"icon-arrow-right"})):void 0,rt&&i.ZP.createElement(_a,{threadInfo:we,disabled:I}),sn&&i.ZP.createElement("div",{className:"svg-appendix",dangerouslySetInnerHTML:_e?Ya:Ja}),ct&&i.ZP.createElement("div",{className:(0,fe.Z)("quick-reaction",Pt&&!le&&"visible"),onClick:yt},i.ZP.createElement(Kn.Z,{reaction:ce}))),t.inlineButtons&&i.ZP.createElement(Ha,{message:t,onClick:Pe}),"outside"===ln&&i.ZP.createElement(Va,{message:oe,isOutside:!0,activeReaction:le,availableReactions:re})),ke&&i.ZP.createElement(jn,{isOpen:Re,anchor:ke,message:t,album:l,chatUsername:n,messageListType:ue,onClose:Ae,onCloseAnimationEnd:Be}))}))),es=(0,i.X$)((0,a.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,c.fS)(e,n),{chatId:s,isBot:i}=a||{};return{message:a,bot:s&&i?(0,c.dy)(e,s):void 0,channel:!i&&s?(0,c.Z1)(e,s):void 0}}))((e=>{let{chatId:t,message:n,containerRef:s,bot:o,channel:r}=e;const{viewSponsoredMessage:c,openChat:l,openChatByInvite:u,startBot:m,focusMessage:h}=(0,a.Sv)(),g=(0,Fe.Z)(),f=(0,i.sO)(null),p=Boolean(n),{observe:v}=(0,Zn.S1)({rootRef:s,debounceMs:200,threshold:1});(0,i.d4)((()=>p?v(f.current,(e=>{e.isIntersecting&&c({chatId:t})})):void 0),[t,p,v,c]);const I=(0,i.I4)((()=>{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})))}),[h,n,l,u,m]);if(n)return i.ZP.createElement("div",{className:"SponsoredMessage Message open",key:"sponsored-message"},i.ZP.createElement("div",{className:"message-content has-shadow has-solid-background",dir:"auto"},i.ZP.createElement("div",{className:"content-inner",dir:"auto"},i.ZP.createElement("div",{className:"message-title",dir:"ltr"},o&&(0,tn.Z)((0,d.Js)(o)||""),r&&(0,tn.Z)(n.chatInviteTitle||(0,d.U)(g,r,o)||"")),i.ZP.createElement("p",{className:"text-content with-meta",dir:"auto",ref:f},i.ZP.createElement("span",{className:"text-content-inner",dir:"auto"},(0,pa.H)(n.text.text,n.text.entities)),i.ZP.createElement("span",{className:"MessageMeta",dir:"ltr"},i.ZP.createElement("span",{className:"message-signature"},g("SponsoredMessage")))),i.ZP.createElement(ze.Z,{color:"secondary",size:"tiny",ripple:!0,onClick:I,className:"SponsoredMessage__button"},g(n.isBot?"Conversation.ViewBot":n.channelPostId?"Conversation.ViewPost":"Conversation.ViewChannel")))))}))),ts=(0,i.X$)((e=>{let{chatId:t,messageIds:n,messageGroups:o,isViewportNewest:r,isUnread:c,withUsers:l,areReactionsInMeta:u,noAvatars:f,containerRef:p,anchorIdRef:v,memoUnreadDividerBeforeIdRef:I,memoFirstUnreadIdRef:y,threadId:w,type:Z,isReady:P,isScrollingRef:C,isScrollPatchNeededRef:b,threadTopMessageId:S,hasLinkedChat:M,isSchedule:R,noAppearanceAnimation:k,onFabToggle:N,onNotchToggle:T}=e;const{openHistoryCalendar:A}=(0,a.Sv)(),{observeIntersectionForMedia:B,observeIntersectionForReading:x,observeIntersectionForAnimatedStickers:O}=function(e,t,n){const{markMessageListRead:s,markMessagesRead:i}=(0,a.Sv)(),{observe:o}=(0,Zn.S1)({rootRef:t,throttleMs:Pn,margin:Cn}),{observe:r,freeze:c,unfreeze:l}=(0,Zn.S1)({rootRef:t,throttleMs:150},(t=>{if("thread"!==e)return;let a=0;const o=[];t.forEach((e=>{const{isIntersecting:t,target:n}=e;if(!t)return;const{dataset:s}=n,i=Number(s.lastMessageId||s.messageId);i>a&&(a=i),s.hasUnreadMention&&o.push(i)})),n.current&&a>=n.current&&s({maxId:a}),o.length&&i({messageIds:o})}));(0,we.Z)(c,l);const{observe:d}=(0,Zn.S1)({rootRef:t,throttleMs:Pn});return{observeIntersectionForMedia:o,observeIntersectionForReading:r,observeIntersectionForAnimatedStickers:d}}(Z,p,y),{backwardsTriggerRef:U,forwardsTriggerRef:F,fabTriggerRef:D}=function(e,t,n,o,r,c,l,d,u,g){const{loadViewportMessages:f}=(0,a.Sv)(),[p,v]=(0,i.Ye)((()=>"thread"===e?[(0,E.Ds)((()=>f({direction:m.Uq.Backwards})),1e3,!0,!1),(0,E.Ds)((()=>f({direction:m.Uq.Forwards})),1e3,!0,!1)]:[]),[f,n]),I=(0,i.sO)(null),y=(0,i.sO)(null),w=(0,i.sO)(null);function Z(){if(!d)return;if(!n||!n.length)return c(!1),void l(!1);if(!o)return c(!0),void l(!0);if(!t.current)return;const{offsetHeight:e,scrollHeight:a,scrollTop:s}=t.current,i=Math.round(a-s-e),u=i<=1;c(r?!u:!(i<=50)),l(!u)}const{observe:P}=(0,Zn.S1)({rootRef:t,margin:h.gZ},(e=>{if(!v||!p)return;if(n[0]>=s.AE)return;const t=e.find((e=>{let{isIntersecting:t}=e;return t}));if(!t)return;const{target:a}=t;"backwards-trigger"===a.className?(h.i4&&u.current&&n.length<=s.hT&&(g.current=!0),p()):"forwards-trigger"===a.className&&v()}));(0,Zn._N)(I,P),(0,Zn._N)(y,P);const{observe:C,freeze:b,unfreeze:S}=(0,Zn.S1)({rootRef:t,margin:100},Z);(0,Zn._N)(w,C);const{observe:M,freeze:R,unfreeze:k}=(0,Zn.S1)({rootRef:t,margin:1},Z);return(0,Zn._N)(w,M),(0,Pe.Z)((()=>{d&&Z()}),[d]),(0,Pe.Z)((()=>{b(),R(),setTimeout((()=>{k(),S()}),250)}),[n]),{backwardsTriggerRef:I,forwardsTriggerRef:y,fabTriggerRef:w}}(Z,p,n,r,c,N,T,P,C,b),$=(0,Fe.Z)(),q=i.ZP.createElement("div",{className:(0,fe.Z)("unread-divider","local-action-message"),key:"unread-messages"},i.ZP.createElement("span",null,$("UnreadMessages"))),j=k?0:o.reduce(((e,t)=>e+(0,g.xH)(t.senderGroups).length),0);let G=0;const H=o.map(((e,t,n)=>{const a=e.senderGroups.map(((e,a,s)=>{if(1===e.length&&!hn(e[0])&&(0,d.Lo)(e[0])){const o=e[0],r=a===s.length-1&&t===n.length-1;return(0,g.oA)([o.id===I.current&&q,i.ZP.createElement(Gn,{key:o.id,message:o,observeIntersection:x,appearanceOrder:j-++G,isLastInList:r})])}let o;return(0,g.xH)(e.map(((r,c)=>{const m=hn(r)?r.mainMessage:r,h=hn(r)?r:void 0,p=(0,d.B4)(m),y=hn(r),P=e[c+1];m.previousLocalId&&v.current===(0,d.d0)(m.previousLocalId)&&(v.current=(0,d.d0)(m.id));const C=!y&&m.groupedId?m.groupedId:void 0,b=P&&!hn(P)?P.groupedId:void 0,E={isFirstInGroup:0===c,isLastInGroup:c===e.length-1,isFirstInDocumentGroup:Boolean(C&&C!==o),isLastInDocumentGroup:Boolean(C&&C!==b),isLastInList:c===e.length-1&&a===s.length-1&&t===n.length-1};o=C;const R=(0,d.KK)(m),k="scheduled"!==Z?R:`${m.date}_${R}`;return(0,g.oA)([m.id===I.current&&q,i.ZP.createElement(Qa,{key:k,message:m,observeIntersectionForBottom:x,observeIntersectionForMedia:B,observeIntersectionForAnimatedStickers:O,album:h,noAvatars:f,withAvatar:E.isLastInGroup&&l&&!p&&!(m.id===S),withSenderName:E.isFirstInGroup&&l&&!p,areReactionsInMeta:u,threadId:w,messageListType:Z,noComments:!1===M,appearanceOrder:j-++G,isFirstInGroup:E.isFirstInGroup,isLastInGroup:E.isLastInGroup,isFirstInDocumentGroup:E.isFirstInDocumentGroup,isLastInDocumentGroup:E.isLastInDocumentGroup,isLastInList:E.isLastInList}),m.id===S&&i.ZP.createElement("div",{className:"local-action-message",key:"discussion-started"},i.ZP.createElement("span",null,$("DiscussionStarted")))])})))}));return i.ZP.createElement("div",{className:"message-date-group",key:e.datetime,onMouseDown:fn.q,teactFastList:!0},i.ZP.createElement("div",{className:(0,fe.Z)("sticky-date",!R&&"interactive"),key:"date-header",onMouseDown:fn.q,onClick:R?void 0:()=>A({selectedAt:e.datetime})},i.ZP.createElement("span",{dir:"auto"},R&&e.originalDate===s.t4&&$("MessageScheduledUntilOnline"),R&&e.originalDate!==s.t4&&$("MessageScheduledOn",(0,L.j1)($,e.datetime,void 0,!0)),!R&&(0,L.j1)($,e.datetime))),(0,g.xH)(a))}));return i.ZP.createElement("div",{className:"messages-container",teactFastList:!0},i.ZP.createElement("div",{ref:U,key:"backwards-trigger",className:"backwards-trigger"}),(0,g.xH)(H),r&&i.ZP.createElement(es,{key:t,chatId:t,containerRef:p}),i.ZP.createElement("div",{ref:F,key:"forwards-trigger",className:"forwards-trigger"}),i.ZP.createElement("div",{ref:D,key:"fab-trigger",className:"fab-trigger"}))}));var ns=n(3547);const as=(0,i.X$)((0,a.c$)(((e,t)=>{let{userId:n}=t;const{stickers:a}=e.stickers.greeting,s=(0,d.db)(n)+(0,d.db)(e.currentUserId),i=null!=a&&a.length?a[s%a.length]:void 0,o=(0,c.Z1)(e,n);return o?{sticker:i,lastUnreadMessageId:o.lastMessage&&o.lastMessage.id!==o.lastReadInboxMessageId?o.lastMessage.id:void 0,connectionState:e.connectionState}:{}}))((e=>{let{sticker:t,connectionState:n,lastUnreadMessageId:s}=e;const{loadGreetingStickers:o,sendMessage:r,markMessageListRead:c}=(0,a.Sv)(),l=(0,Fe.Z)(),d=(0,i.sO)(null),{observe:u}=(0,Zn.S1)({rootRef:d,debounceMs:200});(0,i.d4)((()=>{t||"connectionStateReady"!==n||o()}),[n,o,t]),(0,i.d4)((()=>{"connectionStateReady"===n&&s&&c({maxId:s})}),[n,c,s]);const m=(0,i.I4)((e=>{e={...e,isPreloadedGlobally:!0},r({sticker:e})}),[r]);return i.ZP.createElement("div",{className:"ContactGreeting",ref:d},i.ZP.createElement("div",{className:"wrapper"},i.ZP.createElement("p",{className:"title",dir:"auto"},l("Conversation.EmptyPlaceholder")),i.ZP.createElement("p",{className:"description",dir:"auto"},l("Conversation.GreetingText")),i.ZP.createElement("div",{className:"sticker"},t&&i.ZP.createElement(ns.Z,{sticker:t,onClick:m,clickArg:t,observeIntersection:u,size:160,className:"large",noContextMenu:!0}))))}))),ss=(0,i.X$)((e=>{let{isChatWithSelf:t,type:n,isGroupChatJustCreated:a}=e;const s=(0,Fe.Z)();return"scheduled"===n?function(e){return i.ZP.createElement("div",{className:"empty"},i.ZP.createElement("span",null,e("ScheduledMessages.EmptyPlaceholder")))}(s):t?function(e){return i.ZP.createElement("div",{className:"NoMessages"},i.ZP.createElement("div",{className:"wrapper"},i.ZP.createElement("i",{className:"icon icon-cloud-download"}),i.ZP.createElement("h3",{className:"title"},e("Conversation.CloudStorageInfo.Title")),i.ZP.createElement("ul",{className:"description"},i.ZP.createElement("li",null,e("Conversation.ClousStorageInfo.Description1")),i.ZP.createElement("li",null,e("Conversation.ClousStorageInfo.Description2")),i.ZP.createElement("li",null,e("Conversation.ClousStorageInfo.Description3")),i.ZP.createElement("li",null,e("Conversation.ClousStorageInfo.Description4")))))}(s):a?function(e){return i.ZP.createElement("div",{className:"NoMessages"},i.ZP.createElement("div",{className:"wrapper",dir:e.isRtl?"rtl":void 0},i.ZP.createElement("h3",{className:"title"},e("EmptyGroupInfo.Title")),i.ZP.createElement("p",{className:"description"},e("EmptyGroupInfo.Subtitle")),i.ZP.createElement("ul",{className:"list-checkmarks"},i.ZP.createElement("li",null,e("EmptyGroupInfo.Line1")),i.ZP.createElement("li",null,e("EmptyGroupInfo.Line2")),i.ZP.createElement("li",null,e("EmptyGroupInfo.Line3")),i.ZP.createElement("li",null,e("EmptyGroupInfo.Line4")))))}(s):i.ZP.createElement("div",{className:"empty"},i.ZP.createElement("span",null,s("NoMessages")))})),is=(0,E.Ds)((e=>e()),200,!1),os=(0,i.X$)((0,a.c$)(((e,t)=>{let{chatId:n,threadId:a,type:s}=t;const i=(0,c.Z1)(e,n);if(!i)return{};const r=(0,c.$W)(e,n,a,s),l="scheduled"===s?(0,c.Fn)(e,n):(0,c.Zw)(e,n),u=(0,c.qS)(e,n,a);if(a!==o._f&&!(l&&u&&l[u]))return{};const{isRestricted:m,restrictionReason:h,lastMessage:g}=i,f=(0,c.G$)(e,n),p=a===o._f&&!r&&!i.unreadCount&&!f&&g&&!g.groupedId,v=(0,c.IK)(e,n);let I;return(0,c.pk)(e,n)&&(I=v.fullInfo?v.fullInfo.botDescription||"NoMessages":"Updating bot info..."),{isChatLoaded:!0,isRestricted:m,restrictionReason:h,isChannelChat:(0,d.eA)(i),isGroupChat:(0,d.Bf)(i),isCreator:i.isCreator,isChatWithSelf:(0,c.FM)(e,n),isRepliesChat:(0,d.pK)(n),isBot:Boolean(v),messageIds:r,messagesById:l,firstUnreadId:(0,c.It)(e,n,a),isViewportNewest:"thread"!==s||(0,c.b9)(e,n,a),threadFirstMessageId:(0,c.yZ)(e,n,a),focusingId:f,isSelectModeActive:(0,c.CA)(e),botDescription:I,threadTopMessageId:u,hasLinkedChat:i.fullInfo&&"linkedChatId"in i.fullInfo?Boolean(i.fullInfo.linkedChatId):void 0,lastSyncTime:e.lastSyncTime,...p&&{lastMessage:g}}}))((e=>{var t,n,o,r,l,u;let{chatId:f,threadId:p,type:v,hasTools:I,onFabToggle:y,onNotchToggle:w,isChatLoaded:Z,isChannelChat:P,isGroupChat:C,canPost:b,isReady:S,isChatWithSelf:M,isRepliesChat:R,isCreator:k,isBot:N,messageIds:T,messagesById:A,firstUnreadId:B,isViewportNewest:x,threadFirstMessageId:L,isRestricted:O,restrictionReason:U,focusingId:F,isSelectModeActive:D,lastMessage:$,botDescription:q,threadTopMessageId:j,hasLinkedChat:G,lastSyncTime:H,withBottomShift:_}=e;const{loadViewportMessages:z,setScrollOffset:V,loadSponsoredMessages:K,loadMessageReactions:X,copyMessagesByIds:W}=(0,a.Sv)(),Y=(0,i.sO)(null),J=(0,i.sO)("thread"===v&&(0,c.Vt)((0,a.Rd)(),f,p)||0),Q=(0,i.sO)(),ee=(0,i.sO)(),te=(0,i.sO)(),ne=(0,i.sO)(),ae=(0,i.sO)(),se=(0,i.sO)(),ie=(0,i.sO)(!1),oe=(0,i.sO)(Boolean($)),[re,ce]=(0,i.eJ)(),le=Boolean(T);(0,Pe.Z)((()=>{le&&(0,E.R3)((()=>{oe.current=!1}))}),[le]),(0,Pe.Z)((()=>{ne.current=B}),[B]),(0,Pe.Z)((()=>{P&&S&&H&&K({chatId:f})}),[f,S,P,H]),(0,Pe.Z)((()=>{le&&(ae.current=ne.current)}),[le]),(0,Pe.Z)((()=>{se.current=F}),[F]),(e=>{(0,i.d4)((()=>{function t(t){if((h.jm&&t.metaKey||!h.jm&&t.ctrlKey)&&"c"===(0,xe.Z)(t)){const n=(0,wn.Z)();n&&n.length>0&&(t.preventDefault(),e({messageIds:n}))}}return document.addEventListener("keydown",t,!1),()=>{document.removeEventListener("keydown",t,!1)}}),[e])})(W);const de=(0,i.Ye)((()=>{if(!T||!A)return;const e=!j||T[0]&&L!==T[0]?T:[j,...T];if(!e.length)return;const t=e.map((e=>A[e])).filter(Boolean);return gn((0,g.Xo)(t,["date","id"]),ae.current)}),[T,A,L,j]);(0,yn.Z)((()=>{if(!T||!A)return;const e=T.filter((e=>{var t;return null===(t=A[e])||void 0===t?void 0:t.reactions}));e.length&&X({chatId:f,ids:e})}),15e3);const ue=(0,i.Ye)((()=>{if("thread"===v)return(0,E.Ds)((()=>z({direction:m.Uq.Around})),1e3,!0,!1)}),[z,T]),{isScrolled:me,updateStickyDates:he}=function(){const[e,t]=(0,Oe.Z)(!1),n=(0,pn.Z)(1e3,!0);return{isScrolled:e,updateStickyDates:(0,i.I4)(((e,a)=>{t(),document.body.classList.contains("is-scrolling-messages")||(0,E.T2)((()=>{document.body.classList.add("is-scrolling-messages")})),n((()=>{(0,E.T2)((()=>{const t=document.querySelector(".stuck");t&&t.classList.remove("stuck");const n=function(e,t){const n=e.querySelectorAll(".sticky-date"),a=e.scrollTop;return Array.from(n).find((e=>{const{offsetTop:n,offsetHeight:s}=e,i=n-a;return-s<=i&&i<=(t?60:10)}))}(e,a);n&&n.classList.add("stuck"),document.body.classList.remove("is-scrolling-messages")}))}))}),[t,n])}}(),pe=(0,i.sO)(),ve=(0,i.sO)(),Ie=(0,i.I4)((()=>{if(ie.current)return void(ie.current=!1);pe.current=!0;const e=Y.current;se.current||he(e,I),is((()=>{pe.current=!1,(0,E.T2)((()=>{e.parentElement&&(J.current=e.scrollHeight-e.scrollTop,"thread"===v&&V({chatId:f,threadId:p,scrollOffset:J.current}))}))}))}),[he,I,v,V,f,p]);(0,i.d4)((()=>{if(!("ResizeObserver"in window))return;const e=new ResizeObserver((e=>{let[t]=e;t.target.offsetParent&&ce(t.contentRect.height)}));return e.observe(Y.current),()=>{e.disconnect()}}),[]);const{height:ye}=bt();(0,i.d4)((()=>{Y.current.dataset.normalHeight=String(Y.current.offsetHeight)}),[ye,b]),(0,i.d4)((()=>{if(!ue||!Z||O||F)return;if(T&&T[T.length-1]>=s.AE)return;const e=Y.current;(!T||T.length<s.hT/2&&e.firstElementChild.clientHeight<=e.offsetHeight)&&ue()}),[Z,T,ue,F,O]),(0,Pe.Z)((()=>{if(!T||!te.current)return;const e=te.current.filter((e=>T.includes(Number(e.dataset.messageId)))),t=e[1]||e[0];t&&(Q.current=t.id,ee.current=t.getBoundingClientRect().top)}),[T,x,re,I]),(0,un.Z)((e=>{let[t,n,a]=e;const i=Y.current;te.current=Array.from(i.querySelectorAll(".message-list-item"));const o=T&&t&&T[T.length-1]!==t[t.length-1],r=(null==T?void 0:T[0])!==(null==t?void 0:t[0])&&(null==T?void 0:T.length)===s.hT/2+1,c=o&&!r,l=T&&se.current===T[T.length-1],d=x&&c&&T&&T.length<s.hT/2&&!i.parentElement.classList.contains("force-messages-scroll")&&i.firstElementChild.clientHeight<=2*i.offsetHeight;d&&(i.parentElement.classList.add("force-messages-scroll"),setTimeout((()=>{i.parentElement&&i.parentElement.classList.remove("force-messages-scroll")}),500));const{scrollTop:u,scrollHeight:m,offsetHeight:h}=i,g=J.current,f=te.current[te.current.length-1];let p=g-(a||h);c&&(p-=f?f.offsetHeight:0);const v=x&&n&&p<=20;let y;if(c&&v&&!l&&(f&&(0,E.T2)((()=>{(0,In.Z)(i,f,"end",20)})),y=m-h,J.current=Math.max(Math.ceil(m-y),h),!d))return;const w=void 0!==a&&a!==re,Z=Q.current&&i.querySelector(`#${Q.current}`),P=!Z&&ae.current&&i.querySelector(".unread-divider");if(v&&w){if((0,In.N)())return;y=m-h}else Z?(ve.current&&(ve.current=!1,(0,vn.z)(i)),y=u+(Z.getBoundingClientRect().top-(ee.current||0))):y=P?Math.min(P.offsetTop-(I?60:10),m-g):m-g;(0,vn.Z)(i,Math.ceil(y)),se.current||(ie.current=!0,(0,E.T2)((()=>{ie.current=!1}))),J.current=Math.max(Math.ceil(m-y),h)}),[T,x,re,I]),(0,mn.Z)((e=>{let[t]=e;void 0!==t&&(0,ge.YW)(200+s.fK)}),[D]);const we=(0,Fe.Z)(),Ze=Boolean(f&&(0,d.YC)(f)),Ce=Boolean(!Ze&&!P||M||R),be=Boolean(!Ce||P),Se=(0,d.YC)(f)&&!M&&!N&&(!de&&!$&&T&&(!te.current||0===te.current.length)||1===(null==T?void 0:T.length)&&"contactSignUp"===(null==A||null===(t=A[T[0]])||void 0===t||null===(n=t.content.action)||void 0===n?void 0:n.type)||"contactSignUp"===(null==$||null===(o=$.content)||void 0===o||null===(r=o.action)||void 0===r?void 0:r.type)),Ee=C&&k&&1===(null==T?void 0:T.length)&&"chatCreate"===(null==A||null===(l=A[T[0]])||void 0===l||null===(u=l.content.action)||void 0===u?void 0:u.type),Me=(0,fe.Z)("MessageList custom-scroll",be&&"no-avatars",!b&&"no-composer","pinned"===v&&"type-pinned",_&&"with-bottom-shift",D&&"select-mode-active",me&&"scrolled",!S&&"is-animating");return i.ZP.createElement("div",{ref:Y,className:Me,onScroll:Ie,onMouseDown:fn.q},O?i.ZP.createElement("div",{className:"empty"},i.ZP.createElement("span",null,U?U.text:"This is a private "+(P?"channel":"chat"))):q?i.ZP.createElement("div",{className:"empty"},i.ZP.createElement("span",null,(0,tn.Z)(we(q),["br","emoji","links"]))):Se?i.ZP.createElement(as,{userId:f}):!T||de&&!Ee?T&&de||$?i.ZP.createElement(ts,{chatId:f,messageIds:T||[$.id],messageGroups:de||gn([$]),isViewportNewest:Boolean(x),isUnread:Boolean(B),withUsers:Ce,areReactionsInMeta:Ze,noAvatars:be,containerRef:Y,anchorIdRef:Q,memoUnreadDividerBeforeIdRef:ae,memoFirstUnreadIdRef:ne,threadId:p,type:v,isReady:S,isScrollingRef:pe,isScrollPatchNeededRef:ve,threadTopMessageId:j,hasLinkedChat:G,isSchedule:!!de&&"scheduled"===v,noAppearanceAnimation:!de||!oe.current,onFabToggle:y,onNotchToggle:w}):i.ZP.createElement(ot.Z,{color:"white",backgroundColor:"dark"}):i.ZP.createElement(ss,{chatId:f,type:v,isChatWithSelf:M,isGroupChatJustCreated:Ee}))}))),rs=(0,i.X$)((0,a.c$)((e=>{const t=(0,c.Bt)(e);if(!t)return{};const{chatId:n,threadId:a,type:s}=t,i=(0,c.Z1)(e,n);return{messageListType:s,unreadCount:i&&a===o._f&&"thread"===s?i.unreadCount:void 0}}))((e=>{let{isShown:t,canPost:n,messageListType:s,unreadCount:o,withExtraShift:r}=e;const{focusNextReply:c}=(0,a.Sv)(),l=(0,Fe.Z)(),d=(0,i.sO)(null),u=(0,i.I4)((()=>{if(t)if("thread"===s)c();else{const e=d.current.parentElement.querySelector(".MessageList"),t=e.querySelectorAll(".message-list-item"),n=t[t.length-1];if(!n)return;(0,In.Z)(e,n,"end",20)}}),[t,s,c]),m=(0,fe.Z)("ScrollDownButton",t&&"revealed",!n&&"no-composer",r&&"with-extra-shift");return i.ZP.createElement("div",{ref:d,className:m},i.ZP.createElement("div",{className:"ScrollDownButton-inner"},i.ZP.createElement(ze.Z,{color:"secondary",round:!0,onClick:u,ariaLabel:l("AccDescrPageDown")},i.ZP.createElement("i",{className:"icon-arrow-down"})),Boolean(o)&&i.ZP.createElement("div",{className:"unread-count"},(0,ke.bi)(o))))})));var cs=n(5723);const ls=1280,ds=/\.[^/.]+$/;async function us(e,t,a,i){const o=URL.createObjectURL(t),{type:r,size:c}=t;let l,d,u;if(s.oG.has(r))if(a){const t=await(0,Ct.pt)(o),{width:n,height:a}=t;if(n>ls||a>ls||"image/jpeg"!==r){const t=await Kt(o,ls/Math.max(n,a),"image/jpeg");return URL.revokeObjectURL(o),us(e,await(0,Ct.gm)(t),!0,i)}"image/jpeg"===r&&(e=e.replace(ds,".jpg")),l={width:n,height:a}}else u=o;else if(s.wG.has(r)){const{videoWidth:e,videoHeight:t,duration:n}=await(0,Ct.jj)(o);l={width:e,height:t,duration:n},u=await(0,Ct.ud)(o)}else if(s.e7.has(r)){const{duration:e,title:t,performer:a,coverUrl:s}=await async function(e){const{fetchFromUrl:t,selectCover:a}=await Promise.all([n.e(463),n.e(726)]).then(n.bind(n,2463)),s=await t(e),{common:{title:i,artist:o,picture:r},format:{duration:c}}=s,l=a(r);return{title:i,performer:o,duration:c,coverUrl:l?`data:${l.format};base64,${l.data.toString("base64")}`:void 0}}(o);d={duration:e||0,title:t,performer:a},u=s}return{blobUrl:o,filename:e,mimeType:r,size:c,quick:l,audio:d,previewBlobUrl:u,...i}}function ms(e){const t=window.getSelection();if(null!=t&&t.getRangeAt&&t.rangeCount){const n=t.getRangeAt(0);n.deleteContents();const a=n.createContextualFragment(e),s=a.lastChild;n.insertNode(a),s?(n.setStartAfter(s),n.setEndAfter(s)):n.collapse(!1),t.removeAllRanges(),t.addRange(n)}}var hs=n(6391);let gs;function fs(e){gs.focus(),e.focus()}h.cj&&(gs=document.createElement("input"),gs.classList.add("for-ios-autocapitalization-fix"),document.body.appendChild(gs));var ps=n(4784),vs=n(2400),Is=n(6389),ys=n(971);const ws={encoderPath:new URL(n(8973),n.b).href,reuseWorker:!0},Zs={type:"audio/ogg"};let Ps,Cs,bs;async function Ss(){return Ps||(Ps=n.e(161).then(n.t.bind(n,1161,23)),Cs=(await Ps).default,bs=new Cs(ws)),Ps}async function Es(e){await async function(){await Ss(),await bs.start()}();const t=Date.now();let n;const a=[],s=[];bs.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 c=!1;return function t(){if(c)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),requestAnimationFrame(t)}(),()=>{c=!0}}(bs);return{stop:()=>new Promise(((e,o)=>{bs.onstop=()=>{e({blob:new Blob(a,Zs),duration:Math.round(((n||Date.now())-t)/1e3),waveform:s})},bs.onerror=o;const r=Math.max(0,t+1e3-Date.now());setTimeout((()=>{bs.stop(),i()}),r)})),pause:()=>{const e=Math.max(0,t+1e3-Date.now());setTimeout((()=>{bs.pause(),n=Date.now(),i()}),e)}}}var Ms=n(1262);const Rs=["image/png","image/jpeg","image/gif"];let ks,Ns;var Ts=n(3575),As=n(9295);function Bs(e,t,n){const a=(0,pn.Z)(t,!0),[s,o]=(0,i.eJ)(),[r,c,l]=(0,Oe.Z)();return(0,ge.ZP)(c,l),(0,Pe.Z)((()=>{r||a((()=>{o(e())}))}),[...n,r]),s}const xs=/^@([a-z0-9_]{1,32})[\u00A0\u0020]+(.*)/i,Ls=/^@([a-z0-9_]{1,32})[\u00A0\u0020]+\n{2,}/i,Os={username:"",query:"",canShowHelp:!1,usernameLowered:""},Us=document.createElement("div");const Fs=(0,E.P2)((e=>e()),500,!0),Ds=/^[\w@]{1,32}\s?/i;var $s=n(3057);const qs=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,it.Z)(st.gl.Extra,"DeleteMessageModal",!t);return n?i.ZP.createElement(n,e):void 0}));function js(){return js=Object.assign||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},js.apply(this,arguments)}let Gs,Hs=!0;const _s=(0,i.X$)((e=>{let{onActivate:t,...n}=e;const a=(0,i.sO)(!1),s=(0,i.I4)((()=>{if(a.current=!0,Hs)return Hs=!1,void t();Gs&&(clearTimeout(Gs),Gs=void 0),Gs=window.setTimeout((()=>{a.current&&t()}),200)}),[t]),o=(0,i.I4)((()=>{a.current=!1}),[]);return i.ZP.createElement(ze.Z,js({},n,{onMouseEnter:h.$b?void 0:s,onMouseLeave:h.$b?void 0:o,onClick:t}))}));var zs=n(5655),Vs=n(6503);const Ks=(0,i.X$)((e=>{let{isButtonVisible:t,canAttachMedia:n,canAttachPolls:a,onFileSelect:o,onPollCreate:r}=e;const[c,l,d]=(0,Oe.Z)(),[u,m,g]=(0,Vs.Z)(c,d);(0,i.d4)((()=>{c&&g()}),[c,g]);const f=(0,i.I4)((()=>{c?d():l()}),[c,l,d]),p=(0,i.I4)(((e,t)=>{const{files:n}=e.target;n&&n.length>0&&o(Array.from(n),t)}),[o]),v=(0,i.I4)((()=>{(0,zs.g)(Array.from(s.dI).join(","),(e=>p(e,!0)))}),[p]),I=(0,i.I4)((()=>{(0,zs.g)("*",(e=>p(e,!1)))}),[p]),y=(0,Fe.Z)();if(t)return i.ZP.createElement("div",{className:"AttachMenu"},i.ZP.createElement(_s,{id:"attach-menu-button",className:c?"AttachMenu--button activated":"AttachMenu--button",round:!0,color:"translucent",onActivate:f,ariaLabel:"Add an attachment",ariaControls:"attach-menu-controls",hasPopup:!0},i.ZP.createElement("i",{className:"icon-attach"})),i.ZP.createElement(lt.Z,{id:"attach-menu-controls",isOpen:c,autoClose:!0,positionX:"right",positionY:"bottom",onClose:d,className:"AttachMenu--menu fluid",onCloseAnimationEnd:d,onMouseEnter:h.$b?void 0:u,onMouseLeave:h.$b?void 0:m,noCloseOnBackdrop:!h.$b,ariaLabelledBy:"attach-menu-button"},!n&&i.ZP.createElement(_e.Z,{className:"media-disabled",disabled:!0},"Posting media content is not allowed in this group."),n&&i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement(_e.Z,{icon:"photo",onClick:v},y("AttachmentMenu.PhotoOrVideo")),i.ZP.createElement(_e.Z,{icon:"document",onClick:I},y("AttachDocument"))),a&&i.ZP.createElement(_e.Z,{icon:"poll",onClick:r},y("Poll"))))})),Xs=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,it.Z)(st.gl.Extra,"SymbolMenu",!t);return n?i.ZP.createElement(n,e):void 0})),Ws=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,it.Z)(st.gl.Extra,"InlineBotTooltip",!t);return n?i.ZP.createElement(n,e):void 0})),Ys=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,it.Z)(st.gl.Extra,"MentionTooltip",!t);return n?i.ZP.createElement(n,e):void 0}));var Js=n(7146);const Qs=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,it.Z)(st.gl.Extra,"StickerTooltip",!t);return n?i.ZP.createElement(n,e):void 0}));var ei=n(9830);const ti=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,it.Z)(st.gl.Extra,"BotCommandTooltip",!t);return n?i.ZP.createElement(n,e):void 0})),ni=(0,i.X$)((0,a.c$)(((e,t)=>{let{messageId:n}=t;const{chatId:a}=(0,c.Bt)(e)||{};return a?{message:(0,c.hj)(e,a,n)}:{}}))((e=>{let{isOpen:t,message:n,onClose:s}=e;const{clickInlineButton:o}=(0,a.Sv)(),[r,c]=(0,Vs.Z)(t,s),{isKeyboardSingleUse:l}=n||{},[d,u,m]=(0,Oe.Z)(!0),g=(0,i.I4)((()=>{m(),s()}),[s,m]);if((0,i.d4)((()=>{u()}),[u,null==n?void 0:n.keyboardButtons]),n&&n.keyboardButtons)return i.ZP.createElement(lt.Z,{isOpen:t||d,autoClose:l,positionX:"right",positionY:"bottom",onClose:g,className:"BotKeyboardMenu",onCloseAnimationEnd:g,onMouseEnter:h.$b?void 0:r,onMouseLeave:h.$b?void 0:c,noCompact:!0},i.ZP.createElement("div",{className:"content"},n.keyboardButtons.map((e=>i.ZP.createElement("div",{className:"row"},e.map((e=>i.ZP.createElement(ze.Z,{ripple:!0,disabled:"NOT_SUPPORTED"===e.type,onClick:()=>o({button:e})},e.text))))))))})));var ai=n(3616),si=n(7891);const ii=(0,i.X$)((0,a.c$)((e=>{const{chatId:t,threadId:n,type:a}=(0,c.Bt)(e)||{};if(!t||!n||!a)return{};const{currentUserId:s,forwardMessages:{fromChatId:i,toChatId:o,messageIds:r}}=e,l=(0,c.Yy)(e,t,n),u="scheduled"===a?(0,c.wU)(e,t):(0,c._$)(e,t,n),m=e.settings.byKey.animationLevel>=1,h=o===t;let g,f;if(l?g=(0,c.hj)(e,t,l):u?g=(0,c.kK)(e,t,n,a):h&&1===r.length&&(g=(0,c.hj)(e,i,r[0])),(h||l)&&g){const{forwardInfo:n}=g,a=t===s;n&&(n.isChannelPost||a)&&(f=(0,c.cv)(e,g)),f||(f=(0,c.Ur)(e,g)),f||(f=(0,d.YC)(i)?(0,c.dy)(e,i):(0,c.Z1)(e,i))}return{replyingToId:l,editingId:u,message:g,sender:f,shouldAnimate:m,forwardedMessagesCount:h?r.length:void 0}}))((e=>{let{replyingToId:t,editingId:n,message:s,sender:o,shouldAnimate:r,forwardedMessagesCount:c,onClear:l}=e;const{setReplyingToId:d,setEditingId:u,focusMessage:m,exitForwardMode:h}=(0,a.Sv)(),g=Boolean((t||n)&&s||o&&c),f=(0,si.Z)([c],c?300:void 0),{shouldRender:p,transitionClassNames:v}=(0,ye.Z)(f&&g,void 0,!r,void 0,!r),I=(0,i.I4)((()=>{t?d({messageId:void 0}):n?u({messageId:void 0}):c&&h(),null==l||l()}),[t,n,c,l,d,u,h]);(0,i.d4)((()=>g?(0,Be.Z)(I):void 0),[g,I]);const y=(0,i.I4)((()=>{m({chatId:s.chatId,messageId:s.id})}),[m,s]),w=(0,fe.Z)("ComposerEmbeddedMessage",v),Z=c&&c>1?`${c} forwarded messages`:void 0;if(p)return i.ZP.createElement("div",{className:w},i.ZP.createElement("div",null,i.ZP.createElement(ze.Z,{round:!0,faded:!0,color:"translucent",ariaLabel:"Cancel replying",onClick:I},i.ZP.createElement("i",{className:"icon-close"})),i.ZP.createElement(Hn,{className:"inside-input",message:s,sender:o,customText:Z,title:n?"Edit Message":void 0,onClick:y})))}))),oi=(0,i.X$)((e=>{const{attachments:t}=e,n=(0,it.Z)(st.gl.Extra,"AttachmentModal",!t.length);return n?i.ZP.createElement(n,e):void 0})),ri=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,it.Z)(st.gl.Extra,"BotCommandMenu",!t);return n?i.ZP.createElement(n,e):void 0})),ci=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,it.Z)(st.gl.Extra,"PollModal",!t);return n?i.ZP.createElement(n,e):void 0})),li=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,it.Z)(st.gl.Extra,"DropArea",!t);return n?i.ZP.createElement(n,e):void 0})),di=new RegExp(s.FM,"i"),ui=(0,i.X$)((0,a.c$)(((e,t)=>{let{chatId:n,threadId:a}=t;const s=(0,c.tV)(e,n,a);return{theme:(0,c.Pu)(e),webPagePreview:e.webPagePreview,noWebPage:s}}))((e=>{let{chatId:t,threadId:n,messageText:s,disabled:r,webPagePreview:c,noWebPage:l,theme:d}=e;const{loadWebPagePreview:u,clearWebPagePreview:m,toggleMessageWebPage:h}=(0,a.Sv)(),g=Bs((()=>{const{text:e,entities:t}=(0,v.Z)(s),n=t&&t.find((e=>{let{type:t}=e;return t===o.Vv.TextUrl}));if(n)return n.url;const a=e.match(di);return a?a[0]:void 0}),300,[s]);(0,i.d4)((()=>{g?u({text:g}):(m(),h({chatId:t,threadId:n}))}),[t,h,m,g,u,n]),(0,Pe.Z)((()=>{m(),h({chatId:t,threadId:n})}),[t]);const f=Boolean(c&&s.length&&!l&&!r),{shouldRender:p,transitionClassNames:I}=(0,ye.Z)(f),y=(0,Nt.Z)(c,!0),w=(0,i.I4)((()=>{h({chatId:t,threadId:n,noWebPage:!0})}),[t,n,h]);if(!p||!y)return;const{photo:Z,...P}=y,C={content:{webPage:P}};return i.ZP.createElement("div",{className:(0,fe.Z)("WebPagePreview",I)},i.ZP.createElement("div",null,i.ZP.createElement(ze.Z,{round:!0,faded:!0,color:"translucent",ariaLabel:"Clear Webpage Preview",onClick:w},i.ZP.createElement("i",{className:"icon-close"})),i.ZP.createElement(Sa,{message:C,inPreview:!0,theme:d})))}))),mi=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,it.Z)(st.gl.Extra,"SendAsMenu",!t);return n?i.ZP.createElement(n,e):void 0}));var hi;!function(e){e.Send="send",e.Record="record",e.Edit="edit",e.Schedule="schedule"}(hi||(hi={}));const gi="wonderful-voice-message.ogg",fi=(0,i.X$)((0,a.c$)(((e,t)=>{var n,a,i,r;let{chatId:l,threadId:u,messageListType:m}=t;const h=(0,c.Z1)(e,l),g=l!==s.FV?(0,c.IK)(e,l):void 0,f=Boolean(g),p=(0,c.FM)(e,l),v=f&&(0,c.FT)(e,l),I=(0,c.qy)(e,l),{language:y,shouldSuggestStickers:w}=e.settings.byKey,Z=e.emojiKeywords[s.pR],P=y!==s.pR?e.emojiKeywords[y]:void 0,C=v?v.id:void 0,b=C?(0,c.hj)(e,l,C):void 0,{currentUserId:S}=e,E=null!=h&&h.fullInfo?(null==h||null===(n=h.fullInfo)||void 0===n?void 0:n.sendAsId)||S:void 0,M=null!=h&&h.sendAsIds&&E&&h.sendAsIds.includes(E)?E:null!=h&&null!==(a=h.adminRights)&&void 0!==a&&a.anonymous?null==h?void 0:h.id:void 0,R=M?(0,c.dy)(e,M):void 0,k=!R&&M?(0,c.Z1)(e,M):void 0,N="scheduled"===m?(0,c.hI)(e,l):(0,c.s)(e,l,u);return{editingMessage:(0,c.kK)(e,l,u,m),connectionState:e.connectionState,draft:(0,c.Ms)(e,l,u),chat:h,isChatWithBot:f,isChatWithSelf:p,canScheduleUntilOnline:(0,c.Eh)(e,l),isChannel:h?(0,d.eA)(h):void 0,isRightColumnShown:(0,c.Jf)(e),isSelectModeActive:(0,c.CA)(e),withScheduledButton:u===o._f&&"thread"===m&&Boolean(null==I?void 0:I.length),shouldSchedule:"scheduled"===m,botKeyboardMessageId:C,botKeyboardPlaceholder:null==b?void 0:b.keyboardPlaceholder,isForwarding:l===e.forwardMessages.toChatId,isPollModalOpen:e.isPollModalOpen,stickersForEmoji:e.stickers.forEmoji.stickers,groupChatMembers:null==h||null===(i=h.fullInfo)||void 0===i?void 0:i.members,topInlineBotIds:null===(r=e.topInlineBots)||void 0===r?void 0:r.userIds,currentUserId:S,lastSyncTime:e.lastSyncTime,contentToBeScheduled:e.messages.contentToBeScheduled,shouldSuggestStickers:w,recentEmojis:e.recentEmojis,baseEmojiKeywords:null==Z?void 0:Z.keywords,emojiKeywords:null==P?void 0:P.keywords,inlineBots:e.inlineBots.byUsername,isInlineBotLoading:e.inlineBots.isLoading,chatBotCommands:h&&h.fullInfo&&h.fullInfo.botCommands,botCommands:g&&g.fullInfo?g.fullInfo.botCommands||!1:void 0,sendAsUser:R,sendAsChat:k,sendAsId:M,editingDraft:N}}))((e=>{let{dropAreaState:t,shouldSchedule:n,canScheduleUntilOnline:r,isReady:c,onDropHide:u,editingMessage:m,chatId:g,threadId:p,messageListType:I,draft:y,chat:w,connectionState:Z,isChatWithBot:P,isChatWithSelf:C,isChannel:b,isRightColumnShown:S,isSelectModeActive:M,isForwarding:R,isPollModalOpen:k,botKeyboardMessageId:N,botKeyboardPlaceholder:T,withScheduledButton:A,stickersForEmoji:B,groupChatMembers:x,topInlineBotIds:O,currentUserId:U,lastSyncTime:F,contentToBeScheduled:D,shouldSuggestStickers:$,baseEmojiKeywords:q,emojiKeywords:j,recentEmojis:G,inlineBots:H,isInlineBotLoading:_,botCommands:z,chatBotCommands:V,sendAsUser:K,sendAsChat:X,sendAsId:W,editingDraft:Y}=e;const{sendMessage:J,clearDraft:ee,showDialog:te,setStickerSearchQuery:ne,setGifSearchQuery:ae,forwardMessages:se,openPollModal:ie,closePollModal:oe,loadScheduledHistory:re,openChat:ce,addRecentEmoji:le,sendInlineBotResult:de,loadSendAs:ue,loadFullChat:me}=(0,a.Sv)(),he=(0,Fe.Z)(),ge=(0,i.sO)(null),[pe,ve]=(0,i.eJ)(""),Ie=(0,ys.Y)(pe),ye=(0,i.sO)(),Ce=(0,Et.Z)(t),{width:be}=Q.Z.get(),Se=null==w?void 0:w.sendAsIds,Ee=Se&&(Se.length>1||!Se.includes(U)),[Me,Re,ke]=(0,Oe.Z)(),Ne=(0,Is.Z)(g,p),Te=(0,i.I4)((()=>{ke()}),[ke]),[Ae,xe]=(0,$s.Z)(r,Te);(0,i.d4)((()=>{ye.current=void 0}),[g]),(0,i.d4)((()=>{g&&F&&p===o._f&&c&&re({chatId:g})}),[c,g,re,F,p]),(0,i.d4)((()=>{g&&w&&F&&!Se&&c&&(0,d.ZV)(w)&&ue({chatId:g})}),[w,g,c,F,ue,Se]),(0,i.d4)((()=>{g&&w&&F&&!w.fullInfo&&c&&(0,d.ZV)(w)&&me({chatId:g})}),[w,g,c,F,me]);const Le=(0,i.sO)(!1);(0,Pe.Z)((e=>{let[t,n]=e;Le.current=Boolean(g===t&&Se&&!n)}),[g,Se]),(0,i.bt)((()=>{ge.current&&(ge.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[Ue,De]=(0,i.eJ)([]),[$e,qe,je]=(0,Oe.Z)(),[Ge,He,_e]=(0,Oe.Z)(),[Ve,Ke,Xe]=(0,Oe.Z)(),[We,Je,Qe]=(0,Oe.Z)(),[et,tt,nt]=(0,Oe.Z)(),[at,st]=(0,Oe.Z)(),[it,ot,rt]=(0,Oe.Z)(),{startRecordingVoice:ct,stopRecordingVoice:lt,pauseRecordingVoice:dt,activeVoiceRecording:ut,currentRecordTime:mt,recordButtonRef:ht,startRecordTimeRef:gt}=(()=>{const e=(0,i.sO)(null),[t,n]=(0,i.eJ)(),a=(0,i.sO)(),[s,o]=(0,i.eJ)();(0,i.d4)((()=>{h.s$&&h.mh&&Ss()}),[]);const r=(0,i.I4)((async()=>{try{const{stop:t,pause:s}=await Es((t=>{e.current&&(a.current&&Date.now()%4==0&&(e.current.style.boxShadow=`0 0 0 ${50*(t||0)}px rgba(0,0,0,.15)`),o(Date.now()))}));a.current=Date.now(),o(Date.now()),n({stop:t,pause:s})}catch(e){console.error(e)}}),[]),c=(0,i.I4)((()=>{if(t){e.current&&(e.current.style.boxShadow="none");try{return t.pause()}catch(e){return void console.error(e)}}}),[t]),l=(0,i.I4)((()=>{if(t){n(void 0),a.current=void 0,o(void 0),e.current&&(e.current.style.boxShadow="none");try{return t.stop()}catch(e){return void console.error(e)}}}),[t]);return(0,i.d4)((()=>t?(0,Be.Z)(l):void 0),[t,l]),{startRecordingVoice:r,pauseRecordingVoice:c,stopRecordingVoice:l,activeVoiceRecording:t,currentRecordTime:s,recordButtonRef:e,startRecordTimeRef:a}})();(0,yn.Z)((()=>{Ne({type:"recordAudio"})}),ut&&s.o_),(0,i.d4)((()=>{ut||Ne({type:"cancel"})}),[ut,Ne]);const ft=m?hi.Edit:!h.mh||ut||pe&&!Ue.length||R?n?hi.Schedule:hi.Send:hi.Record,pt=!n,{isMentionTooltipOpen:vt,closeMentionTooltip:It,insertMention:yt,mentionFilteredUsers:Zt}=(0,As.Z)(!Ue.length,Ie,ve,void 0,x,O,U),{isOpen:Pt,id:Ct,isGallery:bt,switchPm:St,results:Mt,closeTooltip:Rt,help:kt,loadMore:Nt}=function(e,t,n,s){const{queryInlineBot:o,resetInlineBot:r}=(0,a.Sv)(),[c,l,d]=(0,Oe.Z)(),{username:u,query:m,canShowHelp:h,usernameLowered:g}=Bs((()=>function(e){const t=function(e){return Us.innerHTML=e.replace(/<br>/g,"\n"),Us.innerText}(e),n=t.match(xs);return n?{username:n[1],query:n[2],canShowHelp:""===n[2]&&!t.match(Ls),usernameLowered:n[1].toLowerCase()}:Os}(n)),300,[n])||{},f=(0,Et.Z)(m),p=(0,Et.Z)(u),v=g?null==s?void 0:s[g]:void 0,{id:I,switchPm:y,offset:w,results:Z,isGallery:P,help:C}=v||{};(0,i.d4)((()=>{f!==m&&d()}),[f,m,d]),(0,i.d4)((()=>{e&&g&&t&&o({chatId:t,username:g,query:m})}),[m,e,o,t,g]);const b=(0,i.I4)((()=>{o({chatId:t,username:g,query:m,offset:w})}),[w,t,m,o,g]);return(0,i.d4)((()=>{e&&I&&(y||null!=Z&&Z.length)?l():d()}),[I,e,l,Z,y,d]),p!==u&&r({username:p}),{isOpen:c,id:I,isGallery:P,switchPm:y,results:Z,closeTooltip:d,help:h&&C?`@${u} ${C}`:void 0,loadMore:b}}(Boolean(!Ue.length&&F),g,pe,H),{isOpen:Tt,close:At,filteredBotCommands:Bt}=function(e,t,n,a){const[s,o,r]=(0,Oe.Z)(),[c,l]=(0,i.eJ)(),d=(0,i.I4)((e=>{n||a?Fs((()=>{const t=(n||a||[]).filter((t=>{let{command:n}=t;return!e||n.includes(e)}));l(t&&t.length?t:void 0)})):l(void 0)}),[n,a]);return(0,i.d4)((()=>{if(e&&t.length)if(t.startsWith("/")){const e=(0,vs._)(t.substr(1)).match(Ds);d(e?e[0]:"")}else l(void 0);else l(void 0)}),[d,t,e,r]),(0,i.d4)((()=>{c&&c.length&&t.length>0?o():r()}),[c,t.length,o,r]),{isOpen:s,close:r,filteredBotCommands:c}}(Boolean(z&&z.length||V&&V.length),pe,z,V),{isContextMenuOpen:xt,handleContextMenu:Lt,handleContextMenuClose:Ot,handleContextMenuHide:Ut}=(0,bn.Z)(ht,!(ft===hi.Send&&pt)),{canSendStickers:Ft,canSendGifs:Dt,canAttachMedia:$t,canAttachPolls:qt,canAttachEmbedLinks:jt}=(0,i.Ye)((()=>(0,d.H5)(w,P)),[w,P]),Gt=w&&(0,d.Nl)(w),Ht=(0,d.Hd)(w),{isStickerTooltipOpen:_t,closeStickerTooltip:zt}=function(e,t,n){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const o=(0,i.Ye)((()=>(0,vs._)(t).trim()),[t]),{loadStickersForEmoji:r,clearStickersForEmoji:c}=(0,a.Sv)(),l=h.op&&1===(0,ps.Z)(o)||!h.op&&Boolean(t.match(/^<img.[^>]*?>$/g)),d=Boolean(n)&&l;return(0,i.d4)((()=>{var t;s||(e&&l?r({emoji:h.op?o:null===(t=o.match(/alt="(.+)"/))||void 0===t?void 0:t[1]}):!d&&l||c())}),[t,l,c,r,e,s]),{isStickerTooltipOpen:d,closeStickerTooltip:c}}(Boolean($&&Ft&&!Ue.length),pe,B,!c),{isEmojiTooltipOpen:Vt,closeEmojiTooltip:Kt,filteredEmojis:Xt,insertEmoji:Wt}=(0,Ts.Z)(Boolean($&&Ft&&!Ue.length),Ie,G,void 0,ve,q,j,!c),Yt=(0,i.I4)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s.R2;const n=window.getSelection();let a;a=t===s.R2?document.querySelector(s.Ed):document.getElementById(t);const i=(0,tn.Z)(e,["escape_html","emoji_html","br_html"]).join("").replace(/\u200b+/g,"");if(n.rangeCount){const e=n.getRangeAt(0);if((0,hs.R)(e,t))return ms(i),void a.dispatchEvent(new Event("input",{bubbles:!0}))}ve(`${Ie.current}${i}`),requestAnimationFrame((()=>{(0,cs.Z)(a)}))}),[Ie]),Jt=(0,i.I4)((()=>{const e=window.getSelection();if(e.rangeCount){const t=e.getRangeAt(0);if((0,hs.R)(t,s.R2))return void document.execCommand("delete",!1)}ve(function(e){const t=document.createElement("div");t.contentEditable="true",t.style.position="absolute",t.style.left="-10000px",t.style.top="-10000px",t.innerHTML=e,document.body.appendChild(t);let n=t.lastChild;if(n.lastChild)for(;n.lastChild;)n=n.lastChild;const a=n.textContent.length,s=document.createRange(),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}(Ie.current))}),[Ie]),Qt=(0,i.I4)((function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e||ve(""),De(l.D),zt(),It(),Kt(),h.wB?setTimeout((()=>Xe()),350):Xe()}),[zt,It,Kt,Xe]),en=(0,i.sO)();en.current=lt,(0,i.d4)((()=>()=>{en.current(),Qt()}),[g,Qt,en]);const[nn,an]=((e,t,n,o,r,c,l,u,m,h)=>{const{editMessage:g,setEditingDraft:f}=(0,a.Sv)();(0,mn.Z)((e=>{let[a]=e;if(!n)return;if((null==a?void 0:a.id)===n.id)return;const i=(0,pa.z)(null!=h&&h.text.length?h:n.content.text);t(i),requestAnimationFrame((()=>{const e=document.querySelector(s.Ed);e&&(0,cs.Z)(e,!0)}))}),[n,t]),(0,i.d4)((()=>{if(n)return()=>{const t=(0,v.Z)(e.current),n=t.text.length?t:void 0;f({chatId:c,threadId:l,type:u,text:n})}}),[c,n,e,f,l,u]);const p=(0,i.I4)((()=>{m&&(0,E.T2)((()=>{t((0,pa.z)(m));const e=document.querySelector(s.Ed);e&&requestAnimationFrame((()=>{(0,cs.Z)(e,!0)}))}))}),[m,t]),I=(0,i.I4)((()=>{o(),p()}),[o,p]),y=(0,i.I4)((()=>{const{text:t,entities:a}=(0,v.Z)(e.current);n&&(t||(0,d.u8)(n)?(g({messageId:n.id,text:t,entities:a}),o(),p()):r())}),[g,n,e,r,o,p]),w=(0,i.I4)((()=>{if(!n)return;const t=(0,v.Z)(e.current),a=t.text.length?t:void 0;f({chatId:c,threadId:l,type:u,text:a})}),[c,n,e,f,l,u]);return(0,we.Z)(w),Ze(w),[y,I]})(Ie,ve,m,Qt,tt,g,p,I,y,Y);((e,t,n,o,r,c)=>{const{saveDraft:l,clearDraft:d}=(0,a.Sv)(),u=(0,i.I4)(((e,t)=>{const n=o.current;c||(n.length?l({chatId:e,threadId:t,draft:(0,v.Z)(n)}):void 0!==n&&d({chatId:e,threadId:t}))}),[d,c,o,l]),m=(0,i.Ye)((()=>(0,E.Ds)((e=>e()),s.r_,!1)),[t]),g=(0,Et.Z)(t),f=(0,Et.Z)(n);(0,i.d4)((()=>(ks=t,Ns=n,()=>{ks=void 0,Ns=void 0,u(t,n)})),[t,n,u]),(0,i.d4)((()=>{t===g&&n===f||!c&&e&&(r((0,pa.z)(e)),h.$b||requestAnimationFrame((()=>{const e=document.querySelector(s.Ed);e&&(0,cs.Z)(e,!0)})))}),[t,n,e,r,u,g,f,c]);const p=o.current,I=(0,Et.Z)(p);(0,i.d4)((()=>{t&&n&&g===t&&f===n&&I!==p&&(p.length?m((()=>{ks===t&&Ns===n&&u(t,n)})):u(t,n))}),[t,p,g,I,f,m,n,u]);const y=(0,i.I4)((()=>{t&&n&&u(t,n)}),[t,n,u]);(0,we.Z)(y),Ze(y)})(y,g,p,Ie,ve,m),((e,t,n)=>{(0,i.d4)((()=>{async function a(a){if(!a.clipboardData)return;const i=document.activeElement;if(i&&![s.R2,s.nY].includes(i.id))return;const o=a.clipboardData.getData("text").substring(0,4096),{items:r}=a.clipboardData;let c=[];if(a.preventDefault(),r.length>0&&(c=await(0,Ms.Z)(r)),0!==c.length||o){if(c.length>0&&!n){const e=await Promise.all(c.map((e=>us(e.name,e,1===c.length&&Rs.includes(e.type)))));t((t=>t.concat(e)))}o&&e(o,null==i?void 0:i.id)}}return document.addEventListener("paste",a,!1),()=>{document.removeEventListener("paste",a,!1)}}),[e,n,t])})(Yt,De,m);const sn=(0,i.I4)((()=>{m&&an()}),[m,an]),rn=(0,i.I4)((async(e,t)=>{De(await Promise.all(e.map((e=>us(e.name,e,t)))))}),[]),cn=(0,i.I4)((async(e,t)=>{De([...Ue,...await Promise.all(e.map((e=>us(e.name,e,t))))])}),[Ue]),ln=(0,i.I4)((()=>{De(l.D)}),[]),dn=(0,i.I4)((async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0;if("connectionStateReady"!==Z)return;let n=Ue;if(ut){const e=await lt();if(e){const{blob:t,duration:a,waveform:s}=e;n=[await us(gi,t,!1,{voice:{duration:a,waveform:s}})]}}const{text:i,entities:o}=(0,v.Z)(Ie.current);if(!n.length&&!i&&!R)return;const{serverTimeOffset:r}=(0,a.Rd)(),c=n.length?1024:4096;if((null==i?void 0:i.length)>c){const e=i.length-c;return void te({data:{message:"MESSAGE_TOO_LONG_PLEASE_REMOVE_CHARACTERS",textParams:{"{EXTRA_CHARS_COUNT}":e,"{PLURAL_S}":e>1?"s":""},hasErrorKey:!0}})}const l=document.querySelector(s.Ed);if(n.length||i){if(Ht&&!Gt){const e=(0,f.b)(r),t=ye.current&&Math.floor(e-ye.current),n=Ht.nextSendDate&&Ht.nextSendDate>e;if(t&&t<Ht.seconds||n){const a=n?Ht.nextSendDate-e:Ht.seconds-t;return te({data:{message:he("SlowModeHint",(0,L.k9)(a)),isSlowMode:!0,hasErrorKey:!1}}),void(null==l||l.blur())}}J({text:i,entities:o,attachments:n,scheduledAt:t,isSilent:e})}R&&se({scheduledAt:t,isSilent:e}),ye.current=(0,f.b)(r),ee({chatId:g,localOnly:!0}),h.cj&&l&&l===document.activeElement&&fs(l),requestAnimationFrame((()=>{Qt()}))}),[Z,Ue,ut,R,ee,g,Qt,lt,te,Ht,Gt,J,se,he,Ie]),un=(0,i.I4)((()=>{Xe(),He()}),[Xe,He]),hn=(0,i.I4)((()=>{_e(),Qe(),Ke()}),[_e,Qe,Ke]),gn=(0,i.I4)(((e,t)=>{if(e&&"queryId"in e){const{id:n,queryId:a,isSilent:s}=e;return void de({id:n,queryId:a,scheduledAt:t,isSilent:s})}const{isSilent:n,...a}=e||{};e&&0!==Object.keys(a).length?J({...e,scheduledAt:t}):dn(Boolean(n),t)}),[dn,de,J]);(0,i.d4)((()=>{D&&Ae((e=>{gn(D,e)}))}),[D,gn,Ae]);const fn=(0,i.I4)((function(e,t,a){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];e={...e,isPreloadedGlobally:!0},n||a?(Re(),Ae((n=>{ke(),gn({sticker:e,isSilent:t},n),requestAnimationFrame((()=>{Qt(s)}))}))):(J({sticker:e,isSilent:t}),requestAnimationFrame((()=>{Qt(s)})))}),[n,Re,Ae,ke,gn,Qt,J]),pn=(0,i.I4)(((e,t,a)=>{n||a?(Re(),Ae((n=>{ke(),gn({gif:e,isSilent:t},n),requestAnimationFrame((()=>{Qt(!0)}))}))):(J({gif:e,isSilent:t}),requestAnimationFrame((()=>{Qt(!0)})))}),[n,Re,Ae,ke,gn,Qt,J]),vn=(0,i.I4)(((e,t,a)=>{if("connectionStateReady"!==Z)return;n||a?Ae((n=>{gn({id:e.id,queryId:e.queryId,isSilent:t},n)})):de({id:e.id,queryId:e.queryId,isSilent:t});const i=document.querySelector(s.Ed);h.cj&&i&&i===document.activeElement&&fs(i),ee({chatId:g,localOnly:!0}),requestAnimationFrame((()=>{Qt()}))}),[g,ee,Z,gn,Ae,Qt,de,n]),In=(0,i.I4)((()=>{ee({chatId:g,localOnly:!0}),requestAnimationFrame((()=>{Qt()}))}),[g,ee,Qt]),wn=(0,i.I4)((e=>{n?(Ae((t=>{gn({poll:e},t)})),oe()):(J({poll:e}),oe())}),[oe,gn,Ae,J,n]),Zn=(0,i.I4)((()=>{n?Ae((e=>{gn({isSilent:!0},e)})):dn(!0)}),[gn,dn,Ae,n]),Pn=(0,i.I4)((e=>{"stickers"===e?(ne({query:""}),ae({query:void 0})):(ae({query:""}),ne({query:void 0}))}),[ne,ae]),Cn=(0,i.I4)((()=>{const e=document.querySelector(s.Ed);h.wB&&e===document.activeElement?(null==e||e.blur(),setTimeout((()=>{_e(),Ke()}),100)):Ke()}),[Ke,_e]),Sn=(0,i.I4)((()=>{const e=document.querySelector(s.Ed);if(!h.wB||e!==document.activeElement)return _e(),Xe(),void Je();null==e||e.blur(),setTimeout((()=>{_e(),Xe(),Je()}),100)}),[_e,Xe,Je]),En=(0,i.I4)((()=>{ce({id:g,threadId:p,type:"scheduled"})}),[ce,g,p]);(0,i.d4)((()=>{S&&h.wB&&Xe()}),[S,Xe]),(0,i.d4)((()=>{c&&(M?ot():setTimeout((()=>{rt()}),200))}),[M,rt,ot,c]);const Mn=(0,i.I4)((()=>{switch(ft){case hi.Send:dn();break;case hi.Record:ct();break;case hi.Edit:nn();break;case hi.Schedule:ut&&dt(),Ae((e=>{gn({},e)}))}}),[ft,dn,ct,nn,ut,Ae,dt,gn]),Rn=ft===hi.Record&&!$t,kn=(0,Et.Z)(m,!0),Nn=m||kn,Tn=new Date;Tn.setSeconds(0),Tn.setMilliseconds(0);const An=new Date;An.setFullYear(An.getFullYear()+1);let Bn="SendMessage";switch(ft){case hi.Edit:Bn="Save edited message";break;case hi.Record:Bn=Rn?"Conversation.DefaultRestrictedMedia":"AccDescrVoiceMessage"}const xn=(0,fe.Z)("Composer",!M&&"shown",it&&"hover-disabled"),Ln=(0,fe.Z)("mobile-symbol-menu-button",!c&&"not-ready",at?Ve&&"menu-opened":Ve&&"is-loading"),On=(0,i.I4)((()=>{Ae((e=>{gn({},e)}))}),[gn,Ae]),Un=ft===hi.Edit?nn:ft===hi.Schedule?On:dn;return i.ZP.createElement("div",{className:xn},$t&&c&&i.ZP.createElement(li,{isOpen:t!==wt.t.None,withQuick:t===wt.t.QuickFile||Ce===wt.t.QuickFile,onHide:u,onFileSelect:rn}),i.ZP.createElement(oi,{chatId:g,threadId:p,canShowCustomSendMenu:pt,attachments:Ue,caption:Ue.length?pe:"",groupChatMembers:x,currentUserId:U,recentEmojis:G,isReady:c,isChatWithSelf:C,onCaptionUpdate:ve,baseEmojiKeywords:q,emojiKeywords:j,addRecentEmoji:le,shouldSchedule:n,onSendSilent:Zn,onSend:dn,onSendScheduled:On,onFileAppend:cn,onClear:ln}),i.ZP.createElement(ci,{isOpen:Boolean(k),shouldBeAnonimous:b,onClear:oe,onSend:wn}),Nn&&i.ZP.createElement(qs,{isOpen:et,isSchedule:"scheduled"===I,onClose:nt,message:Nn}),i.ZP.createElement(mi,{isOpen:We,onClose:Qe,chatId:g,selectedSendAsId:W,sendAsIds:Se}),i.ZP.createElement(Ys,{isOpen:vt,onClose:It,onInsertUserName:yt,filteredUsers:Zt}),i.ZP.createElement(Ws,{isOpen:Pt,botId:Ct,isGallery:bt,inlineBotResults:Mt,switchPm:St,onSelectResult:vn,loadMore:Nt,onClose:Rt,isSavedMessages:C,canSendGifs:Dt}),i.ZP.createElement(ti,{isOpen:Tt,withUsername:Boolean(V),botCommands:Bt,onClick:In,onClose:At}),i.ZP.createElement("div",{id:"message-compose"},i.ZP.createElement("div",{className:"svg-appendix",ref:ge}),i.ZP.createElement(ii,{onClear:sn}),i.ZP.createElement(ui,{chatId:g,threadId:p,messageText:Ue.length?"":pe,disabled:!jt}),i.ZP.createElement("div",{className:"message-input-wrapper"},P&&!1!==z&&!ut&&!m&&i.ZP.createElement(_s,{className:(0,fe.Z)("bot-commands",Ge&&"activated"),round:!0,disabled:void 0===z,color:"translucent",onActivate:un,ariaLabel:"Open bot command keyboard"},i.ZP.createElement("i",{className:"icon-bot-commands-filled"})),Ee&&(K||X)&&i.ZP.createElement(ze.Z,{round:!0,color:"translucent",onClick:We?Qe:Sn,ariaLabel:he("SendMessageAsTitle"),className:(0,fe.Z)("send-as-button",Le.current&&"appear-animation")},i.ZP.createElement(on.Z,{user:K,chat:X,size:"tiny"})),h.wB?i.ZP.createElement(ze.Z,{className:Ln,round:!0,color:"translucent",onClick:Ve?Xe:Cn,ariaLabel:"Choose emoji, sticker or GIF"},i.ZP.createElement("i",{className:"icon-smile"}),i.ZP.createElement("i",{className:"icon-keyboard"}),Ve&&!at&&i.ZP.createElement(Ye.Z,{color:"gray"})):i.ZP.createElement(_s,{className:Ve?"activated":"",round:!0,color:"translucent",onActivate:hn,ariaLabel:"Choose emoji, sticker or GIF"},i.ZP.createElement("i",{className:"icon-smile"})),i.ZP.createElement(ai.Z,{id:"message-input-text",chatId:g,threadId:p,html:Ue.length?"":pe,placeholder:ut&&be<=600?"":T||he("Message"),forcedPlaceholder:kt,canAutoFocus:c&&!Ue.length,shouldSuppressFocus:h.wB&&Ve,shouldSuppressTextFormatter:Vt||vt||Pt,onUpdate:ve,onSend:Un,onSuppressedFocus:Xe}),_&&Boolean(Ct)&&i.ZP.createElement(Ye.Z,{color:"gray"}),A&&i.ZP.createElement(ze.Z,{round:!0,faded:!0,className:"scheduled-button",color:"translucent",onClick:En,ariaLabel:"Open scheduled messages"},i.ZP.createElement("i",{className:"icon-schedule"})),N&&!ut&&!m&&i.ZP.createElement(_s,{className:$e?"activated":"",round:!0,color:"translucent",onActivate:qe,ariaLabel:"Open bot command keyboard"},i.ZP.createElement("i",{className:"icon-bot-command"})),ut&&mt&&i.ZP.createElement("span",{className:"recording-state"},(0,L.rM)(mt-gt.current)),i.ZP.createElement(Qs,{chatId:g,threadId:p,isOpen:_t,onStickerSelect:fn}),i.ZP.createElement(ei.Z,{isOpen:Vt,emojis:Xt,onClose:Kt,onEmojiSelect:Wt,addRecentEmoji:le}),i.ZP.createElement(Ks,{isButtonVisible:!ut&&!m,canAttachMedia:$t,canAttachPolls:qt,onFileSelect:rn,onPollCreate:ie}),N&&i.ZP.createElement(ni,{messageId:N,isOpen:$e,onClose:je}),z&&i.ZP.createElement(ri,{isOpen:Ge,botCommands:z,onClose:_e}),i.ZP.createElement(Xs,{chatId:g,threadId:p,isOpen:Ve||Me,canSendGifs:Dt,canSendStickers:Ft,onLoad:st,onClose:Xe,onEmojiSelect:Yt,onStickerSelect:fn,onGifSelect:pn,onRemoveSymbol:Jt,onSearchOpen:Pn,addRecentEmoji:le}))),ut&&i.ZP.createElement(ze.Z,{round:!0,color:"danger",className:"cancel",onClick:lt,ariaLabel:"Cancel voice recording"},i.ZP.createElement("i",{className:"icon-delete"})),i.ZP.createElement(ze.Z,{ref:ht,round:!0,color:"secondary",className:(0,fe.Z)(ft,!c&&"not-ready",ut&&"recording"),disabled:Rn,ariaLabel:he(Bn),onClick:Mn,onContextMenu:ft===hi.Send&&pt?Lt:void 0},i.ZP.createElement("i",{className:"icon-send"}),i.ZP.createElement("i",{className:"icon-schedule"}),i.ZP.createElement("i",{className:"icon-microphone-alt"}),i.ZP.createElement("i",{className:"icon-check"})),pt&&i.ZP.createElement(Js.Z,{isOpen:xt,onSendSilent:C?void 0:Zn,onSendSchedule:n?void 0:On,onClose:Ot,onCloseAnimationEnd:Ut,isSavedMessages:C}),xe)}))),pi=(0,i.X$)((e=>{const{isActive:t}=e,n=(0,it.Z)(st.gl.Extra,"MobileSearch",!t,!0);return n?i.ZP.createElement(n,e):void 0})),vi=(0,i.X$)((e=>{const{isActive:t}=e,n=(0,it.Z)(st.gl.Extra,"MessageSelectToolbar",!t);return n?i.ZP.createElement(n,e):void 0})),Ii=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,it.Z)(st.gl.Extra,"UnpinAllMessagesModal",!t);return n?i.ZP.createElement(n,e):void 0})),yi=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,it.Z)(st.gl.Extra,"PaymentModal",!t);return n?i.ZP.createElement(n,e):void 0})),wi=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,it.Z)(st.gl.Extra,"ReceiptModal",!t);return n?i.ZP.createElement(n,e):void 0})),Zi=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,it.Z)(st.gl.Extra,"SeenByModal",!t);return n?i.ZP.createElement(n,e):void 0})),Pi=(0,i.X$)((e=>{const{activeEmojiInteraction:t}=e,n=(0,it.Z)(st.gl.Extra,"EmojiInteractionAnimation",!t);return n?i.ZP.createElement(n,e):void 0})),Ci=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,it.Z)(st.gl.Extra,"ReactorListModal",!t);return n?i.ZP.createElement(n,e):void 0})),bi=h.wB?450+s.fK:void 0;function Si(e){return"file"===e.kind&&e.type&&s.oG.has(e.type)}const Ei=(0,i.X$)((0,a.c$)((e=>{const t=(0,c.Pu)(e),{isBlurred:n,background:a,backgroundColor:s,patternColor:i}=e.settings.themes[t]||{},{messageLists:r}=e.messages,l=(0,c.Bt)(e),{isLeftColumnShown:u,chats:{listIds:m},activeEmojiInteractions:g,lastSyncTime:f}=e,p={theme:t,customBackground:a,backgroundColor:s,patternColor:i,isLeftColumnShown:u,isRightColumnShown:(0,c.Jf)(e),isBackgroundBlurred:n,isMobileSearchActive:Boolean(h.wB&&(0,c.n5)(e)),isSelectModeActive:(0,c.CA)(e),isPaymentModalOpen:e.payment.isPaymentModalOpen,isReceiptModalOpen:Boolean(e.payment.receipt),isSeenByModalOpen:Boolean(e.seenByModal),isReactorListModalOpen:Boolean(e.reactorModal),animationLevel:e.settings.byKey.animationLevel,currentTransitionKey:Math.max(0,e.messages.messageLists.length-1),activeEmojiInteractions:g,lastSyncTime:f};if(!l||!m.active)return p;const{chatId:v,threadId:I,type:y}=l,w=(0,d.YC)(v),Z=(0,c.Z1)(e,v),P=(0,c.IK)(e,v),C=(0,c.KB)(e,v),{chatId:b,messageId:S}=e.audioPlayer,E=Z&&(0,d.Qm)(Z,I),M=(0,c.pk)(e,v),R="pinned"===y,k="scheduled"===y,N="thread"===y&&I===o._f,T=Boolean(Z&&(0,d.eA)(Z)),A=Boolean(Z&&N&&(T||(0,d.ZV)(Z))&&Z.isNotJoined),B=Boolean(P&&(0,c.s4)(e,P.id)),x=!B&&M;return{...p,chatId:v,threadId:I,messageListType:y,isPrivate:w,areChatSettingsLoaded:Boolean(null==Z?void 0:Z.settings),canPost:!R&&(!Z||E)&&!M,isPinnedMessageList:R,isScheduledMessageList:k,currentUserBannedRights:null==Z?void 0:Z.currentUserBannedRights,defaultBannedRights:null==Z?void 0:Z.defaultBannedRights,hasPinnedOrAudioPlayer:I!==o._f||Boolean(!R&&(null==C?void 0:C.length))||Boolean(b&&S),pinnedMessagesCount:C?C.length:0,shouldSkipHistoryAnimations:e.shouldSkipHistoryAnimations,messageLists:r,isChannel:T,canSubscribe:A,canStartBot:x,canRestartBot:B}}))((e=>{let{chatId:t,threadId:n,messageListType:o,isPrivate:r,isPinnedMessageList:c,messageLists:l,canPost:u,currentUserBannedRights:m,defaultBannedRights:g,hasPinnedOrAudioPlayer:f,pinnedMessagesCount:p,customBackground:v,theme:I,backgroundColor:y,patternColor:w,isLeftColumnShown:Z,isRightColumnShown:P,isBackgroundBlurred:C,isMobileSearchActive:b,isSelectModeActive:S,isPaymentModalOpen:E,isReceiptModalOpen:M,isSeenByModalOpen:R,isReactorListModalOpen:k,animationLevel:N,shouldSkipHistoryAnimations:T,currentTransitionKey:A,isChannel:B,areChatSettingsLoaded:x,canSubscribe:L,canStartBot:O,canRestartBot:U,activeEmojiInteractions:F,lastSyncTime:D}=e;const{openChat:$,unpinAllMessages:q,loadUser:j,loadChatSettings:G,closeLocalTextSearch:H,exitMessageSelectMode:_,closePaymentModal:z,clearReceipt:V,joinChannel:K,sendBotCommand:X,restartBot:Q}=(0,a.Sv)(),{width:ee}=bt(),te=(0,Fe.Z)(),[ne,ae]=(0,i.eJ)(wt.t.None),[se,ie]=(0,i.eJ)(),[oe,re]=(0,i.eJ)(),[ce,le]=(0,i.eJ)(!1),de=f&&(ee<s.l3||P&&ee>s._m&&ee<s.QU||ee>=s.ks&&ee<s.jT),ue=(0,St.Z)(t,bi),me=(0,St.Z)(n,bi),he=(0,St.Z)(o,bi),ge=(0,St.Z)(L,bi),pe=(0,St.Z)(O,bi),ve=(0,St.Z)(U,bi),Ie=(0,St.Z)(u,bi)&&!ve&&!pe&&!ge,ye=(0,St.Z)(de,bi),we=(0,St.Z)(se,bi),Ze=(0,St.Z)(B,bi),Ce=(0,Et.Z)(A),be=void 0!==Ce&&Ce<A?Ce:void 0,{isReady:Se,handleOpenEnd:Ee,handleSlideStop:Re}=function(e,t,n,a){const[s,o]=(0,i.eJ)(!h.wB),r=(0,Mt.Z)(),c=void 0!==n&&n!==t;return c&&(e?o(!1):r()),(0,Pe.Z)((()=>{e||o(!0)}),[e]),{isReady:s&&!c,handleOpenEnd:e?function(e){"transform"===e.propertyName&&e.target===e.currentTarget&&o(Boolean(a))}:void 0,handleSlideStop:e?function(){o(!0)}:void 0}}(!T&&N!==s.oB,A,Ce,t);(0,i.d4)((()=>t?(0,Be.Z)((()=>{$({id:void 0})})):void 0),[t,$]),(0,Pe.Z)((()=>{ae(wt.t.None),ie(void 0),re(void 0)}),[t]),(0,i.d4)((()=>{const{visualViewport:e}=window;if(!e)return;const t=()=>{window.visualViewport.height!==document.documentElement.clientHeight?document.body.classList.add("keyboard-visible"):document.body.classList.remove("keyboard-visible")};return e.addEventListener("resize",t),()=>{e.removeEventListener("resize",t)}}),[]),(0,i.d4)((()=>{r&&j({userId:t})}),[t,r,j]),(0,i.d4)((()=>{!x&&D&&G({chatId:t})}),[t,r,x,D,G]);const ke=(0,i.I4)((e=>{if(h.$b)return;const{items:t}=e.dataTransfer||{},n=t&&t.length>0&&Array.from(t).filter((e=>"text/uri-list"!==e.type)).every(Si);ae(n?wt.t.QuickFile:wt.t.Document)}),[]),Ne=(0,i.I4)((()=>{ae(wt.t.None)}),[]),Te=(0,i.I4)((()=>{le(!0)}),[]),Ae=(0,i.I4)((()=>{le(!1)}),[]),xe=(0,i.I4)((()=>{q({chatId:t}),Ae(),$({id:t})}),[q,$,Ae,t]),Le=(0,i.I4)((()=>{$({id:t})}),[$,t]),Oe=(0,i.I4)((()=>{K({chatId:t})}),[K,t]),De=(0,i.I4)((()=>{X({command:"/start"})}),[X]),$e=(0,i.I4)((()=>{Q({chatId:t})}),[t,Q]),qe=((e,t)=>{const[n,a]=(0,i.eJ)(t);return(0,i.d4)((()=>{t&&(t.startsWith("#")?a(t):Pt.fetch(s.fo,e,Pt.Type.Blob).then((e=>{const t=URL.createObjectURL(e);(0,Ct.pt)(t).then((()=>{a(`url(${t})`)}))})))}),[t,e]),t?n:void 0})(I,v),je=(0,fe.Z)(ye&&"has-header-tools",v&&"custom-bg-image",y&&"custom-bg-color",v&&C&&"blurred",h.aZ?"mask-image-disabled":"mask-image-enabled"),Ge=(0,fe.Z)("messaging-disabled",!S&&"shown"),He=(0,d.q8)(te,m,g),{composerHiddenScale:_e,toolbarHiddenScale:Ve,composerTranslateX:Ke,toolbarTranslateX:Xe,unpinHiddenScale:We,toolbarForUnpinHiddenScale:Ye}=(0,i.Ye)((()=>function(e,t){const n=e<=s.l3?16:32,a=function(e){if(e>s._m){const t=Math.min(Math.max(.25*e,J),Y),n=Math.min(.25*e,Y);return Math.min(e-t-n,W)}if(e>s.ks){const t=Math.min(Math.max(.4*e,J),Y);return Math.min(e-t,W)}return e>W?W:e}(e),i=e<=s.l3?54:64,o=t?a-n-i:a-n,r=e>s.l3?Math.min(a-n,512):a-n,c=r/o,l=o/r;return{composerHiddenScale:c,toolbarHiddenScale:l,composerTranslateX:t?i/2*l:0,toolbarTranslateX:t?i/2*-1*c:0,unpinHiddenScale:r/258,toolbarForUnpinHiddenScale:258/r}}(ee,Ie)),[Ie,ee]),Je=(0,fe.Z)("middle-column-footer",!Ie&&"no-composer",Ie&&oe&&!S&&"with-notch");(0,Me.ZP)(ue&&me,(()=>{$({id:void 0},{forceSyncOnIOs:!0})}),void 0,void 0,void 0,(null==l?void 0:l.map(Zt.q))||[]),(0,Me.ZP)(b,H),(0,Me.ZP)(S,_);const Qe=Boolean(!c&&!Ie&&!ve&&!pe&&!ge&&He),et=Boolean(ve||ge||pe||c),tt=Boolean(Qe||S||c);return i.ZP.createElement("div",{id:"MiddleColumn",className:je,onTransitionEnd:Ee,style:`\n --composer-hidden-scale: ${_e};\n --toolbar-hidden-scale: ${Ve};\n --unpin-hidden-scale: ${We};\n --toolbar-unpin-hidden-scale: ${Ye};\n --composer-translate-x: ${Ke}px;\n --toolbar-translate-x: ${Xe}px;\n --pattern-color: ${w};\n --theme-background-color:\n ${y||("dark"===I?s.It:s.p3)};\n `,onClick:h.p7&&Z?Le:void 0},i.ZP.createElement("div",{id:"middle-column-bg",style:qe?`--custom-background: ${qe}`:void 0}),i.ZP.createElement("div",{id:"middle-column-portals"}),ue&&me&&i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement("div",{className:"messages-layout",onDragEnter:Ie?ke:void 0},i.ZP.createElement(dn,{chatId:ue,threadId:me,messageListType:he,isReady:Se}),i.ZP.createElement(Ue.Z,{name:T?"none":N===s.zy?"slide":"fade",activeKey:A,shouldCleanup:!0,cleanupExceptionKey:be,onStop:Re},i.ZP.createElement(os,{key:`${ue}-${me}-${he}`,chatId:ue,threadId:me,type:he,canPost:Ie,hasTools:ye,onFabToggle:ie,onNotchToggle:re,isReady:Se,withBottomShift:et}),i.ZP.createElement("div",{className:Je},Ie&&i.ZP.createElement(fi,{chatId:ue,threadId:me,messageListType:he,dropAreaState:ne,onDropHide:Ne,isReady:Se}),c&&i.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:te.isRtl?"rtl":void 0},i.ZP.createElement(ze.Z,{size:"tiny",fluid:!0,color:"secondary",className:"unpin-all-button",onClick:Te},i.ZP.createElement("i",{className:"icon-unpin"}),i.ZP.createElement("span",null,te("Chat.Pinned.UnpinAll",p,"i")))),Qe&&i.ZP.createElement("div",{className:Ge},i.ZP.createElement("div",{className:"messaging-disabled-inner"},i.ZP.createElement("span",null,He))),h.wB&&ge&&i.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:te.isRtl?"rtl":void 0},i.ZP.createElement(ze.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:Oe},te(Ze?"ProfileJoinChannel":"ProfileJoinGroup"))),h.wB&&pe&&i.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:te.isRtl?"rtl":void 0},i.ZP.createElement(ze.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:De},te("BotStart"))),h.wB&&ve&&i.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:te.isRtl?"rtl":void 0},i.ZP.createElement(ze.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:$e},te("BotRestart"))),i.ZP.createElement(vi,{messageListType:he,isActive:S,canPost:Ie}),i.ZP.createElement(yi,{isOpen:Boolean(E),onClose:z}),i.ZP.createElement(wi,{isOpen:Boolean(M),onClose:V}),i.ZP.createElement(Zi,{isOpen:R}),i.ZP.createElement(Ci,{isOpen:k}))),i.ZP.createElement(rs,{isShown:we,canPost:Ie,withExtraShift:tt})),h.wB&&i.ZP.createElement(pi,{isActive:Boolean(b)})),t&&i.ZP.createElement(Ii,{isOpen:ce,chatId:t,pinnedMessagesCount:p,onClose:Ae,onUnpin:xe}),i.ZP.createElement("div",{teactFastList:!0},null==F?void 0:F.map(((e,t)=>i.ZP.createElement(Pi,{teactOrderKey:t,key:e.id,activeEmojiInteraction:e})))))}))),Mi=(0,E.Ds)((e=>e()),200,!1);var Ri;!function(e){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.Management=5]="Management",e[e.ManageInitial=6]="ManageInitial",e[e.ManageChannelSubscribers=7]="ManageChannelSubscribers",e[e.ManageChatAdministrators=8]="ManageChatAdministrators",e[e.ManageChatPrivacyType=9]="ManageChatPrivacyType",e[e.ManageDiscussion=10]="ManageDiscussion",e[e.ManageGroupPermissions=11]="ManageGroupPermissions",e[e.ManageGroupRemovedUsers=12]="ManageGroupRemovedUsers",e[e.ManageChannelRemovedUsers=13]="ManageChannelRemovedUsers",e[e.ManageGroupUserPermissionsCreate=14]="ManageGroupUserPermissionsCreate",e[e.ManageGroupUserPermissions=15]="ManageGroupUserPermissions",e[e.ManageGroupRecentActions=16]="ManageGroupRecentActions",e[e.ManageGroupAdminRights=17]="ManageGroupAdminRights",e[e.ManageGroupNewAdminRights=18]="ManageGroupNewAdminRights",e[e.ManageGroupMembers=19]="ManageGroupMembers",e[e.ManageGroupAddAdmins=20]="ManageGroupAddAdmins",e[e.StickerSearch=21]="StickerSearch",e[e.GifSearch=22]="GifSearch",e[e.PollResults=23]="PollResults",e[e.AddingMembers=24]="AddingMembers",e[e.ManageInvites=25]="ManageInvites",e[e.ManageEditInvite=26]="ManageEditInvite",e[e.ManageReactions=27]="ManageReactions",e[e.ManageInviteInfo=28]="ManageInviteInfo",e[e.ManageJoinRequests=29]="ManageJoinRequests"}(Ri||(Ri={}));const ki=(0,i.X$)((0,a.c$)(((e,t)=>{var n,a,s,i;let{chatId:o,isProfile:r,isManagement:l}=t;const{query:u}=(0,c.n5)(e)||{},{query:m}=(0,c.y5)(e)||{},{query:h}=(0,c.yN)(e)||{},g=o?(0,c.Z1)(e,o):void 0,f=g&&(0,d.eA)(g),p=r&&o&&(0,d.YC)(o)?(0,c.dy)(e,o):void 0,v=p&&(0,d.kw)(p),I=Boolean(!l&&r&&!v&&g&&!(0,c.FM)(e,g.id)&&((0,d.YC)(g.id)||((0,d.Nl)(g)||g.isCreator)&&!g.isNotJoined)),y=Boolean(o&&(null===(n=e.management.byChatId[o])||void 0===n?void 0:n.editingInvite)),w=null==g||null===(a=g.fullInfo)||void 0===a?void 0:a.canViewStatistics,Z=o?null===(s=e.management.byChatId[o])||void 0===s||null===(i=s.inviteInfo)||void 0===i?void 0:i.invite:void 0;return{canManage:I,canAddContact:v,canViewStatistics:w,isChannel:f,userId:null==p?void 0:p.id,messageSearchQuery:u,stickerSearchQuery:m,gifSearchQuery:h,isEditingInvite:y,currentInviteInfo:Z}}))((e=>{var t;let{chatId:n,isColumnOpen:s,isProfile:o,isSearch:r,isManagement:c,isStatistics:l,isStickerSearch:d,isGifSearch:u,isPollResults:g,isAddingChatMembers:f,profileState:p,managementScreen:v,canAddContact:I,userId:y,canManage:w,isChannel:Z,onClose:P,onScreenSelect:C,messageSearchQuery:b,stickerSearchQuery:S,gifSearchQuery:E,shouldSkipAnimation:M,isEditingInvite:R,canViewStatistics:k,currentInviteInfo:N}=e;const{setLocalTextSearchQuery:T,setStickerSearchQuery:A,setGifSearchQuery:B,searchTextMessagesLocal:x,toggleManagement:O,openHistoryCalendar:U,openAddContactDialog:F,toggleStatistics:D,setEditingExportedInvite:$,deleteExportedChatInvite:q}=(0,a.Sv)(),j=(0,i.sO)(null),[G,H,_]=(0,Oe.Z)(),z=(0,i.I4)((()=>{$({chatId:n,invite:N}),C(m.u1.EditInvite)}),[n,N,C,$]),V=(0,i.I4)((()=>{q({chatId:n,link:N.link}),C(m.u1.Invites),_()}),[n,_,N,q,C]),K=(0,i.I4)((e=>{T({query:e}),e.length&&Mi(x)}),[x,T]),X=(0,i.I4)((e=>{A({query:e})}),[A]),W=(0,i.I4)((e=>{B({query:e})}),[B]),Y=(0,i.I4)((()=>{F({userId:y})}),[F,y]),[J,Q]=(0,i.eJ)(!s);(0,i.d4)((()=>{setTimeout((()=>{Q(!s)}),300)}),[s]);const ee=(0,Fe.Z)(),te=o?p===m.vi.Profile?Ri.Profile:p===m.vi.SharedMedia?Ri.SharedMedia:p===m.vi.MemberList?Ri.MemberList:-1:r?Ri.Search:g?Ri.PollResults:d?Ri.StickerSearch:u?Ri.GifSearch:f?Ri.AddingMembers:c?v===m.u1.Initial?Ri.ManageInitial:v===m.u1.ChatPrivacyType?Ri.ManageChatPrivacyType:v===m.u1.Discussion?Ri.ManageDiscussion:v===m.u1.ChannelSubscribers?Ri.ManageChannelSubscribers:v===m.u1.GroupPermissions?Ri.ManageGroupPermissions:v===m.u1.ChatAdministrators?Ri.ManageChatAdministrators:v===m.u1.GroupRemovedUsers?Ri.ManageGroupRemovedUsers:v===m.u1.ChannelRemovedUsers?Ri.ManageChannelRemovedUsers:v===m.u1.GroupUserPermissionsCreate?Ri.ManageGroupUserPermissionsCreate:v===m.u1.GroupUserPermissions?Ri.ManageGroupUserPermissions:v===m.u1.GroupRecentActions?Ri.ManageGroupRecentActions:v===m.u1.ChatAdminRights?Ri.ManageGroupAdminRights:v===m.u1.ChatNewAdminRights?Ri.ManageGroupNewAdminRights:v===m.u1.GroupMembers?Ri.ManageGroupMembers:v===m.u1.Invites?Ri.ManageInvites:v===m.u1.EditInvite?Ri.ManageEditInvite:v===m.u1.GroupAddAdmins?Ri.ManageGroupAddAdmins:v===m.u1.Reactions?Ri.ManageReactions:v===m.u1.InviteInfo?Ri.ManageInviteInfo:v===m.u1.JoinRequests?Ri.ManageJoinRequests:void 0:l?Ri.Statistics:void 0,ne=null!==(t=(0,Nt.Z)(te,!0))&&void 0!==t?t:-1,ae=h.wB||te===Ri.SharedMedia||te===Ri.MemberList||te===Ri.AddingMembers||c,se=(0,fe.Z)("animated-close-icon",ae&&"state-back",(J||M)&&"no-transition");return i.ZP.createElement("div",{className:"RightHeader"},i.ZP.createElement(ze.Z,{className:"close-button",round:!0,color:"translucent",size:"smaller",onClick:P,ariaLabel:ee(ae?"Common.Back":"Common.Close")},i.ZP.createElement("div",{ref:j,className:se})),i.ZP.createElement(Ue.Z,{name:J||M?"none":"slide-fade",activeKey:ne},function(){if(-1!==ne)switch(ne){case Ri.PollResults:return i.ZP.createElement("h3",null,ee("PollResults"));case Ri.Search:return i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement(Ve.Z,{parentContainerClassName:"RightSearch",value:b,onChange:K}),i.ZP.createElement(ze.Z,{round:!0,size:"smaller",color:"translucent",onClick:()=>U({selectedAt:(0,L._F)(Date.now())}),ariaLabel:"Search messages by date"},i.ZP.createElement("i",{className:"icon-calendar"})));case Ri.AddingMembers:return i.ZP.createElement("h3",null,ee(Z?"ChannelAddSubscribers":"GroupAddMembers"));case Ri.ManageInitial:return i.ZP.createElement("h3",null,ee("Edit"));case Ri.ManageChatPrivacyType:return i.ZP.createElement("h3",null,ee(Z?"ChannelTypeHeader":"GroupTypeHeader"));case Ri.ManageDiscussion:return i.ZP.createElement("h3",null,ee("Discussion"));case Ri.ManageChatAdministrators:return i.ZP.createElement("h3",null,ee("ChannelAdministrators"));case Ri.ManageGroupRecentActions:return i.ZP.createElement("h3",null,ee("Group.Info.AdminLog"));case Ri.ManageGroupAdminRights:return i.ZP.createElement("h3",null,ee("EditAdminRights"));case Ri.ManageGroupNewAdminRights:return i.ZP.createElement("h3",null,ee("SetAsAdmin"));case Ri.ManageGroupPermissions:return i.ZP.createElement("h3",null,ee("ChannelPermissions"));case Ri.ManageGroupRemovedUsers:return i.ZP.createElement("h3",null,ee("BlockedUsers"));case Ri.ManageChannelRemovedUsers:return i.ZP.createElement("h3",null,ee("ChannelBlockedUsers"));case Ri.ManageGroupUserPermissionsCreate:return i.ZP.createElement("h3",null,ee("ChannelAddException"));case Ri.ManageGroupUserPermissions:return i.ZP.createElement("h3",null,ee("UserRestrictions"));case Ri.ManageInvites:return i.ZP.createElement("h3",null,ee("lng_group_invite_title"));case Ri.ManageEditInvite:return i.ZP.createElement("h3",null,ee(R?"EditLink":"NewLink"));case Ri.ManageInviteInfo:return i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement("h3",null,ee("InviteLink")),i.ZP.createElement("section",{className:"tools"},N&&!N.isRevoked&&i.ZP.createElement(ze.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:ee("Edit"),onClick:z},i.ZP.createElement("i",{className:"icon-edit"})),N&&N.isRevoked&&i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement(ze.Z,{round:!0,color:"danger",size:"smaller",ariaLabel:ee("Delete"),onClick:H},i.ZP.createElement("i",{className:"icon-delete"})),i.ZP.createElement(Dt.Z,{isOpen:G,onClose:_,title:ee("DeleteLink"),text:ee("DeleteLinkHelp"),confirmIsDestructive:!0,confirmLabel:ee("Delete"),confirmHandler:V}))));case Ri.ManageJoinRequests:return i.ZP.createElement("h3",null,ee(Z?"SubscribeRequests":"MemberRequests"));case Ri.ManageGroupAddAdmins:return i.ZP.createElement("h3",null,ee("Channel.Management.AddModerator"));case Ri.StickerSearch:return i.ZP.createElement(Ve.Z,{value:S,placeholder:ee("SearchStickersHint"),autoFocusSearch:!0,onChange:X});case Ri.GifSearch:return i.ZP.createElement(Ve.Z,{value:E,placeholder:ee("SearchGifsTitle"),autoFocusSearch:!0,onChange:W});case Ri.Statistics:return i.ZP.createElement("h3",null,ee("Statistics"));case Ri.SharedMedia:return i.ZP.createElement("h3",null,ee("SharedMedia"));case Ri.ManageChannelSubscribers:return i.ZP.createElement("h3",null,ee("ChannelSubscribers"));case Ri.MemberList:case Ri.ManageGroupMembers:return i.ZP.createElement("h3",null,ee("GroupMembers"));case Ri.ManageReactions:return i.ZP.createElement("h3",null,ee("Reactions"));default:return i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement("h3",null,"Profile"),i.ZP.createElement("section",{className:"tools"},I&&i.ZP.createElement(ze.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:ee("AddContact"),onClick:Y},i.ZP.createElement("i",{className:"icon-add-user"})),w&&i.ZP.createElement(ze.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:ee("Edit"),onClick:O},i.ZP.createElement("i",{className:"icon-edit"})),k&&i.ZP.createElement(ze.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:ee("Statistics"),onClick:D},i.ZP.createElement("i",{className:"icon-stats"}))))}}()))})));var Ni=n(91);var Ti=n(7407);function Ai(e,t,n,a){const[i,o]=(0,Ti.Z)(n?t:void 0,a,void 0,s.Vk);return[i,o,!(!i||!a||i[0]===a[0])]}function Bi(e,t,n,a,o,r){const c=(0,i.sO)();(0,Pe.Z)((()=>{t===e&&o&&r&&(c.current=(0,d.R5)(o,r,e))}),[o,r,t,e]);const[l,u]=(0,Ti.Z)(a?n:void 0,c.current,void 0,"media"===e?s.EN:s.pn);return[l,u,!(!l||!c.current||l[0]===c.current[0])]}const xi=(0,E.P2)((e=>e()),250,!1);let Li=!1;var Oi=n(1273),Ui=n(1876),Fi=n(787),Di=n(180),$i=n(3709),qi=n(5418),ji=n(7262),Gi=n(1151),Hi=n(2275);const _i=[{type:"media",title:"SharedMediaTab2"},{type:"documents",title:"SharedFilesTab2"},{type:"links",title:"SharedLinksTab2"},{type:"audio",title:"SharedMusicTab2"},{type:"voice",title:"SharedVoiceTab2"}];function zi(e){return[`.shared-media-transition > div:only-child > .${e}-list > .scroll-item`,`.shared-media-transition > .Transition__slide--active > .${e}-list > .scroll-item`].join(", ")}const Vi=(0,i.X$)((0,a.c$)(((e,t)=>{var n,a;let{chatId:s}=t;const i=(0,c.Z1)(e,s),o=(0,c.Zw)(e,s),{currentType:r,resultsByType:l}=(0,c.we)(e)||{},{foundIds:u}=l&&r&&l[r]||{},{byId:m,statusesById:h}=e.users,{byId:g}=e.chats,f=i&&(0,d.Bf)(i),p=i&&(0,d.eA)(i),v=f||p&&(0,d.Nl)(i),I=null==i||null===(n=i.fullInfo)||void 0===n?void 0:n.members,y=v&&i&&(i.isForbidden||i.fullInfo&&!i.fullInfo.canViewMembers),w=v&&i&&((0,d.VE)(i,"inviteUsers")||i.isCreator),Z=v&&i&&((0,d.VE)(i,"banUsers")||i.isCreator),P=(0,c.xs)(e,s);let C,b,S;return(0,d.YC)(s)&&(b=s,S=(0,c.dy)(e,b),C=S&&!S.isSelf&&!(0,d.cS)(S)),{theme:(0,c.Pu)(e),isChannel:p,resolvedUserId:b,chatMessages:o,foundIds:u,mediaSearchType:r,hasCommonChatsTab:C,hasMembersTab:v,areMembersHidden:y,canAddMembers:w,canDeleteMembers:Z,currentUserId:e.currentUserId,isRightColumnShown:(0,c.Jf)(e),isRestricted:null==i?void 0:i.isRestricted,lastSyncTime:e.lastSyncTime,serverTimeOffset:e.serverTimeOffset,activeDownloadIds:P,usersById:m,userStatusesById:h,chatsById:g,isChatProtected:null==i?void 0:i.isProtected,...v&&I&&{members:I},...C&&S&&{commonChatIds:null===(a=S.commonChats)||void 0===a?void 0:a.ids}}}))((e=>{let{chatId:t,profileState:n,onProfileStateChange:r,theme:c,isChannel:l,resolvedUserId:u,currentUserId:g,chatMessages:f,foundIds:p,mediaSearchType:v,hasCommonChatsTab:I,hasMembersTab:y,areMembersHidden:w,canAddMembers:Z,canDeleteMembers:P,commonChatIds:C,members:b,usersById:S,userStatusesById:E,chatsById:M,isRightColumnShown:R,isRestricted:k,lastSyncTime:N,activeDownloadIds:T,serverTimeOffset:A,isChatProtected:B}=e;const{setLocalMediaSearchType:x,loadMoreMembers:L,loadCommonChats:O,openChat:U,searchMediaMessagesLocal:F,openMediaViewer:D,openAudioPlayer:$,focusMessage:q,loadProfilePhotos:j,setNewChatMembersDialogState:G}=(0,a.Sv)(),H=(0,i.sO)(null),_=(0,i.sO)(null),z=(0,Fe.Z)(),[V,K]=(0,i.eJ)(0),[X,W]=(0,i.eJ)(),Y=(0,i.Ye)((()=>[...y?[{type:"members",title:l?"ChannelSubscribers":"GroupMembers"}]:[],..._i,...I?[{type:"commonChats",title:"SharedGroupsTab2"}]:[]]),[I,y,l]),J=Y[V].type,[Q,ee,te,ne]=function(e,t,n,a,s,o,r,c,l,u,m,h,g,f,p){let v=arguments.length>15&&void 0!==arguments[15]?arguments[15]:0;const I="members"!==s&&o?o:s,y=(0,i.Ye)((()=>{if(r&&l&&u)return(0,d.Z0)(r.map((e=>{let{userId:t}=e;return t})),l,u,void 0,v)}),[r,v,l,u]),w=(0,i.Ye)((()=>{if(c&&m)return(0,d.ih)(c,m,!0)}),[m,c]),[Z,P,C]=Ai(0,t,p,y),[b,S,E]=Bi("media",I,a,p,h,g),[M,R,k]=Bi("documents",I,a,p,h,g),[N,T,A]=Bi("links",I,a,p,h,g),[B,x,L]=Bi("audio",I,a,p,h,g),[O,U,F]=Bi("voice",I,a,p,h,g),[D,$,q]=Ai(0,n,p,w);let j,G,H=!1;switch(I){case"members":j=Z,G=P,H=C;break;case"commonChats":j=D,G=$,H=q;break;case"media":j=b,G=S,H=E;break;case"documents":j=M,G=R,H=k;break;case"links":j=N,G=T,H=A;break;case"audio":j=B,G=x,H=L;break;case"voice":j=O,G=U,H=F}return[I,j,G,H]}(R,L,O,F,J,v,b,C,S,E,M,f,p,t,N,A),ae=Y.findIndex((e=>{let{type:t}=e;return t===Q})),{handleScroll:se}=function(e,t,n,a){(0,mn.Z)((n=>{let[s]=n;if(s&&s!==t){const n=e.current,s=n.querySelector(".TabList");n.scrollTop<s.offsetTop&&(a("members"===t?m.vi.MemberList:m.vi.SharedMedia),Li=!0,(0,In.Z)(n,s,"start",void 0,void 0,void 0,300),setTimeout((()=>{Li=!1}),350))}}),[t,a]),(0,mn.Z)((t=>{let[s]=t;if(n!==m.vi.Profile||n===s)return;const i=e.current;if(!i)return;const o=i.querySelector(".TabList");!o||o.offsetTop>i.scrollTop||(Li=!0,(0,In.Z)(i,i.firstElementChild,"start",void 0,2*i.offsetHeight),setTimeout((()=>{Li=!1}),350),a(n))}),[n]);const s=(0,i.I4)((()=>{const n=e.current;if(!n)return;const s=n.querySelector(".TabList");if(!s)return;let i=m.vi.Profile;n.scrollTop>=s.offsetTop&&(i="members"===t?m.vi.MemberList:m.vi.SharedMedia),a(i)}),[e,a,t]);return(0,i.d4)((()=>{Li||s()}),[s,t]),{handleScroll:(0,i.I4)((()=>{Li||xi(s)}),[s])}}(H,J,n,r),{applyTransitionFix:ie,releaseTransitionFix:oe}=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:".Transition.shared-media-transition";(0,i.d4)((()=>{function n(){const n=e.current,a=n.querySelector(t),s=n.querySelector(".TabList");a&&s&&(a.style.minHeight=n.offsetHeight-s.offsetHeight+"px")}return n(),window.addEventListener("resize",n,!1),()=>{window.removeEventListener("resize",n,!1)}}),[e,t]);const n=(0,i.I4)((()=>{const t=e.current;if("hidden"!==t.style.overflowY){const e=t.offsetWidth-t.clientWidth;t.style.overflowY="hidden",t.style.marginRight=`${e}px`}}),[e]),a=(0,i.I4)((()=>{const t=e.current;t.style.overflowY="scroll",t.style.marginRight="0"}),[e]);return{applyTransitionFix:n,releaseTransitionFix:a}}(H),[re,ce]=(()=>{const[e,t]=(0,i.eJ)(!1);return[e,(0,i.I4)((()=>{t((e=>!e))}),[])]})(),{observe:le}=(0,Zn.S1)({rootRef:H,throttleMs:500}),de=(0,i.I4)((()=>{oe(),ce()}),[oe,ce]),ue=(0,i.I4)((()=>{G(m.WB.InProgress)}),[G]);(0,i.d4)((()=>{x({mediaType:J})}),[x,J]);const me=u||t;(0,i.d4)((()=>{N&&j({profileId:me})}),[j,me,N]);const he=(0,i.I4)((e=>{D({chatId:me,threadId:o._f,messageId:e,origin:m.bZ.SharedMedia})}),[me,D]),ge=(0,i.I4)((e=>{$({chatId:me,messageId:e})}),[me,$]),fe=(0,i.I4)((e=>{U({id:e})}),[U]),pe=(0,i.I4)((e=>{q({chatId:me,messageId:e})}),[me,q]),ve=(0,i.I4)((()=>{W(void 0)}),[]);let Ie;(0,i.d4)((()=>{if(_.current&&h.$b)return(0,et.sf)(_.current,{selectorToPreventScroll:".Profile",onSwipe:(e,t)=>t===et.eM.Left?(K(Math.min(V+1,Y.length-1)),!0):t===et.eM.Right&&(K(Math.max(0,V-1)),!0)})}),[V,Y.length]);const ye="members"===Q||!y&&"media"===Q;ye?Ie=R?0:1e3:ee||(Ie=s.Y);const we=(0,si.Z)([t,Q],Ie);return i.ZP.createElement(Oi.Z,{ref:H,className:"Profile custom-scroll",itemSelector:zi(Q),items:we?ee:void 0,cacheBuster:re,sensitiveArea:s.qU,preloadBackwards:we?"members"===Q?s.Vk:s.EN:0,noScrollRestoreOnTop:!0,noFastList:!0,onLoadMore:te,onScroll:se},!ne&&function(e,t){return i.ZP.createElement("div",{className:"profile-info"},i.ZP.createElement(Fi.Z,{userId:t||e}),i.ZP.createElement(Di.Z,{chatOrUserId:t||e}))}(t,u),!k&&i.ZP.createElement("div",{className:"shared-media"},i.ZP.createElement(Ue.Z,{ref:_,name:z.isRtl?"slide-optimized-rtl":"slide-optimized",activeKey:ae,renderCount:Y.length,shouldRestoreHeight:!0,className:"shared-media-transition",onStart:ie,onStop:de},function(){if(!ee||!we||!f){const e=ye&&!we,t=Boolean("members"===Q&&w);return i.ZP.createElement("div",{className:"content empty-list"},!e&&!t&&i.ZP.createElement(Ye.Z,null),t&&i.ZP.createElement(ji.Z,{text:"You have no access to group members list."}))}if(!ee.length){let e;switch(Q){case"members":e=w?"You have no access to group members list.":"No members found";break;case"commonChats":e=z("NoGroupsInCommon");break;case"documents":e=z("lng_media_file_empty");break;case"links":e=z("lng_media_link_empty");break;case"audio":e=z("lng_media_song_empty");break;case"voice":e=z("lng_media_audio_empty");break;default:e=z("SharedMedia.EmptyTitle")}return i.ZP.createElement("div",{className:"content empty-list"},i.ZP.createElement(ji.Z,{text:e}))}return i.ZP.createElement("div",{className:`content ${Q}-list`,dir:z.isRtl&&"media"===Q?"rtl":void 0,teactFastList:!0},"media"===Q?ee.map((e=>f[e]&&i.ZP.createElement($i.Z,{key:e,message:f[e],isProtected:B||f[e].isProtected,observeIntersection:le,onClick:he}))):"documents"===Q?ee.map((e=>f[e]&&i.ZP.createElement(_n.Z,{key:e,message:f[e],withDate:!0,smaller:!0,className:"scroll-item",isDownloading:T.includes(e),observeIntersection:le,onDateClick:pe}))):"links"===Q?ee.map((e=>f[e]&&i.ZP.createElement(qi.Z,{key:e,message:f[e],isProtected:B||f[e].isProtected,observeIntersection:le,onMessageClick:pe}))):"audio"===Q?ee.map((e=>f[e]&&i.ZP.createElement(zn.Z,{key:e,theme:c,message:f[e],origin:m.Cr.SharedMedia,date:f[e].date,lastSyncTime:N,className:"scroll-item",onPlay:ge,onDateClick:pe,isDownloading:T.includes(e)}))):"voice"===Q?ee.map((e=>f[e]&&i.ZP.createElement(zn.Z,{key:e,theme:c,message:f[e],senderTitle:(0,Ni.F)(z,f[e],M,S),origin:m.Cr.SharedMedia,date:f[e].date,lastSyncTime:N,className:"scroll-item",onPlay:ge,onDateClick:pe,isDownloading:T.includes(e)}))):"members"===Q?ee.map(((e,t)=>{return i.ZP.createElement(Ui.Z,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item small-icon",onClick:()=>fe(e),contextActions:(n=e,n!==g&&P?[{title:z("lng_context_remove_from_group"),icon:"stop",handler:()=>{W(n)}}]:void 0)},i.ZP.createElement(Tt.Z,{userId:e,forceShowSelf:!0}));var n})):"commonChats"===Q?ee.map(((e,t)=>i.ZP.createElement(Ui.Z,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item small-icon",onClick:()=>U({id:e})},i.ZP.createElement(At.Z,{chatId:e})))):void 0)}()),i.ZP.createElement(tt.Z,{big:!0,activeTab:V,tabs:Y,onSwitchTab:K})),Z&&i.ZP.createElement(Gi.Z,{isShown:"members"===Q,onClick:ue,ariaLabel:z("lng_channel_add_users")},i.ZP.createElement("i",{className:"icon-add-user-filled"})),P&&i.ZP.createElement(Hi.Z,{isOpen:Boolean(X),userId:X,onClose:ve}))}))),Ki=(0,i.X$)((e=>{const t=(0,it.Z)(st.gl.Extra,"RightSearch");return t?i.ZP.createElement(t,e):i.ZP.createElement(ot.Z,null)})),Xi=(0,i.X$)((e=>{const t=(0,it.Z)(st.gl.Extra,"Management");return t?i.ZP.createElement(t,e):i.ZP.createElement(ot.Z,null)})),Wi=e=>{const t=(0,it.Z)(st.gl.Extra,"Statistics");return t?i.ZP.createElement(t,e):i.ZP.createElement(ot.Z,null)},Yi=(0,i.X$)((()=>{const e=(0,it.Z)(st.gl.Extra,"StickerSearch");return e?i.ZP.createElement(e,null):i.ZP.createElement(ot.Z,null)})),Ji=(0,i.X$)((()=>{const e=(0,it.Z)(st.gl.Extra,"GifSearch");return e?i.ZP.createElement(e,null):i.ZP.createElement(ot.Z,null)})),Qi=(0,i.X$)((()=>{const e=(0,it.Z)(st.gl.Extra,"PollResults");return e?i.ZP.createElement(e,null):i.ZP.createElement(ot.Z,null)}));var eo=n(1820);const to=(0,i.X$)((0,a.c$)(((e,t)=>{var n;let{chatId:a}=t;const s=(0,c.Z1)(e,a),{userIds:i}=e.contactList||{},{byId:o}=e.chats,{currentUserId:r,newChatMembersProgress:l,connectionState:u}=e,h=s&&(0,d.eA)(s),{query:g,fetchingStatus:f,globalUserIds:p,localUserIds:v}=e.userSearch;return{isChannel:h,members:null==s||null===(n=s.fullInfo)||void 0===n?void 0:n.members,currentUserId:r,chatsById:o,localContactIds:i,searchQuery:g,isSearching:f,isLoading:l===m.WB.Loading,globalUserIds:p,localUserIds:v,connectionState:u}}))((e=>{let{isChannel:t,connectionState:n,members:s,onNextStep:o,currentUserId:r,chatsById:c,localContactIds:l,isLoading:u,searchQuery:m,isSearching:h,localUserIds:f,globalUserIds:p,onClose:v,isActive:I}=e;const{setUserSearchQuery:y,loadContactList:w}=(0,a.Sv)(),Z=(0,Fe.Z)(),[P,C]=(0,i.eJ)([]),b=(0,Et.Z)(P)===P;(0,i.d4)((()=>{I&&"connectionStateReady"===n&&w()}),[n,I,w]),(0,Me.ZP)(I,v);const S=(0,i.Ye)((()=>s?s.map((e=>e.userId)):[]),[s]),E=(0,i.I4)((e=>{y({query:e})}),[y]),M=(0,i.Ye)((()=>{const e=(0,a.Rd)().users.byId,n=l?(0,d.kK)(l,e,m):[];return(0,d.ih)((0,g.Tw)([...n,...f||[],...p||[]]).filter((n=>{const a=e[n];return!S.includes(n)&&n!==r&&(!a||!(0,d.cS)(a)||!t&&a.canBeInvitedToGroup)})),c)}),[l,c,m,f,p,r,S,t]),R=(0,i.I4)((()=>{P.length&&(y({query:""}),o(P))}),[P,y,o]);return i.ZP.createElement("div",{className:"AddChatMembers"},i.ZP.createElement("div",{className:"AddChatMembers-inner"},i.ZP.createElement(eo.Z,{itemIds:M,selectedIds:P,filterValue:m,filterPlaceholder:Z("lng_channel_add_users"),searchInputId:"new-members-picker-search",isLoading:h,onSelectedIdsChange:C,onFilterChange:E,noScrollRestore:b}),i.ZP.createElement(Gi.Z,{isShown:Boolean(P.length),disabled:u,ariaLabel:Z("lng_channel_add_users"),onClick:R},u?i.ZP.createElement(Ye.Z,{color:"white"}):i.ZP.createElement("i",{className:"icon-arrow-right"}))))}))),no=Object.keys(m.qt).length/2,ao=Object.keys(m.u1).length/2;function so(){const e=document.querySelector(".RightHeader .SearchInput input");e&&e.blur()}const io=(0,i.X$)((0,a.c$)((e=>{var t;const{chatId:n,threadId:a}=(0,c.Bt)(e)||{},s=(0,c.g4)(e),i=n?null===(t=e.management.byChatId[n])||void 0===t?void 0:t.nextScreen:void 0;return{contentKey:(0,c.Wq)(e),chatId:n,threadId:a,isChatSelected:Boolean(n&&s),shouldSkipHistoryAnimations:e.shouldSkipHistoryAnimations,nextManagementScreen:i}}))((e=>{var t;let{contentKey:n,chatId:o,threadId:r,isChatSelected:c,shouldSkipHistoryAnimations:l,nextManagementScreen:d}=e;const{toggleChatInfo:u,toggleManagement:h,closeLocalTextSearch:g,setStickerSearchQuery:f,setGifSearchQuery:p,closePollResults:v,addChatMembers:I,setNewChatMembersDialogState:y,setEditingExportedInvite:w,toggleStatistics:Z,setOpenedInviteInfo:P,requestNextManagementScreen:C}=(0,a.Sv)(),{width:b}=bt(),[S,E]=(0,i.eJ)(m.vi.Profile),[M,R]=(0,i.eJ)(m.u1.Initial),[k,N]=(0,i.eJ)(),[T,A]=(0,i.eJ)(),B=S!==m.vi.Profile,x=void 0!==n,L=n===m.qt.ChatInfo,O=n===m.qt.Search,U=n===m.qt.Management,F=n===m.qt.Statistics,D=n===m.qt.StickerSearch,$=n===m.qt.GifSearch,q=n===m.qt.PollResults,j=n===m.qt.AddingMembers,G=b<=s._m,[H,_]=(0,i.eJ)(!x),z=null!==(t=(0,Nt.Z)(n,!0,!c))&&void 0!==t?t:-1,V=(0,i.I4)((function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];switch(n){case m.qt.AddingMembers:y(m.WB.Closed);break;case m.qt.ChatInfo:if(B&&e){E(m.vi.Profile);break}u(void 0,{forceSyncOnIOs:!0});break;case m.qt.Management:switch(M){case m.u1.Initial:h();break;case m.u1.ChatPrivacyType:case m.u1.Discussion:case m.u1.GroupPermissions:case m.u1.GroupType:case m.u1.ChatAdministrators:case m.u1.ChannelSubscribers:case m.u1.GroupMembers:case m.u1.Invites:case m.u1.Reactions:case m.u1.JoinRequests:case m.u1.ChannelRemovedUsers:R(m.u1.Initial);break;case m.u1.GroupUserPermissionsCreate:case m.u1.GroupRemovedUsers:case m.u1.GroupUserPermissions:R(m.u1.GroupPermissions),N(void 0),A(void 0);break;case m.u1.ChatAdminRights:case m.u1.ChatNewAdminRights:case m.u1.GroupAddAdmins:case m.u1.GroupRecentActions:R(m.u1.ChatAdministrators);break;case m.u1.EditInvite:case m.u1.InviteInfo:R(m.u1.Invites),P({invite:void 0}),w({chatId:o,invite:void 0})}break;case m.qt.Statistics:Z();break;case m.qt.Search:so(),g();break;case m.qt.StickerSearch:so(),f({query:void 0});break;case m.qt.GifSearch:so(),p({query:void 0});break;case m.qt.PollResults:v()}}),[n,B,u,v,y,M,h,g,f,p,w,o,P,Z]),K=(0,i.I4)(((e,t)=>{N(e),A(t)}),[]),X=(0,i.I4)((e=>{I({chatId:o,memberIds:e})}),[I,o]);function W(e){if(-1!==z)switch(z){case m.qt.AddingMembers:return i.ZP.createElement(to,{key:o,chatId:o,isActive:x&&e,onNextStep:X,onClose:V});case m.qt.ChatInfo:return i.ZP.createElement(Vi,{key:o,chatId:o,profileState:S,onProfileStateChange:E});case m.qt.Search:return i.ZP.createElement(Ki,{chatId:o,threadId:r,onClose:V,isActive:x&&e});case m.qt.Management:return i.ZP.createElement(Xi,{key:o,chatId:o,currentScreen:M,isPromotedByCurrentUser:T,selectedChatMemberId:k,isActive:x&&e,onScreenSelect:R,onChatMemberSelect:K,onClose:V});case m.qt.Statistics:return i.ZP.createElement(Wi,{chatId:o,isActive:x&&e});case m.qt.StickerSearch:return i.ZP.createElement(Yi,{onClose:V,isActive:x&&e});case m.qt.GifSearch:return i.ZP.createElement(Ji,{onClose:V,isActive:x&&e});case m.qt.PollResults:return i.ZP.createElement(Qi,{onClose:V,isActive:x&&e})}}return(0,i.d4)((()=>x?(0,Be.Z)(V):void 0),[x,V]),(0,i.d4)((()=>{setTimeout((()=>{_(!x)}),300)}),[x]),(0,i.d4)((()=>{d&&(R(d),C(void 0))}),[d,C]),(0,i.d4)((()=>{x&&G&&V()}),[G]),(0,un.Z)((e=>{let[t]=e;t!==o&&(E(m.vi.Profile),R(m.u1.Initial))}),[o]),(0,Me.ZP)(c&&(n===m.qt.ChatInfo||n===m.qt.Management||n===m.qt.AddingMembers),(()=>V(!1)),u),i.ZP.createElement("div",{id:"RightColumn-wrapper",className:c?void 0:"is-hidden"},G&&i.ZP.createElement("div",{className:"overlay-backdrop",onClick:V}),i.ZP.createElement("div",{id:"RightColumn"},i.ZP.createElement(ki,{chatId:o,isColumnOpen:x,isProfile:L,isSearch:O,isManagement:U,isStatistics:F,isStickerSearch:D,isGifSearch:$,isPollResults:q,isAddingChatMembers:j,profileState:S,managementScreen:M,onClose:V,shouldSkipAnimation:H||l,onScreenSelect:R}),i.ZP.createElement(Ue.Z,{name:H||l?"none":"zoom-fade",renderCount:no+ao,activeKey:U?no+M:z,shouldCleanup:!0},W)))}))),oo=(0,i.X$)((e=>{let{isOpen:t}=e;const n=(0,it.Z)(st.gl.Extra,"MediaViewer",!t);return n?i.ZP.createElement(n,null):void 0}));var ro=n(9618);let co=[],lo=!1;function uo(e,t){co.push({url:e,filename:t}),lo||(lo=!0,setTimeout((async()=>{await async function(){let e=0;for(const t of co)mo(t),e++,10===e&&(await(0,ro.sleep)(1e3),e=0);co=[]}(),lo=!1}),1e3))}function mo(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 ho=new Set,go=new Set,fo=(0,i.X$)((0,a.c$)((e=>({activeDownloads:e.activeDownloads.byChatId,messages:e.messages.byChatId})))((e=>{let{activeDownloads:t,messages:n}=e;const{cancelMessagesMediaDownload:s}=(0,a.Sv)(),r=(0,pn.Z)(1e3,!0),c=(0,i.I4)((e=>{go.add(e),r((()=>{go.size&&(s({messages:Array.from(go)}),go.clear())}))}),[s,r]);(0,i.d4)((()=>{const e=Object.entries(t).map((e=>{let[t,a]=e;return a.map((e=>n[t].byId[e]))})).flat();e.length?e.forEach((e=>{if(ho.has(e))return;ho.add(e);const t=(0,d.Ti)(e,"download");if(!t)return void c(e);const n=K.UV(t);if(n)return uo(n,(0,d.w6)(e)),void c(e);K.he(t,o.IU.BlobUrl,!0).then((t=>{t&&uo(t,(0,d.w6)(e)),c(e)}))})):ho.clear()}),[n,t,s,c])}))),po=(0,i.X$)((e=>{let{isOpen:t}=e;const n=(0,it.Z)(st.gl.Extra,"Notifications",!t);return n?i.ZP.createElement(n,null):void 0})),vo=(0,i.X$)((e=>{let{isOpen:t}=e;const n=(0,it.Z)(st.gl.Extra,"Dialogs",!t);return n?i.ZP.createElement(n,null):void 0})),Io=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,it.Z)(st.gl.Extra,"ForwardPicker",!t);return n?i.ZP.createElement(n,e):void 0})),yo=(0,i.X$)((e=>{const{url:t}=e,n=(0,it.Z)(st.gl.Extra,"SafeLinkModal",!t);return n?i.ZP.createElement(n,e):void 0})),wo=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,it.Z)(st.gl.Extra,"HistoryCalendar",!t);return n?i.ZP.createElement(n,e):void 0})),Zo=(0,i.X$)((e=>{const{groupCallId:t}=e,n=(0,it.Z)(st.gl.Calls,"GroupCall",!t);return n?i.ZP.createElement(n,e):void 0})),Po=(0,i.X$)((e=>{const{groupCallId:t}=e,n=(0,it.Z)(st.gl.Calls,"ActiveCallHeader",!t);return n?i.ZP.createElement(n,null):void 0})),Co=(0,i.X$)((e=>{let{isOpen:t}=e;const n=(0,it.Z)(st.gl.Calls,"CallFallbackConfirm",!t);return n?i.ZP.createElement(n,{isOpen:t}):void 0})),bo=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,it.Z)(st.gl.Extra,"NewContactModal",!t);return n?i.ZP.createElement(n,e):void 0}));let So,Eo=!1;function Mo(e){document.querySelectorAll('link[rel="icon"], link[rel="alternate icon"]').forEach((t=>{e?t.href.includes("favicon-unread")||(t.href=t.href.replace("favicon","favicon-unread")):t.href=t.href.replace("favicon-unread","favicon")}))}function Ro(e){document.title!==e&&(document.title=e)}const ko=(0,i.X$)((0,a.c$)((e=>{var t,n;const{settings:{byKey:{animationLevel:a,language:s,wasTimeFormatSetManually:i}}}=e,{chatId:o,messageId:r}=e.audioPlayer,l=o&&r?(0,c.hj)(e,o,r):void 0;return{connectionState:e.connectionState,authState:e.authState,lastSyncTime:e.lastSyncTime,isLeftColumnShown:e.isLeftColumnShown,isRightColumnShown:(0,c.Jf)(e),isMediaViewerOpen:(0,c.zQ)(e),isForwardModalOpen:(0,c.Ev)(e),hasNotifications:Boolean(e.notifications.length),hasDialogs:Boolean(e.dialogs.length),audioMessage:l,safeLinkModalUrl:e.safeLinkModalUrl,isHistoryCalendarOpen:Boolean(e.historyCalendarSelectedAt),shouldSkipHistoryAnimations:e.shouldSkipHistoryAnimations,openedStickerSetShortName:e.openedStickerSetShortName,isServiceChatReady:(0,c.UW)(e),activeGroupCallId:e.groupCalls.activeGroupCallId,animationLevel:a,language:s,wasTimeFormatSetManually:i,isCallFallbackConfirmOpen:Boolean(e.groupCalls.isFallbackConfirmOpen),addedSetIds:e.stickers.added.setIds,newContactUserId:null===(t=e.newContact)||void 0===t?void 0:t.userId,newContactByPhoneNumber:null===(n=e.newContact)||void 0===n?void 0:n.isByPhoneNumber}}))((e=>{let{connectionState:t,authState:n,lastSyncTime:o,isLeftColumnShown:r,isRightColumnShown:c,isMediaViewerOpen:l,isForwardModalOpen:d,hasNotifications:u,hasDialogs:m,audioMessage:g,activeGroupCallId:f,safeLinkModalUrl:p,isHistoryCalendarOpen:v,shouldSkipHistoryAnimations:I,openedStickerSetShortName:y,isServiceChatReady:w,animationLevel:Z,language:P,wasTimeFormatSetManually:C,isCallFallbackConfirmOpen:b,addedSetIds:S,newContactUserId:M,newContactByPhoneNumber:R}=e;const{sync:k,loadAnimatedEmojis:N,loadNotificationSettings:T,loadNotificationExceptions:A,updateIsOnline:B,loadTopInlineBots:x,loadEmojiKeywords:L,loadCountryList:O,loadAvailableReactions:U,loadStickerSets:F,loadAddedStickers:$,loadFavoriteStickers:q,ensureTimeFormat:j,openStickerSetShortName:G,checkVersionNotification:H,loadAppConfig:_}=(0,a.Sv)();s.eM&&!Eo&&(Eo=!0,console.log(">>> RENDER MAIN")),(0,i.d4)((()=>{"connectionStateReady"===t&&"authorizationStateReady"===n&&k()}),[t,n,k]),(0,i.d4)((()=>{o&&(B(!0),_(),U(),N(),T(),A(),x(),L({language:s.pR}))}),[o,N,L,A,T,x,B,U,_]),(0,i.d4)((()=>{o&&(P!==s.pR&&L({language:P}),O({langCode:P}))}),[P,o,O,L]),(0,i.d4)((()=>{o&&(S?$():(F(),q()))}),[o,S,F,q,$]),(0,i.d4)((()=>{o&&w&&H()}),[o,w,H]),(0,i.d4)((()=>{o&&!C&&j()}),[o,C,j]),(0,i.d4)((()=>{o&&Me.Oy.startsWith("#?tgaddr=")&&(0,ve.o)(decodeURIComponent(Me.Oy.substr("#?tgaddr=".length)))}),[o]),(0,i.d4)((()=>{if(f)return Q.Z.disableRefresh(),()=>{Q.Z.enableRefresh()}}),[f]);const{transitionClassNames:z}=(0,ye.Z)(!r,void 0,!0,void 0,I),{transitionClassNames:V}=(0,ye.Z)(c,void 0,!0,void 0,I),K=(0,fe.Z)(z.replace(/([\w-]+)/g,"middle-column-$1"),V.replace(/([\w-]+)/g,"right-column-$1"),I&&"history-animation-disabled");(0,Pe.Z)((e=>{let[t]=e;if(void 0===t||0===Z)return;const n=(0,ge.YW)();(0,pe.L)(document.getElementById("MiddleColumn"),n)}),[r]),(0,Pe.Z)((e=>{let[t]=e;if(void 0===t||0===Z)return;(0,E.T2)((()=>{document.body.classList.add("animating-right-column")}));const n=(0,ge.YW)();(0,pe.L)(document.getElementById("RightColumn"),(()=>{n(),(0,E.T2)((()=>{document.body.classList.remove("animating-right-column")}))}))}),[c]);const X=(0,i.I4)((()=>{B(!1);const e=(0,D.xW)();let t=0;clearInterval(So),So=window.setInterval((()=>{if(document.title.includes(s.ou))Mo(!1);else{if(t%2==0){const t=(0,D.xW)()-e;t>0&&(Ro(`${t} notification${t>1?"s":""}`),Mo(!0))}else Ro(s.Ti),Mo(!1);t++}}),1e3)}),[B]),W=(0,i.I4)((()=>{B(!0),clearInterval(So),So=void 0,document.title.includes(s.ou)||Ro(s.Ti),Mo(!1)}),[B]),Y=(0,i.I4)((()=>{G({stickerSetShortName:void 0})}),[G]);return(0,we.Z)(X,W),Ze(X),function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];(0,i.d4)((()=>{if(h.$b){if(!e)return null==Ce||Ce.setAttribute("content",be),h.cj&&!h.fl&&document.addEventListener("gesturestart",Ee),()=>{null==Ce||Ce.setAttribute("content","width=device-width, initial-scale=1, shrink-to-fit=no"),h.cj&&!h.fl&&document.removeEventListener("gesturestart",Ee)};null==Ce||Ce.setAttribute("content",Se)}}),[e])}(l),i.ZP.createElement("div",{id:"Main",className:K,onDrop:Ie.Z,onDragOver:Ie.Z},i.ZP.createElement(yt,null),i.ZP.createElement(Ei,null),i.ZP.createElement(io,null),i.ZP.createElement(oo,{isOpen:l}),i.ZP.createElement(Io,{isOpen:d}),i.ZP.createElement(po,{isOpen:u}),i.ZP.createElement(vo,{isOpen:m}),g&&i.ZP.createElement(an,{key:g.id,message:g,noUi:!0}),i.ZP.createElement(yo,{url:p}),i.ZP.createElement(wo,{isOpen:v}),i.ZP.createElement(Re.Z,{isOpen:Boolean(y),onClose:Y,stickerSetShortName:y}),f&&i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement(Zo,{groupCallId:f}),i.ZP.createElement(Po,{groupCallId:f})),i.ZP.createElement(bo,{isOpen:Boolean(M||R),userId:M,isByPhoneNumber:R}),i.ZP.createElement(fo,null),i.ZP.createElement(Co,{isOpen:b}),i.ZP.createElement(Ae,{isForAppBadge:!0}))})));s.eM&&console.log(">>> FINISH LOAD MAIN BUNDLE"),(0,a.Rd)().connectionState||(0,a.Sv)().initApi()},9618:(e,t,n)=>{var a=n(8764).Buffer;const s=n(4736),i=n(6842);function o(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=a.from(e);const o=i.length;t&&(i=i.reverse());let r=s(i.toString("hex"),16);return n&&Math.floor(r.toString("2").length/8)>=o&&(r=r.subtract(s(2).pow(s(8*o)))),r}function r(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;const n=s(e),i=[];for(let e=0;e<t;e++)i[e]=n.shiftRight(8*e).and(255);return a.from(i)}function c(e,t){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const o=(e=s(e)).bitLength(),r=Math.ceil(o/8);if(t<r)throw new Error("OverflowError: int too big to convert");if(!i&&e.lesser(s(0)))throw new Error("Cannot convert to unsigned");let c=!1;e.lesser(s(0))&&(c=!0,e=e.abs());const l=e.toString("16").padStart(2*t,"0");let d=a.from(l,"hex");if(n&&(d=d.reverse()),i&&c)if(n){let e=!1;0!==d[0]&&(d[0]-=1);for(let t=0;t<d.length;t++)0!==d[t]?(e&&(d[t]-=1,e=!1),d[t]=255-d[t]):e=!0}else{d[d.length-1]=256-d[d.length-1];for(let e=0;e<d.length-1;e++)d[e]=255-d[e]}return d}function l(e){return a.from(i.randomBytes(e))}function d(e){const t=i.createHash("sha1");return t.update(e),t.digest()}let u;e.exports={readBigIntFromBuffer:o,readBufferFromBigInt:c,generateRandomLong:function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return o(l(8),!0,e)},mod:function(e,t){return(e%t+t)%t},crc32:function(e){u||(u=function(){let e;const t=[];for(let n=0;n<256;n++){e=n;for(let t=0;t<8;t++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}()),a.isBuffer(e)||(e=a.from(e));let t=-1;for(let n=0;n<e.length;n++){const a=e[n];t=u[255&(t^a)]^t>>>8}return(-1^t)>>>0},generateRandomBytes:l,generateKeyDataFromNonce:async function(e,t){e=r(e,16),t=r(t,32);const[n,s,i]=await Promise.all([d(a.concat([t,e])),d(a.concat([e,t])),d(a.concat([t,t]))]);return{key:a.concat([n,s.slice(0,12)]),iv:a.concat([s.slice(12,20),i,t.slice(0,4)])}},sha1:d,sha256:function(e){const t=i.createHash("sha256");return t.update(e),t.digest()},bigIntMod:function(e,t){return e.remainder(t).add(t).remainder(t)},modExp:function(e,t,n){e=e.remainder(n);let a=s.one,i=e;for(;t.greater(s.zero);){const e=t.remainder(s(2));t=t.divide(s(2)),e.eq(s.one)&&(a=a.multiply(i),a=a.remainder(n)),i=i.multiply(i),i=i.remainder(n)}return a},getRandomInt:function(e,t){return e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e},sleep:e=>new Promise((t=>setTimeout(t,e))),getByteArray:function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=e.toString(2).length,a=Math.floor((n+8-1)/8);return c(s(e),a,!1,t)},toSignedLittleBuffer:r,convertToLittle:function(e){const t=a.alloc(4*e.length);for(let n=0;n<e.length;n++)t.writeUInt32BE(e[n],4*n);return t},bufferXor:function(e,t){const n=[];for(let a=0;a<e.length;a++)n.push(e[a]^t[a]);return a.from(n)},createDeferred:function(){let e;return{promise:new Promise((t=>{e=t})),resolve:e}}}},4121:(e,t,n)=>{"use strict";function a(e){const t=new Uint8Array(4*e.length);let n=0;for(let a=0;a<e.length;a++){const s=e[a];t[n++]=s>>>24,t[n++]=s>>16&255,t[n++]=s>>8&255,t[n++]=255&s}return t.buffer}function s(e){return e.buffer}function i(e){const t=new Uint8Array(e),n=new Uint32Array(t.length/4);for(let e=0;e<t.length;e+=4)n[e/4]=t[e]<<24^t[e+1]<<16^t[e+2]<<8^t[e+3];return n}function o(e){return new Uint32Array(e)}n.r(t),n.d(t,{ab2i:()=>l,ab2iBig:()=>o,ab2iLow:()=>i,i2ab:()=>c,i2abBig:()=>s,i2abLow:()=>a,isBigEndian:()=>r});const r=1===new Uint8Array(new Uint32Array([16909060]))[0],c=r?s:a,l=r?o:i},6842:(e,t,n)=>{var a=n(8764).Buffer;const s=n(8136).default,{i2ab:i,ab2i:o}=n(4121),{getWords:r}=n(7760);class c{constructor(e){this.setBytes(e)}setBytes(e){e=a.from(e),this._counter=e}increment(){for(let e=15;e>=0;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}}}class l{constructor(e,t){t instanceof c||(t=new c(t)),this._counter=t,this._remainingCounter=void 0,this._remainingCounterIndex=16,this._aes=new s(r(e))}update(e){return this.encrypt(e)}encrypt(e){const t=a.from(e);for(let e=0;e<t.length;e++)16===this._remainingCounterIndex&&(this._remainingCounter=a.from(i(this._aes.encrypt(o(this._counter._counter)))),this._remainingCounterIndex=0,this._counter.increment()),t[e]^=this._remainingCounter[this._remainingCounterIndex++];return t}}class d{constructor(e){this.algorithm=e}update(e){this.data=new Uint8Array(e)}async digest(){return"sha1"===this.algorithm?a.from(await self.crypto.subtle.digest("SHA-1",this.data)):"sha256"===this.algorithm?a.from(await self.crypto.subtle.digest("SHA-256",this.data)):void 0}}e.exports={createCipheriv:function(e,t,n){if(e.includes("ECB"))throw new Error("Not supported");return new l(t,n)},createDecipheriv:function(e,t,n){if(e.includes("ECB"))throw new Error("Not supported");return new l(t,n)},randomBytes:function(e){const t=new Uint8Array(e);return crypto.getRandomValues(t),t},createHash:function(e){return new d(e)},pbkdf2:async function(e,t,n){const s=await crypto.subtle.importKey("raw",e,{name:"PBKDF2"},!1,["deriveBits"]);return a.from(await crypto.subtle.deriveBits({name:"PBKDF2",hash:"SHA-512",salt:t,iterations:n},s,512))}}},7760:(e,t,n)=>{"use strict";function a(e,t){return e.charCodeAt(t)<<24^e.charCodeAt(t+1)<<16^e.charCodeAt(t+2)<<8^e.charCodeAt(t+3)}function s(e){if(e instanceof Uint32Array)return e;if("string"==typeof e){if(e.length%4!=0)for(let t=e.length%4;t<=4;t++)e+="\0x00";const t=new Uint32Array(e.length/4);for(let n=0;n<e.length;n+=4)t[n/4]=a(e,n);return t}if(e instanceof Uint8Array){const t=new Uint32Array(e.length/4);for(let n=0;n<e.length;n+=4)t[n/4]=e[n]<<24^e[n+1]<<16^e[n+2]<<8^e[n+3];return t}throw new Error("Unable to create 32-bit words")}function i(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e;for(let a=0;a<e.length;a++)n[a]=e[a]^t[a]}n.r(t),n.d(t,{getWords:()=>s,s2i:()=>a,xor:()=>i})},8226:(e,t,n)=>{"use strict";e.exports=n.p+"map-pin.7b3c3e60ee24795e4bd2..svg"},4524:(e,t,n)=>{"use strict";e.exports=n.p+"telegram-logo-filled.67469f6dc5e301e8e0bd..svg"},257:e=>{"use strict";e.exports="Telegram Web Z was updated to version 1.40\n\n🤡 **Happy April Fool's Day!** 🤡\n\n👏 **Harder**\n• Explore 37 new emoji.\n• Set Night Mode to follow your operating system in Settings > General.\n• Upload all types of audio files with cover images and meta tags.\n• Improved designs for Settings and Management pages.\n\n🤩 **Better**\n• Proper date formatting for all languages.\n• Changing volume in the media viewer automatically unmutes audio.\n• Groups you were restricted from now stay in your chat list.\n• Accessibility: Screen Reader support for emoji panel.\n• Removed reaction sounds.\n• Various layout improvements.\n\n🚀 **Faster**\n• Smoother transitions in Settings.\n\n💪 **Stronger**\n• Fixed error messages for You must be an admin and You can't write in this chat.\n• Fixed calendar months that start on a Sunday.\n• Fixed duplicated files when downloading.\n• Fixed pasting URLs with non-ASCII characters.\n• Fixed forwarding protected content.\n• Fixed saving Privacy Exceptions.\n• Fixed various issues when switching between message lists.\n"}}]);
//# sourceMappingURL=71.4998fc48600439daeb4d.js.map