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