telegram-tt/dist/3.128af2df1b72904b3973.js
Alexander Zinchuk 099f9fd885 [Build]
2021-04-16 15:02:56 +03:00

1 line
195 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

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

(window.webpackJsonp=window.webpackJsonp||[]).push([[3],{104:function(e,t,a){"use strict";function s(e){const t=e.length;let a=e[0],s=e[0];for(let n=0;n<t;n++){const t=e[n];t>a?a=t:t<s&&(s=t)}return{max:a,min:s}}function n(e){return[].concat.apply([],e)}function c(e){const t=[],a=e.length;for(let s=0,n=e[0].length;s<n;s++){t[s]=0;for(let n=0;n<a;n++)t[s]+=e[n][s]}return t}function r(e,t){return new Proxy({},{get:(a,s)=>void 0!==a[s]?a[s]:void 0!==t[s]?t[s]:e[s]})}function o(e,t,a=!0){let s,n,c=null;return(...r)=>{s=!0,n=r,c||(a&&(s=!1,e(...n)),c=window.setInterval(()=>{if(!s)return window.clearInterval(c),void(c=null);s=!1,e(...n)},t))}}function i(e){let t,a=!1;return function(...s){t=s,a||(a=!0,requestAnimationFrame(()=>{a=!1,e(...t)}))}}function l(e,t,a=!0,s=!0){let n=null;return function(){n?(clearTimeout(n),n=null):a&&e(),n=setTimeout(()=>{s&&e(),n=null},t)}}a.d(t,"b",(function(){return s})),a.d(t,"c",(function(){return n})),a.d(t,"e",(function(){return c})),a.d(t,"d",(function(){return r})),a.d(t,"f",(function(){return o})),a.d(t,"g",(function(){return i})),a.d(t,"a",(function(){return l}))},183:function(e,t,a){},184:function(e,t,a){},185:function(e,t,a){},197:function(e,t,a){},198:function(e,t,a){},199:function(e,t,a){},202:function(e,t,a){},203:function(e,t,a){},204:function(e,t,a){},208:function(e,t,a){},209:function(e,t,a){},211:function(e,t,a){},214:function(e,t,a){},215:function(e,t,a){},216:function(e,t,a){},217:function(e,t,a){},218:function(e,t,a){},219:function(e,t,a){},220:function(e,t,a){},221:function(e,t,a){},222:function(e,t,a){},223:function(e,t,a){},224: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){},234:function(e,t,a){},235:function(e,t,a){},236:function(e,t,a){},91: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(74),a(37)),o=a(6);Object(s.b)("openChat",(e,t,a)=>{const{id:n,threadId:c,type:i}=a,l=Object(o.x)(e);return!l||l.chatId===n&&l.threadId===c&&l.type===i||(e=Object(r.m)(e),e={...e,messages:{...e.messages,contentToBeScheduled:void 0},...n!==e.forwardMessages.toChatId&&{forwardMessages:{}}},Object(s.g)(e)),Object(r.L)(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(18),d=a(3);let b;Object(s.b)("setScrollOffset",(e,t,a)=>{const{chatId:s,threadId:n,scrollOffset:c}=a;return Object(r.v)(e,s,n,"scrollOffset",c)}),Object(s.b)("setReplyingToId",(e,t,a)=>{const{messageId:s}=a,n=Object(o.x)(e);if(!n)return;const{chatId:c,threadId:i}=n;return Object(r.v)(e,c,i,"replyingToId",s)}),Object(s.b)("setEditingId",(e,t,a)=>{const{messageId:s}=a,n=Object(o.x)(e);if(!n)return;const{chatId:c,threadId:i,type:l}=n,d="scheduled"===l?"editingScheduledId":"editingId";return Object(r.v)(e,c,i,d,s)}),Object(s.b)("editLastMessage",e=>{const{chatId:t,threadId:a}=Object(o.x)(e)||{};if(!t||!a)return;const s=Object(o.m)(e,t),n=Object(o.Cb)(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.v)(e,t,a,"editingId",c):void 0}),Object(s.b)("openMediaViewer",(e,t,a)=>{const{chatId:s,threadId:n,messageId:c,avatarOwnerId:r,origin:o}=a;return{...e,mediaViewer:{chatId:s,threadId:n,messageId:c,avatarOwnerId:r,origin:o},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.U)(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.x)(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.xb)(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.H)(e,h,m);t&&t.length&&([O]=t)}const j=Object(o.x)(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.N)(e),e=Object(r.M)(e),Object(s.g)(e)},2e3),e=Object(r.N)(e,n,O,u),e=Object(r.M)(e,void 0),g&&(e=Object(r.M)(e,l.b.Static));const f=Object(o.Cb)(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.v)(e,n,c,"viewportIds",void 0)),e=Object(r.v)(e,n,c,"outlyingIds",void 0),f&&!g){const t=O>f[0]?l.b.Down:l.b.Up;e=Object(r.M)(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.Y)(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()}),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.q)(e);return n?Object(r.l)(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.x)(e);if(!l)return;const{chatId:d,threadId:b,type:u}=l;return Object(r.E)(e,d,b,u,s,n,c,i)}),Object(s.b)("exitMessageSelectMode",r.m),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.P)(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.P)(e,{recentlyFoundChatIds:[s]});const c=n.filter(e=>e!==s);return c.unshift(s),c.length>10&&c.pop(),Object(r.P)(e,{recentlyFoundChatIds:c})}),Object(s.b)("clearRecentlyFoundChats",e=>Object(r.P)(e,{recentlyFoundChatIds:void 0})),Object(s.b)("setGlobalSearchContent",(e,t,a)=>{const{content:s}=a;return Object(r.Q)(e,s)}),Object(s.b)("setGlobalSearchChatId",(e,t,a)=>{const{id:s}=a;return Object(r.P)(e,{chatId:s,query:void 0,resultsByType:void 0})});var u=a(44),m=a(4);Object(s.b)("openLocalTextSearch",e=>{const{chatId:t,threadId:a}=Object(o.x)(e)||{};if(t&&a)return Object(r.W)(e,t,a,!0)}),Object(s.b)("closeLocalTextSearch",e=>{const{chatId:t,threadId:a}=Object(o.x)(e)||{};if(t&&a)return e=Object(r.W)(e,t,a,!1),e=Object(r.s)(e,t,a,void 0)}),Object(s.b)("setLocalTextSearchQuery",(e,t,a)=>{const{chatId:s,threadId:n}=Object(o.x)(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.s)(e,s,n,u.a)),e=Object(r.W)(e,s,n,!0,c)}),Object(s.b)("setLocalMediaSearchType",(e,t,a)=>{const{chatId:s}=Object(o.x)(e)||{};if(!s)return;const{mediaType:n}=a;return Object(r.V)(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.db)(e,void 0)),Object(s.b)("setSettingOption",(e,t,a)=>Object(r.u)(e,a));var h=a(7),O=a(157);Object(s.b)("toggleChatInfo",e=>({...e,isChatInfoShown:!e.isChatInfoShown})),Object(s.b)("toggleManagement",e=>{const{chatId:t}=Object(o.x)(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.x)(e)||{};if(t)return{...e,management:{byChatId:{...e.management.byChatId,[t]:{...e.management.byChatId[t],isActive:!1}}}}}),Object(s.b)("toggleStatistics",e=>({...e,isStatisticsShown:!e.isStatisticsShown})),Object(s.b)("openChat",(e,t,a)=>{if(!h.f)return;const{id:s}=a;return{...e,isLeftColumnShown:void 0===s}}),Object(s.b)("toggleLeftColumn",e=>({...e,isLeftColumnShown:!e.isLeftColumnShown})),Object(s.b)("addRecentEmoji",(e,t,a)=>{const{emoji:s}=a,{recentEmojis: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)("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.g)(e);return Object(r.h)(t)});a(75);var j=a(11),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),v=Object(g.a)(e=>e(),500,!1,!0);async function y(e,t,a){const c=await Object(j.a)("fetchChats",{limit:n.i,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.e)(l,Object(d.c)(c.users,"id")),l=Object(r.K)(l,Object(d.c)(c.chats,"id")),l=Object(r.G)(l,e,o),l=Object(r.H)(l,e,c),Object.keys(c.draftsById).map(Number).forEach(e=>{l=Object(r.v)(l,e,i.MAIN_THREAD_ID,"draft",c.draftsById[e])}),Object.keys(c.replyingToById).map(Number).forEach(e=>{l=Object(r.v)(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 w(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.e)(c,Object(d.c)(a,"id"))),c=Object(r.F)(c,e.id,{fullInfo:n}),Object(s.g)(c)}async function C(e,t,a){const n=Object(s.e)(),c=Object(o.h)(n,t);if(c&&!c.isMin)return void(a?e.focusMessage({chatId:c.id,messageId:a}):e.openChat({id:c.id}));const i=Object(o.q)(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.F)(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.rb;c++){await Object(g.e)(200);const{byId:n,listIds:{active:c},orderedPinnedIds:{active:r}}=Object(s.e)().chats;if(!c)return;const{chatId:l}=Object(o.x)(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}),h.k&&t.loadPinnedMessages({chatId:u.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.Bb)(e,s);t&&Object(j.a)("fetchChat",{type:"user",user:t})}if(n!==i.MAIN_THREAD_ID){Object(o.zb)(e,s,n)||t.requestThreadInfoUpdate({chatId:s,threadId:n})}}),Object(s.b)("openSupportChat",(e,t)=>{const a=Object(o.vb)(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.qb})}),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.L)(e,t.id)).sort((e,t)=>e.lastMessage.date-t.lastMessage.date)[0]:void 0;f(c?()=>y(s,c.id,c.lastMessage.date):()=>y(s))}),Object(s.b)("loadFullChat",(e,t,a)=>{const{chatId:s,force:n}=a,c=Object(o.f)(e,s);c&&(n?w(c):I(()=>w(c)))}),Object(s.b)("loadSuperGroupOnlines",(e,t,a)=>{const{chatId:s}=a,n=Object(o.f)(e,s);n&&v(()=>Object(j.a)("fetchSuperGroupOnlines",n))}),Object(s.b)("loadTopChats",()=>{p(()=>y("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.F)(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.Bb)(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.F)(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.Bb)(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.L)(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.L)(e,s,"archived"===t?n.g: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.g})}),Object(s.b)("loadChatFolders",()=>{!async function(){const e=await Object(j.a)("fetchChatFolders");if(e){const t=Object(s.e)();Object(s.g)({...t,chatFolders:{...t.chatFolders,...e}})}}()}),Object(s.b)("loadRecommendedChatFolders",()=>{!async function(){const e=await Object(j.a)("fetchRecommendedChatFolders");if(e){const t=Object(s.e)();Object(s.g)({...t,chatFolders:{...t.chatFolders,recommended:e}})}}()}),Object(s.b)("editChatFolder",(e,t,a)=>{const{id:s,folderUpdate: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.g)}),Object(s.b)("deleteChatFolder",(e,t,a)=>{const{id:s}=a;Object(o.i)(e,s)&&async function(e){await Object(j.a)("deleteChatFolder",e)}(s)}),Object(s.b)("toggleChatUnread",(e,t,a)=>{const{id:s}=a,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,c=n.X.exec(s);C(t,c[1],c[2]?Number(c[2]):void 0)}),Object(s.b)("openChatByUsername",(e,t,a)=>{const{username:s}=a;C(t,s)}),Object(s.b)("togglePreHistoryHidden",(e,t,a)=>{const{chatId:s,isEnabled:n}=a;let c=Object(o.f)(e,s);c&&(async()=>{if(Object(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.Bb)(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.F)(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.Bb)(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.F)(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.Z)(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.Z)(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&&w(c)})()});var E=a(158);const M=new Map;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.N/2)+1);break;case l.e.Forwards:m=-(n.N+1)}const h=await Object(j.a)("fetchMessages",{chat:Object(o.yb)(Object(s.e)(),u,t),offsetId:a,addOffset:m,limit:n.N,threadId:t});if(!h)return;const{messages:O,users:g,chats:f,threadInfos:p,firstMessageId:I}=h,v=Object(d.c)(O,"id"),y=Object.keys(v).map(Number);let w=Object(s.e)();w=Object(r.b)(w,u,v),w=i?Object(r.bb)(w,u,t,y):Object(r.T)(w,u,t,y),w=Object(r.e)(w,Object(d.c)(g,"id")),w=Object(r.c)(w,Object(d.c)(f,"id")),w=Object(r.jb)(w,u,p),I&&(w=Object(r.v)(w,u,t,"firstMessageId",I));let C=Object(o.W)(w,u,t);const E=Object(o.bb)(w,u,t);if(i&&C&&E&&Object(d.b)(C,E)&&(w=Object(r.T)(w,u,t,E),C=Object(o.W)(w,u,t),w=Object(r.v)(w,u,t,"outlyingIds",void 0),i=!1),!b){const e=i?E:C,{newViewportIds:s}=k(e,a,c);w=Object(r.x)(w,u,t,s)}Object(s.g)(w)}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.N,i=r+n.N-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.N}return{newViewportIds:d,areSomeLocal:b,areAllLocal:u}}async function N(e){let t;const a=e.attachment?(e,n)=>{M.has(n)||(t=n,M.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.x)(n);if(!c)return;const{threadId:r}=c;e.replyingTo||r===i.MAIN_THREAD_ID||(e.replyingTo=Object(o.zb)(n,e.chat.id,r)),await Object(j.a)("sendMessage",e,a),a&&t&&M.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.x)(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.Cb)(e,i,d),m=Object(o.W)(e,i,d),h=Object(o.bb)(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.x)(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.G)(e,i)||Object(o.gb)(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.N&&(e=Object(r.x)(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.J)(t,e.id,a,{...n,replyToMessageId:void 0}),Object(s.g)(t)}return}let c=Object(s.e)();c=Object(r.J)(c,e.id,t,n.message),c=Object(r.e)(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.x)(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});const b={...a,chat:l,replyingTo:Object(o.hb)(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.F);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.x)(e);if(!c)return;const{chatId:r,threadId:i,type:l}=c,d=Object(o.f)(e,r),b=Object(o.C)(e,r,i,l);d&&b&&(Object(j.a)("editMessage",{chat:d,message:b,text:s,entities:n}),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&&M.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.hb)(e,s,n)}),Object(r.v)(e,s,n,"draft",c)}),Object(s.b)("clearDraft",(e,t,a)=>{const{chatId:s,threadId:n,localOnly:c}=a;if(!Object(o.A)(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.v)(e,s,n,"draft",void 0)}),Object(s.b)("pinMessage",(e,t,a)=>{const s=Object(o.q)(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.v)(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.x)(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.B)(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.x)(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.D)(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.x)(e);if(!s)return;const{chatId:n,threadId:c}=s,r=Object(o.yb)(e,n,c);if(!r)return;const{maxId:i}=a;Object(j.a)("markMessageListRead",{chat:r,threadId:c,maxId:i})}),Object(s.b)("markMessagesRead",(e,t,a)=>{const s=Object(o.q)(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.e)(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.q)(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.t)(b,e.id,o,n),b=Object(r.v)(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.kb)(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.yb)(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.v)(b,e.id,i.MAIN_THREAD_ID,"pinnedIds",l),b=Object(r.e)(b,Object(d.c)(c,"id")),b=Object(r.c)(b,Object(d.c)(n,"id")),Object(s.g)(b)}(c)}),Object(s.b)("loadMessageLink",(e,t,a)=>{const{messageId:s,chatId:n}=a,c=Object(o.f)(e,n),r=Object(o.k)(e,n,s);c&&r&&(async()=>{const e=await Object(j.a)("fetchMessageLink",{chat:c,message:r});e&&Object(E.c)(e.link)})()});var P=a(46);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.O)(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.gb)(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.gb)(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.sb)(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.fb)(i,n.id,{...n,stickers:c,packs:o});const l=i.stickers.forEmoji.emoji;l&&o[l]&&(i=Object(r.n)(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.p)(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.sb)(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.gb)(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.hb)(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(28);const R=Object(g.g)(e=>e(),500,!1);async function L(e="",t,a,c,i,l){let b;if(c){const s=await Object(j.a)("searchMessagesLocal",{chatOrUser:c,query:e,type:t,limit:n.u,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.u,type:t,maxDate:i,minDate:l});let u=Object(s.e)();const m=Object(o.s)(u);if(!b||""!==e&&e!==m)return void Object(s.g)(Object(r.R)(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.e)(u,Object(d.c)(O,"id"))),h.length&&(u=Object(r.d)(u,h)),u=Object(r.S)(u,h,f,t,p),Object(s.g)(u)}async function F(){const e=await Object(j.a)("fetchChats",{limit:n.i,archived:!0,withPinned:!0});if(!e)return;let t=Object(s.e)();t=Object(r.mb)(t,Object(d.c)(e.users,"id")),t=Object(r.K)(t,Object(d.c)(e.chats,"id")),t=Object(r.q)(t,"archived",e.chatIds),t=Object(r.H)(t,"archived",e),Object(s.g)(t)}async function B(){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.Bb)(e,t)).filter(Boolean),c=await Object(j.a)("fetchUsers",{users:n});c&&(e=Object(s.e)(),e=Object(r.mb)(e,Object(d.c)(c,"id")),Object(s.g)(e))}Object(s.b)("setGlobalSearchQuery",(e,t,a)=>{const{chatId:c}=e.globalSearch,{query:i}=a;i&&!c&&R(()=>{!async function(e){const t=await Object(j.a)("searchChats",{query:e,limit:n.u});let a=Object(s.e)();const c=Object(o.s)(a);if(!t||!c||e!==c)return void Object(s.g)(Object(r.R)(a,{chats:!1}));const{localChats:i,localUsers:l,globalChats:b,globalUsers:u}=t;(i.length||b.length)&&(a=Object(r.c)(a,Object(d.c)([...i,...b],"id")));(l.length||u.length)&&(a=Object(r.e)(a,Object(d.c)([...l,...u],"id")));a=Object(r.R)(a,{chats:!1}),a=Object(r.P)(a,{localResults:{chats:i,users:l},globalResults:{...a.globalSearch.globalResults,chats:b,users:u}}),Object(s.g)(a)}(i)})}),Object(s.b)("setGlobalSearchDate",(e,t,a)=>{const{date:n}=a,c=n?Object(x.m)(n):n,i=Object(r.P)(e,{date:n,query:"",resultsByType:{...e.globalSearch.resultsByType,text:{totalCount:void 0,foundIds:[],nextOffsetId:0}}});Object(s.g)(i);const{chatId:l}=e.globalSearch;L("","text",void 0,l?Object(o.f)(e,l):void 0,c,n)}),Object(s.b)("searchMessagesGlobal",(e,t,a)=>{const{query:s,resultsByType:n,chatId:c,date:r}=e.globalSearch,i=r?Object(x.m)(r):r,{type:l}=a,{nextOffsetId:d}=n&&n[l]||{};L(s,l,d,c?Object(o.f)(e,c):void 0,i,r)}),Object(s.b)("searchTextMessagesLocal",e=>{const{chatId:t,threadId:a}=Object(o.x)(e)||{},c=t?Object(o.f)(e,t):void 0,l=Object(o.z)(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.xb)(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.P,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.z)(f);if(!p||c&&c!==p.query)return;f=Object(r.b)(f,e.id,O),f=Object(r.e)(f,Object(d.c)(u,"id")),f=Object(r.X)(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.v)(e),a=t?e.users.byId[t]||e.chats.byId[t]:void 0,c=Object(o.u)(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.cb,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.u)(O))return;O=Object(r.b)(O,e.id,m),O=Object(r.e)(O,Object(d.c)(l,"id")),O=Object(r.U)(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.x)(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.x)(e)||{};if(!n)return;if(e.management.progress===l.f.InProgress)return;const{username:c}=a;(async()=>{e=Object(r.Z)(e,l.f.InProgress),e=Object(r.Y)(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.Z)(e,t?l.f.Complete:l.f.Error),e=Object(r.Y)(e,n,{isUsernameAvailable:t}),Object(s.g)(e)})()}),Object(s.b)("updatePublicLink",(e,t,a)=>{const{chatId:n}=Object(o.x)(e)||{};let c=n&&Object(o.f)(e,n);if(!n||!c)return;const{username:i}=a;(async()=>{if(e=Object(r.Z)(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.Z)(e,a?l.f.Complete:l.f.Error),e=Object(r.Y)(e,n,{isUsernameAvailable:void 0}),Object(s.g)(e)})()}),Object(s.b)("updatePrivateLink",e=>{const{chatId:t}=Object(o.x)(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.m&&console.log(">>> START SYNC");await Object(j.a)("fetchCurrentUser");const t=await async function(){const e=await Object(j.a)("fetchChats",{limit:n.i,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.Bb)(t,e)).filter(Boolean),h=b.map(e=>Object(o.f)(t,e)).filter(Boolean),{chatId:O}=Object(o.x)(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.Bb)(t,O);e&&!b.includes(O)&&u.push(e)}}u.push(...e.users),h.push(...e.chats),t=Object(r.r)(t,Object(d.c)(h,"id")),t=Object(r.q)(t,"active",e.chatIds),t={...t,chats:{...t.chats}},t=Object(r.H)(t,"active",e),Object.keys(e.draftsById).map(Number).forEach(a=>{t=Object(r.v)(t,a,i.MAIN_THREAD_ID,"draft",e.draftsById[a])}),Object.keys(e.replyingToById).map(Number).forEach(a=>{t=Object(r.v)(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.x)(c)||{},b=Object.keys(c.messages.byChatId).map(Number).reduce((e,t)=>{const a=Object(o.A)(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.N/2)+1),limit:n.N}));c=Object(s.e)();const{chatId:b}=Object(o.x)(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.K)(c,Object(d.c)(e.chats,"id")),c=Object(r.jb)(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.v)(c,e,i.MAIN_THREAD_ID,"draft",b[e])}),e?c=Object(r.w)(c,Object(d.c)(a,"id")):a&&(c=Object(r.mb)(c,Object(d.c)(a,"id")));Object(s.g)(c)}(t),Object(s.g)({...Object(s.e)(),lastSyncTime:Date.now()}),n.m&&console.log(">>> FINISH SYNC");e()}(t.afterSync)}),Object(s.b)("afterSync",(e,t)=>{!async function(e){n.m&&console.log(">>> START AFTER-SYNC");e.loadFavoriteStickers(),await Promise.all([B(),F()]),await Object(j.a)("fetchCurrentUser"),n.m&&console.log(">>> FINISH AFTER-SYNC")}(t)});const D=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.Bb)(e,s);if(!n)return;const{id:c,accessHash:r}=n;D(()=>Object(j.a)("fetchFullUser",{id:c,accessHash:r}))}),Object(s.b)("loadUser",(e,t,a)=>{const{userId:n}=a,c=Object(o.Bb)(e,n);c&&(async()=>{const t=await Object(j.a)("fetchUsers",{users:[c]});t&&(e=Object(s.e)(),e=Object(r.mb)(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.e)(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.e)(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.Bb)(c,e);if(!i)return;Object(s.d)().updateChatMutedState({chatId:e,isMuted:t}),Object(s.g)(Object(r.Z)(Object(s.e)(),l.f.InProgress));await Object(j.a)("updateContact",{phone:i.phoneNumber,firstName:a,lastName:n})&&Object(s.g)(Object(r.lb)(Object(s.e)(),i.id,{firstName:a,lastName:n}));Object(s.g)(Object(r.Z)(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.Bb)(t,e);if(!a)return;const{id:n,accessHash:c}=a;await Object(j.a)("deleteUser",{id:n,accessHash:c})}(n)}),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.X)?t.openTelegramLink({url:c.value}):window.open(c.value);break;case"callback":{const t=Object(o.q)(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.q)(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.q)(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.Bb)(e,t);a&&Object(s.g)(Object(r.lb)(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.lb)(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.e)(t,Object(d.c)(e.users,"id"))),e.chats&&e.chats.length&&(t=Object(r.K)(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.Bb)(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.o)(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)("loadNotificationsSettings",()=>{(async()=>{const e=await Object(j.a)("loadNotificationsSettings");e&&Object(s.g)(Object(r.u)(Object(s.e)(),e))})()}),Object(s.b)("updateNotificationSettings",(e,t,a)=>{const{peerType:n,isSilent:c,isShowPreviews:o}=a;(async()=>{await Object(j.a)("updateNotificationSettings",n,{isSilent:c,isShowPreviews:o})&&Object(s.g)(Object(r.ab)(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.u)(Object(s.e)(),{hasContactJoinedNotifications:!n}))})()}),Object(s.b)("loadLanguages",()=>{(async()=>{const e=await Object(j.a)("fetchLanguages");e&&Object(s.g)(Object(r.u)(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.u)(t,{hasPassword:e.hasPassword}),t=Object(r.kb)(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.kb)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await Object(j.a)("checkPassword",n);Object(s.g)(Object(r.kb)(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.kb)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await Object(j.a)("clearPassword",n);Object(s.g)(Object(r.kb)(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.kb)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await Object(j.a)("updatePassword",n,c,o,i);Object(s.g)(Object(r.kb)(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.kb)(e,{isLoading:!0,error:void 0})),(async()=>{const e=await Object(j.a)("updateRecoveryEmail",n,c);Object(s.g)(Object(r.kb)(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.kb)(e,{error:void 0}));var H=a(54);Object(s.b)("validateRequestedInfo",(e,t,a)=>{const{requestInfo:n,saveInfo:c}=a,i=Object(o.cb)(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.C)(Object(s.e)(),c);o?(i=Object(r.eb)(i,o),i=Object(r.A)(i,l.i.Shipping)):i=Object(r.A)(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.z)(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.A)(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.B)(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.fb)(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.D)(Object(s.e)(),{type:c.type,id:c.id});o=Object(r.A)(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.cb)(e),l=Object(o.db)(e),d=Object(o.fb)(e),b=Object(o.ub)(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.g)(Object(s.e)());Object(s.g)(Object(r.h)(e))}}(i,{save:c,data:b},l,n)}),Object(s.b)("setPaymentStep",(e,t,a={})=>Object(r.A)(e,a.step||l.i.ShippingInfo)),Object(s.b)("setInvoiceMessageInfo",(e,t,a)=>Object(r.y)(e,a));a(76);Object(s.b)("apiUpdate",(e,t,a)=>{switch(a["@type"]){case"updateChat":Object(o.K)(e,a.id)||t.loadTopChats(),Object(s.g)(Object(r.F)(e,a.id,a.chat));break;case"updateChatJoin":{const n=Object(o.j)(e,a.id);if(!n)break;e=Object(r.G)(e,n,[a.id]),e=Object(r.F)(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.q)(e,t,n.filter(e=>e!==a.id))),e=Object(r.F)(e,a.id,{isNotJoined:!0}),Object(s.g)(e);break}case"updateChatInbox":Object(s.g)(Object(r.F)(e,a.id,a.chat));break;case"updateChatTypingStatus":{const{id:t,typingStatus:n}=a;Object(s.g)(Object(r.F)(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.F)(e,t,{typingStatus:void 0}))},6e3);break}case"newMessage":{if(a.message.senderId===e.currentUserId)return;const t=Object(o.f)(e,a.chatId);if(!t)return;Object(s.g)(Object(r.F)(e,a.chatId,{unreadCount:t.unreadCount?t.unreadCount+1:1,...a.message.hasUnreadMention&&{unreadMentionsCount:t.unreadMentionsCount?t.unreadMentionsCount+1:1}}));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.F)(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.F)(e,a.id,{fullInfo:{...n.fullInfo,...t}}));break}case"updatePinnedChatIds":{const{ids:t,folderId:c}=a,r=c===n.g?"archived":"active";e={...e,chats:{...e.chats,orderedPinnedIds:{...e.chats.orderedPinnedIds,[r]:t.length?t:void 0}}},Object(s.g)(e);break}case"updateChatPinned":{const{id:t,isPinned: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.E){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.I)(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.F)(e,a.id,{membersCount:l.length,fullInfo:{...t.fullInfo,members:l,adminMembers:n}}))}break}}});function q(e,t,a,s,n=!1){const c=n?Object(o.kb)(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.cb)(e,t,a,s):Object(r.J)(e,t,a,s)}function G(e,t){const{id:a,chatId:s}=t;e=Object(r.T)(e,s,i.MAIN_THREAD_ID,[a]),Object(o.V)(e,s,i.MAIN_THREAD_ID)&&(e=Object(r.f)(e,s,i.MAIN_THREAD_ID,a));const{threadInfo:n,firstMessageId:c}=Object(o.wb)(e,s,t)||{};return!c&&Object(m.sb)(t)||n&&(e=Object(r.T)(e,s,n.threadId,[a]),Object(o.V)(e,s,n.threadId)&&(e=Object(r.f)(e,s,n.threadId,a),c||(e=Object(r.v)(e,s,n.threadId,"firstMessageId",t.id)),n.lastMessageId||(e=Object(r.v)(e,s,n.threadId,"threadInfo",{...n,lastMessageId:t.id})))),e}function _(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.F)(e,t,{lastMessage:a})}function z(e,t){const a=Object(o.m)(e,t),s=Object(o.W)(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 V(e,t,a,n){if(e){t.forEach(t=>{const a=z(n=Object(r.J)(n,e,t,{isDeleting:!0}),e);a&&(n=_(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.wb)(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.i)(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.J)(n,t,e,{isDeleting:!0}),t);a&&(n=_(n,t,a,!0)),setTimeout(()=>{Object(s.g)(Object(r.i)(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=G(e=q(e,n,c,i),i);if(Object(o.f)(e,n)){const t=Object(o.k)(e,n,c);e=_(e,n,t)}if(i.threadInfo&&(e=Object(r.ib)(e,i.threadInfo.chatId,i.threadInfo.threadId,i.threadInfo)),Object(s.g)(e),Object(o.a)(e,n,i)){!i.isOutgoing||i.content&&i.content.action||t.focusLastMessage();const{threadInfo:a}=Object(o.wb)(e,n,i)||{};a&&t.requestThreadInfoUpdate({chatId:n,threadId:a.threadId})}Object(o.K)(e,n)||t.loadTopChats();break}case"newScheduledMessage":{const{chatId:t,id:n,message:c}=a;e=q(e,t,n,c,!0);const l=Object(o.jb)(e,t)||[];e=Object(r.v)(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=q(e,t,n,c);const i=Object(o.k)(e,t,n);c.threadInfo&&(e=Object(r.ib)(e,c.threadInfo.chatId,c.threadInfo.threadId,c.threadInfo)),e=_(e,t,i),Object(s.g)(e);break}case"updateScheduledMessage":{const{chatId:t,id:n,message:c}=a;if(!Object(o.kb)(e,t,n))return;e=q(e,t,n,c,!0);const l=Object.keys(Object(o.lb)(e,t)||{}).map(Number).sort((e,t)=>t-e);e=Object(r.v)(e,t,i.MAIN_THREAD_ID,"scheduledIds",l),Object(s.g)(e);break}case"updateMessageSendSucceeded":{const{chatId:t,localId:n,message:c}=a;e=G(e,c);const i=Object(o.k)(e,t,n);e=Object(r.i)(e,t,[n]),c.isScheduled&&(e=Object(r.j)(e,t,[n])),e=Object(r.J)(e,t,c.id,{...i,...c,previousLocalId:n});const l=Object(o.k)(e,t,c.id);e=_(e,t,l),Object(s.g)(e);break}case"updateScheduledMessageSendSucceeded":{const{chatId:t,localId:n,message:c}=a,l=Object(o.jb)(e,t)||[];e=Object(r.v)(e,t,i.MAIN_THREAD_ID,"scheduledIds",[...l,c.id]);const d=Object(o.kb)(e,t,n);e=Object(r.j)(e,t,[n]),e=Object(r.cb)(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.eb)(e,t)||[],d=n?[...l,...c]:l.filter(e=>!c.includes(e));Object(s.g)(Object(r.v)(e,t,i.MAIN_THREAD_ID,"pinnedIds",d));break}case"updateThreadInfo":{const{chatId:t,threadId:n,threadInfo:c}=a,i={...Object(o.xb)(e,t,n),...c};if(!i.threadId)return;e=Object(r.ib)(e,t,n,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.i)(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;V(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.cb)(n,e,t,{isDeleting:!0})}),Object(s.g)(n),setTimeout(()=>{n=Object(r.j)(Object(s.e)(),e,t);const a=Object(o.lb)(n,e);n=Object(r.v)(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;V(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.J)(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.J)(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.J)(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.J)(e,i.chatId,i.id,{content:{...i.content,poll:{...l,results:{...l.results,recentVoterIds:m,totalVoters:h,results:O}}}}));break}}});var $=a(104);const W=Object($.f)((function(){let e=Object(s.e)();Q.forEach(([t,a])=>{e=Object(r.lb)(e,t,{status:a})}),Object(s.g)(e),Q=[]}),3e3,!0);let Q=[];Object(s.b)("apiUpdate",(e,t,a)=>{switch(a["@type"]){case"deleteUser":return Object(r.k)(e,a.id);case"updateUser":return Object(r.lb)(e,a.id,a.user);case"updateUserStatus":return s=a.userId,n=a.status,Q.push([s,n]),void W();case"updateUserFullInfo":{const{id:t,fullInfo:s}=a,n=e.users.byId[t];if(!n)return;return Object(r.lb)(e,t,{fullInfo:{...n.fullInfo,...s}})}}var s,n}),Object(s.b)("apiUpdate",(e,t,a)=>{switch(a["@type"]){case"updateStickerSet":return Object(r.fb)(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.o)(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.ab)(e,a.peerType,a.isSilent,a.isShowPreviews)}}),Object(s.b)("apiUpdate",(e,t,a)=>{switch(a["@type"]){case"updateTwoFaStateWaitCode":return{...e,twoFaSettings:{...e.twoFaSettings,isLoading:!1,waitingEmailCodeLength:a.length}};case"updateTwoFaError":return{...e,twoFaSettings:{...e.twoFaSettings,error:a.message}}}});var K=a(43),Y=a(27),J=a(8),Z=a(42),X=a(100),ee=a(66),te=a(93),ae=a(56),se=a(32),ne=a(31),ce=a(142),re=a(126);a(183);var oe=Object(c.h)(({id:e,name:t,value:a,label:s,checked:n=!1,disabled:r,onChange:o,onCheck:i})=>{const l=Object(c.m)(e=>{o&&o(e),i&&i(e.currentTarget.checked)},[o,i]),d=Object(J.a)("Switcher",r&&"disabled");return c.a.createElement("label",{className:d,title:s},c.a.createElement("input",{type:"checkbox",id:e,name:t,value:a,checked:n,disabled:r,onChange:l}),c.a.createElement("span",{className:"widget"}))});a(184);const ie=[0,1,2];var le=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:w,setSettingOption:C})=>{const E=e===l.d.ChatList,M={date:void 0},S={id:void 0},k=Object(c.p)(()=>g?Object(x.a)(new Date(1e3*g)):void 0,[g]),N=Object(c.p)(()=>E&&I?Object.values(I).reduce((e,t)=>Object(m.hb)(t)&&t.unreadCount?e+1:e,0):0,[E,I]),P=Object(c.p)(()=>({onTrigger:e,isOpen:t})=>c.a.createElement(ne.a,{round:!0,ripple:E&&!h.f,size:"smaller",color:"translucent",className:t?"active":"",onClick:E?e:()=>d(),ariaLabel:E?"Open menu":"Return to chat list"},c.a.createElement("div",{className:Object(J.a)("animated-menu-icon",!E&&"state-back")})),[E,d]),T=Object(c.m)(()=>{b||a("")},[b,a]),A=Object(c.m)(()=>{v({id:O})},[O,v]),R=Object(c.m)(e=>{e.stopPropagation();const t="light"===f?"dark":"light";C({theme:t,customBackground:"dark"===t?"#0F0F0F":void 0}),Object(ee.a)(t,p>0)},[p,C,f]),L=Object(c.m)(e=>{e.stopPropagation();const t=0===p?2:0;ie.forEach((e,a)=>{document.body.classList.toggle("animation-level-"+a,t===a)}),C({animationLevel:t})},[p,C]),F=Object(te.a)(),B=Boolean(j)||e===l.d.GlobalSearch||e===l.d.Contacts,D=e===l.d.Contacts?F("SearchFriends"):F("Search");return c.a.createElement("div",{className:"LeftMainHeader"},c.a.createElement("div",{id:"LeftMainHeader",className:"left-header"},c.a.createElement(ae.a,{trigger:P,footer:n.f},c.a.createElement(se.a,{icon:"saved-messages",onClick:A},F("SavedMessages")),c.a.createElement(se.a,{icon:"archive",onClick:o},c.a.createElement("span",{className:"menu-item-name"},F("ArchivedChats")),N>0&&c.a.createElement("div",{className:"archived-badge"},N)),c.a.createElement(se.a,{icon:"user",onClick:r},F("Contacts")),c.a.createElement(se.a,{icon:"settings",onClick:s},F("Settings")),c.a.createElement(se.a,{icon:"darkmode",onClick:R},c.a.createElement("span",{className:"menu-item-name"},"Dark Mode"),c.a.createElement(oe,{id:"darkmode",label:"Toggle Dark Mode",checked:"dark"===f})),c.a.createElement(se.a,{icon:"animations",onClick:L},c.a.createElement("span",{className:"menu-item-name capitalize"},F("Appearance.Animations").toLowerCase()),c.a.createElement(oe,{id:"animations",label:"Toggle Animations",checked:p>0})),c.a.createElement(se.a,{icon:"help",onClick:y},"Telegram Features"),c.a.createElement(se.a,{icon:"bug",href:n.t},"Report Bug")),c.a.createElement(ce.a,{inputId:"telegram-search-input",className:j||g?"with-picker-item":"",value:t||b,focused:B,isLoading:u,placeholder:D,canClose:Boolean(j||g),onChange:a,onReset:d,onFocus:T},k&&c.a.createElement(re.a,{icon:"calendar",title:k,canClose:!0,isMinimized:Boolean(j),className:"search-date",onClick:w,clickArg:M}),j&&c.a.createElement(re.a,{chatOrUserId:j,onClick:i,canClose:!0,clickArg:S}))))})),de=a(20);a(185);var be=Object(s.h)(e=>Object(d.l)(e,["connectionState"]))(({connectionState:e})=>{const t=Object(te.a)();return"connectionStateConnecting"===e&&c.a.createElement("div",{id:"ConnectionState"},c.a.createElement(de.a,{color:"black"}),c.a.createElement("div",{className:"state-text"},t("WaitingForNetwork")))}),ue=a(127),me=a(106),he=a(29),Oe=(e,t,a)=>{const s=Object(c.q)(),n=(e=>Object(c.p)(()=>Object(g.g)(e=>e(),e),[e]))(t),r=Object(he.a)();return Object(me.a)(()=>{let t=!0;n(()=>{s.current=e(),t||r()}),t=!1},a),s.current},je=a(156),ge=a(176);var fe=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}},(e,t)=>Object(d.l)(t,["loadChatFolders"]))(({chatsById:e,usersById:t,chatFoldersById:a,orderedFolderIds:s,lastSyncTime:n,loadChatFolders:r})=>{const o=Object(c.q)(null),[i,l]=Object(c.r)(0);Object(c.n)(()=>{n&&r()},[n,r]);const b=Object(c.p)(()=>s?s.map(e=>a[e]||{}).filter(Boolean):void 0,[a,s]),u=Oe(()=>{if(!b||!b.length)return;const a=Object.keys(e).map(Number),s=b.map(s=>{const{unreadDialogsCount:n,hasActiveDialogs:c}=Object(m.p)(e,t,s,a)||{};return{id:s.id,badgeCount:n,isBadgeActive:c}});return Object(d.c)(s,"id")},3e3,[b,e,t]),O=Object(c.p)(()=>{if(b&&b.length)return[{title:"All"},...b.map(e=>({title:e.title,...u&&u[e.id]}))]},[b,u]),j=Object(c.m)(e=>{l(e)},[]);Object(c.n)(()=>{O&&O.length&&i>=O.length&&l(0)},[i,O]),Object(c.n)(()=>{if(o.current&&h.k&&O&&O.length)return Object(ue.b)(o.current,{onSwipe:(e,t)=>{t===ue.a.Left?l(Math.min(i+1,O.length-1)):t===ue.a.Right&&l(Math.max(0,i-1))}})},[i,O]);const{shouldRender:g,transitionClassNames:f}=Object(Y.a)(!s,void 0,!0),p=Object(te.a)();function I(){const e=Object.values(a).find(({title:e})=>e===O[i].title);return e&&0!==i?c.a.createElement(ge.a,{folderType:"folder",folderId:e.id,noChatsText:p("FilterNoChatsToDisplay")}):c.a.createElement(ge.a,{folderType:"all"})}return c.a.createElement("div",{className:"ChatFolders"},O&&O.length?c.a.createElement(je.a,{tabs:O,activeTab:i,onSwitchTab:j}):g?c.a.createElement("div",{className:Object(J.a)("tabs-placeholder",f)}):void 0,c.a.createElement(X.a,{ref:o,name:"slide",activeKey:i,renderCount:O?O.length:void 0},I))})),pe=a(12),Ie=a(17),ve=a(16);var ye=e=>{const t=Object(Ie.a)(pe.a.Extra,"LeftSearch");return t?c.a.createElement(t,e):c.a.createElement(ve.a,null)};var we=e=>{const t=Object(Ie.a)(pe.a.Extra,"ContactList");return t?c.a.createElement(t,e):c.a.createElement(ve.a,null)},Ce=a(47);a(197);let Ee;var Me=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(te.a)(),i=Object(J.a)("NewChatButton",e&&"revealed",n&&"menu-is-open"),l=Object(c.m)(()=>{Ee&&(clearTimeout(Ee),Ee=void 0)},[]),d=Object(c.m)(()=>{Ee&&(clearTimeout(Ee),Ee=void 0),Ee=window.setTimeout(()=>{r(!1)},750)},[]);return c.a.createElement("div",{className:i,onMouseEnter:l,onMouseLeave:d},c.a.createElement(ne.a,{round:!0,color:"primary",className:n?"active":"",onClick:()=>{r(!n)},ariaLabel:n?"Close":"Create new chat",tabIndex:-1},c.a.createElement("i",{className:"icon-new-chat-filled"}),c.a.createElement("i",{className:"icon-close"})),c.a.createElement(Ce.a,{isOpen:n,positionX:"right",positionY:"bottom",autoClose:!0,onClose:()=>{r(!1)}},c.a.createElement(se.a,{icon:"channel",onClick:a},o("NewChannel")),c.a.createElement(se.a,{icon:"group",onClick:s},o("NewGroup")),c.a.createElement(se.a,{icon:"user",onClick:t},"New Private Chat")))});a(198);const Se=Object.keys(l.d).length/2;let ke;var Ne=Object(c.h)(({content:e,searchQuery:t,searchDate:a,contactsFilter:s,onSearchQuery:n,onContentChange:r,onReset:o})=>{const[i,d]=Object(c.r)(h.k),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,ke&&(clearTimeout(ke),ke=void 0),ke=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.k)&&d(!0),()=>{t&&(clearTimeout(t),t=void 0)}},[e]),c.a.createElement("div",{id:"LeftColumn-main",onMouseEnter:h.k?void 0:f,onMouseLeave:h.k?void 0:p},c.a.createElement(le,{content:e,contactsFilter:s,onSearchQuery:n,onSelectSettings:u,onSelectContacts:m,onSelectArchived:g,onReset:o}),c.a.createElement(be,null),c.a.createElement(X.a,{name:"zoom-fade",renderCount:Se,activeKey:e},()=>{switch(e){case l.d.ChatList:return c.a.createElement(fe,null);case l.d.GlobalSearch:return c.a.createElement(ye,{searchQuery:t,searchDate:a,onReset:o});case l.d.Contacts:return c.a.createElement(we,{filter:s});default:return}}),c.a.createElement(Me,{isShown:i,onNewPrivateChat:m,onNewChannel:O,onNewGroup:j}))});var Pe=e=>{const t=Object(Ie.a)(pe.a.Extra,"Settings");return t?c.a.createElement(t,e):c.a.createElement(ve.a,null)};var Te=e=>{const t=Object(Ie.a)(pe.a.Extra,"NewChat");return t?c.a.createElement(t,e):c.a.createElement(ve.a,null)};var Ae,xe=e=>{const t=Object(Ie.a)(pe.a.Extra,"ArchivedChats");return t?c.a.createElement(t,e):c.a.createElement(ve.a,null)};a(199);!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"}(Ae||(Ae={}));const Re=Object.keys(Ae).length/2;var Le=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=Ae.Main;switch(d){case l.d.Archived:p=Ae.Archived;break;case l.d.Settings:p=Ae.Settings;break;case l.d.NewChannelStep1:case l.d.NewChannelStep2:p=Ae.NewChannel;break;case l.d.NewGroupStep1:case l.d.NewGroupStep2:p=Ae.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(Z.a)(()=>I()):void 0,[d,I]),Object(c.n)(()=>{i(),u===l.m.Privacy&&o()},[i,o,u]),c.a.createElement(X.a,{id:"LeftColumn",name:h.f?"slide-layers":"push-slide",renderCount:Re,activeKey:p},()=>{switch(p){case Ae.Archived:return c.a.createElement(xe,{onReset:I});case Ae.Settings:return c.a.createElement(Pe,{currentScreen:u,onScreenSelect:m,onReset:I});case Ae.NewChannel:return c.a.createElement(Te,{key:g,isChannel:!0,content:d,onContentChange:b,onReset:I});case Ae.NewGroup:return c.a.createElement(Te,{key:g,content:d,onContentChange:b,onReset:I});default:return c.a.createElement(Ne,{content:d,searchQuery:e,searchDate:t,contactsFilter:O,onContentChange:b,onSearchQuery:v,onReset:I})}})})),Fe=a(124),Be=a(13),De=a(49);var Ue=()=>{const[e,t]=Object(c.r)(De.a.get());return Object(c.n)(()=>{const e=Object(g.g)(()=>{t(De.a.get())},250,!1);return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),e},He=a(38);function qe(e,t){const a=Object(He.a)(e,!0),s=Object(c.q)(),n=Object(he.a)(),r=null!=e;return r&&s.current&&(clearTimeout(s.current),s.current=void 0),Object(me.a)(()=>{t&&!r&&a&&!s.current&&(s.current=window.setTimeout(()=>{s.current=void 0,n()},t))},[e]),s.current&&t&&!r?a:e}function Ge(e,t){const a=e<=n.V?16:32,s=function(e){if(e>n.S){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.R){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.V?54:64,r=t?s-a-c:s-a,o=e>n.V?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}}var _e=a(132),ze=a(129);function Ve(e,t=!1,a=!1){const s=Object(He.a)(e,t);return a||null!=e?e:s}var $e=a(45),We=a(96),Qe=a(111);var Ke=e=>{const{isOpen:t}=e,a=Object(Ie.a)(pe.a.Extra,"HeaderMenuContainer",!t);return a?c.a.createElement(a,e):void 0};var Ye=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.N)(e,t),l="thread"===s&&a===i.MAIN_THREAD_ID,d="thread"===s&&a!==i.MAIN_THREAD_ID,b=Object(o.U)(e),u=Boolean(Object(o.J)(e,t)),O=Boolean(l&&n&&(c||Object(m.nb)(n))&&n.isNotJoined),j=l||d,g=l&&!r&&!O,f=!Object(o.Q)(e),p=l&&!O;return{noMenu:!(h.f&&O||h.f&&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)},[]),w=Object(c.m)(()=>{I(void 0)},[]),C=Object(c.m)(()=>{u({chatId:e})},[u,e]),E=Object(c.m)(()=>{m({command:"/start"})},[m]),M=Object(c.m)(()=>{if(O(),h.f){document.querySelector("#MobileSearch input").focus()}else setTimeout(()=>{const e=document.querySelector(".RightHeader .SearchInput input");e&&e.focus()},400)},[O]),S=Object(te.a)();return c.a.createElement("div",{className:"HeaderActions"},!h.f&&r&&c.a.createElement(ne.a,{size:"tiny",ripple:!0,fluid:!0,onClick:C},S(s?"Subscribe":"Join Group")),!h.f&&n&&c.a.createElement(ne.a,{size:"tiny",ripple:!0,fluid:!0,onClick:E},S("Start")),!h.f&&o&&c.a.createElement(ne.a,{round:!0,ripple:b,color:"translucent",size:"smaller",onClick:M,ariaLabel:"Search in this chat"},c.a.createElement("i",{className:"icon-search"})),(h.f||!r)&&c.a.createElement(ne.a,{ref:j,className:g?"active":"",round:!0,ripple:!h.f,size:"smaller",color:"translucent",disabled:a,ariaLabel:"More actions",onClick:v},c.a.createElement("i",{className:"icon-more"})),p&&c.a.createElement(Ke,{chatId:e,threadId:t,isOpen:g,anchor:p,isChannel:s,canSubscribe:r,canSearch:o,canMute:i,canSelect:l,canLeave:d,onSubscribeChannel:C,onSearchClick:M,onClose:y,onCloseAnimationEnd:w}))})),Je=a(103),Ze=a(35),Xe=a(97),et=a(34);function tt(e){const t=e&&Object(m.E)(e),{sticker:a}=e&&e.content||{},s=t&&a&&!Object(h.o)()&&t.includes("image/webp"),[r,o]=Object(c.r)(et.a),i=e&&e.id;return Object(c.o)(()=>{s&&Object(et.c)("b64-"+i,t).then(o).catch(e=>{n.m&&console.error(e)})},[i,s,t]),s?r:t}var at=a(107),st=a(33),nt=a(36);function ct(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 rt=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=ct(0,0,2,t,1)+ct(0,12,2,t+1,1)+ct(0,25,2,t,1);else for(let e=0;e<a;e++)s+=ct(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(J.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 ot=Object(c.h)(({message:e,count:t,index:a,customTitle:s,className:n,onUnpinMessage:r,onClick:o,onAllPinnedClick:i})=>{const l=tt(e),d=Object(Xe.a)(Object(m.D)(e,"pictogram")),b=Object(m.M)(e,Boolean(l)),[u,h,O]=Object(nt.a)(),j=Object(c.m)(()=>{O(),r&&r(e.id)},[O,r,e.id]),g=Object(te.a)();return c.a.createElement("div",{className:Object(J.a)("HeaderPinnedMessage-wrapper",n)},t>1&&c.a.createElement(ne.a,{round:!0,size:"smaller",color:"translucent",className:"pin-list-button",ariaLabel:g("EventLogFilterPinnedMessages"),onClick:i},c.a.createElement("i",{className:"icon-pin-list"})),r&&c.a.createElement(ne.a,{round:!0,size:"smaller",color:"translucent",ariaLabel:g("UnpinMessageAlertTitle"),className:"unpin-button",onClick:h},c.a.createElement("i",{className:"icon-close"})),c.a.createElement(at.a,{isOpen:u,onClose:O,text:"Would you like to unpin this message?",confirmLabel:"Unpin",confirmHandler:j}),c.a.createElement("div",{className:"HeaderPinnedMessage",onClick:o},c.a.createElement(rt,{count:t,index:a}),l&&function(e,t){const{width:a,height:s}=Object(Je.k)();return c.a.createElement("img",{src:t||e,width:a,height:s,alt:""})}(l,d),c.a.createElement("div",{className:"message-text"},c.a.createElement("div",{className:"title"},s||`${g("PinnedMessage")} ${a>0?"#"+(t-a):""}`),c.a.createElement("p",null,Object(Ze.a)(b))),c.a.createElement(st.a,null)))}),it=a(48),lt=a(164);a(202);var dt=Object(s.h)((e,{message:t})=>{const a=Object(o.ob)(e,t);return{senderName:a?Object(m.U)(a):void 0}},(e,t)=>Object(d.l)(t,["focusMessage","closeAudioPlayer"]))(({message:e,className:t,senderName:a,focusMessage:s,closeAudioPlayer:n})=>{const r=it.c(Object(m.D)(e,"inline")),{playPause:o,isPlaying:i}=Object(lt.a)(Object(m.A)(e),Object(m.r)(e),r,void 0,void 0,!0),l=Object(c.m)(()=>{s({chatId:e.chatId,messageId:e.id})},[s,e.chatId,e.id]),d=Object(c.m)(()=>{i&&o(),n()},[n,i,o]),b=Object(te.a)(),u=Object(m.u)(e);return c.a.createElement("div",{className:Object(J.a)("AudioPlayer",t)},c.a.createElement(ne.a,{round:!0,ripple:!h.f,color:"translucent",size:"smaller",className:Object(J.a)("toggle-play",i?"pause":"play"),onClick:o,ariaLabel:i?"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:l},u?function(e){const{title:t,performer:a,fileName:s}=e;return c.a.createElement(c.a.Fragment,null,c.a.createElement("div",{className:"title"},Object(Ze.a)(t||s)),a&&c.a.createElement("div",{className:"subtitle"},Object(Ze.a)(a)))}(u):function(e,t){return c.a.createElement(c.a.Fragment,null,c.a.createElement("div",{className:"title"},t&&Object(Ze.a)(t)),c.a.createElement("div",{className:"subtitle"},e))}(b("AttachAudio"),a),c.a.createElement(st.a,null)),c.a.createElement(ne.a,{round:!0,className:"player-close",color:"translucent",size:"smaller",onClick:d,ariaLabel:"Close player"},c.a.createElement("i",{className:"icon-close"})))});a(203);var bt=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,h=b&&u?Object(o.k)(e,b,u):void 0,O=Object(o.yb)(e,t,a);let j;if("pinned"===s){const a=Object(o.eb)(e,t);j=a&&a.length}else if("scheduled"===s){const a=Object(o.jb)(e,t);j=a&&a.length}else if("thread"===s&&a!==i.MAIN_THREAD_ID){const s=Object(o.xb)(e,t,a);s&&(j=s.messagesCount)}let g={typingStatus:d,isLeftColumnShown:n,isRightColumnShown:Object(o.U)(e),isSelectModeActive:Object(o.Q)(e),audioMessage:h,chatTitleLength:l&&Object(m.l)(l).length,chatsById:r,originChatId:O?O.id:t,messagesCount:j,isChatWithSelf:Object(o.N)(e,t),isChatWithBot:l&&Object(o.M)(e,l),lastSyncTime:c};const f=Object(o.m)(e,t);if("thread"===s&&f)if(a===i.MAIN_THREAD_ID){const s=Object(o.eb)(e,t);if(s&&s.length){const t=f[s[0]],{canUnpin:n}=t&&Object(o.b)(e,t,a)||{};g={...g,pinnedMessageIds:s,messagesById:f,canUnpin:n}}}else{const s=Object(o.zb)(e,t,a),n=s?Object(o.k)(e,t,s):void 0,c=n?Object(o.I)(e,n):void 0,r=c?Object(m.U)(c):void 0;g={...g,pinnedMessageIds:s,messagesById:f,canUnpin:!1,topMessageTitle:r}}return g},(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,topMessageTitle:l,typingStatus:d,isSelectModeActive:b,isLeftColumnShown:u,isRightColumnShown:O,audioMessage:j,chatTitleLength:g,chatsById:f,originChatId:p,messagesCount:I,isChatWithSelf:v,isChatWithBot:y,lastSyncTime:w,openChatWithInfo:C,pinMessage:E,focusMessage:M,openChat:S,loadPinnedMessages:k,toggleLeftColumn:N,exitMessageSelectMode:P})=>{const[T,A]=Object(c.r)(0),x=Array.isArray(s)?s[T]:s,R=r&&x?r[x]:void 0,L=Array.isArray(s)?s.length:s?1:0;Object(c.n)(()=>{t===i.MAIN_THREAD_ID&&w&&k({chatId:e})},[e,k,w,t]),Object(c.n)(()=>{A(0)},[e]),Object(c.n)(()=>{A(L?Object(_e.a)(L,T):-1)},[L,T]),Object(ze.a)(e,x,R);const{width:F}=Ue(),B=F<=n.R,D=F>=n.V&&u,U=Object(c.q)(null),H=Object(c.q)(!0),q=Object(c.m)(()=>{C({id:e})},[C,e]),G=Object(c.m)(t=>{E({chatId:e,messageId:t,isUnpin:!0})},[E,e]),_=Object(c.m)(()=>{if(R){M({chatId:R.chatId,threadId:t,messageId:R.id});const e=Object(_e.a)(L,T+1);A(e)}},[R,M,t,L,T]),z=Object(c.m)(()=>{S({id:e,threadId:i.MAIN_THREAD_ID,type:"pinned"})},[S,e]),V=Object(c.m)(()=>{if(h.f){const e=document.getElementById(n.r);e&&e.blur()}t!==i.MAIN_THREAD_ID||"thread"!==a?("scheduled"===a&&b&&P(),S({id:p,threadId:i.MAIN_THREAD_ID})):h.f?S({id:void 0}):N()},[S,p,t,a,N,b,P]),$=Object(c.p)(()=>{if(!B||!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||a.isMuted&&!a.unreadMentionsCount||(e=!0),t+s},0);return t?{isActive:e,totalCount:t}:void 0},[B,f]),W=F>=n.R&&F<n.Y||F>n.V&&F<n.R&&(!g||g>30),Q=W||F>n.S&&F<n.Z,{shouldRender:K,transitionClassNames:Z}=Object(Y.a)(Boolean(j)),ee=Ve(j),{shouldRender:ae,transitionClassNames:se}=Object(Y.a)(R&&!K),ce=Ve(R),re=Ve(l),oe=ae&&ce||K&&ee;Object(c.n)(()=>{const e=U.current;if(e)return Q&&oe?void(O||W?(H.current&&(e.classList.add("tools-stacked","animated"),H.current=!1),setTimeout(()=>{e.classList.remove("animated")},350)):(e.classList.remove("tools-stacked"),H.current=!0)):(e.classList.remove("tools-stacked","animated"),void(H.current=!0))},[Q,oe,W,O]);const ie=Object(te.a)();function le(){return"thread"===a&&t===i.MAIN_THREAD_ID?c.a.createElement(c.a.Fragment,null,B&&de(D,$),c.a.createElement("div",{className:"chat-info-wrapper",onClick:q},Object(m.lb)(e)?c.a.createElement(We.a,{userId:e,typingStatus:d,withFullInfo:y,withMediaViewer:!0,withUpdatingStatus:!0}):c.a.createElement(Qe.a,{chatId:e,typingStatus:d,withMediaViewer:!0,withFullInfo:!0,withUpdatingStatus:!0}))):"thread"===a?c.a.createElement(c.a.Fragment,null,de(),c.a.createElement("h3",null,ie("CommentsCount",I))):"pinned"===a?c.a.createElement(c.a.Fragment,null,de(),c.a.createElement("h3",null,ie("PinnedMessagesCount",I))):"scheduled"===a?c.a.createElement(c.a.Fragment,null,de(),c.a.createElement("h3",null,v?ie("Reminders"):ie("messages",I))):void 0}function de(e=!1,t){return c.a.createElement("div",{className:"back-button"},c.a.createElement(ne.a,{round:!0,size:"smaller",color:"translucent",onClick:V,ariaLabel:e?"Close":"Back"},c.a.createElement("div",{className:Object(J.a)("animated-close-icon",!e&&"state-back")})),t&&c.a.createElement("div",{className:"unread-count "+(t.isActive?"active":"")},Object($e.b)(t.totalCount)))}return c.a.createElement("div",{className:"MiddleHeader",ref:U},c.a.createElement(X.a,{name:"slide-fade",activeKey:"thread"===a?t:1},le),c.a.createElement("div",{className:"header-tools"},ae&&ce&&!K&&c.a.createElement(ot,{key:e,message:ce,count:L,index:T,customTitle:re,className:se,onUnpinMessage:o?G:void 0,onClick:_,onAllPinnedClick:z}),K&&ee&&c.a.createElement(dt,{key:Object(m.A)(ee),message:ee,className:Z}),c.a.createElement(Ye,{chatId:e,threadId:t,messageListType:a})))})),ut=a(149);function mt(e){return"albumId"in e}function ht(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 Ot=a(95);function jt(){const[e,t]=Object(nt.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 gt=a(144),ft=a(115);let pt=!1;var It=({containerRef:e,className:t,messageIds:a,containerHeight:s,listItemElementsRef:r,focusingId:o,anchorIdRef:i,anchorTopRef:l,loadMoreForwards:d,loadMoreBackwards:b,isViewportNewest:u,firstUnreadId:m,onFabToggle:h,children:O})=>{const j=Object(c.q)(null),g=Object(c.q)(null),f=Object(c.q)(null),p=Object(c.m)(()=>{if(pt)return;if(!a||!a.length)return void h(!1);if(!u)return void h(!0);const{offsetHeight:t,scrollHeight:s,scrollTop:n}=e.current,c=s-n-t;h(m?!(0===c):!(c<=50))},[a,u,e,h,m]),{observe:I,freeze:v,unfreeze:y}=Object(Ot.a)({rootRef:e,margin:n.M},t=>{if(!d||!b)return;const a=t.find(({isIntersecting:e})=>e);if(!a)return;const{target:s}=a;"backwards-trigger"===s.className?(Object(gt.a)(e.current),b()):"forwards-trigger"===s.className&&s.dataset.isActive&&(Object(gt.a)(e.current),d())});Object(Ot.c)(j,I),Object(Ot.c)(g,I);const{observe:w,freeze:C,unfreeze:E}=Object(Ot.a)({rootRef:e,margin:50},([{target:e}])=>{e.dataset.isActive&&p()});return Object(Ot.c)(f,w),Object(me.a)(()=>{o?(v(),C()):(E(),y())},[o]),Object(me.a)(()=>{if(!r.current)return;const e=r.current.filter(e=>a.includes(Number(e.dataset.messageId))),t=e[1]||e[0];t&&(i.current=t.id,l.current=t.getBoundingClientRect().top)},[a,s]),Object(me.a)(()=>{pt=!0,setTimeout(()=>{pt=!1},100)},[a]),Object(c.n)(p,[m]),c.a.createElement("div",{className:t,teactFastList:!0},c.a.createElement("div",{ref:j,key:"backwards-trigger",className:"backwards-trigger"}),O,c.a.createElement("div",{ref:g,key:"forwards-trigger",className:"forwards-trigger","data-is-active":!u}),c.a.createElement("div",{ref:f,key:"fab-trigger",className:"fab-trigger","data-is-active":u}))},vt=a(131),yt=a(134);function wt(e){return"number"==typeof e}function Ct(e){return e?175:100}function Et(e){const t=Object(m.tb)(e),a=Object(m.qb)(e),s=Object(m.G)(e)||Object(m.Q)(e),n=Object(m.O)(e),c=Boolean(Object(m.Q)(e)),{width:r,height:o}=s?Object(Je.f)(s,t,a,c):Object(Je.h)(n,t,a),i=Ct(Boolean(Object(m.N)(e)));let l=1;r<i&&i-r<12&&(l=i/r),o*l<90&&90-o*l<12&&(l=90/o);const d=Math.round(r*l),b=Math.round(o*l);return{width:d,height:b,isSmall:d<i||b<90}}const Mt=0,St=1,kt=2,Nt=4,Pt=8;function Tt(e,t){return e.reduce((e,t)=>e+t,t)}function At(e,t,a){return e<t?t:e>a?a:e}function xt(e){const t={width:0,height:0};return e.forEach(({dimensions:e,sides:a})=>{a&kt&&(t.width=e.width+e.x),a&Nt&&(t.height=e.height+e.y)}),t}function Rt(e,t,a,s){const c=a.messages.map(e=>{const t=Et(e);return t.width/t.height});const r=function(e){return e.map(e=>e>1.2?"w":e<.8?"n":"q").join("")}(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.V?a/100*69-(t?1.625:0)*Je.c:((e?30:29)-(t?1.625:0))*Je.c}(e,t,s);let b;const u={ratios: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?At(e,1,2.75):At(e,.6667,1))}(e,t),o=e.length,i=new Array(o),l=[],d=e=>{const t=[];let s=0;e.forEach(e=>{t.push(((e,t)=>{const s=Tt(r.slice(e,e+t),0);return(a-(t-1)*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=Tt(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=Mt|(0===e?St:Mt)|(e===O-1?Nt:Mt)|(0===l?Pt:Mt)|(l===t-1?kt:Mt),b=r[j],u=l===t-1?a-o:Math.round(b*s);i[j]={dimensions:{x:o,y:g,width:u,height: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:Pt|St|kt},{dimensions:{x:0,y:c+s,width:a,height:c},sides:Pt|Nt|kt}]}(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:St|Pt|Nt},{dimensions:{x:c+s,y:0,width:c,height:r},sides:St|kt|Nt}]}(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:St|Pt|Nt},{dimensions:{x:i+n,y:0,width:o,height:l},sides:St|kt|Nt}]}(e)}(u):3===i?function(e){const{proportions:t}=e;return"n"===t[0]?function(e){const{maxHeight:t,spacing:a,ratios:s,maxWidth: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:St|Pt|Nt},{dimensions:{x:d+a,y:0,width:l,height:i},sides:St|kt},{dimensions:{x:d+a,y:i+a,width:l,height:o},sides:Nt|kt}]}(e):function(e){const{maxWidth:t,ratios:a,maxHeight:s,spacing: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:Pt|St|kt},{dimensions:{x:0,y:r+n,width:o,height:i},sides:Nt|Pt},{dimensions:{x:o+n,y:r+n,width:c-o-n,height:i},sides:Nt|kt}]}(e)}(u):function(e){const{proportions:t}=e;return"w"===t[0]?function({maxWidth:e,ratios:t,spacing:a,maxHeight:s,minWidth: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:Pt|St|kt},{dimensions:{x:0,y:r+a,width:i,height:b},sides:Nt|Pt},{dimensions:{x:i+a,y:r+a,width:d,height:b},sides:Nt},{dimensions:{x:i+a+d+a,y:r+a,width:l,height:b},sides:kt|Nt}]}(e):function({maxHeight:e,ratios:t,maxWidth:a,spacing:s,minWidth: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:St|Pt|Nt},{dimensions:{x:r+s,y:0,width:b,height:i},sides:St|kt},{dimensions:{x:r+s,y:i+s,width:b,height:l},sides:kt},{dimensions:{x:r+s,y:i+l+2*s,width:b,height:d},sides:Nt|kt}]}(e)}(u),{layout:b,containerStyle:xt(b)}}let Lt;function Ft(e){return Lt||(Lt=document.createElement("span"),Lt.style.font='400 12px Roboto, "Helvetica Neue", "Apple Color Emoji", sans-serif',Lt.style.whiteSpace="nowrap",Lt.style.position="absolute",Lt.style.left="-999px",Lt.style.opacity=".01",document.body.appendChild(Lt)),Lt.innerHTML=e,Lt.offsetWidth}function Bt(e,t,a,s,n){Object(c.o)(()=>{if(a&&e.current){const t=e.current.closest(".MessageList");Object(ft.a)(t,e.current,n?"end":"center",20,void 0===s?1500:1e3,s)}},[e,t,a,s,n])}var Dt=a(99),Ut=a(177);var Ht=e=>{const{isOpen:t}=e,a=Object(Ie.a)(pe.a.Extra,"ContextMenuContainer",!t);return a?c.a.createElement(a,e):void 0};var qt=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.S)(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.Bb)(e,a):void 0,...s&&{targetUser:Object(o.Bb)(e,s)},targetChatId:n,targetMessage:r,isFocused:i,...i&&{focusDirection:l,noFocusHighlight:d}}})(({message:e,observeIntersection:t,isEmbedded:a,sender:s,targetUser:n,targetMessage:r,targetChatId:o,isFocused:i,focusDirection:l,noFocusHighlight:d})=>{const b=Object(c.q)(null);Object(Ot.c)(b,t),Object(ze.a)(e.chatId,e.replyToMessageId,r),Bt(b,e.chatId,i,l,d),Object(te.a)();const u=Object(Ut.a)(e,s,n,r,o,a?{isEmbedded:!0,asPlain:!0}:void 0),{isContextMenuOpen:m,contextMenuPosition:h,handleBeforeContextMenu:O,handleContextMenu:j,handleContextMenuClose:g,handleContextMenuHide:f}=Object(vt.a)(b),p=void 0!==h;return a?c.a.createElement("span",{className:"embedded-action-message"},Object(Ze.a)(u)):c.a.createElement("div",{ref:b,id:"message"+e.id,className:Object(J.a)("ActionMessage message-list-item",i&&!d&&"focused",p&&"has-menu-open"),"data-message-id":e.id,onMouseDown:O,onContextMenu:j},c.a.createElement("span",null,u),h&&c.a.createElement(Ht,{isOpen:m,anchor:h,message:e,messageListType:"thread",onClose:g,onCloseAnimationEnd:f}))}));a(204);var Gt=({className:e,message:t,sender:a,title:s,customText:n,observeIntersection:r,onClick:o})=>{const i=Object(c.q)(null),l=Object(Ot.b)(i,r),d=Object(Xe.a)(t&&Object(m.D)(t,"pictogram"),!l),b=t&&"sticker-reply-thumb"+t.id,u=tt(t);Object(te.a)();const h=a&&Object(m.U)(a);return c.a.createElement("div",{ref:i,className:Object(J.a)("EmbeddedMessage",e),onClick:t?o:void 0},u&&function(e,t,a){const{width:s,height:n}=Object(Je.k)();return c.a.createElement("img",{id:e,src:a||t,width:s,height:n,alt:""})}(b,u,d),c.a.createElement("div",{className:"message-text"},c.a.createElement("div",{className:"message-title"},Object(Ze.a)(h||s||" ")),c.a.createElement("p",null,t?Object(m.db)(t)?c.a.createElement(qt,{message:t,isEmbedded:!0}):Object(Ze.a)(Object(m.M)(t,Boolean(u))):n||" ")))},_t=a(150),zt=a(155),Vt=a(161);a(208);var $t=({message:e,outgoingStatus:t,signature:a,onClick:s})=>{const n=Object(te.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($e.b)(e.views)),c.a.createElement("i",{className:"icon-channelviews"})),a&&c.a.createElement("span",{className:"message-signature"},Object(Ze.a)(a)),c.a.createElement("span",{className:"message-time"},e.isEdited&&n("EditedMessage")+" ",Object(x.h)(1e3*e.date)),t&&c.a.createElement(Vt.a,{status:t}))},Wt=a(102),Qt=a(105),Kt=a(151);a(209);var Yt=({message:e,observeIntersection:t,observeIntersectionForPlaying:a,shouldLoop:s,lastSyncTime:r})=>{const o=Object(c.q)(null),[i,l,d]=Object(nt.a)(),b=e.content.sticker,{isAnimated:u,stickerSetId:h}=b,O=h===n.K,j=Object(Ot.b)(o,t),g=Object(Ot.b)(o,a),f=b.isPreloadedGlobally?"sticker"+b.id:Object(m.D)(e,"inline"),p=tt(e),I=Object(Xe.a)(f,!j,Object(m.C)(e,"inline",!0),r),v=Boolean(I),[y,w]=Object(nt.a)(v),C=u?y:v,{shouldRenderFullMedia:E,transitionClassNames:M}=Object(Wt.a)(C,"slow"),{width:S,height:k}=Object(Je.l)(b),N=Object(J.a)("thumbnail",!p&&"empty"),P=Object(J.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&&E&&c.a.createElement("img",{id:"sticker-"+e.id,src:I,width:S,height:k,alt:"",className:Object(J.a)("full-media",M)}),u&&v&&c.a.createElement(Qt.a,{key:f,className:Object(J.a)("full-media",M),id:f,animationData:I,size:S,play:g,noLoop:!s,onLoad:w}),c.a.createElement(Kt.a,{isOpen:i,fromSticker:b,onClose:d}))},Jt=a(119),Zt=a(112),Xt=a(135);function ea(e,t){return Object(Xt.a)(Object(m.E)(e),Boolean(t),h.f?n.C:void 0)}var ta=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 aa=a(113);var sa=({id:e,message:t,observeIntersection:a,shouldAutoLoad:s,isInSelectMode:n,isSelected:r,uploadProgress:o,size:i="inline",dimensions:l,shouldAffectAppendix:d,onClick:b,onCancelUpload:u})=>{const h=Object(c.q)(null),O=(Object(m.G)(t)||Object(m.Q)(t)).blobUrl,j=Object(Ot.b)(h,a),[g,f]=Object(c.r)(s),p=g&&j,{mediaData:I,downloadProgress:v}=Object(Zt.a)(Object(m.D)(t,i),!p),y=O||I,w=ea(t,y),{isUploading:C,isTransferring:E,transferProgress:M}=Object(m.s)(t,o||v,p&&!y),S=!1===Object(He.a)(g),{shouldRender:k,transitionClassNames:N}=Object(Y.a)(E,void 0,S,"slow"),{shouldRenderThumb:P,shouldRenderFullMedia:T,transitionClassNames:A}=Object(Wt.a)(y,"slow"),x=Object(c.m)(()=>{C?u&&u(t):y?b&&b(t.id):f(e=>!e)},[y,C,t,u,b]),R=Object(m.tb)(t);Object(c.o)(()=>{if(!d)return;const e=h.current.closest(".message-content");y?ta(y,R,0,r).then(t=>{e.style.setProperty("--appendix-bg",t),e.setAttribute("data-has-custom-appendix","")}):e.classList.add("has-appendix-thumb")},[y,R,d,n,r]);const{width:L,height:F,isSmall:B}=l||Et(t),D=Object(J.a)("media-inner",!C&&"interactive",B&&"small-image",L===F&&"square-image"),U=Object(J.a)("thumbnail",!w&&"empty"),H=l?`width: ${L}px; height: ${F}px; left: ${l.x}px; top: ${l.y}px;`:"";return c.a.createElement("div",{id:e,ref:h,className:D,style:H,onClick:C?void 0:x},P&&c.a.createElement("img",{src:w,className:U,width:L,height:F,alt:""}),T&&c.a.createElement("img",{src:y,className:"full-media "+A,width:L,height:F,alt:""}),k&&c.a.createElement("div",{className:"media-loading "+N},c.a.createElement(aa.a,{progress:M,onClick:C?x:void 0})),!y&&!g&&c.a.createElement("i",{className:"icon-download"}),E&&c.a.createElement("span",{className:"message-upload-progress"},Math.round(100*M),"%"))},na=a(121),ca=a(133);function ra(e,t){const a=Object(c.q)();a.current=t;const s=Object(c.m)(()=>{e.current&&e.current.pause()},[e]),n=Object(c.m)(()=>{e.current&&a.current&&Object(ca.a)(e.current)},[e]);Object(K.a)(s,n)}var oa=a(136);function ia(){return(ia=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 la=({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(Ot.b)(b,a),[f,p]=Object(c.r)(s),I=Boolean(f&&g&&o),[v,y]=Object(c.r)(n),w=Object(Xe.a)(Object(m.D)(t,"pictogram"),!(g&&o),Object(m.C)(t,"pictogram"),o),C=ea(t,w),{mediaData:E,downloadProgress:M}=Object(Zt.a)(Object(m.D)(t,"inline"),!I,Object(m.C)(t,"inline"),o),S=w||C,k=O||E,N=Boolean(j&&g&&k),{isBuffered:P,bufferingHandlers:T}=Object(na.a)(!s),{isUploading:A,isTransferring:R,transferProgress:L}=Object(m.s)(t,r||M,I&&j&&!P),F=!1===Object(He.a)(f),{shouldRender:B,transitionClassNames:D}=Object(Y.a)(R,void 0,F),{shouldRenderThumb:U,transitionClassNames:H}=Object(Wt.a)(k,"slow"),[q,G]=Object(c.r)(0),_=Object(c.m)(e=>{G(Math.max(0,e.currentTarget.currentTime-1))},[]),z=Object(m.tb)(t),V=Object(m.qb)(t),{width:$,height:W}=i||Object(Je.h)(h,z,V);ra(u,N),Object(oa.a)(u,[N]);const Q=Object(c.m)(()=>{A?d&&d(t):j&&!k?p(e=>!e):j&&k&&!v?(y(!0),u.current.play()):l&&l(t.id)},[A,j,k,v,l,d,t]),K=Object(J.a)("media-inner dark",!A&&"interactive"),Z=Object(J.a)("thumbnail",!S&&"empty"),X=Object(J.a)("full-media",H),ee=S?`background-image: url(${S}); background-size: cover`:"",te=i?`width: ${$}px; height: ${W}px; left: ${i.x}px; top: ${i.y}px;`:"",ae=N,se=!j&&E,ne=!j||f&&!v&&!B,ce=j&&!f;return c.a.createElement("div",{ref:b,id:e,className:K,style:te,onClick:A?void 0:Q},(U||!N)&&c.a.createElement("img",{src:S,className:Z,width:$,height:W,alt:""}),ae&&c.a.createElement("video",ia({ref:u,className:X,width:$,height:W,autoPlay:v,muted:!0,loop:!0,playsInline:!0,style:ee},T,{onTimeUpdate:_}),c.a.createElement("source",{src:k})),se&&c.a.createElement("img",{src:E,className:"full-media "+H,width:$,height:W,alt:""}),ne&&c.a.createElement("i",{className:"icon-large-play"}),B&&c.a.createElement("div",{className:"media-loading "+D},c.a.createElement(aa.a,{progress:L,onClick:A?Q:void 0})),ce&&c.a.createElement("i",{className:"icon-download"}),R&&!j?c.a.createElement("span",{className:"message-upload-progress"},Math.round(100*L),"%"):R&&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-q)))},da=a(19);a(211);var ba=Object(s.h)((e,{contact:t})=>({user:Object(o.Bb)(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(J.a)("Contact",Boolean(o)&&"interactive"),onClick:o?i:void 0},c.a.createElement(Dt.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(da.c)(r))))}),ua=a(40);var ma=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(ua.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})))}),ha=a(117),Oa=a(169);a(214);function ja(e,t){return t>0?(e/t*100).toFixed():0}var ga=({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?ja(o.votersCount,a||0):0,[b,u]=Object(c.r)(r?0:d),m=Object(c.q)(null),h=o?ja(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(J.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(Ze.a)(e.text)),c.a.createElement("div",{className:Object(J.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(215);var fa=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:w,totalVoters:C}=b,E=w&&w.some(e=>e.isChosen),M=!d.closed&&!E,S=!M&&d.isPublic&&Number(b.totalVoters)>0,k=M&&d.multipleChoice,N=w?Math.max(...w.map(e=>e.votersCount)):C,P=w?w.reduce((e,t)=>(t.isCorrect&&e.push(t.option),e),[]):[],T=d.answers.map(e=>({label:e.text,value:e.option,hidden:Boolean(d.quiz&&d.closePeriod&&I<=0)}));Object(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||E&&!d.closed)&&n({chatId:l,messageId:i})},[l,I,E,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]),R=Object(c.m)(e=>{O([e]),m(!0),p(!0),r([e])},[r]),L=Object(c.m)(e=>{O(e)},[]),F=Object(c.m)(()=>{m(!0),p(!0),r(h)},[r,h]),B=Object(c.m)(()=>{o({chatId:l,messageId:i})},[l,i,o]),D=Object(c.m)(()=>{g(!0)},[]),U=Object(c.m)(()=>{g(!1),p(!1)},[]);Object(c.n)(()=>{if(f&&E&&d.quiz&&b.results&&t.results.solution){b.results.find(e=>e.isChosen&&e.isCorrect)||g(!0)}},[E,f,b.results,d.quiz,t.results.solution]);const H=Object(te.a)();return c.a.createElement("div",{className:"Poll"},j&&t.results.solution&&c.a.createElement(Oa.a,{message:Object(yt.b)(t.results.solution,t.results.solutionEntities),duration:5e3,onDismiss:U}),c.a.createElement("div",{className:"poll-question"},Object(Ze.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(Dt.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(ne.a,{round:!0,size:"tiny",color:"translucent",className:"poll-quiz-help",disabled:j,onClick:D,ariaLabel:"Show Solution"},c.a.createElement("i",{className:"icon-lamp"}))),M&&c.a.createElement("div",{className:"poll-answers"},k?c.a.createElement(ma,{options:T,onChange:L,disabled:e.isScheduled||u,loadingOptions:u?h:void 0,round:!0}):c.a.createElement(ha.a,{name:"poll-"+i,options:T,onChange:R,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(ga,{key:e.option,shouldAnimate:f,answer:e,voteResults:w,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(ne.a,{isText:!0,disabled:0===h.length,size:"tiny",onClick:F},H("PollSubmitVotes")),S&&c.a.createElement(ne.a,{isText:!0,size:"tiny",onClick:B},H("PollViewResults")))})),pa=a(145),Ia=a(52);a(216);var va=Object(c.h)(({message:e,observeIntersection:t,shouldAutoLoad:a,inPreview:s,onMediaClick:n,onCancelMediaTransfer:r})=>{const o=Object(m.P)(e);let i=!1;if(o&&o.photo){const{width:t,height:a}=Et(e);i=t===a}const l=Object(c.m)(()=>{o&&(i||o.hasDocument)?window.open(o.url):n&&n()},[o,i,n]);if(!o)return;const{siteName:d,url:b,displayUrl:u,title:h,description:O,photo:j}=o,g=Object(pa.a)(O,170),f=["WebPage",j?i&&"with-square-photo":!s&&"without-photo"].filter(Boolean).join(" ");return c.a.createElement("div",{className:f,"data-initial":(d||u)[0]},j&&c.a.createElement(sa,{message:e,observeIntersection:t,shouldAutoLoad:a,size:i?"pictogram":"inline",onClick:l,onCancelUpload:r}),c.a.createElement("div",{className:"WebPage-text"},c.a.createElement(Ia.a,{className:"site-name",url:b,text:d||u}),h&&c.a.createElement("p",{className:"site-title"},Object(Ze.a)(h)),g&&c.a.createElement("p",{className:"site-description"},Object(Ze.a)(g,["emoji","br"]))))});a(217);var ya=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(Ze.a)(a)),s&&c.a.createElement("p",null,Object(Ze.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(Ze.a)(n,["emoji","br"]))))});function wa(e){return Object(c.h)(Object(s.h)((e,t)=>{const{message:a}=t;return{isInSelectMode:Object(o.Q)(e),isSelected:Object(o.T)(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(J.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(218);const Ca=wa(sa),Ea=wa(la);var Ma=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&Pt&&I&Nt));return c.a.createElement(Ca,{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(Ea,{id:"album-media-"+e.id,message:e,observeIntersection:t,shouldAutoLoad:a,shouldAutoPlay:s,uploadProgress:f,lastSyncTime:r,dimensions:p,onClick:l,onCancelUpload:h})})))});a(219);function Sa(){return(Sa=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var s in a)Object.prototype.hasOwnProperty.call(a,s)&&(e[s]=a[s])}return e}).apply(this,arguments)}var ka=({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(Ot.b)(r,t),[b,u]=Object(c.r)(a&&s),h=Boolean(b&&d&&n),{mediaData:O,downloadProgress:j}=Object(Zt.a)(Object(m.D)(e,"inline"),!h,Object(m.C)(e,"inline"),n),g=ea(e,O),{isBuffered:f,bufferingHandlers:p}=Object(na.a)(),I=b&&!f,v=!1===Object(He.a)(b),{shouldRender:y,transitionClassNames:w}=Object(Y.a)(I||!f,void 0,v),{shouldRenderThumb:C,transitionClassNames:E}=Object(Wt.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);Object(c.n)(()=>{i.current&&(P?Object(ca.a)(i.current):i.current.pause())},[P]),ra(i,P),Object(oa.a)(i,[O]);const T=Object(c.m)(()=>{if(!O)return void u(e=>!e);const e=i.current;M?e.paused?Object(ca.a)(e):e.pause():(e.currentTime=0,S(!0))},[M,O]),A=Object(c.m)(e=>{const t=e.currentTarget;N(t.currentTime/t.duration)},[]),R=Object(c.m)(()=>{S(!1),N(0),Object(ca.a)(i.current),requestAnimationFrame(()=>{o.current.innerHTML=""})},[]),L=Object(J.a)("full-media",E);return c.a.createElement("div",{ref:r,className:"RoundVideo media-inner",onClick:T},C&&c.a.createElement("div",{className:"thumbnail-wrapper"},c.a.createElement("img",{src:g,className:"thumbnail",width:Je.d,height:Je.d,alt:""})),O&&c.a.createElement("div",{className:"video-wrapper"},c.a.createElement("video",Sa({ref:i,className:L,width:Je.d,height:Je.d,autoPlay:!0,muted:!M,loop:!M,playsInline:!0,poster:g,onEnded:M?R:void 0},p,{onTimeUpdate:M?A:void 0}),c.a.createElement("source",{src:O}))),c.a.createElement("div",{className:"progress",ref:o}),y&&c.a.createElement("div",{className:"media-loading "+w},c.a.createElement(aa.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(220);var Na=({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(ne.a,{size:"tiny",ripple:!0,disabled:"NOT_SUPPORTED"===e.type,onClick:()=>t({button:e})},e.text)))));a(221);var Pa=Object(c.h)(Object(s.h)((e,{message:t})=>{const{threadId:a,chatId:s}=t.threadInfo,n=Object(o.xb)(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{threadId:r,chatId:o,messagesCount:i,lastMessageId:l,lastReadInboxMessageId:d,recentReplierIds:b}=t,u=Object(c.m)(()=>{n({id:o,threadId:r})},[n,o,r]);if(void 0===i)return;const h=b&&b.map(e=>Object(m.lb)(e)?a[e]:s[e]).filter(Boolean);const O=Boolean(d&&l&&d<l);return c.a.createElement("div",{"data-cnt":Object($e.b)(i),className:Object(J.a)("CommentButton",O&&"has-unread",e&&"disabled"),onClick:u},c.a.createElement("i",{className:"icon-comments-sticker"}),(!h||0===h.length)&&c.a.createElement("i",{className:"icon-comments"}),h&&h.length>0&&c.a.createElement("div",{className:"recent-repliers"},h.map(e=>c.a.createElement(Dt.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"},function(e){if(0===e)return"Leave a Comment";if(1===e)return"1 Comment";return Object($e.a)(e)+" Comments"}(i)),c.a.createElement("i",{className:"icon-next"}))}));a(222);function Ta(e){const t=xa(e.currentTarget);t&&t.setAttribute("data-is-document-group-hover","")}function Aa(e){const t=xa(e.currentTarget);t&&t.removeAttribute("data-is-document-group-hover")}function xa(e){let t=e;do{t=t.nextElementSibling}while(t&&!t.classList.contains("last-in-document-group"));return t}var Ra=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.N)(e,h),I=f&&Object(m.jb)(f),v=!p&&Object(m.eb)(c),y=i||l||v?Object(o.ob)(e,c):void 0,w=Object(o.I)(e,c),C=O?Object(o.Bb)(e,O):void 0,E=d?Object(o.zb)(e,h,d):void 0,M=c.id===E,S=j===E,k=j&&!S?Object(o.k)(e,h,j):void 0,N=k&&Object(o.ob)(e,k),P=Object(o.Ab)(e,c),T="thread"===b&&(r?r.messages.some(t=>Object(o.S)(e,t)):Object(o.S)(e,c)),{direction:A,noHighlight:x}=T&&a||{},R=s.messageIds&&s.messageIds.includes(u),{query:L}=Object(o.z)(e)||{},F=Object(m.K)(c);let B;return B=r&&r.messages?r.messages.every(({id:t})=>Object(o.T)(e,t)):Object(o.T)(e,u),{forceSenderName:v,sender:y,originSender:w,botSender:C,shouldHideReply:S,isThreadTop:M,replyMessage:k,replyMessageSender:N,...g&&{outgoingStatus:Object(o.ab)(e,c,"scheduled"===b)},..."number"==typeof P&&{uploadProgress:P},isFocused:T,...T&&{focusDirection:A,noFocusHighlight:x},isForwarding:R,isChatWithSelf:p,isChannel:I,lastSyncTime:n,highlight:L,isSingleEmoji:Boolean(F),animatedEmoji:F?Object(o.c)(e,F):void 0,isInSelectMode:Object(o.Q)(e),isSelected:B,isGroupSelected:!!c.groupedId&&!c.isInAlbum&&Object(o.O)(e,h,c.groupedId),threadId:d,isPinnedList:"pinned"===b,shouldAutoLoadMedia:f?Object(o.pb)(e,c,f,y):void 0,shouldAutoPlayMedia:Object(o.qb)(e,c),shouldLoopStickers:Object(o.rb)(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,isFirstInGroup:b,isLastInGroup:u,isFirstInDocumentGroup:h,isLastInDocumentGroup:O,isLastInList:j,forceSenderName:g,sender:f,originSender:p,botSender:I,isThreadTop:v,shouldHideReply:y,replyMessage:w,replyMessageSender:C,outgoingStatus:E,uploadProgress:M,isFocused:S,focusDirection:k,noFocusHighlight:N,isForwarding:P,isChatWithSelf:T,isChannel:A,lastSyncTime:x,highlight:R,animatedEmoji:L,isInSelectMode:F,isSelected:B,isGroupSelected:D,threadId:U,messageListType:H,isPinnedList:q,shouldAutoLoadMedia:G,shouldAutoPlayMedia:_,shouldLoopStickers:z,focusMessage:V,openMediaViewer:$,openAudioPlayer:W,openUserInfo:Q,openChat:K,cancelSendingMessage:Y,markMessagesRead:Z,sendPollVote:X,toggleMessageSelection:ee,setReplyingToId:ae,openForwardMenu:se,clickInlineButton:ce})=>{const re=Object(c.q)(null),oe=Object(c.q)(null),ie=Object(c.q)(null);Object(Ot.c)(oe,t);const{width:le}=Ue(),{isContextMenuOpen:de,contextMenuPosition:be,handleBeforeContextMenu:ue,handleContextMenu:me,handleContextMenuClose:he,handleContextMenuHide:Oe}=Object(vt.a)(re),{chatId:je,id:ge,threadInfo:fe}=e,pe=Object(m.tb)(e),Ie="scheduled"===H||e.isScheduled,ve=Object(m.ub)(e)&&!y,ye=Boolean(fe)&&"thread"===H,{forwardInfo:we,viaBotId:Ce}=e,Ee=we&&!T&&!we.isLinkedChannelPost,Me=!!e.groupedId&&!e.isInAlbum,Se=Boolean(n)&&n.messages.length>1,{text:ke,photo:Ne,video:Pe,audio:Te,voice:Ae,document:xe,sticker:Re,contact:Le,poll:Fe,webPage:Be,invoice:De}=Object(m.v)(e),He=Object(m.x)(e),qe=Object(yt.a)(e,R,wt(He)),Ge=void 0!==be,_e=Object(J.a)("Message message-list-item",b&&"first-in-group",u&&"last-in-group",h&&"first-in-document-group",O&&"last-in-document-group",j&&"last-in-list",pe&&"own",Boolean(e.views)&&"has-views",e.isEdited&&"was-edited",ve&&"has-reply",Ge&&"has-menu-open",S&&!N&&"focused",P&&"is-forwarding",e.isDeleting&&"is-deleting",Me&&"is-in-document-group",Se&&"is-album",e.hasUnreadMention&&"has-unread-mention",B&&"is-selected",F&&"is-in-selection-mode",v&&"is-thread-top",Boolean(e.inlineButtons)&&"has-inline-buttons"),Ve=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 wt(a)?f.push("emoji-only emoji-only-"+a):i&&f.push("text"),a&&(f.push("custom-shape"),d&&d.isRound&&f.push("round"),o&&f.push("has-comments")),l||d?f.push("media"):b?f.push("audio"):u?f.push("voice"):h?f.push("document"):g?f.push("contact"):O?f.push("poll"):j&&(f.push("web-page"),j.photo&&f.push("media")),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:ve,customShape:He,isLastInGroup:u,asForwarded:Ee,hasThread:ye,forceSenderName:g,hasComments:e.threadInfo&&e.threadInfo.messagesCount>0}),$e=!we||!T&&f?f:p,We=we?p:f,Qe=A&&e.adminTitle||we&&!Ee&&we.adminTitle||void 0;Object(ze.a)(je,ve?e.replyToMessageId:void 0,w,e.id),Bt(re,je,S,k,N),Object(c.n)(()=>{ie.current&&(ie.current.innerHTML=pe?'<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>')},[pe]);const Ke=Object(c.m)(t=>{t.stopPropagation(),ee({messageId:ge,groupedId:e.groupedId})},[ge,e.groupedId,ee]),Ye=Object(c.m)(e=>{const t=Se&&n&&n.messages?{messageId:ge,childMessageIds:n.messages.map(({id:e})=>e),withShift:e&&e.shiftKey}:{messageId:ge,withShift:e&&e.shiftKey};ee(t)},[ee,ge,Se,n]),Xe=Object(c.m)(()=>{ae({messageId:ge})},[ae,ge]),et=Object(c.m)(e=>{e.stopPropagation()},[]),tt=Object(c.m)(()=>{$e&&(Object(m.lb)($e.id)?Q({id:$e.id}):K({id:$e.id}))},[$e,Q,K]),at=Object(c.m)(()=>{We&&(Object(m.lb)(We.id)?Q({id:We.id}):K({id:We.id}))},[We,Q,K]),st=Object(c.m)(()=>{I&&Q({id:I.id})},[I,Q]),nt=Object(c.m)(()=>{V({chatId:je,threadId:U,messageId:e.replyToMessageId})},[V,je,U,e.replyToMessageId]),ct=Object(c.m)(()=>{$({chatId:je,threadId:U,messageId:ge,origin:Ie?l.h.ScheduledInline:l.h.Inline})},[je,U,ge,$,Ie]),rt=Object(c.m)(()=>{W({chatId:je,messageId:ge})},[je,ge,W]),ot=Object(c.m)(e=>{$({chatId:je,threadId:U,messageId:e,origin:Ie?l.h.ScheduledAlbum:l.h.Album})},[je,U,$,Ie]),it=Object(c.m)(()=>{Z({messageIds:[ge]})},[ge,Z]),lt=Object(c.m)(()=>{Y({chatId:je,messageId:ge})},[Y,je,ge]),dt=Object(c.m)(e=>{X({chatId:je,messageId:ge,options:e})},[je,ge,X]),bt=Object(c.m)(()=>{se({fromChatId:je,groupedId:e.groupedId})},[se,je,e.groupedId]),ut=Object(c.m)(()=>{if(n&&n.messages){const e=n.messages.map(({id:e})=>e);se({fromChatId:je,messageIds:e})}else se({fromChatId:je,messageIds:[ge]})},[n,se,je,ge]),mt=Object(c.m)(()=>{V({chatId:je,threadId:i.MAIN_THREAD_ID,messageId:ge})},[V,je,ge]),ht=Object(c.m)(()=>{V(Me?{chatId:we.fromChatId,groupedId:e.groupedId,groupedChatId:je}:{chatId:we.fromChatId,messageId:we.fromMessageId})},[V,we,e,je,Me]),jt=Object(te.a)();let gt,ft="";const pt=Object(c.p)(()=>Se?Rt(pe,Boolean(Ee),n,le):void 0,[Se,le,pe,Ee,n]),It=Ee?28:0;if(Se||!Ne&&!Pe)pt&&(gt=Math.max(Ct(Boolean(ke)),pt.containerStyle.width));else{let t;Ne?t=Et(e).width:Pe&&(t=Pe.isRound?Je.d:Et(e).width),t&&(gt=Math.max(Ct(Boolean(ke)),t))}gt&&(ft=`width: ${gt+It}px`);const Mt=Object(c.p)(()=>Qe?Ft(Qe):void 0,[Qe]),St=!(Ge||F||P)&&(!Me||O),kt=St&&A&&!Ie,Nt=St&&(we&&(we.isChannelPost||T&&!pe)&&we.fromMessageId||q),Pt=e.threadInfo&&(!Me||O)&&"thread"===H&&!d;return c.a.createElement("div",{ref:re,id:"message"+ge,className:_e,style:Mt?`--meta-safe-author-width: ${Mt}px`:void 0,"data-message-id":ge,onClick:F?Ye:void 0,onDoubleClick:F?void 0:Xe,onMouseDown:F?void 0:ue,onContextMenu:F?void 0:me,onMouseEnter:Me&&!O?Ta:void 0,onMouseLeave:Me&&!O?Aa:void 0},c.a.createElement("div",{ref:oe,className:"bottom-marker","data-message-id":ge,"data-last-message-id":n?n.messages[n.messages.length-1].id:void 0,"data-has-unread-mention":e.hasUnreadMention}),!Me&&c.a.createElement("div",{className:"message-select-control"},B&&c.a.createElement("i",{className:"icon-select"})),O&&c.a.createElement("div",{className:Object(J.a)("message-select-control group-select",D&&"is-selected"),onClick:Ke},D&&c.a.createElement("i",{className:"icon-select"})),r&&function(){const e=$e&&Object(m.lb)($e.id),t=$e&&e?$e:void 0,a=$e&&!e?$e:void 0,s=!$e&&we?we.hiddenUserName:void 0;return c.a.createElement(Dt.a,{size:"small",user:t,chat:a,text:s,lastSyncTime:x,onClick:t||a?tt:void 0})}(),c.a.createElement("div",{className:"message-content-wrapper",onClick:F&&Me?Ye:void 0},c.a.createElement("div",{className:Ve,style:ft},Ve.includes("has-appendix")&&c.a.createElement("div",{className:"svg-appendix",ref:ie}),Ee&&!He&&(!Me||h)&&c.a.createElement("div",{className:"message-title"},jt("ForwardedMessage")),function(){const t=Object(J.a)("content-inner",Ee&&!He&&"forwarded-message",ve&&"reply-message"),r=u&&!qe&&!Ee&&!ye;return c.a.createElement("div",{className:t,onDoubleClick:et},function(){if(He||!(o&&!Ne&&!Pe||Ee||Ce||g)||Me&&!h)return;let t,a;We?(t=Object(m.U)(We),Ee||(a="color-"+Object(m.X)(We))):we&&we.hiddenUserName&&(t=we.hiddenUserName);return c.a.createElement("div",{className:"message-title"},t?c.a.createElement("span",{className:Object(J.a)(We&&"interactive",a),onClick:We?at:void 0},Object(Ze.a)(t)):I?void 0:" ",I&&c.a.createElement(c.a.Fragment,null,c.a.createElement("span",{className:"via"},jt("ViaBot")),c.a.createElement("span",{className:"interactive",onClick:st},Object(Ze.a)("@"+I.username))),we&&we.isLinkedChannelPost?c.a.createElement("span",{className:"admin-title"},jt("DiscussChannel")):e.adminTitle&&!A?c.a.createElement("span",{className:"admin-title"},e.adminTitle):void 0)}(),ve&&c.a.createElement(Gt,{message:w,sender:C,observeIntersection:a,onClick:nt}),Re&&c.a.createElement(Yt,{message:e,observeIntersection:a,observeIntersectionForPlaying:s,shouldLoop:z,lastSyncTime:x}),L&&c.a.createElement(Jt.a,{isInline:!0,sticker:L,observeIntersection:a,lastSyncTime:x}),Se&&c.a.createElement(Ma,{album:n,albumLayout:pt,observeIntersection:a,shouldAutoLoad:G,shouldAutoPlay:_,isOwn:pe,hasCustomAppendix:r,lastSyncTime:x,onMediaClick:ot}),!Se&&Ne&&c.a.createElement(sa,{message:e,observeIntersection:a,shouldAutoLoad:G,uploadProgress:M,shouldAffectAppendix:r,onClick:ct,onCancelUpload:lt}),!Se&&Pe&&Pe.isRound&&c.a.createElement(ka,{message:e,observeIntersection:a,shouldAutoLoad:G,shouldAutoPlay:_,lastSyncTime:x}),!Se&&Pe&&!Pe.isRound&&c.a.createElement(la,{message:e,observeIntersection:a,shouldAutoLoad:G,shouldAutoPlay:_,uploadProgress:M,lastSyncTime:x,onClick:ct,onCancelUpload:lt}),(Te||Ae)&&c.a.createElement(zt.a,{message:e,uploadProgress:M,lastSyncTime:x,isSelectable:Me,isSelected:B,onPlay:rt,onReadMedia:!Ae||pe&&!T?void 0:it,onCancelUpload:lt}),xe&&c.a.createElement(_t.a,{message:e,observeIntersection:a,uploadProgress:M,isSelectable:Me,isSelected:B,onCancelUpload:lt}),Le&&c.a.createElement(ba,{contact:Le}),Fe&&c.a.createElement(fa,{message:e,poll:Fe,onSendVote:dt}),!L&&qe&&c.a.createElement("p",{className:"text-content"},qe),Be&&c.a.createElement(va,{message:e,observeIntersection:a,shouldAutoLoad:G,onMediaClick:ct,onCancelMediaTransfer:lt}),De&&c.a.createElement(ya,{message:e}))}(),(!Me||O)&&c.a.createElement($t,{message:e,outgoingStatus:E,signature:Qe,onClick:Ye}),kt?c.a.createElement(ne.a,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:"Forward message",onClick:O?bt:ut},c.a.createElement("i",{className:"icon-share-filled"})):Nt?c.a.createElement(ne.a,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:"Focus message",onClick:q?mt:ht},c.a.createElement("i",{className:"icon-arrow-right"})):void 0,Pt&&c.a.createElement(Pa,{message:e,disabled:d})),e.inlineButtons&&c.a.createElement(Na,{message:e,onClick:ce})),be&&c.a.createElement(Ht,{isOpen:de,anchor:be,message:e,album:n,messageListType:H,onClose:he,onCloseAnimationEnd:Oe}))}));a(223);const La=h.b?1e3:350,Fa=h.f?300:500,Ba=Object(g.a)(e=>e(),200,!1),Da=Object(g.j)(e=>e());function Ua(e,t,a,s,r,o,i,l,b,u,h,O,j,g=!1){const f=c.a.createElement("div",{className:Object(J.a)("unread-divider","local-action-message"),key:"unread-messages"},c.a.createElement("span",null,e("UnreadMessages"))),p=t.map((t,p,I)=>{const v=t.senderGroups.map((t,n,g)=>{if(1===t.length&&!mt(t[0])&&Object(m.db)(t[0])){const e=t[0];return Object(d.e)([e.id===l.current&&f,c.a.createElement(qt,{key:e.id,message:e,observeIntersection:a})])}let v;return Object(d.h)(t.map((y,w)=>{const C=mt(y)?y.mainMessage:y,E=mt(y)?y:void 0,M=Object(m.tb)(C),S=mt(y),k=t[w+1];C.previousLocalId&&i.current==="message"+C.previousLocalId&&(i.current="message"+C.id);const N=!S&&C.groupedId?C.groupedId:void 0,P=k&&!mt(k)?k.groupedId:void 0,T={isFirstInGroup:0===w,isLastInGroup:w===t.length-1,isFirstInDocumentGroup:Boolean(N&&N!==v),isLastInDocumentGroup:Boolean(N&&N!==P),isLastInList:w===t.length-1&&n===g.length-1&&p===I.length-1};v=N;const A=C.id===l.current&&l.current!==O||C.id===h&&l.current===O,x=Object(m.F)(C),R="scheduled"!==u?x:`${C.date}_${x}`;return Object(d.e)([A&&f,c.a.createElement(Ra,{key:R,message:C,observeIntersectionForBottom:a,observeIntersectionForMedia:s,observeIntersectionForAnimatedStickers:r,album:E,withAvatar:T.isLastInGroup&&o&&!M&&!(C.id===h),withSenderName:T.isFirstInGroup&&o&&!M,threadId:b,messageListType:u,noComments:!1===j,isFirstInGroup:T.isFirstInGroup,isLastInGroup:T.isLastInGroup,isFirstInDocumentGroup:T.isFirstInDocumentGroup,isLastInDocumentGroup:T.isLastInDocumentGroup,isLastInList:T.isLastInList}),C.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",null,g&&t.originalDate===n.ab&&e("MessageScheduledUntilOnline"),g&&t.originalDate!==n.ab&&e("MessageScheduledOn",Object(x.c)(t.datetime,void 0,!0)),!g&&Object(x.c)(t.datetime))),Object(d.h)(v))});return Object(d.h)(p)}var Ha=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.w)(e,t,a,s),r="scheduled"===s?Object(o.lb)(e,t):Object(o.m)(e,t),l=Object(o.zb)(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.G)(e,t),O=a===i.MAIN_THREAD_ID&&!c&&!n.unreadCount&&!h&&u&&!u.groupedId;let j;if(Object(o.J)(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),canPost:Object(m.e)(n,a),isChatWithSelf:Object(o.N)(e,t),messageIds:c,messagesById:r,firstUnreadId:Object(o.F)(e,t,a),isViewportNewest:"thread"!==s||Object(o.V)(e,t,a),threadFirstMessageId:Object(o.E)(e,t,a),focusingId:h,isSelectModeActive:Object(o.Q)(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,isChatLoaded:b,isChannelChat:u,canPost:O,bottomOffset:j,isChatWithSelf:f,messageIds:p,messagesById:I,firstUnreadId:v,isViewportNewest:y,threadFirstMessageId:w,isRestricted:C,restrictionReason:E,focusingId:M,isSelectModeActive:S,animationLevel:k,loadViewportMessages:N,markMessageListRead:P,markMessagesRead:T,setScrollOffset:A,lastMessage:x,botDescription:R,threadTopMessageId:L,hasLinkedChat:F})=>{const B=Object(c.q)(null),D=Object(c.q)(),U=Object(c.q)(),H=Object(c.q)(),q=Object(c.q)(),G=Object(c.q)(),_=Object(c.q)(),z=Object(c.q)(),V=Object(c.q)(!1),[$,W]=Object(c.r)(),[Q,Y]=Object(c.r)(Boolean(M));Object(me.a)(()=>{U.current=void 0,G.current=v,D.current="thread"===a&&Object(o.mb)(Object(s.e)(),e,t)||0},[Boolean(p)]),Object(me.a)(()=>{_.current=v},[v]);const{observe:Z,freeze:X,unfreeze:ee}=Object(Ot.a)({rootRef:B,throttleMs:La,margin:Fa}),{observe:ae,freeze:se,unfreeze:ne}=Object(Ot.a)({rootRef:B},e=>{if("thread"!==a)return;let t=0;const s=[];e.forEach(e=>{const{isIntersecting:a,target:n}=e;if(!a)return;const{dataset:c}=n,r=Number(c.lastMessageId||c.messageId);r>t&&(t=r),c.hasUnreadMention&&s.push(r)}),_.current&&t>=_.current&&P({maxId:t}),s.length&&T({messageIds:s})});Object(me.a)(()=>{z.current=M,M?(X(),se()):(ne(),ee())},[M]);const{observe:ce}=Object(Ot.a)({rootRef:B,throttleMs:La});Object(c.n)(()=>{M?Y(!0):setTimeout(()=>{Y(!1)},200)},[M]);const re=Object(c.p)(()=>{if(!p||!I)return;const e=!L||p[0]&&w!==p[0]?p:[L,...p];if(!e.length)return;const t=e.map(e=>I[e]);return ht(Object(d.k)(t,["date","id"]),G.current)},[p,I,w,L]),[oe,ie,le]=Object(c.p)(()=>"thread"===a?[Object(g.a)(()=>N({direction:l.e.Backwards}),1e3,!0,!1),Object(g.a)(()=>N({direction:l.e.Forwards}),1e3,!0,!1),Object(g.a)(()=>N({direction:l.e.Around}),1e3,!0,!1)]:[],[N,p]),{isScrolled:de,updateStickyDates:be}=jt(),ue=Object(c.m)(()=>{if(V.current)return void(V.current=!1);const s=B.current;z.current||be(s,r),Ba(()=>{Object(g.b)(()=>{s.parentElement&&(D.current=s.scrollHeight-s.scrollTop,"thread"===a&&A({chatId:e,threadId:t,scrollOffset:D.current}))})})},[be,r,a,A,e,t]);Object(c.n)(()=>{if(!("ResizeObserver"in window))return;const e=new ResizeObserver(([e])=>{e.target.offsetParent&&W(e.contentRect.height)});return e.observe(B.current),()=>{e.disconnect()}},[]),Object(c.o)(()=>{h.d&&Da(()=>{if(!B.current.querySelector(".AnimatedSticker.is-playing"))return;const e=B.current.style;e.webkitOverflowScrolling="auto"===e.webkitOverflowScrolling?"":"auto"})}),Object(c.n)(()=>{if(!le||!b||C||M)return;const e=B.current;(!p||p.length<n.N/2&&e.firstElementChild.clientHeight<=e.offsetHeight)&&le()},[b,p,le,M,C]),Object(ut.a)(([e,t,a])=>{const s=B.current;if(q.current=Array.from(s.querySelectorAll(".message-list-item")),!s.offsetParent)return;const c=y&&p&&p.length<n.N/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=D.current,b=q.current[q.current.length-1],u=b?b.offsetHeight:0,m=y&&t&&d-(a||l)-u<=100;let h;const O=p&&e&&p[0]!==e[0],j=p&&e&&p[p.length-1]!==e[e.length-1];if(m&&j&&!O&&(b&&Object(g.b)(()=>{Object(ft.a)(s,b,"end",20)}),h=i-l,D.current=Math.max(i-h,l),!c))return;const f=void 0!==a&&a!==$,I=U.current&&s.querySelector("#"+U.current),v=!I&&G.current&&s.querySelector(".unread-divider");if(m&&f)h=i-l;else if(I){h=o+(I.getBoundingClientRect().top-(H.current||0))}else h=v?v.offsetTop-(r?60:10):i-d;Object(gt.a)(s,h),z.current||(V.current=!0,Object(g.b)(()=>{V.current=!1})),D.current=Math.max(i-h,l)},[p,y,$,r]),Object(c.n)(()=>{(!k||k>0)&&Object(K.b)(200+n.c)},[k,S]);const he=Object(te.a)(),Oe=Boolean(e&&Object(m.lb)(e)),je=Boolean(!Oe&&!u||f),ge=Object(J.a)("MessageList custom-scroll",!je&&"no-avatars",u&&"no-avatars",(!O||"none"!==j)&&"bottom-padding","none"!==j&&"bottom-padding-"+j,S&&"select-mode-active",Q&&"has-focusing",de&&"scrolled");return c.a.createElement("div",{ref:B,className:ge,onScroll:ue},C?c.a.createElement("div",{className:"empty"},c.a.createElement("span",null,E?E.text:"This is a private "+(u?"channel":"chat"))):R?c.a.createElement("div",{className:"empty rich"},c.a.createElement("span",null,Object(Ze.a)(he(R),["br","emoji","links"]))):p&&re?c.a.createElement(It,{containerRef:B,className:"messages-container",messageIds:p,containerHeight:$,listItemElementsRef:q,focusingId:M,anchorIdRef:U,anchorTopRef:H,loadMoreForwards:ie,loadMoreBackwards:oe,isViewportNewest:y,firstUnreadId:v,onFabToggle:i},re&&Ua(he,re,ae,Z,ce,je,U,G,t,a,L,w,F,"scheduled"===a)):p?c.a.createElement("div",{className:"empty"},c.a.createElement("span",null,he("NoMessages"))):x?c.a.createElement("div",{className:"messages-container"},Ua(he,ht([x]),ae,Z,ce,je,U,G,t,a,L,w,F,!1)):c.a.createElement(ve.a,{color:"white"}))}));a(224);var qa=Object(c.h)(Object(s.h)(e=>{const t=Object(o.x)(e);if(!t)return{};const{chatId:a,threadId:s,type:n}=t,c=Object(o.f)(e,a);return{messageListType:n,canPost:c&&Object(m.e)(c,s),unreadCount:c&&s===i.MAIN_THREAD_ID&&"thread"===n?c.unreadCount:void 0}},(e,t)=>Object(d.l)(t,["focusLastMessage"]))(({isShown:e,messageListType:t,canPost:a,unreadCount:s,focusLastMessage:n})=>{const r=Object(c.q)(null),o=Object(c.m)(()=>{if(e)if("thread"===t)n();else{const e=r.current.parentElement.querySelector(".MessageList"),t=e.querySelectorAll(".message-list-item"),a=t[t.length-1];if(!a)return;Object(ft.a)(e,a,"end",20)}},[e,t,n]),i=Object(J.a)("ScrollDownButton",e&&"revealed",!a&&"no-composer");return c.a.createElement("div",{ref:r,className:i},c.a.createElement("div",{className:"ScrollDownButton-inner"},c.a.createElement(ne.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($e.b)(s))))})),Ga=a(122),_a=a(123),za=a(14);async function Va(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(za.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),Va(e,c,!0,s)):Va(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(za.h)(n);o={width:e,height:t,duration:a}}i=await Object(za.c)(n)}return{blobUrl:n,filename:e,mimeType:c,size:r,quick:o,previewBlobUrl:i,...s}}var $a=a(170),Wa=a.p+"8ccc0b555efcec3616377aea078dda16.js";const Qa={encoderPath:Wa,reuseWorker:!0},Ka={type:"audio/ogg"};let Ya,Ja,Za;async function Xa(){return Ya||(Ya=a.e(10).then(a.t.bind(null,302,7)),Ja=(await Ya).default,Za=new Ja(Qa)),Ya}async function es(e){await async function(){await Xa(),await Za.start()}();const t=Date.now();let a;const s=[],n=[];Za.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}}(Za,t=>{n.push(255*t),e(t)});return{stop:()=>new Promise((e,r)=>{Za.onstop=()=>{e({blob:new Blob(s,Ka),duration:Math.round(((a||Date.now())-t)/1e3),waveform:n})},Za.onerror=r;const o=Math.max(0,t+1e3-Date.now());setTimeout(()=>{Za.stop(),c()},o)}),pause:()=>{const e=Math.max(0,t+1e3-Date.now());setTimeout(()=>{Za.pause(),a=Date.now(),c()},e)}}}const ts=["image/png","image/jpeg","image/gif"];function as(e){const{text:t,entities:a}=e||{};if(!t)return"";const s=Object(yt.b)(t,a,void 0,void 0,!0);return Array.isArray(s)?s.join(""):s}let ss,ns;var cs=a(58);var rs=a(178);var os=e=>{const{isOpen:t}=e,a=Object(Ie.a)(pe.a.Extra,"DeleteMessageModal",!t);return a?c.a.createElement(a,e):void 0};function is(){return(is=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 ls,ds=!0;var bs=Object(c.h)(({onActivate:e,...t})=>{const a=Object(c.q)(!1),s=Object(c.m)(()=>{if(a.current=!0,ds)return ds=!1,void e();ls&&(clearTimeout(ls),ls=void 0),ls=window.setTimeout(()=>{a.current&&e()},200)},[e]),n=Object(c.m)(()=>{a.current=!1},[]);return c.a.createElement(ne.a,is({},t,{onMouseEnter:h.k?void 0:s,onMouseLeave:h.k?void 0:n,onClick:h.k?e:void 0}))});var us=e=>{const{isOpen:t}=e,a=Object(Ie.a)(pe.a.Extra,"AttachMenu",!t);return a?c.a.createElement(a,e):void 0};var ms=e=>{const{isOpen:t}=e,a=Object(Ie.a)(pe.a.Extra,"SymbolMenu",!t);return a?c.a.createElement(a,e):void 0};var hs=e=>{const{isOpen:t}=e,a=Object(Ie.a)(pe.a.Extra,"MentionMenu",!t);return a?c.a.createElement(a,e):void 0};var Os=e=>{const{isOpen:t}=e,a=Object(Ie.a)(pe.a.Extra,"CustomSendMenu",!t);return a?c.a.createElement(a,e):void 0};var js=e=>{const{isOpen:t}=e,a=Object(Ie.a)(pe.a.Extra,"EmojiTooltip",!t);return a?c.a.createElement(a,e):void 0};var gs=e=>{const{isOpen:t}=e,a=Object(Ie.a)(pe.a.Extra,"BotKeyboardMenu",!t);return a?c.a.createElement(a,e):void 0},fs=a(171),ps=a(109);a(226);var Is=Object(c.h)(Object(s.h)(e=>{const{chatId:t,threadId:a,type:s}=Object(o.x)(e)||{};if(!t||!a||!s)return{};const{currentUserId:n,forwardMessages:{fromChatId:c,toChatId:r,messageIds:i}}=e,l=Object(o.hb)(e,t,a),d="scheduled"===s?Object(o.D)(e,t):Object(o.B)(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.C)(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.I)(e,h)),O||(O=Object(o.ob)(e,h))}else u&&(O=Object(m.lb)(c)?Object(o.Bb)(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(ps.a)([r],r?300:void 0),{shouldRender:m,transitionClassNames:h}=Object(Y.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(Z.a)(O):void 0,[b,O]);const j=Object(c.m)(()=>{l({chatId:a.chatId,messageId:a.id})},[l,a]),g=Object(J.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(ne.a,{round:!0,color:"translucent",ariaLabel:"Cancel replying",onClick:O},c.a.createElement("i",{className:"icon-close"})),c.a.createElement(Gt,{className:"inside-input",message:a,sender:s,customText:f,title:t?"Edit Message":void 0,onClick:j})))}));var vs=e=>{const{attachments:t}=e,a=Object(Ie.a)(pe.a.Extra,"AttachmentModal",!t.length);return a?c.a.createElement(a,e):void 0};var ys=e=>{const{isOpen:t}=e,a=Object(Ie.a)(pe.a.Extra,"PollModal",!t);return a?c.a.createElement(a,e):void 0};var ws=e=>{const{isOpen:t}=e,a=Object(Ie.a)(pe.a.Extra,"DropArea",!t);return a?c.a.createElement(a,e):void 0};a(227);const Cs=/https?:\/\/(www.)?([a-zA-Z0-9.-]{2,256})([a-zA-Z/.-]{1,256})([?|#][=&#a-zA-Z0-9]{2,128})?/;var Es=Object(c.h)(Object(s.h)(e=>Object(d.l)(e,["webPagePreview"]),(e,t)=>Object(d.l)(t,["loadWebPagePreview","clearWebPagePreview"]))(({chatId:e,messageText:t,webPagePreview:a,loadWebPagePreview:s,clearWebPagePreview:n})=>{const r=Object(c.p)(()=>{const{text:e,entities:a}=Object(_a.a)(t),s=a&&a.find(({type:e})=>e===i.ApiMessageEntityTypes.TextUrl);if(s)return s.url;const n=e.match(Cs);return n?n[0]:void 0},[t]);if(Object(c.n)(()=>{r?s({text:r}):n()},[n,r,s]),Object(me.a)(()=>{n()},[e]),!a||!t.length)return;const{photo:o,...l}=a,d={content:{webPage:l}};return c.a.createElement("div",{className:"WebPagePreview"},c.a.createElement(va,{message:d,inPreview:!0}))})),Ms=a(114);var Ss=e=>{const{isOpen:t}=e,a=Object(Ie.a)(pe.a.Extra,"CalendarModal",!t);return a?c.a.createElement(a,e):void 0};var ks=e=>{const{isOpen:t}=e,a=Object(Ie.a)(pe.a.Extra,"PaymentModal",!t);return a?c.a.createElement(a,e):void 0};var Ns,Ps=e=>{const{isOpen:t}=e,a=Object(Ie.a)(pe.a.Extra,"ReceiptModal",!t);return a?c.a.createElement(a,e):void 0};a(228);!function(e){e.Send="send",e.Record="record",e.Edit="edit"}(Ns||(Ns={}));var Ts=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.M)(e,n):void 0,l=Object(o.N)(e,t),d=r&&Object(o.Z)(e,t),b=Object(o.jb)(e,t);return{editingMessage:Object(o.C)(e,t,a,s),connectionState:e.connectionState,draft:Object(o.A)(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.U)(e),isSelectModeActive:Object(o.Q)(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}},(e,t)=>Object(d.l)(t,["sendMessage","editMessage","saveDraft","clearDraft","showError","setStickerSearchQuery","setGifSearchQuery","forwardMessages","openPollModal","closePollModal","closePaymentModal","clearReceipt","loadScheduledHistory","openChat"]))(({dropAreaState:e,shouldSchedule:t,canScheduleUntilOnline:a,onDropHide:r,editingMessage:o,chatId:l,threadId:d,messageListType:b,draft:u,chat:O,connectionState:j,isChatWithBot:f,isChatWithSelf:p,isRightColumnShown:I,isSelectModeActive:v,isForwarding:y,canSuggestMembers:w,isPollModalOpen:C,isPaymentModalOpen:E,isReceiptModalOpen:M,botKeyboardMessageId:S,withScheduledButton:k,stickersForEmoji:N,groupChatMembers:P,currentUserId:T,usersById:A,lastSyncTime:R,contentToBeScheduled:L,shouldSuggestStickers:F,sendMessage:B,editMessage:D,saveDraft:U,clearDraft:H,showError:q,setStickerSearchQuery:G,setGifSearchQuery:_,forwardMessages:z,openPollModal:V,closePollModal:$,loadScheduledHistory:W,closePaymentModal:Q,openChat:K,clearReceipt:Y})=>{const X=Object(c.q)(null),[ee,ae]=Object(c.r)(""),se=Object(c.q)(),ce=Object(He.a)(e),[re,oe,ie]=Object(nt.a)(),[le,be]=Object(c.r)(),ue=Object(c.q)(ee);Object(c.n)(()=>{ue.current=ee},[ee]),Object(c.n)(()=>{se.current=void 0},[l]),Object(c.n)(()=>{l&&R&&d===i.MAIN_THREAD_ID&&W()},[l,W,R,d]),Object(c.n)(()=>{X.current&&(X.current.innerHTML='<svg width="9" height="20" xmlns="http://www.w3.org/2000/svg"><defs><filter x="-50%" y="-14.7%" width="200%" height="141.2%" filterUnits="objectBoundingBox" id="a"><feOffset dy="1" in="SourceAlpha" result="shadowOffsetOuter1"/><feGaussianBlur stdDeviation="1" in="shadowOffsetOuter1" result="shadowBlurOuter1"/><feColorMatrix values="0 0 0 0 0.0621962482 0 0 0 0 0.138574144 0 0 0 0 0.185037364 0 0 0 0.15 0" in="shadowBlurOuter1"/></filter></defs><g fill="none" fill-rule="evenodd"><path d="M6 17H0V0c.193 2.84.876 5.767 2.05 8.782.904 2.325 2.446 4.485 4.625 6.48A1 1 0 016 17z" fill="#000" filter="url(#a)"/><path d="M6 17H0V0c.193 2.84.876 5.767 2.05 8.782.904 2.325 2.446 4.485 4.625 6.48A1 1 0 016 17z" fill="#FFF" class="corner"/></g></svg>')},[]),Object(c.n)(()=>{L&&(be(L),oe())},[L,oe]);const[me,he]=Object(c.r)([]),[Oe,je,ge]=Object(nt.a)(),[fe,pe,Ie]=Object(nt.a)(),[ve,ye,we]=Object(nt.a)(),[Ce,Ee,Me]=Object(nt.a)(),[Se,ke]=Object(nt.a)(),[Ne,Pe,Te]=Object(nt.a)(),{startRecordingVoice:Ae,stopRecordingVoice:xe,pauseRecordingVoice:Re,activeVoiceRecording:Le,currentRecordTime:Be,recordButtonRef:De,startRecordTimeRef:Ue}=(()=>{const e=Object(c.q)(null),[t,a]=Object(c.r)(),s=Object(c.q)(),[n,r]=Object(c.r)();Object(c.n)(()=>{h.d&&Xa()},[]);const o=Object(c.m)(async()=>{try{const{stop:t,pause:n}=await es(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(Z.a)(l):void 0,[t,l]),{startRecordingVoice:o,pauseRecordingVoice:i,stopRecordingVoice:l,activeVoiceRecording:t,currentRecordTime:n,recordButtonRef:e,startRecordTimeRef:s}})(),qe=o?Ns.Edit:!h.l||Le||ee&&!me.length||y?Ns.Send:Ns.Record,Ge=!t,{isMentionMenuOpen:_e,mentionFilter:ze,closeMentionMenu:Ve,insertMention:$e,mentionFilteredMembers:We}=Object(rs.a)(w&&!me.length,ee,ae,void 0,P,T,A),{isContextMenuOpen:Qe,handleContextMenu:Ke,handleContextMenuClose:Ye,handleContextMenuHide:Je}=Object(vt.a)(De,!(qe===Ns.Send&&Ge)),Xe=Object(c.p)(()=>Object(m.c)(O,f),[O,f]),et=O&&Object(m.gb)(O),tt=Object(m.k)(O),{isEmojiTooltipOpen:at,closeEmojiTooltip:st}=function(e,t,a){const{loadStickersForEmoji:n,clearStickersForEmoji:r}=Object(s.d)(),o=h.c&&1===Object(cs.a)(t)||!h.c&&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]),{isEmojiTooltipOpen:i,closeEmojiTooltip:r}}(Boolean(F&&Xe.canSendStickers&&!me.length),ee,N),ct=Object(c.m)(e=>{const t=window.getSelection(),a=document.getElementById(n.r),s=Object(Ze.a)(e,["escape_html","emoji_html","br_html"]).join("").replace(/\u200b+/g,"");if(t.rangeCount){const n=t.getRangeAt(0);if(Object($a.a)(n))return void(h.c?document.execCommand("insertText",!1,e):(!function(e){const t=window.getSelection();if(t&&t.getRangeAt&&t.rangeCount){const a=t.getRangeAt(0);a.deleteContents();const s=a.createContextualFragment(e),n=s.lastChild;a.insertNode(s),n&&(a.setStartAfter(n),a.setEndAfter(n),t.removeAllRanges(),t.addRange(a))}}(s),a.dispatchEvent(new Event("input",{bubbles:!0}))));ae(`${ue.current}${s}`),h.f||requestAnimationFrame(()=>{Object(Ga.a)(a)})}else ae(`${ue.current}${s}`)},[]),rt=Object(c.m)(()=>{const e=window.getSelection();if(e.rangeCount){const t=e.getRangeAt(0);if(Object($a.a)(t))return void document.execCommand("delete",!1)}ae(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}(ue.current))},[]),ot=Object(c.m)(()=>{ae(""),he([]),st(),ie(),be(void 0),Ve(),h.f?setTimeout(()=>we(),350):we()},[st,ie,Ve,we]),it=Object(He.a)(l);Object(c.n)(()=>{it&&l!==it&&(xe(),ot())},[l,it,ot,xe]);const lt=((e,t,a,s,r,o)=>{Object(c.n)(()=>{a?(t(as(a.content.text)),requestAnimationFrame(()=>{const e=document.getElementById(n.r);Object(Ga.a)(e,!0)})):t("")},[a,t]);return Object(c.m)(()=>{const{text:t,entities:n}=Object(_a.a)(e.current);a&&(t||Object(m.cb)(a)?(o({messageId:a.id,text:t,entities:n}),s()):r())},[o,a,e,r,s])})(ue,ae,o,ot,Ee,D);((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(_a.a)(r.current)}):d({chatId:e,threadId:t})},[d,i,r,l]),u=Object(c.p)(()=>Object(g.a)(e=>e(),n.q,!1),[t]),m=Object(He.a)(t),h=Object(He.a)(a);Object(c.n)(()=>(ss=t,ns=a,()=>{ss=void 0,ns=void 0,b(t,a)}),[t,a,b]),Object(c.n)(()=>{t===m&&a===h||e&&(o(as(e)),requestAnimationFrame(()=>{const e=document.getElementById(n.r);Object(Ga.a)(e,!0)}))},[t,a,e,o,b,m,h]);const O=Object(He.a)(s);Object(c.n)(()=>{t&&a&&m===t&&h===a&&O!==s&&(s.length?u(()=>{ss===t&&ns===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,ee,ue,ae,o,U,H),((e,t,a)=>{Object(c.n)(()=>{async function s(s){if(!s.clipboardData)return;const c=document.activeElement;if(!c||![n.r,n.s].includes(c.id))return;const{items:r}=s.clipboardData,o=Array.from(r).find(e=>ts.includes(e.type)),i=o&&o.getAsFile(),l=s.clipboardData.getData("text").substring(0,4096);if(i||l){if(s.preventDefault(),i&&!a){const e=await Va(i.name,i,!0);t(t=>[...t,e])}l&&e(l)}}return document.addEventListener("paste",s,!1),()=>{document.removeEventListener("paste",s,!1)}},[e,a,t])})(ct,he,o);const dt=Object(c.m)(async(e,t)=>{he(await Promise.all(e.map(e=>Va(e.name,e,t))))},[]),bt=Object(c.m)(()=>{he([])},[]),ut=Object(c.m)(async(e=!1,t)=>{if("connectionStateReady"!==j)return;let a=me;if(Le){const e=await xe();if(e){const{blob:t,duration:s,waveform:n}=e;a=[await Va("wonderful-voice-message.ogg",t,!1,{voice:{duration:s,waveform:n}})]}}const{text:s,entities:c}=Object(_a.a)(ue.current);if(a.length||s||y)if(a.length&&s&&s.length>1024){const e=s.length-1024;q({error:{message:"CAPTION_TOO_LONG_PLEASE_REMOVE_CHARACTERS",textParams:{"{EXTRA_CHARS_COUNT}":e,"{PLURAL_S}":e>1?"s":""}}})}else{if(a.length||s){if(tt&&!et){const e=Math.floor(Date.now()/1e3),t=se.current&&Math.floor(e-se.current),a=tt.nextSendDate&&tt.nextSendDate>e;if(t&&t<tt.seconds||a){const s=a?tt.nextSendDate-e:tt.seconds-t;q({error:{message:`A wait of ${s} seconds is required before sending another message in this chat`,isSlowMode:!0}});return void document.getElementById(n.r).blur()}}B({text:s,entities:c,attachments:a,scheduledAt:t,isSilent:e})}y&&z(),se.current=Math.floor(Date.now()/1e3),H({chatId:l,localOnly:!0}),requestAnimationFrame(ot)}},[Le,me,j,l,tt,y,et,B,xe,ot,H,q,z]),mt=Object(c.m)(e=>{e={...e,isPreloadedGlobally:!0},t?(be({sticker:e}),oe()):(B({sticker:e}),requestAnimationFrame(ot))},[t,oe,B,ot]),ht=Object(c.m)(e=>{t?(be({gif:e}),oe()):(B({gif:e}),requestAnimationFrame(ot))},[t,oe,B,ot]),Ot=Object(c.m)(e=>{t?(be({poll:e}),$(),oe()):(B({poll:e}),$())},[$,oe,B,t]),jt=Object(c.m)(()=>{t?(be({isSilent:!0}),oe()):ut(!0)},[ut,oe,t]),gt=Object(c.m)(e=>{const{isSilent:t,...a}=le||{},s=Math.round(Math.max(e.getTime(),Date.now()+6e4)/1e3);le&&0!==Object.keys(a).length?(B({...le,scheduledAt:s}),requestAnimationFrame(ot)):ut(!!t,s),ie()},[ie,ut,ot,le,B]),ft=Object(c.m)(()=>{gt(new Date(1e3*n.ab))},[gt]),pt=Object(c.m)(()=>{ie(),be(void 0)},[ie]),It=Object(c.m)(e=>{"stickers"===e?(G({query:""}),_({query:void 0})):(_({query:""}),G({query:void 0}))},[G,_]),yt=Object(c.m)(()=>{const e=document.getElementById(n.r);h.f&&e===document.activeElement?(e.blur(),setTimeout(()=>{ye()},100)):ye()},[ye]),wt=Object(c.m)(()=>{K({id:l,threadId:d,type:"scheduled"})},[K,l,d]);Object(c.n)(()=>{I&&h.f&&we()},[I,we]),Object(c.n)(()=>{v?Pe():setTimeout(()=>{Te()},200)},[v,Te,Pe]);const Ct=Object(c.m)(()=>{switch(qe){case Ns.Send:t?(Le&&Re(),oe()):(ut(),requestAnimationFrame(ot));break;case Ns.Record:Ae();break;case Ns.Edit:lt()}},[qe,ot,t,Ae,lt,Le,oe,Re,ut]),Et=Object(te.a)(),Mt=qe===Ns.Record&&!Xe.canAttachMedia,St=Object(He.a)(o,!0),kt=o||St,Nt=new Date;Nt.setSeconds(0),Nt.setMilliseconds(0);const Pt=new Date;Pt.setFullYear(Pt.getFullYear()+1);let Tt="Send message";switch(qe){case Ns.Edit:Tt="Save edited message";break;case Ns.Record:Tt=Mt?"Posting media content is not allowed in this group.":"Record a voice message"}const At=Object(J.a)("Composer",!v&&"shown",Ne&&"hover-disabled"),xt=Object(J.a)("mobile-symbol-menu-button",Se?ve&&"menu-opened":ve&&"is-loading");return c.a.createElement("div",{className:At},Xe.canAttachMedia&&c.a.createElement(Ms.a,{containerId:"#middle-column-portals"},c.a.createElement(ws,{isOpen:e!==Fe.a.None,withQuick:[e,ce].includes(Fe.a.QuickFile),onHide:r,onFileSelect:dt})),c.a.createElement(vs,{attachments:me,caption:me.length?ee:"",canSuggestMembers:w,groupChatMembers:P,currentUserId:T,usersById:A,onCaptionUpdate:ae,onSend:t?oe:ut,onClear:bt}),c.a.createElement(ys,{isOpen:Boolean(C),onClear:$,onSend:Ot}),c.a.createElement(ks,{isOpen:Boolean(E),onClose:Q}),c.a.createElement(Ps,{isOpen:Boolean(M),onClose:Y}),kt&&c.a.createElement(os,{isOpen:Ce,isSchedule:"scheduled"===b,onClose:Me,message:kt}),c.a.createElement(hs,{isOpen:_e,filter:ze,onClose:Ve,onInsertUserName:$e,filteredChatMembers:We,usersById:A}),c.a.createElement("div",{id:"message-compose"},c.a.createElement("div",{className:"svg-appendix",ref:X}),c.a.createElement(Is,null),Xe.canAttachEmbedLinks&&c.a.createElement(Es,{chatId:l,messageText:me.length?"":ee}),c.a.createElement("div",{className:"message-input-wrapper"},h.f?c.a.createElement(ne.a,{className:xt,round:!0,color:"translucent",onClick:ve?we:yt,ariaLabel:"Choose emoji, sticker or GIF"},c.a.createElement("i",{className:"icon-smile"}),c.a.createElement("i",{className:"icon-keyboard"}),c.a.createElement(de.a,{color:"gray"})):c.a.createElement(bs,{className:""+(ve?"activated":""),round:!0,faded:!0,color:"translucent",onActivate:ye,ariaLabel:"Choose emoji, sticker or GIF"},c.a.createElement("i",{className:"icon-smile"})),c.a.createElement(fs.a,{id:"message-input-text",html:me.length?"":ee,placeholder:Le&&window.innerWidth<=600?"":Et("Message"),shouldSetFocus:ve,shouldSupressFocus:h.f&&ve,onUpdate:ae,onSend:qe===Ns.Edit?lt:t?oe:ut,onSupressedFocus:we}),k&&c.a.createElement(ne.a,{round:!0,faded:!0,className:"scheduled-button",color:"translucent",onClick:wt,ariaLabel:"Open scheduled messages"},c.a.createElement("i",{className:"icon-schedule"})),S&&!Le&&!o&&c.a.createElement(bs,{className:""+(Oe?"activated":""),round:!0,faded:!0,color:"translucent",onActivate:je,ariaLabel:"Open bot command keyboard"},c.a.createElement("i",{className:"icon-bot-command"})),!Le&&!o&&c.a.createElement(bs,{className:""+(fe?"activated":""),round:!0,faded:!0,color:"translucent",onActivate:pe,ariaLabel:"Add an attachment"},c.a.createElement("i",{className:"icon-attach"})),Le&&Be&&c.a.createElement("span",{className:"recording-state"},Object(x.i)(Be-Ue.current)),c.a.createElement(js,{isOpen:at,onStickerSelect:mt}),c.a.createElement(us,{isOpen:fe,allowedAttachmentOptions:Xe,onFileSelect:dt,onPollCreate:V,onClose:Ie}),S&&c.a.createElement(gs,{messageId:S,isOpen:Oe,onClose:ge}),c.a.createElement(ms,{isOpen:ve,allowedAttachmentOptions:Xe,onLoad:ke,onClose:we,onEmojiSelect:ct,onStickerSelect:mt,onGifSelect:ht,onRemoveSymbol:rt,onSearchOpen:It}))),Le&&c.a.createElement(ne.a,{round:!0,color:"danger",className:"cancel",onClick:xe,ariaLabel:"Cancel voice recording"},c.a.createElement("i",{className:"icon-delete"})),c.a.createElement(ne.a,{ref:De,round:!0,color:"secondary",className:`${qe} ${Le?"recording":""}`,disabled:Mt,ariaLabel:Tt,onClick:Ct,onContextMenu:qe===Ns.Send&&Ge?Ke:void 0},c.a.createElement("i",{className:"icon-send"}),c.a.createElement("i",{className:"icon-microphone-alt"}),c.a.createElement("i",{className:"icon-check"})),Ge&&c.a.createElement(Os,{isOpen:Qe,onSilentSend:p?void 0:jt,onScheduleSend:t?void 0:oe,onClose:Ye,onCloseAnimationEnd:Je}),c.a.createElement(Ss,{isOpen:re,withTimePicker:!0,selectedAt:Nt.getTime(),maxAt:Object(x.k)(Pt),isFutureMode:!0,secondButtonLabel:a?"Send When Online":void 0,onClose:pt,onSubmit:gt,onSecondButtonClick:a?ft:void 0}))}));var As=e=>{const{isActive:t}=e,a=Object(Ie.a)(pe.a.Extra,"MobileSearch",!t,!0);return a?c.a.createElement(a,e):void 0};var xs=e=>{const{isActive:t}=e,a=Object(Ie.a)(pe.a.Extra,"MessageSelectToolbar",!t);return a?c.a.createElement(a,e):void 0};var Rs=e=>{const{isOpen:t}=e,a=Object(Ie.a)(pe.a.Extra,"UnpinAllMessagesModal",!t);return a?c.a.createElement(a,e):void 0};a(229);const Ls=h.f?450+n.c:void 0;function Fs(e){return"file"===e.kind&&e.type&&n.k.includes(e.type)}var Bs=Object(c.h)(Object(s.h)(e=>{const{isBackgroundBlurred:t,customBackground:a}=e.settings.byKey,s=Boolean((a||"").match(/^#[a-f\d]{6,8}$/i)),n=Object(o.x)(e),{chats:{listIds:c}}=e;if(!n||!c.active)return{customBackground:a,isBackgroundBlurred:t,isCustomBackgroundColor:s};const{chatId:r,threadId:i,type:l}=n,d=Object(o.f)(e,r),b=Object(o.eb)(e,r),{chatId:u,messageId:O}=e.audioPlayer,j=d&&Object(m.e)(d,i),g=Object(o.J)(e,r),f="pinned"===l;return{chatId:r,threadId:i,messageListType:l,isPrivate:Object(m.lb)(r),canPost:!f&&(!d||j)&&(!g||h.f),isPinnedMessageList:f,messageSendingRestrictionReason:d&&Object(m.J)(d),hasPinnedOrAudioMessage:Boolean(b&&b.length)||Boolean(u&&O),customBackground:a,isCustomBackgroundColor:s,isRightColumnShown:Object(o.U)(e),isBackgroundBlurred:t,isMobileSearchActive:Boolean(h.f&&Object(o.z)(e)),isSelectModeActive:Object(o.Q)(e),animationLevel:e.settings.byKey.animationLevel}},(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,customBackground:b,isCustomBackgroundColor:u,isRightColumnShown:m,isBackgroundBlurred:O,isMobileSearchActive:j,isSelectModeActive:g,animationLevel:f,openChat:p,unpinAllMessages:I,loadUser:v})=>{const{width:y}=Ue(),[w,C]=Object(c.r)(Fe.a.None),[E,M]=Object(c.r)(!1),[S,k]=Object(c.r)(!1),N=qe(e,Ls),P=qe(t,Ls),T=qe(a,Ls),A=qe(o,Ls);Object(c.n)(()=>e?Object(Z.a)(()=>{p({id:void 0})}):void 0,[e,p]),Object(c.n)(()=>{C(Fe.a.None)},[e]),Object(c.n)(()=>{s&&v({userId:e})},[e,s,v]);const x=Object(c.m)(e=>{if(h.k)return;const{items:t}=e.dataTransfer||{},a=t&&Array.from(t).every(Fs);C(a?Fe.a.QuickFile:Fe.a.Document)},[]),R=Object(c.m)(()=>{C(Fe.a.None)},[]),L=Object(c.m)(()=>{k(!0)},[]),F=Object(c.m)(()=>{k(!1)},[]),B=Object(c.m)(()=>{I({chatId:e}),F(),p({id:e})},[I,p,F,e]),D=(e=>{const[t,a]=Object(c.r)(e);return Object(c.n)(()=>{e&&(e.startsWith("#")?a(e):Be.c(n.l,n.l,Be.a.Blob).then(e=>{a("url("+URL.createObjectURL(e))}))},[e]),t})(b),U=d&&(y<n.V||m&&y>n.S&&y<n.Z||y>=n.R&&y<n.Y),H=Object(J.a)(U&&"has-header-tools",b&&!u&&"custom-bg-image",b&&u&&"custom-bg-color",b&&O&&"blurred",h.m?"mask-image-enabled":"mask-image-disabled"),q=Object(J.a)("messaging-disabled",!g&&"shown"),{composerHiddenScale:G,toolbarHiddenScale:_,composerTranslateX:z,toolbarTranslateX:V}=Object(c.p)(()=>Ge(y,A),[A,y]),$=Object(te.a)();return c.a.createElement("div",{id:"MiddleColumn",className:H,style:`\n --composer-hidden-scale: ${G};\n --toolbar-hidden-scale: ${_};\n --composer-translate-x: ${z}px;\n --toolbar-translate-x: ${V}px;\n `},c.a.createElement("div",{id:"middle-column-bg",style:D?"--custom-background: "+D:void 0}),c.a.createElement("div",{id:"middle-column-portals"}),N&&P&&c.a.createElement(c.a.Fragment,null,c.a.createElement("div",{className:"messages-layout",onDragEnter:A?x:void 0},c.a.createElement(bt,{chatId:N,threadId:P,messageListType:T}),c.a.createElement(X.a,{name:f===n.e?"slide":"fade",activeKey:"thread"===T&&P===i.MAIN_THREAD_ID?1:2,shouldCleanup:!0},()=>c.a.createElement(c.a.Fragment,null,c.a.createElement(Ha,{key:`${N}-${P}-${T}`,chatId:N,threadId:P,type:T,hasTools:U,onFabToggle:M,bottomOffset:A?"none":r?"big":"small"}),c.a.createElement("div",{className:Object(J.a)("middle-column-footer",!A&&"no-composer")},A&&c.a.createElement(Ts,{chatId:N,threadId:P,messageListType:T,dropAreaState:w,onDropHide:R}),r&&c.a.createElement("div",{className:"unpin-button-container"},c.a.createElement(ne.a,{size:"tiny",fluid:!0,color:"secondary",className:"unpin-all-button",onClick:L},c.a.createElement("i",{className:"icon-unpin"}),c.a.createElement("span",null,$("Chat.PanelHidePinnedMessages")))),!r&&!A&&l&&c.a.createElement("div",{className:q},c.a.createElement("div",{className:"messaging-disabled-inner"},c.a.createElement("span",null,l))),c.a.createElement(xs,{messageListType:T,isActive:g,canPost:A})))),c.a.createElement(qa,{isShown:E})),h.f&&c.a.createElement(As,{isActive:Boolean(j)})),e&&c.a.createElement(Rs,{isOpen:S,chatId:e,onClose:F,onUnpin:B}))}));a(230);const Ds=Object(g.a)(e=>e(),200,!1);var Us;!function(e){e[e.Profile=0]="Profile",e[e.MemberList=1]="MemberList",e[e.SharedMedia=2]="SharedMedia",e[e.Search=3]="Search",e[e.Statistics=4]="Statistics",e[e.Management=5]="Management",e[e.ManageInitial=6]="ManageInitial",e[e.ManageChannelSubscribers=7]="ManageChannelSubscribers",e[e.ManageChatAdministrators=8]="ManageChatAdministrators",e[e.ManageChatPrivacyType=9]="ManageChatPrivacyType",e[e.ManageDiscussion=10]="ManageDiscussion",e[e.ManageGroupPermissions=11]="ManageGroupPermissions",e[e.ManageGroupRemovedUsers=12]="ManageGroupRemovedUsers",e[e.ManageGroupUserPermissionsCreate=13]="ManageGroupUserPermissionsCreate",e[e.ManageGroupUserPermissions=14]="ManageGroupUserPermissions",e[e.ManageGroupRecentActions=15]="ManageGroupRecentActions",e[e.ManageGroupAdminRights=16]="ManageGroupAdminRights",e[e.ManageGroupMembers=17]="ManageGroupMembers",e[e.StickerSearch=18]="StickerSearch",e[e.GifSearch=19]="GifSearch",e[e.PollResults=20]="PollResults"}(Us||(Us={}));var Hs=Object(c.h)(Object(s.h)((e,{chatId:t,isProfile:a,isManagement:s})=>{const{query:n}=Object(o.z)(e)||{},{query:c}=Object(o.y)(e)||{},{query:r}=Object(o.r)(e)||{},i=t?Object(o.f)(e,t):void 0,l=i&&Object(m.jb)(i);return{canManage:Boolean(!s&&a&&i&&!Object(o.N)(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,isStatistics:n,isStickerSearch:r,isGifSearch:o,isPollResults:i,profileState:d,managementScreen:b,canManage:u,isChannel:m,onClose:O,messageSearchQuery:j,stickerSearchQuery:g,gifSearchQuery:f,setLocalTextSearchQuery:p,setStickerSearchQuery:I,setGifSearchQuery:v,searchTextMessagesLocal:y,toggleManagement:w,searchMessagesByDate:C})=>{var E;const M=Object(c.q)(null),[S,k,N]=Object(nt.a)(),P=Object(c.m)(e=>{p({query:e}),e.length&&Ds(y)},[y,p]),T=Object(c.m)(e=>{C({timestamp:e.valueOf()/1e3}),N()},[N,C]),A=Object(c.m)(e=>{I({query:e})},[I]),x=Object(c.m)(e=>{v({query:e})},[v]),[R,L]=Object(c.r)(!e);Object(c.n)(()=>{setTimeout(()=>{L(!e)},300)},[e]);const F=Object(te.a)(),B=t?d===l.k.Profile?Us.Profile:d===l.k.SharedMedia?Us.SharedMedia:d===l.k.MemberList?Us.MemberList:-1:a?Us.Search:i?Us.PollResults:r?Us.StickerSearch:o?Us.GifSearch:s?b===l.g.Initial?Us.ManageInitial:b===l.g.ChatPrivacyType?Us.ManageChatPrivacyType:b===l.g.Discussion?Us.ManageDiscussion:b===l.g.ChannelSubscribers?Us.ManageChannelSubscribers:b===l.g.GroupPermissions?Us.ManageGroupPermissions:b===l.g.ChatAdministrators?Us.ManageChatAdministrators:b===l.g.GroupRemovedUsers?Us.ManageGroupRemovedUsers:b===l.g.GroupUserPermissionsCreate?Us.ManageGroupUserPermissionsCreate:b===l.g.GroupUserPermissions?Us.ManageGroupUserPermissions:b===l.g.GroupRecentActions?Us.ManageGroupRecentActions:b===l.g.ChatAdminRights?Us.ManageGroupAdminRights:b===l.g.GroupMembers?Us.ManageGroupMembers:void 0:n?Us.Statistics:void 0,D=null!==(E=Ve(B,!0))&&void 0!==E?E:-1;function U(){if(-1!==D)switch(D){case Us.PollResults:return c.a.createElement("h3",null,F("PollResults"));case Us.Search:return c.a.createElement(c.a.Fragment,null,c.a.createElement(ce.a,{value:j,onChange:P}),c.a.createElement(ne.a,{round:!0,size:"smaller",color:"translucent",onClick:k,ariaLabel:"Search messages by date"},c.a.createElement("i",{className:"icon-calendar"})));case Us.ManageInitial:return c.a.createElement("h3",null,F("Edit"));case Us.ManageChatPrivacyType:return c.a.createElement("h3",null,F(m?"ChannelTypeHeader":"GroupTypeHeader"));case Us.ManageDiscussion:return c.a.createElement("h3",null,F("Discussion"));case Us.ManageChatAdministrators:return c.a.createElement("h3",null,F("ChannelAdministrators"));case Us.ManageGroupRecentActions:return c.a.createElement("h3",null,F("Group.Info.AdminLog"));case Us.ManageGroupAdminRights:return c.a.createElement("h3",null,F("EditAdminRights"));case Us.ManageGroupPermissions:return c.a.createElement("h3",null,F("ChannelPermissions"));case Us.ManageGroupRemovedUsers:return c.a.createElement("h3",null,F("ChannelBlockedUsers"));case Us.ManageGroupUserPermissionsCreate:return c.a.createElement("h3",null,F("ChannelAddException"));case Us.ManageGroupUserPermissions:return c.a.createElement("h3",null,F("UserRestrictions"));case Us.StickerSearch:return c.a.createElement(ce.a,{value:g,placeholder:"Search Stickers",onChange:A});case Us.GifSearch:return c.a.createElement(ce.a,{value:f,placeholder:F("SearchGifsTitle"),onChange:x});case Us.Statistics:return c.a.createElement("h3",null,F("Statistics"));case Us.SharedMedia:return c.a.createElement("h3",null,F("SharedMedia"));case Us.ManageChannelSubscribers:return c.a.createElement("h3",null,F("ChannelSubscribers"));case Us.MemberList:case Us.ManageGroupMembers:return c.a.createElement("h3",null,F("GroupMembers"));default:return c.a.createElement(c.a.Fragment,null,c.a.createElement("h3",null,F("Info")),c.a.createElement("section",{className:"tools"},u&&c.a.createElement(ne.a,{round:!0,color:"translucent",size:"smaller",ariaLabel:F("Edit"),onClick:w},c.a.createElement("i",{className:"icon-edit"}))))}}const H=h.f||B===Us.SharedMedia||B===Us.MemberList||s,q=Object(J.a)("animated-close-icon",R&&"no-transition");return Object(c.n)(()=>{M.current.classList.toggle("state-back",H)},[H]),c.a.createElement("div",{className:"RightHeader"},c.a.createElement(ne.a,{className:"close-button",round:!0,color:"translucent",size:"smaller",onClick:O,ariaLabel:F(H?"Common.Back":"Common.Close")},c.a.createElement("div",{ref:M,className:q})),c.a.createElement(X.a,{name:R?"none":"slide-fade",activeKey:D},U),!h.f&&c.a.createElement(Ss,{isOpen:S,isPastMode:!0,submitButtonLabel:F("JumpToDate"),onClose:N,onSubmit:T}))})),qs=a(118);function Gs(e,t,a,s,r,o){const i=Object(c.q)();Object(me.a)(()=>{t===e&&r&&o&&(i.current=Object(m.w)(r,o,e).reverse())},[r,o,t,e]);const[l,d]=Object(qs.a)(s?a:void 0,i.current,void 0,"media"===e?n.cb:n.P);return[l,d,!(!l||!i.current||l[0]===i.current[0])]}var _s=a(51);const zs=Object(g.g)(e=>e(),250,!1);let Vs=!1;var $s=a(101),Ws=a(94);var Qs=Object(c.h)(Object(s.h)((e,{userId:t})=>{const{lastSyncTime:a}=e;return{lastSyncTime:a,user:Object(o.Bb)(e,t)}},(e,t)=>Object(d.l)(t,["loadFullUser"]))(({lastSyncTime:e,user:t,forceShowSelf:a,loadFullUser:s})=>{const{id:n,fullInfo:r,username:o,phoneNumber:i,isSelf:l}=t||{};Object(c.n)(()=>{e&&s({userId:n})},[s,n,e]);const d=Object(te.a)();if(!t||l&&!a)return;const b=r&&r.bio,u=i&&Object(da.c)(i);return c.a.createElement("div",{className:"ChatExtra"},b&&!!b.length&&c.a.createElement("div",{className:"item"},c.a.createElement("i",{className:"icon-info"}),c.a.createElement("div",null,c.a.createElement("p",{className:"title"},Object(Ze.a)(b,["br","links","emoji"])),c.a.createElement("p",{className:"subtitle"},d("UserBio")))),o&&!!o.length&&c.a.createElement("div",{className:"item"},c.a.createElement("i",{className:"icon-mention"}),c.a.createElement("div",null,c.a.createElement("p",{className:"title"},Object(Ze.a)(o)),c.a.createElement("p",{className:"subtitle"},d("Username")))),u&&!!u.length&&c.a.createElement("div",{className:"item"},c.a.createElement("i",{className:"icon-phone"}),c.a.createElement("div",null,c.a.createElement("p",{className:"title"},u),c.a.createElement("p",{className:"subtitle"},d("Phone")))))}));var Ks=Object(c.h)(Object(s.h)((e,{chatId:t})=>{const a=Object(o.f)(e,t);return{chat:a,canInviteUsers:a&&(!Object(m.jb)(a)&&!Object(m.yb)(a,"inviteUsers")||Object(m.q)(a,"inviteUsers"))}})(({chat:e,canInviteUsers:t})=>{const a=Object(te.a)();if(!e||e.isRestricted)return;const s=Object(m.g)(e),n=Object(m.h)(e),r=0===n.indexOf("http")?n:"http://"+n;return c.a.createElement("div",{className:"ChatExtra"},s&&!!s.length&&c.a.createElement("div",{className:"item"},c.a.createElement("i",{className:"icon-info"}),c.a.createElement("div",null,c.a.createElement("p",{className:"title"},Object(Ze.a)(s,["br","links","emoji"])),c.a.createElement("p",{className:"subtitle"},a("Info")))),t&&!!n.length&&c.a.createElement("div",{className:"item"},c.a.createElement("i",{className:"icon-mention"}),c.a.createElement("div",null,c.a.createElement(Ia.a,{url:r,className:"title",text:n}),c.a.createElement("p",{className:"subtitle"},a("SetUrlPlaceholder")))))})),Ys=a(153),Js=a(172),Zs=a(108);a(234);const Xs=[{type:"media",title:"SharedMediaTab2"},{type:"documents",title:"SharedFilesTab2"},{type:"links",title:"SharedLinksTab2"},{type:"audio",title:"SharedMusicTab2"}];function en(e){return[`.shared-media-transition > div:only-child > .${e}-list > .scroll-item`,`.shared-media-transition > div.active > .${e}-list > .scroll-item`].join(", ")}var tn=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.u)(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.U)(e),isRestricted:s&&s.isRestricted,lastSyncTime:e.lastSyncTime}},(e,t)=>Object(d.l)(t,["setLocalMediaSearchType","searchMediaMessagesLocal","openMediaViewer","openAudioPlayer","openUserInfo","focusMessage"]))(({chatId:e,profileState:t,onProfileStateChange:a,isChannel:s,resolvedUserId:r,chatMessages:o,foundIds:d,mediaSearchType:b,hasMembersTab:u,areMembersHidden:O,members:j,usersById:g,isRightColumnShown:f,isRestricted:p,lastSyncTime:I,setLocalMediaSearchType:v,searchMediaMessagesLocal:y,openMediaViewer:w,openAudioPlayer:C,openUserInfo:E,focusMessage:M})=>{const S=Object(c.q)(null),k=Object(c.q)(null),[N,P]=Object(c.r)(0),T=Object(c.p)(()=>[...u?[{type:"members",title:s?"ChannelSubscribers":"GroupMembers"}]:[],...Xs],[u,s]),A=T[N].type,[x,R,L,F]=function(e,t,a,s,n,r,o,i,l,d){const b="members"!==a&&s?s:a,u=Object(c.p)(()=>{if(n&&r)return Object(m.W)(n.map(({userId:e})=>e),r)},[n,r]),[h,O,j]=Gs("media",b,t,d,o,i),[g,f,p]=Gs("documents",b,t,d,o,i),[I,v,y]=Gs("links",b,t,d,o,i),[w,C,E]=Gs("audio",b,t,d,o,i);let M,S,k=!1;switch(b){case"members":M=u,S=void 0;break;case"media":M=h,S=O,k=j;break;case"documents":M=g,S=f,k=p;break;case"links":M=I,S=v,k=y;break;case"audio":M=w,S=C,k=E}return[b,M,S,k]}(0,y,A,b,j,g,o,d,0,I),B=T.findIndex(({type:e})=>e===x),{handleScroll:D}=function(e,t,a,s){Object(_s.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),Vs=!0,Object(ft.a)(a,n,"start",void 0,void 0,void 0,300),setTimeout(()=>{Vs=!1},350))}},[t,s]),Object(_s.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||(Vs=!0,Object(ft.a)(n,n.firstElementChild,"start",void 0,2*n.offsetHeight),setTimeout(()=>{Vs=!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)(()=>{Vs||n()},[n,t]),{handleScroll:Object(c.m)(()=>{Vs||zs(n)},[n])}}(S,A,t,a),{applyTransitionFix:U,releaseTransitionFix:H}=function(e){return Object(c.n)(()=>{function t(){const t=e.current,a=t.querySelector(".Transition"),s=t.querySelector(".TabList");a&&s&&(a.style.minHeight=t.offsetHeight-s.offsetHeight+"px")}return t(),window.addEventListener("resize",t,!1),()=>{window.removeEventListener("resize",t,!1)}},[e]),{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])}}(S),[q,G]=(()=>{const[e,t]=Object(c.r)(!1);return[e,Object(c.m)(()=>{t(e=>!e)},[])]})(),_=Object(c.m)(()=>{H(),G()},[H,G]);Object(c.n)(()=>{v({mediaType:A})},[v,A]);const z=r||e,V=Object(c.m)(e=>{w({chatId:z,threadId:i.MAIN_THREAD_ID,messageId:e,origin:l.h.SharedMedia})},[z,w]),$=Object(c.m)(e=>{C({chatId:z,messageId:e})},[z,C]),W=Object(c.m)(e=>{E({id:e})},[E]),Q=Object(c.m)(e=>{M({chatId:z,messageId:e})},[z,M]);let K;Object(c.n)(()=>{if(k.current&&h.k)return Object(ue.b)(k.current,{onSwipe:(e,t)=>{t===ue.a.Left?P(Math.min(N+1,T.length-1)):t===ue.a.Right&&P(Math.max(0,N-1))}})},[N,T.length]);const Y="members"===x||!u&&"media"===x;Y?K=f?0:1e3:R||(K=n.db);const J=Object(ps.a)([e,x],K);function Z(){if(!R||!J||!o){const e=Y&&R&&!J;return c.a.createElement("div",{className:"content empty-list"},!e&&c.a.createElement(de.a,null))}if(!R.length){let e;switch(x){case"members":e=O?"You have no access to group members list.":"No members found";break;case"documents":e="No documents found.";break;case"links":e="No links found.";break;case"audio":e="No audio found.";break;default:e="No media found."}return c.a.createElement("div",{className:"content empty-list"},c.a.createElement(Zs.a,{text:e}))}return c.a.createElement("div",{className:`content ${x}-list`,teactFastList:!0},"media"===x?R.map(e=>o[e]&&c.a.createElement(Ys.a,{key:e,message:o[e],onClick:V})):"documents"===x?R.map(e=>o[e]&&c.a.createElement(_t.a,{key:e,message:o[e],withDate:!0,smaller:!0,className:"scroll-item",onDateClick:Q})):"links"===x?R.map(e=>o[e]&&c.a.createElement(Js.a,{key:e,message:o[e],onMessageClick:Q})):"audio"===x?R.map(e=>o[e]&&c.a.createElement(zt.a,{key:e,renderingFor:"sharedMedia",message:o[e],date:o[e].date,lastSyncTime:I,className:"scroll-item",onPlay:$,onDateClick:Q})):"members"===x?R.map((e,t)=>c.a.createElement(Ws.a,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item",onClick:()=>W(e)},c.a.createElement(We.a,{userId:e,forceShowSelf:!0}))):void 0)}return c.a.createElement($s.a,{ref:S,className:"Profile custom-scroll",itemSelector:en(x),items:R,cacheBuster:q,preloadBackwards:n.cb,isDisabled:"members"===A,noFastList:!0,onLoadMore:L,onScroll:D},!F&&function(e,t){return c.a.createElement("div",{className:"profile-info"},t?c.a.createElement(c.a.Fragment,null,c.a.createElement(We.a,{userId:t,avatarSize:"jumbo",forceShowSelf:t!==e,withMediaViewer:!0,withFullInfo:!0}),c.a.createElement(Qs,{userId:t,forceShowSelf:t!==e})):c.a.createElement(c.a.Fragment,null,c.a.createElement(Qe.a,{chatId:e,avatarSize:"jumbo",withMediaViewer:!0,withFullInfo:!0}),c.a.createElement(Ks,{chatId:e})))}(e,r),!p&&c.a.createElement("div",{className:"shared-media"},c.a.createElement(X.a,{ref:k,name:"slide",activeKey:B,renderCount:T.length,shouldRestoreHeight:!0,className:"shared-media-transition",onStart:U,onStop:_},Z),c.a.createElement(je.a,{activeTab:N,tabs:T,onSwitchTab:P})))}));var an=e=>{const t=Object(Ie.a)(pe.a.Extra,"RightSearch");return t?c.a.createElement(t,e):c.a.createElement(ve.a,null)};var sn=e=>{const t=Object(Ie.a)(pe.a.Extra,"Management");return t?c.a.createElement(t,e):c.a.createElement(ve.a,null)};var nn=()=>{const e=Object(Ie.a)(pe.a.Extra,"Statistics");return e?c.a.createElement(e,null):c.a.createElement(ve.a,null)};var cn=()=>{const e=Object(Ie.a)(pe.a.Extra,"StickerSearch");return e?c.a.createElement(e,null):c.a.createElement(ve.a,null)};var rn=()=>{const e=Object(Ie.a)(pe.a.Extra,"GifSearch");return e?c.a.createElement(e,null):c.a.createElement(ve.a,null)};var on=()=>{const e=Object(Ie.a)(pe.a.Extra,"PollResults");return e?c.a.createElement(e,null):c.a.createElement(ve.a,null)};a(235);const ln=Object.keys(l.l).length/2,dn=Object.keys(l.g).length/2;function bn(){const e=document.querySelector(".RightHeader .SearchInput input");e&&e.blur()}var un=Object(c.h)(Object(s.h)(e=>{const{chatId:t,threadId:a}=Object(o.x)(e)||{},s=Object(o.d)(e);return{contentKey:Object(o.ib)(e),chatId:t,threadId:a,currentProfileUserId:e.users.selectedId,isChatSelected:Boolean(t&&s)}},(e,t)=>Object(d.l)(t,["openUserInfo","toggleChatInfo","toggleManagement","toggleStatistics","closeLocalTextSearch","setStickerSearchQuery","setGifSearchQuery","closePollResults"]))(({contentKey:e,chatId:t,threadId:a,currentProfileUserId:s,isChatSelected:r,toggleChatInfo:o,toggleManagement:i,toggleStatistics:d,openUserInfo:b,closeLocalTextSearch:u,setStickerSearchQuery:m,setGifSearchQuery:h,closePollResults:O})=>{var j;const{width:g}=Ue(),[f,p]=Object(c.r)(l.k.Profile),[I,v]=Object(c.r)(l.g.Initial),[y,w]=Object(c.r)(),[C,E]=Object(c.r)(),M=f!==l.k.Profile,S=void 0!==e,k=e===l.l.ChatInfo||e===l.l.UserInfo,N=e===l.l.Search,P=e===l.l.Management,T=e===l.l.Statistics,A=e===l.l.StickerSearch,x=e===l.l.GifSearch,R=e===l.l.PollResults,L=g<=n.S,[F,B]=Object(c.r)(!S),D=null!==(j=Ve(e,!0,!r))&&void 0!==j?j:-1,U=Object(c.m)(()=>{switch(e){case l.l.ChatInfo:if(M){p(l.k.Profile);break}o();break;case l.l.UserInfo:if(M){p(l.k.Profile);break}b({id:void 0});break;case l.l.Management:switch(I){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:v(l.g.Initial);break;case l.g.GroupUserPermissionsCreate:case l.g.GroupRemovedUsers:case l.g.GroupUserPermissions:v(l.g.GroupPermissions),w(void 0),E(void 0);break;case l.g.ChatAdminRights:case l.g.GroupRecentActions:v(l.g.ChatAdministrators)}break;case l.l.Statistics:d();break;case l.l.Search:bn(),u();break;case l.l.StickerSearch:case l.l.GifSearch:bn(),m({query:void 0}),h({query:void 0});break;case l.l.PollResults:O()}},[e,M,o,b,d,O,I,i,u,m,h]),H=Object(c.m)((e,t)=>{w(e),E(t)},[]);function q(){if(-1!==D)switch(D){case l.l.ChatInfo:case l.l.UserInfo:return c.a.createElement(tn,{key:s||t,chatId:t,userId:s,profileState:f,onProfileStateChange:p});case l.l.Search:return c.a.createElement(an,{chatId:t,threadId:a});case l.l.Management:return c.a.createElement(sn,{chatId:t,currentScreen:I,isPromotedByCurrentUser:C,selectedChatMemberId:y,onScreenSelect:v,onChatMemberSelect:H});case l.l.Statistics:return c.a.createElement(nn,null);case l.l.StickerSearch:return c.a.createElement(cn,null);case l.l.GifSearch:return c.a.createElement(rn,null);case l.l.PollResults:return c.a.createElement(on,null)}}return Object(c.n)(()=>S?Object(Z.a)(U):void 0,[S,U]),Object(c.n)(()=>{setTimeout(()=>{B(!S)},300)},[S]),Object(c.n)(()=>{S&&L&&U()},[L]),Object(ut.a)(([a,s])=>{(a===l.l.ChatInfo&&e===l.l.UserInfo||a===l.l.UserInfo&&e===l.l.ChatInfo||s!==t)&&(p(l.k.Profile),v(l.g.Initial))},[e,t]),c.a.createElement("div",{id:"RightColumn-wrapper",className:r?void 0:"is-hidden"},L&&c.a.createElement("div",{className:"overlay-backdrop",onClick:U}),c.a.createElement("div",{id:"RightColumn"},c.a.createElement(Hs,{chatId:t,isColumnOpen:S,isProfile:k,isSearch:N,isManagement:P,isStatistics:T,isStickerSearch:A,isGifSearch:x,isPollResults:R,profileState:f,managementScreen:I,onClose:U}),c.a.createElement(X.a,{name:F?"none":"zoom-fade",renderCount:ln+dn,activeKey:P?ln+I:D},q)))}));var mn=Object(c.h)(({isOpen:e})=>{const t=Object(Ie.a)(pe.a.Extra,"MediaViewer",!e);return t?c.a.createElement(t,null):void 0});var hn=e=>{const{isOpen:t}=e,a=Object(Ie.a)(pe.a.Extra,"ForwardPicker",!t);return a?c.a.createElement(a,e):void 0};var On=({isOpen:e})=>{const t=Object(Ie.a)(pe.a.Extra,"Notifications",!e);return t?c.a.createElement(t,null):void 0};var jn=({isOpen:e})=>{const t=Object(Ie.a)(pe.a.Extra,"Errors",!e);return t?c.a.createElement(t,null):void 0};a(236);let gn,fn=!1;var pn=Object(c.h)(Object(s.h)(e=>({animationLevel:e.settings.byKey.animationLevel,lastSyncTime:e.lastSyncTime,isLeftColumnShown:e.isLeftColumnShown,isRightColumnShown:Object(o.U)(e),isMediaViewerOpen:Object(o.R)(e),isForwardModalOpen:Object(o.P)(e),hasNotifications:Boolean(e.notifications.length),hasErrors:Boolean(e.errors.length)}),(e,t)=>Object(d.l)(t,["loadAnimatedEmojis"]))(({lastSyncTime:e,loadAnimatedEmojis:t,isLeftColumnShown:a,isRightColumnShown:s,isMediaViewerOpen:r,isForwardModalOpen:o,animationLevel:i,hasNotifications:l,hasErrors:d})=>{n.m&&!fn&&(fn=!0,console.log(">>> RENDER MAIN")),Object(c.n)(()=>{e&&t()},[e,t]);const{transitionClassNames:b}=Object(Y.a)(!a,void 0,!0),{transitionClassNames:u}=Object(Y.a)(s,void 0,!0),m=Object(J.a)(b.replace(/([\w-]+)/g,"middle-column-$1"),u.replace(/([\w-]+)/g,"right-column-$1"));function h(e){e.preventDefault(),e.stopPropagation()}return Object(c.n)(()=>{document.body.classList.toggle("is-middle-column-open",m.includes("middle-column-open")),document.body.classList.toggle("is-right-column-shown",m.includes("right-column-open"))},[m]),Object(c.n)(()=>{i>0&&(document.body.classList.add("animating-right-column"),Object(K.b)(350+n.c),gn&&(clearTimeout(gn),gn=void 0),gn=window.setTimeout(()=>{document.body.classList.remove("animating-right-column"),gn=void 0},350+n.c))},[i,s]),c.a.createElement("div",{id:"Main",className:m,onDrop:h,onDragOver:h},c.a.createElement(Le,null),c.a.createElement(Bs,null),c.a.createElement(un,null),c.a.createElement(mn,{isOpen:r}),c.a.createElement(hn,{isOpen:o}),c.a.createElement(On,{isOpen:l}),c.a.createElement(jn,{isOpen:d}))}));n.m&&console.log(">>> FINISH LOAD MAIN BUNDLE"),Object(s.d)().initApi()}}]);