telegram-tt/dist/4.bdd7ea27f3831912b2a8.js
Alexander Zinchuk 82deeb20f7 [Build]
2021-07-06 19:40:10 +03:00

2 lines
213 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

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

(window.webpackJsonp=window.webpackJsonp||[]).push([[4],{103:function(e,t,a){"use strict";a.r(t),a.d(t,"Main",(function(){return xn}));var s=a(2),n=a(1),c=a(0),o=(a(84),a(37)),r=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(r.y)(e);return d&&d.chatId===n&&d.threadId===c&&d.type===i||(e=Object(o.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(o.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(7),l=a(19),d=a(3),b=a(5);let u;Object(s.b)("setScrollOffset",(e,t,a)=>{const{chatId:s,threadId:n,scrollOffset:c}=a;return Object(o.x)(e,s,n,"scrollOffset",c)}),Object(s.b)("setReplyingToId",(e,t,a)=>{const{messageId:s}=a,n=Object(r.y)(e);if(!n)return;const{chatId:c,threadId:i}=n;return Object(o.x)(e,c,i,"replyingToId",s)}),Object(s.b)("setEditingId",(e,t,a)=>{const{messageId:s}=a,n=Object(r.y)(e);if(!n)return;const{chatId:c,threadId:i,type:l}=n,d="scheduled"===l?"editingScheduledId":"editingId";return Object(o.x)(e,c,i,d,s)}),Object(s.b)("editLastMessage",e=>{const{chatId:t,threadId:a}=Object(r.y)(e)||{};if(!t||!a)return;const s=Object(r.m)(e,t),n=Object(r.Ib)(e,t,a);if(!s||!n)return;const c=Object(d.g)(n,t=>Boolean(s[t]&&Object(r.b)(e,s[t],a).canEdit));return c?Object(o.x)(e,t,a,"editingId",c):void 0}),Object(s.b)("replyToNextMessage",(e,t,a)=>{const{targetIndexDelta:s}=a,{chatId:n,threadId:c}=Object(r.y)(e)||{};if(!n||!c)return;const o=Object(r.m)(e,n),l=Object(r.Ib)(e,n,c);if(!o||!l)return;const d=Object(r.mb)(e,n,c);let b;if(Object(r.X)(e,n,c)&&d){const e=Object.keys(o),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(r.f)(e,n);b=t&&t.lastMessage?t.lastMessage.id:void 0}else{const t=Object(r.Db)(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:o,profilePhotoIndex:r,origin:i}=a;return{...e,mediaViewer:{chatId:s,threadId:n,messageId:c,avatarOwnerId:o,profilePhotoIndex:r,origin:i},forwardMessages:{}}}),Object(s.b)("closeMediaViewer",e=>({...e,mediaViewer:{}})),Object(s.b)("openAudioPlayer",(e,t,a)=>{const{chatId:s,threadId:n,messageId:c}=a;return{...e,audioPlayer:{chatId:s,threadId:n,messageId:c}}}),Object(s.b)("closeAudioPlayer",e=>({...e,audioPlayer:{}})),Object(s.b)("openPollResults",(e,t,a)=>{const{chatId:n,messageId:c}=a;Object(r.W)(e)?n===e.pollResults.chatId&&c===e.pollResults.messageId||Object(s.g)({...e,pollResults:{chatId:n,messageId:c,voters:{}}}):window.setTimeout(()=>{const e=Object(s.e)();Object(s.g)({...e,pollResults:{chatId:n,messageId:c,voters:{}}})},450)}),Object(s.b)("closePollResults",e=>{Object(s.g)({...e,pollResults:{}})}),Object(s.b)("focusLastMessage",(e,t)=>{const a=Object(r.y)(e);if(!a)return;const{chatId:s,threadId:n}=a;let c;if(n===i.MAIN_THREAD_ID){const t=Object(r.f)(e,s);c=t&&t.lastMessage?t.lastMessage.id:void 0}else{const t=Object(r.Db)(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(r.J)(e,h,m);t&&t.length&&([O]=t)}const j=Object(r.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(o.P)(e),e=Object(o.O)(e),Object(s.g)(e)},2e3),e=Object(o.P)(e,n,O,b),e=Object(o.O)(e,void 0),g&&(e=Object(o.O)(e,l.b.Static));const f=Object(r.Ib)(e,n,c);if(f&&f.includes(O))return Object(s.g)(e),void t.openChat({id:n,threadId:c});if(g&&(e=Object(o.x)(e,n,c,"viewportIds",void 0)),e=Object(o.x)(e,n,c,"outlyingIds",void 0),f&&!g){const t=O>f[0]?l.b.Down:l.b.Up;e=Object(o.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 o;return c&&(o=Object(r.ab)(e,s,c)),{...e,forwardMessages:{fromChatId:s,messageIds:o||n,isModalShown:!0}}}),Object(s.b)("exitForwardMode",e=>{Object(s.g)({...e,forwardMessages:{}})}),Object(s.b)("setForwardChatId",(e,t,a)=>{const{id:n}=a;Object(s.g)({...e,forwardMessages:{...e.forwardMessages,toChatId:n,isModalShown:!1}}),t.openChat({id:n}),t.closeMediaViewer(),t.exitMessageSelectMode()}),Object(s.b)("openForwardMenuForSelectedMessages",(e,t)=>{if(!e.selectedMessages)return;const{chatId:a,messageIds:s}=e.selectedMessages;t.openForwardMenu({fromChatId:a,messageIds:s})}),Object(s.b)("enterMessageSelectMode",(e,t,a)=>{const{messageId:s}=a||{},n=Object(r.r)(e);return n?Object(o.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(r.y)(e);if(!d)return;const{chatId:u,threadId:m,type:h}=d;e=Object(o.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.m?"long tap":"right click"} on a message.`}))}),Object(s.b)("disableContextMenuHint",e=>{if(e.shouldShowContextMenuHint)return{...e,shouldShowContextMenuHint:!1}}),Object(s.b)("exitMessageSelectMode",o.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(o.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(o.R)(e,{recentlyFoundChatIds:[s]});const c=n.filter(e=>e!==s);return c.unshift(s),c.length>10&&c.pop(),Object(o.R)(e,{recentlyFoundChatIds:c})}),Object(s.b)("clearRecentlyFoundChats",e=>Object(o.R)(e,{recentlyFoundChatIds:void 0})),Object(s.b)("setGlobalSearchContent",(e,t,a)=>{const{content:s}=a;return Object(o.S)(e,s)}),Object(s.b)("setGlobalSearchChatId",(e,t,a)=>{const{id:s}=a;return Object(o.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(r.y)(e)||{};if(t&&a)return Object(o.Y)(e,t,a,!0)}),Object(s.b)("closeLocalTextSearch",e=>{const{chatId:t,threadId:a}=Object(r.y)(e)||{};if(t&&a)return e=Object(o.Y)(e,t,a,!1),e=Object(o.t)(e,t,a,void 0)}),Object(s.b)("setLocalTextSearchQuery",(e,t,a)=>{const{chatId:s,threadId:n}=Object(r.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(o.t)(e,s,n,m.a)),e=Object(o.Y)(e,s,n,!0,c)}),Object(s.b)("setLocalMediaSearchType",(e,t,a)=>{const{chatId:s}=Object(r.y)(e)||{};if(!s)return;const{mediaType:n}=a;return Object(o.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(o.fb)(e,void 0)),Object(s.b)("setSettingOption",(e,t,a)=>Object(o.v)(e,a)),Object(s.b)("setThemeSettings",(e,t,a)=>{const{theme:s,...n}=a;return Object(o.w)(e,s,n)});var O=a(169);Object(s.b)("toggleChatInfo",e=>({...e,isChatInfoShown:!e.isChatInfoShown})),Object(s.b)("toggleManagement",e=>{const{chatId:t}=Object(r.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(r.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.k&&!b.l)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)("showDialog",(e,t,a)=>{const{data:s}=a;if("message"in s&&!Object(O.a)(s))return e;const n=[...e.dialogs];if("message"in s){const e=n.findIndex(e=>e.message===s.message);-1!==e&&n.splice(e,1)}return n.push(s),{...e,dialogs:n}}),Object(s.b)("dismissDialog",e=>{const t=[...e.dialogs];return t.pop(),{...e,dialogs:t}}),Object(s.b)("toggleSafeLinkModal",(e,t,a)=>{const{url:s}=a;return{...e,safeLinkModalUrl:s}}),Object(s.b)("openHistoryCalendar",(e,t,a)=>{const{selectedAt:s}=a;return{...e,historyCalendarSelectedAt:s}}),Object(s.b)("closeHistoryCalendar",e=>({...e,historyCalendarSelectedAt:void 0})),Object(s.b)("openPaymentModal",(e,t,a)=>{const{messageId:s}=a;return{...e,payment:{...e.payment,messageId:s,isPaymentModalOpen:!0}}}),Object(s.b)("closePaymentModal",e=>{const t=Object(o.h)(e);return Object(o.i)(t)});a(85);var j=a(10),g=a(9);const f=Object(g.h)(e=>e(),1e3,!0),p=Object(g.h)(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:r}=c;r.length>0&&r[0]===t&&r.shift();let l=Object(s.e)();l=Object(o.f)(l,Object(d.c)(c.users,"id")),l=Object(o.M)(l,Object(d.c)(c.chats,"id")),l=Object(o.I)(l,e,r),l=Object(o.J)(l,e,c),Object.keys(c.draftsById).map(Number).forEach(e=>{l=Object(o.x)(l,e,i.MAIN_THREAD_ID,"draft",c.draftsById[e])}),Object.keys(c.replyingToById).map(Number).forEach(e=>{l=Object(o.x)(l,e,i.MAIN_THREAD_ID,"replyingToId",c.replyingToById[e])}),0!==r.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(o.f)(c,Object(d.c)(a,"id"))),c=Object(o.H)(c,e.id,{fullInfo:n}),Object(s.g)(c)}async function C(e,t,a){const n=Object(s.e)(),c=Object(r.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(r.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(o.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;c<n.Eb;c++){await Object(g.f)(100);const{byId:n,listIds:{active:c},orderedPinnedIds:{active:o}}=Object(s.e)().chats;if(!c)return;const{chatId:l}=Object(r.y)(e)||{},{pinnedChats:d,otherChats:b}=Object(h.Bb)(n,c,o),u=[...d,...b].find(({id:e})=>e!==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,o=Object(r.f)(e,s);if(o&&o.hasUnreadMark&&t.toggleChatUnread({id:s}),o)Object(h.nb)(o)&&!o.isMin&&t.requestChatUpdate({chatId:s});else if(s===c)Object(j.a)("fetchChat",{type:"self"});else{const t=Object(r.Hb)(e,s);t&&Object(j.a)("fetchChat",{type:"user",user:t})}if(n!==i.MAIN_THREAD_ID){Object(r.Fb)(e,s,n)||t.requestThreadInfoUpdate({chatId:s,threadId:n})}}),Object(s.b)("openSupportChat",(e,t)=>{const a=Object(r.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.Db})}),Object(s.b)("loadMoreChats",(e,t,a)=>{const{listType:s="active"}=a,n=e.chats.listIds[s];if(e.chats.isFullyLoaded[s])return;const c=n?n.map(t=>e.chats.byId[t]).filter(t=>Boolean(t&&t.lastMessage)&&!Object(r.N)(e,t.id)).sort((e,t)=>e.lastMessage.date-t.lastMessage.date)[0]:void 0;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(r.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(r.f)(e,n);c&&Object(j.a)("requestChatUpdate",{chat:c,serverTimeOffset:s})}),Object(s.b)("updateChatMutedState",(e,t,a)=>{const{serverTimeOffset:n}=e,{chatId:c,isMuted:i}=a,l=Object(r.f)(e,c);l&&(Object(s.g)(Object(o.H)(e,c,{isMuted:i})),Object(j.a)("updateChatMutedState",{chat:l,isMuted:i,serverTimeOffset:n}))}),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:r,accessHash:i}=c;let d=Object(s.e)();d=Object(o.H)(d,r,c),d={...d,chatCreation:{...d.chatCreation,progress:c?l.a.Complete:l.a.Error}},Object(s.g)(d),Object(s.d)().openChat({id:r}),r&&i&&n&&await Object(j.a)("editChatPhoto",{chatId:r,accessHash:i,photo:n})}(n,d.map(t=>Object(r.Hb)(e,t)).filter(Boolean),c,i)}),Object(s.b)("joinChannel",(e,t,a)=>{const{chatId:s}=a,n=Object(r.f)(e,s);if(!n)return;const{id:c,accessHash:o}=n;c&&o&&Object(j.a)("joinChannel",{channelId:c,accessHash:o})}),Object(s.b)("leaveChannel",(e,t,a)=>{(async()=>{const{chatId:s}=a,n=Object(r.f)(e,s);if(!n)return;const{id:c,accessHash:o}=n;c&&o&&await Object(j.a)("leaveChannel",{channelId:c,accessHash:o}),t.openChat({id:void 0})})()}),Object(s.b)("deleteChannel",(e,t,a)=>{(async()=>{const{chatId:s}=a,n=Object(r.f)(e,s);if(!n)return;const{id:c,accessHash:o}=n;c&&o&&await Object(j.a)("deleteChannel",{channelId:c,accessHash:o}),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 r=Object(s.e)();r=Object(o.H)(r,c,n),r={...r,chatCreation:{...r.chatCreation,progress:n?l.a.Complete:l.a.Error}},Object(s.g)(r),Object(s.d)().openChat({id:c}),c&&a&&await Object(j.a)("editChatPhoto",{chatId:c,photo:a})}(n,c.map(t=>Object(r.Hb)(e,t)).filter(Boolean),i)}),Object(s.b)("toggleChatPinned",(e,t,a)=>{const{id:s,folderId:c}=a,o=Object(r.f)(e,s);if(o)if(c){const t=Object(r.i)(e,c);if(t){const a=!Object(r.N)(e,s,c),{pinnedChatIds:n,includedChatIds:o}=t,i=a?[s,...n||[]]:(n||[]).filter(e=>e!==s),l=[s,...o];Object(j.a)("editChatFolder",{id:c,folderUpdate:{...t,pinnedChatIds:i,includedChatIds:l}})}}else{const t=Object(r.j)(e,s),a=Object(r.N)(e,s,"archived"===t?n.h:void 0);Object(j.a)("toggleChatPinned",{chat:o,shouldBePinned:!a})}}),Object(s.b)("toggleChatArchived",(e,t,a)=>{const{id:s}=a,c=Object(r.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(r.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:o}=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 o=Object(s.e)(),{recommended:r}=o.chatFolders;r&&Object(s.g)({...o,chatFolders:{...o.chatFolders,recommended:r.filter(({id:e})=>e!==a)}})}(c,o&&o.length?Math.max.apply(Math.max,o):n.h)}),Object(s.b)("deleteChatFolder",(e,t,a)=>{const{id:s}=a;Object(r.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(r.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.ib.exec(s);if(c){const e=c[1];(async()=>{const a=await Object(j.a)("openChatByInvite",e);a&&t.openChat({id:a.chatId})})()}else{c=n.jb.exec(s);const e=c[1],a=c[2]?Number(c[2]):void 0;C(t,e,a)}}),Object(s.b)("acceptInviteConfirmation",(e,t,a)=>{const{hash:s}=a;(async()=>{const e=await Object(j.a)("importChatInvite",{hash:s});e&&t.openChat({id:e.id})})()}),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(r.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(r.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(r.f)(e,n);const d=Object(r.Hb)(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(r.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(o.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(r.f)(e,n);const b=Object(r.Hb)(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(r.f)(e,n);if(!a||!a.fullInfo)return;const{adminMembers:u}=a.fullInfo,m=!Object.keys(i).length;Object(s.g)(Object(o.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(r.f)(e,n);b&&(async()=>{Object(s.g)(Object(o.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(o.bb)(Object(s.e)(),l.f.Complete))})()}),Object(s.b)("toggleSignatures",(e,t,a)=>{const{chatId:s,isEnabled:n}=a,c=Object(r.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(o.c)(Object(s.e)(),t);Object(s.g)({...a,chats:{...a.chats,forDiscussionIds:Object.keys(t).map(Number)}})})()}),Object(s.b)("linkDiscussionGroup",(e,t,a)=>{const{channelId:s,chatId:n}=a,c=Object(r.f)(e,s);let o=Object(r.f)(e,n);c&&o&&(async()=>{if(Object(h.jb)(o)){if(o=await Object(j.a)("migrateChat",o),!o)return;t.openChat({id:o.id})}let{fullInfo:e}=o;if(!e){const t=await Object(j.a)("fetchFullChat",o);if(!t)return;e=t.fullInfo}e.isPreHistoryHidden&&await Object(j.a)("togglePreHistoryHidden",{chat:o,isEnabled:!1}),Object(j.a)("setDiscussionGroup",{channel:c,chat:o})})()}),Object(s.b)("unlinkDiscussionGroup",(e,t,a)=>{const{channelId:s}=a,n=Object(r.f)(e,s);if(!n)return;let c;n.fullInfo&&n.fullInfo.linkedChatId&&(c=Object(r.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(r.y)(e)||{},a=t?Object(r.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(o.f)(e,Object(d.c)(l,"id")),e=Object(o.H)(e,a.id,{fullInfo:{...a.fullInfo,members:[...(a.fullInfo||{}).members||[],...i||[]]}}),Object(s.g)(e))})()});var w=a(152);const E=new Map,M=Object(g.h)(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(r.Eb)(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(o.b)(y,u,I),y=i?Object(o.db)(y,u,t,v):Object(o.V)(y,u,t,v),y=Object(o.f)(y,Object(d.c)(g,"id")),y=Object(o.c)(y,Object(d.c)(f,"id")),y=Object(o.lb)(y,u,p);let C=Object(r.Y)(y,u,t);const w=Object(r.gb)(y,u,t);if(i&&C&&w&&Object(d.b)(C,w)&&(y=Object(o.V)(y,u,t,w),C=Object(r.Y)(y,u,t),y=Object(o.x)(y,u,t,"outlyingIds",void 0),i=!1),!b){const e=i?w:C,{newViewportIds:s}=k(e,a,c);y=Object(o.z)(y,u,t,s)}Object(s.g)(y)}function k(e,t,a){const{length:s}=e,c=t?function(e,t){return t<e[0]?0:t>e[e.length-1]?e.length-1:e.findIndex((a,s)=>a===t||a<t&&e[s+1]>t)}(e,t):-1,o=a===l.e.Backwards?c:c+1||s,r=o-n.V,i=o+n.V-1,d=e.slice(Math.max(0,r),i+1);let b,u;switch(a){case l.e.Backwards:b=o>0,u=r>=0;break;case l.e.Forwards:b=o<s,u=i<=s-1;break;case l.e.Around:default:b=d.length>0,u=d.length===n.V}return{newViewportIds:d,areSomeLocal:b,areAllLocal:u}}async function N(e){let t;const a=e.attachment?(e,n)=>{E.has(n)||(t=n,E.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.g)();const n=Object(s.e)();e.serverTimeOffset=n.serverTimeOffset;const c=Object(r.y)(n);if(!c)return;const{threadId:o}=c;e.replyingTo||o===i.MAIN_THREAD_ID||(e.replyingTo=Object(r.Fb)(n,e.chat.id,o)),await Object(j.a)("sendMessage",e,a),a&&t&&E.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(r.y)(e);if(!t)return;i=t.chatId,d=t.threadId}const b=Object(r.f)(e,i);if(!b||b.isRestricted)return;const u=Object(r.Ib)(e,i,d),m=Object(r.Y)(e,i,d),h=Object(r.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),r=n?h:m,{newViewportIds:O,areSomeLocal:j,areAllLocal:g}=k(r,a,s);if(j&&(e=Object(o.z)(e,i,d,O)),async function(e,t,a,s,n,c,o,r){t||await S(n,c,r,o,a,s);s||(await Promise.resolve(),e.loadViewportMessages({chatId:n.id,threadId:c,direction:o,isBudgetPreload:!0}))}(t,g,n,c,b,d,s,a),c)return}else{const t=Object(r.I)(e,i)||Object(r.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(o.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(r.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(r.k)(t,e.id,a);t=Object(o.L)(t,e.id,a,{...n,replyToMessageId:void 0}),Object(s.g)(t)}return}let c=Object(s.e)();c=Object(o.L)(c,e.id,t,n.message),c=Object(o.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(r.y)(e);if(!s)return;const{chatId:c,threadId:o,type:i}=s;if("scheduled"===i&&!a.scheduledAt)return{...e,messages:{...e.messages,contentToBeScheduled:a}};const l=Object(r.f)(e,c);t.setReplyingToId({messageId:void 0}),t.clearWebPagePreview({chatId:c,threadId:o,value:!1});const b={...a,chat:l,replyingTo:Object(r.mb)(e,c,o),noWebPage:Object(r.cb)(e,c,o)},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;a<c.length;a++){const[n,...o]=c[a],r=`${Date.now()}${a}`;N({...s,text:0===a?e:void 0,entities:0===a?t:void 0,attachment:n,groupedId:o.length>0?r:void 0}),o.forEach(e=>{N({...s,attachment:e,groupedId:r})})}}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,o=Object(r.y)(e);if(!o)return;const{chatId:i,threadId:l,type:d}=o,b=Object(r.f)(e,i),u=Object(r.D)(e,i,l,d);b&&u&&(Object(j.a)("editMessage",{chat:b,message:u,text:n,entities:c,noWebPage:Object(r.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(r.k)(e,s,n),o=c&&E.get(c.previousLocalId||c.id);o&&Object(j.b)(o),t.apiUpdate({"@type":"deleteMessages",ids:[n],chatId:s})}),Object(s.b)("saveDraft",(e,t,a)=>{const{chatId:s,threadId:n,draft:c}=a;if(!c)return;const{text:l,entities:d}=c,b=Object(r.f)(e,s);return n===i.MAIN_THREAD_ID&&Object(j.a)("saveDraft",{chat:b,text:l,entities:d,replyToMsgId:Object(r.mb)(e,s,n)}),e=Object(o.x)(e,s,n,"draft",c),e=Object(o.H)(e,s,{draftDate:Math.round(Date.now()/1e3)})}),Object(s.b)("clearDraft",(e,t,a)=>{const{chatId:s,threadId:n,localOnly:c}=a;if(!Object(r.B)(e,s,n))return;const l=Object(r.f)(e,s);return c||n!==i.MAIN_THREAD_ID||Object(j.a)("clearDraft",l),e=Object(o.x)(e,s,n,"draft",void 0),e=Object(o.H)(e,s,{draftDate:void 0})}),Object(s.b)("toggleMessageWebPage",(e,t,a)=>{const{chatId:s,threadId:n,noWebPage:c}=a;return Object(o.x)(e,s,n,"noWebPage",c)}),Object(s.b)("pinMessage",(e,t,a)=>{const s=Object(r.r)(e);if(!s)return;const{messageId:n,isUnpin:c,isOneSide:o,isSilent:i}=a;Object(j.a)("pinMessage",{chat:s,messageId:n,isUnpin:c,isOneSide:o,isSilent:i})}),Object(s.b)("unpinAllMessages",(e,t,a)=>{const n=Object(r.f)(e,a.chatId);n&&async function(e){await Object(j.a)("unpinAllMessages",{chat:e});let t=Object(s.e)();t=Object(o.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(r.y)(e);if(!c)return;const{chatId:o,threadId:i}=c,l=Object(r.f)(e,o);Object(j.a)("deleteMessages",{chat:l,messageIds:s,shouldDeleteForAll:n});const d=Object(r.C)(e,o,i);s.includes(d)&&t.setEditingId({messageId:void 0})}),Object(s.b)("deleteScheduledMessages",(e,t,a)=>{const{messageIds:s}=a,n=Object(r.y)(e);if(!n)return;const{chatId:c}=n,o=Object(r.f)(e,c);Object(j.a)("deleteScheduledMessages",{chat:o,messageIds:s});const i=Object(r.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(r.f)(e,s);if(!c)return;const o=c.lastMessage&&c.lastMessage.id;await Object(j.a)("deleteHistory",{chat:c,shouldDeleteForAll:n,maxId:o}),t.openChat({id:void 0})})()}),Object(s.b)("markMessageListRead",(e,t,a)=>{const{serverTimeOffset:s}=e,n=Object(r.y)(e);if(!n)return;const{chatId:c,threadId:o}=n,i=Object(r.Eb)(e,c,o);if(!i)return;const{maxId:l}=a;M(()=>{Object(j.a)("markMessageListRead",{serverTimeOffset:s,chat:i,threadId:o,maxId:l})})}),Object(s.b)("markMessagesRead",(e,t,a)=>{const s=Object(r.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,o=Object(r.f)(e,s);o&&Object(j.a)("sendPollVote",{chat:o,messageId:n,options:c})}),Object(s.b)("loadPollOptionResults",(e,t,a)=>{const{chat:n,messageId:c,option:r,offset:i,limit:l,shouldResetVoters:b}=a;!async function(e,t,a,n,c,r){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(o.f)(l,Object(d.c)(i.users,"id"));const{voters:b}=l.pollResults;Object(s.g)({...l,pollResults:{...l.pollResults,voters:{...b,[a]:[...!r&&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,r,i,l,b)}),Object(s.b)("forwardMessages",e=>{const{fromChatId:t,messageIds:a,toChatId:n}=e.forwardMessages,c=t?Object(r.f)(e,t):void 0,o=n?Object(r.f)(e,n):void 0,i=t&&a?a.sort((e,t)=>e-t).map(a=>Object(r.k)(e,t,a)).filter(Boolean):void 0;c&&o&&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,o,i)}),Object(s.b)("loadScheduledHistory",e=>{const t=Object(r.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,r=Object(d.c)(c,"id"),l=Object.keys(r).map(Number).sort((e,t)=>t-e);let b=Object(s.e)();b=Object(o.u)(b,e.id,r,n),b=Object(o.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(r.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,o=Object(r.f)(e,s),i=o&&Object(r.pb)(e,o.id,n);o&&i&&Object(j.a)("rescheduleMessage",{chat:o,message:i,scheduledAt:c})}),Object(s.b)("requestThreadInfoUpdate",(e,t,a)=>{const{chatId:s,threadId:n}=a,c=Object(r.Eb)(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(r.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,r=Object(d.c)(a,"id"),l=Object.keys(r).map(Number).sort((e,t)=>t-e);let b=Object(s.e)();b=Object(o.b)(b,e.id,r),b=Object(o.x)(b,e.id,i.MAIN_THREAD_ID,"pinnedIds",l),b=Object(o.f)(b,Object(d.c)(c,"id")),b=Object(o.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(r.f)(e,n),o=Object(r.k)(e,n,s);c&&o&&(async()=>{const e=await Object(j.a)("fetchMessageLink",{chat:c,message:o});e&&Object(w.c)(e.link)})()});var T=a(52);const P=Object(g.h)(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(o.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(o.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;e<a.length;e++)t.loadStickers({stickerSetId:a[e]}),e%50==0&&e>0&&await Object(g.f)(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(o.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(r.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:r}=a;let i=Object(s.e)();i=Object(o.hb)(i,n.id,{...n,stickers:c,packs:r});const l=i.stickers.forEmoji.emoji;l&&r[l]&&(i=Object(o.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(o.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(r.xb)(e,s);if(!n)return;const{accessHash:c,installedDate:o}=n;Object(j.a)(o?"uninstallStickerSet":"installStickerSet",{stickerSetId:s,accessHash:c})}),Object(s.b)("loadEmojiKeywords",(e,t,a)=>{const{language:n}=a;let c=Object(r.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(r.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:r}=n.stickers,i=a.sets.map(({id:e})=>e);r.setIds&&r.setIds.forEach(t=>{if(!i.includes(t)){const{title:a}=c[t]||{};a&&Object(T.a)(a,e)&&i.unshift(t)}});Object(s.g)(Object(o.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(o.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.h)(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(r.t)(u);if(!b||""!==e&&e!==m)return void Object(s.g)(Object(o.T)(u,{messages:!1}));const{messages:h,users:O,chats:g,totalCount:f,nextRate:p}=b;g.length&&(u=Object(o.c)(u,Object(d.c)(g,"id"))),O.length&&(u=Object(o.f)(u,Object(d.c)(O,"id"))),h.length&&(u=Object(o.d)(u,h)),u=Object(o.U)(u,h,f,t,p),Object(s.g)(u)}async function D(){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(o.ob)(t,Object(d.c)(e.users,"id")),t=Object(o.M)(t,Object(d.c)(e.chats,"id")),t=Object(o.r)(t,"archived",e.chatIds),t=Object(o.J)(t,"archived",e),Object(s.g)(t)}async function F(){let e=Object(s.e)();const{recentlyFoundChatIds:t}=e.globalSearch,{userIds:a}=e.contactList||{};if(!(a&&a.length||t&&t.length))return;const n=[...t||[],...a||[]].map(t=>Object(r.Hb)(e,t)).filter(Boolean),c=await Object(j.a)("fetchUsers",{users:n});c&&(e=Object(s.e)(),e=Object(o.ob)(e,Object(d.c)(c,"id")),Object(s.g)(e))}function B(e){return Object(j.a)("fetchMessages",{chat:e,threadId:i.MAIN_THREAD_ID,offsetId:e.lastReadInboxMessageId,addOffset:-(Math.round(n.V/2)+1),limit:n.V})}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(r.t)(a);if(!t||!n||e!==n)return void Object(s.g)(Object(o.T)(a,{chats:!1}));const{localChats:c,localUsers:i,globalChats:l,globalUsers:b}=t;(c.length||l.length)&&(a=Object(o.c)(a,Object(d.c)([...c,...l],"id")));(i.length||b.length)&&(a=Object(o.f)(a,Object(d.c)([...i,...b],"id")));a=Object(o.T)(a,{chats:!1}),a=Object(o.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(o.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(r.f)(e,l):void 0,c,n)}),Object(s.b)("searchMessagesGlobal",(e,t,a)=>{const{query:s,resultsByType:n,chatId:c,date:o}=e.globalSearch,i=o?Object(x.m)(o):o,{type:l}=a,{nextOffsetId:d}=n&&n[l]||{};L(s,l,d,c?Object(r.f)(e,c):void 0,i,o)}),Object(s.b)("searchTextMessagesLocal",e=>{const{chatId:t,threadId:a}=Object(r.y)(e)||{},c=t?Object(r.f)(e,t):void 0,l=Object(r.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(r.Db)(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(r.A)(f);if(!p||c&&c!==p.query)return;f=Object(o.b)(f,e.id,O),f=Object(o.f)(f,Object(d.c)(u,"id")),f=Object(o.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(r.w)(e),a=t?e.users.byId[t]||e.chats.byId[t]:void 0,c=Object(r.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.pb,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(r.v)(O))return;O=Object(o.b)(O,e.id,m),O=Object(o.f)(O,Object(d.c)(l,"id")),O=Object(o.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(r.y)(e)||{};if(!c)return;const o=Object(r.f)(e,c);o&&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})}(o,n)}),Object(s.b)("checkPublicLink",(e,t,a)=>{const{chatId:n}=Object(r.y)(e)||{};if(!n)return;if(e.management.progress===l.f.InProgress)return;const{username:c}=a;(async()=>{e=Object(o.bb)(e,l.f.InProgress),e=Object(o.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(o.bb)(e,t?l.f.Complete:l.f.Error),e=Object(o.ab)(e,n,{isUsernameAvailable:t}),Object(s.g)(e)})()}),Object(s.b)("updatePublicLink",(e,t,a)=>{const{chatId:n}=Object(r.y)(e)||{};let c=n&&Object(r.f)(e,n);if(!n||!c)return;const{username:i}=a;(async()=>{if(e=Object(o.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(o.bb)(e,a?l.f.Complete:l.f.Error),e=Object(o.ab)(e,n,{isUsernameAvailable:void 0}),Object(s.g)(e)})()}),Object(s.b)("updatePrivateLink",e=>{const{chatId:t}=Object(r.y)(e)||{},a=t&&Object(r.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(r.Hb)(t,e)).filter(Boolean),m=b.map(e=>Object(r.f)(t,e)).filter(Boolean),{chatId:O}=Object(r.y)(t)||{};if(O){const e=Object(r.f)(t,O);if(e&&!b.includes(O)&&m.push(e),Object(h.mb)(O)){const e=Object(r.Hb)(t,O);e&&!b.includes(O)&&u.push(e)}}u.push(...e.users),m.push(...e.chats),t=Object(o.s)(t,Object(d.c)(m,"id")),t=Object(o.r)(t,"active",e.chatIds),t={...t,chats:{...t.chats}},t=Object(o.J)(t,"active",e),Object.keys(e.draftsById).map(Number).forEach(a=>{t=Object(o.x)(t,a,i.MAIN_THREAD_ID,"draft",e.draftsById[a])}),Object.keys(e.replyingToById).map(Number).forEach(a=>{t=Object(o.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||[],n=Object(s.e)();const{chatId:c,threadId:l}=Object(r.y)(n)||{},b=Object.keys(n.messages.byChatId).map(Number).reduce((e,t)=>{const a=Object(r.B)(n,t,i.MAIN_THREAD_ID);return a?{...e,[t]:a}:e},{});if(c){const e=await B(n.chats.byId[c]);n=Object(s.e)();const{chatId:b}=Object(r.y)(n)||{},u=l&&Object(r.Db)(n,c,l);if(e&&b===c){const s=n.messages.byChatId[c],r=Object(d.c)(e.messages,"id"),b=Object.keys(r).map(Number);if(n={...n,messages:{...n.messages,byChatId:{[c]:{byId:r,threadsById:{[i.MAIN_THREAD_ID]:{...s&&s.threadsById[i.MAIN_THREAD_ID],listedIds:b,viewportIds:b,outlyingIds:void 0}}}}}},l&&u&&u.originChannelId){const{originChannelId:e}=u,t=n.messages.byChatId[e],a=await B(n.chats.byId[e]);if(a){const e=Object(d.c)(a.messages,"id"),o=Object.keys(e).map(Number);n={...n,messages:{...n.messages,byChatId:{...n.messages.byChatId,[u.originChannelId]:{byId:e,threadsById:{[i.MAIN_THREAD_ID]:{...t&&t.threadsById[i.MAIN_THREAD_ID],listedIds:o,viewportIds:o,outlyingIds:void 0}}},[c]:{...n.messages.byChatId[c],threadsById:{...n.messages.byChatId[c].threadsById,[l]:{...s&&s.threadsById[l],outlyingIds:void 0}}}}}}}}n=Object(o.M)(n,Object(d.c)(e.chats,"id")),n=Object(o.lb)(n,c,e.threadInfos),t=!0,a=Array.prototype.concat(a,e.users)}}t||(n={...n,messages:{...n.messages,byChatId:{}}});Object.keys(b).map(Number).forEach(e=>{n=Object(o.x)(n,e,i.MAIN_THREAD_ID,"draft",b[e])}),e?n=Object(o.y)(n,Object(d.c)(a,"id")):a&&(n=Object(o.ob)(n,Object(d.c)(a,"id")));Object(s.g)(n);const{chatId:u,messageId:m}=n.audioPlayer;u&&m&&!Object(r.k)(n,u,m)&&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([F(),D()]),await Object(j.a)("fetchCurrentUser"),n.p&&console.log(">>> FINISH AFTER-SYNC")}(t)});const U=Object(g.a)(e=>e(),500,!1,!0);function H(e,{visibility:t,allowedIds:a,deniedIds:s}){const{users:{byId:n},chats:{byId:c}}=e,o={visibility:t};let r,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||(r=a.map(l).filter(Boolean),i=a.map(d).filter(Boolean),r.length>0&&(o.allowedUsers=r),i.length>0&&(o.allowedChats=i)),"everybody"!==t&&"contacts"!==t||(r=s.map(l).filter(Boolean),i=s.map(d).filter(Boolean),r.length>0&&(o.blockedUsers=r),i.length>0&&(o.blockedChats=i)),o}Object(s.b)("loadFullUser",(e,t,a)=>{const{userId:s}=a,n=Object(r.Hb)(e,s);if(!n)return;const{id:c,accessHash:o}=n;U(()=>Object(j.a)("fetchFullUser",{id:c,accessHash:o}))}),Object(s.b)("loadUser",(e,t,a)=>{const{userId:n}=a,c=Object(r.Hb)(e,n);c&&(async()=>{const t=await Object(j.a)("fetchUsers",{users:[c]});t&&(e=Object(s.e)(),e=Object(o.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 r=Object(s.e)();r=Object(o.f)(r,Object(d.c)(c,"id")),r={...r,topPeers:{...r.topPeers,hash:a,userIds:n,lastRequestedAt:Date.now()/1e3+r.serverTimeOffset}},Object(s.g)(r)}(a)}),Object(s.b)("loadContactList",e=>{const{hash:t}=e.contactList||{};!async function(e){const t=await Object(j.a)("fetchContactList",{hash:e});if(!t)return;let a=Object(o.f)(Object(s.e)(),Object(d.c)(t.users,"id"));a=Object(o.c)(a,Object(d.c)(t.chats,"id"));const n=e=>e.lastName||e.firstName||"",c=new Intl.Collator("en-US"),r=t.users.sort((e,t)=>c.compare(n(e),n(t))).filter(e=>!e.isSelf);Object(s.g)({...a,contactList:{hash:t.hash,userIds:r.map(e=>e.id)}})}(t)}),Object(s.b)("loadCurrentUser",()=>{Object(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(r.Hb)(c,e);if(!i)return;Object(s.d)().updateChatMutedState({chatId:e,isMuted:t}),Object(s.g)(Object(o.bb)(Object(s.e)(),l.f.InProgress));await Object(j.a)("updateContact",{phone:i.phoneNumber,firstName:a,lastName:n})&&Object(s.g)(Object(o.nb)(Object(s.e)(),i.id,{firstName:a,lastName:n}));Object(s.g)(Object(o.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(r.Hb)(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(r.Hb)(e,n):void 0,l=c?void 0:Object(r.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(o.nb)(t,n,{photos:e.photos}):(t=Object(o.f)(t,Object(d.c)(e.users,"id")),t=Object(o.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.ib)||c.value.match(n.jb)?t.openTelegramLink({url:c.value}):t.toggleSafeLinkModal({url:c.value});break;case"callback":{const t=Object(r.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:o}=n;o?Object(s.d)().showDialog({data:{message:c}}):Object(s.d)().showNotification({message:c})}(t,c.messageId,c.value);break}case"requestPoll":t.openPollModal();break;case"buy":{const a=Object(r.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(r.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(r.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(r.Hb)(e,t);a&&Object(s.g)(Object(o.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(o.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 o=e.settings.loadedWallpapers[0];if(!o||o.slug!==l.n)return;const r={...a,document:{...a.document,previewBlobUrl:c}};Object(s.g)({...e,settings:{...e.settings,loadedWallpapers:[r,...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(o.f)(t,Object(d.c)(e.users,"id"))),e.chats&&e.chats.length&&(t=Object(o.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(o.a)(e,n))})()}),Object(s.b)("unblockContact",(e,t,a)=>{const{contactId:n}=a;let c;if(Object(h.mb)(n)){const t=Object(r.Hb)(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(o.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(o.v)(Object(s.e)(),e))})()}),Object(s.b)("updateNotificationSettings",(e,t,a)=>{const{peerType:n,isSilent:c,shouldShowPreviews:r}=a;(async()=>{await Object(j.a)("updateNotificationSettings",n,{isSilent:c,shouldShowPreviews:r})&&Object(s.g)(Object(o.cb)(Object(s.e)(),n,c,r))})()}),Object(s.b)("updateContactSignUpNotification",(e,t,a)=>{const{isSilent:n}=a;(async()=>{await Object(j.a)("updateContactSignUpNotification",n)&&Object(s.g)(Object(o.v)(Object(s.e)(),{hasContactJoinedNotifications:!n}))})()}),Object(s.b)("loadLanguages",()=>{(async()=>{const e=await Object(j.a)("fetchLanguages");e&&Object(s.g)(Object(o.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 o=Object(s.e)();o.settings.privacy.phoneNumber=e,o.settings.privacy.lastSeen=t,o.settings.privacy.profilePhoto=a,o.settings.privacy.forwards=n,o.settings.privacy.chatInvite=c,Object(s.g)(o)})()}),Object(s.b)("setPrivacyVisibility",(e,t,a)=>{const{privacyKey:n,visibility:c}=a,{privacy:{[n]:o}}=e.settings;if(!o)return;const r=H(e,{visibility:c,allowedIds:[...o.allowUserIds,...o.allowChatIds],deniedIds:[...o.blockUserIds,...o.blockChatIds]});(async()=>{const e=await Object(j.a)("setPrivacySettings",n,r);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:o}=a,{privacy:{[n]:r}}=e.settings;if(!r)return;const i=H(e,{visibility:r.visibility,allowedIds:c?o:[...r.allowUserIds,...r.allowChatIds],deniedIds:c?[...r.blockUserIds,...r.blockChatIds]:o});(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)("loadContentSettings",()=>{(async()=>{const e=await Object(j.a)("fetchContentSettings");e&&Object(s.g)(Object(o.v)(Object(s.e)(),e))})()}),Object(s.b)("updateContentSettings",(e,t,a)=>{(async()=>{Object(s.g)(Object(o.v)(Object(s.e)(),{isSensitiveEnabled:a}));await Object(j.a)("updateContentSettings",a)||Object(s.g)(Object(o.v)(Object(s.e)(),{isSensitiveEnabled:!a}))})()}),Object(s.b)("loadPasswordInfo",()=>{(async()=>{const e=await Object(j.a)("getPasswordInfo");if(!e)return;let t=Object(s.e)();t=Object(o.v)(t,{hasPassword:e.hasPassword}),t=Object(o.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(o.mb)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await Object(j.a)("checkPassword",n);Object(s.g)(Object(o.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(o.mb)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await Object(j.a)("clearPassword",n);Object(s.g)(Object(o.mb)(Object(s.e)(),{isLoading:!1})),e&&c()})()}),Object(s.b)("updatePassword",(e,t,a)=>{const{currentPassword:n,password:c,hint:r,email:i,onSuccess:l}=a;Object(s.g)(Object(o.mb)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await Object(j.a)("updatePassword",n,c,r,i);Object(s.g)(Object(o.mb)(Object(s.e)(),{isLoading:!1})),e&&l()})()}),Object(s.b)("updateRecoveryEmail",(e,t,a)=>{const{currentPassword:n,email:c,onSuccess:r}=a;Object(s.g)(Object(o.mb)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await Object(j.a)("updateRecoveryEmail",n,c);Object(s.g)(Object(o.mb)(Object(s.e)(),{isLoading:!1,waitingEmailCodeLength:void 0})),e&&r()})()}),Object(s.b)("provideTwoFaEmailCode",(e,t,a)=>{const{code:s}=a;Object(j.a)("provideRecoveryEmailCode",s)}),Object(s.b)("clearTwoFaError",e=>Object(o.mb)(e,{error:void 0}));var q=a(60);Object(s.b)("validateRequestedInfo",(e,t,a)=>{const{requestInfo:n,saveInfo:c}=a,i=Object(r.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:r}=n;if(!c)return;let i=Object(o.E)(Object(s.e)(),c);r?(i=Object(o.gb)(i,r),i=Object(o.C)(i,l.i.Shipping)):i=Object(o.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(o.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(o.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(r.k)(c,a,e);c=Object(o.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(r.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(q.b)(c.error),t=Object(s.e)();return void Object(s.g)({...t,payment:{...t.payment,error:{...e}}})}let r=Object(o.F)(Object(s.e)(),{type:c.type,id:c.id});r=Object(o.C)(r,l.i.Checkout),Object(s.g)(r)}(i,n)}),Object(s.b)("sendPaymentForm",(e,t,a)=>{const{shippingOptionId:n,saveCredentials:c}=a,i=Object(r.hb)(e),l=Object(r.ib)(e),d=Object(r.kb)(e),b=Object(r.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(o.h)(Object(s.e)());Object(s.g)(Object(o.i)(e))}}(i,{save:c,data:b},l,n)}),Object(s.b)("setPaymentStep",(e,t,a={})=>Object(o.C)(e,a.step||l.i.ShippingInfo)),Object(s.b)("setInvoiceMessageInfo",(e,t,a)=>Object(o.A)(e,a));a(86);var G=a(30),_=a(77);const V=Object(g.h)(e=>e(),1e3,!0);Object(s.b)("apiUpdate",(e,t,a)=>{switch(a["@type"]){case"updateChat":{a.noTopChatsRequest||Object(r.M)(e,a.id)||t.loadTopChats();const n=Object(o.H)(e,a.id,a.chat,a.newProfilePhoto);Object(s.g)(n);const c=Object(r.q)(n);V(()=>Object(_.a)(c));break}case"updateChatJoin":{const n=Object(r.j)(e,a.id);if(!n)break;e=Object(o.I)(e,n,[a.id]),e=Object(o.H)(e,a.id,{isNotJoined:!1}),Object(s.g)(e);const c=Object(r.f)(e,a.id);c&&t.requestChatUpdate({chatId:c.id});break}case"updateChatLeave":{const t=Object(r.j)(e,a.id);if(!t)break;const{[t]:n}=e.chats.listIds;n&&(e=Object(o.r)(e,t,n.filter(e=>e!==a.id))),e=Object(o.H)(e,a.id,{isNotJoined:!0}),Object(s.g)(e);break}case"updateChatInbox":Object(s.g)(Object(o.H)(e,a.id,a.chat));break;case"updateChatTypingStatus":{const{id:t,typingStatus:n}=a;Object(s.g)(Object(o.H)(e,t,{typingStatus:n})),setTimeout(()=>{const e=Object(s.e)(),a=Object(r.f)(e,t);a&&n&&a.typingStatus&&a.typingStatus.timestamp===n.timestamp&&Object(s.g)(Object(o.H)(e,t,{typingStatus:void 0}))},6e3);break}case"newMessage":{const{message:n}=a,{chatId:c,threadId:l,type:d}=Object(r.y)(e)||{};if(n.senderId===e.currentUserId&&!n.isFromScheduled)return;const b=Object(r.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(o.H)(e,a.chatId,{unreadCount:b.unreadCount?b.unreadCount+1:1,...a.message.hasUnreadMention&&{unreadMentionsCount:b.unreadMentionsCount?b.unreadMentionsCount+1:1}}));const m=Object(r.q)(Object(s.e)());Object(_.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(r.p)(e,t),n=Object(r.f)(e,s);n&&n.unreadMentionsCount&&(e=Object(o.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(o.H)(e,a.id,{fullInfo:{...n.fullInfo,...t}}));break}case"updatePinnedChatIds":{const{ids:t,folderId:c}=a,o=c===n.h?"archived":"active";e={...e,chats:{...e.chats,orderedPinnedIds:{...e.chats.orderedPinnedIds,[o]:t.length?t:void 0}}},Object(s.g)(e);break}case"updateChatPinned":{const{id:t,isPinned:c}=a,o=Object(r.j)(e,t);if(o){const{[o]:a}=e.chats.orderedPinnedIds;let s=a||[];if(c){if(!s.includes(t)){if("active"===o&&s.length>=n.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,[o]:s.length?s:void 0}}}}Object(s.g)(e);break}case"updateChatListType":{const{id:t,folderId:n}=a;Object(s.g)(Object(o.K)(e,t,n));break}case"updateChatFolder":{const{id:t,folder:n}=a,{byId:c,orderedIds:o}=e.chatFolders,r=n?{...c,[t]:n}:Object(d.l)(c,Object.keys(c).map(Number).filter(e=>e!==t)),i=n?o&&o.includes(t)?o:[...o||[],t]:o?o.filter(e=>e!==t):void 0;Object(s.g)({...e,chatFolders:{...e.chatFolders,byId:r,orderedIds:i}});break}case"updateChatFoldersOrder":{const{orderedIds:t}=a;Object(s.g)({...e,chatFolders:{...e.chatFolders,orderedIds:t}});break}case"updateRecommendedChatFolders":{const{folders:t}=a;Object(s.g)({...e,chatFolders:{...e.chatFolders,recommended:t}});break}case"updateChatMembers":{const t=e.chats.byId[a.id],{replacedMembers:n,addedMember:c,deletedMemberId:r}=a;if(!t)return;let i=!1,l=t.fullInfo&&t.fullInfo.members?[...t.fullInfo.members]:[];if(n)l=n,i=!0;else if(c)l.length&&l.some(e=>e.userId===c.userId)||(l.push(c),i=!0);else if(l.length&&r){const e=l.findIndex(e=>e.userId===r);e>-1&&(l.slice(e,1),i=!0)}if(i){const n=l.filter(({isOwner:e,isAdmin:t})=>e||t);Object(s.g)(Object(o.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(o.H)(e,t,{photos:c.photos.filter(e=>!n.includes(e.id))}));break}case"draftMessage":{const{chatId:t,formattedText:n,date:c,replyingToId:r}=a;e.chats.byId[t]&&(e=Object(o.x)(e,t,i.MAIN_THREAD_ID,"draft",n),e=Object(o.x)(e,t,i.MAIN_THREAD_ID,"replyingToId",r),e=Object(o.H)(e,t,{draftDate:c}),Object(s.g)(e));break}case"showInvite":{const{data:e}=a;t.showDialog({data:e});break}}});function $(e,t,a,s,n=!1){const c=n?Object(r.pb)(e,t,a):Object(r.k)(e,t,a);if(c&&s.content){const{photo:e,video:t,sticker:a,document:n}=Object(h.v)(c);e&&s.content.photo?(s.content.photo.blobUrl=e.blobUrl,s.content.photo.thumbnail=e.thumbnail):t&&s.content.video?s.content.video.blobUrl=t.blobUrl:a&&s.content.sticker?s.content.sticker.isPreloadedGlobally=a.isPreloadedGlobally:n&&s.content.document&&(s.content.document.previewBlobUrl=n.previewBlobUrl)}return n?Object(o.eb)(e,t,a,s):Object(o.L)(e,t,a,s)}function W(e,t){const{id:a,chatId:s}=t,n=Object(r.f)(e,s);if(n&&n.unreadCount&&!Object(r.Y)(e,s,i.MAIN_THREAD_ID))return e;if(e=Object(o.V)(e,s,i.MAIN_THREAD_ID,[a]),Object(r.X)(e,s,i.MAIN_THREAD_ID)){const t=Object(r.H)(e,s,i.MAIN_THREAD_ID),n=Object(o.g)(e,s,i.MAIN_THREAD_ID,a),c=Object(r.Ib)(n,s,i.MAIN_THREAD_ID);t&&!c.includes(t)||(e=n)}const{threadInfo:c,firstMessageId:l}=Object(r.Cb)(e,s,t)||{};return!l&&Object(h.tb)(t)||c&&(e=Object(o.V)(e,s,c.threadId,[a]),Object(r.X)(e,s,c.threadId)&&(e=Object(o.g)(e,s,c.threadId,a),l||(e=Object(o.x)(e,s,c.threadId,"firstMessageId",t.id)),c.lastMessageId||(e=Object(o.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(o.H)(e,t,{lastMessage:a})}function K(e,t){const a=Object(r.m)(e,t),s=Object(r.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 Q(e,t,a,n){if(e){t.forEach(t=>{const a=K(n=Object(o.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(r.k)(n,e,t);if(!a)return;const{threadInfo:s}=Object(r.Cb)(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(o.j)(Object(s.e)(),e,t))},350)}const c=[];t.forEach(e=>{const t=Object(r.p)(n,e);if(t){c.push(t);const a=K(n=Object(o.L)(n,t,e,{isDeleting:!0}),t);a&&(n=z(n,t,a,!0)),setTimeout(()=>{Object(s.g)(Object(o.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=W(e=$(e,n,c,i),i),i.threadInfo&&(e=Object(o.kb)(e,i.threadInfo.chatId,i.threadInfo.threadId,i.threadInfo)),Object(s.g)(e);const l=Object(r.k)(e,n,c);if(Object(r.a)(e,n,i)){if(i.isOutgoing&&(!i.content||!i.content.action)){const a=Object(r.y)(e);a&&t.focusMessage({chatId:n,threadId:a.threadId,messageId:i.id,noHighlight:!0})}const{threadInfo:a}=Object(r.Cb)(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(r.M)(e,n)||t.loadTopChats();break}case"newScheduledMessage":{const{chatId:t,id:n,message:c}=a;e=$(e,t,n,c,!0);const l=Object(r.ob)(e,t)||[];e=Object(o.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(r.k)(e,t,n))return;e=$(e,t,n,c);const i=Object(r.k)(e,t,n);c.threadInfo&&(e=Object(o.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(r.pb)(e,t,n))return;e=$(e,t,n,c,!0);const l=Object.keys(Object(r.qb)(e,t)||{}).map(Number).sort((e,t)=>t-e);e=Object(o.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=W(e,c);const i=Object(r.k)(e,t,n);e=Object(o.j)(e,t,[n]),c.isScheduled&&(e=Object(o.k)(e,t,[n])),e=Object(o.L)(e,t,c.id,{...i,...c,previousLocalId:n});const l=Object(r.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(r.ob)(e,t)||[];e=Object(o.x)(e,t,i.MAIN_THREAD_ID,"scheduledIds",[...l,c.id]);const d=Object(r.pb)(e,t,n);e=Object(o.k)(e,t,[n]),e=Object(o.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(r.jb)(e,t)||[],d=n?[...l,...c].sort((e,t)=>t-e):l.filter(e=>!c.includes(e));Object(s.g)(Object(o.x)(e,t,i.MAIN_THREAD_ID,"pinnedIds",d));break}case"updateThreadInfo":{const{chatId:t,threadId:n,threadInfo:c,firstMessageId:i}=a,l={...Object(r.Db)(e,t,n),...c};if(!l.threadId)return;e=Object(o.kb)(e,t,n,l),i&&(e=Object(o.x)(e,t,n,"firstMessageId",i)),Object(s.g)(e);break}case"resetMessages":{const{id:n}=a,c=Object(r.m)(e,n);c&&!Object(h.mb)(n)&&(e=Object(o.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;Q(n,s,t,e);break}case"deleteScheduledMessages":{const{ids:t,chatId:n}=a;!function(e,t,a,n){if(!e)return;t.forEach(t=>{n=Object(o.eb)(n,e,t,{isDeleting:!0})}),Object(s.g)(n),setTimeout(()=>{n=Object(o.k)(Object(s.e)(),e,t);const a=Object(r.qb)(n,e);n=Object(o.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;Q(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(r.p)(e,t);a&&(e=Object(o.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(o.L)(e,t,a,c)}),Object(s.g)(e);break}case"updateMessagePoll":{const{pollId:t,pollUpdate:n}=a,c=Object(r.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(o.L)(e,c.chatId,c.id,{content:{...c.content,poll:t}}))}break}case"updateMessagePollVote":{const{pollId:t,userId:n,options:c}=a,i=Object(r.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(o.L)(e,i.chatId,i.id,{content:{...i.content,poll:{...l,results:{...l.results,recentVoterIds:m,totalVoters:h,results:O}}}}));break}}});const Y=Object(g.h)((function(){let e=Object(s.e)();J.forEach(([t,a])=>{e=Object(o.nb)(e,t,{status:a})}),Object(s.g)(e),J=[]}),3e3,!0);let J=[];Object(s.b)("apiUpdate",(e,t,a)=>{switch(a["@type"]){case"deleteUser":return Object(o.l)(e,a.id);case"updateUser":return Object(o.nb)(e,a.id,a.user);case"updateUserStatus":return s=a.userId,n=a.status,J.push([s,n]),void Y();case"updateUserFullInfo":{const{id:t,fullInfo:s}=a,n=e.users.byId[t];if(!n)return;return Object(o.nb)(e,t,{fullInfo:{...n.fullInfo,...s}})}}var s,n}),Object(s.b)("apiUpdate",(e,t,a)=>{switch(a["@type"]){case"updateStickerSet":return Object(o.hb)(e,a.id,a.stickerSet)}}),Object(s.b)("apiUpdate",(e,t,a)=>{switch(a["@type"]){case"updatePeerBlocked":return a.isBlocked?Object(o.a)(Object(s.e)(),a.id):Object(o.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(o.cb)(e,a.peerType,a.isSilent,a.shouldShowPreviews);case"updateNotifyExceptions":{const{id:t,isMuted:n,isSilent:c,shouldShowPreviews:r}=a;e.chats.byId[t]&&(e=Object(o.H)(e,t,{isMuted:n})),Object(s.g)(Object(o.e)(e,t,{isMuted:n,isSilent:c,shouldShowPreviews:r}));break}}}),Object(s.b)("apiUpdate",(e,t,a)=>{switch(a["@type"]){case"updateTwoFaStateWaitCode":return{...e,twoFaSettings:{...e.twoFaSettings,isLoading:!1,waitingEmailCodeLength:a.length}};case"updateTwoFaError":return{...e,twoFaSettings:{...e.twoFaSettings,error:a.message}}}});var X=a(48),Z=a(8),ee=a(35),te=a(121);function ae(e){Object(c.n)(()=>Object(g.c)(e),[e])}var se=a(47),ne=a(110);var ce=a(34),oe=a(26),re=a(43),ie=a(62),le=a(41),de=a(23),be=a(153),ue=a(140);a(197);var me=Object(c.h)(({id:e,name:t,value:a,label:s,checked:n=!1,disabled:o,inactive:r,noAnimation:i,onChange:l,onCheck:d})=>{const b=Object(c.m)(e=>{l&&l(e),d&&d(e.currentTarget.checked)},[l,d]),u=Object(Z.a)("Switcher",o&&"disabled",r&&"inactive",i&&"no-animation");return c.a.createElement("label",{className:u,title:s},c.a.createElement("input",{type:"checkbox",id:e,name:t,value:a,checked:n,disabled:o,onChange:b}),c.a.createElement("span",{className:"widget"}))});a(198);const he=[0,1,2];var Oe=Object(c.h)(Object(s.h)(e=>{const{query:t,fetchingStatus:a,chatId:s,date:n}=e.globalSearch,{currentUserId:c}=e,{byId:o}=e.chats,{animationLevel:i}=e.settings.byKey;return{searchQuery:t,isLoading:!!a&&Boolean(a.chats||a.messages),currentUserId:c,chatsById:o,globalSearchChatId:s,searchDate:n,theme:Object(r.Bb)(e),animationLevel:i}},(e,t)=>Object(d.l)(t,["openChat","openTipsChat","setGlobalSearchDate","setGlobalSearchChatId","setSettingOption"]))(({content:e,contactsFilter:t,onSearchQuery:a,onSelectSettings:s,onSelectContacts:o,onSelectArchived:r,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:w})=>{const E=Object(oe.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="web.telegram.org"===window.location.hostname,A=Object(c.p)(()=>({onTrigger:e,isOpen:t})=>c.a.createElement(de.a,{round:!0,ripple:M&&!b.k,size:"smaller",color:"translucent",className:t?"active":"",onClick:M?e:()=>d(),ariaLabel:M?E("AccDescrOpenMenu2"):"Return to chat list"},c.a.createElement("div",{className:Object(Z.a)("animated-menu-icon",!M&&"state-back")})),[M,E,d]),R=Object(c.m)(()=>{u||a("")},[u,a]),L=Object(c.m)(()=>{v({id:O})},[O,v]),D=Object(c.m)(e=>{e.stopPropagation();const t="light"===f?"dark":"light";w({theme:t}),w({shouldUseSystemTheme:!1}),Object(re.a)(t,p===n.e)},[p,w,f]),F=Object(c.m)(e=>{e.stopPropagation();const t=0===p?2:0;he.forEach((e,a)=>{document.body.classList.toggle("animation-level-"+a,t===a)}),w({animationLevel:t})},[p,w]),B=Boolean(j)||e===l.d.GlobalSearch||e===l.d.Contacts,U=e===l.d.Contacts?E("SearchFriends"):E("Search");return c.a.createElement("div",{className:"LeftMainHeader"},c.a.createElement("div",{id:"LeftMainHeader",className:"left-header"},c.a.createElement(ie.a,{trigger:A,footer:`${n.f} alpha ${n.g}`},c.a.createElement(le.a,{icon:"saved-messages",onClick:L},E("SavedMessages")),c.a.createElement(le.a,{icon:"archive",onClick:r},c.a.createElement("span",{className:"menu-item-name"},E("ArchivedChats")),T>0&&c.a.createElement("div",{className:"archived-badge"},T)),c.a.createElement(le.a,{icon:"user",onClick:o},E("Contacts")),c.a.createElement(le.a,{icon:"settings",onClick:s},E("Settings")),c.a.createElement(le.a,{icon:"darkmode",onClick:D},c.a.createElement("span",{className:"menu-item-name"},E("lng_menu_night_mode")),c.a.createElement(me,{id:"darkmode",label:E("dark"===f?"lng_settings_disable_night_theme":"lng_settings_enable_night_theme"),checked:"dark"===f,noAnimation:!0})),c.a.createElement(le.a,{icon:"animations",onClick:F},c.a.createElement("span",{className:"menu-item-name capitalize"},E("Appearance.Animations").toLowerCase()),c.a.createElement(me,{id:"animations",label:"Toggle Animations",checked:p>0})),c.a.createElement(le.a,{icon:"help",onClick:y},E("TelegramFeatures")),c.a.createElement(le.a,{icon:"bug",href:n.x},"Report Bug"),P&&c.a.createElement(c.a.Fragment,null,c.a.createElement(le.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(le.a,{icon:"char-W",href:"https://web.telegram.org/?legacy=1"},"Switch to Old Version"))),c.a.createElement(be.a,{inputId:"telegram-search-input",parentContainerClassName:"LeftSearch",className:j||g?"with-picker-item":"",value:t||u,focused:B,isLoading:m,placeholder:U,autoComplete:"off",canClose:Boolean(j||g),onChange:a,onReset:d,onFocus:R},N&&c.a.createElement(ue.a,{icon:"calendar",title:N,canClose:!0,isMinimized:Boolean(j),className:"search-date",onClick:C,clickArg:S}),j&&c.a.createElement(ue.a,{chatOrUserId:j,onClick:i,canClose:!0,clickArg:k}))))})),je=a(21);a(199);var ge=Object(c.h)(()=>{const e=Object(oe.a)();return c.a.createElement("div",{id:"ConnectionState",dir:e.isRtl?"rtl":void 0},c.a.createElement(je.a,{color:"black"}),c.a.createElement("div",{className:"state-text"},e("WaitingForNetwork")))}),fe=a(131),pe=a(51),Ie=a(27),ve=(e,t,a)=>{const s=Object(c.q)(),n=(e=>Object(c.p)(()=>Object(g.h)(e=>e(),e),[e]))(t),o=Object(Ie.a)();return Object(pe.a)(()=>{let t=!0;n(()=>{s.current=e(),t||o()}),t=!1},a),s.current},ye=a(168),Ce=a(189);var we=Object(c.h)(Object(s.h)(e=>{const{chats:{byId:t},users:{byId:a},chatFolders:{byId:s,orderedIds:n,activeChatFolder:c},currentUserId:o,lastSyncTime:i}=e;return{chatsById:t,usersById:a,chatFoldersById:s,orderedFolderIds:n,lastSyncTime:i,notifySettings:Object(r.eb)(e),notifyExceptions:Object(r.db)(e),activeChatFolder:c,currentUserId:o}},(e,t)=>Object(d.l)(t,["loadChatFolders","setActiveChatFolder","openChat"]))(({chatsById:e,usersById:t,chatFoldersById:a,notifySettings:s,notifyExceptions:n,orderedFolderIds:o,activeChatFolder:r,currentUserId:i,lastSyncTime:l,loadChatFolders:u,setActiveChatFolder:m,openChat:O})=>{const j=Object(c.q)(null),g=Object(oe.a)();Object(c.n)(()=>{l&&u()},[l,u]);const f=Object(c.p)(()=>o?o.map(e=>a[e]||{}).filter(Boolean):void 0,[a,o]),p=ve(()=>{if(!f||!f.length)return;const a=Object.keys(e).map(Number),c=f.map(c=>{const{unreadDialogsCount:o,hasActiveDialogs:r}=Object(h.o)(e,t,c,a,s,n)||{};return{id:c.id,badgeCount:o,isBadgeActive:r}});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&&r>=I.length&&m(0)},[r,I,m]),Object(c.n)(()=>{if(j.current&&b.m&&I&&I.length)return Object(fe.b)(j.current,{onSwipe:(e,t)=>{t===fe.a.Left?m(Math.min(r+1,I.length-1)):t===fe.a.Right&&m(Math.max(0,r-1))}})},[r,I,m]);const y=Object(c.q)();y.current=0!==r,Object(c.n)(()=>y.current?Object(se.a)(()=>{y.current&&m(0)}):void 0,[r,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:w}=Object(ee.a)(!o,void 0,!0);function E(e){const t=Object.values(a).find(({title:e})=>e===I[r].title);return t&&0!==r?c.a.createElement(Ce.a,{folderType:"folder",folderId:t.id,noChatsText:g("FilterNoChatsToDisplay"),isActive:e}):c.a.createElement(Ce.a,{folderType:"all",isActive:e})}return c.a.createElement("div",{className:"ChatFolders"},I&&I.length?c.a.createElement(ye.a,{tabs:I,activeTab:r,onSwitchTab:v}):C?c.a.createElement("div",{className:Object(Z.a)("tabs-placeholder",w)}):void 0,c.a.createElement(ne.a,{ref:j,name:g.isRtl?"slide-reversed":"slide",activeKey:r,renderCount:I?I.length:void 0},E))})),Ee=a(12),Me=a(20),Se=a(17);var ke=Object(c.h)(e=>{const t=Object(Me.a)(Ee.a.Extra,"LeftSearch");return t?c.a.createElement(t,e):c.a.createElement(Se.a,null)});var Ne=Object(c.h)(e=>{const t=Object(Me.a)(Ee.a.Extra,"ContactList");return t?c.a.createElement(t,e):c.a.createElement(Se.a,null)}),Te=a(53);a(210);let Pe;var Ae=Object(c.h)(({isShown:e,onNewPrivateChat:t,onNewChannel:a,onNewGroup:s})=>{const[n,o]=Object(c.r)(!1);Object(c.n)(()=>{e||o(!1)},[e]);const r=Object(oe.a)(),i=Object(Z.a)("NewChatButton",e&&"revealed",n&&"menu-is-open"),l=Object(c.m)(()=>{Pe&&(clearTimeout(Pe),Pe=void 0)},[]),d=Object(c.m)(()=>{Pe&&(clearTimeout(Pe),Pe=void 0),Pe=window.setTimeout(()=>{o(!1)},750)},[]);return c.a.createElement("div",{className:i,onMouseEnter:l,onMouseLeave:d},c.a.createElement(de.a,{round:!0,color:"primary",className:n?"active":"",onClick:()=>{o(!n)},ariaLabel:r(n?"Close":"NewMessageTitle"),tabIndex:-1},c.a.createElement("i",{className:"icon-new-chat-filled"}),c.a.createElement("i",{className:"icon-close"})),c.a.createElement(Te.a,{isOpen:n,positionX:"right",positionY:"bottom",autoClose:!0,onClose:()=>{o(!1)}},c.a.createElement(le.a,{icon:"channel",onClick:a},r("NewChannel")),c.a.createElement(le.a,{icon:"group",onClick:s},r("NewGroup")),c.a.createElement(le.a,{icon:"user",onClick:t},r("NewMessageTitle"))))}),xe=a(157);a(211);const Re=Object.keys(l.d).length/2;let Le;var De=Object(s.h)(e=>Object(d.l)(e,["connectionState"]))(({content:e,searchQuery:t,searchDate:a,contactsFilter:s,onSearchQuery:n,onContentChange:o,onReset:r,connectionState:i})=>{const[d,u]=Object(c.r)(b.m),m=!function(){const[e,t]=Object(c.r)(window.navigator.onLine);return Object(c.n)(()=>{function e(){t(window.navigator.onLine)}return window.addEventListener("online",e),window.addEventListener("offline",e),()=>{window.removeEventListener("offline",e),window.removeEventListener("online",e)}},[]),e}()||"connectionStateConnecting"===i,h=Object(c.q)(!1),O=Object(c.m)(()=>{o(l.d.Settings)},[o]),j=Object(c.m)(()=>{o(l.d.Contacts)},[o]),g=Object(c.m)(()=>{o(l.d.NewChannelStep1)},[o]),f=Object(c.m)(()=>{o(l.d.NewGroupStep1)},[o]),p=Object(c.m)(()=>{o(l.d.Archived)},[o]),I=Object(c.m)(()=>{e===l.d.ChatList&&(h.current=!0,u(!0))},[e]),v=Object(c.m)(()=>{h.current=!1,Le&&(clearTimeout(Le),Le=void 0),Le=window.setTimeout(()=>{h.current||u(!1)},250)},[]);Object(c.n)(()=>{let t;return e!==l.d.ChatList?t=window.setTimeout(()=>{u(!1)},250):(h.current||b.m)&&u(!0),()=>{t&&(clearTimeout(t),t=void 0)}},[e]);const[y,C,w]=function(){const[e,t]=Object(ce.a)(!1);Object(c.n)(()=>{const e=window.setTimeout(t,2592e5);return()=>{clearTimeout(e)}},[t]);const{shouldRender:a,transitionClassNames:s}=Object(ee.a)(e);return[a,s,()=>{window.location.reload()}]}(),E=Object(oe.a)();return c.a.createElement("div",{id:"LeftColumn-main",onMouseEnter:b.m?void 0:I,onMouseLeave:b.m?void 0:v},c.a.createElement(Oe,{content:e,contactsFilter:s,onSearchQuery:n,onSelectSettings:O,onSelectContacts:j,onSelectArchived:p,onReset:r}),c.a.createElement(xe.a,{isOpen:m,isCustom:!0,className:"connection-state-wrapper opacity-transition slow"},()=>c.a.createElement(ge,null)),c.a.createElement(ne.a,{name:"zoom-fade",renderCount:Re,activeKey:e,shouldCleanup:!0,cleanupExceptionKey:l.d.ChatList,className:m?"pull-down":void 0},n=>{switch(e){case l.d.ChatList:return c.a.createElement(we,null);case l.d.GlobalSearch:return c.a.createElement(ke,{searchQuery:t,searchDate:a,isActive:n,onReset:r});case l.d.Contacts:return c.a.createElement(Ne,{filter:s});default:return}}),y&&c.a.createElement(de.a,{fluid:!0,pill:!0,className:Object(Z.a)("btn-update",C),onClick:w},E("lng_update_telegram")),c.a.createElement(Ae,{isShown:d,onNewPrivateChat:j,onNewChannel:g,onNewGroup:f}))});var Fe=Object(c.h)(e=>{const t=Object(Me.a)(Ee.a.Extra,"Settings");return t?c.a.createElement(t,e):c.a.createElement(Se.a,null)});var Be=Object(c.h)(e=>{const t=Object(Me.a)(Ee.a.Extra,"NewChat");return t?c.a.createElement(t,e):c.a.createElement(Se.a,null)});var Ue,He=Object(c.h)(e=>{const t=Object(Me.a)(Ee.a.Extra,"ArchivedChats");return t?c.a.createElement(t,e):c.a.createElement(Se.a,null)});a(212);!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"}(Ue||(Ue={}));const qe=Object.keys(Ue).length/2;var Ge=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:o,setGlobalSearchDate:r,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=Ue.Main;switch(u){case l.d.Archived:I=Ue.Archived;break;case l.d.Settings:I=Ue.Settings;break;case l.d.NewChannelStep1:case l.d.NewChannelStep2:I=Ue.NewChannel;break;case l.d.NewGroupStep1:case l.d.NewGroupStep2:I=Ue.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:""}),r({date:void 0}),n({id:void 0}),o(),setTimeout(()=>{p(Date.now())},250)):m(l.d.GlobalSearch)}else m(l.d.NewGroupStep1)},[u,a,s,r,n,o,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(se.a)(()=>v()):void 0,[a,u,v]),Object(c.n)(()=>{d(),h===l.m.Privacy&&i()},[d,i,h]),c.a.createElement(ne.a,{id:"LeftColumn",name:b.k?"slide-layers":"push-slide",renderCount:qe,activeKey:I,shouldCleanup:!0,cleanupExceptionKey:Ue.Main},a=>{switch(I){case Ue.Archived:return c.a.createElement(He,{isActive:a,onReset:v});case Ue.Settings:return c.a.createElement(Fe,{currentScreen:h,onScreenSelect:O,onReset:v});case Ue.NewChannel:return c.a.createElement(Be,{key:f,isChannel:!0,content:u,onContentChange:m,onReset:v});case Ue.NewGroup:return c.a.createElement(Be,{key:f,content:u,onContentChange:m,onReset:v});default:return c.a.createElement(De,{content:u,searchQuery:e,searchDate:t,contactsFilter:j,onContentChange:m,onSearchQuery:y,onReset:v})}})})),_e=a(138),Ve=a(11),$e=a(13),We=a(56);var ze=()=>{const[e,t]=Object(c.r)(We.a.get());return Object(c.n)(()=>{const e=Object(g.h)(()=>{t(We.a.get())},250,!1);return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]),e},Ke=a(174);function Qe(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,o=t?s-a-c:s-a,r=e>n.db?Math.min(s-a,512):s-a,i=r/o,l=o/r;return{composerHiddenScale:i,toolbarHiddenScale:l,composerTranslateX:t?c/2*l:0,toolbarTranslateX:t?c/2*-1*i:0,unpinHiddenScale:r/258,toolbarForUnpinHiddenScale:258/r}}var Ye=a(133),Je=a(143),Xe=a(134),Ze=a(49),et=a(108),tt=a(123);var at=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Me.a)(Ee.a.Extra,"HeaderMenuContainer",!t);return a?c.a.createElement(a,e):void 0});var st=Object(c.h)(Object(s.h)((e,{chatId:t,threadId:a,messageListType:s})=>{const n=Object(r.f)(e,t),c=Boolean(n&&Object(h.kb)(n));if(n&&n.isRestricted)return{noMenu:!0};const o=Object(r.P)(e,t),l="thread"===s&&a===i.MAIN_THREAD_ID,d="thread"===s&&a!==i.MAIN_THREAD_ID,u=Object(r.W)(e),m=Boolean(Object(r.L)(e,t)),O=Boolean(l&&n&&(c||Object(h.ob)(n))&&n.isNotJoined),j=l||d,g=l&&!o&&!O,f=!Object(r.S)(e),p=l&&!O;return{noMenu:!(b.k&&O||b.k&&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:o,canSearch:r,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)},[]),w=Object(c.m)(()=>{m({chatId:e})},[m,e]),E=Object(c.m)(()=>{h({command:"/start"})},[h]),M=Object(c.m)(()=>{if(O(),b.k){document.querySelector("#MobileSearch input").focus()}else setTimeout(()=>{const e=document.querySelector(".RightHeader .SearchInput input");e&&e.focus()},400)},[O]),S=Object(oe.a)();return c.a.createElement("div",{className:"HeaderActions"},!b.k&&o&&c.a.createElement(de.a,{size:"tiny",ripple:!0,fluid:!0,onClick:w},S(s?"Subscribe":"Join Group")),!b.k&&n&&c.a.createElement(de.a,{size:"tiny",ripple:!0,fluid:!0,onClick:E},S("BotStart")),!b.k&&r&&c.a.createElement(de.a,{round:!0,ripple:u,color:"translucent",size:"smaller",onClick:M,ariaLabel:"Search in this chat"},c.a.createElement("i",{className:"icon-search"})),(b.k||!o)&&c.a.createElement(de.a,{ref:j,className:g?"active":"",round:!0,ripple:!b.k,size:"smaller",color:"translucent",disabled:a,ariaLabel:"More actions",onClick:v},c.a.createElement("i",{className:"icon-more"})),p&&c.a.createElement(at,{chatId:e,threadId:t,isOpen:g,anchor:p,isChannel:s,canSubscribe:o,canSearch:r,canMute:i,canSelect:l,canLeave:d,onSubscribeChannel:w,onSearchClick:M,onClose:y,onCloseAnimationEnd:C}))})),nt=a(114),ct=a(24),ot=a(107),rt=a(44);function it(e){const t=e&&Object(h.E)(e),{sticker:a}=e&&e.content||{},s=t&&a&&!Object(b.r)()&&t.includes("image/webp"),[o,r]=Object(c.r)(rt.a),i=e&&e.id;return Object(c.o)(()=>{s&&Object(rt.c)("b64-"+i,t).then(r).catch(e=>{n.p&&console.error(e)})},[i,s,t]),s?o:t}var lt=a(116),dt=a(42);function bt(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 ut=Object(c.h)(({count:e,index:t})=>{const a=Object(c.q)(null),s=Object(c.p)(()=>function(e,t){const a=e-t-1,s=function(e){let t=8;1===e?t=36:2===e?t=17:3===e?t=11:(4===e||e>3)&&(t=7.5);return t}(e),n=function(e,t){let a=36;1===e?a=36:2===e?a=17:3===e?a=1===t?12:11:(4===e||e>3)&&(a=7.5);return a}(e,a),c=function(e,t){return e<=3?36:t*e+2*(e-1)}(e,s),o="clipPath"+e,r=function(e,t,a){let s="";if(3===a)s=bt(0,0,2,t,1)+bt(0,12,2,t+1,1)+bt(0,25,2,t,1);else for(let e=0;e<a;e++)s+=bt(0,(t+2)*e,2,t,1);return`<clipPath id="${e}">\n <path d="${s}" />\n </clipPath>`}(o,s,e),i=function(e,t,a){if(1===a)return 0;if(2===a)return 0===e?0:t+2;return 3===a?0===e?0:1===e?12:25:(t+2)*e}(a,s,e),l=function(e,t,a,s){if(t<=4)return 0;if(e<=1)return 0;if(e>=t-2)return s-36;return(a+4)/2+(e-2)*(a+2)}(a,e,s,c);return{markHeight:n,clipPath:r,markTranslateY:i,trackTranslateY:l,trackHeight:c,clipPathId:o}}(e,t),[e,t]);if(Object(c.n)(()=>{if(!a.current)return;const{trackHeight:e,trackTranslateY:t,markHeight:n,markTranslateY:c,clipPathId:o,clipPath:r}=s,i=a.current.firstElementChild;if(a&&a.current){const s=a.current,{style:l}=s;l.height=e+"px",l.transform=`translateY(-${t}px)`,l.clipPath=`url("#${o}")`;const d=s.querySelector("svg"),b=s.querySelector("div"),u=s.querySelector("defs");d||i&&(i.innerHTML=`<svg height="0" width="0"><defs> ${r} </defs></svg>`),u&&(u.innerHTML=r),b&&(b.style.height=n+"px",b.style.transform=`translateY(${c}px)`)}},[s]),1===e)return c.a.createElement("div",{className:"pinned-message-border"},c.a.createElement("div",{className:"pinned-message-border-wrapper-1",ref:a}));const{trackHeight:n,trackTranslateY:o,markHeight:r,markTranslateY:i,clipPathId:l}=s;return c.a.createElement("div",{className:Object(Z.a)("pinned-message-border",e>4&&"pinned-message-border-mask")},c.a.createElement("div",{className:"pinned-message-border-wrapper",ref:a,style:`clip-path: url("#${l}"); width: 2px;\n height: ${n}px; transform: translateY(-${o}px);`},c.a.createElement("span",null),c.a.createElement("div",{className:"pinned-message-border-mark",style:`height: ${r}px; transform: translateY(${i}px);`})))});var mt=Object(c.h)(({message:e,count:t,index:a,customTitle:s,className:n,onUnpinMessage:o,onClick:r,onAllPinnedClick:i})=>{const l=Object(oe.a)(),d=it(e),b=Object(ot.a)(Object(h.D)(e,"pictogram")),u=Object(h.N)(l,e,Boolean(d)),[m,O,j]=Object(ce.a)(),g=Object(c.m)(()=>{j(),o&&o(e.id)},[j,o,e.id]);return c.a.createElement("div",{className:Object(Z.a)("HeaderPinnedMessage-wrapper",n)},t>1&&c.a.createElement(de.a,{round:!0,size:"smaller",color:"translucent",className:"pin-list-button",ariaLabel:l("EventLogFilterPinnedMessages"),onClick:i},c.a.createElement("i",{className:"icon-pin-list"})),o&&c.a.createElement(de.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(lt.a,{isOpen:m,onClose:j,text:"Would you like to unpin this message?",confirmLabel:"Unpin",confirmHandler:g}),c.a.createElement("div",{className:"HeaderPinnedMessage",onClick:r,dir:l.isRtl?"rtl":void 0},c.a.createElement(ut,{count:t,index:a}),d&&function(e,t){const{width:a,height:s}=Object(nt.m)();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(ct.a)(u))),c.a.createElement(dt.a,null)))}),ht=a(54),Ot=a(175);a(215);var jt=Object(s.h)((e,{message:t})=>({sender:Object(r.tb)(e,t)}),(e,t)=>Object(d.l)(t,["focusMessage","closeAudioPlayer"]))(({message:e,className:t,noUi:a,sender:s,focusMessage:n,closeAudioPlayer:o})=>{const r=Object(oe.a)(),i=s?Object(h.W)(r,s):void 0,l=ht.c(Object(h.D)(e,"inline")),{playPause:d,isPlaying:u}=Object(Ot.a)(Object(h.A)(e),Object(h.q)(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(),o()},[o,u,d]);if(a)return;const j=Object(h.t)(e);return c.a.createElement("div",{className:Object(Z.a)("AudioPlayer",t),dir:r.isRtl?"rtl":void 0},c.a.createElement(de.a,{round:!0,ripple:!b.k,color:"translucent",size:"smaller",className:Object(Z.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(ct.a)(t||s)),a&&c.a.createElement("div",{className:"subtitle",dir:"auto"},Object(ct.a)(a)))}(j):function(e,t){return c.a.createElement(c.a.Fragment,null,c.a.createElement("div",{className:"title",dir:"auto"},t&&Object(ct.a)(t)),c.a.createElement("div",{className:"subtitle",dir:"auto"},e))}(r("AttachAudio"),i),c.a.createElement(dt.a,null)),c.a.createElement(de.a,{round:!0,className:"player-close",color:"translucent",size:"smaller",onClick:O,ariaLabel:"Close player"},c.a.createElement("i",{className:"icon-close"})))});a(216);var gt=Object(c.h)(Object(s.h)((e,{chatId:t,threadId:a,messageListType:s})=>{const{isLeftColumnShown:n,lastSyncTime:c}=e,{byId:o}=e.chats,l=Object(r.f)(e,t),{typingStatus:d}=l||{},{chatId:b,messageId:u}=e.audioPlayer,m=b&&u?Object(r.k)(e,b,u):void 0,h=Object(r.Eb)(e,t,a);let O;if("pinned"===s){const a=Object(r.jb)(e,t);O=a&&a.length}else if("scheduled"===s){const a=Object(r.ob)(e,t);O=a&&a.length}else if("thread"===s&&a!==i.MAIN_THREAD_ID){const s=Object(r.Db)(e,t,a);s&&(O=s.messagesCount)}const j={typingStatus:d,isLeftColumnShown:n,isRightColumnShown:Object(r.W)(e),isSelectModeActive:Object(r.S)(e),audioMessage:m,chat:l,chatsById:o,originChatId:h?h.id:t,messagesCount:O,isChatWithSelf:Object(r.P)(e,t),isChatWithBot:l&&Object(r.O)(e,l),lastSyncTime:c,notifySettings:Object(r.eb)(e),notifyExceptions:Object(r.db)(e)},g=Object(r.m)(e,t);if("thread"!==s||!g)return j;if(Object.assign(j,{messagesById:g}),a!==i.MAIN_THREAD_ID){const s=Object(r.Fb)(e,t,a),n=s?Object(r.k)(e,t,s):void 0,c=n?Object(r.K)(e,n):void 0;return{...j,pinnedMessageIds:s,canUnpin:!1,topMessageSender:c}}const f=Object(r.jb)(e,t);if(f&&f.length){const t=g[f[0]],{canUnpin:s}=t&&Object(r.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:o,canUnpin:r,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:w,notifyExceptions:E,openChatWithInfo:M,pinMessage:S,focusMessage:k,openChat:N,loadPinnedMessages:T,toggleLeftColumn:P,exitMessageSelectMode:A})=>{const x=Object(oe.a)(),[R,L]=Object(c.r)(0),D=Array.isArray(s)?s[R]:s,F=o&&D?o[D]:void 0,B=Array.isArray(s)?s.length:s?1:0,U=g&&Object(h.k)(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(Je.a)(e,D,F);const{width:q}=ze(),G=q<=n.Z,_=b.l&&m,V=Object(c.q)(null),$=Object(c.q)(!0),W=Object(c.m)(()=>{M({id:e})},[M,e]),z=Object(c.m)(t=>{S({chatId:e,messageId:t,isUnpin:!0})},[S,e]),K=Object(c.m)(()=>{if(F){k({chatId:F.chatId,threadId:t,messageId:F.id});const e=Object(Ye.a)(B,R+1);L(e)}},[F,k,t,B,R]),Q=Object(c.m)(()=>{N({id:e,threadId:i.MAIN_THREAD_ID,type:"pinned"})},[N,e]),Y=Object(c.m)(e=>{if(b.k){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.k||_?(e.stopPropagation(),N({id:void 0})):P()},[N,p,t,a,P,u,A,_]),J=Object(c.p)(()=>{if(!G||!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,w,E)&&!a.unreadMentionsCount||(e=!0),t+s},0);return t?{isActive:e,totalCount:t}:void 0},[G,f,w,E]),X=q>=n.Z&&q<n.kb||q>n.db&&q<n.Z&&(!U||U>30),te=X||q>n.ab&&q<n.lb,{shouldRender:ae,transitionClassNames:se}=Object(ee.a)(Boolean(j)),ce=Object(Xe.a)(j),{shouldRender:re,transitionClassNames:ie}=Object(ee.a)(F&&!ae),le=Object(Xe.a)(F),be=Object(Xe.a)(H),ue=re&&le||ae&&ce;function me(){return"thread"===a&&t===i.MAIN_THREAD_ID?c.a.createElement(c.a.Fragment,null,G&&he(_,J),c.a.createElement("div",{className:"chat-info-wrapper",onClick:W},Object(h.mb)(e)?c.a.createElement(et.a,{userId:e,typingStatus:d,withFullInfo:y,withMediaViewer:!0,withUpdatingStatus:!0,noRtl:!0}):c.a.createElement(tt.a,{chatId:e,typingStatus:d,noRtl:!0,withMediaViewer:!0,withFullInfo:!0,withUpdatingStatus:!0}))):"thread"===a?c.a.createElement(c.a.Fragment,null,he(),c.a.createElement("h3",null,x("CommentsCount",I))):"pinned"===a?c.a.createElement(c.a.Fragment,null,he(),c.a.createElement("h3",null,x("PinnedMessagesCount",I))):"scheduled"===a?c.a.createElement(c.a.Fragment,null,he(),c.a.createElement("h3",null,v?x("Reminders"):x("messages",I))):void 0}function he(e=!1,t){return c.a.createElement("div",{className:"back-button"},c.a.createElement(de.a,{round:!0,size:"smaller",color:"translucent",onClick:Y,ariaLabel:e?"Close":"Back"},c.a.createElement("div",{className:Object(Z.a)("animated-close-icon",!e&&"state-back")})),t&&c.a.createElement("div",{className:"unread-count "+(t.isActive?"active":"")},Object(Ze.b)(t.totalCount)))}return Object(c.n)(()=>{const e=V.current;if(e)return te&&ue?void(O||X?($.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,X,O]),c.a.createElement("div",{className:"MiddleHeader",ref:V},c.a.createElement(ne.a,{name:"slide-fade",activeKey:"thread"===a?t:1},me),c.a.createElement("div",{className:"header-tools"},re&&le&&!ae&&c.a.createElement(mt,{key:e,message:le,count:B,index:R,customTitle:be,className:ie,onUnpinMessage:r?z:void 0,onClick:K,onAllPinnedClick:Q}),ae&&ce&&c.a.createElement(jt,{key:Object(h.A)(ce),message:ce,className:se}),c.a.createElement(st,{chatId:e,threadId:t,messageListType:a})))})),ft=a(159);function pt(e){return"albumId"in e}function It(e,t){let a,s=[],n={originalDate:e[0].date,datetime:Number(Object(x.j)(1e3*e[0].date)),senderGroups:[s]};const c=[n];return e.forEach((o,r)=>{o.isInAlbum?a?(a.messages.push(o),o.content.text&&(a.mainMessage=o)):a={albumId:o.groupedId,messages:[o],mainMessage:o}:s.push(o);const i=e[r+1];if(!a||i&&i.groupedId&&i.groupedId===a.albumId||(s.push(a),a=void 0),i){const e=Number(Object(x.j)(1e3*i.date));n.datetime!==e?(n={originalDate:i.date,datetime:e,senderGroups:[]},c.push(n),s=[],n.senderGroups.push(s)):(i.id===t||o.senderId!==i.senderId||o.isOutgoing!==i.isOutgoing||Object(h.eb)(o)||Object(h.eb)(i)||o.forwardInfo&&i.forwardInfo&&(o.forwardInfo.senderUserId!==i.forwardInfo.senderUserId||o.forwardInfo.fromChatId!==i.forwardInfo.fromChatId||o.forwardInfo.hiddenUserName!==i.forwardInfo.hiddenUserName)||o.inlineButtons||i.inlineButtons||i.date-o.date>600)&&(s=[],n.senderGroups.push(s))}}),c}var vt=a(106);function yt(){const[e,t]=Object(ce.a)(!1),a=(s=1e3,n=!1,Object(c.p)(()=>Object(g.a)(e=>e(),s,n,o),[s,n,o]));var s,n,o;return{isScrolled:e,updateStickyDates:Object(c.m)((e,s)=>{t(),document.body.classList.contains("is-scrolling-messages")||Object(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 Ct=a(154),wt=a(124);var Et=({containerRef:e,className:t,messageIds:a,loadMoreForwards:s,loadMoreBackwards:o,isViewportNewest:r,firstUnreadId:i,onFabToggle:l,onNotchToggle:d,children:b})=>{const u=Object(c.q)(null),m=Object(c.q)(null),h=Object(c.q)(null),O=Object(c.m)(()=>{if(!a||!a.length)return l(!1),void d(!1);if(!r)return l(!0),void d(!0);const{offsetHeight:t,scrollHeight:s,scrollTop:n}=e.current,c=s-n-t,o=c<=0;l(i?!o:!(c<=50)),d(!o)},[a,r,e,l,i,d]),{observe:j}=Object(vt.a)({rootRef:e,margin:n.U},t=>{if(!s||!o)return;const a=t.find(({isIntersecting:e})=>e);if(!a)return;const{target:n}=a;"backwards-trigger"===n.className?(Object(Ct.a)(e.current),o()):"forwards-trigger"===n.className&&(Object(Ct.a)(e.current),s())});Object(vt.c)(u,j),Object(vt.c)(m,j);const{observe:g,freeze:f,unfreeze:p}=Object(vt.a)({rootRef:e,margin:50},O);Object(vt.c)(h,g);const{observe:I,freeze:v,unfreeze:y}=Object(vt.a)({rootRef:e},O);return Object(vt.c)(h,I),Object(pe.a)(()=>{f(),v(),setTimeout(()=>{y(),p()},100)},[a]),c.a.createElement("div",{className:t,teactFastList:!0},c.a.createElement("div",{ref:u,key:"backwards-trigger",className:"backwards-trigger"}),b,c.a.createElement("div",{ref:m,key:"forwards-trigger",className:"forwards-trigger"}),c.a.createElement("div",{ref:h,key:"fab-trigger",className:"fab-trigger"}))},Mt=a(144),St=a(145);function kt(e){return"number"==typeof e}function Nt(e,t){return e?t?238:175:100}function Tt(e,t){const a=Object(h.ub)(e),s=Object(h.rb)(e),n=Object(h.G)(e)||Object(h.R)(e),c=Object(h.P)(e),o=Boolean(Object(h.R)(e)),{width:r,height:i}=n?Object(nt.g)(n,a,s,o,t):Object(nt.i)(c,a,s,t),l=Nt(Boolean(Object(h.O)(e)));let d=1;r<l&&l-r<12&&(d=l/r),i*d<90&&90-i*d<12&&(d=90/i);const b=Math.round(r*d),u=Math.round(i*d);return{width:b,height:u,isSmall:b<l||u<90}}const Pt=0,At=1,xt=2,Rt=4,Lt=8;function Dt(e,t){return e.reduce((e,t)=>e+t,t)}function Ft(e,t,a){return e<t?t:e>a?a:e}function Bt(e){const t={width:0,height:0};return e.forEach(({dimensions:e,sides:a})=>{a&xt&&(t.width=e.width+e.x),a&Rt&&(t.height=e.height+e.y)}),t}function Ut(e,t,a,s){const n=s.messages.map(e=>{const t=Tt(e);return t.width/t.height});const c=function(e){return e.map(e=>e>1.2?"w":e<.8?"n":"q").join("")}(n),o=function(e){return e.reduce((e,t)=>t+e,1)/e.length}(n),r=n.length,i=n.some(e=>e>2),l=Object(nt.j)(e,t,!1,a)-(t?2.5:0)*nt.d;let d;const b={ratios:n,proportions:c,averageRatio:o,maxWidth:l,minWidth:100,maxHeight:l,spacing:2};return d=r>=5||i?function({ratios:e,averageRatio:t,maxWidth:a,minWidth:s,spacing:n,maxHeight:c=4*a/3}){const o=function(e,t){return e.map(e=>t>1.1?Ft(e,1,2.75):Ft(e,.6667,1))}(e,t),r=e.length,i=new Array(r),l=[],d=e=>{const t=[];let s=0;e.forEach(e=>{t.push(((e,t)=>{const s=Dt(o.slice(e,e+t),0);return(a-(t-1)*n)/s})(s,e)),s+=e}),l.push({lineCounts:e,heights:t})};for(let e=1;e!==r;++e){const t=r-e;e<=3&&t<=3&&d([e,t])}for(let e=1;e!==r-1;++e)for(let a=1;a!==r-e;++a){const s=r-e-a;e<=3&&a<=(t<.85?4:3)&&s<=3&&d([e,a,s])}for(let e=1;e!==r-1;++e)for(let t=1;t!==r-e;++t)for(let a=1;a!==r-e-t;++a){const s=r-e-t-a;e<=3&&t<=3&&a<=3&&s<=4&&d([e,t,a,s])}let b,u=0;for(let e=0;e<l.length;e++){const{heights:t,lineCounts:a}=l[e],o=a.length,r=Dt(t,0)+n*(o-1),i=Math.min(...t)<s?1.5:1,d=(()=>{for(let e=1;e!==o;++e)if(a[e-1]>a[e])return 1.5;return 1})(),m=Math.abs(r-c)*i*d;(!b||m<u)&&(b=l[e],u=m)}const m=b.lineCounts,h=b.heights,O=m.length;let j=0,g=0;for(let e=0;e!==O;++e){const t=m[e],s=h[e],c=Math.round(s);let r=0;for(let l=0;l!==t;++l){const d=Pt|(0===e?At:Pt)|(e===O-1?Rt:Pt)|(0===l?Lt:Pt)|(l===t-1?xt:Pt),b=o[j],u=l===t-1?a-r:Math.round(b*s);i[j]={dimensions:{x:r,y:g,width:u,height:c},sides:d},r+=u+n,++j}g+=c+n}return i}(b):2===r?function(e){const{ratios:t,proportions:a,averageRatio:s}=e;return"ww"===a&&s>1.4&&t[1]-t[0]<.2?function(e){const{ratios:t,maxWidth:a,spacing:s,maxHeight:n}=e,c=Math.round(Math.min(a/t[0],Math.min(a/t[1],(n-s)/2)));return[{dimensions:{x:0,y:0,width:a,height:c},sides:Lt|At|xt},{dimensions:{x:0,y:c+s,width:a,height:c},sides:Lt|Rt|xt}]}(e):"ww"===a||"qq"===a?function(e){const{ratios:t,maxWidth:a,spacing:s,maxHeight:n}=e,c=(a-s)/2,o=Math.round(Math.min(c/t[0],Math.min(c/t[1],n)));return[{dimensions:{x:0,y:0,width:c,height:o},sides:At|Lt|Rt},{dimensions:{x:c+s,y:0,width:c,height:o},sides:At|xt|Rt}]}(e):function(e){const{ratios:t,minWidth:a,maxWidth:s,spacing:n,maxHeight:c}=e,o=Math.round(1.5*a),r=Math.min(Math.round(Math.max(.4*(s-n),(s-n)/t[0]/(1/t[0]+1/t[1]))),s-n-o),i=s-r-n,l=Math.min(c,Math.round(Math.min(i/t[0],r/t[1])));return[{dimensions:{x:0,y:0,width:i,height:l},sides:At|Lt|Rt},{dimensions:{x:i+n,y:0,width:r,height:l},sides:At|xt|Rt}]}(e)}(b):3===r?function(e){const{proportions:t}=e;return"n"===t[0]?function(e){const{maxHeight:t,spacing:a,ratios:s,maxWidth:n,minWidth:c}=e,o=t,r=Math.round(Math.min((t-a)/2,s[1]*(n-a)/(s[2]+s[1]))),i=o-r-a,l=Math.max(c,Math.round(Math.min((n-a)/2,Math.min(r*s[2],i*s[1])))),d=Math.min(Math.round(o*s[0]),n-a-l);return[{dimensions:{x:0,y:0,width:d,height:o},sides:At|Lt|Rt},{dimensions:{x:d+a,y:0,width:l,height:i},sides:At|xt},{dimensions:{x:d+a,y:i+a,width:l,height:r},sides:Rt|xt}]}(e):function(e){const{maxWidth:t,ratios:a,maxHeight:s,spacing:n}=e,c=t,o=Math.round(Math.min(c/a[0],.66*(s-n))),r=(t-n)/2,i=Math.min(s-o-n,Math.round(Math.min(r/a[1],r/a[2])));return[{dimensions:{x:0,y:0,width:c,height:o},sides:Lt|At|xt},{dimensions:{x:0,y:o+n,width:r,height:i},sides:Rt|Lt},{dimensions:{x:r+n,y:o+n,width:c-r-n,height:i},sides:Rt|xt}]}(e)}(b):function(e){const{proportions:t}=e;return"w"===t[0]?function({maxWidth:e,ratios:t,spacing:a,maxHeight:s,minWidth:n}){const c=e,o=Math.round(Math.min(c/t[0],.66*(s-a))),r=Math.round((e-2*a)/(t[1]+t[2]+t[3])),i=Math.max(n,Math.round(Math.min(.4*(e-2*a),r*t[1]))),l=Math.round(Math.max(Math.max(n,.33*(e-2*a)),r*t[3])),d=c-i-l-2*a,b=Math.min(s-o-a,r);return[{dimensions:{x:0,y:0,width:c,height:o},sides:Lt|At|xt},{dimensions:{x:0,y:o+a,width:i,height:b},sides:Rt|Lt},{dimensions:{x:i+a,y:o+a,width:d,height:b},sides:Rt},{dimensions:{x:i+a+d+a,y:o+a,width:l,height:b},sides:xt|Rt}]}(e):function({maxHeight:e,ratios:t,maxWidth:a,spacing:s,minWidth:n}){const c=e,o=Math.round(Math.min(c*t[0],.6*(a-s))),r=Math.round((e-2*s)/(1/t[1]+1/t[2]+1/t[3])),i=Math.round(r/t[1]),l=Math.round(r/t[2]),d=c-i-l-2*s,b=Math.max(n,Math.min(a-o-s,r));return[{dimensions:{x:0,y:0,width:o,height:c},sides:At|Lt|Rt},{dimensions:{x:o+s,y:0,width:b,height:i},sides:At|xt},{dimensions:{x:o+s,y:i+s,width:b,height:l},sides:xt},{dimensions:{x:o+s,y:i+l+2*s,width:b,height:d},sides:Rt|xt}]}(e)}(b),{layout:d,containerStyle:Bt(d)}}let Ht;function qt(e){return Ht||(Ht=document.createElement("span"),Ht.style.font='400 12px "Roboto", -apple-system, "Apple Color Emoji", BlinkMacSystemFont, "Helvetica Neue", sans-serif',Ht.style.whiteSpace="nowrap",Ht.style.position="absolute",Ht.style.left="-999px",Ht.style.opacity=".01",document.body.appendChild(Ht)),Ht.innerHTML=e,Ht.offsetWidth}function Gt(e,t,a,s,n){Object(c.o)(()=>{if(a&&e.current){const t=e.current.closest(".MessageList");Object(wt.a)(t,e.current,n?"end":"centerOrTop",20,void 0===s?1500:1e3,s)}},[e,t,a,s,n])}var _t=a(111),Vt=a(67);var $t=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Me.a)(Ee.a.Extra,"ContextMenuContainer",!t);return a?c.a.createElement(a,e):void 0});var Wt=Object(c.h)(Object(s.h)((e,{message:t})=>{const a=t.senderId,{targetUserId:s,targetChatId:n}=t.content.action||{},c=t.replyToMessageId,o=c?Object(r.k)(e,t.chatId,c):void 0,i=Object(r.U)(e,t),{direction:l,noHighlight:d}=i&&e.focusedMessage||{},b=Object(r.f)(e,t.chatId);return{sender:b&&(Object(h.kb)(b)||a===t.chatId)?b:a?Object(r.Hb)(e,a):void 0,...s&&{targetUser:Object(r.Hb)(e,s)},targetChatId:n,targetMessage:o,isFocused:i,...i&&{focusDirection:l,noFocusHighlight:d}}})(({message:e,observeIntersection:t,isEmbedded:a,appearanceOrder:s=0,isLastInList:n,sender:o,targetUser:r,targetMessage:i,targetChatId:l,isFocused:d,focusDirection:b,noFocusHighlight:u})=>{const m=Object(c.q)(null);Object(vt.c)(m,t),Object(Je.a)(e.chatId,e.replyToMessageId,i),Gt(m,e.chatId,d,b,u);const h=Object(oe.a)(),O=s<=0,[j,g]=Object(ce.a)(O);Object(c.n)(()=>{O||setTimeout(g,10*s)},[s,g,O]);const{transitionClassNames:f}=Object(ee.a)(j,void 0,O,!1),p=Object(Vt.a)(h,e,o,r,i,l,a?{isEmbedded:!0,asPlain:!0}:void 0),{isContextMenuOpen:I,contextMenuPosition:v,handleBeforeContextMenu:y,handleContextMenu:C,handleContextMenuClose:w,handleContextMenuHide:E}=Object(Mt.a)(m),M=void 0!==v;if(a)return c.a.createElement("span",{className:"embedded-action-message"},Object(ct.a)(p));const S=Object(Z.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($t,{isOpen:I,anchor:v,message:e,messageListType:"thread",onClose:w,onCloseAnimationEnd:E}))}));a(217);var zt=({className:e,message:t,sender:a,title:s,customText:n,observeIntersection:o,onClick:r})=>{const i=Object(c.q)(null),l=Object(vt.b)(i,o),d=Object(ot.a)(t&&Object(h.D)(t,"pictogram"),!l),b=t&&"sticker-reply-thumb"+t.id,u=it(t),m=Boolean(t&&Object(h.I)(t)),O=Object(oe.a)(),j=a&&Object(h.W)(O,a);return c.a.createElement("div",{ref:i,className:Object(Z.a)("EmbeddedMessage",e),onClick:t?r:void 0},u&&function(e,t,a,s){const{width:n,height:o}=Object(nt.m)();return c.a.createElement("img",{id:e,src:a||t,width:n,height:o,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(Wt,{message:t,isEmbedded:!0}):Object(ct.a)(Object(h.N)(O,t,Boolean(u))):n||" "),c.a.createElement("div",{className:"message-title",dir:"auto"},Object(ct.a)(j||s||" "))))},Kt=a(160),Qt=a(167),Yt=a(172);a(221);var Jt=Object(c.h)(({message:e,outgoingStatus:t,signature:a,onClick:s})=>{const n=Object(oe.a)();return c.a.createElement("span",{className:"MessageMeta",dir:n.isRtl?"rtl":"ltr",onClick:s},Boolean(e.views)&&c.a.createElement(c.a.Fragment,null,c.a.createElement("span",{className:"message-views"},Object(Ze.b)(e.views)),c.a.createElement("i",{className:"icon-channelviews"})),a&&c.a.createElement("span",{className:"message-signature"},Object(ct.a)(a)),c.a.createElement("span",{className:"message-time"},e.isEdited&&n("EditedMessage")+" ",Object(x.h)(1e3*e.date)),t&&c.a.createElement(Yt.a,{status:t}))}),Xt=a(113),Zt=a(115),ea=a(161);a(222);var ta=({message:e,observeIntersection:t,observeIntersectionForPlaying:a,shouldLoop:s,lastSyncTime:o})=>{const r=Object(c.q)(null),[i,l,d]=Object(ce.a)(),b=e.content.sticker,{isAnimated:u,stickerSetId:m}=b,O=m===n.S,j=Object(vt.b)(r,t),g=Object(vt.b)(r,a),f=b.isPreloadedGlobally?"sticker"+b.id:Object(h.D)(e,"inline"),p=it(e),I=Object(ot.a)(f,!j,Object(h.C)(e,"inline",!0),o),v=Boolean(I),[y,C]=Object(ce.a)(v),w=u?y:v,{shouldRenderFullMedia:E,transitionClassNames:M}=Object(Xt.a)(w,"slow"),{width:S,height:k}=Object(nt.n)(b),N=Object(Z.a)("thumbnail",!p&&"empty"),T=Object(Z.a)("Sticker media-inner",O&&"inactive");return c.a.createElement("div",{ref:r,className:T,onClick:O?void 0:l},!w&&c.a.createElement("img",{id:"sticker-thumb-"+e.id,src:p,width:S,height:k,alt:"",className:N}),!u&&E&&c.a.createElement("img",{id:"sticker-"+e.id,src:I,width:S,height:k,alt:"",className:Object(Z.a)("full-media",M)}),u&&v&&c.a.createElement(Zt.a,{key:f,className:Object(Z.a)("full-media",M),id:f,animationData:I,size:S,play:g,noLoop:!s,onLoad:C}),c.a.createElement(ea.a,{isOpen:i,fromSticker:b,onClose:d}))},aa=a(128),sa=a(119),na=a(162);function ca(e,t){return Object(na.a)(Object(h.E)(e),Boolean(t),b.k&&!b.c)}var oa=a(38);var ra=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,o=a.height-1;return`rgba(${Array.from(n.getImageData(c,o,1,1).data).join(",")})`}(e,t);var ia=a(120);var la=({id:e,message:t,observeIntersection:a,noAvatars:s,shouldAutoLoad:n,isInSelectMode:o,isSelected:r,uploadProgress:i,size:l="inline",dimensions:d,nonInteractive:b,shouldAffectAppendix:u,onClick:m,onCancelUpload:O})=>{const j=Object(c.q)(null),g=(Object(h.G)(t)||Object(h.R)(t)).blobUrl,f=Object(vt.b)(j,a),[p,I]=Object(c.r)(n),v=p&&f,{mediaData:y,downloadProgress:C}=Object(sa.a)(Object(h.D)(t,l),!v),w=g||y,E=ca(t,w),{isUploading:M,isTransferring:S,transferProgress:k}=Object(h.r)(t,i||C,v&&!w),N=!1===Object(oa.a)(p),{shouldRender:T,transitionClassNames:P}=Object(ee.a)(S,void 0,N,"slow"),{shouldRenderThumb:A,shouldRenderFullMedia:x,transitionClassNames:R}=Object(Xt.a)(w,"slow"),L=Object(c.m)(()=>{M?O&&O(t):w?m&&m(t.id):I(e=>!e)},[w,M,t,O,m]),D=Object(h.ub)(t);Object(c.o)(()=>{if(!u)return;const e=j.current.closest(".message-content");w?ra(w,D,0,r).then(t=>{e.style.setProperty("--appendix-bg",t),e.setAttribute("data-has-custom-appendix","")}):e.classList.add("has-appendix-thumb")},[w,D,u,o,r]);const{width:F,height:B,isSmall:U}=d||Tt(t,s),H=Object(Z.a)("media-inner",!M&&!b&&"interactive",U&&"small-image",F===B&&"square-image"),q=d?`width: ${F}px; height: ${B}px; left: ${d.x}px; top: ${d.y}px;`:"";return c.a.createElement("div",{id:e,ref:j,className:H,style:q,onClick:M?void 0:L},A&&c.a.createElement("canvas",{ref:E,className:"thumbnail",style:`width: ${F}px; height: ${B}px`}),x&&c.a.createElement("img",{src:w,className:"full-media "+R,width:F,height:B,alt:""}),T&&c.a.createElement("div",{className:"media-loading "+P},c.a.createElement(ia.a,{progress:k,onClick:M?L:void 0})),!w&&!p&&c.a.createElement("i",{className:"icon-download"}),S&&c.a.createElement("span",{className:"message-upload-progress"},Math.round(100*k),"%"))},da=a(136),ba=a(135);function ua(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(ba.a)(e.current)},[e]);Object(X.a)(s,n)}var ma=a(146),ha=(e,t=!1)=>{const a=Object(c.q)(!1),s=Object(c.q)(!1),n=Object(c.m)(()=>{s.current=!0,t&&e.current&&(a.current||(a.current=!e.current.paused),e.current.pause())},[t,e]),o=Object(c.m)(()=>{t&&e.current&&a.current&&document.body.contains(e.current)&&Object(ba.a)(e.current),a.current=!1,s.current=!1},[t,e]),r=Object(c.m)(()=>{Object(g.b)(o)},[o]);document.hasFocus()||n(),Object(te.a)(n,r)};function Oa(){return(Oa=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var s in a)Object.prototype.hasOwnProperty.call(a,s)&&(e[s]=a[s])}return e}).apply(this,arguments)}var ja=({id:e,message:t,observeIntersection:a,noAvatars:s,shouldAutoLoad:n,shouldAutoPlay:o,uploadProgress:r,lastSyncTime:i,dimensions:l,onClick:d,onCancelUpload:b})=>{const u=Object(c.q)(null),m=Object(c.q)(null),O=Object(h.P)(t)||Object(h.S)(t),j=O.blobUrl,g=Object(vt.b)(u,a),[f,p]=Object(c.r)(n),I=Boolean(f&&g&&i),[v,y]=Object(c.r)(o),C=Object(ot.a)(Object(h.D)(t,"pictogram"),!(g&&i),Object(h.C)(t,"pictogram"),i),w=ca(t),{mediaData:E,downloadProgress:M}=Object(sa.a)(Object(h.D)(t,"inline"),!I,Object(h.C)(t,"inline"),i),S=j||E,k=Boolean(g&&S),{isBuffered:N,bufferingHandlers:T}=Object(da.a)(!n),{isUploading:P,isTransferring:A,transferProgress:R}=Object(h.r)(t,r||M,I&&!N),L=!1===Object(oa.a)(f),{shouldRender:D,transitionClassNames:F}=Object(ee.a)(A,void 0,L),{shouldRenderThumb:B,transitionClassNames:U}=Object(Xt.a)(S,"slow"),[H,q]=Object(c.r)(0),G=Object(c.m)(e=>{q(Math.max(0,e.currentTarget.currentTime-1))},[]),_=O.duration||m.current&&m.current.duration||0,V=Object(h.ub)(t),$=Object(h.rb)(t),{width:W,height:z}=l||Object(nt.i)(O,V,$,s);ua(m,Boolean(k&&o)),ha(m,v),Object(ma.a)(m,[k]);const K=Object(c.m)(()=>{P?b&&b(t):S?S&&!v?(y(!0),m.current.play()):d&&d(t.id):p(e=>!e)},[P,S,v,d,b,t]),Q=Object(Z.a)("media-inner dark",!P&&"interactive"),Y=Object(Z.a)("full-media",U),J=l?`width: ${W}px; height: ${z}px; left: ${l.x}px; top: ${l.y}px;`:"",X=k,te=f&&!v&&!D,ae=!f;return c.a.createElement("div",{ref:u,id:e,className:Q,style:J,onClick:P?void 0:K},(!k||B||X)&&c.a.createElement("canvas",{ref:w,className:"thumbnail",style:`width: ${W}px; height: ${z}px;`}),C&&c.a.createElement("img",{src:C,className:"thumbnail",style:`width: ${W}px; height: ${z}px;`,alt:""}),X&&c.a.createElement("video",Oa({ref:m,className:Y,width:W,height:z,autoPlay:v,muted:!0,loop:!0,playsInline:!0},T,{onTimeUpdate:G}),c.a.createElement("source",{src:S})),te&&c.a.createElement("i",{className:"icon-large-play"}),D&&c.a.createElement("div",{className:"media-loading "+F},c.a.createElement(ia.a,{progress:R,onClick:P?K:void 0})),ae&&c.a.createElement("i",{className:"icon-download"}),A?c.a.createElement("span",{className:"message-upload-progress"},"..."):c.a.createElement("div",{className:"message-media-duration"},O.isGif?"GIF":Object(x.e)(Math.max(_-H,0))))},ga=a(18);a(224);var fa=Object(s.h)((e,{contact:t})=>({user:Object(r.Hb)(e,t.userId)}),(e,t)=>Object(d.l)(t,["openUserInfo"]))(({contact:e,user:t,openUserInfo:a})=>{const{firstName:s,lastName:n,phoneNumber:o,userId:r}=e,i=Object(c.m)(()=>{a({id:r})},[a,r]);return c.a.createElement("div",{className:Object(Z.a)("Contact",Boolean(r)&&"interactive"),onClick:r?i:void 0},c.a.createElement(_t.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(ga.c)(o))))}),pa=a(46);var Ia=Object(c.h)(({id:e,options:t,selected:a=[],disabled:s,round:n,loadingOptions:o,onChange:r})=>{const[i,l]=Object(c.r)([]),d=Object(c.m)(e=>{const{value:t,checked:a}=e.currentTarget;let s;s=a?[...i,t]:i.filter(e=>e!==t),l(s),r(s)},[r,i]);return c.a.createElement("div",{id:e,className:"radio-group"},t.map(e=>c.a.createElement(pa.a,{label:e.label,subLabel:e.subLabel,value:e.value,checked:-1!==a.indexOf(e.value),disabled:s,round:n,isLoading:o?-1!==o.indexOf(e.value):void 0,onChange:d})))}),va=a(126),ya=a(180);a(227);function Ca(e,t){return t>0?(e/t*100).toFixed():0}var wa=({answer:e,voteResults:t,totalVoters:a,maxVotersCount:s,correctResults:n,shouldAnimate:o})=>{const r=t&&t.find(t=>t.option===e.option),i=0===n.length||-1!==n.indexOf(e.option),l=n.length>0&&i||r&&r.isChosen,d=r?Ca(r.votersCount,a||0):0,[b,u]=Object(c.r)(o?0:d),m=Object(c.q)(null),h=r?Ca(r.votersCount,s||0):0,O=b<d;if(Object(c.n)(()=>{o&&u(d)},[o,d]),Object(c.n)(()=>{const e=m.current;if(e&&o){const t=e.firstElementChild,a=O?"":"stroke-dasharray: 100% 200%; stroke-dashoffset: -44";t?t.setAttribute("style",a):e.innerHTML=`\n <svg class="poll-line" xmlns="http://www.w3.org/2000/svg" style="${a}">\n <path d="M4.47 5.33v13.6a9 9 0 009 9h13"/>\n </svg>`}},[O,o]),!t||!r)return;const j=`width: ${h}%; transform:scaleX(${O?0:1})`;return c.a.createElement("div",{className:"PollOption",dir:"ltr"},c.a.createElement("div",{className:"poll-option-share "+("100"===d?"limit-width":"")},d,"%",l&&c.a.createElement("span",{className:Object(Z.a)("poll-option-chosen",!i&&"wrong",o&&"animate")},c.a.createElement("i",{className:i?"icon-check":"icon-close"}))),c.a.createElement("div",{className:"poll-option-right"},c.a.createElement("div",{className:"poll-option-text",dir:"auto"},Object(ct.a)(e.text)),c.a.createElement("div",{className:Object(Z.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(228);var Ea=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:o,openPollResults:r,serverTimeOffset:i})=>{const{id:l,chatId:d}=e,{summary:b,results:u}=t,[m,h]=Object(c.r)(!1),[O,j]=Object(c.r)([]),[g,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:w,totalVoters:E}=u,M=w&&w.some(e=>e.isChosen),S=!b.closed&&!M,k=!S&&b.isPublic&&Number(u.totalVoters)>0,N=S&&b.multipleChoice,T=w?Math.max(...w.map(e=>e.votersCount)):E,P=w?w.reduce((e,t)=>(t.isCorrect&&e.push(t.option),e),[]):[],A=b.answers.map(e=>({label:e.text,value:e.option,hidden:Boolean(b.quiz&&b.closePeriod&&v<=0)}));Object(c.n)(()=>{m&&t.results.results&&t.results.results.some(e=>e.isChosen)&&h(!1)},[m,t.results.results]),Object(c.n)(()=>{v>0&&setTimeout(()=>y(v-1),1e3);const e=C.current;if(e){const t=12*Math.PI,a=e.lastElementChild,s=e.firstElementChild;if(v<=5&&e.classList.add("hurry-up"),a&&s){const e=(b.closePeriod-v)/b.closePeriod*t;s.textContent=Object(x.e)(v),a.firstElementChild.setAttribute("stroke-dashoffset","-"+e)}else e.innerHTML=`\n <span>${Object(x.e)(v)}</span>\n <svg width="16px" height="16px">\n <circle cx="8" cy="8" r="6" class="poll-countdown-progress" transform="rotate(-90, 8, 8)"\n stroke-dasharray="${t} ${t}"\n stroke-dashoffset="0"\n />\n </svg>`}},[v,b.closePeriod]),Object(c.n)(()=>{b.quiz&&(v<=0||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),o([e])},[o]),D=Object(c.m)(e=>{j(e)},[]),F=Object(c.m)(()=>{h(!0),I(!0),o(O)},[o,O]),B=Object(c.m)(()=>{r({chatId:d,messageId:l})},[d,l,r]),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 q=Object(oe.a)();return c.a.createElement("div",{className:"Poll",dir:q.isRtl?"auto":"ltr"},g&&t.results.solution&&c.a.createElement(ya.a,{message:Object(St.b)(t.results.solution,t.results.solutionEntities),duration:5e3,onDismiss:H,containerId:"#middle-column-portals"}),c.a.createElement("div",{className:"poll-question"},Object(ct.a)(b.question)),c.a.createElement("div",{className:"poll-type"},q(function(e){if(void 0===e.isPublic)return" ";if(e.quiz)return e.isPublic?"QuizPoll":"AnonymousQuizPoll";if(e.closed)return"FinalResults";return e.isPublic?"PublicPoll":"AnonymousPoll"}(b)),R.length>0&&c.a.createElement("div",{className:"poll-recent-voters"},R.map(e=>c.a.createElement(_t.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(de.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(Ia,{options:A,onChange:D,disabled:e.isScheduled||m,loadingOptions:m?O:void 0,round:!0}):c.a.createElement(va.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(wa,{key:e.option,shouldAnimate:p,answer:e,voteResults:w,totalVoters:E,maxVotersCount:T,correctResults:P})}))),!k&&!N&&c.a.createElement("div",{className:"poll-voters-count"},function(e,t,a){if(!a)return e(t?"Chat.Quiz.TotalVotesEmpty":"Chat.Poll.TotalVotesResultEmpty");return e(t?"Answer":"Vote",a,"i")}(q,b.quiz,u.totalVoters)),N&&c.a.createElement(de.a,{isText:!0,disabled:0===O.length,size:"tiny",onClick:F},q("PollSubmitVotes")),k&&c.a.createElement(de.a,{isText:!0,size:"tiny",onClick:B},q("PollViewResults")))})),Ma=a(39),Sa=a(57);a(229);var ka=Object(c.h)(({message:e,observeIntersection:t,noAvatars:a,shouldAutoLoad:s,shouldAutoPlay:n,inPreview:o,lastSyncTime:r,onMediaClick:i,onCancelMediaTransfer:l})=>{const d=Object(h.Q)(e);let b=!1;if(d&&d.photo){const{width:t,height:a}=Tt(e);b=t===a}const u=Object(c.m)(()=>{i()},[i]);if(!d)return;const{siteName:m,url:O,displayUrl:j,title:g,description:f,photo:p,video:I}=d,v=(p||I)&&i&&!b,y=Object(Ma.a)(f,170),C=Object(Z.a)("WebPage",b&&"with-square-photo",!p&&!I&&!o&&"without-media",I&&"with-video");return c.a.createElement("div",{className:C,"data-initial":(m||j)[0],dir:"auto"},p&&!I&&c.a.createElement(la,{message:e,observeIntersection:t,noAvatars:a,shouldAutoLoad:s,size:b?"pictogram":"inline",nonInteractive:!v,onClick:v?u:void 0,onCancelUpload:l}),c.a.createElement("div",{className:"WebPage-text"},c.a.createElement(Sa.a,{className:"site-name",url:O,text:m||j}),!o&&g&&c.a.createElement("p",{className:"site-title"},Object(ct.a)(g)),y&&c.a.createElement("p",{className:"site-description"},Object(ct.a)(y,["emoji","br"]))),!o&&I&&c.a.createElement(ja,{message:e,observeIntersection:t,noAvatars:a,shouldAutoLoad:s,shouldAutoPlay:n,lastSyncTime:r,onClick:v?u:void 0,onCancelUpload:l}))});a(230);var Na=Object(c.h)(({message:e})=>{const t=Object(h.z)(e),{title:a,text:s,description:n,photoUrl:o}=t;return c.a.createElement("div",{className:"Invoice"},a&&c.a.createElement("p",{className:"title"},Object(ct.a)(a)),s&&c.a.createElement("p",null,Object(ct.a)(s,["emoji","br"])),c.a.createElement("div",{className:"description "+(o?"has-image":"")},o&&c.a.createElement("img",{className:"invoice-image",src:o,alt:""}),n&&c.a.createElement("p",{className:"description-text"},Object(ct.a)(n,["emoji","br"]))))});function Ta(e){return Object(c.h)(Object(s.h)((e,t)=>{const{message:a}=t;return{isInSelectMode:Object(r.S)(e),isSelected:Object(r.V)(e,a.id)}},(e,t)=>Object(d.l)(t,["toggleMessageSelection"]))(t=>{const{isInSelectMode:a,isSelected:s,message:n,toggleMessageSelection:o,dimensions:r}=t,i=Object(c.m)(e=>{e.stopPropagation(),o({messageId:n.id,withShift:e&&e.shiftKey})},[o,n]),l=Object(c.p)(()=>({...t,isInSelectMode:a,isSelected:s,dimensions:{...t.dimensions,x:0,y:0},onClick:a?void 0:t.onClick}),[t,a,s]);return c.a.createElement("div",{className:Object(Z.a)("album-item-select-wrapper",s&&"is-selected"),style:r?`left: ${r.x}px; top: ${r.y}px;`:"",onClick:a?i:void 0},a&&c.a.createElement("div",{className:"message-select-control"},s&&c.a.createElement("i",{className:"icon-select"})),c.a.createElement(e,l))}))}a(231);const Pa=Ta(la),Aa=Ta(ja);var xa=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:o,isOwn:r,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.v)(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&&(r?b===u-1:Boolean(I&Lt&&I&Rt));return c.a.createElement(Pa,{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(Aa,{id:"album-media-"+e.id,message:e,observeIntersection:t,shouldAutoLoad:a,shouldAutoPlay:s,uploadProgress:f,lastSyncTime:o,dimensions:p,onClick:l,onCancelUpload:m})})))});a(232);function Ra(){return(Ra=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var s in a)Object.prototype.hasOwnProperty.call(a,s)&&(e[s]=a[s])}return e}).apply(this,arguments)}let La;var Da=({message:e,observeIntersection:t,shouldAutoLoad:a,shouldAutoPlay:s,lastSyncTime:n})=>{const o=Object(c.q)(null),r=Object(c.q)(null),i=Object(c.q)(null),l=e.content.video,d=Object(vt.b)(o,t),[b,u]=Object(c.r)(a&&s),m=Boolean(b&&d&&n),{mediaData:O,downloadProgress:j}=Object(sa.a)(Object(h.D)(e,"inline"),!m,Object(h.C)(e,"inline"),n),g=ca(e,O),{isBuffered:f,bufferingHandlers:p}=Object(da.a)(),I=b&&!f,v=!1===Object(oa.a)(b),{shouldRender:y,transitionClassNames:C}=Object(ee.a)(I||!f,void 0,v),{shouldRenderThumb:w,transitionClassNames:E}=Object(Xt.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=r.current,n=s.firstElementChild;n?n.firstElementChild.setAttribute("stroke-dashoffset",t.toString()):s.innerHTML=`<svg width="200px" height="200px">\n <circle cx="100" cy="100" r="94" class="progress-circle" transform="rotate(-90, 100, 100)"\n stroke-dasharray="${e} ${e}"\n stroke-dashoffset="${e}"\n />\n </svg>`,N(a.currentTime/a.duration)},[M,k]);const T=Boolean(O&&d),P=()=>{S(!1),N(0),Object(ba.a)(i.current),requestAnimationFrame(()=>{r.current.innerHTML=""})},A=(R=P,()=>{La&&La(),La=R});var R;Object(c.n)(()=>{i.current&&(T?Object(ba.a)(i.current):i.current.pause())},[T]),ua(i,T),ha(i,Boolean(O)),Object(ma.a)(i,[O]);const L=Object(c.m)(()=>{if(!O)return void u(e=>!e);const e=i.current;M?e.paused?Object(ba.a)(e):e.pause():(A(),e.currentTime=0,S(!0))},[A,M,O]),D=Object(c.m)(e=>{const t=e.currentTarget;N(t.currentTime/t.duration)},[]),F=Object(Z.a)("full-media",E);return c.a.createElement("div",{ref:o,className:"RoundVideo media-inner",onClick:L},(w||O)&&c.a.createElement("div",{className:"thumbnail-wrapper"},c.a.createElement("canvas",{ref:g,className:"thumbnail",style:`width: ${nt.e}px; height: ${nt.e}px`})),O&&c.a.createElement("div",{className:"video-wrapper"},c.a.createElement("video",Ra({ref:i,className:F,width:nt.e,height:nt.e,autoPlay:!0,muted:!M,loop:!M,playsInline:!0,onEnded:M?P:void 0},p,{onTimeUpdate:M?D:void 0}),c.a.createElement("source",{src:O}))),c.a.createElement("div",{className:"progress",ref:r}),y&&c.a.createElement("div",{className:"media-loading "+C},c.a.createElement(ia.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(233);var Fa=({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(de.a,{size:"tiny",ripple:!0,disabled:"NOT_SUPPORTED"===e.type,onClick:()=>t({button:e})},e.text,"url"===e.type&&!e.value.match(n.jb)&&c.a.createElement("i",{className:"icon-arrow-right"}))))));a(234);var Ba=Object(c.h)(Object(s.h)((e,{message:t})=>{const{threadId:a,chatId:s}=t.threadInfo,n=Object(r.Db)(e,s,a)||t.threadInfo,{byId:c}=e.users,{byId:o}=e.chats;return{threadInfo:n,usersById:c,chatsById:o}},(e,t)=>Object(d.l)(t,["openChat"]))(({disabled:e,threadInfo:t,usersById:a,chatsById:s,openChat:n})=>{const o=Object(oe.a)(),{threadId:r,chatId:i,messagesCount:l,lastMessageId:d,lastReadInboxMessageId:b,recentReplierIds:u}=t,m=Object(c.m)(()=>{n({id:i,threadId:r})},[n,i,r]);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&&b<d);return c.a.createElement("div",{"data-cnt":Object(Ze.b)(l),className:Object(Z.a)("CommentButton",j&&"has-unread",e&&"disabled"),dir:o.isRtl?"rtl":"ltr",onClick:m},c.a.createElement("i",{className:"icon-comments-sticker"}),(!O||0===O.length)&&c.a.createElement("i",{className:"icon-comments"}),O&&O.length>0&&c.a.createElement("div",{className:"recent-repliers",dir:o.isRtl?"rtl":"ltr"},O.map(e=>c.a.createElement(_t.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?o("Comments",l,"i"):o("LeaveAComment")),c.a.createElement("i",{className:"icon-next"}))}));a(235);function Ua(e){const t=qa(e.currentTarget);t&&t.setAttribute("data-is-document-group-hover","")}function Ha(e){const t=qa(e.currentTarget);t&&t.removeAttribute("data-is-document-group-hover")}function qa(e){let t=e;do{t=t.nextElementSibling}while(t&&!t.classList.contains("last-in-document-group"));return t}var Ga=Object(c.h)(Object(s.h)((e,t)=>{const{focusedMessage:a,forwardMessages:s,lastSyncTime:n}=e,{message:c,album:o,withSenderName:i,withAvatar:l,threadId:d,messageListType:b}=t,{id:u,chatId:m,viaBotId:O,replyToMessageId:j,isOutgoing:g}=c,f=Object(r.f)(e,m),p=Object(r.P)(e,m),I=f&&Object(h.kb)(f),v=!p&&Object(h.fb)(c),y=i||l||v?Object(r.tb)(e,c):void 0,C=Object(r.K)(e,c),w=O?Object(r.Hb)(e,O):void 0,E=d?Object(r.Fb)(e,m,d):void 0,M=c.id===E,S=j===E,k=j&&!S?Object(r.k)(e,m,j):void 0,N=k&&Object(r.tb)(e,k),T=Object(r.Gb)(e,c),P="thread"===b&&(o?o.messages.some(t=>Object(r.U)(e,t)):Object(r.U)(e,c)),{direction:A,noHighlight:x}=P&&a||{},R=s.messageIds&&s.messageIds.includes(u),{query:L}=Object(r.A)(e)||{},D=Object(h.L)(c);let F;return F=o&&o.messages?o.messages.every(({id:t})=>Object(r.V)(e,t)):Object(r.V)(e,u),{theme:Object(r.Bb)(e),forceSenderName:v,sender:y,originSender:C,botSender:w,shouldHideReply:S,isThreadTop:M,replyMessage:k,replyMessageSender:N,...g&&{outgoingStatus:Object(r.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(D),animatedEmoji:D?Object(r.c)(e,D):void 0,isInSelectMode:Object(r.S)(e),isSelected:F,isGroupSelected:!!c.groupedId&&!c.isInAlbum&&Object(r.Q)(e,m,c.groupedId),threadId:d,isPinnedList:"pinned"===b,shouldAutoLoadMedia:f?Object(r.ub)(e,c,f,y):void 0,shouldAutoPlayMedia:Object(r.vb)(e,c),shouldLoopStickers:Object(r.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,noAvatars:o,withAvatar:r,withSenderName:d,noComments:u,appearanceOrder:m,isFirstInGroup:O,isLastInGroup:j,isFirstInDocumentGroup:g,isLastInDocumentGroup:f,isLastInList:p,theme:I,forceSenderName:v,sender:y,originSender:C,botSender:w,isThreadTop:E,shouldHideReply:M,replyMessage:S,replyMessageSender:k,outgoingStatus:N,uploadProgress:T,isFocused:P,focusDirection:A,noFocusHighlight:x,isForwarding:R,isChatWithSelf:L,isChannel:D,lastSyncTime:F,highlight:B,animatedEmoji:U,isInSelectMode:H,isSelected:q,isGroupSelected:G,threadId:_,messageListType:V,isPinnedList:$,shouldAutoLoadMedia:W,shouldAutoPlayMedia:z,shouldLoopStickers:K,focusMessage:Q,openMediaViewer:Y,openAudioPlayer:J,openUserInfo:X,openChat:te,cancelSendingMessage:ae,markMessagesRead:se,sendPollVote:ne,toggleMessageSelection:re,setReplyingToId:ie,openForwardMenu:le,clickInlineButton:be,disableContextMenuHint:ue})=>{const me=Object(c.q)(null),he=Object(c.q)(null),Oe=Object(c.q)(null);Object(vt.c)(he,t);const{isContextMenuOpen:je,contextMenuPosition:ge,handleBeforeContextMenu:fe,handleContextMenu:pe,handleContextMenuClose:Ie,handleContextMenuHide:ve}=Object(Mt.a)(me,!1,!0);Object(c.n)(()=>{je&&ue()},[je,ue]);const ye=m<=0,[Ce,we]=Object(ce.a)(ye);Object(c.n)(()=>{ye||setTimeout(we,10*m)},[m,we,ye]);const{transitionClassNames:Ee}=Object(ee.a)(Ce,void 0,ye,!1),{chatId:Me,id:Se,threadInfo:ke}=e,Ne=Object(h.ub)(e),Te="scheduled"===V||e.isScheduled,Pe=Object(h.vb)(e)&&!M,Ae=Boolean(ke)&&"thread"===V,{forwardInfo:xe,viaBotId:Re}=e,Le=xe&&!L&&!xe.isLinkedChannelPost,De=!!e.groupedId&&!e.isInAlbum,Fe=Boolean(n)&&n.messages.length>1,{text:Be,photo:Ue,video:He,audio:qe,voice:Ge,document:_e,sticker:Ve,contact:$e,poll:We,webPage:ze,invoice:Ke}=Object(h.v)(e),Qe=Object(h.x)(e),Ye=Object(St.a)(e,B,kt(Qe)),Xe=void 0!==ge,Ze=D&&e.adminTitle||xe&&!Le&&xe.adminTitle||void 0,et=Object(c.p)(()=>Ze?qt(Ze):void 0,[Ze]),tt=!(Xe||H||R)&&(!De||f),at=tt&&D&&!Te,st=Boolean(tt&&(xe&&(xe.isChannelPost||L&&!Ne)&&xe.fromMessageId||$)),ot=!xe||!L&&y?y:C,rt=xe?C:y,it=Object(Z.a)("Message message-list-item",O&&"first-in-group",j&&"last-in-group",g&&"first-in-document-group",f&&"last-in-document-group",p&&"last-in-list",Ne&&"own",Boolean(e.views)&&"has-views",e.isEdited&&"was-edited",Pe&&"has-reply",Xe&&"has-menu-open",P&&!x&&"focused",R&&"is-forwarding",e.isDeleting&&"is-deleting",De&&"is-in-document-group",Fe&&"is-album",e.hasUnreadMention&&"has-unread-mention",q&&"is-selected",H&&"is-in-selection-mode",E&&"is-thread-top",Boolean(e.inlineButtons)&&"has-inline-buttons",Ee),lt=function(e,{hasReply:t,customShape:a,isLastInGroup:s,asForwarded:n,hasThread:c,forceSenderName:o,hasComments:r}={}){const{text:i,photo:l,video:d,audio:b,voice:u,document:m,poll:O,webPage:j,contact:g}=Object(h.v)(e),f=["message-content"],p=(l||d)&&!i,I=Boolean(e.viaBotId);return kt(a)?f.push("emoji-only emoji-only-"+a):i&&f.push("text"),a&&(f.push("custom-shape"),d&&d.isRound&&f.push("round"),r&&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||j.video)&&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"),o&&f.push("force-sender-name"),a||(f.push("has-shadow"),(t||n||!p||I||o)&&f.push("has-solid-background"),!s||!l&&p||f.push("has-appendix")),f.join(" ")}(e,{hasReply:Pe,customShape:Qe,isLastInGroup:j,asForwarded:Le,hasThread:Ae,forceSenderName:v,hasComments:e.threadInfo&&e.threadInfo.messagesCount>0}),dt=e.threadInfo&&(!De||f)&&"thread"===V&&!u,bt=lt.includes("has-appendix");Object(Je.a)(Me,Pe?e.replyToMessageId:void 0,S,e.id),Gt(me,Me,P,A,x),Object(c.o)(()=>{Oe.current&&(Oe.current.innerHTML=Ne?'<svg width="9" height="20" xmlns="http://www.w3.org/2000/svg"><defs><filter x="-50%" y="-14.7%" width="200%" height="141.2%" filterUnits="objectBoundingBox" id="a"><feOffset dy="1" in="SourceAlpha" result="shadowOffsetOuter1"/><feGaussianBlur stdDeviation="1" in="shadowOffsetOuter1" result="shadowBlurOuter1"/><feColorMatrix values="0 0 0 0 0.0621962482 0 0 0 0 0.138574144 0 0 0 0 0.185037364 0 0 0 0.15 0" in="shadowBlurOuter1"/></filter></defs><g fill="none" fill-rule="evenodd"><path d="M6 17H0V0c.193 2.84.876 5.767 2.05 8.782.904 2.325 2.446 4.485 4.625 6.48A1 1 0 016 17z" fill="#000" filter="url(#a)"/><path d="M6 17H0V0c.193 2.84.876 5.767 2.05 8.782.904 2.325 2.446 4.485 4.625 6.48A1 1 0 016 17z" fill="#EEFFDE" class="corner"/></g></svg>':'<svg width="9" height="20" xmlns="http://www.w3.org/2000/svg"><defs><filter x="-50%" y="-14.7%" width="200%" height="141.2%" filterUnits="objectBoundingBox" id="a"><feOffset dy="1" in="SourceAlpha" result="shadowOffsetOuter1"/><feGaussianBlur stdDeviation="1" in="shadowOffsetOuter1" result="shadowBlurOuter1"/><feColorMatrix values="0 0 0 0 0.0621962482 0 0 0 0 0.138574144 0 0 0 0 0.185037364 0 0 0 0.15 0" in="shadowBlurOuter1"/></filter></defs><g fill="none" fill-rule="evenodd"><path d="M3 17h6V0c-.193 2.84-.876 5.767-2.05 8.782-.904 2.325-2.446 4.485-4.625 6.48A1 1 0 003 17z" fill="#000" filter="url(#a)"/><path d="M3 17h6V0c-.193 2.84-.876 5.767-2.05 8.782-.904 2.325-2.446 4.485-4.625 6.48A1 1 0 003 17z" fill="#FFF" class="corner"/></g></svg>')},[Ne,bt]);const ut=Object(c.m)(t=>{t.stopPropagation(),re({messageId:Se,groupedId:e.groupedId})},[Se,e.groupedId,re]),mt=Object(c.m)(e=>{const t=Fe&&n&&n.messages?{messageId:Se,childMessageIds:n.messages.map(({id:e})=>e),withShift:e&&e.shiftKey}:{messageId:Se,withShift:e&&e.shiftKey};re(t)},[re,Se,Fe,n]),ht=Object(c.m)(()=>{ie({messageId:Se})},[ie,Se]),Ot=Object(c.m)(e=>{e.stopPropagation()},[]),jt=Object(c.m)(()=>{ot&&(Object(h.mb)(ot.id)?X({id:ot.id}):te({id:ot.id}))},[ot,X,te]),gt=Object(c.m)(()=>{rt&&(Object(h.mb)(rt.id)?X({id:rt.id}):te({id:rt.id}))},[rt,X,te]),ft=Object(c.m)(()=>{w&&X({id:w.id})},[w,X]),pt=Object(c.m)(()=>{Q({chatId:Me,threadId:_,messageId:e.replyToMessageId})},[Q,Me,_,e.replyToMessageId]),It=Object(c.m)(()=>{Y({chatId:Me,threadId:_,messageId:Se,origin:Te?l.h.ScheduledInline:l.h.Inline})},[Me,_,Se,Y,Te]),yt=Object(c.m)(()=>{J({chatId:Me,messageId:Se})},[Me,Se,J]),Ct=Object(c.m)(e=>{Y({chatId:Me,threadId:_,messageId:e,origin:Te?l.h.ScheduledAlbum:l.h.Album})},[Me,_,Y,Te]),wt=Object(c.m)(e=>{const t=e.target;(t.classList.contains("text-content")||t.classList.contains("Message"))&&pe(e)},[pe]),Et=Object(c.m)(()=>{se({messageIds:[Se]})},[Se,se]),Pt=Object(c.m)(()=>{ae({chatId:Me,messageId:Se})},[ae,Me,Se]),At=Object(c.m)(e=>{ne({chatId:Me,messageId:Se,options:e})},[Me,Se,ne]),xt=Object(c.m)(()=>{le({fromChatId:Me,groupedId:e.groupedId})},[le,Me,e.groupedId]),Rt=Object(c.m)(()=>{if(n&&n.messages){const e=n.messages.map(({id:e})=>e);le({fromChatId:Me,messageIds:e})}else le({fromChatId:Me,messageIds:[Se]})},[n,le,Me,Se]),Lt=Object(c.m)(()=>{Q({chatId:Me,threadId:i.MAIN_THREAD_ID,messageId:Se})},[Q,Me,Se]),Dt=Object(c.m)(()=>{Q(De?{chatId:xe.fromChatId,groupedId:e.groupedId,groupedChatId:Me}:{chatId:xe.fromChatId,messageId:xe.fromMessageId})},[Q,xe,e,Me,De]),Ft=Object(oe.a)();let Bt,Ht="",Vt=!1;const Wt=Object(c.p)(()=>Fe?Ut(Ne,Boolean(Le),Boolean(o),n):void 0,[Fe,Ne,Le,o,n]),Yt=Le?28:0;if(Fe||!Ue&&!He)Wt&&(Bt=Math.max(Nt(Boolean(Be),dt),Wt.containerStyle.width),Bt-Wt.containerStyle.width>18&&(Vt=!0));else{let t;Ue?t=Tt(e,o).width:He&&(t=He.isRound?nt.e:Tt(e,o).width),t&&(Bt=Math.max(Nt(Boolean(Be),dt),t),Bt-t>18&&(Vt=!0))}return Bt&&(Ht=`width: ${Bt+Yt}px`),c.a.createElement("div",{ref:me,id:"message"+Se,className:it,style:et?`--meta-safe-author-width: ${et}px`:void 0,"data-message-id":Se,onClick:H?mt:b.b?wt:void 0,onDoubleClick:H?void 0:ht,onMouseDown:H?void 0:fe,onContextMenu:H?void 0:pe,onMouseEnter:De&&!f?Ua:void 0,onMouseLeave:De&&!f?Ha:void 0},c.a.createElement("div",{ref:he,className:"bottom-marker","data-message-id":Se,"data-last-message-id":n?n.messages[n.messages.length-1].id:void 0,"data-has-unread-mention":e.hasUnreadMention}),!De&&c.a.createElement("div",{className:"message-select-control"},q&&c.a.createElement("i",{className:"icon-select"})),f&&c.a.createElement("div",{className:Object(Z.a)("message-select-control group-select",G&&"is-selected"),onClick:ut},G&&c.a.createElement("i",{className:"icon-select"})),r&&function(){const e=ot&&Object(h.mb)(ot.id),t=ot&&e?ot:void 0,a=ot&&!e?ot:void 0,s=!ot&&xe?xe.hiddenUserName:void 0;return c.a.createElement(_t.a,{size:"small",user:t,chat:a,text:s,lastSyncTime:F,onClick:t||a?jt:void 0})}(),c.a.createElement("div",{className:"message-content-wrapper",onClick:H&&De?mt:void 0},c.a.createElement("div",{className:lt,style:Ht,dir:"auto"},Le&&!Qe&&(!De||g)&&c.a.createElement("div",{className:"message-title"},Ft("ForwardedMessage")),function(){const t=Object(Z.a)("content-inner",Le&&!Qe&&"forwarded-message",Pe&&"reply-message",Vt&&"no-media-corners"),r=j&&!Ye&&!Le&&!Ae,i=!ze&&!U&&Ye;return c.a.createElement("div",{className:t,onDoubleClick:Ot,dir:"auto"},function(){if(Qe||!(d&&!Ue&&!He||Le||Re||v)||De&&!g)return;let t,a;rt?(t=Object(h.W)(Ft,rt),Le||(a="color-"+Object(h.Y)(rt))):xe&&xe.hiddenUserName&&(t=xe.hiddenUserName);return c.a.createElement("div",{className:"message-title",dir:"ltr"},t?c.a.createElement("span",{className:Object(Z.a)(rt&&"interactive",a),onClick:rt?gt:void 0,dir:"auto"},Object(ct.a)(t)):w?void 0:" ",w&&c.a.createElement(c.a.Fragment,null,c.a.createElement("span",{className:"via"},Ft("ViaBot")),c.a.createElement("span",{className:"interactive",onClick:ft},Object(ct.a)("@"+w.username))),xe&&xe.isLinkedChannelPost?c.a.createElement("span",{className:"admin-title",dir:"auto"},Ft("DiscussChannel")):e.adminTitle&&!D?c.a.createElement("span",{className:"admin-title",dir:"auto"},e.adminTitle):void 0)}(),Pe&&c.a.createElement(zt,{message:S,sender:k,observeIntersection:a,onClick:pt}),Ve&&c.a.createElement(ta,{message:e,observeIntersection:a,observeIntersectionForPlaying:s,shouldLoop:K,lastSyncTime:F}),U&&c.a.createElement(aa.a,{isInline:!0,sticker:U,observeIntersection:a,lastSyncTime:F,forceLoadPreview:Object(h.tb)(e)}),Fe&&c.a.createElement(xa,{album:n,albumLayout:Wt,observeIntersection:a,shouldAutoLoad:W,shouldAutoPlay:z,isOwn:Ne,hasCustomAppendix:r,lastSyncTime:F,onMediaClick:Ct}),!Fe&&Ue&&c.a.createElement(la,{message:e,observeIntersection:a,noAvatars:o,shouldAutoLoad:W,uploadProgress:T,shouldAffectAppendix:r,onClick:It,onCancelUpload:Pt}),!Fe&&He&&He.isRound&&c.a.createElement(Da,{message:e,observeIntersection:a,shouldAutoLoad:W,shouldAutoPlay:z,lastSyncTime:F}),!Fe&&He&&!He.isRound&&c.a.createElement(ja,{message:e,observeIntersection:a,noAvatars:o,shouldAutoLoad:W,shouldAutoPlay:z,uploadProgress:T,lastSyncTime:F,onClick:It,onCancelUpload:Pt}),(qe||Ge)&&c.a.createElement(Qt.a,{theme:I,message:e,uploadProgress:T,lastSyncTime:F,isSelectable:De,isSelected:q,onPlay:yt,onReadMedia:!Ge||Ne&&!L?void 0:Et,onCancelUpload:Pt}),_e&&c.a.createElement(Kt.a,{message:e,observeIntersection:a,uploadProgress:T,isSelectable:De,isSelected:q,onCancelUpload:Pt}),$e&&c.a.createElement(fa,{contact:$e}),We&&c.a.createElement(Ea,{message:e,poll:We,onSendVote:At}),!U&&Ye&&c.a.createElement("p",{className:"text-content "+(i?"with-meta":""),dir:"auto"},Ye,i&&c.a.createElement(Jt,{message:e,outgoingStatus:N,signature:Ze,onClick:mt})),ze&&c.a.createElement(ka,{message:e,observeIntersection:a,noAvatars:o,shouldAutoLoad:W,shouldAutoPlay:z,lastSyncTime:F,onMediaClick:It,onCancelMediaTransfer:Pt}),Ke&&c.a.createElement(Na,{message:e}))}(),(!De||f)&&!(!ze&&!U&&Ye)&&c.a.createElement(Jt,{message:e,outgoingStatus:N,signature:Ze,onClick:mt}),at?c.a.createElement(de.a,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:Ft("lng_context_forward_msg"),onClick:f?xt:Rt},c.a.createElement("i",{className:"icon-share-filled"})):st?c.a.createElement(de.a,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:"Focus message",onClick:$?Lt:Dt},c.a.createElement("i",{className:"icon-arrow-right"})):void 0,dt&&c.a.createElement(Ba,{message:e,disabled:u}),bt&&c.a.createElement("div",{className:"svg-appendix",ref:Oe})),e.inlineButtons&&c.a.createElement(Fa,{message:e,onClick:be})),ge&&c.a.createElement($t,{isOpen:je,anchor:ge,message:e,album:n,messageListType:V,onClose:Ie,onCloseAnimationEnd:ve}))}));a(236);const _a=b.b?1e3:350,Va=b.k?300:500,$a=Object(g.a)(e=>e(),200,!1);var Wa=Object(c.h)(Object(s.h)((e,{chatId:t,threadId:a,type:s})=>{const n=Object(r.f)(e,t);if(!n)return{};const c=Object(r.x)(e,t,a,s),o="scheduled"===s?Object(r.qb)(e,t):Object(r.m)(e,t),l=Object(r.Fb)(e,t,a);if(a!==i.MAIN_THREAD_ID&&!(o&&l&&o[l]))return{};const{isRestricted:d,restrictionReason:b,lastMessage:u}=n,m=Object(r.I)(e,t),O=a===i.MAIN_THREAD_ID&&!c&&!n.unreadCount&&!m&&u&&!u.groupedId;let j;if(Object(r.L)(e,t)){const a=Object(r.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(r.P)(e,t),messageIds:c,messagesById:o,firstUnreadId:Object(r.H)(e,t,a),isViewportNewest:"thread"!==s||Object(r.X)(e,t,a),threadFirstMessageId:Object(r.G)(e,t,a),focusingId:m,isSelectModeActive:Object(r.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:o,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:w,focusingId:E,isSelectModeActive:M,animationLevel:S,loadViewportMessages:k,markMessageListRead:N,markMessagesRead:T,setScrollOffset:P,lastMessage:A,botDescription:R,threadTopMessageId:L,hasLinkedChat:D,openHistoryCalendar:F})=>{const B=Object(c.q)(null),U=Object(c.q)("thread"===a&&Object(r.rb)(Object(s.e)(),e,t)||0),H=Object(c.q)(),q=Object(c.q)(),G=Object(c.q)(),_=Object(c.q)(),V=Object(c.q)(),$=Object(c.q)(),W=Object(c.q)(!1),z=Object(c.q)(Boolean(A)),[K,Q]=Object(c.r)(),[Y,J]=Object(c.r)(Boolean(E)),ee=Boolean(f);Object(pe.a)(()=>{ee&&Object(g.e)(()=>{z.current=!1})},[ee]),Object(pe.a)(()=>{V.current=I,_.current||(_.current=I)},[I]);const{observe:ae}=Object(vt.a)({rootRef:B,throttleMs:_a,margin:Va}),{observe:se,freeze:ne,unfreeze:ce}=Object(vt.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,o=Number(c.lastMessageId||c.messageId);o>t&&(t=o),c.hasUnreadMention&&s.push(o)}),V.current&&t>=V.current&&N({maxId:t}),s.length&&T({messageIds:s})});Object(te.a)(ne,ce),Object(pe.a)(()=>{$.current=E},[E]);const{observe:re}=Object(vt.a)({rootRef:B,throttleMs:_a});Object(c.n)(()=>{E?J(!0):setTimeout(()=>{J(!1)},200)},[E]);const ie=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]).filter(Boolean);return It(Object(d.k)(t,["date","id"]),_.current)},[f,p,y,L]),[le,de,be]=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:ue,updateStickyDates:me}=yt(),he=Object(c.m)(()=>{if(W.current)return void(W.current=!1);const s=B.current;$.current||me(s,o),$a(()=>{Object(g.b)(()=>{s.parentElement&&(U.current=s.scrollHeight-s.scrollTop,"thread"===a&&P({chatId:e,threadId:t,scrollOffset:U.current}))})})},[me,o,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:Oe}=ze();Object(c.n)(()=>{B.current.dataset.normalHeight=String(B.current.offsetHeight)},[Oe]),Object(c.n)(()=>{if(!be||!u||C||E)return;const e=B.current;(!f||f.length<n.V/2&&e.firstElementChild.clientHeight<=e.offsetHeight)&&be()},[u,f,be,E,C]),Object(pe.a)(()=>{if(!f||!G.current)return;const e=G.current.filter(e=>f.includes(Number(e.dataset.messageId))),t=e[1]||e[0];t&&(H.current=t.id,q.current=t.getBoundingClientRect().top)},[f,v,K,o]),Object(ft.a)(([e,t,a])=>{const s=B.current;if(G.current=Array.from(s.querySelectorAll(".message-list-item")),!s.offsetParent)return;const c=v&&f&&f.length<n.V/2&&!s.parentElement.classList.contains("force-messages-scroll")&&s.firstElementChild.clientHeight<=2*s.offsetHeight;c&&(s.parentElement.classList.add("force-messages-scroll"),setTimeout(()=>{s.parentElement&&s.parentElement.classList.remove("force-messages-scroll")},1e3));const{scrollTop:r,scrollHeight:i,offsetHeight:l}=s,d=U.current,b=G.current[G.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(wt.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(wt.b)())return;h=i-l}else if(y){h=r+(y.getBoundingClientRect().top-(q.current||0))}else h=C?Math.min(C.offsetTop-(o?60:10),i-d):i-d;Object(Ct.a)(s,h),$.current||(W.current=!0,Object(g.b)(()=>{W.current=!1})),U.current=Math.max(i-h,l)},[f,v,K,o]),Object(c.n)(()=>{(!S||S>0)&&Object(X.b)(200+n.c)},[S,M]);const je=Object(oe.a)(),ge=Boolean(e&&Object(h.mb)(e)),fe=Boolean(!ge&&!m||j),Ie=Boolean(!fe||m),ve=Object(Z.a)("MessageList custom-scroll",Ie&&"no-avatars",!O&&"no-composer","pinned"===a&&"type-pinned",M&&"select-mode-active",Y&&"has-focusing",ue&&"scrolled");return c.a.createElement("div",{ref:B,className:ve,onScroll:he},C?c.a.createElement("div",{className:"empty"},c.a.createElement("span",null,w?w.text:"This is a private "+(m?"channel":"chat"))):R?c.a.createElement("div",{className:"empty rich"},c.a.createElement("span",null,Object(ct.a)(je(R),["br","emoji","links"]))):f&&!ie?c.a.createElement("div",{className:"empty"},c.a.createElement("span",null,je("NoMessages"))):f&&ie||A?c.a.createElement(Et,{containerRef:B,className:"messages-container",messageIds:f||[A.id],loadMoreForwards:de,loadMoreBackwards:le,isViewportNewest:v,firstUnreadId:I,onFabToggle:i,onNotchToggle:b},function(e,t,a,s,o,r,i,l,b,u,m,O,j,g,f,p,I){const v=c.a.createElement("div",{className:Object(Z.a)("unread-divider","local-action-message"),key:"unread-messages"},c.a.createElement("span",null,e("UnreadMessages"))),y=p?0:t.reduce((e,t)=>e+Object(d.h)(t.senderGroups).length,0);let C=0;const w=t.map((t,j,p)=>{const w=t.senderGroups.map((t,n,f)=>{if(1===t.length&&!pt(t[0])&&Object(h.eb)(t[0])){const e=t[0],s=n===f.length-1&&j===p.length-1;return Object(d.e)([e.id===b.current&&v,c.a.createElement(Wt,{key:e.id,message:e,observeIntersection:a,appearanceOrder:y-++C,isLastInList:s})])}let I;return Object(d.h)(t.map((w,E)=>{const M=pt(w)?w.mainMessage:w,S=pt(w)?w:void 0,k=Object(h.ub)(M),N=pt(w),T=t[E+1];M.previousLocalId&&l.current==="message"+M.previousLocalId&&(l.current="message"+M.id);const P=!N&&M.groupedId?M.groupedId:void 0,A=T&&!pt(T)?T.groupedId:void 0,x={isFirstInGroup:0===E,isLastInGroup:E===t.length-1,isFirstInDocumentGroup:Boolean(P&&P!==I),isLastInDocumentGroup:Boolean(P&&P!==A),isLastInList:E===t.length-1&&n===f.length-1&&j===p.length-1};I=P;const R=Object(h.F)(M),L="scheduled"!==m?R:`${M.date}_${R}`;return Object(d.e)([M.id===b.current?v:void 0,c.a.createElement(Ga,{key:L,message:M,observeIntersectionForBottom:a,observeIntersectionForMedia:s,observeIntersectionForAnimatedStickers:o,album:S,noAvatars:i,withAvatar:x.isLastInGroup&&r&&!k&&!(M.id===O),withSenderName:x.isFirstInGroup&&r&&!k,threadId:u,messageListType:m,noComments:!1===g,appearanceOrder:y-++C,isFirstInGroup:x.isFirstInGroup,isLastInGroup:x.isLastInGroup,isFirstInDocumentGroup:x.isFirstInDocumentGroup,isLastInDocumentGroup:x.isLastInDocumentGroup,isLastInList:x.isLastInList}),M.id===O&&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(Z.a)("sticky-date",!f&&"interactive"),key:"date-header",onClick:f?void 0:()=>I({selectedAt:t.datetime})},c.a.createElement("span",{dir:"auto"},f&&t.originalDate===n.mb&&e("MessageScheduledUntilOnline"),f&&t.originalDate!==n.mb&&e("MessageScheduledOn",Object(x.c)(e,t.datetime,void 0,!0)),!f&&Object(x.c)(e,t.datetime))),Object(d.h)(w))});return Object(d.h)(w)}(je,ie||It([A]),se,ae,re,fe,Ie,H,_,t,a,L,0,D,!!ie&&"scheduled"===a,!ie||!z.current,F)):c.a.createElement(Se.a,{color:"white"}))}));a(237);var za=Object(c.h)(Object(s.h)(e=>{const t=Object(r.y)(e);if(!t)return{};const{chatId:a,threadId:s,type:n}=t,c=Object(r.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 o=Object(oe.a)(),r=Object(c.q)(null),i=Object(c.m)(()=>{if(e)if("thread"===a)n();else{const e=r.current.parentElement.querySelector(".MessageList"),t=e.querySelectorAll(".message-list-item"),a=t[t.length-1];if(!a)return;Object(wt.a)(e,a,"end",20)}},[e,a,n]),l=Object(Z.a)("ScrollDownButton",e&&"revealed",!t&&"no-composer");return c.a.createElement("div",{ref:r,className:l},c.a.createElement("div",{className:"ScrollDownButton-inner"},c.a.createElement(de.a,{color:"secondary",round:!0,onClick:i,ariaLabel:o("AccDescrPageDown")},c.a.createElement("i",{className:"icon-arrow-down"})),Boolean(s)&&c.a.createElement("div",{className:"unread-count"},Object(Ze.b)(s))))})),Ka=a(129),Qa=a(137);async function Ya(e,t,a,s){const n=URL.createObjectURL(t),{type:c,size:o}=t;let r,i;if(c.startsWith("image/"))if(a){const a=await Object($e.g)(n),{width:o,height:i}=a;if(o>1280||i>1280||"image/jpeg"!==c){const c=await function(e){return new Promise(t=>{const a=document.createElement("canvas"),s=a.getContext("2d");let{width:n,height:c}=e;(n>1280||c>1280)&&(n>=c?(c*=1280/n,n=1280):(n*=1280/c,c=1280)),a.width=n,a.height=c,s.drawImage(e,0,0,e.width,e.height,0,0,n,c),a.toBlob(t,"image/jpeg",100)})}(a);return c?(URL.revokeObjectURL(n),Ya(e,c,!0,s)):Ya(e,t,!1,s)}r={width:o,height:i}}else i=n;else if(c.startsWith("video/")){if(o<10485760){const{videoWidth:e,videoHeight:t,duration:a}=await Object($e.h)(n);r={width:e,height:t,duration:a}}i=await Object($e.c)(n)}return{blobUrl:n,filename:e,mimeType:c,size:o,quick:r,previewBlobUrl:i,...s}}var Ja=a(181),Xa=a.p+"c0155344d336103c2b6a0b28cc510750.js";const Za={encoderPath:Xa,reuseWorker:!0},es={type:"audio/ogg"};let ts,as,ss;async function ns(){return ts||(ts=a.e(10).then(a.t.bind(null,318,7)),as=(await ts).default,ss=new as(Za)),ts}async function cs(e){await async function(){await ns(),await ss.start()}();const t=Date.now();let a;const s=[],n=[];ss.ondataavailable=e=>{s.push(e)};const c=function(e,t){const a=e.sourceNode,s=a.context.createAnalyser();s.fftSize=64,a.connect(s);const n=s.frequencyBinCount,c=new Uint8Array(n);let o=!1;return function e(){if(o)return;s.getByteFrequencyData(c);const a=c.reduce((e,t)=>e+t,0),r=a/n/255;t(r<.1?0:r),requestAnimationFrame(e)}(),()=>{o=!0}}(ss,t=>{n.push(255*t),e(t)});return{stop:()=>new Promise((e,o)=>{ss.onstop=()=>{e({blob:new Blob(s,es),duration:Math.round(((a||Date.now())-t)/1e3),waveform:n})},ss.onerror=o;const r=Math.max(0,t+1e3-Date.now());setTimeout(()=>{ss.stop(),c()},r)}),pause:()=>{const e=Math.max(0,t+1e3-Date.now());setTimeout(()=>{ss.pause(),a=Date.now(),c()},e)}}}const os=["image/png","image/jpeg","image/gif"];function rs(e){const{text:t,entities:a}=e||{};if(!t)return"";const s=Object(St.b)(t,a,void 0,void 0,!0);return Array.isArray(s)?s.join(""):s}let is,ls;var ds=a(64);var bs=a(182),us=a(190);var ms=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Me.a)(Ee.a.Extra,"DeleteMessageModal",!t);return a?c.a.createElement(a,e):void 0});function hs(){return(hs=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var s in a)Object.prototype.hasOwnProperty.call(a,s)&&(e[s]=a[s])}return e}).apply(this,arguments)}let Os,js=!0;var gs=Object(c.h)(({onActivate:e,...t})=>{const a=Object(c.q)(!1),s=Object(c.m)(()=>{if(a.current=!0,js)return js=!1,void e();Os&&(clearTimeout(Os),Os=void 0),Os=window.setTimeout(()=>{a.current&&e()},200)},[e]),n=Object(c.m)(()=>{a.current=!1},[]);return c.a.createElement(de.a,hs({},t,{onMouseEnter:b.m?void 0:s,onMouseLeave:b.m?void 0:n,onClick:b.m?e:void 0}))});var fs=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Me.a)(Ee.a.Extra,"AttachMenu",!t);return a?c.a.createElement(a,e):void 0});var ps=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Me.a)(Ee.a.Extra,"SymbolMenu",!t);return a?c.a.createElement(a,e):void 0});var Is=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Me.a)(Ee.a.Extra,"MentionTooltip",!t);return a?c.a.createElement(a,e):void 0});var vs=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Me.a)(Ee.a.Extra,"CustomSendMenu",!t);return a?c.a.createElement(a,e):void 0});var ys=e=>{const{isOpen:t}=e,a=Object(Me.a)(Ee.a.Extra,"StickerTooltip",!t);return a?c.a.createElement(a,e):void 0},Cs=a(183);var ws=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Me.a)(Ee.a.Extra,"BotKeyboardMenu",!t);return a?c.a.createElement(a,e):void 0}),Es=a(184),Ms=a(118);a(239);var Ss=Object(c.h)(Object(s.h)(e=>{const{chatId:t,threadId:a,type:s}=Object(r.y)(e)||{};if(!t||!a||!s)return{};const{currentUserId:n,forwardMessages:{fromChatId:c,toChatId:o,messageIds:i}}=e,l=Object(r.mb)(e,t,a),d="scheduled"===s?Object(r.E)(e,t):Object(r.C)(e,t,a),b=e.settings.byKey.animationLevel>=1,u=o===t;let m,O;if(l?m=Object(r.k)(e,t,l):d?m=Object(r.D)(e,t,a,s):u&&1===i.length&&(m=Object(r.k)(e,c,i[0])),l&&m){const{forwardInfo:a}=m,s=t===n;a&&(a.isChannelPost||s)&&(O=Object(r.K)(e,m)),O||(O=Object(r.tb)(e,m))}else u&&(O=Object(h.mb)(c)?Object(r.Hb)(e,c):Object(r.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:o,setReplyingToId:r,setEditingId:i,focusMessage:l,exitForwardMode:d})=>{const b=Boolean((e||t)&&a||s&&o),u=Object(Ms.a)([o],o?300:void 0),{shouldRender:m,transitionClassNames:h}=Object(ee.a)(u&&b,void 0,!n,void 0,!n),O=Object(c.m)(()=>{e?r({messageId:void 0}):t?i({messageId:void 0}):o&&d()},[e,t,o,r,i,d]);Object(c.n)(()=>b?Object(se.a)(O):void 0,[b,O]);const j=Object(c.m)(()=>{l({chatId:a.chatId,messageId:a.id})},[l,a]),g=Object(Z.a)("ComposerEmbeddedMessage",h),f=o&&o>1?o+" forwarded messages":void 0;if(m)return c.a.createElement("div",{className:g},c.a.createElement("div",null,c.a.createElement(de.a,{round:!0,color:"translucent",ariaLabel:"Cancel replying",onClick:O},c.a.createElement("i",{className:"icon-close"})),c.a.createElement(zt,{className:"inside-input",message:a,sender:s,customText:f,title:t?"Edit Message":void 0,onClick:j})))}));var ks=Object(c.h)(e=>{const{attachments:t}=e,a=Object(Me.a)(Ee.a.Extra,"AttachmentModal",!t.length);return a?c.a.createElement(a,e):void 0});var Ns=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Me.a)(Ee.a.Extra,"PollModal",!t);return a?c.a.createElement(a,e):void 0});var Ts=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Me.a)(Ee.a.Extra,"DropArea",!t);return a?c.a.createElement(a,e):void 0});a(240);const Ps=new RegExp(n.gb,"i");var As=Object(c.h)(Object(s.h)((e,{chatId:t,threadId:a})=>{const s=Object(r.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:o,loadWebPagePreview:r,clearWebPagePreview:l,toggleMessageWebPage:d})=>{const b=Object(c.p)(()=>{const{text:e,entities:t}=Object(Qa.a)(a),s=t&&t.find(({type:e})=>e===i.ApiMessageEntityTypes.TextUrl);if(s)return s.url;const n=e.match(Ps);return n?n[0]:void 0},[a]);Object(c.n)(()=>{b?r({text:b}):(l(),d({chatId:e,threadId:t}))},[e,d,l,b,r,t]),Object(pe.a)(()=>{l(),d({chatId:e,threadId:t})},[e]);const u=Boolean(n&&a.length&&!o&&!s),{shouldRender:m,transitionClassNames:h}=Object(ee.a)(u),O=Object(Xe.a)(n);if(!m||!O)return;const{photo:j,...g}=O,f={content:{webPage:g}};return c.a.createElement("div",{className:Object(Z.a)("WebPagePreview",h)},c.a.createElement("div",null,c.a.createElement(de.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(ka,{message:f,inPreview:!0})))})),xs=a(122);var Rs=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Me.a)(Ee.a.Extra,"CalendarModal",!t);return a?c.a.createElement(a,e):void 0});var Ls=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Me.a)(Ee.a.Extra,"PaymentModal",!t);return a?c.a.createElement(a,e):void 0});var Ds,Fs=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Me.a)(Ee.a.Extra,"ReceiptModal",!t);return a?c.a.createElement(a,e):void 0});a(241);!function(e){e.Send="send",e.Record="record",e.Edit="edit"}(Ds||(Ds={}));var Bs=Object(c.h)(Object(s.h)((e,{chatId:t,threadId:a,messageListType:s})=>{const n=Object(r.f)(e,t),c=n&&Object(r.o)(e,n),o=n?Object(r.O)(e,n):void 0,l=Object(r.P)(e,t),d=o&&Object(r.bb)(e,t),b=Object(r.ob)(e,t),{language:u}=e.settings.byKey,m=Object(r.F)(e,"en"),O="en"!==u?Object(r.F)(e,u):void 0;return{editingMessage:Object(r.D)(e,t,a,s),connectionState:e.connectionState,draft:Object(r.B)(e,t,a),chat:n,isChatWithBot:o,isChatWithSelf:l,canScheduleUntilOnline:!l&&!o&&n&&c&&Object(h.mb)(t)&&c.status&&Boolean(c.status.wasOnline),isRightColumnShown:Object(r.W)(e),isSelectModeActive:Object(r.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,baseEmojiKeywords:m?m.keywords:void 0,emojiKeywords:O?O.keywords:void 0,serverTimeOffset:e.serverTimeOffset}},(e,t)=>Object(d.l)(t,["sendMessage","editMessage","saveDraft","clearDraft","showDialog","setStickerSearchQuery","setGifSearchQuery","forwardMessages","openPollModal","closePollModal","closePaymentModal","clearReceipt","loadScheduledHistory","openChat","addRecentEmoji","loadEmojiKeywords"]))(({dropAreaState:e,shouldSchedule:t,canScheduleUntilOnline:a,onDropHide:o,editingMessage:r,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:w,isPaymentModalOpen:E,isReceiptModalOpen:M,botKeyboardMessageId:S,withScheduledButton:k,stickersForEmoji:N,groupChatMembers:T,currentUserId:P,usersById:A,lastSyncTime:R,contentToBeScheduled:L,shouldSuggestStickers:D,language:F,baseEmojiKeywords:B,emojiKeywords:U,serverTimeOffset:H,recentEmojis:q,sendMessage:G,editMessage:_,saveDraft:V,clearDraft:$,showDialog:W,setStickerSearchQuery:z,setGifSearchQuery:K,forwardMessages:Q,openPollModal:Y,closePollModal:J,loadScheduledHistory:X,closePaymentModal:ee,openChat:ne,clearReceipt:re,addRecentEmoji:ie,loadEmojiKeywords:le})=>{const be=Object(c.q)(null),[ue,me]=Object(c.r)(""),he=Object(c.q)(),Oe=Object(oa.a)(e),[ge,fe,pe]=Object(ce.a)(),[Ie,ve]=Object(c.r)(),ye=Object(c.q)(ue);Object(c.n)(()=>{ye.current=ue},[ue]),Object(c.n)(()=>{he.current=void 0},[l]),Object(c.n)(()=>{l&&R&&d===i.MAIN_THREAD_ID&&X()},[l,X,R,d]),Object(c.o)(()=>{be.current&&(be.current.innerHTML='<svg width="9" height="20" xmlns="http://www.w3.org/2000/svg"><defs><filter x="-50%" y="-14.7%" width="200%" height="141.2%" filterUnits="objectBoundingBox" id="a"><feOffset dy="1" in="SourceAlpha" result="shadowOffsetOuter1"/><feGaussianBlur stdDeviation="1" in="shadowOffsetOuter1" result="shadowBlurOuter1"/><feColorMatrix values="0 0 0 0 0.0621962482 0 0 0 0 0.138574144 0 0 0 0 0.185037364 0 0 0 0.15 0" in="shadowBlurOuter1"/></filter></defs><g fill="none" fill-rule="evenodd"><path d="M6 17H0V0c.193 2.84.876 5.767 2.05 8.782.904 2.325 2.446 4.485 4.625 6.48A1 1 0 016 17z" fill="#000" filter="url(#a)"/><path d="M6 17H0V0c.193 2.84.876 5.767 2.05 8.782.904 2.325 2.446 4.485 4.625 6.48A1 1 0 016 17z" fill="#FFF" class="corner"/></g></svg>')},[]),Object(c.n)(()=>{L&&(ve(L),fe())},[L,fe]);const[Ce,we]=Object(c.r)([]),[Ee,Me,Se]=Object(ce.a)(),[ke,Ne,Te]=Object(ce.a)(),[Pe,Ae,xe]=Object(ce.a)(),[Re,Le,De]=Object(ce.a)(),[Fe,Be]=Object(ce.a)(),[Ue,He,qe]=Object(ce.a)(),{startRecordingVoice:Ge,stopRecordingVoice:Ve,pauseRecordingVoice:$e,activeVoiceRecording:We,currentRecordTime:ze,recordButtonRef:Ke,startRecordTimeRef:Qe}=(()=>{const e=Object(c.q)(null),[t,a]=Object(c.r)(),s=Object(c.q)(),[n,o]=Object(c.r)();Object(c.n)(()=>{b.e&&ns()},[]);const r=Object(c.m)(async()=>{try{const{stop:t,pause:n}=await cs(t=>{e.current&&(s.current&&Date.now()%4==0&&(e.current.style.boxShadow=`0 0 0 ${50*(t||0)}px rgba(0,0,0,.15)`),o(Date.now()))});s.current=Date.now(),o(Date.now()),a({stop:t,pause:n})}catch(e){console.error(e)}},[]),i=Object(c.m)(()=>{if(t){e.current&&(e.current.style.boxShadow="none");try{return t.pause()}catch(e){return void console.error(e)}}},[t]),l=Object(c.m)(()=>{if(t){a(void 0),s.current=void 0,o(void 0),e.current&&(e.current.style.boxShadow="none");try{return t.stop()}catch(e){return void console.error(e)}}},[t]);return Object(c.n)(()=>t?Object(se.a)(l):void 0,[t,l]),{startRecordingVoice:r,pauseRecordingVoice:i,stopRecordingVoice:l,activeVoiceRecording:t,currentRecordTime:n,recordButtonRef:e,startRecordTimeRef:s}})(),Ye=r?Ds.Edit:!b.n||We||ue&&!Ce.length||y?Ds.Send:Ds.Record,Je=!t,{isMentionTooltipOpen:Xe,mentionFilter:Ze,closeMentionTooltip:et,insertMention:tt,mentionFilteredMembers:at}=Object(us.a)(C&&!Ce.length,ue,me,void 0,T,P,A),{isContextMenuOpen:st,handleContextMenu:nt,handleContextMenuClose:ot,handleContextMenuHide:rt}=Object(Mt.a)(Ke,!(Ye===Ds.Send&&Je)),it=Object(c.p)(()=>Object(h.b)(O,f),[O,f]),lt=O&&Object(h.hb)(O),dt=Object(h.j)(O),{isStickerTooltipOpen:bt,closeStickerTooltip:ut}=function(e,t,a){const{loadStickersForEmoji:n,clearStickersForEmoji:o}=Object(s.d)(),r=b.d&&1===Object(ds.a)(t)||!b.d&&Boolean(t.match(/^<img.[^>]*?>$/g)),i=Boolean(a)&&r;return Object(c.n)(()=>{e&&r?n({emoji:t}):!i&&r||o()},[t,r,o,n,e]),{isStickerTooltipOpen:i,closeStickerTooltip:o}}(Boolean(D&&it.canSendStickers&&!Ce.length),ue,N),{isEmojiTooltipOpen:mt,closeEmojiTooltip:ht,filteredEmojis:Ot,insertEmoji:jt}=Object(bs.a)(Boolean(D&&it.canSendStickers&&!Ce.length),ue,q,void 0,me,B,U),gt=Object(c.m)((e,t=n.v)=>{const a=window.getSelection(),s=document.getElementById(t),c=Object(ct.a)(e,["escape_html","emoji_html","br_html"]).join("").replace(/\u200b+/g,"");if(a.rangeCount){const e=a.getRangeAt(0);if(Object(Ja.a)(e,t))return function(e){const t=window.getSelection();if(t&&t.getRangeAt&&t.rangeCount){const a=t.getRangeAt(0);a.deleteContents();const s=a.createContextualFragment(e),n=s.lastChild;a.insertNode(s),n&&(a.setStartAfter(n),a.setEndAfter(n),t.removeAllRanges(),t.addRange(a))}}(c),void s.dispatchEvent(new Event("input",{bubbles:!0}))}me(`${ye.current}${c}`),b.k||requestAnimationFrame(()=>{Object(Ka.a)(s)})},[]),ft=Object(c.m)(()=>{const e=window.getSelection();if(e.rangeCount){const t=e.getRangeAt(0);if(Object(Ja.a)(t,n.v))return void document.execCommand("delete",!1)}me(function(e){const t=document.createElement("div");t.contentEditable="true",t.style.position="absolute",t.style.left="-10000px",t.style.top="-10000px",t.innerHTML=e,document.body.appendChild(t);let a=t.lastChild;if(a.lastChild)for(;a.lastChild;)a=a.lastChild;const s=a.textContent.length,n=document.createRange(),c=window.getSelection();n.setStart(a,s),n.setEnd(a,s),c.removeAllRanges(),c.addRange(n),document.execCommand("delete",!1);const o=t.innerHTML;return document.body.removeChild(t),o}(ye.current))},[]),pt=Object(c.m)(()=>{me(""),we([]),ut(),pe(),ve(void 0),et(),ht(),b.k?setTimeout(()=>xe(),350):xe()},[ut,pe,et,ht,xe]),It=Object(oa.a)(l);Object(c.n)(()=>{It&&l!==It&&(Ve(),pt())},[l,It,pt,Ve]);const vt=((e,t,a,s,o,r)=>{Object(c.n)(()=>{a?(t(rs(a.content.text)),requestAnimationFrame(()=>{const e=document.getElementById(n.v);Object(Ka.a)(e,!0)})):t("")},[a,t]);return Object(c.m)(()=>{const{text:t,entities:n}=Object(Qa.a)(e.current);a&&(t||Object(h.db)(a)?(r({messageId:a.id,text:t,entities:n}),s()):o())},[r,a,e,o,s])})(ye,me,r,pt,Le,_);((e,t,a,s,o,r,i,l,d)=>{const b=Object(c.m)((e,t)=>{o.current.length&&!i?l({chatId:e,threadId:t,draft:Object(Qa.a)(o.current)}):d({chatId:e,threadId:t})},[d,i,o,l]),u=Object(c.p)(()=>Object(g.a)(e=>e(),n.u,!1),[t]),m=Object(oa.a)(t),h=Object(oa.a)(a);Object(c.n)(()=>(is=t,ls=a,()=>{is=void 0,ls=void 0,b(t,a)}),[t,a,b]),Object(c.n)(()=>{t===m&&a===h||e&&(r(rs(e)),requestAnimationFrame(()=>{const e=document.getElementById(n.v);Object(Ka.a)(e,!0)}))},[t,a,e,r,b,m,h]);const O=Object(oa.a)(s);Object(c.n)(()=>{t&&a&&m===t&&h===a&&O!==s&&(s.length?u(()=>{is===t&&ls===a&&b(t,a)}):b(t,a))},[t,s,m,O,h,u,a,b]);const j=Object(c.m)(()=>{t&&a&&b(t,a)},[t,a,b]);Object(te.a)(j),ae(j)})(m,l,d,ue,ye,me,r,V,$),((e,t,a)=>{Object(c.n)(()=>{async function s(s){if(!s.clipboardData)return;const c=document.activeElement;if(c&&![n.v,n.w].includes(c.id))return;const{items:o}=s.clipboardData,r=Array.from(o).find(e=>os.includes(e.type)),i=r&&r.getAsFile(),l=s.clipboardData.getData("text").substring(0,4096);if(i||l){if(s.preventDefault(),i&&!a){const e=await Ya(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])})(gt,we,r);const yt=Object(c.m)(async(e,t)=>{we(await Promise.all(e.map(e=>Ya(e.name,e,t))))},[]),Ct=Object(c.m)(async(e,t)=>{we([...Ce,...await Promise.all(e.map(e=>Ya(e.name,e,t)))])},[Ce]),wt=Object(c.m)(()=>{we([])},[]),Et=Object(c.m)(async(e=!1,t)=>{if("connectionStateReady"!==j)return;let a=Ce;if(We){const e=await Ve();if(e){const{blob:t,duration:s,waveform:n}=e;a=[await Ya("wonderful-voice-message.ogg",t,!1,{voice:{duration:s,waveform:n}})]}}const{text:s,entities:c}=Object(Qa.a)(ye.current);if(a.length||s||y)if(a.length&&s&&s.length>1024){const e=s.length-1024;W({data:{message:"CAPTION_TOO_LONG_PLEASE_REMOVE_CHARACTERS",textParams:{"{EXTRA_CHARS_COUNT}":e,"{PLURAL_S}":e>1?"s":""}}})}else{if(a.length||s){if(dt&&!lt){const e=Math.floor(Date.now()/1e3)+H,t=he.current&&Math.floor(e-he.current),a=dt.nextSendDate&&dt.nextSendDate>e;if(t&&t<dt.seconds||a){const s=a?dt.nextSendDate-e:dt.seconds-t;W({data:{message:`A wait of ${s} seconds is required before sending another message in this chat`,isSlowMode:!0}});return void document.getElementById(n.v).blur()}}G({text:s,entities:c,attachments:a,scheduledAt:t,isSilent:e})}y&&Q(),he.current=Math.floor(Date.now()/1e3)+H,$({chatId:l,localOnly:!0}),requestAnimationFrame(pt)}},[j,Ce,We,y,H,$,l,pt,Ve,W,dt,lt,G,Q]),St=Object(c.m)(e=>{e={...e,isPreloadedGlobally:!0},t?(ve({sticker:e}),fe()):(G({sticker:e}),requestAnimationFrame(pt))},[t,fe,G,pt]),kt=Object(c.m)(e=>{t?(ve({gif:e}),fe()):(G({gif:e}),requestAnimationFrame(pt))},[t,fe,G,pt]),Nt=Object(c.m)(e=>{t?(ve({poll:e}),J(),fe()):(G({poll:e}),J())},[J,fe,G,t]),Tt=Object(c.m)(()=>{t?(ve({isSilent:!0}),fe()):Et(!0)},[Et,fe,t]),Pt=Object(c.m)((e,t=!1)=>{const{isSilent:a,...s}=Ie||{},n=Math.round(Math.max(e.getTime(),Date.now()+6e4)/1e3)+(t?0:H);Ie&&0!==Object.keys(s).length?(G({...Ie,scheduledAt:n}),requestAnimationFrame(pt)):Et(!!a,n),pe()},[pe,Et,pt,Ie,G,H]),At=Object(c.m)(()=>{Pt(new Date(1e3*n.mb),!0)},[Pt]),xt=Object(c.m)(()=>{pe(),ve(void 0)},[pe]),Rt=Object(c.m)(e=>{"stickers"===e?(z({query:""}),K({query:void 0})):(K({query:""}),z({query:void 0}))},[z,K]),Lt=Object(c.m)(()=>{const e=document.getElementById(n.v);b.k&&e===document.activeElement?(e.blur(),setTimeout(()=>{Ae()},100)):Ae()},[Ae]),Dt=Object(c.m)(()=>{ne({id:l,threadId:d,type:"scheduled"})},[ne,l,d]);Object(c.n)(()=>{I&&b.k&&xe()},[I,xe]),Object(c.n)(()=>{v?He():setTimeout(()=>{qe()},200)},[v,qe,He]);const Ft=Object(c.m)(()=>{switch(Ye){case Ds.Send:t?(We&&$e(),fe()):(Et(),requestAnimationFrame(pt));break;case Ds.Record:Ge();break;case Ds.Edit:vt()}},[Ye,pt,t,Ge,vt,We,fe,$e,Et]),Bt=Object(oe.a)(),Ut=Ye===Ds.Record&&!it.canAttachMedia,Ht=Object(oa.a)(r,!0),qt=r||Ht,Gt=new Date;Gt.setSeconds(0),Gt.setMilliseconds(0);const _t=new Date;_t.setFullYear(_t.getFullYear()+1);let Vt="SendMessage";switch(Ye){case Ds.Edit:Vt="Save edited message";break;case Ds.Record:Vt=Ut?"Conversation.DefaultRestrictedMedia":"AccDescrVoiceMessage"}const $t=Object(Z.a)("Composer",!v&&"shown",Ue&&"hover-disabled"),Wt=Object(Z.a)("mobile-symbol-menu-button",Fe?Pe&&"menu-opened":Pe&&"is-loading"),zt=Ye===Ds.Edit?vt:t?fe:Et;return c.a.createElement("div",{className:$t},it.canAttachMedia&&c.a.createElement(xs.a,{containerId:"#middle-column-portals"},c.a.createElement(Ts,{isOpen:e!==_e.a.None,withQuick:[e,Oe].includes(_e.a.QuickFile),onHide:o,onFileSelect:yt})),c.a.createElement(ks,{attachments:Ce,caption:Ce.length?ue:"",canSuggestMembers:C,groupChatMembers:T,currentUserId:P,usersById:A,recentEmojis:q,onCaptionUpdate:me,language:F,emojiKeywords:U,addRecentEmoji:ie,loadEmojiKeywords:le,onSend:t?fe:Et,onFileAppend:Ct,onClear:wt}),c.a.createElement(Ns,{isOpen:Boolean(w),onClear:J,onSend:Nt}),c.a.createElement(Ls,{isOpen:Boolean(E),onClose:ee}),c.a.createElement(Fs,{isOpen:Boolean(M),onClose:re}),qt&&c.a.createElement(ms,{isOpen:Re,isSchedule:"scheduled"===u,onClose:De,message:qt}),c.a.createElement(Is,{isOpen:Xe,filter:Ze,onClose:et,onInsertUserName:tt,filteredChatMembers:at,usersById:A}),c.a.createElement("div",{id:"message-compose"},c.a.createElement("div",{className:"svg-appendix",ref:be}),c.a.createElement(Ss,null),c.a.createElement(As,{chatId:l,threadId:d,messageText:Ce.length?"":ue,disabled:!it.canAttachEmbedLinks}),c.a.createElement("div",{className:"message-input-wrapper"},b.k?c.a.createElement(de.a,{className:Wt,round:!0,color:"translucent",onClick:Pe?xe:Lt,ariaLabel:"Choose emoji, sticker or GIF"},c.a.createElement("i",{className:"icon-smile"}),c.a.createElement("i",{className:"icon-keyboard"}),c.a.createElement(je.a,{color:"gray"})):c.a.createElement(gs,{className:""+(Pe?"activated":""),round:!0,faded:!0,color:"translucent",onActivate:Ae,ariaLabel:"Choose emoji, sticker or GIF"},c.a.createElement("i",{className:"icon-smile"})),c.a.createElement(Es.a,{id:"message-input-text",html:Ce.length?"":ue,placeholder:We&&window.innerWidth<=600?"":Bt("Message"),shouldSetFocus:Pe,shouldSuppressFocus:b.k&&Pe,shouldSuppressTextFormatter:mt||Xe,onUpdate:me,onSend:zt,onSuppressedFocus:xe}),k&&c.a.createElement(de.a,{round:!0,faded:!0,className:"scheduled-button",color:"translucent",onClick:Dt,ariaLabel:"Open scheduled messages"},c.a.createElement("i",{className:"icon-schedule"})),S&&!We&&!r&&c.a.createElement(gs,{className:""+(Ee?"activated":""),round:!0,faded:!0,color:"translucent",onActivate:Me,ariaLabel:"Open bot command keyboard"},c.a.createElement("i",{className:"icon-bot-command"})),!We&&!r&&c.a.createElement(gs,{className:""+(ke?"activated":""),round:!0,faded:!0,color:"translucent",onActivate:Ne,ariaLabel:"Add an attachment"},c.a.createElement("i",{className:"icon-attach"})),We&&ze&&c.a.createElement("span",{className:"recording-state"},Object(x.i)(ze-Qe.current)),c.a.createElement(ys,{isOpen:bt,onStickerSelect:St}),c.a.createElement(Cs.a,{isOpen:mt,emojis:Ot,onClose:ht,onEmojiSelect:jt,addRecentEmoji:ie,loadEmojiKeywords:le,language:F}),c.a.createElement(fs,{isOpen:ke,allowedAttachmentOptions:it,onFileSelect:yt,onPollCreate:Y,onClose:Te}),S&&c.a.createElement(ws,{messageId:S,isOpen:Ee,onClose:Se}),c.a.createElement(ps,{isOpen:Pe,allowedAttachmentOptions:it,onLoad:Be,onClose:xe,onEmojiSelect:gt,onStickerSelect:St,onGifSelect:kt,onRemoveSymbol:ft,onSearchOpen:Rt,addRecentEmoji:ie}))),We&&c.a.createElement(de.a,{round:!0,color:"danger",className:"cancel",onClick:Ve,ariaLabel:"Cancel voice recording"},c.a.createElement("i",{className:"icon-delete"})),c.a.createElement(de.a,{ref:Ke,round:!0,color:"secondary",className:`${Ye} ${We?"recording":""}`,disabled:Ut,ariaLabel:Bt(Vt),onClick:Ft,onContextMenu:Ye===Ds.Send&&Je?nt:void 0},c.a.createElement("i",{className:"icon-send"}),c.a.createElement("i",{className:"icon-microphone-alt"}),c.a.createElement("i",{className:"icon-check"})),Je&&c.a.createElement(vs,{isOpen:st,onSilentSend:p?void 0:Tt,onScheduleSend:t?void 0:fe,onClose:ot,onCloseAnimationEnd:rt}),c.a.createElement(Rs,{isOpen:ge,withTimePicker:!0,selectedAt:Gt.getTime(),maxAt:Object(x.k)(_t),isFutureMode:!0,secondButtonLabel:a?"Send When Online":void 0,onClose:xt,onSubmit:Pt,onSecondButtonClick:a?At:void 0}))}));var Us=Object(c.h)(e=>{const{isActive:t}=e,a=Object(Me.a)(Ee.a.Extra,"MobileSearch",!t,!0);return a?c.a.createElement(a,e):void 0});var Hs=Object(c.h)(e=>{const{isActive:t}=e,a=Object(Me.a)(Ee.a.Extra,"MessageSelectToolbar",!t);return a?c.a.createElement(a,e):void 0});var qs=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Me.a)(Ee.a.Extra,"UnpinAllMessagesModal",!t);return a?c.a.createElement(a,e):void 0});a(242);const Gs=b.k?450+n.c:void 0;function _s(e){return"file"===e.kind&&e.type&&n.l.includes(e.type)}var Vs=Object(c.h)(Object(s.h)(e=>{const t=Object(r.Bb)(e),{isBlurred:a,background:s,backgroundColor:n,patternColor:c}=e.settings.themes[t]||{},o=Object(r.y)(e),{isLeftColumnShown:l,chats:{listIds:d}}=e,u={theme:t,customBackground:s,backgroundColor:n,patternColor:c,isLeftColumnShown:l,isRightColumnShown:Object(r.W)(e),isBackgroundBlurred:a,isMobileSearchActive:Boolean(b.k&&Object(r.A)(e)),isSelectModeActive:Object(r.S)(e),animationLevel:e.settings.byKey.animationLevel};if(!o||!d.active)return u;const{chatId:m,threadId:O,type:j}=o,g=Object(r.f)(e,m),f=Object(r.jb)(e,m),{chatId:p,messageId:I}=e.audioPlayer,v=g&&Object(h.d)(g,O),y=Object(r.L)(e,m),C="pinned"===j;return{...u,chatId:m,threadId:O,messageListType:j,isPrivate:Object(h.mb)(m),canPost:!C&&(!g||v)&&(!y||b.k),isPinnedMessageList:C,messageSendingRestrictionReason:g&&Object(h.K)(g),hasPinnedOrAudioMessage:O!==i.MAIN_THREAD_ID||Boolean(f&&f.length)||Boolean(p&&I),pinnedMessagesCount:f?f.length:0}},(e,t)=>Object(d.l)(t,["openChat","unpinAllMessages","loadUser"]))(({chatId:e,threadId:t,messageListType:a,isPrivate:s,isPinnedMessageList:o,canPost:r,messageSendingRestrictionReason:l,hasPinnedOrAudioMessage:d,pinnedMessagesCount:u,customBackground:m,theme:h,backgroundColor:O,patternColor:j,isLeftColumnShown:g,isRightColumnShown:f,isBackgroundBlurred:p,isMobileSearchActive:I,isSelectModeActive:v,animationLevel:y,openChat:C,unpinAllMessages:w,loadUser:E})=>{const{width:M}=ze(),[S,k]=Object(c.r)(_e.a.None),[N,T]=Object(c.r)(),[P,A]=Object(c.r)(),[x,R]=Object(c.r)(!1),L=d&&(M<n.db||f&&M>n.ab&&M<n.lb||M>=n.Z&&M<n.kb),D=Object(Ke.a)(e,Gs),F=Object(Ke.a)(t,Gs),B=Object(Ke.a)(a,Gs),U=Object(Ke.a)(r,Gs),H=Object(Ke.a)(L,Gs),q=Object(Ke.a)(N,Gs);Object(c.n)(()=>e?Object(se.a)(()=>{C({id:void 0})}):void 0,[e,C]),Object(c.n)(()=>{k(_e.a.None),T(void 0),A(void 0)},[e]),Object(c.n)(()=>{s&&E({userId:e})},[e,s,E]);const G=Object(c.m)(e=>{if(b.m)return;const{items:t}=e.dataTransfer||{},a=t&&Array.from(t).every(_s);k(a?_e.a.QuickFile:_e.a.Document)},[]),_=Object(c.m)(()=>{k(_e.a.None)},[]),V=Object(c.m)(()=>{R(!0)},[]),$=Object(c.m)(()=>{R(!1)},[]),W=Object(c.m)(()=>{w({chatId:e}),$(),C({id:e})},[w,C,$,e]),z=Object(c.m)(()=>{C({id:e})},[C,e]),K=((e,t)=>{const[a,s]=Object(c.r)(t);return Object(c.n)(()=>{t&&(t.startsWith("#")?s(t):Ve.c(n.m,e,Ve.a.Blob).then(e=>{const t=URL.createObjectURL(e);Object($e.g)(t).then(()=>{s(`url(${t})`)})}))},[t,e]),t?a:void 0})(h,m),Q=Object(Z.a)(H&&"has-header-tools",m&&"custom-bg-image",O&&"custom-bg-color",m&&p&&"blurred",b.o?"mask-image-disabled":"mask-image-enabled"),Y=Object(Z.a)("messaging-disabled",!v&&"shown"),{composerHiddenScale:J,toolbarHiddenScale:X,composerTranslateX:ee,toolbarTranslateX:te,unpinHiddenScale:ae,toolbarForUnpinHiddenScale:ce}=Object(c.p)(()=>Qe(M,U),[U,M]),re=Object(oe.a)(),ie=Object(Z.a)("middle-column-footer",!U&&"no-composer",U&&P&&!v&&"with-notch");return c.a.createElement("div",{id:"MiddleColumn",className:Q,style:`\n --composer-hidden-scale: ${J};\n --toolbar-hidden-scale: ${X};\n --unpin-hidden-scale: ${ae};\n --toolbar-unpin-hidden-scale: ${ce};\n --composer-translate-x: ${ee}px;\n --toolbar-translate-x: ${te}px;\n --pattern-color: ${j};\n --theme-background-color:\n ${O||("dark"===h?n.n:n.I)};\n `,onClick:b.l&&g?z:void 0},c.a.createElement("div",{id:"middle-column-bg",style:K?"--custom-background: "+K:void 0}),c.a.createElement("div",{id:"middle-column-portals"}),D&&F&&c.a.createElement(c.a.Fragment,null,c.a.createElement("div",{className:"messages-layout",onDragEnter:U?G:void 0},c.a.createElement(gt,{chatId:D,threadId:F,messageListType:B}),c.a.createElement(ne.a,{name:y===n.e?"slide":"fade",activeKey:"thread"===B&&F===i.MAIN_THREAD_ID?1:2,shouldCleanup:!0},()=>c.a.createElement(c.a.Fragment,null,c.a.createElement(Wa,{key:`${D}-${F}-${B}`,chatId:D,threadId:F,type:B,canPost:U,hasTools:H,onFabToggle:T,onNotchToggle:A}),c.a.createElement("div",{className:ie},U&&c.a.createElement(Bs,{chatId:D,threadId:F,messageListType:B,dropAreaState:S,onDropHide:_}),o&&c.a.createElement("div",{className:"unpin-button-container",dir:re.isRtl?"rtl":void 0},c.a.createElement(de.a,{size:"tiny",fluid:!0,color:"secondary",className:"unpin-all-button",onClick:V},c.a.createElement("i",{className:"icon-unpin"}),c.a.createElement("span",null,re("Chat.Pinned.UnpinAll",u,"i")))),!o&&!U&&l&&c.a.createElement("div",{className:Y},c.a.createElement("div",{className:"messaging-disabled-inner"},c.a.createElement("span",null,l))),c.a.createElement(Hs,{messageListType:B,isActive:v,canPost:U})))),c.a.createElement(za,{isShown:q,canPost:U})),b.k&&c.a.createElement(Us,{isActive:Boolean(I)})),e&&c.a.createElement(qs,{isOpen:x,chatId:e,pinnedMessagesCount:u,onClose:$,onUnpin:W}))}));a(243);const $s=Object(g.a)(e=>e(),200,!1);var Ws;!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"}(Ws||(Ws={}));var zs=Object(c.h)(Object(s.h)((e,{chatId:t,isProfile:a,isManagement:s})=>{const{query:n}=Object(r.A)(e)||{},{query:c}=Object(r.z)(e)||{},{query:o}=Object(r.s)(e)||{},i=t?Object(r.f)(e,t):void 0,l=i&&Object(h.kb)(i);return{canManage:Boolean(!s&&a&&i&&!Object(r.P)(e,i.id)&&(Object(h.mb)(i.id)||(Object(h.hb)(i)||i.isCreator)&&!i.isNotJoined)),isChannel:l,messageSearchQuery:n,stickerSearchQuery:c,gifSearchQuery:o}},(e,t)=>Object(d.l)(t,["setLocalTextSearchQuery","setStickerSearchQuery","setGifSearchQuery","searchTextMessagesLocal","toggleManagement","openHistoryCalendar"]))(({isColumnOpen:e,isProfile:t,isSearch:a,isManagement:s,isStickerSearch:n,isGifSearch:o,isPollResults:r,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 w;const E=Object(c.q)(null),M=Object(c.m)(e=>{f({query:e}),e.length&&$s(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(oe.a)(),A=t?i===l.k.Profile?Ws.Profile:i===l.k.SharedMedia?Ws.SharedMedia:i===l.k.MemberList?Ws.MemberList:-1:a?Ws.Search:r?Ws.PollResults:n?Ws.StickerSearch:o?Ws.GifSearch:s?d===l.g.Initial?Ws.ManageInitial:d===l.g.ChatPrivacyType?Ws.ManageChatPrivacyType:d===l.g.Discussion?Ws.ManageDiscussion:d===l.g.ChannelSubscribers?Ws.ManageChannelSubscribers:d===l.g.GroupPermissions?Ws.ManageGroupPermissions:d===l.g.ChatAdministrators?Ws.ManageChatAdministrators:d===l.g.GroupRemovedUsers?Ws.ManageGroupRemovedUsers:d===l.g.GroupUserPermissionsCreate?Ws.ManageGroupUserPermissionsCreate:d===l.g.GroupUserPermissions?Ws.ManageGroupUserPermissions:d===l.g.GroupRecentActions?Ws.ManageGroupRecentActions:d===l.g.ChatAdminRights?Ws.ManageGroupAdminRights:d===l.g.GroupMembers?Ws.ManageGroupMembers:void 0:void 0,R=null!==(w=Object(Xe.a)(A,!0))&&void 0!==w?w:-1;function L(){if(-1!==R)switch(R){case Ws.PollResults:return c.a.createElement("h3",null,P("PollResults"));case Ws.Search:return c.a.createElement(c.a.Fragment,null,c.a.createElement(be.a,{parentContainerClassName:"RightSearch",value:O,onChange:M}),c.a.createElement(de.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 Ws.ManageInitial:return c.a.createElement("h3",null,P("Edit"));case Ws.ManageChatPrivacyType:return c.a.createElement("h3",null,P(m?"ChannelTypeHeader":"GroupTypeHeader"));case Ws.ManageDiscussion:return c.a.createElement("h3",null,P("Discussion"));case Ws.ManageChatAdministrators:return c.a.createElement("h3",null,P("ChannelAdministrators"));case Ws.ManageGroupRecentActions:return c.a.createElement("h3",null,P("Group.Info.AdminLog"));case Ws.ManageGroupAdminRights:return c.a.createElement("h3",null,P("EditAdminRights"));case Ws.ManageGroupPermissions:return c.a.createElement("h3",null,P("ChannelPermissions"));case Ws.ManageGroupRemovedUsers:return c.a.createElement("h3",null,P("ChannelBlockedUsers"));case Ws.ManageGroupUserPermissionsCreate:return c.a.createElement("h3",null,P("ChannelAddException"));case Ws.ManageGroupUserPermissions:return c.a.createElement("h3",null,P("UserRestrictions"));case Ws.StickerSearch:return c.a.createElement(be.a,{value:j,placeholder:P("SearchStickersHint"),onChange:S});case Ws.GifSearch:return c.a.createElement(be.a,{value:g,placeholder:P("SearchGifsTitle"),onChange:k});case Ws.SharedMedia:return c.a.createElement("h3",null,P("SharedMedia"));case Ws.ManageChannelSubscribers:return c.a.createElement("h3",null,P("ChannelSubscribers"));case Ws.MemberList:case Ws.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(de.a,{round:!0,color:"translucent",size:"smaller",ariaLabel:P("Edit"),onClick:y},c.a.createElement("i",{className:"icon-edit"}))))}}const D=b.k||A===Ws.SharedMedia||A===Ws.MemberList||s,F=Object(Z.a)("animated-close-icon",N&&"no-transition");return Object(c.n)(()=>{E.current.classList.toggle("state-back",D)},[D]),c.a.createElement("div",{className:"RightHeader"},c.a.createElement(de.a,{className:"close-button",round:!0,color:"translucent",size:"smaller",onClick:h,ariaLabel:P(D?"Common.Back":"Common.Close")},c.a.createElement("div",{ref:E,className:F})),c.a.createElement(ne.a,{name:N?"none":"slide-fade",activeKey:R},L))})),Ks=a(127);function Qs(e,t,a,s,o,r,i,l,d,b,u,m=0){const O="members"!==s&&o?o:s,j=Object(c.p)(()=>{if(r&&i)return Object(h.Fb)(r.map(({userId:e})=>e),i,void 0,m)},[r,m,i]),[g,f,p]=function(e,t,a,s){const[c,o]=Object(Ks.a)(a?t:void 0,s,void 0,n.R),r=!c||!s||c[0]===s[0];return[c,o,!r]}(0,t,u,j),[I,v,y]=Ys("media",O,a,u,l,d),[C,w,E]=Ys("documents",O,a,u,l,d),[M,S,k]=Ys("links",O,a,u,l,d),[N,T,P]=Ys("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=w,R=E;break;case"links":A=M,x=S,R=k;break;case"audio":A=N,x=T,R=P}return[O,A,x,R]}function Ys(e,t,a,s,o,r){const i=Object(c.q)();Object(pe.a)(()=>{t===e&&o&&r&&(i.current=Object(h.w)(o,r,e).reverse())},[o,r,t,e]);const[l,d]=Object(Ks.a)(s?a:void 0,i.current,void 0,"media"===e?n.pb:n.X);return[l,d,!(!l||!i.current||l[0]===i.current[0])]}var Js=a(58);const Xs=Object(g.h)(e=>e(),250,!1);let Zs=!1;var en=a(112),tn=a(105);var an=a(132),sn=a(191);a(244);var nn=Object(c.h)(({chat:e,user:t,photo:a,isFirstPhoto:s,isSavedMessages:n,lastSyncTime:o,onClick:r})=>{const l=Object(oe.a)(),d=t&&Object(h.qb)(t);function b(s="big",c){if(a&&!c)return`photo${a.id}?size=c`;let o;return n||d||(t?o=Object(h.e)(t,s):e&&(o=Object(h.e)(e,s))),o}const u=b(),m=Object(ot.a)(u,!1,i.ApiMediaFormat.BlobUrl,o),O=Object(ot.a)(!m&&s?b("normal",!0):void 0,!1,i.ApiMediaFormat.BlobUrl,o),j=Object(sn.a)(!m&&a&&a.thumbnail&&a.thumbnail.dataUri),g=m||O||j,f=Object(oa.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(Ze.c)(e,2):void 0}else if(!g&&e){const t=Object(h.k)(l,e);p=t&&Object(Ze.c)(t,Object(h.mb)(e.id)?2:1)}else p=c.a.createElement("div",{className:"spinner-wrapper"},c.a.createElement(je.a,{color:"white"}));const I=Object(Z.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?r:void 0},f&&g&&f!==g&&c.a.createElement("img",{src:f,className:"prev-avatar-media",alt:"",decoding:"async"}),"string"==typeof p?Object(ct.a)(p,["hq_emoji"]):p)});a(245);var cn=Object(c.h)(Object(s.h)((e,{userId:t,forceShowSelf:a})=>{const{lastSyncTime:s,serverTimeOffset:n}=e,c=Object(r.Hb)(e,t),o=Object(r.f)(e,t),i=!a&&c&&c.isSelf,{animationLevel:l}=e.settings.byKey;return{lastSyncTime:s,user:c,chat:o,isSavedMessages:i,animationLevel:l,serverTimeOffset:n}},(e,t)=>Object(d.l)(t,["loadFullUser","openMediaViewer"]))(({user:e,chat:t,isSavedMessages:a,lastSyncTime:s,animationLevel:n,loadFullUser:o,openMediaViewer:r,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(oe.a)();Object(c.n)(()=>{s&&u&&o({userId:u})},[u,o,s]),function(e,t,a){Object(c.n)(()=>{t.slice(a,a+4).forEach(e=>{ht.c(`photo${e.id}?size=c`)||ht.b(`photo${e.id}?size=c`,i.ApiMediaFormat.BlobUrl)})},[a,t])}(0,j,f);const C=Object(c.m)(()=>{r({avatarOwnerId:u||m,profilePhotoIndex:f,origin:l.h.ProfileAvatar})},[r,u,m,f]),w=Object(c.m)(()=>{I||p(f-1)},[f,I]),E=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(fe.b)(e,{excludedClosestSelector:".navigation",onSwipe:b.m?(e,t)=>{t===fe.a.Right?w():t===fe.a.Left&&E()}:void 0})},[E,w]),!e&&!t)return;function M(){const s=!a&&j&&j.length>0?j[f]:void 0;return c.a.createElement(nn,{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(ne.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:w}),!v&&c.a.createElement("button",{type:"button",className:"navigation next","aria-label":y("Next"),onClick:E})),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(ct.a)(O)),S&&c.a.createElement(an.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 on=Object(c.h)(Object(s.h)((e,{chatOrUserId:t})=>{const{lastSyncTime:a}=e,s=t?Object(r.f)(e,t):void 0,n=Object(h.mb)(t)?Object(r.Hb)(e,t):void 0,c=s&&Object(h.Db)(s,Object(r.eb)(e),Object(r.db)(e));return{lastSyncTime:a,chat:s,user:n,canInviteUsers:s&&(!Object(h.kb)(s)&&!Object(h.zb)(s,"inviteUsers")||Object(h.p)(s,"inviteUsers")),isMuted:c}},(e,t)=>Object(d.l)(t,["loadFullUser","updateChatMutedState","showNotification"]))(({lastSyncTime:e,user:t,chat:a,forceShowSelf:s,canInviteUsers:n,isMuted:o,loadFullUser:r,showNotification:i,updateChatMutedState:l})=>{const{id:d,fullInfo:b,username:u,phoneNumber:m,isSelf:O}=t||{},{id:j,username:g}=a||{},f=Object(oe.a)();Object(c.n)(()=>{e&&d&&r({userId:d})},[r,d,e]);const p=Object(c.m)(()=>{l({chatId:j,isMuted:!o})},[j,o,l]);if(!a||a.isRestricted||O&&!s)return;function I(e,t){Object(w.c)(e),i({message:t+" was copied"})}const v=m&&Object(ga.c)(m),y=Object(h.g)(a),C=0===y.indexOf("http")?y:"http://"+y,E=u||g,M=b&&b.bio||Object(h.f)(a);return c.a.createElement("div",{className:"ChatExtra"},v&&!!v.length&&c.a.createElement(tn.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"))),E&&c.a.createElement(tn.a,{icon:"mention",multiline:!0,narrow:!0,ripple:!0,onClick:()=>I("@"+E,f("Username"))},c.a.createElement("span",{className:"title",dir:"auto"},Object(ct.a)(E)),c.a.createElement("span",{className:"subtitle"},f("Username"))),M&&!!M.length&&c.a.createElement(tn.a,{icon:"info",multiline:!0,narrow:!0,isStatic:!0},c.a.createElement("span",{className:"title",dir:"auto"},Object(ct.a)(M,["br","links","emoji"])),c.a.createElement("span",{className:"subtitle"},f(d?"UserBio":"Info"))),n&&!E&&!!y.length&&c.a.createElement(tn.a,{icon:"mention",multiline:!0,narrow:!0,ripple:!0,onClick:()=>I(y,f("SetUrlPlaceholder"))},c.a.createElement("div",{className:"title"},c.a.createElement(Sa.a,{url:C,className:"title",text:y})),c.a.createElement("span",{className:"subtitle"},f("SetUrlPlaceholder"))),c.a.createElement(tn.a,{icon:"unmute",ripple:!0,onClick:p},c.a.createElement("span",null,f("Notifications")),c.a.createElement(me,{id:"group-notifications",label:d?"Toggle User Notifications":"Toggle Chat Notifications",checked:!o,inactive:!0})))})),rn=a(165),ln=a(185),dn=a(117);a(249);const bn=[{type:"media",title:"SharedMediaTab2"},{type:"documents",title:"SharedFilesTab2"},{type:"links",title:"SharedLinksTab2"},{type:"audio",title:"SharedMusicTab2"}];function un(e){return[`.shared-media-transition > div:only-child > .${e}-list > .scroll-item`,`.shared-media-transition > div.active > .${e}-list > .scroll-item`].join(", ")}var mn=Object(c.h)(Object(s.h)((e,{chatId:t,userId:a})=>{const s=Object(r.f)(e,t),n=Object(r.m)(e,a||t),{currentType:c,resultsByType:o}=Object(r.v)(e)||{},{foundIds:i}=o&&c&&o[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),{theme:Object(r.Bb)(e),isChannel:b,resolvedUserId:j,chatMessages:n,foundIds:i,mediaSearchType:c,hasMembersTab:u,areMembersHidden:O,...u&&m&&{members:m,usersById:l},isRightColumnShown:Object(r.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,theme:s,isChannel:o,resolvedUserId:r,chatMessages:d,foundIds:u,mediaSearchType:m,hasMembersTab:h,areMembersHidden:O,members:j,usersById:g,isRightColumnShown:f,isRestricted:p,lastSyncTime:I,setLocalMediaSearchType:v,loadMoreMembers:y,searchMediaMessagesLocal:C,openMediaViewer:w,openAudioPlayer:E,openUserInfo:M,focusMessage:S,loadProfilePhotos:k,serverTimeOffset:N})=>{const T=Object(c.q)(null),P=Object(c.q)(null),A=Object(oe.a)(),[x,R]=Object(c.r)(0),L=Object(c.p)(()=>[...h?[{type:"members",title:o?"ChannelSubscribers":"GroupMembers"}]:[],...bn],[h,o]),D=L[x].type,[F,B,U,H]=Qs(0,y,C,D,m,j,g,d,u,0,I,N),q=L.findIndex(({type:e})=>e===F),{handleScroll:G}=function(e,t,a,s){Object(Js.a)(([a])=>{if(a&&a!==t){const a=e.current,n=a.querySelector(".TabList");a.scrollTop<n.offsetTop&&(s("members"===t?l.k.MemberList:l.k.SharedMedia),Zs=!0,Object(wt.a)(a,n,"start",void 0,void 0,void 0,300),setTimeout(()=>{Zs=!1},350))}},[t,s]),Object(Js.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||(Zs=!0,Object(wt.a)(n,n.firstElementChild,"start",void 0,2*n.offsetHeight),setTimeout(()=>{Zs=!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)(()=>{Zs||n()},[n,t]),{handleScroll:Object(c.m)(()=>{Zs||Xs(n)},[n])}}(T,D,t,a),{applyTransitionFix:_,releaseTransitionFix:V}=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])}}(T),[$,W]=(()=>{const[e,t]=Object(c.r)(!1);return[e,Object(c.m)(()=>{t(e=>!e)},[])]})(),z=Object(c.m)(()=>{V(),W()},[V,W]);Object(c.n)(()=>{v({mediaType:D})},[v,D]);const K=r||e;Object(c.n)(()=>{I&&k({profileId:K})},[k,K,I]);const Q=Object(c.m)(e=>{w({chatId:K,threadId:i.MAIN_THREAD_ID,messageId:e,origin:l.h.SharedMedia})},[K,w]),Y=Object(c.m)(e=>{E({chatId:K,messageId:e})},[K,E]),J=Object(c.m)(e=>{M({id:e})},[M]),X=Object(c.m)(e=>{S({chatId:K,messageId:e})},[K,S]);let Z;Object(c.n)(()=>{if(P.current&&b.m)return Object(fe.b)(P.current,{onSwipe:(e,t)=>{t===fe.a.Left?R(Math.min(x+1,L.length-1)):t===fe.a.Right&&R(Math.max(0,x-1))}})},[x,L.length]);const ee="members"===F||!h&&"media"===F;ee?Z=f?0:1e3:B||(Z=n.qb);const te=Object(Ms.a)([e,F],Z);function ae(){if(!B||!te||!d){const e=ee&&B&&!te;return c.a.createElement("div",{className:"content empty-list"},!e&&c.a.createElement(je.a,null))}if(!B.length){let e;switch(F){case"members":e=O?"You have no access to group members list.":"No members found";break;case"documents":e=A("lng_media_file_empty_search");break;case"links":e=A("lng_media_link_empty_search");break;case"audio":e=A("lng_media_song_empty_search");break;default:e=A("SharedMedia.EmptyTitle")}return c.a.createElement("div",{className:"content empty-list"},c.a.createElement(dn.a,{text:e}))}return c.a.createElement("div",{className:`content ${F}-list`,dir:A.isRtl&&"media"===F?"rtl":void 0,teactFastList:!0},"media"===F?B.map(e=>d[e]&&c.a.createElement(rn.a,{key:e,message:d[e],onClick:Q})):"documents"===F?B.map(e=>d[e]&&c.a.createElement(Kt.a,{key:e,message:d[e],withDate:!0,smaller:!0,className:"scroll-item",onDateClick:X})):"links"===F?B.map(e=>d[e]&&c.a.createElement(ln.a,{key:e,message:d[e],onMessageClick:X})):"audio"===F?B.map(e=>d[e]&&c.a.createElement(Qt.a,{key:e,theme:s,message:d[e],target:"sharedMedia",date:d[e].date,lastSyncTime:I,className:"scroll-item",onPlay:Y,onDateClick:X})):"members"===F?B.map((e,t)=>c.a.createElement(tn.a,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item",onClick:()=>J(e)},c.a.createElement(et.a,{userId:e,forceShowSelf:!0}))):void 0)}return c.a.createElement(en.a,{ref:T,className:"Profile custom-scroll",itemSelector:un(F),items:te?B:void 0,cacheBuster:$,sensitiveArea:n.fb,preloadBackwards:te?"members"===F?n.R:n.pb:0,noScrollRestoreOnTop:!0,noFastList:!0,onLoadMore:U,onScroll:G},!H&&function(e,t){return c.a.createElement("div",{className:"profile-info"},c.a.createElement(cn,{userId:t||e,forceShowSelf:t!==e}),c.a.createElement(on,{chatOrUserId:t||e,forceShowSelf:t!==e}))}(e,r),!p&&c.a.createElement("div",{className:"shared-media"},c.a.createElement(ne.a,{ref:P,name:A.isRtl?"slide-reversed":"slide",activeKey:q,renderCount:L.length,shouldRestoreHeight:!0,className:"shared-media-transition",onStart:_,onStop:z},ae),c.a.createElement(ye.a,{big:!0,activeTab:x,tabs:L,onSwitchTab:R})))}));var hn=Object(c.h)(e=>{const t=Object(Me.a)(Ee.a.Extra,"RightSearch");return t?c.a.createElement(t,e):c.a.createElement(Se.a,null)});var On=Object(c.h)(e=>{const t=Object(Me.a)(Ee.a.Extra,"Management");return t?c.a.createElement(t,e):c.a.createElement(Se.a,null)});var jn=Object(c.h)(()=>{const e=Object(Me.a)(Ee.a.Extra,"StickerSearch");return e?c.a.createElement(e,null):c.a.createElement(Se.a,null)});var gn=Object(c.h)(()=>{const e=Object(Me.a)(Ee.a.Extra,"GifSearch");return e?c.a.createElement(e,null):c.a.createElement(Se.a,null)});var fn=Object(c.h)(()=>{const e=Object(Me.a)(Ee.a.Extra,"PollResults");return e?c.a.createElement(e,null):c.a.createElement(Se.a,null)});a(250);const pn=Object.keys(l.l).length/2,In=Object.keys(l.g).length/2;function vn(){const e=document.querySelector(".RightHeader .SearchInput input");e&&e.blur()}var yn=Object(c.h)(Object(s.h)(e=>{const{chatId:t,threadId:a}=Object(r.y)(e)||{},s=Object(r.d)(e);return{contentKey:Object(r.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:o,toggleChatInfo:r,toggleManagement:i,openUserInfo:d,closeLocalTextSearch:b,setStickerSearchQuery:u,setGifSearchQuery:m,closePollResults:h})=>{var O;const{width:j}=ze(),[g,f]=Object(c.r)(l.k.Profile),[p,I]=Object(c.r)(l.g.Initial),[v,y]=Object(c.r)(),[C,w]=Object(c.r)(),E=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),D=null!==(O=Object(Xe.a)(e,!0,!o))&&void 0!==O?O:-1,F=Object(c.m)(()=>{switch(e){case l.l.ChatInfo:if(E){f(l.k.Profile);break}r();break;case l.l.UserInfo:if(E){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),w(void 0);break;case l.g.ChatAdminRights:case l.g.GroupRecentActions:I(l.g.ChatAdministrators)}break;case l.l.Search:vn(),b();break;case l.l.StickerSearch:case l.l.GifSearch:vn(),u({query:void 0}),m({query:void 0});break;case l.l.PollResults:h()}},[e,E,r,d,h,p,i,b,u,m]),B=Object(c.m)((e,t)=>{y(e),w(t)},[]);function U(){if(-1!==D)switch(D){case l.l.ChatInfo:case l.l.UserInfo:return c.a.createElement(mn,{key:s||t,chatId:t,userId:s,profileState:g,onProfileStateChange:f});case l.l.Search:return c.a.createElement(hn,{chatId:t,threadId:a});case l.l.Management:return c.a.createElement(On,{chatId:t,currentScreen:p,isPromotedByCurrentUser:C,selectedChatMemberId:v,onScreenSelect:I,onChatMemberSelect:B});case l.l.StickerSearch:return c.a.createElement(jn,null);case l.l.GifSearch:return c.a.createElement(gn,null);case l.l.PollResults:return c.a.createElement(fn,null)}}return Object(c.n)(()=>M?Object(se.a)(F):void 0,[M,F]),Object(c.n)(()=>{setTimeout(()=>{L(!M)},300)},[M]),Object(c.n)(()=>{M&&x&&F()},[x]),Object(ft.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:o?void 0:"is-hidden"},x&&c.a.createElement("div",{className:"overlay-backdrop",onClick:F}),c.a.createElement("div",{id:"RightColumn"},c.a.createElement(zs,{chatId:t,isColumnOpen:M,isProfile:S,isSearch:k,isManagement:N,isStickerSearch:T,isGifSearch:P,isPollResults:A,profileState:g,managementScreen:p,onClose:F}),c.a.createElement(ne.a,{name:R?"none":"zoom-fade",renderCount:pn+In,activeKey:N?pn+p:D,shouldCleanup:!0,cleanupExceptionKey:l.l.ChatInfo},U)))}));var Cn=Object(c.h)(({isOpen:e})=>{const t=Object(Me.a)(Ee.a.Extra,"MediaViewer",!e);return t?c.a.createElement(t,null):void 0});var wn=Object(c.h)(({isOpen:e})=>{const t=Object(Me.a)(Ee.a.Extra,"Notifications",!e);return t?c.a.createElement(t,null):void 0});var En=Object(c.h)(({isOpen:e})=>{const t=Object(Me.a)(Ee.a.Extra,"Dialogs",!e);return t?c.a.createElement(t,null):void 0});var Mn=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Me.a)(Ee.a.Extra,"ForwardPicker",!t);return a?c.a.createElement(a,e):void 0});var Sn=Object(c.h)(e=>{const{url:t}=e,a=Object(Me.a)(Ee.a.Extra,"SafeLinkModal",!t);return a?c.a.createElement(a,e):void 0});var kn=Object(c.h)(e=>{const{isOpen:t}=e,a=Object(Me.a)(Ee.a.Extra,"HistoryCalendar",!t);return a?c.a.createElement(a,e):void 0});a(251);let Nn,Tn,Pn=!1;function An(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 xn=Object(c.h)(Object(s.h)(e=>{const{chatId:t,messageId:a}=e.audioPlayer,s=t&&a?Object(r.k)(e,t,a):void 0;return{animationLevel:e.settings.byKey.animationLevel,lastSyncTime:e.lastSyncTime,isLeftColumnShown:e.isLeftColumnShown,isRightColumnShown:Object(r.W)(e),isMediaViewerOpen:Object(r.T)(e),isForwardModalOpen:Object(r.R)(e),hasNotifications:Boolean(e.notifications.length),hasDialogs:Boolean(e.dialogs.length),audioMessage:s,safeLinkModalUrl:e.safeLinkModalUrl,isHistoryCalendarOpen:Boolean(e.historyCalendarSelectedAt)}},(e,t)=>Object(d.l)(t,["loadAnimatedEmojis","loadNotificationSettings","loadNotificationExceptions","updateIsOnline"]))(({lastSyncTime:e,isLeftColumnShown:t,isRightColumnShown:a,isMediaViewerOpen:o,isForwardModalOpen:i,animationLevel:l,hasNotifications:d,hasDialogs:b,audioMessage:u,safeLinkModalUrl:m,isHistoryCalendarOpen:h,loadAnimatedEmojis:O,loadNotificationSettings:j,loadNotificationExceptions:g,updateIsOnline:f})=>{n.p&&!Pn&&(Pn=!0,console.log(">>> RENDER MAIN")),Object(c.n)(()=>{e&&(f(!0),O(),j(),g())},[e,O,g,j,f]);const{transitionClassNames:p}=Object(ee.a)(!t,void 0,!0),{transitionClassNames:I}=Object(ee.a)(a,void 0,!0),v=Object(Z.a)(p.replace(/([\w-]+)/g,"middle-column-$1"),I.replace(/([\w-]+)/g,"right-column-$1"));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(X.b)(350+n.c),Nn&&(clearTimeout(Nn),Nn=void 0),Nn=window.setTimeout(()=>{document.body.classList.remove("animating-right-column"),Nn=void 0},350+n.c))},[l,a]);const y=Object(c.m)(()=>{f(!1);const e=Object(r.q)(Object(s.e)());let t=0;clearInterval(Tn),Tn=window.setInterval(()=>{if(document.title.includes(n.D))An(!1);else{if(t%2==0){const t=Object(r.q)(Object(s.e)())-e;t>0&&(document.title=`${t} notification${t>1?"s":""}`,An(!0))}else document.title=n.eb,An(!1);t++}},1e3)},[f]),C=Object(c.m)(()=>{f(!0),clearInterval(Tn),Tn=void 0,document.title.includes(n.D)||(document.title=n.eb),An(!1)},[f]);function w(e){e.preventDefault(),e.stopPropagation()}return Object(te.a)(y,C),ae(y),c.a.createElement("div",{id:"Main",className:v,onDrop:w,onDragOver:w},c.a.createElement(Ge,null),c.a.createElement(Vs,null),c.a.createElement(yn,null),c.a.createElement(Cn,{isOpen:o}),c.a.createElement(Mn,{isOpen:i}),c.a.createElement(wn,{isOpen:d}),c.a.createElement(En,{isOpen:b}),u&&c.a.createElement(jt,{key:u.id,message:u,noUi:!0}),c.a.createElement(Sn,{url:m}),c.a.createElement(kn,{isOpen:h}))}));n.p&&console.log(">>> FINISH LOAD MAIN BUNDLE"),Object(s.e)().connectionState||Object(s.d)().initApi()},197:function(e,t,a){},198:function(e,t,a){},199:function(e,t,a){},210:function(e,t,a){},211:function(e,t,a){},212:function(e,t,a){},215:function(e,t,a){},216:function(e,t,a){},217:function(e,t,a){},221:function(e,t,a){},222:function(e,t,a){},224:function(e,t,a){},227:function(e,t,a){},228: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){},239:function(e,t,a){},240:function(e,t,a){},241:function(e,t,a){},242:function(e,t,a){},243:function(e,t,a){},244:function(e,t,a){},245:function(e,t,a){},249:function(e,t,a){},250:function(e,t,a){},251:function(e,t,a){}}]);
//# sourceMappingURL=4.bdd7ea27f3831912b2a8.js.map