mirror of
https://github.com/danog/telegram-tt.git
synced 2024-12-11 16:49:44 +01:00
2 lines
230 KiB
JavaScript
2 lines
230 KiB
JavaScript
"use strict";(self.webpackChunktelegram_t=self.webpackChunktelegram_t||[]).push([[164],{6164:(e,t,s)=>{s.r(t),s.d(t,{Main:()=>yo});var n=s(5116),a=s(3716),o=s(4050),r=(s(7895),s(1752)),i=s(8085),c=s(735),d=s(2858);function l(e){const{chatId:t,threadId:s}=(0,i.Bt)(e)||{};return t&&s?(e=(0,r.qr)(e,t,s,!1),e=(0,r.Pb)(e,t,s,void 0)):e}(0,n.Q6)("openLocalTextSearch",(e=>{const{chatId:t,threadId:s}=(0,i.Bt)(e)||{};if(t&&s)return(0,r.qr)(e,t,s,!0)})),(0,n.Q6)("closeLocalTextSearch",l),(0,n.Q6)("setLocalTextSearchQuery",((e,t,s)=>{const{chatId:n,threadId:a}=(0,i.Bt)(e)||{};if(!n||!a)return;const{query:o}=s,l=(0,d.uw)(n,a),{query:u}=e.localTextSearch.byChatThreadKey[l]||{};return o!==u&&(e=(0,r.Pb)(e,n,a,c.D)),(0,r.qr)(e,n,a,!0,o)})),(0,n.Q6)("setLocalMediaSearchType",((e,t,s)=>{const{chatId:n}=(0,i.Bt)(e)||{};if(!n)return;const{mediaType:a}=s;return(0,r.z5)(e,n,a)})),(0,n.Q6)("openChat",((e,t,s)=>{const{id:a,threadId:o=-1,type:c="thread",shouldReplaceHistory:d=!1}=s,u=(0,i.Bt)(e);return u&&u.chatId===a&&u.threadId===o&&u.type===c||(e=(0,r.pf)(e,a,o,"replyStack",[]),e=l(e=(0,r.i9)(e)),e={...e,messages:{...e.messages,contentToBeScheduled:void 0},...a!==e.forwardMessages.toChatId&&{forwardMessages:{}}},(0,n.R3)(e)),(0,r.Wy)(e,a,o,c,d)})),(0,n.Q6)("openPreviousChat",(e=>(0,r.Wy)(e,void 0))),(0,n.Q6)("openChatWithInfo",((e,t,s)=>{(0,n.R3)({...e,isChatInfoShown:!0}),t.openChat(s)})),(0,n.Q6)("resetChatCreation",(e=>({...e,chatCreation:void 0}))),(0,n.Q6)("setNewChatMembersDialogState",((e,t,s)=>({...e,newChatMembersProgress:s}))),(0,n.Q6)("openNextChat",((e,t,s)=>{const{targetIndexDelta:n,orderedIds:a}=s,{chatId:o}=(0,i.Bt)(e)||{};if(!o)return void t.openChat({id:a[0]});const r=a.indexOf(o);if(-1===r)return;const c=a[r+n];t.openChat({id:c,shouldReplaceHistory:!0})}));var u=s(6137),h=s(1713),m=s(7361),g=s(782);const f=a.ck+a.fK;let p;(0,n.Q6)("setScrollOffset",((e,t,s)=>{const{chatId:n,threadId:a,scrollOffset:o}=s;return(0,r.pf)(e,n,a,"scrollOffset",o)})),(0,n.Q6)("setReplyingToId",((e,t,s)=>{const{messageId:n}=s,a=(0,i.Bt)(e);if(!a)return;const{chatId:o,threadId:c}=a;return(0,r.pf)(e,o,c,"replyingToId",n)})),(0,n.Q6)("setEditingId",((e,t,s)=>{const{messageId:n}=s,a=(0,i.Bt)(e);if(!a)return;const{chatId:o,threadId:c,type:d}=a,l="scheduled"===d?"editingScheduledId":"editingId";return(0,r.pf)(e,o,c,l,n)})),(0,n.Q6)("editLastMessage",(e=>{const{chatId:t,threadId:s}=(0,i.Bt)(e)||{};if(!t||!s)return;const n=(0,i.Zw)(e,t),a=(0,i.Cb)(e,t,s);if(!n||!a)return;const o=(0,g.dF)(a,(t=>Boolean(n[t]&&(0,i._k)(e,n[t],s).canEdit)));return o?(0,r.pf)(e,t,s,"editingId",o):void 0})),(0,n.Q6)("replyToNextMessage",((e,t,s)=>{const{targetIndexDelta:n}=s,{chatId:a,threadId:o}=(0,i.Bt)(e)||{};if(!a||!o)return;const r=(0,i.Zw)(e,a),c=(0,i.Cb)(e,a,o);if(!r||!c)return;const d=(0,i.Yy)(e,a,o);let l;if((0,i.b9)(e,a,o)&&d){const e=Object.keys(r),t=e.indexOf(d.toString())+n;l=t<=e.length+1&&t>=0?Number(e[t]):void 0}else if(o===u._f){var h;const t=(0,i.Z1)(e,a);l=null==t||null===(h=t.lastMessage)||void 0===h?void 0:h.id}else{const t=(0,i.tZ)(e,a,o);l=null==t?void 0:t.lastMessageId}t.setReplyingToId({messageId:l}),t.focusMessage({chatId:a,threadId:o,messageId:l})})),(0,n.Q6)("openMediaViewer",((e,t,s)=>{const{chatId:n,threadId:a,messageId:o,avatarOwnerId:r,profilePhotoIndex:i,origin:c}=s;return{...e,mediaViewer:{chatId:n,threadId:a,messageId:o,avatarOwnerId:r,profilePhotoIndex:i,origin:c},forwardMessages:{}}})),(0,n.Q6)("closeMediaViewer",(e=>({...e,mediaViewer:{}}))),(0,n.Q6)("openAudioPlayer",((e,t,s)=>{const{chatId:n,threadId:a,messageId:o,origin:r}=s;return{...e,audioPlayer:{chatId:n,threadId:a,messageId:o,origin:r}}})),(0,n.Q6)("closeAudioPlayer",(e=>({...e,audioPlayer:{}}))),(0,n.Q6)("openPollResults",((e,t,s)=>{const{chatId:a,messageId:o}=s;(0,i.Jf)(e)?a===e.pollResults.chatId&&o===e.pollResults.messageId||(0,n.R3)({...e,pollResults:{chatId:a,messageId:o,voters:{}}}):window.setTimeout((()=>{const e=(0,n.Rd)();(0,n.R3)({...e,pollResults:{chatId:a,messageId:o,voters:{}}})}),450)})),(0,n.Q6)("closePollResults",(e=>{(0,n.R3)({...e,pollResults:{}})})),(0,n.Q6)("focusLastMessage",((e,t)=>{const s=(0,i.Bt)(e);if(!s)return;const{chatId:n,threadId:a}=s;let o;if(a===u._f){var r;const t=(0,i.Z1)(e,n);o=null==t||null===(r=t.lastMessage)||void 0===r?void 0:r.id}else{const t=(0,i.tZ)(e,n,a);o=null==t?void 0:t.lastMessageId}o&&t.focusMessage({chatId:n,threadId:a,messageId:o,noHighlight:!0})})),(0,n.Q6)("focusNextReply",((e,t)=>{const s=(0,i.Bt)(e);if(!s)return;const{chatId:a,threadId:o}=s,c=(0,i.p9)(e,a,o);if(c&&0!==c.length){const s=c.pop();e=(0,r.pf)(e,a,o,"replyStack",[...c]),(0,n.R3)(e),t.focusMessage({chatId:a,threadId:o,messageId:s})}else t.focusLastMessage()})),(0,n.Q6)("focusMessage",((e,t,s)=>{const{chatId:a,threadId:o=u._f,messageListType:c="thread",noHighlight:d,groupedId:l,groupedChatId:m,replyMessageId:g,isResizingContainer:I}=s;let{messageId:v}=s;if(void 0!==l){const t=(0,i.y8)(e,m,l);null!=t&&t.length&&([v]=t)}const y=(0,i.Bt)(e),C=!y||a!==y.chatId||o!==y.threadId||c!==y.type;if(p&&(clearTimeout(p),p=void 0),p=window.setTimeout((()=>{let e=(0,n.Rd)();e=(0,r.cq)(e),e=(0,r.wV)(e),(0,n.R3)(e)}),d?f:1500),e=(0,r.cq)(e,a,v,d,I),e=(0,r.wV)(e,void 0),g){const t=(0,i.p9)(e,a,o)||[];e=(0,r.pf)(e,a,o,"replyStack",[...t,g])}C&&(e=(0,r.wV)(e,h.fo.Static));const Z=(0,i.Cb)(e,a,o);if(Z&&Z.includes(v))return(0,n.R3)(e),void t.openChat({id:a,threadId:o});if(C&&(e=(0,r.pf)(e,a,o,"viewportIds",void 0)),e=(0,r.pf)(e,a,o,"outlyingIds",void 0),Z&&!C){const t=v>Z[0]?h.fo.Down:h.fo.Up;e=(0,r.wV)(e,t)}(0,n.R3)(e),t.openChat({id:a,threadId:o}),t.loadViewportMessages()})),(0,n.Q6)("openForwardMenu",((e,t,s)=>{const{fromChatId:n,messageIds:a,groupedId:o}=s;let r;return o&&(r=(0,i.xH)(e,n,o)),{...e,forwardMessages:{fromChatId:n,messageIds:r||a,isModalShown:!0}}})),(0,n.Q6)("exitForwardMode",(e=>{(0,n.R3)({...e,forwardMessages:{}})})),(0,n.Q6)("setForwardChatId",((e,t,s)=>{const{id:a}=s;(0,n.R3)({...e,forwardMessages:{...e.forwardMessages,toChatId:a,isModalShown:!1}}),t.openChat({id:a}),t.closeMediaViewer(),t.exitMessageSelectMode()})),(0,n.Q6)("openForwardMenuForSelectedMessages",((e,t)=>{if(!e.selectedMessages)return;const{chatId:s,messageIds:n}=e.selectedMessages;t.openForwardMenu({fromChatId:s,messageIds:n})})),(0,n.Q6)("enterMessageSelectMode",((e,t,s)=>{const{messageId:n}=s||{},a=(0,i.jr)(e);return a?(0,r.M6)(e,a.id,n):e})),(0,n.Q6)("toggleMessageSelection",((e,t,s)=>{const{messageId:a,groupedId:o,childMessageIds:c,withShift:d}=s,l=(0,i.Bt)(e);if(!l)return;const{chatId:u,threadId:h,type:g}=l;e=(0,r.Ob)(e,u,h,g,a,o,c,d),(0,n.R3)(e),e.shouldShowContextMenuHint&&(t.disableContextMenuHint(),t.showNotification({message:`To **edit** or **reply**, close this menu. Then ${m.$b?"long tap":"right click"} on a message.`}))})),(0,n.Q6)("disableContextMenuHint",(e=>{if(e.shouldShowContextMenuHint)return{...e,shouldShowContextMenuHint:!1}})),(0,n.Q6)("exitMessageSelectMode",r.i9),(0,n.Q6)("openPollModal",(e=>({...e,isPollModalOpen:!0}))),(0,n.Q6)("closePollModal",(e=>({...e,isPollModalOpen:!1}))),(0,n.Q6)("setGlobalSearchQuery",((e,t,s)=>{const{query:n}=s,{chatId:a}=e.globalSearch;return(0,r.No)(e,{globalResults:{},localResults:{},resultsByType:void 0,...n?{fetchingStatus:{chats:!a,messages:!0}}:{fetchingStatus:void 0},query:n})})),(0,n.Q6)("addRecentlyFoundChatId",((e,t,s)=>{const{id:n}=s,{recentlyFoundChatIds:a}=e.globalSearch;if(!a)return(0,r.No)(e,{recentlyFoundChatIds:[n]});const o=a.filter((e=>e!==n));return o.unshift(n),o.length>10&&o.pop(),(0,r.No)(e,{recentlyFoundChatIds:o})})),(0,n.Q6)("clearRecentlyFoundChats",(e=>(0,r.No)(e,{recentlyFoundChatIds:void 0}))),(0,n.Q6)("setGlobalSearchContent",((e,t,s)=>{const{content:n}=s;return(0,r.Og)(e,n)})),(0,n.Q6)("setGlobalSearchChatId",((e,t,s)=>{const{id:n}=s;return(0,r.No)(e,{chatId:n,query:void 0,resultsByType:void 0})})),(0,n.Q6)("setStickerSearchQuery",((e,t,s)=>{const{query:n}=s;return{...e,stickers:{...e.stickers,search:{query:n,resultIds:void 0}}}})),(0,n.Q6)("setGifSearchQuery",((e,t,s)=>{const{query:n}=s;return{...e,gifs:{...e.gifs,search:{query:n,offsetId:void 0,results:void 0}}}})),(0,n.Q6)("openUserInfo",((e,t,s)=>{const{id:n}=s;t.openChat({id:n})})),(0,n.Q6)("openChat",(e=>(0,r.x1)(e,void 0))),(0,n.Q6)("setUserSearchQuery",((e,t,s)=>{const{query:n}=s;return(0,r.Lm)(e,{globalUserIds:void 0,localUserIds:void 0,fetchingStatus:Boolean(n),query:n})})),s(3781);var I=s(1947),v=s(6926);(0,n.Q6)("toggleChatInfo",(e=>({...e,isChatInfoShown:!e.isChatInfoShown}))),(0,n.Q6)("setLeftColumnWidth",((e,t,s)=>({...e,leftColumnWidth:s}))),(0,n.Q6)("resetLeftColumnWidth",(e=>({...e,leftColumnWidth:void 0}))),(0,n.Q6)("toggleManagement",(e=>{const{chatId:t}=(0,i.Bt)(e)||{};if(t)return{...e,management:{byChatId:{...e.management.byChatId,[t]:{...e.management.byChatId[t],isActive:!(e.management.byChatId[t]||{}).isActive}}}}})),(0,n.Q6)("closeManagement",(e=>{const{chatId:t}=(0,i.Bt)(e)||{};if(t)return{...e,management:{byChatId:{...e.management.byChatId,[t]:{...e.management.byChatId[t],isActive:!1}}}}})),(0,n.Q6)("openChat",(e=>{if(m.wB||m.p7)return{...e,isLeftColumnShown:0===e.messages.messageLists.length}})),(0,n.Q6)("toggleLeftColumn",(e=>({...e,isLeftColumnShown:!e.isLeftColumnShown}))),(0,n.Q6)("addRecentEmoji",((e,t,s)=>{const{emoji:n}=s,{recentEmojis:a}=e;if(!a)return{...e,recentEmojis:[n]};const o=a.filter((e=>e!==n));return o.unshift(n),o.length>18&&o.pop(),{...e,recentEmojis:o}})),(0,n.Q6)("addRecentSticker",((e,t,s)=>{const{sticker:n}=s,{recent:a}=e.stickers;if(!a)return{...e,stickers:{...e.stickers,recent:{hash:0,stickers:[n]}}};const o=a.stickers.filter((e=>e.id!==n.id));return o.unshift(n),{...e,stickers:{...e.stickers,recent:{...a,stickers:o}}}})),(0,n.Q6)("showNotification",((e,t,s)=>{const n=s;n.localId=(0,v.Z)({});const a=[...e.notifications],o=a.findIndex((e=>e.message===n.message));return-1!==o&&a.splice(o,1),a.push(n),{...e,notifications:a}})),(0,n.Q6)("dismissNotification",((e,t,s)=>{const n=e.notifications.filter((({localId:e})=>e!==s.localId));return{...e,notifications:n}})),(0,n.Q6)("showDialog",((e,t,s)=>{const{data:n}=s;if("message"in n&&n.hasErrorKey&&!(0,I.ZP)(n))return e;const a=[...e.dialogs];if("message"in n){const e=a.findIndex((e=>e.message===n.message));-1!==e&&a.splice(e,1)}return a.push(n),{...e,dialogs:a}})),(0,n.Q6)("dismissDialog",(e=>{const t=[...e.dialogs];return t.pop(),{...e,dialogs:t}})),(0,n.Q6)("toggleSafeLinkModal",((e,t,s)=>{const{url:n}=s;return{...e,safeLinkModalUrl:n}})),(0,n.Q6)("openHistoryCalendar",((e,t,s)=>{const{selectedAt:n}=s;return{...e,historyCalendarSelectedAt:n}})),(0,n.Q6)("closeHistoryCalendar",(e=>({...e,historyCalendarSelectedAt:void 0}))),(0,n.Q6)("openPaymentModal",((e,t,s)=>{const{chatId:n,messageId:a}=s;return{...e,payment:{...e.payment,chatId:n,messageId:a,isPaymentModalOpen:!0}}})),(0,n.Q6)("closePaymentModal",(e=>{const t=(0,r.bp)(e);return(0,r.WY)(t)})),(0,n.Q6)("addPaymentError",((e,t,s)=>{const{error:n}=s;return{...e,payment:{...e.payment,error:n}}})),s(1363);var y=s(1226),C=s(9118);const Z=e=>{const{protocol:t,searchParams:s,pathname:a}=new URL(e);if("tg:"!==t)return;const{openChatByInvite:o,openChatByUsername:r,openStickerSetShortName:i,focusMessage:c}=(0,n.uC)(),d=a.replace(/^\/\//,""),l={};switch(s.forEach(((e,t)=>{l[t]=e})),d){case"resolve":{const{domain:e,post:t,comment:s}=l;"telegrampassport"!==e&&r({username:e,messageId:Number(t),commentId:Number(s)});break}case"privatepost":{const{post:e,channel:t}=l;c({chatId:-Number(t),id:e});break}case"bg":break;case"join":{const{invite:e}=l;o({hash:e});break}case"addstickers":{const{set:e}=l;i({stickerSetShortName:e});break}}},P=(0,C.P2)((e=>e()),300,!0),w=(0,C.P2)((e=>e()),3e3,!0),b=(0,C.Ds)((e=>e()),500,!1,!0);async function M(e,t,s){const o=await(0,y.t9)("fetchChats",{limit:a.Ov,offsetDate:s,archived:"archived"===e,withPinned:void 0===(0,n.Rd)().chats.orderedPinnedIds[e],serverTimeOffset:(0,n.Rd)().serverTimeOffset});if(!o)return;const{chatIds:i}=o;i.length>0&&i[0]===t&&i.shift();let c=(0,n.Rd)();c=(0,r.Sh)(c,(0,g.ee)(o.users,"id")),c=(0,r.GL)(c,(0,g.ee)(o.chats,"id")),c=(0,r.B1)(c,e,i),c=(0,r.vv)(c,e,o),Object.keys(o.draftsById).map(Number).forEach((e=>{c=(0,r.pf)(c,e,u._f,"draft",o.draftsById[e])})),Object.keys(o.replyingToById).map(Number).forEach((e=>{c=(0,r.pf)(c,e,u._f,"replyingToId",o.replyingToById[e])})),0!==i.length||c.chats.isFullyLoaded[e]||(c={...c,chats:{...c.chats,isFullyLoaded:{...c.chats.isFullyLoaded,[e]:!0}}}),(0,n.R3)(c)}async function S(e){const t=await(0,y.t9)("fetchFullChat",e);if(!t)return;const{users:s,fullInfo:a}=t;let o=(0,n.Rd)();s&&(o=(0,r.Sh)(o,(0,g.ee)(s,"id"))),o=(0,r.a4)(o,e.id,{fullInfo:a}),(0,n.R3)(o)}async function E(e){const t=(0,n.Rd)(),s=(0,i.DI)(t,e);if(s&&!s.isMin)return s;const a=await(0,y.t9)("getChatByUsername",e);return a?((0,n.R3)((0,r.a4)((0,n.Rd)(),a.id,a)),a):void 0}(0,n.Q6)("preloadTopChatMessages",((e,t)=>{(async()=>{const s=[];for(let o=0;o<a.ul;o++){await(0,C.wO)(100);const{byId:a,listIds:{active:o},orderedPinnedIds:{active:r}}=(0,n.Rd)().chats;if(!o)return;const{chatId:c}=(0,i.Bt)(e)||{},{pinnedChats:l,otherChats:h}=(0,d.O)(a,o,r),m=[...l,...h].find((({id:e})=>e!==c&&!s.includes(e)));if(!m)return;s.push(m.id),t.loadViewportMessages({chatId:m.id,threadId:u._f})}})()})),(0,n.Q6)("openChat",((e,t,s)=>{const{id:n,threadId:a}=s,{currentUserId:o}=e,r=(0,i.Z1)(e,n);if(null!=r&&r.hasUnreadMark&&t.toggleChatUnread({id:n}),r&&r.lastMessage&&r.lastMessage.threadInfo&&t.requestThreadInfoUpdate({chatId:r.lastMessage.threadInfo.chatId,threadId:r.lastMessage.threadInfo.threadId}),r)(0,d.Hp)(r)&&!r.isMin&&t.requestChatUpdate({chatId:n});else if(n===o)(0,y.t9)("fetchChat",{type:"self"});else{const t=(0,i.dy)(e,n);t&&(0,y.t9)("fetchChat",{type:"user",user:t})}a!==u._f&&((0,i.qS)(e,n,a)||t.requestThreadInfoUpdate({chatId:n,threadId:a}))})),(0,n.Q6)("openLinkedChat",((e,t,s)=>{const{id:n}=s,a=(0,i.Z1)(e,n);a&&(async()=>{var e;const s=await(0,y.t9)("fetchFullChat",a);null!=s&&null!==(e=s.fullInfo)&&void 0!==e&&e.linkedChatId&&t.openChat({id:s.fullInfo.linkedChatId})})()})),(0,n.Q6)("focusMessageInComments",((e,t,s)=>{const{chatId:n,threadId:a,messageId:o}=s,r=(0,i.Z1)(e,n);r&&(async()=>{await(0,y.t9)("requestThreadInfoUpdate",{chat:r,threadId:a})&&t.focusMessage({chatId:n,threadId:a,messageId:o})})()})),(0,n.Q6)("openSupportChat",((e,t)=>{const s=(0,i.P_)(e);t.openChat({id:s?s.id:-1}),s||(async()=>{const e=await(0,y.t9)("fetchChat",{type:"support"});e&&t.openChat({id:e.chatId})})()})),(0,n.Q6)("openTipsChat",((e,t,s)=>{const{langCode:n}=s,o="pt-br"===n?"BR":a.Db.includes(n)?n.toUpperCase():"";t.openChatByUsername({username:`${a.vi}${o}`})})),(0,n.Q6)("loadMoreChats",((e,t,s)=>{const{listType:n="active"}=s,a=e.chats.listIds[n];if(e.chats.isFullyLoaded[n])return;const o=a?a.map((t=>e.chats.byId[t])).filter((t=>Boolean(null==t?void 0:t.lastMessage)&&!(0,i.ep)(e,t.id))).sort(((e,t)=>e.lastMessage.date-t.lastMessage.date))[0]:void 0;P(o?()=>M(n,o.id,o.lastMessage.date):()=>M(n))})),(0,n.Q6)("preloadArchivedChats",(()=>{(async()=>{for(;!(0,n.Rd)().chats.isFullyLoaded.archived;){const e=(0,n.Rd)(),t=e.chats.listIds.archived,s=t?t.map((t=>e.chats.byId[t])).filter((t=>Boolean(null==t?void 0:t.lastMessage)&&!(0,i.ep)(e,t.id))).sort(((e,t)=>e.lastMessage.date-t.lastMessage.date))[0]:void 0;await M("archived",null==s?void 0:s.id,null==s?void 0:s.lastMessage.date),await(0,C.wO)(300)}})()})),(0,n.Q6)("loadFullChat",((e,t,s)=>{const{chatId:n,force:a}=s,o=(0,i.Z1)(e,n);o&&(a?S(o):b((()=>S(o))))})),(0,n.Q6)("loadTopChats",(()=>{w((()=>M("active")))})),(0,n.Q6)("requestChatUpdate",((e,t,s)=>{const{serverTimeOffset:n}=e,{chatId:a}=s,o=(0,i.Z1)(e,a);o&&(0,y.t9)("requestChatUpdate",{chat:o,serverTimeOffset:n})})),(0,n.Q6)("updateChatMutedState",((e,t,s)=>{const{serverTimeOffset:a}=e,{chatId:o,isMuted:c}=s,d=(0,i.Z1)(e,o);d&&((0,n.R3)((0,r.a4)(e,o,{isMuted:c})),(0,y.t9)("updateChatMutedState",{chat:d,isMuted:c,serverTimeOffset:a}))})),(0,n.Q6)("createChannel",((e,t,s)=>{const{title:a,about:o,photo:c,memberIds:d}=s;!async function(e,t,s,a){(0,n.R3)({...(0,n.Rd)(),chatCreation:{progress:h.Nh.InProgress}});const o=await(0,y.t9)("createChannel",{title:e,about:s,users:t});if(!o)return;const{id:i,accessHash:c}=o;let d=(0,n.Rd)();d=(0,r.a4)(d,i,o),d={...d,chatCreation:{...d.chatCreation,progress:o?h.Nh.Complete:h.Nh.Error}},(0,n.R3)(d),(0,n.uC)().openChat({id:i}),i&&c&&a&&await(0,y.t9)("editChatPhoto",{chatId:i,accessHash:c,photo:a})}(a,d.map((t=>(0,i.dy)(e,t))).filter(Boolean),o,c)})),(0,n.Q6)("joinChannel",((e,t,s)=>{const{chatId:n}=s,a=(0,i.Z1)(e,n);if(!a)return;const{id:o,accessHash:r}=a;o&&r&&(0,y.t9)("joinChannel",{channelId:o,accessHash:r})})),(0,n.Q6)("deleteChatUser",((e,t,s)=>{(async()=>{const{chatId:n,userId:a}=s,o=(0,i.Z1)(e,n),r=(0,i.dy)(e,a);if(!o||!r)return;await(0,y.t9)("deleteChatUser",{chat:o,user:r});const c=(0,i.Bt)(e);c&&c.chatId===n&&e.currentUserId===a&&t.openChat({id:void 0})})()})),(0,n.Q6)("deleteChat",((e,t,s)=>{(async()=>{const{chatId:n}=s,a=(0,i.Z1)(e,n);if(!a)return;await(0,y.t9)("deleteChat",{chatId:a.id});const o=(0,i.Bt)(e);o&&o.chatId===n&&t.openChat({id:void 0})})()})),(0,n.Q6)("leaveChannel",((e,t,s)=>{(async()=>{const{chatId:n}=s,a=(0,i.Z1)(e,n);if(!a)return;const{id:o,accessHash:r}=a;o&&r&&await(0,y.t9)("leaveChannel",{channelId:o,accessHash:r});const c=(0,i.Bt)(e);c&&c.chatId===n&&t.openChat({id:void 0})})()})),(0,n.Q6)("deleteChannel",((e,t,s)=>{(async()=>{const{chatId:n}=s,a=(0,i.Z1)(e,n);if(!a)return;const{id:o,accessHash:r}=a;o&&r&&await(0,y.t9)("deleteChannel",{channelId:o,accessHash:r});const c=(0,i.Bt)(e);c&&c.chatId===n&&t.openChat({id:void 0})})()})),(0,n.Q6)("createGroupChat",((e,t,s)=>{const{title:a,memberIds:o,photo:c}=s;!async function(e,t,s){(0,n.R3)({...(0,n.Rd)(),chatCreation:{progress:h.Nh.InProgress}});const a=await(0,y.t9)("createGroupChat",{title:e,users:t});if(!a)return;const{id:o}=a;let i=(0,n.Rd)();i=(0,r.a4)(i,o,a),i={...i,chatCreation:{...i.chatCreation,progress:a?h.Nh.Complete:h.Nh.Error}},(0,n.R3)(i),(0,n.uC)().openChat({id:o}),o&&s&&await(0,y.t9)("editChatPhoto",{chatId:o,photo:s})}(a,o.map((t=>(0,i.dy)(e,t))).filter(Boolean),c)})),(0,n.Q6)("toggleChatPinned",((e,t,s)=>{const{id:n,folderId:o}=s,r=(0,i.Z1)(e,n);if(r)if(o){const t=(0,i.Mw)(e,o);if(t){const s=!(0,i.ep)(e,n,o),{pinnedChatIds:a,includedChatIds:r}=t,c=s?[n,...a||[]]:(a||[]).filter((e=>e!==n)),d=[n,...r];(0,y.t9)("editChatFolder",{id:o,folderUpdate:{...t,pinnedChatIds:c,includedChatIds:d}})}}else{const t=(0,i.Ek)(e,n),s=(0,i.ep)(e,n,"archived"===t?a.WS:void 0);(0,y.t9)("toggleChatPinned",{chat:r,shouldBePinned:!s})}})),(0,n.Q6)("toggleChatArchived",((e,t,s)=>{const{id:n}=s,o=(0,i.Z1)(e,n);o&&(0,y.t9)("toggleChatArchived",{chat:o,folderId:(0,d.pE)(o)?0:a.WS})})),(0,n.Q6)("loadChatFolders",(()=>{!async function(){const e=await(0,y.t9)("fetchChatFolders");if(e){const t=(0,n.Rd)();(0,n.R3)({...t,chatFolders:{...t.chatFolders,...e}})}}()})),(0,n.Q6)("loadRecommendedChatFolders",(()=>{!async function(){const e=await(0,y.t9)("fetchRecommendedChatFolders");if(e){const t=(0,n.Rd)();(0,n.R3)({...t,chatFolders:{...t.chatFolders,recommended:e}})}}()})),(0,n.Q6)("editChatFolders",((e,t,s)=>{const{chatId:n,idsToRemove:a,idsToAdd:o}=s;a.forEach((async t=>{const s=(0,i.Mw)(e,t);var a;s&&await(0,y.t9)("editChatFolder",{id:t,folderUpdate:{...s,pinnedChatIds:null===(a=s.pinnedChatIds)||void 0===a?void 0:a.filter((e=>e!==n)),includedChatIds:s.includedChatIds.filter((e=>e!==n))}})})),o.forEach((async t=>{const s=(0,i.Mw)(e,t);s&&await(0,y.t9)("editChatFolder",{id:t,folderUpdate:{...s,includedChatIds:s.includedChatIds.concat(n)}})}))})),(0,n.Q6)("editChatFolder",((e,t,s)=>{const{id:n,folderUpdate:a}=s,o=(0,i.Mw)(e,n);o&&(0,y.t9)("editChatFolder",{id:n,folderUpdate:{id:n,emoticon:o.emoticon,pinnedChatIds:o.pinnedChatIds,...a}})})),(0,n.Q6)("addChatFolder",((e,t,s)=>{const{folder:o}=s,{orderedIds:r}=e.chatFolders;!async function(e,t){const{id:s,description:a,...o}=e;if(await(0,y.t9)("editChatFolder",{id:t+1,folderUpdate:{id:t+1,...o}}),!a)return;const r=(0,n.Rd)(),{recommended:i}=r.chatFolders;i&&(0,n.R3)({...r,chatFolders:{...r.chatFolders,recommended:i.filter((({id:e})=>e!==s))}})}(o,null!=r&&r.length?Math.max.apply(Math.max,r):a.WS)})),(0,n.Q6)("deleteChatFolder",((e,t,s)=>{const{id:n}=s;(0,i.Mw)(e,n)&&async function(e){await(0,y.t9)("deleteChatFolder",e)}(n)})),(0,n.Q6)("toggleChatUnread",((e,t,s)=>{const{id:n}=s,{serverTimeOffset:a}=e,o=(0,i.Z1)(e,n);o&&(o.unreadCount?(0,y.t9)("markMessageListRead",{serverTimeOffset:a,chat:o,threadId:u._f}):(0,y.t9)("toggleDialogUnread",{chat:o,hasUnreadMark:!o.hasUnreadMark}))})),(0,n.Q6)("openChatByInvite",((e,t,s)=>{const{hash:n}=s;(async()=>{const e=await(0,y.t9)("openChatByInvite",n);e&&t.openChat({id:e.chatId})})()})),(0,n.Q6)("openTelegramLink",((e,t,s)=>{const{url:n}=s,o=a.iL.exec(n);if(o)t.openStickerSetShortName({stickerSetShortName:o[1]});else if(n.match(a.g$))Z(n.match(a.g$)[0]);else{let e=a.Lj.exec(n);if(e){const s=e[1];t.openChatByInvite({hash:s})}else{e=a.FS.exec(n);const s=e[1],o=e[2]?Number(e[2]):void 0,r=e[3]?Number(e[3]):void 0,i="comment"===e[4]&&e[5]?Number(e[5]):void 0;"c"===s&&o&&r?t.focusMessage({chatId:-o,messageId:r}):t.openChatByUsername({username:s,messageId:r||o,commentId:i})}}})),(0,n.Q6)("acceptInviteConfirmation",((e,t,s)=>{const{hash:n}=s;(async()=>{const e=await(0,y.t9)("importChatInvite",{hash:n});e&&t.openChat({id:e.id})})()})),(0,n.Q6)("openChatByUsername",((e,t,s)=>{const{username:a,messageId:o,commentId:r}=s;(async()=>{const s=(0,i.jr)(e);if(!r)return s&&s.username===a?void t.focusMessage({chatId:s.id,messageId:o}):void await async function(e,t,s){e.openChat({id:-1});const n=await E(t);if(!n)return e.openPreviousChat(),void e.showNotification({message:"User does not exist"});s?e.focusMessage({chatId:n.id,messageId:s}):e.openChat({id:n.id})}(t,a,o);const{chatId:c,type:d}=(0,i.Bt)(e)||{},l=(0,i.DI)(e,a);if(c&&l&&"thread"===d){const s=(0,i.tZ)(e,c,o);if(s&&s.chatId===c)return void t.focusMessage({chatId:s.chatId,threadId:s.threadId,messageId:r})}o&&await async function(e,t,s,a){e.openChat({id:-1});const o=await E(t);if(!o)return;const r=(0,n.Rd)(),c=(0,i.tZ)(r,o.id,s);let d;if(c)d=c.chatId;else{const e=await(0,y.t9)("requestThreadInfoUpdate",{chat:o,threadId:s});if(!e)return;d=e.discussionChatId}d&&e.focusMessage({chatId:d,threadId:s,messageId:Number(a)})}(t,a,o,r)})()})),(0,n.Q6)("togglePreHistoryHidden",((e,t,s)=>{const{chatId:n,isEnabled:a}=s;let o=(0,i.Z1)(e,n);o&&(async()=>{if((0,d.G9)(o)){if(o=await(0,y.t9)("migrateChat",o),!o)return;t.openChat({id:o.id})}(0,y.t9)("togglePreHistoryHidden",{chat:o,isEnabled:a})})()})),(0,n.Q6)("updateChatDefaultBannedRights",((e,t,s)=>{const{chatId:n,bannedRights:a}=s,o=(0,i.Z1)(e,n);o&&(0,y.t9)("updateChatDefaultBannedRights",{chat:o,bannedRights:a})})),(0,n.Q6)("updateChatMemberBannedRights",((e,t,s)=>{const{chatId:a,userId:o,bannedRights:c}=s;let l=(0,i.Z1)(e,a);const u=(0,i.dy)(e,o);l&&u&&(async()=>{if((0,d.G9)(l)){if(l=await(0,y.t9)("migrateChat",l),!l)return;t.openChat({id:l.id})}await(0,y.t9)("updateChatMemberBannedRights",{chat:l,user:u,bannedRights:c});const e=(0,n.Rd)(),s=(0,i.Z1)(e,a);if(!s||!s.fullInfo)return;const{members:h,kickedMembers:m}=s.fullInfo,g=!!c.viewMessages,f=!Object.keys(c).length;(0,n.R3)((0,r.a4)(e,a,{fullInfo:{...s.fullInfo,...h&&g&&{members:h.filter((e=>e.userId!==o))},...h&&!g&&{members:h.map((e=>e.userId===o?{...e,bannedRights:c}:e))},...f&&m&&{kickedMembers:m.filter((e=>e.userId!==o))}}}))})()})),(0,n.Q6)("updateChatAdmin",((e,t,s)=>{const{chatId:a,userId:o,adminRights:c,customTitle:l}=s;let u=(0,i.Z1)(e,a);const h=(0,i.dy)(e,o);u&&h&&(async()=>{if((0,d.G9)(u)){if(u=await(0,y.t9)("migrateChat",u),!u)return;t.openChat({id:u.id})}await(0,y.t9)("updateChatAdmin",{chat:u,user:h,adminRights:c,customTitle:l});const e=(0,n.Rd)(),s=(0,i.Z1)(e,a);if(!s||!s.fullInfo)return;const{adminMembers:m}=s.fullInfo,g=!Object.keys(c).length;(0,n.R3)((0,r.a4)(e,a,{fullInfo:{...s.fullInfo,...m&&g&&{adminMembers:m.filter((e=>e.userId!==o))},...m&&!g&&{adminMembers:m.map((e=>e.userId===o?{...e,adminRights:c,customTitle:l}:e))}}}))})()})),(0,n.Q6)("updateChat",((e,t,s)=>{const{chatId:a,title:o,about:c,photo:d}=s,l=(0,i.Z1)(e,a);l&&(async()=>{(0,n.R3)((0,r.H9)((0,n.Rd)(),h.wv.InProgress)),await Promise.all([l.title!==o?(0,y.t9)("updateChatTitle",l,o):void 0,l.fullInfo&&l.fullInfo.about!==c?(0,y.t9)("updateChatAbout",l,c):void 0,d?(0,y.t9)("editChatPhoto",{chatId:a,accessHash:l.accessHash,photo:d}):void 0]),(0,n.R3)((0,r.H9)((0,n.Rd)(),h.wv.Complete))})()})),(0,n.Q6)("toggleSignatures",((e,t,s)=>{const{chatId:n,isEnabled:a}=s,o=(0,i.Z1)(e,n);o&&(0,y.t9)("toggleSignatures",{chat:o,isEnabled:a})})),(0,n.Q6)("loadGroupsForDiscussion",(()=>{(async()=>{const e=await(0,y.t9)("fetchGroupsForDiscussion");if(!e)return;const t=e.reduce(((e,t)=>(t&&(e[t.id]=t),e)),{}),s=(0,r.fZ)((0,n.Rd)(),t);(0,n.R3)({...s,chats:{...s.chats,forDiscussionIds:Object.keys(t).map(Number)}})})()})),(0,n.Q6)("linkDiscussionGroup",((e,t,s)=>{const{channelId:n,chatId:a}=s,o=(0,i.Z1)(e,n);let r=(0,i.Z1)(e,a);o&&r&&(async()=>{if((0,d.G9)(r)){if(r=await(0,y.t9)("migrateChat",r),!r)return;t.openChat({id:r.id})}let{fullInfo:e}=r;if(!e){const t=await(0,y.t9)("fetchFullChat",r);if(!t)return;e=t.fullInfo}e.isPreHistoryHidden&&await(0,y.t9)("togglePreHistoryHidden",{chat:r,isEnabled:!1}),(0,y.t9)("setDiscussionGroup",{channel:o,chat:r})})()})),(0,n.Q6)("unlinkDiscussionGroup",((e,t,s)=>{var n;const{channelId:a}=s,o=(0,i.Z1)(e,a);if(!o)return;let r;null!==(n=o.fullInfo)&&void 0!==n&&n.linkedChatId&&(r=(0,i.Z1)(e,o.fullInfo.linkedChatId)),(async()=>{await(0,y.t9)("setDiscussionGroup",{channel:o}),r&&S(r)})()})),(0,n.Q6)("setActiveChatFolder",((e,t,s)=>({...e,chatFolders:{...e.chatFolders,activeChatFolder:s}}))),(0,n.Q6)("loadMoreMembers",(e=>{(async()=>{var t,s;const{chatId:a}=(0,i.Bt)(e)||{},o=a?(0,i.Z1)(e,a):void 0;if(!o||(0,d.G9)(o))return;const c=(null===(t=o.fullInfo)||void 0===t||null===(s=t.members)||void 0===s?void 0:s.length)||void 0,l=await(0,y.t9)("fetchMembers",o.id,o.accessHash,"recent",c);if(!l)return;const{members:u,users:h}=l;u&&u.length&&(e=(0,n.Rd)(),e=(0,r.Sh)(e,(0,g.ee)(h,"id")),e=(0,r.a4)(e,o.id,{fullInfo:{...o.fullInfo,members:[...(o.fullInfo||{}).members||[],...u||[]]}}),(0,n.R3)(e))})()})),(0,n.Q6)("addChatMembers",((e,t,s)=>{const{chatId:n,memberIds:a}=s,o=(0,i.Z1)(e,n),r=a.map((t=>(0,i.dy)(e,t))).filter(Boolean);o&&r.length&&(t.setNewChatMembersDialogState(h.WB.Loading),(async()=>{await(0,y.t9)("addChatMembers",o,r),t.setNewChatMembersDialogState(h.WB.Closed),S(o)})())})),(0,n.Q6)("deleteChatMember",((e,t,s)=>{const{chatId:n,userId:a}=s,o=(0,i.Z1)(e,n),r=(0,i.dy)(e,a);o&&r&&(async()=>{await(0,y.t9)("deleteChatMember",o,r),S(o)})()}));const k=new Map,R=(0,C.Ds)((e=>e()),500,!1);async function T(e,t,s,o,c=!1,d=!1){const l=e.id;let u;switch(o){case h.Uq.Backwards:u=void 0;break;case h.Uq.Around:u=-(Math.round(a.hT/2)+1);break;case h.Uq.Forwards:u=-(a.hT+1)}const m=await(0,y.t9)("fetchMessages",{chat:(0,i.Cm)((0,n.Rd)(),l,t),offsetId:s,addOffset:u,limit:a.hT,threadId:t});if(!m)return;const{messages:f,users:p,chats:I,threadInfos:v}=m,C=(0,g.ee)(f,"id"),Z=Object.keys(C).map(Number);let P=(0,n.Rd)();P=(0,r.c_)(P,l,C),P=c?(0,r.ff)(P,l,t,Z):(0,r.xj)(P,l,t,Z),P=(0,r.Sh)(P,(0,g.ee)(p,"id")),P=(0,r.fZ)(P,(0,g.ee)(I,"id")),P=(0,r.j6)(P,l,v);let w=(0,i.gb)(P,l,t);const b=(0,i.qC)(P,l,t);if(c&&w&&b&&(b.length&&!(0,g.YE)(w,b)||(P=(0,r.xj)(P,l,t,b),w=(0,i.gb)(P,l,t),P=(0,r.pf)(P,l,t,"outlyingIds",void 0),c=!1)),!d){const e=c?b:w,{newViewportIds:n}=N(e,s,o);P=(0,r.y9)(P,l,t,n)}(0,n.R3)(P)}function N(e,t,s){const{length:n}=e,o=t?function(e,t){return t<e[0]?0:t>e[e.length-1]?e.length-1:e.findIndex(((s,n)=>s===t||s<t&&e[n+1]>t))}(e,t):-1,r=s===h.Uq.Backwards?o:o+1||n,i=r-a.hT,c=r+a.hT-1,d=e.slice(Math.max(0,i),c+1);let l,u;switch(s){case h.Uq.Backwards:l=r>0,u=i>=0;break;case h.Uq.Forwards:l=r<n,u=c<=n-1;break;case h.Uq.Around:default:l=d.length>0,u=d.length===a.hT}return{newViewportIds:d,areSomeLocal:l,areAllLocal:u}}async function B(e){let t;const s=e.attachment?(e,a)=>{k.has(a)||(t=a,k.set(a,s));const o=(0,n.Rd)();(0,n.R3)({...o,fileUploads:{byMessageLocalId:{...o.fileUploads.byMessageLocalId,[a]:{progress:e}}}})}:void 0;(e.replyingTo||m.cj)&&await(0,C.Pn)();const a=(0,n.Rd)();e.serverTimeOffset=a.serverTimeOffset;const o=(0,i.Bt)(a);if(!o)return;const{threadId:r}=o;e.replyingTo||r===u._f||(e.replyingTo=(0,i.qS)(a,e.chat.id,r)),await(0,y.t9)("sendMessage",e,s),s&&t&&k.delete(t)}(0,n.Q6)("loadViewportMessages",((e,t,s)=>{const{direction:n=h.Uq.Around,isBudgetPreload:o=!1}=s||{};let{chatId:c,threadId:d}=s||{};if(!c){const t=(0,i.Bt)(e);if(!t)return;c=t.chatId,d=t.threadId}const l=(0,i.Z1)(e,c);if(!l||l.isRestricted)return;const u=(0,i.Cb)(e,c,d),m=(0,i.gb)(e,c,d),g=(0,i.qC)(e,c,d);if(u&&u.length&&n!==h.Uq.Around){const s=n===h.Uq.Backwards?u[0]:u[u.length-1],a=Boolean(g),i=a?g:m,{newViewportIds:f,areSomeLocal:p,areAllLocal:I}=N(i,s,n);if(p&&(e=(0,r.y9)(e,c,d,f)),async function(e,t,s,n,a,o,r,i){t||await T(a,o,i,r,s,n),n||(await Promise.resolve(),e.loadViewportMessages({chatId:a.id,threadId:o,direction:r,isBudgetPreload:!0}))}(t,I,a,o,l,d,n,s),o)return}else{const t=(0,i.G$)(e,c)||(0,i.rd)(e,c,d),s=Boolean(t&&m&&!m.includes(t)),n=(s?g:m)||[],{newViewportIds:u,areSomeLocal:f,areAllLocal:p}=N(n,t,h.Uq.Around);f&&u.length>=a.hT&&(e=(0,r.y9)(e,c,d,u)),p||T(l,d,t,h.Uq.Around,s,o)}return e})),(0,n.Q6)("loadMessage",((e,t,s)=>{const{chatId:a,messageId:o,replyOriginForId:c,threadUpdate:d}=s,l=(0,i.Z1)(e,a);l&&(async()=>{const e=await async function(e,t,s){const a=await(0,y.t9)("fetchMessage",{chat:e,messageId:t});if(!a)return;if(a===u._Q){if(s){let t=(0,n.Rd)();const a=(0,i.hj)(t,e.id,s);t=(0,r.cY)(t,e.id,s,{...a,replyToMessageId:void 0}),(0,n.R3)(t)}return}let o=(0,n.Rd)();return o=(0,r.cY)(o,e.id,t,a.message),o=(0,r.Sh)(o,(0,g.ee)(a.users,"id")),(0,n.R3)(o),a.message}(l,o,c);if(e&&d){const{lastMessageId:t,isDeleting:s}=d;(0,n.R3)((0,r.lG)((0,n.Rd)(),e,a,t,s))}})()})),(0,n.Q6)("sendMessage",((e,t,s)=>{const n=(0,i.Bt)(e);if(!n)return;const{chatId:o,threadId:r,type:c}=n;if("scheduled"===c&&!s.scheduledAt)return{...e,messages:{...e.messages,contentToBeScheduled:s}};const d=(0,i.Z1)(e,o);t.setReplyingToId({messageId:void 0}),t.clearWebPagePreview({chatId:o,threadId:r,value:!1});const l={...s,chat:d,replyingTo:(0,i.Yy)(e,o,r),noWebPage:(0,i.tV)(e,o,r)},u=!s.attachments||s.attachments.length<=1,h=!u&&s.attachments&&s.attachments.length>1;if(u){const{attachments:e,...t}=l;B({...t,attachment:e?e[0]:void 0})}else if(h){const{text:e,entities:t,attachments:s,...n}=l,o=(0,g.Vl)(s,a.DU);for(let s=0;s<o.length;s++){const[a,...r]=o[s],i=`${Date.now()}${s}`;B({...n,text:0===s?e:void 0,entities:0===s?t:void 0,attachment:a,groupedId:r.length>0?i:void 0}),r.forEach((e=>{B({...n,attachment:e,groupedId:i})}))}}else{const{text:e,entities:t,attachments:s,replyingTo:n,...a}=l;e&&B({...a,text:e,entities:t,replyingTo:n}),s.forEach((e=>{B({...a,attachment:e})}))}})),(0,n.Q6)("editMessage",((e,t,s)=>{const{serverTimeOffset:n}=e,{text:a,entities:o}=s,r=(0,i.Bt)(e);if(!r)return;const{chatId:c,threadId:d,type:l}=r,u=(0,i.Z1)(e,c),h=(0,i.kK)(e,c,d,l);u&&h&&((0,y.t9)("editMessage",{chat:u,message:h,text:a,entities:o,noWebPage:(0,i.tV)(e,c,d),serverTimeOffset:n}),t.setEditingId({messageId:void 0}))})),(0,n.Q6)("cancelSendingMessage",((e,t,s)=>{const{chatId:n,messageId:a}=s,o=(0,i.hj)(e,n,a),r=o&&k.get(o.previousLocalId||o.id);r&&(0,y.u3)(r),t.apiUpdate({"@type":"deleteMessages",ids:[a],chatId:n})})),(0,n.Q6)("saveDraft",((e,t,s)=>{const{chatId:n,threadId:a,draft:o}=s;if(!o)return;const{text:c,entities:d}=o,l=(0,i.Z1)(e,n);return a===u._f&&(0,y.t9)("saveDraft",{chat:l,text:c,entities:d,replyToMsgId:(0,i.Yy)(e,n,a)}),e=(0,r.pf)(e,n,a,"draft",o),(0,r.a4)(e,n,{draftDate:Math.round(Date.now()/1e3)})})),(0,n.Q6)("clearDraft",((e,t,s)=>{const{chatId:n,threadId:a,localOnly:o}=s;if(!(0,i.Ms)(e,n,a))return;const c=(0,i.Z1)(e,n);return o||a!==u._f||(0,y.t9)("clearDraft",c),e=(0,r.pf)(e,n,a,"draft",void 0),(0,r.a4)(e,n,{draftDate:void 0})})),(0,n.Q6)("toggleMessageWebPage",((e,t,s)=>{const{chatId:n,threadId:a,noWebPage:o}=s;return(0,r.pf)(e,n,a,"noWebPage",o)})),(0,n.Q6)("pinMessage",((e,t,s)=>{const n=(0,i.jr)(e);if(!n)return;const{messageId:a,isUnpin:o,isOneSide:r,isSilent:c}=s;(0,y.t9)("pinMessage",{chat:n,messageId:a,isUnpin:o,isOneSide:r,isSilent:c})})),(0,n.Q6)("unpinAllMessages",((e,t,s)=>{const a=(0,i.Z1)(e,s.chatId);a&&async function(e){await(0,y.t9)("unpinAllMessages",{chat:e});let t=(0,n.Rd)();t=(0,r.pf)(t,e.id,u._f,"pinnedIds",[]),(0,n.R3)(t)}(a)})),(0,n.Q6)("deleteMessages",((e,t,s)=>{const{messageIds:n,shouldDeleteForAll:a}=s,o=(0,i.Bt)(e);if(!o)return;const{chatId:r,threadId:c}=o,d=(0,i.Z1)(e,r);(0,y.t9)("deleteMessages",{chat:d,messageIds:n,shouldDeleteForAll:a});const l=(0,i._$)(e,r,c);n.includes(l)&&t.setEditingId({messageId:void 0})})),(0,n.Q6)("deleteScheduledMessages",((e,t,s)=>{const{messageIds:n}=s,a=(0,i.Bt)(e);if(!a)return;const{chatId:o}=a,r=(0,i.Z1)(e,o);(0,y.t9)("deleteScheduledMessages",{chat:r,messageIds:n});const c=(0,i.wU)(e,o);n.includes(c)&&t.setEditingId({messageId:void 0})})),(0,n.Q6)("deleteHistory",((e,t,s)=>{(async()=>{var n;const{chatId:a,shouldDeleteForAll:o}=s,r=(0,i.Z1)(e,a);if(!r)return;const c=null===(n=r.lastMessage)||void 0===n?void 0:n.id;await(0,y.t9)("deleteHistory",{chat:r,shouldDeleteForAll:o,maxId:c});const d=(0,i.Bt)(e);d&&d.chatId===a&&t.openChat({id:void 0})})()})),(0,n.Q6)("reportMessages",((e,t,s)=>{(async()=>{const{messageIds:n,reason:a,description:o}=s,r=(0,i.Bt)(e);if(!r)return;const{chatId:c}=r,d=(0,i.Z1)(e,c),l=await(0,y.t9)("reportMessages",{peer:d,messageIds:n,reason:a,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,n.Q6)("markMessageListRead",((e,t,s)=>{const{serverTimeOffset:n}=e,a=(0,i.Bt)(e);if(!a)return;const{chatId:o,threadId:c}=a,d=(0,i.Cm)(e,o,c);if(!d)return;const{maxId:l}=s;if(R((()=>{(0,y.t9)("markMessageListRead",{serverTimeOffset:n,chat:d,threadId:c,maxId:l})})),c!==u._f)return;const h=(0,i.Cb)(e,o,c),m=(0,i.It)(e,o,c);if(!h||!m||!d.unreadCount)return;const g=function(e,t,s){let n=0;for(let a=0,o=e.length;a<o&&(e[a]>=t&&e[a]<=s&&n++,!(e[a]>=s));a++);return n}(h,m,l);return g?(0,r.a4)(e,o,{lastReadInboxMessageId:l,unreadCount:Math.max(0,d.unreadCount-g)}):void 0})),(0,n.Q6)("markMessagesRead",((e,t,s)=>{const n=(0,i.jr)(e);if(!n)return;const{messageIds:a}=s;(0,y.t9)("markMessagesRead",{chat:n,messageIds:a})})),(0,n.Q6)("loadWebPagePreview",((e,t,s)=>{const{text:a}=s;!async function(e){const t=await(0,y.t9)("fetchWebPagePreview",{message:e});(0,n.R3)({...(0,n.Rd)(),webPagePreview:t})}(a)})),(0,n.Q6)("clearWebPagePreview",(e=>{if(e.webPagePreview)return{...e,webPagePreview:void 0}})),(0,n.Q6)("sendPollVote",((e,t,s)=>{const{chatId:n,messageId:a,options:o}=s,r=(0,i.Z1)(e,n);r&&(0,y.t9)("sendPollVote",{chat:r,messageId:a,options:o})})),(0,n.Q6)("loadPollOptionResults",((e,t,s)=>{const{chat:a,messageId:o,option:i,offset:c,limit:d,shouldResetVoters:l}=s;!async function(e,t,s,a,o,i){const c=await(0,y.t9)("loadPollOptionResults",{chat:e,messageId:t,option:s,offset:a,limit:o});if(!c)return;let d=(0,n.Rd)();d=(0,r.Sh)(d,(0,g.ee)(c.users,"id"));const{voters:l}=d.pollResults;(0,n.R3)({...d,pollResults:{...d.pollResults,voters:{...l,[s]:[...!i&&l&&l[s]?l[s]:[],...c&&c.users.map((e=>e.id))].filter(((e,t,s)=>s.indexOf(e)===t))},offsets:{...d.pollResults.offsets?d.pollResults.offsets:{},[s]:c.nextOffset||""}}})}(a,o,i,c,d,l)})),(0,n.Q6)("forwardMessages",(e=>{const{fromChatId:t,messageIds:s,toChatId:a}=e.forwardMessages,o=t?(0,i.Z1)(e,t):void 0,r=a?(0,i.Z1)(e,a):void 0,c=t&&s?s.sort(((e,t)=>e-t)).map((s=>(0,i.hj)(e,t,s))).filter(Boolean):void 0;o&&r&&c&&c.length&&function(e,t,s){(0,y.t9)("forwardMessages",{fromChat:e,toChat:t,messages:s,serverTimeOffset:(0,n.Rd)().serverTimeOffset}),(0,n.R3)({...(0,n.Rd)(),forwardMessages:{}})}(o,r,c)})),(0,n.Q6)("loadScheduledHistory",((e,t,s)=>{const{chatId:a}=s,o=(0,i.Z1)(e,a);if(!o)return;const{hash:c}=e.scheduledMessages.byChatId[o.id]||{};!async function(e,t){const s=await(0,y.t9)("fetchScheduledHistory",{chat:e,hash:t});if(!s)return;const{hash:a,messages:o}=s,i=(0,g.ee)(o,"id"),c=Object.keys(i).map(Number).sort(((e,t)=>t-e));let d=(0,n.Rd)();d=(0,r.w3)(d,e.id,i,a),d=(0,r.pf)(d,e.id,u._f,"scheduledIds",c),(0,n.R3)(d)}(o,c)})),(0,n.Q6)("sendScheduledMessages",((e,t,s)=>{const{chatId:n,id:a}=s,o=(0,i.Z1)(e,n);o&&(0,y.t9)("sendScheduledMessages",{chat:o,ids:[a]})})),(0,n.Q6)("rescheduleMessage",((e,t,s)=>{const{chatId:n,messageId:a,scheduledAt:o}=s,r=(0,i.Z1)(e,n),c=r&&(0,i.Tm)(e,r.id,a);r&&c&&(0,y.t9)("rescheduleMessage",{chat:r,message:c,scheduledAt:o})})),(0,n.Q6)("requestThreadInfoUpdate",((e,t,s)=>{const{chatId:n,threadId:a}=s,o=(0,i.Cm)(e,n,a);o&&(0,y.t9)("requestThreadInfoUpdate",{chat:o,threadId:a})})),(0,n.Q6)("loadPinnedMessages",((e,t,s)=>{const{chatId:a}=s,o=(0,i.Z1)(e,a);o&&async function(e){const t=await(0,y.t9)("fetchPinnedMessages",{chat:e});if(!t)return;const{messages:s,chats:a,users:o}=t,i=(0,g.ee)(s,"id"),c=Object.keys(i).map(Number).sort(((e,t)=>t-e));let d=(0,n.Rd)();d=(0,r.c_)(d,e.id,i),d=(0,r.pf)(d,e.id,u._f,"pinnedIds",c),d=(0,r.Sh)(d,(0,g.ee)(o,"id")),d=(0,r.fZ)(d,(0,g.ee)(a,"id")),(0,n.R3)(d)}(o)}));var L=s(5765);const x=(0,C.P2)((e=>e()),500,!1);async function A(e,t){const s=await(0,y.t9)("searchGifs",{query:e,offset:t});s&&(0,n.R3)((0,r.rq)((0,n.Rd)(),!t,s.gifs,s.nextOffset))}(0,n.Q6)("loadStickerSets",(e=>{const{hash:t}=e.stickers.added||{};!async function(e=0){const t=await(0,y.t9)("fetchStickerSets",{hash:e});t&&(0,n.R3)((0,r.z3)((0,n.Rd)(),"added",t.hash,t.sets))}(t)})),(0,n.Q6)("loadAddedStickers",((e,t)=>{const{setIds:s}=e.stickers.added;s&&s.length&&(async()=>{for(let e=0;e<s.length;e++)t.loadStickers({stickerSetId:s[e]}),e%50==0&&e>0&&await(0,C.wO)(500)})()})),(0,n.Q6)("loadRecentStickers",(e=>{const{hash:t}=e.stickers.recent||{};!async function(e=0){const t=await(0,y.t9)("fetchRecentStickers",{hash:e});if(!t)return;const s=(0,n.Rd)();(0,n.R3)({...s,stickers:{...s.stickers,recent:t}})}(t)})),(0,n.Q6)("loadFavoriteStickers",(e=>{const{hash:t}=e.stickers.favorite||{};!async function(e=0){const t=await(0,y.t9)("fetchFavoriteStickers",{hash:e});if(!t)return;const s=(0,n.Rd)();(0,n.R3)({...s,stickers:{...s.stickers,favorite:t}})}(t)})),(0,n.Q6)("loadGreetingStickers",(e=>{const{hash:t}=e.stickers.greeting||{};(async()=>{const e=await(0,y.t9)("fetchStickersForEmoji",{emoji:"👋⭐️",hash:t});if(!e)return;const s=(0,n.Rd)();(0,n.R3)({...s,stickers:{...s.stickers,greeting:{hash:e.hash,stickers:e.stickers.filter((e=>"👋"===e.emoji))}}})})()})),(0,n.Q6)("loadFeaturedStickers",(e=>{const{hash:t}=e.stickers.featured||{};!async function(e=0){const t=await(0,y.t9)("fetchFeaturedStickers",{hash:e});t&&(0,n.R3)((0,r.z3)((0,n.Rd)(),"featured",t.hash,t.sets))}(t)})),(0,n.Q6)("loadStickers",((e,t,s)=>{const{stickerSetId:a,stickerSetShortName:o}=s;let{stickerSetAccessHash:c}=s;if(!c&&!o){const t=(0,i.Ny)(e,a);if(!t)return;c=t.accessHash}!async function(e,t,s){const a=await(0,y.t9)("fetchStickers",{stickerSetShortName:s,stickerSetId:e,accessHash:t});if(!a)return;const{set:o,stickers:i,packs:c}=a;let d=(0,n.Rd)();d=(0,r.Rg)(d,o.id,{...o,stickers:i,packs:c});const l=d.stickers.forEmoji.emoji;l&&c[l]&&(d=(0,r.vy)(d)),(0,n.R3)(d)}(a,c,o)})),(0,n.Q6)("loadAnimatedEmojis",(()=>{!async function(){const e=await(0,y.t9)("fetchAnimatedEmojis");if(!e)return;const{set:t,stickers:s}=e;(0,n.R3)((0,r.g_)((0,n.Rd)(),{...t,stickers:s}))}()})),(0,n.Q6)("loadSavedGifs",(e=>{const{hash:t}=e.gifs.saved;!async function(e=0){const t=await(0,y.t9)("fetchSavedGifs",{hash:e});if(!t)return;const s=(0,n.Rd)();(0,n.R3)({...s,gifs:{...s.gifs,saved:t}})}(t)})),(0,n.Q6)("faveSticker",((e,t,s)=>{const{sticker:n}=s;n&&(0,y.t9)("faveSticker",{sticker:n})})),(0,n.Q6)("unfaveSticker",((e,t,s)=>{const{sticker:a}=s;a&&function(e){const t=(0,n.Rd)();(0,n.R3)({...t,stickers:{...t.stickers,favorite:{...t.stickers.favorite,stickers:t.stickers.favorite.stickers.filter((({id:t})=>t!==e.id))}}}),(0,y.t9)("faveSticker",{sticker:e,unfave:!0})}(a)})),(0,n.Q6)("toggleStickerSet",((e,t,s)=>{const{stickerSetId:n}=s,a=(0,i.Ny)(e,n);if(!a)return;const{accessHash:o,installedDate:r}=a;(0,y.t9)(r?"uninstallStickerSet":"installStickerSet",{stickerSetId:n,accessHash:o})})),(0,n.Q6)("loadEmojiKeywords",((e,t,s)=>{var a;const{language:o}=s;let r=e.emojiKeywords[o];null!==(a=r)&&void 0!==a&&a.isLoading||((0,n.R3)({...e,emojiKeywords:{...e.emojiKeywords,[o]:{...r,isLoading:!0}}}),(async()=>{var t;const s=await(0,y.t9)("fetchEmojiKeywords",{language:o,fromVersion:r?r.version:0});e=(0,n.Rd)(),r=e.emojiKeywords[o],s?(0,n.R3)({...e,emojiKeywords:{...e.emojiKeywords,[o]:{isLoading:!1,version:s.version,keywords:{...null===(t=r)||void 0===t?void 0:t.keywords,...s.keywords}}}}):(0,n.R3)({...e,emojiKeywords:{...e.emojiKeywords,[o]:{...r,isLoading:!1}}})})())})),(0,n.Q6)("setStickerSearchQuery",((e,t,s)=>{const{query:a}=s;a&&x((()=>{!async function(e,t=0){const s=await(0,y.t9)("searchStickers",{query:e,hash:t});if(!s)return;const a=(0,n.Rd)(),{setsById:o,added:i}=a.stickers,c=s.sets.map((({id:e})=>e));i.setIds&&i.setIds.forEach((t=>{if(!c.includes(t)){const{title:s}=o[t]||{};s&&(0,L.Z)(s,e)&&c.unshift(t)}})),(0,n.R3)((0,r.z3)(a,"search",s.hash,s.sets,c))}(a)}))})),(0,n.Q6)("setGifSearchQuery",((e,t,s)=>{const{query:n}=s;"string"==typeof n&&x((()=>{A(n)}))})),(0,n.Q6)("searchMoreGifs",(e=>{const{query:t,offset:s}=e.gifs.search;"string"==typeof t&&x((()=>{A(t,s)}))})),(0,n.Q6)("loadStickersForEmoji",((e,t,s)=>{const{emoji:a}=s,{hash:o}=e.stickers.forEmoji;x((()=>{!async function(e,t=0){let s=(0,n.Rd)();(0,n.R3)({...s,stickers:{...s.stickers,forEmoji:{...s.stickers.forEmoji,emoji:e}}});const a=await(0,y.t9)("fetchStickersForEmoji",{emoji:e,hash:t});s=(0,n.Rd)(),a&&s.stickers.forEmoji.emoji===e&&(s=(0,r.IM)(s,e,a.stickers,a.hash),(0,n.R3)(s))}(a,o)}))})),(0,n.Q6)("clearStickersForEmoji",(e=>({...e,stickers:{...e.stickers,forEmoji:{}}}))),(0,n.Q6)("openStickerSetShortName",((e,t,s)=>{const{stickerSetShortName:n}=s;return{...e,openedStickerSetShortName:n}}));var O=s(790);const F=(0,C.P2)((e=>e()),500,!1);async function U(e="",t,s,o,c,d){let l;if(o){const n=await(0,y.t9)("searchMessagesLocal",{chatOrUser:o,query:e,type:t,limit:a.Hk,offsetId:s,minDate:d,maxDate:c});if(n){const{messages:e,users:t,totalCount:s,nextOffsetId:a}=n;l={messages:e,users:t,chats:[],totalCount:s,nextRate:a}}}else l=await(0,y.t9)("searchMessagesGlobal",{query:e,offsetRate:s,limit:a.Hk,type:t,maxDate:c,minDate:d});let u=(0,n.Rd)();const h=(0,i.JX)(u);if(!l||""!==e&&e!==h)return void(0,n.R3)((0,r.xv)(u,{messages:!1}));const{messages:m,users:f,chats:p,totalCount:I,nextRate:v}=l;p.length&&(u=(0,r.fZ)(u,(0,g.ee)(p,"id"))),f.length&&(u=(0,r.Sh)(u,(0,g.ee)(f,"id"))),m.length&&(u=(0,r.m6)(u,m)),u=(0,r.px)(u,m,I,t,v),(0,n.R3)(u)}(0,n.Q6)("setGlobalSearchQuery",((e,t,s)=>{const{chatId:a}=e.globalSearch,{query:o}=s;o&&!a&&F((()=>{!async function(e){const t=await(0,y.t9)("searchChats",{query:e});let s=(0,n.Rd)();const a=(0,i.JX)(s);if(!t||!a||e!==a)return void(0,n.R3)((0,r.xv)(s,{chats:!1}));const{localChats:o,localUsers:c,globalChats:d,globalUsers:l}=t;(o.length||d.length)&&(s=(0,r.fZ)(s,(0,g.ee)([...o,...d],"id"))),(c.length||l.length)&&(s=(0,r.Sh)(s,(0,g.ee)([...c,...l],"id"))),s=(0,r.xv)(s,{chats:!1}),s=(0,r.No)(s,{localResults:{chatIds:o.map((({id:e})=>e)),userIds:c.map((({id:e})=>e))},globalResults:{...s.globalSearch.globalResults,chatIds:d.map((({id:e})=>e)),userIds:l.map((({id:e})=>e))}}),(0,n.R3)(s)}(o)}))})),(0,n.Q6)("setGlobalSearchDate",((e,t,s)=>{const{date:a}=s,o=a?(0,O.IS)(a):a,c=(0,r.No)(e,{date:a,query:"",resultsByType:{...e.globalSearch.resultsByType,text:{totalCount:void 0,foundIds:[],nextOffsetId:0}}});(0,n.R3)(c);const{chatId:d}=e.globalSearch;U("","text",void 0,d?(0,i.Z1)(e,d):void 0,o,a)})),(0,n.Q6)("searchMessagesGlobal",((e,t,s)=>{var n;const{query:a,resultsByType:o,chatId:r,date:c}=e.globalSearch,d=c?(0,O.IS)(c):c,{type:l}=s;U(a,l,null==o||null===(n=o[l])||void 0===n?void 0:n.nextOffsetId,r?(0,i.Z1)(e,r):void 0,d,c)})),(0,n.Q6)("searchTextMessagesLocal",(e=>{const{chatId:t,threadId:s}=(0,i.Bt)(e)||{},o=t?(0,i.Z1)(e,t):void 0,c=(0,i.n5)(e);if(!o||!c||!s)return;const{query:d,results:l}=c,h=null==l?void 0:l.nextOffsetId;let m;if(s!==u._f){const n=(0,i.tZ)(e,t,s);m=null==n?void 0:n.topMessageId}!async function(e,t,s,o,c){const d=await(0,y.t9)("searchMessagesLocal",{chatOrUser:e,type:"text",query:o,topMessageId:s,limit:a.pn,offsetId:c});if(!d)return;const{messages:l,users:u,totalCount:h,nextOffsetId:m}=d,f=(0,g.ee)(l,"id"),p=Object.keys(f).map(Number);let I=(0,n.Rd)();const v=(0,i.n5)(I);!v||o&&o!==v.query||(I=(0,r.c_)(I,e.id,f),I=(0,r.Sh)(I,(0,g.ee)(u,"id")),I=(0,r.dx)(I,e.id,t,p,h,m),(0,n.R3)(I))}(o,s,m,d,h)})),(0,n.Q6)("searchMediaMessagesLocal",(e=>{const t=(0,i.og)(e),s=t?e.users.byId[t]||e.chats.byId[t]:void 0,o=(0,i.we)(e);if(!s||!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,s){const o=await(0,y.t9)("searchMessagesLocal",{chatOrUser:e,type:t,limit:a.EN,offsetId:s});if(!o)return;const{messages:c,users:d,totalCount:l,nextOffsetId:u}=o,h=(0,g.ee)(c,"id"),m=Object.keys(h).map(Number);let f=(0,n.Rd)();(0,i.we)(f)&&(f=(0,r.c_)(f,e.id,h),f=(0,r.Sh)(f,(0,g.ee)(d,"id")),f=(0,r.c1)(f,e.id,t,m,l,u),(0,n.R3)(f))}(s,c,u)})),(0,n.Q6)("searchMessagesByDate",((e,t,s)=>{const{timestamp:a}=s,{chatId:o}=(0,i.Bt)(e)||{};if(!o)return;const r=(0,i.Z1)(e,o);r&&async function(e,t){const s=await(0,y.t9)("findFirstMessageIdAfterDate",{chat:e,timestamp:t});s&&(0,n.uC)().focusMessage({chatId:e.id,messageId:s})}(r,a)})),(0,n.Q6)("checkPublicLink",((e,t,s)=>{const{chatId:a}=(0,i.Bt)(e)||{};if(!a)return;if(e.management.progress===h.wv.InProgress)return;const{username:o}=s;(async()=>{e=(0,r.H9)(e,h.wv.InProgress),e=(0,r.fw)(e,a,{isUsernameAvailable:void 0}),(0,n.R3)(e);const t=await(0,y.t9)("checkChatUsername",{username:o});e=(0,n.Rd)(),e=(0,r.H9)(e,t?h.wv.Complete:h.wv.Error),e=(0,r.fw)(e,a,{isUsernameAvailable:t}),(0,n.R3)(e)})()})),(0,n.Q6)("updatePublicLink",((e,t,s)=>{const{chatId:a}=(0,i.Bt)(e)||{};let o=a&&(0,i.Z1)(e,a);if(!a||!o)return;const{username:c}=s;(async()=>{if(e=(0,r.H9)(e,h.wv.InProgress),(0,n.R3)(e),(0,d.G9)(o)){if(o=await(0,y.t9)("migrateChat",o),!o)return;t.openChat({id:o.id})}const s=await(0,y.t9)("setChatUsername",{chat:o,username:c});e=(0,n.Rd)(),e=(0,r.H9)(e,s?h.wv.Complete:h.wv.Error),e=(0,r.fw)(e,a,{isUsernameAvailable:void 0}),(0,n.R3)(e)})()})),(0,n.Q6)("updatePrivateLink",(e=>{const{chatId:t}=(0,i.Bt)(e)||{},s=t&&(0,i.Z1)(e,t);t&&s&&(0,y.t9)("updatePrivateLink",{chat:s})}));var Q=s(7358);async function $(){const e=await(0,y.t9)("fetchChats",{limit:a.Ov,archived:!0,withPinned:!0,serverTimeOffset:(0,n.Rd)().serverTimeOffset});if(!e)return;let t=(0,n.Rd)();t=(0,r.eD)(t,(0,g.ee)(e.users,"id")),t=(0,r.GL)(t,(0,g.ee)(e.chats,"id")),t=(0,r.Mg)(t,"archived",e.chatIds),t=(0,r.vv)(t,"archived",e),(0,n.R3)(t)}async function D(){let e=(0,n.Rd)();const{recentlyFoundChatIds:t}=e.globalSearch,{userIds:s}=e.contactList||{};if(!(s&&s.length||t&&t.length))return;const a=[...t||[],...s||[]].map((t=>(0,i.dy)(e,t))).filter(Boolean),o=await(0,y.t9)("fetchUsers",{users:a});o&&(e=(0,n.Rd)(),e=(0,r.eD)(e,(0,g.ee)(o,"id")),(0,n.R3)(e))}function q(e){return(0,y.t9)("fetchMessages",{chat:e,threadId:u._f,offsetId:e.lastReadInboxMessageId,addOffset:-(Math.round(a.hT/2)+1),limit:a.hT})}(0,n.Q6)("sync",((e,t)=>{!async function(e){a.eM&&console.log(">>> START SYNC"),await(0,y.t9)("fetchCurrentUser");const t=await async function(){const e=await(0,y.t9)("fetchChats",{limit:a.Ov,withPinned:!0,serverTimeOffset:(0,n.Rd)().serverTimeOffset});if(!e)return;let t=(0,n.Rd)();const{recentlyFoundChatIds:s}=t.globalSearch,{userIds:o}=t.contactList||{},{currentUserId:c}=t,l=[...s||[],...o||[],...c?[c]:[]],h=l.map((e=>(0,i.dy)(t,e))).filter(Boolean),m=l.map((e=>(0,i.Z1)(t,e))).filter(Boolean),{chatId:f}=(0,i.Bt)(t)||{};if(f){const e=(0,i.Z1)(t,f);if(e&&!l.includes(f)&&m.push(e),(0,d.YA)(f)){const e=(0,i.dy)(t,f);e&&!l.includes(f)&&h.push(e)}}return h.push(...e.users),m.push(...e.chats),t=(0,r.SL)(t,(0,g.ee)(m,"id")),t=(0,r.Mg)(t,"active",e.chatIds),t={...t,chats:{...t.chats}},t=(0,r.vv)(t,"active",e),Object.keys(e.draftsById).map(Number).forEach((s=>{t=(0,r.pf)(t,s,u._f,"draft",e.draftsById[s])})),Object.keys(e.replyingToById).map(Number).forEach((s=>{t=(0,r.pf)(t,s,u._f,"replyingToId",e.replyingToById[s])})),(0,n.R3)(t),f&&!t.chats.byId[f]&&(0,n.uC)().openChat({id:void 0}),h}();await async function(e){let t=!1,s=e||[],a=(0,n.Rd)();const{chatId:o,threadId:c}=(0,i.Bt)(a)||{},d=Object.keys(a.messages.byChatId).map(Number).reduce(((e,t)=>{const s=(0,i.Ms)(a,t,u._f);return s?{...e,[t]:s}:e}),{});if(o){const e=await q(a.chats.byId[o]);a=(0,n.Rd)();const{chatId:d}=(0,i.Bt)(a)||{},l=c&&(0,i.tZ)(a,o,c);if(e&&d===o){const n=a.messages.byChatId[o],i=(0,g.ee)(e.messages,"id"),d=Object.keys(i).map(Number);if(a={...a,messages:{...a.messages,byChatId:{[o]:{byId:i,threadsById:{[u._f]:{...null==n?void 0:n.threadsById[u._f],listedIds:d,viewportIds:d,outlyingIds:void 0}}}}}},c&&l&&l.originChannelId){const{originChannelId:e}=l,t=a.messages.byChatId[e],s=await q(a.chats.byId[e]);if(s){const e=(0,g.ee)(s.messages,"id"),r=Object.keys(e).map(Number);a={...a,messages:{...a.messages,byChatId:{...a.messages.byChatId,[l.originChannelId]:{byId:e,threadsById:{[u._f]:{...null==t?void 0:t.threadsById[u._f],listedIds:r,viewportIds:r,outlyingIds:void 0}}},[o]:{...a.messages.byChatId[o],threadsById:{...a.messages.byChatId[o].threadsById,[c]:{...null==n?void 0:n.threadsById[c],outlyingIds:void 0}}}}}}}}a=(0,r.GL)(a,(0,g.ee)(e.chats,"id")),a=(0,r.j6)(a,o,e.threadInfos),t=!0,s=Array.prototype.concat(s,e.users)}}t||(a={...a,messages:{...a.messages,byChatId:{}}}),Object.keys(d).map(Number).forEach((e=>{a=(0,r.pf)(a,e,u._f,"draft",d[e])})),e?a=(0,r.s5)(a,(0,g.ee)(s,"id")):s&&(a=(0,r.eD)(a,(0,g.ee)(s,"id"))),(0,n.R3)(a);const{chatId:l,messageId:h}=a.audioPlayer;l&&h&&!(0,i.hj)(a,l,h)&&(0,n.uC)().closeAudioPlayer()}(t),(0,n.R3)({...(0,n.Rd)(),lastSyncTime:Date.now()}),a.eM&&console.log(">>> FINISH SYNC"),e()}(t.afterSync)})),(0,n.Q6)("afterSync",((e,t)=>{!async function(e){a.eM&&console.log(">>> START AFTER-SYNC"),e.loadFavoriteStickers(),await Promise.all([D(),$()]),await(0,y.t9)("fetchCurrentUser"),(0,Q.w)((0,i.A1)((0,n.Rd)())),a.eM&&console.log(">>> FINISH AFTER-SYNC")}(t)}));var G=s(2267);const H=(0,C.Ds)((e=>e()),500,!1,!0),j=(0,C.P2)((e=>e()),500,!1);function _(e,t,s){return{...e,inlineBots:{...e.inlineBots,byUsername:{...e.inlineBots.byUsername,[t]:s}}}}function V(e,t){return{...e,inlineBots:{...e.inlineBots,isLoading:t}}}(0,n.Q6)("loadFullUser",((e,t,s)=>{const{userId:n}=s,a=(0,i.dy)(e,n);if(!a)return;const{id:o,accessHash:r}=a;H((()=>(0,y.t9)("fetchFullUser",{id:o,accessHash:r})))})),(0,n.Q6)("loadUser",((e,t,s)=>{const{userId:a}=s,o=(0,i.dy)(e,a);o&&(async()=>{const t=await(0,y.t9)("fetchUsers",{users:[o]});t&&(e=(0,n.Rd)(),e=(0,r.eD)(e,(0,g.ee)(t,"id")),(0,n.R3)(e))})()})),(0,n.Q6)("loadTopUsers",(e=>{const{topPeers:{hash:t,lastRequestedAt:s}}=e;(!s||(0,G.b)(e.serverTimeOffset)-s>60)&&async function(e){const t=await(0,y.t9)("fetchTopUsers",{hash:e});if(!t)return;const{hash:s,ids:a,users:o}=t;let i=(0,n.Rd)();i=(0,r.Sh)(i,(0,g.ee)(o,"id")),i={...i,topPeers:{...i.topPeers,hash:s,userIds:a,lastRequestedAt:(0,G.b)(i.serverTimeOffset)}},(0,n.R3)(i)}(t)})),(0,n.Q6)("loadContactList",(e=>{const{hash:t}=e.contactList||{};!async function(e){const t=await(0,y.t9)("fetchContactList",{hash:e});if(!t)return;let s=(0,r.Sh)((0,n.Rd)(),(0,g.ee)(t.users,"id"));s=(0,r.fZ)(s,(0,g.ee)(t.chats,"id"));const a=e=>e.lastName||e.firstName||"",o=new Intl.Collator("en-US"),i=t.users.sort(((e,t)=>o.compare(a(e),a(t)))).filter((e=>!e.isSelf));(0,n.R3)({...s,contactList:{hash:t.hash,userIds:i.map((e=>e.id))}})}(t)})),(0,n.Q6)("loadCurrentUser",(()=>{(0,y.t9)("fetchCurrentUser")})),(0,n.Q6)("updateContact",((e,t,s)=>{const{userId:a,isMuted:o,firstName:c,lastName:d}=s;!async function(e,t,s,a){const o=(0,n.Rd)(),c=(0,i.dy)(o,e);c&&((0,n.uC)().updateChatMutedState({chatId:e,isMuted:t}),(0,n.R3)((0,r.H9)((0,n.Rd)(),h.wv.InProgress)),await(0,y.t9)("updateContact",{phone:c.phoneNumber,firstName:s,lastName:a})&&(0,n.R3)((0,r.Nq)((0,n.Rd)(),c.id,{firstName:s,lastName:a})),(0,n.R3)((0,r.H9)((0,n.Rd)(),h.wv.Complete)))}(a,o,c,d)})),(0,n.Q6)("deleteUser",((e,t,s)=>{const{userId:a}=s;!async function(e){const t=(0,n.Rd)(),s=(0,i.dy)(t,e);if(!s)return;const{id:a,accessHash:o}=s;await(0,y.t9)("deleteUser",{id:a,accessHash:o})}(a)})),(0,n.Q6)("loadProfilePhotos",((e,t,s)=>{const{profileId:a}=s,o=(0,d.YA)(a),c=o?(0,i.dy)(e,a):void 0,l=o?void 0:(0,i.Z1)(e,a);(c||l)&&(async()=>{const e=await(0,y.t9)("fetchProfilePhotos",c,l);if(!e||!e.photos)return;let t=(0,n.Rd)();o?t=(0,r.Nq)(t,a,{photos:e.photos}):(t=(0,r.Sh)(t,(0,g.ee)(e.users,"id")),t=(0,r.a4)(t,a,{photos:e.photos})),(0,n.R3)(t)})()})),(0,n.Q6)("setUserSearchQuery",((e,t,s)=>{const{query:a}=s;a&&j((()=>{!async function(e){const t=await(0,y.t9)("searchChats",{query:e});let s=(0,n.Rd)();const a=s.userSearch.query;if(!t||!a||e!==a)return void(0,n.R3)((0,r.Q3)(s,!1));const{localUsers:o,globalUsers:i}=t;let c,d;o.length&&(s=(0,r.Sh)(s,(0,g.ee)(o,"id")),c=o.map((({id:e})=>e))),i.length&&(s=(0,r.Sh)(s,(0,g.ee)(i,"id")),d=i.map((({id:e})=>e))),s=(0,r.Q3)(s,!1),s=(0,r.Lm)(s,{localUserIds:c,globalUserIds:d}),(0,n.R3)(s)}(a)}))}));const W=(0,C.Ds)((e=>e()),500,!1);async function z(e,t,s,n){await(0,y.t9)("sendMessage",{chat:e,text:s,replyingTo:n})}(0,n.Q6)("clickInlineButton",((e,t,s)=>{const{button:o}=s;switch(o.type){case"command":t.sendBotCommand({command:o.value});break;case"url":o.value.match(a.Lj)||o.value.match(a.FS)||o.value.match(a.g$)||o.value.match(a.iL)?t.openTelegramLink({url:o.value}):t.toggleSafeLinkModal({url:o.value});break;case"callback":{const t=(0,i.jr)(e);if(!t)return;!async function(e,t,s){const a=await(0,y.t9)("answerCallbackButton",{chatId:e.id,accessHash:e.accessHash,messageId:t,data:s});if(!a)return;const{showDialog:o,showNotification:r,toggleSafeLinkModal:i}=(0,n.uC)(),{message:c,alert:d,url:l}=a;d?o({data:{message:c||"Error"}}):c?r({message:c}):l&&i({url:l})}(t,o.messageId,o.value);break}case"requestPoll":t.openPollModal();break;case"buy":{const s=(0,i.jr)(e),{messageId:n,value:a}=o;if(!s)return;a?t.getReceipt({receiptMessageId:a,chatId:s.id,messageId:n}):(t.getPaymentForm({chat:s,messageId:n}),t.setInvoiceMessageInfo((0,i.hj)(e,s.id,n)),t.openPaymentModal({chatId:s.id,messageId:n}));break}}})),(0,n.Q6)("sendBotCommand",((e,t,s)=>{const{command:n,chatId:a}=s,{currentUserId:o}=e,r=a?(0,i.Z1)(e,a):(0,i.jr)(e),c=(0,i.Bt)(e);if(!o||!r||!c)return;const{threadId:d}=c;t.setReplyingToId({messageId:void 0}),t.clearWebPagePreview({chatId:r.id,threadId:d,value:!1}),z(r,0,n,(0,i.Yy)(e,r.id,d))})),(0,n.Q6)("restartBot",((e,t,s)=>{const{chatId:a}=s,{currentUserId:o}=e,c=(0,i.jr)(e),d=o&&(0,i.IK)(e,a);o&&c&&d&&(async()=>{await(0,y.t9)("unblockContact",d.id,d.accessHash)&&((0,n.R3)((0,r.rB)((0,n.Rd)(),d.id)),z(c,0,"/start"))})()})),(0,n.Q6)("loadTopInlineBots",(e=>{const{hash:t,lastRequestedAt:s}=e.topInlineBots;s&&(0,G.b)(e.serverTimeOffset)-s<60||(async()=>{const s=await(0,y.t9)("fetchTopInlineBots",{hash:t});if(!s)return;const{hash:a,ids:o,users:i}=s;let c=(0,n.Rd)();c=(0,r.Sh)(c,(0,g.ee)(i,"id")),c={...c,topInlineBots:{...c.topInlineBots,hash:a,userIds:o,lastRequestedAt:(0,G.b)(e.serverTimeOffset)}},(0,n.R3)(c)})()})),(0,n.Q6)("queryInlineBot",((e,t,s)=>{const{chatId:a,username:o,query:c,offset:d}=s;(async()=>{let t=e.inlineBots.byUsername[o];if(!1!==t){if(void 0===t){const{user:s,chat:a}=await(0,y.t9)("fetchInlineBot",{username:o})||{};if(e=(0,n.Rd)(),!s||!a)return void(0,n.R3)(_(e,o,!1));e=(0,r.Sh)(e,{[s.id]:s}),e=(0,r.fZ)(e,{[a.id]:a}),t={id:s.id,query:"",offset:"",switchPm:void 0,canLoadMore:!0,results:[]},e=_(e,o,t),(0,n.R3)(e)}(c!==t.query||t.canLoadMore)&&W((()=>{!async function({username:e,inlineBotData:t,chatId:s,query:a,offset:o}){let r=(0,n.Rd)();const c=(0,i.dy)(r,t.id),d=(0,i.Z1)(r,s);if(!c||!d)return;const l=t.query!==a;r=V(r,!0),r=_(r,e,{...t,query:a,...l&&{offset:void 0,results:[]}}),(0,n.R3)(r);const u=await(0,y.t9)("fetchInlineBotResults",{bot:c,chat:d,query:a,offset:l?void 0:o}),h=r.inlineBots.byUsername[e];if(r=V((0,n.Rd)(),!1),!u||!h||a!==h.query)return void(0,n.R3)(r);const m=new Set((h.results||[]).map((e=>e.id))),g=u.results.filter((e=>!m.has(e.id)));r=_(r,e,{...h,help:u.help,...g.length&&{isGallery:u.isGallery},...u.switchPm&&{switchPm:u.switchPm},canLoadMore:u.results.length>0&&Boolean(u.nextOffset),results:""===h.offset||h.offset===u.nextOffset?u.results:(h.results||[]).concat(g),offset:g.length?u.nextOffset:""}),(0,n.R3)(r)}({username:o,inlineBotData:t,chatId:a,query:c,offset:d})}))}})()})),(0,n.Q6)("sendInlineBotResult",((e,t,s)=>{const{id:n,queryId:a}=s,o=(0,i.Bt)(e);if(!o||!n)return;const{chatId:r,threadId:c}=o,d=(0,i.Z1)(e,r);t.setReplyingToId({messageId:void 0}),t.clearWebPagePreview({chatId:r,threadId:c,value:!1}),(0,y.t9)("sendInlineBotResult",{chat:d,resultId:n,queryId:a,replyingTo:(0,i.Yy)(e,r,c)})})),(0,n.Q6)("resetInlineBot",((e,t,s)=>{const{username:a}=s;let o=e.inlineBots.byUsername[a];o&&(o={id:o.id,query:"",offset:"",switchPm:void 0,canLoadMore:!0,results:[]},(0,n.R3)(_(e,a,o)))})),(0,n.Q6)("startBot",((e,t,s)=>{const{botId:n,param:a}=s,o=(0,i.dy)(e,n);o&&(async()=>{await(0,y.t9)("startBot",{bot:o,startParam:a})})()})),s(9667),(0,n.Q6)("loadPasswordInfo",(()=>{(async()=>{const e=await(0,y.t9)("getPasswordInfo");if(!e)return;let t=(0,n.Rd)();t=(0,r.BI)(t,{hasPassword:e.hasPassword}),t=(0,r.IE)(t,{hint:e.hint}),(0,n.R3)(t)})()})),(0,n.Q6)("checkPassword",((e,t,s)=>{const{currentPassword:a,onSuccess:o}=s;(0,n.R3)((0,r.IE)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await(0,y.t9)("checkPassword",a);(0,n.R3)((0,r.IE)((0,n.Rd)(),{isLoading:!1})),e&&o()})()})),(0,n.Q6)("clearPassword",((e,t,s)=>{const{currentPassword:a,onSuccess:o}=s;(0,n.R3)((0,r.IE)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await(0,y.t9)("clearPassword",a);(0,n.R3)((0,r.IE)((0,n.Rd)(),{isLoading:!1})),e&&o()})()})),(0,n.Q6)("updatePassword",((e,t,s)=>{const{currentPassword:a,password:o,hint:i,email:c,onSuccess:d}=s;(0,n.R3)((0,r.IE)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await(0,y.t9)("updatePassword",a,o,i,c);(0,n.R3)((0,r.IE)((0,n.Rd)(),{isLoading:!1})),e&&d()})()})),(0,n.Q6)("updateRecoveryEmail",((e,t,s)=>{const{currentPassword:a,email:o,onSuccess:i}=s;(0,n.R3)((0,r.IE)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await(0,y.t9)("updateRecoveryEmail",a,o);(0,n.R3)((0,r.IE)((0,n.Rd)(),{isLoading:!1,waitingEmailCodeLength:void 0})),e&&i()})()})),(0,n.Q6)("provideTwoFaEmailCode",((e,t,s)=>{const{code:n}=s;(0,y.t9)("provideRecoveryEmailCode",n)})),(0,n.Q6)("clearTwoFaError",(e=>(0,r.IE)(e,{error:void 0}))),(0,n.Q6)("validateRequestedInfo",((e,t,s)=>{const{requestInfo:a,saveInfo:o}=s,c=(0,i.gx)(e),d=c&&(0,i.Z1)(e,c),l=(0,i.Mz)(e);d&&l&&async function(e,t,s,a){const o=await(0,y.t9)("validateRequestedInfo",{chat:e,messageId:t,requestInfo:s,shouldSave:a});if(!o)return;const{id:i,shippingOptions:c}=o;if(!i)return;let d=(0,r.vT)((0,n.Rd)(),i);c?(d=(0,r.TM)(d,c),d=(0,r.Q$)(d,h.KB.Shipping)):d=(0,r.Q$)(d,h.KB.PaymentInfo),(0,n.R3)(d)}(d,l,a,o)})),(0,n.Q6)("getPaymentForm",((e,t,s)=>{const{chat:a,messageId:o}=s;a&&o&&async function(e,t){const s=await(0,y.t9)("getPaymentForm",{chat:e,messageId:t});if(!s)return;let a=(0,r._7)((0,n.Rd)(),s),o=h.KB.PaymentInfo;a.payment.invoice&&(a.payment.invoice.shippingAddressRequested||a.payment.invoice.nameRequested||a.payment.invoice.phoneRequested||a.payment.invoice.emailRequested)&&(o=h.KB.ShippingInfo),a=(0,r.Q$)(a,o),(0,n.R3)(a)}(a,o)})),(0,n.Q6)("getReceipt",((e,t,s)=>{const{receiptMessageId:a,chatId:o,messageId:c}=s,d=o&&(0,i.Z1)(e,o);c&&a&&d&&async function(e,t,s){const a=await(0,y.t9)("getReceipt",e,s);if(!a)return;let o=(0,n.Rd)();const c=(0,i.hj)(o,e.id,t);o=(0,r.Dq)(o,a,c),(0,n.R3)(o)}(d,c,a)})),(0,n.Q6)("clearPaymentError",(e=>{(0,n.R3)({...e,payment:{...e.payment,error:void 0}})})),(0,n.Q6)("clearReceipt",(e=>{(0,n.R3)({...e,payment:{...e.payment,receipt:void 0}})})),(0,n.Q6)("sendCredentialsInfo",((e,t,s)=>{const a=(0,i.$$)(e);if(!a)return;const{credentials:o}=s,{data:c}=o;!async function(e,t){const s=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}),a=await fetch(`https://api.stripe.com/v1/tokens${s}`,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/x-www-form-urlencoded",Authorization:`Bearer ${t}`}}),o=await a.json();if(o.error){const e=(0,d.Ow)(o.error),t=(0,n.Rd)();return void(0,n.R3)({...t,payment:{...t.payment,error:{...e}}})}let i=(0,r.QH)((0,n.Rd)(),{type:o.type,id:o.id});i=(0,r.Q$)(i,h.KB.Checkout),(0,n.R3)(i)}(c,a)})),(0,n.Q6)("sendPaymentForm",((e,t,s)=>{const{shippingOptionId:a,saveCredentials:o}=s,c=(0,i.gx)(e),d=c&&(0,i.Z1)(e,c),l=(0,i.Mz)(e),u=(0,i.eh)(e),h=(0,i.sp)(e),m=(0,i.$$)(e),g=(0,i.i3)(e);d&&l&&m&&u&&async function(e,t,s,a,o,i){if(await(0,y.t9)("sendPaymentForm",{chat:e,messageId:t,formId:s,credentials:a,requestedInfoId:o,shippingOptionId:i})){const e=(0,r.bp)((0,n.Rd)());(0,n.R3)((0,r.WY)(e))}}(d,l,u,{save:o,data:g},h,a)})),(0,n.Q6)("setPaymentStep",((e,t,s={})=>(0,r.Q$)(e,s.step||h.KB.ShippingInfo))),(0,n.Q6)("setInvoiceMessageInfo",((e,t,s)=>(0,r.nA)(e,s))),s(4907);var Y=s(8406);const K=(0,C.P2)((e=>e()),500,!0);(0,n.Q6)("apiUpdate",((e,t,s)=>{switch(s["@type"]){case"updateChat":{s.noTopChatsRequest||(0,i.N)(e,s.id)||t.loadTopChats();const a=(0,r.a4)(e,s.id,s.chat,s.newProfilePhoto);(0,n.R3)(a),K((()=>(0,Q.w)((0,i.A1)((0,n.Rd)())))),s.chat.id&&(0,Y.Vr)({chatId:s.chat.id,lastReadInboxMessageId:s.chat.lastReadInboxMessageId});break}case"updateChatJoin":{const a=(0,i.Ek)(e,s.id);if(!a)break;e=(0,r.B1)(e,a,[s.id]),e=(0,r.a4)(e,s.id,{isNotJoined:!1}),(0,n.R3)(e);const o=(0,i.Z1)(e,s.id);o&&t.requestChatUpdate({chatId:o.id});break}case"updateChatLeave":{const t=(0,i.Ek)(e,s.id);if(!t)break;const{[t]:a}=e.chats.listIds;a&&(e=(0,r.Mg)(e,t,a.filter((e=>e!==s.id)))),e=(0,r.a4)(e,s.id,{isNotJoined:!0}),(0,n.R3)(e);break}case"updateChatInbox":(0,n.R3)((0,r.a4)(e,s.id,s.chat)),K((()=>(0,Q.w)((0,i.A1)((0,n.Rd)()))));break;case"updateChatTypingStatus":{const{id:t,typingStatus:a}=s;(0,n.R3)((0,r.a4)(e,t,{typingStatus:a})),setTimeout((()=>{const e=(0,n.Rd)(),s=(0,i.Z1)(e,t);s&&a&&s.typingStatus&&s.typingStatus.timestamp===a.timestamp&&(0,n.R3)((0,r.a4)(e,t,{typingStatus:void 0}))}),6e3);break}case"newMessage":{const{message:a}=s,{chatId:o,threadId:c,type:d}=(0,i.Bt)(e)||{};if(a.senderId===e.currentUserId&&!a.isFromScheduled)return;const l=(0,i.Z1)(e,s.chatId);if(!l)return;const h="thread"===d&&c===u._f&&s.chatId===o;h?setTimeout((()=>{t.requestChatUpdate({chatId:s.chatId})}),1500):(0,n.R3)((0,r.a4)(e,s.chatId,{unreadCount:l.unreadCount?l.unreadCount+1:1,...s.message.hasUnreadMention&&{unreadMentionsCount:l.unreadMentionsCount?l.unreadMentionsCount+1:1}})),(0,Q.w)((0,i.A1)((0,n.Rd)()));const{hasWebNotifications:m}=(0,i.dZ)(e);m&&(0,Y.VL)({chat:l,message:a,isActiveChat:h});break}case"updateCommonBoxMessages":case"updateChannelMessages":{const{ids:t,messageUpdate:a}=s;if(!1!==a.hasUnreadMention)return;t.forEach((t=>{const n="channelId"in s?s.channelId:(0,i.X5)(e,t),a=(0,i.Z1)(e,n);null!=a&&a.unreadMentionsCount&&(e=(0,r.a4)(e,n,{unreadMentionsCount:a.unreadMentionsCount-1}))})),(0,n.R3)(e);break}case"updateChatFullInfo":{const{fullInfo:t}=s,a=e.chats.byId[s.id];if(!a)return;(0,n.R3)((0,r.a4)(e,s.id,{fullInfo:{...a.fullInfo,...t}}));break}case"updatePinnedChatIds":{const{ids:t,folderId:o}=s,r=o===a.WS?"archived":"active";e={...e,chats:{...e.chats,orderedPinnedIds:{...e.chats.orderedPinnedIds,[r]:t.length?t:void 0}}},(0,n.R3)(e);break}case"updateChatPinned":{const{id:t,isPinned:o}=s,r=(0,i.Ek)(e,t);if(r){const{[r]:s}=e.chats.orderedPinnedIds;let n=s||[];if(o){if(!n.includes(t)){if("active"===r&&n.length>=a.EG){const t=e.chats.listIds.active;n=n.filter((e=>t&&t.includes(e)))}n=[t,...n]}}else n=n.filter((e=>e!==t));e={...e,chats:{...e.chats,orderedPinnedIds:{...e.chats.orderedPinnedIds,[r]:n.length?n:void 0}}}}(0,n.R3)(e);break}case"updateChatListType":{const{id:t,folderId:a}=s;(0,n.R3)((0,r.Pi)(e,t,a));break}case"updateChatFolder":{const{id:t,folder:a}=s,{byId:o,orderedIds:r}=e.chatFolders,i=a?{...o,[t]:a}:(0,g.ei)(o,Object.keys(o).map(Number).filter((e=>e!==t))),c=a?r&&r.includes(t)?r:[...r||[],t]:r?r.filter((e=>e!==t)):void 0;(0,n.R3)({...e,chatFolders:{...e.chatFolders,byId:i,orderedIds:c}});break}case"updateChatFoldersOrder":{const{orderedIds:t}=s;(0,n.R3)({...e,chatFolders:{...e.chatFolders,orderedIds:t}});break}case"updateRecommendedChatFolders":{const{folders:t}=s;(0,n.R3)({...e,chatFolders:{...e.chatFolders,recommended:t}});break}case"updateChatMembers":{var o;const t=e.chats.byId[s.id],{replacedMembers:a,addedMember:i,deletedMemberId:c}=s;if(!t)return;let d=!1,l=null!==(o=t.fullInfo)&&void 0!==o&&o.members?[...t.fullInfo.members]:[];if(a)l=a,d=!0;else if(i)l.length&&l.some((e=>e.userId===i.userId))||(l.push(i),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 a=l.filter((({isOwner:e,isAdmin:t})=>e||t));(0,n.R3)((0,r.a4)(e,s.id,{membersCount:l.length,fullInfo:{...t.fullInfo,members:l,adminMembers:a}}))}break}case"deleteProfilePhotos":{const{chatId:t,ids:a}=s,o=e.chats.byId[t];null!=o&&o.photos&&(0,n.R3)((0,r.a4)(e,t,{photos:o.photos.filter((e=>!a.includes(e.id)))}));break}case"draftMessage":{const{chatId:t,formattedText:a,date:o,replyingToId:i}=s;e.chats.byId[t]&&(e=(0,r.pf)(e,t,u._f,"draft",a),e=(0,r.pf)(e,t,u._f,"replyingToId",i),e=(0,r.a4)(e,t,{draftDate:o}),(0,n.R3)(e));break}case"showInvite":{const{data:e}=s;t.showDialog({data:e});break}}}));const X=350;function J(e,t,s,n,a=!1){const o=a?(0,i.Tm)(e,t,s):(0,i.hj)(e,t,s);if(o&&n.content){const{photo:e,video:t,sticker:s,document:a}=(0,d.qp)(o);e&&n.content.photo?(n.content.photo.blobUrl=e.blobUrl,n.content.photo.thumbnail=e.thumbnail):t&&n.content.video?n.content.video.blobUrl=t.blobUrl:s&&n.content.sticker?n.content.sticker.isPreloadedGlobally=s.isPreloadedGlobally:a&&n.content.document&&(n.content.document.previewBlobUrl=a.previewBlobUrl)}return a?(0,r.P4)(e,t,s,n):(0,r.cY)(e,t,s,n)}function ee(e,t,s,n){const{chatId:a}=s,{threadInfo:o}=(0,i.Db)(e,a,s)||{};if(!o&&s.replyToMessageId){const o=(0,i.hj)(e,a,s.replyToMessageId);o?e=(0,r.lG)(e,o,a,s.id,n):t.loadMessage({chatId:a,messageId:s.replyToMessageId,threadUpdate:{isDeleting:n,lastMessageId:s.id}})}return e}function te(e,t,s){const{id:n,chatId:a}=s,{threadInfo:o,firstMessageId:c}=(0,i.Db)(e,a,s)||{},l=(0,i.Z1)(e,a),h=(null==l?void 0:l.unreadCount)&&!(0,i.gb)(e,a,u._f);if(e=ee(e,t,s),o&&(!c&&(0,d.CI)(s)||(e=(0,r.xj)(e,a,o.threadId,[n]),(0,i.b9)(e,a,o.threadId)&&(e=(0,r.$S)(e,a,o.threadId,n),c||(e=(0,r.pf)(e,a,o.threadId,"firstMessageId",s.id)))),e=(0,r.pf)(e,a,o.threadId,"threadInfo",{...o,lastMessageId:s.id,messagesCount:o.messagesCount+1})),h)return e;if(e=(0,r.xj)(e,a,u._f,[n]),(0,i.b9)(e,a,u._f)){const t=(0,i.It)(e,a,u._f),s=(0,r.$S)(e,a,u._f,n),o=(0,i.Cb)(s,a,u._f);t&&!o.includes(t)||(e=s)}return e}function se(e,t,s,n=!1){var a;const{chats:o}=e,i=null===(a=o.byId[t])||void 0===a?void 0:a.lastMessage;return!i||n||i.id===s.id||i.id===s.previousLocalId||s.id>i.id?(0,r.a4)(e,t,{lastMessage:s}):e}function ne(e,t){const s=(0,i.Zw)(e,t),n=(0,i.gb)(e,t,u._f);if(!s||!n)return;let a=n.length;for(;a--;){const e=s[n[a]];if(!e.isDeleting)return e}}function ae(e,t,s,a){if(e){t.forEach((t=>{const s=ne(a=(0,r.cY)(a,e,t,{isDeleting:!0}),e);s&&(a=se(a,e,s,!0))})),(0,n.R3)(a),s.requestChatUpdate({chatId:e});const o=[];return t.forEach((t=>{const n=(0,i.hj)(a,e,t);if(!n)return;a=ee(a,s,n,!0);const{threadInfo:r}=(0,i.Db)(a,e,n)||{};r&&o.push(r.threadId)})),(0,n.R3)(a),void setTimeout((()=>{(0,n.R3)((0,r.K4)((0,n.Rd)(),e,t)),(0,g.Tw)(o).forEach((t=>{s.requestThreadInfoUpdate({chatId:e,threadId:t})}))}),X)}const o=[];t.forEach((e=>{const t=(0,i.X5)(a,e);if(t){o.push(t);const s=ne(a=(0,r.cY)(a,t,e,{isDeleting:!0}),t);s&&(a=se(a,t,s,!0)),setTimeout((()=>{(0,n.R3)((0,r.K4)((0,n.Rd)(),t,[e]))}),X)}})),(0,n.R3)(a),(0,g.Tw)(o).forEach((e=>{s.requestChatUpdate({chatId:e})}))}(0,n.Q6)("apiUpdate",((e,t,s)=>{switch(s["@type"]){case"newMessage":{const{chatId:o,id:c,message:l,shouldForceReply:h}=s;e=te(e=J(e,o,c,l),t,l),l.threadInfo&&(e=(0,r.Xg)(e,l.threadInfo.chatId,l.threadInfo.threadId,l.threadInfo)),(0,n.R3)(e);const m=(0,i.hj)(e,o,c);if((0,i.hg)(e,o,l)){var a;if(l.isOutgoing&&(null===(a=l.content)||void 0===a||!a.action)){const s=(0,i.Bt)(e);s&&t.focusMessage({chatId:o,threadId:s.threadId,messageId:l.id,noHighlight:!0,isResizingContainer:!0})}const{threadInfo:s}=(0,i.Db)(e,o,l)||{};s&&t.requestThreadInfoUpdate({chatId:o,threadId:s.threadId}),(0,d.CI)(l)||setTimeout((()=>{let e=(0,n.Rd)();h&&(e=(0,r.pf)(e,o,u._f,"replyingToId",c)),(0,n.R3)(se(e,o,m))}),X)}else(0,n.R3)(se((0,n.Rd)(),o,m));(0,i.N)(e,o)||t.loadTopChats();break}case"newScheduledMessage":{const{chatId:t,id:a,message:o}=s;e=J(e,t,a,o,!0);const c=(0,i.qy)(e,t)||[];e=(0,r.pf)(e,t,u._f,"scheduledIds",(0,g.Tw)([...c,a])),(0,n.R3)(e);break}case"updateMessage":{var o,c;const{chatId:a,id:d,message:l}=s;if(!(0,i.hj)(e,a,d))return;e=J(e,a,d,l);const h=(0,i.hj)(e,a,d);l.threadInfo&&(e=(0,r.Xg)(e,l.threadInfo.chatId,l.threadInfo.threadId,l.threadInfo)),e=se(e,a,h),(0,n.R3)(e);const m=(0,i.Z1)(e,a);m&&!l.isOutgoing&&(null===(o=m.lastMessage)||void 0===o?void 0:o.id)===l.id&&(0,i.xo)(e,m)&&(0,i.hg)(e,a,l)&&(0,i.b9)(e,a,(null===(c=l.threadInfo)||void 0===c?void 0:c.threadId)||u._f)&&t.focusLastMessage();break}case"updateScheduledMessage":{const{chatId:t,id:a,message:o}=s;if(!(0,i.Tm)(e,t,a))return;e=J(e,t,a,o,!0);const c=Object.keys((0,i.Fn)(e,t)||{}).map(Number).sort(((e,t)=>t-e));e=(0,r.pf)(e,t,u._f,"scheduledIds",c),(0,n.R3)(e);break}case"updateMessageSendSucceeded":{const{chatId:a,localId:o,message:c}=s;e=te(e,t,c);const d=(0,i.hj)(e,a,o);e=(0,r.K4)(e,a,[o]),c.isScheduled&&(e=(0,r.bV)(e,a,[o])),e=(0,r.cY)(e,a,c.id,{...d,...c,previousLocalId:o});const l=(0,i.hj)(e,a,c.id);e=se(e,a,l);const u=(0,i.Db)(e,a,c);null!=u&&u.threadInfo&&(t.markMessageListRead({maxId:c.id}),e=(0,r.pf)(e,a,u.threadInfo.threadId,"threadInfo",{...u.threadInfo,lastMessageId:c.id,lastReadInboxMessageId:c.id})),(0,n.R3)(e);break}case"updateScheduledMessageSendSucceeded":{const{chatId:t,localId:a,message:o}=s,c=(0,i.qy)(e,t)||[];e=(0,r.pf)(e,t,u._f,"scheduledIds",[...c,o.id]);const d=(0,i.Tm)(e,t,a);e=(0,r.bV)(e,t,[a]),e=(0,r.P4)(e,t,o.id,{...d,...o,previousLocalId:a}),(0,n.R3)(e);break}case"updatePinnedIds":{const{chatId:t,isPinned:a,messageIds:o}=s,c=(0,i.KB)(e,t)||[],d=a?[...c,...o].sort(((e,t)=>t-e)):c.filter((e=>!o.includes(e)));(0,n.R3)((0,r.pf)(e,t,u._f,"pinnedIds",d));break}case"updateThreadInfo":{const{chatId:t,threadId:a,threadInfo:o,firstMessageId:c}=s,d={...(0,i.tZ)(e,t,a),...o};if(!d.threadId)return;e=(0,r.Xg)(e,t,a,d),c&&(e=(0,r.pf)(e,t,a,"firstMessageId",c)),(0,n.R3)(e);break}case"resetMessages":{const{id:a}=s,o=(0,i.Zw)(e,a);o&&!(0,d.YA)(a)&&(e=(0,r.K4)(e,a,Object.keys(o).map(Number)),(0,n.R3)(e),t.loadFullChat({chatId:a,force:!0}));break}case"deleteMessages":{const{ids:n,chatId:a}=s;ae(a,n,t,e);break}case"deleteScheduledMessages":{const{ids:t,chatId:a}=s;!function(e,t,s,a){e&&(t.forEach((t=>{a=(0,r.P4)(a,e,t,{isDeleting:!0})})),(0,n.R3)(a),setTimeout((()=>{a=(0,r.bV)((0,n.Rd)(),e,t);const s=(0,i.Fn)(a,e);a=(0,r.pf)(a,e,u._f,"scheduledIds",Object.keys(s||{}).map(Number)),(0,n.R3)(a)}),X))}(a,t,0,e);break}case"deleteHistory":{const{chatId:n}=s,a=e.messages.byChatId[n];a?ae(n,Object.keys(a.byId).map(Number),t,e):t.requestChatUpdate({chatId:n});break}case"updateCommonBoxMessages":{const{ids:t,messageUpdate:a}=s;t.forEach((t=>{const s=(0,i.X5)(e,t);s&&(e=(0,r.cY)(e,s,t,a))})),(0,n.R3)(e);break}case"updateChannelMessages":{const{channelId:t,ids:a,messageUpdate:o}=s;a.forEach((s=>{e=(0,r.cY)(e,t,s,o)})),(0,n.R3)(e);break}case"updateMessagePoll":{const{pollId:t,pollUpdate:a}=s,o=(0,i.ZB)(e,t);if(null!=o&&o.content.poll){const t={...o.content.poll,...a},{results:s}=t.results||{};if(s&&!s.some((e=>e.isChosen))){const{results:e}=o.content.poll.results,n=e&&e.filter((e=>e.isChosen));n&&n.forEach((e=>{const n=s.findIndex((t=>t.option===e.option));n>=0&&(t.results.results[n].isChosen=!0)}))}(0,n.R3)((0,r.cY)(e,o.chatId,o.id,{content:{...o.content,poll:t}}))}break}case"updateMessagePollVote":{const{pollId:t,userId:a,options:o}=s,c=(0,i.ZB)(e,t);if(!c||!c.content.poll||!c.content.poll.results)break;const{poll:d}=c.content,{recentVoterIds:l,totalVoters:u,results:h}=d.results,m=l?[...l]:[],g=u?u+1:1,f=h?[...h]:[];m.push(a),o.forEach((t=>{const s=f.find((e=>e.option===t)),n=f.findIndex((e=>e.option===t)),o=s?{...s}:{option:t,votersCount:0};o.votersCount+=1,a===e.currentUserId&&(o.isChosen=!0),n?f[n]=o:f.push(o)})),(0,n.R3)((0,r.cY)(e,c.chatId,c.id,{content:{...c.content,poll:{...d,results:{...d.results,recentVoterIds:m,totalVoters:g,results:f}}}}));break}}}));const oe=(0,C.P2)((function(){let e=(0,n.Rd)();re.forEach((([t,s])=>{e=(0,r.Nq)(e,t,{status:s})})),(0,n.R3)(e),re=[]}),3e3,!0);let re=[];(0,n.Q6)("apiUpdate",((e,t,s)=>{switch(s["@type"]){case"deleteUser":return(0,r.h8)(e,s.id);case"updateUser":return(0,r.Nq)(e,s.id,s.user);case"updateUserStatus":return n=s.userId,a=s.status,re.push([n,a]),void oe();case"updateUserFullInfo":{const{id:t,fullInfo:n}=s,a=e.users.byId[t];if(!a)return;return(0,r.Nq)(e,t,{fullInfo:{...a.fullInfo,...n}})}}var n,a})),(0,n.Q6)("apiUpdate",((e,t,s)=>{switch(s["@type"]){case"updateStickerSet":return(0,r.Rg)(e,s.id,s.stickerSet)}})),(0,n.Q6)("apiUpdate",((e,t,s)=>{switch(s["@type"]){case"updatePeerBlocked":return s.isBlocked?(0,r.O4)((0,n.Rd)(),s.id):(0,r.rB)((0,n.Rd)(),s.id);case"updateResetContactList":(0,n.R3)({...(0,n.Rd)(),contactList:{hash:0,userIds:[]}});break;case"updateFavoriteStickers":t.loadFavoriteStickers();break;case"updatePrivacy":e.settings.privacy[s.key]=s.rules}})),(0,n.Q6)("apiUpdate",((e,t,s)=>{switch(s["@type"]){case"updateNotifySettings":return(0,r.HN)(e,s.peerType,s.isSilent,s.shouldShowPreviews);case"updateNotifyExceptions":{const{chatId:t,isMuted:a,isSilent:o,shouldShowPreviews:i}=s;e.chats.byId[t]&&(e=(0,r.a4)(e,t,{isMuted:a})),(0,n.R3)((0,r.aK)(e,t,{isMuted:a,isSilent:o,shouldShowPreviews:i}));break}}})),(0,n.Q6)("apiUpdate",((e,t,s)=>{switch(s["@type"]){case"updateTwoFaStateWaitCode":return{...e,twoFaSettings:{...e.twoFaSettings,isLoading:!1,waitingEmailCodeLength:s.length}};case"updateTwoFaError":return{...e,twoFaSettings:{...e.twoFaSettings,error:s.message}}}}));var ie=s(8674),ce=s(6752),de=s(1279),le=s(1212),ue=s(5332);function he(e){(0,o.d4)((()=>(0,C.Gq)(e)),[e])}var me=s(9290);const ge=document.querySelector('meta[name="viewport"]'),fe=(null==ge?void 0:ge.getAttribute("content"))||"",pe=fe.replace(/\s*maximum-scale=1\.0,?/i,"").replace(/\s*user-scalable=no,?/i,"");function Ie(e){e.preventDefault()}var ve=s(6590),ye=s(3989),Ce=s(3455),Ze=s(706),Pe=s(2255);function we(){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 be=s(9107),Me=s(6917),Se=s(3106),Ee=s(8964),ke=s(231),Re=s(9589),Te=s(9187),Ne=s(3321);const Be=[0,1,2],Le=(0,o.X$)((0,n.c$)((e=>{const{query:t,fetchingStatus:s,chatId:n,date:a}=e.globalSearch,{currentUserId:o}=e,{byId:r}=e.chats,{animationLevel:c}=e.settings.byKey;return{searchQuery:t,isLoading:!!s&&Boolean(s.chats||s.messages),currentUserId:o,chatsById:r,globalSearchChatId:n,searchDate:a,theme:(0,i.Pu)(e),animationLevel:c}}),((e,t)=>(0,g.ei)(t,["openChat","openTipsChat","setGlobalSearchDate","setGlobalSearchChatId","setSettingOption"])))((({content:e,contactsFilter:t,onSearchQuery:s,onSelectSettings:n,onSelectContacts:r,onSelectArchived:i,setGlobalSearchChatId:c,onReset:l,searchQuery:u,isLoading:g,shouldSkipTransition:f,currentUserId:p,globalSearchChatId:I,searchDate:v,theme:y,animationLevel:C,chatsById:Z,openChat:P,openTipsChat:w,setGlobalSearchDate:b,setSettingOption:M})=>{const S=(0,be.Z)(),E=e===h.du.ChatList,k=(0,o.Ye)((()=>v?(0,O.xH)(new Date(1e3*v)):void 0),[v]),R=(0,o.Ye)((()=>E&&Z?Object.values(Z).reduce(((e,t)=>(0,d.pE)(t)&&t.unreadCount?e+1:e),0):0),[E,Z]),T="web.telegram.org"===window.location.hostname,N=(0,o.Ye)((()=>({onTrigger:e,isOpen:t})=>o.ZP.createElement(ke.Z,{round:!0,ripple:E&&!m.wB,size:"smaller",color:"translucent",className:t?"active":"",onClick:E?e:()=>l(),ariaLabel:E?S("AccDescrOpenMenu2"):"Return to chat list"},o.ZP.createElement("div",{className:(0,ce.Z)("animated-menu-icon",!E&&"state-back",f&&"no-animation")}))),[E,S,l,f]),B=(0,o.I4)((()=>{u||s("")}),[u,s]),L=(0,o.I4)((()=>{P({id:p,shouldReplaceHistory:!0})}),[p,P]),x=(0,o.I4)((e=>{e.stopPropagation();const t="light"===y?"dark":"light";M({theme:t}),M({shouldUseSystemTheme:!1}),(0,Me.Z)(t,C===a.zy)}),[C,M,y]),A=(0,o.I4)((e=>{e.stopPropagation();const t=0===C?2:0;Be.forEach(((e,s)=>{document.body.classList.toggle(`animation-level-${s}`,t===s)})),M({animationLevel:t})}),[C,M]),F=Boolean(I)||e===h.du.GlobalSearch||e===h.du.Contacts,U=e===h.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(Se.Z,{trigger:N,footer:`${a.iC} alpha ${a.Ji}`},o.ZP.createElement(Ee.Z,{icon:"saved-messages",onClick:L},S("SavedMessages")),o.ZP.createElement(Ee.Z,{icon:"archive",onClick:i},o.ZP.createElement("span",{className:"menu-item-name"},S("ArchivedChats")),R>0&&o.ZP.createElement("div",{className:"archived-badge"},R)),o.ZP.createElement(Ee.Z,{icon:"user",onClick:r},S("Contacts")),o.ZP.createElement(Ee.Z,{icon:"settings",onClick:n},S("Settings")),o.ZP.createElement(Ee.Z,{icon:"darkmode",onClick:x},o.ZP.createElement("span",{className:"menu-item-name"},S("lng_menu_night_mode")),o.ZP.createElement(Ne.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(Ee.Z,{icon:"animations",onClick:A},o.ZP.createElement("span",{className:"menu-item-name capitalize"},S("Appearance.Animations").toLowerCase()),o.ZP.createElement(Ne.Z,{id:"animations",label:"Toggle Animations",checked:C>0})),o.ZP.createElement(Ee.Z,{icon:"help",onClick:()=>{w({langCode:S.code})}},S("TelegramFeatures")),o.ZP.createElement(Ee.Z,{icon:"bug",href:a.mU},"Report Bug"),T&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement(Ee.Z,{icon:"char-K",href:"https://web.telegram.org/k/",onClick:()=>{localStorage.setItem("kz_version",JSON.stringify("K")),(0,ve.Wv)()}},"Switch to K Version"),o.ZP.createElement(Ee.Z,{icon:"char-W",href:"https://web.telegram.org/?legacy=1",onClick:ve.Wv},"Switch to Old Version"))),o.ZP.createElement(Re.Z,{inputId:"telegram-search-input",parentContainerClassName:"LeftSearch",className:I||v?"with-picker-item":"",value:t||u,focused:F,isLoading:g,placeholder:U,autoComplete:"off",canClose:Boolean(I||v),onChange:s,onReset:l,onFocus:B},k&&o.ZP.createElement(Te.Z,{icon:"calendar",title:k,canClose:!0,isMinimized:Boolean(I),className:"search-date",onClick:b,clickArg:{date:void 0}}),I&&o.ZP.createElement(Te.Z,{chatOrUserId:I,onClick:c,canClose:!0,clickArg:{id:void 0}}))))})));var xe=s(9204);const Ae=(0,o.X$)((()=>{const e=(0,be.Z)();return o.ZP.createElement("div",{id:"ConnectionState",dir:e.isRtl?"rtl":void 0},o.ZP.createElement(xe.Z,{color:"black"}),o.ZP.createElement("div",{className:"state-text"},e("WaitingForNetwork")))}));var Oe=s(1174);var Fe=s(3133),Ue=s(9359);const Qe=(0,o.X$)((0,n.c$)((e=>{const{chats:{byId:t},users:{byId:s},chatFolders:{byId:n,orderedIds:a,activeChatFolder:o},currentUserId:r,lastSyncTime:c,shouldSkipHistoryAnimations:d}=e;return{chatsById:t,usersById:s,chatFoldersById:n,orderedFolderIds:a,lastSyncTime:c,notifySettings:(0,i.dZ)(e),notifyExceptions:(0,i.NJ)(e),activeChatFolder:o,currentUserId:r,shouldSkipHistoryAnimations:d}}),((e,t)=>(0,g.ei)(t,["loadChatFolders","setActiveChatFolder","openChat"])))((({chatsById:e,usersById:t,chatFoldersById:s,notifySettings:n,notifyExceptions:a,orderedFolderIds:r,activeChatFolder:i,currentUserId:c,lastSyncTime:l,shouldSkipHistoryAnimations:u,foldersDispatch:h,onScreenSelect:f,loadChatFolders:p,setActiveChatFolder:I,openChat:v})=>{const y=(0,o.sO)(null),Z=(0,be.Z)();(0,o.d4)((()=>{l&&p()}),[l,p]);const P=(0,o.Ye)((()=>r?r.map((e=>s[e]||{})).filter(Boolean):void 0),[s,r]),w=((e,t,s)=>{const n=((e,t=!1)=>(0,o.Ye)((()=>(0,C.P2)((e=>e()),e,!t)),[e,t]))(t,!0),[a,r]=(0,o.eJ)(),[i,c,d]=(0,Ze.Z)();return(0,ie.ZP)(c,d),(0,me.Z)((()=>{i||n((()=>{r(e())}))}),s.concat([i])),a})((()=>{if(!P||!P.length)return;const s=Object.keys(e).map(Number),o=P.map((o=>{const{unreadDialogsCount:r,hasActiveDialogs:i}=(0,d.Fu)(e,t,o,s,n,a)||{};return{id:o.id,badgeCount:r,isBadgeActive:i}}));return(0,g.ee)(o,"id")}),3e3,[P,e,t,n,a]),b=(0,o.Ye)((()=>{if(P&&P.length)return[{title:"en"===Z.code?"All":Z("FilterAllChats")},...P.map((e=>({title:e.title,...null==w?void 0:w[e.id]})))]}),[P,w,Z]),M=(0,o.I4)((e=>{I(e)}),[I]);(0,o.d4)((()=>{b&&b.length&&i>=b.length&&I(0)}),[i,b,I]),(0,o.d4)((()=>{if(y.current&&m.$b&&b&&b.length)return(0,Oe.s)(y.current,{selectorToPreventScroll:".chat-list",onSwipe:(e,t)=>t===Oe.e.Left?(I(Math.min(i+1,b.length-1)),!0):t===Oe.e.Right&&(I(Math.max(0,i-1)),!0)})}),[i,b,I]);const S=(0,o.sO)();S.current=0!==i,(0,o.d4)((()=>S.current?(0,ye.Z)((()=>{S.current&&I(0)})):void 0),[i,I]),(0,ve.ZP)(0!==i,(()=>I(0))),(0,o.d4)((()=>{const e=e=>{if(e.ctrlKey&&e.shiftKey&&e.code.startsWith("Digit")&&b){const[,t]=e.code.match(/Digit(\d)/)||[];if(!t)return;if("0"===t)return void v({id:c,shouldReplaceHistory:!0});const s=Number(t)-1;if(s>b.length-1)return;I(s),e.preventDefault()}};return document.addEventListener("keydown",e,!0),()=>{document.removeEventListener("keydown",e,!0)}}));const{shouldRender:E,transitionClassNames:k}=(0,le.Z)(!r,void 0,!0);function R(e){const t=Object.values(s).find((({title:e})=>e===b[i].title));return t&&0!==i?o.ZP.createElement(Ue.Z,{folderType:"folder",folderId:t.id,isActive:e,onScreenSelect:f,foldersDispatch:h}):o.ZP.createElement(Ue.Z,{folderType:"all",isActive:e,foldersDispatch:h,onScreenSelect:f})}return o.ZP.createElement("div",{className:"ChatFolders"},null!=b&&b.length?o.ZP.createElement(Fe.Z,{tabs:b,activeTab:i,onSwitchTab:M}):E?o.ZP.createElement("div",{className:(0,ce.Z)("tabs-placeholder",k)}):void 0,o.ZP.createElement(Pe.Z,{ref:y,name:u?"none":Z.isRtl?"slide-reversed":"slide",activeKey:i,renderCount:b?b.length:void 0},R))})));var $e=s(9203),De=s(8778),qe=s(4288);const Ge=(0,o.X$)((e=>{const t=(0,De.Z)($e.gl.Extra,"LeftSearch");return t?o.ZP.createElement(t,e):o.ZP.createElement(qe.Z,null)})),He=(0,o.X$)((e=>{const t=(0,De.Z)($e.gl.Extra,"ContactList");return t?o.ZP.createElement(t,e):o.ZP.createElement(qe.Z,null)}));var je=s(2328);let _e;const Ve=(0,o.X$)((({isShown:e,onNewPrivateChat:t,onNewChannel:s,onNewGroup:n})=>{const[a,r]=(0,o.eJ)(!1);(0,o.d4)((()=>{e||r(!1)}),[e]);const i=(0,be.Z)(),c=(0,ce.Z)("NewChatButton",e&&"revealed",a&&"menu-is-open"),d=(0,o.I4)((()=>{_e&&(clearTimeout(_e),_e=void 0)}),[]),l=(0,o.I4)((()=>{_e&&(clearTimeout(_e),_e=void 0),_e=window.setTimeout((()=>{r(!1)}),750)}),[]);return o.ZP.createElement("div",{className:c,onMouseEnter:d,onMouseLeave:l},o.ZP.createElement(ke.Z,{round:!0,color:"primary",className:a?"active":"",onClick:()=>{r(!a)},ariaLabel:i(a?"Close":"NewMessageTitle"),tabIndex:-1},o.ZP.createElement("i",{className:"icon-new-chat-filled"}),o.ZP.createElement("i",{className:"icon-close"})),o.ZP.createElement(je.Z,{isOpen:a,positionX:"right",positionY:"bottom",autoClose:!0,onClose:()=>{r(!1)}},o.ZP.createElement(Ee.Z,{icon:"channel",onClick:s},i("NewChannel")),o.ZP.createElement(Ee.Z,{icon:"group",onClick:n},i("NewGroup")),o.ZP.createElement(Ee.Z,{icon:"user",onClick:t},i("NewMessageTitle"))))}));var We=s(126);const ze=Object.keys(h.du).length/2;let Ye;const Ke=(0,n.c$)((e=>(0,g.ei)(e,["connectionState"])))((({content:e,searchQuery:t,searchDate:s,contactsFilter:n,shouldSkipTransition:a,foldersDispatch:r,onSearchQuery:i,onContentChange:c,onScreenSelect:d,onReset:l,connectionState:u})=>{const[g,f]=(0,o.eJ)(m.$b),p=!we()||"connectionStateConnecting"===u,I=(0,o.sO)(!1),v=(0,o.I4)((()=>{c(h.du.Settings)}),[c]),y=(0,o.I4)((()=>{c(h.du.Contacts)}),[c]),C=(0,o.I4)((()=>{c(h.du.NewChannelStep1)}),[c]),Z=(0,o.I4)((()=>{c(h.du.NewGroupStep1)}),[c]),P=(0,o.I4)((()=>{c(h.du.Archived)}),[c]),w=(0,o.I4)((()=>{e===h.du.ChatList&&(I.current=!0,f(!0))}),[e]),b=(0,o.I4)((()=>{I.current=!1,Ye&&(clearTimeout(Ye),Ye=void 0),Ye=window.setTimeout((()=>{I.current||f(!1)}),250)}),[]);(0,o.d4)((()=>{let t;return e!==h.du.ChatList?t=window.setTimeout((()=>{f(!1)}),250):(I.current||m.$b)&&f(!0),()=>{t&&(clearTimeout(t),t=void 0)}}),[e]);const[M,S,E]=function(){const[e,t]=(0,Ze.Z)(!1);(0,o.d4)((()=>{const e=window.setTimeout(t,2592e5);return()=>{clearTimeout(e)}}),[t]);const{shouldRender:s,transitionClassNames:n}=(0,le.Z)(e);return[s,n,()=>{window.location.reload()}]}(),k=(0,be.Z)();return o.ZP.createElement("div",{id:"LeftColumn-main",onMouseEnter:m.$b?void 0:w,onMouseLeave:m.$b?void 0:b},o.ZP.createElement(Le,{content:e,contactsFilter:n,onSearchQuery:i,onSelectSettings:v,onSelectContacts:y,onSelectArchived:P,onReset:l,shouldSkipTransition:a}),o.ZP.createElement(We.Z,{isOpen:p,isCustom:!0,className:"connection-state-wrapper opacity-transition slow"},(()=>o.ZP.createElement(Ae,null))),o.ZP.createElement(Pe.Z,{name:a?"none":"zoom-fade",renderCount:ze,activeKey:e,shouldCleanup:!0,cleanupExceptionKey:h.du.ChatList,className:p?"pull-down":void 0},(a=>{switch(e){case h.du.ChatList:return o.ZP.createElement(Qe,{onScreenSelect:d,foldersDispatch:r});case h.du.GlobalSearch:return o.ZP.createElement(Ge,{searchQuery:t,searchDate:s,isActive:a,onReset:l});case h.du.Contacts:return o.ZP.createElement(He,{filter:n,isActive:a,onReset:l});default:return}})),M&&o.ZP.createElement(ke.Z,{fluid:!0,pill:!0,className:(0,ce.Z)("btn-update",S),onClick:E},k("lng_update_telegram")),o.ZP.createElement(Ve,{isShown:g,onNewPrivateChat:y,onNewChannel:C,onNewGroup:Z}))})),Xe=(0,o.X$)((e=>{const t=(0,De.Z)($e.gl.Extra,"Settings");return t?o.ZP.createElement(t,e):o.ZP.createElement(qe.Z,null)})),Je=(0,o.X$)((e=>{const t=(0,De.Z)($e.gl.Extra,"NewChat");return t?o.ZP.createElement(t,e):o.ZP.createElement(qe.Z,null)})),et=(0,o.X$)((e=>{const t=(0,De.Z)($e.gl.Extra,"ArchivedChats");return t?o.ZP.createElement(t,e):o.ZP.createElement(qe.Z,null)}));var tt;!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"}(tt||(tt={}));const st=Object.keys(tt).length/2,nt=(0,o.X$)((0,n.c$)((e=>{const{globalSearch:{query:t,date:s},chatFolders:{activeChatFolder:n},shouldSkipHistoryAnimations:a,leftColumnWidth:o}=e;return{searchQuery:t,searchDate:s,activeChatFolder:n,shouldSkipHistoryAnimations:a,leftColumnWidth:o}}),((e,t)=>(0,g.ei)(t,["setGlobalSearchQuery","setGlobalSearchChatId","resetChatCreation","setGlobalSearchDate","loadPasswordInfo","clearTwoFaError","setLeftColumnWidth","resetLeftColumnWidth"])))((({searchQuery:e,searchDate:t,activeChatFolder:s,shouldSkipHistoryAnimations:n,leftColumnWidth:a,setGlobalSearchQuery:r,setGlobalSearchChatId:i,resetChatCreation:c,setGlobalSearchDate:d,loadPasswordInfo:l,clearTwoFaError:u,setLeftColumnWidth:g,resetLeftColumnWidth:f})=>{const p=(0,o.sO)(null),[I,v]=(0,o.eJ)(h.du.ChatList),[y,C]=(0,o.eJ)(h.MT.Main),[Z,P]=(0,o.eJ)(""),[w,b]=(0,Ce.ZP)(),[M,S]=(0,o.eJ)(0);let E=tt.Main;switch(I){case h.du.Archived:E=tt.Archived;break;case h.du.Settings:E=tt.Settings;break;case h.du.NewChannelStep1:case h.du.NewChannelStep2:E=tt.NewChannel;break;case h.du.NewGroupStep1:case h.du.NewGroupStep2:E=tt.NewGroup}const k=(0,o.I4)((e=>{if(I!==h.du.NewGroupStep2||e)if(I!==h.du.NewChannelStep2||e){if(I===h.du.NewGroupStep1){const e=document.getElementById("new-group-picker-search");e&&e.blur()}if(I===h.du.Settings)switch(y){case h.MT.EditProfile:case h.MT.Folders:case h.MT.General:case h.MT.Notifications:case h.MT.Privacy:case h.MT.Language:return void C(h.MT.Main);case h.MT.GeneralChatBackground:return void C(h.MT.General);case h.MT.GeneralChatBackgroundColor:return void C(h.MT.GeneralChatBackground);case h.MT.PrivacyPhoneNumber:case h.MT.PrivacyLastSeen:case h.MT.PrivacyProfilePhoto:case h.MT.PrivacyForwarding:case h.MT.PrivacyGroupChats:case h.MT.PrivacyActiveSessions:case h.MT.PrivacyBlockedUsers:case h.MT.TwoFaDisabled:case h.MT.TwoFaEnabled:case h.MT.TwoFaCongratulations:return void C(h.MT.Privacy);case h.MT.PrivacyPhoneNumberAllowedContacts:case h.MT.PrivacyPhoneNumberDeniedContacts:return void C(h.MT.PrivacyPhoneNumber);case h.MT.PrivacyLastSeenAllowedContacts:case h.MT.PrivacyLastSeenDeniedContacts:return void C(h.MT.PrivacyLastSeen);case h.MT.PrivacyProfilePhotoAllowedContacts:case h.MT.PrivacyProfilePhotoDeniedContacts:return void C(h.MT.PrivacyProfilePhoto);case h.MT.PrivacyForwardingAllowedContacts:case h.MT.PrivacyForwardingDeniedContacts:return void C(h.MT.PrivacyForwarding);case h.MT.PrivacyGroupChatsAllowedContacts:case h.MT.PrivacyGroupChatsDeniedContacts:return void C(h.MT.PrivacyGroupChats);case h.MT.TwoFaNewPassword:return void C(h.MT.TwoFaDisabled);case h.MT.TwoFaNewPasswordConfirm:return void C(h.MT.TwoFaNewPassword);case h.MT.TwoFaNewPasswordHint:return void C(h.MT.TwoFaNewPasswordConfirm);case h.MT.TwoFaNewPasswordEmail:return void C(h.MT.TwoFaNewPasswordHint);case h.MT.TwoFaNewPasswordEmailCode:return void C(h.MT.TwoFaNewPasswordEmail);case h.MT.TwoFaChangePasswordCurrent:case h.MT.TwoFaTurnOff:case h.MT.TwoFaRecoveryEmailCurrentPassword:return void C(h.MT.TwoFaEnabled);case h.MT.TwoFaChangePasswordNew:return void C(h.MT.TwoFaChangePasswordCurrent);case h.MT.TwoFaChangePasswordConfirm:return void C(h.MT.TwoFaChangePasswordNew);case h.MT.TwoFaChangePasswordHint:return void C(h.MT.TwoFaChangePasswordConfirm);case h.MT.TwoFaRecoveryEmail:return void C(h.MT.TwoFaRecoveryEmailCurrentPassword);case h.MT.TwoFaRecoveryEmailCode:return void C(h.MT.TwoFaRecoveryEmail);case h.MT.FoldersCreateFolder:case h.MT.FoldersEditFolder:return void C(h.MT.Folders);case h.MT.FoldersIncludedChatsFromChatList:case h.MT.FoldersExcludedChatsFromChatList:return void C(h.MT.FoldersEditFolderFromChatList);case h.MT.FoldersEditFolderFromChatList:return v(h.du.ChatList),void C(h.MT.Main)}I!==h.du.ChatList||0!==s?(v(h.du.ChatList),P(""),r({query:""}),d({date:void 0}),i({id:void 0}),c(),setTimeout((()=>{S(Date.now())}),250)):v(h.du.GlobalSearch)}else v(h.du.NewChannelStep1);else v(h.du.NewGroupStep1)}),[I,s,y,r,d,i,c]),R=(0,o.I4)((t=>{I!==h.du.Contacts?(v(h.du.GlobalSearch),t!==e&&r({query:t})):P(t)}),[I,e,r]);(0,o.d4)((()=>I!==h.du.ChatList||0===s?(0,ye.Z)((()=>k())):void 0),[s,I,k]),(0,o.d4)((()=>{u(),y===h.MT.Privacy&&l()}),[u,l,y]);const{initResize:T,resetResize:N,handleMouseUp:B}=((e,t,s,n)=>{const[a,r,i]=(0,Ze.Z)(),[c,d]=(0,o.eJ)(),[l,u]=(0,o.eJ)();(0,o.d4)((()=>{e.current&&n&&(e.current.style.width=`${n}px`)}),[e,n]);const h=()=>{document.body.classList.remove("no-selection","cursor-ew-resize")};return(0,o.d4)((()=>{if(!a)return;const s=t=>{const s=Math.ceil(l+t.clientX-c);e.current.style.width=`${s}px`},n=()=>{h(),document.removeEventListener("mousemove",s,!1),document.removeEventListener("mouseup",n,!1),document.removeEventListener("blur",n,!1),t(e.current.offsetWidth),i()};document.addEventListener("mousemove",s,!1),document.addEventListener("mouseup",n,!1),document.addEventListener("blur",n,!1)}),[l,c,e,t,a,i]),{initResize:t=>{document.body.classList.add("no-selection","cursor-ew-resize"),d(t.clientX),u(e.current.offsetWidth),r()},resetResize:t=>{t.preventDefault(),e.current.style.width="",s()},handleMouseUp:h}})(p,g,f,a),L=e=>{v(h.du.Settings),C(e)};return o.ZP.createElement("div",{id:"LeftColumn",ref:p},o.ZP.createElement(Pe.Z,{name:n?"none":m.s0,renderCount:st,activeKey:E,shouldCleanup:!0,cleanupExceptionKey:tt.Main},(s=>{switch(E){case tt.Archived:return o.ZP.createElement(et,{isActive:s,onReset:k,onContentChange:v});case tt.Settings:return o.ZP.createElement(Xe,{isActive:s,currentScreen:y,foldersState:w,foldersDispatch:b,onScreenSelect:L,onReset:k,shouldSkipTransition:n});case tt.NewChannel:return o.ZP.createElement(Je,{key:M,isActive:s,isChannel:!0,content:I,onContentChange:v,onReset:k});case tt.NewGroup:return o.ZP.createElement(Je,{key:M,isActive:s,content:I,onContentChange:v,onReset:k});default:return o.ZP.createElement(Ke,{content:I,searchQuery:e,searchDate:t,contactsFilter:Z,foldersDispatch:b,onContentChange:v,onSearchQuery:R,onScreenSelect:L,onReset:k,shouldSkipTransition:n})}})),o.ZP.createElement("div",{className:"resize-handle",onMouseDown:T,onMouseUp:B,onDoubleClick:N}))})));var at=s(2420),ot=s(9524),rt=s(1394),it=s(3858);const ct=()=>{const[e,t]=(0,o.eJ)(it.Z.get());return(0,o.d4)((()=>{const e=(0,C.P2)((()=>{t(it.Z.get())}),250,!1);return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]),e};var dt=s(2678);const lt=728;var ut=s(5780),ht=s(3570),mt=s(5790),gt=s(8360),ft=s(2155),pt=s(6058),It=s(8799);const vt=(0,o.X$)((e=>{const{isOpen:t}=e,s=(0,De.Z)($e.gl.Extra,"HeaderMenuContainer",!t);return s?o.ZP.createElement(s,e):void 0})),yt=(0,o.X$)((0,n.c$)(((e,{chatId:t,threadId:s,messageListType:n})=>{const a=(0,i.Z1)(e,t),o=Boolean(a&&(0,d.eA)(a));if(null!=a&&a.isRestricted||(0,i.CA)(e))return{noMenu:!0};const r=(0,i.IK)(e,t),c=(0,i.FM)(e,t),l="thread"===n&&s===u._f,h="thread"===n&&s!==u._f,m=(0,i.Jf)(e),g=Boolean(r&&(0,i.s4)(e,r.id)),f=!g&&Boolean((0,i.pk)(e,t)),p=Boolean(l&&a&&(o||(0,d.ZV)(a))&&a.isNotJoined);return{noMenu:!1,isChannel:o,isRightColumnShown:m,canStartBot:f,canRestartBot:g,canSubscribe:p,canSearch:l||h,canMute:l&&!c&&!p,canLeave:l&&!p}}),((e,t)=>(0,g.ei)(t,["joinChannel","sendBotCommand","openLocalTextSearch","restartBot"])))((({chatId:e,threadId:t,noMenu:s,isChannel:n,canStartBot:a,canRestartBot:r,canSubscribe:i,canSearch:c,canMute:d,canLeave:l,isRightColumnShown:u,joinChannel:h,sendBotCommand:g,openLocalTextSearch:f,restartBot:p})=>{const I=(0,o.sO)(null),[v,y]=(0,o.eJ)(!1),[C,Z]=(0,o.eJ)(void 0),P=(0,o.I4)((()=>{y(!0);const e=I.current.getBoundingClientRect();Z({x:e.right,y:e.bottom})}),[]),w=(0,o.I4)((()=>{y(!1)}),[]),b=(0,o.I4)((()=>{Z(void 0)}),[]),M=(0,o.I4)((()=>{h({chatId:e})}),[h,e]),S=(0,o.I4)((()=>{g({command:"/start"})}),[g]),E=(0,o.I4)((()=>{p({chatId:e})}),[e,p]),k=(0,o.I4)((()=>{f(),m.wB?document.querySelector("#MobileSearch input").focus():setTimeout((()=>{const e=document.querySelector(".RightHeader .SearchInput input");e&&e.focus()}),400)}),[f]),R=(0,be.Z)();return o.ZP.createElement("div",{className:"HeaderActions"},!m.wB&&i&&o.ZP.createElement(ke.Z,{size:"tiny",ripple:!0,fluid:!0,onClick:M},R(n?"Subscribe":"Join Group")),!m.wB&&a&&o.ZP.createElement(ke.Z,{size:"tiny",ripple:!0,fluid:!0,onClick:S},R("BotStart")),!m.wB&&r&&o.ZP.createElement(ke.Z,{size:"tiny",ripple:!0,fluid:!0,onClick:E},R("BotRestart")),!m.wB&&c&&o.ZP.createElement(ke.Z,{round:!0,ripple:u,color:"translucent",size:"smaller",onClick:k,ariaLabel:"Search in this chat"},o.ZP.createElement("i",{className:"icon-search"})),o.ZP.createElement(ke.Z,{ref:I,className:v?"active":"",round:!0,ripple:!m.wB,size:"smaller",color:"translucent",disabled:s,ariaLabel:"More actions",onClick:P},o.ZP.createElement("i",{className:"icon-more"})),C&&o.ZP.createElement(vt,{chatId:e,threadId:t,isOpen:v,anchor:C,isChannel:n,canStartBot:a,canRestartBot:r,canSubscribe:i,canSearch:c,canMute:d,canLeave:l,onSubscribeChannel:M,onSearchClick:k,onClose:w,onCloseAnimationEnd:b}))})));var Ct=s(4399),Zt=s(2340),Pt=s(6202),wt=s(862);function bt(e){var t;const s=e&&(0,d.DH)(e),n=null==e||null===(t=e.content)||void 0===t?void 0:t.sticker,r=s&&n&&!(0,m.on)()&&s.includes("image/webp"),[i,c]=(0,o.eJ)(wt.Hu),l=null==e?void 0:e.id;return(0,o.bt)((()=>{r&&(0,wt.p6)(`b64-${l}`,s).then(c).catch((e=>{a.eM&&console.error(e)}))}),[l,r,s]),r?i:s}var Mt=s(7551),St=s(8512);function Et(e,t,s,n,a){return`M${e},${t+a}a${a},${a},0,0,1,\n ${s},0v${n-2*a}a${a},${a},0,0,1,${-s},0Z`}const kt=(0,o.X$)((({count:e,index:t})=>{const s=(0,o.sO)(null),n=(0,o.Ye)((()=>function(e,t){const s=e-t-1,n=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),a=function(e,t){let s=36;return 1===e?s=36:2===e?s=17:3===e?s=1===t?12:11:(4===e||e>3)&&(s=7.5),s}(e,s),o=function(e,t){return e<=3?36:t*e+2*(e-1)}(e,n),r=`clipPath${e}`;return{markHeight:a,clipPath:function(e,t,s){let n="";if(3===s)n=Et(0,0,2,t,1)+Et(0,12,2,t+1,1)+Et(0,25,2,t,1);else for(let e=0;e<s;e++)n+=Et(0,(t+2)*e,2,t,1);return`<clipPath id="${e}">\n <path d="${n}" />\n </clipPath>`}(r,n,e),markTranslateY:function(e,t,s){return 1===s?0:2===s?0===e?0:t+2:3===s?0===e?0:1===e?12:25:(t+2)*e}(s,n,e),trackTranslateY:function(e,t,s,n){return t<=4||e<=1?0:e>=t-2?n-36:(s+4)/2+(e-2)*(s+2)}(s,e,n,o),trackHeight:o,clipPathId:r}}(e,t)),[e,t]);if((0,o.d4)((()=>{if(!s.current)return;const{trackHeight:e,trackTranslateY:t,markHeight:a,markTranslateY:o,clipPathId:r,clipPath:i}=n,c=s.current.firstElementChild;if(null!=s&&s.current){const n=s.current,{style:d}=n;d.height=`${e}px`,d.transform=`translateY(-${t}px)`,d.clipPath=`url("#${r}")`;const l=n.querySelector("svg"),u=n.querySelector("div"),h=n.querySelector("defs");l||c&&(c.innerHTML=`<svg height="0" width="0"><defs> ${i} </defs></svg>`),h&&(h.innerHTML=i),u&&(u.style.height=`${a}px`,u.style.transform=`translateY(${o}px)`)}}),[n]),1===e)return o.ZP.createElement("div",{className:"pinned-message-border"},o.ZP.createElement("div",{className:"pinned-message-border-wrapper-1",ref:s}));const{trackHeight:a,trackTranslateY:r,markHeight:i,markTranslateY:c,clipPathId:d}=n;return o.ZP.createElement("div",{className:(0,ce.Z)("pinned-message-border",e>4&&"pinned-message-border-mask")},o.ZP.createElement("div",{className:"pinned-message-border-wrapper",ref:s,style:`clip-path: url("#${d}"); width: 2px;\n height: ${a}px; transform: translateY(-${r}px);`},o.ZP.createElement("span",null),o.ZP.createElement("div",{className:"pinned-message-border-mark",style:`height: ${i}px; transform: translateY(${c}px);`})))})),Rt=(0,o.X$)((({message:e,count:t,index:s,customTitle:n,className:a,onUnpinMessage:r,onClick:i,onAllPinnedClick:c})=>{const l=(0,be.Z)(),u=bt(e),h=(0,Pt.Z)((0,d.Ti)(e,"pictogram")),m=(0,d.MK)(l,e,Boolean(u)),[g,f,p]=(0,Ze.Z)(),I=(0,o.I4)((()=>{p(),r&&r(e.id)}),[p,r,e.id]);return o.ZP.createElement("div",{className:(0,ce.Z)("HeaderPinnedMessage-wrapper",a)},t>1&&o.ZP.createElement(ke.Z,{round:!0,size:"smaller",color:"translucent",className:"pin-list-button",ariaLabel:l("EventLogFilterPinnedMessages"),onClick:c},o.ZP.createElement("i",{className:"icon-pin-list"})),r&&o.ZP.createElement(ke.Z,{round:!0,size:"smaller",color:"translucent",ariaLabel:l("UnpinMessageAlertTitle"),className:"unpin-button",onClick:f},o.ZP.createElement("i",{className:"icon-close"})),o.ZP.createElement(Mt.Z,{isOpen:g,onClose:p,text:"Would you like to unpin this message?",confirmLabel:"Unpin",confirmHandler:I}),o.ZP.createElement("div",{className:"HeaderPinnedMessage",onClick:i,dir:l.isRtl?"rtl":void 0},o.ZP.createElement(kt,{count:t,index:s}),u&&function(e,t){const{width:s,height:n}=(0,Ct.W7)();return o.ZP.createElement("img",{src:t||e,width:s,height:n,alt:""})}(u,h),o.ZP.createElement("div",{className:"message-text"},o.ZP.createElement("div",{className:"title",dir:"auto"},n||`${l("PinnedMessage")} ${s>0?"#"+(t-s):""}`),o.ZP.createElement("p",{dir:"auto"},(0,Zt.Z)(m))),o.ZP.createElement(St.Z,null)))}));var Tt=s(647),Nt=s(3186),Bt=s(663),Lt=s(4532);function xt(e,t,s="image/png"){const n=e instanceof Blob?URL.createObjectURL(e):e,a=new Image;return new Promise((o=>{a.onload=()=>{At(a,a.width*t,a.height*t,s).then((e=>URL.createObjectURL(e))).then(o).finally((()=>{e instanceof Blob&&URL.revokeObjectURL(n)}))},a.src=n}))}async function At(e,t,s,n="image/png"){if(!("createImageBitmap"in window))return Ot(e,t,s,void 0,n);try{const a=await window.createImageBitmap(e,{resizeWidth:t,resizeHeight:s,resizeQuality:"high"});if(a.height!==s||a.width!==t)throw new Error("Image bitmap resize not supported!");return await new Promise((e=>{const t=document.createElement("canvas");t.width=a.width,t.height=a.height;const s=t.getContext("bitmaprenderer");s?s.transferFromImageBitmap(a):t.getContext("2d").drawImage(a,0,0),t.toBlob(e,n)}))}catch(a){return Ot(e,t,s,void 0,n)}}function Ot(e,t,s,n=.5,a="image/png"){const o=document.createElement("canvas"),r=o.getContext("2d"),i=document.createElement("canvas"),c=i.getContext("2d");if(o.width=t,o.height=s,e.width*n>t){const s=1/n;let a={width:Math.floor(e.width*n),height:Math.floor(e.height*n)};for(i.width=a.width,i.height=a.height,c.drawImage(e,0,0,a.width,a.height);a.width*n>t;)a={width:Math.floor(a.width*n),height:Math.floor(a.height*n)},c.drawImage(i,0,0,a.width*s,a.height*s,0,0,a.width,a.height);r.drawImage(i,0,0,a.width,a.height,0,0,o.width,o.height)}else r.drawImage(e,0,0,o.width,o.height);return new Promise((e=>{o.toBlob(e,a)}))}var Ft=s(4524);const Ut={width:200,height:200},Qt=115,$t=(e,t,s)=>{const{audio:n,voice:a}=(0,d.qp)(e),r=n?n.title||n.fileName:a?"Voice message":"",i=n&&n.performer||t&&(0,d.OU)(Bt.i0,t),c=s&&(0,d.U)(Bt.i0,s)||"Telegram",l=n&&(0,d.MR)(n)&&(0,d.Ti)(e,"pictogram"),u=t&&(0,d.RT)(t,"big"),h=n&&l||a&&u,m=(0,Pt.Z)(h),g=function(e,t,s){if(!s)return Ut;if(e){if(!e.thumbnailSizes||0===e.thumbnailSizes.length)return;return e.thumbnailSizes.find((e=>"m"===e.type))||e.thumbnailSizes[0]}return t?Ct.vY:void 0}(n,a,m),{result:f}=((e,t,s)=>{const[n,a]=(0,o.eJ)(!1),[r,i]=(0,o.eJ)(),[c,d]=(0,o.eJ)(s);return(0,o.d4)((()=>{a(!0);let e=!1;return function(e,t){if(!e)return Promise.resolve(Ft);if(!t)return function(e,t,s,n="image/png"){const a=e instanceof Blob?URL.createObjectURL(e):e,o=new Image;return new Promise((r=>{o.onload=()=>{At(o,t,s,n).then((e=>URL.createObjectURL(e))).then(r).finally((()=>{e instanceof Blob&&URL.revokeObjectURL(a)}))},o.src=a}))}(e,Qt,Qt);const s=Math.min(t.width,t.height);return s<Qt?xt(e,Qt/s):Promise.resolve(e)}(m,g).then((t=>{e||(a(!1),d(t))}),(t=>{e||(a(!1),i(t))})),()=>{e=!0}}),t),{isLoading:n,error:r,result:c}})(0,[m,g],Ft);return(0,o.Ye)((()=>(0,Lt.Of)({title:r,artist:i,album:c,artwork:[{src:f}]})),[c,i,r,f])};var Dt=s(396);const qt=(0,n.c$)(((e,{message:t})=>({sender:(0,i.Ur)(e,t),chat:(0,i.Z1)(e,t.chatId)})),((e,t)=>(0,g.ei)(t,["focusMessage","closeAudioPlayer"])))((({message:e,origin:t=h.Cr.Inline,className:s,noUi:n,sender:a,focusMessage:r,closeAudioPlayer:i,chat:c})=>{const l=(0,be.Z)(),{audio:u,voice:g}=(0,d.qp)(e),f=Boolean(g),p=a?(0,d.OU)(l,a):void 0,I=Tt.UV((0,d.Ti)(e,"inline")),v=$t(e,a,c),{playPause:y,stop:C,isPlaying:Z}=(0,Nt.Z)((0,Dt.An)(e),(0,d.XV)(e),f?"voice":"audio",t,I,void 0,v,void 0,!0,void 0,void 0,!0),P=(0,o.I4)((()=>{r({chatId:e.chatId,messageId:e.id})}),[r,e.chatId,e.id]),w=(0,o.I4)((()=>{Z&&y(),i(),(0,Lt.Ay)(),C()}),[i,Z,y,C]);if(!n)return o.ZP.createElement("div",{className:(0,ce.Z)("AudioPlayer",s),dir:l.isRtl?"rtl":void 0},o.ZP.createElement(ke.Z,{round:!0,ripple:!m.wB,color:"translucent",size:"smaller",className:(0,ce.Z)("toggle-play",Z?"pause":"play"),onClick:y,ariaLabel:Z?"Pause audio":"Play audio"},o.ZP.createElement("i",{className:"icon-play"}),o.ZP.createElement("i",{className:"icon-pause"})),o.ZP.createElement("div",{className:"AudioPlayer-content",onClick:P},u?function(e){const{title:t,performer:s,fileName:n}=e;return o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("div",{className:"title",dir:"auto"},(0,Zt.Z)(t||n)),s&&o.ZP.createElement("div",{className:"subtitle",dir:"auto"},(0,Zt.Z)(s)))}(u):function(e,t){return o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("div",{className:"title",dir:"auto"},t&&(0,Zt.Z)(t)),o.ZP.createElement("div",{className:"subtitle",dir:"auto"},e))}(l("AttachAudio"),p),o.ZP.createElement(St.Z,null)),o.ZP.createElement(ke.Z,{round:!0,className:"player-close",color:"translucent",size:"smaller",onClick:w,ariaLabel:"Close player"},o.ZP.createElement("i",{className:"icon-close"})))})),Gt=(0,o.X$)((0,n.c$)(((e,{chatId:t,threadId:s,messageListType:n})=>{const{isLeftColumnShown:a,lastSyncTime:o,shouldSkipHistoryAnimations:r}=e,{byId:c}=e.chats,d=(0,i.Z1)(e,t),{typingStatus:l}=d||{},{chatId:h,messageId:m}=e.audioPlayer,g=h&&m?(0,i.hj)(e,h,m):void 0;let f;if("pinned"===n){const s=(0,i.KB)(e,t);f=null==s?void 0:s.length}else if("scheduled"===n){const s=(0,i.qy)(e,t);f=null==s?void 0:s.length}else if("thread"===n&&s!==u._f){const n=(0,i.tZ)(e,t,s);f=(null==n?void 0:n.messagesCount)||0}const p={typingStatus:l,isLeftColumnShown:a,isRightColumnShown:(0,i.Jf)(e),isSelectModeActive:(0,i.CA)(e),audioMessage:g,chat:d,chatsById:c,messagesCount:f,isChatWithSelf:(0,i.FM)(e,t),isChatWithBot:d&&(0,i.xo)(e,d),lastSyncTime:o,shouldSkipHistoryAnimations:r,currentTransitionKey:Math.max(0,e.messages.messageLists.length-1),connectionState:e.connectionState},I=(0,i.Zw)(e,t);if("thread"!==n||!I)return p;if(Object.assign(p,{messagesById:I}),s!==u._f){const n=(0,i.qS)(e,t,s),a=n?(0,i.hj)(e,t,n):void 0,o=a?(0,i.cv)(e,a):void 0;return{...p,pinnedMessageIds:n,canUnpin:!1,topMessageSender:o}}const v=(0,i.KB)(e,t);if(null!=v&&v.length){const t=I[v[0]],{canUnpin:n}=t&&(0,i._k)(e,t,s)||{};return{...p,pinnedMessageIds:v,canUnpin:n}}return p}),((e,t)=>(0,g.ei)(t,["openChatWithInfo","pinMessage","focusMessage","openChat","openPreviousChat","loadPinnedMessages","toggleLeftColumn","exitMessageSelectMode"])))((({chatId:e,threadId:t,messageListType:s,isReady:r,pinnedMessageIds:c,messagesById:l,canUnpin:h,topMessageSender:g,typingStatus:f,isSelectModeActive:p,isLeftColumnShown:I,isRightColumnShown:v,audioMessage:y,chat:C,chatsById:Z,messagesCount:P,isChatWithSelf:w,isChatWithBot:b,lastSyncTime:M,shouldSkipHistoryAnimations:S,currentTransitionKey:E,connectionState:k,openChatWithInfo:R,pinMessage:T,focusMessage:N,openChat:B,openPreviousChat:L,loadPinnedMessages:x,toggleLeftColumn:A,exitMessageSelectMode:O})=>{const F=(0,be.Z)(),U=(0,o.sO)(!0),[Q,$]=(0,o.eJ)(0),D=Array.isArray(c)?c[Q]:c,q=l&&D?l[D]:void 0,G=Array.isArray(c)?c.length:c?1:void 0,H=C&&(0,d.U)(F,C).length,j=g?(0,d.OU)(F,g):void 0;(0,o.d4)((()=>{t===u._f&&M&&r&&x({chatId:e})}),[e,x,M,t,r]),(0,o.d4)((()=>{$(0)}),[c]),(0,mt.Z)(e,D,q);const{width:_}=ct(),V=_<=a.ks,W=m.p7&&I,z=(0,o.sO)(null),Y=(0,o.sO)(!0),K=(0,o.I4)((()=>{R({id:e})}),[R,e]),X=(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,ht.Z)(G||1,Q+1);$(e)}}),[q,N,t,G,Q]),ee=(0,o.I4)((()=>{B({id:e,threadId:u._f,type:"pinned"})}),[B,e]),te=(0,o.I4)((()=>{setTimeout((()=>{U.current=!0}),450)}),[]),se=(0,o.I4)((e=>{if(U.current){if(U.current=!1,m.wB){const e=document.getElementById(a.R2);e&&e.blur()}if(p)return O(),void te();if(t===u._f&&"thread"===s&&0===E)return m.wB||W?(e.stopPropagation(),B({id:void 0})):A(),void te();L(),te()}}),[t,s,E,p,L,W,B,A,O,te]),ne=(0,o.Ye)((()=>{if(V&&Z)return(0,i.A1)((0,n.Rd)())||void 0}),[V,Z]),ae=_>=a.ks&&_<a.jT||_>a.l3&&_<a.ks&&(!H||H>30),oe=ae||_>a._m&&_<a.QU,{shouldRender:re,transitionClassNames:ie}=(0,le.Z)(Boolean(y)),de=(0,gt.Z)(y),{shouldRender:ue,transitionClassNames:he}=(0,le.Z)(q&&!re),me=(0,gt.Z)(q,!0),ge=(0,gt.Z)(G,!0),fe=(0,gt.Z)(h,!0),pe=(0,gt.Z)(j),Ie=ue&&me||re&&de;(0,o.d4)((()=>{const e=z.current;if(e)return oe&&Ie?void(v||ae?(Y.current&&(e.classList.add("tools-stacked","animated"),Y.current=!1),setTimeout((()=>{e.classList.remove("animated")}),350)):(e.classList.remove("tools-stacked"),Y.current=!0)):(e.classList.remove("tools-stacked","animated"),void(Y.current=!0))}),[oe,Ie,ae,v]);const ve=(!we()||"connectionStateConnecting"===k)&&(m.wB||m.p7&&!W);function ye(){return ve?o.ZP.createElement(o.ZP.Fragment,null,Ce(),o.ZP.createElement("h3",null,F("WaitingForNetwork"))):"thread"===s&&t===u._f?o.ZP.createElement(o.ZP.Fragment,null,(V||E>0)&&Ce(W,!0),o.ZP.createElement("div",{className:"chat-info-wrapper",onClick:K},(0,d.YA)(e)?o.ZP.createElement(pt.Z,{userId:e,typingStatus:f,withFullInfo:b,withMediaViewer:!0,withUpdatingStatus:!0,noRtl:!0}):o.ZP.createElement(It.Z,{chatId:e,typingStatus:f,noRtl:!0,withMediaViewer:!0,withFullInfo:!0,withUpdatingStatus:!0}))):"thread"===s?o.ZP.createElement(o.ZP.Fragment,null,Ce(),o.ZP.createElement("h3",null,F("CommentsCount",P,"i"))):"pinned"===s?o.ZP.createElement(o.ZP.Fragment,null,Ce(),o.ZP.createElement("h3",null,F("PinnedMessagesCount",P,"i"))):"scheduled"===s?o.ZP.createElement(o.ZP.Fragment,null,Ce(),o.ZP.createElement("h3",null,w?F("Reminders"):F("messages",P,"i"))):void 0}function Ce(e=!1,t=!1){return o.ZP.createElement("div",{className:"back-button"},o.ZP.createElement(ke.Z,{round:!0,size:"smaller",color:"translucent",onClick:se,ariaLabel:e?"Close":"Back"},o.ZP.createElement("div",{className:(0,ce.Z)("animated-close-icon",!e&&"state-back")})),t&&ne&&o.ZP.createElement("div",{className:"unread-count active"},(0,ft.bi)(ne)))}return o.ZP.createElement("div",{className:"MiddleHeader",ref:z},o.ZP.createElement(Pe.Z,{name:S?"none":"slide-fade",activeKey:ve?1/0:E},ye),o.ZP.createElement("div",{className:"header-tools"},ue&&me&&!re&&o.ZP.createElement(Rt,{key:e,message:me,count:ge||0,index:Q,customTitle:pe,className:he,onUnpinMessage:fe?X:void 0,onClick:J,onAllPinnedClick:ee}),re&&de&&o.ZP.createElement(qt,{key:(0,d.Tp)(de),message:de,className:ie}),o.ZP.createElement(yt,{chatId:e,threadId:t,messageListType:s})))})));var Ht=s(2645),jt=s(274);function _t(e){return"albumId"in e}function Vt(e,t){let s,n=[],a={originalDate:e[0].date,datetime:Number((0,O.$Y)(1e3*e[0].date)),senderGroups:[n]};const o=[a];return e.forEach(((r,i)=>{r.isInAlbum?s?(s.messages.push(r),r.content.text&&(s.mainMessage=r)):s={albumId:r.groupedId,messages:[r],mainMessage:r}:n.push(r);const c=e[i+1];if(!s||c&&c.groupedId&&c.groupedId===s.albumId||(n.push(s),s=void 0),c){const e=Number((0,O.$Y)(1e3*c.date));a.datetime!==e?(a={originalDate:c.date,datetime:e,senderGroups:[]},o.push(a),n=[],a.senderGroups.push(n)):(c.id===t||r.senderId!==c.senderId||r.isOutgoing!==c.isOutgoing||(0,d.Lo)(r)||(0,d.Lo)(c)||r.forwardInfo&&c.forwardInfo&&(r.forwardInfo.senderUserId!==c.forwardInfo.senderUserId||r.forwardInfo.fromChatId!==c.forwardInfo.fromChatId||r.forwardInfo.hiddenUserName!==c.forwardInfo.hiddenUserName)||r.inlineButtons||c.inlineButtons||c.date-r.date>600)&&(n=[],a.senderGroups.push(n))}})),o}var Wt=s(386);var zt=s(7675),Yt=s(539),Kt=s(3657);const Xt=m.wZ?1e3:350,Jt=m.wB?300:500;var es=s(7240),ts=s(935);function ss(e){return"number"==typeof e}function ns(e,t){return e?t?238:175:t?238:100}function as(e,t){const s=(0,d.B4)(e),n=(0,d.MF)(e),a=(0,d.O$)(e)||(0,d.F$)(e),o=(0,d.b7)(e),r=Boolean((0,d.F$)(e)),{width:i,height:c}=a?(0,Ct.Eh)(a,s,n,r,t):(0,Ct.GC)(o,s,n,t),l=ns(Boolean((0,d.UD)(e)));let u=1;i<l&&l-i<12&&(u=l/i),c*u<90&&90-c*u<12&&(u=90/c);const h=Math.round(i*u),m=Math.round(c*u);return{width:h,height:m,isSmall:h<l||m<90}}function os(e,t){return e.reduce(((e,t)=>e+t),t)}function rs(e,t,s){return e<t?t:e>s?s:e}function is(e){const t={width:0,height:0};return e.forEach((({dimensions:e,sides:s})=>{2&s&&(t.width=e.width+e.x),4&s&&(t.height=e.height+e.y)})),t}function cs(e,t,s,n){const a=n.messages.map((e=>{const t=as(e);return t.width/t.height})),o=function(e){return e.map((e=>e>1.2?"w":e<.8?"n":"q")).join("")}(a),r=function(e){return e.reduce(((e,t)=>t+e),1)/e.length}(a),i=a.length,c=a.some((e=>e>2)),d=(0,Ct.kc)(e,t,!1,s)-(t?2.5:0)*Ct.Gw;let l;const u={ratios:a,proportions:o,averageRatio:r,maxWidth:d,minWidth:100,maxHeight:d,spacing:2};return l=i>=5||c?function({ratios:e,averageRatio:t,maxWidth:s,minWidth:n,spacing:a,maxHeight:o=4*s/3}){const r=function(e,t){return e.map((e=>t>1.1?rs(e,1,2.75):rs(e,.6667,1)))}(e,t),i=e.length,c=new Array(i),d=[],l=e=>{const t=[];let n=0;e.forEach((e=>{t.push(((e,t)=>{const n=os(r.slice(e,e+t),0);return(s-(t-1)*a)/n})(n,e)),n+=e})),d.push({lineCounts:e,heights:t})};for(let e=1;e!==i;++e){const t=i-e;e<=3&&t<=3&&l([e,t])}for(let e=1;e!==i-1;++e)for(let s=1;s!==i-e;++s){const n=i-e-s;e<=3&&s<=(t<.85?4:3)&&n<=3&&l([e,s,n])}for(let e=1;e!==i-1;++e)for(let t=1;t!==i-e;++t)for(let s=1;s!==i-e-t;++s){const n=i-e-t-s;e<=3&&t<=3&&s<=3&&n<=4&&l([e,t,s,n])}let u,h=0;for(let e=0;e<d.length;e++){const{heights:t,lineCounts:s}=d[e],r=s.length,i=os(t,0)+a*(r-1),c=Math.min(...t)<n?1.5:1,l=(()=>{for(let e=1;e!==r;++e)if(s[e-1]>s[e])return 1.5;return 1})(),m=Math.abs(i-o)*c*l;(!u||m<h)&&(u=d[e],h=m)}const m=u.lineCounts,g=u.heights,f=m.length;let p=0,I=0;for(let e=0;e!==f;++e){const t=m[e],n=g[e],o=Math.round(n);let i=0;for(let d=0;d!==t;++d){const l=0|(0===e?1:0)|(e===f-1?4:0)|(0===d?8:0)|(d===t-1?2:0),u=r[p],h=d===t-1?s-i:Math.round(u*n);c[p]={dimensions:{x:i,y:I,width:h,height:o},sides:l},i+=h+a,++p}I+=o+a}return c}(u):2===i?function(e){const{ratios:t,proportions:s,averageRatio:n}=e;return"ww"===s&&n>1.4&&t[1]-t[0]<.2?function(e){const{ratios:t,maxWidth:s,spacing:n,maxHeight:a}=e,o=Math.round(Math.min(s/t[0],Math.min(s/t[1],(a-n)/2)));return[{dimensions:{x:0,y:0,width:s,height:o},sides:11},{dimensions:{x:0,y:o+n,width:s,height:o},sides:14}]}(e):"ww"===s||"qq"===s?function(e){const{ratios:t,maxWidth:s,spacing:n,maxHeight:a}=e,o=(s-n)/2,r=Math.round(Math.min(o/t[0],Math.min(o/t[1],a)));return[{dimensions:{x:0,y:0,width:o,height:r},sides:13},{dimensions:{x:o+n,y:0,width:o,height:r},sides:7}]}(e):function(e){const{ratios:t,minWidth:s,maxWidth:n,spacing:a,maxHeight:o}=e,r=Math.round(1.5*s),i=Math.min(Math.round(Math.max(.4*(n-a),(n-a)/t[0]/(1/t[0]+1/t[1]))),n-a-r),c=n-i-a,d=Math.min(o,Math.round(Math.min(c/t[0],i/t[1])));return[{dimensions:{x:0,y:0,width:c,height:d},sides:13},{dimensions:{x:c+a,y:0,width:i,height:d},sides:7}]}(e)}(u):3===i?function(e){const{proportions:t}=e;return"n"===t[0]?function(e){const{maxHeight:t,spacing:s,ratios:n,maxWidth:a,minWidth:o}=e,r=t,i=Math.round(Math.min((t-s)/2,n[1]*(a-s)/(n[2]+n[1]))),c=r-i-s,d=Math.max(o,Math.round(Math.min((a-s)/2,Math.min(i*n[2],c*n[1])))),l=Math.min(Math.round(r*n[0]),a-s-d);return[{dimensions:{x:0,y:0,width:l,height:r},sides:13},{dimensions:{x:l+s,y:0,width:d,height:c},sides:3},{dimensions:{x:l+s,y:c+s,width:d,height:i},sides:6}]}(e):function(e){const{maxWidth:t,ratios:s,maxHeight:n,spacing:a}=e,o=t,r=Math.round(Math.min(o/s[0],.66*(n-a))),i=(t-a)/2,c=Math.min(n-r-a,Math.round(Math.min(i/s[1],i/s[2])));return[{dimensions:{x:0,y:0,width:o,height:r},sides:11},{dimensions:{x:0,y:r+a,width:i,height:c},sides:12},{dimensions:{x:i+a,y:r+a,width:o-i-a,height:c},sides:6}]}(e)}(u):function(e){const{proportions:t}=e;return"w"===t[0]?function({maxWidth:e,ratios:t,spacing:s,maxHeight:n,minWidth:a}){const o=e,r=Math.round(Math.min(o/t[0],.66*(n-s))),i=Math.round((e-2*s)/(t[1]+t[2]+t[3])),c=Math.max(a,Math.round(Math.min(.4*(e-2*s),i*t[1]))),d=Math.round(Math.max(Math.max(a,.33*(e-2*s)),i*t[3])),l=o-c-d-2*s,u=Math.min(n-r-s,i);return[{dimensions:{x:0,y:0,width:o,height:r},sides:11},{dimensions:{x:0,y:r+s,width:c,height:u},sides:12},{dimensions:{x:c+s,y:r+s,width:l,height:u},sides:4},{dimensions:{x:c+s+l+s,y:r+s,width:d,height:u},sides:6}]}(e):function({maxHeight:e,ratios:t,maxWidth:s,spacing:n,minWidth:a}){const o=e,r=Math.round(Math.min(o*t[0],.6*(s-n))),i=Math.round((e-2*n)/(1/t[1]+1/t[2]+1/t[3])),c=Math.round(i/t[1]),d=Math.round(i/t[2]),l=o-c-d-2*n,u=Math.max(a,Math.min(s-r-n,i));return[{dimensions:{x:0,y:0,width:r,height:o},sides:13},{dimensions:{x:r+n,y:0,width:u,height:c},sides:3},{dimensions:{x:r+n,y:c+n,width:u,height:d},sides:2},{dimensions:{x:r+n,y:c+d+2*n,width:u,height:l},sides:6}]}(e)}(u),{layout:l,containerStyle:is(l)}}let ds;function ls(e){return ds||(ds=document.createElement("span"),ds.style.font=m.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',ds.style.whiteSpace="nowrap",ds.style.position="absolute",ds.style.left="-999px",ds.style.opacity=".01",document.body.appendChild(ds)),ds.innerHTML=e,ds.offsetWidth}function us(e,t,s,n,a,r){(0,o.bt)((()=>{if(s&&e.current){const t=e.current.closest(".MessageList");(0,Yt.Z)(t,e.current,a?"end":"centerOrTop",20,void 0!==n?1e3:void 0,n,void 0,r)}}),[e,t,s,n,a,r])}var hs=s(172),ms=s(2864);const gs=(0,o.X$)((e=>{const{isOpen:t}=e,s=(0,De.Z)($e.gl.Extra,"ContextMenuContainer",!t);return s?o.ZP.createElement(s,e):void 0})),fs=(0,o.X$)((0,n.c$)(((e,{message:t})=>{const{byId:s}=e.users,n=t.senderId,{targetUserIds:a,targetChatId:o}=t.content.action||{},r=t.replyToMessageId,c=r?(0,i.hj)(e,t.chatId,r):void 0,l=(0,i._X)(e,t),{direction:u,noHighlight:h}=l&&e.focusedMessage||{},m=(0,i.Z1)(e,t.chatId);return{usersById:s,sender:m&&((0,d.eA)(m)||n===t.chatId)?m:n?(0,i.dy)(e,n):void 0,targetChatId:o,targetUserIds:a,targetMessage:c,isFocused:l,...l&&{focusDirection:u,noFocusHighlight:h}}}))((({message:e,observeIntersection:t,isEmbedded:s,appearanceOrder:n=0,isLastInList:a,usersById:r,sender:i,targetUserIds:c,targetMessage:d,targetChatId:l,isFocused:u,focusDirection:h,noFocusHighlight:m})=>{const g=(0,o.sO)(null);(0,Kt._N)(g,t),(0,mt.Z)(e.chatId,e.replyToMessageId,d),us(g,e.chatId,u,h,m);const f=(0,be.Z)(),p=n<=0,[I,v]=(0,Ze.Z)(p);(0,o.d4)((()=>{p||setTimeout(v,10*n)}),[n,v,p]);const{transitionClassNames:y}=(0,le.Z)(I,void 0,p,!1),C=(0,o.Ye)((()=>c?c.map((e=>null==r?void 0:r[e])).filter(Boolean):void 0),[c,r]),Z=(0,ms.D)(f,e,i,C,d,l,s?{isEmbedded:!0,asPlain:!0}:void 0),{isContextMenuOpen:P,contextMenuPosition:w,handleBeforeContextMenu:b,handleContextMenu:M,handleContextMenuClose:S,handleContextMenuHide:E}=(0,es.Z)(g),k=void 0!==w;if(s)return o.ZP.createElement("span",{className:"embedded-action-message"},(0,Zt.Z)(Z));const R=(0,ce.Z)("ActionMessage message-list-item",u&&!m&&"focused",k&&"has-menu-open",a&&"last-in-list",y);return o.ZP.createElement("div",{ref:g,id:`message${e.id}`,className:R,"data-message-id":e.id,onMouseDown:e=>{(0,Wt.q)(e),b(e)},onContextMenu:M},o.ZP.createElement("span",null,Z),w&&o.ZP.createElement(gs,{isOpen:P,anchor:w,message:e,messageListType:"thread",onClose:S,onCloseAnimationEnd:E}))}))),ps=({className:e,message:t,sender:s,title:n,customText:a,observeIntersection:r,onClick:i})=>{const c=(0,o.sO)(null),l=(0,Kt.Op)(c,r),u=(0,Pt.Z)(t&&(0,d.Ti)(t,"pictogram"),!l),h=t&&`sticker-reply-thumb${t.id}`,m=bt(t),g=Boolean(t&&(0,d.Y5)(t)),f=(0,be.Z)(),p=s&&(0,d.OU)(f,s);return o.ZP.createElement("div",{ref:c,className:(0,ce.Z)("EmbeddedMessage",e),onClick:t?i:void 0},m&&function(e,t,s,n){const{width:a,height:r}=(0,Ct.W7)();return o.ZP.createElement("img",{id:e,src:s||t,width:a,height:r,alt:"",className:n?"round":""})}(h,m,u,g),o.ZP.createElement("div",{className:"message-text"},o.ZP.createElement("p",{dir:"auto"},t?(0,d.Lo)(t)?o.ZP.createElement(fs,{message:t,isEmbedded:!0}):(0,Zt.Z)((0,d.MK)(f,t,Boolean(m))):a||" "),o.ZP.createElement("div",{className:"message-title",dir:"auto"},(0,Zt.Z)(p||n||" "))))};var Is=s(2535),vs=s(4752),ys=s(8018);const Cs=(0,o.X$)((({message:e,outgoingStatus:t,signature:s,onClick:n})=>{const a=(0,be.Z)();return o.ZP.createElement("span",{className:"MessageMeta",dir:a.isRtl?"rtl":"ltr",onClick:n},Boolean(e.views)&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("span",{className:"message-views"},(0,ft.bi)(e.views)),o.ZP.createElement("i",{className:"icon-channelviews"})),s&&o.ZP.createElement("span",{className:"message-signature"},(0,Zt.Z)(s)),o.ZP.createElement("span",{className:"message-time"},e.isEdited&&`${a("EditedMessage")} `,(0,O.mr)(1e3*e.date)),t&&o.ZP.createElement(ys.Z,{status:t}))}));var Zs=s(8835),Ps=s(7799),ws=s(4851);const bs=({message:e,observeIntersection:t,observeIntersectionForPlaying:s,shouldLoop:n,lastSyncTime:r})=>{const i=(0,o.sO)(null),[c,l,u]=(0,Ze.Z)(),h=e.content.sticker,{isAnimated:m,stickerSetId:g}=h,f=g===a.n,p=(0,Kt.Op)(i,t),I=(0,Kt.Op)(i,s),v=h.isPreloadedGlobally?`sticker${h.id}`:(0,d.Ti)(e,"inline"),y=bt(e),C=(0,Pt.Z)(v,!p,(0,d.kG)(e,"inline",!0),r),Z=Boolean(C),[P,w]=(0,Ze.Z)(Z),b=m?P:Z,{shouldRenderFullMedia:M,transitionClassNames:S}=(0,Zs.Z)(b,"slow"),{width:E,height:k}=(0,Ct.Wr)(h),R=(0,ce.Z)("thumbnail",!y&&"empty"),T=(0,ce.Z)("Sticker media-inner",f&&"inactive");return o.ZP.createElement("div",{ref:i,className:T,onClick:f?void 0:l},!b&&o.ZP.createElement("img",{id:`sticker-thumb-${e.id}`,src:y,width:E,height:k,alt:"",className:R}),!m&&M&&o.ZP.createElement("img",{id:`sticker-${e.id}`,src:C,width:E,height:k,alt:"",className:(0,ce.Z)("full-media",S)}),m&&Z&&o.ZP.createElement(Ps.Z,{key:v,className:(0,ce.Z)("full-media",S),id:v,animationData:C,size:E,play:I,noLoop:!n,onLoad:w}),o.ZP.createElement(ws.Z,{isOpen:c,fromSticker:h,onClose:u}))};var Ms=s(7854),Ss=s(2761),Es=s(5866);function ks(e,t){return(0,Es.Z)((0,d.DH)(e),Boolean(t),m.wB&&!m.vX)}var Rs=s(7204);const Ts={dark:{outgoing:"rgb(135,116,225)",incoming:"rgb(33,33,33)"},light:{outgoing:"rgb(238,255,222)",incoming:"rgb(255,255,255)"}};var Ns=s(9196);const Bs=({id:e,message:t,observeIntersection:s,noAvatars:n,shouldAutoLoad:a,isInSelectMode:r,isSelected:i,uploadProgress:c,size:l="inline",dimensions:u,nonInteractive:h,shouldAffectAppendix:m,theme:g,onClick:f,onCancelUpload:p})=>{const I=(0,o.sO)(null),v=((0,d.O$)(t)||(0,d.F$)(t)).blobUrl,y=(0,Kt.Op)(I,s),[C,Z]=(0,o.eJ)(a),P=C&&y,{mediaData:w,downloadProgress:b}=(0,Ss.Z)((0,d.Ti)(t,l),!P),M=v||w,S=ks(t,M),{isUploading:E,isTransferring:k,transferProgress:R}=(0,d.Sc)(t,c||b,P&&!M),T=!1===(0,Rs.Z)(C),{shouldRender:N,transitionClassNames:B}=(0,le.Z)(k,void 0,T,"slow"),{shouldRenderThumb:L,shouldRenderFullMedia:x,transitionClassNames:A}=(0,Zs.Z)(M,"slow"),O=(0,o.I4)((()=>{E?p&&p(t):M?f&&f(t.id):Z((e=>!e))}),[M,E,t,p,f]),F=(0,d.B4)(t);(0,o.bt)((()=>{if(!m)return;const e=I.current.closest(".message-content");M?function(e,t,s,n,a){return n?Promise.resolve(Ts[a||"light"][t?"outgoing":"incoming"]):async function(e,t){const s=new Image;s.src=e,s.width||await new Promise((e=>{s.onload=e}));const n=document.createElement("canvas"),a=n.getContext("2d");n.width=s.width,n.height=s.height,a.drawImage(s,0,0,s.width,s.height);const o=t?s.width-1:0,r=s.height-1;return`rgba(${Array.from(a.getImageData(o,r,1,1).data).join(",")})`}(e,t)}(M,F,0,i,g).then((t=>{e.style.setProperty("--appendix-bg",t),e.setAttribute("data-has-custom-appendix","")})):e.classList.add("has-appendix-thumb")}),[M,F,m,r,i,g]);const{width:U,height:Q,isSmall:$}=u||as(t,n),D=(0,ce.Z)("media-inner",!E&&!h&&"interactive",$&&"small-image",U===Q&&"square-image"),q=u?`width: ${U}px; height: ${Q}px; left: ${u.x}px; top: ${u.y}px;`:"";return o.ZP.createElement("div",{id:e,ref:I,className:D,style:q,onClick:E?void 0:O},L&&o.ZP.createElement("canvas",{ref:S,className:"thumbnail",style:`width: ${U}px; height: ${Q}px`}),x&&o.ZP.createElement("img",{src:M,className:`full-media ${A}`,width:U,height:Q,alt:""}),N&&o.ZP.createElement("div",{className:`media-loading ${B}`},o.ZP.createElement(Ns.Z,{progress:R,onClick:E?O:void 0})),!M&&!C&&o.ZP.createElement("i",{className:"icon-download"}),k&&o.ZP.createElement("span",{className:"message-upload-progress"},Math.round(100*R),"%"))};var Ls=s(2019),xs=s(4753);function As(e,t){const s=(0,o.sO)();s.current=t;const n=(0,o.I4)((()=>{e.current&&e.current.pause()}),[e]),a=(0,o.I4)((()=>{e.current&&s.current&&(0,xs.Z)(e.current)}),[e]);(0,ie.ZP)(n,a)}var Os=s(6898);const Fs=(e,t=!1)=>{const s=(0,o.sO)(!1),n=(0,o.sO)(!1),a=(0,o.I4)((()=>{n.current=!0,t&&e.current&&(s.current||(s.current=!e.current.paused),e.current.pause())}),[t,e]),r=(0,o.I4)((()=>{t&&e.current&&s.current&&document.body.contains(e.current)&&(0,xs.Z)(e.current),s.current=!1,n.current=!1}),[t,e]),i=(0,o.I4)((()=>{(0,C.T2)(r)}),[r]);document.hasFocus()||a(),(0,ue.Z)(a,i)};function Us(){return(Us=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n])}return e}).apply(this,arguments)}const Qs=({id:e,message:t,observeIntersection:s,noAvatars:n,shouldAutoLoad:a,shouldAutoPlay:r,uploadProgress:i,lastSyncTime:c,dimensions:l,onClick:u,onCancelUpload:h})=>{var m;const g=(0,o.sO)(null),f=(0,o.sO)(null),p=(0,d.b7)(t)||(0,d.Cg)(t),I=p.blobUrl,v=(0,Kt.Op)(g,s),[y,C]=(0,o.eJ)(a),Z=Boolean(y&&v&&c),[P,w]=(0,o.eJ)(r),b=(0,Pt.Z)((0,d.Ti)(t,"pictogram"),!(v&&c),(0,d.kG)(t,"pictogram"),c),{mediaData:M,downloadProgress:S}=(0,Ss.Z)((0,d.Ti)(t,"inline"),!Z,(0,d.kG)(t,"inline"),c),E=I||M,k=Boolean(v&&E),R=ks(t,b),{isBuffered:T,bufferingHandlers:N}=(0,Ls.Z)(!a),{isUploading:B,isTransferring:L,transferProgress:x}=(0,d.Sc)(t,i||S,Z&&!T),A=!1===(0,Rs.Z)(y),{shouldRender:F,transitionClassNames:U}=(0,le.Z)(L,void 0,A),{transitionClassNames:Q}=(0,Zs.Z)(E,"slow"),[$,D]=(0,o.eJ)(0),q=(0,o.I4)((e=>{D(Math.max(0,e.currentTarget.currentTime-1))}),[]),G=(null===(m=f.current)||void 0===m?void 0:m.duration)||p.duration||0,H=(0,d.B4)(t),j=(0,d.MF)(t),{width:_,height:V}=l||(0,Ct.GC)(p,H,j,n);As(f,Boolean(k&&r)),Fs(f,P),(0,Os.Z)(f,[k]);const W=(0,o.I4)((()=>{B?h&&h(t):E?E&&!P?(w(!0),f.current.play()):u&&u(t.id):C((e=>!e))}),[B,E,P,u,h,t]),z=(0,ce.Z)("media-inner dark",!B&&"interactive"),Y=(0,ce.Z)("full-media",Q),K=l?`width: ${_}px; height: ${V}px; left: ${l.x}px; top: ${l.y}px;`:"";return o.ZP.createElement("div",{ref:g,id:e,className:z,style:K,onClick:B?void 0:W},!b&&o.ZP.createElement("canvas",{ref:R,className:"thumbnail",style:`width: ${_}px; height: ${V}px;`}),b&&o.ZP.createElement("img",{src:b,className:"thumbnail",style:`width: ${_}px; height: ${V}px;`,alt:""}),k&&o.ZP.createElement("video",Us({ref:f,className:Y,width:_,height:V,autoPlay:P,muted:!0,loop:!0,playsInline:!0},N,{onTimeUpdate:q}),o.ZP.createElement("source",{src:E})),y&&!P&&!F&&o.ZP.createElement("i",{className:"icon-large-play"}),F&&o.ZP.createElement("div",{className:`media-loading ${U}`},o.ZP.createElement(Ns.Z,{progress:x,onClick:B?W:void 0})),!y&&o.ZP.createElement("i",{className:"icon-download"}),L?o.ZP.createElement("span",{className:"message-upload-progress"},B?`${Math.round(100*x)}%`:"..."):o.ZP.createElement("div",{className:"message-media-duration"},p.isGif?"GIF":(0,O.k9)(Math.max(G-$,0))))};var $s=s(6272);const Ds=(0,n.c$)(((e,{contact:t})=>{const{countryList:{phoneCodes:s}}=e;return{user:(0,i.dy)(e,t.userId),phoneCodeList:s}}),((e,t)=>(0,g.ei)(t,["openUserInfo"])))((({contact:e,user:t,openUserInfo:s,phoneCodeList:n})=>{const{firstName:a,lastName:r,phoneNumber:i,userId:c}=e,d=(0,o.I4)((()=>{s({id:c})}),[s,c]);return o.ZP.createElement("div",{className:(0,ce.Z)("Contact",Boolean(c)&&"interactive"),onClick:c?d:void 0},o.ZP.createElement(hs.Z,{size:"large",user:t,text:a||r}),o.ZP.createElement("div",{className:"contact-info"},o.ZP.createElement("div",{className:"contact-name"},a," ",r),o.ZP.createElement("div",{className:"contact-phone"},(0,$s.WZ)(n,i))))}));var qs=s(1218),Gs=s(4434),Hs=s(6937);function js(e,t){return t>0?(e/t*100).toFixed():0}const _s=({answer:e,voteResults:t,totalVoters:s,maxVotersCount:n,correctResults:a,shouldAnimate:r})=>{const i=t&&t.find((t=>t.option===e.option)),c=0===a.length||-1!==a.indexOf(e.option),d=a.length>0&&c||(null==i?void 0:i.isChosen),l=i?js(i.votersCount,s||0):0,[u,h]=(0,o.eJ)(r?0:l),m=(0,o.sO)(null),g=i?js(i.votersCount,n||0):0,f=u<l;if((0,o.d4)((()=>{r&&h(l)}),[r,l]),(0,o.d4)((()=>{const e=m.current;if(e&&r){const t=e.firstElementChild,s=f?"":"stroke-dasharray: 100% 200%; stroke-dashoffset: -44";t?t.setAttribute("style",s):e.innerHTML=`\n <svg class="poll-line" xmlns="http://www.w3.org/2000/svg" style="${s}">\n <path d="M4.47 5.33v13.6a9 9 0 009 9h13"/>\n </svg>`}}),[f,r]),!t||!i)return;const p=`width: ${g}%; transform:scaleX(${f?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,ce.Z)("poll-option-chosen",!c&&"wrong",r&&"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,Zt.Z)(e.text)),o.ZP.createElement("div",{className:(0,ce.Z)("poll-option-answer",d&&!c&&"wrong")},o.ZP.createElement("div",{className:"poll-option-corner",ref:m}),o.ZP.createElement("div",{className:"poll-option-line",style:p}))))},Vs=(0,o.X$)((0,n.c$)(((e,{poll:t})=>{const{recentVoterIds:s}=t.results,{serverTimeOffset:n,users:{byId:a}}=e;return s&&0!==s.length?{recentVoterIds:s,usersById:a,serverTimeOffset:n}:{}}),((e,t)=>(0,g.ei)(t,["loadMessage","openPollResults"])))((({message:e,poll:t,recentVoterIds:s,usersById:n,loadMessage:a,onSendVote:r,openPollResults:i,serverTimeOffset:c})=>{const{id:d,chatId:l}=e,{summary:u,results:h}=t,[m,g]=(0,o.eJ)(!1),[f,p]=(0,o.eJ)([]),[I,v]=(0,o.eJ)(!1),[y,C]=(0,o.eJ)(!1),[Z,P]=(0,o.eJ)(!u.closed&&u.closeDate&&u.closeDate>0?Math.min(u.closeDate-Math.floor(Date.now()/1e3)+c,u.closePeriod):0),w=(0,o.sO)(null),{results:b,totalVoters:M}=h,S=b&&b.some((e=>e.isChosen)),E=!u.closed&&!S,k=!E&&u.isPublic&&Number(h.totalVoters)>0,R=E&&u.multipleChoice,T=b?Math.max(...b.map((e=>e.votersCount))):M,N=b?b.reduce(((e,t)=>(t.isCorrect&&e.push(t.option),e)),[]):[],B=u.answers.map((e=>({label:e.text,value:e.option,hidden:Boolean(u.quiz&&u.closePeriod&&Z<=0)})));(0,o.d4)((()=>{m&&t.results.results&&t.results.results.some((e=>e.isChosen))&&g(!1)}),[m,t.results.results]),(0,o.d4)((()=>{Z>0&&setTimeout((()=>P(Z-1)),1e3);const e=w.current;if(e){const t=12*Math.PI,s=e.lastElementChild,n=e.firstElementChild;if(Z<=5&&e.classList.add("hurry-up"),s&&n){const e=(u.closePeriod-Z)/u.closePeriod*t;n.textContent=(0,O.k9)(Z),s.firstElementChild.setAttribute("stroke-dashoffset",`-${e}`)}else e.innerHTML=`\n <span>${(0,O.k9)(Z)}</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>`}}),[Z,u.closePeriod]),(0,o.d4)((()=>{u.quiz&&(Z<=0||S&&!u.closed)&&a({chatId:l,messageId:d})}),[l,Z,S,a,d,u.closed,u.quiz]),(0,o.d4)((()=>{let e;return u.quiz&&!u.closed&&u.closePeriod&&u.closePeriod>0&&(e=window.setTimeout((()=>{a({chatId:l,messageId:d})}),1e3*u.closePeriod)),()=>{e&&window.clearTimeout(e)}}),[E,l,a,d,u.closePeriod,u.closed,u.quiz]);const L=(0,o.Ye)((()=>s?s.reduce(((e,t)=>{const s=n[t];return s&&e.push(s),e}),[]):[]),[n,s]),x=(0,o.I4)((e=>{p([e]),g(!0),C(!0),r([e])}),[r]),A=(0,o.I4)((e=>{p(e)}),[]),F=(0,o.I4)((()=>{g(!0),C(!0),r(f)}),[r,f]),U=(0,o.I4)((()=>{i({chatId:l,messageId:d})}),[l,d,i]),Q=(0,o.I4)((()=>{v(!0)}),[]),$=(0,o.I4)((()=>{v(!1),C(!1)}),[]);(0,o.d4)((()=>{y&&S&&u.quiz&&h.results&&t.results.solution&&(h.results.find((e=>e.isChosen&&e.isCorrect))||v(!0))}),[S,y,h.results,u.quiz,t.results.solution]);const D=(0,be.Z)();return o.ZP.createElement("div",{className:"Poll",dir:D.isRtl?"auto":"ltr"},I&&t.results.solution&&o.ZP.createElement(Hs.Z,{message:(0,ts.H)(t.results.solution,t.results.solutionEntities),duration:5e3,onDismiss:$,containerId:"#middle-column-portals"}),o.ZP.createElement("div",{className:"poll-question"},(0,Zt.Z)(u.question,["emoji","br"])),o.ZP.createElement("div",{className:"poll-type"},D(function(e){return void 0===e.isPublic?" ":e.quiz?e.isPublic?"QuizPoll":"AnonymousQuizPoll":e.closed?"FinalResults":e.isPublic?"PublicPoll":"AnonymousPoll"}(u)),L.length>0&&o.ZP.createElement("div",{className:"poll-recent-voters"},L.map((e=>o.ZP.createElement(hs.Z,{size:"micro",user:e})))),Z>0&&E&&o.ZP.createElement("div",{ref:w,className:"poll-countdown"}),u.quiz&&t.results.solution&&!E&&o.ZP.createElement(ke.Z,{round:!0,size:"tiny",color:"translucent",className:"poll-quiz-help",disabled:I,onClick:Q,ariaLabel:"Show Solution"},o.ZP.createElement("i",{className:"icon-lamp"}))),E&&o.ZP.createElement("div",{className:"poll-answers"},R?o.ZP.createElement(qs.Z,{options:B,onChange:A,disabled:e.isScheduled||m,loadingOptions:m?f:void 0,round:!0}):o.ZP.createElement(Gs.Z,{name:`poll-${d}`,options:B,onChange:x,disabled:e.isScheduled||m,loadingOption:m?f[0]:void 0})),!E&&o.ZP.createElement("div",{className:"poll-results"},u.answers.map((function(e){return o.ZP.createElement(_s,{key:e.option,shouldAnimate:y,answer:e,voteResults:b,totalVoters:M,maxVotersCount:T,correctResults:N})}))),!k&&!R&&o.ZP.createElement("div",{className:"poll-voters-count"},function(e,t,s){return s?e(t?"Answer":"Vote",s,"i"):e(t?"Chat.Quiz.TotalVotesEmpty":"Chat.Poll.TotalVotesResultEmpty")}(D,u.quiz,h.totalVoters)),R&&o.ZP.createElement(ke.Z,{isText:!0,disabled:0===f.length,size:"tiny",onClick:F},D("PollSubmitVotes")),k&&o.ZP.createElement(ke.Z,{isText:!0,size:"tiny",onClick:U},D("PollViewResults")))})));var Ws=s(8035),zs=s(88);const Ys=(0,o.X$)((({message:e,observeIntersection:t,noAvatars:s,shouldAutoLoad:n,shouldAutoPlay:a,inPreview:r,lastSyncTime:i,theme:c,onMediaClick:l,onCancelMediaTransfer:u})=>{const h=(0,d.s1)(e);let m=!1;if(null!=h&&h.photo&&!h.video){const{width:t,height:s}=as(e);m=t===s}const g=(0,o.I4)((()=>{l()}),[l]);if(!h)return;const{siteName:f,url:p,displayUrl:I,title:v,description:y,photo:C,video:Z}=h,P=(C||Z)&&l&&!m,w=(0,Ws.Z)(y,170),b=(0,ce.Z)("WebPage",m&&"with-square-photo",!C&&!Z&&!r&&"without-media",Z&&"with-video");return o.ZP.createElement("div",{className:b,"data-initial":(f||I)[0],dir:"auto"},C&&!Z&&o.ZP.createElement(Bs,{message:e,observeIntersection:t,noAvatars:s,shouldAutoLoad:n,size:m?"pictogram":"inline",nonInteractive:!P,onClick:P?g:void 0,onCancelUpload:u,theme:c}),o.ZP.createElement("div",{className:"WebPage-text"},o.ZP.createElement(zs.Z,{className:"site-name",url:p,text:f||I}),!r&&v&&o.ZP.createElement("p",{className:"site-title"},(0,Zt.Z)(v)),w&&o.ZP.createElement("p",{className:"site-description"},(0,Zt.Z)(w,["emoji","br"]))),!r&&Z&&o.ZP.createElement(Qs,{message:e,observeIntersection:t,noAvatars:s,shouldAutoLoad:n,shouldAutoPlay:a,lastSyncTime:i,onClick:P?g:void 0,onCancelUpload:u}))}));var Ks=s(9937);const Xs=(0,o.X$)((({message:e})=>{const t=(0,be.Z)(),s=(0,d.eO)(e),{title:n,text:a,amount:r,currency:i,isTest:c,photoUrl:l}=s;return o.ZP.createElement("div",{className:"Invoice"},n&&o.ZP.createElement("p",{className:"title"},(0,Zt.Z)(n)),a&&o.ZP.createElement("p",null,(0,Zt.Z)(a,["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,Ks.x)(r,i,t.code),c&&o.ZP.createElement("span",null,t("PaymentTestInvoice")))))}));function Js(e){return(0,o.X$)((0,n.c$)(((e,t)=>{const{message:s}=t;return{isInSelectMode:(0,i.CA)(e),isSelected:(0,i.vk)(e,s.id)}}),((e,t)=>(0,g.ei)(t,["toggleMessageSelection"])))((t=>{const{isInSelectMode:s,isSelected:n,message:a,toggleMessageSelection:r,dimensions:i}=t,c=(0,o.I4)((e=>{e.stopPropagation(),r({messageId:a.id,withShift:null==e?void 0:e.shiftKey})}),[r,a]),d=(0,o.Ye)((()=>({...t,isInSelectMode:s,isSelected:n,dimensions:{...t.dimensions,x:0,y:0},onClick:s?void 0:t.onClick})),[t,s,n]);return o.ZP.createElement("div",{className:(0,ce.Z)("album-item-select-wrapper",n&&"is-selected"),style:i?`left: ${i.x}px; top: ${i.y}px;`:"",onClick:s?c:void 0},s&&o.ZP.createElement("div",{className:"message-select-control"},n&&o.ZP.createElement("i",{className:"icon-select"})),o.ZP.createElement(e,d))})))}const en=Js(Bs),tn=Js(Qs),sn=(0,n.c$)((e=>({theme:(0,i.Pu)(e),uploadsById:e.fileUploads.byMessageLocalId})),((e,t)=>(0,g.ei)(t,["cancelSendingMessage"])))((({album:e,observeIntersection:t,shouldAutoLoad:s,shouldAutoPlay:n,hasCustomAppendix:a,lastSyncTime:r,isOwn:i,albumLayout:c,onMediaClick:l,uploadsById:u,theme:h,cancelSendingMessage:m})=>{const g=e.messages.length,f=(0,o.I4)((e=>{m({chatId:e.chatId,messageId:e.id})}),[m]),{width:p,height:I}=c.containerStyle;return o.ZP.createElement("div",{className:"Album",style:`width: ${p}px; height: ${I}px;`},e.messages.map((function(e,m){const{photo:p,video:I}=(0,d.qp)(e),v=u[e.previousLocalId||e.id],y=null==v?void 0:v.progress,{dimensions:C,sides:Z}=c.layout[m];if(p){const n=a&&(i?m===g-1:Boolean(8&Z&&4&Z));return o.ZP.createElement(en,{id:`album-media-${e.id}`,message:e,observeIntersection:t,shouldAutoLoad:s,shouldAffectAppendix:n,uploadProgress:y,dimensions:C,onClick:l,onCancelUpload:f,theme:h})}if(I)return o.ZP.createElement(tn,{id:`album-media-${e.id}`,message:e,observeIntersection:t,shouldAutoLoad:s,shouldAutoPlay:n,uploadProgress:y,lastSyncTime:r,dimensions:C,onClick:l,onCancelUpload:f,theme:h})})))}));function nn(){return(nn=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n])}return e}).apply(this,arguments)}let an;const on=({message:e,observeIntersection:t,shouldAutoLoad:s,shouldAutoPlay:n,lastSyncTime:a})=>{const r=(0,o.sO)(null),i=(0,o.sO)(null),c=(0,o.sO)(null),l=e.content.video,u=(0,Kt.Op)(r,t),[h,m]=(0,o.eJ)(s&&n),g=Boolean(h&&u&&a),{mediaData:f,downloadProgress:p}=(0,Ss.Z)((0,d.Ti)(e,"inline"),!g,(0,d.kG)(e,"inline"),a),I=ks(e,f),{isBuffered:v,bufferingHandlers:y}=(0,Ls.Z)(),Z=h&&!v,P=!1===(0,Rs.Z)(h),{shouldRender:w,transitionClassNames:b}=(0,le.Z)(Z||!v,void 0,P),{shouldRenderThumb:M,transitionClassNames:S}=(0,Zs.Z)(f,"slow"),[E,k]=(0,o.eJ)(!1),[R,T]=(0,o.eJ)(0);(0,o.d4)((()=>{if(!E)return;const e=188*Math.PI,t=e-R*e,s=c.current,n=i.current,a=n.firstElementChild;a?a.firstElementChild.setAttribute("stroke-dashoffset",t.toString()):n.innerHTML=`<svg width="200px" height="200px">\n <circle cx="100" cy="100" r="94" class="progress-circle" transform="rotate(-90, 100, 100)"\n stroke-dasharray="${e} ${e}"\n stroke-dashoffset="${e}"\n />\n </svg>`,T(s.currentTime/s.duration)}),[E,R]);const N=Boolean(f&&u),B=()=>{k(!1),T(0),(0,xs.Z)(c.current),(0,C.T2)((()=>{i.current.innerHTML=""}))},L=(x=B,()=>{an&&an(),an=x});var x;(0,o.d4)((()=>{c.current&&(N?(0,xs.Z)(c.current):c.current.pause())}),[N]),As(c,N),Fs(c,Boolean(f)),(0,Os.Z)(c,[f]);const A=(0,o.I4)((()=>{if(!f)return void m((e=>!e));const e=c.current;E?e.paused?((0,xs.Z)(e),(0,Dt.Es)()):e.pause():(L(),e.pause(),e.currentTime=0,(0,xs.Z)(e),(0,Dt.Es)(),k(!0))}),[L,E,f]),F=(0,o.I4)((e=>{const t=e.currentTarget;T(t.currentTime/t.duration)}),[]),U=(0,ce.Z)("full-media",S);return o.ZP.createElement("div",{ref:r,className:"RoundVideo media-inner",onClick:A},(M||f)&&o.ZP.createElement("div",{className:"thumbnail-wrapper"},o.ZP.createElement("canvas",{ref:I,className:"thumbnail",style:`width: ${Ct.vw}px; height: ${Ct.vw}px`})),f&&o.ZP.createElement("div",{className:"video-wrapper"},o.ZP.createElement("video",nn({ref:c,className:U,width:Ct.vw,height:Ct.vw,autoPlay:!0,muted:!E,loop:!E,playsInline:!0,onEnded:E?B:void 0},y,{onTimeUpdate:E?F:void 0}),o.ZP.createElement("source",{src:f}))),o.ZP.createElement("div",{className:"progress",ref:i}),w&&o.ZP.createElement("div",{className:`media-loading ${b}`},o.ZP.createElement(Ns.Z,{progress:p})),!f&&!h&&o.ZP.createElement("i",{className:"icon-large-play"}),o.ZP.createElement("div",{className:"message-media-duration"},E?(0,O.k9)(c.current.currentTime):(0,O.k9)(l.duration),(!E||c.current.paused)&&o.ZP.createElement("i",{className:"icon-muted-chat"})))},rn=({message:e,onClick:t})=>{const s=(0,be.Z)();return o.ZP.createElement("div",{className:"InlineButtons"},e.inlineButtons.map((e=>o.ZP.createElement("div",{className:"row"},e.map((e=>o.ZP.createElement(ke.Z,{size:"tiny",ripple:!0,disabled:"NOT_SUPPORTED"===e.type,onClick:()=>t({button:e})},(0,Zt.Z)(s(e.text)),"buy"===e.type&&o.ZP.createElement("i",{className:"icon-card"}),"url"===e.type&&!e.value.match(a.FS)&&o.ZP.createElement("i",{className:"icon-arrow-right"}))))))))},cn=(0,o.X$)((0,n.c$)(((e,{message:t})=>{const{threadId:s,chatId:n}=t.threadInfo,a=(0,i.tZ)(e,n,s)||t.threadInfo,{byId:o}=e.users,{byId:r}=e.chats;return{threadInfo:a,usersById:o,chatsById:r}}),((e,t)=>(0,g.ei)(t,["openChat"])))((({disabled:e,threadInfo:t,usersById:s,chatsById:n,openChat:a})=>{const r=(0,be.Z)(),{threadId:i,chatId:c,messagesCount:l,lastMessageId:u,lastReadInboxMessageId:h,recentReplierIds:m}=t,g=(0,o.I4)((()=>{a({id:c,threadId:i})}),[a,c,i]);if(void 0===l)return;const f=m&&m.map((e=>(0,d.YA)(e)?s[e]:n[e])).filter(Boolean),p=Boolean(h&&u&&h<u);return o.ZP.createElement("div",{"data-cnt":(0,ft.bi)(l),className:(0,ce.Z)("CommentButton",p&&"has-unread",e&&"disabled"),dir:r.isRtl?"rtl":"ltr",onClick:g},o.ZP.createElement("i",{className:"icon-comments-sticker"}),(!f||0===f.length)&&o.ZP.createElement("i",{className:"icon-comments"}),f&&f.length>0&&o.ZP.createElement("div",{className:"recent-repliers",dir:r.isRtl?"rtl":"ltr"},f.map((e=>o.ZP.createElement(hs.Z,{key:e.id,size:"small",user:(0,d.YA)(e.id)?e:void 0,chat:(0,d.YA)(e.id)?void 0:e})))),o.ZP.createElement("div",{className:"label",dir:"auto"},l?r("Comments",l,"i"):r("LeaveAComment")),o.ZP.createElement("i",{className:"icon-next"}))}))),dn="data-is-document-group-hover";function ln(e){const t=hn(e.currentTarget);t&&t.setAttribute(dn,"")}function un(e){const t=hn(e.currentTarget);t&&t.removeAttribute(dn)}function hn(e){let t=e;do{t=t.nextElementSibling}while(t&&!t.classList.contains("last-in-document-group"));return t}const mn=(0,o.X$)((0,n.c$)(((e,t)=>{const{focusedMessage:s,forwardMessages:n,lastSyncTime:a}=e,{message:o,album:r,withSenderName:c,withAvatar:l,threadId:u,messageListType:h}=t,{id:m,chatId:g,viaBotId:f,replyToChatId:p,replyToMessageId:I,isOutgoing:v}=o,y=(0,i.Z1)(e,g),C=(0,i.FM)(e,g),Z=(0,d.pK)(g),P=y&&(0,d.eA)(y),w=null==y?void 0:y.username,b=!C&&(0,d.Ul)(o),M=c||l||b?(0,i.Ur)(e,o):void 0,S=(0,i.cv)(e,o),E=f?(0,i.dy)(e,f):void 0,k=u?(0,i.qS)(e,g,u):void 0,R=o.id===k,T=I===k,N=I&&!T?(0,i.hj)(e,Z&&p?p:g,I):void 0,B=N&&(0,i.Ur)(e,N),L=(0,i.uZ)(e,o),x="thread"===h&&(r?r.messages.some((t=>(0,i._X)(e,t))):(0,i._X)(e,o)),{direction:A,noHighlight:O,isResizingContainer:F}=x&&s||{},U=n.messageIds&&n.messageIds.includes(m),{query:Q}=(0,i.n5)(e)||{},$=(0,d._O)(o);let D;D=null!=r&&r.messages?r.messages.every((({id:t})=>(0,i.vk)(e,t))):(0,i.vk)(e,m);const{canReply:q}="thread"===h&&(0,i._k)(e,o,u)||{};return{theme:(0,i.Pu)(e),chatUsername:w,forceSenderName:b,sender:M,originSender:S,botSender:E,shouldHideReply:T,isThreadTop:R,replyMessage:N,replyMessageSender:B,isFocused:x,isForwarding:U,isChatWithSelf:C,isRepliesChat:Z,isChannel:P,canReply:q,lastSyncTime:a,highlight:Q,isSingleEmoji:Boolean($),animatedEmoji:$?(0,i.zB)(e,$):void 0,isInSelectMode:(0,i.CA)(e),isSelected:D,isGroupSelected:!!o.groupedId&&!o.isInAlbum&&(0,i.a6)(e,g,o.groupedId),threadId:u,isPinnedList:"pinned"===h,shouldAutoLoadMedia:y?(0,i.TD)(e,o,y,M):void 0,shouldAutoPlayMedia:(0,i.pv)(e,o),shouldLoopStickers:(0,i.yB)(e),...v&&{outgoingStatus:(0,i.dT)(e,o,"scheduled"===h)},..."number"==typeof L&&{uploadProgress:L},...x&&{focusDirection:A,noFocusHighlight:O,isResizingContainer:F}}}),((e,t)=>(0,g.ei)(t,["toggleMessageSelection","clickInlineButton","disableContextMenuHint"])))((({message:e,chatUsername:t,observeIntersectionForBottom:s,observeIntersectionForMedia:a,observeIntersectionForAnimatedStickers:r,album:i,noAvatars:c,withAvatar:l,withSenderName:g,noComments:f,appearanceOrder:p,isFirstInGroup:I,isLastInGroup:v,isFirstInDocumentGroup:y,isLastInDocumentGroup:C,isLastInList:Z,theme:P,forceSenderName:w,sender:b,originSender:M,botSender:S,isThreadTop:E,shouldHideReply:k,replyMessage:R,replyMessageSender:T,outgoingStatus:N,uploadProgress:B,isFocused:L,focusDirection:x,noFocusHighlight:A,isResizingContainer:O,isForwarding:F,isChatWithSelf:U,isRepliesChat:Q,isChannel:$,canReply:D,lastSyncTime:q,highlight:G,animatedEmoji:H,isInSelectMode:j,isSelected:_,isGroupSelected:V,threadId:W,messageListType:z,isPinnedList:Y,shouldAutoLoadMedia:K,shouldAutoPlayMedia:X,shouldLoopStickers:J,toggleMessageSelection:ee,clickInlineButton:te,disableContextMenuHint:se})=>{const ne=(0,o.sO)(null),ae=(0,o.sO)(null),oe=(0,o.sO)(null),re=(0,be.Z)();(0,Kt._N)(ae,s);const{isContextMenuOpen:ie,contextMenuPosition:de,handleBeforeContextMenu:ue,handleContextMenu:he,handleContextMenuClose:me,handleContextMenuHide:ge}=(0,es.Z)(ne,m.$b&&j,!0,m.wZ);(0,o.d4)((()=>{ie&&se()}),[ie,se]);const fe=p<=0,[pe,Ie]=(0,Ze.Z)(fe);(0,o.d4)((()=>{fe||setTimeout(Ie,10*p)}),[p,Ie,fe]);const{transitionClassNames:ve}=(0,le.Z)(pe,void 0,fe,!1),{id:ye,chatId:Ce,threadInfo:Pe}=e,we=(0,d.CI)(e),Me=(0,d.B4)(e),Se="scheduled"===z||e.isScheduled,Ee=(0,d.ss)(e)&&!k,Re=Boolean(Pe)&&"thread"===z,{forwardInfo:Te,viaBotId:Ne}=e,Be=Te&&!U&&!Q&&!Te.isLinkedChannelPost,Le=Boolean(e.groupedId)&&!e.isInAlbum,xe=Boolean(i)&&i.messages.length>1,{text:Ae,photo:Fe,video:Ue,audio:Qe,voice:$e,document:De,sticker:qe,contact:Ge,poll:He,webPage:je,invoice:_e}=(0,d.qp)(e),Ve=(0,d.$D)(e),We=(0,ts.X)(e,G,ss(Ve)),ze=void 0!==de,Ye=$&&e.adminTitle||Te&&!Be&&Te.adminTitle||void 0,Ke=(0,o.Ye)((()=>Ye?ls(Ye):void 0),[Ye]),Xe=!(ze||j||F)&&(!Le||C),Je=$&&!Se,et=Boolean(Y||Te&&(Te.isChannelPost||U&&!Me||Q)&&Te.fromMessageId),tt=Te&&(U||Q||!b)?M:b,st=Te?M:b,nt=(0,o.I4)(((e,t)=>{we||ee({messageId:ye,groupedId:t,...(null==e?void 0:e.shiftKey)&&{withShift:!0},...xe&&{childMessageIds:i.messages.map((({id:e})=>e))}})}),[we,ee,ye,xe,i]),{handleMouseDown:at,handleClick:ot,handleContextMenu:rt,handleDoubleClick:ct,handleContentDoubleClick:dt,isSwiped:lt}=function(e,t,s,a,r,i,c,d,l){const{setReplyingToId:u}=(0,n.uC)(),[h,g,f]=(0,Ze.Z)();return(0,o.d4)((()=>{if(!m.$b||i||!c)return;let e;return(0,Oe.s)(t.current,{selectorToPreventScroll:".MessageList",onSwipe:(t,s)=>s===Oe.e.Left&&(e||(e=Date.now()),g(),!0),onRelease:()=>{e&&(u({messageId:s}),setTimeout(f,Math.max(0,150-(Date.now()-e))),e=void 0)}})}),[t,i,s,u,g,f,c]),{handleMouseDown:i?void 0:function(e){(0,Wt.q)(e),a||l(e)},handleClick:function(t){if(i&&!a)e(t);else if(m.wZ){const e=t.target;if(!e.classList.contains("text-content")&&!e.classList.contains("Message"))return;it.Z.getIsKeyboardVisible()?setTimeout((()=>{d(t)}),350):d(t)}},handleContextMenu:i||a?void 0:function(t){if(m.wZ){if(t.target.matches("a[href]"))return;t.preventDefault(),e()}else d(t)},handleDoubleClick:i?void 0:function(){u({messageId:s})},handleContentDoubleClick:m.$b?void 0:function(e){e.stopPropagation()},isSwiped:h}}(nt,ne,ye,we,0,Boolean(j),Boolean(D),he,ue),{handleAvatarClick:ut,handleSenderClick:ht,handleViaBotClick:gt,handleReplyClick:ft,handleMediaClick:pt,handleAudioPlay:It,handleAlbumMediaClick:vt,handleMetaClick:yt,handleReadMedia:Pt,handleCancelUpload:wt,handleVoteSend:bt,handleGroupForward:Mt,handleForward:St,handleFocus:Et,handleFocusForwarded:kt,handleDocumentGroupSelectAll:Rt}=function(e,t,s,a,r,i,c,l,m,g,f,p){const{openUserInfo:I,openChat:v,showNotification:y,focusMessage:C,openMediaViewer:Z,openAudioPlayer:P,markMessagesRead:w,cancelSendingMessage:b,sendPollVote:M,openForwardMenu:S,focusMessageInComments:E}=(0,n.uC)(),{id:k,forwardInfo:R,replyToMessageId:T,replyToChatId:N,replyToTopMessageId:B,groupedId:L}=s,x=(0,o.I4)((()=>{g&&((0,d.YA)(g.id)?I({id:g.id}):v({id:g.id}))}),[g,I,v]),A=(0,o.I4)((()=>{f?(0,d.YA)(f.id)?I({id:f.id}):v({id:f.id}):y({message:e("HidAccount")})}),[f,y,e,I,v]),O=(0,o.I4)((()=>{p&&I({id:p.id})}),[p,I]),F=(0,o.I4)((()=>{C({chatId:l&&N?N:a,threadId:r,messageId:T,replyMessageId:l&&N?void 0:k})}),[C,l,N,a,r,T,k]),U=(0,o.I4)((()=>{Z({chatId:a,threadId:r,messageId:k,origin:c?h.bZ.ScheduledInline:h.bZ.Inline})}),[a,r,k,Z,c]),Q=(0,o.I4)((()=>{P({chatId:a,messageId:k,origin:h.Cr.Inline})}),[a,k,P]),$=(0,o.I4)((e=>{Z({chatId:a,threadId:r,messageId:e,origin:c?h.bZ.ScheduledAlbum:h.bZ.Album})}),[a,r,Z,c]),D=(0,o.I4)((()=>{w({messageIds:[k]})}),[k,w]),q=(0,o.I4)((()=>{b({chatId:a,messageId:k})}),[b,a,k]),G=(0,o.I4)((e=>{M({chatId:a,messageId:k,options:e})}),[a,k,M]),H=(0,o.I4)((()=>{S({fromChatId:a,groupedId:L})}),[S,a,L]),j=(0,o.I4)((()=>{if(m&&m.messages){const e=m.messages.map((({id:e})=>e));S({fromChatId:a,messageIds:e})}else S({fromChatId:a,messageIds:[k]})}),[m,S,a,k]),_=(0,o.I4)((()=>{C({chatId:a,threadId:u._f,messageId:k})}),[C,a,k]),V=(0,o.I4)((()=>{i?C({chatId:R.fromChatId,groupedId:L,groupedChatId:a}):l&&N?E({chatId:N,threadId:B,messageId:R.fromMessageId}):C({chatId:R.fromChatId,messageId:R.fromMessageId})}),[i,l,N,C,R,L,a,E,B]),W=(0,o.I4)((e=>{e.stopPropagation(),t(e,L)}),[t,L]);return{handleAvatarClick:x,handleSenderClick:A,handleViaBotClick:O,handleReplyClick:F,handleMediaClick:U,handleAudioPlay:Q,handleAlbumMediaClick:$,handleMetaClick:W,handleReadMedia:D,handleCancelUpload:q,handleVoteSend:G,handleGroupForward:H,handleForward:j,handleFocus:_,handleFocusForwarded:V,handleDocumentGroupSelectAll:W}}(re,nt,e,Ce,W,Le,Boolean(Se),Q,i,tt,st,S),Tt=(0,ce.Z)("Message message-list-item",I&&"first-in-group",v&&"last-in-group",y&&"first-in-document-group",C&&"last-in-document-group",Z&&"last-in-list",Me&&"own",Boolean(e.views)&&"has-views",e.isEdited&&"was-edited",Ee&&"has-reply",ze&&"has-menu-open",L&&!A&&"focused",F&&"is-forwarding",e.isDeleting&&"is-deleting",Le&&"is-in-document-group",xe&&"is-album",e.hasUnreadMention&&"has-unread-mention",_&&"is-selected",j&&"is-in-selection-mode",E&&"is-thread-top",Boolean(e.inlineButtons)&&"has-inline-buttons",lt&&"is-swiped",ve),Nt=function(e,{hasReply:t,customShape:s,isLastInGroup:n,asForwarded:a,hasThread:o,forceSenderName:r,hasComments:i,hasActionButton:c}={}){const{text:l,photo:u,video:h,audio:m,voice:g,document:f,poll:p,webPage:I,contact:v}=(0,d.qp)(e),y=["message-content"],C=u||h,Z=C&&!l,P=Boolean(e.viaBotId);return ss(s)?y.push(`emoji-only emoji-only-${s}`):l&&y.push("text"),c&&y.push("has-action-button"),s&&(y.push("custom-shape"),null!=h&&h.isRound&&y.push("round"),i&&y.push("has-comments")),u||h?y.push("media"):m?y.push("audio"):g?y.push("voice"):f?y.push("document"):v?y.push("contact"):p?y.push("poll"):I&&(y.push("web-page"),(I.photo||I.video)&&y.push("media")),a&&!s&&y.push("is-forwarded"),t&&y.push("is-reply"),o&&y.push("has-replies"),P&&y.push("is-via-bot"),r&&y.push("force-sender-name"),s||(y.push("has-shadow"),C&&i&&y.push("has-background"),(t||a||!Z||P||r)&&y.push("has-solid-background"),!n||!u&&Z||y.push("has-appendix")),y.join(" ")}(e,{hasReply:Ee,customShape:Ve,isLastInGroup:v,asForwarded:Be,hasThread:Re,forceSenderName:w,hasComments:e.threadInfo&&e.threadInfo.messagesCount>0,hasActionButton:Je||et}),Bt=e.threadInfo&&(!Le||C)&&"thread"===z&&!f,Lt=Nt.includes("has-appendix");(0,mt.Z)(Q&&e.replyToChatId?e.replyToChatId:Ce,Ee?e.replyToMessageId:void 0,R,e.id),us(ne,Ce,L,x,A,O),(0,o.bt)((()=>{oe.current&&(oe.current.innerHTML=Me?'<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>':'<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>')}),[Me,Lt]);let xt,At="",Ot=!1;const Ft=(0,o.Ye)((()=>xe?cs(Me,Boolean(Be),Boolean(c),i):void 0),[xe,Me,Be,c,i]),Ut=Be?28:0;if(xe||!Fe&&!Ue)Ft&&(xt=Math.max(ns(Boolean(Ae),Bt),Ft.containerStyle.width),xt-Ft.containerStyle.width>18&&(Ot=!0));else{let t;Fe?t=as(e,c).width:Ue&&(t=Ue.isRound?Ct.vw:as(e,c).width),t&&(xt=Math.max(ns(Boolean(Ae),Bt),t),xt-t>18&&(Ot=!0))}return xt&&(At=`width: ${xt+Ut}px`),o.ZP.createElement("div",{ref:ne,id:`message${ye}`,className:Tt,style:Ke?`--meta-safe-author-width: ${Ke}px`:void 0,"data-message-id":ye,onMouseDown:at,onClick:ot,onContextMenu:rt,onDoubleClick:ct,onMouseEnter:Le&&!C?ln:void 0,onMouseLeave:Le&&!C?un:void 0},o.ZP.createElement("div",{ref:ae,className:"bottom-marker","data-message-id":ye,"data-last-message-id":i?i.messages[i.messages.length-1].id:void 0,"data-has-unread-mention":e.hasUnreadMention}),!we&&!Le&&o.ZP.createElement("div",{className:"message-select-control"},_&&o.ZP.createElement("i",{className:"icon-select"})),!we&&C&&o.ZP.createElement("div",{className:(0,ce.Z)("message-select-control group-select",V&&"is-selected"),onClick:Rt},V&&o.ZP.createElement("i",{className:"icon-select"})),l&&function(){const e=tt&&(0,d.YA)(tt.id),t=tt&&e?tt:void 0,s=tt&&!e?tt:void 0,n=!tt&&Te?Te.hiddenUserName:void 0;return o.ZP.createElement(hs.Z,{size:"small",user:t,chat:s,text:n,lastSyncTime:q,onClick:t||s?ut:void 0})}(),o.ZP.createElement("div",{className:(0,ce.Z)("message-content-wrapper",Nt.includes("text")&&"can-select-text")},o.ZP.createElement("div",{className:Nt,style:At,dir:"auto"},Be&&!Ve&&(!Le||y)&&o.ZP.createElement("div",{className:"message-title"},re("ForwardedMessage")),function(){const t=(0,ce.Z)("content-inner",Be&&!Ve&&"forwarded-message",Ee&&"reply-message",Ot&&"no-media-corners"),s=v&&!We&&!Be&&!Re,n=!je&&!H&&We,l=(0,ce.Z)("text-content",n&&"with-meta",N&&"with-outgoing-icon");return o.ZP.createElement("div",{className:t,onDoubleClick:dt,dir:"auto"},function(){if(Ve&&!Ne||!(g&&!Fe&&!Ue||Be||Ne||w)||Le&&!y||Ee&&Ve)return;let t,s;return!st||Ve&&Ne?null!=Te&&Te.hiddenUserName&&(t=Te.hiddenUserName):(t=(0,d.OU)(re,st),Be||(s=`color-${(0,d.Rs)(st)}`)),o.ZP.createElement("div",{className:"message-title",dir:"ltr"},t?o.ZP.createElement("span",{className:(0,ce.Z)("interactive",s),onClick:ht,dir:"auto"},(0,Zt.Z)(t)):S?void 0:" ",S&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("span",{className:"via"},re("ViaBot")),o.ZP.createElement("span",{className:"interactive",onClick:gt},(0,Zt.Z)(`@${S.username}`))),null!=Te&&Te.isLinkedChannelPost?o.ZP.createElement("span",{className:"admin-title",dir:"auto"},re("DiscussChannel")):e.adminTitle&&!$?o.ZP.createElement("span",{className:"admin-title",dir:"auto"},e.adminTitle):void 0)}(),Ee&&o.ZP.createElement(ps,{message:R,sender:T,observeIntersection:a,onClick:ft}),qe&&o.ZP.createElement(bs,{message:e,observeIntersection:a,observeIntersectionForPlaying:r,shouldLoop:J,lastSyncTime:q}),H&&o.ZP.createElement(Ms.Z,{size:"small",sticker:H,observeIntersection:a,lastSyncTime:q,forceLoadPreview:we}),xe&&o.ZP.createElement(sn,{album:i,albumLayout:Ft,observeIntersection:a,shouldAutoLoad:K,shouldAutoPlay:X,isOwn:Me,hasCustomAppendix:s,lastSyncTime:q,onMediaClick:vt}),!xe&&Fe&&o.ZP.createElement(Bs,{message:e,observeIntersection:a,noAvatars:c,shouldAutoLoad:K,uploadProgress:B,shouldAffectAppendix:s,onClick:pt,onCancelUpload:wt,theme:P}),!xe&&Ue&&Ue.isRound&&o.ZP.createElement(on,{message:e,observeIntersection:a,shouldAutoLoad:K,shouldAutoPlay:X,lastSyncTime:q}),!xe&&Ue&&!Ue.isRound&&o.ZP.createElement(Qs,{message:e,observeIntersection:a,noAvatars:c,shouldAutoLoad:K,shouldAutoPlay:X,uploadProgress:B,lastSyncTime:q,onClick:pt,onCancelUpload:wt}),(Qe||$e)&&o.ZP.createElement(vs.Z,{theme:P,message:e,origin:h.Cr.Inline,uploadProgress:B,lastSyncTime:q,isSelectable:Le,isSelected:_,onPlay:It,onReadMedia:!$e||Me&&!U?void 0:Pt,onCancelUpload:wt}),De&&o.ZP.createElement(Is.Z,{message:e,observeIntersection:a,uploadProgress:B,isSelectable:Le,isSelected:_,onMediaClick:pt,onCancelUpload:wt}),Ge&&o.ZP.createElement(Ds,{contact:Ge}),He&&o.ZP.createElement(Vs,{message:e,poll:He,onSendVote:bt}),!H&&We&&o.ZP.createElement("p",{className:l,dir:"auto"},We,n&&o.ZP.createElement(Cs,{message:e,outgoingStatus:N,signature:Ye,onClick:yt})),je&&o.ZP.createElement(Ys,{message:e,observeIntersection:a,noAvatars:c,shouldAutoLoad:K,shouldAutoPlay:X,lastSyncTime:q,onMediaClick:pt,onCancelMediaTransfer:wt,theme:P}),_e&&o.ZP.createElement(Xs,{message:e}))}(),(!Le||C)&&!(!je&&!H&&We)&&o.ZP.createElement(Cs,{message:e,outgoingStatus:N,signature:Ye,onClick:yt}),Xe&&Je?o.ZP.createElement(ke.Z,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:re("lng_context_forward_msg"),onClick:C?Mt:St},o.ZP.createElement("i",{className:"icon-share-filled"})):Xe&&et?o.ZP.createElement(ke.Z,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:"Focus message",onClick:Y?Et:kt},o.ZP.createElement("i",{className:"icon-arrow-right"})):void 0,Bt&&o.ZP.createElement(cn,{message:e,disabled:f}),Lt&&o.ZP.createElement("div",{className:"svg-appendix",ref:oe})),e.inlineButtons&&o.ZP.createElement(rn,{message:e,onClick:te})),de&&o.ZP.createElement(gs,{isOpen:ie,anchor:de,message:e,album:i,chatUsername:t,messageListType:z,onClose:me,onCloseAnimationEnd:ge}))}))),gn=(0,o.X$)((({messageIds:e,messageGroups:t,isViewportNewest:s,isUnread:r,withUsers:i,noAvatars:c,containerRef:l,anchorIdRef:u,memoUnreadDividerBeforeIdRef:m,memoFirstUnreadIdRef:f,threadId:p,type:I,isActive:v,threadTopMessageId:y,hasLinkedChat:Z,isSchedule:P,noAppearanceAnimation:w,onFabToggle:b,onNotchToggle:M,openHistoryCalendar:S})=>{const{observeIntersectionForMedia:E,observeIntersectionForReading:k,observeIntersectionForAnimatedStickers:R}=function(e,t,s){const{markMessageListRead:a,markMessagesRead:o}=(0,n.uC)(),{observe:r}=(0,Kt.S1)({rootRef:t,throttleMs:Xt,margin:Jt}),{observe:i,freeze:c,unfreeze:d}=(0,Kt.S1)({rootRef:t,throttleMs:150,noAutoFreeze:!0},(t=>{if("thread"!==e)return;let n=0;const r=[];t.forEach((e=>{const{isIntersecting:t,target:s}=e;if(!t)return;const{dataset:a}=s,o=Number(a.lastMessageId||a.messageId);o>n&&(n=o),a.hasUnreadMention&&r.push(o)})),s.current&&n>=s.current&&a({maxId:n}),r.length&&o({messageIds:r})}));(0,ue.Z)(c,d);const{observe:l}=(0,Kt.S1)({rootRef:t,throttleMs:Xt});return{observeIntersectionForMedia:r,observeIntersectionForReading:i,observeIntersectionForAnimatedStickers:l}}(I,l,f),{backwardsTriggerRef:T,forwardsTriggerRef:N,fabTriggerRef:B}=function(e,t,s,r,i,c,d,l){const{loadViewportMessages:u}=(0,n.uC)(),[m,g]=(0,o.Ye)((()=>"thread"===e?[(0,C.Ds)((()=>u({direction:h.Uq.Backwards})),1e3,!0,!1),(0,C.Ds)((()=>u({direction:h.Uq.Forwards})),1e3,!0,!1)]:[]),[u,s]),f=(0,o.sO)(null),p=(0,o.sO)(null),I=(0,o.sO)(null);function v(){if(!l)return;if(!s||!s.length)return c(!1),void d(!1);if(!r)return c(!0),void d(!0);const{offsetHeight:e,scrollHeight:n,scrollTop:a}=t.current,o=Math.round(n-a-e),u=o<=0;c(i?!u:!(o<=50)),d(!u)}const{observe:y}=(0,Kt.S1)({rootRef:t,margin:a.gZ},(e=>{if(!g||!m)return;if(s[0]>=a.AE)return;const n=e.find((({isIntersecting:e})=>e));if(!n)return;const{target:o}=n;"backwards-trigger"===o.className?((0,zt.Z)(t.current),m()):"forwards-trigger"===o.className&&((0,zt.Z)(t.current),g())}));(0,Kt._N)(f,y),(0,Kt._N)(p,y);const{observe:Z,freeze:P,unfreeze:w}=(0,Kt.S1)({rootRef:t,margin:50},v);(0,Kt._N)(I,Z);const{observe:b,freeze:M,unfreeze:S}=(0,Kt.S1)({rootRef:t},v);return(0,Kt._N)(I,b),(0,me.Z)((()=>{P(),M(),setTimeout((()=>{S(),w()}),100)}),[s]),{backwardsTriggerRef:f,forwardsTriggerRef:p,fabTriggerRef:I}}(I,l,e,s,r,b,M,v),L=(0,be.Z)(),x=o.ZP.createElement("div",{className:(0,ce.Z)("unread-divider","local-action-message"),key:"unread-messages"},o.ZP.createElement("span",null,L("UnreadMessages"))),A=w?0:t.reduce(((e,t)=>e+(0,g.xH)(t.senderGroups).length),0);let F=0;const U=t.map(((e,t,s)=>{const n=e.senderGroups.map(((e,n,a)=>{if(1===e.length&&!_t(e[0])&&(0,d.Lo)(e[0])){const r=e[0],i=n===a.length-1&&t===s.length-1;return(0,g.oA)([r.id===m.current&&x,o.ZP.createElement(fs,{key:r.id,message:r,observeIntersection:k,appearanceOrder:A-++F,isLastInList:i})])}let r;return(0,g.xH)(e.map(((l,h)=>{const f=_t(l)?l.mainMessage:l,v=_t(l)?l:void 0,C=(0,d.B4)(f),P=_t(l),w=e[h+1];f.previousLocalId&&u.current===`message${f.previousLocalId}`&&(u.current=`message${f.id}`);const b=!P&&f.groupedId?f.groupedId:void 0,M=w&&!_t(w)?w.groupedId:void 0,S={isFirstInGroup:0===h,isLastInGroup:h===e.length-1,isFirstInDocumentGroup:Boolean(b&&b!==r),isLastInDocumentGroup:Boolean(b&&b!==M),isLastInList:h===e.length-1&&n===a.length-1&&t===s.length-1};r=b;const T=(0,d.KK)(f),N="scheduled"!==I?T:`${f.date}_${T}`;return(0,g.oA)([f.id===m.current&&x,o.ZP.createElement(mn,{key:N,message:f,observeIntersectionForBottom:k,observeIntersectionForMedia:E,observeIntersectionForAnimatedStickers:R,album:v,noAvatars:c,withAvatar:S.isLastInGroup&&i&&!C&&!(f.id===y),withSenderName:S.isFirstInGroup&&i&&!C,threadId:p,messageListType:I,noComments:!1===Z,appearanceOrder:A-++F,isFirstInGroup:S.isFirstInGroup,isLastInGroup:S.isLastInGroup,isFirstInDocumentGroup:S.isFirstInDocumentGroup,isLastInDocumentGroup:S.isLastInDocumentGroup,isLastInList:S.isLastInList}),f.id===y&&o.ZP.createElement("div",{className:"local-action-message",key:"discussion-started"},o.ZP.createElement("span",null,L("DiscussionStarted")))])})))}));return o.ZP.createElement("div",{className:"message-date-group",key:e.datetime,onMouseDown:Wt.q,teactFastList:!0},o.ZP.createElement("div",{className:(0,ce.Z)("sticky-date",!P&&"interactive"),key:"date-header",onMouseDown:Wt.q,onClick:P?void 0:()=>S({selectedAt:e.datetime})},o.ZP.createElement("span",{dir:"auto"},P&&e.originalDate===a.t4&&L("MessageScheduledUntilOnline"),P&&e.originalDate!==a.t4&&L("MessageScheduledOn",(0,O.j1)(L,e.datetime,void 0,!0)),!P&&(0,O.j1)(L,e.datetime))),(0,g.xH)(n))}));return o.ZP.createElement("div",{className:"messages-container",teactFastList:!0},o.ZP.createElement("div",{ref:T,key:"backwards-trigger",className:"backwards-trigger"}),(0,g.xH)(U),o.ZP.createElement("div",{ref:N,key:"forwards-trigger",className:"forwards-trigger"}),o.ZP.createElement("div",{ref:B,key:"fab-trigger",className:"fab-trigger"}))}));var fn=s(3547);const pn=(0,o.X$)((0,n.c$)(((e,{userId:t})=>{const{stickers:s}=e.stickers.greeting,n=null!=s&&s.length?s[t%s.length]:void 0,a=(0,i.Z1)(e,t);return a?{sticker:n,lastUnreadMessageId:a.lastMessage&&a.lastMessage.id!==a.lastReadInboxMessageId?a.lastMessage.id:void 0,connectionState:e.connectionState}:{}}),((e,t)=>(0,g.ei)(t,["loadGreetingStickers","sendMessage","markMessageListRead"])))((({sticker:e,connectionState:t,lastUnreadMessageId:s,loadGreetingStickers:n,sendMessage:a,markMessageListRead:r})=>{const i=(0,be.Z)(),c=(0,o.sO)(null),{observe:d}=(0,Kt.S1)({rootRef:c,debounceMs:200});(0,o.d4)((()=>{e||"connectionStateReady"!==t||n()}),[t,n,e]),(0,o.d4)((()=>{"connectionStateReady"===t&&s&&r({maxId:s})}),[t,r,s]);const l=(0,o.I4)((e=>{e={...e,isPreloadedGlobally:!0},a({sticker:e})}),[a]);return o.ZP.createElement("div",{className:"ContactGreeting",ref:c},o.ZP.createElement("div",{className:"wrapper"},o.ZP.createElement("p",{className:"title",dir:"auto"},i("Conversation.EmptyPlaceholder")),o.ZP.createElement("p",{className:"description",dir:"auto"},i("Conversation.GreetingText")),o.ZP.createElement("div",{className:"sticker"},e&&o.ZP.createElement(fn.Z,{sticker:e,onClick:l,clickArg:e,observeIntersection:d,size:160,className:"large"}))))}))),In=(0,o.X$)((({isChatWithSelf:e,type:t,isGroupChatJustCreated:s})=>{const n=(0,be.Z)();return"scheduled"===t?function(e){return o.ZP.createElement("div",{className:"empty"},o.ZP.createElement("span",null,e("ScheduledMessages.EmptyPlaceholder")))}(n):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")))))}(n):s?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")))))}(n):o.ZP.createElement("div",{className:"empty"},o.ZP.createElement("span",null,n("NoMessages")))})),vn=(0,C.Ds)((e=>e()),200,!1),yn=(0,o.X$)((0,n.c$)(((e,{chatId:t,threadId:s,type:n})=>{const a=(0,i.Z1)(e,t);if(!a)return{};const o=(0,i.$W)(e,t,s,n),r="scheduled"===n?(0,i.Fn)(e,t):(0,i.Zw)(e,t),c=(0,i.qS)(e,t,s);if(s!==u._f&&!(r&&c&&r[c]))return{};const{isRestricted:l,restrictionReason:h,lastMessage:m}=a,g=(0,i.G$)(e,t),f=s===u._f&&!o&&!a.unreadCount&&!g&&m&&!m.groupedId,p=(0,i.IK)(e,t);let I;return(0,i.pk)(e,t)&&(I=p.fullInfo?p.fullInfo.botDescription||"NoMessages":"Updating bot info..."),{isChatLoaded:!0,isRestricted:l,restrictionReason:h,isChannelChat:(0,d.eA)(a),isGroupChat:(0,d.Bf)(a),isCreator:a.isCreator,isChatWithSelf:(0,i.FM)(e,t),isRepliesChat:(0,d.pK)(t),isBot:Boolean(p),messageIds:o,messagesById:r,firstUnreadId:(0,i.It)(e,t,s),isViewportNewest:"thread"!==n||(0,i.b9)(e,t,s),threadFirstMessageId:(0,i.yZ)(e,t,s),focusingId:g,isSelectModeActive:(0,i.CA)(e),botDescription:I,threadTopMessageId:c,hasLinkedChat:a.fullInfo&&"linkedChatId"in a.fullInfo?Boolean(a.fullInfo.linkedChatId):void 0,...f&&{lastMessage:m}}}),((e,t)=>(0,g.ei)(t,["loadViewportMessages","setScrollOffset","openHistoryCalendar"])))((({chatId:e,threadId:t,type:s,hasTools:r,onFabToggle:c,onNotchToggle:l,isChatLoaded:u,isChannelChat:m,isGroupChat:f,canPost:p,isReady:I,isActive:v,isChatWithSelf:y,isRepliesChat:Z,isCreator:P,isBot:w,messageIds:b,messagesById:M,firstUnreadId:S,isViewportNewest:E,threadFirstMessageId:k,isRestricted:R,restrictionReason:T,focusingId:N,isSelectModeActive:B,loadViewportMessages:L,setScrollOffset:x,lastMessage:A,botDescription:O,threadTopMessageId:F,hasLinkedChat:U,openHistoryCalendar:Q})=>{var $,D,q,G,H,j;const _=(0,o.sO)(null),V=(0,o.sO)("thread"===s&&(0,i.Vt)((0,n.Rd)(),e,t)||0),W=(0,o.sO)(),z=(0,o.sO)(),Y=(0,o.sO)(),K=(0,o.sO)(),X=(0,o.sO)(),J=(0,o.sO)(),ee=(0,o.sO)(!1),te=(0,o.sO)(Boolean(A)),[se,ne]=(0,o.eJ)(),ae=Boolean(b);(0,me.Z)((()=>{ae&&(0,C.R3)((()=>{te.current=!1}))}),[ae]),(0,me.Z)((()=>{K.current=S}),[S]),(0,me.Z)((()=>{ae&&(X.current=K.current)}),[ae]),(0,me.Z)((()=>{J.current=N}),[N]);const oe=(0,o.Ye)((()=>{if(!b||!M)return;const e=!F||b[0]&&k!==b[0]?b:[F,...b];if(!e.length)return;const t=e.map((e=>M[e])).filter(Boolean);return Vt((0,g.Xo)(t,["date","id"]),X.current)}),[b,M,k,F]),re=(0,o.Ye)((()=>{if("thread"===s)return(0,C.Ds)((()=>L({direction:h.Uq.Around})),1e3,!0,!1)}),[L,b]),{isScrolled:de,updateStickyDates:le}=function(){const[e,t]=(0,Ze.Z)(!1),s=(0,o.Ye)((()=>(0,C.Ds)((e=>e()),1e3,!1,n)),[1e3,!1,n]);var n;return{isScrolled:e,updateStickyDates:(0,o.I4)(((e,n)=>{t(),document.body.classList.contains("is-scrolling-messages")||(0,C.T2)((()=>{document.body.classList.add("is-scrolling-messages")})),s((()=>{(0,C.T2)((()=>{const t=document.querySelector(".stuck");t&&t.classList.remove("stuck");const s=function(e,t){const s=e.querySelectorAll(".sticky-date"),n=e.scrollTop;return Array.from(s).find((e=>{const{offsetTop:s,offsetHeight:a}=e,o=s-n;return-a<=o&&o<=(t?60:10)}))}(e,n);s&&s.classList.add("stuck"),document.body.classList.remove("is-scrolling-messages")}))}))}),[t,s])}}(),ue=(0,o.I4)((()=>{if(ee.current)return void(ee.current=!1);const n=_.current;J.current||le(n,r),vn((()=>{(0,C.T2)((()=>{n.parentElement&&(V.current=n.scrollHeight-n.scrollTop,"thread"===s&&x({chatId:e,threadId:t,scrollOffset:V.current}))}))}))}),[le,r,s,x,e,t]);(0,o.d4)((()=>{if(!("ResizeObserver"in window))return;const e=new ResizeObserver((([e])=>{e.target.offsetParent&&ne(e.contentRect.height)}));return e.observe(_.current),()=>{e.disconnect()}}),[]);const{height:he}=ct();(0,o.d4)((()=>{I&&(_.current.dataset.normalHeight=String(_.current.offsetHeight))}),[he,I,p]),(0,o.d4)((()=>{if(!re||!u||R||N)return;if(b&&b[0]>=a.AE)return;const e=_.current;(!b||b.length<a.hT/2&&e.firstElementChild.clientHeight<=e.offsetHeight)&&re()}),[u,b,re,N,R]),(0,me.Z)((()=>{if(!b||!Y.current||!I)return;const e=Y.current.filter((e=>b.includes(Number(e.dataset.messageId)))),t=e[1]||e[0];t&&(W.current=t.id,z.current=t.getBoundingClientRect().top)}),[b,E,se,r,I]),(0,Ht.Z)((([e,t,s])=>{const n=_.current;if(Y.current=Array.from(n.querySelectorAll(".message-list-item")),!n.offsetParent)return;const o=E&&b&&b.length<a.hT/2&&!n.parentElement.classList.contains("force-messages-scroll")&&n.firstElementChild.clientHeight<=2*n.offsetHeight;o&&(n.parentElement.classList.add("force-messages-scroll"),setTimeout((()=>{n.parentElement&&n.parentElement.classList.remove("force-messages-scroll")}),1e3));const i=b&&e&&b[b.length-1]!==e[e.length-1],c=(null==b?void 0:b[0])!==(null==e?void 0:e[0])&&(null==b?void 0:b.length)===a.hT/2+1,d=i&&!c,l=b&&J.current===b[b.length-1],{scrollTop:u,scrollHeight:h,offsetHeight:m}=n,g=V.current,f=Y.current[Y.current.length-1];let p=g-(s||m);d&&(p-=f?f.offsetHeight:0);const I=E&&t&&p<=20;let v;if(d&&I&&!l&&(f&&(0,C.T2)((()=>{(0,Yt.Z)(n,f,"end",20)})),v=h-m,V.current=Math.max(Math.ceil(h-v),m),!o))return;const y=void 0!==s&&s!==se,Z=W.current&&n.querySelector(`#${W.current}`),P=!Z&&X.current&&n.querySelector(".unread-divider");if(I&&y){if((0,Yt.N)())return;v=h-m}else v=Z?u+(Z.getBoundingClientRect().top-(z.current||0)):P?Math.min(P.offsetTop-(r?60:10),h-g):h-g;(0,zt.Z)(n,Math.ceil(v)),J.current||(ee.current=!0,(0,C.T2)((()=>{ee.current=!1}))),V.current=Math.max(Math.ceil(h-v),m)}),[b,E,se,r]),(0,jt.Z)((([e])=>{void 0!==e&&(0,ie.YW)(200+a.fK)}),[B]);const ge=(0,be.Z)(),fe=Boolean(e&&(0,d.YA)(e)),pe=Boolean(!fe&&!m||y||Z),Ie=Boolean(!pe||m),ve=(0,d.YA)(e)&&!y&&!w&&(!oe&&!A&&b&&(!Y.current||0===Y.current.length)||1===(null==b?void 0:b.length)&&"contactSignUp"===(null==M||null===($=M[b[0]])||void 0===$||null===(D=$.content.action)||void 0===D?void 0:D.type)||"contactSignUp"===(null==A||null===(q=A.content)||void 0===q||null===(G=q.action)||void 0===G?void 0:G.type)),ye=f&&P&&1===(null==b?void 0:b.length)&&"chatCreate"===(null==M||null===(H=M[b[0]])||void 0===H||null===(j=H.content.action)||void 0===j?void 0:j.type),Ce=(0,ce.Z)("MessageList custom-scroll",Ie&&"no-avatars",!p&&"no-composer","pinned"===s&&"type-pinned",B&&"select-mode-active",de&&"scrolled",!I&&"is-animating");return o.ZP.createElement("div",{ref:_,className:Ce,onScroll:ue,onMouseDown:Wt.q},R?o.ZP.createElement("div",{className:"empty"},o.ZP.createElement("span",null,T?T.text:"This is a private "+(m?"channel":"chat"))):O?o.ZP.createElement("div",{className:"empty"},o.ZP.createElement("span",null,(0,Zt.Z)(ge(O),["br","emoji","links"]))):ve?o.ZP.createElement(pn,{userId:e}):!b||oe&&!ye?b&&oe||A?o.ZP.createElement(gn,{messageIds:b||[A.id],messageGroups:oe||Vt([A]),isViewportNewest:Boolean(E),isUnread:Boolean(S),withUsers:pe,noAvatars:Ie,containerRef:_,anchorIdRef:W,memoUnreadDividerBeforeIdRef:X,memoFirstUnreadIdRef:K,threadId:t,type:s,isActive:v,threadTopMessageId:F,hasLinkedChat:U,isSchedule:!!oe&&"scheduled"===s,noAppearanceAnimation:!oe||!te.current,onFabToggle:c,onNotchToggle:l,openHistoryCalendar:Q}):o.ZP.createElement(qe.Z,{color:"white"}):o.ZP.createElement(In,{chatId:e,type:s,isChatWithSelf:y,isGroupChatJustCreated:ye}))}))),Cn=(0,o.X$)((0,n.c$)((e=>{const t=(0,i.Bt)(e);if(!t)return{};const{chatId:s,threadId:n,type:a}=t,o=(0,i.Z1)(e,s);return{messageListType:a,unreadCount:o&&n===u._f&&"thread"===a?o.unreadCount:void 0}}),((e,t)=>(0,g.ei)(t,["focusNextReply"])))((({isShown:e,canPost:t,messageListType:s,unreadCount:n,withExtraShift:a,focusNextReply:r})=>{const i=(0,be.Z)(),c=(0,o.sO)(null),d=(0,o.I4)((()=>{if(e)if("thread"===s)r();else{const e=c.current.parentElement.querySelector(".MessageList"),t=e.querySelectorAll(".message-list-item"),s=t[t.length-1];if(!s)return;(0,Yt.Z)(e,s,"end",20)}}),[e,s,r]),l=(0,ce.Z)("ScrollDownButton",e&&"revealed",!t&&"no-composer",a&&"with-extra-shift");return o.ZP.createElement("div",{ref:c,className:l},o.ZP.createElement("div",{className:"ScrollDownButton-inner"},o.ZP.createElement(ke.Z,{color:"secondary",round:!0,onClick:d,ariaLabel:i("AccDescrPageDown")},o.ZP.createElement("i",{className:"icon-arrow-down"})),Boolean(n)&&o.ZP.createElement("div",{className:"unread-count"},(0,ft.bi)(n))))})));var Zn=s(5723),Pn=s(6980);const wn=1280;async function bn(e,t,s,n){const o=URL.createObjectURL(t),{type:r,size:i}=t;let c,d;if(a.oG.has(r))if(s){const t=await(0,rt.pt)(o),{width:s,height:a}=t;if(s>wn||a>wn||"image/jpeg"!==r){const t=await xt(o,wn/Math.max(s,a),"image/jpeg");return URL.revokeObjectURL(o),bn(e,await(0,rt.gm)(t),!0,n)}c={width:s,height:a}}else d=o;else if(a.wG.has(r)){const{videoWidth:e,videoHeight:t,duration:s}=await(0,rt.jj)(o);c={width:e,height:t,duration:s},d=await(0,rt.ud)(o)}return{blobUrl:o,filename:e,mimeType:r,size:i,quick:c,previewBlobUrl:d,...n}}var Mn=s(6391);let Sn;function En(e){Sn.focus(),e.focus()}m.cj&&(Sn=document.createElement("input"),Sn.classList.add("for-ios-autocapitalization-fix"),document.body.appendChild(Sn));const kn={encoderPath:s.p+"c0155344d336103c2b6a0b28cc510750.js",reuseWorker:!0},Rn={type:"audio/ogg"};let Tn,Nn,Bn;async function Ln(){return Tn||(Tn=s.e(161).then(s.t.bind(s,1161,23)),Nn=(await Tn).default,Bn=new Nn(kn)),Tn}async function xn(e){await async function(){await Ln(),await Bn.start()}();const t=Date.now();let s;const n=[],a=[];Bn.ondataavailable=e=>{n.push(e)};const o=function(t,s){const n=t.sourceNode,o=n.context.createAnalyser();o.fftSize=64,n.connect(o);const r=o.frequencyBinCount,i=new Uint8Array(r);let c=!1;return function t(){if(c)return;o.getByteFrequencyData(i);const s=i.reduce(((e,t)=>e+t),0)/r/255;(t=>{a.push(255*t),e(t)})(s<.1?0:s),requestAnimationFrame(t)}(),()=>{c=!0}}(Bn);return{stop:()=>new Promise(((e,r)=>{Bn.onstop=()=>{e({blob:new Blob(n,Rn),duration:Math.round(((s||Date.now())-t)/1e3),waveform:a})},Bn.onerror=r;const i=Math.max(0,t+1e3-Date.now());setTimeout((()=>{Bn.stop(),o()}),i)})),pause:()=>{const e=Math.max(0,t+1e3-Date.now());setTimeout((()=>{Bn.pause(),s=Date.now(),o()}),e)}}}const An=["image/png","image/jpeg","image/gif"];function On(e){const{text:t,entities:s}=e||{};if(!t)return"";const n=(0,ts.H)(t,s,void 0,void 0,!0);return Array.isArray(n)?n.join(""):n}let Fn,Un;var Qn=s(4784),$n=s(2400),Dn=s(8353),qn=s(2365);const Gn=document.createElement("div"),Hn=/^@([a-z0-9_]{1,32})[\u00A0\u0020]+(.*)/i,jn=/^@([a-z0-9_]{1,32})[\u00A0\u0020]+\n{2,}/i;const _n=(0,C.P2)((e=>e()),500,!0),Vn=/^[\w@]{1,32}\s?/i,Wn=(0,o.X$)((e=>{const{isOpen:t}=e,s=(0,De.Z)($e.gl.Extra,"DeleteMessageModal",!t);return s?o.ZP.createElement(s,e):void 0}));function zn(){return(zn=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n])}return e}).apply(this,arguments)}let Yn,Kn=!0;const Xn=(0,o.X$)((({onActivate:e,...t})=>{const s=(0,o.sO)(!1),n=(0,o.I4)((()=>{if(s.current=!0,Kn)return Kn=!1,void e();Yn&&(clearTimeout(Yn),Yn=void 0),Yn=window.setTimeout((()=>{s.current&&e()}),200)}),[e]),a=(0,o.I4)((()=>{s.current=!1}),[]);return o.ZP.createElement(ke.Z,zn({},t,{onMouseEnter:m.$b?void 0:n,onMouseLeave:m.$b?void 0:a,onClick:m.$b?e:void 0}))})),Jn=(0,o.X$)((e=>{const{isOpen:t}=e,s=(0,De.Z)($e.gl.Extra,"AttachMenu",!t);return s?o.ZP.createElement(s,e):void 0})),ea=(0,o.X$)((e=>{const{isOpen:t}=e,s=(0,De.Z)($e.gl.Extra,"SymbolMenu",!t);return s?o.ZP.createElement(s,e):void 0})),ta=(0,o.X$)((e=>{const{isOpen:t}=e,s=(0,De.Z)($e.gl.Extra,"InlineBotTooltip",!t);return s?o.ZP.createElement(s,e):void 0})),sa=(0,o.X$)((e=>{const{isOpen:t}=e,s=(0,De.Z)($e.gl.Extra,"MentionTooltip",!t);return s?o.ZP.createElement(s,e):void 0})),na=(0,o.X$)((e=>{const{isOpen:t}=e,s=(0,De.Z)($e.gl.Extra,"CustomSendMenu",!t);return s?o.ZP.createElement(s,e):void 0})),aa=e=>{const{isOpen:t}=e,s=(0,De.Z)($e.gl.Extra,"StickerTooltip",!t);return s?o.ZP.createElement(s,e):void 0};var oa=s(9830);const ra=(0,o.X$)((e=>{const{isOpen:t}=e,s=(0,De.Z)($e.gl.Extra,"BotCommandTooltip",!t);return s?o.ZP.createElement(s,e):void 0}));var ia=s(6503);const ca=(0,o.X$)((0,n.c$)(((e,{messageId:t})=>{const{chatId:s}=(0,i.Bt)(e)||{};return s?{message:(0,i.hj)(e,s,t)}:{}}),((e,t)=>(0,g.ei)(t,["clickInlineButton"])))((({isOpen:e,message:t,onClose:s,clickInlineButton:n})=>{const[a,r]=(0,ia.Z)(e,s),{isKeyboardSingleUse:i}=t||{},[c,d,l]=(0,Ze.Z)(!0),u=()=>{l(),s()};if((0,o.d4)((()=>{d()}),[d,t]),t&&t.keyboardButtons)return o.ZP.createElement(je.Z,{isOpen:e||c,autoClose:i,positionX:"right",positionY:"bottom",onClose:u,className:"BotKeyboardMenu",onCloseAnimationEnd:u,onMouseEnter:m.$b?void 0:a,onMouseLeave:m.$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(ke.Z,{ripple:!0,disabled:"NOT_SUPPORTED"===e.type,onClick:()=>n({button:e})},e.text))))))))})));var da=s(3616),la=s(7891);const ua=(0,o.X$)((0,n.c$)((e=>{const{chatId:t,threadId:s,type:n}=(0,i.Bt)(e)||{};if(!t||!s||!n)return{};const{currentUserId:a,forwardMessages:{fromChatId:o,toChatId:r,messageIds:c}}=e,l=(0,i.Yy)(e,t,s),u="scheduled"===n?(0,i.wU)(e,t):(0,i._$)(e,t,s),h=e.settings.byKey.animationLevel>=1,m=r===t;let g,f;if(l?g=(0,i.hj)(e,t,l):u?g=(0,i.kK)(e,t,s,n):m&&1===c.length&&(g=(0,i.hj)(e,o,c[0])),l&&g){const{forwardInfo:s}=g,n=t===a;s&&(s.isChannelPost||n)&&(f=(0,i.cv)(e,g)),f||(f=(0,i.Ur)(e,g))}else m&&(f=(0,d.YA)(o)?(0,i.dy)(e,o):(0,i.Z1)(e,o));return{replyingToId:l,editingId:u,message:g,sender:f,shouldAnimate:h,forwardedMessagesCount:m?c.length:void 0}}),((e,t)=>(0,g.ei)(t,["setReplyingToId","setEditingId","focusMessage","exitForwardMode"])))((({replyingToId:e,editingId:t,message:s,sender:n,shouldAnimate:a,forwardedMessagesCount:r,setReplyingToId:i,setEditingId:c,focusMessage:d,exitForwardMode:l})=>{const u=Boolean((e||t)&&s||n&&r),h=(0,la.Z)([r],r?300:void 0),{shouldRender:m,transitionClassNames:g}=(0,le.Z)(h&&u,void 0,!a,void 0,!a),f=(0,o.I4)((()=>{e?i({messageId:void 0}):t?c({messageId:void 0}):r&&l()}),[e,t,r,i,c,l]);(0,o.d4)((()=>u?(0,ye.Z)(f):void 0),[u,f]);const p=(0,o.I4)((()=>{d({chatId:s.chatId,messageId:s.id})}),[d,s]),I=(0,ce.Z)("ComposerEmbeddedMessage",g),v=r&&r>1?`${r} forwarded messages`:void 0;if(m)return o.ZP.createElement("div",{className:I},o.ZP.createElement("div",null,o.ZP.createElement(ke.Z,{round:!0,faded:!0,color:"translucent",ariaLabel:"Cancel replying",onClick:f},o.ZP.createElement("i",{className:"icon-close"})),o.ZP.createElement(ps,{className:"inside-input",message:s,sender:n,customText:v,title:t?"Edit Message":void 0,onClick:p})))}))),ha=(0,o.X$)((e=>{const{attachments:t}=e,s=(0,De.Z)($e.gl.Extra,"AttachmentModal",!t.length);return s?o.ZP.createElement(s,e):void 0})),ma=(0,o.X$)((e=>{const{isOpen:t}=e,s=(0,De.Z)($e.gl.Extra,"BotCommandMenu",!t);return s?o.ZP.createElement(s,e):void 0})),ga=(0,o.X$)((e=>{const{isOpen:t}=e,s=(0,De.Z)($e.gl.Extra,"PollModal",!t);return s?o.ZP.createElement(s,e):void 0})),fa=(0,o.X$)((e=>{const{isOpen:t}=e,s=(0,De.Z)($e.gl.Extra,"DropArea",!t);return s?o.ZP.createElement(s,e):void 0})),pa=new RegExp(a.FM,"i"),Ia=(0,o.X$)((0,n.c$)(((e,{chatId:t,threadId:s})=>{const n=(0,i.tV)(e,t,s);return{theme:(0,i.Pu)(e),webPagePreview:e.webPagePreview,noWebPage:n}}),((e,t)=>(0,g.ei)(t,["loadWebPagePreview","clearWebPagePreview","toggleMessageWebPage"])))((({chatId:e,threadId:t,messageText:s,disabled:n,webPagePreview:a,noWebPage:r,theme:i,loadWebPagePreview:c,clearWebPagePreview:d,toggleMessageWebPage:l})=>{const h=(0,o.Ye)((()=>{const{text:e,entities:t}=(0,Pn.Z)(s),n=t&&t.find((({type:e})=>e===u.Vv.TextUrl));if(n)return n.url;const a=e.match(pa);return a?a[0]:void 0}),[s]);(0,o.d4)((()=>{h?c({text:h}):(d(),l({chatId:e,threadId:t}))}),[e,l,d,h,c,t]),(0,me.Z)((()=>{d(),l({chatId:e,threadId:t})}),[e]);const m=Boolean(a&&s.length&&!r&&!n),{shouldRender:g,transitionClassNames:f}=(0,le.Z)(m),p=(0,gt.Z)(a,!0);if(!g||!p)return;const{photo:I,...v}=p,y={content:{webPage:v}};return o.ZP.createElement("div",{className:(0,ce.Z)("WebPagePreview",f)},o.ZP.createElement("div",null,o.ZP.createElement(ke.Z,{round:!0,faded:!0,color:"translucent",ariaLabel:"Clear Webpage Preview",onClick:()=>{l({chatId:e,threadId:t,noWebPage:!0})}},o.ZP.createElement("i",{className:"icon-close"})),o.ZP.createElement(Ys,{message:y,inPreview:!0,theme:i})))})));var va=s(2898);const ya=(0,o.X$)((e=>{const{isOpen:t}=e,s=(0,De.Z)($e.gl.Extra,"CalendarModal",!t);return s?o.ZP.createElement(s,e):void 0}));var Ca;!function(e){e.Send="send",e.Record="record",e.Edit="edit"}(Ca||(Ca={}));const Za=(0,o.X$)((0,n.c$)(((e,{chatId:t,threadId:s,messageListType:n})=>{var o,r;const c=(0,i.Z1)(e,t),l=c&&(0,i.Dg)(e,c),h=t!==a.FV?(0,i.IK)(e,t):void 0,m=Boolean(h),g=(0,i.FM)(e,t),f=m&&(0,i.FT)(e,t),p=(0,i.qy)(e,t),{language:I}=e.settings.byKey,v=e.emojiKeywords[a.pR],y=I!==a.pR?e.emojiKeywords[I]:void 0,C=f?f.id:void 0,Z=C?(0,i.hj)(e,t,C):void 0;return{editingMessage:(0,i.kK)(e,t,s,n),connectionState:e.connectionState,draft:(0,i.Ms)(e,t,s),chat:c,isChatWithBot:m,isChatWithSelf:g,canScheduleUntilOnline:!g&&!m&&c&&l&&(0,d.YA)(t)&&l.status&&Boolean(l.status.wasOnline),isRightColumnShown:(0,i.Jf)(e),isSelectModeActive:(0,i.CA)(e),withScheduledButton:s===u._f&&"thread"===n&&Boolean(null==p?void 0:p.length),shouldSchedule:"scheduled"===n,botKeyboardMessageId:C,botKeyboardPlaceholder:null==Z?void 0:Z.keyboardPlaceholder,isForwarding:t===e.forwardMessages.toChatId,isPollModalOpen:e.isPollModalOpen,stickersForEmoji:e.stickers.forEmoji.stickers,groupChatMembers:null==c||null===(o=c.fullInfo)||void 0===o?void 0:o.members,topInlineBotIds:null===(r=e.topInlineBots)||void 0===r?void 0:r.userIds,currentUserId:e.currentUserId,usersById:e.users.byId,lastSyncTime:e.lastSyncTime,contentToBeScheduled:e.messages.contentToBeScheduled,shouldSuggestStickers:e.settings.byKey.shouldSuggestStickers,recentEmojis:e.recentEmojis,baseEmojiKeywords:null==v?void 0:v.keywords,emojiKeywords:null==y?void 0:y.keywords,serverTimeOffset:e.serverTimeOffset,inlineBots:e.inlineBots.byUsername,isInlineBotLoading:e.inlineBots.isLoading,chatBotCommands:c&&c.fullInfo&&c.fullInfo.botCommands,botCommands:h&&h.fullInfo?h.fullInfo.botCommands||!1:void 0}}),((e,t)=>(0,g.ei)(t,["sendMessage","editMessage","saveDraft","clearDraft","showDialog","setStickerSearchQuery","setGifSearchQuery","forwardMessages","openPollModal","closePollModal","loadScheduledHistory","openChat","addRecentEmoji","sendInlineBotResult"])))((({dropAreaState:e,shouldSchedule:t,canScheduleUntilOnline:s,isReady:r,onDropHide:i,editingMessage:c,chatId:l,threadId:h,messageListType:g,draft:f,chat:p,connectionState:I,isChatWithBot:v,isChatWithSelf:y,isRightColumnShown:Z,isSelectModeActive:P,isForwarding:w,isPollModalOpen:b,botKeyboardMessageId:M,botKeyboardPlaceholder:S,withScheduledButton:E,stickersForEmoji:k,groupChatMembers:R,topInlineBotIds:T,currentUserId:N,usersById:B,lastSyncTime:L,contentToBeScheduled:x,shouldSuggestStickers:A,baseEmojiKeywords:F,emojiKeywords:U,serverTimeOffset:Q,recentEmojis:$,inlineBots:D,isInlineBotLoading:q,botCommands:H,chatBotCommands:j,sendMessage:_,editMessage:V,saveDraft:W,clearDraft:z,showDialog:Y,setStickerSearchQuery:K,setGifSearchQuery:X,forwardMessages:J,openPollModal:ee,closePollModal:te,loadScheduledHistory:se,openChat:ne,addRecentEmoji:ae,sendInlineBotResult:oe})=>{const re=(0,be.Z)(),ie=(0,o.sO)(null),[de,le]=(0,o.eJ)(""),me=(0,o.sO)(),ge=(0,Rs.Z)(e),[fe,pe,Ie]=(0,Ze.Z)(),[ve,Ce]=(0,o.eJ)(),{width:Pe}=it.Z.get(),we=(0,o.sO)(de);(0,o.d4)((()=>{we.current=de}),[de]),(0,o.d4)((()=>{me.current=void 0}),[l]),(0,o.d4)((()=>{l&&L&&h===u._f&&r&&se({chatId:l})}),[r,l,se,L,h]),(0,o.bt)((()=>{ie.current&&(ie.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)((()=>{x&&(Ce(x),pe())}),[x,pe]);const[Me,Se]=(0,o.eJ)([]),[Ee,Re,Te]=(0,Ze.Z)(),[Ne,Be,Le]=(0,Ze.Z)(),[Ae,Oe,Fe]=(0,Ze.Z)(),[Ue,Qe,$e]=(0,Ze.Z)(),[De,qe,Ge]=(0,Ze.Z)(),[He,je]=(0,Ze.Z)(),[_e,Ve,We]=(0,Ze.Z)(),{startRecordingVoice:ze,stopRecordingVoice:Ye,pauseRecordingVoice:Ke,activeVoiceRecording:Xe,currentRecordTime:Je,recordButtonRef:et,startRecordTimeRef:tt}=(()=>{const e=(0,o.sO)(null),[t,s]=(0,o.eJ)(),n=(0,o.sO)(),[a,r]=(0,o.eJ)();(0,o.d4)((()=>{m.s$&&m.mh&&Ln()}),[]);const i=(0,o.I4)((async()=>{try{const{stop:t,pause:a}=await xn((t=>{e.current&&(n.current&&Date.now()%4==0&&(e.current.style.boxShadow=`0 0 0 ${50*(t||0)}px rgba(0,0,0,.15)`),r(Date.now()))}));n.current=Date.now(),r(Date.now()),s({stop:t,pause:a})}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){s(void 0),n.current=void 0,r(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,ye.Z)(d):void 0),[t,d]),{startRecordingVoice:i,pauseRecordingVoice:c,stopRecordingVoice:d,activeVoiceRecording:t,currentRecordTime:a,recordButtonRef:e,startRecordTimeRef:n}})(),st=c?Ca.Edit:!m.mh||Xe||de&&!Me.length||w?Ca.Send:Ca.Record,nt=!t,{isMentionTooltipOpen:ot,closeMentionTooltip:rt,insertMention:ct,mentionFilteredUsers:dt}=(0,qn.Z)(!Me.length,de,le,void 0,R,T,N,B),{isOpen:lt,id:ut,isGallery:ht,switchPm:mt,results:gt,closeTooltip:ft,help:pt,loadMore:It}=function(e,t,s,a){const[r,i,c]=(0,Ze.Z)(),d=function(e){return Gn.innerHTML=e.replace(/<br>/g,"\n"),Gn.innerText}(s),{queryInlineBot:l,resetInlineBot:u}=(0,n.uC)(),{username:h,query:m,canShowHelp:g}=function(e){const t=e.match(Hn);return t?{username:t[1],query:t[2],canShowHelp:""===t[2]&&!e.match(jn)}:{username:"",query:"",canShowHelp:!1}}(d),f=h.toLowerCase(),p=(0,Rs.Z)(m),I=(0,Rs.Z)(h),v=null==a?void 0:a[f],{id:y,switchPm:C,offset:Z,results:P,isGallery:w,help:b}=v||{};(0,o.d4)((()=>{p!==m&&c()}),[p,m,c]),(0,o.d4)((()=>{e&&f&&t&&l({chatId:t,username:f,query:m})}),[m,e,l,t,f]);const M=(0,o.I4)((()=>{l({chatId:t,username:f,query:m,offset:Z})}),[Z,t,m,l,f]);return(0,o.d4)((()=>{e&&y&&(C||null!=P&&P.length)?i():c()}),[y,e,i,P,C,c]),I!==h&&u({username:I}),{isOpen:r,closeTooltip:c,loadMore:M,username:h,id:y,isGallery:w,switchPm:C,results:P,help:g&&b?`@${h} ${b}`:void 0}}(Boolean(!Me.length&&L),l,de,D),{isOpen:vt,close:yt,filteredBotCommands:Ct}=function(e,t,s,n){const[a,r,i]=(0,Ze.Z)(),[c,d]=(0,o.eJ)(),l=(0,o.I4)((e=>{s||n?_n((()=>{const t=(s||n||[]).filter((({command:t})=>!e||t.includes(e)));d(t&&t.length?t:void 0)})):d(void 0)}),[s,n]);return(0,o.d4)((()=>{if(e&&t.length)if(t.startsWith("/")){const e=(0,$n._)(t.substr(1)).match(Vn);l(e?e[0]:"")}else i();else i()}),[l,t,e,i]),(0,o.d4)((()=>{c&&c.length?r():i()}),[c,r,i]),{isOpen:a,close:i,filteredBotCommands:c}}(Boolean(H&&H.length||j&&j.length),de,H,j),{isContextMenuOpen:Pt,handleContextMenu:wt,handleContextMenuClose:bt,handleContextMenuHide:Mt}=(0,es.Z)(et,!(st===Ca.Send&&nt)),St=(0,o.Ye)((()=>(0,d.H5)(p,v)),[p,v]),Et=p&&(0,d.Nl)(p),kt=(0,d.Hd)(p),{isStickerTooltipOpen:Rt,closeStickerTooltip:Tt}=function(e,t,s,a=!1){const r=(0,o.Ye)((()=>(0,$n._)(t).trim()),[t]),{loadStickersForEmoji:i,clearStickersForEmoji:c}=(0,n.uC)(),d=m.op&&1===(0,Qn.Z)(r)||!m.op&&Boolean(t.match(/^<img.[^>]*?>$/g)),l=Boolean(s)&&d;return(0,o.d4)((()=>{a||(e&&d?i({emoji:r}):!l&&d||c())}),[t,d,c,i,e,a]),{isStickerTooltipOpen:l,closeStickerTooltip:c}}(Boolean(A&&St.canSendStickers&&!Me.length),de,k,!r),{isEmojiTooltipOpen:Nt,closeEmojiTooltip:Bt,filteredEmojis:Lt,insertEmoji:xt}=(0,Dn.Z)(Boolean(A&&St.canSendStickers&&!Me.length),de,$,void 0,le,F,U,!r),At=(0,o.I4)(((e,t=a.R2)=>{const s=window.getSelection(),n=document.getElementById(t),o=(0,Zt.Z)(e,["escape_html","emoji_html","br_html"]).join("").replace(/\u200b+/g,"");if(s.rangeCount){const e=s.getRangeAt(0);if((0,Mn.R)(e,t))return function(e){const t=window.getSelection();if(null!=t&&t.getRangeAt&&t.rangeCount){const s=t.getRangeAt(0);s.deleteContents();const n=s.createContextualFragment(e),a=n.lastChild;s.insertNode(n),a?(s.setStartAfter(a),s.setEndAfter(a)):s.collapse(!1),t.removeAllRanges(),t.addRange(s)}}(o),void n.dispatchEvent(new Event("input",{bubbles:!0}))}le(`${we.current}${o}`),requestAnimationFrame((()=>{(0,Zn.Z)(n)}))}),[]),Ot=(0,o.I4)((()=>{const e=window.getSelection();if(e.rangeCount){const t=e.getRangeAt(0);if((0,Mn.R)(t,a.R2))return void document.execCommand("delete",!1)}le(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 s=t.lastChild;if(s.lastChild)for(;s.lastChild;)s=s.lastChild;const n=s.textContent.length,a=document.createRange(),o=window.getSelection();a.setStart(s,n),a.setEnd(s,n),o.removeAllRanges(),o.addRange(a),document.execCommand("delete",!1);const r=t.innerHTML;return document.body.removeChild(t),r}(we.current))}),[]),Ft=(0,o.I4)(((e=!1)=>{e||le(""),Se([]),Tt(),Ie(),Ce(void 0),rt(),Bt(),m.wB?setTimeout((()=>$e()),350):$e()}),[Tt,Ie,rt,Bt,$e]),Ut=(0,o.sO)();Ut.current=Ye,(0,o.d4)((()=>()=>{Ut.current(),Ft()}),[l,Ft,Ut]);const Qt=((e,t,s,n,r,i)=>((0,o.d4)((()=>{s?(t(On(s.content.text)),requestAnimationFrame((()=>{const e=document.getElementById(a.R2);(0,Zn.Z)(e,!0)}))):t("")}),[s,t]),(0,o.I4)((()=>{const{text:t,entities:a}=(0,Pn.Z)(e.current);s&&(t||(0,d.u8)(s)?(i({messageId:s.id,text:t,entities:a}),n()):r())}),[i,s,e,r,n])))(we,le,c,Ft,qe,V);((e,t,s,n,r,i,c,d,l)=>{const u=(0,o.I4)(((e,t)=>{r.current.length&&!c?d({chatId:e,threadId:t,draft:(0,Pn.Z)(r.current)}):l({chatId:e,threadId:t})}),[l,c,r,d]),h=(0,o.Ye)((()=>(0,C.Ds)((e=>e()),a.r_,!1)),[t]),g=(0,Rs.Z)(t),f=(0,Rs.Z)(s);(0,o.d4)((()=>(Fn=t,Un=s,()=>{Fn=void 0,Un=void 0,u(t,s)})),[t,s,u]),(0,o.d4)((()=>{t===g&&s===f||e&&(i(On(e)),m.$b||requestAnimationFrame((()=>{const e=document.getElementById(a.R2);(0,Zn.Z)(e,!0)})))}),[t,s,e,i,u,g,f]);const p=(0,Rs.Z)(n);(0,o.d4)((()=>{t&&s&&g===t&&f===s&&p!==n&&(n.length?h((()=>{Fn===t&&Un===s&&u(t,s)})):u(t,s))}),[t,n,g,p,f,h,s,u]);const I=(0,o.I4)((()=>{t&&s&&u(t,s)}),[t,s,u]);(0,ue.Z)(I),he(I)})(f,l,h,de,we,le,c,W,z),((e,t,s)=>{(0,o.d4)((()=>{async function n(n){if(!n.clipboardData)return;const o=document.activeElement;if(o&&![a.R2,a.nY].includes(o.id))return;const{items:r}=n.clipboardData,i=Array.from(r).find((e=>An.includes(e.type)&&"file"===e.kind)),c=i&&i.getAsFile(),d=n.clipboardData.getData("text").substring(0,4096);if(n.preventDefault(),c||d){if(c&&!s){const e=await bn(c.name,c,!0);t((t=>[...t,e]))}d&&e(d,null==o?void 0:o.id)}}return document.addEventListener("paste",n,!1),()=>{document.removeEventListener("paste",n,!1)}}),[e,s,t])})(At,Se,c);const $t=(0,o.I4)((async(e,t)=>{Se(await Promise.all(e.map((e=>bn(e.name,e,t)))))}),[]),Dt=(0,o.I4)((async(e,t)=>{Se([...Me,...await Promise.all(e.map((e=>bn(e.name,e,t))))])}),[Me]),qt=(0,o.I4)((()=>{Se([])}),[]),Gt=(0,o.I4)((async(e=!1,t)=>{if("connectionStateReady"!==I)return;let s=Me;if(Xe){const e=await Ye();if(e){const{blob:t,duration:n,waveform:a}=e;s=[await bn("wonderful-voice-message.ogg",t,!1,{voice:{duration:n,waveform:a}})]}}const{text:n,entities:o}=(0,Pn.Z)(we.current);if(!s.length&&!n&&!w)return;const r=s.length?1024:4096;if((null==n?void 0:n.length)>r){const e=n.length-r;return void Y({data:{message:"MESSAGE_TOO_LONG_PLEASE_REMOVE_CHARACTERS",textParams:{"{EXTRA_CHARS_COUNT}":e,"{PLURAL_S}":e>1?"s":""},hasErrorKey:!0}})}const i=document.getElementById(a.R2);if(s.length||n){if(kt&&!Et){const e=(0,G.b)(Q),t=me.current&&Math.floor(e-me.current),s=kt.nextSendDate&&kt.nextSendDate>e;if(t&&t<kt.seconds||s){const n=s?kt.nextSendDate-e:kt.seconds-t;return Y({data:{message:re("SlowModeHint",(0,O.k9)(n)),isSlowMode:!0,hasErrorKey:!1}}),void i.blur()}}_({text:n,entities:o,attachments:s,scheduledAt:t,isSilent:e})}w&&J(),me.current=(0,G.b)(Q),z({chatId:l,localOnly:!0}),m.cj&&i===document.activeElement&&En(i),requestAnimationFrame((()=>{Ft()}))}),[I,Me,Xe,w,z,l,Q,Ft,Ye,Y,kt,Et,_,J,re]),Ht=(0,o.I4)((()=>{$e(),Be()}),[$e,Be]),jt=(0,o.I4)((()=>{Le(),Qe()}),[Le,Qe]),_t=(0,o.I4)(((e,s=!1)=>{e={...e,isPreloadedGlobally:!0},t?(Ce({sticker:e}),pe()):(_({sticker:e}),requestAnimationFrame((()=>{Ft(s)})))}),[t,pe,_,Ft]),Vt=(0,o.I4)((e=>{t?(Ce({gif:e}),pe()):(_({gif:e}),requestAnimationFrame((()=>{Ft(!0)})))}),[t,pe,_,Ft]),Wt=(0,o.I4)((e=>{if("connectionStateReady"!==I)return;oe({id:e.id,queryId:e.queryId});const t=document.getElementById(a.R2);m.cj&&t===document.activeElement&&En(t),z({chatId:l,localOnly:!0}),requestAnimationFrame((()=>{Ft()}))}),[l,z,I,Ft,oe]),zt=(0,o.I4)((()=>{z({chatId:l,localOnly:!0}),requestAnimationFrame((()=>{Ft()}))}),[l,z,Ft]),Yt=(0,o.I4)((e=>{t?(Ce({poll:e}),te(),pe()):(_({poll:e}),te())}),[te,pe,_,t]),Kt=(0,o.I4)((()=>{t?(Ce({isSilent:!0}),pe()):Gt(!0)}),[Gt,pe,t]),Xt=(0,o.I4)(((e,t=!1)=>{const{isSilent:s,...n}=ve||{},a=Math.round(Math.max(e.getTime(),Date.now()+6e4)/1e3)+(t?0:Q);ve&&0!==Object.keys(n).length?(_({...ve,scheduledAt:a}),requestAnimationFrame((()=>{Ft()}))):Gt(!!s,a),Ie()}),[Ie,Gt,Ft,ve,_,Q]),Jt=(0,o.I4)((()=>{Xt(new Date(1e3*a.t4),!0)}),[Xt]),ts=(0,o.I4)((()=>{Ie(),Ce(void 0)}),[Ie]),ss=(0,o.I4)((e=>{"stickers"===e?(K({query:""}),X({query:void 0})):(X({query:""}),K({query:void 0}))}),[K,X]),ns=(0,o.I4)((()=>{const e=document.getElementById(a.R2);m.wB&&e===document.activeElement?(e.blur(),setTimeout((()=>{Le(),Qe()}),100)):Qe()}),[Qe,Le]),as=(0,o.I4)((()=>{ne({id:l,threadId:h,type:"scheduled"})}),[ne,l,h]);(0,o.d4)((()=>{Z&&m.wB&&$e()}),[Z,$e]),(0,o.d4)((()=>{r&&(P?Ve():setTimeout((()=>{We()}),200))}),[P,We,Ve,r]);const os=(0,o.I4)((()=>{switch(st){case Ca.Send:t?(Xe&&Ke(),pe()):Gt();break;case Ca.Record:ze();break;case Ca.Edit:Qt()}}),[st,t,ze,Qt,Xe,pe,Ke,Gt]),rs=st===Ca.Record&&!St.canAttachMedia,is=(0,Rs.Z)(c,!0),cs=c||is,ds=new Date;ds.setSeconds(0),ds.setMilliseconds(0);const ls=new Date;ls.setFullYear(ls.getFullYear()+1);let us="SendMessage";switch(st){case Ca.Edit:us="Save edited message";break;case Ca.Record:us=rs?"Conversation.DefaultRestrictedMedia":"AccDescrVoiceMessage"}const hs=(0,ce.Z)("Composer",!P&&"shown",_e&&"hover-disabled"),ms=(0,ce.Z)("mobile-symbol-menu-button",!r&&"not-ready",He?Ue&&"menu-opened":Ue&&"is-loading"),gs=st===Ca.Edit?Qt:t?pe:Gt;return o.ZP.createElement("div",{className:hs},St.canAttachMedia&&r&&o.ZP.createElement(va.Z,{containerId:"#middle-column-portals"},o.ZP.createElement(fa,{isOpen:e!==at.t.None,withQuick:[e,ge].includes(at.t.QuickFile),onHide:i,onFileSelect:$t})),o.ZP.createElement(ha,{attachments:Me,caption:Me.length?de:"",groupChatMembers:R,currentUserId:N,usersById:B,recentEmojis:$,isReady:r,onCaptionUpdate:le,baseEmojiKeywords:F,emojiKeywords:U,addRecentEmoji:ae,onSend:t?pe:Gt,onFileAppend:Dt,onClear:qt}),o.ZP.createElement(ga,{isOpen:Boolean(b),onClear:te,onSend:Yt}),cs&&o.ZP.createElement(Wn,{isOpen:De,isSchedule:"scheduled"===g,onClose:Ge,message:cs}),o.ZP.createElement(sa,{isOpen:ot,onClose:rt,onInsertUserName:ct,filteredUsers:dt,usersById:B}),o.ZP.createElement(ta,{isOpen:lt,botId:ut,allowedAttachmentOptions:St,isGallery:ht,inlineBotResults:gt,switchPm:mt,onSelectResult:Wt,loadMore:It,onClose:ft}),o.ZP.createElement(ra,{isOpen:vt,withUsername:Boolean(j),botCommands:Ct,onClick:zt,onClose:yt}),o.ZP.createElement("div",{id:"message-compose"},o.ZP.createElement("div",{className:"svg-appendix",ref:ie}),o.ZP.createElement(ua,null),o.ZP.createElement(Ia,{chatId:l,threadId:h,messageText:Me.length?"":de,disabled:!St.canAttachEmbedLinks}),o.ZP.createElement("div",{className:"message-input-wrapper"},v&&!1!==H&&!Xe&&!c&&o.ZP.createElement(Xn,{className:(0,ce.Z)("bot-commands",Ne&&"activated"),round:!0,disabled:void 0===H,color:"translucent",onActivate:Ht,ariaLabel:"Open bot command keyboard"},o.ZP.createElement("i",{className:"icon-bot-commands-filled"})),m.wB?o.ZP.createElement(ke.Z,{className:ms,round:!0,color:"translucent",onClick:Ue?$e:ns,ariaLabel:"Choose emoji, sticker or GIF"},o.ZP.createElement("i",{className:"icon-smile"}),o.ZP.createElement("i",{className:"icon-keyboard"}),Ue&&!He&&o.ZP.createElement(xe.Z,{color:"gray"})):o.ZP.createElement(Xn,{className:Ue?"activated":"",round:!0,color:"translucent",onActivate:jt,ariaLabel:"Choose emoji, sticker or GIF"},o.ZP.createElement("i",{className:"icon-smile"})),o.ZP.createElement(da.Z,{id:"message-input-text",html:Me.length?"":de,placeholder:Xe&&Pe<=600?"":S||re("Message"),forcedPlaceholder:pt,shouldSetFocus:!Me.length,shouldSuppressFocus:m.wB&&Ue,shouldSuppressTextFormatter:Nt||ot||lt,onUpdate:le,onSend:gs,onSuppressedFocus:$e}),q&&Boolean(ut)&&o.ZP.createElement(xe.Z,{color:"gray"}),E&&o.ZP.createElement(ke.Z,{round:!0,faded:!0,className:"scheduled-button",color:"translucent",onClick:as,ariaLabel:"Open scheduled messages"},o.ZP.createElement("i",{className:"icon-schedule"})),M&&!Xe&&!c&&o.ZP.createElement(Xn,{className:Ee?"activated":"",round:!0,color:"translucent",onActivate:Re,ariaLabel:"Open bot command keyboard"},o.ZP.createElement("i",{className:"icon-bot-command"})),!Xe&&!c&&o.ZP.createElement(Xn,{className:Ae?"activated":"",round:!0,color:"translucent",onActivate:Oe,ariaLabel:"Add an attachment"},o.ZP.createElement("i",{className:"icon-attach"})),Xe&&Je&&o.ZP.createElement("span",{className:"recording-state"},(0,O.rM)(Je-tt.current)),o.ZP.createElement(aa,{isOpen:Rt,onStickerSelect:_t}),o.ZP.createElement(oa.Z,{isOpen:Nt,emojis:Lt,onClose:Bt,onEmojiSelect:xt,addRecentEmoji:ae}),o.ZP.createElement(Jn,{isOpen:Ae,allowedAttachmentOptions:St,onFileSelect:$t,onPollCreate:ee,onClose:Fe}),M&&o.ZP.createElement(ca,{messageId:M,isOpen:Ee,onClose:Te}),H&&o.ZP.createElement(ma,{isOpen:Ne,botCommands:H,onClose:Le}),o.ZP.createElement(ea,{isOpen:Ue,allowedAttachmentOptions:St,onLoad:je,onClose:$e,onEmojiSelect:At,onStickerSelect:_t,onGifSelect:Vt,onRemoveSymbol:Ot,onSearchOpen:ss,addRecentEmoji:ae}))),Xe&&o.ZP.createElement(ke.Z,{round:!0,color:"danger",className:"cancel",onClick:Ye,ariaLabel:"Cancel voice recording"},o.ZP.createElement("i",{className:"icon-delete"})),o.ZP.createElement(ke.Z,{ref:et,round:!0,color:"secondary",className:(0,ce.Z)(st,!r&&"not-ready",Xe&&"recording"),disabled:rs,ariaLabel:re(us),onClick:os,onContextMenu:st===Ca.Send&&nt?wt:void 0},o.ZP.createElement("i",{className:"icon-send"}),o.ZP.createElement("i",{className:"icon-microphone-alt"}),o.ZP.createElement("i",{className:"icon-check"})),nt&&o.ZP.createElement(na,{isOpen:Pt,onSilentSend:y?void 0:Kt,onScheduleSend:t?void 0:pe,onClose:bt,onCloseAnimationEnd:Mt}),o.ZP.createElement(ya,{isOpen:fe,withTimePicker:!0,selectedAt:ds.getTime(),maxAt:(0,O._F)(ls),isFutureMode:!0,secondButtonLabel:s?re("Schedule.SendWhenOnline"):void 0,onClose:ts,onSubmit:Xt,onSecondButtonClick:s?Jt:void 0}))}))),Pa=(0,o.X$)((e=>{const{isActive:t}=e,s=(0,De.Z)($e.gl.Extra,"MobileSearch",!t,!0);return s?o.ZP.createElement(s,e):void 0})),wa=(0,o.X$)((e=>{const{isActive:t}=e,s=(0,De.Z)($e.gl.Extra,"MessageSelectToolbar",!t);return s?o.ZP.createElement(s,e):void 0})),ba=(0,o.X$)((e=>{const{isOpen:t}=e,s=(0,De.Z)($e.gl.Extra,"UnpinAllMessagesModal",!t);return s?o.ZP.createElement(s,e):void 0})),Ma=(0,o.X$)((e=>{const{isOpen:t}=e,s=(0,De.Z)($e.gl.Extra,"PaymentModal",!t);return s?o.ZP.createElement(s,e):void 0})),Sa=(0,o.X$)((e=>{const{isOpen:t}=e,s=(0,De.Z)($e.gl.Extra,"ReceiptModal",!t);return s?o.ZP.createElement(s,e):void 0})),Ea=m.wB?450+a.fK:void 0;function ka(e){return"file"===e.kind&&e.type&&a.oG.has(e.type)}const Ra=(0,o.X$)((0,n.c$)((e=>{const t=(0,i.Pu)(e),{isBlurred:s,background:n,backgroundColor:a,patternColor:o}=e.settings.themes[t]||{},{messageLists:r}=e.messages,c=(0,i.Bt)(e),{isLeftColumnShown:l,chats:{listIds:h}}=e,g={theme:t,customBackground:n,backgroundColor:a,patternColor:o,isLeftColumnShown:l,isRightColumnShown:(0,i.Jf)(e),isBackgroundBlurred:s,isMobileSearchActive:Boolean(m.wB&&(0,i.n5)(e)),isSelectModeActive:(0,i.CA)(e),isPaymentModalOpen:e.payment.isPaymentModalOpen,isReceiptModalOpen:Boolean(e.payment.receipt),animationLevel:e.settings.byKey.animationLevel,currentTransitionKey:Math.max(0,e.messages.messageLists.length-1)};if(!c||!h.active)return g;const{chatId:f,threadId:p,type:I}=c,v=(0,i.Z1)(e,f),y=(0,i.KB)(e,f),{chatId:C,messageId:Z}=e.audioPlayer,P=v&&(0,d.Qm)(v,p),w=(0,i.pk)(e,f),b="pinned"===I,M="scheduled"===I;return{...g,chatId:f,threadId:p,messageListType:I,isPrivate:(0,d.YA)(f),canPost:!b&&(!v||P)&&!w,isPinnedMessageList:b,isScheduledMessageList:M,currentUserBannedRights:null==v?void 0:v.currentUserBannedRights,defaultBannedRights:null==v?void 0:v.defaultBannedRights,hasPinnedOrAudioMessage:p!==u._f||Boolean(null==y?void 0:y.length)||Boolean(C&&Z),pinnedMessagesCount:y?y.length:0,shouldSkipHistoryAnimations:e.shouldSkipHistoryAnimations,messageLists:r}}),((e,t)=>(0,g.ei)(t,["openChat","unpinAllMessages","loadUser","closeLocalTextSearch","exitMessageSelectMode","closePaymentModal","clearReceipt"])))((({chatId:e,threadId:t,messageListType:s,isPrivate:n,isPinnedMessageList:r,messageLists:i,canPost:c,currentUserBannedRights:l,defaultBannedRights:u,hasPinnedOrAudioMessage:h,pinnedMessagesCount:g,customBackground:f,theme:p,backgroundColor:I,patternColor:v,isLeftColumnShown:y,isRightColumnShown:C,isBackgroundBlurred:Z,isMobileSearchActive:P,isSelectModeActive:w,isPaymentModalOpen:b,isReceiptModalOpen:M,animationLevel:S,shouldSkipHistoryAnimations:E,currentTransitionKey:k,openChat:R,unpinAllMessages:T,loadUser:N,closeLocalTextSearch:B,exitMessageSelectMode:L,closePaymentModal:x,clearReceipt:A})=>{const{width:O}=ct(),F=(0,be.Z)(),[U,Q]=(0,o.eJ)(at.t.None),[$,D]=(0,o.eJ)(),[q,G]=(0,o.eJ)(),[H,j]=(0,o.eJ)(!1),[_,V]=(0,o.eJ)(!m.wB||S===a.oB),W=h&&(O<a.l3||C&&O>a._m&&O<a.QU||O>=a.ks&&O<a.jT),z=(0,dt.Z)(e,Ea),Y=(0,dt.Z)(t,Ea),K=(0,dt.Z)(s,Ea),X=(0,dt.Z)(c,Ea),J=(0,dt.Z)(W,Ea),ee=(0,dt.Z)($,Ea);(0,o.d4)((()=>e?(0,ye.Z)((()=>{R({id:void 0})})):void 0),[e,R]),(0,o.d4)((()=>{Q(at.t.None),D(void 0),G(void 0)}),[e]),(0,o.d4)((()=>{S===a.oB&&V(!0)}),[S]),(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)((()=>{n&&N({userId:e})}),[e,n,N]);const te=(0,o.I4)((e=>{if(m.$b)return;const{items:t}=e.dataTransfer||{},s=t&&Array.from(t).filter((e=>"text/uri-list"!==e.type)).every(ka);Q(s?at.t.QuickFile:at.t.Document)}),[]),se=(0,o.I4)((()=>{Q(at.t.None)}),[]),ne=(0,o.I4)((()=>{j(!0)}),[]),ae=(0,o.I4)((()=>{j(!1)}),[]),oe=(0,o.I4)((()=>{T({chatId:e}),ae(),R({id:e})}),[T,R,ae,e]),re=(0,o.I4)((()=>{R({id:e})}),[R,e]),ie=((e,t)=>{const[s,n]=(0,o.eJ)(t);return(0,o.d4)((()=>{t&&(t.startsWith("#")?n(t):ot.fetch(a.fo,e,ot.Type.Blob).then((e=>{const t=URL.createObjectURL(e);(0,rt.pt)(t).then((()=>{n(`url(${t})`)}))})))}),[t,e]),t?s:void 0})(p,f),de=(0,ce.Z)(J&&"has-header-tools",f&&"custom-bg-image",I&&"custom-bg-color",f&&Z&&"blurred",m.aZ?"mask-image-disabled":"mask-image-enabled"),le=(0,ce.Z)("messaging-disabled",!w&&"shown"),ue=(0,d.q8)(F,l,u),{composerHiddenScale:he,toolbarHiddenScale:me,composerTranslateX:ge,toolbarTranslateX:fe,unpinHiddenScale:pe,toolbarForUnpinHiddenScale:Ie}=(0,o.Ye)((()=>function(e,t){const s=e<=a.l3?16:32,n=function(e){if(e>a._m){const t=Math.min(Math.max(.25*e,288),424),s=Math.min(.25*e,424);return Math.min(e-t-s,lt)}if(e>a.ks){const t=Math.min(Math.max(.4*e,288),424);return Math.min(e-t,lt)}return e>lt?lt:e}(e),o=e<=a.l3?54:64,r=t?n-s-o:n-s,i=e>a.l3?Math.min(n-s,512):n-s,c=i/r,d=r/i;return{composerHiddenScale:c,toolbarHiddenScale:d,composerTranslateX:t?o/2*d:0,toolbarTranslateX:t?o/2*-1*c:0,unpinHiddenScale:i/258,toolbarForUnpinHiddenScale:258/i}}(O,X)),[X,O]),Ce=(0,ce.Z)("middle-column-footer",!X&&"no-composer",X&&q&&!w&&"with-notch");(0,ve.ZP)(z&&Y,(()=>{R({id:void 0},!0)}),void 0,void 0,void 0,i?i.map(ut.q):[]),(0,ve.ZP)(P,B),(0,ve.ZP)(w,L);const Ze=Boolean(!r&&!X&&ue);return o.ZP.createElement("div",{id:"MiddleColumn",className:de,onTransitionEnd:t=>{"transform"===t.propertyName&&t.target===t.currentTarget&&V(Boolean(e))},style:`\n --composer-hidden-scale: ${he};\n --toolbar-hidden-scale: ${me};\n --unpin-hidden-scale: ${pe};\n --toolbar-unpin-hidden-scale: ${Ie};\n --composer-translate-x: ${ge}px;\n --toolbar-translate-x: ${fe}px;\n --pattern-color: ${v};\n --theme-background-color:\n ${I||("dark"===p?a.It:a.p3)};\n `,onClick:m.p7&&y?re:void 0},o.ZP.createElement("div",{id:"middle-column-bg",style:ie?`--custom-background: ${ie}`:void 0}),o.ZP.createElement("div",{id:"middle-column-portals"}),z&&Y&&o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("div",{className:"messages-layout",onDragEnter:X?te:void 0},o.ZP.createElement(Gt,{chatId:z,threadId:Y,messageListType:K,isReady:_}),o.ZP.createElement(Pe.Z,{name:E?"none":S===a.zy?"slide":"fade",activeKey:k,shouldCleanup:!0},(e=>o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement(yn,{key:`${z}-${Y}-${K}`,chatId:z,threadId:Y,type:K,canPost:X,hasTools:J,onFabToggle:D,onNotchToggle:G,isReady:_,isActive:e}),o.ZP.createElement("div",{className:Ce},X&&o.ZP.createElement(Za,{chatId:z,threadId:Y,messageListType:K,dropAreaState:U,onDropHide:se,isReady:_}),r&&o.ZP.createElement("div",{className:"unpin-button-container",dir:F.isRtl?"rtl":void 0},o.ZP.createElement(ke.Z,{size:"tiny",fluid:!0,color:"secondary",className:"unpin-all-button",onClick:ne},o.ZP.createElement("i",{className:"icon-unpin"}),o.ZP.createElement("span",null,F("Chat.Pinned.UnpinAll",g,"i")))),Ze&&o.ZP.createElement("div",{className:le},o.ZP.createElement("div",{className:"messaging-disabled-inner"},o.ZP.createElement("span",null,ue))),o.ZP.createElement(wa,{messageListType:K,isActive:w,canPost:X}),o.ZP.createElement(Ma,{isOpen:Boolean(b),onClose:x}),o.ZP.createElement(Sa,{isOpen:Boolean(M),onClose:A}))))),o.ZP.createElement(Cn,{isShown:ee,canPost:X,withExtraShift:Ze||w||r})),m.wB&&o.ZP.createElement(Pa,{isActive:Boolean(P)})),e&&o.ZP.createElement(ba,{isOpen:H,chatId:e,pinnedMessagesCount:g,onClose:ae,onUnpin:oe}))}))),Ta=(0,C.Ds)((e=>e()),200,!1);var Na;!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.ManageGroupMembers=16]="ManageGroupMembers",e[e.StickerSearch=17]="StickerSearch",e[e.GifSearch=18]="GifSearch",e[e.PollResults=19]="PollResults",e[e.AddingMembers=20]="AddingMembers"}(Na||(Na={}));const Ba=(0,o.X$)((0,n.c$)(((e,{chatId:t,isProfile:s,isManagement:n})=>{const{query:a}=(0,i.n5)(e)||{},{query:o}=(0,i.y5)(e)||{},{query:r}=(0,i.yN)(e)||{},c=t?(0,i.Z1)(e,t):void 0,l=c&&(0,d.eA)(c);return{canManage:Boolean(!n&&s&&c&&!(0,i.FM)(e,c.id)&&((0,d.YA)(c.id)||((0,d.Nl)(c)||c.isCreator)&&!c.isNotJoined)),isChannel:l,messageSearchQuery:a,stickerSearchQuery:o,gifSearchQuery:r}}),((e,t)=>(0,g.ei)(t,["setLocalTextSearchQuery","setStickerSearchQuery","setGifSearchQuery","searchTextMessagesLocal","toggleManagement","openHistoryCalendar"])))((({isColumnOpen:e,isProfile:t,isSearch:s,isManagement:n,isStickerSearch:a,isGifSearch:r,isPollResults:i,isAddingChatMembers:c,profileState:d,managementScreen:l,canManage:u,isChannel:g,onClose:f,messageSearchQuery:p,stickerSearchQuery:I,gifSearchQuery:v,setLocalTextSearchQuery:y,setStickerSearchQuery:C,setGifSearchQuery:Z,searchTextMessagesLocal:P,toggleManagement:w,openHistoryCalendar:b,shouldSkipAnimation:M})=>{var S;const E=(0,o.sO)(null),k=(0,o.I4)((e=>{y({query:e}),e.length&&Ta(P)}),[P,y]),R=(0,o.I4)((e=>{C({query:e})}),[C]),T=(0,o.I4)((e=>{Z({query:e})}),[Z]),[N,B]=(0,o.eJ)(!e);(0,o.d4)((()=>{setTimeout((()=>{B(!e)}),300)}),[e]);const L=(0,be.Z)(),x=t?d===h.vi.Profile?Na.Profile:d===h.vi.SharedMedia?Na.SharedMedia:d===h.vi.MemberList?Na.MemberList:-1:s?Na.Search:i?Na.PollResults:a?Na.StickerSearch:r?Na.GifSearch:c?Na.AddingMembers:n?l===h.u1.Initial?Na.ManageInitial:l===h.u1.ChatPrivacyType?Na.ManageChatPrivacyType:l===h.u1.Discussion?Na.ManageDiscussion:l===h.u1.ChannelSubscribers?Na.ManageChannelSubscribers:l===h.u1.GroupPermissions?Na.ManageGroupPermissions:l===h.u1.ChatAdministrators?Na.ManageChatAdministrators:l===h.u1.GroupRemovedUsers?Na.ManageGroupRemovedUsers:l===h.u1.GroupUserPermissionsCreate?Na.ManageGroupUserPermissionsCreate:l===h.u1.GroupUserPermissions?Na.ManageGroupUserPermissions:l===h.u1.GroupRecentActions?Na.ManageGroupRecentActions:l===h.u1.ChatAdminRights?Na.ManageGroupAdminRights:l===h.u1.GroupMembers?Na.ManageGroupMembers:void 0:void 0,A=null!==(S=(0,gt.Z)(x,!0))&&void 0!==S?S:-1;function F(){if(-1!==A)switch(A){case Na.PollResults:return o.ZP.createElement("h3",null,L("PollResults"));case Na.Search:return o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement(Re.Z,{parentContainerClassName:"RightSearch",value:p,onChange:k}),o.ZP.createElement(ke.Z,{round:!0,size:"smaller",color:"translucent",onClick:()=>b({selectedAt:(0,O._F)(Date.now())}),ariaLabel:"Search messages by date"},o.ZP.createElement("i",{className:"icon-calendar"})));case Na.AddingMembers:return o.ZP.createElement("h3",null,L("GroupAddMembers"));case Na.ManageInitial:return o.ZP.createElement("h3",null,L("Edit"));case Na.ManageChatPrivacyType:return o.ZP.createElement("h3",null,L(g?"ChannelTypeHeader":"GroupTypeHeader"));case Na.ManageDiscussion:return o.ZP.createElement("h3",null,L("Discussion"));case Na.ManageChatAdministrators:return o.ZP.createElement("h3",null,L("ChannelAdministrators"));case Na.ManageGroupRecentActions:return o.ZP.createElement("h3",null,L("Group.Info.AdminLog"));case Na.ManageGroupAdminRights:return o.ZP.createElement("h3",null,L("EditAdminRights"));case Na.ManageGroupPermissions:return o.ZP.createElement("h3",null,L("ChannelPermissions"));case Na.ManageGroupRemovedUsers:return o.ZP.createElement("h3",null,L("ChannelBlockedUsers"));case Na.ManageGroupUserPermissionsCreate:return o.ZP.createElement("h3",null,L("ChannelAddException"));case Na.ManageGroupUserPermissions:return o.ZP.createElement("h3",null,L("UserRestrictions"));case Na.StickerSearch:return o.ZP.createElement(Re.Z,{value:I,placeholder:L("SearchStickersHint"),onChange:R});case Na.GifSearch:return o.ZP.createElement(Re.Z,{value:v,placeholder:L("SearchGifsTitle"),onChange:T});case Na.SharedMedia:return o.ZP.createElement("h3",null,L("SharedMedia"));case Na.ManageChannelSubscribers:return o.ZP.createElement("h3",null,L("ChannelSubscribers"));case Na.MemberList:case Na.ManageGroupMembers:return o.ZP.createElement("h3",null,L("GroupMembers"));default:return o.ZP.createElement(o.ZP.Fragment,null,o.ZP.createElement("h3",null,"Profile"),o.ZP.createElement("section",{className:"tools"},u&&o.ZP.createElement(ke.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:L("Edit"),onClick:w},o.ZP.createElement("i",{className:"icon-edit"}))))}}const U=m.wB||x===Na.SharedMedia||x===Na.MemberList||x===Na.AddingMembers||n,Q=(0,ce.Z)("animated-close-icon",U&&"state-back",(N||M)&&"no-transition");return o.ZP.createElement("div",{className:"RightHeader"},o.ZP.createElement(ke.Z,{className:"close-button",round:!0,color:"translucent",size:"smaller",onClick:f,ariaLabel:L(U?"Common.Back":"Common.Close")},o.ZP.createElement("div",{ref:E,className:Q})),o.ZP.createElement(Pe.Z,{name:N||M?"none":"slide-fade",activeKey:A},F))})));var La=s(91),xa=s(7407);function Aa(e,t,s,n,r,i){const c=(0,o.sO)();(0,me.Z)((()=>{t===e&&r&&i&&(c.current=(0,d.R5)(r,i,e).reverse())}),[r,i,t,e]);const[l,u]=(0,xa.Z)(n?s:void 0,c.current,void 0,"media"===e?a.EN:a.pn);return[l,u,!(!l||!c.current||l[0]===c.current[0])]}const Oa=(0,C.P2)((e=>e()),250,!1);let Fa=!1;var Ua=s(1273),Qa=s(1876),$a=s(787),Da=s(180),qa=s(3709),Ga=s(5418),Ha=s(7262),ja=s(1151),_a=s(3103);const Va=(0,o.X$)((0,n.c$)(((e,{userId:t})=>{const s=(0,i.jr)(e),n=t&&(0,i.dy)(e,t);return{chat:s,contactName:n?(0,d.Vl)(n):void 0}}),((e,t)=>(0,g.ei)(t,["deleteChatMember"])))((({isOpen:e,chat:t,userId:s,contactName:n,onClose:a,deleteChatMember:r})=>{const i=(0,be.Z)(),c=(0,o.I4)((()=>{r({chatId:t.id,userId:s}),a()}),[t,r,a,s]);if(t&&s)return o.ZP.createElement(_a.Z,{isOpen:e,onClose:a,onEnter:c,className:"delete",title:i("GroupRemoved.Remove")},o.ZP.createElement("p",null,(0,Zt.Z)(i("PeerInfo.Confirm.RemovePeer",n))),o.ZP.createElement(ke.Z,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:c},i("lng_box_remove")),o.ZP.createElement(ke.Z,{className:"confirm-dialog-button",isText:!0,onClick:a},i("Cancel")))}))),Wa=[{type:"media",title:"SharedMediaTab2"},{type:"documents",title:"SharedFilesTab2"},{type:"links",title:"SharedLinksTab2"},{type:"audio",title:"SharedMusicTab2"},{type:"voice",title:"SharedVoiceTab2"}];function za(e){return[`.shared-media-transition > div:only-child > .${e}-list > .scroll-item`,`.shared-media-transition > div.active > .${e}-list > .scroll-item`].join(", ")}const Ya=(0,o.X$)((0,n.c$)(((e,{chatId:t,userId:s})=>{var n;const a=(0,i.Z1)(e,t),o=(0,i.Zw)(e,s||t),{currentType:r,resultsByType:c}=(0,i.we)(e)||{},{foundIds:l}=c&&r&&c[r]||{},{byId:u}=e.users,{byId:h}=e.chats,m=a&&(0,d.Bf)(a),g=a&&(0,d.eA)(a),f=m||g&&(0,d.Nl)(a),p=null==a||null===(n=a.fullInfo)||void 0===n?void 0:n.members,I=f&&a&&a.fullInfo&&!a.fullInfo.canViewMembers,v=f&&a&&((0,d.VE)(a,"inviteUsers")||a.isCreator),y=f&&a&&((0,d.VE)(a,"banUsers")||a.isCreator);let C;return s?C=s:(0,d.YA)(t)&&(C=t),{theme:(0,i.Pu)(e),isChannel:g,resolvedUserId:C,chatMessages:o,foundIds:l,mediaSearchType:r,hasMembersTab:f,areMembersHidden:I,canAddMembers:v,canDeleteMembers:y,currentUserId:e.currentUserId,isRightColumnShown:(0,i.Jf)(e),isRestricted:null==a?void 0:a.isRestricted,lastSyncTime:e.lastSyncTime,serverTimeOffset:e.serverTimeOffset,usersById:u,chatsById:h,...f&&p&&{members:p}}}),((e,t)=>(0,g.ei)(t,["setLocalMediaSearchType","loadMoreMembers","searchMediaMessagesLocal","openMediaViewer","openAudioPlayer","openUserInfo","focusMessage","loadProfilePhotos","setNewChatMembersDialogState"])))((({chatId:e,profileState:t,onProfileStateChange:s,theme:n,isChannel:r,resolvedUserId:i,currentUserId:c,chatMessages:l,foundIds:g,mediaSearchType:f,hasMembersTab:p,areMembersHidden:I,canAddMembers:v,canDeleteMembers:y,members:C,usersById:Z,chatsById:P,isRightColumnShown:w,isRestricted:b,lastSyncTime:M,setLocalMediaSearchType:S,loadMoreMembers:E,searchMediaMessagesLocal:k,openMediaViewer:R,openAudioPlayer:T,openUserInfo:N,focusMessage:B,loadProfilePhotos:L,setNewChatMembersDialogState:x,serverTimeOffset:A})=>{const O=(0,o.sO)(null),F=(0,o.sO)(null),U=(0,be.Z)(),[Q,$]=(0,o.eJ)(0),[D,q]=(0,o.eJ)(),G=(0,o.Ye)((()=>[...p?[{type:"members",title:r?"ChannelSubscribers":"GroupMembers"}]:[],...Wa]),[p,r]),H=G[Q].type,[j,_,V,W]=function(e,t,s,n,r,i,c,l,u,h,m,g=0){const f="members"!==n&&r?r:n,p=(0,o.Ye)((()=>{if(i&&c)return(0,d.Z0)(i.map((({userId:e})=>e)),c,void 0,g)}),[i,g,c]),[I,v,y]=function(e,t,s,n){const[o,r]=(0,xa.Z)(s?t:void 0,n,void 0,a.Vk);return[o,r,!(!o||!n||o[0]===n[0])]}(0,t,m,p),[C,Z,P]=Aa("media",f,s,m,l,u),[w,b,M]=Aa("documents",f,s,m,l,u),[S,E,k]=Aa("links",f,s,m,l,u),[R,T,N]=Aa("audio",f,s,m,l,u),[B,L,x]=Aa("voice",f,s,m,l,u);let A,O,F=!1;switch(f){case"members":A=I,O=v,F=y;break;case"media":A=C,O=Z,F=P;break;case"documents":A=w,O=b,F=M;break;case"links":A=S,O=E,F=k;break;case"audio":A=R,O=T,F=N;break;case"voice":A=B,O=L,F=x}return[f,A,O,F]}(0,E,k,H,f,C,Z,l,g,0,M,A),z=G.findIndex((({type:e})=>e===j)),{handleScroll:Y}=function(e,t,s,n){(0,jt.Z)((([s])=>{if(s&&s!==t){const s=e.current,a=s.querySelector(".TabList");s.scrollTop<a.offsetTop&&(n("members"===t?h.vi.MemberList:h.vi.SharedMedia),Fa=!0,(0,Yt.Z)(s,a,"start",void 0,void 0,void 0,300),setTimeout((()=>{Fa=!1}),350))}}),[t,n]),(0,jt.Z)((([t])=>{if(s!==h.vi.Profile||s===t)return;const a=e.current;a&&a.querySelector(".TabList")&&(Fa=!0,(0,Yt.Z)(a,a.firstElementChild,"start",void 0,2*a.offsetHeight),setTimeout((()=>{Fa=!1}),350),n(s))}),[s]);const a=(0,o.I4)((()=>{const s=e.current;if(!s)return;const a=s.querySelector(".TabList");if(!a)return;let o=h.vi.Profile;s.scrollTop>=a.offsetTop&&(o="members"===t?h.vi.MemberList:h.vi.SharedMedia),n(o)}),[e,n,t]);return(0,o.d4)((()=>{Fa||a()}),[a,t]),{handleScroll:(0,o.I4)((()=>{Fa||Oa(a)}),[a])}}(O,H,t,s),{applyTransitionFix:K,releaseTransitionFix:X}=function(e,t=".Transition.shared-media-transition"){return(0,o.d4)((()=>{function s(){const s=e.current,n=s.querySelector(t),a=s.querySelector(".TabList");n&&a&&(n.style.minHeight=s.offsetHeight-a.offsetHeight+"px")}return s(),window.addEventListener("resize",s,!1),()=>{window.removeEventListener("resize",s,!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])}}(O),[J,ee]=(()=>{const[e,t]=(0,o.eJ)(!1);return[e,(0,o.I4)((()=>{t((e=>!e))}),[])]})(),te=(0,o.I4)((()=>{X(),ee()}),[X,ee]),se=(0,o.I4)((()=>{x(h.WB.InProgress)}),[x]);(0,o.d4)((()=>{S({mediaType:H})}),[S,H]);const ne=i||e;(0,o.d4)((()=>{M&&L({profileId:ne})}),[L,ne,M]);const ae=(0,o.I4)((e=>{R({chatId:ne,threadId:u._f,messageId:e,origin:h.bZ.SharedMedia})}),[ne,R]),oe=(0,o.I4)((e=>{T({chatId:ne,messageId:e,origin:h.Cr.SharedMedia})}),[ne,T]),re=(0,o.I4)((e=>{N({id:e})}),[N]),ie=(0,o.I4)((e=>{B({chatId:ne,messageId:e})}),[ne,B]),ce=(0,o.I4)((()=>{q(void 0)}),[]);let de;(0,o.d4)((()=>{if(F.current&&m.$b)return(0,Oe.s)(F.current,{selectorToPreventScroll:".Profile",onSwipe:(e,t)=>t===Oe.e.Left?($(Math.min(Q+1,G.length-1)),!0):t===Oe.e.Right&&($(Math.max(0,Q-1)),!0)})}),[Q,G.length]);const le="members"===j||!p&&"media"===j;le?de=w?0:1e3:_||(de=a.Y);const ue=(0,la.Z)([e,j],de);function he(e){return e!==c&&y?[{title:U("lng_context_remove_from_group"),icon:"stop",handler:()=>{q(e)}}]:void 0}function me(){if(!_||!ue||!l){const e=le&&_&&!ue;return o.ZP.createElement("div",{className:"content empty-list"},!e&&o.ZP.createElement(xe.Z,null))}if(!_.length){let e;switch(j){case"members":e=I?"You have no access to group members list.":"No members found";break;case"documents":e=U("lng_media_file_empty");break;case"links":e=U("lng_media_link_empty");break;case"audio":e=U("lng_media_song_empty");break;case"voice":e=U("lng_media_audio_empty");break;default:e=U("SharedMedia.EmptyTitle")}return o.ZP.createElement("div",{className:"content empty-list"},o.ZP.createElement(Ha.Z,{text:e}))}return o.ZP.createElement("div",{className:`content ${j}-list`,dir:U.isRtl&&"media"===j?"rtl":void 0,teactFastList:!0},"media"===j?_.map((e=>l[e]&&o.ZP.createElement(qa.Z,{key:e,message:l[e],onClick:ae}))):"documents"===j?_.map((e=>l[e]&&o.ZP.createElement(Is.Z,{key:e,message:l[e],withDate:!0,smaller:!0,className:"scroll-item",onDateClick:ie}))):"links"===j?_.map((e=>l[e]&&o.ZP.createElement(Ga.Z,{key:e,message:l[e],onMessageClick:ie}))):"audio"===j?_.map((e=>l[e]&&o.ZP.createElement(vs.Z,{key:e,theme:n,message:l[e],origin:h.Cr.SharedMedia,date:l[e].date,lastSyncTime:M,className:"scroll-item",onPlay:oe,onDateClick:ie}))):"voice"===j?_.map((e=>l[e]&&o.ZP.createElement(vs.Z,{key:e,theme:n,message:l[e],senderTitle:(0,La.F)(U,l[e],P,Z),origin:h.Cr.SharedMedia,date:l[e].date,lastSyncTime:M,className:"scroll-item",onPlay:oe,onDateClick:ie}))):"members"===j?_.map(((e,t)=>o.ZP.createElement(Qa.Z,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item small-icon",onClick:()=>re(e),contextActions:he(e)},o.ZP.createElement(pt.Z,{userId:e,forceShowSelf:!0})))):void 0)}return o.ZP.createElement(Ua.Z,{ref:O,className:"Profile custom-scroll",itemSelector:za(j),items:ue?_:void 0,cacheBuster:J,sensitiveArea:a.qU,preloadBackwards:ue?"members"===j?a.Vk:a.EN:0,noScrollRestoreOnTop:!0,noFastList:!0,onLoadMore:V,onScroll:Y},!W&&function(e,t){return o.ZP.createElement("div",{className:"profile-info"},o.ZP.createElement($a.Z,{userId:t||e}),o.ZP.createElement(Da.Z,{chatOrUserId:t||e}))}(e,i),!b&&o.ZP.createElement("div",{className:"shared-media"},o.ZP.createElement(Pe.Z,{ref:F,name:U.isRtl?"slide-reversed":"slide",activeKey:z,renderCount:G.length,shouldRestoreHeight:!0,className:"shared-media-transition",onStart:K,onStop:te},me),o.ZP.createElement(Fe.Z,{big:!0,activeTab:Q,tabs:G,onSwitchTab:$})),v&&o.ZP.createElement(ja.Z,{isShown:"members"===j,onClick:se,ariaLabel:U("lng_channel_add_users")},o.ZP.createElement("i",{className:"icon-add-user-filled"})),y&&o.ZP.createElement(Va,{isOpen:Boolean(D),userId:D,onClose:ce}))}))),Ka=(0,o.X$)((e=>{const t=(0,De.Z)($e.gl.Extra,"RightSearch");return t?o.ZP.createElement(t,e):o.ZP.createElement(qe.Z,null)})),Xa=(0,o.X$)((e=>{const t=(0,De.Z)($e.gl.Extra,"Management");return t?o.ZP.createElement(t,e):o.ZP.createElement(qe.Z,null)})),Ja=(0,o.X$)((()=>{const e=(0,De.Z)($e.gl.Extra,"StickerSearch");return e?o.ZP.createElement(e,null):o.ZP.createElement(qe.Z,null)})),eo=(0,o.X$)((()=>{const e=(0,De.Z)($e.gl.Extra,"GifSearch");return e?o.ZP.createElement(e,null):o.ZP.createElement(qe.Z,null)})),to=(0,o.X$)((()=>{const e=(0,De.Z)($e.gl.Extra,"PollResults");return e?o.ZP.createElement(e,null):o.ZP.createElement(qe.Z,null)}));var so=s(1820);const no=(0,o.X$)((0,n.c$)(((e,{chatId:t})=>{var s;const n=(0,i.Z1)(e,t),{userIds:a}=e.contactList||{},{byId:o}=e.users,{byId:r}=e.chats,{currentUserId:c,newChatMembersProgress:l,connectionState:u}=e,m=n&&(0,d.eA)(n),{query:g,fetchingStatus:f,globalUserIds:p,localUserIds:I}=e.userSearch;return{isChannel:m,members:null==n||null===(s=n.fullInfo)||void 0===s?void 0:s.members,currentUserId:c,usersById:o,chatsById:r,localContactIds:a,searchQuery:g,isSearching:f,isLoading:l===h.WB.Loading,globalUserIds:p,localUserIds:I,connectionState:u}}),((e,t)=>(0,g.ei)(t,["loadContactList","setUserSearchQuery"])))((({isChannel:e,connectionState:t,members:s,onNextStep:n,currentUserId:a,usersById:r,chatsById:i,localContactIds:c,isLoading:l,searchQuery:u,isSearching:h,localUserIds:m,globalUserIds:f,setUserSearchQuery:p,onClose:I,isActive:v,loadContactList:y})=>{const C=(0,be.Z)(),[Z,P]=(0,o.eJ)([]),w=(0,Rs.Z)(Z)===Z;(0,o.d4)((()=>{v&&"connectionStateReady"===t&&y()}),[t,v,y]),(0,ve.ZP)(v,I);const b=(0,o.Ye)((()=>s?s.map((e=>e.userId)):[]),[s]),M=(0,o.I4)((e=>{p({query:e})}),[p]),S=(0,o.Ye)((()=>{const t=c?(0,d.ih)(c.filter((e=>e!==a)),i):[];if(!u)return t.filter((e=>!b.includes(e)));const s=t.filter((e=>{const t=r[e];if(!t)return!1;const s=(0,d.Js)(t);return s&&(0,L.Z)(s,u)}));return(0,d.ih)((0,g.Tw)([...s,...m||[],...f||[]]).filter((t=>{const s=r[t];return!b.includes(t)&&(!s||!(0,d.cS)(s)||!e&&s.canBeInvitedToGroup)})),i)}),[c,i,u,m,f,a,r,b,e]),E=(0,o.I4)((()=>{Z.length&&(p({query:""}),n(Z))}),[Z,p,n]);return o.ZP.createElement("div",{className:"AddChatMembers"},o.ZP.createElement("div",{className:"AddChatMembers-inner"},o.ZP.createElement(so.Z,{itemIds:S,selectedIds:Z,filterValue:u,filterPlaceholder:C("lng_channel_add_users"),searchInputId:"new-members-picker-search",isLoading:h,onSelectedIdsChange:P,onFilterChange:M,noScrollRestore:w}),o.ZP.createElement(ja.Z,{isShown:Boolean(Z.length),disabled:l,ariaLabel:C("lng_channel_add_users"),onClick:E},l?o.ZP.createElement(xe.Z,{color:"white"}):o.ZP.createElement("i",{className:"icon-arrow-right"}))))}))),ao=Object.keys(h.qt).length/2,oo=Object.keys(h.u1).length/2;function ro(){const e=document.querySelector(".RightHeader .SearchInput input");e&&e.blur()}const io=(0,o.X$)((0,n.c$)((e=>{const{chatId:t,threadId:s}=(0,i.Bt)(e)||{},n=(0,i.g4)(e);return{contentKey:(0,i.Wq)(e),chatId:t,threadId:s,currentProfileUserId:e.users.selectedId,isChatSelected:Boolean(t&&n),shouldSkipHistoryAnimations:e.shouldSkipHistoryAnimations}}),((e,t)=>(0,g.ei)(t,["openUserInfo","toggleChatInfo","toggleManagement","closeLocalTextSearch","setStickerSearchQuery","setGifSearchQuery","closePollResults","addChatMembers","setNewChatMembersDialogState"])))((({contentKey:e,chatId:t,threadId:s,currentProfileUserId:n,isChatSelected:r,toggleChatInfo:i,toggleManagement:c,openUserInfo:d,closeLocalTextSearch:l,setStickerSearchQuery:u,setGifSearchQuery:m,closePollResults:g,addChatMembers:f,setNewChatMembersDialogState:p,shouldSkipHistoryAnimations:I})=>{var v;const{width:y}=ct(),[C,Z]=(0,o.eJ)(h.vi.Profile),[P,w]=(0,o.eJ)(h.u1.Initial),[b,M]=(0,o.eJ)(),[S,E]=(0,o.eJ)(),k=C!==h.vi.Profile,R=void 0!==e,T=e===h.qt.ChatInfo||e===h.qt.UserInfo,N=e===h.qt.Search,B=e===h.qt.Management,L=e===h.qt.StickerSearch,x=e===h.qt.GifSearch,A=e===h.qt.PollResults,O=e===h.qt.AddingMembers,F=y<=a._m,[U,Q]=(0,o.eJ)(!R),$=null!==(v=(0,gt.Z)(e,!0,!r))&&void 0!==v?v:-1,D=(0,o.I4)(((t=!0)=>{switch(e){case h.qt.AddingMembers:p(h.WB.Closed);break;case h.qt.ChatInfo:if(k&&t){Z(h.vi.Profile);break}i(void 0,!0);break;case h.qt.UserInfo:if(k&&t){Z(h.vi.Profile);break}d({id:void 0},!0);break;case h.qt.Management:switch(P){case h.u1.Initial:c();break;case h.u1.ChatPrivacyType:case h.u1.Discussion:case h.u1.GroupPermissions:case h.u1.GroupType:case h.u1.ChatAdministrators:case h.u1.ChannelSubscribers:case h.u1.GroupMembers:w(h.u1.Initial);break;case h.u1.GroupUserPermissionsCreate:case h.u1.GroupRemovedUsers:case h.u1.GroupUserPermissions:w(h.u1.GroupPermissions),M(void 0),E(void 0);break;case h.u1.ChatAdminRights:case h.u1.GroupRecentActions:w(h.u1.ChatAdministrators)}break;case h.qt.Search:ro(),l();break;case h.qt.StickerSearch:ro(),u({query:void 0});break;case h.qt.GifSearch:ro(),m({query:void 0});break;case h.qt.PollResults:g()}}),[e,k,i,d,g,p,P,c,l,u,m]),q=(0,o.I4)(((e,t)=>{M(e),E(t)}),[]),G=(0,o.I4)((e=>{f({chatId:t,memberIds:e})}),[f,t]);function H(e){if(-1!==$)switch($){case h.qt.AddingMembers:return o.ZP.createElement(no,{chatId:t,onNextStep:G,isActive:R&&e,onClose:D});case h.qt.ChatInfo:case h.qt.UserInfo:return o.ZP.createElement(Ya,{key:n||t,chatId:t,userId:n,profileState:C,onProfileStateChange:Z});case h.qt.Search:return o.ZP.createElement(Ka,{chatId:t,threadId:s,onClose:D,isActive:R&&e});case h.qt.Management:return o.ZP.createElement(Xa,{chatId:t,currentScreen:P,isPromotedByCurrentUser:S,selectedChatMemberId:b,onScreenSelect:w,onChatMemberSelect:q,isActive:R&&e,onClose:D});case h.qt.StickerSearch:return o.ZP.createElement(Ja,{onClose:D,isActive:R&&e});case h.qt.GifSearch:return o.ZP.createElement(eo,{onClose:D,isActive:R&&e});case h.qt.PollResults:return o.ZP.createElement(to,{onClose:D,isActive:R&&e})}}return(0,o.d4)((()=>R?(0,ye.Z)(D):void 0),[R,D]),(0,o.d4)((()=>{setTimeout((()=>{Q(!R)}),300)}),[R]),(0,o.d4)((()=>{R&&F&&D()}),[F]),(0,Ht.Z)((([s,n])=>{(s===h.qt.ChatInfo&&e===h.qt.UserInfo||s===h.qt.UserInfo&&e===h.qt.ChatInfo||n!==t)&&(Z(h.vi.Profile),w(h.u1.Initial))}),[e,t]),(0,ve.ZP)(r&&(e===h.qt.ChatInfo||e===h.qt.UserInfo||e===h.qt.Management||e===h.qt.AddingMembers),(()=>D(!1)),i),o.ZP.createElement("div",{id:"RightColumn-wrapper",className:r?void 0:"is-hidden"},F&&o.ZP.createElement("div",{className:"overlay-backdrop",onClick:D}),o.ZP.createElement("div",{id:"RightColumn"},o.ZP.createElement(Ba,{chatId:t,isColumnOpen:R,isProfile:T,isSearch:N,isManagement:B,isStickerSearch:L,isGifSearch:x,isPollResults:A,isAddingChatMembers:O,profileState:C,managementScreen:P,onClose:D,shouldSkipAnimation:U||I}),o.ZP.createElement(Pe.Z,{name:U||I?"none":"zoom-fade",renderCount:ao+oo,activeKey:B?ao+P:$,shouldCleanup:!0,cleanupExceptionKey:h.qt.ChatInfo},H)))}))),co=(0,o.X$)((({isOpen:e})=>{const t=(0,De.Z)($e.gl.Extra,"MediaViewer",!e);return t?o.ZP.createElement(t,null):void 0})),lo=(0,o.X$)((({isOpen:e})=>{const t=(0,De.Z)($e.gl.Extra,"Notifications",!e);return t?o.ZP.createElement(t,null):void 0})),uo=(0,o.X$)((({isOpen:e})=>{const t=(0,De.Z)($e.gl.Extra,"Dialogs",!e);return t?o.ZP.createElement(t,null):void 0})),ho=(0,o.X$)((e=>{const{isOpen:t}=e,s=(0,De.Z)($e.gl.Extra,"ForwardPicker",!t);return s?o.ZP.createElement(s,e):void 0})),mo=(0,o.X$)((e=>{const{url:t}=e,s=(0,De.Z)($e.gl.Extra,"SafeLinkModal",!t);return s?o.ZP.createElement(s,e):void 0})),go=(0,o.X$)((e=>{const{isOpen:t}=e,s=(0,De.Z)($e.gl.Extra,"HistoryCalendar",!t);return s?o.ZP.createElement(s,e):void 0}));let fo,po=!1;function Io(e){document.querySelectorAll('link[rel="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 vo(e){document.title!==e&&(document.title=e)}const yo=(0,o.X$)((0,n.c$)((e=>{const{chatId:t,messageId:s,origin:n}=e.audioPlayer,a=t&&s?(0,i.hj)(e,t,s):void 0;return{animationLevel:e.settings.byKey.animationLevel,lastSyncTime:e.lastSyncTime,isLeftColumnShown:e.isLeftColumnShown,isRightColumnShown:(0,i.Jf)(e),isMediaViewerOpen:(0,i.zQ)(e),isForwardModalOpen:(0,i.Ev)(e),hasNotifications:Boolean(e.notifications.length),hasDialogs:Boolean(e.dialogs.length),audioMessage:a,audioOrigin:n,safeLinkModalUrl:e.safeLinkModalUrl,isHistoryCalendarOpen:Boolean(e.historyCalendarSelectedAt),shouldSkipHistoryAnimations:e.shouldSkipHistoryAnimations,language:e.settings.byKey.language,openedStickerSetShortName:e.openedStickerSetShortName}}),((e,t)=>(0,g.ei)(t,["loadAnimatedEmojis","loadNotificationSettings","loadNotificationExceptions","updateIsOnline","loadTopInlineBots","loadEmojiKeywords","openStickerSetShortName","loadCountryList"])))((({lastSyncTime:e,isLeftColumnShown:t,isRightColumnShown:s,isMediaViewerOpen:r,isForwardModalOpen:c,animationLevel:d,hasNotifications:l,hasDialogs:u,audioMessage:h,audioOrigin:g,safeLinkModalUrl:f,isHistoryCalendarOpen:p,shouldSkipHistoryAnimations:I,language:v,openedStickerSetShortName:y,loadAnimatedEmojis:P,loadNotificationSettings:w,loadNotificationExceptions:b,updateIsOnline:M,loadTopInlineBots:S,loadEmojiKeywords:E,loadCountryList:k,openStickerSetShortName:R})=>{a.eM&&!po&&(po=!0,console.log(">>> RENDER MAIN")),(0,o.d4)((()=>{e&&(M(!0),P(),w(),b(),S(),E({language:a.pR}),v!==a.pR&&E({language:v}),k({langCode:v}))}),[e,P,b,w,M,S,E,k,v]),(0,o.d4)((()=>{e&&ve.Oy.startsWith("#?tgaddr=")&&Z(decodeURIComponent(ve.Oy.substr("#?tgaddr=".length)))}),[e]);const{transitionClassNames:T}=(0,le.Z)(!t,void 0,!0,void 0,I),{transitionClassNames:N}=(0,le.Z)(s,void 0,!0,void 0,I),B=(0,ce.Z)(T.replace(/([\w-]+)/g,"middle-column-$1"),N.replace(/([\w-]+)/g,"right-column-$1"),I&&"history-animation-disabled");(0,me.Z)((([e])=>{if(void 0===e||0===d)return;const t=(0,ie.YW)();(0,de.L)(document.getElementById("MiddleColumn"),t)}),[t]),(0,me.Z)((([e])=>{if(void 0===e||0===d)return;(0,C.T2)((()=>{document.body.classList.add("animating-right-column")}));const t=(0,ie.YW)();(0,de.L)(document.getElementById("RightColumn"),(()=>{t(),(0,C.T2)((()=>{document.body.classList.remove("animating-right-column")}))}))}),[s]);const L=(0,o.I4)((()=>{M(!1);const e=(0,i.A1)((0,n.Rd)());let t=0;clearInterval(fo),fo=window.setInterval((()=>{if(document.title.includes(a.ou))Io(!1);else{if(t%2==0){const t=(0,i.A1)((0,n.Rd)())-e;t>0&&(vo(`${t} notification${t>1?"s":""}`),Io(!0))}else vo(a.Ti),Io(!1);t++}}),1e3)}),[M]),x=(0,o.I4)((()=>{M(!0),clearInterval(fo),fo=void 0,document.title.includes(a.ou)||vo(a.Ti),Io(!1)}),[M]),A=(0,o.I4)((()=>{R({stickerSetShortName:void 0})}),[R]);function O(e){e.preventDefault(),e.stopPropagation()}return(0,ue.Z)(L,x),he(L),function(e=!1){(0,o.d4)((()=>{if(m.$b){if(!e)return null==ge||ge.setAttribute("content",fe),m.cj&&!m.fl&&document.addEventListener("gesturestart",Ie),()=>{null==ge||ge.setAttribute("content","width=device-width, initial-scale=1, shrink-to-fit=no"),m.cj&&!m.fl&&document.removeEventListener("gesturestart",Ie)};null==ge||ge.setAttribute("content",pe)}}),[e])}(r),o.ZP.createElement("div",{id:"Main",className:B,onDrop:O,onDragOver:O},o.ZP.createElement(nt,null),o.ZP.createElement(Ra,null),o.ZP.createElement(io,null),o.ZP.createElement(co,{isOpen:r}),o.ZP.createElement(ho,{isOpen:c}),o.ZP.createElement(lo,{isOpen:l}),o.ZP.createElement(uo,{isOpen:u}),h&&o.ZP.createElement(qt,{key:h.id,message:h,origin:g,noUi:!0}),o.ZP.createElement(mo,{url:f}),o.ZP.createElement(go,{isOpen:p}),o.ZP.createElement(ws.Z,{isOpen:Boolean(y),onClose:A,stickerSetShortName:y}))})));a.eM&&console.log(">>> FINISH LOAD MAIN BUNDLE"),(0,n.Rd)().connectionState||(0,n.uC)().initApi()},4524:(e,t,s)=>{e.exports=s.p+"telegram-logo-filled.67469f6dc5e301e8e0bd..svg"}}]);
|
||
//# sourceMappingURL=164.7c4902ece76a25a89c70.js.map
|