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