TelegramPWA/dist/769.79d1ffce801bb01a4b8a.js
Alexander Zinchuk 957331985b [Build]
2022-05-06 18:08:20 +01:00

2 lines
298 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

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

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

"use strict";(self.webpackChunktelegram_t=self.webpackChunktelegram_t||[]).push([[769],{3287:(e,t,n)=>{n.r(t),n.d(t,{Main:()=>cr});var a=n(3555),s=n(3716),o=n(4050),i=(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:o}=n,i=(0,d.uw)(a,s),{query:u}=e.localTextSearch.byChatThreadKey[i]||{};return o!==u&&(e=(0,r.Pb)(e,a,s,l.D)),(0,r.qr)(e,a,s,!0,o)})),(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:a,threadId:s=i._f,type:o="thread",shouldReplaceHistory:l=!1}=n,d=(0,c.Bt)(e);return d&&d.chatId===a&&d.threadId===s&&d.type===o||(a&&(e=(0,r.pf)(e,a,s,"replyStack",[])),e=u(e=(0,r.i9)(e)),e={...e,isStatisticsShown:!1,messages:{...e.messages,contentToBeScheduled:void 0},...a!==e.forwardMessages.toChatId&&{forwardMessages:{}}}),(0,r.Wy)(e,a,s,o,l)})),(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:o}=(0,c.Bt)(e)||{};if(!o)return void t.openChat({id:s[0]});const i=s.indexOf(o);if(-1===i)return;const r=s[i+a];t.openChat({id:r,shouldReplaceHistory:!0})}));var m=n(1713),h=n(7361),g=n(782),p=n(2267),f=n(3099),v=n(711),I=n(4319);const y=s.ck+s.fK;let w;function Z(e,t,n){const{threadId:a}=(0,c.Bt)(e)||{},s=v.i0,o=(0,c.Zw)(e,t);if(!o||!a)return;const i=n.map((e=>o[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,I.TE)(i.join("\n"))}(0,a.iw)("setScrollOffset",((e,t,n)=>{const{chatId:a,threadId:s,scrollOffset:o}=n;return(0,r.pf)(e,a,s,"scrollOffset",o)})),(0,a.iw)("setReplyingToId",((e,t,n)=>{const{messageId:a}=n,s=(0,c.Bt)(e);if(!s)return;const{chatId:o,threadId:i}=s;return(0,r.pf)(e,o,i,"replyingToId",a)})),(0,a.iw)("setEditingId",((e,t,n)=>{const{messageId:a}=n,s=(0,c.Bt)(e);if(!s)return;const{chatId:o,threadId:i,type:l}=s,d="scheduled"===l?"editingScheduledId":"editingId";return(0,r.pf)(e,o,i,d,a)})),(0,a.iw)("setEditingDraft",((e,t,n)=>{const{text:a,chatId:s,threadId:o,type:i}=n,c="scheduled"===i?"editingScheduledDraft":"editingDraft";return(0,r.pf)(e,s,o,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 o=(0,g.dF)(s,(t=>Boolean(a[t]&&(0,c._k)(e,a[t],n).canEdit)));return o?(0,r.pf)(e,t,n,"editingId",o):void 0})),(0,a.iw)("replyToNextMessage",((e,t,n)=>{const{targetIndexDelta:a}=n,{chatId:s,threadId:o}=(0,c.Bt)(e)||{};if(!s||!o)return;const r=(0,c.Zw)(e,s),l=(0,c.Cb)(e,s,o);if(!r||!l)return;const d=(0,c.Yy)(e,s,o);let u;if((0,c.b9)(e,s,o)&&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(o===i._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,o);u=null==t?void 0:t.lastMessageId}t.setReplyingToId({messageId:u}),t.focusMessage({chatId:s,threadId:o,messageId:u})})),(0,a.iw)("openAudioPlayer",((e,t,n)=>{const{chatId:a,threadId:s,messageId:o,origin:i,volume:r,playbackRate:c,isMuted:l}=n;return{...e,audioPlayer:{chatId:a,threadId:s,messageId:o,origin:null!=i?i: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:o}=n;if((0,c.Jf)(e)){if(s!==e.pollResults.chatId||o!==e.pollResults.messageId)return{...e,pollResults:{chatId:s,messageId:o,voters:{}}}}else window.setTimeout((()=>{e=(0,a.Rd)(),(0,a.R3)({...e,pollResults:{chatId:s,messageId:o,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 o;if(s===i._f){var r;const t=(0,c.Z1)(e,a);o=null==t||null===(r=t.lastMessage)||void 0===r?void 0:r.id}else{const t=(0,c.tZ)(e,a,s);o=null==t?void 0:t.lastMessageId}o&&t.focusMessage({chatId:a,threadId:s,messageId:o,noHighlight:!0})})),(0,a.iw)("focusNextReply",((e,t)=>{const n=(0,c.Bt)(e);if(!n)return;const{chatId:s,threadId:o}=n,i=(0,c.p9)(e,s,o);if(i&&0!==i.length){const n=i.pop();e=(0,r.pf)(e,s,o,"replyStack",[...i]),(0,a.R3)(e),t.focusMessage({chatId:s,threadId:o,messageId:n})}else t.focusLastMessage()})),(0,a.iw)("focusMessage",((e,t,n)=>{const{chatId:s,threadId:o=i._f,messageListType:l="thread",noHighlight:d,groupedId:u,groupedChatId:h,replyMessageId:g,isResizingContainer:p,shouldReplaceHistory:f}=n;let{messageId:v}=n;if(void 0!==u){const t=(0,c.y8)(e,h,u);null!=t&&t.length&&([v]=t)}const I=(0,c.Bt)(e),Z=!I||s!==I.chatId||o!==I.threadId||l!==I.type;if(w&&(clearTimeout(w),w=void 0),w=window.setTimeout((()=>{let e=(0,a.Rd)();e=(0,r.cq)(e),e=(0,r.wV)(e),(0,a.R3)(e)}),d?y:1500),e=(0,r.cq)(e,s,v,d,p),e=(0,r.wV)(e,void 0),g){const t=(0,c.p9)(e,s,o)||[];e=(0,r.pf)(e,s,o,"replyStack",[...t,g])}Z&&(e=(0,r.wV)(e,m.fo.Static));const P=(0,c.Cb)(e,s,o);if(P&&P.includes(v))return(0,a.R3)(e),void t.openChat({id:s,threadId:o,shouldReplaceHistory:f});if(Z&&(e=(0,r.pf)(e,s,o,"viewportIds",void 0)),e=(0,r.pf)(e,s,o,"outlyingIds",void 0),P&&!Z){const t=v>P[0]?m.fo.Down:m.fo.Up;e=(0,r.wV)(e,t)}(0,a.R3)(e),t.openChat({id:s,threadId:o,shouldReplaceHistory:f}),t.loadViewportMessages()})),(0,a.iw)("openForwardMenu",((e,t,n)=>{const{fromChatId:a,messageIds:s,groupedId:o,withMyScore:i}=n;let r;return o&&(r=(0,c.xH)(e,a,o)),{...e,forwardMessages:{fromChatId:a,messageIds:r||s,isModalShown:!0,withMyScore:i}}})),(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,o=e.activeDownloads.byChatId[s.chatId];o&&o.length&&(0,a.R3)({...e,activeDownloads:{byChatId:{...e.activeDownloads.byChatId,[s.chatId]:o.filter((e=>e!==s.id))}}})})),(0,a.iw)("cancelMessagesMediaDownload",((e,t,n)=>{const{messages:a}=n,s=e.activeDownloads.byChatId,o={};return Object.keys(s).forEach((e=>{o[e]=s[e].filter((e=>!a.find((t=>t.id===e))))})),{...e,activeDownloads:{byChatId:o}}})),(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)||{},o=(0,c.Zw)(e,n);o&&s&&a.map((e=>o[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:o,childMessageIds:i,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,o,i,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 o={chatId:s.aw,date:(0,p.b)(e.serverTimeOffset),content:{text:(0,f.Z)("**Telegram Web Z was updated to version 1.45**\n\n👏 **Harder**\n• Copy phone number from the contact card context menu.\n\n🤩 **Better**\n• Migrated chats do not appear in the chat list anymore.\n\n🚀 **Faster**\n• Optimized memory usage.\n\n💪 **Stronger**\n• Header buttons are now clickable when notifications are shown.\n• Fixed infinite spinner when clicking on a contact card.\n",!0)},isOutgoing:!1};t.createServiceNotification({message:o,version:n})})),(0,a.iw)("createServiceNotification",((e,t,n)=>{var o;const{message:i,version:r}=n,{serviceNotifications:l}=e,d=(0,c.Z1)(e,s.aw),u=Math.max((null===(o=d.lastMessage)||void 0===o?void 0:o.id)||0,...l.map((e=>{let{id:t}=e;return t}))),m=(l.length+1)/1e3,h=Math.floor(u)+m;i.previousLocalId=i.id,i.id=h;const g={id:h,message:i,version:r,isUnread:!0};(0,a.R3)({...e,serviceNotifications:[...l.slice(-1e3),g]}),t.apiUpdate({"@type":"newMessage",id:i.id,chatId:i.chatId,message:i})})),(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;Z(e,t,n)})),(0,a.iw)("copyMessagesByIds",((e,t,n)=>{const{messageIds:a}=n,s=(0,c.jr)(e);a&&0!==a.length&&s&&Z(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 o=s.filter((e=>e!==a));return o.unshift(a),o.length>10&&o.pop(),(0,r.No)(e,{recentlyFoundChatIds:o})})),(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 P=n(1947),C=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,statistics:{...e.statistics,currentMessageId:void 0}}))),(0,a.iw)("toggleMessageStatistics",((e,t,n)=>({...e,statistics:{...e.statistics,currentMessageId:null==n?void 0:n.messageId}}))),(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 o=s.filter((e=>e!==a));return o.unshift(a),o.length>18&&o.pop(),{...e,recentEmojis:o}})),(0,a.iw)("addRecentSticker",((e,t,n)=>{const{sticker:a}=n,{recent:s}=e.stickers;if(!s)return{...e,stickers:{...e.stickers,recent:{hash:"0",stickers:[a]}}};const o=s.stickers.filter((e=>e.id!==a.id));return o.unshift(a),{...e,stickers:{...e.stickers,recent:{...s,stickers:o}}}})),(0,a.iw)("showNotification",((e,t,n)=>{const a=n;a.localId=(0,C.Z)({});const s=[...e.notifications],o=s.findIndex((e=>e.message===a.message));return-1!==o&&s.splice(o,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,P.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:s,chatId:o,messageId:i}=n,r=(0,c.hj)(e,o,i);if(!r)return;const l=r.viaBotId||r.senderId,d=l&&(0,c.IK)(e,l);d&&((0,c.LM)(e,d)?(0,a.R3)({...e,openedGame:{url:s,chatId:o,messageId:i}}):(0,a.R3)({...e,botTrustRequest:{bot:d,type:"game",onConfirm:{action:"openGame",payload:n}}}))})),(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:o,avatarOwnerId:i,profilePhotoIndex:r,origin:c,volume:l,playbackRate:d,isMuted:u}=n;return{...e,mediaViewer:{...e.mediaViewer,chatId:a,threadId:s,messageId:o,avatarOwnerId:i,profilePhotoIndex:r,origin:c,volume:null!=l?l:e.mediaViewer.volume,playbackRate:d||e.mediaViewer.playbackRate,isMuted:u||e.mediaViewer.isMuted},forwardMessages:{}}})),(0,a.iw)("closeMediaViewer",(e=>{const{volume:t,isMuted:n,playbackRate:a}=e.mediaViewer;return{...e,mediaViewer:{volume:t,isMuted:n,playbackRate:a}}})),(0,a.iw)("setMediaViewerVolume",((e,t,n)=>{const{volume:a}=n;return{...e,mediaViewer:{...e.mediaViewer,volume:a,isMuted:!1}}})),(0,a.iw)("setMediaViewerPlaybackRate",((e,t,n)=>{const{playbackRate:a}=n;return{...e,mediaViewer:{...e.mediaViewer,playbackRate:a}}})),(0,a.iw)("setMediaViewerMuted",((e,t,n)=>{const{isMuted:a}=n;return{...e,mediaViewer:{...e.mediaViewer,isMuted:a}}})),n(5456),n(7225);var S=n(1226),M=n(9118);const E=new Map,R=(0,M.Ds)((e=>e()),500,!1);async function k(e,t,n,o){let i=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(o){case m.Uq.Backwards:u=void 0;break;case m.Uq.Around:u=-(Math.round(s.hT/2)+1);break;case m.Uq.Forwards:u=-(s.hT+1)}const h=await(0,S.t9)("fetchMessages",{chat:(0,c.Cm)((0,a.Rd)(),d,t),offsetId:n,addOffset:u,limit:s.hT,threadId:t});if(!h)return;const{messages: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=i?(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 b=(0,c.gb)(y,d,t);const M=(0,c.qC)(y,d,t);if(i&&b&&M&&(M.length&&!(0,g.YE)(b,M)||(y=(0,r.xj)(y,d,t,M),b=(0,c.gb)(y,d,t),y=(0,r.pf)(y,d,t,"outlyingIds",void 0),i=!1)),!l){const e=i?M:b,{newViewportIds:a}=N(e,n,o);y=(0,r.y9)(y,d,t,a)}(0,a.R3)(y)}function N(e,t,n){const{length:a}=e,o=t?function(e,t){return t<e[0]?0:t>e[e.length-1]?e.length-1:e.findIndex(((n,a)=>n===t||n<t&&e[a+1]>t))}(e,t):-1,i=n===m.Uq.Backwards?o:o+1||a,r=i-s.hT,c=i+s.hT-1,l=e.slice(Math.max(0,r),c+1);let d,u;switch(n){case m.Uq.Backwards:d=i>0,u=r>=0;break;case m.Uq.Forwards:d=i<a,u=c<=a-1;break;case m.Uq.Around:default:d=l.length>0,u=l.length===s.hT}return{newViewportIds:l,areSomeLocal:d,areAllLocal:u}}async function T(e){let t;const n=e.attachment?(e,s)=>{E.has(s)||(t=s,E.set(s,n));const o=(0,a.Rd)();(0,a.R3)({...o,fileUploads:{byMessageLocalId:{...o.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 o=(0,c.Bt)(s);if(!o)return;const{threadId:r}=o;e.replyingTo||r===i._f||(e.replyingTo=(0,c.qS)(s,e.chat.id,r)),await(0,S.t9)("sendMessage",e,n),n&&t&&E.delete(t)}(0,a.iw)("loadViewportMessages",((e,t,n)=>{const{direction:a=m.Uq.Around,isBudgetPreload:o=!1}=n||{};let{chatId:i,threadId:l}=n||{};if(!i){const t=(0,c.Bt)(e);if(!t)return;i=t.chatId,l=t.threadId}const d=(0,c.Z1)(e,i);if(!d||d.isRestricted)return;const u=(0,c.Cb)(e,i,l),h=(0,c.gb)(e,i,l),g=(0,c.qC)(e,i,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}=N(c,n,a);if(f&&(e=(0,r.y9)(e,i,l,p)),(0,M.R3)((()=>{!async function(e,t,n,a,s,o,i,r){t||await k(s,o,r,i,n,a),a||e.loadViewportMessages({chatId:s.id,threadId:o,direction:i,isBudgetPreload:!0})}(t,v,s,o,d,l,a,n)})),o)return}else{const t=(0,c.G$)(e,i)||(0,c.rd)(e,i,l),n=Boolean(t&&h&&!h.includes(t)),a=(n?g:h)||[],{newViewportIds:u,areSomeLocal:p,areAllLocal:f}=N(a,t,m.Uq.Around);p&&u.length>=s.hT&&(e=(0,r.y9)(e,i,l,u)),f||(0,M.R3)((()=>{k(d,l,t,m.Uq.Around,n,o)}))}return e})),(0,a.iw)("loadMessage",(async(e,t,n)=>{const{chatId:s,messageId:o,replyOriginForId:l,threadUpdate:d}=n,u=(0,c.Z1)(e,s);if(!u)return;const m=await async function(e,t,n){const s=await(0,S.t9)("fetchMessage",{chat:e,messageId:t});if(!s)return;if(s===i._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 o=(0,a.Rd)();return o=(0,r.cY)(o,e.id,t,s.message),o=(0,r.Sh)(o,(0,g.ee)(s.users,"id")),(0,a.R3)(o),s.message}(u,o,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:o,threadId:i,type:r}=a;if("scheduled"===r&&!n.scheduledAt)return{...e,messages:{...e.messages,contentToBeScheduled:n}};const l=(0,c.Z1)(e,o),d={...n,chat:l,replyingTo:(0,c.Yy)(e,o,i),noWebPage:(0,c.tV)(e,o,i),sendAs:(0,c._5)(e,o)};t.setReplyingToId({messageId:void 0}),t.clearWebPagePreview({chatId:o,threadId:i,value:!1});const u=!n.attachments||n.attachments.length<=1,m=!u&&n.attachments&&n.attachments.length>1;if(u){const{attachments:e,...t}=d;T({...t,attachment:e?e[0]:void 0})}else if(m){const{text:e,entities:t,attachments:n,...a}=d,o=(0,g.Vl)(n,s.DU);for(let n=0;n<o.length;n++){const[s,...i]=o[n],r=`${Date.now()}${n}`;T({...a,text:0===n?e:void 0,entities:0===n?t:void 0,attachment:s,groupedId:i.length>0?r:void 0}),i.forEach((e=>{T({...a,attachment:e,groupedId:r})}))}}else{const{text:e,entities:t,attachments:n,replyingTo:a,...s}=d;e&&T({...s,text:e,entities:t,replyingTo:a}),n.forEach((e=>{T({...s,attachment:e})}))}})),(0,a.iw)("editMessage",((e,t,n)=>{const{serverTimeOffset:a}=e,{text:s,entities:o}=n,i=(0,c.Bt)(e);if(!i)return;const{chatId:r,threadId:l,type:d}=i,u=(0,c.Z1)(e,r),m=(0,c.kK)(e,r,l,d);u&&m&&((0,S.t9)("editMessage",{chat:u,message:m,text:s,entities:o,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,o=(0,c.hj)(e,a,s),i=o&&E.get(o.previousLocalId||o.id);i&&(0,S.u3)(i),t.apiUpdate({"@type":"deleteMessages",ids:[s],chatId:a})})),(0,a.iw)("saveDraft",((e,t,n)=>{const{chatId:a,threadId:s,draft:o}=n;if(!o)return;const{text:l,entities:d}=o,u=(0,c.Z1)(e,a);return s===i._f&&(0,S.t9)("saveDraft",{chat:u,text:l,entities:d,replyToMsgId:(0,c.Yy)(e,a,s)}),e=(0,r.pf)(e,a,s,"draft",o),(0,r.a4)(e,a,{draftDate:Math.round(Date.now()/1e3)})})),(0,a.iw)("clearDraft",((e,t,n)=>{const{chatId:a,threadId:s,localOnly:o}=n;if(!(0,c.Ms)(e,a,s))return;const l=(0,c.Z1)(e,a);return o||s!==i._f||(0,S.t9)("clearDraft",l),e=(0,r.pf)(e,a,s,"draft",void 0),(0,r.a4)(e,a,{draftDate:void 0})})),(0,a.iw)("toggleMessageWebPage",((e,t,n)=>{const{chatId:a,threadId:s,noWebPage:o}=n;return(0,r.pf)(e,a,s,"noWebPage",o)})),(0,a.iw)("pinMessage",((e,t,n)=>{const a=(0,c.jr)(e);if(!a)return;const{messageId:s,isUnpin:o,isOneSide:i,isSilent:r}=n;(0,S.t9)("pinMessage",{chat:a,messageId:s,isUnpin:o,isOneSide:i,isSilent:r})})),(0,a.iw)("unpinAllMessages",((e,t,n)=>{const s=(0,c.Z1)(e,n.chatId);s&&async function(e){await(0,S.t9)("unpinAllMessages",{chat:e});let t=(0,a.Rd)();t=(0,r.pf)(t,e.id,i._f,"pinnedIds",[]),(0,a.R3)(t)}(s)})),(0,a.iw)("deleteMessages",((e,t,n)=>{const{messageIds:a,shouldDeleteForAll:s}=n,o=(0,c.Bt)(e);if(!o)return;const{chatId:i,threadId:r}=o,l=(0,c.Z1)(e,i);(0,S.t9)("deleteMessages",{chat:l,messageIds:a,shouldDeleteForAll:s});const d=(0,c._$)(e,i,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:o}=s,i=(0,c.Z1)(e,o);(0,S.t9)("deleteScheduledMessages",{chat:i,messageIds:a});const r=(0,c.wU)(e,o);a.includes(r)&&t.setEditingId({messageId:void 0})})),(0,a.iw)("deleteHistory",(async(e,t,n)=>{var a;const{chatId:s,shouldDeleteForAll:o}=n,i=(0,c.Z1)(e,s);if(!i)return;const r=null===(a=i.lastMessage)||void 0===a?void 0:a.id;await(0,S.t9)("deleteHistory",{chat:i,shouldDeleteForAll:o,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:o}=n,i=(0,c.Bt)(e);if(!i)return;const{chatId:r}=i,l=(0,c.Z1)(e,r),d=await(0,S.t9)("reportMessages",{peer:l,messageIds:a,reason:s,description:o});t.showNotification({message:d?(0,v.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:o}=n;if(s===e.currentUserId)return;const i=(0,c.Z1)(e,s);i&&await(0,S.t9)("sendMessageAction",{peer:i,threadId:o,action:a})})),(0,a.iw)("markMessageListRead",((e,t,n)=>{const{serverTimeOffset:a}=e,o=(0,c.Bt)(e);if(!o)return;const{chatId:l,threadId:d}=o,u=(0,c.Cm)(e,l,d);if(!u)return;const{maxId:m}=n;if(R((()=>{(0,S.t9)("markMessageListRead",{serverTimeOffset:a,chat:u,threadId:d,maxId:m})})),d!==i._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,o=e.length;s<o&&(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,S.t9)("markMessagesRead",{chat:a,messageIds:s})})),(0,a.iw)("loadWebPagePreview",((e,t,n)=>{const{text:s}=n;!async function(e){const t=await(0,S.t9)("fetchWebPagePreview",{message:e});(0,a.R3)({...(0,a.Rd)(),webPagePreview:t})}(s)})),(0,a.iw)("clearWebPagePreview",(e=>{if(e.webPagePreview)return{...e,webPagePreview:void 0}})),(0,a.iw)("sendPollVote",((e,t,n)=>{const{chatId:a,messageId:s,options:o}=n,i=(0,c.Z1)(e,a);i&&(0,S.t9)("sendPollVote",{chat:i,messageId:s,options:o})})),(0,a.iw)("loadPollOptionResults",((e,t,n)=>{const{chat:s,messageId:o,option:i,offset:c,limit:l,shouldResetVoters:d}=n;!async function(e,t,n,s,o,i){const c=await(0,S.t9)("loadPollOptionResults",{chat:e,messageId:t,option:n,offset:s,limit:o});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)([...!i&&d&&d[n]?d[n]:[],...c&&c.users.map((e=>e.id))])},offsets:{...l.pollResults.offsets?l.pollResults.offsets:{},[n]:c.nextOffset||""}}})}(s,o,i,c,l,d)})),(0,a.iw)("forwardMessages",((e,t,n)=>{const{fromChatId:s,messageIds:o,toChatId:i,withMyScore:r}=e.forwardMessages,l=s?(0,c.Z1)(e,s):void 0,u=i?(0,c.Z1)(e,i):void 0,m=s&&o?o.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,i),f=m.filter((e=>!(0,d.jM)(e)));f.length&&(0,S.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;T({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,o=(0,c.Z1)(e,s);o&&async function(e){const t=await(0,S.t9)("fetchScheduledHistory",{chat:e});if(!t)return;const{messages:n}=t,s=(0,g.ee)(n,"id"),o=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,i._f,"scheduledIds",o),(0,a.R3)(c)}(o)})),(0,a.iw)("sendScheduledMessages",((e,t,n)=>{const{chatId:a,id:s}=n,o=(0,c.Z1)(e,a);o&&(0,S.t9)("sendScheduledMessages",{chat:o,ids:[s]})})),(0,a.iw)("rescheduleMessage",((e,t,n)=>{const{chatId:a,messageId:s,scheduledAt:o}=n,i=(0,c.Z1)(e,a),r=i&&(0,c.Tm)(e,i.id,s);i&&r&&(0,S.t9)("rescheduleMessage",{chat:i,message:r,scheduledAt:o})})),(0,a.iw)("requestThreadInfoUpdate",((e,t,n)=>{const{chatId:a,threadId:s}=n,o=(0,c.Cm)(e,a,s);o&&(0,S.t9)("requestThreadInfoUpdate",{chat:o,threadId:s})})),(0,a.iw)("loadPinnedMessages",((e,t,n)=>{const{chatId:s}=n,o=(0,c.Z1)(e,s);o&&async function(e){const t=await(0,S.t9)("fetchPinnedMessages",{chat:e});if(!t)return;const{messages:n,chats:s,users:o}=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,i._f,"pinnedIds",l),d=(0,r.Sh)(d,(0,g.ee)(o,"id")),d=(0,r.fZ)(d,(0,g.ee)(s,"id")),(0,a.R3)(d)}(o)})),(0,a.iw)("loadSeenBy",(async(e,t,n)=>{const{chatId:s,messageId:o}=n,i=(0,c.Z1)(e,s);if(!i)return;const l=await(0,S.t9)("fetchSeenBy",{chat:i,messageId:o});l&&(0,a.R3)((0,r.cY)((0,a.Rd)(),s,o,{seenByUserIds:l}))})),(0,a.iw)("saveDefaultSendAs",((e,t,n)=>{const{chatId:a,sendAsId:s}=n,o=(0,c.Z1)(e,a),i=(0,c.Z1)(e,s)||(0,c.dy)(e,s);if(o&&i)return(0,S.t9)("saveDefaultSendAs",{sendAs:i,chat:o}),(0,r.a4)(e,a,{fullInfo:{...o.fullInfo,sendAsId:s}})})),(0,a.iw)("loadSendAs",(async(e,t,n)=>{const{chatId:s}=n,o=(0,c.Z1)(e,s);if(!o)return;const i=await(0,S.t9)("fetchSendAs",{chat:o});i?(e=(0,a.Rd)(),e=(0,r.Sh)(e,(0,g.ee)(i.users,"id")),e=(0,r.fZ)(e,(0,g.ee)(i.chats,"id")),e=(0,r.a4)(e,s,{sendAsIds:i.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,o=(0,c.Z1)(e,s);if(!o)return;const i=await(0,S.t9)("fetchSponsoredMessages",{chat:o});i&&(e=(0,a.Rd)(),e=(0,r.Fn)(e,s,i.messages[0]),e=(0,r.Sh)(e,(0,g.ee)(i.users,"id")),e=(0,r.fZ)(e,(0,g.ee)(i.chats,"id")),(0,a.R3)(e))})),(0,a.iw)("viewSponsoredMessage",((e,t,n)=>{const{chatId:a}=n,s=(0,c.Z1)(e,a),o=(0,c.fS)(e,a);s&&o&&(0,S.t9)("viewSponsoredMessage",{chat:s,random:o.randomId})})),(0,a.iw)("fetchUnreadMentions",(async(e,t,n)=>{const{chatId:s,offsetId:o}=n,i=(0,c.Z1)(e,s);if(!i)return;const l=await(0,S.t9)("fetchUnreadMentions",{chat:i,offsetId:o});if(!l)return;const{messages:d,chats:u,users:m}=l,h=(0,g.ee)(d,"id"),p=Object.keys(h).map(Number);e=(0,a.Rd)(),e=(0,r.c_)(e,i.id,h),e=(0,r.Sh)(e,(0,g.ee)(m,"id")),e=(0,r.fZ)(e,(0,g.ee)(u,"id")),e=(0,r.a4)(e,s,{unreadMentions:[...i.unreadMentions||[],...p]}),(0,a.R3)(e)})),(0,a.iw)("markMentionsRead",((e,t,n)=>{const{messageIds:s}=n,o=(0,c.jr)(e);if(!o)return;if(!o.unreadMentionsCount)return;const i=o.unreadMentionsCount-s.length,l=(o.unreadMentions||[]).filter((e=>!s.includes(e)));e=(0,r.a4)(e,o.id,{unreadMentions:l}),(0,a.R3)(e),!l.length&&i&&t.fetchUnreadMentions({chatId:o.id,offsetId:Math.max(...s)}),t.markMessagesRead({messageIds:s})})),(0,a.iw)("focusNextMention",((e,t)=>{const n=(0,c.jr)(e);null!=n&&n.unreadMentions&&t.focusMessage({chatId:n.id,messageId:n.unreadMentions[0]})})),(0,a.iw)("readAllMentions",(e=>{const t=(0,c.jr)(e);if(t)return(0,S.t9)("readAllMentions",{chat:t}),(0,r.a4)(e,t.id,{unreadMentionsCount:void 0,unreadMentions:void 0})}));var A=n(5765);const B=(0,M.P2)((e=>e()),500,!1);async function x(e,t){const n=await(0,S.t9)("searchGifs",{query:e,offset:t});n&&(0,a.R3)((0,r.rq)((0,a.Rd)(),!t,n.gifs,n.nextOffset))}(0,a.iw)("loadStickerSets",(e=>{const{hash:t}=e.stickers.added||{};!async function(e){const t=await(0,S.t9)("fetchStickerSets",{hash:e});t&&(0,a.R3)((0,r.z3)((0,a.Rd)(),"added",t.hash,t.sets))}(t)})),(0,a.iw)("loadAddedStickers",(async(e,t)=>{const{setIds:n}=e.stickers.added,a=e.stickers.setsById;if(n&&n.length)for(let e=0;e<n.length;e++){const s=n[e];a[s].stickers||(t.loadStickers({stickerSetId:s}),e%10==0&&e>0&&await(0,M.wO)(200))}})),(0,a.iw)("loadRecentStickers",(e=>{const{hash:t}=e.stickers.recent||{};!async function(e){const t=await(0,S.t9)("fetchRecentStickers",{hash:e});if(!t)return;const n=(0,a.Rd)();(0,a.R3)({...n,stickers:{...n.stickers,recent:t}})}(t)})),(0,a.iw)("loadFavoriteStickers",(e=>{const{hash:t}=e.stickers.favorite||{};!async function(e){const t=await(0,S.t9)("fetchFavoriteStickers",{hash:e});if(!t)return;const n=(0,a.Rd)();(0,a.R3)({...n,stickers:{...n.stickers,favorite:t}})}(t)})),(0,a.iw)("loadGreetingStickers",(async e=>{const{hash:t}=e.stickers.greeting||{},n=await(0,S.t9)("fetchStickersForEmoji",{emoji:"👋⭐️",hash:t});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,S.t9)("fetchFeaturedStickers",{hash:e});t&&(0,a.R3)((0,r.z3)((0,a.Rd)(),"featured",t.hash,t.sets))}(t)})),(0,a.iw)("loadStickers",((e,t,n)=>{const{stickerSetId:s,stickerSetShortName:o}=n;let{stickerSetAccessHash:i}=n;if(!i&&!o){const t=(0,c.Ny)(e,s);if(!t)return;i=t.accessHash}!async function(e,t,n){const s=await(0,S.t9)("fetchStickers",{stickerSetShortName:n,stickerSetId:e,accessHash:t});if(!s)return;const{set:o,stickers:i,packs:c}=s;let l=(0,a.Rd)();l=(0,r.Rg)(l,o.id,{...o,stickers:i,packs:c});const d=l.stickers.forEmoji.emoji;d&&c[d]&&(l=(0,r.vy)(l)),(0,a.R3)(l)}(s,i,o)})),(0,a.iw)("loadAnimatedEmojis",(()=>{!async function(){const e=await(0,S.t9)("fetchAnimatedEmojis");if(!e)return;const{set:t,stickers:n}=e;(0,a.R3)((0,r.g_)((0,a.Rd)(),{...t,stickers:n}))}(),async function(){const e=await(0,S.t9)("fetchAnimatedEmojiEffects");if(!e)return;const{set:t,stickers:n}=e;(0,a.R3)({...(0,a.Rd)(),animatedEmojiEffects:{...t,stickers:n}})}()})),(0,a.iw)("loadSavedGifs",(e=>{const{hash:t}=e.gifs.saved;!async function(e){const t=await(0,S.t9)("fetchSavedGifs",{hash:e});if(!t)return;const n=(0,a.Rd)();(0,a.R3)({...n,gifs:{...n.gifs,saved:t}})}(t)})),(0,a.iw)("saveGif",(async(e,t,n)=>{var s;const{gif:o,shouldUnsave:i}=n;if(!await(0,S.t9)("saveGif",{gif:o,shouldUnsave:i}))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!==o.id})))||[],c=i?r:[o,...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,S.t9)("faveSticker",{sticker:a})})),(0,a.iw)("unfaveSticker",((e,t,n)=>{const{sticker:s}=n;s&&function(e){const t=(0,a.Rd)();(0,a.R3)({...t,stickers:{...t.stickers,favorite:{...t.stickers.favorite,stickers:t.stickers.favorite.stickers.filter((t=>{let{id:n}=t;return n!==e.id}))}}}),(0,S.t9)("faveSticker",{sticker:e,unfave:!0})}(s)})),(0,a.iw)("toggleStickerSet",((e,t,n)=>{const{stickerSetId:a}=n,s=(0,c.Ny)(e,a);if(!s)return;const{accessHash:o,installedDate:i}=s;(0,S.t9)(i?"uninstallStickerSet":"installStickerSet",{stickerSetId:a,accessHash:o})})),(0,a.iw)("loadEmojiKeywords",(async(e,t,n)=>{var s,o;const{language:i}=n;let r=e.emojiKeywords[i];if(null!==(s=r)&&void 0!==s&&s.isLoading)return;(0,a.R3)({...e,emojiKeywords:{...e.emojiKeywords,[i]:{...r,isLoading:!0}}});const c=await(0,S.t9)("fetchEmojiKeywords",{language:i,fromVersion:r?r.version:0});r=(e=(0,a.Rd)()).emojiKeywords[i],c?(0,a.R3)({...e,emojiKeywords:{...e.emojiKeywords,[i]:{isLoading:!1,version:c.version,keywords:{...null===(o=r)||void 0===o?void 0:o.keywords,...c.keywords}}}}):(0,a.R3)({...e,emojiKeywords:{...e.emojiKeywords,[i]:{...r,isLoading:!1}}})})),(0,a.iw)("setStickerSearchQuery",((e,t,n)=>{const{query:s}=n;s&&B((()=>{!async function(e,t){const n=await(0,S.t9)("searchStickers",{query:e,hash:void 0});if(!n)return;const s=(0,a.Rd)(),{setsById:o,added:i}=s.stickers,c=n.sets.map((e=>{let{id:t}=e;return t}));i.setIds&&i.setIds.forEach((t=>{if(!c.includes(t)){const{title:n}=o[t]||{};n&&(0,A.Z)(n,e)&&c.unshift(t)}})),(0,a.R3)((0,r.z3)(s,"search",n.hash,n.sets,c))}(s)}))})),(0,a.iw)("setGifSearchQuery",((e,t,n)=>{const{query:a}=n;"string"==typeof a&&B((()=>{x(a)}))})),(0,a.iw)("searchMoreGifs",(e=>{const{query:t,offset:n}=e.gifs.search;"string"==typeof t&&B((()=>{x(t,n)}))})),(0,a.iw)("loadStickersForEmoji",((e,t,n)=>{const{emoji:s}=n,{hash:o}=e.stickers.forEmoji;B((()=>{!async function(e,t){let n=(0,a.Rd)();(0,a.R3)({...n,stickers:{...n.stickers,forEmoji:{...n.stickers.forEmoji,emoji:e}}});const s=await(0,S.t9)("fetchStickersForEmoji",{emoji:e,hash:t});n=(0,a.Rd)(),s&&n.stickers.forEmoji.emoji===e&&(n=(0,r.IM)(n,e,s.stickers,s.hash),(0,a.R3)(n))}(s,o)}))})),(0,a.iw)("clearStickersForEmoji",(e=>({...e,stickers:{...e.stickers,forEmoji:{}}}))),(0,a.iw)("openStickerSetShortName",((e,t,n)=>{const{stickerSetShortName:a}=n;return{...e,openedStickerSetShortName:a}}));var L=n(790);const O=(0,M.P2)((e=>e()),500,!1);async function U(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1?arguments[1]:void 0,o=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,l=arguments.length>4?arguments[4]:void 0,d=arguments.length>5?arguments[5]:void 0;if(i){const a=await(0,S.t9)("searchMessagesLocal",{chat:i,query:t,type:n,limit:s.Hk,offsetId:o,minDate:d,maxDate:l});if(a){const{messages:t,users:n,totalCount:s,nextOffsetId:o}=a;e={messages:t,users:n,chats:[],totalCount:s,nextRate:o}}}else e=await(0,S.t9)("searchMessagesGlobal",{query:t,offsetRate:o,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 F(e,t,n){let o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const i=await(0,S.t9)("searchMessagesLocal",{chat:e,type:t,limit:2*s.EN,offsetId:n});if(!i)return;const{chats:l,users:d,messages:u,totalCount:m,nextOffsetId:h}=i,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),o||F(e,t,h,!0))}(0,a.iw)("setGlobalSearchQuery",((e,t,n)=>{const{chatId:s}=e.globalSearch,{query:o}=n;o&&!s&&O((()=>{!async function(e){const t=await(0,S.t9)("searchChats",{query:e});let n=(0,a.Rd)();const s=(0,c.JX)(n);if(!t||!s||e!==s)return void(0,a.R3)((0,r.xv)(n,{chats:!1}));const{localChats:o,localUsers:i,globalChats:l,globalUsers:d}=t;(o.length||l.length)&&(n=(0,r.fZ)(n,(0,g.ee)([...o,...l],"id"))),(i.length||d.length)&&(n=(0,r.Sh)(n,(0,g.ee)([...i,...d],"id"))),n=(0,r.xv)(n,{chats:!1}),n=(0,r.No)(n,{localResults:{chatIds:o.map((e=>{let{id:t}=e;return t})),userIds:i.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)}(o)}))})),(0,a.iw)("setGlobalSearchDate",((e,t,n)=>{const{date:s}=n,o=s?(0,L.IS)(s):s;e=(0,r.No)(e,{date:s,query:"",resultsByType:{...e.globalSearch.resultsByType,text:{totalCount:void 0,foundIds:[],nextOffsetId:0}}}),(0,a.R3)(e);const{chatId:i}=e.globalSearch;U("","text",void 0,i?(0,c.Z1)(e,i):void 0,o,s)})),(0,a.iw)("searchMessagesGlobal",((e,t,n)=>{var a;const{query:s,resultsByType:o,chatId:i,date:r}=e.globalSearch,l=r?(0,L.IS)(r):r,{type:d}=n;U(s,d,null==o||null===(a=o[d])||void 0===a?void 0:a.nextOffsetId,i?(0,c.Z1)(e,i):void 0,l,r)})),(0,a.iw)("searchTextMessagesLocal",(e=>{const{chatId:t,threadId:n}=(0,c.Bt)(e)||{},o=t?(0,c.Z1)(e,t):void 0,l=(0,c.n5)(e);if(!o||!l||!n)return;const{query:d,results:u}=l,m=null==u?void 0:u.nextOffsetId;let h;if(n!==i._f){const a=(0,c.tZ)(e,t,n);h=null==a?void 0:a.topMessageId}!async function(e,t,n,o,i){if(!o)return;const l=await(0,S.t9)("searchMessagesLocal",{chat:e,type:"text",query:o,topMessageId:n,limit:s.pn,offsetId:i});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&&o===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))}(o,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:o}=a,i=s&&o&&o[s],r=null==i?void 0:i.nextOffsetId;s&&F(n,s,r)})),(0,a.iw)("searchMessagesByDate",((e,t,n)=>{const{timestamp:s}=n,{chatId:o}=(0,c.Bt)(e)||{};if(!o)return;const i=(0,c.Z1)(e,o);i&&async function(e,t){const n=await(0,S.t9)("findFirstMessageIdAfterDate",{chat:e,timestamp:t});n&&(0,a.Sv)().focusMessage({chatId:e.id,messageId:n})}(i,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:o}=n;e=(0,r.H9)(e,m.wv.InProgress),e=(0,r.fw)(e,s,{isUsernameAvailable:void 0}),(0,a.R3)(e);const i=await(0,S.t9)("checkChatUsername",{username:o});e=(0,a.Rd)(),e=(0,r.H9)(e,i?m.wv.Complete:m.wv.Error),e=(0,r.fw)(e,s,{isUsernameAvailable:i}),(0,a.R3)(e)})),(0,a.iw)("updatePublicLink",(async(e,t,n)=>{const{chatId:s}=(0,c.Bt)(e)||{};let o=s&&(0,c.Z1)(e,s);if(!s||!o)return;const{username:i}=n;if(e=(0,r.H9)(e,m.wv.InProgress),(0,a.R3)(e),(0,d.G9)(o)){if(o=await(0,S.t9)("migrateChat",o),!o)return;t.openChat({id:o.id})}const l=await(0,S.t9)("setChatUsername",{chat:o,username:i});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,S.t9)("updatePrivateLink",{chat:n})})),(0,a.iw)("setEditingExportedInvite",((e,t,n)=>{const{chatId:s,invite:o}=n;(0,a.R3)((0,r.fw)(e,s,{editingInvite:o}))})),(0,a.iw)("setOpenedInviteInfo",((e,t,n)=>{const{chatId:s,invite:o}=n,i=o?{inviteInfo:{invite:o}}:{inviteInfo:void 0};(0,a.R3)((0,r.fw)(e,s,i))})),(0,a.iw)("loadExportedChatInvites",(async(e,t,n)=>{const{chatId:s,adminId:o,isRevoked:i,limit:l}=n,d=(0,c.Z1)(e,s),u=(0,c.dy)(e,o||e.currentUserId);if(!d||!u)return;const m=await(0,S.t9)("fetchExportedChatInvites",{peer:d,admin:u,isRevoked:i,limit:l});if(!m)return;const h=i?{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:o,isRevoked:i,expireDate:l,usageLimit:d,isRequestNeeded:u,title:m}=n,h=(0,c.Z1)(e,s);if(!h)return;const g=await(0,S.t9)("editExportedChatInvite",{peer:h,link:o,isRevoked:i,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:o,usageLimit:i,isRequestNeeded:l,title:d}=n,u=(0,c.Z1)(e,s);if(!u)return;const m=await(0,S.t9)("exportChatInvite",{peer:u,expireDate:o,usageLimit:i,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,o;const{chatId:i,link:l}=n,d=(0,c.Z1)(e,i);if(!d)return;if(!await(0,S.t9)("deleteExportedChatInvite",{peer:d,link:l}))return;const u=(e=(0,a.Rd)()).management.byChatId[i];(0,a.R3)((0,r.fw)(e,i,{invites:null==u||null===(s=u.invites)||void 0===s?void 0:s.filter((e=>e.link!==l)),revokedInvites:null==u||null===(o=u.revokedInvites)||void 0===o?void 0:o.filter((e=>e.link!==l))}))})),(0,a.iw)("deleteRevokedExportedChatInvites",(async(e,t,n)=>{const{chatId:s,adminId:o}=n,i=(0,c.Z1)(e,s),l=(0,c.dy)(e,o||e.currentUserId);i&&l&&await(0,S.t9)("deleteRevokedExportedChatInvites",{peer:i,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:o,link:i,offsetDate:l,offsetUserId:d,limit:u}=n,m=(0,c.Z1)(e,o),h=(0,c.dy)(e,d);if(!m||d&&!h)return;const g=await(0,S.t9)("fetchChatInviteImporters",{peer:m,link:i,offsetDate:l,offsetUser:h,limit:u});if(!g)return;const p=null===(s=(e=(0,a.Rd)()).management.byChatId[o])||void 0===s?void 0:s.inviteInfo;null!=p&&p.invite&&p.invite.link===i&&(0,a.R3)((0,r.fw)(e,o,{inviteInfo:{...p,importers:g}}))})),(0,a.iw)("loadChatInviteRequesters",(async(e,t,n)=>{var s;const{chatId:o,link:i,offsetDate:l,offsetUserId:d,limit:u}=n,m=(0,c.Z1)(e,o),h=(0,c.dy)(e,d);if(!m||d&&!h)return;const g=await(0,S.t9)("fetchChatInviteImporters",{peer:m,link:i,offsetDate:l,offsetUser:h,limit:u,isRequested:!0});if(!g)return;const p=null===(s=(e=(0,a.Rd)()).management.byChatId[o])||void 0===s?void 0:s.inviteInfo;null!=p&&p.invite&&p.invite.link===i&&(0,a.R3)((0,r.fw)(e,o,{inviteInfo:{...p,requesters:g}}))})),(0,a.iw)("loadChatJoinRequests",(async(e,t,n)=>{const{chatId:s,offsetDate:o,offsetUserId:i,limit:l}=n,d=(0,c.Z1)(e,s),u=(0,c.dy)(e,i);if(!d||i&&!u)return;const m=await(0,S.t9)("fetchChatInviteImporters",{peer:d,offsetDate:o,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:o,userId:i,isApproved:l}=n,d=(0,c.Z1)(e,o),u=(0,c.dy)(e,i);if(!d||!u)return;if(!await(0,S.t9)("hideChatJoinRequest",{peer:d,user:u,isApproved:l}))return;e=(0,a.Rd)();const m=(0,c.Z1)(e,o);m&&(0,a.R3)((0,r.a4)(e,o,{joinRequests:null===(s=m.joinRequests)||void 0===s?void 0:s.filter((e=>e.userId!==i))}))})),(0,a.iw)("hideAllChatJoinRequests",(async(e,t,n)=>{const{chatId:s,isApproved:o,link:i}=n,l=(0,c.Z1)(e,s);if(!l)return;if(!await(0,S.t9)("hideAllChatJoinRequests",{peer:l,isApproved:o,link:i}))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,o=(0,c.Z1)(e,s);o&&await(0,S.t9)("hideChatReportPanel",o)&&(0,a.R3)((0,r.a4)((0,a.Rd)(),s,{settings:void 0}))}));var $=n(6974);let D;function q(e){return(0,S.t9)("fetchMessages",{chat:e,threadId:i._f,offsetId:e.lastReadInboxMessageId,addOffset:-(Math.round(s.hT/2)+1),limit:s.hT})}(0,a.iw)("sync",(()=>{s.eM&&console.log(">>> START SYNC"),D&&clearTimeout(D),(0,a.R3)({...(0,a.Rd)(),isSyncing:!0}),D=window.setTimeout((()=>{(0,a.R3)({...(0,a.Rd)(),isSyncing:!1}),D=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,i._f),e[n].editingId=(0,c._$)(t,n,i._f),e[n].editingDraft=(0,c.s)(t,n,i._f),e)),{}),{chatId:o,threadId:l}=(0,c.Bt)(t)||{},d=o?t.chats.byId[o]:void 0;if(o&&d){const n=await q(d);t=(0,a.Rd)();const{chatId:u}=(0,c.Bt)(t)||{},m=l&&(0,c.tZ)(t,o,l);if(n&&u===o){const a=t.messages.byChatId[o],c=o===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,o,u),t=(0,r.xj)(t,o,i._f,h),t=(0,r.y9)(t,o,i._f,h),l&&m&&m.originChannelId){const{originChannelId:e}=m,n=t.messages.byChatId[e],s=await q(t.chats.byId[e]);if(s){const e=(0,g.ee)(s.messages,"id"),r=Object.keys(e).map(Number);t={...t,messages:{...t.messages,byChatId:{...t.messages.byChatId,[m.originChannelId]:{byId:e,threadsById:{[i._f]:{...null==n?void 0:n.threadsById[i._f],listedIds:r,viewportIds:r,outlyingIds:void 0}}},[o]:{...t.messages.byChatId[o],threadsById:{...t.messages.byChatId[o].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,o,n.threadInfos),e=!0}}e||(t={...t,messages:{...t.messages,byChatId:{}}}),Object.keys(n).forEach((e=>{t=(0,r.sN)(t,e,i._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,$.S1)(),e({listType:"archived",shouldReplace:!0}),(0,S.t9)("fetchCurrentUser"),t()}})})),(0,a.iw)("reportPeer",(async(e,t,n)=>{const{chatId:a,reason:s,description:o}=n;if(!a)return;const i=(0,c.Z1)(e,a);if(!i)return;const r=await(0,S.t9)("reportPeer",{peer:i,reason:s,description:o});t.showNotification({message:r?(0,v.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:o,photo:i}=n;if(!a)return;const r=(0,c.Z1)(e,a);if(!r||!i)return;const l=await(0,S.t9)("reportProfilePhoto",{peer:r,photo:i,reason:s,description:o});t.showNotification({message:l?(0,v.i0)("ReportPeer.AlertSuccess"):"An error occurred while submitting your report. Please, try again later."})})),(0,a.iw)("loadAuthorizations",(async()=>{const e=await(0,S.t9)("fetchAuthorizations");e&&(0,a.R3)({...(0,a.Rd)(),activeSessions:{byHash:e.authorizations,orderedHashes:Object.keys(e.authorizations),ttlDays:e.ttlDays}})})),(0,a.iw)("terminateAuthorization",(async(e,t,n)=>{const{hash:s}=n;if(!await(0,S.t9)("terminateAuthorization",s))return;e=(0,a.Rd)();const{[s]:o,...i}=e.activeSessions.byHash;(0,a.R3)({...e,activeSessions:{byHash:i,orderedHashes:e.activeSessions.orderedHashes.filter((e=>e!==s))}})})),(0,a.iw)("terminateAllAuthorizations",(async e=>{if(!await(0,S.t9)("terminateAllAuthorizations"))return;const t=(e=(0,a.Rd)()).activeSessions.orderedHashes.find((t=>e.activeSessions.byHash[t].isCurrent));if(!t)return;const n=e.activeSessions.byHash[t];(0,a.R3)({...e,activeSessions:{byHash:{[t]:n},orderedHashes:[t]}})})),(0,a.iw)("changeSessionSettings",(async(e,t,n)=>{const{hash:s,areCallsEnabled:o,areSecretChatsEnabled:i}=n;await(0,S.t9)("changeSessionSettings",{hash:s,areCallsEnabled:o,areSecretChatsEnabled:i})&&(e=(0,a.Rd)(),(0,a.R3)({...e,activeSessions:{...e.activeSessions,byHash:{...e.activeSessions.byHash,[s]:{...e.activeSessions.byHash[s],...void 0!==o?{areCallsEnabled:o}:void 0,...void 0!==i?{areSecretChatsEnabled:i}:void 0}}}}))})),(0,a.iw)("changeSessionTtl",(async(e,t,n)=>{const{days:s}=n;await(0,S.t9)("changeSessionTtl",{days:s})&&(e=(0,a.Rd)(),(0,a.R3)({...e,activeSessions:{...e.activeSessions,ttlDays:s}}))}));const j=(0,M.Ds)((e=>e()),500,!1,!0),G=(0,M.P2)((e=>e()),500,!1);function _(e,t,n){return{...e,inlineBots:{...e.inlineBots,byUsername:{...e.inlineBots.byUsername,[t]:n}}}}function H(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:o,accessHash:i}=s;j((()=>(0,S.t9)("fetchFullUser",{id:o,accessHash:i})))})),(0,a.iw)("loadUser",(async(e,t,n)=>{const{userId:s}=n,o=(0,c.dy)(e,s);if(!o)return;const i=await(0,S.t9)("fetchUsers",{users:[o]});if(!i)return;const{users:l,userStatusesById:d}=i;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,S.t9)("fetchTopUsers");if(!e)return;const{ids:t,users:n}=e;let s=(0,a.Rd)();s=(0,r.Sh)(s,(0,g.ee)(n,"id")),s={...s,topPeers:{...s.topPeers,userIds:t,lastRequestedAt:(0,p.b)(s.serverTimeOffset)}},(0,a.R3)(s)}()})),(0,a.iw)("loadContactList",(()=>{!async function(){const e=await(0,S.t9)("fetchContactList");if(!e)return;let t=(0,r.Sh)((0,a.Rd)(),(0,g.ee)(e.users,"id"));t=(0,r.fZ)(t,(0,g.ee)(e.chats,"id"));const n=e=>e.lastName||e.firstName||"",s=new Intl.Collator("en-US"),o=e.users.sort(((e,t)=>s.compare(n(e),n(t)))).filter((e=>!e.isSelf));(0,a.R3)({...t,contactList:{userIds:o.map((e=>e.id))}})}()})),(0,a.iw)("loadCurrentUser",(()=>{(0,S.t9)("fetchCurrentUser")})),(0,a.iw)("loadCommonChats",(async e=>{var t,n,s;const{chatId:o}=(0,c.Bt)(e)||{},i=o?(0,c.dy)(e,o):void 0;if(!i||(0,d.cS)(i)||null!==(t=i.commonChats)&&void 0!==t&&t.isFullyLoaded)return;const l=null===(n=i.commonChats)||void 0===n?void 0:n.maxId,u=await(0,S.t9)("fetchCommonChats",i.id,i.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,i.id,{commonChats:{maxId:h.length?h[h.length-1]:"0",ids:(0,g.Tw)(((null===(s=i.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:o=!1,firstName:i,lastName:l,shouldSharePhoneNumber:d}=n;!async function(e,t,n,s,o){let i=(0,a.Rd)();const l=(0,c.dy)(i,e);if(!l)return;let d;if((0,a.Sv)().updateChatMutedState({chatId:e,isMuted:t}),(0,a.R3)((0,r.H9)((0,a.Rd)(),m.wv.InProgress)),!l.isContact&&l.phoneNumber)d=await(0,S.t9)("importContact",{phone:l.phoneNumber,firstName:n,lastName:s});else{const{id:e,accessHash:t}=l;d=await(0,S.t9)("updateContact",{id:e,accessHash:t,phoneNumber:"",firstName:n,lastName:s,shouldSharePhoneNumber:o})}d&&((0,a.Sv)().loadChatSettings({chatId:e}),(0,a.R3)((0,r.Nq)((0,a.Rd)(),l.id,{firstName:n,lastName:s}))),i=(0,a.Rd)(),i=(0,r.H9)(i,m.wv.Complete),i=(0,r.ft)(i),(0,a.R3)(i)}(s,o,i,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:o}=n;await(0,S.t9)("deleteContact",{id:s,accessHash:o})}(s)})),(0,a.iw)("loadProfilePhotos",(async(e,t,n)=>{const{profileId:s}=n,o=(0,d.YC)(s),i=o?(0,c.dy)(e,s):void 0,l=o?void 0:(0,c.Z1)(e,s);if(!i&&!l)return;const u=await(0,S.t9)("fetchProfilePhotos",i,l);u&&u.photos&&(e=(0,a.Rd)(),o?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&&G((()=>{!async function(e){const t=await(0,S.t9)("searchChats",{query:e});let n=(0,a.Rd)();const s=n.userSearch.query;if(!t||!s||e!==s)return void(0,a.R3)((0,r.Q3)(n,!1));const{localUsers:o,globalUsers:i}=t;let c,l;o.length&&(n=(0,r.Sh)(n,(0,g.ee)(o,"id")),c=o.map((e=>{let{id:t}=e;return t}))),i.length&&(n=(0,r.Sh)(n,(0,g.ee)(i,"id")),l=i.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:o,lastName:i}=n,c=await(0,S.t9)("importContact",{phone:s,firstName:o,lastName:i});c?(t.openChat({id:c}),(0,a.R3)((0,r.ft)((0,a.Rd)()))):t.showNotification({message:v.i0("Contacts.PhoneNumber.NotRegistred")})})),(0,a.iw)("reportSpam",((e,t,n)=>{const{chatId:a}=n,s=(0,d.YC)(a)?(0,c.dy)(e,a):(0,c.Z1)(e,a);s&&(0,S.t9)("reportSpam",s)}));var z=n(8629);const V=h.cj||h.wZ;class W{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 X="https://prizes.gamee.com/",Y=(0,M.Ds)((e=>e()),500,!1);async function K(e,t){await(0,S.t9)("toggleBotInAttachMenu",{bot:e,isEnabled:t}),await J()}async function J(e){const t=await(0,S.t9)("loadAttachMenuBots",{hash:e});if(!t)return;const n=(0,a.Rd)();(0,a.R3)({...n,attachMenu:{hash:t.hash,bots:t.bots}})}async function Q(e,t,n,a,s){await(0,S.t9)("sendMessage",{chat:e,text:n,replyingTo:a,sendAs:s})}let ee;async function te(e,t,n){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{showDialog:o,showNotification:i,toggleSafeLinkModal:r,openGame:c}=(0,a.Sv)();s&&(ee||(ee=new W("popup,width=800,height=600",(()=>{i({message:"Allow browser to open popup window"})}))),ee.preOpenIfNeeded());const l=await(0,S.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?o({data:{message:d||"Error"}}):d?i({message:d}):m&&(s?m.includes(X)?ee.open(m):(ee.cancelPreOpen(),c({url:m,chatId:e.id,messageId:t})):r({url:m}))}(0,a.iw)("clickBotInlineButton",((e,t,n)=>{const{messageId:a,button:o}=n;switch(o.type){case"command":t.sendBotCommand({command:o.text});break;case"url":{const{url:e}=o;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;te(t,a,o.data);break}case"requestPoll":t.openPollModal({isQuiz:o.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}=o;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;te(t,a,void 0,!0);break}case"switchBotInline":{const{query:e,isSamePeer:n}=o;t.switchBotInline({query:e,isSamePeer:n,messageId:a});break}case"userProfile":{const{userId:e}=o;t.openChatWithInfo({id:e});break}case"simpleWebView":{const{url:n}=o,{chatId:a}=(0,c.Bt)(e)||{};if(!a)return;const s=(0,c.IK)(e,a);if(!s)return;const i=(0,z.B)();t.requestSimpleWebView({url:n,bot:s,theme:i,buttonText:o.text});break}case"webView":{const{url:n}=o,s=(0,c.jr)(e);if(!s)return;const i=(0,c.hj)(e,s.id,a);if(!i)return;if(!i.viaBotId&&!i.senderId)return;const r=(0,c.IK)(e,i.viaBotId||i.senderId);if(!r)return;const l=(0,z.B)();t.requestWebView({url:n,bot:r,peer:s,theme:l,buttonText:o.text});break}}})),(0,a.iw)("sendBotCommand",((e,t,n)=>{const{command:a,chatId:s}=n,{currentUserId:o}=e,i=s?(0,c.Z1)(e,s):(0,c.jr)(e),r=(0,c.Bt)(e);if(!o||!i||!r)return;const{threadId:l}=r;t.setReplyingToId({messageId:void 0}),t.clearWebPagePreview({chatId:i.id,threadId:l,value:!1}),Q(i,0,a,(0,c.Yy)(e,i.id,l),(0,c._5)(e,s))})),(0,a.iw)("restartBot",(async(e,t,n)=>{const{chatId:s}=n,{currentUserId:o}=e,i=(0,c.jr)(e),l=o&&(0,c.IK)(e,s);o&&i&&l&&await(0,S.t9)("unblockContact",l.id,l.accessHash)&&((0,a.R3)((0,r.rB)((0,a.Rd)(),l.id)),Q(i,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,S.t9)("fetchTopInlineBots");if(!n)return;const{ids:s,users:o}=n;e=(0,a.Rd)(),e=(0,r.Sh)(e,(0,g.ee)(o,"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:o,query:i,offset:l}=n;let d=e.inlineBots.byUsername[o];if(!1!==d){if(void 0===d){const{user:t,chat:n}=await(0,S.t9)("fetchInlineBot",{username:o})||{};if(e=(0,a.Rd)(),!t||!n)return void(0,a.R3)(_(e,o,!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=_(e,o,d),(0,a.R3)(e)}(i!==d.query||d.canLoadMore)&&Y((()=>{!async function(e){let{username:t,inlineBotData:n,chatId:s,query:o,offset:i}=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!==o;r=H(r,!0),r=_(r,t,{...n,query:o,...u&&{offset:void 0,results:[]}}),(0,a.R3)(r);const m=await(0,S.t9)("fetchInlineBotResults",{bot:l,chat:d,query:o,offset:u?void 0:i}),h=r.inlineBots.byUsername[t];if(r=H((0,a.Rd)(),!1),!m||!h||o!==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=_(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:o,inlineBotData:d,chatId:s,query:i,offset:l})}))}})),(0,a.iw)("switchBotInline",((e,t,n)=>{const{query:a,isSamePeer:s,messageId:o}=n,i=(0,c.jr)(e);if(!i)return;const r=(0,c.hj)(e,i.id,o);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:i.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:o,scheduledAt:i}=n,r=(0,c.Bt)(e);if(!r||!a)return;const{chatId:l,threadId:d}=r,u=(0,c.Z1)(e,l);t.setReplyingToId({messageId:void 0}),t.clearWebPagePreview({chatId:l,threadId:d,value:!1}),(0,S.t9)("sendInlineBotResult",{chat:u,resultId:a,queryId:s,replyingTo:(0,c.Yy)(e,l,d),sendAs:(0,c._5)(e,l),isSilent:o,scheduleDate:i})})),(0,a.iw)("resetInlineBot",((e,t,n)=>{const{username:s}=n;let o=e.inlineBots.byUsername[s];o&&(o={id:o.id,query:"",offset:"",switchPm:void 0,canLoadMore:!0,results:[]},(0,a.R3)(_(e,s,o)))})),(0,a.iw)("startBot",(async(e,t,n)=>{const{botId:a,param:s}=n,o=(0,c.dy)(e,a);o&&await(0,S.t9)("startBot",{bot:o,startParam:s})})),(0,a.iw)("requestSimpleWebView",(async(e,t,n)=>{const{url:s,bot:o,theme:i,buttonText:r}=n;if(!(0,c.LM)(e,o))return void(0,a.R3)({...e,botTrustRequest:{bot:o,type:"webApp",onConfirm:{action:"requestSimpleWebView",payload:n}}});const l=await(0,S.t9)("requestSimpleWebView",{url:s,bot:o,theme:i});l&&(e=(0,a.Rd)(),(0,a.R3)({...e,webApp:{url:l,bot:o,buttonText:r}}))})),(0,a.iw)("requestWebView",(async(e,t,n)=>{const{url:s,bot:o,peer:i,theme:r,isSilent:l,buttonText:d,isFromBotMenu:u,startParam:m}=n;if(!(0,c.LM)(e,o))return void(0,a.R3)({...e,botTrustRequest:{bot:o,type:"webApp",onConfirm:{action:"requestWebView",payload:n}}});const h=(0,c.Bt)(e);if(!h)return;const{chatId:g,threadId:p}=h,f=g&&(0,c.Yy)(e,g,p),v=await(0,S.t9)("requestWebView",{url:s,bot:o,peer:i,theme:r,isSilent:l,replyToMessageId:f||void 0,isFromBotMenu:u,startParam:m});if(!v)return;const{url:I,queryId:y}=v;e=(0,a.Rd)(),(0,a.R3)({...e,webApp:{url:I,bot:o,queryId:y,buttonText:d}})})),(0,a.iw)("prolongWebView",((e,t,n)=>{const{bot:a,peer:s,isSilent:o,replyToMessageId:i,queryId:r}=n;(0,S.t9)("prolongWebView",{bot:a,peer:s,isSilent:o,replyToMessageId:i,queryId:r})||t.closeWebApp()})),(0,a.iw)("sendWebViewData",((e,t,n)=>{const{bot:a,data:s,buttonText:o}=n;(0,S.t9)("sendWebViewData",{bot:a,data:s,buttonText:o})})),(0,a.iw)("closeWebApp",(e=>({...e,webApp:void 0}))),(0,a.iw)("cancelBotTrustRequest",(e=>({...e,botTrustRequest:void 0}))),(0,a.iw)("markBotTrusted",((e,t,n)=>{var s;const{botId:o}=n,{trustedBotIds:i}=e,r=new Set(i);if(r.add(o),(0,a.R3)({...e,botTrustRequest:void 0,trustedBotIds:Array.from(r)}),null!==(s=e.botTrustRequest)&&void 0!==s&&s.onConfirm){const{action:n,payload:a}=e.botTrustRequest.onConfirm;t[n](a)}})),(0,a.iw)("loadAttachMenuBots",(async(e,t,n)=>{const{hash:a}=n||{};await J(a)})),(0,a.iw)("toggleBotInAttachMenu",(async(e,t,n)=>{const{botId:a,isEnabled:s}=n,o=(0,c.dy)(e,a);o&&await K(o,s)})),(0,a.iw)("callAttachMenuBot",((e,t,n)=>{const{chatId:a,botId:s,isFromBotMenu:o,url:i,startParam:r}=n,l=(0,c.Z1)(e,a),d=(0,c.IK)(e,s);if(!l||!d)return;const{attachMenu:{bots:u}}=e;if(!o&&!u[s])return{...e,botAttachRequest:{bot:d,chatId:a,startParam:r}};const m=(0,z.B)();t.requestWebView({url:i,peer:l,bot:d,theme:m,buttonText:"",isFromBotMenu:o,startParam:r})})),(0,a.iw)("confirmBotAttachRequest",(async(e,t)=>{const{botAttachRequest:n}=e;if(!n)return;const{bot:s,chatId:o,startParam:i}=n;(0,a.R3)({...e,botAttachRequest:void 0}),await K(s,!0),t.callAttachMenuBot({chatId:o,botId:s.id,startParam:i})})),(0,a.iw)("closeBotAttachRequestModal",(e=>({...e,botAttachRequest:void 0}))),n(1371),(0,a.iw)("loadPasswordInfo",(async e=>{const t=await(0,S.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:o}=n;(0,a.R3)((0,r.IE)(e,{isLoading:!0,error:void 0}));const i=await(0,S.t9)("checkPassword",s);(0,a.R3)((0,r.IE)((0,a.Rd)(),{isLoading:!1})),i&&o()})),(0,a.iw)("clearPassword",(async(e,t,n)=>{const{currentPassword:s,onSuccess:o}=n;(0,a.R3)((0,r.IE)(e,{isLoading:!0,error:void 0}));const i=await(0,S.t9)("clearPassword",s);(0,a.R3)((0,r.IE)((0,a.Rd)(),{isLoading:!1})),i&&o()})),(0,a.iw)("updatePassword",(async(e,t,n)=>{const{currentPassword:s,password:o,hint:i,email:c,onSuccess:l}=n;(0,a.R3)((0,r.IE)(e,{isLoading:!0,error:void 0}));const d=await(0,S.t9)("updatePassword",s,o,i,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:o,onSuccess:i}=n;(0,a.R3)((0,r.IE)(e,{isLoading:!0,error:void 0}));const c=await(0,S.t9)("updateRecoveryEmail",s,o);(0,a.R3)((0,r.IE)((0,a.Rd)(),{isLoading:!1,waitingEmailCodeLength:void 0})),c&&i()})),(0,a.iw)("provideTwoFaEmailCode",((e,t,n)=>{const{code:a}=n;(0,S.t9)("provideRecoveryEmailCode",a)})),(0,a.iw)("clearTwoFaError",(e=>(0,r.IE)(e,{error:void 0}))),(0,a.iw)("validateRequestedInfo",((e,t,n)=>{const{requestInfo:s,saveInfo:o}=n,i=(0,c.gx)(e),l=i&&(0,c.Z1)(e,i),d=(0,c.Mz)(e);l&&d&&async function(e,t,n,s){const o=await(0,S.t9)("validateRequestedInfo",{chat:e,messageId:t,requestInfo:n,shouldSave:s});if(!o)return;const{id:i,shippingOptions:c}=o;if(!i)return;let l=(0,r.vT)((0,a.Rd)(),i);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,o)})),(0,a.iw)("getPaymentForm",((e,t,n)=>{const{chat:s,messageId:o}=n;s&&o&&async function(e,t){const n=await(0,S.t9)("getPaymentForm",{chat:e,messageId:t});if(!n)return;let s=(0,r._7)((0,a.Rd)(),n),o=m.KB.PaymentInfo;s.payment.invoice&&(s.payment.invoice.shippingAddressRequested||s.payment.invoice.nameRequested||s.payment.invoice.phoneRequested||s.payment.invoice.emailRequested)&&(o=m.KB.ShippingInfo),s=(0,r.Q$)(s,o),(0,a.R3)(s)}(s,o)})),(0,a.iw)("getReceipt",((e,t,n)=>{const{receiptMessageId:s,chatId:o,messageId:i}=n,l=o&&(0,c.Z1)(e,o);i&&s&&l&&async function(e,t,n){const s=await(0,S.t9)("getReceipt",e,n);if(!s)return;let o=(0,a.Rd)();const i=(0,c.hj)(o,e.id,t);o=(0,r.Dq)(o,s,i),(0,a.R3)(o)}(l,i,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:o}=e.payment,{credentials:i}=n,{data:l}=i;if("stripe"===o){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}`}}),o=await s.json();if(o.error){const e=(0,d.Ow)(o.error),t=(0,a.Rd)();return void(0,a.R3)({...t,payment:{...t.payment,error:{...e}}})}let i=(0,r.QH)((0,a.Rd)(),{type:o.type,id:o.id});i=(0,r.Q$)(i,m.KB.Checkout),(0,a.R3)(i)}(l,t)}else if("smartglocal"===o){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,"")}},o=s.eA?"https://tgb-playground.smart-glocal.com/cds/v1/tokenize/card":"https://tgb.smart-glocal.com/cds/v1/tokenize/card",i=await fetch(o,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json","X-PUBLIC-TOKEN":t},body:JSON.stringify(n)}),c=await i.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:o}=n,i=(0,c.gx)(e),l=i&&(0,c.Z1)(e,i),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,o,i,c){if(!0===await(0,S.t9)("sendPaymentForm",{chat:e,messageId:t,formId:s,credentials:o,requestedInfoId:i,shippingOptionId:c})){const e=(0,r.bp)((0,a.Rd)());(0,a.R3)((0,r.WY)(e))}}(l,d,0,u,{save:o,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 ne=n(647),ae=n(4907);const se=728,oe=424,ie=288;var re=n(3858),ce=n(3475);function le(e,t){return t-(e.isLeftColumnShown&&!h.wB?e.leftColumnWidth||((n=re.Z.get().width)>s._m?Math.min(Math.max(.25*n,ie),.33*n):n>s.ks?Math.min(Math.max(.33*n,ie),.4*n):oe):0);var n}function de(e,t,n){return(0,ce.a4)(e,t,n,void 0,!0)}let ue=0;(0,a.iw)("loadAvailableReactions",(async()=>{const e=await(0,S.t9)("getAvailableReactions");e&&(e.forEach((e=>{e.aroundAnimation&&ne.he(`sticker${e.aroundAnimation.id}`,i.IU.Lottie),e.centerIcon&&ne.he(`sticker${e.centerIcon.id}`,i.IU.Lottie)})),(0,a.R3)({...(0,a.Rd)(),availableReactions:e}))})),(0,a.iw)("interactWithAnimatedEmoji",((e,t,n)=>{const{emoji:a,x:s,y:o,localEffect:i,startSize:r,isReversed:c}=n,l={id:ue++,animatedEffect:a||i,x:le(e,s)+40*Math.random()-20,y:o+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:o,interactions:i,localEffect:r}=n,l=(0,c.Z1)(e,s);l&&(o||r)&&s!==e.currentUserId&&(0,S.t9)("sendEmojiInteraction",{chat:l,messageId:a,emoticon:o||(0,c.ji)(r),timestamps:i})})),(0,a.iw)("sendDefaultReaction",((e,t,n)=>{const{chatId:a,messageId:s,x:o,y:i}=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:o,y:i})})),(0,a.iw)("sendReaction",((e,t,n)=>{var a,o,i;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!==(o=m.reactions)&&void 0!==o&&null!==(i=o.results)&&void 0!==i&&i.some((e=>e.reaction===d&&e.isChosen))&&(d=void 0),(0,S.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 o=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:i}=s;if(a&&!o.some((e=>e.reaction===a))){const{currentUserId:t}=e;o=[...o,{reaction:a,isChosen:!0,count:1}],s.canSeeList&&(i=[...i||[],{userId:t,reaction:a}])}return(0,ae.cY)(e,t,n,{reactions:{...s,results:o,recentReactions:i}})}(e,r,l,d)})),(0,a.iw)("openChat",(e=>({...e,activeReactions:{}}))),(0,a.iw)("stopActiveReaction",((e,t,n)=>{var a;const{messageId:s,reaction:o}=n;return(null===(a=e.activeReactions[s])||void 0===a?void 0:a.reaction)!==o?e:{...e,activeReactions:(0,g.CE)(e.activeReactions,[s])}})),(0,a.iw)("setDefaultReaction",(async(e,t,n)=>{const{reaction:s}=n;await(0,S.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,o,i;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,S.t9)("fetchMessageReactionsList",{reaction:u,chat:m,messageId:d,offset:p});if(!f)return;e=(0,a.Rd)(),null!==(o=f.users)&&void 0!==o&&o.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===(i=h.reactors)||void 0===i?void 0:i.reactions)||[],...y]}}))})),(0,a.iw)("loadMessageReactions",((e,t,n)=>{const{ids:a,chatId:s}=n,o=(0,c.Z1)(e,s);o&&(0,S.t9)("fetchMessageReactions",{ids:a,chat:o})})),(0,a.iw)("sendWatchingEmojiInteraction",((e,t,n)=>{var a;const{chatId:s,emoticon:o,x:i,y:r,startSize:l,isReversed:d,id:u}=n,m=(0,c.Z1)(e,s);if(m&&null!==(a=e.activeEmojiInteractions)&&void 0!==a&&a.some((e=>e.id===u))&&s!==e.currentUserId)return(0,S.t9)("sendWatchingEmojiInteraction",{chat:m,emoticon:o}),{...e,activeEmojiInteractions:e.activeEmojiInteractions.map((t=>t.id===u?{...t,x:le(e,i),y:r,startSize:l,isReversed:d}:t))}})),(0,a.iw)("fetchUnreadReactions",(async(e,t,n)=>{const{chatId:s,offsetId:o}=n,i=(0,c.Z1)(e,s);if(!i)return;const l=await(0,S.t9)("fetchUnreadReactions",{chat:i,offsetId:o,addOffset:o?-1:void 0});if(!l||!l.messages.length)return e=de(e=(0,a.Rd)(),s,{unreadReactionsCount:0}),void(0,a.R3)(e);const{messages:d,chats:u,users:m}=l,h=(0,g.ee)(d,"id"),p=Object.keys(h).map(Number);e=(0,a.Rd)(),e=(0,r.c_)(e,i.id,h),e=(0,r.Sh)(e,(0,g.ee)(m,"id")),e=de(e=(0,r.fZ)(e,(0,g.ee)(u,"id")),s,{unreadReactions:[...i.unreadReactions||[],...p]}),(0,a.R3)(e)})),(0,a.iw)("animateUnreadReaction",((e,t,n)=>{const{messageIds:o}=n,{animationLevel:i}=e.settings.byKey,r=(0,c.jr)(e);if(r){if(r.unreadReactionsCount){const n=r.unreadReactionsCount-o.length,s=(r.unreadReactions||[]).filter((e=>!o.includes(e)));e=de(e,r.id,{unreadReactions:s}),(0,a.R3)(e),!s.length&&n&&t.fetchUnreadReactions({chatId:r.id,offsetId:Math.min(...o)})}if(t.markMessagesRead({messageIds:o}),i===s.zy)return e=(0,a.Rd)(),{...e,activeReactions:{...e.activeReactions,...Object.fromEntries(o.map((t=>{var n,a;const s=(0,c.hj)(e,r.id,t);if(!s)return;const o=null===(n=s.reactions)||void 0===n||null===(a=n.recentReactions)||void 0===a?void 0:a.find((e=>e.isUnread));return o?[t,{messageId:t,reaction:null==o?void 0:o.reaction}]:void 0})).filter(Boolean))}}}})),(0,a.iw)("focusNextReaction",((e,t)=>{const n=(0,c.jr)(e);null!=n&&n.unreadReactions&&t.focusMessage({chatId:n.id,messageId:n.unreadReactions[0]})})),(0,a.iw)("readAllReactions",(e=>{const t=(0,c.jr)(e);if(t)return(0,S.t9)("readAllReactions",{chat:t}),de(e,t.id,{unreadReactionsCount:void 0,unreadReactions:void 0})})),(0,a.iw)("loadStatistics",(async(e,t,n)=>{var s;const{chatId:o,isGroup:i}=n,l=(0,c.Z1)(e,o);if(null==l||!l.fullInfo)return;const d=await(0,S.t9)(i?"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,o);d.recentTopMessages=d.recentTopMessages.map((e=>({...e,...t[e.msgId]})))}(0,a.R3)((0,r.ze)(e,o,d))}})),(0,a.iw)("loadMessageStatistics",(async(e,t,n)=>{const{chatId:s,messageId:o}=n,i=(0,c.Z1)(e,s);if(null==i||!i.fullInfo)return;let l=await(0,S.t9)("fetchMessageStatistics",{chat:i,messageId:o});l||(l={}),e=(0,a.Rd)();const{views:d,forwards:u}=(0,c.Zw)(e,s)[o];l.views=d,l.forwards=u,(0,a.R3)((0,r.kM)(e,l))})),(0,a.iw)("loadStatisticsAsyncGraph",(async(e,t,n)=>{const{chatId:s,token:o,name:i,isPercentage:l}=n,d=(0,c.Z1)(e,s);if(null==d||!d.fullInfo)return;const u=d.fullInfo.statisticsDcId,m=await(0,S.t9)("fetchStatisticsAsyncGraph",{token:o,dcId:u,isPercentage:l});m&&(0,a.R3)((0,r.yC)((0,a.Rd)(),s,i,m))})),n(8304);var me=n(8406);function he(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)=>he(e,a[t])))}const s=e,o=t;return Object.keys(s).every((e=>he(s[e],o[e])))}(0,a.iw)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"updateChat":return(0,a.R3)((0,r.a4)(e,n.id,n.chat,n.newProfilePhoto)),n.noTopChatsRequest||(0,c.N)(e,n.id)||t.loadTopChats(),void(n.chat.id&&(0,me.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 o=(0,c.Z1)(e,n.id);return void(o&&t.requestChatUpdate({chatId:o.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:o,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===i._f&&n.chatId===o&&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.id&&n.message.hasUnreadMention&&{unreadMentionsCount:(u.unreadMentionsCount||0)+1,unreadMentions:[...u.unreadMentions||[],n.message.id]}})),void(0,me.rh)({chat:u,message:s})}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);var o,i;null!=s&&s.unreadReactionsCount&&(e=de(e,a,{unreadReactionsCount:s.unreadReactionsCount-1||void 0,unreadReactions:null===(o=s.unreadReactions)||void 0===o?void 0:o.filter((e=>e!==t))})),null!=s&&s.unreadMentionsCount&&(e=(0,r.a4)(e,a,{unreadMentionsCount:s.unreadMentionsCount-1||void 0,unreadMentions:null===(i=s.unreadMentions)||void 0===i?void 0:i.filter((e=>e!==t))}))})),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,o=a===s.WS?"archived":"active";return{...e,chats:{...e.chats,orderedPinnedIds:{...e.chats.orderedPinnedIds,[o]:t.length?t:void 0}}}}case"updateChatPinned":{const{id:t,isPinned:a}=n,o=(0,c.Ek)(e,t);if(!o)return;const{[o]:i}=e.chats.orderedPinnedIds;let r=i||[];if(a){if(!r.includes(t)){if("active"===o&&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,[o]: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:o}=e.chatFolders,i=a?{...s,[t]:a}:(0,g.ei)(s,Object.keys(s).map(Number).filter((e=>e!==t))),r=a?o&&o.includes(t)?o:[...o||[],t]:o?o.filter((e=>e!==t)):void 0;return{...e,chatFolders:{...e.chatFolders,byId:i,orderedIds:r}}}case"updateChatFoldersOrder":{const{orderedIds:t}=n;return{...e,chatFolders:{...e.chatFolders,orderedIds:t}}}case"updateRecommendedChatFolders":{const{folders:t}=n;return{...e,chatFolders:{...e.chatFolders,recommended:t}}}case"updateChatMembers":{var o;const t=e.chats.byId[n.id],{replacedMembers:a,addedMember:s,deletedMemberId:i}=n;if(!t)return;let c=!1,l=null!==(o=t.fullInfo)&&void 0!==o&&o.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&&i){const e=l.findIndex((e=>e.userId===i));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:o}=n;if(!e.chats.byId[t])return;return e=(0,r.pf)(e,t,i._f,"draft",a),e=(0,r.pf)(e,t,i._f,"replyingToId",o),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:o,recentRequesterIds:i}=n,c=e.chats.byId[s];if(!c)return;e=(0,r.a4)(e,s,{fullInfo:{...c.fullInfo,requestsPending:o,recentRequesterIds:i}}),(0,a.R3)(e),t.loadChatJoinRequests({chatId:s})}}}));const ge=350;function pe(e,t,n,a,s,o,i){var l;const u=null==i?void 0:i.reactions;if(u&&he(a,u))return e;if(e=(0,r.cY)(e,t,n,{reactions:a}),!o)return e;const m=null===(l=s.unreadReactions)||void 0===l?void 0:l.includes(n);if((0,d.yL)(e,a)&&!m){e=de(e,t,{unreadReactionsCount:((null==s?void 0:s.unreadReactionsCount)||0)+1,unreadReactions:[...(null==s?void 0:s.unreadReactions)||[],n]});const a=(0,c.hj)(e,t,n);if(!s||!a)return e;(0,M.R3)((()=>{(0,me.rh)({chat:s,message:a,isReaction:!0})}))}else if(m){var h;e=de(e,t,{unreadReactionsCount:((null==s?void 0:s.unreadReactionsCount)||1)-1,unreadReactions:null==s||null===(h=s.unreadReactions)||void 0===h?void 0:h.filter((e=>e!==n))})}return e}function fe(e,t,n,a){let s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const o=s?(0,c.Tm)(e,t,n):(0,c.hj)(e,t,n);if(o&&a.content){const{photo:e,video:t,sticker:n,document:s}=(0,d.qp)(o);e&&a.content.photo?(a.content.photo.blobUrl=e.blobUrl,a.content.photo.thumbnail=e.thumbnail):t&&a.content.video?a.content.video.blobUrl=t.blobUrl:n&&a.content.sticker?a.content.sticker.isPreloadedGlobally=n.isPreloadedGlobally:s&&a.content.document&&(a.content.document.previewBlobUrl=s.previewBlobUrl)}return s?(0,r.P4)(e,t,n,a):(0,r.cY)(e,t,n,a)}function ve(e,t,n,a){const{chatId:s}=n,{threadInfo:o}=(0,c.Db)(e,s,n)||{};if(!o&&n.replyToMessageId){const o=(0,c.hj)(e,s,n.replyToMessageId);o?e=(0,r.lG)(e,o,s,n.id,a):t.loadMessage({chatId:s,messageId:n.replyToMessageId,threadUpdate:{isDeleting:a,lastMessageId:n.id}})}return e}function Ie(e,t,n){const{id:a,chatId:s}=n,{threadInfo:o,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,i._f);if(e=ve(e,t,n),o&&(!l&&(0,d.CI)(n)||(e=(0,r.xj)(e,s,o.threadId,[a]),(0,c.b9)(e,s,o.threadId)&&(e=(0,r.$S)(e,s,o.threadId,a),l||(e=(0,r.pf)(e,s,o.threadId,"firstMessageId",n.id)))),e=(0,r.pf)(e,s,o.threadId,"threadInfo",{...o,lastMessageId:n.id,messagesCount:o.messagesCount+1})),m)return e;if(e=(0,r.xj)(e,s,i._f,[a]),(0,c.b9)(e,s,i._f)){const t=(0,c.It)(e,s,i._f),n=(0,r.$S)(e,s,i._f,a),o=(0,c.Cb)(n,s,i._f);t&&!o.includes(t)||(e=n)}return e}function ye(e,t,n){var a;let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{chats:o}=e,i=null===(a=o.byId[t])||void 0===a?void 0:a.lastMessage;return!i||s||i.id===n.id||i.id===n.previousLocalId||n.id>i.id?(0,r.a4)(e,t,{lastMessage:n}):e}function we(e,t){const n=(0,c.Zw)(e,t),a=(0,c.gb)(e,t,i._f);if(!n||!a)return;let s=a.length;for(;s--;){const e=n[a[s]];if(!e.isDeleting)return e}}function Ze(e,t,n,s){if(e){t.forEach((t=>{const n=we(s=(0,r.cY)(s,e,t,{isDeleting:!0}),e);n&&(s=ye(s,e,n,!0))})),n.requestChatUpdate({chatId:e});const o=[];return t.forEach((t=>{const a=(0,c.hj)(s,e,t);if(!a)return;s=ve(s,n,a,!0);const{threadInfo:i}=(0,c.Db)(s,e,a)||{};i&&o.push(i.threadId)})),(0,a.R3)(s),void setTimeout((()=>{(0,a.R3)((0,r.K4)((0,a.Rd)(),e,t)),(0,g.Tw)(o).forEach((t=>{n.requestThreadInfoUpdate({chatId:e,threadId:t})}))}),ge)}const o=[];t.forEach((e=>{const t=(0,c.X5)(s,e);if(t){o.push(t);const n=we(s=(0,r.cY)(s,t,e,{isDeleting:!0}),t);n&&(s=ye(s,t,n,!0)),setTimeout((()=>{(0,a.R3)((0,r.K4)((0,a.Rd)(),t,[e]))}),ge)}})),(0,a.R3)(s),(0,g.Tw)(o).forEach((e=>{n.requestChatUpdate({chatId:e})}))}(0,a.iw)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"newMessage":{const{chatId:o,id:l,message:u,shouldForceReply:m}=n;e=Ie(e=fe(e,o,l,u),t,u),u.threadInfo&&(e=(0,r.Xg)(e,u.threadInfo.chatId,u.threadInfo.threadId,u.threadInfo));const h=(0,c.hj)(e,o,l);if((0,c.KA)(e,o,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:o,threadId:n.threadId,messageId:u.id,noHighlight:!0,isResizingContainer:!0})}const{threadInfo:n}=(0,c.Db)(e,o,u)||{};n&&t.requestThreadInfoUpdate({chatId:o,threadId:n.threadId}),(0,d.CI)(u)||setTimeout((()=>{let e=(0,a.Rd)();m&&(e=(0,r.pf)(e,o,i._f,"replyingToId",l)),(0,a.R3)(ye(e,o,h))}),ge)}else e=ye(e,o,h);(0,a.R3)(e),(0,c.N)(e,o)||t.loadTopChats();break}case"updateStartEmojiInteraction":{var o;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 i=(0,c.CP)(e,n.emoji);e={...e,activeEmojiInteractions:[...e.activeEmojiInteractions||[],{id:(null===(o=e.activeEmojiInteractions)||void 0===o?void 0:o.length)||0,animatedEffect:i?(0,c.cu)(i):n.emoji,messageId:n.messageId}]},(0,a.R3)(e);break}case"newScheduledMessage":{const{chatId:t,id:s,message:o}=n;e=fe(e,t,s,o,!0);const l=(0,c.qy)(e,t)||[];e=(0,r.pf)(e,t,i._f,"scheduledIds",(0,g.Tw)([...l,s])),(0,a.R3)(e);break}case"updateMessage":{var l,u;const{chatId:s,id:o,message:d}=n,m=(0,c.hj)(e,s,o),h=(0,c.Z1)(e,s);e=fe(e,s,o,d);const g=(0,c.hj)(e,s,o);d.threadInfo&&(e=(0,r.Xg)(e,d.threadInfo.chatId,d.threadInfo.threadId,d.threadInfo)),m&&(e=ye(e,s,g)),d.reactions&&h&&(e=pe(e,s,o,d.reactions,h,d.isOutgoing,m)),(0,a.R3)(e),m&&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)||i._f)&&t.focusLastMessage();break}case"updateScheduledMessage":{const{chatId:t,id:s,message:o}=n;if(!(0,c.Tm)(e,t,s))return;e=fe(e,t,s,o,!0);const l=Object.keys((0,c.Fn)(e,t)||{}).map(Number).sort(((e,t)=>t-e));e=(0,r.pf)(e,t,i._f,"scheduledIds",l),(0,a.R3)(e);break}case"updateMessageSendSucceeded":{const{chatId:s,localId:o,message:i}=n;e=Ie(e,t,i);const l=(0,c.hj)(e,s,o);e=(0,r.K4)(e,s,[o]),i.isScheduled&&(e=(0,r.bV)(e,s,[o])),e=(0,r.cY)(e,s,i.id,{...l,...i,previousLocalId:o});const d=(0,c.hj)(e,s,i.id);e=ye(e,s,d);const u=(0,c.Db)(e,s,i);null!=u&&u.threadInfo&&(t.markMessageListRead({maxId:i.id}),e=(0,r.pf)(e,s,u.threadInfo.threadId,"threadInfo",{...u.threadInfo,lastMessageId:i.id,lastReadInboxMessageId:i.id})),(0,a.R3)(e);break}case"updateScheduledMessageSendSucceeded":{const{chatId:t,localId:s,message:o}=n,l=(0,c.qy)(e,t)||[];e=(0,r.pf)(e,t,i._f,"scheduledIds",[...l,o.id]);const d=(0,c.Tm)(e,t,s);e=(0,r.bV)(e,t,[s]),e=(0,r.P4)(e,t,o.id,{...d,...o,previousLocalId:s}),(0,a.R3)(e);break}case"updatePinnedIds":{const{chatId:t,isPinned:s,messageIds:o}=n,l=(0,c.KB)(e,t)||[],d=s?[...l,...o].sort(((e,t)=>t-e)):l.filter((e=>!o.includes(e)));(0,a.R3)((0,r.pf)(e,t,i._f,"pinnedIds",d));break}case"updateThreadInfo":{const{chatId:t,threadId:s,threadInfo:o,firstMessageId:i}=n,l={...(0,c.tZ)(e,t,s),...o};if(!l.threadId)return;e=(0,r.Xg)(e,t,s,l),i&&(e=(0,r.pf)(e,t,s,"firstMessageId",i)),(0,a.R3)(e);break}case"resetMessages":{const{id:s}=n,o=(0,c.Zw)(e,s);o&&!(0,d.YC)(s)&&(e=(0,r.K4)(e,s,Object.keys(o).map(Number)),(0,a.R3)(e),t.loadFullChat({chatId:s,force:!0}));break}case"deleteMessages":{const{ids:a,chatId:s}=n;Ze(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,i._f,"scheduledIds",Object.keys(n||{}).map(Number)),(0,a.R3)(s)}),ge))}(s,t,0,e);break}case"deleteHistory":{const{chatId:a}=n,s=e.messages.byChatId[a];s?Ze(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:o}=n;s.forEach((n=>{e=(0,r.cY)(e,t,n,o)})),(0,a.R3)(e);break}case"updateMessagePoll":{const{pollId:t,pollUpdate:s}=n,o=(0,c.ZB)(e,t);if(null!=o&&o.content.poll){const t={...o.content.poll,...s},{results:n}=t.results||{};if(n&&!n.some((e=>e.isChosen))){const{results:e}=o.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,o.chatId,o.id,{content:{...o.content,poll:t}}))}break}case"updateMessagePollVote":{const{pollId:t,userId:s,options:o}=n,i=(0,c.ZB)(e,t);if(!i||!i.content.poll||!i.content.poll.results)break;const{poll:l}=i.content,{recentVoterIds:d,totalVoters:u,results:m}=l.results,h=d?[...d]:[],g=u?u+1:1,p=m?[...m]:[];h.push(s),o.forEach((t=>{const n=p.find((e=>e.option===t)),a=p.findIndex((e=>e.option===t)),o=n?{...n}:{option:t,votersCount:0};o.votersCount+=1,s===e.currentUserId&&(o.isChosen=!0),a?p[a]=o:p.push(o)})),(0,a.R3)((0,r.cY)(e,i.chatId,i.id,{content:{...i.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:o}=n,i=(0,c.hj)(e,t,s),r=(0,c.Z1)(e,n.chatId);if(!r||!i)return;(0,a.R3)(pe(e,t,s,o,r,i.isOutgoing,i));break}}}));const Pe=(0,M.P2)((function(){const e=(0,a.Rd)();(0,a.R3)((0,r.ps)(e,{...e.users.statusesById,...Ce})),Ce={}}),3e3,!0);let Ce={};(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 s=n.userId,o=n.status,Ce[s]=o,void Pe();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}})}case"updateBotMenuButton":{var a;const{botId:t,button:s}=n,o=(0,c.dy)(e,t);if(null==o||null===(a=o.fullInfo)||void 0===a||!a.botInfo)return;return(0,r.Nq)(e,t,{fullInfo:{...o.fullInfo,botInfo:{...o.fullInfo.botInfo,menuButton:s}}})}}var s,o})),(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)=>{var s;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);break;case"updateWebViewResultSent":(null===(s=e.webApp)||void 0===s?void 0:s.queryId)===n.queryId&&(t.setReplyingToId({messageId:void 0}),t.closeWebApp())}})),(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:o,shouldShowPreviews:i}=n;e.chats.byId[t]&&(e=(0,r.a4)(e,t,{isMuted:s})),(0,a.R3)((0,r.aK)(e,t,{isMuted:s,isSilent:o,shouldShowPreviews:i}));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 be=n(8958),Se=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,be.dc)(e,n.call.id):(0,be.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:o}=n,{currentUserId:i}=e;return e=(0,a.Rd)(),s.forEach((n=>{n.id&&(e=(0,be.B6)(e,t,n.id,n,Boolean(o)||i===n.id))})),o&&(e=(0,be.AH)(e,t,{nextOffset:o})),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,me.TO)({call:s,user:(0,Se.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 Me=n(8674),Ee=n(6752),Re=n(1279),ke=n(3551),Ne=n(3227),Te=n(5332);function Ae(e){(0,o.d4)((()=>(0,M.Gq)(e)),[e])}var Be=n(9290);const xe=document.querySelector('meta[name="viewport"]'),Le=(null==xe?void 0:xe.getAttribute("content"))||"",Oe="width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover";function Ue(e){e.preventDefault()}var Fe=n(5326),$e=n(6590),De=n(1212),qe=n(4851),je=n(2155),Ge=n(5616),_e=n(7358);const He=(0,o.X$)((e=>{let{isForAppBadge:t}=e;(0,Ge.yi)();const n=(0,$.xW)();if((0,o.d4)((()=>{t&&(0,_e.w)(n)}),[t,n]),!t&&n)return o.ZP.createElement("div",{className:"unread-count active"},(0,je.bi)(n))}));var ze=n(3989),Ve=n(3455),We=n(706),Xe=n(3541),Ye=n(2255),Ke=n(9107),Je=n(7370),Qe=n(7926),et=n(1622);let tt;function nt(e,t,n,a,s,i){let r,c,l;return r=function(){const[e,t]=(0,o.eJ)(window.navigator.onLine);return(0,o.d4)((()=>{function e(){t(window.navigator.onLine)}return window.addEventListener("online",e),window.addEventListener("offline",e),()=>{window.removeEventListener("offline",e),window.removeEventListener("online",e)}}),[]),e}()&&"connectionStateConnecting"!==t?n?tt.syncing:tt.online:tt.waitingForNetwork,c=r===tt.online||i?"none":a?"middleHeader":s?"minimized":"overlay",r===tt.waitingForNetwork?l=e("WaitingForNetwork"):r===tt.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"}(tt||(tt={}));var at=n(3106),st=n(8964),ot=n(231),it=n(9589),rt=n(9187),ct=n(3321),lt=n(126),dt=n(9204);const ut=(0,o.X$)((e=>{let{connectionStatus:t,connectionStatusText:n,onClick:a}=e;const s=(0,Ke.Z)();return o.ZP.createElement("div",{id:"ConnectionStatusOverlay",dir:s.isRtl?"rtl":void 0,onClick:a},o.ZP.createElement(dt.Z,{color:"black"}),o.ZP.createElement("div",{className:"state-text"},o.ZP.createElement(Ye.Z,{activeKey:t,name:"slide-fade"},n)),o.ZP.createElement(ot.Z,{round:!0,size:"tiny",color:"translucent-black"},o.ZP.createElement("span",{className:"icon-close"})))})),mt=(0,o.X$)((0,a.c$)((e=>{const{query:t,fetchingStatus:n,chatId:a,date:s}=e.globalSearch,{currentUserId:o,connectionState:i,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:o,chatsById:l,globalSearchChatId:a,searchDate:s,theme:(0,c.Pu)(e),animationLevel:u,connectionState:i,isSyncing:r,isMessageListOpen:Boolean((0,c.Bt)(e)),isConnectionStatusMinimized:d,areChatsLoaded:Boolean(e.chats.listIds.active)}}))((e=>{let{content:t,contactsFilter:n,onSearchQuery:i,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:b,isMessageListOpen:S,isConnectionStatusMinimized:M,areChatsLoaded:E}=e;const{openChat:R,setGlobalSearchDate:k,setSettingOption:N,setGlobalSearchChatId:T,openChatByUsername:A}=(0,a.Sv)(),B=(0,Ke.Z)(),x=t===m.du.ChatList,O=(0,o.Ye)((()=>y?(0,L.xH)(new Date(1e3*y)):void 0),[y]),U=(0,o.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}=nt(B,C,b,S,M,!E),q="web.telegram.org"===window.location.hostname||s.Cg,j=(0,o.Ye)((()=>e=>{let{onTrigger:t,isOpen:n}=e;return o.ZP.createElement(ot.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"},o.ZP.createElement("div",{className:(0,Ee.Z)("animated-menu-icon",!x&&"state-back",f&&"no-animation")}))}),[x,B,u,f]),G=(0,o.I4)((()=>{g||i("")}),[g,i]),_=(0,o.I4)((()=>{N({isConnectionStatusMinimized:!M})}),[M,N]),H=(0,o.I4)((()=>{R({id:v,shouldReplaceHistory:!0})}),[v,R]),z=(0,o.I4)((e=>{e.stopPropagation();const t="light"===w?"dark":"light";N({theme:t}),N({shouldUseSystemTheme:!1}),(0,Je.Z)(t,Z===s.zy)}),[Z,N,w]),V=(0,o.I4)((()=>{window.open(s.ul,"_blank")}),[]),W=(0,o.I4)((()=>{A({username:s.j3})}),[A]),X=(0,o.I4)((()=>{A({username:s.$p})}),[A]),Y=(0,o.I4)((()=>{(0,Qe.L)("K"),(0,et.W8)()}),[]),K=(0,o.I4)((()=>{A({username:B("Settings.TipsUsername")})}),[B,A]),J=Boolean(I)||t===m.du.GlobalSearch||t===m.du.Contacts,Q=t===m.du.Contacts?B("SearchFriends"):B("Search"),ee=s.Tj?`${s.Ji} Beta (master)`:s.eM?"master":s.Ji;return o.ZP.createElement("div",{className:"LeftMainHeader"},o.ZP.createElement("div",{id:"LeftMainHeader",className:"left-header"},o.ZP.createElement(at.Z,{trigger:j,footer:`${s.iC} ${ee}`},o.ZP.createElement(st.Z,{icon:"saved-messages",onClick:H},B("SavedMessages")),o.ZP.createElement(st.Z,{icon:"archive",onClick:l},o.ZP.createElement("span",{className:"menu-item-name"},B("ArchivedChats")),U>0&&o.ZP.createElement("div",{className:"archived-badge"},U)),o.ZP.createElement(st.Z,{icon:"user",onClick:c},B("Contacts")),o.ZP.createElement(st.Z,{icon:"settings",onClick:r},B("Settings")),o.ZP.createElement(st.Z,{icon:"darkmode",onClick:z},o.ZP.createElement("span",{className:"menu-item-name"},B("lng_menu_night_mode")),o.ZP.createElement(ct.Z,{id:"darkmode",label:B("dark"===w?"lng_settings_disable_night_theme":"lng_settings_enable_night_theme"),checked:"dark"===w,noAnimation:!0})),o.ZP.createElement(st.Z,{icon:"help",onClick:K},B("TelegramFeatures")),o.ZP.createElement(st.Z,{icon:"bug",href:s.mU},"Report Bug"),s.Tj&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement(st.Z,{icon:"permissions",onClick:V},"Beta Changelog"),o.ZP.createElement(st.Z,{icon:"comments",onClick:W},"Beta Discussion (ru)"),o.ZP.createElement(st.Z,{icon:"comments",onClick:X},"Beta Discussion (en)")),q&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement(st.Z,{icon:"char-K",href:"https://web.telegram.org/k/",onClick:Y},"Switch to K Version"),o.ZP.createElement(st.Z,{icon:"char-W",href:"https://web.telegram.org/?legacy=1"},"Switch to Old Version"))),o.ZP.createElement(it.Z,{inputId:"telegram-search-input",parentContainerClassName:"LeftSearch",className:I||y?"with-picker-item":"",value:n||g,focused:J,isLoading:p||"minimized"===D,spinnerColor:"minimized"===D?"yellow":void 0,spinnerBackgroundColor:"minimized"===D&&"light"===w?"light":void 0,placeholder:Q,autoComplete:"off",canClose:Boolean(I||y),onChange:i,onReset:u,onFocus:G,onSpinnerClick:"minimized"===D?_:void 0},O&&o.ZP.createElement(rt.Z,{icon:"calendar",title:O,canClose:!0,isMinimized:Boolean(I),className:"search-date",onClick:k,clickArg:{date:void 0}}),I&&o.ZP.createElement(rt.Z,{chatOrUserId:I,onClick:T,canClose:!0,clickArg:{id:void 0}})),o.ZP.createElement(lt.Z,{isOpen:"overlay"===D,isCustom:!0,className:"connection-state-wrapper"},o.ZP.createElement(ut,{connectionStatus:F,connectionStatusText:$,onClick:_}))))})));var ht=n(1174),gt=n(3133),pt=n(1080);const ft=(0,o.X$)((0,a.c$)((e=>{const{chatFolders:{byId:t,orderedIds:n,activeChatFolder:a},currentUserId:s,lastSyncTime:o,shouldSkipHistoryAnimations:i}=e;return{chatFoldersById:t,orderedFolderIds:n,activeChatFolder:a,currentUserId:s,lastSyncTime:o,shouldSkipHistoryAnimations:i}}))((e=>{let{foldersDispatch:t,onScreenSelect:n,chatFoldersById:i,orderedFolderIds:r,activeChatFolder:c,currentUserId:l,lastSyncTime:d,shouldSkipHistoryAnimations:u}=e;const{loadChatFolders:m,setActiveChatFolder:g,openChat:p}=(0,a.Sv)(),f=(0,o.sO)(null),v=(0,Ke.Z)();(0,o.d4)((()=>{d&&m()}),[d,m]);const I=(0,o.Ye)((()=>r?r.map((e=>i[e]||{})).filter(Boolean):void 0),[i,r]),y=(0,Ge.yi)(),w=(0,o.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,o.I4)((e=>{g(e,{forceOnHeavyAnimation:!0})}),[g]);(0,o.d4)((()=>{w&&w.length&&c>=w.length&&g(0)}),[c,w,g]),(0,o.d4)((()=>{if(f.current&&h.$b&&w&&w.length)return(0,ht.sf)(f.current,{selectorToPreventScroll:".chat-list",onSwipe:(e,t)=>t===ht.eM.Left?(g(Math.min(c+1,w.length-1),{forceOnHeavyAnimation:!0}),!0):t===ht.eM.Right&&(g(Math.max(0,c-1),{forceOnHeavyAnimation:!0}),!0)})}),[c,w,g]);const P=(0,o.sO)();P.current=0!==c,(0,o.d4)((()=>P.current?(0,ze.Z)((()=>{P.current&&g(0)})):void 0),[c,g]),(0,$e.Z)({isActive:0!==c,onBack:()=>g(0,{forceOnHeavyAnimation:!0})}),(0,o.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)}}),[l,w,p,g]);const{shouldRender:C,transitionClassNames:b}=(0,De.Z)(!r,void 0,!0);function S(e){const a=Object.values(i).find((e=>{let{id:t}=e;return t===w[c].id}));return a&&0!==c?o.ZP.createElement(pt.Z,{folderType:"folder",folderId:a.id,isActive:e,lastSyncTime:d,onScreenSelect:n,foldersDispatch:t}):o.ZP.createElement(pt.Z,{folderType:"all",isActive:e,lastSyncTime:d,foldersDispatch:t,onScreenSelect:n})}return o.ZP.createElement("div",{className:"ChatFolders"},null!=w&&w.length?o.ZP.createElement(gt.Z,{tabs:w,activeTab:c,onSwitchTab:Z}):C?o.ZP.createElement("div",{className:(0,Ee.Z)("tabs-placeholder",b)}):void 0,o.ZP.createElement(Ye.Z,{ref:f,name:u?"none":v.isRtl?"slide-optimized-rtl":"slide-optimized",activeKey:c,renderCount:w?w.length:void 0},S))})));var vt=n(9203),It=n(8778),yt=n(4288);const wt=(0,o.X$)((e=>{const t=(0,It.Z)(vt.gl.Extra,"LeftSearch");return t?o.ZP.createElement(t,e):o.ZP.createElement(yt.Z,null)})),Zt=(0,o.X$)((e=>{const t=(0,It.Z)(vt.gl.Extra,"ContactList");return t?o.ZP.createElement(t,e):o.ZP.createElement(yt.Z,null)}));var Pt=n(2328);const Ct=(0,o.X$)((e=>{let{isShown:t,onNewPrivateChat:n,onNewChannel:a,onNewGroup:s}=e;const[i,r]=(0,o.eJ)(!1);(0,o.d4)((()=>{t||r(!1)}),[t]);const c=(0,Ke.Z)(),l=(0,Ee.Z)("NewChatButton",t&&"revealed",i&&"menu-is-open"),d=(0,o.I4)((()=>{r(!i)}),[i]),u=(0,o.I4)((()=>{r(!1)}),[]);return o.ZP.createElement("div",{className:l},o.ZP.createElement(ot.Z,{round:!0,color:"primary",className:i?"active":"",onClick:d,ariaLabel:c(i?"Close":"NewMessageTitle"),tabIndex:-1},o.ZP.createElement("i",{className:"icon-new-chat-filled"}),o.ZP.createElement("i",{className:"icon-close"})),o.ZP.createElement(Pt.Z,{isOpen:i,positionX:"right",positionY:"bottom",autoClose:!0,onClose:u},o.ZP.createElement(st.Z,{icon:"channel",onClick:a},c("NewChannel")),o.ZP.createElement(st.Z,{icon:"group",onClick:s},c("NewGroup")),o.ZP.createElement(st.Z,{icon:"user",onClick:n},c("NewMessageTitle"))))})),bt=Object.keys(m.du).length/2;let St;const Mt=(0,o.X$)((e=>{let{content:t,searchQuery:n,searchDate:a,contactsFilter:s,shouldSkipTransition:i,foldersDispatch:r,onSearchQuery:c,onContentChange:l,onScreenSelect:d,onReset:u}=e;const[g,p]=(0,o.eJ)(h.$b),f=(0,o.sO)(!1),v=(0,o.I4)((()=>{l(m.du.Settings)}),[l]),I=(0,o.I4)((()=>{l(m.du.Contacts)}),[l]),y=(0,o.I4)((()=>{l(m.du.NewChannelStep1)}),[l]),w=(0,o.I4)((()=>{l(m.du.NewGroupStep1)}),[l]),Z=(0,o.I4)((()=>{l(m.du.Archived)}),[l]),P=(0,o.I4)((()=>{t===m.du.ChatList&&(f.current=!0,p(!0))}),[t]),C=(0,o.I4)((()=>{f.current=!1,St&&(clearTimeout(St),St=void 0),St=window.setTimeout((()=>{f.current||p(!1)}),250)}),[]);(0,o.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[b,S,M]=function(){const[e,t]=(0,We.Z)(!1);(0,o.d4)((()=>{const e=window.setTimeout(t,2592e5);return()=>{clearTimeout(e)}}),[t]);const{shouldRender:n,transitionClassNames:a}=(0,De.Z)(e);return[n,a,()=>{window.location.reload()}]}(),E=(0,Ke.Z)();return o.ZP.createElement("div",{id:"LeftColumn-main",onMouseEnter:h.$b?void 0:P,onMouseLeave:h.$b?void 0:C},o.ZP.createElement(mt,{content:t,contactsFilter:s,onSearchQuery:c,onSelectSettings:v,onSelectContacts:I,onSelectArchived:Z,onReset:u,shouldSkipTransition:i}),o.ZP.createElement(Ye.Z,{name:i?"none":"zoom-fade",renderCount:bt,activeKey:t,shouldCleanup:!0,cleanupExceptionKey:m.du.ChatList},(e=>{switch(t){case m.du.ChatList:return o.ZP.createElement(ft,{onScreenSelect:d,foldersDispatch:r});case m.du.GlobalSearch:return o.ZP.createElement(wt,{searchQuery:n,searchDate:a,isActive:e,onReset:u});case m.du.Contacts:return o.ZP.createElement(Zt,{filter:s,isActive:e,onReset:u});default:return}})),b&&o.ZP.createElement(ot.Z,{fluid:!0,pill:!0,className:(0,Ee.Z)("btn-update",S),onClick:M},E("lng_update_telegram")),o.ZP.createElement(Ct,{isShown:g,onNewPrivateChat:I,onNewChannel:y,onNewGroup:w}))})),Et=(0,o.X$)((e=>{const t=(0,It.Z)(vt.gl.Extra,"Settings");return t?o.ZP.createElement(t,e):o.ZP.createElement(yt.Z,null)})),Rt=(0,o.X$)((e=>{const t=(0,It.Z)(vt.gl.Extra,"NewChat");return t?o.ZP.createElement(t,e):o.ZP.createElement(yt.Z,null)})),kt=(0,o.X$)((e=>{const t=(0,It.Z)(vt.gl.Extra,"ArchivedChats");return t?o.ZP.createElement(t,e):o.ZP.createElement(yt.Z,null)}));var Nt;!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"}(Nt||(Nt={}));const Tt=Object.keys(Nt).length/2,At=(0,o.X$)((0,a.c$)((e=>{const{globalSearch:{query:t,date:n},chatFolders:{activeChatFolder:a},shouldSkipHistoryAnimations:s,leftColumnWidth:o,currentUserId:i}=e;return{searchQuery:t,searchDate:n,activeChatFolder:a,shouldSkipHistoryAnimations:s,leftColumnWidth:o,currentUserId:i}}))((e=>{let{searchQuery:t,searchDate:n,activeChatFolder:s,shouldSkipHistoryAnimations:i,leftColumnWidth:r,currentUserId:c}=e;const{setGlobalSearchQuery:l,setGlobalSearchChatId:d,resetChatCreation:u,setGlobalSearchDate:g,loadPasswordInfo:p,clearTwoFaError:f,setLeftColumnWidth:v,resetLeftColumnWidth:I,openChat:y}=(0,a.Sv)(),w=(0,o.sO)(null),[Z,P]=(0,o.eJ)(m.du.ChatList),[C,b]=(0,o.eJ)(m.MT.Main),[S,M]=(0,o.eJ)(""),[E,R]=(0,Ve.ZP)(),[k,N]=(0,o.eJ)(0);let T=Nt.Main;switch(Z){case m.du.Archived:T=Nt.Archived;break;case m.du.Settings:T=Nt.Settings;break;case m.du.NewChannelStep1:case m.du.NewChannelStep2:T=Nt.NewChannel;break;case m.du.NewGroupStep1:case m.du.NewGroupStep2:T=Nt.NewGroup}const A=(0,o.I4)((e=>{if(Z!==m.du.NewGroupStep2||e)if(Z!==m.du.NewChannelStep2||e){if(Z===m.du.NewGroupStep1){const e=document.getElementById("new-group-picker-search");e&&e.blur()}if(Z===m.du.Settings)switch(C){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 b(m.MT.Main);case m.MT.GeneralChatBackground:case m.MT.QuickReaction:return void b(m.MT.General);case m.MT.GeneralChatBackgroundColor:return void b(m.MT.GeneralChatBackground);case m.MT.PrivacyPhoneNumber:case m.MT.PrivacyLastSeen:case m.MT.PrivacyProfilePhoto:case m.MT.PrivacyPhoneCall:case m.MT.PrivacyPhoneP2P: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 b(m.MT.Privacy);case m.MT.PrivacyPhoneNumberAllowedContacts:case m.MT.PrivacyPhoneNumberDeniedContacts:return void b(m.MT.PrivacyPhoneNumber);case m.MT.PrivacyLastSeenAllowedContacts:case m.MT.PrivacyLastSeenDeniedContacts:return void b(m.MT.PrivacyLastSeen);case m.MT.PrivacyProfilePhotoAllowedContacts:case m.MT.PrivacyProfilePhotoDeniedContacts:return void b(m.MT.PrivacyProfilePhoto);case m.MT.PrivacyPhoneCallAllowedContacts:case m.MT.PrivacyPhoneCallDeniedContacts:return void b(m.MT.PrivacyPhoneCall);case m.MT.PrivacyPhoneP2PAllowedContacts:case m.MT.PrivacyPhoneP2PDeniedContacts:return void b(m.MT.PrivacyPhoneP2P);case m.MT.PrivacyForwardingAllowedContacts:case m.MT.PrivacyForwardingDeniedContacts:return void b(m.MT.PrivacyForwarding);case m.MT.PrivacyGroupChatsAllowedContacts:case m.MT.PrivacyGroupChatsDeniedContacts:return void b(m.MT.PrivacyGroupChats);case m.MT.TwoFaNewPassword:return void b(m.MT.TwoFaDisabled);case m.MT.TwoFaNewPasswordConfirm:return void b(m.MT.TwoFaNewPassword);case m.MT.TwoFaNewPasswordHint:return void b(m.MT.TwoFaNewPasswordConfirm);case m.MT.TwoFaNewPasswordEmail:return void b(m.MT.TwoFaNewPasswordHint);case m.MT.TwoFaNewPasswordEmailCode:return void b(m.MT.TwoFaNewPasswordEmail);case m.MT.TwoFaChangePasswordCurrent:case m.MT.TwoFaTurnOff:case m.MT.TwoFaRecoveryEmailCurrentPassword:return void b(m.MT.TwoFaEnabled);case m.MT.TwoFaChangePasswordNew:return void b(m.MT.TwoFaChangePasswordCurrent);case m.MT.TwoFaChangePasswordConfirm:return void b(m.MT.TwoFaChangePasswordNew);case m.MT.TwoFaChangePasswordHint:return void b(m.MT.TwoFaChangePasswordConfirm);case m.MT.TwoFaRecoveryEmail:return void b(m.MT.TwoFaRecoveryEmailCurrentPassword);case m.MT.TwoFaRecoveryEmailCode:return void b(m.MT.TwoFaRecoveryEmail);case m.MT.FoldersCreateFolder:case m.MT.FoldersEditFolder:return void b(m.MT.Folders);case m.MT.FoldersIncludedChatsFromChatList:case m.MT.FoldersExcludedChatsFromChatList:return void b(m.MT.FoldersEditFolderFromChatList);case m.MT.FoldersEditFolderFromChatList:return P(m.du.ChatList),void b(m.MT.Main)}Z!==m.du.ChatList||0!==s?(P(m.du.ChatList),M(""),l({query:""}),g({date:void 0}),d({id:void 0}),u(),setTimeout((()=>{N(Date.now())}),250)):P(m.du.GlobalSearch)}else P(m.du.NewChannelStep1);else P(m.du.NewGroupStep1)}),[Z,s,C,l,g,d,u]),B=(0,o.I4)((e=>{Z!==m.du.Contacts?(P(m.du.GlobalSearch),e!==t&&l({query:e})):M(e)}),[Z,t,l]);(0,o.d4)((()=>Z!==m.du.ChatList||0===s?(0,ze.Z)((()=>A())):void 0),[s,Z,A]);const x=(0,o.I4)((e=>{Z!==m.du.GlobalSearch&&(e.preventDefault(),P(m.du.GlobalSearch))}),[Z]),L=(0,o.I4)((e=>{e.preventDefault(),y({id:c})}),[c,y]);(0,Xe.y)({"mod+shift+F":x,"mod+shift+S":L}),(0,o.d4)((()=>{f(),C===m.MT.Privacy&&p()}),[f,p,C]);const{initResize:O,resetResize:U,handleMouseUp:F}=function(e,t,n,a){const[s,i,r]=(0,We.Z)(),[c,l]=(0,o.eJ)(),[d,u]=(0,o.eJ)();function m(){document.body.classList.remove("cursor-ew-resize")}return(0,o.d4)((()=>{e.current&&a&&(e.current.style.width=`${a}px`)}),[e,a]),(0,o.d4)((()=>{if(!s)return;const n=t=>{const n=Math.ceil(d+t.clientX-c);e.current.style.width=`${n}px`};function a(){o(),t(e.current.offsetWidth)}function o(){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),o}),[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),i()},resetResize:function(t){t.preventDefault(),e.current.style.width="",n()},handleMouseUp:m}}(w,v,I,r),$=(0,o.I4)((e=>{P(m.du.Settings),b(e)}),[]);return o.ZP.createElement("div",{id:"LeftColumn",ref:w},o.ZP.createElement(Ye.Z,{name:i?"none":h.s0,renderCount:Tt,activeKey:T,shouldCleanup:!0,cleanupExceptionKey:Nt.Main},(e=>{switch(T){case Nt.Archived:return o.ZP.createElement(kt,{isActive:e,onReset:A,onContentChange:P});case Nt.Settings:return o.ZP.createElement(Et,{isActive:e,currentScreen:C,foldersState:E,foldersDispatch:R,onScreenSelect:$,onReset:A,shouldSkipTransition:i});case Nt.NewChannel:return o.ZP.createElement(Rt,{key:k,isActive:e,isChannel:!0,content:Z,onContentChange:P,onReset:A});case Nt.NewGroup:return o.ZP.createElement(Rt,{key:k,isActive:e,content:Z,onContentChange:P,onReset:A});default:return o.ZP.createElement(Mt,{content:Z,searchQuery:t,searchDate:n,contactsFilter:S,foldersDispatch:R,onContentChange:P,onSearchQuery:B,onScreenSelect:$,onReset:A,shouldSkipTransition:i})}})),o.ZP.createElement("div",{className:"resize-handle",onMouseDown:O,onMouseUp:F,onDoubleClick:U}))})));var Bt=n(2420),xt=n(9524),Lt=n(1394);var Ot=n(8986),Ut=n(2678),Ft=n(7204),$t=n(3570),Dt=n(5790),qt=n(8360),jt=n(6058),Gt=n(8799);const _t=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,It.Z)(vt.gl.Extra,"HeaderMenuContainer",!t);return n?o.ZP.createElement(n,e):void 0})),Ht=(0,o.X$)((0,a.c$)(((e,t)=>{var n,a,s;let{chatId:o,threadId:r,messageListType:l}=t;const u=(0,c.Z1)(e,o),m=Boolean(u&&(0,d.eA)(u));if(!u||u.isRestricted||(0,c.CA)(e))return{noMenu:!0};const g=(0,c.IK)(e,o),p=(0,c.FM)(e,o),f="thread"===l&&r===i._f,v="thread"===l&&r!==i._f,I=(0,c.Jf)(e),y=Boolean(g&&(0,c.s4)(e,g.id)),w=!y&&Boolean((0,c.pk)(e,o)),Z=Boolean(f&&(m||(0,d.ZV)(u))&&u.isNotJoined),P=f||v,C=h.Bi&&(0,d.YC)(u.id)&&!p&&!g,b=f&&!p&&!Z,S=f&&!Z,M=h.Bi&&u.isCallActive,E=h.Bi&&!u.isCallActive&&((null===(n=u.adminRights)||void 0===n?void 0:n.manageCall)||u.isCreator&&(0,d.G9)(u));return{noMenu:!1,isChannel:m,isRightColumnShown:I,canStartBot:w,canRestartBot:y,canSubscribe:Z,canSearch:P,canCall:C,canMute:b,canViewStatistics:null===(a=u.fullInfo)||void 0===a?void 0:a.canViewStatistics,canLeave:S,canEnterVoiceChat:M,canCreateVoiceChat:E,pendingJoinRequests:null===(s=u.fullInfo)||void 0===s?void 0:s.requestsPending}}))((e=>{let{chatId:t,threadId:n,noMenu:s,isChannel:i,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:b,restartBot:S,requestCall:M,requestNextManagementScreen:E}=(0,a.Sv)(),R=(0,o.sO)(null),[k,N]=(0,o.eJ)(!1),[T,A]=(0,o.eJ)(void 0),B=(0,o.I4)((()=>{N(!0);const e=R.current.getBoundingClientRect();A({x:e.right,y:e.bottom})}),[]),x=(0,o.I4)((()=>{N(!1)}),[]),L=(0,o.I4)((()=>{A(void 0)}),[]),O=(0,o.I4)((()=>{P({chatId:t})}),[P,t]),U=(0,o.I4)((()=>{C({command:"/start"})}),[C]),F=(0,o.I4)((()=>{S({chatId:t})}),[t,S]),$=(0,o.I4)((()=>{E({screen:m.u1.JoinRequests})}),[E]),D=(0,o.I4)((()=>{b(),h.wB?document.querySelector("#MobileSearch input").focus():setTimeout((()=>{const e=document.querySelector(".RightHeader .SearchInput input");e&&e.focus()}),400)}),[b]),q=(0,o.I4)((e=>{d&&h.fl&&!e.shiftKey&&(e.preventDefault(),D())}),[d,D]);(0,Xe.y)({"meta+F":q});const j=(0,Ke.Z)();return o.ZP.createElement("div",{className:"HeaderActions"},!h.wB&&o.ZP.createElement(o.ZP.Fragment,null,Z&&l&&o.ZP.createElement(ot.Z,{size:"tiny",ripple:!0,fluid:!0,onClick:O},j(i?"ProfileJoinChannel":"ProfileJoinGroup")),Z&&r&&o.ZP.createElement(ot.Z,{size:"tiny",ripple:!0,fluid:!0,onClick:U},j("BotStart")),Z&&c&&o.ZP.createElement(ot.Z,{size:"tiny",ripple:!0,fluid:!0,onClick:F},j("BotRestart")),d&&o.ZP.createElement(ot.Z,{round:!0,ripple:w,color:"translucent",size:"smaller",onClick:D,ariaLabel:"Search in this chat"},o.ZP.createElement("i",{className:"icon-search"})),u&&o.ZP.createElement(ot.Z,{round:!0,color:"translucent",size:"smaller",onClick:function(){M({userId:t})},ariaLabel:"Call"},o.ZP.createElement("i",{className:"icon-phone"}))),Boolean(y)&&o.ZP.createElement(ot.Z,{round:!0,className:"badge-button",ripple:w,color:"translucent",size:"smaller",onClick:$,ariaLabel:j(i?"SubscribeRequests":"MemberRequests")},o.ZP.createElement("i",{className:"icon-user"}),o.ZP.createElement("div",{className:"badge"},y)),o.ZP.createElement(ot.Z,{ref:R,className:k?"active":"",round:!0,ripple:!h.wB,size:"smaller",color:"translucent",disabled:s,ariaLabel:"More actions",onClick:B},o.ZP.createElement("i",{className:"icon-more"})),T&&o.ZP.createElement(_t,{chatId:t,threadId:n,isOpen:k,anchor:T,withExtraActions:h.wB||!Z,isChannel:i,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 zt=n(4399),Vt=n(996),Wt=n(6202),Xt=n(862);function Yt(e){var t;const n=e&&(0,d.DH)(e),a=null==e||null===(t=e.content)||void 0===t?void 0:t.sticker,i=n&&a&&!(0,h.on)()&&n.includes("image/webp"),[r,c]=(0,o.eJ)(Xt.Hu),l=null==e?void 0:e.id;return(0,o.bt)((()=>{i&&(0,Xt.p6)(`b64-${l}`,n).then(c).catch((e=>{s.eM&&console.error(e)}))}),[l,i,n]),i?r:n}var Kt=n(8512),Jt=n(7551);function Qt(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 en=(0,o.X$)((e=>{let{count:t,index:n}=e;const a=(0,o.sO)(null),s=(0,o.Ye)((()=>function(e,t){const n=e-t-1,a=function(e){let t=8;return 1===e?t=36:2===e?t=17:3===e?t=11:(4===e||e>3)&&(t=7.5),t}(e),s=function(e,t){let n=36;return 1===e?n=36:2===e?n=17:3===e?n=1===t?12:11:(4===e||e>3)&&(n=7.5),n}(e,n),o=function(e,t){return e<=3?36:t*e+2*(e-1)}(e,a),i=`clipPath${e}`,r=function(e,t,n){let a="";if(3===n)a=Qt(0,0,2,t,1)+Qt(0,12,2,t+1,1)+Qt(0,25,2,t,1);else for(let e=0;e<n;e++)a+=Qt(0,(t+2)*e,2,t,1);return`<clipPath id="${e}">\n <path d="${a}" />\n </clipPath>`}(i,a,e),c=function(e,t,n){return 1===n?0:2===n?0===e?0:t+2:3===n?0===e?0:1===e?12:25:(t+2)*e}(n,a,e),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,o);return{markHeight:s,clipPath:r,markTranslateY:c,trackTranslateY:l,trackHeight:o,clipPathId:i}}(t,n)),[t,n]);if((0,o.d4)((()=>{if(!a.current)return;const{trackHeight:e,trackTranslateY:t,markHeight:n,markTranslateY:o,clipPathId:i,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("#${i}")`;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(${o}px)`)}}),[s]),1===t)return o.ZP.createElement("div",{className:"pinned-message-border"},o.ZP.createElement("div",{className:"pinned-message-border-wrapper-1",ref:a}));const{trackHeight:i,trackTranslateY:r,markHeight:c,markTranslateY:l,clipPathId:d}=s;return o.ZP.createElement("div",{className:(0,Ee.Z)("pinned-message-border",t>4&&"pinned-message-border-mask")},o.ZP.createElement("div",{className:"pinned-message-border-wrapper",ref:a,style:`clip-path: url("#${d}"); width: 2px;\n height: ${i}px; transform: translateY(-${r}px);`},o.ZP.createElement("span",null),o.ZP.createElement("div",{className:"pinned-message-border-mark",style:`height: ${c}px; transform: translateY(${l}px);`})))})),tn=(0,o.X$)((e=>{let{message:t,count:n,index:s,customTitle:i,className:r,onUnpinMessage:c,onClick:l,onAllPinnedClick:u}=e;const{clickBotInlineButton:m}=(0,a.Sv)(),g=(0,Ke.Z)(),p=Yt(t),f=(0,Wt.Z)((0,d.Ti)(t,"pictogram")),v=(0,Vt.e)(g,t,Boolean(p)),[I,y,w]=(0,We.Z)(),Z=(0,o.I4)((()=>{w(),c&&c(t.id)}),[w,c,t.id]),P=(0,d.eH)(t),C=(0,o.I4)((()=>{P&&m({messageId:t.id,button:P})}),[m,P,t.id]),[b,S,M]=(0,We.Z)();return o.ZP.createElement("div",{className:(0,Ee.Z)("HeaderPinnedMessage-wrapper",r)},n>1&&o.ZP.createElement(ot.Z,{round:!0,size:"smaller",color:"translucent",className:"pin-list-button",ariaLabel:g("EventLogFilterPinnedMessages"),onClick:u},o.ZP.createElement("i",{className:"icon-pin-list"})),c&&o.ZP.createElement(ot.Z,{round:!0,size:"smaller",color:"translucent",ariaLabel:g("UnpinMessageAlertTitle"),className:"unpin-button",onClick:y},o.ZP.createElement("i",{className:"icon-close"})),o.ZP.createElement(Jt.Z,{isOpen:I,onClose:w,text:"Would you like to unpin this message?",confirmLabel:"Unpin",confirmHandler:Z}),o.ZP.createElement("div",{className:(0,Ee.Z)("HeaderPinnedMessage",b&&"no-hover"),onClick:l,dir:g.isRtl?"rtl":void 0},o.ZP.createElement(en,{count:n,index:s}),p&&function(e,t){const{width:n,height:a}=(0,zt.W7)();return o.ZP.createElement("img",{src:t||e,width:n,height:a,alt:""})}(p,f),o.ZP.createElement("div",{className:"message-text"},o.ZP.createElement("div",{className:"title",dir:"auto"},i||`${g("PinnedMessage")} ${s>0?"#"+(n-s):""}`),o.ZP.createElement("p",{dir:"auto"},v),o.ZP.createElement(Kt.Z,null)),P&&o.ZP.createElement(ot.Z,{size:"tiny",className:"inline-button",onClick:C,shouldStopPropagation:!0,onMouseEnter:h.$b?void 0:S,onMouseLeave:h.$b?void 0:M},P.text)))}));var nn=n(396),an=n(4532),sn=n(3186);function on(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"image/png";const a=e instanceof Blob?URL.createObjectURL(e):e,s=new Image;return new Promise((o=>{s.onload=()=>{rn(s,s.width*t,s.height*t,n).then((e=>{if(!e)throw new Error("Image resize failed!");return URL.createObjectURL(e)})).then(o).finally((()=>{e instanceof Blob&&URL.revokeObjectURL(a)}))},s.src=a}))}async function rn(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"image/png";if(!("createImageBitmap"in window))return cn(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 cn(e,t,n,void 0,a)}}function cn(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.5,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"image/png";const o=document.createElement("canvas"),i=o.getContext("2d"),r=document.createElement("canvas"),c=r.getContext("2d");if(o.width=t,o.height=n,e.width*a>t){const n=1/a;let s={width:Math.floor(e.width*a),height:Math.floor(e.height*a)};for(r.width=s.width,r.height=s.height,c.drawImage(e,0,0,s.width,s.height);s.width*a>t;)s={width:Math.floor(s.width*a),height:Math.floor(s.height*a)},c.drawImage(r,0,0,s.width*n,s.height*n,0,0,s.width,s.height);i.drawImage(r,0,0,s.width,s.height,0,0,o.width,o.height)}else i.drawImage(e,0,0,o.width,o.height);return new Promise((e=>{o.toBlob(e,s)}))}const ln=n.p+"telegram-logo-filled.67469f6dc5e301e8e0bd..svg",dn={width:200,height:200},un=115,mn=(e,t,n)=>{const a=(0,Ke.Z)(),{audio:s,voice:i}=(0,d.qp)(e),r=s?s.title||s.fileName:i?"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||i&&m,g=(0,Wt.Z)(h),p=(0,o.Ye)((()=>function(e,t,n){if(!n)return dn;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?zt.vY:void 0}(s,i,g)),[s,g,i]),{result:f}=((e,t,n)=>{const[a,s]=(0,o.eJ)(!1),[i,r]=(0,o.eJ)(),[c,l]=(0,o.eJ)(n);return(0,o.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:i,result:c}})((()=>function(e,t){if(!e)return Promise.resolve(ln);if(!t)return function(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"image/png";const s=e instanceof Blob?URL.createObjectURL(e):e,o=new Image;return new Promise((i=>{o.onload=()=>{rn(o,t,n,a).then((e=>{if(!e)throw new Error("Image resize failed!");return URL.createObjectURL(e)})).then(i).finally((()=>{e instanceof Blob&&URL.revokeObjectURL(s)}))},o.src=s}))}(e,un,un);const n=Math.min(t.width,t.height);return n<un?on(e,un/n):Promise.resolve(e)}(g,p)),[g,p],ln);return(0,o.Ye)((()=>(0,an.Of)({title:r,artist:c,album:l,artwork:[{src:f}]})),[l,c,r,f])};var hn=n(2340),gn=n(8051);const pn=(0,a.c$)(((e,t)=>{let{message:n}=t;const a=(0,c.Ur)(e,n),s=(0,c.Z1)(e,n.chatId),{volume:o,playbackRate:i,isMuted:r}=e.audioPlayer;return{sender:a,chat:s,volume:o,playbackRate:i,isMuted:r}}))((e=>{let{message:t,className:n,noUi:s,sender:i,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,Ke.Z)(),{audio:y,voice:w,video:Z}=(0,d.qp)(t),P=Boolean(w||Z),C=i?(0,d.OU)(I,i):void 0,b=ne.UV((0,d.Ti)(t,"inline")),S=mn(t,i,r),{playPause:M,stop:E,isPlaying:R,requestNextTrack:k,requestPreviousTrack:N,isFirst:T,isLast:A,setVolume:B,toggleMuted:x,setPlaybackRate:L}=(0,sn.Z)((0,nn.An)(t),(0,d.XV)(t),P?"voice":"audio",b,void 0,S,void 0,!0,void 0,void 0,(0,d.CI)(t),!0),O=P&&R;(0,o.d4)((()=>{if(O)return re.Z.disableRefresh(),()=>{re.Z.enableRefresh()}}),[O]);const U=(0,o.I4)((()=>{f({chatId:t.chatId,messageId:t.id})}),[f,t.chatId,t.id]),F=(0,o.I4)((()=>{R&&M(),v(),(0,an.Ay)(),E()}),[v,R,M,E]),$=(0,o.I4)((e=>{m({volume:e/100}),B(e/100)}),[m,B]),D=(0,o.I4)((()=>{h.$b&&!h.cj||(x(),p({isMuted:!u}))}),[u,p,x]),q=(0,o.I4)((()=>{1===l?(L(1.8),g({playbackRate:1.8})):(L(1),g({playbackRate:1}))}),[l,g,L]),j=(0,o.Ye)((()=>0===c||u?"icon-muted":c<.3?"icon-volume-1":c<.6?"icon-volume-2":"icon-volume-3"),[c,u]);if(!s)return o.ZP.createElement("div",{className:(0,Ee.Z)("AudioPlayer",n),dir:I.isRtl?"rtl":void 0},o.ZP.createElement(ot.Z,{round:!0,ripple:!h.wB,color:"translucent",size:"smaller",className:"player-button",disabled:T(),onClick:N,ariaLabel:"Previous track"},o.ZP.createElement("i",{className:"icon-skip-previous"})),o.ZP.createElement(ot.Z,{round:!0,ripple:!h.wB,color:"translucent",size:"smaller",className:(0,Ee.Z)("toggle-play","player-button",R?"pause":"play"),onClick:M,ariaLabel:R?"Pause audio":"Play audio"},o.ZP.createElement("i",{className:"icon-play"}),o.ZP.createElement("i",{className:"icon-pause"})),o.ZP.createElement(ot.Z,{round:!0,ripple:!h.wB,color:"translucent",size:"smaller",className:"player-button",disabled:A(),onClick:k,ariaLabel:"Next track"},o.ZP.createElement("i",{className:"icon-skip-next"})),o.ZP.createElement("div",{className:"AudioPlayer-content",onClick:U},y?function(e){const{title:t,performer:n,fileName:a}=e;return o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("div",{className:"title",dir:"auto"},(0,hn.Z)(t||a)),n&&o.ZP.createElement("div",{className:"subtitle",dir:"auto"},(0,hn.Z)(n)))}(y):function(e,t){return o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("div",{className:"title",dir:"auto"},t&&(0,hn.Z)(t)),o.ZP.createElement("div",{className:"subtitle",dir:"auto"},e))}(I("AttachAudio"),C),o.ZP.createElement(Kt.Z,null)),o.ZP.createElement(ot.Z,{round:!0,className:"player-button volume-button",color:"translucent",size:"smaller",ariaLabel:"Volume",noPreventDefault:!0},o.ZP.createElement("i",{className:j,onClick:D}),!h.cj&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("div",{className:"volume-slider-spacer"}),o.ZP.createElement("div",{className:"volume-slider"},o.ZP.createElement(gn.Z,{bold:!0,value:u?0:100*c,onChange:$})))),P&&o.ZP.createElement(ot.Z,{round:!0,className:(0,Ee.Z)("playback-button",1!==l&&"applied"),color:"translucent",size:"smaller",ariaLabel:"Playback Rate",ripple:!h.wB,onClick:q},o.ZP.createElement("span",{className:"playback-button-inner"},"2Х")),o.ZP.createElement(ot.Z,{round:!0,className:"player-close",color:"translucent",size:"smaller",onClick:F,ariaLabel:"Close player"},o.ZP.createElement("i",{className:"icon-close"})))}));var fn=n(172);const vn=(0,o.X$)((0,a.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,c.Z1)(e,n),s=(0,Se.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:i,usersById:r,chatsById:c}=e;const{joinGroupCall:l,subscribeToGroupCallUpdates:d}=(0,a.Sv)(),u=(0,Ke.Z)(),m=(0,o.I4)((()=>{l({chatId:t})}),[l,t]),h=null==s?void 0:s.participants,g=(0,o.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,o.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 o.ZP.createElement("div",{className:(0,Ee.Z)("GroupCallTopPane",i&&"has-pinned-offset",!n&&"is-hidden"),onClick:m},o.ZP.createElement("div",{className:"info"},o.ZP.createElement("span",{className:"title"},u("VoipGroupVoiceChat")),o.ZP.createElement("span",{className:"participants"},u("Participants",s.participantsCount||0,"i"))),o.ZP.createElement("div",{className:"avatars"},g.map((e=>{if(e)return e.user?o.ZP.createElement(fn.Z,{key:e.user.id,user:e.user}):o.ZP.createElement(fn.Z,{key:e.chat.id,chat:e.chat})}))),o.ZP.createElement(ot.Z,{round:!0,className:"join"},u("VoipChatJoin")))})));var In=n(4605);const yn=(0,o.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:i,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,Ke.Z)(),[w,Z,P]=(0,We.Z)(),[C,b]=(0,o.eJ)(!0),[S,M]=(0,o.eJ)(!0),{accessHash:E}=s||{},{isAutoArchived:R,canReportSpam:k,canAddContact:N,canBlockContact:T}=r||{},A=s&&(0,d.G9)(s),B=(0,o.I4)((()=>{l({userId:t}),R&&v({chatId:t})}),[l,R,v,t]),x=(0,o.I4)((()=>{P(),u({contactId:t,accessHash:E}),k&&C&&m({chatId:t}),S&&h({chatId:t})}),[E,u,P,h,m,k,S,C,t]),L=(0,o.I4)((()=>{I({chatId:t})}),[t,I]),O=(0,o.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 o.ZP.createElement("div",{className:(0,Ee.Z)("ChatReportPanel",n),dir:y.isRtl?"rtl":void 0},N&&o.ZP.createElement(ot.Z,{isText:!0,fluid:!0,size:"tiny",className:"UserReportPanel--Button",onClick:B},y("lng_new_contact_add")),T&&o.ZP.createElement(ot.Z,{color:"danger",isText:!0,fluid:!0,size:"tiny",className:"UserReportPanel--Button",onClick:Z},y("lng_new_contact_block")),k&&!T&&o.ZP.createElement(ot.Z,{color:"danger",isText:!0,fluid:!0,size:"tiny",className:"UserReportPanel--Button",onClick:Z},y("lng_report_spam_and_leave")),o.ZP.createElement(ot.Z,{round:!0,ripple:!0,size:"tiny",color:"translucent",onClick:L,ariaLabel:y("Close")},o.ZP.createElement("i",{className:"icon-close"})),o.ZP.createElement(Jt.Z,{isOpen:w,onClose:P,title:y("BlockUserTitle",i?(0,d.Vl)(i):(0,d.U)(y,s)),text:i?y("UserInfo.BlockConfirmationTitle",(0,d.Js)(i)):y("Chat.Confirm.ReportSpam.Channel"),isButtonsInOneRow:!0,confirmIsDestructive:!0,confirmLabel:y("Block"),confirmHandler:i?x:O},i&&o.ZP.createElement(In.Z,{label:y("DeleteThisChat"),checked:S,onCheck:M}),i&&k&&o.ZP.createElement(In.Z,{label:y("ReportChat"),checked:C,onCheck:b})))}))),wn=(0,o.X$)((0,a.c$)(((e,t)=>{let{chatId:n,threadId:a,messageListType:s}=t;const{isLeftColumnShown:o,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!==i._f){const t=(0,c.tZ)(e,n,a);p=(null==t?void 0:t.messagesCount)||0}const f={typingStatus:u,isLeftColumnShown:o,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!==i._f){const t=(0,c.qS)(e,n,a),s=t?(0,c.hj)(e,n,t):void 0,o=s?(0,c.cv)(e,s):void 0;return{...f,pinnedMessageIds:t,canUnpin:!1,topMessageSender:o}}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:b,shouldSkipHistoryAnimations:S,currentTransitionKey:M,connectionState:E,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,Ke.Z)(),F=(0,o.sO)(!0),[$,D]=(0,o.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,o.d4)((()=>{n===i._f&&b&&c&&x({chatId:t})}),[t,x,b,n,c]),(0,o.d4)((()=>{D(0)}),[l]),(0,Dt.Z)(t,q,j);const{width:V}=(0,Ot.Z)(),W=V<=s.ks,X=h.p7&&v,Y=(0,o.sO)(null),K=(0,o.sO)(!0),J=(0,o.I4)((()=>{k({id:t})}),[k,t]),Q=(0,o.I4)((e=>{N({chatId:t,messageId:e,isUnpin:!0})}),[N,t]),ee=(0,o.I4)((()=>{if(j){T({chatId:j.chatId,threadId:n,messageId:j.id});const e=(0,$t.Z)(G||1,$+1);D(e)}}),[j,T,n,G,$]),te=(0,o.I4)((()=>{A({id:t,threadId:i._f,type:"pinned"})}),[A,t]),ne=(0,o.I4)((()=>{setTimeout((()=>{F.current=!0}),450)}),[]),ae=(0,o.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===i._f&&"thread"===r&&0===M)return h.wB||X?(e.stopPropagation(),A({id:void 0})):L(),void ne();B(),ne()}}),[n,r,M,f,B,X,A,L,O,ne]),se=V>=s.ks&&V<s.jT||V>s.l3&&V<s.ks&&(!_||_>30),oe=se||V>s._m&&V<s.QU,ie=Boolean((null==z?void 0:z.canAddContact)||(null==z?void 0:z.canBlockContact)||(null==z?void 0:z.canReportSpam)),{shouldRender:re,transitionClassNames:ce}=(0,De.Z)(ie),le=(0,qt.Z)(ie?z:void 0,!0),{shouldRender:de,transitionClassNames:ue}=(0,De.Z)(Boolean(y)),me=(0,qt.Z)(y,!0),{shouldRender:he,transitionClassNames:ge}=(0,De.Z)(Boolean(j)),pe=(0,qt.Z)(j,!0),fe=(0,qt.Z)(G,!0),ve=(0,qt.Z)(m,!0),Ie=(0,qt.Z)(H),ye=he&&pe||de&&me;(0,o.d4)((()=>{const e=Y.current;if(e)return oe&&ye?void(I||se?(K.current&&(e.classList.add("tools-stacked","animated"),K.current=!1),setTimeout((()=>{e.classList.remove("animated")}),350)):(e.classList.remove("tools-stacked"),K.current=!0)):(e.classList.remove("tools-stacked","animated"),void(K.current=!0))}),[oe,ye,se,I]);const{connectionStatusText:we}=nt(U,E,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 o.ZP.createElement("div",{className:"back-button"},o.ZP.createElement(ot.Z,{round:!0,size:"smaller",color:"translucent",onClick:ae,ariaLabel:U(e?"Close":"Back")},o.ZP.createElement("div",{className:(0,Ee.Z)("animated-close-icon",!e&&"state-back")})),t&&o.ZP.createElement(He,null))}const Pe=Boolean(de&&me);return o.ZP.createElement("div",{className:"MiddleHeader",ref:Y},o.ZP.createElement(Ye.Z,{name:S?"none":"slide-fade",activeKey:M},"thread"===r&&n===i._f?o.ZP.createElement(o.ZP.Fragment,null,(W||M>0)&&Ze(X,!0),o.ZP.createElement("div",{className:"chat-info-wrapper",onClick:J},(0,d.YC)(t)?o.ZP.createElement(jt.Z,{userId:t,typingStatus:p,status:we,withDots:Boolean(we),withFullInfo:C,withMediaViewer:!0,withUpdatingStatus:!0,noRtl:!0}):o.ZP.createElement(Gt.Z,{chatId:t,typingStatus:p,status:we,withDots:Boolean(we),withMediaViewer:!0,withFullInfo:!0,withUpdatingStatus:!0,noRtl:!0}))):"thread"===r?o.ZP.createElement(o.ZP.Fragment,null,Ze(),o.ZP.createElement("h3",null,U("CommentsCount",Z,"i"))):"pinned"===r?o.ZP.createElement(o.ZP.Fragment,null,Ze(),o.ZP.createElement("h3",null,U("PinnedMessagesCount",Z,"i"))):"scheduled"===r?o.ZP.createElement(o.ZP.Fragment,null,Ze(),o.ZP.createElement("h3",null,P?U("Reminders"):U("messages",Z,"i"))):void 0),o.ZP.createElement(vn,{hasPinnedOffset:he&&Boolean(pe)||de&&Boolean(me),chatId:t}),he&&pe&&o.ZP.createElement(tn,{key:t,message:pe,count:fe||0,index:$,customTitle:Ie,className:(0,Ee.Z)(ge,Pe&&"full-width"),onUnpinMessage:ve?Q:void 0,onClick:ee,onAllPinnedClick:te}),re&&o.ZP.createElement(yn,{key:t,chatId:t,settings:le,className:ce}),o.ZP.createElement("div",{className:"header-tools"},Pe&&o.ZP.createElement(pn,{key:(0,d.Tp)(me),message:me,className:ue}),o.ZP.createElement(Ht,{chatId:t,threadId:n,messageListType:r,canExpandActions:!Pe})))})));var Zn=n(2645),Pn=n(274);function Cn(e){return"albumId"in e}function bn(e,t){let n,a=[],s={originalDate:e[0].date,datetime:(0,L._F)(1e3*e[0].date),senderGroups:[a]};const o=[s];return e.forEach(((i,r)=>{i.isInAlbum?n?(n.messages.push(i),i.content.text&&(n.mainMessage=i)):n={albumId:i.groupedId,messages:[i],mainMessage:i}:a.push(i);const c=e[r+1];if(!n||c&&c.groupedId&&c.groupedId===n.albumId||(a.push(n),n=void 0),c){const e=(0,L._F)(1e3*c.date);s.datetime!==e?(s={originalDate:c.date,datetime:e,senderGroups:[]},o.push(s),a=[],s.senderGroups.push(a)):(c.id===t||i.senderId!==c.senderId||i.isOutgoing!==c.isOutgoing||(0,d.Lo)(i)||(0,d.Lo)(c)||i.forwardInfo&&c.forwardInfo&&(i.forwardInfo.senderUserId!==c.forwardInfo.senderUserId||i.forwardInfo.fromChatId!==c.forwardInfo.fromChatId||i.forwardInfo.hiddenUserName!==c.forwardInfo.hiddenUserName)||i.inlineButtons||c.inlineButtons||c.date-i.date>600)&&(a=[],s.senderGroups.push(a))}})),o}var Sn=n(386),Mn=n(8957);var En=n(7675),Rn=n(539),kn=n(2357),Nn=n(998);var Tn=n(3657);const An=h.wZ?1e3:350,Bn=h.wB?300:500;var xn=n(7240);function Ln(e){return"number"==typeof e}function On(e,t){return e?t?238:175:t?238:100}function Un(e,t){const n=(0,d.B4)(e),a=(0,d.MF)(e),s=(0,d.O$)(e)||(0,d.F$)(e),o=(0,d.b7)(e),i=Boolean((0,d.F$)(e)),{width:r,height:c}=s?(0,zt.Eh)(s,n,a,i,t):(0,zt.GC)(o,n,a,t),l=On(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 Fn(e,t){return e.reduce(((e,t)=>e+t),t)}function $n(e,t,n){return e<t?t:e>n?n:e}function Dn(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 qn(e,t,n,a){const s=function(e){return e.map((e=>{const t=Un(e);return t.width/t.height}))}(a.messages),o=function(e){return e.map((e=>e>1.2?"w":e<.8?"n":"q")).join("")}(s),i=function(e){return e.reduce(((e,t)=>t+e),1)/e.length}(s),r=s.length,c=s.some((e=>e>2)),l=(0,zt.kc)(e,t,!1,n)-(t?2.5:0)*zt.Gw;let d;const u={ratios:s,proportions:o,averageRatio:i,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:o,maxHeight:i=4*a/3}=e;const r=function(e,t){return e.map((e=>t>1.1?$n(e,1,2.75):$n(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=Fn(r.slice(e,e+t),0);return(a-(t-1)*o)/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=Fn(t,0)+o*(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-i)*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 i=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-i:Math.round(u*n);l[v]={dimensions:{x:i,y:I,width:m,height:s},sides:d},i+=m+o,++v}I+=s+o}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,o=Math.round(Math.min(n/t[0],Math.min(n/t[1],(s-a)/2)));return[{dimensions:{x:0,y:0,width:n,height:o},sides:11},{dimensions:{x:0,y:o+a,width:n,height:o},sides:14}]}(e):"ww"===n||"qq"===n?function(e){const{ratios:t,maxWidth:n,spacing:a,maxHeight:s}=e,o=(n-a)/2,i=Math.round(Math.min(o/t[0],Math.min(o/t[1],s)));return[{dimensions:{x:0,y:0,width:o,height:i},sides:13},{dimensions:{x:o+a,y:0,width:o,height:i},sides:7}]}(e):function(e){const{ratios:t,minWidth:n,maxWidth:a,spacing:s,maxHeight:o}=e,i=Math.round(1.5*n),r=Math.min(Math.round(Math.max(.4*(a-s),(a-s)/t[0]/(1/t[0]+1/t[1]))),a-s-i),c=a-r-s,l=Math.min(o,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:o}=e,i=t,r=Math.round(Math.min((t-n)/2,a[1]*(s-n)/(a[2]+a[1]))),c=i-r-n,l=Math.max(o,Math.round(Math.min((s-n)/2,Math.min(r*a[2],c*a[1])))),d=Math.min(Math.round(i*a[0]),s-n-l);return[{dimensions:{x:0,y:0,width:d,height:i},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,o=t,i=Math.round(Math.min(o/n[0],.66*(a-s))),r=(t-s)/2,c=Math.min(a-i-s,Math.round(Math.min(r/n[1],r/n[2])));return[{dimensions:{x:0,y:0,width:o,height:i},sides:11},{dimensions:{x:0,y:i+s,width:r,height:c},sides:12},{dimensions:{x:r+s,y:i+s,width:o-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:o}=e;const i=t,r=Math.round(Math.min(i/n[0],.66*(s-a))),c=Math.round((t-2*a)/(n[1]+n[2]+n[3])),l=Math.max(o,Math.round(Math.min(.4*(t-2*a),c*n[1]))),d=Math.round(Math.max(Math.max(o,.33*(t-2*a)),c*n[3])),u=i-l-d-2*a,m=Math.min(s-r-a,c);return[{dimensions:{x:0,y:0,width:i,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:o}=e;const i=t,r=Math.round(Math.min(i*n[0],.6*(a-s))),c=Math.round((t-2*s)/(1/n[1]+1/n[2]+1/n[3])),l=Math.round(c/n[1]),d=Math.round(c/n[2]),u=i-l-d-2*s,m=Math.max(o,Math.min(a-r-s,c));return[{dimensions:{x:0,y:0,width:r,height:i},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:Dn(d)}}let jn;function Gn(e){return jn||(jn=document.createElement("span"),jn.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',jn.style.whiteSpace="nowrap",jn.style.position="absolute",jn.style.left="-999px",jn.style.opacity=".01",document.body.appendChild(jn)),jn.innerHTML=e,jn.offsetWidth}function _n(e,t,n,a,s,i){(0,o.bt)((()=>{if(n&&e.current){const t=e.current.closest(".MessageList");(0,Rn.Z)(t,e.current,s?"end":"centerOrTop",20,void 0!==a?1e3:void 0,a,void 0,i)}}),[e,t,n,a,s,i])}const Hn=3*zt.Gw,zn=Number(zt.Gw),Vn="data-is-document-group-hover";function Wn(e,t,n,s,i,r,c,l,d,u,m,g,p,f){const{setReplyingToId:v,sendDefaultReaction:I}=(0,a.Sv)(),[y,w,Z]=(0,We.Z)(),[P,C,b]=(0,We.Z)(),S=(0,o.sO)();return(0,o.d4)((()=>{if(!h.$b||i||!r||m)return;let e;return(0,ht.sf)(t.current,{selectorToPreventScroll:".MessageList",onSwipe:(t,n)=>n===ht.eM.Left&&(e||(e=Date.now()),C(),!0),onRelease:()=>{e&&(v({messageId:n}),setTimeout(b,Math.max(0,150-(Date.now()-e))),e=void 0)}})}),[t,i,n,v,C,b,r,m]),{handleMouseDown:i?void 0:function(e){(0,Sn.q)(e),d(e)},handleClick:function(t){if(i)e(t);else if(h.$b)return S.current?(clearInterval(S.current),S.current=void 0,void function(e){const{pageX:t,pageY:a}=e;I({chatId:u,messageId:n,x:t,y:a})}(t)):void(S.current=setTimeout((()=>{S.current=void 0,function(e){if(h.wZ){const t=e.target;if(!t.classList.contains("text-content")&&!t.classList.contains("Message"))return;re.Z.getIsKeyboardVisible()?setTimeout((()=>{l(e)}),350):l(e)}}(t)}),200))},handleContextMenu:i?c?Ne.Z:void 0:function(t){if(h.wZ){if(t.target.matches("a[href]")||m)return;t.preventDefault(),e()}else l(t)},handleDoubleClick:i?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:o,y:i,height:r}=t.getBoundingClientRect(),c=Math.abs(p?n-s:s+o-n)<Hn,l=Math.abs(i+r-a)<zn;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=Yn(e.currentTarget);t&&t.removeAttribute(Vn)}(e)},isSwiped:P,isQuickReactionVisible:y,handleDocumentGroupMouseEnter:Xn}}function Xn(e){const t=Yn(e.currentTarget);t&&t.setAttribute(Vn,"")}function Yn(e){let t=e;do{t=t.nextElementSibling}while(t&&!t.classList.contains("last-in-document-group"));return t}var Kn=n(5254),Jn=n(8005);const Qn=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,It.Z)(vt.gl.Extra,"ContextMenuContainer",!t);return n?o.ZP.createElement(n,e):void 0})),ea=(0,o.X$)((0,a.c$)(((e,t)=>{let{message:n}=t;const{byId:a}=e.users,s=n.senderId,{targetUserIds:o,targetChatId:i}=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:i,targetUserIds:o,targetMessage:l,isFocused:u,...u&&{focusDirection:m,noFocusHighlight:h}}}))((e=>{let{message:t,observeIntersection:n,isEmbedded:a,appearanceOrder:s=0,isLastInList:i,usersById:r,senderUser:c,senderChat:l,targetUserIds:u,targetMessage:m,targetChatId:h,isFocused:g,focusDirection:p,noFocusHighlight:f}=e;const v=(0,o.sO)(null);(0,Tn._N)(v,n),(0,Dt.Z)(t.chatId,t.replyToMessageId,m),_n(v,t.chatId,g,p,f);const I=(0,Ke.Z)(),y=s<=0,[w,Z]=(0,We.Z)(y);(0,o.d4)((()=>{y||setTimeout(Z,10*s)}),[s,Z,y]);const{transitionClassNames:P}=(0,De.Z)(w,void 0,y,!1),C=(0,o.Ye)((()=>u?u.map((e=>null==r?void 0:r[e])).filter(Boolean):void 0),[u,r]),b=(0,Jn.D)(I,t,c,l,C,m,h,{asTextWithSpoilers:a}),{isContextMenuOpen:S,contextMenuPosition:M,handleBeforeContextMenu:E,handleContextMenu:R,handleContextMenuClose:k,handleContextMenuHide:N}=(0,xn.Z)(v),T=void 0!==M;if(a)return o.ZP.createElement("span",{className:"embedded-action-message"},b);const A=(0,Ee.Z)("ActionMessage message-list-item",g&&!f&&"focused",T&&"has-menu-open",i&&"last-in-list",P);return o.ZP.createElement("div",{ref:v,id:(0,d.d0)(t.id),className:A,"data-message-id":t.id,onMouseDown:e=>{(0,Sn.q)(e),E(e)},onContextMenu:R},o.ZP.createElement("span",null,b),M&&o.ZP.createElement(Qn,{isOpen:S,anchor:M,message:t,messageListType:"thread",onClose:k,onCloseAnimationEnd:N}))}))),ta=e=>{var t;let{className:n,message:a,sender:s,title:i,customText:r,isProtected:c,observeIntersection:l,onClick:u}=e;const m=(0,o.sO)(null),h=(0,Tn.Op)(m,l),g=(0,Wt.Z)(a&&(0,d.Ti)(a,"pictogram"),!h),p=Yt(a),f=Boolean(a&&(0,d.Y5)(a)),v=(0,Ke.Z)(),I=s?(0,d.OU)(v,s):null==a||null===(t=a.forwardInfo)||void 0===t?void 0:t.hiddenUserName;return o.ZP.createElement("div",{ref:m,className:(0,Ee.Z)("EmbeddedMessage",n),onClick:a?u:void 0},p&&function(e,t,n,a){const{width:s,height:i}=(0,zt.W7)();return o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("img",{src:t||e,width:s,height:i,alt:"",className:n?"round":"",draggable:!a}),a&&o.ZP.createElement("span",{className:"protector"}))}(p,g,f,c),o.ZP.createElement("div",{className:"message-text"},o.ZP.createElement("p",{dir:"auto"},a?(0,d.Lo)(a)?o.ZP.createElement(ea,{message:a,isEmbedded:!0}):(0,Vt.e)(v,a,Boolean(p)):r||" "),o.ZP.createElement("div",{className:"message-title",dir:"auto"},(0,hn.Z)(I||i||" "))))};var na=n(2535),aa=n(4752),sa=n(8018),oa=n(8198),ia=n(7799);const ra=(0,o.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,Wt.Z)(`sticker${m}`,!m,i.IU.Lottie),p=(0,Wt.Z)(`sticker${h}`,!h,i.IU.Lottie),f=Boolean((null==r?void 0:r.reaction)===s&&g&&p),{shouldRender:v,transitionClassNames:I}=(0,De.Z)(f,void 0,!0,"slow"),y=(0,o.I4)((()=>{d({messageId:null==r?void 0:r.messageId,reaction:s})}),[null==r?void 0:r.messageId,s,d]),[w,Z,P]=(0,We.Z)(),C=!f||!w,b=(0,Ee.Z)("ReactionAnimatedEmoji",c&&"in-meta",v&&"is-animating");return o.ZP.createElement("div",{className:b},C&&o.ZP.createElement(oa.Z,{reaction:s}),v&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement(ia.Z,{key:m,id:`reaction_emoji_${m}`,className:I,size:30,animationData:g,play:!0,noLoop:!0,forceOnHeavyAnimation:!0,onLoad:Z,onEnded:P}),o.ZP.createElement(ia.Z,{key:h,id:`reaction_effect_${h}`,className:(0,Ee.Z)("effect",I),size:100,animationData:p,play:!0,noLoop:!0,forceOnHeavyAnimation:!0,onEnded:y})))})),ca=(0,o.X$)((e=>{var t;let{message:n,outgoingStatus:a,signature:s,onClick:i,withReactions:r,activeReaction:c,withReactionOffset:l,availableReactions:d,reactionMessage:u}=e;const m=(0,Ke.Z)(),[h,g]=(0,We.Z)(),p=r&&(null==u||null===(t=u.reactions)||void 0===t?void 0:t.results.filter((e=>e.count>0))),f=(0,o.Ye)((()=>{if(!h)return;const e=(0,L.SA)(1e3*n.date,m.code),t=n.isEdited&&(0,L.SA)(1e3*n.editDate,m.code),a=n.forwardInfo&&(0,L.SA)(1e3*n.forwardInfo.date,m.code);let s=e;return t&&(s+="\n",s+=m("lng_edited_date").replace("{date}",t)),a&&(s+="\n",s+=m("lng_forwarded_date").replace("{date}",a)),s}),[h,m,n]);return o.ZP.createElement("span",{className:(0,Ee.Z)("MessageMeta",l&&"reactions-offset"),dir:m.isRtl?"rtl":"ltr",onClick:i},p&&p.map((e=>o.ZP.createElement(ra,{activeReaction:c,reaction:e.reaction,isInMeta:!0,availableReactions:d}))),Boolean(n.views)&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("span",{className:"message-views"},(0,je.bi)(n.views)),o.ZP.createElement("i",{className:"icon-channelviews"})),s&&o.ZP.createElement("span",{className:"message-signature"},(0,hn.Z)(s)),o.ZP.createElement("span",{className:"message-time",title:f,onMouseEnter:g},n.isEdited&&`${m("EditedMessage")} `,(0,L.mr)(m,1e3*n.date)),a&&o.ZP.createElement(sa.Z,{status:a}))}));var la=n(692),da=n(4753);const ua=e=>{let{message:t,observeIntersection:n,observeIntersectionForPlaying:a,shouldLoop:i,lastSyncTime:r}=e;const c=(0,o.sO)(null),[l,u,m]=(0,We.Z)(),g=t.content.sticker,{isLottie:p,stickerSetId:f,isVideo:v}=g,I=h.Hh,y=f===s.$E,w=(0,Tn.Op)(c,n),Z=(0,Tn.Op)(c,a),P=g.isPreloadedGlobally?`sticker${g.id}`:(0,d.Ti)(t,"inline"),C=v&&!I&&(g.isPreloadedGlobally?`sticker${g.id}?size=m`:(0,d.Ti)(t,"pictogram")),b=(0,Wt.Z)(C),S=Yt(t),M=b||S,E=(0,Wt.Z)(P,!w,(0,d.kG)(t,"inline"),r),R=Boolean(E),[k,N]=(0,We.Z)(R),T=p?k:R,A=(0,la.Z)(T),{width:B,height:x}=(0,zt.Wr)(g),L=(0,Ee.Z)("thumbnail",!S&&"empty"),O=(0,Ee.Z)("Sticker media-inner",y&&"inactive");return(0,o.d4)((()=>{if(!v||!c.current)return;const e=c.current.querySelector("video");e&&(Z?(0,da.Z)(e):e.pause())}),[v,Z]),o.ZP.createElement("div",{ref:c,className:O,onClick:y?void 0:u},(!T||v&&!I)&&o.ZP.createElement("img",{src:M,width:B,height:x,alt:"",className:L}),!p&&!v&&o.ZP.createElement("img",{src:E,width:B,height:x,alt:"",className:(0,Ee.Z)("full-media",A)}),v&&I&&T&&o.ZP.createElement("video",{src:E,width:B,height:x,autoPlay:Z,playsInline:!0,loop:i,muted:!0}),p&&R&&o.ZP.createElement(ia.Z,{key:P,className:(0,Ee.Z)("full-media",A),id:P,animationData:E,size:B,play:Z,noLoop:!i,onLoad:N}),o.ZP.createElement(qe.Z,{isOpen:l,fromSticker:g,onClose:m}))};var ma=n(7854),ha=n(2566),ga=n(5866);function pa(e,t){return(0,ga.Z)((0,d.DH)(e),Boolean(t),h.wB&&!h.vX)}const fa={dark:{outgoing:"rgb(135,116,225)",incoming:"rgb(33,33,33)"},light:{outgoing:"rgb(238,255,222)",incoming:"rgb(255,255,255)"}};function va(e,t,n,a,s){return a?Promise.resolve(fa[s||"light"][t?"outgoing":"incoming"]):async function(e,t){const n=new Image;n.src=e,n.crossOrigin="anonymous",n.width||await new Promise((e=>{n.onload=e}));const a=document.createElement("canvas"),s=a.getContext("2d");a.width=n.width,a.height=n.height,s.drawImage(n,0,0,n.width,n.height);const o=t?n.width-1:0,i=n.height-1;return`rgba(${Array.from(s.getImageData(o,i,1,1).data).join(",")})`}(e,t)}var Ia=n(9196);const ya=e=>{let{id:t,message:n,observeIntersection:a,noAvatars:i,canAutoLoad:r,isInSelectMode:c,isSelected:l,uploadProgress:u,size:m="inline",dimensions:h,nonInteractive:g,shouldAffectAppendix:p,isDownloading:f,isProtected:v,withAspectRatio:I,theme:y,onClick:w,onCancelUpload:Z}=e;const P=(0,o.sO)(null),C=((0,d.O$)(n)||(0,d.F$)(n)).blobUrl,b=(0,Tn.Op)(P,a),[S,M]=(0,o.eJ)(r),E=S&&b,{mediaData:R,loadProgress:k}=(0,ha.Z)((0,d.Ti)(n,m),!E),N=C||R,T=pa(n,N),{loadProgress:A}=(0,ha.Z)((0,d.Ti)(n,"download"),!f),{isUploading:B,isTransferring:x,transferProgress:L}=(0,d.Sc)(n,u||(f?A:k),E&&!N),O=!1===(0,Ft.Z)(S),U=(0,la.Z)(N),{shouldRender:F,transitionClassNames:$}=(0,De.Z)(x,void 0,O,"slow"),{shouldRender:D,transitionClassNames:q}=(0,De.Z)(!N&&!S),j=(0,o.I4)((()=>{B?Z&&Z(n):N?w&&w(n.id):M((e=>!e))}),[N,B,n,Z,w]),G=(0,d.B4)(n);(0,o.bt)((()=>{if(!p)return;const e=P.current.closest(".message-content");N?va(N,G,0,l,y).then((t=>{e.style.setProperty("--appendix-bg",t),e.setAttribute(s.s2,"")})):e.classList.add("has-appendix-thumb")}),[N,G,p,c,l,y]);const{width:_,height:H,isSmall:z}=h||Un(n,i),V=(0,Ee.Z)("media-inner",!B&&!g&&"interactive",z&&"small-image",_===H&&"square-image"),W=I?`aspect-ratio: ${(_/H).toFixed(3)}/ 1`:"",X=h?`width: ${_}px; height: ${H}px; left: ${h.x}px; top: ${h.y}px;${W}`:"";return o.ZP.createElement("div",{id:t,ref:P,className:V,style:X,onClick:B?void 0:j},o.ZP.createElement("canvas",{ref:T,className:"thumbnail",style:`width: ${_}px; height: ${H}px;${W}`}),o.ZP.createElement("img",{src:N,className:`full-media ${U}`,width:_,height:H,alt:"",draggable:!v}),v&&o.ZP.createElement("span",{className:"protector"}),F&&!D&&o.ZP.createElement("div",{className:`media-loading ${$}`},o.ZP.createElement(Ia.Z,{progress:L,onClick:B?j:void 0})),D&&o.ZP.createElement("i",{className:(0,Ee.Z)("icon-download",q)}),x&&o.ZP.createElement("span",{className:"message-transfer-progress"},Math.round(100*L),"%"))};var wa=n(2019),Za=n(6898);function Pa(e,t){var n;const a=(0,o.sO)(null===(n=e.current)||void 0===n?void 0:n.paused),s=(0,o.sO)();s.current=t;const i=(0,o.I4)((()=>{e.current&&(a.current=!e.current.paused,a.current&&e.current.pause())}),[e]),r=(0,o.I4)((()=>{e.current&&a.current&&s.current&&document.body.contains(e.current)&&(0,da.Z)(e.current)}),[e]),c=(0,o.I4)((()=>{(0,M.T2)(r)}),[r]);(0,Te.Z)(i,c),(0,Me.ZP)(i,r)}function Ca(){return Ca=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},Ca.apply(this,arguments)}const ba=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,withAspectRatio:y}=e;const w=(0,o.sO)(null),Z=(0,o.sO)(null),P=(0,d.b7)(s)||(0,d.Cg)(s),C=P.blobUrl,b=(0,Tn.Op)(w,r),[S,M]=(0,o.eJ)(l),E=Boolean(S&&b&&h),[R,k]=(0,o.eJ)(u),N=(0,Wt.Z)((0,d.Ti)(s,"pictogram"),!(b&&h),(0,d.kG)(s,"pictogram"),h),T=(0,la.Z)(N),{mediaData:A,loadProgress:B}=(0,ha.Z)((0,d.Ti)(s,"inline"),!E,(0,d.kG)(s,"inline"),h),x=C||A,O=Boolean(b&&x),U=pa(s,N),{loadProgress:F}=(0,ha.Z)((0,d.Ti)(s,"download"),!v,i.IU.BlobUrl,h),{isBuffered:$,bufferingHandlers:D}=(0,wa.Z)(!l),{isUploading:q,isTransferring:j,transferProgress:G}=(0,d.Sc)(s,m||(v?F:B),E&&!$||v),_=!1===(0,Ft.Z)(S),{shouldRender:H,transitionClassNames:z}=(0,De.Z)(j,void 0,_),{shouldRender:V,transitionClassNames:W}=(0,De.Z)(S&&!R&&!H),[X,Y]=(0,o.eJ)(0),K=(0,o.I4)((e=>{Y(Math.max(0,e.currentTarget.currentTime-1))}),[]),J=(null===(t=Z.current)||void 0===t?void 0:t.duration)||P.duration||0,Q=(0,d.B4)(s),ee=(0,d.MF)(s),{width:te,height:ne}=g||(0,zt.GC)(P,Q,ee,c);Pa(Z,O),(0,Za.Z)(Z,[O]);const ae=(0,o.I4)((()=>{q?f&&f(s):v?(0,a.Sv)().cancelMessageMediaDownload({message:s}):x?x&&!R?(k(!0),Z.current.play()):p&&p(s.id):M((e=>!e))}),[q,v,x,R,p,f,s]),se=(0,Ee.Z)("media-inner dark",!q&&"interactive"),oe=y?`aspect-ratio: ${(te/ne).toFixed(3)}/ 1`:"",ie=g?`width: ${te}px; height: ${ne}px; left: ${g.x}px; top: ${g.y}px;${oe}`:"";return o.ZP.createElement("div",{ref:w,id:n,className:se,style:ie,onClick:q?void 0:ae},o.ZP.createElement("canvas",{ref:U,className:"thumbnail",style:`width: ${te}px; height: ${ne}px;${oe}`}),o.ZP.createElement("img",{src:N,className:(0,Ee.Z)("thumbnail",T),style:`width: ${te}px; height: ${ne}px;${oe}`,alt:"",draggable:!I}),O&&o.ZP.createElement("video",Ca({ref:Z,className:"full-media",width:te,height:ne,autoPlay:R,muted:!0,loop:!0,playsInline:!0},D,{draggable:!I,onTimeUpdate:K,style:oe}),o.ZP.createElement("source",{src:x})),I&&o.ZP.createElement("span",{className:"protector"}),V&&o.ZP.createElement("i",{className:(0,Ee.Z)("icon-large-play",W)}),H&&o.ZP.createElement("div",{className:(0,Ee.Z)("media-loading",z)},o.ZP.createElement(Ia.Z,{progress:G,onClick:ae})),!S&&o.ZP.createElement("i",{className:"icon-download"}),j?o.ZP.createElement("span",{className:"message-transfer-progress"},q||v?`${Math.round(100*G)}%`:"..."):o.ZP.createElement("div",{className:"message-media-duration"},P.isGif?"GIF":(0,L.k9)(Math.max(J-X,0))))};var Sa=n(6272);const Ma=(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:i}=(0,a.Sv)(),{firstName:r,lastName:c,phoneNumber:l,userId:d}=t,u="0"!==d,m=(0,o.I4)((()=>{i({id:d})}),[i,d]);return o.ZP.createElement("div",{className:(0,Ee.Z)("Contact",u&&"interactive"),onClick:u?m:void 0},o.ZP.createElement(fn.Z,{size:"large",user:n,text:r||c}),o.ZP.createElement("div",{className:"contact-info"},o.ZP.createElement("div",{className:"contact-name"},r," ",c),o.ZP.createElement("div",{className:"contact-phone"},(0,Sa.WZ)(s,l))))}));var Ea=n(8974),Ra=n(1218),ka=n(4434),Na=n(6937);function Ta(e,t){return t>0?(e/t*100).toFixed():0}const Aa=e=>{let{answer:t,voteResults:n,totalVoters:a,maxVotersCount:s,correctResults:i,shouldAnimate:r}=e;const c=n&&n.find((e=>e.option===t.option)),l=0===i.length||-1!==i.indexOf(t.option),d=i.length>0&&l||(null==c?void 0:c.isChosen),u=c?Ta(c.votersCount,a||0):0,[m,h]=(0,o.eJ)(r?0:u),g=(0,o.sO)(null),p=c?Ta(c.votersCount,s||0):0,f=m<u;if((0,o.d4)((()=>{r&&h(u)}),[r,u]),(0,o.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 o.ZP.createElement("div",{className:"PollOption",dir:"ltr"},o.ZP.createElement("div",{className:"poll-option-share "+("100"===u?"limit-width":"")},u,"%",d&&o.ZP.createElement("span",{className:(0,Ee.Z)("poll-option-chosen",!l&&"wrong",r&&"animate")},o.ZP.createElement("i",{className:l?"icon-check":"icon-close"}))),o.ZP.createElement("div",{className:"poll-option-right"},o.ZP.createElement("div",{className:"poll-option-text",dir:"auto"},(0,hn.Z)(t.text)),o.ZP.createElement("div",{className:(0,Ee.Z)("poll-option-answer",d&&!l&&"wrong")},o.ZP.createElement("div",{className:"poll-option-corner",ref:g}),o.ZP.createElement("div",{className:"poll-option-line",style:v}))))},Ba=(0,o.X$)((0,a.c$)(((e,t)=>{let{poll:n}=t;const{recentVoterIds:a}=n.results,{serverTimeOffset:s,users:{byId:o}}=e;return a&&0!==a.length?{recentVoterIds:a,usersById:o,serverTimeOffset:s}:{}}))((e=>{let{message:t,poll:n,recentVoterIds:s,usersById:i,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,o.eJ)(!1),[v,I]=(0,o.eJ)([]),[y,w]=(0,o.eJ)(!1),[Z,P]=(0,o.eJ)(!1),[C,b]=(0,o.eJ)(!h.closed&&h.closeDate&&h.closeDate>0?Math.min(h.closeDate-Math.floor(Date.now()/1e3)+c,h.closePeriod):0),S=(0,o.sO)(null),{results:M,totalVoters:E}=g,R=M&&M.some((e=>e.isChosen)),k=!h.closed&&!R,N=!k&&h.isPublic&&Number(g.totalVoters)>0,T=k&&h.multipleChoice,A=M?Math.max(...M.map((e=>e.votersCount))):E,B=M?M.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,o.d4)((()=>{p&&n.results.results&&n.results.results.some((e=>e.isChosen))&&f(!1)}),[p,n.results.results]),(0,o.d4)((()=>{C>0&&setTimeout((()=>b(C-1)),1e3);const e=S.current;if(e){const t=12*Math.PI,n=e.lastElementChild,a=e.firstElementChild;if(C<=5&&e.classList.add("hurry-up"),n&&a){const e=(h.closePeriod-C)/h.closePeriod*t;a.textContent=(0,L.k9)(C),n.firstElementChild.setAttribute("stroke-dashoffset",`-${e}`)}else e.innerHTML=`\n <span>${(0,L.k9)(C)}</span>\n <svg width="16px" height="16px">\n <circle cx="8" cy="8" r="6" class="poll-countdown-progress" transform="rotate(-90, 8, 8)"\n stroke-dasharray="${t} ${t}"\n stroke-dashoffset="0"\n />\n </svg>`}}),[C,h.closePeriod]),(0,o.d4)((()=>{h.quiz&&(C<=0||R&&!h.closed)&&l({chatId:m,messageId:u})}),[m,C,R,l,u,h.closed,h.quiz]),(0,o.d4)((()=>{let e;return h.quiz&&!h.closed&&h.closePeriod&&h.closePeriod>0&&(e=window.setTimeout((()=>{l({chatId:m,messageId:u})}),1e3*h.closePeriod)),()=>{e&&window.clearTimeout(e)}}),[k,m,l,u,h.closePeriod,h.closed,h.quiz]);const O=(0,o.Ye)((()=>s?s.reduce(((e,t)=>{const n=i[t];return n&&e.push(n),e}),[]):[]),[i,s]),U=(0,o.I4)((e=>{I([e]),f(!0),P(!0),r([e])}),[r]),F=(0,o.I4)((e=>{I(e)}),[]),$=(0,o.I4)((()=>{f(!0),P(!0),r(v)}),[r,v]),D=(0,o.I4)((()=>{d({chatId:m,messageId:u})}),[m,u,d]),q=(0,o.I4)((()=>{w(!0)}),[]),j=(0,o.I4)((()=>{w(!1),P(!1)}),[]);(0,o.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,Ke.Z)();return o.ZP.createElement("div",{className:"Poll",dir:G.isRtl?"auto":"ltr"},y&&n.results.solution&&o.ZP.createElement(Na.Z,{message:(0,Ea.H)(n.results.solution,n.results.solutionEntities),duration:5e3,onDismiss:j,containerId:"#middle-column-portals"}),o.ZP.createElement("div",{className:"poll-question"},(0,hn.Z)(h.question,["emoji","br"])),o.ZP.createElement("div",{className:"poll-type"},G(function(e){return void 0===e.isPublic?" ":e.quiz?e.isPublic?"QuizPoll":"AnonymousQuizPoll":e.closed?"FinalResults":e.isPublic?"PublicPoll":"AnonymousPoll"}(h)),O.length>0&&o.ZP.createElement("div",{className:"poll-recent-voters"},O.map((e=>o.ZP.createElement(fn.Z,{size:"micro",user:e})))),C>0&&k&&o.ZP.createElement("div",{ref:S,className:"poll-countdown"}),h.quiz&&n.results.solution&&!k&&o.ZP.createElement(ot.Z,{round:!0,size:"tiny",color:"translucent",className:"poll-quiz-help",disabled:y,onClick:q,ariaLabel:"Show Solution"},o.ZP.createElement("i",{className:"icon-lamp"}))),k&&o.ZP.createElement("div",{className:"poll-answers"},T?o.ZP.createElement(Ra.Z,{options:x,onChange:F,disabled:t.isScheduled||p,loadingOptions:p?v:void 0,round:!0}):o.ZP.createElement(ka.Z,{name:`poll-${u}`,options:x,onChange:U,disabled:t.isScheduled||p,loadingOption:p?v[0]:void 0})),!k&&o.ZP.createElement("div",{className:"poll-results"},h.answers.map((function(e){return o.ZP.createElement(Aa,{key:e.option,shouldAnimate:Z,answer:e,voteResults:M,totalVoters:E,maxVotersCount:A,correctResults:B})}))),!N&&!T&&o.ZP.createElement("div",{className:"poll-voters-count"},function(e,t,n){return n?e(t?"Answer":"Vote",n,"i"):e(t?"Chat.Quiz.TotalVotesEmpty":"Chat.Poll.TotalVotesResultEmpty")}(G,h.quiz,g.totalVoters)),T&&o.ZP.createElement(ot.Z,{isText:!0,disabled:0===v.length,size:"tiny",onClick:$},G("PollSubmitVotes")),N&&o.ZP.createElement(ot.Z,{isText:!0,size:"tiny",onClick:D},G("PollViewResults")))})));var xa=n(8035),La=n(88);const Oa=(0,o.X$)((e=>{let{message:t,observeIntersection:n,noAvatars:a,canAutoLoad:s,canAutoPlay:i,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}=Un(t);f=e===n}const v=(0,o.I4)((()=>{h()}),[h]);if(!p)return;const{siteName:I,url:y,displayUrl:w,title:Z,description:P,photo:C,video:b}=p,S=(C||b)&&h&&!f,M=(0,xa.Z)(P,170),E=(0,Ee.Z)("WebPage",r&&"in-preview",f&&"with-square-photo",!C&&!b&&!r&&"without-media",b&&"with-video");return o.ZP.createElement("div",{className:E,"data-initial":(I||w)[0],dir:"auto"},C&&!b&&o.ZP.createElement(ya,{message:t,observeIntersection:n,noAvatars:a,canAutoLoad:s,size:f?"pictogram":"inline",nonInteractive:!S,onClick:S?v:void 0,onCancelUpload:g,isDownloading:l,isProtected:u,withAspectRatio:!0,theme:m}),o.ZP.createElement("div",{className:"WebPage-text"},o.ZP.createElement(La.Z,{className:"site-name",url:y,text:I||w}),!r&&Z&&o.ZP.createElement("p",{className:"site-title"},(0,hn.Z)(Z)),M&&o.ZP.createElement("p",{className:"site-description"},(0,hn.Z)(M,["emoji","br"]))),!r&&b&&o.ZP.createElement(ba,{message:t,observeIntersection:n,noAvatars:a,canAutoLoad:s,canAutoPlay:i,lastSyncTime:c,onClick:S?v:void 0,onCancelUpload:g,isDownloading:l,isProtected:u,withAspectRatio:!0}))}));var Ua=n(9937);const Fa=(0,o.X$)((e=>{let{message:t,shouldAffectAppendix:n,isInSelectMode:a,isSelected:i,theme:r}=e;const c=(0,o.sO)(null),l=(0,Ke.Z)(),u=(0,d.eO)(t),{title:m,text:h,amount:g,currency:p,isTest:f,photoUrl:v,photoWidth:I,photoHeight:y}=u;(0,o.bt)((()=>{if(!n)return;const e=c.current.closest(".message-content");v&&va(v,!1,0,i,r).then((t=>{e.style.setProperty("--appendix-bg",t),e.setAttribute(s.s2,"")}))}),[n,v,a,i,r]);const w=y&&I?`aspect-ratio: ${I/y};`:void 0;return o.ZP.createElement("div",{ref:c,className:"Invoice"},m&&o.ZP.createElement("p",{className:"title"},(0,hn.Z)(m)),h&&o.ZP.createElement("div",null,(0,hn.Z)(h,["emoji","br"])),o.ZP.createElement("div",{className:"description "+(v?"has-image":"")},v&&o.ZP.createElement("img",{className:"invoice-image",src:v,alt:"",style:w,crossOrigin:"anonymous"}),o.ZP.createElement("p",{className:"description-text"},(0,Ua.x)(g,p,l.code),f&&o.ZP.createElement("span",null,l("PaymentTestInvoice")))))}));var $a=n(8183);const Da=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"})),qa=["#e56cd5","#f89440","#9986ff","#44b3f5","#6dc139","#ff5d5a","#f87aad","#6e82b3","#f5ba21"],ja=e=>{let{variant:t="rectangular",animation:n="wave",width:a,height:s,className:i}=e;const r=(0,Ee.Z)("Skeleton",t,n,i),c=(a?`width: ${a}px;`:"")+(s?`height: ${s}px;`:"");return o.ZP.createElement("div",{className:r,style:c})},Ga=n.p+"map-pin.7b3c3e60ee24795e4bd2..svg",_a=1e-4,Ha={width:400,height:300,zoom:16,scale:2},za={__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>'},Va=(0,o.X$)((e=>{let{message:t,peer:n,lastSyncTime:a,isInSelectMode:i,isSelected:r,theme:c,serverTimeOffset:l}=e;const u=(0,o.sO)(null),m=(0,o.sO)(null),h=(0,Ke.Z)(),g=(0,Fe.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,o.eJ)(I),b="venue"===v||"geoLive"===v&&!w,{width:S,height:M,zoom:E,scale:R}=Ha,k=Boolean(a)&&(0,d.k6)(P,S,M,E,R),N=(0,Wt.Z)(k),T=(0,Ft.Z)(N),A=N||T,B=n&&(0,d.YC)(n.id),x=n&&B?n:void 0,O=n&&!B?n:void 0,U=(0,d.B4)(t),F=(0,o.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,E)}),[v,P,E]),$=(0,o.I4)((e=>{if("geoLive"!==v)return;const n=24*Math.PI,a=e.lastElementChild,s=e.firstElementChild,o=t.date+f.period-(0,p.b)(l),i=(1-o/f.period)*n,r=(0,L.mB)(h,1e3*o);a&&s?(s.textContent=r,a.firstElementChild.setAttribute("stroke-dashoffset",`-${i}`)):e.innerHTML=`\n <span class="geo-countdown-text">${r}</span>\n <svg width="32px" height="32px">\n <circle cx="16" cy="16" r="12" class="geo-countdown-progress" transform="rotate(-90, 16, 16)"\n stroke-dasharray="${n} ${n}"\n stroke-dashoffset="-${i}"\n />\n </svg>`}),[v,t.date,f,l,h]);return(0,o.bt)((()=>{m.current&&$(m.current)}),[$]),(0,o.bt)((()=>{if(b)return;const e=u.current.closest(".message-content");A&&va(A,U,0,r,c).then((t=>{e.style.setProperty("--appendix-bg",t),e.classList.add("has-appendix-thumb"),e.setAttribute(s.s2,"")}))}),[U,i,r,c,A,b]),(0,o.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,$a.Z)((()=>{g()}),w?void 0:1e3*(Z||0)),(0,kn.Z)((()=>{const e=m.current;e&&$(e)}),Z?1e3:void 0),o.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,E);null===(e=window.open(t,"_blank"))||void 0===e||e.focus()}},o.ZP.createElement("div",{className:"map-wrapper"},A?o.ZP.createElement("img",{className:"full-media map",src:A,alt:"Location on a map",width:Ha.width,height:Ha.height}):o.ZP.createElement(ja,{width:S,height:M}),function(){if(A)return o.ZP.createElement(o.ZP.Fragment,null,Boolean(F)&&!w&&o.ZP.createElement("div",{className:"location-accuracy",style:`width: ${2*F}px; height: ${2*F}px`}),function(){const e=(0,Ee.Z)("pin",v,w&&"expired");if("geoLive"===v)return o.ZP.createElement("div",{className:e,dangerouslySetInnerHTML:za},o.ZP.createElement(fn.Z,{chat:O,user:x,className:"location-avatar"}),void 0!==f.heading&&o.ZP.createElement("div",{className:"direction",style:`--direction: ${f.heading}deg`}));if("venue"===v){const t=function(e){return e?Da.get(e)||Da.get(e.split("/")[0])||qa[(t=e,t.split("").reduce(((e,t)=>(e<<5)-e+t.charCodeAt(0)|0),0)%qa.length)]:"#008df2";var t}(f.venueType),n=function(e){return e?`https://ss3.4sqi.net/img/categories_v2/${e}_88.png`:""}(f.venueType);return o.ZP.createElement("div",{className:e,dangerouslySetInnerHTML:za,style:`--pin-color: ${t}`},o.ZP.createElement("img",{src:n,className:"venue-icon",alt:""}))}return o.ZP.createElement("img",{className:e,src:Ga,alt:""})}())}()),function(){if(b)return"venue"===v?o.ZP.createElement("div",{className:"location-info"},o.ZP.createElement("div",{className:"location-info-title"},f.title),o.ZP.createElement("div",{className:"location-info-subtitle"},f.address)):"geoLive"===v?o.ZP.createElement("div",{className:"location-info"},o.ZP.createElement("div",{className:"location-info-title"},h("AttachLiveLocation")),o.ZP.createElement("div",{className:"location-info-subtitle"},(0,L.dJ)(h,y,t.editDate)),!w&&o.ZP.createElement("div",{className:"geo-countdown",ref:m})):void 0}())})),Wa=(0,o.X$)((e=>{let{message:t,canAutoLoadMedia:n,lastSyncTime:s}=e;const{clickBotInlineButton:i}=(0,a.Sv)(),r=t.content.game,{title:c,description:l}=r,u=Boolean(s)&&(0,d.N)(r),m=Boolean(s)&&(0,d.Wc)(r),h=(0,Wt.Z)(u,!n),g=(0,Wt.Z)(m,!n);return o.ZP.createElement("div",{className:"Game"},o.ZP.createElement("div",{className:"preview",style:"width: 480px; height: 270px",onClick:()=>{i({messageId:t.id,button:t.inlineButtons[0][0]})}},!h&&!g&&o.ZP.createElement(ja,{className:"skeleton preview-content"}),h&&o.ZP.createElement("img",{className:"preview-content",src:h,alt:c}),g&&o.ZP.createElement("video",{className:"preview-content",playsInline:!0,muted:!0,autoPlay:!0,loop:!0,src:g})),o.ZP.createElement("div",{className:"title"},c),!(0,d.UD)(t)&&o.ZP.createElement("div",{className:"description"},l))}));function Xa(e){return(0,o.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:i,dimensions:r}=t,{toggleMessageSelection:c}=(0,a.Sv)(),l=(0,o.I4)((e=>{e.stopPropagation(),c({messageId:i.id,withShift:null==e?void 0:e.shiftKey})}),[c,i]),d=(0,o.Ye)((()=>{const{dimensions:e,onClick:a}=t;return{...t,isInSelectMode:n,isSelected:s,dimensions:{...e,x:0,y:0},onClick:n?void 0:a}}),[t,n,s]);return o.ZP.createElement("div",{className:(0,Ee.Z)("album-item-select-wrapper",s&&"is-selected"),style:r?`left: ${r.x}px; top: ${r.y}px;`:"",onClick:n?l:void 0},n&&o.ZP.createElement("div",{className:"message-select-control"},s&&o.ZP.createElement("i",{className:"icon-select"})),o.ZP.createElement(e,d))})))}const Ya=Xa(ya),Ka=Xa(ba),Ja=(0,a.c$)(((e,t)=>{let{album:n}=t;const{chatId:a}=n.mainMessage,s=(0,c.Pu)(e),o=(0,c.xs)(e,a);return{theme:s,uploadsById:e.fileUploads.byMessageLocalId,activeDownloadIds:o}}))((e=>{let{album:t,observeIntersection:n,hasCustomAppendix:s,lastSyncTime:i,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,o.I4)((e=>{f({chatId:e.chatId,messageId:e.id})}),[f]),{width:y,height:w}=u.containerStyle;return o.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],b=(0,c.bH)((0,a.Rd)(),e),S=(0,c.__)((0,a.Rd)(),e);if(f){const a=s&&(r?t===v-1:Boolean(8&C&&4&C));return o.ZP.createElement(Ya,{id:`album-media-${(0,d.d0)(e.id)}`,message:e,observeIntersection:n,canAutoLoad:b,shouldAffectAppendix:a,uploadProgress:Z,dimensions:P,isProtected:l,onClick:m,onCancelUpload:I,isDownloading:g.includes(e.id),theme:p})}if(y)return o.ZP.createElement(Ka,{id:`album-media-${(0,d.d0)(e.id)}`,message:e,observeIntersection:n,canAutoLoad:b,canAutoPlay:S,uploadProgress:Z,lastSyncTime:i,dimensions:P,isProtected:l,onClick:m,onCancelUpload:I,isDownloading:g.includes(e.id),theme:p})})))}));function Qa(){return Qa=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},Qa.apply(this,arguments)}let es;const ts=e=>{let{message:t,observeIntersection:n,canAutoLoad:s,lastSyncTime:r,isDownloading:c}=e;const l=(0,o.sO)(null),u=(0,o.sO)(null),m=(0,o.sO)(null),h=t.content.video,g=(0,Tn.Op)(l,n),[p,f]=(0,o.eJ)(s),v=Boolean(p&&g&&r),{mediaData:I,loadProgress:y}=(0,ha.Z)((0,d.Ti)(t,"inline"),!v,(0,d.kG)(t,"inline"),r),{loadProgress:w}=(0,ha.Z)((0,d.Ti)(t,"download"),!c,i.IU.BlobUrl,r),Z=pa(t,I),{isBuffered:P,bufferingHandlers:C}=(0,wa.Z)(),b=p&&!P||c,S=!1===(0,Ft.Z)(p),E=(0,la.Z)(I),{shouldRender:R,transitionClassNames:k}=(0,De.Z)(b||!P,void 0,S),[N,T]=(0,o.eJ)(!1),[A,B]=(0,o.eJ)(0);(0,o.d4)((()=>{if(!N)return;const e=zt.Rj/2,t=2*(e-6)*Math.PI,n=t-A*t,a=m.current,s=u.current,o=s.firstElementChild;o?o.firstElementChild.setAttribute("stroke-dashoffset",n.toString()):s.innerHTML=`\n <svg width="${zt.Rj}px" height="${zt.Rj}px">\n <circle cx="${e}" cy="${e}" r="${e-6}" class="progress-circle"\n transform="rotate(-90, ${e}, ${e})"\n stroke-dasharray="${t} ${t}"\n stroke-dashoffset="${t}"\n />\n </svg>`,B(a.currentTime/a.duration)}),[N,A]);const x=Boolean(I&&g),O=(0,o.I4)((()=>{m.current&&(T(!1),B(0),(0,da.Z)(m.current),(0,M.T2)((()=>{u.current.innerHTML=""})))}),[]),U=(0,o.I4)((()=>{var e;null===(e=es)||void 0===e||e(),es=O}),[O]);(0,o.d4)((()=>{m.current&&(x?(0,da.Z)(m.current):m.current.pause())}),[x]),Pa(m,x),(0,Za.Z)(m,[I]);const F=(0,o.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,da.Z)(e),(0,nn.Es)()):e.pause():(U(),e.pause(),e.currentTime=0,(0,da.Z)(e),(0,nn.Es)(),T(!0))}),[U,N,c,I,t]),$=(0,o.I4)((e=>{const t=e.currentTarget;B(t.currentTime/t.duration)}),[]),D=(0,Ee.Z)("full-media",E);return o.ZP.createElement("div",{ref:l,className:"RoundVideo media-inner",onClick:F},o.ZP.createElement("div",{className:"thumbnail-wrapper"},o.ZP.createElement("canvas",{ref:Z,className:"thumbnail",style:`width: ${zt.Rj}px; height: ${zt.Rj}px`})),I&&o.ZP.createElement("div",{className:"video-wrapper"},o.ZP.createElement("video",Qa({ref:m,className:D,width:zt.Rj,height:zt.Rj,autoPlay:!0,muted:!N,loop:!N,playsInline:!0,onEnded:N?O:void 0},C,{onTimeUpdate:N?$:void 0}),o.ZP.createElement("source",{src:I}))),o.ZP.createElement("div",{className:"progress",ref:u}),R&&o.ZP.createElement("div",{className:`media-loading ${k}`},o.ZP.createElement(Ia.Z,{progress:c?w:y})),!I&&!p&&o.ZP.createElement("i",{className:"icon-download"}),o.ZP.createElement("div",{className:"message-media-duration"},N?(0,L.k9)(m.current.currentTime):(0,L.k9)(h.duration),(!N||m.current.paused)&&o.ZP.createElement("i",{className:"icon-muted"})))},ns=e=>{let{message:t,onClick:n}=e;const a=(0,Ke.Z)();return o.ZP.createElement("div",{className:"InlineButtons"},t.inlineButtons.map((e=>o.ZP.createElement("div",{className:"row"},e.map((e=>o.ZP.createElement(ot.Z,{size:"tiny",ripple:!0,disabled:"unsupported"===e.type,onClick:()=>n({messageId:t.id,button:e})},o.ZP.createElement("span",{className:"inline-button-text"},(0,hn.Z)(a(e.text))),["buy","receipt"].includes(e.type)&&o.ZP.createElement("i",{className:"icon-card"}),"url"===e.type&&!s.FS.test(e.url)&&o.ZP.createElement("i",{className:"icon-arrow-right"}),"switchBotInline"===e.type&&o.ZP.createElement("i",{className:"icon-share-filled"}),["webView","simpleWebView"].includes(e.type)&&o.ZP.createElement("i",{className:"icon-webapp"}))))))))},as=(0,o.X$)((e=>{let{threadInfo:t,disabled:n}=e;const{openChat:s}=(0,a.Sv)(),i=(0,Ke.Z)(),{threadId:r,chatId:c,messagesCount:l,lastMessageId:u,lastReadInboxMessageId:m,recentReplierIds:h}=t,g=(0,o.I4)((()=>{s({id:c,threadId:r})}),[s,c,r]),p=(0,o.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 o.ZP.createElement("div",{"data-cnt":(0,je.bi)(l),className:(0,Ee.Z)("CommentButton",f&&"has-unread",n&&"disabled"),dir:i.isRtl?"rtl":"ltr",onClick:g},o.ZP.createElement("i",{className:"icon-comments-sticker"}),(!p||0===p.length)&&o.ZP.createElement("i",{className:"icon-comments"}),p&&p.length>0&&o.ZP.createElement("div",{className:"recent-repliers",dir:i.isRtl?"rtl":"ltr"},p.map((e=>o.ZP.createElement(fn.Z,{key:e.id,size:"small",user:(0,d.YC)(e.id)?e:void 0,chat:(0,d.YC)(e.id)?void 0:e})))),o.ZP.createElement("div",{className:"label",dir:"auto"},l?i("Comments",l,"i"):i("LeaveAComment")),o.ZP.createElement("i",{className:"icon-next"}))})),ss=(0,o.X$)((e=>{let{reaction:t,message:n,activeReaction:s,availableReactions:i}=e;const{sendReaction:r}=(0,a.Sv)(),{recentReactions:c}=n.reactions,l=(0,o.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,o.I4)((()=>{r({reaction:t.isChosen?void 0:t.reaction,chatId:n.chatId,messageId:n.id})}),[n,t,r]);return o.ZP.createElement(ot.Z,{className:(0,Ee.Z)(t.isChosen&&"chosen"),size:"tiny",onClick:d},o.ZP.createElement(ra,{activeReaction:s,reaction:t.reaction,availableReactions:i}),null!=l&&l.length?o.ZP.createElement("div",{className:"avatars"},l.map((e=>o.ZP.createElement(fn.Z,{user:e,size:"micro"})))):(0,je.bi)(t.count))})),os=(0,o.X$)((e=>{let{message:t,isOutside:n,activeReaction:a,availableReactions:s,metaChildren:i}=e;return o.ZP.createElement("div",{className:(0,Ee.Z)("Reactions",n&&"is-outside")},t.reactions.results.map((e=>o.ZP.createElement(ss,{key:e.reaction,reaction:e,message:t,activeReaction:a,availableReactions:s}))),i)}));var is=n(9332),rs=n(5296);const cs=(0,o.X$)((e=>{let{localSticker:t,localEffect:n,isOwn:a,soundId:s,size:i="medium",observeIntersection:r,messageId:c,chatId:l,activeEmojiInteractions:d}=e;const{playKey:u,ref:m,style:h,width:g,handleClick:p,markAnimationLoaded:f}=(0,rs.Z)(i,l,c,s,d,a,n),v=`local_emoji_${t}`,I=(0,Tn.Op)(m,r),[y,w]=(0,o.eJ)();return(0,o.d4)((()=>{t&&(0,is.Z)(t).then((e=>{w(e)}))}),[t]),o.ZP.createElement("div",{ref:m,className:"AnimatedEmoji media-inner",style:h,onClick:p},y&&o.ZP.createElement(ia.Z,{key:v,id:v,animationData:y,size:g,quality:1,play:I&&u,forceOnHeavyAnimation:!0,noLoop:!0,onLoad:f}))})),ls=(0,o.X$)((e=>{let{phoneCall:t,message:n,chatId:s}=e;const{requestCall:i}=(0,a.Sv)(),r=(0,Ke.Z)(),{isOutgoing:c,isVideo:l,reason:d}=t,u="missed"===d,m="busy"===d&&!c,g=(0,o.I4)((()=>{i({isVideo:l,userId:s})}),[s,l,i]),p=(0,o.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,o.Ye)((()=>t.duration?(0,L.J_)(r,t.duration):void 0),[r,t.duration]),v=(0,L.mr)(r,1e3*n.date);return o.ZP.createElement("div",{className:"src-components-middle-message-MessagePhoneCall-module__root"},o.ZP.createElement(ot.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")},o.ZP.createElement("i",{className:l?"icon-video-outlined":"icon-phone"})),o.ZP.createElement("div",{className:"src-components-middle-message-MessagePhoneCall-module__info"},o.ZP.createElement("div",{className:"src-components-middle-message-MessagePhoneCall-module__reason"},r(p)),o.ZP.createElement("div",{className:"src-components-middle-message-MessagePhoneCall-module__meta"},o.ZP.createElement("i",{className:(0,Ee.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")}),o.ZP.createElement("span",{className:"src-components-middle-message-MessagePhoneCall-module__duration"},f?r("CallMessageWithDuration",[v,f]):v))))})),ds={__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>'},us={__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>'},ms=(0,o.X$)((0,a.c$)(((e,t)=>{var n;const{focusedMessage:a,forwardMessages:s,lastSyncTime:o,serverTimeOffset:i}=e,{message:r,album:l,withSenderName:u,withAvatar:m,threadId:h,messageListType:g,isLastInDocumentGroup:p}=t,{id:f,chatId:v,viaBotId:I,replyToChatId:y,replyToMessageId:w,isOutgoing:Z,threadInfo:P,forwardInfo:C}=r,b=(0,c.Z1)(e,v),S=(0,c.FM)(e,v),M=(0,d.pK)(v),E=b&&(0,d.eA)(b),R=null==b?void 0:b.username,k=!S&&(0,d.Ul)(r),N=u||m||k,T=(0,c.Ur)(e,r),A=(0,c.cv)(e,r),B=I?(0,c.dy)(e,I):void 0,x=h?(0,c.qS)(e,v,h):void 0,L=r.id===x,O=w===x,U=w&&!O?(0,c.hj)(e,M&&y?y:v,w):void 0,F=U&&(0,c.Bz)(e,U,Boolean(C)),$=(0,c.uZ)(e,r),D="thread"===g&&(l?l.messages.some((t=>(0,c._X)(e,t))):(0,c._X)(e,r)),{direction:q,noHighlight:j,isResizingContainer:G}=D&&a||{},_=s.messageIds&&s.messageIds.includes(f),{query:H}=(0,c.n5)(e)||{},z=(0,d._O)(r);let V;V=null!=l&&l.messages?l.messages.every((t=>{let{id:n}=t;return(0,c.vk)(e,n)})):(0,c.vk)(e,f);const{canReply:W}="thread"===g&&(0,c._k)(e,r,h)||{},X=(0,c.te)(e,r),Y=P?(0,c.tZ)(e,P.chatId,P.threadId)||P:void 0,K=Boolean(r.groupedId)&&!r.isInAlbum,J=K?(0,c.xH)(e,v,r.groupedId)[0]:void 0,Q=K?p?(0,c.hj)(e,v,J):void 0:r,ee=z?(0,c.CP)(e,z):void 0,te=null==b||null===(n=b.unreadReactions)||void 0===n?void 0:n.includes(r.id);return{theme:(0,c.Pu)(e),chatUsername:R,forceSenderName:k,sender:T,canShowSender:N,originSender:A,botSender:B,shouldHideReply:O,isThreadTop:L,replyMessage:U,replyMessageSender:F,isInDocumentGroup:K,isProtected:(0,c.EV)(e,r),isFocused:D,isForwarding:_,reactionMessage:Q,isChatWithSelf:S,isRepliesChat:M,isChannel:E,canReply:W,lastSyncTime:o,serverTimeOffset:i,highlight:H,isSingleEmoji:Boolean(z),animatedEmoji:z?(0,c.zB)(e,z):void 0,animatedEmojiEffect:z&&(0,d.YC)(v)?(0,c.tH)(e,z):void 0,animatedEmojiSoundId:z?(0,c.Oh)(e,z):void 0,localSticker:ee,localEffect:ee&&(0,d.YC)(v)?(0,c.cu)(ee):void 0,isInSelectMode:(0,c.CA)(e),isSelected:V,isGroupSelected:Boolean(r.groupedId)&&!r.isInAlbum&&(0,c.a6)(e,v,r.groupedId),threadId:h,isDownloading:X,isPinnedList:"pinned"===g,canAutoLoadMedia:(0,c.bH)(e,r),canAutoPlayMedia:(0,c.__)(e,r),autoLoadFileMaxSizeMb:e.settings.byKey.autoLoadFileMaxSizeMb,shouldLoopStickers:(0,c.yB)(e),threadInfo:Y,availableReactions:e.availableReactions,defaultReaction:(0,d.CI)(r)?void 0:(0,c.q6)(e,v),activeReaction:Q&&e.activeReactions[Q.id],activeEmojiInteractions:e.activeEmojiInteractions,...Z&&{outgoingStatus:(0,c.dT)(e,r,"scheduled"===g)},..."number"==typeof $&&{uploadProgress:$},...D&&{focusDirection:q,noFocusHighlight:j,isResizingContainer:G},hasUnreadReaction:te}}))((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:b,theme:S,forceSenderName:M,sender:E,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:W,serverTimeOffset:X,highlight:Y,animatedEmoji:K,localSticker:J,localEffect:Q,animatedEmojiEffect:ee,animatedEmojiSoundId:te,isInSelectMode:ne,isSelected:ae,isGroupSelected:se,threadId:oe,reactionMessage:ie,availableReactions:re,defaultReaction:ce,activeReaction:le,activeEmojiInteractions:de,messageListType:ue,isPinnedList:me,isDownloading:he,canAutoLoadMedia:ge,canAutoPlayMedia:pe,shouldLoopStickers:fe,autoLoadFileMaxSizeMb:ve,threadInfo:Ie,hasUnreadReaction:ye}=e;const{toggleMessageSelection:we,clickBotInlineButton:Ze,disableContextMenuHint:Pe,animateUnreadReaction:Ce}=(0,a.Sv)(),be=(0,o.sO)(null),Se=(0,o.sO)(null),Me=(0,o.sO)(null),Re=(0,Ke.Z)();(0,Tn._N)(Se,s);const{isContextMenuOpen:ke,contextMenuPosition:Ne,handleBeforeContextMenu:Te,handleContextMenu:Ae,handleContextMenuClose:Be,handleContextMenuHide:xe}=(0,xn.Z)(be,h.$b&&ne,!0,h.wZ);(0,o.d4)((()=>{ke&&Pe()}),[ke,Pe]);const Le=y<=0,[Oe,Ue]=(0,We.Z)(Le);(0,o.d4)((()=>{Le||setTimeout(Ue,10*y)}),[y,Ue,Le]);const{transitionClassNames:Fe}=(0,De.Z)(Oe,void 0,Le,!1),{id:$e,chatId:qe,forwardInfo:je,viaBotId:Ge}=t,_e=(0,d.CI)(t),He=(0,d.B4)(t),ze="scheduled"===ue||t.isScheduled,Ve=(0,d.ss)(t)&&!A,Xe=Boolean(Ie)&&"thread"===ue,Ye=(0,d.$D)(t),Je=J||K,Qe=(null==ie?void 0:ie.reactions)&&!(0,d.JE)(ie.reactions),et=je&&(!_||ze)&&!H&&!je.isLinkedChannelPost&&!Ye,tt=Boolean(l)&&l.messages.length>1,nt=U&&!P,at=U&&!C,st=void 0!==Ne,it=!(st||ne||G||at),rt=z&&!ze&&!F,ct=Boolean(me||je&&(je.isChannelPost||_&&!He||H)&&je.fromMessageId),lt=(0,o.I4)(((e,t)=>{we({messageId:$e,groupedId:t,...(null==e?void 0:e.shiftKey)&&{withShift:!0},...tt&&{childMessageIds:l.messages.map((e=>{let{id:t}=e;return t}))}})}),[we,$e,tt,l]),dt=R?E:void 0,ut=je&&(_||H||!dt)?k:dt,mt=je?k:dt,{handleMouseDown:ht,handleClick:gt,handleContextMenu:pt,handleDoubleClick:ft,handleContentDoubleClick:vt,handleMouseMove:It,handleSendQuickReaction:yt,handleMouseLeave:wt,isSwiped:Zt,isQuickReactionVisible:Pt,handleDocumentGroupMouseEnter:Ct}=Wn(lt,be,$e,0,Boolean(ne),Boolean(V),Boolean(F),Ae,Te,qe,st,Me,He,at),{handleAvatarClick:bt,handleSenderClick:St,handleViaBotClick:Mt,handleReplyClick:Et,handleMediaClick:Rt,handleAudioPlay:kt,handleAlbumMediaClick:Nt,handleMetaClick:Tt,handleReadMedia:At,handleCancelUpload:Bt,handleVoteSend:xt,handleGroupForward:Lt,handleForward:Ot,handleFocus:Ut,handleFocusForwarded:Ft,handleDocumentGroupSelectAll:$t}=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:b,openForwardMenu:S,focusMessageInComments:M}=(0,a.Sv)(),{id:E,forwardInfo:R,replyToMessageId:k,replyToChatId:N,replyToTopMessageId:T,groupedId:A}=n,B=(0,o.I4)((()=>{g&&v({id:g.id})}),[g,v]),x=(0,o.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,o.I4)((()=>{f&&v({id:f.id})}),[f,v]),O=(0,o.I4)((()=>{y({chatId:u&&N?N:s,threadId:r,messageId:k,replyMessageId:u&&N?void 0:E})}),[y,u,N,s,r,k,E]),U=(0,o.I4)((()=>{w({chatId:s,threadId:r,messageId:E,origin:d?m.bZ.ScheduledInline:m.bZ.Inline})}),[s,r,E,w,d]),F=(0,o.I4)((()=>{Z({chatId:s,messageId:E})}),[s,E,Z]),$=(0,o.I4)((e=>{w({chatId:s,threadId:r,messageId:e,origin:d?m.bZ.ScheduledAlbum:m.bZ.Album})}),[s,r,w,d]),D=(0,o.I4)((()=>{P({messageIds:[E]})}),[E,P]),q=(0,o.I4)((()=>{C({chatId:s,messageId:E})}),[C,s,E]),j=(0,o.I4)((e=>{b({chatId:s,messageId:E,options:e})}),[s,E,b]),G=(0,o.I4)((()=>{S({fromChatId:s,groupedId:A})}),[S,s,A]),_=(0,o.I4)((()=>{if(h&&h.messages){const e=h.messages.map((e=>{let{id:t}=e;return t}));S({fromChatId:s,messageIds:e})}else S({fromChatId:s,messageIds:[E]})}),[h,S,s,E]),H=(0,o.I4)((()=>{y({chatId:s,threadId:i._f,messageId:E})}),[y,s,E]),z=(0,o.I4)((()=>{c?y({chatId:R.fromChatId,groupedId:A,groupedChatId:s}):u&&N?M({chatId:N,threadId:T,messageId:R.fromMessageId}):y({chatId:R.fromChatId,messageId:R.fromMessageId})}),[c,u,N,y,R,A,s,M,T]),V=(0,o.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}}(Re,lt,t,qe,oe,U,et,ze,H,l,ut,mt,N),qt=(0,Ee.Z)("Message message-list-item",w&&"first-in-group",F&&"is-protected",Z&&"last-in-group",P&&"first-in-document-group",C&&"last-in-document-group",b&&"last-in-list",He&&"own",Boolean(t.views)&&"has-views",t.isEdited&&"was-edited",Ve&&"has-reply",st&&"has-menu-open",$&&!q&&"focused",G&&"is-forwarding",t.isDeleting&&"is-deleting",U&&"is-in-document-group",tt&&"is-album",t.hasUnreadMention&&"has-unread-mention",ae&&"is-selected",ne&&"is-in-selection-mode",T&&"is-thread-top",Boolean(t.inlineButtons)&&"has-inline-buttons",Zt&&"is-swiped",Fe,Boolean(le)&&"has-active-reaction"),{text:jt,photo:Gt,video:_t,audio:Ht,voice:Wt,document:Xt,sticker:Yt,contact:Kt,poll:Jt,webPage:Qt,invoice:en,location:tn,action:nn,game:an}=(0,d.qp)(t),{phoneCall:sn}=nn||{},on=Ie&&!at&&"thread"===ue&&!I,rn=!h.$b&&!sn&&!ne&&ce&&!at,cn=function(e){let{hasReply:t,customShape:n,isLastInGroup:a,asForwarded:s,hasThread:o,forceSenderName:i,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,invoice:P}=(0,d.qp)(e),C=["message-content"],b=h||g||Z,S=m||"venue"===(null==Z?void 0:Z.type)||u,M=b&&!S,E=Boolean(e.viaBotId);return Ln(n)?C.push(`emoji-only emoji-only-${n}`):S&&C.push("text"),c&&C.push("has-action-button"),n&&(C.push("custom-shape"),null!=g&&g.isRound&&C.push("round"),r&&C.push("has-comments")),b?C.push("media"):p?C.push("audio"):f?C.push("voice"):v?C.push("document"):w?C.push("contact"):I?C.push("poll"):y&&(C.push("web-page"),(y.photo||y.video)&&C.push("media")),P&&C.push("invoice"),s&&C.push("is-forwarded"),t&&C.push("is-reply"),o&&C.push("has-replies"),l&&C.push("has-reactions"),E&&C.push("is-via-bot"),i&&C.push("force-sender-name"),n||(C.push("has-shadow"),b&&r&&C.push("has-background"),(t||s||!M||E||i)&&C.push("has-solid-background"),a&&(h||Z&&!S||!M)&&C.push("has-appendix")),C.join(" ")}(t,{hasReply:Ve,customShape:Ye,isLastInGroup:Z,asForwarded:et,hasThread:Xe,forceSenderName:M,hasComments:Ie&&(null==Ie?void 0:Ie.messagesCount)>0,hasActionButton:rt||ct,hasReactions:Qe,isGeoLiveActive:"geoLive"===(null==tn?void 0:tn.type)&&!(0,d.$R)(t,(0,p.b)(X))}),ln=cn.includes("has-appendix"),dn=(0,Vt.X)(t,Y,Ln(Ye));let un,mn;un=sn||at?"none":!dn||Je||Qt?"standalone":"in-text",v?mn="in-meta":Qe?Ye||(Gt||_t||Je)&&!dn?mn="outside":et?(un="standalone",mn="inside"):mn="inside":mn="none",(0,Dt.Z)(H&&t.replyToChatId?t.replyToChatId:qe,Ve?t.replyToMessageId:void 0,B,t.id),_n(be,qe,$,D,q,j),(0,o.d4)((()=>{const e=Se.current;ye&&e&&(0,Kn.P)(e)&&Ce({messageIds:[$e]})}),[ye,$e,Ce]);let gn,pn="",vn=!1;const In=(0,o.Ye)((()=>tt?qn(He,Boolean(et),Boolean(u),l):void 0),[tt,He,et,u,l]),yn=et?28:0;if(tt||!Gt&&!_t)In&&(gn=Math.max(On(Boolean(jt),on),In.containerStyle.width),gn-In.containerStyle.width>18&&(vn=!0));else{let e;Gt?e=Un(t,u).width:_t&&(e=_t.isRound?zt.Rj:Un(t,u).width),e&&(gn=Math.max(On(Boolean(jt),on),e),gn-e>18&&(vn=!0))}gn&&(pn=`width: ${gn+yn}px`);const wn=z&&t.adminTitle||!et&&(null==je?void 0:je.adminTitle)||void 0,Zn=(0,o.Ye)((()=>wn?Gn(wn):void 0),[wn]);function Pn(){const e=o.ZP.createElement(ca,{message:t,reactionMessage:ie,outgoingStatus:L,signature:wn,withReactions:"in-meta"===mn,withReactionOffset:"inside"===mn,availableReactions:re,activeReaction:le,onClick:Tt});return"inside"!==mn?e:o.ZP.createElement(os,{activeReaction:le,message:ie,metaChildren:e,availableReactions:re})}return o.ZP.createElement("div",{ref:be,id:(0,d.d0)(t.id),className:qt,style:Zn?`--meta-safe-author-width: ${Zn}px`:void 0,"data-message-id":$e,onMouseDown:ht,onClick:gt,onContextMenu:pt,onDoubleClick:ft,onMouseEnter:at?Ct:void 0,onMouseMove:rn?It:void 0,onMouseLeave:rn||at?wt:void 0},o.ZP.createElement("div",{ref:Se,className:"bottom-marker","data-message-id":$e,"data-last-message-id":l?l.messages[l.messages.length-1].id:void 0,"data-has-unread-mention":t.hasUnreadMention||void 0,"data-has-unread-reaction":ye||void 0}),!U&&o.ZP.createElement("div",{className:"message-select-control"},ae&&o.ZP.createElement("i",{className:"icon-select"})),C&&o.ZP.createElement("div",{className:(0,Ee.Z)("message-select-control group-select",se&&"is-selected"),onClick:$t},se&&o.ZP.createElement("i",{className:"icon-select"})),g&&function(){const e=ut&&(0,d.YC)(ut.id),t=ut&&e?ut:void 0,n=ut&&!e?ut:void 0,a=!ut&&je?je.hiddenUserName:void 0;return o.ZP.createElement(fn.Z,{size:"small",user:t,chat:n,text:a,lastSyncTime:W,onClick:t||n?bt:void 0})}(),o.ZP.createElement("div",{className:(0,Ee.Z)("message-content-wrapper",cn.includes("text")&&"can-select-text")},o.ZP.createElement("div",{ref:Me,className:cn,style:pn,dir:"auto"},et&&!nt&&o.ZP.createElement("div",{className:"message-title"},Re("ForwardedMessage")),function(){const e=(0,Ee.Z)("content-inner",et&&"forwarded-message",Ve&&"reply-message",vn&&"no-media-corners"),n=Z&&!dn&&!et&&!Xe,a=(0,Ee.Z)("text-content","in-text"===un&&"with-meta",L&&"with-outgoing-icon");return o.ZP.createElement("div",{className:e,onDoubleClick:vt,dir:"auto"},function(){if(Ye&&!Ge||!(f&&!(Gt||_t||tn)||et||Ge||M)||nt||Ve&&Ye)return;let e,n;return!mt||Ye&&Ge?null!=je&&je.hiddenUserName&&(e=je.hiddenUserName):(e=(0,d.OU)(Re,mt),et||(n=`color-${(0,d.Rs)(mt)}`)),o.ZP.createElement("div",{className:"message-title",dir:"ltr"},e?o.ZP.createElement("span",{className:(0,Ee.Z)("interactive",n),onClick:St,dir:"auto"},(0,hn.Z)(e)):N?void 0:" ",N&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("span",{className:"via"},Re("ViaBot")),o.ZP.createElement("span",{className:"interactive",onClick:Mt},(0,hn.Z)(`@${N.username}`))),null!=je&&je.isLinkedChannelPost?o.ZP.createElement("span",{className:"admin-title",dir:"auto"},Re("DiscussChannel")):t.adminTitle&&!z?o.ZP.createElement("span",{className:"admin-title",dir:"auto"},t.adminTitle):void 0)}(),Ve&&o.ZP.createElement(ta,{message:B,isProtected:F,sender:x,observeIntersection:r,onClick:Et}),Yt&&o.ZP.createElement(ua,{message:t,observeIntersection:r,observeIntersectionForPlaying:c,shouldLoop:fe,lastSyncTime:W}),K&&o.ZP.createElement(ma.Z,{size:"small",isOwn:He,sticker:K,effect:ee,soundId:te,observeIntersection:r,lastSyncTime:W,forceLoadPreview:_e,messageId:$e,chatId:qe,activeEmojiInteractions:de}),J&&o.ZP.createElement(cs,{size:"small",isOwn:He,localSticker:J,localEffect:Q,soundId:te,observeIntersection:r,lastSyncTime:W,forceLoadPreview:_e,messageId:$e,chatId:qe,activeEmojiInteractions:de}),tt&&o.ZP.createElement(Ja,{album:l,albumLayout:In,observeIntersection:r,isOwn:He,isProtected:F,hasCustomAppendix:n,lastSyncTime:W,onMediaClick:Nt}),sn&&o.ZP.createElement(ls,{message:t,phoneCall:sn,chatId:qe}),!tt&&Gt&&o.ZP.createElement(ya,{message:t,observeIntersection:r,noAvatars:u,canAutoLoad:ge,uploadProgress:O,shouldAffectAppendix:n,onClick:Rt,onCancelUpload:Bt,isDownloading:he,isProtected:F,theme:S}),!tt&&_t&&_t.isRound&&o.ZP.createElement(ts,{message:t,observeIntersection:r,canAutoLoad:ge,lastSyncTime:W,isDownloading:he}),!tt&&_t&&!_t.isRound&&o.ZP.createElement(ba,{message:t,observeIntersection:r,noAvatars:u,canAutoLoad:ge,canAutoPlay:pe,uploadProgress:O,lastSyncTime:W,onClick:Rt,onCancelUpload:Bt,isDownloading:he,isProtected:F}),(Ht||Wt)&&o.ZP.createElement(aa.Z,{theme:S,message:t,origin:m.Cr.Inline,uploadProgress:O,lastSyncTime:W,isSelectable:U,isSelected:ae,onPlay:kt,onReadMedia:!Wt||He&&!_?void 0:At,onCancelUpload:Bt,isDownloading:he}),Xt&&o.ZP.createElement(na.Z,{message:t,observeIntersection:r,canAutoLoad:ge,autoLoadFileMaxSizeMb:ve,uploadProgress:O,isSelectable:U,isSelected:ae,onMediaClick:Rt,onCancelUpload:Bt,isDownloading:he}),Kt&&o.ZP.createElement(Ma,{contact:Kt}),Jt&&o.ZP.createElement(Ba,{message:t,poll:Jt,onSendVote:xt}),an&&o.ZP.createElement(Wa,{message:t,canAutoLoadMedia:ge,lastSyncTime:W}),!Je&&dn&&o.ZP.createElement("p",{className:a,dir:"auto"},dn,"in-text"===un&&Pn()),Qt&&o.ZP.createElement(Oa,{message:t,observeIntersection:r,noAvatars:u,canAutoLoad:ge,canAutoPlay:pe,lastSyncTime:W,onMediaClick:Rt,onCancelMediaTransfer:Bt,isDownloading:he,isProtected:F,theme:S}),en&&o.ZP.createElement(Fa,{message:t,shouldAffectAppendix:n,isInSelectMode:ne,isSelected:ae,theme:S}),tn&&o.ZP.createElement(Va,{message:t,lastSyncTime:W,isInSelectMode:ne,isSelected:ae,theme:S,peer:E,serverTimeOffset:X}))}(),!at&&"standalone"===un&&Pn(),it&&rt?o.ZP.createElement(ot.Z,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:Re("lng_context_forward_msg"),onClick:C?Lt:Ot},o.ZP.createElement("i",{className:"icon-share-filled"})):it&&ct?o.ZP.createElement(ot.Z,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:"Focus message",onClick:me?Ut:Ft},o.ZP.createElement("i",{className:"icon-arrow-right"})):void 0,on&&o.ZP.createElement(as,{threadInfo:Ie,disabled:I}),ln&&o.ZP.createElement("div",{className:"svg-appendix",dangerouslySetInnerHTML:He?ds:us}),rn&&o.ZP.createElement("div",{className:(0,Ee.Z)("quick-reaction",Pt&&!le&&"visible"),onClick:yt},o.ZP.createElement(oa.Z,{reaction:ce}))),t.inlineButtons&&o.ZP.createElement(ns,{message:t,onClick:Ze}),"outside"===mn&&o.ZP.createElement(os,{message:ie,isOutside:!0,activeReaction:le,availableReactions:re})),Ne&&o.ZP.createElement(Qn,{isOpen:ke,anchor:Ne,message:t,album:l,chatUsername:n,messageListType:ue,onClose:Be,onCloseAnimationEnd:xe}))}))),hs=(0,o.X$)((0,a.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,c.fS)(e,n),{chatId:s,isBot:o}=a||{};return{message:a,bot:s&&o?(0,c.dy)(e,s):void 0,channel:!o&&s?(0,c.Z1)(e,s):void 0}}))((e=>{let{chatId:t,message:n,containerRef:s,bot:i,channel:r}=e;const{viewSponsoredMessage:c,openChat:l,openChatByInvite:u,startBot:m,focusMessage:h}=(0,a.Sv)(),g=(0,Ke.Z)(),p=(0,o.sO)(null),f=Boolean(n),{observe:v}=(0,Tn.S1)({rootRef:s,debounceMs:200,threshold:1});(0,o.d4)((()=>f?v(p.current,(e=>{e.isIntersecting&&c({chatId:t})})):void 0),[t,f,v,c]);const I=(0,o.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 o.ZP.createElement("div",{className:"SponsoredMessage Message open",key:"sponsored-message"},o.ZP.createElement("div",{className:"message-content has-shadow has-solid-background",dir:"auto"},o.ZP.createElement("div",{className:"content-inner",dir:"auto"},o.ZP.createElement("div",{className:"message-title",dir:"ltr"},i&&(0,hn.Z)((0,d.Js)(i)||""),r&&(0,hn.Z)(n.chatInviteTitle||(0,d.U)(g,r,i)||"")),o.ZP.createElement("p",{className:"text-content with-meta",dir:"auto",ref:p},o.ZP.createElement("span",{className:"text-content-inner",dir:"auto"},(0,Ea.H)(n.text.text,n.text.entities)),o.ZP.createElement("span",{className:"MessageMeta",dir:"ltr"},o.ZP.createElement("span",{className:"message-signature"},g("SponsoredMessage")))),o.ZP.createElement(ot.Z,{color:"secondary",size:"tiny",ripple:!0,onClick:I,className:"SponsoredMessage__button"},g(n.isBot?"Conversation.ViewBot":n.channelPostId?"Conversation.ViewPost":"Conversation.ViewChannel")))))}))),gs=(0,o.X$)((e=>{let{chatId:t,messageIds:n,messageGroups:i,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:b,threadTopMessageId:S,hasLinkedChat:E,isSchedule:R,noAppearanceAnimation:k,onFabToggle:N,onNotchToggle:T}=e;const{openHistoryCalendar:A}=(0,a.Sv)(),{observeIntersectionForMedia:B,observeIntersectionForReading:x,observeIntersectionForAnimatedStickers:O}=function(e,t,n){const{markMessageListRead:s,markMentionsRead:o,animateUnreadReaction:i}=(0,a.Sv)(),{observe:r}=(0,Tn.S1)({rootRef:t,throttleMs:An,margin:Bn}),{observe:c,freeze:l,unfreeze:d}=(0,Tn.S1)({rootRef:t,throttleMs:150},(t=>{if("thread"!==e)return;let a=0;const r=[],c=[];t.forEach((e=>{const{isIntersecting:t,target:n}=e;if(!t)return;const{dataset:s}=n,o=Number(s.lastMessageId||s.messageId);o>a&&(a=o),s.hasUnreadMention&&r.push(o),s.hasUnreadReaction&&c.push(o)})),n.current&&a>=n.current&&s({maxId:a}),r.length&&o({messageIds:r}),c.length&&i({messageIds:c})}));(0,Te.Z)(l,d);const{observe:u}=(0,Tn.S1)({rootRef:t,throttleMs:An});return{observeIntersectionForMedia:r,observeIntersectionForReading:c,observeIntersectionForAnimatedStickers:u}}(Z,f,y),{backwardsTriggerRef:U,forwardsTriggerRef:F,fabTriggerRef:$}=function(e,t,n,i,r,c,l,d,u,g){const{loadViewportMessages:p}=(0,a.Sv)(),[f,v]=(0,o.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,o.sO)(null),y=(0,o.sO)(null),w=(0,o.sO)(null);function Z(){if(!d)return;if(!n||!n.length)return c(!1),void l(!1);if(!i)return c(!0),void l(!0);if(!t.current)return;const{offsetHeight:e,scrollHeight:a,scrollTop:s}=t.current,o=Math.round(a-s-e),u=o<=1;c(r?!u:!(o<=50)),l(!u)}const{observe:P}=(0,Tn.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,Tn._N)(I,P),(0,Tn._N)(y,P);const{observe:C,freeze:b,unfreeze:S}=(0,Tn.S1)({rootRef:t,margin:100},Z);(0,Tn._N)(w,C);const{observe:E,freeze:R,unfreeze:k}=(0,Tn.S1)({rootRef:t,margin:1},Z);return(0,Tn._N)(w,E),(0,Be.Z)((()=>{d&&Z()}),[d]),(0,Be.Z)((()=>{b(),R(),setTimeout((()=>{k(),S()}),250)}),[n]),{backwardsTriggerRef:I,forwardsTriggerRef:y,fabTriggerRef:w}}(Z,f,n,r,c,N,T,P,C,b),D=(0,Ke.Z)(),q=o.ZP.createElement("div",{className:(0,Ee.Z)("unread-divider","local-action-message"),key:"unread-messages"},o.ZP.createElement("span",null,D("UnreadMessages"))),j=k?0:i.reduce(((e,t)=>e+(0,g.xH)(t.senderGroups).length),0);let G=0;const _=i.map(((e,t,n)=>{const a=e.senderGroups.map(((e,a,s)=>{var i;if(1===e.length&&!Cn(e[0])&&(0,d.Lo)(e[0])&&(null===(i=e[0].content.action)||void 0===i||!i.phoneCall)){const i=e[0],r=a===s.length-1&&t===n.length-1;return(0,g.oA)([i.id===I.current&&q,o.ZP.createElement(ea,{key:i.id,message:i,observeIntersection:x,appearanceOrder:j-++G,isLastInList:r})])}let r;return(0,g.xH)(e.map(((i,c)=>{const m=Cn(i)?i.mainMessage:i,h=Cn(i)?i:void 0,f=(0,d.B4)(m),y=Cn(i),P=e[c+1];m.previousLocalId&&v.current===(0,d.d0)(m.previousLocalId)&&(v.current=(0,d.d0)(m.id));const C=!y&&m.groupedId?m.groupedId:void 0,b=P&&!Cn(P)?P.groupedId:void 0,M={isFirstInGroup:0===c,isLastInGroup:c===e.length-1,isFirstInDocumentGroup:Boolean(C&&C!==r),isLastInDocumentGroup:Boolean(C&&C!==b),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,o.ZP.createElement(ms,{key:k,message:m,observeIntersectionForBottom:x,observeIntersectionForMedia:B,observeIntersectionForAnimatedStickers:O,album:h,noAvatars:p,withAvatar:M.isLastInGroup&&l&&!f&&!(m.id===S),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===S&&o.ZP.createElement("div",{className:"local-action-message",key:"discussion-started"},o.ZP.createElement("span",null,D("DiscussionStarted")))])})))}));return o.ZP.createElement("div",{className:"message-date-group",key:e.datetime,onMouseDown:Sn.q,teactFastList:!0},o.ZP.createElement("div",{className:(0,Ee.Z)("sticky-date",!R&&"interactive"),key:"date-header",onMouseDown:Sn.q,onClick:R?void 0:()=>A({selectedAt:e.datetime})},o.ZP.createElement("span",{dir:"auto"},R&&e.originalDate===s.t4&&D("MessageScheduledUntilOnline"),R&&e.originalDate!==s.t4&&D("MessageScheduledOn",(0,L.j1)(D,e.datetime,void 0,!0)),!R&&(0,L.j1)(D,e.datetime))),(0,g.xH)(a))}));return o.ZP.createElement("div",{className:"messages-container",teactFastList:!0},o.ZP.createElement("div",{ref:U,key:"backwards-trigger",className:"backwards-trigger"}),(0,g.xH)(_),r&&o.ZP.createElement(hs,{key:t,chatId:t,containerRef:f}),o.ZP.createElement("div",{ref:F,key:"forwards-trigger",className:"forwards-trigger"}),o.ZP.createElement("div",{ref:$,key:"fab-trigger",className:"fab-trigger"}))}));var ps=n(3547);const fs=(0,o.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),o=null!=a&&a.length?a[s%a.length]:void 0,i=(0,c.Z1)(e,n);return i?{sticker:o,lastUnreadMessageId:i.lastMessage&&i.lastMessage.id!==i.lastReadInboxMessageId?i.lastMessage.id:void 0,connectionState:e.connectionState}:{}}))((e=>{let{sticker:t,connectionState:n,lastUnreadMessageId:s}=e;const{loadGreetingStickers:i,sendMessage:r,markMessageListRead:c}=(0,a.Sv)(),l=(0,Ke.Z)(),d=(0,o.sO)(null),{observe:u}=(0,Tn.S1)({rootRef:d,debounceMs:200});(0,o.d4)((()=>{t||"connectionStateReady"!==n||i()}),[n,i,t]),(0,o.d4)((()=>{"connectionStateReady"===n&&s&&c({maxId:s})}),[n,c,s]);const m=(0,o.I4)((e=>{e={...e,isPreloadedGlobally:!0},r({sticker:e})}),[r]);return o.ZP.createElement("div",{className:"ContactGreeting",ref:d},o.ZP.createElement("div",{className:"wrapper"},o.ZP.createElement("p",{className:"title",dir:"auto"},l("Conversation.EmptyPlaceholder")),o.ZP.createElement("p",{className:"description",dir:"auto"},l("Conversation.GreetingText")),o.ZP.createElement("div",{className:"sticker"},t&&o.ZP.createElement(ps.Z,{sticker:t,onClick:m,clickArg:t,observeIntersection:u,size:160,className:"large",noContextMenu:!0}))))}))),vs=(0,o.X$)((e=>{let{isChatWithSelf:t,type:n,isGroupChatJustCreated:a}=e;const s=(0,Ke.Z)();return"scheduled"===n?function(e){return o.ZP.createElement("div",{className:"empty"},o.ZP.createElement("span",null,e("ScheduledMessages.EmptyPlaceholder")))}(s):t?function(e){return o.ZP.createElement("div",{className:"NoMessages"},o.ZP.createElement("div",{className:"wrapper"},o.ZP.createElement("i",{className:"icon icon-cloud-download"}),o.ZP.createElement("h3",{className:"title"},e("Conversation.CloudStorageInfo.Title")),o.ZP.createElement("ul",{className:"description"},o.ZP.createElement("li",null,e("Conversation.ClousStorageInfo.Description1")),o.ZP.createElement("li",null,e("Conversation.ClousStorageInfo.Description2")),o.ZP.createElement("li",null,e("Conversation.ClousStorageInfo.Description3")),o.ZP.createElement("li",null,e("Conversation.ClousStorageInfo.Description4")))))}(s):a?function(e){return o.ZP.createElement("div",{className:"NoMessages"},o.ZP.createElement("div",{className:"wrapper",dir:e.isRtl?"rtl":void 0},o.ZP.createElement("h3",{className:"title"},e("EmptyGroupInfo.Title")),o.ZP.createElement("p",{className:"description"},e("EmptyGroupInfo.Subtitle")),o.ZP.createElement("ul",{className:"list-checkmarks"},o.ZP.createElement("li",null,e("EmptyGroupInfo.Line1")),o.ZP.createElement("li",null,e("EmptyGroupInfo.Line2")),o.ZP.createElement("li",null,e("EmptyGroupInfo.Line3")),o.ZP.createElement("li",null,e("EmptyGroupInfo.Line4")))))}(s):o.ZP.createElement("div",{className:"empty"},o.ZP.createElement("span",null,s("NoMessages")))})),Is=(0,M.Ds)((e=>e()),200,!1),ys=(0,o.X$)((0,a.c$)(((e,t)=>{let{chatId:n,threadId:a,type:s}=t;const o=(0,c.Z1)(e,n);if(!o)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!==i._f&&!(l&&u&&l[u]))return{};const{isRestricted:m,restrictionReason:h,lastMessage:g}=o,p=(0,c.G$)(e,n),f=a===i._f&&!r&&!o.unreadCount&&!p&&g&&!g.groupedId,v=(0,c.IK)(e,n);let I;var y;return(0,c.pk)(e,n)&&(I=v.fullInfo?(null===(y=v.fullInfo.botInfo)||void 0===y?void 0:y.description)||"NoMessages":"Updating bot info..."),{isChatLoaded:!0,isRestricted:m,restrictionReason:h,isChannelChat:(0,d.eA)(o),isGroupChat:(0,d.Bf)(o),isCreator:o.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:o.fullInfo&&"linkedChatId"in o.fullInfo?Boolean(o.fullInfo.linkedChatId):void 0,lastSyncTime:e.lastSyncTime,...f&&{lastMessage:g}}}))((e=>{var t,n,i,r,l,u;let{chatId:h,threadId:p,type:f,hasTools:v,onFabToggle:I,onNotchToggle:y,isChatLoaded:w,isChannelChat:Z,isGroupChat:P,canPost:C,isReady:b,isChatWithSelf:S,isRepliesChat:E,isCreator:R,isBot:k,messageIds:N,messagesById:T,firstUnreadId:A,isViewportNewest:B,threadFirstMessageId:x,isRestricted:L,restrictionReason:O,focusingId:U,isSelectModeActive:F,lastMessage:$,botDescription:D,threadTopMessageId:q,hasLinkedChat:j,lastSyncTime:G,withBottomShift:_}=e;const{loadViewportMessages:H,setScrollOffset:z,loadSponsoredMessages:V,loadMessageReactions:W,copyMessagesByIds:X}=(0,a.Sv)(),Y=(0,o.sO)(null),K=(0,o.sO)("thread"===f&&(0,c.Vt)((0,a.Rd)(),h,p)||0),J=(0,o.sO)(),Q=(0,o.sO)(),ee=(0,o.sO)(),te=(0,o.sO)(),ne=(0,o.sO)(),ae=(0,o.sO)(),se=(0,o.sO)(!1),oe=(0,o.sO)(Boolean($)),[ie,re]=(0,o.eJ)(),ce=Boolean(N);(0,Be.Z)((()=>{ce&&(0,M.R3)((()=>{oe.current=!1}))}),[ce]),(0,Be.Z)((()=>{te.current=A}),[A]),(0,Be.Z)((()=>{Z&&b&&G&&V({chatId:h})}),[h,b,Z,G]),(0,Be.Z)((()=>{ce&&(ne.current=te.current)}),[ce]),(0,Be.Z)((()=>{ae.current=U}),[U]),(e=>{(0,Xe.y)({"meta+C":function(t){const n=(0,Nn.Z)();n&&n.length>0&&(t.preventDefault(),e({messageIds:n}))}})})(X);const le=(0,o.Ye)((()=>{if(!N||!T)return;const e=!q||N[0]&&x!==N[0]?N:[q,...N];if(!e.length)return;const t=e.map((e=>T[e])).filter(Boolean);return bn((0,g.Xo)(t,["date","id"]),ne.current)}),[N,T,x,q]);(0,kn.Z)((()=>{if(!N||!T)return;const e=N.filter((e=>{var t;return null===(t=T[e])||void 0===t?void 0:t.reactions}));e.length&&W({chatId:h,ids:e})}),15e3);const de=(0,o.Ye)((()=>{if("thread"===f)return(0,M.Ds)((()=>H({direction:m.Uq.Around})),1e3,!0,!1)}),[H,N]),{isScrolled:ue,updateStickyDates:me}=function(){const[e,t]=(0,We.Z)(!1),n=(0,Mn.Z)(1e3,!0);return{isScrolled:e,updateStickyDates:(0,o.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,o=n-a;return-s<=o&&o<=(t?60:10)}))}(e,a);n&&n.classList.add("stuck"),document.body.classList.remove("is-scrolling-messages")}))}))}),[t,n])}}(),he=(0,o.sO)(),ge=(0,o.sO)(),pe=(0,o.I4)((()=>{if(se.current)return void(se.current=!1);he.current=!0;const e=Y.current;ae.current||me(e,v),Is((()=>{he.current=!1,(0,M.T2)((()=>{e.parentElement&&(K.current=e.scrollHeight-e.scrollTop,"thread"===f&&z({chatId:h,threadId:p,scrollOffset:K.current}))}))}))}),[me,v,f,z,h,p]);(0,o.d4)((()=>{if(!("ResizeObserver"in window))return;const e=new ResizeObserver((e=>{let[t]=e;t.target.offsetParent&&re(t.contentRect.height)}));return e.observe(Y.current),()=>{e.disconnect()}}),[]);const{height:fe}=(0,Ot.Z)();(0,o.d4)((()=>{Y.current.dataset.normalHeight=String(Y.current.offsetHeight)}),[fe,C]),(0,o.d4)((()=>{if(!de||!w||L||U)return;if(N&&N[N.length-1]>=s.AE)return;const e=Y.current;(!N||N.length<s.hT/2&&e.firstElementChild.clientHeight<=e.offsetHeight)&&de()}),[w,N,de,U,L]),(0,Be.Z)((()=>{if(!N||!ee.current)return;const e=ee.current.filter((e=>N.includes(Number(e.dataset.messageId)))),t=e[1]||e[0];t&&(J.current=t.id,Q.current=t.getBoundingClientRect().top)}),[N,B,ie,v]),(0,Zn.Z)((e=>{let[t,n,a]=e;const o=Y.current;ee.current=Array.from(o.querySelectorAll(".message-list-item"));const i=N&&t&&N[N.length-1]!==t[t.length-1],r=(null==N?void 0:N[0])!==(null==t?void 0:t[0])&&(null==N?void 0:N.length)===s.hT/2+1,c=i&&!r,l=N&&ae.current===N[N.length-1],d=B&&c&&N&&N.length<s.hT/2&&!o.parentElement.classList.contains("force-messages-scroll")&&o.firstElementChild.clientHeight<=2*o.offsetHeight;d&&(o.parentElement.classList.add("force-messages-scroll"),setTimeout((()=>{o.parentElement&&o.parentElement.classList.remove("force-messages-scroll")}),500));const{scrollTop:u,scrollHeight:m,offsetHeight:h}=o,g=K.current,p=ee.current[ee.current.length-1];let f=g-(a||h);c&&(f-=p?p.offsetHeight:0);const I=B&&n&&f<=20;let y;if(c&&I&&!l&&(p&&(0,M.T2)((()=>{(0,Rn.Z)(o,p,"end",20)})),y=m-h,K.current=Math.max(Math.ceil(m-y),h),!d))return;const w=void 0!==a&&a!==ie,Z=J.current&&o.querySelector(`#${J.current}`),P=!Z&&ne.current&&o.querySelector(".unread-divider");if(I&&w){if((0,Rn.N)())return;y=m-h}else Z?(ge.current&&(ge.current=!1,(0,En.z)(o)),y=u+(Z.getBoundingClientRect().top-(Q.current||0))):y=P?Math.min(P.offsetTop-(v?60:10),m-g):m-g;(0,En.Z)(o,Math.ceil(y)),ae.current||(se.current=!0,(0,M.T2)((()=>{se.current=!1}))),K.current=Math.max(Math.ceil(m-y),h)}),[N,B,ie,v]),(0,Pn.Z)((e=>{let[t]=e;void 0!==t&&(0,Me.YW)(200+s.fK)}),[F]);const ve=(0,Ke.Z)(),Ie=Boolean(h&&(0,d.YC)(h)),ye=Boolean(!Ie&&!Z||S||E),we=Boolean(!ye||Z),Ze=(0,d.YC)(h)&&!S&&!k&&(!le&&!$&&N&&(!ee.current||0===ee.current.length)||1===(null==N?void 0:N.length)&&"contactSignUp"===(null==T||null===(t=T[N[0]])||void 0===t||null===(n=t.content.action)||void 0===n?void 0:n.type)||"contactSignUp"===(null==$||null===(i=$.content)||void 0===i||null===(r=i.action)||void 0===r?void 0:r.type)),Pe=P&&R&&1===(null==N?void 0:N.length)&&"chatCreate"===(null==T||null===(l=T[N[0]])||void 0===l||null===(u=l.content.action)||void 0===u?void 0:u.type),Ce=(0,Ee.Z)("MessageList custom-scroll",we&&"no-avatars",!C&&"no-composer","pinned"===f&&"type-pinned",_&&"with-bottom-shift",F&&"select-mode-active",ue&&"scrolled",!b&&"is-animating");return o.ZP.createElement("div",{ref:Y,className:Ce,onScroll:pe,onMouseDown:Sn.q},L?o.ZP.createElement("div",{className:"empty"},o.ZP.createElement("span",null,O?O.text:"This is a private "+(Z?"channel":"chat"))):D?o.ZP.createElement("div",{className:"empty"},o.ZP.createElement("span",null,(0,hn.Z)(ve(D),["br","emoji","links"]))):Ze?o.ZP.createElement(fs,{userId:h}):!N||le&&!Pe?N&&le||$?o.ZP.createElement(gs,{chatId:h,messageIds:N||[$.id],messageGroups:le||bn([$]),isViewportNewest:Boolean(B),isUnread:Boolean(A),withUsers:ye,areReactionsInMeta:Ie,noAvatars:we,containerRef:Y,anchorIdRef:J,memoUnreadDividerBeforeIdRef:ne,memoFirstUnreadIdRef:te,threadId:p,type:f,isReady:b,isScrollingRef:he,isScrollPatchNeededRef:ge,threadTopMessageId:q,hasLinkedChat:j,isSchedule:!!le&&"scheduled"===f,noAppearanceAnimation:!le||!oe.current,onFabToggle:I,onNotchToggle:y}):o.ZP.createElement(yt.Z,{color:"white",backgroundColor:"dark"}):o.ZP.createElement(vs,{chatId:h,type:f,isChatWithSelf:S,isGroupChatJustCreated:Pe}))}))),ws=(0,o.X$)((e=>{let{icon:t,ariaLabelLang:n,unreadCount:a,onClick:s,onReadAll:i,className:r}=e;const c=(0,Ke.Z)(),l=(0,o.sO)(null),{isContextMenuOpen:d,handleContextMenu:u,handleContextMenuClose:m,handleContextMenuHide:h}=(0,xn.Z)(l,!i);return o.ZP.createElement("div",{className:(0,Ee.Z)("src-components-middle-ScrollDownButton-module__root",r),ref:l},o.ZP.createElement(ot.Z,{color:"secondary",round:!0,className:"src-components-middle-ScrollDownButton-module__button",onClick:s,onContextMenu:u,ariaLabel:c(n)},o.ZP.createElement("i",{className:(0,Ee.Z)("src-components-middle-ScrollDownButton-module__icon",`icon-${t}`)})),Boolean(a)&&o.ZP.createElement("div",{className:"src-components-middle-ScrollDownButton-module__unread-count"},(0,je.bi)(a)),i&&o.ZP.createElement(Pt.Z,{isOpen:d,onClose:m,onCloseAnimationEnd:h,autoClose:!0,positionX:"right",positionY:"bottom"},o.ZP.createElement(st.Z,{icon:"readchats",onClick:i},c("MarkAllAsRead"))))})),Zs=(0,o.X$)((0,a.c$)((e=>{const t=(0,c.Bt)(e);if(!t)return{};const{chatId:n,threadId:a,type:s}=t,o=(0,c.Z1)(e,n),r=o&&a===i._f&&"thread"===s;return{messageListType:s,chatId:n,reactionsCount:r?o.unreadReactionsCount:void 0,mentionsCount:r?o.unreadMentionsCount:void 0,unreadCount:r?o.unreadCount:void 0}}))((e=>{let{isShown:t,canPost:n,messageListType:s,chatId:i,unreadCount:r,reactionsCount:c,mentionsCount:l,withExtraShift:d}=e;const{focusNextReply:u,focusNextReaction:m,focusNextMention:h,fetchUnreadReactions:g,readAllMentions:p,readAllReactions:f,fetchUnreadMentions:v}=(0,a.Sv)(),I=(0,o.sO)(null),y=Boolean(c),w=Boolean(l);(0,o.d4)((()=>{y&&i&&g({chatId:i})}),[i,g,y]),(0,o.d4)((()=>{w&&i&&v({chatId:i})}),[i,v,w]);const Z=(0,o.I4)((()=>{if(t)if("thread"===s)u();else{const e=I.current.parentElement.querySelector(".MessageList"),t=e.querySelectorAll(".message-list-item"),n=t[t.length-1];if(!n)return;(0,Rn.Z)(e,n,"end",20)}}),[t,s,u]),P=(0,Ee.Z)("src-components-middle-FloatingActionButtons-module__root",(t||Boolean(c)||Boolean(l))&&"src-components-middle-FloatingActionButtons-module__revealed",(Boolean(c)||Boolean(l))&&!t&&"src-components-middle-FloatingActionButtons-module__only-reactions",!n&&"src-components-middle-FloatingActionButtons-module__no-composer",!d&&"src-components-middle-FloatingActionButtons-module__no-extra-shift");return o.ZP.createElement("div",{ref:I,className:P},y&&o.ZP.createElement(ws,{icon:"heart-outline",ariaLabelLang:"AccDescrReactionMentionDown",onClick:m,onReadAll:f,unreadCount:c}),w&&o.ZP.createElement(ws,{icon:"mention",ariaLabelLang:"AccDescrMentionDown",onClick:h,onReadAll:p,unreadCount:l}),o.ZP.createElement(ws,{icon:"arrow-down",ariaLabelLang:"AccDescrPageDown",onClick:Z,unreadCount:r,className:"src-components-middle-FloatingActionButtons-module__unread"}))})));var Ps=n(5723);const Cs=1280,bs=/\.[^/.]+$/;async function Ss(e,t,a,o){const i=URL.createObjectURL(t),{type:r,size:c}=t;let l,d,u;if(s.oG.has(r))if(a){const t=await(0,Lt.pt)(i),{width:n,height:a}=t;if(n>Cs||a>Cs||"image/jpeg"!==r){const t=await on(i,Cs/Math.max(n,a),"image/jpeg");return URL.revokeObjectURL(i),Ss(e,await(0,Lt.gm)(t),!0,o)}"image/jpeg"===r&&(e=e.replace(bs,".jpg")),l={width:n,height:a}}else u=i;else if(s.wG.has(r)){const{videoWidth:e,videoHeight:t,duration:n}=await(0,Lt.jj)(i);l={width:e,height:t,duration:n},u=await(0,Lt.ud)(i)}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:o,artist:i,picture:r},format:{duration:c}}=s,l=a(r);return{title:o,performer:i,duration:c,coverUrl:l?`data:${l.format};base64,${l.data.toString("base64")}`:void 0}}(i);d={duration:e||0,title:t,performer:a},u=s}return{blobUrl:i,filename:e,mimeType:r,size:c,quick:l,audio:d,previewBlobUrl:u,...o}}function Ms(e){const t=window.getSelection();if(null!=t&&t.getRangeAt&&t.rangeCount){const n=t.getRangeAt(0);n.deleteContents();const a=n.createContextualFragment(e),s=a.lastChild;n.insertNode(a),s?(n.setStartAfter(s),n.setEndAfter(s)):n.collapse(!1),t.removeAllRanges(),t.addRange(n)}}var Es=n(6391);let Rs;function ks(e){Rs.focus(),e.focus()}h.cj&&(Rs=document.createElement("input"),Rs.classList.add("for-ios-autocapitalization-fix"),document.body.appendChild(Rs));var Ns=n(4784),Ts=n(2400),As=n(6389),Bs=n(971);const xs={encoderPath:new URL(n(8973),n.b).href,reuseWorker:!0},Ls={type:"audio/ogg"};let Os,Us,Fs;async function $s(){return Os||(Os=n.e(161).then(n.t.bind(n,1161,23)),Us=(await Os).default,Fs=new Us(xs)),Os}async function Ds(e){await async function(){await $s(),await Fs.start()}();const t=Date.now();let n;const a=[],s=[];Fs.ondataavailable=e=>{a.push(e)};const o=function(t,n){const a=t.sourceNode,o=a.context.createAnalyser();o.fftSize=64,a.connect(o);const i=o.frequencyBinCount,r=new Uint8Array(i);let c=!1;return function t(){if(c)return;o.getByteFrequencyData(r);const n=r.reduce(((e,t)=>e+t),0)/i/255;(t=>{s.push(255*t),e(t)})(n<.1?0:n),requestAnimationFrame(t)}(),()=>{c=!0}}(Fs);return{stop:()=>new Promise(((e,i)=>{Fs.onstop=()=>{e({blob:new Blob(a,Ls),duration:Math.round(((n||Date.now())-t)/1e3),waveform:s})},Fs.onerror=i;const r=Math.max(0,t+1e3-Date.now());setTimeout((()=>{Fs.stop(),o()}),r)})),pause:()=>{const e=Math.max(0,t+1e3-Date.now());setTimeout((()=>{Fs.pause(),n=Date.now(),o()}),e)}}}var qs=n(1262);const js=["image/png","image/jpeg","image/gif"];let Gs,_s;var Hs=n(3575),zs=n(9295);function Vs(e,t,n){const[a,s]=(0,o.eJ)(),{isFrozen:i,updateWhenUnfrozen:r}=function(){const e=(0,o.sO)(!1),t=(0,o.I4)((()=>{e.current=!0}),[]),n=(0,Fe.Z)(),a=(0,o.I4)((()=>{e.current&&(e.current=!1,n())}),[n]);return(0,Me.ZP)(Ws,a),{isFrozen:(0,Me.zG)(),updateWhenUnfrozen:t}}(),c=(0,Mn.Z)(t,!0);return(0,Be.Z)((()=>{i?r():c((()=>{s(e())}))}),[...n,i]),a}function Ws(){}const Xs=/^@([a-z0-9_]{1,32})[\u00A0\u0020]+(.*)/i,Ys=/^@([a-z0-9_]{1,32})[\u00A0\u0020]+\n{2,}/i,Ks={username:"",query:"",canShowHelp:!1,usernameLowered:""},Js=document.createElement("div");const Qs=(0,M.P2)((e=>e()),500,!0),eo=/^[\w@]{1,32}\s?/i;var to=n(3057);const no=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,It.Z)(vt.gl.Extra,"DeleteMessageModal",!t);return n?o.ZP.createElement(n,e):void 0}));function ao(){return ao=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},ao.apply(this,arguments)}let so,oo=!0;const io=(0,o.X$)((e=>{let{onActivate:t,...n}=e;const a=(0,o.sO)(!1),s=(0,o.I4)((()=>{if(a.current=!0,oo)return oo=!1,void t();so&&(clearTimeout(so),so=void 0),so=window.setTimeout((()=>{a.current&&t()}),200)}),[t]),i=(0,o.I4)((()=>{a.current=!1}),[]);return o.ZP.createElement(ot.Z,ao({},n,{onMouseEnter:h.$b?void 0:s,onMouseLeave:h.$b?void 0:i,onClick:t}))}));var ro=n(5655),co=n(6503),lo=n(2898);const uo="src-components-middle-composer-AttachmentMenuBotIcon-module__compact",mo=/#fff/gi,ho=(0,o.X$)((e=>{let{icon:t,theme:n}=e;const a=(0,Wt.Z)((0,d.ym)(t),!1,i.IU.Text),s=(0,o.Ye)((()=>{if(!a)return"";const e="dark"===n?"rgb(170, 170, 170)":"rgb(112, 117, 121)",t=a.replace(mo,e),s=(new DOMParser).parseFromString(t,"image/svg+xml");return s.querySelectorAll("path").forEach((t=>{t.style.stroke=e,t.style.strokeWidth="0.5px"})),`data:image/svg+xml;utf8,${s.documentElement.outerHTML}`}),[a,n]);return o.ZP.createElement("i",{className:(0,Ee.Z)("src-components-middle-composer-AttachmentMenuBotIcon-module__root",h.FW&&uo)},o.ZP.createElement("img",{src:s,alt:"",className:(0,Ee.Z)("src-components-middle-composer-AttachmentMenuBotIcon-module__image",h.FW&&uo)}))})),go=(0,o.X$)((e=>{let{bot:t,theme:n,chatId:s,onMenuOpened:i,onMenuClosed:r}=e;const{callAttachMenuBot:c,toggleBotInAttachMenu:l}=(0,a.Sv)(),d=(0,Ke.Z)(),u=(0,o.Ye)((()=>{var e;return null===(e=t.icons.find((e=>{let{name:t}=e;return"default_static"===t})))||void 0===e?void 0:e.document}),[t.icons]),[m,h,g]=(0,We.Z)(),[p,f]=(0,o.eJ)(void 0),v=(0,o.I4)((e=>{e.preventDefault();const t=e.currentTarget.getBoundingClientRect();f({x:t.right,y:t.bottom}),i(),h()}),[i,h]),I=(0,o.I4)((()=>{g(),r()}),[g,r]),y=(0,o.I4)((()=>{f(void 0)}),[]),w=(0,o.I4)((()=>{l({botId:t.id,isEnabled:!1})}),[t.id,l]);return o.ZP.createElement(st.Z,{key:t.id,customIcon:u&&o.ZP.createElement(ho,{icon:u,theme:n}),icon:u?void 0:"bots",onClick:()=>c({botId:t.id,chatId:s}),onContextMenu:v},t.shortName,p&&o.ZP.createElement(lo.Z,null,o.ZP.createElement(Pt.Z,{isOpen:m,positionX:"right",style:`left: ${p.x}px;top: ${p.y}px;`,className:"bot-attach-context-menu",autoClose:!0,onClose:I,onCloseAnimationEnd:y},o.ZP.createElement(st.Z,{icon:"stop",destructive:!0,onClick:w},d("WebApp.RemoveBot")))))})),po=(0,o.X$)((e=>{let{chatId:t,isButtonVisible:n,canAttachMedia:a,canAttachPolls:i,attachMenuBots:r,isScheduled:c,isPrivateChat:l,onFileSelect:d,onPollCreate:u,theme:m}=e;const[g,p,f]=(0,We.Z)(),[v,I,y]=(0,co.Z)(g,f),[w,Z,P]=(0,We.Z)();(0,o.d4)((()=>{g&&y()}),[g,y]);const C=(0,o.I4)((()=>{g?f():p()}),[g,p,f]),b=(0,o.I4)(((e,t)=>{const{files:n}=e.target;n&&n.length>0&&d(Array.from(n),t)}),[d]),S=(0,o.I4)((()=>{(0,ro.g)(Array.from(s.dI).join(","),(e=>b(e,!0)))}),[b]),M=(0,o.I4)((()=>{(0,ro.g)("*",(e=>b(e,!1)))}),[b]),E=(0,Ke.Z)();if(n)return o.ZP.createElement("div",{className:"AttachMenu"},o.ZP.createElement(io,{id:"attach-menu-button",className:g?"AttachMenu--button activated":"AttachMenu--button",round:!0,color:"translucent",onActivate:C,ariaLabel:"Add an attachment",ariaControls:"attach-menu-controls",hasPopup:!0},o.ZP.createElement("i",{className:"icon-attach"})),o.ZP.createElement(Pt.Z,{id:"attach-menu-controls",isOpen:g||w,autoClose:!0,positionX:"right",positionY:"bottom",onClose:f,className:"AttachMenu--menu fluid",onCloseAnimationEnd:f,onMouseEnter:h.$b?void 0:v,onMouseLeave:h.$b?void 0:I,noCloseOnBackdrop:!h.$b,ariaLabelledBy:"attach-menu-button"},!a&&o.ZP.createElement(st.Z,{className:"media-disabled",disabled:!0},"Posting media content is not allowed in this group."),a&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement(st.Z,{icon:"photo",onClick:S},E("AttachmentMenu.PhotoOrVideo")),o.ZP.createElement(st.Z,{icon:"document",onClick:M},E("AttachDocument"))),i&&o.ZP.createElement(st.Z,{icon:"poll",onClick:u},E("Poll")),a&&!c&&l&&Object.values(r).map((e=>o.ZP.createElement(go,{bot:e,chatId:t,theme:m,onMenuOpened:Z,onMenuClosed:P})))))})),fo=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,It.Z)(vt.gl.Extra,"SymbolMenu",!t);return n?o.ZP.createElement(n,e):void 0})),vo=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,It.Z)(vt.gl.Extra,"InlineBotTooltip",!t);return n?o.ZP.createElement(n,e):void 0})),Io=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,It.Z)(vt.gl.Extra,"MentionTooltip",!t);return n?o.ZP.createElement(n,e):void 0}));var yo=n(7146);const wo=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,It.Z)(vt.gl.Extra,"StickerTooltip",!t);return n?o.ZP.createElement(n,e):void 0}));var Zo=n(9830);const Po=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,It.Z)(vt.gl.Extra,"BotCommandTooltip",!t);return n?o.ZP.createElement(n,e):void 0})),Co=(0,o.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:i}=(0,a.Sv)(),[r,c]=(0,co.Z)(t,s),{isKeyboardSingleUse:l}=n||{},[d,u,m]=(0,We.Z)(!0),g=(0,o.I4)((()=>{m(),s()}),[s,m]);if((0,o.d4)((()=>{u()}),[u,null==n?void 0:n.keyboardButtons]),n&&n.keyboardButtons)return o.ZP.createElement(Pt.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},o.ZP.createElement("div",{className:"content"},n.keyboardButtons.map((e=>o.ZP.createElement("div",{className:"row"},e.map((e=>o.ZP.createElement(ot.Z,{ripple:!0,disabled:"unsupported"===e.type,onClick:()=>i({messageId:n.id,button:e})},e.text))))))))})));var bo=n(3616),So=n(7891);const Mo=(0,o.X$)((0,a.c$)((e=>{const{chatId:t,threadId:n,type:a}=(0,c.Bt)(e)||{};if(!t||!n||!a)return{};const{forwardMessages:{fromChatId:s,toChatId:o,messageIds:i}}=e,r=(0,c.Yy)(e,t,n),l="scheduled"===a?(0,c.wU)(e,t):(0,c._$)(e,t,n),u=e.settings.byKey.animationLevel>=1,m=o===t;let h,g;if(r?h=(0,c.hj)(e,t,r):l?h=(0,c.kK)(e,t,n,a):m&&1===i.length&&(h=(0,c.hj)(e,s,i[0])),r&&h){const{forwardInfo:n}=h,a=(0,c.FM)(e,t);n&&(n.isChannelPost||a)&&(g=(0,c.cv)(e,h)),g||null!=n&&n.hiddenUserName||(g=(0,c.Ur)(e,h))}else m&&(h&&(g=(0,c.cv)(e,h),g||(g=(0,c.Ur)(e,h))),g||(g=(0,d.YC)(s)?(0,c.dy)(e,s):(0,c.Z1)(e,s)));return{replyingToId:r,editingId:l,message:h,sender:g,shouldAnimate:u,forwardedMessagesCount:m?i.length:void 0}}))((e=>{let{replyingToId:t,editingId:n,message:s,sender:i,shouldAnimate:r,forwardedMessagesCount:c,onClear:l}=e;const{setReplyingToId:d,setEditingId:u,focusMessage:m,exitForwardMode:h}=(0,a.Sv)(),g=Boolean((t||n)&&s||i&&c),p=(0,So.Z)([c],c?300:void 0),{shouldRender:f,transitionClassNames:v}=(0,De.Z)(p&&g,void 0,!r,void 0,!r),I=(0,o.I4)((()=>{t?d({messageId:void 0}):n?u({messageId:void 0}):c&&h(),null==l||l()}),[t,n,c,l,d,u,h]);(0,o.d4)((()=>g?(0,ze.Z)(I):void 0),[g,I]);const y=(0,o.I4)((()=>{m({chatId:s.chatId,messageId:s.id})}),[m,s]),w=(0,Ee.Z)("ComposerEmbeddedMessage",v),Z=c&&c>1?`${c} forwarded messages`:void 0;if(f)return o.ZP.createElement("div",{className:w},o.ZP.createElement("div",null,o.ZP.createElement(ot.Z,{round:!0,faded:!0,color:"translucent",ariaLabel:"Cancel replying",onClick:I},o.ZP.createElement("i",{className:"icon-close"})),o.ZP.createElement(ta,{className:"inside-input",message:s,sender:i,customText:Z,title:n?"Edit Message":void 0,onClick:y})))}))),Eo=(0,o.X$)((e=>{const{attachments:t}=e,n=(0,It.Z)(vt.gl.Extra,"AttachmentModal",!t.length);return n?o.ZP.createElement(n,e):void 0})),Ro=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,It.Z)(vt.gl.Extra,"BotCommandMenu",!t);return n?o.ZP.createElement(n,e):void 0})),ko=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,It.Z)(vt.gl.Extra,"PollModal",!t);return n?o.ZP.createElement(n,e):void 0})),No=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,It.Z)(vt.gl.Extra,"DropArea",!t);return n?o.ZP.createElement(n,e):void 0})),To=new RegExp(s.FM,"i"),Ao=(0,o.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=Vs((()=>{const{text:e,entities:t}=(0,f.Z)(s),n=t&&t.find((e=>{let{type:t}=e;return t===i.Vv.TextUrl}));if(n)return n.url;const a=e.match(To);return a?a[0]:void 0}),300,[s]);(0,o.d4)((()=>{g?u({text:g}):(m(),h({chatId:t,threadId:n}))}),[t,h,m,g,u,n]),(0,Be.Z)((()=>{m(),h({chatId:t,threadId:n})}),[t]);const p=Boolean(c&&s.length&&!l&&!r),{shouldRender:v,transitionClassNames:I}=(0,De.Z)(p),y=(0,qt.Z)(c,!0),w=(0,o.I4)((()=>{h({chatId:t,threadId:n,noWebPage:!0})}),[t,n,h]);if(!v||!y)return;const{photo:Z,...P}=y,C={content:{webPage:P}};return o.ZP.createElement("div",{className:(0,Ee.Z)("WebPagePreview",I)},o.ZP.createElement("div",null,o.ZP.createElement(ot.Z,{round:!0,faded:!0,color:"translucent",ariaLabel:"Clear Webpage Preview",onClick:w},o.ZP.createElement("i",{className:"icon-close"})),o.ZP.createElement(Oa,{message:C,inPreview:!0,theme:d})))}))),Bo=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,It.Z)(vt.gl.Extra,"SendAsMenu",!t);return n?o.ZP.createElement(n,e):void 0})),xo=(0,o.X$)((e=>{let{isOpen:t,onClick:n,text:a,isDisabled:s}=e;const i=(0,o.sO)(null);return(0,o.d4)((()=>{const e=i.current;if(!e)return;const t=e.scrollWidth+1;e.closest(".Composer").style.setProperty("--bot-menu-text-width",`${t}px`)}),[t,a]),(0,o.d4)((()=>{const e=i.current;if(!e)return;const t=e.closest(".Composer");return()=>{t.style.removeProperty("--bot-menu-text-width")}}),[]),o.ZP.createElement(ot.Z,{className:(0,Ee.Z)("bot-menu",t&&"open"),round:!0,color:"translucent",disabled:s,onClick:n,ariaLabel:"Open bot command keyboard"},o.ZP.createElement("i",{className:(0,Ee.Z)("bot-menu-icon","icon-webapp",t&&"open")}),o.ZP.createElement("span",{ref:i,className:"bot-menu-text"},a))}));var Lo;!function(e){e.Send="send",e.Record="record",e.Edit="edit",e.Schedule="schedule"}(Lo||(Lo={}));const Oo="wonderful-voice-message.ogg",Uo=(0,o.X$)((0,a.c$)(((e,t)=>{var n,a,o,r,l,u,m;let{chatId:h,threadId:g,messageListType:p}=t;const f=(0,c.Z1)(e,h),v=h!==s.FV?(0,c.IK)(e,h):void 0,I=Boolean(v),y=(0,c.FM)(e,h),w=Boolean((0,c.dy)(e,h)),Z=I&&(0,c.FT)(e,h),P=(0,c.qy)(e,h),{language:C,shouldSuggestStickers:b}=e.settings.byKey,S=e.emojiKeywords[s.pR],M=C!==s.pR?e.emojiKeywords[C]:void 0,E=Z?Z.id:void 0,R=E?(0,c.hj)(e,h,E):void 0,{currentUserId:k}=e,N=null!=f&&f.fullInfo?(null==f||null===(n=f.fullInfo)||void 0===n?void 0:n.sendAsId)||k:void 0,T=null!=f&&f.sendAsIds&&N&&f.sendAsIds.includes(N)?N:null!=f&&null!==(a=f.adminRights)&&void 0!==a&&a.anonymous?null==f?void 0:f.id:void 0,A=T?(0,c.dy)(e,T):void 0,B=!A&&T?(0,c.Z1)(e,T):void 0,x=(0,c.QV)(e,h),L=(0,c.Bt)(e),O=h===(null==L?void 0:L.chatId)&&g===(null==L?void 0:L.threadId)&&p===(null==L?void 0:L.type),U="scheduled"===p?(0,c.hI)(e,h):(0,c.s)(e,h,g);return{editingMessage:(0,c.kK)(e,h,g,p),connectionState:e.connectionState,draft:(0,c.Ms)(e,h,g),chat:f,isChatWithBot:I,isChatWithSelf:y,isPrivateChat:w,isForCurrentMessageList:O,canScheduleUntilOnline:(0,c.Eh)(e,h),isChannel:f?(0,d.eA)(f):void 0,isRightColumnShown:(0,c.Jf)(e),isSelectModeActive:(0,c.CA)(e),withScheduledButton:g===i._f&&"thread"===p&&Boolean(null==P?void 0:P.length),shouldSchedule:"scheduled"===p,botKeyboardMessageId:E,botKeyboardPlaceholder:null==R?void 0:R.keyboardPlaceholder,isForwarding:h===e.forwardMessages.toChatId,pollModal:e.pollModal,stickersForEmoji:e.stickers.forEmoji.stickers,groupChatMembers:null==f||null===(o=f.fullInfo)||void 0===o?void 0:o.members,topInlineBotIds:null===(r=e.topInlineBots)||void 0===r?void 0:r.userIds,currentUserId:k,lastSyncTime:e.lastSyncTime,contentToBeScheduled:e.messages.contentToBeScheduled,shouldSuggestStickers:b,recentEmojis:e.recentEmojis,baseEmojiKeywords:null==S?void 0:S.keywords,emojiKeywords:null==M?void 0:M.keywords,inlineBots:e.inlineBots.byUsername,isInlineBotLoading:e.inlineBots.isLoading,chatBotCommands:(null==f?void 0:f.fullInfo)&&f.fullInfo.botCommands,botCommands:null!=v&&v.fullInfo?(null===(l=v.fullInfo.botInfo)||void 0===l?void 0:l.commands)||!1:void 0,botMenuButton:null==v||null===(u=v.fullInfo)||void 0===u||null===(m=u.botInfo)||void 0===m?void 0:m.menuButton,sendAsUser:A,sendAsChat:B,sendAsId:T,editingDraft:U,requestedText:x,attachMenuBots:e.attachMenu.bots,theme:(0,c.Pu)(e)}}))((e=>{let{dropAreaState:t,shouldSchedule:n,canScheduleUntilOnline:r,isReady:c,onDropHide:u,editingMessage:m,chatId:g,threadId:v,messageListType:I,draft:y,chat:w,isForCurrentMessageList:Z,connectionState:P,isChatWithBot:C,isChatWithSelf:b,isChannel:S,isRightColumnShown:E,isSelectModeActive:R,isForwarding:k,pollModal:N,botKeyboardMessageId:T,botKeyboardPlaceholder:A,withScheduledButton:B,stickersForEmoji:x,groupChatMembers:O,topInlineBotIds:U,currentUserId:F,lastSyncTime:$,contentToBeScheduled:D,shouldSuggestStickers:q,baseEmojiKeywords:j,emojiKeywords:G,recentEmojis:_,inlineBots:H,isInlineBotLoading:z,botCommands:V,chatBotCommands:W,sendAsUser:X,sendAsChat:Y,sendAsId:K,editingDraft:J,requestedText:Q,botMenuButton:ee,attachMenuBots:te,isPrivateChat:ne,theme:ae}=e;const{sendMessage:se,clearDraft:oe,showDialog:ie,setStickerSearchQuery:ce,setGifSearchQuery:le,forwardMessages:de,openPollModal:ue,closePollModal:me,loadScheduledHistory:he,openChat:ge,addRecentEmoji:pe,sendInlineBotResult:fe,loadSendAs:ve,loadFullChat:Ie,resetOpenChatWithText:ye,callAttachMenuBot:we}=(0,a.Sv)(),Ze=(0,Ke.Z)(),Pe=(0,o.sO)(null),[Ce,be]=(0,o.eJ)(""),Se=(0,Bs.Y)(Ce),Me=(0,o.sO)(),Re=(0,Ft.Z)(t),{width:ke}=re.Z.get(),Ne=null==w?void 0:w.sendAsIds,xe=Ne&&(Ne.length>1||!Ne.includes(F)),[Le,Oe,Ue]=(0,We.Z)(),Fe=(0,As.Z)(g,v),$e=(0,o.I4)((()=>{Ue()}),[Ue]),[De,qe]=(0,to.Z)(r,$e);(0,o.d4)((()=>{Me.current=void 0}),[g]),(0,o.d4)((()=>{g&&$&&v===i._f&&c&&he({chatId:g})}),[c,g,he,$,v]),(0,o.d4)((()=>{g&&w&&$&&!Ne&&c&&(0,d.ZV)(w)&&ve({chatId:g})}),[w,g,c,$,ve,Ne]),(0,o.d4)((()=>{g&&w&&$&&!w.fullInfo&&c&&(0,d.ZV)(w)&&Ie({chatId:g})}),[w,g,c,$,Ie]);const je=(0,o.sO)(!1);(0,Be.Z)((e=>{let[t,n]=e;je.current=Boolean(g===t&&Ne&&!n)}),[g,Ne]),(0,o.bt)((()=>{Pe.current&&(Pe.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[Ge,_e]=(0,o.eJ)([]),[He,Ve,Xe]=(0,We.Z)(),[Ye,Je,Qe]=(0,We.Z)(),[et,tt,nt]=(0,We.Z)(),[at,st,it]=(0,We.Z)(),[rt,ct,lt]=(0,We.Z)(),[ut,mt]=(0,We.Z)(),[ht,gt,pt]=(0,We.Z)(),{startRecordingVoice:ft,stopRecordingVoice:vt,pauseRecordingVoice:It,activeVoiceRecording:yt,currentRecordTime:wt,recordButtonRef:Zt,startRecordTimeRef:Pt}=(()=>{const e=(0,o.sO)(null),[t,n]=(0,o.eJ)(),a=(0,o.sO)(),[s,i]=(0,o.eJ)();(0,o.d4)((()=>{h.s$&&h.mh&&$s()}),[]);const r=(0,o.I4)((async()=>{try{const{stop:t,pause:s}=await Ds((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)`),i(Date.now()))}));a.current=Date.now(),i(Date.now()),n({stop:t,pause:s})}catch(e){console.error(e)}}),[]),c=(0,o.I4)((()=>{if(t){e.current&&(e.current.style.boxShadow="none");try{return t.pause()}catch(e){return void console.error(e)}}}),[t]),l=(0,o.I4)((()=>{if(t){n(void 0),a.current=void 0,i(void 0),e.current&&(e.current.style.boxShadow="none");try{return t.stop()}catch(e){return void console.error(e)}}}),[t]);return(0,o.d4)((()=>t?(0,ze.Z)(l):void 0),[t,l]),{startRecordingVoice:r,pauseRecordingVoice:c,stopRecordingVoice:l,activeVoiceRecording:t,currentRecordTime:s,recordButtonRef:e,startRecordTimeRef:a}})();(0,kn.Z)((()=>{Fe({type:"recordAudio"})}),yt&&s.o_),(0,o.d4)((()=>{yt||Fe({type:"cancel"})}),[yt,Fe]);const Ct=m?Lo.Edit:!h.mh||yt||Ce&&!Ge.length||k?n?Lo.Schedule:Lo.Send:Lo.Record,bt=!n,{isMentionTooltipOpen:St,closeMentionTooltip:Mt,insertMention:Et,mentionFilteredUsers:Rt}=(0,zs.Z)(!Ge.length,Se,be,void 0,O,U,F),{isOpen:kt,id:Nt,isGallery:Tt,switchPm:At,results:xt,closeTooltip:Lt,help:Ot,loadMore:Ut}=function(e,t,n,s){const{queryInlineBot:i,resetInlineBot:r}=(0,a.Sv)(),[c,l,d]=(0,We.Z)(),{username:u,query:m,canShowHelp:h,usernameLowered:g}=Vs((()=>function(e){const t=function(e){return Js.innerHTML=e.replace(/<br>/g,"\n"),Js.innerText}(e),n=t.match(Xs);return n?{username:n[1],query:n[2],canShowHelp:""===n[2]&&!t.match(Ys),usernameLowered:n[1].toLowerCase()}:Ks}(n)),300,[n])||{},p=(0,Ft.Z)(m),f=(0,Ft.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,o.d4)((()=>{p!==m&&d()}),[p,m,d]),(0,o.d4)((()=>{e&&g&&t&&i({chatId:t,username:g,query:m})}),[m,e,i,t,g]);const b=(0,o.I4)((()=>{i({chatId:t,username:g,query:m,offset:w})}),[w,t,m,i,g]);return(0,o.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:b}}(Boolean(!Ge.length&&$),g,Ce,H),{isOpen:$t,close:Dt,filteredBotCommands:qt}=function(e,t,n,a){const[s,i,r]=(0,We.Z)(),[c,l]=(0,o.eJ)(),d=(0,o.I4)((e=>{n||a?Qs((()=>{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,o.d4)((()=>{if(e&&t.length)if(t.startsWith("/")){const e=(0,Ts._)(t.substr(1)).match(eo);d(e?e[0]:"")}else l(void 0);else l(void 0)}),[d,t,e,r]),(0,o.d4)((()=>{c&&c.length&&t.length>0?i():r()}),[c,t.length,i,r]),{isOpen:s,close:r,filteredBotCommands:c}}(Boolean(V&&V.length||W&&W.length),Ce,V,W),{isContextMenuOpen:jt,handleContextMenu:Gt,handleContextMenuClose:_t,handleContextMenuHide:Ht}=(0,xn.Z)(Zt,!(Ct===Lo.Send&&bt)),{canSendStickers:zt,canSendGifs:Vt,canAttachMedia:Wt,canAttachPolls:Xt,canAttachEmbedLinks:Yt}=(0,o.Ye)((()=>(0,d.H5)(w,C)),[w,C]),Kt=w&&(0,d.Nl)(w),Jt=(0,d.Hd)(w),{isStickerTooltipOpen:Qt,closeStickerTooltip:en}=function(e,t,n){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const i=(0,o.Ye)((()=>(0,Ts._)(t).trim()),[t]),{loadStickersForEmoji:r,clearStickersForEmoji:c}=(0,a.Sv)(),l=h.op&&1===(0,Ns.Z)(i)||!h.op&&Boolean(t.match(/^<img.[^>]*?>$/g)),d=Boolean(n)&&l;return(0,o.d4)((()=>{var t;s||(e&&l?r({emoji:h.op?i:null===(t=i.match(/alt="(.+)"/))||void 0===t?void 0:t[1]}):!d&&l||c())}),[t,l,c,r,e,s]),{isStickerTooltipOpen:d,closeStickerTooltip:c}}(Boolean(q&&zt&&!Ge.length),Ce,x,!c),{isEmojiTooltipOpen:tn,closeEmojiTooltip:nn,filteredEmojis:an,insertEmoji:sn}=(0,Hs.Z)(Boolean(q&&zt&&!Ge.length),Se,_,void 0,be,j,G,!c),on=(0,o.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 o=(0,hn.Z)(e,["escape_html","emoji_html","br_html"]).join("").replace(/\u200b+/g,"");if(n.rangeCount){const e=n.getRangeAt(0);if((0,Es.R)(e,t))return Ms(o),void a.dispatchEvent(new Event("input",{bubbles:!0}))}be(`${Se.current}${o}`),requestAnimationFrame((()=>{(0,Ps.Z)(a)}))}),[Se]),rn=(0,o.I4)((()=>{const e=window.getSelection();if(e.rangeCount){const t=e.getRangeAt(0);if((0,Es.R)(t,s.R2))return void document.execCommand("delete",!1)}be(function(e){const t=document.createElement("div");t.contentEditable="true",t.style.position="absolute",t.style.left="-10000px",t.style.top="-10000px",t.innerHTML=e,document.body.appendChild(t);let n=t.lastChild;if(n.lastChild)for(;n.lastChild;)n=n.lastChild;const a=n.textContent.length,s=document.createRange(),o=window.getSelection();s.setStart(n,a),s.setEnd(n,a),o.removeAllRanges(),o.addRange(s),document.execCommand("delete",!1);const i=t.innerHTML;return document.body.removeChild(t),i}(Se.current))}),[Se]),cn=(0,o.I4)((function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e||be(""),_e(l.D),en(),Mt(),nn(),h.wB?setTimeout((()=>nt()),350):nt()}),[en,Mt,nn,nt]),ln=(0,o.sO)();ln.current=vt,(0,o.d4)((()=>()=>{ln.current(),cn()}),[g,cn,ln]);const[dn,un]=((e,t,n,i,r,c,l,u,m,h)=>{const{editMessage:g,setEditingDraft:p}=(0,a.Sv)();(0,Pn.Z)((e=>{let[a]=e;if(!n)return;if((null==a?void 0:a.id)===n.id)return;const o=(0,Ea.z)(null!=h&&h.text.length?h:n.content.text);t(o),requestAnimationFrame((()=>{const e=document.querySelector(s.Ed);e&&(0,Ps.Z)(e,!0)}))}),[n,t]),(0,o.d4)((()=>{if(n)return()=>{const t=(0,f.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 v=(0,o.I4)((()=>{m&&(0,M.T2)((()=>{t((0,Ea.z)(m));const e=document.querySelector(s.Ed);e&&requestAnimationFrame((()=>{(0,Ps.Z)(e,!0)}))}))}),[m,t]),I=(0,o.I4)((()=>{i(),v()}),[i,v]),y=(0,o.I4)((()=>{const{text:t,entities:a}=(0,f.Z)(e.current);n&&(t||(0,d.u8)(n)?(g({messageId:n.id,text:t,entities:a}),i(),v()):r())}),[g,n,e,r,i,v]),w=(0,o.I4)((()=>{if(!n)return;const t=(0,f.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,Te.Z)(w),Ae(w),[y,I]})(Se,be,m,cn,ct,g,v,I,y,J);((e,t,n,i,r,c)=>{const{saveDraft:l,clearDraft:d}=(0,a.Sv)(),u=(0,o.I4)(((e,t)=>{const n=i.current;c||(n.length?l({chatId:e,threadId:t,draft:(0,f.Z)(n)}):void 0!==n&&d({chatId:e,threadId:t}))}),[d,c,i,l]),m=(0,o.Ye)((()=>(0,M.Ds)((e=>e()),s.r_,!1)),[t]),g=(0,Ft.Z)(t),p=(0,Ft.Z)(n);(0,o.d4)((()=>(Gs=t,_s=n,()=>{Gs=void 0,_s=void 0,u(t,n)})),[t,n,u]),(0,o.d4)((()=>{t===g&&n===p||!c&&e&&(r((0,Ea.z)(e)),h.$b||requestAnimationFrame((()=>{const e=document.querySelector(s.Ed);e&&(0,Ps.Z)(e,!0)})))}),[t,n,e,r,u,g,p,c]);const v=i.current,I=(0,Ft.Z)(v);(0,o.d4)((()=>{t&&n&&g===t&&p===n&&I!==v&&(v.length?m((()=>{Gs===t&&_s===n&&u(t,n)})):u(t,n))}),[t,v,g,I,p,m,n,u]);const y=(0,o.I4)((()=>{t&&n&&u(t,n)}),[t,n,u]);(0,Te.Z)(y),Ae(y)})(y,g,v,Se,be,m),((e,t,n,a)=>{(0,o.d4)((()=>{if(e)return document.addEventListener("paste",o,!1),()=>{document.removeEventListener("paste",o,!1)};async function o(e){if(!e.clipboardData)return;const o=document.activeElement;if(o&&![s.R2,s.nY].includes(o.id))return;const i=e.clipboardData.getData("text").substring(0,4096),{items:r}=e.clipboardData;let c=[];if(e.preventDefault(),r.length>0&&(c=await(0,qs.Z)(r)),0!==c.length||i){if(c.length>0&&!a){const e=await Promise.all(c.map((e=>Ss(e.name,e,1===c.length&&js.includes(e.type)))));n((t=>t.concat(e)))}i&&t(i,null==o?void 0:o.id)}}}),[t,a,n,e])})(Z,on,_e,m);const mn=(0,o.I4)((()=>{m&&un()}),[m,un]),gn=(0,o.I4)((async(e,t)=>{_e(await Promise.all(e.map((e=>Ss(e.name,e,t)))))}),[]),pn=(0,o.I4)((async(e,t)=>{_e([...Ge,...await Promise.all(e.map((e=>Ss(e.name,e,t))))])}),[Ge]),vn=(0,o.I4)((()=>{_e(l.D)}),[]),In=(0,o.I4)((async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0;if("connectionStateReady"!==P)return;let n=Ge;if(yt){const e=await vt();if(e){const{blob:t,duration:a,waveform:s}=e;n=[await Ss(Oo,t,!1,{voice:{duration:a,waveform:s}})]}}const{text:o,entities:i}=(0,f.Z)(Se.current);if(!n.length&&!o&&!k)return;const{serverTimeOffset:r}=(0,a.Rd)(),c=n.length?1024:4096;if((null==o?void 0:o.length)>c){const e=o.length-c;return void ie({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||o){if(Jt&&!Kt){const e=(0,p.b)(r),t=Me.current&&Math.floor(e-Me.current),n=Jt.nextSendDate&&Jt.nextSendDate>e;if(t&&t<Jt.seconds||n){const a=n?Jt.nextSendDate-e:Jt.seconds-t;return ie({data:{message:Ze("SlowModeHint",(0,L.k9)(a)),isSlowMode:!0,hasErrorKey:!1}}),void(null==l||l.blur())}}se({text:o,entities:i,attachments:n,scheduledAt:t,isSilent:e})}k&&de({scheduledAt:t,isSilent:e}),Me.current=(0,p.b)(r),oe({chatId:g,localOnly:!0}),h.cj&&l&&l===document.activeElement&&ks(l),requestAnimationFrame((()=>{cn()}))}),[P,Ge,yt,k,oe,g,cn,vt,ie,Jt,Kt,se,de,Ze,Se]),yn=(0,o.I4)((()=>{"webApp"===(null==ee?void 0:ee.type)&&we({botId:g,chatId:g,isFromBotMenu:!0,url:ee.url})}),[ee,we,g]),wn=(0,o.I4)((()=>{nt(),Je()}),[nt,Je]),Zn=(0,o.I4)((()=>{Qe(),it(),tt()}),[Qe,it,tt]),Cn=(0,o.I4)(((e,t)=>{if(e&&"queryId"in e){const{id:n,queryId:a,isSilent:s}=e;return void fe({id:n,queryId:a,scheduledAt:t,isSilent:s})}const{isSilent:n,...a}=e||{};e&&0!==Object.keys(a).length?se({...e,scheduledAt:t}):In(Boolean(n),t)}),[In,fe,se]);(0,o.d4)((()=>{D&&De((e=>{Cn(D,e)}))}),[D,Cn,De]),(0,o.d4)((()=>{Q&&(be(Q),ye(),requestAnimationFrame((()=>{const e=document.getElementById(s.R2);(0,Ps.Z)(e,!0)})))}),[Q,ye]);const bn=(0,o.I4)((function(e,t,a){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];e={...e,isPreloadedGlobally:!0},n||a?(Oe(),De((n=>{Ue(),Cn({sticker:e,isSilent:t},n),requestAnimationFrame((()=>{cn(s)}))}))):(se({sticker:e,isSilent:t}),requestAnimationFrame((()=>{cn(s)})))}),[n,Oe,De,Ue,Cn,cn,se]),Sn=(0,o.I4)(((e,t,a)=>{n||a?(Oe(),De((n=>{Ue(),Cn({gif:e,isSilent:t},n),requestAnimationFrame((()=>{cn(!0)}))}))):(se({gif:e,isSilent:t}),requestAnimationFrame((()=>{cn(!0)})))}),[n,Oe,De,Ue,Cn,cn,se]),Mn=(0,o.I4)(((e,t,a)=>{if("connectionStateReady"!==P)return;n||a?De((n=>{Cn({id:e.id,queryId:e.queryId,isSilent:t},n)})):fe({id:e.id,queryId:e.queryId,isSilent:t});const o=document.querySelector(s.Ed);h.cj&&o&&o===document.activeElement&&ks(o),oe({chatId:g,localOnly:!0}),requestAnimationFrame((()=>{cn()}))}),[g,oe,P,Cn,De,cn,fe,n]),En=(0,o.I4)((()=>{oe({chatId:g,localOnly:!0}),requestAnimationFrame((()=>{cn()}))}),[g,oe,cn]),Rn=(0,o.I4)((e=>{n?(De((t=>{Cn({poll:e},t)})),me()):(se({poll:e}),me())}),[me,Cn,De,se,n]),Nn=(0,o.I4)((()=>{n?De((e=>{Cn({isSilent:!0},e)})):In(!0)}),[Cn,In,De,n]),Tn=(0,o.I4)((e=>{"stickers"===e?(ce({query:""}),le({query:void 0})):(le({query:""}),ce({query:void 0}))}),[ce,le]),An=(0,o.I4)((()=>{const e=document.querySelector(s.Ed);h.wB&&e===document.activeElement?(null==e||e.blur(),setTimeout((()=>{Qe(),tt()}),100)):tt()}),[tt,Qe]),Bn=(0,o.I4)((()=>{const e=document.querySelector(s.Ed);if(!h.wB||e!==document.activeElement)return Qe(),nt(),void st();null==e||e.blur(),setTimeout((()=>{Qe(),nt(),st()}),100)}),[Qe,nt,st]),Ln=(0,o.I4)((()=>{ge({id:g,threadId:v,type:"scheduled"})}),[ge,g,v]);(0,o.d4)((()=>{E&&h.wB&&nt()}),[E,nt]),(0,o.d4)((()=>{c&&(R?gt():setTimeout((()=>{pt()}),200))}),[R,pt,gt,c]);const On=(0,o.I4)((()=>{switch(Ct){case Lo.Send:In();break;case Lo.Record:ft();break;case Lo.Edit:dn();break;case Lo.Schedule:yt&&It(),De((e=>{Cn({},e)}))}}),[Ct,In,ft,dn,yt,De,It,Cn]),Un=Ct===Lo.Record&&!Wt,Fn=(0,Ft.Z)(m,!0),$n=m||Fn,Dn=new Date;Dn.setSeconds(0),Dn.setMilliseconds(0);const qn=new Date;qn.setFullYear(qn.getFullYear()+1);let jn="SendMessage";switch(Ct){case Lo.Edit:jn="Save edited message";break;case Lo.Record:jn=Un?"Conversation.DefaultRestrictedMedia":"AccDescrVoiceMessage"}const Gn=(0,Ee.Z)("Composer",!R&&"shown",ht&&"hover-disabled"),_n=(0,Ee.Z)("mobile-symbol-menu-button",!c&&"not-ready",ut?et&&"menu-opened":et&&"is-loading"),Hn=(0,o.I4)((()=>{De((e=>{Cn({},e)}))}),[Cn,De]),zn=Ct===Lo.Edit?dn:Ct===Lo.Schedule?Hn:In,Vn=ee&&"commands"===(null==ee?void 0:ee.type);return o.ZP.createElement("div",{className:Gn},Wt&&c&&o.ZP.createElement(No,{isOpen:t!==Bt.t.None,withQuick:t===Bt.t.QuickFile||Re===Bt.t.QuickFile,onHide:u,onFileSelect:gn}),o.ZP.createElement(Eo,{chatId:g,threadId:v,canShowCustomSendMenu:bt,attachments:Ge,caption:Ge.length?Ce:"",groupChatMembers:O,currentUserId:F,recentEmojis:_,isReady:c,isChatWithSelf:b,onCaptionUpdate:be,baseEmojiKeywords:j,emojiKeywords:G,addRecentEmoji:pe,shouldSchedule:n,onSendSilent:Nn,onSend:In,onSendScheduled:Hn,onFileAppend:pn,onClear:vn}),o.ZP.createElement(ko,{isOpen:N.isOpen,isQuiz:N.isQuiz,shouldBeAnonimous:S,onClear:me,onSend:Rn}),$n&&o.ZP.createElement(no,{isOpen:rt,isSchedule:"scheduled"===I,onClose:lt,message:$n}),o.ZP.createElement(Bo,{isOpen:at,onClose:it,chatId:g,selectedSendAsId:K,sendAsIds:Ne}),o.ZP.createElement(Io,{isOpen:St,onClose:Mt,onInsertUserName:Et,filteredUsers:Rt}),o.ZP.createElement(vo,{isOpen:kt,botId:Nt,isGallery:Tt,inlineBotResults:xt,switchPm:At,onSelectResult:Mn,loadMore:Ut,onClose:Lt,isSavedMessages:b,canSendGifs:Vt}),o.ZP.createElement(Po,{isOpen:$t,withUsername:Boolean(W),botCommands:qt,onClick:En,onClose:Dt}),o.ZP.createElement("div",{id:"message-compose"},o.ZP.createElement("div",{className:"svg-appendix",ref:Pe}),o.ZP.createElement(Mo,{onClear:mn}),o.ZP.createElement(Ao,{chatId:g,threadId:v,messageText:Ge.length?"":Ce,disabled:!Yt}),o.ZP.createElement("div",{className:"message-input-wrapper"},C&&ee&&"webApp"===ee.type&&!m&&o.ZP.createElement(xo,{isOpen:!Ce&&!yt,onClick:yn,text:ee.text,isDisabled:Boolean(yt)}),C&&Vn&&!1!==V&&!yt&&!m&&o.ZP.createElement(io,{className:(0,Ee.Z)("bot-commands",Ye&&"activated"),round:!0,disabled:void 0===V,color:"translucent",onActivate:wn,ariaLabel:"Open bot command keyboard"},o.ZP.createElement("i",{className:"icon-bot-commands-filled"})),xe&&(X||Y)&&o.ZP.createElement(ot.Z,{round:!0,color:"translucent",onClick:at?it:Bn,ariaLabel:Ze("SendMessageAsTitle"),className:(0,Ee.Z)("send-as-button",je.current&&"appear-animation")},o.ZP.createElement(fn.Z,{user:X,chat:Y,size:"tiny"})),h.wB?o.ZP.createElement(ot.Z,{className:_n,round:!0,color:"translucent",onClick:et?nt:An,ariaLabel:"Choose emoji, sticker or GIF"},o.ZP.createElement("i",{className:"icon-smile"}),o.ZP.createElement("i",{className:"icon-keyboard"}),et&&!ut&&o.ZP.createElement(dt.Z,{color:"gray"})):o.ZP.createElement(io,{className:et?"activated":"",round:!0,color:"translucent",onActivate:Zn,ariaLabel:"Choose emoji, sticker or GIF"},o.ZP.createElement("i",{className:"icon-smile"})),o.ZP.createElement(bo.Z,{id:"message-input-text",chatId:g,threadId:v,html:Ge.length?"":Ce,placeholder:yt&&ke<=600?"":A||Ze("Message"),forcedPlaceholder:Ot,canAutoFocus:c&&!Ge.length,shouldSuppressFocus:h.wB&&et,shouldSuppressTextFormatter:tn||St||kt,onUpdate:be,onSend:zn,onSuppressedFocus:nt}),z&&Boolean(Nt)&&o.ZP.createElement(dt.Z,{color:"gray"}),B&&o.ZP.createElement(ot.Z,{round:!0,faded:!0,className:"scheduled-button",color:"translucent",onClick:Ln,ariaLabel:"Open scheduled messages"},o.ZP.createElement("i",{className:"icon-schedule"})),T&&!yt&&!m&&o.ZP.createElement(io,{className:He?"activated":"",round:!0,color:"translucent",onActivate:Ve,ariaLabel:"Open bot command keyboard"},o.ZP.createElement("i",{className:"icon-bot-command"})),yt&&wt&&o.ZP.createElement("span",{className:"recording-state"},(0,L.rM)(wt-Pt.current)),o.ZP.createElement(po,{chatId:g,isButtonVisible:!yt&&!m,canAttachMedia:Wt,canAttachPolls:Xt,onFileSelect:gn,onPollCreate:ue,isScheduled:n,isPrivateChat:ne,attachMenuBots:te,theme:ae}),T&&o.ZP.createElement(Co,{messageId:T,isOpen:He,onClose:Xe}),V&&o.ZP.createElement(Ro,{isOpen:Ye,botCommands:V,onClose:Qe}),o.ZP.createElement(wo,{chatId:g,threadId:v,isOpen:Qt,onStickerSelect:bn}),o.ZP.createElement(Zo.Z,{isOpen:tn,emojis:an,onClose:nn,onEmojiSelect:sn,addRecentEmoji:pe}),o.ZP.createElement(fo,{chatId:g,threadId:v,isOpen:et||Le,canSendGifs:Vt,canSendStickers:zt,onLoad:mt,onClose:nt,onEmojiSelect:on,onStickerSelect:bn,onGifSelect:Sn,onRemoveSymbol:rn,onSearchOpen:Tn,addRecentEmoji:pe}))),yt&&o.ZP.createElement(ot.Z,{round:!0,color:"danger",className:"cancel",onClick:vt,ariaLabel:"Cancel voice recording"},o.ZP.createElement("i",{className:"icon-delete"})),o.ZP.createElement(ot.Z,{ref:Zt,round:!0,color:"secondary",className:(0,Ee.Z)(Ct,!c&&"not-ready",yt&&"recording"),disabled:Un,ariaLabel:Ze(jn),onClick:On,onContextMenu:Ct===Lo.Send&&bt?Gt:void 0},o.ZP.createElement("i",{className:"icon-send"}),o.ZP.createElement("i",{className:"icon-schedule"}),o.ZP.createElement("i",{className:"icon-microphone-alt"}),o.ZP.createElement("i",{className:"icon-check"})),bt&&o.ZP.createElement(yo.Z,{isOpen:jt,onSendSilent:b?void 0:Nn,onSendSchedule:n?void 0:Hn,onClose:_t,onCloseAnimationEnd:Ht,isSavedMessages:b}),qe)}))),Fo=(0,o.X$)((e=>{const{isActive:t}=e,n=(0,It.Z)(vt.gl.Extra,"MobileSearch",!t,!0);return n?o.ZP.createElement(n,e):void 0})),$o=(0,o.X$)((e=>{const{isActive:t}=e,n=(0,It.Z)(vt.gl.Extra,"MessageSelectToolbar",!t);return n?o.ZP.createElement(n,e):void 0})),Do=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,It.Z)(vt.gl.Extra,"UnpinAllMessagesModal",!t);return n?o.ZP.createElement(n,e):void 0})),qo=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,It.Z)(vt.gl.Extra,"PaymentModal",!t);return n?o.ZP.createElement(n,e):void 0})),jo=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,It.Z)(vt.gl.Extra,"ReceiptModal",!t);return n?o.ZP.createElement(n,e):void 0})),Go=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,It.Z)(vt.gl.Extra,"SeenByModal",!t);return n?o.ZP.createElement(n,e):void 0})),_o=(0,o.X$)((e=>{const{activeEmojiInteraction:t}=e,n=(0,It.Z)(vt.gl.Extra,"EmojiInteractionAnimation",!t);return n?o.ZP.createElement(n,e):void 0})),Ho=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,It.Z)(vt.gl.Extra,"ReactorListModal",!t);return n?o.ZP.createElement(n,e):void 0})),zo=h.wB?450+s.fK:void 0;function Vo(e){return"file"===e.kind&&e.type&&s.oG.has(e.type)}const Wo=(0,o.X$)((0,a.c$)((e=>{const t=(0,c.Pu)(e),{isBlurred:n,background:a,backgroundColor:s,patternColor:o}=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:o,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,r.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:b,messageId:S}=e.audioPlayer,M=Z&&(0,d.Qm)(Z,I),E=(0,c.pk)(e,v),R="pinned"===y,k="scheduled"===y,N="thread"===y&&I===i._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&&E;return{...f,chatId:v,threadId:I,messageListType:y,isPrivate:w,areChatSettingsLoaded:Boolean(null==Z?void 0:Z.settings),canPost:!R&&(!Z||M)&&!E,isPinnedMessageList:R,isScheduledMessageList:k,currentUserBannedRights:null==Z?void 0:Z.currentUserBannedRights,defaultBannedRights:null==Z?void 0:Z.defaultBannedRights,hasPinnedOrAudioPlayer:I!==i._f||Boolean(!R&&(null==C?void 0:C.length))||Boolean(b&&S),pinnedMessagesCount:C?C.length:0,shouldSkipHistoryAnimations:e.shouldSkipHistoryAnimations,isChannel:T,canSubscribe:A,canStartBot:x,canRestartBot:B}}))((e=>{let{chatId:t,threadId:n,messageListType:i,isPrivate:r,isPinnedMessageList:c,canPost:l,currentUserBannedRights:u,defaultBannedRights:m,hasPinnedOrAudioPlayer:g,pinnedMessagesCount:p,customBackground:f,theme:v,backgroundColor:I,patternColor:y,isLeftColumnShown:w,isRightColumnShown:Z,isBackgroundBlurred:P,isMobileSearchActive:C,isSelectModeActive:b,isPaymentModalOpen:S,isReceiptModalOpen:M,isSeenByModalOpen:E,isReactorListModalOpen:R,animationLevel:k,shouldSkipHistoryAnimations:N,currentTransitionKey:T,isChannel:A,areChatSettingsLoaded:B,canSubscribe:x,canStartBot:L,canRestartBot:O,activeEmojiInteractions:U,lastSyncTime:F}=e;const{openChat:$,openPreviousChat:D,unpinAllMessages:q,loadUser:j,loadChatSettings:G,closeLocalTextSearch:_,exitMessageSelectMode:H,closePaymentModal:z,clearReceipt:V,joinChannel:W,sendBotCommand:X,restartBot:Y}=(0,a.Sv)(),{width:K}=(0,Ot.Z)(),J=(0,Ke.Z)(),[Q,ee]=(0,o.eJ)(Bt.t.None),[te,ne]=(0,o.eJ)(),[ae,re]=(0,o.eJ)(),[ce,le]=(0,o.eJ)(!1),de=g&&(K<s.l3||Z&&K>s._m&&K<s.QU||K>=s.ks&&K<s.jT),ue=(0,Ut.Z)(t,zo),me=(0,Ut.Z)(n,zo),he=(0,Ut.Z)(i,zo),ge=(0,Ut.Z)(x,zo),pe=(0,Ut.Z)(L,zo),fe=(0,Ut.Z)(O,zo),ve=(0,Ut.Z)(l,zo)&&!fe&&!pe&&!ge,Ie=(0,Ut.Z)(de,zo),ye=(0,Ut.Z)(te,zo),we=(0,Ut.Z)(A,zo),Ze=(0,Ft.Z)(T),Pe=void 0!==Ze&&Ze<T?Ze:void 0,{isReady:Ce,handleOpenEnd:be,handleSlideStop:Se}=function(e,t,n,a){const[s,i]=(0,o.eJ)(!h.wB),r=(0,Fe.Z)(),c=void 0!==n&&n!==t;return c&&(e?i(!1):r()),(0,Be.Z)((()=>{e||i(!0)}),[e]),{isReady:s&&!c,handleOpenEnd:e?function(e){"transform"===e.propertyName&&e.target===e.currentTarget&&i(Boolean(a))}:void 0,handleSlideStop:e?function(){i(!0)}:void 0}}(!N&&k!==s.oB,T,Ze,t);(0,o.d4)((()=>t?(0,ze.Z)((()=>{$({id:void 0})})):void 0),[t,$]),(0,Be.Z)((()=>{ee(Bt.t.None),ne(void 0),re(void 0)}),[t]),(0,o.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,o.d4)((()=>{r&&j({userId:t})}),[t,r,j]),(0,o.d4)((()=>{!B&&F&&G({chatId:t})}),[t,r,B,F,G]);const Me=(0,o.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(Vo);ee(n?Bt.t.QuickFile:Bt.t.Document)}),[]),Re=(0,o.I4)((()=>{ee(Bt.t.None)}),[]),ke=(0,o.I4)((()=>{le(!0)}),[]),Ne=(0,o.I4)((()=>{le(!1)}),[]),Te=(0,o.I4)((()=>{q({chatId:t}),Ne(),D()}),[q,t,Ne,D]),Ae=(0,o.I4)((()=>{$({id:t})}),[$,t]),xe=(0,o.I4)((()=>{W({chatId:t})}),[W,t]),Le=(0,o.I4)((()=>{X({command:"/start"})}),[X]),Oe=(0,o.I4)((()=>{Y({chatId:t})}),[t,Y]),Ue=((e,t)=>{const[n,a]=(0,o.eJ)(t);return(0,o.d4)((()=>{t&&(t.startsWith("#")?a(t):xt.fetch(s.fo,e,xt.Type.Blob).then((e=>{const t=URL.createObjectURL(e);(0,Lt.pt)(t).then((()=>{a(`url(${t})`)}))})))}),[t,e]),t?n:void 0})(v,f),De=(0,Ee.Z)(Ie&&"has-header-tools",f&&"custom-bg-image",I&&"custom-bg-color",f&&P&&"blurred",h.aZ?"mask-image-disabled":"mask-image-enabled"),qe=(0,Ee.Z)("messaging-disabled",!b&&"shown"),je=(0,d.q8)(J,u,m),{composerHiddenScale:Ge,toolbarHiddenScale:_e,composerTranslateX:He,toolbarTranslateX:Ve,unpinHiddenScale:We,toolbarForUnpinHiddenScale:Xe}=(0,o.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,ie),oe),n=Math.min(.25*e,oe);return Math.min(e-t-n,se)}if(e>s.ks){const t=Math.min(Math.max(.4*e,ie),oe);return Math.min(e-t,se)}return e>se?se:e}(e),o=e<=s.l3?54:64,i=t?a-n-o:a-n,r=e>s.l3?Math.min(a-n,512):a-n,c=r/i,l=i/r;return{composerHiddenScale:c,toolbarHiddenScale:l,composerTranslateX:t?o/2*l:0,toolbarTranslateX:t?o/2*-1*c:0,unpinHiddenScale:r/258,toolbarForUnpinHiddenScale:258/r}}(K,ve)),[ve,K]),Je=(0,Ee.Z)("middle-column-footer",!ve&&"no-composer",ve&&ae&&!b&&"with-notch");(0,$e.Z)({isActive:b,onBack:H}),(0,$e.Z)({isActive:C,onBack:_});const Qe=Boolean(!c&&!ve&&!fe&&!pe&&!ge&&je),et=Boolean(fe||ge||pe||c),tt=Boolean(Qe||b||c);return o.ZP.createElement("div",{id:"MiddleColumn",className:De,onTransitionEnd:be,style:`\n --composer-hidden-scale: ${Ge};\n --toolbar-hidden-scale: ${_e};\n --unpin-hidden-scale: ${We};\n --toolbar-unpin-hidden-scale: ${Xe};\n --composer-translate-x: ${He}px;\n --toolbar-translate-x: ${Ve}px;\n --pattern-color: ${y};\n --theme-background-color:\n ${I||("dark"===v?s.It:s.p3)};\n `,onClick:h.p7&&w?Ae:void 0},o.ZP.createElement("div",{id:"middle-column-bg",style:Ue?`--custom-background: ${Ue}`:void 0}),o.ZP.createElement("div",{id:"middle-column-portals"}),ue&&me&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("div",{className:"messages-layout",onDragEnter:ve?Me:void 0},o.ZP.createElement(wn,{chatId:ue,threadId:me,messageListType:he,isReady:Ce}),o.ZP.createElement(Ye.Z,{name:N?"none":k===s.zy?"slide":"fade",activeKey:T,shouldCleanup:!0,cleanupExceptionKey:Pe,onStop:Se},o.ZP.createElement(ys,{key:`${ue}-${me}-${he}`,chatId:ue,threadId:me,type:he,canPost:ve,hasTools:Ie,onFabToggle:ne,onNotchToggle:re,isReady:Ce,withBottomShift:et}),o.ZP.createElement("div",{className:Je},ve&&o.ZP.createElement(Uo,{chatId:ue,threadId:me,messageListType:he,dropAreaState:Q,onDropHide:Re,isReady:Ce}),c&&o.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:J.isRtl?"rtl":void 0},o.ZP.createElement(ot.Z,{size:"tiny",fluid:!0,color:"secondary",className:"unpin-all-button",onClick:ke},o.ZP.createElement("i",{className:"icon-unpin"}),o.ZP.createElement("span",null,J("Chat.Pinned.UnpinAll",p,"i")))),Qe&&o.ZP.createElement("div",{className:qe},o.ZP.createElement("div",{className:"messaging-disabled-inner"},o.ZP.createElement("span",null,je))),h.wB&&ge&&o.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:J.isRtl?"rtl":void 0},o.ZP.createElement(ot.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:xe},J(we?"ProfileJoinChannel":"ProfileJoinGroup"))),h.wB&&pe&&o.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:J.isRtl?"rtl":void 0},o.ZP.createElement(ot.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:Le},J("BotStart"))),h.wB&&fe&&o.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:J.isRtl?"rtl":void 0},o.ZP.createElement(ot.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:Oe},J("BotRestart"))),o.ZP.createElement($o,{messageListType:he,isActive:b,canPost:ve}),o.ZP.createElement(qo,{isOpen:Boolean(S),onClose:z}),o.ZP.createElement(jo,{isOpen:Boolean(M),onClose:V}),o.ZP.createElement(Go,{isOpen:E}),o.ZP.createElement(Ho,{isOpen:R}))),o.ZP.createElement(Zs,{isShown:ye,canPost:ve,withExtraShift:tt})),h.wB&&o.ZP.createElement(Fo,{isActive:Boolean(C)})),t&&o.ZP.createElement(Do,{isOpen:ce,chatId:t,pinnedMessagesCount:p,onClose:Ne,onUnpin:Te}),o.ZP.createElement("div",{teactFastList:!0},null==U?void 0:U.map(((e,t)=>o.ZP.createElement(_o,{teactOrderKey:t,key:e.id,activeEmojiInteraction:e})))))}))),Xo=450+s.fK,Yo=(0,M.Ds)((e=>e()),200,!1);var Ko;!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.MessageStatistics=5]="MessageStatistics",e[e.Management=6]="Management",e[e.ManageInitial=7]="ManageInitial",e[e.ManageChannelSubscribers=8]="ManageChannelSubscribers",e[e.ManageChatAdministrators=9]="ManageChatAdministrators",e[e.ManageChatPrivacyType=10]="ManageChatPrivacyType",e[e.ManageDiscussion=11]="ManageDiscussion",e[e.ManageGroupPermissions=12]="ManageGroupPermissions",e[e.ManageGroupRemovedUsers=13]="ManageGroupRemovedUsers",e[e.ManageChannelRemovedUsers=14]="ManageChannelRemovedUsers",e[e.ManageGroupUserPermissionsCreate=15]="ManageGroupUserPermissionsCreate",e[e.ManageGroupUserPermissions=16]="ManageGroupUserPermissions",e[e.ManageGroupRecentActions=17]="ManageGroupRecentActions",e[e.ManageGroupAdminRights=18]="ManageGroupAdminRights",e[e.ManageGroupNewAdminRights=19]="ManageGroupNewAdminRights",e[e.ManageGroupMembers=20]="ManageGroupMembers",e[e.ManageGroupAddAdmins=21]="ManageGroupAddAdmins",e[e.StickerSearch=22]="StickerSearch",e[e.GifSearch=23]="GifSearch",e[e.PollResults=24]="PollResults",e[e.AddingMembers=25]="AddingMembers",e[e.ManageInvites=26]="ManageInvites",e[e.ManageEditInvite=27]="ManageEditInvite",e[e.ManageReactions=28]="ManageReactions",e[e.ManageInviteInfo=29]="ManageInviteInfo",e[e.ManageJoinRequests=30]="ManageJoinRequests"}(Ko||(Ko={}));const Jo=(0,o.X$)((0,a.c$)(((e,t)=>{var n,a,s,o;let{chatId:i,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=i?(0,c.Z1)(e,i):void 0,p=g&&(0,d.eA)(g),f=r&&i&&(0,d.YC)(i)?(0,c.dy)(e,i):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(i&&(null===(n=e.management.byChatId[i])||void 0===n?void 0:n.editingInvite)),w=null==g||null===(a=g.fullInfo)||void 0===a?void 0:a.canViewStatistics,Z=i?null===(s=e.management.byChatId[i])||void 0===s||null===(o=s.inviteInfo)||void 0===o?void 0:o.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,shouldSkipHistoryAnimations:e.shouldSkipHistoryAnimations}}))((e=>{var t;let{chatId:n,isColumnOpen:s,isProfile:i,isSearch:r,isManagement:c,isStatistics:l,isMessageStatistics:d,isStickerSearch:u,isGifSearch:g,isPollResults:p,isAddingChatMembers:f,profileState:v,managementScreen:I,canAddContact:y,userId:w,canManage:Z,isChannel:P,onClose:C,onScreenSelect:b,messageSearchQuery:S,stickerSearchQuery:M,gifSearchQuery:E,isEditingInvite:R,canViewStatistics:k,currentInviteInfo:N,shouldSkipHistoryAnimations:T}=e;const{setLocalTextSearchQuery:A,setStickerSearchQuery:B,setGifSearchQuery:x,searchTextMessagesLocal:O,toggleManagement:U,openHistoryCalendar:F,openAddContactDialog:$,toggleStatistics:D,setEditingExportedInvite:q,deleteExportedChatInvite:j}=(0,a.Sv)(),G=(0,o.sO)(null),[_,H,z]=(0,We.Z)(),V=(0,o.I4)((()=>{q({chatId:n,invite:N}),b(m.u1.EditInvite)}),[n,N,b,q]),W=(0,o.I4)((()=>{j({chatId:n,link:N.link}),b(m.u1.Invites),z()}),[n,z,N,j,b]),X=(0,o.I4)((e=>{A({query:e}),e.length&&Yo(O)}),[O,A]),Y=(0,o.I4)((e=>{B({query:e})}),[B]),K=(0,o.I4)((e=>{x({query:e})}),[x]),J=(0,o.I4)((()=>{$({userId:w})}),[$,w]),[Q,ee]=(0,o.eJ)(!s);(0,o.d4)((()=>{setTimeout((()=>{ee(!s)}),Xo)}),[s]);const te=(0,Ke.Z)(),ne=i?v===m.vi.Profile?Ko.Profile:v===m.vi.SharedMedia?Ko.SharedMedia:v===m.vi.MemberList?Ko.MemberList:-1:r?Ko.Search:p?Ko.PollResults:u?Ko.StickerSearch:g?Ko.GifSearch:f?Ko.AddingMembers:c?I===m.u1.Initial?Ko.ManageInitial:I===m.u1.ChatPrivacyType?Ko.ManageChatPrivacyType:I===m.u1.Discussion?Ko.ManageDiscussion:I===m.u1.ChannelSubscribers?Ko.ManageChannelSubscribers:I===m.u1.GroupPermissions?Ko.ManageGroupPermissions:I===m.u1.ChatAdministrators?Ko.ManageChatAdministrators:I===m.u1.GroupRemovedUsers?Ko.ManageGroupRemovedUsers:I===m.u1.ChannelRemovedUsers?Ko.ManageChannelRemovedUsers:I===m.u1.GroupUserPermissionsCreate?Ko.ManageGroupUserPermissionsCreate:I===m.u1.GroupUserPermissions?Ko.ManageGroupUserPermissions:I===m.u1.GroupRecentActions?Ko.ManageGroupRecentActions:I===m.u1.ChatAdminRights?Ko.ManageGroupAdminRights:I===m.u1.ChatNewAdminRights?Ko.ManageGroupNewAdminRights:I===m.u1.GroupMembers?Ko.ManageGroupMembers:I===m.u1.Invites?Ko.ManageInvites:I===m.u1.EditInvite?Ko.ManageEditInvite:I===m.u1.GroupAddAdmins?Ko.ManageGroupAddAdmins:I===m.u1.Reactions?Ko.ManageReactions:I===m.u1.InviteInfo?Ko.ManageInviteInfo:I===m.u1.JoinRequests?Ko.ManageJoinRequests:void 0:l?Ko.Statistics:d?Ko.MessageStatistics:void 0,ae=null!==(t=(0,qt.Z)(ne,!0))&&void 0!==t?t:-1,se=h.wB||ne===Ko.SharedMedia||ne===Ko.MemberList||ne===Ko.AddingMembers||c,oe=(0,Ee.Z)("animated-close-icon",se&&"state-back",(Q||T)&&"no-transition");return o.ZP.createElement("div",{className:"RightHeader"},o.ZP.createElement(ot.Z,{className:"close-button",round:!0,color:"translucent",size:"smaller",onClick:C,ariaLabel:te(se?"Common.Back":"Common.Close")},o.ZP.createElement("div",{ref:G,className:oe})),o.ZP.createElement(Ye.Z,{name:Q||T?"none":"slide-fade",activeKey:ae},function(){if(-1!==ae)switch(ae){case Ko.PollResults:return o.ZP.createElement("h3",null,te("PollResults"));case Ko.Search:return o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement(it.Z,{parentContainerClassName:"RightSearch",value:S,onChange:X}),o.ZP.createElement(ot.Z,{round:!0,size:"smaller",color:"translucent",onClick:()=>F({selectedAt:(0,L._F)(Date.now())}),ariaLabel:"Search messages by date"},o.ZP.createElement("i",{className:"icon-calendar"})));case Ko.AddingMembers:return o.ZP.createElement("h3",null,te(P?"ChannelAddSubscribers":"GroupAddMembers"));case Ko.ManageInitial:return o.ZP.createElement("h3",null,te("Edit"));case Ko.ManageChatPrivacyType:return o.ZP.createElement("h3",null,te(P?"ChannelTypeHeader":"GroupTypeHeader"));case Ko.ManageDiscussion:return o.ZP.createElement("h3",null,te("Discussion"));case Ko.ManageChatAdministrators:return o.ZP.createElement("h3",null,te("ChannelAdministrators"));case Ko.ManageGroupRecentActions:return o.ZP.createElement("h3",null,te("Group.Info.AdminLog"));case Ko.ManageGroupAdminRights:return o.ZP.createElement("h3",null,te("EditAdminRights"));case Ko.ManageGroupNewAdminRights:return o.ZP.createElement("h3",null,te("SetAsAdmin"));case Ko.ManageGroupPermissions:return o.ZP.createElement("h3",null,te("ChannelPermissions"));case Ko.ManageGroupRemovedUsers:return o.ZP.createElement("h3",null,te("BlockedUsers"));case Ko.ManageChannelRemovedUsers:return o.ZP.createElement("h3",null,te("ChannelBlockedUsers"));case Ko.ManageGroupUserPermissionsCreate:return o.ZP.createElement("h3",null,te("ChannelAddException"));case Ko.ManageGroupUserPermissions:return o.ZP.createElement("h3",null,te("UserRestrictions"));case Ko.ManageInvites:return o.ZP.createElement("h3",null,te("lng_group_invite_title"));case Ko.ManageEditInvite:return o.ZP.createElement("h3",null,te(R?"EditLink":"NewLink"));case Ko.ManageInviteInfo:return o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("h3",null,te("InviteLink")),o.ZP.createElement("section",{className:"tools"},N&&!N.isRevoked&&o.ZP.createElement(ot.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:te("Edit"),onClick:V},o.ZP.createElement("i",{className:"icon-edit"})),N&&N.isRevoked&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement(ot.Z,{round:!0,color:"danger",size:"smaller",ariaLabel:te("Delete"),onClick:H},o.ZP.createElement("i",{className:"icon-delete"})),o.ZP.createElement(Jt.Z,{isOpen:_,onClose:z,title:te("DeleteLink"),text:te("DeleteLinkHelp"),confirmIsDestructive:!0,confirmLabel:te("Delete"),confirmHandler:W}))));case Ko.ManageJoinRequests:return o.ZP.createElement("h3",null,te(P?"SubscribeRequests":"MemberRequests"));case Ko.ManageGroupAddAdmins:return o.ZP.createElement("h3",null,te("Channel.Management.AddModerator"));case Ko.StickerSearch:return o.ZP.createElement(it.Z,{value:M,placeholder:te("SearchStickersHint"),autoFocusSearch:!0,onChange:Y});case Ko.GifSearch:return o.ZP.createElement(it.Z,{value:E,placeholder:te("SearchGifsTitle"),autoFocusSearch:!0,onChange:K});case Ko.Statistics:return o.ZP.createElement("h3",null,te(P?"ChannelStats.Title":"GroupStats.Title"));case Ko.MessageStatistics:return o.ZP.createElement("h3",null,te("Stats.MessageTitle"));case Ko.SharedMedia:return o.ZP.createElement("h3",null,te("SharedMedia"));case Ko.ManageChannelSubscribers:return o.ZP.createElement("h3",null,te("ChannelSubscribers"));case Ko.MemberList:case Ko.ManageGroupMembers:return o.ZP.createElement("h3",null,te("GroupMembers"));case Ko.ManageReactions:return o.ZP.createElement("h3",null,te("Reactions"));default:return o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("h3",null,"Profile"),o.ZP.createElement("section",{className:"tools"},y&&o.ZP.createElement(ot.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:te("AddContact"),onClick:J},o.ZP.createElement("i",{className:"icon-add-user"})),Z&&o.ZP.createElement(ot.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:te("Edit"),onClick:U},o.ZP.createElement("i",{className:"icon-edit"})),k&&o.ZP.createElement(ot.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:te("Statistics"),onClick:D},o.ZP.createElement("i",{className:"icon-stats"}))))}}()))})));var Qo=n(91);var ei=n(7407);function ti(e,t,n,a){const[o,i]=(0,ei.Z)(n?t:void 0,a,void 0,s.Vk);return[o,i,!(!o||!a||o[0]===a[0])]}function ni(e,t,n,a,i,r){const c=(0,o.sO)();(0,Be.Z)((()=>{t===e&&i&&r&&(c.current=(0,d.R5)(i,r,e))}),[i,r,t,e]);const[l,u]=(0,ei.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 ai=(0,M.P2)((e=>e()),250,!1);let si=!1;var oi=n(1273),ii=n(1876),ri=n(787),ci=n(180),li=n(3709),di=n(5418),ui=n(7262),mi=n(1151),hi=n(2275);const gi=[{type:"media",title:"SharedMediaTab2"},{type:"documents",title:"SharedFilesTab2"},{type:"links",title:"SharedLinksTab2"},{type:"audio",title:"SharedMusicTab2"},{type:"voice",title:"SharedVoiceTab2"}];function pi(e){return[`.shared-media-transition > div:only-child > .${e}-list > .scroll-item`,`.shared-media-transition > .Transition__slide--active > .${e}-list > .scroll-item`].join(", ")}const fi=(0,o.X$)((0,a.c$)(((e,t)=>{var n,a;let{chatId:s}=t;const o=(0,c.Z1)(e,s),i=(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=o&&(0,d.Bf)(o),f=o&&(0,d.eA)(o),v=p||f&&(0,d.Nl)(o),I=null==o||null===(n=o.fullInfo)||void 0===n?void 0:n.members,y=v&&o&&(o.isForbidden||o.fullInfo&&!o.fullInfo.canViewMembers),w=v&&o&&((0,d.VE)(o,"inviteUsers")||!(0,d.Mg)(o,"inviteUsers")||o.isCreator),Z=v&&o&&((0,d.VE)(o,"banUsers")||o.isCreator),P=(0,c.xs)(e,s);let C,b,S;return(0,d.YC)(s)&&(b=s,S=(0,c.dy)(e,b),C=S&&!S.isSelf&&!(0,d.cS)(S)),{theme:(0,c.Pu)(e),isChannel:f,resolvedUserId:b,chatMessages:i,foundIds:u,mediaSearchType:r,hasCommonChatsTab:C,hasMembersTab:v,areMembersHidden:y,canAddMembers:w,canDeleteMembers:Z,currentUserId:e.currentUserId,isRightColumnShown:(0,c.Jf)(e),isRestricted:null==o?void 0:o.isRestricted,lastSyncTime:e.lastSyncTime,serverTimeOffset:e.serverTimeOffset,activeDownloadIds:P,usersById:m,userStatusesById:h,chatsById:g,isChatProtected:null==o?void 0:o.isProtected,...v&&I&&{members:I},...C&&S&&{commonChatIds:null===(a=S.commonChats)||void 0===a?void 0:a.ids}}}))((e=>{let{chatId:t,profileState:n,onProfileStateChange:r,theme:c,isChannel:l,resolvedUserId:u,currentUserId:g,chatMessages:p,foundIds:f,mediaSearchType:v,hasCommonChatsTab:I,hasMembersTab:y,areMembersHidden:w,canAddMembers:Z,canDeleteMembers:P,commonChatIds:C,members:b,usersById:S,userStatusesById:M,chatsById:E,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,o.sO)(null),H=(0,o.sO)(null),z=(0,Ke.Z)(),[V,W]=(0,o.eJ)(0),[X,Y]=(0,o.eJ)(),K=(0,o.Ye)((()=>[...y?[{type:"members",title:l?"ChannelSubscribers":"GroupMembers"}]:[],...gi,...I?[{type:"commonChats",title:"SharedGroupsTab2"}]:[]]),[I,y,l]),J=K[V].type,[Q,ee,te,ne]=function(e,t,n,a,s,i,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&&i?i:s,y=(0,o.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,o.Ye)((()=>{if(c&&m)return(0,d.ih)(c,m,!0)}),[m,c]),[Z,P,C]=ti(0,t,f,y),[b,S,M]=ni("media",I,a,f,h,g),[E,R,k]=ni("documents",I,a,f,h,g),[N,T,A]=ni("links",I,a,f,h,g),[B,x,L]=ni("audio",I,a,f,h,g),[O,U,F]=ni("voice",I,a,f,h,g),[$,D,q]=ti(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=b,G=S,_=M;break;case"documents":j=E,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,b,C,S,M,E,p,f,t,N,A),ae=K.findIndex((e=>{let{type:t}=e;return t===Q})),{handleScroll:se}=function(e,t,n,a){(0,Pn.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),si=!0,(0,Rn.Z)(n,s,"start",void 0,void 0,void 0,300),setTimeout((()=>{si=!1}),350))}}),[t,a]),(0,Pn.Z)((t=>{let[s]=t;if(n!==m.vi.Profile||n===s)return;const o=e.current;if(!o)return;const i=o.querySelector(".TabList");!i||i.offsetTop>o.scrollTop||(si=!0,(0,Rn.Z)(o,o.firstElementChild,"start",void 0,2*o.offsetHeight),setTimeout((()=>{si=!1}),350),a(n))}),[n]);const s=(0,o.I4)((()=>{const n=e.current;if(!n)return;const s=n.querySelector(".TabList");if(!s)return;let o=m.vi.Profile;n.scrollTop>=s.offsetTop&&(o="members"===t?m.vi.MemberList:m.vi.SharedMedia),a(o)}),[e,a,t]);return(0,o.d4)((()=>{si||s()}),[s,t]),{handleScroll:(0,o.I4)((()=>{si||ai(s)}),[s])}}(_,J,n,r),{applyTransitionFix:oe,releaseTransitionFix:ie}=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:".Transition.shared-media-transition";(0,o.d4)((()=>{function n(){const n=e.current,a=n.querySelector(t),s=n.querySelector(".TabList");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,o.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,o.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,o.eJ)(!1);return[e,(0,o.I4)((()=>{t((e=>!e))}),[])]})(),{observe:le}=(0,Tn.S1)({rootRef:_,throttleMs:500}),de=(0,o.I4)((()=>{ie(),ce()}),[ie,ce]),ue=(0,o.I4)((()=>{G(m.WB.InProgress)}),[G]);(0,o.d4)((()=>{x({mediaType:J})}),[x,J]);const me=u||t;(0,o.d4)((()=>{N&&j({profileId:me})}),[j,me,N]);const he=(0,o.I4)((e=>{$({chatId:me,threadId:i._f,messageId:e,origin:m.bZ.SharedMedia})}),[me,$]),ge=(0,o.I4)((e=>{D({chatId:me,messageId:e})}),[me,D]),pe=(0,o.I4)((e=>{U({id:e})}),[U]),fe=(0,o.I4)((e=>{q({chatId:me,messageId:e})}),[me,q]),ve=(0,o.I4)((()=>{Y(void 0)}),[]);let Ie;(0,o.d4)((()=>{if(H.current&&h.$b)return(0,ht.sf)(H.current,{selectorToPreventScroll:".Profile",onSwipe:(e,t)=>t===ht.eM.Left?(W(Math.min(V+1,K.length-1)),!0):t===ht.eM.Right&&(W(Math.max(0,V-1)),!0)})}),[V,K.length]);const ye="members"===Q||!y&&"media"===Q;ye?Ie=R?0:1e3:ee||(Ie=s.Y);const we=(0,So.Z)([t,Q],Ie);return o.ZP.createElement(oi.Z,{ref:_,className:"Profile custom-scroll",itemSelector:pi(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 o.ZP.createElement("div",{className:"profile-info"},o.ZP.createElement(ri.Z,{userId:t||e}),o.ZP.createElement(ci.Z,{chatOrUserId:t||e}))}(t,u),!k&&o.ZP.createElement("div",{className:"shared-media"},o.ZP.createElement(Ye.Z,{ref:H,name:z.isRtl?"slide-optimized-rtl":"slide-optimized",activeKey:ae,renderCount:K.length,shouldRestoreHeight:!0,className:"shared-media-transition",onStart:oe,onStop:de},function(){if(!ee||!we||!p){const e=ye&&!we,t=Boolean("members"===Q&&w);return o.ZP.createElement("div",{className:"content empty-list"},!e&&!t&&o.ZP.createElement(dt.Z,null),t&&o.ZP.createElement(ui.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 o.ZP.createElement("div",{className:"content empty-list"},o.ZP.createElement(ui.Z,{text:e}))}return o.ZP.createElement("div",{className:`content ${Q}-list`,dir:z.isRtl&&"media"===Q?"rtl":void 0,teactFastList:!0},"media"===Q?ee.map((e=>p[e]&&o.ZP.createElement(li.Z,{key:e,message:p[e],isProtected:B||p[e].isProtected,observeIntersection:le,onClick:he}))):"documents"===Q?ee.map((e=>p[e]&&o.ZP.createElement(na.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]&&o.ZP.createElement(di.Z,{key:e,message:p[e],isProtected:B||p[e].isProtected,observeIntersection:le,onMessageClick:fe}))):"audio"===Q?ee.map((e=>p[e]&&o.ZP.createElement(aa.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]&&o.ZP.createElement(aa.Z,{key:e,theme:c,message:p[e],senderTitle:(0,Qo.F)(z,p[e],E,S),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 o.ZP.createElement(ii.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:()=>{Y(n)}}]:void 0)},o.ZP.createElement(jt.Z,{userId:e,forceShowSelf:!0}));var n})):"commonChats"===Q?ee.map(((e,t)=>o.ZP.createElement(ii.Z,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item small-icon",onClick:()=>U({id:e})},o.ZP.createElement(Gt.Z,{chatId:e})))):void 0)}()),o.ZP.createElement(gt.Z,{big:!0,activeTab:V,tabs:K,onSwitchTab:W})),Z&&o.ZP.createElement(mi.Z,{isShown:"members"===Q,onClick:ue,ariaLabel:z("lng_channel_add_users")},o.ZP.createElement("i",{className:"icon-add-user-filled"})),P&&o.ZP.createElement(hi.Z,{isOpen:Boolean(X),userId:X,onClose:ve}))}))),vi=(0,o.X$)((e=>{const t=(0,It.Z)(vt.gl.Extra,"RightSearch");return t?o.ZP.createElement(t,e):o.ZP.createElement(yt.Z,null)})),Ii=(0,o.X$)((e=>{const t=(0,It.Z)(vt.gl.Extra,"Management");return t?o.ZP.createElement(t,e):o.ZP.createElement(yt.Z,null)})),yi=e=>{const t=(0,It.Z)(vt.gl.Extra,"Statistics");return t?o.ZP.createElement(t,e):o.ZP.createElement(yt.Z,null)},wi=e=>{const t=(0,It.Z)(vt.gl.Extra,"MessageStatistics");return t?o.ZP.createElement(t,e):o.ZP.createElement(yt.Z,null)},Zi=(0,o.X$)((()=>{const e=(0,It.Z)(vt.gl.Extra,"StickerSearch");return e?o.ZP.createElement(e,null):o.ZP.createElement(yt.Z,null)})),Pi=(0,o.X$)((()=>{const e=(0,It.Z)(vt.gl.Extra,"GifSearch");return e?o.ZP.createElement(e,null):o.ZP.createElement(yt.Z,null)})),Ci=(0,o.X$)((()=>{const e=(0,It.Z)(vt.gl.Extra,"PollResults");return e?o.ZP.createElement(e,null):o.ZP.createElement(yt.Z,null)}));var bi=n(1820);const Si=(0,o.X$)((0,a.c$)(((e,t)=>{var n;let{chatId:a}=t;const s=(0,c.Z1)(e,a),{userIds:o}=e.contactList||{},{byId:i}=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:i,localContactIds:o,searchQuery:g,isSearching:p,isLoading:l===m.WB.Loading,globalUserIds:f,localUserIds:v,connectionState:u}}))((e=>{let{isChannel:t,connectionState:n,members:s,onNextStep:i,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,Ke.Z)(),[P,C]=(0,o.eJ)([]),b=(0,Ft.Z)(P)===P;(0,o.d4)((()=>{I&&"connectionStateReady"===n&&w()}),[n,I,w]),(0,$e.Z)({isActive:I,onBack:v});const S=(0,o.Ye)((()=>s?s.map((e=>e.userId)):[]),[s]),M=(0,o.I4)((e=>{y({query:e})}),[y]),E=(0,o.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!S.includes(n)&&n!==r&&(!a||!(0,d.cS)(a)||!t&&a.canBeInvitedToGroup)})),c)}),[l,c,m,p,f,r,S,t]),R=(0,o.I4)((()=>{P.length&&(y({query:""}),i(P))}),[P,y,i]);return o.ZP.createElement("div",{className:"AddChatMembers"},o.ZP.createElement("div",{className:"AddChatMembers-inner"},o.ZP.createElement(bi.Z,{itemIds:E,selectedIds:P,filterValue:m,filterPlaceholder:Z("lng_channel_add_users"),searchInputId:"new-members-picker-search",isLoading:h,onSelectedIdsChange:C,onFilterChange:M,noScrollRestore:b}),o.ZP.createElement(mi.Z,{isShown:Boolean(P.length),disabled:u,ariaLabel:Z("lng_channel_add_users"),onClick:R},u?o.ZP.createElement(dt.Z,{color:"white"}):o.ZP.createElement("i",{className:"icon-arrow-right"}))))}))),Mi=450+s.fK,Ei=Object.keys(m.qt).length/2,Ri=Object.keys(m.u1).length/2;function ki(){const e=document.querySelector(".RightHeader .SearchInput input");e&&e.blur()}const Ni=(0,o.X$)((0,a.c$)((e=>{var t;const{chatId:n,threadId:a}=(0,c.Bt)(e)||{},s=(0,c.g4)(e),o=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:o}}))((e=>{var t;let{contentKey:n,chatId:i,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,toggleMessageStatistics:P,setOpenedInviteInfo:C,requestNextManagementScreen:b}=(0,a.Sv)(),{width:S}=(0,Ot.Z)(),[M,E]=(0,o.eJ)(m.vi.Profile),[R,k]=(0,o.eJ)(m.u1.Initial),[N,T]=(0,o.eJ)(),[A,B]=(0,o.eJ)(),x=M!==m.vi.Profile,L=void 0!==n,O=n===m.qt.ChatInfo,U=n===m.qt.Search,F=n===m.qt.Management,$=n===m.qt.Statistics,D=n===m.qt.MessageStatistics,q=n===m.qt.StickerSearch,j=n===m.qt.GifSearch,G=n===m.qt.PollResults,_=n===m.qt.AddingMembers,H=S<=s._m,[z,V]=(0,o.eJ)(!L),W=null!==(t=(0,qt.Z)(n,!0,!c))&&void 0!==t?t:-1,X=(0,o.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(x&&e){E(m.vi.Profile);break}u(void 0,{forceSyncOnIOs:!0});break;case m.qt.Management:switch(R){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:k(m.u1.Initial);break;case m.u1.GroupUserPermissionsCreate:case m.u1.GroupRemovedUsers:case m.u1.GroupUserPermissions:k(m.u1.GroupPermissions),T(void 0),B(void 0);break;case m.u1.ChatAdminRights:case m.u1.ChatNewAdminRights:case m.u1.GroupAddAdmins:case m.u1.GroupRecentActions:k(m.u1.ChatAdministrators);break;case m.u1.EditInvite:case m.u1.InviteInfo:k(m.u1.Invites),C({invite:void 0}),w({chatId:i,invite:void 0})}break;case m.qt.MessageStatistics:P();break;case m.qt.Statistics:Z();break;case m.qt.Search:ki(),g();break;case m.qt.StickerSearch:ki(),p({query:void 0});break;case m.qt.GifSearch:ki(),f({query:void 0});break;case m.qt.PollResults:v()}}),[n,x,u,v,y,R,h,g,p,f,w,i,C,Z,P]),Y=(0,o.I4)(((e,t)=>{T(e),B(t)}),[]),K=(0,o.I4)((e=>{I({chatId:i,memberIds:e})}),[I,i]);function J(e){if(-1!==W)switch(W){case m.qt.AddingMembers:return o.ZP.createElement(Si,{key:i,chatId:i,isActive:L&&e,onNextStep:K,onClose:X});case m.qt.ChatInfo:return o.ZP.createElement(fi,{key:i,chatId:i,profileState:M,onProfileStateChange:E});case m.qt.Search:return o.ZP.createElement(vi,{chatId:i,threadId:r,onClose:X,isActive:L&&e});case m.qt.Management:return o.ZP.createElement(Ii,{key:i,chatId:i,currentScreen:R,isPromotedByCurrentUser:A,selectedChatMemberId:N,isActive:L&&e,onScreenSelect:k,onChatMemberSelect:Y,onClose:X});case m.qt.Statistics:return o.ZP.createElement(yi,{chatId:i,isActive:L&&e});case m.qt.MessageStatistics:return o.ZP.createElement(wi,{chatId:i,isActive:L&&e});case m.qt.StickerSearch:return o.ZP.createElement(Zi,{onClose:X,isActive:L&&e});case m.qt.GifSearch:return o.ZP.createElement(Pi,{onClose:X,isActive:L&&e});case m.qt.PollResults:return o.ZP.createElement(Ci,{onClose:X,isActive:L&&e})}}return(0,o.d4)((()=>L?(0,ze.Z)(X):void 0),[L,X]),(0,o.d4)((()=>{setTimeout((()=>{V(!L)}),Mi)}),[L]),(0,o.d4)((()=>{d&&(k(d),b(void 0))}),[d,b]),(0,o.d4)((()=>{L&&H&&X()}),[H]),(0,Zn.Z)((e=>{let[t]=e;t!==i&&(E(m.vi.Profile),k(m.u1.Initial))}),[i]),(0,$e.Z)({isActive:c&&(n===m.qt.ChatInfo||n===m.qt.Management||n===m.qt.AddingMembers),onBack:()=>X(!1)}),o.ZP.createElement("div",{id:"RightColumn-wrapper",className:c?void 0:"is-hidden"},H&&o.ZP.createElement("div",{className:"overlay-backdrop",onClick:X}),o.ZP.createElement("div",{id:"RightColumn"},o.ZP.createElement(Jo,{chatId:i,isColumnOpen:L,isProfile:O,isSearch:U,isManagement:F,isStatistics:$,isMessageStatistics:D,isStickerSearch:q,isGifSearch:j,isPollResults:G,isAddingChatMembers:_,profileState:M,managementScreen:R,onClose:X,onScreenSelect:k}),o.ZP.createElement(Ye.Z,{name:z||l?"none":"zoom-fade",renderCount:Ei+Ri,activeKey:F?Ei+R:W,shouldCleanup:!0},J)))}))),Ti=(0,o.X$)((e=>{let{isOpen:t}=e;const n=(0,It.Z)(vt.gl.Extra,"MediaViewer",!t);return n?o.ZP.createElement(n,null):void 0}));let Ai=[],Bi=!1;function xi(e,t){Ai.push({url:e,filename:t}),Bi||(Bi=!0,setTimeout((async()=>{await async function(){let e=0;for(const t of Ai)Li(t),e++,10===e&&(await(0,M.wO)(1e3),e=0);Ai=[]}(),Bi=!1}),1e3))}function Li(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 Oi=new Set,Ui=new Set,Fi=(0,o.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,Mn.Z)(1e3,!0),c=(0,o.I4)((e=>{Ui.add(e),r((()=>{Ui.size&&(s({messages:Array.from(Ui)}),Ui.clear())}))}),[s,r]);(0,o.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(Oi.has(e))return;Oi.add(e);const t=(0,d.Ti)(e,"download");if(!t)return void c(e);const n=ne.UV(t);if(n)return xi(n,(0,d.w6)(e)),void c(e);ne.he(t,i.IU.BlobUrl,!0).then((t=>{t&&xi(t,(0,d.w6)(e)),c(e)}))})):Oi.clear()}),[n,t,s,c])})));var $i=n(5116),Di=n(3103);const qi=(0,o.X$)((e=>{let{openedGame:t,gameTitle:n}=e;const{closeGame:a,showNotification:s,openForwardMenu:i}=(0,$i.Sv)(),r=(0,Ke.Z)(),{url:c,chatId:l,messageId:d}=t||{},u=Boolean(c),m=(0,As.Z)(l);(0,kn.Z)((()=>{m({type:"playingGame"})}),u?5e3:void 0);const h=(0,o.I4)((e=>{try{const t=JSON.parse(e.data);"share_score"===t.eventType&&(i({fromChatId:l,messageIds:[d],withMyScore:!0}),a()),"share_game"===t.eventType&&s({message:"Unsupported game action"})}catch(e){}}),[l,a,d,i,s]),g=(0,o.I4)((e=>{e.currentTarget.focus()}),[]);return(0,o.d4)((()=>(window.addEventListener("message",h),()=>window.removeEventListener("message",h))),[h]),(0,o.d4)((()=>{if(u)return re.Z.disableRefresh(),()=>{re.Z.enableRefresh()}}),[u]),o.ZP.createElement(Di.Z,{className:"GameModal",isOpen:u,onClose:a,title:n,hasCloseButton:!0},u&&o.ZP.createElement("iframe",{className:"game-frame",onLoad:g,src:c,title:r("AttachGame"),sandbox:"allow-scripts allow-same-origin allow-orientation-lock",allow:"fullscreen"}))})),ji=(0,o.X$)((e=>{let{isOpen:t}=e;const n=(0,It.Z)(vt.gl.Extra,"Notifications",!t);return n?o.ZP.createElement(n,null):void 0})),Gi=(0,o.X$)((e=>{let{isOpen:t}=e;const n=(0,It.Z)(vt.gl.Extra,"Dialogs",!t);return n?o.ZP.createElement(n,null):void 0})),_i=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,It.Z)(vt.gl.Extra,"ForwardPicker",!t);return n?o.ZP.createElement(n,e):void 0})),Hi=(0,o.X$)((e=>{const{url:t}=e,n=(0,It.Z)(vt.gl.Extra,"SafeLinkModal",!t);return n?o.ZP.createElement(n,e):void 0})),zi=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,It.Z)(vt.gl.Extra,"HistoryCalendar",!t);return n?o.ZP.createElement(n,e):void 0})),Vi=(0,o.X$)((e=>{const{groupCallId:t}=e,n=(0,It.Z)(vt.gl.Calls,"GroupCall",!t);return n?o.ZP.createElement(n,e):void 0})),Wi=(0,o.X$)((e=>{const{isActive:t}=e,n=(0,It.Z)(vt.gl.Calls,"ActiveCallHeader",!t);return n?o.ZP.createElement(n,null):void 0})),Xi=(0,o.X$)((e=>{const{isActive:t}=e,n=(0,It.Z)(vt.gl.Calls,"PhoneCall",!t);return n?o.ZP.createElement(n,null):void 0}));var Yi=n(5780);function Ki(){return Ki=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},Ki.apply(this,arguments)}const Ji=(0,o.X$)((0,$i.c$)((e=>({messageLists:e.messages.messageLists})))((e=>{let{messageLists:t}=e;const{openChat:n}=(0,$i.Sv)(),a=()=>{n({id:void 0},{forceSyncOnIOs:!0})},s=e=>{let{chatId:t,type:n,threadId:s}=e;(0,$e.Z)({isActive:!0,hash:(0,Yi.q)(t,n,s),onBack:a})};return o.ZP.createElement("div",null,null==t?void 0:t.map(((e,t)=>o.ZP.createElement(s,Ki({key:`${e.chatId}_${e.threadId}_${e.type}_${t}`},e)))))}))),Qi=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,It.Z)(vt.gl.Extra,"NewContactModal",!t);return n?o.ZP.createElement(n,e):void 0})),er=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,It.Z)(vt.gl.Calls,"RatePhoneCallModal",!t);return n?o.ZP.createElement(n,e):void 0})),tr=(0,o.X$)((e=>{const{webApp:t}=e,n=(0,It.Z)(vt.gl.Extra,"WebAppModal",!t);return n?o.ZP.createElement(n,e):void 0})),nr=(0,o.X$)((e=>{const{bot:t}=e,n=(0,It.Z)(vt.gl.Extra,"BotTrustModal",!t);return n?o.ZP.createElement(n,e):void 0})),ar=(0,o.X$)((e=>{const{bot:t}=e,n=(0,It.Z)(vt.gl.Extra,"BotAttachModal",!t);return n?o.ZP.createElement(n,e):void 0}));let sr,or=!1;function ir(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 rr(e){document.title!==e&&(document.title=e)}const cr=(0,o.X$)((0,a.c$)((e=>{var t,n,a;const{settings:{byKey:{animationLevel:s,language:o,wasTimeFormatSetManually:i}}}=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,isLeftColumnOpen:e.isLeftColumnShown,isRightColumnOpen:(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:o,wasTimeFormatSetManually:i,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),botTrustRequest:e.botTrustRequest,botAttachRequest:e.botAttachRequest,webApp:e.webApp}}))((e=>{let{connectionState:t,authState:n,lastSyncTime:i,isLeftColumnOpen:r,isRightColumnOpen: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:b,isPhoneCallActive:S,newContactUserId:E,newContactByPhoneNumber:R,openedGame:k,gameTitle:N,isRatePhoneCallModalOpen:T,botTrustRequest:A,botAttachRequest:B,webApp:x}=e;const{sync:L,loadAnimatedEmojis:O,loadNotificationSettings:U,loadNotificationExceptions:F,updateIsOnline:D,loadTopInlineBots:q,loadEmojiKeywords:j,loadCountryList:G,loadAvailableReactions:_,loadStickerSets:H,loadAddedStickers:z,loadFavoriteStickers:V,ensureTimeFormat:W,openStickerSetShortName:X,checkVersionNotification:Y,loadAppConfig:K,loadAttachMenuBots:J}=(0,a.Sv)();s.eM&&!or&&(or=!0,console.log(">>> RENDER MAIN")),(0,o.d4)((()=>{"connectionStateReady"===t&&"authorizationStateReady"===n&&L()}),[t,n,L]),(0,o.d4)((()=>{i&&(D(!0),K(),_(),O(),U(),F(),q(),j({language:s.pR}),J())}),[i,O,j,F,U,q,D,_,K,J]),(0,o.d4)((()=>{i&&(P!==s.pR&&j({language:P}),G({langCode:P}))}),[P,i,G,j]),(0,o.d4)((()=>{i&&(b?z():(H(),V()))}),[i,b,H,V,z]),(0,o.d4)((()=>{i&&w&&Y()}),[i,w,Y]),(0,o.d4)((()=>{i&&!C&&W()}),[i,C,W]),(0,o.d4)((()=>{i&&$e.O.startsWith("#?tgaddr=")&&(0,ke.o)(decodeURIComponent($e.O.substr("#?tgaddr=".length)))}),[i]),(0,o.d4)((()=>{if(p)return re.Z.disableRefresh(),()=>{re.Z.enableRefresh()}}),[p]);const Q=(0,De.Z)(r,void 0,!0,void 0,I),ee=(0,o.sO)(!1),te=(0,Fe.Z)();(0,Be.Z)((e=>{let[t]=e;if(void 0===t||0===Z)return;ee.current=!0,h.wZ&&(0,M.T2)((()=>{document.body.classList.toggle("android-left-blackout-open",!r)}));const n=(0,Me.YW)();(0,Re.L)(document.getElementById("MiddleColumn"),(()=>{n(),ee.current=!1,te()}))}),[r]);const ne=(0,De.Z)(c,void 0,!0,void 0,I),ae=(0,o.sO)(!1),[se,oe]=(0,o.eJ)(c);(0,Be.Z)((e=>{let[t]=e;if(void 0===t||0===Z)return;ae.current=!0;const n=(0,Me.YW)();(0,Re.L)(document.getElementById("RightColumn"),(()=>{n(),ae.current=!1,te(),oe(c)}))}),[c]);const ie=(0,Ee.Z)(Q.hasShownClass&&"left-column-shown",Q.hasOpenClass&&"left-column-open",ee.current&&"left-column-animating",ne.hasShownClass&&"right-column-shown",ne.hasOpenClass&&"right-column-open",ae.current&&"right-column-animating",se&&"narrow-message-list",I&&"history-animation-disabled"),ce=(0,o.I4)((()=>{D(!1);const e=(0,$.xW)();let t=0;clearInterval(sr),sr=window.setInterval((()=>{if(document.title.includes(s.ou))ir(!1);else{if(t%2==0){const t=(0,$.xW)()-e;t>0&&(rr(`${t} notification${t>1?"s":""}`),ir(!0))}else rr(s.Ti),ir(!1);t++}}),1e3)}),[D]),le=(0,o.I4)((()=>{D(!0),clearInterval(sr),sr=void 0,document.title.includes(s.ou)||rr(s.Ti),ir(!1)}),[D]),de=(0,o.I4)((()=>{X({stickerSetShortName:void 0})}),[X]);return(0,Te.Z)(ce,le),Ae(ce),function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];(0,o.d4)((()=>{if(h.$b){if(!e)return null==xe||xe.setAttribute("content",Le),h.cj&&!h.fl&&document.addEventListener("gesturestart",Ue),()=>{null==xe||xe.setAttribute("content","width=device-width, initial-scale=1, shrink-to-fit=no"),h.cj&&!h.fl&&document.removeEventListener("gesturestart",Ue)};null==xe||xe.setAttribute("content",Oe)}}),[e])}(l),o.ZP.createElement("div",{id:"Main",className:ie,onDrop:Ne.Z,onDragOver:Ne.Z},o.ZP.createElement(At,null),o.ZP.createElement(Wo,null),o.ZP.createElement(Ni,null),o.ZP.createElement(Ti,{isOpen:l}),o.ZP.createElement(_i,{isOpen:d}),o.ZP.createElement(ji,{isOpen:u}),o.ZP.createElement(Gi,{isOpen:m}),g&&o.ZP.createElement(pn,{key:g.id,message:g,noUi:!0}),o.ZP.createElement(Hi,{url:f}),o.ZP.createElement(zi,{isOpen:v}),o.ZP.createElement(qe.Z,{isOpen:Boolean(y),onClose:de,stickerSetShortName:y}),p&&o.ZP.createElement(Vi,{groupCallId:p}),o.ZP.createElement(Wi,{isActive:Boolean(p||S)}),o.ZP.createElement(Qi,{isOpen:Boolean(E||R),userId:E,isByPhoneNumber:R}),o.ZP.createElement(qi,{openedGame:k,gameTitle:N}),o.ZP.createElement(tr,{webApp:x}),o.ZP.createElement(Fi,null),o.ZP.createElement(Xi,{isActive:S}),o.ZP.createElement(He,{isForAppBadge:!0}),o.ZP.createElement(er,{isOpen:T}),o.ZP.createElement(nr,{bot:null==A?void 0:A.bot,type:null==A?void 0:A.type}),o.ZP.createElement(ar,{bot:null==B?void 0:B.bot}),o.ZP.createElement(Ji,null))})));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"}}]);
//# sourceMappingURL=769.79d1ffce801bb01a4b8a.js.map