telegram-tt/dist/4.a194de4797679ae7a3bb.js
Alexander Zinchuk db36a289e4 [Build]
2021-08-12 03:37:57 +03:00

2 lines
229 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

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

(window.webpackJsonp=window.webpackJsonp||[]).push([[4],{106:function(e,t,a){"use strict";a.r(t),a.d(t,"Main",(function(){return rc}));var s=a(1),n=a(2),c=a(0),o=(a(86),a(11)),r=a(7),i=a(53),l=a(4);function d(e){const{chatId:t,threadId:a}=Object(r.z)(e)||{};return t&&a?(e=Object(o.Z)(e,t,a,!1),e=Object(o.u)(e,t,a,void 0)):e}Object(s.b)("openLocalTextSearch",e=>{const{chatId:t,threadId:a}=Object(r.z)(e)||{};if(t&&a)return Object(o.Z)(e,t,a,!0)}),Object(s.b)("closeLocalTextSearch",d),Object(s.b)("setLocalTextSearchQuery",(e,t,a)=>{const{chatId:s,threadId:n}=Object(r.z)(e)||{};if(!s||!n)return;const{query:c}=a,d=Object(l.a)(s,n),{query:b}=e.localTextSearch.byChatThreadKey[d]||{};return c!==b&&(e=Object(o.u)(e,s,n,i.a)),e=Object(o.Z)(e,s,n,!0,c)}),Object(s.b)("setLocalMediaSearchType",(e,t,a)=>{const{chatId:s}=Object(r.z)(e)||{};if(!s)return;const{mediaType:n}=a;return Object(o.Y)(e,s,n)}),Object(s.b)("openChat",(e,t,a)=>{const{id:n,threadId:c=-1,type:i="thread",shouldReplaceHistory:l=!1}=a,b=Object(r.z)(e);return b&&b.chatId===n&&b.threadId===c&&b.type===i||(e=Object(o.y)(e,n,c,"replyStack",[]),e=d(e=Object(o.o)(e)),e={...e,messages:{...e.messages,contentToBeScheduled:void 0},...n!==e.forwardMessages.toChatId&&{forwardMessages:{}}},Object(s.g)(e)),Object(o.O)(e,n,c,i,l)}),Object(s.b)("openPreviousChat",e=>Object(o.O)(e,void 0)),Object(s.b)("openChatWithInfo",(e,t,a)=>{Object(s.g)({...e,isChatInfoShown:!0}),t.openChat(a)}),Object(s.b)("resetChatCreation",e=>({...e,chatCreation:void 0})),Object(s.b)("setNewChatMembersDialogState",(e,t,a)=>({...e,newChatMembersProgress:a})),Object(s.b)("openNextChat",(e,t,a)=>{const{targetIndexDelta:s,orderedIds:n}=a,{chatId:c}=Object(r.z)(e)||{};if(!c)return void t.openChat({id:n[0]});const o=n.indexOf(c);if(-1===o)return;const i=n[o+s];t.openChat({id:i,shouldReplaceHistory:!0})});var b=a(8),u=a(13),m=a(6),h=a(3);const O=n.C+n.c;let j;Object(s.b)("setScrollOffset",(e,t,a)=>{const{chatId:s,threadId:n,scrollOffset:c}=a;return Object(o.y)(e,s,n,"scrollOffset",c)}),Object(s.b)("setReplyingToId",(e,t,a)=>{const{messageId:s}=a,n=Object(r.z)(e);if(!n)return;const{chatId:c,threadId:i}=n;return Object(o.y)(e,c,i,"replyingToId",s)}),Object(s.b)("setEditingId",(e,t,a)=>{const{messageId:s}=a,n=Object(r.z)(e);if(!n)return;const{chatId:c,threadId:i,type:l}=n,d="scheduled"===l?"editingScheduledId":"editingId";return Object(o.y)(e,c,i,d,s)}),Object(s.b)("editLastMessage",e=>{const{chatId:t,threadId:a}=Object(r.z)(e)||{};if(!t||!a)return;const s=Object(r.n)(e,t),n=Object(r.Lb)(e,t,a);if(!s||!n)return;const c=Object(h.g)(n,t=>Boolean(s[t]&&Object(r.b)(e,s[t],a).canEdit));return c?Object(o.y)(e,t,a,"editingId",c):void 0}),Object(s.b)("replyToNextMessage",(e,t,a)=>{const{targetIndexDelta:s}=a,{chatId:n,threadId:c}=Object(r.z)(e)||{};if(!n||!c)return;const o=Object(r.n)(e,n),i=Object(r.Lb)(e,n,c);if(!o||!i)return;const l=Object(r.ob)(e,n,c);let d;if(Object(r.Y)(e,n,c)&&l){const e=Object.keys(o),t=e.indexOf(l.toString())+s;d=t<=e.length+1&&t>=0?Number(e[t]):void 0}else if(c===b.MAIN_THREAD_ID){const t=Object(r.g)(e,n);d=t&&t.lastMessage?t.lastMessage.id:void 0}else{const t=Object(r.Gb)(e,n,c);d=t?t.lastMessageId:void 0}t.setReplyingToId({messageId:d}),t.focusMessage({chatId:n,threadId:c,messageId:d})}),Object(s.b)("openMediaViewer",(e,t,a)=>{const{chatId:s,threadId:n,messageId:c,avatarOwnerId:o,profilePhotoIndex:r,origin:i}=a;return{...e,mediaViewer:{chatId:s,threadId:n,messageId:c,avatarOwnerId:o,profilePhotoIndex:r,origin:i},forwardMessages:{}}}),Object(s.b)("closeMediaViewer",e=>({...e,mediaViewer:{}})),Object(s.b)("openAudioPlayer",(e,t,a)=>{const{chatId:s,threadId:n,messageId:c}=a;return{...e,audioPlayer:{chatId:s,threadId:n,messageId:c}}}),Object(s.b)("closeAudioPlayer",e=>({...e,audioPlayer:{}})),Object(s.b)("openPollResults",(e,t,a)=>{const{chatId:n,messageId:c}=a;Object(r.W)(e)?n===e.pollResults.chatId&&c===e.pollResults.messageId||Object(s.g)({...e,pollResults:{chatId:n,messageId:c,voters:{}}}):window.setTimeout(()=>{const e=Object(s.e)();Object(s.g)({...e,pollResults:{chatId:n,messageId:c,voters:{}}})},450)}),Object(s.b)("closePollResults",e=>{Object(s.g)({...e,pollResults:{}})}),Object(s.b)("focusLastMessage",(e,t)=>{const a=Object(r.z)(e);if(!a)return;const{chatId:s,threadId:n}=a;let c;if(n===b.MAIN_THREAD_ID){const t=Object(r.g)(e,s);c=t&&t.lastMessage?t.lastMessage.id:void 0}else{const t=Object(r.Gb)(e,s,n);c=t?t.lastMessageId:void 0}c&&t.focusMessage({chatId:s,threadId:n,messageId:c,noHighlight:!0})}),Object(s.b)("focusNextReply",(e,t)=>{const a=Object(r.z)(e);if(!a)return;const{chatId:n,threadId:c}=a,i=Object(r.nb)(e,n,c);if(i&&0!==i.length){const a=i.pop();e=Object(o.y)(e,n,c,"replyStack",[...i]),Object(s.g)(e),t.focusMessage({chatId:n,threadId:c,messageId:a})}else t.focusLastMessage()}),Object(s.b)("focusMessage",(e,t,a)=>{const{chatId:n,threadId:c=b.MAIN_THREAD_ID,messageListType:i="thread",noHighlight:l,groupedId:d,groupedChatId:m,replyMessageId:h}=a;let{messageId:g}=a;if(void 0!==d){const t=Object(r.J)(e,m,d);t&&t.length&&([g]=t)}const p=Object(r.z)(e),f=!p||n!==p.chatId||c!==p.threadId||i!==p.type;if(j&&(clearTimeout(j),j=void 0),j=window.setTimeout(()=>{let e=Object(s.e)();e=Object(o.Q)(e),e=Object(o.P)(e),Object(s.g)(e)},l?O:1500),e=Object(o.Q)(e,n,g,l),e=Object(o.P)(e,void 0),h){const t=Object(r.nb)(e,n,c)||[];e=Object(o.y)(e,n,c,"replyStack",[...t,h])}f&&(e=Object(o.P)(e,u.b.Static));const I=Object(r.Lb)(e,n,c);if(I&&I.includes(g))return Object(s.g)(e),void t.openChat({id:n,threadId:c});if(f&&(e=Object(o.y)(e,n,c,"viewportIds",void 0)),e=Object(o.y)(e,n,c,"outlyingIds",void 0),I&&!f){const t=g>I[0]?u.b.Down:u.b.Up;e=Object(o.P)(e,t)}Object(s.g)(e),t.openChat({id:n,threadId:c}),t.loadViewportMessages()}),Object(s.b)("openForwardMenu",(e,t,a)=>{const{fromChatId:s,messageIds:n,groupedId:c}=a;let o;return c&&(o=Object(r.bb)(e,s,c)),{...e,forwardMessages:{fromChatId:s,messageIds:o||n,isModalShown:!0}}}),Object(s.b)("exitForwardMode",e=>{Object(s.g)({...e,forwardMessages:{}})}),Object(s.b)("setForwardChatId",(e,t,a)=>{const{id:n}=a;Object(s.g)({...e,forwardMessages:{...e.forwardMessages,toChatId:n,isModalShown:!1}}),t.openChat({id:n}),t.closeMediaViewer(),t.exitMessageSelectMode()}),Object(s.b)("openForwardMenuForSelectedMessages",(e,t)=>{if(!e.selectedMessages)return;const{chatId:a,messageIds:s}=e.selectedMessages;t.openForwardMenu({fromChatId:a,messageIds:s})}),Object(s.b)("enterMessageSelectMode",(e,t,a)=>{const{messageId:s}=a||{},n=Object(r.s)(e);return n?Object(o.n)(e,n.id,s):e}),Object(s.b)("toggleMessageSelection",(e,t,a)=>{const{messageId:n,groupedId:c,childMessageIds:i,withShift:l}=a,d=Object(r.z)(e);if(!d)return;const{chatId:b,threadId:u,type:h}=d;e=Object(o.H)(e,b,u,h,n,c,i,l),Object(s.g)(e),e.shouldShowContextMenuHint&&(t.disableContextMenuHint(),t.showNotification({message:`To **edit** or **reply**, close this menu. Then ${m.n?"long tap":"right click"} on a message.`}))}),Object(s.b)("disableContextMenuHint",e=>{if(e.shouldShowContextMenuHint)return{...e,shouldShowContextMenuHint:!1}}),Object(s.b)("exitMessageSelectMode",o.o),Object(s.b)("openPollModal",e=>({...e,isPollModalOpen:!0})),Object(s.b)("closePollModal",e=>({...e,isPollModalOpen:!1}));Object(s.b)("setGlobalSearchQuery",(e,t,a)=>{const{query:s}=a,{chatId:n}=e.globalSearch;return Object(o.S)(e,{globalResults:{},localResults:{},resultsByType:void 0,...s?{fetchingStatus:{chats:!n,messages:!0}}:{fetchingStatus:void 0},query:s})}),Object(s.b)("addRecentlyFoundChatId",(e,t,a)=>{const{id:s}=a,{recentlyFoundChatIds:n}=e.globalSearch;if(!n)return Object(o.S)(e,{recentlyFoundChatIds:[s]});const c=n.filter(e=>e!==s);return c.unshift(s),c.length>10&&c.pop(),Object(o.S)(e,{recentlyFoundChatIds:c})}),Object(s.b)("clearRecentlyFoundChats",e=>Object(o.S)(e,{recentlyFoundChatIds:void 0})),Object(s.b)("setGlobalSearchContent",(e,t,a)=>{const{content:s}=a;return Object(o.T)(e,s)}),Object(s.b)("setGlobalSearchChatId",(e,t,a)=>{const{id:s}=a;return Object(o.S)(e,{chatId:s,query:void 0,resultsByType:void 0})}),Object(s.b)("setStickerSearchQuery",(e,t,a)=>{const{query:s}=a;return{...e,stickers:{...e.stickers,search:{query:s,resultIds:void 0}}}}),Object(s.b)("setGifSearchQuery",(e,t,a)=>{const{query:s}=a;return{...e,gifs:{...e.gifs,search:{query:s,offsetId:void 0,results:void 0}}}}),Object(s.b)("openUserInfo",(e,t,a)=>{const{id:s}=a;t.openChat({id:s})});Object(s.b)("openChat",e=>Object(o.gb)(e,void 0)),Object(s.b)("setUserSearchQuery",(e,t,a)=>{const{query:s}=a;return Object(o.pb)(e,{globalUserIds:void 0,localUserIds:void 0,fetchingStatus:Boolean(s),query:s})});a(87);var g=a(179);Object(s.b)("toggleChatInfo",e=>({...e,isChatInfoShown:!e.isChatInfoShown})),Object(s.b)("toggleManagement",e=>{const{chatId:t}=Object(r.z)(e)||{};if(t)return{...e,management:{byChatId:{...e.management.byChatId,[t]:{...e.management.byChatId[t],isActive:!(e.management.byChatId[t]||{}).isActive}}}}}),Object(s.b)("closeManagement",e=>{const{chatId:t}=Object(r.z)(e)||{};if(t)return{...e,management:{byChatId:{...e.management.byChatId,[t]:{...e.management.byChatId[t],isActive:!1}}}}}),Object(s.b)("openChat",e=>{if(m.l||m.m)return{...e,isLeftColumnShown:0===e.messages.messageLists.length}}),Object(s.b)("toggleLeftColumn",e=>({...e,isLeftColumnShown:!e.isLeftColumnShown})),Object(s.b)("addRecentEmoji",(e,t,a)=>{const{emoji:s}=a,{recentEmojis:n}=e;if(!n)return{...e,recentEmojis:[s]};const c=n.filter(e=>e!==s);return c.unshift(s),c.length>18&&c.pop(),{...e,recentEmojis:c}}),Object(s.b)("addRecentSticker",(e,t,a)=>{const{sticker:s}=a,{recent:n}=e.stickers;if(!n)return{...e,stickers:{...e.stickers,recent:{hash:0,stickers:[s]}}};const c=n.stickers.filter(e=>e.id!==s.id);return c.unshift(s),{...e,stickers:{...e.stickers,recent:{...n,stickers:c}}}}),Object(s.b)("showNotification",(e,t,a)=>{const s=a,n=[...e.notifications],c=n.findIndex(e=>e.message===s.message);return-1!==c&&n.splice(c,1),n.push(s),{...e,notifications:n}}),Object(s.b)("dismissNotification",e=>{const t=[...e.notifications];return t.pop(),{...e,notifications:t}}),Object(s.b)("showDialog",(e,t,a)=>{const{data:s}=a;if("message"in s&&s.hasErrorKey&&!Object(g.a)(s))return e;const n=[...e.dialogs];if("message"in s){const e=n.findIndex(e=>e.message===s.message);-1!==e&&n.splice(e,1)}return n.push(s),{...e,dialogs:n}}),Object(s.b)("dismissDialog",e=>{const t=[...e.dialogs];return t.pop(),{...e,dialogs:t}}),Object(s.b)("toggleSafeLinkModal",(e,t,a)=>{const{url:s}=a;return{...e,safeLinkModalUrl:s}}),Object(s.b)("openHistoryCalendar",(e,t,a)=>{const{selectedAt:s}=a;return{...e,historyCalendarSelectedAt:s}}),Object(s.b)("closeHistoryCalendar",e=>({...e,historyCalendarSelectedAt:void 0})),Object(s.b)("openPaymentModal",(e,t,a)=>{const{messageId:s}=a;return{...e,payment:{...e.payment,messageId:s,isPaymentModalOpen:!0}}}),Object(s.b)("closePaymentModal",e=>{const t=Object(o.i)(e);return Object(o.j)(t)});a(88);var p=a(5),f=a(10);const I=Object(f.h)(e=>e(),1e3,!0),v=Object(f.h)(e=>e(),3e3,!0),y=Object(f.a)(e=>e(),500,!1,!0);async function C(e,t,a){const c=await Object(p.a)("fetchChats",{limit:n.l,offsetDate:a,archived:"archived"===e,withPinned:void 0===Object(s.e)().chats.orderedPinnedIds[e],serverTimeOffset:Object(s.e)().serverTimeOffset});if(!c)return;const{chatIds:r}=c;r.length>0&&r[0]===t&&r.shift();let i=Object(s.e)();i=Object(o.g)(i,Object(h.c)(c.users,"id")),i=Object(o.N)(i,Object(h.c)(c.chats,"id")),i=Object(o.J)(i,e,r),i=Object(o.K)(i,e,c),Object.keys(c.draftsById).map(Number).forEach(e=>{i=Object(o.y)(i,e,b.MAIN_THREAD_ID,"draft",c.draftsById[e])}),Object.keys(c.replyingToById).map(Number).forEach(e=>{i=Object(o.y)(i,e,b.MAIN_THREAD_ID,"replyingToId",c.replyingToById[e])}),0!==r.length||i.chats.isFullyLoaded[e]||(i={...i,chats:{...i.chats,isFullyLoaded:{...i.chats.isFullyLoaded,[e]:!0}}}),Object(s.g)(i)}async function E(e){const t=await Object(p.a)("fetchFullChat",e);if(!t)return;const{users:a,fullInfo:n}=t;let c=Object(s.e)();a&&(c=Object(o.g)(c,Object(h.c)(a,"id"))),c=Object(o.I)(c,e.id,{fullInfo:n}),Object(s.g)(c)}async function w(e,t,a){const n=Object(s.e)(),c=Object(r.i)(n,t);if(c&&!c.isMin)return void(a?e.focusMessage({chatId:c.id,messageId:a}):e.openChat({id:c.id}));const i=Object(r.s)(n);e.openChat({id:-1});const l=await Object(p.a)("getChatByUsername",t);if(!l)return i&&e.openChat({id:i.id}),void e.showNotification({message:"User does not exist"});Object(s.g)(Object(o.I)(Object(s.e)(),l.id,l)),a?e.focusMessage({chatId:l.id,messageId:a}):e.openChat({id:l.id})}Object(s.b)("preloadTopChatMessages",(e,t)=>{(async()=>{const a=[];for(let c=0;c<n.Qb;c++){await Object(f.f)(100);const{byId:n,listIds:{active:c},orderedPinnedIds:{active:o}}=Object(s.e)().chats;if(!c)return;const{chatId:i}=Object(r.z)(e)||{},{pinnedChats:d,otherChats:u}=Object(l.Fb)(n,c,o),m=[...d,...u].find(({id:e})=>e!==i&&!a.includes(e));if(!m)return;a.push(m.id),t.loadViewportMessages({chatId:m.id,threadId:b.MAIN_THREAD_ID})}})()}),Object(s.b)("openChat",(e,t,a)=>{const{id:s,threadId:n}=a,{currentUserId:c}=e,o=Object(r.g)(e,s);if(o&&o.hasUnreadMark&&t.toggleChatUnread({id:s}),o)Object(l.pb)(o)&&!o.isMin&&t.requestChatUpdate({chatId:s});else if(s===c)Object(p.a)("fetchChat",{type:"self"});else{const t=Object(r.Kb)(e,s);t&&Object(p.a)("fetchChat",{type:"user",user:t})}if(n!==b.MAIN_THREAD_ID){Object(r.Ib)(e,s,n)||t.requestThreadInfoUpdate({chatId:s,threadId:n})}}),Object(s.b)("openSupportChat",(e,t)=>{const a=Object(r.Db)(e);t.openChat({id:a?a.id:-1}),a||(async()=>{const e=await Object(p.a)("fetchChat",{type:"support"});e&&t.openChat({id:e.chatId})})()}),Object(s.b)("openTipsChat",(e,t,a)=>{const{langCode:s}=a,c="pt-br"===s?"BR":n.S.includes(s)?s.toUpperCase():"";t.openChatByUsername({username:`${n.Pb}${c}`})}),Object(s.b)("loadMoreChats",(e,t,a)=>{const{listType:s="active"}=a,n=e.chats.listIds[s];if(e.chats.isFullyLoaded[s])return;const c=n?n.map(t=>e.chats.byId[t]).filter(t=>Boolean(t&&t.lastMessage)&&!Object(r.N)(e,t.id)).sort((e,t)=>e.lastMessage.date-t.lastMessage.date)[0]:void 0;I(c?()=>C(s,c.id,c.lastMessage.date):()=>C(s))}),Object(s.b)("loadFullChat",(e,t,a)=>{const{chatId:s,force:n}=a,c=Object(r.g)(e,s);c&&(n?E(c):y(()=>E(c)))}),Object(s.b)("loadTopChats",()=>{v(()=>C("active"))}),Object(s.b)("requestChatUpdate",(e,t,a)=>{const{serverTimeOffset:s}=e,{chatId:n}=a,c=Object(r.g)(e,n);c&&Object(p.a)("requestChatUpdate",{chat:c,serverTimeOffset:s})}),Object(s.b)("updateChatMutedState",(e,t,a)=>{const{serverTimeOffset:n}=e,{chatId:c,isMuted:i}=a,l=Object(r.g)(e,c);l&&(Object(s.g)(Object(o.I)(e,c,{isMuted:i})),Object(p.a)("updateChatMutedState",{chat:l,isMuted:i,serverTimeOffset:n}))}),Object(s.b)("createChannel",(e,t,a)=>{const{title:n,about:c,photo:i,memberIds:l}=a;!async function(e,t,a,n){Object(s.g)({...Object(s.e)(),chatCreation:{progress:u.a.InProgress}});const c=await Object(p.a)("createChannel",{title:e,about:a,users:t});if(!c)return;const{id:r,accessHash:i}=c;let l=Object(s.e)();l=Object(o.I)(l,r,c),l={...l,chatCreation:{...l.chatCreation,progress:c?u.a.Complete:u.a.Error}},Object(s.g)(l),Object(s.d)().openChat({id:r}),r&&i&&n&&await Object(p.a)("editChatPhoto",{chatId:r,accessHash:i,photo:n})}(n,l.map(t=>Object(r.Kb)(e,t)).filter(Boolean),c,i)}),Object(s.b)("joinChannel",(e,t,a)=>{const{chatId:s}=a,n=Object(r.g)(e,s);if(!n)return;const{id:c,accessHash:o}=n;c&&o&&Object(p.a)("joinChannel",{channelId:c,accessHash:o})}),Object(s.b)("deleteChatUser",(e,t,a)=>{(async()=>{const{chatId:s,userId:n}=a,c=Object(r.g)(e,s),o=Object(r.Kb)(e,n);if(!c||!o)return;await Object(p.a)("deleteChatUser",{chat:c,user:o});const i=Object(r.z)(e);i&&i.chatId===s&&e.currentUserId===n&&t.openChat({id:void 0})})()}),Object(s.b)("deleteChat",(e,t,a)=>{(async()=>{const{chatId:s}=a,n=Object(r.g)(e,s);if(!n)return;await Object(p.a)("deleteChat",{chatId:n.id});const c=Object(r.z)(e);c&&c.chatId===s&&t.openChat({id:void 0})})()}),Object(s.b)("leaveChannel",(e,t,a)=>{(async()=>{const{chatId:s}=a,n=Object(r.g)(e,s);if(!n)return;const{id:c,accessHash:o}=n;c&&o&&await Object(p.a)("leaveChannel",{channelId:c,accessHash:o});const i=Object(r.z)(e);i&&i.chatId===s&&t.openChat({id:void 0})})()}),Object(s.b)("deleteChannel",(e,t,a)=>{(async()=>{const{chatId:s}=a,n=Object(r.g)(e,s);if(!n)return;const{id:c,accessHash:o}=n;c&&o&&await Object(p.a)("deleteChannel",{channelId:c,accessHash:o});const i=Object(r.z)(e);i&&i.chatId===s&&t.openChat({id:void 0})})()}),Object(s.b)("createGroupChat",(e,t,a)=>{const{title:n,memberIds:c,photo:i}=a;!async function(e,t,a){Object(s.g)({...Object(s.e)(),chatCreation:{progress:u.a.InProgress}});const n=await Object(p.a)("createGroupChat",{title:e,users:t});if(!n)return;const{id:c}=n;let r=Object(s.e)();r=Object(o.I)(r,c,n),r={...r,chatCreation:{...r.chatCreation,progress:n?u.a.Complete:u.a.Error}},Object(s.g)(r),Object(s.d)().openChat({id:c}),c&&a&&await Object(p.a)("editChatPhoto",{chatId:c,photo:a})}(n,c.map(t=>Object(r.Kb)(e,t)).filter(Boolean),i)}),Object(s.b)("toggleChatPinned",(e,t,a)=>{const{id:s,folderId:c}=a,o=Object(r.g)(e,s);if(o)if(c){const t=Object(r.j)(e,c);if(t){const a=!Object(r.N)(e,s,c),{pinnedChatIds:n,includedChatIds:o}=t,i=a?[s,...n||[]]:(n||[]).filter(e=>e!==s),l=[s,...o];Object(p.a)("editChatFolder",{id:c,folderUpdate:{...t,pinnedChatIds:i,includedChatIds:l}})}}else{const t=Object(r.k)(e,s),a=Object(r.N)(e,s,"archived"===t?n.i:void 0);Object(p.a)("toggleChatPinned",{chat:o,shouldBePinned:!a})}}),Object(s.b)("toggleChatArchived",(e,t,a)=>{const{id:s}=a,c=Object(r.g)(e,s);c&&Object(p.a)("toggleChatArchived",{chat:c,folderId:Object(l.kb)(c)?0:n.i})}),Object(s.b)("loadChatFolders",()=>{!async function(){const e=await Object(p.a)("fetchChatFolders");if(e){const t=Object(s.e)();Object(s.g)({...t,chatFolders:{...t.chatFolders,...e}})}}()}),Object(s.b)("loadRecommendedChatFolders",()=>{!async function(){const e=await Object(p.a)("fetchRecommendedChatFolders");if(e){const t=Object(s.e)();Object(s.g)({...t,chatFolders:{...t.chatFolders,recommended:e}})}}()}),Object(s.b)("editChatFolder",(e,t,a)=>{const{id:s,folderUpdate:n}=a,c=Object(r.j)(e,s);c&&Object(p.a)("editChatFolder",{id:s,folderUpdate:{id:s,emoticon:c.emoticon,pinnedChatIds:c.pinnedChatIds,...n}})}),Object(s.b)("addChatFolder",(e,t,a)=>{const{folder:c}=a,{orderedIds:o}=e.chatFolders;!async function(e,t){const{id:a,description:n,...c}=e;if(await Object(p.a)("editChatFolder",{id:t+1,folderUpdate:{id:t+1,...c}}),!n)return;const o=Object(s.e)(),{recommended:r}=o.chatFolders;r&&Object(s.g)({...o,chatFolders:{...o.chatFolders,recommended:r.filter(({id:e})=>e!==a)}})}(c,o&&o.length?Math.max.apply(Math.max,o):n.i)}),Object(s.b)("deleteChatFolder",(e,t,a)=>{const{id:s}=a;Object(r.j)(e,s)&&async function(e){await Object(p.a)("deleteChatFolder",e)}(s)}),Object(s.b)("toggleChatUnread",(e,t,a)=>{const{id:s}=a,{serverTimeOffset:n}=e,c=Object(r.g)(e,s);c&&(c.unreadCount?Object(p.a)("markMessageListRead",{serverTimeOffset:n,chat:c,threadId:b.MAIN_THREAD_ID}):Object(p.a)("toggleDialogUnread",{chat:c,hasUnreadMark:!c.hasUnreadMark}))}),Object(s.b)("openTelegramLink",(e,t,a)=>{const{url:s}=a;let c=n.tb.exec(s);if(c){const e=c[1];(async()=>{const a=await Object(p.a)("openChatByInvite",e);a&&t.openChat({id:a.chatId})})()}else{c=n.ub.exec(s);const e=c[1],a=c[2]?Number(c[2]):void 0,o=c[3]?Number(c[3]):void 0;"c"===e&&a&&o?t.focusMessage({chatId:-a,messageId:o}):w(t,e,a)}}),Object(s.b)("acceptInviteConfirmation",(e,t,a)=>{const{hash:s}=a;(async()=>{const e=await Object(p.a)("importChatInvite",{hash:s});e&&t.openChat({id:e.id})})()}),Object(s.b)("openChatByUsername",(e,t,a)=>{const{username:s}=a;w(t,s)}),Object(s.b)("togglePreHistoryHidden",(e,t,a)=>{const{chatId:s,isEnabled:n}=a;let c=Object(r.g)(e,s);c&&(async()=>{if(Object(l.lb)(c)){if(c=await Object(p.a)("migrateChat",c),!c)return;t.openChat({id:c.id})}Object(p.a)("togglePreHistoryHidden",{chat:c,isEnabled:n})})()}),Object(s.b)("updateChatDefaultBannedRights",(e,t,a)=>{const{chatId:s,bannedRights:n}=a,c=Object(r.g)(e,s);c&&Object(p.a)("updateChatDefaultBannedRights",{chat:c,bannedRights:n})}),Object(s.b)("updateChatMemberBannedRights",(e,t,a)=>{const{chatId:n,userId:c,bannedRights:i}=a;let d=Object(r.g)(e,n);const b=Object(r.Kb)(e,c);d&&b&&(async()=>{if(Object(l.lb)(d)){if(d=await Object(p.a)("migrateChat",d),!d)return;t.openChat({id:d.id})}await Object(p.a)("updateChatMemberBannedRights",{chat:d,user:b,bannedRights:i});const e=Object(s.e)(),a=Object(r.g)(e,n);if(!a||!a.fullInfo)return;const{members:u,kickedMembers:m}=a.fullInfo,h=!!i.viewMessages,O=!Object.keys(i).length;Object(s.g)(Object(o.I)(e,n,{fullInfo:{...a.fullInfo,...u&&h&&{members:u.filter(e=>e.userId!==c)},...u&&!h&&{members:u.map(e=>e.userId===c?{...e,bannedRights:i}:e)},...O&&m&&{kickedMembers:m.filter(e=>e.userId!==c)}}}))})()}),Object(s.b)("updateChatAdmin",(e,t,a)=>{const{chatId:n,userId:c,adminRights:i,customTitle:d}=a;let b=Object(r.g)(e,n);const u=Object(r.Kb)(e,c);b&&u&&(async()=>{if(Object(l.lb)(b)){if(b=await Object(p.a)("migrateChat",b),!b)return;t.openChat({id:b.id})}await Object(p.a)("updateChatAdmin",{chat:b,user:u,adminRights:i,customTitle:d});const e=Object(s.e)(),a=Object(r.g)(e,n);if(!a||!a.fullInfo)return;const{adminMembers:m}=a.fullInfo,h=!Object.keys(i).length;Object(s.g)(Object(o.I)(e,n,{fullInfo:{...a.fullInfo,...m&&h&&{adminMembers:m.filter(e=>e.userId!==c)},...m&&!h&&{adminMembers:m.map(e=>e.userId===c?{...e,adminRights:i,customTitle:d}:e)}}}))})()}),Object(s.b)("updateChat",(e,t,a)=>{const{chatId:n,title:c,about:i,photo:l}=a,d=Object(r.g)(e,n);d&&(async()=>{Object(s.g)(Object(o.cb)(Object(s.e)(),u.f.InProgress)),await Promise.all([d.title!==c?Object(p.a)("updateChatTitle",d,c):void 0,d.fullInfo&&d.fullInfo.about!==i?Object(p.a)("updateChatAbout",d,i):void 0,l?Object(p.a)("editChatPhoto",{chatId:n,accessHash:d.accessHash,photo:l}):void 0]),Object(s.g)(Object(o.cb)(Object(s.e)(),u.f.Complete))})()}),Object(s.b)("toggleSignatures",(e,t,a)=>{const{chatId:s,isEnabled:n}=a,c=Object(r.g)(e,s);c&&Object(p.a)("toggleSignatures",{chat:c,isEnabled:n})}),Object(s.b)("loadGroupsForDiscussion",()=>{(async()=>{const e=await Object(p.a)("fetchGroupsForDiscussion");if(!e)return;const t=e.reduce((e,t)=>(t&&(e[t.id]=t),e),{}),a=Object(o.c)(Object(s.e)(),t);Object(s.g)({...a,chats:{...a.chats,forDiscussionIds:Object.keys(t).map(Number)}})})()}),Object(s.b)("linkDiscussionGroup",(e,t,a)=>{const{channelId:s,chatId:n}=a,c=Object(r.g)(e,s);let o=Object(r.g)(e,n);c&&o&&(async()=>{if(Object(l.lb)(o)){if(o=await Object(p.a)("migrateChat",o),!o)return;t.openChat({id:o.id})}let{fullInfo:e}=o;if(!e){const t=await Object(p.a)("fetchFullChat",o);if(!t)return;e=t.fullInfo}e.isPreHistoryHidden&&await Object(p.a)("togglePreHistoryHidden",{chat:o,isEnabled:!1}),Object(p.a)("setDiscussionGroup",{channel:c,chat:o})})()}),Object(s.b)("unlinkDiscussionGroup",(e,t,a)=>{const{channelId:s}=a,n=Object(r.g)(e,s);if(!n)return;let c;n.fullInfo&&n.fullInfo.linkedChatId&&(c=Object(r.g)(e,n.fullInfo.linkedChatId)),(async()=>{await Object(p.a)("setDiscussionGroup",{channel:n}),c&&E(c)})()}),Object(s.b)("setActiveChatFolder",(e,t,a)=>({...e,chatFolders:{...e.chatFolders,activeChatFolder:a}})),Object(s.b)("loadMoreMembers",e=>{(async()=>{const{chatId:t}=Object(r.z)(e)||{},a=t?Object(r.g)(e,t):void 0;if(!a||Object(l.lb)(a))return;const n=a.fullInfo&&a.fullInfo.members&&a.fullInfo.members.length||void 0,c=await Object(p.a)("fetchMembers",a.id,a.accessHash,"recent",n);if(!c)return;const{members:i,users:d}=c;i&&i.length&&(e=Object(s.e)(),e=Object(o.g)(e,Object(h.c)(d,"id")),e=Object(o.I)(e,a.id,{fullInfo:{...a.fullInfo,members:[...(a.fullInfo||{}).members||[],...i||[]]}}),Object(s.g)(e))})()}),Object(s.b)("addChatMembers",(e,t,a)=>{const{chatId:s,memberIds:n}=a,c=Object(r.g)(e,s),o=n.map(t=>Object(r.Kb)(e,t)).filter(Boolean);c&&o.length&&(t.setNewChatMembersDialogState(u.i.Loading),(async()=>{await Object(p.a)("addChatMembers",c,o),t.setNewChatMembersDialogState(u.i.Closed),E(c)})())}),Object(s.b)("deleteChatMember",(e,t,a)=>{const{chatId:s,userId:n}=a,c=Object(r.g)(e,s),o=Object(r.Kb)(e,n);c&&o&&(async()=>{await Object(p.a)("deleteChatMember",c,o),E(c)})()});const S=new Map,M=Object(f.h)(e=>e(),1e3,!0);async function k(e,t,a,c,i=!1,l=!1){const d=e.id;let b;switch(c){case u.e.Backwards:b=void 0;break;case u.e.Around:b=-(Math.round(n.gb/2)+1);break;case u.e.Forwards:b=-(n.gb+1)}const m=await Object(p.a)("fetchMessages",{chat:Object(r.Hb)(Object(s.e)(),d,t),offsetId:a,addOffset:b,limit:n.gb,threadId:t});if(!m)return;const{messages:O,users:j,chats:g,threadInfos:f}=m,I=Object(h.c)(O,"id"),v=Object.keys(I).map(Number);let y=Object(s.e)();y=Object(o.b)(y,d,I),y=i?Object(o.eb)(y,d,t,v):Object(o.W)(y,d,t,v),y=Object(o.g)(y,Object(h.c)(j,"id")),y=Object(o.c)(y,Object(h.c)(g,"id")),y=Object(o.mb)(y,d,f);let C=Object(r.Z)(y,d,t);const E=Object(r.hb)(y,d,t);if(i&&C&&E&&Object(h.b)(C,E)&&(y=Object(o.W)(y,d,t,E),C=Object(r.Z)(y,d,t),y=Object(o.y)(y,d,t,"outlyingIds",void 0),i=!1),!l){const e=i?E:C,{newViewportIds:s}=N(e,a,c);y=Object(o.A)(y,d,t,s)}Object(s.g)(y)}function N(e,t,a){const{length:s}=e,c=t?function(e,t){return t<e[0]?0:t>e[e.length-1]?e.length-1:e.findIndex((a,s)=>a===t||a<t&&e[s+1]>t)}(e,t):-1,o=a===u.e.Backwards?c:c+1||s,r=o-n.gb,i=o+n.gb-1,l=e.slice(Math.max(0,r),i+1);let d,b;switch(a){case u.e.Backwards:d=o>0,b=r>=0;break;case u.e.Forwards:d=o<s,b=i<=s-1;break;case u.e.Around:default:d=l.length>0,b=l.length===n.gb}return{newViewportIds:l,areSomeLocal:d,areAllLocal:b}}async function T(e){let t;const a=e.attachment?(e,n)=>{S.has(n)||(t=n,S.set(n,a));const c=Object(s.e)();Object(s.g)({...c,fileUploads:{byMessageLocalId:{...c.fileUploads.byMessageLocalId,[n]:{progress:e}}}})}:void 0;(e.replyingTo||m.e)&&await Object(f.g)();const n=Object(s.e)();e.serverTimeOffset=n.serverTimeOffset;const c=Object(r.z)(n);if(!c)return;const{threadId:o}=c;e.replyingTo||o===b.MAIN_THREAD_ID||(e.replyingTo=Object(r.Ib)(n,e.chat.id,o)),await Object(p.a)("sendMessage",e,a),a&&t&&S.delete(t)}Object(s.b)("loadViewportMessages",(e,t,a)=>{const{direction:s=u.e.Around,isBudgetPreload:c=!1}=a||{};let{chatId:i,threadId:l}=a||{};if(!i){const t=Object(r.z)(e);if(!t)return;i=t.chatId,l=t.threadId}const d=Object(r.g)(e,i);if(!d||d.isRestricted)return;const b=Object(r.Lb)(e,i,l),m=Object(r.Z)(e,i,l),h=Object(r.hb)(e,i,l);if(b&&b.length&&s!==u.e.Around){const a=s===u.e.Backwards?b[0]:b[b.length-1],n=Boolean(h),r=n?h:m,{newViewportIds:O,areSomeLocal:j,areAllLocal:g}=N(r,a,s);if(j&&(e=Object(o.A)(e,i,l,O)),async function(e,t,a,s,n,c,o,r){t||await k(n,c,r,o,a,s);s||(await Promise.resolve(),e.loadViewportMessages({chatId:n.id,threadId:c,direction:o,isBudgetPreload:!0}))}(t,g,n,c,d,l,s,a),c)return}else{const t=Object(r.I)(e,i)||Object(r.mb)(e,i,l),a=Boolean(t&&m&&!m.includes(t)),s=(a?h:m)||[],{newViewportIds:b,areSomeLocal:O,areAllLocal:j}=N(s,t,u.e.Around);O&&b.length>=n.gb&&(e=Object(o.A)(e,i,l,b)),j||k(d,l,t,u.e.Around,a,c)}return e}),Object(s.b)("loadMessage",(e,t,a)=>{const{chatId:n,messageId:c,replyOriginForId:i}=a,l=Object(r.g)(e,n);l&&async function(e,t,a){const n=await Object(p.a)("fetchMessage",{chat:e,messageId:t});if(!n)return;if(n===b.MESSAGE_DELETED){if(a){let t=Object(s.e)();const n=Object(r.l)(t,e.id,a);t=Object(o.M)(t,e.id,a,{...n,replyToMessageId:void 0}),Object(s.g)(t)}return}let c=Object(s.e)();c=Object(o.M)(c,e.id,t,n.message),c=Object(o.g)(c,Object(h.c)(n.users,"id")),Object(s.g)(c)}(l,c,i)}),Object(s.b)("sendMessage",(e,t,a)=>{const s=Object(r.z)(e);if(!s)return;const{chatId:c,threadId:o,type:i}=s;if("scheduled"===i&&!a.scheduledAt)return{...e,messages:{...e.messages,contentToBeScheduled:a}};const l=Object(r.g)(e,c);t.setReplyingToId({messageId:void 0}),t.clearWebPagePreview({chatId:c,threadId:o,value:!1});const d={...a,chat:l,replyingTo:Object(r.ob)(e,c,o),noWebPage:Object(r.db)(e,c,o)},b=!a.attachments||a.attachments.length<=1,u=!b&&a.attachments&&a.attachments.length>1;if(b){const{attachments:e,...t}=d;T({...t,attachment:e?e[0]:void 0})}else if(u){const{text:e,entities:t,attachments:a,...s}=d,c=Object(h.n)(a,n.W);for(let a=0;a<c.length;a++){const[n,...o]=c[a],r=`${Date.now()}${a}`;T({...s,text:0===a?e:void 0,entities:0===a?t:void 0,attachment:n,groupedId:o.length>0?r:void 0}),o.forEach(e=>{T({...s,attachment:e,groupedId:r})})}}else{const{text:e,entities:t,attachments:a,replyingTo:s,...n}=d;e&&T({...n,text:e,entities:t,replyingTo:s}),a.forEach(e=>{T({...n,attachment:e})})}}),Object(s.b)("editMessage",(e,t,a)=>{const{serverTimeOffset:s}=e,{text:n,entities:c}=a,o=Object(r.z)(e);if(!o)return;const{chatId:i,threadId:l,type:d}=o,b=Object(r.g)(e,i),u=Object(r.E)(e,i,l,d);b&&u&&(Object(p.a)("editMessage",{chat:b,message:u,text:n,entities:c,noWebPage:Object(r.db)(e,i,l),serverTimeOffset:s}),t.setEditingId({messageId:void 0}))}),Object(s.b)("cancelSendingMessage",(e,t,a)=>{const{chatId:s,messageId:n}=a,c=Object(r.l)(e,s,n),o=c&&S.get(c.previousLocalId||c.id);o&&Object(p.b)(o),t.apiUpdate({"@type":"deleteMessages",ids:[n],chatId:s})}),Object(s.b)("saveDraft",(e,t,a)=>{const{chatId:s,threadId:n,draft:c}=a;if(!c)return;const{text:i,entities:l}=c,d=Object(r.g)(e,s);return n===b.MAIN_THREAD_ID&&Object(p.a)("saveDraft",{chat:d,text:i,entities:l,replyToMsgId:Object(r.ob)(e,s,n)}),e=Object(o.y)(e,s,n,"draft",c),e=Object(o.I)(e,s,{draftDate:Math.round(Date.now()/1e3)})}),Object(s.b)("clearDraft",(e,t,a)=>{const{chatId:s,threadId:n,localOnly:c}=a;if(!Object(r.C)(e,s,n))return;const i=Object(r.g)(e,s);return c||n!==b.MAIN_THREAD_ID||Object(p.a)("clearDraft",i),e=Object(o.y)(e,s,n,"draft",void 0),e=Object(o.I)(e,s,{draftDate:void 0})}),Object(s.b)("toggleMessageWebPage",(e,t,a)=>{const{chatId:s,threadId:n,noWebPage:c}=a;return Object(o.y)(e,s,n,"noWebPage",c)}),Object(s.b)("pinMessage",(e,t,a)=>{const s=Object(r.s)(e);if(!s)return;const{messageId:n,isUnpin:c,isOneSide:o,isSilent:i}=a;Object(p.a)("pinMessage",{chat:s,messageId:n,isUnpin:c,isOneSide:o,isSilent:i})}),Object(s.b)("unpinAllMessages",(e,t,a)=>{const n=Object(r.g)(e,a.chatId);n&&async function(e){await Object(p.a)("unpinAllMessages",{chat:e});let t=Object(s.e)();t=Object(o.y)(t,e.id,b.MAIN_THREAD_ID,"pinnedIds",[]),Object(s.g)(t)}(n)}),Object(s.b)("deleteMessages",(e,t,a)=>{const{messageIds:s,shouldDeleteForAll:n}=a,c=Object(r.z)(e);if(!c)return;const{chatId:o,threadId:i}=c,l=Object(r.g)(e,o);Object(p.a)("deleteMessages",{chat:l,messageIds:s,shouldDeleteForAll:n});const d=Object(r.D)(e,o,i);s.includes(d)&&t.setEditingId({messageId:void 0})}),Object(s.b)("deleteScheduledMessages",(e,t,a)=>{const{messageIds:s}=a,n=Object(r.z)(e);if(!n)return;const{chatId:c}=n,o=Object(r.g)(e,c);Object(p.a)("deleteScheduledMessages",{chat:o,messageIds:s});const i=Object(r.F)(e,c);s.includes(i)&&t.setEditingId({messageId:void 0})}),Object(s.b)("deleteHistory",(e,t,a)=>{(async()=>{const{chatId:s,shouldDeleteForAll:n}=a,c=Object(r.g)(e,s);if(!c)return;const o=c.lastMessage&&c.lastMessage.id;await Object(p.a)("deleteHistory",{chat:c,shouldDeleteForAll:n,maxId:o});const i=Object(r.z)(e);i&&i.chatId===s&&t.openChat({id:void 0})})()}),Object(s.b)("reportMessages",(e,t,a)=>{(async()=>{const{messageIds:s,reason:n,description:c}=a,o=Object(r.z)(e);if(!o)return;const{chatId:i}=o,l=Object(r.g)(e,i),d=await Object(p.a)("reportMessages",{peer:l,messageIds:s,reason:n,description:c});t.showNotification({message:d?"Thank you! Your report will be reviewed by our team.":"Error occured while submiting report. Please, try again later."})})()}),Object(s.b)("markMessageListRead",(e,t,a)=>{const{serverTimeOffset:s}=e,n=Object(r.z)(e);if(!n)return;const{chatId:c,threadId:o}=n,i=Object(r.Hb)(e,c,o);if(!i)return;const{maxId:l}=a;M(()=>{Object(p.a)("markMessageListRead",{serverTimeOffset:s,chat:i,threadId:o,maxId:l})})}),Object(s.b)("markMessagesRead",(e,t,a)=>{const s=Object(r.s)(e);if(!s)return;const{messageIds:n}=a;Object(p.a)("markMessagesRead",{chat:s,messageIds:n})}),Object(s.b)("loadWebPagePreview",(e,t,a)=>{const{text:n}=a;!async function(e){const t=await Object(p.a)("fetchWebPagePreview",{message:e});Object(s.g)({...Object(s.e)(),webPagePreview:t})}(n)}),Object(s.b)("clearWebPagePreview",e=>{if(e.webPagePreview)return{...e,webPagePreview:void 0}}),Object(s.b)("sendPollVote",(e,t,a)=>{const{chatId:s,messageId:n,options:c}=a,o=Object(r.g)(e,s);o&&Object(p.a)("sendPollVote",{chat:o,messageId:n,options:c})}),Object(s.b)("loadPollOptionResults",(e,t,a)=>{const{chat:n,messageId:c,option:r,offset:i,limit:l,shouldResetVoters:d}=a;!async function(e,t,a,n,c,r){const i=await Object(p.a)("loadPollOptionResults",{chat:e,messageId:t,option:a,offset:n,limit:c});if(!i)return;let l=Object(s.e)();l=Object(o.g)(l,Object(h.c)(i.users,"id"));const{voters:d}=l.pollResults;Object(s.g)({...l,pollResults:{...l.pollResults,voters:{...d,[a]:[...!r&&d&&d[a]?d[a]:[],...i&&i.users.map(e=>e.id)].filter((e,t,a)=>a.indexOf(e)===t)},offsets:{...l.pollResults.offsets?l.pollResults.offsets:{},[a]:i.nextOffset||""}}})}(n,c,r,i,l,d)}),Object(s.b)("forwardMessages",e=>{const{fromChatId:t,messageIds:a,toChatId:n}=e.forwardMessages,c=t?Object(r.g)(e,t):void 0,o=n?Object(r.g)(e,n):void 0,i=t&&a?a.sort((e,t)=>e-t).map(a=>Object(r.l)(e,t,a)).filter(Boolean):void 0;c&&o&&i&&i.length&&function(e,t,a){Object(p.a)("forwardMessages",{fromChat:e,toChat:t,messages:a,serverTimeOffset:Object(s.e)().serverTimeOffset}),Object(s.g)({...Object(s.e)(),forwardMessages:{}})}(c,o,i)}),Object(s.b)("loadScheduledHistory",e=>{const t=Object(r.s)(e);if(!t)return;const{hash:a}=e.scheduledMessages.byChatId[t.id]||{};!async function(e,t){const a=await Object(p.a)("fetchScheduledHistory",{chat:e,hash:t});if(!a)return;const{hash:n,messages:c}=a,r=Object(h.c)(c,"id"),i=Object.keys(r).map(Number).sort((e,t)=>t-e);let l=Object(s.e)();l=Object(o.v)(l,e.id,r,n),l=Object(o.y)(l,e.id,b.MAIN_THREAD_ID,"scheduledIds",i),Object(s.g)(l)}(t,a)}),Object(s.b)("sendScheduledMessages",(e,t,a)=>{const{chatId:s,id:n}=a,c=Object(r.g)(e,s);c&&Object(p.a)("sendScheduledMessages",{chat:c,ids:[n]})}),Object(s.b)("rescheduleMessage",(e,t,a)=>{const{chatId:s,messageId:n,scheduledAt:c}=a,o=Object(r.g)(e,s),i=o&&Object(r.rb)(e,o.id,n);o&&i&&Object(p.a)("rescheduleMessage",{chat:o,message:i,scheduledAt:c})}),Object(s.b)("requestThreadInfoUpdate",(e,t,a)=>{const{chatId:s,threadId:n}=a,c=Object(r.Hb)(e,s,n);c&&Object(p.a)("requestThreadInfoUpdate",{chat:c,threadId:n})}),Object(s.b)("loadPinnedMessages",(e,t,a)=>{const{chatId:n}=a,c=Object(r.g)(e,n);c&&async function(e){const t=await Object(p.a)("fetchPinnedMessages",{chat:e});if(!t)return;const{messages:a,chats:n,users:c}=t,r=Object(h.c)(a,"id"),i=Object.keys(r).map(Number).sort((e,t)=>t-e);let l=Object(s.e)();l=Object(o.b)(l,e.id,r),l=Object(o.y)(l,e.id,b.MAIN_THREAD_ID,"pinnedIds",i),l=Object(o.g)(l,Object(h.c)(c,"id")),l=Object(o.c)(l,Object(h.c)(n,"id")),Object(s.g)(l)}(c)});var P=a(55);const A=Object(f.h)(e=>e(),500,!1);async function R(e,t){const a=await Object(p.a)("searchGifs",{query:e,offset:t});a&&Object(s.g)(Object(o.R)(Object(s.e)(),!t,a.gifs,a.nextOffset))}Object(s.b)("loadStickerSets",e=>{const{hash:t}=e.stickers.added||{};!async function(e=0){const t=await Object(p.a)("fetchStickerSets",{hash:e});if(!t)return;Object(s.g)(Object(o.jb)(Object(s.e)(),"added",t.hash,t.sets))}(t)}),Object(s.b)("loadAddedStickers",(e,t)=>{const{setIds:a}=e.stickers.added;a&&a.length&&(async()=>{for(let e=0;e<a.length;e++)t.loadStickers({stickerSetId:a[e]}),e%50==0&&e>0&&await Object(f.f)(500)})()}),Object(s.b)("loadRecentStickers",e=>{const{hash:t}=e.stickers.recent||{};!async function(e=0){const t=await Object(p.a)("fetchRecentStickers",{hash:e});if(!t)return;const a=Object(s.e)();Object(s.g)({...a,stickers:{...a.stickers,recent:t}})}(t)}),Object(s.b)("loadFavoriteStickers",e=>{const{hash:t}=e.stickers.favorite||{};!async function(e=0){const t=await Object(p.a)("fetchFavoriteStickers",{hash:e});if(!t)return;const a=Object(s.e)();Object(s.g)({...a,stickers:{...a.stickers,favorite:t}})}(t)}),Object(s.b)("loadGreetingStickers",e=>{const{hash:t}=e.stickers.greeting||{};(async()=>{const e=await Object(p.a)("fetchStickersForEmoji",{emoji:"👋⭐️",hash:t});if(!e)return;const a=Object(s.e)();Object(s.g)({...a,stickers:{...a.stickers,greeting:{hash:e.hash,stickers:e.stickers.filter(e=>"👋"===e.emoji)}}})})()}),Object(s.b)("loadFeaturedStickers",e=>{const{hash:t}=e.stickers.featured||{};!async function(e=0){const t=await Object(p.a)("fetchFeaturedStickers",{hash:e});if(!t)return;Object(s.g)(Object(o.jb)(Object(s.e)(),"featured",t.hash,t.sets))}(t)}),Object(s.b)("loadStickers",(e,t,a)=>{const{stickerSetId:n,stickerSetShortName:c}=a;let{stickerSetAccessHash:i}=a;if(!i&&!c){const t=Object(r.zb)(e,n);if(!t)return;i=t.accessHash}!async function(e,t,a){const n=await Object(p.a)("fetchStickers",{stickerSetShortName:a,stickerSetId:e,accessHash:t});if(!n)return;const{set:c,stickers:r,packs:i}=n;let l=Object(s.e)();l=Object(o.ib)(l,c.id,{...c,stickers:r,packs:i});const d=l.stickers.forEmoji.emoji;d&&i[d]&&(l=Object(o.p)(l));Object(s.g)(l)}(n,i,c)}),Object(s.b)("loadAnimatedEmojis",()=>{!async function(){const e=await Object(p.a)("fetchAnimatedEmojis");if(!e)return;const{set:t,stickers:a}=e;Object(s.g)(Object(o.r)(Object(s.e)(),{...t,stickers:a}))}()}),Object(s.b)("loadSavedGifs",e=>{const{hash:t}=e.gifs.saved;!async function(e=0){const t=await Object(p.a)("fetchSavedGifs",{hash:e});if(!t)return;const a=Object(s.e)();Object(s.g)({...a,gifs:{...a.gifs,saved:t}})}(t)}),Object(s.b)("faveSticker",(e,t,a)=>{const{sticker:s}=a;s&&Object(p.a)("faveSticker",{sticker:s})}),Object(s.b)("unfaveSticker",(e,t,a)=>{const{sticker:n}=a;n&&function(e){const t=Object(s.e)();Object(s.g)({...t,stickers:{...t.stickers,favorite:{...t.stickers.favorite,stickers:t.stickers.favorite.stickers.filter(({id:t})=>t!==e.id)}}}),Object(p.a)("faveSticker",{sticker:e,unfave:!0})}(n)}),Object(s.b)("toggleStickerSet",(e,t,a)=>{const{stickerSetId:s}=a,n=Object(r.zb)(e,s);if(!n)return;const{accessHash:c,installedDate:o}=n;Object(p.a)(o?"uninstallStickerSet":"installStickerSet",{stickerSetId:s,accessHash:c})}),Object(s.b)("loadEmojiKeywords",(e,t,a)=>{const{language:n}=a;let c=e.emojiKeywords[n];c&&c.isLoading||(Object(s.g)({...e,emojiKeywords:{...e.emojiKeywords,[n]:{...c,isLoading:!0}}}),(async()=>{const t=await Object(p.a)("fetchEmojiKeywords",{language:n,fromVersion:c?c.version:0});e=Object(s.e)(),c=e.emojiKeywords[n],t?Object(s.g)({...e,emojiKeywords:{...e.emojiKeywords,[n]:{isLoading:!1,version:t.version,keywords:{...c&&c.keywords,...t.keywords}}}}):Object(s.g)({...e,emojiKeywords:{...e.emojiKeywords,[n]:{...c,isLoading:!1}}})})())}),Object(s.b)("setStickerSearchQuery",(e,t,a)=>{const{query:n}=a;n&&A(()=>{!async function(e,t=0){const a=await Object(p.a)("searchStickers",{query:e,hash:t});if(!a)return;const n=Object(s.e)(),{setsById:c,added:r}=n.stickers,i=a.sets.map(({id:e})=>e);r.setIds&&r.setIds.forEach(t=>{if(!i.includes(t)){const{title:a}=c[t]||{};a&&Object(P.a)(a,e)&&i.unshift(t)}});Object(s.g)(Object(o.jb)(n,"search",a.hash,a.sets,i))}(n)})}),Object(s.b)("setGifSearchQuery",(e,t,a)=>{const{query:s}=a;"string"==typeof s&&A(()=>{R(s)})}),Object(s.b)("searchMoreGifs",e=>{const{query:t,offset:a}=e.gifs.search;"string"==typeof t&&A(()=>{R(t,a)})}),Object(s.b)("loadStickersForEmoji",(e,t,a)=>{const{emoji:n}=a,{hash:c}=e.stickers.forEmoji;A(()=>{!async function(e,t=0){let a=Object(s.e)();Object(s.g)({...a,stickers:{...a.stickers,forEmoji:{...a.stickers.forEmoji,emoji:e}}});const n=await Object(p.a)("fetchStickersForEmoji",{emoji:e,hash:t});if(a=Object(s.e)(),!n||a.stickers.forEmoji.emoji!==e)return;a=Object(o.kb)(a,e,n.stickers,n.hash),Object(s.g)(a)}(n,c)})}),Object(s.b)("clearStickersForEmoji",e=>({...e,stickers:{...e.stickers,forEmoji:{}}})),Object(s.b)("openStickerSetShortName",(e,t,a)=>{const{stickerSetShortName:s}=a;return{...e,openedStickerSetShortName:s}});var x=a(31);const L=Object(f.h)(e=>e(),500,!1);async function B(e="",t,a,c,i,l){let d;if(c){const s=await Object(p.a)("searchMessagesLocal",{chatOrUser:c,query:e,type:t,limit:n.G,offsetId:a,minDate:l,maxDate:i});if(s){const{messages:e,users:t,totalCount:a,nextOffsetId:n}=s;d={messages:e,users:t,chats:[],totalCount:a,nextRate:n}}}else d=await Object(p.a)("searchMessagesGlobal",{query:e,offsetRate:a,limit:n.G,type:t,maxDate:i,minDate:l});let b=Object(s.e)();const u=Object(r.u)(b);if(!d||""!==e&&e!==u)return void Object(s.g)(Object(o.U)(b,{messages:!1}));const{messages:m,users:O,chats:j,totalCount:g,nextRate:f}=d;j.length&&(b=Object(o.c)(b,Object(h.c)(j,"id"))),O.length&&(b=Object(o.g)(b,Object(h.c)(O,"id"))),m.length&&(b=Object(o.d)(b,m)),b=Object(o.V)(b,m,g,t,f),Object(s.g)(b)}async function D(){const e=await Object(p.a)("fetchChats",{limit:n.l,archived:!0,withPinned:!0,serverTimeOffset:Object(s.e)().serverTimeOffset});if(!e)return;let t=Object(s.e)();t=Object(o.rb)(t,Object(h.c)(e.users,"id")),t=Object(o.N)(t,Object(h.c)(e.chats,"id")),t=Object(o.s)(t,"archived",e.chatIds),t=Object(o.K)(t,"archived",e),Object(s.g)(t)}async function F(){let e=Object(s.e)();const{recentlyFoundChatIds:t}=e.globalSearch,{userIds:a}=e.contactList||{};if(!(a&&a.length||t&&t.length))return;const n=[...t||[],...a||[]].map(t=>Object(r.Kb)(e,t)).filter(Boolean),c=await Object(p.a)("fetchUsers",{users:n});c&&(e=Object(s.e)(),e=Object(o.rb)(e,Object(h.c)(c,"id")),Object(s.g)(e))}function U(e){return Object(p.a)("fetchMessages",{chat:e,threadId:b.MAIN_THREAD_ID,offsetId:e.lastReadInboxMessageId,addOffset:-(Math.round(n.gb/2)+1),limit:n.gb})}Object(s.b)("setGlobalSearchQuery",(e,t,a)=>{const{chatId:n}=e.globalSearch,{query:c}=a;c&&!n&&L(()=>{!async function(e){const t=await Object(p.a)("searchChats",{query:e});let a=Object(s.e)();const n=Object(r.u)(a);if(!t||!n||e!==n)return void Object(s.g)(Object(o.U)(a,{chats:!1}));const{localChats:c,localUsers:i,globalChats:l,globalUsers:d}=t;(c.length||l.length)&&(a=Object(o.c)(a,Object(h.c)([...c,...l],"id")));(i.length||d.length)&&(a=Object(o.g)(a,Object(h.c)([...i,...d],"id")));a=Object(o.U)(a,{chats:!1}),a=Object(o.S)(a,{localResults:{chatIds:c.map(({id:e})=>e),userIds:i.map(({id:e})=>e)},globalResults:{...a.globalSearch.globalResults,chatIds:d.map(({id:e})=>e),userIds:l.map(({id:e})=>e)}}),Object(s.g)(a)}(c)})}),Object(s.b)("setGlobalSearchDate",(e,t,a)=>{const{date:n}=a,c=n?Object(x.m)(n):n,i=Object(o.S)(e,{date:n,query:"",resultsByType:{...e.globalSearch.resultsByType,text:{totalCount:void 0,foundIds:[],nextOffsetId:0}}});Object(s.g)(i);const{chatId:l}=e.globalSearch;B("","text",void 0,l?Object(r.g)(e,l):void 0,c,n)}),Object(s.b)("searchMessagesGlobal",(e,t,a)=>{const{query:s,resultsByType:n,chatId:c,date:o}=e.globalSearch,i=o?Object(x.m)(o):o,{type:l}=a,{nextOffsetId:d}=n&&n[l]||{};B(s,l,d,c?Object(r.g)(e,c):void 0,i,o)}),Object(s.b)("searchTextMessagesLocal",e=>{const{chatId:t,threadId:a}=Object(r.z)(e)||{},c=t?Object(r.g)(e,t):void 0,i=Object(r.B)(e);if(!c||!i||!a)return;const{query:l,results:d}=i,u=d?d.nextOffsetId:void 0;let m;if(a!==b.MAIN_THREAD_ID){const s=Object(r.Gb)(e,t,a);m=s?s.topMessageId:void 0}!async function(e,t,a,c,i){const l=await Object(p.a)("searchMessagesLocal",{chatOrUser:e,type:"text",query:c,topMessageId:a,limit:n.ib,offsetId:i});if(!l)return;const{messages:d,users:b,totalCount:u,nextOffsetId:m}=l,O=Object(h.c)(d,"id"),j=Object.keys(O).map(Number);let g=Object(s.e)();const f=Object(r.B)(g);if(!f||c&&c!==f.query)return;g=Object(o.b)(g,e.id,O),g=Object(o.g)(g,Object(h.c)(b,"id")),g=Object(o.ab)(g,e.id,t,j,u,m),Object(s.g)(g)}(c,a,m,l,u)}),Object(s.b)("searchMediaMessagesLocal",e=>{const t=Object(r.x)(e),a=t?e.users.byId[t]||e.chats.byId[t]:void 0,c=Object(r.w)(e);if(!a||!c)return;const{currentType:i,resultsByType:l}=c,d=i&&l&&l[i],b=d?d.nextOffsetId:void 0;i&&async function(e,t,a){const c=await Object(p.a)("searchMessagesLocal",{chatOrUser:e,type:t,limit:n.Ab,offsetId:a});if(!c)return;const{messages:i,users:l,totalCount:d,nextOffsetId:b}=c,u=Object(h.c)(i,"id"),m=Object.keys(u).map(Number);let O=Object(s.e)();if(!Object(r.w)(O))return;O=Object(o.b)(O,e.id,u),O=Object(o.g)(O,Object(h.c)(l,"id")),O=Object(o.X)(O,e.id,t,m,d,b),Object(s.g)(O)}(a,i,b)}),Object(s.b)("searchMessagesByDate",(e,t,a)=>{const{timestamp:n}=a,{chatId:c}=Object(r.z)(e)||{};if(!c)return;const o=Object(r.g)(e,c);o&&async function(e,t){const a=await Object(p.a)("findFirstMessageIdAfterDate",{chat:e,timestamp:t});if(!a)return;Object(s.d)().focusMessage({chatId:e.id,messageId:a})}(o,n)}),Object(s.b)("checkPublicLink",(e,t,a)=>{const{chatId:n}=Object(r.z)(e)||{};if(!n)return;if(e.management.progress===u.f.InProgress)return;const{username:c}=a;(async()=>{e=Object(o.cb)(e,u.f.InProgress),e=Object(o.bb)(e,n,{isUsernameAvailable:void 0}),Object(s.g)(e);const t=await Object(p.a)("checkChatUsername",{username:c});e=Object(s.e)(),e=Object(o.cb)(e,t?u.f.Complete:u.f.Error),e=Object(o.bb)(e,n,{isUsernameAvailable:t}),Object(s.g)(e)})()}),Object(s.b)("updatePublicLink",(e,t,a)=>{const{chatId:n}=Object(r.z)(e)||{};let c=n&&Object(r.g)(e,n);if(!n||!c)return;const{username:i}=a;(async()=>{if(e=Object(o.cb)(e,u.f.InProgress),Object(s.g)(e),Object(l.lb)(c)){if(c=await Object(p.a)("migrateChat",c),!c)return;t.openChat({id:c.id})}const a=await Object(p.a)("setChatUsername",{chat:c,username:i});e=Object(s.e)(),e=Object(o.cb)(e,a?u.f.Complete:u.f.Error),e=Object(o.bb)(e,n,{isUsernameAvailable:void 0}),Object(s.g)(e)})()}),Object(s.b)("updatePrivateLink",e=>{const{chatId:t}=Object(r.z)(e)||{},a=t&&Object(r.g)(e,t);t&&a&&Object(p.a)("updatePrivateLink",{chat:a})}),Object(s.b)("sync",(e,t)=>{!async function(e){n.r&&console.log(">>> START SYNC");await Object(p.a)("fetchCurrentUser");const t=await async function(){const e=await Object(p.a)("fetchChats",{limit:n.l,withPinned:!0,serverTimeOffset:Object(s.e)().serverTimeOffset});if(!e)return;let t=Object(s.e)();const{recentlyFoundChatIds:a}=t.globalSearch,{userIds:c}=t.contactList||{},{currentUserId:i}=t,d=[...a||[],...c||[],...i?[i]:[]],u=d.map(e=>Object(r.Kb)(t,e)).filter(Boolean),m=d.map(e=>Object(r.g)(t,e)).filter(Boolean),{chatId:O}=Object(r.z)(t)||{};if(O){const e=Object(r.g)(t,O);if(e&&!d.includes(O)&&m.push(e),Object(l.ob)(O)){const e=Object(r.Kb)(t,O);e&&!d.includes(O)&&u.push(e)}}u.push(...e.users),m.push(...e.chats),t=Object(o.t)(t,Object(h.c)(m,"id")),t=Object(o.s)(t,"active",e.chatIds),t={...t,chats:{...t.chats}},t=Object(o.K)(t,"active",e),Object.keys(e.draftsById).map(Number).forEach(a=>{t=Object(o.y)(t,a,b.MAIN_THREAD_ID,"draft",e.draftsById[a])}),Object.keys(e.replyingToById).map(Number).forEach(a=>{t=Object(o.y)(t,a,b.MAIN_THREAD_ID,"replyingToId",e.replyingToById[a])}),Object(s.g)(t),O&&!t.chats.byId[O]&&Object(s.d)().openChat({id:void 0});return u}();await async function(e){let t=!1,a=e||[],n=Object(s.e)();const{chatId:c,threadId:i}=Object(r.z)(n)||{},l=Object.keys(n.messages.byChatId).map(Number).reduce((e,t)=>{const a=Object(r.C)(n,t,b.MAIN_THREAD_ID);return a?{...e,[t]:a}:e},{});if(c){const e=await U(n.chats.byId[c]);n=Object(s.e)();const{chatId:l}=Object(r.z)(n)||{},d=i&&Object(r.Gb)(n,c,i);if(e&&l===c){const s=n.messages.byChatId[c],r=Object(h.c)(e.messages,"id"),l=Object.keys(r).map(Number);if(n={...n,messages:{...n.messages,byChatId:{[c]:{byId:r,threadsById:{[b.MAIN_THREAD_ID]:{...s&&s.threadsById[b.MAIN_THREAD_ID],listedIds:l,viewportIds:l,outlyingIds:void 0}}}}}},i&&d&&d.originChannelId){const{originChannelId:e}=d,t=n.messages.byChatId[e],a=await U(n.chats.byId[e]);if(a){const e=Object(h.c)(a.messages,"id"),o=Object.keys(e).map(Number);n={...n,messages:{...n.messages,byChatId:{...n.messages.byChatId,[d.originChannelId]:{byId:e,threadsById:{[b.MAIN_THREAD_ID]:{...t&&t.threadsById[b.MAIN_THREAD_ID],listedIds:o,viewportIds:o,outlyingIds:void 0}}},[c]:{...n.messages.byChatId[c],threadsById:{...n.messages.byChatId[c].threadsById,[i]:{...s&&s.threadsById[i],outlyingIds:void 0}}}}}}}}n=Object(o.N)(n,Object(h.c)(e.chats,"id")),n=Object(o.mb)(n,c,e.threadInfos),t=!0,a=Array.prototype.concat(a,e.users)}}t||(n={...n,messages:{...n.messages,byChatId:{}}});Object.keys(l).map(Number).forEach(e=>{n=Object(o.y)(n,e,b.MAIN_THREAD_ID,"draft",l[e])}),e?n=Object(o.z)(n,Object(h.c)(a,"id")):a&&(n=Object(o.rb)(n,Object(h.c)(a,"id")));Object(s.g)(n);const{chatId:d,messageId:u}=n.audioPlayer;d&&u&&!Object(r.l)(n,d,u)&&Object(s.d)().closeAudioPlayer()}(t),Object(s.g)({...Object(s.e)(),lastSyncTime:Date.now()}),n.r&&console.log(">>> FINISH SYNC");e()}(t.afterSync)}),Object(s.b)("afterSync",(e,t)=>{!async function(e){n.r&&console.log(">>> START AFTER-SYNC");e.loadFavoriteStickers(),await Promise.all([F(),D()]),await Object(p.a)("fetchCurrentUser"),n.r&&console.log(">>> FINISH AFTER-SYNC")}(t)});const H=Object(f.a)(e=>e(),500,!1,!0),q=Object(f.h)(e=>e(),500,!1);function G(e,t,a){return{...e,inlineBots:{...e.inlineBots,byUsername:{...e.inlineBots.byUsername,[t]:a}}}}function _(e,t){return{...e,inlineBots:{...e.inlineBots,isLoading:t}}}Object(s.b)("loadFullUser",(e,t,a)=>{const{userId:s}=a,n=Object(r.Kb)(e,s);if(!n)return;const{id:c,accessHash:o}=n;H(()=>Object(p.a)("fetchFullUser",{id:c,accessHash:o}))}),Object(s.b)("loadUser",(e,t,a)=>{const{userId:n}=a,c=Object(r.Kb)(e,n);c&&(async()=>{const t=await Object(p.a)("fetchUsers",{users:[c]});t&&(e=Object(s.e)(),e=Object(o.rb)(e,Object(h.c)(t,"id")),Object(s.g)(e))})()}),Object(s.b)("loadTopUsers",e=>{const{serverTimeOffset:t,topPeers:{hash:a,lastRequestedAt:n}}=e;(!n||Date.now()/1e3+t-n>60)&&async function(e){const t=await Object(p.a)("fetchTopUsers",{hash:e});if(!t)return;const{hash:a,ids:n,users:c}=t;let r=Object(s.e)();r=Object(o.g)(r,Object(h.c)(c,"id")),r={...r,topPeers:{...r.topPeers,hash:a,userIds:n,lastRequestedAt:Date.now()/1e3+r.serverTimeOffset}},Object(s.g)(r)}(a)}),Object(s.b)("loadContactList",e=>{const{hash:t}=e.contactList||{};!async function(e){const t=await Object(p.a)("fetchContactList",{hash:e});if(!t)return;let a=Object(o.g)(Object(s.e)(),Object(h.c)(t.users,"id"));a=Object(o.c)(a,Object(h.c)(t.chats,"id"));const n=e=>e.lastName||e.firstName||"",c=new Intl.Collator("en-US"),r=t.users.sort((e,t)=>c.compare(n(e),n(t))).filter(e=>!e.isSelf);Object(s.g)({...a,contactList:{hash:t.hash,userIds:r.map(e=>e.id)}})}(t)}),Object(s.b)("loadCurrentUser",()=>{Object(p.a)("fetchCurrentUser")}),Object(s.b)("updateContact",(e,t,a)=>{const{userId:n,isMuted:c,firstName:i,lastName:l}=a;!async function(e,t,a,n){const c=Object(s.e)(),i=Object(r.Kb)(c,e);if(!i)return;Object(s.d)().updateChatMutedState({chatId:e,isMuted:t}),Object(s.g)(Object(o.cb)(Object(s.e)(),u.f.InProgress));await Object(p.a)("updateContact",{phone:i.phoneNumber,firstName:a,lastName:n})&&Object(s.g)(Object(o.ob)(Object(s.e)(),i.id,{firstName:a,lastName:n}));Object(s.g)(Object(o.cb)(Object(s.e)(),u.f.Complete))}(n,c,i,l)}),Object(s.b)("deleteUser",(e,t,a)=>{const{userId:n}=a;!async function(e){const t=Object(s.e)(),a=Object(r.Kb)(t,e);if(!a)return;const{id:n,accessHash:c}=a;await Object(p.a)("deleteUser",{id:n,accessHash:c})}(n)}),Object(s.b)("loadProfilePhotos",(e,t,a)=>{const{profileId:n}=a,c=Object(l.ob)(n),i=c?Object(r.Kb)(e,n):void 0,d=c?void 0:Object(r.g)(e,n);(async()=>{const e=await Object(p.a)("fetchProfilePhotos",i,d);if(!e||!e.photos)return;let t=Object(s.e)();c?t=Object(o.ob)(t,n,{photos:e.photos}):(t=Object(o.g)(t,Object(h.c)(e.users,"id")),t=Object(o.I)(t,n,{photos:e.photos})),Object(s.g)(t)})()}),Object(s.b)("setUserSearchQuery",(e,t,a)=>{const{query:n}=a;n&&q(()=>{!async function(e){const t=await Object(p.a)("searchChats",{query:e});let a=Object(s.e)();const n=a.userSearch.query;if(!t||!n||e!==n)return void Object(s.g)(Object(o.qb)(a,!1));const{localUsers:c,globalUsers:r}=t;let i,l;c.length&&(a=Object(o.g)(a,Object(h.c)(c,"id")),i=c.map(({id:e})=>e));r.length&&(a=Object(o.g)(a,Object(h.c)(r,"id")),l=r.map(({id:e})=>e));a=Object(o.qb)(a,!1),a=Object(o.pb)(a,{localUserIds:i,globalUserIds:l}),Object(s.g)(a)}(n)})});const z=Object(f.a)(e=>e(),500,!1);async function K(e,t,a){await Object(p.a)("sendMessage",{chat:e,text:a})}Object(s.b)("clickInlineButton",(e,t,a)=>{const{button:c}=a;switch(c.type){case"command":t.sendBotCommand({command:c.value});break;case"url":c.value.match(n.tb)||c.value.match(n.ub)?t.openTelegramLink({url:c.value}):t.toggleSafeLinkModal({url:c.value});break;case"callback":{const t=Object(r.s)(e);if(!t)return;!async function(e,t,a){const n=await Object(p.a)("answerCallbackButton",{chatId:e.id,accessHash:e.accessHash,messageId:t,data:a});if(!n||!n.message)return;const{message:c,alert:o}=n;o?Object(s.d)().showDialog({data:{message:c}}):Object(s.d)().showNotification({message:c})}(t,c.messageId,c.value);break}case"requestPoll":t.openPollModal();break;case"buy":{const a=Object(r.s)(e),{messageId:s,value:n}=c;if(!a)return;n?t.getReceipt({receiptMessageId:n,chatId:a.id,messageId:s}):(t.getPaymentForm({messageId:s}),t.setInvoiceMessageInfo(Object(r.l)(e,a.id,s)),t.openPaymentModal({messageId:s}));break}}}),Object(s.b)("sendBotCommand",(e,t,a)=>{const{command:s,chatId:n}=a,{currentUserId:c}=e,o=n?Object(r.g)(e,n):Object(r.s)(e);c&&o&&K(o,c,s)}),Object(s.b)("restartBot",(e,t,a)=>{const{chatId:n}=a,{currentUserId:c}=e,i=Object(r.s)(e),l=c&&Object(r.h)(e,n);c&&i&&l&&(async()=>{await Object(p.a)("unblockContact",l.id,l.accessHash)&&(Object(s.g)(Object(o.q)(Object(s.e)(),l.id)),K(i,c,"/start"))})()}),Object(s.b)("loadTopInlineBots",e=>{const{serverTimeOffset:t}=e,{hash:a,lastRequestedAt:n}=e.topInlineBots;n&&Date.now()+t-n<6e4||(async()=>{const e=await Object(p.a)("fetchTopInlineBots",{hash:a});if(!e)return;const{hash:t,ids:n,users:c}=e;let r=Object(s.e)();r=Object(o.g)(r,Object(h.c)(c,"id")),r={...r,topInlineBots:{...r.topInlineBots,hash:t,userIds:n,lastRequestedAt:Date.now()}},Object(s.g)(r)})()}),Object(s.b)("queryInlineBot",(e,t,a)=>{const{chatId:n,username:c,query:i,offset:l}=a;(async()=>{let t=e.inlineBots.byUsername[c];if(!1!==t){if(void 0===t){const{user:a,chat:n}=await Object(p.a)("fetchInlineBot",{username:c})||{};if(e=Object(s.e)(),!a||!n)return void Object(s.g)(G(e,c,!1));e=Object(o.g)(e,{[a.id]:a}),e=Object(o.c)(e,{[n.id]:n}),t={id:a.id,query:"",offset:"",switchPm:void 0,canLoadMore:!0,results:[]},e=G(e,c,t),Object(s.g)(e)}(i!==t.query||t.canLoadMore)&&z(()=>{!async function({username:e,inlineBotData:t,chatId:a,query:n,offset:c}){let o=Object(s.e)();const i=Object(r.Kb)(o,t.id),l=Object(r.g)(o,a);if(!i||!l)return;const d=t.query!==n;o=_(o,!0),o=G(o,e,{...t,query:n,...d&&{offset:void 0,results:[]}}),Object(s.g)(o);const b=await Object(p.a)("fetchInlineBotResults",{bot:i,chat:l,query:n,offset:d?void 0:c}),u=o.inlineBots.byUsername[e];if(o=_(Object(s.e)(),!1),!b||!u||n!==u.query)return void Object(s.g)(o);const m=new Set((u.results||[]).map(e=>e.id)),h=b.results.filter(e=>!m.has(e.id));o=G(o,e,{...u,help:b.help,...h.length&&{isGallery:b.isGallery},...b.switchPm&&{switchPm:b.switchPm},canLoadMore:b.results.length>0&&Boolean(b.nextOffset),results:""===u.offset||u.offset===b.nextOffset?b.results:(u.results||[]).concat(h),offset:h.length?b.nextOffset:""}),Object(s.g)(o)}({username:c,inlineBotData:t,chatId:n,query:i,offset:l})})}})()}),Object(s.b)("sendInlineBotResult",(e,t,a)=>{const{id:s,queryId:n}=a,c=Object(r.z)(e);if(!c||!s)return;const{chatId:o,threadId:i}=c,l=Object(r.g)(e,o);t.setReplyingToId({messageId:void 0}),t.clearWebPagePreview({chatId:o,threadId:i,value:!1}),Object(p.a)("sendInlineBotResult",{chat:l,resultId:s,queryId:n,replyingTo:Object(r.ob)(e,o,i)})}),Object(s.b)("resetInlineBot",(e,t,a)=>{const{username:n}=a;let c=e.inlineBots.byUsername[n];c&&(c={id:c.id,query:"",offset:"",switchPm:void 0,canLoadMore:!0,results:[]},Object(s.g)(G(e,n,c)))});a(89);Object(s.b)("loadPasswordInfo",()=>{(async()=>{const e=await Object(p.a)("getPasswordInfo");if(!e)return;let t=Object(s.e)();t=Object(o.w)(t,{hasPassword:e.hasPassword}),t=Object(o.nb)(t,{hint:e.hint}),Object(s.g)(t)})()}),Object(s.b)("checkPassword",(e,t,a)=>{const{currentPassword:n,onSuccess:c}=a;Object(s.g)(Object(o.nb)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await Object(p.a)("checkPassword",n);Object(s.g)(Object(o.nb)(Object(s.e)(),{isLoading:!1})),e&&c()})()}),Object(s.b)("clearPassword",(e,t,a)=>{const{currentPassword:n,onSuccess:c}=a;Object(s.g)(Object(o.nb)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await Object(p.a)("clearPassword",n);Object(s.g)(Object(o.nb)(Object(s.e)(),{isLoading:!1})),e&&c()})()}),Object(s.b)("updatePassword",(e,t,a)=>{const{currentPassword:n,password:c,hint:r,email:i,onSuccess:l}=a;Object(s.g)(Object(o.nb)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await Object(p.a)("updatePassword",n,c,r,i);Object(s.g)(Object(o.nb)(Object(s.e)(),{isLoading:!1})),e&&l()})()}),Object(s.b)("updateRecoveryEmail",(e,t,a)=>{const{currentPassword:n,email:c,onSuccess:r}=a;Object(s.g)(Object(o.nb)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await Object(p.a)("updateRecoveryEmail",n,c);Object(s.g)(Object(o.nb)(Object(s.e)(),{isLoading:!1,waitingEmailCodeLength:void 0})),e&&r()})()}),Object(s.b)("provideTwoFaEmailCode",(e,t,a)=>{const{code:s}=a;Object(p.a)("provideRecoveryEmailCode",s)}),Object(s.b)("clearTwoFaError",e=>Object(o.nb)(e,{error:void 0}));var $=a(62);Object(s.b)("validateRequestedInfo",(e,t,a)=>{const{requestInfo:n,saveInfo:c}=a,i=Object(r.ib)(e);i&&async function(e,t,a){const n=await Object(p.a)("validateRequestedInfo",{messageId:e,requestInfo:t,shouldSave:a});if(!n)return;const{id:c,shippingOptions:r}=n;if(!c)return;let i=Object(o.F)(Object(s.e)(),c);r?(i=Object(o.hb)(i,r),i=Object(o.D)(i,u.j.Shipping)):i=Object(o.D)(i,u.j.PaymentInfo);Object(s.g)(i)}(i,n,c)}),Object(s.b)("getPaymentForm",(e,t,a)=>{const{messageId:n}=a;n&&async function(e){const t=await Object(p.a)("getPaymentForm",{messageId:e});if(!t)return;let a=Object(o.C)(Object(s.e)(),t),n=u.j.PaymentInfo;a.payment.invoice&&(a.payment.invoice.shippingAddressRequested||a.payment.invoice.nameRequested||a.payment.invoice.phoneRequested||a.payment.invoice.emailRequested)&&(n=u.j.ShippingInfo);a=Object(o.D)(a,n),Object(s.g)(a)}(n)}),Object(s.b)("getReceipt",(e,t,a)=>{const{receiptMessageId:n,chatId:c,messageId:i}=a;i&&n&&c&&async function(e,t,a){const n=await Object(p.a)("getReceipt",t);if(!n)return;let c=Object(s.e)();const i=Object(r.l)(c,a,e);c=Object(o.E)(c,n,i),Object(s.g)(c)}(i,n,c)}),Object(s.b)("clearPaymentError",e=>{Object(s.g)({...e,payment:{...e.payment,error:void 0}})}),Object(s.b)("clearReceipt",e=>{Object(s.g)({...e,payment:{...e.payment,receipt:void 0}})}),Object(s.b)("sendCredentialsInfo",(e,t,a)=>{const n=Object(r.lb)(e);if(!n)return;const{credentials:c}=a,{data:i}=c;!async function(e,t){const a=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}),n=await fetch("https://api.stripe.com/v1/tokens"+a,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/x-www-form-urlencoded",Authorization:"Bearer "+t}}),c=await n.json();if(c.error){const e=Object($.b)(c.error),t=Object(s.e)();return void Object(s.g)({...t,payment:{...t.payment,error:{...e}}})}let r=Object(o.G)(Object(s.e)(),{type:c.type,id:c.id});r=Object(o.D)(r,u.j.Checkout),Object(s.g)(r)}(i,n)}),Object(s.b)("sendPaymentForm",(e,t,a)=>{const{shippingOptionId:n,saveCredentials:c}=a,i=Object(r.ib)(e),l=Object(r.jb)(e),d=Object(r.lb)(e),b=Object(r.Cb)(e);i&&d&&async function(e,t,a,n){if(await Object(p.a)("sendPaymentForm",{messageId:e,credentials:t,requestedInfoId:a,shippingOptionId:n})){const e=Object(o.i)(Object(s.e)());Object(s.g)(Object(o.j)(e))}}(i,{save:c,data:b},l,n)}),Object(s.b)("setPaymentStep",(e,t,a={})=>Object(o.D)(e,a.step||u.j.ShippingInfo)),Object(s.b)("setInvoiceMessageInfo",(e,t,a)=>Object(o.B)(e,a));a(90);var V=a(21),W=a(80);const Q=Object(f.h)(e=>e(),1e3,!0);Object(s.b)("apiUpdate",(e,t,a)=>{switch(a["@type"]){case"updateChat":{a.noTopChatsRequest||Object(r.M)(e,a.id)||t.loadTopChats();const n=Object(o.I)(e,a.id,a.chat,a.newProfilePhoto);Object(s.g)(n);const c=Object(r.r)(n);Q(()=>Object(W.a)(c));break}case"updateChatJoin":{const n=Object(r.k)(e,a.id);if(!n)break;e=Object(o.J)(e,n,[a.id]),e=Object(o.I)(e,a.id,{isNotJoined:!1}),Object(s.g)(e);const c=Object(r.g)(e,a.id);c&&t.requestChatUpdate({chatId:c.id});break}case"updateChatLeave":{const t=Object(r.k)(e,a.id);if(!t)break;const{[t]:n}=e.chats.listIds;n&&(e=Object(o.s)(e,t,n.filter(e=>e!==a.id))),e=Object(o.I)(e,a.id,{isNotJoined:!0}),Object(s.g)(e);break}case"updateChatInbox":Object(s.g)(Object(o.I)(e,a.id,a.chat));break;case"updateChatTypingStatus":{const{id:t,typingStatus:n}=a;Object(s.g)(Object(o.I)(e,t,{typingStatus:n})),setTimeout(()=>{const e=Object(s.e)(),a=Object(r.g)(e,t);a&&n&&a.typingStatus&&a.typingStatus.timestamp===n.timestamp&&Object(s.g)(Object(o.I)(e,t,{typingStatus:void 0}))},6e3);break}case"newMessage":{const{message:n}=a,{chatId:c,threadId:i,type:l}=Object(r.z)(e)||{};if(n.senderId===e.currentUserId&&!n.isFromScheduled)return;const d=Object(r.g)(e,a.chatId);if(!d)return;const u="thread"===l&&i===b.MAIN_THREAD_ID&&a.chatId===c;u?setTimeout(()=>{t.requestChatUpdate({chatId:a.chatId})},1e3):Object(s.g)(Object(o.I)(e,a.chatId,{unreadCount:d.unreadCount?d.unreadCount+1:1,...a.message.hasUnreadMention&&{unreadMentionsCount:d.unreadMentionsCount?d.unreadMentionsCount+1:1}}));const m=Object(r.r)(Object(s.e)());Object(W.a)(m);const{hasWebNotifications:h}=Object(r.fb)(e);h&&Object(V.c)({chat:d,message:n,isActiveChat:u});break}case"updateCommonBoxMessages":case"updateChannelMessages":{const{ids:t,messageUpdate:n}=a;if(!1!==n.hasUnreadMention)return;t.forEach(t=>{const s="channelId"in a?a.channelId:Object(r.q)(e,t),n=Object(r.g)(e,s);n&&n.unreadMentionsCount&&(e=Object(o.I)(e,s,{unreadMentionsCount:n.unreadMentionsCount-1}))}),Object(s.g)(e);break}case"updateChatFullInfo":{const{fullInfo:t}=a,n=e.chats.byId[a.id];if(!n)return;Object(s.g)(Object(o.I)(e,a.id,{fullInfo:{...n.fullInfo,...t}}));break}case"updatePinnedChatIds":{const{ids:t,folderId:c}=a,o=c===n.i?"archived":"active";e={...e,chats:{...e.chats,orderedPinnedIds:{...e.chats.orderedPinnedIds,[o]:t.length?t:void 0}}},Object(s.g)(e);break}case"updateChatPinned":{const{id:t,isPinned:c}=a,o=Object(r.k)(e,t);if(o){const{[o]:a}=e.chats.orderedPinnedIds;let s=a||[];if(c){if(!s.includes(t)){if("active"===o&&s.length>=n.V){const t=e.chats.listIds.active;s=s.filter(e=>t&&t.includes(e))}s=[t,...s]}}else s=s.filter(e=>e!==t);e={...e,chats:{...e.chats,orderedPinnedIds:{...e.chats.orderedPinnedIds,[o]:s.length?s:void 0}}}}Object(s.g)(e);break}case"updateChatListType":{const{id:t,folderId:n}=a;Object(s.g)(Object(o.L)(e,t,n));break}case"updateChatFolder":{const{id:t,folder:n}=a,{byId:c,orderedIds:o}=e.chatFolders,r=n?{...c,[t]:n}:Object(h.l)(c,Object.keys(c).map(Number).filter(e=>e!==t)),i=n?o&&o.includes(t)?o:[...o||[],t]:o?o.filter(e=>e!==t):void 0;Object(s.g)({...e,chatFolders:{...e.chatFolders,byId:r,orderedIds:i}});break}case"updateChatFoldersOrder":{const{orderedIds:t}=a;Object(s.g)({...e,chatFolders:{...e.chatFolders,orderedIds:t}});break}case"updateRecommendedChatFolders":{const{folders:t}=a;Object(s.g)({...e,chatFolders:{...e.chatFolders,recommended:t}});break}case"updateChatMembers":{const t=e.chats.byId[a.id],{replacedMembers:n,addedMember:c,deletedMemberId:r}=a;if(!t)return;let i=!1,l=t.fullInfo&&t.fullInfo.members?[...t.fullInfo.members]:[];if(n)l=n,i=!0;else if(c)l.length&&l.some(e=>e.userId===c.userId)||(l.push(c),i=!0);else if(l.length&&r){const e=l.findIndex(e=>e.userId===r);e>-1&&(l.slice(e,1),i=!0)}if(i){const n=l.filter(({isOwner:e,isAdmin:t})=>e||t);Object(s.g)(Object(o.I)(e,a.id,{membersCount:l.length,fullInfo:{...t.fullInfo,members:l,adminMembers:n}}))}break}case"deleteProfilePhotos":{const{chatId:t,ids:n}=a,c=e.chats.byId[t];c&&c.photos&&Object(s.g)(Object(o.I)(e,t,{photos:c.photos.filter(e=>!n.includes(e.id))}));break}case"draftMessage":{const{chatId:t,formattedText:n,date:c,replyingToId:r}=a;e.chats.byId[t]&&(e=Object(o.y)(e,t,b.MAIN_THREAD_ID,"draft",n),e=Object(o.y)(e,t,b.MAIN_THREAD_ID,"replyingToId",r),e=Object(o.I)(e,t,{draftDate:c}),Object(s.g)(e));break}case"showInvite":{const{data:e}=a;t.showDialog({data:e});break}}});function Y(e,t,a,s,n=!1){const c=n?Object(r.rb)(e,t,a):Object(r.l)(e,t,a);if(c&&s.content){const{photo:e,video:t,sticker:a,document:n}=Object(l.v)(c);e&&s.content.photo?(s.content.photo.blobUrl=e.blobUrl,s.content.photo.thumbnail=e.thumbnail):t&&s.content.video?s.content.video.blobUrl=t.blobUrl:a&&s.content.sticker?s.content.sticker.isPreloadedGlobally=a.isPreloadedGlobally:n&&s.content.document&&(s.content.document.previewBlobUrl=n.previewBlobUrl)}return n?Object(o.fb)(e,t,a,s):Object(o.M)(e,t,a,s)}function J(e,t){const{id:a,chatId:s}=t,{threadInfo:n,firstMessageId:c}=Object(r.Fb)(e,s,t)||{},i=Object(r.g)(e,s),d=i&&i.unreadCount&&!Object(r.Z)(e,s,b.MAIN_THREAD_ID);if(n&&(!c&&Object(l.xb)(t)||(e=Object(o.W)(e,s,n.threadId,[a]),Object(r.Y)(e,s,n.threadId)&&(e=Object(o.h)(e,s,n.threadId,a),c||(e=Object(o.y)(e,s,n.threadId,"firstMessageId",t.id)))),e=Object(o.y)(e,s,n.threadId,"threadInfo",{...n,lastMessageId:t.id,messagesCount:n.messagesCount+1})),d)return e;if(e=Object(o.W)(e,s,b.MAIN_THREAD_ID,[a]),Object(r.Y)(e,s,b.MAIN_THREAD_ID)){const t=Object(r.H)(e,s,b.MAIN_THREAD_ID),n=Object(o.h)(e,s,b.MAIN_THREAD_ID,a),c=Object(r.Lb)(n,s,b.MAIN_THREAD_ID);t&&!c.includes(t)||(e=n)}return e}function X(e,t,a,s=!1){const{chats:n}=e,c=n.byId[t]&&n.byId[t].lastMessage;if(c&&!s){if(!(c.id===a.id||c.id===a.previousLocalId||a.id>c.id))return e}return Object(o.I)(e,t,{lastMessage:a})}function Z(e,t){const a=Object(r.n)(e,t),s=Object(r.Z)(e,t,b.MAIN_THREAD_ID);if(!a||!s)return;let n=s.length;for(;n--;){const e=a[s[n]];if(!e.isDeleting)return e}}function ee(e,t,a,n){if(e){t.forEach(t=>{const a=Z(n=Object(o.M)(n,e,t,{isDeleting:!0}),e);a&&(n=X(n,e,a,!0))}),Object(s.g)(n),a.requestChatUpdate({chatId:e});const c=[];return t.forEach(t=>{const a=Object(r.l)(n,e,t);if(!a)return;const{threadInfo:s}=Object(r.Fb)(n,e,a)||{};s&&c.push(s.threadId)}),void setTimeout(()=>{Object(s.g)(Object(o.k)(Object(s.e)(),e,t)),Object(h.o)(c).forEach(t=>{a.requestThreadInfoUpdate({chatId:e,threadId:t})})},350)}const c=[];t.forEach(e=>{const t=Object(r.q)(n,e);if(t){c.push(t);const a=Z(n=Object(o.M)(n,t,e,{isDeleting:!0}),t);a&&(n=X(n,t,a,!0)),setTimeout(()=>{Object(s.g)(Object(o.k)(Object(s.e)(),t,[e]))},350)}}),Object(s.g)(n),Object(h.o)(c).forEach(e=>{a.requestChatUpdate({chatId:e})})}Object(s.b)("apiUpdate",(e,t,a)=>{switch(a["@type"]){case"newMessage":{const{chatId:n,id:c,message:i}=a;e=J(e=Y(e,n,c,i),i),i.threadInfo&&(e=Object(o.lb)(e,i.threadInfo.chatId,i.threadInfo.threadId,i.threadInfo)),Object(s.g)(e);const d=Object(r.l)(e,n,c);if(Object(r.a)(e,n,i)){if(i.isOutgoing&&(!i.content||!i.content.action)){const a=Object(r.z)(e);a&&t.focusMessage({chatId:n,threadId:a.threadId,messageId:i.id,noHighlight:!0})}const{threadInfo:a}=Object(r.Fb)(e,n,i)||{};a&&t.requestThreadInfoUpdate({chatId:n,threadId:a.threadId}),Object(l.xb)(i)||setTimeout(()=>{Object(s.g)(X(Object(s.e)(),n,d))},350)}else Object(s.g)(X(Object(s.e)(),n,d));Object(r.M)(e,n)||t.loadTopChats();break}case"newScheduledMessage":{const{chatId:t,id:n,message:c}=a;e=Y(e,t,n,c,!0);const i=Object(r.qb)(e,t)||[];e=Object(o.y)(e,t,b.MAIN_THREAD_ID,"scheduledIds",Object(h.o)([...i,n])),Object(s.g)(e);break}case"updateMessage":{const{chatId:t,id:n,message:c}=a;if(!Object(r.l)(e,t,n))return;e=Y(e,t,n,c);const i=Object(r.l)(e,t,n);c.threadInfo&&(e=Object(o.lb)(e,c.threadInfo.chatId,c.threadInfo.threadId,c.threadInfo)),e=X(e,t,i),Object(s.g)(e);break}case"updateScheduledMessage":{const{chatId:t,id:n,message:c}=a;if(!Object(r.rb)(e,t,n))return;e=Y(e,t,n,c,!0);const i=Object.keys(Object(r.sb)(e,t)||{}).map(Number).sort((e,t)=>t-e);e=Object(o.y)(e,t,b.MAIN_THREAD_ID,"scheduledIds",i),Object(s.g)(e);break}case"updateMessageSendSucceeded":{const{chatId:n,localId:c,message:i}=a;e=J(e,i);const l=Object(r.l)(e,n,c);e=Object(o.k)(e,n,[c]),i.isScheduled&&(e=Object(o.l)(e,n,[c])),e=Object(o.M)(e,n,i.id,{...l,...i,previousLocalId:c});const d=Object(r.l)(e,n,i.id);e=X(e,n,d);const b=Object(r.Fb)(e,n,i);b&&b.threadInfo&&(t.markMessageListRead({maxId:i.id}),e=Object(o.y)(e,n,b.threadInfo.threadId,"threadInfo",{...b.threadInfo,lastMessageId:i.id,lastReadInboxMessageId:i.id})),Object(s.g)(e);break}case"updateScheduledMessageSendSucceeded":{const{chatId:t,localId:n,message:c}=a,i=Object(r.qb)(e,t)||[];e=Object(o.y)(e,t,b.MAIN_THREAD_ID,"scheduledIds",[...i,c.id]);const l=Object(r.rb)(e,t,n);e=Object(o.l)(e,t,[n]),e=Object(o.fb)(e,t,c.id,{...l,...c,previousLocalId:n}),Object(s.g)(e);break}case"updatePinnedIds":{const{chatId:t,isPinned:n,messageIds:c}=a,i=Object(r.kb)(e,t)||[],l=n?[...i,...c].sort((e,t)=>t-e):i.filter(e=>!c.includes(e));Object(s.g)(Object(o.y)(e,t,b.MAIN_THREAD_ID,"pinnedIds",l));break}case"updateThreadInfo":{const{chatId:t,threadId:n,threadInfo:c,firstMessageId:i}=a,l={...Object(r.Gb)(e,t,n),...c};if(!l.threadId)return;e=Object(o.lb)(e,t,n,l),i&&(e=Object(o.y)(e,t,n,"firstMessageId",i)),Object(s.g)(e);break}case"resetMessages":{const{id:n}=a,c=Object(r.n)(e,n);c&&!Object(l.ob)(n)&&(e=Object(o.k)(e,n,Object.keys(c).map(Number)),Object(s.g)(e),t.loadFullChat({chatId:n,force:!0}));break}case"deleteMessages":{const{ids:s,chatId:n}=a;ee(n,s,t,e);break}case"deleteScheduledMessages":{const{ids:t,chatId:n}=a;!function(e,t,a,n){if(!e)return;t.forEach(t=>{n=Object(o.fb)(n,e,t,{isDeleting:!0})}),Object(s.g)(n),setTimeout(()=>{n=Object(o.l)(Object(s.e)(),e,t);const a=Object(r.sb)(n,e);n=Object(o.y)(n,e,b.MAIN_THREAD_ID,"scheduledIds",Object.keys(a||{}).map(Number)),Object(s.g)(n)},350)}(n,t,0,e);break}case"deleteHistory":{const{chatId:s}=a,n=e.messages.byChatId[s];if(n){ee(s,Object.keys(n.byId).map(Number),t,e)}else t.requestChatUpdate({chatId:s});break}case"updateCommonBoxMessages":{const{ids:t,messageUpdate:n}=a;t.forEach(t=>{const a=Object(r.q)(e,t);a&&(e=Object(o.M)(e,a,t,n))}),Object(s.g)(e);break}case"updateChannelMessages":{const{channelId:t,ids:n,messageUpdate:c}=a;n.forEach(a=>{e=Object(o.M)(e,t,a,c)}),Object(s.g)(e);break}case"updateMessagePoll":{const{pollId:t,pollUpdate:n}=a,c=Object(r.m)(e,t);if(c&&c.content.poll){const t={...c.content.poll,...n},{results:a}=t.results||{};if(a&&!a.some(e=>e.isChosen)){const{results:e}=c.content.poll.results,s=e&&e.filter(e=>e.isChosen);s&&s.forEach(e=>{const s=a.findIndex(t=>t.option===e.option);s>=0&&(t.results.results[s].isChosen=!0)})}Object(s.g)(Object(o.M)(e,c.chatId,c.id,{content:{...c.content,poll:t}}))}break}case"updateMessagePollVote":{const{pollId:t,userId:n,options:c}=a,i=Object(r.m)(e,t);if(!i||!i.content.poll||!i.content.poll.results)break;const{poll:l}=i.content,{recentVoterIds:d,totalVoters:b,results:u}=l.results,m=d?[...d]:[],h=b?b+1:1,O=u?[...u]:[];m.push(n),c.forEach(t=>{const a=O.find(e=>e.option===t),s=O.findIndex(e=>e.option===t),c=a?{...a}:{option:t,votersCount:0};c.votersCount+=1,n===e.currentUserId&&(c.isChosen=!0),s?O[s]=c:O.push(c)}),Object(s.g)(Object(o.M)(e,i.chatId,i.id,{content:{...i.content,poll:{...l,results:{...l.results,recentVoterIds:m,totalVoters:h,results:O}}}}));break}}});const te=Object(f.h)((function(){let e=Object(s.e)();ae.forEach(([t,a])=>{e=Object(o.ob)(e,t,{status:a})}),Object(s.g)(e),ae=[]}),3e3,!0);let ae=[];Object(s.b)("apiUpdate",(e,t,a)=>{switch(a["@type"]){case"deleteUser":return Object(o.m)(e,a.id);case"updateUser":return Object(o.ob)(e,a.id,a.user);case"updateUserStatus":return s=a.userId,n=a.status,ae.push([s,n]),void te();case"updateUserFullInfo":{const{id:t,fullInfo:s}=a,n=e.users.byId[t];if(!n)return;return Object(o.ob)(e,t,{fullInfo:{...n.fullInfo,...s}})}}var s,n}),Object(s.b)("apiUpdate",(e,t,a)=>{switch(a["@type"]){case"updateStickerSet":return Object(o.ib)(e,a.id,a.stickerSet)}}),Object(s.b)("apiUpdate",(e,t,a)=>{switch(a["@type"]){case"updatePeerBlocked":return a.isBlocked?Object(o.a)(Object(s.e)(),a.id):Object(o.q)(Object(s.e)(),a.id);case"updateResetContactList":Object(s.g)({...Object(s.e)(),contactList:{hash:0,userIds:[]}});break;case"updateFavoriteStickers":t.loadFavoriteStickers();break;case"updatePrivacy":e.settings.privacy[a.key]=a.rules}}),Object(s.b)("apiUpdate",(e,t,a)=>{switch(a["@type"]){case"updateNotifySettings":return Object(o.db)(e,a.peerType,a.isSilent,a.shouldShowPreviews);case"updateNotifyExceptions":{const{chatId:t,isMuted:n,isSilent:c,shouldShowPreviews:r}=a;e.chats.byId[t]&&(e=Object(o.I)(e,t,{isMuted:n})),Object(s.g)(Object(o.e)(e,t,{isMuted:n,isSilent:c,shouldShowPreviews:r}));break}}}),Object(s.b)("apiUpdate",(e,t,a)=>{switch(a["@type"]){case"updateTwoFaStateWaitCode":return{...e,twoFaSettings:{...e.twoFaSettings,isLoading:!1,waitingEmailCodeLength:a.length}};case"updateTwoFaError":return{...e,twoFaSettings:{...e.twoFaSettings,error:a.message}}}});var se=a(39),ne=a(9),ce=a(180),oe=a(42),re=a(128);function ie(e){Object(c.n)(()=>Object(f.c)(e),[e])}var le=a(54);var de=a(41),be=a(51),ue=a(146),me=a(114);var he=a(25),Oe=a(18),je=a(48),ge=a(64),pe=a(45),fe=a(22),Ie=a(162),ve=a(147);a(208);var ye=Object(c.h)(({id:e,name:t,value:a,label:s,checked:n=!1,disabled:o,inactive:r,noAnimation:i,onChange:l,onCheck:d})=>{const b=Object(c.m)(e=>{l&&l(e),d&&d(e.currentTarget.checked)},[l,d]),u=Object(ne.a)("Switcher",o&&"disabled",r&&"inactive",i&&"no-animation");return c.a.createElement("label",{className:u,title:s},c.a.createElement("input",{type:"checkbox",id:e,name:t,value:a,checked:n,disabled:o,onChange:b}),c.a.createElement("span",{className:"widget"}))});a(209);const Ce=[0,1,2];var Ee=Object(c.h)(Object(s.h)(e=>{const{query:t,fetchingStatus:a,chatId:s,date:n}=e.globalSearch,{currentUserId:c}=e,{byId:o}=e.chats,{animationLevel:i}=e.settings.byKey;return{searchQuery:t,isLoading:!!a&&Boolean(a.chats||a.messages),currentUserId:c,chatsById:o,globalSearchChatId:s,searchDate:n,theme:Object(r.Eb)(e),animationLevel:i}},(e,t)=>Object(h.l)(t,["openChat","openTipsChat","setGlobalSearchDate","setGlobalSearchChatId","setSettingOption"]))(({content:e,contactsFilter:t,onSearchQuery:a,onSelectSettings:s,onSelectContacts:o,onSelectArchived:r,setGlobalSearchChatId:i,onReset:d,searchQuery:b,isLoading:h,shouldSkipTransition:O,currentUserId:j,globalSearchChatId:g,searchDate:p,theme:f,animationLevel:I,chatsById:v,openChat:y,openTipsChat:C,setGlobalSearchDate:E,setSettingOption:w})=>{const S=Object(Oe.a)(),M=e===u.d.ChatList,k={date:void 0},N={id:void 0},T=Object(c.p)(()=>p?Object(x.a)(new Date(1e3*p)):void 0,[p]),P=Object(c.p)(()=>M&&v?Object.values(v).reduce((e,t)=>Object(l.kb)(t)&&t.unreadCount?e+1:e,0):0,[M,v]),A="web.telegram.org"===window.location.hostname,R=Object(c.p)(()=>({onTrigger:e,isOpen:t})=>c.a.createElement(fe.a,{round:!0,ripple:M&&!m.l,size:"smaller",color:"translucent",className:t?"active":"",onClick:M?e:()=>d(),ariaLabel:M?S("AccDescrOpenMenu2"):"Return to chat list"},c.a.createElement("div",{className:Object(ne.a)("animated-menu-icon",!M&&"state-back",O&&"no-animation")})),[M,S,d,O]),L=Object(c.m)(()=>{b||a("")},[b,a]),B=Object(c.m)(()=>{y({id:j,shouldReplaceHistory:!0})},[j,y]),D=Object(c.m)(e=>{e.stopPropagation();const t="light"===f?"dark":"light";w({theme:t}),w({shouldUseSystemTheme:!1}),Object(je.a)(t,I===n.e)},[I,w,f]),F=Object(c.m)(e=>{e.stopPropagation();const t=0===I?2:0;Ce.forEach((e,a)=>{document.body.classList.toggle("animation-level-"+a,t===a)}),w({animationLevel:t})},[I,w]),U=Boolean(g)||e===u.d.GlobalSearch||e===u.d.Contacts,H=e===u.d.Contacts?S("SearchFriends"):S("Search");return c.a.createElement("div",{className:"LeftMainHeader"},c.a.createElement("div",{id:"LeftMainHeader",className:"left-header"},c.a.createElement(ge.a,{trigger:R,footer:`${n.g} alpha ${n.h}`},c.a.createElement(pe.a,{icon:"saved-messages",onClick:B},S("SavedMessages")),c.a.createElement(pe.a,{icon:"archive",onClick:r},c.a.createElement("span",{className:"menu-item-name"},S("ArchivedChats")),P>0&&c.a.createElement("div",{className:"archived-badge"},P)),c.a.createElement(pe.a,{icon:"user",onClick:o},S("Contacts")),c.a.createElement(pe.a,{icon:"settings",onClick:s},S("Settings")),c.a.createElement(pe.a,{icon:"darkmode",onClick:D},c.a.createElement("span",{className:"menu-item-name"},S("lng_menu_night_mode")),c.a.createElement(ye,{id:"darkmode",label:S("dark"===f?"lng_settings_disable_night_theme":"lng_settings_enable_night_theme"),checked:"dark"===f,noAnimation:!0})),c.a.createElement(pe.a,{icon:"animations",onClick:F},c.a.createElement("span",{className:"menu-item-name capitalize"},S("Appearance.Animations").toLowerCase()),c.a.createElement(ye,{id:"animations",label:"Toggle Animations",checked:I>0})),c.a.createElement(pe.a,{icon:"help",onClick:()=>{C({langCode:S.code})}},S("TelegramFeatures")),c.a.createElement(pe.a,{icon:"bug",href:n.F},"Report Bug"),A&&c.a.createElement(c.a.Fragment,null,c.a.createElement(pe.a,{icon:"char-K",href:"https://web.telegram.org/k/",onClick:()=>{localStorage.setItem("kz_version",JSON.stringify("K")),Object(de.c)()}},"Switch to K Version"),c.a.createElement(pe.a,{icon:"char-W",href:"https://web.telegram.org/?legacy=1",onClick:de.c},"Switch to Old Version"))),c.a.createElement(Ie.a,{inputId:"telegram-search-input",parentContainerClassName:"LeftSearch",className:g||p?"with-picker-item":"",value:t||b,focused:U,isLoading:h,placeholder:H,autoComplete:"off",canClose:Boolean(g||p),onChange:a,onReset:d,onFocus:L},T&&c.a.createElement(ve.a,{icon:"calendar",title:T,canClose:!0,isMinimized:Boolean(g),className:"search-date",onClick:E,clickArg:k}),g&&c.a.createElement(ve.a,{chatOrUserId:g,onClick:i,canClose:!0,clickArg:N}))))})),we=a(27);a(210);var Se=Object(c.h)(()=>{const e=Object(Oe.a)();return c.a.createElement("div",{id:"ConnectionState",dir:e.isRtl?"rtl":void 0},c.a.createElement(we.a,{color:"black"}),c.a.createElement("div",{className:"state-text"},e("WaitingForNetwork")))}),Me=a(138),ke=(e,t,a)=>{const s=((e,t=!1)=>Object(c.p)(()=>Object(f.h)(e=>e(),e,!t),[e,t]))(t,!0),[n,o]=Object(c.r)(),[r,i,l]=Object(he.a)();return Object(se.c)(i,l),Object(le.a)(()=>{r||s(()=>{o(e())})},a.concat([r])),n},Ne=a(178),Te=a(200);var Pe=Object(c.h)(Object(s.h)(e=>{const{chats:{byId:t},users:{byId:a},chatFolders:{byId:s,orderedIds:n,activeChatFolder:c},currentUserId:o,lastSyncTime:i}=e;return{chatsById:t,usersById:a,chatFoldersById:s,orderedFolderIds:n,lastSyncTime:i,notifySettings:Object(r.fb)(e),notifyExceptions:Object(r.eb)(e),activeChatFolder:c,currentUserId:o}},(e,t)=>Object(h.l)(t,["loadChatFolders","setActiveChatFolder","openChat"]))(({chatsById:e,usersById:t,chatFoldersById:a,notifySettings:s,notifyExceptions:n,orderedFolderIds:o,activeChatFolder:r,currentUserId:i,lastSyncTime:d,foldersDispatch:b,onScreenSelect:u,loadChatFolders:O,setActiveChatFolder:j,openChat:g})=>{const p=Object(c.q)(null),f=Object(Oe.a)();Object(c.n)(()=>{d&&O()},[d,O]);const I=Object(c.p)(()=>o?o.map(e=>a[e]||{}).filter(Boolean):void 0,[a,o]),v=ke(()=>{if(!I||!I.length)return;const a=Object.keys(e).map(Number),c=I.map(c=>{const{unreadDialogsCount:o,hasActiveDialogs:r}=Object(l.o)(e,t,c,a,s,n)||{};return{id:c.id,badgeCount:o,isBadgeActive:r}});return Object(h.c)(c,"id")},3e3,[I,e,t,s,n]),y=Object(c.p)(()=>{if(I&&I.length)return[{title:"en"===f.code?"All":f("FilterAllChats")},...I.map(e=>({title:e.title,...v&&v[e.id]}))]},[I,v,f]),C=Object(c.m)(e=>{j(e)},[j]);Object(c.n)(()=>{y&&y.length&&r>=y.length&&j(0)},[r,y,j]),Object(c.n)(()=>{if(p.current&&m.n&&y&&y.length)return Object(Me.b)(p.current,{onSwipe:(e,t)=>{t===Me.a.Left?j(Math.min(r+1,y.length-1)):t===Me.a.Right&&j(Math.max(0,r-1))}})},[r,y,j]);const E=Object(c.q)();E.current=0!==r,Object(c.n)(()=>E.current?Object(be.a)(()=>{E.current&&j(0)}):void 0,[r,j]),Object(de.b)(0!==r,()=>j(0)),Object(c.n)(()=>{const e=e=>{if(e.ctrlKey&&e.shiftKey&&e.code.startsWith("Digit")&&y){const[,t]=e.code.match(/Digit(\d)/)||[];if(!t)return;if("0"===t)return void g({id:i,shouldReplaceHistory:!0});const a=Number(t)-1;if(a>y.length-1)return;j(a),e.preventDefault()}};return document.addEventListener("keydown",e,!0),()=>{document.removeEventListener("keydown",e,!0)}});const{shouldRender:w,transitionClassNames:S}=Object(oe.a)(!o,void 0,!0);function M(e){const t=Object.values(a).find(({title:e})=>e===y[r].title);return t&&0!==r?c.a.createElement(Te.a,{folderType:"folder",folderId:t.id,isActive:e,onScreenSelect:u,foldersDispatch:b}):c.a.createElement(Te.a,{folderType:"all",isActive:e,foldersDispatch:b,onScreenSelect:u})}return c.a.createElement("div",{className:"ChatFolders"},y&&y.length?c.a.createElement(Ne.a,{tabs:y,activeTab:r,onSwitchTab:C}):w?c.a.createElement("div",{className:Object(ne.a)("tabs-placeholder",S)}):void 0,c.a.createElement(me.a,{ref:p,name:f.isRtl?"slide-reversed":"slide",activeKey:r,renderCount:y?y.length:void 0},M))})),Ae=a(15),Re=a(26),xe=a(20);var Le=Object(c.h)(e=>{const t=Object(Re.a)(Ae.a.Extra,"LeftSearch");return t?c.a.createElement(t,e):c.a.createElement(xe.a,null)});var Be=Object(c.h)(e=>{const t=Object(Re.a)(Ae.a.Extra,"ContactList");return t?c.a.createElement(t,e):c.a.createElement(xe.a,null)}),De=a(57);a(223);let Fe;var Ue=Object(c.h)(({isShown:e,onNewPrivateChat:t,onNewChannel:a,onNewGroup:s})=>{const[n,o]=Object(c.r)(!1);Object(c.n)(()=>{e||o(!1)},[e]);const r=Object(Oe.a)(),i=Object(ne.a)("NewChatButton",e&&"revealed",n&&"menu-is-open"),l=Object(c.m)(()=>{Fe&&(clearTimeout(Fe),Fe=void 0)},[]),d=Object(c.m)(()=>{Fe&&(clearTimeout(Fe),Fe=void 0),Fe=window.setTimeout(()=>{o(!1)},750)},[]);return c.a.createElement("div",{className:i,onMouseEnter:l,onMouseLeave:d},c.a.createElement(fe.a,{round:!0,color:"primary",className:n?"active":"",onClick:()=>{o(!n)},ariaLabel:r(n?"Close":"NewMessageTitle"),tabIndex:-1},c.a.createElement("i",{className:"icon-new-chat-filled"}),c.a.createElement("i",{className:"icon-close"})),c.a.createElement(De.a,{isOpen:n,positionX:"right",positionY:"bottom",autoClose:!0,onClose:()=>{o(!1)}},c.a.createElement(pe.a,{icon:"channel",onClick:a},r("NewChannel")),c.a.createElement(pe.a,{icon:"group",onClick:s},r("NewGroup")),c.a.createElement(pe.a,{icon:"user",onClick:t},r("NewMessageTitle"))))}),He=a(166);a(224);const qe=Object.keys(u.d).length/2;let Ge;var _e=Object(s.h)(e=>Object(h.l)(e,["connectionState"]))(({content:e,searchQuery:t,searchDate:a,contactsFilter:s,shouldSkipTransition:n,foldersDispatch:o,onSearchQuery:r,onContentChange:i,onScreenSelect:l,onReset:d,connectionState:b})=>{const[h,O]=Object(c.r)(m.n),j=!function(){const[e,t]=Object(c.r)(window.navigator.onLine);return Object(c.n)(()=>{function e(){t(window.navigator.onLine)}return window.addEventListener("online",e),window.addEventListener("offline",e),()=>{window.removeEventListener("offline",e),window.removeEventListener("online",e)}},[]),e}()||"connectionStateConnecting"===b,g=Object(c.q)(!1),p=Object(c.m)(()=>{i(u.d.Settings)},[i]),f=Object(c.m)(()=>{i(u.d.Contacts)},[i]),I=Object(c.m)(()=>{i(u.d.NewChannelStep1)},[i]),v=Object(c.m)(()=>{i(u.d.NewGroupStep1)},[i]),y=Object(c.m)(()=>{i(u.d.Archived)},[i]),C=Object(c.m)(()=>{e===u.d.ChatList&&(g.current=!0,O(!0))},[e]),E=Object(c.m)(()=>{g.current=!1,Ge&&(clearTimeout(Ge),Ge=void 0),Ge=window.setTimeout(()=>{g.current||O(!1)},250)},[]);Object(c.n)(()=>{let t;return e!==u.d.ChatList?t=window.setTimeout(()=>{O(!1)},250):(g.current||m.n)&&O(!0),()=>{t&&(clearTimeout(t),t=void 0)}},[e]);const[w,S,M]=function(){const[e,t]=Object(he.a)(!1);Object(c.n)(()=>{const e=window.setTimeout(t,2592e5);return()=>{clearTimeout(e)}},[t]);const{shouldRender:a,transitionClassNames:s}=Object(oe.a)(e);return[a,s,()=>{window.location.reload()}]}(),k=Object(Oe.a)();return c.a.createElement("div",{id:"LeftColumn-main",onMouseEnter:m.n?void 0:C,onMouseLeave:m.n?void 0:E},c.a.createElement(Ee,{content:e,contactsFilter:s,onSearchQuery:r,onSelectSettings:p,onSelectContacts:f,onSelectArchived:y,onReset:d,shouldSkipTransition:n}),c.a.createElement(He.a,{isOpen:j,isCustom:!0,className:"connection-state-wrapper opacity-transition slow"},()=>c.a.createElement(Se,null)),c.a.createElement(me.a,{name:n?"none":"zoom-fade",renderCount:qe,activeKey:e,shouldCleanup:!0,cleanupExceptionKey:u.d.ChatList,className:j?"pull-down":void 0},n=>{switch(e){case u.d.ChatList:return c.a.createElement(Pe,{onScreenSelect:l,foldersDispatch:o});case u.d.GlobalSearch:return c.a.createElement(Le,{searchQuery:t,searchDate:a,isActive:n,onReset:d});case u.d.Contacts:return c.a.createElement(Be,{filter:s,isActive:n,onReset:d});default:return}}),w&&c.a.createElement(fe.a,{fluid:!0,pill:!0,className:Object(ne.a)("btn-update",S),onClick:M},k("lng_update_telegram")),c.a.createElement(Ue,{isShown:h,onNewPrivateChat:f,onNewChannel:I,onNewGroup:v}))});var ze=Object(c.h)(e=>{const t=Object(Re.a)(Ae.a.Extra,"Settings");return t?c.a.createElement(t,e):c.a.createElement(xe.a,null)});var Ke=Object(c.h)(e=>{const t=Object(Re.a)(Ae.a.Extra,"NewChat");return t?c.a.createElement(t,e):c.a.createElement(xe.a,null)});var $e,Ve=Object(c.h)(e=>{const t=Object(Re.a)(Ae.a.Extra,"ArchivedChats");return t?c.a.createElement(t,e):c.a.createElement(xe.a,null)});a(225);!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"}($e||($e={}));const We=Object.keys($e).length/2;var Qe=Object(c.h)(Object(s.h)(e=>{const{globalSearch:{query:t,date:a},chatFolders:{activeChatFolder:s},shouldSkipHistoryAnimations:n}=e;return{searchQuery:t,searchDate:a,activeChatFolder:s,shouldSkipHistoryAnimations:n}},(e,t)=>Object(h.l)(t,["setGlobalSearchQuery","setGlobalSearchChatId","resetChatCreation","setGlobalSearchDate","loadPasswordInfo","clearTwoFaError"]))(({searchQuery:e,searchDate:t,activeChatFolder:a,shouldSkipHistoryAnimations:s,setGlobalSearchQuery:n,setGlobalSearchChatId:o,resetChatCreation:r,setGlobalSearchDate:i,loadPasswordInfo:l,clearTwoFaError:d})=>{const[b,h]=Object(c.r)(u.d.ChatList),[O,j]=Object(c.r)(u.n.Main),[g,p]=Object(c.r)(""),[f,I]=Object(ue.c)(),[v,y]=Object(c.r)(0);let C=$e.Main;switch(b){case u.d.Archived:C=$e.Archived;break;case u.d.Settings:C=$e.Settings;break;case u.d.NewChannelStep1:case u.d.NewChannelStep2:C=$e.NewChannel;break;case u.d.NewGroupStep1:case u.d.NewGroupStep2:C=$e.NewGroup}const E=Object(c.m)(e=>{if(b!==u.d.NewGroupStep2||e)if(b!==u.d.NewChannelStep2||e){if(b===u.d.NewGroupStep1){const e=document.getElementById("new-group-picker-search");e&&e.blur()}if(b===u.d.Settings)switch(O){case u.n.EditProfile:case u.n.Folders:case u.n.General:case u.n.Notifications:case u.n.Privacy:case u.n.Language:return void j(u.n.Main);case u.n.GeneralChatBackground:return void j(u.n.General);case u.n.GeneralChatBackgroundColor:return void j(u.n.GeneralChatBackground);case u.n.PrivacyPhoneNumber:case u.n.PrivacyLastSeen:case u.n.PrivacyProfilePhoto:case u.n.PrivacyForwarding:case u.n.PrivacyGroupChats:case u.n.PrivacyActiveSessions:case u.n.PrivacyBlockedUsers:case u.n.TwoFaDisabled:case u.n.TwoFaEnabled:case u.n.TwoFaCongratulations:return void j(u.n.Privacy);case u.n.PrivacyPhoneNumberAllowedContacts:case u.n.PrivacyPhoneNumberDeniedContacts:return void j(u.n.PrivacyPhoneNumber);case u.n.PrivacyLastSeenAllowedContacts:case u.n.PrivacyLastSeenDeniedContacts:return void j(u.n.PrivacyLastSeen);case u.n.PrivacyProfilePhotoAllowedContacts:case u.n.PrivacyProfilePhotoDeniedContacts:return void j(u.n.PrivacyProfilePhoto);case u.n.PrivacyForwardingAllowedContacts:case u.n.PrivacyForwardingDeniedContacts:return void j(u.n.PrivacyForwarding);case u.n.PrivacyGroupChatsAllowedContacts:case u.n.PrivacyGroupChatsDeniedContacts:return void j(u.n.PrivacyGroupChats);case u.n.TwoFaNewPassword:return void j(u.n.TwoFaDisabled);case u.n.TwoFaNewPasswordConfirm:return void j(u.n.TwoFaNewPassword);case u.n.TwoFaNewPasswordHint:return void j(u.n.TwoFaNewPasswordConfirm);case u.n.TwoFaNewPasswordEmail:return void j(u.n.TwoFaNewPasswordHint);case u.n.TwoFaNewPasswordEmailCode:return void j(u.n.TwoFaNewPasswordEmail);case u.n.TwoFaChangePasswordCurrent:case u.n.TwoFaTurnOff:case u.n.TwoFaRecoveryEmailCurrentPassword:return void j(u.n.TwoFaEnabled);case u.n.TwoFaChangePasswordNew:return void j(u.n.TwoFaChangePasswordCurrent);case u.n.TwoFaChangePasswordConfirm:return void j(u.n.TwoFaChangePasswordNew);case u.n.TwoFaChangePasswordHint:return void j(u.n.TwoFaChangePasswordConfirm);case u.n.TwoFaRecoveryEmail:return void j(u.n.TwoFaRecoveryEmailCurrentPassword);case u.n.TwoFaRecoveryEmailCode:return void j(u.n.TwoFaRecoveryEmail);case u.n.FoldersCreateFolder:case u.n.FoldersEditFolder:return void j(u.n.Folders);case u.n.FoldersIncludedChatsFromChatList:case u.n.FoldersExcludedChatsFromChatList:return void j(u.n.FoldersEditFolderFromChatList);case u.n.FoldersEditFolderFromChatList:return h(u.d.ChatList),void j(u.n.Main)}b!==u.d.ChatList||0!==a?(h(u.d.ChatList),p(""),n({query:""}),i({date:void 0}),o({id:void 0}),r(),setTimeout(()=>{y(Date.now())},250)):h(u.d.GlobalSearch)}else h(u.d.NewChannelStep1);else h(u.d.NewGroupStep1)},[b,a,O,n,i,o,r]),w=Object(c.m)(t=>{b!==u.d.Contacts?(h(u.d.GlobalSearch),t!==e&&n({query:t})):p(t)},[b,e,n]);Object(c.n)(()=>b!==u.d.ChatList||0===a?Object(be.a)(()=>E()):void 0,[a,b,E]),Object(c.n)(()=>{d(),O===u.n.Privacy&&l()},[d,l,O]);const S=e=>{h(u.d.Settings),j(e)};return c.a.createElement(me.a,{id:"LeftColumn",name:s?"none":m.p,renderCount:We,activeKey:C,shouldCleanup:!0,cleanupExceptionKey:$e.Main},a=>{switch(C){case $e.Archived:return c.a.createElement(Ve,{isActive:a,onReset:E,onContentChange:h});case $e.Settings:return c.a.createElement(ze,{isActive:a,currentScreen:O,foldersState:f,foldersDispatch:I,onScreenSelect:S,onReset:E,shouldSkipTransition:s});case $e.NewChannel:return c.a.createElement(Ke,{key:v,isActive:a,isChannel:!0,content:b,onContentChange:h,onReset:E});case $e.NewGroup:return c.a.createElement(Ke,{key:v,isActive:a,content:b,onContentChange:h,onReset:E});default:return c.a.createElement(_e,{content:b,searchQuery:e,searchDate:t,contactsFilter:g,foldersDispatch:I,onContentChange:h,onSearchQuery:w,onScreenSelect:S,onReset:E,shouldSkipTransition:s})}})})),Ye=a(144),Je=a(12),Xe=a(17),Ze=a(56);var et=()=>{const[e,t]=Object(c.r)(Ze.a.get());return Object(c.n)(()=>{const e=Object(f.h)(()=>{t(Ze.a.get())},250,!1);return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]),e},tt=a(185);function at(e,t){const a=e<=n.ob?16:32,s=function(e){if(e>n.lb){const t=Math.min(Math.max(.25*e,288),424),a=Math.min(.25*e,424);return Math.min(e-t-a,728)}if(e>n.kb){const t=Math.min(Math.max(.4*e,288),424);return Math.min(e-t,728)}if(e>728)return 728;return e}(e),c=e<=n.ob?54:64,o=t?s-a-c:s-a,r=e>n.ob?Math.min(s-a,512):s-a,i=r/o,l=o/r;return{composerHiddenScale:i,toolbarHiddenScale:l,composerTranslateX:t?c/2*l:0,toolbarTranslateX:t?c/2*-1*i:0,unpinHiddenScale:r/258,toolbarForUnpinHiddenScale:258/r}}const st=e=>e.chatId.toString()+("thread"!==e.type?"_"+e.type:-1!==e.threadId?"_"+e.threadId:"");var nt=a(135),ct=a(150),ot=a(140),rt=a(52),it=a(112),lt=a(131);var dt=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Re.a)(Ae.a.Extra,"HeaderMenuContainer",!t);return a?c.a.createElement(a,e):void 0});var bt=Object(c.h)(Object(s.h)((e,{chatId:t,threadId:a,messageListType:s})=>{const n=Object(r.g)(e,t),c=Boolean(n&&Object(l.mb)(n));if(n&&n.isRestricted)return{noMenu:!0};const o=Object(r.h)(e,t),i=Object(r.P)(e,t),d="thread"===s&&a===b.MAIN_THREAD_ID,u="thread"===s&&a!==b.MAIN_THREAD_ID,h=Object(r.W)(e),O=Boolean(o&&Object(r.X)(e,o.id)),j=!O&&Boolean(Object(r.L)(e,t)),g=Boolean(d&&n&&(c||Object(l.qb)(n))&&n.isNotJoined),p=d||u,f=d&&!i&&!g,I=!Object(r.S)(e),v=d&&!g;return{noMenu:!(m.l&&g||m.l&&p||f||I||v),isChannel:c,isRightColumnShown:h,canStartBot:j,canRestartBot:O,canSubscribe:g,canSearch:p,canMute:f,canSelect:I,canLeave:v}},(e,t)=>Object(h.l)(t,["joinChannel","sendBotCommand","openLocalTextSearch","restartBot"]))(({chatId:e,threadId:t,noMenu:a,isChannel:s,canStartBot:n,canRestartBot:o,canSubscribe:r,canSearch:i,canMute:l,canSelect:d,canLeave:b,isRightColumnShown:u,joinChannel:h,sendBotCommand:O,openLocalTextSearch:j,restartBot:g})=>{const p=Object(c.q)(null),[f,I]=Object(c.r)(!1),[v,y]=Object(c.r)(void 0),C=Object(c.m)(()=>{I(!0);const e=p.current.getBoundingClientRect();y({x:e.right,y:e.bottom})},[]),E=Object(c.m)(()=>{I(!1)},[]),w=Object(c.m)(()=>{y(void 0)},[]),S=Object(c.m)(()=>{h({chatId:e})},[h,e]),M=Object(c.m)(()=>{O({command:"/start"})},[O]),k=Object(c.m)(()=>{g({chatId:e})},[e,g]),N=Object(c.m)(()=>{if(j(),m.l){document.querySelector("#MobileSearch input").focus()}else setTimeout(()=>{const e=document.querySelector(".RightHeader .SearchInput input");e&&e.focus()},400)},[j]),T=Object(Oe.a)();return c.a.createElement("div",{className:"HeaderActions"},!m.l&&r&&c.a.createElement(fe.a,{size:"tiny",ripple:!0,fluid:!0,onClick:S},T(s?"Subscribe":"Join Group")),!m.l&&n&&c.a.createElement(fe.a,{size:"tiny",ripple:!0,fluid:!0,onClick:M},T("BotStart")),!m.l&&o&&c.a.createElement(fe.a,{size:"tiny",ripple:!0,fluid:!0,onClick:k},T("BotRestart")),!m.l&&i&&c.a.createElement(fe.a,{round:!0,ripple:u,color:"translucent",size:"smaller",onClick:N,ariaLabel:"Search in this chat"},c.a.createElement("i",{className:"icon-search"})),(m.l||!r)&&c.a.createElement(fe.a,{ref:p,className:f?"active":"",round:!0,ripple:!m.l,size:"smaller",color:"translucent",disabled:a,ariaLabel:"More actions",onClick:C},c.a.createElement("i",{className:"icon-more"})),v&&c.a.createElement(dt,{chatId:e,threadId:t,isOpen:f,anchor:v,isChannel:s,canStartBot:n,canRestartBot:o,canSubscribe:r,canSearch:i,canMute:l,canSelect:d,canLeave:b,onSubscribeChannel:S,onSearchClick:N,onClose:E,onCloseAnimationEnd:w}))})),ut=a(119),mt=a(23),ht=a(111),Ot=a(47);function jt(e){const t=e&&Object(l.F)(e),{sticker:a}=e&&e.content||{},s=t&&a&&!Object(m.t)()&&t.includes("image/webp"),[o,r]=Object(c.r)(Ot.a),i=e&&e.id;return Object(c.o)(()=>{s&&Object(Ot.c)("b64-"+i,t).then(r).catch(e=>{n.r&&console.error(e)})},[i,s,t]),s?o:t}var gt=a(121),pt=a(46);function ft(e,t,a,s,n){return`M${e},${t+n}a${n},${n},0,0,1,\n ${a},0v${s-2*n}a${n},${n},0,0,1,${-a},0Z`}var It=Object(c.h)(({count:e,index:t})=>{const a=Object(c.q)(null),s=Object(c.p)(()=>function(e,t){const a=e-t-1,s=function(e){let t=8;1===e?t=36:2===e?t=17:3===e?t=11:(4===e||e>3)&&(t=7.5);return t}(e),n=function(e,t){let a=36;1===e?a=36:2===e?a=17:3===e?a=1===t?12:11:(4===e||e>3)&&(a=7.5);return a}(e,a),c=function(e,t){return e<=3?36:t*e+2*(e-1)}(e,s),o="clipPath"+e,r=function(e,t,a){let s="";if(3===a)s=ft(0,0,2,t,1)+ft(0,12,2,t+1,1)+ft(0,25,2,t,1);else for(let e=0;e<a;e++)s+=ft(0,(t+2)*e,2,t,1);return`<clipPath id="${e}">\n <path d="${s}" />\n </clipPath>`}(o,s,e),i=function(e,t,a){if(1===a)return 0;if(2===a)return 0===e?0:t+2;return 3===a?0===e?0:1===e?12:25:(t+2)*e}(a,s,e),l=function(e,t,a,s){if(t<=4)return 0;if(e<=1)return 0;if(e>=t-2)return s-36;return(a+4)/2+(e-2)*(a+2)}(a,e,s,c);return{markHeight:n,clipPath:r,markTranslateY:i,trackTranslateY:l,trackHeight:c,clipPathId:o}}(e,t),[e,t]);if(Object(c.n)(()=>{if(!a.current)return;const{trackHeight:e,trackTranslateY:t,markHeight:n,markTranslateY:c,clipPathId:o,clipPath:r}=s,i=a.current.firstElementChild;if(a&&a.current){const s=a.current,{style:l}=s;l.height=e+"px",l.transform=`translateY(-${t}px)`,l.clipPath=`url("#${o}")`;const d=s.querySelector("svg"),b=s.querySelector("div"),u=s.querySelector("defs");d||i&&(i.innerHTML=`<svg height="0" width="0"><defs> ${r} </defs></svg>`),u&&(u.innerHTML=r),b&&(b.style.height=n+"px",b.style.transform=`translateY(${c}px)`)}},[s]),1===e)return c.a.createElement("div",{className:"pinned-message-border"},c.a.createElement("div",{className:"pinned-message-border-wrapper-1",ref:a}));const{trackHeight:n,trackTranslateY:o,markHeight:r,markTranslateY:i,clipPathId:l}=s;return c.a.createElement("div",{className:Object(ne.a)("pinned-message-border",e>4&&"pinned-message-border-mask")},c.a.createElement("div",{className:"pinned-message-border-wrapper",ref:a,style:`clip-path: url("#${l}"); width: 2px;\n height: ${n}px; transform: translateY(-${o}px);`},c.a.createElement("span",null),c.a.createElement("div",{className:"pinned-message-border-mark",style:`height: ${r}px; transform: translateY(${i}px);`})))});var vt=Object(c.h)(({message:e,count:t,index:a,customTitle:s,className:n,onUnpinMessage:o,onClick:r,onAllPinnedClick:i})=>{const d=Object(Oe.a)(),b=jt(e),u=Object(ht.a)(Object(l.E)(e,"pictogram")),m=Object(l.O)(d,e,Boolean(b)),[h,O,j]=Object(he.a)(),g=Object(c.m)(()=>{j(),o&&o(e.id)},[j,o,e.id]);return c.a.createElement("div",{className:Object(ne.a)("HeaderPinnedMessage-wrapper",n)},t>1&&c.a.createElement(fe.a,{round:!0,size:"smaller",color:"translucent",className:"pin-list-button",ariaLabel:d("EventLogFilterPinnedMessages"),onClick:i},c.a.createElement("i",{className:"icon-pin-list"})),o&&c.a.createElement(fe.a,{round:!0,size:"smaller",color:"translucent",ariaLabel:d("UnpinMessageAlertTitle"),className:"unpin-button",onClick:O},c.a.createElement("i",{className:"icon-close"})),c.a.createElement(gt.a,{isOpen:h,onClose:j,text:"Would you like to unpin this message?",confirmLabel:"Unpin",confirmHandler:g}),c.a.createElement("div",{className:"HeaderPinnedMessage",onClick:r,dir:d.isRtl?"rtl":void 0},c.a.createElement(It,{count:t,index:a}),b&&function(e,t){const{width:a,height:s}=Object(ut.m)();return c.a.createElement("img",{src:t||e,width:a,height:s,alt:""})}(b,u),c.a.createElement("div",{className:"message-text"},c.a.createElement("div",{className:"title",dir:"auto"},s||`${d("PinnedMessage")} ${a>0?"#"+(t-a):""}`),c.a.createElement("p",{dir:"auto"},Object(mt.a)(m))),c.a.createElement(pt.a,null)))}),yt=a(34),Ct=a(186);a(228);var Et=Object(s.h)((e,{message:t})=>({sender:Object(r.vb)(e,t)}),(e,t)=>Object(h.l)(t,["focusMessage","closeAudioPlayer"]))(({message:e,className:t,noUi:a,sender:s,focusMessage:n,closeAudioPlayer:o})=>{const r=Object(Oe.a)(),i=s?Object(l.X)(r,s):void 0,d=yt.c(Object(l.E)(e,"inline")),{playPause:b,isPlaying:u}=Object(Ct.a)(Object(l.C)(e),Object(l.q)(e),d,void 0,void 0,!0),h=Object(c.m)(()=>{n({chatId:e.chatId,messageId:e.id})},[n,e.chatId,e.id]),O=Object(c.m)(()=>{u&&b(),o()},[o,u,b]);if(a)return;const j=Object(l.t)(e);return c.a.createElement("div",{className:Object(ne.a)("AudioPlayer",t),dir:r.isRtl?"rtl":void 0},c.a.createElement(fe.a,{round:!0,ripple:!m.l,color:"translucent",size:"smaller",className:Object(ne.a)("toggle-play",u?"pause":"play"),onClick:b,ariaLabel:u?"Pause audio":"Play audio"},c.a.createElement("i",{className:"icon-play"}),c.a.createElement("i",{className:"icon-pause"})),c.a.createElement("div",{className:"AudioPlayer-content",onClick:h},j?function(e){const{title:t,performer:a,fileName:s}=e;return c.a.createElement(c.a.Fragment,null,c.a.createElement("div",{className:"title",dir:"auto"},Object(mt.a)(t||s)),a&&c.a.createElement("div",{className:"subtitle",dir:"auto"},Object(mt.a)(a)))}(j):function(e,t){return c.a.createElement(c.a.Fragment,null,c.a.createElement("div",{className:"title",dir:"auto"},t&&Object(mt.a)(t)),c.a.createElement("div",{className:"subtitle",dir:"auto"},e))}(r("AttachAudio"),i),c.a.createElement(pt.a,null)),c.a.createElement(fe.a,{round:!0,className:"player-close",color:"translucent",size:"smaller",onClick:O,ariaLabel:"Close player"},c.a.createElement("i",{className:"icon-close"})))});a(229);var wt=Object(c.h)(Object(s.h)((e,{chatId:t,threadId:a,messageListType:s})=>{const{isLeftColumnShown:n,lastSyncTime:c,shouldSkipHistoryAnimations:o}=e,{byId:i}=e.chats,l=Object(r.g)(e,t),{typingStatus:d}=l||{},{chatId:u,messageId:m}=e.audioPlayer,h=u&&m?Object(r.l)(e,u,m):void 0;let O;if("pinned"===s){const a=Object(r.kb)(e,t);O=a&&a.length}else if("scheduled"===s){const a=Object(r.qb)(e,t);O=a&&a.length}else if("thread"===s&&a!==b.MAIN_THREAD_ID){const s=Object(r.Gb)(e,t,a);s&&(O=s.messagesCount)}const j={typingStatus:d,isLeftColumnShown:n,isRightColumnShown:Object(r.W)(e),isSelectModeActive:Object(r.S)(e),audioMessage:h,chat:l,chatsById:i,messagesCount:O,isChatWithSelf:Object(r.P)(e,t),isChatWithBot:l&&Object(r.O)(e,l),lastSyncTime:c,notifySettings:Object(r.fb)(e),notifyExceptions:Object(r.eb)(e),shouldSkipHistoryAnimations:o,currentTransitionKey:Math.max(0,e.messages.messageLists.length-1)},g=Object(r.n)(e,t);if("thread"!==s||!g)return j;if(Object.assign(j,{messagesById:g}),a!==b.MAIN_THREAD_ID){const s=Object(r.Ib)(e,t,a),n=s?Object(r.l)(e,t,s):void 0,c=n?Object(r.K)(e,n):void 0;return{...j,pinnedMessageIds:s,canUnpin:!1,topMessageSender:c}}const p=Object(r.kb)(e,t);if(p&&p.length){const t=g[p[0]],{canUnpin:s}=t&&Object(r.b)(e,t,a)||{};return{...j,pinnedMessageIds:p,canUnpin:s}}return j},(e,t)=>Object(h.l)(t,["openChatWithInfo","pinMessage","focusMessage","openChat","openPreviousChat","loadPinnedMessages","toggleLeftColumn","exitMessageSelectMode"]))(({chatId:e,threadId:t,messageListType:a,isReady:s,pinnedMessageIds:o,messagesById:r,canUnpin:i,topMessageSender:d,typingStatus:u,isSelectModeActive:h,isLeftColumnShown:O,isRightColumnShown:j,audioMessage:g,chat:p,chatsById:f,messagesCount:I,isChatWithSelf:v,isChatWithBot:y,lastSyncTime:C,notifySettings:E,notifyExceptions:w,shouldSkipHistoryAnimations:S,currentTransitionKey:M,openChatWithInfo:k,pinMessage:N,focusMessage:T,openChat:P,openPreviousChat:A,loadPinnedMessages:R,toggleLeftColumn:x,exitMessageSelectMode:L})=>{const B=Object(Oe.a)(),[D,F]=Object(c.r)(0),U=Array.isArray(o)?o[D]:o,H=r&&U?r[U]:void 0,q=Array.isArray(o)?o.length:o?1:0,G=p&&Object(l.k)(B,p).length,_=d?Object(l.X)(B,d):void 0;Object(c.n)(()=>{t===b.MAIN_THREAD_ID&&C&&s&&R({chatId:e})},[e,R,C,t,s]),Object(c.n)(()=>{F(0)},[o]),Object(ct.a)(e,U,H);const{width:z}=et(),K=z<=n.kb,$=m.m&&O,V=Object(c.q)(null),W=Object(c.q)(!0),Q=Object(c.m)(()=>{k({id:e})},[k,e]),Y=Object(c.m)(t=>{N({chatId:e,messageId:t,isUnpin:!0})},[N,e]),J=Object(c.m)(()=>{if(H){T({chatId:H.chatId,threadId:t,messageId:H.id});const e=Object(nt.a)(q,D+1);F(e)}},[H,T,t,q,D]),X=Object(c.m)(()=>{P({id:e,threadId:b.MAIN_THREAD_ID,type:"pinned"})},[P,e]),Z=Object(c.m)(e=>{if(m.l){const e=document.getElementById(n.z);e&&e.blur()}t!==b.MAIN_THREAD_ID||"thread"!==a||0!==M?("scheduled"===a&&h&&L(),A()):m.l||$?(e.stopPropagation(),P({id:void 0})):x()},[t,a,M,h,A,$,P,x,L]),ee=Object(c.p)(()=>{if(!K||!f)return;let e=!1;const t=Object.values(f).reduce((t,a)=>{if(Object(l.kb)(a))return t;const s=a.unreadCount||0;return!s||Object(l.Hb)(a,E,w)&&!a.unreadMentionsCount||(e=!0),t+s},0);return t?{isActive:e,totalCount:t}:void 0},[K,f,E,w]),te=z>=n.kb&&z<n.vb||z>n.ob&&z<n.kb&&(!G||G>30),ae=te||z>n.lb&&z<n.wb,{shouldRender:se,transitionClassNames:ce}=Object(oe.a)(Boolean(g)),re=Object(ot.a)(g),{shouldRender:ie,transitionClassNames:le}=Object(oe.a)(H&&!se),de=Object(ot.a)(H),be=Object(ot.a)(_),ue=ie&&de||se&&re;function he(){return"thread"===a&&t===b.MAIN_THREAD_ID?c.a.createElement(c.a.Fragment,null,(K||M>0)&&je($,ee),c.a.createElement("div",{className:"chat-info-wrapper",onClick:Q},Object(l.ob)(e)?c.a.createElement(it.a,{userId:e,typingStatus:u,withFullInfo:y,withMediaViewer:!0,withUpdatingStatus:!0,noRtl:!0}):c.a.createElement(lt.a,{chatId:e,typingStatus:u,noRtl:!0,withMediaViewer:!0,withFullInfo:!0,withUpdatingStatus:!0}))):"thread"===a?c.a.createElement(c.a.Fragment,null,je(),c.a.createElement("h3",null,B("CommentsCount",I))):"pinned"===a?c.a.createElement(c.a.Fragment,null,je(),c.a.createElement("h3",null,B("PinnedMessagesCount",I))):"scheduled"===a?c.a.createElement(c.a.Fragment,null,je(),c.a.createElement("h3",null,v?B("Reminders"):B("messages",I,"i"))):void 0}function je(e=!1,t){return c.a.createElement("div",{className:"back-button"},c.a.createElement(fe.a,{round:!0,size:"smaller",color:"translucent",onClick:Z,ariaLabel:e?"Close":"Back"},c.a.createElement("div",{className:Object(ne.a)("animated-close-icon",!e&&"state-back")})),t&&c.a.createElement("div",{className:"unread-count "+(t.isActive?"active":"")},Object(rt.b)(t.totalCount)))}return Object(c.n)(()=>{const e=V.current;if(e)return ae&&ue?void(j||te?(W.current&&(e.classList.add("tools-stacked","animated"),W.current=!1),setTimeout(()=>{e.classList.remove("animated")},350)):(e.classList.remove("tools-stacked"),W.current=!0)):(e.classList.remove("tools-stacked","animated"),void(W.current=!0))},[ae,ue,te,j]),c.a.createElement("div",{className:"MiddleHeader",ref:V},c.a.createElement(me.a,{name:S?"none":"slide-fade",activeKey:M},he),c.a.createElement("div",{className:"header-tools"},ie&&de&&!se&&c.a.createElement(vt,{key:e,message:de,count:q,index:D,customTitle:be,className:le,onUnpinMessage:i?Y:void 0,onClick:J,onAllPinnedClick:X}),se&&re&&c.a.createElement(Et,{key:Object(l.C)(re),message:re,className:ce}),c.a.createElement(bt,{chatId:e,threadId:t,messageListType:a})))})),St=a(168),Mt=a(59);function kt(e){return"albumId"in e}function Nt(e,t){let a,s=[],n={originalDate:e[0].date,datetime:Number(Object(x.j)(1e3*e[0].date)),senderGroups:[s]};const c=[n];return e.forEach((o,r)=>{o.isInAlbum?a?(a.messages.push(o),o.content.text&&(a.mainMessage=o)):a={albumId:o.groupedId,messages:[o],mainMessage:o}:s.push(o);const i=e[r+1];if(!a||i&&i.groupedId&&i.groupedId===a.albumId||(s.push(a),a=void 0),i){const e=Number(Object(x.j)(1e3*i.date));n.datetime!==e?(n={originalDate:i.date,datetime:e,senderGroups:[]},c.push(n),s=[],n.senderGroups.push(s)):(i.id===t||o.senderId!==i.senderId||o.isOutgoing!==i.isOutgoing||Object(l.gb)(o)||Object(l.gb)(i)||o.forwardInfo&&i.forwardInfo&&(o.forwardInfo.senderUserId!==i.forwardInfo.senderUserId||o.forwardInfo.fromChatId!==i.forwardInfo.fromChatId||o.forwardInfo.hiddenUserName!==i.forwardInfo.hiddenUserName)||o.inlineButtons||i.inlineButtons||i.date-o.date>600)&&(s=[],n.senderGroups.push(s))}}),c}function Tt(e){!m.l&&document.activeElement&&document.activeElement.id===n.z&&e.target===e.currentTarget&&e.preventDefault()}function Pt(){const[e,t]=Object(he.a)(!1),a=(s=1e3,n=!1,Object(c.p)(()=>Object(f.a)(e=>e(),s,n,o),[s,n,o]));var s,n,o;return{isScrolled:e,updateStickyDates:Object(c.m)((e,s)=>{t(),document.body.classList.contains("is-scrolling-messages")||Object(f.b)(()=>{document.body.classList.add("is-scrolling-messages")}),a(()=>{Object(f.b)(()=>{const t=document.querySelector(".stuck");t&&t.classList.remove("stuck");const a=function(e,t){const a=e.querySelectorAll(".sticky-date"),s=e.scrollTop;return Array.from(a).find(e=>{const{offsetTop:a,offsetHeight:n}=e,c=a-s;return-n<=c&&c<=(t?60:10)})}(e,s);a&&a.classList.add("stuck"),document.body.classList.remove("is-scrolling-messages")})})},[t,a])}}var At=a(163),Rt=a(132),xt=a(110);const Lt=m.b?1e3:350,Bt=m.l?300:500;var Dt=a(151),Ft=a(152);function Ut(e){return"number"==typeof e}function Ht(e,t){return e?t?238:175:t?238:100}function qt(e,t){const a=Object(l.yb)(e),s=Object(l.tb)(e),n=Object(l.H)(e)||Object(l.S)(e),c=Object(l.Q)(e),o=Boolean(Object(l.S)(e)),{width:r,height:i}=n?Object(ut.g)(n,a,s,o,t):Object(ut.i)(c,a,s,t),d=Ht(Boolean(Object(l.P)(e)));let b=1;r<d&&d-r<12&&(b=d/r),i*b<90&&90-i*b<12&&(b=90/i);const u=Math.round(r*b),m=Math.round(i*b);return{width:u,height:m,isSmall:u<d||m<90}}const Gt=0,_t=1,zt=2,Kt=4,$t=8;function Vt(e,t){return e.reduce((e,t)=>e+t,t)}function Wt(e,t,a){return e<t?t:e>a?a:e}function Qt(e){const t={width:0,height:0};return e.forEach(({dimensions:e,sides:a})=>{a&zt&&(t.width=e.width+e.x),a&Kt&&(t.height=e.height+e.y)}),t}function Yt(e,t,a,s){const n=s.messages.map(e=>{const t=qt(e);return t.width/t.height});const c=function(e){return e.map(e=>e>1.2?"w":e<.8?"n":"q").join("")}(n),o=function(e){return e.reduce((e,t)=>t+e,1)/e.length}(n),r=n.length,i=n.some(e=>e>2),l=Object(ut.j)(e,t,!1,a)-(t?2.5:0)*ut.d;let d;const b={ratios:n,proportions:c,averageRatio:o,maxWidth:l,minWidth:100,maxHeight:l,spacing:2};return d=r>=5||i?function({ratios:e,averageRatio:t,maxWidth:a,minWidth:s,spacing:n,maxHeight:c=4*a/3}){const o=function(e,t){return e.map(e=>t>1.1?Wt(e,1,2.75):Wt(e,.6667,1))}(e,t),r=e.length,i=new Array(r),l=[],d=e=>{const t=[];let s=0;e.forEach(e=>{t.push(((e,t)=>{const s=Vt(o.slice(e,e+t),0);return(a-(t-1)*n)/s})(s,e)),s+=e}),l.push({lineCounts:e,heights:t})};for(let e=1;e!==r;++e){const t=r-e;e<=3&&t<=3&&d([e,t])}for(let e=1;e!==r-1;++e)for(let a=1;a!==r-e;++a){const s=r-e-a;e<=3&&a<=(t<.85?4:3)&&s<=3&&d([e,a,s])}for(let e=1;e!==r-1;++e)for(let t=1;t!==r-e;++t)for(let a=1;a!==r-e-t;++a){const s=r-e-t-a;e<=3&&t<=3&&a<=3&&s<=4&&d([e,t,a,s])}let b,u=0;for(let e=0;e<l.length;e++){const{heights:t,lineCounts:a}=l[e],o=a.length,r=Vt(t,0)+n*(o-1),i=Math.min(...t)<s?1.5:1,d=(()=>{for(let e=1;e!==o;++e)if(a[e-1]>a[e])return 1.5;return 1})(),m=Math.abs(r-c)*i*d;(!b||m<u)&&(b=l[e],u=m)}const m=b.lineCounts,h=b.heights,O=m.length;let j=0,g=0;for(let e=0;e!==O;++e){const t=m[e],s=h[e],c=Math.round(s);let r=0;for(let l=0;l!==t;++l){const d=Gt|(0===e?_t:Gt)|(e===O-1?Kt:Gt)|(0===l?$t:Gt)|(l===t-1?zt:Gt),b=o[j],u=l===t-1?a-r:Math.round(b*s);i[j]={dimensions:{x:r,y:g,width:u,height:c},sides:d},r+=u+n,++j}g+=c+n}return i}(b):2===r?function(e){const{ratios:t,proportions:a,averageRatio:s}=e;return"ww"===a&&s>1.4&&t[1]-t[0]<.2?function(e){const{ratios:t,maxWidth:a,spacing:s,maxHeight:n}=e,c=Math.round(Math.min(a/t[0],Math.min(a/t[1],(n-s)/2)));return[{dimensions:{x:0,y:0,width:a,height:c},sides:$t|_t|zt},{dimensions:{x:0,y:c+s,width:a,height:c},sides:$t|Kt|zt}]}(e):"ww"===a||"qq"===a?function(e){const{ratios:t,maxWidth:a,spacing:s,maxHeight:n}=e,c=(a-s)/2,o=Math.round(Math.min(c/t[0],Math.min(c/t[1],n)));return[{dimensions:{x:0,y:0,width:c,height:o},sides:_t|$t|Kt},{dimensions:{x:c+s,y:0,width:c,height:o},sides:_t|zt|Kt}]}(e):function(e){const{ratios:t,minWidth:a,maxWidth:s,spacing:n,maxHeight:c}=e,o=Math.round(1.5*a),r=Math.min(Math.round(Math.max(.4*(s-n),(s-n)/t[0]/(1/t[0]+1/t[1]))),s-n-o),i=s-r-n,l=Math.min(c,Math.round(Math.min(i/t[0],r/t[1])));return[{dimensions:{x:0,y:0,width:i,height:l},sides:_t|$t|Kt},{dimensions:{x:i+n,y:0,width:r,height:l},sides:_t|zt|Kt}]}(e)}(b):3===r?function(e){const{proportions:t}=e;return"n"===t[0]?function(e){const{maxHeight:t,spacing:a,ratios:s,maxWidth:n,minWidth:c}=e,o=t,r=Math.round(Math.min((t-a)/2,s[1]*(n-a)/(s[2]+s[1]))),i=o-r-a,l=Math.max(c,Math.round(Math.min((n-a)/2,Math.min(r*s[2],i*s[1])))),d=Math.min(Math.round(o*s[0]),n-a-l);return[{dimensions:{x:0,y:0,width:d,height:o},sides:_t|$t|Kt},{dimensions:{x:d+a,y:0,width:l,height:i},sides:_t|zt},{dimensions:{x:d+a,y:i+a,width:l,height:r},sides:Kt|zt}]}(e):function(e){const{maxWidth:t,ratios:a,maxHeight:s,spacing:n}=e,c=t,o=Math.round(Math.min(c/a[0],.66*(s-n))),r=(t-n)/2,i=Math.min(s-o-n,Math.round(Math.min(r/a[1],r/a[2])));return[{dimensions:{x:0,y:0,width:c,height:o},sides:$t|_t|zt},{dimensions:{x:0,y:o+n,width:r,height:i},sides:Kt|$t},{dimensions:{x:r+n,y:o+n,width:c-r-n,height:i},sides:Kt|zt}]}(e)}(b):function(e){const{proportions:t}=e;return"w"===t[0]?function({maxWidth:e,ratios:t,spacing:a,maxHeight:s,minWidth:n}){const c=e,o=Math.round(Math.min(c/t[0],.66*(s-a))),r=Math.round((e-2*a)/(t[1]+t[2]+t[3])),i=Math.max(n,Math.round(Math.min(.4*(e-2*a),r*t[1]))),l=Math.round(Math.max(Math.max(n,.33*(e-2*a)),r*t[3])),d=c-i-l-2*a,b=Math.min(s-o-a,r);return[{dimensions:{x:0,y:0,width:c,height:o},sides:$t|_t|zt},{dimensions:{x:0,y:o+a,width:i,height:b},sides:Kt|$t},{dimensions:{x:i+a,y:o+a,width:d,height:b},sides:Kt},{dimensions:{x:i+a+d+a,y:o+a,width:l,height:b},sides:zt|Kt}]}(e):function({maxHeight:e,ratios:t,maxWidth:a,spacing:s,minWidth:n}){const c=e,o=Math.round(Math.min(c*t[0],.6*(a-s))),r=Math.round((e-2*s)/(1/t[1]+1/t[2]+1/t[3])),i=Math.round(r/t[1]),l=Math.round(r/t[2]),d=c-i-l-2*s,b=Math.max(n,Math.min(a-o-s,r));return[{dimensions:{x:0,y:0,width:o,height:c},sides:_t|$t|Kt},{dimensions:{x:o+s,y:0,width:b,height:i},sides:_t|zt},{dimensions:{x:o+s,y:i+s,width:b,height:l},sides:zt},{dimensions:{x:o+s,y:i+l+2*s,width:b,height:d},sides:Kt|zt}]}(e)}(b),{layout:d,containerStyle:Qt(d)}}let Jt;function Xt(e){return Jt||(Jt=document.createElement("span"),Jt.style.font=m.e?'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',Jt.style.whiteSpace="nowrap",Jt.style.position="absolute",Jt.style.left="-999px",Jt.style.opacity=".01",document.body.appendChild(Jt)),Jt.innerHTML=e,Jt.offsetWidth}function Zt(e,t,a,s,n){Object(c.o)(()=>{if(a&&e.current){const t=e.current.closest(".MessageList");Object(Rt.a)(t,e.current,n?"end":"centerOrTop",20,void 0!==s?1e3:void 0,s)}},[e,t,a,s,n])}var ea=a(115),ta=a(69);var aa=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Re.a)(Ae.a.Extra,"ContextMenuContainer",!t);return a?c.a.createElement(a,e):void 0});var sa=Object(c.h)(Object(s.h)((e,{message:t})=>{const{byId:a}=e.users,s=t.senderId,{targetUserIds:n,targetChatId:c}=t.content.action||{},o=t.replyToMessageId,i=o?Object(r.l)(e,t.chatId,o):void 0,d=Object(r.U)(e,t),{direction:b,noHighlight:u}=d&&e.focusedMessage||{},m=Object(r.g)(e,t.chatId);return{usersById:a,sender:m&&(Object(l.mb)(m)||s===t.chatId)?m:s?Object(r.Kb)(e,s):void 0,targetChatId:c,targetUserIds:n,targetMessage:i,isFocused:d,...d&&{focusDirection:b,noFocusHighlight:u}}})(({message:e,observeIntersection:t,isEmbedded:a,appearanceOrder:s=0,isLastInList:n,usersById:o,sender:r,targetUserIds:i,targetMessage:l,targetChatId:d,isFocused:b,focusDirection:u,noFocusHighlight:m})=>{const h=Object(c.q)(null);Object(xt.c)(h,t),Object(ct.a)(e.chatId,e.replyToMessageId,l),Zt(h,e.chatId,b,u,m);const O=Object(Oe.a)(),j=s<=0,[g,p]=Object(he.a)(j);Object(c.n)(()=>{j||setTimeout(p,10*s)},[s,p,j]);const{transitionClassNames:f}=Object(oe.a)(g,void 0,j,!1),I=Object(c.p)(()=>i?i.map(e=>o&&o[e]).filter(Boolean):void 0,[i,o]),v=Object(ta.a)(O,e,r,I,l,d,a?{isEmbedded:!0,asPlain:!0}:void 0),{isContextMenuOpen:y,contextMenuPosition:C,handleBeforeContextMenu:E,handleContextMenu:w,handleContextMenuClose:S,handleContextMenuHide:M}=Object(Dt.a)(h),k=void 0!==C;if(a)return c.a.createElement("span",{className:"embedded-action-message"},Object(mt.a)(v));const N=Object(ne.a)("ActionMessage message-list-item",b&&!m&&"focused",k&&"has-menu-open",n&&"last-in-list",f);return c.a.createElement("div",{ref:h,id:"message"+e.id,className:N,"data-message-id":e.id,onMouseDown:e=>{Tt(e),E(e)},onContextMenu:w},c.a.createElement("span",null,v),C&&c.a.createElement(aa,{isOpen:y,anchor:C,message:e,messageListType:"thread",onClose:S,onCloseAnimationEnd:M}))}));a(230);var na=({className:e,message:t,sender:a,title:s,customText:n,observeIntersection:o,onClick:r})=>{const i=Object(c.q)(null),d=Object(xt.b)(i,o),b=Object(ht.a)(t&&Object(l.E)(t,"pictogram"),!d),u=t&&"sticker-reply-thumb"+t.id,m=jt(t),h=Boolean(t&&Object(l.J)(t)),O=Object(Oe.a)(),j=a&&Object(l.X)(O,a);return c.a.createElement("div",{ref:i,className:Object(ne.a)("EmbeddedMessage",e),onClick:t?r:void 0},m&&function(e,t,a,s){const{width:n,height:o}=Object(ut.m)();return c.a.createElement("img",{id:e,src:a||t,width:n,height:o,alt:"",className:s?"round":""})}(u,m,b,h),c.a.createElement("div",{className:"message-text"},c.a.createElement("p",{dir:"auto"},t?Object(l.gb)(t)?c.a.createElement(sa,{message:t,isEmbedded:!0}):Object(mt.a)(Object(l.O)(O,t,Boolean(m))):n||" "),c.a.createElement("div",{className:"message-title",dir:"auto"},Object(mt.a)(j||s||" "))))},ca=a(169),oa=a(177),ra=a(183);a(234);var ia=Object(c.h)(({message:e,outgoingStatus:t,signature:a,onClick:s})=>{const n=Object(Oe.a)();return c.a.createElement("span",{className:"MessageMeta",dir:n.isRtl?"rtl":"ltr",onClick:s},Boolean(e.views)&&c.a.createElement(c.a.Fragment,null,c.a.createElement("span",{className:"message-views"},Object(rt.b)(e.views)),c.a.createElement("i",{className:"icon-channelviews"})),a&&c.a.createElement("span",{className:"message-signature"},Object(mt.a)(a)),c.a.createElement("span",{className:"message-time"},e.isEdited&&n("EditedMessage")+" ",Object(x.h)(1e3*e.date)),t&&c.a.createElement(ra.a,{status:t}))}),la=a(118),da=a(120),ba=a(153);a(235);var ua=({message:e,observeIntersection:t,observeIntersectionForPlaying:a,shouldLoop:s,lastSyncTime:o})=>{const r=Object(c.q)(null),[i,d,b]=Object(he.a)(),u=e.content.sticker,{isAnimated:m,stickerSetId:h}=u,O=h===n.db,j=Object(xt.b)(r,t),g=Object(xt.b)(r,a),p=u.isPreloadedGlobally?"sticker"+u.id:Object(l.E)(e,"inline"),f=jt(e),I=Object(ht.a)(p,!j,Object(l.D)(e,"inline",!0),o),v=Boolean(I),[y,C]=Object(he.a)(v),E=m?y:v,{shouldRenderFullMedia:w,transitionClassNames:S}=Object(la.a)(E,"slow"),{width:M,height:k}=Object(ut.n)(u),N=Object(ne.a)("thumbnail",!f&&"empty"),T=Object(ne.a)("Sticker media-inner",O&&"inactive");return c.a.createElement("div",{ref:r,className:T,onClick:O?void 0:d},!E&&c.a.createElement("img",{id:"sticker-thumb-"+e.id,src:f,width:M,height:k,alt:"",className:N}),!m&&w&&c.a.createElement("img",{id:"sticker-"+e.id,src:I,width:M,height:k,alt:"",className:Object(ne.a)("full-media",S)}),m&&v&&c.a.createElement(da.a,{key:p,className:Object(ne.a)("full-media",S),id:p,animationData:I,size:M,play:g,noLoop:!s,onLoad:C}),c.a.createElement(ba.a,{isOpen:i,fromSticker:u,onClose:b}))},ma=a(130),ha=a(124),Oa=a(170);function ja(e,t){return Object(Oa.a)(Object(l.F)(e),Boolean(t),m.l&&!m.c)}var ga=a(30);const pa=Promise.resolve("rgba(255,255,255,1)");function fa(e,t,a,s){return s?pa:async function(e,t){const a=new Image;a.src=e,a.width||await new Promise(e=>{a.onload=e});const s=document.createElement("canvas"),n=s.getContext("2d");s.width=a.width,s.height=a.height,n.drawImage(a,0,0,a.width,a.height);const c=t?a.width-1:0,o=a.height-1;return`rgba(${Array.from(n.getImageData(c,o,1,1).data).join(",")})`}(e,t)}var Ia=a(125);var va=({id:e,message:t,observeIntersection:a,noAvatars:s,shouldAutoLoad:n,isInSelectMode:o,isSelected:r,uploadProgress:i,size:d="inline",dimensions:b,nonInteractive:u,shouldAffectAppendix:m,onClick:h,onCancelUpload:O})=>{const j=Object(c.q)(null),g=(Object(l.H)(t)||Object(l.S)(t)).blobUrl,p=Object(xt.b)(j,a),[f,I]=Object(c.r)(n),v=f&&p,{mediaData:y,downloadProgress:C}=Object(ha.a)(Object(l.E)(t,d),!v),E=g||y,w=ja(t,E),{isUploading:S,isTransferring:M,transferProgress:k}=Object(l.r)(t,i||C,v&&!E),N=!1===Object(ga.a)(f),{shouldRender:T,transitionClassNames:P}=Object(oe.a)(M,void 0,N,"slow"),{shouldRenderThumb:A,shouldRenderFullMedia:R,transitionClassNames:x}=Object(la.a)(E,"slow"),L=Object(c.m)(()=>{S?O&&O(t):E?h&&h(t.id):I(e=>!e)},[E,S,t,O,h]),B=Object(l.yb)(t);Object(c.o)(()=>{if(!m)return;const e=j.current.closest(".message-content");E?fa(E,B,0,r).then(t=>{e.style.setProperty("--appendix-bg",t),e.setAttribute("data-has-custom-appendix","")}):e.classList.add("has-appendix-thumb")},[E,B,m,o,r]);const{width:D,height:F,isSmall:U}=b||qt(t,s),H=Object(ne.a)("media-inner",!S&&!u&&"interactive",U&&"small-image",D===F&&"square-image"),q=b?`width: ${D}px; height: ${F}px; left: ${b.x}px; top: ${b.y}px;`:"";return c.a.createElement("div",{id:e,ref:j,className:H,style:q,onClick:S?void 0:L},A&&c.a.createElement("canvas",{ref:w,className:"thumbnail",style:`width: ${D}px; height: ${F}px`}),R&&c.a.createElement("img",{src:E,className:"full-media "+x,width:D,height:F,alt:""}),T&&c.a.createElement("div",{className:"media-loading "+P},c.a.createElement(Ia.a,{progress:k,onClick:S?L:void 0})),!E&&!f&&c.a.createElement("i",{className:"icon-download"}),M&&c.a.createElement("span",{className:"message-upload-progress"},Math.round(100*k),"%"))},ya=a(142),Ca=a(141);function Ea(e,t){const a=Object(c.q)();a.current=t;const s=Object(c.m)(()=>{e.current&&e.current.pause()},[e]),n=Object(c.m)(()=>{e.current&&a.current&&Object(Ca.a)(e.current)},[e]);Object(se.c)(s,n)}var wa=a(154),Sa=(e,t=!1)=>{const a=Object(c.q)(!1),s=Object(c.q)(!1),n=Object(c.m)(()=>{s.current=!0,t&&e.current&&(a.current||(a.current=!e.current.paused),e.current.pause())},[t,e]),o=Object(c.m)(()=>{t&&e.current&&a.current&&document.body.contains(e.current)&&Object(Ca.a)(e.current),a.current=!1,s.current=!1},[t,e]),r=Object(c.m)(()=>{Object(f.b)(o)},[o]);document.hasFocus()||n(),Object(re.a)(n,r)};function Ma(){return(Ma=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var s in a)Object.prototype.hasOwnProperty.call(a,s)&&(e[s]=a[s])}return e}).apply(this,arguments)}var ka=({id:e,message:t,observeIntersection:a,noAvatars:s,shouldAutoLoad:n,shouldAutoPlay:o,uploadProgress:r,lastSyncTime:i,dimensions:d,onClick:b,onCancelUpload:u})=>{const m=Object(c.q)(null),h=Object(c.q)(null),O=Object(l.Q)(t)||Object(l.T)(t),j=O.blobUrl,g=Object(xt.b)(m,a),[p,f]=Object(c.r)(n),I=Boolean(p&&g&&i),[v,y]=Object(c.r)(o),C=Object(ht.a)(Object(l.E)(t,"pictogram"),!(g&&i),Object(l.D)(t,"pictogram"),i),{mediaData:E,downloadProgress:w}=Object(ha.a)(Object(l.E)(t,"inline"),!I,Object(l.D)(t,"inline"),i),S=j||E,M=Boolean(g&&S),k=ja(t,C),{isBuffered:N,bufferingHandlers:T}=Object(ya.a)(!n),{isUploading:P,isTransferring:A,transferProgress:R}=Object(l.r)(t,r||w,I&&!N),L=!1===Object(ga.a)(p),{shouldRender:B,transitionClassNames:D}=Object(oe.a)(A,void 0,L),{transitionClassNames:F}=Object(la.a)(S,"slow"),[U,H]=Object(c.r)(0),q=Object(c.m)(e=>{H(Math.max(0,e.currentTarget.currentTime-1))},[]),G=h.current&&h.current.duration||O.duration||0,_=Object(l.yb)(t),z=Object(l.tb)(t),{width:K,height:$}=d||Object(ut.i)(O,_,z,s);Ea(h,Boolean(M&&o)),Sa(h,v),Object(wa.a)(h,[M]);const V=Object(c.m)(()=>{P?u&&u(t):S?S&&!v?(y(!0),h.current.play()):b&&b(t.id):f(e=>!e)},[P,S,v,b,u,t]),W=Object(ne.a)("media-inner dark",!P&&"interactive"),Q=Object(ne.a)("full-media",F),Y=d?`width: ${K}px; height: ${$}px; left: ${d.x}px; top: ${d.y}px;`:"";return c.a.createElement("div",{ref:m,id:e,className:W,style:Y,onClick:P?void 0:V},!C&&c.a.createElement("canvas",{ref:k,className:"thumbnail",style:`width: ${K}px; height: ${$}px;`}),C&&c.a.createElement("img",{src:C,className:"thumbnail",style:`width: ${K}px; height: ${$}px;`,alt:""}),M&&c.a.createElement("video",Ma({ref:h,className:Q,width:K,height:$,autoPlay:v,muted:!0,loop:!0,playsInline:!0},T,{onTimeUpdate:q}),c.a.createElement("source",{src:S})),p&&!v&&!B&&c.a.createElement("i",{className:"icon-large-play"}),B&&c.a.createElement("div",{className:"media-loading "+D},c.a.createElement(Ia.a,{progress:R,onClick:P?V:void 0})),!p&&c.a.createElement("i",{className:"icon-download"}),A?c.a.createElement("span",{className:"message-upload-progress"},"..."):c.a.createElement("div",{className:"message-media-duration"},O.isGif?"GIF":Object(x.e)(Math.max(G-U,0))))},Na=a(24);a(236);var Ta=Object(s.h)((e,{contact:t})=>({user:Object(r.Kb)(e,t.userId)}),(e,t)=>Object(h.l)(t,["openUserInfo"]))(({contact:e,user:t,openUserInfo:a})=>{const{firstName:s,lastName:n,phoneNumber:o,userId:r}=e,i=Object(c.m)(()=>{a({id:r})},[a,r]);return c.a.createElement("div",{className:Object(ne.a)("Contact",Boolean(r)&&"interactive"),onClick:r?i:void 0},c.a.createElement(ea.a,{size:"large",user:t,text:s||n}),c.a.createElement("div",{className:"contact-info"},c.a.createElement("div",{className:"contact-name"},s," ",n),c.a.createElement("div",{className:"contact-phone"},Object(Na.c)(o))))}),Pa=a(50);var Aa=Object(c.h)(({id:e,options:t,selected:a=[],disabled:s,round:n,loadingOptions:o,onChange:r})=>{const[i,l]=Object(c.r)([]),d=Object(c.m)(e=>{const{value:t,checked:a}=e.currentTarget;let s;s=a?[...i,t]:i.filter(e=>e!==t),l(s),r(s)},[r,i]);return c.a.createElement("div",{id:e,className:"radio-group"},t.map(e=>c.a.createElement(Pa.a,{label:e.label,subLabel:e.subLabel,value:e.value,checked:-1!==a.indexOf(e.value),disabled:s,round:n,isLoading:o?-1!==o.indexOf(e.value):void 0,onChange:d})))}),Ra=a(127),xa=a(191);a(239);function La(e,t){return t>0?(e/t*100).toFixed():0}var Ba=({answer:e,voteResults:t,totalVoters:a,maxVotersCount:s,correctResults:n,shouldAnimate:o})=>{const r=t&&t.find(t=>t.option===e.option),i=0===n.length||-1!==n.indexOf(e.option),l=n.length>0&&i||r&&r.isChosen,d=r?La(r.votersCount,a||0):0,[b,u]=Object(c.r)(o?0:d),m=Object(c.q)(null),h=r?La(r.votersCount,s||0):0,O=b<d;if(Object(c.n)(()=>{o&&u(d)},[o,d]),Object(c.n)(()=>{const e=m.current;if(e&&o){const t=e.firstElementChild,a=O?"":"stroke-dasharray: 100% 200%; stroke-dashoffset: -44";t?t.setAttribute("style",a):e.innerHTML=`\n <svg class="poll-line" xmlns="http://www.w3.org/2000/svg" style="${a}">\n <path d="M4.47 5.33v13.6a9 9 0 009 9h13"/>\n </svg>`}},[O,o]),!t||!r)return;const j=`width: ${h}%; transform:scaleX(${O?0:1})`;return c.a.createElement("div",{className:"PollOption",dir:"ltr"},c.a.createElement("div",{className:"poll-option-share "+("100"===d?"limit-width":"")},d,"%",l&&c.a.createElement("span",{className:Object(ne.a)("poll-option-chosen",!i&&"wrong",o&&"animate")},c.a.createElement("i",{className:i?"icon-check":"icon-close"}))),c.a.createElement("div",{className:"poll-option-right"},c.a.createElement("div",{className:"poll-option-text",dir:"auto"},Object(mt.a)(e.text)),c.a.createElement("div",{className:Object(ne.a)("poll-option-answer",l&&!i&&"wrong")},c.a.createElement("div",{className:"poll-option-corner",ref:m}),c.a.createElement("div",{className:"poll-option-line",style:j}))))};a(240);var Da=Object(c.h)(Object(s.h)((e,{poll:t})=>{const{recentVoterIds:a}=t.results,{serverTimeOffset:s,users:{byId:n}}=e;return a&&0!==a.length?{recentVoterIds:a,usersById:n,serverTimeOffset:s}:{}},(e,t)=>Object(h.l)(t,["loadMessage","openPollResults"]))(({message:e,poll:t,recentVoterIds:a,usersById:s,loadMessage:n,onSendVote:o,openPollResults:r,serverTimeOffset:i})=>{const{id:l,chatId:d}=e,{summary:b,results:u}=t,[m,h]=Object(c.r)(!1),[O,j]=Object(c.r)([]),[g,p]=Object(c.r)(!1),[f,I]=Object(c.r)(!1),[v,y]=Object(c.r)(!b.closed&&b.closeDate&&b.closeDate>0?Math.min(b.closeDate-Math.floor(Date.now()/1e3)+i,b.closePeriod):0),C=Object(c.q)(null),{results:E,totalVoters:w}=u,S=E&&E.some(e=>e.isChosen),M=!b.closed&&!S,k=!M&&b.isPublic&&Number(u.totalVoters)>0,N=M&&b.multipleChoice,T=E?Math.max(...E.map(e=>e.votersCount)):w,P=E?E.reduce((e,t)=>(t.isCorrect&&e.push(t.option),e),[]):[],A=b.answers.map(e=>({label:e.text,value:e.option,hidden:Boolean(b.quiz&&b.closePeriod&&v<=0)}));Object(c.n)(()=>{m&&t.results.results&&t.results.results.some(e=>e.isChosen)&&h(!1)},[m,t.results.results]),Object(c.n)(()=>{v>0&&setTimeout(()=>y(v-1),1e3);const e=C.current;if(e){const t=12*Math.PI,a=e.lastElementChild,s=e.firstElementChild;if(v<=5&&e.classList.add("hurry-up"),a&&s){const e=(b.closePeriod-v)/b.closePeriod*t;s.textContent=Object(x.e)(v),a.firstElementChild.setAttribute("stroke-dashoffset","-"+e)}else e.innerHTML=`\n <span>${Object(x.e)(v)}</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>`}},[v,b.closePeriod]),Object(c.n)(()=>{b.quiz&&(v<=0||S&&!b.closed)&&n({chatId:d,messageId:l})},[d,v,S,n,l,b.closed,b.quiz]),Object(c.n)(()=>{let e;return b.quiz&&!b.closed&&b.closePeriod&&b.closePeriod>0&&(e=window.setTimeout(()=>{n({chatId:d,messageId:l})},1e3*b.closePeriod)),()=>{e&&window.clearTimeout(e)}},[M,d,n,l,b.closePeriod,b.closed,b.quiz]);const R=Object(c.p)(()=>a?a.reduce((e,t)=>{const a=s[t];return a&&e.push(a),e},[]):[],[s,a]),L=Object(c.m)(e=>{j([e]),h(!0),I(!0),o([e])},[o]),B=Object(c.m)(e=>{j(e)},[]),D=Object(c.m)(()=>{h(!0),I(!0),o(O)},[o,O]),F=Object(c.m)(()=>{r({chatId:d,messageId:l})},[d,l,r]),U=Object(c.m)(()=>{p(!0)},[]),H=Object(c.m)(()=>{p(!1),I(!1)},[]);Object(c.n)(()=>{if(f&&S&&b.quiz&&u.results&&t.results.solution){u.results.find(e=>e.isChosen&&e.isCorrect)||p(!0)}},[S,f,u.results,b.quiz,t.results.solution]);const q=Object(Oe.a)();return c.a.createElement("div",{className:"Poll",dir:q.isRtl?"auto":"ltr"},g&&t.results.solution&&c.a.createElement(xa.a,{message:Object(Ft.b)(t.results.solution,t.results.solutionEntities),duration:5e3,onDismiss:H,containerId:"#middle-column-portals"}),c.a.createElement("div",{className:"poll-question"},Object(mt.a)(b.question)),c.a.createElement("div",{className:"poll-type"},q(function(e){if(void 0===e.isPublic)return" ";if(e.quiz)return e.isPublic?"QuizPoll":"AnonymousQuizPoll";if(e.closed)return"FinalResults";return e.isPublic?"PublicPoll":"AnonymousPoll"}(b)),R.length>0&&c.a.createElement("div",{className:"poll-recent-voters"},R.map(e=>c.a.createElement(ea.a,{size:"micro",user:e}))),v>0&&M&&c.a.createElement("div",{ref:C,className:"poll-countdown"}),b.quiz&&t.results.solution&&!M&&c.a.createElement(fe.a,{round:!0,size:"tiny",color:"translucent",className:"poll-quiz-help",disabled:g,onClick:U,ariaLabel:"Show Solution"},c.a.createElement("i",{className:"icon-lamp"}))),M&&c.a.createElement("div",{className:"poll-answers"},N?c.a.createElement(Aa,{options:A,onChange:B,disabled:e.isScheduled||m,loadingOptions:m?O:void 0,round:!0}):c.a.createElement(Ra.a,{name:"poll-"+l,options:A,onChange:L,disabled:e.isScheduled||m,loadingOption:m?O[0]:void 0})),!M&&c.a.createElement("div",{className:"poll-results"},b.answers.map((function(e){return c.a.createElement(Ba,{key:e.option,shouldAnimate:f,answer:e,voteResults:E,totalVoters:w,maxVotersCount:T,correctResults:P})}))),!k&&!N&&c.a.createElement("div",{className:"poll-voters-count"},function(e,t,a){if(!a)return e(t?"Chat.Quiz.TotalVotesEmpty":"Chat.Poll.TotalVotesResultEmpty");return e(t?"Answer":"Vote",a,"i")}(q,b.quiz,u.totalVoters)),N&&c.a.createElement(fe.a,{isText:!0,disabled:0===O.length,size:"tiny",onClick:D},q("PollSubmitVotes")),k&&c.a.createElement(fe.a,{isText:!0,size:"tiny",onClick:F},q("PollViewResults")))})),Fa=a(43),Ua=a(60);a(241);var Ha=Object(c.h)(({message:e,observeIntersection:t,noAvatars:a,shouldAutoLoad:s,shouldAutoPlay:n,inPreview:o,lastSyncTime:r,onMediaClick:i,onCancelMediaTransfer:d})=>{const b=Object(l.R)(e);let u=!1;if(b&&b.photo&&!b.video){const{width:t,height:a}=qt(e);u=t===a}const m=Object(c.m)(()=>{i()},[i]);if(!b)return;const{siteName:h,url:O,displayUrl:j,title:g,description:p,photo:f,video:I}=b,v=(f||I)&&i&&!u,y=Object(Fa.a)(p,170),C=Object(ne.a)("WebPage",u&&"with-square-photo",!f&&!I&&!o&&"without-media",I&&"with-video");return c.a.createElement("div",{className:C,"data-initial":(h||j)[0],dir:"auto"},f&&!I&&c.a.createElement(va,{message:e,observeIntersection:t,noAvatars:a,shouldAutoLoad:s,size:u?"pictogram":"inline",nonInteractive:!v,onClick:v?m:void 0,onCancelUpload:d}),c.a.createElement("div",{className:"WebPage-text"},c.a.createElement(Ua.a,{className:"site-name",url:O,text:h||j}),!o&&g&&c.a.createElement("p",{className:"site-title"},Object(mt.a)(g)),y&&c.a.createElement("p",{className:"site-description"},Object(mt.a)(y,["emoji","br"]))),!o&&I&&c.a.createElement(ka,{message:e,observeIntersection:t,noAvatars:a,shouldAutoLoad:s,shouldAutoPlay:n,lastSyncTime:r,onClick:v?m:void 0,onCancelUpload:d}))});a(242);var qa=Object(c.h)(({message:e})=>{const t=Object(l.B)(e),{title:a,text:s,description:n,photoUrl:o}=t;return c.a.createElement("div",{className:"Invoice"},a&&c.a.createElement("p",{className:"title"},Object(mt.a)(a)),s&&c.a.createElement("p",null,Object(mt.a)(s,["emoji","br"])),c.a.createElement("div",{className:"description "+(o?"has-image":"")},o&&c.a.createElement("img",{className:"invoice-image",src:o,alt:""}),n&&c.a.createElement("p",{className:"description-text"},Object(mt.a)(n,["emoji","br"]))))});function Ga(e){return Object(c.h)(Object(s.h)((e,t)=>{const{message:a}=t;return{isInSelectMode:Object(r.S)(e),isSelected:Object(r.V)(e,a.id)}},(e,t)=>Object(h.l)(t,["toggleMessageSelection"]))(t=>{const{isInSelectMode:a,isSelected:s,message:n,toggleMessageSelection:o,dimensions:r}=t,i=Object(c.m)(e=>{e.stopPropagation(),o({messageId:n.id,withShift:e&&e.shiftKey})},[o,n]),l=Object(c.p)(()=>({...t,isInSelectMode:a,isSelected:s,dimensions:{...t.dimensions,x:0,y:0},onClick:a?void 0:t.onClick}),[t,a,s]);return c.a.createElement("div",{className:Object(ne.a)("album-item-select-wrapper",s&&"is-selected"),style:r?`left: ${r.x}px; top: ${r.y}px;`:"",onClick:a?i:void 0},a&&c.a.createElement("div",{className:"message-select-control"},s&&c.a.createElement("i",{className:"icon-select"})),c.a.createElement(e,l))}))}a(243);const _a=Ga(va),za=Ga(ka);var Ka=Object(s.h)(e=>({uploadsById:e.fileUploads.byMessageLocalId}),(e,t)=>Object(h.l)(t,["cancelSendingMessage"]))(({album:e,observeIntersection:t,shouldAutoLoad:a,shouldAutoPlay:s,hasCustomAppendix:n,lastSyncTime:o,isOwn:r,albumLayout:i,onMediaClick:d,uploadsById:b,cancelSendingMessage:u})=>{const m=e.messages.length,h=Object(c.m)(e=>{u({chatId:e.chatId,messageId:e.id})},[u]);const{width:O,height:j}=i.containerStyle;return c.a.createElement("div",{className:"Album",style:`width: ${O}px; height: ${j}px;`},e.messages.map((function(e,u){const{photo:O,video:j}=Object(l.v)(e),g=b[e.previousLocalId||e.id],p=g?g.progress:void 0,{dimensions:f,sides:I}=i.layout[u];if(O){const s=n&&(r?u===m-1:Boolean(I&$t&&I&Kt));return c.a.createElement(_a,{id:"album-media-"+e.id,message:e,observeIntersection:t,shouldAutoLoad:a,shouldAffectAppendix:s,uploadProgress:p,dimensions:f,onClick:d,onCancelUpload:h})}if(j)return c.a.createElement(za,{id:"album-media-"+e.id,message:e,observeIntersection:t,shouldAutoLoad:a,shouldAutoPlay:s,uploadProgress:p,lastSyncTime:o,dimensions:f,onClick:d,onCancelUpload:h})})))});a(244);function $a(){return($a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var s in a)Object.prototype.hasOwnProperty.call(a,s)&&(e[s]=a[s])}return e}).apply(this,arguments)}let Va;var Wa=({message:e,observeIntersection:t,shouldAutoLoad:a,shouldAutoPlay:s,lastSyncTime:n})=>{const o=Object(c.q)(null),r=Object(c.q)(null),i=Object(c.q)(null),d=e.content.video,b=Object(xt.b)(o,t),[u,m]=Object(c.r)(a&&s),h=Boolean(u&&b&&n),{mediaData:O,downloadProgress:j}=Object(ha.a)(Object(l.E)(e,"inline"),!h,Object(l.D)(e,"inline"),n),g=ja(e,O),{isBuffered:p,bufferingHandlers:I}=Object(ya.a)(),v=u&&!p,y=!1===Object(ga.a)(u),{shouldRender:C,transitionClassNames:E}=Object(oe.a)(v||!p,void 0,y),{shouldRenderThumb:w,transitionClassNames:S}=Object(la.a)(O,"slow"),[M,k]=Object(c.r)(!1),[N,T]=Object(c.r)(0);Object(c.n)(()=>{if(!M)return;const e=188*Math.PI,t=e-N*e,a=i.current,s=r.current,n=s.firstElementChild;n?n.firstElementChild.setAttribute("stroke-dashoffset",t.toString()):s.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(a.currentTime/a.duration)},[M,N]);const P=Boolean(O&&b),A=()=>{k(!1),T(0),Object(Ca.a)(i.current),Object(f.b)(()=>{r.current.innerHTML=""})},R=(L=A,()=>{Va&&Va(),Va=L});var L;Object(c.n)(()=>{i.current&&(P?Object(Ca.a)(i.current):i.current.pause())},[P]),Ea(i,P),Sa(i,Boolean(O)),Object(wa.a)(i,[O]);const B=Object(c.m)(()=>{if(!O)return void m(e=>!e);const e=i.current;M?e.paused?Object(Ca.a)(e):e.pause():(R(),e.pause(),e.currentTime=0,Object(Ca.a)(e),k(!0))},[R,M,O]),D=Object(c.m)(e=>{const t=e.currentTarget;T(t.currentTime/t.duration)},[]),F=Object(ne.a)("full-media",S);return c.a.createElement("div",{ref:o,className:"RoundVideo media-inner",onClick:B},(w||O)&&c.a.createElement("div",{className:"thumbnail-wrapper"},c.a.createElement("canvas",{ref:g,className:"thumbnail",style:`width: ${ut.e}px; height: ${ut.e}px`})),O&&c.a.createElement("div",{className:"video-wrapper"},c.a.createElement("video",$a({ref:i,className:F,width:ut.e,height:ut.e,autoPlay:!0,muted:!M,loop:!M,playsInline:!0,onEnded:M?A:void 0},I,{onTimeUpdate:M?D:void 0}),c.a.createElement("source",{src:O}))),c.a.createElement("div",{className:"progress",ref:r}),C&&c.a.createElement("div",{className:"media-loading "+E},c.a.createElement(Ia.a,{progress:j})),!O&&!u&&c.a.createElement("i",{className:"icon-large-play"}),c.a.createElement("div",{className:"message-media-duration"},M?Object(x.e)(i.current.currentTime):Object(x.e)(d.duration),(!M||i.current.paused)&&c.a.createElement("i",{className:"icon-muted-chat"})))};a(245);var Qa=({message:e,onClick:t})=>c.a.createElement("div",{className:"InlineButtons"},e.inlineButtons.map(e=>c.a.createElement("div",{className:"row"},e.map(e=>c.a.createElement(fe.a,{size:"tiny",ripple:!0,disabled:"NOT_SUPPORTED"===e.type,onClick:()=>t({button:e})},Object(mt.a)(e.text),"url"===e.type&&!e.value.match(n.ub)&&c.a.createElement("i",{className:"icon-arrow-right"}))))));a(246);var Ya=Object(c.h)(Object(s.h)((e,{message:t})=>{const{threadId:a,chatId:s}=t.threadInfo,n=Object(r.Gb)(e,s,a)||t.threadInfo,c=Object(r.Hb)(e,s,a),{byId:o}=e.users,{byId:i}=e.chats;return{threadInfo:n,usersById:o,chatsById:i,shouldRequestThreadUpdate:!!c&&!n.topMessageId}},(e,t)=>Object(h.l)(t,["openChat","requestThreadInfoUpdate"]))(({disabled:e,threadInfo:t,usersById:a,chatsById:s,shouldRequestThreadUpdate:n,openChat:o,requestThreadInfoUpdate:r})=>{const i=Object(Oe.a)(),{threadId:d,chatId:b,messagesCount:u,lastMessageId:m,lastReadInboxMessageId:h,recentReplierIds:O}=t,j=Object(c.m)(()=>{o({id:b,threadId:d})},[o,b,d]);if(Object(c.n)(()=>{n&&r({chatId:b,threadId:d})},[b,r,n,d]),void 0===u)return;const g=O&&O.map(e=>Object(l.ob)(e)?a[e]:s[e]).filter(Boolean);const p=Boolean(h&&m&&h<m);return c.a.createElement("div",{"data-cnt":Object(rt.b)(u),className:Object(ne.a)("CommentButton",p&&"has-unread",e&&"disabled"),dir:i.isRtl?"rtl":"ltr",onClick:j},c.a.createElement("i",{className:"icon-comments-sticker"}),(!g||0===g.length)&&c.a.createElement("i",{className:"icon-comments"}),g&&g.length>0&&c.a.createElement("div",{className:"recent-repliers",dir:i.isRtl?"rtl":"ltr"},g.map(e=>c.a.createElement(ea.a,{key:e.id,size:"small",user:Object(l.ob)(e.id)?e:void 0,chat:Object(l.ob)(e.id)?void 0:e}))),c.a.createElement("div",{className:"label",dir:"auto"},u?i("Comments",u,"i"):i("LeaveAComment")),c.a.createElement("i",{className:"icon-next"}))}));a(247);function Ja(e){const t=Za(e.currentTarget);t&&t.setAttribute("data-is-document-group-hover","")}function Xa(e){const t=Za(e.currentTarget);t&&t.removeAttribute("data-is-document-group-hover")}function Za(e){let t=e;do{t=t.nextElementSibling}while(t&&!t.classList.contains("last-in-document-group"));return t}var es=Object(c.h)(Object(s.h)((e,t)=>{const{focusedMessage:a,forwardMessages:s,lastSyncTime:n}=e,{message:c,album:o,withSenderName:i,withAvatar:d,threadId:b,messageListType:u}=t,{id:m,chatId:h,viaBotId:O,replyToMessageId:j,isOutgoing:g}=c,p=Object(r.g)(e,h),f=Object(r.P)(e,h),I=p&&Object(l.mb)(p),v=p&&p.username,y=!f&&Object(l.hb)(c),C=i||d||y?Object(r.vb)(e,c):void 0,E=Object(r.K)(e,c),w=O?Object(r.Kb)(e,O):void 0,S=b?Object(r.Ib)(e,h,b):void 0,M=c.id===S,k=j===S,N=j&&!k?Object(r.l)(e,h,j):void 0,T=N&&Object(r.vb)(e,N),P=Object(r.Jb)(e,c),A="thread"===u&&(o?o.messages.some(t=>Object(r.U)(e,t)):Object(r.U)(e,c)),{direction:R,noHighlight:x}=A&&a||{},L=s.messageIds&&s.messageIds.includes(m),{query:B}=Object(r.B)(e)||{},D=Object(l.M)(c);let F;return F=o&&o.messages?o.messages.every(({id:t})=>Object(r.V)(e,t)):Object(r.V)(e,m),{theme:Object(r.Eb)(e),chatUsername:v,forceSenderName:y,sender:C,originSender:E,botSender:w,shouldHideReply:k,isThreadTop:M,replyMessage:N,replyMessageSender:T,isFocused:A,isForwarding:L,isChatWithSelf:f,isChannel:I,lastSyncTime:n,highlight:B,isSingleEmoji:Boolean(D),animatedEmoji:D?Object(r.c)(e,D):void 0,isInSelectMode:Object(r.S)(e),isSelected:F,isGroupSelected:!!c.groupedId&&!c.isInAlbum&&Object(r.Q)(e,h,c.groupedId),threadId:b,isPinnedList:"pinned"===u,shouldAutoLoadMedia:p?Object(r.wb)(e,c,p,C):void 0,shouldAutoPlayMedia:Object(r.xb)(e,c),shouldLoopStickers:Object(r.yb)(e),...g&&{outgoingStatus:Object(r.gb)(e,c,"scheduled"===u)},..."number"==typeof P&&{uploadProgress:P},...A&&{focusDirection:R,noFocusHighlight:x}}},(e,t)=>Object(h.l)(t,["focusMessage","openMediaViewer","openAudioPlayer","cancelSendingMessage","openUserInfo","openChat","markMessagesRead","sendPollVote","toggleMessageSelection","setReplyingToId","openForwardMenu","clickInlineButton","disableContextMenuHint","showNotification"]))(({message:e,chatUsername:t,observeIntersectionForBottom:a,observeIntersectionForMedia:s,observeIntersectionForAnimatedStickers:n,album:o,noAvatars:r,withAvatar:i,withSenderName:d,noComments:h,appearanceOrder:O,isFirstInGroup:j,isLastInGroup:g,isFirstInDocumentGroup:p,isLastInDocumentGroup:f,isLastInList:I,theme:v,forceSenderName:y,sender:C,originSender:E,botSender:w,isThreadTop:S,shouldHideReply:M,replyMessage:k,replyMessageSender:N,outgoingStatus:T,uploadProgress:P,isFocused:A,focusDirection:R,noFocusHighlight:x,isForwarding:L,isChatWithSelf:B,isChannel:D,lastSyncTime:F,highlight:U,animatedEmoji:H,isInSelectMode:q,isSelected:G,isGroupSelected:_,threadId:z,messageListType:K,isPinnedList:$,shouldAutoLoadMedia:V,shouldAutoPlayMedia:W,shouldLoopStickers:Q,focusMessage:Y,openMediaViewer:J,openAudioPlayer:X,openUserInfo:Z,openChat:ee,cancelSendingMessage:te,markMessagesRead:ae,sendPollVote:se,toggleMessageSelection:ce,setReplyingToId:re,openForwardMenu:ie,clickInlineButton:le,disableContextMenuHint:de,showNotification:be})=>{const ue=Object(c.q)(null),me=Object(c.q)(null),je=Object(c.q)(null),ge=Object(Oe.a)();Object(xt.c)(me,a);const{isContextMenuOpen:pe,contextMenuPosition:Ie,handleBeforeContextMenu:ve,handleContextMenu:ye,handleContextMenuClose:Ce,handleContextMenuHide:Ee}=Object(Dt.a)(ue,m.n&&q,!0,m.b);Object(c.n)(()=>{pe&&de()},[pe,de]);const we=O<=0,[Se,Me]=Object(he.a)(we);Object(c.n)(()=>{we||setTimeout(Me,10*O)},[O,Me,we]);const{transitionClassNames:ke}=Object(oe.a)(Se,void 0,we,!1),{chatId:Ne,id:Te,threadInfo:Pe}=e,Ae=Object(l.xb)(e),Re=Object(l.yb)(e),xe="scheduled"===K||e.isScheduled,Le=Object(l.zb)(e)&&!M,Be=Boolean(Pe)&&"thread"===K,{forwardInfo:De,viaBotId:Fe}=e,Ue=De&&!B&&!De.isLinkedChannelPost,He=!!e.groupedId&&!e.isInAlbum,qe=Boolean(o)&&o.messages.length>1,{text:Ge,photo:_e,video:ze,audio:Ke,voice:$e,document:Ve,sticker:We,contact:Qe,poll:Ye,webPage:Je,invoice:Xe}=Object(l.v)(e),et=Object(l.x)(e),tt=Object(Ft.a)(e,U,Ut(et)),at=void 0!==Ie,st=D&&e.adminTitle||De&&!Ue&&De.adminTitle||void 0,nt=Object(c.p)(()=>st?Xt(st):void 0,[st]),ot=!(at||q||L)&&(!He||f),rt=D&&!xe,it=Boolean($||De&&(De.isChannelPost||B&&!Re)&&De.fromMessageId),lt=!De||!B&&C?C:E,dt=De?E:C,bt=Object(ne.a)("Message message-list-item",j&&"first-in-group",g&&"last-in-group",p&&"first-in-document-group",f&&"last-in-document-group",I&&"last-in-list",Re&&"own",Boolean(e.views)&&"has-views",e.isEdited&&"was-edited",Le&&"has-reply",at&&"has-menu-open",A&&!x&&"focused",L&&"is-forwarding",e.isDeleting&&"is-deleting",He&&"is-in-document-group",qe&&"is-album",e.hasUnreadMention&&"has-unread-mention",G&&"is-selected",q&&"is-in-selection-mode",S&&"is-thread-top",Boolean(e.inlineButtons)&&"has-inline-buttons",ke),ht=function(e,{hasReply:t,customShape:a,isLastInGroup:s,asForwarded:n,hasThread:c,forceSenderName:o,hasComments:r,hasActionButton:i}={}){const{text:d,photo:b,video:u,audio:m,voice:h,document:O,poll:j,webPage:g,contact:p}=Object(l.v)(e),f=["message-content"],I=b||u,v=I&&!d,y=Boolean(e.viaBotId);return Ut(a)?f.push("emoji-only emoji-only-"+a):d&&f.push("text"),i&&f.push("has-action-button"),a&&(f.push("custom-shape"),u&&u.isRound&&f.push("round"),r&&f.push("has-comments")),b||u?f.push("media"):m?f.push("audio"):h?f.push("voice"):O?f.push("document"):p?f.push("contact"):j?f.push("poll"):g&&(f.push("web-page"),(g.photo||g.video)&&f.push("media")),n&&!a&&f.push("is-forwarded"),t&&f.push("is-reply"),c&&f.push("has-replies"),y&&f.push("is-via-bot"),o&&f.push("force-sender-name"),a||(f.push("has-shadow"),I&&r&&f.push("has-background"),(t||n||!v||y||o)&&f.push("has-solid-background"),!s||!b&&v||f.push("has-appendix")),f.join(" ")}(e,{hasReply:Le,customShape:et,isLastInGroup:g,asForwarded:Ue,hasThread:Be,forceSenderName:y,hasComments:e.threadInfo&&e.threadInfo.messagesCount>0,hasActionButton:rt||it}),Ot=e.threadInfo&&(!He||f)&&"thread"===K&&!h,jt=ht.includes("has-appendix");Object(ct.a)(Ne,Le?e.replyToMessageId:void 0,k,e.id),Zt(ue,Ne,A,R,x),Object(c.o)(()=>{je.current&&(je.current.innerHTML=Re?'<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>')},[Re,jt]);const gt=Object(c.m)(t=>{t.stopPropagation(),ce({messageId:Te,groupedId:e.groupedId})},[Te,e.groupedId,ce]),pt=Object(c.m)(e=>{if(Ae)return;const t=qe&&o&&o.messages?{messageId:Te,childMessageIds:o.messages.map(({id:e})=>e),withShift:e&&e.shiftKey}:{messageId:Te,withShift:e&&e.shiftKey};ce(t)},[Ae,qe,o,Te,ce]),ft=Object(c.m)(()=>{re({messageId:Te})},[re,Te]),It=Object(c.m)(e=>{e.stopPropagation()},[]),vt=Object(c.m)(()=>{lt&&(Object(l.ob)(lt.id)?Z({id:lt.id}):ee({id:lt.id}))},[lt,Z,ee]),yt=Object(c.m)(()=>{dt?Object(l.ob)(dt.id)?Z({id:dt.id}):ee({id:dt.id}):be({message:ge("HidAccount")})},[dt,be,ge,Z,ee]),Ct=Object(c.m)(()=>{w&&Z({id:w.id})},[w,Z]),Et=Object(c.m)(()=>{Y({chatId:Ne,threadId:z,messageId:e.replyToMessageId,replyMessageId:Te})},[Y,Ne,z,e.replyToMessageId,Te]),wt=Object(c.m)(()=>{J({chatId:Ne,threadId:z,messageId:Te,origin:xe?u.h.ScheduledInline:u.h.Inline})},[Ne,z,Te,J,xe]),St=Object(c.m)(()=>{X({chatId:Ne,messageId:Te})},[Ne,Te,X]),Mt=Object(c.m)(e=>{J({chatId:Ne,threadId:z,messageId:e,origin:xe?u.h.ScheduledAlbum:u.h.Album})},[Ne,z,J,xe]),kt=Object(c.m)(e=>{const t=e.target;(t.classList.contains("text-content")||t.classList.contains("Message"))&&(m.b&&Ze.a.getIsKeyboardVisible()?setTimeout(()=>{ye(e)},350):ye(e))},[ye]),Nt=Object(c.m)(e=>{m.b?pt(e):ye(e)},[ye,pt]),Pt=Object(c.m)(()=>{ae({messageIds:[Te]})},[Te,ae]),At=Object(c.m)(()=>{te({chatId:Ne,messageId:Te})},[te,Ne,Te]),Rt=Object(c.m)(e=>{se({chatId:Ne,messageId:Te,options:e})},[Ne,Te,se]),Lt=Object(c.m)(()=>{ie({fromChatId:Ne,groupedId:e.groupedId})},[ie,Ne,e.groupedId]),Bt=Object(c.m)(()=>{if(o&&o.messages){const e=o.messages.map(({id:e})=>e);ie({fromChatId:Ne,messageIds:e})}else ie({fromChatId:Ne,messageIds:[Te]})},[o,ie,Ne,Te]),Gt=Object(c.m)(()=>{Y({chatId:Ne,threadId:b.MAIN_THREAD_ID,messageId:Te})},[Y,Ne,Te]),_t=Object(c.m)(()=>{Y(He?{chatId:De.fromChatId,groupedId:e.groupedId,groupedChatId:Ne}:{chatId:De.fromChatId,messageId:De.fromMessageId})},[Y,De,e,Ne,He]);let zt,Kt="",$t=!1;const Vt=Object(c.p)(()=>qe?Yt(Re,Boolean(Ue),Boolean(r),o):void 0,[qe,Re,Ue,r,o]),Wt=Ue?28:0;if(qe||!_e&&!ze)Vt&&(zt=Math.max(Ht(Boolean(Ge),Ot),Vt.containerStyle.width),zt-Vt.containerStyle.width>18&&($t=!0));else{let t;_e?t=qt(e,r).width:ze&&(t=ze.isRound?ut.e:qt(e,r).width),t&&(zt=Math.max(Ht(Boolean(Ge),Ot),t),zt-t>18&&($t=!0))}return zt&&(Kt=`width: ${zt+Wt}px`),c.a.createElement("div",{ref:ue,id:"message"+Te,className:bt,style:nt?`--meta-safe-author-width: ${nt}px`:void 0,"data-message-id":Te,onClick:q?pt:m.b?kt:void 0,onDoubleClick:q?void 0:ft,onMouseDown:q?void 0:e=>{Tt(e),Ae||ve(e)},onContextMenu:q||Ae?void 0:Nt,onMouseEnter:He&&!f?Ja:void 0,onMouseLeave:He&&!f?Xa:void 0},c.a.createElement("div",{ref:me,className:"bottom-marker","data-message-id":Te,"data-last-message-id":o?o.messages[o.messages.length-1].id:void 0,"data-has-unread-mention":e.hasUnreadMention}),!Ae&&!He&&c.a.createElement("div",{className:"message-select-control"},G&&c.a.createElement("i",{className:"icon-select"})),!Ae&&f&&c.a.createElement("div",{className:Object(ne.a)("message-select-control group-select",_&&"is-selected"),onClick:gt},_&&c.a.createElement("i",{className:"icon-select"})),i&&function(){const e=lt&&Object(l.ob)(lt.id),t=lt&&e?lt:void 0,a=lt&&!e?lt:void 0,s=!lt&&De?De.hiddenUserName:void 0;return c.a.createElement(ea.a,{size:"small",user:t,chat:a,text:s,lastSyncTime:F,onClick:t||a?vt:void 0})}(),c.a.createElement("div",{className:Object(ne.a)("message-content-wrapper",ht.includes("text")&&"can-select-text"),onClick:q&&He?pt:void 0},c.a.createElement("div",{className:ht,style:Kt,dir:"auto"},Ue&&!et&&(!He||p)&&c.a.createElement("div",{className:"message-title"},ge("ForwardedMessage")),function(){const t=Object(ne.a)("content-inner",Ue&&!et&&"forwarded-message",Le&&"reply-message",$t&&"no-media-corners"),a=g&&!tt&&!Ue&&!Be,i=!Je&&!H&&tt,b=Object(ne.a)("text-content",i&&"with-meta",T&&"with-outgoing-icon");return c.a.createElement("div",{className:t,onDoubleClick:It,dir:"auto"},function(){if(et&&!Fe||!(d&&!_e&&!ze||Ue||Fe||y)||He&&!p)return;let t,a;!dt||et&&Fe?De&&De.hiddenUserName&&(t=De.hiddenUserName):(t=Object(l.X)(ge,dt),Ue||(a="color-"+Object(l.Z)(dt)));return c.a.createElement("div",{className:"message-title",dir:"ltr"},t?c.a.createElement("span",{className:Object(ne.a)("interactive",a),onClick:yt,dir:"auto"},Object(mt.a)(t)):w?void 0:" ",w&&c.a.createElement(c.a.Fragment,null,c.a.createElement("span",{className:"via"},ge("ViaBot")),c.a.createElement("span",{className:"interactive",onClick:Ct},Object(mt.a)("@"+w.username))),De&&De.isLinkedChannelPost?c.a.createElement("span",{className:"admin-title",dir:"auto"},ge("DiscussChannel")):e.adminTitle&&!D?c.a.createElement("span",{className:"admin-title",dir:"auto"},e.adminTitle):void 0)}(),Le&&c.a.createElement(na,{message:k,sender:N,observeIntersection:s,onClick:Et}),We&&c.a.createElement(ua,{message:e,observeIntersection:s,observeIntersectionForPlaying:n,shouldLoop:Q,lastSyncTime:F}),H&&c.a.createElement(ma.a,{size:"small",sticker:H,observeIntersection:s,lastSyncTime:F,forceLoadPreview:Ae}),qe&&c.a.createElement(Ka,{album:o,albumLayout:Vt,observeIntersection:s,shouldAutoLoad:V,shouldAutoPlay:W,isOwn:Re,hasCustomAppendix:a,lastSyncTime:F,onMediaClick:Mt}),!qe&&_e&&c.a.createElement(va,{message:e,observeIntersection:s,noAvatars:r,shouldAutoLoad:V,uploadProgress:P,shouldAffectAppendix:a,onClick:wt,onCancelUpload:At}),!qe&&ze&&ze.isRound&&c.a.createElement(Wa,{message:e,observeIntersection:s,shouldAutoLoad:V,shouldAutoPlay:W,lastSyncTime:F}),!qe&&ze&&!ze.isRound&&c.a.createElement(ka,{message:e,observeIntersection:s,noAvatars:r,shouldAutoLoad:V,shouldAutoPlay:W,uploadProgress:P,lastSyncTime:F,onClick:wt,onCancelUpload:At}),(Ke||$e)&&c.a.createElement(oa.a,{theme:v,message:e,uploadProgress:P,lastSyncTime:F,isSelectable:He,isSelected:G,onPlay:St,onReadMedia:!$e||Re&&!B?void 0:Pt,onCancelUpload:At}),Ve&&c.a.createElement(ca.a,{message:e,observeIntersection:s,uploadProgress:P,isSelectable:He,isSelected:G,onMediaClick:wt,onCancelUpload:At}),Qe&&c.a.createElement(Ta,{contact:Qe}),Ye&&c.a.createElement(Da,{message:e,poll:Ye,onSendVote:Rt}),!H&&tt&&c.a.createElement("p",{className:b,dir:"auto"},tt,i&&c.a.createElement(ia,{message:e,outgoingStatus:T,signature:st,onClick:pt})),Je&&c.a.createElement(Ha,{message:e,observeIntersection:s,noAvatars:r,shouldAutoLoad:V,shouldAutoPlay:W,lastSyncTime:F,onMediaClick:wt,onCancelMediaTransfer:At}),Xe&&c.a.createElement(qa,{message:e}))}(),(!He||f)&&!(!Je&&!H&&tt)&&c.a.createElement(ia,{message:e,outgoingStatus:T,signature:st,onClick:pt}),ot&&rt?c.a.createElement(fe.a,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:ge("lng_context_forward_msg"),onClick:f?Lt:Bt},c.a.createElement("i",{className:"icon-share-filled"})):ot&&it?c.a.createElement(fe.a,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:"Focus message",onClick:$?Gt:_t},c.a.createElement("i",{className:"icon-arrow-right"})):void 0,Ot&&c.a.createElement(Ya,{message:e,disabled:h}),jt&&c.a.createElement("div",{className:"svg-appendix",ref:je})),e.inlineButtons&&c.a.createElement(Qa,{message:e,onClick:le})),Ie&&c.a.createElement(aa,{isOpen:pe,anchor:Ie,message:e,album:o,chatUsername:t,messageListType:K,onClose:Ce,onCloseAnimationEnd:Ee}))}));var ts=Object(c.h)(({messageIds:e,messageGroups:t,isViewportNewest:a,isUnread:o,withUsers:r,noAvatars:i,containerRef:d,anchorIdRef:b,memoFirstUnreadIdRef:m,threadId:O,type:j,threadTopMessageId:g,hasLinkedChat:p,isSchedule:I,noAppearanceAnimation:v,onFabToggle:y,onNotchToggle:C,openHistoryCalendar:E})=>{const{observeIntersectionForMedia:w,observeIntersectionForReading:S,observeIntersectionForAnimatedStickers:M}=function(e,t,a){const{markMessageListRead:n,markMessagesRead:c}=Object(s.d)(),{observe:o}=Object(xt.a)({rootRef:t,throttleMs:Lt,margin:Bt}),{observe:r,freeze:i,unfreeze:l}=Object(xt.a)({rootRef:t},t=>{if("thread"!==e)return;let s=0;const o=[];t.forEach(e=>{const{isIntersecting:t,target:a}=e;if(!t)return;const{dataset:n}=a,c=Number(n.lastMessageId||n.messageId);c>s&&(s=c),n.hasUnreadMention&&o.push(c)}),a.current&&s>=a.current&&n({maxId:s}),o.length&&c({messageIds:o})});Object(re.a)(i,l);const{observe:d}=Object(xt.a)({rootRef:t,throttleMs:Lt});return{observeIntersectionForMedia:o,observeIntersectionForReading:r,observeIntersectionForAnimatedStickers:d}}(j,d,m),{backwardsTriggerRef:k,forwardsTriggerRef:N,fabTriggerRef:T}=function(e,t,a,o,r,i,l){const{loadViewportMessages:d}=Object(s.d)(),[b,m]=Object(c.p)(()=>"thread"===e?[Object(f.a)(()=>d({direction:u.e.Backwards}),1e3,!0,!1),Object(f.a)(()=>d({direction:u.e.Forwards}),1e3,!0,!1)]:[],[d,a]),h=Object(c.q)(null),O=Object(c.q)(null),j=Object(c.q)(null),g=Object(c.m)(()=>{if(!a||!a.length)return i(!1),void l(!1);if(!o)return i(!0),void l(!0);const{offsetHeight:e,scrollHeight:s,scrollTop:n}=t.current,c=s-n-e,d=c<=0;i(r?!d:!(c<=50)),l(!d)},[a,o,t,i,r,l]),{observe:p}=Object(xt.a)({rootRef:t,margin:n.fb},e=>{if(!m||!b)return;const a=e.find(({isIntersecting:e})=>e);if(!a)return;const{target:s}=a;"backwards-trigger"===s.className?(Object(At.a)(t.current),b()):"forwards-trigger"===s.className&&(Object(At.a)(t.current),m())});Object(xt.c)(h,p),Object(xt.c)(O,p);const{observe:I,freeze:v,unfreeze:y}=Object(xt.a)({rootRef:t,margin:50},g);Object(xt.c)(j,I);const{observe:C,freeze:E,unfreeze:w}=Object(xt.a)({rootRef:t},g);return Object(xt.c)(j,C),Object(le.a)(()=>{v(),E(),setTimeout(()=>{w(),y()},100)},[a]),{backwardsTriggerRef:h,forwardsTriggerRef:O,fabTriggerRef:j}}(j,d,e,a,o,y,C),P=Object(Oe.a)(),A=c.a.createElement("div",{className:Object(ne.a)("unread-divider","local-action-message"),key:"unread-messages"},c.a.createElement("span",null,P("UnreadMessages"))),R=v?0:t.reduce((e,t)=>e+Object(h.h)(t.senderGroups).length,0);let L=0;const B=t.map((e,t,a)=>{const s=e.senderGroups.map((e,s,n)=>{if(1===e.length&&!kt(e[0])&&Object(l.gb)(e[0])){const o=e[0],r=s===n.length-1&&t===a.length-1;return Object(h.e)([o.id===m.current&&A,c.a.createElement(sa,{key:o.id,message:o,observeIntersection:S,appearanceOrder:R-++L,isLastInList:r})])}let o;return Object(h.h)(e.map((d,u)=>{const f=kt(d)?d.mainMessage:d,I=kt(d)?d:void 0,v=Object(l.yb)(f),y=kt(d),C=e[u+1];f.previousLocalId&&b.current==="message"+f.previousLocalId&&(b.current="message"+f.id);const E=!y&&f.groupedId?f.groupedId:void 0,k=C&&!kt(C)?C.groupedId:void 0,N={isFirstInGroup:0===u,isLastInGroup:u===e.length-1,isFirstInDocumentGroup:Boolean(E&&E!==o),isLastInDocumentGroup:Boolean(E&&E!==k),isLastInList:u===e.length-1&&s===n.length-1&&t===a.length-1};o=E;const T=Object(l.G)(f),x="scheduled"!==j?T:`${f.date}_${T}`;return Object(h.e)([f.id===m.current?A:void 0,c.a.createElement(es,{key:x,message:f,observeIntersectionForBottom:S,observeIntersectionForMedia:w,observeIntersectionForAnimatedStickers:M,album:I,noAvatars:i,withAvatar:N.isLastInGroup&&r&&!v&&!(f.id===g),withSenderName:N.isFirstInGroup&&r&&!v,threadId:O,messageListType:j,noComments:!1===p,appearanceOrder:R-++L,isFirstInGroup:N.isFirstInGroup,isLastInGroup:N.isLastInGroup,isFirstInDocumentGroup:N.isFirstInDocumentGroup,isLastInDocumentGroup:N.isLastInDocumentGroup,isLastInList:N.isLastInList}),f.id===g&&c.a.createElement("div",{className:"local-action-message",key:"discussion-started"},c.a.createElement("span",null,P("DiscussionStarted")))])}))});return c.a.createElement("div",{className:"message-date-group",key:e.datetime,onMouseDown:Tt,teactFastList:!0},c.a.createElement("div",{className:Object(ne.a)("sticky-date",!I&&"interactive"),key:"date-header",onMouseDown:Tt,onClick:I?void 0:()=>E({selectedAt:e.datetime})},c.a.createElement("span",{dir:"auto"},I&&e.originalDate===n.xb&&P("MessageScheduledUntilOnline"),I&&e.originalDate!==n.xb&&P("MessageScheduledOn",Object(x.c)(P,e.datetime,void 0,!0)),!I&&Object(x.c)(P,e.datetime))),Object(h.h)(s))});return c.a.createElement("div",{className:"messages-container",teactFastList:!0},c.a.createElement("div",{ref:k,key:"backwards-trigger",className:"backwards-trigger"}),Object(h.h)(B),c.a.createElement("div",{ref:N,key:"forwards-trigger",className:"forwards-trigger"}),c.a.createElement("div",{ref:T,key:"fab-trigger",className:"fab-trigger"}))}),as=a(126);a(249);var ss=Object(c.h)(Object(s.h)((e,{userId:t})=>{const{stickers:a}=e.stickers.greeting,s=a&&a.length?a[t%a.length]:void 0,n=Object(r.g)(e,t);return n?{sticker:s,lastUnreadMessageId:n.lastMessage&&n.lastMessage.id!==n.lastReadInboxMessageId?n.lastMessage.id:void 0,connectionState:e.connectionState}:{}},(e,t)=>Object(h.l)(t,["loadGreetingStickers","sendMessage","markMessageListRead"]))(({sticker:e,connectionState:t,lastUnreadMessageId:a,loadGreetingStickers:s,sendMessage:n,markMessageListRead:o})=>{const r=Object(Oe.a)(),i=Object(c.q)(null),{observe:l}=Object(xt.a)({rootRef:i,debounceMs:200});Object(c.n)(()=>{e||"connectionStateReady"!==t||s()},[t,s,e]),Object(c.n)(()=>{"connectionStateReady"===t&&a&&o({maxId:a})},[t,o,a]);const d=Object(c.m)(e=>{e={...e,isPreloadedGlobally:!0},n({sticker:e})},[n]);return c.a.createElement("div",{className:"ContactGreeting",ref:i},c.a.createElement("div",{className:"wrapper"},c.a.createElement("p",{className:"title",dir:"auto"},r("Conversation.EmptyPlaceholder")),c.a.createElement("p",{className:"description",dir:"auto"},r("Conversation.GreetingText")),c.a.createElement("div",{className:"sticker"},e&&c.a.createElement(as.a,{sticker:e,onClick:d,clickArg:e,observeIntersection:l,size:160,className:"large"}))))}));a(250);var ns=Object(c.h)(({isChatWithSelf:e,type:t,isGroupChatJustCreated:a})=>{const s=Object(Oe.a)();return"scheduled"===t?function(e){return c.a.createElement("div",{className:"empty"},c.a.createElement("span",null,e("ScheduledMessages.EmptyPlaceholder")))}(s):e?function(e){return c.a.createElement("div",{className:"NoMessages"},c.a.createElement("div",{className:"wrapper"},c.a.createElement("i",{className:"icon icon-cloud-download"}),c.a.createElement("h3",{className:"title"},e("Conversation.CloudStorageInfo.Title")),c.a.createElement("ul",{className:"description"},c.a.createElement("li",null,e("Conversation.ClousStorageInfo.Description1")),c.a.createElement("li",null,e("Conversation.ClousStorageInfo.Description2")),c.a.createElement("li",null,e("Conversation.ClousStorageInfo.Description3")),c.a.createElement("li",null,e("Conversation.ClousStorageInfo.Description4")))))}(s):a?function(e){return c.a.createElement("div",{className:"NoMessages"},c.a.createElement("div",{className:"wrapper",dir:e.isRtl?"rtl":void 0},c.a.createElement("h3",{className:"title"},e("EmptyGroupInfo.Title")),c.a.createElement("p",{className:"description"},e("EmptyGroupInfo.Subtitle")),c.a.createElement("ul",{className:"list-checkmarks"},c.a.createElement("li",null,e("EmptyGroupInfo.Line1")),c.a.createElement("li",null,e("EmptyGroupInfo.Line2")),c.a.createElement("li",null,e("EmptyGroupInfo.Line3")),c.a.createElement("li",null,e("EmptyGroupInfo.Line4")))))}(s):c.a.createElement("div",{className:"empty"},c.a.createElement("span",null,s("NoMessages")))});a(251);const cs=Object(f.a)(e=>e(),200,!1);function os(e,t){return t&&1===t.length&&1===t[0].senderGroups.length&&1===t[0].senderGroups[0].length&&"content"in t[0].senderGroups[0][0]&&t[0].senderGroups[0][0].content.action&&t[0].senderGroups[0][0].content.action.type===e}var rs=Object(c.h)(Object(s.h)((e,{chatId:t,threadId:a,type:s})=>{const n=Object(r.g)(e,t);if(!n)return{};const c=Object(r.y)(e,t,a,s),o="scheduled"===s?Object(r.sb)(e,t):Object(r.n)(e,t),i=Object(r.Ib)(e,t,a);if(a!==b.MAIN_THREAD_ID&&!(o&&i&&o[i]))return{};const{isRestricted:d,restrictionReason:u,lastMessage:m}=n,h=Object(r.I)(e,t),O=h?!e.focusedMessage.noHighlight:void 0,j=a===b.MAIN_THREAD_ID&&!c&&!n.unreadCount&&!h&&m&&!m.groupedId,g=Object(r.h)(e,t);let p;if(Object(r.L)(e,t)){const a=Object(r.h)(e,t);p=a.fullInfo?a.fullInfo.botDescription||"NoMessages":"Updating bot info..."}return{isChatLoaded:!0,isRestricted:d,restrictionReason:u,isChannelChat:Object(l.mb)(n),isGroupChat:Object(l.nb)(n),isCreator:n.isCreator,isChatWithSelf:Object(r.P)(e,t),isBot:Boolean(g),messageIds:c,messagesById:o,firstUnreadId:Object(r.H)(e,t,a),isViewportNewest:"thread"!==s||Object(r.Y)(e,t,a),threadFirstMessageId:Object(r.G)(e,t,a),focusingId:h,hasFocusHighlight:O,isSelectModeActive:Object(r.S)(e),botDescription:p,threadTopMessageId:i,hasLinkedChat:n.fullInfo&&"linkedChatId"in n.fullInfo?Boolean(n.fullInfo.linkedChatId):void 0,...j&&{lastMessage:m}}},(e,t)=>Object(h.l)(t,["loadViewportMessages","setScrollOffset","openHistoryCalendar"]))(({chatId:e,threadId:t,type:a,hasTools:o,onFabToggle:i,onNotchToggle:d,isChatLoaded:b,isChannelChat:m,isGroupChat:O,canPost:j,isReady:g,isChatWithSelf:p,isCreator:I,isBot:v,messageIds:y,messagesById:C,firstUnreadId:E,isViewportNewest:w,threadFirstMessageId:S,isRestricted:M,restrictionReason:k,focusingId:N,hasFocusHighlight:T,isSelectModeActive:P,loadViewportMessages:A,setScrollOffset:R,lastMessage:x,botDescription:L,threadTopMessageId:B,hasLinkedChat:D,openHistoryCalendar:F})=>{const U=Object(c.q)(null),H=Object(c.q)("thread"===a&&Object(r.tb)(Object(s.e)(),e,t)||0),q=Object(c.q)(),G=Object(c.q)(),_=Object(c.q)(),z=Object(c.q)(),K=Object(c.q)(),$=Object(c.q)(),V=Object(c.q)(!1),W=Object(c.q)(Boolean(x)),[Q,Y]=Object(c.r)(),J=Boolean(y);Object(le.a)(()=>{J&&Object(f.e)(()=>{W.current=!1})},[J]),Object(le.a)(()=>{K.current=E,z.current||(z.current=E)},[E]),Object(le.a)(()=>{$.current=N},[N]);const X=Object(c.p)(()=>{if(!y||!C)return;const e=!B||y[0]&&S!==y[0]?y:[B,...y];if(!e.length)return;const t=e.map(e=>C[e]).filter(Boolean);return Nt(Object(h.k)(t,["date","id"]),z.current)},[y,C,S,B]),Z=Object(c.p)(()=>{if("thread"===a)return Object(f.a)(()=>A({direction:u.e.Around}),1e3,!0,!1)},[A,y]),{isScrolled:ee,updateStickyDates:te}=Pt(),ae=Object(c.m)(()=>{if(V.current)return void(V.current=!1);const s=U.current;$.current||te(s,o),cs(()=>{Object(f.b)(()=>{s.parentElement&&(H.current=s.scrollHeight-s.scrollTop,"thread"===a&&R({chatId:e,threadId:t,scrollOffset:H.current}))})})},[te,o,a,R,e,t]);Object(c.n)(()=>{if(!("ResizeObserver"in window))return;const e=new ResizeObserver(([e])=>{e.target.offsetParent&&Y(e.contentRect.height)});return e.observe(U.current),()=>{e.disconnect()}},[]);const{height:ce}=et();Object(c.n)(()=>{g&&(U.current.dataset.normalHeight=String(U.current.offsetHeight))},[ce,g]),Object(c.n)(()=>{if(!Z||!b||M||N)return;const e=U.current;(!y||y.length<n.gb/2&&e.firstElementChild.clientHeight<=e.offsetHeight)&&Z()},[b,y,Z,N,M]),Object(le.a)(()=>{if(!y||!_.current||!g)return;const e=_.current.filter(e=>y.includes(Number(e.dataset.messageId))),t=e[1]||e[0];t&&(q.current=t.id,G.current=t.getBoundingClientRect().top)},[y,w,Q,o,g]),Object(St.a)(([e,t,a])=>{const s=U.current;if(_.current=Array.from(s.querySelectorAll(".message-list-item")),!s.offsetParent)return;const c=w&&y&&y.length<n.gb/2&&!s.parentElement.classList.contains("force-messages-scroll")&&s.firstElementChild.clientHeight<=2*s.offsetHeight;c&&(s.parentElement.classList.add("force-messages-scroll"),setTimeout(()=>{s.parentElement&&s.parentElement.classList.remove("force-messages-scroll")},1e3));const{scrollTop:r,scrollHeight:i,offsetHeight:l}=s,d=H.current,b=_.current[_.current.length-1],u=b?b.offsetHeight:0,m=w&&t&&d-(a||l)-u<=100;let h;const O=y&&e&&y[0]!==e[0],j=y&&e&&y[y.length-1]!==e[e.length-1],g=y&&$.current===y[y.length-1];if(m&&j&&!O&&!g&&(b&&Object(f.b)(()=>{Object(Rt.a)(s,b,"end",20,void 0,void 0,void 0,!0)}),h=i-l,H.current=Math.max(i-h,l),!c))return;const p=void 0!==a&&a!==Q,I=q.current&&s.querySelector("#"+q.current),v=!I&&z.current&&s.querySelector(".unread-divider");if(m&&p){if(Object(Rt.b)())return;h=i-l}else if(I){h=r+(I.getBoundingClientRect().top-(G.current||0))}else h=v?Math.min(v.offsetTop-(o?60:10),i-d):i-d;Object(At.a)(s,h),$.current||(V.current=!0,Object(f.b)(()=>{V.current=!1})),H.current=Math.max(i-h,l)},[y,w,Q,o]),Object(Mt.a)(([e])=>{void 0!==e&&Object(se.d)(200+n.c)},[P]);const oe=Object(Oe.a)(),re=Boolean(e&&Object(l.ob)(e)),ie=Boolean(!re&&!m||p),de=Boolean(!ie||m),be=Object(l.ob)(e)&&!p&&!v&&(!X&&!x&&y&&(!_.current||0===_.current.length)||os("contactSignUp",X)||x&&x.content.action&&"contactSignUp"===x.content.action.type),ue=O&&I&&os("chatCreate",X),me=Object(ne.a)("MessageList custom-scroll",de&&"no-avatars",!j&&"no-composer","pinned"===a&&"type-pinned",T&&"has-focus-highlight",P&&"select-mode-active",ee&&"scrolled",!g&&"is-animating");return c.a.createElement("div",{ref:U,className:me,onScroll:ae,onMouseDown:Tt},M?c.a.createElement("div",{className:"empty"},c.a.createElement("span",null,k?k.text:"This is a private "+(m?"channel":"chat"))):L?c.a.createElement("div",{className:"empty rich"},c.a.createElement("span",null,Object(mt.a)(oe(L),["br","emoji","links"]))):be?c.a.createElement(ss,{userId:e}):!y||X&&!ue?y&&X||x?c.a.createElement(ts,{messageIds:y||[x.id],messageGroups:X||Nt([x]),isViewportNewest:Boolean(w),isUnread:Boolean(E),withUsers:ie,noAvatars:de,containerRef:U,anchorIdRef:q,memoFirstUnreadIdRef:z,threadId:t,type:a,threadTopMessageId:B,hasLinkedChat:D,isSchedule:!!X&&"scheduled"===a,noAppearanceAnimation:!X||!W.current,onFabToggle:i,onNotchToggle:d,openHistoryCalendar:F}):c.a.createElement(xe.a,{color:"white"}):c.a.createElement(ns,{chatId:e,type:a,isChatWithSelf:p,isGroupChatJustCreated:ue}))}));a(252);var is=Object(c.h)(Object(s.h)(e=>{const t=Object(r.z)(e);if(!t)return{};const{chatId:a,threadId:s,type:n}=t,c=Object(r.g)(e,a);return{messageListType:n,unreadCount:c&&s===b.MAIN_THREAD_ID&&"thread"===n?c.unreadCount:void 0}},(e,t)=>Object(h.l)(t,["focusNextReply"]))(({isShown:e,canPost:t,messageListType:a,unreadCount:s,focusNextReply:n})=>{const o=Object(Oe.a)(),r=Object(c.q)(null),i=Object(c.m)(()=>{if(e)if("thread"===a)n();else{const e=r.current.parentElement.querySelector(".MessageList"),t=e.querySelectorAll(".message-list-item"),a=t[t.length-1];if(!a)return;Object(Rt.a)(e,a,"end",20)}},[e,a,n]),l=Object(ne.a)("ScrollDownButton",e&&"revealed",!t&&"no-composer");return c.a.createElement("div",{ref:r,className:l},c.a.createElement("div",{className:"ScrollDownButton-inner"},c.a.createElement(fe.a,{color:"secondary",round:!0,onClick:i,ariaLabel:o("AccDescrPageDown")},c.a.createElement("i",{className:"icon-arrow-down"})),Boolean(s)&&c.a.createElement("div",{className:"unread-count"},Object(rt.b)(s))))})),ls=a(136),ds=a(143);async function bs(e,t,a,s){const n=URL.createObjectURL(t),{type:c,size:o}=t;let r,i;if(c.startsWith("image/"))if(a){const a=await Object(Xe.g)(n),{width:o,height:i}=a;if(o>1280||i>1280||"image/jpeg"!==c){const c=await function(e){return new Promise(t=>{const a=document.createElement("canvas"),s=a.getContext("2d");let{width:n,height:c}=e;(n>1280||c>1280)&&(n>=c?(c*=1280/n,n=1280):(n*=1280/c,c=1280)),a.width=n,a.height=c,s.drawImage(e,0,0,e.width,e.height,0,0,n,c),a.toBlob(t,"image/jpeg",100)})}(a);return c?(URL.revokeObjectURL(n),bs(e,c,!0,s)):bs(e,t,!1,s)}r={width:o,height:i}}else i=n;else if(c.startsWith("video/")){if(o<10485760){const{videoWidth:e,videoHeight:t,duration:a}=await Object(Xe.h)(n);r={width:e,height:t,duration:a}}i=await Object(Xe.c)(n)}return{blobUrl:n,filename:e,mimeType:c,size:o,quick:r,previewBlobUrl:i,...s}}var us=a(192);let ms;function hs(e){ms.focus(),e.focus()}m.e&&(ms=document.createElement("input"),ms.classList.add("for-ios-autocapitalization-fix"),document.body.appendChild(ms));var Os=a.p+"c0155344d336103c2b6a0b28cc510750.js";const js={encoderPath:Os,reuseWorker:!0},gs={type:"audio/ogg"};let ps,fs,Is;async function vs(){return ps||(ps=a.e(10).then(a.t.bind(null,336,7)),fs=(await ps).default,Is=new fs(js)),ps}async function ys(e){await async function(){await vs(),await Is.start()}();const t=Date.now();let a;const s=[],n=[];Is.ondataavailable=e=>{s.push(e)};const c=function(e,t){const a=e.sourceNode,s=a.context.createAnalyser();s.fftSize=64,a.connect(s);const n=s.frequencyBinCount,c=new Uint8Array(n);let o=!1;return function e(){if(o)return;s.getByteFrequencyData(c);const a=c.reduce((e,t)=>e+t,0),r=a/n/255;t(r<.1?0:r),requestAnimationFrame(e)}(),()=>{o=!0}}(Is,t=>{n.push(255*t),e(t)});return{stop:()=>new Promise((e,o)=>{Is.onstop=()=>{e({blob:new Blob(s,gs),duration:Math.round(((a||Date.now())-t)/1e3),waveform:n})},Is.onerror=o;const r=Math.max(0,t+1e3-Date.now());setTimeout(()=>{Is.stop(),c()},r)}),pause:()=>{const e=Math.max(0,t+1e3-Date.now());setTimeout(()=>{Is.pause(),a=Date.now(),c()},e)}}}const Cs=["image/png","image/jpeg","image/gif"];function Es(e){const{text:t,entities:a}=e||{};if(!t)return"";const s=Object(Ft.b)(t,a,void 0,void 0,!0);return Array.isArray(s)?s.join(""):s}let ws,Ss;var Ms=a(66);var ks=a(193),Ns=a(201);const Ts=document.createElement("div"),Ps=/^@([a-z0-9_]{1,32})[\u00A0\u0020]+(.*)/i,As=/^@([a-z0-9_]{1,32})[\u00A0\u0020]+\n{2,}/i;function Rs(e,t,a,n){const[o,r,i]=Object(he.a)(),l=function(e){return Ts.innerHTML=e.replace(/<br>/g,"\n"),Ts.innerText}(a),{queryInlineBot:d,resetInlineBot:b}=Object(s.d)(),{username:u,query:m,canShowHelp:h}=function(e){const t=e.match(Ps);if(!t)return{username:"",query:"",canShowHelp:!1};return{username:t[1],query:t[2],canShowHelp:""===t[2]&&!e.match(As)}}(l),O=u.toLowerCase(),j=Object(ga.a)(m),g=Object(ga.a)(u),p=n&&n[O],{id:f,switchPm:I,offset:v,results:y,isGallery:C,help:E}=p||{};Object(c.n)(()=>{j!==m&&i()},[j,m,i]),Object(c.n)(()=>{e&&O&&t&&d({chatId:t,username:O,query:m})},[m,e,d,t,O]);const w=Object(c.m)(()=>{d({chatId:t,username:O,query:m,offset:v})},[v,t,m,d,O]);return Object(c.n)(()=>{e&&f&&(I||y&&y.length)?r():i()},[f,e,r,y,I,i]),g!==u&&b({username:g}),{isOpen:o,closeTooltip:i,loadMore:w,username:u,id:f,isGallery:C,switchPm:I,results:y,help:h&&E?`@${u} ${E}`:void 0}}var xs=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Re.a)(Ae.a.Extra,"DeleteMessageModal",!t);return a?c.a.createElement(a,e):void 0});function Ls(){return(Ls=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var s in a)Object.prototype.hasOwnProperty.call(a,s)&&(e[s]=a[s])}return e}).apply(this,arguments)}let Bs,Ds=!0;var Fs=Object(c.h)(({onActivate:e,...t})=>{const a=Object(c.q)(!1),s=Object(c.m)(()=>{if(a.current=!0,Ds)return Ds=!1,void e();Bs&&(clearTimeout(Bs),Bs=void 0),Bs=window.setTimeout(()=>{a.current&&e()},200)},[e]),n=Object(c.m)(()=>{a.current=!1},[]);return c.a.createElement(fe.a,Ls({},t,{onMouseEnter:m.n?void 0:s,onMouseLeave:m.n?void 0:n,onClick:m.n?e:void 0}))});var Us=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Re.a)(Ae.a.Extra,"AttachMenu",!t);return a?c.a.createElement(a,e):void 0});var Hs=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Re.a)(Ae.a.Extra,"SymbolMenu",!t);return a?c.a.createElement(a,e):void 0});var qs=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Re.a)(Ae.a.Extra,"InlineBotTooltip",!t);return a?c.a.createElement(a,e):void 0});var Gs=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Re.a)(Ae.a.Extra,"MentionTooltip",!t);return a?c.a.createElement(a,e):void 0});var _s=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Re.a)(Ae.a.Extra,"CustomSendMenu",!t);return a?c.a.createElement(a,e):void 0});var zs=e=>{const{isOpen:t}=e,a=Object(Re.a)(Ae.a.Extra,"StickerTooltip",!t);return a?c.a.createElement(a,e):void 0},Ks=a(194),$s=a(155);a(253);var Vs=Object(c.h)(Object(s.h)((e,{messageId:t})=>{const{chatId:a}=Object(r.z)(e)||{};return a?{message:Object(r.l)(e,a,t)}:{}},(e,t)=>Object(h.l)(t,["clickInlineButton"]))(({isOpen:e,message:t,onClose:a,clickInlineButton:s})=>{const[n,o]=Object($s.a)(e,a),{isKeyboardSingleUse:r}=t||{},[i,l,d]=Object(he.a)(!0),b=()=>{d(),a()};if(Object(c.n)(()=>{l()},[l,t]),t&&t.keyboardButtons)return c.a.createElement(De.a,{isOpen:e||i,autoClose:r,positionX:"right",positionY:"bottom",onClose:b,className:"BotKeyboardMenu",onCloseAnimationEnd:b,onMouseEnter:m.n?void 0:n,onMouseLeave:m.n?void 0:o},c.a.createElement("div",{className:"content"},t.keyboardButtons.map(e=>c.a.createElement("div",{className:"row"},e.map(e=>c.a.createElement(fe.a,{ripple:!0,disabled:"NOT_SUPPORTED"===e.type,onClick:()=>s({button:e})},e.text))))))})),Ws=a(195),Qs=a(123);a(255);var Ys=Object(c.h)(Object(s.h)(e=>{const{chatId:t,threadId:a,type:s}=Object(r.z)(e)||{};if(!t||!a||!s)return{};const{currentUserId:n,forwardMessages:{fromChatId:c,toChatId:o,messageIds:i}}=e,d=Object(r.ob)(e,t,a),b="scheduled"===s?Object(r.F)(e,t):Object(r.D)(e,t,a),u=e.settings.byKey.animationLevel>=1,m=o===t;let h,O;if(d?h=Object(r.l)(e,t,d):b?h=Object(r.E)(e,t,a,s):m&&1===i.length&&(h=Object(r.l)(e,c,i[0])),d&&h){const{forwardInfo:a}=h,s=t===n;a&&(a.isChannelPost||s)&&(O=Object(r.K)(e,h)),O||(O=Object(r.vb)(e,h))}else m&&(O=Object(l.ob)(c)?Object(r.Kb)(e,c):Object(r.g)(e,c));return{replyingToId:d,editingId:b,message:h,sender:O,shouldAnimate:u,forwardedMessagesCount:m?i.length:void 0}},(e,t)=>Object(h.l)(t,["setReplyingToId","setEditingId","focusMessage","exitForwardMode"]))(({replyingToId:e,editingId:t,message:a,sender:s,shouldAnimate:n,forwardedMessagesCount:o,setReplyingToId:r,setEditingId:i,focusMessage:l,exitForwardMode:d})=>{const b=Boolean((e||t)&&a||s&&o),u=Object(Qs.a)([o],o?300:void 0),{shouldRender:m,transitionClassNames:h}=Object(oe.a)(u&&b,void 0,!n,void 0,!n),O=Object(c.m)(()=>{e?r({messageId:void 0}):t?i({messageId:void 0}):o&&d()},[e,t,o,r,i,d]);Object(c.n)(()=>b?Object(be.a)(O):void 0,[b,O]);const j=Object(c.m)(()=>{l({chatId:a.chatId,messageId:a.id})},[l,a]),g=Object(ne.a)("ComposerEmbeddedMessage",h),p=o&&o>1?o+" forwarded messages":void 0;if(m)return c.a.createElement("div",{className:g},c.a.createElement("div",null,c.a.createElement(fe.a,{round:!0,color:"translucent",ariaLabel:"Cancel replying",onClick:O},c.a.createElement("i",{className:"icon-close"})),c.a.createElement(na,{className:"inside-input",message:a,sender:s,customText:p,title:t?"Edit Message":void 0,onClick:j})))}));var Js=Object(c.h)(e=>{const{attachments:t}=e,a=Object(Re.a)(Ae.a.Extra,"AttachmentModal",!t.length);return a?c.a.createElement(a,e):void 0});var Xs=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Re.a)(Ae.a.Extra,"PollModal",!t);return a?c.a.createElement(a,e):void 0});var Zs=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Re.a)(Ae.a.Extra,"DropArea",!t);return a?c.a.createElement(a,e):void 0});a(256);const en=new RegExp(n.rb,"i");var tn=Object(c.h)(Object(s.h)((e,{chatId:t,threadId:a})=>{const s=Object(r.db)(e,t,a);return{webPagePreview:e.webPagePreview,noWebPage:s}},(e,t)=>Object(h.l)(t,["loadWebPagePreview","clearWebPagePreview","toggleMessageWebPage"]))(({chatId:e,threadId:t,messageText:a,disabled:s,webPagePreview:n,noWebPage:o,loadWebPagePreview:r,clearWebPagePreview:i,toggleMessageWebPage:l})=>{const d=Object(c.p)(()=>{const{text:e,entities:t}=Object(ds.a)(a),s=t&&t.find(({type:e})=>e===b.ApiMessageEntityTypes.TextUrl);if(s)return s.url;const n=e.match(en);return n?n[0]:void 0},[a]);Object(c.n)(()=>{d?r({text:d}):(i(),l({chatId:e,threadId:t}))},[e,l,i,d,r,t]),Object(le.a)(()=>{i(),l({chatId:e,threadId:t})},[e]);const u=Boolean(n&&a.length&&!o&&!s),{shouldRender:m,transitionClassNames:h}=Object(oe.a)(u),O=Object(ot.a)(n);if(!m||!O)return;const{photo:j,...g}=O,p={content:{webPage:g}};return c.a.createElement("div",{className:Object(ne.a)("WebPagePreview",h)},c.a.createElement("div",null,c.a.createElement(fe.a,{round:!0,color:"translucent",ariaLabel:"Clear Webpage Preview",onClick:()=>{l({chatId:e,threadId:t,noWebPage:!0})}},c.a.createElement("i",{className:"icon-close"})),c.a.createElement(Ha,{message:p,inPreview:!0})))})),an=a(129);var sn=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Re.a)(Ae.a.Extra,"CalendarModal",!t);return a?c.a.createElement(a,e):void 0});var nn=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Re.a)(Ae.a.Extra,"PaymentModal",!t);return a?c.a.createElement(a,e):void 0});var cn,on=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Re.a)(Ae.a.Extra,"ReceiptModal",!t);return a?c.a.createElement(a,e):void 0});a(257);!function(e){e.Send="send",e.Record="record",e.Edit="edit"}(cn||(cn={}));var rn=Object(c.h)(Object(s.h)((e,{chatId:t,threadId:a,messageListType:s})=>{const c=Object(r.g)(e,t),o=c&&Object(r.p)(e,c),i=c?Object(r.O)(e,c):void 0,d=Object(r.P)(e,t),u=i&&Object(r.cb)(e,t),m=Object(r.qb)(e,t),{language:h}=e.settings.byKey,O=e.emojiKeywords[n.j],j=h!==n.j?e.emojiKeywords[h]:void 0,g=u?u.id:void 0,p=g?Object(r.l)(e,t,g):void 0;return{editingMessage:Object(r.E)(e,t,a,s),connectionState:e.connectionState,draft:Object(r.C)(e,t,a),chat:c,isChatWithBot:i,isChatWithSelf:d,canScheduleUntilOnline:!d&&!i&&c&&o&&Object(l.ob)(t)&&o.status&&Boolean(o.status.wasOnline),isRightColumnShown:Object(r.W)(e),isSelectModeActive:Object(r.S)(e),withScheduledButton:a===b.MAIN_THREAD_ID&&"thread"===s&&Boolean(m&&m.length),shouldSchedule:"scheduled"===s,botKeyboardMessageId:g,botKeyboardPlaceholder:p?p.keyboardPlaceholder:void 0,isForwarding:t===e.forwardMessages.toChatId,isPollModalOpen:e.isPollModalOpen,stickersForEmoji:e.stickers.forEmoji.stickers,groupChatMembers:c&&c.fullInfo&&c.fullInfo.members,topInlineBotIds:e.topInlineBots&&e.topInlineBots.userIds,currentUserId:e.currentUserId,usersById:e.users.byId,lastSyncTime:e.lastSyncTime,contentToBeScheduled:e.messages.contentToBeScheduled,isPaymentModalOpen:e.payment.isPaymentModalOpen,isReceiptModalOpen:Boolean(e.payment.receipt),shouldSuggestStickers:e.settings.byKey.shouldSuggestStickers,recentEmojis:e.recentEmojis,baseEmojiKeywords:O?O.keywords:void 0,emojiKeywords:j?j.keywords:void 0,serverTimeOffset:e.serverTimeOffset,inlineBots:e.inlineBots.byUsername,isInlineBotLoading:e.inlineBots.isLoading}},(e,t)=>Object(h.l)(t,["sendMessage","editMessage","saveDraft","clearDraft","showDialog","setStickerSearchQuery","setGifSearchQuery","forwardMessages","openPollModal","closePollModal","closePaymentModal","clearReceipt","loadScheduledHistory","openChat","addRecentEmoji","sendInlineBotResult"]))(({dropAreaState:e,shouldSchedule:t,canScheduleUntilOnline:a,isReady:o,onDropHide:r,editingMessage:i,chatId:d,threadId:u,messageListType:h,draft:O,chat:j,connectionState:g,isChatWithBot:p,isChatWithSelf:I,isRightColumnShown:v,isSelectModeActive:y,isForwarding:C,isPollModalOpen:E,isPaymentModalOpen:w,isReceiptModalOpen:S,botKeyboardMessageId:M,botKeyboardPlaceholder:k,withScheduledButton:N,stickersForEmoji:T,groupChatMembers:P,topInlineBotIds:A,currentUserId:R,usersById:L,lastSyncTime:B,contentToBeScheduled:D,shouldSuggestStickers:F,baseEmojiKeywords:U,emojiKeywords:H,serverTimeOffset:q,recentEmojis:G,inlineBots:_,isInlineBotLoading:z,sendMessage:K,editMessage:$,saveDraft:V,clearDraft:W,showDialog:Q,setStickerSearchQuery:Y,setGifSearchQuery:J,forwardMessages:X,openPollModal:Z,closePollModal:ee,loadScheduledHistory:te,closePaymentModal:ae,openChat:se,clearReceipt:ce,addRecentEmoji:oe,sendInlineBotResult:le})=>{const de=Object(Oe.a)(),ue=Object(c.q)(null),[me,je]=Object(c.r)(""),ge=Object(c.q)(),pe=Object(ga.a)(e),[Ie,ve,ye]=Object(he.a)(),[Ce,Ee]=Object(c.r)(),{width:Se}=Ze.a.get(),Me=Object(c.q)(me);Object(c.n)(()=>{Me.current=me},[me]),Object(c.n)(()=>{ge.current=void 0},[d]),Object(c.n)(()=>{d&&B&&u===b.MAIN_THREAD_ID&&o&&te()},[o,d,te,B,u]),Object(c.o)(()=>{ue.current&&(ue.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>')},[]),Object(c.n)(()=>{D&&(Ee(D),ve())},[D,ve]);const[ke,Ne]=Object(c.r)([]),[Te,Pe,Ae]=Object(he.a)(),[Re,xe,Le]=Object(he.a)(),[Be,De,Fe]=Object(he.a)(),[Ue,He,qe]=Object(he.a)(),[Ge,_e]=Object(he.a)(),[ze,Ke,$e]=Object(he.a)(),{startRecordingVoice:Ve,stopRecordingVoice:We,pauseRecordingVoice:Qe,activeVoiceRecording:Je,currentRecordTime:Xe,recordButtonRef:et,startRecordTimeRef:tt}=(()=>{const e=Object(c.q)(null),[t,a]=Object(c.r)(),s=Object(c.q)(),[n,o]=Object(c.r)();Object(c.n)(()=>{m.e&&m.o&&vs()},[]);const r=Object(c.m)(async()=>{try{const{stop:t,pause:n}=await ys(t=>{e.current&&(s.current&&Date.now()%4==0&&(e.current.style.boxShadow=`0 0 0 ${50*(t||0)}px rgba(0,0,0,.15)`),o(Date.now()))});s.current=Date.now(),o(Date.now()),a({stop:t,pause:n})}catch(e){console.error(e)}},[]),i=Object(c.m)(()=>{if(t){e.current&&(e.current.style.boxShadow="none");try{return t.pause()}catch(e){return void console.error(e)}}},[t]),l=Object(c.m)(()=>{if(t){a(void 0),s.current=void 0,o(void 0),e.current&&(e.current.style.boxShadow="none");try{return t.stop()}catch(e){return void console.error(e)}}},[t]);return Object(c.n)(()=>t?Object(be.a)(l):void 0,[t,l]),{startRecordingVoice:r,pauseRecordingVoice:i,stopRecordingVoice:l,activeVoiceRecording:t,currentRecordTime:n,recordButtonRef:e,startRecordTimeRef:s}})(),at=i?cn.Edit:!m.o||Je||me&&!ke.length||C?cn.Send:cn.Record,st=!t,{isMentionTooltipOpen:nt,mentionFilter:ct,closeMentionTooltip:ot,insertMention:rt,mentionFilteredUsers:it}=Object(Ns.a)(!ke.length,me,je,void 0,P,A,R,L),{isOpen:lt,id:dt,isGallery:bt,switchPm:ut,results:ht,closeTooltip:Ot,help:jt,loadMore:gt}=Rs(Boolean(!ke.length&&B),d,me,_),{isContextMenuOpen:pt,handleContextMenu:ft,handleContextMenuClose:It,handleContextMenuHide:vt}=Object(Dt.a)(et,!(at===cn.Send&&st)),yt=Object(c.p)(()=>Object(l.b)(j,p),[j,p]),Ct=j&&Object(l.jb)(j),Et=Object(l.j)(j),{isStickerTooltipOpen:wt,closeStickerTooltip:St}=function(e,t,a,n=!1){const{loadStickersForEmoji:o,clearStickersForEmoji:r}=Object(s.d)(),i=m.d&&1===Object(Ms.a)(t)||!m.d&&Boolean(t.match(/^<img.[^>]*?>$/g)),l=Boolean(a)&&i;return Object(c.n)(()=>{n||(e&&i?o({emoji:t}):!l&&i||r())},[t,i,r,o,e,n]),{isStickerTooltipOpen:l,closeStickerTooltip:r}}(Boolean(F&&yt.canSendStickers&&!ke.length),me,T,!o),{isEmojiTooltipOpen:Mt,closeEmojiTooltip:kt,filteredEmojis:Nt,insertEmoji:Tt}=Object(ks.a)(Boolean(F&&yt.canSendStickers&&!ke.length),me,G,void 0,je,U,H,!o),Pt=Object(c.m)((e,t=n.z)=>{const a=window.getSelection(),s=document.getElementById(t),c=Object(mt.a)(e,["escape_html","emoji_html","br_html"]).join("").replace(/\u200b+/g,"");if(a.rangeCount){const e=a.getRangeAt(0);if(Object(us.a)(e,t))return function(e){const t=window.getSelection();if(t&&t.getRangeAt&&t.rangeCount){const a=t.getRangeAt(0);a.deleteContents();const s=a.createContextualFragment(e),n=s.lastChild;a.insertNode(s),n?(a.setStartAfter(n),a.setEndAfter(n)):a.collapse(!1),t.removeAllRanges(),t.addRange(a)}}(c),void s.dispatchEvent(new Event("input",{bubbles:!0}))}je(`${Me.current}${c}`),requestAnimationFrame(()=>{Object(ls.a)(s)})},[]),At=Object(c.m)(()=>{const e=window.getSelection();if(e.rangeCount){const t=e.getRangeAt(0);if(Object(us.a)(t,n.z))return void document.execCommand("delete",!1)}je(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 a=t.lastChild;if(a.lastChild)for(;a.lastChild;)a=a.lastChild;const s=a.textContent.length,n=document.createRange(),c=window.getSelection();n.setStart(a,s),n.setEnd(a,s),c.removeAllRanges(),c.addRange(n),document.execCommand("delete",!1);const o=t.innerHTML;return document.body.removeChild(t),o}(Me.current))},[]),Rt=Object(c.m)((e=!1)=>{e||je(""),Ne([]),St(),ye(),Ee(void 0),ot(),kt(),m.l?setTimeout(()=>Fe(),350):Fe()},[St,ye,ot,kt,Fe]),xt=Object(ga.a)(d);Object(c.n)(()=>{xt&&d!==xt&&(We(),Rt())},[d,xt,Rt,We]);const Lt=((e,t,a,s,o,r)=>{Object(c.n)(()=>{a?(t(Es(a.content.text)),requestAnimationFrame(()=>{const e=document.getElementById(n.z);Object(ls.a)(e,!0)})):t("")},[a,t]);return Object(c.m)(()=>{const{text:t,entities:n}=Object(ds.a)(e.current);a&&(t||Object(l.fb)(a)?(r({messageId:a.id,text:t,entities:n}),s()):o())},[r,a,e,o,s])})(Me,je,i,Rt,He,$);((e,t,a,s,o,r,i,l,d)=>{const b=Object(c.m)((e,t)=>{o.current.length&&!i?l({chatId:e,threadId:t,draft:Object(ds.a)(o.current)}):d({chatId:e,threadId:t})},[d,i,o,l]),u=Object(c.p)(()=>Object(f.a)(e=>e(),n.y,!1),[t]),h=Object(ga.a)(t),O=Object(ga.a)(a);Object(c.n)(()=>(ws=t,Ss=a,()=>{ws=void 0,Ss=void 0,b(t,a)}),[t,a,b]),Object(c.n)(()=>{t===h&&a===O||e&&(r(Es(e)),m.n||requestAnimationFrame(()=>{const e=document.getElementById(n.z);Object(ls.a)(e,!0)}))},[t,a,e,r,b,h,O]);const j=Object(ga.a)(s);Object(c.n)(()=>{t&&a&&h===t&&O===a&&j!==s&&(s.length?u(()=>{ws===t&&Ss===a&&b(t,a)}):b(t,a))},[t,s,h,j,O,u,a,b]);const g=Object(c.m)(()=>{t&&a&&b(t,a)},[t,a,b]);Object(re.a)(g),ie(g)})(O,d,u,me,Me,je,i,V,W),((e,t,a)=>{Object(c.n)(()=>{async function s(s){if(!s.clipboardData)return;const c=document.activeElement;if(c&&![n.z,n.A].includes(c.id))return;const{items:o}=s.clipboardData,r=Array.from(o).find(e=>Cs.includes(e.type)),i=r&&r.getAsFile(),l=s.clipboardData.getData("text").substring(0,4096);if(i||l){if(s.preventDefault(),i&&!a){const e=await bs(i.name,i,!0);t(t=>[...t,e])}l&&e(l,c?c.id:void 0)}}return document.addEventListener("paste",s,!1),()=>{document.removeEventListener("paste",s,!1)}},[e,a,t])})(Pt,Ne,i);const Bt=Object(c.m)(async(e,t)=>{Ne(await Promise.all(e.map(e=>bs(e.name,e,t))))},[]),Ft=Object(c.m)(async(e,t)=>{Ne([...ke,...await Promise.all(e.map(e=>bs(e.name,e,t)))])},[ke]),Ut=Object(c.m)(()=>{Ne([])},[]),Ht=Object(c.m)(async(e=!1,t)=>{if("connectionStateReady"!==g)return;let a=ke;if(Je){const e=await We();if(e){const{blob:t,duration:s,waveform:n}=e;a=[await bs("wonderful-voice-message.ogg",t,!1,{voice:{duration:s,waveform:n}})]}}const{text:s,entities:c}=Object(ds.a)(Me.current);if(!a.length&&!s&&!C)return;if(a.length&&s&&s.length>1024){const e=s.length-1024;return void Q({data:{message:"CAPTION_TOO_LONG_PLEASE_REMOVE_CHARACTERS",textParams:{"{EXTRA_CHARS_COUNT}":e,"{PLURAL_S}":e>1?"s":""},hasErrorKey:!0}})}const o=document.getElementById(n.z);if(a.length||s){if(Et&&!Ct){const e=Math.floor(Date.now()/1e3)+q,t=ge.current&&Math.floor(e-ge.current),a=Et.nextSendDate&&Et.nextSendDate>e;if(t&&t<Et.seconds||a){const s=a?Et.nextSendDate-e:Et.seconds-t;return Q({data:{message:de("SlowModeHint",Object(x.e)(s)),isSlowMode:!0,hasErrorKey:!1}}),void o.blur()}}K({text:s,entities:c,attachments:a,scheduledAt:t,isSilent:e})}C&&X(),ge.current=Math.floor(Date.now()/1e3)+q,W({chatId:d,localOnly:!0}),m.e&&o===document.activeElement&&hs(o),requestAnimationFrame(()=>{Rt()})},[g,ke,Je,C,q,W,d,Rt,We,Q,Et,Ct,K,X,de]),qt=Object(c.m)((e,a=!1)=>{e={...e,isPreloadedGlobally:!0},t?(Ee({sticker:e}),ve()):(K({sticker:e}),requestAnimationFrame(()=>{Rt(a)}))},[t,ve,K,Rt]),Gt=Object(c.m)(e=>{t?(Ee({gif:e}),ve()):(K({gif:e}),requestAnimationFrame(()=>{Rt(!0)}))},[t,ve,K,Rt]),_t=Object(c.m)(e=>{if("connectionStateReady"!==g)return;le({id:e.id,queryId:e.queryId});const t=document.getElementById(n.z);m.e&&t===document.activeElement&&hs(t),W({chatId:d,localOnly:!0}),requestAnimationFrame(()=>{Rt()})},[d,W,g,Rt,le]),zt=Object(c.m)(e=>{t?(Ee({poll:e}),ee(),ve()):(K({poll:e}),ee())},[ee,ve,K,t]),Kt=Object(c.m)(()=>{t?(Ee({isSilent:!0}),ve()):Ht(!0)},[Ht,ve,t]),$t=Object(c.m)((e,t=!1)=>{const{isSilent:a,...s}=Ce||{},n=Math.round(Math.max(e.getTime(),Date.now()+6e4)/1e3)+(t?0:q);Ce&&0!==Object.keys(s).length?(K({...Ce,scheduledAt:n}),requestAnimationFrame(()=>{Rt()})):Ht(!!a,n),ye()},[ye,Ht,Rt,Ce,K,q]),Vt=Object(c.m)(()=>{$t(new Date(1e3*n.xb),!0)},[$t]),Wt=Object(c.m)(()=>{ye(),Ee(void 0)},[ye]),Qt=Object(c.m)(e=>{"stickers"===e?(Y({query:""}),J({query:void 0})):(J({query:""}),Y({query:void 0}))},[Y,J]),Yt=Object(c.m)(()=>{const e=document.getElementById(n.z);m.l&&e===document.activeElement?(e.blur(),setTimeout(()=>{De()},100)):De()},[De]),Jt=Object(c.m)(()=>{se({id:d,threadId:u,type:"scheduled"})},[se,d,u]);Object(c.n)(()=>{v&&m.l&&Fe()},[v,Fe]),Object(c.n)(()=>{o&&(y?Ke():setTimeout(()=>{$e()},200))},[y,$e,Ke,o]);const Xt=Object(c.m)(()=>{switch(at){case cn.Send:t?(Je&&Qe(),ve()):(Ht(),requestAnimationFrame(()=>{Rt()}));break;case cn.Record:Ve();break;case cn.Edit:Lt()}},[at,Rt,t,Ve,Lt,Je,ve,Qe,Ht]),Zt=at===cn.Record&&!yt.canAttachMedia,ea=Object(ga.a)(i,!0),ta=i||ea,aa=new Date;aa.setSeconds(0),aa.setMilliseconds(0);const sa=new Date;sa.setFullYear(sa.getFullYear()+1);let na="SendMessage";switch(at){case cn.Edit:na="Save edited message";break;case cn.Record:na=Zt?"Conversation.DefaultRestrictedMedia":"AccDescrVoiceMessage"}const ca=Object(ne.a)("Composer",!y&&"shown",ze&&"hover-disabled"),oa=Object(ne.a)("mobile-symbol-menu-button",!o&&"not-ready",Ge?Be&&"menu-opened":Be&&"is-loading"),ra=at===cn.Edit?Lt:t?ve:Ht;return c.a.createElement("div",{className:ca},yt.canAttachMedia&&o&&c.a.createElement(an.a,{containerId:"#middle-column-portals"},c.a.createElement(Zs,{isOpen:e!==Ye.a.None,withQuick:[e,pe].includes(Ye.a.QuickFile),onHide:r,onFileSelect:Bt})),c.a.createElement(Js,{attachments:ke,caption:ke.length?me:"",groupChatMembers:P,currentUserId:R,usersById:L,recentEmojis:G,isReady:o,onCaptionUpdate:je,baseEmojiKeywords:U,emojiKeywords:H,addRecentEmoji:oe,onSend:t?ve:Ht,onFileAppend:Ft,onClear:Ut}),c.a.createElement(Xs,{isOpen:Boolean(E),onClear:ee,onSend:zt}),c.a.createElement(nn,{isOpen:Boolean(w),onClose:ae}),c.a.createElement(on,{isOpen:Boolean(S),onClose:ce}),ta&&c.a.createElement(xs,{isOpen:Ue,isSchedule:"scheduled"===h,onClose:qe,message:ta}),c.a.createElement(Gs,{isOpen:nt,filter:ct,onClose:ot,onInsertUserName:rt,filteredUsers:it,usersById:L}),c.a.createElement(qs,{isOpen:lt,botId:dt,allowedAttachmentOptions:yt,isGallery:bt,inlineBotResults:ht,switchPm:ut,onSelectResult:_t,loadMore:gt,onClose:Ot}),c.a.createElement("div",{id:"message-compose"},c.a.createElement("div",{className:"svg-appendix",ref:ue}),c.a.createElement(Ys,null),c.a.createElement(tn,{chatId:d,threadId:u,messageText:ke.length?"":me,disabled:!yt.canAttachEmbedLinks}),c.a.createElement("div",{className:"message-input-wrapper"},m.l?c.a.createElement(fe.a,{className:oa,round:!0,faded:!0,color:"translucent",onClick:Be?Fe:Yt,ariaLabel:"Choose emoji, sticker or GIF"},c.a.createElement("i",{className:"icon-smile"}),c.a.createElement("i",{className:"icon-keyboard"}),Be&&!Ge&&c.a.createElement(we.a,{color:"gray"})):c.a.createElement(Fs,{className:""+(Be?"activated":""),round:!0,faded:!0,color:"translucent",onActivate:De,ariaLabel:"Choose emoji, sticker or GIF"},c.a.createElement("i",{className:"icon-smile"})),c.a.createElement(Ws.a,{id:"message-input-text",html:ke.length?"":me,placeholder:Je&&Se<=600?"":k||de("Message"),forcedPlaceholder:jt,shouldSetFocus:Be,shouldSuppressFocus:m.l&&Be,shouldSuppressTextFormatter:Mt||nt||lt,onUpdate:je,onSend:ra,onSuppressedFocus:Fe}),z&&Boolean(dt)&&c.a.createElement(we.a,{color:"gray"}),N&&c.a.createElement(fe.a,{round:!0,faded:!0,className:"scheduled-button",color:"translucent",onClick:Jt,ariaLabel:"Open scheduled messages"},c.a.createElement("i",{className:"icon-schedule"})),M&&!Je&&!i&&c.a.createElement(Fs,{className:""+(Te?"activated":""),round:!0,faded:!0,color:"translucent",onActivate:Pe,ariaLabel:"Open bot command keyboard"},c.a.createElement("i",{className:"icon-bot-command"})),!Je&&!i&&c.a.createElement(Fs,{className:""+(Re?"activated":""),round:!0,faded:!0,color:"translucent",onActivate:xe,ariaLabel:"Add an attachment"},c.a.createElement("i",{className:"icon-attach"})),Je&&Xe&&c.a.createElement("span",{className:"recording-state"},Object(x.i)(Xe-tt.current)),c.a.createElement(zs,{isOpen:wt,onStickerSelect:qt}),c.a.createElement(Ks.a,{isOpen:Mt,emojis:Nt,onClose:kt,onEmojiSelect:Tt,addRecentEmoji:oe}),c.a.createElement(Us,{isOpen:Re,allowedAttachmentOptions:yt,onFileSelect:Bt,onPollCreate:Z,onClose:Le}),M&&c.a.createElement(Vs,{messageId:M,isOpen:Te,onClose:Ae}),c.a.createElement(Hs,{isOpen:Be,allowedAttachmentOptions:yt,onLoad:_e,onClose:Fe,onEmojiSelect:Pt,onStickerSelect:qt,onGifSelect:Gt,onRemoveSymbol:At,onSearchOpen:Qt,addRecentEmoji:oe}))),Je&&c.a.createElement(fe.a,{round:!0,color:"danger",className:"cancel",onClick:We,ariaLabel:"Cancel voice recording"},c.a.createElement("i",{className:"icon-delete"})),c.a.createElement(fe.a,{ref:et,round:!0,color:"secondary",className:Object(ne.a)(at,!o&&"not-ready",Je&&"recording"),disabled:Zt,ariaLabel:de(na),onClick:Xt,onContextMenu:at===cn.Send&&st?ft:void 0},c.a.createElement("i",{className:"icon-send"}),c.a.createElement("i",{className:"icon-microphone-alt"}),c.a.createElement("i",{className:"icon-check"})),st&&c.a.createElement(_s,{isOpen:pt,onSilentSend:I?void 0:Kt,onScheduleSend:t?void 0:ve,onClose:It,onCloseAnimationEnd:vt}),c.a.createElement(sn,{isOpen:Ie,withTimePicker:!0,selectedAt:aa.getTime(),maxAt:Object(x.k)(sa),isFutureMode:!0,secondButtonLabel:a?"Send When Online":void 0,onClose:Wt,onSubmit:$t,onSecondButtonClick:a?Vt:void 0}))}));var ln=Object(c.h)(e=>{const{isActive:t}=e,a=Object(Re.a)(Ae.a.Extra,"MobileSearch",!t,!0);return a?c.a.createElement(a,e):void 0});var dn=Object(c.h)(e=>{const{isActive:t}=e,a=Object(Re.a)(Ae.a.Extra,"MessageSelectToolbar",!t);return a?c.a.createElement(a,e):void 0});var bn=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Re.a)(Ae.a.Extra,"UnpinAllMessagesModal",!t);return a?c.a.createElement(a,e):void 0});a(258);const un=m.l?450+n.c:void 0;function mn(e){return"file"===e.kind&&e.type&&n.n.has(e.type)}var hn=Object(c.h)(Object(s.h)(e=>{const t=Object(r.Eb)(e),{isBlurred:a,background:s,backgroundColor:n,patternColor:c}=e.settings.themes[t]||{},{messageLists:o}=e.messages,i=Object(r.z)(e),{isLeftColumnShown:d,chats:{listIds:u}}=e,h={theme:t,customBackground:s,backgroundColor:n,patternColor:c,isLeftColumnShown:d,isRightColumnShown:Object(r.W)(e),isBackgroundBlurred:a,isMobileSearchActive:Boolean(m.l&&Object(r.B)(e)),isSelectModeActive:Object(r.S)(e),animationLevel:e.settings.byKey.animationLevel,currentTransitionKey:Math.max(0,e.messages.messageLists.length-1)};if(!i||!u.active)return h;const{chatId:O,threadId:j,type:g}=i,p=Object(r.g)(e,O),f=Object(r.kb)(e,O),{chatId:I,messageId:v}=e.audioPlayer,y=p&&Object(l.d)(p,j),C=Object(r.L)(e,O),E="pinned"===g,w="scheduled"===g;return{...h,chatId:O,threadId:j,messageListType:g,isPrivate:Object(l.ob)(O),canPost:!E&&(!p||y)&&!C,isPinnedMessageList:E,isScheduledMessageList:w,currentUserBannedRights:p&&p.currentUserBannedRights,defaultBannedRights:p&&p.defaultBannedRights,hasPinnedOrAudioMessage:j!==b.MAIN_THREAD_ID||Boolean(f&&f.length)||Boolean(I&&v),pinnedMessagesCount:f?f.length:0,shouldSkipHistoryAnimations:e.shouldSkipHistoryAnimations,messageLists:o}},(e,t)=>Object(h.l)(t,["openChat","unpinAllMessages","loadUser","closeLocalTextSearch","exitMessageSelectMode"]))(({chatId:e,threadId:t,messageListType:a,isPrivate:s,isPinnedMessageList:o,messageLists:r,canPost:i,currentUserBannedRights:d,defaultBannedRights:b,hasPinnedOrAudioMessage:u,pinnedMessagesCount:h,customBackground:O,theme:j,backgroundColor:g,patternColor:p,isLeftColumnShown:f,isRightColumnShown:I,isBackgroundBlurred:v,isMobileSearchActive:y,isSelectModeActive:C,animationLevel:E,shouldSkipHistoryAnimations:w,currentTransitionKey:S,openChat:M,unpinAllMessages:k,loadUser:N,closeLocalTextSearch:T,exitMessageSelectMode:P})=>{const{width:A}=et(),R=Object(Oe.a)(),[x,L]=Object(c.r)(Ye.a.None),[B,D]=Object(c.r)(),[F,U]=Object(c.r)(),[H,q]=Object(c.r)(!1),[G,_]=Object(c.r)(!m.l||E===n.f),z=u&&(A<n.ob||I&&A>n.lb&&A<n.wb||A>=n.kb&&A<n.vb),K=Object(tt.a)(e,un),$=Object(tt.a)(t,un),V=Object(tt.a)(a,un),W=Object(tt.a)(i,un),Q=Object(tt.a)(z,un),Y=Object(tt.a)(B,un);Object(c.n)(()=>e?Object(be.a)(()=>{M({id:void 0})}):void 0,[e,M]),Object(c.n)(()=>{L(Ye.a.None),D(void 0),U(void 0)},[e]),Object(c.n)(()=>{E===n.f&&_(!0)},[E]);Object(c.n)(()=>{s&&N({userId:e})},[e,s,N]);const J=Object(c.m)(e=>{if(m.n)return;const{items:t}=e.dataTransfer||{},a=t&&Array.from(t).filter(e=>"text/uri-list"!==e.type).every(mn);L(a?Ye.a.QuickFile:Ye.a.Document)},[]),X=Object(c.m)(()=>{L(Ye.a.None)},[]),Z=Object(c.m)(()=>{q(!0)},[]),ee=Object(c.m)(()=>{q(!1)},[]),te=Object(c.m)(()=>{k({chatId:e}),ee(),M({id:e})},[k,M,ee,e]),ae=Object(c.m)(()=>{M({id:e})},[M,e]),se=((e,t)=>{const[a,s]=Object(c.r)(t);return Object(c.n)(()=>{t&&(t.startsWith("#")?s(t):Je.c(n.o,e,Je.a.Blob).then(e=>{const t=URL.createObjectURL(e);Object(Xe.g)(t).then(()=>{s(`url(${t})`)})}))},[t,e]),t?a:void 0})(j,O),ce=Object(ne.a)(Q&&"has-header-tools",O&&"custom-bg-image",g&&"custom-bg-color",O&&v&&"blurred",m.q?"mask-image-disabled":"mask-image-enabled"),oe=Object(ne.a)("messaging-disabled",!C&&"shown"),re=Object(l.L)(R,d,b),{composerHiddenScale:ie,toolbarHiddenScale:le,composerTranslateX:ue,toolbarTranslateX:he,unpinHiddenScale:je,toolbarForUnpinHiddenScale:ge}=Object(c.p)(()=>at(A,W),[W,A]),pe=Object(ne.a)("middle-column-footer",!W&&"no-composer",W&&F&&!C&&"with-notch");return Object(de.b)(K&&$,()=>{M({id:void 0},!0)},void 0,void 0,void 0,r?r.map(st):[]),Object(de.b)(y,T),Object(de.b)(C,P),c.a.createElement("div",{id:"MiddleColumn",className:ce,onTransitionEnd:t=>{"transform"===t.propertyName&&t.target===t.currentTarget&&_(Boolean(e))},style:`\n --composer-hidden-scale: ${ie};\n --toolbar-hidden-scale: ${le};\n --unpin-hidden-scale: ${je};\n --toolbar-unpin-hidden-scale: ${ge};\n --composer-translate-x: ${ue}px;\n --toolbar-translate-x: ${he}px;\n --pattern-color: ${p};\n --theme-background-color:\n ${g||("dark"===j?n.p:n.R)};\n `,onClick:m.m&&f?ae:void 0},c.a.createElement("div",{id:"middle-column-bg",style:se?"--custom-background: "+se:void 0}),c.a.createElement("div",{id:"middle-column-portals"}),K&&$&&c.a.createElement(c.a.Fragment,null,c.a.createElement("div",{className:"messages-layout",onDragEnter:W?J:void 0},c.a.createElement(wt,{chatId:K,threadId:$,messageListType:V,isReady:G}),c.a.createElement(me.a,{name:w?"none":E===n.e?"slide":"fade",activeKey:S,shouldCleanup:!0},()=>c.a.createElement(c.a.Fragment,null,c.a.createElement(rs,{key:`${K}-${$}-${V}`,chatId:K,threadId:$,type:V,canPost:W,hasTools:Q,onFabToggle:D,onNotchToggle:U,isReady:G}),c.a.createElement("div",{className:pe},W&&c.a.createElement(rn,{chatId:K,threadId:$,messageListType:V,dropAreaState:x,onDropHide:X,isReady:G}),o&&c.a.createElement("div",{className:"unpin-button-container",dir:R.isRtl?"rtl":void 0},c.a.createElement(fe.a,{size:"tiny",fluid:!0,color:"secondary",className:"unpin-all-button",onClick:Z},c.a.createElement("i",{className:"icon-unpin"}),c.a.createElement("span",null,R("Chat.Pinned.UnpinAll",h,"i")))),!o&&!W&&re&&c.a.createElement("div",{className:oe},c.a.createElement("div",{className:"messaging-disabled-inner"},c.a.createElement("span",null,re))),c.a.createElement(dn,{messageListType:V,isActive:C,canPost:W})))),c.a.createElement(is,{isShown:Y,canPost:W})),m.l&&c.a.createElement(ln,{isActive:Boolean(y)})),e&&c.a.createElement(bn,{isOpen:H,chatId:e,pinnedMessagesCount:h,onClose:ee,onUnpin:te}))}));a(259);const On=Object(f.a)(e=>e(),200,!1);var jn;!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"}(jn||(jn={}));var gn=Object(c.h)(Object(s.h)((e,{chatId:t,isProfile:a,isManagement:s})=>{const{query:n}=Object(r.B)(e)||{},{query:c}=Object(r.A)(e)||{},{query:o}=Object(r.t)(e)||{},i=t?Object(r.g)(e,t):void 0,d=i&&Object(l.mb)(i);return{canManage:Boolean(!s&&a&&i&&!Object(r.P)(e,i.id)&&(Object(l.ob)(i.id)||(Object(l.jb)(i)||i.isCreator)&&!i.isNotJoined)),isChannel:d,messageSearchQuery:n,stickerSearchQuery:c,gifSearchQuery:o}},(e,t)=>Object(h.l)(t,["setLocalTextSearchQuery","setStickerSearchQuery","setGifSearchQuery","searchTextMessagesLocal","toggleManagement","openHistoryCalendar"]))(({isColumnOpen:e,isProfile:t,isSearch:a,isManagement:s,isStickerSearch:n,isGifSearch:o,isPollResults:r,isAddingChatMembers:i,profileState:l,managementScreen:d,canManage:b,isChannel:h,onClose:O,messageSearchQuery:j,stickerSearchQuery:g,gifSearchQuery:p,setLocalTextSearchQuery:f,setStickerSearchQuery:I,setGifSearchQuery:v,searchTextMessagesLocal:y,toggleManagement:C,openHistoryCalendar:E,shouldSkipAnimation:w})=>{var S;const M=Object(c.q)(null),k=Object(c.m)(e=>{f({query:e}),e.length&&On(y)},[y,f]),N=Object(c.m)(e=>{I({query:e})},[I]),T=Object(c.m)(e=>{v({query:e})},[v]),[P,A]=Object(c.r)(!e);Object(c.n)(()=>{setTimeout(()=>{A(!e)},300)},[e]);const R=Object(Oe.a)(),L=t?l===u.l.Profile?jn.Profile:l===u.l.SharedMedia?jn.SharedMedia:l===u.l.MemberList?jn.MemberList:-1:a?jn.Search:r?jn.PollResults:n?jn.StickerSearch:o?jn.GifSearch:i?jn.AddingMembers:s?d===u.g.Initial?jn.ManageInitial:d===u.g.ChatPrivacyType?jn.ManageChatPrivacyType:d===u.g.Discussion?jn.ManageDiscussion:d===u.g.ChannelSubscribers?jn.ManageChannelSubscribers:d===u.g.GroupPermissions?jn.ManageGroupPermissions:d===u.g.ChatAdministrators?jn.ManageChatAdministrators:d===u.g.GroupRemovedUsers?jn.ManageGroupRemovedUsers:d===u.g.GroupUserPermissionsCreate?jn.ManageGroupUserPermissionsCreate:d===u.g.GroupUserPermissions?jn.ManageGroupUserPermissions:d===u.g.GroupRecentActions?jn.ManageGroupRecentActions:d===u.g.ChatAdminRights?jn.ManageGroupAdminRights:d===u.g.GroupMembers?jn.ManageGroupMembers:void 0:void 0,B=null!==(S=Object(ot.a)(L,!0))&&void 0!==S?S:-1;function D(){if(-1!==B)switch(B){case jn.PollResults:return c.a.createElement("h3",null,R("PollResults"));case jn.Search:return c.a.createElement(c.a.Fragment,null,c.a.createElement(Ie.a,{parentContainerClassName:"RightSearch",value:j,onChange:k}),c.a.createElement(fe.a,{round:!0,size:"smaller",color:"translucent",onClick:()=>E({selectedAt:Object(x.k)(Date.now())}),ariaLabel:"Search messages by date"},c.a.createElement("i",{className:"icon-calendar"})));case jn.AddingMembers:return c.a.createElement("h3",null,R("GroupAddMembers"));case jn.ManageInitial:return c.a.createElement("h3",null,R("Edit"));case jn.ManageChatPrivacyType:return c.a.createElement("h3",null,R(h?"ChannelTypeHeader":"GroupTypeHeader"));case jn.ManageDiscussion:return c.a.createElement("h3",null,R("Discussion"));case jn.ManageChatAdministrators:return c.a.createElement("h3",null,R("ChannelAdministrators"));case jn.ManageGroupRecentActions:return c.a.createElement("h3",null,R("Group.Info.AdminLog"));case jn.ManageGroupAdminRights:return c.a.createElement("h3",null,R("EditAdminRights"));case jn.ManageGroupPermissions:return c.a.createElement("h3",null,R("ChannelPermissions"));case jn.ManageGroupRemovedUsers:return c.a.createElement("h3",null,R("ChannelBlockedUsers"));case jn.ManageGroupUserPermissionsCreate:return c.a.createElement("h3",null,R("ChannelAddException"));case jn.ManageGroupUserPermissions:return c.a.createElement("h3",null,R("UserRestrictions"));case jn.StickerSearch:return c.a.createElement(Ie.a,{value:g,placeholder:R("SearchStickersHint"),onChange:N});case jn.GifSearch:return c.a.createElement(Ie.a,{value:p,placeholder:R("SearchGifsTitle"),onChange:T});case jn.SharedMedia:return c.a.createElement("h3",null,R("SharedMedia"));case jn.ManageChannelSubscribers:return c.a.createElement("h3",null,R("ChannelSubscribers"));case jn.MemberList:case jn.ManageGroupMembers:return c.a.createElement("h3",null,R("GroupMembers"));default:return c.a.createElement(c.a.Fragment,null,c.a.createElement("h3",null,"Profile"),c.a.createElement("section",{className:"tools"},b&&c.a.createElement(fe.a,{round:!0,color:"translucent",size:"smaller",ariaLabel:R("Edit"),onClick:C},c.a.createElement("i",{className:"icon-edit"}))))}}const F=m.l||L===jn.SharedMedia||L===jn.MemberList||L===jn.AddingMembers||s,U=Object(ne.a)("animated-close-icon",(P||w)&&"no-transition");return Object(c.n)(()=>{M.current.classList.toggle("state-back",F)},[F]),c.a.createElement("div",{className:"RightHeader"},c.a.createElement(fe.a,{className:"close-button",round:!0,color:"translucent",size:"smaller",onClick:O,ariaLabel:R(F?"Common.Back":"Common.Close")},c.a.createElement("div",{ref:M,className:U})),c.a.createElement(me.a,{name:P||w?"none":"slide-fade",activeKey:B},D))})),pn=a(134);function fn(e,t,a,s,o,r,i,d,b,u,m,h=0){const O="members"!==s&&o?o:s,j=Object(c.p)(()=>{if(r&&i)return Object(l.Kb)(r.map(({userId:e})=>e),i,void 0,h)},[r,h,i]),[g,p,f]=function(e,t,a,s){const[c,o]=Object(pn.a)(a?t:void 0,s,void 0,n.cb),r=!c||!s||c[0]===s[0];return[c,o,!r]}(0,t,m,j),[I,v,y]=In("media",O,a,m,d,b),[C,E,w]=In("documents",O,a,m,d,b),[S,M,k]=In("links",O,a,m,d,b),[N,T,P]=In("audio",O,a,m,d,b);let A,R,x=!1;switch(O){case"members":A=g,R=p,x=f;break;case"media":A=I,R=v,x=y;break;case"documents":A=C,R=E,x=w;break;case"links":A=S,R=M,x=k;break;case"audio":A=N,R=T,x=P}return[O,A,R,x]}function In(e,t,a,s,o,r){const i=Object(c.q)();Object(le.a)(()=>{t===e&&o&&r&&(i.current=Object(l.w)(o,r,e).reverse())},[o,r,t,e]);const[d,b]=Object(pn.a)(s?a:void 0,i.current,void 0,"media"===e?n.Ab:n.ib);return[d,b,!(!d||!i.current||d[0]===i.current[0])]}const vn=Object(f.h)(e=>e(),250,!1);let yn=!1;var Cn=a(116),En=a(109);var wn=a(139),Sn=a(202);a(260);var Mn=Object(c.h)(({chat:e,user:t,photo:a,isFirstPhoto:s,isSavedMessages:n,lastSyncTime:o,onClick:r})=>{const i=Object(Oe.a)(),d=t&&Object(l.sb)(t);function u(s="big",c){if(a&&!c)return`photo${a.id}?size=c`;let o;return n||d||(t?o=Object(l.e)(t,s):e&&(o=Object(l.e)(e,s))),o}const m=u(),h=Object(ht.a)(m,!1,b.ApiMediaFormat.BlobUrl,o),O=Object(ht.a)(!h&&s?u("normal",!0):void 0,!1,b.ApiMediaFormat.BlobUrl,o),j=Object(Sn.a)(!h&&a&&a.thumbnail&&a.thumbnail.dataUri),g=h||O||j,p=Object(ga.a)(g);let f="";if(n)f=c.a.createElement("i",{className:"icon-avatar-saved-messages"});else if(d)f=c.a.createElement("i",{className:"icon-avatar-deleted-account"});else if(g)f=c.a.createElement("img",{src:g,className:"avatar-media",alt:"",decoding:"async"});else if(!g&&t){const e=Object(l.bb)(t);f=e?Object(rt.c)(e,2):void 0}else if(!g&&e){const t=Object(l.k)(i,e);f=t&&Object(rt.c)(t,Object(l.ob)(e.id)?2:1)}else f=c.a.createElement("div",{className:"spinner-wrapper"},c.a.createElement(we.a,{color:"white"}));const I=Object(ne.a)("ProfilePhoto","color-bg-"+Object(l.Z)(t||e),n&&"saved-messages",d&&"deleted-account",!n&&!g&&"no-photo");return c.a.createElement("div",{className:I,onClick:g?r:void 0},p&&g&&p!==g&&c.a.createElement("img",{src:p,className:"prev-avatar-media",alt:"",decoding:"async"}),"string"==typeof f?Object(mt.a)(f,["hq_emoji"]):f)});a(261);var kn=Object(c.h)(Object(s.h)((e,{userId:t,forceShowSelf:a})=>{const{lastSyncTime:s,serverTimeOffset:n}=e,c=Object(r.Kb)(e,t),o=Object(r.g)(e,t),i=!a&&c&&c.isSelf,{animationLevel:l}=e.settings.byKey;return{lastSyncTime:s,user:c,chat:o,isSavedMessages:i,animationLevel:l,serverTimeOffset:n}},(e,t)=>Object(h.l)(t,["loadFullUser","openMediaViewer"]))(({user:e,chat:t,isSavedMessages:a,lastSyncTime:s,animationLevel:n,loadFullUser:o,openMediaViewer:r,serverTimeOffset:i})=>{const{id:d}=e||{},{id:h}=t||{},O=e?Object(l.bb)(e):t?t.title:"",j=(e?e.photos:t?t.photos:void 0)||[],g=n>=1?"slide":"none",[p,f]=Object(c.r)(0),I=a||j.length<=1||0===p,v=a||j.length<=1||p===j.length-1;Object(c.n)(()=>{p>j.length&&f(Math.max(0,j.length-1))},[p,j.length]);const y=Object(Oe.a)();Object(c.n)(()=>{s&&d&&o({userId:d})},[d,o,s]),function(e,t,a){Object(c.n)(()=>{t.slice(a,a+4).forEach(e=>{yt.c(`photo${e.id}?size=c`)||yt.b(`photo${e.id}?size=c`,b.ApiMediaFormat.BlobUrl)})},[a,t])}(0,j,p);const C=Object(c.m)(()=>{r({avatarOwnerId:d||h,profilePhotoIndex:p,origin:u.h.ProfileAvatar})},[r,d,h,p]),E=Object(c.m)(()=>{I||f(p-1)},[p,I]),w=Object(c.m)(()=>{v||f(p+1)},[p,v]);if(Object(c.n)(()=>{const e=document.querySelector(".photo-wrapper");if(e)return Object(Me.b)(e,{onSwipe:m.n?(e,t)=>{t===Me.a.Right?E():t===Me.a.Left&&w()}:void 0})},[w,E]),!e&&!t)return;function S(){const s=!a&&j&&j.length>0?j[p]:void 0;return c.a.createElement(Mn,{key:p,user:e,chat:t,photo:s,isSavedMessages:a,isFirstPhoto:I,onClick:C})}const M=e&&e.isVerified||t&&t.isVerified;return c.a.createElement("div",{className:"ProfileInfo",dir:y.isRtl?"rtl":void 0},c.a.createElement("div",{className:"photo-wrapper"},function(){if(!(a||!j||j.length<=1))return c.a.createElement("div",{className:"photo-dashes"},j.map((e,t)=>c.a.createElement("span",{className:"photo-dash "+(t===p?"current":"")})))}(),c.a.createElement(me.a,{activeKey:p,name:g,className:"profile-slide-container"},S),!I&&c.a.createElement("button",{type:"button",className:"navigation prev","aria-label":y("AccDescrPrevious"),onClick:E}),!v&&c.a.createElement("button",{type:"button",className:"navigation next","aria-label":y("Next"),onClick:w})),c.a.createElement("div",{className:"info",dir:y.isRtl?"rtl":"auto"},a?c.a.createElement("div",{className:"title"},c.a.createElement("h3",{dir:"auto"},y("SavedMessages"))):c.a.createElement("div",{className:"title"},c.a.createElement("h3",{dir:"auto"},O&&Object(mt.a)(O)),M&&c.a.createElement(wn.a,null)),!a&&(e?c.a.createElement("div",{className:"status "+(Object(l.Cb)(e)?"online":"")},c.a.createElement("span",{className:"user-status",dir:"auto"},Object(l.cb)(y,e,i))):c.a.createElement("span",{className:"status",dir:"auto"},Object(l.mb)(t)?y("Subscribers",t.membersCount,"i"):y("Members",t.membersCount,"i")))))})),Nn=a(173);var Tn=Object(c.h)(Object(s.h)((e,{chatOrUserId:t})=>{const{lastSyncTime:a}=e,s=t?Object(r.g)(e,t):void 0,n=Object(l.ob)(t)?Object(r.Kb)(e,t):void 0,c=s&&Object(l.Hb)(s,Object(r.fb)(e),Object(r.eb)(e));return{lastSyncTime:a,chat:s,user:n,canInviteUsers:s&&!n&&(!Object(l.mb)(s)&&!Object(l.Db)(s,"inviteUsers")||Object(l.p)(s,"inviteUsers")),isMuted:c}},(e,t)=>Object(h.l)(t,["loadFullUser","updateChatMutedState","showNotification"]))(({lastSyncTime:e,user:t,chat:a,forceShowSelf:s,canInviteUsers:n,isMuted:o,loadFullUser:r,showNotification:i,updateChatMutedState:d})=>{const{id:b,fullInfo:u,username:m,phoneNumber:h,isSelf:O}=t||{},{id:j}=a||{},g=Object(Oe.a)();Object(c.n)(()=>{e&&b&&r({userId:b})},[r,b,e]);const p=Object(c.m)(()=>{d({chatId:j,isMuted:!o})},[j,o,d]);if(!a||a.isRestricted||O&&!s)return;function f(e,t){Object(Nn.c)(e),i({message:t+" was copied"})}const I=h&&Object(Na.c)(h),v=Object(l.g)(a),y=u&&u.bio||Object(l.f)(a);return c.a.createElement("div",{className:"ChatExtra"},I&&!!I.length&&c.a.createElement(En.a,{icon:"phone",multiline:!0,narrow:!0,ripple:!0,onClick:()=>f(I,g("Phone"))},c.a.createElement("span",{className:"title",dir:"auto"},I),c.a.createElement("span",{className:"subtitle"},g("Phone"))),m&&c.a.createElement(En.a,{icon:"mention",multiline:!0,narrow:!0,ripple:!0,onClick:()=>f("@"+m,g("Username"))},c.a.createElement("span",{className:"title",dir:"auto"},Object(mt.a)(m)),c.a.createElement("span",{className:"subtitle"},g("Username"))),y&&!!y.length&&c.a.createElement(En.a,{icon:"info",multiline:!0,narrow:!0,isStatic:!0},c.a.createElement("span",{className:"title",dir:"auto"},Object(mt.a)(y,["br","links","emoji"])),c.a.createElement("span",{className:"subtitle"},g(b?"UserBio":"Info"))),(n||!m)&&v&&c.a.createElement(En.a,{icon:"mention",multiline:!0,narrow:!0,ripple:!0,onClick:()=>f(v,g("SetUrlPlaceholder"))},c.a.createElement("div",{className:"title"},v),c.a.createElement("span",{className:"subtitle"},g("SetUrlPlaceholder"))),c.a.createElement(En.a,{icon:"unmute",ripple:!0,onClick:p},c.a.createElement("span",null,g("Notifications")),c.a.createElement(ye,{id:"group-notifications",label:b?"Toggle User Notifications":"Toggle Chat Notifications",checked:!o,inactive:!0})))})),Pn=a(174),An=a(196),Rn=a(122),xn=a(117),Ln=a(113);var Bn=Object(c.h)(Object(s.h)((e,{userId:t})=>{const a=Object(r.s)(e),s=t&&Object(r.Kb)(e,t);return{chat:a,contactName:s?Object(l.ab)(s):void 0}},(e,t)=>Object(h.l)(t,["deleteChatMember"]))(({isOpen:e,chat:t,userId:a,contactName:s,onClose:n,deleteChatMember:o})=>{const r=Object(Oe.a)(),i=Object(c.m)(()=>{o({chatId:t.id,userId:a}),n()},[t,o,n,a]);if(t&&a)return c.a.createElement(Ln.a,{isOpen:e,onClose:n,onEnter:i,className:"delete",title:r("GroupRemoved.Remove")},c.a.createElement("p",null,Object(mt.a)(r("PeerInfo.Confirm.RemovePeer",s))),c.a.createElement(fe.a,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:i},r("lng_box_remove")),c.a.createElement(fe.a,{className:"confirm-dialog-button",isText:!0,onClick:n},r("Cancel")))}));a(266);const Dn=[{type:"media",title:"SharedMediaTab2"},{type:"documents",title:"SharedFilesTab2"},{type:"links",title:"SharedLinksTab2"},{type:"audio",title:"SharedMusicTab2"}];function Fn(e){return[`.shared-media-transition > div:only-child > .${e}-list > .scroll-item`,`.shared-media-transition > div.active > .${e}-list > .scroll-item`].join(", ")}var Un=Object(c.h)(Object(s.h)((e,{chatId:t,userId:a})=>{const s=Object(r.g)(e,t),n=Object(r.n)(e,a||t),{currentType:c,resultsByType:o}=Object(r.w)(e)||{},{foundIds:i}=o&&c&&o[c]||{},{byId:d}=e.users,b=s&&Object(l.nb)(s),u=s&&Object(l.mb)(s),m=b||u&&Object(l.jb)(s),h=s&&s.fullInfo&&s.fullInfo.members,O=m&&s&&s.fullInfo&&!s.fullInfo.canViewMembers,j=m&&s&&(Object(l.p)(s,"inviteUsers")||s.isCreator),g=m&&s&&(Object(l.p)(s,"banUsers")||s.isCreator);let p;return a?p=a:Object(l.ob)(t)&&(p=t),{theme:Object(r.Eb)(e),isChannel:u,resolvedUserId:p,chatMessages:n,foundIds:i,mediaSearchType:c,hasMembersTab:m,areMembersHidden:O,canAddMembers:j,canDeleteMembers:g,currentUserId:e.currentUserId,isRightColumnShown:Object(r.W)(e),isRestricted:s&&s.isRestricted,lastSyncTime:e.lastSyncTime,serverTimeOffset:e.serverTimeOffset,...m&&h&&{members:h,usersById:d}}},(e,t)=>Object(h.l)(t,["setLocalMediaSearchType","loadMoreMembers","searchMediaMessagesLocal","openMediaViewer","openAudioPlayer","openUserInfo","focusMessage","loadProfilePhotos","setNewChatMembersDialogState"]))(({chatId:e,profileState:t,onProfileStateChange:a,theme:s,isChannel:o,resolvedUserId:r,currentUserId:i,chatMessages:l,foundIds:d,mediaSearchType:h,hasMembersTab:O,areMembersHidden:j,canAddMembers:g,canDeleteMembers:p,members:f,usersById:I,isRightColumnShown:v,isRestricted:y,lastSyncTime:C,setLocalMediaSearchType:E,loadMoreMembers:w,searchMediaMessagesLocal:S,openMediaViewer:M,openAudioPlayer:k,openUserInfo:N,focusMessage:T,loadProfilePhotos:P,setNewChatMembersDialogState:A,serverTimeOffset:R})=>{const x=Object(c.q)(null),L=Object(c.q)(null),B=Object(Oe.a)(),[D,F]=Object(c.r)(0),[U,H]=Object(c.r)(),q=Object(c.p)(()=>[...O?[{type:"members",title:o?"ChannelSubscribers":"GroupMembers"}]:[],...Dn],[O,o]),G=q[D].type,[_,z,K,$]=fn(0,w,S,G,h,f,I,l,d,0,C,R),V=q.findIndex(({type:e})=>e===_),{handleScroll:W}=function(e,t,a,s){Object(Mt.a)(([a])=>{if(a&&a!==t){const a=e.current,n=a.querySelector(".TabList");a.scrollTop<n.offsetTop&&(s("members"===t?u.l.MemberList:u.l.SharedMedia),yn=!0,Object(Rt.a)(a,n,"start",void 0,void 0,void 0,300),setTimeout(()=>{yn=!1},350))}},[t,s]),Object(Mt.a)(([t])=>{if(a!==u.l.Profile||a===t)return;const n=e.current;if(!n)return;const c=n.querySelector(".TabList");!c||c.offsetTop>n.scrollTop||(yn=!0,Object(Rt.a)(n,n.firstElementChild,"start",void 0,2*n.offsetHeight),setTimeout(()=>{yn=!1},350),s(a))},[a]);const n=Object(c.m)(()=>{const a=e.current;if(!a)return;const n=a.querySelector(".TabList");if(!n)return;let c=u.l.Profile;a.scrollTop>=n.offsetTop&&(c="members"===t?u.l.MemberList:u.l.SharedMedia),s(c)},[e,s,t]);return Object(c.n)(()=>{yn||n()},[n,t]),{handleScroll:Object(c.m)(()=>{yn||vn(n)},[n])}}(x,G,t,a),{applyTransitionFix:Q,releaseTransitionFix:Y}=function(e,t=".Transition.shared-media-transition"){return Object(c.n)(()=>{function a(){const a=e.current,s=a.querySelector(t),n=a.querySelector(".TabList");s&&n&&(s.style.minHeight=a.offsetHeight-n.offsetHeight+"px")}return a(),window.addEventListener("resize",a,!1),()=>{window.removeEventListener("resize",a,!1)}},[e,t]),{applyTransitionFix:Object(c.m)(()=>{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:Object(c.m)(()=>{const t=e.current;t.style.overflowY="scroll",t.style.marginRight="0"},[e])}}(x),[J,X]=(()=>{const[e,t]=Object(c.r)(!1);return[e,Object(c.m)(()=>{t(e=>!e)},[])]})(),Z=Object(c.m)(()=>{Y(),X()},[Y,X]),ee=Object(c.m)(()=>{A(u.i.InProgress)},[A]);Object(c.n)(()=>{E({mediaType:G})},[E,G]);const te=r||e;Object(c.n)(()=>{C&&P({profileId:te})},[P,te,C]);const ae=Object(c.m)(e=>{M({chatId:te,threadId:b.MAIN_THREAD_ID,messageId:e,origin:u.h.SharedMedia})},[te,M]),se=Object(c.m)(e=>{k({chatId:te,messageId:e})},[te,k]),ne=Object(c.m)(e=>{N({id:e})},[N]),ce=Object(c.m)(e=>{T({chatId:te,messageId:e})},[te,T]),oe=Object(c.m)(()=>{H(void 0)},[]);let re;Object(c.n)(()=>{if(L.current&&m.n)return Object(Me.b)(L.current,{onSwipe:(e,t)=>{t===Me.a.Left?F(Math.min(D+1,q.length-1)):t===Me.a.Right&&F(Math.max(0,D-1))}})},[D,q.length]);const ie="members"===_||!O&&"media"===_;ie?re=v?0:1e3:z||(re=n.Bb);const le=Object(Qs.a)([e,_],re);function de(e){return e!==i&&p?[{title:B("lng_context_remove_from_group"),icon:"stop",handler:()=>{H(e)}}]:void 0}function be(){if(!z||!le||!l){const e=ie&&z&&!le;return c.a.createElement("div",{className:"content empty-list"},!e&&c.a.createElement(we.a,null))}if(!z.length){let e;switch(_){case"members":e=j?"You have no access to group members list.":"No members found";break;case"documents":e=B("lng_media_file_empty_search");break;case"links":e=B("lng_media_link_empty_search");break;case"audio":e=B("lng_media_song_empty_search");break;default:e=B("SharedMedia.EmptyTitle")}return c.a.createElement("div",{className:"content empty-list"},c.a.createElement(Rn.a,{text:e}))}return c.a.createElement("div",{className:`content ${_}-list`,dir:B.isRtl&&"media"===_?"rtl":void 0,teactFastList:!0},"media"===_?z.map(e=>l[e]&&c.a.createElement(Pn.a,{key:e,message:l[e],onClick:ae})):"documents"===_?z.map(e=>l[e]&&c.a.createElement(ca.a,{key:e,message:l[e],withDate:!0,smaller:!0,className:"scroll-item",onDateClick:ce})):"links"===_?z.map(e=>l[e]&&c.a.createElement(An.a,{key:e,message:l[e],onMessageClick:ce})):"audio"===_?z.map(e=>l[e]&&c.a.createElement(oa.a,{key:e,theme:s,message:l[e],target:"sharedMedia",date:l[e].date,lastSyncTime:C,className:"scroll-item",onPlay:se,onDateClick:ce})):"members"===_?z.map((e,t)=>c.a.createElement(En.a,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item",onClick:()=>ne(e),contextActions:de(e)},c.a.createElement(it.a,{userId:e,forceShowSelf:!0}))):void 0)}return c.a.createElement(Cn.a,{ref:x,className:"Profile custom-scroll",itemSelector:Fn(_),items:le?z:void 0,cacheBuster:J,sensitiveArea:n.qb,preloadBackwards:le?"members"===_?n.cb:n.Ab:0,noScrollRestoreOnTop:!0,noFastList:!0,onLoadMore:K,onScroll:W},!$&&function(e,t){return c.a.createElement("div",{className:"profile-info"},c.a.createElement(kn,{userId:t||e,forceShowSelf:t!==e}),c.a.createElement(Tn,{chatOrUserId:t||e,forceShowSelf:t!==e}))}(e,r),!y&&c.a.createElement("div",{className:"shared-media"},c.a.createElement(me.a,{ref:L,name:B.isRtl?"slide-reversed":"slide",activeKey:V,renderCount:q.length,shouldRestoreHeight:!0,className:"shared-media-transition",onStart:Q,onStop:Z},be),c.a.createElement(Ne.a,{big:!0,activeTab:D,tabs:q,onSwitchTab:F})),g&&c.a.createElement(xn.a,{isShown:"members"===_,onClick:ee,ariaLabel:B("lng_channel_add_users")},c.a.createElement("i",{className:"icon-add-user-filled"})),p&&c.a.createElement(Bn,{isOpen:Boolean(U),userId:U,onClose:oe}))}));var Hn=Object(c.h)(e=>{const t=Object(Re.a)(Ae.a.Extra,"RightSearch");return t?c.a.createElement(t,e):c.a.createElement(xe.a,null)});var qn=Object(c.h)(e=>{const t=Object(Re.a)(Ae.a.Extra,"Management");return t?c.a.createElement(t,e):c.a.createElement(xe.a,null)});var Gn=Object(c.h)(()=>{const e=Object(Re.a)(Ae.a.Extra,"StickerSearch");return e?c.a.createElement(e,null):c.a.createElement(xe.a,null)});var _n=Object(c.h)(()=>{const e=Object(Re.a)(Ae.a.Extra,"GifSearch");return e?c.a.createElement(e,null):c.a.createElement(xe.a,null)});var zn=Object(c.h)(()=>{const e=Object(Re.a)(Ae.a.Extra,"PollResults");return e?c.a.createElement(e,null):c.a.createElement(xe.a,null)}),Kn=a(175);a(267);var $n=Object(c.h)(Object(s.h)((e,{chatId:t})=>{const a=Object(r.g)(e,t),{userIds:s}=e.contactList||{},{byId:n}=e.users,{byId:c}=e.chats,{currentUserId:o,newChatMembersProgress:i,connectionState:d}=e,b=a&&Object(l.mb)(a),{query:m,fetchingStatus:h,globalUserIds:O,localUserIds:j}=e.userSearch;return{isChannel:b,members:a&&a.fullInfo?a.fullInfo.members:void 0,currentUserId:o,usersById:n,chatsById:c,localContactIds:s,searchQuery:m,isSearching:h,isLoading:i===u.i.Loading,globalUserIds:O,localUserIds:j,connectionState:d}},(e,t)=>Object(h.l)(t,["loadContactList","setUserSearchQuery"]))(({isChannel:e,connectionState:t,members:a,onNextStep:s,currentUserId:n,usersById:o,chatsById:r,localContactIds:i,isLoading:d,searchQuery:b,isSearching:u,localUserIds:m,globalUserIds:O,setUserSearchQuery:j,onClose:g,isActive:p,loadContactList:f})=>{const I=Object(Oe.a)(),[v,y]=Object(c.r)([]),C=Object(ga.a)(v)===v;Object(c.n)(()=>{p&&"connectionStateReady"===t&&f()},[t,p,f]),Object(de.b)(p,g);const E=Object(c.p)(()=>a?a.map(e=>e.userId):[],[a]),w=Object(c.m)(e=>{j({query:e})},[j]),S=Object(c.p)(()=>{const t=i?Object(l.Jb)(i.filter(e=>e!==n),r):[];if(!b)return t.filter(e=>!E.includes(e));const a=t.filter(e=>{const t=o[e];if(!t)return!1;const a=Object(l.bb)(t);return a&&Object(P.a)(a,b)});return Object(l.Jb)(Object(h.o)([...a,...m||[],...O||[]]).filter(t=>{const a=o[t];return!E.includes(t)&&(!a||!Object(l.Bb)(a)||!e&&a.canBeInvitedToGroup)}),r)},[i,r,b,m,O,n,o,E,e]),M=Object(c.m)(()=>{v.length&&(j({query:""}),s(v))},[v,j,s]);return c.a.createElement("div",{className:"AddChatMembers"},c.a.createElement("div",{className:"AddChatMembers-inner"},c.a.createElement(Kn.a,{itemIds:S,selectedIds:v,filterValue:b,filterPlaceholder:I("lng_channel_add_users"),searchInputId:"new-members-picker-search",isLoading:u,onSelectedIdsChange:y,onFilterChange:w,noScrollRestore:C}),c.a.createElement(xn.a,{isShown:Boolean(v.length),disabled:d,ariaLabel:I("lng_channel_add_users"),onClick:M},d?c.a.createElement(we.a,{color:"white"}):c.a.createElement("i",{className:"icon-arrow-right"}))))}));a(268);const Vn=Object.keys(u.m).length/2,Wn=Object.keys(u.g).length/2;function Qn(){const e=document.querySelector(".RightHeader .SearchInput input");e&&e.blur()}var Yn=Object(c.h)(Object(s.h)(e=>{const{chatId:t,threadId:a}=Object(r.z)(e)||{},s=Object(r.d)(e);return{contentKey:Object(r.pb)(e),chatId:t,threadId:a,currentProfileUserId:e.users.selectedId,isChatSelected:Boolean(t&&s),shouldSkipHistoryAnimations:e.shouldSkipHistoryAnimations}},(e,t)=>Object(h.l)(t,["openUserInfo","toggleChatInfo","toggleManagement","closeLocalTextSearch","setStickerSearchQuery","setGifSearchQuery","closePollResults","addChatMembers","setNewChatMembersDialogState"]))(({contentKey:e,chatId:t,threadId:a,currentProfileUserId:s,isChatSelected:o,toggleChatInfo:r,toggleManagement:i,openUserInfo:l,closeLocalTextSearch:d,setStickerSearchQuery:b,setGifSearchQuery:m,closePollResults:h,addChatMembers:O,setNewChatMembersDialogState:j,shouldSkipHistoryAnimations:g})=>{var p;const{width:f}=et(),[I,v]=Object(c.r)(u.l.Profile),[y,C]=Object(c.r)(u.g.Initial),[E,w]=Object(c.r)(),[S,M]=Object(c.r)(),k=I!==u.l.Profile,N=void 0!==e,T=e===u.m.ChatInfo||e===u.m.UserInfo,P=e===u.m.Search,A=e===u.m.Management,R=e===u.m.StickerSearch,x=e===u.m.GifSearch,L=e===u.m.PollResults,B=e===u.m.AddingMembers,D=f<=n.lb,[F,U]=Object(c.r)(!N),H=null!==(p=Object(ot.a)(e,!0,!o))&&void 0!==p?p:-1,q=Object(c.m)((t=!0)=>{switch(e){case u.m.AddingMembers:j(u.i.Closed);break;case u.m.ChatInfo:if(k&&t){v(u.l.Profile);break}r(void 0,!0);break;case u.m.UserInfo:if(k&&t){v(u.l.Profile);break}l({id:void 0},!0);break;case u.m.Management:switch(y){case u.g.Initial:i();break;case u.g.ChatPrivacyType:case u.g.Discussion:case u.g.GroupPermissions:case u.g.GroupType:case u.g.ChatAdministrators:case u.g.ChannelSubscribers:case u.g.GroupMembers:C(u.g.Initial);break;case u.g.GroupUserPermissionsCreate:case u.g.GroupRemovedUsers:case u.g.GroupUserPermissions:C(u.g.GroupPermissions),w(void 0),M(void 0);break;case u.g.ChatAdminRights:case u.g.GroupRecentActions:C(u.g.ChatAdministrators)}break;case u.m.Search:Qn(),d();break;case u.m.StickerSearch:Qn(),b({query:void 0});break;case u.m.GifSearch:Qn(),m({query:void 0});break;case u.m.PollResults:h()}},[e,k,r,l,h,j,y,i,d,b,m]),G=Object(c.m)((e,t)=>{w(e),M(t)},[]),_=Object(c.m)(e=>{O({chatId:t,memberIds:e})},[O,t]);function z(e){if(-1!==H)switch(H){case u.m.AddingMembers:return c.a.createElement($n,{chatId:t,onNextStep:_,isActive:N&&e,onClose:q});case u.m.ChatInfo:case u.m.UserInfo:return c.a.createElement(Un,{key:s||t,chatId:t,userId:s,profileState:I,onProfileStateChange:v});case u.m.Search:return c.a.createElement(Hn,{chatId:t,threadId:a,onClose:q,isActive:N&&e});case u.m.Management:return c.a.createElement(qn,{chatId:t,currentScreen:y,isPromotedByCurrentUser:S,selectedChatMemberId:E,onScreenSelect:C,onChatMemberSelect:G,isActive:N&&e,onClose:q});case u.m.StickerSearch:return c.a.createElement(Gn,{onClose:q,isActive:N&&e});case u.m.GifSearch:return c.a.createElement(_n,{onClose:q,isActive:N&&e});case u.m.PollResults:return c.a.createElement(zn,{onClose:q,isActive:N&&e})}}return Object(c.n)(()=>N?Object(be.a)(q):void 0,[N,q]),Object(c.n)(()=>{setTimeout(()=>{U(!N)},300)},[N]),Object(c.n)(()=>{N&&D&&q()},[D]),Object(St.a)(([a,s])=>{(a===u.m.ChatInfo&&e===u.m.UserInfo||a===u.m.UserInfo&&e===u.m.ChatInfo||s!==t)&&(v(u.l.Profile),C(u.g.Initial))},[e,t]),Object(de.b)(o&&(e===u.m.ChatInfo||e===u.m.UserInfo||e===u.m.Management||e===u.m.AddingMembers),()=>q(!1),r),c.a.createElement("div",{id:"RightColumn-wrapper",className:o?void 0:"is-hidden"},D&&c.a.createElement("div",{className:"overlay-backdrop",onClick:q}),c.a.createElement("div",{id:"RightColumn"},c.a.createElement(gn,{chatId:t,isColumnOpen:N,isProfile:T,isSearch:P,isManagement:A,isStickerSearch:R,isGifSearch:x,isPollResults:L,isAddingChatMembers:B,profileState:I,managementScreen:y,onClose:q,shouldSkipAnimation:F||g}),c.a.createElement(me.a,{name:F||g?"none":"zoom-fade",renderCount:Vn+Wn,activeKey:A?Vn+y:H,shouldCleanup:!0,cleanupExceptionKey:u.m.ChatInfo},z)))}));var Jn=Object(c.h)(({isOpen:e})=>{const t=Object(Re.a)(Ae.a.Extra,"MediaViewer",!e);return t?c.a.createElement(t,null):void 0});var Xn=Object(c.h)(({isOpen:e})=>{const t=Object(Re.a)(Ae.a.Extra,"Notifications",!e);return t?c.a.createElement(t,null):void 0});var Zn=Object(c.h)(({isOpen:e})=>{const t=Object(Re.a)(Ae.a.Extra,"Dialogs",!e);return t?c.a.createElement(t,null):void 0});var ec=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Re.a)(Ae.a.Extra,"ForwardPicker",!t);return a?c.a.createElement(a,e):void 0});var tc=Object(c.h)(e=>{const{url:t}=e,a=Object(Re.a)(Ae.a.Extra,"SafeLinkModal",!t);return a?c.a.createElement(a,e):void 0});var ac=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Re.a)(Ae.a.Extra,"HistoryCalendar",!t);return a?c.a.createElement(a,e):void 0});a(269);let sc,nc=!1;function cc(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 oc(e){document.title!==e&&(document.title=e)}var rc=Object(c.h)(Object(s.h)(e=>{const{chatId:t,messageId:a}=e.audioPlayer,s=t&&a?Object(r.l)(e,t,a):void 0;return{animationLevel:e.settings.byKey.animationLevel,lastSyncTime:e.lastSyncTime,isLeftColumnShown:e.isLeftColumnShown,isRightColumnShown:Object(r.W)(e),isMediaViewerOpen:Object(r.T)(e),isForwardModalOpen:Object(r.R)(e),hasNotifications:Boolean(e.notifications.length),hasDialogs:Boolean(e.dialogs.length),audioMessage:s,safeLinkModalUrl:e.safeLinkModalUrl,isHistoryCalendarOpen:Boolean(e.historyCalendarSelectedAt),shouldSkipHistoryAnimations:e.shouldSkipHistoryAnimations,language:e.settings.byKey.language,openedStickerSetShortName:e.openedStickerSetShortName}},(e,t)=>Object(h.l)(t,["loadAnimatedEmojis","loadNotificationSettings","loadNotificationExceptions","updateIsOnline","loadTopInlineBots","loadEmojiKeywords","openStickerSetShortName"]))(({lastSyncTime:e,isLeftColumnShown:t,isRightColumnShown:a,isMediaViewerOpen:o,isForwardModalOpen:i,animationLevel:l,hasNotifications:d,hasDialogs:b,audioMessage:u,safeLinkModalUrl:m,isHistoryCalendarOpen:h,shouldSkipHistoryAnimations:O,language:j,openedStickerSetShortName:g,loadAnimatedEmojis:p,loadNotificationSettings:I,loadNotificationExceptions:v,updateIsOnline:y,loadTopInlineBots:C,loadEmojiKeywords:E,openStickerSetShortName:w})=>{n.r&&!nc&&(nc=!0,console.log(">>> RENDER MAIN")),Object(c.n)(()=>{e&&(y(!0),p(),I(),v(),C(),E({language:n.j}),j!==n.j&&E({language:j}))},[e,p,v,I,y,C,E,j]),Object(c.n)(()=>{e&&de.a.startsWith("#?tgaddr=")&&(e=>{const{protocol:t,searchParams:a,pathname:n}=new URL(e);if("tg:"!==t)return;const{openChatByUsername:c,openStickerSetShortName:o}=Object(s.d)(),r=n.replace(/^\/\//,""),i={};switch(a.forEach((e,t)=>{i[t]=e}),r){case"resolve":{const{domain:e}=i;"telegrampassport"!==e&&c({username:e});break}case"privatepost":case"bg":case"join":break;case"addstickers":{const{set:e}=i;o({stickerSetShortName:e});break}}})(decodeURIComponent(de.a.substr("#?tgaddr=".length)))},[e]);const{transitionClassNames:S}=Object(oe.a)(!t,void 0,!0,void 0,O),{transitionClassNames:M}=Object(oe.a)(a,void 0,!0,void 0,O),k=Object(ne.a)(S.replace(/([\w-]+)/g,"middle-column-$1"),M.replace(/([\w-]+)/g,"right-column-$1"),O&&"history-animation-disabled");Object(le.a)(([e])=>{if(void 0===e||0===l)return;const t=Object(se.d)();Object(ce.b)(document.getElementById("MiddleColumn"),t)},[t]),Object(le.a)(([e])=>{if(void 0===e||0===l)return;Object(f.b)(()=>{document.body.classList.add("animating-right-column")});const t=Object(se.d)();Object(ce.b)(document.getElementById("RightColumn"),()=>{t(),Object(f.b)(()=>{document.body.classList.remove("animating-right-column")})})},[a]);const N=Object(c.m)(()=>{y(!1);const e=Object(r.r)(Object(s.e)());let t=0;clearInterval(sc),sc=window.setInterval(()=>{if(document.title.includes(n.L))cc(!1);else{if(t%2==0){const t=Object(r.r)(Object(s.e)())-e;t>0&&(oc(`${t} notification${t>1?"s":""}`),cc(!0))}else oc(n.pb),cc(!1);t++}},1e3)},[y]),T=Object(c.m)(()=>{y(!0),clearInterval(sc),sc=void 0,document.title.includes(n.L)||oc(n.pb),cc(!1)},[y]);function P(e){e.preventDefault(),e.stopPropagation()}return Object(re.a)(N,T),ie(N),c.a.createElement("div",{id:"Main",className:k,onDrop:P,onDragOver:P},c.a.createElement(Qe,null),c.a.createElement(hn,null),c.a.createElement(Yn,null),c.a.createElement(Jn,{isOpen:o}),c.a.createElement(ec,{isOpen:i}),c.a.createElement(Xn,{isOpen:d}),c.a.createElement(Zn,{isOpen:b}),u&&c.a.createElement(Et,{key:u.id,message:u,noUi:!0}),c.a.createElement(tc,{url:m}),c.a.createElement(ac,{isOpen:h}),c.a.createElement(ba.a,{isOpen:!!g,onClose:()=>w({stickerSetShortName:void 0}),stickerSetShortName:g}))}));n.r&&console.log(">>> FINISH LOAD MAIN BUNDLE"),Object(s.e)().connectionState||Object(s.d)().initApi()},208:function(e,t,a){},209:function(e,t,a){},210:function(e,t,a){},223:function(e,t,a){},224:function(e,t,a){},225:function(e,t,a){},228:function(e,t,a){},229:function(e,t,a){},230:function(e,t,a){},234:function(e,t,a){},235:function(e,t,a){},236:function(e,t,a){},239:function(e,t,a){},240:function(e,t,a){},241:function(e,t,a){},242:function(e,t,a){},243:function(e,t,a){},244:function(e,t,a){},245:function(e,t,a){},246:function(e,t,a){},247:function(e,t,a){},249:function(e,t,a){},250:function(e,t,a){},251:function(e,t,a){},252:function(e,t,a){},253:function(e,t,a){},255:function(e,t,a){},256:function(e,t,a){},257:function(e,t,a){},258:function(e,t,a){},259:function(e,t,a){},260:function(e,t,a){},261:function(e,t,a){},266:function(e,t,a){},267:function(e,t,a){},268:function(e,t,a){},269:function(e,t,a){}}]);
//# sourceMappingURL=4.a194de4797679ae7a3bb.js.map