mirror of
https://github.com/danog/telegram-tt.git
synced 2024-12-15 10:47:04 +01:00
2 lines
246 KiB
JavaScript
2 lines
246 KiB
JavaScript
"use strict";(self.webpackChunktelegram_t=self.webpackChunktelegram_t||[]).push([[700],{4700:(e,t,n)=>{n.r(t),n.d(t,{Main:()=>Ko});var a=n(5116),s=n(3716),o=n(4050),i=(n(7895),n(9959)),r=n(1638),c=n(735),d=n(2858);function l(e){const{chatId:t,threadId:n}=(0,r.Bt)(e)||{};return t&&n?(e=(0,i.qr)(e,t,n,!1),e=(0,i.Pb)(e,t,n,void 0)):e}(0,a.Q6)("openLocalTextSearch",(e=>{const{chatId:t,threadId:n}=(0,r.Bt)(e)||{};if(t&&n)return(0,i.qr)(e,t,n,!0)})),(0,a.Q6)("closeLocalTextSearch",l),(0,a.Q6)("setLocalTextSearchQuery",((e,t,n)=>{const{chatId:a,threadId:s}=(0,r.Bt)(e)||{};if(!a||!s)return;const{query:o}=n,l=(0,d.uw)(a,s),{query:u}=e.localTextSearch.byChatThreadKey[l]||{};return o!==u&&(e=(0,i.Pb)(e,a,s,c.D)),(0,i.qr)(e,a,s,!0,o)})),(0,a.Q6)("setLocalMediaSearchType",((e,t,n)=>{const{chatId:a}=(0,r.Bt)(e)||{};if(!a)return;const{mediaType:s}=n;return(0,i.z5)(e,a,s)})),(0,a.Q6)("openChat",((e,t,n)=>{const{id:s,threadId:o=-1,type:c="thread",shouldReplaceHistory:d=!1}=n,u=(0,r.Bt)(e);return u&&u.chatId===s&&u.threadId===o&&u.type===c||(e=(0,i.pf)(e,s,o,"replyStack",[]),e=l(e=(0,i.i9)(e)),e={...e,messages:{...e.messages,contentToBeScheduled:void 0},...s!==e.forwardMessages.toChatId&&{forwardMessages:{}}},(0,a.R3)(e)),(0,i.Wy)(e,s,o,c,d)})),(0,a.Q6)("openPreviousChat",(e=>(0,i.Wy)(e,void 0))),(0,a.Q6)("openChatWithInfo",((e,t,n)=>{(0,a.R3)({...e,isChatInfoShown:!0}),t.openChat(n)})),(0,a.Q6)("resetChatCreation",(e=>({...e,chatCreation:void 0}))),(0,a.Q6)("setNewChatMembersDialogState",((e,t,n)=>({...e,newChatMembersProgress:n}))),(0,a.Q6)("openNextChat",((e,t,n)=>{const{targetIndexDelta:a,orderedIds:s}=n,{chatId:o}=(0,r.Bt)(e)||{};if(!o)return void t.openChat({id:s[0]});const i=s.indexOf(o);if(-1===i)return;const c=s[i+a];t.openChat({id:c,shouldReplaceHistory:!0})}));var u=n(6137),m=n(1713),h=n(7361),g=n(782),p=n(2267),f=n(3099);const I=s.ck+s.fK;let v;(0,a.Q6)("setScrollOffset",((e,t,n)=>{const{chatId:a,threadId:s,scrollOffset:o}=n;return(0,i.pf)(e,a,s,"scrollOffset",o)})),(0,a.Q6)("setReplyingToId",((e,t,n)=>{const{messageId:a}=n,s=(0,r.Bt)(e);if(!s)return;const{chatId:o,threadId:c}=s;return(0,i.pf)(e,o,c,"replyingToId",a)})),(0,a.Q6)("setEditingId",((e,t,n)=>{const{messageId:a}=n,s=(0,r.Bt)(e);if(!s)return;const{chatId:o,threadId:c,type:d}=s,l="scheduled"===d?"editingScheduledId":"editingId";return(0,i.pf)(e,o,c,l,a)})),(0,a.Q6)("editLastMessage",(e=>{const{chatId:t,threadId:n}=(0,r.Bt)(e)||{};if(!t||!n)return;const a=(0,r.Zw)(e,t),s=(0,r.Cb)(e,t,n);if(!a||!s)return;const o=(0,g.dF)(s,(t=>Boolean(a[t]&&(0,r._k)(e,a[t],n).canEdit)));return o?(0,i.pf)(e,t,n,"editingId",o):void 0})),(0,a.Q6)("replyToNextMessage",((e,t,n)=>{const{targetIndexDelta:a}=n,{chatId:s,threadId:o}=(0,r.Bt)(e)||{};if(!s||!o)return;const i=(0,r.Zw)(e,s),c=(0,r.Cb)(e,s,o);if(!i||!c)return;const d=(0,r.Yy)(e,s,o);let l;if((0,r.b9)(e,s,o)&&d){const e=Object.keys(i),t=e.indexOf(d.toString())+a;l=t<=e.length+1&&t>=0?Number(e[t]):void 0}else if(o===u._f){var m;const t=(0,r.Z1)(e,s);l=null==t||null===(m=t.lastMessage)||void 0===m?void 0:m.id}else{const t=(0,r.tZ)(e,s,o);l=null==t?void 0:t.lastMessageId}t.setReplyingToId({messageId:l}),t.focusMessage({chatId:s,threadId:o,messageId:l})})),(0,a.Q6)("openMediaViewer",((e,t,n)=>{const{chatId:a,threadId:s,messageId:o,avatarOwnerId:i,profilePhotoIndex:r,origin:c}=n;return{...e,mediaViewer:{chatId:a,threadId:s,messageId:o,avatarOwnerId:i,profilePhotoIndex:r,origin:c},forwardMessages:{}}})),(0,a.Q6)("closeMediaViewer",(e=>({...e,mediaViewer:{}}))),(0,a.Q6)("openAudioPlayer",((e,t,n)=>{const{chatId:a,threadId:s,messageId:o,origin:i,volume:r,playbackRate:c,isMuted:d}=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:d||e.audioPlayer.isMuted}}})),(0,a.Q6)("setAudioPlayerVolume",((e,t,n)=>{const{volume:a}=n;return{...e,audioPlayer:{...e.audioPlayer,volume:a}}})),(0,a.Q6)("setAudioPlayerPlaybackRate",((e,t,n)=>{const{playbackRate:a}=n;return{...e,audioPlayer:{...e.audioPlayer,playbackRate:a}}})),(0,a.Q6)("setAudioPlayerMuted",((e,t,n)=>{const{isMuted:a}=n;return{...e,audioPlayer:{...e.audioPlayer,isMuted:a}}})),(0,a.Q6)("setAudioPlayerOrigin",((e,t,n)=>{const{origin:a}=n;return{...e,audioPlayer:{...e.audioPlayer,origin:a}}})),(0,a.Q6)("closeAudioPlayer",(e=>({...e,audioPlayer:{volume:e.audioPlayer.volume,playbackRate:e.audioPlayer.playbackRate,isMuted:e.audioPlayer.isMuted}}))),(0,a.Q6)("openPollResults",((e,t,n)=>{const{chatId:s,messageId:o}=n;(0,r.Jf)(e)?s===e.pollResults.chatId&&o===e.pollResults.messageId||(0,a.R3)({...e,pollResults:{chatId:s,messageId:o,voters:{}}}):window.setTimeout((()=>{const e=(0,a.Rd)();(0,a.R3)({...e,pollResults:{chatId:s,messageId:o,voters:{}}})}),450)})),(0,a.Q6)("closePollResults",(e=>{(0,a.R3)({...e,pollResults:{}})})),(0,a.Q6)("focusLastMessage",((e,t)=>{const n=(0,r.Bt)(e);if(!n)return;const{chatId:a,threadId:s}=n;let o;if(s===u._f){var i;const t=(0,r.Z1)(e,a);o=null==t||null===(i=t.lastMessage)||void 0===i?void 0:i.id}else{const t=(0,r.tZ)(e,a,s);o=null==t?void 0:t.lastMessageId}o&&t.focusMessage({chatId:a,threadId:s,messageId:o,noHighlight:!0})})),(0,a.Q6)("focusNextReply",((e,t)=>{const n=(0,r.Bt)(e);if(!n)return;const{chatId:s,threadId:o}=n,c=(0,r.p9)(e,s,o);if(c&&0!==c.length){const n=c.pop();e=(0,i.pf)(e,s,o,"replyStack",[...c]),(0,a.R3)(e),t.focusMessage({chatId:s,threadId:o,messageId:n})}else t.focusLastMessage()})),(0,a.Q6)("focusMessage",((e,t,n)=>{const{chatId:s,threadId:o=u._f,messageListType:c="thread",noHighlight:d,groupedId:l,groupedChatId:h,replyMessageId:g,isResizingContainer:p}=n;let{messageId:f}=n;if(void 0!==l){const t=(0,r.y8)(e,h,l);null!=t&&t.length&&([f]=t)}const y=(0,r.Bt)(e),Z=!y||s!==y.chatId||o!==y.threadId||c!==y.type;if(v&&(clearTimeout(v),v=void 0),v=window.setTimeout((()=>{let e=(0,a.Rd)();e=(0,i.cq)(e),e=(0,i.wV)(e),(0,a.R3)(e)}),d?I:1500),e=(0,i.cq)(e,s,f,d,p),e=(0,i.wV)(e,void 0),g){const t=(0,r.p9)(e,s,o)||[];e=(0,i.pf)(e,s,o,"replyStack",[...t,g])}Z&&(e=(0,i.wV)(e,m.fo.Static));const P=(0,r.Cb)(e,s,o);if(P&&P.includes(f))return(0,a.R3)(e),void t.openChat({id:s,threadId:o});if(Z&&(e=(0,i.pf)(e,s,o,"viewportIds",void 0)),e=(0,i.pf)(e,s,o,"outlyingIds",void 0),P&&!Z){const t=f>P[0]?m.fo.Down:m.fo.Up;e=(0,i.wV)(e,t)}(0,a.R3)(e),t.openChat({id:s,threadId:o}),t.loadViewportMessages()})),(0,a.Q6)("openForwardMenu",((e,t,n)=>{const{fromChatId:a,messageIds:s,groupedId:o}=n;let i;return o&&(i=(0,r.xH)(e,a,o)),{...e,forwardMessages:{fromChatId:a,messageIds:i||s,isModalShown:!0}}})),(0,a.Q6)("exitForwardMode",(e=>{(0,a.R3)({...e,forwardMessages:{}})})),(0,a.Q6)("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.Q6)("openForwardMenuForSelectedMessages",((e,t)=>{if(!e.selectedMessages)return;const{chatId:n,messageIds:a}=e.selectedMessages;t.openForwardMenu({fromChatId:n,messageIds:a})})),(0,a.Q6)("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.Q6)("downloadMessageMedia",((e,t,n)=>{const{message:s}=n;s&&(0,a.R3)({...e,activeDownloads:{byChatId:{...e.activeDownloads.byChatId,[s.chatId]:[...e.activeDownloads.byChatId[s.chatId]||[],s.id]}}})})),(0,a.Q6)("downloadSelectedMessages",((e,t)=>{if(!e.selectedMessages)return;const{chatId:n,messageIds:a}=e.selectedMessages,{threadId:s}=(0,r.Bt)(e)||{},o=(0,r.Zw)(e,n);o&&s&&a.map((e=>o[e])).filter((t=>(0,r._k)(e,t,s).canDownload)).forEach((e=>t.downloadMessageMedia({message:e})))})),(0,a.Q6)("enterMessageSelectMode",((e,t,n)=>{const{messageId:a}=n||{},s=(0,r.jr)(e);return s?(0,i.M6)(e,s.id,a):e})),(0,a.Q6)("toggleMessageSelection",((e,t,n)=>{const{messageId:s,groupedId:o,childMessageIds:c,withShift:d}=n,l=(0,r.Bt)(e);if(!l)return;const{chatId:u,threadId:m,type:g}=l;e=(0,i.Ob)(e,u,m,g,s,o,c,d),(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.Q6)("disableContextMenuHint",(e=>{if(e.shouldShowContextMenuHint)return{...e,shouldShowContextMenuHint:!1}})),(0,a.Q6)("exitMessageSelectMode",i.i9),(0,a.Q6)("openPollModal",(e=>({...e,isPollModalOpen:!0}))),(0,a.Q6)("closePollModal",(e=>({...e,isPollModalOpen:!1}))),(0,a.Q6)("checkVersionNotification",((e,t)=>{const n=s.Ji.split(".").slice(0,2).join("."),{serviceNotifications:a}=e;if(a.find((({version:e})=>e===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.30**\n\n👏 **Harder**\n• Meet Message Reactions:\n - React to a message with ❤️🔥🎉😁😱🤩😢👎💩🤮 in the context menu.\n - Send a quick 👍 reaction by hovering over the bottom corner of a message.\n - You can change your default reaction to another emoji in Settings > General.\n - Group and Channel admins can enable and control reactions via their chat's Info Page > Edit > Reactions.\n\n• Interactive Emoji:\n - Added support for all interactive emoji, including fullscreen animations and sound effects. Try 🔥, 🍆, 🍑 and more.\n - Animations play simultaneously when both users have the chat open.\n – The “is watching…” status will appear when your chat partner is also seeing the animations.\n\n• Manage invite links for Groups and Channels:\n – Enable admin approval or limited duration and users.\n\n🤩 **Better**\n• Better quality for uploaded profile pictures.\n• Various UI improvements.\n\n🚀 **Faster**\n• Several optimizations for older devices – no more freezing while typing.\n\n💪 **Stronger**\n• Saved Messages now correctly renders in search results.\n• Fixed missing icons for muted chats in the chat list.\n• The context menu no longer flickers on older devices.\n• Fix re-scheduling messages to a previous date.\n")},isOutgoing:!1};t.createServiceNotification({message:o,version:n})})),(0,a.Q6)("createServiceNotification",((e,t,n)=>{var o;const{message:i,version:c}=n,{serviceNotifications:d}=e,l=(0,r.Z1)(e,s.aw),u=Math.max((null===(o=l.lastMessage)||void 0===o?void 0:o.id)||0,...d.map((({id:e})=>e))),m=(d.length+1)/1e3,h=Math.floor(u)+m;i.id=h;const g={id:h,message:i,version:c,isUnread:!0};(0,a.R3)({...e,serviceNotifications:[...d.slice(-1e3),g]}),t.apiUpdate({"@type":"newMessage",id:i.id,chatId:i.chatId,message:i})})),(0,a.Q6)("openReactorListModal",((e,t,n)=>{const{chatId:a,messageId:s}=n;return{...e,reactorModal:{chatId:a,messageId:s}}})),(0,a.Q6)("closeReactorListModal",(e=>({...e,reactorModal:void 0}))),(0,a.Q6)("openSeenByModal",((e,t,n)=>{const{chatId:a,messageId:s}=n;return{...e,seenByModal:{chatId:a,messageId:s}}})),(0,a.Q6)("closeSeenByModal",(e=>({...e,seenByModal:void 0}))),(0,a.Q6)("setGlobalSearchQuery",((e,t,n)=>{const{query:a}=n,{chatId:s}=e.globalSearch;return(0,i.No)(e,{globalResults:{},localResults:{},resultsByType:void 0,...a?{fetchingStatus:{chats:!s,messages:!0}}:{fetchingStatus:void 0},query:a})})),(0,a.Q6)("addRecentlyFoundChatId",((e,t,n)=>{const{id:a}=n,{recentlyFoundChatIds:s}=e.globalSearch;if(!s)return(0,i.No)(e,{recentlyFoundChatIds:[a]});const o=s.filter((e=>e!==a));return o.unshift(a),o.length>10&&o.pop(),(0,i.No)(e,{recentlyFoundChatIds:o})})),(0,a.Q6)("clearRecentlyFoundChats",(e=>(0,i.No)(e,{recentlyFoundChatIds:void 0}))),(0,a.Q6)("setGlobalSearchContent",((e,t,n)=>{const{content:a}=n;return(0,i.Og)(e,a)})),(0,a.Q6)("setGlobalSearchChatId",((e,t,n)=>{const{id:a}=n;return(0,i.No)(e,{chatId:a,query:void 0,resultsByType:void 0})})),(0,a.Q6)("setStickerSearchQuery",((e,t,n)=>{const{query:a}=n;return{...e,stickers:{...e.stickers,search:{query:a,resultIds:void 0}}}})),(0,a.Q6)("setGifSearchQuery",((e,t,n)=>{const{query:a}=n;return{...e,gifs:{...e.gifs,search:{query:a,offsetId:void 0,results:void 0}}}})),(0,a.Q6)("openUserInfo",((e,t,n)=>{const{id:a}=n;t.openChat({id:a})})),(0,a.Q6)("openChat",(e=>(0,i.x1)(e,void 0))),(0,a.Q6)("setUserSearchQuery",((e,t,n)=>{const{query:a}=n;return(0,i.Lm)(e,{globalUserIds:void 0,localUserIds:void 0,fetchingStatus:Boolean(a),query:a})})),n(3781);var y=n(1947),Z=n(6926);(0,a.Q6)("toggleChatInfo",(e=>({...e,isChatInfoShown:!e.isChatInfoShown}))),(0,a.Q6)("setLeftColumnWidth",((e,t,n)=>({...e,leftColumnWidth:n}))),(0,a.Q6)("resetLeftColumnWidth",(e=>({...e,leftColumnWidth:void 0}))),(0,a.Q6)("toggleManagement",(e=>{const{chatId:t}=(0,r.Bt)(e)||{};if(t)return{...e,management:{byChatId:{...e.management.byChatId,[t]:{...e.management.byChatId[t],isActive:!(e.management.byChatId[t]||{}).isActive}}}}})),(0,a.Q6)("closeManagement",(e=>{const{chatId:t}=(0,r.Bt)(e)||{};if(t)return{...e,management:{byChatId:{...e.management.byChatId,[t]:{...e.management.byChatId[t],isActive:!1}}}}})),(0,a.Q6)("openChat",(e=>{if(h.wB||h.p7)return{...e,isLeftColumnShown:0===e.messages.messageLists.length}})),(0,a.Q6)("toggleLeftColumn",(e=>({...e,isLeftColumnShown:!e.isLeftColumnShown}))),(0,a.Q6)("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.Q6)("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.Q6)("showNotification",((e,t,n)=>{const a=n;a.localId=(0,Z.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.Q6)("dismissNotification",((e,t,n)=>{const a=e.notifications.filter((({localId:e})=>e!==n.localId));return{...e,notifications:a}})),(0,a.Q6)("showDialog",((e,t,n)=>{const{data:a}=n;if("message"in a&&a.hasErrorKey&&!(0,y.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.Q6)("dismissDialog",(e=>{const t=[...e.dialogs];return t.pop(),{...e,dialogs:t}})),(0,a.Q6)("toggleSafeLinkModal",((e,t,n)=>{const{url:a}=n;return{...e,safeLinkModalUrl:a}})),(0,a.Q6)("openHistoryCalendar",((e,t,n)=>{const{selectedAt:a}=n;return{...e,historyCalendarSelectedAt:a}})),(0,a.Q6)("closeHistoryCalendar",(e=>({...e,historyCalendarSelectedAt:void 0}))),(0,a.Q6)("openPaymentModal",((e,t,n)=>{const{chatId:a,messageId:s}=n;return{...e,payment:{...e.payment,chatId:a,messageId:s,isPaymentModalOpen:!0}}})),(0,a.Q6)("closePaymentModal",(e=>{const t=(0,i.bp)(e);return(0,i.WY)(t)})),(0,a.Q6)("addPaymentError",((e,t,n)=>{const{error:a}=n;return{...e,payment:{...e.payment,error:a}}})),n(1689),n(1363),n(6204);var P=n(1226),C=n(9118);const w=new Map,b=(0,C.Ds)((e=>e()),500,!1);async function E(e,t,n,o,c=!1,d=!1){const l=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,P.t9)("fetchMessages",{chat:(0,r.Cm)((0,a.Rd)(),l,t),offsetId:n,addOffset:u,limit:s.hT,threadId:t});if(!h)return;const{messages:p,users:f,chats:I,threadInfos:v}=h;let y=(0,a.Rd)();const Z=l===s.aw?y.serviceNotifications.map((({message:e})=>e)):[],C=[].concat(p,Z),w=(0,g.ee)(C,"id"),b=Object.keys(w).map(Number);y=(0,i.c_)(y,l,w),y=c?(0,i.ff)(y,l,t,b):(0,i.xj)(y,l,t,b),y=(0,i.Sh)(y,(0,g.ee)(f,"id")),y=(0,i.fZ)(y,(0,g.ee)(I,"id")),y=(0,i.j6)(y,l,v);let E=(0,r.gb)(y,l,t);const S=(0,r.qC)(y,l,t);if(c&&E&&S&&(S.length&&!(0,g.YE)(E,S)||(y=(0,i.xj)(y,l,t,S),E=(0,r.gb)(y,l,t),y=(0,i.pf)(y,l,t,"outlyingIds",void 0),c=!1)),!d){const e=c?S:E,{newViewportIds:a}=M(e,n,o);y=(0,i.y9)(y,l,t,a)}(0,a.R3)(y)}function M(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,d=e.slice(Math.max(0,r),c+1);let l,u;switch(n){case m.Uq.Backwards:l=i>0,u=r>=0;break;case m.Uq.Forwards:l=i<a,u=c<=a-1;break;case m.Uq.Around:default:l=d.length>0,u=d.length===s.hT}return{newViewportIds:d,areSomeLocal:l,areAllLocal:u}}async function S(e){let t;const n=e.attachment?(e,s)=>{w.has(s)||(t=s,w.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,C.Pn)();const s=(0,a.Rd)();e.serverTimeOffset=s.serverTimeOffset;const o=(0,r.Bt)(s);if(!o)return;const{threadId:i}=o;e.replyingTo||i===u._f||(e.replyingTo=(0,r.qS)(s,e.chat.id,i)),await(0,P.t9)("sendMessage",e,n),n&&t&&w.delete(t)}(0,a.Q6)("loadViewportMessages",((e,t,n)=>{const{direction:a=m.Uq.Around,isBudgetPreload:o=!1}=n||{};let{chatId:c,threadId:d}=n||{};if(!c){const t=(0,r.Bt)(e);if(!t)return;c=t.chatId,d=t.threadId}const l=(0,r.Z1)(e,c);if(!l||l.isRestricted)return;const u=(0,r.Cb)(e,c,d),h=(0,r.gb)(e,c,d),g=(0,r.qC)(e,c,d);if(u&&u.length&&a!==m.Uq.Around){const n=a===m.Uq.Backwards?u[0]:u[u.length-1],s=Boolean(g),r=s?g:h,{newViewportIds:p,areSomeLocal:f,areAllLocal:I}=M(r,n,a);if(f&&(e=(0,i.y9)(e,c,d,p)),async function(e,t,n,a,s,o,i,r){t||await E(s,o,r,i,n,a),a||(await Promise.resolve(),e.loadViewportMessages({chatId:s.id,threadId:o,direction:i,isBudgetPreload:!0}))}(t,I,s,o,l,d,a,n),o)return}else{const t=(0,r.G$)(e,c)||(0,r.rd)(e,c,d),n=Boolean(t&&h&&!h.includes(t)),a=(n?g:h)||[],{newViewportIds:u,areSomeLocal:p,areAllLocal:f}=M(a,t,m.Uq.Around);p&&u.length>=s.hT&&(e=(0,i.y9)(e,c,d,u)),f||E(l,d,t,m.Uq.Around,n,o)}return e})),(0,a.Q6)("loadMessage",((e,t,n)=>{const{chatId:s,messageId:o,replyOriginForId:c,threadUpdate:d}=n,l=(0,r.Z1)(e,s);l&&(async()=>{const e=await async function(e,t,n){const s=await(0,P.t9)("fetchMessage",{chat:e,messageId:t});if(!s)return;if(s===u._Q){if(n){let t=(0,a.Rd)();const s=(0,r.hj)(t,e.id,n);t=(0,i.cY)(t,e.id,n,{...s,replyToMessageId:void 0}),(0,a.R3)(t)}return}let o=(0,a.Rd)();return o=(0,i.cY)(o,e.id,t,s.message),o=(0,i.Sh)(o,(0,g.ee)(s.users,"id")),(0,a.R3)(o),s.message}(l,o,c);if(e&&d){const{lastMessageId:t,isDeleting:n}=d;(0,a.R3)((0,i.lG)((0,a.Rd)(),e,s,t,n))}})()})),(0,a.Q6)("sendMessage",((e,t,n)=>{const a=(0,r.Bt)(e);if(!a)return;const{chatId:o,threadId:i,type:c}=a;if("scheduled"===c&&!n.scheduledAt)return{...e,messages:{...e.messages,contentToBeScheduled:n}};const d=(0,r.Z1)(e,o),l={...n,chat:d,replyingTo:(0,r.Yy)(e,o,i),noWebPage:(0,r.tV)(e,o,i),sendAs:(0,r._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}=l;S({...t,attachment:e?e[0]:void 0})}else if(m){const{text:e,entities:t,attachments:n,...a}=l,o=(0,g.Vl)(n,s.DU);for(let n=0;n<o.length;n++){const[s,...i]=o[n],r=`${Date.now()}${n}`;S({...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=>{S({...a,attachment:e,groupedId:r})}))}}else{const{text:e,entities:t,attachments:n,replyingTo:a,...s}=l;e&&S({...s,text:e,entities:t,replyingTo:a}),n.forEach((e=>{S({...s,attachment:e})}))}})),(0,a.Q6)("editMessage",((e,t,n)=>{const{serverTimeOffset:a}=e,{text:s,entities:o}=n,i=(0,r.Bt)(e);if(!i)return;const{chatId:c,threadId:d,type:l}=i,u=(0,r.Z1)(e,c),m=(0,r.kK)(e,c,d,l);u&&m&&((0,P.t9)("editMessage",{chat:u,message:m,text:s,entities:o,noWebPage:(0,r.tV)(e,c,d),serverTimeOffset:a}),t.setEditingId({messageId:void 0}))})),(0,a.Q6)("cancelSendingMessage",((e,t,n)=>{const{chatId:a,messageId:s}=n,o=(0,r.hj)(e,a,s),i=o&&w.get(o.previousLocalId||o.id);i&&(0,P.u3)(i),t.apiUpdate({"@type":"deleteMessages",ids:[s],chatId:a})})),(0,a.Q6)("saveDraft",((e,t,n)=>{const{chatId:a,threadId:s,draft:o}=n;if(!o)return;const{text:c,entities:d}=o,l=(0,r.Z1)(e,a);return s===u._f&&(0,P.t9)("saveDraft",{chat:l,text:c,entities:d,replyToMsgId:(0,r.Yy)(e,a,s)}),e=(0,i.pf)(e,a,s,"draft",o),(0,i.a4)(e,a,{draftDate:Math.round(Date.now()/1e3)})})),(0,a.Q6)("clearDraft",((e,t,n)=>{const{chatId:a,threadId:s,localOnly:o}=n;if(!(0,r.Ms)(e,a,s))return;const c=(0,r.Z1)(e,a);return o||s!==u._f||(0,P.t9)("clearDraft",c),e=(0,i.pf)(e,a,s,"draft",void 0),(0,i.a4)(e,a,{draftDate:void 0})})),(0,a.Q6)("toggleMessageWebPage",((e,t,n)=>{const{chatId:a,threadId:s,noWebPage:o}=n;return(0,i.pf)(e,a,s,"noWebPage",o)})),(0,a.Q6)("pinMessage",((e,t,n)=>{const a=(0,r.jr)(e);if(!a)return;const{messageId:s,isUnpin:o,isOneSide:i,isSilent:c}=n;(0,P.t9)("pinMessage",{chat:a,messageId:s,isUnpin:o,isOneSide:i,isSilent:c})})),(0,a.Q6)("unpinAllMessages",((e,t,n)=>{const s=(0,r.Z1)(e,n.chatId);s&&async function(e){await(0,P.t9)("unpinAllMessages",{chat:e});let t=(0,a.Rd)();t=(0,i.pf)(t,e.id,u._f,"pinnedIds",[]),(0,a.R3)(t)}(s)})),(0,a.Q6)("deleteMessages",((e,t,n)=>{const{messageIds:a,shouldDeleteForAll:s}=n,o=(0,r.Bt)(e);if(!o)return;const{chatId:i,threadId:c}=o,d=(0,r.Z1)(e,i);(0,P.t9)("deleteMessages",{chat:d,messageIds:a,shouldDeleteForAll:s});const l=(0,r._$)(e,i,c);a.includes(l)&&t.setEditingId({messageId:void 0})})),(0,a.Q6)("deleteScheduledMessages",((e,t,n)=>{const{messageIds:a}=n,s=(0,r.Bt)(e);if(!s)return;const{chatId:o}=s,i=(0,r.Z1)(e,o);(0,P.t9)("deleteScheduledMessages",{chat:i,messageIds:a});const c=(0,r.wU)(e,o);a.includes(c)&&t.setEditingId({messageId:void 0})})),(0,a.Q6)("deleteHistory",((e,t,n)=>{(async()=>{var a;const{chatId:s,shouldDeleteForAll:o}=n,i=(0,r.Z1)(e,s);if(!i)return;const c=null===(a=i.lastMessage)||void 0===a?void 0:a.id;await(0,P.t9)("deleteHistory",{chat:i,shouldDeleteForAll:o,maxId:c});const d=(0,r.Bt)(e);d&&d.chatId===s&&t.openChat({id:void 0})})()})),(0,a.Q6)("reportMessages",((e,t,n)=>{(async()=>{const{messageIds:a,reason:s,description:o}=n,i=(0,r.Bt)(e);if(!i)return;const{chatId:c}=i,d=(0,r.Z1)(e,c),l=await(0,P.t9)("reportMessages",{peer:d,messageIds:a,reason:s,description:o});t.showNotification({message:l?"Thank you! Your report will be reviewed by our team.":"Error occured while submiting report. Please, try again later."})})()})),(0,a.Q6)("sendMessageAction",((e,t,n)=>{(async()=>{const{action:t,chatId:a,threadId:s}=n;if(a===e.currentUserId)return;const o=(0,r.Z1)(e,a);o&&await(0,P.t9)("sendMessageAction",{peer:o,threadId:s,action:t})})()})),(0,a.Q6)("markMessageListRead",((e,t,n)=>{const{serverTimeOffset:a}=e,o=(0,r.Bt)(e);if(!o)return;const{chatId:c,threadId:d}=o,l=(0,r.Cm)(e,c,d);if(!l)return;const{maxId:m}=n;if(b((()=>{(0,P.t9)("markMessageListRead",{serverTimeOffset:a,chat:l,threadId:d,maxId:m})})),d!==u._f)return;c===s.aw&&(e={...e,serviceNotifications:e.serviceNotifications.map((e=>e.isUnread&&e.id<=m?{...e,isUnread:!1}:e))});const h=(0,r.Cb)(e,c,d),g=(0,r.It)(e,c,d);if(!h||!g||!l.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,i.a4)(e,c,{lastReadInboxMessageId:m,unreadCount:Math.max(0,l.unreadCount-p)}):e})),(0,a.Q6)("markMessagesRead",((e,t,n)=>{const a=(0,r.jr)(e);if(!a)return;const{messageIds:s}=n;(0,P.t9)("markMessagesRead",{chat:a,messageIds:s})})),(0,a.Q6)("loadWebPagePreview",((e,t,n)=>{const{text:s}=n;!async function(e){const t=await(0,P.t9)("fetchWebPagePreview",{message:e});(0,a.R3)({...(0,a.Rd)(),webPagePreview:t})}(s)})),(0,a.Q6)("clearWebPagePreview",(e=>{if(e.webPagePreview)return{...e,webPagePreview:void 0}})),(0,a.Q6)("sendPollVote",((e,t,n)=>{const{chatId:a,messageId:s,options:o}=n,i=(0,r.Z1)(e,a);i&&(0,P.t9)("sendPollVote",{chat:i,messageId:s,options:o})})),(0,a.Q6)("loadPollOptionResults",((e,t,n)=>{const{chat:s,messageId:o,option:r,offset:c,limit:d,shouldResetVoters:l}=n;!async function(e,t,n,s,o,r){const c=await(0,P.t9)("loadPollOptionResults",{chat:e,messageId:t,option:n,offset:s,limit:o});if(!c)return;let d=(0,a.Rd)();d=(0,i.Sh)(d,(0,g.ee)(c.users,"id"));const{voters:l}=d.pollResults;(0,a.R3)({...d,pollResults:{...d.pollResults,voters:{...l,[n]:(0,g.Tw)([...!r&&l&&l[n]?l[n]:[],...c&&c.users.map((e=>e.id))])},offsets:{...d.pollResults.offsets?d.pollResults.offsets:{},[n]:c.nextOffset||""}}})}(s,o,r,c,d,l)})),(0,a.Q6)("forwardMessages",((e,t,n)=>{const{fromChatId:s,messageIds:o,toChatId:i}=e.forwardMessages,c=s?(0,r.Z1)(e,s):void 0,l=i?(0,r.Z1)(e,i):void 0,u=s&&o?o.sort(((e,t)=>e-t)).map((t=>(0,r.hj)(e,s,t))).filter(Boolean):void 0;if(!c||!l||!u)return;const{isSilent:m,scheduledAt:h}=n,g=(0,r._5)(e,i),p=u.filter((e=>!(0,d.jM)(e)));p.length&&(0,P.t9)("forwardMessages",{fromChat:c,toChat:l,messages:p,serverTimeOffset:(0,a.Rd)().serverTimeOffset,isSilent:m,scheduledAt:h,sendAs:g}),u.filter((e=>(0,d.jM)(e))).forEach((e=>{const{text:t,entities:n}=e.content.text||{},{sticker:a,poll:s}=e.content;S({chat:l,text:t,entities:n,sticker:a,poll:s,isSilent:m,scheduledAt:h,sendAs:g})})),(0,a.R3)({...(0,a.Rd)(),forwardMessages:{}})})),(0,a.Q6)("loadScheduledHistory",((e,t,n)=>{const{chatId:s}=n,o=(0,r.Z1)(e,s);o&&async function(e){const t=await(0,P.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 r=(0,a.Rd)();r=(0,i.w3)(r,e.id,s),r=(0,i.pf)(r,e.id,u._f,"scheduledIds",o),(0,a.R3)(r)}(o)})),(0,a.Q6)("sendScheduledMessages",((e,t,n)=>{const{chatId:a,id:s}=n,o=(0,r.Z1)(e,a);o&&(0,P.t9)("sendScheduledMessages",{chat:o,ids:[s]})})),(0,a.Q6)("rescheduleMessage",((e,t,n)=>{const{chatId:a,messageId:s,scheduledAt:o}=n,i=(0,r.Z1)(e,a),c=i&&(0,r.Tm)(e,i.id,s);i&&c&&(0,P.t9)("rescheduleMessage",{chat:i,message:c,scheduledAt:o})})),(0,a.Q6)("requestThreadInfoUpdate",((e,t,n)=>{const{chatId:a,threadId:s}=n,o=(0,r.Cm)(e,a,s);o&&(0,P.t9)("requestThreadInfoUpdate",{chat:o,threadId:s})})),(0,a.Q6)("loadPinnedMessages",((e,t,n)=>{const{chatId:s}=n,o=(0,r.Z1)(e,s);o&&async function(e){const t=await(0,P.t9)("fetchPinnedMessages",{chat:e});if(!t)return;const{messages:n,chats:s,users:o}=t,r=(0,g.ee)(n,"id"),c=Object.keys(r).map(Number).sort(((e,t)=>t-e));let d=(0,a.Rd)();d=(0,i.c_)(d,e.id,r),d=(0,i.pf)(d,e.id,u._f,"pinnedIds",c),d=(0,i.Sh)(d,(0,g.ee)(o,"id")),d=(0,i.fZ)(d,(0,g.ee)(s,"id")),(0,a.R3)(d)}(o)})),(0,a.Q6)("loadSeenBy",((e,t,n)=>{const{chatId:s,messageId:o}=n,c=(0,r.Z1)(e,s);c&&(async()=>{const e=await(0,P.t9)("fetchSeenBy",{chat:c,messageId:o});e&&(0,a.R3)((0,i.cY)((0,a.Rd)(),s,o,{seenByUserIds:e}))})()})),(0,a.Q6)("saveDefaultSendAs",((e,t,n)=>{const{chatId:a,sendAsId:s}=n,o=(0,r.Z1)(e,a),c=(0,r.Z1)(e,s)||(0,r.dy)(e,s);if(o&&c)return(0,P.t9)("saveDefaultSendAs",{sendAs:c,chat:o}),(0,i.a4)(e,a,{fullInfo:{...o.fullInfo,sendAsId:s}})})),(0,a.Q6)("loadSendAs",((e,t,n)=>{const{chatId:s}=n,o=(0,r.Z1)(e,s);o&&(async()=>{const t=await(0,P.t9)("fetchSendAs",{chat:o});if(!t)return e=(0,i.a4)(e,s,{sendAsIds:[]}),void(0,a.R3)(e);e=(0,a.Rd)(),e=(0,i.Sh)(e,(0,g.ee)(t.users,"id")),e=(0,i.fZ)(e,(0,g.ee)(t.chats,"id")),e=(0,i.a4)(e,s,{sendAsIds:t.ids}),(0,a.R3)(e)})()})),(0,a.Q6)("loadSponsoredMessages",((e,t,n)=>{const{chatId:s}=n,o=(0,r.Z1)(e,s);o&&(async()=>{const e=await(0,P.t9)("fetchSponsoredMessages",{chat:o});if(!e)return;let t=(0,i.Fn)((0,a.Rd)(),s,e.messages[0]);t=(0,i.Sh)(t,(0,g.ee)(e.users,"id")),t=(0,i.fZ)(t,(0,g.ee)(e.chats,"id")),(0,a.R3)(t)})()})),(0,a.Q6)("viewSponsoredMessage",((e,t,n)=>{const{chatId:a}=n,s=(0,r.Z1)(e,a),o=(0,r.fS)(e,a);s&&o&&(0,P.t9)("viewSponsoredMessage",{chat:s,random:o.randomId})}));var R=n(5765);const k=(0,C.P2)((e=>e()),500,!1);async function T(e,t){const n=await(0,P.t9)("searchGifs",{query:e,offset:t});n&&(0,a.R3)((0,i.rq)((0,a.Rd)(),!t,n.gifs,n.nextOffset))}(0,a.Q6)("loadStickerSets",(e=>{const{hash:t}=e.stickers.added||{};!async function(e){const t=await(0,P.t9)("fetchStickerSets",{hash:e});t&&(0,a.R3)((0,i.z3)((0,a.Rd)(),"added",t.hash,t.sets))}(t)})),(0,a.Q6)("loadAddedStickers",((e,t)=>{const{setIds:n}=e.stickers.added;n&&n.length&&(async()=>{for(let e=0;e<n.length;e++)t.loadStickers({stickerSetId:n[e]}),e%10==0&&e>0&&await(0,C.wO)(200)})()})),(0,a.Q6)("loadRecentStickers",(e=>{const{hash:t}=e.stickers.recent||{};!async function(e){const t=await(0,P.t9)("fetchRecentStickers",{hash:e});if(!t)return;const n=(0,a.Rd)();(0,a.R3)({...n,stickers:{...n.stickers,recent:t}})}(t)})),(0,a.Q6)("loadFavoriteStickers",(e=>{const{hash:t}=e.stickers.favorite||{};!async function(e){const t=await(0,P.t9)("fetchFavoriteStickers",{hash:e});if(!t)return;const n=(0,a.Rd)();(0,a.R3)({...n,stickers:{...n.stickers,favorite:t}})}(t)})),(0,a.Q6)("loadGreetingStickers",(e=>{const{hash:t}=e.stickers.greeting||{};(async()=>{const e=await(0,P.t9)("fetchStickersForEmoji",{emoji:"👋⭐️",hash:t});if(!e)return;const n=(0,a.Rd)();(0,a.R3)({...n,stickers:{...n.stickers,greeting:{hash:e.hash,stickers:e.stickers.filter((e=>"👋"===e.emoji))}}})})()})),(0,a.Q6)("loadFeaturedStickers",(e=>{const{hash:t}=e.stickers.featured||{};!async function(e){const t=await(0,P.t9)("fetchFeaturedStickers",{hash:e});t&&(0,a.R3)((0,i.z3)((0,a.Rd)(),"featured",t.hash,t.sets))}(t)})),(0,a.Q6)("loadStickers",((e,t,n)=>{const{stickerSetId:s,stickerSetShortName:o}=n;let{stickerSetAccessHash:c}=n;if(!c&&!o){const t=(0,r.Ny)(e,s);if(!t)return;c=t.accessHash}!async function(e,t,n){const s=await(0,P.t9)("fetchStickers",{stickerSetShortName:n,stickerSetId:e,accessHash:t});if(!s)return;const{set:o,stickers:r,packs:c}=s;let d=(0,a.Rd)();d=(0,i.Rg)(d,o.id,{...o,stickers:r,packs:c});const l=d.stickers.forEmoji.emoji;l&&c[l]&&(d=(0,i.vy)(d)),(0,a.R3)(d)}(s,c,o)})),(0,a.Q6)("loadAnimatedEmojis",(()=>{!async function(){const e=await(0,P.t9)("fetchAnimatedEmojis");if(!e)return;const{set:t,stickers:n}=e;(0,a.R3)((0,i.g_)((0,a.Rd)(),{...t,stickers:n}))}(),async function(){const e=await(0,P.t9)("fetchAnimatedEmojiEffects");if(!e)return;const{set:t,stickers:n}=e;(0,a.R3)({...(0,a.Rd)(),animatedEmojiEffects:{...t,stickers:n}})}()})),(0,a.Q6)("loadSavedGifs",(e=>{const{hash:t}=e.gifs.saved;!async function(e){const t=await(0,P.t9)("fetchSavedGifs",{hash:e});if(!t)return;const n=(0,a.Rd)();(0,a.R3)({...n,gifs:{...n.gifs,saved:t}})}(t)})),(0,a.Q6)("faveSticker",((e,t,n)=>{const{sticker:a}=n;a&&(0,P.t9)("faveSticker",{sticker:a})})),(0,a.Q6)("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((({id:t})=>t!==e.id))}}}),(0,P.t9)("faveSticker",{sticker:e,unfave:!0})}(s)})),(0,a.Q6)("toggleStickerSet",((e,t,n)=>{const{stickerSetId:a}=n,s=(0,r.Ny)(e,a);if(!s)return;const{accessHash:o,installedDate:i}=s;(0,P.t9)(i?"uninstallStickerSet":"installStickerSet",{stickerSetId:a,accessHash:o})})),(0,a.Q6)("loadEmojiKeywords",((e,t,n)=>{var s;const{language:o}=n;let i=e.emojiKeywords[o];null!==(s=i)&&void 0!==s&&s.isLoading||((0,a.R3)({...e,emojiKeywords:{...e.emojiKeywords,[o]:{...i,isLoading:!0}}}),(async()=>{var t;const n=await(0,P.t9)("fetchEmojiKeywords",{language:o,fromVersion:i?i.version:0});e=(0,a.Rd)(),i=e.emojiKeywords[o],n?(0,a.R3)({...e,emojiKeywords:{...e.emojiKeywords,[o]:{isLoading:!1,version:n.version,keywords:{...null===(t=i)||void 0===t?void 0:t.keywords,...n.keywords}}}}):(0,a.R3)({...e,emojiKeywords:{...e.emojiKeywords,[o]:{...i,isLoading:!1}}})})())})),(0,a.Q6)("setStickerSearchQuery",((e,t,n)=>{const{query:s}=n;s&&k((()=>{!async function(e,t){const n=await(0,P.t9)("searchStickers",{query:e,hash:void 0});if(!n)return;const s=(0,a.Rd)(),{setsById:o,added:r}=s.stickers,c=n.sets.map((({id:e})=>e));r.setIds&&r.setIds.forEach((t=>{if(!c.includes(t)){const{title:n}=o[t]||{};n&&(0,R.Z)(n,e)&&c.unshift(t)}})),(0,a.R3)((0,i.z3)(s,"search",n.hash,n.sets,c))}(s)}))})),(0,a.Q6)("setGifSearchQuery",((e,t,n)=>{const{query:a}=n;"string"==typeof a&&k((()=>{T(a)}))})),(0,a.Q6)("searchMoreGifs",(e=>{const{query:t,offset:n}=e.gifs.search;"string"==typeof t&&k((()=>{T(t,n)}))})),(0,a.Q6)("loadStickersForEmoji",((e,t,n)=>{const{emoji:s}=n,{hash:o}=e.stickers.forEmoji;k((()=>{!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,P.t9)("fetchStickersForEmoji",{emoji:e,hash:t});n=(0,a.Rd)(),s&&n.stickers.forEmoji.emoji===e&&(n=(0,i.IM)(n,e,s.stickers,s.hash),(0,a.R3)(n))}(s,o)}))})),(0,a.Q6)("clearStickersForEmoji",(e=>({...e,stickers:{...e.stickers,forEmoji:{}}}))),(0,a.Q6)("openStickerSetShortName",((e,t,n)=>{const{stickerSetShortName:a}=n;return{...e,openedStickerSetShortName:a}}));var N=n(790);const B=(0,C.P2)((e=>e()),500,!1);async function A(e="",t,n,o,c,d){let l;if(o){const a=await(0,P.t9)("searchMessagesLocal",{chatOrUser:o,query:e,type:t,limit:s.Hk,offsetId:n,minDate:d,maxDate:c});if(a){const{messages:e,users:t,totalCount:n,nextOffsetId:s}=a;l={messages:e,users:t,chats:[],totalCount:n,nextRate:s}}}else l=await(0,P.t9)("searchMessagesGlobal",{query:e,offsetRate:n,limit:s.Hk,type:t,maxDate:c,minDate:d});let u=(0,a.Rd)();const m=(0,r.JX)(u);if(!l||""!==e&&e!==m)return void(0,a.R3)((0,i.xv)(u,{messages:!1}));const{messages:h,users:p,chats:f,totalCount:I,nextRate:v}=l;f.length&&(u=(0,i.fZ)(u,(0,g.ee)(f,"id"))),p.length&&(u=(0,i.Sh)(u,(0,g.ee)(p,"id"))),h.length&&(u=(0,i.m6)(u,h)),u=(0,i.px)(u,h,I,t,v),(0,a.R3)(u)}(0,a.Q6)("setGlobalSearchQuery",((e,t,n)=>{const{chatId:s}=e.globalSearch,{query:o}=n;o&&!s&&B((()=>{!async function(e){const t=await(0,P.t9)("searchChats",{query:e});let n=(0,a.Rd)();const s=(0,r.JX)(n);if(!t||!s||e!==s)return void(0,a.R3)((0,i.xv)(n,{chats:!1}));const{localChats:o,localUsers:c,globalChats:d,globalUsers:l}=t;(o.length||d.length)&&(n=(0,i.fZ)(n,(0,g.ee)([...o,...d],"id"))),(c.length||l.length)&&(n=(0,i.Sh)(n,(0,g.ee)([...c,...l],"id"))),n=(0,i.xv)(n,{chats:!1}),n=(0,i.No)(n,{localResults:{chatIds:o.map((({id:e})=>e)),userIds:c.map((({id:e})=>e))},globalResults:{...n.globalSearch.globalResults,chatIds:d.map((({id:e})=>e)),userIds:l.map((({id:e})=>e))}}),(0,a.R3)(n)}(o)}))})),(0,a.Q6)("setGlobalSearchDate",((e,t,n)=>{const{date:s}=n,o=s?(0,N.IS)(s):s,c=(0,i.No)(e,{date:s,query:"",resultsByType:{...e.globalSearch.resultsByType,text:{totalCount:void 0,foundIds:[],nextOffsetId:0}}});(0,a.R3)(c);const{chatId:d}=e.globalSearch;A("","text",void 0,d?(0,r.Z1)(e,d):void 0,o,s)})),(0,a.Q6)("searchMessagesGlobal",((e,t,n)=>{var a;const{query:s,resultsByType:o,chatId:i,date:c}=e.globalSearch,d=c?(0,N.IS)(c):c,{type:l}=n;A(s,l,null==o||null===(a=o[l])||void 0===a?void 0:a.nextOffsetId,i?(0,r.Z1)(e,i):void 0,d,c)})),(0,a.Q6)("searchTextMessagesLocal",(e=>{const{chatId:t,threadId:n}=(0,r.Bt)(e)||{},o=t?(0,r.Z1)(e,t):void 0,c=(0,r.n5)(e);if(!o||!c||!n)return;const{query:d,results:l}=c,m=null==l?void 0:l.nextOffsetId;let h;if(n!==u._f){const a=(0,r.tZ)(e,t,n);h=null==a?void 0:a.topMessageId}!async function(e,t,n,o,c){const d=await(0,P.t9)("searchMessagesLocal",{chatOrUser:e,type:"text",query:o,topMessageId:n,limit:s.pn,offsetId:c});if(!d)return;const{messages:l,users:u,totalCount:m,nextOffsetId:h}=d,p=(0,g.ee)(l,"id"),f=Object.keys(p).map(Number);let I=(0,a.Rd)();const v=(0,r.n5)(I);!v||o&&o!==v.query||(I=(0,i.c_)(I,e.id,p),I=(0,i.Sh)(I,(0,g.ee)(u,"id")),I=(0,i.dx)(I,e.id,t,f,m,h),(0,a.R3)(I))}(o,n,h,d,m)})),(0,a.Q6)("searchMediaMessagesLocal",(e=>{const t=(0,r.og)(e),n=t?e.users.byId[t]||e.chats.byId[t]:void 0,o=(0,r.we)(e);if(!n||!o)return;const{currentType:c,resultsByType:d}=o,l=c&&d&&d[c],u=null==l?void 0:l.nextOffsetId;c&&async function(e,t,n){const o=await(0,P.t9)("searchMessagesLocal",{chatOrUser:e,type:t,limit:s.EN,offsetId:n});if(!o)return;const{messages:c,users:d,totalCount:l,nextOffsetId:u}=o,m=(0,g.ee)(c,"id"),h=Object.keys(m).map(Number);let p=(0,a.Rd)();(0,r.we)(p)&&(p=(0,i.c_)(p,e.id,m),p=(0,i.Sh)(p,(0,g.ee)(d,"id")),p=(0,i.c1)(p,e.id,t,h,l,u),(0,a.R3)(p))}(n,c,u)})),(0,a.Q6)("searchMessagesByDate",((e,t,n)=>{const{timestamp:s}=n,{chatId:o}=(0,r.Bt)(e)||{};if(!o)return;const i=(0,r.Z1)(e,o);i&&async function(e,t){const n=await(0,P.t9)("findFirstMessageIdAfterDate",{chat:e,timestamp:t});n&&(0,a.uC)().focusMessage({chatId:e.id,messageId:n})}(i,s)})),(0,a.Q6)("checkPublicLink",((e,t,n)=>{const{chatId:s}=(0,r.Bt)(e)||{};if(!s)return;if(e.management.progress===m.wv.InProgress)return;const{username:o}=n;(async()=>{e=(0,i.H9)(e,m.wv.InProgress),e=(0,i.fw)(e,s,{isUsernameAvailable:void 0}),(0,a.R3)(e);const t=await(0,P.t9)("checkChatUsername",{username:o});e=(0,a.Rd)(),e=(0,i.H9)(e,t?m.wv.Complete:m.wv.Error),e=(0,i.fw)(e,s,{isUsernameAvailable:t}),(0,a.R3)(e)})()})),(0,a.Q6)("updatePublicLink",((e,t,n)=>{const{chatId:s}=(0,r.Bt)(e)||{};let o=s&&(0,r.Z1)(e,s);if(!s||!o)return;const{username:c}=n;(async()=>{if(e=(0,i.H9)(e,m.wv.InProgress),(0,a.R3)(e),(0,d.G9)(o)){if(o=await(0,P.t9)("migrateChat",o),!o)return;t.openChat({id:o.id})}const n=await(0,P.t9)("setChatUsername",{chat:o,username:c});e=(0,a.Rd)(),e=(0,i.H9)(e,n?m.wv.Complete:m.wv.Error),e=(0,i.fw)(e,s,{isUsernameAvailable:void 0}),(0,a.R3)(e)})()})),(0,a.Q6)("updatePrivateLink",(e=>{const{chatId:t}=(0,r.Bt)(e)||{},n=t&&(0,r.Z1)(e,t);t&&n&&(0,P.t9)("updatePrivateLink",{chat:n})})),(0,a.Q6)("setEditingExportedInvite",((e,t,n)=>{const{chatId:s,invite:o}=n;(0,a.R3)((0,i.fw)(e,s,{editingInvite:o}))}));var x=n(7358);async function L(){const e=await(0,P.t9)("fetchChats",{limit:s.Ov,archived:!0,withPinned:!0,serverTimeOffset:(0,a.Rd)().serverTimeOffset});if(!e)return;let t=(0,a.Rd)();t=(0,i.eD)(t,(0,g.ee)(e.users,"id")),t=(0,i.zn)(t,e.userStatusesById),t=(0,i.GL)(t,(0,g.ee)(e.chats,"id")),t=(0,i.Mg)(t,"archived",e.chatIds),t=(0,i.vv)(t,"archived",e),(0,a.R3)(t)}async function O(){let e=(0,a.Rd)();const{recentlyFoundChatIds:t}=e.globalSearch,{userIds:n}=e.contactList||{};if(!(n&&n.length||t&&t.length))return;const s=[...t||[],...n||[]].map((t=>(0,r.dy)(e,t))).filter(Boolean),o=await(0,P.t9)("fetchUsers",{users:s});if(!o)return;const{users:c,userStatusesById:d}=o;e=(0,a.Rd)(),e=(0,i.eD)(e,(0,g.ee)(c,"id")),e=(0,i.zn)(e,d),(0,a.R3)(e)}function U(e){return(0,P.t9)("fetchMessages",{chat:e,threadId:u._f,offsetId:e.lastReadInboxMessageId,addOffset:-(Math.round(s.hT/2)+1),limit:s.hT})}(0,a.Q6)("sync",((e,t)=>{!async function(e){s.eM&&console.log(">>> START SYNC"),await(0,P.t9)("fetchCurrentUser");const t=await async function(){var e;let t=(0,a.Rd)();const n=await(0,P.t9)("fetchChats",{limit:s.Ov,withPinned:!0,serverTimeOffset:t.serverTimeOffset,lastLocalServiceMessage:null===(e=(0,r.VF)(t))||void 0===e?void 0:e.message});if(!n)return;t=(0,a.Rd)();const{recentlyFoundChatIds:o}=t.globalSearch,{userIds:c}=t.contactList||{},{currentUserId:l}=t,m=[...o||[],...c||[],...l?[l]:[]],h=m.map((e=>(0,r.dy)(t,e))).filter(Boolean),p=m.map((e=>(0,r.Z1)(t,e))).filter(Boolean),{chatId:f}=(0,r.Bt)(t)||{};if(f){const e=(0,r.Z1)(t,f);if(e&&!m.includes(f)&&p.push(e),(0,d.YC)(f)){const e=(0,r.dy)(t,f);e&&!m.includes(f)&&h.push(e)}}return h.push(...n.users),p.push(...n.chats),t=(0,i.ps)(t,n.userStatusesById),t=(0,i.SL)(t,(0,g.ee)(p,"id")),t=(0,i.Mg)(t,"active",n.chatIds),t=(0,i.vv)(t,"active",n),Object.keys(n.draftsById).forEach((e=>{t=(0,i.pf)(t,e,u._f,"draft",n.draftsById[e])})),Object.keys(n.replyingToById).forEach((e=>{t=(0,i.pf)(t,e,u._f,"replyingToId",n.replyingToById[e])})),(0,a.R3)(t),f&&!t.chats.byId[f]&&(0,a.uC)().openChat({id:void 0}),h}();await async function(e){let t=!1,n=e||[],o=(0,a.Rd)();const{chatId:c,threadId:d}=(0,r.Bt)(o)||{},l=Object.keys(o.messages.byChatId).reduce(((e,t)=>{const n=(0,r.Ms)(o,t,u._f);return n&&(e[t]=n),e}),{});if(c){const e=await U(o.chats.byId[c]);o=(0,a.Rd)();const{chatId:l}=(0,r.Bt)(o)||{},m=d&&(0,r.tZ)(o,c,d);if(e&&l===c){const a=o.messages.byChatId[c],r=c===s.aw?o.serviceNotifications.map((({message:e})=>e)):[],l=[].concat(e.messages,r),h=(0,g.ee)(l,"id"),p=Object.keys(h).map(Number);if(o={...o,messages:{...o.messages,byChatId:{}}},o=(0,i.c_)(o,c,h),o=(0,i.xj)(o,c,u._f,p),o=(0,i.y9)(o,c,u._f,p),d&&m&&m.originChannelId){const{originChannelId:e}=m,t=o.messages.byChatId[e],n=await U(o.chats.byId[e]);if(n){const e=(0,g.ee)(n.messages,"id"),s=Object.keys(e).map(Number);o={...o,messages:{...o.messages,byChatId:{...o.messages.byChatId,[m.originChannelId]:{byId:e,threadsById:{[u._f]:{...null==t?void 0:t.threadsById[u._f],listedIds:s,viewportIds:s,outlyingIds:void 0}}},[c]:{...o.messages.byChatId[c],threadsById:{...o.messages.byChatId[c].threadsById,[d]:{...null==a?void 0:a.threadsById[d],outlyingIds:void 0}}}}}}}}o=(0,i.GL)(o,(0,g.ee)(e.chats,"id")),o=(0,i.j6)(o,c,e.threadInfos),t=!0,n=Array.prototype.concat(n,e.users)}}t||(o={...o,messages:{...o.messages,byChatId:{}}}),Object.keys(l).forEach((e=>{o=(0,i.pf)(o,e,u._f,"draft",l[e])})),e?o=(0,i.s5)(o,(0,g.ee)(n,"id")):n&&(o=(0,i.eD)(o,(0,g.ee)(n,"id"))),(0,a.R3)(o);const{chatId:m,messageId:h}=o.audioPlayer;m&&h&&!(0,r.hj)(o,m,h)&&(0,a.uC)().closeAudioPlayer()}(t),(0,a.R3)({...(0,a.Rd)(),lastSyncTime:Date.now()}),s.eM&&console.log(">>> FINISH SYNC"),e()}(t.afterSync)})),(0,a.Q6)("afterSync",(()=>{!async function(){s.eM&&console.log(">>> START AFTER-SYNC"),await Promise.all([O(),L()]),await(0,P.t9)("fetchCurrentUser"),(0,x.w)((0,r.A1)((0,a.Rd)())),s.eM&&console.log(">>> FINISH AFTER-SYNC")}()}));const F=(0,C.Ds)((e=>e()),500,!1,!0),$=(0,C.P2)((e=>e()),500,!1);function D(e,t,n){return{...e,inlineBots:{...e.inlineBots,byUsername:{...e.inlineBots.byUsername,[t]:n}}}}function j(e,t){return{...e,inlineBots:{...e.inlineBots,isLoading:t}}}(0,a.Q6)("loadFullUser",((e,t,n)=>{const{userId:a}=n,s=(0,r.dy)(e,a);if(!s)return;const{id:o,accessHash:i}=s;F((()=>(0,P.t9)("fetchFullUser",{id:o,accessHash:i})))})),(0,a.Q6)("loadUser",((e,t,n)=>{const{userId:s}=n,o=(0,r.dy)(e,s);o&&(async()=>{const t=await(0,P.t9)("fetchUsers",{users:[o]});if(!t)return;const{users:n,userStatusesById:s}=t;e=(0,a.Rd)(),e=(0,i.eD)(e,(0,g.ee)(n,"id")),(0,a.R3)((0,i.ps)(e,{...e.users.statusesById,...s})),(0,a.R3)(e)})()})),(0,a.Q6)("loadTopUsers",(e=>{const{topPeers:{lastRequestedAt:t}}=e;(!t||(0,p.b)(e.serverTimeOffset)-t>60)&&async function(){const e=await(0,P.t9)("fetchTopUsers");if(!e)return;const{ids:t,users:n}=e;let s=(0,a.Rd)();s=(0,i.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.Q6)("loadContactList",(()=>{!async function(){const e=await(0,P.t9)("fetchContactList");if(!e)return;let t=(0,i.Sh)((0,a.Rd)(),(0,g.ee)(e.users,"id"));t=(0,i.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.Q6)("loadCurrentUser",(()=>{(0,P.t9)("fetchCurrentUser")})),(0,a.Q6)("loadCommonChats",(e=>{var t;const{chatId:n}=(0,r.Bt)(e)||{},s=n?(0,r.dy)(e,n):void 0;!s||(0,d.cS)(s)||null!==(t=s.commonChats)&&void 0!==t&&t.isFullyLoaded||(async()=>{var t,n;const o=null===(t=s.commonChats)||void 0===t?void 0:t.maxId,r=await(0,P.t9)("fetchCommonChats",s.id,s.accessHash,o);if(!r)return;const{chats:c,chatIds:d,isFullyLoaded:l}=r;e=(0,a.Rd)(),c.length&&(e=(0,i.fZ)(e,(0,g.ee)(c,"id"))),e=(0,i.Nq)(e,s.id,{commonChats:{maxId:d.length?d[d.length-1]:"0",ids:(0,g.Tw)(((null===(n=s.commonChats)||void 0===n?void 0:n.ids)||[]).concat(d)),isFullyLoaded:l}}),(0,a.R3)(e)})()})),(0,a.Q6)("updateContact",((e,t,n)=>{const{userId:s,isMuted:o,firstName:c,lastName:d}=n;!async function(e,t,n,s){const o=(0,a.Rd)(),c=(0,r.dy)(o,e);if(!c)return;let d;if((0,a.uC)().updateChatMutedState({chatId:e,isMuted:t}),(0,a.R3)((0,i.H9)((0,a.Rd)(),m.wv.InProgress)),c.phoneNumber)d=await(0,P.t9)("updateContact",{phone:c.phoneNumber,firstName:n,lastName:s});else{const{id:e,accessHash:t}=c;d=await(0,P.t9)("addContact",{id:e,accessHash:t,phoneNumber:"",firstName:n,lastName:s})}d&&(0,a.R3)((0,i.Nq)((0,a.Rd)(),c.id,{firstName:n,lastName:s})),(0,a.R3)((0,i.H9)((0,a.Rd)(),m.wv.Complete))}(s,o,c,d)})),(0,a.Q6)("deleteContact",((e,t,n)=>{const{userId:s}=n;!async function(e){const t=(0,a.Rd)(),n=(0,r.dy)(t,e);if(!n)return;const{id:s,accessHash:o}=n;await(0,P.t9)("deleteContact",{id:s,accessHash:o})}(s)})),(0,a.Q6)("loadProfilePhotos",((e,t,n)=>{const{profileId:s}=n,o=(0,d.YC)(s),c=o?(0,r.dy)(e,s):void 0,l=o?void 0:(0,r.Z1)(e,s);(c||l)&&(async()=>{const e=await(0,P.t9)("fetchProfilePhotos",c,l);if(!e||!e.photos)return;let t=(0,a.Rd)();o?t=(0,i.Nq)(t,s,{photos:e.photos}):(t=(0,i.Sh)(t,(0,g.ee)(e.users,"id")),t=(0,i.a4)(t,s,{photos:e.photos})),(0,a.R3)(t)})()})),(0,a.Q6)("setUserSearchQuery",((e,t,n)=>{const{query:s}=n;s&&$((()=>{!async function(e){const t=await(0,P.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,i.Q3)(n,!1));const{localUsers:o,globalUsers:r}=t;let c,d;o.length&&(n=(0,i.Sh)(n,(0,g.ee)(o,"id")),c=o.map((({id:e})=>e))),r.length&&(n=(0,i.Sh)(n,(0,g.ee)(r,"id")),d=r.map((({id:e})=>e))),n=(0,i.Q3)(n,!1),n=(0,i.Lm)(n,{localUserIds:c,globalUserIds:d}),(0,a.R3)(n)}(s)}))})),(0,a.Q6)("addContact",((e,t,n)=>{const{userId:a}=n,s=(0,r.dy)(e,a);s&&(0,P.t9)("addContact",(0,g.ei)(s,["id","accessHash","firstName","lastName","phoneNumber"]))}));const Q=(0,C.Ds)((e=>e()),500,!1);async function q(e,t,n,a,s){await(0,P.t9)("sendMessage",{chat:e,text:n,replyingTo:a,sendAs:s})}(0,a.Q6)("clickInlineButton",((e,t,n)=>{const{button:o}=n;switch(o.type){case"command":t.sendBotCommand({command:o.value});break;case"url":o.value.match(s.FS)||o.value.match(s.g$)?t.openTelegramLink({url:o.value}):t.toggleSafeLinkModal({url:o.value});break;case"callback":{const t=(0,r.jr)(e);if(!t)return;!async function(e,t,n){const s=await(0,P.t9)("answerCallbackButton",{chatId:e.id,accessHash:e.accessHash,messageId:t,data:n});if(!s)return;const{showDialog:o,showNotification:i,toggleSafeLinkModal:r}=(0,a.uC)(),{message:c,alert:d,url:l}=s;d?o({data:{message:c||"Error"}}):c?i({message:c}):l&&r({url:l})}(t,o.messageId,o.value);break}case"requestPoll":t.openPollModal();break;case"requestSelfContact":{const n=e.currentUserId?(0,r.dy)(e,e.currentUserId):void 0;if(!n)return;t.showDialog({data:{phoneNumber:n.phoneNumber,firstName:n.firstName,lastName:n.lastName,userId:n.id}});break}case"buy":{const n=(0,r.jr)(e),{messageId:a,value:s}=o;if(!n)return;s?t.getReceipt({receiptMessageId:s,chatId:n.id,messageId:a}):(t.getPaymentForm({chat:n,messageId:a}),t.setInvoiceMessageInfo((0,r.hj)(e,n.id,a)),t.openPaymentModal({chatId:n.id,messageId:a}));break}}})),(0,a.Q6)("sendBotCommand",((e,t,n)=>{const{command:a,chatId:s}=n,{currentUserId:o}=e,i=s?(0,r.Z1)(e,s):(0,r.jr)(e),c=(0,r.Bt)(e);if(!o||!i||!c)return;const{threadId:d}=c;t.setReplyingToId({messageId:void 0}),t.clearWebPagePreview({chatId:i.id,threadId:d,value:!1}),q(i,0,a,(0,r.Yy)(e,i.id,d),(0,r._5)(e,s))})),(0,a.Q6)("restartBot",((e,t,n)=>{const{chatId:s}=n,{currentUserId:o}=e,c=(0,r.jr)(e),d=o&&(0,r.IK)(e,s);o&&c&&d&&(async()=>{await(0,P.t9)("unblockContact",d.id,d.accessHash)&&((0,a.R3)((0,i.rB)((0,a.Rd)(),d.id)),q(c,0,"/start",void 0,(0,r._5)(e,s)))})()})),(0,a.Q6)("loadTopInlineBots",(e=>{const{lastRequestedAt:t}=e.topInlineBots;t&&(0,p.b)(e.serverTimeOffset)-t<60||(async()=>{const t=await(0,P.t9)("fetchTopInlineBots");if(!t)return;const{ids:n,users:s}=t;let o=(0,a.Rd)();o=(0,i.Sh)(o,(0,g.ee)(s,"id")),o={...o,topInlineBots:{...o.topInlineBots,userIds:n,lastRequestedAt:(0,p.b)(e.serverTimeOffset)}},(0,a.R3)(o)})()})),(0,a.Q6)("queryInlineBot",((e,t,n)=>{const{chatId:s,username:o,query:c,offset:d}=n;(async()=>{let t=e.inlineBots.byUsername[o];if(!1!==t){if(void 0===t){const{user:n,chat:s}=await(0,P.t9)("fetchInlineBot",{username:o})||{};if(e=(0,a.Rd)(),!n||!s)return void(0,a.R3)(D(e,o,!1));e=(0,i.Sh)(e,{[n.id]:n}),e=(0,i.fZ)(e,{[s.id]:s}),t={id:n.id,query:"",offset:"",switchPm:void 0,canLoadMore:!0,results:[]},e=D(e,o,t),(0,a.R3)(e)}(c!==t.query||t.canLoadMore)&&Q((()=>{!async function({username:e,inlineBotData:t,chatId:n,query:s,offset:o}){let i=(0,a.Rd)();const c=(0,r.dy)(i,t.id),d=(0,r.Z1)(i,n);if(!c||!d)return;const l=t.query!==s;i=j(i,!0),i=D(i,e,{...t,query:s,...l&&{offset:void 0,results:[]}}),(0,a.R3)(i);const u=await(0,P.t9)("fetchInlineBotResults",{bot:c,chat:d,query:s,offset:l?void 0:o}),m=i.inlineBots.byUsername[e];if(i=j((0,a.Rd)(),!1),!u||!m||s!==m.query)return void(0,a.R3)(i);const h=new Set((m.results||[]).map((e=>e.id))),g=u.results.filter((e=>!h.has(e.id)));i=D(i,e,{...m,help:u.help,...g.length&&{isGallery:u.isGallery},...u.switchPm&&{switchPm:u.switchPm},canLoadMore:u.results.length>0&&Boolean(u.nextOffset),results:""===m.offset||m.offset===u.nextOffset?u.results:(m.results||[]).concat(g),offset:g.length?u.nextOffset:""}),(0,a.R3)(i)}({username:o,inlineBotData:t,chatId:s,query:c,offset:d})}))}})()})),(0,a.Q6)("sendInlineBotResult",((e,t,n)=>{const{id:a,queryId:s}=n,o=(0,r.Bt)(e);if(!o||!a)return;const{chatId:i,threadId:c}=o,d=(0,r.Z1)(e,i);t.setReplyingToId({messageId:void 0}),t.clearWebPagePreview({chatId:i,threadId:c,value:!1}),(0,P.t9)("sendInlineBotResult",{chat:d,resultId:a,queryId:s,replyingTo:(0,r.Yy)(e,i,c),sendAs:(0,r._5)(e,i)})})),(0,a.Q6)("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)(D(e,s,o)))})),(0,a.Q6)("startBot",((e,t,n)=>{const{botId:a,param:s}=n,o=(0,r.dy)(e,a);o&&(async()=>{await(0,P.t9)("startBot",{bot:o,startParam:s})})()})),n(9667),(0,a.Q6)("loadPasswordInfo",(()=>{(async()=>{const e=await(0,P.t9)("getPasswordInfo");if(!e)return;let t=(0,a.Rd)();t=(0,i.BI)(t,{hasPassword:e.hasPassword}),t=(0,i.IE)(t,{hint:e.hint}),(0,a.R3)(t)})()})),(0,a.Q6)("checkPassword",((e,t,n)=>{const{currentPassword:s,onSuccess:o}=n;(0,a.R3)((0,i.IE)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await(0,P.t9)("checkPassword",s);(0,a.R3)((0,i.IE)((0,a.Rd)(),{isLoading:!1})),e&&o()})()})),(0,a.Q6)("clearPassword",((e,t,n)=>{const{currentPassword:s,onSuccess:o}=n;(0,a.R3)((0,i.IE)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await(0,P.t9)("clearPassword",s);(0,a.R3)((0,i.IE)((0,a.Rd)(),{isLoading:!1})),e&&o()})()})),(0,a.Q6)("updatePassword",((e,t,n)=>{const{currentPassword:s,password:o,hint:r,email:c,onSuccess:d}=n;(0,a.R3)((0,i.IE)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await(0,P.t9)("updatePassword",s,o,r,c);(0,a.R3)((0,i.IE)((0,a.Rd)(),{isLoading:!1})),e&&d()})()})),(0,a.Q6)("updateRecoveryEmail",((e,t,n)=>{const{currentPassword:s,email:o,onSuccess:r}=n;(0,a.R3)((0,i.IE)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await(0,P.t9)("updateRecoveryEmail",s,o);(0,a.R3)((0,i.IE)((0,a.Rd)(),{isLoading:!1,waitingEmailCodeLength:void 0})),e&&r()})()})),(0,a.Q6)("provideTwoFaEmailCode",((e,t,n)=>{const{code:a}=n;(0,P.t9)("provideRecoveryEmailCode",a)})),(0,a.Q6)("clearTwoFaError",(e=>(0,i.IE)(e,{error:void 0}))),(0,a.Q6)("validateRequestedInfo",((e,t,n)=>{const{requestInfo:s,saveInfo:o}=n,c=(0,r.gx)(e),d=c&&(0,r.Z1)(e,c),l=(0,r.Mz)(e);d&&l&&async function(e,t,n,s){const o=await(0,P.t9)("validateRequestedInfo",{chat:e,messageId:t,requestInfo:n,shouldSave:s});if(!o)return;const{id:r,shippingOptions:c}=o;if(!r)return;let d=(0,i.vT)((0,a.Rd)(),r);c?(d=(0,i.TM)(d,c),d=(0,i.Q$)(d,m.KB.Shipping)):d=(0,i.Q$)(d,m.KB.PaymentInfo),(0,a.R3)(d)}(d,l,s,o)})),(0,a.Q6)("getPaymentForm",((e,t,n)=>{const{chat:s,messageId:o}=n;s&&o&&async function(e,t){const n=await(0,P.t9)("getPaymentForm",{chat:e,messageId:t});if(!n)return;let s=(0,i._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,i.Q$)(s,o),(0,a.R3)(s)}(s,o)})),(0,a.Q6)("getReceipt",((e,t,n)=>{const{receiptMessageId:s,chatId:o,messageId:c}=n,d=o&&(0,r.Z1)(e,o);c&&s&&d&&async function(e,t,n){const s=await(0,P.t9)("getReceipt",e,n);if(!s)return;let o=(0,a.Rd)();const c=(0,r.hj)(o,e.id,t);o=(0,i.Dq)(o,s,c),(0,a.R3)(o)}(d,c,s)})),(0,a.Q6)("clearPaymentError",(e=>{(0,a.R3)({...e,payment:{...e.payment,error:void 0}})})),(0,a.Q6)("clearReceipt",(e=>{(0,a.R3)({...e,payment:{...e.payment,receipt:void 0}})})),(0,a.Q6)("sendCredentialsInfo",((e,t,n)=>{const s=(0,r.$$)(e);if(!s)return;const{credentials:o}=n,{data:c}=o;!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 r=(0,i.QH)((0,a.Rd)(),{type:o.type,id:o.id});r=(0,i.Q$)(r,m.KB.Checkout),(0,a.R3)(r)}(c,s)})),(0,a.Q6)("sendPaymentForm",((e,t,n)=>{const{shippingOptionId:s,saveCredentials:o}=n,c=(0,r.gx)(e),d=c&&(0,r.Z1)(e,c),l=(0,r.Mz)(e),u=(0,r.eh)(e),m=(0,r.sp)(e),h=(0,r.$$)(e),g=(0,r.i3)(e);d&&l&&h&&u&&async function(e,t,n,s,o,r){if(await(0,P.t9)("sendPaymentForm",{chat:e,messageId:t,formId:n,credentials:s,requestedInfoId:o,shippingOptionId:r})){const e=(0,i.bp)((0,a.Rd)());(0,a.R3)((0,i.WY)(e))}}(d,l,u,{save:o,data:g},m,s)})),(0,a.Q6)("setPaymentStep",((e,t,n={})=>(0,i.Q$)(e,n.step||m.KB.ShippingInfo))),(0,a.Q6)("setInvoiceMessageInfo",((e,t,n)=>(0,i.nA)(e,n)));var G=n(647),H=n(3495);const _=728,z=424,V=288;var Y=n(3858);function X(e,t){return t-(e.isLeftColumnShown&&!h.wB?e.leftColumnWidth||((n=Y.Z.get().width)>s._m?Math.min(Math.max(.25*n,V),.33*n):n>s.ks?Math.min(Math.max(.33*n,V),.4*n):z):0);var n}(0,a.Q6)("loadAvailableReactions",(()=>{(async()=>{const e=await(0,P.t9)("getAvailableReactions");e&&(e.forEach((e=>{e.aroundAnimation&&G.he(`sticker${e.aroundAnimation.id}`,u.IU.Lottie),e.centerIcon&&G.he(`sticker${e.centerIcon.id}`,u.IU.Lottie)})),(0,a.R3)({...(0,a.Rd)(),availableReactions:e}))})()})),(0,a.Q6)("interactWithAnimatedEmoji",((e,t,n)=>{const{emoji:a,x:s,y:o,localEffect:i,startSize:r,isReversed:c}=n;return{...e,activeEmojiInteraction:{animatedEffect:a||i,x:X(e,s),y:o,startSize:r,isReversed:c}}})),(0,a.Q6)("sendEmojiInteraction",((e,t,n)=>{const{messageId:a,chatId:s,emoji:o,interactions:i,localEffect:c,x:d,y:l,startX:u,startY:m,startSize:h}=n,g=(0,r.Z1)(e,s);if(g&&(o||c)&&((0,P.t9)("sendEmojiInteraction",{chat:g,messageId:a,emoticon:o||(0,r.ji)(c),timestamps:i}),e.activeEmojiInteraction))return{...e,activeEmojiInteraction:{...e.activeEmojiInteraction,endX:X(e,d),endY:l,...u&&{x:X(e,u)},...m&&{y:m},...h&&{startSize:h}}}})),(0,a.Q6)("sendDefaultReaction",((e,t,n)=>{const{chatId:a,messageId:s,x:o,y:i}=n,c=(0,r.q6)(e,a);c&&t.sendReaction({chatId:a,messageId:s,reaction:c,x:o,y:i})})),(0,a.Q6)("sendReaction",((e,t,n)=>{var a,o;const{chatId:i,messageId:c}=n;let{reaction:d}=n;const l=(0,r.Z1)(e,i),u=(0,r.hj)(e,i,c);if(!l||!u)return;null!==(a=u.reactions)&&void 0!==a&&null!==(o=a.results)&&void 0!==o&&o.some((e=>e.reaction===d&&e.isChosen))&&(d=void 0),(0,P.t9)("sendReaction",{chat:l,messageId:c,reaction:d});const{animationLevel:m}=e.settings.byKey;return m===s.zy&&(e={...e,activeReactions:{...d?e.activeReactions:(0,g.CE)(e.activeReactions,[c]),...d&&{[c]:{reaction:d,messageId:c}}}}),function(e,t,n,a){const{reactions:s}=(0,r.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,H.cY)(e,t,n,{reactions:{...s,results:o,recentReactions:i}})}(e,i,c,d)})),(0,a.Q6)("openChat",(e=>({...e,activeReactions:{}}))),(0,a.Q6)("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.Q6)("setDefaultReaction",((e,t,n)=>{const{reaction:s}=n;(async()=>{await(0,P.t9)("setDefaultReaction",{reaction:s})&&(e=(0,a.Rd)(),(0,a.R3)({...e,appConfig:{...e.appConfig,defaultReaction:s}}))})()})),(0,a.Q6)("stopActiveEmojiInteraction",(e=>({...e,activeEmojiInteraction:void 0}))),(0,a.Q6)("loadReactors",((e,t,n)=>{var s;const{chatId:o,messageId:c,reaction:d}=n,l=(0,r.Z1)(e,o),u=(0,r.hj)(e,o,c);if(!l||!u)return;const m=null===(s=u.reactors)||void 0===s?void 0:s.nextOffset;(async()=>{var t,n;const s=await(0,P.t9)("fetchMessageReactionsList",{reaction:d,chat:l,messageId:c,offset:m});if(!s)return;e=(0,a.Rd)(),null!==(t=s.users)&&void 0!==t&&t.length&&(e=(0,i.Sh)(e,(0,g.ee)(s.users,"id")));const{nextOffset:r,count:h,reactions:p}=s;(0,a.R3)((0,i.cY)(e,o,c,{reactors:{nextOffset:r,count:h,reactions:[...(null===(n=u.reactors)||void 0===n?void 0:n.reactions)||[],...p]}}))})()})),(0,a.Q6)("loadMessageReactions",((e,t,n)=>{const{ids:a,chatId:s}=n,o=(0,r.Z1)(e,s);o&&(0,P.t9)("fetchMessageReactions",{ids:a,chat:o})})),(0,a.Q6)("sendWatchingEmojiInteraction",((e,t,n)=>{const{chatId:a,emoticon:s,x:o,y:i,startSize:c,isReversed:d}=n,l=(0,r.Z1)(e,a);if(l&&e.activeEmojiInteraction)return(0,P.t9)("sendWatchingEmojiInteraction",{chat:l,emoticon:s}),{...e,activeEmojiInteraction:{...e.activeEmojiInteraction,x:X(e,o),y:i,startSize:c,isReversed:d}}})),n(4907);var W=n(8406);const K=(0,C.P2)((e=>e()),500,!0);(0,a.Q6)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"updateChat":{n.noTopChatsRequest||(0,r.N)(e,n.id)||t.loadTopChats();const s=(0,i.a4)(e,n.id,n.chat,n.newProfilePhoto);(0,a.R3)(s),K((()=>(0,x.w)((0,r.A1)((0,a.Rd)())))),n.chat.id&&(0,W.Vr)({chatId:n.chat.id,lastReadInboxMessageId:n.chat.lastReadInboxMessageId});break}case"updateChatJoin":{const s=(0,r.Ek)(e,n.id);if(!s)break;e=(0,i.B1)(e,s,[n.id]),e=(0,i.a4)(e,n.id,{isNotJoined:!1}),(0,a.R3)(e);const o=(0,r.Z1)(e,n.id);o&&t.requestChatUpdate({chatId:o.id});break}case"updateChatLeave":(0,a.R3)((0,i.Dd)(e,n.id));break;case"updateChatInbox":(0,a.R3)((0,i.a4)(e,n.id,n.chat)),K((()=>(0,x.w)((0,r.A1)((0,a.Rd)()))));break;case"updateChatTypingStatus":{const{id:t,typingStatus:s}=n;(0,a.R3)((0,i.a4)(e,t,{typingStatus:s})),setTimeout((()=>{const e=(0,a.Rd)(),n=(0,r.Z1)(e,t);n&&s&&n.typingStatus&&n.typingStatus.timestamp===s.timestamp&&(0,a.R3)((0,i.a4)(e,t,{typingStatus:void 0}))}),6e3);break}case"newMessage":{const{message:s}=n,{chatId:o,threadId:c,type:d}=(0,r.Bt)(e)||{};if(s.senderId===e.currentUserId&&!s.isFromScheduled)return;const l=(0,r.Z1)(e,n.chatId);if(!l)return;"thread"===d&&c===u._f&&n.chatId===o?setTimeout((()=>{t.requestChatUpdate({chatId:n.chatId})}),1500):(0,a.R3)((0,i.a4)(e,n.chatId,{unreadCount:l.unreadCount?l.unreadCount+1:1,...n.message.hasUnreadMention&&{unreadMentionsCount:l.unreadMentionsCount?l.unreadMentionsCount+1:1}})),(0,x.w)((0,r.A1)((0,a.Rd)())),(0,W.zP)({chat:l,message:s});break}case"updateCommonBoxMessages":case"updateChannelMessages":{const{ids:t,messageUpdate:s}=n;if(!1!==s.hasUnreadMention)return;t.forEach((t=>{const a="channelId"in n?n.channelId:(0,r.X5)(e,t),s=(0,r.Z1)(e,a);null!=s&&s.unreadMentionsCount&&(e=(0,i.a4)(e,a,{unreadMentionsCount:s.unreadMentionsCount-1}))})),(0,a.R3)(e);break}case"updateChatFullInfo":{const{fullInfo:t}=n,s=e.chats.byId[n.id];if(!s)return;(0,a.R3)((0,i.a4)(e,n.id,{fullInfo:{...s.fullInfo,...t}}));break}case"updatePinnedChatIds":{const{ids:t,folderId:o}=n,i=o===s.WS?"archived":"active";e={...e,chats:{...e.chats,orderedPinnedIds:{...e.chats.orderedPinnedIds,[i]:t.length?t:void 0}}},(0,a.R3)(e);break}case"updateChatPinned":{const{id:t,isPinned:o}=n,i=(0,r.Ek)(e,t);if(i){const{[i]:n}=e.chats.orderedPinnedIds;let a=n||[];if(o){if(!a.includes(t)){if("active"===i&&a.length>=s.EG){const t=e.chats.listIds.active;a=a.filter((e=>t&&t.includes(e)))}a=[t,...a]}}else a=a.filter((e=>e!==t));e={...e,chats:{...e.chats,orderedPinnedIds:{...e.chats.orderedPinnedIds,[i]:a.length?a:void 0}}}}(0,a.R3)(e);break}case"updateChatListType":{const{id:t,folderId:s}=n;(0,a.R3)((0,i.Pi)(e,t,s));break}case"updateChatFolder":{const{id:t,folder:s}=n,{byId:o,orderedIds:i}=e.chatFolders,r=s?{...o,[t]:s}:(0,g.ei)(o,Object.keys(o).map(Number).filter((e=>e!==t))),c=s?i&&i.includes(t)?i:[...i||[],t]:i?i.filter((e=>e!==t)):void 0;(0,a.R3)({...e,chatFolders:{...e.chatFolders,byId:r,orderedIds:c}});break}case"updateChatFoldersOrder":{const{orderedIds:t}=n;(0,a.R3)({...e,chatFolders:{...e.chatFolders,orderedIds:t}});break}case"updateRecommendedChatFolders":{const{folders:t}=n;(0,a.R3)({...e,chatFolders:{...e.chatFolders,recommended:t}});break}case"updateChatMembers":{var o;const t=e.chats.byId[n.id],{replacedMembers:s,addedMember:r,deletedMemberId:c}=n;if(!t)return;let d=!1,l=null!==(o=t.fullInfo)&&void 0!==o&&o.members?[...t.fullInfo.members]:[];if(s)l=s,d=!0;else if(r)l.length&&l.some((e=>e.userId===r.userId))||(l.push(r),d=!0);else if(l.length&&c){const e=l.findIndex((e=>e.userId===c));e>-1&&(l.slice(e,1),d=!0)}if(d){const s=l.filter((({isOwner:e,isAdmin:t})=>e||t));(0,a.R3)((0,i.a4)(e,n.id,{membersCount:l.length,fullInfo:{...t.fullInfo,members:l,adminMembers:s}}))}break}case"deleteProfilePhotos":{const{chatId:t,ids:s}=n,o=e.chats.byId[t];null!=o&&o.photos&&(0,a.R3)((0,i.a4)(e,t,{photos:o.photos.filter((e=>!s.includes(e.id)))}));break}case"draftMessage":{const{chatId:t,formattedText:s,date:o,replyingToId:r}=n;e.chats.byId[t]&&(e=(0,i.pf)(e,t,u._f,"draft",s),e=(0,i.pf)(e,t,u._f,"replyingToId",r),e=(0,i.a4)(e,t,{draftDate:o}),(0,a.R3)(e));break}case"showInvite":{const{data:e}=n;t.showDialog({data:e});break}}}));const J=350;function ee(e,t,n,a,s=!1){const o=s?(0,r.Tm)(e,t,n):(0,r.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,i.P4)(e,t,n,a):(0,i.cY)(e,t,n,a)}function te(e,t,n,a){const{chatId:s}=n,{threadInfo:o}=(0,r.Db)(e,s,n)||{};if(!o&&n.replyToMessageId){const o=(0,r.hj)(e,s,n.replyToMessageId);o?e=(0,i.lG)(e,o,s,n.id,a):t.loadMessage({chatId:s,messageId:n.replyToMessageId,threadUpdate:{isDeleting:a,lastMessageId:n.id}})}return e}function ne(e,t,n){const{id:a,chatId:s}=n,{threadInfo:o,firstMessageId:c}=(0,r.Db)(e,s,n)||{},l=(0,r.Z1)(e,s),m=(null==l?void 0:l.unreadCount)&&!(0,r.gb)(e,s,u._f);if(e=te(e,t,n),o&&(!c&&(0,d.CI)(n)||(e=(0,i.xj)(e,s,o.threadId,[a]),(0,r.b9)(e,s,o.threadId)&&(e=(0,i.$S)(e,s,o.threadId,a),c||(e=(0,i.pf)(e,s,o.threadId,"firstMessageId",n.id)))),e=(0,i.pf)(e,s,o.threadId,"threadInfo",{...o,lastMessageId:n.id,messagesCount:o.messagesCount+1})),m)return e;if(e=(0,i.xj)(e,s,u._f,[a]),(0,r.b9)(e,s,u._f)){const t=(0,r.It)(e,s,u._f),n=(0,i.$S)(e,s,u._f,a),o=(0,r.Cb)(n,s,u._f);t&&!o.includes(t)||(e=n)}return e}function ae(e,t,n,a=!1){var s;const{chats:o}=e,r=null===(s=o.byId[t])||void 0===s?void 0:s.lastMessage;return!r||a||r.id===n.id||r.id===n.previousLocalId||n.id>r.id?(0,i.a4)(e,t,{lastMessage:n}):e}function se(e,t){const n=(0,r.Zw)(e,t),a=(0,r.gb)(e,t,u._f);if(!n||!a)return;let s=a.length;for(;s--;){const e=n[a[s]];if(!e.isDeleting)return e}}function oe(e,t,n,s){if(e){t.forEach((t=>{const n=se(s=(0,i.cY)(s,e,t,{isDeleting:!0}),e);n&&(s=ae(s,e,n,!0))})),(0,a.R3)(s),n.requestChatUpdate({chatId:e});const o=[];return t.forEach((t=>{const a=(0,r.hj)(s,e,t);if(!a)return;s=te(s,n,a,!0);const{threadInfo:i}=(0,r.Db)(s,e,a)||{};i&&o.push(i.threadId)})),(0,a.R3)(s),void setTimeout((()=>{(0,a.R3)((0,i.K4)((0,a.Rd)(),e,t)),(0,g.Tw)(o).forEach((t=>{n.requestThreadInfoUpdate({chatId:e,threadId:t})}))}),J)}const o=[];t.forEach((e=>{const t=(0,r.X5)(s,e);if(t){o.push(t);const n=se(s=(0,i.cY)(s,t,e,{isDeleting:!0}),t);n&&(s=ae(s,t,n,!0)),setTimeout((()=>{(0,a.R3)((0,i.K4)((0,a.Rd)(),t,[e]))}),J)}})),(0,a.R3)(s),(0,g.Tw)(o).forEach((e=>{n.requestChatUpdate({chatId:e})}))}(0,a.Q6)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"newMessage":{const{chatId:o,id:c,message:l,shouldForceReply:m}=n;e=ne(e=ee(e,o,c,l),t,l),l.threadInfo&&(e=(0,i.Xg)(e,l.threadInfo.chatId,l.threadInfo.threadId,l.threadInfo)),(0,a.R3)(e);const h=(0,r.hj)(e,o,c);if((0,r.hg)(e,o,l)){var s;if(l.isOutgoing&&(null===(s=l.content)||void 0===s||!s.action)){const n=(0,r.Bt)(e);n&&t.focusMessage({chatId:o,threadId:n.threadId,messageId:l.id,noHighlight:!0,isResizingContainer:!0})}const{threadInfo:n}=(0,r.Db)(e,o,l)||{};n&&t.requestThreadInfoUpdate({chatId:o,threadId:n.threadId}),(0,d.CI)(l)||setTimeout((()=>{let e=(0,a.Rd)();m&&(e=(0,i.pf)(e,o,u._f,"replyingToId",c)),(0,a.R3)(ae(e,o,h))}),J)}else(0,a.R3)(ae((0,a.Rd)(),o,h));(0,r.N)(e,o)||t.loadTopChats();break}case"updateStartEmojiInteraction":{const{chatId:t}=(0,r.Bt)(e)||{};if(e.activeEmojiInteraction||t!==n.id)return;const s=(0,r.CP)(e,n.emoji);e={...e,activeEmojiInteraction:{animatedEffect:s?(0,r.cu)(s):n.emoji,messageId:n.messageId}},(0,a.R3)(e);break}case"newScheduledMessage":{const{chatId:t,id:s,message:o}=n;e=ee(e,t,s,o,!0);const c=(0,r.qy)(e,t)||[];e=(0,i.pf)(e,t,u._f,"scheduledIds",(0,g.Tw)([...c,s])),(0,a.R3)(e);break}case"updateMessage":{var o,c;const{chatId:s,id:d,message:l}=n;if(!(0,r.hj)(e,s,d))return;e=ee(e,s,d,l);const m=(0,r.hj)(e,s,d);l.threadInfo&&(e=(0,i.Xg)(e,l.threadInfo.chatId,l.threadInfo.threadId,l.threadInfo)),e=ae(e,s,m),(0,a.R3)(e);const h=(0,r.Z1)(e,s);h&&!l.isOutgoing&&(null===(o=h.lastMessage)||void 0===o?void 0:o.id)===l.id&&(0,r.xo)(e,h)&&(0,r.hg)(e,s,l)&&(0,r.b9)(e,s,(null===(c=l.threadInfo)||void 0===c?void 0:c.threadId)||u._f)&&t.focusLastMessage();break}case"updateScheduledMessage":{const{chatId:t,id:s,message:o}=n;if(!(0,r.Tm)(e,t,s))return;e=ee(e,t,s,o,!0);const c=Object.keys((0,r.Fn)(e,t)||{}).map(Number).sort(((e,t)=>t-e));e=(0,i.pf)(e,t,u._f,"scheduledIds",c),(0,a.R3)(e);break}case"updateMessageSendSucceeded":{const{chatId:s,localId:o,message:c}=n;e=ne(e,t,c);const d=(0,r.hj)(e,s,o);e=(0,i.K4)(e,s,[o]),c.isScheduled&&(e=(0,i.bV)(e,s,[o])),e=(0,i.cY)(e,s,c.id,{...d,...c,previousLocalId:o});const l=(0,r.hj)(e,s,c.id);e=ae(e,s,l);const u=(0,r.Db)(e,s,c);null!=u&&u.threadInfo&&(t.markMessageListRead({maxId:c.id}),e=(0,i.pf)(e,s,u.threadInfo.threadId,"threadInfo",{...u.threadInfo,lastMessageId:c.id,lastReadInboxMessageId:c.id})),(0,a.R3)(e);break}case"updateScheduledMessageSendSucceeded":{const{chatId:t,localId:s,message:o}=n,c=(0,r.qy)(e,t)||[];e=(0,i.pf)(e,t,u._f,"scheduledIds",[...c,o.id]);const d=(0,r.Tm)(e,t,s);e=(0,i.bV)(e,t,[s]),e=(0,i.P4)(e,t,o.id,{...d,...o,previousLocalId:s}),(0,a.R3)(e);break}case"updatePinnedIds":{const{chatId:t,isPinned:s,messageIds:o}=n,c=(0,r.KB)(e,t)||[],d=s?[...c,...o].sort(((e,t)=>t-e)):c.filter((e=>!o.includes(e)));(0,a.R3)((0,i.pf)(e,t,u._f,"pinnedIds",d));break}case"updateThreadInfo":{const{chatId:t,threadId:s,threadInfo:o,firstMessageId:c}=n,d={...(0,r.tZ)(e,t,s),...o};if(!d.threadId)return;e=(0,i.Xg)(e,t,s,d),c&&(e=(0,i.pf)(e,t,s,"firstMessageId",c)),(0,a.R3)(e);break}case"resetMessages":{const{id:s}=n,o=(0,r.Zw)(e,s);o&&!(0,d.YC)(s)&&(e=(0,i.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;oe(s,a,t,e);break}case"deleteScheduledMessages":{const{ids:t,chatId:s}=n;!function(e,t,n,s){e&&(t.forEach((t=>{s=(0,i.P4)(s,e,t,{isDeleting:!0})})),(0,a.R3)(s),setTimeout((()=>{s=(0,i.bV)((0,a.Rd)(),e,t);const n=(0,r.Fn)(s,e);s=(0,i.pf)(s,e,u._f,"scheduledIds",Object.keys(n||{}).map(Number)),(0,a.R3)(s)}),J))}(s,t,0,e);break}case"deleteHistory":{const{chatId:a}=n,s=e.messages.byChatId[a];s?oe(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,r.X5)(e,t);n&&(e=(0,i.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,i.cY)(e,t,n,o)})),(0,a.R3)(e);break}case"updateMessagePoll":{const{pollId:t,pollUpdate:s}=n,o=(0,r.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,i.cY)(e,o.chatId,o.id,{content:{...o.content,poll:t}}))}break}case"updateMessagePollVote":{const{pollId:t,userId:s,options:o}=n,c=(0,r.ZB)(e,t);if(!c||!c.content.poll||!c.content.poll.results)break;const{poll:d}=c.content,{recentVoterIds:l,totalVoters:u,results:m}=d.results,h=l?[...l]:[],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,i.cY)(e,c.chatId,c.id,{content:{...c.content,poll:{...d,results:{...d.results,recentVoterIds:h,totalVoters:g,results:p}}}}));break}case"updateServiceNotification":{const{message:a}=n;(0,r.UW)(e)&&t.createServiceNotification({message:a});break}case"updateMessageReactions":(0,a.R3)((0,i.cY)(e,n.chatId,n.id,{reactions:n.reactions}))}}));const ie=(0,C.P2)((function(){const e=(0,a.Rd)();(0,a.R3)((0,i.ps)(e,{...e.users.statusesById,...re})),re={}}),3e3,!0);let re={};(0,a.Q6)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"deleteContact":return(0,i.GK)(e,n.id);case"updateUser":return(0,i.Nq)(e,n.id,n.user);case"updateUserStatus":return a=n.userId,s=n.status,re[a]=s,void ie();case"updateUserFullInfo":{const{id:t,fullInfo:a}=n,s=e.users.byId[t];if(!s)return;return(0,i.Nq)(e,t,{fullInfo:{...s.fullInfo,...a}})}}var a,s})),(0,a.Q6)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"updateStickerSet":return(0,i.Rg)(e,n.id,n.stickerSet)}})),(0,a.Q6)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"updatePeerBlocked":return n.isBlocked?(0,i.O4)((0,a.Rd)(),n.id):(0,i.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}})),(0,a.Q6)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"updateNotifySettings":return(0,i.HN)(e,n.peerType,n.isSilent,n.shouldShowPreviews);case"updateNotifyExceptions":{const{chatId:t,isMuted:s,isSilent:o,shouldShowPreviews:r}=n;e.chats.byId[t]&&(e=(0,i.a4)(e,t,{isMuted:s})),(0,a.R3)((0,i.aK)(e,t,{isMuted:s,isSilent:o,shouldShowPreviews:r}));break}}})),(0,a.Q6)("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 ce=n(4446);(0,a.Q6)("apiUpdate",((e,t,n)=>{switch(n["@type"]){case"updateGroupCall":return"discarded"===n.call.connectionState?e.groupCalls.activeGroupCallId?void t.leaveGroupCall({shouldRemove:!0}):(0,ce.dc)(e,n.call.id):(0,ce.AH)(e,n.call.id,(0,g.CE)(n.call,["connectionState"]),void 0,n.call.participantsCount);case"updateGroupCallChatId":{const t=(0,r.Z1)(e,n.chatId);return t&&(e=(0,i.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,ce.B6)(e,t,n.id,n,!!o||i===n.id))})),o&&(e=(0,ce.AH)(e,t,{nextOffset:o})),e}}}));var de=n(8674),le=n(6752),ue=n(1279),me=n(3551),he=n(3227),ge=n(1212),pe=n(5332);function fe(e){(0,o.d4)((()=>(0,C.Gq)(e)),[e])}var Ie=n(9290);const ve=document.querySelector('meta[name="viewport"]'),ye=(null==ve?void 0:ve.getAttribute("content"))||"";function Ze(e){e.preventDefault()}var Pe=n(6590),Ce=n(3989),we=n(7529),be=n(3455),Ee=n(706),Me=n(2255);function Se(){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}var Re=n(9107),ke=n(6917),Te=n(7926),Ne=n(1622),Be=n(3106),Ae=n(8964),xe=n(231),Le=n(9589),Oe=n(9187),Ue=n(3321);const Fe=[0,1,2],$e=(0,o.X$)((0,a.c$)((e=>{const{query:t,fetchingStatus:n,chatId:a,date:s}=e.globalSearch,{currentUserId:o}=e,{byId:i}=e.chats,{animationLevel:c}=e.settings.byKey;return{searchQuery:t,isLoading:!!n&&Boolean(n.chats||n.messages),currentUserId:o,chatsById:i,globalSearchChatId:a,searchDate:s,theme:(0,r.Pu)(e),animationLevel:c}}))((({content:e,contactsFilter:t,onSearchQuery:n,onSelectSettings:i,onSelectContacts:r,onSelectArchived:c,onReset:l,searchQuery:u,isLoading:g,shouldSkipTransition:p,currentUserId:f,globalSearchChatId:I,searchDate:v,theme:y,animationLevel:Z,chatsById:P})=>{const{openChat:C,openTipsChat:w,setGlobalSearchDate:b,setSettingOption:E,setGlobalSearchChatId:M}=(0,a.uC)(),S=(0,Re.Z)(),R=e===m.du.ChatList,k=(0,o.Ye)((()=>v?(0,N.xH)(new Date(1e3*v)):void 0),[v]),T=(0,o.Ye)((()=>R&&P?Object.values(P).reduce(((e,t)=>(0,d.pE)(t)&&t.unreadCount?e+1:e),0):0),[R,P]),B="web.telegram.org"===window.location.hostname,A=(0,o.Ye)((()=>({onTrigger:e,isOpen:t})=>o.ZP.createElement(xe.Z,{round:!0,ripple:R&&!h.wB,size:"smaller",color:"translucent",className:t?"active":"",onClick:R?e:()=>l(),ariaLabel:R?S("AccDescrOpenMenu2"):"Return to chat list"},o.ZP.createElement("div",{className:(0,le.Z)("animated-menu-icon",!R&&"state-back",p&&"no-animation")}))),[R,S,l,p]),x=(0,o.I4)((()=>{u||n("")}),[u,n]),L=(0,o.I4)((()=>{C({id:f,shouldReplaceHistory:!0})}),[f,C]),O=(0,o.I4)((e=>{e.stopPropagation();const t="light"===y?"dark":"light";E({theme:t}),E({shouldUseSystemTheme:!1}),(0,ke.Z)(t,Z===s.zy)}),[Z,E,y]),U=(0,o.I4)((e=>{e.stopPropagation();const t=0===Z?2:0;Fe.forEach(((e,n)=>{document.body.classList.toggle(`animation-level-${n}`,t===n)})),E({animationLevel:t})}),[Z,E]),F=Boolean(I)||e===m.du.GlobalSearch||e===m.du.Contacts,$=e===m.du.Contacts?S("SearchFriends"):S("Search");return o.ZP.createElement("div",{className:"LeftMainHeader"},o.ZP.createElement("div",{id:"LeftMainHeader",className:"left-header"},o.ZP.createElement(Be.Z,{trigger:A,footer:`${s.iC} ${s.Ji}`},o.ZP.createElement(Ae.Z,{icon:"saved-messages",onClick:L},S("SavedMessages")),o.ZP.createElement(Ae.Z,{icon:"archive",onClick:c},o.ZP.createElement("span",{className:"menu-item-name"},S("ArchivedChats")),T>0&&o.ZP.createElement("div",{className:"archived-badge"},T)),o.ZP.createElement(Ae.Z,{icon:"user",onClick:r},S("Contacts")),o.ZP.createElement(Ae.Z,{icon:"settings",onClick:i},S("Settings")),o.ZP.createElement(Ae.Z,{icon:"darkmode",onClick:O},o.ZP.createElement("span",{className:"menu-item-name"},S("lng_menu_night_mode")),o.ZP.createElement(Ue.Z,{id:"darkmode",label:S("dark"===y?"lng_settings_disable_night_theme":"lng_settings_enable_night_theme"),checked:"dark"===y,noAnimation:!0})),o.ZP.createElement(Ae.Z,{icon:"animations",onClick:U},o.ZP.createElement("span",{className:"menu-item-name capitalize"},S("Appearance.Animations").toLowerCase()),o.ZP.createElement(Ue.Z,{id:"animations",label:"Toggle Animations",checked:Z>0})),o.ZP.createElement(Ae.Z,{icon:"help",onClick:()=>{w({langCode:S.code})}},S("TelegramFeatures")),o.ZP.createElement(Ae.Z,{icon:"bug",href:s.mU},"Report Bug"),B&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement(Ae.Z,{icon:"char-K",href:"https://web.telegram.org/k/",onClick:()=>{(0,Te.L)("K"),(0,Ne.W8)(),(0,Pe.Wv)()}},"Switch to K Version"),o.ZP.createElement(Ae.Z,{icon:"char-W",href:"https://web.telegram.org/?legacy=1",onClick:Pe.Wv},"Switch to Old Version"))),o.ZP.createElement(Le.Z,{inputId:"telegram-search-input",parentContainerClassName:"LeftSearch",className:I||v?"with-picker-item":"",value:t||u,focused:F,isLoading:g,placeholder:$,autoComplete:"off",canClose:Boolean(I||v),onChange:n,onReset:l,onFocus:x},k&&o.ZP.createElement(Oe.Z,{icon:"calendar",title:k,canClose:!0,isMinimized:Boolean(I),className:"search-date",onClick:b,clickArg:{date:void 0}}),I&&o.ZP.createElement(Oe.Z,{chatOrUserId:I,onClick:M,canClose:!0,clickArg:{id:void 0}}))))})));var De=n(9204);const je=(0,o.X$)((()=>{const e=(0,Re.Z)();return o.ZP.createElement("div",{id:"ConnectionState",dir:e.isRtl?"rtl":void 0},o.ZP.createElement(De.Z,{color:"black"}),o.ZP.createElement("div",{className:"state-text"},e("WaitingForNetwork")))}));var Qe=n(1174),qe=n(6071),Ge=n(3133),He=n(1080);const _e=(0,o.X$)((0,a.c$)((e=>{const{chats:{listIds:t,byId:n},users:{byId:a},chatFolders:{byId:s,orderedIds:o,activeChatFolder:i},currentUserId:c,lastSyncTime:d,shouldSkipHistoryAnimations:l}=e;return{allListIds:t,chatsById:n,usersById:a,chatFoldersById:s,orderedFolderIds:o,lastSyncTime:d,notifySettings:(0,r.dZ)(e),notifyExceptions:(0,r.NJ)(e),activeChatFolder:i,currentUserId:c,shouldSkipHistoryAnimations:l}}))((({allListIds:e,chatsById:t,usersById:n,chatFoldersById:i,notifySettings:r,notifyExceptions:c,orderedFolderIds:l,activeChatFolder:u,currentUserId:m,lastSyncTime:p,shouldSkipHistoryAnimations:f,foldersDispatch:I,onScreenSelect:v})=>{const{loadChatFolders:y,setActiveChatFolder:Z,openChat:P}=(0,a.uC)(),C=(0,o.sO)(null),w=(0,Re.Z)();(0,o.d4)((()=>{p&&y()}),[p,y]);const b=(0,o.Ye)((()=>l?l.map((e=>i[e]||{})).filter(Boolean):void 0),[i,l]),E=function(a,s,i){const l=(0,qe.Z)(3e3,!0),[u,m]=(0,o.eJ)(),[h,p,f]=(0,Ee.Z)();return(0,de.ZP)(p,f),(0,Ie.Z)((()=>{h||l((()=>{m((()=>{if(!b||!b.length)return;const a=b.map((a=>{const{unreadDialogsCount:s,hasActiveDialogs:o}=(0,d.Fu)(e,t,n,a,r,c)||{};return{id:a.id,badgeCount:s,isBadgeActive:o}}));return(0,g.ee)(a,"id")})())}))}),[...i,h]),u}(0,0,[b,e,t,n,r,c]),M=(0,o.Ye)((()=>{if(b&&b.length)return[{title:"en"===w.code?"All":w("FilterAllChats"),id:s.Nf},...b.map((e=>({title:e.title,...null==E?void 0:E[e.id]})))]}),[b,E,w]),S=(0,o.I4)((e=>{Z(e,{forceOnHeavyAnimation:!0})}),[Z]);(0,o.d4)((()=>{M&&M.length&&u>=M.length&&Z(0)}),[u,M,Z]),(0,o.d4)((()=>{if(C.current&&h.$b&&M&&M.length)return(0,Qe.s)(C.current,{selectorToPreventScroll:".chat-list",onSwipe:(e,t)=>t===Qe.e.Left?(Z(Math.min(u+1,M.length-1),{forceOnHeavyAnimation:!0}),!0):t===Qe.e.Right&&(Z(Math.max(0,u-1),{forceOnHeavyAnimation:!0}),!0)})}),[u,M,Z]);const R=(0,o.sO)();R.current=0!==u,(0,o.d4)((()=>R.current?(0,Ce.Z)((()=>{R.current&&Z(0)})):void 0),[u,Z]),(0,Pe.ZP)(0!==u,(()=>Z(0,{forceOnHeavyAnimation:!0}))),(0,o.d4)((()=>{const e=e=>{if(e.ctrlKey&&e.shiftKey&&e.code.startsWith("Digit")&&M){const[,t]=e.code.match(/Digit(\d)/)||[];if(!t)return;if("0"===t)return void P({id:m,shouldReplaceHistory:!0});const n=Number(t)-1;if(n>M.length-1)return;Z(n,{forceOnHeavyAnimation:!0}),e.preventDefault()}};return document.addEventListener("keydown",e,!0),()=>{document.removeEventListener("keydown",e,!0)}}));const{shouldRender:k,transitionClassNames:T}=(0,ge.Z)(!l,void 0,!0);function N(e){const t=Object.values(i).find((({id:e})=>e===M[u].id));return t&&0!==u?o.ZP.createElement(He.Z,{folderType:"folder",folderId:t.id,isActive:e,onScreenSelect:v,foldersDispatch:I}):o.ZP.createElement(He.Z,{folderType:"all",isActive:e,foldersDispatch:I,onScreenSelect:v})}return o.ZP.createElement("div",{className:"ChatFolders"},null!=M&&M.length?o.ZP.createElement(Ge.Z,{tabs:M,activeTab:u,onSwitchTab:S}):k?o.ZP.createElement("div",{className:(0,le.Z)("tabs-placeholder",T)}):void 0,o.ZP.createElement(Me.Z,{ref:C,name:f?"none":w.isRtl?"slide-optimized-rtl":"slide-optimized",activeKey:u,renderCount:M?M.length:void 0},N))})));var ze=n(9203),Ve=n(8778),Ye=n(4288);const Xe=(0,o.X$)((e=>{const t=(0,Ve.Z)(ze.gl.Extra,"LeftSearch");return t?o.ZP.createElement(t,e):o.ZP.createElement(Ye.Z,null)})),We=(0,o.X$)((e=>{const t=(0,Ve.Z)(ze.gl.Extra,"ContactList");return t?o.ZP.createElement(t,e):o.ZP.createElement(Ye.Z,null)}));var Ke=n(2328);let Je;const et=(0,o.X$)((({isShown:e,onNewPrivateChat:t,onNewChannel:n,onNewGroup:a})=>{const[s,i]=(0,o.eJ)(!1);(0,o.d4)((()=>{e||i(!1)}),[e]);const r=(0,Re.Z)(),c=(0,le.Z)("NewChatButton",e&&"revealed",s&&"menu-is-open"),d=(0,o.I4)((()=>{Je&&(clearTimeout(Je),Je=void 0)}),[]),l=(0,o.I4)((()=>{Je&&(clearTimeout(Je),Je=void 0),Je=window.setTimeout((()=>{i(!1)}),750)}),[]);return o.ZP.createElement("div",{className:c,onMouseEnter:d,onMouseLeave:l},o.ZP.createElement(xe.Z,{round:!0,color:"primary",className:s?"active":"",onClick:()=>{i(!s)},ariaLabel:r(s?"Close":"NewMessageTitle"),tabIndex:-1},o.ZP.createElement("i",{className:"icon-new-chat-filled"}),o.ZP.createElement("i",{className:"icon-close"})),o.ZP.createElement(Ke.Z,{isOpen:s,positionX:"right",positionY:"bottom",autoClose:!0,onClose:()=>{i(!1)}},o.ZP.createElement(Ae.Z,{icon:"channel",onClick:n},r("NewChannel")),o.ZP.createElement(Ae.Z,{icon:"group",onClick:a},r("NewGroup")),o.ZP.createElement(Ae.Z,{icon:"user",onClick:t},r("NewMessageTitle"))))}));var tt=n(126);const nt=Object.keys(m.du).length/2;let at;const st=(0,a.c$)((e=>(0,g.ei)(e,["connectionState"])))((({content:e,searchQuery:t,searchDate:n,contactsFilter:a,shouldSkipTransition:s,foldersDispatch:i,onSearchQuery:r,onContentChange:c,onScreenSelect:d,onReset:l,connectionState:u})=>{const[g,p]=(0,o.eJ)(h.$b),f=!Se()||"connectionStateConnecting"===u,I=(0,o.sO)(!1),v=(0,o.I4)((()=>{c(m.du.Settings)}),[c]),y=(0,o.I4)((()=>{c(m.du.Contacts)}),[c]),Z=(0,o.I4)((()=>{c(m.du.NewChannelStep1)}),[c]),P=(0,o.I4)((()=>{c(m.du.NewGroupStep1)}),[c]),C=(0,o.I4)((()=>{c(m.du.Archived)}),[c]),w=(0,o.I4)((()=>{e===m.du.ChatList&&(I.current=!0,p(!0))}),[e]),b=(0,o.I4)((()=>{I.current=!1,at&&(clearTimeout(at),at=void 0),at=window.setTimeout((()=>{I.current||p(!1)}),250)}),[]);(0,o.d4)((()=>{let t;return e!==m.du.ChatList?t=window.setTimeout((()=>{p(!1)}),250):(I.current||h.$b)&&p(!0),()=>{t&&(clearTimeout(t),t=void 0)}}),[e]);const[E,M,S]=function(){const[e,t]=(0,Ee.Z)(!1);(0,o.d4)((()=>{const e=window.setTimeout(t,2592e5);return()=>{clearTimeout(e)}}),[t]);const{shouldRender:n,transitionClassNames:a}=(0,ge.Z)(e);return[n,a,()=>{window.location.reload()}]}(),R=(0,Re.Z)();return o.ZP.createElement("div",{id:"LeftColumn-main",onMouseEnter:h.$b?void 0:w,onMouseLeave:h.$b?void 0:b},o.ZP.createElement($e,{content:e,contactsFilter:a,onSearchQuery:r,onSelectSettings:v,onSelectContacts:y,onSelectArchived:C,onReset:l,shouldSkipTransition:s}),o.ZP.createElement(tt.Z,{isOpen:f,isCustom:!0,className:"connection-state-wrapper opacity-transition slow"},(()=>o.ZP.createElement(je,null))),o.ZP.createElement(Me.Z,{name:s?"none":"zoom-fade",renderCount:nt,activeKey:e,shouldCleanup:!0,cleanupExceptionKey:m.du.ChatList,className:f?"pull-down":void 0},(s=>{switch(e){case m.du.ChatList:return o.ZP.createElement(_e,{onScreenSelect:d,foldersDispatch:i});case m.du.GlobalSearch:return o.ZP.createElement(Xe,{searchQuery:t,searchDate:n,isActive:s,onReset:l});case m.du.Contacts:return o.ZP.createElement(We,{filter:a,isActive:s,onReset:l});default:return}})),E&&o.ZP.createElement(xe.Z,{fluid:!0,pill:!0,className:(0,le.Z)("btn-update",M),onClick:S},R("lng_update_telegram")),o.ZP.createElement(et,{isShown:g,onNewPrivateChat:y,onNewChannel:Z,onNewGroup:P}))})),ot=(0,o.X$)((e=>{const t=(0,Ve.Z)(ze.gl.Extra,"Settings");return t?o.ZP.createElement(t,e):o.ZP.createElement(Ye.Z,null)})),it=(0,o.X$)((e=>{const t=(0,Ve.Z)(ze.gl.Extra,"NewChat");return t?o.ZP.createElement(t,e):o.ZP.createElement(Ye.Z,null)})),rt=(0,o.X$)((e=>{const t=(0,Ve.Z)(ze.gl.Extra,"ArchivedChats");return t?o.ZP.createElement(t,e):o.ZP.createElement(Ye.Z,null)}));var ct;!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"}(ct||(ct={}));const dt=Object.keys(ct).length/2,lt=(0,o.X$)((0,a.c$)((e=>{const{globalSearch:{query:t,date:n},chatFolders:{activeChatFolder:a},shouldSkipHistoryAnimations:s,leftColumnWidth:o}=e;return{searchQuery:t,searchDate:n,activeChatFolder:a,shouldSkipHistoryAnimations:s,leftColumnWidth:o}}))((({searchQuery:e,searchDate:t,activeChatFolder:n,shouldSkipHistoryAnimations:s,leftColumnWidth:i})=>{const{setGlobalSearchQuery:r,setGlobalSearchChatId:c,resetChatCreation:d,setGlobalSearchDate:l,loadPasswordInfo:u,clearTwoFaError:g,setLeftColumnWidth:p,resetLeftColumnWidth:f}=(0,a.uC)(),I=(0,o.sO)(null),[v,y]=(0,o.eJ)(m.du.ChatList),[Z,P]=(0,o.eJ)(m.MT.Main),[C,w]=(0,o.eJ)(""),[b,E]=(0,be.ZP)(),[M,S]=(0,o.eJ)(0);let R=ct.Main;switch(v){case m.du.Archived:R=ct.Archived;break;case m.du.Settings:R=ct.Settings;break;case m.du.NewChannelStep1:case m.du.NewChannelStep2:R=ct.NewChannel;break;case m.du.NewGroupStep1:case m.du.NewGroupStep2:R=ct.NewGroup}const k=(0,o.I4)((e=>{if(v!==m.du.NewGroupStep2||e)if(v!==m.du.NewChannelStep2||e){if(v===m.du.NewGroupStep1){const e=document.getElementById("new-group-picker-search");e&&e.blur()}if(v===m.du.Settings)switch(Z){case m.MT.EditProfile:case m.MT.Folders:case m.MT.General:case m.MT.Notifications:case m.MT.DataStorage:case m.MT.Privacy:case m.MT.Language:return void P(m.MT.Main);case m.MT.GeneralChatBackground:case m.MT.QuickReaction:return void P(m.MT.General);case m.MT.GeneralChatBackgroundColor:return void P(m.MT.GeneralChatBackground);case m.MT.PrivacyPhoneNumber:case m.MT.PrivacyLastSeen:case m.MT.PrivacyProfilePhoto:case m.MT.PrivacyForwarding:case m.MT.PrivacyGroupChats:case m.MT.PrivacyActiveSessions:case m.MT.PrivacyBlockedUsers:case m.MT.TwoFaDisabled:case m.MT.TwoFaEnabled:case m.MT.TwoFaCongratulations:return void P(m.MT.Privacy);case m.MT.PrivacyPhoneNumberAllowedContacts:case m.MT.PrivacyPhoneNumberDeniedContacts:return void P(m.MT.PrivacyPhoneNumber);case m.MT.PrivacyLastSeenAllowedContacts:case m.MT.PrivacyLastSeenDeniedContacts:return void P(m.MT.PrivacyLastSeen);case m.MT.PrivacyProfilePhotoAllowedContacts:case m.MT.PrivacyProfilePhotoDeniedContacts:return void P(m.MT.PrivacyProfilePhoto);case m.MT.PrivacyForwardingAllowedContacts:case m.MT.PrivacyForwardingDeniedContacts:return void P(m.MT.PrivacyForwarding);case m.MT.PrivacyGroupChatsAllowedContacts:case m.MT.PrivacyGroupChatsDeniedContacts:return void P(m.MT.PrivacyGroupChats);case m.MT.TwoFaNewPassword:return void P(m.MT.TwoFaDisabled);case m.MT.TwoFaNewPasswordConfirm:return void P(m.MT.TwoFaNewPassword);case m.MT.TwoFaNewPasswordHint:return void P(m.MT.TwoFaNewPasswordConfirm);case m.MT.TwoFaNewPasswordEmail:return void P(m.MT.TwoFaNewPasswordHint);case m.MT.TwoFaNewPasswordEmailCode:return void P(m.MT.TwoFaNewPasswordEmail);case m.MT.TwoFaChangePasswordCurrent:case m.MT.TwoFaTurnOff:case m.MT.TwoFaRecoveryEmailCurrentPassword:return void P(m.MT.TwoFaEnabled);case m.MT.TwoFaChangePasswordNew:return void P(m.MT.TwoFaChangePasswordCurrent);case m.MT.TwoFaChangePasswordConfirm:return void P(m.MT.TwoFaChangePasswordNew);case m.MT.TwoFaChangePasswordHint:return void P(m.MT.TwoFaChangePasswordConfirm);case m.MT.TwoFaRecoveryEmail:return void P(m.MT.TwoFaRecoveryEmailCurrentPassword);case m.MT.TwoFaRecoveryEmailCode:return void P(m.MT.TwoFaRecoveryEmail);case m.MT.FoldersCreateFolder:case m.MT.FoldersEditFolder:return void P(m.MT.Folders);case m.MT.FoldersIncludedChatsFromChatList:case m.MT.FoldersExcludedChatsFromChatList:return void P(m.MT.FoldersEditFolderFromChatList);case m.MT.FoldersEditFolderFromChatList:return y(m.du.ChatList),void P(m.MT.Main)}v!==m.du.ChatList||0!==n?(y(m.du.ChatList),w(""),r({query:""}),l({date:void 0}),c({id:void 0}),d(),setTimeout((()=>{S(Date.now())}),250)):y(m.du.GlobalSearch)}else y(m.du.NewChannelStep1);else y(m.du.NewGroupStep1)}),[v,n,Z,r,l,c,d]),T=(0,o.I4)((t=>{v!==m.du.Contacts?(y(m.du.GlobalSearch),t!==e&&r({query:t})):w(t)}),[v,e,r]);(0,o.d4)((()=>v!==m.du.ChatList||0===n?(0,Ce.Z)((()=>k())):void 0),[n,v,k]),(0,o.d4)((()=>{if(v!==m.du.GlobalSearch)return document.addEventListener("keydown",e,!1),()=>{document.removeEventListener("keydown",e,!1)};function e(e){(h.jm&&e.metaKey||!h.jm&&e.ctrlKey)&&e.shiftKey&&"f"===(0,we.Z)(e)&&(e.preventDefault(),y(m.du.GlobalSearch))}}),[v]),(0,o.d4)((()=>{g(),Z===m.MT.Privacy&&u()}),[g,u,Z]);const{initResize:N,resetResize:B,handleMouseUp:A}=((e,t,n,a)=>{const[s,i,r]=(0,Ee.Z)(),[c,d]=(0,o.eJ)(),[l,u]=(0,o.eJ)();(0,o.d4)((()=>{e.current&&a&&(e.current.style.width=`${a}px`)}),[e,a]);const m=()=>{document.body.classList.remove("no-selection","cursor-ew-resize")};return(0,o.d4)((()=>{if(!s)return;const n=t=>{const n=Math.ceil(l+t.clientX-c);e.current.style.width=`${n}px`},a=()=>{m(),document.removeEventListener("mousemove",n,!1),document.removeEventListener("mouseup",a,!1),document.removeEventListener("blur",a,!1),t(e.current.offsetWidth),r()};document.addEventListener("mousemove",n,!1),document.addEventListener("mouseup",a,!1),document.addEventListener("blur",a,!1)}),[l,c,e,t,s,r]),{initResize:t=>{document.body.classList.add("no-selection","cursor-ew-resize"),d(t.clientX),u(e.current.offsetWidth),i()},resetResize:t=>{t.preventDefault(),e.current.style.width="",n()},handleMouseUp:m}})(I,p,f,i),x=e=>{y(m.du.Settings),P(e)};return o.ZP.createElement("div",{id:"LeftColumn",ref:I},o.ZP.createElement(Me.Z,{name:s?"none":h.s0,renderCount:dt,activeKey:R,shouldCleanup:!0,cleanupExceptionKey:ct.Main},(n=>{switch(R){case ct.Archived:return o.ZP.createElement(rt,{isActive:n,onReset:k,onContentChange:y});case ct.Settings:return o.ZP.createElement(ot,{isActive:n,currentScreen:Z,foldersState:b,foldersDispatch:E,onScreenSelect:x,onReset:k,shouldSkipTransition:s});case ct.NewChannel:return o.ZP.createElement(it,{key:M,isActive:n,isChannel:!0,content:v,onContentChange:y,onReset:k});case ct.NewGroup:return o.ZP.createElement(it,{key:M,isActive:n,content:v,onContentChange:y,onReset:k});default:return o.ZP.createElement(st,{content:v,searchQuery:e,searchDate:t,contactsFilter:C,foldersDispatch:E,onContentChange:y,onSearchQuery:T,onScreenSelect:x,onReset:k,shouldSkipTransition:s})}})),o.ZP.createElement("div",{className:"resize-handle",onMouseDown:N,onMouseUp:A,onDoubleClick:B}))})));var ut=n(2420),mt=n(5780),ht=n(9524),gt=n(1394);const pt=()=>{const[e,t]=(0,o.eJ)(Y.Z.get());return(0,o.d4)((()=>{const e=(0,C.P2)((()=>{t(Y.Z.get())}),250,!1);return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]),e};var ft=n(2678),It=n(7204),vt=n(5326),yt=n(3570),Zt=n(5790),Pt=n(8360),Ct=n(2155),wt=n(6058),bt=n(8799);const Et=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Ve.Z)(ze.gl.Extra,"HeaderMenuContainer",!t);return n?o.ZP.createElement(n,e):void 0})),Mt=(0,o.X$)((0,a.c$)(((e,{chatId:t,threadId:n,messageListType:a})=>{var s;const o=(0,r.Z1)(e,t),i=Boolean(o&&(0,d.eA)(o));if(!o||o.isRestricted||(0,r.CA)(e))return{noMenu:!0};const c=(0,r.IK)(e,t),l=(0,r.FM)(e,t),m="thread"===a&&n===u._f,g="thread"===a&&n!==u._f,p=(0,r.Jf)(e),f=Boolean(c&&(0,r.s4)(e,c.id)),I=!f&&Boolean((0,r.pk)(e,t)),v=Boolean(m&&(i||(0,d.ZV)(o))&&o.isNotJoined);return{noMenu:!1,isChannel:i,isRightColumnShown:p,canStartBot:I,canRestartBot:f,canSubscribe:v,canSearch:m||g,canCall:h.Bi&&(0,d.YC)(o.id)&&!l&&!c,canMute:m&&!l&&!v,canLeave:m&&!v,canEnterVoiceChat:h.Bi&&o.isCallActive,canCreateVoiceChat:h.Bi&&!o.isCallActive&&((null===(s=o.adminRights)||void 0===s?void 0:s.manageCall)||o.isCreator&&(0,d.G9)(o))}}))((({chatId:e,threadId:t,noMenu:n,isChannel:s,canStartBot:i,canRestartBot:r,canSubscribe:c,canSearch:d,canCall:l,canMute:u,canLeave:m,canEnterVoiceChat:g,canCreateVoiceChat:p,isRightColumnShown:f,canExpandActions:I})=>{const{joinChannel:v,sendBotCommand:y,openLocalTextSearch:Z,restartBot:P,openCallFallbackConfirm:C}=(0,a.uC)(),w=(0,o.sO)(null),[b,E]=(0,o.eJ)(!1),[M,S]=(0,o.eJ)(void 0),R=(0,o.I4)((()=>{E(!0);const e=w.current.getBoundingClientRect();S({x:e.right,y:e.bottom})}),[]),k=(0,o.I4)((()=>{E(!1)}),[]),T=(0,o.I4)((()=>{S(void 0)}),[]),N=(0,o.I4)((()=>{v({chatId:e})}),[v,e]),B=(0,o.I4)((()=>{y({command:"/start"})}),[y]),A=(0,o.I4)((()=>{P({chatId:e})}),[e,P]),x=(0,o.I4)((()=>{Z(),h.wB?document.querySelector("#MobileSearch input").focus():setTimeout((()=>{const e=document.querySelector(".RightHeader .SearchInput input");e&&e.focus()}),400)}),[Z]);(0,o.d4)((()=>{if(d)return document.addEventListener("keydown",e,!1),()=>{document.removeEventListener("keydown",e,!1)};function e(e){h.fl&&(h.jm&&e.metaKey||!h.jm&&e.ctrlKey)&&!e.shiftKey&&"f"===(0,we.Z)(e)&&(e.preventDefault(),x())}}),[d,x]);const L=(0,Re.Z)();return o.ZP.createElement("div",{className:"HeaderActions"},!h.wB&&o.ZP.createElement(o.ZP.Fragment,null,I&&c&&o.ZP.createElement(xe.Z,{size:"tiny",ripple:!0,fluid:!0,onClick:N},L(s?"ProfileJoinChannel":"ProfileJoinGroup")),I&&i&&o.ZP.createElement(xe.Z,{size:"tiny",ripple:!0,fluid:!0,onClick:B},L("BotStart")),I&&r&&o.ZP.createElement(xe.Z,{size:"tiny",ripple:!0,fluid:!0,onClick:A},L("BotRestart")),d&&o.ZP.createElement(xe.Z,{round:!0,ripple:f,color:"translucent",size:"smaller",onClick:x,ariaLabel:"Search in this chat"},o.ZP.createElement("i",{className:"icon-search"})),l&&o.ZP.createElement(xe.Z,{round:!0,color:"translucent",size:"smaller",onClick:C,ariaLabel:"Call"},o.ZP.createElement("i",{className:"icon-phone"}))),o.ZP.createElement(xe.Z,{ref:w,className:b?"active":"",round:!0,ripple:!h.wB,size:"smaller",color:"translucent",disabled:n,ariaLabel:"More actions",onClick:R},o.ZP.createElement("i",{className:"icon-more"})),M&&o.ZP.createElement(Et,{chatId:e,threadId:t,isOpen:b,anchor:M,withExtraActions:h.wB||!I,isChannel:s,canStartBot:i,canRestartBot:r,canSubscribe:c,canSearch:d,canCall:l,canMute:u,canLeave:m,canEnterVoiceChat:g,canCreateVoiceChat:p,onSubscribeChannel:N,onSearchClick:x,onClose:k,onCloseAnimationEnd:T}))})));var St=n(4399),Rt=n(2340),kt=n(6202),Tt=n(862);function Nt(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)(Tt.Hu),l=null==e?void 0:e.id;return(0,o.bt)((()=>{i&&(0,Tt.p6)(`b64-${l}`,n).then(c).catch((e=>{s.eM&&console.error(e)}))}),[l,i,n]),i?r:n}var Bt=n(7551),At=n(8512);function xt(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 Lt=(0,o.X$)((({count:e,index:t})=>{const n=(0,o.sO)(null),a=(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}`;return{markHeight:s,clipPath:function(e,t,n){let a="";if(3===n)a=xt(0,0,2,t,1)+xt(0,12,2,t+1,1)+xt(0,25,2,t,1);else for(let e=0;e<n;e++)a+=xt(0,(t+2)*e,2,t,1);return`<clipPath id="${e}">\n <path d="${a}" />\n </clipPath>`}(i,a,e),markTranslateY: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),trackTranslateY: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),trackHeight:o,clipPathId:i}}(e,t)),[e,t]);if((0,o.d4)((()=>{if(!n.current)return;const{trackHeight:e,trackTranslateY:t,markHeight:s,markTranslateY:o,clipPathId:i,clipPath:r}=a,c=n.current.firstElementChild;if(null!=n&&n.current){const a=n.current,{style:d}=a;d.height=`${e}px`,d.transform=`translateY(-${t}px)`,d.clipPath=`url("#${i}")`;const l=a.querySelector("svg"),u=a.querySelector("div"),m=a.querySelector("defs");l||c&&(c.innerHTML=`<svg height="0" width="0"><defs> ${r} </defs></svg>`),m&&(m.innerHTML=r),u&&(u.style.height=`${s}px`,u.style.transform=`translateY(${o}px)`)}}),[a]),1===e)return o.ZP.createElement("div",{className:"pinned-message-border"},o.ZP.createElement("div",{className:"pinned-message-border-wrapper-1",ref:n}));const{trackHeight:s,trackTranslateY:i,markHeight:r,markTranslateY:c,clipPathId:d}=a;return o.ZP.createElement("div",{className:(0,le.Z)("pinned-message-border",e>4&&"pinned-message-border-mask")},o.ZP.createElement("div",{className:"pinned-message-border-wrapper",ref:n,style:`clip-path: url("#${d}"); width: 2px;\n height: ${s}px; transform: translateY(-${i}px);`},o.ZP.createElement("span",null),o.ZP.createElement("div",{className:"pinned-message-border-mark",style:`height: ${r}px; transform: translateY(${c}px);`})))})),Ot=(0,o.X$)((({message:e,count:t,index:n,customTitle:a,className:s,onUnpinMessage:i,onClick:r,onAllPinnedClick:c})=>{const l=(0,Re.Z)(),u=Nt(e),m=(0,kt.Z)((0,d.Ti)(e,"pictogram")),h=(0,d.MK)(l,e,Boolean(u)),[g,p,f]=(0,Ee.Z)(),I=(0,o.I4)((()=>{f(),i&&i(e.id)}),[f,i,e.id]);return o.ZP.createElement("div",{className:(0,le.Z)("HeaderPinnedMessage-wrapper",s)},t>1&&o.ZP.createElement(xe.Z,{round:!0,size:"smaller",color:"translucent",className:"pin-list-button",ariaLabel:l("EventLogFilterPinnedMessages"),onClick:c},o.ZP.createElement("i",{className:"icon-pin-list"})),i&&o.ZP.createElement(xe.Z,{round:!0,size:"smaller",color:"translucent",ariaLabel:l("UnpinMessageAlertTitle"),className:"unpin-button",onClick:p},o.ZP.createElement("i",{className:"icon-close"})),o.ZP.createElement(Bt.Z,{isOpen:g,onClose:f,text:"Would you like to unpin this message?",confirmLabel:"Unpin",confirmHandler:I}),o.ZP.createElement("div",{className:"HeaderPinnedMessage",onClick:r,dir:l.isRtl?"rtl":void 0},o.ZP.createElement(Lt,{count:t,index:n}),u&&function(e,t){const{width:n,height:a}=(0,St.W7)();return o.ZP.createElement("img",{src:t||e,width:n,height:a,alt:""})}(u,m),o.ZP.createElement("div",{className:"message-text"},o.ZP.createElement("div",{className:"title",dir:"auto"},a||`${l("PinnedMessage")} ${n>0?"#"+(t-n):""}`),o.ZP.createElement("p",{dir:"auto"},(0,Rt.Z)(h))),o.ZP.createElement(At.Z,null)))}));var Ut=n(396),Ft=n(4532),$t=n(3186),Dt=n(663);function jt(e,t,n="image/png"){const a=e instanceof Blob?URL.createObjectURL(e):e,s=new Image;return new Promise((o=>{s.onload=()=>{Qt(s,s.width*t,s.height*t,n).then((e=>URL.createObjectURL(e))).then(o).finally((()=>{e instanceof Blob&&URL.revokeObjectURL(a)}))},s.src=a}))}async function Qt(e,t,n,a="image/png"){if(!("createImageBitmap"in window))return qt(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 qt(e,t,n,void 0,a)}}function qt(e,t,n,a=.5,s="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)}))}var Gt=n(4524);const Ht={width:200,height:200},_t=115,zt=(e,t,n)=>{const{audio:a,voice:s}=(0,d.qp)(e),i=a?a.title||a.fileName:s?"Voice message":"",r=a&&a.performer||t&&(0,d.OU)(Dt.i0,t),c=n&&(0,d.U)(Dt.i0,n)||"Telegram",l=a&&(0,d.MR)(a)&&(0,d.Ti)(e,"pictogram"),u=t&&(0,d.RT)(t,"big"),m=a&&l||s&&u,h=(0,kt.Z)(m),g=(0,o.Ye)((()=>function(e,t,n){if(!n)return Ht;if(e){if(!e.thumbnailSizes||0===e.thumbnailSizes.length)return;return e.thumbnailSizes.find((e=>"m"===e.type))||e.thumbnailSizes[0]}return t?St.vY:void 0}(a,s,h)),[a,h,s]),{result:p}=((e,t,n)=>{const[a,s]=(0,o.eJ)(!1),[i,r]=(0,o.eJ)(),[c,d]=(0,o.eJ)(n);return(0,o.d4)((()=>{s(!0);let e=!1;return function(e,t){if(!e)return Promise.resolve(Gt);if(!t)return function(e,t,n,a="image/png"){const s=e instanceof Blob?URL.createObjectURL(e):e,o=new Image;return new Promise((i=>{o.onload=()=>{Qt(o,t,n,a).then((e=>URL.createObjectURL(e))).then(i).finally((()=>{e instanceof Blob&&URL.revokeObjectURL(s)}))},o.src=s}))}(e,_t,_t);const n=Math.min(t.width,t.height);return n<_t?jt(e,_t/n):Promise.resolve(e)}(h,g).then((t=>{e||(s(!1),d(t))}),(t=>{e||(s(!1),r(t))})),()=>{e=!0}}),t),{isLoading:a,error:i,result:c}})(0,[h,g],Gt);return(0,o.Ye)((()=>(0,Ft.Of)({title:i,artist:r,album:c,artwork:[{src:p}]})),[c,r,i,p])};var Vt=n(8051);const Yt=(0,a.c$)(((e,{message:t})=>{const n=(0,r.Ur)(e,t),a=(0,r.Z1)(e,t.chatId),{volume:s,playbackRate:o,isMuted:i}=e.audioPlayer;return{sender:n,chat:a,volume:s,playbackRate:o,isMuted:i}}))((({message:e,className:t,noUi:n,sender:s,chat:i,volume:r,playbackRate:c,isMuted:l})=>{const{setAudioPlayerVolume:u,setAudioPlayerPlaybackRate:m,setAudioPlayerMuted:g,focusMessage:p,closeAudioPlayer:f}=(0,a.uC)(),I=(0,Re.Z)(),{audio:v,voice:y,video:Z}=(0,d.qp)(e),P=Boolean(y||Z),C=s?(0,d.OU)(I,s):void 0,w=G.UV((0,d.Ti)(e,"inline")),b=zt(e,s,i),{playPause:E,stop:M,isPlaying:S,requestNextTrack:R,requestPreviousTrack:k,isFirst:T,isLast:N,setVolume:B,toggleMuted:A,setPlaybackRate:x}=(0,$t.Z)((0,Ut.An)(e),(0,d.XV)(e),P?"voice":"audio",w,void 0,b,void 0,!0,void 0,void 0,(0,d.CI)(e),!0),L=P&&S;(0,o.d4)((()=>{if(L)return Y.Z.disableRefresh(),()=>{Y.Z.enableRefresh()}}),[L]);const O=(0,o.I4)((()=>{p({chatId:e.chatId,messageId:e.id})}),[p,e.chatId,e.id]),U=(0,o.I4)((()=>{S&&E(),f(),(0,Ft.Ay)(),M()}),[f,S,E,M]),F=(0,o.I4)((e=>{u({volume:e/100}),g({isMuted:!1}),B(e/100)}),[g,u,B]),$=(0,o.I4)((()=>{h.$b&&!h.cj||(A(),g({isMuted:!l}))}),[l,g,A]),D=(0,o.I4)((()=>{1===c?(x(1.8),m({playbackRate:1.8})):(x(1),m({playbackRate:1}))}),[c,m,x]),j=(0,o.Ye)((()=>0===r||l?"icon-muted":r<.3?"icon-volume-1":r<.6?"icon-volume-2":"icon-volume-3"),[r,l]);if(!n)return o.ZP.createElement("div",{className:(0,le.Z)("AudioPlayer",t),dir:I.isRtl?"rtl":void 0},o.ZP.createElement(xe.Z,{round:!0,ripple:!h.wB,color:"translucent",size:"smaller",className:"player-button",disabled:T(),onClick:k,ariaLabel:"Previous track"},o.ZP.createElement("i",{className:"icon-skip-previous"})),o.ZP.createElement(xe.Z,{round:!0,ripple:!h.wB,color:"translucent",size:"smaller",className:(0,le.Z)("toggle-play","player-button",S?"pause":"play"),onClick:E,ariaLabel:S?"Pause audio":"Play audio"},o.ZP.createElement("i",{className:"icon-play"}),o.ZP.createElement("i",{className:"icon-pause"})),o.ZP.createElement(xe.Z,{round:!0,ripple:!h.wB,color:"translucent",size:"smaller",className:"player-button",disabled:N(),onClick:R,ariaLabel:"Next track"},o.ZP.createElement("i",{className:"icon-skip-next"})),o.ZP.createElement("div",{className:"AudioPlayer-content",onClick:O},v?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,Rt.Z)(t||a)),n&&o.ZP.createElement("div",{className:"subtitle",dir:"auto"},(0,Rt.Z)(n)))}(v):function(e,t){return o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("div",{className:"title",dir:"auto"},t&&(0,Rt.Z)(t)),o.ZP.createElement("div",{className:"subtitle",dir:"auto"},e))}(I("AttachAudio"),C),o.ZP.createElement(At.Z,null)),o.ZP.createElement(xe.Z,{round:!0,className:"player-button volume-button",color:"translucent",size:"smaller",ariaLabel:"Volume",withClickPropagation:!0},o.ZP.createElement("i",{className:j,onClick:$}),!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(Vt.Z,{value:l?0:100*r,onChange:F})))),P&&o.ZP.createElement(xe.Z,{round:!0,className:(0,le.Z)("playback-button",1!==c&&"applied"),color:"translucent",size:"smaller",ariaLabel:"Playback Rate",ripple:!h.wB,onClick:D},o.ZP.createElement("span",{className:"playback-button-inner"},"2Х")),o.ZP.createElement(xe.Z,{round:!0,className:"player-close",color:"translucent",size:"smaller",onClick:U,ariaLabel:"Close player"},o.ZP.createElement("i",{className:"icon-close"})))}));var Xt=n(2607),Wt=n(172);const Kt=(0,o.X$)((0,a.c$)(((e,{chatId:t})=>{const n=(0,r.Z1)(e,t),a=(0,Xt.Bj)(e,t);return{groupCall:a,usersById:e.users.byId,chatsById:e.chats.byId,activeGroupCallId:e.groupCalls.activeGroupCallId,isActive:(a?a.participantsCount>0&&a.isLoaded:n&&n.isCallNotEmpty&&n.isCallActive)&&e.groupCalls.activeGroupCallId!==(null==a?void 0:a.id)}}))((({chatId:e,isActive:t,groupCall:n,hasPinnedOffset:s,usersById:i,chatsById:r})=>{const{joinGroupCall:c,subscribeToGroupCallUpdates:d}=(0,a.uC)(),l=(0,Re.Z)(),u=(0,o.I4)((()=>{c({chatId:e})}),[c,e]),m=null==n?void 0:n.participants,h=(0,o.Ye)((()=>m?Object.values(m).filter(((e,t)=>t<3)).map((({id:e,isUser:t})=>{if(t){if(!i[e])return;return{user:i[e]}}if(r[e])return{chat:r[e]}})).filter(Boolean):[]),[r,m,i]);if((0,o.d4)((()=>{if(null!=n&&n.id&&(t||!n.isLoaded))return d({id:n.id,subscribed:!0}),()=>{d({id:n.id,subscribed:!1})}}),[null==n?void 0:n.id,null==n?void 0:n.isLoaded,t,d]),n)return o.ZP.createElement("div",{className:(0,le.Z)("GroupCallTopPane",s&&"has-pinned-offset",!t&&"is-hidden"),onClick:u},o.ZP.createElement("div",{className:"info"},o.ZP.createElement("span",{className:"title"},l("VoipGroupVoiceChat")),o.ZP.createElement("span",{className:"participants"},l("Participants",n.participantsCount||0,"i"))),o.ZP.createElement("div",{className:"avatars"},h.map((e=>{if(e)return e.user?o.ZP.createElement(Wt.Z,{key:e.user.id,user:e.user}):o.ZP.createElement(Wt.Z,{key:e.chat.id,chat:e.chat})}))),o.ZP.createElement(xe.Z,{round:!0,className:"join"},l("VoipChatJoin")))}))),Jt=(0,o.X$)((0,a.c$)(((e,{chatId:t,threadId:n,messageListType:a})=>{const{isLeftColumnShown:s,lastSyncTime:o,shouldSkipHistoryAnimations:i}=e,{byId:c}=e.chats,d=(0,r.Z1)(e,t),{typingStatus:l}=d||{},{chatId:m,messageId:h}=e.audioPlayer,g=m&&h?(0,r.hj)(e,m,h):void 0;let p;if("pinned"===a){const n=(0,r.KB)(e,t);p=null==n?void 0:n.length}else if("scheduled"===a){const n=(0,r.qy)(e,t);p=null==n?void 0:n.length}else if("thread"===a&&n!==u._f){const a=(0,r.tZ)(e,t,n);p=(null==a?void 0:a.messagesCount)||0}const f={typingStatus:l,isLeftColumnShown:s,isRightColumnShown:(0,r.Jf)(e),isSelectModeActive:(0,r.CA)(e),audioMessage:g,chat:d,chatsById:c,messagesCount:p,isChatWithSelf:(0,r.FM)(e,t),isChatWithBot:d&&(0,r.xo)(e,d),lastSyncTime:o,shouldSkipHistoryAnimations:i,currentTransitionKey:Math.max(0,e.messages.messageLists.length-1),connectionState:e.connectionState},I=(0,r.Zw)(e,t);if("thread"!==a||!I)return f;if(Object.assign(f,{messagesById:I}),n!==u._f){const a=(0,r.qS)(e,t,n),s=a?(0,r.hj)(e,t,a):void 0,o=s?(0,r.cv)(e,s):void 0;return{...f,pinnedMessageIds:a,canUnpin:!1,topMessageSender:o}}const v=(0,r.KB)(e,t);if(null!=v&&v.length){const t=I[v[0]],{canUnpin:a}=t&&(0,r._k)(e,t,n)||{};return{...f,pinnedMessageIds:v,canUnpin:a}}return f}))((({chatId:e,threadId:t,messageListType:n,isReady:i,pinnedMessageIds:c,messagesById:l,canUnpin:m,topMessageSender:g,typingStatus:p,isSelectModeActive:f,isLeftColumnShown:I,isRightColumnShown:v,audioMessage:y,chat:Z,chatsById:P,messagesCount:C,isChatWithSelf:w,isChatWithBot:b,lastSyncTime:E,shouldSkipHistoryAnimations:M,currentTransitionKey:S,connectionState:R})=>{const{openChatWithInfo:k,pinMessage:T,focusMessage:N,openChat:B,openPreviousChat:A,loadPinnedMessages:x,toggleLeftColumn:L,exitMessageSelectMode:O}=(0,a.uC)(),U=(0,Re.Z)(),F=(0,o.sO)(!0),[$,D]=(0,o.eJ)(0),j=Array.isArray(c)?c[$]:c,Q=l&&j?l[j]:void 0,q=Array.isArray(c)?c.length:c?1:void 0,G=Z&&(0,d.U)(U,Z).length,H=g?(0,d.OU)(U,g):void 0;(0,o.d4)((()=>{t===u._f&&E&&i&&x({chatId:e})}),[e,x,E,t,i]),(0,o.d4)((()=>{D(0)}),[c]),(0,Zt.Z)(e,j,Q);const{width:_}=pt(),z=_<=s.ks,V=h.p7&&I,Y=(0,o.sO)(null),X=(0,o.sO)(!0),W=(0,o.I4)((()=>{k({id:e})}),[k,e]),K=(0,o.I4)((t=>{T({chatId:e,messageId:t,isUnpin:!0})}),[T,e]),J=(0,o.I4)((()=>{if(Q){N({chatId:Q.chatId,threadId:t,messageId:Q.id});const e=(0,yt.Z)(q||1,$+1);D(e)}}),[Q,N,t,q,$]),ee=(0,o.I4)((()=>{B({id:e,threadId:u._f,type:"pinned"})}),[B,e]),te=(0,o.I4)((()=>{setTimeout((()=>{F.current=!0}),450)}),[]),ne=(0,o.I4)((e=>{if(F.current){if(F.current=!1,h.wB){const e=document.getElementById(s.R2);e&&e.blur()}if(f)return O(),void te();if(t===u._f&&"thread"===n&&0===S)return h.wB||V?(e.stopPropagation(),B({id:void 0})):L(),void te();A(),te()}}),[t,n,S,f,A,V,B,L,O,te]),ae=(0,o.Ye)((()=>{if(z&&P)return(0,r.A1)((0,a.Rd)())||void 0}),[z,P]),se=_>=s.ks&&_<s.jT||_>s.l3&&_<s.ks&&(!G||G>30),oe=se||_>s._m&&_<s.QU,{shouldRender:ie,transitionClassNames:re}=(0,ge.Z)(Boolean(y)),ce=(0,Pt.Z)(y),{shouldRender:de,transitionClassNames:ue}=(0,ge.Z)(Boolean(Q)),me=(0,Pt.Z)(Q,!0),he=(0,Pt.Z)(q,!0),pe=(0,Pt.Z)(m,!0),fe=(0,Pt.Z)(H),Ie=de&&me||ie&&ce;(0,o.d4)((()=>{const e=Y.current;if(e)return oe&&Ie?void(v||se?(X.current&&(e.classList.add("tools-stacked","animated"),X.current=!1),setTimeout((()=>{e.classList.remove("animated")}),350)):(e.classList.remove("tools-stacked"),X.current=!0)):(e.classList.remove("tools-stacked","animated"),void(X.current=!0))}),[oe,Ie,se,v]);const ve=(!Se()||"connectionStateConnecting"===R)&&(h.wB||h.p7&&!V);function ye(){return ve?o.ZP.createElement(o.ZP.Fragment,null,Ze(),o.ZP.createElement("h3",null,U("WaitingForNetwork"))):"thread"===n&&t===u._f?o.ZP.createElement(o.ZP.Fragment,null,(z||S>0)&&Ze(V,!0),o.ZP.createElement("div",{className:"chat-info-wrapper",onClick:W},(0,d.YC)(e)?o.ZP.createElement(wt.Z,{userId:e,typingStatus:p,withFullInfo:b,withMediaViewer:!0,withUpdatingStatus:!0,noRtl:!0}):o.ZP.createElement(bt.Z,{chatId:e,typingStatus:p,noRtl:!0,withMediaViewer:!0,withFullInfo:!0,withUpdatingStatus:!0}))):"thread"===n?o.ZP.createElement(o.ZP.Fragment,null,Ze(),o.ZP.createElement("h3",null,U("CommentsCount",C,"i"))):"pinned"===n?o.ZP.createElement(o.ZP.Fragment,null,Ze(),o.ZP.createElement("h3",null,U("PinnedMessagesCount",C,"i"))):"scheduled"===n?o.ZP.createElement(o.ZP.Fragment,null,Ze(),o.ZP.createElement("h3",null,w?U("Reminders"):U("messages",C,"i"))):void 0}function Ze(e=!1,t=!1){return o.ZP.createElement("div",{className:"back-button"},o.ZP.createElement(xe.Z,{round:!0,size:"smaller",color:"translucent",onClick:ne,ariaLabel:U(e?"Close":"Back")},o.ZP.createElement("div",{className:(0,le.Z)("animated-close-icon",!e&&"state-back")})),t&&ae&&o.ZP.createElement("div",{className:"unread-count active"},(0,Ct.bi)(ae)))}const Pe=Boolean(ie&&ce);return o.ZP.createElement("div",{className:"MiddleHeader",ref:Y},o.ZP.createElement(Me.Z,{name:M?"none":"slide-fade",activeKey:ve?1/0:S},ye),o.ZP.createElement(Kt,{hasPinnedOffset:de&&!!me||ie&&!!ce,chatId:e}),de&&me&&o.ZP.createElement(Ot,{key:e,message:me,count:he||0,index:$,customTitle:fe,className:(0,le.Z)(ue,Pe&&"full-width"),onUnpinMessage:pe?K:void 0,onClick:J,onAllPinnedClick:ee}),o.ZP.createElement("div",{className:"header-tools"},Pe&&o.ZP.createElement(Yt,{key:(0,d.Tp)(ce),message:ce,className:re}),o.ZP.createElement(Mt,{chatId:e,threadId:t,messageListType:n,canExpandActions:!Pe})))})));var en=n(2645),tn=n(274);function nn(e){return"albumId"in e}function an(e,t){let n,a=[],s={originalDate:e[0].date,datetime:Number((0,N.$Y)(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=Number((0,N.$Y)(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),on=n(2202);var rn=n(7675),cn=n(539),dn=n(2357),ln=n(3657);const un=h.wZ?1e3:350,mn=h.wB?300:500;var hn=n(7240),gn=n(935);function pn(e){return"number"==typeof e}function fn(e,t){return e?t?238:175:t?238:100}function In(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,St.Eh)(s,n,a,i,t):(0,St.GC)(o,n,a,t),l=fn(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 vn(e,t){return e.reduce(((e,t)=>e+t),t)}function yn(e,t,n){return e<t?t:e>n?n:e}function Zn(e){const t={width:0,height:0};return e.forEach((({dimensions:e,sides:n})=>{2&n&&(t.width=e.width+e.x),4&n&&(t.height=e.height+e.y)})),t}function Pn(e,t,n,a){const s=function(e){return e.map((e=>{const t=In(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)),d=(0,St.kc)(e,t,!1,n)-(t?2.5:0)*St.Gw;let l;const u={ratios:s,proportions:o,averageRatio:i,maxWidth:d,minWidth:100,maxHeight:d,spacing:2};return l=r>=5||c?function({ratios:e,averageRatio:t,maxWidth:n,minWidth:a,spacing:s,maxHeight:o=4*n/3}){const i=function(e,t){return e.map((e=>t>1.1?yn(e,1,2.75):yn(e,.6667,1)))}(e,t),r=e.length,c=new Array(r),d=[],l=e=>{const t=[];let a=0;e.forEach((e=>{t.push(((e,t)=>{const a=vn(i.slice(e,e+t),0);return(n-(t-1)*s)/a})(a,e)),a+=e})),d.push({lineCounts:e,heights:t})};for(let e=1;e!==r;++e){const t=r-e;e<=3&&t<=3&&l([e,t])}for(let e=1;e!==r-1;++e)for(let n=1;n!==r-e;++n){const a=r-e-n;e<=3&&n<=(t<.85?4:3)&&a<=3&&l([e,n,a])}for(let e=1;e!==r-1;++e)for(let t=1;t!==r-e;++t)for(let n=1;n!==r-e-t;++n){const a=r-e-t-n;e<=3&&t<=3&&n<=3&&a<=4&&l([e,t,n,a])}let u,m=0;for(let e=0;e<d.length;e++){const{heights:t,lineCounts:n}=d[e],i=n.length,r=vn(t,0)+s*(i-1),c=Math.min(...t)<a?1.5:1,l=(()=>{for(let e=1;e!==i;++e)if(n[e-1]>n[e])return 1.5;return 1})(),h=Math.abs(r-o)*c*l;(!u||h<m)&&(u=d[e],m=h)}const h=u.lineCounts,g=u.heights,p=h.length;let f=0,I=0;for(let e=0;e!==p;++e){const t=h[e],a=g[e],o=Math.round(a);let r=0;for(let d=0;d!==t;++d){const l=0|(0===e?1:0)|(e===p-1?4:0)|(0===d?8:0)|(d===t-1?2:0),u=i[f],m=d===t-1?n-r:Math.round(u*a);c[f]={dimensions:{x:r,y:I,width:m,height:o},sides:l},r+=m+s,++f}I+=o+s}return c}(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,d=Math.min(o,Math.round(Math.min(c/t[0],r/t[1])));return[{dimensions:{x:0,y:0,width:c,height:d},sides:13},{dimensions:{x:c+s,y:0,width:r,height:d},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,d=Math.max(o,Math.round(Math.min((s-n)/2,Math.min(r*a[2],c*a[1])))),l=Math.min(Math.round(i*a[0]),s-n-d);return[{dimensions:{x:0,y:0,width:l,height:i},sides:13},{dimensions:{x:l+n,y:0,width:d,height:c},sides:3},{dimensions:{x:l+n,y:c+n,width:d,height:r},sides:6}]}(e):function(e){const{maxWidth:t,ratios:n,maxHeight:a,spacing:s}=e,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({maxWidth:e,ratios:t,spacing:n,maxHeight:a,minWidth:s}){const o=e,i=Math.round(Math.min(o/t[0],.66*(a-n))),r=Math.round((e-2*n)/(t[1]+t[2]+t[3])),c=Math.max(s,Math.round(Math.min(.4*(e-2*n),r*t[1]))),d=Math.round(Math.max(Math.max(s,.33*(e-2*n)),r*t[3])),l=o-c-d-2*n,u=Math.min(a-i-n,r);return[{dimensions:{x:0,y:0,width:o,height:i},sides:11},{dimensions:{x:0,y:i+n,width:c,height:u},sides:12},{dimensions:{x:c+n,y:i+n,width:l,height:u},sides:4},{dimensions:{x:c+n+l+n,y:i+n,width:d,height:u},sides:6}]}(e):function({maxHeight:e,ratios:t,maxWidth:n,spacing:a,minWidth:s}){const o=e,i=Math.round(Math.min(o*t[0],.6*(n-a))),r=Math.round((e-2*a)/(1/t[1]+1/t[2]+1/t[3])),c=Math.round(r/t[1]),d=Math.round(r/t[2]),l=o-c-d-2*a,u=Math.max(s,Math.min(n-i-a,r));return[{dimensions:{x:0,y:0,width:i,height:o},sides:13},{dimensions:{x:i+a,y:0,width:u,height:c},sides:3},{dimensions:{x:i+a,y:c+a,width:u,height:d},sides:2},{dimensions:{x:i+a,y:c+d+2*a,width:u,height:l},sides:6}]}(e)}(u),{layout:l,containerStyle:Zn(l)}}let Cn;function wn(e){return Cn||(Cn=document.createElement("span"),Cn.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',Cn.style.whiteSpace="nowrap",Cn.style.position="absolute",Cn.style.left="-999px",Cn.style.opacity=".01",document.body.appendChild(Cn)),Cn.innerHTML=e,Cn.offsetWidth}function bn(e,t,n,a,s,i){(0,o.bt)((()=>{if(n&&e.current){const t=e.current.closest(".MessageList");(0,cn.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 En=3*St.Gw,Mn=Number(St.Gw),Sn="data-is-document-group-hover";function Rn(e,t,n,s,i,r,c,d,l,u,m,g,p,f){const{setReplyingToId:I,sendDefaultReaction:v}=(0,a.uC)(),[y,Z,P]=(0,Ee.Z)(),[C,w,b]=(0,Ee.Z)(),E=(0,o.sO)();return(0,o.d4)((()=>{if(!h.$b||i||!r||m)return;let e;return(0,Qe.s)(t.current,{selectorToPreventScroll:".MessageList",onSwipe:(t,n)=>n===Qe.e.Left&&(e||(e=Date.now()),w(),!0),onRelease:()=>{e&&(I({messageId:n}),setTimeout(b,Math.max(0,150-(Date.now()-e))),e=void 0)}})}),[t,i,n,I,w,b,r,m]),{handleMouseDown:i?void 0:function(e){(0,sn.q)(e),l(e)},handleClick:function(t){if(i)e(t);else if(h.$b)return E.current?(clearInterval(E.current),E.current=void 0,void function(e){const{pageX:t,pageY:a}=e;v({chatId:u,messageId:n,x:t,y:a})}(t)):void(E.current=setTimeout((()=>{E.current=void 0,function(e){if(h.wZ){const t=e.target;if(!t.classList.contains("text-content")&&!t.classList.contains("Message"))return;Y.Z.getIsKeyboardVisible()?setTimeout((()=>{d(e)}),350):d(e)}}(t)}),200))},handleContextMenu:i?c?he.Z:void 0:function(t){if(h.wZ){if(t.target.matches("a[href]"))return;t.preventDefault(),e()}else d(t)},handleDoubleClick:i?void 0:function(){h.$b||I({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)<En,d=Math.abs(i+r-a)<Mn;c&&d?Z():P()},handleSendQuickReaction:function(e){const{x:t,y:a}=e.currentTarget.getBoundingClientRect();v({chatId:u,messageId:n,x:t,y:a})},handleMouseLeave:function(e){P(),f&&function(e){const t=Tn(e.currentTarget);t&&t.removeAttribute(Sn)}(e)},isSwiped:C,isQuickReactionVisible:y,handleDocumentGroupMouseEnter:kn}}function kn(e){const t=Tn(e.currentTarget);t&&t.setAttribute(Sn,"")}function Tn(e){let t=e;do{t=t.nextElementSibling}while(t&&!t.classList.contains("last-in-document-group"));return t}var Nn=n(8005);const Bn=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Ve.Z)(ze.gl.Extra,"ContextMenuContainer",!t);return n?o.ZP.createElement(n,e):void 0})),An=(0,o.X$)((0,a.c$)(((e,{message:t})=>{const{byId:n}=e.users,a=t.senderId,{targetUserIds:s,targetChatId:o}=t.content.action||{},i=t.replyToMessageId,c=i?(0,r.hj)(e,t.chatId,i):void 0,l=(0,r._X)(e,t),{direction:u,noHighlight:m}=l&&e.focusedMessage||{},h=(0,r.Z1)(e,t.chatId);return{usersById:n,sender:h&&((0,d.eA)(h)||a===t.chatId)?h:a?(0,r.dy)(e,a):void 0,targetChatId:o,targetUserIds:s,targetMessage:c,isFocused:l,...l&&{focusDirection:u,noFocusHighlight:m}}}))((({message:e,observeIntersection:t,isEmbedded:n,appearanceOrder:a=0,isLastInList:s,usersById:i,sender:r,targetUserIds:c,targetMessage:d,targetChatId:l,isFocused:u,focusDirection:m,noFocusHighlight:h})=>{const g=(0,o.sO)(null);(0,ln._N)(g,t),(0,Zt.Z)(e.chatId,e.replyToMessageId,d),bn(g,e.chatId,u,m,h);const p=(0,Re.Z)(),f=a<=0,[I,v]=(0,Ee.Z)(f);(0,o.d4)((()=>{f||setTimeout(v,10*a)}),[a,v,f]);const{transitionClassNames:y}=(0,ge.Z)(I,void 0,f,!1),Z=(0,o.Ye)((()=>c?c.map((e=>null==i?void 0:i[e])).filter(Boolean):void 0),[c,i]),P=(0,Nn.D)(p,e,r,Z,d,l,n?{isEmbedded:!0,asPlain:!0}:void 0),{isContextMenuOpen:C,contextMenuPosition:w,handleBeforeContextMenu:b,handleContextMenu:E,handleContextMenuClose:M,handleContextMenuHide:S}=(0,hn.Z)(g),R=void 0!==w;if(n)return o.ZP.createElement("span",{className:"embedded-action-message"},(0,Rt.Z)(P));const k=(0,le.Z)("ActionMessage message-list-item",u&&!h&&"focused",R&&"has-menu-open",s&&"last-in-list",y);return o.ZP.createElement("div",{ref:g,id:`message${e.id}`,className:k,"data-message-id":e.id,onMouseDown:e=>{(0,sn.q)(e),b(e)},onContextMenu:E},o.ZP.createElement("span",null,P),w&&o.ZP.createElement(Bn,{isOpen:C,anchor:w,message:e,messageListType:"thread",onClose:M,onCloseAnimationEnd:S}))}))),xn=({className:e,message:t,sender:n,title:a,customText:s,isProtected:i,observeIntersection:r,onClick:c})=>{const l=(0,o.sO)(null),u=(0,ln.Op)(l,r),m=(0,kt.Z)(t&&(0,d.Ti)(t,"pictogram"),!u),h=t&&`sticker-reply-thumb${t.id}`,g=Nt(t),p=Boolean(t&&(0,d.Y5)(t)),f=(0,Re.Z)(),I=n&&(0,d.OU)(f,n);return o.ZP.createElement("div",{ref:l,className:(0,le.Z)("EmbeddedMessage",e),onClick:t?c:void 0},g&&function(e,t,n,a,s){const{width:i,height:r}=(0,St.W7)();return o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("img",{id:e,src:n||t,width:i,height:r,alt:"",className:a?"round":"",draggable:!s}),s&&o.ZP.createElement("span",{className:"protector"}))}(h,g,m,p,i),o.ZP.createElement("div",{className:"message-text"},o.ZP.createElement("p",{dir:"auto"},t?(0,d.Lo)(t)?o.ZP.createElement(An,{message:t,isEmbedded:!0}):(0,Rt.Z)((0,d.MK)(f,t,Boolean(g))):s||" "),o.ZP.createElement("div",{className:"message-title",dir:"auto"},(0,Rt.Z)(I||a||" "))))};var Ln=n(2535),On=n(4752),Un=n(8018),Fn=n(8198),$n=n(7799);const Dn=(0,o.X$)((({reaction:e,activeReaction:t,isInMeta:n,availableReactions:s})=>{var i,r;const{stopActiveReaction:c}=(0,a.uC)(),d=null==s?void 0:s.find((t=>t.reaction===e)),l=null==d||null===(i=d.centerIcon)||void 0===i?void 0:i.id,m=null==d||null===(r=d.aroundAnimation)||void 0===r?void 0:r.id,h=(0,kt.Z)(`sticker${l}`,!l,u.IU.Lottie),g=(0,kt.Z)(`sticker${m}`,!m,u.IU.Lottie),p=Boolean((null==t?void 0:t.reaction)===e&&h&&g),{shouldRender:f,transitionClassNames:I}=(0,ge.Z)(p,void 0,!0,"slow"),v=(0,o.I4)((()=>{c({messageId:null==t?void 0:t.messageId,reaction:e})}),[null==t?void 0:t.messageId,e,c]),[y,Z,P]=(0,Ee.Z)(),C=!p||!y,w=(0,le.Z)("ReactionAnimatedEmoji",n&&"in-meta",f&&"is-animating");return o.ZP.createElement("div",{className:w},C&&o.ZP.createElement(Fn.Z,{reaction:e}),f&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement($n.Z,{key:l,id:`reaction_emoji_${l}`,className:I,size:30,animationData:h,play:!0,noLoop:!0,onLoad:Z,onEnded:P}),o.ZP.createElement($n.Z,{key:m,id:`reaction_effect_${m}`,className:(0,le.Z)("effect",I),size:100,animationData:g,play:!0,noLoop:!0,onEnded:v})))})),jn=(0,o.X$)((({message:e,outgoingStatus:t,signature:n,onClick:a,withReactions:s,activeReaction:i,withReactionOffset:r,availableReactions:c})=>{var d;const l=(0,Re.Z)(),[u,m]=(0,Ee.Z)(),h=s&&(null===(d=e.reactions)||void 0===d?void 0:d.results.filter((e=>e.count>0))),g=(0,o.Ye)((()=>{if(!u)return;const t=(0,N.SA)(1e3*e.date,l.code),n=e.isEdited&&(0,N.SA)(1e3*e.editDate,l.code),a=e.forwardInfo&&(0,N.SA)(1e3*e.forwardInfo.date,l.code);let s=t;return n&&(s+="\n",s+=l("lng_edited_date").replace("{date}",n)),a&&(s+="\n",s+=l("lng_forwarded_date").replace("{date}",a)),s}),[u,l,e]);return o.ZP.createElement("span",{className:(0,le.Z)("MessageMeta",r&&"reactions-offset"),dir:l.isRtl?"rtl":"ltr",onClick:a},h&&h.map((e=>o.ZP.createElement(Dn,{activeReaction:i,reaction:e.reaction,isInMeta:!0,availableReactions:c}))),Boolean(e.views)&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("span",{className:"message-views"},(0,Ct.bi)(e.views)),o.ZP.createElement("i",{className:"icon-channelviews"})),n&&o.ZP.createElement("span",{className:"message-signature"},(0,Rt.Z)(n)),o.ZP.createElement("span",{className:"message-time",title:g,onMouseEnter:m},e.isEdited&&`${l("EditedMessage")} `,(0,N.mr)(l,1e3*e.date)),t&&o.ZP.createElement(Un.Z,{status:t}))}));var Qn=n(692),qn=n(4851);const Gn=({message:e,observeIntersection:t,observeIntersectionForPlaying:n,shouldLoop:a,lastSyncTime:i})=>{const r=(0,o.sO)(null),[c,l,u]=(0,Ee.Z)(),m=e.content.sticker,{isAnimated:h,stickerSetId:g}=m,p=g===s.n,f=(0,ln.Op)(r,t),I=(0,ln.Op)(r,n),v=m.isPreloadedGlobally?`sticker${m.id}`:(0,d.Ti)(e,"inline"),y=Nt(e),Z=(0,kt.Z)(v,!f,(0,d.kG)(e,"inline",!0),i),P=Boolean(Z),[C,w]=(0,Ee.Z)(P),b=h?C:P,E=(0,Qn.Z)(b),{width:M,height:S}=(0,St.Wr)(m),R=(0,le.Z)("thumbnail",!y&&"empty"),k=(0,le.Z)("Sticker media-inner",p&&"inactive");return o.ZP.createElement("div",{ref:r,className:k,onClick:p?void 0:l},!b&&o.ZP.createElement("img",{id:`sticker-thumb-${e.id}`,src:y,width:M,height:S,alt:"",className:R}),!h&&o.ZP.createElement("img",{id:`sticker-${e.id}`,src:Z,width:M,height:S,alt:"",className:(0,le.Z)("full-media",E)}),h&&P&&o.ZP.createElement($n.Z,{key:v,className:(0,le.Z)("full-media",E),id:v,animationData:Z,size:M,play:I,noLoop:!a,onLoad:w}),o.ZP.createElement(qn.Z,{isOpen:c,fromSticker:m,onClose:u}))};var Hn=n(7854),_n=n(2566),zn=n(5866);function Vn(e,t){return(0,zn.Z)((0,d.DH)(e),Boolean(t),h.wB&&!h.vX)}const Yn={dark:{outgoing:"rgb(135,116,225)",incoming:"rgb(33,33,33)"},light:{outgoing:"rgb(238,255,222)",incoming:"rgb(255,255,255)"}};var Xn=n(9196);const Wn=({id:e,message:t,observeIntersection:n,noAvatars:a,canAutoLoad:s,isInSelectMode:i,isSelected:r,uploadProgress:c,size:l="inline",dimensions:u,nonInteractive:m,shouldAffectAppendix:h,isDownloading:g,isProtected:p,theme:f,onClick:I,onCancelUpload:v})=>{const y=(0,o.sO)(null),Z=((0,d.O$)(t)||(0,d.F$)(t)).blobUrl,P=(0,ln.Op)(y,n),[C,w]=(0,o.eJ)(s),b=C&&P,{mediaData:E,loadProgress:M}=(0,_n.Z)((0,d.Ti)(t,l),!b),S=Z||E,R=Vn(t,S),{loadProgress:k}=(0,_n.Z)((0,d.Ti)(t,"download"),!g),{isUploading:T,isTransferring:N,transferProgress:B}=(0,d.Sc)(t,c||(g?k:M),b&&!S),A=!1===(0,It.Z)(C),x=(0,Qn.Z)(S),{shouldRender:L,transitionClassNames:O}=(0,ge.Z)(N,void 0,A,"slow"),{shouldRender:U,transitionClassNames:F}=(0,ge.Z)(!S&&!C),$=(0,o.I4)((()=>{T?v&&v(t):S?I&&I(t.id):w((e=>!e))}),[S,T,t,v,I]),D=(0,d.B4)(t);(0,o.bt)((()=>{if(!h)return;const e=y.current.closest(".message-content");S?function(e,t,n,a,s){return a?Promise.resolve(Yn[s||"light"][t?"outgoing":"incoming"]):async function(e,t){const n=new Image;n.src=e,n.width||await new Promise((e=>{n.onload=e}));const a=document.createElement("canvas"),s=a.getContext("2d");a.width=n.width,a.height=n.height,s.drawImage(n,0,0,n.width,n.height);const o=t?n.width-1:0,i=n.height-1;return`rgba(${Array.from(s.getImageData(o,i,1,1).data).join(",")})`}(e,t)}(S,D,0,r,f).then((t=>{e.style.setProperty("--appendix-bg",t),e.setAttribute("data-has-custom-appendix","")})):e.classList.add("has-appendix-thumb")}),[S,D,h,i,r,f]);const{width:j,height:Q,isSmall:q}=u||In(t,a),G=(0,le.Z)("media-inner",!T&&!m&&"interactive",q&&"small-image",j===Q&&"square-image"),H=u?`width: ${j}px; height: ${Q}px; left: ${u.x}px; top: ${u.y}px;`:"";return o.ZP.createElement("div",{id:e,ref:y,className:G,style:H,onClick:T?void 0:$},o.ZP.createElement("canvas",{ref:R,className:"thumbnail",style:`width: ${j}px; height: ${Q}px`}),o.ZP.createElement("img",{src:S,className:`full-media ${x}`,width:j,height:Q,alt:"",draggable:!p}),p&&o.ZP.createElement("span",{className:"protector"}),L&&!U&&o.ZP.createElement("div",{className:`media-loading ${O}`},o.ZP.createElement(Xn.Z,{progress:B,onClick:T?$:void 0})),U&&o.ZP.createElement("i",{className:(0,le.Z)("icon-download",F)}),N&&o.ZP.createElement("span",{className:"message-transfer-progress"},Math.round(100*B),"%"))};var Kn=n(2019),Jn=n(6898),ea=n(4753);function ta(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,ea.Z)(e.current)}),[e]),c=(0,o.I4)((()=>{(0,C.T2)(r)}),[r]);(0,pe.Z)(i,c),(0,de.ZP)(i,r)}function na(){return(na=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}).apply(this,arguments)}const aa=({id:e,message:t,observeIntersection:n,noAvatars:s,canAutoLoad:i,canAutoPlay:r,uploadProgress:c,lastSyncTime:l,dimensions:m,onClick:h,onCancelUpload:g,isDownloading:p,isProtected:f})=>{var I;const v=(0,o.sO)(null),y=(0,o.sO)(null),Z=(0,d.b7)(t)||(0,d.Cg)(t),P=Z.blobUrl,C=(0,ln.Op)(v,n),[w,b]=(0,o.eJ)(i),E=Boolean(w&&C&&l),[M,S]=(0,o.eJ)(r),R=(0,kt.Z)((0,d.Ti)(t,"pictogram"),!(C&&l),(0,d.kG)(t,"pictogram"),l),k=(0,Qn.Z)(R),{mediaData:T,loadProgress:B}=(0,_n.Z)((0,d.Ti)(t,"inline"),!E,(0,d.kG)(t,"inline"),l),A=P||T,x=Boolean(C&&A),L=Vn(t,R),{loadProgress:O}=(0,_n.Z)((0,d.Ti)(t,"download"),!p,u.IU.BlobUrl,l),{isBuffered:U,bufferingHandlers:F}=(0,Kn.Z)(!i),{isUploading:$,isTransferring:D,transferProgress:j}=(0,d.Sc)(t,c||(p?O:B),E&&!U||p),Q=!1===(0,It.Z)(w),{shouldRender:q,transitionClassNames:G}=(0,ge.Z)(D,void 0,Q),{shouldRender:H,transitionClassNames:_}=(0,ge.Z)(w&&!M&&!q),[z,V]=(0,o.eJ)(0),Y=(0,o.I4)((e=>{V(Math.max(0,e.currentTarget.currentTime-1))}),[]),X=(null===(I=y.current)||void 0===I?void 0:I.duration)||Z.duration||0,W=(0,d.B4)(t),K=(0,d.MF)(t),{width:J,height:ee}=m||(0,St.GC)(Z,W,K,s);ta(y,x),(0,Jn.Z)(y,[x]);const te=(0,o.I4)((()=>{$?g&&g(t):p?(0,a.uC)().cancelMessageMediaDownload({message:t}):A?A&&!M?(S(!0),y.current.play()):h&&h(t.id):b((e=>!e))}),[$,p,A,M,h,g,t]),ne=(0,le.Z)("media-inner dark",!$&&"interactive"),ae=m?`width: ${J}px; height: ${ee}px; left: ${m.x}px; top: ${m.y}px;`:"";return o.ZP.createElement("div",{ref:v,id:e,className:ne,style:ae,onClick:$?void 0:te},o.ZP.createElement("canvas",{ref:L,className:"thumbnail",style:`width: ${J}px; height: ${ee}px;`}),o.ZP.createElement("img",{src:R,className:(0,le.Z)("thumbnail",k),style:`width: ${J}px; height: ${ee}px;`,alt:"",draggable:!f}),x&&o.ZP.createElement("video",na({ref:y,className:"full-media",width:J,height:ee,autoPlay:M,muted:!0,loop:!0,playsInline:!0},F,{draggable:!f,onTimeUpdate:Y}),o.ZP.createElement("source",{src:A})),f&&o.ZP.createElement("span",{className:"protector"}),H&&o.ZP.createElement("i",{className:(0,le.Z)("icon-large-play",_)}),q&&o.ZP.createElement("div",{className:(0,le.Z)("media-loading",G)},o.ZP.createElement(Xn.Z,{progress:j,onClick:te})),!w&&o.ZP.createElement("i",{className:"icon-download"}),D?o.ZP.createElement("span",{className:"message-transfer-progress"},$||p?`${Math.round(100*j)}%`:"..."):o.ZP.createElement("div",{className:"message-media-duration"},Z.isGif?"GIF":(0,N.k9)(Math.max(X-z,0))))};var sa=n(6272);const oa=(0,a.c$)(((e,{contact:t})=>{const{countryList:{phoneCodes:n}}=e;return{user:(0,r.dy)(e,t.userId),phoneCodeList:n}}))((({contact:e,user:t,phoneCodeList:n})=>{const{openUserInfo:s}=(0,a.uC)(),{firstName:i,lastName:r,phoneNumber:c,userId:d}=e,l=(0,o.I4)((()=>{s({id:d})}),[s,d]);return o.ZP.createElement("div",{className:(0,le.Z)("Contact",Boolean(d)&&"interactive"),onClick:d?l:void 0},o.ZP.createElement(Wt.Z,{size:"large",user:t,text:i||r}),o.ZP.createElement("div",{className:"contact-info"},o.ZP.createElement("div",{className:"contact-name"},i," ",r),o.ZP.createElement("div",{className:"contact-phone"},(0,sa.WZ)(n,c))))}));var ia=n(1218),ra=n(4434),ca=n(6937);function da(e,t){return t>0?(e/t*100).toFixed():0}const la=({answer:e,voteResults:t,totalVoters:n,maxVotersCount:a,correctResults:s,shouldAnimate:i})=>{const r=t&&t.find((t=>t.option===e.option)),c=0===s.length||-1!==s.indexOf(e.option),d=s.length>0&&c||(null==r?void 0:r.isChosen),l=r?da(r.votersCount,n||0):0,[u,m]=(0,o.eJ)(i?0:l),h=(0,o.sO)(null),g=r?da(r.votersCount,a||0):0,p=u<l;if((0,o.d4)((()=>{i&&m(l)}),[i,l]),(0,o.d4)((()=>{const e=h.current;if(e&&i){const t=e.firstElementChild,n=p?"":"stroke-dasharray: 100% 200%; stroke-dashoffset: -44";t?t.setAttribute("style",n):e.innerHTML=`\n <svg class="poll-line" xmlns="http://www.w3.org/2000/svg" style="${n}">\n <path d="M4.47 5.33v13.6a9 9 0 009 9h13"/>\n </svg>`}}),[p,i]),!t||!r)return;const f=`width: ${g}%; transform:scaleX(${p?0:1})`;return o.ZP.createElement("div",{className:"PollOption",dir:"ltr"},o.ZP.createElement("div",{className:"poll-option-share "+("100"===l?"limit-width":"")},l,"%",d&&o.ZP.createElement("span",{className:(0,le.Z)("poll-option-chosen",!c&&"wrong",i&&"animate")},o.ZP.createElement("i",{className:c?"icon-check":"icon-close"}))),o.ZP.createElement("div",{className:"poll-option-right"},o.ZP.createElement("div",{className:"poll-option-text",dir:"auto"},(0,Rt.Z)(e.text)),o.ZP.createElement("div",{className:(0,le.Z)("poll-option-answer",d&&!c&&"wrong")},o.ZP.createElement("div",{className:"poll-option-corner",ref:h}),o.ZP.createElement("div",{className:"poll-option-line",style:f}))))},ua=(0,o.X$)((0,a.c$)(((e,{poll:t})=>{const{recentVoterIds:n}=t.results,{serverTimeOffset:a,users:{byId:s}}=e;return n&&0!==n.length?{recentVoterIds:n,usersById:s,serverTimeOffset:a}:{}}))((({message:e,poll:t,recentVoterIds:n,usersById:s,onSendVote:i,serverTimeOffset:r})=>{const{loadMessage:c,openPollResults:d}=(0,a.uC)(),{id:l,chatId:u}=e,{summary:m,results:h}=t,[g,p]=(0,o.eJ)(!1),[f,I]=(0,o.eJ)([]),[v,y]=(0,o.eJ)(!1),[Z,P]=(0,o.eJ)(!1),[C,w]=(0,o.eJ)(!m.closed&&m.closeDate&&m.closeDate>0?Math.min(m.closeDate-Math.floor(Date.now()/1e3)+r,m.closePeriod):0),b=(0,o.sO)(null),{results:E,totalVoters:M}=h,S=E&&E.some((e=>e.isChosen)),R=!m.closed&&!S,k=!R&&m.isPublic&&Number(h.totalVoters)>0,T=R&&m.multipleChoice,B=E?Math.max(...E.map((e=>e.votersCount))):M,A=E?E.reduce(((e,t)=>(t.isCorrect&&e.push(t.option),e)),[]):[],x=m.answers.map((e=>({label:e.text,value:e.option,hidden:Boolean(m.quiz&&m.closePeriod&&C<=0)})));(0,o.d4)((()=>{g&&t.results.results&&t.results.results.some((e=>e.isChosen))&&p(!1)}),[g,t.results.results]),(0,o.d4)((()=>{C>0&&setTimeout((()=>w(C-1)),1e3);const e=b.current;if(e){const t=12*Math.PI,n=e.lastElementChild,a=e.firstElementChild;if(C<=5&&e.classList.add("hurry-up"),n&&a){const e=(m.closePeriod-C)/m.closePeriod*t;a.textContent=(0,N.k9)(C),n.firstElementChild.setAttribute("stroke-dashoffset",`-${e}`)}else e.innerHTML=`\n <span>${(0,N.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,m.closePeriod]),(0,o.d4)((()=>{m.quiz&&(C<=0||S&&!m.closed)&&c({chatId:u,messageId:l})}),[u,C,S,c,l,m.closed,m.quiz]),(0,o.d4)((()=>{let e;return m.quiz&&!m.closed&&m.closePeriod&&m.closePeriod>0&&(e=window.setTimeout((()=>{c({chatId:u,messageId:l})}),1e3*m.closePeriod)),()=>{e&&window.clearTimeout(e)}}),[R,u,c,l,m.closePeriod,m.closed,m.quiz]);const L=(0,o.Ye)((()=>n?n.reduce(((e,t)=>{const n=s[t];return n&&e.push(n),e}),[]):[]),[s,n]),O=(0,o.I4)((e=>{I([e]),p(!0),P(!0),i([e])}),[i]),U=(0,o.I4)((e=>{I(e)}),[]),F=(0,o.I4)((()=>{p(!0),P(!0),i(f)}),[i,f]),$=(0,o.I4)((()=>{d({chatId:u,messageId:l})}),[u,l,d]),D=(0,o.I4)((()=>{y(!0)}),[]),j=(0,o.I4)((()=>{y(!1),P(!1)}),[]);(0,o.d4)((()=>{Z&&S&&m.quiz&&h.results&&t.results.solution&&(h.results.find((e=>e.isChosen&&e.isCorrect))||y(!0))}),[S,Z,h.results,m.quiz,t.results.solution]);const Q=(0,Re.Z)();return o.ZP.createElement("div",{className:"Poll",dir:Q.isRtl?"auto":"ltr"},v&&t.results.solution&&o.ZP.createElement(ca.Z,{message:(0,gn.H)(t.results.solution,t.results.solutionEntities),duration:5e3,onDismiss:j,containerId:"#middle-column-portals"}),o.ZP.createElement("div",{className:"poll-question"},(0,Rt.Z)(m.question,["emoji","br"])),o.ZP.createElement("div",{className:"poll-type"},Q(function(e){return void 0===e.isPublic?" ":e.quiz?e.isPublic?"QuizPoll":"AnonymousQuizPoll":e.closed?"FinalResults":e.isPublic?"PublicPoll":"AnonymousPoll"}(m)),L.length>0&&o.ZP.createElement("div",{className:"poll-recent-voters"},L.map((e=>o.ZP.createElement(Wt.Z,{size:"micro",user:e})))),C>0&&R&&o.ZP.createElement("div",{ref:b,className:"poll-countdown"}),m.quiz&&t.results.solution&&!R&&o.ZP.createElement(xe.Z,{round:!0,size:"tiny",color:"translucent",className:"poll-quiz-help",disabled:v,onClick:D,ariaLabel:"Show Solution"},o.ZP.createElement("i",{className:"icon-lamp"}))),R&&o.ZP.createElement("div",{className:"poll-answers"},T?o.ZP.createElement(ia.Z,{options:x,onChange:U,disabled:e.isScheduled||g,loadingOptions:g?f:void 0,round:!0}):o.ZP.createElement(ra.Z,{name:`poll-${l}`,options:x,onChange:O,disabled:e.isScheduled||g,loadingOption:g?f[0]:void 0})),!R&&o.ZP.createElement("div",{className:"poll-results"},m.answers.map((function(e){return o.ZP.createElement(la,{key:e.option,shouldAnimate:Z,answer:e,voteResults:E,totalVoters:M,maxVotersCount:B,correctResults:A})}))),!k&&!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")}(Q,m.quiz,h.totalVoters)),T&&o.ZP.createElement(xe.Z,{isText:!0,disabled:0===f.length,size:"tiny",onClick:F},Q("PollSubmitVotes")),k&&o.ZP.createElement(xe.Z,{isText:!0,size:"tiny",onClick:$},Q("PollViewResults")))})));var ma=n(8035),ha=n(88);const ga=(0,o.X$)((({message:e,observeIntersection:t,noAvatars:n,canAutoLoad:a,canAutoPlay:s,inPreview:i,lastSyncTime:r,isDownloading:c=!1,isProtected:l,theme:u,onMediaClick:m,onCancelMediaTransfer:h})=>{const g=(0,d.s1)(e);let p=!1;if(null!=g&&g.photo&&!g.video){const{width:t,height:n}=In(e);p=t===n}const f=(0,o.I4)((()=>{m()}),[m]);if(!g)return;const{siteName:I,url:v,displayUrl:y,title:Z,description:P,photo:C,video:w}=g,b=(C||w)&&m&&!p,E=(0,ma.Z)(P,170),M=(0,le.Z)("WebPage",p&&"with-square-photo",!C&&!w&&!i&&"without-media",w&&"with-video");return o.ZP.createElement("div",{className:M,"data-initial":(I||y)[0],dir:"auto"},C&&!w&&o.ZP.createElement(Wn,{message:e,observeIntersection:t,noAvatars:n,canAutoLoad:a,size:p?"pictogram":"inline",nonInteractive:!b,onClick:b?f:void 0,onCancelUpload:h,isDownloading:c,isProtected:l,theme:u}),o.ZP.createElement("div",{className:"WebPage-text"},o.ZP.createElement(ha.Z,{className:"site-name",url:v,text:I||y}),!i&&Z&&o.ZP.createElement("p",{className:"site-title"},(0,Rt.Z)(Z)),E&&o.ZP.createElement("p",{className:"site-description"},(0,Rt.Z)(E,["emoji","br"]))),!i&&w&&o.ZP.createElement(aa,{message:e,observeIntersection:t,noAvatars:n,canAutoLoad:a,canAutoPlay:s,lastSyncTime:r,onClick:b?f:void 0,onCancelUpload:h,isDownloading:c,isProtected:l}))}));var pa=n(9937);const fa=(0,o.X$)((({message:e})=>{const t=(0,Re.Z)(),n=(0,d.eO)(e),{title:a,text:s,amount:i,currency:r,isTest:c,photoUrl:l}=n;return o.ZP.createElement("div",{className:"Invoice"},a&&o.ZP.createElement("p",{className:"title"},(0,Rt.Z)(a)),s&&o.ZP.createElement("p",null,(0,Rt.Z)(s,["emoji","br"])),o.ZP.createElement("div",{className:"description "+(l?"has-image":"")},l&&o.ZP.createElement("img",{className:"invoice-image",src:l,alt:""}),o.ZP.createElement("p",{className:"description-text"},(0,pa.x)(i,r,t.code),c&&o.ZP.createElement("span",null,t("PaymentTestInvoice")))))}));function Ia(e){return(0,o.X$)((0,a.c$)(((e,t)=>{const{message:n}=t;return{isInSelectMode:(0,r.CA)(e),isSelected:(0,r.vk)(e,n.id)}}))((t=>{const{isInSelectMode:n,isSelected:s,message:i,dimensions:r}=t,{toggleMessageSelection:c}=(0,a.uC)(),d=(0,o.I4)((e=>{e.stopPropagation(),c({messageId:i.id,withShift:null==e?void 0:e.shiftKey})}),[c,i]),l=(0,o.Ye)((()=>({...t,isInSelectMode:n,isSelected:s,dimensions:{...t.dimensions,x:0,y:0},onClick:n?void 0:t.onClick})),[t,n,s]);return o.ZP.createElement("div",{className:(0,le.Z)("album-item-select-wrapper",s&&"is-selected"),style:r?`left: ${r.x}px; top: ${r.y}px;`:"",onClick:n?d:void 0},n&&o.ZP.createElement("div",{className:"message-select-control"},s&&o.ZP.createElement("i",{className:"icon-select"})),o.ZP.createElement(e,l))})))}const va=Ia(Wn),ya=Ia(aa),Za=(0,a.c$)(((e,{album:t})=>{const{chatId:n}=t.mainMessage,a=(0,r.Pu)(e),s=(0,r.xs)(e,n);return{theme:a,uploadsById:e.fileUploads.byMessageLocalId,activeDownloadIds:s}}))((({album:e,observeIntersection:t,hasCustomAppendix:n,lastSyncTime:s,isOwn:i,isProtected:c,albumLayout:l,onMediaClick:u,uploadsById:m,activeDownloadIds:h,theme:g})=>{const{cancelSendingMessage:p}=(0,a.uC)(),f=e.messages.length,I=(0,o.I4)((e=>{p({chatId:e.chatId,messageId:e.id})}),[p]),{width:v,height:y}=l.containerStyle;return o.ZP.createElement("div",{className:"Album",style:`width: ${v}px; height: ${y}px;`},e.messages.map((function(e,p){const{photo:v,video:y}=(0,d.qp)(e),Z=m[e.previousLocalId||e.id],P=null==Z?void 0:Z.progress,{dimensions:C,sides:w}=l.layout[p],b=(0,r.bH)((0,a.Rd)(),e),E=(0,r.__)((0,a.Rd)(),e);if(v){const a=n&&(i?p===f-1:Boolean(8&w&&4&w));return o.ZP.createElement(va,{id:`album-media-${e.id}`,message:e,observeIntersection:t,canAutoLoad:b,shouldAffectAppendix:a,uploadProgress:P,dimensions:C,isProtected:c,onClick:u,onCancelUpload:I,isDownloading:h.includes(e.id),theme:g})}if(y)return o.ZP.createElement(ya,{id:`album-media-${e.id}`,message:e,observeIntersection:t,canAutoLoad:b,canAutoPlay:E,uploadProgress:P,lastSyncTime:s,dimensions:C,isProtected:c,onClick:u,onCancelUpload:I,isDownloading:h.includes(e.id),theme:g})})))}));function Pa(){return(Pa=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}).apply(this,arguments)}let Ca;const wa=({message:e,observeIntersection:t,canAutoLoad:n,lastSyncTime:s,isDownloading:i})=>{const r=(0,o.sO)(null),c=(0,o.sO)(null),l=(0,o.sO)(null),m=e.content.video,h=(0,ln.Op)(r,t),[g,p]=(0,o.eJ)(n),f=Boolean(g&&h&&s),{mediaData:I,loadProgress:v}=(0,_n.Z)((0,d.Ti)(e,"inline"),!f,(0,d.kG)(e,"inline"),s),{loadProgress:y}=(0,_n.Z)((0,d.Ti)(e,"download"),!i,u.IU.BlobUrl,s),Z=Vn(e,I),{isBuffered:P,bufferingHandlers:w}=(0,Kn.Z)(),b=g&&!P||i,E=!1===(0,It.Z)(g),M=(0,Qn.Z)(I),{shouldRender:S,transitionClassNames:R}=(0,ge.Z)(b||!P,void 0,E),[k,T]=(0,o.eJ)(!1),[B,A]=(0,o.eJ)(0);(0,o.d4)((()=>{if(!k)return;const e=St.Rj/2,t=2*(e-6)*Math.PI,n=t-B*t,a=l.current,s=c.current,o=s.firstElementChild;o?o.firstElementChild.setAttribute("stroke-dashoffset",n.toString()):s.innerHTML=`\n <svg width="${St.Rj}px" height="${St.Rj}px">\n <circle cx="${e}" cy="${e}" r="${e-6}" class="progress-circle"\n transform="rotate(-90, ${e}, ${e})"\n stroke-dasharray="${t} ${t}"\n stroke-dashoffset="${t}"\n />\n </svg>`,A(a.currentTime/a.duration)}),[k,B]);const x=Boolean(I&&h),L=()=>{T(!1),A(0),(0,ea.Z)(l.current),(0,C.T2)((()=>{c.current.innerHTML=""}))},O=(U=L,()=>{Ca&&Ca(),Ca=U});var U;(0,o.d4)((()=>{l.current&&(x?(0,ea.Z)(l.current):l.current.pause())}),[x]),ta(l,x),(0,Jn.Z)(l,[I]);const F=(0,o.I4)((()=>{if(!I)return void p((e=>!e));if(i)return void(0,a.uC)().cancelMessageMediaDownload({message:e});const t=l.current;k?t.paused?((0,ea.Z)(t),(0,Ut.Es)()):t.pause():(O(),t.pause(),t.currentTime=0,(0,ea.Z)(t),(0,Ut.Es)(),T(!0))}),[O,k,i,I,e]),$=(0,o.I4)((e=>{const t=e.currentTarget;A(t.currentTime/t.duration)}),[]),D=(0,le.Z)("full-media",M);return o.ZP.createElement("div",{ref:r,className:"RoundVideo media-inner",onClick:F},o.ZP.createElement("div",{className:"thumbnail-wrapper"},o.ZP.createElement("canvas",{ref:Z,className:"thumbnail",style:`width: ${St.Rj}px; height: ${St.Rj}px`})),I&&o.ZP.createElement("div",{className:"video-wrapper"},o.ZP.createElement("video",Pa({ref:l,className:D,width:St.Rj,height:St.Rj,autoPlay:!0,muted:!k,loop:!k,playsInline:!0,onEnded:k?L:void 0},w,{onTimeUpdate:k?$:void 0}),o.ZP.createElement("source",{src:I}))),o.ZP.createElement("div",{className:"progress",ref:c}),S&&o.ZP.createElement("div",{className:`media-loading ${R}`},o.ZP.createElement(Xn.Z,{progress:i?y:v})),!I&&!g&&o.ZP.createElement("i",{className:"icon-download"}),o.ZP.createElement("div",{className:"message-media-duration"},k?(0,N.k9)(l.current.currentTime):(0,N.k9)(m.duration),(!k||l.current.paused)&&o.ZP.createElement("i",{className:"icon-muted"})))},ba=({message:e,onClick:t})=>{const n=(0,Re.Z)();return o.ZP.createElement("div",{className:"InlineButtons"},e.inlineButtons.map((e=>o.ZP.createElement("div",{className:"row"},e.map((e=>o.ZP.createElement(xe.Z,{size:"tiny",ripple:!0,disabled:"NOT_SUPPORTED"===e.type,onClick:()=>t({button:e})},(0,Rt.Z)(n(e.text)),"buy"===e.type&&o.ZP.createElement("i",{className:"icon-card"}),"url"===e.type&&!e.value.match(s.FS)&&o.ZP.createElement("i",{className:"icon-arrow-right"}))))))))},Ea=(0,o.X$)((({threadInfo:e,disabled:t})=>{const{openChat:n}=(0,a.uC)(),s=(0,Re.Z)(),{threadId:i,chatId:r,messagesCount:c,lastMessageId:l,lastReadInboxMessageId:u,recentReplierIds:m}=e,h=(0,o.I4)((()=>{n({id:r,threadId:i})}),[n,r,i]),g=(0,o.Ye)((()=>{if(null==m||!m.length)return;const{users:{byId:e},chats:{byId:t}}=(0,a.Rd)();return m.map((n=>(0,d.YC)(n)?e[n]:t[n])).filter(Boolean)}),[m]);if(void 0===c)return;const p=Boolean(u&&l&&u<l);return o.ZP.createElement("div",{"data-cnt":(0,Ct.bi)(c),className:(0,le.Z)("CommentButton",p&&"has-unread",t&&"disabled"),dir:s.isRtl?"rtl":"ltr",onClick:h},o.ZP.createElement("i",{className:"icon-comments-sticker"}),(!g||0===g.length)&&o.ZP.createElement("i",{className:"icon-comments"}),g&&g.length>0&&o.ZP.createElement("div",{className:"recent-repliers",dir:s.isRtl?"rtl":"ltr"},g.map((e=>o.ZP.createElement(Wt.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"},c?s("Comments",c,"i"):s("LeaveAComment")),o.ZP.createElement("i",{className:"icon-next"}))})),Ma=(0,o.X$)((({reaction:e,message:t,activeReaction:n,availableReactions:s})=>{const{sendReaction:i}=(0,a.uC)(),{recentReactions:r}=t.reactions,c=(0,o.Ye)((()=>{if(!r||e.count>3)return;const t=(0,a.Rd)().users.byId;return r.filter((t=>t.reaction===e.reaction)).map((e=>t[e.userId])).filter(Boolean)}),[e,r]),d=(0,o.I4)((()=>{i({reaction:e.isChosen?void 0:e.reaction,chatId:t.chatId,messageId:t.id})}),[t,e,i]);return o.ZP.createElement(xe.Z,{className:(0,le.Z)(e.isChosen&&"chosen"),size:"tiny",onClick:d},o.ZP.createElement(Dn,{activeReaction:n,reaction:e.reaction,availableReactions:s}),null!=c&&c.length?o.ZP.createElement("div",{className:"avatars"},c.map((e=>o.ZP.createElement(Wt.Z,{user:e,size:"micro"})))):(0,Ct.bi)(e.count))})),Sa=(0,o.X$)((({message:e,isOutside:t,activeReaction:n,availableReactions:a,metaChildren:s})=>o.ZP.createElement("div",{className:(0,le.Z)("Reactions",t&&"is-outside")},e.reactions.results.map((t=>o.ZP.createElement(Ma,{key:t.reaction,reaction:t,message:e,activeReaction:n,availableReactions:a}))),s)));var Ra=n(7324),ka=n(5296);const Ta=(0,o.X$)((({localSticker:e,localEffect:t,isOwn:n,soundId:a,size:s="medium",observeIntersection:i,messageId:r,chatId:c,activeEmojiInteraction:d})=>{const{playKey:l,ref:u,style:m,width:h,handleClick:g,markAnimationLoaded:p}=(0,ka.Z)(s,c,r,a,d,n,t),f=`local_emoji_${e}`,I=(0,ln.Op)(u,i),[v,y]=(0,o.eJ)();return(0,o.d4)((()=>{e&&(0,Ra.Z)(e).then((e=>{y(e)}))}),[e]),o.ZP.createElement("div",{ref:u,className:"AnimatedEmoji media-inner",style:m,onClick:g},v&&o.ZP.createElement($n.Z,{key:f,id:f,animationData:v,size:h,quality:1,play:I&&l,noLoop:!0,onLoad:p}))})),Na={__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>'},Ba={__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>'},Aa=(0,o.X$)((0,a.c$)(((e,t)=>{const{focusedMessage:n,forwardMessages:a,lastSyncTime:s}=e,{message:o,album:i,withSenderName:c,withAvatar:l,threadId:u,messageListType:m,isLastInDocumentGroup:h}=t,{id:g,chatId:p,viaBotId:f,replyToChatId:I,replyToMessageId:v,isOutgoing:y,threadInfo:Z}=o,P=(0,r.Z1)(e,p),C=(0,r.FM)(e,p),w=(0,d.pK)(p),b=P&&(0,d.eA)(P),E=null==P?void 0:P.username,M=!C&&(0,d.Ul)(o),S=c||l||M,R=(0,r.Ur)(e,o),k=(0,r.cv)(e,o),T=f?(0,r.dy)(e,f):void 0,N=u?(0,r.qS)(e,p,u):void 0,B=o.id===N,A=v===N,x=v&&!A?(0,r.hj)(e,w&&I?I:p,v):void 0,L=x&&(0,r.Ur)(e,x),O=(0,r.uZ)(e,o),U="thread"===m&&(i?i.messages.some((t=>(0,r._X)(e,t))):(0,r._X)(e,o)),{direction:F,noHighlight:$,isResizingContainer:D}=U&&n||{},j=a.messageIds&&a.messageIds.includes(g),{query:Q}=(0,r.n5)(e)||{},q=(0,d._O)(o);let G;G=null!=i&&i.messages?i.messages.every((({id:t})=>(0,r.vk)(e,t))):(0,r.vk)(e,g);const{canReply:H}="thread"===m&&(0,r._k)(e,o,u)||{},_=(0,r.te)(e,o),z=Z?(0,r.tZ)(e,Z.chatId,Z.threadId)||Z:void 0,V=Boolean(o.groupedId)&&!o.isInAlbum,Y=V?(0,r.xH)(e,p,o.groupedId)[0]:void 0,X=V?h?(0,r.hj)(e,p,Y):void 0:o,W=q?(0,r.CP)(e,q):void 0;return{theme:(0,r.Pu)(e),chatUsername:E,forceSenderName:M,sender:S?R:void 0,originSender:k,botSender:T,shouldHideReply:A,isThreadTop:B,replyMessage:x,replyMessageSender:L,isInDocumentGroup:V,isProtected:(0,r.EV)(e,o),isFocused:U,isForwarding:j,reactionMessage:X,isChatWithSelf:C,isRepliesChat:w,isChannel:b,canReply:H,lastSyncTime:s,highlight:Q,isSingleEmoji:Boolean(q),animatedEmoji:q?(0,r.zB)(e,q):void 0,animatedEmojiEffect:q&&(0,d.YC)(p)?(0,r.tH)(e,q):void 0,animatedEmojiSoundId:q?(0,r.Oh)(e,q):void 0,localSticker:W,localEffect:W&&(0,d.YC)(p)?(0,r.cu)(W):void 0,isInSelectMode:(0,r.CA)(e),isSelected:G,isGroupSelected:!!o.groupedId&&!o.isInAlbum&&(0,r.a6)(e,p,o.groupedId),threadId:u,isDownloading:_,isPinnedList:"pinned"===m,canAutoLoadMedia:(0,r.bH)(e,o),canAutoPlayMedia:(0,r.__)(e,o),autoLoadFileMaxSizeMb:e.settings.byKey.autoLoadFileMaxSizeMb,shouldLoopStickers:(0,r.yB)(e),threadInfo:z,availableReactions:e.availableReactions,defaultReaction:(0,r.q6)(e,p),activeReaction:e.activeReactions[g],activeEmojiInteraction:e.activeEmojiInteraction,...y&&{outgoingStatus:(0,r.dT)(e,o,"scheduled"===m)},..."number"==typeof O&&{uploadProgress:O},...U&&{focusDirection:F,noFocusHighlight:$,isResizingContainer:D}}}))((({message:e,chatUsername:t,observeIntersectionForBottom:n,observeIntersectionForMedia:s,observeIntersectionForAnimatedStickers:i,album:r,noAvatars:c,withAvatar:l,withSenderName:g,areReactionsInMeta:p,noComments:f,appearanceOrder:I,isFirstInGroup:v,isLastInGroup:y,isFirstInDocumentGroup:Z,isLastInDocumentGroup:P,isLastInList:C,theme:w,forceSenderName:b,sender:E,originSender:M,botSender:S,isThreadTop:R,shouldHideReply:k,replyMessage:T,replyMessageSender:N,outgoingStatus:B,uploadProgress:A,isInDocumentGroup:x,isProtected:L,isFocused:O,focusDirection:U,noFocusHighlight:F,isResizingContainer:$,isForwarding:D,isChatWithSelf:j,isRepliesChat:Q,isChannel:q,canReply:G,lastSyncTime:H,highlight:_,animatedEmoji:z,localSticker:V,localEffect:Y,animatedEmojiEffect:X,animatedEmojiSoundId:W,isInSelectMode:K,isSelected:J,isGroupSelected:ee,threadId:te,reactionMessage:ne,availableReactions:ae,defaultReaction:se,activeReaction:oe,activeEmojiInteraction:ie,messageListType:re,isPinnedList:ce,isDownloading:de,canAutoLoadMedia:ue,canAutoPlayMedia:me,shouldLoopStickers:he,autoLoadFileMaxSizeMb:pe,threadInfo:fe})=>{const{toggleMessageSelection:Ie,clickInlineButton:ve,disableContextMenuHint:ye}=(0,a.uC)(),Ze=(0,o.sO)(null),Pe=(0,o.sO)(null),Ce=(0,o.sO)(null),we=(0,Re.Z)();(0,ln._N)(Pe,n);const{isContextMenuOpen:be,contextMenuPosition:Me,handleBeforeContextMenu:Se,handleContextMenu:ke,handleContextMenuClose:Te,handleContextMenuHide:Ne}=(0,hn.Z)(Ze,h.$b&&K,!0,h.wZ);(0,o.d4)((()=>{be&&ye()}),[be,ye]);const Be=I<=0,[Ae,Le]=(0,Ee.Z)(Be);(0,o.d4)((()=>{Be||setTimeout(Le,10*I)}),[I,Le,Be]);const{transitionClassNames:Oe}=(0,ge.Z)(Ae,void 0,Be,!1),{id:Ue,chatId:Fe,forwardInfo:$e,viaBotId:De}=e,je=(0,d.CI)(e),Qe=(0,d.B4)(e),qe="scheduled"===re||e.isScheduled,Ge=(0,d.ss)(e)&&!k,He=Boolean(fe)&&"thread"===re,_e=(0,d.$D)(e),ze=V||z,Ve=$e&&(!j||qe)&&!Q&&!$e.isLinkedChannelPost&&!_e,Ye=Boolean(r)&&r.messages.length>1,Xe=x&&!Z,We=x&&!P,Ke=void 0!==Me,Je=!(Ke||K||D||We),et=q&&!qe,tt=Boolean(ce||$e&&($e.isChannelPost||j&&!Qe||Q)&&$e.fromMessageId),nt=fe&&!We&&"thread"===re&&!f,at=!h.$b&&se&&!We,st=(0,o.I4)(((e,t)=>{Ie({messageId:Ue,groupedId:t,...(null==e?void 0:e.shiftKey)&&{withShift:!0},...Ye&&{childMessageIds:r.messages.map((({id:e})=>e))}})}),[Ie,Ue,Ye,r]),ot=$e&&(j||Q||!E)?M:E,it=$e?M:E,{handleMouseDown:rt,handleClick:ct,handleContextMenu:dt,handleDoubleClick:lt,handleContentDoubleClick:ut,handleMouseMove:mt,handleSendQuickReaction:ht,handleMouseLeave:gt,isSwiped:pt,isQuickReactionVisible:ft,handleDocumentGroupMouseEnter:It}=Rn(st,Ze,Ue,0,Boolean(K),Boolean(G),Boolean(L),ke,Se,Fe,Ke,Ce,Qe,We),{handleAvatarClick:vt,handleSenderClick:yt,handleViaBotClick:Pt,handleReplyClick:Ct,handleMediaClick:wt,handleAudioPlay:bt,handleAlbumMediaClick:Et,handleMetaClick:Mt,handleReadMedia:kt,handleCancelUpload:Tt,handleVoteSend:Nt,handleGroupForward:Bt,handleForward:At,handleFocus:xt,handleFocusForwarded:Lt,handleDocumentGroupSelectAll:Ot}=function(e,t,n,s,i,r,c,l,h,g,p,f,I){const{openUserInfo:v,openChat:y,showNotification:Z,focusMessage:P,openMediaViewer:C,openAudioPlayer:w,markMessagesRead:b,cancelSendingMessage:E,sendPollVote:M,openForwardMenu:S,focusMessageInComments:R}=(0,a.uC)(),{id:k,forwardInfo:T,replyToMessageId:N,replyToChatId:B,replyToTopMessageId:A,groupedId:x}=n,L=(0,o.I4)((()=>{p&&((0,d.YC)(p.id)?v({id:p.id}):y({id:p.id}))}),[p,v,y]),O=(0,o.I4)((()=>{f?c&&null!=T&&T.channelPostId?P({chatId:f.id,messageId:T.channelPostId}):(0,d.YC)(f.id)?v({id:f.id}):y({id:f.id}):Z({message:e("HidAccount")})}),[c,P,T,e,y,v,f,Z]),U=(0,o.I4)((()=>{I&&v({id:I.id})}),[I,v]),F=(0,o.I4)((()=>{P({chatId:h&&B?B:s,threadId:i,messageId:N,replyMessageId:h&&B?void 0:k})}),[P,h,B,s,i,N,k]),$=(0,o.I4)((()=>{C({chatId:s,threadId:i,messageId:k,origin:l?m.bZ.ScheduledInline:m.bZ.Inline})}),[s,i,k,C,l]),D=(0,o.I4)((()=>{w({chatId:s,messageId:k})}),[s,k,w]),j=(0,o.I4)((e=>{C({chatId:s,threadId:i,messageId:e,origin:l?m.bZ.ScheduledAlbum:m.bZ.Album})}),[s,i,C,l]),Q=(0,o.I4)((()=>{b({messageIds:[k]})}),[k,b]),q=(0,o.I4)((()=>{E({chatId:s,messageId:k})}),[E,s,k]),G=(0,o.I4)((e=>{M({chatId:s,messageId:k,options:e})}),[s,k,M]),H=(0,o.I4)((()=>{S({fromChatId:s,groupedId:x})}),[S,s,x]),_=(0,o.I4)((()=>{if(g&&g.messages){const e=g.messages.map((({id:e})=>e));S({fromChatId:s,messageIds:e})}else S({fromChatId:s,messageIds:[k]})}),[g,S,s,k]),z=(0,o.I4)((()=>{P({chatId:s,threadId:u._f,messageId:k})}),[P,s,k]),V=(0,o.I4)((()=>{r?P({chatId:T.fromChatId,groupedId:x,groupedChatId:s}):h&&B?R({chatId:B,threadId:A,messageId:T.fromMessageId}):P({chatId:T.fromChatId,messageId:T.fromMessageId})}),[r,h,B,P,T,x,s,R,A]),Y=(0,o.I4)((e=>{e.stopPropagation(),t(e,x)}),[t,x]);return{handleAvatarClick:L,handleSenderClick:O,handleViaBotClick:U,handleReplyClick:F,handleMediaClick:$,handleAudioPlay:D,handleAlbumMediaClick:j,handleMetaClick:Y,handleReadMedia:Q,handleCancelUpload:q,handleVoteSend:G,handleGroupForward:H,handleForward:_,handleFocus:z,handleFocusForwarded:V,handleDocumentGroupSelectAll:Y}}(we,st,e,Fe,te,x,Ve,qe,Q,r,ot,it,S),Ut=(0,le.Z)("Message message-list-item",v&&"first-in-group",L&&"is-protected",y&&"last-in-group",Z&&"first-in-document-group",P&&"last-in-document-group",C&&"last-in-list",Qe&&"own",Boolean(e.views)&&"has-views",e.isEdited&&"was-edited",Ge&&"has-reply",Ke&&"has-menu-open",O&&!F&&"focused",D&&"is-forwarding",e.isDeleting&&"is-deleting",x&&"is-in-document-group",Ye&&"is-album",e.hasUnreadMention&&"has-unread-mention",J&&"is-selected",K&&"is-in-selection-mode",R&&"is-thread-top",Boolean(e.inlineButtons)&&"has-inline-buttons",pt&&"is-swiped",Oe,Boolean(oe)&&"has-active-reaction"),Ft=function(e,{hasReply:t,customShape:n,isLastInGroup:a,asForwarded:s,hasThread:o,forceSenderName:i,hasComments:r,hasActionButton:c}={}){const{text:l,photo:u,video:m,audio:h,voice:g,document:p,poll:f,webPage:I,contact:v}=(0,d.qp)(e),y=["message-content"],Z=u||m,P=Z&&!l,C=Boolean(e.viaBotId);return pn(n)?y.push(`emoji-only emoji-only-${n}`):l&&y.push("text"),c&&y.push("has-action-button"),n&&(y.push("custom-shape"),null!=m&&m.isRound&&y.push("round"),r&&y.push("has-comments")),u||m?y.push("media"):h?y.push("audio"):g?y.push("voice"):p?y.push("document"):v?y.push("contact"):f?y.push("poll"):I&&(y.push("web-page"),(I.photo||I.video)&&y.push("media")),s&&y.push("is-forwarded"),t&&y.push("is-reply"),o&&y.push("has-replies"),C&&y.push("is-via-bot"),i&&y.push("force-sender-name"),n||(y.push("has-shadow"),Z&&r&&y.push("has-background"),(t||s||!P||C||i)&&y.push("has-solid-background"),!a||!u&&P||y.push("has-appendix")),y.join(" ")}(e,{hasReply:Ge,customShape:_e,isLastInGroup:y,asForwarded:Ve,hasThread:He,forceSenderName:b,hasComments:fe&&(null==fe?void 0:fe.messagesCount)>0,hasActionButton:et||tt}),$t=Ft.includes("has-appendix"),Dt=(0,gn.X)(e,_,pn(_e)),{text:jt,photo:Qt,video:qt,audio:Gt,voice:Ht,document:_t,sticker:zt,contact:Vt,poll:Yt,webPage:Xt,invoice:Kt}=(0,d.qp)(e);let Jt,en;Jt=We?"none":!Dt||ze||Xt?"standalone":"in-text",p?en="in-meta":null!=ne&&ne.reactions&&!(0,d.JE)(ne.reactions)?_e||(Qt||qt||ze)&&!Dt?en="outside":Ve?(Jt="standalone",en="inside"):en="inside":en="none",(0,Zt.Z)(Q&&e.replyToChatId?e.replyToChatId:Fe,Ge?e.replyToMessageId:void 0,T,e.id),bn(Ze,Fe,O,U,F,$);let tn,nn="",an=!1;const sn=(0,o.Ye)((()=>Ye?Pn(Qe,Boolean(Ve),Boolean(c),r):void 0),[Ye,Qe,Ve,c,r]),on=Ve?28:0;if(Ye||!Qt&&!qt)sn&&(tn=Math.max(fn(Boolean(jt),nt),sn.containerStyle.width),tn-sn.containerStyle.width>18&&(an=!0));else{let t;Qt?t=In(e,c).width:qt&&(t=qt.isRound?St.Rj:In(e,c).width),t&&(tn=Math.max(fn(Boolean(jt),nt),t),tn-t>18&&(an=!0))}tn&&(nn=`width: ${tn+on}px`);const rn=q&&e.adminTitle||!Ve&&(null==$e?void 0:$e.adminTitle)||void 0,cn=(0,o.Ye)((()=>rn?wn(rn):void 0),[rn]);function dn(){const t=o.ZP.createElement(jn,{message:e,outgoingStatus:B,signature:rn,withReactions:"in-meta"===en,withReactionOffset:"inside"===en,availableReactions:ae,activeReaction:oe,onClick:Mt});return"inside"!==en?t:o.ZP.createElement(Sa,{activeReaction:oe,message:ne,metaChildren:t,availableReactions:ae})}return o.ZP.createElement("div",{ref:Ze,id:`message${Ue}`,className:Ut,style:cn?`--meta-safe-author-width: ${cn}px`:void 0,"data-message-id":Ue,onMouseDown:rt,onClick:ct,onContextMenu:dt,onDoubleClick:lt,onMouseEnter:We?It:void 0,onMouseMove:at?mt:void 0,onMouseLeave:at||We?gt:void 0},o.ZP.createElement("div",{ref:Pe,className:"bottom-marker","data-message-id":Ue,"data-last-message-id":r?r.messages[r.messages.length-1].id:void 0,"data-has-unread-mention":e.hasUnreadMention}),!x&&o.ZP.createElement("div",{className:"message-select-control"},J&&o.ZP.createElement("i",{className:"icon-select"})),P&&o.ZP.createElement("div",{className:(0,le.Z)("message-select-control group-select",ee&&"is-selected"),onClick:Ot},ee&&o.ZP.createElement("i",{className:"icon-select"})),l&&function(){const e=ot&&(0,d.YC)(ot.id),t=ot&&e?ot:void 0,n=ot&&!e?ot:void 0,a=!ot&&$e?$e.hiddenUserName:void 0;return o.ZP.createElement(Wt.Z,{size:"small",user:t,chat:n,text:a,lastSyncTime:H,onClick:t||n?vt:void 0})}(),o.ZP.createElement("div",{className:(0,le.Z)("message-content-wrapper",Ft.includes("text")&&"can-select-text")},o.ZP.createElement("div",{ref:Ce,className:Ft,style:nn,dir:"auto"},Ve&&!Xe&&o.ZP.createElement("div",{className:"message-title"},we("ForwardedMessage")),function(){const t=(0,le.Z)("content-inner",Ve&&"forwarded-message",Ge&&"reply-message",an&&"no-media-corners"),n=y&&!Dt&&!Ve&&!He,a=(0,le.Z)("text-content","in-text"===Jt&&"with-meta",B&&"with-outgoing-icon");return o.ZP.createElement("div",{className:t,onDoubleClick:ut,dir:"auto"},function(){if(_e&&!De||!(g&&!Qt&&!qt||Ve||De||b)||Xe||Ge&&_e)return;let t,n;return!it||_e&&De?null!=$e&&$e.hiddenUserName&&(t=$e.hiddenUserName):(t=(0,d.OU)(we,it),Ve||(n=`color-${(0,d.Rs)(it)}`)),o.ZP.createElement("div",{className:"message-title",dir:"ltr"},t?o.ZP.createElement("span",{className:(0,le.Z)("interactive",n),onClick:yt,dir:"auto"},(0,Rt.Z)(t)):S?void 0:" ",S&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("span",{className:"via"},we("ViaBot")),o.ZP.createElement("span",{className:"interactive",onClick:Pt},(0,Rt.Z)(`@${S.username}`))),null!=$e&&$e.isLinkedChannelPost?o.ZP.createElement("span",{className:"admin-title",dir:"auto"},we("DiscussChannel")):e.adminTitle&&!q?o.ZP.createElement("span",{className:"admin-title",dir:"auto"},e.adminTitle):void 0)}(),Ge&&o.ZP.createElement(xn,{message:T,isProtected:L,sender:N,observeIntersection:s,onClick:Ct}),zt&&o.ZP.createElement(Gn,{message:e,observeIntersection:s,observeIntersectionForPlaying:i,shouldLoop:he,lastSyncTime:H}),z&&o.ZP.createElement(Hn.Z,{size:"small",isOwn:Qe,sticker:z,effect:X,soundId:W,observeIntersection:s,lastSyncTime:H,forceLoadPreview:je,messageId:Ue,chatId:Fe,activeEmojiInteraction:ie}),V&&o.ZP.createElement(Ta,{size:"small",isOwn:Qe,localSticker:V,localEffect:Y,soundId:W,observeIntersection:s,lastSyncTime:H,forceLoadPreview:je,messageId:Ue,chatId:Fe,activeEmojiInteraction:ie}),Ye&&o.ZP.createElement(Za,{album:r,albumLayout:sn,observeIntersection:s,isOwn:Qe,isProtected:L,hasCustomAppendix:n,lastSyncTime:H,onMediaClick:Et}),!Ye&&Qt&&o.ZP.createElement(Wn,{message:e,observeIntersection:s,noAvatars:c,canAutoLoad:ue,uploadProgress:A,shouldAffectAppendix:n,onClick:wt,onCancelUpload:Tt,isDownloading:de,isProtected:L,theme:w}),!Ye&&qt&&qt.isRound&&o.ZP.createElement(wa,{message:e,observeIntersection:s,canAutoLoad:ue,lastSyncTime:H,isDownloading:de}),!Ye&&qt&&!qt.isRound&&o.ZP.createElement(aa,{message:e,observeIntersection:s,noAvatars:c,canAutoLoad:ue,canAutoPlay:me,uploadProgress:A,lastSyncTime:H,onClick:wt,onCancelUpload:Tt,isDownloading:de,isProtected:L}),(Gt||Ht)&&o.ZP.createElement(On.Z,{theme:w,message:e,origin:m.Cr.Inline,uploadProgress:A,lastSyncTime:H,isSelectable:x,isSelected:J,onPlay:bt,onReadMedia:!Ht||Qe&&!j?void 0:kt,onCancelUpload:Tt,isDownloading:de}),_t&&o.ZP.createElement(Ln.Z,{message:e,observeIntersection:s,canAutoLoad:ue,autoLoadFileMaxSizeMb:pe,uploadProgress:A,isSelectable:x,isSelected:J,onMediaClick:wt,onCancelUpload:Tt,isDownloading:de}),Vt&&o.ZP.createElement(oa,{contact:Vt}),Yt&&o.ZP.createElement(ua,{message:e,poll:Yt,onSendVote:Nt}),!ze&&Dt&&o.ZP.createElement("p",{className:a,dir:"auto"},Dt,"in-text"===Jt&&dn()),Xt&&o.ZP.createElement(ga,{message:e,observeIntersection:s,noAvatars:c,canAutoLoad:ue,canAutoPlay:me,lastSyncTime:H,onMediaClick:wt,onCancelMediaTransfer:Tt,isDownloading:de,isProtected:L,theme:w}),Kt&&o.ZP.createElement(fa,{message:e}))}(),!We&&"standalone"===Jt&&dn(),Je&&et?o.ZP.createElement(xe.Z,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:we("lng_context_forward_msg"),onClick:P?Bt:At},o.ZP.createElement("i",{className:"icon-share-filled"})):Je&&tt?o.ZP.createElement(xe.Z,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:"Focus message",onClick:ce?xt:Lt},o.ZP.createElement("i",{className:"icon-arrow-right"})):void 0,nt&&o.ZP.createElement(Ea,{threadInfo:fe,disabled:f}),$t&&o.ZP.createElement("div",{className:"svg-appendix",dangerouslySetInnerHTML:Qe?Na:Ba}),at&&o.ZP.createElement("div",{className:(0,le.Z)("quick-reaction",ft&&!oe&&"visible"),onClick:ht},o.ZP.createElement(Fn.Z,{reaction:se}))),e.inlineButtons&&o.ZP.createElement(ba,{message:e,onClick:ve}),"outside"===en&&o.ZP.createElement(Sa,{message:ne,isOutside:!0,activeReaction:oe,availableReactions:ae})),Me&&o.ZP.createElement(Bn,{isOpen:be,anchor:Me,message:e,album:r,chatUsername:t,messageListType:re,onClose:Te,onCloseAnimationEnd:Ne}))}))),xa=(0,o.X$)((0,a.c$)(((e,{chatId:t})=>{const n=(0,r.fS)(e,t),{chatId:a,isBot:s}=n||{};return{message:n,bot:a&&s?(0,r.dy)(e,a):void 0,channel:!s&&a?(0,r.Z1)(e,a):void 0}}))((({chatId:e,message:t,containerRef:n,bot:s,channel:i})=>{const{viewSponsoredMessage:r,openChat:c,openChatByInvite:l,startBot:u,focusMessage:m}=(0,a.uC)(),h=(0,Re.Z)(),g=(0,o.sO)(null),p=Boolean(t),{observe:f}=(0,ln.S1)({rootRef:n,debounceMs:200,threshold:1});if((0,o.d4)((()=>p?f(g.current,(t=>{t.isIntersecting&&r({chatId:e})})):void 0),[e,p,f,r]),t)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"},s&&(0,Rt.Z)((0,d.Js)(s)||""),i&&(0,Rt.Z)(t.chatInviteTitle||(0,d.U)(h,i,s)||"")),o.ZP.createElement("p",{className:"text-content with-meta",dir:"auto",ref:g},o.ZP.createElement("span",{className:"text-content-inner",dir:"auto"},(0,gn.H)(t.text.text,t.text.entities)),o.ZP.createElement("span",{className:"MessageMeta",dir:"ltr"},o.ZP.createElement("span",{className:"message-signature"},h("SponsoredMessage")))),o.ZP.createElement(xe.Z,{color:"secondary",size:"tiny",ripple:!0,onClick:()=>{t.chatInviteHash?l({hash:t.chatInviteHash}):t.channelPostId?m({chatId:t.chatId,messageId:t.channelPostId}):(c({id:t.chatId}),t.startParam&&u({botId:t.chatId,param:t.startParam}))},className:"SponsoredMessage__button"},h(t.isBot?"Conversation.ViewBot":t.channelPostId?"Conversation.ViewPost":"Conversation.ViewChannel")))))}))),La=(0,o.X$)((({chatId:e,messageIds:t,messageGroups:n,isViewportNewest:i,isUnread:r,withUsers:c,areReactionsInMeta:l,noAvatars:u,containerRef:p,anchorIdRef:f,memoUnreadDividerBeforeIdRef:I,memoFirstUnreadIdRef:v,threadId:y,type:Z,isReady:P,isScrollingRef:w,isScrollPatchNeededRef:b,threadTopMessageId:E,hasLinkedChat:M,isSchedule:S,noAppearanceAnimation:R,onFabToggle:k,onNotchToggle:T})=>{const{openHistoryCalendar:B}=(0,a.uC)(),{observeIntersectionForMedia:A,observeIntersectionForReading:x,observeIntersectionForAnimatedStickers:L}=function(e,t,n){const{markMessageListRead:s,markMessagesRead:o}=(0,a.uC)(),{observe:i}=(0,ln.S1)({rootRef:t,throttleMs:un,margin:mn}),{observe:r,freeze:c,unfreeze:d}=(0,ln.S1)({rootRef:t,throttleMs:150},(t=>{if("thread"!==e)return;let a=0;const i=[];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&&i.push(o)})),n.current&&a>=n.current&&s({maxId:a}),i.length&&o({messageIds:i})}));(0,pe.Z)(c,d);const{observe:l}=(0,ln.S1)({rootRef:t,throttleMs:un});return{observeIntersectionForMedia:i,observeIntersectionForReading:r,observeIntersectionForAnimatedStickers:l}}(Z,p,v),{backwardsTriggerRef:O,forwardsTriggerRef:U,fabTriggerRef:F}=function(e,t,n,i,r,c,d,l,u,g){const{loadViewportMessages:p}=(0,a.uC)(),[f,I]=(0,o.Ye)((()=>"thread"===e?[(0,C.Ds)((()=>p({direction:m.Uq.Backwards})),1e3,!0,!1),(0,C.Ds)((()=>p({direction:m.Uq.Forwards})),1e3,!0,!1)]:[]),[p,n]),v=(0,o.sO)(null),y=(0,o.sO)(null),Z=(0,o.sO)(null);function P(){if(!l)return;if(!n||!n.length)return c(!1),void d(!1);if(!i)return c(!0),void d(!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)),d(!u)}const{observe:w}=(0,ln.S1)({rootRef:t,margin:h.gZ},(e=>{if(!I||!f)return;if(n[0]>=s.AE)return;const t=e.find((({isIntersecting:e})=>e));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&&I()}));(0,ln._N)(v,w),(0,ln._N)(y,w);const{observe:b,freeze:E,unfreeze:M}=(0,ln.S1)({rootRef:t,margin:100},P);(0,ln._N)(Z,b);const{observe:S,freeze:R,unfreeze:k}=(0,ln.S1)({rootRef:t,margin:1},P);return(0,ln._N)(Z,S),(0,Ie.Z)((()=>{l&&P()}),[l]),(0,Ie.Z)((()=>{E(),R(),setTimeout((()=>{k(),M()}),250)}),[n]),{backwardsTriggerRef:v,forwardsTriggerRef:y,fabTriggerRef:Z}}(Z,p,t,i,r,k,T,P,w,b),$=(0,Re.Z)(),D=o.ZP.createElement("div",{className:(0,le.Z)("unread-divider","local-action-message"),key:"unread-messages"},o.ZP.createElement("span",null,$("UnreadMessages"))),j=R?0:n.reduce(((e,t)=>e+(0,g.xH)(t.senderGroups).length),0);let Q=0;const q=n.map(((e,t,n)=>{const a=e.senderGroups.map(((e,a,s)=>{if(1===e.length&&!nn(e[0])&&(0,d.Lo)(e[0])){const i=e[0],r=a===s.length-1&&t===n.length-1;return(0,g.oA)([i.id===I.current&&D,o.ZP.createElement(An,{key:i.id,message:i,observeIntersection:x,appearanceOrder:j-++Q,isLastInList:r})])}let i;return(0,g.xH)(e.map(((r,m)=>{const h=nn(r)?r.mainMessage:r,p=nn(r)?r:void 0,v=(0,d.B4)(h),P=nn(r),C=e[m+1];h.previousLocalId&&f.current===`message${h.previousLocalId}`&&(f.current=`message${h.id}`);const w=!P&&h.groupedId?h.groupedId:void 0,b=C&&!nn(C)?C.groupedId:void 0,S={isFirstInGroup:0===m,isLastInGroup:m===e.length-1,isFirstInDocumentGroup:Boolean(w&&w!==i),isLastInDocumentGroup:Boolean(w&&w!==b),isLastInList:m===e.length-1&&a===s.length-1&&t===n.length-1};i=w;const R=(0,d.KK)(h),k="scheduled"!==Z?R:`${h.date}_${R}`;return(0,g.oA)([h.id===I.current&&D,o.ZP.createElement(Aa,{key:k,message:h,observeIntersectionForBottom:x,observeIntersectionForMedia:A,observeIntersectionForAnimatedStickers:L,album:p,noAvatars:u,withAvatar:S.isLastInGroup&&c&&!v&&!(h.id===E),withSenderName:S.isFirstInGroup&&c&&!v,areReactionsInMeta:l,threadId:y,messageListType:Z,noComments:!1===M,appearanceOrder:j-++Q,isFirstInGroup:S.isFirstInGroup,isLastInGroup:S.isLastInGroup,isFirstInDocumentGroup:S.isFirstInDocumentGroup,isLastInDocumentGroup:S.isLastInDocumentGroup,isLastInList:S.isLastInList}),h.id===E&&o.ZP.createElement("div",{className:"local-action-message",key:"discussion-started"},o.ZP.createElement("span",null,$("DiscussionStarted")))])})))}));return o.ZP.createElement("div",{className:"message-date-group",key:e.datetime,onMouseDown:sn.q,teactFastList:!0},o.ZP.createElement("div",{className:(0,le.Z)("sticky-date",!S&&"interactive"),key:"date-header",onMouseDown:sn.q,onClick:S?void 0:()=>B({selectedAt:e.datetime})},o.ZP.createElement("span",{dir:"auto"},S&&e.originalDate===s.t4&&$("MessageScheduledUntilOnline"),S&&e.originalDate!==s.t4&&$("MessageScheduledOn",(0,N.j1)($,e.datetime,void 0,!0)),!S&&(0,N.j1)($,e.datetime))),(0,g.xH)(a))}));return o.ZP.createElement("div",{className:"messages-container",teactFastList:!0},o.ZP.createElement("div",{ref:O,key:"backwards-trigger",className:"backwards-trigger"}),(0,g.xH)(q),i&&o.ZP.createElement(xa,{key:e,chatId:e,containerRef:p}),o.ZP.createElement("div",{ref:U,key:"forwards-trigger",className:"forwards-trigger"}),o.ZP.createElement("div",{ref:F,key:"fab-trigger",className:"fab-trigger"}))}));var Oa=n(3547);const Ua=(0,o.X$)((0,a.c$)(((e,{userId:t})=>{const{stickers:n}=e.stickers.greeting,a=(0,d.db)(t)+(0,d.db)(e.currentUserId),s=null!=n&&n.length?n[a%n.length]:void 0,o=(0,r.Z1)(e,t);return o?{sticker:s,lastUnreadMessageId:o.lastMessage&&o.lastMessage.id!==o.lastReadInboxMessageId?o.lastMessage.id:void 0,connectionState:e.connectionState}:{}}))((({sticker:e,connectionState:t,lastUnreadMessageId:n})=>{const{loadGreetingStickers:s,sendMessage:i,markMessageListRead:r}=(0,a.uC)(),c=(0,Re.Z)(),d=(0,o.sO)(null),{observe:l}=(0,ln.S1)({rootRef:d,debounceMs:200});(0,o.d4)((()=>{e||"connectionStateReady"!==t||s()}),[t,s,e]),(0,o.d4)((()=>{"connectionStateReady"===t&&n&&r({maxId:n})}),[t,r,n]);const u=(0,o.I4)((e=>{e={...e,isPreloadedGlobally:!0},i({sticker:e})}),[i]);return o.ZP.createElement("div",{className:"ContactGreeting",ref:d},o.ZP.createElement("div",{className:"wrapper"},o.ZP.createElement("p",{className:"title",dir:"auto"},c("Conversation.EmptyPlaceholder")),o.ZP.createElement("p",{className:"description",dir:"auto"},c("Conversation.GreetingText")),o.ZP.createElement("div",{className:"sticker"},e&&o.ZP.createElement(Oa.Z,{sticker:e,onClick:u,clickArg:e,observeIntersection:l,size:160,className:"large"}))))}))),Fa=(0,o.X$)((({isChatWithSelf:e,type:t,isGroupChatJustCreated:n})=>{const a=(0,Re.Z)();return"scheduled"===t?function(e){return o.ZP.createElement("div",{className:"empty"},o.ZP.createElement("span",null,e("ScheduledMessages.EmptyPlaceholder")))}(a):e?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")))))}(a):n?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")))))}(a):o.ZP.createElement("div",{className:"empty"},o.ZP.createElement("span",null,a("NoMessages")))})),$a=(0,C.Ds)((e=>e()),200,!1),Da=(0,o.X$)((0,a.c$)(((e,{chatId:t,threadId:n,type:a})=>{const s=(0,r.Z1)(e,t);if(!s)return{};const o=(0,r.$W)(e,t,n,a),i="scheduled"===a?(0,r.Fn)(e,t):(0,r.Zw)(e,t),c=(0,r.qS)(e,t,n);if(n!==u._f&&!(i&&c&&i[c]))return{};const{isRestricted:l,restrictionReason:m,lastMessage:h}=s,g=(0,r.G$)(e,t),p=n===u._f&&!o&&!s.unreadCount&&!g&&h&&!h.groupedId,f=(0,r.IK)(e,t);let I;return(0,r.pk)(e,t)&&(I=f.fullInfo?f.fullInfo.botDescription||"NoMessages":"Updating bot info..."),{isChatLoaded:!0,isRestricted:l,restrictionReason:m,isChannelChat:(0,d.eA)(s),isGroupChat:(0,d.Bf)(s),isCreator:s.isCreator,isChatWithSelf:(0,r.FM)(e,t),isRepliesChat:(0,d.pK)(t),isBot:Boolean(f),messageIds:o,messagesById:i,firstUnreadId:(0,r.It)(e,t,n),isViewportNewest:"thread"!==a||(0,r.b9)(e,t,n),threadFirstMessageId:(0,r.yZ)(e,t,n),focusingId:g,isSelectModeActive:(0,r.CA)(e),botDescription:I,threadTopMessageId:c,hasLinkedChat:s.fullInfo&&"linkedChatId"in s.fullInfo?Boolean(s.fullInfo.linkedChatId):void 0,lastSyncTime:e.lastSyncTime,...p&&{lastMessage:h}}}))((({chatId:e,threadId:t,type:n,hasTools:i,onFabToggle:c,onNotchToggle:l,isChatLoaded:u,isChannelChat:h,isGroupChat:p,canPost:f,isReady:I,isChatWithSelf:v,isRepliesChat:y,isCreator:Z,isBot:P,messageIds:w,messagesById:b,firstUnreadId:E,isViewportNewest:M,threadFirstMessageId:S,isRestricted:R,restrictionReason:k,focusingId:T,isSelectModeActive:N,lastMessage:B,botDescription:A,threadTopMessageId:x,hasLinkedChat:L,lastSyncTime:O,withBottomShift:U})=>{var F,$,D,j,Q,q;const{loadViewportMessages:G,setScrollOffset:H,loadSponsoredMessages:_,loadMessageReactions:z}=(0,a.uC)(),V=(0,o.sO)(null),Y=(0,o.sO)("thread"===n&&(0,r.Vt)((0,a.Rd)(),e,t)||0),X=(0,o.sO)(),W=(0,o.sO)(),K=(0,o.sO)(),J=(0,o.sO)(),ee=(0,o.sO)(),te=(0,o.sO)(),ne=(0,o.sO)(!1),ae=(0,o.sO)(Boolean(B)),[se,oe]=(0,o.eJ)(),ie=Boolean(w);(0,Ie.Z)((()=>{ie&&(0,C.R3)((()=>{ae.current=!1}))}),[ie]),(0,Ie.Z)((()=>{J.current=E}),[E]),(0,Ie.Z)((()=>{h&&I&&O&&_({chatId:e})}),[e,I,h,O]),(0,Ie.Z)((()=>{ie&&(ee.current=J.current)}),[ie]),(0,Ie.Z)((()=>{te.current=T}),[T]);const re=(0,o.Ye)((()=>{if(!w||!b)return;const e=!x||w[0]&&S!==w[0]?w:[x,...w];if(!e.length)return;const t=e.map((e=>b[e])).filter(Boolean);return an((0,g.Xo)(t,["date","id"]),ee.current)}),[w,b,S,x]);(0,dn.Z)((()=>{if(!w||!b)return;const t=w.filter((e=>{var t;return null===(t=b[e])||void 0===t?void 0:t.reactions}));t.length&&z({chatId:e,ids:t})}),15e3);const ce=(0,o.Ye)((()=>{if("thread"===n)return(0,C.Ds)((()=>G({direction:m.Uq.Around})),1e3,!0,!1)}),[G,w]),{isScrolled:ue,updateStickyDates:me}=function(){const[e,t]=(0,Ee.Z)(!1),n=(0,on.Z)(1e3,!0);return{isScrolled:e,updateStickyDates:(0,o.I4)(((e,a)=>{t(),document.body.classList.contains("is-scrolling-messages")||(0,C.T2)((()=>{document.body.classList.add("is-scrolling-messages")})),n((()=>{(0,C.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(ne.current)return void(ne.current=!1);he.current=!0;const a=V.current;te.current||me(a,i),$a((()=>{he.current=!1,(0,C.T2)((()=>{a.parentElement&&(Y.current=a.scrollHeight-a.scrollTop,"thread"===n&&H({chatId:e,threadId:t,scrollOffset:Y.current}))}))}))}),[me,i,n,H,e,t]);(0,o.d4)((()=>{if(!("ResizeObserver"in window))return;const e=new ResizeObserver((([e])=>{e.target.offsetParent&&oe(e.contentRect.height)}));return e.observe(V.current),()=>{e.disconnect()}}),[]);const{height:fe}=pt();(0,o.d4)((()=>{I&&(V.current.dataset.normalHeight=String(V.current.offsetHeight))}),[fe,I,f]),(0,o.d4)((()=>{if(!ce||!u||R||T)return;if(w&&w[w.length-1]>=s.AE)return;const e=V.current;(!w||w.length<s.hT/2&&e.firstElementChild.clientHeight<=e.offsetHeight)&&ce()}),[u,w,ce,T,R]),(0,Ie.Z)((()=>{if(!w||!K.current)return;const e=K.current.filter((e=>w.includes(Number(e.dataset.messageId)))),t=e[1]||e[0];t&&(X.current=t.id,W.current=t.getBoundingClientRect().top)}),[w,M,se,i]),(0,en.Z)((([e,t,n])=>{const a=V.current;K.current=Array.from(a.querySelectorAll(".message-list-item"));const o=w&&e&&w[w.length-1]!==e[e.length-1],r=(null==w?void 0:w[0])!==(null==e?void 0:e[0])&&(null==w?void 0:w.length)===s.hT/2+1,c=o&&!r,d=w&&te.current===w[w.length-1],l=M&&c&&w&&w.length<s.hT/2&&!a.parentElement.classList.contains("force-messages-scroll")&&a.firstElementChild.clientHeight<=2*a.offsetHeight;l&&(a.parentElement.classList.add("force-messages-scroll"),setTimeout((()=>{a.parentElement&&a.parentElement.classList.remove("force-messages-scroll")}),500));const{scrollTop:u,scrollHeight:m,offsetHeight:h}=a,g=Y.current,p=K.current[K.current.length-1];let f=g-(n||h);c&&(f-=p?p.offsetHeight:0);const I=M&&t&&f<=20;let v;if(c&&I&&!d&&(p&&(0,C.T2)((()=>{(0,cn.Z)(a,p,"end",20)})),v=m-h,Y.current=Math.max(Math.ceil(m-v),h),!l))return;const y=void 0!==n&&n!==se,Z=X.current&&a.querySelector(`#${X.current}`),P=!Z&&ee.current&&a.querySelector(".unread-divider");if(I&&y){if((0,cn.N)())return;v=m-h}else Z?(ge.current&&(ge.current=!1,(0,rn.z)(a)),v=u+(Z.getBoundingClientRect().top-(W.current||0))):v=P?Math.min(P.offsetTop-(i?60:10),m-g):m-g;(0,rn.Z)(a,Math.ceil(v)),te.current||(ne.current=!0,(0,C.T2)((()=>{ne.current=!1}))),Y.current=Math.max(Math.ceil(m-v),h)}),[w,M,se,i]),(0,tn.Z)((([e])=>{void 0!==e&&(0,de.YW)(200+s.fK)}),[N]);const ve=(0,Re.Z)(),ye=Boolean(e&&(0,d.YC)(e)),Ze=Boolean(!ye&&!h||v||y),Pe=Boolean(!Ze||h),Ce=(0,d.YC)(e)&&!v&&!P&&(!re&&!B&&w&&(!K.current||0===K.current.length)||1===(null==w?void 0:w.length)&&"contactSignUp"===(null==b||null===(F=b[w[0]])||void 0===F||null===($=F.content.action)||void 0===$?void 0:$.type)||"contactSignUp"===(null==B||null===(D=B.content)||void 0===D||null===(j=D.action)||void 0===j?void 0:j.type)),we=p&&Z&&1===(null==w?void 0:w.length)&&"chatCreate"===(null==b||null===(Q=b[w[0]])||void 0===Q||null===(q=Q.content.action)||void 0===q?void 0:q.type),be=(0,le.Z)("MessageList custom-scroll",Pe&&"no-avatars",!f&&"no-composer","pinned"===n&&"type-pinned",U&&"with-bottom-shift",N&&"select-mode-active",ue&&"scrolled",!I&&"is-animating");return o.ZP.createElement("div",{ref:V,className:be,onScroll:pe,onMouseDown:sn.q},R?o.ZP.createElement("div",{className:"empty"},o.ZP.createElement("span",null,k?k.text:"This is a private "+(h?"channel":"chat"))):A?o.ZP.createElement("div",{className:"empty"},o.ZP.createElement("span",null,(0,Rt.Z)(ve(A),["br","emoji","links"]))):Ce?o.ZP.createElement(Ua,{userId:e}):!w||re&&!we?w&&re||B?o.ZP.createElement(La,{chatId:e,messageIds:w||[B.id],messageGroups:re||an([B]),isViewportNewest:Boolean(M),isUnread:Boolean(E),withUsers:Ze,areReactionsInMeta:ye,noAvatars:Pe,containerRef:V,anchorIdRef:X,memoUnreadDividerBeforeIdRef:ee,memoFirstUnreadIdRef:J,threadId:t,type:n,isReady:I,isScrollingRef:he,isScrollPatchNeededRef:ge,threadTopMessageId:x,hasLinkedChat:L,isSchedule:!!re&&"scheduled"===n,noAppearanceAnimation:!re||!ae.current,onFabToggle:c,onNotchToggle:l}):o.ZP.createElement(Ye.Z,{color:"white"}):o.ZP.createElement(Fa,{chatId:e,type:n,isChatWithSelf:v,isGroupChatJustCreated:we}))}))),ja=(0,o.X$)((0,a.c$)((e=>{const t=(0,r.Bt)(e);if(!t)return{};const{chatId:n,threadId:a,type:s}=t,o=(0,r.Z1)(e,n);return{messageListType:s,unreadCount:o&&a===u._f&&"thread"===s?o.unreadCount:void 0}}))((({isShown:e,canPost:t,messageListType:n,unreadCount:s,withExtraShift:i})=>{const{focusNextReply:r}=(0,a.uC)(),c=(0,Re.Z)(),d=(0,o.sO)(null),l=(0,o.I4)((()=>{if(e)if("thread"===n)r();else{const e=d.current.parentElement.querySelector(".MessageList"),t=e.querySelectorAll(".message-list-item"),n=t[t.length-1];if(!n)return;(0,cn.Z)(e,n,"end",20)}}),[e,n,r]),u=(0,le.Z)("ScrollDownButton",e&&"revealed",!t&&"no-composer",i&&"with-extra-shift");return o.ZP.createElement("div",{ref:d,className:u},o.ZP.createElement("div",{className:"ScrollDownButton-inner"},o.ZP.createElement(xe.Z,{color:"secondary",round:!0,onClick:l,ariaLabel:c("AccDescrPageDown")},o.ZP.createElement("i",{className:"icon-arrow-down"})),Boolean(s)&&o.ZP.createElement("div",{className:"unread-count"},(0,Ct.bi)(s))))})));var Qa=n(5723);const qa=1280,Ga=/\.[^/.]+$/;async function Ha(e,t,n,a){const o=URL.createObjectURL(t),{type:i,size:r}=t;let c,d;if(s.oG.has(i))if(n){const t=await(0,gt.pt)(o),{width:n,height:s}=t;if(n>qa||s>qa||"image/jpeg"!==i){const t=await jt(o,qa/Math.max(n,s),"image/jpeg");return URL.revokeObjectURL(o),Ha(e,await(0,gt.gm)(t),!0,a)}"image/jpeg"===i&&(e=e.replace(Ga,".jpg")),c={width:n,height:s}}else d=o;else if(s.wG.has(i)){const{videoWidth:e,videoHeight:t,duration:n}=await(0,gt.jj)(o);c={width:e,height:t,duration:n},d=await(0,gt.ud)(o)}return{blobUrl:o,filename:e,mimeType:i,size:r,quick:c,previewBlobUrl:d,...a}}var _a=n(6391);let za;function Va(e){za.focus(),e.focus()}h.cj&&(za=document.createElement("input"),za.classList.add("for-ios-autocapitalization-fix"),document.body.appendChild(za));var Ya=n(4784),Xa=n(2400),Wa=n(6389);const Ka={encoderPath:n.p+"c0155344d336103c2b6a0b28cc510750.js",reuseWorker:!0},Ja={type:"audio/ogg"};let es,ts,ns;async function as(){return es||(es=n.e(161).then(n.t.bind(n,1161,23)),ts=(await es).default,ns=new ts(Ka)),es}async function ss(e){await async function(){await as(),await ns.start()}();const t=Date.now();let n;const a=[],s=[];ns.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}}(ns);return{stop:()=>new Promise(((e,i)=>{ns.onstop=()=>{e({blob:new Blob(a,Ja),duration:Math.round(((n||Date.now())-t)/1e3),waveform:s})},ns.onerror=i;const r=Math.max(0,t+1e3-Date.now());setTimeout((()=>{ns.stop(),o()}),r)})),pause:()=>{const e=Math.max(0,t+1e3-Date.now());setTimeout((()=>{ns.pause(),n=Date.now(),o()}),e)}}}const os=["image/png","image/jpeg","image/gif"];function is(e){const{text:t,entities:n}=e||{};if(!t)return"";const a=(0,gn.H)(t,n,void 0,void 0,!0);return Array.isArray(a)?a.join(""):a}let rs,cs;var ds=n(3575),ls=n(9295);function us(e,t,n){const a=(0,on.Z)(t,!0),[s,i]=(0,o.eJ)(),[r,c,d]=(0,Ee.Z)();return(0,de.ZP)(c,d),(0,Ie.Z)((()=>{r||a((()=>{i(e())}))}),[...n,r]),s}const ms=/^@([a-z0-9_]{1,32})[\u00A0\u0020]+(.*)/i,hs=/^@([a-z0-9_]{1,32})[\u00A0\u0020]+\n{2,}/i,gs=document.createElement("div");const ps=(0,C.P2)((e=>e()),500,!0),fs=/^[\w@]{1,32}\s?/i,Is=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Ve.Z)(ze.gl.Extra,"DeleteMessageModal",!t);return n?o.ZP.createElement(n,e):void 0}));function vs(){return(vs=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}).apply(this,arguments)}let ys,Zs=!0;const Ps=(0,o.X$)((({onActivate:e,...t})=>{const n=(0,o.sO)(!1),a=(0,o.I4)((()=>{if(n.current=!0,Zs)return Zs=!1,void e();ys&&(clearTimeout(ys),ys=void 0),ys=window.setTimeout((()=>{n.current&&e()}),200)}),[e]),s=(0,o.I4)((()=>{n.current=!1}),[]);return o.ZP.createElement(xe.Z,vs({},t,{onMouseEnter:h.$b?void 0:a,onMouseLeave:h.$b?void 0:s,onClick:h.$b?e:void 0}))})),Cs=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Ve.Z)(ze.gl.Extra,"AttachMenu",!t);return n?o.ZP.createElement(n,e):void 0})),ws=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Ve.Z)(ze.gl.Extra,"SymbolMenu",!t);return n?o.ZP.createElement(n,e):void 0})),bs=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Ve.Z)(ze.gl.Extra,"InlineBotTooltip",!t);return n?o.ZP.createElement(n,e):void 0})),Es=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Ve.Z)(ze.gl.Extra,"MentionTooltip",!t);return n?o.ZP.createElement(n,e):void 0})),Ms=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Ve.Z)(ze.gl.Extra,"CustomSendMenu",!t);return n?o.ZP.createElement(n,e):void 0})),Ss=e=>{const{isOpen:t}=e,n=(0,Ve.Z)(ze.gl.Extra,"StickerTooltip",!t);return n?o.ZP.createElement(n,e):void 0};var Rs=n(9830);const ks=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Ve.Z)(ze.gl.Extra,"BotCommandTooltip",!t);return n?o.ZP.createElement(n,e):void 0}));var Ts=n(6503);const Ns=(0,o.X$)((0,a.c$)(((e,{messageId:t})=>{const{chatId:n}=(0,r.Bt)(e)||{};return n?{message:(0,r.hj)(e,n,t)}:{}}))((({isOpen:e,message:t,onClose:n})=>{const{clickInlineButton:s}=(0,a.uC)(),[i,r]=(0,Ts.Z)(e,n),{isKeyboardSingleUse:c}=t||{},[d,l,u]=(0,Ee.Z)(!0),m=()=>{u(),n()};if((0,o.d4)((()=>{l()}),[l,null==t?void 0:t.keyboardButtons]),t&&t.keyboardButtons)return o.ZP.createElement(Ke.Z,{isOpen:e||d,autoClose:c,positionX:"right",positionY:"bottom",onClose:m,className:"BotKeyboardMenu",onCloseAnimationEnd:m,onMouseEnter:h.$b?void 0:i,onMouseLeave:h.$b?void 0:r},o.ZP.createElement("div",{className:"content"},t.keyboardButtons.map((e=>o.ZP.createElement("div",{className:"row"},e.map((e=>o.ZP.createElement(xe.Z,{ripple:!0,disabled:"NOT_SUPPORTED"===e.type,onClick:()=>s({button:e})},e.text))))))))})));var Bs=n(3616),As=n(7891);const xs=(0,o.X$)((0,a.c$)((e=>{const{chatId:t,threadId:n,type:a}=(0,r.Bt)(e)||{};if(!t||!n||!a)return{};const{currentUserId:s,forwardMessages:{fromChatId:o,toChatId:i,messageIds:c}}=e,l=(0,r.Yy)(e,t,n),u="scheduled"===a?(0,r.wU)(e,t):(0,r._$)(e,t,n),m=e.settings.byKey.animationLevel>=1,h=i===t;let g,p;if(l?g=(0,r.hj)(e,t,l):u?g=(0,r.kK)(e,t,n,a):h&&1===c.length&&(g=(0,r.hj)(e,o,c[0])),l&&g){const{forwardInfo:n}=g,a=t===s;n&&(n.isChannelPost||a)&&(p=(0,r.cv)(e,g)),p||(p=(0,r.Ur)(e,g))}else h&&(p=(0,d.YC)(o)?(0,r.dy)(e,o):(0,r.Z1)(e,o));return{replyingToId:l,editingId:u,message:g,sender:p,shouldAnimate:m,forwardedMessagesCount:h?c.length:void 0}}))((({replyingToId:e,editingId:t,message:n,sender:s,shouldAnimate:i,forwardedMessagesCount:r})=>{const{setReplyingToId:c,setEditingId:d,focusMessage:l,exitForwardMode:u}=(0,a.uC)(),m=Boolean((e||t)&&n||s&&r),h=(0,As.Z)([r],r?300:void 0),{shouldRender:g,transitionClassNames:p}=(0,ge.Z)(h&&m,void 0,!i,void 0,!i),f=(0,o.I4)((()=>{e?c({messageId:void 0}):t?d({messageId:void 0}):r&&u()}),[e,t,r,c,d,u]);(0,o.d4)((()=>m?(0,Ce.Z)(f):void 0),[m,f]);const I=(0,o.I4)((()=>{l({chatId:n.chatId,messageId:n.id})}),[l,n]),v=(0,le.Z)("ComposerEmbeddedMessage",p),y=r&&r>1?`${r} forwarded messages`:void 0;if(g)return o.ZP.createElement("div",{className:v},o.ZP.createElement("div",null,o.ZP.createElement(xe.Z,{round:!0,faded:!0,color:"translucent",ariaLabel:"Cancel replying",onClick:f},o.ZP.createElement("i",{className:"icon-close"})),o.ZP.createElement(xn,{className:"inside-input",message:n,sender:s,customText:y,title:t?"Edit Message":void 0,onClick:I})))}))),Ls=(0,o.X$)((e=>{const{attachments:t}=e,n=(0,Ve.Z)(ze.gl.Extra,"AttachmentModal",!t.length);return n?o.ZP.createElement(n,e):void 0})),Os=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Ve.Z)(ze.gl.Extra,"BotCommandMenu",!t);return n?o.ZP.createElement(n,e):void 0})),Us=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Ve.Z)(ze.gl.Extra,"PollModal",!t);return n?o.ZP.createElement(n,e):void 0})),Fs=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Ve.Z)(ze.gl.Extra,"DropArea",!t);return n?o.ZP.createElement(n,e):void 0})),$s=new RegExp(s.FM,"i"),Ds=(0,o.X$)((0,a.c$)(((e,{chatId:t,threadId:n})=>{const a=(0,r.tV)(e,t,n);return{theme:(0,r.Pu)(e),webPagePreview:e.webPagePreview,noWebPage:a}}))((({chatId:e,threadId:t,messageText:n,disabled:s,webPagePreview:i,noWebPage:r,theme:c})=>{const{loadWebPagePreview:d,clearWebPagePreview:l,toggleMessageWebPage:m}=(0,a.uC)(),h=us((()=>{const{text:e,entities:t}=(0,f.Z)(n),a=t&&t.find((({type:e})=>e===u.Vv.TextUrl));if(a)return a.url;const s=e.match($s);return s?s[0]:void 0}),300,[n]);(0,o.d4)((()=>{h?d({text:h}):(l(),m({chatId:e,threadId:t}))}),[e,m,l,h,d,t]),(0,Ie.Z)((()=>{l(),m({chatId:e,threadId:t})}),[e]);const g=Boolean(i&&n.length&&!r&&!s),{shouldRender:p,transitionClassNames:I}=(0,ge.Z)(g),v=(0,Pt.Z)(i,!0);if(!p||!v)return;const{photo:y,...Z}=v,P={content:{webPage:Z}};return o.ZP.createElement("div",{className:(0,le.Z)("WebPagePreview",I)},o.ZP.createElement("div",null,o.ZP.createElement(xe.Z,{round:!0,faded:!0,color:"translucent",ariaLabel:"Clear Webpage Preview",onClick:()=>{m({chatId:e,threadId:t,noWebPage:!0})}},o.ZP.createElement("i",{className:"icon-close"})),o.ZP.createElement(ga,{message:P,inPreview:!0,theme:c})))})));var js=n(2898),Qs=n(2531);const qs=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Ve.Z)(ze.gl.Extra,"SendAsMenu",!t);return n?o.ZP.createElement(n,e):void 0}));var Gs;!function(e){e.Send="send",e.Record="record",e.Edit="edit",e.Schedule="schedule"}(Gs||(Gs={}));const Hs=(0,o.X$)((0,a.c$)(((e,{chatId:t,threadId:n,messageListType:a})=>{var o,i,c,l;const m=(0,r.Z1)(e,t),h=m&&(0,r.Dg)(e,m),g=t!==s.FV?(0,r.IK)(e,t):void 0,p=Boolean(g),f=(0,r.FM)(e,t),I=p&&(0,r.FT)(e,t),v=(0,r.qy)(e,t),{language:y,shouldSuggestStickers:Z}=e.settings.byKey,P=e.emojiKeywords[s.pR],C=y!==s.pR?e.emojiKeywords[y]:void 0,w=I?I.id:void 0,b=w?(0,r.hj)(e,t,w):void 0,E=e.users.byId,M=e.chats.byId,{currentUserId:S}=e,R=null!=m&&m.fullInfo?(null==m||null===(o=m.fullInfo)||void 0===o?void 0:o.sendAsId)||S:void 0,k=R?null==E?void 0:E[R]:void 0,T=!k&&R?null==M?void 0:M[R]:void 0;return{editingMessage:(0,r.kK)(e,t,n,a),connectionState:e.connectionState,draft:(0,r.Ms)(e,t,n),chat:m,isChatWithBot:p,isChatWithSelf:f,canScheduleUntilOnline:Boolean(!f&&!p&&m&&h&&(0,d.YC)(t)&&(null===(i=(0,r.ss)(e,t))||void 0===i?void 0:i.wasOnline)),isRightColumnShown:(0,r.Jf)(e),isSelectModeActive:(0,r.CA)(e),withScheduledButton:n===u._f&&"thread"===a&&Boolean(null==v?void 0:v.length),shouldSchedule:"scheduled"===a,botKeyboardMessageId:w,botKeyboardPlaceholder:null==b?void 0:b.keyboardPlaceholder,isForwarding:t===e.forwardMessages.toChatId,isPollModalOpen:e.isPollModalOpen,stickersForEmoji:e.stickers.forEmoji.stickers,groupChatMembers:null==m||null===(c=m.fullInfo)||void 0===c?void 0:c.members,topInlineBotIds:null===(l=e.topInlineBots)||void 0===l?void 0:l.userIds,currentUserId:S,usersById:E,lastSyncTime:e.lastSyncTime,contentToBeScheduled:e.messages.contentToBeScheduled,shouldSuggestStickers:Z,recentEmojis:e.recentEmojis,baseEmojiKeywords:null==P?void 0:P.keywords,emojiKeywords:null==C?void 0:C.keywords,serverTimeOffset:e.serverTimeOffset,inlineBots:e.inlineBots.byUsername,isInlineBotLoading:e.inlineBots.isLoading,chatBotCommands:m&&m.fullInfo&&m.fullInfo.botCommands,botCommands:g&&g.fullInfo?g.fullInfo.botCommands||!1:void 0,sendAsUser:k,sendAsChat:T,sendAsId:R}}))((({dropAreaState:e,shouldSchedule:t,canScheduleUntilOnline:n,isReady:i,onDropHide:r,editingMessage:c,chatId:l,threadId:m,messageListType:g,draft:I,chat:v,connectionState:y,isChatWithBot:Z,isChatWithSelf:P,isRightColumnShown:w,isSelectModeActive:b,isForwarding:E,isPollModalOpen:M,botKeyboardMessageId:S,botKeyboardPlaceholder:R,withScheduledButton:k,stickersForEmoji:T,groupChatMembers:B,topInlineBotIds:A,currentUserId:x,usersById:L,lastSyncTime:O,contentToBeScheduled:U,shouldSuggestStickers:F,baseEmojiKeywords:$,emojiKeywords:D,serverTimeOffset:j,recentEmojis:Q,inlineBots:q,isInlineBotLoading:G,botCommands:H,chatBotCommands:_,sendAsUser:z,sendAsChat:V,sendAsId:X})=>{const{sendMessage:W,clearDraft:K,showDialog:J,setStickerSearchQuery:ee,setGifSearchQuery:te,forwardMessages:ne,openPollModal:ae,closePollModal:se,loadScheduledHistory:oe,openChat:ie,addRecentEmoji:re,sendInlineBotResult:ce,loadSendAs:de}=(0,a.uC)(),ue=(0,Re.Z)(),me=(0,o.sO)(null),[he,ge]=(0,o.eJ)(""),ve=(0,o.sO)(),ye=(0,It.Z)(e),[Ze,Pe,we]=(0,Ee.Z)(),[be,Me]=(0,o.eJ)(),{width:Se}=Y.Z.get(),ke=null==v?void 0:v.sendAsIds,Te=(0,Wa.Z)(l,m),Ne=(0,o.sO)(he);(0,o.d4)((()=>{Ne.current=he}),[he]),(0,o.d4)((()=>{ve.current=void 0}),[l]),(0,o.d4)((()=>{l&&O&&m===u._f&&i&&oe({chatId:l})}),[i,l,oe,O,m]),(0,o.d4)((()=>{l&&v&&O&&!ke&&i&&(0,d.ZV)(v)&&de({chatId:l})}),[v,l,i,O,de,ke]);const Be=(0,o.sO)(!1);(0,Ie.Z)((([e,t])=>{Be.current=Boolean(l===e&&ke&&!t)}),[l,ke]),(0,o.bt)((()=>{me.current&&(me.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>')}),[]),(0,o.d4)((()=>{U&&(Me(U),Pe())}),[U,Pe]);const[Ae,Le]=(0,o.eJ)([]),[Oe,Ue,Fe]=(0,Ee.Z)(),[$e,je,Qe]=(0,Ee.Z)(),[qe,Ge,He]=(0,Ee.Z)(),[_e,ze,Ve]=(0,Ee.Z)(),[Ye,Xe,We]=(0,Ee.Z)(),[Ke,Je,et]=(0,Ee.Z)(),[tt,nt]=(0,Ee.Z)(),[at,st,ot]=(0,Ee.Z)(),{startRecordingVoice:it,stopRecordingVoice:rt,pauseRecordingVoice:ct,activeVoiceRecording:dt,currentRecordTime:lt,recordButtonRef:mt,startRecordTimeRef:ht}=(()=>{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&&as()}),[]);const r=(0,o.I4)((async()=>{try{const{stop:t,pause:s}=await ss((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]),d=(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,Ce.Z)(d):void 0),[t,d]),{startRecordingVoice:r,pauseRecordingVoice:c,stopRecordingVoice:d,activeVoiceRecording:t,currentRecordTime:s,recordButtonRef:e,startRecordTimeRef:a}})();(0,dn.Z)((()=>{Te({type:"recordAudio"})}),dt&&s.o_),(0,o.d4)((()=>{dt||Te({type:"cancel"})}),[dt,Te]);const gt=c?Gs.Edit:!h.mh||dt||he&&!Ae.length||E?t?Gs.Schedule:Gs.Send:Gs.Record,pt=!t,{isMentionTooltipOpen:ft,closeMentionTooltip:vt,insertMention:yt,mentionFilteredUsers:Zt}=(0,ls.Z)(!Ae.length,he,ge,void 0,B,A,x),{isOpen:Pt,id:Ct,isGallery:wt,switchPm:bt,results:Et,closeTooltip:Mt,help:St,loadMore:kt}=function(e,t,n,s){const{queryInlineBot:i,resetInlineBot:r}=(0,a.uC)(),[c,d,l]=(0,Ee.Z)(),{username:u,query:m,canShowHelp:h,usernameLowered:g}=us((()=>function(e){const t=function(e){return gs.innerHTML=e.replace(/<br>/g,"\n"),gs.innerText}(e),n=t.match(ms);return n?{username:n[1],query:n[2],canShowHelp:""===n[2]&&!t.match(hs),usernameLowered:n[1].toLowerCase()}:{username:"",query:"",canShowHelp:!1,usernameLowered:""}}(n)),300,[n])||{},p=(0,It.Z)(m),f=(0,It.Z)(u),I=g?null==s?void 0:s[g]:void 0,{id:v,switchPm:y,offset:Z,results:P,isGallery:C,help:w}=I||{};(0,o.d4)((()=>{p!==m&&l()}),[p,m,l]),(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:Z})}),[Z,t,m,i,g]);return(0,o.d4)((()=>{e&&v&&(y||null!=P&&P.length)?d():l()}),[v,e,d,P,y,l]),f!==u&&r({username:f}),{isOpen:c,id:v,isGallery:C,switchPm:y,results:P,closeTooltip:l,help:h&&w?`@${u} ${w}`:void 0,loadMore:b}}(Boolean(!Ae.length&&O),l,he,q),{isOpen:Tt,close:Nt,filteredBotCommands:Bt}=function(e,t,n,a){const[s,i,r]=(0,Ee.Z)(),[c,d]=(0,o.eJ)(),l=(0,o.I4)((e=>{n||a?ps((()=>{const t=(n||a||[]).filter((({command:t})=>!e||t.includes(e)));d(t&&t.length?t:void 0)})):d(void 0)}),[n,a]);return(0,o.d4)((()=>{if(e&&t.length)if(t.startsWith("/")){const e=(0,Xa._)(t.substr(1)).match(fs);l(e?e[0]:"")}else r();else r()}),[l,t,e,r]),(0,o.d4)((()=>{c&&c.length?i():r()}),[c,i,r]),{isOpen:s,close:r,filteredBotCommands:c}}(Boolean(H&&H.length||_&&_.length),he,H,_),{isContextMenuOpen:At,handleContextMenu:xt,handleContextMenuClose:Lt,handleContextMenuHide:Ot}=(0,hn.Z)(mt,!(gt===Gs.Send&&pt)),Ut=(0,o.Ye)((()=>(0,d.H5)(v,Z)),[v,Z]),Ft=v&&(0,d.Nl)(v),$t=(0,d.Hd)(v),{isStickerTooltipOpen:Dt,closeStickerTooltip:jt}=function(e,t,n,s=!1){const i=(0,o.Ye)((()=>(0,Xa._)(t).trim()),[t]),{loadStickersForEmoji:r,clearStickersForEmoji:c}=(0,a.uC)(),d=h.op&&1===(0,Ya.Z)(i)||!h.op&&Boolean(t.match(/^<img.[^>]*?>$/g)),l=Boolean(n)&&d;return(0,o.d4)((()=>{var t;s||(e&&d?r({emoji:h.op?i:null===(t=i.match(/alt="(.+)"/))||void 0===t?void 0:t[1]}):!l&&d||c())}),[t,d,c,r,e,s]),{isStickerTooltipOpen:l,closeStickerTooltip:c}}(Boolean(F&&Ut.canSendStickers&&!Ae.length),he,T,!i),{isEmojiTooltipOpen:Qt,closeEmojiTooltip:qt,filteredEmojis:Gt,insertEmoji:Ht}=(0,ds.Z)(Boolean(F&&Ut.canSendStickers&&!Ae.length),he,Q,void 0,ge,$,D,!i),_t=(0,o.I4)(((e,t=s.R2)=>{const n=window.getSelection(),a=document.getElementById(t),o=(0,Rt.Z)(e,["escape_html","emoji_html","br_html"]).join("").replace(/\u200b+/g,"");if(n.rangeCount){const e=n.getRangeAt(0);if((0,_a.R)(e,t))return function(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)}}(o),void a.dispatchEvent(new Event("input",{bubbles:!0}))}ge(`${Ne.current}${o}`),requestAnimationFrame((()=>{(0,Qa.Z)(a)}))}),[]),zt=(0,o.I4)((()=>{const e=window.getSelection();if(e.rangeCount){const t=e.getRangeAt(0);if((0,_a.R)(t,s.R2))return void document.execCommand("delete",!1)}ge(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}(Ne.current))}),[]),Vt=(0,o.I4)(((e=!1)=>{e||ge(""),Le([]),jt(),we(),Me(void 0),vt(),qt(),h.wB?setTimeout((()=>Ve()),350):Ve()}),[jt,we,vt,qt,Ve]),Yt=(0,o.sO)();Yt.current=rt,(0,o.d4)((()=>()=>{Yt.current(),Vt()}),[l,Vt,Yt]);const Xt=((e,t,n,i,r)=>{const{editMessage:c}=(0,a.uC)();return(0,o.d4)((()=>{n?(t(is(n.content.text)),requestAnimationFrame((()=>{const e=document.getElementById(s.R2);(0,Qa.Z)(e,!0)}))):t("")}),[n,t]),(0,o.I4)((()=>{const{text:t,entities:a}=(0,f.Z)(e.current);n&&(t||(0,d.u8)(n)?(c({messageId:n.id,text:t,entities:a}),i()):r())}),[c,n,e,r,i])})(Ne,ge,c,Vt,Je);((e,t,n,i,r,c,d)=>{const{saveDraft:l,clearDraft:u}=(0,a.uC)(),m=(0,o.I4)(((e,t)=>{r.current.length&&!d?l({chatId:e,threadId:t,draft:(0,f.Z)(r.current)}):u({chatId:e,threadId:t})}),[u,d,r,l]),g=(0,o.Ye)((()=>(0,C.Ds)((e=>e()),s.r_,!1)),[t]),p=(0,It.Z)(t),I=(0,It.Z)(n);(0,o.d4)((()=>(rs=t,cs=n,()=>{rs=void 0,cs=void 0,m(t,n)})),[t,n,m]),(0,o.d4)((()=>{t===p&&n===I||e&&(c(is(e)),h.$b||requestAnimationFrame((()=>{const e=document.getElementById(s.R2);(0,Qa.Z)(e,!0)})))}),[t,n,e,c,m,p,I]);const v=(0,It.Z)(i);(0,o.d4)((()=>{t&&n&&p===t&&I===n&&v!==i&&(i.length?g((()=>{rs===t&&cs===n&&m(t,n)})):m(t,n))}),[t,i,p,v,I,g,n,m]);const y=(0,o.I4)((()=>{t&&n&&m(t,n)}),[t,n,m]);(0,pe.Z)(y),fe(y)})(I,l,m,he,Ne,ge,c),((e,t,n)=>{(0,o.d4)((()=>{async function a(a){if(!a.clipboardData)return;const o=document.activeElement;if(o&&![s.R2,s.nY].includes(o.id))return;const{items:i}=a.clipboardData,r=Array.from(i).find((e=>os.includes(e.type)&&"file"===e.kind)),c=r&&r.getAsFile(),d=a.clipboardData.getData("text").substring(0,4096);if(a.preventDefault(),c||d){if(c&&!n){const e=await Ha(c.name,c,!0);t((t=>[...t,e]))}d&&e(d,null==o?void 0:o.id)}}return document.addEventListener("paste",a,!1),()=>{document.removeEventListener("paste",a,!1)}}),[e,n,t])})(_t,Le,c);const Kt=(0,o.I4)((async(e,t)=>{Le(await Promise.all(e.map((e=>Ha(e.name,e,t)))))}),[]),Jt=(0,o.I4)((async(e,t)=>{Le([...Ae,...await Promise.all(e.map((e=>Ha(e.name,e,t))))])}),[Ae]),en=(0,o.I4)((()=>{Le([])}),[]),tn=(0,o.I4)((async(e=!1,t)=>{if("connectionStateReady"!==y)return;let n=Ae;if(dt){const e=await rt();if(e){const{blob:t,duration:a,waveform:s}=e;n=[await Ha("wonderful-voice-message.ogg",t,!1,{voice:{duration:a,waveform:s}})]}}const{text:a,entities:o}=(0,f.Z)(Ne.current);if(!n.length&&!a&&!E)return;const i=n.length?1024:4096;if((null==a?void 0:a.length)>i){const e=a.length-i;return void J({data:{message:"MESSAGE_TOO_LONG_PLEASE_REMOVE_CHARACTERS",textParams:{"{EXTRA_CHARS_COUNT}":e,"{PLURAL_S}":e>1?"s":""},hasErrorKey:!0}})}const r=document.getElementById(s.R2);if(n.length||a){if($t&&!Ft){const e=(0,p.b)(j),t=ve.current&&Math.floor(e-ve.current),n=$t.nextSendDate&&$t.nextSendDate>e;if(t&&t<$t.seconds||n){const a=n?$t.nextSendDate-e:$t.seconds-t;return J({data:{message:ue("SlowModeHint",(0,N.k9)(a)),isSlowMode:!0,hasErrorKey:!1}}),void r.blur()}}W({text:a,entities:o,attachments:n,scheduledAt:t,isSilent:e})}E&&ne({scheduledAt:t,isSilent:e}),ve.current=(0,p.b)(j),K({chatId:l,localOnly:!0}),h.cj&&r===document.activeElement&&Va(r),requestAnimationFrame((()=>{Vt()}))}),[y,Ae,dt,E,K,l,j,Vt,rt,J,$t,Ft,W,ne,ue]),nn=(0,o.I4)((()=>{Ve(),je()}),[Ve,je]),an=(0,o.I4)((()=>{Qe(),We(),ze()}),[Qe,We,ze]),sn=(0,o.I4)(((e,n=!1)=>{e={...e,isPreloadedGlobally:!0},t?(Me({sticker:e}),Pe()):(W({sticker:e}),requestAnimationFrame((()=>{Vt(n)})))}),[t,Pe,W,Vt]),on=(0,o.I4)((e=>{t?(Me({gif:e}),Pe()):(W({gif:e}),requestAnimationFrame((()=>{Vt(!0)})))}),[t,Pe,W,Vt]),rn=(0,o.I4)((e=>{if("connectionStateReady"!==y)return;ce({id:e.id,queryId:e.queryId});const t=document.getElementById(s.R2);h.cj&&t===document.activeElement&&Va(t),K({chatId:l,localOnly:!0}),requestAnimationFrame((()=>{Vt()}))}),[l,K,y,Vt,ce]),cn=(0,o.I4)((()=>{K({chatId:l,localOnly:!0}),requestAnimationFrame((()=>{Vt()}))}),[l,K,Vt]),ln=(0,o.I4)((e=>{t?(Me({poll:e}),se(),Pe()):(W({poll:e}),se())}),[se,Pe,W,t]),un=(0,o.I4)((()=>{t?(Me({isSilent:!0}),Pe()):tn(!0)}),[tn,Pe,t]),mn=(0,o.I4)(((e,t=!1)=>{const{isSilent:n,...a}=be||{},s=Math.round(Math.max(e.getTime(),Date.now()+6e4)/1e3)+(t?0:j);be&&0!==Object.keys(a).length?(W({...be,scheduledAt:s}),requestAnimationFrame((()=>{Vt()}))):tn(!!n,s),we()}),[we,tn,Vt,be,W,j]),gn=(0,o.I4)((()=>{mn(new Date(1e3*s.t4),!0)}),[mn]),pn=(0,o.I4)((()=>{we(),Me(void 0)}),[we]),fn=(0,o.I4)((e=>{"stickers"===e?(ee({query:""}),te({query:void 0})):(te({query:""}),ee({query:void 0}))}),[ee,te]),In=(0,o.I4)((()=>{const e=document.getElementById(s.R2);h.wB&&e===document.activeElement?(e.blur(),setTimeout((()=>{Qe(),ze()}),100)):ze()}),[ze,Qe]),vn=(0,o.I4)((()=>{const e=document.getElementById(s.R2);if(!h.wB||e!==document.activeElement)return Qe(),Ve(),void Xe();e.blur(),setTimeout((()=>{Qe(),Ve(),Xe()}),100)}),[Qe,Ve,Xe]),yn=(0,o.I4)((()=>{ie({id:l,threadId:m,type:"scheduled"})}),[ie,l,m]);(0,o.d4)((()=>{w&&h.wB&&Ve()}),[w,Ve]),(0,o.d4)((()=>{i&&(b?st():setTimeout((()=>{ot()}),200))}),[b,ot,st,i]);const Zn=(0,o.I4)((()=>{switch(gt){case Gs.Send:tn();break;case Gs.Record:it();break;case Gs.Edit:Xt();break;case Gs.Schedule:dt&&ct(),Pe()}}),[gt,tn,it,Xt,dt,Pe,ct]),Pn=gt===Gs.Record&&!Ut.canAttachMedia,Cn=(0,It.Z)(c,!0),wn=c||Cn,bn=new Date;bn.setSeconds(0),bn.setMilliseconds(0);const En=new Date;En.setFullYear(En.getFullYear()+1);let Mn="SendMessage";switch(gt){case Gs.Edit:Mn="Save edited message";break;case Gs.Record:Mn=Pn?"Conversation.DefaultRestrictedMedia":"AccDescrVoiceMessage"}const Sn=(0,le.Z)("Composer",!b&&"shown",at&&"hover-disabled"),Rn=(0,le.Z)("mobile-symbol-menu-button",!i&&"not-ready",tt?_e&&"menu-opened":_e&&"is-loading"),kn=gt===Gs.Edit?Xt:gt===Gs.Schedule?Pe:tn;return o.ZP.createElement("div",{className:Sn},Ut.canAttachMedia&&i&&o.ZP.createElement(js.Z,{containerId:"#middle-column-portals"},o.ZP.createElement(Fs,{isOpen:e!==ut.t.None,withQuick:[e,ye].includes(ut.t.QuickFile),onHide:r,onFileSelect:Kt})),o.ZP.createElement(Ls,{chatId:l,threadId:m,attachments:Ae,caption:Ae.length?he:"",groupChatMembers:B,currentUserId:x,usersById:L,recentEmojis:Q,isReady:i,onCaptionUpdate:ge,baseEmojiKeywords:$,emojiKeywords:D,addRecentEmoji:re,onSend:t?Pe:tn,onFileAppend:Jt,onClear:en}),o.ZP.createElement(Us,{isOpen:Boolean(M),onClear:se,onSend:ln}),wn&&o.ZP.createElement(Is,{isOpen:Ke,isSchedule:"scheduled"===g,onClose:et,message:wn}),o.ZP.createElement(qs,{isOpen:Ye,onClose:We,chatId:l,selectedSendAsId:X,sendAsIds:ke}),o.ZP.createElement(Es,{isOpen:ft,onClose:vt,onInsertUserName:yt,filteredUsers:Zt,usersById:L}),o.ZP.createElement(bs,{isOpen:Pt,botId:Ct,allowedAttachmentOptions:Ut,isGallery:wt,inlineBotResults:Et,switchPm:bt,onSelectResult:rn,loadMore:kt,onClose:Mt}),o.ZP.createElement(ks,{isOpen:Tt,withUsername:Boolean(_),botCommands:Bt,onClick:cn,onClose:Nt}),o.ZP.createElement("div",{id:"message-compose"},o.ZP.createElement("div",{className:"svg-appendix",ref:me}),o.ZP.createElement(xs,null),o.ZP.createElement(Ds,{chatId:l,threadId:m,messageText:Ae.length?"":he,disabled:!Ut.canAttachEmbedLinks}),o.ZP.createElement("div",{className:"message-input-wrapper"},Z&&!1!==H&&!dt&&!c&&o.ZP.createElement(Ps,{className:(0,le.Z)("bot-commands",$e&&"activated"),round:!0,disabled:void 0===H,color:"translucent",onActivate:nn,ariaLabel:"Open bot command keyboard"},o.ZP.createElement("i",{className:"icon-bot-commands-filled"})),!(null==ke||!ke.length)&&(z||V)&&o.ZP.createElement(xe.Z,{round:!0,color:"translucent",onClick:Ye?We:vn,ariaLabel:ue("SendMessageAsTitle"),className:(0,le.Z)("send-as-button",Be.current&&"appear-animation")},o.ZP.createElement(Wt.Z,{user:z,chat:V,size:"tiny"})),h.wB?o.ZP.createElement(xe.Z,{className:Rn,round:!0,color:"translucent",onClick:_e?Ve:In,ariaLabel:"Choose emoji, sticker or GIF"},o.ZP.createElement("i",{className:"icon-smile"}),o.ZP.createElement("i",{className:"icon-keyboard"}),_e&&!tt&&o.ZP.createElement(De.Z,{color:"gray"})):o.ZP.createElement(Ps,{className:_e?"activated":"",round:!0,color:"translucent",onActivate:an,ariaLabel:"Choose emoji, sticker or GIF"},o.ZP.createElement("i",{className:"icon-smile"})),o.ZP.createElement(Bs.Z,{id:"message-input-text",chatId:l,threadId:m,html:Ae.length?"":he,placeholder:dt&&Se<=600?"":R||ue("Message"),forcedPlaceholder:St,canAutoFocus:i&&!Ae.length,shouldSuppressFocus:h.wB&&_e,shouldSuppressTextFormatter:Qt||ft||Pt,onUpdate:ge,onSend:kn,onSuppressedFocus:Ve}),G&&Boolean(Ct)&&o.ZP.createElement(De.Z,{color:"gray"}),k&&o.ZP.createElement(xe.Z,{round:!0,faded:!0,className:"scheduled-button",color:"translucent",onClick:yn,ariaLabel:"Open scheduled messages"},o.ZP.createElement("i",{className:"icon-schedule"})),S&&!dt&&!c&&o.ZP.createElement(Ps,{className:Oe?"activated":"",round:!0,color:"translucent",onActivate:Ue,ariaLabel:"Open bot command keyboard"},o.ZP.createElement("i",{className:"icon-bot-command"})),!dt&&!c&&o.ZP.createElement(Ps,{className:qe?"activated":"",round:!0,color:"translucent",onActivate:Ge,ariaLabel:"Add an attachment"},o.ZP.createElement("i",{className:"icon-attach"})),dt&<&&o.ZP.createElement("span",{className:"recording-state"},(0,N.rM)(lt-ht.current)),o.ZP.createElement(Ss,{chatId:l,threadId:m,isOpen:Dt,onStickerSelect:sn}),o.ZP.createElement(Rs.Z,{isOpen:Qt,emojis:Gt,onClose:qt,onEmojiSelect:Ht,addRecentEmoji:re}),o.ZP.createElement(Cs,{isOpen:qe,allowedAttachmentOptions:Ut,onFileSelect:Kt,onPollCreate:ae,onClose:He}),S&&o.ZP.createElement(Ns,{messageId:S,isOpen:Oe,onClose:Fe}),H&&o.ZP.createElement(Os,{isOpen:$e,botCommands:H,onClose:Qe}),o.ZP.createElement(ws,{chatId:l,threadId:m,isOpen:_e,allowedAttachmentOptions:Ut,onLoad:nt,onClose:Ve,onEmojiSelect:_t,onStickerSelect:sn,onGifSelect:on,onRemoveSymbol:zt,onSearchOpen:fn,addRecentEmoji:re}))),dt&&o.ZP.createElement(xe.Z,{round:!0,color:"danger",className:"cancel",onClick:rt,ariaLabel:"Cancel voice recording"},o.ZP.createElement("i",{className:"icon-delete"})),o.ZP.createElement(xe.Z,{ref:mt,round:!0,color:"secondary",className:(0,le.Z)(gt,!i&&"not-ready",dt&&"recording"),disabled:Pn,ariaLabel:ue(Mn),onClick:Zn,onContextMenu:gt===Gs.Send&&pt?xt: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"})),pt&&o.ZP.createElement(Ms,{isOpen:At,onSilentSend:P?void 0:un,onScheduleSend:t?void 0:Pe,onClose:Lt,onCloseAnimationEnd:Ot}),o.ZP.createElement(Qs.Z,{isOpen:Ze,withTimePicker:!0,selectedAt:bn.getTime(),maxAt:(0,N._F)(En),isFutureMode:!0,secondButtonLabel:n?ue("Schedule.SendWhenOnline"):void 0,onClose:pn,onSubmit:mn,onSecondButtonClick:n?gn:void 0}))}))),_s=(0,o.X$)((e=>{const{isActive:t}=e,n=(0,Ve.Z)(ze.gl.Extra,"MobileSearch",!t,!0);return n?o.ZP.createElement(n,e):void 0})),zs=(0,o.X$)((e=>{const{isActive:t}=e,n=(0,Ve.Z)(ze.gl.Extra,"MessageSelectToolbar",!t);return n?o.ZP.createElement(n,e):void 0})),Vs=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Ve.Z)(ze.gl.Extra,"UnpinAllMessagesModal",!t);return n?o.ZP.createElement(n,e):void 0})),Ys=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Ve.Z)(ze.gl.Extra,"PaymentModal",!t);return n?o.ZP.createElement(n,e):void 0})),Xs=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Ve.Z)(ze.gl.Extra,"ReceiptModal",!t);return n?o.ZP.createElement(n,e):void 0})),Ws=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Ve.Z)(ze.gl.Extra,"SeenByModal",!t);return n?o.ZP.createElement(n,e):void 0})),Ks=(0,o.X$)((e=>{const{emojiInteraction:t}=e,n=(0,Ve.Z)(ze.gl.Extra,"EmojiInteractionAnimation",!t);return n?o.ZP.createElement(n,e):void 0})),Js=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Ve.Z)(ze.gl.Extra,"ReactorListModal",!t);return n?o.ZP.createElement(n,e):void 0})),eo=h.wB?450+s.fK:void 0;function to(e){return"file"===e.kind&&e.type&&s.oG.has(e.type)}const no=(0,o.X$)((0,a.c$)((e=>{const t=(0,r.Pu)(e),{isBlurred:n,background:a,backgroundColor:s,patternColor:o}=e.settings.themes[t]||{},{messageLists:i}=e.messages,c=(0,r.Bt)(e),{isLeftColumnShown:l,chats:{listIds:m},activeEmojiInteraction:g}=e,p={theme:t,customBackground:a,backgroundColor:s,patternColor:o,isLeftColumnShown:l,isRightColumnShown:(0,r.Jf)(e),isBackgroundBlurred:n,isMobileSearchActive:Boolean(h.wB&&(0,r.n5)(e)),isSelectModeActive:(0,r.CA)(e),isPaymentModalOpen:e.payment.isPaymentModalOpen,isReceiptModalOpen:Boolean(e.payment.receipt),isSeenByModalOpen:Boolean(e.seenByModal),isReactorListModalOpen:Boolean(e.reactorModal),animationLevel:e.settings.byKey.animationLevel,currentTransitionKey:Math.max(0,e.messages.messageLists.length-1),activeEmojiInteraction:g};if(!c||!m.active)return p;const{chatId:f,threadId:I,type:v}=c,y=(0,r.Z1)(e,f),Z=(0,r.IK)(e,f),P=(0,r.KB)(e,f),{chatId:C,messageId:w}=e.audioPlayer,b=y&&(0,d.Qm)(y,I),E=(0,r.pk)(e,f),M="pinned"===v,S="scheduled"===v,R="thread"===v&&I===u._f,k=Boolean(y&&(0,d.eA)(y)),T=Boolean(y&&R&&(k||(0,d.ZV)(y))&&y.isNotJoined),N=Boolean(Z&&(0,r.s4)(e,Z.id)),B=!N&&E;return{...p,chatId:f,threadId:I,messageListType:v,isPrivate:(0,d.YC)(f),canPost:!M&&(!y||b)&&!E,isPinnedMessageList:M,isScheduledMessageList:S,currentUserBannedRights:null==y?void 0:y.currentUserBannedRights,defaultBannedRights:null==y?void 0:y.defaultBannedRights,hasPinnedOrAudioPlayer:I!==u._f||Boolean(!M&&(null==P?void 0:P.length))||Boolean(C&&w),pinnedMessagesCount:P?P.length:0,shouldSkipHistoryAnimations:e.shouldSkipHistoryAnimations,messageLists:i,isChannel:k,canSubscribe:T,canStartBot:B,canRestartBot:N}}))((({chatId:e,threadId:t,messageListType:n,isPrivate:i,isPinnedMessageList:r,messageLists:c,canPost:l,currentUserBannedRights:u,defaultBannedRights:m,hasPinnedOrAudioPlayer:g,pinnedMessagesCount:p,customBackground:f,theme:I,backgroundColor:v,patternColor:y,isLeftColumnShown:Z,isRightColumnShown:P,isBackgroundBlurred:C,isMobileSearchActive:w,isSelectModeActive:b,isPaymentModalOpen:E,isReceiptModalOpen:M,isSeenByModalOpen:S,isReactorListModalOpen:R,animationLevel:k,shouldSkipHistoryAnimations:T,currentTransitionKey:N,isChannel:B,canSubscribe:A,canStartBot:x,canRestartBot:L,activeEmojiInteraction:O})=>{const{openChat:U,unpinAllMessages:F,loadUser:$,closeLocalTextSearch:D,exitMessageSelectMode:j,closePaymentModal:Q,clearReceipt:q,joinChannel:G,sendBotCommand:H,restartBot:Y}=(0,a.uC)(),{width:X}=pt(),W=(0,Re.Z)(),[K,J]=(0,o.eJ)(ut.t.None),[ee,te]=(0,o.eJ)(),[ne,ae]=(0,o.eJ)(),[se,oe]=(0,o.eJ)(!1),ie=g&&(X<s.l3||P&&X>s._m&&X<s.QU||X>=s.ks&&X<s.jT),re=(0,ft.Z)(e,eo),ce=(0,ft.Z)(t,eo),de=(0,ft.Z)(n,eo),ue=(0,ft.Z)(A,eo),me=(0,ft.Z)(x,eo),he=(0,ft.Z)(L,eo),ge=(0,ft.Z)(l,eo)&&!he&&!me&&!ue,pe=(0,ft.Z)(ie,eo),fe=(0,ft.Z)(ee,eo),ve=(0,ft.Z)(B,eo),ye=(0,It.Z)(N),Ze=void 0!==ye&&ye<N?ye:void 0,{isReady:we,handleOpenEnd:be,handleSlideStop:Ee}=function(e,t,n,a){const[i,r]=(0,o.eJ)(!h.wB),c=(0,vt.Z)(),d=void 0!==n&&n!==t;return d&&(e!==s.oB?r(!1):c()),(0,Ie.Z)((()=>{e===s.oB&&r(!0)}),[e]),{isReady:i&&!d,handleOpenEnd:e!==s.oB?function(e){"transform"===e.propertyName&&e.target===e.currentTarget&&r(Boolean(a))}:void 0,handleSlideStop:e!==s.oB?function(){r(!0)}:void 0}}(k,N,ye,e);(0,o.d4)((()=>e?(0,Ce.Z)((()=>{U({id:void 0})})):void 0),[e,U]),(0,Ie.Z)((()=>{J(ut.t.None),te(void 0),ae(void 0)}),[e]),(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)((()=>{i&&$({userId:e})}),[e,i,$]);const Se=(0,o.I4)((e=>{if(h.$b)return;const{items:t}=e.dataTransfer||{},n=t&&Array.from(t).filter((e=>"text/uri-list"!==e.type)).every(to);J(n?ut.t.QuickFile:ut.t.Document)}),[]),ke=(0,o.I4)((()=>{J(ut.t.None)}),[]),Te=(0,o.I4)((()=>{oe(!0)}),[]),Ne=(0,o.I4)((()=>{oe(!1)}),[]),Be=(0,o.I4)((()=>{F({chatId:e}),Ne(),U({id:e})}),[F,U,Ne,e]),Ae=(0,o.I4)((()=>{U({id:e})}),[U,e]),Le=(0,o.I4)((()=>{G({chatId:e})}),[G,e]),Oe=(0,o.I4)((()=>{H({command:"/start"})}),[H]),Ue=(0,o.I4)((()=>{Y({chatId:e})}),[e,Y]),Fe=((e,t)=>{const[n,a]=(0,o.eJ)(t);return(0,o.d4)((()=>{t&&(t.startsWith("#")?a(t):ht.fetch(s.fo,e,ht.Type.Blob).then((e=>{const t=URL.createObjectURL(e);(0,gt.pt)(t).then((()=>{a(`url(${t})`)}))})))}),[t,e]),t?n:void 0})(I,f),$e=(0,le.Z)(pe&&"has-header-tools",f&&"custom-bg-image",v&&"custom-bg-color",f&&C&&"blurred",h.aZ?"mask-image-disabled":"mask-image-enabled"),De=(0,le.Z)("messaging-disabled",!b&&"shown"),je=(0,d.q8)(W,u,m),{composerHiddenScale:Qe,toolbarHiddenScale:qe,composerTranslateX:Ge,toolbarTranslateX:He,unpinHiddenScale:_e,toolbarForUnpinHiddenScale:ze}=(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,V),z),n=Math.min(.25*e,z);return Math.min(e-t-n,_)}if(e>s.ks){const t=Math.min(Math.max(.4*e,V),z);return Math.min(e-t,_)}return e>_?_: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,d=i/r;return{composerHiddenScale:c,toolbarHiddenScale:d,composerTranslateX:t?o/2*d:0,toolbarTranslateX:t?o/2*-1*c:0,unpinHiddenScale:r/258,toolbarForUnpinHiddenScale:258/r}}(X,ge)),[ge,X]),Ve=(0,le.Z)("middle-column-footer",!ge&&"no-composer",ge&&ne&&!b&&"with-notch");(0,Pe.ZP)(re&&ce,(()=>{U({id:void 0},{forceSyncOnIOs:!0})}),void 0,void 0,void 0,(null==c?void 0:c.map(mt.q))||[]),(0,Pe.ZP)(w,D),(0,Pe.ZP)(b,j);const Ye=Boolean(!r&&!ge&&je),Xe=Boolean(he||ue||me||r),We=Boolean(Ye||b||r);return o.ZP.createElement("div",{id:"MiddleColumn",className:$e,onTransitionEnd:be,style:`\n --composer-hidden-scale: ${Qe};\n --toolbar-hidden-scale: ${qe};\n --unpin-hidden-scale: ${_e};\n --toolbar-unpin-hidden-scale: ${ze};\n --composer-translate-x: ${Ge}px;\n --toolbar-translate-x: ${He}px;\n --pattern-color: ${y};\n --theme-background-color:\n ${v||("dark"===I?s.It:s.p3)};\n `,onClick:h.p7&&Z?Ae:void 0},o.ZP.createElement("div",{id:"middle-column-bg",style:Fe?`--custom-background: ${Fe}`:void 0}),o.ZP.createElement("div",{id:"middle-column-portals"}),re&&ce&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("div",{className:"messages-layout",onDragEnter:ge?Se:void 0},o.ZP.createElement(Jt,{chatId:re,threadId:ce,messageListType:de,isReady:we}),o.ZP.createElement(Me.Z,{name:T?"none":k===s.zy?"slide":"fade",activeKey:N,shouldCleanup:!0,cleanupExceptionKey:Ze,onStop:Ee},(()=>o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement(Da,{key:`${re}-${ce}-${de}`,chatId:re,threadId:ce,type:de,canPost:ge,hasTools:pe,onFabToggle:te,onNotchToggle:ae,isReady:we,withBottomShift:Xe}),o.ZP.createElement("div",{className:Ve},ge&&o.ZP.createElement(Hs,{chatId:re,threadId:ce,messageListType:de,dropAreaState:K,onDropHide:ke,isReady:we}),r&&o.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:W.isRtl?"rtl":void 0},o.ZP.createElement(xe.Z,{size:"tiny",fluid:!0,color:"secondary",className:"unpin-all-button",onClick:Te},o.ZP.createElement("i",{className:"icon-unpin"}),o.ZP.createElement("span",null,W("Chat.Pinned.UnpinAll",p,"i")))),Ye&&o.ZP.createElement("div",{className:De},o.ZP.createElement("div",{className:"messaging-disabled-inner"},o.ZP.createElement("span",null,je))),h.wB&&ue&&o.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:W.isRtl?"rtl":void 0},o.ZP.createElement(xe.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:Le},W(ve?"ProfileJoinChannel":"ProfileJoinGroup"))),h.wB&&me&&o.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:W.isRtl?"rtl":void 0},o.ZP.createElement(xe.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:Oe},W("BotStart"))),h.wB&&he&&o.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:W.isRtl?"rtl":void 0},o.ZP.createElement(xe.Z,{size:"tiny",fluid:!0,ripple:!0,className:"join-subscribe-button",onClick:Ue},W("BotRestart"))),o.ZP.createElement(zs,{messageListType:de,isActive:b,canPost:ge}),o.ZP.createElement(Ys,{isOpen:Boolean(E),onClose:Q}),o.ZP.createElement(Xs,{isOpen:Boolean(M),onClose:q}),o.ZP.createElement(Ws,{isOpen:S}),o.ZP.createElement(Js,{isOpen:R}))))),o.ZP.createElement(ja,{isShown:fe,canPost:ge,withExtraShift:We})),h.wB&&o.ZP.createElement(_s,{isActive:Boolean(w)})),e&&o.ZP.createElement(Vs,{isOpen:se,chatId:e,pinnedMessagesCount:p,onClose:Ne,onUnpin:Be}),O&&o.ZP.createElement(Ks,{emojiInteraction:O}))}))),ao=(0,C.Ds)((e=>e()),200,!1);var so;!function(e){e[e.Profile=0]="Profile",e[e.MemberList=1]="MemberList",e[e.SharedMedia=2]="SharedMedia",e[e.Search=3]="Search",e[e.Management=4]="Management",e[e.ManageInitial=5]="ManageInitial",e[e.ManageChannelSubscribers=6]="ManageChannelSubscribers",e[e.ManageChatAdministrators=7]="ManageChatAdministrators",e[e.ManageChatPrivacyType=8]="ManageChatPrivacyType",e[e.ManageDiscussion=9]="ManageDiscussion",e[e.ManageGroupPermissions=10]="ManageGroupPermissions",e[e.ManageGroupRemovedUsers=11]="ManageGroupRemovedUsers",e[e.ManageGroupUserPermissionsCreate=12]="ManageGroupUserPermissionsCreate",e[e.ManageGroupUserPermissions=13]="ManageGroupUserPermissions",e[e.ManageGroupRecentActions=14]="ManageGroupRecentActions",e[e.ManageGroupAdminRights=15]="ManageGroupAdminRights",e[e.ManageGroupNewAdminRights=16]="ManageGroupNewAdminRights",e[e.ManageGroupMembers=17]="ManageGroupMembers",e[e.ManageGroupAddAdmins=18]="ManageGroupAddAdmins",e[e.StickerSearch=19]="StickerSearch",e[e.GifSearch=20]="GifSearch",e[e.PollResults=21]="PollResults",e[e.AddingMembers=22]="AddingMembers",e[e.ManageInvites=23]="ManageInvites",e[e.ManageEditInvite=24]="ManageEditInvite",e[e.ManageReactions=25]="ManageReactions"}(so||(so={}));const oo=(0,o.X$)((0,a.c$)(((e,{chatId:t,isProfile:n,isManagement:a})=>{var s;const{query:o}=(0,r.n5)(e)||{},{query:i}=(0,r.y5)(e)||{},{query:c}=(0,r.yN)(e)||{},l=t?(0,r.Z1)(e,t):void 0,u=l&&(0,d.eA)(l),m=n&&t&&(0,d.YC)(t)?(0,r.dy)(e,t):void 0,h=m&&(0,d.kw)(m),g=Boolean(!a&&n&&!h&&l&&!(0,r.FM)(e,l.id)&&((0,d.YC)(l.id)||((0,d.Nl)(l)||l.isCreator)&&!l.isNotJoined)),p=Boolean(t&&(null===(s=e.management.byChatId[t])||void 0===s?void 0:s.editingInvite));return{canManage:g,canAddContact:h,isChannel:u,userId:null==m?void 0:m.id,messageSearchQuery:o,stickerSearchQuery:i,gifSearchQuery:c,isEditingInvite:p}}))((({isColumnOpen:e,isProfile:t,isSearch:n,isManagement:s,isStickerSearch:i,isGifSearch:r,isPollResults:c,isAddingChatMembers:d,profileState:l,managementScreen:u,canAddContact:g,userId:p,canManage:f,isChannel:I,onClose:v,messageSearchQuery:y,stickerSearchQuery:Z,gifSearchQuery:P,shouldSkipAnimation:C,isEditingInvite:w})=>{var b;const{setLocalTextSearchQuery:E,setStickerSearchQuery:M,setGifSearchQuery:S,searchTextMessagesLocal:R,toggleManagement:k,openHistoryCalendar:T,addContact:B}=(0,a.uC)(),A=(0,o.sO)(null),x=(0,o.I4)((e=>{E({query:e}),e.length&&ao(R)}),[R,E]),L=(0,o.I4)((e=>{M({query:e})}),[M]),O=(0,o.I4)((e=>{S({query:e})}),[S]),U=(0,o.I4)((()=>{B({userId:p})}),[B,p]),[F,$]=(0,o.eJ)(!e);(0,o.d4)((()=>{setTimeout((()=>{$(!e)}),300)}),[e]);const D=(0,Re.Z)(),j=t?l===m.vi.Profile?so.Profile:l===m.vi.SharedMedia?so.SharedMedia:l===m.vi.MemberList?so.MemberList:-1:n?so.Search:c?so.PollResults:i?so.StickerSearch:r?so.GifSearch:d?so.AddingMembers:s?u===m.u1.Initial?so.ManageInitial:u===m.u1.ChatPrivacyType?so.ManageChatPrivacyType:u===m.u1.Discussion?so.ManageDiscussion:u===m.u1.ChannelSubscribers?so.ManageChannelSubscribers:u===m.u1.GroupPermissions?so.ManageGroupPermissions:u===m.u1.ChatAdministrators?so.ManageChatAdministrators:u===m.u1.GroupRemovedUsers?so.ManageGroupRemovedUsers:u===m.u1.GroupUserPermissionsCreate?so.ManageGroupUserPermissionsCreate:u===m.u1.GroupUserPermissions?so.ManageGroupUserPermissions:u===m.u1.GroupRecentActions?so.ManageGroupRecentActions:u===m.u1.ChatAdminRights?so.ManageGroupAdminRights:u===m.u1.ChatNewAdminRights?so.ManageGroupNewAdminRights:u===m.u1.GroupMembers?so.ManageGroupMembers:u===m.u1.Invites?so.ManageInvites:u===m.u1.EditInvite?so.ManageEditInvite:u===m.u1.GroupAddAdmins?so.ManageGroupAddAdmins:u===m.u1.Reactions?so.ManageReactions:void 0:void 0,Q=null!==(b=(0,Pt.Z)(j,!0))&&void 0!==b?b:-1;function q(){if(-1!==Q)switch(Q){case so.PollResults:return o.ZP.createElement("h3",null,D("PollResults"));case so.Search:return o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement(Le.Z,{parentContainerClassName:"RightSearch",value:y,onChange:x}),o.ZP.createElement(xe.Z,{round:!0,size:"smaller",color:"translucent",onClick:()=>T({selectedAt:(0,N._F)(Date.now())}),ariaLabel:"Search messages by date"},o.ZP.createElement("i",{className:"icon-calendar"})));case so.AddingMembers:return o.ZP.createElement("h3",null,D(I?"ChannelAddSubscribers":"GroupAddMembers"));case so.ManageInitial:return o.ZP.createElement("h3",null,D("Edit"));case so.ManageChatPrivacyType:return o.ZP.createElement("h3",null,D(I?"ChannelTypeHeader":"GroupTypeHeader"));case so.ManageDiscussion:return o.ZP.createElement("h3",null,D("Discussion"));case so.ManageChatAdministrators:return o.ZP.createElement("h3",null,D("ChannelAdministrators"));case so.ManageGroupRecentActions:return o.ZP.createElement("h3",null,D("Group.Info.AdminLog"));case so.ManageGroupAdminRights:return o.ZP.createElement("h3",null,D("EditAdminRights"));case so.ManageGroupNewAdminRights:return o.ZP.createElement("h3",null,D("SetAsAdmin"));case so.ManageGroupPermissions:return o.ZP.createElement("h3",null,D("ChannelPermissions"));case so.ManageGroupRemovedUsers:return o.ZP.createElement("h3",null,D("ChannelBlockedUsers"));case so.ManageGroupUserPermissionsCreate:return o.ZP.createElement("h3",null,D("ChannelAddException"));case so.ManageGroupUserPermissions:return o.ZP.createElement("h3",null,D("UserRestrictions"));case so.ManageInvites:return o.ZP.createElement("h3",null,D("lng_group_invite_title"));case so.ManageEditInvite:return o.ZP.createElement("h3",null,D(w?"EditLink":"NewLink"));case so.ManageGroupAddAdmins:return o.ZP.createElement("h3",null,D("Channel.Management.AddModerator"));case so.StickerSearch:return o.ZP.createElement(Le.Z,{value:Z,placeholder:D("SearchStickersHint"),autoFocusSearch:!0,onChange:L});case so.GifSearch:return o.ZP.createElement(Le.Z,{value:P,placeholder:D("SearchGifsTitle"),autoFocusSearch:!0,onChange:O});case so.SharedMedia:return o.ZP.createElement("h3",null,D("SharedMedia"));case so.ManageChannelSubscribers:return o.ZP.createElement("h3",null,D("ChannelSubscribers"));case so.MemberList:case so.ManageGroupMembers:return o.ZP.createElement("h3",null,D("GroupMembers"));case so.ManageReactions:return o.ZP.createElement("h3",null,D("Reactions"));default:return o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("h3",null,"Profile"),o.ZP.createElement("section",{className:"tools"},g&&o.ZP.createElement(xe.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:D("AddContact"),onClick:U},o.ZP.createElement("i",{className:"icon-add-user"})),f&&o.ZP.createElement(xe.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:D("Edit"),onClick:k},o.ZP.createElement("i",{className:"icon-edit"}))))}}const G=h.wB||j===so.SharedMedia||j===so.MemberList||j===so.AddingMembers||s,H=(0,le.Z)("animated-close-icon",G&&"state-back",(F||C)&&"no-transition");return o.ZP.createElement("div",{className:"RightHeader"},o.ZP.createElement(xe.Z,{className:"close-button",round:!0,color:"translucent",size:"smaller",onClick:v,ariaLabel:D(G?"Common.Back":"Common.Close")},o.ZP.createElement("div",{ref:A,className:H})),o.ZP.createElement(Me.Z,{name:F||C?"none":"slide-fade",activeKey:Q},q))})));var io=n(91),ro=n(7407);function co(e,t,n,a){const[o,i]=(0,ro.Z)(n?t:void 0,a,void 0,s.Vk);return[o,i,!(!o||!a||o[0]===a[0])]}function lo(e,t,n,a,i,r){const c=(0,o.sO)();(0,Ie.Z)((()=>{t===e&&i&&r&&(c.current=(0,d.R5)(i,r,e).reverse())}),[i,r,t,e]);const[l,u]=(0,ro.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 uo=(0,C.P2)((e=>e()),250,!1);let mo=!1;var ho=n(1273),go=n(1876),po=n(787),fo=n(180),Io=n(3709),vo=n(5418),yo=n(7262),Zo=n(1151),Po=n(2275);const Co=[{type:"media",title:"SharedMediaTab2"},{type:"documents",title:"SharedFilesTab2"},{type:"links",title:"SharedLinksTab2"},{type:"audio",title:"SharedMusicTab2"},{type:"voice",title:"SharedVoiceTab2"}];function wo(e){return[`.shared-media-transition > div:only-child > .${e}-list > .scroll-item`,`.shared-media-transition > .Transition__slide--active > .${e}-list > .scroll-item`].join(", ")}const bo=(0,o.X$)((0,a.c$)(((e,{chatId:t,userId:n})=>{var a,s;const o=(0,r.Z1)(e,t),i=(0,r.Zw)(e,n||t),{currentType:c,resultsByType:l}=(0,r.we)(e)||{},{foundIds:u}=l&&c&&l[c]||{},{byId:m,statusesById:h}=e.users,{byId:g}=e.chats,p=o&&(0,d.Bf)(o),f=o&&(0,d.eA)(o),I=p||f&&(0,d.Nl)(o),v=null==o||null===(a=o.fullInfo)||void 0===a?void 0:a.members,y=I&&o&&o.fullInfo&&!o.fullInfo.canViewMembers,Z=I&&o&&((0,d.VE)(o,"inviteUsers")||o.isCreator),P=I&&o&&((0,d.VE)(o,"banUsers")||o.isCreator),C=(0,r.xs)(e,t);let w,b,E;return n?b=n:(0,d.YC)(t)&&(b=t),b&&(E=(0,r.dy)(e,b),w=E&&!E.isSelf&&!(0,d.cS)(E)),{theme:(0,r.Pu)(e),isChannel:f,resolvedUserId:b,chatMessages:i,foundIds:u,mediaSearchType:c,hasCommonChatsTab:w,hasMembersTab:I,areMembersHidden:y,canAddMembers:Z,canDeleteMembers:P,currentUserId:e.currentUserId,isRightColumnShown:(0,r.Jf)(e),isRestricted:null==o?void 0:o.isRestricted,lastSyncTime:e.lastSyncTime,serverTimeOffset:e.serverTimeOffset,activeDownloadIds:C,usersById:m,userStatusesById:h,chatsById:g,isChatProtected:null==o?void 0:o.isProtected,...I&&v&&{members:v},...w&&E&&{commonChatIds:null===(s=E.commonChats)||void 0===s?void 0:s.ids}}}))((({chatId:e,profileState:t,onProfileStateChange:n,theme:i,isChannel:r,resolvedUserId:c,currentUserId:l,chatMessages:g,foundIds:p,mediaSearchType:f,hasCommonChatsTab:I,hasMembersTab:v,areMembersHidden:y,canAddMembers:Z,canDeleteMembers:P,commonChatIds:C,members:w,usersById:b,userStatusesById:E,chatsById:M,isRightColumnShown:S,isRestricted:R,lastSyncTime:k,activeDownloadIds:T,serverTimeOffset:N,isChatProtected:B})=>{const{setLocalMediaSearchType:A,loadMoreMembers:x,loadCommonChats:L,openChat:O,searchMediaMessagesLocal:U,openMediaViewer:F,openAudioPlayer:$,openUserInfo:D,focusMessage:j,loadProfilePhotos:Q,setNewChatMembersDialogState:q}=(0,a.uC)(),G=(0,o.sO)(null),H=(0,o.sO)(null),_=(0,Re.Z)(),[z,V]=(0,o.eJ)(0),[Y,X]=(0,o.eJ)(),W=(0,o.Ye)((()=>[...v?[{type:"members",title:r?"ChannelSubscribers":"GroupMembers"}]:[],...Co,...I?[{type:"commonChats",title:"SharedGroupsTab2"}]:[]]),[I,v,r]),K=W[z].type,[J,ee,te,ne]=function(e,t,n,a,s,i,r,c,l,u,m,h,g,p,f,I=0){const v="members"!==s&&i?i:s,y=(0,o.Ye)((()=>{if(r&&l&&u)return(0,d.Z0)(r.map((({userId:e})=>e)),l,u,void 0,I)}),[r,I,l,u]),Z=(0,o.Ye)((()=>{if(c&&m)return(0,d.ih)(c,m,!0)}),[m,c]),[P,C,w]=co(0,t,f,y),[b,E,M]=lo("media",v,a,f,h,g),[S,R,k]=lo("documents",v,a,f,h,g),[T,N,B]=lo("links",v,a,f,h,g),[A,x,L]=lo("audio",v,a,f,h,g),[O,U,F]=lo("voice",v,a,f,h,g),[$,D,j]=co(0,n,f,Z);let Q,q,G=!1;switch(v){case"members":Q=P,q=C,G=w;break;case"commonChats":Q=$,q=D,G=j;break;case"media":Q=b,q=E,G=M;break;case"documents":Q=S,q=R,G=k;break;case"links":Q=T,q=N,G=B;break;case"audio":Q=A,q=x,G=L;break;case"voice":Q=O,q=U,G=F}return[v,Q,q,G]}(0,x,L,U,K,f,w,C,b,E,M,g,p,0,k,N),ae=W.findIndex((({type:e})=>e===J)),{handleScroll:se}=function(e,t,n,a){(0,tn.Z)((([n])=>{if(n&&n!==t){const n=e.current,s=n.querySelector(".TabList");n.scrollTop<s.offsetTop&&(a("members"===t?m.vi.MemberList:m.vi.SharedMedia),mo=!0,(0,cn.Z)(n,s,"start",void 0,void 0,void 0,300),setTimeout((()=>{mo=!1}),350))}}),[t,a]),(0,tn.Z)((([t])=>{if(n!==m.vi.Profile||n===t)return;const s=e.current;if(!s)return;const o=s.querySelector(".TabList");!o||o.offsetTop>s.scrollTop||(mo=!0,(0,cn.Z)(s,s.firstElementChild,"start",void 0,2*s.offsetHeight),setTimeout((()=>{mo=!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)((()=>{mo||s()}),[s,t]),{handleScroll:(0,o.I4)((()=>{mo||uo(s)}),[s])}}(G,K,t,n),{applyTransitionFix:oe,releaseTransitionFix:ie}=function(e,t=".Transition.shared-media-transition"){return(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]),{applyTransitionFix:(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]),releaseTransitionFix:(0,o.I4)((()=>{const t=e.current;t.style.overflowY="scroll",t.style.marginRight="0"}),[e])}}(G),[re,ce]=(()=>{const[e,t]=(0,o.eJ)(!1);return[e,(0,o.I4)((()=>{t((e=>!e))}),[])]})(),de=(0,o.I4)((()=>{ie(),ce()}),[ie,ce]),le=(0,o.I4)((()=>{q(m.WB.InProgress)}),[q]);(0,o.d4)((()=>{A({mediaType:K})}),[A,K]);const ue=c||e;(0,o.d4)((()=>{k&&Q({profileId:ue})}),[Q,ue,k]);const me=(0,o.I4)((e=>{F({chatId:ue,threadId:u._f,messageId:e,origin:m.bZ.SharedMedia})}),[ue,F]),he=(0,o.I4)((e=>{$({chatId:ue,messageId:e})}),[ue,$]),ge=(0,o.I4)((e=>{D({id:e})}),[D]),pe=(0,o.I4)((e=>{j({chatId:ue,messageId:e})}),[ue,j]),fe=(0,o.I4)((()=>{X(void 0)}),[]);let Ie;(0,o.d4)((()=>{if(H.current&&h.$b)return(0,Qe.s)(H.current,{selectorToPreventScroll:".Profile",onSwipe:(e,t)=>t===Qe.e.Left?(V(Math.min(z+1,W.length-1)),!0):t===Qe.e.Right&&(V(Math.max(0,z-1)),!0)})}),[z,W.length]);const ve="members"===J||!v&&"media"===J;ve?Ie=S?0:1e3:ee||(Ie=s.Y);const ye=(0,As.Z)([e,J],Ie);function Ze(){if(!ee||!ye||!g){const e=ve&&ee&&!ye;return o.ZP.createElement("div",{className:"content empty-list"},!e&&o.ZP.createElement(De.Z,null))}if(!ee.length){let e;switch(J){case"members":e=y?"You have no access to group members list.":"No members found";break;case"commonChats":e=_("NoGroupsInCommon");break;case"documents":e=_("lng_media_file_empty");break;case"links":e=_("lng_media_link_empty");break;case"audio":e=_("lng_media_song_empty");break;case"voice":e=_("lng_media_audio_empty");break;default:e=_("SharedMedia.EmptyTitle")}return o.ZP.createElement("div",{className:"content empty-list"},o.ZP.createElement(yo.Z,{text:e}))}return o.ZP.createElement("div",{className:`content ${J}-list`,dir:_.isRtl&&"media"===J?"rtl":void 0,teactFastList:!0},"media"===J?ee.map((e=>g[e]&&o.ZP.createElement(Io.Z,{key:e,message:g[e],isProtected:B||g[e].isProtected,onClick:me}))):"documents"===J?ee.map((e=>g[e]&&o.ZP.createElement(Ln.Z,{key:e,message:g[e],withDate:!0,smaller:!0,className:"scroll-item",onDateClick:pe,isDownloading:T.includes(e)}))):"links"===J?ee.map((e=>g[e]&&o.ZP.createElement(vo.Z,{key:e,message:g[e],isProtected:B||g[e].isProtected,onMessageClick:pe}))):"audio"===J?ee.map((e=>g[e]&&o.ZP.createElement(On.Z,{key:e,theme:i,message:g[e],origin:m.Cr.SharedMedia,date:g[e].date,lastSyncTime:k,className:"scroll-item",onPlay:he,onDateClick:pe,isDownloading:T.includes(e)}))):"voice"===J?ee.map((e=>g[e]&&o.ZP.createElement(On.Z,{key:e,theme:i,message:g[e],senderTitle:(0,io.F)(_,g[e],M,b),origin:m.Cr.SharedMedia,date:g[e].date,lastSyncTime:k,className:"scroll-item",onPlay:he,onDateClick:pe,isDownloading:T.includes(e)}))):"members"===J?ee.map(((e,t)=>{return o.ZP.createElement(go.Z,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item small-icon",onClick:()=>ge(e),contextActions:(n=e,n!==l&&P?[{title:_("lng_context_remove_from_group"),icon:"stop",handler:()=>{X(n)}}]:void 0)},o.ZP.createElement(wt.Z,{userId:e,forceShowSelf:!0}));var n})):"commonChats"===J?ee.map(((e,t)=>o.ZP.createElement(go.Z,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item small-icon",onClick:()=>O({id:e})},o.ZP.createElement(bt.Z,{chatId:e})))):void 0)}return o.ZP.createElement(ho.Z,{ref:G,className:"Profile custom-scroll",itemSelector:wo(J),items:ye?ee:void 0,cacheBuster:re,sensitiveArea:s.qU,preloadBackwards:ye?"members"===J?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(po.Z,{userId:t||e}),o.ZP.createElement(fo.Z,{chatOrUserId:t||e}))}(e,c),!R&&o.ZP.createElement("div",{className:"shared-media"},o.ZP.createElement(Me.Z,{ref:H,name:_.isRtl?"slide-optimized-rtl":"slide-optimized",activeKey:ae,renderCount:W.length,shouldRestoreHeight:!0,className:"shared-media-transition",onStart:oe,onStop:de},Ze),o.ZP.createElement(Ge.Z,{big:!0,activeTab:z,tabs:W,onSwitchTab:V})),Z&&o.ZP.createElement(Zo.Z,{isShown:"members"===J,onClick:le,ariaLabel:_("lng_channel_add_users")},o.ZP.createElement("i",{className:"icon-add-user-filled"})),P&&o.ZP.createElement(Po.Z,{isOpen:Boolean(Y),userId:Y,onClose:fe}))}))),Eo=(0,o.X$)((e=>{const t=(0,Ve.Z)(ze.gl.Extra,"RightSearch");return t?o.ZP.createElement(t,e):o.ZP.createElement(Ye.Z,null)})),Mo=(0,o.X$)((e=>{const t=(0,Ve.Z)(ze.gl.Extra,"Management");return t?o.ZP.createElement(t,e):o.ZP.createElement(Ye.Z,null)})),So=(0,o.X$)((()=>{const e=(0,Ve.Z)(ze.gl.Extra,"StickerSearch");return e?o.ZP.createElement(e,null):o.ZP.createElement(Ye.Z,null)})),Ro=(0,o.X$)((()=>{const e=(0,Ve.Z)(ze.gl.Extra,"GifSearch");return e?o.ZP.createElement(e,null):o.ZP.createElement(Ye.Z,null)})),ko=(0,o.X$)((()=>{const e=(0,Ve.Z)(ze.gl.Extra,"PollResults");return e?o.ZP.createElement(e,null):o.ZP.createElement(Ye.Z,null)}));var To=n(1820);const No=(0,o.X$)((0,a.c$)(((e,{chatId:t})=>{var n;const a=(0,r.Z1)(e,t),{userIds:s}=e.contactList||{},{byId:o}=e.chats,{currentUserId:i,newChatMembersProgress:c,connectionState:l}=e,u=a&&(0,d.eA)(a),{query:h,fetchingStatus:g,globalUserIds:p,localUserIds:f}=e.userSearch;return{isChannel:u,members:null==a||null===(n=a.fullInfo)||void 0===n?void 0:n.members,currentUserId:i,chatsById:o,localContactIds:s,searchQuery:h,isSearching:g,isLoading:c===m.WB.Loading,globalUserIds:p,localUserIds:f,connectionState:l}}))((({isChannel:e,connectionState:t,members:n,onNextStep:s,currentUserId:i,chatsById:r,localContactIds:c,isLoading:l,searchQuery:u,isSearching:m,localUserIds:h,globalUserIds:p,onClose:f,isActive:I})=>{const{setUserSearchQuery:v,loadContactList:y}=(0,a.uC)(),Z=(0,Re.Z)(),[P,C]=(0,o.eJ)([]),w=(0,It.Z)(P)===P;(0,o.d4)((()=>{I&&"connectionStateReady"===t&&y()}),[t,I,y]),(0,Pe.ZP)(I,f);const b=(0,o.Ye)((()=>n?n.map((e=>e.userId)):[]),[n]),E=(0,o.I4)((e=>{v({query:e})}),[v]),M=(0,o.Ye)((()=>{const t=(0,a.Rd)().users.byId,n=c?(0,d.kK)(c,t,u):[];return(0,d.ih)((0,g.Tw)([...n,...h||[],...p||[]]).filter((n=>{const a=t[n];return!b.includes(n)&&n!==i&&(!a||!(0,d.cS)(a)||!e&&a.canBeInvitedToGroup)})),r)}),[c,r,u,h,p,i,b,e]),S=(0,o.I4)((()=>{P.length&&(v({query:""}),s(P))}),[P,v,s]);return o.ZP.createElement("div",{className:"AddChatMembers"},o.ZP.createElement("div",{className:"AddChatMembers-inner"},o.ZP.createElement(To.Z,{itemIds:M,selectedIds:P,filterValue:u,filterPlaceholder:Z("lng_channel_add_users"),searchInputId:"new-members-picker-search",isLoading:m,onSelectedIdsChange:C,onFilterChange:E,noScrollRestore:w}),o.ZP.createElement(Zo.Z,{isShown:Boolean(P.length),disabled:l,ariaLabel:Z("lng_channel_add_users"),onClick:S},l?o.ZP.createElement(De.Z,{color:"white"}):o.ZP.createElement("i",{className:"icon-arrow-right"}))))}))),Bo=Object.keys(m.qt).length/2,Ao=Object.keys(m.u1).length/2;function xo(){const e=document.querySelector(".RightHeader .SearchInput input");e&&e.blur()}const Lo=(0,o.X$)((0,a.c$)((e=>{const{chatId:t,threadId:n}=(0,r.Bt)(e)||{},a=(0,r.g4)(e);return{contentKey:(0,r.Wq)(e),chatId:t,threadId:n,currentProfileUserId:e.users.selectedId,isChatSelected:Boolean(t&&a),shouldSkipHistoryAnimations:e.shouldSkipHistoryAnimations}}))((({contentKey:e,chatId:t,threadId:n,currentProfileUserId:i,isChatSelected:r,shouldSkipHistoryAnimations:c})=>{var d;const{toggleChatInfo:l,toggleManagement:u,openUserInfo:h,closeLocalTextSearch:g,setStickerSearchQuery:p,setGifSearchQuery:f,closePollResults:I,addChatMembers:v,setNewChatMembersDialogState:y,setEditingExportedInvite:Z}=(0,a.uC)(),{width:P}=pt(),[C,w]=(0,o.eJ)(m.vi.Profile),[b,E]=(0,o.eJ)(m.u1.Initial),[M,S]=(0,o.eJ)(),[R,k]=(0,o.eJ)(),T=C!==m.vi.Profile,N=void 0!==e,B=e===m.qt.ChatInfo||e===m.qt.UserInfo,A=e===m.qt.Search,x=e===m.qt.Management,L=e===m.qt.StickerSearch,O=e===m.qt.GifSearch,U=e===m.qt.PollResults,F=e===m.qt.AddingMembers,$=P<=s._m,[D,j]=(0,o.eJ)(!N),Q=null!==(d=(0,Pt.Z)(e,!0,!r))&&void 0!==d?d:-1,q=(0,o.I4)(((n=!0)=>{switch(e){case m.qt.AddingMembers:y(m.WB.Closed);break;case m.qt.ChatInfo:if(T&&n){w(m.vi.Profile);break}l(void 0,{forceSyncOnIOs:!0});break;case m.qt.UserInfo:if(T&&n){w(m.vi.Profile);break}h({id:void 0},{forceSyncOnIOs:!0});break;case m.qt.Management:switch(b){case m.u1.Initial:u();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:E(m.u1.Initial);break;case m.u1.GroupUserPermissionsCreate:case m.u1.GroupRemovedUsers:case m.u1.GroupUserPermissions:E(m.u1.GroupPermissions),S(void 0),k(void 0);break;case m.u1.ChatAdminRights:case m.u1.ChatNewAdminRights:case m.u1.GroupAddAdmins:case m.u1.GroupRecentActions:E(m.u1.ChatAdministrators);break;case m.u1.EditInvite:E(m.u1.Invites),Z({chatId:t,invite:void 0})}break;case m.qt.Search:xo(),g();break;case m.qt.StickerSearch:xo(),p({query:void 0});break;case m.qt.GifSearch:xo(),f({query:void 0});break;case m.qt.PollResults:I()}}),[e,T,l,h,I,y,b,u,g,p,f,Z,t]),G=(0,o.I4)(((e,t)=>{S(e),k(t)}),[]),H=(0,o.I4)((e=>{v({chatId:t,memberIds:e})}),[v,t]);function _(e){if(-1!==Q)switch(Q){case m.qt.AddingMembers:return o.ZP.createElement(No,{chatId:t,onNextStep:H,isActive:N&&e,onClose:q});case m.qt.ChatInfo:case m.qt.UserInfo:return o.ZP.createElement(bo,{key:i||t,chatId:t,userId:i,profileState:C,onProfileStateChange:w});case m.qt.Search:return o.ZP.createElement(Eo,{chatId:t,threadId:n,onClose:q,isActive:N&&e});case m.qt.Management:return o.ZP.createElement(Mo,{chatId:t,currentScreen:b,isPromotedByCurrentUser:R,selectedChatMemberId:M,onScreenSelect:E,onChatMemberSelect:G,isActive:N&&e,onClose:q});case m.qt.StickerSearch:return o.ZP.createElement(So,{onClose:q,isActive:N&&e});case m.qt.GifSearch:return o.ZP.createElement(Ro,{onClose:q,isActive:N&&e});case m.qt.PollResults:return o.ZP.createElement(ko,{onClose:q,isActive:N&&e})}}return(0,o.d4)((()=>N?(0,Ce.Z)(q):void 0),[N,q]),(0,o.d4)((()=>{setTimeout((()=>{j(!N)}),300)}),[N]),(0,o.d4)((()=>{N&&$&&q()}),[$]),(0,en.Z)((([n,a])=>{(n===m.qt.ChatInfo&&e===m.qt.UserInfo||n===m.qt.UserInfo&&e===m.qt.ChatInfo||a!==t)&&(w(m.vi.Profile),E(m.u1.Initial))}),[e,t]),(0,Pe.ZP)(r&&(e===m.qt.ChatInfo||e===m.qt.UserInfo||e===m.qt.Management||e===m.qt.AddingMembers),(()=>q(!1)),l),o.ZP.createElement("div",{id:"RightColumn-wrapper",className:r?void 0:"is-hidden"},$&&o.ZP.createElement("div",{className:"overlay-backdrop",onClick:q}),o.ZP.createElement("div",{id:"RightColumn"},o.ZP.createElement(oo,{chatId:t,isColumnOpen:N,isProfile:B,isSearch:A,isManagement:x,isStickerSearch:L,isGifSearch:O,isPollResults:U,isAddingChatMembers:F,profileState:C,managementScreen:b,onClose:q,shouldSkipAnimation:D||c}),o.ZP.createElement(Me.Z,{name:D||c?"none":"zoom-fade",renderCount:Bo+Ao,activeKey:x?Bo+b:Q,shouldCleanup:!0,cleanupExceptionKey:m.qt.ChatInfo},_)))}))),Oo=(0,o.X$)((({isOpen:e})=>{const t=(0,Ve.Z)(ze.gl.Extra,"MediaViewer",!e);return t?o.ZP.createElement(t,null):void 0}));function Uo(e,t){const n=document.createElement("a");n.href=e,n.download=t;try{n.click()}catch(e){console.error(e)}}const Fo=new Set,$o=(0,o.X$)((0,a.c$)((e=>({activeDownloads:e.activeDownloads.byChatId,messages:e.messages.byChatId})))((({activeDownloads:e,messages:t})=>{const{cancelMessageMediaDownload:n}=(0,a.uC)();(0,o.d4)((()=>{Object.entries(e).forEach((([e,a])=>{a.map((n=>t[Number(e)].byId[n])).forEach((e=>{const t=(0,d.Ti)(e,"download");if(t){if(!Fo.has(t)){const a=G.UV(t);if(a)return Fo.delete(t),Uo(a,(0,d.w6)(e)),void n({message:e});G.he(t,u.IU.BlobUrl,!0).then((a=>{Fo.delete(t),a&&Uo(a,(0,d.w6)(e)),n({message:e})})),Fo.add(t)}}else n({message:e})}))}))}),[n,t,e])}))),Do=(0,o.X$)((({isOpen:e})=>{const t=(0,Ve.Z)(ze.gl.Extra,"Notifications",!e);return t?o.ZP.createElement(t,null):void 0})),jo=(0,o.X$)((({isOpen:e})=>{const t=(0,Ve.Z)(ze.gl.Extra,"Dialogs",!e);return t?o.ZP.createElement(t,null):void 0})),Qo=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Ve.Z)(ze.gl.Extra,"ForwardPicker",!t);return n?o.ZP.createElement(n,e):void 0})),qo=(0,o.X$)((e=>{const{url:t}=e,n=(0,Ve.Z)(ze.gl.Extra,"SafeLinkModal",!t);return n?o.ZP.createElement(n,e):void 0})),Go=(0,o.X$)((e=>{const{isOpen:t}=e,n=(0,Ve.Z)(ze.gl.Extra,"HistoryCalendar",!t);return n?o.ZP.createElement(n,e):void 0})),Ho=(0,o.X$)((e=>{const{groupCallId:t}=e,n=(0,Ve.Z)(ze.gl.Calls,"GroupCall",!t);return n?o.ZP.createElement(n,e):void 0})),_o=(0,o.X$)((e=>{const{groupCallId:t}=e,n=(0,Ve.Z)(ze.gl.Calls,"ActiveCallHeader",!t);return n?o.ZP.createElement(n,null):void 0})),zo=(0,o.X$)((({isOpen:e})=>{const t=(0,Ve.Z)(ze.gl.Calls,"CallFallbackConfirm",!e);return t?o.ZP.createElement(t,{isOpen:e}):void 0}));let Vo,Yo=!1;function Xo(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 Wo(e){document.title!==e&&(document.title=e)}const Ko=(0,o.X$)((0,a.c$)((e=>{const{settings:{byKey:{animationLevel:t,language:n,wasTimeFormatSetManually:a}}}=e,{chatId:s,messageId:o}=e.audioPlayer,i=s&&o?(0,r.hj)(e,s,o):void 0;return{lastSyncTime:e.lastSyncTime,isLeftColumnShown:e.isLeftColumnShown,isRightColumnShown:(0,r.Jf)(e),isMediaViewerOpen:(0,r.zQ)(e),isForwardModalOpen:(0,r.Ev)(e),hasNotifications:Boolean(e.notifications.length),hasDialogs:Boolean(e.dialogs.length),audioMessage:i,safeLinkModalUrl:e.safeLinkModalUrl,isHistoryCalendarOpen:Boolean(e.historyCalendarSelectedAt),shouldSkipHistoryAnimations:e.shouldSkipHistoryAnimations,openedStickerSetShortName:e.openedStickerSetShortName,isServiceChatReady:(0,r.UW)(e),activeGroupCallId:e.groupCalls.activeGroupCallId,animationLevel:t,language:n,wasTimeFormatSetManually:a,isCallFallbackConfirmOpen:Boolean(e.groupCalls.isFallbackConfirmOpen),addedSetIds:e.stickers.added.setIds}}))((({lastSyncTime:e,isLeftColumnShown:t,isRightColumnShown:n,isMediaViewerOpen:i,isForwardModalOpen:c,hasNotifications:d,hasDialogs:l,audioMessage:u,activeGroupCallId:m,safeLinkModalUrl:g,isHistoryCalendarOpen:p,shouldSkipHistoryAnimations:f,openedStickerSetShortName:I,isServiceChatReady:v,animationLevel:y,language:Z,wasTimeFormatSetManually:P,isCallFallbackConfirmOpen:w,addedSetIds:b})=>{const{loadAnimatedEmojis:E,loadNotificationSettings:M,loadNotificationExceptions:S,updateIsOnline:R,loadTopInlineBots:k,loadEmojiKeywords:T,loadCountryList:N,loadAvailableReactions:B,loadStickerSets:A,loadAddedStickers:x,loadFavoriteStickers:L,ensureTimeFormat:O,openStickerSetShortName:U,checkVersionNotification:F,loadAppConfig:$}=(0,a.uC)(),D=Boolean(e);s.eM&&!Yo&&(Yo=!0,console.log(">>> RENDER MAIN")),(0,o.d4)((()=>{e&&(R(!0),$(),B(),E(),M(),S(),k(),T({language:s.pR}))}),[e,E,T,S,M,k,R,B,$]),(0,o.d4)((()=>{e&&(Z!==s.pR&&T({language:Z}),N({langCode:Z}))}),[Z,e,N,T]),(0,o.d4)((()=>{D&&(b?x():(A(),L()))}),[D,b,A,L,x]),(0,o.d4)((()=>{e&&v&&F()}),[e,v,F]),(0,o.d4)((()=>{e&&!P&&O()}),[e,P,O]),(0,o.d4)((()=>{e&&Pe.Oy.startsWith("#?tgaddr=")&&(0,me.o)(decodeURIComponent(Pe.Oy.substr("#?tgaddr=".length)))}),[e]),(0,o.d4)((()=>{if(m)return Y.Z.disableRefresh(),()=>{Y.Z.enableRefresh()}}),[m]);const{transitionClassNames:j}=(0,ge.Z)(!t,void 0,!0,void 0,f),{transitionClassNames:Q}=(0,ge.Z)(n,void 0,!0,void 0,f),q=(0,le.Z)(j.replace(/([\w-]+)/g,"middle-column-$1"),Q.replace(/([\w-]+)/g,"right-column-$1"),f&&"history-animation-disabled");(0,Ie.Z)((([e])=>{if(void 0===e||0===y)return;const t=(0,de.YW)();(0,ue.L)(document.getElementById("MiddleColumn"),t)}),[t]),(0,Ie.Z)((([e])=>{if(void 0===e||0===y)return;(0,C.T2)((()=>{document.body.classList.add("animating-right-column")}));const t=(0,de.YW)();(0,ue.L)(document.getElementById("RightColumn"),(()=>{t(),(0,C.T2)((()=>{document.body.classList.remove("animating-right-column")}))}))}),[n]);const G=(0,o.I4)((()=>{R(!1);const e=(0,r.A1)((0,a.Rd)());let t=0;clearInterval(Vo),Vo=window.setInterval((()=>{if(document.title.includes(s.ou))Xo(!1);else{if(t%2==0){const t=(0,r.A1)((0,a.Rd)())-e;t>0&&(Wo(`${t} notification${t>1?"s":""}`),Xo(!0))}else Wo(s.Ti),Xo(!1);t++}}),1e3)}),[R]),H=(0,o.I4)((()=>{R(!0),clearInterval(Vo),Vo=void 0,document.title.includes(s.ou)||Wo(s.Ti),Xo(!1)}),[R]),_=(0,o.I4)((()=>{U({stickerSetShortName:void 0})}),[U]);return(0,pe.Z)(G,H),fe(G),function(e=!1){(0,o.d4)((()=>{if(h.$b){if(!e)return null==ve||ve.setAttribute("content",ye),h.cj&&!h.fl&&document.addEventListener("gesturestart",Ze),()=>{null==ve||ve.setAttribute("content","width=device-width, initial-scale=1, shrink-to-fit=no"),h.cj&&!h.fl&&document.removeEventListener("gesturestart",Ze)};null==ve||ve.setAttribute("content","width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover")}}),[e])}(i),o.ZP.createElement("div",{id:"Main",className:q,onDrop:he.Z,onDragOver:he.Z},o.ZP.createElement(lt,null),o.ZP.createElement(no,null),o.ZP.createElement(Lo,null),o.ZP.createElement(Oo,{isOpen:i}),o.ZP.createElement(Qo,{isOpen:c}),o.ZP.createElement(Do,{isOpen:d}),o.ZP.createElement(jo,{isOpen:l}),u&&o.ZP.createElement(Yt,{key:u.id,message:u,noUi:!0}),o.ZP.createElement(qo,{url:g}),o.ZP.createElement(Go,{isOpen:p}),o.ZP.createElement(qn.Z,{isOpen:Boolean(I),onClose:_,stickerSetShortName:I}),m&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement(Ho,{groupCallId:m}),o.ZP.createElement(_o,{groupCallId:m})),o.ZP.createElement($o,null),o.ZP.createElement(zo,{isOpen:w}))})));s.eM&&console.log(">>> FINISH LOAD MAIN BUNDLE"),(0,a.Rd)().connectionState||(0,a.uC)().initApi()},4524:(e,t,n)=>{e.exports=n.p+"telegram-logo-filled.67469f6dc5e301e8e0bd..svg"}}]);
|
||
//# sourceMappingURL=700.f057ed004e34fabd3032.js.map
|