(window.webpackJsonp=window.webpackJsonp||[]).push([[4],{105:function(e,t,a){"use strict";a.r(t),a.d(t,"Main",(function(){return Tn}));var s=a(2),n=a(1),c=a(0),r=(a(85),a(37)),o=a(6);window.addEventListener("popstate",e=>{if(!e.state)return;const{chatId:t,threadId:a,messageListType:n}=e.state;Object(s.d)().openChat({id:t,threadId:a,type:n,noPushState:!0})}),Object(s.b)("openChat",(e,t,a)=>{const{id:n,threadId:c=-1,type:i="thread",noPushState:l}=a,d=Object(o.y)(e);return d&&d.chatId===n&&d.threadId===c&&d.type===i||(e=Object(r.n)(e),e={...e,messages:{...e.messages,contentToBeScheduled:void 0},...n!==e.forwardMessages.toChatId&&{forwardMessages:{}}},Object(s.g)(e),l||window.history.pushState({chatId:n,threadId:c,messageListType:i},"")),Object(r.N)(e,n,c,i)}),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}));var i=a(5),l=a(19),d=a(3),b=a(7);let u;Object(s.b)("setScrollOffset",(e,t,a)=>{const{chatId:s,threadId:n,scrollOffset:c}=a;return Object(r.x)(e,s,n,"scrollOffset",c)}),Object(s.b)("setReplyingToId",(e,t,a)=>{const{messageId:s}=a,n=Object(o.y)(e);if(!n)return;const{chatId:c,threadId:i}=n;return Object(r.x)(e,c,i,"replyingToId",s)}),Object(s.b)("setEditingId",(e,t,a)=>{const{messageId:s}=a,n=Object(o.y)(e);if(!n)return;const{chatId:c,threadId:i,type:l}=n,d="scheduled"===l?"editingScheduledId":"editingId";return Object(r.x)(e,c,i,d,s)}),Object(s.b)("editLastMessage",e=>{const{chatId:t,threadId:a}=Object(o.y)(e)||{};if(!t||!a)return;const s=Object(o.m)(e,t),n=Object(o.Hb)(e,t,a);if(!s||!n)return;const c=Object(d.g)(n,t=>Boolean(s[t]&&Object(o.b)(e,s[t],a).canEdit));return c?Object(r.x)(e,t,a,"editingId",c):void 0}),Object(s.b)("replyToNextMessage",(e,t,a)=>{const{targetIndexDelta:s}=a,{chatId:n,threadId:c}=Object(o.y)(e)||{};if(!n||!c)return;const r=Object(o.m)(e,n),l=Object(o.Hb)(e,n,c);if(!r||!l)return;const d=Object(o.mb)(e,n,c);let b;if(Object(o.X)(e,n,c)&&d){const e=Object.keys(r),t=e.indexOf(d.toString())+s;b=t<=e.length+1&&t>=0?Number(e[t]):void 0}else if(c===i.MAIN_THREAD_ID){const t=Object(o.f)(e,n);b=t&&t.lastMessage?t.lastMessage.id:void 0}else{const t=Object(o.Cb)(e,n,c);b=t?t.lastMessageId:void 0}t.setReplyingToId({messageId:b}),t.focusMessage({chatId:n,threadId:c,messageId:b})}),Object(s.b)("openMediaViewer",(e,t,a)=>{const{chatId:s,threadId:n,messageId:c,avatarOwnerId:r,profilePhotoIndex:o,origin:i}=a;return{...e,mediaViewer:{chatId:s,threadId:n,messageId:c,avatarOwnerId:r,profilePhotoIndex:o,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(o.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(o.y)(e);if(!a)return;const{chatId:s,threadId:n}=a;let c;if(n===i.MAIN_THREAD_ID){const t=Object(o.f)(e,s);c=t&&t.lastMessage?t.lastMessage.id:void 0}else{const t=Object(o.Cb)(e,s,n);c=t?t.lastMessageId:void 0}c&&t.focusMessage({chatId:s,threadId:n,messageId:c,noHighlight:!0})}),Object(s.b)("focusMessage",(e,t,a)=>{const{chatId:n,threadId:c=i.MAIN_THREAD_ID,messageListType:d="thread",noHighlight:b,groupedId:m,groupedChatId:h}=a;let{messageId:O}=a;if(void 0!==m){const t=Object(o.J)(e,h,m);t&&t.length&&([O]=t)}const j=Object(o.y)(e),g=!j||n!==j.chatId||c!==j.threadId||d!==j.type;u&&(clearTimeout(u),u=void 0),u=window.setTimeout(()=>{let e=Object(s.e)();e=Object(r.P)(e),e=Object(r.O)(e),Object(s.g)(e)},2e3),e=Object(r.P)(e,n,O,b),e=Object(r.O)(e,void 0),g&&(e=Object(r.O)(e,l.b.Static));const f=Object(o.Hb)(e,n,c);if(f&&f.includes(O))return Object(s.g)(e),void t.openChat({id:n,threadId:c});if(g&&(e=Object(r.x)(e,n,c,"viewportIds",void 0)),e=Object(r.x)(e,n,c,"outlyingIds",void 0),f&&!g){const t=O>f[0]?l.b.Down:l.b.Up;e=Object(r.O)(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 r;return c&&(r=Object(o.ab)(e,s,c)),{...e,forwardMessages:{fromChatId:s,messageIds:r||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(o.r)(e);return n?Object(r.m)(e,n.id,s):e}),Object(s.b)("toggleMessageSelection",(e,t,a)=>{const{messageId:n,groupedId:c,childMessageIds:i,withShift:l}=a,d=Object(o.y)(e);if(!d)return;const{chatId:u,threadId:m,type:h}=d;e=Object(r.G)(e,u,m,h,n,c,i,l),Object(s.g)(e),e.shouldShowContextMenuHint&&(t.disableContextMenuHint(),t.showNotification({message:`To **edit** or **reply**, close this menu. Then ${b.l?"long tap":"right click"} on a message.`}))}),Object(s.b)("disableContextMenuHint",e=>{if(e.shouldShowContextMenuHint)return{...e,shouldShowContextMenuHint:!1}}),Object(s.b)("exitMessageSelectMode",r.n),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(r.R)(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(r.R)(e,{recentlyFoundChatIds:[s]});const c=n.filter(e=>e!==s);return c.unshift(s),c.length>10&&c.pop(),Object(r.R)(e,{recentlyFoundChatIds:c})}),Object(s.b)("clearRecentlyFoundChats",e=>Object(r.R)(e,{recentlyFoundChatIds:void 0})),Object(s.b)("setGlobalSearchContent",(e,t,a)=>{const{content:s}=a;return Object(r.S)(e,s)}),Object(s.b)("setGlobalSearchChatId",(e,t,a)=>{const{id:s}=a;return Object(r.R)(e,{chatId:s,query:void 0,resultsByType:void 0})});var m=a(50),h=a(4);Object(s.b)("openLocalTextSearch",e=>{const{chatId:t,threadId:a}=Object(o.y)(e)||{};if(t&&a)return Object(r.Y)(e,t,a,!0)}),Object(s.b)("closeLocalTextSearch",e=>{const{chatId:t,threadId:a}=Object(o.y)(e)||{};if(t&&a)return e=Object(r.Y)(e,t,a,!1),e=Object(r.t)(e,t,a,void 0)}),Object(s.b)("setLocalTextSearchQuery",(e,t,a)=>{const{chatId:s,threadId:n}=Object(o.y)(e)||{};if(!s||!n)return;const{query:c}=a,i=Object(h.a)(s,n),{query:l}=e.localTextSearch.byChatThreadKey[i]||{};return c!==l&&(e=Object(r.t)(e,s,n,m.a)),e=Object(r.Y)(e,s,n,!0,c)}),Object(s.b)("setLocalMediaSearchType",(e,t,a)=>{const{chatId:s}=Object(o.y)(e)||{};if(!s)return;const{mediaType:n}=a;return Object(r.X)(e,s,n)}),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(r.fb)(e,void 0)),Object(s.b)("setSettingOption",(e,t,a)=>Object(r.v)(e,a)),Object(s.b)("setThemeSettings",(e,t,a)=>{const{theme:s,...n}=a;return Object(r.w)(e,s,n)});var O=a(170);Object(s.b)("toggleChatInfo",e=>({...e,isChatInfoShown:!e.isChatInfoShown})),Object(s.b)("toggleManagement",e=>{const{chatId:t}=Object(o.y)(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(o.y)(e)||{};if(t)return{...e,management:{byChatId:{...e.management.byChatId,[t]:{...e.management.byChatId[t],isActive:!1}}}}}),Object(s.b)("openChat",(e,t,a)=>{if(!b.g)return;const{id:s}=a;return{...e,isLeftColumnShown:void 0===s}}),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)("showError",(e,t,a)=>{const{error:s}=a;if(!Object(O.a)(s))return e;const n=[...e.errors],c=n.findIndex(e=>e.message===s.message);return-1!==c&&n.splice(c,1),n.push(s),{...e,errors:n}}),Object(s.b)("dismissError",e=>{const t=[...e.errors];return t.pop(),{...e,errors: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(r.h)(e);return Object(r.i)(t)});a(86);var j=a(10),g=a(9);const f=Object(g.g)(e=>e(),1e3,!0),p=Object(g.g)(e=>e(),3e3,!0),I=Object(g.a)(e=>e(),500,!1,!0);async function v(e,t,a){const c=await Object(j.a)("fetchChats",{limit:n.j,offsetDate:a,archived:"archived"===e,withPinned:void 0===Object(s.e)().chats.orderedPinnedIds[e],serverTimeOffset:Object(s.e)().serverTimeOffset});if(!c)return;const{chatIds:o}=c;o.length>0&&o[0]===t&&o.shift();let l=Object(s.e)();l=Object(r.f)(l,Object(d.c)(c.users,"id")),l=Object(r.M)(l,Object(d.c)(c.chats,"id")),l=Object(r.I)(l,e,o),l=Object(r.J)(l,e,c),Object.keys(c.draftsById).map(Number).forEach(e=>{l=Object(r.x)(l,e,i.MAIN_THREAD_ID,"draft",c.draftsById[e])}),Object.keys(c.replyingToById).map(Number).forEach(e=>{l=Object(r.x)(l,e,i.MAIN_THREAD_ID,"replyingToId",c.replyingToById[e])}),0!==o.length||l.chats.isFullyLoaded[e]||(l={...l,chats:{...l.chats,isFullyLoaded:{...l.chats.isFullyLoaded,[e]:!0}}}),Object(s.g)(l)}async function y(e){const t=await Object(j.a)("fetchFullChat",e);if(!t)return;const{users:a,fullInfo:n}=t;let c=Object(s.e)();a&&(c=Object(r.f)(c,Object(d.c)(a,"id"))),c=Object(r.H)(c,e.id,{fullInfo:n}),Object(s.g)(c)}async function C(e,t,a){const n=Object(s.e)(),c=Object(o.h)(n,t);if(c&&!c.isMin)return void(a?e.focusMessage({chatId:c.id,messageId:a}):e.openChat({id:c.id}));const i=Object(o.r)(n);e.openChat({id:-1});const l=await Object(j.a)("getChatByUsername",t);if(!l)return i&&e.openChat({id:i.id}),void e.showNotification({message:"User does not exist"});Object(s.g)(Object(r.H)(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;ce!==l&&!a.includes(e));if(!u)return;a.push(u.id),t.loadViewportMessages({chatId:u.id,threadId:i.MAIN_THREAD_ID})}})()}),Object(s.b)("openChat",(e,t,a)=>{const{id:s,threadId:n}=a,{currentUserId:c}=e,r=Object(o.f)(e,s);if(r&&r.hasUnreadMark&&t.toggleChatUnread({id:s}),r)Object(h.nb)(r)&&!r.isMin&&t.requestChatUpdate({chatId:s});else if(s===c)Object(j.a)("fetchChat",{type:"self"});else{const t=Object(o.Gb)(e,s);t&&Object(j.a)("fetchChat",{type:"user",user:t})}if(n!==i.MAIN_THREAD_ID){Object(o.Eb)(e,s,n)||t.requestThreadInfoUpdate({chatId:s,threadId:n})}}),Object(s.b)("openSupportChat",(e,t)=>{const a=Object(o.Ab)(e);t.openChat({id:a?a.id:-1}),a||(async()=>{const e=await Object(j.a)("fetchChat",{type:"support"});e&&t.openChat({id:e.chatId})})()}),Object(s.b)("openTipsChat",(e,t)=>{t.openChatByUsername({username:n.Cb})}),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(o.N)(e,t.id)).sort((e,t)=>e.lastMessage.date-t.lastMessage.date)[0]:void 0;f(c?()=>v(s,c.id,c.lastMessage.date):()=>v(s))}),Object(s.b)("loadFullChat",(e,t,a)=>{const{chatId:s,force:n}=a,c=Object(o.f)(e,s);c&&(n?y(c):I(()=>y(c)))}),Object(s.b)("loadTopChats",()=>{p(()=>v("active"))}),Object(s.b)("requestChatUpdate",(e,t,a)=>{const{serverTimeOffset:s}=e,{chatId:n}=a,c=Object(o.f)(e,n);c&&Object(j.a)("requestChatUpdate",{chat:c,serverTimeOffset:s})}),Object(s.b)("updateChatMutedState",(e,t,a)=>{const{serverTimeOffset:s}=e,{chatId:n,isMuted:c}=a,r=Object(o.f)(e,n);r&&Object(j.a)("updateChatMutedState",{chat:r,isMuted:c,serverTimeOffset:s})}),Object(s.b)("createChannel",(e,t,a)=>{const{title:n,about:c,photo:i,memberIds:d}=a;!async function(e,t,a,n){Object(s.g)({...Object(s.e)(),chatCreation:{progress:l.a.InProgress}});const c=await Object(j.a)("createChannel",{title:e,about:a,users:t});if(!c)return;const{id:o,accessHash:i}=c;let d=Object(s.e)();d=Object(r.H)(d,o,c),d={...d,chatCreation:{...d.chatCreation,progress:c?l.a.Complete:l.a.Error}},Object(s.g)(d),Object(s.d)().openChat({id:o}),o&&i&&n&&await Object(j.a)("editChatPhoto",{chatId:o,accessHash:i,photo:n})}(n,d.map(t=>Object(o.Gb)(e,t)).filter(Boolean),c,i)}),Object(s.b)("joinChannel",(e,t,a)=>{const{chatId:s}=a,n=Object(o.f)(e,s);if(!n)return;const{id:c,accessHash:r}=n;c&&r&&Object(j.a)("joinChannel",{channelId:c,accessHash:r})}),Object(s.b)("leaveChannel",(e,t,a)=>{(async()=>{const{chatId:s}=a,n=Object(o.f)(e,s);if(!n)return;const{id:c,accessHash:r}=n;c&&r&&await Object(j.a)("leaveChannel",{channelId:c,accessHash:r}),t.openChat({id:void 0})})()}),Object(s.b)("deleteChannel",(e,t,a)=>{(async()=>{const{chatId:s}=a,n=Object(o.f)(e,s);if(!n)return;const{id:c,accessHash:r}=n;c&&r&&await Object(j.a)("deleteChannel",{channelId:c,accessHash:r}),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:l.a.InProgress}});const n=await Object(j.a)("createGroupChat",{title:e,users:t});if(!n)return;const{id:c}=n;let o=Object(s.e)();o=Object(r.H)(o,c,n),o={...o,chatCreation:{...o.chatCreation,progress:n?l.a.Complete:l.a.Error}},Object(s.g)(o),Object(s.d)().openChat({id:c}),c&&a&&await Object(j.a)("editChatPhoto",{chatId:c,photo:a})}(n,c.map(t=>Object(o.Gb)(e,t)).filter(Boolean),i)}),Object(s.b)("toggleChatPinned",(e,t,a)=>{const{id:s,folderId:c}=a,r=Object(o.f)(e,s);if(r)if(c){const t=Object(o.i)(e,c);if(t){const a=!Object(o.N)(e,s,c),{pinnedChatIds:n,includedChatIds:r}=t,i=a?[s,...n||[]]:(n||[]).filter(e=>e!==s),l=[s,...r];Object(j.a)("editChatFolder",{id:c,folderUpdate:{...t,pinnedChatIds:i,includedChatIds:l}})}}else{const t=Object(o.j)(e,s),a=Object(o.N)(e,s,"archived"===t?n.h:void 0);Object(j.a)("toggleChatPinned",{chat:r,shouldBePinned:!a})}}),Object(s.b)("toggleChatArchived",(e,t,a)=>{const{id:s}=a,c=Object(o.f)(e,s);c&&Object(j.a)("toggleChatArchived",{chat:c,folderId:Object(h.ib)(c)?0:n.h})}),Object(s.b)("loadChatFolders",()=>{!async function(){const e=await Object(j.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(j.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(o.i)(e,s);c&&Object(j.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:r}=e.chatFolders;!async function(e,t){const{id:a,description:n,...c}=e;if(await Object(j.a)("editChatFolder",{id:t+1,folderUpdate:{id:t+1,...c}}),!n)return;const r=Object(s.e)(),{recommended:o}=r.chatFolders;o&&Object(s.g)({...r,chatFolders:{...r.chatFolders,recommended:o.filter(({id:e})=>e!==a)}})}(c,r&&r.length?Math.max.apply(Math.max,r):n.h)}),Object(s.b)("deleteChatFolder",(e,t,a)=>{const{id:s}=a;Object(o.i)(e,s)&&async function(e){await Object(j.a)("deleteChatFolder",e)}(s)}),Object(s.b)("toggleChatUnread",(e,t,a)=>{const{id:s}=a,{serverTimeOffset:n}=e,c=Object(o.f)(e,s);c&&(c.unreadCount?Object(j.a)("markMessageListRead",{serverTimeOffset:n,chat:c,threadId:i.MAIN_THREAD_ID}):Object(j.a)("toggleDialogUnread",{chat:c,hasUnreadMark:!c.hasUnreadMark}))}),Object(s.b)("openTelegramLink",(e,t,a)=>{const{url:s}=a;let c=n.hb.exec(s);if(c){const e=c[1];(async()=>{const a=await Object(j.a)("openChatByInvite",e);a&&t.openChat({id:a.id})})()}else{c=n.ib.exec(s);const e=c[1],a=c[2]?Number(c[2]):void 0;C(t,e,a)}}),Object(s.b)("openChatByUsername",(e,t,a)=>{const{username:s}=a;C(t,s)}),Object(s.b)("togglePreHistoryHidden",(e,t,a)=>{const{chatId:s,isEnabled:n}=a;let c=Object(o.f)(e,s);c&&(async()=>{if(Object(h.jb)(c)){if(c=await Object(j.a)("migrateChat",c),!c)return;t.openChat({id:c.id})}Object(j.a)("togglePreHistoryHidden",{chat:c,isEnabled:n})})()}),Object(s.b)("updateChatDefaultBannedRights",(e,t,a)=>{const{chatId:s,bannedRights:n}=a,c=Object(o.f)(e,s);c&&Object(j.a)("updateChatDefaultBannedRights",{chat:c,bannedRights:n})}),Object(s.b)("updateChatMemberBannedRights",(e,t,a)=>{const{chatId:n,userId:c,bannedRights:i}=a;let l=Object(o.f)(e,n);const d=Object(o.Gb)(e,c);l&&d&&(async()=>{if(Object(h.jb)(l)){if(l=await Object(j.a)("migrateChat",l),!l)return;t.openChat({id:l.id})}await Object(j.a)("updateChatMemberBannedRights",{chat:l,user:d,bannedRights:i});const e=Object(s.e)(),a=Object(o.f)(e,n);if(!a||!a.fullInfo)return;const{members:b,kickedMembers:u}=a.fullInfo,m=!!i.viewMessages,O=!Object.keys(i).length;Object(s.g)(Object(r.H)(e,n,{fullInfo:{...a.fullInfo,...b&&m&&{members:b.filter(e=>e.userId!==c)},...b&&!m&&{members:b.map(e=>e.userId===c?{...e,bannedRights:i}:e)},...O&&u&&{kickedMembers:u.filter(e=>e.userId!==c)}}}))})()}),Object(s.b)("updateChatAdmin",(e,t,a)=>{const{chatId:n,userId:c,adminRights:i,customTitle:l}=a;let d=Object(o.f)(e,n);const b=Object(o.Gb)(e,c);d&&b&&(async()=>{if(Object(h.jb)(d)){if(d=await Object(j.a)("migrateChat",d),!d)return;t.openChat({id:d.id})}await Object(j.a)("updateChatAdmin",{chat:d,user:b,adminRights:i,customTitle:l});const e=Object(s.e)(),a=Object(o.f)(e,n);if(!a||!a.fullInfo)return;const{adminMembers:u}=a.fullInfo,m=!Object.keys(i).length;Object(s.g)(Object(r.H)(e,n,{fullInfo:{...a.fullInfo,...u&&m&&{adminMembers:u.filter(e=>e.userId!==c)},...u&&!m&&{adminMembers:u.map(e=>e.userId===c?{...e,adminRights:i,customTitle:l}:e)}}}))})()}),Object(s.b)("updateChat",(e,t,a)=>{const{chatId:n,title:c,about:i,photo:d}=a,b=Object(o.f)(e,n);b&&(async()=>{Object(s.g)(Object(r.bb)(Object(s.e)(),l.f.InProgress)),await Promise.all([b.title!==c?Object(j.a)("updateChatTitle",b,c):void 0,b.fullInfo&&b.fullInfo.about!==i?Object(j.a)("updateChatAbout",b,i):void 0,d?Object(j.a)("editChatPhoto",{chatId:n,accessHash:b.accessHash,photo:d}):void 0]),Object(s.g)(Object(r.bb)(Object(s.e)(),l.f.Complete))})()}),Object(s.b)("toggleSignatures",(e,t,a)=>{const{chatId:s,isEnabled:n}=a,c=Object(o.f)(e,s);c&&Object(j.a)("toggleSignatures",{chat:c,isEnabled:n})}),Object(s.b)("loadGroupsForDiscussion",()=>{(async()=>{const e=await Object(j.a)("fetchGroupsForDiscussion");if(!e)return;const t=e.reduce((e,t)=>(t&&(e[t.id]=t),e),{}),a=Object(r.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(o.f)(e,s);let r=Object(o.f)(e,n);c&&r&&(async()=>{if(Object(h.jb)(r)){if(r=await Object(j.a)("migrateChat",r),!r)return;t.openChat({id:r.id})}let{fullInfo:e}=r;if(!e){const t=await Object(j.a)("fetchFullChat",r);if(!t)return;e=t.fullInfo}e.isPreHistoryHidden&&await Object(j.a)("togglePreHistoryHidden",{chat:r,isEnabled:!1}),Object(j.a)("setDiscussionGroup",{channel:c,chat:r})})()}),Object(s.b)("unlinkDiscussionGroup",(e,t,a)=>{const{channelId:s}=a,n=Object(o.f)(e,s);if(!n)return;let c;n.fullInfo&&n.fullInfo.linkedChatId&&(c=Object(o.f)(e,n.fullInfo.linkedChatId)),(async()=>{await Object(j.a)("setDiscussionGroup",{channel:n}),c&&y(c)})()}),Object(s.b)("setActiveChatFolder",(e,t,a)=>({...e,chatFolders:{...e.chatFolders,activeChatFolder:a}})),Object(s.b)("loadMoreMembers",e=>{(async()=>{const{chatId:t}=Object(o.y)(e)||{},a=t?Object(o.f)(e,t):void 0;if(!a||Object(h.jb)(a))return;const n=a.fullInfo&&a.fullInfo.members&&a.fullInfo.members.length||void 0,c=await Object(j.a)("fetchMembers",a.id,a.accessHash,"recent",n);if(!c)return;const{members:i,users:l}=c;i&&i.length&&(e=Object(s.e)(),e=Object(r.f)(e,Object(d.c)(l,"id")),e=Object(r.H)(e,a.id,{fullInfo:{...a.fullInfo,members:[...(a.fullInfo||{}).members||[],...i||[]]}}),Object(s.g)(e))})()});var E=a(154);const w=new Map,M=Object(g.g)(e=>e(),1e3,!0);async function S(e,t,a,c,i=!1,b=!1){const u=e.id;let m;switch(c){case l.e.Backwards:m=void 0;break;case l.e.Around:m=-(Math.round(n.V/2)+1);break;case l.e.Forwards:m=-(n.V+1)}const h=await Object(j.a)("fetchMessages",{chat:Object(o.Db)(Object(s.e)(),u,t),offsetId:a,addOffset:m,limit:n.V,threadId:t});if(!h)return;const{messages:O,users:g,chats:f,threadInfos:p}=h,I=Object(d.c)(O,"id"),v=Object.keys(I).map(Number);let y=Object(s.e)();y=Object(r.b)(y,u,I),y=i?Object(r.db)(y,u,t,v):Object(r.V)(y,u,t,v),y=Object(r.f)(y,Object(d.c)(g,"id")),y=Object(r.c)(y,Object(d.c)(f,"id")),y=Object(r.lb)(y,u,p);let C=Object(o.Y)(y,u,t);const E=Object(o.gb)(y,u,t);if(i&&C&&E&&Object(d.b)(C,E)&&(y=Object(r.V)(y,u,t,E),C=Object(o.Y)(y,u,t),y=Object(r.x)(y,u,t,"outlyingIds",void 0),i=!1),!b){const e=i?E:C,{newViewportIds:s}=k(e,a,c);y=Object(r.z)(y,u,t,s)}Object(s.g)(y)}function k(e,t,a){const{length:s}=e,c=t?function(e,t){return te[e.length-1]?e.length-1:e.findIndex((a,s)=>a===t||at)}(e,t):-1,r=a===l.e.Backwards?c:c+1||s,o=r-n.V,i=r+n.V-1,d=e.slice(Math.max(0,o),i+1);let b,u;switch(a){case l.e.Backwards:b=r>0,u=o>=0;break;case l.e.Forwards:b=r0,u=d.length===n.V}return{newViewportIds:d,areSomeLocal:b,areAllLocal:u}}async function N(e){let t;const a=e.attachment?(e,n)=>{w.has(n)||(t=n,w.set(n,a));const c=Object(s.e)();Object(s.g)({...c,fileUploads:{byMessageLocalId:{...c.fileUploads.byMessageLocalId,[n]:{progress:e}}}})}:void 0;e.replyingTo&&await Object(g.f)();const n=Object(s.e)();e.serverTimeOffset=n.serverTimeOffset;const c=Object(o.y)(n);if(!c)return;const{threadId:r}=c;e.replyingTo||r===i.MAIN_THREAD_ID||(e.replyingTo=Object(o.Eb)(n,e.chat.id,r)),await Object(j.a)("sendMessage",e,a),a&&t&&w.delete(t)}Object(s.b)("loadViewportMessages",(e,t,a)=>{const{direction:s=l.e.Around,isBudgetPreload:c=!1}=a||{};let{chatId:i,threadId:d}=a||{};if(!i){const t=Object(o.y)(e);if(!t)return;i=t.chatId,d=t.threadId}const b=Object(o.f)(e,i);if(!b||b.isRestricted)return;const u=Object(o.Hb)(e,i,d),m=Object(o.Y)(e,i,d),h=Object(o.gb)(e,i,d);if(u&&u.length&&s!==l.e.Around){const a=s===l.e.Backwards?u[0]:u[u.length-1],n=Boolean(h),o=n?h:m,{newViewportIds:O,areSomeLocal:j,areAllLocal:g}=k(o,a,s);if(j&&(e=Object(r.z)(e,i,d,O)),async function(e,t,a,s,n,c,r,o){t||await S(n,c,o,r,a,s);s||(await Promise.resolve(),e.loadViewportMessages({chatId:n.id,threadId:c,direction:r,isBudgetPreload:!0}))}(t,g,n,c,b,d,s,a),c)return}else{const t=Object(o.I)(e,i)||Object(o.lb)(e,i,d),a=Boolean(t&&m&&!m.includes(t)),s=(a?h:m)||[],{newViewportIds:u,areSomeLocal:O,areAllLocal:j}=k(s,t,l.e.Around);O&&u.length>=n.V&&(e=Object(r.z)(e,i,d,u)),j||S(b,d,t,l.e.Around,a,c)}return e}),Object(s.b)("loadMessage",(e,t,a)=>{const{chatId:n,messageId:c,replyOriginForId:l}=a,b=Object(o.f)(e,n);b&&async function(e,t,a){const n=await Object(j.a)("fetchMessage",{chat:e,messageId:t});if(!n)return;if(n===i.MESSAGE_DELETED){if(a){let t=Object(s.e)();const n=Object(o.k)(t,e.id,a);t=Object(r.L)(t,e.id,a,{...n,replyToMessageId:void 0}),Object(s.g)(t)}return}let c=Object(s.e)();c=Object(r.L)(c,e.id,t,n.message),c=Object(r.f)(c,Object(d.c)(n.users,"id")),Object(s.g)(c)}(b,c,l)}),Object(s.b)("sendMessage",(e,t,a)=>{const s=Object(o.y)(e);if(!s)return;const{chatId:c,threadId:r,type:i}=s;if("scheduled"===i&&!a.scheduledAt)return{...e,messages:{...e.messages,contentToBeScheduled:a}};const l=Object(o.f)(e,c);t.setReplyingToId({messageId:void 0}),t.clearWebPagePreview({chatId:c,threadId:r,value:!1});const b={...a,chat:l,replyingTo:Object(o.mb)(e,c,r),noWebPage:Object(o.cb)(e,c,r)},u=!a.attachments||a.attachments.length<=1,m=!u&&a.attachments&&a.attachments.length>1;if(u){const{attachments:e,...t}=b;N({...t,attachment:e?e[0]:void 0})}else if(m){const{text:e,entities:t,attachments:a,...s}=b,c=Object(d.n)(a,n.L);for(let a=0;a0?o:void 0}),r.forEach(e=>{N({...s,attachment:e,groupedId:o})})}}else{const{text:e,entities:t,attachments:a,replyingTo:s,...n}=b;e&&N({...n,text:e,entities:t,replyingTo:s}),a.forEach(e=>{N({...n,attachment:e})})}}),Object(s.b)("editMessage",(e,t,a)=>{const{serverTimeOffset:s}=e,{text:n,entities:c}=a,r=Object(o.y)(e);if(!r)return;const{chatId:i,threadId:l,type:d}=r,b=Object(o.f)(e,i),u=Object(o.D)(e,i,l,d);b&&u&&(Object(j.a)("editMessage",{chat:b,message:u,text:n,entities:c,noWebPage:Object(o.cb)(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(o.k)(e,s,n),r=c&&w.get(c.previousLocalId||c.id);r&&Object(j.b)(r),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:l,entities:d}=c,b=Object(o.f)(e,s);return n===i.MAIN_THREAD_ID&&Object(j.a)("saveDraft",{chat:b,text:l,entities:d,replyToMsgId:Object(o.mb)(e,s,n)}),Object(r.x)(e,s,n,"draft",c)}),Object(s.b)("clearDraft",(e,t,a)=>{const{chatId:s,threadId:n,localOnly:c}=a;if(!Object(o.B)(e,s,n))return;const l=Object(o.f)(e,s);return c||n!==i.MAIN_THREAD_ID||Object(j.a)("clearDraft",l),Object(r.x)(e,s,n,"draft",void 0)}),Object(s.b)("toggleMessageWebPage",(e,t,a)=>{const{chatId:s,threadId:n,noWebPage:c}=a;return Object(r.x)(e,s,n,"noWebPage",c)}),Object(s.b)("pinMessage",(e,t,a)=>{const s=Object(o.r)(e);if(!s)return;const{messageId:n,isUnpin:c,isOneSide:r,isSilent:i}=a;Object(j.a)("pinMessage",{chat:s,messageId:n,isUnpin:c,isOneSide:r,isSilent:i})}),Object(s.b)("unpinAllMessages",(e,t,a)=>{const n=Object(o.f)(e,a.chatId);n&&async function(e){await Object(j.a)("unpinAllMessages",{chat:e});let t=Object(s.e)();t=Object(r.x)(t,e.id,i.MAIN_THREAD_ID,"pinnedIds",[]),Object(s.g)(t)}(n)}),Object(s.b)("deleteMessages",(e,t,a)=>{const{messageIds:s,shouldDeleteForAll:n}=a,c=Object(o.y)(e);if(!c)return;const{chatId:r,threadId:i}=c,l=Object(o.f)(e,r);Object(j.a)("deleteMessages",{chat:l,messageIds:s,shouldDeleteForAll:n});const d=Object(o.C)(e,r,i);s.includes(d)&&t.setEditingId({messageId:void 0})}),Object(s.b)("deleteScheduledMessages",(e,t,a)=>{const{messageIds:s}=a,n=Object(o.y)(e);if(!n)return;const{chatId:c}=n,r=Object(o.f)(e,c);Object(j.a)("deleteScheduledMessages",{chat:r,messageIds:s});const i=Object(o.E)(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(o.f)(e,s);if(!c)return;const r=c.lastMessage&&c.lastMessage.id;await Object(j.a)("deleteHistory",{chat:c,shouldDeleteForAll:n,maxId:r}),t.openChat({id:void 0})})()}),Object(s.b)("markMessageListRead",(e,t,a)=>{const{serverTimeOffset:s}=e,n=Object(o.y)(e);if(!n)return;const{chatId:c,threadId:r}=n,i=Object(o.Db)(e,c,r);if(!i)return;const{maxId:l}=a;M(()=>{Object(j.a)("markMessageListRead",{serverTimeOffset:s,chat:i,threadId:r,maxId:l})})}),Object(s.b)("markMessagesRead",(e,t,a)=>{const s=Object(o.r)(e);if(!s)return;const{messageIds:n}=a;Object(j.a)("markMessagesRead",{chat:s,messageIds:n})}),Object(s.b)("loadWebPagePreview",(e,t,a)=>{const{text:n}=a;!async function(e){const t=await Object(j.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,r=Object(o.f)(e,s);r&&Object(j.a)("sendPollVote",{chat:r,messageId:n,options:c})}),Object(s.b)("loadPollOptionResults",(e,t,a)=>{const{chat:n,messageId:c,option:o,offset:i,limit:l,shouldResetVoters:b}=a;!async function(e,t,a,n,c,o){const i=await Object(j.a)("loadPollOptionResults",{chat:e,messageId:t,option:a,offset:n,limit:c});if(!i)return;let l=Object(s.e)();l=Object(r.f)(l,Object(d.c)(i.users,"id"));const{voters:b}=l.pollResults;Object(s.g)({...l,pollResults:{...l.pollResults,voters:{...b,[a]:[...!o&&b&&b[a]?b[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,o,i,l,b)}),Object(s.b)("forwardMessages",e=>{const{fromChatId:t,messageIds:a,toChatId:n}=e.forwardMessages,c=t?Object(o.f)(e,t):void 0,r=n?Object(o.f)(e,n):void 0,i=t&&a?a.sort((e,t)=>e-t).map(a=>Object(o.k)(e,t,a)).filter(Boolean):void 0;c&&r&&i&&i.length&&function(e,t,a){Object(j.a)("forwardMessages",{fromChat:e,toChat:t,messages:a,serverTimeOffset:Object(s.e)().serverTimeOffset}),Object(s.g)({...Object(s.e)(),forwardMessages:{}})}(c,r,i)}),Object(s.b)("loadScheduledHistory",e=>{const t=Object(o.r)(e);if(!t)return;const{hash:a}=e.scheduledMessages.byChatId[t.id]||{};!async function(e,t){const a=await Object(j.a)("fetchScheduledHistory",{chat:e,hash:t});if(!a)return;const{hash:n,messages:c}=a,o=Object(d.c)(c,"id"),l=Object.keys(o).map(Number).sort((e,t)=>t-e);let b=Object(s.e)();b=Object(r.u)(b,e.id,o,n),b=Object(r.x)(b,e.id,i.MAIN_THREAD_ID,"scheduledIds",l),Object(s.g)(b)}(t,a)}),Object(s.b)("sendScheduledMessages",(e,t,a)=>{const{chatId:s,id:n}=a,c=Object(o.f)(e,s);c&&Object(j.a)("sendScheduledMessages",{chat:c,ids:[n]})}),Object(s.b)("rescheduleMessage",(e,t,a)=>{const{chatId:s,messageId:n,scheduledAt:c}=a,r=Object(o.f)(e,s),i=r&&Object(o.pb)(e,r.id,n);r&&i&&Object(j.a)("rescheduleMessage",{chat:r,message:i,scheduledAt:c})}),Object(s.b)("requestThreadInfoUpdate",(e,t,a)=>{const{chatId:s,threadId:n}=a,c=Object(o.Db)(e,s,n);c&&Object(j.a)("requestThreadInfoUpdate",{chat:c,threadId:n})}),Object(s.b)("loadPinnedMessages",(e,t,a)=>{const{chatId:n}=a,c=Object(o.f)(e,n);c&&async function(e){const t=await Object(j.a)("fetchPinnedMessages",{chat:e});if(!t)return;const{messages:a,chats:n,users:c}=t,o=Object(d.c)(a,"id"),l=Object.keys(o).map(Number).sort((e,t)=>t-e);let b=Object(s.e)();b=Object(r.b)(b,e.id,o),b=Object(r.x)(b,e.id,i.MAIN_THREAD_ID,"pinnedIds",l),b=Object(r.f)(b,Object(d.c)(c,"id")),b=Object(r.c)(b,Object(d.c)(n,"id")),Object(s.g)(b)}(c)}),Object(s.b)("loadMessageLink",(e,t,a)=>{const{messageId:s,chatId:n}=a,c=Object(o.f)(e,n),r=Object(o.k)(e,n,s);c&&r&&(async()=>{const e=await Object(j.a)("fetchMessageLink",{chat:c,message:r});e&&Object(E.c)(e.link)})()});var T=a(52);const P=Object(g.g)(e=>e(),500,!1);async function A(e,t){const a=await Object(j.a)("searchGifs",{query:e,offset:t});a&&Object(s.g)(Object(r.Q)(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(j.a)("fetchStickerSets",{hash:e});if(!t)return;Object(s.g)(Object(r.ib)(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;e0&&await Object(g.e)(500)})()}),Object(s.b)("loadRecentStickers",e=>{const{hash:t}=e.stickers.recent||{};!async function(e=0){const t=await Object(j.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(j.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)("loadFeaturedStickers",e=>{const{hash:t}=e.stickers.featured||{};!async function(e=0){const t=await Object(j.a)("fetchFeaturedStickers",{hash:e});if(!t)return;Object(s.g)(Object(r.ib)(Object(s.e)(),"featured",t.hash,t.sets))}(t)}),Object(s.b)("loadStickers",(e,t,a)=>{const{stickerSetId:n}=a;let{stickerSetAccessHash:c}=a;if(!c){const t=Object(o.xb)(e,n);if(!t)return;c=t.accessHash}!async function(e,t){const a=await Object(j.a)("fetchStickers",{stickerSetId:e,accessHash:t});if(!a)return;const{set:n,stickers:c,packs:o}=a;let i=Object(s.e)();i=Object(r.hb)(i,n.id,{...n,stickers:c,packs:o});const l=i.stickers.forEmoji.emoji;l&&o[l]&&(i=Object(r.o)(i));Object(s.g)(i)}(n,c)}),Object(s.b)("loadAnimatedEmojis",()=>{!async function(){const e=await Object(j.a)("fetchAnimatedEmojis");if(!e)return;const{set:t,stickers:a}=e;Object(s.g)(Object(r.q)(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(j.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(j.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(j.a)("faveSticker",{sticker:e,unfave:!0})}(n)}),Object(s.b)("toggleStickerSet",(e,t,a)=>{const{stickerSetId:s}=a,n=Object(o.xb)(e,s);if(!n)return;const{accessHash:c,installedDate:r}=n;Object(j.a)(r?"uninstallStickerSet":"installStickerSet",{stickerSetId:s,accessHash:c})}),Object(s.b)("loadEmojiKeywords",(e,t,a)=>{const{language:n}=a;let c=Object(o.F)(e,n);c&&c.isLoading||(Object(s.g)({...e,emojiKeywords:{...e.emojiKeywords,[n]:{...c,isLoading:!0}}}),(async()=>{const t=await Object(j.a)("fetchEmojiKeywords",{language:n,fromVersion:c?c.version:0});e=Object(s.e)(),c=Object(o.F)(e,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&&P(()=>{!async function(e,t=0){const a=await Object(j.a)("searchStickers",{query:e,hash:t});if(!a)return;const n=Object(s.e)(),{setsById:c,added:o}=n.stickers,i=a.sets.map(({id:e})=>e);o.setIds&&o.setIds.forEach(t=>{if(!i.includes(t)){const{title:a}=c[t]||{};a&&Object(T.a)(a,e)&&i.unshift(t)}});Object(s.g)(Object(r.ib)(n,"search",a.hash,a.sets,i))}(n)})}),Object(s.b)("setGifSearchQuery",(e,t,a)=>{const{query:s}=a;"string"==typeof s&&P(()=>{A(s)})}),Object(s.b)("searchMoreGifs",e=>{const{query:t,offset:a}=e.gifs.search;"string"==typeof t&&P(()=>{A(t,a)})}),Object(s.b)("loadStickersForEmoji",(e,t,a)=>{const{emoji:n}=a,{hash:c}=e.stickers.forEmoji;P(()=>{!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(j.a)("fetchStickersForEmoji",{emoji:e,hash:t});if(a=Object(s.e)(),!n||a.stickers.forEmoji.emoji!==e)return;a=Object(r.jb)(a,e,n.stickers,n.hash),Object(s.g)(a)}(n,c)})}),Object(s.b)("clearStickersForEmoji",e=>({...e,stickers:{...e.stickers,forEmoji:{}}}));var x=a(36);const R=Object(g.g)(e=>e(),500,!1);async function L(e="",t,a,c,i,l){let b;if(c){const s=await Object(j.a)("searchMessagesLocal",{chatOrUser:c,query:e,type:t,limit:n.y,offsetId:a,minDate:l,maxDate:i});if(s){const{messages:e,users:t,totalCount:a,nextOffsetId:n}=s;b={messages:e,users:t,chats:[],totalCount:a,nextRate:n}}}else b=await Object(j.a)("searchMessagesGlobal",{query:e,offsetRate:a,limit:n.y,type:t,maxDate:i,minDate:l});let u=Object(s.e)();const m=Object(o.t)(u);if(!b||""!==e&&e!==m)return void Object(s.g)(Object(r.T)(u,{messages:!1}));const{messages:h,users:O,chats:g,totalCount:f,nextRate:p}=b;g.length&&(u=Object(r.c)(u,Object(d.c)(g,"id"))),O.length&&(u=Object(r.f)(u,Object(d.c)(O,"id"))),h.length&&(u=Object(r.d)(u,h)),u=Object(r.U)(u,h,f,t,p),Object(s.g)(u)}async function F(){const e=await Object(j.a)("fetchChats",{limit:n.j,archived:!0,withPinned:!0,serverTimeOffset:Object(s.e)().serverTimeOffset});if(!e)return;let t=Object(s.e)();t=Object(r.ob)(t,Object(d.c)(e.users,"id")),t=Object(r.M)(t,Object(d.c)(e.chats,"id")),t=Object(r.r)(t,"archived",e.chatIds),t=Object(r.J)(t,"archived",e),Object(s.g)(t)}async function D(){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(o.Gb)(e,t)).filter(Boolean),c=await Object(j.a)("fetchUsers",{users:n});c&&(e=Object(s.e)(),e=Object(r.ob)(e,Object(d.c)(c,"id")),Object(s.g)(e))}Object(s.b)("setGlobalSearchQuery",(e,t,a)=>{const{chatId:n}=e.globalSearch,{query:c}=a;c&&!n&&R(()=>{!async function(e){const t=await Object(j.a)("searchChats",{query:e});let a=Object(s.e)();const n=Object(o.t)(a);if(!t||!n||e!==n)return void Object(s.g)(Object(r.T)(a,{chats:!1}));const{localChats:c,localUsers:i,globalChats:l,globalUsers:b}=t;(c.length||l.length)&&(a=Object(r.c)(a,Object(d.c)([...c,...l],"id")));(i.length||b.length)&&(a=Object(r.f)(a,Object(d.c)([...i,...b],"id")));a=Object(r.T)(a,{chats:!1}),a=Object(r.R)(a,{localResults:{chatIds:c.map(({id:e})=>e),userIds:i.map(({id:e})=>e)},globalResults:{...a.globalSearch.globalResults,chatIds:b.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(r.R)(e,{date:n,query:"",resultsByType:{...e.globalSearch.resultsByType,text:{totalCount:void 0,foundIds:[],nextOffsetId:0}}});Object(s.g)(i);const{chatId:l}=e.globalSearch;L("","text",void 0,l?Object(o.f)(e,l):void 0,c,n)}),Object(s.b)("searchMessagesGlobal",(e,t,a)=>{const{query:s,resultsByType:n,chatId:c,date:r}=e.globalSearch,i=r?Object(x.m)(r):r,{type:l}=a,{nextOffsetId:d}=n&&n[l]||{};L(s,l,d,c?Object(o.f)(e,c):void 0,i,r)}),Object(s.b)("searchTextMessagesLocal",e=>{const{chatId:t,threadId:a}=Object(o.y)(e)||{},c=t?Object(o.f)(e,t):void 0,l=Object(o.A)(e);if(!c||!l||!a)return;const{query:b,results:u}=l,m=u?u.nextOffsetId:void 0;let h;if(a!==i.MAIN_THREAD_ID){const s=Object(o.Cb)(e,t,a);h=s?s.topMessageId:void 0}!async function(e,t,a,c,i){const l=await Object(j.a)("searchMessagesLocal",{chatOrUser:e,type:"text",query:c,topMessageId:a,limit:n.X,offsetId:i});if(!l)return;const{messages:b,users:u,totalCount:m,nextOffsetId:h}=l,O=Object(d.c)(b,"id"),g=Object.keys(O).map(Number);let f=Object(s.e)();const p=Object(o.A)(f);if(!p||c&&c!==p.query)return;f=Object(r.b)(f,e.id,O),f=Object(r.f)(f,Object(d.c)(u,"id")),f=Object(r.Z)(f,e.id,t,g,m,h),Object(s.g)(f)}(c,a,h,b,m)}),Object(s.b)("searchMediaMessagesLocal",e=>{const t=Object(o.w)(e),a=t?e.users.byId[t]||e.chats.byId[t]:void 0,c=Object(o.v)(e);if(!a||!c)return;const{currentType:i,resultsByType:l}=c,b=i&&l&&l[i],u=b?b.nextOffsetId:void 0;i&&async function(e,t,a){const c=await Object(j.a)("searchMessagesLocal",{chatOrUser:e,type:t,limit:n.ob,offsetId:a});if(!c)return;const{messages:i,users:l,totalCount:b,nextOffsetId:u}=c,m=Object(d.c)(i,"id"),h=Object.keys(m).map(Number);let O=Object(s.e)();if(!Object(o.v)(O))return;O=Object(r.b)(O,e.id,m),O=Object(r.f)(O,Object(d.c)(l,"id")),O=Object(r.W)(O,e.id,t,h,b,u),Object(s.g)(O)}(a,i,u)}),Object(s.b)("searchMessagesByDate",(e,t,a)=>{const{timestamp:n}=a,{chatId:c}=Object(o.y)(e)||{};if(!c)return;const r=Object(o.f)(e,c);r&&async function(e,t){const a=await Object(j.a)("findFirstMessageIdAfterDate",{chat:e,timestamp:t});if(!a)return;Object(s.d)().focusMessage({chatId:e.id,messageId:a})}(r,n)}),Object(s.b)("checkPublicLink",(e,t,a)=>{const{chatId:n}=Object(o.y)(e)||{};if(!n)return;if(e.management.progress===l.f.InProgress)return;const{username:c}=a;(async()=>{e=Object(r.bb)(e,l.f.InProgress),e=Object(r.ab)(e,n,{isUsernameAvailable:void 0}),Object(s.g)(e);const t=await Object(j.a)("checkChatUsername",{username:c});e=Object(s.e)(),e=Object(r.bb)(e,t?l.f.Complete:l.f.Error),e=Object(r.ab)(e,n,{isUsernameAvailable:t}),Object(s.g)(e)})()}),Object(s.b)("updatePublicLink",(e,t,a)=>{const{chatId:n}=Object(o.y)(e)||{};let c=n&&Object(o.f)(e,n);if(!n||!c)return;const{username:i}=a;(async()=>{if(e=Object(r.bb)(e,l.f.InProgress),Object(s.g)(e),Object(h.jb)(c)){if(c=await Object(j.a)("migrateChat",c),!c)return;t.openChat({id:c.id})}const a=await Object(j.a)("setChatUsername",{chat:c,username:i});e=Object(s.e)(),e=Object(r.bb)(e,a?l.f.Complete:l.f.Error),e=Object(r.ab)(e,n,{isUsernameAvailable:void 0}),Object(s.g)(e)})()}),Object(s.b)("updatePrivateLink",e=>{const{chatId:t}=Object(o.y)(e)||{},a=t&&Object(o.f)(e,t);t&&a&&Object(j.a)("updatePrivateLink",{chat:a})}),Object(s.b)("sync",(e,t)=>{!async function(e){n.p&&console.log(">>> START SYNC");await Object(j.a)("fetchCurrentUser");const t=await async function(){const e=await Object(j.a)("fetchChats",{limit:n.j,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:l}=t,b=[...a||[],...c||[],...l?[l]:[]],u=b.map(e=>Object(o.Gb)(t,e)).filter(Boolean),m=b.map(e=>Object(o.f)(t,e)).filter(Boolean),{chatId:O}=Object(o.y)(t)||{};if(O){const e=Object(o.f)(t,O);if(e&&!b.includes(O)&&m.push(e),Object(h.mb)(O)){const e=Object(o.Gb)(t,O);e&&!b.includes(O)&&u.push(e)}}u.push(...e.users),m.push(...e.chats),t=Object(r.s)(t,Object(d.c)(m,"id")),t=Object(r.r)(t,"active",e.chatIds),t={...t,chats:{...t.chats}},t=Object(r.J)(t,"active",e),Object.keys(e.draftsById).map(Number).forEach(a=>{t=Object(r.x)(t,a,i.MAIN_THREAD_ID,"draft",e.draftsById[a])}),Object.keys(e.replyingToById).map(Number).forEach(a=>{t=Object(r.x)(t,a,i.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||[],c=Object(s.e)();const{chatId:l}=Object(o.y)(c)||{},b=Object.keys(c.messages.byChatId).map(Number).reduce((e,t)=>{const a=Object(o.B)(c,t,i.MAIN_THREAD_ID);return a?{...e,[t]:a}:e},{});if(l){const e=await(u=c.chats.byId[l],Object(j.a)("fetchMessages",{chat:u,threadId:i.MAIN_THREAD_ID,offsetId:u.lastReadInboxMessageId,addOffset:-(Math.round(n.V/2)+1),limit:n.V}));c=Object(s.e)();const{chatId:b}=Object(o.y)(c)||{};if(e&&b===l){const s=c.messages.byChatId[l],n=Object(d.c)(e.messages,"id"),o=Object.keys(n).map(Number);c={...c,messages:{...c.messages,byChatId:{[l]:{byId:n,threadsById:{[i.MAIN_THREAD_ID]:{...s&&s.threadsById[i.MAIN_THREAD_ID],listedIds:o,viewportIds:o,outlyingIds:void 0}}}}}},c=Object(r.M)(c,Object(d.c)(e.chats,"id")),c=Object(r.lb)(c,l,e.threadInfos),t=!0,a=Array.prototype.concat(a,e.users)}}var u;t||(c={...c,messages:{...c.messages,byChatId:{}}});Object.keys(b).map(Number).forEach(e=>{c=Object(r.x)(c,e,i.MAIN_THREAD_ID,"draft",b[e])}),e?c=Object(r.y)(c,Object(d.c)(a,"id")):a&&(c=Object(r.ob)(c,Object(d.c)(a,"id")));Object(s.g)(c);const{chatId:m,messageId:h}=c.audioPlayer;m&&h&&!Object(o.k)(c,m,h)&&Object(s.d)().closeAudioPlayer()}(t),Object(s.g)({...Object(s.e)(),lastSyncTime:Date.now()}),n.p&&console.log(">>> FINISH SYNC");e()}(t.afterSync)}),Object(s.b)("afterSync",(e,t)=>{!async function(e){n.p&&console.log(">>> START AFTER-SYNC");e.loadFavoriteStickers(),await Promise.all([D(),F()]),await Object(j.a)("fetchCurrentUser"),n.p&&console.log(">>> FINISH AFTER-SYNC")}(t)});const B=Object(g.a)(e=>e(),500,!1,!0);function U(e,{visibility:t,allowedIds:a,deniedIds:s}){const{users:{byId:n},chats:{byId:c}}=e,r={visibility:t};let o,i;const l=e=>{if(!Object(h.mb)(e))return;const{id:t,accessHash:a}=n[e]||{};return t?{id:t,accessHash:a}:void 0},d=e=>{if(Object(h.mb)(e))return;const t=c[e];return t?{id:t.id}:void 0};return"contacts"!==t&&"nobody"!==t||(o=a.map(l).filter(Boolean),i=a.map(d).filter(Boolean),o.length>0&&(r.allowedUsers=o),i.length>0&&(r.allowedChats=i)),"everybody"!==t&&"contacts"!==t||(o=s.map(l).filter(Boolean),i=s.map(d).filter(Boolean),o.length>0&&(r.blockedUsers=o),i.length>0&&(r.blockedChats=i)),r}Object(s.b)("loadFullUser",(e,t,a)=>{const{userId:s}=a,n=Object(o.Gb)(e,s);if(!n)return;const{id:c,accessHash:r}=n;B(()=>Object(j.a)("fetchFullUser",{id:c,accessHash:r}))}),Object(s.b)("loadUser",(e,t,a)=>{const{userId:n}=a,c=Object(o.Gb)(e,n);c&&(async()=>{const t=await Object(j.a)("fetchUsers",{users:[c]});t&&(e=Object(s.e)(),e=Object(r.ob)(e,Object(d.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(j.a)("fetchTopUsers",{hash:e});if(!t)return;const{hash:a,ids:n,users:c}=t;let o=Object(s.e)();o=Object(r.f)(o,Object(d.c)(c,"id")),o={...o,topPeers:{...o.topPeers,hash:a,userIds:n,lastRequestedAt:Date.now()/1e3+o.serverTimeOffset}},Object(s.g)(o)}(a)}),Object(s.b)("loadContactList",e=>{const{hash:t}=e.contactList||{};!async function(e){const t=await Object(j.a)("fetchContactList",{hash:e});if(!t)return;let a=Object(r.f)(Object(s.e)(),Object(d.c)(t.users,"id"));a=Object(r.c)(a,Object(d.c)(t.chats,"id"));const n=e=>e.lastName||e.firstName||"",c=new Intl.Collator("en-US"),o=t.users.sort((e,t)=>c.compare(n(e),n(t))).filter(e=>!e.isSelf);Object(s.g)({...a,contactList:{hash:t.hash,userIds:o.map(e=>e.id)}})}(t)}),Object(s.b)("loadCurrentUser",()=>{Object(j.a)("fetchCurrentUser")}),Object(s.b)("updateContact",(e,t,a)=>{const{userId:n,isMuted:c,firstName:i,lastName:d}=a;!async function(e,t,a,n){const c=Object(s.e)(),i=Object(o.Gb)(c,e);if(!i)return;Object(s.d)().updateChatMutedState({chatId:e,isMuted:t}),Object(s.g)(Object(r.bb)(Object(s.e)(),l.f.InProgress));await Object(j.a)("updateContact",{phone:i.phoneNumber,firstName:a,lastName:n})&&Object(s.g)(Object(r.nb)(Object(s.e)(),i.id,{firstName:a,lastName:n}));Object(s.g)(Object(r.bb)(Object(s.e)(),l.f.Complete))}(n,c,i,d)}),Object(s.b)("deleteUser",(e,t,a)=>{const{userId:n}=a;!async function(e){const t=Object(s.e)(),a=Object(o.Gb)(t,e);if(!a)return;const{id:n,accessHash:c}=a;await Object(j.a)("deleteUser",{id:n,accessHash:c})}(n)}),Object(s.b)("loadProfilePhotos",(e,t,a)=>{const{profileId:n}=a,c=Object(h.mb)(n),i=c?Object(o.Gb)(e,n):void 0,l=c?void 0:Object(o.f)(e,n);(async()=>{const e=await Object(j.a)("fetchProfilePhotos",i,l);if(!e||!e.photos)return;let t=Object(s.e)();c?t=Object(r.nb)(t,n,{photos:e.photos}):(t=Object(r.f)(t,Object(d.c)(e.users,"id")),t=Object(r.H)(t,n,{photos:e.photos})),Object(s.g)(t)})()}),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.hb)||c.value.match(n.ib)?t.openTelegramLink({url:c.value}):t.toggleSafeLinkModal({url:c.value});break;case"callback":{const t=Object(o.r)(e);if(!t)return;!async function(e,t,a){const n=await Object(j.a)("answerCallbackButton",{chatId:e.id,accessHash:e.accessHash,messageId:t,data:a});if(!n||!n.message)return;const{message:c,alert:r}=n;r?Object(s.d)().showError({error:{message:c}}):Object(s.d)().showNotification({message:c})}(t,c.messageId,c.value);break}case"requestPoll":t.openPollModal();break;case"buy":{const a=Object(o.r)(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(o.k)(e,a.id,s)),t.openPaymentModal({messageId:s}));break}}}),Object(s.b)("sendBotCommand",(e,t,a)=>{const{command:s}=a,{currentUserId:n}=e,c=Object(o.r)(e);n&&c&&async function(e,t,a){await Object(j.a)("sendMessage",{chat:e,text:a})}(c,0,s)}),Object(s.b)("updateProfile",(e,t,a)=>{const{photo:n,firstName:c,lastName:i,bio:d,username:b}=a;(async()=>{const{currentUserId:t}=e;if(t){if(Object(s.g)({...Object(s.e)(),profileEdit:{progress:l.j.InProgress}}),n&&await Object(j.a)("updateProfilePhoto",n),c||i||d){if(await Object(j.a)("updateProfile",{firstName:c,lastName:i,about:d})){e=Object(s.e)();const a=t&&Object(o.Gb)(e,t);a&&Object(s.g)(Object(r.nb)(e,a.id,{firstName:c,lastName:i,fullInfo:{...a.fullInfo,bio:d}}))}}if(b){await Object(j.a)("updateUsername",b)&&t&&Object(s.g)(Object(r.nb)(Object(s.e)(),t,{username:b}))}Object(s.g)({...Object(s.e)(),profileEdit:{progress:l.j.Complete}})}})()}),Object(s.b)("checkUsername",(e,t,a)=>{const{username:n}=a;(async()=>{if(e.profileEdit&&e.profileEdit.progress===l.j.InProgress)return;Object(s.g)({...e,profileEdit:{progress:e.profileEdit?e.profileEdit.progress:l.j.Idle,isUsernameAvailable:void 0}});const t=await Object(j.a)("checkUsername",n);e=Object(s.e)(),Object(s.g)({...e,profileEdit:{...e.profileEdit,isUsernameAvailable:t}})})()}),Object(s.b)("loadWallpapers",()=>{(async()=>{const e=await Object(j.a)("fetchWallpapers",0);if(!e)return;const t=Object(s.e)();Object(s.g)({...t,settings:{...t.settings,loadedWallpapers:e.wallpapers}})})()}),Object(s.b)("uploadWallpaper",(e,t,a)=>{const n=a,c=URL.createObjectURL(n);Object(s.g)({...e,settings:{...e.settings,loadedWallpapers:[{slug:l.n,document:{fileName:"",size:n.size,mimeType:n.type,previewBlobUrl:c}},...e.settings.loadedWallpapers||[]]}}),(async()=>{const t=await Object(j.a)("uploadWallpaper",n);if(!t)return;const{wallpaper:a}=t;if(!(e=Object(s.e)()).settings.loadedWallpapers)return;const r=e.settings.loadedWallpapers[0];if(!r||r.slug!==l.n)return;const o={...a,document:{...a.document,previewBlobUrl:c}};Object(s.g)({...e,settings:{...e.settings,loadedWallpapers:[o,...e.settings.loadedWallpapers.slice(1)]}})})()}),Object(s.b)("loadBlockedContacts",()=>{(async()=>{const e=await Object(j.a)("fetchBlockedContacts");if(!e)return;let t=Object(s.e)();e.users&&e.users.length&&(t=Object(r.f)(t,Object(d.c)(e.users,"id"))),e.chats&&e.chats.length&&(t=Object(r.M)(t,Object(d.c)(e.chats,"id"))),t={...t,blocked:{...t.blocked,ids:[...t.blocked.ids||[],...e.blockedIds],totalCount:e.totalCount}},Object(s.g)(t)})()}),Object(s.b)("blockContact",(e,t,a)=>{const{contactId:n}=a;(async()=>{if(!await Object(j.a)("blockContact",n))return;const e=Object(s.e)();Object(s.g)(Object(r.a)(e,n))})()}),Object(s.b)("unblockContact",(e,t,a)=>{const{contactId:n}=a;let c;if(Object(h.mb)(n)){const t=Object(o.Gb)(e,n);if(!t)return;c=t.accessHash}(async()=>{if(!await Object(j.a)("unblockContact",n,c))return;const e=Object(s.e)();Object(s.g)(Object(r.p)(e,n))})()}),Object(s.b)("loadAuthorizations",()=>{(async()=>{const e=await Object(j.a)("fetchAuthorizations");e&&Object(s.g)({...Object(s.e)(),activeSessions:e})})()}),Object(s.b)("terminateAuthorization",(e,t,a)=>{const{hash:n}=a;(async()=>{if(!await Object(j.a)("terminateAuthorization",n))return;const e=Object(s.e)();Object(s.g)({...e,activeSessions:e.activeSessions.filter(e=>e.hash!==n)})})()}),Object(s.b)("terminateAllAuthorizations",()=>{(async()=>{if(!await Object(j.a)("terminateAllAuthorizations"))return;const e=Object(s.e)();Object(s.g)({...e,activeSessions:e.activeSessions.filter(e=>e.isCurrent)})})()}),Object(s.b)("loadNotificationExceptions",()=>{Object(j.a)("fetchNotificationExceptions")}),Object(s.b)("loadNotificationSettings",e=>{const{serverTimeOffset:t}=e;(async()=>{const e=await Object(j.a)("fetchNotificationSettings",{serverTimeOffset:t});e&&Object(s.g)(Object(r.v)(Object(s.e)(),e))})()}),Object(s.b)("updateNotificationSettings",(e,t,a)=>{const{peerType:n,isSilent:c,shouldShowPreviews:o}=a;(async()=>{await Object(j.a)("updateNotificationSettings",n,{isSilent:c,shouldShowPreviews:o})&&Object(s.g)(Object(r.cb)(Object(s.e)(),n,c,o))})()}),Object(s.b)("updateContactSignUpNotification",(e,t,a)=>{const{isSilent:n}=a;(async()=>{await Object(j.a)("updateContactSignUpNotification",n)&&Object(s.g)(Object(r.v)(Object(s.e)(),{hasContactJoinedNotifications:!n}))})()}),Object(s.b)("loadLanguages",()=>{(async()=>{const e=await Object(j.a)("fetchLanguages");e&&Object(s.g)(Object(r.v)(Object(s.e)(),{languages:e}))})()}),Object(s.b)("loadPrivacySettings",()=>{(async()=>{const[e,t,a,n,c]=await Promise.all([Object(j.a)("fetchPrivacySettings","phoneNumber"),Object(j.a)("fetchPrivacySettings","lastSeen"),Object(j.a)("fetchPrivacySettings","profilePhoto"),Object(j.a)("fetchPrivacySettings","forwards"),Object(j.a)("fetchPrivacySettings","chatInvite")]);if(!(e&&t&&a&&n&&c))return;const r=Object(s.e)();r.settings.privacy.phoneNumber=e,r.settings.privacy.lastSeen=t,r.settings.privacy.profilePhoto=a,r.settings.privacy.forwards=n,r.settings.privacy.chatInvite=c,Object(s.g)(r)})()}),Object(s.b)("setPrivacyVisibility",(e,t,a)=>{const{privacyKey:n,visibility:c}=a,{privacy:{[n]:r}}=e.settings;if(!r)return;const o=U(e,{visibility:c,allowedIds:[...r.allowUserIds,...r.allowChatIds],deniedIds:[...r.blockUserIds,...r.blockChatIds]});(async()=>{const e=await Object(j.a)("setPrivacySettings",n,o);if(e){const t=Object(s.e)();t.settings.privacy[n]=e,Object(s.g)(t)}})()}),Object(s.b)("setPrivacySettings",(e,t,a)=>{const{privacyKey:n,isAllowList:c,contactsIds:r}=a,{privacy:{[n]:o}}=e.settings;if(!o)return;const i=U(e,{visibility:o.visibility,allowedIds:c?r:[...o.allowUserIds,...o.allowChatIds],deniedIds:c?[...o.blockUserIds,...o.blockChatIds]:r});(async()=>{const e=await Object(j.a)("setPrivacySettings",n,i);if(e){const t=Object(s.e)();t.settings.privacy[n]=e,Object(s.g)(t)}})()}),Object(s.b)("updateIsOnline",(e,t,a)=>{Object(j.a)("updateIsOnline",a)}),Object(s.b)("loadPasswordInfo",()=>{(async()=>{const e=await Object(j.a)("getPasswordInfo");if(!e)return;let t=Object(s.e)();t=Object(r.v)(t,{hasPassword:e.hasPassword}),t=Object(r.mb)(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(r.mb)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await Object(j.a)("checkPassword",n);Object(s.g)(Object(r.mb)(Object(s.e)(),{isLoading:!1})),e&&c()})()}),Object(s.b)("clearPassword",(e,t,a)=>{const{currentPassword:n,onSuccess:c}=a;Object(s.g)(Object(r.mb)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await Object(j.a)("clearPassword",n);Object(s.g)(Object(r.mb)(Object(s.e)(),{isLoading:!1})),e&&c()})()}),Object(s.b)("updatePassword",(e,t,a)=>{const{currentPassword:n,password:c,hint:o,email:i,onSuccess:l}=a;Object(s.g)(Object(r.mb)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await Object(j.a)("updatePassword",n,c,o,i);Object(s.g)(Object(r.mb)(Object(s.e)(),{isLoading:!1})),e&&l()})()}),Object(s.b)("updateRecoveryEmail",(e,t,a)=>{const{currentPassword:n,email:c,onSuccess:o}=a;Object(s.g)(Object(r.mb)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await Object(j.a)("updateRecoveryEmail",n,c);Object(s.g)(Object(r.mb)(Object(s.e)(),{isLoading:!1,waitingEmailCodeLength:void 0})),e&&o()})()}),Object(s.b)("provideTwoFaEmailCode",(e,t,a)=>{const{code:s}=a;Object(j.a)("provideRecoveryEmailCode",s)}),Object(s.b)("clearTwoFaError",e=>Object(r.mb)(e,{error:void 0}));var H=a(60);Object(s.b)("validateRequestedInfo",(e,t,a)=>{const{requestInfo:n,saveInfo:c}=a,i=Object(o.hb)(e);i&&async function(e,t,a){const n=await Object(j.a)("validateRequestedInfo",{messageId:e,requestInfo:t,shouldSave:a});if(!n)return;const{id:c,shippingOptions:o}=n;if(!c)return;let i=Object(r.E)(Object(s.e)(),c);o?(i=Object(r.gb)(i,o),i=Object(r.C)(i,l.i.Shipping)):i=Object(r.C)(i,l.i.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(j.a)("getPaymentForm",{messageId:e});if(!t)return;let a=Object(r.B)(Object(s.e)(),t),n=l.i.PaymentInfo;a.payment.invoice&&(a.payment.invoice.shippingAddressRequested||a.payment.invoice.nameRequested||a.payment.invoice.phoneRequested||a.payment.invoice.emailRequested)&&(n=l.i.ShippingInfo);a=Object(r.C)(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(j.a)("getReceipt",t);if(!n)return;let c=Object(s.e)();const i=Object(o.k)(c,a,e);c=Object(r.D)(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(o.kb)(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(H.b)(c.error),t=Object(s.e)();return void Object(s.g)({...t,payment:{...t.payment,error:{...e}}})}let o=Object(r.F)(Object(s.e)(),{type:c.type,id:c.id});o=Object(r.C)(o,l.i.Checkout),Object(s.g)(o)}(i,n)}),Object(s.b)("sendPaymentForm",(e,t,a)=>{const{shippingOptionId:n,saveCredentials:c}=a,i=Object(o.hb)(e),l=Object(o.ib)(e),d=Object(o.kb)(e),b=Object(o.zb)(e);i&&d&&async function(e,t,a,n){if(await Object(j.a)("sendPaymentForm",{messageId:e,credentials:t,requestedInfoId:a,shippingOptionId:n})){const e=Object(r.h)(Object(s.e)());Object(s.g)(Object(r.i)(e))}}(i,{save:c,data:b},l,n)}),Object(s.b)("setPaymentStep",(e,t,a={})=>Object(r.C)(e,a.step||l.i.ShippingInfo)),Object(s.b)("setInvoiceMessageInfo",(e,t,a)=>Object(r.A)(e,a));a(88);var G=a(30),q=a(78);const _=Object(g.g)(e=>e(),1e3,!0);Object(s.b)("apiUpdate",(e,t,a)=>{switch(a["@type"]){case"updateChat":{a.noTopChatsRequest||Object(o.M)(e,a.id)||t.loadTopChats();const n=Object(r.H)(e,a.id,a.chat,a.newProfilePhoto);Object(s.g)(n);const c=Object(o.q)(n);_(()=>Object(q.a)(c));break}case"updateChatJoin":{const n=Object(o.j)(e,a.id);if(!n)break;e=Object(r.I)(e,n,[a.id]),e=Object(r.H)(e,a.id,{isNotJoined:!1}),Object(s.g)(e);const c=Object(o.f)(e,a.id);c&&t.requestChatUpdate({chatId:c.id});break}case"updateChatLeave":{const t=Object(o.j)(e,a.id);if(!t)break;const{[t]:n}=e.chats.listIds;n&&(e=Object(r.r)(e,t,n.filter(e=>e!==a.id))),e=Object(r.H)(e,a.id,{isNotJoined:!0}),Object(s.g)(e);break}case"updateChatInbox":Object(s.g)(Object(r.H)(e,a.id,a.chat));break;case"updateChatTypingStatus":{const{id:t,typingStatus:n}=a;Object(s.g)(Object(r.H)(e,t,{typingStatus:n})),setTimeout(()=>{const e=Object(s.e)(),a=Object(o.f)(e,t);a&&n&&a.typingStatus&&a.typingStatus.timestamp===n.timestamp&&Object(s.g)(Object(r.H)(e,t,{typingStatus:void 0}))},6e3);break}case"newMessage":{const{message:n}=a,{chatId:c,threadId:l,type:d}=Object(o.y)(e)||{};if(n.senderId===e.currentUserId&&!n.isFromScheduled)return;const b=Object(o.f)(e,a.chatId);if(!b)return;const u="thread"===d&&l===i.MAIN_THREAD_ID&&a.chatId===c;u?setTimeout(()=>{t.requestChatUpdate({chatId:a.chatId})},1e3):Object(s.g)(Object(r.H)(e,a.chatId,{unreadCount:b.unreadCount?b.unreadCount+1:1,...a.message.hasUnreadMention&&{unreadMentionsCount:b.unreadMentionsCount?b.unreadMentionsCount+1:1}}));const m=Object(o.q)(Object(s.e)());Object(q.a)(m),Object(G.b)({chat:b,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(o.p)(e,t),n=Object(o.f)(e,s);n&&n.unreadMentionsCount&&(e=Object(r.H)(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(r.H)(e,a.id,{fullInfo:{...n.fullInfo,...t}}));break}case"updatePinnedChatIds":{const{ids:t,folderId:c}=a,r=c===n.h?"archived":"active";e={...e,chats:{...e.chats,orderedPinnedIds:{...e.chats.orderedPinnedIds,[r]:t.length?t:void 0}}},Object(s.g)(e);break}case"updateChatPinned":{const{id:t,isPinned:c}=a,r=Object(o.j)(e,t);if(r){const{[r]:a}=e.chats.orderedPinnedIds;let s=a||[];if(c){if(!s.includes(t)){if("active"===r&&s.length>=n.K){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,[r]:s.length?s:void 0}}}}Object(s.g)(e);break}case"updateChatListType":{const{id:t,folderId:n}=a;Object(s.g)(Object(r.K)(e,t,n));break}case"updateChatFolder":{const{id:t,folder:n}=a,{byId:c,orderedIds:r}=e.chatFolders,o=n?{...c,[t]:n}:Object(d.l)(c,Object.keys(c).map(Number).filter(e=>e!==t)),i=n?r&&r.includes(t)?r:[...r||[],t]:r?r.filter(e=>e!==t):void 0;Object(s.g)({...e,chatFolders:{...e.chatFolders,byId:o,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:o}=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&&o){const e=l.findIndex(e=>e.userId===o);e>-1&&(l.slice(e,1),i=!0)}if(i){const n=l.filter(({isOwner:e,isAdmin:t})=>e||t);Object(s.g)(Object(r.H)(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(r.H)(e,t,{photos:c.photos.filter(e=>!n.includes(e.id))}));break}case"draftMessage":{const{chatId:t,formattedText:n,replyingToId:c}=a;e.chats.byId[t]&&(e=Object(r.x)(e,t,i.MAIN_THREAD_ID,"draft",n),e=Object(r.x)(e,t,i.MAIN_THREAD_ID,"replyingToId",c),Object(s.g)(e))}}});function V(e,t,a,s,n=!1){const c=n?Object(o.pb)(e,t,a):Object(o.k)(e,t,a);if(c&&s.content){const{photo:e,video:t,sticker:a,document:n}=Object(h.w)(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(r.eb)(e,t,a,s):Object(r.L)(e,t,a,s)}function $(e,t){const{id:a,chatId:s}=t,n=Object(o.f)(e,s);if(n&&n.unreadCount&&!Object(o.Y)(e,s,i.MAIN_THREAD_ID))return e;if(e=Object(r.V)(e,s,i.MAIN_THREAD_ID,[a]),Object(o.X)(e,s,i.MAIN_THREAD_ID)){const t=Object(o.H)(e,s,i.MAIN_THREAD_ID),n=Object(r.g)(e,s,i.MAIN_THREAD_ID,a),c=Object(o.Hb)(n,s,i.MAIN_THREAD_ID);t&&!c.includes(t)||(e=n)}const{threadInfo:c,firstMessageId:l}=Object(o.Bb)(e,s,t)||{};return!l&&Object(h.tb)(t)||c&&(e=Object(r.V)(e,s,c.threadId,[a]),Object(o.X)(e,s,c.threadId)&&(e=Object(r.g)(e,s,c.threadId,a),l||(e=Object(r.x)(e,s,c.threadId,"firstMessageId",t.id)),c.lastMessageId||(e=Object(r.x)(e,s,c.threadId,"threadInfo",{...c,lastMessageId:t.id})))),e}function z(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(r.H)(e,t,{lastMessage:a})}function W(e,t){const a=Object(o.m)(e,t),s=Object(o.Y)(e,t,i.MAIN_THREAD_ID);if(!a||!s)return;let n=s.length;for(;n--;){const e=a[s[n]];if(!e.isDeleting)return e}}function K(e,t,a,n){if(e){t.forEach(t=>{const a=W(n=Object(r.L)(n,e,t,{isDeleting:!0}),e);a&&(n=z(n,e,a,!0))}),Object(s.g)(n),a.requestChatUpdate({chatId:e});const c=[];return t.forEach(t=>{const a=Object(o.k)(n,e,t);if(!a)return;const{threadInfo:s}=Object(o.Bb)(n,e,a)||{};s&&c.push(s.threadId)}),Object(d.o)(c).forEach(t=>{a.requestThreadInfoUpdate({chatId:e,threadId:t})}),void setTimeout(()=>{Object(s.g)(Object(r.j)(Object(s.e)(),e,t))},350)}const c=[];t.forEach(e=>{const t=Object(o.p)(n,e);if(t){c.push(t);const a=W(n=Object(r.L)(n,t,e,{isDeleting:!0}),t);a&&(n=z(n,t,a,!0)),setTimeout(()=>{Object(s.g)(Object(r.j)(Object(s.e)(),t,[e]))},350)}}),Object(s.g)(n),Object(d.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=$(e=V(e,n,c,i),i),i.threadInfo&&(e=Object(r.kb)(e,i.threadInfo.chatId,i.threadInfo.threadId,i.threadInfo)),Object(s.g)(e);const l=Object(o.k)(e,n,c);if(Object(o.a)(e,n,i)){if(i.isOutgoing&&(!i.content||!i.content.action)){const a=Object(o.y)(e);a&&t.focusMessage({chatId:n,threadId:a.threadId,messageId:i.id,noHighlight:!0})}const{threadInfo:a}=Object(o.Bb)(e,n,i)||{};a&&t.requestThreadInfoUpdate({chatId:n,threadId:a.threadId}),Object(h.tb)(i)||setTimeout(()=>{Object(s.g)(z(Object(s.e)(),n,l))},350)}else Object(s.g)(z(Object(s.e)(),n,l));Object(o.M)(e,n)||t.loadTopChats();break}case"newScheduledMessage":{const{chatId:t,id:n,message:c}=a;e=V(e,t,n,c,!0);const l=Object(o.ob)(e,t)||[];e=Object(r.x)(e,t,i.MAIN_THREAD_ID,"scheduledIds",Object(d.o)([...l,n])),Object(s.g)(e);break}case"updateMessage":{const{chatId:t,id:n,message:c}=a;if(!Object(o.k)(e,t,n))return;e=V(e,t,n,c);const i=Object(o.k)(e,t,n);c.threadInfo&&(e=Object(r.kb)(e,c.threadInfo.chatId,c.threadInfo.threadId,c.threadInfo)),e=z(e,t,i),Object(s.g)(e);break}case"updateScheduledMessage":{const{chatId:t,id:n,message:c}=a;if(!Object(o.pb)(e,t,n))return;e=V(e,t,n,c,!0);const l=Object.keys(Object(o.qb)(e,t)||{}).map(Number).sort((e,t)=>t-e);e=Object(r.x)(e,t,i.MAIN_THREAD_ID,"scheduledIds",l),Object(s.g)(e);break}case"updateMessageSendSucceeded":{const{chatId:t,localId:n,message:c}=a;e=$(e,c);const i=Object(o.k)(e,t,n);e=Object(r.j)(e,t,[n]),c.isScheduled&&(e=Object(r.k)(e,t,[n])),e=Object(r.L)(e,t,c.id,{...i,...c,previousLocalId:n});const l=Object(o.k)(e,t,c.id);e=z(e,t,l),Object(s.g)(e);break}case"updateScheduledMessageSendSucceeded":{const{chatId:t,localId:n,message:c}=a,l=Object(o.ob)(e,t)||[];e=Object(r.x)(e,t,i.MAIN_THREAD_ID,"scheduledIds",[...l,c.id]);const d=Object(o.pb)(e,t,n);e=Object(r.k)(e,t,[n]),e=Object(r.eb)(e,t,c.id,{...d,...c,previousLocalId:n}),Object(s.g)(e);break}case"updatePinnedIds":{const{chatId:t,isPinned:n,messageIds:c}=a,l=Object(o.jb)(e,t)||[],d=n?[...l,...c].sort((e,t)=>t-e):l.filter(e=>!c.includes(e));Object(s.g)(Object(r.x)(e,t,i.MAIN_THREAD_ID,"pinnedIds",d));break}case"updateThreadInfo":{const{chatId:t,threadId:n,threadInfo:c,firstMessageId:i}=a,l={...Object(o.Cb)(e,t,n),...c};if(!l.threadId)return;e=Object(r.kb)(e,t,n,l),i&&(e=Object(r.x)(e,t,n,"firstMessageId",i)),Object(s.g)(e);break}case"resetMessages":{const{id:n}=a,c=Object(o.m)(e,n);c&&!Object(h.mb)(n)&&(e=Object(r.j)(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;K(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(r.eb)(n,e,t,{isDeleting:!0})}),Object(s.g)(n),setTimeout(()=>{n=Object(r.k)(Object(s.e)(),e,t);const a=Object(o.qb)(n,e);n=Object(r.x)(n,e,i.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;K(s,Object.keys(e.messages.byChatId[s].byId).map(Number),t,e);break}case"updateCommonBoxMessages":{const{ids:t,messageUpdate:n}=a;t.forEach(t=>{const a=Object(o.p)(e,t);a&&(e=Object(r.L)(e,a,t,n))}),Object(s.g)(e);break}case"updateChannelMessages":{const{channelId:t,ids:n,messageUpdate:c}=a;n.forEach(a=>{e=Object(r.L)(e,t,a,c)}),Object(s.g)(e);break}case"updateMessagePoll":{const{pollId:t,pollUpdate:n}=a,c=Object(o.l)(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(r.L)(e,c.chatId,c.id,{content:{...c.content,poll:t}}))}break}case"updateMessagePollVote":{const{pollId:t,userId:n,options:c}=a,i=Object(o.l)(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(r.L)(e,i.chatId,i.id,{content:{...i.content,poll:{...l,results:{...l.results,recentVoterIds:m,totalVoters:h,results:O}}}}));break}}});const Q=Object(g.g)((function(){let e=Object(s.e)();Y.forEach(([t,a])=>{e=Object(r.nb)(e,t,{status:a})}),Object(s.g)(e),Y=[]}),3e3,!0);let Y=[];Object(s.b)("apiUpdate",(e,t,a)=>{switch(a["@type"]){case"deleteUser":return Object(r.l)(e,a.id);case"updateUser":return Object(r.nb)(e,a.id,a.user);case"updateUserStatus":return s=a.userId,n=a.status,Y.push([s,n]),void Q();case"updateUserFullInfo":{const{id:t,fullInfo:s}=a,n=e.users.byId[t];if(!n)return;return Object(r.nb)(e,t,{fullInfo:{...n.fullInfo,...s}})}}var s,n}),Object(s.b)("apiUpdate",(e,t,a)=>{switch(a["@type"]){case"updateStickerSet":return Object(r.hb)(e,a.id,a.stickerSet)}}),Object(s.b)("apiUpdate",(e,t,a)=>{switch(a["@type"]){case"updatePeerBlocked":return a.isBlocked?Object(r.a)(Object(s.e)(),a.id):Object(r.p)(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(r.cb)(e,a.peerType,a.isSilent,a.shouldShowPreviews);case"updateNotifyExceptions":{const{id:t,isMuted:n,isSilent:c,shouldShowPreviews:o}=a;e.chats.byId[t]&&(e=Object(r.H)(e,t,{isMuted:n})),Object(s.g)(Object(r.e)(e,t,{isMuted:n,isSilent:c,shouldShowPreviews:o}));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 J=a(48),X=a(8),Z=a(35),ee=a(128),te=a(47),ae=a(112),se=a(77),ne=a(26),ce=a(62),re=a(42),oe=a(23),ie=a(155),le=a(142);a(199);var de=Object(c.h)(({id:e,name:t,value:a,label:s,checked:n=!1,disabled:r,inactive:o,noAnimation:i,onChange:l,onCheck:d})=>{const b=Object(c.m)(e=>{l&&l(e),d&&d(e.currentTarget.checked)},[l,d]),u=Object(X.a)("Switcher",r&&"disabled",o&&"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:r,onChange:b}),c.a.createElement("span",{className:"widget"}))});a(200);const be=[0,1,2];var ue=Object(c.h)(Object(s.h)(e=>{const{query:t,fetchingStatus:a,chatId:s,date:n}=e.globalSearch,{currentUserId:c}=e,{byId:r}=e.chats,{theme:o,animationLevel:i}=e.settings.byKey;return{searchQuery:t,isLoading:!!a&&Boolean(a.chats||a.messages),currentUserId:c,chatsById:r,globalSearchChatId:s,searchDate:n,theme:o,animationLevel:i}},(e,t)=>Object(d.l)(t,["openChat","openTipsChat","setGlobalSearchDate","setGlobalSearchChatId","setSettingOption"]))(({content:e,contactsFilter:t,onSearchQuery:a,onSelectSettings:s,onSelectContacts:r,onSelectArchived:o,setGlobalSearchChatId:i,onReset:d,searchQuery:u,isLoading:m,currentUserId:O,globalSearchChatId:j,searchDate:g,theme:f,animationLevel:p,chatsById:I,openChat:v,openTipsChat:y,setGlobalSearchDate:C,setSettingOption:E})=>{const w=Object(ne.a)(),M=e===l.d.ChatList,S={date:void 0},k={id:void 0},N=Object(c.p)(()=>g?Object(x.a)(new Date(1e3*g)):void 0,[g]),T=Object(c.p)(()=>M&&I?Object.values(I).reduce((e,t)=>Object(h.ib)(t)&&t.unreadCount?e+1:e,0):0,[M,I]),P=Object(c.p)(()=>({onTrigger:e,isOpen:t})=>c.a.createElement(oe.a,{round:!0,ripple:M&&!b.g,size:"smaller",color:"translucent",className:t?"active":"",onClick:M?e:()=>d(),ariaLabel:M?w("AccDescrOpenMenu2"):"Return to chat list"},c.a.createElement("div",{className:Object(X.a)("animated-menu-icon",!M&&"state-back")})),[M,w,d]),A=Object(c.m)(()=>{u||a("")},[u,a]),R=Object(c.m)(()=>{v({id:O})},[O,v]),L=Object(c.m)(e=>{e.stopPropagation();const t="light"===f?"dark":"light";E({theme:t}),Object(se.a)(t,p>0)},[p,E,f]),F=Object(c.m)(e=>{e.stopPropagation();const t=0===p?2:0;be.forEach((e,a)=>{document.body.classList.toggle("animation-level-"+a,t===a)}),E({animationLevel:t})},[p,E]),D=Boolean(j)||e===l.d.GlobalSearch||e===l.d.Contacts,B=e===l.d.Contacts?w("SearchFriends"):w("Search");return c.a.createElement("div",{className:"LeftMainHeader"},c.a.createElement("div",{id:"LeftMainHeader",className:"left-header"},c.a.createElement(ce.a,{trigger:P,footer:`${n.f} alpha ${n.g}`},c.a.createElement(re.a,{icon:"saved-messages",onClick:R},w("SavedMessages")),c.a.createElement(re.a,{icon:"archive",onClick:o},c.a.createElement("span",{className:"menu-item-name"},w("ArchivedChats")),T>0&&c.a.createElement("div",{className:"archived-badge"},T)),c.a.createElement(re.a,{icon:"user",onClick:r},w("Contacts")),c.a.createElement(re.a,{icon:"settings",onClick:s},w("Settings")),c.a.createElement(re.a,{icon:"darkmode",onClick:L},c.a.createElement("span",{className:"menu-item-name"},w("lng_menu_night_mode")),c.a.createElement(de,{id:"darkmode",label:w("dark"===f?"lng_settings_disable_night_theme":"lng_settings_enable_night_theme"),checked:"dark"===f,noAnimation:!0})),c.a.createElement(re.a,{icon:"animations",onClick:F},c.a.createElement("span",{className:"menu-item-name capitalize"},w("Appearance.Animations").toLowerCase()),c.a.createElement(de,{id:"animations",label:"Toggle Animations",checked:p>0})),c.a.createElement(re.a,{icon:"help",onClick:y},w("TelegramFeatures")),c.a.createElement(re.a,{icon:"bug",href:n.x},"Report Bug"),c.a.createElement(re.a,{icon:"char-K",href:"https://web.telegram.org/k/",onClick:()=>{localStorage.setItem("kz_version",JSON.stringify("K"))}},"Switch to K Version"),c.a.createElement(re.a,{icon:"char-W",href:"https://web.telegram.org/?legacy=1"},"Switch to Old Version")),c.a.createElement(ie.a,{inputId:"telegram-search-input",parentContainerClassName:"LeftSearch",className:j||g?"with-picker-item":"",value:t||u,focused:D,isLoading:m,placeholder:B,autoComplete:"off",canClose:Boolean(j||g),onChange:a,onReset:d,onFocus:A},N&&c.a.createElement(le.a,{icon:"calendar",title:N,canClose:!0,isMinimized:Boolean(j),className:"search-date",onClick:C,clickArg:S}),j&&c.a.createElement(le.a,{chatOrUserId:j,onClick:i,canClose:!0,clickArg:k}))))})),me=a(21);a(201);var he=Object(s.h)(e=>Object(d.l)(e,["connectionState"]))(({connectionState:e})=>{const t=Object(ne.a)();return"connectionStateConnecting"===e&&c.a.createElement("div",{id:"ConnectionState",dir:t.isRtl?"rtl":void 0},c.a.createElement(me.a,{color:"black"}),c.a.createElement("div",{className:"state-text"},t("WaitingForNetwork")))}),Oe=a(133),je=a(51),ge=a(27),fe=(e,t,a)=>{const s=Object(c.q)(),n=(e=>Object(c.p)(()=>Object(g.g)(e=>e(),e),[e]))(t),r=Object(ge.a)();return Object(je.a)(()=>{let t=!0;n(()=>{s.current=e(),t||r()}),t=!1},a),s.current},pe=a(169),Ie=a(191);var ve=Object(c.h)(Object(s.h)(e=>{const{chats:{byId:t},users:{byId:a},chatFolders:{byId:s,orderedIds:n,activeChatFolder:c},currentUserId:r,lastSyncTime:i}=e;return{chatsById:t,usersById:a,chatFoldersById:s,orderedFolderIds:n,lastSyncTime:i,notifySettings:Object(o.eb)(e),notifyExceptions:Object(o.db)(e),activeChatFolder:c,currentUserId:r}},(e,t)=>Object(d.l)(t,["loadChatFolders","setActiveChatFolder","openChat"]))(({chatsById:e,usersById:t,chatFoldersById:a,notifySettings:s,notifyExceptions:n,orderedFolderIds:r,activeChatFolder:o,currentUserId:i,lastSyncTime:l,loadChatFolders:u,setActiveChatFolder:m,openChat:O})=>{const j=Object(c.q)(null),g=Object(ne.a)();Object(c.n)(()=>{l&&u()},[l,u]);const f=Object(c.p)(()=>r?r.map(e=>a[e]||{}).filter(Boolean):void 0,[a,r]),p=fe(()=>{if(!f||!f.length)return;const a=Object.keys(e).map(Number),c=f.map(c=>{const{unreadDialogsCount:r,hasActiveDialogs:o}=Object(h.p)(e,t,c,a,s,n)||{};return{id:c.id,badgeCount:r,isBadgeActive:o}});return Object(d.c)(c,"id")},3e3,[f,e,t,s,n]),I=Object(c.p)(()=>{if(f&&f.length)return[{title:g("FilterAllChats")},...f.map(e=>({title:e.title,...p&&p[e.id]}))]},[f,p,g]),v=Object(c.m)(e=>{m(e)},[m]);Object(c.n)(()=>{I&&I.length&&o>=I.length&&m(0)},[o,I,m]),Object(c.n)(()=>{if(j.current&&b.l&&I&&I.length)return Object(Oe.b)(j.current,{onSwipe:(e,t)=>{t===Oe.a.Left?m(Math.min(o+1,I.length-1)):t===Oe.a.Right&&m(Math.max(0,o-1))}})},[o,I,m]);const y=Object(c.q)();y.current=0!==o,Object(c.n)(()=>y.current?Object(te.a)(()=>{y.current&&m(0)}):void 0,[o,m]),Object(c.n)(()=>{const e=e=>{if(e.metaKey&&e.code.startsWith("Digit")&&I){const[,t]=e.code.match(/Digit(\d)/)||[];if(!t)return;if("0"===t)return void O({id:i});const a=Number(t)-1;if(a>I.length-1)return;m(a),e.preventDefault()}};return document.addEventListener("keydown",e,!0),()=>{document.removeEventListener("keydown",e,!0)}});const{shouldRender:C,transitionClassNames:E}=Object(Z.a)(!r,void 0,!0);function w(e){const t=Object.values(a).find(({title:e})=>e===I[o].title);return t&&0!==o?c.a.createElement(Ie.a,{folderType:"folder",folderId:t.id,noChatsText:g("FilterNoChatsToDisplay"),isActive:e}):c.a.createElement(Ie.a,{folderType:"all",isActive:e})}return c.a.createElement("div",{className:"ChatFolders"},I&&I.length?c.a.createElement(pe.a,{tabs:I,activeTab:o,onSwitchTab:v}):C?c.a.createElement("div",{className:Object(X.a)("tabs-placeholder",E)}):void 0,c.a.createElement(ae.a,{ref:j,name:g.isRtl?"slide-reversed":"slide",activeKey:o,renderCount:I?I.length:void 0},w))})),ye=a(12),Ce=a(20),Ee=a(16);var we=Object(c.h)(e=>{const t=Object(Ce.a)(ye.a.Extra,"LeftSearch");return t?c.a.createElement(t,e):c.a.createElement(Ee.a,null)});var Me=Object(c.h)(e=>{const t=Object(Ce.a)(ye.a.Extra,"ContactList");return t?c.a.createElement(t,e):c.a.createElement(Ee.a,null)}),Se=a(53);a(212);let ke;var Ne=Object(c.h)(({isShown:e,onNewPrivateChat:t,onNewChannel:a,onNewGroup:s})=>{const[n,r]=Object(c.r)(!1);Object(c.n)(()=>{e||r(!1)},[e]);const o=Object(ne.a)(),i=Object(X.a)("NewChatButton",e&&"revealed",n&&"menu-is-open"),l=Object(c.m)(()=>{ke&&(clearTimeout(ke),ke=void 0)},[]),d=Object(c.m)(()=>{ke&&(clearTimeout(ke),ke=void 0),ke=window.setTimeout(()=>{r(!1)},750)},[]);return c.a.createElement("div",{className:i,onMouseEnter:l,onMouseLeave:d},c.a.createElement(oe.a,{round:!0,color:"primary",className:n?"active":"",onClick:()=>{r(!n)},ariaLabel:o(n?"Close":"NewMessageTitle"),tabIndex:-1},c.a.createElement("i",{className:"icon-new-chat-filled"}),c.a.createElement("i",{className:"icon-close"})),c.a.createElement(Se.a,{isOpen:n,positionX:"right",positionY:"bottom",autoClose:!0,onClose:()=>{r(!1)}},c.a.createElement(re.a,{icon:"channel",onClick:a},o("NewChannel")),c.a.createElement(re.a,{icon:"group",onClick:s},o("NewGroup")),c.a.createElement(re.a,{icon:"user",onClick:t},o("NewMessageTitle"))))});a(213);const Te=Object.keys(l.d).length/2;let Pe;var Ae=Object(c.h)(({content:e,searchQuery:t,searchDate:a,contactsFilter:s,onSearchQuery:n,onContentChange:r,onReset:o})=>{const[i,d]=Object(c.r)(b.l),u=Object(c.q)(!1),m=Object(c.m)(()=>{r(l.d.Settings)},[r]),h=Object(c.m)(()=>{r(l.d.Contacts)},[r]),O=Object(c.m)(()=>{r(l.d.NewChannelStep1)},[r]),j=Object(c.m)(()=>{r(l.d.NewGroupStep1)},[r]),g=Object(c.m)(()=>{r(l.d.Archived)},[r]),f=Object(c.m)(()=>{e===l.d.ChatList&&(u.current=!0,d(!0))},[e]),p=Object(c.m)(()=>{u.current=!1,Pe&&(clearTimeout(Pe),Pe=void 0),Pe=window.setTimeout(()=>{u.current||d(!1)},250)},[]);return Object(c.n)(()=>{let t;return e!==l.d.ChatList?t=window.setTimeout(()=>{d(!1)},250):(u.current||b.l)&&d(!0),()=>{t&&(clearTimeout(t),t=void 0)}},[e]),c.a.createElement("div",{id:"LeftColumn-main",onMouseEnter:b.l?void 0:f,onMouseLeave:b.l?void 0:p},c.a.createElement(ue,{content:e,contactsFilter:s,onSearchQuery:n,onSelectSettings:m,onSelectContacts:h,onSelectArchived:g,onReset:o}),c.a.createElement(he,null),c.a.createElement(ae.a,{name:"zoom-fade",renderCount:Te,activeKey:e},n=>{switch(e){case l.d.ChatList:return c.a.createElement(ve,null);case l.d.GlobalSearch:return c.a.createElement(we,{searchQuery:t,searchDate:a,isActive:n,onReset:o});case l.d.Contacts:return c.a.createElement(Me,{filter:s});default:return}}),c.a.createElement(Ne,{isShown:i,onNewPrivateChat:h,onNewChannel:O,onNewGroup:j}))});var xe=Object(c.h)(e=>{const t=Object(Ce.a)(ye.a.Extra,"Settings");return t?c.a.createElement(t,e):c.a.createElement(Ee.a,null)});var Re=Object(c.h)(e=>{const t=Object(Ce.a)(ye.a.Extra,"NewChat");return t?c.a.createElement(t,e):c.a.createElement(Ee.a,null)});var Le,Fe=Object(c.h)(e=>{const t=Object(Ce.a)(ye.a.Extra,"ArchivedChats");return t?c.a.createElement(t,e):c.a.createElement(Ee.a,null)});a(214);!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"}(Le||(Le={}));const De=Object.keys(Le).length/2;var Be=Object(c.h)(Object(s.h)(e=>{const{globalSearch:{query:t,date:a},chatFolders:{activeChatFolder:s}}=e;return{searchQuery:t,searchDate:a,activeChatFolder:s}},(e,t)=>Object(d.l)(t,["setGlobalSearchQuery","setGlobalSearchChatId","resetChatCreation","setGlobalSearchDate","loadPasswordInfo","clearTwoFaError"]))(({searchQuery:e,searchDate:t,activeChatFolder:a,setGlobalSearchQuery:s,setGlobalSearchChatId:n,resetChatCreation:r,setGlobalSearchDate:o,loadPasswordInfo:i,clearTwoFaError:d})=>{const[u,m]=Object(c.r)(l.d.ChatList),[h,O]=Object(c.r)(l.m.Main),[j,g]=Object(c.r)(""),[f,p]=Object(c.r)(0);let I=Le.Main;switch(u){case l.d.Archived:I=Le.Archived;break;case l.d.Settings:I=Le.Settings;break;case l.d.NewChannelStep1:case l.d.NewChannelStep2:I=Le.NewChannel;break;case l.d.NewGroupStep1:case l.d.NewGroupStep2:I=Le.NewGroup}const v=Object(c.m)(e=>{if(u!==l.d.NewGroupStep2||e){if(u===l.d.NewGroupStep1){const e=document.getElementById("new-group-picker-search");e&&e.blur()}if(u===l.d.Settings)switch(h){case l.m.EditProfile:case l.m.Folders:case l.m.General:case l.m.Notifications:case l.m.Privacy:case l.m.Language:return void O(l.m.Main);case l.m.GeneralChatBackground:return void O(l.m.General);case l.m.GeneralChatBackgroundColor:return void O(l.m.GeneralChatBackground);case l.m.PrivacyPhoneNumber:case l.m.PrivacyLastSeen:case l.m.PrivacyProfilePhoto:case l.m.PrivacyForwarding:case l.m.PrivacyGroupChats:case l.m.PrivacyActiveSessions:case l.m.PrivacyBlockedUsers:case l.m.TwoFaDisabled:case l.m.TwoFaEnabled:case l.m.TwoFaCongratulations:return void O(l.m.Privacy);case l.m.PrivacyPhoneNumberAllowedContacts:case l.m.PrivacyPhoneNumberDeniedContacts:return void O(l.m.PrivacyPhoneNumber);case l.m.PrivacyLastSeenAllowedContacts:case l.m.PrivacyLastSeenDeniedContacts:return void O(l.m.PrivacyLastSeen);case l.m.PrivacyProfilePhotoAllowedContacts:case l.m.PrivacyProfilePhotoDeniedContacts:return void O(l.m.PrivacyProfilePhoto);case l.m.PrivacyForwardingAllowedContacts:case l.m.PrivacyForwardingDeniedContacts:return void O(l.m.PrivacyForwarding);case l.m.PrivacyGroupChatsAllowedContacts:case l.m.PrivacyGroupChatsDeniedContacts:return void O(l.m.PrivacyGroupChats);case l.m.TwoFaNewPassword:return void O(l.m.TwoFaDisabled);case l.m.TwoFaNewPasswordConfirm:return void O(l.m.TwoFaNewPassword);case l.m.TwoFaNewPasswordHint:return void O(l.m.TwoFaNewPasswordConfirm);case l.m.TwoFaNewPasswordEmail:return void O(l.m.TwoFaNewPasswordHint);case l.m.TwoFaNewPasswordEmailCode:return void O(l.m.TwoFaNewPasswordEmail);case l.m.TwoFaChangePasswordCurrent:case l.m.TwoFaTurnOff:case l.m.TwoFaRecoveryEmailCurrentPassword:return void O(l.m.TwoFaEnabled);case l.m.TwoFaChangePasswordNew:return void O(l.m.TwoFaChangePasswordCurrent);case l.m.TwoFaChangePasswordConfirm:return void O(l.m.TwoFaChangePasswordNew);case l.m.TwoFaChangePasswordHint:return void O(l.m.TwoFaChangePasswordConfirm);case l.m.TwoFaRecoveryEmail:return void O(l.m.TwoFaRecoveryEmailCurrentPassword);case l.m.TwoFaRecoveryEmailCode:return void O(l.m.TwoFaRecoveryEmail);case l.m.FoldersCreateFolder:case l.m.FoldersEditFolder:return void O(l.m.Folders)}u!==l.d.ChatList||0!==a?(m(l.d.ChatList),g(""),s({query:""}),o({date:void 0}),n({id:void 0}),r(),setTimeout(()=>{p(Date.now())},250)):m(l.d.GlobalSearch)}else m(l.d.NewGroupStep1)},[u,a,s,o,n,r,h]),y=Object(c.m)(t=>{u!==l.d.Contacts?(m(l.d.GlobalSearch),t!==e&&s({query:t})):g(t)},[u,s,e]);return Object(c.n)(()=>u!==l.d.ChatList||0===a?Object(te.a)(()=>v()):void 0,[a,u,v]),Object(c.n)(()=>{d(),h===l.m.Privacy&&i()},[d,i,h]),c.a.createElement(ae.a,{id:"LeftColumn",name:b.g?"slide-layers":"push-slide",renderCount:De,activeKey:I},a=>{switch(I){case Le.Archived:return c.a.createElement(Fe,{isActive:a,onReset:v});case Le.Settings:return c.a.createElement(xe,{currentScreen:h,onScreenSelect:O,onReset:v});case Le.NewChannel:return c.a.createElement(Re,{key:f,isChannel:!0,content:u,onContentChange:m,onReset:v});case Le.NewGroup:return c.a.createElement(Re,{key:f,content:u,onContentChange:m,onReset:v});default:return c.a.createElement(Ae,{content:u,searchQuery:e,searchDate:t,contactsFilter:j,onContentChange:m,onSearchQuery:y,onReset:v})}})})),Ue=a(140),He=a(11),Ge=a(13),qe=a(56);var _e=()=>{const[e,t]=Object(c.r)(qe.a.get());return Object(c.n)(()=>{const e=Object(g.g)(()=>{t(qe.a.get())},250,!1);return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]),e},Ve=a(176);function $e(e,t){const a=e<=n.db?16:32,s=function(e){if(e>n.ab){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.Z){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.db?54:64,r=t?s-a-c:s-a,o=e>n.db?Math.min(s-a,512):s-a,i=o/r,l=r/o;return{composerHiddenScale:i,toolbarHiddenScale:l,composerTranslateX:t?c/2*l:0,toolbarTranslateX:t?c/2*-1*i:0,unpinHiddenScale:o/258,toolbarForUnpinHiddenScale:258/o}}var ze=a(135),We=a(145),Ke=a(136),Qe=a(49),Ye=a(110),Je=a(124);var Xe=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Ce.a)(ye.a.Extra,"HeaderMenuContainer",!t);return a?c.a.createElement(a,e):void 0});var Ze=Object(c.h)(Object(s.h)((e,{chatId:t,threadId:a,messageListType:s})=>{const n=Object(o.f)(e,t),c=Boolean(n&&Object(h.kb)(n));if(n&&n.isRestricted)return{noMenu:!0};const r=Object(o.P)(e,t),l="thread"===s&&a===i.MAIN_THREAD_ID,d="thread"===s&&a!==i.MAIN_THREAD_ID,u=Object(o.W)(e),m=Boolean(Object(o.L)(e,t)),O=Boolean(l&&n&&(c||Object(h.ob)(n))&&n.isNotJoined),j=l||d,g=l&&!r&&!O,f=!Object(o.S)(e),p=l&&!O;return{noMenu:!(b.g&&O||b.g&&j||g||f||p),isChannel:c,isRightColumnShown:u,canStartBot:m,canSubscribe:O,canSearch:j,canMute:g,canSelect:f,canLeave:p}},(e,t)=>Object(d.l)(t,["joinChannel","sendBotCommand","openLocalTextSearch"]))(({chatId:e,threadId:t,noMenu:a,isChannel:s,canStartBot:n,canSubscribe:r,canSearch:o,canMute:i,canSelect:l,canLeave:d,isRightColumnShown:u,joinChannel:m,sendBotCommand:h,openLocalTextSearch:O})=>{const j=Object(c.q)(null),[g,f]=Object(c.r)(!1),[p,I]=Object(c.r)(void 0),v=Object(c.m)(()=>{f(!0);const e=j.current.getBoundingClientRect();I({x:e.right,y:e.bottom})},[]),y=Object(c.m)(()=>{f(!1)},[]),C=Object(c.m)(()=>{I(void 0)},[]),E=Object(c.m)(()=>{m({chatId:e})},[m,e]),w=Object(c.m)(()=>{h({command:"/start"})},[h]),M=Object(c.m)(()=>{if(O(),b.g){document.querySelector("#MobileSearch input").focus()}else setTimeout(()=>{const e=document.querySelector(".RightHeader .SearchInput input");e&&e.focus()},400)},[O]),S=Object(ne.a)();return c.a.createElement("div",{className:"HeaderActions"},!b.g&&r&&c.a.createElement(oe.a,{size:"tiny",ripple:!0,fluid:!0,onClick:E},S(s?"Subscribe":"Join Group")),!b.g&&n&&c.a.createElement(oe.a,{size:"tiny",ripple:!0,fluid:!0,onClick:w},S("Start")),!b.g&&o&&c.a.createElement(oe.a,{round:!0,ripple:u,color:"translucent",size:"smaller",onClick:M,ariaLabel:"Search in this chat"},c.a.createElement("i",{className:"icon-search"})),(b.g||!r)&&c.a.createElement(oe.a,{ref:j,className:g?"active":"",round:!0,ripple:!b.g,size:"smaller",color:"translucent",disabled:a,ariaLabel:"More actions",onClick:v},c.a.createElement("i",{className:"icon-more"})),p&&c.a.createElement(Xe,{chatId:e,threadId:t,isOpen:g,anchor:p,isChannel:s,canSubscribe:r,canSearch:o,canMute:i,canSelect:l,canLeave:d,onSubscribeChannel:E,onSearchClick:M,onClose:y,onCloseAnimationEnd:C}))})),et=a(116),tt=a(24),at=a(109),st=a(44);function nt(e){const t=e&&Object(h.F)(e),{sticker:a}=e&&e.content||{},s=t&&a&&!Object(b.p)()&&t.includes("image/webp"),[r,o]=Object(c.r)(st.a),i=e&&e.id;return Object(c.o)(()=>{s&&Object(st.c)("b64-"+i,t).then(o).catch(e=>{n.p&&console.error(e)})},[i,s,t]),s?r:t}var ct=a(118),rt=a(43),ot=a(34);function it(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 lt=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),r="clipPath"+e,o=function(e,t,a){let s="";if(3===a)s=it(0,0,2,t,1)+it(0,12,2,t+1,1)+it(0,25,2,t,1);else for(let e=0;e\n \n `}(r,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:o,markTranslateY:i,trackTranslateY:l,trackHeight:c,clipPathId:r}}(e,t),[e,t]);if(Object(c.n)(()=>{if(!a.current)return;const{trackHeight:e,trackTranslateY:t,markHeight:n,markTranslateY:c,clipPathId:r,clipPath:o}=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("#${r}")`;const d=s.querySelector("svg"),b=s.querySelector("div"),u=s.querySelector("defs");d||i&&(i.innerHTML=` ${o} `),u&&(u.innerHTML=o),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:r,markHeight:o,markTranslateY:i,clipPathId:l}=s;return c.a.createElement("div",{className:Object(X.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(-${r}px);`},c.a.createElement("span",null),c.a.createElement("div",{className:"pinned-message-border-mark",style:`height: ${o}px; transform: translateY(${i}px);`})))});var dt=Object(c.h)(({message:e,count:t,index:a,customTitle:s,className:n,onUnpinMessage:r,onClick:o,onAllPinnedClick:i})=>{const l=Object(ne.a)(),d=nt(e),b=Object(at.a)(Object(h.E)(e,"pictogram")),u=Object(h.O)(l,e,Boolean(d)),[m,O,j]=Object(ot.a)(),g=Object(c.m)(()=>{j(),r&&r(e.id)},[j,r,e.id]);return c.a.createElement("div",{className:Object(X.a)("HeaderPinnedMessage-wrapper",n)},t>1&&c.a.createElement(oe.a,{round:!0,size:"smaller",color:"translucent",className:"pin-list-button",ariaLabel:l("EventLogFilterPinnedMessages"),onClick:i},c.a.createElement("i",{className:"icon-pin-list"})),r&&c.a.createElement(oe.a,{round:!0,size:"smaller",color:"translucent",ariaLabel:l("UnpinMessageAlertTitle"),className:"unpin-button",onClick:O},c.a.createElement("i",{className:"icon-close"})),c.a.createElement(ct.a,{isOpen:m,onClose:j,text:"Would you like to unpin this message?",confirmLabel:"Unpin",confirmHandler:g}),c.a.createElement("div",{className:"HeaderPinnedMessage",onClick:o,dir:l.isRtl?"rtl":void 0},c.a.createElement(lt,{count:t,index:a}),d&&function(e,t){const{width:a,height:s}=Object(et.l)();return c.a.createElement("img",{src:t||e,width:a,height:s,alt:""})}(d,b),c.a.createElement("div",{className:"message-text"},c.a.createElement("div",{className:"title",dir:"auto"},s||`${l("PinnedMessage")} ${a>0?"#"+(t-a):""}`),c.a.createElement("p",{dir:"auto"},Object(tt.a)(u))),c.a.createElement(rt.a,null)))}),bt=a(54),ut=a(177);a(217);var mt=Object(s.h)((e,{message:t})=>({sender:Object(o.tb)(e,t)}),(e,t)=>Object(d.l)(t,["focusMessage","closeAudioPlayer"]))(({message:e,className:t,noUi:a,sender:s,focusMessage:n,closeAudioPlayer:r})=>{const o=Object(ne.a)(),i=s?Object(h.W)(o,s):void 0,l=bt.c(Object(h.E)(e,"inline")),{playPause:d,isPlaying:u}=Object(ut.a)(Object(h.B)(e),Object(h.r)(e),l,void 0,void 0,!0),m=Object(c.m)(()=>{n({chatId:e.chatId,messageId:e.id})},[n,e.chatId,e.id]),O=Object(c.m)(()=>{u&&d(),r()},[r,u,d]);if(a)return;const j=Object(h.u)(e);return c.a.createElement("div",{className:Object(X.a)("AudioPlayer",t),dir:o.isRtl?"rtl":void 0},c.a.createElement(oe.a,{round:!0,ripple:!b.g,color:"translucent",size:"smaller",className:Object(X.a)("toggle-play",u?"pause":"play"),onClick:d,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:m},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(tt.a)(t||s)),a&&c.a.createElement("div",{className:"subtitle",dir:"auto"},Object(tt.a)(a)))}(j):function(e,t){return c.a.createElement(c.a.Fragment,null,c.a.createElement("div",{className:"title",dir:"auto"},t&&Object(tt.a)(t)),c.a.createElement("div",{className:"subtitle",dir:"auto"},e))}(o("AttachAudio"),i),c.a.createElement(rt.a,null)),c.a.createElement(oe.a,{round:!0,className:"player-close",color:"translucent",size:"smaller",onClick:O,ariaLabel:"Close player"},c.a.createElement("i",{className:"icon-close"})))});a(218);var ht=Object(c.h)(Object(s.h)((e,{chatId:t,threadId:a,messageListType:s})=>{const{isLeftColumnShown:n,lastSyncTime:c}=e,{byId:r}=e.chats,l=Object(o.f)(e,t),{typingStatus:d}=l||{},{chatId:b,messageId:u}=e.audioPlayer,m=b&&u?Object(o.k)(e,b,u):void 0,h=Object(o.Db)(e,t,a);let O;if("pinned"===s){const a=Object(o.jb)(e,t);O=a&&a.length}else if("scheduled"===s){const a=Object(o.ob)(e,t);O=a&&a.length}else if("thread"===s&&a!==i.MAIN_THREAD_ID){const s=Object(o.Cb)(e,t,a);s&&(O=s.messagesCount)}const j={typingStatus:d,isLeftColumnShown:n,isRightColumnShown:Object(o.W)(e),isSelectModeActive:Object(o.S)(e),audioMessage:m,chat:l,chatsById:r,originChatId:h?h.id:t,messagesCount:O,isChatWithSelf:Object(o.P)(e,t),isChatWithBot:l&&Object(o.O)(e,l),lastSyncTime:c,notifySettings:Object(o.eb)(e),notifyExceptions:Object(o.db)(e)},g=Object(o.m)(e,t);if("thread"!==s||!g)return j;if(Object.assign(j,{messagesById:g}),a!==i.MAIN_THREAD_ID){const s=Object(o.Eb)(e,t,a),n=s?Object(o.k)(e,t,s):void 0,c=n?Object(o.K)(e,n):void 0;return{...j,pinnedMessageIds:s,canUnpin:!1,topMessageSender:c}}const f=Object(o.jb)(e,t);if(f&&f.length){const t=g[f[0]],{canUnpin:s}=t&&Object(o.b)(e,t,a)||{};return{...j,pinnedMessageIds:f,canUnpin:s}}return j},(e,t)=>Object(d.l)(t,["openChatWithInfo","pinMessage","focusMessage","openChat","loadPinnedMessages","toggleLeftColumn","exitMessageSelectMode"]))(({chatId:e,threadId:t,messageListType:a,pinnedMessageIds:s,messagesById:r,canUnpin:o,topMessageSender:l,typingStatus:d,isSelectModeActive:u,isLeftColumnShown:m,isRightColumnShown:O,audioMessage:j,chat:g,chatsById:f,originChatId:p,messagesCount:I,isChatWithSelf:v,isChatWithBot:y,lastSyncTime:C,notifySettings:E,notifyExceptions:w,openChatWithInfo:M,pinMessage:S,focusMessage:k,openChat:N,loadPinnedMessages:T,toggleLeftColumn:P,exitMessageSelectMode:A})=>{const x=Object(ne.a)(),[R,L]=Object(c.r)(0),F=Array.isArray(s)?s[R]:s,D=r&&F?r[F]:void 0,B=Array.isArray(s)?s.length:s?1:0,U=g&&Object(h.l)(x,g).length,H=l?Object(h.W)(x,l):void 0;Object(c.n)(()=>{t===i.MAIN_THREAD_ID&&C&&T({chatId:e})},[e,T,C,t]),Object(c.n)(()=>{L(0)},[s]),Object(We.a)(e,F,D);const{width:G}=_e(),q=G<=n.Z,_=G>=n.db&&m,V=Object(c.q)(null),$=Object(c.q)(!0),z=Object(c.m)(()=>{M({id:e})},[M,e]),W=Object(c.m)(t=>{S({chatId:e,messageId:t,isUnpin:!0})},[S,e]),K=Object(c.m)(()=>{if(D){k({chatId:D.chatId,threadId:t,messageId:D.id});const e=Object(ze.a)(B,R+1);L(e)}},[D,k,t,B,R]),Q=Object(c.m)(()=>{N({id:e,threadId:i.MAIN_THREAD_ID,type:"pinned"})},[N,e]),Y=Object(c.m)(()=>{if(b.g){const e=document.getElementById(n.v);e&&e.blur()}t!==i.MAIN_THREAD_ID||"thread"!==a?("scheduled"===a&&u&&A(),N({id:p,threadId:i.MAIN_THREAD_ID})):b.g?N({id:void 0}):P()},[N,p,t,a,P,u,A]),J=Object(c.p)(()=>{if(!q||!f)return;let e=!1;const t=Object.values(f).reduce((t,a)=>{if(Object(h.ib)(a))return t;const s=a.unreadCount||0;return!s||Object(h.Db)(a,E,w)&&!a.unreadMentionsCount||(e=!0),t+s},0);return t?{isActive:e,totalCount:t}:void 0},[q,f,E,w]),ee=G>=n.Z&&Gn.db&&G30),te=ee||G>n.ab&&G{const e=V.current;if(e)return te&&ue?void(O||ee?($.current&&(e.classList.add("tools-stacked","animated"),$.current=!1),setTimeout(()=>{e.classList.remove("animated")},350)):(e.classList.remove("tools-stacked"),$.current=!0)):(e.classList.remove("tools-stacked","animated"),void($.current=!0))},[te,ue,ee,O]),c.a.createElement("div",{className:"MiddleHeader",ref:V},c.a.createElement(ae.a,{name:"slide-fade",activeKey:"thread"===a?t:1},me),c.a.createElement("div",{className:"header-tools"},ie&&de&&!se&&c.a.createElement(dt,{key:e,message:de,count:B,index:R,customTitle:be,className:le,onUnpinMessage:o?W:void 0,onClick:K,onAllPinnedClick:Q}),se&&re&&c.a.createElement(mt,{key:Object(h.B)(re),message:re,className:ce}),c.a.createElement(Ze,{chatId:e,threadId:t,messageListType:a})))})),Ot=a(160);function jt(e){return"albumId"in e}function gt(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((r,o)=>{r.isInAlbum?a?(a.messages.push(r),r.content.text&&(a.mainMessage=r)):a={albumId:r.groupedId,messages:[r],mainMessage:r}:s.push(r);const i=e[o+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||r.senderId!==i.senderId||r.isOutgoing!==i.isOutgoing||Object(h.eb)(r)||Object(h.eb)(i)||r.forwardInfo&&i.forwardInfo&&(r.forwardInfo.senderUserId!==i.forwardInfo.senderUserId||r.forwardInfo.fromChatId!==i.forwardInfo.fromChatId||r.forwardInfo.hiddenUserName!==i.forwardInfo.hiddenUserName)||r.inlineButtons||i.inlineButtons)&&(s=[],n.senderGroups.push(s))}}),c}var ft=a(108);function pt(){const[e,t]=Object(ot.a)(!1),a=(s=1e3,n=!1,Object(c.p)(()=>Object(g.a)(e=>e(),s,n,r),[s,n,r]));var s,n,r;return{isScrolled:e,updateStickyDates:Object(c.m)((e,s)=>{t(),document.body.classList.contains("is-scrolling-messages")||Object(g.b)(()=>{document.body.classList.add("is-scrolling-messages")}),a(()=>{Object(g.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 It=a(156),vt=a(125);var yt=({containerRef:e,className:t,messageIds:a,focusingId:s,loadMoreForwards:r,loadMoreBackwards:o,isViewportNewest:i,firstUnreadId:l,onFabToggle:d,onNotchToggle:b,children:u})=>{const m=Object(c.q)(null),h=Object(c.q)(null),O=Object(c.q)(null),j=Object(c.m)(()=>{if(!a||!a.length)return d(!1),void b(!1);if(!i)return d(!0),void b(!0);const{offsetHeight:t,scrollHeight:s,scrollTop:n}=e.current,c=s-n-t,r=c<=0;d(l?!r:!(c<=50)),b(!r)},[a,i,e,d,l,b]),{observe:g,freeze:f,unfreeze:p}=Object(ft.a)({rootRef:e,margin:n.U},t=>{if(!r||!o)return;const a=t.find(({isIntersecting:e})=>e);if(!a)return;const{target:s}=a;"backwards-trigger"===s.className?(Object(It.a)(e.current),o()):"forwards-trigger"===s.className&&(Object(It.a)(e.current),r())});Object(ft.c)(m,g),Object(ft.c)(h,g);const{observe:I,freeze:v,unfreeze:y}=Object(ft.a)({rootRef:e,margin:50},j);Object(ft.c)(O,I);const{observe:C,freeze:E,unfreeze:w}=Object(ft.a)({rootRef:e},j);Object(ft.c)(O,C);const M=Boolean(s);return Object(je.a)(()=>{M?f():p()},[M]),Object(je.a)(()=>{v(),E(),setTimeout(()=>{w(),y()},100)},[a]),c.a.createElement("div",{className:t,teactFastList:!0},c.a.createElement("div",{ref:m,key:"backwards-trigger",className:"backwards-trigger"}),u,c.a.createElement("div",{ref:h,key:"forwards-trigger",className:"forwards-trigger"}),c.a.createElement("div",{ref:O,key:"fab-trigger",className:"fab-trigger"}))},Ct=a(146),Et=a(147);function wt(e){return"number"==typeof e}function Mt(e,t){return e?t?238:175:100}function St(e){const t=Object(h.ub)(e),a=Object(h.rb)(e),s=Object(h.H)(e)||Object(h.S)(e),n=Object(h.Q)(e),c=Boolean(Object(h.S)(e)),{width:r,height:o}=s?Object(et.g)(s,t,a,c):Object(et.i)(n,t,a),i=Mt(Boolean(Object(h.P)(e)));let l=1;re+t,t)}function Rt(e,t,a){return ea?a:e}function Lt(e){const t={width:0,height:0};return e.forEach(({dimensions:e,sides:a})=>{a&Tt&&(t.width=e.width+e.x),a&Pt&&(t.height=e.height+e.y)}),t}function Ft(e,t,a,s){const c=a.messages.map(e=>{const t=St(e);return t.width/t.height});const r=function(e){return e.map(e=>e>1.2?"w":e<.8?"n":"q").join("")}(c),o=function(e){return e.reduce((e,t)=>t+e,1)/e.length}(c),i=c.length,l=c.some(e=>e>2),d=function(e,t,a){return a<=n.db?a/100*69-(t?1.625:0)*et.d:((e?30:29)-(t?1.625:0))*et.d}(e,t,s);let b;const u={ratios:c,proportions:r,averageRatio:o,maxWidth:d,minWidth:100,maxHeight:d,spacing:2};return b=i>=5||l?function({ratios:e,averageRatio:t,maxWidth:a,minWidth:s,spacing:n,maxHeight:c=4*a/3}){const r=function(e,t){return e.map(e=>t>1.1?Rt(e,1,2.75):Rt(e,.6667,1))}(e,t),o=e.length,i=new Array(o),l=[],d=e=>{const t=[];let s=0;e.forEach(e=>{t.push(((e,t)=>{const s=xt(r.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!==o;++e){const t=o-e;e<=3&&t<=3&&d([e,t])}for(let e=1;e!==o-1;++e)for(let a=1;a!==o-e;++a){const s=o-e-a;e<=3&&a<=(t<.85?4:3)&&s<=3&&d([e,a,s])}for(let e=1;e!==o-1;++e)for(let t=1;t!==o-e;++t)for(let a=1;a!==o-e-t;++a){const s=o-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{for(let e=1;e!==r;++e)if(a[e-1]>a[e])return 1.5;return 1})(),m=Math.abs(o-c)*i*d;(!b||m1.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:At|Nt|Tt},{dimensions:{x:0,y:c+s,width:a,height:c},sides:At|Pt|Tt}]}(e):"ww"===a||"qq"===a?function(e){const{ratios:t,maxWidth:a,spacing:s,maxHeight:n}=e,c=(a-s)/2,r=Math.round(Math.min(c/t[0],Math.min(c/t[1],n)));return[{dimensions:{x:0,y:0,width:c,height:r},sides:Nt|At|Pt},{dimensions:{x:c+s,y:0,width:c,height:r},sides:Nt|Tt|Pt}]}(e):function(e){const{ratios:t,minWidth:a,maxWidth:s,spacing:n,maxHeight:c}=e,r=Math.round(1.5*a),o=Math.min(Math.round(Math.max(.4*(s-n),(s-n)/t[0]/(1/t[0]+1/t[1]))),s-n-r),i=s-o-n,l=Math.min(c,Math.round(Math.min(i/t[0],o/t[1])));return[{dimensions:{x:0,y:0,width:i,height:l},sides:Nt|At|Pt},{dimensions:{x:i+n,y:0,width:o,height:l},sides:Nt|Tt|Pt}]}(e)}(u):3===i?function(e){const{proportions:t}=e;return"n"===t[0]?function(e){const{maxHeight:t,spacing:a,ratios:s,maxWidth:n,minWidth:c}=e,r=t,o=Math.round(Math.min((t-a)/2,s[1]*(n-a)/(s[2]+s[1]))),i=r-o-a,l=Math.max(c,Math.round(Math.min((n-a)/2,Math.min(o*s[2],i*s[1])))),d=Math.min(Math.round(r*s[0]),n-a-l);return[{dimensions:{x:0,y:0,width:d,height:r},sides:Nt|At|Pt},{dimensions:{x:d+a,y:0,width:l,height:i},sides:Nt|Tt},{dimensions:{x:d+a,y:i+a,width:l,height:o},sides:Pt|Tt}]}(e):function(e){const{maxWidth:t,ratios:a,maxHeight:s,spacing:n}=e,c=t,r=Math.round(Math.min(c/a[0],.66*(s-n))),o=(t-n)/2,i=Math.min(s-r-n,Math.round(Math.min(o/a[1],o/a[2])));return[{dimensions:{x:0,y:0,width:c,height:r},sides:At|Nt|Tt},{dimensions:{x:0,y:r+n,width:o,height:i},sides:Pt|At},{dimensions:{x:o+n,y:r+n,width:c-o-n,height:i},sides:Pt|Tt}]}(e)}(u):function(e){const{proportions:t}=e;return"w"===t[0]?function({maxWidth:e,ratios:t,spacing:a,maxHeight:s,minWidth:n}){const c=e,r=Math.round(Math.min(c/t[0],.66*(s-a))),o=Math.round((e-2*a)/(t[1]+t[2]+t[3])),i=Math.max(n,Math.round(Math.min(.4*(e-2*a),o*t[1]))),l=Math.round(Math.max(Math.max(n,.33*(e-2*a)),o*t[3])),d=c-i-l-2*a,b=Math.min(s-r-a,o);return[{dimensions:{x:0,y:0,width:c,height:r},sides:At|Nt|Tt},{dimensions:{x:0,y:r+a,width:i,height:b},sides:Pt|At},{dimensions:{x:i+a,y:r+a,width:d,height:b},sides:Pt},{dimensions:{x:i+a+d+a,y:r+a,width:l,height:b},sides:Tt|Pt}]}(e):function({maxHeight:e,ratios:t,maxWidth:a,spacing:s,minWidth:n}){const c=e,r=Math.round(Math.min(c*t[0],.6*(a-s))),o=Math.round((e-2*s)/(1/t[1]+1/t[2]+1/t[3])),i=Math.round(o/t[1]),l=Math.round(o/t[2]),d=c-i-l-2*s,b=Math.max(n,Math.min(a-r-s,o));return[{dimensions:{x:0,y:0,width:r,height:c},sides:Nt|At|Pt},{dimensions:{x:r+s,y:0,width:b,height:i},sides:Nt|Tt},{dimensions:{x:r+s,y:i+s,width:b,height:l},sides:Tt},{dimensions:{x:r+s,y:i+l+2*s,width:b,height:d},sides:Pt|Tt}]}(e)}(u),{layout:b,containerStyle:Lt(b)}}let Dt;function Bt(e){return Dt||(Dt=document.createElement("span"),Dt.style.font='400 12px "Roboto", -apple-system, "Apple Color Emoji", BlinkMacSystemFont, "Helvetica Neue", sans-serif',Dt.style.whiteSpace="nowrap",Dt.style.position="absolute",Dt.style.left="-999px",Dt.style.opacity=".01",document.body.appendChild(Dt)),Dt.innerHTML=e,Dt.offsetWidth}function Ut(e,t,a,s,n){Object(c.o)(()=>{if(a&&e.current){const t=e.current.closest(".MessageList");Object(vt.a)(t,e.current,n?"end":"center",20,void 0===s?1500:1e3,s)}},[e,t,a,s,n])}var Ht=a(113),Gt=a(67);var qt=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Ce.a)(ye.a.Extra,"ContextMenuContainer",!t);return a?c.a.createElement(a,e):void 0});var _t=Object(c.h)(Object(s.h)((e,{message:t})=>{const a=t.senderId,{targetUserId:s,targetChatId:n}=t.content.action||{},c=t.replyToMessageId,r=c?Object(o.k)(e,t.chatId,c):void 0,i=Object(o.U)(e,t),{direction:l,noHighlight:d}=i&&e.focusedMessage||{},b=Object(o.f)(e,t.chatId);return{sender:b&&(Object(h.kb)(b)||a===t.chatId)?b:a?Object(o.Gb)(e,a):void 0,...s&&{targetUser:Object(o.Gb)(e,s)},targetChatId:n,targetMessage:r,isFocused:i,...i&&{focusDirection:l,noFocusHighlight:d}}})(({message:e,observeIntersection:t,isEmbedded:a,appearanceOrder:s=0,isLastInList:n,sender:r,targetUser:o,targetMessage:i,targetChatId:l,isFocused:d,focusDirection:b,noFocusHighlight:u})=>{const m=Object(c.q)(null);Object(ft.c)(m,t),Object(We.a)(e.chatId,e.replyToMessageId,i),Ut(m,e.chatId,d,b,u);const h=Object(ne.a)(),O=s<=0,[j,g]=Object(ot.a)(O);Object(c.n)(()=>{O||setTimeout(g,10*s)},[s,g,O]);const{transitionClassNames:f}=Object(Z.a)(j,void 0,O,!1),p=Object(Gt.a)(h,e,r,o,i,l,a?{isEmbedded:!0,asPlain:!0}:void 0),{isContextMenuOpen:I,contextMenuPosition:v,handleBeforeContextMenu:y,handleContextMenu:C,handleContextMenuClose:E,handleContextMenuHide:w}=Object(Ct.a)(m),M=void 0!==v;if(a)return c.a.createElement("span",{className:"embedded-action-message"},Object(tt.a)(p));const S=Object(X.a)("ActionMessage message-list-item",d&&!u&&"focused",M&&"has-menu-open",n&&"last-in-list",f);return c.a.createElement("div",{ref:m,id:"message"+e.id,className:S,"data-message-id":e.id,onMouseDown:y,onContextMenu:C},c.a.createElement("span",null,p),v&&c.a.createElement(qt,{isOpen:I,anchor:v,message:e,messageListType:"thread",onClose:E,onCloseAnimationEnd:w}))}));a(219);var Vt=({className:e,message:t,sender:a,title:s,customText:n,observeIntersection:r,onClick:o})=>{const i=Object(c.q)(null),l=Object(ft.b)(i,r),d=Object(at.a)(t&&Object(h.E)(t,"pictogram"),!l),b=t&&"sticker-reply-thumb"+t.id,u=nt(t),m=Boolean(t&&Object(h.J)(t)),O=Object(ne.a)(),j=a&&Object(h.W)(O,a);return c.a.createElement("div",{ref:i,className:Object(X.a)("EmbeddedMessage",e),onClick:t?o:void 0},u&&function(e,t,a,s){const{width:n,height:r}=Object(et.l)();return c.a.createElement("img",{id:e,src:a||t,width:n,height:r,alt:"",className:s?"round":""})}(b,u,d,m),c.a.createElement("div",{className:"message-text"},c.a.createElement("p",{dir:"auto"},t?Object(h.eb)(t)?c.a.createElement(_t,{message:t,isEmbedded:!0}):Object(tt.a)(Object(h.O)(O,t,Boolean(u))):n||" "),c.a.createElement("div",{className:"message-title",dir:"auto"},Object(tt.a)(j||s||" "))))},$t=a(161),zt=a(168),Wt=a(173);a(223);var Kt=Object(c.h)(({message:e,outgoingStatus:t,signature:a,onClick:s})=>{const n=Object(ne.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(Qe.b)(e.views)),c.a.createElement("i",{className:"icon-channelviews"})),a&&c.a.createElement("span",{className:"message-signature"},Object(tt.a)(a)),c.a.createElement("span",{className:"message-time"},e.isEdited&&n("EditedMessage")+" ",Object(x.h)(1e3*e.date)),t&&c.a.createElement(Wt.a,{status:t}))}),Qt=a(115),Yt=a(117),Jt=a(162);a(224);var Xt=({message:e,observeIntersection:t,observeIntersectionForPlaying:a,shouldLoop:s,lastSyncTime:r})=>{const o=Object(c.q)(null),[i,l,d]=Object(ot.a)(),b=e.content.sticker,{isAnimated:u,stickerSetId:m}=b,O=m===n.S,j=Object(ft.b)(o,t),g=Object(ft.b)(o,a),f=b.isPreloadedGlobally?"sticker"+b.id:Object(h.E)(e,"inline"),p=nt(e),I=Object(at.a)(f,!j,Object(h.D)(e,"inline",!0),r),v=Boolean(I),[y,C]=Object(ot.a)(v),E=u?y:v,{shouldRenderFullMedia:w,transitionClassNames:M}=Object(Qt.a)(E,"slow"),{width:S,height:k}=Object(et.m)(b),N=Object(X.a)("thumbnail",!p&&"empty"),T=Object(X.a)("Sticker media-inner",O&&"inactive");return c.a.createElement("div",{ref:o,className:T,onClick:O?void 0:l},!E&&c.a.createElement("img",{id:"sticker-thumb-"+e.id,src:p,width:S,height:k,alt:"",className:N}),!u&&w&&c.a.createElement("img",{id:"sticker-"+e.id,src:I,width:S,height:k,alt:"",className:Object(X.a)("full-media",M)}),u&&v&&c.a.createElement(Yt.a,{key:f,className:Object(X.a)("full-media",M),id:f,animationData:I,size:S,play:g,noLoop:!s,onLoad:C}),c.a.createElement(Jt.a,{isOpen:i,fromSticker:b,onClose:d}))},Zt=a(130),ea=a(121),ta=a(163);function aa(e,t){return Object(ta.a)(Object(h.F)(e),Boolean(t),b.g&&!b.c)}var sa=a(38);var na=async(e,t,a,s)=>s?"rgba(255,255,255,1)":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,r=a.height-1;return`rgba(${Array.from(n.getImageData(c,r,1,1).data).join(",")})`}(e,t);var ca=a(122);var ra=({id:e,message:t,observeIntersection:a,shouldAutoLoad:s,isInSelectMode:n,isSelected:r,uploadProgress:o,size:i="inline",dimensions:l,nonInteractive:d,shouldAffectAppendix:b,onClick:u,onCancelUpload:m})=>{const O=Object(c.q)(null),j=(Object(h.H)(t)||Object(h.S)(t)).blobUrl,g=Object(ft.b)(O,a),[f,p]=Object(c.r)(s),I=f&&g,{mediaData:v,downloadProgress:y}=Object(ea.a)(Object(h.E)(t,i),!I),C=j||v,E=aa(t,C),{isUploading:w,isTransferring:M,transferProgress:S}=Object(h.s)(t,o||y,I&&!C),k=!1===Object(sa.a)(f),{shouldRender:N,transitionClassNames:T}=Object(Z.a)(M,void 0,k,"slow"),{shouldRenderThumb:P,shouldRenderFullMedia:A,transitionClassNames:x}=Object(Qt.a)(C,"slow"),R=Object(c.m)(()=>{w?m&&m(t):C?u&&u(t.id):p(e=>!e)},[C,w,t,m,u]),L=Object(h.ub)(t);Object(c.o)(()=>{if(!b)return;const e=O.current.closest(".message-content");C?na(C,L,0,r).then(t=>{e.style.setProperty("--appendix-bg",t),e.setAttribute("data-has-custom-appendix","")}):e.classList.add("has-appendix-thumb")},[C,L,b,n,r]);const{width:F,height:D,isSmall:B}=l||St(t),U=Object(X.a)("media-inner",!w&&!d&&"interactive",B&&"small-image",F===D&&"square-image"),H=l?`width: ${F}px; height: ${D}px; left: ${l.x}px; top: ${l.y}px;`:"";return c.a.createElement("div",{id:e,ref:O,className:U,style:H,onClick:w?void 0:R},P&&c.a.createElement("canvas",{ref:E,className:"thumbnail",style:`width: ${F}px; height: ${D}px`}),A&&c.a.createElement("img",{src:C,className:"full-media "+x,width:F,height:D,alt:""}),N&&c.a.createElement("div",{className:"media-loading "+T},c.a.createElement(ca.a,{progress:S,onClick:w?R:void 0})),!C&&!f&&c.a.createElement("i",{className:"icon-download"}),M&&c.a.createElement("span",{className:"message-upload-progress"},Math.round(100*S),"%"))},oa=a(138),ia=a(137);function la(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(ia.a)(e.current)},[e]);Object(J.a)(s,n)}var da=a(148),ba=(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]),r=Object(c.m)(()=>{t&&e.current&&a.current&&document.body.contains(e.current)&&Object(ia.a)(e.current),a.current=!1,s.current=!1},[t,e]),o=Object(c.m)(()=>{Object(g.b)(r)},[r]);document.hasFocus()||n(),Object(ee.a)(n,o)};function ua(){return(ua=Object.assign||function(e){for(var t=1;t{const b=Object(c.q)(null),u=Object(c.q)(null),m=t.content.video,O=m.blobUrl,j=Boolean(O)||Object(h.b)(m),g=Object(ft.b)(b,a),[f,p]=Object(c.r)(s),I=Boolean(f&&g&&o),[v,y]=Object(c.r)(n),C=Object(at.a)(Object(h.E)(t,"pictogram"),!(g&&o),Object(h.D)(t,"pictogram"),o),E=aa(t),{mediaData:w,downloadProgress:M}=Object(ea.a)(Object(h.E)(t,"inline"),!I,Object(h.D)(t,"inline"),o),S=O||w,k=Boolean(j&&g&&S),{isBuffered:N,bufferingHandlers:T}=Object(oa.a)(!s),{isUploading:P,isTransferring:A,transferProgress:R}=Object(h.s)(t,r||M,I&&j&&!N),L=!1===Object(sa.a)(f),{shouldRender:F,transitionClassNames:D}=Object(Z.a)(A,void 0,L),{shouldRenderThumb:B,transitionClassNames:U}=Object(Qt.a)(S,"slow"),[H,G]=Object(c.r)(0),q=Object(c.m)(e=>{G(Math.max(0,e.currentTarget.currentTime-1))},[]),_=Object(h.ub)(t),V=Object(h.rb)(t),{width:$,height:z}=i||Object(et.i)(m,_,V);la(u,Boolean(k&&n)),ba(u,v),Object(da.a)(u,[k]);const W=Object(c.m)(()=>{P?d&&d(t):j&&!S?p(e=>!e):j&&S&&!v?(y(!0),u.current.play()):l&&l(t.id)},[P,j,S,v,l,d,t]),K=Object(X.a)("media-inner dark",!P&&"interactive"),Q=Object(X.a)("full-media",U),Y=i?`width: ${$}px; height: ${z}px; left: ${i.x}px; top: ${i.y}px;`:"",J=k,ee=!j&&w,te=!j||f&&!v&&!F,ae=j&&!f;return c.a.createElement("div",{ref:b,id:e,className:K,style:Y,onClick:P?void 0:W},(!k||B)&&c.a.createElement("canvas",{ref:E,className:"thumbnail",style:`width: ${$}px; height: ${z}px;`}),C&&c.a.createElement("img",{src:C,className:"thumbnail",style:`width: ${$}px; height: ${z}px;`,alt:""}),J&&c.a.createElement("video",ua({ref:u,className:Q,width:$,height:z,autoPlay:v,muted:!0,loop:!0,playsInline:!0},T,{onTimeUpdate:q}),c.a.createElement("source",{src:S})),ee&&c.a.createElement("img",{src:w,className:"full-media "+U,width:$,height:z,alt:""}),te&&c.a.createElement("i",{className:"icon-large-play"}),F&&c.a.createElement("div",{className:"media-loading "+D},c.a.createElement(ca.a,{progress:R,onClick:P?W:void 0})),ae&&c.a.createElement("i",{className:"icon-download"}),A&&!j?c.a.createElement("span",{className:"message-upload-progress"},Math.round(100*R),"%"):A&&j?c.a.createElement("span",{className:"message-upload-progress"},"..."):c.a.createElement("div",{className:"message-media-duration"},m.isGif?"GIF":Object(x.e)(m.duration-H)))},ha=a(17);a(226);var Oa=Object(s.h)((e,{contact:t})=>({user:Object(o.Gb)(e,t.userId)}),(e,t)=>Object(d.l)(t,["openUserInfo"]))(({contact:e,user:t,openUserInfo:a})=>{const{firstName:s,lastName:n,phoneNumber:r,userId:o}=e,i=Object(c.m)(()=>{a({id:o})},[a,o]);return c.a.createElement("div",{className:Object(X.a)("Contact",Boolean(o)&&"interactive"),onClick:o?i:void 0},c.a.createElement(Ht.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(ha.c)(r))))}),ja=a(46);var ga=Object(c.h)(({id:e,options:t,selected:a=[],disabled:s,round:n,loadingOptions:r,onChange:o})=>{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),o(s)},[o,i]);return c.a.createElement("div",{id:e,className:"radio-group"},t.map(e=>c.a.createElement(ja.a,{label:e.label,subLabel:e.subLabel,value:e.value,checked:-1!==a.indexOf(e.value),disabled:s,round:n,isLoading:r?-1!==r.indexOf(e.value):void 0,onChange:d})))}),fa=a(127),pa=a(182);a(229);function Ia(e,t){return t>0?(e/t*100).toFixed():0}var va=({answer:e,voteResults:t,totalVoters:a,maxVotersCount:s,correctResults:n,shouldAnimate:r})=>{const o=t&&t.find(t=>t.option===e.option),i=0===n.length||-1!==n.indexOf(e.option),l=n.length>0&&i||o&&o.isChosen,d=o?Ia(o.votersCount,a||0):0,[b,u]=Object(c.r)(r?0:d),m=Object(c.q)(null),h=o?Ia(o.votersCount,s||0):0,O=b{r&&u(d)},[r,d]),Object(c.n)(()=>{const e=m.current;if(e&&r){const t=e.firstElementChild,a=O?"":"stroke-dasharray: 100% 200%; stroke-dashoffset: -44";t?t.setAttribute("style",a):e.innerHTML=`\n \n \n `}},[O,r]),!t||!o)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(X.a)("poll-option-chosen",!i&&"wrong",r&&"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(tt.a)(e.text)),c.a.createElement("div",{className:Object(X.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(230);var ya=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(d.l)(t,["loadMessage","openPollResults"]))(({message:e,poll:t,recentVoterIds:a,usersById:s,loadMessage:n,onSendVote:r,openPollResults:o,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,f]=Object(c.r)(!1),[p,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,M=E&&E.some(e=>e.isChosen),S=!b.closed&&!M,k=!S&&b.isPublic&&Number(u.totalVoters)>0,N=S&&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 ${Object(x.e)(v)}\n \n \n `}},[v,b.closePeriod]),Object(c.n)(()=>{b.quiz&&(v<=0||M&&!b.closed)&&n({chatId:d,messageId:l})},[d,v,M,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)}},[S,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),r([e])},[r]),F=Object(c.m)(e=>{j(e)},[]),D=Object(c.m)(()=>{h(!0),I(!0),r(O)},[r,O]),B=Object(c.m)(()=>{o({chatId:d,messageId:l})},[d,l,o]),U=Object(c.m)(()=>{f(!0)},[]),H=Object(c.m)(()=>{f(!1),I(!1)},[]);Object(c.n)(()=>{if(p&&M&&b.quiz&&u.results&&t.results.solution){u.results.find(e=>e.isChosen&&e.isCorrect)||f(!0)}},[M,p,u.results,b.quiz,t.results.solution]);const G=Object(ne.a)();return c.a.createElement("div",{className:"Poll",dir:G.isRtl?"auto":"ltr"},g&&t.results.solution&&c.a.createElement(pa.a,{message:Object(Et.b)(t.results.solution,t.results.solutionEntities),duration:5e3,onDismiss:H,containerId:"#middle-column-portals"}),c.a.createElement("div",{className:"poll-question"},Object(tt.a)(b.question)),c.a.createElement("div",{className:"poll-type"},G(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(Ht.a,{size:"micro",user:e}))),v>0&&S&&c.a.createElement("div",{ref:C,className:"poll-countdown"}),b.quiz&&t.results.solution&&!S&&c.a.createElement(oe.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"}))),S&&c.a.createElement("div",{className:"poll-answers"},N?c.a.createElement(ga,{options:A,onChange:F,disabled:e.isScheduled||m,loadingOptions:m?O:void 0,round:!0}):c.a.createElement(fa.a,{name:"poll-"+l,options:A,onChange:L,disabled:e.isScheduled||m,loadingOption:m?O[0]:void 0})),!S&&c.a.createElement("div",{className:"poll-results"},b.answers.map((function(e){return c.a.createElement(va,{key:e.option,shouldAnimate:p,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")}(G,b.quiz,u.totalVoters)),N&&c.a.createElement(oe.a,{isText:!0,disabled:0===O.length,size:"tiny",onClick:D},G("PollSubmitVotes")),k&&c.a.createElement(oe.a,{isText:!0,size:"tiny",onClick:B},G("PollViewResults")))})),Ca=a(39),Ea=a(57);a(231);var wa=Object(c.h)(({message:e,observeIntersection:t,shouldAutoLoad:a,inPreview:s,onMediaClick:n,onCancelMediaTransfer:r})=>{const o=Object(h.R)(e);let i=!1;if(o&&o.photo){const{width:t,height:a}=St(e);i=t===a}const l=Object(c.m)(()=>{n()},[n]);if(!o)return;const{siteName:d,url:b,displayUrl:u,title:m,description:O,photo:j}=o,g=j&&n&&!i&&!o.hasDocument,f=Object(Ca.a)(O,170),p=Object(X.a)("WebPage",j?i&&"with-square-photo":!s&&"without-photo");return c.a.createElement("div",{className:p,"data-initial":(d||u)[0],dir:"auto"},j&&c.a.createElement(ra,{message:e,observeIntersection:t,shouldAutoLoad:a,size:i?"pictogram":"inline",nonInteractive:!g,onClick:g?l:void 0,onCancelUpload:r}),c.a.createElement("div",{className:"WebPage-text"},c.a.createElement(Ea.a,{className:"site-name",url:b,text:d||u}),!s&&m&&c.a.createElement("p",{className:"site-title"},Object(tt.a)(m)),f&&c.a.createElement("p",{className:"site-description"},Object(tt.a)(f,["emoji","br"]))))});a(232);var Ma=Object(c.h)(({message:e})=>{const t=Object(h.A)(e),{title:a,text:s,description:n,photoUrl:r}=t;return c.a.createElement("div",{className:"Invoice"},a&&c.a.createElement("p",{className:"title"},Object(tt.a)(a)),s&&c.a.createElement("p",null,Object(tt.a)(s,["emoji","br"])),c.a.createElement("div",{className:"description "+(r?"has-image":"")},r&&c.a.createElement("img",{className:"invoice-image",src:r,alt:""}),n&&c.a.createElement("p",{className:"description-text"},Object(tt.a)(n,["emoji","br"]))))});function Sa(e){return Object(c.h)(Object(s.h)((e,t)=>{const{message:a}=t;return{isInSelectMode:Object(o.S)(e),isSelected:Object(o.V)(e,a.id)}},(e,t)=>Object(d.l)(t,["toggleMessageSelection"]))(t=>{const{isInSelectMode:a,isSelected:s,message:n,toggleMessageSelection:r,dimensions:o}=t,i=Object(c.m)(e=>{e.stopPropagation(),r({messageId:n.id,withShift:e&&e.shiftKey})},[r,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(X.a)("album-item-select-wrapper",s&&"is-selected"),style:o?`left: ${o.x}px; top: ${o.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(233);const ka=Sa(ra),Na=Sa(ma);var Ta=Object(s.h)(e=>({uploadsById:e.fileUploads.byMessageLocalId}),(e,t)=>Object(d.l)(t,["cancelSendingMessage"]))(({album:e,observeIntersection:t,shouldAutoLoad:a,shouldAutoPlay:s,hasCustomAppendix:n,lastSyncTime:r,isOwn:o,albumLayout:i,onMediaClick:l,uploadsById:d,cancelSendingMessage:b})=>{const u=e.messages.length,m=Object(c.m)(e=>{b({chatId:e.chatId,messageId:e.id})},[b]);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,b){const{photo:O,video:j}=Object(h.w)(e),g=d[e.previousLocalId||e.id],f=g?g.progress:void 0,{dimensions:p,sides:I}=i.layout[b];if(O){const s=n&&(o?b===u-1:Boolean(I&At&&I&Pt));return c.a.createElement(ka,{id:"album-media-"+e.id,message:e,observeIntersection:t,shouldAutoLoad:a,shouldAffectAppendix:s,uploadProgress:f,dimensions:p,onClick:l,onCancelUpload:m})}if(j)return c.a.createElement(Na,{id:"album-media-"+e.id,message:e,observeIntersection:t,shouldAutoLoad:a,shouldAutoPlay:s,uploadProgress:f,lastSyncTime:r,dimensions:p,onClick:l,onCancelUpload:m})})))});a(234);function Pa(){return(Pa=Object.assign||function(e){for(var t=1;t{const r=Object(c.q)(null),o=Object(c.q)(null),i=Object(c.q)(null),l=e.content.video,d=Object(ft.b)(r,t),[b,u]=Object(c.r)(a&&s),m=Boolean(b&&d&&n),{mediaData:O,downloadProgress:j}=Object(ea.a)(Object(h.E)(e,"inline"),!m,Object(h.D)(e,"inline"),n),g=aa(e,O),{isBuffered:f,bufferingHandlers:p}=Object(oa.a)(),I=b&&!f,v=!1===Object(sa.a)(b),{shouldRender:y,transitionClassNames:C}=Object(Z.a)(I||!f,void 0,v),{shouldRenderThumb:E,transitionClassNames:w}=Object(Qt.a)(O,"slow"),[M,S]=Object(c.r)(!1),[k,N]=Object(c.r)(0);Object(c.n)(()=>{if(!M)return;const e=188*Math.PI,t=e-k*e,a=i.current,s=o.current,n=s.firstElementChild;n?n.firstElementChild.setAttribute("stroke-dashoffset",t.toString()):s.innerHTML=`\n \n `,N(a.currentTime/a.duration)},[M,k]);const T=Boolean(O&&d),P=()=>{S(!1),N(0),Object(ia.a)(i.current),requestAnimationFrame(()=>{o.current.innerHTML=""})},A=(R=P,()=>{Aa&&Aa(),Aa=R});var R;Object(c.n)(()=>{i.current&&(T?Object(ia.a)(i.current):i.current.pause())},[T]),la(i,T),ba(i,Boolean(O)),Object(da.a)(i,[O]);const L=Object(c.m)(()=>{if(!O)return void u(e=>!e);const e=i.current;M?e.paused?Object(ia.a)(e):e.pause():(A(),e.currentTime=0,S(!0))},[A,M,O]),F=Object(c.m)(e=>{const t=e.currentTarget;N(t.currentTime/t.duration)},[]),D=Object(X.a)("full-media",w);return c.a.createElement("div",{ref:r,className:"RoundVideo media-inner",onClick:L},E&&c.a.createElement("div",{className:"thumbnail-wrapper"},c.a.createElement("canvas",{ref:g,className:"thumbnail",style:`width: ${et.e}px; height: ${et.e}px`})),O&&c.a.createElement("div",{className:"video-wrapper"},c.a.createElement("video",Pa({ref:i,className:D,width:et.e,height:et.e,autoPlay:!0,muted:!M,loop:!M,playsInline:!0,onEnded:M?P:void 0},p,{onTimeUpdate:M?F:void 0}),c.a.createElement("source",{src:O}))),c.a.createElement("div",{className:"progress",ref:o}),y&&c.a.createElement("div",{className:"media-loading "+C},c.a.createElement(ca.a,{progress:j})),!O&&!b&&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)(l.duration),(!M||i.current.paused)&&c.a.createElement("i",{className:"icon-muted-chat"})))};a(235);var Ra=({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(oe.a,{size:"tiny",ripple:!0,disabled:"NOT_SUPPORTED"===e.type,onClick:()=>t({button:e})},e.text,"url"===e.type&&c.a.createElement("i",{className:"icon-arrow-right"}))))));a(236);var La=Object(c.h)(Object(s.h)((e,{message:t})=>{const{threadId:a,chatId:s}=t.threadInfo,n=Object(o.Cb)(e,s,a)||t.threadInfo,{byId:c}=e.users,{byId:r}=e.chats;return{threadInfo:n,usersById:c,chatsById:r}},(e,t)=>Object(d.l)(t,["openChat"]))(({disabled:e,threadInfo:t,usersById:a,chatsById:s,openChat:n})=>{const r=Object(ne.a)(),{threadId:o,chatId:i,messagesCount:l,lastMessageId:d,lastReadInboxMessageId:b,recentReplierIds:u}=t,m=Object(c.m)(()=>{n({id:i,threadId:o})},[n,i,o]);if(void 0===l)return;const O=u&&u.map(e=>Object(h.mb)(e)?a[e]:s[e]).filter(Boolean);const j=Boolean(b&&d&&b0&&c.a.createElement("div",{className:"recent-repliers",dir:r.isRtl?"rtl":"ltr"},O.map(e=>c.a.createElement(Ht.a,{key:e.id,size:"small",user:Object(h.mb)(e.id)?e:void 0,chat:Object(h.mb)(e.id)?void 0:e}))),c.a.createElement("div",{className:"label",dir:"auto"},l?r("Comments",l,"i"):r("LeaveAComment")),c.a.createElement("i",{className:"icon-next"}))}));a(237);function Fa(e){const t=Ba(e.currentTarget);t&&t.setAttribute("data-is-document-group-hover","")}function Da(e){const t=Ba(e.currentTarget);t&&t.removeAttribute("data-is-document-group-hover")}function Ba(e){let t=e;do{t=t.nextElementSibling}while(t&&!t.classList.contains("last-in-document-group"));return t}var Ua=Object(c.h)(Object(s.h)((e,t)=>{const{focusedMessage:a,forwardMessages:s,lastSyncTime:n}=e,{message:c,album:r,withSenderName:i,withAvatar:l,threadId:d,messageListType:b}=t,{id:u,chatId:m,viaBotId:O,replyToMessageId:j,isOutgoing:g}=c,f=Object(o.f)(e,m),p=Object(o.P)(e,m),I=f&&Object(h.kb)(f),v=!p&&Object(h.fb)(c),y=i||l||v?Object(o.tb)(e,c):void 0,C=Object(o.K)(e,c),E=O?Object(o.Gb)(e,O):void 0,w=d?Object(o.Eb)(e,m,d):void 0,M=c.id===w,S=j===w,k=j&&!S?Object(o.k)(e,m,j):void 0,N=k&&Object(o.tb)(e,k),T=Object(o.Fb)(e,c),P="thread"===b&&(r?r.messages.some(t=>Object(o.U)(e,t)):Object(o.U)(e,c)),{direction:A,noHighlight:x}=P&&a||{},R=s.messageIds&&s.messageIds.includes(u),{query:L}=Object(o.A)(e)||{},F=Object(h.M)(c);let D;return D=r&&r.messages?r.messages.every(({id:t})=>Object(o.V)(e,t)):Object(o.V)(e,u),{forceSenderName:v,sender:y,originSender:C,botSender:E,shouldHideReply:S,isThreadTop:M,replyMessage:k,replyMessageSender:N,...g&&{outgoingStatus:Object(o.fb)(e,c,"scheduled"===b)},..."number"==typeof T&&{uploadProgress:T},isFocused:P,...P&&{focusDirection:A,noFocusHighlight:x},isForwarding:R,isChatWithSelf:p,isChannel:I,lastSyncTime:n,highlight:L,isSingleEmoji:Boolean(F),animatedEmoji:F?Object(o.c)(e,F):void 0,isInSelectMode:Object(o.S)(e),isSelected:D,isGroupSelected:!!c.groupedId&&!c.isInAlbum&&Object(o.Q)(e,m,c.groupedId),threadId:d,isPinnedList:"pinned"===b,shouldAutoLoadMedia:f?Object(o.ub)(e,c,f,y):void 0,shouldAutoPlayMedia:Object(o.vb)(e,c),shouldLoopStickers:Object(o.wb)(e)}},(e,t)=>Object(d.l)(t,["focusMessage","openMediaViewer","openAudioPlayer","cancelSendingMessage","openUserInfo","openChat","markMessagesRead","sendPollVote","toggleMessageSelection","setReplyingToId","openForwardMenu","clickInlineButton","disableContextMenuHint"]))(({message:e,observeIntersectionForBottom:t,observeIntersectionForMedia:a,observeIntersectionForAnimatedStickers:s,album:n,withAvatar:r,withSenderName:o,noComments:d,appearanceOrder:b,isFirstInGroup:u,isLastInGroup:m,isFirstInDocumentGroup:O,isLastInDocumentGroup:j,isLastInList:g,forceSenderName:f,sender:p,originSender:I,botSender:v,isThreadTop:y,shouldHideReply:C,replyMessage:E,replyMessageSender:w,outgoingStatus:M,uploadProgress:S,isFocused:k,focusDirection:N,noFocusHighlight:T,isForwarding:P,isChatWithSelf:A,isChannel:x,lastSyncTime:R,highlight:L,animatedEmoji:F,isInSelectMode:D,isSelected:B,isGroupSelected:U,threadId:H,messageListType:G,isPinnedList:q,shouldAutoLoadMedia:_,shouldAutoPlayMedia:V,shouldLoopStickers:$,focusMessage:z,openMediaViewer:W,openAudioPlayer:K,openUserInfo:Q,openChat:Y,cancelSendingMessage:J,markMessagesRead:ee,sendPollVote:te,toggleMessageSelection:ae,setReplyingToId:se,openForwardMenu:ce,clickInlineButton:re,disableContextMenuHint:ie})=>{const le=Object(c.q)(null),de=Object(c.q)(null),be=Object(c.q)(null);Object(ft.c)(de,t);const{width:ue}=_e(),{isContextMenuOpen:me,contextMenuPosition:he,handleBeforeContextMenu:Oe,handleContextMenu:je,handleContextMenuClose:ge,handleContextMenuHide:fe}=Object(Ct.a)(le,!1,!0);Object(c.n)(()=>{me&&ie()},[me,ie]);const pe=b<=0,[Ie,ve]=Object(ot.a)(pe);Object(c.n)(()=>{pe||setTimeout(ve,10*b)},[b,ve,pe]);const{transitionClassNames:ye}=Object(Z.a)(Ie,void 0,pe,!1),{chatId:Ce,id:Ee,threadInfo:we}=e,Me=Object(h.ub)(e),Se="scheduled"===G||e.isScheduled,ke=Object(h.vb)(e)&&!C,Ne=Boolean(we)&&"thread"===G,{forwardInfo:Te,viaBotId:Pe}=e,Ae=Te&&!A&&!Te.isLinkedChannelPost,xe=!!e.groupedId&&!e.isInAlbum,Re=Boolean(n)&&n.messages.length>1,{text:Le,photo:Fe,video:De,audio:Be,voice:Ue,document:He,sticker:Ge,contact:qe,poll:Ve,webPage:$e,invoice:ze}=Object(h.w)(e),Ke=Object(h.y)(e),Qe=Object(Et.a)(e,L,wt(Ke)),Ye=void 0!==he,Je=Object(X.a)("Message message-list-item",u&&"first-in-group",m&&"last-in-group",O&&"first-in-document-group",j&&"last-in-document-group",g&&"last-in-list",Me&&"own",Boolean(e.views)&&"has-views",e.isEdited&&"was-edited",ke&&"has-reply",Ye&&"has-menu-open",k&&!T&&"focused",P&&"is-forwarding",e.isDeleting&&"is-deleting",xe&&"is-in-document-group",Re&&"is-album",e.hasUnreadMention&&"has-unread-mention",B&&"is-selected",D&&"is-in-selection-mode",y&&"is-thread-top",Boolean(e.inlineButtons)&&"has-inline-buttons",ye),Xe=function(e,{hasReply:t,customShape:a,isLastInGroup:s,asForwarded:n,hasThread:c,forceSenderName:r,hasComments:o}={}){const{text:i,photo:l,video:d,audio:b,voice:u,document:m,poll:O,webPage:j,contact:g}=Object(h.w)(e),f=["message-content"],p=(l||d)&&!i,I=Boolean(e.viaBotId);return wt(a)?f.push("emoji-only emoji-only-"+a):i&&f.push("text"),a&&(f.push("custom-shape"),d&&d.isRound&&f.push("round"),o&&f.push("has-comments")),l||d?f.push("media"):b?f.push("audio"):u?f.push("voice"):m?f.push("document"):g?f.push("contact"):O?f.push("poll"):j&&(f.push("web-page"),j.photo&&f.push("media")),n&&!a&&f.push("is-forwarded"),t&&f.push("is-reply"),c&&f.push("has-replies"),I&&f.push("is-via-bot"),r&&f.push("force-sender-name"),a||(f.push("has-shadow"),(t||n||!p||I||r)&&f.push("has-solid-background"),!s||!l&&p||f.push("has-appendix")),f.join(" ")}(e,{hasReply:ke,customShape:Ke,isLastInGroup:m,asForwarded:Ae,hasThread:Ne,forceSenderName:f,hasComments:e.threadInfo&&e.threadInfo.messagesCount>0}),Ze=!Te||!A&&p?p:I,at=Te?I:p,st=x&&e.adminTitle||Te&&!Ae&&Te.adminTitle||void 0,nt=e.threadInfo&&(!xe||j)&&"thread"===G&&!d,ct=Xe.includes("has-appendix");Object(We.a)(Ce,ke?e.replyToMessageId:void 0,E,e.id),Ut(le,Ce,k,N,T),Object(c.o)(()=>{be.current&&(be.current.innerHTML=Me?'':'')},[Me,ct]);const rt=Object(c.m)(t=>{t.stopPropagation(),ae({messageId:Ee,groupedId:e.groupedId})},[Ee,e.groupedId,ae]),it=Object(c.m)(e=>{const t=Re&&n&&n.messages?{messageId:Ee,childMessageIds:n.messages.map(({id:e})=>e),withShift:e&&e.shiftKey}:{messageId:Ee,withShift:e&&e.shiftKey};ae(t)},[ae,Ee,Re,n]),lt=Object(c.m)(()=>{se({messageId:Ee})},[se,Ee]),dt=Object(c.m)(e=>{e.stopPropagation()},[]),bt=Object(c.m)(()=>{Ze&&(Object(h.mb)(Ze.id)?Q({id:Ze.id}):Y({id:Ze.id}))},[Ze,Q,Y]),ut=Object(c.m)(()=>{at&&(Object(h.mb)(at.id)?Q({id:at.id}):Y({id:at.id}))},[at,Q,Y]),mt=Object(c.m)(()=>{v&&Q({id:v.id})},[v,Q]),ht=Object(c.m)(()=>{z({chatId:Ce,threadId:H,messageId:e.replyToMessageId})},[z,Ce,H,e.replyToMessageId]),Ot=Object(c.m)(()=>{W({chatId:Ce,threadId:H,messageId:Ee,origin:Se?l.h.ScheduledInline:l.h.Inline})},[Ce,H,Ee,W,Se]),jt=Object(c.m)(()=>{K({chatId:Ce,messageId:Ee})},[Ce,Ee,K]),gt=Object(c.m)(e=>{W({chatId:Ce,threadId:H,messageId:e,origin:Se?l.h.ScheduledAlbum:l.h.Album})},[Ce,H,W,Se]),pt=Object(c.m)(()=>{ee({messageIds:[Ee]})},[Ee,ee]),It=Object(c.m)(()=>{J({chatId:Ce,messageId:Ee})},[J,Ce,Ee]),vt=Object(c.m)(e=>{te({chatId:Ce,messageId:Ee,options:e})},[Ce,Ee,te]),yt=Object(c.m)(()=>{ce({fromChatId:Ce,groupedId:e.groupedId})},[ce,Ce,e.groupedId]),kt=Object(c.m)(()=>{if(n&&n.messages){const e=n.messages.map(({id:e})=>e);ce({fromChatId:Ce,messageIds:e})}else ce({fromChatId:Ce,messageIds:[Ee]})},[n,ce,Ce,Ee]),Nt=Object(c.m)(()=>{z({chatId:Ce,threadId:i.MAIN_THREAD_ID,messageId:Ee})},[z,Ce,Ee]),Tt=Object(c.m)(()=>{z(xe?{chatId:Te.fromChatId,groupedId:e.groupedId,groupedChatId:Ce}:{chatId:Te.fromChatId,messageId:Te.fromMessageId})},[z,Te,e,Ce,xe]),Pt=Object(ne.a)();let At,xt="",Rt=!1;const Lt=Object(c.p)(()=>Re?Ft(Me,Boolean(Ae),n,ue):void 0,[Re,ue,Me,Ae,n]),Dt=Ae?28:0;if(Re||!Fe&&!De)Lt&&(At=Math.max(Mt(Boolean(Le),nt),Lt.containerStyle.width),At-Lt.containerStyle.width>18&&(Rt=!0));else{let t;Fe?t=St(e).width:De&&(t=De.isRound?et.e:St(e).width),t&&(At=Math.max(Mt(Boolean(Le),nt),t),At-t>18&&(Rt=!0))}At&&(xt=`width: ${At+Dt}px`);const Gt=Object(c.p)(()=>st?Bt(st):void 0,[st]),_t=!(Ye||D||P)&&(!xe||j),Wt=_t&&x&&!Se,Qt=_t&&(Te&&(Te.isChannelPost||A&&!Me)&&Te.fromMessageId||q);return c.a.createElement("div",{ref:le,id:"message"+Ee,className:Je,style:Gt?`--meta-safe-author-width: ${Gt}px`:void 0,"data-message-id":Ee,onClick:D?it:void 0,onDoubleClick:D?void 0:lt,onMouseDown:D?void 0:Oe,onContextMenu:D?void 0:je,onMouseEnter:xe&&!j?Fa:void 0,onMouseLeave:xe&&!j?Da:void 0},c.a.createElement("div",{ref:de,className:"bottom-marker","data-message-id":Ee,"data-last-message-id":n?n.messages[n.messages.length-1].id:void 0,"data-has-unread-mention":e.hasUnreadMention}),!xe&&c.a.createElement("div",{className:"message-select-control"},B&&c.a.createElement("i",{className:"icon-select"})),j&&c.a.createElement("div",{className:Object(X.a)("message-select-control group-select",U&&"is-selected"),onClick:rt},U&&c.a.createElement("i",{className:"icon-select"})),r&&function(){const e=Ze&&Object(h.mb)(Ze.id),t=Ze&&e?Ze:void 0,a=Ze&&!e?Ze:void 0,s=!Ze&&Te?Te.hiddenUserName:void 0;return c.a.createElement(Ht.a,{size:"small",user:t,chat:a,text:s,lastSyncTime:R,onClick:t||a?bt:void 0})}(),c.a.createElement("div",{className:"message-content-wrapper",onClick:D&&xe?it:void 0},c.a.createElement("div",{className:Xe,style:xt,dir:"auto"},Ae&&!Ke&&(!xe||O)&&c.a.createElement("div",{className:"message-title"},Pt("ForwardedMessage")),function(){const t=Object(X.a)("content-inner",Ae&&!Ke&&"forwarded-message",ke&&"reply-message",Rt&&"no-media-corners"),r=m&&!Qe&&!Ae&&!Ne,i=!$e&&!F&&Qe;return c.a.createElement("div",{className:t,onDoubleClick:dt,dir:"auto"},function(){if(Ke||!(o&&!Fe&&!De||Ae||Pe||f)||xe&&!O)return;let t,a;at?(t=Object(h.W)(Pt,at),Ae||(a="color-"+Object(h.Y)(at))):Te&&Te.hiddenUserName&&(t=Te.hiddenUserName);return c.a.createElement("div",{className:"message-title",dir:"ltr"},t?c.a.createElement("span",{className:Object(X.a)(at&&"interactive",a),onClick:at?ut:void 0,dir:"auto"},Object(tt.a)(t)):v?void 0:" ",v&&c.a.createElement(c.a.Fragment,null,c.a.createElement("span",{className:"via"},Pt("ViaBot")),c.a.createElement("span",{className:"interactive",onClick:mt},Object(tt.a)("@"+v.username))),Te&&Te.isLinkedChannelPost?c.a.createElement("span",{className:"admin-title",dir:"auto"},Pt("DiscussChannel")):e.adminTitle&&!x?c.a.createElement("span",{className:"admin-title",dir:"auto"},e.adminTitle):void 0)}(),ke&&c.a.createElement(Vt,{message:E,sender:w,observeIntersection:a,onClick:ht}),Ge&&c.a.createElement(Xt,{message:e,observeIntersection:a,observeIntersectionForPlaying:s,shouldLoop:$,lastSyncTime:R}),F&&c.a.createElement(Zt.a,{isInline:!0,sticker:F,observeIntersection:a,lastSyncTime:R,forceLoadPreview:Object(h.tb)(e)}),Re&&c.a.createElement(Ta,{album:n,albumLayout:Lt,observeIntersection:a,shouldAutoLoad:_,shouldAutoPlay:V,isOwn:Me,hasCustomAppendix:r,lastSyncTime:R,onMediaClick:gt}),!Re&&Fe&&c.a.createElement(ra,{message:e,observeIntersection:a,shouldAutoLoad:_,uploadProgress:S,shouldAffectAppendix:r,onClick:Ot,onCancelUpload:It}),!Re&&De&&De.isRound&&c.a.createElement(xa,{message:e,observeIntersection:a,shouldAutoLoad:_,shouldAutoPlay:V,lastSyncTime:R}),!Re&&De&&!De.isRound&&c.a.createElement(ma,{message:e,observeIntersection:a,shouldAutoLoad:_,shouldAutoPlay:V,uploadProgress:S,lastSyncTime:R,onClick:Ot,onCancelUpload:It}),(Be||Ue)&&c.a.createElement(zt.a,{message:e,uploadProgress:S,lastSyncTime:R,isSelectable:xe,isSelected:B,onPlay:jt,onReadMedia:!Ue||Me&&!A?void 0:pt,onCancelUpload:It}),He&&c.a.createElement($t.a,{message:e,observeIntersection:a,uploadProgress:S,isSelectable:xe,isSelected:B,onCancelUpload:It}),qe&&c.a.createElement(Oa,{contact:qe}),Ve&&c.a.createElement(ya,{message:e,poll:Ve,onSendVote:vt}),!F&&Qe&&c.a.createElement("p",{className:"text-content "+(i?"with-meta":""),dir:"auto"},Qe,i&&c.a.createElement(Kt,{message:e,outgoingStatus:M,signature:st,onClick:it})),$e&&c.a.createElement(wa,{message:e,observeIntersection:a,shouldAutoLoad:_,onMediaClick:Ot,onCancelMediaTransfer:It}),ze&&c.a.createElement(Ma,{message:e}))}(),(!xe||j)&&!(!$e&&!F&&Qe)&&c.a.createElement(Kt,{message:e,outgoingStatus:M,signature:st,onClick:it}),Wt?c.a.createElement(oe.a,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:Pt("lng_context_forward_msg"),onClick:j?yt:kt},c.a.createElement("i",{className:"icon-share-filled"})):Qt?c.a.createElement(oe.a,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:"Focus message",onClick:q?Nt:Tt},c.a.createElement("i",{className:"icon-arrow-right"})):void 0,nt&&c.a.createElement(La,{message:e,disabled:d}),ct&&c.a.createElement("div",{className:"svg-appendix",ref:be})),e.inlineButtons&&c.a.createElement(Ra,{message:e,onClick:re})),he&&c.a.createElement(qt,{isOpen:me,anchor:he,message:e,album:n,messageListType:G,onClose:ge,onCloseAnimationEnd:fe}))}));a(238);const Ha=b.b?1e3:350,Ga=b.g?300:500,qa=Object(g.a)(e=>e(),200,!1);var _a=Object(c.h)(Object(s.h)((e,{chatId:t,threadId:a,type:s})=>{const n=Object(o.f)(e,t);if(!n)return{};const c=Object(o.x)(e,t,a,s),r="scheduled"===s?Object(o.qb)(e,t):Object(o.m)(e,t),l=Object(o.Eb)(e,t,a);if(a!==i.MAIN_THREAD_ID&&!(r&&l&&r[l]))return{};const{isRestricted:d,restrictionReason:b,lastMessage:u}=n,m=Object(o.I)(e,t),O=a===i.MAIN_THREAD_ID&&!c&&!n.unreadCount&&!m&&u&&!u.groupedId;let j;if(Object(o.L)(e,t)){const a=Object(o.g)(e,t);j=a.fullInfo?a.fullInfo.botDescription||"NoMessages":"Updating bot info..."}return{isChatLoaded:!0,isRestricted:d,restrictionReason:b,isChannelChat:Object(h.kb)(n),isChatWithSelf:Object(o.P)(e,t),messageIds:c,messagesById:r,firstUnreadId:Object(o.H)(e,t,a),isViewportNewest:"thread"!==s||Object(o.X)(e,t,a),threadFirstMessageId:Object(o.G)(e,t,a),focusingId:m,isSelectModeActive:Object(o.S)(e),animationLevel:e.settings.byKey.animationLevel,...O&&{lastMessage:u},botDescription:j,threadTopMessageId:l,hasLinkedChat:n.fullInfo&&"linkedChatId"in n.fullInfo?Boolean(n.fullInfo.linkedChatId):void 0}},(e,t)=>Object(d.l)(t,["loadViewportMessages","markMessageListRead","markMessagesRead","setScrollOffset","openHistoryCalendar"]))(({chatId:e,threadId:t,type:a,hasTools:r,onFabToggle:i,onNotchToggle:b,isChatLoaded:u,isChannelChat:m,canPost:O,isChatWithSelf:j,messageIds:f,messagesById:p,firstUnreadId:I,isViewportNewest:v,threadFirstMessageId:y,isRestricted:C,restrictionReason:E,focusingId:w,isSelectModeActive:M,animationLevel:S,loadViewportMessages:k,markMessageListRead:N,markMessagesRead:T,setScrollOffset:P,lastMessage:A,botDescription:R,threadTopMessageId:L,hasLinkedChat:F,openHistoryCalendar:D})=>{const B=Object(c.q)(null),U=Object(c.q)("thread"===a&&Object(o.rb)(Object(s.e)(),e,t)||0),H=Object(c.q)(),G=Object(c.q)(),q=Object(c.q)(),_=Object(c.q)(),V=Object(c.q)(),$=Object(c.q)(),z=Object(c.q)(!1),W=Object(c.q)(!f),[K,Q]=Object(c.r)(),[Y,Z]=Object(c.r)(Boolean(w)),te=Boolean(f);Object(je.a)(()=>{te&&Object(g.d)(()=>{W.current=!1})},[te]),Object(je.a)(()=>{V.current=I,_.current||(_.current=I)},[I]);const{observe:ae,freeze:se,unfreeze:ce}=Object(ft.a)({rootRef:B,throttleMs:Ha,margin:Ga}),{observe:re,freeze:oe,unfreeze:ie}=Object(ft.a)({rootRef:B},e=>{if("thread"!==a)return;let t=0;const s=[];e.forEach(e=>{const{isIntersecting:a,target:n}=e;if(!a)return;const{dataset:c}=n,r=Number(c.lastMessageId||c.messageId);r>t&&(t=r),c.hasUnreadMention&&s.push(r)}),V.current&&t>=V.current&&N({maxId:t}),s.length&&T({messageIds:s})});Object(ee.a)(oe,ie),Object(je.a)(()=>{$.current=w,w?(se(),oe()):(ie(),ce())},[w]);const{observe:le}=Object(ft.a)({rootRef:B,throttleMs:Ha});Object(c.n)(()=>{w?Z(!0):setTimeout(()=>{Z(!1)},200)},[w]);const de=Object(c.p)(()=>{if(!f||!p)return;const e=!L||f[0]&&y!==f[0]?f:[L,...f];if(!e.length)return;const t=e.map(e=>p[e]);return gt(Object(d.k)(t,["date","id"]),_.current)},[f,p,y,L]),[be,ue,me]=Object(c.p)(()=>"thread"===a?[Object(g.a)(()=>k({direction:l.e.Backwards}),1e3,!0,!1),Object(g.a)(()=>k({direction:l.e.Forwards}),1e3,!0,!1),Object(g.a)(()=>k({direction:l.e.Around}),1e3,!0,!1)]:[],[k,f]),{isScrolled:he,updateStickyDates:Oe}=pt(),ge=Object(c.m)(()=>{if(z.current)return void(z.current=!1);const s=B.current;$.current||Oe(s,r),qa(()=>{Object(g.b)(()=>{s.parentElement&&(U.current=s.scrollHeight-s.scrollTop,"thread"===a&&P({chatId:e,threadId:t,scrollOffset:U.current}))})})},[Oe,r,a,P,e,t]);Object(c.n)(()=>{if(!("ResizeObserver"in window))return;const e=new ResizeObserver(([e])=>{e.target.offsetParent&&Q(e.contentRect.height)});return e.observe(B.current),()=>{e.disconnect()}},[]);const{height:fe}=_e();Object(c.n)(()=>{B.current.dataset.normalHeight=String(B.current.offsetHeight)},[fe]),Object(c.n)(()=>{if(!me||!u||C||w)return;const e=B.current;(!f||f.length{if(!f||!q.current)return;const e=q.current.filter(e=>f.includes(Number(e.dataset.messageId))),t=e[1]||e[0];t&&(H.current=t.id,G.current=t.getBoundingClientRect().top)},[f,v,K,r]),Object(Ot.a)(([e,t,a])=>{const s=B.current;if(q.current=Array.from(s.querySelectorAll(".message-list-item")),!s.offsetParent)return;const c=v&&f&&f.length{s.parentElement&&s.parentElement.classList.remove("force-messages-scroll")},1e3));const{scrollTop:o,scrollHeight:i,offsetHeight:l}=s,d=U.current,b=q.current[q.current.length-1],u=b?b.offsetHeight:0,m=v&&t&&d-(a||l)-u<=100;let h;const O=f&&e&&f[0]!==e[0],j=f&&e&&f[f.length-1]!==e[e.length-1],p=f&&$.current===f[f.length-1];if(m&&j&&!O&&!p&&(b&&Object(g.b)(()=>{Object(vt.a)(s,b,"end",20,void 0,void 0,void 0,!0)}),h=i-l,U.current=Math.max(i-h,l),!c))return;const I=void 0!==a&&a!==K,y=H.current&&s.querySelector("#"+H.current),C=!y&&_.current&&s.querySelector(".unread-divider");if(m&&I){if(Object(vt.b)())return;h=i-l}else if(y){h=o+(y.getBoundingClientRect().top-(G.current||0))}else h=C?C.offsetTop-(r?60:10):i-d;Object(It.a)(s,h),$.current||(z.current=!0,Object(g.b)(()=>{z.current=!1})),U.current=Math.max(i-h,l)},[f,v,K,r]),Object(c.n)(()=>{(!S||S>0)&&Object(J.b)(200+n.c)},[S,M]);const pe=Object(ne.a)(),Ie=Boolean(e&&Object(h.mb)(e)),ve=Boolean(!Ie&&!m||j),ye=Object(X.a)("MessageList custom-scroll",!ve&&"no-avatars",m&&"no-avatars",!O&&"no-composer","pinned"===a&&"type-pinned",M&&"select-mode-active",Y&&"has-focusing",he&&"scrolled");return c.a.createElement("div",{ref:B,className:ye,onScroll:ge},C?c.a.createElement("div",{className:"empty"},c.a.createElement("span",null,E?E.text:"This is a private "+(m?"channel":"chat"))):R?c.a.createElement("div",{className:"empty rich"},c.a.createElement("span",null,Object(tt.a)(pe(R),["br","emoji","links"]))):f&&!de?c.a.createElement("div",{className:"empty"},c.a.createElement("span",null,pe("NoMessages"))):f&&de||A?c.a.createElement(yt,{containerRef:B,className:"messages-container",messageIds:f||[A.id],focusingId:w,loadMoreForwards:ue,loadMoreBackwards:be,isViewportNewest:v,firstUnreadId:I,onFabToggle:i,onNotchToggle:b},function(e,t,a,s,r,o,i,l,b,u,m,O,j,g,f,p){const I=c.a.createElement("div",{className:Object(X.a)("unread-divider","local-action-message"),key:"unread-messages"},c.a.createElement("span",null,e("UnreadMessages"))),v=f?0:t.reduce((e,t)=>e+Object(d.h)(t.senderGroups).length,0);let y=0;const C=t.map((t,O,f)=>{const C=t.senderGroups.map((t,n,g)=>{if(1===t.length&&!jt(t[0])&&Object(h.eb)(t[0])){const e=t[0],s=n===g.length-1&&O===f.length-1;return Object(d.e)([e.id===l.current&&I,c.a.createElement(_t,{key:e.id,message:e,observeIntersection:a,appearanceOrder:v-++y,isLastInList:s})])}let p;return Object(d.h)(t.map((C,E)=>{const w=jt(C)?C.mainMessage:C,M=jt(C)?C:void 0,S=Object(h.ub)(w),k=jt(C),N=t[E+1];w.previousLocalId&&i.current==="message"+w.previousLocalId&&(i.current="message"+w.id);const T=!k&&w.groupedId?w.groupedId:void 0,P=N&&!jt(N)?N.groupedId:void 0,A={isFirstInGroup:0===E,isLastInGroup:E===t.length-1,isFirstInDocumentGroup:Boolean(T&&T!==p),isLastInDocumentGroup:Boolean(T&&T!==P),isLastInList:E===t.length-1&&n===g.length-1&&O===f.length-1};p=T;const x=Object(h.G)(w),R="scheduled"!==u?x:`${w.date}_${x}`;return Object(d.e)([w.id===l.current?I:void 0,c.a.createElement(Ua,{key:R,message:w,observeIntersectionForBottom:a,observeIntersectionForMedia:s,observeIntersectionForAnimatedStickers:r,album:M,withAvatar:A.isLastInGroup&&o&&!S&&!(w.id===m),withSenderName:A.isFirstInGroup&&o&&!S,threadId:b,messageListType:u,noComments:!1===j,appearanceOrder:v-++y,isFirstInGroup:A.isFirstInGroup,isLastInGroup:A.isLastInGroup,isFirstInDocumentGroup:A.isFirstInDocumentGroup,isLastInDocumentGroup:A.isLastInDocumentGroup,isLastInList:A.isLastInList}),w.id===m&&c.a.createElement("div",{className:"local-action-message",key:"discussion-started"},c.a.createElement("span",null,e("DiscussionStarted")))])}))});return c.a.createElement("div",{className:"message-date-group",key:t.datetime,teactFastList:!0},c.a.createElement("div",{className:Object(X.a)("sticky-date",!g&&"interactive"),key:"date-header",onClick:g?void 0:()=>p({selectedAt:t.datetime})},c.a.createElement("span",{dir:"auto"},g&&t.originalDate===n.lb&&e("MessageScheduledUntilOnline"),g&&t.originalDate!==n.lb&&e("MessageScheduledOn",Object(x.c)(e,t.datetime,void 0,!0)),!g&&Object(x.c)(e,t.datetime))),Object(d.h)(C))});return Object(d.h)(C)}(pe,de||gt([A]),re,ae,le,ve,H,_,t,a,L,0,F,!!de&&"scheduled"===a,!de||!W.current,D)):c.a.createElement(Ee.a,{color:"white"}))}));a(239);var Va=Object(c.h)(Object(s.h)(e=>{const t=Object(o.y)(e);if(!t)return{};const{chatId:a,threadId:s,type:n}=t,c=Object(o.f)(e,a);return{messageListType:n,unreadCount:c&&s===i.MAIN_THREAD_ID&&"thread"===n?c.unreadCount:void 0}},(e,t)=>Object(d.l)(t,["focusLastMessage"]))(({isShown:e,canPost:t,messageListType:a,unreadCount:s,focusLastMessage:n})=>{const r=Object(ne.a)(),o=Object(c.q)(null),i=Object(c.m)(()=>{if(e)if("thread"===a)n();else{const e=o.current.parentElement.querySelector(".MessageList"),t=e.querySelectorAll(".message-list-item"),a=t[t.length-1];if(!a)return;Object(vt.a)(e,a,"end",20)}},[e,a,n]),l=Object(X.a)("ScrollDownButton",e&&"revealed",!t&&"no-composer");return c.a.createElement("div",{ref:o,className:l},c.a.createElement("div",{className:"ScrollDownButton-inner"},c.a.createElement(oe.a,{color:"secondary",round:!0,onClick:i,ariaLabel:r("AccDescrPageDown")},c.a.createElement("i",{className:"icon-arrow-down"})),Boolean(s)&&c.a.createElement("div",{className:"unread-count"},Object(Qe.b)(s))))})),$a=a(131),za=a(139);async function Wa(e,t,a,s){const n=URL.createObjectURL(t),{type:c,size:r}=t;let o,i;if(c.startsWith("image/"))if(a){const a=await Object(Ge.g)(n),{width:r,height:i}=a;if(r>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),Wa(e,c,!0,s)):Wa(e,t,!1,s)}o={width:r,height:i}}else i=n;else if(c.startsWith("video/")){if(r<10485760){const{videoWidth:e,videoHeight:t,duration:a}=await Object(Ge.h)(n);o={width:e,height:t,duration:a}}i=await Object(Ge.c)(n)}return{blobUrl:n,filename:e,mimeType:c,size:r,quick:o,previewBlobUrl:i,...s}}var Ka=a(183),Qa=a.p+"8ccc0b555efcec3616377aea078dda16.js";const Ya={encoderPath:Qa,reuseWorker:!0},Ja={type:"audio/ogg"};let Xa,Za,es;async function ts(){return Xa||(Xa=a.e(9).then(a.t.bind(null,318,7)),Za=(await Xa).default,es=new Za(Ya)),Xa}async function as(e){await async function(){await ts(),await es.start()}();const t=Date.now();let a;const s=[],n=[];es.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 r=!1;return function e(){if(r)return;s.getByteFrequencyData(c);const a=c.reduce((e,t)=>e+t,0),o=a/n/255;t(o<.1?0:o),requestAnimationFrame(e)}(),()=>{r=!0}}(es,t=>{n.push(255*t),e(t)});return{stop:()=>new Promise((e,r)=>{es.onstop=()=>{e({blob:new Blob(s,Ja),duration:Math.round(((a||Date.now())-t)/1e3),waveform:n})},es.onerror=r;const o=Math.max(0,t+1e3-Date.now());setTimeout(()=>{es.stop(),c()},o)}),pause:()=>{const e=Math.max(0,t+1e3-Date.now());setTimeout(()=>{es.pause(),a=Date.now(),c()},e)}}}const ss=["image/png","image/jpeg","image/gif"];function ns(e){const{text:t,entities:a}=e||{};if(!t)return"";const s=Object(Et.b)(t,a,void 0,void 0,!0);return Array.isArray(s)?s.join(""):s}let cs,rs;var os=a(64);var is=a(184),ls=a(192);var ds=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Ce.a)(ye.a.Extra,"DeleteMessageModal",!t);return a?c.a.createElement(a,e):void 0});function bs(){return(bs=Object.assign||function(e){for(var t=1;t{const a=Object(c.q)(!1),s=Object(c.m)(()=>{if(a.current=!0,ms)return ms=!1,void e();us&&(clearTimeout(us),us=void 0),us=window.setTimeout(()=>{a.current&&e()},200)},[e]),n=Object(c.m)(()=>{a.current=!1},[]);return c.a.createElement(oe.a,bs({},t,{onMouseEnter:b.l?void 0:s,onMouseLeave:b.l?void 0:n,onClick:b.l?e:void 0}))});var Os=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Ce.a)(ye.a.Extra,"AttachMenu",!t);return a?c.a.createElement(a,e):void 0});var js=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Ce.a)(ye.a.Extra,"SymbolMenu",!t);return a?c.a.createElement(a,e):void 0});var gs=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Ce.a)(ye.a.Extra,"MentionTooltip",!t);return a?c.a.createElement(a,e):void 0});var fs=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Ce.a)(ye.a.Extra,"CustomSendMenu",!t);return a?c.a.createElement(a,e):void 0});var ps=e=>{const{isOpen:t}=e,a=Object(Ce.a)(ye.a.Extra,"StickerTooltip",!t);return a?c.a.createElement(a,e):void 0},Is=a(185);var vs=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Ce.a)(ye.a.Extra,"BotKeyboardMenu",!t);return a?c.a.createElement(a,e):void 0}),ys=a(186),Cs=a(120);a(241);var Es=Object(c.h)(Object(s.h)(e=>{const{chatId:t,threadId:a,type:s}=Object(o.y)(e)||{};if(!t||!a||!s)return{};const{currentUserId:n,forwardMessages:{fromChatId:c,toChatId:r,messageIds:i}}=e,l=Object(o.mb)(e,t,a),d="scheduled"===s?Object(o.E)(e,t):Object(o.C)(e,t,a),b=e.settings.byKey.animationLevel>=1,u=r===t;let m,O;if(l?m=Object(o.k)(e,t,l):d?m=Object(o.D)(e,t,a,s):u&&1===i.length&&(m=Object(o.k)(e,c,i[0])),l&&m){const{forwardInfo:a}=m,s=t===n;a&&(a.isChannelPost||s)&&(O=Object(o.K)(e,m)),O||(O=Object(o.tb)(e,m))}else u&&(O=Object(h.mb)(c)?Object(o.Gb)(e,c):Object(o.f)(e,c));return{replyingToId:l,editingId:d,message:m,sender:O,shouldAnimate:b,forwardedMessagesCount:u?i.length:void 0}},(e,t)=>Object(d.l)(t,["setReplyingToId","setEditingId","focusMessage","exitForwardMode"]))(({replyingToId:e,editingId:t,message:a,sender:s,shouldAnimate:n,forwardedMessagesCount:r,setReplyingToId:o,setEditingId:i,focusMessage:l,exitForwardMode:d})=>{const b=Boolean((e||t)&&a||s&&r),u=Object(Cs.a)([r],r?300:void 0),{shouldRender:m,transitionClassNames:h}=Object(Z.a)(u&&b,void 0,!n,void 0,!n),O=Object(c.m)(()=>{e?o({messageId:void 0}):t?i({messageId:void 0}):r&&d()},[e,t,r,o,i,d]);Object(c.n)(()=>b?Object(te.a)(O):void 0,[b,O]);const j=Object(c.m)(()=>{l({chatId:a.chatId,messageId:a.id})},[l,a]),g=Object(X.a)("ComposerEmbeddedMessage",h),f=r&&r>1?r+" forwarded messages":void 0;if(m)return c.a.createElement("div",{className:g},c.a.createElement("div",null,c.a.createElement(oe.a,{round:!0,color:"translucent",ariaLabel:"Cancel replying",onClick:O},c.a.createElement("i",{className:"icon-close"})),c.a.createElement(Vt,{className:"inside-input",message:a,sender:s,customText:f,title:t?"Edit Message":void 0,onClick:j})))}));var ws=Object(c.h)(e=>{const{attachments:t}=e,a=Object(Ce.a)(ye.a.Extra,"AttachmentModal",!t.length);return a?c.a.createElement(a,e):void 0});var Ms=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Ce.a)(ye.a.Extra,"PollModal",!t);return a?c.a.createElement(a,e):void 0});var Ss=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Ce.a)(ye.a.Extra,"DropArea",!t);return a?c.a.createElement(a,e):void 0});a(242);const ks=new RegExp(n.gb,"i");var Ns=Object(c.h)(Object(s.h)((e,{chatId:t,threadId:a})=>{const s=Object(o.cb)(e,t,a);return{webPagePreview:e.webPagePreview,noWebPage:s}},(e,t)=>Object(d.l)(t,["loadWebPagePreview","clearWebPagePreview","toggleMessageWebPage"]))(({chatId:e,threadId:t,messageText:a,disabled:s,webPagePreview:n,noWebPage:r,loadWebPagePreview:o,clearWebPagePreview:l,toggleMessageWebPage:d})=>{const b=Object(c.p)(()=>{const{text:e,entities:t}=Object(za.a)(a),s=t&&t.find(({type:e})=>e===i.ApiMessageEntityTypes.TextUrl);if(s)return s.url;const n=e.match(ks);return n?n[0]:void 0},[a]);Object(c.n)(()=>{b?o({text:b}):(l(),d({chatId:e,threadId:t}))},[e,d,l,b,o,t]),Object(je.a)(()=>{l(),d({chatId:e,threadId:t})},[e]);const u=Boolean(n&&a.length&&!r&&!s),{shouldRender:m,transitionClassNames:h}=Object(Z.a)(u),O=Object(Ke.a)(n);if(!m||!O)return;const{photo:j,...g}=O,f={content:{webPage:g}};return c.a.createElement("div",{className:Object(X.a)("WebPagePreview",h)},c.a.createElement("div",null,c.a.createElement(oe.a,{round:!0,color:"translucent",ariaLabel:"Clear Webpage Preview",onClick:()=>{d({chatId:e,threadId:t,noWebPage:!0})}},c.a.createElement("i",{className:"icon-close"})),c.a.createElement(wa,{message:f,inPreview:!0})))})),Ts=a(123);var Ps=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Ce.a)(ye.a.Extra,"CalendarModal",!t);return a?c.a.createElement(a,e):void 0});var As=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Ce.a)(ye.a.Extra,"PaymentModal",!t);return a?c.a.createElement(a,e):void 0});var xs,Rs=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Ce.a)(ye.a.Extra,"ReceiptModal",!t);return a?c.a.createElement(a,e):void 0});a(243);!function(e){e.Send="send",e.Record="record",e.Edit="edit"}(xs||(xs={}));var Ls=Object(c.h)(Object(s.h)((e,{chatId:t,threadId:a,messageListType:s})=>{const n=Object(o.f)(e,t),c=n&&Object(o.o)(e,n),r=n?Object(o.O)(e,n):void 0,l=Object(o.P)(e,t),d=r&&Object(o.bb)(e,t),b=Object(o.ob)(e,t),{language:u}=e.settings.byKey,m=Object(o.F)(e,u);return{editingMessage:Object(o.D)(e,t,a,s),connectionState:e.connectionState,draft:Object(o.B)(e,t,a),chat:n,isChatWithBot:r,isChatWithSelf:l,canScheduleUntilOnline:!l&&!r&&n&&c&&Object(h.mb)(t)&&c.status&&Boolean(c.status.wasOnline),isRightColumnShown:Object(o.W)(e),isSelectModeActive:Object(o.S)(e),withScheduledButton:a===i.MAIN_THREAD_ID&&"thread"===s&&Boolean(b&&b.length),shouldSchedule:"scheduled"===s,botKeyboardMessageId:d?d.id:void 0,isForwarding:t===e.forwardMessages.toChatId,canSuggestMembers:n&&Object(h.lb)(n),isPollModalOpen:e.isPollModalOpen,stickersForEmoji:e.stickers.forEmoji.stickers,groupChatMembers:n&&n.fullInfo&&n.fullInfo.members,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,language:u,emojiKeywords:m?m.keywords:void 0,serverTimeOffset:e.serverTimeOffset}},(e,t)=>Object(d.l)(t,["sendMessage","editMessage","saveDraft","clearDraft","showError","setStickerSearchQuery","setGifSearchQuery","forwardMessages","openPollModal","closePollModal","closePaymentModal","clearReceipt","loadScheduledHistory","openChat","addRecentEmoji","loadEmojiKeywords"]))(({dropAreaState:e,shouldSchedule:t,canScheduleUntilOnline:a,onDropHide:r,editingMessage:o,chatId:l,threadId:d,messageListType:u,draft:m,chat:O,connectionState:j,isChatWithBot:f,isChatWithSelf:p,isRightColumnShown:I,isSelectModeActive:v,isForwarding:y,canSuggestMembers:C,isPollModalOpen:E,isPaymentModalOpen:w,isReceiptModalOpen:M,botKeyboardMessageId:S,withScheduledButton:k,stickersForEmoji:N,groupChatMembers:T,currentUserId:P,usersById:A,lastSyncTime:R,contentToBeScheduled:L,shouldSuggestStickers:F,language:D,emojiKeywords:B,serverTimeOffset:U,recentEmojis:H,sendMessage:G,editMessage:q,saveDraft:_,clearDraft:V,showError:$,setStickerSearchQuery:z,setGifSearchQuery:W,forwardMessages:K,openPollModal:Q,closePollModal:Y,loadScheduledHistory:J,closePaymentModal:Z,openChat:ee,clearReceipt:ae,addRecentEmoji:se,loadEmojiKeywords:ce})=>{const re=Object(c.q)(null),[ie,le]=Object(c.r)(""),de=Object(c.q)(),be=Object(sa.a)(e),[ue,he,Oe]=Object(ot.a)(),[je,ge]=Object(c.r)(),fe=Object(c.q)(ie);Object(c.n)(()=>{fe.current=ie},[ie]),Object(c.n)(()=>{de.current=void 0},[l]),Object(c.n)(()=>{l&&R&&d===i.MAIN_THREAD_ID&&J()},[l,J,R,d]),Object(c.o)(()=>{re.current&&(re.current.innerHTML='')},[]),Object(c.n)(()=>{L&&(ge(L),he())},[L,he]);const[pe,Ie]=Object(c.r)([]),[ve,ye,Ce]=Object(ot.a)(),[Ee,we,Me]=Object(ot.a)(),[Se,ke,Ne]=Object(ot.a)(),[Te,Pe,Ae]=Object(ot.a)(),[xe,Re]=Object(ot.a)(),[Le,Fe,De]=Object(ot.a)(),{startRecordingVoice:Be,stopRecordingVoice:He,pauseRecordingVoice:Ge,activeVoiceRecording:qe,currentRecordTime:_e,recordButtonRef:Ve,startRecordTimeRef:$e}=(()=>{const e=Object(c.q)(null),[t,a]=Object(c.r)(),s=Object(c.q)(),[n,r]=Object(c.r)();Object(c.n)(()=>{b.e&&ts()},[]);const o=Object(c.m)(async()=>{try{const{stop:t,pause:n}=await as(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)`),r(Date.now()))});s.current=Date.now(),r(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,r(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(te.a)(l):void 0,[t,l]),{startRecordingVoice:o,pauseRecordingVoice:i,stopRecordingVoice:l,activeVoiceRecording:t,currentRecordTime:n,recordButtonRef:e,startRecordTimeRef:s}})(),ze=o?xs.Edit:!b.m||qe||ie&&!pe.length||y?xs.Send:xs.Record,We=!t,{isMentionTooltipOpen:Ke,mentionFilter:Qe,closeMentionTooltip:Ye,insertMention:Je,mentionFilteredMembers:Xe}=Object(ls.a)(C&&!pe.length,ie,le,void 0,T,P,A),{isContextMenuOpen:Ze,handleContextMenu:et,handleContextMenuClose:at,handleContextMenuHide:st}=Object(Ct.a)(Ve,!(ze===xs.Send&&We)),nt=Object(c.p)(()=>Object(h.c)(O,f),[O,f]),ct=O&&Object(h.hb)(O),rt=Object(h.k)(O),{isStickerTooltipOpen:it,closeStickerTooltip:lt}=function(e,t,a){const{loadStickersForEmoji:n,clearStickersForEmoji:r}=Object(s.d)(),o=b.d&&1===Object(os.a)(t)||!b.d&&Boolean(t.match(/^]*?>$/g)),i=Boolean(a)&&o;return Object(c.n)(()=>{e&&o?n({emoji:t}):!i&&o||r()},[t,o,r,n,e]),{isStickerTooltipOpen:i,closeStickerTooltip:r}}(Boolean(F&&nt.canSendStickers&&!pe.length),ie,N),{isEmojiTooltipOpen:dt,closeEmojiTooltip:bt,filteredEmojis:ut,insertEmoji:mt}=Object(is.a)(Boolean(F&&nt.canSendStickers&&!pe.length),ie,H,void 0,le,B),ht=Object(c.m)((e,t=n.v)=>{const a=window.getSelection(),s=document.getElementById(t),c=Object(tt.a)(e,["escape_html","emoji_html","br_html"]).join("").replace(/\u200b+/g,"​");if(a.rangeCount){const n=a.getRangeAt(0);if(Object(Ka.a)(n,t))return void(b.d?document.execCommand("insertText",!1,e):(!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),t.removeAllRanges(),t.addRange(a))}}(c),s.dispatchEvent(new Event("input",{bubbles:!0}))))}le(`${fe.current}${c}`),b.g||requestAnimationFrame(()=>{Object($a.a)(s)})},[]),Ot=Object(c.m)(()=>{const e=window.getSelection();if(e.rangeCount){const t=e.getRangeAt(0);if(Object(Ka.a)(t,n.v))return void document.execCommand("delete",!1)}le(function(e){const t=document.createElement("div");t.contentEditable="true",t.style.position="absolute",t.style.left="-10000px",t.style.top="-10000px",t.innerHTML=e,document.body.appendChild(t);let 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 r=t.innerHTML;return document.body.removeChild(t),r}(fe.current))},[]),jt=Object(c.m)(()=>{le(""),Ie([]),lt(),Oe(),ge(void 0),Ye(),bt(),b.g?setTimeout(()=>Ne(),350):Ne()},[lt,Oe,Ye,bt,Ne]),gt=Object(sa.a)(l);Object(c.n)(()=>{gt&&l!==gt&&(He(),jt())},[l,gt,jt,He]);const ft=((e,t,a,s,r,o)=>{Object(c.n)(()=>{a?(t(ns(a.content.text)),requestAnimationFrame(()=>{const e=document.getElementById(n.v);Object($a.a)(e,!0)})):t("")},[a,t]);return Object(c.m)(()=>{const{text:t,entities:n}=Object(za.a)(e.current);a&&(t||Object(h.db)(a)?(o({messageId:a.id,text:t,entities:n}),s()):r())},[o,a,e,r,s])})(fe,le,o,jt,Pe,q);((e,t,a,s,r,o,i,l,d)=>{const b=Object(c.m)((e,t)=>{r.current.length&&!i?l({chatId:e,threadId:t,draft:Object(za.a)(r.current)}):d({chatId:e,threadId:t})},[d,i,r,l]),u=Object(c.p)(()=>Object(g.a)(e=>e(),n.u,!1),[t]),m=Object(sa.a)(t),h=Object(sa.a)(a);Object(c.n)(()=>(cs=t,rs=a,()=>{cs=void 0,rs=void 0,b(t,a)}),[t,a,b]),Object(c.n)(()=>{t===m&&a===h||e&&(o(ns(e)),requestAnimationFrame(()=>{const e=document.getElementById(n.v);Object($a.a)(e,!0)}))},[t,a,e,o,b,m,h]);const O=Object(sa.a)(s);Object(c.n)(()=>{t&&a&&m===t&&h===a&&O!==s&&(s.length?u(()=>{cs===t&&rs===a&&b(t,a)}):b(t,a))},[t,s,m,O,h,u,a,b]),Object(c.n)(()=>{function e(){t&&a&&b(t,a)}return window.addEventListener("blur",e),()=>{window.removeEventListener("blur",e)}},[t,a,b])})(m,l,d,ie,fe,le,o,_,V),((e,t,a)=>{Object(c.n)(()=>{async function s(s){if(!s.clipboardData)return;const c=document.activeElement;if(c&&"INPUT"===c.tagName&&![n.v,n.w].includes(c.id))return;const{items:r}=s.clipboardData,o=Array.from(r).find(e=>ss.includes(e.type)),i=o&&o.getAsFile(),l=s.clipboardData.getData("text").substring(0,4096);if(i||l){if(s.preventDefault(),i&&!a){const e=await Wa(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])})(ht,Ie,o);const pt=Object(c.m)(async(e,t)=>{Ie(await Promise.all(e.map(e=>Wa(e.name,e,t))))},[]),It=Object(c.m)(async(e,t)=>{Ie([...pe,...await Promise.all(e.map(e=>Wa(e.name,e,t)))])},[pe]),vt=Object(c.m)(()=>{Ie([])},[]),yt=Object(c.m)(async(e=!1,t)=>{if("connectionStateReady"!==j)return;let a=pe;if(qe){const e=await He();if(e){const{blob:t,duration:s,waveform:n}=e;a=[await Wa("wonderful-voice-message.ogg",t,!1,{voice:{duration:s,waveform:n}})]}}const{text:s,entities:c}=Object(za.a)(fe.current);if(a.length||s||y)if(a.length&&s&&s.length>1024){const e=s.length-1024;$({error:{message:"CAPTION_TOO_LONG_PLEASE_REMOVE_CHARACTERS",textParams:{"{EXTRA_CHARS_COUNT}":e,"{PLURAL_S}":e>1?"s":""}}})}else{if(a.length||s){if(rt&&!ct){const e=Math.floor(Date.now()/1e3)+U,t=de.current&&Math.floor(e-de.current),a=rt.nextSendDate&&rt.nextSendDate>e;if(t&&t{e={...e,isPreloadedGlobally:!0},t?(ge({sticker:e}),he()):(G({sticker:e}),requestAnimationFrame(jt))},[t,he,G,jt]),wt=Object(c.m)(e=>{t?(ge({gif:e}),he()):(G({gif:e}),requestAnimationFrame(jt))},[t,he,G,jt]),Mt=Object(c.m)(e=>{t?(ge({poll:e}),Y(),he()):(G({poll:e}),Y())},[Y,he,G,t]),St=Object(c.m)(()=>{t?(ge({isSilent:!0}),he()):yt(!0)},[yt,he,t]),kt=Object(c.m)((e,t=!1)=>{const{isSilent:a,...s}=je||{},n=Math.round(Math.max(e.getTime(),Date.now()+6e4)/1e3)+(t?0:U);je&&0!==Object.keys(s).length?(G({...je,scheduledAt:n}),requestAnimationFrame(jt)):yt(!!a,n),Oe()},[Oe,yt,jt,je,G,U]),Nt=Object(c.m)(()=>{kt(new Date(1e3*n.lb),!0)},[kt]),Tt=Object(c.m)(()=>{Oe(),ge(void 0)},[Oe]),Pt=Object(c.m)(e=>{"stickers"===e?(z({query:""}),W({query:void 0})):(W({query:""}),z({query:void 0}))},[z,W]),At=Object(c.m)(()=>{const e=document.getElementById(n.v);b.g&&e===document.activeElement?(e.blur(),setTimeout(()=>{ke()},100)):ke()},[ke]),xt=Object(c.m)(()=>{ee({id:l,threadId:d,type:"scheduled"})},[ee,l,d]);Object(c.n)(()=>{I&&b.g&&Ne()},[I,Ne]),Object(c.n)(()=>{v?Fe():setTimeout(()=>{De()},200)},[v,De,Fe]);const Rt=Object(c.m)(()=>{switch(ze){case xs.Send:t?(qe&&Ge(),he()):(yt(),requestAnimationFrame(jt));break;case xs.Record:Be();break;case xs.Edit:ft()}},[ze,jt,t,Be,ft,qe,he,Ge,yt]),Lt=Object(ne.a)(),Ft=ze===xs.Record&&!nt.canAttachMedia,Dt=Object(sa.a)(o,!0),Bt=o||Dt,Ut=new Date;Ut.setSeconds(0),Ut.setMilliseconds(0);const Ht=new Date;Ht.setFullYear(Ht.getFullYear()+1);let Gt="SendMessage";switch(ze){case xs.Edit:Gt="Save edited message";break;case xs.Record:Gt=Ft?"Conversation.DefaultRestrictedMedia":"AccDescrVoiceMessage"}const qt=Object(X.a)("Composer",!v&&"shown",Le&&"hover-disabled"),_t=Object(X.a)("mobile-symbol-menu-button",xe?Se&&"menu-opened":Se&&"is-loading"),Vt=ze===xs.Edit?ft:t?he:yt;return c.a.createElement("div",{className:qt},nt.canAttachMedia&&c.a.createElement(Ts.a,{containerId:"#middle-column-portals"},c.a.createElement(Ss,{isOpen:e!==Ue.a.None,withQuick:[e,be].includes(Ue.a.QuickFile),onHide:r,onFileSelect:pt})),c.a.createElement(ws,{attachments:pe,caption:pe.length?ie:"",canSuggestMembers:C,groupChatMembers:T,currentUserId:P,usersById:A,recentEmojis:H,onCaptionUpdate:le,language:D,emojiKeywords:B,addRecentEmoji:se,loadEmojiKeywords:ce,onSend:t?he:yt,onFileAppend:It,onClear:vt}),c.a.createElement(Ms,{isOpen:Boolean(E),onClear:Y,onSend:Mt}),c.a.createElement(As,{isOpen:Boolean(w),onClose:Z}),c.a.createElement(Rs,{isOpen:Boolean(M),onClose:ae}),Bt&&c.a.createElement(ds,{isOpen:Te,isSchedule:"scheduled"===u,onClose:Ae,message:Bt}),c.a.createElement(gs,{isOpen:Ke,filter:Qe,onClose:Ye,onInsertUserName:Je,filteredChatMembers:Xe,usersById:A}),c.a.createElement("div",{id:"message-compose"},c.a.createElement("div",{className:"svg-appendix",ref:re}),c.a.createElement(Es,null),c.a.createElement(Ns,{chatId:l,threadId:d,messageText:pe.length?"":ie,disabled:!nt.canAttachEmbedLinks}),c.a.createElement("div",{className:"message-input-wrapper"},b.g?c.a.createElement(oe.a,{className:_t,round:!0,color:"translucent",onClick:Se?Ne:At,ariaLabel:"Choose emoji, sticker or GIF"},c.a.createElement("i",{className:"icon-smile"}),c.a.createElement("i",{className:"icon-keyboard"}),c.a.createElement(me.a,{color:"gray"})):c.a.createElement(hs,{className:""+(Se?"activated":""),round:!0,faded:!0,color:"translucent",onActivate:ke,ariaLabel:"Choose emoji, sticker or GIF"},c.a.createElement("i",{className:"icon-smile"})),c.a.createElement(ys.a,{id:"message-input-text",html:pe.length?"":ie,placeholder:qe&&window.innerWidth<=600?"":Lt("Message"),shouldSetFocus:Se,shouldSupressFocus:b.g&&Se,shouldSupressTextFormatter:dt||Ke,onUpdate:le,onSend:Vt,onSupressedFocus:Ne}),k&&c.a.createElement(oe.a,{round:!0,faded:!0,className:"scheduled-button",color:"translucent",onClick:xt,ariaLabel:"Open scheduled messages"},c.a.createElement("i",{className:"icon-schedule"})),S&&!qe&&!o&&c.a.createElement(hs,{className:""+(ve?"activated":""),round:!0,faded:!0,color:"translucent",onActivate:ye,ariaLabel:"Open bot command keyboard"},c.a.createElement("i",{className:"icon-bot-command"})),!qe&&!o&&c.a.createElement(hs,{className:""+(Ee?"activated":""),round:!0,faded:!0,color:"translucent",onActivate:we,ariaLabel:"Add an attachment"},c.a.createElement("i",{className:"icon-attach"})),qe&&_e&&c.a.createElement("span",{className:"recording-state"},Object(x.i)(_e-$e.current)),c.a.createElement(ps,{isOpen:it,onStickerSelect:Et}),c.a.createElement(Is.a,{isOpen:dt,emojis:ut,onClose:bt,onEmojiSelect:mt,addRecentEmoji:se,loadEmojiKeywords:ce,language:D}),c.a.createElement(Os,{isOpen:Ee,allowedAttachmentOptions:nt,onFileSelect:pt,onPollCreate:Q,onClose:Me}),S&&c.a.createElement(vs,{messageId:S,isOpen:ve,onClose:Ce}),c.a.createElement(js,{isOpen:Se,allowedAttachmentOptions:nt,onLoad:Re,onClose:Ne,onEmojiSelect:ht,onStickerSelect:Et,onGifSelect:wt,onRemoveSymbol:Ot,onSearchOpen:Pt,addRecentEmoji:se}))),qe&&c.a.createElement(oe.a,{round:!0,color:"danger",className:"cancel",onClick:He,ariaLabel:"Cancel voice recording"},c.a.createElement("i",{className:"icon-delete"})),c.a.createElement(oe.a,{ref:Ve,round:!0,color:"secondary",className:`${ze} ${qe?"recording":""}`,disabled:Ft,ariaLabel:Lt(Gt),onClick:Rt,onContextMenu:ze===xs.Send&&We?et:void 0},c.a.createElement("i",{className:"icon-send"}),c.a.createElement("i",{className:"icon-microphone-alt"}),c.a.createElement("i",{className:"icon-check"})),We&&c.a.createElement(fs,{isOpen:Ze,onSilentSend:p?void 0:St,onScheduleSend:t?void 0:he,onClose:at,onCloseAnimationEnd:st}),c.a.createElement(Ps,{isOpen:ue,withTimePicker:!0,selectedAt:Ut.getTime(),maxAt:Object(x.k)(Ht),isFutureMode:!0,secondButtonLabel:a?"Send When Online":void 0,onClose:Tt,onSubmit:kt,onSecondButtonClick:a?Nt:void 0}))}));var Fs=Object(c.h)(e=>{const{isActive:t}=e,a=Object(Ce.a)(ye.a.Extra,"MobileSearch",!t,!0);return a?c.a.createElement(a,e):void 0});var Ds=Object(c.h)(e=>{const{isActive:t}=e,a=Object(Ce.a)(ye.a.Extra,"MessageSelectToolbar",!t);return a?c.a.createElement(a,e):void 0});var Bs=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Ce.a)(ye.a.Extra,"UnpinAllMessagesModal",!t);return a?c.a.createElement(a,e):void 0});a(244);const Us=b.g?450+n.c:void 0;function Hs(e){return"file"===e.kind&&e.type&&n.l.includes(e.type)}var Gs=Object(c.h)(Object(s.h)(e=>{const{theme:t}=e.settings.byKey,{isBlurred:a,background:s,backgroundColor:n,patternColor:c}=e.settings.themes[t]||{},r=Object(o.y)(e),{chats:{listIds:l}}=e,d={theme:t,customBackground:s,backgroundColor:n,patternColor:c,isRightColumnShown:Object(o.W)(e),isBackgroundBlurred:a,isMobileSearchActive:Boolean(b.g&&Object(o.A)(e)),isSelectModeActive:Object(o.S)(e),animationLevel:e.settings.byKey.animationLevel};if(!r||!l.active)return d;const{chatId:u,threadId:m,type:O}=r,j=Object(o.f)(e,u),g=Object(o.jb)(e,u),{chatId:f,messageId:p}=e.audioPlayer,I=j&&Object(h.e)(j,m),v=Object(o.L)(e,u),y="pinned"===O;return{...d,chatId:u,threadId:m,messageListType:O,isPrivate:Object(h.mb)(u),canPost:!y&&(!j||I)&&(!v||b.g),isPinnedMessageList:y,messageSendingRestrictionReason:j&&Object(h.L)(j),hasPinnedOrAudioMessage:m!==i.MAIN_THREAD_ID||Boolean(g&&g.length)||Boolean(f&&p),pinnedMessagesCount:g?g.length:0}},(e,t)=>Object(d.l)(t,["openChat","unpinAllMessages","loadUser"]))(({chatId:e,threadId:t,messageListType:a,isPrivate:s,isPinnedMessageList:r,canPost:o,messageSendingRestrictionReason:l,hasPinnedOrAudioMessage:d,pinnedMessagesCount:u,customBackground:m,theme:h,backgroundColor:O,patternColor:j,isRightColumnShown:g,isBackgroundBlurred:f,isMobileSearchActive:p,isSelectModeActive:I,animationLevel:v,openChat:y,unpinAllMessages:C,loadUser:E})=>{const{width:w}=_e(),[M,S]=Object(c.r)(Ue.a.None),[k,N]=Object(c.r)(),[T,P]=Object(c.r)(),[A,x]=Object(c.r)(!1),R=d&&(wn.ab&&w=n.Z&&we?Object(te.a)(()=>{y({id:void 0})}):void 0,[e,y]),Object(c.n)(()=>{S(Ue.a.None),N(void 0),P(void 0)},[e]),Object(c.n)(()=>{s&&E({userId:e})},[e,s,E]);const G=Object(c.m)(e=>{if(b.l)return;const{items:t}=e.dataTransfer||{},a=t&&Array.from(t).every(Hs);S(a?Ue.a.QuickFile:Ue.a.Document)},[]),q=Object(c.m)(()=>{S(Ue.a.None)},[]),_=Object(c.m)(()=>{x(!0)},[]),V=Object(c.m)(()=>{x(!1)},[]),$=Object(c.m)(()=>{C({chatId:e}),V(),y({id:e})},[C,y,V,e]),z=((e,t)=>{const[a,s]=Object(c.r)(t);return Object(c.n)(()=>{t&&(t.startsWith("#")?s(t):He.c(n.m,e,He.a.Blob).then(e=>{const t=URL.createObjectURL(e);Object(Ge.g)(t).then(()=>{s(`url(${t})`)})}))},[t,e]),t?a:void 0})(h,m),W=Object(X.a)(U&&"has-header-tools",m&&"custom-bg-image",O&&"custom-bg-color",m&&f&&"blurred",b.n?"mask-image-disabled":"mask-image-enabled"),K=Object(X.a)("messaging-disabled",!I&&"shown"),{composerHiddenScale:Q,toolbarHiddenScale:Y,composerTranslateX:J,toolbarTranslateX:Z,unpinHiddenScale:ee,toolbarForUnpinHiddenScale:se}=Object(c.p)(()=>$e(w,B),[B,w]),ce=Object(ne.a)(),re=Object(X.a)("middle-column-footer",!B&&"no-composer",B&&T&&!I&&"with-notch");return c.a.createElement("div",{id:"MiddleColumn",className:W,style:`\n --composer-hidden-scale: ${Q};\n --toolbar-hidden-scale: ${Y};\n --unpin-hidden-scale: ${ee};\n --toolbar-unpin-hidden-scale: ${se};\n --composer-translate-x: ${J}px;\n --toolbar-translate-x: ${Z}px;\n --pattern-color: ${j};\n --theme-background-color:\n ${O||("dark"===h?n.n:n.I)};\n `},c.a.createElement("div",{id:"middle-column-bg",style:z?"--custom-background: "+z:void 0}),c.a.createElement("div",{id:"middle-column-portals"}),L&&F&&c.a.createElement(c.a.Fragment,null,c.a.createElement("div",{className:"messages-layout",onDragEnter:B?G:void 0},c.a.createElement(ht,{chatId:L,threadId:F,messageListType:D}),c.a.createElement(ae.a,{name:v===n.e?"slide":"fade",activeKey:"thread"===D&&F===i.MAIN_THREAD_ID?1:2,shouldCleanup:!0},()=>c.a.createElement(c.a.Fragment,null,c.a.createElement(_a,{key:`${L}-${F}-${D}`,chatId:L,threadId:F,type:D,canPost:B,hasTools:U,onFabToggle:N,onNotchToggle:P}),c.a.createElement("div",{className:re},B&&c.a.createElement(Ls,{chatId:L,threadId:F,messageListType:D,dropAreaState:M,onDropHide:q}),r&&c.a.createElement("div",{className:"unpin-button-container",dir:ce.isRtl?"rtl":void 0},c.a.createElement(oe.a,{size:"tiny",fluid:!0,color:"secondary",className:"unpin-all-button",onClick:_},c.a.createElement("i",{className:"icon-unpin"}),c.a.createElement("span",null,ce("Chat.Pinned.UnpinAll",u,"i")))),!r&&!B&&l&&c.a.createElement("div",{className:K},c.a.createElement("div",{className:"messaging-disabled-inner"},c.a.createElement("span",null,l))),c.a.createElement(Ds,{messageListType:D,isActive:I,canPost:B})))),c.a.createElement(Va,{isShown:H,canPost:B})),b.g&&c.a.createElement(Fs,{isActive:Boolean(p)})),e&&c.a.createElement(Bs,{isOpen:A,chatId:e,pinnedMessagesCount:u,onClose:V,onUnpin:$}))}));a(245);const qs=Object(g.a)(e=>e(),200,!1);var _s;!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"}(_s||(_s={}));var Vs=Object(c.h)(Object(s.h)((e,{chatId:t,isProfile:a,isManagement:s})=>{const{query:n}=Object(o.A)(e)||{},{query:c}=Object(o.z)(e)||{},{query:r}=Object(o.s)(e)||{},i=t?Object(o.f)(e,t):void 0,l=i&&Object(h.kb)(i);return{canManage:Boolean(!s&&a&&i&&!Object(o.P)(e,i.id)&&(Object(h.mb)(i.id)||(Object(h.hb)(i)||i.isCreator)&&!i.isNotJoined)),isChannel:l,messageSearchQuery:n,stickerSearchQuery:c,gifSearchQuery:r}},(e,t)=>Object(d.l)(t,["setLocalTextSearchQuery","setStickerSearchQuery","setGifSearchQuery","searchTextMessagesLocal","toggleManagement","openHistoryCalendar"]))(({isColumnOpen:e,isProfile:t,isSearch:a,isManagement:s,isStickerSearch:n,isGifSearch:r,isPollResults:o,profileState:i,managementScreen:d,canManage:u,isChannel:m,onClose:h,messageSearchQuery:O,stickerSearchQuery:j,gifSearchQuery:g,setLocalTextSearchQuery:f,setStickerSearchQuery:p,setGifSearchQuery:I,searchTextMessagesLocal:v,toggleManagement:y,openHistoryCalendar:C})=>{var E;const w=Object(c.q)(null),M=Object(c.m)(e=>{f({query:e}),e.length&&qs(v)},[v,f]),S=Object(c.m)(e=>{p({query:e})},[p]),k=Object(c.m)(e=>{I({query:e})},[I]),[N,T]=Object(c.r)(!e);Object(c.n)(()=>{setTimeout(()=>{T(!e)},300)},[e]);const P=Object(ne.a)(),A=t?i===l.k.Profile?_s.Profile:i===l.k.SharedMedia?_s.SharedMedia:i===l.k.MemberList?_s.MemberList:-1:a?_s.Search:o?_s.PollResults:n?_s.StickerSearch:r?_s.GifSearch:s?d===l.g.Initial?_s.ManageInitial:d===l.g.ChatPrivacyType?_s.ManageChatPrivacyType:d===l.g.Discussion?_s.ManageDiscussion:d===l.g.ChannelSubscribers?_s.ManageChannelSubscribers:d===l.g.GroupPermissions?_s.ManageGroupPermissions:d===l.g.ChatAdministrators?_s.ManageChatAdministrators:d===l.g.GroupRemovedUsers?_s.ManageGroupRemovedUsers:d===l.g.GroupUserPermissionsCreate?_s.ManageGroupUserPermissionsCreate:d===l.g.GroupUserPermissions?_s.ManageGroupUserPermissions:d===l.g.GroupRecentActions?_s.ManageGroupRecentActions:d===l.g.ChatAdminRights?_s.ManageGroupAdminRights:d===l.g.GroupMembers?_s.ManageGroupMembers:void 0:void 0,R=null!==(E=Object(Ke.a)(A,!0))&&void 0!==E?E:-1;function L(){if(-1!==R)switch(R){case _s.PollResults:return c.a.createElement("h3",null,P("PollResults"));case _s.Search:return c.a.createElement(c.a.Fragment,null,c.a.createElement(ie.a,{parentContainerClassName:"RightSearch",value:O,onChange:M}),c.a.createElement(oe.a,{round:!0,size:"smaller",color:"translucent",onClick:()=>C({selectedAt:Object(x.k)(Date.now())}),ariaLabel:"Search messages by date"},c.a.createElement("i",{className:"icon-calendar"})));case _s.ManageInitial:return c.a.createElement("h3",null,P("Edit"));case _s.ManageChatPrivacyType:return c.a.createElement("h3",null,P(m?"ChannelTypeHeader":"GroupTypeHeader"));case _s.ManageDiscussion:return c.a.createElement("h3",null,P("Discussion"));case _s.ManageChatAdministrators:return c.a.createElement("h3",null,P("ChannelAdministrators"));case _s.ManageGroupRecentActions:return c.a.createElement("h3",null,P("Group.Info.AdminLog"));case _s.ManageGroupAdminRights:return c.a.createElement("h3",null,P("EditAdminRights"));case _s.ManageGroupPermissions:return c.a.createElement("h3",null,P("ChannelPermissions"));case _s.ManageGroupRemovedUsers:return c.a.createElement("h3",null,P("ChannelBlockedUsers"));case _s.ManageGroupUserPermissionsCreate:return c.a.createElement("h3",null,P("ChannelAddException"));case _s.ManageGroupUserPermissions:return c.a.createElement("h3",null,P("UserRestrictions"));case _s.StickerSearch:return c.a.createElement(ie.a,{value:j,placeholder:P("SearchStickersHint"),onChange:S});case _s.GifSearch:return c.a.createElement(ie.a,{value:g,placeholder:P("SearchGifsTitle"),onChange:k});case _s.SharedMedia:return c.a.createElement("h3",null,P("SharedMedia"));case _s.ManageChannelSubscribers:return c.a.createElement("h3",null,P("ChannelSubscribers"));case _s.MemberList:case _s.ManageGroupMembers:return c.a.createElement("h3",null,P("GroupMembers"));default:return c.a.createElement(c.a.Fragment,null,c.a.createElement("h3",null,"Profile"),c.a.createElement("section",{className:"tools"},u&&c.a.createElement(oe.a,{round:!0,color:"translucent",size:"smaller",ariaLabel:P("Edit"),onClick:y},c.a.createElement("i",{className:"icon-edit"}))))}}const F=b.g||A===_s.SharedMedia||A===_s.MemberList||s,D=Object(X.a)("animated-close-icon",N&&"no-transition");return Object(c.n)(()=>{w.current.classList.toggle("state-back",F)},[F]),c.a.createElement("div",{className:"RightHeader"},c.a.createElement(oe.a,{className:"close-button",round:!0,color:"translucent",size:"smaller",onClick:h,ariaLabel:P(F?"Common.Back":"Common.Close")},c.a.createElement("div",{ref:w,className:D})),c.a.createElement(ae.a,{name:N?"none":"slide-fade",activeKey:R},L))})),$s=a(129);function zs(e,t,a,s,r,o,i,l,d,b,u,m=0){const O="members"!==s&&r?r:s,j=Object(c.p)(()=>{if(o&&i)return Object(h.Fb)(o.map(({userId:e})=>e),i,void 0,m)},[o,m,i]),[g,f,p]=function(e,t,a,s){const[c,r]=Object($s.a)(a?t:void 0,s,void 0,n.R),o=!c||!s||c[0]===s[0];return[c,r,!o]}(0,t,u,j),[I,v,y]=Ws("media",O,a,u,l,d),[C,E,w]=Ws("documents",O,a,u,l,d),[M,S,k]=Ws("links",O,a,u,l,d),[N,T,P]=Ws("audio",O,a,u,l,d);let A,x,R=!1;switch(O){case"members":A=g,x=f,R=p;break;case"media":A=I,x=v,R=y;break;case"documents":A=C,x=E,R=w;break;case"links":A=M,x=S,R=k;break;case"audio":A=N,x=T,R=P}return[O,A,x,R]}function Ws(e,t,a,s,r,o){const i=Object(c.q)();Object(je.a)(()=>{t===e&&r&&o&&(i.current=Object(h.x)(r,o,e).reverse())},[r,o,t,e]);const[l,d]=Object($s.a)(s?a:void 0,i.current,void 0,"media"===e?n.ob:n.X);return[l,d,!(!l||!i.current||l[0]===i.current[0])]}var Ks=a(58);const Qs=Object(g.g)(e=>e(),250,!1);let Ys=!1;var Js=a(114),Xs=a(107);var Zs=a(134),en=a(193);a(246);var tn=Object(c.h)(({chat:e,user:t,photo:a,isFirstPhoto:s,isSavedMessages:n,lastSyncTime:r,onClick:o})=>{const l=Object(ne.a)(),d=t&&Object(h.qb)(t);function b(s="big",c){if(a&&!c)return`photo${a.id}?size=c`;let r;return n||d||(t?r=Object(h.f)(t,s):e&&(r=Object(h.f)(e,s))),r}const u=b(),m=Object(at.a)(u,!1,i.ApiMediaFormat.BlobUrl,r),O=Object(at.a)(!m&&s?b("normal",!0):void 0,!1,i.ApiMediaFormat.BlobUrl,r),j=Object(en.a)(!m&&a&&a.thumbnail&&a.thumbnail.dataUri),g=m||O||j,f=Object(sa.a)(g);let p="";if(n)p=c.a.createElement("i",{className:"icon-avatar-saved-messages"});else if(d)p=c.a.createElement("i",{className:"icon-avatar-deleted-account"});else if(g)p=c.a.createElement("img",{src:g,className:"avatar-media",alt:"",decoding:"async"});else if(!g&&t){const e=Object(h.ab)(t);p=e?Object(Qe.c)(e,2):void 0}else if(!g&&e){const t=Object(h.l)(l,e);p=t&&Object(Qe.c)(t,Object(h.mb)(e.id)?2:1)}else p=c.a.createElement("div",{className:"spinner-wrapper"},c.a.createElement(me.a,{color:"white"}));const I=Object(X.a)("ProfilePhoto","color-bg-"+Object(h.Y)(t||e),n&&"saved-messages",d&&"deleted-account",!n&&!g&&"no-photo");return c.a.createElement("div",{className:I,onClick:g?o:void 0},f&&g&&f!==g&&c.a.createElement("img",{src:f,className:"prev-avatar-media",alt:"",decoding:"async"}),"string"==typeof p?Object(tt.a)(p,["hq_emoji"]):p)});a(247);var an=Object(c.h)(Object(s.h)((e,{userId:t,forceShowSelf:a})=>{const{lastSyncTime:s,serverTimeOffset:n}=e,c=Object(o.Gb)(e,t),r=Object(o.f)(e,t),i=!a&&c&&c.isSelf,{animationLevel:l}=e.settings.byKey;return{lastSyncTime:s,user:c,chat:r,isSavedMessages:i,animationLevel:l,serverTimeOffset:n}},(e,t)=>Object(d.l)(t,["loadFullUser","openMediaViewer"]))(({user:e,chat:t,isSavedMessages:a,lastSyncTime:s,animationLevel:n,loadFullUser:r,openMediaViewer:o,serverTimeOffset:d})=>{const{id:u}=e||{},{id:m}=t||{},O=e?Object(h.ab)(e):t?t.title:"",j=(e?e.photos:t?t.photos:void 0)||[],g=n>=1?"slide":"none",[f,p]=Object(c.r)(0),I=a||j.length<=1||0===f,v=a||j.length<=1||f===j.length-1;Object(c.n)(()=>{f>j.length&&p(Math.max(0,j.length-1))},[f,j.length]);const y=Object(ne.a)();Object(c.n)(()=>{s&&u&&r({userId:u})},[u,r,s]),function(e,t,a){Object(c.n)(()=>{t.slice(a,a+4).forEach(e=>{bt.c(`photo${e.id}?size=c`)||bt.b(`photo${e.id}?size=c`,i.ApiMediaFormat.BlobUrl)})},[a,t])}(0,j,f);const C=Object(c.m)(()=>{o({avatarOwnerId:u||m,profilePhotoIndex:f,origin:l.h.ProfileAvatar})},[o,u,m,f]),E=Object(c.m)(()=>{I||p(f-1)},[f,I]),w=Object(c.m)(()=>{v||p(f+1)},[f,v]);if(Object(c.n)(()=>{const e=document.querySelector(".profile-slide-container > .active, .profile-slide-container > .to");if(e)return Object(Oe.b)(e,{excludedClosestSelector:".navigation",onSwipe:b.l?(e,t)=>{t===Oe.a.Right?E():t===Oe.a.Left&&w()}:void 0})},[w,E]),!e&&!t)return;function M(){const s=!a&&j&&j.length>0?j[f]:void 0;return c.a.createElement(tn,{key:f,user:e,chat:t,photo:s,isSavedMessages:a,isFirstPhoto:I,onClick:C})}const S=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===f?"current":"")})))}(),c.a.createElement(ae.a,{activeKey:f,name:g,className:"profile-slide-container"},M),!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(tt.a)(O)),S&&c.a.createElement(Zs.a,null)),!a&&(e?c.a.createElement("div",{className:"status "+(Object(h.yb)(e)?"online":"")},c.a.createElement("span",{className:"user-status",dir:"auto"},Object(h.bb)(y,e,d))):c.a.createElement("span",{className:"status",dir:"auto"},Object(h.kb)(t)?y("Subscribers",t.membersCount,"i"):y("Members",t.membersCount,"i")))))}));var sn=Object(c.h)(Object(s.h)((e,{chatOrUserId:t})=>{const{lastSyncTime:a}=e,s=t?Object(o.f)(e,t):void 0;return{lastSyncTime:a,chat:s,user:Object(h.mb)(t)?Object(o.Gb)(e,t):void 0,canInviteUsers:s&&(!Object(h.kb)(s)&&!Object(h.zb)(s,"inviteUsers")||Object(h.q)(s,"inviteUsers"))}},(e,t)=>Object(d.l)(t,["loadFullUser","updateChatMutedState","showNotification"]))(({lastSyncTime:e,user:t,chat:a,forceShowSelf:s,canInviteUsers:n,loadFullUser:r,showNotification:o,updateChatMutedState:i})=>{const{id:l,fullInfo:d,username:b,phoneNumber:u,isSelf:m}=t||{},{id:O,isMuted:j,username:g}=a||{},f=Object(ne.a)();Object(c.n)(()=>{e&&l&&r({userId:l})},[r,l,e]);const p=Object(c.m)(()=>{i({chatId:O,isMuted:!j})},[O,j,i]);if(!a||a.isRestricted||m&&!s)return;function I(e,t){Object(E.c)(e),o({message:t+" was copied"})}const v=u&&Object(ha.c)(u),y=Object(h.h)(a),C=0===y.indexOf("http")?y:"http://"+y,w=b||g,M=d&&d.bio||Object(h.g)(a);return c.a.createElement("div",{className:"ChatExtra"},v&&!!v.length&&c.a.createElement(Xs.a,{icon:"phone",multiline:!0,narrow:!0,ripple:!0,onClick:()=>I(v,f("Phone"))},c.a.createElement("span",{className:"title",dir:"auto"},v),c.a.createElement("span",{className:"subtitle"},f("Phone"))),w&&c.a.createElement(Xs.a,{icon:"mention",multiline:!0,narrow:!0,ripple:!0,onClick:()=>I("@"+w,f("Username"))},c.a.createElement("span",{className:"title",dir:"auto"},Object(tt.a)(w)),c.a.createElement("span",{className:"subtitle"},f("Username"))),M&&!!M.length&&c.a.createElement(Xs.a,{icon:"info",multiline:!0,narrow:!0,isStatic:!0},c.a.createElement("span",{className:"title",dir:"auto"},Object(tt.a)(M,["br","links","emoji"])),c.a.createElement("span",{className:"subtitle"},f(l?"UserBio":"Info"))),n&&!w&&!!y.length&&c.a.createElement(Xs.a,{icon:"mention",multiline:!0,narrow:!0,ripple:!0,onClick:()=>I(y,f("SetUrlPlaceholder"))},c.a.createElement("div",{className:"title"},c.a.createElement(Ea.a,{url:C,className:"title",text:y})),c.a.createElement("span",{className:"subtitle"},f("SetUrlPlaceholder"))),c.a.createElement(Xs.a,{icon:"unmute",ripple:!0,onClick:p},c.a.createElement("span",null,f("Notifications")),c.a.createElement(de,{id:"group-notifications",label:l?"Toggle User Notifications":"Toggle Chat Notifications",checked:!j,inactive:!0})))})),nn=a(166),cn=a(187),rn=a(119);a(251);const on=[{type:"media",title:"SharedMediaTab2"},{type:"documents",title:"SharedFilesTab2"},{type:"links",title:"SharedLinksTab2"},{type:"audio",title:"SharedMusicTab2"}];function ln(e){return[`.shared-media-transition > div:only-child > .${e}-list > .scroll-item`,`.shared-media-transition > div.active > .${e}-list > .scroll-item`].join(", ")}var dn=Object(c.h)(Object(s.h)((e,{chatId:t,userId:a})=>{const s=Object(o.f)(e,t),n=Object(o.m)(e,a||t),{currentType:c,resultsByType:r}=Object(o.v)(e)||{},{foundIds:i}=r&&c&&r[c]||{},{byId:l}=e.users,d=s&&Object(h.lb)(s),b=s&&Object(h.kb)(s),u=d||b&&Object(h.hb)(s),m=s&&s.fullInfo&&s.fullInfo.members,O=u&&s&&s.fullInfo&&!s.fullInfo.canViewMembers;let j;return a?j=a:Object(h.mb)(t)&&(j=t),{isChannel:b,resolvedUserId:j,chatMessages:n,foundIds:i,mediaSearchType:c,hasMembersTab:u,areMembersHidden:O,...u&&m&&{members:m,usersById:l},isRightColumnShown:Object(o.W)(e),isRestricted:s&&s.isRestricted,lastSyncTime:e.lastSyncTime,serverTimeOffset:e.serverTimeOffset}},(e,t)=>Object(d.l)(t,["setLocalMediaSearchType","loadMoreMembers","searchMediaMessagesLocal","openMediaViewer","openAudioPlayer","openUserInfo","focusMessage","loadProfilePhotos"]))(({chatId:e,profileState:t,onProfileStateChange:a,isChannel:s,resolvedUserId:r,chatMessages:o,foundIds:d,mediaSearchType:u,hasMembersTab:m,areMembersHidden:h,members:O,usersById:j,isRightColumnShown:g,isRestricted:f,lastSyncTime:p,setLocalMediaSearchType:I,loadMoreMembers:v,searchMediaMessagesLocal:y,openMediaViewer:C,openAudioPlayer:E,openUserInfo:w,focusMessage:M,loadProfilePhotos:S,serverTimeOffset:k})=>{const N=Object(c.q)(null),T=Object(c.q)(null),P=Object(ne.a)(),[A,x]=Object(c.r)(0),R=Object(c.p)(()=>[...m?[{type:"members",title:s?"ChannelSubscribers":"GroupMembers"}]:[],...on],[m,s]),L=R[A].type,[F,D,B,U]=zs(0,v,y,L,u,O,j,o,d,0,p,k),H=R.findIndex(({type:e})=>e===F),{handleScroll:G}=function(e,t,a,s){Object(Ks.a)(([a])=>{if(a&&a!==t){const a=e.current,n=a.querySelector(".TabList");a.scrollTop{Ys=!1},350))}},[t,s]),Object(Ks.a)(([t])=>{if(a!==l.k.Profile||a===t)return;const n=e.current;if(!n)return;const c=n.querySelector(".TabList");!c||c.offsetTop>n.scrollTop||(Ys=!0,Object(vt.a)(n,n.firstElementChild,"start",void 0,2*n.offsetHeight),setTimeout(()=>{Ys=!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=l.k.Profile;a.scrollTop>=n.offsetTop&&(c="members"===t?l.k.MemberList:l.k.SharedMedia),s(c)},[e,s,t]);return Object(c.n)(()=>{Ys||n()},[n,t]),{handleScroll:Object(c.m)(()=>{Ys||Qs(n)},[n])}}(N,L,t,a),{applyTransitionFix:q,releaseTransitionFix:_}=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])}}(N),[V,$]=(()=>{const[e,t]=Object(c.r)(!1);return[e,Object(c.m)(()=>{t(e=>!e)},[])]})(),z=Object(c.m)(()=>{_(),$()},[_,$]);Object(c.n)(()=>{I({mediaType:L})},[I,L]);const W=r||e;Object(c.n)(()=>{p&&S({profileId:W})},[S,W,p]);const K=Object(c.m)(e=>{C({chatId:W,threadId:i.MAIN_THREAD_ID,messageId:e,origin:l.h.SharedMedia})},[W,C]),Q=Object(c.m)(e=>{E({chatId:W,messageId:e})},[W,E]),Y=Object(c.m)(e=>{w({id:e})},[w]),J=Object(c.m)(e=>{M({chatId:W,messageId:e})},[W,M]);let X;Object(c.n)(()=>{if(T.current&&b.l)return Object(Oe.b)(T.current,{onSwipe:(e,t)=>{t===Oe.a.Left?x(Math.min(A+1,R.length-1)):t===Oe.a.Right&&x(Math.max(0,A-1))}})},[A,R.length]);const Z="members"===F||!m&&"media"===F;Z?X=g?0:1e3:D||(X=n.pb);const ee=Object(Cs.a)([e,F],X);function te(){if(!D||!ee||!o){const e=Z&&D&&!ee;return c.a.createElement("div",{className:"content empty-list"},!e&&c.a.createElement(me.a,null))}if(!D.length){let e;switch(F){case"members":e=h?"You have no access to group members list.":"No members found";break;case"documents":e=P("lng_media_file_empty_search");break;case"links":e=P("lng_media_link_empty_search");break;case"audio":e=P("lng_media_song_empty_search");break;default:e=P("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 ${F}-list`,dir:P.isRtl&&"media"===F?"rtl":void 0,teactFastList:!0},"media"===F?D.map(e=>o[e]&&c.a.createElement(nn.a,{key:e,message:o[e],onClick:K})):"documents"===F?D.map(e=>o[e]&&c.a.createElement($t.a,{key:e,message:o[e],withDate:!0,smaller:!0,className:"scroll-item",onDateClick:J})):"links"===F?D.map(e=>o[e]&&c.a.createElement(cn.a,{key:e,message:o[e],onMessageClick:J})):"audio"===F?D.map(e=>o[e]&&c.a.createElement(zt.a,{key:e,renderingFor:"sharedMedia",message:o[e],date:o[e].date,lastSyncTime:p,className:"scroll-item",onPlay:Q,onDateClick:J})):"members"===F?D.map((e,t)=>c.a.createElement(Xs.a,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item",onClick:()=>Y(e)},c.a.createElement(Ye.a,{userId:e,forceShowSelf:!0}))):void 0)}return c.a.createElement(Js.a,{ref:N,className:"Profile custom-scroll",itemSelector:ln(F),items:ee?D:void 0,cacheBuster:V,sensitiveArea:n.fb,preloadBackwards:ee?"members"===F?n.R:n.ob:0,noScrollRestoreOnTop:!0,noFastList:!0,onLoadMore:B,onScroll:G},!U&&function(e,t){return c.a.createElement("div",{className:"profile-info"},c.a.createElement(an,{userId:t||e,forceShowSelf:t!==e}),c.a.createElement(sn,{chatOrUserId:t||e,forceShowSelf:t!==e}))}(e,r),!f&&c.a.createElement("div",{className:"shared-media"},c.a.createElement(ae.a,{ref:T,name:P.isRtl?"slide-reversed":"slide",activeKey:H,renderCount:R.length,shouldRestoreHeight:!0,className:"shared-media-transition",onStart:q,onStop:z},te),c.a.createElement(pe.a,{big:!0,activeTab:A,tabs:R,onSwitchTab:x})))}));var bn=Object(c.h)(e=>{const t=Object(Ce.a)(ye.a.Extra,"RightSearch");return t?c.a.createElement(t,e):c.a.createElement(Ee.a,null)});var un=Object(c.h)(e=>{const t=Object(Ce.a)(ye.a.Extra,"Management");return t?c.a.createElement(t,e):c.a.createElement(Ee.a,null)});var mn=Object(c.h)(()=>{const e=Object(Ce.a)(ye.a.Extra,"StickerSearch");return e?c.a.createElement(e,null):c.a.createElement(Ee.a,null)});var hn=Object(c.h)(()=>{const e=Object(Ce.a)(ye.a.Extra,"GifSearch");return e?c.a.createElement(e,null):c.a.createElement(Ee.a,null)});var On=Object(c.h)(()=>{const e=Object(Ce.a)(ye.a.Extra,"PollResults");return e?c.a.createElement(e,null):c.a.createElement(Ee.a,null)});a(252);const jn=Object.keys(l.l).length/2,gn=Object.keys(l.g).length/2;function fn(){const e=document.querySelector(".RightHeader .SearchInput input");e&&e.blur()}var pn=Object(c.h)(Object(s.h)(e=>{const{chatId:t,threadId:a}=Object(o.y)(e)||{},s=Object(o.d)(e);return{contentKey:Object(o.nb)(e),chatId:t,threadId:a,currentProfileUserId:e.users.selectedId,isChatSelected:Boolean(t&&s)}},(e,t)=>Object(d.l)(t,["openUserInfo","toggleChatInfo","toggleManagement","closeLocalTextSearch","setStickerSearchQuery","setGifSearchQuery","closePollResults"]))(({contentKey:e,chatId:t,threadId:a,currentProfileUserId:s,isChatSelected:r,toggleChatInfo:o,toggleManagement:i,openUserInfo:d,closeLocalTextSearch:b,setStickerSearchQuery:u,setGifSearchQuery:m,closePollResults:h})=>{var O;const{width:j}=_e(),[g,f]=Object(c.r)(l.k.Profile),[p,I]=Object(c.r)(l.g.Initial),[v,y]=Object(c.r)(),[C,E]=Object(c.r)(),w=g!==l.k.Profile,M=void 0!==e,S=e===l.l.ChatInfo||e===l.l.UserInfo,k=e===l.l.Search,N=e===l.l.Management,T=e===l.l.StickerSearch,P=e===l.l.GifSearch,A=e===l.l.PollResults,x=j<=n.ab,[R,L]=Object(c.r)(!M),F=null!==(O=Object(Ke.a)(e,!0,!r))&&void 0!==O?O:-1,D=Object(c.m)(()=>{switch(e){case l.l.ChatInfo:if(w){f(l.k.Profile);break}o();break;case l.l.UserInfo:if(w){f(l.k.Profile);break}d({id:void 0});break;case l.l.Management:switch(p){case l.g.Initial:i();break;case l.g.ChatPrivacyType:case l.g.Discussion:case l.g.GroupPermissions:case l.g.GroupType:case l.g.ChatAdministrators:case l.g.ChannelSubscribers:case l.g.GroupMembers:I(l.g.Initial);break;case l.g.GroupUserPermissionsCreate:case l.g.GroupRemovedUsers:case l.g.GroupUserPermissions:I(l.g.GroupPermissions),y(void 0),E(void 0);break;case l.g.ChatAdminRights:case l.g.GroupRecentActions:I(l.g.ChatAdministrators)}break;case l.l.Search:fn(),b();break;case l.l.StickerSearch:case l.l.GifSearch:fn(),u({query:void 0}),m({query:void 0});break;case l.l.PollResults:h()}},[e,w,o,d,h,p,i,b,u,m]),B=Object(c.m)((e,t)=>{y(e),E(t)},[]);function U(){if(-1!==F)switch(F){case l.l.ChatInfo:case l.l.UserInfo:return c.a.createElement(dn,{key:s||t,chatId:t,userId:s,profileState:g,onProfileStateChange:f});case l.l.Search:return c.a.createElement(bn,{chatId:t,threadId:a});case l.l.Management:return c.a.createElement(un,{chatId:t,currentScreen:p,isPromotedByCurrentUser:C,selectedChatMemberId:v,onScreenSelect:I,onChatMemberSelect:B});case l.l.StickerSearch:return c.a.createElement(mn,null);case l.l.GifSearch:return c.a.createElement(hn,null);case l.l.PollResults:return c.a.createElement(On,null)}}return Object(c.n)(()=>M?Object(te.a)(D):void 0,[M,D]),Object(c.n)(()=>{setTimeout(()=>{L(!M)},300)},[M]),Object(c.n)(()=>{M&&x&&D()},[x]),Object(Ot.a)(([a,s])=>{(a===l.l.ChatInfo&&e===l.l.UserInfo||a===l.l.UserInfo&&e===l.l.ChatInfo||s!==t)&&(f(l.k.Profile),I(l.g.Initial))},[e,t]),c.a.createElement("div",{id:"RightColumn-wrapper",className:r?void 0:"is-hidden"},x&&c.a.createElement("div",{className:"overlay-backdrop",onClick:D}),c.a.createElement("div",{id:"RightColumn"},c.a.createElement(Vs,{chatId:t,isColumnOpen:M,isProfile:S,isSearch:k,isManagement:N,isStickerSearch:T,isGifSearch:P,isPollResults:A,profileState:g,managementScreen:p,onClose:D}),c.a.createElement(ae.a,{name:R?"none":"zoom-fade",renderCount:jn+gn,activeKey:N?jn+p:F},U)))}));var In=Object(c.h)(({isOpen:e})=>{const t=Object(Ce.a)(ye.a.Extra,"MediaViewer",!e);return t?c.a.createElement(t,null):void 0});var vn=Object(c.h)(({isOpen:e})=>{const t=Object(Ce.a)(ye.a.Extra,"Notifications",!e);return t?c.a.createElement(t,null):void 0});var yn=Object(c.h)(({isOpen:e})=>{const t=Object(Ce.a)(ye.a.Extra,"Errors",!e);return t?c.a.createElement(t,null):void 0});var Cn=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Ce.a)(ye.a.Extra,"ForwardPicker",!t);return a?c.a.createElement(a,e):void 0});var En=Object(c.h)(e=>{const{url:t}=e,a=Object(Ce.a)(ye.a.Extra,"SafeLinkModal",!t);return a?c.a.createElement(a,e):void 0});var wn=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Ce.a)(ye.a.Extra,"HistoryCalendar",!t);return a?c.a.createElement(a,e):void 0});a(253);let Mn,Sn,kn=!1;function Nn(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")})}var Tn=Object(c.h)(Object(s.h)(e=>{const{chatId:t,messageId:a}=e.audioPlayer,s=t&&a?Object(o.k)(e,t,a):void 0;return{animationLevel:e.settings.byKey.animationLevel,lastSyncTime:e.lastSyncTime,isLeftColumnShown:e.isLeftColumnShown,isRightColumnShown:Object(o.W)(e),isMediaViewerOpen:Object(o.T)(e),isForwardModalOpen:Object(o.R)(e),hasNotifications:Boolean(e.notifications.length),hasErrors:Boolean(e.errors.length),audioMessage:s,safeLinkModalUrl:e.safeLinkModalUrl,isHistoryCalendarOpen:Boolean(e.historyCalendarSelectedAt)}},(e,t)=>Object(d.l)(t,["loadAnimatedEmojis","loadNotificationSettings","loadNotificationExceptions","updateIsOnline"]))(({lastSyncTime:e,isLeftColumnShown:t,isRightColumnShown:a,isMediaViewerOpen:r,isForwardModalOpen:i,animationLevel:l,hasNotifications:d,hasErrors:b,audioMessage:u,safeLinkModalUrl:m,isHistoryCalendarOpen:h,loadAnimatedEmojis:O,loadNotificationSettings:j,loadNotificationExceptions:g,updateIsOnline:f})=>{n.p&&!kn&&(kn=!0,console.log(">>> RENDER MAIN")),Object(c.n)(()=>{e&&(f(!0),O(),j(),g())},[e,O,g,j,f]);const{transitionClassNames:p}=Object(Z.a)(!t,void 0,!0),{transitionClassNames:I}=Object(Z.a)(a,void 0,!0),v=Object(X.a)(p.replace(/([\w-]+)/g,"middle-column-$1"),I.replace(/([\w-]+)/g,"right-column-$1"));function y(e){e.preventDefault(),e.stopPropagation()}return Object(c.n)(()=>{document.body.classList.toggle("is-middle-column-open",v.includes("middle-column-open")),document.body.classList.toggle("is-right-column-shown",v.includes("right-column-open"))},[v]),Object(c.n)(()=>{l>0&&(document.body.classList.add("animating-right-column"),Object(J.b)(350+n.c),Mn&&(clearTimeout(Mn),Mn=void 0),Mn=window.setTimeout(()=>{document.body.classList.remove("animating-right-column"),Mn=void 0},350+n.c))},[l,a]),Object(ee.a)(()=>{f(!1)},()=>{f(!0)}),Object(ee.a)(()=>{const e=Object(o.q)(Object(s.e)());let t=0;clearInterval(Sn),Sn=window.setInterval(()=>{if(document.title.includes(n.D))Nn(!1);else{if(t%2==0){const t=Object(o.q)(Object(s.e)())-e;t>0&&(document.title=`${t} notification${t>1?"s":""}`,Nn(!0))}else document.title=n.eb,Nn(!1);t++}},1e3)},()=>{clearInterval(Sn),Sn=void 0,document.title.includes(n.D)||(document.title=n.eb),Nn(!1)}),c.a.createElement("div",{id:"Main",className:v,onDrop:y,onDragOver:y},c.a.createElement(Be,null),c.a.createElement(Gs,null),c.a.createElement(pn,null),c.a.createElement(In,{isOpen:r}),c.a.createElement(Cn,{isOpen:i}),c.a.createElement(vn,{isOpen:d}),c.a.createElement(yn,{isOpen:b}),u&&c.a.createElement(mt,{key:u.id,message:u,noUi:!0}),c.a.createElement(En,{url:m}),c.a.createElement(wn,{isOpen:h}))}));n.p&&console.log(">>> FINISH LOAD MAIN BUNDLE"),Object(s.e)().connectionState||Object(s.d)().initApi()},199:function(e,t,a){},200:function(e,t,a){},201:function(e,t,a){},212:function(e,t,a){},213:function(e,t,a){},214:function(e,t,a){},217:function(e,t,a){},218:function(e,t,a){},219:function(e,t,a){},223:function(e,t,a){},224:function(e,t,a){},226:function(e,t,a){},229:function(e,t,a){},230:function(e,t,a){},231:function(e,t,a){},232:function(e,t,a){},233:function(e,t,a){},234:function(e,t,a){},235:function(e,t,a){},236:function(e,t,a){},237:function(e,t,a){},238:function(e,t,a){},239: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){},251:function(e,t,a){},252:function(e,t,a){},253:function(e,t,a){}}]); //# sourceMappingURL=4.52516289099b751ed3e0.js.map