2 lines
280 KiB
JavaScript
2 lines
280 KiB
JavaScript
"use strict";(self.webpackChunktelegram_t=self.webpackChunktelegram_t||[]).push([[568],{9568:(e,t,n)=>{n.r(t),n.d(t,{Main:()=>Do});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),p=n(2267),f=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:p}=n;let{messageId:f}=n;if(void 0!==u){const t=(0,c.y8)(e,h,u);null!=t&&t.length&&([f]=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,f,d,p),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(f))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=f>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,withMyScore:o}=n;let r;return i&&(r=(0,c.xH)(e,a,i)),{...e,forwardMessages:{fromChatId:a,messageIds:r||s,isModalShown:!0,withMyScore:o}}})),(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,t,n)=>{const{isQuiz:a}=n||{};return{...e,pollModal:{isOpen:!0,isQuiz:a}}})),(0,a.iw)("closePollModal",(e=>({...e,pollModal:{isOpen:!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,p.b)(e.serverTimeOffset),content:{text:(0,v.Z)(f)},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),S=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,S.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)("openGame",((e,t,n)=>{const{url:a,chatId:s,messageId:i}=n;return{...e,openedGame:{url:a,chatId:s,messageId:i}}})),(0,a.iw)("closeGame",(e=>({...e,openedGame: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}}}));var b=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 E=n(1226),M=n(9118);const R=new Map,k=(0,M.Ds)((e=>e()),500,!1);async function N(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,E.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:p,users:f,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(p,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)(f,"id")),y=(0,r.fZ)(y,(0,g.ee)(v,"id")),y=(0,r.j6)(y,d,I);let S=(0,c.gb)(y,d,t);const b=(0,c.qC)(y,d,t);if(o&&S&&b&&(b.length&&!(0,g.YE)(S,b)||(y=(0,r.xj)(y,d,t,b),S=(0,c.gb)(y,d,t),y=(0,r.pf)(y,d,t,"outlyingIds",void 0),o=!1)),!l){const e=o?b:S,{newViewportIds:a}=T(e,n,i);y=(0,r.y9)(y,d,t,a)}(0,a.R3)(y)}function T(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 A(e){let t;const n=e.attachment?(e,s)=>{R.has(s)||(t=s,R.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,M.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,E.t9)("sendMessage",e,n),n&&t&&R.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:p,areSomeLocal:f,areAllLocal:v}=T(c,n,a);if(f&&(e=(0,r.y9)(e,o,l,p)),(0,M.R3)((()=>{!async function(e,t,n,a,s,i,o,r){t||await N(s,i,r,o,n,a),a||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:p,areAllLocal:f}=T(a,t,m.Uq.Around);p&&u.length>=s.hT&&(e=(0,r.y9)(e,o,l,u)),f||(0,M.R3)((()=>{N(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,E.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;(0,a.R3)((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;A({...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}`;A({...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=>{A({...a,attachment:e,groupedId:r})}))}}else{const{text:e,entities:t,attachments:n,replyingTo:a,...s}=d;e&&A({...s,text:e,entities:t,replyingTo:a}),n.forEach((e=>{A({...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,E.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&&R.get(i.previousLocalId||i.id);o&&(0,E.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,E.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,E.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,E.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,E.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,E.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,E.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,E.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,E.t9)("reportMessages",{peer:l,messageIds:a,reason:s,description:i});t.showNotification({message:d?(0,I.i0)("ReportPeer.AlertSuccess"):"An error occurred while submitting your 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,E.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(k((()=>{(0,E.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 p=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 p?(0,r.a4)(e,l,{lastReadInboxMessageId:m,unreadCount:Math.max(0,u.unreadCount-p)}):e})),(0,a.iw)("markMessagesRead",((e,t,n)=>{const a=(0,c.jr)(e);if(!a)return;const{messageIds:s}=n;(0,E.t9)("markMessagesRead",{chat:a,messageIds:s})})),(0,a.iw)("loadWebPagePreview",((e,t,n)=>{const{text:s}=n;!async function(e){const t=await(0,E.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,E.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,E.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,withMyScore:r}=e.forwardMessages,l=s?(0,c.Z1)(e,s):void 0,u=o?(0,c.Z1)(e,o):void 0,m=s&&i?i.sort(((e,t)=>e-t)).map((t=>(0,c.hj)(e,s,t))).filter(Boolean):void 0;if(!l||!u||!m)return;const{isSilent:h,scheduledAt:g}=n,p=(0,c._5)(e,o),f=m.filter((e=>!(0,d.jM)(e)));f.length&&(0,E.t9)("forwardMessages",{fromChat:l,toChat:u,messages:f,serverTimeOffset:(0,a.Rd)().serverTimeOffset,isSilent:h,scheduledAt:g,sendAs:p,withMyScore:r}),m.filter((e=>(0,d.jM)(e))).forEach((e=>{const{text:t,entities:n}=e.content.text||{},{sticker:a,poll:s}=e.content;A({chat:u,text:t,entities:n,sticker:a,poll:s,isSilent:h,scheduledAt:g,sendAs:p})})),(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,E.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,E.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,E.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,E.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,E.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,E.t9)("fetchSeenBy",{chat:o,messageId:i});l&&(0,a.R3)((0,r.cY)((0,a.Rd)(),s,i,{seenByUserIds:l}))})),(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,E.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,E.t9)("fetchSendAs",{chat:i});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,a.R3)(e)):(0,a.R3)((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,E.t9)("fetchSponsoredMessages",{chat:i});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")),(0,a.R3)(e))})),(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,E.t9)("viewSponsoredMessage",{chat:s,random:i.randomId})}));var B=n(5765);const x=(0,M.P2)((e=>e()),500,!1);async function L(e,t){const n=await(0,E.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,E.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,M.wO)(200))}})),(0,a.iw)("loadRecentStickers",(e=>{const{hash:t}=e.stickers.recent||{};!async function(e){const t=await(0,E.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,E.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,E.t9)("fetchStickersForEmoji",{emoji:"👋⭐️",hash:t});n&&(e=(0,a.Rd)(),(0,a.R3)({...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,E.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,E.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,E.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,E.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,E.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,E.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];(0,a.R3)({...e,gifs:{...e.gifs,saved:{...e.gifs.saved,gifs:c}}})})),(0,a.iw)("faveSticker",((e,t,n)=>{const{sticker:a}=n;a&&(0,E.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,E.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,E.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,E.t9)("fetchEmojiKeywords",{language:o,fromVersion:r?r.version:0});r=(e=(0,a.Rd)()).emojiKeywords[o],c?(0,a.R3)({...e,emojiKeywords:{...e.emojiKeywords,[o]:{isLoading:!1,version:c.version,keywords:{...null===(i=r)||void 0===i?void 0:i.keywords,...c.keywords}}}}):(0,a.R3)({...e,emojiKeywords:{...e.emojiKeywords,[o]:{...r,isLoading:!1}}})})),(0,a.iw)("setStickerSearchQuery",((e,t,n)=>{const{query:s}=n;s&&x((()=>{!async function(e,t){const n=await(0,E.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,B.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&&x((()=>{L(a)}))})),(0,a.iw)("searchMoreGifs",(e=>{const{query:t,offset:n}=e.gifs.search;"string"==typeof t&&x((()=>{L(t,n)}))})),(0,a.iw)("loadStickersForEmoji",((e,t,n)=>{const{emoji:s}=n,{hash:i}=e.stickers.forEmoji;x((()=>{!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,E.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 O=n(790);const U=(0,M.P2)((e=>e()),500,!1);async function F(){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,E.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,E.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:p,chats:f,totalCount:v,nextRate:I}=e;f.length&&(u=(0,r.fZ)(u,(0,g.ee)(f,"id"))),p.length&&(u=(0,r.Sh)(u,(0,g.ee)(p,"id"))),h.length&&(u=(0,r.m6)(u,h)),u=(0,r.px)(u,h,v,n,I),(0,a.R3)(u)}async function $(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const o=await(0,E.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,p=(0,g.ee)(u,"id"),f=Object.keys(p).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,p),v=(0,r.c1)(v,e.id,t,f,m,h),(0,a.R3)(v),i||$(e,t,h,!0))}(0,a.iw)("setGlobalSearchQuery",((e,t,n)=>{const{chatId:s}=e.globalSearch,{query:i}=n;i&&!s&&U((()=>{!async function(e){const t=await(0,E.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,O.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;F("","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,O.IS)(r):r,{type:d}=n;F(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,E.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:p}=l,f=(0,g.ee)(m,"id"),v=Object.keys(f).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,f),I=(0,r.dx)(I,e.id,t,v,h,p),(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&&$(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,E.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,E.t9)("checkChatUsername",{username:i});e=(0,a.Rd)(),e=(0,r.H9)(e,o?m.wv.Complete:m.wv.Error),e=(0,r.fw)(e,s,{isUsernameAvailable:o}),(0,a.R3)(e)})),(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,E.t9)("migrateChat",i),!i)return;t.openChat({id:i.id})}const l=await(0,E.t9)("setChatUsername",{chat:i,username:o});e=(0,a.Rd)(),e=(0,r.H9)(e,l?m.wv.Complete:m.wv.Error),e=(0,r.fw)(e,s,{isUsernameAvailable:void 0}),(0,a.R3)(e)})),(0,a.iw)("updatePrivateLink",(e=>{const{chatId:t}=(0,c.Bt)(e)||{},n=t&&(0,c.Z1)(e,t);t&&n&&(0,E.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,E.t9)("fetchExportedChatInvites",{peer:d,admin:u,isRevoked:o,limit:l});if(!m)return;const h=o?{revokedInvites:m}:{invites:m};(0,a.R3)((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,E.t9)("editExportedChatInvite",{peer:h,link:i,isRevoked:o,expireDate:l,usageLimit:d,isRequestNeeded:u,title:m});if(!g)return;const{oldInvite:p,newInvite:f}=g,v=((e=(0,a.Rd)()).management.byChatId[s].invites||[]).filter((e=>e.link!==p.link)),I=[...e.management.byChatId[s].revokedInvites||[]];f.isRevoked?I.unshift(f):v.push(f),(0,a.R3)((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,E.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||[];(0,a.R3)((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,E.t9)("deleteExportedChatInvite",{peer:d,link:l}))return;const u=(e=(0,a.Rd)()).management.byChatId[o];(0,a.R3)((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);o&&l&&await(0,E.t9)("deleteRevokedExportedChatInvites",{peer:o,admin:l})&&(e=(0,a.Rd)(),(0,a.R3)((0,r.fw)(e,s,{revokedInvites:[]})))})),(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,E.t9)("fetchChatInviteImporters",{peer:m,link:o,offsetDate:l,offsetUser:h,limit:u});if(!g)return;const p=null===(s=(e=(0,a.Rd)()).management.byChatId[i])||void 0===s?void 0:s.inviteInfo;null!=p&&p.invite&&p.invite.link===o&&(0,a.R3)((0,r.fw)(e,i,{inviteInfo:{...p,importers:g}}))})),(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,E.t9)("fetchChatInviteImporters",{peer:m,link:o,offsetDate:l,offsetUser:h,limit:u,isRequested:!0});if(!g)return;const p=null===(s=(e=(0,a.Rd)()).management.byChatId[i])||void 0===s?void 0:s.inviteInfo;null!=p&&p.invite&&p.invite.link===o&&(0,a.R3)((0,r.fw)(e,i,{inviteInfo:{...p,requesters:g}}))})),(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,E.t9)("fetchChatInviteImporters",{peer:d,offsetDate:i,offsetUser:u,limit:l,isRequested:!0});m&&(e=(0,a.Rd)(),(0,a.R3)((0,r.a4)(e,s,{joinRequests:m})))})),(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,E.t9)("hideChatJoinRequest",{peer:d,user:u,isApproved:l}))return;e=(0,a.Rd)();const m=(0,c.Z1)(e,i);m&&(0,a.R3)((0,r.a4)(e,i,{joinRequests:null===(s=m.joinRequests)||void 0===s?void 0:s.filter((e=>e.userId!==o))}))})),(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,E.t9)("hideAllChatJoinRequests",{peer:l,isApproved:i,link:o}))return;e=(0,a.Rd)();const d=(0,c.Z1)(e,s);d&&(0,a.R3)((0,r.a4)(e,s,{joinRequests:[],fullInfo:{...d.fullInfo,recentRequesterIds:[],requestsPending:0}}))})),(0,a.iw)("hideChatReportPanel",(async(e,t,n)=>{const{chatId:s}=n,i=(0,c.Z1)(e,s);i&&await(0,E.t9)("hideChatReportPanel",i)&&(0,a.R3)((0,r.a4)((0,a.Rd)(),s,{settings:void 0}))}));var D=n(6974);let q;function j(e){return(0,E.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"),q&&clearTimeout(q),(0,a.R3)({...(0,a.Rd)(),isSyncing:!0}),q=window.setTimeout((()=>{(0,a.R3)({...(0,a.Rd)(),isSyncing:!1}),q=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 j(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 j(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,E.t9)("fetchCurrentUser"),t()}})})),(0,a.iw)("reportPeer",(async(e,t,n)=>{const{chatId:a,reason:s,description:i}=n;if(!a)return;const o=(0,c.Z1)(e,a);if(!o)return;const r=await(0,E.t9)("reportPeer",{peer:o,reason:s,description:i});t.showNotification({message:r?(0,I.i0)("ReportPeer.AlertSuccess"):"An error occurred while submitting your report. Please, try again later."})})),(0,a.iw)("reportProfilePhoto",(async(e,t,n)=>{const{chatId:a,reason:s,description:i,photo:o}=n;if(!a)return;const r=(0,c.Z1)(e,a);if(!r||!o)return;const l=await(0,E.t9)("reportProfilePhoto",{peer:r,photo:o,reason:s,description:i});t.showNotification({message:l?(0,I.i0)("ReportPeer.AlertSuccess"):"An error occurred while submitting your report. Please, try again later."})}));const G=(0,M.Ds)((e=>e()),500,!1,!0),_=(0,M.P2)((e=>e()),500,!1);function H(e,t,n){return{...e,inlineBots:{...e.inlineBots,byUsername:{...e.inlineBots.byUsername,[t]:n}}}}function z(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;G((()=>(0,E.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,E.t9)("fetchUsers",{users:[i]});if(!o)return;const{users:l,userStatusesById:d}=o;e=(0,a.Rd)(),e=(0,r.eD)(e,(0,g.ee)(l,"id")),e=(0,r.ps)(e,{...e.users.statusesById,...d}),(0,a.R3)(e)})),(0,a.iw)("loadTopUsers",(e=>{const{topPeers:{lastRequestedAt:t}}=e;(!t||(0,p.b)(e.serverTimeOffset)-t>60)&&async function(){const e=await(0,E.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,p.b)(s.serverTimeOffset)}},(0,a.R3)(s)}()})),(0,a.iw)("loadContactList",(()=>{!async function(){const e=await(0,E.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,E.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,E.t9)("fetchCommonChats",o.id,o.accessHash,l);if(!u)return;const{chats:m,chatIds:h,isFullyLoaded:p}=u;e=(0,a.Rd)(),m.length&&(e=(0,r.fZ)(e,(0,g.ee)(m,"id"))),e=(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:p}}),(0,a.R3)(e)})),(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,E.t9)("importContact",{phone:l.phoneNumber,firstName:n,lastName:s});else{const{id:e,accessHash:t}=l;d=await(0,E.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,E.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,E.t9)("fetchProfilePhotos",o,l);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})),(0,a.R3)(e))})),(0,a.iw)("setUserSearchQuery",((e,t,n)=>{const{query:s}=n;s&&_((()=>{!async function(e){const t=await(0,E.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,E.t9)("importContact",{phone:s,firstName:i,lastName:o});c?(t.openChat({id:c}),(0,a.R3)((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,E.t9)("reportSpam",s)}));const V=h.cj||h.wZ;class X{constructor(e,t){var n,a;this.features=e,this.onFail=t,a=void 0,(n="preOpened")in this?Object.defineProperty(this,n,{value:a,enumerable:!0,configurable:!0,writable:!0}):this[n]=a}preOpenIfNeeded(){var e;V&&(this.preOpened=window.open("about:blank",void 0,this.features),this.preOpened?this.preOpened.blur():null===(e=this.onFail)||void 0===e||e.call(this))}open(e){if(this.preOpened)return this.preOpened.location.href=e,this.preOpened.focus(),void(this.preOpened=void 0);if(!V){const n=window.open(e,void 0,this.features);var t;n?n.focus():null===(t=this.onFail)||void 0===t||t.call(this)}}cancelPreOpen(){var e;null===(e=this.preOpened)||void 0===e||e.close(),this.preOpened=void 0}}const K="https://prizes.gamee.com/",W=(0,M.Ds)((e=>e()),500,!1);async function Y(e,t,n,a,s){await(0,E.t9)("sendMessage",{chat:e,text:n,replyingTo:a,sendAs:s})}let J;async function Q(e,t,n){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{showDialog:i,showNotification:o,toggleSafeLinkModal:r,openGame:c}=(0,a.Sv)();s&&(J||(J=new X("popup,width=800,height=600",(()=>{o({message:"Allow browser to open popup window"})}))),J.preOpenIfNeeded());const l=await(0,E.t9)("answerCallbackButton",{chatId:e.id,accessHash:e.accessHash,messageId:t,data:n,isGame:s});if(!l)return;const{message:d,alert:u,url:m}=l;u?i({data:{message:d||"Error"}}):d?o({message:d}):m&&(s?m.includes(K)?J.open(m):(J.cancelPreOpen(),c({url:m,chatId:e.id,messageId:t})):r({url:m}))}(0,a.iw)("clickBotInlineButton",((e,t,n)=>{const{messageId:a,button:i}=n;switch(i.type){case"command":t.sendBotCommand({command:i.text});break;case"url":{const{url:e}=i;e.match(s.FS)||e.match(s.g$)?t.openTelegramLink({url:e}):t.toggleSafeLinkModal({url:e});break}case"callback":{const t=(0,c.jr)(e);if(!t)return;Q(t,a,i.data);break}case"requestPoll":t.openPollModal({isQuiz:i.isQuiz});break;case"requestPhone":{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"receipt":{const n=(0,c.jr)(e);if(!n)return;const{receiptMessageId:s}=i;t.getReceipt({receiptMessageId:s,chatId:n.id,messageId:a});break}case"buy":{const n=(0,c.jr)(e);if(!n)return;t.getPaymentForm({chat:n,messageId:a}),t.setInvoiceMessageInfo((0,c.hj)(e,n.id,a)),t.openPaymentModal({chatId:n.id,messageId:a});break}case"game":{const t=(0,c.jr)(e);if(!t)return;Q(t,a,void 0,!0);break}case"switchBotInline":{const{query:e,isSamePeer:n}=i;t.switchBotInline({query:e,isSamePeer:n,messageId:a});break}case"userProfile":{const{userId:e}=i;t.openChatWithInfo({id:e});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}),Y(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,E.t9)("unblockContact",l.id,l.accessHash)&&((0,a.R3)((0,r.rB)((0,a.Rd)(),l.id)),Y(o,0,"/start",void 0,(0,c._5)(e,s)))})),(0,a.iw)("loadTopInlineBots",(async e=>{const{lastRequestedAt:t}=e.topInlineBots;if(t&&(0,p.b)(e.serverTimeOffset)-t<60)return;const n=await(0,E.t9)("fetchTopInlineBots");if(!n)return;const{ids:s,users:i}=n;e=(0,a.Rd)(),e=(0,r.Sh)(e,(0,g.ee)(i,"id")),e={...e,topInlineBots:{...e.topInlineBots,userIds:s,lastRequestedAt:(0,p.b)(e.serverTimeOffset)}},(0,a.R3)(e)})),(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,E.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)&&W((()=>{!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=z(r,!0),r=H(r,t,{...n,query:i,...u&&{offset:void 0,results:[]}}),(0,a.R3)(r);const m=await(0,E.t9)("fetchInlineBotResults",{bot:l,chat:d,query:i,offset:u?void 0:o}),h=r.inlineBots.byUsername[t];if(r=z((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))),p=m.results.filter((e=>!g.has(e.id)));r=H(r,t,{...h,help:m.help,...p.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(p),offset:p.length?m.nextOffset:""}),(0,a.R3)(r)}({username:i,inlineBotData:d,chatId:s,query:o,offset:l})}))}})),(0,a.iw)("switchBotInline",((e,t,n)=>{const{query:a,isSamePeer:s,messageId:i}=n,o=(0,c.jr)(e);if(!o)return;const r=(0,c.hj)(e,o.id,i);if(!r)return;const l=(0,c.IK)(e,r.senderId);if(!l)return;const d=`@${l.username} ${a}`;if(!s)return{...e,switchBotInline:{query:a,botUsername:l.username}};t.openChatWithText({chatId:o.id,text:d})})),(0,a.iw)("resetSwitchBotInline",(e=>({...e,switchBotInline:void 0}))),(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,E.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,E.t9)("startBot",{bot:i,startParam:s})})),n(1371),(0,a.iw)("loadPasswordInfo",(async e=>{const t=await(0,E.t9)("getPasswordInfo");t&&(e=(0,a.Rd)(),e=(0,r.BI)(e,{hasPassword:t.hasPassword}),e=(0,r.IE)(e,{hint:t.hint}),(0,a.R3)(e))})),(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,E.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,E.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,E.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,E.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,E.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,E.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,E.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,E.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,E.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 ee=n(647),te=n(4907);const ne=728,ae=424,se=288;var ie=n(3858);function oe(e,t){return t-(e.isLeftColumnShown&&!h.wB?e.leftColumnWidth||((n=ie.Z.get().width)>s._m?Math.min(Math.max(.25*n,se),.33*n):n>s.ks?Math.min(Math.max(.33*n,se),.4*n):ae):0);var n}let re=0;(0,a.iw)("loadAvailableReactions",(async()=>{const e=await(0,E.t9)("getAvailableReactions");e&&(e.forEach((e=>{e.aroundAnimation&&ee.he(`sticker${e.aroundAnimation.id}`,o.IU.Lottie),e.centerIcon&&ee.he(`sticker${e.centerIcon.id}`,o.IU.Lottie)})),(0,a.R3)({...(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:re++,animatedEffect:a||o,x:oe(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,E.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,p=h?(0,c.xH)(e,r,m.groupedId)[0]:void 0;m=h&&(0,c.hj)(e,r,p)||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,E.t9)("sendReaction",{chat:u,messageId:l,reaction:d});const{animationLevel:f}=e.settings.byKey;return f===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,te.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;await(0,E.t9)("setDefaultReaction",{reaction:s})&&(0,a.R3)({...(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 p=null===(s=h.reactors)||void 0===s?void 0:s.nextOffset,f=await(0,E.t9)("fetchMessageReactionsList",{reaction:u,chat:m,messageId:d,offset:p});if(!f)return;e=(0,a.Rd)(),null!==(i=f.users)&&void 0!==i&&i.length&&(e=(0,r.Sh)(e,(0,g.ee)(f.users,"id")));const{nextOffset:v,count:I,reactions:y}=f;(0,a.R3)((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,E.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,E.t9)("sendWatchingEmojiInteraction",{chat:m,emoticon:i}),{...e,activeEmojiInteractions:e.activeEmojiInteractions.map((t=>t.id===u?{...t,x:oe(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,E.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]})))}(0,a.R3)((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,E.t9)("fetchStatisticsAsyncGraph",{token:i,dcId:u,isPercentage:l});m&&(0,a.R3)((0,r.yC)((0,a.Rd)(),s,o,m))})),n(8304);var ce=n(8406);function le(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)=>le(e,a[t])))}const s=e,i=t;return Object.keys(s).every((e=>le(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,ce.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,ce.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,ce.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 de=350;function ue(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 me(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):(0,M.R3)((()=>{t.loadMessage({chatId:s,messageId:n.replyToMessageId,threadUpdate:{isDeleting:a,lastMessageId:n.id}})}))}return e}function he(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=me(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 ge(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 pe(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 fe(e,t,n,s){if(e){t.forEach((t=>{const n=pe(s=(0,r.cY)(s,e,t,{isDeleting:!0}),e);n&&(s=ge(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=me(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})}))}),de)}const i=[];t.forEach((e=>{const t=(0,c.X5)(s,e);if(t){i.push(t);const n=pe(s=(0,r.cY)(s,t,e,{isDeleting:!0}),t);n&&(s=ge(s,t,n,!0)),setTimeout((()=>{(0,a.R3)((0,r.K4)((0,a.Rd)(),t,[e]))}),de)}})),(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=he(e=ue(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)(ge(e,i,h))}),de)}else(0,a.R3)(ge((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=ue(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=ue(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=ge(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=ue(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=he(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=ge(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;fe(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)}),de))}(s,t,0,e);break}case"deleteHistory":{const{chatId:a}=n,s=e.messages.byChatId[a];s?fe(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,p=m?[...m]:[];h.push(s),i.forEach((t=>{const n=p.find((e=>e.option===t)),a=p.findIndex((e=>e.option===t)),i=n?{...n}:{option:t,votersCount:0};i.votersCount+=1,s===e.currentUserId&&(i.isChosen=!0),a?p[a]=i:p.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:p}}}}));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&&le(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,M.R3)((()=>{(0,ce.rh)({chat:l,message:n,isReaction:!0})}))}(0,a.R3)(e);break}}}));const ve=(0,M.P2)((function(){const e=(0,a.Rd)();(0,a.R3)((0,r.ps)(e,{...e.users.statusesById,...Ie})),Ie={}}),3e3,!0);let Ie={};(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,Ie[a]=s,void ve();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 ye=n(8958),we=n(2431);(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,ye.dc)(e,n.call.id):(0,ye.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,ye.B6)(e,t,n.id,n,Boolean(i)||o===n.id))})),i&&(e=(0,ye.AH)(e,t,{nextOffset:i})),e}case"updatePhoneCall":{if(!h.Bi)return;const{phoneCall:t,currentUserId:a}=e;if(t)return;const{call:s}=n;if((null==s?void 0:s.adminId)!==a&&"requested"===s.state)return(0,ce.TO)({call:s,user:(0,we.fu)(e)}),(0,b.o5)(),{...e,phoneCall:s,isCallPanelVisible:!1}}}})),(0,a.iw)("apiUpdate",((e,t,n)=>{if("updatePaymentStateCompleted"===n["@type"])return(0,r.bp)(e)}));var Ze=n(8674),Pe=n(6752),Ce=n(1279),Se=n(3551),be=n(3227),Ee=n(1212),Me=n(5332);function Re(e){(0,i.d4)((()=>(0,M.Gq)(e)),[e])}var ke=n(9290);const Ne=document.querySelector('meta[name="viewport"]'),Te=(null==Ne?void 0:Ne.getAttribute("content"))||"",Ae="width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover";function Be(e){e.preventDefault()}var xe=n(6590),Le=n(4851),Oe=n(2155),Ue=n(5616),Fe=n(7358);const $e=(0,i.X$)((e=>{let{isForAppBadge:t}=e;(0,Ue.yi)();const n=(0,D.xW)();if((0,i.d4)((()=>{t&&(0,Fe.w)(n)}),[t,n]),!t&&n)return i.ZP.createElement("div",{className:"unread-count active"},(0,Oe.bi)(n))}));var De=n(3989),qe=n(7529),je=n(3455),Ge=n(706),_e=n(2255),He=n(9107),ze=n(7370),Ve=n(7926),Xe=n(1622);let Ke;function We(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?Ke.syncing:Ke.online:Ke.waitingForNetwork,c=r===Ke.online||o?"none":a?"middleHeader":s?"minimized":"overlay",r===Ke.waitingForNetwork?l=e("WaitingForNetwork"):r===Ke.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"}(Ke||(Ke={}));var Ye=n(3106),Je=n(8964),Qe=n(231),et=n(9589),tt=n(9187),nt=n(3321),at=n(126),st=n(9204);const it=(0,i.X$)((e=>{let{connectionStatus:t,connectionStatusText:n,onClick:a}=e;const s=(0,He.Z)();return i.ZP.createElement("div",{id:"ConnectionStatusOverlay",dir:s.isRtl?"rtl":void 0,onClick:a},i.ZP.createElement(st.Z,{color:"black"}),i.ZP.createElement("div",{className:"state-text"},i.ZP.createElement(_e.Z,{activeKey:t,name:"slide-fade"},n)),i.ZP.createElement(Qe.Z,{round:!0,size:"tiny",color:"translucent-black"},i.ZP.createElement("span",{className:"icon-close"})))})),ot=(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:p,shouldSkipTransition:f,currentUserId:v,globalSearchChatId:I,searchDate:y,theme:w,animationLevel:Z,chatsById:P,connectionState:C,isSyncing:S,isMessageListOpen:b,isConnectionStatusMinimized:E,areChatsLoaded:M}=e;const{openChat:R,openTipsChat:k,setGlobalSearchDate:N,setSettingOption:T,setGlobalSearchChatId:A}=(0,a.Sv)(),B=(0,He.Z)(),x=t===m.du.ChatList,L=(0,i.Ye)((()=>y?(0,O.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:$,connectionStatusPosition:D}=We(B,C,S,b,E,!M),q="web.telegram.org"===window.location.hostname,j=(0,i.Ye)((()=>e=>{let{onTrigger:t,isOpen:n}=e;return i.ZP.createElement(Qe.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,Pe.Z)("animated-menu-icon",!x&&"state-back",f&&"no-animation")}))}),[x,B,u,f]),G=(0,i.I4)((()=>{g||o("")}),[g,o]),_=(0,i.I4)((()=>{T({isConnectionStatusMinimized:!E})}),[E,T]),H=(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,ze.Z)(t,Z===s.zy)}),[Z,T,w]),V=(0,i.I4)((()=>{(0,Ve.L)("K"),(0,Xe.W8)(),(0,xe.Wv)()}),[]),X=(0,i.I4)((()=>{k({langCode:B.code})}),[B.code,k]),K=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(Ye.Z,{trigger:j,footer:`${s.iC} ${s.eM?"master":s.Ji}`},i.ZP.createElement(Je.Z,{icon:"saved-messages",onClick:H},B("SavedMessages")),i.ZP.createElement(Je.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(Je.Z,{icon:"user",onClick:c},B("Contacts")),i.ZP.createElement(Je.Z,{icon:"settings",onClick:r},B("Settings")),i.ZP.createElement(Je.Z,{icon:"darkmode",onClick:z},i.ZP.createElement("span",{className:"menu-item-name"},B("lng_menu_night_mode")),i.ZP.createElement(nt.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(Je.Z,{icon:"help",onClick:X},B("TelegramFeatures")),i.ZP.createElement(Je.Z,{icon:"bug",href:s.mU},"Report Bug"),q&&i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement(Je.Z,{icon:"char-K",href:"https://web.telegram.org/k/",onClick:V},"Switch to K Version"),i.ZP.createElement(Je.Z,{icon:"char-W",href:"https://web.telegram.org/?legacy=1",onClick:xe.Wv},"Switch to Old Version"))),i.ZP.createElement(et.Z,{inputId:"telegram-search-input",parentContainerClassName:"LeftSearch",className:I||y?"with-picker-item":"",value:n||g,focused:K,isLoading:p||"minimized"===D,spinnerColor:"minimized"===D?"yellow":void 0,spinnerBackgroundColor:"minimized"===D&&"light"===w?"light":void 0,placeholder:W,autoComplete:"off",canClose:Boolean(I||y),onChange:o,onReset:u,onFocus:G,onSpinnerClick:"minimized"===D?_:void 0},L&&i.ZP.createElement(tt.Z,{icon:"calendar",title:L,canClose:!0,isMinimized:Boolean(I),className:"search-date",onClick:N,clickArg:{date:void 0}}),I&&i.ZP.createElement(tt.Z,{chatOrUserId:I,onClick:A,canClose:!0,clickArg:{id:void 0}})),i.ZP.createElement(at.Z,{isOpen:"overlay"===D,isCustom:!0,className:"connection-state-wrapper"},i.ZP.createElement(it,{connectionStatus:F,connectionStatusText:$,onClick:_}))))})));var rt=n(1174),ct=n(3133),lt=n(1080);const dt=(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:p}=(0,a.Sv)(),f=(0,i.sO)(null),v=(0,He.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,Ue.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(f.current&&h.$b&&w&&w.length)return(0,rt.sf)(f.current,{selectorToPreventScroll:".chat-list",onSwipe:(e,t)=>t===rt.eM.Left?(g(Math.min(c+1,w.length-1),{forceOnHeavyAnimation:!0}),!0):t===rt.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,De.Z)((()=>{P.current&&g(0)})):void 0),[c,g]),(0,xe.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 p({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:S}=(0,Ee.Z)(!r,void 0,!0);function b(e){const a=Object.values(o).find((e=>{let{id:t}=e;return t===w[c].id}));return a&&0!==c?i.ZP.createElement(lt.Z,{folderType:"folder",folderId:a.id,isActive:e,lastSyncTime:d,onScreenSelect:n,foldersDispatch:t}):i.ZP.createElement(lt.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(ct.Z,{tabs:w,activeTab:c,onSwitchTab:Z}):C?i.ZP.createElement("div",{className:(0,Pe.Z)("tabs-placeholder",S)}):void 0,i.ZP.createElement(_e.Z,{ref:f,name:u?"none":v.isRtl?"slide-optimized-rtl":"slide-optimized",activeKey:c,renderCount:w?w.length:void 0},b))})));var ut=n(9203),mt=n(8778),ht=n(4288);const gt=(0,i.X$)((e=>{const t=(0,mt.Z)(ut.gl.Extra,"LeftSearch");return t?i.ZP.createElement(t,e):i.ZP.createElement(ht.Z,null)})),pt=(0,i.X$)((e=>{const t=(0,mt.Z)(ut.gl.Extra,"ContactList");return t?i.ZP.createElement(t,e):i.ZP.createElement(ht.Z,null)}));var ft=n(2328);const vt=(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,He.Z)(),l=(0,Pe.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(Qe.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(ft.Z,{isOpen:o,positionX:"right",positionY:"bottom",autoClose:!0,onClose:u},i.ZP.createElement(Je.Z,{icon:"channel",onClick:a},c("NewChannel")),i.ZP.createElement(Je.Z,{icon:"group",onClick:s},c("NewGroup")),i.ZP.createElement(Je.Z,{icon:"user",onClick:n},c("NewMessageTitle"))))})),It=Object.keys(m.du).length/2;let yt;const wt=(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,p]=(0,i.eJ)(h.$b),f=(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&&(f.current=!0,p(!0))}),[t]),C=(0,i.I4)((()=>{f.current=!1,yt&&(clearTimeout(yt),yt=void 0),yt=window.setTimeout((()=>{f.current||p(!1)}),250)}),[]);(0,i.d4)((()=>{let e;return t!==m.du.ChatList?e=window.setTimeout((()=>{p(!1)}),250):(f.current||h.$b)&&p(!0),()=>{e&&(clearTimeout(e),e=void 0)}}),[t]);const[S,b,E]=function(){const[e,t]=(0,Ge.Z)(!1);(0,i.d4)((()=>{const e=window.setTimeout(t,2592e5);return()=>{clearTimeout(e)}}),[t]);const{shouldRender:n,transitionClassNames:a}=(0,Ee.Z)(e);return[n,a,()=>{window.location.reload()}]}(),M=(0,He.Z)();return i.ZP.createElement("div",{id:"LeftColumn-main",onMouseEnter:h.$b?void 0:P,onMouseLeave:h.$b?void 0:C},i.ZP.createElement(ot,{content:t,contactsFilter:s,onSearchQuery:c,onSelectSettings:v,onSelectContacts:I,onSelectArchived:Z,onReset:u,shouldSkipTransition:o}),i.ZP.createElement(_e.Z,{name:o?"none":"zoom-fade",renderCount:It,activeKey:t,shouldCleanup:!0,cleanupExceptionKey:m.du.ChatList},(e=>{switch(t){case m.du.ChatList:return i.ZP.createElement(dt,{onScreenSelect:d,foldersDispatch:r});case m.du.GlobalSearch:return i.ZP.createElement(gt,{searchQuery:n,searchDate:a,isActive:e,onReset:u});case m.du.Contacts:return i.ZP.createElement(pt,{filter:s,isActive:e,onReset:u});default:return}})),S&&i.ZP.createElement(Qe.Z,{fluid:!0,pill:!0,className:(0,Pe.Z)("btn-update",b),onClick:E},M("lng_update_telegram")),i.ZP.createElement(vt,{isShown:g,onNewPrivateChat:I,onNewChannel:y,onNewGroup:w}))})),Zt=(0,i.X$)((e=>{const t=(0,mt.Z)(ut.gl.Extra,"Settings");return t?i.ZP.createElement(t,e):i.ZP.createElement(ht.Z,null)})),Pt=(0,i.X$)((e=>{const t=(0,mt.Z)(ut.gl.Extra,"NewChat");return t?i.ZP.createElement(t,e):i.ZP.createElement(ht.Z,null)})),Ct=(0,i.X$)((e=>{const t=(0,mt.Z)(ut.gl.Extra,"ArchivedChats");return t?i.ZP.createElement(t,e):i.ZP.createElement(ht.Z,null)}));var St;!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"}(St||(St={}));const bt=Object.keys(St).length/2,Et=(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:p,setLeftColumnWidth:f,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,S]=(0,i.eJ)(""),[b,E]=(0,je.ZP)(),[M,R]=(0,i.eJ)(0);let k=St.Main;switch(y){case m.du.Archived:k=St.Archived;break;case m.du.Settings:k=St.Settings;break;case m.du.NewChannelStep1:case m.du.NewChannelStep2:k=St.NewChannel;break;case m.du.NewGroupStep1:case m.du.NewGroupStep2:k=St.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),S(""),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})):S(e)}),[y,t,c]);(0,i.d4)((()=>y!==m.du.ChatList||0===s?(0,De.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,qe.Z)(e)&&(e.preventDefault(),w(m.du.GlobalSearch))}}),[y]),(0,i.d4)((()=>{p(),Z===m.MT.Privacy&&g()}),[p,g,Z]);const{initResize:A,resetResize:B,handleMouseUp:x}=function(e,t,n,a){const[s,o,r]=(0,Ge.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,f,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(_e.Z,{name:o?"none":h.s0,renderCount:bt,activeKey:k,shouldCleanup:!0,cleanupExceptionKey:St.Main},(e=>{switch(k){case St.Archived:return i.ZP.createElement(Ct,{isActive:e,onReset:N,onContentChange:w});case St.Settings:return i.ZP.createElement(Zt,{isActive:e,currentScreen:Z,foldersState:b,foldersDispatch:E,onScreenSelect:L,onReset:N,shouldSkipTransition:o});case St.NewChannel:return i.ZP.createElement(Pt,{key:M,isActive:e,isChannel:!0,content:y,onContentChange:w,onReset:N});case St.NewGroup:return i.ZP.createElement(Pt,{key:M,isActive:e,content:y,onContentChange:w,onReset:N});default:return i.ZP.createElement(wt,{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 Mt=n(2420),Rt=n(5780),kt=n(9524),Nt=n(1394);const Tt=()=>{const[e,t]=(0,i.eJ)(ie.Z.get());return(0,i.d4)((()=>{const e=(0,M.P2)((()=>{t(ie.Z.get())}),250,!1);return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]),e};var At=n(2678),Bt=n(7204),xt=n(5326),Lt=n(3570),Ot=n(5790),Ut=n(8360),Ft=n(6058),$t=n(8799);const Dt=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,mt.Z)(ut.gl.Extra,"HeaderMenuContainer",!t);return n?i.ZP.createElement(n,e):void 0})),qt=(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),p=(0,c.FM)(e,i),f="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(f&&(m||(0,d.ZV)(u))&&u.isNotJoined),P=f||v,C=h.Bi&&(0,d.YC)(u.id)&&!p&&!g,S=f&&!p&&!Z,b=f&&!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:S,canViewStatistics:null===(a=u.fullInfo)||void 0===a?void 0:a.canViewStatistics,canLeave:b,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:p,canLeave:f,canEnterVoiceChat:v,canCreateVoiceChat:I,pendingJoinRequests:y,isRightColumnShown:w,canExpandActions:Z}=e;const{joinChannel:P,sendBotCommand:C,openLocalTextSearch:S,restartBot:b,requestCall: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)((()=>{b({chatId:t})}),[t,b]),$=(0,i.I4)((()=>{M({screen:m.u1.JoinRequests})}),[M]),D=(0,i.I4)((()=>{S(),h.wB?document.querySelector("#MobileSearch input").focus():setTimeout((()=>{const e=document.querySelector(".RightHeader .SearchInput input");e&&e.focus()}),400)}),[S]);(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,qe.Z)(e)&&(e.preventDefault(),D())}}),[d,D]);const q=(0,He.Z)();return i.ZP.createElement("div",{className:"HeaderActions"},!h.wB&&i.ZP.createElement(i.ZP.Fragment,null,Z&&l&&i.ZP.createElement(Qe.Z,{size:"tiny",ripple:!0,fluid:!0,onClick:O},q(o?"ProfileJoinChannel":"ProfileJoinGroup")),Z&&r&&i.ZP.createElement(Qe.Z,{size:"tiny",ripple:!0,fluid:!0,onClick:U},q("BotStart")),Z&&c&&i.ZP.createElement(Qe.Z,{size:"tiny",ripple:!0,fluid:!0,onClick:F},q("BotRestart")),d&&i.ZP.createElement(Qe.Z,{round:!0,ripple:w,color:"translucent",size:"smaller",onClick:D,ariaLabel:"Search in this chat"},i.ZP.createElement("i",{className:"icon-search"})),u&&i.ZP.createElement(Qe.Z,{round:!0,color:"translucent",size:"smaller",onClick:function(){E({userId:t})},ariaLabel:"Call"},i.ZP.createElement("i",{className:"icon-phone"}))),Boolean(y)&&i.ZP.createElement(Qe.Z,{round:!0,className:"badge-button",ripple:w,color:"translucent",size:"smaller",onClick:$,ariaLabel:q(o?"SubscribeRequests":"MemberRequests")},i.ZP.createElement("i",{className:"icon-user"}),i.ZP.createElement("div",{className:"badge"},y)),i.ZP.createElement(Qe.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(Dt,{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:p,canLeave:f,canEnterVoiceChat:v,canCreateVoiceChat:I,onSubscribeChannel:O,onSearchClick:D,onClose:x,onCloseAnimationEnd:L}))})));var jt=n(4399),Gt=n(6202),_t=n(862);function Ht(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)(_t.Hu),l=null==e?void 0:e.id;return(0,i.bt)((()=>{o&&(0,_t.p6)(`b64-${l}`,n).then(c).catch((e=>{s.eM&&console.error(e)}))}),[l,o,n]),o?r:n}var zt=n(7551),Vt=n(8512),Xt=n(996);function Kt(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 Wt=(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=Kt(0,0,2,t,1)+Kt(0,12,2,t+1,1)+Kt(0,25,2,t,1);else for(let e=0;e<n;e++)a+=Kt(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,Pe.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);`})))})),Yt=(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,He.Z)(),m=Ht(t),h=(0,Gt.Z)((0,d.Ti)(t,"pictogram")),g=(0,Xt.e)(u,t,Boolean(m)),[p,f,v]=(0,Ge.Z)(),I=(0,i.I4)((()=>{v(),r&&r(t.id)}),[v,r,t.id]);return i.ZP.createElement("div",{className:(0,Pe.Z)("HeaderPinnedMessage-wrapper",o)},n>1&&i.ZP.createElement(Qe.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(Qe.Z,{round:!0,size:"smaller",color:"translucent",ariaLabel:u("UnpinMessageAlertTitle"),className:"unpin-button",onClick:f},i.ZP.createElement("i",{className:"icon-close"})),i.ZP.createElement(zt.Z,{isOpen:p,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(Wt,{count:n,index:a}),m&&function(e,t){const{width:n,height:a}=(0,jt.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(Vt.Z,null)))}));var Jt=n(396),Qt=n(4532),en=n(3186);function tn(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=()=>{nn(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 nn(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"image/png";if(!("createImageBitmap"in window))return an(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 an(e,t,n,void 0,a)}}function an(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 sn=n(4524);const on={width:200,height:200},rn=115,cn=(e,t,n)=>{const a=(0,He.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,Gt.Z)(h),p=(0,i.Ye)((()=>function(e,t,n){if(!n)return on;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?jt.vY:void 0}(s,o,g)),[s,g,o]),{result:f}=((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(sn);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=()=>{nn(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,rn,rn);const n=Math.min(t.width,t.height);return n<rn?tn(e,rn/n):Promise.resolve(e)}(g,p)),[g,p],sn);return(0,i.Ye)((()=>(0,Qt.Of)({title:r,artist:c,album:l,artwork:[{src:f}]})),[l,c,r,f])};var ln=n(2340),dn=n(8051);const un=(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:p,focusMessage:f,closeAudioPlayer:v}=(0,a.Sv)(),I=(0,He.Z)(),{audio:y,voice:w,video:Z}=(0,d.qp)(t),P=Boolean(w||Z),C=o?(0,d.OU)(I,o):void 0,S=ee.UV((0,d.Ti)(t,"inline")),b=cn(t,o,r),{playPause:E,stop:M,isPlaying:R,requestNextTrack:k,requestPreviousTrack:N,isFirst:T,isLast:A,setVolume:B,toggleMuted:x,setPlaybackRate:L}=(0,en.Z)((0,Jt.An)(t),(0,d.XV)(t),P?"voice":"audio",S,void 0,b,void 0,!0,void 0,void 0,(0,d.CI)(t),!0),O=P&&R;(0,i.d4)((()=>{if(O)return ie.Z.disableRefresh(),()=>{ie.Z.enableRefresh()}}),[O]);const U=(0,i.I4)((()=>{f({chatId:t.chatId,messageId:t.id})}),[f,t.chatId,t.id]),F=(0,i.I4)((()=>{R&&E(),v(),(0,Qt.Ay)(),M()}),[v,R,E,M]),$=(0,i.I4)((e=>{m({volume:e/100}),B(e/100)}),[m,B]),D=(0,i.I4)((()=>{h.$b&&!h.cj||(x(),p({isMuted:!u}))}),[u,p,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,Pe.Z)("AudioPlayer",n),dir:I.isRtl?"rtl":void 0},i.ZP.createElement(Qe.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(Qe.Z,{round:!0,ripple:!h.wB,color:"translucent",size:"smaller",className:(0,Pe.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(Qe.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,ln.Z)(t||a)),n&&i.ZP.createElement("div",{className:"subtitle",dir:"auto"},(0,ln.Z)(n)))}(y):function(e,t){return i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement("div",{className:"title",dir:"auto"},t&&(0,ln.Z)(t)),i.ZP.createElement("div",{className:"subtitle",dir:"auto"},e))}(I("AttachAudio"),C),i.ZP.createElement(Vt.Z,null)),i.ZP.createElement(Qe.Z,{round:!0,className:"player-button volume-button",color:"translucent",size:"smaller",ariaLabel:"Volume",withClickPropagation:!0},i.ZP.createElement("i",{className:j,onClick:D}),!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(dn.Z,{bold:!0,value:u?0:100*c,onChange:$})))),P&&i.ZP.createElement(Qe.Z,{round:!0,className:(0,Pe.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(Qe.Z,{round:!0,className:"player-close",color:"translucent",size:"smaller",onClick:F,ariaLabel:"Close player"},i.ZP.createElement("i",{className:"icon-close"})))}));var mn=n(172);const hn=(0,i.X$)((0,a.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,c.Z1)(e,n),s=(0,we.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,He.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,Pe.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(mn.Z,{key:e.user.id,user:e.user}):i.ZP.createElement(mn.Z,{key:e.chat.id,chat:e.chat})}))),i.ZP.createElement(Qe.Z,{round:!0,className:"join"},u("VoipChatJoin")))})));var gn=n(4605);const pn=(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:p,deleteHistory:f,toggleChatArchived:v,hideChatReportPanel:I}=(0,a.Sv)(),y=(0,He.Z)(),[w,Z,P]=(0,Ge.Z)(),[C,S]=(0,i.eJ)(!0),[b,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}),b&&h({chatId:t})}),[M,u,P,h,m,k,b,C,t]),L=(0,i.I4)((()=>{I({chatId:t})}),[t,I]),O=(0,i.I4)((()=>{P(),m({chatId:t}),A?(p({chatId:t,userId:c}),f({chatId:t,shouldDeleteForAll:!1})):g({chatId:t})}),[t,P,c,p,f,A,g,m]);if(r)return i.ZP.createElement("div",{className:(0,Pe.Z)("ChatReportPanel",n),dir:y.isRtl?"rtl":void 0},N&&i.ZP.createElement(Qe.Z,{isText:!0,fluid:!0,size:"tiny",className:"UserReportPanel--Button",onClick:B},y("lng_new_contact_add")),T&&i.ZP.createElement(Qe.Z,{color:"danger",isText:!0,fluid:!0,size:"tiny",className:"UserReportPanel--Button",onClick:Z},y("lng_new_contact_block")),k&&!T&&i.ZP.createElement(Qe.Z,{color:"danger",isText:!0,fluid:!0,size:"tiny",className:"UserReportPanel--Button",onClick:Z},y("lng_report_spam_and_leave")),i.ZP.createElement(Qe.Z,{round:!0,ripple:!0,size:"tiny",color:"translucent",onClick:L,ariaLabel:y("Close")},i.ZP.createElement("i",{className:"icon-close"})),i.ZP.createElement(zt.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(gn.Z,{label:y("DeleteThisChat"),checked:b,onCheck:E}),o&&k&&i.ZP.createElement(gn.Z,{label:y("ReportChat"),checked:C,onCheck:S})))}))),fn=(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 p;if("pinned"===s){const t=(0,c.KB)(e,n);p=null==t?void 0:t.length}else if("scheduled"===s){const t=(0,c.qy)(e,n);p=null==t?void 0:t.length}else if("thread"===s&&a!==o._f){const t=(0,c.tZ)(e,n,a);p=(null==t?void 0:t.messagesCount)||0}const f={typingStatus:u,isLeftColumnShown:i,isRightColumnShown:(0,c.Jf)(e),isSelectModeActive:(0,c.CA)(e),audioMessage:g,chat:d,messagesCount:p,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 f;if(Object.assign(f,{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{...f,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{...f,pinnedMessageIds:I,canUnpin:n}}return f}))((e=>{let{chatId:t,threadId:n,messageListType:r,isReady:c,pinnedMessageIds:l,messagesById:u,canUnpin:m,topMessageSender:g,typingStatus:p,isSelectModeActive:f,isLeftColumnShown:v,isRightColumnShown:I,audioMessage:y,chat:w,messagesCount:Z,isChatWithSelf:P,isChatWithBot:C,lastSyncTime:S,shouldSkipHistoryAnimations:b,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,He.Z)(),F=(0,i.sO)(!0),[$,D]=(0,i.eJ)(0),q=Array.isArray(l)?l[$]:l,j=u&&q?u[q]:void 0,G=Array.isArray(l)?l.length:l?1:void 0,_=w&&(0,d.U)(U,w).length,H=g?(0,d.OU)(U,g):void 0,{settings:z}=w||{};(0,i.d4)((()=>{n===o._f&&S&&c&&x({chatId:t})}),[t,x,S,n,c]),(0,i.d4)((()=>{D(0)}),[l]),(0,Ot.Z)(t,q,j);const{width:V}=Tt(),X=V<=s.ks,K=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,Lt.Z)(G||1,$+1);D(e)}}),[j,T,n,G,$]),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(f)return O(),void ne();if(n===o._f&&"thread"===r&&0===E)return h.wB||K?(e.stopPropagation(),A({id:void 0})):L(),void ne();B(),ne()}}),[n,r,E,f,B,K,A,L,O,ne]),se=V>=s.ks&&V<s.jT||V>s.l3&&V<s.ks&&(!_||_>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,Ee.Z)(oe),le=(0,Ut.Z)(oe?z:void 0,!0),{shouldRender:de,transitionClassNames:ue}=(0,Ee.Z)(Boolean(y)),me=(0,Ut.Z)(y,!0),{shouldRender:he,transitionClassNames:ge}=(0,Ee.Z)(Boolean(j)),pe=(0,Ut.Z)(j,!0),fe=(0,Ut.Z)(G,!0),ve=(0,Ut.Z)(m,!0),Ie=(0,Ut.Z)(H),ye=he&&pe||de&&me;(0,i.d4)((()=>{const e=W.current;if(e)return ie&&ye?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,ye,se,I]);const{connectionStatusText:we}=We(U,M,R,!0);function Ze(){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(Qe.Z,{round:!0,size:"smaller",color:"translucent",onClick:ae,ariaLabel:U(e?"Close":"Back")},i.ZP.createElement("div",{className:(0,Pe.Z)("animated-close-icon",!e&&"state-back")})),t&&i.ZP.createElement($e,null))}const Ce=Boolean(de&&me);return i.ZP.createElement("div",{className:"MiddleHeader",ref:W},i.ZP.createElement(_e.Z,{name:b?"none":"slide-fade",activeKey:E},"thread"===r&&n===o._f?i.ZP.createElement(i.ZP.Fragment,null,(X||E>0)&&Ze(K,!0),i.ZP.createElement("div",{className:"chat-info-wrapper",onClick:J},(0,d.YC)(t)?i.ZP.createElement(Ft.Z,{userId:t,typingStatus:p,status:we,withDots:Boolean(we),withFullInfo:C,withMediaViewer:!0,withUpdatingStatus:!0,noRtl:!0}):i.ZP.createElement($t.Z,{chatId:t,typingStatus:p,status:we,withDots:Boolean(we),withMediaViewer:!0,withFullInfo:!0,withUpdatingStatus:!0,noRtl:!0}))):"thread"===r?i.ZP.createElement(i.ZP.Fragment,null,Ze(),i.ZP.createElement("h3",null,U("CommentsCount",Z,"i"))):"pinned"===r?i.ZP.createElement(i.ZP.Fragment,null,Ze(),i.ZP.createElement("h3",null,U("PinnedMessagesCount",Z,"i"))):"scheduled"===r?i.ZP.createElement(i.ZP.Fragment,null,Ze(),i.ZP.createElement("h3",null,P?U("Reminders"):U("messages",Z,"i"))):void 0),i.ZP.createElement(hn,{hasPinnedOffset:he&&Boolean(pe)||de&&Boolean(me),chatId:t}),he&&pe&&i.ZP.createElement(Yt,{key:t,message:pe,count:fe||0,index:$,customTitle:Ie,className:(0,Pe.Z)(ge,Ce&&"full-width"),onUnpinMessage:ve?Q:void 0,onClick:ee,onAllPinnedClick:te}),re&&i.ZP.createElement(pn,{key:t,chatId:t,settings:le,className:ce}),i.ZP.createElement("div",{className:"header-tools"},Ce&&i.ZP.createElement(un,{key:(0,d.Tp)(me),message:me,className:ue}),i.ZP.createElement(qt,{chatId:t,threadId:n,messageListType:r,canExpandActions:!Ce})))})));var vn=n(2645),In=n(274);function yn(e){return"albumId"in e}function wn(e,t){let n,a=[],s={originalDate:e[0].date,datetime:(0,O._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,O._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 Zn=n(386),Pn=n(2202);var Cn=n(7675),Sn=n(539),bn=n(2357),En=n(998);var Mn=n(3657);const Rn=h.wZ?1e3:350,kn=h.wB?300:500;var Nn=n(7240);function Tn(e){return"number"==typeof e}function An(e,t){return e?t?238:175:t?238:100}function Bn(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,jt.Eh)(s,n,a,o,t):(0,jt.GC)(i,n,a,t),l=An(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 xn(e,t){return e.reduce(((e,t)=>e+t),t)}function Ln(e,t,n){return e<t?t:e>n?n:e}function On(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 Un(e,t,n,a){const s=function(e){return e.map((e=>{const t=Bn(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,jt.kc)(e,t,!1,n)-(t?2.5:0)*jt.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?Ln(e,1,2.75):Ln(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=xn(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=xn(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,p=m.heights,f=g.length;let v=0,I=0;for(let e=0;e!==f;++e){const t=g[e],n=p[e],s=Math.round(n);let o=0;for(let c=0;c!==t;++c){const d=0|(0===e?1:0)|(e===f-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:On(d)}}let Fn;function $n(e){return Fn||(Fn=document.createElement("span"),Fn.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',Fn.style.whiteSpace="nowrap",Fn.style.position="absolute",Fn.style.left="-999px",Fn.style.opacity=".01",document.body.appendChild(Fn)),Fn.innerHTML=e,Fn.offsetWidth}function Dn(e,t,n,a,s,o){(0,i.bt)((()=>{if(n&&e.current){const t=e.current.closest(".MessageList");(0,Sn.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 qn=3*jt.Gw,jn=Number(jt.Gw),Gn="data-is-document-group-hover";function _n(e,t,n,s,o,r,c,l,d,u,m,g,p,f){const{setReplyingToId:v,sendDefaultReaction:I}=(0,a.Sv)(),[y,w,Z]=(0,Ge.Z)(),[P,C,S]=(0,Ge.Z)(),b=(0,i.sO)();return(0,i.d4)((()=>{if(!h.$b||o||!r||m)return;let e;return(0,rt.sf)(t.current,{selectorToPreventScroll:".MessageList",onSwipe:(t,n)=>n===rt.eM.Left&&(e||(e=Date.now()),C(),!0),onRelease:()=>{e&&(v({messageId:n}),setTimeout(S,Math.max(0,150-(Date.now()-e))),e=void 0)}})}),[t,o,n,v,C,S,r,m]),{handleMouseDown:o?void 0:function(e){(0,Zn.q)(e),d(e)},handleClick:function(t){if(o)e(t);else if(h.$b)return b.current?(clearInterval(b.current),b.current=void 0,void function(e){const{pageX:t,pageY:a}=e;I({chatId:u,messageId:n,x:t,y:a})}(t)):void(b.current=setTimeout((()=>{b.current=void 0,function(e){if(h.wZ){const t=e.target;if(!t.classList.contains("text-content")&&!t.classList.contains("Message"))return;ie.Z.getIsKeyboardVisible()?setTimeout((()=>{l(e)}),350):l(e)}}(t)}),200))},handleContextMenu:o?c?be.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(p?n-s:s+i-n)<qn,l=Math.abs(o+r-a)<jn;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(),f&&function(e){const t=zn(e.currentTarget);t&&t.removeAttribute(Gn)}(e)},isSwiped:P,isQuickReactionVisible:y,handleDocumentGroupMouseEnter:Hn}}function Hn(e){const t=zn(e.currentTarget);t&&t.setAttribute(Gn,"")}function zn(e){let t=e;do{t=t.nextElementSibling}while(t&&!t.classList.contains("last-in-document-group"));return t}var Vn=n(8005);const Xn=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,mt.Z)(ut.gl.Extra,"ContextMenuContainer",!t);return n?i.ZP.createElement(n,e):void 0})),Kn=(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),p=g&&((0,d.eA)(g)||s===n.chatId);return{usersById:a,senderUser:!p&&s?(0,c.dy)(e,s):void 0,senderChat:p?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:p,noFocusHighlight:f}=e;const v=(0,i.sO)(null);(0,Mn._N)(v,n),(0,Ot.Z)(t.chatId,t.replyToMessageId,m),Dn(v,t.chatId,g,p,f);const I=(0,He.Z)(),y=s<=0,[w,Z]=(0,Ge.Z)(y);(0,i.d4)((()=>{y||setTimeout(Z,10*s)}),[s,Z,y]);const{transitionClassNames:P}=(0,Ee.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]),S=(0,Vn.D)(I,t,c,l,C,m,h,{asTextWithSpoilers:a}),{isContextMenuOpen:b,contextMenuPosition:E,handleBeforeContextMenu:M,handleContextMenu:R,handleContextMenuClose:k,handleContextMenuHide:N}=(0,Nn.Z)(v),T=void 0!==E;if(a)return i.ZP.createElement("span",{className:"embedded-action-message"},S);const A=(0,Pe.Z)("ActionMessage message-list-item",g&&!f&&"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,Zn.q)(e),M(e)},onContextMenu:R},i.ZP.createElement("span",null,S),E&&i.ZP.createElement(Xn,{isOpen:b,anchor:E,message:t,messageListType:"thread",onClose:k,onCloseAnimationEnd:N}))}))),Wn=e=>{let{className:t,message:n,sender:a,title:s,customText:o,isProtected:r,observeIntersection:c,onClick:l}=e;const u=(0,i.sO)(null),m=(0,Mn.Op)(u,c),h=(0,Gt.Z)(n&&(0,d.Ti)(n,"pictogram"),!m),g=Ht(n),p=Boolean(n&&(0,d.Y5)(n)),f=(0,He.Z)(),v=a&&(0,d.OU)(f,a);return i.ZP.createElement("div",{ref:u,className:(0,Pe.Z)("EmbeddedMessage",t),onClick:n?l:void 0},g&&function(e,t,n,a){const{width:s,height:o}=(0,jt.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"}))}(g,h,p,r),i.ZP.createElement("div",{className:"message-text"},i.ZP.createElement("p",{dir:"auto"},n?(0,d.Lo)(n)?i.ZP.createElement(Kn,{message:n,isEmbedded:!0}):(0,Xt.e)(f,n,Boolean(g)):o||" "),i.ZP.createElement("div",{className:"message-title",dir:"auto"},(0,ln.Z)(v||s||" "))))};var Yn=n(2535),Jn=n(4752),Qn=n(8018),ea=n(8198),ta=n(7799);const na=(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,Gt.Z)(`sticker${m}`,!m,o.IU.Lottie),p=(0,Gt.Z)(`sticker${h}`,!h,o.IU.Lottie),f=Boolean((null==r?void 0:r.reaction)===s&&g&&p),{shouldRender:v,transitionClassNames:I}=(0,Ee.Z)(f,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,Ge.Z)(),C=!f||!w,S=(0,Pe.Z)("ReactionAnimatedEmoji",c&&"in-meta",v&&"is-animating");return i.ZP.createElement("div",{className:S},C&&i.ZP.createElement(ea.Z,{reaction:s}),v&&i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement(ta.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(ta.Z,{key:h,id:`reaction_effect_${h}`,className:(0,Pe.Z)("effect",I),size:100,animationData:p,play:!0,noLoop:!0,forceOnHeavyAnimation:!0,onEnded:y})))})),aa=(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,He.Z)(),[h,g]=(0,Ge.Z)(),p=r&&(null==u||null===(t=u.reactions)||void 0===t?void 0:t.results.filter((e=>e.count>0))),f=(0,i.Ye)((()=>{if(!h)return;const e=(0,O.SA)(1e3*n.date,m.code),t=n.isEdited&&(0,O.SA)(1e3*n.editDate,m.code),a=n.forwardInfo&&(0,O.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,Pe.Z)("MessageMeta",l&&"reactions-offset"),dir:m.isRtl?"rtl":"ltr",onClick:o},p&&p.map((e=>i.ZP.createElement(na,{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,Oe.bi)(n.views)),i.ZP.createElement("i",{className:"icon-channelviews"})),s&&i.ZP.createElement("span",{className:"message-signature"},(0,ln.Z)(s)),i.ZP.createElement("span",{className:"message-time",title:f,onMouseEnter:g},n.isEdited&&`${m("EditedMessage")} `,(0,O.mr)(m,1e3*n.date)),a&&i.ZP.createElement(Qn.Z,{status:a}))}));var sa=n(692),ia=n(4753);const oa=e=>{let{message:t,observeIntersection:n,observeIntersectionForPlaying:a,shouldLoop:o,lastSyncTime:r}=e;const c=(0,i.sO)(null),[l,u,m]=(0,Ge.Z)(),g=t.content.sticker,{isLottie:p,stickerSetId:f,isVideo:v}=g,I=h.Hh,y=f===s.$E,w=(0,Mn.Op)(c,n),Z=(0,Mn.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")),S=(0,Gt.Z)(C),b=Ht(t),E=S||b,M=(0,Gt.Z)(P,!w,(0,d.kG)(t,"inline"),r),R=Boolean(M),[k,N]=(0,Ge.Z)(R),T=p?k:R,A=(0,sa.Z)(T),{width:B,height:x}=(0,jt.Wr)(g),L=(0,Pe.Z)("thumbnail",!b&&"empty"),O=(0,Pe.Z)("Sticker media-inner",y&&"inactive");return(0,i.d4)((()=>{if(!v||!c.current)return;const e=c.current.querySelector("video");e&&(Z?(0,ia.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}),!p&&!v&&i.ZP.createElement("img",{src:M,width:B,height:x,alt:"",className:(0,Pe.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}),p&&R&&i.ZP.createElement(ta.Z,{key:P,className:(0,Pe.Z)("full-media",A),id:P,animationData:M,size:B,play:Z,noLoop:!o,onLoad:N}),i.ZP.createElement(Le.Z,{isOpen:l,fromSticker:g,onClose:m}))};var ra=n(7854),ca=n(2566),la=n(5866);function da(e,t){return(0,la.Z)((0,d.DH)(e),Boolean(t),h.wB&&!h.vX)}const ua={dark:{outgoing:"rgb(135,116,225)",incoming:"rgb(33,33,33)"},light:{outgoing:"rgb(238,255,222)",incoming:"rgb(255,255,255)"}};function ma(e,t,n,a,s){return a?Promise.resolve(ua[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 ha=n(9196);const ga=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:p,isDownloading:f,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,Mn.Op)(Z,a),[S,b]=(0,i.eJ)(r),E=S&&C,{mediaData:M,loadProgress:R}=(0,ca.Z)((0,d.Ti)(n,m),!E),k=P||M,N=da(n,k),{loadProgress:T}=(0,ca.Z)((0,d.Ti)(n,"download"),!f),{isUploading:A,isTransferring:B,transferProgress:x}=(0,d.Sc)(n,u||(f?T:R),E&&!k),L=!1===(0,Bt.Z)(S),O=(0,sa.Z)(k),{shouldRender:U,transitionClassNames:F}=(0,Ee.Z)(B,void 0,L,"slow"),{shouldRender:$,transitionClassNames:D}=(0,Ee.Z)(!k&&!S),q=(0,i.I4)((()=>{A?w&&w(n):k?y&&y(n.id):b((e=>!e))}),[k,A,n,w,y]),j=(0,d.B4)(n);(0,i.bt)((()=>{if(!p)return;const e=Z.current.closest(".message-content");k?ma(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,p,c,l,I]);const{width:G,height:_,isSmall:H}=h||Bn(n,o),z=(0,Pe.Z)("media-inner",!A&&!g&&"interactive",H&&"small-image",G===_&&"square-image"),V=h?`width: ${G}px; height: ${_}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: ${_}px`}),i.ZP.createElement("img",{src:k,className:`full-media ${O}`,width:G,height:_,alt:"",draggable:!v}),v&&i.ZP.createElement("span",{className:"protector"}),U&&!$&&i.ZP.createElement("div",{className:`media-loading ${F}`},i.ZP.createElement(ha.Z,{progress:x,onClick:A?q:void 0})),$&&i.ZP.createElement("i",{className:(0,Pe.Z)("icon-download",D)}),B&&i.ZP.createElement("span",{className:"message-transfer-progress"},Math.round(100*x),"%"))};var pa=n(2019),fa=n(6898);function va(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,ia.Z)(e.current)}),[e]),c=(0,i.I4)((()=>{(0,M.T2)(r)}),[r]);(0,Me.Z)(o,c),(0,Ze.ZP)(o,r)}function Ia(){return Ia=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},Ia.apply(this,arguments)}const ya=e=>{var t;let{id:n,message:s,observeIntersection:r,noAvatars:c,canAutoLoad:l,canAutoPlay:u,uploadProgress:m,lastSyncTime:h,dimensions:g,onClick:p,onCancelUpload:f,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,Mn.Op)(y,r),[S,b]=(0,i.eJ)(l),E=Boolean(S&&C&&h),[M,R]=(0,i.eJ)(u),k=(0,Gt.Z)((0,d.Ti)(s,"pictogram"),!(C&&h),(0,d.kG)(s,"pictogram"),h),N=(0,sa.Z)(k),{mediaData:T,loadProgress:A}=(0,ca.Z)((0,d.Ti)(s,"inline"),!E,(0,d.kG)(s,"inline"),h),B=P||T,x=Boolean(C&&B),L=da(s,k),{loadProgress:U}=(0,ca.Z)((0,d.Ti)(s,"download"),!v,o.IU.BlobUrl,h),{isBuffered:F,bufferingHandlers:$}=(0,pa.Z)(!l),{isUploading:D,isTransferring:q,transferProgress:j}=(0,d.Sc)(s,m||(v?U:A),E&&!F||v),G=!1===(0,Bt.Z)(S),{shouldRender:_,transitionClassNames:H}=(0,Ee.Z)(q,void 0,G),{shouldRender:z,transitionClassNames:V}=(0,Ee.Z)(S&&!M&&!_),[X,K]=(0,i.eJ)(0),W=(0,i.I4)((e=>{K(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,jt.GC)(Z,J,Q,c);va(w,x),(0,fa.Z)(w,[x]);const ne=(0,i.I4)((()=>{D?f&&f(s):v?(0,a.Sv)().cancelMessageMediaDownload({message:s}):B?B&&!M?(R(!0),w.current.play()):p&&p(s.id):b((e=>!e))}),[D,v,B,M,p,f,s]),ae=(0,Pe.Z)("media-inner dark",!D&&"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:D?void 0:ne},i.ZP.createElement("canvas",{ref:L,className:"thumbnail",style:`width: ${ee}px; height: ${te}px;`}),i.ZP.createElement("img",{src:k,className:(0,Pe.Z)("thumbnail",N),style:`width: ${ee}px; height: ${te}px;`,alt:"",draggable:!I}),x&&i.ZP.createElement("video",Ia({ref:w,className:"full-media",width:ee,height:te,autoPlay:M,muted:!0,loop:!0,playsInline:!0},$,{draggable:!I,onTimeUpdate:W}),i.ZP.createElement("source",{src:B})),I&&i.ZP.createElement("span",{className:"protector"}),z&&i.ZP.createElement("i",{className:(0,Pe.Z)("icon-large-play",V)}),_&&i.ZP.createElement("div",{className:(0,Pe.Z)("media-loading",H)},i.ZP.createElement(ha.Z,{progress:j,onClick:ne})),!S&&i.ZP.createElement("i",{className:"icon-download"}),q?i.ZP.createElement("span",{className:"message-transfer-progress"},D||v?`${Math.round(100*j)}%`:"..."):i.ZP.createElement("div",{className:"message-media-duration"},Z.isGif?"GIF":(0,O.k9)(Math.max(Y-X,0))))};var wa=n(6272);const Za=(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,Pe.Z)("Contact",Boolean(d)&&"interactive"),onClick:d?u:void 0},i.ZP.createElement(mn.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,wa.WZ)(s,l))))}));var Pa=n(8974),Ca=n(1218),Sa=n(4434),ba=n(6937);function Ea(e,t){return t>0?(e/t*100).toFixed():0}const Ma=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?Ea(c.votersCount,a||0):0,[m,h]=(0,i.eJ)(r?0:u),g=(0,i.sO)(null),p=c?Ea(c.votersCount,s||0):0,f=m<u;if((0,i.d4)((()=>{r&&h(u)}),[r,u]),(0,i.d4)((()=>{const e=g.current;if(e&&r){const t=e.firstElementChild,n=f?"":"stroke-dasharray: 100% 200%; stroke-dashoffset: -44";t?t.setAttribute("style",n):e.innerHTML=`\n <svg class="poll-line" xmlns="http://www.w3.org/2000/svg" style="${n}">\n <path d="M4.47 5.33v13.6a9 9 0 009 9h13"/>\n </svg>`}}),[f,r]),!n||!c)return;const v=`width: ${p}%; transform:scaleX(${f?0:1})`;return i.ZP.createElement("div",{className:"PollOption",dir:"ltr"},i.ZP.createElement("div",{className:"poll-option-share "+("100"===u?"limit-width":"")},u,"%",d&&i.ZP.createElement("span",{className:(0,Pe.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,ln.Z)(t.text)),i.ZP.createElement("div",{className:(0,Pe.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}))))},Ra=(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,[p,f]=(0,i.eJ)(!1),[v,I]=(0,i.eJ)([]),[y,w]=(0,i.eJ)(!1),[Z,P]=(0,i.eJ)(!1),[C,S]=(0,i.eJ)(!h.closed&&h.closeDate&&h.closeDate>0?Math.min(h.closeDate-Math.floor(Date.now()/1e3)+c,h.closePeriod):0),b=(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)((()=>{p&&n.results.results&&n.results.results.some((e=>e.isChosen))&&f(!1)}),[p,n.results.results]),(0,i.d4)((()=>{C>0&&setTimeout((()=>S(C-1)),1e3);const e=b.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,O.k9)(C),n.firstElementChild.setAttribute("stroke-dashoffset",`-${e}`)}else e.innerHTML=`\n <span>${(0,O.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 L=(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]),f(!0),P(!0),r([e])}),[r]),F=(0,i.I4)((e=>{I(e)}),[]),$=(0,i.I4)((()=>{f(!0),P(!0),r(v)}),[r,v]),D=(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,He.Z)();return i.ZP.createElement("div",{className:"Poll",dir:G.isRtl?"auto":"ltr"},y&&n.results.solution&&i.ZP.createElement(ba.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,ln.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)),L.length>0&&i.ZP.createElement("div",{className:"poll-recent-voters"},L.map((e=>i.ZP.createElement(mn.Z,{size:"micro",user:e})))),C>0&&k&&i.ZP.createElement("div",{ref:b,className:"poll-countdown"}),h.quiz&&n.results.solution&&!k&&i.ZP.createElement(Qe.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(Ca.Z,{options:x,onChange:F,disabled:t.isScheduled||p,loadingOptions:p?v:void 0,round:!0}):i.ZP.createElement(Sa.Z,{name:`poll-${u}`,options:x,onChange:U,disabled:t.isScheduled||p,loadingOption:p?v[0]:void 0})),!k&&i.ZP.createElement("div",{className:"poll-results"},h.answers.map((function(e){return i.ZP.createElement(Ma,{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(Qe.Z,{isText:!0,disabled:0===v.length,size:"tiny",onClick:$},G("PollSubmitVotes")),N&&i.ZP.createElement(Qe.Z,{isText:!0,size:"tiny",onClick:D},G("PollViewResults")))})));var ka=n(8035),Na=n(88);const Ta=(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 p=(0,d.s1)(t);let f=!1;if(null!=p&&p.photo&&!p.video){const{width:e,height:n}=Bn(t);f=e===n}const v=(0,i.I4)((()=>{h()}),[h]);if(!p)return;const{siteName:I,url:y,displayUrl:w,title:Z,description:P,photo:C,video:S}=p,b=(C||S)&&h&&!f,E=(0,ka.Z)(P,170),M=(0,Pe.Z)("WebPage",f&&"with-square-photo",!C&&!S&&!r&&"without-media",S&&"with-video");return i.ZP.createElement("div",{className:M,"data-initial":(I||w)[0],dir:"auto"},C&&!S&&i.ZP.createElement(ga,{message:t,observeIntersection:n,noAvatars:a,canAutoLoad:s,size:f?"pictogram":"inline",nonInteractive:!b,onClick:b?v:void 0,onCancelUpload:g,isDownloading:l,isProtected:u,theme:m}),i.ZP.createElement("div",{className:"WebPage-text"},i.ZP.createElement(Na.Z,{className:"site-name",url:y,text:I||w}),!r&&Z&&i.ZP.createElement("p",{className:"site-title"},(0,ln.Z)(Z)),E&&i.ZP.createElement("p",{className:"site-description"},(0,ln.Z)(E,["emoji","br"]))),!r&&S&&i.ZP.createElement(ya,{message:t,observeIntersection:n,noAvatars:a,canAutoLoad:s,canAutoPlay:o,lastSyncTime:c,onClick:b?v:void 0,onCancelUpload:g,isDownloading:l,isProtected:u}))}));var Aa=n(9937);const Ba=(0,i.X$)((e=>{let{message:t}=e;const n=(0,He.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,ln.Z)(s)),o&&i.ZP.createElement("p",null,(0,ln.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,Aa.x)(r,c,n.code),l&&i.ZP.createElement("span",null,n("PaymentTestInvoice")))))}));var xa=n(8183);const La=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"})),Oa=["#e56cd5","#f89440","#9986ff","#44b3f5","#6dc139","#ff5d5a","#f87aad","#6e82b3","#f5ba21"],Ua=e=>{let{variant:t="rectangular",animation:n="wave",width:a,height:s,className:o}=e;const r=(0,Pe.Z)("Skeleton",t,n,o),c=(a?`width: ${a}px;`:"")+(s?`height: ${s}px;`:"");return i.ZP.createElement("div",{className:r,style:c})};var Fa=n(8226);const $a=1e-4,Da={width:400,height:300,zoom:16,scale:2},qa={__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>'},ja=(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,He.Z)(),g=(0,xt.Z)(),f=(0,d.nf)(t),{type:v,geo:I}=f,y=(0,p.b)(l),w=(0,d.$R)(t,y),Z="geoLive"!==v||w?void 0:t.date+f.period-y,[P,C]=(0,i.eJ)(I),S="venue"===v||"geoLive"===v&&!w,{width:b,height:E,zoom:M,scale:R}=Da,k=Boolean(a)&&(0,d.k6)(P,b,E,M,R),N=(0,Gt.Z)(k),T=(0,Bt.Z)(N),A=N||T,B=n&&(0,d.YC)(n.id),x=n&&B?n:void 0,L=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]),$=(0,i.I4)((e=>{if("geoLive"!==v)return;const n=24*Math.PI,a=e.lastElementChild,s=e.firstElementChild,i=t.date+f.period-(0,p.b)(l),o=(1-i/f.period)*n,r=(0,O.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,f,l,h]);return(0,i.bt)((()=>{m.current&&$(m.current)}),[$]),(0,i.bt)((()=>{if(S)return;const e=u.current.closest(".message-content");A&&ma(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,S]),(0,i.d4)((()=>{Math.abs(I.lat-P.lat)<$a&&Math.abs(I.long-P.long)<$a?P.accuracyRadius!==I.accuracyRadius&&C({...P,accuracyRadius:I.accuracyRadius}):C(I)}),[I,P]),(0,xa.Z)((()=>{g()}),w?void 0:1e3*(Z||0)),(0,bn.Z)((()=>{const e=m.current;e&&$(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:Da.width,height:Da.height}):i.ZP.createElement(Ua,{width:b,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,Pe.Z)("pin",v,w&&"expired");if("geoLive"===v)return i.ZP.createElement("div",{className:e,dangerouslySetInnerHTML:qa},i.ZP.createElement(mn.Z,{chat:L,user:x,className:"location-avatar"}),void 0!==f.heading&&i.ZP.createElement("div",{className:"direction",style:`--direction: ${f.heading}deg`}));if("venue"===v){const t=function(e){return e?La.get(e)||La.get(e.split("/")[0])||Oa[(t=e,t.split("").reduce(((e,t)=>(e<<5)-e+t.charCodeAt(0)|0),0)%Oa.length)]:"#008df2";var t}(f.venueType),n=function(e){return e?`https://ss3.4sqi.net/img/categories_v2/${e}_88.png`:""}(f.venueType);return i.ZP.createElement("div",{className:e,dangerouslySetInnerHTML:qa,style:`--pin-color: ${t}`},i.ZP.createElement("img",{src:n,className:"venue-icon",alt:""}))}return i.ZP.createElement("img",{className:e,src:Fa,alt:""})}())}()),function(){if(S)return"venue"===v?i.ZP.createElement("div",{className:"location-info"},i.ZP.createElement("div",{className:"location-info-title"},f.title),i.ZP.createElement("div",{className:"location-info-subtitle"},f.address)):"geoLive"===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,O.dJ)(h,y,t.editDate)),!w&&i.ZP.createElement("div",{className:"geo-countdown",ref:m})):void 0}())})),Ga=(0,i.X$)((e=>{let{message:t,canAutoLoadMedia:n,lastSyncTime:s}=e;const{clickBotInlineButton:o}=(0,a.Sv)(),r=t.content.game,{title:c,description:l}=r,u=Boolean(s)&&(0,d.N)(r),m=Boolean(s)&&(0,d.Wc)(r),h=(0,Gt.Z)(u,!n),g=(0,Gt.Z)(m,!n);return i.ZP.createElement("div",{className:"Game"},i.ZP.createElement("div",{className:"preview",style:"width: 480px; height: 270px",onClick:()=>{o({messageId:t.id,button:t.inlineButtons[0][0]})}},!h&&!g&&i.ZP.createElement(Ua,{className:"skeleton preview-content"}),h&&i.ZP.createElement("img",{className:"preview-content",src:h,alt:c}),g&&i.ZP.createElement("video",{className:"preview-content",playsInline:!0,muted:!0,autoPlay:!0,loop:!0,src:g})),i.ZP.createElement("div",{className:"title"},c),!(0,d.UD)(t)&&i.ZP.createElement("div",{className:"description"},l))}));function _a(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,Pe.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 Ha=_a(ga),za=_a(ya),Va=(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:p}=e;const{cancelSendingMessage:f}=(0,a.Sv)(),v=t.messages.length,I=(0,i.I4)((e=>{f({chatId:e.chatId,messageId:e.id})}),[f]),{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:f,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],S=(0,c.bH)((0,a.Rd)(),e),b=(0,c.__)((0,a.Rd)(),e);if(f){const a=s&&(r?t===v-1:Boolean(8&C&&4&C));return i.ZP.createElement(Ha,{id:`album-media-${(0,d.d0)(e.id)}`,message:e,observeIntersection:n,canAutoLoad:S,shouldAffectAppendix:a,uploadProgress:Z,dimensions:P,isProtected:l,onClick:m,onCancelUpload:I,isDownloading:g.includes(e.id),theme:p})}if(y)return i.ZP.createElement(za,{id:`album-media-${(0,d.d0)(e.id)}`,message:e,observeIntersection:n,canAutoLoad:S,canAutoPlay:b,uploadProgress:Z,lastSyncTime:o,dimensions:P,isProtected:l,onClick:m,onCancelUpload:I,isDownloading:g.includes(e.id),theme:p})})))}));function Xa(){return Xa=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},Xa.apply(this,arguments)}let Ka;const Wa=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,Mn.Op)(l,n),[p,f]=(0,i.eJ)(s),v=Boolean(p&&g&&r),{mediaData:I,loadProgress:y}=(0,ca.Z)((0,d.Ti)(t,"inline"),!v,(0,d.kG)(t,"inline"),r),{loadProgress:w}=(0,ca.Z)((0,d.Ti)(t,"download"),!c,o.IU.BlobUrl,r),Z=da(t,I),{isBuffered:P,bufferingHandlers:C}=(0,pa.Z)(),S=p&&!P||c,b=!1===(0,Bt.Z)(p),E=(0,sa.Z)(I),{shouldRender:R,transitionClassNames:k}=(0,Ee.Z)(S||!P,void 0,b),[N,T]=(0,i.eJ)(!1),[A,B]=(0,i.eJ)(0);(0,i.d4)((()=>{if(!N)return;const e=jt.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="${jt.Rj}px" height="${jt.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),L=(0,i.I4)((()=>{m.current&&(T(!1),B(0),(0,ia.Z)(m.current),(0,M.T2)((()=>{u.current.innerHTML=""})))}),[]),U=(0,i.I4)((()=>{var e;null===(e=Ka)||void 0===e||e(),Ka=L}),[L]);(0,i.d4)((()=>{m.current&&(x?(0,ia.Z)(m.current):m.current.pause())}),[x]),va(m,x),(0,fa.Z)(m,[I]);const F=(0,i.I4)((()=>{if(!I)return void f((e=>!e));if(c)return void(0,a.Sv)().cancelMessageMediaDownload({message:t});const e=m.current;N?e.paused?((0,ia.Z)(e),(0,Jt.Es)()):e.pause():(U(),e.pause(),e.currentTime=0,(0,ia.Z)(e),(0,Jt.Es)(),T(!0))}),[U,N,c,I,t]),$=(0,i.I4)((e=>{const t=e.currentTarget;B(t.currentTime/t.duration)}),[]),D=(0,Pe.Z)("full-media",E);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: ${jt.Rj}px; height: ${jt.Rj}px`})),I&&i.ZP.createElement("div",{className:"video-wrapper"},i.ZP.createElement("video",Xa({ref:m,className:D,width:jt.Rj,height:jt.Rj,autoPlay:!0,muted:!N,loop:!N,playsInline:!0,onEnded:N?L:void 0},C,{onTimeUpdate:N?$: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(ha.Z,{progress:c?w:y})),!I&&!p&&i.ZP.createElement("i",{className:"icon-download"}),i.ZP.createElement("div",{className:"message-media-duration"},N?(0,O.k9)(m.current.currentTime):(0,O.k9)(h.duration),(!N||m.current.paused)&&i.ZP.createElement("i",{className:"icon-muted"})))},Ya=e=>{let{message:t,onClick:n}=e;const a=(0,He.Z)();return i.ZP.createElement("div",{className:"InlineButtons"},t.inlineButtons.map((e=>i.ZP.createElement("div",{className:"row"},e.map((e=>i.ZP.createElement(Qe.Z,{size:"tiny",ripple:!0,disabled:"unsupported"===e.type,onClick:()=>n({messageId:t.id,button:e})},(0,ln.Z)(a(e.text)),["buy","receipt"].includes(e.type)&&i.ZP.createElement("i",{className:"icon-card"}),"url"===e.type&&!s.FS.test(e.url)&&i.ZP.createElement("i",{className:"icon-arrow-right"}),"switchBotInline"===e.type&&i.ZP.createElement("i",{className:"icon-share-filled"}))))))))},Ja=(0,i.X$)((e=>{let{threadInfo:t,disabled:n}=e;const{openChat:s}=(0,a.Sv)(),o=(0,He.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]),p=(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 f=Boolean(m&&u&&m<u);return i.ZP.createElement("div",{"data-cnt":(0,Oe.bi)(l),className:(0,Pe.Z)("CommentButton",f&&"has-unread",n&&"disabled"),dir:o.isRtl?"rtl":"ltr",onClick:g},i.ZP.createElement("i",{className:"icon-comments-sticker"}),(!p||0===p.length)&&i.ZP.createElement("i",{className:"icon-comments"}),p&&p.length>0&&i.ZP.createElement("div",{className:"recent-repliers",dir:o.isRtl?"rtl":"ltr"},p.map((e=>i.ZP.createElement(mn.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"}))})),Qa=(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(Qe.Z,{className:(0,Pe.Z)(t.isChosen&&"chosen"),size:"tiny",onClick:d},i.ZP.createElement(na,{activeReaction:s,reaction:t.reaction,availableReactions:o}),null!=l&&l.length?i.ZP.createElement("div",{className:"avatars"},l.map((e=>i.ZP.createElement(mn.Z,{user:e,size:"micro"})))):(0,Oe.bi)(t.count))})),es=(0,i.X$)((e=>{let{message:t,isOutside:n,activeReaction:a,availableReactions:s,metaChildren:o}=e;return i.ZP.createElement("div",{className:(0,Pe.Z)("Reactions",n&&"is-outside")},t.reactions.results.map((e=>i.ZP.createElement(Qa,{key:e.reaction,reaction:e,message:t,activeReaction:a,availableReactions:s}))),o)}));var ts=n(7324),ns=n(5296);const as=(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:p,markAnimationLoaded:f}=(0,ns.Z)(o,l,c,s,d,a,n),v=`local_emoji_${t}`,I=(0,Mn.Op)(m,r),[y,w]=(0,i.eJ)();return(0,i.d4)((()=>{t&&(0,ts.Z)(t).then((e=>{w(e)}))}),[t]),i.ZP.createElement("div",{ref:m,className:"AnimatedEmoji media-inner",style:h,onClick:p},y&&i.ZP.createElement(ta.Z,{key:v,id:v,animationData:y,size:g,quality:1,play:I&&u,forceOnHeavyAnimation:!0,noLoop:!0,onLoad:f}))})),ss=(0,i.X$)((e=>{let{phoneCall:t,message:n,chatId:s}=e;const{requestCall:o}=(0,a.Sv)(),r=(0,He.Z)(),{isOutgoing:c,isVideo:l,reason:d}=t,u="missed"===d,m="busy"===d&&!c,g=(0,i.I4)((()=>{o({isVideo:l,userId:s})}),[s,l,o]),p=(0,i.Ye)((()=>l?m?"CallMessageVideoIncomingDeclined":u?c?"CallMessageVideoOutgoingMissed":"CallMessageVideoIncomingMissed":c?"CallMessageVideoOutgoing":"CallMessageVideoIncoming":m?"CallMessageIncomingDeclined":u?c?"CallMessageOutgoingMissed":"CallMessageIncomingMissed":c?"CallMessageOutgoing":"CallMessageIncoming"),[m,u,c,l]),f=(0,i.Ye)((()=>t.duration?(0,O.J_)(r,t.duration):void 0),[r,t.duration]),v=(0,O.mr)(r,1e3*n.date);return i.ZP.createElement("div",{className:"src-components-middle-message-MessagePhoneCall-module__root"},i.ZP.createElement(Qe.Z,{size:"smaller",color:"translucent",round:!0,ripple:!0,onClick:g,className:"src-components-middle-message-MessagePhoneCall-module__button",disabled:!h.Bi,ariaLabel:r(c?"CallAgain":"CallBack")},i.ZP.createElement("i",{className:l?"icon-video-outlined":"icon-phone"})),i.ZP.createElement("div",{className:"src-components-middle-message-MessagePhoneCall-module__info"},i.ZP.createElement("div",{className:"src-components-middle-message-MessagePhoneCall-module__reason"},r(p)),i.ZP.createElement("div",{className:"src-components-middle-message-MessagePhoneCall-module__meta"},i.ZP.createElement("i",{className:(0,Pe.Z)("icon-arrow-right","src-components-middle-message-MessagePhoneCall-module__arrow",u&&"src-components-middle-message-MessagePhoneCall-module__missed",!c&&"src-components-middle-message-MessagePhoneCall-module__incoming")}),i.ZP.createElement("span",{className:"src-components-middle-message-MessagePhoneCall-module__duration"},f?r("CallMessageWithDuration",[v,f]):v))))})),is={__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>'},os={__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>'},rs=(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:p,chatId:f,viaBotId:v,replyToChatId:I,replyToMessageId:y,isOutgoing:w,threadInfo:Z}=o,P=(0,c.Z1)(e,f),C=(0,c.FM)(e,f),S=(0,d.pK)(f),b=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,f,m):void 0,B=o.id===A,x=y===A,L=y&&!x?(0,c.hj)(e,S&&I?I:f,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:$,noHighlight:D,isResizingContainer:q}=F&&n||{},j=a.messageIds&&a.messageIds.includes(p),{query:G}=(0,c.n5)(e)||{},_=(0,d._O)(o);let H;H=null!=r&&r.messages?r.messages.every((t=>{let{id:n}=t;return(0,c.vk)(e,n)})):(0,c.vk)(e,p);const{canReply:z}="thread"===h&&(0,c._k)(e,o,m)||{},V=(0,c.te)(e,o),X=Z?(0,c.tZ)(e,Z.chatId,Z.threadId)||Z:void 0,K=Boolean(o.groupedId)&&!o.isInAlbum,W=K?(0,c.xH)(e,f,o.groupedId)[0]:void 0,Y=K?g?(0,c.hj)(e,f,W):void 0:o,J=_?(0,c.CP)(e,_):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:K,isProtected:(0,c.EV)(e,o),isFocused:F,isForwarding:j,reactionMessage:Y,isChatWithSelf:C,isRepliesChat:S,isChannel:b,canReply:z,lastSyncTime:s,serverTimeOffset:i,highlight:G,isSingleEmoji:Boolean(_),animatedEmoji:_?(0,c.zB)(e,_):void 0,animatedEmojiEffect:_&&(0,d.YC)(f)?(0,c.tH)(e,_):void 0,animatedEmojiSoundId:_?(0,c.Oh)(e,_):void 0,localSticker:J,localEffect:J&&(0,d.YC)(f)?(0,c.cu)(J):void 0,isInSelectMode:(0,c.CA)(e),isSelected:H,isGroupSelected:Boolean(o.groupedId)&&!o.isInAlbum&&(0,c.a6)(e,f,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:X,availableReactions:e.availableReactions,defaultReaction:(0,d.CI)(o)?void 0:(0,c.q6)(e,f),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:$,noFocusHighlight:D,isResizingContainer:q}}}))((e=>{let{message:t,chatUsername:n,observeIntersectionForBottom:s,observeIntersectionForMedia:r,observeIntersectionForAnimatedStickers:c,album:l,noAvatars:u,withAvatar:g,withSenderName:f,areReactionsInMeta:v,noComments:I,appearanceOrder:y,isFirstInGroup:w,isLastInGroup:Z,isFirstInDocumentGroup:P,isLastInDocumentGroup:C,isLastInList:S,theme:b,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:$,focusDirection:D,noFocusHighlight:q,isResizingContainer:j,isForwarding:G,isChatWithSelf:_,isRepliesChat:H,isChannel:z,canReply:V,lastSyncTime:X,serverTimeOffset:K,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:fe,autoLoadFileMaxSizeMb:ve,threadInfo:Ie}=e;const{toggleMessageSelection:ye,clickBotInlineButton:we,disableContextMenuHint:Ze}=(0,a.Sv)(),Ce=(0,i.sO)(null),Se=(0,i.sO)(null),be=(0,i.sO)(null),Me=(0,He.Z)();(0,Mn._N)(Se,s);const{isContextMenuOpen:Re,contextMenuPosition:ke,handleBeforeContextMenu:Ne,handleContextMenu:Te,handleContextMenuClose:Ae,handleContextMenuHide:Be}=(0,Nn.Z)(Ce,h.$b&&ne,!0,h.wZ);(0,i.d4)((()=>{Re&&Ze()}),[Re,Ze]);const xe=y<=0,[Le,Oe]=(0,Ge.Z)(xe);(0,i.d4)((()=>{xe||setTimeout(Oe,10*y)}),[y,Oe,xe]);const{transitionClassNames:Ue}=(0,Ee.Z)(Le,void 0,xe,!1),{id:Fe,chatId:$e,forwardInfo:De,viaBotId:qe}=t,je=(0,d.CI)(t),_e=(0,d.B4)(t),ze="scheduled"===ue||t.isScheduled,Ve=(0,d.ss)(t)&&!A,Xe=Boolean(Ie)&&"thread"===ue,Ke=(0,d.$D)(t),We=J||Y,Ye=(null==oe?void 0:oe.reactions)&&!(0,d.JE)(oe.reactions),Je=De&&(!_||ze)&&!H&&!De.isLinkedChannelPost&&!Ke,et=Boolean(l)&&l.messages.length>1,tt=U&&!P,nt=U&&!C,at=void 0!==ke,st=!(at||ne||G||nt),it=z&&!ze&&!F,ot=Boolean(me||De&&(De.isChannelPost||_&&!_e||H)&&De.fromMessageId),rt=(0,i.I4)(((e,t)=>{ye({messageId:Fe,groupedId:t,...(null==e?void 0:e.shiftKey)&&{withShift:!0},...et&&{childMessageIds:l.messages.map((e=>{let{id:t}=e;return t}))}})}),[ye,Fe,et,l]),ct=R?M:void 0,lt=De&&(_||H||!ct)?k:ct,dt=De?k:ct,{handleMouseDown:ut,handleClick:mt,handleContextMenu:ht,handleDoubleClick:gt,handleContentDoubleClick:pt,handleMouseMove:ft,handleSendQuickReaction:vt,handleMouseLeave:It,isSwiped:yt,isQuickReactionVisible:wt,handleDocumentGroupMouseEnter:Zt}=_n(rt,Ce,Fe,0,Boolean(ne),Boolean(V),Boolean(F),Te,Ne,$e,at,be,_e,nt),{handleAvatarClick:Pt,handleSenderClick:Ct,handleViaBotClick:St,handleReplyClick:bt,handleMediaClick:Et,handleAudioPlay:Mt,handleAlbumMediaClick:Rt,handleMetaClick:kt,handleReadMedia:Nt,handleCancelUpload:Tt,handleVoteSend:At,handleGroupForward:Bt,handleForward:xt,handleFocus:Lt,handleFocusForwarded:Ut,handleDocumentGroupSelectAll:Ft}=function(e,t,n,s,r,c,l,d,u,h,g,p,f){const{openChat:v,showNotification:I,focusMessage:y,openMediaViewer:w,openAudioPlayer:Z,markMessagesRead:P,cancelSendingMessage:C,sendPollVote:S,openForwardMenu:b,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)((()=>{p?l&&null!=R&&R.channelPostId?y({chatId:p.id,messageId:R.channelPostId}):v({id:p.id}):I({message:e("HidAccount")})}),[l,y,R,e,v,p,I]),L=(0,i.I4)((()=>{f&&v({id:f.id})}),[f,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]),$=(0,i.I4)((e=>{w({chatId:s,threadId:r,messageId:e,origin:d?m.bZ.ScheduledAlbum:m.bZ.Album})}),[s,r,w,d]),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=>{S({chatId:s,messageId:M,options:e})}),[s,M,S]),G=(0,i.I4)((()=>{b({fromChatId:s,groupedId:A})}),[b,s,A]),_=(0,i.I4)((()=>{if(h&&h.messages){const e=h.messages.map((e=>{let{id:t}=e;return t}));b({fromChatId:s,messageIds:e})}else b({fromChatId:s,messageIds:[M]})}),[h,b,s,M]),H=(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:$,handleMetaClick:V,handleReadMedia:D,handleCancelUpload:q,handleVoteSend:j,handleGroupForward:G,handleForward:_,handleFocus:H,handleFocusForwarded:z,handleDocumentGroupSelectAll:V}}(Me,rt,t,$e,ie,U,Je,ze,H,l,lt,dt,N),$t=(0,Pe.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",S&&"last-in-list",_e&&"own",Boolean(t.views)&&"has-views",t.isEdited&&"was-edited",Ve&&"has-reply",at&&"has-menu-open",$&&!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",yt&&"is-swiped",Ue,Boolean(le)&&"has-active-reaction"),{text:Dt,photo:qt,video:Gt,audio:_t,voice:Ht,document:zt,sticker:Vt,contact:Kt,poll:Wt,webPage:Yt,invoice:Jt,location:Qt,action:en,game:tn}=(0,d.qp)(t),{phoneCall:nn}=en||{},an=Ie&&!nt&&"thread"===ue&&!I,sn=!h.$b&&!nn&&!ne&&ce&&!nt,on=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:p,voice:f,document:v,poll:I,webPage:y,contact:w,location:Z}=(0,d.qp)(e),P=["message-content"],C=h||g||Z,S=m||"venue"===(null==Z?void 0:Z.type)||u,b=C&&!S,E=Boolean(e.viaBotId);return Tn(n)?P.push(`emoji-only emoji-only-${n}`):S&&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"):p?P.push("audio"):f?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||!b||E||o)&&P.push("has-solid-background"),a&&(h||Z&&!S||!b)&&P.push("has-appendix")),P.join(" ")}(t,{hasReply:Ve,customShape:Ke,isLastInGroup:Z,asForwarded:Je,hasThread:Xe,forceSenderName:E,hasComments:Ie&&(null==Ie?void 0:Ie.messagesCount)>0,hasActionButton:it||ot,hasReactions:Ye,isGeoLiveActive:"geoLive"===(null==Qt?void 0:Qt.type)&&!(0,d.$R)(t,(0,p.b)(K))}),rn=on.includes("has-appendix"),cn=(0,Xt.X)(t,W,Tn(Ke));let dn,un;dn=nn||nt?"none":!cn||We||Yt?"standalone":"in-text",v?un="in-meta":Ye?Ke||(qt||Gt||We)&&!cn?un="outside":Je?(dn="standalone",un="inside"):un="inside":un="none",(0,Ot.Z)(H&&t.replyToChatId?t.replyToChatId:$e,Ve?t.replyToMessageId:void 0,B,t.id),Dn(Ce,$e,$,D,q,j);let hn,gn="",pn=!1;const fn=(0,i.Ye)((()=>et?Un(_e,Boolean(Je),Boolean(u),l):void 0),[et,_e,Je,u,l]),vn=Je?28:0;if(et||!qt&&!Gt)fn&&(hn=Math.max(An(Boolean(Dt),an),fn.containerStyle.width),hn-fn.containerStyle.width>18&&(pn=!0));else{let e;qt?e=Bn(t,u).width:Gt&&(e=Gt.isRound?jt.Rj:Bn(t,u).width),e&&(hn=Math.max(An(Boolean(Dt),an),e),hn-e>18&&(pn=!0))}hn&&(gn=`width: ${hn+vn}px`);const In=z&&t.adminTitle||!Je&&(null==De?void 0:De.adminTitle)||void 0,yn=(0,i.Ye)((()=>In?$n(In):void 0),[In]);function wn(){const e=i.ZP.createElement(aa,{message:t,reactionMessage:oe,outgoingStatus:L,signature:In,withReactions:"in-meta"===un,withReactionOffset:"inside"===un,availableReactions:re,activeReaction:le,onClick:kt});return"inside"!==un?e:i.ZP.createElement(es,{activeReaction:le,message:oe,metaChildren:e,availableReactions:re})}return i.ZP.createElement("div",{ref:Ce,id:(0,d.d0)(t.id),className:$t,style:yn?`--meta-safe-author-width: ${yn}px`:void 0,"data-message-id":Fe,onMouseDown:ut,onClick:mt,onContextMenu:ht,onDoubleClick:gt,onMouseEnter:nt?Zt:void 0,onMouseMove:sn?ft:void 0,onMouseLeave:sn||nt?It:void 0},i.ZP.createElement("div",{ref:Se,className:"bottom-marker","data-message-id":Fe,"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,Pe.Z)("message-select-control group-select",se&&"is-selected"),onClick:Ft},se&&i.ZP.createElement("i",{className:"icon-select"})),g&&function(){const e=lt&&(0,d.YC)(lt.id),t=lt&&e?lt:void 0,n=lt&&!e?lt:void 0,a=!lt&&De?De.hiddenUserName:void 0;return i.ZP.createElement(mn.Z,{size:"small",user:t,chat:n,text:a,lastSyncTime:X,onClick:t||n?Pt:void 0})}(),i.ZP.createElement("div",{className:(0,Pe.Z)("message-content-wrapper",on.includes("text")&&"can-select-text")},i.ZP.createElement("div",{ref:be,className:on,style:gn,dir:"auto"},Je&&!tt&&i.ZP.createElement("div",{className:"message-title"},Me("ForwardedMessage")),function(){const e=(0,Pe.Z)("content-inner",Je&&"forwarded-message",Ve&&"reply-message",pn&&"no-media-corners"),n=Z&&!cn&&!Je&&!Xe,a=(0,Pe.Z)("text-content","in-text"===dn&&"with-meta",L&&"with-outgoing-icon");return i.ZP.createElement("div",{className:e,onDoubleClick:pt,dir:"auto"},function(){if(Ke&&!qe||!(f&&!(qt||Gt||Qt)||Je||qe||E)||tt||Ve&&Ke)return;let e,n;return!dt||Ke&&qe?null!=De&&De.hiddenUserName&&(e=De.hiddenUserName):(e=(0,d.OU)(Me,dt),Je||(n=`color-${(0,d.Rs)(dt)}`)),i.ZP.createElement("div",{className:"message-title",dir:"ltr"},e?i.ZP.createElement("span",{className:(0,Pe.Z)("interactive",n),onClick:Ct,dir:"auto"},(0,ln.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:St},(0,ln.Z)(`@${N.username}`))),null!=De&&De.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)}(),Ve&&i.ZP.createElement(Wn,{message:B,isProtected:F,sender:x,observeIntersection:r,onClick:bt}),Vt&&i.ZP.createElement(oa,{message:t,observeIntersection:r,observeIntersectionForPlaying:c,shouldLoop:fe,lastSyncTime:X}),Y&&i.ZP.createElement(ra.Z,{size:"small",isOwn:_e,sticker:Y,effect:ee,soundId:te,observeIntersection:r,lastSyncTime:X,forceLoadPreview:je,messageId:Fe,chatId:$e,activeEmojiInteractions:de}),J&&i.ZP.createElement(as,{size:"small",isOwn:_e,localSticker:J,localEffect:Q,soundId:te,observeIntersection:r,lastSyncTime:X,forceLoadPreview:je,messageId:Fe,chatId:$e,activeEmojiInteractions:de}),et&&i.ZP.createElement(Va,{album:l,albumLayout:fn,observeIntersection:r,isOwn:_e,isProtected:F,hasCustomAppendix:n,lastSyncTime:X,onMediaClick:Rt}),nn&&i.ZP.createElement(ss,{message:t,phoneCall:nn,chatId:$e}),!et&&qt&&i.ZP.createElement(ga,{message:t,observeIntersection:r,noAvatars:u,canAutoLoad:ge,uploadProgress:O,shouldAffectAppendix:n,onClick:Et,onCancelUpload:Tt,isDownloading:he,isProtected:F,theme:b}),!et&&Gt&&Gt.isRound&&i.ZP.createElement(Wa,{message:t,observeIntersection:r,canAutoLoad:ge,lastSyncTime:X,isDownloading:he}),!et&&Gt&&!Gt.isRound&&i.ZP.createElement(ya,{message:t,observeIntersection:r,noAvatars:u,canAutoLoad:ge,canAutoPlay:pe,uploadProgress:O,lastSyncTime:X,onClick:Et,onCancelUpload:Tt,isDownloading:he,isProtected:F}),(_t||Ht)&&i.ZP.createElement(Jn.Z,{theme:b,message:t,origin:m.Cr.Inline,uploadProgress:O,lastSyncTime:X,isSelectable:U,isSelected:ae,onPlay:Mt,onReadMedia:!Ht||_e&&!_?void 0:Nt,onCancelUpload:Tt,isDownloading:he}),zt&&i.ZP.createElement(Yn.Z,{message:t,observeIntersection:r,canAutoLoad:ge,autoLoadFileMaxSizeMb:ve,uploadProgress:O,isSelectable:U,isSelected:ae,onMediaClick:Et,onCancelUpload:Tt,isDownloading:he}),Kt&&i.ZP.createElement(Za,{contact:Kt}),Wt&&i.ZP.createElement(Ra,{message:t,poll:Wt,onSendVote:At}),tn&&i.ZP.createElement(Ga,{message:t,canAutoLoadMedia:ge,lastSyncTime:X}),!We&&cn&&i.ZP.createElement("p",{className:a,dir:"auto"},cn,"in-text"===dn&&wn()),Yt&&i.ZP.createElement(Ta,{message:t,observeIntersection:r,noAvatars:u,canAutoLoad:ge,canAutoPlay:pe,lastSyncTime:X,onMediaClick:Et,onCancelMediaTransfer:Tt,isDownloading:he,isProtected:F,theme:b}),Jt&&i.ZP.createElement(Ba,{message:t}),Qt&&i.ZP.createElement(ja,{message:t,lastSyncTime:X,isInSelectMode:ne,isSelected:ae,theme:b,peer:M,serverTimeOffset:K}))}(),!nt&&"standalone"===dn&&wn(),st&&it?i.ZP.createElement(Qe.Z,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:Me("lng_context_forward_msg"),onClick:C?Bt:xt},i.ZP.createElement("i",{className:"icon-share-filled"})):st&&ot?i.ZP.createElement(Qe.Z,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:"Focus message",onClick:me?Lt:Ut},i.ZP.createElement("i",{className:"icon-arrow-right"})):void 0,an&&i.ZP.createElement(Ja,{threadInfo:Ie,disabled:I}),rn&&i.ZP.createElement("div",{className:"svg-appendix",dangerouslySetInnerHTML:_e?is:os}),sn&&i.ZP.createElement("div",{className:(0,Pe.Z)("quick-reaction",wt&&!le&&"visible"),onClick:vt},i.ZP.createElement(ea.Z,{reaction:ce}))),t.inlineButtons&&i.ZP.createElement(Ya,{message:t,onClick:we}),"outside"===un&&i.ZP.createElement(es,{message:oe,isOutside:!0,activeReaction:le,availableReactions:re})),ke&&i.ZP.createElement(Xn,{isOpen:Re,anchor:ke,message:t,album:l,chatUsername:n,messageListType:ue,onClose:Ae,onCloseAnimationEnd:Be}))}))),cs=(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,He.Z)(),p=(0,i.sO)(null),f=Boolean(n),{observe:v}=(0,Mn.S1)({rootRef:s,debounceMs:200,threshold:1});(0,i.d4)((()=>f?v(p.current,(e=>{e.isIntersecting&&c({chatId:t})})):void 0),[t,f,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,ln.Z)((0,d.Js)(o)||""),r&&(0,ln.Z)(n.chatInviteTitle||(0,d.U)(g,r,o)||"")),i.ZP.createElement("p",{className:"text-content with-meta",dir:"auto",ref:p},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(Qe.Z,{color:"secondary",size:"tiny",ripple:!0,onClick:I,className:"SponsoredMessage__button"},g(n.isBot?"Conversation.ViewBot":n.channelPostId?"Conversation.ViewPost":"Conversation.ViewChannel")))))}))),ls=(0,i.X$)((e=>{let{chatId:t,messageIds:n,messageGroups:o,isViewportNewest:r,isUnread:c,withUsers:l,areReactionsInMeta:u,noAvatars:p,containerRef:f,anchorIdRef:v,memoUnreadDividerBeforeIdRef:I,memoFirstUnreadIdRef:y,threadId:w,type:Z,isReady:P,isScrollingRef:C,isScrollPatchNeededRef:S,threadTopMessageId:b,hasLinkedChat:E,isSchedule:R,noAppearanceAnimation:k,onFabToggle:N,onNotchToggle:T}=e;const{openHistoryCalendar:A}=(0,a.Sv)(),{observeIntersectionForMedia:B,observeIntersectionForReading:x,observeIntersectionForAnimatedStickers:L}=function(e,t,n){const{markMessageListRead:s,markMessagesRead:i}=(0,a.Sv)(),{observe:o}=(0,Mn.S1)({rootRef:t,throttleMs:Rn,margin:kn}),{observe:r,freeze:c,unfreeze:l}=(0,Mn.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,Me.Z)(c,l);const{observe:d}=(0,Mn.S1)({rootRef:t,throttleMs:Rn});return{observeIntersectionForMedia:o,observeIntersectionForReading:r,observeIntersectionForAnimatedStickers:d}}(Z,f,y),{backwardsTriggerRef:U,forwardsTriggerRef:F,fabTriggerRef:$}=function(e,t,n,o,r,c,l,d,u,g){const{loadViewportMessages:p}=(0,a.Sv)(),[f,v]=(0,i.Ye)((()=>"thread"===e?[(0,M.Ds)((()=>p({direction:m.Uq.Backwards})),1e3,!0,!1),(0,M.Ds)((()=>p({direction:m.Uq.Forwards})),1e3,!0,!1)]:[]),[p,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,Mn.S1)({rootRef:t,margin:h.gZ},(e=>{if(!v||!f)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),f()):"forwards-trigger"===a.className&&v()}));(0,Mn._N)(I,P),(0,Mn._N)(y,P);const{observe:C,freeze:S,unfreeze:b}=(0,Mn.S1)({rootRef:t,margin:100},Z);(0,Mn._N)(w,C);const{observe:E,freeze:R,unfreeze:k}=(0,Mn.S1)({rootRef:t,margin:1},Z);return(0,Mn._N)(w,E),(0,ke.Z)((()=>{d&&Z()}),[d]),(0,ke.Z)((()=>{S(),R(),setTimeout((()=>{k(),b()}),250)}),[n]),{backwardsTriggerRef:I,forwardsTriggerRef:y,fabTriggerRef:w}}(Z,f,n,r,c,N,T,P,C,S),D=(0,He.Z)(),q=i.ZP.createElement("div",{className:(0,Pe.Z)("unread-divider","local-action-message"),key:"unread-messages"},i.ZP.createElement("span",null,D("UnreadMessages"))),j=k?0:o.reduce(((e,t)=>e+(0,g.xH)(t.senderGroups).length),0);let G=0;const _=o.map(((e,t,n)=>{const a=e.senderGroups.map(((e,a,s)=>{var o;if(1===e.length&&!yn(e[0])&&(0,d.Lo)(e[0])&&(null===(o=e[0].content.action)||void 0===o||!o.phoneCall)){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(Kn,{key:o.id,message:o,observeIntersection:x,appearanceOrder:j-++G,isLastInList:r})])}let r;return(0,g.xH)(e.map(((o,c)=>{const m=yn(o)?o.mainMessage:o,h=yn(o)?o:void 0,f=(0,d.B4)(m),y=yn(o),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,S=P&&!yn(P)?P.groupedId:void 0,M={isFirstInGroup:0===c,isLastInGroup:c===e.length-1,isFirstInDocumentGroup:Boolean(C&&C!==r),isLastInDocumentGroup:Boolean(C&&C!==S),isLastInList:c===e.length-1&&a===s.length-1&&t===n.length-1};r=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(rs,{key:k,message:m,observeIntersectionForBottom:x,observeIntersectionForMedia:B,observeIntersectionForAnimatedStickers:L,album:h,noAvatars:p,withAvatar:M.isLastInGroup&&l&&!f&&!(m.id===b),withSenderName:M.isFirstInGroup&&l&&!f,areReactionsInMeta:u,threadId:w,messageListType:Z,noComments:!1===E,appearanceOrder:j-++G,isFirstInGroup:M.isFirstInGroup,isLastInGroup:M.isLastInGroup,isFirstInDocumentGroup:M.isFirstInDocumentGroup,isLastInDocumentGroup:M.isLastInDocumentGroup,isLastInList:M.isLastInList}),m.id===b&&i.ZP.createElement("div",{className:"local-action-message",key:"discussion-started"},i.ZP.createElement("span",null,D("DiscussionStarted")))])})))}));return i.ZP.createElement("div",{className:"message-date-group",key:e.datetime,onMouseDown:Zn.q,teactFastList:!0},i.ZP.createElement("div",{className:(0,Pe.Z)("sticky-date",!R&&"interactive"),key:"date-header",onMouseDown:Zn.q,onClick:R?void 0:()=>A({selectedAt:e.datetime})},i.ZP.createElement("span",{dir:"auto"},R&&e.originalDate===s.t4&&D("MessageScheduledUntilOnline"),R&&e.originalDate!==s.t4&&D("MessageScheduledOn",(0,O.j1)(D,e.datetime,void 0,!0)),!R&&(0,O.j1)(D,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)(_),r&&i.ZP.createElement(cs,{key:t,chatId:t,containerRef:f}),i.ZP.createElement("div",{ref:F,key:"forwards-trigger",className:"forwards-trigger"}),i.ZP.createElement("div",{ref:$,key:"fab-trigger",className:"fab-trigger"}))}));var ds=n(3547);const us=(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,He.Z)(),d=(0,i.sO)(null),{observe:u}=(0,Mn.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(ds.Z,{sticker:t,onClick:m,clickArg:t,observeIntersection:u,size:160,className:"large",noContextMenu:!0}))))}))),ms=(0,i.X$)((e=>{let{isChatWithSelf:t,type:n,isGroupChatJustCreated:a}=e;const s=(0,He.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")))})),hs=(0,M.Ds)((e=>e()),200,!1),gs=(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,p=(0,c.G$)(e,n),f=a===o._f&&!r&&!i.unreadCount&&!p&&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:p,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,...f&&{lastMessage:g}}}))((e=>{var t,n,o,r,l,u;let{chatId:p,threadId:f,type:v,hasTools:I,onFabToggle:y,onNotchToggle:w,isChatLoaded:Z,isChannelChat:P,isGroupChat:C,canPost:S,isReady:b,isChatWithSelf:E,isRepliesChat:R,isCreator:k,isBot:N,messageIds:T,messagesById:A,firstUnreadId:B,isViewportNewest:x,threadFirstMessageId:L,isRestricted:O,restrictionReason:U,focusingId:F,isSelectModeActive:$,lastMessage:D,botDescription:q,threadTopMessageId:j,hasLinkedChat:G,lastSyncTime:_,withBottomShift:H}=e;const{loadViewportMessages:z,setScrollOffset:V,loadSponsoredMessages:X,loadMessageReactions:K,copyMessagesByIds:W}=(0,a.Sv)(),Y=(0,i.sO)(null),J=(0,i.sO)("thread"===v&&(0,c.Vt)((0,a.Rd)(),p,f)||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(D)),[re,ce]=(0,i.eJ)(),le=Boolean(T);(0,ke.Z)((()=>{le&&(0,M.R3)((()=>{oe.current=!1}))}),[le]),(0,ke.Z)((()=>{ne.current=B}),[B]),(0,ke.Z)((()=>{P&&b&&_&&X({chatId:p})}),[p,b,P,_]),(0,ke.Z)((()=>{le&&(ae.current=ne.current)}),[le]),(0,ke.Z)((()=>{se.current=F}),[F]),(e=>{(0,i.d4)((()=>{function t(t){if((h.jm&&t.metaKey||!h.jm&&t.ctrlKey)&&"c"===(0,qe.Z)(t)){const n=(0,En.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 wn((0,g.Xo)(t,["date","id"]),ae.current)}),[T,A,L,j]);(0,bn.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&&K({chatId:p,ids:e})}),15e3);const ue=(0,i.Ye)((()=>{if("thread"===v)return(0,M.Ds)((()=>z({direction:m.Uq.Around})),1e3,!0,!1)}),[z,T]),{isScrolled:me,updateStickyDates:he}=function(){const[e,t]=(0,Ge.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,M.T2)((()=>{document.body.classList.add("is-scrolling-messages")})),n((()=>{(0,M.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])}}(),ge=(0,i.sO)(),pe=(0,i.sO)(),fe=(0,i.I4)((()=>{if(ie.current)return void(ie.current=!1);ge.current=!0;const e=Y.current;se.current||he(e,I),hs((()=>{ge.current=!1,(0,M.T2)((()=>{e.parentElement&&(J.current=e.scrollHeight-e.scrollTop,"thread"===v&&V({chatId:p,threadId:f,scrollOffset:J.current}))}))}))}),[he,I,v,V,p,f]);(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:ve}=Tt();(0,i.d4)((()=>{Y.current.dataset.normalHeight=String(Y.current.offsetHeight)}),[ve,S]),(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,ke.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,vn.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,p=te.current[te.current.length-1];let f=g-(a||h);c&&(f-=p?p.offsetHeight:0);const v=x&&n&&f<=20;let y;if(c&&v&&!l&&(p&&(0,M.T2)((()=>{(0,Sn.Z)(i,p,"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,Sn.N)())return;y=m-h}else Z?(pe.current&&(pe.current=!1,(0,Cn.z)(i)),y=u+(Z.getBoundingClientRect().top-(ee.current||0))):y=P?Math.min(P.offsetTop-(I?60:10),m-g):m-g;(0,Cn.Z)(i,Math.ceil(y)),se.current||(ie.current=!0,(0,M.T2)((()=>{ie.current=!1}))),J.current=Math.max(Math.ceil(m-y),h)}),[T,x,re,I]),(0,In.Z)((e=>{let[t]=e;void 0!==t&&(0,Ze.YW)(200+s.fK)}),[$]);const Ie=(0,He.Z)(),ye=Boolean(p&&(0,d.YC)(p)),we=Boolean(!ye&&!P||E||R),Ce=Boolean(!we||P),Se=(0,d.YC)(p)&&!E&&!N&&(!de&&!D&&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==D||null===(o=D.content)||void 0===o||null===(r=o.action)||void 0===r?void 0:r.type)),be=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),Ee=(0,Pe.Z)("MessageList custom-scroll",Ce&&"no-avatars",!S&&"no-composer","pinned"===v&&"type-pinned",H&&"with-bottom-shift",$&&"select-mode-active",me&&"scrolled",!b&&"is-animating");return i.ZP.createElement("div",{ref:Y,className:Ee,onScroll:fe,onMouseDown:Zn.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,ln.Z)(Ie(q),["br","emoji","links"]))):Se?i.ZP.createElement(us,{userId:p}):!T||de&&!be?T&&de||D?i.ZP.createElement(ls,{chatId:p,messageIds:T||[D.id],messageGroups:de||wn([D]),isViewportNewest:Boolean(x),isUnread:Boolean(B),withUsers:we,areReactionsInMeta:ye,noAvatars:Ce,containerRef:Y,anchorIdRef:Q,memoUnreadDividerBeforeIdRef:ae,memoFirstUnreadIdRef:ne,threadId:f,type:v,isReady:b,isScrollingRef:ge,isScrollPatchNeededRef:pe,threadTopMessageId:j,hasLinkedChat:G,isSchedule:!!de&&"scheduled"===v,noAppearanceAnimation:!de||!oe.current,onFabToggle:y,onNotchToggle:w}):i.ZP.createElement(ht.Z,{color:"white",backgroundColor:"dark"}):i.ZP.createElement(ms,{chatId:p,type:v,isChatWithSelf:E,isGroupChatJustCreated:be}))}))),ps=(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,He.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,Sn.Z)(e,n,"end",20)}}),[t,s,c]),m=(0,Pe.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(Qe.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,Oe.bi)(o))))})));var fs=n(5723);const vs=1280,Is=/\.[^/.]+$/;async function ys(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,Nt.pt)(o),{width:n,height:a}=t;if(n>vs||a>vs||"image/jpeg"!==r){const t=await tn(o,vs/Math.max(n,a),"image/jpeg");return URL.revokeObjectURL(o),ys(e,await(0,Nt.gm)(t),!0,i)}"image/jpeg"===r&&(e=e.replace(Is,".jpg")),l={width:n,height:a}}else u=o;else if(s.wG.has(r)){const{videoWidth:e,videoHeight:t,duration:n}=await(0,Nt.jj)(o);l={width:e,height:t,duration:n},u=await(0,Nt.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 n.e(505).then(n.t.bind(n,8505,23)),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 ws(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 Zs=n(6391);let Ps;function Cs(e){Ps.focus(),e.focus()}h.cj&&(Ps=document.createElement("input"),Ps.classList.add("for-ios-autocapitalization-fix"),document.body.appendChild(Ps));var Ss=n(4784),bs=n(2400),Es=n(6389),Ms=n(971);const Rs={encoderPath:new URL(n(8973),n.b).href,reuseWorker:!0},ks={type:"audio/ogg"};let Ns,Ts,As;async function Bs(){return Ns||(Ns=n.e(161).then(n.t.bind(n,1161,23)),Ts=(await Ns).default,As=new Ts(Rs)),Ns}async function xs(e){await async function(){await Bs(),await As.start()}();const t=Date.now();let n;const a=[],s=[];As.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}}(As);return{stop:()=>new Promise(((e,o)=>{As.onstop=()=>{e({blob:new Blob(a,ks),duration:Math.round(((n||Date.now())-t)/1e3),waveform:s})},As.onerror=o;const r=Math.max(0,t+1e3-Date.now());setTimeout((()=>{As.stop(),i()}),r)})),pause:()=>{const e=Math.max(0,t+1e3-Date.now());setTimeout((()=>{As.pause(),n=Date.now(),i()}),e)}}}var Ls=n(1262);const Os=["image/png","image/jpeg","image/gif"];let Us,Fs;var $s=n(3575),Ds=n(9295);function qs(e,t,n){const a=(0,Pn.Z)(t,!0),[s,o]=(0,i.eJ)(),[r,c,l]=(0,Ge.Z)();return(0,Ze.ZP)(c,l),(0,ke.Z)((()=>{r||a((()=>{o(e())}))}),[...n,r]),s}const js=/^@([a-z0-9_]{1,32})[\u00A0\u0020]+(.*)/i,Gs=/^@([a-z0-9_]{1,32})[\u00A0\u0020]+\n{2,}/i,_s={username:"",query:"",canShowHelp:!1,usernameLowered:""},Hs=document.createElement("div");const zs=(0,M.P2)((e=>e()),500,!0),Vs=/^[\w@]{1,32}\s?/i;var Xs=n(3057);const Ks=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,mt.Z)(ut.gl.Extra,"DeleteMessageModal",!t);return n?i.ZP.createElement(n,e):void 0}));function Ws(){return Ws=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},Ws.apply(this,arguments)}let Ys,Js=!0;const Qs=(0,i.X$)((e=>{let{onActivate:t,...n}=e;const a=(0,i.sO)(!1),s=(0,i.I4)((()=>{if(a.current=!0,Js)return Js=!1,void t();Ys&&(clearTimeout(Ys),Ys=void 0),Ys=window.setTimeout((()=>{a.current&&t()}),200)}),[t]),o=(0,i.I4)((()=>{a.current=!1}),[]);return i.ZP.createElement(Qe.Z,Ws({},n,{onMouseEnter:h.$b?void 0:s,onMouseLeave:h.$b?void 0:o,onClick:t}))}));var ei=n(5655),ti=n(6503);const ni=(0,i.X$)((e=>{let{isButtonVisible:t,canAttachMedia:n,canAttachPolls:a,onFileSelect:o,onPollCreate:r}=e;const[c,l,d]=(0,Ge.Z)(),[u,m,g]=(0,ti.Z)(c,d);(0,i.d4)((()=>{c&&g()}),[c,g]);const p=(0,i.I4)((()=>{c?d():l()}),[c,l,d]),f=(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,ei.g)(Array.from(s.dI).join(","),(e=>f(e,!0)))}),[f]),I=(0,i.I4)((()=>{(0,ei.g)("*",(e=>f(e,!1)))}),[f]),y=(0,He.Z)();if(t)return i.ZP.createElement("div",{className:"AttachMenu"},i.ZP.createElement(Qs,{id:"attach-menu-button",className:c?"AttachMenu--button activated":"AttachMenu--button",round:!0,color:"translucent",onActivate:p,ariaLabel:"Add an attachment",ariaControls:"attach-menu-controls",hasPopup:!0},i.ZP.createElement("i",{className:"icon-attach"})),i.ZP.createElement(ft.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(Je.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(Je.Z,{icon:"photo",onClick:v},y("AttachmentMenu.PhotoOrVideo")),i.ZP.createElement(Je.Z,{icon:"document",onClick:I},y("AttachDocument"))),a&&i.ZP.createElement(Je.Z,{icon:"poll",onClick:r},y("Poll"))))})),ai=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,mt.Z)(ut.gl.Extra,"SymbolMenu",!t);return n?i.ZP.createElement(n,e):void 0})),si=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,mt.Z)(ut.gl.Extra,"InlineBotTooltip",!t);return n?i.ZP.createElement(n,e):void 0})),ii=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,mt.Z)(ut.gl.Extra,"MentionTooltip",!t);return n?i.ZP.createElement(n,e):void 0}));var oi=n(7146);const ri=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,mt.Z)(ut.gl.Extra,"StickerTooltip",!t);return n?i.ZP.createElement(n,e):void 0}));var ci=n(9830);const li=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,mt.Z)(ut.gl.Extra,"BotCommandTooltip",!t);return n?i.ZP.createElement(n,e):void 0})),di=(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{clickBotInlineButton:o}=(0,a.Sv)(),[r,c]=(0,ti.Z)(t,s),{isKeyboardSingleUse:l}=n||{},[d,u,m]=(0,Ge.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(ft.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(Qe.Z,{ripple:!0,disabled:"unsupported"===e.type,onClick:()=>o({messageId:n.id,button:e})},e.text))))))))})));var ui=n(3616),mi=n(7891);const hi=(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,p;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])),l&&g){const{forwardInfo:n}=g,a=t===s;n&&(n.isChannelPost||a)&&(p=(0,c.cv)(e,g)),p||(p=(0,c.Ur)(e,g))}else h&&(p=(0,d.YC)(i)?(0,c.dy)(e,i):(0,c.Z1)(e,i));return{replyingToId:l,editingId:u,message:g,sender:p,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),p=(0,mi.Z)([c],c?300:void 0),{shouldRender:f,transitionClassNames:v}=(0,Ee.Z)(p&&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,De.Z)(I):void 0),[g,I]);const y=(0,i.I4)((()=>{m({chatId:s.chatId,messageId:s.id})}),[m,s]),w=(0,Pe.Z)("ComposerEmbeddedMessage",v),Z=c&&c>1?`${c} forwarded messages`:void 0;if(f)return i.ZP.createElement("div",{className:w},i.ZP.createElement("div",null,i.ZP.createElement(Qe.Z,{round:!0,faded:!0,color:"translucent",ariaLabel:"Cancel replying",onClick:I},i.ZP.createElement("i",{className:"icon-close"})),i.ZP.createElement(Wn,{className:"inside-input",message:s,sender:o,customText:Z,title:n?"Edit Message":void 0,onClick:y})))}))),gi=(0,i.X$)((e=>{const{attachments:t}=e,n=(0,mt.Z)(ut.gl.Extra,"AttachmentModal",!t.length);return n?i.ZP.createElement(n,e):void 0})),pi=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,mt.Z)(ut.gl.Extra,"BotCommandMenu",!t);return n?i.ZP.createElement(n,e):void 0})),fi=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,mt.Z)(ut.gl.Extra,"PollModal",!t);return n?i.ZP.createElement(n,e):void 0})),vi=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,mt.Z)(ut.gl.Extra,"DropArea",!t);return n?i.ZP.createElement(n,e):void 0})),Ii=new RegExp(s.FM,"i"),yi=(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=qs((()=>{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(Ii);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,ke.Z)((()=>{m(),h({chatId:t,threadId:n})}),[t]);const p=Boolean(c&&s.length&&!l&&!r),{shouldRender:f,transitionClassNames:I}=(0,Ee.Z)(p),y=(0,Ut.Z)(c,!0),w=(0,i.I4)((()=>{h({chatId:t,threadId:n,noWebPage:!0})}),[t,n,h]);if(!f||!y)return;const{photo:Z,...P}=y,C={content:{webPage:P}};return i.ZP.createElement("div",{className:(0,Pe.Z)("WebPagePreview",I)},i.ZP.createElement("div",null,i.ZP.createElement(Qe.Z,{round:!0,faded:!0,color:"translucent",ariaLabel:"Clear Webpage Preview",onClick:w},i.ZP.createElement("i",{className:"icon-close"})),i.ZP.createElement(Ta,{message:C,inPreview:!0,theme:d})))}))),wi=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,mt.Z)(ut.gl.Extra,"SendAsMenu",!t);return n?i.ZP.createElement(n,e):void 0}));var Zi;!function(e){e.Send="send",e.Record="record",e.Edit="edit",e.Schedule="schedule"}(Zi||(Zi={}));const Pi="wonderful-voice-message.ogg",Ci=(0,i.X$)((0,a.c$)(((e,t)=>{var n,a,i,r,l;let{chatId:u,threadId:m,messageListType:h}=t;const g=(0,c.Z1)(e,u),p=u!==s.FV?(0,c.IK)(e,u):void 0,f=Boolean(p),v=(0,c.FM)(e,u),I=f&&(0,c.FT)(e,u),y=(0,c.qy)(e,u),{language:w,shouldSuggestStickers:Z}=e.settings.byKey,P=e.emojiKeywords[s.pR],C=w!==s.pR?e.emojiKeywords[w]:void 0,S=I?I.id:void 0,b=S?(0,c.hj)(e,u,S):void 0,{currentUserId:E}=e,M=null!=g&&g.fullInfo?(null==g||null===(n=g.fullInfo)||void 0===n?void 0:n.sendAsId)||E:void 0,R=null!=g&&g.sendAsIds&&M&&g.sendAsIds.includes(M)?M:null!=g&&null!==(a=g.adminRights)&&void 0!==a&&a.anonymous?null==g?void 0:g.id:void 0,k=R?(0,c.dy)(e,R):void 0,N=!k&&R?(0,c.Z1)(e,R):void 0,T=(0,c.QV)(e,u),A="scheduled"===h?(0,c.hI)(e,u):(0,c.s)(e,u,m);return{editingMessage:(0,c.kK)(e,u,m,h),connectionState:e.connectionState,draft:(0,c.Ms)(e,u,m),chat:g,isChatWithBot:f,isChatWithSelf:v,canScheduleUntilOnline:(0,c.Eh)(e,u),isChannel:g?(0,d.eA)(g):void 0,isRightColumnShown:(0,c.Jf)(e),isSelectModeActive:(0,c.CA)(e),withScheduledButton:m===o._f&&"thread"===h&&Boolean(null==y?void 0:y.length),shouldSchedule:"scheduled"===h,botKeyboardMessageId:S,botKeyboardPlaceholder:null==b?void 0:b.keyboardPlaceholder,isForwarding:u===e.forwardMessages.toChatId,pollModal:e.pollModal,stickersForEmoji:e.stickers.forEmoji.stickers,groupChatMembers:null==g||null===(i=g.fullInfo)||void 0===i?void 0:i.members,topInlineBotIds:null===(r=e.topInlineBots)||void 0===r?void 0:r.userIds,currentUserId:E,lastSyncTime:e.lastSyncTime,contentToBeScheduled:e.messages.contentToBeScheduled,shouldSuggestStickers:Z,recentEmojis:e.recentEmojis,baseEmojiKeywords:null==P?void 0:P.keywords,emojiKeywords:null==C?void 0:C.keywords,inlineBots:e.inlineBots.byUsername,isInlineBotLoading:e.inlineBots.isLoading,chatBotCommands:null==g||null===(l=g.fullInfo)||void 0===l?void 0:l.botCommands,botCommands:null!=p&&p.fullInfo?p.fullInfo.botCommands||!1:void 0,sendAsUser:k,sendAsChat:N,sendAsId:R,editingDraft:A,requestedText:T}}))((e=>{let{dropAreaState:t,shouldSchedule:n,canScheduleUntilOnline:r,isReady:c,onDropHide:u,editingMessage:m,chatId:g,threadId:f,messageListType:I,draft:y,chat:w,connectionState:Z,isChatWithBot:P,isChatWithSelf:C,isChannel:S,isRightColumnShown:b,isSelectModeActive:E,isForwarding:R,pollModal:k,botKeyboardMessageId:N,botKeyboardPlaceholder:T,withScheduledButton:A,stickersForEmoji:B,groupChatMembers:x,topInlineBotIds:L,currentUserId:U,lastSyncTime:F,contentToBeScheduled:$,shouldSuggestStickers:D,baseEmojiKeywords:q,emojiKeywords:j,recentEmojis:G,inlineBots:_,isInlineBotLoading:H,botCommands:z,chatBotCommands:V,sendAsUser:X,sendAsChat:K,sendAsId:W,editingDraft:Y,requestedText:J}=e;const{sendMessage:Q,clearDraft:ee,showDialog:te,setStickerSearchQuery:ne,setGifSearchQuery:ae,forwardMessages:se,openPollModal:oe,closePollModal:re,loadScheduledHistory:ce,openChat:le,addRecentEmoji:de,sendInlineBotResult:ue,loadSendAs:me,loadFullChat:he,resetOpenChatWithText:ge}=(0,a.Sv)(),pe=(0,He.Z)(),fe=(0,i.sO)(null),[ve,Ie]=(0,i.eJ)(""),ye=(0,Ms.Y)(ve),we=(0,i.sO)(),Ze=(0,Bt.Z)(t),{width:Ce}=ie.Z.get(),Se=null==w?void 0:w.sendAsIds,be=Se&&(Se.length>1||!Se.includes(U)),[Ee,Ne,Te]=(0,Ge.Z)(),Ae=(0,Es.Z)(g,f),Be=(0,i.I4)((()=>{Te()}),[Te]),[xe,Le]=(0,Xs.Z)(r,Be);(0,i.d4)((()=>{we.current=void 0}),[g]),(0,i.d4)((()=>{g&&F&&f===o._f&&c&&ce({chatId:g})}),[c,g,ce,F,f]),(0,i.d4)((()=>{g&&w&&F&&!Se&&c&&(0,d.ZV)(w)&&me({chatId:g})}),[w,g,c,F,me,Se]),(0,i.d4)((()=>{g&&w&&F&&!w.fullInfo&&c&&(0,d.ZV)(w)&&he({chatId:g})}),[w,g,c,F,he]);const Oe=(0,i.sO)(!1);(0,ke.Z)((e=>{let[t,n]=e;Oe.current=Boolean(g===t&&Se&&!n)}),[g,Se]),(0,i.bt)((()=>{fe.current&&(fe.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,Fe]=(0,i.eJ)([]),[$e,qe,je]=(0,Ge.Z)(),[_e,ze,Ve]=(0,Ge.Z)(),[Xe,Ke,We]=(0,Ge.Z)(),[Ye,Je,et]=(0,Ge.Z)(),[tt,nt,at]=(0,Ge.Z)(),[it,ot]=(0,Ge.Z)(),[rt,ct,lt]=(0,Ge.Z)(),{startRecordingVoice:dt,stopRecordingVoice:ut,pauseRecordingVoice:mt,activeVoiceRecording:ht,currentRecordTime:gt,recordButtonRef:pt,startRecordTimeRef:ft}=(()=>{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&&Bs()}),[]);const r=(0,i.I4)((async()=>{try{const{stop:t,pause:s}=await xs((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,De.Z)(l):void 0),[t,l]),{startRecordingVoice:r,pauseRecordingVoice:c,stopRecordingVoice:l,activeVoiceRecording:t,currentRecordTime:s,recordButtonRef:e,startRecordTimeRef:a}})();(0,bn.Z)((()=>{Ae({type:"recordAudio"})}),ht&&s.o_),(0,i.d4)((()=>{ht||Ae({type:"cancel"})}),[ht,Ae]);const vt=m?Zi.Edit:!h.mh||ht||ve&&!Ue.length||R?n?Zi.Schedule:Zi.Send:Zi.Record,It=!n,{isMentionTooltipOpen:yt,closeMentionTooltip:wt,insertMention:Zt,mentionFilteredUsers:Pt}=(0,Ds.Z)(!Ue.length,ye,Ie,void 0,x,L,U),{isOpen:Ct,id:St,isGallery:bt,switchPm:Et,results:Rt,closeTooltip:kt,help:Nt,loadMore:Tt}=function(e,t,n,s){const{queryInlineBot:o,resetInlineBot:r}=(0,a.Sv)(),[c,l,d]=(0,Ge.Z)(),{username:u,query:m,canShowHelp:h,usernameLowered:g}=qs((()=>function(e){const t=function(e){return Hs.innerHTML=e.replace(/<br>/g,"\n"),Hs.innerText}(e),n=t.match(js);return n?{username:n[1],query:n[2],canShowHelp:""===n[2]&&!t.match(Gs),usernameLowered:n[1].toLowerCase()}:_s}(n)),300,[n])||{},p=(0,Bt.Z)(m),f=(0,Bt.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)((()=>{p!==m&&d()}),[p,m,d]),(0,i.d4)((()=>{e&&g&&t&&o({chatId:t,username:g,query:m})}),[m,e,o,t,g]);const S=(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]),f!==u&&r({username:f}),{isOpen:c,id:I,isGallery:P,switchPm:y,results:Z,closeTooltip:d,help:h&&C?`@${u} ${C}`:void 0,loadMore:S}}(Boolean(!Ue.length&&F),g,ve,_),{isOpen:At,close:xt,filteredBotCommands:Lt}=function(e,t,n,a){const[s,o,r]=(0,Ge.Z)(),[c,l]=(0,i.eJ)(),d=(0,i.I4)((e=>{n||a?zs((()=>{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,bs._)(t.substr(1)).match(Vs);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),ve,z,V),{isContextMenuOpen:Ot,handleContextMenu:Ut,handleContextMenuClose:Ft,handleContextMenuHide:$t}=(0,Nn.Z)(pt,!(vt===Zi.Send&&It)),{canSendStickers:Dt,canSendGifs:qt,canAttachMedia:jt,canAttachPolls:Gt,canAttachEmbedLinks:_t}=(0,i.Ye)((()=>(0,d.H5)(w,P)),[w,P]),Ht=w&&(0,d.Nl)(w),zt=(0,d.Hd)(w),{isStickerTooltipOpen:Vt,closeStickerTooltip:Xt}=function(e,t,n){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const o=(0,i.Ye)((()=>(0,bs._)(t).trim()),[t]),{loadStickersForEmoji:r,clearStickersForEmoji:c}=(0,a.Sv)(),l=h.op&&1===(0,Ss.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(D&&Dt&&!Ue.length),ve,B,!c),{isEmojiTooltipOpen:Kt,closeEmojiTooltip:Wt,filteredEmojis:Yt,insertEmoji:Jt}=(0,$s.Z)(Boolean(D&&Dt&&!Ue.length),ye,G,void 0,Ie,q,j,!c),Qt=(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,ln.Z)(e,["escape_html","emoji_html","br_html"]).join("").replace(/\u200b+/g,"");if(n.rangeCount){const e=n.getRangeAt(0);if((0,Zs.R)(e,t))return ws(i),void a.dispatchEvent(new Event("input",{bubbles:!0}))}Ie(`${ye.current}${i}`),requestAnimationFrame((()=>{(0,fs.Z)(a)}))}),[ye]),en=(0,i.I4)((()=>{const e=window.getSelection();if(e.rangeCount){const t=e.getRangeAt(0);if((0,Zs.R)(t,s.R2))return void document.execCommand("delete",!1)}Ie(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}(ye.current))}),[ye]),tn=(0,i.I4)((function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e||Ie(""),Fe(l.D),Xt(),wt(),Wt(),h.wB?setTimeout((()=>We()),350):We()}),[Xt,wt,Wt,We]),nn=(0,i.sO)();nn.current=ut,(0,i.d4)((()=>()=>{nn.current(),tn()}),[g,tn,nn]);const[an,sn]=((e,t,n,o,r,c,l,u,m,h)=>{const{editMessage:g,setEditingDraft:p}=(0,a.Sv)();(0,In.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,fs.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;p({chatId:c,threadId:l,type:u,text:n})}}),[c,n,e,p,l,u]);const f=(0,i.I4)((()=>{m&&(0,M.T2)((()=>{t((0,Pa.z)(m));const e=document.querySelector(s.Ed);e&&requestAnimationFrame((()=>{(0,fs.Z)(e,!0)}))}))}),[m,t]),I=(0,i.I4)((()=>{o(),f()}),[o,f]),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(),f()):r())}),[g,n,e,r,o,f]),w=(0,i.I4)((()=>{if(!n)return;const t=(0,v.Z)(e.current),a=t.text.length?t:void 0;p({chatId:c,threadId:l,type:u,text:a})}),[c,n,e,p,l,u]);return(0,Me.Z)(w),Re(w),[y,I]})(ye,Ie,m,tn,nt,g,f,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,M.Ds)((e=>e()),s.r_,!1)),[t]),g=(0,Bt.Z)(t),p=(0,Bt.Z)(n);(0,i.d4)((()=>(Us=t,Fs=n,()=>{Us=void 0,Fs=void 0,u(t,n)})),[t,n,u]),(0,i.d4)((()=>{t===g&&n===p||!c&&e&&(r((0,Pa.z)(e)),h.$b||requestAnimationFrame((()=>{const e=document.querySelector(s.Ed);e&&(0,fs.Z)(e,!0)})))}),[t,n,e,r,u,g,p,c]);const f=o.current,I=(0,Bt.Z)(f);(0,i.d4)((()=>{t&&n&&g===t&&p===n&&I!==f&&(f.length?m((()=>{Us===t&&Fs===n&&u(t,n)})):u(t,n))}),[t,f,g,I,p,m,n,u]);const y=(0,i.I4)((()=>{t&&n&&u(t,n)}),[t,n,u]);(0,Me.Z)(y),Re(y)})(y,g,f,ye,Ie,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,Ls.Z)(r)),0!==c.length||o){if(c.length>0&&!n){const e=await Promise.all(c.map((e=>ys(e.name,e,1===c.length&&Os.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])})(Qt,Fe,m);const on=(0,i.I4)((()=>{m&&sn()}),[m,sn]),rn=(0,i.I4)((async(e,t)=>{Fe(await Promise.all(e.map((e=>ys(e.name,e,t)))))}),[]),cn=(0,i.I4)((async(e,t)=>{Fe([...Ue,...await Promise.all(e.map((e=>ys(e.name,e,t))))])}),[Ue]),dn=(0,i.I4)((()=>{Fe(l.D)}),[]),un=(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(ht){const e=await ut();if(e){const{blob:t,duration:a,waveform:s}=e;n=[await ys(Pi,t,!1,{voice:{duration:a,waveform:s}})]}}const{text:i,entities:o}=(0,v.Z)(ye.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(zt&&!Ht){const e=(0,p.b)(r),t=we.current&&Math.floor(e-we.current),n=zt.nextSendDate&&zt.nextSendDate>e;if(t&&t<zt.seconds||n){const a=n?zt.nextSendDate-e:zt.seconds-t;return te({data:{message:pe("SlowModeHint",(0,O.k9)(a)),isSlowMode:!0,hasErrorKey:!1}}),void(null==l||l.blur())}}Q({text:i,entities:o,attachments:n,scheduledAt:t,isSilent:e})}R&&se({scheduledAt:t,isSilent:e}),we.current=(0,p.b)(r),ee({chatId:g,localOnly:!0}),h.cj&&l&&l===document.activeElement&&Cs(l),requestAnimationFrame((()=>{tn()}))}),[Z,Ue,ht,R,ee,g,tn,ut,te,zt,Ht,Q,se,pe,ye]),hn=(0,i.I4)((()=>{We(),ze()}),[We,ze]),gn=(0,i.I4)((()=>{Ve(),et(),Ke()}),[Ve,et,Ke]),pn=(0,i.I4)(((e,t)=>{if(e&&"queryId"in e){const{id:n,queryId:a,isSilent:s}=e;return void ue({id:n,queryId:a,scheduledAt:t,isSilent:s})}const{isSilent:n,...a}=e||{};e&&0!==Object.keys(a).length?Q({...e,scheduledAt:t}):un(Boolean(n),t)}),[un,ue,Q]);(0,i.d4)((()=>{$&&xe((e=>{pn($,e)}))}),[$,pn,xe]),(0,i.d4)((()=>{J&&(Ie(J),ge(),requestAnimationFrame((()=>{const e=document.getElementById(s.R2);(0,fs.Z)(e,!0)})))}),[J,ge]);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?(Ne(),xe((n=>{Te(),pn({sticker:e,isSilent:t},n),requestAnimationFrame((()=>{tn(s)}))}))):(Q({sticker:e,isSilent:t}),requestAnimationFrame((()=>{tn(s)})))}),[n,Ne,xe,Te,pn,tn,Q]),vn=(0,i.I4)(((e,t,a)=>{n||a?(Ne(),xe((n=>{Te(),pn({gif:e,isSilent:t},n),requestAnimationFrame((()=>{tn(!0)}))}))):(Q({gif:e,isSilent:t}),requestAnimationFrame((()=>{tn(!0)})))}),[n,Ne,xe,Te,pn,tn,Q]),yn=(0,i.I4)(((e,t,a)=>{if("connectionStateReady"!==Z)return;n||a?xe((n=>{pn({id:e.id,queryId:e.queryId,isSilent:t},n)})):ue({id:e.id,queryId:e.queryId,isSilent:t});const i=document.querySelector(s.Ed);h.cj&&i&&i===document.activeElement&&Cs(i),ee({chatId:g,localOnly:!0}),requestAnimationFrame((()=>{tn()}))}),[g,ee,Z,pn,xe,tn,ue,n]),wn=(0,i.I4)((()=>{ee({chatId:g,localOnly:!0}),requestAnimationFrame((()=>{tn()}))}),[g,ee,tn]),Zn=(0,i.I4)((e=>{n?(xe((t=>{pn({poll:e},t)})),re()):(Q({poll:e}),re())}),[re,pn,xe,Q,n]),Pn=(0,i.I4)((()=>{n?xe((e=>{pn({isSilent:!0},e)})):un(!0)}),[pn,un,xe,n]),Cn=(0,i.I4)((e=>{"stickers"===e?(ne({query:""}),ae({query:void 0})):(ae({query:""}),ne({query:void 0}))}),[ne,ae]),Sn=(0,i.I4)((()=>{const e=document.querySelector(s.Ed);h.wB&&e===document.activeElement?(null==e||e.blur(),setTimeout((()=>{Ve(),Ke()}),100)):Ke()}),[Ke,Ve]),En=(0,i.I4)((()=>{const e=document.querySelector(s.Ed);if(!h.wB||e!==document.activeElement)return Ve(),We(),void Je();null==e||e.blur(),setTimeout((()=>{Ve(),We(),Je()}),100)}),[Ve,We,Je]),Mn=(0,i.I4)((()=>{le({id:g,threadId:f,type:"scheduled"})}),[le,g,f]);(0,i.d4)((()=>{b&&h.wB&&We()}),[b,We]),(0,i.d4)((()=>{c&&(E?ct():setTimeout((()=>{lt()}),200))}),[E,lt,ct,c]);const Rn=(0,i.I4)((()=>{switch(vt){case Zi.Send:un();break;case Zi.Record:dt();break;case Zi.Edit:an();break;case Zi.Schedule:ht&&mt(),xe((e=>{pn({},e)}))}}),[vt,un,dt,an,ht,xe,mt,pn]),kn=vt===Zi.Record&&!jt,Tn=(0,Bt.Z)(m,!0),An=m||Tn,Bn=new Date;Bn.setSeconds(0),Bn.setMilliseconds(0);const xn=new Date;xn.setFullYear(xn.getFullYear()+1);let Ln="SendMessage";switch(vt){case Zi.Edit:Ln="Save edited message";break;case Zi.Record:Ln=kn?"Conversation.DefaultRestrictedMedia":"AccDescrVoiceMessage"}const On=(0,Pe.Z)("Composer",!E&&"shown",rt&&"hover-disabled"),Un=(0,Pe.Z)("mobile-symbol-menu-button",!c&&"not-ready",it?Xe&&"menu-opened":Xe&&"is-loading"),Fn=(0,i.I4)((()=>{xe((e=>{pn({},e)}))}),[pn,xe]),$n=vt===Zi.Edit?an:vt===Zi.Schedule?Fn:un;return i.ZP.createElement("div",{className:On},jt&&c&&i.ZP.createElement(vi,{isOpen:t!==Mt.t.None,withQuick:t===Mt.t.QuickFile||Ze===Mt.t.QuickFile,onHide:u,onFileSelect:rn}),i.ZP.createElement(gi,{chatId:g,threadId:f,canShowCustomSendMenu:It,attachments:Ue,caption:Ue.length?ve:"",groupChatMembers:x,currentUserId:U,recentEmojis:G,isReady:c,isChatWithSelf:C,onCaptionUpdate:Ie,baseEmojiKeywords:q,emojiKeywords:j,addRecentEmoji:de,shouldSchedule:n,onSendSilent:Pn,onSend:un,onSendScheduled:Fn,onFileAppend:cn,onClear:dn}),i.ZP.createElement(fi,{isOpen:k.isOpen,isQuiz:k.isQuiz,shouldBeAnonimous:S,onClear:re,onSend:Zn}),An&&i.ZP.createElement(Ks,{isOpen:tt,isSchedule:"scheduled"===I,onClose:at,message:An}),i.ZP.createElement(wi,{isOpen:Ye,onClose:et,chatId:g,selectedSendAsId:W,sendAsIds:Se}),i.ZP.createElement(ii,{isOpen:yt,onClose:wt,onInsertUserName:Zt,filteredUsers:Pt}),i.ZP.createElement(si,{isOpen:Ct,botId:St,isGallery:bt,inlineBotResults:Rt,switchPm:Et,onSelectResult:yn,loadMore:Tt,onClose:kt,isSavedMessages:C,canSendGifs:qt}),i.ZP.createElement(li,{isOpen:At,withUsername:Boolean(V),botCommands:Lt,onClick:wn,onClose:xt}),i.ZP.createElement("div",{id:"message-compose"},i.ZP.createElement("div",{className:"svg-appendix",ref:fe}),i.ZP.createElement(hi,{onClear:on}),i.ZP.createElement(yi,{chatId:g,threadId:f,messageText:Ue.length?"":ve,disabled:!_t}),i.ZP.createElement("div",{className:"message-input-wrapper"},P&&!1!==z&&!ht&&!m&&i.ZP.createElement(Qs,{className:(0,Pe.Z)("bot-commands",_e&&"activated"),round:!0,disabled:void 0===z,color:"translucent",onActivate:hn,ariaLabel:"Open bot command keyboard"},i.ZP.createElement("i",{className:"icon-bot-commands-filled"})),be&&(X||K)&&i.ZP.createElement(Qe.Z,{round:!0,color:"translucent",onClick:Ye?et:En,ariaLabel:pe("SendMessageAsTitle"),className:(0,Pe.Z)("send-as-button",Oe.current&&"appear-animation")},i.ZP.createElement(mn.Z,{user:X,chat:K,size:"tiny"})),h.wB?i.ZP.createElement(Qe.Z,{className:Un,round:!0,color:"translucent",onClick:Xe?We:Sn,ariaLabel:"Choose emoji, sticker or GIF"},i.ZP.createElement("i",{className:"icon-smile"}),i.ZP.createElement("i",{className:"icon-keyboard"}),Xe&&!it&&i.ZP.createElement(st.Z,{color:"gray"})):i.ZP.createElement(Qs,{className:Xe?"activated":"",round:!0,color:"translucent",onActivate:gn,ariaLabel:"Choose emoji, sticker or GIF"},i.ZP.createElement("i",{className:"icon-smile"})),i.ZP.createElement(ui.Z,{id:"message-input-text",chatId:g,threadId:f,html:Ue.length?"":ve,placeholder:ht&&Ce<=600?"":T||pe("Message"),forcedPlaceholder:Nt,canAutoFocus:c&&!Ue.length,shouldSuppressFocus:h.wB&&Xe,shouldSuppressTextFormatter:Kt||yt||Ct,onUpdate:Ie,onSend:$n,onSuppressedFocus:We}),H&&Boolean(St)&&i.ZP.createElement(st.Z,{color:"gray"}),A&&i.ZP.createElement(Qe.Z,{round:!0,faded:!0,className:"scheduled-button",color:"translucent",onClick:Mn,ariaLabel:"Open scheduled messages"},i.ZP.createElement("i",{className:"icon-schedule"})),N&&!ht&&!m&&i.ZP.createElement(Qs,{className:$e?"activated":"",round:!0,color:"translucent",onActivate:qe,ariaLabel:"Open bot command keyboard"},i.ZP.createElement("i",{className:"icon-bot-command"})),ht&>&&i.ZP.createElement("span",{className:"recording-state"},(0,O.rM)(gt-ft.current)),i.ZP.createElement(ri,{chatId:g,threadId:f,isOpen:Vt,onStickerSelect:fn}),i.ZP.createElement(ci.Z,{isOpen:Kt,emojis:Yt,onClose:Wt,onEmojiSelect:Jt,addRecentEmoji:de}),i.ZP.createElement(ni,{isButtonVisible:!ht&&!m,canAttachMedia:jt,canAttachPolls:Gt,onFileSelect:rn,onPollCreate:oe}),N&&i.ZP.createElement(di,{messageId:N,isOpen:$e,onClose:je}),z&&i.ZP.createElement(pi,{isOpen:_e,botCommands:z,onClose:Ve}),i.ZP.createElement(ai,{chatId:g,threadId:f,isOpen:Xe||Ee,canSendGifs:qt,canSendStickers:Dt,onLoad:ot,onClose:We,onEmojiSelect:Qt,onStickerSelect:fn,onGifSelect:vn,onRemoveSymbol:en,onSearchOpen:Cn,addRecentEmoji:de}))),ht&&i.ZP.createElement(Qe.Z,{round:!0,color:"danger",className:"cancel",onClick:ut,ariaLabel:"Cancel voice recording"},i.ZP.createElement("i",{className:"icon-delete"})),i.ZP.createElement(Qe.Z,{ref:pt,round:!0,color:"secondary",className:(0,Pe.Z)(vt,!c&&"not-ready",ht&&"recording"),disabled:kn,ariaLabel:pe(Ln),onClick:Rn,onContextMenu:vt===Zi.Send&&It?Ut: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"})),It&&i.ZP.createElement(oi.Z,{isOpen:Ot,onSendSilent:C?void 0:Pn,onSendSchedule:n?void 0:Fn,onClose:Ft,onCloseAnimationEnd:$t,isSavedMessages:C}),Le)}))),Si=(0,i.X$)((e=>{const{isActive:t}=e,n=(0,mt.Z)(ut.gl.Extra,"MobileSearch",!t,!0);return n?i.ZP.createElement(n,e):void 0})),bi=(0,i.X$)((e=>{const{isActive:t}=e,n=(0,mt.Z)(ut.gl.Extra,"MessageSelectToolbar",!t);return n?i.ZP.createElement(n,e):void 0})),Ei=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,mt.Z)(ut.gl.Extra,"UnpinAllMessagesModal",!t);return n?i.ZP.createElement(n,e):void 0})),Mi=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,mt.Z)(ut.gl.Extra,"PaymentModal",!t);return n?i.ZP.createElement(n,e):void 0})),Ri=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,mt.Z)(ut.gl.Extra,"ReceiptModal",!t);return n?i.ZP.createElement(n,e):void 0})),ki=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,mt.Z)(ut.gl.Extra,"SeenByModal",!t);return n?i.ZP.createElement(n,e):void 0})),Ni=(0,i.X$)((e=>{const{activeEmojiInteraction:t}=e,n=(0,mt.Z)(ut.gl.Extra,"EmojiInteractionAnimation",!t);return n?i.ZP.createElement(n,e):void 0})),Ti=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,mt.Z)(ut.gl.Extra,"ReactorListModal",!t);return n?i.ZP.createElement(n,e):void 0})),Ai=h.wB?450+s.fK:void 0;function Bi(e){return"file"===e.kind&&e.type&&s.oG.has(e.type)}const xi=(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:p}=e,f={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:p};if(!l||!m.active)return f;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:S,messageId:b}=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{...f,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(S&&b),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:p,pinnedMessagesCount:f,customBackground:v,theme:I,backgroundColor:y,patternColor:w,isLeftColumnShown:Z,isRightColumnShown:P,isBackgroundBlurred:C,isMobileSearchActive:S,isSelectModeActive:b,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:$}=e;const{openChat:D,unpinAllMessages:q,loadUser:j,loadChatSettings:G,closeLocalTextSearch:_,exitMessageSelectMode:H,closePaymentModal:z,clearReceipt:V,joinChannel:X,sendBotCommand:K,restartBot:W}=(0,a.Sv)(),{width:Y}=Tt(),J=(0,He.Z)(),[Q,ee]=(0,i.eJ)(Mt.t.None),[te,ie]=(0,i.eJ)(),[oe,re]=(0,i.eJ)(),[ce,le]=(0,i.eJ)(!1),de=p&&(Y<s.l3||P&&Y>s._m&&Y<s.QU||Y>=s.ks&&Y<s.jT),ue=(0,At.Z)(t,Ai),me=(0,At.Z)(n,Ai),he=(0,At.Z)(o,Ai),ge=(0,At.Z)(L,Ai),pe=(0,At.Z)(O,Ai),fe=(0,At.Z)(U,Ai),ve=(0,At.Z)(u,Ai)&&!fe&&!pe&&!ge,Ie=(0,At.Z)(de,Ai),ye=(0,At.Z)(te,Ai),we=(0,At.Z)(B,Ai),Ze=(0,Bt.Z)(A),Ce=void 0!==Ze&&Ze<A?Ze:void 0,{isReady:Se,handleOpenEnd:be,handleSlideStop:Ee}=function(e,t,n,a){const[s,o]=(0,i.eJ)(!h.wB),r=(0,xt.Z)(),c=void 0!==n&&n!==t;return c&&(e?o(!1):r()),(0,ke.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,Ze,t);(0,i.d4)((()=>t?(0,De.Z)((()=>{D({id:void 0})})):void 0),[t,D]),(0,ke.Z)((()=>{ee(Mt.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&&$&&G({chatId:t})}),[t,r,x,$,G]);const Me=(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(Bi);ee(n?Mt.t.QuickFile:Mt.t.Document)}),[]),Re=(0,i.I4)((()=>{ee(Mt.t.None)}),[]),Ne=(0,i.I4)((()=>{le(!0)}),[]),Te=(0,i.I4)((()=>{le(!1)}),[]),Ae=(0,i.I4)((()=>{q({chatId:t}),Te(),D({id:t})}),[q,D,Te,t]),Be=(0,i.I4)((()=>{D({id:t})}),[D,t]),Le=(0,i.I4)((()=>{X({chatId:t})}),[X,t]),Oe=(0,i.I4)((()=>{K({command:"/start"})}),[K]),Ue=(0,i.I4)((()=>{W({chatId:t})}),[t,W]),Fe=((e,t)=>{const[n,a]=(0,i.eJ)(t);return(0,i.d4)((()=>{t&&(t.startsWith("#")?a(t):kt.fetch(s.fo,e,kt.Type.Blob).then((e=>{const t=URL.createObjectURL(e);(0,Nt.pt)(t).then((()=>{a(`url(${t})`)}))})))}),[t,e]),t?n:void 0})(I,v),$e=(0,Pe.Z)(Ie&&"has-header-tools",v&&"custom-bg-image",y&&"custom-bg-color",v&&C&&"blurred",h.aZ?"mask-image-disabled":"mask-image-enabled"),qe=(0,Pe.Z)("messaging-disabled",!b&&"shown"),je=(0,d.q8)(J,m,g),{composerHiddenScale:Ge,toolbarHiddenScale:ze,composerTranslateX:Ve,toolbarTranslateX:Xe,unpinHiddenScale:Ke,toolbarForUnpinHiddenScale:We}=(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,se),ae),n=Math.min(.25*e,ae);return Math.min(e-t-n,ne)}if(e>s.ks){const t=Math.min(Math.max(.4*e,se),ae);return Math.min(e-t,ne)}return e>ne?ne: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}}(Y,ve)),[ve,Y]),Ye=(0,Pe.Z)("middle-column-footer",!ve&&"no-composer",ve&&oe&&!b&&"with-notch");(0,xe.ZP)(ue&&me,(()=>{D({id:void 0},{forceSyncOnIOs:!0})}),void 0,void 0,void 0,(null==l?void 0:l.map(Rt.q))||[]),(0,xe.ZP)(S,_),(0,xe.ZP)(b,H);const Je=Boolean(!c&&!ve&&!fe&&!pe&&!ge&&je),et=Boolean(fe||ge||pe||c),tt=Boolean(Je||b||c);return i.ZP.createElement("div",{id:"MiddleColumn",className:$e,onTransitionEnd:be,style:`\n --composer-hidden-scale: ${Ge};\n --toolbar-hidden-scale: ${ze};\n --unpin-hidden-scale: ${Ke};\n --toolbar-unpin-hidden-scale: ${We};\n --composer-translate-x: ${Ve}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?Be:void 0},i.ZP.createElement("div",{id:"middle-column-bg",style:Fe?`--custom-background: ${Fe}`: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:ve?Me:void 0},i.ZP.createElement(fn,{chatId:ue,threadId:me,messageListType:he,isReady:Se}),i.ZP.createElement(_e.Z,{name:T?"none":N===s.zy?"slide":"fade",activeKey:A,shouldCleanup:!0,cleanupExceptionKey:Ce,onStop:Ee},i.ZP.createElement(gs,{key:`${ue}-${me}-${he}`,chatId:ue,threadId:me,type:he,canPost:ve,hasTools:Ie,onFabToggle:ie,onNotchToggle:re,isReady:Se,withBottomShift:et}),i.ZP.createElement("div",{className:Ye},ve&&i.ZP.createElement(Ci,{chatId:ue,threadId:me,messageListType:he,dropAreaState:Q,onDropHide:Re,isReady:Se}),c&&i.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:J.isRtl?"rtl":void 0},i.ZP.createElement(Qe.Z,{size:"tiny",fluid:!0,color:"secondary",className:"unpin-all-button",onClick:Ne},i.ZP.createElement("i",{className:"icon-unpin"}),i.ZP.createElement("span",null,J("Chat.Pinned.UnpinAll",f,"i")))),Je&&i.ZP.createElement("div",{className:qe},i.ZP.createElement("div",{className:"messaging-disabled-inner"},i.ZP.createElement("span",null,je))),h.wB&&ge&&i.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:J.isRtl?"rtl":void 0},i.ZP.createElement(Qe.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:Le},J(we?"ProfileJoinChannel":"ProfileJoinGroup"))),h.wB&&pe&&i.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:J.isRtl?"rtl":void 0},i.ZP.createElement(Qe.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:Oe},J("BotStart"))),h.wB&&fe&&i.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:J.isRtl?"rtl":void 0},i.ZP.createElement(Qe.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:Ue},J("BotRestart"))),i.ZP.createElement(bi,{messageListType:he,isActive:b,canPost:ve}),i.ZP.createElement(Mi,{isOpen:Boolean(E),onClose:z}),i.ZP.createElement(Ri,{isOpen:Boolean(M),onClose:V}),i.ZP.createElement(ki,{isOpen:R}),i.ZP.createElement(Ti,{isOpen:k}))),i.ZP.createElement(ps,{isShown:ye,canPost:ve,withExtraShift:tt})),h.wB&&i.ZP.createElement(Si,{isActive:Boolean(S)})),t&&i.ZP.createElement(Ei,{isOpen:ce,chatId:t,pinnedMessagesCount:f,onClose:Te,onUnpin:Ae}),i.ZP.createElement("div",{teactFastList:!0},null==F?void 0:F.map(((e,t)=>i.ZP.createElement(Ni,{teactOrderKey:t,key:e.id,activeEmojiInteraction:e})))))}))),Li=(0,M.Ds)((e=>e()),200,!1);var Oi;!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"}(Oi||(Oi={}));const Ui=(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,p=g&&(0,d.eA)(g),f=r&&o&&(0,d.YC)(o)?(0,c.dy)(e,o):void 0,v=f&&(0,d.kw)(f),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:p,userId:null==f?void 0:f.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:p,profileState:f,managementScreen:v,canAddContact:I,userId:y,canManage:w,isChannel:Z,onClose:P,onScreenSelect:C,messageSearchQuery:S,stickerSearchQuery:b,gifSearchQuery:E,shouldSkipAnimation:M,isEditingInvite:R,canViewStatistics:k,currentInviteInfo:N}=e;const{setLocalTextSearchQuery:T,setStickerSearchQuery:A,setGifSearchQuery:B,searchTextMessagesLocal:x,toggleManagement:L,openHistoryCalendar:U,openAddContactDialog:F,toggleStatistics:$,setEditingExportedInvite:D,deleteExportedChatInvite:q}=(0,a.Sv)(),j=(0,i.sO)(null),[G,_,H]=(0,Ge.Z)(),z=(0,i.I4)((()=>{D({chatId:n,invite:N}),C(m.u1.EditInvite)}),[n,N,C,D]),V=(0,i.I4)((()=>{q({chatId:n,link:N.link}),C(m.u1.Invites),H()}),[n,H,N,q,C]),X=(0,i.I4)((e=>{T({query:e}),e.length&&Li(x)}),[x,T]),K=(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,He.Z)(),te=o?f===m.vi.Profile?Oi.Profile:f===m.vi.SharedMedia?Oi.SharedMedia:f===m.vi.MemberList?Oi.MemberList:-1:r?Oi.Search:g?Oi.PollResults:d?Oi.StickerSearch:u?Oi.GifSearch:p?Oi.AddingMembers:c?v===m.u1.Initial?Oi.ManageInitial:v===m.u1.ChatPrivacyType?Oi.ManageChatPrivacyType:v===m.u1.Discussion?Oi.ManageDiscussion:v===m.u1.ChannelSubscribers?Oi.ManageChannelSubscribers:v===m.u1.GroupPermissions?Oi.ManageGroupPermissions:v===m.u1.ChatAdministrators?Oi.ManageChatAdministrators:v===m.u1.GroupRemovedUsers?Oi.ManageGroupRemovedUsers:v===m.u1.ChannelRemovedUsers?Oi.ManageChannelRemovedUsers:v===m.u1.GroupUserPermissionsCreate?Oi.ManageGroupUserPermissionsCreate:v===m.u1.GroupUserPermissions?Oi.ManageGroupUserPermissions:v===m.u1.GroupRecentActions?Oi.ManageGroupRecentActions:v===m.u1.ChatAdminRights?Oi.ManageGroupAdminRights:v===m.u1.ChatNewAdminRights?Oi.ManageGroupNewAdminRights:v===m.u1.GroupMembers?Oi.ManageGroupMembers:v===m.u1.Invites?Oi.ManageInvites:v===m.u1.EditInvite?Oi.ManageEditInvite:v===m.u1.GroupAddAdmins?Oi.ManageGroupAddAdmins:v===m.u1.Reactions?Oi.ManageReactions:v===m.u1.InviteInfo?Oi.ManageInviteInfo:v===m.u1.JoinRequests?Oi.ManageJoinRequests:void 0:l?Oi.Statistics:void 0,ne=null!==(t=(0,Ut.Z)(te,!0))&&void 0!==t?t:-1,ae=h.wB||te===Oi.SharedMedia||te===Oi.MemberList||te===Oi.AddingMembers||c,se=(0,Pe.Z)("animated-close-icon",ae&&"state-back",(J||M)&&"no-transition");return i.ZP.createElement("div",{className:"RightHeader"},i.ZP.createElement(Qe.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(_e.Z,{name:J||M?"none":"slide-fade",activeKey:ne},function(){if(-1!==ne)switch(ne){case Oi.PollResults:return i.ZP.createElement("h3",null,ee("PollResults"));case Oi.Search:return i.ZP.createElement(i.ZP.Fragment,null,i.ZP.createElement(et.Z,{parentContainerClassName:"RightSearch",value:S,onChange:X}),i.ZP.createElement(Qe.Z,{round:!0,size:"smaller",color:"translucent",onClick:()=>U({selectedAt:(0,O._F)(Date.now())}),ariaLabel:"Search messages by date"},i.ZP.createElement("i",{className:"icon-calendar"})));case Oi.AddingMembers:return i.ZP.createElement("h3",null,ee(Z?"ChannelAddSubscribers":"GroupAddMembers"));case Oi.ManageInitial:return i.ZP.createElement("h3",null,ee("Edit"));case Oi.ManageChatPrivacyType:return i.ZP.createElement("h3",null,ee(Z?"ChannelTypeHeader":"GroupTypeHeader"));case Oi.ManageDiscussion:return i.ZP.createElement("h3",null,ee("Discussion"));case Oi.ManageChatAdministrators:return i.ZP.createElement("h3",null,ee("ChannelAdministrators"));case Oi.ManageGroupRecentActions:return i.ZP.createElement("h3",null,ee("Group.Info.AdminLog"));case Oi.ManageGroupAdminRights:return i.ZP.createElement("h3",null,ee("EditAdminRights"));case Oi.ManageGroupNewAdminRights:return i.ZP.createElement("h3",null,ee("SetAsAdmin"));case Oi.ManageGroupPermissions:return i.ZP.createElement("h3",null,ee("ChannelPermissions"));case Oi.ManageGroupRemovedUsers:return i.ZP.createElement("h3",null,ee("BlockedUsers"));case Oi.ManageChannelRemovedUsers:return i.ZP.createElement("h3",null,ee("ChannelBlockedUsers"));case Oi.ManageGroupUserPermissionsCreate:return i.ZP.createElement("h3",null,ee("ChannelAddException"));case Oi.ManageGroupUserPermissions:return i.ZP.createElement("h3",null,ee("UserRestrictions"));case Oi.ManageInvites:return i.ZP.createElement("h3",null,ee("lng_group_invite_title"));case Oi.ManageEditInvite:return i.ZP.createElement("h3",null,ee(R?"EditLink":"NewLink"));case Oi.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(Qe.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(Qe.Z,{round:!0,color:"danger",size:"smaller",ariaLabel:ee("Delete"),onClick:_},i.ZP.createElement("i",{className:"icon-delete"})),i.ZP.createElement(zt.Z,{isOpen:G,onClose:H,title:ee("DeleteLink"),text:ee("DeleteLinkHelp"),confirmIsDestructive:!0,confirmLabel:ee("Delete"),confirmHandler:V}))));case Oi.ManageJoinRequests:return i.ZP.createElement("h3",null,ee(Z?"SubscribeRequests":"MemberRequests"));case Oi.ManageGroupAddAdmins:return i.ZP.createElement("h3",null,ee("Channel.Management.AddModerator"));case Oi.StickerSearch:return i.ZP.createElement(et.Z,{value:b,placeholder:ee("SearchStickersHint"),autoFocusSearch:!0,onChange:K});case Oi.GifSearch:return i.ZP.createElement(et.Z,{value:E,placeholder:ee("SearchGifsTitle"),autoFocusSearch:!0,onChange:W});case Oi.Statistics:return i.ZP.createElement("h3",null,ee(Z?"ChannelStats.Title":"GroupStats.Title"));case Oi.SharedMedia:return i.ZP.createElement("h3",null,ee("SharedMedia"));case Oi.ManageChannelSubscribers:return i.ZP.createElement("h3",null,ee("ChannelSubscribers"));case Oi.MemberList:case Oi.ManageGroupMembers:return i.ZP.createElement("h3",null,ee("GroupMembers"));case Oi.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(Qe.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:ee("AddContact"),onClick:Y},i.ZP.createElement("i",{className:"icon-add-user"})),w&&i.ZP.createElement(Qe.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:ee("Edit"),onClick:L},i.ZP.createElement("i",{className:"icon-edit"})),k&&i.ZP.createElement(Qe.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:ee("Statistics"),onClick:$},i.ZP.createElement("i",{className:"icon-stats"}))))}}()))})));var Fi=n(91);var $i=n(7407);function Di(e,t,n,a){const[i,o]=(0,$i.Z)(n?t:void 0,a,void 0,s.Vk);return[i,o,!(!i||!a||i[0]===a[0])]}function qi(e,t,n,a,o,r){const c=(0,i.sO)();(0,ke.Z)((()=>{t===e&&o&&r&&(c.current=(0,d.R5)(o,r,e))}),[o,r,t,e]);const[l,u]=(0,$i.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 ji=(0,M.P2)((e=>e()),250,!1);let Gi=!1;var _i=n(1273),Hi=n(1876),zi=n(787),Vi=n(180),Xi=n(3709),Ki=n(5418),Wi=n(7262),Yi=n(1151),Ji=n(2275);const Qi=[{type:"media",title:"SharedMediaTab2"},{type:"documents",title:"SharedFilesTab2"},{type:"links",title:"SharedLinksTab2"},{type:"audio",title:"SharedMusicTab2"},{type:"voice",title:"SharedVoiceTab2"}];function eo(e){return[`.shared-media-transition > div:only-child > .${e}-list > .scroll-item`,`.shared-media-transition > .Transition__slide--active > .${e}-list > .scroll-item`].join(", ")}const to=(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,p=i&&(0,d.Bf)(i),f=i&&(0,d.eA)(i),v=p||f&&(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,S,b;return(0,d.YC)(s)&&(S=s,b=(0,c.dy)(e,S),C=b&&!b.isSelf&&!(0,d.cS)(b)),{theme:(0,c.Pu)(e),isChannel:f,resolvedUserId:S,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&&b&&{commonChatIds:null===(a=b.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:p,foundIds:f,mediaSearchType:v,hasCommonChatsTab:I,hasMembersTab:y,areMembersHidden:w,canAddMembers:Z,canDeleteMembers:P,commonChatIds:C,members:S,usersById:b,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:$,openAudioPlayer:D,focusMessage:q,loadProfilePhotos:j,setNewChatMembersDialogState:G}=(0,a.Sv)(),_=(0,i.sO)(null),H=(0,i.sO)(null),z=(0,He.Z)(),[V,X]=(0,i.eJ)(0),[K,W]=(0,i.eJ)(),Y=(0,i.Ye)((()=>[...y?[{type:"members",title:l?"ChannelSubscribers":"GroupMembers"}]:[],...Qi,...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,p,f){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]=Di(0,t,f,y),[S,b,E]=qi("media",I,a,f,h,g),[M,R,k]=qi("documents",I,a,f,h,g),[N,T,A]=qi("links",I,a,f,h,g),[B,x,L]=qi("audio",I,a,f,h,g),[O,U,F]=qi("voice",I,a,f,h,g),[$,D,q]=Di(0,n,f,w);let j,G,_=!1;switch(I){case"members":j=Z,G=P,_=C;break;case"commonChats":j=$,G=D,_=q;break;case"media":j=S,G=b,_=E;break;case"documents":j=M,G=R,_=k;break;case"links":j=N,G=T,_=A;break;case"audio":j=B,G=x,_=L;break;case"voice":j=O,G=U,_=F}return[I,j,G,_]}(R,L,O,F,J,v,S,C,b,E,M,p,f,t,N,A),ae=Y.findIndex((e=>{let{type:t}=e;return t===Q})),{handleScroll:se}=function(e,t,n,a){(0,In.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),Gi=!0,(0,Sn.Z)(n,s,"start",void 0,void 0,void 0,300),setTimeout((()=>{Gi=!1}),350))}}),[t,a]),(0,In.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||(Gi=!0,(0,Sn.Z)(i,i.firstElementChild,"start",void 0,2*i.offsetHeight),setTimeout((()=>{Gi=!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)((()=>{Gi||s()}),[s,t]),{handleScroll:(0,i.I4)((()=>{Gi||ji(s)}),[s])}}(_,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}}(_),[re,ce]=(()=>{const[e,t]=(0,i.eJ)(!1);return[e,(0,i.I4)((()=>{t((e=>!e))}),[])]})(),{observe:le}=(0,Mn.S1)({rootRef:_,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=>{$({chatId:me,threadId:o._f,messageId:e,origin:m.bZ.SharedMedia})}),[me,$]),ge=(0,i.I4)((e=>{D({chatId:me,messageId:e})}),[me,D]),pe=(0,i.I4)((e=>{U({id:e})}),[U]),fe=(0,i.I4)((e=>{q({chatId:me,messageId:e})}),[me,q]),ve=(0,i.I4)((()=>{W(void 0)}),[]);let Ie;(0,i.d4)((()=>{if(H.current&&h.$b)return(0,rt.sf)(H.current,{selectorToPreventScroll:".Profile",onSwipe:(e,t)=>t===rt.eM.Left?(X(Math.min(V+1,Y.length-1)),!0):t===rt.eM.Right&&(X(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,mi.Z)([t,Q],Ie);return i.ZP.createElement(_i.Z,{ref:_,className:"Profile custom-scroll",itemSelector:eo(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(zi.Z,{userId:t||e}),i.ZP.createElement(Vi.Z,{chatOrUserId:t||e}))}(t,u),!k&&i.ZP.createElement("div",{className:"shared-media"},i.ZP.createElement(_e.Z,{ref:H,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||!p){const e=ye&&!we,t=Boolean("members"===Q&&w);return i.ZP.createElement("div",{className:"content empty-list"},!e&&!t&&i.ZP.createElement(st.Z,null),t&&i.ZP.createElement(Wi.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(Wi.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=>p[e]&&i.ZP.createElement(Xi.Z,{key:e,message:p[e],isProtected:B||p[e].isProtected,observeIntersection:le,onClick:he}))):"documents"===Q?ee.map((e=>p[e]&&i.ZP.createElement(Yn.Z,{key:e,message:p[e],withDate:!0,smaller:!0,className:"scroll-item",isDownloading:T.includes(e),observeIntersection:le,onDateClick:fe}))):"links"===Q?ee.map((e=>p[e]&&i.ZP.createElement(Ki.Z,{key:e,message:p[e],isProtected:B||p[e].isProtected,observeIntersection:le,onMessageClick:fe}))):"audio"===Q?ee.map((e=>p[e]&&i.ZP.createElement(Jn.Z,{key:e,theme:c,message:p[e],origin:m.Cr.SharedMedia,date:p[e].date,lastSyncTime:N,className:"scroll-item",onPlay:ge,onDateClick:fe,isDownloading:T.includes(e)}))):"voice"===Q?ee.map((e=>p[e]&&i.ZP.createElement(Jn.Z,{key:e,theme:c,message:p[e],senderTitle:(0,Fi.F)(z,p[e],M,b),origin:m.Cr.SharedMedia,date:p[e].date,lastSyncTime:N,className:"scroll-item",onPlay:ge,onDateClick:fe,isDownloading:T.includes(e)}))):"members"===Q?ee.map(((e,t)=>{return i.ZP.createElement(Hi.Z,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item small-icon",onClick:()=>pe(e),contextActions:(n=e,n!==g&&P?[{title:z("lng_context_remove_from_group"),icon:"stop",handler:()=>{W(n)}}]:void 0)},i.ZP.createElement(Ft.Z,{userId:e,forceShowSelf:!0}));var n})):"commonChats"===Q?ee.map(((e,t)=>i.ZP.createElement(Hi.Z,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item small-icon",onClick:()=>U({id:e})},i.ZP.createElement($t.Z,{chatId:e})))):void 0)}()),i.ZP.createElement(ct.Z,{big:!0,activeTab:V,tabs:Y,onSwitchTab:X})),Z&&i.ZP.createElement(Yi.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(Ji.Z,{isOpen:Boolean(K),userId:K,onClose:ve}))}))),no=(0,i.X$)((e=>{const t=(0,mt.Z)(ut.gl.Extra,"RightSearch");return t?i.ZP.createElement(t,e):i.ZP.createElement(ht.Z,null)})),ao=(0,i.X$)((e=>{const t=(0,mt.Z)(ut.gl.Extra,"Management");return t?i.ZP.createElement(t,e):i.ZP.createElement(ht.Z,null)})),so=e=>{const t=(0,mt.Z)(ut.gl.Extra,"Statistics");return t?i.ZP.createElement(t,e):i.ZP.createElement(ht.Z,null)},io=(0,i.X$)((()=>{const e=(0,mt.Z)(ut.gl.Extra,"StickerSearch");return e?i.ZP.createElement(e,null):i.ZP.createElement(ht.Z,null)})),oo=(0,i.X$)((()=>{const e=(0,mt.Z)(ut.gl.Extra,"GifSearch");return e?i.ZP.createElement(e,null):i.ZP.createElement(ht.Z,null)})),ro=(0,i.X$)((()=>{const e=(0,mt.Z)(ut.gl.Extra,"PollResults");return e?i.ZP.createElement(e,null):i.ZP.createElement(ht.Z,null)}));var co=n(1820);const lo=(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:p,globalUserIds:f,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:p,isLoading:l===m.WB.Loading,globalUserIds:f,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:p,globalUserIds:f,onClose:v,isActive:I}=e;const{setUserSearchQuery:y,loadContactList:w}=(0,a.Sv)(),Z=(0,He.Z)(),[P,C]=(0,i.eJ)([]),S=(0,Bt.Z)(P)===P;(0,i.d4)((()=>{I&&"connectionStateReady"===n&&w()}),[n,I,w]),(0,xe.ZP)(I,v);const b=(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,...p||[],...f||[]]).filter((n=>{const a=e[n];return!b.includes(n)&&n!==r&&(!a||!(0,d.cS)(a)||!t&&a.canBeInvitedToGroup)})),c)}),[l,c,m,p,f,r,b,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(co.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:S}),i.ZP.createElement(Yi.Z,{isShown:Boolean(P.length),disabled:u,ariaLabel:Z("lng_channel_add_users"),onClick:R},u?i.ZP.createElement(st.Z,{color:"white"}):i.ZP.createElement("i",{className:"icon-arrow-right"}))))}))),uo=Object.keys(m.qt).length/2,mo=Object.keys(m.u1).length/2;function ho(){const e=document.querySelector(".RightHeader .SearchInput input");e&&e.blur()}const go=(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:p,setGifSearchQuery:f,closePollResults:v,addChatMembers:I,setNewChatMembersDialogState:y,setEditingExportedInvite:w,toggleStatistics:Z,setOpenedInviteInfo:P,requestNextManagementScreen:C}=(0,a.Sv)(),{width:S}=Tt(),[b,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=b!==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,$=n===m.qt.StickerSearch,D=n===m.qt.GifSearch,q=n===m.qt.PollResults,j=n===m.qt.AddingMembers,G=S<=s._m,[_,H]=(0,i.eJ)(!x),z=null!==(t=(0,Ut.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:ho(),g();break;case m.qt.StickerSearch:ho(),p({query:void 0});break;case m.qt.GifSearch:ho(),f({query:void 0});break;case m.qt.PollResults:v()}}),[n,B,u,v,y,M,h,g,p,f,w,o,P,Z]),X=(0,i.I4)(((e,t)=>{N(e),A(t)}),[]),K=(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(lo,{key:o,chatId:o,isActive:x&&e,onNextStep:K,onClose:V});case m.qt.ChatInfo:return i.ZP.createElement(to,{key:o,chatId:o,profileState:b,onProfileStateChange:E});case m.qt.Search:return i.ZP.createElement(no,{chatId:o,threadId:r,onClose:V,isActive:x&&e});case m.qt.Management:return i.ZP.createElement(ao,{key:o,chatId:o,currentScreen:M,isPromotedByCurrentUser:T,selectedChatMemberId:k,isActive:x&&e,onScreenSelect:R,onChatMemberSelect:X,onClose:V});case m.qt.Statistics:return i.ZP.createElement(so,{chatId:o,isActive:x&&e});case m.qt.StickerSearch:return i.ZP.createElement(io,{onClose:V,isActive:x&&e});case m.qt.GifSearch:return i.ZP.createElement(oo,{onClose:V,isActive:x&&e});case m.qt.PollResults:return i.ZP.createElement(ro,{onClose:V,isActive:x&&e})}}return(0,i.d4)((()=>x?(0,De.Z)(V):void 0),[x,V]),(0,i.d4)((()=>{setTimeout((()=>{H(!x)}),300)}),[x]),(0,i.d4)((()=>{d&&(R(d),C(void 0))}),[d,C]),(0,i.d4)((()=>{x&&G&&V()}),[G]),(0,vn.Z)((e=>{let[t]=e;t!==o&&(E(m.vi.Profile),R(m.u1.Initial))}),[o]),(0,xe.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(Ui,{chatId:o,isColumnOpen:x,isProfile:L,isSearch:O,isManagement:U,isStatistics:F,isStickerSearch:$,isGifSearch:D,isPollResults:q,isAddingChatMembers:j,profileState:b,managementScreen:M,onClose:V,shouldSkipAnimation:_||l,onScreenSelect:R}),i.ZP.createElement(_e.Z,{name:_||l?"none":"zoom-fade",renderCount:uo+mo,activeKey:U?uo+M:z,shouldCleanup:!0},W)))}))),po=(0,i.X$)((e=>{let{isOpen:t}=e;const n=(0,mt.Z)(ut.gl.Extra,"MediaViewer",!t);return n?i.ZP.createElement(n,null):void 0}));let fo=[],vo=!1;function Io(e,t){fo.push({url:e,filename:t}),vo||(vo=!0,setTimeout((async()=>{await async function(){let e=0;for(const t of fo)yo(t),e++,10===e&&(await(0,M.wO)(1e3),e=0);fo=[]}(),vo=!1}),1e3))}function yo(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 wo=new Set,Zo=new Set,Po=(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=>{Zo.add(e),r((()=>{Zo.size&&(s({messages:Array.from(Zo)}),Zo.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(wo.has(e))return;wo.add(e);const t=(0,d.Ti)(e,"download");if(!t)return void c(e);const n=ee.UV(t);if(n)return Io(n,(0,d.w6)(e)),void c(e);ee.he(t,o.IU.BlobUrl,!0).then((t=>{t&&Io(t,(0,d.w6)(e)),c(e)}))})):wo.clear()}),[n,t,s,c])})));var Co=n(5116),So=n(3103);const bo=(0,i.X$)((e=>{let{openedGame:t,gameTitle:n}=e;const{closeGame:a,showNotification:s,openForwardMenu:o}=(0,Co.Sv)(),r=(0,He.Z)(),{url:c,chatId:l,messageId:d}=t||{},u=Boolean(c),m=(0,Es.Z)(l);(0,bn.Z)((()=>{m({type:"playingGame"})}),u?5e3:void 0);const h=(0,i.I4)((e=>{try{const t=JSON.parse(e.data);"share_score"===t.eventType&&(o({fromChatId:l,messageIds:[d],withMyScore:!0}),a()),"share_game"===t.eventType&&s({message:"Unsupported game action"})}catch(e){}}),[l,a,d,o,s]),g=(0,i.I4)((e=>{e.currentTarget.focus()}),[]);return(0,i.d4)((()=>(window.addEventListener("message",h),()=>window.removeEventListener("message",h))),[h]),(0,i.d4)((()=>{if(u)return ie.Z.disableRefresh(),()=>{ie.Z.enableRefresh()}}),[u]),i.ZP.createElement(So.Z,{className:"GameModal",isOpen:u,onClose:a,title:n,hasCloseButton:!0},u&&i.ZP.createElement("iframe",{className:"game-frame",onLoad:g,src:c,title:r("AttachGame"),sandbox:"allow-scripts allow-same-origin allow-orientation-lock",allow:"fullscreen"}))})),Eo=(0,i.X$)((e=>{let{isOpen:t}=e;const n=(0,mt.Z)(ut.gl.Extra,"Notifications",!t);return n?i.ZP.createElement(n,null):void 0})),Mo=(0,i.X$)((e=>{let{isOpen:t}=e;const n=(0,mt.Z)(ut.gl.Extra,"Dialogs",!t);return n?i.ZP.createElement(n,null):void 0})),Ro=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,mt.Z)(ut.gl.Extra,"ForwardPicker",!t);return n?i.ZP.createElement(n,e):void 0})),ko=(0,i.X$)((e=>{const{url:t}=e,n=(0,mt.Z)(ut.gl.Extra,"SafeLinkModal",!t);return n?i.ZP.createElement(n,e):void 0})),No=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,mt.Z)(ut.gl.Extra,"HistoryCalendar",!t);return n?i.ZP.createElement(n,e):void 0})),To=(0,i.X$)((e=>{const{groupCallId:t}=e,n=(0,mt.Z)(ut.gl.Calls,"GroupCall",!t);return n?i.ZP.createElement(n,e):void 0})),Ao=(0,i.X$)((e=>{const{isActive:t}=e,n=(0,mt.Z)(ut.gl.Calls,"ActiveCallHeader",!t);return n?i.ZP.createElement(n,null):void 0})),Bo=(0,i.X$)((e=>{const{isActive:t}=e,n=(0,mt.Z)(ut.gl.Calls,"PhoneCall",!t);return n?i.ZP.createElement(n,null):void 0})),xo=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,mt.Z)(ut.gl.Extra,"NewContactModal",!t);return n?i.ZP.createElement(n,e):void 0})),Lo=(0,i.X$)((e=>{const{isOpen:t}=e,n=(0,mt.Z)(ut.gl.Calls,"RatePhoneCallModal",!t);return n?i.ZP.createElement(n,e):void 0}));let Oo,Uo=!1;function Fo(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 $o(e){document.title!==e&&(document.title=e)}const Do=(0,i.X$)((0,a.c$)((e=>{var t,n,a;const{settings:{byKey:{animationLevel:s,language:i,wasTimeFormatSetManually:o}}}=e,{chatId:r,messageId:l}=e.audioPlayer,d=r&&l?(0,c.hj)(e,r,l):void 0,u=e.openedGame,m=u&&(0,c.hj)(e,u.chatId,u.messageId),h=null==m||null===(t=m.content.game)||void 0===t?void 0:t.title;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:d,safeLinkModalUrl:e.safeLinkModalUrl,isHistoryCalendarOpen:Boolean(e.historyCalendarSelectedAt),shouldSkipHistoryAnimations:e.shouldSkipHistoryAnimations,openedStickerSetShortName:e.openedStickerSetShortName,isServiceChatReady:(0,c.UW)(e),activeGroupCallId:e.groupCalls.activeGroupCallId,animationLevel:s,language:i,wasTimeFormatSetManually:o,isPhoneCallActive:Boolean(e.phoneCall),addedSetIds:e.stickers.added.setIds,newContactUserId:null===(n=e.newContact)||void 0===n?void 0:n.userId,newContactByPhoneNumber:null===(a=e.newContact)||void 0===a?void 0:a.isByPhoneNumber,openedGame:u,gameTitle:h,isRatePhoneCallModalOpen:Boolean(e.ratingPhoneCall)}}))((e=>{let{connectionState:t,authState:n,lastSyncTime:o,isLeftColumnShown:r,isRightColumnShown:c,isMediaViewerOpen:l,isForwardModalOpen:d,hasNotifications:u,hasDialogs:m,audioMessage:g,activeGroupCallId:p,safeLinkModalUrl:f,isHistoryCalendarOpen:v,shouldSkipHistoryAnimations:I,openedStickerSetShortName:y,isServiceChatReady:w,animationLevel:Z,language:P,wasTimeFormatSetManually:C,addedSetIds:S,isPhoneCallActive:b,newContactUserId:E,newContactByPhoneNumber:R,openedGame:k,gameTitle:N,isRatePhoneCallModalOpen:T}=e;const{sync:A,loadAnimatedEmojis:B,loadNotificationSettings:x,loadNotificationExceptions:L,updateIsOnline:O,loadTopInlineBots:U,loadEmojiKeywords:F,loadCountryList:$,loadAvailableReactions:q,loadStickerSets:j,loadAddedStickers:G,loadFavoriteStickers:_,ensureTimeFormat:H,openStickerSetShortName:z,checkVersionNotification:V,loadAppConfig:X}=(0,a.Sv)();s.eM&&!Uo&&(Uo=!0,console.log(">>> RENDER MAIN")),(0,i.d4)((()=>{"connectionStateReady"===t&&"authorizationStateReady"===n&&A()}),[t,n,A]),(0,i.d4)((()=>{o&&(O(!0),X(),q(),B(),x(),L(),U(),F({language:s.pR}))}),[o,B,F,L,x,U,O,q,X]),(0,i.d4)((()=>{o&&(P!==s.pR&&F({language:P}),$({langCode:P}))}),[P,o,$,F]),(0,i.d4)((()=>{o&&(S?G():(j(),_()))}),[o,S,j,_,G]),(0,i.d4)((()=>{o&&w&&V()}),[o,w,V]),(0,i.d4)((()=>{o&&!C&&H()}),[o,C,H]),(0,i.d4)((()=>{o&&xe.Oy.startsWith("#?tgaddr=")&&(0,Se.o)(decodeURIComponent(xe.Oy.substr("#?tgaddr=".length)))}),[o]),(0,i.d4)((()=>{if(p)return ie.Z.disableRefresh(),()=>{ie.Z.enableRefresh()}}),[p]);const{transitionClassNames:K}=(0,Ee.Z)(!r,void 0,!0,void 0,I),{transitionClassNames:W}=(0,Ee.Z)(c,void 0,!0,void 0,I),Y=(0,Pe.Z)(K.replace(/([\w-]+)/g,"middle-column-$1"),W.replace(/([\w-]+)/g,"right-column-$1"),I&&"history-animation-disabled");(0,ke.Z)((e=>{let[t]=e;if(void 0===t||0===Z)return;const n=(0,Ze.YW)();(0,Ce.L)(document.getElementById("MiddleColumn"),n)}),[r]),(0,ke.Z)((e=>{let[t]=e;if(void 0===t||0===Z)return;(0,M.T2)((()=>{document.body.classList.add("animating-right-column")}));const n=(0,Ze.YW)();(0,Ce.L)(document.getElementById("RightColumn"),(()=>{n(),(0,M.T2)((()=>{document.body.classList.remove("animating-right-column")}))}))}),[c]);const J=(0,i.I4)((()=>{O(!1);const e=(0,D.xW)();let t=0;clearInterval(Oo),Oo=window.setInterval((()=>{if(document.title.includes(s.ou))Fo(!1);else{if(t%2==0){const t=(0,D.xW)()-e;t>0&&($o(`${t} notification${t>1?"s":""}`),Fo(!0))}else $o(s.Ti),Fo(!1);t++}}),1e3)}),[O]),Q=(0,i.I4)((()=>{O(!0),clearInterval(Oo),Oo=void 0,document.title.includes(s.ou)||$o(s.Ti),Fo(!1)}),[O]),ee=(0,i.I4)((()=>{z({stickerSetShortName:void 0})}),[z]);return(0,Me.Z)(J,Q),Re(J),function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];(0,i.d4)((()=>{if(h.$b){if(!e)return null==Ne||Ne.setAttribute("content",Te),h.cj&&!h.fl&&document.addEventListener("gesturestart",Be),()=>{null==Ne||Ne.setAttribute("content","width=device-width, initial-scale=1, shrink-to-fit=no"),h.cj&&!h.fl&&document.removeEventListener("gesturestart",Be)};null==Ne||Ne.setAttribute("content",Ae)}}),[e])}(l),i.ZP.createElement("div",{id:"Main",className:Y,onDrop:be.Z,onDragOver:be.Z},i.ZP.createElement(Et,null),i.ZP.createElement(xi,null),i.ZP.createElement(go,null),i.ZP.createElement(po,{isOpen:l}),i.ZP.createElement(Ro,{isOpen:d}),i.ZP.createElement(Eo,{isOpen:u}),i.ZP.createElement(Mo,{isOpen:m}),g&&i.ZP.createElement(un,{key:g.id,message:g,noUi:!0}),i.ZP.createElement(ko,{url:f}),i.ZP.createElement(No,{isOpen:v}),i.ZP.createElement(Le.Z,{isOpen:Boolean(y),onClose:ee,stickerSetShortName:y}),p&&i.ZP.createElement(To,{groupCallId:p}),i.ZP.createElement(Ao,{isActive:Boolean(p||b)}),i.ZP.createElement(xo,{isOpen:Boolean(E||R),userId:E,isByPhoneNumber:R}),i.ZP.createElement(bo,{openedGame:k,gameTitle:N}),i.ZP.createElement(Po,null),i.ZP.createElement(Bo,{isActive:b}),i.ZP.createElement($e,{isForAppBadge:!0}),i.ZP.createElement(Lo,{isOpen:T}))})));s.eM&&console.log(">>> FINISH LOAD MAIN BUNDLE"),(0,a.Rd)().connectionState||(0,a.Sv)().initApi()},8973:(e,t,n)=>{e.exports=n.p+"encoderWorker.min.8ea62f6317fbac7d4558..js"},8226:(e,t,n)=>{e.exports=n.p+"map-pin.7b3c3e60ee24795e4bd2..svg"},4524:(e,t,n)=>{e.exports=n.p+"telegram-logo-filled.67469f6dc5e301e8e0bd..svg"},257:e=>{e.exports="**Telegram Web Z was updated to version 1.41**\n\n👏 **Harder**\n• Telegram Peer-to-Peer Calls – send and receive voice and video calls with screen sharing from any up-to-date app – secured with end-to-end encryption.\n• Challenge your friends or enjoy solo 🎮 with the full support of game bots like @gamee or @gamebot.\n• Know who you can trust – `SCAM` and `FAKE` badges now appear in suspicious chats.\n• Report suspicious peers and their profile photos.\n• Configure bot extra settings (if available) in the chat via ⋮ > Settings.\n\n🤩 **Better**\n• More UI improvements, as always.\n• New font for Persian language.\n\n💪 **Stronger**\n• Smoother navigation in Group and Channel Statistics.\n"}}]);
|
||
//# sourceMappingURL=568.df1621c9b95b7722cf26.js.map
|