2 lines
392 KiB
JavaScript
2 lines
392 KiB
JavaScript
(self.webpackChunktelegram_t=self.webpackChunktelegram_t||[]).push([[5769],{22351:(e,t,s)=>{"use strict";s.r(t),s.d(t,{LockScreen:()=>Xc,Main:()=>Jc});var a=s(33555),n=s(83716),i=s(97184),o=(s(65456),s(27225)),r=s(59187),c=s(91713),d=s(51190),l=s(81396),u=s(65054),m=s(60782),h=s(59692),p=s(490),g=s(69118),f=s(92387),I=s(4463),w=s(11302),v=s(44271),b=s(7054),y=s(84112),P=s(28406),Z=s(26646),S=s(43858),C=s(74399);const M=32*C.Gw,E=45.5*C.Gw,R=26.5*C.Gw,k=16*C.Gw,T=16.125*C.Gw;var N=s(53475),A=s(4907),B=s(42797);function x(e,t){return t-((0,b.jUK)(e).isLeftColumnShown&&!(0,B.W7)()?e.leftColumnWidth||((s=S.Z.get().width)>n._mX?Math.min(Math.max(.25*s,k),.33*s):s>n.ksF?Math.min(Math.max(.33*s,k),.4*s):R):0);var s}function U(e,t,s){const a=(0,b.FM1)(e,t.chatId),n=t.reactions||{results:[],areTags:a},i=(0,b._5C)(e,t.chatId),o=(0,I.vt)(n.results,s);let{recentReactions:r=[]}=n;return r.length&&(r=r.filter((({isOwn:t,peerId:s})=>!t&&s!==e.currentUserId))),s.forEach((t=>{const{currentUserId:s}=e;r.unshift({peerId:i?.id||s,reaction:t,addedDate:Math.floor(Date.now()/1e3),isOwn:!0})})),(0,A.cY)(e,t.chatId,t.id,{reactions:{...n,results:o,recentReactions:r}})}function L(e,t,s){return(0,N.a4)(e,t,s,void 0,!0)}const O=350;function _(e,t,s,a,n,i,o,r){const c=r?.reactions;if(c&&(0,y.A)(n,c))return e;if(e=(0,w.cY)(e,s,a,{reactions:n}),!o)return e;const{reaction:d,isOwn:l,isUnread:m}=n.recentReactions?.[0]??{};if((0,b.$Yd)(e,"reactionEffects")&&r&&d&&m&&!l){const e=(0,p.T)(r);t.startActiveReaction({containerId:e,reaction:d,tabId:(0,u._w)()})}const h=i.unreadReactions?.includes(a);if((0,I.yL)(e,n)&&!h){e=L(e,s,{unreadReactionsCount:(i?.unreadReactionsCount||0)+1,unreadReactions:[...i?.unreadReactions||[],a]});const t=(0,b.hjO)(e,s,a);if(!i||!t)return e;(0,g.R3)((()=>{(0,P.rh)({chat:i,message:t,isReaction:!0})}))}else h&&(e=L(e,s,{unreadReactionsCount:(i?.unreadReactionsCount||1)-1,unreadReactions:i?.unreadReactions?.filter((e=>e!==a))}));return e}function F(e,t,s,a,n=!1){const i=n?(0,b.TmO)(e,t,s):(0,b.hjO)(e,t,s);if(i&&a.content&&!(0,I.AJ)(s)){const{photo:e,video:t,sticker:s,document:n}=(0,I.qp)(i);var o,r;if(e&&a.content.photo)(o=a.content.photo).blobUrl??(o.blobUrl=e.blobUrl),(r=a.content.photo).thumbnail??(r.thumbnail=e.thumbnail);else if(t&&a.content.video){var c;(c=a.content.video).blobUrl??(c.blobUrl=t.blobUrl)}else if(s&&a.content.sticker){var d;(d=a.content.sticker).isPreloadedGlobally??(d.isPreloadedGlobally=s.isPreloadedGlobally)}else if(n&&a.content.document){var l;(l=a.content.document).previewBlobUrl??(l.previewBlobUrl=n.previewBlobUrl)}}const u=i?{...i,...a}:a;return n?(0,w.P4)(e,t,s,u):(0,w.cY)(e,t,s,u)}function D(e,t,s,a){const{chatId:n}=s,i=(0,Z.H)(s),{threadInfo:o}=(0,b.DbP)(e,s)||{};if(!o&&i?.replyToMsgId){const o=(0,b.hjO)(e,n,i.replyToMsgId);o?e=(0,w.lG)(e,o,n,s.id,a):t.loadMessage({chatId:n,messageId:i.replyToMsgId,threadUpdate:{isDeleting:a,lastMessageId:s.id}})}return e}function j(e,t,s){const{id:a,chatId:n}=s,i=(0,b.heq)(e,s),{threadInfo:o}=(0,b.DbP)(e,s)||{},c=(0,b.Z1J)(e,n),d=c?.unreadCount&&!(0,b.gbs)(e,n,r._f);e=D(e,t,s);const{threadId:l}=o??{threadId:i};return l&&(e=(0,w.xj)(e,n,l,[a]),Object.values(e.byTabId).forEach((({id:t})=>{if((0,b.b9T)(e,n,l,t)){const s=(0,b.It8)(e,n,l),i=(0,w.$S)(e,n,l,a,t),o=(0,b.Cbz)(i,n,l,t);s&&!o.includes(s)||(e=i)}})),o&&(e=(0,w.pf)(e,n,l,"threadInfo",{...o,lastMessageId:s.id}),(0,I.CI)(s)||(0,I.FT)(s)||(e=(0,w.Xg)(e,n,l,{messagesCount:(o.messagesCount||0)+1})))),d||(e=(0,w.xj)(e,n,r._f,[a]),Object.values(e.byTabId).forEach((({id:t})=>{if((0,b.b9T)(e,n,r._f,t)){const s=(0,b.It8)(e,n,r._f),i=(0,w.$S)(e,n,r._f,a,t),o=(0,b.Cbz)(i,n,r._f,t);s&&!o.includes(s)||(e=i)}}))),e}function q(e,t,s,a=!1){const{chats:n}=e,i=n.byId[t],o=(0,b.xMv)(e,t),r=i?.isForum?(0,b.p$s)(e,s):void 0;r&&(e=(0,w.Cn)(e,t,r.id,{lastMessageId:s.id}));const c=(0,b.heq)(e,s);return c&&(e=(0,w._l)(e,c,s.id,"saved")),!o||a||o===s.id||o===s.previousLocalId||s.id>o?(0,w._l)(e,t,s.id):e}function G(e,t,s=r._f){const a=(0,b.Zwk)(e,t),n=(0,b.gbs)(e,t,s);if(!a||!n)return;let i=n.length;for(;i--;){const e=a[n[i]];if(e&&!e.isDeleting)return e}}function H(e,t,s,n){if(t){const i=(0,b.Z1J)(e,t);if(!i)return;const o=new Set;o.add(r._f),s.forEach((s=>{e=(0,w.cY)(e,t,s,{isDeleting:!0}),i.topics?.[s]&&(e=(0,w.BK)(e,t,s));const a=(0,b.hjO)(e,t,s);if(!a)return;e=D(e,n,a,!0);const r=(0,b.nrh)(e,a);r&&o.add(r)})),n.requestChatUpdate({chatId:t});const c=new Set(s);return o.forEach((s=>{const a=(0,b.tZg)(e,t,s);if(!a?.lastMessageId||!c.has(a.lastMessageId))return;const n=G(e,t,s);n&&(s===r._f&&(e=q(e,t,n,!0)),e=(0,w.Xg)(e,t,s,{lastMessageId:n.id}),i.isForum&&(e=(0,w.Cn)(e,t,Number(s),{lastMessageId:n.id})))})),(0,a.R3)(e),void setTimeout((()=>{e=(0,a.Rd)(),e=(0,w.K4)(e,t,s),(0,a.R3)(e)}),O)}const i=[];s.forEach((t=>{const s=(0,b.X5I)(e,t);if(s){i.push(s);const o=G(e=(0,w.cY)(e,s,t,{isDeleting:!0}),s);o&&(e=q(e,s,o,!0));const r=(0,b.hjO)(e,s,t);if((0,b.FM1)(e,s)&&r){const t=(0,b.nrh)(e,r);if((0,I._o)(s,t,e.currentUserId)){const a=G(e,s,t);n.requestSavedDialogUpdate({chatId:String(t)}),a&&(e=(0,w._l)(e,s,a.id,"saved"))}}setTimeout((()=>{e=(0,a.Rd)(),e=(0,w.K4)(e,s,[t]),(0,a.R3)(e)}),O)}})),(0,a.R3)(e),(0,m.Tw)(i).forEach((e=>{n.requestChatUpdate({chatId:e})}))}(0,a.iw)("apiUpdate",((e,t,s)=>{switch(s["@type"]){case"newMessage":{const{chatId:n,id:i,message:o,shouldForceReply:r,wasDrafted:c}=s;e=j(e=F(e,n,i,o),t,o);const d=(0,b.hjO)(e,n,i),l=(0,Z.H)(d),u=(0,Z.f)(d),m=(0,b.Z1J)(e,n);m?.isForum&&l?.isForumTopic&&!(0,b.p$s)(e,d)&&l.replyToMsgId&&t.loadTopicById({chatId:n,topicId:l.replyToMsgId});const h=(0,I.CI)(o);if(Object.values(e.byTabId).forEach((({id:s})=>{if(h&&c&&(e=q(e,n,d)),(0,b.KAC)(e,n,o,s)){if(h&&o.isOutgoing&&!o.content?.action&&!u?.storyId&&!o.content?.storyData){const a=(0,b.Btg)(e,s);a&&t.focusMessage({chatId:n,threadId:a.threadId,messageId:o.id,noHighlight:!0,isResizingContainer:!0,tabId:s})}h||setTimeout((()=>{e=(0,a.Rd)(),r&&t.updateDraftReplyInfo({replyToMsgId:i,tabId:s}),e=q(e,n,d),(0,a.R3)(e)}),O)}else e=q(e,n,d)})),(0,a.R3)(e),(0,b.Nap)(e,n)||t.loadTopChats(),(0,b.FM1)(e,n)&&!h){const s=(0,b.heq)(e,d);s&&!(0,b.Nap)(e,s,"saved")&&t.requestSavedDialogUpdate({chatId:s})}break}case"updateChatLastMessage":{const{id:t,lastMessage:n}=s;e=q(e,t,n,!0),e=(0,w.m6)(e,[n]),(0,a.R3)(e);break}case"updateStartEmojiInteraction":Object.values(e.byTabId).forEach((({id:t})=>{const{chatId:a}=(0,b.Btg)(e,t)||{};if(a!==s.id)return;const n=(0,b.hjO)(e,a,s.messageId);if(!n)return;if((0,I.UD)(n)!==s.emoji)return;const i=(0,b.jUK)(e,t);e=(0,v.i)(e,{activeEmojiInteractions:[...i.activeEmojiInteractions||[],{id:Math.random(),animatedEffect:s.emoji,messageId:s.messageId}]},t)})),(0,a.R3)(e);break;case"newScheduledMessage":{const{chatId:t,id:n,message:i}=s;e=F(e,t,n,i,!0);const o=(0,b.qyA)(e,t,r._f)||[];e=(0,w.pf)(e,t,r._f,"scheduledIds",(0,m.Tw)([...o,n]));const c=(0,b.nrh)(e,i);if(c!==r._f){const s=(0,b.qyA)(e,t,c)||[];e=(0,w.pf)(e,t,c,"scheduledIds",(0,m.Tw)([...s,n]))}(0,a.R3)(e);break}case"updateMessage":{const{chatId:n,id:i,message:o}=s,r=(0,b.hjO)(e,n,i),c=(0,b.Z1J)(e,n);e=F(e,n,i,o);const d=(0,b.hjO)(e,n,i);o.reactions&&c&&(e=_(e,t,n,i,o.reactions,c,d.isOutgoing,r)),o.content?.text?.text!==r?.content?.text?.text&&(e=(0,w.CE)(e,n,i)),(0,a.R3)(e);break}case"updateScheduledMessage":{const{chatId:t,id:n,message:i}=s,o=(0,b.TmO)(e,t,n);if(!o)return;e=F(e,t,n,i,!0);const c=Object.keys((0,b.yBV)(e,t)||{}).map(Number).sort(((e,t)=>t-e));e=(0,w.pf)(e,t,r._f,"scheduledIds",c);const d=(0,b.nrh)(e,o);if(d!==r._f){const s=(0,b.qyA)(e,t,d)||[];e=(0,w.pf)(e,t,d,"scheduledIds",s.sort(((e,t)=>t-e)))}(0,a.R3)(e);break}case"updateMessageSendSucceeded":{const{chatId:n,localId:i,message:o}=s;e=j(e,t,o);const c=(0,b.hjO)(e,n,i);e=(0,w.K4)(e,n,[i]),o.isScheduled&&(e=(0,w.bV)(e,n,[i])),e=(0,w.cY)(e,n,o.id,{...c,...o,previousLocalId:i}),e={...e,fileUploads:{byMessageKey:(0,m.CE)(e.fileUploads.byMessageKey,[(0,p.T)(o)])}};const d=(0,b.hjO)(e,n,o.id);e=q(e,n,d);const l=(0,b.DbP)(e,o);if(Object.values(e.byTabId).forEach((({id:s})=>{const{chatId:a,threadId:i}=(0,b.Btg)(e,s)||{};a===n&&(l?.threadInfo?.threadId||r._f)===i&&t.markMessageListRead({maxId:o.id,tabId:s})})),l?.threadInfo?.threadId&&(e=(0,w.pf)(e,n,l.threadInfo.threadId,"threadInfo",{...l.threadInfo,lastMessageId:o.id,lastReadInboxMessageId:o.id})),e=(0,w.a4)(e,n,{lastReadInboxMessageId:o.id}),(0,b.FM1)(e,n)){const s=(0,b.heq)(e,d);s&&!(0,b.Nap)(e,s,"saved")&&t.requestSavedDialogUpdate({chatId:s})}(0,a.R3)(e);break}case"updateScheduledMessageSendSucceeded":{const{chatId:t,localId:n,message:i}=s,o=(0,b.qyA)(e,t,r._f)||[];e=(0,w.pf)(e,t,r._f,"scheduledIds",[...o,i.id]);const c=(0,b.nrh)(e,i);if(c!==r._f){const s=(0,b.qyA)(e,t,c)||[];e=(0,w.pf)(e,t,c,"scheduledIds",[...s,i.id])}const d=(0,b.TmO)(e,t,n);e=(0,w.bV)(e,t,[n]),e=(0,w.P4)(e,t,i.id,{...d,...i,previousLocalId:n}),(0,a.R3)(e);break}case"updatePinnedIds":{const{chatId:t,isPinned:n,messageIds:i}=s,o=(0,m.q0)((0,b.Zwk)(e,t),i),c={[r._f]:i};Object.values(o).forEach((s=>{const a=(0,b.nrh)(e,s);if(e=(0,w.cY)(e,t,s.id,{isPinned:n}),a===r._f)return;const i=c[a]||[];i.push(s.id),c[a]=i})),Object.entries(c).forEach((([s,a])=>{const i=(0,b.KBA)(e,t,r._f)||[],o=n?(0,m.Tw)(i.concat(a)).sort(((e,t)=>t-e)):i.filter((e=>!a.includes(e)));e=(0,w.pf)(e,t,Number(s),"pinnedIds",o)})),(0,a.R3)(e);break}case"updateThreadInfos":{const{threadInfoUpdates:n}=s;e=(0,w.j6)(e,n),n.forEach((s=>{const{chatId:a,threadId:n}=s;if(!a||!n)return;const i=(0,b.Z1J)(e,a),o=(0,b.tZg)(e,a,n);if(i?.isForum&&s.lastReadInboxMessageId!==o?.lastReadInboxMessageId&&t.loadTopicById({chatId:a,topicId:Number(n)}),!i?.isForum){const t=i?.lastReadInboxMessageId,o=s.lastReadInboxMessageId||t;t&&o&&(e=(0,w.Xg)(e,a,n,{lastReadInboxMessageId:Math.max(o,t)}))}})),(0,a.R3)(e);break}case"resetMessages":{const{id:n}=s,i=(0,b.Zwk)(e,n);if(i&&!(0,I.YC)(n)){const s=(0,u._w)();e=(0,w.K4)(e,n,Object.keys(i).map(Number)),(0,a.R3)(e),t.loadFullChat({chatId:n,force:!0,tabId:s}),t.loadViewportMessages({chatId:n,threadId:r._f,tabId:s})}break}case"deleteMessages":{const{ids:a,chatId:n}=s;H(e,n,a,t);break}case"deleteScheduledMessages":{const{ids:t,chatId:n}=s;!function(e,t,s,n){e&&(t.forEach((t=>{n=(0,w.P4)(n,e,t,{isDeleting:!0})})),(0,a.R3)(n),setTimeout((()=>{n=(0,a.Rd)(),n=(0,w.bV)(n,e,t);const s=(0,b.yBV)(n,e);n=(0,w.pf)(n,e,r._f,"scheduledIds",Object.keys(s||{}).map(Number)),(0,a.R3)(n)}),O))}(n,t,0,e);break}case"deleteHistory":{const{chatId:i}=s,o=e.messages.byChatId[i];if(i===n.awM&&(e={...e,serviceNotifications:e.serviceNotifications.map((e=>({...e,isDeleted:!0})))},(0,a.R3)(e)),o){const s=Object.keys(o.byId).map(Number);H(e=(0,a.Rd)(),i,s,t)}else t.requestChatUpdate({chatId:i});e=(0,a.Rd)(),e=(0,w.kq)(e,i),(0,a.R3)(e);break}case"deleteSavedHistory":{const{chatId:n}=s,i=e.currentUserId;e=(0,w.kq)(e,n,"saved"),(0,a.R3)(e),function(e,t,s,a){const n=(0,b.Zwk)(e,t);if(!n)return;const i=Object.values(n).filter((t=>(0,b.nrh)(e,t)===s)).map((e=>e.id));i.length&&H(e,t,i,a)}(e=(0,a.Rd)(),i,n,t);break}case"updateCommonBoxMessages":{const{ids:t,messageUpdate:n}=s;t.forEach((t=>{const s=(0,b.X5I)(e,t);s&&(e=(0,w.cY)(e,s,t,n))})),(0,a.R3)(e);break}case"updateChannelMessages":{const{channelId:t,ids:n,messageUpdate:i}=s;n.forEach((s=>{e=(0,w.cY)(e,t,s,i)})),(0,a.R3)(e);break}case"updateMessagePoll":{const{pollId:t,pollUpdate:n}=s,i=(0,b.ZBV)(e,t);if(i?.content.poll){const t=i.content.poll.results;let s=t;n.results?.results&&(t.results&&n.results.isMin?t.results&&(s={...n.results,results:n.results.results.map((e=>({...e,isChosen:t.results.find((t=>t.option===e.option))?.isChosen}))),isMin:void 0}):s=n.results);const o={...i.content.poll,...n,results:s};e=(0,w.cY)(e,i.chatId,i.id,{content:{...i.content,poll:o}}),(0,a.R3)(e)}break}case"updateMessagePollVote":{const{pollId:t,peerId:n,options:i}=s,o=(0,b.ZBV)(e,t);if(!o||!o.content.poll||!o.content.poll.results)break;const{poll:r}=o.content,c=(0,b._5C)(e,o.chatId),{recentVoterIds:d,totalVoters:l,results:u}=r.results,m=d?[...d]:[],h=l?l+1:1,p=u?[...u]:[];m.push(n),i.forEach((t=>{const s=p.findIndex((e=>e.option===t)),a=p[s],i=a?{...a}:{option:t,votersCount:0};i.votersCount+=1,c?.id!==n&&n!==e.currentUserId||(i.isChosen=!0),s?p[s]=i:p.push(i)})),e=(0,w.cY)(e,o.chatId,o.id,{content:{...o.content,poll:{...r,results:{...r.results,recentVoterIds:m,totalVoters:h,results:p}}}}),(0,a.R3)(e);break}case"updateServiceNotification":{const{message:a}=s;(0,b.UWV)(e)&&t.createServiceNotification({message:a});break}case"updateMessageReactions":{const{chatId:n,id:i,reactions:o}=s,r=(0,b.hjO)(e,n,i),c=(0,b.Z1J)(e,s.chatId);if(!c||!r)return;e=_(e,t,n,i,o,c,r.isOutgoing,r),(0,a.R3)(e);break}case"updateMessageExtendedMedia":{const{chatId:t,id:n,media:i,preview:o}=s,r=(0,b.hjO)(e,t,n);if(!(0,b.Z1J)(e,s.chatId)||!r)return;if(o){if(!r.content.invoice)return;e=(0,w.cY)(e,t,n,{content:{...r.content,invoice:{...r.content.invoice,extendedMedia:o}}}),(0,a.R3)(e)}else i&&(e=(0,w.cY)(e,t,n,{content:{...i}}),(0,a.R3)(e));break}case"updateTranscribedAudio":{const{transcriptionId:t,text:n,isPending:i}=s;e={...e,transcriptions:{...e.transcriptions,[t]:{...e.transcriptions[t]||{},transcriptionId:t,text:n,isPending:i}}},(0,a.R3)(e);break}case"updateMessageSendFailed":{const{chatId:n,localId:i,error:o}=s;o.match(/CHAT_SEND_.+?FORBIDDEN/)&&Object.values(e.byTabId).forEach((({id:e})=>{t.showAllowedMessageTypesNotification({chatId:n,tabId:e})})),e=(0,w.cY)(e,n,i,{sendingState:"messageSendingStateFailed"}),(0,a.R3)(e);break}case"updateMessageTranslations":{const{chatId:t,messageIds:n,toLanguageCode:i,translations:o}=s;e=(0,w.TD)(e,t,n,i,o),(0,a.R3)(e);break}}}));const V=new Map,$=(0,g.Ds)((e=>e()),500,!1);async function z({global:e,chatId:t,threadId:s,draft:n,isLocalOnly:i,noLocalTimeUpdate:o}){const r=(0,b.Z1J)(e,t),c=(0,b.dyD)(e,t);if(!r||c&&(0,I.NB)(c))return;const d=(0,b.U1D)(e,t,s,n?.replyInfo),l=n?{...n,replyInfo:d,date:Math.floor(Date.now()/1e3),isLocal:!0}:void 0;e=(0,w.pf)(e,t,s,"draft",l),o||(e=(0,w.a4)(e,t,{draftDate:l?.date})),(0,a.R3)(e),i||(await(0,f.t9)("saveDraft",{chat:r,draft:l})&&l&&(l.isLocal=!1),e=(0,a.Rd)(),e=(0,w.pf)(e,t,s,"draft",l),e=(0,w.a4)(e,t,{draftDate:l?.date}),(0,a.R3)(e))}async function K(e,t,s,i,o,d=!1,l=!1,h,...[p=(0,u._w)()]){const g=t.id;let v,y=n.hT6;switch(o){case c.Uq.Backwards:i?(v=-1,y+=1):v=void 0;break;case c.Uq.Around:v=-(Math.round(n.hT6/2)+1);break;case c.Uq.Forwards:v=-(n.hT6+1),i&&(y+=1)}const P=(e=(0,a.Rd)()).currentUserId,Z=(0,I._o)(g,s,P),S=Z?String(s):g,C=await(0,f.t9)("fetchMessages",{chat:(0,b.Z1J)(e,S),offsetId:i,addOffset:v,limit:y,threadId:s,isSavedDialog:Z});if(!C)return;const{messages:M,users:E,chats:R,count:k}=C;e=(0,a.Rd)();const T=g===n.awM?e.serviceNotifications.filter((({isDeleted:e})=>!e)).map((({message:e})=>e)):[],N=[].concat(M,T),A=(0,m.ee)(N,"id"),B=Object.keys(A).map(Number);if(s!==r._f&&!(0,I._o)(g,s,e.currentUserId)){const t=(0,b.yZJ)(e,g,s);B[0]&&t!==B[0]||t===s||B.unshift(Number(s))}e=(0,w.c_)(e,g,A),e=d?(0,w.hv)(e,g,s,B):(0,w.xj)(e,g,s,B),e=(0,w.Sh)(e,(0,m.ee)(E,"id")),e=(0,w.fZ)(e,(0,m.ee)(R,"id"));let x=(0,b.gbs)(e,g,s);const U=i?(0,b.ofg)(e,g,s,i):void 0;if(d&&x&&U&&(U.length&&!(0,m.YE)(x,U)||(e=(0,w.xj)(e,g,s,U),x=(0,b.gbs)(e,g,s),e=(0,w.IU)(e,g,s,U),d=!1)),!l){const t=d&&U?U:x;if(t){const{newViewportIds:a}=J(t,i,o);e=(0,w.y9)(e,g,s,a,p)}}k&&(e=(0,w.Xg)(e,t.id,s,{messagesCount:k})),(0,a.R3)(e),h?.()}function J(e,t,s){const{length:a}=e,i=t?function(e,t){return t<e[0]?0:t>e[e.length-1]?e.length-1:e.findIndex(((s,a)=>s===t||s<t&&e[a+1]>t))}(e,t):-1,o=s===c.Uq.Backwards?i:i+1||a,r=s===c.Uq.Around?Math.round(n.hT6/2):n.hT6,d=o-r,l=o+r-1,u=e.slice(Math.max(0,d),l+1);let m,h;switch(s){case c.Uq.Backwards:m=o>=0,h=d>=0;break;case c.Uq.Forwards:m=o<a,h=l<=a-1;break;case c.Uq.Around:default:m=u.length>0,h=u.length===n.hT6}return{newViewportIds:u,areSomeLocal:m,areAllLocal:h}}async function W(e,t){let s;const n=t.attachment?(t,i)=>{V.has(i)||(s=i,V.set(i,n)),e=(0,a.Rd)(),e=(0,w.RZ)(e,i,t),(0,a.R3)(e)}:void 0;(t.replyInfo||i.cj)&&await(0,g.Pn)(),await(0,f.t9)("sendMessage",t,n),n&&s&&(e=(0,a.Rd)(),e=(0,w.RZ)(e,s,void 0),(0,a.R3)(e),V.delete(s))}(0,a.iw)("loadViewportMessages",((e,t,s)=>{const{direction:n=c.Uq.Around,isBudgetPreload:i=!1,shouldForceRender:o=!1,onLoaded:r,onError:d,tabId:l=(0,u._w)()}=s||{};let{chatId:m,threadId:h}=s||{};if(!m||!h){const t=(0,b.Btg)(e,l);if(!t)return void d?.();m=t.chatId,h=t.threadId}const p=(0,b.Z1J)(e,m);if(!p||p.isRestricted)return void d?.();const f=(0,b.Cbz)(e,m,h,l),v=(0,b.gbs)(e,m,h);if(f&&f.length&&n!==c.Uq.Around){const s=n===c.Uq.Backwards?f[0]:f[f.length-1];if((0,I.AJ)(s))return;if(s===h&&n===c.Uq.Backwards)return;const a=Boolean(v&&!v.includes(s)),o=a?(0,b.ofg)(e,m,h,s):v,{newViewportIds:d,areSomeLocal:y,areAllLocal:P}=J(o,s,n);if(y&&(e=(0,w.y9)(e,m,h,d,l)),(0,g.R3)((()=>{!async function(e,t,s,a,n,i,o,r,c,d,...[l=(0,u._w)()]){s||await K(e,i,o,c,r,a,n,d,l),n||t.loadViewportMessages({chatId:i.id,threadId:o,direction:r,isBudgetPreload:!0,onLoaded:d,tabId:l})}(e,t,P,a,i,p,h,n,s,r,l)})),i)return}else{const t=(0,b.G$N)(e,m,l)||(0,b.rdT)(e,m,h),s=Boolean(t&&v&&!v.includes(t)),a=(s?(0,b.ofg)(e,m,h,t):v)||[],{newViewportIds:n,areSomeLocal:o,areAllLocal:d}=J(a,t,c.Uq.Around);o&&(e=(0,w.y9)(e,m,h,n,l)),d?r?.():(0,g.R3)((()=>{K(e,p,h,t,c.Uq.Around,s,i,r,l)}))}(0,a.R3)(e,{forceOnHeavyAnimation:o})})),(0,a.iw)("loadMessage",(async(e,t,s)=>{const{chatId:n,messageId:i,replyOriginForId:o,threadUpdate:c}=s,d=(0,b.Z1J)(e,n);if(!d)return;const l=await async function(e,t,s,n){const i=await(0,f.t9)("fetchMessage",{chat:t,messageId:s});if(i){if(i!==r._Q)return e=(0,a.Rd)(),e=(0,w.cY)(e,t.id,s,i.message),e=(0,w.Sh)(e,(0,m.ee)(i.users,"id")),(0,a.R3)(e),i.message;if(n){e=(0,a.Rd)();const s=(0,b.hjO)(e,t.id,n);e=(0,w.cY)(e,t.id,n,{...s,replyInfo:void 0}),(0,a.R3)(e)}}}(e,d,i,o);if(l&&c){const{lastMessageId:t,isDeleting:s}=c;e=(0,a.Rd)(),e=(0,w.lG)(e,l,n,t,s),(0,a.R3)(e)}})),(0,a.iw)("sendMessage",((e,t,s)=>{const{messageList:a,tabId:i=(0,u._w)()}=s,{storyId:o,peerId:c}=(0,b.pri)(e,i),d=Boolean(o&&c);if(!a&&!d)return;let{chatId:l,threadId:h,type:p}=a||{};if(d&&(l=c,h=r._f,p="thread"),s=(0,m.CE)(s,["tabId"]),"scheduled"===p&&!s.scheduledAt)return(0,v.i)(e,{contentToBeScheduled:s},i);const g=(0,b.Z1J)(e,l),f=(0,b.Mst)(e,l,h),I=d?void 0:f?.replyInfo,w=d?{type:"story",peerId:c,storyId:o}:void 0,y=(0,b.U1D)(e,l,h,I),P=w||y,Z=(0,b.xMv)(e,l),S={...s,chat:g,replyInfo:P,noWebPage:(0,b.tVX)(e,l,h),sendAs:(0,b._5C)(e,l),lastMessageId:Z};d||t.clearWebPagePreview({tabId:i});const C=!s.attachments||s.attachments.length<=1,M=!C&&s.shouldGroupMessages;if(C){const{attachments:t,...s}=S;W(e,{...s,attachment:t?t[0]:void 0,wasDrafted:Boolean(f)})}else if(M){const{text:t,entities:s,attachments:a,...i}=S,o=function(e){return e.reduce(((e,t,s,a)=>0===s?(e.push([t]),e):(ee(t)===ee(a[s-1])?e[e.length-1].push(t):e.push([t]),e)),[])}(a);o.forEach(((a,o)=>{const r=(0,m.Vl)(a,n.DUi);for(let a=0;a<r.length;a++){const[n,...c]=r[a],d=`${Date.now()}${o}${a}`,l=0===a&&0===o;W(e,{...i,text:l?t:void 0,entities:l?s:void 0,attachment:n,groupedId:c.length>0?d:void 0,wasDrafted:Boolean(f)}),c.forEach((t=>{W(e,{...i,attachment:t,groupedId:d})}))}}))}else{const{text:t,entities:s,attachments:a,replyInfo:n,...i}=S;t&&W(e,{...i,text:t,entities:s,replyInfo:n,wasDrafted:Boolean(f)}),a?.forEach((t=>{W(e,{...i,attachment:t})}))}})),(0,a.iw)("sendInviteMessages",(async(e,t,s)=>{const{chatId:a,userIds:n,tabId:i=(0,u._w)()}=s,o=(0,b.x67)(e,a);if(!o?.inviteLink)return;const r=[];return await Promise.all(n.map((t=>{const s=(0,b.Z1J)(e,t);if(!s)return;const a=(0,I.Js)((0,b.dyD)(e,t));return a&&r.push(a),W(e,{chat:s,text:o.inviteLink})}))),t.showNotification({message:(0,h.Iu)("Conversation.ShareLinkTooltip.Chat.One",r.join(", ")),tabId:i})})),(0,a.iw)("editMessage",((e,t,s)=>{const{messageList:n,text:i,entities:o,attachments:r,tabId:c=(0,u._w)()}=s;if(!n)return;let d;const l=r?(t,s)=>{V.has(s)||(d=s,V.set(s,l)),e=(0,a.Rd)(),e=(0,w.RZ)(e,s,t),(0,a.R3)(e)}:void 0,{chatId:m,threadId:h,type:p}=n,g=(0,b.Z1J)(e,m),I=(0,b.kKD)(e,m,h,p);g&&I&&(t.setEditingId({messageId:void 0,tabId:c}),(async()=>{await(0,f.t9)("editMessage",{chat:g,message:I,attachment:r?r[0]:void 0,text:i,entities:o,noWebPage:(0,b.tVX)(e,m,h)},l),l&&d&&(e=(0,a.Rd)(),e=(0,w.RZ)(e,d,void 0),(0,a.R3)(e),V.delete(d))})())})),(0,a.iw)("cancelUploadMedia",((e,t,s)=>{const{chatId:a,messageId:n}=s,i=(0,b.hjO)(e,a,n);if(!i)return;const o=i&&V.get((0,p.T)(i));o&&(0,f.u3)(o),(0,I.CI)(i)&&t.apiUpdate({"@type":"deleteMessages",ids:[n],chatId:a})})),(0,a.iw)("saveDraft",((e,t,s)=>{const{chatId:a,threadId:n,text:i}=s;if(!i)return;const o=(0,b.Mst)(e,a,n);z({global:e,chatId:a,threadId:n,draft:{text:i,replyInfo:o?.replyInfo}})})),(0,a.iw)("clearDraft",((e,t,s)=>{const{chatId:a,threadId:n=r._f,isLocalOnly:i,shouldKeepReply:o}=s,c=(0,b.Mst)(e,a,n);if(!c)return;const d=c.replyInfo;z({global:e,chatId:a,threadId:n,draft:o&&d?{replyInfo:d}:void 0,isLocalOnly:i})})),(0,a.iw)("updateDraftReplyInfo",((e,t,s)=>{const{tabId:a=(0,u._w)(),...n}=s,i=(0,b.Btg)(e,a);if(!i)return;const{chatId:o,threadId:r}=i,c=(0,b.Mst)(e,o,r),d={type:"message",...c?.replyInfo,...n};d.replyToMsgId&&z({global:e,chatId:o,threadId:r,draft:{...c,replyInfo:d},isLocalOnly:!0,noLocalTimeUpdate:!0})})),(0,a.iw)("resetDraftReplyInfo",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{},n=(0,b.Btg)(e,a);if(!n)return;const{chatId:i,threadId:o}=n,r=(0,b.Mst)(e,i,o),c=r?.text?{...r,replyInfo:void 0}:void 0;z({global:e,chatId:i,threadId:o,draft:c,isLocalOnly:Boolean(c)})})),(0,a.iw)("toggleMessageWebPage",((e,t,s)=>{const{chatId:a,threadId:n,noWebPage:i}=s;return(0,w.pf)(e,a,n,"noWebPage",i)})),(0,a.iw)("pinMessage",((e,t,s)=>{const{messageId:a,isUnpin:n,isOneSide:i,isSilent:o,tabId:r=(0,u._w)()}=s,c=(0,b.jrE)(e,r);c&&(0,f.t9)("pinMessage",{chat:c,messageId:a,isUnpin:n,isOneSide:i,isSilent:o})})),(0,a.iw)("unpinAllMessages",(async(e,t,s)=>{const{chatId:n,threadId:i}=s,o=(0,b.Z1J)(e,n);if(!o)return;await(0,f.t9)("unpinAllMessages",{chat:o,threadId:i}),e=(0,a.Rd)();const c=(0,b.KBA)(e,n,i);c?.forEach((t=>{e=(0,w.cY)(e,n,t,{isPinned:!1})})),e=(0,w.pf)(e,o.id,r._f,"pinnedIds",[]),(0,a.R3)(e)})),(0,a.iw)("deleteMessages",((e,t,s)=>{const{messageIds:a,shouldDeleteForAll:n,tabId:i=(0,u._w)()}=s,o=(0,b.Btg)(e,i);if(!o)return;const{chatId:r,threadId:c}=o,d=(0,b.Z1J)(e,r),l=a.filter((t=>{const s=(0,b.hjO)(e,r,t);return s&&!(0,I.CI)(s)}));if(!l.length&&a.length)return void H(e,(0,I.eA)(d)?r:void 0,a,t);(0,f.t9)("deleteMessages",{chat:d,messageIds:l,shouldDeleteForAll:n});const m=(0,b._$9)(e,r,c);m&&a.includes(m)&&t.setEditingId({messageId:void 0,tabId:i})})),(0,a.iw)("deleteScheduledMessages",((e,t,s)=>{const{messageIds:a,tabId:n=(0,u._w)()}=s,i=(0,b.Btg)(e,n);if(!i)return;const{chatId:o}=i,r=(0,b.Z1J)(e,o);(0,f.t9)("deleteScheduledMessages",{chat:r,messageIds:a});const c=(0,b.nBP)(e,o);c&&a.includes(c)&&t.setEditingId({messageId:void 0,tabId:n})})),(0,a.iw)("deleteHistory",(async(e,t,s)=>{const{chatId:n,shouldDeleteForAll:i,tabId:o=(0,u._w)()}=s,r=(0,b.Z1J)(e,n);if(!r)return;await(0,f.t9)("deleteHistory",{chat:r,shouldDeleteForAll:i}),e=(0,a.Rd)();const c=(0,b.Btg)(e,o);c&&c.chatId===n&&t.openChat({id:void 0,tabId:o});const d=e.chatFolders.byId;Object.values(d).forEach((e=>{if(e.includedChatIds.includes(n)||e.pinnedChatIds?.includes(n)){const t=e.includedChatIds.filter((e=>e!==n)),s=e.pinnedChatIds?.filter((e=>e!==n)),a={...e,includedChatIds:t,pinnedChatIds:s};(0,f.t9)("editChatFolder",{id:e.id,folderUpdate:a})}}))})),(0,a.iw)("deleteSavedHistory",(async(e,t,s)=>{const{chatId:n,tabId:i=(0,u._w)()}=s,o=(0,b.Z1J)(e,n);if(!o)return;await(0,f.t9)("deleteSavedHistory",{chat:o}),e=(0,a.Rd)();const r=(0,b.Btg)(e,i);r&&r.threadId===n&&t.openChat({id:void 0,tabId:i})})),(0,a.iw)("reportMessages",(async(e,t,s)=>{const{messageIds:a,reason:n,description:i,tabId:o=(0,u._w)()}=s,r=(0,b.Btg)(e,o);if(!r)return;const{chatId:c}=r,d=(0,b.Z1J)(e,c),l=await(0,f.t9)("reportMessages",{peer:d,messageIds:a,reason:n,description:i});t.showNotification({message:l?(0,h.Iu)("ReportPeer.AlertSuccess"):"An error occurred while submitting your report. Please, try again later.",tabId:o})})),(0,a.iw)("sendMessageAction",(async(e,t,s)=>{const{action:a,chatId:n,threadId:i}=s;if("connectionStateReady"!==e.connectionState)return;if((0,b.FM1)(e,n))return;const o=(0,b.Z1J)(e,n);if(!o)return;const r=(0,b.dyD)(e,n);r&&((0,I.cS)(r)||(0,I.NB)(r))||await(0,f.t9)("sendMessageAction",{peer:o,threadId:i,action:a})})),(0,a.iw)("markMessageListRead",((e,t,s)=>{const{maxId:a,tabId:i=(0,u._w)()}=s,o=(0,b.Btg)(e,i);if(!o)return;const{chatId:c,threadId:d}=o,l=(0,b.Z1J)(e,c);if(!l||(0,I._o)(c,d,e.currentUserId))return;$((()=>{(0,f.t9)("markMessageListRead",{chat:l,threadId:d,maxId:a})})),c===n.awM&&(e={...e,serviceNotifications:e.serviceNotifications.map((e=>e.isUnread&&e.id<=a?{...e,isUnread:!1}:e))});const m=(0,b.Cbz)(e,c,d,i),h=(0,b.It8)(e,c,d);if(d!==r._f&&!l.isForum)return(0,w.Xg)(e,c,d,{lastReadInboxMessageId:a});if(!m||!h||!l.unreadCount)return e;const p=function(e,t,s){let a=0;for(let n=0,i=e.length;n<i&&(e[n]>=t&&e[n]<=s&&a++,!(e[n]>=s));n++);return a}(m,h,a);if(!p)return e;if(l.isForum&&l.topics?.[d]){const t=l.topics[d];e=(0,w.Xg)(e,c,d,{lastReadInboxMessageId:a});const s=Math.max(0,t.unreadCount-p);return 0===s&&(e=(0,w.a4)(e,c,{unreadCount:Math.max(0,l.unreadCount-1)})),(0,w.Cn)(e,c,Number(d),{unreadCount:s})}return(0,w.a4)(e,c,{lastReadInboxMessageId:a,unreadCount:Math.max(0,l.unreadCount-p)})})),(0,a.iw)("markMessagesRead",((e,t,s)=>{const{messageIds:a,tabId:n=(0,u._w)()}=s,i=(0,b.jrE)(e,n);i&&(0,f.t9)("markMessagesRead",{chat:i,messageIds:a})})),(0,a.iw)("loadWebPagePreview",(async(e,t,s)=>{const{text:n,tabId:i=(0,u._w)()}=s,o=await(0,f.t9)("fetchWebPagePreview",{text:n});e=(0,a.Rd)(),e=(0,v.i)(e,{webPagePreview:o},i),(0,a.R3)(e)})),(0,a.iw)("clearWebPagePreview",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{};if((0,b.jUK)(e,a).webPagePreview)return(0,v.i)(e,{webPagePreview:void 0},a)})),(0,a.iw)("sendPollVote",((e,t,s)=>{const{chatId:a,messageId:n,options:i}=s,o=(0,b.Z1J)(e,a);o&&(0,f.t9)("sendPollVote",{chat:o,messageId:n,options:i})})),(0,a.iw)("cancelPollVote",((e,t,s)=>{const{chatId:a,messageId:n}=s,i=(0,b.Z1J)(e,a);i&&(0,f.t9)("sendPollVote",{chat:i,messageId:n,options:[]})})),(0,a.iw)("closePoll",((e,t,s)=>{const{chatId:a,messageId:n}=s,i=(0,b.Z1J)(e,a),o=(0,b.hjO)(e,a,n)?.content.poll;i&&o&&(0,f.t9)("closePoll",{chat:i,messageId:n,poll:o})})),(0,a.iw)("loadPollOptionResults",(async(e,t,s)=>{const{chat:n,messageId:i,option:o,offset:r,limit:c,shouldResetVoters:d,tabId:l=(0,u._w)()}=s,h=await(0,f.t9)("loadPollOptionResults",{chat:n,messageId:i,option:o,offset:r,limit:c});if(!h)return;e=(0,a.Rd)(),e=(0,w.Sh)(e,(0,m.ee)(h.users,"id")),e=(0,w.fZ)(e,(0,m.ee)(h.chats,"id"));const p=(0,b.jUK)(e,l),{pollResults:g}=p,{voters:I}=p.pollResults;e=(0,v.i)(e,{pollResults:{...g,voters:{...I,[o]:(0,m.Tw)([...!d&&I?.[o]?I[o]:[],...h.votes.map((e=>e.peerId))])},offsets:{...g.offsets?g.offsets:{},[o]:h.nextOffset||""}}},l),(0,a.R3)(e)})),(0,a.iw)("loadExtendedMedia",((e,t,s)=>{const{chatId:a,ids:n}=s,i=(0,b.Z1J)(e,a);i&&(0,f.t9)("fetchExtendedMedia",{chat:i,ids:n})})),(0,a.iw)("forwardMessages",((e,t,s)=>{const{isSilent:n,scheduledAt:i,tabId:o=(0,u._w)()}=s,{fromChatId:c,messageIds:d,toChatId:l,withMyScore:h,noAuthors:p,noCaptions:w,toThreadId:y=r._f}=(0,b.jUK)(e,o).forwardMessages,P=(0,b.wVz)(e),Z=y===r._f,S=c?(0,b.Z1J)(e,c):void 0,C=l?(0,b.Z1J)(e,l):void 0,M=c&&d?d.sort(((e,t)=>e-t)).map((t=>(0,b.hjO)(e,c,t))).filter(Boolean):void 0;if(!S||!C||!M||y&&!Z&&!C.isForum)return;const E=(0,b._5C)(e,l),R=(0,b.Mst)(e,l,y||r._f),k=(0,b.xMv)(e,C.id),[T,N]=(0,m.uK)(M,(e=>!(0,I.jM)(e)));T.length&&(async()=>{await(0,g.Pn)(),(0,f.t9)("forwardMessages",{fromChat:S,toChat:C,toThreadId:y,messages:T,isSilent:n,scheduledAt:i,sendAs:E,withMyScore:h,noAuthors:p,noCaptions:w,isCurrentUserPremium:P,wasDrafted:Boolean(R),lastMessageId:k})})(),N.forEach((t=>{const{text:s,entities:a}=t.content.text||{},{sticker:o,poll:r}=t.content,c=(0,b.U1D)(e,C.id,y);W(e,{chat:C,replyInfo:c,text:s,entities:a,sticker:o,poll:r,isSilent:n,scheduledAt:i,sendAs:E,lastMessageId:k})})),e=(0,a.Rd)(),e=(0,v.i)(e,{forwardMessages:{}},o),(0,a.R3)(e)})),(0,a.iw)("loadScheduledHistory",(async(e,t,s)=>{const{chatId:n}=s,i=(0,b.Z1J)(e,n);if(!i)return;const o=await(0,f.t9)("fetchScheduledHistory",{chat:i});if(!o)return;const{messages:c}=o,d=(0,m.ee)(c,"id"),l=Object.keys(d).map(Number).sort(((e,t)=>t-e));if(e=(0,a.Rd)(),e=(0,w.w3)(e,i.id,d),e=(0,w.pf)(e,i.id,r._f,"scheduledIds",l),i?.isForum){const t={};c.forEach((s=>{const a=(0,b.nrh)(e,s),n=t[a]||[];n.push(s.id),t[a]=n})),Object.entries(t).forEach((([t,s])=>{e=(0,w.pf)(e,i.id,Number(t),"scheduledIds",s)}))}(0,a.R3)(e)})),(0,a.iw)("sendScheduledMessages",((e,t,s)=>{const{chatId:a,id:n}=s,i=(0,b.Z1J)(e,a);i&&(0,f.t9)("sendScheduledMessages",{chat:i,ids:[n]})})),(0,a.iw)("rescheduleMessage",((e,t,s)=>{const{chatId:a,messageId:n,scheduledAt:i}=s,o=(0,b.Z1J)(e,a),r=o&&(0,b.TmO)(e,o.id,n);o&&r&&(0,f.t9)("rescheduleMessage",{chat:o,message:r,scheduledAt:i})})),(0,a.iw)("transcribeAudio",(async(e,t,s)=>{const{messageId:n,chatId:i}=s,o=(0,b.Z1J)(e,i);if(!o)return;e=(0,w.cY)(e,i,n,{transcriptionId:""}),(0,a.R3)(e);const r=await(0,f.t9)("transcribeAudio",{chat:o,messageId:n});e=(0,a.Rd)(),e=(0,w.cY)(e,i,n,{transcriptionId:r,isTranscriptionError:!r}),(0,a.R3)(e)})),(0,a.iw)("loadCustomEmojis",(async(e,t,s)=>{const{ids:n,ignoreCache:i}=s,o=i?n:(0,m.Tw)(n.filter((t=>!e.customEmojis.byId[t]))),r=await(0,f.t9)("fetchCustomEmoji",{documentId:o});r&&(e=(0,a.Rd)(),e={...e,customEmojis:{...e.customEmojis,byId:{...e.customEmojis.byId,...(0,m.ee)(r,"id")}}},(0,a.R3)(e))})),(0,a.iw)("loadPinnedMessages",(async(e,t,s)=>{const{chatId:n,threadId:i}=s,o=(0,b.Z1J)(e,n);if(!o||(0,I._o)(n,i,e.currentUserId))return;const r=await(0,f.t9)("fetchPinnedMessages",{chat:o,threadId:i});if(!r)return;const{messages:c,chats:d,users:l}=r,u=(0,m.ee)(c,"id"),h=Object.keys(u).map(Number).sort(((e,t)=>t-e));e=(0,a.Rd)(),e=(0,w.c_)(e,o.id,u),e=(0,w.HX)(e,o.id,i,h),e=(0,w.Sh)(e,(0,m.ee)(l,"id")),e=(0,w.fZ)(e,(0,m.ee)(d,"id")),(0,a.R3)(e)})),(0,a.iw)("loadSeenBy",(async(e,t,s)=>{const{chatId:n,messageId:i}=s,o=(0,b.Z1J)(e,n);if(!o)return;const r=await(0,f.t9)("fetchSeenBy",{chat:o,messageId:i});r&&(e=(0,a.Rd)(),e=(0,w.cY)(e,n,i,{seenByDates:r}),(0,a.R3)(e))})),(0,a.iw)("saveDefaultSendAs",((e,t,s)=>{const{chatId:a,sendAsId:n}=s,i=(0,b.Z1J)(e,a),o=(0,b.Z1J)(e,n)||(0,b.dyD)(e,n);if(i&&o)return(0,f.t9)("saveDefaultSendAs",{sendAs:o,chat:i}),(0,w.US)(e,a,{sendAsId:n})})),(0,a.iw)("loadSendAs",(async(e,t,s)=>{const{chatId:n}=s,i=(0,b.Z1J)(e,n);if(!i)return;const o=await(0,f.t9)("fetchSendAs",{chat:i});if(!o)return e=(0,a.Rd)(),e=(0,w.a4)(e,n,{sendAsPeerIds:[]}),void(0,a.R3)(e);e=(0,a.Rd)(),e=(0,w.Sh)(e,(0,m.ee)(o.users,"id")),e=(0,w.fZ)(e,(0,m.ee)(o.chats,"id")),e=(0,w.a4)(e,n,{sendAsPeerIds:o.sendAs}),(0,a.R3)(e)})),(0,a.iw)("loadSponsoredMessages",(async(e,t,s)=>{const{chatId:n}=s,i=(0,b.Z1J)(e,n);if(!i)return;const o=await(0,f.t9)("fetchSponsoredMessages",{chat:i});o&&(e=(0,a.Rd)(),e=(0,w.Fn)(e,n,o.messages[0]),e=(0,w.Sh)(e,(0,m.ee)(o.users,"id")),e=(0,w.fZ)(e,(0,m.ee)(o.chats,"id")),(0,a.R3)(e))})),(0,a.iw)("viewSponsoredMessage",((e,t,s)=>{const{chatId:a}=s,n=(0,b.Z1J)(e,a),i=(0,b.fSe)(e,a);n&&i&&(0,f.t9)("viewSponsoredMessage",{chat:n,random:i.randomId})})),(0,a.iw)("clickSponsoredMessage",((e,t,s)=>{const{chatId:a}=s,n=(0,b.Z1J)(e,a),i=(0,b.fSe)(e,a);n&&i&&(0,f.t9)("clickSponsoredMessage",{chat:n,random:i.randomId})})),(0,a.iw)("fetchUnreadMentions",(async(e,t,s)=>{const{chatId:n,offsetId:i}=s,o=(0,b.Z1J)(e,n);if(!o)return;const r=await(0,f.t9)("fetchUnreadMentions",{chat:o,offsetId:i});if(!r)return;const{messages:c,chats:d,users:l}=r,u=(0,m.ee)(c,"id"),h=Object.keys(u).map(Number);e=(0,a.Rd)(),e=(0,w.c_)(e,o.id,u),e=(0,w.Sh)(e,(0,m.ee)(l,"id")),e=(0,w.fZ)(e,(0,m.ee)(d,"id")),e=(0,w.a4)(e,n,{unreadMentions:[...o.unreadMentions||[],...h]}),(0,a.R3)(e)})),(0,a.iw)("markMentionsRead",((e,t,s)=>{const{messageIds:n,tabId:i=(0,u._w)()}=s,o=(0,b.jrE)(e,i);if(!o)return;const r=(o.unreadMentions||[]).filter((e=>!n.includes(e)));e=(0,w.a4)(e,o.id,{unreadMentions:r}),(0,a.R3)(e),t.markMessagesRead({messageIds:n,tabId:i})})),(0,a.iw)("focusNextMention",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{},n=(0,b.jrE)(e,a);n?.unreadMentions&&t.focusMessage({chatId:n.id,messageId:n.unreadMentions[0],tabId:a})})),(0,a.iw)("readAllMentions",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{},n=(0,b.jrE)(e,a);if(n)return(0,f.t9)("readAllMentions",{chat:n}),(0,w.a4)(e,n.id,{unreadMentionsCount:void 0,unreadMentions:void 0})})),(0,a.iw)("openUrl",((e,t,s)=>{const{url:a,shouldSkipModal:i,tabId:o=(0,u._w)()}=s,r=(0,l.X)(a),c=Boolean((0,b.jUK)(e,o).storyViewer.peerId);if((0,d.I)(r))return c&&t.closeStoryViewer({tabId:o}),void t.openTelegramLink({url:a,tabId:o});const{appConfig:m,config:h}=e;if(m){const e=new URL(r);if(h?.autologinToken&&m.autologinDomains.includes(e.hostname))return e.searchParams.set("autologin_token",h.autologinToken),void window.open(e.href,"_blank","noopener");if(m.urlAuthDomains.includes(e.hostname))return c&&t.closeStoryViewer({tabId:o}),void t.requestLinkUrlAuth({url:a,tabId:o})}r.match(n.jL5)||i?window.open(r,"_blank","noopener"):t.toggleSafeLinkModal({url:r,tabId:o})})),(0,a.iw)("setForwardChatOrTopic",(async(e,t,s)=>{const{chatId:n,topicId:i,tabId:o=(0,u._w)()}=s;let c=(0,b.dyD)(e,n);if(c&&(0,b.Nm0)(e,o)){let s=(0,b.ccz)(e,n);if(!s){const{accessHash:t}=c,i=await(0,f.t9)("fetchFullUser",{id:n,accessHash:t});e=(0,a.Rd)(),c=i?.user,s=i?.fullInfo}if(s.noVoiceMessages)return void t.showDialog({data:{message:(0,h.Iu)("VoiceMessagesRestrictedByPrivacy",(0,I.Js)(c))},tabId:o})}(0,b.GQU)(e,n,o)?(e=(0,v.i)(e,{forwardMessages:{...(0,b.jUK)(e,o).forwardMessages,toChatId:n,toThreadId:i,isModalShown:!1}},o),(0,a.R3)(e),t.openThread({chatId:n,threadId:i||r._f,tabId:o}),t.closeMediaViewer({tabId:o}),t.exitMessageSelectMode({tabId:o})):t.showAllowedMessageTypesNotification({chatId:n,tabId:o})})),(0,a.iw)("forwardToSavedMessages",((e,t,s)=>{const{tabId:n=(0,u._w)()}=s||{};e=(0,v.i)(e,{forwardMessages:{...(0,b.jUK)(e,n).forwardMessages,toChatId:e.currentUserId}},n),(0,a.R3)(e),t.exitMessageSelectMode({tabId:n}),t.forwardMessages({isSilent:!0,tabId:n})})),(0,a.iw)("forwardStory",((e,t,s)=>{const{toChatId:n,tabId:i=(0,u._w)()}=s||{},{fromChatId:o,storyId:r}=(0,b.jUK)(e,i).forwardMessages,c=o?(0,b.Z1J)(e,o):void 0,d=n?(0,b.Z1J)(e,n):void 0,l=o&&r?(0,b.JrV)(e,o,r):void 0;if(!c||!d||!l||"isDeleted"in l)return;const m=(0,b.xMv)(e,n),{text:h,entities:p}=l.content.text||{};W(e,{chat:d,text:h,entities:p,story:l,lastMessageId:m}),e=(0,a.Rd)(),e=(0,v.i)(e,{forwardMessages:{}},i),(0,a.R3)(e)})),(0,a.iw)("requestMessageTranslation",((e,t,s)=>{const{chatId:a,id:n,toLanguageCode:i=(0,b.Mc4)(e),tabId:o=(0,u._w)()}=s;return e=(0,w.ql)(e,a,n,i,o),(0,w.BI)(e,{translationLanguage:i})})),(0,a.iw)("showOriginalMessage",((e,t,s)=>{const{chatId:a,id:n,tabId:i=(0,u._w)()}=s;return(0,w.IR)(e,a,n,i)})),(0,a.iw)("markMessagesTranslationPending",((e,t,s)=>{const{chatId:a,messageIds:n,toLanguageCode:i=(0,b.rB0)(e)}=s;return n.forEach((t=>{e=(0,w.qt)(e,a,t,i,{isPending:!0})})),e})),(0,a.iw)("translateMessages",((e,t,s)=>{const{chatId:a,messageIds:n,toLanguageCode:i=(0,b.rB0)(e)}=s,o=(0,b.Z1J)(e,a);if(o)return t.markMessagesTranslationPending({chatId:a,messageIds:n,toLanguageCode:i}),(0,f.t9)("translateText",{chat:o,messageIds:n,toLanguageCode:i}),e}));let Y,X={};function Q(){Y&&(clearTimeout(Y),Y=void 0);const{loadMessageViews:e}=(0,a.Sv)();Object.entries(X).forEach((([t,s])=>{e({chatId:t,ids:Array.from(s),shouldIncrement:!0})})),X={}}function ee(e){const{shouldSendAsFile:t,mimeType:s}=e;return t?"file":s===n.s11?"gif":n.oGt.has(s)||n.wGh.has(s)?"media":n.e74.has(s)?"audio":e.voice?"voice":"file"}(0,a.iw)("scheduleForViewsIncrement",((e,t,s)=>{const{ids:a,chatId:n}=s;Y||setTimeout(Q,1e3),X[n]||(X[n]=new Set),a.forEach((e=>{X[n].add(e)}))})),(0,a.iw)("loadMessageViews",(async(e,t,s)=>{const{chatId:n,ids:i,shouldIncrement:o}=s,r=(0,b.Z1J)(e,n);if(!r)return;const c=await(0,f.t9)("fetchMessageViews",{chat:r,ids:i,shouldIncrement:o});c&&(e=(0,a.Rd)(),e=(0,w.Sh)(e,(0,m.ee)(c.users,"id")),e=(0,w.fZ)(e,(0,m.ee)(c.chats,"id")),c.viewsInfo.forEach((t=>{e=(0,w.cY)(e,n,t.id,{viewsCount:t.views,forwardsCount:t.forwards}),t.threadInfo&&(e=(0,w.Xg)(e,n,t.id,t.threadInfo))})),(0,a.R3)(e))})),(0,a.iw)("loadOutboxReadDate",(async(e,t,s)=>{const{chatId:n,messageId:i}=s,o=(0,b.Z1J)(e,n);if(o)try{const t=await(0,f.t9)("fetchOutboxReadDate",{chat:o,messageId:i});t?.date&&(e=(0,a.Rd)(),e=(0,w.cY)(e,n,i,{readDate:t.date}),(0,a.R3)(e))}catch(t){const{message:s}=t;if("USER_PRIVACY_RESTRICTED"===s||"YOUR_PRIVACY_RESTRICTED"===s){if(e=(0,a.Rd)(),!(0,b.dyD)(e,n))return;const t=(0,b.ssc)(e,n);if(!t)return;const o="USER_PRIVACY_RESTRICTED"===s?{isReadDateRestricted:!0}:{isReadDateRestrictedByMe:!0};e=(0,w.ps)(e,{[n]:{...t,...o}}),e=(0,w.cY)(e,n,i,{readDate:void 0}),(0,a.R3)(e)}}}));var te=s(85765),se=s(9211);const ae=(0,g.P2)((e=>e()),500,!1);async function ne(e,t){const s=await(0,f.t9)("fetchRecentStickers",{hash:t});s&&(e=(0,a.Rd)(),e={...e,stickers:{...e.stickers,recent:s}},(0,a.R3)(e))}async function ie(e,t,s,...[n=(0,u._w)()]){let i;try{i=await(0,f.t9)("fetchStickers",{stickerSetInfo:s})}catch(i){if("STICKERSET_INVALID"===i.message)return t.showNotification({message:(0,h.Iu)("StickerPack.ErrorNotFound"),tabId:n}),void("shortName"in s&&(0,b.jUK)(e,n).openedStickerSetShortName===s.shortName&&(e=(0,v.i)(e,{openedStickerSetShortName:void 0},n),(0,a.R3)(e)))}if(e=(0,a.Rd)(),!i)return;const{set:o,stickers:r,packs:c}=i,d=(e=(0,w.Rg)(e,o.id,{...o,stickers:r,packs:c})).stickers.forEmoji.emoji;d&&c[d]&&(e=(0,w.vy)(e)),(0,a.R3)(e)}async function oe(e,t,s,n,...[i=(0,u._w)()]){const o=await(0,f.t9)("searchGifs",{query:t,offset:n,username:s});o&&(e=(0,a.Rd)(),e=(0,w.rq)(e,!n,o.gifs,o.nextOffset,i),(0,a.R3)(e))}(0,a.iw)("loadStickerSets",(async(e,t)=>{const[s,n]=await Promise.all([(0,f.t9)("fetchStickerSets",{hash:e.stickers.added.hash}),(0,f.t9)("fetchCustomEmojiSets",{hash:e.customEmojis.added.hash})]);n&&s&&(e=(0,a.Rd)(),e=(0,w.z3)(e,"added",s.hash,s.sets),e=(0,w.cU)(e,n.hash,n.sets),(0,a.R3)(e),t.loadCustomEmojis({ids:e.recentCustomEmojis}))})),(0,a.iw)("loadAddedStickers",(async(e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{},{added:{setIds:n=[]},setsById:i}=e.stickers,{added:{setIds:o=[]}}=e.customEmojis,r=[...n,...o];if(r.length)for(let e=0;e<r.length;e++){const s=r[e];i[s]?.stickers||(t.loadStickers({stickerSetInfo:{id:s,accessHash:i[s].accessHash},tabId:a}),e%10==0&&e>0&&await(0,g.wO)(200))}})),(0,a.iw)("loadRecentStickers",(e=>{const{hash:t}=e.stickers.recent||{};ne(e,t)})),(0,a.iw)("loadFavoriteStickers",(async e=>{const{hash:t}=e.stickers.favorite||{},s=await(0,f.t9)("fetchFavoriteStickers",{hash:t});s&&(e=(0,a.Rd)(),e={...e,stickers:{...e.stickers,favorite:s}},(0,a.R3)(e))})),(0,a.iw)("loadPremiumStickers",(async e=>{const{hash:t}=e.stickers.premium||{},s=await(0,f.t9)("fetchStickersForEmoji",{emoji:"⭐️⭐️",hash:t});s&&(e=(0,a.Rd)(),e={...e,stickers:{...e.stickers,premium:{hash:s.hash,stickers:s.stickers}}},(0,a.R3)(e))})),(0,a.iw)("loadGreetingStickers",(async e=>{const{hash:t}=e.stickers.greeting||{},s=await(0,f.t9)("fetchStickersForEmoji",{emoji:"👋⭐️",hash:t});s&&(e=(0,a.Rd)(),e={...e,stickers:{...e.stickers,greeting:{hash:s.hash,stickers:s.stickers.filter((e=>"👋"===e.emoji))}}},(0,a.R3)(e))})),(0,a.iw)("loadFeaturedStickers",(async e=>{const{hash:t}=e.stickers.featured||{},s=await(0,f.t9)("fetchFeaturedStickers",{hash:t});s&&(e=(0,a.Rd)(),e=(0,w.z3)(e,"featured",s.hash,s.sets),(0,a.R3)(e))})),(0,a.iw)("loadPremiumGifts",(async e=>{const t=await(0,f.t9)("fetchPremiumGifts");if(!t)return;const{set:s,stickers:n}=t;e=(0,a.Rd)(),e={...e,premiumGifts:{...s,stickers:n}},(0,a.R3)(e)})),(0,a.iw)("loadDefaultTopicIcons",(async e=>{const t=await(0,f.t9)("fetchDefaultTopicIcons");if(!t)return;e=(0,a.Rd)();const{set:s,stickers:n}=t,i={...s,stickers:n};e=(0,w.Rg)(e,i.id,i),e={...e,defaultTopicIconsId:i.id},(0,a.R3)(e)})),(0,a.iw)("loadDefaultStatusIcons",(async e=>{const t=await(0,f.t9)("fetchDefaultStatusEmojis");if(!t)return;e=(0,a.Rd)();const{set:s,stickers:n}=t,i={...s,stickers:n};e=(0,w.Rg)(e,i.id,i),e={...e,defaultStatusIconsId:i.id},(0,a.R3)(e)})),(0,a.iw)("loadStickers",((e,t,s)=>{const{stickerSetInfo:a,tabId:n=(0,u._w)()}=s,i=(0,b.Ny0)(e,a);i&&i.count===i?.stickers?.length||ie(e,t,a,n)})),(0,a.iw)("loadAnimatedEmojis",(async e=>{const[t,s]=await Promise.all([(0,f.t9)("fetchAnimatedEmojis"),(0,f.t9)("fetchAnimatedEmojiEffects")]);t&&s&&(e=(0,a.Rd)(),e=(0,w.g_)(e,{...t.set,stickers:t.stickers}),e={...e,animatedEmojiEffects:{...s.set,stickers:s.stickers}},(0,a.R3)(e))})),(0,a.iw)("loadGenericEmojiEffects",(async e=>{const t=await(0,f.t9)("fetchGenericEmojiEffects");if(!t)return;e=(0,a.Rd)();const{set:s,stickers:n}=t;e={...e,genericEmojiEffects:{...s,stickers:n}},(0,a.R3)(e)})),(0,a.iw)("loadSavedGifs",(async e=>{const{hash:t}=e.gifs.saved,s=await(0,f.t9)("fetchSavedGifs",{hash:t});s&&(e=(0,a.Rd)(),e={...e,gifs:{...e.gifs,saved:s}},(0,a.R3)(e))})),(0,a.iw)("saveGif",(async(e,t,s)=>{const{gif:n,shouldUnsave:i,tabId:o=(0,u._w)()}=s,r=e.gifs.saved.gifs?.length,c=(0,se.M)(e,"savedGifs"),d=(0,se.P)(e,"savedGifs"),l=(0,b.wVz)(e);if(!i&&r&&r>=c&&t.showNotification({title:h.Iu("LimitReachedFavoriteGifs",c.toString()),message:l?h.Iu("LimitReachedFavoriteGifsSubtitlePremium"):h.Iu("LimitReachedFavoriteGifsSubtitle",d.toString()),...!l&&{action:{action:"openPremiumModal",payload:{tabId:o}}},className:"bold-link",tabId:o}),!await(0,f.t9)("saveGif",{gif:n,shouldUnsave:i}))return;e=(0,a.Rd)();const m=e.gifs.saved.gifs?.filter((({id:e})=>e!==n.id))||[],p=i?m:[n,...m];e={...e,gifs:{...e.gifs,saved:{...e.gifs.saved,gifs:p}}},(0,a.R3)(e)})),(0,a.iw)("faveSticker",((e,t,s)=>{const{sticker:a,tabId:n=(0,u._w)()}=s,i=e.stickers.favorite.stickers.length,o=(0,se.M)(e,"stickersFaved"),r=(0,se.P)(e,"stickersFaved"),c=(0,b.wVz)(e);i>=o&&t.showNotification({title:h.Iu("LimitReachedFavoriteStickers",o.toString()),message:c?h.Iu("LimitReachedFavoriteStickersSubtitlePremium"):h.Iu("LimitReachedFavoriteStickersSubtitle",r.toString()),...!c&&{action:{action:"openPremiumModal",payload:{tabId:n}}},className:"bold-link",tabId:n}),a&&(0,f.t9)("faveSticker",{sticker:a})})),(0,a.iw)("unfaveSticker",((e,t,s)=>{const{sticker:n}=s;n&&(e=(0,a.Rd)(),e={...e,stickers:{...e.stickers,favorite:{...e.stickers.favorite,stickers:e.stickers.favorite.stickers.filter((({id:e})=>e!==n.id))}}},(0,a.R3)(e),(0,f.t9)("faveSticker",{sticker:n,unfave:!0}))})),(0,a.iw)("removeRecentSticker",(async(e,t,s)=>{const{sticker:n}=s;await(0,f.t9)("removeRecentSticker",{sticker:n})&&ne((0,a.Rd)())})),(0,a.iw)("clearRecentStickers",(async e=>{await(0,f.t9)("clearRecentStickers")&&(e=(0,a.Rd)(),e={...e,stickers:{...e.stickers,recent:{stickers:[]}}},(0,a.R3)(e))})),(0,a.iw)("toggleStickerSet",((e,t,s)=>{const{stickerSetId:a}=s,n=(0,b.Ny0)(e,a);if(!n)return;const{accessHash:i,installedDate:o,isArchived:r}=n,c=!r&&Boolean(o);(0,f.t9)(c?"uninstallStickerSet":"installStickerSet",{stickerSetId:a,accessHash:i})})),(0,a.iw)("loadEmojiKeywords",(async(e,t,s)=>{const{language:n}=s;let i=e.emojiKeywords[n];if(i?.isLoading)return;e={...e,emojiKeywords:{...e.emojiKeywords,[n]:{...i,isLoading:!0}}},(0,a.R3)(e);const o=await(0,f.t9)("fetchEmojiKeywords",{language:n,fromVersion:i?i.version:0});if(i=(e=(0,a.Rd)()).emojiKeywords[n],!o)return e={...e,emojiKeywords:{...e.emojiKeywords,[n]:{...i,isLoading:!1}}},void(0,a.R3)(e);e={...e,emojiKeywords:{...e.emojiKeywords,[n]:{isLoading:!1,version:o.version,keywords:{...i?.keywords,...o.keywords}}}},(0,a.R3)(e)})),(0,a.iw)("setStickerSearchQuery",((e,t,s)=>{const{query:n,tabId:i=(0,u._w)()}=s;n&&ae((async()=>{const t=await(0,f.t9)("searchStickers",{query:n});if(!t)return;e=(0,a.Rd)();const{setsById:s,added:o}=e.stickers,r=t.sets.map((({id:e})=>e));o.setIds&&o.setIds.forEach((e=>{if(!r.includes(e)){const{title:t}=s[e]||{};t&&(0,te.Z)(t,n)&&r.unshift(e)}})),e=(0,w.z3)(e,"search",t.hash,t.sets),e=(0,w.fH)(e,t.hash,r,i),(0,a.R3)(e)}))})),(0,a.iw)("setGifSearchQuery",((e,t,s)=>{const{query:n,tabId:i=(0,u._w)()}=s;"string"==typeof n&&ae((()=>{oe(e=(0,a.Rd)(),n,e.config?.gifSearchUsername,void 0,i)}))})),(0,a.iw)("searchMoreGifs",((e,t,s)=>{const{tabId:n=(0,u._w)()}=s||{},{query:i,offset:o}=(0,b.jUK)(e,n).gifSearch;"string"==typeof i&&ae((()=>{oe(e=(0,a.Rd)(),i,e.config?.gifSearchUsername,o,n)}))})),(0,a.iw)("loadStickersForEmoji",((e,t,s)=>{const{emoji:n}=s,{hash:i}=e.stickers.forEmoji;ae((async()=>{e=(0,a.Rd)(),e={...e,stickers:{...e.stickers,forEmoji:{...e.stickers.forEmoji,emoji:n}}},(0,a.R3)(e);const t=await(0,f.t9)("fetchStickersForEmoji",{emoji:n,hash:i});e=(0,a.Rd)(),t&&e.stickers.forEmoji.emoji===n&&(e=(0,w.IM)(e,n,t.stickers,t.hash),(0,a.R3)(e))}))})),(0,a.iw)("clearStickersForEmoji",(e=>({...e,stickers:{...e.stickers,forEmoji:{}}}))),(0,a.iw)("loadCustomEmojiForEmoji",((e,t,s)=>{const{emoji:a}=s;return(0,w.AA)(e,a)})),(0,a.iw)("clearCustomEmojiForEmoji",(e=>({...e,customEmojis:{...e.customEmojis,forEmoji:{}}}))),(0,a.iw)("loadFeaturedEmojiStickers",(async e=>{const t=await(0,f.t9)("fetchFeaturedEmojiStickers");t&&(e=(0,a.Rd)(),e={...e,customEmojis:{...e.customEmojis,featuredIds:t.sets.map((({id:e})=>e)),byId:{...e.customEmojis.byId,...(0,m.ee)(t.sets.flatMap((e=>e.stickers||[])),"id")}},stickers:{...e.stickers,setsById:{...e.stickers.setsById,...(0,m.ee)(t.sets,"id")}}},(0,a.R3)(e))})),(0,a.iw)("openStickerSet",(async(e,t,s)=>{const{stickerSetInfo:n,tabId:i=(0,u._w)()}=s;(0,b.Ny0)(e,n)||await ie(e,t,n,i),e=(0,a.Rd)();const o=(0,b.Ny0)(e,n);o?.shortName&&(e=(0,v.i)(e,{openedStickerSetShortName:o.shortName},i),(0,a.R3)(e))})),(0,a.iw)("loadRecentEmojiStatuses",(async e=>{const t=await(0,f.t9)("fetchRecentEmojiStatuses");t&&(e=(0,a.Rd)(),e=(0,w.et)(e,t.hash,t.emojiStatuses),(0,a.R3)(e))}));var re=s(790),ce=s(22825);const de=(0,g.P2)((e=>e()),500,!1);async function le(e,t="",s,i,o,r,c,...[l=(0,u._w)()]){let h,p;if(o){const e=(0,f.t9)("searchMessagesLocal",{chat:o,query:t,type:s,limit:n.Hkl,offsetId:i,minDate:c,maxDate:r}),a=o.isForum?(0,f.t9)("fetchTopics",{chat:o,query:t,limit:n.XM3}):void 0,[d,l]=await Promise.all([e,a]);if(d){const{messages:e,users:t,totalCount:s,nextOffsetId:a}=d,{topics:n,count:i}=l||{};h={topics:n,totalTopicsCount:i,messages:e,users:t,chats:[],totalCount:s,nextRate:a}}}else if(h=await(0,f.t9)("searchMessagesGlobal",{query:t,offsetRate:i,limit:n.Hkl,type:s,maxDate:r,minDate:c}),(0,d.I)(t)){const s=(0,d.E)(t);"publicMessageLink"===s?.type?p=await async function(e,t){const{username:s,messageId:a}=t,n=(0,b.DIA)(e,s);if(n)return ue(e,n,a);const{chat:i}=await(0,f.t9)("getChatByUsername",s)??{};return i?ue(e,i,a):void 0}(e,s):"privateMessageLink"===s?.type&&(p=await function(e,t){const{channelId:s,messageId:a}=t,n=(0,ce.Yg)(s),i=(0,b.Z1J)(e,n);if(i)return ue(e,i,a)}(e,s))}e=(0,a.Rd)();const g=(0,b.JXM)(e,l);if(!h||""!==t&&t!==g)return e=(0,w.xv)(e,{messages:!1},l),void(0,a.R3)(e);p&&(h.totalCount=h.messages.unshift(p));const{messages:I,users:v,chats:y,totalCount:P,nextRate:Z}=h;y.length&&(e=(0,w.fZ)(e,(0,m.ee)(y,"id"))),v.length&&(e=(0,w.Sh)(e,(0,m.ee)(v,"id"))),I.length&&(e=(0,w.m6)(e,I)),e=(0,w.px)(e,I,P,s,Z,l),h.topics&&(e=(0,w.XG)(e,o.id,h.totalTopicsCount,h.topics));const S=h.topics?.map((({id:e})=>e)).sort(((e,t)=>t-e));e=(0,w.No)(e,{foundTopicIds:S},l),(0,a.R3)(e)}async function ue(e,t,s){if(!(0,ce.Bf)(t)&&!(0,ce.eA)(t))return;const a=(0,b.hjO)(e,t.id,s);if(a)return a;const n=await(0,f.t9)("fetchMessage",{chat:t,messageId:s});return"MESSAGE_DELETED"===n?void 0:n?.message}async function me(e,t,s,i,o,r=!1,c,...[d=(0,u._w)()]){const l=c?e.currentUserId:t.id,h=await(0,f.t9)("searchMessagesLocal",{chat:t,type:i,limit:2*n.ENB,threadId:s,offsetId:o,isSavedDialog:c});if(!h)return;const{chats:p,users:g,messages:I,totalCount:v,nextOffsetId:y}=h,P=(0,m.ee)(I,"id"),Z=Object.keys(P).map(Number);e=(0,a.Rd)(),(0,b.weG)(e,d)&&(e=(0,w.fZ)(e,(0,m.ee)(p,"id")),e=(0,w.Sh)(e,(0,m.ee)(g,"id")),e=(0,w.c_)(e,l,P),e=(0,w.c1)(e,l,s,i,Z,v,y,d),(0,a.R3)(e),r||me(e,t,s,i,y,!0,c,d))}(0,a.iw)("setGlobalSearchQuery",((e,t,s)=>{const{query:n,tabId:i=(0,u._w)()}=s,{chatId:o}=(0,b.jUK)(e,i).globalSearch;n&&!o&&de((async()=>{const t=await(0,f.t9)("searchChats",{query:n});e=(0,a.Rd)();const s=(0,b.JXM)(e,i);if(!t||!s||n!==s)return e=(0,w.xv)(e,{chats:!1},i),void(0,a.R3)(e);const{accountChats:o,accountUsers:r,globalChats:c,globalUsers:d}=t;(o.length||c.length)&&(e=(0,w.fZ)(e,(0,m.ee)([...o,...c],"id"))),(r.length||d.length)&&(e=(0,w.Sh)(e,(0,m.ee)([...r,...d],"id"))),e=(0,w.xv)(e,{chats:!1},i),e=(0,w.No)(e,{localResults:{chatIds:o.map((({id:e})=>e)),userIds:o.map((({id:e})=>e))},globalResults:{...(0,b.jUK)(e,i).globalSearch.globalResults,chatIds:c.map((({id:e})=>e)),userIds:d.map((({id:e})=>e))}},i),(0,a.R3)(e)}))})),(0,a.iw)("setGlobalSearchDate",((e,t,s)=>{const{date:n,tabId:i=(0,u._w)()}=s,o=n?(0,re.IS)(n):n;e=(0,w.No)(e,{date:n,query:"",resultsByType:{...(0,b.jUK)(e,i).globalSearch.resultsByType,text:{totalCount:void 0,foundIds:[],nextOffsetId:0}}},i),(0,a.R3)(e);const{chatId:r}=(0,b.jUK)(e,i).globalSearch;le(e,"","text",void 0,r?(0,b.Z1J)(e,r):void 0,o,n,i)})),(0,a.iw)("searchMessagesGlobal",((e,t,s)=>{const{type:a,tabId:n=(0,u._w)()}=s,{query:i,resultsByType:o,chatId:r,date:c}=(0,b.jUK)(e,n).globalSearch,d=c?(0,re.IS)(c):c,l=o?.[a]?.nextOffsetId;le(e,i,a,l,r?(0,b.Z1J)(e,r):void 0,d,c,n)})),(0,a.iw)("searchTextMessagesLocal",(async(e,t,s)=>{const{tabId:i=(0,u._w)()}=s||{},{chatId:o,threadId:r}=(0,b.Btg)(e,i)||{};if(!o)return;const c=e.currentUserId,d=(0,I._o)(o,r,c),l=d?String(r):o,h=l?(0,b.Z1J)(e,l):void 0;let p=(0,b.n5x)(e,i);if(!h||!r||!p)return;const{query:g,results:v,savedTag:y}=p,P=v?.nextOffsetId;if(!g&&!y)return;const Z=await(0,f.t9)("searchMessagesLocal",{chat:h,type:"text",query:g,threadId:r,limit:n.pnA,offsetId:P,isSavedDialog:d,savedTag:y});if(!Z)return;const{chats:S,users:C,messages:M,totalCount:E,nextOffsetId:R}=Z,k=(0,m.ee)(M,"id"),T=Object.keys(k).map(Number);e=(0,a.Rd)(),p=(0,b.n5x)(e,i);const N=!(0,I.Hl)(y,p?.savedTag);if(!p||g!==p.query||N)return;const A=d?c:h.id;e=(0,w.fZ)(e,(0,m.ee)(S,"id")),e=(0,w.Sh)(e,(0,m.ee)(C,"id")),e=(0,w.c_)(e,A,k),e=(0,w.dx)(e,A,r,T,E,R,i),(0,a.R3)(e)})),(0,a.iw)("searchMediaMessagesLocal",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{},{chatId:n,threadId:i}=(0,b.Btg)(e,a)||{};if(!n||!i)return;const o=(0,I._o)(n,i,e.currentUserId),r=o?String(i):n,c=(0,b.Z1J)(e,r),d=(0,b.weG)(e,a);if(!c||!d)return;const{currentType:l,resultsByType:m}=d,h=l&&m&&m[l],p=h?.nextOffsetId;l&&me(e,c,i,l,p,void 0,o,a)})),(0,a.iw)("searchMessagesByDate",(async(e,t,s)=>{const{timestamp:a,tabId:n=(0,u._w)()}=s,{chatId:i}=(0,b.Btg)(e,n)||{};if(!i)return;const o=(0,b.Z1J)(e,i);if(!o)return;const r=await(0,f.t9)("findFirstMessageIdAfterDate",{chat:o,timestamp:a});r&&t.focusMessage({chatId:o.id,messageId:r,tabId:n})})),(0,a.iw)("checkPublicLink",(async(e,t,s)=>{const{username:n,tabId:i=(0,u._w)()}=s,{chatId:o}=(0,b.Btg)(e,i)||{};if(!o)return;if((0,b.jUK)(e,i).management.progress===c.wv.InProgress)return;e=(0,w.fw)(e,o,{isUsernameAvailable:void 0,checkedUsername:void 0},i),(0,a.R3)(e);const{result:r,error:d}=await(0,f.t9)("checkChatUsername",{username:n});e=(0,a.Rd)(),e=(0,w.H9)(e,!0===r?c.wv.Complete:c.wv.Error,i),e=(0,w.fw)(e,o,{isUsernameAvailable:!0===r,checkedUsername:n,error:d},i),(0,a.R3)(e),void 0===r&&t.openLimitReachedModal({limit:"channelsPublic",tabId:i})})),(0,a.iw)("updatePublicLink",(async(e,t,s)=>{const{username:n,shouldDisableUsernames:i,tabId:r=(0,u._w)()}=s,{chatId:d}=(0,b.Btg)(e,r)||{};if(!d)return;const l=await(0,o.X9)(e,t,d,r);if(!l)return;e=(0,a.Rd)(),e=(0,w.H9)(e,c.wv.InProgress,r),(0,a.R3)(e);const m=await(0,f.t9)("setChatUsername",{chat:l,username:n});i&&await(0,f.t9)("deactivateAllUsernames",{chat:l}),e=(0,a.Rd)(),e=(0,w.H9)(e,m?c.wv.Complete:c.wv.Error,r),e=(0,w.fw)(e,l.id,{isUsernameAvailable:void 0,checkedUsername:void 0,error:void 0},r),(0,a.R3)(e)})),(0,a.iw)("updatePrivateLink",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{},{chatId:n}=(0,b.Btg)(e,a)||{},i=n&&(0,b.Z1J)(e,n);n&&i&&(0,f.t9)("updatePrivateLink",{chat:i})})),(0,a.iw)("setEditingExportedInvite",((e,t,s)=>{const{chatId:n,invite:i,tabId:o=(0,u._w)()}=s;e=(0,w.fw)(e,n,{editingInvite:i},o),(0,a.R3)(e)})),(0,a.iw)("setOpenedInviteInfo",((e,t,s)=>{const{chatId:n,invite:i,tabId:o=(0,u._w)()}=s,r=i?{inviteInfo:{invite:i}}:{inviteInfo:void 0};e=(0,w.fw)(e,n,r,o),(0,a.R3)(e)})),(0,a.iw)("loadExportedChatInvites",(async(e,t,s)=>{const{chatId:n,adminId:i,isRevoked:o,limit:r,tabId:c=(0,u._w)()}=s,d=(0,b.Z1J)(e,n),l=(0,b.dyD)(e,i||e.currentUserId);if(!d||!l)return;const h=await(0,f.t9)("fetchExportedChatInvites",{peer:d,admin:l,isRevoked:o,limit:r});if(!h)return;e=(0,a.Rd)();const{invites:p,users:g}=h;e=(0,w.Sh)(e,(0,m.ee)(g,"id"));const I=o?{revokedInvites:p}:{invites:p};e=(0,w.fw)(e,n,I,c),(0,a.R3)(e)})),(0,a.iw)("editExportedChatInvite",(async(e,t,s)=>{const{chatId:n,link:i,isRevoked:o,expireDate:r,usageLimit:c,isRequestNeeded:d,title:l,tabId:h=(0,u._w)()}=s,p=(0,b.Z1J)(e,n);if(!p)return;const g=await(0,f.t9)("editExportedChatInvite",{peer:p,link:i,isRevoked:o,expireDate:r,usageLimit:c,isRequestNeeded:d,title:l});if(!g)return;const{oldInvite:I,newInvite:v,users:y}=g;e=(0,a.Rd)();const{management:P}=(0,b.jUK)(e,h),Z=(P.byChatId[n].invites||[]).filter((e=>e.link!==I.link)),S=[...P.byChatId[n].revokedInvites||[]];v.isRevoked?S.unshift(v):Z.push(v),e=(0,w.Sh)(e,(0,m.ee)(y,"id")),e=(0,w.fw)(e,n,{invites:Z,revokedInvites:S},h),(0,a.R3)(e)})),(0,a.iw)("exportChatInvite",(async(e,t,s)=>{const{chatId:n,expireDate:i,usageLimit:o,isRequestNeeded:r,title:c,tabId:d=(0,u._w)()}=s,l=(0,b.Z1J)(e,n);if(!l)return;const m=await(0,f.t9)("exportChatInvite",{peer:l,expireDate:i,usageLimit:o,isRequestNeeded:r,title:c});if(!m)return;e=(0,a.Rd)();const h=(0,b.jUK)(e,d).management.byChatId[n].invites||[];e=(0,w.fw)(e,n,{invites:[...h,m]},d),(0,a.R3)(e)})),(0,a.iw)("deleteExportedChatInvite",(async(e,t,s)=>{const{chatId:n,link:i,tabId:o=(0,u._w)()}=s,r=(0,b.Z1J)(e,n);if(!r)return;if(!await(0,f.t9)("deleteExportedChatInvite",{peer:r,link:i}))return;e=(0,a.Rd)();const c=(0,b.jUK)(e,o).management.byChatId[n];e=(0,w.fw)(e,n,{invites:c?.invites?.filter((e=>e.link!==i)),revokedInvites:c?.revokedInvites?.filter((e=>e.link!==i))},o),(0,a.R3)(e)})),(0,a.iw)("deleteRevokedExportedChatInvites",(async(e,t,s)=>{const{chatId:n,adminId:i,tabId:o=(0,u._w)()}=s,r=(0,b.Z1J)(e,n),c=(0,b.dyD)(e,i||e.currentUserId);r&&c&&await(0,f.t9)("deleteRevokedExportedChatInvites",{peer:r,admin:c})&&(e=(0,a.Rd)(),e=(0,w.fw)(e,n,{revokedInvites:[]},o),(0,a.R3)(e))})),(0,a.iw)("loadChatInviteImporters",(async(e,t,s)=>{const{chatId:n,link:i,offsetDate:o,offsetUserId:r,limit:c,tabId:d=(0,u._w)()}=s,l=(0,b.Z1J)(e,n),m=r?(0,b.dyD)(e,r):void 0;if(!l||r&&!m)return;const h=await(0,f.t9)("fetchChatInviteImporters",{peer:l,link:i,offsetDate:o,offsetUser:m,limit:c});if(!h)return;const{importers:p,users:g}=h;e=(0,a.Rd)();const I=(0,b.jUK)(e,d).management.byChatId[n]?.inviteInfo;I?.invite&&I.invite.link===i&&(e=(0,w.fw)(e,n,{inviteInfo:{...I,importers:p}},d),e=(0,w.Sh)(e,g),(0,a.R3)(e))})),(0,a.iw)("loadChatInviteRequesters",(async(e,t,s)=>{const{chatId:n,link:i,offsetDate:o,offsetUserId:r,limit:c,tabId:d=(0,u._w)()}=s,l=(0,b.Z1J)(e,n),m=r?(0,b.dyD)(e,r):void 0;if(!l||r&&!m)return;const h=await(0,f.t9)("fetchChatInviteImporters",{peer:l,link:i,offsetDate:o,offsetUser:m,limit:c,isRequested:!0});if(!h)return;const{importers:p,users:g}=h;e=(0,a.Rd)();const I=(0,b.jUK)(e,d).management.byChatId[n]?.inviteInfo;I?.invite&&I.invite.link===i&&(e=(0,w.fw)(e,n,{inviteInfo:{...I,requesters:p}},d),e=(0,w.Sh)(e,g),(0,a.R3)(e))})),(0,a.iw)("loadChatJoinRequests",(async(e,t,s)=>{const{chatId:n,offsetDate:i=0,offsetUserId:o,limit:r=0}=s,c=(0,b.Z1J)(e,n),d=o?(0,b.dyD)(e,o):void 0;if(!c||o&&!d)return;const l=await(0,f.t9)("fetchChatInviteImporters",{peer:c,offsetDate:i,offsetUser:d,limit:r,isRequested:!0});if(!l)return;const{importers:u,users:m}=l;e=(0,a.Rd)(),e=(0,w.a4)(e,n,{joinRequests:u}),e=(0,w.Sh)(e,m),(0,a.R3)(e)})),(0,a.iw)("hideChatJoinRequest",(async(e,t,s)=>{const{chatId:n,userId:i,isApproved:o}=s,r=(0,b.Z1J)(e,n),c=(0,b.dyD)(e,i);if(!r||!c)return;if(!await(0,f.t9)("hideChatJoinRequest",{peer:r,user:c,isApproved:o}))return;e=(0,a.Rd)();const d=(0,b.Z1J)(e,n);d&&(e=(0,w.a4)(e,n,{joinRequests:d.joinRequests?.filter((e=>e.userId!==i))}),(0,a.R3)(e))})),(0,a.iw)("hideAllChatJoinRequests",(async(e,t,s)=>{const{chatId:n,isApproved:i,link:o}=s,r=(0,b.Z1J)(e,n);r&&await(0,f.t9)("hideAllChatJoinRequests",{peer:r,isApproved:i,link:o})&&(e=(0,a.Rd)(),(0,b.Z1J)(e,n)&&(e=(0,w.a4)(e,n,{joinRequests:[]}),e=(0,w.US)(e,n,{recentRequesterIds:[],requestsPending:0}),(0,a.R3)(e)))})),(0,a.iw)("hideChatReportPanel",(async(e,t,s)=>{const{chatId:n}=s,i=(0,b.Z1J)(e,n);i&&await(0,f.t9)("hideChatReportPanel",i)&&(e=(0,a.Rd)(),e=(0,w.a4)(e,n,{settings:void 0}),(0,a.R3)(e))})),(0,a.iw)("uploadContactProfilePhoto",(async(e,t,s)=>{const{userId:n,file:i,isSuggest:o,tabId:r=(0,u._w)()}=s,d=(0,b.dyD)(e,n);if(!d)return;e=(0,w.H9)(e,c.wv.InProgress,r),(0,a.R3)(e);const l=await(0,f.t9)("uploadContactProfilePhoto",{user:d,file:i,isSuggest:o});if(!l)return e=(0,a.Rd)(),e=(0,w.H9)(e,c.wv.Error,r),void(0,a.R3)(e);e=(0,a.Rd)(),e=(0,w.Sh)(e,(0,m.ee)(l.users,"id")),(0,a.R3)(e);const{id:p,accessHash:g}=d;if(!await(0,f.t9)("fetchFullUser",{id:p,accessHash:g}))return e=(0,a.Rd)(),e=(0,w.H9)(e,c.wv.Error,r),void(0,a.R3)(e);t.loadProfilePhotos({profileId:n}),e=(0,a.Rd)(),e=(0,w.H9)(e,c.wv.Complete,r),(0,a.R3)(e),i&&!o&&t.showNotification({message:h.Iu("UserInfo.SetCustomPhoto.SuccessPhotoText",(0,I.Vl)(d)),tabId:r})})),(0,a.iw)("resetManagementError",((e,t,s)=>{const{chatId:a,tabId:n=(0,u._w)()}=s||{};return(0,w.fw)(e,a,{error:void 0},n)}));var he=s(65116),pe=s(16974);let ge,fe;function Ie(e,t,s){const a=e.currentUserId,i=(0,I._o)(t,s,a),o=i?String(s):t,r=(0,b.Z1J)(e,o);return(0,f.t9)("fetchMessages",{chat:r,threadId:s,offsetId:i?void 0:r.lastReadInboxMessageId,addOffset:-(Math.round(n.hT6/2)+1),limit:n.hT6,isSavedDialog:i})}(0,a.iw)("sync",((e,t)=>{n.eMD&&console.log(">>> START SYNC"),ge&&clearTimeout(ge),e=(0,a.Rd)(),e={...e,isSyncing:!0},(0,a.R3)(e),ge=window.setTimeout((()=>{e=(0,a.Rd)(),e={...e,isSyncing:!1},(0,a.R3)(e),ge=void 0}),15e3);const{loadAllChats:s,preloadTopChatMessages:i,loadAllStories:o,loadAllHiddenStories:c}=t;s({listType:"active",shouldReplace:!0,onReplace:async()=>{await async function(e,t){let s=!1;e=(0,a.Rd)();let i=!1;const o=Object.keys(e.messages.byChatId).reduce(((t,s)=>(t[s]=Object.keys(e.messages.byChatId[s].threadsById).reduce(((t,a)=>(t[Number(a)]=(0,m.Yc)({draft:(0,b.Mst)(e,s,Number(a)),editingId:(0,b._$9)(e,s,Number(a)),editingDraft:(0,b.saH)(e,s,Number(a))}),t)),{}),t)),{}),c=Object.entries(e.chats.lastMessageIds.all||{}).map((([t,s])=>(0,b.hjO)(e,t,Number(s)))).filter(Boolean),d=Object.values(e.chats.lastMessageIds.saved||{}).map((t=>(0,b.hjO)(e,e.currentUserId,Number(t)))).filter(Boolean);for(const{id:o}of Object.values(e.byTabId)){e=(0,a.Rd)();const{chatId:c,threadId:d}=(0,b.Btg)(e,o)||{},l=d||r._f,u=c&&d?(0,b.tZg)(e,c,d):void 0,h=c?e.chats.byId[c]:void 0;if(c&&h){const[t,d]=await Promise.all([Ie(e,c,l),l===r._f||(0,I._o)(h.id,l,e.currentUserId)?void 0:(0,f.t9)("fetchDiscussionMessage",{chat:h,messageId:Number(l)})]);e=(0,a.Rd)();const{chatId:p}=(0,b.Btg)(e,o)||{};if(t&&p===c){const a=(0,b.Zwk)(e,c),o=c===n.awM?e.serviceNotifications.filter((({isDeleted:e})=>!e)).map((({message:e})=>e)):[],p=h.isForum&&h.topics?Object.values(h.topics).map((({lastMessageId:e})=>a[e])).filter(Boolean):[],g=t.messages.map((({id:e})=>e)),f=(0,m.ei)(e.messages.byChatId[c].threadsById,g),I=((!t.messages.length||t.messages.some((({id:e})=>e===d?.firstMessageId)))&&d?.topMessages||[]).concat(t.messages,o),y=I.concat(p),P=(0,m.ee)(y,"id"),Z=(0,m.Tw)(I.map((({id:e})=>e)));i||(e={...e,messages:{...e.messages,byChatId:{}}},Object.values(e.byTabId).forEach((({id:t})=>{e=(0,v.i)(e,{tabThreads:{}},t)})),i=!0),e=(0,w.c_)(e,c,P),e=(0,w.xj)(e,c,l,Z),Object.entries(f).forEach((([t,s])=>{s?.threadInfo&&(e=(0,w.Xg)(e,c,t,s.threadInfo))})),u&&!u.isCommentsInfo&&l!==r._f&&(e=(0,w.Xg)(e,c,l,{...(0,m.ei)(u,["fromChannelId","fromMessageId"])})),Object.values(e.byTabId).forEach((({id:t})=>{const{chatId:s,threadId:a}=(0,b.Btg)(e,t)||{};s===c&&a===l&&(e=(0,w.y9)(e,c,l,Z,t))})),e=(0,w.GL)(e,(0,m.ee)(t.chats,"id")),e=(0,w.eD)(e,(0,m.ee)(t.users,"id")),s=!0}}(0,a.R3)(e),h?.isForum&&(t.loadTopics({chatId:c,force:!0}),d&&d!==r._f&&t.loadTopicById({chatId:c,topicId:Number(d),shouldCloseChatOnError:!0}))}e=(0,a.Rd)(),s||(e={...e,messages:{...e.messages,byChatId:{}}},Object.values(e.byTabId).forEach((({id:t})=>{e=(0,v.i)(e,{tabThreads:{}},t)}))),Object.keys(o).forEach((t=>{const s=o[t];Object.keys(s).forEach((s=>{e=(0,w.sN)(e,t,Number(s),o[t][Number(s)])}))})),e=(0,w.m6)(e,c),e=(0,w.m6)(e,d),(0,a.R3)(e),Object.values(e.byTabId).forEach((({id:s})=>{const{chatId:a,messageId:n}=(0,b.jUK)(e,s).audioPlayer;a&&n&&!(0,b.hjO)(e,a,n)&&t.closeAudioPlayer({tabId:s})}))}(e,t),e=(0,a.Rd)(),e={...e,isSyncing:!1,isSynced:!0,isFetchingDifference:!1},(0,a.R3)(e),n.eMD&&console.log(">>> FINISH SYNC"),(0,pe.S1)(),s({listType:"archived",shouldReplace:!0}),s({listType:"saved",shouldReplace:!0}),i(),o(),c()}})})),(0,he.ll)((e=>{const{connectionState:t,authState:s,isSynced:n}=e,{isMasterTab:i}=(0,b.jUK)(e);!i||n||fe?.connectionState===t&&fe?.authState===s||"connectionStateReady"===t&&"authorizationStateReady"===s&&(0,a.Sv)().sync(),fe=e})),(0,a.iw)("reportPeer",(async(e,t,s)=>{const{chatId:a,reason:n,description:i,tabId:o=(0,u._w)()}=s;if(!a)return;const r=(0,b.Z1J)(e,a);if(!r)return;const c=await(0,f.t9)("reportPeer",{peer:r,reason:n,description:i});t.showNotification({message:c?(0,h.Iu)("ReportPeer.AlertSuccess"):"An error occurred while submitting your report. Please, try again later.",tabId:o})})),(0,a.iw)("reportProfilePhoto",(async(e,t,s)=>{const{chatId:a,reason:n,description:i,photo:o,tabId:r=(0,u._w)()}=s;if(!a)return;const c=(0,b.Z1J)(e,a);if(!c||!o)return;const d=await(0,f.t9)("reportProfilePhoto",{peer:c,photo:o,reason:n,description:i});t.showNotification({message:d?(0,h.Iu)("ReportPeer.AlertSuccess"):"An error occurred while submitting your report. Please, try again later.",tabId:r})})),(0,a.iw)("loadAuthorizations",(async e=>{const t=await(0,f.t9)("fetchAuthorizations");t&&(e=(0,a.Rd)(),e={...e,activeSessions:{byHash:t.authorizations,orderedHashes:Object.keys(t.authorizations),ttlDays:t.ttlDays}},(0,a.R3)(e))})),(0,a.iw)("terminateAuthorization",(async(e,t,s)=>{const{hash:n}=s;if(!await(0,f.t9)("terminateAuthorization",n))return;e=(0,a.Rd)();const{[n]:i,...o}=e.activeSessions.byHash;e={...e,activeSessions:{byHash:o,orderedHashes:e.activeSessions.orderedHashes.filter((e=>e!==n))}},(0,a.R3)(e)})),(0,a.iw)("terminateAllAuthorizations",(async e=>{if(!await(0,f.t9)("terminateAllAuthorizations"))return;const t=(e=(0,a.Rd)()).activeSessions.orderedHashes.find((t=>e.activeSessions.byHash[t].isCurrent));if(!t)return;const s=e.activeSessions.byHash[t];e={...e,activeSessions:{byHash:{[t]:s},orderedHashes:[t]}},(0,a.R3)(e)})),(0,a.iw)("changeSessionSettings",(async(e,t,s)=>{const{hash:n,areCallsEnabled:i,areSecretChatsEnabled:o,isConfirmed:r}=s;await(0,f.t9)("changeSessionSettings",{hash:n,areCallsEnabled:i,areSecretChatsEnabled:o,isConfirmed:r})&&(e=(0,a.Rd)(),e={...e,activeSessions:{...e.activeSessions,byHash:{...e.activeSessions.byHash,[n]:{...e.activeSessions.byHash[n],...void 0!==i?{areCallsEnabled:i}:void 0,...void 0!==o?{areSecretChatsEnabled:o}:void 0,...r&&{isUnconfirmed:void 0}}}}},(0,a.R3)(e))})),(0,a.iw)("changeSessionTtl",(async(e,t,s)=>{const{days:n}=s;await(0,f.t9)("changeSessionTtl",{days:n})&&(e=(0,a.Rd)(),e={...e,activeSessions:{...e.activeSessions,ttlDays:n}},(0,a.R3)(e))})),(0,a.iw)("loadWebAuthorizations",(async e=>{const t=await(0,f.t9)("fetchWebAuthorizations");if(!t)return;const{users:s,webAuthorizations:n}=t;e=(0,a.Rd)(),e=(0,w.Sh)(e,(0,m.ee)(s,"id")),e={...e,activeWebSessions:{byHash:n,orderedHashes:Object.keys(n)}},(0,a.R3)(e)})),(0,a.iw)("terminateWebAuthorization",(async(e,t,s)=>{const{hash:n}=s;if(!await(0,f.t9)("terminateWebAuthorization",n))return;e=(0,a.Rd)();const{[n]:i,...o}=e.activeWebSessions.byHash;e={...e,activeWebSessions:{byHash:o,orderedHashes:e.activeWebSessions.orderedHashes.filter((e=>e!==n))}},(0,a.R3)(e)})),(0,a.iw)("terminateAllWebAuthorizations",(async e=>{await(0,f.t9)("terminateAllWebAuthorizations")&&(e=(0,a.Rd)(),e={...e,activeWebSessions:{byHash:{},orderedHashes:[]}},(0,a.R3)(e))}));var we=s(82267);const ve=(0,g.P2)((e=>e()),500,!1);(0,a.iw)("loadFullUser",(async(e,t,s)=>{const{userId:n,withPhotos:i}=s,o=(0,b.dyD)(e,n);if(!o)return;const{id:r,accessHash:c}=o,d=await(0,f.t9)("fetchFullUser",{id:r,accessHash:c});if(!d?.user)return;e=(0,a.Rd)();const l=(0,b.ccz)(e,n),{user:u,fullInfo:m}=d,h=o.avatarHash!==u.avatarHash||l?.profilePhoto?.id!==m?.profilePhoto?.id||l?.fallbackPhoto?.id!==m?.fallbackPhoto?.id||l?.personalPhoto?.id!==m?.personalPhoto?.id;e=(0,w.Nq)(e,n,d.user),e=(0,w.ap)(e,n,d.fullInfo),(0,a.R3)(e),(i||o.photos?.length&&h)&&t.loadProfilePhotos({profileId:n})})),(0,a.iw)("loadUser",(async(e,t,s)=>{const{userId:n}=s,i=(0,b.dyD)(e,n);if(!i)return;const o=await(0,f.t9)("fetchUsers",{users:[i]});if(!o)return;const{users:r,userStatusesById:c}=o;e=(0,a.Rd)(),e=(0,w.eD)(e,(0,m.ee)(r,"id")),e=(0,w.ps)(e,{...e.users.statusesById,...c}),(0,a.R3)(e)})),(0,a.iw)("loadTopUsers",(async e=>{const{topPeers:{lastRequestedAt:t}}=e;if(t&&!((0,we.bp)()-t>60))return;const s=await(0,f.t9)("fetchTopUsers");if(!s)return;const{ids:n,users:i}=s;e=(0,a.Rd)(),e=(0,w.Sh)(e,(0,m.ee)(i,"id")),e={...e,topPeers:{...e.topPeers,userIds:n,lastRequestedAt:(0,we.bp)()}},(0,a.R3)(e)})),(0,a.iw)("loadContactList",(async e=>{const t=await(0,f.t9)("fetchContactList");if(!t)return;e=(0,a.Rd)(),e=(0,w.Sh)(e,(0,m.ee)(t.users,"id")),e=(0,w.fZ)(e,(0,m.ee)(t.chats,"id")),e=(0,w.zn)(e,t.userStatusesById);const s=e=>e.lastName||e.firstName||"",n=new Intl.Collator("en-US"),i=t.users.sort(((e,t)=>n.compare(s(e),s(t)))).filter((e=>!e.isSelf));e={...e,contactList:{userIds:i.map((e=>e.id))}},(0,a.R3)(e)})),(0,a.iw)("loadCurrentUser",(()=>{(0,f.t9)("fetchCurrentUser")})),(0,a.iw)("loadCommonChats",(async(e,t,s)=>{const{tabId:n=(0,u._w)()}=s||{},{chatId:i}=(0,b.Btg)(e,n)||{},o=i?(0,b.dyD)(e,i):void 0;if(!o||(0,I.cS)(o)||o.commonChats?.isFullyLoaded)return;const r=o.commonChats?.maxId,c=await(0,f.t9)("fetchCommonChats",o.id,o.accessHash,r);if(!c)return;const{chats:d,chatIds:l,isFullyLoaded:h}=c;e=(0,a.Rd)(),d.length&&(e=(0,w.fZ)(e,(0,m.ee)(d,"id"))),e=(0,w.Nq)(e,o.id,{commonChats:{maxId:l.length?l[l.length-1]:"0",ids:(0,m.Tw)((o.commonChats?.ids||[]).concat(l)),isFullyLoaded:h}}),(0,a.R3)(e)})),(0,a.iw)("updateContact",(async(e,t,s)=>{const{userId:n,isMuted:i=!1,firstName:o,lastName:r,shouldSharePhoneNumber:d,tabId:l=(0,u._w)()}=s,m=(0,b.dyD)(e,n);if(!m)return;let h;if(t.updateChatMutedState({chatId:n,isMuted:i}),e=(0,a.Rd)(),e=(0,w.H9)(e,c.wv.InProgress,l),(0,a.R3)(e),!m.isContact&&m.phoneNumber)h=await(0,f.t9)("importContact",{phone:m.phoneNumber,firstName:o,lastName:r});else{const{id:e,accessHash:t}=m;h=await(0,f.t9)("updateContact",{id:e,accessHash:t,phoneNumber:"",firstName:o,lastName:r,shouldSharePhoneNumber:d})}h&&(t.loadChatSettings({chatId:n}),t.loadPeerStories({peerId:n}),e=(0,a.Rd)(),e=(0,w.Nq)(e,m.id,{firstName:o,lastName:r}),(0,a.R3)(e)),e=(0,a.Rd)(),e=(0,w.H9)(e,c.wv.Complete,l),e=(0,w.ft)(e,l),(0,a.R3)(e)})),(0,a.iw)("deleteContact",(async(e,t,s)=>{const{userId:a}=s,n=(0,b.dyD)(e,a);if(!n)return;const{id:i,accessHash:o}=n;await(0,f.t9)("deleteContact",{id:i,accessHash:o})})),(0,a.iw)("loadProfilePhotos",(async(e,t,s)=>{const{profileId:n}=s,i=(0,I.YC)(n);let o=i?(0,b.dyD)(e,n):void 0;const r=i?void 0:(0,b.Z1J)(e,n);if(!o&&!r)return;let c=(0,b.ccz)(e,n);if(o&&!c?.profilePhoto){const{id:e,accessHash:t}=o,s=await(0,f.t9)("fetchFullUser",{id:e,accessHash:t});if(!s?.user)return;o=s.user,c=s.fullInfo}const d=await(0,f.t9)("fetchProfilePhotos",o,r);if(!d||!d.photos)return;e=(0,a.Rd)();const l=o||r,{photos:u,users:h}=d,p=c?.fallbackPhoto,g=c?.personalPhoto;p&&u.push(p),g&&u.unshift(g),u.sort((e=>e.id===l?.avatarHash?-1:1)),e=(0,w.Sh)(e,(0,m.ee)(h,"id")),e=i?(0,w.Nq)(e,n,{photos:u}):(0,w.a4)(e,n,{photos:u}),(0,a.R3)(e)})),(0,a.iw)("setUserSearchQuery",((e,t,s)=>{const{query:n,tabId:i=(0,u._w)()}=s;n&&ve((async()=>{const t=await(0,f.t9)("searchChats",{query:n});e=(0,a.Rd)();const s=(0,b.jUK)(e,i).userSearch.query;if(!t||!s||n!==s)return e=(0,w.Q3)(e,!1,i),void(0,a.R3)(e);const{accountUsers:o,globalUsers:r}=t;let c,d;o.length&&(e=(0,w.Sh)(e,(0,m.ee)(o,"id")),c=o.map((({id:e})=>e))),r.length&&(e=(0,w.Sh)(e,(0,m.ee)(r,"id")),d=r.map((({id:e})=>e))),e=(0,w.Q3)(e,!1,i),e=(0,w.Lm)(e,{localUserIds:c,globalUserIds:d},i),(0,a.R3)(e)}))})),(0,a.iw)("importContact",(async(e,t,s)=>{const{phoneNumber:n,firstName:i,lastName:o,tabId:r=(0,u._w)()}=s,c=await(0,f.t9)("importContact",{phone:n,firstName:i,lastName:o});c?(t.openChat({id:c,tabId:r}),e=(0,a.Rd)(),e=(0,w.ft)(e,r),(0,a.R3)(e)):t.showNotification({message:h.Iu("Contacts.PhoneNumber.NotRegistred"),tabId:r})})),(0,a.iw)("reportSpam",((e,t,s)=>{const{chatId:a}=s,n=(0,b.RGZ)(e,a);n&&(0,f.t9)("reportSpam",n)})),(0,a.iw)("setEmojiStatus",((e,t,s)=>{const{emojiStatus:a,expires:n}=s;(0,f.t9)("updateEmojiStatus",a,n)})),(0,a.iw)("saveCloseFriends",(async(e,t,s)=>{const{userIds:n}=s;await(0,f.t9)("saveCloseFriends",n)&&(e=(0,a.Rd)(),e.contactList?.userIds.forEach((t=>{const{isCloseFriend:s}=e.users.byId[t]||{};s&&!n.includes(t)&&(e=(0,w.Nq)(e,t,{isCloseFriend:void 0}))})),n.forEach((t=>{e=(0,w.Nq)(e,t,{isCloseFriend:!0})})),(0,a.R3)(e))}));const be=i.cj||i.wZ;class ye{constructor(e,t){var s,a,n,i;this.features=e,this.onFail=t,s=this,n=void 0,(a="symbol"==typeof(i=function(e,t){if("object"!=typeof e||!e)return e;var s=e[Symbol.toPrimitive];if(void 0!==s){var a=s.call(e,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(a="preOpened"))?i:String(i))in s?Object.defineProperty(s,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):s[a]=n}preOpenIfNeeded(){be&&(this.preOpened=window.open("about:blank",void 0,this.features),this.preOpened?this.preOpened.blur():this.onFail?.())}open(e){if(this.preOpened)return this.preOpened.location.href=e,this.preOpened.focus(),void(this.preOpened=void 0);if(!be){const t=window.open(e,void 0,this.features);t?t.focus():this.onFail?.()}}cancelPreOpen(){this.preOpened?.close(),this.preOpened=void 0}}var Pe=s(97690),Ze=s(18629);function Se(e,t,s,...[a=(0,u._w)()]){const n=(0,b.jUK)(e,a);return(0,v.i)(e,{inlineBots:{...n.inlineBots,byUsername:{...n.inlineBots.byUsername,[t]:s}}},a)}function Ce(e,t,...[s=(0,u._w)()]){return(0,v.i)(e,{inlineBots:{...(0,b.jUK)(e,s).inlineBots,isLoading:t}},s)}const Me=(0,g.Ds)((e=>e()),500,!1);let Ee,Re;function ke(e,t,s,n,...[i=(0,u._w)()]){if("request"===n.type){e=(0,a.Rd)();const t=(0,b.jUK)(e,i);if(!t.urlAuth)return;const{domain:s,bot:o,shouldRequestWriteAccess:r}=n;return e=(0,v.i)(e,{urlAuth:{...t.urlAuth,request:{domain:s,botId:o.id,shouldRequestWriteAccess:r}}},i),void(0,a.R3)(e)}const o="accepted"===n.type?n.url:s;window.open(o,"_blank","noopener"),t.closeUrlAuthModal({tabId:i})}async function Te(e,t,s,a,n){await(0,f.t9)("sendMessage",{chat:e,replyInfo:s,text:t,sendAs:a,lastMessageId:n})}async function Ne(e,t,s,a,n,i=!1,...[o=(0,u._w)()]){const{showDialog:r,showNotification:c,openUrl:d,openGame:l}=t;i&&(Re||(Re=new ye("popup,width=800,height=600",(()=>{c({message:"Allow browser to open popup window",tabId:o})}))),Re.preOpenIfNeeded());const m=await(0,f.t9)("answerCallbackButton",{chatId:s.id,accessHash:s.accessHash,messageId:a,data:n,isGame:i});if(!m)return;const{message:h,alert:p,url:g}=m;p?r({data:{message:h||"Error"},tabId:o}):h?c({message:h,tabId:o}):g&&(i?g.includes("https://prizes.gamee.com/")?Re.open(g):(Re.cancelPreOpen(),l({url:g,chatId:s.id,messageId:a,tabId:o})):d({url:g,tabId:o}))}async function Ae(e,t,...[s=(0,u._w)()]){const n=await(0,f.t9)("getPaymentForm",t);if(!n)return;const{form:i,invoice:o,users:r,botId:d}=n;return e=(0,a.Rd)(),e=(0,w.Sh)(e,(0,m.ee)(r,"id")),e=(0,w._7)(e,i,s),e=(0,w.Q$)(e,c.KB.Checkout,s),e=(0,w.cQ)(e,{botName:(0,b.dyD)(e,d)?.firstName},s),(0,a.R3)(e),o}async function Be(e,t,s,n,...[i=(0,u._w)()]){const o=await(0,f.t9)("validateRequestedInfo",{inputInvoice:t,requestInfo:s,shouldSave:n});if(!o)return;const{id:r,shippingOptions:d}=o;e=(0,a.Rd)(),e=(0,w.vT)(e,r,i),d?(e=(0,w.TM)(e,d,i),e=(0,w.Q$)(e,c.KB.Shipping,i)):e=(0,w.Q$)(e,c.KB.Checkout,i),(0,a.R3)(e)}(0,a.iw)("clickBotInlineButton",((e,t,s)=>{const{messageId:a,button:n,tabId:i=(0,u._w)()}=s;switch(n.type){case"command":t.sendBotCommand({command:n.text,tabId:i});break;case"url":{const{url:e}=n;t.openUrl({url:e,tabId:i});break}case"callback":{const s=(0,b.jrE)(e,i);if(!s)return;Ne(0,t,s,a,n.data,void 0,i);break}case"requestPoll":t.openPollModal({isQuiz:n.isQuiz,tabId:i});break;case"requestPhone":{const s=e.currentUserId?(0,b.dyD)(e,e.currentUserId):void 0;if(!s)return;t.showDialog({data:{phoneNumber:s.phoneNumber,firstName:s.firstName||"",lastName:s.lastName||"",userId:s.id},tabId:i});break}case"receipt":{const s=(0,b.jrE)(e,i);if(!s)return;const{receiptMessageId:o}=n;t.getReceipt({receiptMessageId:o,chatId:s.id,messageId:a,tabId:i});break}case"buy":{const s=(0,b.jrE)(e,i);if(!s)return;t.openInvoice({chatId:s.id,messageId:a,tabId:i});break}case"game":{const s=(0,b.jrE)(e,i);if(!s)return;Ne(0,t,s,a,void 0,!0,i);break}case"switchBotInline":{const{query:e,isSamePeer:s}=n;t.switchBotInline({query:e,isSamePeer:s,messageId:a,tabId:i});break}case"userProfile":{const{userId:e}=n;t.openChatWithInfo({id:e,tabId:i});break}case"simpleWebView":{const{url:s}=n,{chatId:o}=(0,b.Btg)(e,i)||{};if(!o)return;const r=(0,b.hjO)(e,o,a);if(!r?.senderId)return;const c=(0,Ze.BS)();t.requestSimpleWebView({url:s,botId:r?.senderId,theme:c,buttonText:n.text,tabId:i});break}case"webView":{const{url:s}=n,o=(0,b.jrE)(e,i);if(!o)return;const r=(0,b.hjO)(e,o.id,a);if(!r)return;const c=r.viaBotId||r.senderId;if(!c)return;const d=(0,Ze.BS)();t.requestWebView({url:s,botId:c,peerId:o.id,theme:d,buttonText:n.text,tabId:i});break}case"urlAuth":{const{url:s}=n,o=(0,b.jrE)(e,i);if(!o)return;t.requestBotUrlAuth({chatId:o.id,messageId:a,buttonId:n.buttonId,url:s,tabId:i});break}}})),(0,a.iw)("sendBotCommand",((e,t,s)=>{const{command:a,chatId:n,tabId:i=(0,u._w)()}=s,o=n?(0,b.Z1J)(e,n):(0,b.jrE)(e,i),r=(0,b.Btg)(e,i);if(!o||!r)return;const{threadId:c}=r;t.resetDraftReplyInfo({tabId:i}),t.clearWebPagePreview({tabId:i});const d=(0,b.xMv)(e,o.id);Te(o,a,(0,b.Mst)(e,o.id,c)?.replyInfo,(0,b._5C)(e,o.id),d)})),(0,a.iw)("restartBot",(async(e,t,s)=>{const{chatId:n,tabId:i=(0,u._w)()}=s,{currentUserId:o}=e,r=(0,b.jrE)(e,i),c=o&&(0,b.kBx)(e,n);if(!o||!r||!c)return;const d=(0,b.xMv)(e,r.id);await(0,f.t9)("unblockUser",{user:c})&&(e=(0,a.Rd)(),e=(0,w.kw)(e,c.id),(0,a.R3)(e),Te(r,"/start",void 0,(0,b._5C)(e,n),d))})),(0,a.iw)("loadTopInlineBots",(async e=>{const{lastRequestedAt:t}=e.topInlineBots;if(t&&(0,we.bp)()-t<60)return;const s=await(0,f.t9)("fetchTopInlineBots");if(!s)return;const{ids:n,users:i}=s;e=(0,a.Rd)(),e=(0,w.Sh)(e,(0,m.ee)(i,"id")),e={...e,topInlineBots:{...e.topInlineBots,userIds:n,lastRequestedAt:(0,we.bp)()}},(0,a.R3)(e)})),(0,a.iw)("queryInlineBot",(async(e,t,s)=>{const{chatId:n,username:i,query:o,offset:r,tabId:c=(0,u._w)()}=s;let d=(0,b.jUK)(e,c).inlineBots.byUsername[i];if(!1!==d){if(void 0===d){const{user:t,chat:s}=await(0,f.t9)("fetchInlineBot",{username:i})||{};if(e=(0,a.Rd)(),!t||!s)return e=Se(e,i,!1,c),void(0,a.R3)(e);e=(0,w.Sh)(e,{[t.id]:t}),e=(0,w.fZ)(e,{[s.id]:s}),d={id:t.id,query:"",offset:"",switchPm:void 0,canLoadMore:!0,results:[],cacheTime:0},e=Se(e,i,d,c),(0,a.R3)(e)}(o!==d.query||d.canLoadMore)&&Me((()=>{!async function(e,{username:t,inlineBotData:s,chatId:n,query:i,offset:o},...[r=(0,u._w)()]){e=(0,a.Rd)();const c=(0,b.dyD)(e,s.id),d=(0,b.Z1J)(e,n);if(!c||!d)return;const l=s.query!==i;e=Se(e=Ce(e,!0,r),t,{...s,query:i,...l&&{offset:void 0,results:[]}},r),(0,a.R3)(e);const m=await(0,f.t9)("fetchInlineBotResults",{bot:c,chat:d,query:i,offset:l?void 0:o});e=(0,a.Rd)();const h=(0,b.jUK)(e,r).inlineBots.byUsername[t];if(e=Ce(e,!1,r),!m||!h||i!==h.query)return void(0,a.R3)(e);const p=new Set((h.results||[]).map((e=>e.id))),g=m.results.filter((e=>!p.has(e.id)));e=Se(e,t,{...h,help:m.help,cacheTime:Date.now()+1e3*m.cacheTime,...g.length&&{isGallery:m.isGallery},...m.switchPm&&{switchPm:m.switchPm},...m.switchWebview&&{switchWebview:m.switchWebview},canLoadMore:m.results.length>0&&Boolean(m.nextOffset),results:""===h.offset||h.offset===m.nextOffset?m.results:(h.results||[]).concat(g),offset:g.length?m.nextOffset:""},r),(0,a.R3)(e)}(e,{username:i,inlineBotData:d,chatId:n,query:o,offset:r},c)}))}})),(0,a.iw)("switchBotInline",((e,t,s)=>{const{query:a,isSamePeer:n,messageId:i,filter:o,tabId:r=(0,u._w)()}=s;let{botId:c}=s;const d=(0,b.jrE)(e,r);if(!d)return;if(!c&&i){const t=(0,b.hjO)(e,d.id,i);if(!t)return;c=t.viaBotId||t.senderId}if(!c)return;const l=(0,b.dyD)(e,c);l&&t.openChatWithDraft({text:`@${l.usernames[0].username} ${a}`,chatId:n?d.id:void 0,filter:o,tabId:r})})),(0,a.iw)("sendInlineBotResult",((e,t,s)=>{const{id:a,queryId:n,isSilent:i,scheduledAt:o,messageList:r,tabId:c=(0,u._w)()}=s;if(!a)return;const{chatId:d,threadId:l}=r,m=(0,b.Z1J)(e,d),h=(0,b.Mst)(e,d,l)?.replyInfo,p=(0,b.U1D)(e,d,l,h);t.resetDraftReplyInfo({tabId:c}),t.clearWebPagePreview({tabId:c}),(0,f.t9)("sendInlineBotResult",{chat:m,resultId:a,queryId:n,replyInfo:p,sendAs:(0,b._5C)(e,d),isSilent:i,scheduleDate:o})})),(0,a.iw)("resetInlineBot",((e,t,s)=>{const{username:n,force:i,tabId:o=(0,u._w)()}=s;let r=(0,b.jUK)(e,o).inlineBots.byUsername[n];r&&(!i&&Date.now()<r.cacheTime||(r={id:r.id,query:"",offset:"",switchPm:void 0,canLoadMore:!0,results:[],cacheTime:0},e=Se(e,n,r,o),(0,a.R3)(e)))})),(0,a.iw)("resetAllInlineBots",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{},n=(0,b.jUK)(e,a).inlineBots.byUsername;Object.keys(n).forEach((e=>{t.resetInlineBot({username:e,tabId:a})}))})),(0,a.iw)("startBot",(async(e,t,s)=>{const{botId:a,param:n}=s,i=(0,b.dyD)(e,a);if(!i)return;let o=(0,b.ccz)(e,a);if(!o){const e=await(0,f.t9)("fetchFullUser",{id:i.id,accessHash:i.accessHash});o=e?.fullInfo}o?.isBlocked&&await(0,f.t9)("unblockUser",{user:i}),await(0,f.t9)("startBot",{bot:i,startParam:n})})),(0,a.iw)("sharePhoneWithBot",(async(e,t,s)=>{const{botId:n}=s,i=(0,b.dyD)(e,n);if(!i)return;let o=(0,b.ccz)(e,n);if(!o){const e=await(0,f.t9)("fetchFullUser",{id:i.id,accessHash:i.accessHash});o=e?.fullInfo}o?.isBlocked&&await(0,f.t9)("unblockUser",{user:i}),e=(0,a.Rd)();const r=(0,b.Z1J)(e,n),c=(0,b.dyD)(e,e.currentUserId);if(!r)return;const d=(0,b.xMv)(e,r.id);await(0,f.t9)("sendMessage",{chat:r,contact:{firstName:c.firstName||"",lastName:c.lastName||"",phoneNumber:c.phoneNumber||"",userId:c.id},lastMessageId:d})})),(0,a.iw)("requestSimpleWebView",(async(e,t,s)=>{const{url:n,botId:i,theme:o,buttonText:r,isFromSideMenu:c,isFromSwitchWebView:d,startParam:l,tabId:m=(0,u._w)()}=s,h=(0,b.dyD)(e,i);if(!h)return;if(!(0,b.LM9)(e,i))return e=(0,v.i)(e,{botTrustRequest:{botId:i,type:"webApp",onConfirm:{action:"requestSimpleWebView",payload:s}}},m),void(0,a.R3)(e);const p=await(0,f.t9)("requestSimpleWebView",{url:n,bot:h,theme:o,startParam:l,isFromSideMenu:c,isFromSwitchWebView:d});p&&(e=(0,a.Rd)(),e=(0,v.i)(e,{webApp:{url:p,botId:i,buttonText:r}},m),(0,a.R3)(e))})),(0,a.iw)("requestWebView",(async(e,t,s)=>{const{url:n,botId:i,peerId:o,theme:r,isSilent:c,buttonText:d,isFromBotMenu:l,startParam:m,tabId:h=(0,u._w)()}=s,p=(0,b.dyD)(e,i);if(!p)return;const g=(0,b.Z1J)(e,o);if(!g)return;if(!(0,b.LM9)(e,i))return e=(0,v.i)(e,{botTrustRequest:{botId:i,type:"webApp",onConfirm:{action:"requestWebView",payload:s}}},h),void(0,a.R3)(e);const I=(0,b.Btg)(e,h);if(!I)return;const{chatId:w,threadId:y}=I,P=w?(0,b.Mst)(e,w,y)?.replyInfo:void 0,Z=(0,b.U1D)(e,w,y,P),S=(0,b._5C)(e,w),C=await(0,f.t9)("requestWebView",{url:n,bot:p,peer:g,theme:r,isSilent:c,replyInfo:Z,isFromBotMenu:l,startParam:m,sendAs:S});if(!C)return;const{url:M,queryId:E}=C;e=(0,a.Rd)(),e=(0,v.i)(e,{webApp:{url:M,botId:i,queryId:E,replyInfo:Z,buttonText:d}},h),(0,a.R3)(e)})),(0,a.iw)("requestAppWebView",(async(e,t,s)=>{const{botId:n,appName:i,startApp:o,theme:r,isWriteAllowed:c,isFromConfirm:d,tabId:l=(0,u._w)()}=s,p=(0,b.dyD)(e,n);if(!p)return;const g=Boolean(e.attachMenu.bots[p.id]);if(p.isAttachBot&&!d&&!g){const t=await(0,f.t9)("loadAttachBot",{bot:p});if(t){const n=t.bot;if(e=(0,a.Rd)(),e=(0,w.Sh)(e,(0,m.ee)(t.users,"id")),(0,a.R3)(e),n.isDisclaimerNeeded||n.isForAttachMenu||n.isForSideMenu)return e=(0,v.i)(e,{requestedAttachBotInstall:{bot:n,onConfirm:{action:"requestAppWebView",payload:{...s,isFromConfirm:!0}}}},l),void(0,a.R3)(e)}}const I=await(0,f.t9)("fetchBotApp",{bot:p,appName:i});if(e=(0,a.Rd)(),!I)return void t.showNotification({message:(0,h.Iu)("lng_username_app_not_found"),tabId:l});if(I.isInactive&&!(0,b.LM9)(e,n))return e=(0,v.i)(e,{botTrustRequest:{botId:n,shouldRequestWriteAccess:I.shouldRequestWriteAccess,type:"botApp",onConfirm:{action:"requestAppWebView",payload:s}}},l),void(0,a.R3)(e);const y=(0,b.jrE)(e,l),P=await(0,f.t9)("requestAppWebView",{peer:y||p,app:I,startParam:o,isWriteAllowed:c,theme:r});e=(0,a.Rd)(),P&&(e=(0,v.i)(e,{webApp:{url:P,botId:n,buttonText:""}},l),(0,a.R3)(e))})),(0,a.iw)("prolongWebView",(async(e,t,s)=>{const{botId:a,peerId:n,isSilent:i,replyInfo:o,queryId:r,tabId:c=(0,u._w)()}=s,d=(0,b.dyD)(e,a);if(!d)return;const l=(0,b.Z1J)(e,n);if(!l)return;const m=(0,b._5C)(e,n);await(0,f.t9)("prolongWebView",{bot:d,peer:l,isSilent:i,replyInfo:o,queryId:r,sendAs:m})||t.closeWebApp({tabId:c})})),(0,a.iw)("sendWebViewData",((e,t,s)=>{const{bot:a,data:n,buttonText:i}=s;(0,f.t9)("sendWebViewData",{bot:a,data:n,buttonText:i})})),(0,a.iw)("closeWebApp",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{};return(0,v.i)(e,{webApp:void 0},a)})),(0,a.iw)("setWebAppPaymentSlug",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s,n=(0,b.jUK)(e,a);if(n.webApp?.url)return(0,v.i)(e,{webApp:{...n.webApp,slug:s.slug}},a)})),(0,a.iw)("cancelBotTrustRequest",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{};return(0,v.i)(e,{botTrustRequest:void 0},a)})),(0,a.iw)("markBotTrusted",((e,t,s)=>{const{botId:n,isWriteAllowed:i,tabId:o=(0,u._w)()}=s,{trustedBotIds:r}=e,c=new Set(r);c.add(n),e={...e,trustedBotIds:Array.from(c)};const d=(0,b.jUK)(e,o);if(d.botTrustRequest?.onConfirm){const{action:e,payload:s}=d.botTrustRequest.onConfirm;t[e]({...s,isWriteAllowed:i})}e=(0,v.i)(e,{botTrustRequest:void 0},o),(0,a.R3)(e)})),(0,a.iw)("loadAttachBots",(async(e,t,s)=>{const{hash:i}=s||{},o=await async function(e,t){const s=await(0,f.t9)("loadAttachBots",{hash:t});if(s)return e=(0,a.Rd)(),e=(0,w.Sh)(e,(0,m.ee)(s.users,"id")),e={...e,attachMenu:{hash:s.hash,bots:s.bots}},(0,a.R3)(e),s}(e,i);(0,Pe.Z)({action:"loadAttachBots",payload:{hash:o?.hash}},n.dse)})),(0,a.iw)("toggleAttachBot",(async(e,t,s)=>{const{botId:a,isWriteAllowed:n,isEnabled:i}=s,o=(0,b.dyD)(e,a);o&&await(0,f.t9)("toggleAttachBot",{bot:o,isWriteAllowed:n,isEnabled:i})})),(0,a.iw)("callAttachBot",((e,t,s)=>{const{bot:a,startParam:n,isFromConfirm:i,tabId:o=(0,u._w)()}=s,c="isFromSideMenu"in s&&s.isFromSideMenu,d=!a,l=!d&&!e.attachMenu.bots[a.id]||a?.isInactive||a?.isDisclaimerNeeded;if(!i&&l)return(0,v.i)(e,{requestedAttachBotInstall:{bot:a,onConfirm:{action:"callAttachBot",payload:{...s,isFromConfirm:!0}}}},o);const m=(0,Ze.BS)();if(c&&t.requestSimpleWebView({botId:a.id,buttonText:"",isFromSideMenu:!0,startParam:n,theme:m,tabId:o}),"chatId"in s){const{chatId:e,threadId:i=r._f,url:c}=s;t.openThread({chatId:e,threadId:i,tabId:o}),t.requestWebView({url:c,peerId:e,botId:d?e:a.id,theme:m,buttonText:"",isFromBotMenu:d,startParam:n,tabId:o})}})),(0,a.iw)("confirmAttachBotInstall",(async(e,t,s)=>{const{isWriteAllowed:n,tabId:i=(0,u._w)()}=s,{requestedAttachBotInstall:o}=(0,b.jUK)(e,i),{bot:r,onConfirm:c}=o;e=(0,v.i)(e,{requestedAttachBotInstall:void 0},i),(0,a.R3)(e);const d=(0,b.dyD)(e,r.id);if(d&&(t.markBotTrusted({botId:r.id,isWriteAllowed:n,tabId:i}),await(0,f.t9)("toggleAttachBot",{bot:d,isWriteAllowed:n,isEnabled:!0}),c)){const{action:e,payload:s}=c;t[e](s)}})),(0,a.iw)("cancelAttachBotInstall",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{};return(0,v.i)(e,{requestedAttachBotInstall:void 0},a)})),(0,a.iw)("requestAttachBotInChat",((e,t,s)=>{const{bot:n,filter:i,startParam:o,tabId:r=(0,u._w)()}=s,c=(0,b.Btg)(e,r)?.chatId,d=n.attachMenuPeerTypes?.filter((e=>"self"!==e&&i.includes(e)));d?.length?(e=(0,v.i)(e,{requestedAttachBotInChat:{bot:n,filter:d,startParam:o}},r),(0,a.R3)(e)):t.callAttachBot({chatId:c||n.id,bot:n,startParam:o,tabId:r})})),(0,a.iw)("cancelAttachBotInChat",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{};return(0,v.i)(e,{requestedAttachBotInChat:void 0},a)})),(0,a.iw)("requestBotUrlAuth",(async(e,t,s)=>{const{chatId:n,buttonId:i,messageId:o,url:r,tabId:c=(0,u._w)()}=s,d=(0,b.Z1J)(e,n);if(!d)return;const l=await(0,f.t9)("requestBotUrlAuth",{chat:d,buttonId:i,messageId:o});l&&(e=(0,a.Rd)(),e=(0,v.i)(e,{urlAuth:{url:r,button:{buttonId:i,messageId:o,chatId:d.id}}},c),(0,a.R3)(e),ke(e,t,r,l,c))})),(0,a.iw)("acceptBotUrlAuth",(async(e,t,s)=>{const{isWriteAllowed:n,tabId:i=(0,u._w)()}=s,o=(0,b.jUK)(e,i);if(!o.urlAuth?.button)return;const{button:r,url:c}=o.urlAuth,{chatId:d,messageId:l,buttonId:m}=r,h=(0,b.Z1J)(e,d);if(!h)return;const p=await(0,f.t9)("acceptBotUrlAuth",{chat:h,messageId:l,buttonId:m,isWriteAllowed:n});p&&ke(e=(0,a.Rd)(),t,c,p,i)})),(0,a.iw)("requestLinkUrlAuth",(async(e,t,s)=>{const{url:n,tabId:i=(0,u._w)()}=s,o=await(0,f.t9)("requestLinkUrlAuth",{url:n});o&&(e=(0,a.Rd)(),e=(0,v.i)(e,{urlAuth:{url:n}},i),(0,a.R3)(e),ke(e,t,n,o,i))})),(0,a.iw)("acceptLinkUrlAuth",(async(e,t,s)=>{const{isWriteAllowed:n,tabId:i=(0,u._w)()}=s,o=(0,b.jUK)(e,i);if(!o.urlAuth?.url)return;const{url:r}=o.urlAuth,c=await(0,f.t9)("acceptLinkUrlAuth",{url:r,isWriteAllowed:n});c&&ke(e=(0,a.Rd)(),t,r,c,i)})),(0,a.iw)("closeUrlAuthModal",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{};return(0,v.i)(e,{urlAuth:void 0},a)})),(0,a.iw)("setBotInfo",(async(e,t,s)=>{const{bot:n,name:i,description:o,tabId:r=(0,u._w)()}=s;let{langCode:d}=s;d||(d=e.settings.byKey.language);const{currentUserId:l}=e;l&&n&&(e=(0,a.Rd)(),e=(0,w.H9)(e,c.wv.InProgress,r),(0,a.R3)(e),(i||o)&&await(0,f.t9)("setBotInfo",{bot:n,langCode:d,name:i,about:o})&&(e=(0,a.Rd)(),e=(0,w.Nq)(e,n.id,{firstName:i}),e=(0,w.ap)(e,n.id,{bio:o}),(0,a.R3)(e)),e=(0,a.Rd)(),e=(0,w.H9)(e,c.wv.Complete,r),(0,a.R3)(e))})),(0,a.iw)("startBotFatherConversation",(async(e,t,s)=>{const{param:a,tabId:i=(0,u._w)()}=s;if(!Ee){const t=await(0,o.Co)(e,n.P1i);if(!t)return;Ee=t.id}a&&t.startBot({botId:Ee,param:a}),t.openChat({id:Ee,tabId:i})})),s(51371),(0,a.iw)("loadPasswordInfo",(async e=>{const t=await(0,f.t9)("getPasswordInfo");t&&(e=(0,a.Rd)(),e=(0,w.BI)(e,{hasPassword:t.hasPassword}),e=(0,w.IE)(e,{hint:t.hint}),(0,a.R3)(e))})),(0,a.iw)("checkPassword",(async(e,t,s)=>{const{currentPassword:n,onSuccess:i}=s;e=(0,w.IE)(e,{isLoading:!0,error:void 0}),(0,a.R3)(e);const o=await(0,f.t9)("checkPassword",n);e=(0,a.Rd)(),e=(0,w.IE)(e,{isLoading:!1}),(0,a.R3)(e),o&&i()})),(0,a.iw)("clearPassword",(async(e,t,s)=>{const{currentPassword:n,onSuccess:i}=s;e=(0,w.IE)(e,{isLoading:!0,error:void 0}),(0,a.R3)(e);const o=await(0,f.t9)("clearPassword",n);e=(0,a.Rd)(),e=(0,w.IE)(e,{isLoading:!1}),(0,a.R3)(e),o&&i()})),(0,a.iw)("updatePassword",(async(e,t,s)=>{const{currentPassword:n,password:i,hint:o,email:r,onSuccess:c}=s;e=(0,w.IE)(e,{isLoading:!0,error:void 0}),(0,a.R3)(e);const d=await(0,f.t9)("updatePassword",n,i,o,r);e=(0,a.Rd)(),e=(0,w.IE)(e,{isLoading:!1}),(0,a.R3)(e),d&&c()})),(0,a.iw)("updateRecoveryEmail",(async(e,t,s)=>{const{currentPassword:n,email:i,onSuccess:o}=s;e=(0,w.IE)(e,{isLoading:!0,error:void 0}),(0,a.R3)(e);const r=await(0,f.t9)("updateRecoveryEmail",n,i);e=(0,a.Rd)(),e=(0,w.IE)(e,{isLoading:!1,waitingEmailCodeLength:void 0}),(0,a.R3)(e),r&&o()})),(0,a.iw)("provideTwoFaEmailCode",((e,t,s)=>{const{code:a}=s;(0,f.t9)("provideRecoveryEmailCode",a)})),(0,a.iw)("clearTwoFaError",(e=>(0,w.IE)(e,{error:void 0}))),(0,a.iw)("validateRequestedInfo",((e,t,s)=>{const{requestInfo:a,saveInfo:n,tabId:i=(0,u._w)()}=s,o=(0,b.kbX)(e,i);if(o)if("slug"in o)Be(e,o,a,n,i);else{const t=(0,b.Z1J)(e,o.chatId);if(!t)return;Be(e,{chat:t,messageId:o.messageId},a,n,i)}})),(0,a.iw)("openInvoice",(async(e,t,s)=>{const{tabId:n=(0,u._w)()}=s;let i;if("slug"in s)i=await Ae(e,{slug:s.slug},n);else{const t=(0,b.Z1J)(e,s.chatId);if(!t)return;i=await Ae(e,{chat:t,messageId:s.messageId},n)}i&&(e=(0,a.Rd)(),e=(0,w.bs)(e,i,n),e=(0,v.i)(e,{payment:{...(0,b.jUK)(e,n).payment,inputInvoice:s,isPaymentModalOpen:!0,status:"cancelled",isExtendedMedia:s.isExtendedMedia}},n),(0,a.R3)(e))})),(0,a.iw)("getReceipt",(async(e,t,s)=>{const{receiptMessageId:n,chatId:i,messageId:o,tabId:r=(0,u._w)()}=s,c=i&&(0,b.Z1J)(e,i);if(!o||!n||!c)return;const d=await(0,f.t9)("getReceipt",c,n);if(!d)return;e=(0,a.Rd)();const l=(0,b.hjO)(e,c.id,o);e=(0,w.Sh)(e,(0,m.ee)(d.users,"id")),e=(0,w.Dq)(e,d.receipt,l,r),(0,a.R3)(e)})),(0,a.iw)("clearPaymentError",((e,t,s)=>{const{tabId:n=(0,u._w)()}=s||{};e=(0,v.i)(e,{payment:{...(0,b.jUK)(e,n).payment,error:void 0}},n),(0,a.R3)(e)})),(0,a.iw)("clearReceipt",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{};return(0,v.i)(e,{payment:{...(0,b.jUK)(e,a).payment,receipt:void 0}},a)})),(0,a.iw)("sendCredentialsInfo",((e,t,s)=>{const{credentials:i,tabId:o=(0,u._w)()}=s,{nativeProvider:r}=(0,b.jUK)(e,o).payment,{data:d}=i;if("stripe"===r){const t=(0,b.$$M)(e,o);if(!t)return;!async function(e,t,s,...[n=(0,u._w)()]){const i=function(e){const t=Object.keys(e).map((t=>`${t}=${e[t]}`)).join("&");return t.length>0?`?${t}`:""}({"card[number]":t.cardNumber,"card[exp_month]":t.expiryMonth,"card[exp_year]":t.expiryYear,"card[cvc]":t.cvv,"card[address_zip]":t.zip,"card[address_country]":t.country}),o=await fetch(`https://api.stripe.com/v1/tokens${i}`,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/x-www-form-urlencoded",Authorization:`Bearer ${s}`}}),r=await o.json();if(r.error){const t=(0,I.Ow)(r.error);return e=(0,a.Rd)(),e=(0,v.i)(e,{payment:{...(0,b.jUK)(e,n).payment,status:"failed",error:{...t}}},n),void(0,a.R3)(e)}e=(0,a.Rd)(),e=(0,w.QH)(e,{type:r.type,id:r.id},n),e=(0,w.Q$)(e,c.KB.Checkout,n),(0,a.R3)(e)}(e,d,t,o)}else if("smartglocal"===r){const t=(0,b.EBU)(e,o);if(!t)return;!async function(e,t,s,...[i=(0,u._w)()]){const o={card:{number:t.cardNumber.replace(/\D+/g,""),expiration_month:t.expiryMonth,expiration_year:t.expiryYear,security_code:t.cvv.replace(/\D+/g,"")}},r=n.eAU?"https://tgb-playground.smart-glocal.com/cds/v1/tokenize/card":"https://tgb.smart-glocal.com/cds/v1/tokenize/card",d=await fetch(r,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json","X-PUBLIC-TOKEN":s},body:JSON.stringify(o)}),l=await d.json();if("ok"!==l.status){const t={description:"payment error"};return e=(0,a.Rd)(),e=(0,v.i)(e,{payment:{...(0,b.jUK)(e,i).payment,status:"failed",error:{...t}}},i),void(0,a.R3)(e)}e=(0,a.Rd)(),e=(0,w.QD)(e,{type:"card",token:l.data.token},i),e=(0,w.Q$)(e,c.KB.Checkout,i),(0,a.R3)(e)}(e,d,t,o)}})),(0,a.iw)("sendPaymentForm",(async(e,t,s)=>{const{shippingOptionId:n,saveCredentials:i,savedCredentialId:o,tipAmount:r,tabId:c=(0,u._w)()}=s,d=(0,b.kbX)(e,c),l=(0,b.ehD)(e,c),m=(0,b.sp9)(e,c),{nativeProvider:h,temporaryPassword:p}=(0,b.jUK)(e,c).payment;if(!d||!l)return;let g;if("slug"in d)g={slug:d.slug};else{const t=(0,b.Z1J)(e,d.chatId);if(!t)return;g={chat:t,messageId:d.messageId}}e=(0,w.cQ)(e,{status:"pending"},c),(0,a.R3)(e);const I={save:i,data:"stripe"===h?(0,b.i31)(e,c):(0,b.Jg1)(e,c)};await(0,f.t9)("sendPaymentForm",{inputInvoice:g,formId:l,credentials:I,requestedInfoId:m,shippingOptionId:n,savedCredentialId:o,temporaryPassword:p?.value,tipAmount:r})&&(e=(0,a.Rd)(),e=(0,w.cQ)(e,{status:"paid"},c),e=(0,w.WY)(e,c),(0,a.R3)(e))})),(0,a.iw)("setSmartGlocalCardInfo",((e,t,s)=>{const{tabId:a=(0,u._w)(),type:n,token:i}=s;return(0,w.QD)(e,{type:n,token:i},a)})),(0,a.iw)("setPaymentStep",((e,t,s)=>{const{step:a,tabId:n=(0,u._w)()}=s;return(0,w.Q$)(e,a??c.KB.Checkout,n)})),(0,a.iw)("closePremiumModal",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{},n=(0,b.jUK)(e,a);if(n.premiumModal)return(0,v.i)(e,{premiumModal:{promo:n.premiumModal.promo,isOpen:!1}},a)})),(0,a.iw)("openPremiumModal",(async(e,t,s)=>{const{initialSection:n,fromUserId:i,isSuccess:o,isGift:r,monthsAmount:c,toUserId:d,tabId:l=(0,u._w)()}=s||{};t.loadPremiumStickers();const h=await(0,f.t9)("fetchPremiumPromo");h&&(e=(0,a.Rd)(),e=(0,w.Sh)(e,(0,m.ee)(h.users,"id")),e=(0,v.i)(e,{premiumModal:{promo:h.promo,initialSection:n,isOpen:!0,fromUserId:i,toUserId:d,isGift:r,monthsAmount:c,isSuccess:o}},l),(0,a.R3)(e),t.closeReactionPicker({tabId:l}))})),(0,a.iw)("openGiftPremiumModal",(async(e,t,s)=>{const{forUserId:n,tabId:i=(0,u._w)()}=s||{},o=await(0,f.t9)("fetchPremiumPromo");o&&(e=(0,a.Rd)(),e=(0,w.Sh)(e,(0,m.ee)(o.users,"id")),e=(0,v.i)(e,{giftPremiumModal:{isOpen:!0,forUserId:n}},i),(0,a.R3)(e))})),(0,a.iw)("closeGiftPremiumModal",((e,t,s)=>{const{tabId:n=(0,u._w)()}=s||{};e=(0,v.i)(e,{giftPremiumModal:{isOpen:!1}},n),(0,a.R3)(e)})),(0,a.iw)("validatePaymentPassword",(async(e,t,s)=>{const{password:n,tabId:i=(0,u._w)()}=s,o=await(0,f.t9)("fetchTemporaryPaymentPassword",n);e=(0,a.Rd)(),e=o?"error"in o?(0,w.cQ)(e,{error:{message:o.error,field:"password"}},i):(0,w.cQ)(e,{temporaryPassword:o,step:c.KB.Checkout},i):(0,w.cQ)(e,{error:{message:"Unknown Error",field:"password"}},i),(0,a.R3)(e)})),(0,a.iw)("openBoostModal",(async(e,t,s)=>{const{chatId:n,tabId:i=(0,u._w)()}=s,o=(0,b.Z1J)(e,n);if(!o||!(0,I.eA)(o)&&!(0,I.ZV)(o))return;e=(0,v.i)(e,{boostModal:{chatId:n}},i),(0,a.R3)(e);const r=await(0,f.t9)("fetchBoostsStatus",{chat:o});if(!r)return void t.closeBoostModal({tabId:i});e=(0,a.Rd)(),e=(0,v.i)(e,{boostModal:{chatId:n,boostStatus:r}},i),(0,a.R3)(e);const c=await(0,f.t9)("fetchMyBoosts");if(!c)return;e=(0,a.Rd)();const d=(0,b.jUK)(e,i);d.boostModal&&(e=(0,w.fZ)(e,(0,m.ee)(c.chats,"id")),e=(0,w.Sh)(e,(0,m.ee)(c.users,"id")),e=(0,v.i)(e,{boostModal:{...d.boostModal,myBoosts:c.boosts}},i),(0,a.R3)(e))})),(0,a.iw)("openBoostStatistics",(async(e,t,s)=>{const{chatId:n,tabId:i=(0,u._w)()}=s,o=(0,b.Z1J)(e,n);if(!o)return;e=(0,v.i)(e,{boostStatistics:{chatId:n}},i),(0,a.R3)(e);const[r,c]=await Promise.all([(0,f.t9)("fetchBoostsList",{chat:o}),(0,f.t9)("fetchBoostsStatus",{chat:o})]);if(e=(0,a.Rd)(),!r||!c)return e=(0,v.i)(e,{boostStatistics:void 0},i),void(0,a.R3)(e);e=(0,w.Sh)(e,(0,m.ee)(r.users,"id")),e=(0,v.i)(e,{boostStatistics:{chatId:n,boostStatus:c,boosters:r.boosters,boosterIds:r.boosterIds,count:r.count,nextOffset:r.nextOffset}},i),(0,a.R3)(e)})),(0,a.iw)("loadMoreBoosters",(async(e,t,s)=>{const{tabId:n=(0,u._w)()}=s||{};let i=(0,b.jUK)(e,n);if(!i.boostStatistics)return;const o=(0,b.Z1J)(e,i.boostStatistics.chatId);if(!o)return;e=(0,v.i)(e,{boostStatistics:{...i.boostStatistics,isLoadingBoosters:!0}},n),(0,a.R3)(e);const r=await(0,f.t9)("fetchBoostsList",{chat:o,offset:i.boostStatistics.nextOffset});r&&(e=(0,a.Rd)(),e=(0,w.Sh)(e,(0,m.ee)(r.users,"id")),i=(0,b.jUK)(e,n),i.boostStatistics&&(e=(0,v.i)(e,{boostStatistics:{...i.boostStatistics,boosters:{...i.boostStatistics.boosters,...r.boosters},boosterIds:(0,m.Tw)([...i.boostStatistics.boosterIds||[],...r.boosterIds]),count:r.count,nextOffset:r.nextOffset,isLoadingBoosters:!1}},n),(0,a.R3)(e)))})),(0,a.iw)("applyBoost",(async(e,t,s)=>{const{chatId:n,slots:i,tabId:o=(0,u._w)()}=s,r=(0,b.Z1J)(e,n);if(!r)return;const c=(0,b.x67)(e,n),d=c?.boostsApplied||0,l=i.length;let h=(0,b.jUK)(e,o);const p=h.boostModal?.boostStatus;if(p){const t=p.nextLevelBoosts?p.nextLevelBoosts-p.currentLevelBoosts:1,s=p.boosts+l,n=p.nextLevelBoosts&&s>=p.nextLevelBoosts,i=n?p.nextLevelBoosts:p.currentLevelBoosts,r=n?p.nextLevelBoosts+t:p.nextLevelBoosts;e=(0,v.i)(e,{boostModal:{...h.boostModal,boostStatus:{...p,level:n?p.level+1:p.level,currentLevelBoosts:i,nextLevelBoosts:r,hasMyBoost:!0,boosts:s}}},o),(0,a.R3)(e)}e=(0,a.Rd)(),h=(0,b.jUK)(e,o);const g=h.boostModal?.myBoosts;if(g){const t=Math.floor(Date.now()/1e3),s=g.map((e=>i.includes(e.slot)?{...e,chatId:n,date:t,cooldownUntil:t+86400}:e));e=(0,v.i)(e,{boostModal:{...h.boostModal,myBoosts:s}},o),(0,a.R3)(e)}const I=await(0,f.t9)("applyBoost",{slots:i,chat:r});if(e=(0,a.Rd)(),I)h=(0,b.jUK)(e,o),e=(0,w.Sh)(e,(0,m.ee)(I.users,"id")),e=(0,w.fZ)(e,(0,m.ee)(I.chats,"id")),c&&(e=(0,w.US)(e,n,{boostsApplied:d+i.length})),h.boostModal&&(e=(0,v.i)(e,{boostModal:{...h.boostModal,myBoosts:I.boosts}},o)),(0,a.R3)(e);else{const t=(0,b.jUK)(e,o).boostModal;t&&(e=(0,v.i)(e,{boostModal:{...t,boostStatus:p,myBoosts:g}},o),(0,a.R3)(e))}})),(0,a.iw)("checkGiftCode",(async(e,t,s)=>{const{slug:n,message:i,tabId:o=(0,u._w)()}=s,r=await(0,f.t9)("checkGiftCode",{slug:n});r?(e=(0,a.Rd)(),e=(0,w.Sh)(e,(0,m.ee)(r.users,"id")),e=(0,w.fZ)(e,(0,m.ee)(r.chats,"id")),e=(0,v.i)(e,{giftCodeModal:{slug:n,info:r.code,message:i}},o),(0,a.R3)(e)):t.showNotification({message:h.Iu("lng_gift_link_expired"),tabId:o})})),(0,a.iw)("applyGiftCode",(async(e,t,s)=>{const{slug:a,tabId:n=(0,u._w)()}=s;await(0,f.t9)("applyGiftCode",{slug:a})&&(t.requestConfetti({tabId:n}),t.closeGiftCodeModal({tabId:n}))}));var xe=s(40647);let Ue=0;(0,a.iw)("loadAvailableReactions",(async e=>{const t=await(0,f.t9)("fetchAvailableReactions");t&&(t.forEach((e=>{e.aroundAnimation&&xe.he(`sticker${e.aroundAnimation.id}`,r.IU.BlobUrl),e.centerIcon&&xe.he(`sticker${e.centerIcon.id}`,r.IU.BlobUrl),e.appearAnimation&&xe.he(`sticker${e.appearAnimation.id}`,r.IU.BlobUrl),e.selectAnimation&&xe.he((0,I.ym)(e.selectAnimation),r.IU.BlobUrl)})),e=(0,a.Rd)(),e={...e,reactions:{...e.reactions,availableReactions:t}},(0,a.R3)(e),(0,Pe.Z)({action:"loadAvailableReactions",payload:void 0},n.dse))})),(0,a.iw)("interactWithAnimatedEmoji",((e,t,s)=>{const{emoji:a,x:n,y:i,startSize:o,isReversed:r,tabId:c=(0,u._w)()}=s,d={id:Ue++,animatedEffect:a,x:x(e,n)+40*Math.random()-20,y:i+40*Math.random()-20,startSize:o,isReversed:r};return(0,v.i)(e,{activeEmojiInteractions:[...(0,b.jUK)(e,c).activeEmojiInteractions||[],d]},c)})),(0,a.iw)("sendEmojiInteraction",((e,t,s)=>{const{messageId:a,chatId:n,emoji:i,interactions:o}=s;if("connectionStateReady"!==e.connectionState)return;const r=(0,b.Z1J)(e,n);r&&i&&!(0,b.FM1)(e,n)&&(0,f.t9)("sendEmojiInteraction",{chat:r,messageId:a,emoticon:i,timestamps:o})})),(0,a.iw)("sendDefaultReaction",((e,t,s)=>{const{chatId:a,messageId:n,tabId:i=(0,u._w)()}=s,o=(0,b.q6x)(e,a),r=(0,b.hjO)(e,a,n);o&&r&&!(0,I.CI)(r)&&t.toggleReaction({chatId:a,messageId:n,reaction:o,tabId:i})})),(0,a.iw)("toggleReaction",(async(e,t,s)=>{const{chatId:n,reaction:i,shouldAddToRecent:o,tabId:r=(0,u._w)()}=s;let{messageId:c}=s;const d=(0,b.Z1J)(e,n);let l=(0,b.hjO)(e,n,c);if(!d||!l)return;const m=(0,b.FM1)(e,n),h=Boolean(l.groupedId)&&!l.isInAlbum,g=h?(0,b.xHX)(e,n,l.groupedId)[0]:void 0;l=h&&(0,b.hjO)(e,n,g)||l,c=l?.id||c;const w=(0,I.UZ)(l),v=w.some((e=>(0,I.Hl)(e,i))),y=v?w.filter((e=>!(0,I.Hl)(e,i))):[...w,i],P=(0,b.oC7)(e),Z=y.slice(-P),S=(0,p.T)(l);(0,b.$Yd)(e,"reactionEffects")&&(v?t.stopActiveReaction({containerId:S,reaction:i,tabId:r}):t.startActiveReaction({containerId:S,reaction:i,tabId:r})),e=U(e,l,Z),(0,a.R3)(e);try{await(0,f.t9)("sendReaction",{chat:d,messageId:c,reactions:Z,shouldAddToRecent:o}),m&&t.loadSavedReactionTags()}catch(t){e=U(e=(0,a.Rd)(),l,w),(0,a.R3)(e)}})),(0,a.iw)("startActiveReaction",((e,t,s)=>{const{containerId:a,reaction:n,tabId:i=(0,u._w)()}=s,o=(0,b.jUK)(e,i);if(!(0,b.$Yd)(e,"reactionEffects"))return;const r=o.activeReactions[a]||[];if(r.some((e=>(0,I.Hl)(e,n))))return;const c=r.concat(n);return(0,v.i)(e,{activeReactions:{...o.activeReactions,[a]:c}},i)})),(0,a.iw)("stopActiveReaction",((e,t,s)=>{const{containerId:a,reaction:n,tabId:i=(0,u._w)()}=s,o=(0,b.jUK)(e,i),r=o.activeReactions[a]||[],c=n?r.filter((e=>!(0,I.Hl)(e,n))):[],d=c.length?{...o.activeReactions,[a]:c}:(0,m.CE)(o.activeReactions,[a]);return(0,v.i)(e,{activeReactions:d},i)})),(0,a.iw)("setDefaultReaction",(async(e,t,s)=>{const{reaction:n}=s;await(0,f.t9)("setDefaultReaction",{reaction:n})&&((e=(0,a.Rd)()).config?(e={...e,config:{...e.config,defaultReaction:n}},(0,a.R3)(e)):t.loadConfig())})),(0,a.iw)("stopActiveEmojiInteraction",((e,t,s)=>{const{id:a,tabId:n=(0,u._w)()}=s;return(0,v.i)(e,{activeEmojiInteractions:(0,b.jUK)(e,n).activeEmojiInteractions?.filter((e=>e.id!==a))},n)})),(0,a.iw)("loadReactors",(async(e,t,s)=>{const{chatId:n,messageId:i,reaction:o}=s,r=(0,b.Z1J)(e,n),c=(0,b.hjO)(e,n,i);if(!r||!c)return;const d=c.reactors?.nextOffset,l=await(0,f.t9)("fetchMessageReactionsList",{reaction:o,chat:r,messageId:i,offset:d});l&&(e=(0,a.Rd)(),e=(0,w.Sh)(e,(0,m.ee)(l.users,"id")),e=(0,w.fZ)(e,(0,m.ee)(l.chats,"id")),e=(0,w.cY)(e,n,i,{reactors:l}),(0,a.R3)(e))})),(0,a.iw)("loadMessageReactions",((e,t,s)=>{const{ids:a,chatId:n}=s,i=(0,b.Z1J)(e,n);i&&"connectionStateReady"===e.connectionState&&(0,f.t9)("fetchMessageReactions",{ids:a,chat:i})})),(0,a.iw)("sendWatchingEmojiInteraction",((e,t,s)=>{const{chatId:a,emoticon:n,x:i,y:o,startSize:r,isReversed:c,id:d,tabId:l=(0,u._w)()}=s,m=(0,b.Z1J)(e,a),h=(0,b.jUK)(e,l);if(m&&h.activeEmojiInteractions?.some((e=>e.id===d))&&!(0,b.FM1)(e,a))return"connectionStateReady"===e.connectionState&&(0,f.t9)("sendWatchingEmojiInteraction",{chat:m,emoticon:n}),(0,v.i)(e,{activeEmojiInteractions:h.activeEmojiInteractions.map((t=>t.id===d?{...t,x:x(e,i),y:o,startSize:r,isReversed:c}:t))},l)})),(0,a.iw)("fetchUnreadReactions",(async(e,t,s)=>{const{chatId:n,offsetId:i}=s,o=(0,b.Z1J)(e,n);if(!o)return;const r=await(0,f.t9)("fetchUnreadReactions",{chat:o,offsetId:i,addOffset:i?-1:void 0});if(!r||!r.messages.length)return e=L(e=(0,a.Rd)(),n,{unreadReactionsCount:0}),void(0,a.R3)(e);const{messages:c,chats:d,users:l}=r,u=(0,m.ee)(c,"id"),h=Object.keys(u).map(Number);e=(0,a.Rd)(),e=(0,w.c_)(e,o.id,u),e=(0,w.Sh)(e,(0,m.ee)(l,"id")),e=L(e=(0,w.fZ)(e,(0,m.ee)(d,"id")),n,{unreadReactions:[...o.unreadReactions||[],...h]}),(0,a.R3)(e)})),(0,a.iw)("animateUnreadReaction",((e,t,s)=>{const{messageIds:n,tabId:i=(0,u._w)()}=s,o=(0,b.jrE)(e,i);if(o){if(o.unreadReactionsCount){const s=o.unreadReactionsCount-n.length,i=(o.unreadReactions||[]).filter((e=>!n.includes(e)));e=L(e,o.id,{unreadReactions:i}),(0,a.R3)(e),!i.length&&s&&t.fetchUnreadReactions({chatId:o.id,offsetId:Math.min(...n)})}if(t.markMessagesRead({messageIds:n,tabId:i}),(0,b.$Yd)(e,"reactionEffects"))return e=(0,a.Rd)(),(0,v.i)(e,{activeReactions:{...(0,b.jUK)(e,i).activeReactions,...Object.fromEntries(n.map((t=>{const s=(0,b.hjO)(e,o.id,t);if(!s)return;const a=s.reactions?.recentReactions?.filter((({isUnread:e})=>e));if(!a)return;const n=a.map((e=>e.reaction));return[t,n.map((e=>({messageId:t,reaction:e})))]})).filter(Boolean))}},i)}})),(0,a.iw)("focusNextReaction",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{},n=(0,b.jrE)(e,a);n?.unreadReactions&&t.focusMessage({chatId:n.id,messageId:n.unreadReactions[0],tabId:a})})),(0,a.iw)("readAllReactions",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{},n=(0,b.jrE)(e,a);if(n)return(0,f.t9)("readAllReactions",{chat:n}),L(e,n.id,{unreadReactionsCount:void 0,unreadReactions:void 0})})),(0,a.iw)("loadTopReactions",(async e=>{const t=await(0,f.t9)("fetchTopReactions",{hash:e.reactions.hash.topReactions});t&&(e=(0,a.Rd)(),e={...e,reactions:{...e.reactions,topReactions:t.reactions,hash:{...e.reactions.hash,topReactions:t.hash}}},(0,a.R3)(e))})),(0,a.iw)("loadRecentReactions",(async e=>{const t=await(0,f.t9)("fetchRecentReactions",{hash:e.reactions.hash.recentReactions});t&&(e=(0,a.Rd)(),e={...e,reactions:{...e.reactions,recentReactions:t.reactions,hash:{...e.reactions.hash,recentReactions:t.hash}}},(0,a.R3)(e))})),(0,a.iw)("clearRecentReactions",(async e=>{await(0,f.t9)("clearRecentReactions")&&(e=(0,a.Rd)(),e={...e,reactions:{...e.reactions,recentReactions:[]}},(0,a.R3)(e))})),(0,a.iw)("loadDefaultTagReactions",(async e=>{const t=await(0,f.t9)("fetchDefaultTagReactions",{hash:e.reactions.hash.defaultTags});t&&(e=(0,a.Rd)(),e={...e,reactions:{...e.reactions,defaultTags:t.reactions,hash:{...e.reactions.hash,defaultTags:t.hash}}},(0,a.R3)(e))})),(0,a.iw)("loadSavedReactionTags",(async e=>{const{hash:t}=e.savedReactionTags||{},s=await(0,f.t9)("fetchSavedReactionTags",{hash:t});if(!s)return;e=(0,a.Rd)();const n=(0,m.RS)(s.tags,(e=>[(0,I.jq)(e.reaction),e]));e={...e,savedReactionTags:{hash:s.hash,byKey:n}},(0,a.R3)(e)})),(0,a.iw)("editSavedReactionTag",(async(e,t,s)=>{const{reaction:n,title:i}=s;if(!await(0,f.t9)("updateSavedReactionTag",{reaction:n,title:i}))return;e=(0,a.Rd)();const o=e.savedReactionTags?.byKey;if(!o)return;const r=(0,I.jq)(n),c={...o[r],title:i};e={...e,savedReactionTags:{...e.savedReactionTags,byKey:{...o,[r]:c}}},(0,a.R3)(e)})),(0,a.iw)("loadStatistics",(async(e,t,s)=>{const{chatId:n,isGroup:i,tabId:o=(0,u._w)()}=s,r=(0,b.Z1J)(e,n),c=(0,b.x67)(e,n);if(!r||!c)return;const d=await(0,f.t9)(i?"fetchGroupStatistics":"fetchChannelStatistics",{chat:r,dcId:c.statisticsDcId});if(!d)return;e=(0,a.Rd)();const{stats:l,users:h}=d;e=(0,w.Sh)(e,(0,m.ee)(h,"id")),e=(0,w.ze)(e,n,l,o),(0,a.R3)(e)})),(0,a.iw)("loadMessageStatistics",(async(e,t,s)=>{const{chatId:n,messageId:i,tabId:o=(0,u._w)()}=s,r=(0,b.Z1J)(e,n),c=(0,b.x67)(e,n);if(!r||!c)return;const d=c.statisticsDcId;let l=await(0,f.t9)("fetchMessageStatistics",{chat:r,messageId:i,dcId:d});l||(l={}),e=(0,a.Rd)();const{viewsCount:m,forwardsCount:h,reactions:p}=(0,b.Zwk)(e,n)[i]||{};l.viewsCount=m,l.forwardsCount=h,l.reactionsCount=p?.results?p?.results.reduce(((e,t)=>e+t.count),0):void 0,e=(0,w.kM)(e,l,o),(0,a.R3)(e),t.loadMessagePublicForwards({chatId:n,messageId:i,tabId:o})})),(0,a.iw)("loadMessagePublicForwards",(async(e,t,s)=>{const{chatId:n,messageId:i,tabId:o=(0,u._w)()}=s,r=(0,b.Z1J)(e,n),c=(0,b.x67)(e,n);if(!r||!c)return;const d=c.statisticsDcId,l=(0,b.jUK)(e,o).statistics.currentMessage||{};if(l?.publicForwards&&!l.nextOffset)return;const m=await(0,f.t9)("fetchMessagePublicForwards",{chat:r,messageId:i,dcId:d,offset:l.nextOffset}),{forwards:h,nextOffset:p,count:g}=m||{},I=l.publicForwardsData?.length&&h?.length&&(0,y.A)(l.publicForwardsData[l.publicForwardsData.length-1],h[0]);e=(0,a.Rd)(),e=(0,w.kM)(e,{...l,publicForwards:g||h?.length,publicForwardsData:(l.publicForwardsData||[]).concat(I?h.slice(1):h||[]),nextOffset:p},o),(0,a.R3)(e)})),(0,a.iw)("loadStatisticsAsyncGraph",(async(e,t,s)=>{const{chatId:n,token:i,name:o,isPercentage:r,tabId:c=(0,u._w)()}=s,d=(0,b.x67)(e,n);if(!d)return;const l=d.statisticsDcId,m=await(0,f.t9)("fetchStatisticsAsyncGraph",{token:i,dcId:l,isPercentage:r});m&&(e=(0,a.Rd)(),e=(0,w.yC)(e,n,o,m,c),(0,a.R3)(e))})),(0,a.iw)("loadStoryStatistics",(async(e,t,s)=>{const{chatId:n,storyId:i,tabId:o=(0,u._w)()}=s,r=(0,b.Z1J)(e,n),c=(0,b.x67)(e,n);if(!r||!c)return;const d=c.statisticsDcId;let l=await(0,f.t9)("fetchStoryStatistics",{chat:r,storyId:i,dcId:d});l||(l={}),e=(0,a.Rd)();const m=(0,b.JrV)(e,n,i),{forwardsCount:h=0,viewsCount:p=0,reactionsCount:g=0}=m&&"views"in m&&m.views?m.views:{};l.viewsCount=p,l.forwardsCount=h,l.reactionsCount=g,e=(0,a.Rd)(),e=(0,w.sG)(e,l,o),(0,a.R3)(e),t.loadStoryPublicForwards({chatId:n,storyId:i,tabId:o})})),(0,a.iw)("loadStoryPublicForwards",(async(e,t,s)=>{const{chatId:n,storyId:i,tabId:o=(0,u._w)()}=s,r=(0,b.Z1J)(e,n),c=(0,b.x67)(e,n);if(!r||!c)return;const d=c.statisticsDcId,l=(0,b.jUK)(e,o).statistics.currentStory||{};if(l?.publicForwards&&!l.nextOffset)return;const{publicForwards:h,users:p,chats:g,count:I,nextOffset:v}=await(0,f.t9)("fetchStoryPublicForwards",{chat:r,storyId:i,dcId:d,offset:l.nextOffset})||{};e=(0,a.Rd)(),g&&(e=(0,w.fZ)(e,(0,m.ee)(g,"id"))),p&&(e=(0,w.Sh)(e,(0,m.ee)(p,"id"))),e=(0,w.sG)(e,{...l,publicForwards:I||h?.length,publicForwardsData:(l.publicForwardsData||[]).concat(h||[]),nextOffset:v},o),(0,a.R3)(e)})),(0,a.iw)("loadAllStories",(async e=>{let t=0;for(;e.stories.hasNext;){if(t++>=100)return void(n.eMD&&console.error("`actions/loadAllStories`: Infinite loop detected"));e=(0,a.Rd)();const{stateHash:s,hasNext:i}=e.stories;if(s&&!i)return;const o=await(0,f.t9)("fetchAllStories",{isFirstRequest:!s,stateHash:s});if(!o)return;(e=(0,a.Rd)()).stories.stateHash=o.state,"peerStories"in o&&(e=(0,w.Sh)(e,(0,m.ee)(o.users,"id")),e=(0,w.fZ)(e,(0,m.ee)(o.chats,"id")),e=(0,w.p1)(e,o.peerStories),e=(0,w.Fz)(e,o.peerStories),(e=(0,w.Uq)(e,o.stealthMode)).stories.hasNext=o.hasMore),(0,a.R3)(e)}})),(0,a.iw)("loadAllHiddenStories",(async e=>{let t=0;for(;e.stories.hasNextInArchive;){if(t++>=100)return void(n.eMD&&console.error("`actions/loadAllHiddenStories`: Infinite loop detected"));e=(0,a.Rd)();const{archiveStateHash:s,hasNextInArchive:i}=e.stories;if(s&&!i)return;const o=await(0,f.t9)("fetchAllStories",{isFirstRequest:!s,stateHash:s,isHidden:!0});if(!o)return;(e=(0,a.Rd)()).stories.archiveStateHash=o.state,"peerStories"in o&&(e=(0,w.Sh)(e,(0,m.ee)(o.users,"id")),e=(0,w.fZ)(e,(0,m.ee)(o.chats,"id")),e=(0,w.p1)(e,o.peerStories),e=(0,w.Fz)(e,o.peerStories),(e=(0,w.Uq)(e,o.stealthMode)).stories.hasNextInArchive=o.hasMore),(0,a.R3)(e)}})),(0,a.iw)("loadPeerSkippedStories",(async(e,t,s)=>{const{peerId:n}=s,i=(0,b.RGZ)(e,n),o=(0,b.nST)(e,n);if(!i||!o)return;const r=Object.values(o.byId).reduce(((e,t)=>("content"in t||e.push(t.id),e)),[]);if(0===r.length)return;const c=await(0,f.t9)("fetchPeerStoriesByIds",{peer:i,ids:r});c&&(e=(0,a.Rd)(),e=(0,w.Sh)(e,(0,m.ee)(c.users,"id")),e=(0,w.fZ)(e,(0,m.ee)(c.chats,"id")),e=(0,w._6)(e,n,c.stories),(0,a.R3)(e))})),(0,a.iw)("viewStory",(async(e,t,s)=>{const{peerId:n,storyId:i,tabId:o=(0,u._w)()}=s,r=(0,b.RGZ)(e,n),c=(0,b.JrV)(e,n,i);if(!r||!c||!("content"in c))return;e=(0,w.WW)(e,n,i,o),(0,a.R3)(e);const d=(0,we.bp)();c.expireDate<d&&c.isPinned&&(0,f.t9)("viewStory",{peer:r,storyId:i}),(e.stories.byPeerId[n].lastReadId||0)<c.id&&await(0,f.t9)("markStoryRead",{peer:r,storyId:i})&&(e=(0,a.Rd)(),e=(0,w.P5)(e,n,i),(0,a.R3)(e))})),(0,a.iw)("deleteStory",(async(e,t,s)=>{const{peerId:n,storyId:i}=s,o=(0,b.RGZ)(e,n);o&&await(0,f.t9)("deleteStory",{peer:o,storyId:i})&&(e=(0,a.Rd)(),e=(0,w.se)(e,n,i),(0,a.R3)(e))})),(0,a.iw)("toggleStoryPinned",(async(e,t,s)=>{const{peerId:n,storyId:i,isPinned:o}=s,r=(0,b.RGZ)(e,n);if(!r)return;const c=(0,b.JrV)(e,n,i),d=c&&"content"in c?c.isPinned:void 0;e=(0,w.w2)(e,n,i,{isPinned:o}),e=(0,w.vI)(e,n,i,o),(0,a.R3)(e),await(0,f.t9)("toggleStoryPinned",{peer:r,storyId:i,isPinned:o})||(e=(0,a.Rd)(),e=(0,w.w2)(e,n,i,{isPinned:d}),e=(0,w.vI)(e,n,i,d),(0,a.R3)(e))})),(0,a.iw)("loadPeerStories",(async(e,t,s)=>{const{peerId:n}=s,i=(0,b.RGZ)(e,n);if(!i)return;const o=await(0,f.t9)("fetchPeerStories",{peer:i});o&&(e=(0,a.Rd)(),e=(0,w.Sh)(e,(0,m.ee)(o.users,"id")),e=(0,w.fZ)(e,(0,m.ee)(o.chats,"id")),e=(0,w._6)(e,n,o.stories),o.lastReadStoryId&&(e=(0,w.P5)(e,n,o.lastReadStoryId)),(0,a.R3)(e))})),(0,a.iw)("loadPeerPinnedStories",(async(e,t,s)=>{const{peerId:n,offsetId:i}=s,o=(0,b.RGZ)(e,n);if(!o)return;const r=await(0,f.t9)("fetchPeerPinnedStories",{peer:o,offsetId:i});r&&(e=(0,a.Rd)(),e=(0,w.Sh)(e,(0,m.ee)(r.users,"id")),e=(0,w.fZ)(e,(0,m.ee)(r.chats,"id")),e=(0,w._6)(e,n,r.stories),(0,a.R3)(e))})),(0,a.iw)("loadStoriesArchive",(async(e,t,s)=>{const{peerId:n,offsetId:i}=s,o=(0,b.RGZ)(e,n);if(!o)return;const r=await(0,f.t9)("fetchStoriesArchive",{peer:o,offsetId:i});r&&(e=(0,a.Rd)(),e=(0,w.Sh)(e,(0,m.ee)(r.users,"id")),e=(0,w.fZ)(e,(0,m.ee)(r.chats,"id")),e=(0,w._6)(e,n,r.stories,!0),(0,a.R3)(e))})),(0,a.iw)("loadPeerStoriesByIds",(async(e,t,s)=>{const{peerId:n,storyIds:i}=s,o=(0,b.RGZ)(e,n);if(!o)return;const r=await(0,f.t9)("fetchPeerStoriesByIds",{peer:o,ids:i});r&&(e=(0,a.Rd)(),e=(0,w.Sh)(e,(0,m.ee)(r.users,"id")),e=(0,w.fZ)(e,(0,m.ee)(r.chats,"id")),e=(0,w._6)(e,n,r.stories),(0,a.R3)(e))})),(0,a.iw)("loadStoryViews",(async(e,t,s)=>{const{peerId:n,storyId:i}=s,o=(0,b.RGZ)(e,n);if(!o)return;const r=await(0,f.t9)("fetchStoriesViews",{peer:o,storyIds:[i]});r&&(e=(0,a.Rd)(),e=(0,w.Sh)(e,(0,m.ee)(r.users,"id")),e=(0,w.Qn)(e,n,i,r.views),(0,a.R3)(e))})),(0,a.iw)("loadStoryViewList",(async(e,t,s)=>{const{peerId:n,storyId:i,offset:o,areReactionsFirst:r,areJustContacts:c,query:d,limit:l,tabId:h=(0,u._w)()}=s,p=(0,b.RGZ)(e,n);if(!p)return;e=(0,w.uS)(e,!0,h),(0,a.R3)(e);const g=await(0,f.t9)("fetchStoryViewList",{peer:p,storyId:i,offset:o,areReactionsFirst:r,areJustContacts:c,limit:l,query:d});if(!g)return e=(0,a.Rd)(),e=(0,w.uS)(e,!1,h),void(0,a.R3)(e);e=(0,a.Rd)(),e=(0,w.Sh)(e,(0,m.ee)(g.users,"id")),e=(0,w.fZ)(e,(0,m.ee)(g.chats,"id")),e=(0,w.eB)(e,i,g.views,g.nextOffset,h),(0,a.R3)(e)})),(0,a.iw)("reportStory",(async(e,t,s)=>{const{peerId:a,storyId:n,reason:i,description:o,tabId:r=(0,u._w)()}=s,c=(0,b.RGZ)(e,a);if(!c)return;const d=await(0,f.t9)("reportStory",{peer:c,storyId:n,reason:i,description:o});t.showNotification({message:d?(0,h.Iu)("ReportPeer.AlertSuccess"):"An error occurred while submitting your report. Please, try again later.",tabId:r})})),(0,a.iw)("editStoryPrivacy",((e,t,s)=>{const{peerId:a,storyId:n,privacy:i}=s,o=(0,b.RGZ)(e,a);if(!o)return;const r=[...i.allowUserIds,...i.allowChatIds],c=[...i.blockUserIds,...i.blockChatIds],d=(0,I.wA)(e,{visibility:i.visibility,isUnspecified:i.isUnspecified,allowedIds:r,blockedIds:c});(0,f.t9)("editStoryPrivacy",{peer:o,id:n,privacy:d})})),(0,a.iw)("toggleStoriesHidden",(async(e,t,s)=>{const{peerId:n,isHidden:i}=s,o=(0,b.RGZ)(e,n);o&&await(0,f.t9)("toggleStoriesHidden",{peer:o,isHidden:i})&&(e=(0,a.Rd)(),e=(0,w.QO)(e,n,i),(0,a.R3)(e))})),(0,a.iw)("loadStoriesMaxIds",(async(e,t,s)=>{const{peerIds:n}=s,i=n.map((t=>(0,b.RGZ)(e,t))).filter(Boolean);if(!i.length)return;const o=await(0,f.t9)("fetchStoriesMaxIds",{peers:i});if(!o)return;const r=[];e=(0,a.Rd)(),o.forEach(((t,s)=>{const a=i[s];e=(0,w.GG)(e,a.id,{maxStoryId:t,hasStories:0!==t}),0!==t&&r.push(a.id)})),(0,a.R3)(e),r?.forEach((e=>t.loadPeerStories({peerId:e})))})),(0,a.iw)("sendStoryReaction",(async(e,t,s)=>{const{peerId:n,storyId:i,containerId:o,reaction:r,shouldAddToRecent:c,tabId:d=(0,u._w)()}=s,l=(0,b.RGZ)(e,n);if(!l)return;const m=(0,b.JrV)(e,n,i);if(!m||!("content"in m))return;const h=m.sentReaction;e=(0,w.ed)(e,n,i,r),(0,a.R3)(e),r?t.startActiveReaction({containerId:o,reaction:r,tabId:d}):t.stopActiveReaction({containerId:o,tabId:d});const p=await(0,f.t9)("sendStoryReaction",{peer:l,storyId:i,reaction:r,shouldAddToRecent:c});e=(0,a.Rd)(),p||(e=(0,w.ed)(e,n,i,h)),(0,a.R3)(e)})),(0,a.iw)("activateStealthMode",((e,t,s)=>{const{isForPast:a=!0,isForFuture:n=!0}=s||{};(0,f.t9)("activateStealthMode",{isForPast:a||!0,isForFuture:n||!0})})),s(89005);var Le=s(15780),Oe=s(70735);function _e(e,...[t=(0,u._w)()]){const{chatId:s,threadId:a}=(0,b.Btg)(e,t)||{};return s&&a?(e=(0,w.S3)(e,s,a,void 0,t),e=(0,w.qr)(e,s,a,void 0,t),e=(0,w.Pb)(e,s,a,void 0,void 0,void 0,t)):e}(0,a.iw)("openLocalTextSearch",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{},{chatId:n,threadId:i}=(0,b.Btg)(e,a)||{};if(n&&i)return(0,w.qr)(e,n,i,"",a)})),(0,a.iw)("closeLocalTextSearch",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{};return _e(e,a)})),(0,a.iw)("setLocalTextSearchQuery",((e,t,s)=>{const{query:a,tabId:n=(0,u._w)()}=s,{chatId:i,threadId:o}=(0,b.Btg)(e,n)||{};if(!i||!o)return;const r=(0,I.uw)(i,o),{query:c}=(0,b.jUK)(e,n).localTextSearch.byChatThreadKey[r]||{};return a!==c&&(e=(0,w.Pb)(e,i,o,Oe.D,void 0,void 0,n)),(0,w.qr)(e,i,o,a,n)})),(0,a.iw)("setLocalTextSearchTag",((e,t,s)=>{const{tag:a,tabId:n=(0,u._w)()}=s,{chatId:i,threadId:o}=(0,b.Btg)(e,n)||{};if(!i||!o)return;const r=(0,I.uw)(i,o),{savedTag:c}=(0,b.jUK)(e,n).localTextSearch.byChatThreadKey[r]||{};return(0,I.Hl)(a,c)||(e=(0,w.Pb)(e,i,o,Oe.D,void 0,void 0,n)),(0,w.S3)(e,i,o,a,n)})),(0,a.iw)("setLocalMediaSearchType",((e,t,s)=>{const{mediaType:a,tabId:n=(0,u._w)()}=s,{chatId:i,threadId:o}=(0,b.Btg)(e,n)||{};if(i&&o)return(0,w.z5)(e,i,o,a,n)})),(0,a.iw)("processOpenChatOrThread",((e,t,s)=>{const{chatId:a,threadId:n=r._f,type:i="thread",shouldReplaceHistory:o=!1,shouldReplaceLast:c=!1,noForumTopicPanel:d,tabId:l=(0,u._w)()}=s,m=(0,b.Btg)(e,l),h=(0,b.jUK)(e,l);if(h.premiumModal?.promo&&h.premiumModal?.isOpen&&(e=(0,v.i)(e,{premiumModal:{...h.premiumModal,isOpen:!1}},l)),m&&m.chatId===a&&m.threadId===n&&m.type===i||(a&&(e=(0,w.O8)(e,a,n,"replyStack",[],l),e=(0,v.i)(e,{activeReactions:{}},l)),e=_e(e=(0,w.i9)(e,l),l),e=(0,v.i)(e,{isStatisticsShown:!1,boostStatistics:void 0,contentToBeScheduled:void 0,...a!==(0,b.jUK)(e,l).forwardMessages.toChatId&&{forwardMessages:{}}},l)),a){const s=(0,b.Z1J)(e,a);s?.isForum&&!d?t.openForumPanel({chatId:a,tabId:l}):a!==(0,b.jUK)(e,l).forumPanelChatId&&t.closeForumPanel({tabId:l})}return t.updatePageTitle({tabId:l}),(0,w.Wy)(e,a,n,i,o,c,l)})),(0,a.iw)("openChatInNewTab",((e,t,s)=>{const{chatId:a,threadId:n=r._f}=s,o=(0,Le.Ex)(a,"thread",n);i.D$?window.electron.openNewWindow(o):window.open(o,"_blank")})),(0,a.iw)("openPreviousChat",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{};return t.updatePageTitle({tabId:a}),(0,w.Wy)(e,void 0,void 0,void 0,void 0,void 0,a)})),(0,a.iw)("openChatWithInfo",((e,t,s)=>{const{profileTab:n,forceScrollProfileTab:i=!1,tabId:o=(0,u._w)()}=s;e=(0,v.i)(e,{...(0,b.jUK)(e,o),isChatInfoShown:!0,nextProfileTab:n,forceScrollProfileTab:i},o),e={...e,lastIsChatInfoShown:!0},(0,a.R3)(e),t.openChat({...s,tabId:o})})),(0,a.iw)("openThreadWithInfo",((e,t,s)=>{const{tabId:n=(0,u._w)()}=s;e=(0,v.i)(e,{...(0,b.jUK)(e,n),isChatInfoShown:!0},n),e={...e,lastIsChatInfoShown:!0},(0,a.R3)(e),t.openThread({...s,tabId:n})})),(0,a.iw)("openChatWithDraft",((e,t,s)=>{const{chatId:a,text:n,threadId:i=r._f,files:o,filter:c,tabId:d=(0,u._w)()}=s;return a&&t.openThread({chatId:a,threadId:i,tabId:d}),(0,v.i)(e,{requestedDraft:{chatId:a,text:n,files:o,filter:c}},d)})),(0,a.iw)("resetChatCreation",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{};return(0,v.i)(e,{chatCreation:void 0},a)})),(0,a.iw)("setNewChatMembersDialogState",((e,t,s)=>{const{newChatMembersProgress:a,tabId:n=(0,u._w)()}=s;return(0,v.i)(e,{newChatMembersProgress:a},n)})),(0,a.iw)("openNextChat",((e,t,s)=>{const{targetIndexDelta:a,orderedIds:n,tabId:i=(0,u._w)()}=s,{chatId:o}=(0,b.Btg)(e,i)||{};if(!o)return void t.openChat({id:n[0],tabId:i});const r=n.indexOf(o);if(-1===r)return;const c=n[r+a];t.openChat({id:c,shouldReplaceHistory:!0,tabId:i})})),(0,a.iw)("closeDeleteChatFolderModal",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{};return(0,v.i)(e,{deleteFolderDialogModal:void 0},a)})),(0,a.iw)("closeChatlistModal",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{};return(0,v.i)(e,{chatlistModal:void 0},a)})),(0,a.iw)("requestChatTranslation",((e,t,s)=>{const{chatId:a,toLanguageCode:n,tabId:i=(0,u._w)()}=s;return(0,w.LV)(e,a,n,i)}));var Fe=s(64319),De=s(89455),je=s(996),qe=s(42986);const Ge=n.ckE+n.fK3;let He;function Ve(e,t,s){const{type:a,threadId:n}=(0,b.Btg)(e)||{},i=h.Iu,o=(0,b.Z1J)(e,t),r="scheduled"===a?(0,b.yBV)(e,t):(0,b.Zwk)(e,t);if(!o||!r||!n)return;const c=s.map((e=>r[e])).filter((t=>(0,b._kf)(e,t,n).canCopy)).sort(((e,t)=>e.id-t.id)),d=[],l=[];c.forEach((t=>{const s=(0,I.eA)(o)?o:(0,b.Urc)(e,t),a=`> ${s?(0,I.OU)(i,s):t.forwardInfo?.hiddenUserName||""}:`;d.push(a),d.push(`${function(e,t){const s=(0,qe.Eb)(t),a=s?`${s} `:"",n=(0,je.X)({message:t,shouldRenderAsHtml:!0})?.join("");return`${a}${(0,qe.Kk)(e,t,n,!0)}`}(i,t)}\n`),l.push(a),l.push(`${(0,I.MK)(i,t,!1,0,!0)}\n`)})),(0,Fe.qN)(d.join("\n"),l.join("\n"))}(0,a.iw)("setScrollOffset",((e,t,s)=>{const{chatId:a,threadId:n,scrollOffset:i,tabId:o=(0,u._w)()}=s;return e=(0,w.pf)(e,a,n,"lastScrollOffset",i),(0,w.O8)(e,a,n,"scrollOffset",i,o)})),(0,a.iw)("setEditingId",((e,t,s)=>{const{messageId:a,tabId:n=(0,u._w)()}=s,i=(0,b.Btg)(e,n);if(!i)return;const{chatId:o,threadId:r,type:c}=i,d="scheduled"===c?"editingScheduledId":"editingId";return(0,w.pf)(e,o,r,d,a)})),(0,a.iw)("setEditingDraft",((e,t,s)=>{const{text:a,chatId:n,threadId:i,type:o}=s,r="scheduled"===o?"editingScheduledDraft":"editingDraft";return(0,w.pf)(e,n,i,r,a)})),(0,a.iw)("editLastMessage",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{},{chatId:n,threadId:i}=(0,b.Btg)(e,a)||{};if(!n||!i)return;const o=(0,b.Zwk)(e,n),r=(0,b.Cbz)(e,n,i,a);if(!o||!r)return;const c=(0,m.dF)(r,(t=>Boolean(o[t]&&(0,b._kf)(e,o[t],i).canEdit)));return c?(0,w.pf)(e,n,i,"editingId",c):void 0})),(0,a.iw)("replyToNextMessage",((e,t,s)=>{const{targetIndexDelta:a,tabId:n=(0,u._w)()}=s,{chatId:i,threadId:o}=(0,b.Btg)(e,n)||{};if(!i||!o)return;const c=(0,b.Zwk)(e,i),d=(0,b.Cbz)(e,i,o,n);if(!c||!d)return;const l=(0,b.Mst)(e,i,o)?.replyInfo;let m;if((0,b.b9T)(e,i,o,n)&&l?.replyToMsgId){const e=Object.keys(c),t=e.indexOf(l.replyToMsgId.toString())+a;m=t<=e.length+1&&t>=0?Number(e[t]):void 0}else if(o===r._f)m=(0,b.xMv)(e,i);else{const t=(0,b.tZg)(e,i,o);m=t?.lastMessageId}t.updateDraftReplyInfo({replyToMsgId:m,tabId:n}),t.focusMessage({chatId:i,threadId:o,messageId:m,tabId:n})})),(0,a.iw)("openAudioPlayer",((e,t,s)=>{const{chatId:a,threadId:n,messageId:i,origin:o,volume:r,playbackRate:c,isMuted:d,tabId:l=(0,u._w)()}=s,m=(0,b.jUK)(e,l);return(0,v.i)(e,{audioPlayer:{chatId:a,threadId:n,messageId:i,origin:o??m.audioPlayer.origin,volume:r??m.audioPlayer.volume,playbackRate:c||m.audioPlayer.playbackRate||e.audioPlayer.lastPlaybackRate,isPlaybackRateActive:void 0===m.audioPlayer.isPlaybackRateActive?e.audioPlayer.isLastPlaybackRateActive:m.audioPlayer.isPlaybackRateActive,isMuted:d||m.audioPlayer.isMuted}},l)})),(0,a.iw)("setAudioPlayerVolume",((e,t,s)=>{const{volume:a,tabId:n=(0,u._w)()}=s;return(0,v.i)(e,{audioPlayer:{...(0,b.jUK)(e,n).audioPlayer,volume:a,isMuted:!1}},n)})),(0,a.iw)("setAudioPlayerPlaybackRate",((e,t,s)=>{const{playbackRate:a,isPlaybackRateActive:n,tabId:i=(0,u._w)()}=s;return e={...e,audioPlayer:{...e.audioPlayer,lastPlaybackRate:a,isLastPlaybackRateActive:n}},(0,v.i)(e,{audioPlayer:{...(0,b.jUK)(e,i).audioPlayer,playbackRate:a,isPlaybackRateActive:n}},i)})),(0,a.iw)("setAudioPlayerMuted",((e,t,s)=>{const{isMuted:a,tabId:n=(0,u._w)()}=s;return(0,v.i)(e,{audioPlayer:{...(0,b.jUK)(e,n).audioPlayer,isMuted:a}},n)})),(0,a.iw)("setAudioPlayerOrigin",((e,t,s)=>{const{origin:a,tabId:n=(0,u._w)()}=s;return(0,v.i)(e,{audioPlayer:{...(0,b.jUK)(e,n).audioPlayer,origin:a}},n)})),(0,a.iw)("closeAudioPlayer",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{},n=(0,b.jUK)(e,a);return(0,v.i)(e,{audioPlayer:{volume:n.audioPlayer.volume,playbackRate:n.audioPlayer.playbackRate,isPlaybackRateActive:n.audioPlayer.isPlaybackRateActive,isMuted:n.audioPlayer.isMuted}},a)})),(0,a.iw)("openPollResults",((e,t,s)=>{const{chatId:n,messageId:i,tabId:o=(0,u._w)()}=s,r=(0,b.Jf5)(e,(0,B.W7)(),o),c=(0,b.jUK)(e,o);if(r){if(n!==c.pollResults.chatId||i!==c.pollResults.messageId)return(0,v.i)(e,{pollResults:{chatId:n,messageId:i,voters:{}}},o)}else window.setTimeout((()=>{e=(0,a.Rd)(),e=(0,v.i)(e,{pollResults:{chatId:n,messageId:i,voters:{}}},o),(0,a.R3)(e)}),450)})),(0,a.iw)("closePollResults",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{};return(0,v.i)(e,{pollResults:{}},a)})),(0,a.iw)("focusLastMessage",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{},n=(0,b.Btg)(e,a);if(!n)return;const{chatId:i,threadId:o,type:c}=n,d=(0,I._o)(i,o,e.currentUserId);let l;if(o===r._f)if("pinned"===c){const t=(0,b.KBA)(e,i,r._f);if(!t?.length)return;l=t[t.length-1]}else{l=(0,b.xMv)(e,i);const t=(0,b.Zwk)(e,i),s=Object.values(t).reverse()[0];l&&(0,I.Pt)(s)&&s.id>l&&(l=s.id)}else if(d)l=(0,b.xMv)(e,String(o),"saved");else{const t=(0,b.tZg)(e,i,o);l=t?.lastMessageId}l&&t.focusMessage({chatId:i,threadId:o,messageListType:c,messageId:l,noHighlight:!0,noForumTopicPanel:!0,tabId:a})})),(0,a.iw)("focusNextReply",((e,t,s)=>{const{tabId:n=(0,u._w)()}=s||{},i=(0,b.Btg)(e,n);if(!i)return;const{chatId:o,threadId:r}=i,c=(0,b.p9o)(e,o,r,n);if(c&&0!==c.length){const s=c.pop();e=(0,w.O8)(e,o,r,"replyStack",[...c],n),(0,a.R3)(e),t.focusMessage({chatId:o,threadId:r,messageId:s,tabId:n,noForumTopicPanel:!0})}else t.focusLastMessage({tabId:n})})),(0,a.iw)("focusMessage",((e,t,s)=>{const{chatId:n,threadId:i=r._f,messageListType:o="thread",noHighlight:d,groupedId:l,groupedChatId:h,replyMessageId:p,isResizingContainer:g,shouldReplaceHistory:f,noForumTopicPanel:I,quote:v,tabId:y=(0,u._w)()}=s;let{messageId:P}=s;if(void 0!==l){const t=(0,b.y84)(e,h,l);t?.length&&([P]=(0,m.oA)(t))}const Z=(0,b.Btg)(e,y),S=!Z||n!==Z.chatId||i!==Z.threadId||o!==Z.type;if(He&&(clearTimeout(He),He=void 0),He=window.setTimeout((()=>{e=(0,a.Rd)(),e=(0,w.cq)({global:e},y),e=(0,w.wV)(e,void 0,y),(0,a.R3)(e)}),d?Ge:1500),e=(0,w.cq)({global:e,chatId:n,messageId:P,threadId:i,noHighlight:d,isResizingContainer:g,quote:v},y),e=(0,w.wV)(e,void 0,y),p){const t=(0,b.p9o)(e,n,i,y)||[];e=(0,w.O8)(e,n,i,"replyStack",[...t,p],y)}S&&(e=(0,w.wV)(e,c.fo.Static,y));const C=(0,b.Cbz)(e,n,i,y);if(C&&C.includes(P))return(0,a.R3)(e,{forceOnHeavyAnimation:!0}),void t.openThread({chatId:n,threadId:i,type:o,shouldReplaceHistory:f,noForumTopicPanel:I,tabId:y});if(S&&(e=(0,w.O8)(e,n,i,"viewportIds",void 0,y)),C&&!S){const t=P>C[0]?c.fo.Down:c.fo.Up;e=(0,w.wV)(e,t,y)}(0,a.R3)(e,{forceOnHeavyAnimation:!0}),t.openThread({chatId:n,threadId:i,type:o,shouldReplaceHistory:f,noForumTopicPanel:I,tabId:y}),t.loadViewportMessages({chatId:n,threadId:i,tabId:y,shouldForceRender:!0})})),(0,a.iw)("openForwardMenu",((e,t,s)=>{const{fromChatId:a,messageIds:n,storyId:i,groupedId:o,withMyScore:r,tabId:c=(0,u._w)()}=s;let d;return o&&(d=(0,b.xHX)(e,a,o)),(0,v.i)(e,{forwardMessages:{fromChatId:a,messageIds:d||n,storyId:i,isModalShown:!0,withMyScore:r}},c)})),(0,a.iw)("changeForwardRecipient",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{};return(0,v.i)(e,{forwardMessages:{...(0,b.jUK)(e,a).forwardMessages,toChatId:void 0,isModalShown:!0,noAuthors:!1,noCaptions:!1}},a)})),(0,a.iw)("setForwardNoAuthors",((e,t,s)=>{const{noAuthors:a,tabId:n=(0,u._w)()}=s,i=(0,b.jUK)(e,n);return(0,v.i)(e,{forwardMessages:{...i.forwardMessages,noAuthors:a,noCaptions:a&&i.forwardMessages.noCaptions}},n)})),(0,a.iw)("setForwardNoCaptions",((e,t,s)=>{const{noCaptions:a,tabId:n=(0,u._w)()}=s;return(0,v.i)(e,{forwardMessages:{...(0,b.jUK)(e,n).forwardMessages,noCaptions:a,noAuthors:a}},n)})),(0,a.iw)("exitForwardMode",((e,t,s)=>{const{tabId:n=(0,u._w)()}=s||{};e=(0,v.i)(e,{forwardMessages:{}},n),(0,a.R3)(e)})),(0,a.iw)("openForwardMenuForSelectedMessages",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{},n=(0,b.jUK)(e,a);if(!n.selectedMessages)return;const{chatId:i,messageIds:o}=n.selectedMessages;t.openForwardMenu({fromChatId:i,messageIds:o,tabId:a})})),(0,a.iw)("cancelMessageMediaDownload",((e,t,s)=>{const{message:a,tabId:n=(0,u._w)()}=s;return(0,w.wI)(e,a,n)})),(0,a.iw)("cancelMessagesMediaDownload",((e,t,s)=>{const{messages:a,tabId:n=(0,u._w)()}=s;for(const t of a)e=(0,w.wI)(e,t,n);return e})),(0,a.iw)("downloadMessageMedia",((e,t,s)=>{const{message:a,tabId:n=(0,u._w)()}=s;return(0,w.fC)(e,a,n)})),(0,a.iw)("downloadSelectedMessages",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{},n=(0,b.jUK)(e,a);if(!n.selectedMessages)return;const{chatId:i,messageIds:o}=n.selectedMessages,{threadId:r}=(0,b.Btg)(e,a)||{},c=(0,b.Zwk)(e,i);c&&r&&o.map((e=>c[e])).filter((t=>(0,b._kf)(e,t,r).canDownload)).forEach((e=>t.downloadMessageMedia({message:e,tabId:a})))})),(0,a.iw)("enterMessageSelectMode",((e,t,s)=>{const{messageId:a,tabId:n=(0,u._w)()}=s||{},i=(0,b.jrE)(e,n);return i?(0,w.M6)(e,i.id,a,n):e})),(0,a.iw)("toggleMessageSelection",((e,t,s)=>{const{messageId:n,groupedId:o,childMessageIds:r,withShift:c,tabId:d=(0,u._w)()}=s,l=(0,b.Btg)(e,d);if(!l)return;const{chatId:m,threadId:h,type:p}=l;e=(0,w.Ob)(e,m,h,p,n,o,r,c,d),(0,a.R3)(e),e.shouldShowContextMenuHint&&(t.disableContextMenuHint(),t.showNotification({message:`To **edit** or **reply**, close this menu. Then ${i.$b?"long tap":"right click"} on a message.`,tabId:d}))})),(0,a.iw)("disableContextMenuHint",(e=>{if(e.shouldShowContextMenuHint)return{...e,shouldShowContextMenuHint:!1}})),(0,a.iw)("exitMessageSelectMode",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{};return(0,w.i9)(e,a)})),(0,a.iw)("openPollModal",((e,t,s)=>{const{isQuiz:a,tabId:n=(0,u._w)()}=s||{};return(0,v.i)(e,{pollModal:{isOpen:!0,isQuiz:a}},n)})),(0,a.iw)("closePollModal",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{};return(0,v.i)(e,{pollModal:{isOpen:!1}},a)})),(0,a.iw)("checkVersionNotification",((e,t)=>{if(n.V61&&Date.now()>Number(n.V61)+2592e5)return;const s="10.4.9".split(".").slice(0,2).join("."),{serviceNotifications:a}=e;if(a.find((({version:e})=>e===s)))return;const i={chatId:n.awM,date:(0,we.bp)(),content:{text:(0,De.ZP)("**Introducing Telegram Web A v10.0!**\n\nToday marks a special occasion. Telegram is celebrating its 10th anniversary! In honor of this milestone, and to highlight our web version's long-awaited parity with the native apps, we've leaped from version 1.x straight to 10.0. Big day!\n\n🌟 **Stories on Telegram**\nIntroducing [Telegram Stories](https://t.me/durov/216) - share moments of your life, beyond just text.\n\n💻 **Desktop Version**\nAn experimental standalone version is now available for enthusiasts and early adopters on all desktop platforms: **[web.telegram.org/a/get](https://web.telegram.org/a/get)**.\n\n🚀 **Massive Connection Improvements**\nWeb A is now more optimized – ensuring speedy and seamless conversations. Less loading, more chatting.\n\n🎙️ **Redesigned Group Calls**\nGroup calls have been overhauled to bring exceptional clarity, connectivity, and functionality.\n\n🌍 **Real-Time Translation**\nPremium users can tap to translate entire chats, dynamically updating as they scroll.\n\n⏱️ **Custom Mute Durations**\nNotifications from any chat can be temporarily muted for a specific period – like hours, days, or weeks.\n\n🔖 **Read Time in Groups**\nYou can see at what time other members read your message in the 'Seen By' section.\n\n😄 **Emoji v15 Support**\nWeb A now supports the latest from Emoji v15, so you can express yourself fully.\n\n🎨 **Dynamic Sticker Packs**\nDynamic order for your sticker packs can be toggled on or off – whichever you prefer.\n\n🚀 **Performance Upgrades**\nWe've implemented multiple memory and performance optimizations for a smoother, faster, more efficient Telegram experience.\n\n🔧 **Fixes & Improvements**\nWe've patched several problems, including issues with sending messages while uploading files, freezes while scrolling, and messages incorrectly marking as read with Web A in the background. See if you can spot the host of UI refinements we added as well.😉\n\n📱 **More for iPad Users**\niPad users, we heard you! Web A now has improved iPad support.\n\nThank you for being with us. Here's to the next decade together! 🎉🥳\n\n🦄 **We also welcome** you to join our official channels in **[English](https://t.me/webachannel)** and **[Russian](https://t.me/webachannelru)** — where we post app updates and share our experiences building one of the world’s most feature-rich web applications.\n",!0)},isOutgoing:!1};t.createServiceNotification({message:i,version:s})})),(0,a.iw)("createServiceNotification",((e,t,s)=>{const{message:i,version:o}=s,{serviceNotifications:r}=e,c=Math.max((0,b.xMv)(e,n.awM)||0,...r.map((({id:e})=>e))),d=(r.length+1)/1e3,l=Math.floor(c)+d;i.previousLocalId=i.id,i.id=l;const u={id:l,message:i,version:o,isUnread:!0};e={...e,serviceNotifications:[...r.slice(-1e3),u]},(0,a.R3)(e),t.apiUpdate({"@type":"newMessage",id:i.id,chatId:i.chatId,message:i})})),(0,a.iw)("openReactorListModal",((e,t,s)=>{const{chatId:a,messageId:n,tabId:i=(0,u._w)()}=s;return(0,v.i)(e,{reactorModal:{chatId:a,messageId:n}},i)})),(0,a.iw)("closeReactorListModal",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{};return(0,v.i)(e,{reactorModal:void 0},a)})),(0,a.iw)("openSeenByModal",((e,t,s)=>{const{chatId:a,messageId:n,tabId:i=(0,u._w)()}=s;return(0,v.i)(e,{seenByModal:{chatId:a,messageId:n}},i)})),(0,a.iw)("closeSeenByModal",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{};return(0,v.i)(e,{seenByModal:void 0},a)})),(0,a.iw)("openPrivacySettingsNoticeModal",((e,t,s)=>{const{chatId:a,isReadDate:n,tabId:i=(0,u._w)()}=s;return(0,v.i)(e,{privacySettingsNoticeModal:{chatId:a,isReadDate:n}},i)})),(0,a.iw)("closePrivacySettingsNoticeModal",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{};return(0,v.i)(e,{privacySettingsNoticeModal:void 0},a)})),(0,a.iw)("openChatLanguageModal",((e,t,s)=>{const{chatId:a,messageId:n,tabId:i=(0,u._w)()}=s,o=n?(0,b.Bdn)(e,a,n,i):(0,b.lpX)(e,a,i);return(0,v.i)(e,{chatLanguageModal:{chatId:a,messageId:n,activeLanguage:o}},i)})),(0,a.iw)("closeChatLanguageModal",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{};return(0,v.i)(e,{chatLanguageModal:void 0},a)})),(0,a.iw)("copySelectedMessages",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{},n=(0,b.jUK)(e,a);if(!n.selectedMessages)return;const{chatId:i,messageIds:o}=n.selectedMessages;Ve(e,i,o)})),(0,a.iw)("copyMessagesByIds",((e,t,s)=>{const{messageIds:a,tabId:n=(0,u._w)()}=s,i=(0,b.jrE)(e,n);a&&0!==a.length&&i&&Ve(e,i.id,a)})),(0,a.iw)("openOneTimeMediaModal",((e,t,s)=>{const{message:n,tabId:i=(0,u._w)()}=s;e=(0,v.i)(e,{oneTimeMediaModal:{message:n}},i),(0,a.R3)(e)})),(0,a.iw)("closeOneTimeMediaModal",((e,t,s)=>{const{tabId:n=(0,u._w)()}=s||{};e=(0,v.i)(e,{oneTimeMediaModal:void 0},n),(0,a.R3)(e)})),(0,a.iw)("setGlobalSearchQuery",((e,t,s)=>{const{query:a,tabId:n=(0,u._w)()}=s,{chatId:i}=(0,b.jUK)(e,n).globalSearch;return(0,w.No)(e,{globalResults:{},localResults:{},resultsByType:void 0,...a?{fetchingStatus:{chats:!i,messages:!0}}:{fetchingStatus:void 0},query:a},n)})),(0,a.iw)("setGlobalSearchClosing",((e,t,s)=>{const{tabId:a=(0,u._w)(),isClosing:n}=s||{};return(0,w.No)(e,{isClosing:n},a)})),(0,a.iw)("addRecentlyFoundChatId",((e,t,s)=>{const{id:a}=s,{recentlyFoundChatIds:n}=e;if(!n)return{...e,recentlyFoundChatIds:[a]};const i=n.filter((e=>e!==a));return i.unshift(a),i.length>10&&i.pop(),{...e,recentlyFoundChatIds:i}})),(0,a.iw)("clearRecentlyFoundChats",(e=>({...e,recentlyFoundChatIds:void 0}))),(0,a.iw)("setGlobalSearchContent",((e,t,s)=>{const{content:a,tabId:n=(0,u._w)()}=s;return(0,w.Og)(e,a,n)})),(0,a.iw)("setGlobalSearchChatId",((e,t,s)=>{const{id:a,tabId:n=(0,u._w)()}=s;return(0,w.No)(e,{chatId:a,query:void 0,resultsByType:void 0},n)})),(0,a.iw)("setStickerSearchQuery",((e,t,s)=>{const{query:a,tabId:n=(0,u._w)()}=s;return(0,v.i)(e,{stickerSearch:{query:a,resultIds:void 0}},n)})),(0,a.iw)("setGifSearchQuery",((e,t,s)=>{const{query:a,tabId:n=(0,u._w)()}=s;return(0,v.i)(e,{gifSearch:{query:a,offset:void 0,results:void 0}},n)})),(0,a.iw)("setUserSearchQuery",((e,t,s)=>{const{query:a,tabId:n=(0,u._w)()}=s;return(0,w.Lm)(e,{globalUserIds:void 0,localUserIds:void 0,fetchingStatus:Boolean(a),query:a},n)})),(0,a.iw)("openAddContactDialog",((e,t,s)=>{const{userId:a,tabId:n=(0,u._w)()}=s;return(0,v.i)(e,{newContact:{userId:a}},n)})),(0,a.iw)("openNewContactDialog",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{};return(0,v.i)(e,{newContact:{isByPhoneNumber:!0}},a)})),(0,a.iw)("closeNewContactDialog",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{};return(0,w.ft)(e,a)})),s(73456);var $e=s(69995);const ze=/^\d+\.\d+(\.\d+)?$/;var Ke=s(91947);function Je(e){document.querySelectorAll('link[rel="icon"], link[rel="alternate icon"]').forEach((t=>{e?t.href.includes("favicon-unread")||(t.href=t.href.replace("favicon","favicon-unread")):t.href=t.href.replace("favicon-unread","favicon")}))}function We(e){i.D$?window.electron.setWindowTitle(e):document.title!==e&&(document.title=e)}const Ye=(0,g.Ds)(We,200,!1);let Xe,Qe;(0,a.iw)("toggleChatInfo",((e,t,s)=>{const{force:a,tabId:n=(0,u._w)()}=s||{},i=void 0!==a?a:!(0,b.jUK)(e,n).isChatInfoShown;return e=(0,v.i)(e,{isChatInfoShown:i},n),{...e,lastIsChatInfoShown:i}})),(0,a.iw)("setLeftColumnWidth",((e,t,s)=>{const{leftColumnWidth:a}=s;return{...e,leftColumnWidth:a}})),(0,a.iw)("resetLeftColumnWidth",(e=>({...e,leftColumnWidth:void 0}))),(0,a.iw)("toggleManagement",((e,t,s)=>{const{force:a,tabId:n=(0,u._w)()}=s||{},{chatId:i}=(0,b.Btg)(e,n)||{};if(!i)return;const o=(0,b.jUK)(e,n);return(0,v.i)(e,{management:{byChatId:{...o.management.byChatId,[i]:{...o.management.byChatId[i],isActive:void 0!==a?a:!(o.management.byChatId[i]||{}).isActive}}}},n)})),(0,a.iw)("requestNextManagementScreen",((e,t,s)=>{const{screen:a,tabId:n=(0,u._w)()}=s||{},{chatId:i}=(0,b.Btg)(e,n)||{};if(!i)return;const o=(0,b.jUK)(e,n);return(0,v.i)(e,{management:{byChatId:{...o.management.byChatId,[i]:{...o.management.byChatId[i],isActive:!0,nextScreen:a}}}},n)})),(0,a.iw)("closeManagement",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{},{chatId:n}=(0,b.Btg)(e,a)||{};if(!n)return;const i=(0,b.jUK)(e,a);return(0,v.i)(e,{management:{byChatId:{...i.management.byChatId,[n]:{...i.management.byChatId[n],isActive:!1}}}},a)})),(0,a.iw)("processOpenChatOrThread",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s;if((0,B.W7)()||(0,B.c9)())return(0,v.i)(e,{isLeftColumnShown:0===(0,b.jUK)(e,a).messageLists.length},a)})),(0,a.iw)("resetNextProfileTab",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{},{chatId:n}=(0,b.Btg)(e,a)||{};if(n)return(0,v.i)(e,{nextProfileTab:void 0,forceScrollProfileTab:!1},a)})),(0,a.iw)("toggleStatistics",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{},n=(0,b.jUK)(e,a);return(0,v.i)(e,{isStatisticsShown:!n.isStatisticsShown,statistics:{...n.statistics,currentMessageId:void 0,currentStoryId:void 0}},a)})),(0,a.iw)("toggleMessageStatistics",((e,t,s)=>{const{tabId:a=(0,u._w)(),messageId:n}=s||{};return(0,v.i)(e,{statistics:{...(0,b.jUK)(e,a).statistics,currentMessageId:n,currentStoryId:void 0}},a)})),(0,a.iw)("toggleStoryStatistics",((e,t,s)=>{const{tabId:a=(0,u._w)(),storyId:n}=s||{};return(0,v.i)(e,{statistics:{...(0,b.jUK)(e,a).statistics,currentStoryId:n,currentMessageId:void 0}},a)})),(0,a.iw)("toggleLeftColumn",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{};return(0,v.i)(e,{isLeftColumnShown:!(0,b.jUK)(e,a).isLeftColumnShown},a)})),(0,a.iw)("addRecentEmoji",((e,t,s)=>{const{emoji:a}=s,{recentEmojis:n}=e;if(!n)return{...e,recentEmojis:[a]};const i=n.filter((e=>e!==a));return i.unshift(a),i.length>32&&i.pop(),{...e,recentEmojis:i}})),(0,a.iw)("addRecentSticker",((e,t,s)=>{const{sticker:a}=s,{recent:n}=e.stickers;if(!n)return{...e,stickers:{...e.stickers,recent:{hash:"0",stickers:[a]}}};const i=n.stickers.filter((e=>e.id!==a.id));return i.unshift(a),{...e,stickers:{...e.stickers,recent:{...n,stickers:i}}}})),(0,a.iw)("addRecentCustomEmoji",((e,t,s)=>{const{documentId:a}=s,{recentCustomEmojis:n}=e;if(!n)return{...e,recentCustomEmojis:[a]};const i=n.filter((e=>e!==a));return i.unshift(a),i.length>32&&i.pop(),{...e,recentCustomEmojis:i}})),(0,a.iw)("clearRecentCustomEmoji",(e=>({...e,recentCustomEmojis:[]}))),(0,a.iw)("reorderStickerSets",((e,t,s)=>{const{order:a,isCustomEmoji:n}=s;return{...e,stickers:{...e.stickers,added:{setIds:n?e.stickers.added.setIds:a}},customEmojis:{...e.customEmojis,added:{setIds:n?a:e.customEmojis.added.setIds}}}})),(0,a.iw)("showNotification",((e,t,s)=>{const{tabId:a=(0,u._w)(),...n}=s;n.localId=(0,$e.Z)();const i=[...(0,b.jUK)(e,a).notifications],o=i.findIndex((e=>e.message===n.message));return-1!==o&&i.splice(o,1),i.push(n),(0,v.i)(e,{notifications:i},a)})),(0,a.iw)("showAllowedMessageTypesNotification",((e,t,s)=>{const{chatId:a,tabId:n=(0,u._w)()}=s,i=(0,b.Z1J)(e,a);if(!i)return;const o=(0,b.x67)(e,a),{canSendPlainText:r,canSendPhotos:c,canSendVideos:d,canSendDocuments:l,canSendAudios:p,canSendStickers:g,canSendRoundVideos:f,canSendVoices:w}=(0,I.H5)(i,o),v=(0,m.oA)([r?"Chat.SendAllowedContentTypeText":void 0,c?"Chat.SendAllowedContentTypePhoto":void 0,d?"Chat.SendAllowedContentTypeVideo":void 0,w?"Chat.SendAllowedContentTypeVoiceMessage":void 0,f?"Chat.SendAllowedContentTypeVideoMessage":void 0,l?"Chat.SendAllowedContentTypeFile":void 0,p?"Chat.SendAllowedContentTypeMusic":void 0,g?"Chat.SendAllowedContentTypeSticker":void 0]).map((e=>h.Iu(e)));if(!v.length)return void t.showNotification({message:h.Iu("Chat.SendNotAllowedText"),tabId:n});const y=h.Iu("AutoDownloadSettings.LastDelimeter"),P=v.join(", ").replace(/,([^,]*)$/,`${y}$1`);t.showNotification({message:h.Iu("Chat.SendAllowedContentText",P),tabId:n})})),(0,a.iw)("dismissNotification",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s,n=(0,b.jUK)(e,a).notifications.filter((({localId:e})=>e!==s.localId));return(0,v.i)(e,{notifications:n},a)})),(0,a.iw)("showDialog",((e,t,s)=>{const{data:a,tabId:n=(0,u._w)()}=s;if("message"in a&&a.hasErrorKey&&!(0,Ke.ZP)(a))return e;const i=[...(0,b.jUK)(e,n).dialogs];if("message"in a){const e=i.findIndex((e=>e.message===a.message));-1!==e&&i.splice(e,1)}return i.push(a),(0,v.i)(e,{dialogs:i},n)})),(0,a.iw)("dismissDialog",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{},n=[...(0,b.jUK)(e,a).dialogs];return n.pop(),(0,v.i)(e,{dialogs:n},a)})),(0,a.iw)("toggleSafeLinkModal",((e,t,s)=>{const{url:a,tabId:n=(0,u._w)()}=s;return(0,v.i)(e,{safeLinkModalUrl:a},n)})),(0,a.iw)("openHistoryCalendar",((e,t,s)=>{const{selectedAt:a,tabId:n=(0,u._w)()}=s;return(0,v.i)(e,{historyCalendarSelectedAt:a},n)})),(0,a.iw)("closeHistoryCalendar",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{};return(0,v.i)(e,{historyCalendarSelectedAt:void 0},a)})),(0,a.iw)("openGame",((e,t,s)=>{const{url:n,chatId:i,messageId:o,tabId:r=(0,u._w)()}=s,c=(0,b.hjO)(e,i,o);if(!c)return;const d=c.viaBotId||c.senderId;if(d){if(!(0,b.LM9)(e,d))return e=(0,v.i)(e,{botTrustRequest:{botId:d,type:"game",onConfirm:{action:"openGame",payload:s}}},r),void(0,a.R3)(e);e=(0,v.i)(e,{openedGame:{url:n,chatId:i,messageId:o}},r),(0,a.R3)(e)}})),(0,a.iw)("closeGame",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{};return(0,v.i)(e,{openedGame:void 0},a)})),(0,a.iw)("requestConfetti",((e,t,s)=>{const{tabId:a=(0,u._w)(),...n}=s;if((0,b.FOo)(e))return(0,v.i)(e,{confetti:{lastConfettiTime:Date.now(),...n}},a)})),(0,a.iw)("updateAttachmentSettings",((e,t,s)=>{const{shouldCompress:a,shouldSendGrouped:n}=s;return{...e,attachmentSettings:{shouldCompress:a??e.attachmentSettings.shouldCompress,shouldSendGrouped:n??e.attachmentSettings.shouldSendGrouped}}})),(0,a.iw)("openLimitReachedModal",((e,t,s)=>{const{limit:a,tabId:n=(0,u._w)()}=s;return(0,v.i)(e,{limitReachedModal:{limit:a}},n)})),(0,a.iw)("closeLimitReachedModal",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{};return(0,v.i)(e,{limitReachedModal:void 0},a)})),(0,a.iw)("closeStickerSetModal",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{};return(0,v.i)(e,{openedStickerSetShortName:void 0},a)})),(0,a.iw)("openCustomEmojiSets",((e,t,s)=>{const{setIds:a,tabId:n=(0,u._w)()}=s;return(0,v.i)(e,{openedCustomEmojiSetIds:a},n)})),(0,a.iw)("closeCustomEmojiSets",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{};return(0,v.i)(e,{openedCustomEmojiSetIds:void 0},a)})),(0,a.iw)("updateLastRenderedCustomEmojis",((e,t,s)=>{const{ids:a}=s,{lastRendered:i}=e.customEmojis;return{...e,customEmojis:{...e.customEmojis,lastRendered:(0,m.Tw)([...i,...a]).slice(0,n.j7i)}}})),(0,a.iw)("openCreateTopicPanel",((e,t,s)=>{const{chatId:a,tabId:n=(0,u._w)()}=s;return(0,b.jrE)(e,n)||t.openChat({id:a,tabId:n}),(0,v.i)(e,{createTopicPanel:{chatId:a}},n)})),(0,a.iw)("closeCreateTopicPanel",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{};return(0,v.i)(e,{createTopicPanel:void 0},a)})),(0,a.iw)("openEditTopicPanel",((e,t,s)=>{const{chatId:a,topicId:n,tabId:i=(0,u._w)()}=s;return(0,b.jrE)(e,i)||t.openChat({id:a,tabId:i}),(0,v.i)(e,{editTopicPanel:{chatId:a,topicId:n}},i)})),(0,a.iw)("closeEditTopicPanel",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{};return(0,v.i)(e,{editTopicPanel:void 0},a)})),(0,a.iw)("updateArchiveSettings",((e,t,s)=>{const{archiveSettings:a}=e,{isHidden:n=a.isHidden,isMinimized:i=a.isMinimized}=s;return{...e,archiveSettings:{isHidden:n,isMinimized:i}}})),(0,a.iw)("openMapModal",((e,t,s)=>{const{geoPoint:a,zoom:n,tabId:i=(0,u._w)()}=s;return(0,v.i)(e,{mapModal:{point:a,zoom:n}},i)})),(0,a.iw)("closeMapModal",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{};return(0,v.i)(e,{mapModal:void 0},a)})),(0,a.iw)("checkAppVersion",(e=>{fetch(`version.txt?${Date.now()}`).then((e=>e.text())).then((t=>{(function(e,t,s){const a=e.trim();return!!ze.test(a)&&a!==t})(t=t.trim(),"10.4.9")&&(e=(0,a.Rd)(),e={...e,isAppUpdateAvailable:!0},(0,a.R3)(e))})).catch((e=>{n.eMD&&console.error("[checkAppVersion failed] ",e)}))})),(0,a.iw)("setIsElectronUpdateAvailable",((e,t,s)=>{e=(0,a.Rd)(),e={...e,isElectronUpdateAvailable:Boolean(s)},(0,a.R3)(e)})),(0,a.iw)("afterHangUp",(e=>{(0,b.jUK)(e,(0,u._w)()).multitabNextAction&&(0,u.g)()})),(0,a.iw)("onTabFocusChange",((e,t,s)=>{const{isBlurred:a,tabId:n=(0,u._w)()}=s;return a?(Xe&&clearInterval(Xe),Xe=window.setInterval((()=>{t.updatePageTitle({tabId:n})}),500)):(clearInterval(Xe),Xe=void 0),e=(0,v.i)(e,{isBlurred:a},n),{...e,initialUnreadNotifications:a?(0,pe.xW)():void 0}})),(0,a.iw)("updatePageTitle",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{},{canDisplayChatInTitle:o}=e.settings.byKey,r=e.currentUserId;if(document.title.includes(n.ouc))return Je(!1),void We(`${n.Tih} ${n.ouc}`);if(e.initialUnreadNotifications&&Math.round(Date.now()/1e3)%2==0){const t=(0,pe.xW)()-e.initialUnreadNotifications;if(t>0)return We(`${t} notification${t>1?"s":""}`),void Je(!0)}Je(!1);const c=(0,b.Btg)(e,a);if(c&&o&&!e.passcode.isScreenLocked){const{chatId:t,threadId:s}=c,a=(0,b.Z1J)(e,t);if(a){const e=(0,I.U)(h.Iu,a,t===r);return a.isForum&&a.topics?.[s]?void Ye(`${e} › ${a.topics[s].title}`):void Ye(e)}}We(i.D$?"":n.Tih)})),(0,a.iw)("closeInviteViaLinkModal",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s??{};return(0,v.i)(e,{inviteViaLinkModal:void 0},a)}));let et,tt=0;(0,he.ll)((e=>{const{updatePageTitle:t,updateIsOnline:s}=(0,a.Sv)(),n=e.passcode.isScreenLocked!==Qe,i=Object.values(e.byTabId).filter((e=>e.isBlurred)).length,o=(0,b.jUK)(e,(0,u._w)()).isMasterTab;n&&t(),i!==tt&&o&&(et&&clearTimeout(et),et=window.setTimeout((()=>{e=(0,a.Rd)();const t=Object.values(e.byTabId).filter((e=>e.isBlurred)).length;s(t!==(0,u.s1)().length)}),100)),Qe=e.passcode.isScreenLocked,tt=i})),(0,a.iw)("closePaymentModal",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{},n=(0,b.jUK)(e,a).payment.status;return e=(0,w.bp)(e,a),e=(0,w.WY)(e,a),(0,v.i)(e,{payment:{...(0,b.jUK)(e,a).payment,status:n}},a)})),(0,a.iw)("addPaymentError",((e,t,s)=>{const{error:a,tabId:n=(0,u._w)()}=s;return(0,v.i)(e,{payment:{...(0,b.jUK)(e,n).payment,status:"failed",error:a}},n)})),(0,a.iw)("closeGiftCodeModal",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{};return(0,v.i)(e,{giftCodeModal:void 0},a)}));var st=s(88422);(0,a.iw)("openMediaViewer",((e,t,s)=>{const{chatId:a,threadId:i,mediaId:o,avatarOwnerId:r,profilePhotoIndex:c,origin:d,volume:l,playbackRate:m,isMuted:h,tabId:p=(0,u._w)()}=s,g=(0,b.jUK)(e,p);return(0,v.i)(e,{mediaViewer:{...g.mediaViewer,chatId:a,threadId:i,mediaId:o,avatarOwnerId:r,profilePhotoIndex:c,origin:d,isHidden:!1,volume:l??g.mediaViewer.volume,playbackRate:m||g.mediaViewer.playbackRate||e.mediaViewer.lastPlaybackRate||n.mwi,isMuted:h||g.mediaViewer.isMuted},forwardMessages:{}},p)})),(0,a.iw)("closeMediaViewer",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{},{volume:n,isMuted:i,playbackRate:o,isHidden:r}=(0,b.jUK)(e,a).mediaViewer;return(0,v.i)(e,{mediaViewer:{volume:n,isMuted:i,isHidden:r,playbackRate:o}},a)})),(0,a.iw)("setMediaViewerVolume",((e,t,s)=>{const{volume:a,tabId:n=(0,u._w)()}=s;return(0,v.i)(e,{mediaViewer:{...(0,b.jUK)(e,n).mediaViewer,volume:a,isMuted:!1}},n)})),(0,a.iw)("setMediaViewerPlaybackRate",((e,t,s)=>{const{playbackRate:a,tabId:n=(0,u._w)()}=s;return e={...e,mediaViewer:{...e.mediaViewer,lastPlaybackRate:a}},(0,v.i)(e,{mediaViewer:{...(0,b.jUK)(e,n).mediaViewer,playbackRate:a}},n)})),(0,a.iw)("setMediaViewerMuted",((e,t,s)=>{const{isMuted:a,tabId:n=(0,u._w)()}=s;return(0,v.i)(e,{mediaViewer:{...(0,b.jUK)(e,n).mediaViewer,isMuted:a}},n)})),(0,a.iw)("setMediaViewerHidden",((e,t,s)=>{const{isHidden:a,tabId:n=(0,u._w)()}=s;return(0,v.i)(e,{mediaViewer:{...(0,b.jUK)(e,n).mediaViewer,isHidden:a}},n)}));var at=s(95281),nt=s(17210),it=s(5872),ot=s(35369);let rt=!1;(0,g.Gq)((()=>{(0,a.Rd)().passcode.hasPasscode&&!rt&&1===Object.keys((0,a.Rd)().byTabId).length&&(0,nt.jv)()})),(0,a.iw)("setPasscode",(async(e,t,s)=>{const{passcode:n,tabId:i=(0,u._w)()}=s;e=(0,w.vu)(e,{isLoading:!0}),(0,a.R3)(e),await(0,at.AU)(n);const o=JSON.stringify({...(0,nt.K8)(),userId:e.currentUserId});e=(0,a.Rd)();const r=(0,it.Uf)((0,w.vu)(e,{hasPasscode:!0,error:void 0,isLoading:!1}));try{await(0,at.H4)(o,r),(0,u.Z6)(),e=(0,a.Rd)(),e=(0,w.vu)(e,{hasPasscode:!0,error:void 0,isLoading:!1}),(0,a.R3)(e),(0,it.jA)(!0)}catch(s){(0,at.J9)(),e=(0,a.Rd)(),e=(0,w.vu)(e,{isLoading:!1}),(0,a.R3)(e),t.showNotification({message:"Failed to set passcode",tabId:i}),t.requestNextSettingsScreen({screen:c.MT.PasscodeDisabled,tabId:i})}})),(0,a.iw)("clearPasscode",(e=>((0,at.C8)(),(0,w.Kn)(e)))),(0,a.iw)("unlockScreen",((e,t,s)=>{const n=Object.values(e.byTabId),{sessionJson:i,globalJson:o}=s,r=JSON.parse(i);(0,nt.wX)(r,r.userId);const c=e;(e=JSON.parse(o)).byTabId=c.byTabId,(0,it.nE)(e,(0,m.Xh)(ot.g9)),e=(0,w.vu)(e,{isScreenLocked:!1,error:void 0,invalidAttemptsCount:0}),(0,a.R3)(e),(0,u.Z6)(),n.forEach((({id:e,isMasterTab:s})=>t.init({tabId:e,isMasterTab:s}))),t.initApi()})),(0,a.iw)("decryptSession",((e,t,s)=>{const{passcode:a}=s;(0,at.so)(a).then(t.unlockScreen,(()=>{t.logInvalidUnlockAttempt()}))})),(0,a.iw)("logInvalidUnlockAttempt",(e=>{const t=(e.passcode?.invalidAttemptsCount??0)+1;return(0,w.vu)(e,{invalidAttemptsCount:t,timeoutUntil:t>=5?Date.now()+15e3:void 0})})),(0,a.iw)("resetInvalidUnlockAttempts",(e=>(0,w.vu)(e,{invalidAttemptsCount:0,timeoutUntil:void 0}))),(0,a.iw)("setPasscodeError",((e,t,s)=>{const{error:a}=s;return(0,w.vu)(e,{error:a})})),(0,a.iw)("clearPasscodeError",(e=>(0,w.vu)(e,{error:void 0}))),(0,a.iw)("skipLockOnUnload",(()=>{rt=!0})),(0,a.iw)("processOpenChatOrThread",((e,t,s)=>{const{chatId:a,tabId:n=(0,u._w)()}=s;return a?(0,v.i)(e,{reactionPicker:{chatId:a,messageId:void 0,position:void 0}},n):(0,v.i)(e,{reactionPicker:void 0},n)})),(0,a.iw)("openMessageReactionPicker",((e,t,s)=>{const{chatId:a,messageId:n,position:i,tabId:o=(0,u._w)()}=s;return(0,v.i)(e,{reactionPicker:{chatId:a,messageId:n,position:i}},o)})),(0,a.iw)("openStoryReactionPicker",((e,t,s)=>{const{peerId:a,storyId:n,position:i,sendAsMessage:o,tabId:r=(0,u._w)()}=s;return(0,v.i)(e,{reactionPicker:{storyPeerId:a,storyId:n,sendAsMessage:o,position:i}},r)})),(0,a.iw)("closeReactionPicker",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{},n=(0,b.jUK)(e,a);return(0,v.i)(e,{reactionPicker:{...n.reactionPicker,messageId:void 0,position:void 0,storyId:void 0,storyPeerId:void 0}},a)})),(0,a.iw)("openStoryViewer",(async(e,t,s)=>{const{peerId:n,storyId:i,isSinglePeer:o,isSingleStory:r,isPrivate:c,isArchive:d,origin:l,tabId:h=(0,u._w)()}=s,p=(0,b.RGZ)(e,n);if(!p)return;const g=(0,b.jUK)(e,h),I=(0,b.nST)(e,n);if(i&&(!I||!I.byId[i])){const t=await(0,f.t9)("fetchPeerStoriesByIds",{peer:p,ids:[i]});if(!t)return;e=(0,a.Rd)(),e=(0,w.Sh)(e,(0,m.ee)(t.users,"id")),e=(0,w.fZ)(e,(0,m.ee)(t.chats,"id")),e=(0,w._6)(e,n,t.stories)}const y=g.storyViewer.storyList||(0,b.tWo)(e,n,i,r,o,c,d);e=(0,v.i)(e,{storyViewer:{...g.storyViewer,peerId:n,storyId:i||(0,b.ZEE)(e,n)||(0,b.wUq)(e,n),isSinglePeer:o,isPrivate:c,isArchive:d,isSingleStory:r,viewModal:void 0,origin:l,storyList:y}},h),(0,a.R3)(e)})),(0,a.iw)("openStoryViewerByUsername",(async(e,t,s)=>{const{username:a,storyId:n,origin:i,tabId:r=(0,u._w)()}=s,c=await(0,o.Co)(e,a);c&&t.openStoryViewer({peerId:c.id,storyId:n,isSinglePeer:!0,isSingleStory:!0,origin:i,tabId:r})})),(0,a.iw)("closeStoryViewer",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{},{isMuted:n,isRibbonShown:i,isArchivedRibbonShown:o,storyId:r}=(0,b.jUK)(e,a).storyViewer;return r?e=(0,v.i)(e,{storyViewer:{isMuted:n,isRibbonShown:i,isArchivedRibbonShown:o,lastViewedByPeerIds:void 0,storyList:void 0}},a):e})),(0,a.iw)("setStoryViewerMuted",((e,t,s)=>{const{isMuted:a,tabId:n=(0,u._w)()}=s;return(0,v.i)(e,{storyViewer:{...(0,b.jUK)(e,n).storyViewer,isMuted:a}},n)})),(0,a.iw)("toggleStoryRibbon",((e,t,s)=>{const{isShown:a,isArchived:n,tabId:i=(0,u._w)()}=s,o=e.stories.orderedPeerIds[n?"archived":"active"];return o?.length?(0,v.i)(e,{storyViewer:{...(0,b.jUK)(e,i).storyViewer,[n?"isArchivedRibbonShown":"isRibbonShown"]:a}},i):e})),(0,a.iw)("openPreviousStory",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{},n=(0,b.jUK)(e,a),{peerId:i,storyId:o,isSinglePeer:r,isSingleStory:c,storyList:d}=n.storyViewer;if(c||!d)return void t.closeStoryViewer({tabId:a});if(!i||!o)return;const l=(0,b.RGZ)(e,i);if(!(0,b.nST)(e,i)||!l)return;const{peerIds:m,storyIdsByPeerId:h}=d,p=(h[i]??[]).indexOf(o);let g,f;if(p>0)g=p-1,f=i;else{const e=m.indexOf(i)-1;if(r||e<0)return;f=m[e],g=(h?.[f]?.length||1)-1}const I=h?.[f]?.[g];return I?(0,v.i)(e,{storyViewer:{...n.storyViewer,peerId:f,storyId:I}},a):void 0})),(0,a.iw)("openNextStory",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{},n=(0,b.jUK)(e,a),{peerId:i,storyId:o,isSinglePeer:r,isSingleStory:c,storyList:d}=n.storyViewer;if(c||!d)return void t.closeStoryViewer({tabId:a});if(!i||!o)return;const l=(0,b.RGZ)(e,i);if(!(0,b.nST)(e,i)||!l)return;const{peerIds:m,storyIdsByPeerId:h}=d,p=h[i]??[],g=p.indexOf(o);let f,I;if(g<p.length-1)f=g+1,I=i;else{const e=m.indexOf(i)+1;if(r||e>m.length-1)return void t.closeStoryViewer({tabId:a});I=m[e],f=0}const w=h?.[I]?.[f];return w?(0,v.i)(e,{storyViewer:{...n.storyViewer,peerId:I,storyId:w}},a):void 0})),(0,a.iw)("openStoryViewModal",((e,t,s)=>{const{storyId:a,tabId:n=(0,u._w)()}=s,i=(0,b.jUK)(e,n);return(0,v.i)(e,{storyViewer:{...i.storyViewer,viewModal:{storyId:a,nextOffset:"",isLoading:!0}}},n)})),(0,a.iw)("closeStoryViewModal",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{},n=(0,b.jUK)(e,a);return(0,v.i)(e,{storyViewer:(0,m.CE)(n.storyViewer,["viewModal"])},a)})),(0,a.iw)("copyStoryLink",(async(e,t,s)=>{const{peerId:a,storyId:n,tabId:i=(0,u._w)()}=s,o=(0,b.RGZ)(e,a);if(!o)return;const r=await(0,f.t9)("fetchStoryLink",{peer:o,storyId:n});r&&((0,Fe.TE)(r),t.showNotification({message:h.Iu("LinkCopied"),tabId:i}))})),(0,a.iw)("sendMessage",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s,{storyId:n,peerId:i}=(0,b.pri)(e,a);if(!Boolean(n&&i))return;const{gif:o,sticker:r,isReaction:c}=s;let d;d=o?"Story.Tooltip.GifSent":r?"Story.Tooltip.StickerSent":c?"Story.Tooltip.ReactionSent":"Story.Tooltip.MessageSent",t.showNotification({message:h.Iu(d),actionText:h.Iu("Story.ToastViewInChat"),action:[{action:"closeStoryViewer",payload:void 0},{action:"openChat",payload:{id:i}}],tabId:a})})),(0,a.iw)("openStoryPrivacyEditor",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{},n=(0,b.jUK)(e,a);return(0,v.i)(e,{storyViewer:{...n.storyViewer,isPrivacyModalOpen:!0}},a)})),(0,a.iw)("closeStoryPrivacyEditor",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{},n=(0,b.jUK)(e,a);return(0,v.i)(e,{storyViewer:{...n.storyViewer,isPrivacyModalOpen:!1}},a)})),(0,a.iw)("toggleStealthModal",((e,t,s)=>{const{isOpen:a,tabId:n=(0,u._w)()}=s||{},i=(0,b.jUK)(e,n);return(0,v.i)(e,{storyViewer:{...i.storyViewer,isStealthModalOpen:a}},n)})),(0,a.iw)("clearStoryViews",((e,t,s)=>{const{isLoading:a,tabId:n=(0,u._w)()}=s||{},i=(0,b.jUK)(e,n);return i.storyViewer.viewModal?(0,v.i)(e,{storyViewer:{...i.storyViewer,viewModal:{...i.storyViewer.viewModal,views:void 0,isLoading:a,nextOffset:""}}},n):e})),(0,a.iw)("updateStoryView",((e,t,s)=>{const{userId:a,isUserBlocked:n,areStoriesBlocked:i,tabId:o=(0,u._w)()}=s,r=(0,b.jUK)(e,o),{viewModal:c}=r.storyViewer;if(!c?.storyId)return;const d=c?.views?.map((e=>e.peerId===a?{...e,isUserBlocked:n||void 0,areStoriesBlocked:i||void 0}:e));return(0,v.i)(e,{storyViewer:{...r.storyViewer,viewModal:{...c,views:d}}},o)})),(0,a.iw)("closeBoostModal",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{};return(0,v.i)(e,{boostModal:void 0},a)})),(0,a.iw)("closeBoostStatistics",((e,t,s)=>{const{tabId:a=(0,u._w)()}=s||{};return(0,v.i)(e,{boostStatistics:void 0},a)})),s(28304),s(13522);var ct=s(78058),dt=s(1735),lt=s(24736),ut=s.n(lt);s(89618);var mt=s(57404),ht=s(48764).lW;const pt="BroadcastChannel"in self,gt=pt?new BroadcastChannel(n.tuy):void 0;let ft=[];const It=(0,g.P2)((()=>{gt.postMessage({type:"localDbUpdate",batchedUpdates:ft}),ft=[]}),100);function wt(e){if(e instanceof Uint8Array)return ht.from(e);if("object"==typeof e&&1===Object.keys(e).length&&"value"===Object.keys(e)[0])return ut()(e.value);if(Array.isArray(e))return e.map(wt);if("object"!=typeof e||!("CONSTRUCTOR_ID"in e))return e;const t=e.className.split(".").reduce(((e,t)=>e[t]),mt.constructors),s=function(e){const{flags:t,CONSTRUCTOR_ID:s,SUBCLASS_OF_ID:a,className:n,classType:i,getBytes:o,...r}=e;return r}(e);return new t(Object.keys(s).reduce(((e,t)=>(e[t]=wt(s[t]),e)),{}))}var vt;["localMessages","chats","users","messages","documents","stickerSets","photos","webDocuments","stories","commonBoxState","channelPtsById"].reduce(((e,t)=>{const s=vt?.[t]??{},a=Object.keys(s).reduce(((e,a)=>{if("commonBoxState"===t||"channelPtsById"===t){const t=s;return e[a]=t[a],e}return e[a]=wt(s[a]),e}),{});var n;return e[t]=pt?(n=t,new Proxy(a,{get:(e,t,s)=>Reflect.get(e,t,s),set:(e,t,s)=>(ft.push({name:n,prop:t,value:s}),It(),Reflect.set(e,t,s))})):a,e}),{}),s(48764).lW,s(48960);const bt=1e6,yt="temp";let Pt=0;function Zt(e,t){return{poll:{id:String(t),summary:(0,m.ei)(e.summary,["question","answers"]),results:{}}}}function St(e,t,s,a,i,o,r,c,d,l,u,m,h,p){const g=function(e=0){return e+ ++Pt/bt}(t),f=o&&function(e){const{filename:t,blobUrl:s,previewBlobUrl:a,mimeType:i,size:o,audio:r,shouldSendAsFile:c,shouldSendAsSpoiler:d,ttlSeconds:l}=e;if(!c){if(e.quick){if(n.oGt.has(i)){const{width:t,height:n}=e.quick;return{photo:{id:yt,sizes:[],thumbnail:{width:t,height:n,dataUri:a||s},blobUrl:s,isSpoiler:d}}}if(n.wGh.has(i)){const{width:n,height:r,duration:c}=e.quick;return{video:{id:yt,mimeType:i,duration:c||0,fileName:t,width:n,height:r,blobUrl:s,...a&&{thumbnail:{width:n,height:r,dataUri:a}},size:o,isSpoiler:d}}}}if(e.voice){const{duration:t,waveform:s}=e.voice,{data:a}=(0,dt.C)(s,63);return{voice:{id:yt,duration:t,waveform:a},ttlSeconds:l}}if(n.e74.has(i)){const{duration:e,performer:s,title:a}=r||{};return{audio:{id:yt,mimeType:i,fileName:t,size:o,duration:e||0,title:a,performer:s}}}}return{document:{mimeType:i,fileName:t,size:o,...a&&{previewBlobUrl:a}}}}(o),I="chatTypeChannel"===e.type,w=i&&(y=i,P=e.isForum,"story"===y.type?{type:"story",peerId:y.peerId,storyId:y.storyId}:{type:"message",replyToMsgId:y.replyToMsgId,replyToTopId:y.replyToTopId,replyToPeerId:y.replyToPeerId,quoteText:y.quoteText,isForumTopic:!(!P||!y.replyToTopId)||void 0,...Boolean(y.quoteText)&&{isQuote:!0}}),v={id:g,chatId:e.id,content:{...s&&{text:{text:s,entities:a}},...f,...r&&{sticker:r},...c&&{video:c},...d&&Zt(d,g),...l&&{contact:l},...p&&{storyData:p}},date:m||Math.round(Date.now()/1e3)+(0,we.Qj)(),isOutgoing:!I,senderId:h?.id||undefined,replyInfo:w,...u&&{groupedId:u,...f&&(f.photo||f.video)&&{isInAlbum:!0}},...m&&{isScheduled:!0},isForwardingAllowed:!0},b=(0,ct.k)(v.content,v.groupedId);var y,P;return{...v,...b&&{emojiOnlyCount:b}}}(0,a.iw)("apiUpdate",((e,t,s)=>{switch(s["@type"]){case"updateChat":{const{isForum:n,lastReadOutboxMessageId:i}=(0,b.Z1J)(e,s.id)||{};s.chat.lastReadOutboxMessageId&&i&&s.chat.lastReadOutboxMessageId<i&&(s={...s,chat:(0,m.CE)(s.chat,["lastReadInboxMessageId"])});const o=(0,b.Z1J)(e,s.id);return e=(0,w.a4)(e,s.id,s.chat,s.newProfilePhoto),o?.areStoriesHidden!==s.chat.areStoriesHidden&&(e=(0,w.QO)(e,s.id,s.chat.areStoriesHidden||!1)),(0,a.R3)(e),s.noTopChatsRequest||(0,b.Nap)(e,s.id)||t.loadTopChats(),s.chat.id&&(0,P.Vr)({chatId:s.chat.id,lastReadInboxMessageId:s.chat.lastReadInboxMessageId}),void Object.values(e.byTabId).forEach((({id:a})=>{const{chatId:i}=(0,b.Btg)(e,a)||{},o=s;i===o.id&&"isForum"in o.chat&&n!==o.chat.isForum&&(n&&t.closeForumPanel({tabId:a}),t.openChat({id:i,tabId:a}))}))}case"updateChatJoin":{const n=(0,b.EkO)(e,s.id),i=(0,b.Z1J)(e,s.id);if(i&&(0,I.eA)(i)){t.fetchChannelRecommendations({chatId:i.id});const s=St(i,(0,b.xMv)(e,i.id));s.content.action={text:"you joined this channel",translationValues:["ChannelJoined"],type:"joinedChannel",targetChatId:i.id},t.apiUpdate({"@type":"newMessage",id:s.id,chatId:i.id,message:s})}if(!n)return;return e=(0,w.B1)(e,n,[s.id]),e=(0,w.a4)(e,s.id,{isNotJoined:!1}),(0,a.R3)(e),void(i&&t.requestChatUpdate({chatId:i.id}))}case"updateChatLeave":{e=(0,w.Dd)(e,s.id);const t=(0,b.Z1J)(e,s.id);if(t&&(0,I.eA)(t)){const a=(0,b.Zwk)(e,s.id),n=Object.keys(a).map(Number).filter(I.AJ);e=(0,w.K4)(e,t.id,n)}return e}case"updateChatInbox":return(0,w.a4)(e,s.id,s.chat);case"updateChatTypingStatus":{const{id:t,threadId:n=r._f,typingStatus:i}=s;return e=(0,w.pf)(e,t,n,"typingStatus",i),(0,a.R3)(e),void setTimeout((()=>{e=(0,a.Rd)();const s=(0,b.WPz)(e,t,n,"typingStatus");i&&s&&i.timestamp===s.timestamp&&(e=(0,w.pf)(e,t,n,"typingStatus",void 0),(0,a.R3)(e))}),6e3)}case"newMessage":{const{message:t}=s;if(t.senderId===e.currentUserId&&!t.isFromScheduled)return;const n=(0,b.Z1J)(e,s.chatId);if(!n)return;const i=Boolean(s.message.id&&s.message.hasUnreadMention);e=(0,w.a4)(e,s.chatId,{unreadCount:n.unreadCount?n.unreadCount+1:1,...i&&{unreadMentionsCount:(n.unreadMentionsCount||0)+1}}),i&&(e=(0,w.a4)(e,s.chatId,{unreadMentions:[...n.unreadMentions||[],s.message.id]}));const o=n.isForum?(0,b.p$s)(e,t):void 0;return o&&(e=(0,w.Cn)(e,s.chatId,o.id,{unreadCount:o.unreadCount?o.unreadCount+1:1})),(0,a.R3)(e),void(0,P.rh)({chat:n,message:t})}case"updateCommonBoxMessages":case"updateChannelMessages":{const{ids:t,messageUpdate:a}=s;if(!1!==a.hasUnreadMention)return;return t.forEach((t=>{const a="channelId"in s?s.channelId:(0,b.X5I)(e,t),n=(0,b.Z1J)(e,a);n?.unreadReactionsCount&&(e=L(e,a,{unreadReactionsCount:n.unreadReactionsCount-1||void 0,unreadReactions:n.unreadReactions?.filter((e=>e!==t))})),n?.unreadMentionsCount&&(e=(0,w.a4)(e,a,{unreadMentionsCount:n.unreadMentionsCount-1||void 0,unreadMentions:n.unreadMentions?.filter((e=>e!==t))}))})),e}case"updateChatFullInfo":return(0,w.US)(e,s.id,s.fullInfo);case"updatePinnedChatIds":{const{ids:t,folderId:a}=s,i=a===n.WSp?"archived":"active";return{...e,chats:{...e.chats,orderedPinnedIds:{...e.chats.orderedPinnedIds,[i]:t.length?t:void 0}}}}case"updatePinnedSavedDialogIds":{const{ids:t}=s;return{...e,chats:{...e.chats,orderedPinnedIds:{...e.chats.orderedPinnedIds,saved:t.length?t:void 0}}}}case"updateChatPinned":{const{id:t,isPinned:a}=s,i=(0,b.EkO)(e,t);if(!i)return;const{[i]:o}=e.chats.orderedPinnedIds;let r=o||[];if(a){if(!r.includes(t)){if("active"===i&&r.length>=n.EGK){const t=e.chats.listIds.active;r=r.filter((e=>t&&t.includes(e)))}r=[t,...r]}}else r=r.filter((e=>e!==t));return{...e,chats:{...e.chats,orderedPinnedIds:{...e.chats.orderedPinnedIds,[i]:r.length?r:void 0}}}}case"updateSavedDialogPinned":{const{id:t,isPinned:a}=s,{saved:n}=e.chats.orderedPinnedIds;let i=n||[];return a?i.includes(t)||(i=[t,...i]):i=i.filter((e=>e!==t)),{...e,chats:{...e.chats,orderedPinnedIds:{...e.chats.orderedPinnedIds,saved:i.length?i:void 0}}}}case"updateChatListType":{const{id:t,folderId:a}=s;return(0,w.Pi)(e,t,a)}case"updateChatFolder":{const{id:t,folder:a}=s,{byId:n,orderedIds:i}=e.chatFolders,o=void 0===a;Object.values(e.byTabId).forEach((({id:s})=>{const a=(0,b.jUK)(e,s);Object.values(n)[a.activeChatFolder-1]?.id===t&&(e=(0,v.i)(e,{activeChatFolder:0},s))}));const r=o?(0,m.CE)(n,[t]):{...n,[t]:a},c=o?i?.filter((e=>e!==t)):i?.includes(t)?i:[...i||[],t];return{...e,chatFolders:{...e.chatFolders,byId:r,orderedIds:c,invites:(0,m.CE)(e.chatFolders.invites,[t])}}}case"updateChatFoldersOrder":{const{orderedIds:t}=s;return{...e,chatFolders:{...e.chatFolders,orderedIds:t}}}case"updateRecommendedChatFolders":{const{folders:t}=s;return{...e,chatFolders:{...e.chatFolders,recommended:t}}}case"updateChatMembers":{const t=(0,b.x67)(e,s.id),{replacedMembers:a,addedMember:n,deletedMemberId:i}=s;if(!t)return;let o=!1,r=t?.members?[...t.members]:[];if(a)r=a,o=!0;else if(n)r.length&&r.some((e=>e.userId===n.userId))||(r.push(n),o=!0);else if(r.length&&i){const e=r.findIndex((e=>e.userId===i));e>-1&&(r.slice(e,1),o=!0)}if(o){const t=r.filter((({isOwner:e,isAdmin:t})=>e||t));return e=(0,w.a4)(e,s.id,{membersCount:r.length}),e=(0,w.US)(e,s.id,{members:r,adminMembersById:(0,m.ee)(t,"userId")})}return}case"deleteProfilePhotos":{const{chatId:t,ids:a}=s,n=e.chats.byId[t];return n?.photos?(0,w.a4)(e,t,{photos:n.photos.filter((e=>!a.includes(e.id)))}):void 0}case"draftMessage":{const{chatId:t,threadId:a,draft:n}=s;if(!e.chats.byId[t])return;return e=(0,w.pf)(e,t,a||r._f,"draft",n),e=(0,w.a4)(e,t,{draftDate:n?.date})}case"showInvite":{const{data:a}=s;return void Object.values(e.byTabId).forEach((({id:e})=>{t.showDialog({data:a,tabId:e})}))}case"updatePendingJoinRequests":{const{chatId:n,requestsPending:i,recentRequesterIds:o}=s;if(!e.chats.byId[n])return;return e=(0,w.US)(e,n,{requestsPending:i,recentRequesterIds:o}),(0,a.R3)(e),void t.loadChatJoinRequests({chatId:n})}case"updatePinnedTopic":{const{chatId:t,topicId:n,isPinned:i}=s;if(!e.chats.byId[t])return;return e=(0,w.Cn)(e,t,n,{isPinned:i}),void(0,a.R3)(e)}case"updatePinnedTopicsOrder":{const{chatId:t,order:n}=s;if(!e.chats.byId[t])return;return e=(0,w.a4)(e,t,{orderedPinnedTopicIds:n}),void(0,a.R3)(e)}case"updateTopic":{const{chatId:a,topicId:n}=s,i=(0,b.Z1J)(e,a);if(!i?.isForum)return;return void t.loadTopicById({chatId:a,topicId:n})}case"updateTopics":{const{chatId:a}=s,n=(0,b.Z1J)(e,a);if(!n?.isForum)return;return void t.loadTopics({chatId:a,force:!0})}case"updateViewForumAsMessages":{const{chatId:t,isEnabled:n}=s,i=(0,b.Z1J)(e,t);if(!i?.isForum)return;e=(0,w.a4)(e,t,{isForumAsMessages:n}),(0,a.R3)(e)}}}));const Ct=(0,g.P2)((function(){let e=(0,a.Rd)();e=(0,w.ps)(e,{...e.users.statusesById,...Mt}),(0,a.R3)(e),Mt={}}),3e3,!0);let Mt={};(0,a.iw)("apiUpdate",((e,t,s)=>{switch(s["@type"]){case"deleteContact":return(0,w.GK)(e,s.id);case"updateUser":{Object.values(e.byTabId).forEach((({id:a})=>{(0,b.FM1)(e,s.id)&&s.user.isPremium!==(0,b.wVz)(e)&&(s.user.isPremium&&e.byTabId[a].premiumModal&&t.openPremiumModal({isSuccess:!0,tabId:a}),e={...e,translations:{byChatId:{}}})}));const a=(0,b.dyD)(e,s.id);return e=(0,w.Nq)(e,s.id,s.user),s.fullInfo&&(e=(0,w.ap)(e,s.id,s.fullInfo)),a?.areStoriesHidden!==s.user.areStoriesHidden&&(e=(0,w.QO)(e,s.id,s.user.areStoriesHidden||!1)),e}case"updateRequestUserUpdate":t.loadFullUser({userId:s.id});break;case"updateUserEmojiStatus":return(0,w.Nq)(e,s.userId,{emojiStatus:s.emojiStatus});case"updateUserStatus":return a=s.userId,n=s.status,Mt[a]=n,void Ct();case"updateUserFullInfo":{const{id:t,fullInfo:a}=s;return(0,w.ap)(e,t,a)}case"updateBotMenuButton":{const{botId:t,button:a}=s,n=(0,b.ccz)(e,t);if(!n?.botInfo)return;return(0,w.ap)(e,t,{botInfo:{...n.botInfo,menuButton:a}})}}var a,n})),(0,a.iw)("apiUpdate",((e,t,s)=>{if("updateStickerSet"===s["@type"])return(0,w.Rg)(e,s.id,s.stickerSet)})),(0,a.iw)("apiUpdate",((e,t,s)=>{switch(s["@type"]){case"updatePeerBlocked":return s.isBlocked?(0,w.h7)(e,s.id):s.isBlockedFromStories?e:(0,w.kw)(e,s.id);case"updateResetContactList":e={...e,contactList:{userIds:[]}},(0,a.R3)(e);break;case"updateConfig":t.loadConfig();break;case"updateNewAuthorization":t.loadAuthorizations();break;case"updateFavoriteStickers":t.loadFavoriteStickers();break;case"updateRecentStickers":t.loadRecentStickers();break;case"updateRecentReactions":t.loadRecentReactions();break;case"updateRecentEmojiStatuses":t.loadRecentEmojiStatuses();break;case"updateSavedReactionTags":t.loadSavedReactionTags();break;case"updateMoveStickerSetToTop":{const a=s.isCustomEmoji?e.customEmojis.added.setIds:e.stickers.added.setIds;if(!a)return e;const n=[s.id,...a.filter((e=>e!==s.id))];t.reorderStickerSets({order:n,isCustomEmoji:s.isCustomEmoji});break}case"updateStickerSets":t.loadStickerSets();break;case"updateStickerSetsOrder":{const a=s.order.filter((t=>Boolean(e.stickers.setsById[t])));t.reorderStickerSets({order:a,isCustomEmoji:s.isCustomEmoji});break}case"updateSavedGifs":t.loadSavedGifs();break;case"updatePrivacy":e={...e,settings:{...e.settings,privacy:{...e.settings.privacy,[s.key]:s.rules}}},(0,a.R3)(e);break;case"updatePaymentVerificationNeeded":Object.values(e.byTabId).forEach((({id:t})=>{e=(0,w.fS)(e,s.url,t),e=(0,w.Q$)(e,c.KB.ConfirmPayment,t)})),(0,a.R3)(e);break;case"updateWebViewResultSent":Object.values(e.byTabId).forEach((e=>{e.webApp?.queryId===s.queryId&&(t.resetDraftReplyInfo({tabId:e.id}),t.closeWebApp({tabId:e.id}))}));break;case"updateStory":e=(0,w._6)(e,s.peerId,{[s.story.id]:s.story}),e=(0,w.Fz)(e,{[s.peerId]:(0,b.nST)(e,s.peerId)}),(0,a.R3)(e);break;case"deleteStory":e=(0,w.se)(e,s.peerId,s.storyId),(0,a.R3)(e);break;case"updateReadStories":e=(0,w.P5)(e,s.peerId,s.lastReadId),(0,a.R3)(e);break;case"updateSentStoryReaction":{const{peerId:t,storyId:n,reaction:i}=s;if(!(0,b.JrV)(e,t,n))return e;e=(0,w.w2)(e,t,n,{sentReaction:i}),(0,a.R3)(e);break}case"updateStealthMode":e=(0,w.Uq)(e,s.stealthMode),(0,a.R3)(e);break;case"updateAttachMenuBots":t.loadAttachBots({hash:e.attachMenu.hash})}})),(0,a.iw)("apiUpdate",((e,t,s)=>{switch(s["@type"]){case"updateNotifySettings":return(0,w.HN)(e,s.peerType,s.isSilent,s.shouldShowPreviews);case"updateNotifyExceptions":{const{chatId:t,isMuted:n,isSilent:i,shouldShowPreviews:o}=s;e.chats.byId[t]&&(e=(0,w.a4)(e,t,{isMuted:n})),e=(0,w.aK)(e,t,{isMuted:n,isSilent:i,shouldShowPreviews:o}),(0,a.R3)(e);break}case"updateTopicNotifyExceptions":{const{chatId:t,topicId:n,isMuted:i}=s;e=(0,w.Cn)(e,t,n,{isMuted:i}),(0,a.R3)(e);break}}})),(0,a.iw)("apiUpdate",((e,t,s)=>{switch(s["@type"]){case"updateTwoFaStateWaitCode":return{...e,twoFaSettings:{...e.twoFaSettings,isLoading:!1,waitingEmailCodeLength:s.length}};case"updateTwoFaError":return{...e,twoFaSettings:{...e.twoFaSettings,error:s.message}}}}));var Et=s(78958),Rt=s(42431);(0,a.iw)("apiUpdate",((e,t,s)=>{switch(s["@type"]){case"updateGroupCall":{if("discarded"===s.call.connectionState)return e.groupCalls.activeGroupCallId?void("leaveGroupCall"in t&&t.leaveGroupCall({shouldRemove:!0,tabId:(0,u._w)()})):(0,Et.dc)(e,s.call.id);const a=(0,Rt.$5)(e,s.call.id),n=a?.chatId;return n&&(e=(0,w.a4)(e,n,{isCallNotEmpty:a.participantsCount>0||Boolean(a.participants?.length)})),(0,Et.AH)(e,s.call.id,(0,m.CE)(s.call,["connectionState"]),void 0,s.call.participantsCount)}case"updateGroupCallChatId":return(0,b.Z1J)(e,s.chatId)&&(e=(0,w.US)(e,s.chatId,{groupCallId:s.call.id})),e;case"updateGroupCallParticipants":{const{groupCallId:t,participants:n,nextOffset:i}=s,{currentUserId:o}=e;e=(0,a.Rd)(),n.forEach((s=>{s.id&&(e=(0,Et.B6)(e,t,s.id,s,Boolean(i)||o===s.id))})),i&&(e=(0,Et.AH)(e,t,{nextOffset:i}));const r=(0,Rt.$5)(e,t),c=r?.chatId;return c&&(e=(0,w.a4)(e,c,{isCallNotEmpty:r.participantsCount>0||Boolean(r.participants?.length)})),e}case"updatePhoneCall":{if(!i.Bi)return;const{phoneCall:n,currentUserId:o}=e,{call:r}=s;if(n)return"discarded"===r.state?(t.playGroupCallSound({sound:"end"}),"hangUp"in t&&t.hangUp({tabId:(0,u._w)()}),{...e,...r.needRating&&{ratingPhoneCall:r}}):void 0;if(r?.adminId!==o&&"requested"===r.state)return(0,g.R3)((()=>{e=(0,a.Rd)(),(0,P.TO)({call:r,user:(0,Rt.fu)(e)})})),(0,st.EP)(),(0,st.CW)(e,t,r.isVideo,(0,u._w)()),e={...e,phoneCall:r},(0,v.i)(e,{isCallPanelVisible:!1},(0,u._w)())}}}));var kt=s(9937);(0,a.iw)("apiUpdate",((e,t,s)=>{"updatePaymentStateCompleted"===s["@type"]&&Object.values(e.byTabId).forEach((({id:a})=>{const{inputInvoice:n}=(0,b.jUK)(e,a).payment;if(n&&"chatId"in n&&"messageId"in n){const s=(0,b.hjO)(e,n.chatId,n.messageId);if(s&&s.content.invoice){const{amount:e,currency:n,title:i}=s.content.invoice;t.showNotification({tabId:a,message:h.Iu("PaymentInfoHint",[(0,kt.x)(e,n,h.QO().code),i])})}}i.Xp||(e=(0,w.WY)(e,a)),s.slug&&n&&"slug"in n&&n.slug!==s.slug||(e=(0,v.i)(e,{payment:{...(0,b.jUK)(e,a).payment,status:"paid"}},a))}))}));var Tt=s(60748),Nt=s(31664),At=s(73760),Bt=s(57710),xt=s(46752),Ut=s(1279),Lt=s(53551),Ot=s(99203),_t=s(96557),Ft=s(49488),Dt=s(65326),jt=s(18674),qt=s(25190);const Gt=document.querySelector('meta[name="viewport"]'),Ht=Gt?.getAttribute("content")||"";function Vt(e){e.preventDefault()}var $t=s(31212),zt=s(34446),Kt=s(13819),Jt=s(20797),Wt=s(80498),Yt=s(48778);const Xt=e=>{const{isActive:t}=e,s=(0,Yt.Z)(Ot.gl.Calls,"ActiveCallHeader",!t);return s?Tt.ZP.createElement(s,null):void 0},Qt=e=>{const{groupCallId:t}=e,s=(0,Yt.Z)(Ot.gl.Calls,"GroupCall",!t);return s?Tt.ZP.createElement(s,e):void 0},es=e=>{const{isActive:t}=e,s=(0,Yt.Z)(Ot.gl.Calls,"PhoneCall",!t);return s?Tt.ZP.createElement(s,null):void 0},ts=e=>{const{isOpen:t}=e,s=(0,Yt.Z)(Ot.gl.Calls,"RatePhoneCallModal",!t);return s?Tt.ZP.createElement(s,e):void 0},ss=e=>{const{customEmojiSetIds:t}=e,s=(0,Yt.Z)(Ot.gl.Extra,"CustomEmojiSetsModal",!t);return s?Tt.ZP.createElement(s,e):void 0},as=e=>{const{isOpen:t}=e,s=(0,Yt.Z)(Ot.gl.Extra,"StickerSetModal",!t);return s?Tt.ZP.createElement(s,e):void 0};var ns=s(17358),is=s(2155),os=s(95616);const rs=(0,Tt.X$)((({isForAppBadge:e})=>{(0,os.yi)();const t=(0,pe.xW)();if((0,Tt.d4)((()=>{e&&(0,ns.w)(t)}),[e,t]),!e&&t)return Tt.ZP.createElement("div",{className:"unread-count active"},(0,is.bi)(t))}));var cs=s(23989),ds=s(29371),ls=s(53455),us=s(73541),ms=s(70971),hs=s(2255),ps=s(34288);const gs=e=>{const t=(0,Yt.Z)(Ot.gl.Extra,"ArchivedChats");return t?Tt.ZP.createElement(t,e):Tt.ZP.createElement(ps.Z,null)};var fs=s(54416),Is=s(59107),ws=s(231),vs=s(52328),bs=s(58964);const ys=({isShown:e,onNewPrivateChat:t,onNewChannel:s,onNewGroup:a})=>{const[n,i]=(0,Tt.eJ)(!1);(0,Tt.d4)((()=>{e||i(!1)}),[e]);const o=(0,Is.Z)(),r=(0,xt.Z)("NewChatButton",e&&"revealed",n&&"menu-is-open"),c=(0,Tt.I4)((()=>{i(!n)}),[n]),d=(0,Tt.I4)((()=>{i(!1)}),[]),l=(0,Tt.Ye)((()=>Tt.ZP.createElement(Tt.ZP.Fragment,null,Tt.ZP.createElement(bs.Z,{icon:"channel",onClick:s},o("NewChannel")),Tt.ZP.createElement(bs.Z,{icon:"group",onClick:a},o("NewGroup")),Tt.ZP.createElement(bs.Z,{icon:"user",onClick:t},o("NewMessageTitle")))),[o,s,a,t]);return Tt.ZP.createElement("div",{className:r,dir:o.isRtl?"rtl":void 0},Tt.ZP.createElement(ws.Z,{round:!0,color:"primary",className:n?"active":"",onClick:c,ariaLabel:o(n?"Close":"NewMessageTitle"),tabIndex:-1},Tt.ZP.createElement("i",{className:"icon icon-new-chat-filled"}),Tt.ZP.createElement("i",{className:"icon icon-close"})),Tt.ZP.createElement(vs.Z,{isOpen:n,positionX:o.isRtl?"left":"right",positionY:"bottom",autoClose:!0,onClose:d},l))},Ps=e=>{const t=(0,Yt.Z)(Ot.gl.Extra,"LeftSearch");return t?Tt.ZP.createElement(t,e):Tt.ZP.createElement(ps.Z,null)};var Zs=s(64963),Ss=s(46590),Cs=s(47505),Ms=s(31711),Es=s(40340);const Rs=(0,Tt.X$)((0,a.c$)((e=>{const{chatFolders:{byId:t,orderedIds:s,invites:a},chats:{listIds:{archived:n}},stories:{orderedPeerIds:{archived:i}},activeSessions:{byHash:o},currentUserId:r,archiveSettings:c}=e,{shouldSkipHistoryAnimations:d,activeChatFolder:l}=(0,b.jUK)(e),{storyViewer:{isRibbonShown:u}}=(0,b.jUK)(e);return{chatFoldersById:t,folderInvitesById:a,orderedFolderIds:s,activeChatFolder:l,currentUserId:r,shouldSkipHistoryAnimations:d,hasArchivedChats:Boolean(n?.length),hasArchivedStories:Boolean(i?.length),maxFolders:(0,se.M)(e,"dialogFilters"),maxFolderInvites:(0,se.M)(e,"chatlistInvites"),maxChatLists:(0,se.M)(e,"chatlistJoined"),archiveSettings:c,isStoryRibbonShown:u,sessions:o}}))((({foldersDispatch:e,onSettingsScreenSelect:t,onLeftColumnContentChange:s,chatFoldersById:o,orderedFolderIds:r,activeChatFolder:c,currentUserId:d,isForumPanelOpen:l,shouldSkipHistoryAnimations:u,maxFolders:m,maxChatLists:h,shouldHideFolderTabs:p,folderInvitesById:g,maxFolderInvites:f,hasArchivedChats:I,hasArchivedStories:w,archiveSettings:v,isStoryRibbonShown:y,sessions:P})=>{const{loadChatFolders:Z,setActiveChatFolder:S,openChat:C,openShareChatFolderModal:M,openDeleteChatFolderModal:E,openEditChatFolder:R,openLimitReachedModal:k}=(0,a.Sv)(),T=(0,Tt.sO)(null),N=(0,Is.Z)();(0,Tt.d4)((()=>{Z()}),[]);const{shouldRender:A,transitionClassNames:B,isClosing:x}=(0,$t.Z)(y,void 0,void 0,""),U=(0,Tt.Ye)((()=>({id:n.NfV,title:r?.[0]===n.NfV?N("FilterAllChatsShort"):N("FilterAllChats"),includedChatIds:Oe.D,excludedChatIds:Oe.D})),[r,N]),L=(0,Tt.Ye)((()=>r?r.map((e=>e===n.NfV?U:o[e]||{})).filter(Boolean):void 0),[o,U,r]),O=L?.findIndex((e=>e.id===n.NfV)),_=O===c,F=0===c,D=(0,os.yi)(),j=(0,Tt.Ye)((()=>{if(L&&L.length)return L.map(((e,t)=>{const{id:s,title:i}=e,r=s!==n.NfV&&t>m-1,c=[];return(0,b.yEv)((0,a.Rd)(),s)&&c.push({title:N("ChatList.ContextMenuShare"),icon:"link",handler:()=>{Object.values(o).reduce(((e,t)=>e+(t.isChatList?1:0)),0)>=h&&!e.isChatList?k({limit:"chatlistJoined"}):g[s]?.length>=f?k({limit:"chatlistInvites"}):M({folderId:s})}}),s!==n.NfV&&(c.push({title:N("FilterEdit"),icon:"edit",handler:()=>{R({folderId:s})}}),c.push({title:N("FilterDeleteItem"),icon:"delete",destructive:!0,handler:()=>{E({folderId:s})}})),{id:s,title:i,badgeCount:D[s]?.chatsCount,isBadgeActive:Boolean(D[s]?.notificationsCount),isBlocked:r,contextActions:c?.length?c:void 0}}))}),[L,m,D,N,o,h,g,f]),q=(0,qt.Z)((e=>{S({activeChatFolder:e},{forceOnHeavyAnimation:!0})}));(0,Tt.d4)((()=>{j?.length&&c>=j.length&&S({activeChatFolder:0})}),[c,j,S]),(0,Tt.d4)((()=>{if(i.$b&&j?.length&&!l)return(0,Zs.sf)(T.current,{selectorToPreventScroll:".chat-list",onSwipe:(e,t)=>t===Zs.eM.Left?(S({activeChatFolder:Math.min(c+1,j.length-1)},{forceOnHeavyAnimation:!0}),!0):t===Zs.eM.Right&&(S({activeChatFolder:Math.max(0,c-1)},{forceOnHeavyAnimation:!0}),!0)})}),[c,j,l,S]);const G=(0,Tt.sO)();G.current=!F,(0,Tt.d4)((()=>G.current?(0,cs.Z)((()=>{G.current&&S({activeChatFolder:0})})):void 0),[c,S]),(0,Ss.Z)({isActive:!F,onBack:()=>S({activeChatFolder:0},{forceOnHeavyAnimation:!0})}),(0,Tt.d4)((()=>{const e=e=>{if(e.ctrlKey&&e.shiftKey&&e.code.startsWith("Digit")&&j){const[,t]=e.code.match(/Digit(\d)/)||[];if(!t)return;if("0"===t)return void C({id:d,shouldReplaceHistory:!0});const s=Number(t)-1;if(s>j.length-1)return;S({activeChatFolder:s},{forceOnHeavyAnimation:!0}),e.preventDefault()}};return document.addEventListener("keydown",e,!0),()=>{document.removeEventListener("keydown",e,!0)}}),[d,j,C,S]);const{shouldRender:H,transitionClassNames:V}=(0,$t.Z)(!r,void 0,!0);function $(a){const n=Object.values(o).find((({id:e})=>e===j[c].id)),i=n&&!_;return Tt.ZP.createElement(Es.Z,{folderType:i?"folder":"all",folderId:i?n.id:void 0,isActive:a,isForumPanelOpen:l,foldersDispatch:e,onSettingsScreenSelect:t,onLeftColumnContentChange:s,canDisplayArchive:(I||w)&&!v.isHidden,archiveSettings:v,sessions:P})}const z=j&&j.length>1;return Tt.ZP.createElement("div",{className:(0,xt.Z)("ChatFolders",z&&p&&"ChatFolders--tabs-hidden",A&&"with-story-ribbon",B)},A&&Tt.ZP.createElement(Cs.Z,{isClosing:x}),z?Tt.ZP.createElement(Ms.Z,{contextRootElementSelector:"#LeftColumn",tabs:j,activeTab:c,onSwitchTab:q,areFolders:!0}):H?Tt.ZP.createElement("div",{className:(0,xt.Z)("tabs-placeholder",V)}):void 0,Tt.ZP.createElement(hs.ZP,{ref:T,name:u?"none":N.isRtl?"slideOptimizedRtl":"slideOptimized",activeKey:c,renderCount:z?j.length:void 0},$))}))),ks=e=>{const t=(0,Yt.Z)(Ot.gl.Extra,"ContactList");return t?Tt.ZP.createElement(t,e):Tt.ZP.createElement(ps.Z,null)};var Ts=s(59690);let Ns=function(e){return e[e.waitingForNetwork=0]="waitingForNetwork",e[e.syncing=1]="syncing",e[e.online=2]="online",e}({});function As(e,t,s,a,n,i){let o,r,c;return o=function(){const[e,t]=(0,Tt.eJ)(window.navigator.onLine);return(0,Tt.d4)((()=>{function e(){t(window.navigator.onLine)}return window.addEventListener("online",e),window.addEventListener("offline",e),()=>{window.removeEventListener("offline",e),window.removeEventListener("online",e)}}),[]),e}()&&"connectionStateConnecting"!==t?s?Ns.syncing:Ns.online:Ns.waitingForNetwork,r=o===Ns.online||i?"none":a?"middleHeader":n?"minimized":"overlay",o===Ns.waitingForNetwork?c=e("WaitingForNetwork"):o===Ns.syncing&&(c=e("Updating")),"middleHeader"===r&&(c=c.toLowerCase().replace(/\.+$/,"")),{connectionStatus:o,connectionStatusPosition:r,connectionStatusText:c}}var Bs=s(97458),xs=s(60706),Us=s(73217),Ls=s(49187),Os=s(85194),_s=s(53106),Fs=s(69589),Ds=s(40126),js=s(49204);const qs=(0,Tt.X$)((({connectionStatus:e,connectionStatusText:t,onClick:s})=>{const a=(0,Is.Z)();return Tt.ZP.createElement("div",{id:"ConnectionStatusOverlay",dir:a.isRtl?"rtl":void 0,onClick:s},Tt.ZP.createElement(js.Z,{color:"black"}),Tt.ZP.createElement("div",{className:"state-text"},Tt.ZP.createElement(hs.ZP,{activeKey:e,name:"slideFade"},t)),Tt.ZP.createElement(ws.Z,{round:!0,size:"tiny",color:"translucent-black"},Tt.ZP.createElement("span",{className:"icon icon-close"})))}));var Gs=s(36046),Hs=s(17926),Vs=s(43159),$s=s(83321),zs=s(79994);const Ks=(0,Tt.X$)((0,a.c$)((e=>{const t=(0,b.jUK)(e),{currentUserId:s,archiveSettings:a}=e,{animationLevel:n}=e.settings.byKey,i=e.attachMenu.bots;return{currentUserId:s,theme:(0,b.Puy)(e),animationLevel:n,canInstall:Boolean(t.canInstall),archiveSettings:a,attachBots:i}}))((({currentUserId:e,archiveSettings:t,animationLevel:s,theme:o,canInstall:r,attachBots:c,onSelectArchived:d,onSelectContacts:l,onSelectSettings:u,onBotMenuOpened:m,onBotMenuClosed:h})=>{const{openChat:p,setSettingOption:g,updatePerformanceSettings:f,openChatByUsername:I,openUrl:w,openChatWithInfo:v}=(0,a.Sv)(),b=(0,Is.Z)(),y=s!==n.oBh?s===n.zy8?"max":"mid":"min",P=!i.D$&&(window.location.hostname===n.xHY||n.Cgt),Z=(0,os.yi)()[n.WSp]?.chatsCount||0,S=(0,Tt.Ye)((()=>Object.values(c).filter((e=>e.isForSideMenu))),[c]),C=(0,qt.Z)((()=>{p({id:e,shouldReplaceHistory:!0})})),M=(0,qt.Z)((e=>{e.stopPropagation(),g({theme:"light"===o?"dark":"light"}),g({shouldUseSystemTheme:!1})})),E=(0,qt.Z)((e=>{e.stopPropagation();let t=s+1;t>n.zy8&&(t=n.oBh);const a=t===n.oBh?ot.ww:t===n.zy8?ot.WD:ot.LN;g({animationLevel:t}),f(a)})),R=(0,qt.Z)((()=>{window.open(n.ulW,"_blank","noopener")})),k=(0,qt.Z)((()=>{(0,Hs.El)("K")})),T=(0,qt.Z)((()=>{I({username:b("Settings.TipsUsername")})})),N=(0,qt.Z)((()=>{w({url:n.mUA})})),A=(0,qt.Z)((()=>{v({id:e,shouldReplaceHistory:!0,profileTab:"stories"})}));return Tt.ZP.createElement(Tt.ZP.Fragment,null,Tt.ZP.createElement(bs.Z,{icon:"saved-messages",onClick:C},b("SavedMessages")),t.isHidden&&Tt.ZP.createElement(bs.Z,{icon:"archive",onClick:d},Tt.ZP.createElement("span",{className:"menu-item-name"},b("ArchivedChats")),Z>0&&Tt.ZP.createElement("div",{className:"right-badge"},Z)),Tt.ZP.createElement(bs.Z,{icon:"user",onClick:l},b("Contacts")),S.map((e=>Tt.ZP.createElement(Vs.Z,{bot:e,theme:o,isInSideMenu:!0,canShowNew:!0,onMenuOpened:m,onMenuClosed:h}))),Tt.ZP.createElement(bs.Z,{icon:"play-story",onClick:A},b("Settings.MyStories")),Tt.ZP.createElement(bs.Z,{icon:"settings",onClick:u},b("Settings")),Tt.ZP.createElement(bs.Z,{icon:"darkmode",onClick:M},Tt.ZP.createElement("span",{className:"menu-item-name"},b("lng_menu_night_mode")),Tt.ZP.createElement($s.Z,{id:"darkmode",label:b("dark"===o?"lng_settings_disable_night_theme":"lng_settings_enable_night_theme"),checked:"dark"===o,noAnimation:!0})),Tt.ZP.createElement(bs.Z,{icon:"animations",onClick:E},Tt.ZP.createElement("span",{className:"menu-item-name capitalize"},b("Appearance.Animations").toLowerCase()),Tt.ZP.createElement(zs.Z,{value:y})),Tt.ZP.createElement(bs.Z,{icon:"help",onClick:T},b("TelegramFeatures")),Tt.ZP.createElement(bs.Z,{icon:"bug",onClick:N},"Report Bug"),n.Tjg&&Tt.ZP.createElement(bs.Z,{icon:"permissions",onClick:R},"Beta Changelog"),P&&Tt.ZP.createElement(bs.Z,{icon:"K",isCharIcon:!0,href:`${n.OfM}k`,onClick:k},"Switch to K Version"),r&&Tt.ZP.createElement(bs.Z,{icon:"install",onClick:(0,Gs.G)()},"Install App"))})));var Js=s(274),Ws=s(96459),Ys=s(4863),Xs=s(67427);const Qs=e=>{const{isOpen:t}=e,s=(0,Yt.Z)(Ot.gl.Extra,"StatusPickerMenu",!t);return s?Tt.ZP.createElement(s,e):void 0},ea=(0,Tt.X$)((0,a.c$)((e=>{const{currentUserId:t}=e,s=t?(0,b.dyD)(e,t):void 0;return{emojiStatus:s?.emojiStatus}}))((({emojiStatus:e})=>{const{setEmojiStatus:t,loadCurrentUser:s}=(0,a.Sv)(),i=(0,Tt.sO)(null),[o,r,c]=(0,xs.Z)(!1),[d,l,u]=(0,xs.Z)(!1),[m,h,p]=(0,xs.Z)(!1),{isMobile:g}=(0,B.ZP)(),f=e?.until?1e3*e.until-Date.now()+1e3*(0,we.Qj)():void 0;(0,Ft.Z)(s,f),(0,Js.Z)((([t])=>{o&&e&&t&&e.documentId!==t.documentId&&(l(),c())}),[e,o,l,c]);const I=(0,Tt.I4)((e=>{r(),t({emojiStatus:e})}),[r,t]);(0,Ft.Z)(u,d?1500:void 0);const w=(0,Tt.I4)((()=>{h()}),[h]);return Tt.ZP.createElement("div",{className:"extra-spacing"},Boolean(d&&e)&&Tt.ZP.createElement(Xs.Z,{reaction:e,isLottie:!0,className:"emoji-status-effect"}),Tt.ZP.createElement(ws.Z,{round:!0,ref:i,ripple:!g,size:"smaller",color:"translucent",className:"emoji-status",onClick:w},e?Tt.ZP.createElement(Ws.Z,{key:e.documentId,documentId:e.documentId,size:24,loopLimit:n.y3O}):Tt.ZP.createElement(Ys.Z,null)),Tt.ZP.createElement(Qs,{statusButtonRef:i,isOpen:m,onEmojiStatusSelect:I,onClose:p}))}))),ta={date:void 0},sa={id:void 0},aa=(0,Tt.X$)((0,a.c$)((e=>{const t=(0,b.jUK)(e),{query:s,fetchingStatus:a,chatId:n,date:i}=t.globalSearch,{connectionState:o,isSyncing:r,isFetchingDifference:c}=e,{isConnectionStatusMinimized:d}=e.settings.byKey;return{searchQuery:s,isLoading:!!a&&Boolean(a.chats||a.messages),globalSearchChatId:n,searchDate:i,theme:(0,b.Puy)(e),connectionState:o,isSyncing:r,isFetchingDifference:c,isMessageListOpen:Boolean((0,b.Btg)(e)),isConnectionStatusMinimized:d,isCurrentUserPremium:(0,b.wVz)(e),areChatsLoaded:Boolean(e.chats.listIds.active),hasPasscode:Boolean(e.passcode.hasPasscode),canSetPasscode:(0,b.eB8)(e)}}))((({shouldHideSearch:e,content:t,contactsFilter:s,isClosingSearch:o,searchQuery:r,isLoading:d,isCurrentUserPremium:l,shouldSkipTransition:u,globalSearchChatId:m,searchDate:h,theme:p,connectionState:g,isSyncing:f,isFetchingDifference:I,isMessageListOpen:w,isConnectionStatusMinimized:v,areChatsLoaded:b,hasPasscode:y,canSetPasscode:P,onSearchQuery:Z,onSelectSettings:S,onSelectContacts:C,onSelectArchived:M,onReset:E})=>{const{setGlobalSearchDate:R,setSettingOption:k,setGlobalSearchChatId:T,lockScreen:N,requestNextSettingsScreen:A}=(0,a.Sv)(),x=(0,Is.Z)(),{isMobile:U}=(0,B.ZP)(),[L,O,_]=(0,xs.Z)(),F=t===c.du.ChatList,D=(0,Tt.Ye)((()=>h?(0,re.xH)(new Date(1e3*h)):void 0),[h]),{connectionStatus:j,connectionStatusText:q,connectionStatusPosition:G}=As(x,g,f||I,w,v,!b),H=(0,qt.Z)((e=>{e.preventDefault(),e.stopPropagation(),y?N():A({screen:c.MT.PasscodeDisabled})}));(0,us.y)(P?{"Ctrl+Shift+L":H,"Alt+Shift+L":H,"Meta+Shift+L":H,...i.RM&&{"Mod+L":H}}:void 0);const V=(0,Tt.Ye)((()=>({onTrigger:e,isOpen:t})=>Tt.ZP.createElement(ws.Z,{round:!0,ripple:F&&!U,size:"smaller",color:"translucent",className:t?"active":"",onClick:F?e:()=>E(),ariaLabel:F?x("AccDescrOpenMenu2"):"Return to chat list"},Tt.ZP.createElement("div",{className:(0,xt.Z)("animated-menu-icon",!F&&"state-back",u&&"no-animation")}))),[F,U,x,E,u]),$=(0,qt.Z)((()=>{r||Z("")})),z=(0,qt.Z)((()=>{k({isConnectionStatusMinimized:!v})})),K=(0,qt.Z)((()=>{N()})),J=Boolean(m)||t===c.du.GlobalSearch||t===c.du.Contacts;(0,Tt.d4)((()=>J?(0,cs.Z)((()=>E())):void 0),[J,E]);const W=t===c.du.Contacts?x("SearchFriends"):x("Search"),Y=n.Tjg?"10.4.9 Beta (master)":n.eMD?"master":"10.4.9",X=(0,Wt.Ar)(),{shouldDisableDropdownMenuTransitionRef:Q,handleDropdownMenuTransitionEnd:ee}=(0,Us.Z)(e),te=(0,Tt.sO)(null);(0,Bs.Z)(te);const se=(0,Tt.Ye)((()=>Tt.ZP.createElement(Tt.ZP.Fragment,null,D&&Tt.ZP.createElement(Ls.Z,{icon:"calendar",title:D,canClose:!0,isMinimized:Boolean(m),className:"search-date",onClick:R,clickArg:ta}),m&&Tt.ZP.createElement(Ls.Z,{peerId:m,onClick:T,canClose:!0,clickArg:sa}))),[m,D]);return Tt.ZP.createElement("div",{className:"LeftMainHeader"},Tt.ZP.createElement("div",{id:"LeftMainHeader",className:"left-header",ref:te},x.isRtl&&Tt.ZP.createElement("div",{className:"DropdownMenuFiller"}),Tt.ZP.createElement(_s.Z,{trigger:V,footer:`${n.iCi} ${Y}`,className:(0,xt.Z)("main-menu",x.isRtl&&"rtl",e&&x.isRtl&&"right-aligned",Q.current&&x.isRtl&&"disable-transition"),forceOpen:L,positionX:e&&x.isRtl?"right":"left",transformOriginX:i.D$&&i.jm&&!X?90:void 0,onTransitionEnd:x.isRtl?ee:void 0},Tt.ZP.createElement(Ks,{onSelectArchived:M,onSelectContacts:C,onSelectSettings:S,onBotMenuOpened:O,onBotMenuClosed:_})),Tt.ZP.createElement(Fs.Z,{inputId:"telegram-search-input",parentContainerClassName:"LeftSearch",className:(0,xt.Z)(m||h?"with-picker-item":void 0,e&&"SearchInput--hidden"),value:o?void 0:s||r,focused:J,isLoading:d||"minimized"===G,spinnerColor:"minimized"===G?"yellow":void 0,spinnerBackgroundColor:"minimized"===G&&"light"===p?"light":void 0,placeholder:W,autoComplete:"off",canClose:Boolean(m||h),onChange:Z,onReset:E,onFocus:$,onSpinnerClick:"minimized"===G?z:void 0},se,Tt.ZP.createElement(Os.Z,{canShow:!J&&!D&&!m})),l&&Tt.ZP.createElement(ea,null),y&&Tt.ZP.createElement(ws.Z,{round:!0,ripple:!U,size:"smaller",color:"translucent",ariaLabel:`${x("ShortcutsController.Others.LockByPasscode")} (Ctrl+Shift+L)`,onClick:K,className:(0,xt.Z)(!l&&"extra-spacing")},Tt.ZP.createElement("i",{className:"icon icon-lock"})),Tt.ZP.createElement(Ds.Z,{isOpen:"overlay"===G,isCustom:!0,className:"connection-state-wrapper"},Tt.ZP.createElement(qs,{connectionStatus:j,connectionStatusText:q,onClick:z}))))}))),na=Object.keys(c.du).length/2;let ia;const oa=(0,Tt.X$)((({content:e,searchQuery:t,searchDate:s,isClosingSearch:o,contactsFilter:r,shouldSkipTransition:d,foldersDispatch:l,isAppUpdateAvailable:u,isElectronUpdateAvailable:m,isForumPanelOpen:h,onSearchQuery:p,onContentChange:g,onSettingsScreenSelect:f,onReset:I,onTopicSearch:w})=>{const{closeForumPanel:v}=(0,a.Sv)(),[b,y]=(0,Tt.eJ)(i.$b),[P,Z]=(0,Tt.eJ)(!1);(0,Tt.d4)((()=>{window.electron?.getIsAutoUpdateEnabled().then(Z)}),[]);const{shouldRenderForumPanel:S,handleForumPanelAnimationEnd:C,handleForumPanelAnimationStart:M,isAnimationStarted:E}=(0,fs.Z)(h),R=h&&e===c.du.ChatList,k=R&&E,{shouldRender:T,transitionClassNames:N}=(0,$t.Z)(u||m),A=(0,Tt.sO)(!1),B=(0,qt.Z)((()=>{e===c.du.ChatList&&(A.current=!0,y(!0))})),x=(0,qt.Z)((()=>{A.current=!1,ia&&(clearTimeout(ia),ia=void 0),ia=window.setTimeout((()=>{A.current||y(!1)}),250)})),U=(0,qt.Z)((()=>{g(c.du.Settings)})),L=(0,qt.Z)((()=>{g(c.du.Contacts)})),O=(0,qt.Z)((()=>{g(c.du.Archived),v()})),_=(0,qt.Z)((()=>{i.D$&&!P?window.open(`${n.bl0}/get`,"_blank","noopener"):m?window.electron?.installUpdate():window.location.reload()})),F=(0,qt.Z)((()=>{g(c.du.NewChannelStep1)})),D=(0,qt.Z)((()=>{g(c.du.NewGroupStep1)}));(0,Tt.d4)((()=>{let t;return e!==c.du.ChatList?t=window.setTimeout((()=>{y(!1)}),250):(A.current||i.$b)&&y(!0),()=>{t&&(clearTimeout(t),t=void 0)}}),[e]);const j=(0,Is.Z)();return Tt.ZP.createElement("div",{id:"LeftColumn-main",onMouseEnter:i.$b?void 0:B,onMouseLeave:i.$b?void 0:x},Tt.ZP.createElement(aa,{shouldHideSearch:k,content:e,contactsFilter:r,onSearchQuery:p,onSelectSettings:U,onSelectContacts:L,onSelectArchived:O,onReset:I,shouldSkipTransition:d,isClosingSearch:o}),Tt.ZP.createElement(hs.ZP,{name:d?"none":"zoomFade",renderCount:na,activeKey:e,shouldCleanup:!0,cleanupExceptionKey:c.du.ChatList,shouldWrap:!0,wrapExceptionKey:c.du.ChatList},(a=>{switch(e){case c.du.ChatList:return Tt.ZP.createElement(Rs,{shouldHideFolderTabs:k,onSettingsScreenSelect:f,onLeftColumnContentChange:g,foldersDispatch:l,isForumPanelOpen:k});case c.du.GlobalSearch:return Tt.ZP.createElement(Ps,{searchQuery:t,searchDate:s,isActive:a,onReset:I});case c.du.Contacts:return Tt.ZP.createElement(ks,{filter:r,isActive:a,onReset:I});default:return}})),T&&Tt.ZP.createElement(ws.Z,{fluid:!0,pill:!0,className:(0,xt.Z)("btn-update",N),onClick:_},j("lng_update_telegram")),S&&Tt.ZP.createElement(Ts.Z,{isOpen:h,isHidden:!R,onTopicSearch:w,onOpenAnimationStart:M,onCloseAnimationEnd:C}),Tt.ZP.createElement(ys,{isShown:b,onNewPrivateChat:L,onNewChannel:F,onNewGroup:D}))})),ra=e=>{const t=(0,Yt.Z)(Ot.gl.Extra,"NewChat");return t?Tt.ZP.createElement(t,e):Tt.ZP.createElement(ps.Z,null)},ca=e=>{const t=(0,Yt.Z)(Ot.gl.Extra,"Settings");return t?Tt.ZP.createElement(t,e):Tt.ZP.createElement(ps.Z,null)};var da=function(e){return 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",e}(da||{});const la=Object.keys(da).length/2,ua=(0,Tt.X$)((0,a.c$)((e=>{const t=(0,b.jUK)(e),{globalSearch:{query:s,date:a},shouldSkipHistoryAnimations:n,activeChatFolder:i,nextSettingsScreen:o,nextFoldersAction:r,storyViewer:{isArchivedRibbonShown:c}}=t,{currentUserId:d,passcode:{hasPasscode:l},isAppUpdateAvailable:u,isElectronUpdateAvailable:m,archiveSettings:h}=e,p=(0,b.jrE)(e);return{searchQuery:s,searchDate:a,isFirstChatFolderActive:0===i,shouldSkipHistoryAnimations:n,currentUserId:d,hasPasscode:l,nextSettingsScreen:o,nextFoldersAction:r,isChatOpen:Boolean(p?.id),isAppUpdateAvailable:u,isElectronUpdateAvailable:m,isForumPanelOpen:(0,b.nd)(e),forumPanelChatId:t.forumPanelChatId,isClosingSearch:t.globalSearch.isClosing,archiveSettings:h,isArchivedStoryRibbonShown:c}}))((function({ref:e,searchQuery:t,searchDate:s,isFirstChatFolderActive:n,shouldSkipHistoryAnimations:o,currentUserId:r,hasPasscode:d,nextSettingsScreen:l,nextFoldersAction:u,isChatOpen:m,isAppUpdateAvailable:h,isElectronUpdateAvailable:p,isForumPanelOpen:g,forumPanelChatId:f,isClosingSearch:I,archiveSettings:w,isArchivedStoryRibbonShown:v}){const{setGlobalSearchQuery:b,setGlobalSearchClosing:y,setGlobalSearchChatId:P,resetChatCreation:Z,setGlobalSearchDate:S,loadPasswordInfo:C,clearTwoFaError:M,openChat:E,requestNextSettingsScreen:R}=(0,a.Sv)(),[k,T]=(0,Tt.eJ)(c.du.ChatList),[N,A]=(0,Tt.eJ)(c.MT.Main),[B,x]=(0,Tt.eJ)(""),[U,L]=(0,ls.ZP)(),[O,_]=(0,Tt.eJ)(0);let F=da.Main;switch(k){case c.du.Archived:F=da.Archived;break;case c.du.Settings:F=da.Settings;break;case c.du.NewChannelStep1:case c.du.NewChannelStep2:F=da.NewChannel;break;case c.du.NewGroupStep1:case c.du.NewGroupStep2:F=da.NewGroup}const D=(0,qt.Z)((e=>{function t(){T(c.du.ChatList),A(c.MT.Main),x(""),y({isClosing:!0}),Z(),setTimeout((()=>{b({query:""}),S({date:void 0}),P({id:void 0}),y({isClosing:!1}),_(Date.now())}),250)}if(!0!==e)if(k!==c.du.NewGroupStep2)if(k!==c.du.NewChannelStep2){if(k===c.du.NewGroupStep1){const e=document.getElementById("new-group-picker-search");e&&e.blur()}if(k===c.du.Settings)switch(N){case c.MT.EditProfile:case c.MT.Folders:case c.MT.General:case c.MT.Notifications:case c.MT.DataStorage:case c.MT.Privacy:case c.MT.Performance:case c.MT.ActiveSessions:case c.MT.Language:case c.MT.Stickers:case c.MT.Experimental:return void A(c.MT.Main);case c.MT.GeneralChatBackground:return void A(c.MT.General);case c.MT.GeneralChatBackgroundColor:return void A(c.MT.GeneralChatBackground);case c.MT.PrivacyPhoneNumber:case c.MT.PrivacyAddByPhone:case c.MT.PrivacyLastSeen:case c.MT.PrivacyProfilePhoto:case c.MT.PrivacyBio:case c.MT.PrivacyPhoneCall:case c.MT.PrivacyPhoneP2P:case c.MT.PrivacyForwarding:case c.MT.PrivacyGroupChats:case c.MT.PrivacyVoiceMessages:case c.MT.PrivacyMessages:case c.MT.PrivacyBlockedUsers:case c.MT.ActiveWebsites:case c.MT.TwoFaDisabled:case c.MT.TwoFaEnabled:case c.MT.TwoFaCongratulations:case c.MT.PasscodeDisabled:case c.MT.PasscodeEnabled:case c.MT.PasscodeCongratulations:return void A(c.MT.Privacy);case c.MT.PasscodeNewPasscode:return void A(d?c.MT.PasscodeEnabled:c.MT.PasscodeDisabled);case c.MT.PasscodeChangePasscodeCurrent:case c.MT.PasscodeTurnOff:return void A(c.MT.PasscodeEnabled);case c.MT.PasscodeNewPasscodeConfirm:return void A(c.MT.PasscodeNewPasscode);case c.MT.PasscodeChangePasscodeNew:return void A(c.MT.PasscodeChangePasscodeCurrent);case c.MT.PasscodeChangePasscodeConfirm:return void A(c.MT.PasscodeChangePasscodeNew);case c.MT.PrivacyPhoneNumberAllowedContacts:case c.MT.PrivacyPhoneNumberDeniedContacts:return void A(c.MT.PrivacyPhoneNumber);case c.MT.PrivacyLastSeenAllowedContacts:case c.MT.PrivacyLastSeenDeniedContacts:return void A(c.MT.PrivacyLastSeen);case c.MT.PrivacyProfilePhotoAllowedContacts:case c.MT.PrivacyProfilePhotoDeniedContacts:return void A(c.MT.PrivacyProfilePhoto);case c.MT.PrivacyBioAllowedContacts:case c.MT.PrivacyBioDeniedContacts:return void A(c.MT.PrivacyBio);case c.MT.PrivacyPhoneCallAllowedContacts:case c.MT.PrivacyPhoneCallDeniedContacts:return void A(c.MT.PrivacyPhoneCall);case c.MT.PrivacyPhoneP2PAllowedContacts:case c.MT.PrivacyPhoneP2PDeniedContacts:return void A(c.MT.PrivacyPhoneP2P);case c.MT.PrivacyForwardingAllowedContacts:case c.MT.PrivacyForwardingDeniedContacts:return void A(c.MT.PrivacyForwarding);case c.MT.PrivacyVoiceMessagesAllowedContacts:case c.MT.PrivacyVoiceMessagesDeniedContacts:return void A(c.MT.PrivacyVoiceMessages);case c.MT.PrivacyGroupChatsAllowedContacts:case c.MT.PrivacyGroupChatsDeniedContacts:return void A(c.MT.PrivacyGroupChats);case c.MT.TwoFaNewPassword:return void A(c.MT.TwoFaDisabled);case c.MT.TwoFaNewPasswordConfirm:return void A(c.MT.TwoFaNewPassword);case c.MT.TwoFaNewPasswordHint:return void A(c.MT.TwoFaNewPasswordConfirm);case c.MT.TwoFaNewPasswordEmail:return void A(c.MT.TwoFaNewPasswordHint);case c.MT.TwoFaNewPasswordEmailCode:return void A(c.MT.TwoFaNewPasswordEmail);case c.MT.TwoFaChangePasswordCurrent:case c.MT.TwoFaTurnOff:case c.MT.TwoFaRecoveryEmailCurrentPassword:return void A(c.MT.TwoFaEnabled);case c.MT.TwoFaChangePasswordNew:return void A(c.MT.TwoFaChangePasswordCurrent);case c.MT.TwoFaChangePasswordConfirm:return void A(c.MT.TwoFaChangePasswordNew);case c.MT.TwoFaChangePasswordHint:return void A(c.MT.TwoFaChangePasswordConfirm);case c.MT.TwoFaRecoveryEmail:return void A(c.MT.TwoFaRecoveryEmailCurrentPassword);case c.MT.TwoFaRecoveryEmailCode:return void A(c.MT.TwoFaRecoveryEmail);case c.MT.FoldersCreateFolder:case c.MT.FoldersEditFolder:return void A(c.MT.Folders);case c.MT.FoldersShare:return void A(c.MT.FoldersEditFolder);case c.MT.FoldersIncludedChatsFromChatList:case c.MT.FoldersExcludedChatsFromChatList:return void A(c.MT.FoldersEditFolderFromChatList);case c.MT.FoldersEditFolderFromChatList:case c.MT.FoldersEditFolderInvites:return T(c.du.ChatList),void A(c.MT.Main);case c.MT.QuickReaction:case c.MT.CustomEmoji:return void A(c.MT.Stickers);case c.MT.DoNotTranslate:return void A(c.MT.Language)}k===c.du.ChatList&&n?T(c.du.GlobalSearch):t()}else T(c.du.NewChannelStep1);else T(c.du.NewGroupStep1);else t()})),j=(0,qt.Z)((e=>{k!==c.du.Contacts?(T(c.du.GlobalSearch),e!==t&&b({query:e})):x(e)})),q=(0,qt.Z)((()=>{T(c.du.GlobalSearch),b({query:""}),P({id:f})}));(0,Tt.d4)((()=>{const e=k===c.du.Archived,t=k===c.du.ChatList,s=!m&&!g;return e&&s||!t&&!e||n&&s?(0,cs.Z)((()=>{D()})):void 0}),[n,k,D,m,g]);const G=(0,qt.Z)((e=>{k!==c.du.GlobalSearch&&(e.preventDefault(),T(c.du.GlobalSearch))})),H=(0,qt.Z)((e=>{e.preventDefault(),E({id:r,shouldReplaceHistory:!0})})),V=(0,qt.Z)((e=>{e.preventDefault(),T(c.du.Archived)})),$=(0,qt.Z)((e=>{e.preventDefault(),T(c.du.Settings)}));(0,us.y)({"Mod+Shift+F":G,...!i.D1&&{"Mod+Shift+S":H},...i.RM&&{"Mod+0":H,"Mod+9":V},...i.jm&&i.RM&&{"Mod+,":$}}),(0,Tt.d4)((()=>{M(),N===c.MT.Privacy&&C()}),[M,C,N]),(0,zt.Z)((()=>{void 0!==l&&(T(c.du.Settings),A(l),R({screen:void 0})),u&&L(u)}),[L,u,l,R]);const z=(0,qt.Z)((e=>{T(c.du.Settings),A(e)})),K=(0,ms.Y)(function(e){const t=(0,Tt.sO)(),s=(0,Tt.sO)();return s.current!==e&&(t.current=s.current),s.current=e,t.current}(F===da.Settings?N:-1));function J(e){switch(F){case da.Archived:return Tt.ZP.createElement(gs,{isActive:e,onReset:D,onTopicSearch:q,foldersDispatch:L,onSettingsScreenSelect:z,onLeftColumnContentChange:T,isForumPanelOpen:g,archiveSettings:w,isStoryRibbonShown:v});case da.Settings:return Tt.ZP.createElement(ca,{isActive:e,currentScreen:N,foldersState:U,foldersDispatch:L,shouldSkipTransition:o,onScreenSelect:z,onReset:D});case da.NewChannel:return Tt.ZP.createElement(ra,{key:O,isActive:e,isChannel:!0,content:k,onContentChange:T,onReset:D});case da.NewGroup:return Tt.ZP.createElement(ra,{key:O,isActive:e,content:k,onContentChange:T,onReset:D});default:return Tt.ZP.createElement(oa,{content:k,isClosingSearch:I,searchQuery:t,searchDate:s,contactsFilter:B,foldersDispatch:L,onContentChange:T,onSearchQuery:j,onSettingsScreenSelect:z,onReset:D,shouldSkipTransition:o,isAppUpdateAvailable:h,isElectronUpdateAvailable:p,isForumPanelOpen:g,onTopicSearch:q})}}return(0,Tt.d4)((()=>{if(i.$b)return(0,ds.U)(e.current,{excludedClosestSelector:".ProfileInfo, .color-picker, .hue-picker",selectorToPreventScroll:"#Settings .custom-scroll",onSwipeRightStart:D,onCancel:()=>{T(c.du.Settings),z(K.current)}})}),[K,e]),Tt.ZP.createElement(hs.ZP,{ref:e,name:o?"none":i.s0,renderCount:la,activeKey:F,shouldCleanup:!0,cleanupExceptionKey:da.Main,shouldWrap:!0,wrapExceptionKey:da.Main,id:"LeftColumn",withSwipeControl:!0},J)}))),ma=({isOpen:e})=>{const t=(0,Yt.Z)(Ot.gl.Extra,"MediaViewer",!e);return t?Tt.ZP.createElement(t,null):void 0};var ha=s(10396),pa=s(64532),ga=s(32340),fa=s(23186),Ia=s(17240),wa=s(93447),va=s(77510),ba=s(6202);const ya=s.p+"telegram-logo-filled.67469f6dc5e301e8e0bd.svg",Pa={width:200,height:200},Za=115;var Sa=s(18051),Ca=s(68512);const Ma={.5:.66,.75:.8,1:1,1.5:1.4,2:1.8},Ea=Object.keys(Ma).sort().map(Number),Ra=(0,a.c$)(((e,{message:t})=>{const s=(0,b.Urc)(e,t),a=(0,b.Z1J)(e,t.chatId),{volume:n,playbackRate:i,isMuted:o,isPlaybackRateActive:r}=(0,b.jUK)(e).audioPlayer;return{sender:s,chat:a,volume:n,playbackRate:i,isPlaybackRateActive:r,isMuted:o}}))((({message:e,className:t,noUi:s,sender:o,chat:r,volume:c,playbackRate:d,isPlaybackRateActive:l,isMuted:u})=>{const{setAudioPlayerVolume:m,setAudioPlayerPlaybackRate:h,setAudioPlayerMuted:p,focusMessage:g,closeAudioPlayer:f}=(0,a.Sv)(),w=(0,Tt.sO)(null),v=(0,Is.Z)(),{isMobile:b}=(0,B.ZP)(),{audio:y,voice:P,video:Z}=(0,I.qp)(e),S=Boolean(P||Z),M=S||(y?.duration||0)>n.J0S,E=o?(0,I.OU)(v,o):void 0,R=xe.UV((0,I.Ti)(e,"inline")),k=((e,t,s)=>{const a=(0,Is.Z)(),{audio:n,voice:i}=(0,I.qp)(e),o=n?n.title||n.fileName:i?"Voice message":"",r=n?.performer||t&&(0,I.OU)(a,t),c=s&&(0,I.U)(a,s)||"Telegram",d=n&&(0,I.MR)(n)&&(0,I.Ti)(e,"pictogram"),l=t&&(0,I.RT)(t,"big"),u=n&&d||i&&l,m=(0,ba.Z)(u),h=(0,Tt.Ye)((()=>function(e,t,s){if(!s)return Pa;if(e){if(!e.thumbnailSizes?.length)return;const t=e.thumbnailSizes.find((e=>"m"===e.type));return t||e.thumbnailSizes[0]}return t?C.vY:void 0}(n,i,m)),[n,m,i]),{result:p}=(0,va.Z)((()=>function(e,t){if(!e)return Promise.resolve(ya);if(!t)return(0,wa.t)(e,Za,Za);const s=Math.min(t.width,t.height);if(s<Za){const t=Za/s;return(0,wa.j)(e,t)}return Promise.resolve(e)}(m,h)),[m,h],ya);return(0,Tt.Ye)((()=>(0,pa.Of)({title:o,artist:r,album:c,artwork:[{src:p}]})),[c,r,o,p])})(e,o,r),{playPause:T,stop:N,isPlaying:A,requestNextTrack:x,requestPreviousTrack:U,isFirst:L,isLast:O,setVolume:_,toggleMuted:F,setPlaybackRate:D}=(0,fa.Z)((0,ha.An)(e),(0,I.XV)(e),S?"voice":"audio",R,void 0,k,void 0,!0,void 0,void 0,(0,I.CI)(e),!0),{isContextMenuOpen:j,handleBeforeContextMenu:q,handleContextMenu:G,handleContextMenuClose:H,handleContextMenuHide:V}=(0,Ia.Z)(w),$=(0,qt.Z)((()=>{g({chatId:e.chatId,messageId:e.id})})),z=(0,qt.Z)((()=>{A&&T(),f(),(0,pa.Ay)(),N()})),K=(0,qt.Z)((e=>{m({volume:e/100}),_(e/100)})),J=(0,qt.Z)((()=>{i.$b&&!i.cj||(F(),p({isMuted:!u}))})),W=(0,qt.Z)(((e,t=!0)=>{const s=Ma[e],a=1!==e&&t;h({playbackRate:s,isPlaybackRateActive:a}),D(a?s:1)})),Y=(0,qt.Z)((()=>{H();const e=Number(Object.entries(Ma).find((([,e])=>e===d))?.[0])||1,t=!l;W(t&&1===e?2:e,t)})),X=(0,qt.Z)((()=>{const e=Object.entries(Ma).find((([,e])=>e===d))?.[0]||1,t=`${1===d?2:e}Х`;return Tt.ZP.createElement("div",{className:"playback-wrapper"},j&&Tt.ZP.createElement("div",{className:"playback-backdrop",onClick:H}),Tt.ZP.createElement(ws.Z,{round:!0,className:(0,xt.Z)("playback-button",l&&"applied",j&&"on-top"),color:"translucent",size:"smaller",ariaLabel:"Playback Rate",ripple:!b,onMouseEnter:G,onClick:Y,onMouseDown:q,onContextMenu:G},Tt.ZP.createElement("span",{className:(0,xt.Z)("playback-button-inner",4===t.length&&"small",5===t.length&&"tiny")},t)))})),Q=(0,Tt.Ye)((()=>0===c||u?"icon-muted":c<.3?"icon-volume-1":c<.6?"icon-volume-2":"icon-volume-3"),[c,u]);if(!s)return Tt.ZP.createElement("div",{className:(0,xt.Z)("AudioPlayer",t),dir:v.isRtl?"rtl":void 0,ref:w},Tt.ZP.createElement("div",{className:"AudioPlayer-content",onClick:$},y?function(e){const{title:t,performer:s,fileName:a}=e;return Tt.ZP.createElement(Tt.ZP.Fragment,null,Tt.ZP.createElement("div",{className:"title",dir:"auto"},(0,ga.Z)(t||a)),s&&Tt.ZP.createElement("div",{className:"subtitle",dir:"auto"},(0,ga.Z)(s)))}(y):function(e,t){return Tt.ZP.createElement(Tt.ZP.Fragment,null,Tt.ZP.createElement("div",{className:"title",dir:"auto"},t&&(0,ga.Z)(t)),Tt.ZP.createElement("div",{className:"subtitle",dir:"auto"},e))}(v("AttachAudio"),E),Tt.ZP.createElement(Ca.Z,null)),Tt.ZP.createElement(ws.Z,{round:!0,ripple:!b,color:"translucent",size:"smaller",className:"player-button",disabled:L(),onClick:U,ariaLabel:"Previous track"},Tt.ZP.createElement("i",{className:"icon icon-skip-previous"})),Tt.ZP.createElement(ws.Z,{round:!0,ripple:!b,color:"translucent",size:"smaller",className:(0,xt.Z)("toggle-play","player-button",A?"pause":"play"),onClick:T,ariaLabel:A?"Pause audio":"Play audio"},Tt.ZP.createElement("i",{className:"icon icon-play"}),Tt.ZP.createElement("i",{className:"icon icon-pause"})),Tt.ZP.createElement(ws.Z,{round:!0,ripple:!b,color:"translucent",size:"smaller",className:"player-button",disabled:O(),onClick:x,ariaLabel:"Next track"},Tt.ZP.createElement("i",{className:"icon icon-skip-next"})),Tt.ZP.createElement("div",{className:"volume-button-wrapper"},Tt.ZP.createElement(ws.Z,{round:!0,className:"player-button volume-button",color:"translucent",size:"smaller",ariaLabel:"Volume",onClick:J,ripple:!b},Tt.ZP.createElement("i",{className:(0,xt.Z)("icon",Q)})),!i.cj&&Tt.ZP.createElement("div",{className:"volume-slider-wrapper"},Tt.ZP.createElement("div",{className:"volume-slider-spacer"}),Tt.ZP.createElement("div",{className:"volume-slider"},Tt.ZP.createElement(Sa.Z,{bold:!0,value:u?0:100*c,onChange:K})))),M&&Tt.ZP.createElement(_s.Z,{forceOpen:j,positionX:"right",positionY:"top",className:"playback-rate-menu",trigger:X,onClose:H,onHide:V,onMouseEnterBackdrop:H},Ea.map((e=>function(e,t,s,a){const n=t===Ma[e]&&a||1===e&&!a;return Tt.ZP.createElement(bs.Z,{key:e,onClick:()=>s(e),icon:n?"check":void 0,customIcon:n?void 0:Tt.ZP.createElement("i",{className:"icon icon-placeholder"})},e,"X")}(e,d,W,l)))),Tt.ZP.createElement(ws.Z,{round:!0,className:"player-close",color:"translucent",size:"smaller",onClick:z,ariaLabel:"Close player"},Tt.ZP.createElement("i",{className:"icon icon-close"})))})),ka=e=>{const{isOpen:t}=e,s=(0,Yt.Z)(Ot.gl.Extra,"ReactionPicker",!t);return s?Tt.ZP.createElement(s,e):void 0};function Ta(){return Ta=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(e[a]=s[a])}return e},Ta.apply(this,arguments)}const Na=(0,Tt.X$)((0,a.c$)((e=>({messageLists:(0,b.jUK)(e).messageLists})))((({messageLists:e})=>{const{openChat:t}=(0,a.Sv)(),s=()=>{t({id:void 0},{forceSyncOnIOs:!0})},n=({chatId:e,type:t,threadId:a})=>{(0,Ss.Z)({isActive:!0,hash:(0,Le.tB)(e,t,a),onBack:s})};return Tt.ZP.createElement("div",null,e?.map(((e,t)=>Tt.ZP.createElement(n,Ta({key:`${e.chatId}_${e.threadId}_${e.type}_${t}`},e)))))})));var Aa=s(80036),Ba=s(49524),xa=s(71394);var Ua=s(52678),La=s(87204),Oa=s(22418),_a=s(3570),Fa=s(28712),Da=s(33799),ja=s(37149);const qa=e=>{const{isOpen:t}=e,s=(0,Yt.Z)(Ot.gl.Extra,"PrivacySettingsNoticeModal",!t);return s?Tt.ZP.createElement(s,e):void 0},Ga=e=>{const{isOpen:t}=e,s=(0,Yt.Z)(Ot.gl.Extra,"SeenByModal",!t);return s?Tt.ZP.createElement(s,e):void 0},Ha=e=>{const{isOpen:t}=e,s=(0,Yt.Z)(Ot.gl.Extra,"UnpinAllMessagesModal",!t);return s?Tt.ZP.createElement(s,e):void 0},Va=e=>{const{isOpen:t}=e,s=(0,Yt.Z)(Ot.gl.Extra,"GiftPremiumModal",!t);return s?Tt.ZP.createElement(s,e):void 0},$a=e=>{const{isOpen:t}=e,s=(0,Yt.Z)(Ot.gl.Extra,"ChatLanguageModal",!t);return s?Tt.ZP.createElement(s,e):void 0};var za=s(12420);const Ka=e=>{const{activeEmojiInteraction:t}=e,s=(0,Yt.Z)(Ot.gl.Extra,"EmojiInteractionAnimation",!t);return s?Tt.ZP.createElement(s,e):void 0};var Ja=s(81740);const Wa=(0,Tt.X$)((({icon:e,ariaLabelLang:t,unreadCount:s,onClick:a,onReadAll:n,className:i})=>{const o=(0,Is.Z)(),r=(0,Tt.sO)(null),{isContextMenuOpen:c,handleContextMenu:d,handleContextMenuClose:l,handleContextMenuHide:u}=(0,Ia.Z)(r,!n);return Tt.ZP.createElement("div",{className:(0,xt.Z)("Y2NKrpKj",i),ref:r},Tt.ZP.createElement(ws.Z,{color:"secondary",round:!0,className:"cxwA6gDO",onClick:a,onContextMenu:d,ariaLabel:o(t)},Tt.ZP.createElement("i",{className:(0,xt.Z)("F4zNUFhH","icon",`icon-${e}`)})),Boolean(s)&&Tt.ZP.createElement("div",{className:"GovSzpfQ"},(0,is.bi)(s)),n&&Tt.ZP.createElement(vs.Z,{isOpen:c,onClose:l,onCloseAnimationEnd:u,autoClose:!0,positionX:"right",positionY:"bottom"},Tt.ZP.createElement(bs.Z,{icon:"readchats",onClick:n},o("MarkAllAsRead"))))})),Ya="UMXbiYB3",Xa=(0,Tt.X$)((0,a.c$)((e=>{const t=(0,b.Btg)(e);if(!t)return{};const{chatId:s,threadId:a,type:n}=t,i=(0,b.Z1J)(e,s),o=i&&a===r._f&&"thread"===n;return{messageListType:n,chatId:s,reactionsCount:o?i.unreadReactionsCount:void 0,mentionsCount:o?i.unreadMentionsCount:void 0,unreadCount:o?i.unreadCount:void 0}}))((({isShown:e,canPost:t,messageListType:s,chatId:n,unreadCount:i,reactionsCount:o,mentionsCount:r,withExtraShift:c})=>{const{focusNextReply:d,focusNextReaction:l,focusNextMention:u,fetchUnreadReactions:m,readAllMentions:h,readAllReactions:p,fetchUnreadMentions:g}=(0,a.Sv)(),f=(0,Tt.sO)(null),I=Boolean(o),w=Boolean(r);(0,Tt.d4)((()=>{I&&n&&m({chatId:n})}),[n,m,I]),(0,Tt.d4)((()=>{w&&n&&g({chatId:n})}),[n,g,w]);const v=(0,qt.Z)((()=>{if(e)if("thread"===s)d();else{const e=f.current.parentElement.querySelector(".MessageList"),t=e.querySelectorAll(".message-list-item"),s=t[t.length-1];if(!s)return;(0,Ja.ZP)(e,s,"end",20)}})),b=(0,xt.Z)("VWoOZCD5",(e||Boolean(o)||Boolean(r))&&"iozW83la",(Boolean(o)||Boolean(r))&&!e&&"dpkAoSjW",!t&&"yzzjqibi",!c&&"wDwOdyQH");return Tt.ZP.createElement("div",{ref:f,className:b},Tt.ZP.createElement(Wa,{icon:"heart-outline",ariaLabelLang:"AccDescrReactionMentionDown",onClick:l,onReadAll:p,unreadCount:o,className:(0,xt.Z)("eO_Fz8SD",!I&&Ya,!w&&"gn3iLVq1")}),Tt.ZP.createElement(Wa,{icon:"mention",ariaLabelLang:"AccDescrMentionDown",onClick:u,onReadAll:h,unreadCount:r,className:!w&&Ya}),Tt.ZP.createElement(Wa,{icon:"arrow-down",ariaLabelLang:"AccDescrPageDown",onClick:v,unreadCount:i,className:"u62x81QI"}))})));var Qa=s(87675);function en(e){return"albumId"in e}function tn(e,t,s,a){let n,i=[],o={originalDate:e[0].date,datetime:(0,re._F)(1e3*e[0].date),senderGroups:[i]};const r=[o];return e.forEach(((c,d)=>{c.isInAlbum?n?(n.messages.push(c),(c.hasComments||c.content.text&&!n.mainMessage.hasComments)&&(n.mainMessage=c)):n={albumId:c.groupedId,messages:[c],mainMessage:c}:i.push(c);const l=e[d+1];!n||l&&l.groupedId&&l.groupedId===n.albumId||(i.push(n),n=void 0);const u=i[i.length-1];if(l){const e=(0,re._F)(1e3*l.date);o.datetime!==e?(o={originalDate:l.date,datetime:e,senderGroups:[]},r.push(o),i=[],o.senderGroups.push(i)):(l.id===t||c.senderId!==l.senderId||c.isOutgoing!==l.isOutgoing||(0,I.FT)(c)&&!c.content.action?.phoneCall||(0,I.FT)(l)&&!l.content.action?.phoneCall||c.inlineButtons||l.inlineButtons||l.date-c.date>600||s&&(c.id===s||u&&"mainMessage"in u&&u.mainMessage?.id===s)&&l.id!==s||a&&c.forwardInfo?.fromId!==l.forwardInfo?.fromId)&&(i=[],o.senderGroups.push(i))}})),r}var sn=s(30386),an=s(72645),nn=s(60998);var on=s(78722),rn=s(88957);var cn=s(36765);const dn=(0,Tt.X$)((0,a.c$)(((e,{userId:t})=>{const{stickers:s}=e.stickers.greeting,a=(0,b.Z1J)(e,t);if(!a)return{};const n=(0,b._If)(e,a.id);return{stickers:s,lastUnreadMessageId:n&&n.id!==a.lastReadInboxMessageId?n.id:void 0,connectionState:e.connectionState,currentMessageList:(0,b.Btg)(e)}}))((({stickers:e,connectionState:t,lastUnreadMessageId:s,currentMessageList:n})=>{const{loadGreetingStickers:i,sendMessage:o,markMessageListRead:r}=(0,a.Sv)(),c=(0,Is.Z)(),d=(0,Tt.sO)(null),l=(0,Tt.Ye)((()=>{if(!e?.length)return;const t=Math.floor(Math.random()*e.length);return e[t]}),[e]);(0,Tt.d4)((()=>{e?.length||"connectionStateReady"!==t||i()}),[t,i,e]),(0,Tt.d4)((()=>{"connectionStateReady"===t&&s&&r({maxId:s})}),[t,r,s]);const u=(0,qt.Z)((()=>{n&&o({sticker:{...l,isPreloadedGlobally:!0},messageList:n})}));return Tt.ZP.createElement("div",{className:"ContactGreeting"},Tt.ZP.createElement("div",{className:"wrapper"},Tt.ZP.createElement("p",{className:"title",dir:"auto"},c("Conversation.EmptyPlaceholder")),Tt.ZP.createElement("p",{className:"description",dir:"auto"},c("Conversation.GreetingText")),Tt.ZP.createElement("div",{ref:d,className:"sticker",onClick:u},l&&Tt.ZP.createElement(cn.Z,{containerRef:d,sticker:l,size:160,shouldLoop:!0}))))})));var ln=s(38146),un=s(57080),mn=s(74607);const hn=(0,Tt.X$)((0,a.c$)(((e,{chatId:t})=>{const s=(0,b.kBx)(e,t);let a,n=!1;if(s){const t=(0,b.ccz)(e,s.id);t?a=t.botInfo:n=!0}return{botInfo:a,isLoadingBotInfo:n}}))((({botInfo:e,isLoadingBotInfo:t,isInMessageList:s})=>{const a=(0,Is.Z)(),n=(0,ln.Z)(),i=(0,ba.Z)(e?.photo?(0,I.NF)(e.photo):void 0),o=(0,ba.Z)(e?.gif?(0,I.ym)(e.gif):void 0),r=e?.photo?(0,I.bV)(e.photo):e?.gif?(0,I.jC)(e.gif):void 0,c=r&&{width:r.width/n,height:r.height/n},d=e&&!e.description&&!e.gif&&!e.photo,{width:l,height:u}=c||{};if(!d&&!t||!s)return Tt.ZP.createElement("div",{className:(0,xt.Z)("sqThK406","empty")},t&&Tt.ZP.createElement("span",null,a("Loading")),d&&!t&&Tt.ZP.createElement("span",null,a("NoMessages")),e&&Tt.ZP.createElement("div",{className:"XhDB6LWO",style:c&&`width: ${c.width}px`},i&&Tt.ZP.createElement("img",{className:"y7ijMlDf",src:i,width:c?.width,height:c?.height,alt:"Bot info"}),o&&Tt.ZP.createElement(un.Z,{canPlay:!0,src:o,loop:!0,disablePictureInPicture:!0,muted:!0,playsInline:!0,style:(0,Aa.Z)(Boolean(l)&&`width: ${l}px`,Boolean(u)&&`height: ${u}px`)}),r&&!i&&!o&&Tt.ZP.createElement(mn.Z,{width:c?.width,height:c?.height}),e.description&&Tt.ZP.createElement("div",{className:"lbMO1XqP"},Tt.ZP.createElement("p",{className:"ELYpyMpR"},a("BotInfoTitle")),(0,ga.Z)(e.description,["br","emoji","links"]))))})));var pn=s(71790),gn=s(3657);const fn=i.wZ?1e3:350;var In=s(11309),wn=s(93862),vn=s(58785),bn=s(55254),yn=s(3858),Pn=s(33780),Zn=s(44139),Sn=s(83967);const Cn={None:0,Top:1,Right:2,Bottom:4,Left:8};function Mn(e,t){return e.reduce(((e,t)=>e+t),t)}function En(e){const t={width:0,height:0};return e.forEach((({dimensions:e,sides:s})=>{s&Cn.Right&&(t.width=e.width+e.x),s&Cn.Bottom&&(t.height=e.height+e.y)})),t}function Rn(e,t,s,a,n){const i=function(e,t){return e.map((e=>{const s=(0,Sn.GH)(e,void 0,void 0,t);return s.width/s.height}))}(a.messages,n),o=function(e){return e.map((e=>e>1.2?"w":e<.8?"n":"q")).join("")}(i),r=function(e){return e.reduce(((e,t)=>t+e),1)/e.length}(i),c=i.length,d=i.some((e=>e>2)),l=(0,C.kc)(e,t,!1,s,n)-(t?2.5:0)*C.Gw;let u;const m={ratios:i,proportions:o,averageRatio:r,maxWidth:l,minWidth:100,maxHeight:l,spacing:2};return u=c>=5||d?function({ratios:e,averageRatio:t,maxWidth:s,minWidth:a,spacing:n,maxHeight:i=4*s/3}){const o=function(e,t){return e.map((e=>t>1.1?(0,Fa.uZ)(e,1,2.75):(0,Fa.uZ)(e,.6667,1)))}(e,t),r=e.length,c=new Array(r),d=[],l=e=>{const t=[];let a=0;e.forEach((e=>{t.push(((e,t)=>{const a=Mn(o.slice(e,e+t),0);return(s-(t-1)*n)/a})(a,e)),a+=e})),d.push({lineCounts:e,heights:t})};for(let e=1;e!==r;++e){const t=r-e;e<=3&&t<=3&&l([e,t])}for(let e=1;e!==r-1;++e)for(let s=1;s!==r-e;++s){const a=r-e-s;e<=3&&s<=(t<.85?4:3)&&a<=3&&l([e,s,a])}for(let e=1;e!==r-1;++e)for(let t=1;t!==r-e;++t)for(let s=1;s!==r-e-t;++s){const a=r-e-t-s;e<=3&&t<=3&&s<=3&&a<=4&&l([e,t,s,a])}let u,m=0;for(let e=0;e<d.length;e++){const{heights:t,lineCounts:s}=d[e],o=s.length,r=Mn(t,0)+n*(o-1),c=Math.min(...t)<a?1.5:1,l=(()=>{for(let e=1;e!==o;++e)if(s[e-1]>s[e])return 1.5;return 1})(),h=Math.abs(r-i)*c*l;(!u||h<m)&&(u=d[e],m=h)}const h=u.lineCounts,p=u.heights,g=h.length;let f=0,I=0;for(let e=0;e!==g;++e){const t=h[e],a=p[e],i=Math.round(a);let r=0;for(let d=0;d!==t;++d){const l=Cn.None|(0===e?Cn.Top:Cn.None)|(e===g-1?Cn.Bottom:Cn.None)|(0===d?Cn.Left:Cn.None)|(d===t-1?Cn.Right:Cn.None),u=o[f],m=d===t-1?s-r:Math.round(u*a);c[f]={dimensions:{x:r,y:I,width:m,height:i},sides:l},r+=m+n,++f}I+=i+n}return c}(m):2===c?function(e){const{ratios:t,proportions:s,averageRatio:a}=e;return"ww"===s&&a>1.4&&t[1]-t[0]<.2?function(e){const{ratios:t,maxWidth:s,spacing:a,maxHeight:n}=e,i=Math.round(Math.min(s/t[0],Math.min(s/t[1],(n-a)/2)));return[{dimensions:{x:0,y:0,width:s,height:i},sides:Cn.Left|Cn.Top|Cn.Right},{dimensions:{x:0,y:i+a,width:s,height:i},sides:Cn.Left|Cn.Bottom|Cn.Right}]}(e):"ww"===s||"qq"===s?function(e){const{ratios:t,maxWidth:s,spacing:a,maxHeight:n}=e,i=(s-a)/2,o=Math.round(Math.min(i/t[0],Math.min(i/t[1],n)));return[{dimensions:{x:0,y:0,width:i,height:o},sides:Cn.Top|Cn.Left|Cn.Bottom},{dimensions:{x:i+a,y:0,width:i,height:o},sides:Cn.Top|Cn.Right|Cn.Bottom}]}(e):function(e){const{ratios:t,minWidth:s,maxWidth:a,spacing:n,maxHeight:i}=e,o=Math.round(1.5*s),r=Math.min(Math.round(Math.max(.4*(a-n),(a-n)/t[0]/(1/t[0]+1/t[1]))),a-n-o),c=a-r-n,d=Math.min(i,Math.round(Math.min(c/t[0],r/t[1])));return[{dimensions:{x:0,y:0,width:c,height:d},sides:Cn.Top|Cn.Left|Cn.Bottom},{dimensions:{x:c+n,y:0,width:r,height:d},sides:Cn.Top|Cn.Right|Cn.Bottom}]}(e)}(m):3===c?function(e){const{proportions:t}=e;return"n"===t[0]?function(e){const{maxHeight:t,spacing:s,ratios:a,maxWidth:n,minWidth:i}=e,o=t,r=Math.round(Math.min((t-s)/2,a[1]*(n-s)/(a[2]+a[1]))),c=o-r-s,d=Math.max(i,Math.round(Math.min((n-s)/2,Math.min(r*a[2],c*a[1])))),l=Math.min(Math.round(o*a[0]),n-s-d);return[{dimensions:{x:0,y:0,width:l,height:o},sides:Cn.Top|Cn.Left|Cn.Bottom},{dimensions:{x:l+s,y:0,width:d,height:c},sides:Cn.Top|Cn.Right},{dimensions:{x:l+s,y:c+s,width:d,height:r},sides:Cn.Bottom|Cn.Right}]}(e):function(e){const{maxWidth:t,ratios:s,maxHeight:a,spacing:n}=e,i=t,o=Math.round(Math.min(i/s[0],.66*(a-n))),r=(t-n)/2,c=Math.min(a-o-n,Math.round(Math.min(r/s[1],r/s[2]))),d=i-r-n;return[{dimensions:{x:0,y:0,width:i,height:o},sides:Cn.Left|Cn.Top|Cn.Right},{dimensions:{x:0,y:o+n,width:r,height:c},sides:Cn.Bottom|Cn.Left},{dimensions:{x:r+n,y:o+n,width:d,height:c},sides:Cn.Bottom|Cn.Right}]}(e)}(m):function(e){const{proportions:t}=e;return"w"===t[0]?function({maxWidth:e,ratios:t,spacing:s,maxHeight:a,minWidth:n}){const i=e,o=Math.round(Math.min(i/t[0],.66*(a-s))),r=Math.round((e-2*s)/(t[1]+t[2]+t[3])),c=Math.max(n,Math.round(Math.min(.4*(e-2*s),r*t[1]))),d=Math.round(Math.max(Math.max(n,.33*(e-2*s)),r*t[3])),l=i-c-d-2*s,u=Math.min(a-o-s,r);return[{dimensions:{x:0,y:0,width:i,height:o},sides:Cn.Left|Cn.Top|Cn.Right},{dimensions:{x:0,y:o+s,width:c,height:u},sides:Cn.Bottom|Cn.Left},{dimensions:{x:c+s,y:o+s,width:l,height:u},sides:Cn.Bottom},{dimensions:{x:c+s+l+s,y:o+s,width:d,height:u},sides:Cn.Right|Cn.Bottom}]}(e):function({maxHeight:e,ratios:t,maxWidth:s,spacing:a,minWidth:n}){const i=e,o=Math.round(Math.min(i*t[0],.6*(s-a))),r=Math.round((e-2*a)/(1/t[1]+1/t[2]+1/t[3])),c=Math.round(r/t[1]),d=Math.round(r/t[2]),l=i-c-d-2*a,u=Math.max(n,Math.min(s-o-a,r));return[{dimensions:{x:0,y:0,width:o,height:i},sides:Cn.Top|Cn.Left|Cn.Bottom},{dimensions:{x:o+a,y:0,width:u,height:c},sides:Cn.Top|Cn.Right},{dimensions:{x:o+a,y:c+a,width:u,height:d},sides:Cn.Right},{dimensions:{x:o+a,y:c+d+2*a,width:u,height:l},sides:Cn.Bottom|Cn.Right}]}(e)}(m),{layout:u,containerStyle:En(u)}}var kn=s(75790),Tn=s(31526),Nn=s(46586),An=s(74095);let Bn;const xn=new Nn.Z;i.SX&&setTimeout((function(){Bn||(Bn=(0,An.K)(new Worker(new URL(s.p+s.u(4923),s.b))),xn.resolve())}),4e3);var Un=s(3927);let Ln,On;function _n(e,t,s){var a;return(t="symbol"==typeof(a=function(e,t){if("object"!=typeof e||!e)return e;var s=e[Symbol.toPrimitive];if(void 0!==s){var a=s.call(e,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t))?a:String(a))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}Ln=Symbol.toStringTag,On=Symbol.iterator;class Fn{constructor(e){this.limit=e,_n(this,"map",void 0),_n(this,"insertionQueue",void 0),this.map=new Map,this.insertionQueue=new Set}get(e){return this.map.get(e)}set(e,t){if(this.map.size===this.limit){const e=Array.from(this.insertionQueue).shift();e&&(this.map.delete(e),this.insertionQueue.delete(e))}return this.map.set(e,t),this.insertionQueue.add(e),this}delete(e){const t=this.map.delete(e);return t&&this.insertionQueue.delete(e),t}clear(){this.map.clear(),this.insertionQueue.clear()}forEach(e,t){this.map.forEach(e,t)}get size(){return this.map.size}get[Ln](){return this.map[Symbol.toStringTag]}[On](){return this.map[Symbol.iterator]()}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}}const Dn=new Map;const jn=(0,g.P2)((function(e){const{updateChatDetectedLanguage:t}=(0,a.Sv)(),s=Dn.get(e);if(!s)return;const n=s.size;if(n<8)return;let i=0,o=0;const r=new Map;for(const e of s.values()){e.isTranslatable&&i++,e.detectedLanguage&&o++;const t=e.detectedLanguage;if(t){const e=r.get(t)||0;r.set(t,e+1)}}if(i/n<.3||o/n<.6)return;t({chatId:e,detectedLanguage:Array.from(r.entries()).sort((([,e],[,t])=>t-e))[0][0]})}),1e3);var qn=s(45277),Gn=s(75368);const Hn=3*C.Gw,Vn=Number(C.Gw),$n="data-is-document-group-hover";function zn(e,t,s,n,o,r,c,d,l,u,m,h,p){const{updateDraftReplyInfo:g,sendDefaultReaction:f}=(0,a.Sv)(),[I,w,v]=(0,xs.Z)(),[b,y,P]=(0,xs.Z)(),Z=(0,Tt.sO)(),C=(0,Un.Z)((e=>{const t=m.current;if(!t)return;const{clientX:s,clientY:a}=e,{x:n,width:i,y:o,height:r}=t.getBoundingClientRect(),c=n+i/2,d=o+r/2,l=Math.abs(c-s)<Hn,u=Math.abs(d-a)<Vn;l&&u?w():v()}),[m],Bt.i$);return(0,Tt.d4)((()=>{if(!i.$b||n||!o||u||!p())return;let e;return(0,Zs.sf)(t.current,{selectorToPreventScroll:".MessageList",excludedClosestSelector:".no-word-wrap",onSwipe:(t,s)=>s===Zs.eM.Left&&(e||(e=Date.now()),y(),!0),onRelease:()=>{e&&o&&(g({replyToMsgId:s}),setTimeout(P,Math.max(0,150-(Date.now()-e))),e=void 0)}})}),[t,n,s,y,P,o,u,p]),{handleMouseDown:n?void 0:function(e){(0,sn.q)(e),d(e)},handleClick:function(t){if(n)e(t);else if(i.$b)return Z.current?(clearInterval(Z.current),Z.current=void 0,void f({chatId:l,messageId:s})):void(Z.current=setTimeout((()=>{Z.current=void 0,function(e){if(i.wZ){const t=e.target;if(!t.classList.contains("text-content")&&!t.classList.contains("Message"))return;S.Z.getIsKeyboardVisible()?setTimeout((()=>{c(e)}),350):c(e)}}(t)}),200))},handleContextMenu:n?r?yn.Z:void 0:function(t){if(i.wZ){if(t.target.matches("a[href]")||u)return;t.preventDefault(),e()}else c(t)},handleDoubleClick:n?void 0:function(){!i.$b&&o&&g({replyToMsgId:s})},handleContentDoubleClick:i.$b?void 0:function(e){e.stopPropagation()},handleMouseMove:C,handleSendQuickReaction:function(e){e.stopPropagation(),f({chatId:l,messageId:s})},handleMouseLeave:function(e){(0,Bt.i$)(v),h&&function(e){const t=Jn(e.currentTarget);t&&t.removeAttribute($n)}(e)},isSwiped:b,isQuickReactionVisible:I,handleDocumentGroupMouseEnter:Kn}}function Kn(e){const t=Jn(e.currentTarget);t&&t.setAttribute($n,"")}function Jn(e){let t=e;do{t=t.nextElementSibling}while(t&&!t.classList.contains("last-in-document-group"));return t}var Wn=s(73482),Yn=s(70172),Xn=s(82535),Qn=s(78780),ei=s(32683),ti=s(39415),si=s(65979);const ai=({story:e,sender:t,noUserColors:s,isProtected:n,observeIntersectionForLoading:i,onClick:o})=>{const{showNotification:r}=(0,a.Sv)(),c=(0,Is.Z)(),d=(0,Tt.sO)(null),l=(0,gn.Op)(d,i),u=e&&"content"in e,m=e&&"isDeleted"in e,h=u&&Boolean(e.content.video),p=u?"Story":m?"ExpiredStory":"Loading",g=(0,ba.Z)(u&&(0,I.Cc)(e,"pictogram"),!l),f=h?e.content.video.thumbnail?.dataUri:void 0,w=g||f,v=t?(0,I.OU)(c,t):void 0,b=(0,qt.Z)((()=>{e&&!m?o():r({message:c("StoryNotFound")})})),{handleClick:y,handleMouseDown:P}=(0,ti.m)(b);return Tt.ZP.createElement("div",{ref:d,className:(0,xt.Z)("EmbeddedMessage",(0,Pn.D)(t,s,!0),w&&"with-thumb"),onClick:y,onMouseDown:P},w&&function(e,t){const{width:s,height:a}=(0,C.W7)();return Tt.ZP.createElement("div",{className:"embedded-thumb"},Tt.ZP.createElement("img",{src:e,width:s,height:a,alt:"",className:"pictogram",draggable:!1}),t&&Tt.ZP.createElement("span",{className:"protector"}))}(w,n),Tt.ZP.createElement("div",{className:"message-text with-message-color"},Tt.ZP.createElement("p",{className:"embedded-text-wrapper"},m&&Tt.ZP.createElement(si.Z,{name:"story-expired",className:"embedded-origin-icon"}),u&&Tt.ZP.createElement(si.Z,{name:"story-reply",className:"embedded-origin-icon"}),c(p)),Tt.ZP.createElement("div",{className:"message-title"},(0,ga.Z)(v||" "))))};var ni=s(50685),ii=s(14612),oi=s(48198),ri=s(98138),ci=s(2995);var di=s(69123);const li=1.125*C.Gw,ui=(0,Tt.X$)((({topic:e,className:t,onClick:s})=>{const a=(0,Is.Z)();return Tt.ZP.createElement("div",{className:(0,xt.Z)("JldIqqof",t),style:`--topic-button-accent-color: var(${(0,ri.gZ)(e?.iconColor)})`,onClick:s},e?Tt.ZP.createElement(ci.Z,{topic:e,size:li}):Tt.ZP.createElement("img",{src:di,alt:"",draggable:!1}),e?.title?(0,ga.Z)(e.title):a("Loading"),e?.isClosed&&Tt.ZP.createElement("i",{className:"icon icon-lock"}),Tt.ZP.createElement("i",{className:"icon icon-next"}))}));function mi(e){return(0,Tt.X$)((0,a.c$)(((e,t)=>{const{message:s}=t;return{isInSelectMode:(0,b.CAb)(e),isSelected:(0,b.vkB)(e,s.id)}}))((t=>{const{isInSelectMode:s,isSelected:n,message:i,dimensions:o}=t,{toggleMessageSelection:r}=(0,a.Sv)(),c=(0,qt.Z)((e=>{e.stopPropagation(),r({messageId:i.id,withShift:e?.shiftKey})})),d=(0,Tt.Ye)((()=>{const{dimensions:e,onClick:a}=t;return{...t,isInSelectMode:s,isSelected:n,dimensions:{...e,x:0,y:0},onClick:s?void 0:a}}),[t,s,n]);return Tt.ZP.createElement("div",{className:(0,xt.Z)("album-item-select-wrapper",n&&"is-selected"),style:o?`left: ${o.x}px; top: ${o.y}px;`:"",onClick:s?c:void 0},s&&Tt.ZP.createElement("div",{className:"message-select-control"},n&&Tt.ZP.createElement("i",{className:"icon icon-select"})),Tt.ZP.createElement(e,d))})))}var hi=s(95822),pi=s(35269);const gi=mi(hi.Z),fi=mi(pi.Z),Ii=(0,a.c$)(((e,{album:t})=>{const{chatId:s}=t.mainMessage,a=(0,b.Puy)(e),n=(0,b.f21)(e,s),i=t.mainMessage.isScheduled;return{theme:a,uploadsByKey:e.fileUploads.byMessageKey,activeDownloadIds:i?n?.scheduledIds:n?.ids}}))((({album:e,observeIntersection:t,hasCustomAppendix:s,isOwn:n,isProtected:i,albumLayout:o,onMediaClick:r,uploadsByKey:c,activeDownloadIds:d,theme:l})=>{const{cancelUploadMedia:u}=(0,a.Sv)(),m=e.messages.length,h=(0,qt.Z)((e=>{u({chatId:e.chatId,messageId:e.id})})),{width:g,height:f}=o.containerStyle;return Tt.ZP.createElement("div",{className:"Album",style:`width: ${g}px; height: ${f}px;`},e.messages.map((function(e,u){const{photo:g,video:f}=(0,I.qp)(e),w=c[(0,p.T)(e)],v=w?.progress,{dimensions:y,sides:P}=o.layout[u],Z=(0,b.bHC)((0,a.Rd)(),e),S=(0,b.__o)((0,a.Rd)(),e);if(g){const a=s&&(n?u===m-1:Boolean(P&Cn.Left&&P&Cn.Bottom));return Tt.ZP.createElement(gi,{id:`album-media-${(0,I.d0)(e.id)}`,message:e,observeIntersectionForLoading:t,canAutoLoad:Z,shouldAffectAppendix:a,uploadProgress:v,dimensions:y,isProtected:i,onClick:r,onCancelUpload:h,isDownloading:d?.includes(e.id),theme:l})}if(f)return Tt.ZP.createElement(fi,{id:`album-media-${(0,I.d0)(e.id)}`,message:e,observeIntersectionForLoading:t,canAutoLoad:Z,canAutoPlay:S,uploadProgress:v,dimensions:y,isProtected:i,onClick:r,onCancelUpload:h,isDownloading:d?.includes(e.id),theme:l})})))}));var wi=s(74753);const vi=7*C.Gw;function bi(e,t,s,n,o,r,c){const{interactWithAnimatedEmoji:d,sendEmojiInteraction:l,sendWatchingEmojiInteraction:u}=(0,a.Sv)(),m=(0,Tt.sO)(null),h=(0,Tt.sO)(null),p=(0,ba.Z)(s?`document${s}`:void 0,!s),g=c||vi,f=(0,Aa.Z)(`width: ${g}px`,`height: ${g}px`,r&&!i.D$&&"cursor: pointer"),I=(0,Tt.sO)(void 0),w=(0,Tt.sO)(void 0),v=(0,qt.Z)((()=>{m.current&&(l({chatId:e,messageId:t,emoji:r,interactions:I.current}),w.current=void 0,I.current=void 0)})),b=(0,qt.Z)((()=>{const e=h.current;p&&(e&&(e.pause(),e.remove()),h.current=new Audio,h.current.src=p,(0,wi.Z)(h.current),h.current.addEventListener("ended",(()=>{h.current=void 0}),{once:!0}))})),y=(0,qt.Z)((()=>{b();const s=m.current;if(!(r&&s&&t&&e))return;const{x:a,y:n}=s.getBoundingClientRect();d({emoji:r,x:a,y:n,startSize:g,isReversed:!o}),I.current||(I.current=[],w.current=performance.now(),setTimeout(v,1e3)),I.current.push(w.current?(performance.now()-w.current)/1e3:0)}));return(0,Tt.d4)((()=>{const s=m.current;s&&n&&n.forEach((({id:a,startSize:n,messageId:i})=>{if(n||t!==i)return;const{x:c,y:d}=s.getBoundingClientRect();u({id:a,chatId:e,emoticon:r,startSize:g,x:c,y:d,isReversed:!o}),b()}))}),[n,e,r,o,t,b,u,g]),{ref:m,size:g,style:f,handleClick:y}}const yi=(0,Tt.X$)((0,a.c$)(((e,{customEmojiId:t,withEffects:s})=>{const a=e.customEmojis.byId[t];return{sticker:a,effect:a?.emoji&&s?(0,b.tHA)(e,a.emoji):void 0,soundId:a?.emoji&&(0,b.Ohz)(e,a.emoji),noPlay:!(0,b.W9H)(e)}}))((({isOwn:e,customEmojiId:t,messageId:s,chatId:a,activeEmojiInteractions:n,sticker:i,effect:o,soundId:r,noPlay:c,observeIntersection:d})=>{const{ref:l,size:u,style:m,handleClick:h}=bi(a,s,r,n,e,o?.emoji,(0,Zn.qo)(1));return Tt.ZP.createElement(Ws.Z,{ref:l,documentId:t,className:(0,xt.Z)("AnimatedEmoji media-inner",i?.id===C.wB&&"like-sticker-thumb"),style:m,size:u,isBig:!0,noPlay:c,withSharedAnimation:!0,forceOnHeavyAnimation:Boolean(o&&n?.length),observeIntersectionForLoading:d,onClick:h})})));var Pi=s(45601);const Zi=(0,Tt.X$)((0,a.c$)(((e,{emoji:t,withEffects:s})=>({sticker:(0,b.zB_)(e,t),effect:s?(0,b.tHA)(e,t):void 0,soundId:(0,b.Ohz)(e,t)})))((({isOwn:e,observeIntersection:t,forceLoadPreview:s,messageId:a,chatId:n,activeEmojiInteractions:i,sticker:o,effect:r,soundId:c})=>{const{ref:d,size:l,style:u,handleClick:m}=bi(n,a,c,i,e,r?.emoji),h=(0,gn.Op)(d,t);return Tt.ZP.createElement(Pi.Z,{sticker:o,size:l,quality:1,noLoad:!h,forcePreview:s,play:h,forceAlways:!0,ref:d,className:(0,xt.Z)("AnimatedEmoji media-inner",o?.id===C.wB&&"like-sticker-thumb"),style:u,onClick:m})})));var Si=s(17891),Ci=s(34076);const Mi=(0,Tt.X$)((({isCustomShape:e,threadInfo:t,disabled:s,isLoading:n})=>{const{openThread:i}=(0,a.Sv)(),o=(0,Si.Z)([n],450),r=(0,Is.Z)(),{originMessageId:c,chatId:d,messagesCount:l,lastMessageId:u,lastReadInboxMessageId:m,recentReplierIds:h,originChannelId:p}=t,g=(0,qt.Z)((()=>{i({isComments:!0,chatId:d,originMessageId:c,originChannelId:p})})),f=(0,Tt.Ye)((()=>{if(!h?.length)return;const e=(0,a.Rd)();return h.map((t=>(0,b.RGZ)(e,t))).filter(Boolean)}),[h]);if(void 0===l)return;const I=Boolean(m&&u&&m<u),w=l?r("CommentsCount","%COMMENTS_COUNT%",void 0,l).split("%").map((e=>"COMMENTS_COUNT"===e?Tt.ZP.createElement(Ci.Z,{text:(0,is.bi)(l)}):e)):void 0;return Tt.ZP.createElement("div",{"data-cnt":(0,is.bi)(l),className:(0,xt.Z)("CommentButton",I&&"has-unread",s&&"disabled",e&&"CommentButton-custom-shape",n&&"loading"),dir:r.isRtl?"rtl":"ltr",onClick:g,role:"button",tabIndex:0},Tt.ZP.createElement("i",{className:(0,xt.Z)("CommentButton_icon-comments icon icon-comments-sticker",n&&o&&"CommentButton_hidden"),"aria-hidden":!0}),!f?.length&&Tt.ZP.createElement("i",{className:"icon icon-comments","aria-hidden":!0}),Boolean(f?.length)&&Tt.ZP.createElement("div",{className:"recent-repliers",dir:r.isRtl?"rtl":"ltr"},f.map((e=>Tt.ZP.createElement(Yn.Z,{key:e.id,size:"small",peer:e})))),Tt.ZP.createElement("div",{className:"label",dir:"auto"},l?w:r("LeaveAComment")),Tt.ZP.createElement("div",{className:"CommentButton_right"},n&&Tt.ZP.createElement(js.Z,{className:(0,xt.Z)("CommentButton_loading",!o&&"CommentButton_hidden"),color:e?"white":"blue"}),Tt.ZP.createElement("i",{className:(0,xt.Z)("CommentButton_icon-open icon icon-next",n&&o&&"CommentButton_hidden"),"aria-hidden":!0})))}));var Ei=s(6272),Ri=s(41278);const ki=(0,Tt.X$)((function({peer:e,noUserColors:t,shoudReset:s,className:a,emojiIconClassName:n,children:i}){return Tt.ZP.createElement("div",{className:(0,xt.Z)((0,Pn.D)(e,t,s),a)},e?.color?.backgroundEmojiId&&Tt.ZP.createElement(Ri.Z,{className:n,emojiDocumentId:e.color.backgroundEmojiId}),i)})),Ti="ReDHhQHm";function Ni(e){return e.firstName&&e.lastName?`${e.firstName} ${e.lastName}`:e.firstName?e.firstName:e.lastName?e.lastName:""}const Ai=(0,a.c$)(((e,{contact:t})=>{const{countryList:{phoneCodes:s}}=e;return{user:(0,b.dyD)(e,t.userId),phoneCodeList:s}}))((({contact:e,user:t,phoneCodeList:s})=>{const n=(0,Is.Z)(),{openChat:i,openAddContactDialog:o,showNotification:r,openChatWithInfo:c}=(0,a.Sv)(),{phoneNumber:d,userId:l}=e,u="0"!==l,m=u&&t&&(0,I.kw)(t),h=(0,qt.Z)((()=>{i({id:l})})),p=(0,qt.Z)((()=>{o({userId:t?.id})})),g=(0,qt.Z)((()=>{t?c({id:l}):((0,Fe.TE)(d),r({message:n("PhoneCopied")}))}));return Tt.ZP.createElement(ki,{peer:t,emojiIconClassName:"SjZYi3sJ",className:"AAHWWWvU"},Tt.ZP.createElement("div",{className:"tpDpg82n",onClick:g},Tt.ZP.createElement(Yn.Z,{size:"large",peer:t,text:Ni(e)}),Tt.ZP.createElement("div",{className:"fpYynE5s"},Tt.ZP.createElement("div",{className:"_PNTJc_V"},t?(0,I.Js)(t):Ni(e)),Tt.ZP.createElement("div",{className:"JP_3wes8"},(0,Ei.WZ)(s,d)))),u&&Tt.ZP.createElement(Tt.ZP.Fragment,null,Tt.ZP.createElement("div",{className:"_OSJcuqH"}),Tt.ZP.createElement("div",{className:"Blui4M4G"},Tt.ZP.createElement(ws.Z,{isText:!0,color:"translucent",ripple:!0,onClick:h,className:Ti},n("SharedContactMessage")),m&&Tt.ZP.createElement(ws.Z,{isText:!0,color:"translucent",ripple:!0,onClick:p,className:Ti},n("SharedContactAdd")))))}));var Bi=s(97182);const xi=(0,Tt.X$)((({message:e,canAutoLoadMedia:t})=>{const{clickBotInlineButton:s}=(0,a.Sv)(),n=e.content.game,{title:i,description:o}=n,r=(0,I.N)(n),c=(0,I.Wc)(n),d=(0,ba.Z)(r,!t),l=(0,ba.Z)(c,!t);return Tt.ZP.createElement("div",{className:"Game"},Tt.ZP.createElement("div",{className:"preview",style:"width: 480px; height: 270px",onClick:()=>{s({messageId:e.id,button:e.inlineButtons[0][0]})}},!d&&!l&&Tt.ZP.createElement(mn.Z,{className:"skeleton preview-content"}),d&&Tt.ZP.createElement("img",{className:"preview-content",src:d,alt:i,draggable:!1}),l&&Tt.ZP.createElement("video",{className:"preview-content",playsInline:!0,muted:!0,disablePictureInPicture:!0,autoPlay:!0,loop:!0,src:l})),Tt.ZP.createElement("div",{className:"title"},i),!(0,I.UD)(e)&&Tt.ZP.createElement("div",{className:"description"},o))}));var Ui=s(61463),Li=s(89945),Oi=s(21179),_i=s(17551),Fi=s(27150);const Di="ogvcv3mr",ji="MSFa9BPf",qi="HfZ6SuLI",Gi="rPyyNYxK",Hi="FV70u896",Vi=(0,Tt.X$)((0,a.c$)(((e,{message:t})=>{const{giveaway:s}=t.content,a=(0,b.Z1J)(e,t.chatId);return{chat:a,sender:(0,b.Z1J)(e,s?.channelIds[0])||(0,b.cve)(e,t)||a,giftSticker:s&&(0,b.PGA)(e,s.months),canPlayAnimatedEmojis:(0,b.W9H)(e)}}))((({chat:e,sender:t,message:s,canPlayAnimatedEmojis:n,giftSticker:i})=>{const{openChat:o}=(0,a.Sv)(),r=(0,Tt.sO)(!1),[c,d]=(0,Tt.eJ)(),l=(0,Is.Z)(),{giveaway:u,giveawayResults:m}=s.content,h=Boolean(m),{months:p,untilDate:g,prizeDescription:w}=u||m,v=(0,I.B4)(s),b=h?m.winnersCount:u.quantity,y=(0,we.bp)()>g,P=(0,Tt.Ye)((()=>{if(h)return;const e=new Intl.DisplayNames([l.code,"en"].filter(Boolean),{type:"region"});return u?.countries?.map((t=>`${(0,Ui.Wg)(t)} ${e.of(t)}`)).join(", ")}),[u,h,l.code]),Z=(0,qt.Z)((e=>{o({id:e})})),S=(0,qt.Z)((async()=>{if(r.current)return;r.current=!0;const t=await(0,f.t9)("fetchGiveawayInfo",{peer:e,messageId:s.id});d(t),r.current=!1})),C=(0,qt.Z)((()=>{d(void 0)})),M=(0,Tt.Ye)((()=>{if(c)return l("results"===c.type?"BoostingGiveawayEnd":"BoostingGiveAwayAbout")}),[c,l]);return Tt.ZP.createElement("div",{className:"CbpKtOey"},Tt.ZP.createElement("div",{className:(0,xt.Z)("hjjKhvVv",h&&"JEiR48jJ")},h?Tt.ZP.createElement(Oi.Z,{size:150,tgsUrl:Li.l.PartyPopper,nonInteractive:!0,noLoop:!0}):Tt.ZP.createElement(Pi.Z,{sticker:i,play:n&&y,noLoop:!0,nonInteractive:!0,size:175}),Tt.ZP.createElement("span",{className:"n_QCMv_A"},`x${b}`)),h?function(e){const t=e.winnerIds;return Tt.ZP.createElement(Tt.ZP.Fragment,null,Tt.ZP.createElement("div",{className:ji},Tt.ZP.createElement("strong",{className:Di},(0,ga.Z)(l("BoostingGiveawayResultsMsgWinnersSelected"),["simple_markdown"])),Tt.ZP.createElement("p",{className:qi},(0,ga.Z)(l("BoostingGiveawayResultsMsgWinnersTitle",t.length),["simple_markdown"])),Tt.ZP.createElement("strong",{className:Di},l("lng_prizes_results_winners")),Tt.ZP.createElement("div",{className:Gi},t.map((e=>Tt.ZP.createElement(Ls.Z,{peerId:e,forceShowSelf:!0,fluid:!0,withPeerColors:!v,className:Hi,clickArg:e,onClick:Z}))))),Tt.ZP.createElement("div",{className:ji},Tt.ZP.createElement("p",{className:qi},l("BoostingGiveawayResultsMsgAllWinnersReceivedLinks"))))}(m):function(e){const t=e.channelIds;return Tt.ZP.createElement(Tt.ZP.Fragment,null,Tt.ZP.createElement("div",{className:ji},Tt.ZP.createElement("strong",{className:Di},(0,ga.Z)(l("BoostingGiveawayPrizes"),["simple_markdown"])),w&&Tt.ZP.createElement(Tt.ZP.Fragment,null,Tt.ZP.createElement("p",{className:qi},(0,ga.Z)(l("BoostingGiveawayMsgPrizes",[b,w],void 0,b),["simple_markdown"])),Tt.ZP.createElement(Fi.Z,null,l("BoostingGiveawayMsgWithDivider"))),Tt.ZP.createElement("p",{className:qi},(0,ga.Z)(l("Chat.Giveaway.Info.Subscriptions",b),["simple_markdown"]),Tt.ZP.createElement("br",null),(0,ga.Z)(l("ActionGiftPremiumSubtitle",l("Chat.Giveaway.Info.Months",p)),["simple_markdown"]))),Tt.ZP.createElement("div",{className:ji},Tt.ZP.createElement("strong",{className:Di},(0,ga.Z)(l("BoostingGiveawayMsgParticipants"),["simple_markdown"])),Tt.ZP.createElement("p",{className:qi},(0,ga.Z)(l("BoostingGiveawayMsgAllSubsPlural",t.length),["simple_markdown"])),Tt.ZP.createElement("div",{className:Gi},t.map((e=>Tt.ZP.createElement(Ls.Z,{peerId:e,forceShowSelf:!0,fluid:!0,withPeerColors:!v,className:Hi,clickArg:e,onClick:Z})))),P&&Tt.ZP.createElement("span",null,(0,ga.Z)(l("Chat.Giveaway.Message.CountriesFrom",P)))),Tt.ZP.createElement("div",{className:ji},Tt.ZP.createElement("strong",{className:Di},(0,ga.Z)(l("BoostingWinnersDate"),["simple_markdown"])),Tt.ZP.createElement("p",{className:qi},(0,re.SA)(1e3*g,l.code,!0))))}(u),Tt.ZP.createElement(ws.Z,{className:"jMBw7STU",color:"adaptive",size:"smaller",onClick:S},l("BoostingHowItWork")),Tt.ZP.createElement(_i.Z,{isOpen:Boolean(c),isOnlyConfirm:!0,title:M,confirmHandler:C,onClose:C},function(){if(!t||!c)return;const e="results"===c.type,s=(0,I.Wd)(t)?(0,I.U)(l,t):(0,I.Js)(t),n=l("Chat.Giveaway.Info.Months",p),i=(0,re.$M)(l,1e3*g),o=u?.channelIds?u.channelIds.length-1:0,r=l("Chat.Giveaway.Info.OtherChannels",o),d=o>0,m=l(e?"BoostingGiveawayHowItWorksTextEnd":"BoostingGiveawayHowItWorksText",[s,b,n],void 0,b),h=w?l("BoostingGiveawayHowItWorksIncludeText",[s,b,w],void 0,b):void 0;let f="";f=e?d?"BoostingGiveawayHowItWorksSubTextSeveralEnd":"BoostingGiveawayHowItWorksSubTextEnd":d?"BoostingGiveawayHowItWorksSubTextSeveral":"BoostingGiveawayHowItWorksSubText";let v=l(f,[i,b,s,o],void 0,b);e&&c.activatedCount&&(v+=` ${l("BoostingGiveawayUsedLinksPlural",c.activatedCount)}`);let y="";e&&(y=c.isRefunded?l("BoostingGiveawayCanceledByPayment"):l(c.isWinner?"BoostingGiveawayYouWon":"BoostingGiveawayYouNotWon"));let P="";if(e);else if(c.disallowedCountry)P=l("BoostingGiveawayNotEligibleCountry");else if(c.adminDisallowedChatId){const e=(0,a.Rd)().chats.byId[c.adminDisallowedChatId],t=e&&(0,I.U)(l,e);P=l("BoostingGiveawayNotEligibleAdmin",t)}else if(c.joinedTooEarlyDate){const e=(0,re.$M)(l,1e3*c.joinedTooEarlyDate);P=l("BoostingGiveawayNotEligible",e)}else P=c.isParticipating?d?l("Chat.Giveaway.Info.ParticipatingMany",[s,o]):l("Chat.Giveaway.Info.Participating",s):d?l("Chat.Giveaway.Info.NotQualifiedMany",[s,r,i]):l("Chat.Giveaway.Info.NotQualified",[s,i]);return Tt.ZP.createElement(Tt.ZP.Fragment,null,y&&Tt.ZP.createElement("p",{className:"ZQ4aVVkI"},(0,ga.Z)(y,["simple_markdown"])),Tt.ZP.createElement("p",null,(0,ga.Z)(m,["simple_markdown"])),h&&Tt.ZP.createElement("p",null,(0,ga.Z)(h,["simple_markdown"])),Tt.ZP.createElement("p",null,(0,ga.Z)(v,["simple_markdown"])),P&&Tt.ZP.createElement("p",null,(0,ga.Z)(P,["simple_markdown"])))}()))}))),$i=({message:e,onClick:t})=>{const s=(0,Is.Z)();return Tt.ZP.createElement("div",{className:"InlineButtons"},e.inlineButtons.map((a=>Tt.ZP.createElement("div",{className:"row"},a.map((a=>Tt.ZP.createElement(ws.Z,{size:"tiny",ripple:!0,disabled:"unsupported"===a.type,onClick:()=>t({messageId:e.id,button:a})},Tt.ZP.createElement("span",{className:"inline-button-text"},(0,ga.Z)(s(a.text))),(e=>{const{type:t}=e;switch(t){case"url":if(!n.FSu.test(e.url))return Tt.ZP.createElement("i",{className:"icon icon-arrow-right"});break;case"urlAuth":return Tt.ZP.createElement("i",{className:"icon icon-arrow-right"});case"buy":case"receipt":return Tt.ZP.createElement("i",{className:"icon icon-cart"});case"switchBotInline":return Tt.ZP.createElement("i",{className:"icon icon-share-filled"});case"webView":case"simpleWebView":return Tt.ZP.createElement("i",{className:"icon icon-webapp"})}})(a))))))))};var zi=s(26593),Ki=s(41280);const Ji=(0,Tt.X$)((({message:e,shouldAffectAppendix:t,isInSelectMode:s,isSelected:a,theme:i,forcedWidth:o})=>{const r=(0,Tt.sO)(null),c=(0,Is.Z)(),d=(0,I.eO)(e),{title:l,text:u,amount:m,currency:h,isTest:p,photo:g}=d,f=(0,ba.Z)((0,I.O9)(g)),w=Boolean(o),v=(0,Ki.Z)(e,!w,f);(0,an.Z)((([e])=>{if(t){if(f){const e=r.current.closest(n.be_);(0,zi.Z)(f,!1,a,i).then((t=>{e.style.setProperty("--appendix-bg",t),e.setAttribute(n.s22,"")}))}}else e&&r.current.closest(n.be_).removeAttribute(n.s22)}),[t,f,s,a,i]);const b=o||g?.dimensions?.width,y=(0,Aa.Z)(g?.dimensions&&`width: ${b}px`,g?.dimensions&&`aspect-ratio: ${g.dimensions.width} / ${g.dimensions.height}`,Boolean(!g?.dimensions&&o)&&`width: ${o}px`);return Tt.ZP.createElement("div",{ref:r,className:"Invoice"},l&&Tt.ZP.createElement("p",{className:"title"},(0,ga.Z)(l)),u&&Tt.ZP.createElement("div",null,(0,ga.Z)(u,["emoji","br"])),Tt.ZP.createElement("div",{className:"description "+(g?"has-image":"")},Boolean(g)&&Tt.ZP.createElement("div",{className:"invoice-image-container"},w&&Tt.ZP.createElement("canvas",{ref:v,className:"thumbnail blurred-bg"}),f&&Tt.ZP.createElement("img",{className:"invoice-image",src:f,alt:"",style:y,crossOrigin:"anonymous",draggable:!1}),!f&&g&&Tt.ZP.createElement(mn.Z,{width:b,height:g.dimensions?.height,forceAspectRatio:!0})),Tt.ZP.createElement("p",{className:"description-text"},(0,kt.x)(m,h,c.code),p&&Tt.ZP.createElement("span",null,c("PaymentTestInvoice")))))}));var Wi=s(62230);const Yi={root:"dCK8GQ_8",duration:"CWT8ZMwV",buy:"C38zhCDM",spoiler:"CG55VZP1"},Xi=(0,Tt.X$)((({message:e,isConnected:t})=>{const{openInvoice:s,loadExtendedMedia:n}=(0,a.Sv)(),i=(0,Is.Z)(),o=(0,I.eO)(e),{chatId:r,id:c}=e,d=(0,qt.Z)((()=>{n({chatId:r,ids:[c]})}));(0,_t.Z)(d,t?3e4:void 0);const{amount:l,currency:u,extendedMedia:m}=o,{width:h,height:p,thumbnail:g,duration:f}=m,w=(0,qt.Z)((()=>{s({chatId:r,messageId:c,isExtendedMedia:!0})}));return Tt.ZP.createElement("div",{className:(0,xt.Z)(Yi.root,"media-inner"),onClick:w},Tt.ZP.createElement(Wi.Z,{thumbDataUri:g?.dataUri,width:h,height:p,isVisible:!0,className:Yi.spoiler}),Boolean(f)&&Tt.ZP.createElement("div",{className:Yi.duration},(0,re.k9)(f)),Tt.ZP.createElement("div",{className:Yi.buy},Tt.ZP.createElement("i",{className:(0,xt.Z)("icon","icon-lock",Yi.lock)}),i("Checkout.PayPrice",(0,kt.x)(l,u))))}));var Qi=s(91489);const eo=s.p+"map-pin.899635f6fe777c28998a.svg",to=24*Math.PI,so=1e-4,ao={width:400,height:300,zoom:16,scale:2};function no(){return Tt.ZP.createElement("svg",{className:"round-pin",style:"enable-background:new 0 0 64 64",viewBox:"0 0 64 64"},Tt.ZP.createElement("circle",{cx:"32",cy:"32",r:"24.5"}),Tt.ZP.createElement("path",{d:"M32 8c13.23 0 24 10.77 24 24S45.23 56 32 56 8 45.23 8 32 18.77 8 32 8m0-1C18.19 7 7 18.19 7 32s11.19 25 25 25 25-11.19 25-25S45.81 7 32 7z"}),Tt.ZP.createElement("path",{d:"m29.38 57.67-1.98-1.59 3.02-1.66L32 51.54l1.58 2.88 3.02 1.66-1.91 1.53L32 60.73z"}),Tt.ZP.createElement("path",{d:"m32 52.58 1.07 1.95.14.26.26.14 2.24 1.22-1.33 1.06-.07.06-.06.07L32 59.96l-2.24-2.61-.06-.07-.07-.06-1.33-1.06 2.24-1.22.26-.14.14-.26L32 52.58m0-2.08-1.94 3.56L26.5 56l2.5 2 3 3.5 3-3.5 2.5-2-3.56-1.94L32 50.5z"}))}const io=(0,Tt.X$)((({message:e,peer:t})=>{const{openMapModal:s}=(0,a.Sv)(),n=(0,Tt.sO)(null),i=(0,Tt.sO)(null),o=(0,Is.Z)(),r=(0,Dt.Z)(),c=(0,I.nf)(e),{type:d,geo:l}=c,u=(0,we.bp)(),m=(0,I.$R)(e),h="geoLive"!==d||m?void 0:e.date+c.period-u,[p,g]=(0,Tt.eJ)(l),f="venue"===d||"geoLive"===d&&!m,{width:w,height:v,zoom:b,scale:y}=ao,P=(0,I.k6)(p,w,v,b,y),Z=(0,ba.Z)(P),S=(0,La.Z)(Z,!0),C=Z||S,M=(0,Tt.Ye)((()=>{if("geoLive"!==d||!p.accuracyRadius)return 0;const{lat:e,accuracyRadius:t}=p;return t/(0,Qi.Qw)(e,b)}),[d,p,b]),E=(0,qt.Z)((t=>{if("geoLive"!==d)return;const s=t.lastElementChild,a=t.firstElementChild,n=e.date+c.period-(0,we.bp)(),i=(1-n/c.period)*to,r=(0,re.mB)(o,1e3*n);a.textContent=r,s.firstElementChild.setAttribute("stroke-dashoffset",`-${i}`)}));return(0,Tt.bt)((()=>{i.current&&E(i.current)}),[E]),(0,Tt.d4)((()=>{Math.abs(l.lat-p.lat)<so&&Math.abs(l.long-p.long)<so?p.accuracyRadius!==l.accuracyRadius&&g({...p,accuracyRadius:l.accuracyRadius}):g(l)}),[l,p]),(0,Ft.Z)((()=>{r()}),m?void 0:1e3*(h||0)),(0,_t.Z)((()=>{(0,Bt.WM)((()=>{const e=i.current;e&&E(e)}))}),h?1e3:void 0),Tt.ZP.createElement("div",{ref:n,className:"Location media-inner interactive",onClick:()=>{s({geoPoint:p,zoom:b})}},Tt.ZP.createElement("div",{className:"map-wrapper"},C?Tt.ZP.createElement("img",{className:"full-media map",src:C,alt:"Location on a map",draggable:!1,style:`width: ${ao.width}px; height: ${ao.height}px;`}):Tt.ZP.createElement(mn.Z,{width:w,height:v}),function(){if(C)return Tt.ZP.createElement(Tt.ZP.Fragment,null,Boolean(M)&&!m&&Tt.ZP.createElement("div",{className:"location-accuracy",style:`width: ${2*M}px; height: ${2*M}px`}),function(){const e=(0,xt.Z)("pin",d,m&&"expired");if("geoLive"===d)return Tt.ZP.createElement("div",{className:e},Tt.ZP.createElement(no,null),Tt.ZP.createElement(Yn.Z,{peer:t,className:"location-avatar"}),void 0!==c.heading&&Tt.ZP.createElement("div",{className:"direction",style:`--direction: ${c.heading}deg`}));if("venue"===d){const t=(0,Qi.k4)(c.venueType),s=(0,Qi.lZ)(c.venueType);if(s)return Tt.ZP.createElement("div",{className:e,style:`--pin-color: ${t}`},Tt.ZP.createElement(no,null),Tt.ZP.createElement("img",{src:s,draggable:!1,className:"venue-icon",alt:""}))}return Tt.ZP.createElement("img",{className:e,draggable:!1,src:eo,alt:""})}())}()),function(){if(f)return"venue"===d?Tt.ZP.createElement("div",{className:"location-info"},Tt.ZP.createElement("div",{className:"location-info-title"},c.title),Tt.ZP.createElement("div",{className:"location-info-subtitle"},c.address)):"geoLive"===d?Tt.ZP.createElement("div",{className:"location-info"},Tt.ZP.createElement("div",{className:"location-info-title"},o("AttachLiveLocation")),Tt.ZP.createElement("div",{className:"location-info-subtitle"},(0,re.dJ)(o,u,e.editDate)),!m&&Tt.ZP.createElement("div",{className:"geo-countdown",ref:i},Tt.ZP.createElement("span",{className:"geo-countdown-text"}),Tt.ZP.createElement("svg",{width:"32px",height:"32px"},Tt.ZP.createElement("circle",{cx:"16",cy:"16",r:12,className:"geo-countdown-progress",transform:"rotate(-90, 16, 16)","stroke-dasharray":to,"stroke-dashoffset":"0"})))):void 0}())})),oo=function({isOwn:e}){const t=e?"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":"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";return Tt.ZP.createElement("svg",{width:"9",height:"20",className:"svg-appendix"},Tt.ZP.createElement("defs",null,Tt.ZP.createElement("filter",{x:"-50%",y:"-14.7%",width:"200%",height:"141.2%",filterUnits:"objectBoundingBox",id:"messageAppendix"},Tt.ZP.createElement("feOffset",{dy:"1",in:"SourceAlpha",result:"shadowOffsetOuter1"}),Tt.ZP.createElement("feGaussianBlur",{stdDeviation:"1",in:"shadowOffsetOuter1",result:"shadowBlurOuter1"}),Tt.ZP.createElement("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"}))),Tt.ZP.createElement("g",{fill:"none","fill-rule":"evenodd"},Tt.ZP.createElement("path",{d:t,fill:"#000",filter:"url(#messageAppendix)"}),Tt.ZP.createElement("path",{d:t,fill:e?"#EEFFDE":"FFF",className:"corner"})))};var ro=s(8018);const co=(0,Tt.X$)((({message:e,outgoingStatus:t,signature:s,withReactionOffset:n,repliesThreadInfo:i,renderQuickReactionButton:o,noReplies:r,isTranslated:c,isPinned:d,withFullDate:l,onClick:u,onTranslationClick:m,onOpenThread:h})=>{const{showNotification:p}=(0,a.Sv)(),g=(0,Is.Z)(),[f,I]=(0,xs.Z)();function w(e){e.stopPropagation(),p({message:g("ImportedInfo")})}const v=(0,Tt.Ye)((()=>{if(!f)return;const t=(0,re.SA)(1e3*e.date,g.code,void 0,g.timeFormat),s=e.isEdited&&(0,re.SA)(1e3*e.editDate,g.code,void 0,g.timeFormat),a=e.forwardInfo&&(0,re.SA)(1e3*(e.forwardInfo.savedDate||e.forwardInfo.date),g.code,void 0,g.timeFormat);let n=t;return s&&(n+="\n",n+=g("lng_edited_date").replace("{date}",s)),a&&(n+="\n",n+=g("lng_forwarded_date").replace("{date}",a)),n}),[f,g,e,g.timeFormat]),b=(0,Tt.Ye)((()=>{const t=(0,re.mr)(g,1e3*e.date);return l?(0,re.VX)(g,1e3*(e.forwardInfo?.date||e.date),!0):t}),[g,e.date,e.forwardInfo?.date,l]),y=(0,xt.Z)("MessageMeta",n&&"reactions-offset",e.forwardInfo?.isImported&&"is-imported");return Tt.ZP.createElement("span",{className:y,dir:g.isRtl?"rtl":"ltr",onClick:u,"data-ignore-on-paste":!0},c&&Tt.ZP.createElement("i",{className:"icon icon-language message-translated",onClick:m}),Boolean(e.viewsCount)&&Tt.ZP.createElement(Tt.ZP.Fragment,null,Tt.ZP.createElement("span",{className:"message-views"},(0,is.bi)(e.viewsCount)),Tt.ZP.createElement("i",{className:"icon icon-channelviews"})),!r&&Boolean(i?.messagesCount)&&Tt.ZP.createElement("span",{onClick:function(e){e.stopPropagation(),h()},className:"message-replies-wrapper"},Tt.ZP.createElement("span",{className:"message-replies"},Tt.ZP.createElement(Ci.Z,{text:(0,is.bi)(i.messagesCount)})),Tt.ZP.createElement("i",{className:"icon icon-reply-filled"})),d&&Tt.ZP.createElement("i",{className:"icon icon-pinned-message message-pinned"}),s&&Tt.ZP.createElement("span",{className:"message-signature"},(0,ga.Z)(s)),Tt.ZP.createElement("span",{className:"message-time",title:v,onMouseEnter:I},e.forwardInfo?.isImported&&Tt.ZP.createElement(Tt.ZP.Fragment,null,Tt.ZP.createElement("span",{className:"message-imported",onClick:w},(0,re.SA)(1e3*e.forwardInfo.date,g.code,!0)),Tt.ZP.createElement("span",{className:"message-imported",onClick:w},g("ImportedMessage"))),e.isEdited&&`${g("EditedMessage")} `,b),t&&Tt.ZP.createElement(ro.Z,{status:t}),o&&o())})),lo=(0,Tt.X$)((({phoneCall:e,message:t,chatId:s})=>{const{requestMasterAndRequestCall:n}=(0,a.Sv)(),o=(0,Is.Z)(),{isOutgoing:r,isVideo:c,reason:d,duration:l}=e,u="missed"===d,m="busy"===d||void 0===l,h=(0,qt.Z)((()=>{n({isVideo:c,userId:s})})),p=(0,Tt.Ye)((()=>c?u?r?"CallMessageVideoOutgoingMissed":"CallMessageVideoIncomingMissed":m?"CallMessageVideoIncomingDeclined":r?"CallMessageVideoOutgoing":"CallMessageVideoIncoming":u?r?"CallMessageOutgoingMissed":"CallMessageIncomingMissed":m?"CallMessageIncomingDeclined":r?"CallMessageOutgoing":"CallMessageIncoming"),[m,u,r,c]),g=(0,Tt.Ye)((()=>e.duration?(0,re.J_)(o,e.duration):void 0),[o,e.duration]),f=(0,re.mr)(o,1e3*t.date);return Tt.ZP.createElement("div",{className:"wqsZyy8u"},Tt.ZP.createElement(ws.Z,{size:"smaller",color:"translucent",round:!0,ripple:!0,onClick:h,className:"NGmo4ADz",disabled:!i.Bi,ariaLabel:o(r?"CallAgain":"CallBack")},Tt.ZP.createElement("i",{className:(0,xt.Z)("icon",c?"icon-video-outlined":"icon-phone")})),Tt.ZP.createElement("div",{className:"iFn6m6hd"},Tt.ZP.createElement("div",{className:"l8QfocIQ"},o(p)),Tt.ZP.createElement("div",{className:"rF5tkx92"},Tt.ZP.createElement("i",{className:(0,xt.Z)("icon","icon-arrow-right","ONmpzmUS",u&&"Alra_BWu",m&&"J7xsuCAm",!r&&"BfgDXljM")}),Tt.ZP.createElement("span",{className:"kKPKwFzu"},g?o("CallMessageWithDuration",[f,g]):f))))}));var uo=s(4809),mo=s(51218),ho=s(96937),po=s(14434);function go(e,t){return t>0?(e/t*100).toFixed():0}const fo=({answer:e,voteResults:t,totalVoters:s,maxVotersCount:a,correctResults:n,shouldAnimate:i})=>{const o=t&&t.find((t=>t.option===e.option)),r=0===n.length||-1!==n.indexOf(e.option),c=n.length>0&&r||o?.isChosen,d=o?go(o.votersCount,s||0):0,[l,u]=(0,Tt.eJ)(i?0:d),m=o?go(o.votersCount,a||0):0,h=l!==d;if((0,Tt.d4)((()=>{i&&u(d)}),[i,d]),!t||!o)return;const p=`width: ${m}%; transform:scaleX(${h?0:1})`;return Tt.ZP.createElement("div",{className:"PollOption",dir:"ltr"},Tt.ZP.createElement("div",{className:"poll-option-share "+("100"===d?"limit-width":"")},d,"%",c&&Tt.ZP.createElement("span",{className:(0,xt.Z)("poll-option-chosen",!r&&"wrong",i&&"animate")},Tt.ZP.createElement("i",{className:(0,xt.Z)("icon",r?"icon-check":"icon-close")}))),Tt.ZP.createElement("div",{className:"poll-option-right"},Tt.ZP.createElement("div",{className:"poll-option-text",dir:"auto"},(0,ga.Z)(e.text)),Tt.ZP.createElement("div",{className:(0,xt.Z)("poll-option-answer",c&&!r&&"wrong")},i&&Tt.ZP.createElement("svg",{className:"poll-line",style:h?"":"stroke-dasharray: 100% 200%; stroke-dashoffset: -44"},Tt.ZP.createElement("path",{d:"M4.47 5.33v13.6a9 9 0 009 9h13"})),Tt.ZP.createElement("div",{className:"poll-option-line",style:p}))))},Io=12*Math.PI;function wo(e){e.stopPropagation()}const vo=(0,Tt.X$)((0,a.c$)(((e,{poll:t})=>{const{recentVoterIds:s}=t.results,{users:{byId:a}}=e;return s&&0!==s.length?{recentVoterIds:s,usersById:a}:{}}))((({message:e,poll:t,recentVoterIds:s,onSendVote:n})=>{const{loadMessage:i,openPollResults:o,requestConfetti:r}=(0,a.Sv)(),{id:c,chatId:d}=e,{summary:l,results:u}=t,[m,h]=(0,Tt.eJ)(!1),[p,g]=(0,Tt.eJ)([]),[f,I]=(0,Tt.eJ)(!1),[w,v]=(0,Tt.eJ)(!1),[b,y]=(0,Tt.eJ)(!l.closed&&l.closeDate&&l.closeDate>0?Math.min(l.closeDate-(0,we.bp)(),l.closePeriod):0),P=(0,Tt.sO)(null),Z=(0,Tt.sO)(null),{results:S,totalVoters:C}=u,M=S&&S.some((e=>e.isChosen)),E=!l.closed&&!M,R=!E&&l.isPublic&&Number(u.totalVoters)>0,k=E&&l.multipleChoice,T=S?Math.max(...S.map((e=>e.votersCount))):C,N=(0,Tt.Ye)((()=>S?.filter((e=>e.isCorrect)).map((e=>e.option))||[]),[S]),A=(0,Tt.Ye)((()=>l.answers.map((e=>({label:e.text,value:e.option,hidden:Boolean(l.quiz&&l.closePeriod&&b<=0)})))),[b,l]);(0,Tt.d4)((()=>{const e=t.results.results?.find((e=>e.isChosen));m&&e&&(e.isCorrect&&r({}),h(!1))}),[m,t.results.results,r]),(0,Tt.bt)((()=>{if(b>0&&setTimeout((()=>y(b-1)),1e3),!Z.current)return;b<=5&&P.current.classList.add("hurry-up");const e=(l.closePeriod-b)/l.closePeriod*Io;Z.current.setAttribute("stroke-dashoffset",`-${e}`)}),[b,l.closePeriod]),(0,Tt.d4)((()=>{l.quiz&&(b<=0||M&&!l.closed)&&i({chatId:d,messageId:c})}),[d,b,M,i,c,l.closed,l.quiz]),(0,Tt.d4)((()=>{let e;return l.quiz&&!l.closed&&l.closePeriod&&l.closePeriod>0&&(e=window.setTimeout((()=>{i({chatId:d,messageId:c})}),1e3*l.closePeriod)),()=>{e&&window.clearTimeout(e)}}),[E,d,i,c,l.closePeriod,l.closed,l.quiz]);const B=(0,Tt.Ye)((()=>{const e=(0,a.Rd)().chats.byId,t=(0,a.Rd)().users.byId;return s?s.reduce(((s,a)=>{const n=e[a],i=t[a];return i?s.push(i):n&&s.push(n),s}),[]):[]}),[s]),x=(0,qt.Z)((e=>{g([e]),h(!0),v(!0),n([e])})),U=(0,qt.Z)((e=>{g(e)})),L=(0,qt.Z)((()=>{h(!0),v(!0),n(p)})),O=(0,qt.Z)((()=>{o({chatId:d,messageId:c})})),_=(0,qt.Z)((()=>{I(!0)})),F=(0,qt.Z)((()=>{I(!1),v(!1)}));(0,Tt.d4)((()=>{w&&M&&l.quiz&&u.results&&t.results.solution&&(u.results.find((e=>e.isChosen&&e.isCorrect))||I(!0))}),[M,w,u.results,l.quiz,t.results.solution]);const D=(0,Is.Z)();return Tt.ZP.createElement("div",{className:"Poll",dir:D.isRtl?"auto":"ltr"},f&&t.results.solution&&Tt.ZP.createElement(ho.Z,{message:(0,uo.H)({text:t.results.solution,entities:t.results.solutionEntities}),duration:5e3,onDismiss:F,containerId:"#middle-column-portals"}),Tt.ZP.createElement("div",{className:"poll-question"},(0,ga.Z)(l.question,["emoji","br"])),Tt.ZP.createElement("div",{className:"poll-type"},D(function(e){return void 0===e.isPublic?" ":e.closed?"FinalResults":e.quiz?e.isPublic?"QuizPoll":"AnonymousQuizPoll":e.isPublic?"PublicPoll":"AnonymousPoll"}(l)),B.length>0&&Tt.ZP.createElement("div",{className:"poll-recent-voters"},B.map((e=>Tt.ZP.createElement(Yn.Z,{key:e.id,size:"micro",peer:e})))),b>0&&E&&Tt.ZP.createElement("div",{ref:P,className:"poll-countdown"},Tt.ZP.createElement("span",null,(0,re.k9)(b)),Tt.ZP.createElement("svg",{width:"16px",height:"16px"},Tt.ZP.createElement("circle",{ref:Z,cx:"8",cy:"8",r:6,className:"poll-countdown-progress",transform:"rotate(-90, 8, 8)","stroke-dasharray":Io,"stroke-dashoffset":"0"}))),l.quiz&&t.results.solution&&!E&&Tt.ZP.createElement(ws.Z,{round:!0,size:"tiny",color:"translucent",className:"poll-quiz-help",disabled:f,onClick:_,ariaLabel:"Show Solution"},Tt.ZP.createElement("i",{className:"icon icon-lamp"}))),E&&Tt.ZP.createElement("div",{className:"poll-answers",onClick:wo},k?Tt.ZP.createElement(mo.Z,{options:A,onChange:U,disabled:e.isScheduled||m,loadingOptions:m?p:void 0,round:!0}):Tt.ZP.createElement(po.Z,{name:`poll-${c}`,options:A,onChange:x,disabled:e.isScheduled||m,loadingOption:m?p[0]:void 0})),!E&&Tt.ZP.createElement("div",{className:"poll-results"},l.answers.map((function(e){return Tt.ZP.createElement(fo,{key:e.option,shouldAnimate:w||!E,answer:e,voteResults:S,totalVoters:C,maxVotersCount:T,correctResults:N})}))),!R&&!k&&Tt.ZP.createElement("div",{className:"poll-voters-count"},function(e,t,s){return s?e(t?"Answer":"Vote",s,"i"):e(t?"Chat.Quiz.TotalVotesEmpty":"Chat.Poll.TotalVotesResultEmpty")}(D,l.quiz,u.totalVoters)),k&&Tt.ZP.createElement(ws.Z,{isText:!0,disabled:0===p.length,size:"tiny",onClick:L},D("PollSubmitVotes")),R&&Tt.ZP.createElement(ws.Z,{isText:!0,size:"tiny",onClick:O},D("PollViewResults")))})));var bo=s(65351),yo=s(36368),Po=s(31482);const Zo=1.25*C.Gw,So=(0,Tt.X$)((({reaction:e,containerId:t,isOwnMessage:s,recentReactors:a,className:n,chosenClassName:i,observeIntersection:o,onClick:r})=>{const c=(0,qt.Z)((()=>{r?.(e.reaction)}));return Tt.ZP.createElement(ws.Z,{className:(0,xt.Z)(Po.Z.root,s&&Po.Z.own,(0,I.Bt)(e)&&Po.Z.chosen,(0,I.Bt)(e)&&i,n),size:"tiny",onClick:c},Tt.ZP.createElement(yo.Z,{className:Po.Z.animatedEmoji,containerId:t,reaction:e.reaction,size:Zo,observeIntersection:o}),a?.length?Tt.ZP.createElement(bo.Z,{size:"mini",peers:a}):Tt.ZP.createElement(Ci.Z,{text:(0,is.bi)(e.count),className:Po.Z.counter}))}));var Co=s(14018);const Mo=(0,Tt.X$)((({message:e,isOutside:t,maxWidth:s,metaChildren:n,observeIntersection:i,noRecentReactors:o,isCurrentUserPremium:r,tags:c})=>{const{toggleReaction:d,setLocalTextSearchTag:l,searchTextMessagesLocal:u,openPremiumModal:m}=(0,a.Sv)(),h=(0,Is.Z)(),{results:g,areTags:f,recentReactions:w}=e.reactions,v=(0,Tt.Ye)((()=>g.reduce(((e,t)=>e+t.count),0)),[g]),y=(0,Tt.Ye)((()=>{const e=(0,a.Rd)();return w?.reduce(((t,s)=>{const{reaction:a,peerId:n}=s,i=(0,I.jq)(a),o=(0,b.RGZ)(e,n);if(!o)return t;const r=t[i]||[];return r.push(o),t[i]=r,t}),{})}),[w]),P=(0,Tt.Ye)((()=>{const t=(0,p.T)(e);return g.map((e=>{const s=(0,I.jq)(e.reaction),a=y?.[s],n=v>3||o,i=f?c?.[s]:void 0;return{reaction:e,reactionKey:s,messageKey:t,recentReactors:n?void 0:a,isChosen:(0,I.Bt)(e),tag:i}}))}),[e,o,y,g,f,c,v]),Z=(0,qt.Z)((t=>{if(f)return r?(l({tag:t}),void u()):void m({initialSection:"saved_tags"});d({chatId:e.chatId,messageId:e.id,reaction:t})})),S=(0,qt.Z)((t=>{d({chatId:e.chatId,messageId:e.id,reaction:t})}));return Tt.ZP.createElement("div",{className:(0,xt.Z)("Reactions",t&&"is-outside"),style:s?`max-width: ${s}px`:void 0,dir:h.isRtl?"rtl":"ltr"},P.map((({reaction:t,recentReactors:s,messageKey:a,reactionKey:n,isChosen:o,tag:c})=>f?Tt.ZP.createElement(Co.Z,{key:n,className:"message-reaction",chosenClassName:"chosen",containerId:a,isOwnMessage:e.isOutgoing,isChosen:o,reaction:t.reaction,tag:c,withContextMenu:r,onClick:Z,onRemove:S,observeIntersection:i}):Tt.ZP.createElement(So,{key:n,className:"message-reaction",chosenClassName:"chosen",containerId:a,isOwnMessage:e.isOutgoing,recentReactors:s,reaction:t,onClick:Z,observeIntersection:i}))),n)}));var Eo=s(56766),Ro=s(97799);const ko=({message:e,observeIntersection:t,observeIntersectionForPlaying:s,shouldLoop:n,shouldPlayEffect:o,withEffect:c,onPlayEffect:d,onStopEffect:l})=>{const{showNotification:u,openStickerSet:m}=(0,a.Sv)(),h=(0,Is.Z)(),{isMobile:p}=(0,B.ZP)(),g=(0,Tt.sO)(null),f=e.content.sticker,{stickerSetInfo:w,isVideo:v,hasEffect:b}=f,y=f.isPreloadedGlobally?void 0:(0,I.Ti)(e,v&&!i.Hh?"pictogram":"inline"),P=(0,gn.Op)(g,t),Z=(0,gn.Op)(g,s),S=`sticker${f.id}?size=f`,M=(0,ba.Z)(S,!P||!b,r.IU.BlobUrl),[E,R,k]=(0,xs.Z)(),T=(0,qt.Z)((()=>{k(),l?.()})),N=(0,La.Z)(o);(0,Tt.d4)((()=>{b&&c&&Z&&(o||N)&&(R(),d?.())}),[b,Z,d,o,N,R,c]);const A=(0,qt.Z)((()=>{m({stickerSetInfo:f.stickerSetInfo})})),x=(0,qt.Z)((()=>{if(b){if(E||!c)return void u({message:h("PremiumStickerTooltip"),action:{action:"openStickerSet",payload:{stickerSetInfo:f.stickerSetInfo}},actionText:h("ViewAction")});if(c)return R(),void d?.()}A()})),U="isMissing"in w,{width:L,height:O}=(0,C.Wr)(f,p),_=(0,xt.Z)("Sticker media-inner",U&&"inactive",b&&!e.isOutgoing&&"reversed");return Tt.ZP.createElement("div",{ref:g,className:_,style:`width: ${L}px; height: ${O}px;`,onClick:U?void 0:x},Tt.ZP.createElement(cn.Z,{containerRef:g,sticker:f,fullMediaHash:y,fullMediaClassName:"full-media",size:L,shouldLoop:n,noLoad:!P,noPlay:!Z,withSharedAnimation:!0}),b&&c&&P&&E&&Tt.ZP.createElement(Ro.Z,{key:S,className:"effect-sticker",tgsUrl:M,size:1.49*L,play:!0,isLowPriority:!0,noLoop:!0,onEnded:T}))};var To=s(93609);const No=(0,Tt.X$)((0,a.c$)(((e,{message:t})=>{const{id:s,peerId:a}=t.content.storyData;return{story:(0,b.JrV)(e,a,s),isConnected:"connectionStateReady"===e.connectionState}}))((function({message:e,story:t,isProtected:s,isConnected:a}){const{storyData:n}=e.content;return Tt.ZP.createElement(To.Z,{story:t||n,isProtected:s,isConnected:a})}))),Ao=(0,Tt.X$)((0,a.c$)(((e,{message:t})=>{const{id:s,peerId:a}=t.content.storyData,n=(0,b.nST)(e,a)?.lastReadId;return{story:(0,b.JrV)(e,a,s),peer:(0,b.RGZ)(e,a),targetUser:(0,b.dyD)(e,t.chatId),isUnread:Boolean(n&&n<s)}}))((function({message:e,story:t,peer:s,isUnread:n,targetUser:i}){const{openStoryViewer:o}=(0,a.Sv)(),r=(0,Is.Z)(),{storyData:c}=e.content,d=(0,qt.Z)((()=>{o({peerId:t.peerId,storyId:t.id,isSinglePeer:!0,isSingleStory:!0})})),l=t&&"isDeleted"in t,u=t&&"content"in t,m=u?t.content.video:void 0,h=u?(0,I.Cc)(t,"pictogram"):void 0,p=(0,ba.Z)(h)||m?.thumbnail?.dataUri;return(0,Tn.Z)(c.peerId,c.id,t),Tt.ZP.createElement("div",{className:(0,xt.Z)("action-message-story-mention",n&&"is-unread",u&&"with-preview"),tabIndex:0,role:"button",onClick:u?d:void 0},u&&Tt.ZP.createElement("span",{className:"story-media-wrapper"},p&&Tt.ZP.createElement("img",{src:p,alt:"",className:"story-media"})),Tt.ZP.createElement("span",{className:"story-title"},(0,ga.Z)(s&&"isSelf"in s&&s.isSelf?r(l?"ExpiredStoryMentioned":"StoryYouMentionedTitle",(0,I.Vl)(i)):l?r("ExpiredStoryMention"):r("StoryMentionedTitle",(0,I.OU)(r,s)),["emoji","simple_markdown"])))})));var Bo=s(54659);const xo=1.75*C.Gw,Uo=2.25*C.Gw,Lo=(0,Tt.X$)((0,a.c$)(((e,t)=>{const{focusedMessage:s,forwardMessages:a,activeReactions:o,activeEmojiInteractions:c,loadingThread:d}=(0,b.jUK)(e),{message:l,album:u,withSenderName:m,withAvatar:h,threadId:g,messageListType:f,isLastInDocumentGroup:w,isFirstInGroup:v}=t,{id:y,chatId:P,viaBotId:S,isOutgoing:C,forwardInfo:M,transcriptionId:E,isPinned:R}=l,k=(0,b.Z1J)(e,P),T=(0,b.FM1)(e,P),N=(0,I.pK)(P),A=(0,I.wo)(P),B=k&&(0,I.eA)(k),x=k&&(0,I.Bf)(k),U=(0,I.YC)(P)?void 0:(0,b.x67)(e,P),L=l.content.webPage?.story,O=L?(0,b.JrV)(e,L.peerId,L.id):void 0,_=a.messageIds&&a.messageIds.includes(y),F=!T&&(0,I.Ul)(l),D=m||h||F,j=(0,b.Urc)(e,l),q=(0,b.cve)(e,l),G=S?(0,b.dyD)(e,S):void 0,H=j?.id&&x?U?.adminMembersById?.[j?.id]:void 0,V=l.id===g,{replyToMsgId:$,replyToPeerId:z,replyFrom:K}=(0,Z.H)(l)||{},{peerId:J,storyId:W}=(0,Z.f)(l)||{},Y=$&&$===g,X=$?(0,b.hjO)(e,z||P,$):void 0,Q=M||K,ee=X?(0,b.BzW)(e,X):!Q||N||A?void 0:(0,b.zDD)(e,Q),te=X&&(0,b.cve)(e,X),se=z?(0,b.Z1J)(e,z):void 0,ae=!N&&!A&&se&&!(0,I.Sb)(se)&&(se.isNotJoined||se.isRestricted),ne="topicCreate"===X?.content.action?.type,ie=W&&J?(0,b.JrV)(e,J,W):void 0,oe=J?(0,b.RGZ)(e,J):void 0,re=(0,b.uZE)(e,l),ce="thread"===f&&(u?u.messages.some((t=>(0,b._XY)(e,t,g))):(0,b._XY)(e,l,g)),{direction:de,noHighlight:le,isResizingContainer:ue,quote:me}=ce&&s||{},{query:he}=(0,b.n5x)(e)||{},pe=(0,I.h_)(l),ge=pe&&(0,b.zB_)(e,pe)?pe:void 0,fe=(0,I.HW)(l);let Ie;Ie=u?.messages?u.messages.every((({id:t})=>(0,b.vkB)(e,t))):(0,b.vkB)(e,y);const{canReply:we}="thread"===f&&(0,b._kf)(e,l,g)||{},ve=(0,b.teg)(e,l),be=(0,b.tZg)(e,P,u?.mainMessage.id||y),ye=Boolean(l.groupedId)&&!l.isInAlbum,Pe=ye?(0,b.xHX)(e,P,l.groupedId)[0]:void 0,Ze=ye?w?(0,b.hjO)(e,P,Pe):void 0:l,Se=k?.unreadReactions?.includes(l.id),Ce=g===r._f&&k?.isForum&&v,Me=Ce?(0,b.p$s)(e,l)||k?.topics?.[n.OxA]:void 0,Ee=(0,b.xfm)(e,P),Re=(0,b.Bdn)(e,P,l.id),ke=(0,b.lpX)(e,P),Te=i.SX&&e.settings.byKey.canTranslate&&!ke,Ne="connectionStateReady"===e.connectionState,Ae=Boolean(Ze&&o[(0,p.T)(Ze)]?.length),Be=(0,b.wVz)(e),xe=j&&(0,b.FM1)(e,j.id)?U?.boostsApplied??l.senderBoosts:l.senderBoosts,Ue=k?.boostLevel||0,Le=e.appConfig?.groupTranscribeLevelMin,Oe=Be||Boolean(Le&&Ue>=Le);return{theme:(0,b.Puy)(e),forceSenderName:F,sender:j,canShowSender:D,originSender:q,botSender:G,shouldHideReply:Y||ne,isThreadTop:V,replyMessage:X,replyMessageSender:ee,replyMessageForwardSender:te,replyMessageChat:se,replyStory:ie,isReplyPrivate:ae,storySender:oe,isInDocumentGroup:ye,isProtected:(0,b.EVS)(e,l),isChatProtected:(0,b.AmN)(e,P),isFocused:ce,isForwarding:_,reactionMessage:Ze,isChatWithSelf:T,isRepliesChat:N,isAnonymousForwards:A,isChannel:B,isGroup:x,canReply:we,highlight:he,animatedEmoji:ge,animatedCustomEmoji:fe,isInSelectMode:(0,b.CAb)(e),isSelected:Ie,isGroupSelected:Boolean(l.groupedId)&&!l.isInAlbum&&(0,b.a65)(e,P,l.groupedId),threadId:g,isDownloading:ve,isPinnedList:"pinned"===f,isPinned:R,canAutoLoadMedia:(0,b.bHC)(e,l),canAutoPlayMedia:(0,b.__o)(e,l),autoLoadFileMaxSizeMb:e.settings.byKey.autoLoadFileMaxSizeMb,shouldLoopStickers:(0,b.yBd)(e),repliesThreadInfo:be,availableReactions:e.reactions.availableReactions,defaultReaction:(0,I.CI)(l)||"scheduled"===f?void 0:(0,b.q6x)(e,P),hasActiveReactions:Ae,activeEmojiInteractions:c,hasUnreadReaction:Se,isTranscribing:void 0!==E&&e.transcriptions[E]?.isPending,transcribedText:void 0!==E?e.transcriptions[E]?.text:void 0,isPremium:Be,senderAdminMember:H,messageTopic:Me,hasTopicChip:Ce,chatTranslations:Ee,areTranslationsEnabled:Te,shouldDetectChatLanguage:(0,b.J1l)(e,P),requestedTranslationLanguage:Re,requestedChatTranslationLanguage:ke,hasLinkedChat:Boolean(U?.linkedChatId),withStickerEffects:(0,b.$Yd)(e,"stickerEffects"),webPageStory:O,isConnected:Ne,isLoadingComments:be?.isCommentsInfo&&d?.loadingChatId===be?.originChannelId&&d?.loadingMessageId===be?.originMessageId,shouldWarnAboutSvg:e.settings.byKey.shouldWarnAboutSvg,...C&&{outgoingStatus:(0,b.dTW)(e,l,"scheduled"===f)},..."number"==typeof re&&{uploadProgress:re},...ce&&{focusDirection:de,noFocusHighlight:le,isResizingContainer:ue,focusedQuote:me},senderBoosts:xe,tags:e.savedReactionTags?.byKey,canTranscribeVoice:Oe}}))((({message:e,observeIntersectionForBottom:t,observeIntersectionForLoading:s,observeIntersectionForPlaying:o,album:d,noAvatars:l,withAvatar:u,withSenderName:m,noComments:h,noReplies:p,appearanceOrder:g,isJustAdded:f,isFirstInGroup:w,isPremium:v,isLastInGroup:b,isFirstInDocumentGroup:y,isLastInDocumentGroup:P,isTranscribing:S,transcribedText:M,isLastInList:E,theme:R,forceSenderName:k,sender:T,canShowSender:N,originSender:A,botSender:x,isThreadTop:U,shouldHideReply:L,replyMessage:O,replyMessageSender:_,replyMessageForwardSender:F,replyMessageChat:D,replyStory:j,isReplyPrivate:q,storySender:G,outgoingStatus:H,uploadProgress:V,isInDocumentGroup:$,isLoadingComments:z,isProtected:K,isChatProtected:J,isFocused:W,focusDirection:Y,focusedQuote:X,noFocusHighlight:Q,isResizingContainer:ee,isForwarding:te,isChatWithSelf:se,isRepliesChat:ae,isAnonymousForwards:ne,isChannel:ie,isGroup:oe,canReply:re,highlight:ce,animatedEmoji:de,animatedCustomEmoji:le,hasActiveReactions:ue,hasLinkedChat:me,isInSelectMode:he,isSelected:pe,isGroupSelected:ge,threadId:fe,reactionMessage:Ie,availableReactions:we,defaultReaction:ve,activeEmojiInteractions:be,messageListType:ye,isPinnedList:Pe,isPinned:Ze,isDownloading:Se,canAutoLoadMedia:Ce,canAutoPlayMedia:Me,shouldLoopStickers:Ee,autoLoadFileMaxSizeMb:Re,repliesThreadInfo:ke,hasUnreadReaction:Te,memoFirstUnreadIdRef:Ne,senderAdminMember:Ae,messageTopic:Be,hasTopicChip:xe,chatTranslations:Ue,areTranslationsEnabled:Le,shouldDetectChatLanguage:Oe,requestedTranslationLanguage:_e,requestedChatTranslationLanguage:Fe,withStickerEffects:De,webPageStory:je,isConnected:qe,getIsMessageListReady:Ge,shouldWarnAboutSvg:He,senderBoosts:Ve,tags:$e,canTranscribeVoice:ze,onPinnedIntersectionChange:Ke})=>{const{toggleMessageSelection:Je,clickBotInlineButton:We,disableContextMenuHint:Ye,animateUnreadReaction:Xe,focusLastMessage:Qe}=(0,a.Sv)(),et=(0,Tt.sO)(null),tt=(0,Tt.sO)(null),st=(0,Tt.sO)(null),at=(0,Tt.sO)(0),nt=(0,Is.Z)(),[it,ot]=(0,Tt.eJ)(!1),[rt,ct,dt]=(0,xs.Z)(),{isMobile:lt,isTouchScreen:ut}=(0,B.ZP)();(0,gn._N)(tt,t);const{isContextMenuOpen:mt,contextMenuPosition:ht,contextMenuTarget:pt,handleBeforeContextMenu:gt,handleContextMenu:ft,handleContextMenuClose:It,handleContextMenuHide:wt}=(0,Ia.Z)(et,ut&&he,!i.D$,i.wZ,Ge);(0,Tt.d4)((()=>{mt&&Ye()}),[mt,Ye]);const vt=g<=0,[bt,yt]=(0,xs.Z)(vt);(0,Tt.d4)((()=>{vt||setTimeout(yt,10*g)}),[g,yt,vt]);const{transitionClassNames:Pt}=(0,$t.Z)(bt||f,void 0,vt&&!f,!1),{id:Zt,chatId:St,forwardInfo:Ct,viaBotId:Mt,isTranscriptionError:Et}=e;(0,Tt.d4)((()=>{if(!Ze)return;const e=d?d.mainMessage.id:Zt;return()=>{Ke({viewportPinnedIdsToRemove:[e],isUnmount:!0})}}),[d,Ze,Zt,Ke]);const Rt=(0,I.CI)(e),kt=(0,I.B4)(e),Nt="scheduled"===ye||e.isScheduled,At=(0,I.V5)(e)&&!L,Bt=(0,Z.H)(e),Ut=(0,Z.f)(e),Lt=Boolean(Ut),Ot=Boolean(ke)&&"thread"===ye,_t=(0,I.$D)(e),Ft=_t&&(de||le),Dt=Ie?.reactions&&!(0,I.JE)(Ie.reactions),Gt=Ct&&(!se||Nt)&&!ae&&!ne&&!Ct.isLinkedChannelPost&&!_t||Boolean(e.content.storyData&&!e.content.storyData.isMention),Ht=e.content.storyData?.isMention,Vt=Boolean(d)&&d.messages.length>1&&!d?.messages.some((e=>0===Object.keys(e.content).length)),zt=$&&!y,Kt=$&&!P,Jt=void 0!==ht,Wt=!(Jt||he||te||Kt||Ht),Yt=ie&&!Nt&&e.isForwardingAllowed&&!J,Xt=Boolean(Pe||Ct&&(Ct.isChannelPost||se&&!kt||ae||ne)&&Ct.fromMessageId),Qt=kt&&!_t,es=xe||At||Lt,ts=(0,qt.Z)(((e,t)=>{Je({messageId:Zt,groupedId:t,...e?.shiftKey&&{withShift:!0},...Vt&&{childMessageIds:d.messages.map((({id:e})=>e))}})})),ss=N?T:void 0,as=Boolean(!it&&(Et||M)),ns=Ct&&(se||ae||ne||!ss)?A:ss,is=A||T,os=Ct||e.content.storyData?A:ss,rs=(0,I.fY)(e),cs=(0,I.qR)(e),{handleMouseDown:ds,handleClick:ls,handleContextMenu:us,handleDoubleClick:ms,handleContentDoubleClick:hs,handleMouseMove:ps,handleSendQuickReaction:gs,handleMouseLeave:fs,isSwiped:vs,isQuickReactionVisible:bs,handleDocumentGroupMouseEnter:ys}=zn(ts,et,Zt,Boolean(he),Boolean(re),Boolean(K),ft,gt,St,Jt,st,Kt,Ge),{handleAvatarClick:Ps,handleSenderClick:Zs,handleViaBotClick:Ss,handleReplyClick:Cs,handleMediaClick:Ms,handleAudioPlay:Es,handleAlbumMediaClick:Rs,handleMetaClick:ks,handleTranslationClick:Ts,handleOpenThread:Ns,handleReadMedia:As,handleCancelUpload:Bs,handleVoteSend:Us,handleGroupForward:Ls,handleForward:Os,handleFocus:_s,handleFocusForwarded:Fs,handleDocumentGroupSelectAll:Ds,handleTopicChipClick:js,handleStoryClick:qs}=function(e,t,s,n,i,o,d,l,u,m,h,p,g,f,I,w,v){const{openChat:b,showNotification:y,focusMessage:P,openMediaViewer:S,openAudioPlayer:C,markMessagesRead:M,cancelUploadMedia:E,sendPollVote:R,openForwardMenu:k,openChatLanguageModal:T,openThread:N,openStoryViewer:A}=(0,a.Sv)(),{id:B,forwardInfo:x,groupedId:U}=s,{replyToMsgId:L,replyToPeerId:O,replyToTopId:_,isQuote:F,quoteText:D}=(0,Z.H)(s)||{},j=(0,qt.Z)((()=>{m&&b({id:m.id})})),q=(0,qt.Z)((()=>{h?d&&x?.channelPostId?P({chatId:h.id,messageId:x.channelPostId}):b({id:h.id}):y({message:e("HidAccount")})})),G=(0,qt.Z)((()=>{p&&b({id:p.id})})),H=(0,qt.Z)((()=>{L&&!w?P({chatId:O||n,threadId:v?_:i,messageId:L,replyMessageId:O?void 0:B,noForumTopicPanel:!O,...F&&{quote:D?.text}}):y({message:e(F?"QuotePrivate":"ReplyPrivate")})})),V=(0,qt.Z)((()=>{S({chatId:n,threadId:i,mediaId:B,origin:l?c.bZ.ScheduledInline:c.bZ.Inline})})),$=(0,qt.Z)((()=>{C({chatId:n,messageId:B})})),z=(0,qt.Z)((e=>{S({chatId:n,threadId:i,mediaId:e,origin:l?c.bZ.ScheduledAlbum:c.bZ.Album})})),K=(0,qt.Z)((()=>{M({messageIds:[B]})})),J=(0,qt.Z)((()=>{E({chatId:n,messageId:B})})),W=(0,qt.Z)((e=>{R({chatId:n,messageId:B,options:e})})),Y=(0,qt.Z)((()=>{k({fromChatId:n,groupedId:U})})),X=(0,qt.Z)((()=>{if(u&&u.messages){const e=u.messages.map((({id:e})=>e));k({fromChatId:n,messageIds:e})}else k({fromChatId:n,messageIds:[B]})})),Q=(0,qt.Z)((()=>{P({chatId:n,threadId:r._f,messageId:B})})),ee=(0,qt.Z)((()=>{P(o?{chatId:x.fromChatId,groupedId:U,groupedChatId:n,messageId:x.fromMessageId}:O&&_?{chatId:O,threadId:_,messageId:x.fromMessageId}:{chatId:x.fromChatId,messageId:x.fromMessageId})})),te=(0,qt.Z)((e=>{e.stopPropagation(),t(e,U)}));return{handleAvatarClick:j,handleSenderClick:q,handleViaBotClick:G,handleReplyClick:H,handleMediaClick:V,handleAudioPlay:$,handleAlbumMediaClick:z,handleMetaClick:te,handleTranslationClick:(0,qt.Z)((e=>{e.stopPropagation(),T({chatId:n,messageId:f?void 0:B})})),handleOpenThread:(0,qt.Z)((()=>{N({chatId:s.chatId,threadId:s.id})})),handleReadMedia:K,handleCancelUpload:J,handleVoteSend:W,handleGroupForward:Y,handleForward:X,handleFocus:Q,handleFocusForwarded:ee,handleDocumentGroupSelectAll:te,handleTopicChipClick:(0,qt.Z)((()=>{g&&P({chatId:O||n,threadId:g.id,messageId:B})})),handleStoryClick:(0,qt.Z)((()=>{I&&A({peerId:I.peerId,storyId:I.id,isSingleStory:!0})}))}}(nt,ts,e,St,fe,$,Gt,Nt,d,ns,os,x,Be,Boolean(Fe),j&&"content"in j?j:void 0,q,ae);(0,Tt.d4)((()=>{E&&as&&M&&Qe()}),[Qe,E,M,as]);const Gs=(0,xt.Z)("Message message-list-item",w&&"first-in-group",K&&!rs?"is-protected":"allow-selection",b&&"last-in-group",y&&"first-in-document-group",P&&"last-in-document-group",E&&"last-in-list",kt&&"own",Boolean(e.viewsCount)&&"has-views",e.isEdited&&"was-edited",At&&"has-reply",mt&&"has-menu-open",W&&!Q&&"focused",te&&"is-forwarding",e.isDeleting&&"is-deleting",$&&"is-in-document-group",Vt&&"is-album",e.hasUnreadMention&&"has-unread-mention",pe&&"is-selected",he&&"is-in-selection-mode",U&&!u&&"is-thread-top",Boolean(e.inlineButtons)&&"has-inline-buttons",vs&&"is-swiped",Pt,f&&"is-just-added",(ue||rt)&&"has-active-reaction",Ht&&"is-story-mention"),{text:Hs,photo:Vs,video:$s,audio:zs,voice:Ks,document:Js,sticker:Xs,contact:Qs,poll:ea,webPage:ta,invoice:sa,location:aa,action:na,game:ia,storyData:oa,giveaway:ra,giveawayResults:ca}=(0,I.qp)(e),{replyToMsgId:da,replyToPeerId:la,isQuote:ua}=Bt||{},{peerId:ma,storyId:ha}=Ut||{},pa=function(e,t,s){const[a,n]=(0,Tt.eJ)();return(0,Tt.d4)((()=>{t||s&&!s()||(e?async function(e,t=.2){return Bn||await xn.promise,await Bn.request({name:"detectLanguage",args:[e,t]})}(e).then(n):n(void 0))}),[t,e,s]),a}(Hs?.text,!(Le||Oe),Ge);!function(e,t,s,a){(0,Tt.d4)((()=>{if(s||a&&!a())return;const n=Boolean(e.content.text?.text.length);!function(e,t,s,a){const n=Dn.get(e)||new Fn(150),i=n.get(t);i&&i.detectedLanguage===a&&i.isTranslatable===s||(n.set(t,{id:t,isTranslatable:s,detectedLanguage:a}),Dn.set(e,n),jn(e))}(e.chatId,e.id,n,t)}),[e,t,s,a])}(e,pa,!Oe,Ge);const fa=(0,I.cT)(e,!Fe),{isPending:wa,translatedText:va}=(0,Gn.Z)(Ue,St,fa?Zt:void 0,_e),ba=(0,La.Z)(va,Boolean(fa)),ya=va||ba,{phoneCall:Pa}=na||{},Za=(ke||me&&ie&&Rt)&&!Kt&&"thread"===ye&&!h,Sa=ke?.isCommentsInfo&&!Kt&&"thread"===ye&&!h,Ca=!ut&&!Pa&&!he&&ve&&!Kt&&!Ht&&!cs,Ma=function(e,{hasSubheader:t,isCustomShape:s,isLastInGroup:a,asForwarded:i,hasThread:o,forceSenderName:r,hasCommentCounter:c,hasActionButton:d,hasReactions:l,isGeoLiveActive:u,withVoiceTranscription:m,peerColorClass:h}={}){const{text:p,photo:g,video:f,audio:w,voice:v,document:b,poll:y,webPage:P,contact:Z,location:S,invoice:C,storyData:M,giveaway:E,giveawayResults:R}=(0,I.qp)(e),k=[n.gnl],T=M||g||f||S||C?.extendedMedia,N=p||"venue"===S?.type||u,A=T&&!N,B=Boolean(e.viaBotId);return h&&k.push(h),!T&&e.emojiOnlyCount?(k.push("emoji-only"),e.emojiOnlyCount<=n.L5X&&k.push(`emoji-only-${e.emojiOnlyCount}`)):N?k.push("text"):k.push("no-text"),d&&k.push("has-action-button"),s&&(k.push("custom-shape"),f?.isRound&&k.push("round"),c&&k.push("has-comment-counter")),T?k.push("media"):w?k.push("audio"):v?(k.push("voice"),m&&k.push("with-voice-transcription")):b?k.push("document"):Z?k.push("contact"):y?k.push("poll"):E||R?k.push("giveaway"):P&&(k.push("web-page"),(P.photo||P.video)&&k.push("media"),P.document&&k.push("document")),C&&!C.extendedMedia&&k.push("invoice"),M&&k.push("story"),i&&k.push("is-forwarded"),t&&k.push("has-subheader"),o&&k.push("has-replies"),l&&k.push("has-reactions"),B&&k.push("is-via-bot"),r&&k.push("force-sender-name"),s||(k.push("has-shadow"),T&&o&&k.push("has-background"),(t||i||B||!A||r)&&k.push("has-solid-background"),a&&(g||!A||S&&i)&&k.push("has-appendix")),k.join(" ")}(e,{hasSubheader:es,isCustomShape:_t,isLastInGroup:b,asForwarded:Gt,hasThread:Ot&&!h,forceSenderName:k,hasCommentCounter:Ot&&ke.messagesCount>0,hasActionButton:Yt||Xt,hasReactions:Dt,isGeoLiveActive:"geoLive"===aa?.type&&!(0,I.$R)(e),withVoiceTranscription:as,peerColorClass:(0,Pn.D)(is,Qt)}),Ea=Ma.includes("has-appendix"),Ra=(0,Zn.qo)(e.emojiOnlyCount);let ka,Ta;ka=Pa||Kt?"none":!rs||ta||Ra?"standalone":"in-text",Dt?_t||(Vs||$s||oa||"geo"===aa?.type)&&!rs?Ta="outside":Gt?(ka="standalone",Ta="inside"):Ta="inside":Ta="none";const Na=_t?"in-meta":"in-content";(0,kn.Z)(la||St,da,O,e.id,L||ua||q),(0,Tn.Z)(ma||St,ha,j),(0,qn.Z)(et,St,W,Y,Q,ee,f,Boolean(X));const Aa=ie&&e.postAuthorTitle||(Gt||se)&&Ct?.postAuthorTitle||void 0,Ba=E,xa=(0,qt.Z)((e=>{const t=at.current,s=e.contentRect.height;if(at.current=s,(0,Ja.Ni)()||!t||s<=t)return;const a=e.target.closest(".MessageList");if(!a)return;(0,jt.YW)(400);const n=s-t,{offsetHeight:i,scrollHeight:o,scrollTop:r}=a;Math.round(o-r-i)-n<=5&&Qe()})),Ua=(0,Un.Z)(xa,[xa],300,!1);(0,on.Z)(et,Ua,!Ba),(0,Tt.d4)((()=>{const e=tt.current;Te&&e&&(0,bn.P)(e)&&Xe({messageIds:[Zt]})}),[Te,Zt,Xe]);const Oa=(0,Tt.Ye)((()=>Vt?Rn(kt,Boolean(Gt),Boolean(l),d,lt):void 0),[Vt,kt,Gt,l,d,lt]),_a=Gt?28:0,Fa=(0,Tt.Ye)((()=>{let t,s,a,n=!1,i="";if(!Vt&&(Vs||$s||sa?.extendedMedia)){let a;if(Vs)a=(0,Sn.GH)(e,Gt,l,lt).width;else if($s)a=$s.isRound?C.Rj:(0,Sn.GH)(e,Gt,l,lt).width;else if(sa?.extendedMedia&&sa.extendedMedia.width&&sa.extendedMedia.height){const{width:e,height:t}=sa.extendedMedia;a=(0,C.Kf)({width:e,height:t,fromOwnMessage:kt,asForwarded:Gt,noAvatars:l,isMobile:lt}).width}a&&(a<Sn.Vx&&(s=a),t=Math.max((0,Sn.Pw)(Hs?.text,Za),a),sa?.extendedMedia&&t-a>18&&(n=!0))}else Oa&&(t=Math.max((0,Sn.Pw)(Hs?.text,Za),Oa.containerStyle.width),t-Oa.containerStyle.width>18&&(n=!0));if(t)i=`width: ${t+_a}px`,a=t+Uo;else if(Xs&&!es){const{width:e}=(0,C.Wr)(Xs,lt);i=`width: ${e+_a}px`,a=e+Uo}return{contentWidth:s,noMediaCorners:n,style:i,reactionsMaxWidth:a}}),[Oa,Gt,_a,es,sa?.extendedMedia,Vt,Za,lt,kt,e,l,Vs,Xs,Hs?.text,$s]),{contentWidth:Da,noMediaCorners:ja,style:qa,reactionsMaxWidth:Ga}=Fa;function Ha(t){return Tt.ZP.createElement(ii.Z,{messageOrStory:e,translatedText:_e?ya:void 0,isForAnimation:t,focusedQuote:X,emojiSize:Ra,highlight:ce,isProtected:K,observeIntersectionForLoading:s,observeIntersectionForPlaying:o,withTranslucentThumbs:_t})}const Va=(0,Tt.I4)((()=>{if(ve)return Tt.ZP.createElement("div",{className:(0,xt.Z)("quick-reaction",bs&&!ue&&"visible"),onClick:gs,ref:st},Tt.ZP.createElement(oi.Z,{reaction:ve,size:xo,availableReactions:we,observeIntersection:o}))}),[ue,we,ve,gs,bs,o]);function $a(){const t=Tt.ZP.createElement(co,{message:e,isPinned:Ze,withFullDate:se&&!kt,noReplies:p,repliesThreadInfo:ke,outgoingStatus:H,signature:Aa,withReactionOffset:"inside"===Ta,renderQuickReactionButton:Ca&&"in-meta"===Na?Va:void 0,availableReactions:we,isTranslated:Boolean(_e?ya:void 0),onClick:ks,onTranslationClick:Ts,onOpenThread:Ns});return"inside"!==Ta?t:Tt.ZP.createElement(Mo,{message:Ie,metaChildren:t,observeIntersection:o,noRecentReactors:ie,tags:$e,isCurrentUserPremium:v})}function za(){if(_t&&!Mt||!(m&&(!(Vs||$s||aa)||xe)||Gt||Mt||k)||zt||At&&_t)return;let t;!os||_t&&Mt?Ct?.hiddenUserName?t=Ct.hiddenUserName:oa&&A&&(t=(0,I.OU)(nt,A)):t=(0,I.OU)(nt,os);const a=os&&"emojiStatus"in os&&os.emojiStatus,i=os&&"isPremium"in os&&os.isPremium;return Tt.ZP.createElement("div",{className:"message-title",dir:"ltr"},t||Gt?Tt.ZP.createElement("span",{className:(0,xt.Z)("message-title-name",Ct?.hiddenUserName?"sender-hidden":"interactive",void 0),onClick:Zs,dir:"ltr"},Gt&&Tt.ZP.createElement(si.Z,{name:Ct?.hiddenUserName?"forward":"share-filled"}),oa&&Tt.ZP.createElement(si.Z,{name:"play-story"}),t?(0,ga.Z)(t):Gt?" ":void 0,!Gt&&a&&Tt.ZP.createElement(Ws.Z,{documentId:a.documentId,loopLimit:n.y3O,observeIntersectionForLoading:s,observeIntersectionForPlaying:o}),!Gt&&!a&&i&&Tt.ZP.createElement(Ys.Z,null),os?.fakeType&&Tt.ZP.createElement(ni.Z,{fakeType:os.fakeType})):x?void 0:" ",x&&Tt.ZP.createElement(Tt.ZP.Fragment,null,Tt.ZP.createElement("span",{className:"via"},nt("ViaBot")),Tt.ZP.createElement("span",{className:"interactive",onClick:Ss},(0,ga.Z)(`@${x.usernames[0].username}`))),Tt.ZP.createElement("div",{className:"title-spacer"}),Ct?.isLinkedChannelPost?Tt.ZP.createElement("span",{className:"admin-title",dir:"auto"},nt("DiscussChannel")):e.forwardInfo?.postAuthorTitle&&oe&&Gt?Tt.ZP.createElement("span",{className:"admin-title",dir:"auto"},e.forwardInfo?.postAuthorTitle):e.postAuthorTitle&&oe&&!Gt?Tt.ZP.createElement("span",{className:"admin-title",dir:"auto"},e.postAuthorTitle):!Ae||Gt||Mt?void 0:Tt.ZP.createElement("span",{className:"admin-title",dir:"auto"},Ae.customTitle||nt(Ae.isOwner?"GroupInfo.LabelOwner":"GroupInfo.LabelAdmin")),Boolean(Ve)&&Tt.ZP.createElement("span",{className:"sender-boosts","aria-hidden":!0},Tt.ZP.createElement(si.Z,{name:Ve>1?"boosts":"boost"}),Ve>1?Ve:void 0))}const Ka=oe&&Gt?e.postAuthorTitle:void 0;return Tt.ZP.createElement("div",{ref:et,id:(0,I.d0)(e.id),className:Gs,"data-message-id":Zt,onCopy:K?yn.Z:void 0,onMouseDown:ds,onClick:ls,onContextMenu:us,onDoubleClick:ms,onMouseEnter:Kt?ys:void 0,onMouseMove:Ca?ps:void 0,onMouseLeave:Ca||Kt?fs:void 0},Tt.ZP.createElement("div",{ref:tt,className:"bottom-marker","data-message-id":Zt,"data-last-message-id":d?d.messages[d.messages.length-1].id:void 0,"data-album-main-id":d?d.mainMessage.id:void 0,"data-has-unread-mention":e.hasUnreadMention||void 0,"data-has-unread-reaction":Te||void 0,"data-is-pinned":Ze||void 0,"data-should-update-views":void 0!==e.viewsCount}),!$&&Tt.ZP.createElement("div",{className:"message-select-control"},pe&&Tt.ZP.createElement("i",{className:"icon icon-select"})),P&&Tt.ZP.createElement("div",{className:(0,xt.Z)("message-select-control group-select",ge&&"is-selected"),onClick:Ds},ge&&Tt.ZP.createElement("i",{className:"icon icon-select"})),u&&function(){const e=!ns&&Ct?Ct.hiddenUserName:void 0;return Tt.ZP.createElement(Yn.Z,{size:lt?"small-mobile":"small",peer:ns,text:e,onClick:ns?Ps:void 0})}(),Tt.ZP.createElement("div",{className:(0,xt.Z)("message-content-wrapper",Ma.includes("text")&&"can-select-text")},Tt.ZP.createElement("div",{className:Ma,style:qa,dir:"auto"},Gt&&!zt&&Tt.ZP.createElement(Tt.ZP.Fragment,null,za(),Ka&&Tt.ZP.createElement("span",{className:"admin-title",dir:"auto"},Ka)),function(){const t=(0,xt.Z)("content-inner",Gt&&"forwarded-message",es&&"with-subheader",ja&&"no-media-corners"),a=b&&!rs&&!Gt&&!Sa,n=(0,xt.Z)("text-content","clearfix","in-text"===ka&&"with-meta",H&&"with-outgoing-icon"),i=!cs||!kt||se;return Tt.ZP.createElement("div",{className:t,onDoubleClick:hs,dir:"auto"},!Gt&&za(),es&&Tt.ZP.createElement("div",{className:"message-subheader"},xe&&Tt.ZP.createElement(ui,{topic:Be,onClick:js,className:"message-topic"}),At&&Tt.ZP.createElement(ei.Z,{message:O,replyInfo:Bt,noUserColors:Qt,isProtected:K,sender:_,senderChat:D,forwardSender:F,chatTranslations:Ue,requestedChatTranslationLanguage:Fe,observeIntersectionForLoading:s,observeIntersectionForPlaying:o,onClick:Cs}),Lt&&Tt.ZP.createElement(ai,{story:j,sender:G,noUserColors:Qt,isProtected:K,observeIntersectionForLoading:s,onClick:qs})),Xs&&Tt.ZP.createElement(ko,{message:e,observeIntersection:s,observeIntersectionForPlaying:o,shouldLoop:Ee,shouldPlayEffect:Xs.hasEffect&&(Ne.current&&Zt>=Ne.current||Rt)||void 0,withEffect:De,onPlayEffect:ct,onStopEffect:dt}),Ft&&le&&Tt.ZP.createElement(yi,{customEmojiId:le,withEffects:De&&(0,I.YC)(St),isOwn:kt,observeIntersection:s,forceLoadPreview:Rt,messageId:Zt,chatId:St,activeEmojiInteractions:be}),Ft&&de&&Tt.ZP.createElement(Zi,{emoji:de,withEffects:De&&(0,I.YC)(St),isOwn:kt,observeIntersection:s,forceLoadPreview:Rt,messageId:Zt,chatId:St,activeEmojiInteractions:be}),Vt&&Tt.ZP.createElement(Ii,{album:d,albumLayout:Oa,observeIntersection:s,isOwn:kt,isProtected:K,hasCustomAppendix:a,onMediaClick:Rs}),Pa&&Tt.ZP.createElement(lo,{message:e,phoneCall:Pa,chatId:St}),!Vt&&Vs&&Tt.ZP.createElement(hi.Z,{message:e,observeIntersection:s,noAvatars:l,canAutoLoad:Ce,uploadProgress:V,shouldAffectAppendix:a,isDownloading:Se,isProtected:K,asForwarded:Gt,theme:R,forcedWidth:Da,onClick:Ms,onCancelUpload:Bs}),!Vt&&$s&&$s.isRound&&Tt.ZP.createElement(Eo.Z,{message:e,observeIntersection:s,canAutoLoad:Ce,isDownloading:Se,onReadMedia:i?As:void 0}),!Vt&&$s&&!$s.isRound&&Tt.ZP.createElement(pi.Z,{message:e,observeIntersectionForLoading:s,observeIntersectionForPlaying:o,forcedWidth:Da,noAvatars:l,canAutoLoad:Ce,canAutoPlay:Me,uploadProgress:V,isDownloading:Se,isProtected:K,asForwarded:Gt,onClick:Ms,onCancelUpload:Bs}),(zs||Ks)&&Tt.ZP.createElement(Wn.ZP,{theme:R,message:e,origin:c.Cr.Inline,uploadProgress:V,isSelectable:$,isSelected:pe,noAvatars:l,onPlay:Es,onReadMedia:Ks&&i?As:void 0,onCancelUpload:Bs,isDownloading:Se,isTranscribing:S,isTranscriptionHidden:it,isTranscribed:Boolean(M),isTranscriptionError:Et,canDownload:!K,onHideTranscription:ot,canTranscribe:ze&&!cs}),Js&&Tt.ZP.createElement(Xn.Z,{message:e,observeIntersection:s,canAutoLoad:Ce,autoLoadFileMaxSizeMb:Re,uploadProgress:V,isSelectable:$,isSelected:pe,onMediaClick:Ms,onCancelUpload:Bs,isDownloading:Se,shouldWarnAboutSvg:He}),oa&&!Ht&&Tt.ZP.createElement(No,{message:e,isProtected:K}),Ht&&Tt.ZP.createElement(Ao,{message:e}),Qs&&Tt.ZP.createElement(Ai,{contact:Qs}),ea&&Tt.ZP.createElement(vo,{message:e,poll:ea,onSendVote:Us}),(ra||ca)&&Tt.ZP.createElement(Vi,{message:e}),ia&&Tt.ZP.createElement(xi,{message:e,canAutoLoadMedia:Ce}),sa?.extendedMedia&&Tt.ZP.createElement(Xi,{message:e,isConnected:qe}),as&&Tt.ZP.createElement("p",{className:(0,xt.Z)("transcription",!it&&Et&&"transcription-error"),dir:"auto"},Et?nt("NoWordsRecognized"):S&&M?Tt.ZP.createElement(Qn.Z,{content:M}):M),!Ft&&rs&&Tt.ZP.createElement("div",{className:n,dir:"auto"},Ha(),wa&&Tt.ZP.createElement("div",{className:"translation-animation"},Tt.ZP.createElement("div",{className:"text-loading"},Ha(!0))),"in-text"===ka&&$a()),ta&&Tt.ZP.createElement(Bo.Z,{message:e,observeIntersection:s,noAvatars:l,canAutoLoad:Ce,canAutoPlay:Me,asForwarded:Gt,isDownloading:Se,isProtected:K,theme:R,story:je,isConnected:qe,backgroundEmojiId:T?.color?.backgroundEmojiId,shouldWarnAboutSvg:He,autoLoadFileMaxSizeMb:Re,onAudioPlay:Es,onMediaClick:Ms,onCancelMediaTransfer:Bs}),sa&&!sa.extendedMedia&&Tt.ZP.createElement(Ji,{message:e,shouldAffectAppendix:a&&!Dt,isInSelectMode:he,isSelected:pe,theme:R,forcedWidth:Da}),aa&&Tt.ZP.createElement(io,{message:e,isInSelectMode:he,isSelected:pe,theme:R,peer:T}))}(),!Kt&&"standalone"===ka&&!Ht&&$a(),Wt&&Yt?Tt.ZP.createElement(ws.Z,{className:(0,xt.Z)("message-action-button",z&&"message-action-button-shown"),color:"translucent-white",round:!0,size:"tiny",ariaLabel:nt("lng_context_forward_msg"),onClick:P?Ls:Os},Tt.ZP.createElement("i",{className:"icon icon-share-filled"})):Wt&&Xt?Tt.ZP.createElement(ws.Z,{className:(0,xt.Z)("message-action-button",z&&"message-action-button-shown"),color:"translucent-white",round:!0,size:"tiny",ariaLabel:"Focus message",onClick:Pe?_s:Fs},Tt.ZP.createElement("i",{className:"icon icon-arrow-right"})):void 0,Sa&&Tt.ZP.createElement(Mi,{threadInfo:ke,disabled:h,isLoading:z,isCustomShape:_t}),Ea&&Tt.ZP.createElement(oo,{isOwn:kt}),Ca&&"in-content"===Na&&Va()),e.inlineButtons&&Tt.ZP.createElement($i,{message:e,onClick:We}),"outside"===Ta&&!Ht&&Tt.ZP.createElement(Mo,{message:Ie,isOutside:!0,isCurrentUserPremium:v,maxWidth:Ga,observeIntersection:o,noRecentReactors:ie,tags:$e})),ht&&Tt.ZP.createElement(Bi.Z,{isOpen:mt,anchor:ht,targetHref:pt?.matches("a[href]")?pt.href:void 0,message:e,album:d,messageListType:ye,onClose:It,onCloseAnimationEnd:wt,repliesThreadInfo:ke,noReplies:p,detectedLanguage:pa}))}))),Oo=e=>{const{isOpen:t}=e,s=(0,Yt.Z)(Ot.gl.Extra,"AboutAdsModal",!t);return s?Tt.ZP.createElement(s,e):void 0},_o=e=>{const{isOpen:t}=e,s=(0,Yt.Z)(Ot.gl.Extra,"SponsoredMessageContextMenuContainer",!t);return s?Tt.ZP.createElement(s,e):void 0},Fo=(0,Tt.X$)((0,a.c$)(((e,{chatId:t})=>{const s=(0,b.fSe)(e,t),a=s?.chatId?(0,b.Z1J)(e,s?.chatId):void 0,{chatId:n,isBot:i}=s||{};return{message:s,peer:a,bot:n&&i?(0,b.dyD)(e,n):void 0,channel:!i&&n?(0,b.Z1J)(e,n):void 0}}))((({chatId:e,peer:t,message:s,containerRef:n,bot:o,channel:r})=>{const{viewSponsoredMessage:c,openChat:d,openChatByInvite:l,requestAppWebView:u,startBot:m,focusMessage:h,openUrl:p,openPremiumModal:g,clickSponsoredMessage:f}=(0,a.Sv)(),w=(0,Is.Z)(),v=(0,Tt.sO)(null),b=(0,Tt.sO)(null),y=Boolean(s),{observe:P}=(0,gn.S1)({rootRef:n,debounceMs:200,threshold:1}),{isContextMenuOpen:Z,contextMenuPosition:S,handleBeforeContextMenu:C,handleContextMenu:M,handleContextMenuClose:E,handleContextMenuHide:R}=(0,Ia.Z)(v,i.$b,!0,i.wZ),[k,T,N]=(0,xs.Z)(!1),{isMobile:A}=(0,B.ZP)(),x=Boolean(s?.isAvatarShown&&t),U=Boolean(s?.botApp);(0,Tt.d4)((()=>y?P(b.current,(t=>{t.isIntersecting&&c({chatId:e})})):void 0),[e,y,P,c]);const L=(0,qt.Z)((()=>{t&&d({id:t.id})})),O=(0,qt.Z)((t=>(t.preventDefault(),f({chatId:e}),p({url:s.webPage.url,shouldSkipModal:!0}),!1))),_=(0,qt.Z)((()=>{g()})),F=(0,qt.Z)((()=>{if(s)if(f({chatId:e}),U){const{shortName:e}=s.botApp,t=(0,Ze.BS)();u({botId:s.chatId,appName:e,startApp:s.startParam,theme:t})}else s.chatInviteHash?l({hash:s.chatInviteHash}):s.channelPostId?h({chatId:s.chatId,messageId:s.channelPostId}):(d({id:s.chatId}),s.startParam&&m({botId:s.chatId,param:s.startParam}))}));if(!s)return;const D=(0,xt.Z)("message-content has-shadow has-solid-background has-appendix",(0,Pn.D)(o||t||r));return Tt.ZP.createElement("div",{ref:v,key:"sponsored-message",className:(0,xt.Z)("SponsoredMessage Message open",x&&"with-avatar")},x&&Tt.ZP.createElement(Yn.Z,{size:A?"small-mobile":"small",peer:t,onClick:t?L:void 0}),Tt.ZP.createElement("div",{className:D,dir:"auto",onMouseDown:e=>{(0,sn.q)(e),C(e)},onContextMenu:M},Tt.ZP.createElement("div",{className:"content-inner",dir:"auto"},function(){if(s?.botApp){if(!s.botApp.photo)return;return Tt.ZP.createElement(Yn.Z,{size:"large",peer:o,photo:s.botApp.photo,className:(0,xt.Z)("channel-avatar",w.isRtl&&"is-rtl")})}if(r)return Tt.ZP.createElement(Yn.Z,{size:"large",peer:r,className:(0,xt.Z)("channel-avatar",w.isRtl&&"is-rtl")})}(),Tt.ZP.createElement("span",{className:"message-title message-type"},s.isRecommended?w("Message.RecommendedLabel"):w("SponsoredMessage")),function(){if(s?.webPage)return Tt.ZP.createElement(Tt.ZP.Fragment,null,Tt.ZP.createElement("div",{className:"text-content with-meta",dir:"auto",ref:b},Tt.ZP.createElement("div",{className:"message-title message-peer",dir:"ltr"},(0,ga.Z)(s.webPage.siteName)),Tt.ZP.createElement("span",{className:"text-content-inner",dir:"auto"},(0,uo.H)({text:s.text.text,entities:s.text.entities}))),Tt.ZP.createElement(ws.Z,{className:"SponsoredMessage__button",size:"tiny",color:"translucent",isRectangular:!0,onClick:O},Tt.ZP.createElement("i",{className:"icon icon-arrow-right","aria-hidden":!0}),w("OpenLink")));const e=s?.buttonText??(U?w("BotWebAppInstantViewOpen"):s.isBot?w("Conversation.ViewBot"):w(s.channelPostId?"Conversation.ViewPost":"Conversation.ViewChannel")),t=U?s.botApp.title:o?(0,ga.Z)((0,I.Js)(o)||""):r?(0,ga.Z)(s.chatInviteTitle||(0,I.U)(w,r)||""):"";return Tt.ZP.createElement(Tt.ZP.Fragment,null,Tt.ZP.createElement("div",{className:"message-title message-peer",dir:"auto"},t),Tt.ZP.createElement("div",{className:"text-content with-meta",dir:"auto",ref:b},Tt.ZP.createElement("span",{className:"text-content-inner",dir:"auto"},(0,uo.H)({text:s.text.text,entities:s.text.entities}))),Tt.ZP.createElement(ws.Z,{className:"SponsoredMessage__button",size:"tiny",color:"translucent",isRectangular:!0,onClick:F},e))}()),Tt.ZP.createElement(oo,null),Tt.ZP.createElement(ws.Z,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:w("Close"),onClick:_},Tt.ZP.createElement("i",{className:"icon icon-close","aria-hidden":!0}))),S&&Tt.ZP.createElement(_o,{isOpen:Z,anchor:S,message:s,onAboutAds:T,onClose:E,onCloseAnimationEnd:R}),Tt.ZP.createElement(Oo,{isOpen:k,onClose:N}))}))),Do=(0,Tt.X$)((({isCurrentUserPremium:e,chatId:t,threadId:s,messageIds:o,messageGroups:d,getContainerHeight:l,isViewportNewest:u,isUnread:h,isComments:p,isEmptyThread:f,withUsers:w,isChannelChat:v,noAvatars:b,containerRef:y,anchorIdRef:P,memoUnreadDividerBeforeIdRef:Z,memoFirstUnreadIdRef:S,type:C,isReady:M,hasLinkedChat:E,isSchedule:R,shouldRenderBotInfo:k,noAppearanceAnimation:T,isSavedDialog:N,onFabToggle:A,onNotchToggle:x,onPinnedIntersectionChange:U})=>{const{openHistoryCalendar:L}=(0,a.Sv)(),O=(0,pn.Z)(M),_=!N&&!R,{observeIntersectionForReading:F,observeIntersectionForLoading:D,observeIntersectionForPlaying:j}=function(e,t,s,n,i){const{markMessageListRead:o,markMentionsRead:r,animateUnreadReaction:c,scheduleForViewsIncrement:d}=(0,a.Sv)(),{isMobile:l}=(0,B.ZP)(),u=l?300:500,{observe:m,freeze:h,unfreeze:p}=(0,gn.S1)({rootRef:t,throttleMs:150},(t=>{if("thread"!==e||(0,Kt.q)())return;let a=0;const l=[],u=[],m=[],h=[],p=[];let g=!1;t.forEach((e=>{const{isIntersecting:t,target:s,boundingClientRect:n,rootBounds:i}=e,{dataset:o}=s,r=Number(o.lastMessageId||o.messageId),c="true"===o.shouldUpdateViews,d=o.albumMainId?Number(o.albumMainId):void 0;t?(r>a&&(a=r),o.hasUnreadMention&&l.push(r),o.hasUnreadReaction&&u.push(r),o.isPinned&&m.push(d||r),c&&p.push(d||r)):o.isPinned&&(i&&n.bottom<i.top&&(g=!0),h.push(d||r))})),s.current&&a>=s.current&&o({maxId:a}),l.length&&r({messageIds:l}),u.length&&c({messageIds:u}),(m.length||h.length)&&n({viewportPinnedIdsToAdd:m,viewportPinnedIdsToRemove:h,isReversed:g}),p.length&&d({chatId:i,ids:p})}));(0,Kt.Z)(h,p);const{observe:g}=(0,gn.S1)({rootRef:t,throttleMs:fn,margin:u}),{observe:f}=(0,gn.S1)({rootRef:t,throttleMs:fn});return{observeIntersectionForReading:m,observeIntersectionForLoading:g,observeIntersectionForPlaying:f}}(C,y,S,U,t),{withHistoryTriggers:q,backwardsTriggerRef:G,forwardsTriggerRef:H,fabTriggerRef:V}=function(e,t,s,n,o,r,d,l,u){const{loadViewportMessages:m}=(0,a.Sv)(),[h,p]=(0,Tt.Ye)((()=>"thread"===e?[(0,g.Ds)((()=>m({direction:c.Uq.Backwards})),1e3,!0,!1),(0,g.Ds)((()=>m({direction:c.Uq.Forwards})),1e3,!0,!1)]:[]),[m,s]),f=(0,Tt.sO)(null),I=(0,Tt.sO)(null),w=(0,Tt.sO)(null),v=(0,qt.Z)((()=>{if(!u)return;if(!s?.length)return d(!1),void l(!1);if(!o)return d(!0),void l(!0);const e=t.current;if(!e)return;const{offsetHeight:a,scrollHeight:n,scrollTop:i}=e,c=Math.round(n-i-a),m=c<=1;0!==n&&(d(r?!m:!(c<=50)),l(!m))})),{observe:b}=(0,gn.S1)({rootRef:t,margin:i.gZ},(e=>{p&&h&&e.forEach((({isIntersecting:e,target:t})=>{e&&("backwards-trigger"===t.className&&h(),"forwards-trigger"===t.className&&p())}))})),y=s&&s.length>1;(0,gn._N)(f,y?b:void 0),(0,gn._N)(I,y?b:void 0);const{observe:P,freeze:Z,unfreeze:S}=(0,gn.S1)({rootRef:t,margin:100,throttleScheduler:Bt.i$},v);(0,gn._N)(w,P);const{observe:C,freeze:M,unfreeze:E}=(0,gn.S1)({rootRef:t,margin:1,throttleScheduler:Bt.i$},v);(0,gn._N)(w,C),(0,Tt.d4)((()=>{u&&v()}),[u,v]);const R=(0,qt.Z)((()=>{Z(),M(),setTimeout((()=>{E(),S()}),350)}));(0,zt.Z)(R,[R,s]);const k=(0,In.Vr)(n,200);return(0,wn.b)(R,[R,k]),{withHistoryTriggers:y,backwardsTriggerRef:f,forwardsTriggerRef:I,fabTriggerRef:w}}(C,y,o,l,u,h,A,x,M),$=(0,Is.Z)(),z=Tt.ZP.createElement("div",{className:(0,xt.Z)("unread-divider","local-action-message"),key:"unread-messages"},Tt.ZP.createElement("span",null,$("UnreadMessages"))),K=T?0:d.reduce(((e,t)=>e+t.senderGroups.flat().length),0);let J=0;const W=(0,La.Z)(o),Y=Boolean(o&&W&&o[o.length-2]===W[W.length-1]),X=d.map(((e,t,a)=>{const i=e.senderGroups.map(((e,n,i)=>{if(1===e.length&&!en(e[0])&&(0,I.FT)(e[0])&&!e[0].content.action?.phoneCall){const o=e[0],c=n===i.length-1&&t===a.length-1;return(0,m.oA)([o.id===Z.current&&z,Tt.ZP.createElement(vn.Z,{key:o.id,message:o,threadId:s,messageListType:C,isInsideTopic:Boolean(s&&s!==r._f&&!N),observeIntersectionForReading:F,observeIntersectionForLoading:D,observeIntersectionForPlaying:j,memoFirstUnreadIdRef:S,appearanceOrder:K-++J,isJustAdded:c&&Y,isLastInList:c,onPinnedIntersectionChange:U})])}let o;return e.map(((c,d)=>{const l=en(c)?c.mainMessage:c,u=en(c)?c:void 0,h=(0,I.B4)(l),g=en(c),y=e[d+1];l.previousLocalId&&P.current===(0,I.d0)(l.previousLocalId)&&(P.current=(0,I.d0)(l.id));const M=!g&&l.groupedId?l.groupedId:void 0,R=y&&!en(y)?y.groupedId:void 0,k=l.id===s,T={isFirstInGroup:0===d,isLastInGroup:d===e.length-1,isFirstInDocumentGroup:Boolean(M&&M!==o),isLastInDocumentGroup:Boolean(M&&M!==R),isLastInList:d===e.length-1&&n===i.length-1&&t===a.length-1};o=M;const N=(0,I.KK)(l),A=(0,I.jM)(l)?`${l.date}_${N}`:N,B=!1===E||!v;return(0,m.oA)([l.id===Z.current&&z,Tt.ZP.createElement(Lo,{key:A,message:l,observeIntersectionForBottom:F,observeIntersectionForLoading:D,observeIntersectionForPlaying:j,album:u,noAvatars:b,withAvatar:T.isLastInGroup&&w&&!h&&(!k||!p),withSenderName:T.isFirstInGroup&&w&&!h,threadId:s,messageListType:C,noComments:B,noReplies:!B||s!==r._f||"scheduled"===C,appearanceOrder:K-++J,isJustAdded:T.isLastInList&&Y,isFirstInGroup:T.isFirstInGroup,isLastInGroup:T.isLastInGroup,isFirstInDocumentGroup:T.isFirstInDocumentGroup,isLastInDocumentGroup:T.isLastInDocumentGroup,isLastInList:T.isLastInList,memoFirstUnreadIdRef:S,onPinnedIntersectionChange:U,getIsMessageListReady:O}),l.id===s&&Tt.ZP.createElement("div",{className:"local-action-message",key:"discussion-started"},Tt.ZP.createElement("span",null,$(f?p?"NoComments":"NoReplies":"DiscussionStarted")))])})).flat()}));return Tt.ZP.createElement("div",{className:"message-date-group",key:e.datetime,onMouseDown:sn.q,teactFastList:!0},Tt.ZP.createElement("div",{className:(0,xt.Z)("sticky-date",_&&"interactive"),key:"date-header",onMouseDown:sn.q,onClick:_?()=>L({selectedAt:e.datetime}):void 0},Tt.ZP.createElement("span",{dir:"auto"},R&&e.originalDate===n.t4X&&$("MessageScheduledUntilOnline"),R&&e.originalDate!==n.t4X&&$("MessageScheduledOn",(0,re.j1)($,e.datetime,void 0,!0)),!R&&(0,re.j1)($,e.datetime))),i.flat())}));return Tt.ZP.createElement("div",{className:"messages-container",teactFastList:!0},q&&Tt.ZP.createElement("div",{ref:G,key:"backwards-trigger",className:"backwards-trigger"}),k&&Tt.ZP.createElement(hn,{isInMessageList:!0,key:`bot_info_${t}`,chatId:t}),X.flat(),!e&&u&&Tt.ZP.createElement(Fo,{key:t,chatId:t,containerRef:y}),q&&Tt.ZP.createElement("div",{ref:H,key:"forwards-trigger",className:"forwards-trigger"}),Tt.ZP.createElement("div",{ref:V,key:"fab-trigger",className:"fab-trigger"}))})),jo=3*C.Gw,qo=(0,Tt.X$)((({isChatWithSelf:e,type:t,isGroupChatJustCreated:s,topic:a})=>{const n=(0,Is.Z)();return"scheduled"===t?function(e){return Tt.ZP.createElement("div",{className:"empty"},Tt.ZP.createElement("span",null,e("ScheduledMessages.EmptyPlaceholder")))}(n):e?function(e){return Tt.ZP.createElement("div",{className:"NoMessages"},Tt.ZP.createElement("div",{className:"wrapper"},Tt.ZP.createElement("i",{className:"icon no-messages-icon icon-cloud-download"}),Tt.ZP.createElement("h3",{className:"title"},e("Conversation.CloudStorageInfo.Title")),Tt.ZP.createElement("ul",{className:"description"},Tt.ZP.createElement("li",null,e("Conversation.ClousStorageInfo.Description1")),Tt.ZP.createElement("li",null,e("Conversation.ClousStorageInfo.Description2")),Tt.ZP.createElement("li",null,e("Conversation.ClousStorageInfo.Description3")),Tt.ZP.createElement("li",null,e("Conversation.ClousStorageInfo.Description4")))))}(n):s?function(e){return Tt.ZP.createElement("div",{className:"NoMessages"},Tt.ZP.createElement("div",{className:"wrapper",dir:e.isRtl?"rtl":void 0},Tt.ZP.createElement("h3",{className:"title"},e("EmptyGroupInfo.Title")),Tt.ZP.createElement("p",{className:"description"},e("EmptyGroupInfo.Subtitle")),Tt.ZP.createElement("ul",{className:"list-checkmarks"},Tt.ZP.createElement("li",null,e("EmptyGroupInfo.Line1")),Tt.ZP.createElement("li",null,e("EmptyGroupInfo.Line2")),Tt.ZP.createElement("li",null,e("EmptyGroupInfo.Line3")),Tt.ZP.createElement("li",null,e("EmptyGroupInfo.Line4")))))}(n):a?function(e,t){return Tt.ZP.createElement("div",{className:"NoMessages"},Tt.ZP.createElement("div",{className:"wrapper"},Tt.ZP.createElement(ci.Z,{topic:t,size:jo,className:"no-messages-icon topic-icon"}),Tt.ZP.createElement("h3",{className:"title"},e("Chat.EmptyTopicPlaceholder.Title")),Tt.ZP.createElement("p",{className:"description topic-description"},(0,ga.Z)(e("Chat.EmptyTopicPlaceholder.Text"),["br"]))))}(n,a):Tt.ZP.createElement("div",{className:"empty"},Tt.ZP.createElement("span",null,n("NoMessages")))})),Go=(0,Tt.X$)((0,a.c$)(((e,{userId:t})=>{const s=(0,b.Puy)(e),{patternColor:a}=e.settings.themes[s]||{},n=(0,b.dyD)(e,t);return{patternColor:a,userName:(0,I.Vl)(n)}}))((function({patternColor:e,userName:t}){const s=(0,Is.Z)(),{openPremiumModal:n}=(0,a.Sv)(),i=(0,qt.Z)((()=>n()));return Tt.ZP.createElement("div",{className:"tFp81o13"},Tt.ZP.createElement("div",{className:"xzZFmIqC"},Tt.ZP.createElement("div",{className:"vyeCoKP3"},Tt.ZP.createElement(Oi.Z,{tgsUrl:Li.l.Unlock,size:54,color:e,className:"YVmR5pRi"}),Tt.ZP.createElement(si.Z,{name:"comments-sticker",className:"ouB5dgHN"})),Tt.ZP.createElement("span",{className:"oEQISdJD"},(0,ga.Z)(s("MessageLockedPremium",t),["simple_markdown"])),Tt.ZP.createElement(ws.Z,{color:"translucent-black",size:"tiny",onClick:i,className:"KJVF1etk"},s("MessagePremiumUnlock"))))}))),Ho=(0,g.Ds)((e=>e()),200,!1),Vo=(0,Tt.X$)((0,a.c$)(((e,{chatId:t,threadId:s,type:a})=>{const i=e.currentUserId,o=(0,b.Z1J)(e,t);if(!o)return{currentUserId:i};const c=(0,b.$Wy)(e,t,s,a),d="scheduled"===a?(0,b.yBV)(e,t):(0,b.Zwk)(e,t),l=(0,I._o)(t,s,i);if(!(s===r._f||l||o?.isForum||d&&s&&d[Number(s)]))return{currentUserId:i};const{isRestricted:u,restrictionReason:m}=o,h=(0,b._If)(e,t,l?"saved":"all"),p=(0,b.G$N)(e,t),g=s===r._f&&!c&&!o.unreadCount&&!p&&h&&!h.groupedId,f=(0,b.kBx)(e,t),w=o.topics?.[s],v=(0,I.YC)(t)?void 0:(0,b.x67)(e,t),y=!(0,b.tZg)(e,t,s)?.messagesCount;return{isCurrentUserPremium:(0,b.wVz)(e),isChatLoaded:!0,isRestricted:u,restrictionReason:m,isChannelChat:(0,I.eA)(o),isGroupChat:(0,I.Bf)(o),isCreator:o.isCreator,isChatWithSelf:(0,b.FM1)(e,t),isRepliesChat:(0,I.pK)(t),isAnonymousForwards:(0,I.wo)(t),isBot:Boolean(f),isSynced:e.isSynced,messageIds:c,messagesById:d,firstUnreadId:(0,b.It8)(e,t,s),isViewportNewest:"thread"!==a||(0,b.b9T)(e,t,s),focusingId:p,isSelectModeActive:(0,b.CAb)(e),hasLinkedChat:v?Boolean(v.linkedChatId):void 0,topic:w,noMessageSendingAnimation:!(0,b.$Yd)(e,"messageSendingAnimations"),isServiceNotificationsChat:t===n.awM,isForum:o.isForum,isEmptyThread:y,currentUserId:i,...g&&{lastMessage:h}}}))((({chatId:e,threadId:t,type:s,hasTools:i,onFabToggle:o,onNotchToggle:d,isCurrentUserPremium:l,isChatLoaded:u,isForum:h,isChannelChat:p,isGroupChat:f,canPost:w,isSynced:v,isReady:y,isChatWithSelf:P,isRepliesChat:Z,isAnonymousForwards:S,isCreator:C,isBot:M,messageIds:E,messagesById:R,firstUnreadId:k,isComments:T,isViewportNewest:N,isRestricted:A,restrictionReason:B,isEmptyThread:x,focusingId:U,isSelectModeActive:L,lastMessage:O,hasLinkedChat:_,withBottomShift:F,withDefaultBg:D,topic:j,noMessageSendingAnimation:q,isServiceNotificationsChat:G,currentUserId:H,getForceNextPinnedInHeader:V,onPinnedIntersectionChange:$,isContactRequirePremium:z})=>{const{loadViewportMessages:K,setScrollOffset:J,loadSponsoredMessages:W,loadMessageReactions:Y,copyMessagesByIds:X,loadMessageViews:Q,loadPeerStoriesByIds:ee}=(0,a.Sv)(),te=(0,Tt.sO)(null),se=(0,Tt.sO)("thread"===s&&(0,b.Vtl)((0,a.Rd)(),e,t)||(0,b.T6o)((0,a.Rd)(),e,t)||0),ae=(0,Tt.sO)(),ne=(0,Tt.sO)(),ie=(0,Tt.sO)(),oe=(0,Tt.sO)(),re=(0,Tt.sO)(),ce=(0,Tt.sO)(),de=(0,Tt.sO)(!1),le=(0,Tt.sO)(Boolean(O)),ue=(0,I._o)(e,t,H),me=ue&&t!==n.tKb,he=Boolean(E);(0,zt.Z)((()=>{he&&(0,g.R3)((()=>{le.current=!1}))}),[he]),(0,zt.Z)((()=>{oe.current=k}),[k]),(0,Tt.d4)((()=>{!l&&p&&v&&y&&W({chatId:e})}),[l,e,v,y,p]),(0,zt.Z)((()=>{he&&(re.current=oe.current)}),[he]),(0,zt.Z)((()=>{ce.current=U}),[U]),(e=>{(0,us.y)({"Mod+C":function(t){const s=(0,nn.Z)();s&&s.length>1&&(t.preventDefault(),e({messageIds:s}))}})})(X);const pe=(0,Tt.Ye)((()=>{if(!E?.length||!R)return;const e=E.map((e=>R[e])).filter(Boolean),a="scheduled"===s||G?["date","id"]:["id"];return e.length?tn((0,m.Xo)(e,a),re.current,h?void 0:Number(t),P):void 0}),[E,R,s,G,h,t,P]);(0,_t.Z)((()=>{if(!E||!R||"scheduled"===s)return;if(!p&&!f)return;const t=E.filter((e=>{const t=R[e];return t&&t.reactions?.results.length&&!t.content.action}));t.length&&Y({chatId:e,ids:t})}),2e4,!0),(0,_t.Z)((()=>{if(!E||!R||"scheduled"===s)return;const e=E.map((e=>R[e]?.content.storyData)).filter(Boolean);if(!e.length)return;const t=e.reduce(((e,t)=>{const{peerId:s,id:a}=t;return e[s]||(e[s]=[]),e[s].push(a),e}),{});Object.entries(t).forEach((([e,t])=>{ee({peerId:e,storyIds:t})}))}),3e5),(0,_t.Z)((()=>{if(!E||!R||t!==r._f||"scheduled"===s)return;const n=(0,a.Rd)(),i=E.filter((t=>(0,b.tZg)(n,e,t)?.isCommentsInfo||void 0!==R[t]?.viewsCount));i.length&&Q({chatId:e,ids:i})}),2e4,!0);const ge=(0,Tt.Ye)((()=>{if("thread"===s)return(0,g.Ds)((()=>K({direction:c.Uq.Around})),1e3,!0,!1)}),[K,E]),{isScrolled:fe,updateStickyDates:Ie}=function(){const[e,t]=(0,xs.Z)(!1),s=(0,rn.Z)(1e3,!0);return{isScrolled:e,updateStickyDates:(0,qt.Z)(((e,a)=>{t(),document.body.classList.contains("is-scrolling-messages")||(0,Bt.WM)((()=>{document.body.classList.add("is-scrolling-messages")})),s((()=>{const t=function(e,t){const s=e.querySelectorAll(".sticky-date"),a=e.scrollTop;return Array.from(s).find((e=>{const{offsetTop:s,offsetHeight:n}=e,i=s-a;return-n<=i&&i<=(t?60:10)}))}(e,a);t&&(0,Bt.WM)((()=>{t.classList.add("stuck")})),(0,Bt.WM)((()=>{const e=document.querySelector(".stuck");e&&e.classList.remove("stuck"),document.body.classList.remove("is-scrolling-messages")}))}))}))}}(),we=(0,qt.Z)((()=>{if(de.current)return void(de.current=!1);const n=te.current;n&&(ce.current||Ie(n,i),Ho((()=>{const i=(0,a.Rd)();V()&&!(0,b.jUK)(i).focusedMessage?.chatId&&$({hasScrolled:!0}),n.parentElement&&(se.current=n.scrollHeight-n.scrollTop,"thread"===s&&J({chatId:e,threadId:t,scrollOffset:se.current}))})))})),[ve,be]=function(e,t){const[s,a]=(0,Da.Z)(),n=(0,qt.Z)((e=>{a(e.contentRect.height)}));(0,on.Z)(e,n),(0,Tt.d4)((()=>{const a=Number(e.current.dataset.normalHeight)||0,n=s();n&&n>a&&t&&(e.current.dataset.normalHeight=String(n))}),[t,e,s]);const i=(0,Tt.sO)();return[s,i]}(te,w&&!L);(0,Tt.d4)((()=>{if(!ge||!u||A||U)return;if(E&&(0,I.AJ)(E[E.length-1]))return;const e=te.current;(!E||E.length<n.hT6/2&&e.firstElementChild.clientHeight<=e.offsetHeight)&&ge()}),[u,E,ge,U,A]);const ye=(0,ms.Y)((()=>{if(!E||!ie.current)return;const e=ie.current.filter((e=>E.includes(Number(e.dataset.messageId)))),t=e[1]||e[0];t&&(ae.current=t.id,ne.current=t.getBoundingClientRect().top)}));(0,zt.Z)((()=>(0,Bt.yn)((()=>ye.current()))),[E,N,i,ye]),(0,Tt.d4)((()=>ye.current()),[ve,ye]),(0,an.Z)((([e,t])=>{const s=ve(),a=be.current;if(be.current=s,E===e&&N===t&&s!==a&&void 0===a)return;const o=te.current;ie.current=Array.from(o.querySelectorAll(".message-list-item"));const r=ie.current[ie.current.length-1],c=oe.current?o.querySelector(`#${(0,I.d0)(oe.current)}`):void 0,d=E&&e&&E[E.length-1]!==e[e.length-1],l=E?.[0]!==e?.[0]&&E?.length===n.hT6/2+1,u=d&&!l;N&&u&&E&&E.length<n.hT6/2&&!o.parentElement.classList.contains("force-messages-scroll")&&(0,Bt.yn)((()=>o.firstElementChild.clientHeight<=2*o.offsetHeight))&&((0,Nt.D_)(o.parentElement,"force-messages-scroll"),o.parentElement.classList.add("force-messages-scroll"),setTimeout((()=>{o.parentElement&&(0,Nt.mC)(o.parentElement,"force-messages-scroll")}),500)),(0,Bt.lT)((()=>{const{scrollTop:e,scrollHeight:n,offsetHeight:d}=o,l=se.current;let m=l-(a||d);u&&(m-=r?r.offsetHeight:0);const h=N&&t&&m<=50,p=E&&ce.current===E[E.length-1];u&&h&&!p&&(0,Bt.i$)((()=>{const e=!(0,Kt.q)()||!c;(0,Ja.ZP)(o,e?r:c,e?"end":"start",20,void 0,void 0,q?0:void 0)}));const g=void 0!==a&&a!==s;if(g&&(0,Ja.Ni)())return;const f=ae.current&&o.querySelector(`#${ae.current}`),I=!f&&re.current&&o.querySelector(".unread-divider");let w;if(h&&g)w=n-d;else if(f){const t=f.getBoundingClientRect().top;w=e+(t-(ne.current||0))}else w=I?Math.min(I.offsetTop-(i?60:10),n-l):n-l;return()=>{(0,Qa.Z)(o,Math.ceil(w)),(0,Ja.wA)(),se.current=Math.max(Math.ceil(n-w),d),ce.current||(de.current=!0,(0,Bt.i$)((()=>{de.current=!1})))}}))}),[E,N,i,ve,be,q]),(0,Js.Z)((([e])=>{void 0!==e&&(0,jt.YW)(200+n.fK3)}),[L]);const Pe=Boolean(e&&(0,I.YC)(e)),Ze=Boolean(!Pe&&!p||P||Z||S),Se=Boolean(!Ze||p),Ce=(0,I.YC)(e)&&!P&&!M&&!S&&(!pe&&!O&&E&&(!ie.current||0===ie.current.length)||1===E?.length&&"contactSignUp"===R?.[E[0]]?.content.action?.type||"contactSignUp"===O?.content?.action?.type),Me=f&&C&&1===E?.length&&"chatCreate"===R?.[E[0]]?.content.action?.type,Ee=1===E?.length&&"topicCreate"===R?.[E[0]]?.content.action?.type,Re=(0,xt.Z)("MessageList custom-scroll",Se&&"no-avatars",!w&&"no-composer","pinned"===s&&"type-pinned",F&&"with-bottom-shift",D&&"with-default-bg",L&&"select-mode-active",fe&&"scrolled",!y&&"is-animating",me&&"saved-dialog"),ke=E&&pe||O;return Tt.ZP.createElement("div",{ref:te,className:Re,onScroll:we,onMouseDown:sn.q},A?Tt.ZP.createElement("div",{className:"empty"},Tt.ZP.createElement("span",null,B?B.text:"This is a private "+(p?"channel":"chat"))):z?Tt.ZP.createElement(Go,{userId:e}):M&&!ke?Tt.ZP.createElement(hn,{chatId:e}):Ce?Tt.ZP.createElement(dn,{key:e,userId:e}):E&&(!pe||Me||Ee)?Tt.ZP.createElement(qo,{chatId:e,topic:j,type:s,isChatWithSelf:P,isGroupChatJustCreated:Me}):ke?Tt.ZP.createElement(Do,{isCurrentUserPremium:l,chatId:e,isComments:T,isChannelChat:p,isSavedDialog:ue,messageIds:E||[O.id],messageGroups:pe||tn([O]),getContainerHeight:ve,isViewportNewest:Boolean(N),isUnread:Boolean(k),isEmptyThread:x,withUsers:Ze,noAvatars:Se,containerRef:te,anchorIdRef:ae,memoUnreadDividerBeforeIdRef:re,memoFirstUnreadIdRef:oe,threadId:t,type:s,isReady:y,hasLinkedChat:_,isSchedule:!!pe&&"scheduled"===s,shouldRenderBotInfo:M,noAppearanceAnimation:!pe||!le.current,onFabToggle:o,onNotchToggle:d,onPinnedIntersectionChange:$}):Tt.ZP.createElement(ps.Z,{color:"white",backgroundColor:"dark"}))}))),$o=e=>{const{isActive:t}=e,s=(0,Yt.Z)(Ot.gl.Extra,"MessageSelectToolbar",!t);return s?Tt.ZP.createElement(s,e):void 0};var zo=s(18360),Ko=s(86203),Jo=s(4794),Wo=s(98799),Yo=s(6058),Xo=s(14605);const Qo=(0,Tt.X$)((0,a.c$)(((e,{chatId:t})=>({currentUserId:e.currentUserId,chat:(0,b.Z1J)(e,t),user:(0,b.dyD)(e,t)})))((({chatId:e,className:t,chat:s,user:n,settings:i,currentUserId:o})=>{const{openAddContactDialog:r,blockUser:c,reportSpam:d,deleteChat:l,leaveChannel:u,deleteChatUser:m,deleteHistory:h,toggleChatArchived:p,hideChatReportPanel:g}=(0,a.Sv)(),f=(0,Is.Z)(),[w,v,b]=(0,xs.Z)(),[y,P]=(0,Tt.eJ)(!0),[Z,S]=(0,Tt.eJ)(!0),{isAutoArchived:C,canReportSpam:M,canAddContact:E,canBlockContact:R}=i||{},k=s&&(0,I.G9)(s),T=(0,qt.Z)((()=>{r({userId:e}),C&&p({id:e})})),N=(0,qt.Z)((()=>{b(),c({userId:e}),M&&y&&d({chatId:e}),Z&&l({chatId:e})})),A=(0,qt.Z)((()=>{g({chatId:e})})),B=(0,qt.Z)((()=>{b(),d({chatId:e}),k?(m({chatId:e,userId:o}),h({chatId:e,shouldDeleteForAll:!1})):u({chatId:e})}));if(i&&(s||n))return Tt.ZP.createElement("div",{className:(0,xt.Z)("ChatReportPanel",t),dir:f.isRtl?"rtl":void 0},E&&Tt.ZP.createElement(ws.Z,{isText:!0,fluid:!0,size:"tiny",className:"UserReportPanel--Button",onClick:T},f("lng_new_contact_add")),R&&Tt.ZP.createElement(ws.Z,{color:"danger",isText:!0,fluid:!0,size:"tiny",className:"UserReportPanel--Button",onClick:v},f("lng_new_contact_block")),M&&!R&&Tt.ZP.createElement(ws.Z,{color:"danger",isText:!0,fluid:!0,size:"tiny",className:"UserReportPanel--Button",onClick:v},f("lng_report_spam_and_leave")),Tt.ZP.createElement(ws.Z,{round:!0,ripple:!0,size:"tiny",color:"translucent",onClick:A,ariaLabel:f("Close")},Tt.ZP.createElement("i",{className:"icon icon-close"})),Tt.ZP.createElement(_i.Z,{isOpen:w,onClose:b,title:f("BlockUserTitle",n?(0,I.Vl)(n):(0,I.U)(f,s)),text:n?f("UserInfo.BlockConfirmationTitle",(0,I.Js)(n)):f("Chat.Confirm.ReportSpam.Channel"),confirmIsDestructive:!0,confirmLabel:f("Block"),confirmHandler:n?N:B},n&&Tt.ZP.createElement(Xo.Z,{label:f("DeleteThisChat"),checked:Z,onCheck:S}),n&&M&&Tt.ZP.createElement(Xo.Z,{label:f("ReportChat"),checked:y,onCheck:P})))})));var er=s(59188),tr=s(2903),sr=s(45370);const ar={"pinned-message-border":"L5TQCriM",pinnedMessageBorder:"L5TQCriM","pinned-message-border-wrapper-1":"v5sJGzfS",pinnedMessageBorderWrapper1:"v5sJGzfS","pinned-message-border-wrapper":"p6PQhvds",pinnedMessageBorderWrapper:"p6PQhvds","pinned-message-border-mark":"M2PQZgBd",pinnedMessageBorderMark:"M2PQZgBd"};function nr(e,t,s,a,n){return`M${e},${t+n}a${n},${n},0,0,1,\n ${s},0v${a-2*n}a${n},${n},0,0,1,${-s},0Z`}const ir=(0,Tt.X$)((({count:e,index:t})=>{const s=(0,Tt.sO)(null),a=(0,Tt.Ye)((()=>function(e,t){const s=e-t-1,a=function(e){let t=8;return 1===e?t=36:2===e?t=17:3===e?t=11:(4===e||e>3)&&(t=7.5),t}(e),n=function(e,t){let s=36;return 1===e?s=36:2===e?s=17:3===e?s=1===t?12:11:(4===e||e>3)&&(s=7.5),s}(e,s),i=function(e,t){return e<=3?36:t*e+2*(e-1)}(e,a),o=`clipPath${e}`,r=function(e,t,s){let a="";if(3===s)a=nr(0,0,2,t,1)+nr(0,12,2,t+1,1)+nr(0,25,2,t,1);else for(let e=0;e<s;e++)a+=nr(0,(t+2)*e,2,t,1);return`<clipPath id="${e}">\n <path d="${a}" />\n </clipPath>`}(o,a,e),c=function(e,t,s){return 1===s?0:2===s?0===e?0:t+2:3===s?0===e?0:1===e?12:25:(t+2)*e}(s,a,e),d=function(e,t,s,a){return t<=4||e<=1?0:e>=t-2?a-36:(s+4)/2+(e-2)*(s+2)}(s,e,a,i);return{markHeight:n,clipPath:r,markTranslateY:c,trackTranslateY:d,trackHeight:i,clipPathId:o}}(e,t)),[e,t]);if((0,Tt.bt)((()=>{if(!s.current)return;const{trackHeight:e,trackTranslateY:t,markHeight:n,markTranslateY:i,clipPathId:o,clipPath:r}=a,c=s.current.firstElementChild;if(s?.current){const a=s.current,{style:d}=a;d.height=`${e}px`,d.transform=`translateY(-${t}px)`,d.clipPath=`url("#${o}")`;const l=a.querySelector("svg"),u=a.querySelector("div"),m=a.querySelector("defs");l||c&&(c.innerHTML=`<svg height="0" width="0"><defs> ${r} </defs></svg>`),m&&(m.innerHTML=r),u&&(u.style.height=`${n}px`,u.style.transform=`translateY(${i}px)`)}}),[a]),1===e)return Tt.ZP.createElement("div",{className:ar.pinnedMessageBorder},Tt.ZP.createElement("div",{className:ar.pinnedMessageBorderWrapper1,ref:s}));const{trackHeight:n,trackTranslateY:i,markHeight:o,markTranslateY:r,clipPathId:c}=a;return Tt.ZP.createElement("div",{className:(0,xt.Z)(ar.pinnedMessageBorder,e>4&&ar.pinnedMessageBorderMask)},Tt.ZP.createElement("div",{className:ar.pinnedMessageBorderWrapper,ref:s,style:`clip-path: url("#${c}"); width: 2px;\n height: ${n}px; transform: translateY(-${i}px);`},Tt.ZP.createElement("span",null),Tt.ZP.createElement("div",{className:ar.pinnedMessageBorderMark,style:`--height: ${o}px; --translate-y: ${r}px; --translate-track: ${i}px;`})))})),or="OibpUlOd",rr="_f3hwC8p",cr=1.125*C.Gw,dr=(0,Tt.X$)((({message:e,count:t,index:s,customTitle:n,className:o,onUnpinMessage:r,onClick:c,onAllPinnedClick:d,isLoading:l,isFullWidth:u})=>{const{clickBotInlineButton:m}=(0,a.Sv)(),h=(0,Is.Z)(),p=(0,tr.Z)(e),g=(0,ba.Z)((0,I.Ti)(e,"pictogram")),f=(0,I.NE)(e),w=(0,Si.Z)([l],450)&&l,[v,b,y]=(0,xs.Z)(),P=(0,qt.Z)((()=>{y(),r&&r(e.id)})),Z=(0,I.eH)(e),S=(0,qt.Z)((()=>{Z&&m({messageId:e.id,button:Z})})),[M,E,R]=(0,xs.Z)(),{handleClick:k,handleMouseDown:T}=(0,ti.m)(c);return Tt.ZP.createElement("div",{className:(0,xt.Z)("HeaderPinnedMessageWrapper","Guj4V7W_",u&&"full-width",o)},(t>1||w)&&Tt.ZP.createElement(ws.Z,{round:!0,size:"smaller",color:"translucent",ariaLabel:h("EventLogFilterPinnedMessages"),onClick:w?void 0:d},l&&Tt.ZP.createElement(js.Z,{color:"blue",className:(0,xt.Z)("clu9vjEC",or,!w&&rr)}),Tt.ZP.createElement("i",{className:(0,xt.Z)("icon","icon-pin-list",or,w&&rr)})),r&&Tt.ZP.createElement(ws.Z,{round:!0,size:"smaller",color:"translucent",ariaLabel:h("UnpinMessageAlertTitle"),onClick:b},Tt.ZP.createElement("i",{className:"icon icon-close"})),Tt.ZP.createElement(_i.Z,{isOpen:v,onClose:y,text:"Would you like to unpin this message?",confirmLabel:"Unpin",confirmHandler:P}),Tt.ZP.createElement("div",{className:(0,xt.Z)("GgG7nh8p",M&&"Nki3ifmz"),onClick:k,onMouseDown:T,dir:h.isRtl?"rtl":void 0},Tt.ZP.createElement(ir,{count:t,index:s}),Tt.ZP.createElement(hs.ZP,{activeKey:e.id,name:"slideVertical",className:"ud4LJMTI"},function(e,t,s){const{width:a,height:n}=(0,C.W7)(),i=t||e;return Tt.ZP.createElement("div",{className:"_M8tJtJD"},e&&!s&&Tt.ZP.createElement("img",{className:"KKUhI313",src:i,width:a,height:n,alt:"",draggable:!1}),e&&Tt.ZP.createElement(Wi.Z,{thumbDataUri:i,isVisible:Boolean(s),width:a,height:n}))}(p,g,f)),Tt.ZP.createElement("div",{className:(0,xt.Z)("LPdDfCw0",p&&"hRtSF_Ex")},Tt.ZP.createElement("div",{className:"bY9umAoY",dir:"auto"},!n&&Tt.ZP.createElement(Ci.Z,{text:`${h("PinnedMessage")} ${s>0?"#"+(t-s):""}`}),n&&(0,ga.Z)(n)),Tt.ZP.createElement(hs.ZP,{activeKey:e.id,name:"slideVerticalFade",className:"lo853Tki"},Tt.ZP.createElement("p",{dir:"auto",className:"Ko14czNN"},Tt.ZP.createElement(sr.Z,{lang:h,message:e,noEmoji:Boolean(p),emojiSize:cr})))),Tt.ZP.createElement(Ca.Z,null),Z&&Tt.ZP.createElement(ws.Z,{size:"tiny",className:"lfWlkB7k",onClick:S,shouldStopPropagation:!0,onMouseEnter:i.$b?void 0:E,onMouseLeave:i.$b?void 0:R},(0,ga.Z)(Z.text))))})),lr=(0,Tt.X$)((0,a.c$)(((e,{chatId:t,threadId:s,messageListType:a,isMobile:n})=>{const{isLeftColumnShown:i,shouldSkipHistoryAnimations:o,audioPlayer:c,messageLists:d}=(0,b.jUK)(e),l=(0,b.Z1J)(e,t),{chatId:u,messageId:m}=c,h=u&&m?(0,b.hjO)(e,u,m):void 0;let p;if("pinned"===a){const a=(0,b.KBA)(e,t,s);p=a?.length}else if("scheduled"===a){const a=(0,b.qyA)(e,t,s);p=a?.length}else if("thread"===a&&s!==r._f){const a=(0,b.tZg)(e,t,s);p=a?.messagesCount||0}const g="thread"===a&&s===r._f,f=l&&(0,b.xoo)(e,l),w=Boolean(f&&(0,b.s4q)(e,t)),v=f&&!w&&Boolean((0,b.pkN)(e,t)),y=Boolean(l&&(g||l.isForum)&&((0,I.eA)(l)||(0,I.ZV)(l))&&l.isNotJoined),P=Boolean(l?.isNotJoined&&l.isJoinRequest),Z=(0,b.WPz)(e,t,s,"typingStatus"),S=l?.emojiStatus,C=S&&e.customEmojis.byId[S.documentId],M=(0,I._o)(t,s,e.currentUserId),E={typingStatus:Z,isLeftColumnShown:i,isRightColumnShown:(0,b.Jf5)(e,n),isSelectModeActive:(0,b.CAb)(e),audioMessage:h,chat:l,messagesCount:p,isChatWithSelf:(0,b.FM1)(e,t),shouldSkipHistoryAnimations:o,currentTransitionKey:Math.max(0,d.length-1),connectionState:e.connectionState,isSyncing:e.isSyncing,isSynced:e.isSynced,isFetchingDifference:e.isFetchingDifference,emojiStatusSticker:C,hasButtonInHeader:v||w||y||P,isSavedDialog:M},R=(0,b.Zwk)(e,t);if("thread"!==a||!R)return E;if(s!==r._f&&!M&&!l?.isForum){const a=Number(s),n=a?(0,b.hjO)(e,t,a):void 0,i=n?(0,b.cve)(e,n):void 0;return{...E,pinnedMessageIds:a,messagesById:R,canUnpin:!1,topMessageSender:i}}const k=M?void 0:(0,b.KBA)(e,t,s);if(k?.length){const t=R[k[0]],{canUnpin:a=!1}=t&&1===k.length&&(0,b._kf)(e,t,s)||{};return{...E,pinnedMessageIds:k,messagesById:R,canUnpin:a}}return E}))((({chatId:e,threadId:t,messageListType:s,isReady:i,isMobile:o,pinnedMessageIds:d,messagesById:l,canUnpin:u,topMessageSender:m,typingStatus:h,isSelectModeActive:g,isLeftColumnShown:f,isRightColumnShown:w,audioMessage:v,chat:b,messagesCount:y,isComments:P,isChatWithSelf:Z,hasButtonInHeader:S,shouldSkipHistoryAnimations:C,currentTransitionKey:M,connectionState:E,isSyncing:R,isSynced:k,isFetchingDifference:T,getCurrentPinnedIndexes:N,getLoadingPinnedId:A,emojiStatusSticker:x,isSavedDialog:U,onFocusPinnedMessage:L})=>{const{openThreadWithInfo:O,pinMessage:_,focusMessage:F,openChat:D,openPreviousChat:j,loadPinnedMessages:q,toggleLeftColumn:G,exitMessageSelectMode:H,openPremiumModal:V,openThread:$,openStickerSet:z}=(0,a.Sv)(),K=(0,Is.Z)(),J=(0,Tt.sO)(!0),{isTablet:W}=(0,B.ZP)(),Y=(0,Ko.Z)(N)[`${e}_${t}`]||0,X=(0,Ko.Z)(A),Q=Array.isArray(d)?d[Y]:d,ee=l&&Q?l[Q]:void 0,te=Array.isArray(d)?d.length:d?1:void 0,se=b&&(0,I.U)(K,b).length,ae=m?(0,I.OU)(K,m):void 0,{settings:ne}=b||{},ie=b?.isForum;(0,Tt.d4)((()=>{k&&i&&(t===r._f||ie)&&q({chatId:e,threadId:t})}),[e,t,k,i,ie]),(0,kn.Z)(e,Q,ee);const{width:oe}=(0,Oa.Z)(),re=oe<=n.ksF,ce=W&&f,de=(0,Tt.sO)(null),le=(0,Tt.sO)(!0),{handleClick:ue,handleMouseDown:me}=(0,ti.m)((s=>{"mousedown"===s.type&&s.target.closest(".title > .custom-emoji")||O({chatId:e,threadId:t})})),he=(0,qt.Z)((e=>{_({messageId:e,isUnpin:!0})})),pe=(0,qt.Z)((s=>{const a=s.shiftKey&&Array.isArray(d)?d[(0,_a.Z)(d.length,d.indexOf(Q)-2)]:Q;L(a)&&F({chatId:e,threadId:t,messageId:a,noForumTopicPanel:!0})})),ge=(0,qt.Z)((()=>{$({chatId:e,threadId:t,type:"pinned"})})),fe=(0,qt.Z)((()=>{setTimeout((()=>{J.current=!0}),450)})),Ie=(0,qt.Z)((()=>{V({fromUserId:e})})),we=(0,qt.Z)((()=>{z({stickerSetInfo:x.stickerSetInfo})})),ve=(0,qt.Z)((e=>{if(J.current){if(J.current=!1,o){const e=document.querySelector(n.Edp);e?.blur()}if(g)return H(),void fe();if("thread"===s&&0===M)return!W||ce?(e.stopPropagation(),D({id:void 0},{forceOnHeavyAnimation:!0})):G(),void fe();j(),fe()}})),be=oe>=n.ksF&&oe<n.jT7||oe>n.l35&&oe<n.ksF&&(!se||se>30),ye=be||oe>n._mX&&oe<n.QU1,Pe=Boolean(ne?.canAddContact||ne?.canBlockContact||ne?.canReportSpam),{shouldRender:Ze,transitionClassNames:Se}=(0,$t.Z)(Pe),Ce=(0,zo.Z)(Pe?ne:void 0,!0),{shouldRender:Me,transitionClassNames:Ee}=(0,$t.Z)(Boolean(v)),Re=(0,zo.Z)(v,!0),{shouldRender:ke,transitionClassNames:Te}=(0,$t.Z)(Boolean(ee),void 0,!0),Ne=(0,zo.Z)(ee,!0),Ae=(0,zo.Z)(te,!0),Be=(0,zo.Z)(u,!0),xe=(0,zo.Z)(ae),Ue=(0,La.Z)(M),Le=void 0!==Ue&&Ue<M?Ue:void 0,Oe=ke&&Ne||Me&ℜ(0,Tt.bt)((()=>{const e=de.current;if(e)return ye&&Oe?void(w||be?(le.current&&(e.classList.add("tools-stacked","animated"),le.current=!1),setTimeout((()=>{(0,Bt.WM)((()=>{e.classList.remove("animated")}))}),350)):(e.classList.remove("tools-stacked"),le.current=!0)):(e.classList.remove("tools-stacked","animated"),void(le.current=!0))}),[ye,Oe,be,w]);const{connectionStatusText:_e}=As(K,E,R||T,!0);function Fe(e=!1,t=!1){return Tt.ZP.createElement("div",{className:"back-button"},Tt.ZP.createElement(ws.Z,{round:!0,size:"smaller",color:"translucent",onClick:ve,ariaLabel:K(e?"Close":"Back")},Tt.ZP.createElement("div",{className:(0,xt.Z)("animated-close-icon",!e&&"state-back")})),t&&Tt.ZP.createElement(rs,null))}const De=Boolean(Me&&Re),je=De||!o&&S&&oe<n.sgm;return(0,Bs.Z)(de),Tt.ZP.createElement("div",{className:"MiddleHeader",ref:de},Tt.ZP.createElement(hs.ZP,{name:C?"none":"slideFade",activeKey:M,shouldCleanup:!0,cleanupExceptionKey:Le},"thread"===s&&(t===r._f||U||b?.isForum)?function(){const s=U?K("SavedMessages"):void 0,a=U?String(t):e;return Tt.ZP.createElement(Tt.ZP.Fragment,null,(re||M>0)&&Fe(ce,!U),Tt.ZP.createElement("div",{className:"chat-info-wrapper",onClick:ue,onMouseDown:me},(0,I.YC)(a)?Tt.ZP.createElement(Yo.Z,{key:a,userId:a,typingStatus:h,status:_e||s,withDots:Boolean(_e),withFullInfo:!0,withMediaViewer:!0,withStory:!Z,withUpdatingStatus:!0,isSavedDialog:U,storyViewerOrigin:c.ze.MiddleHeaderAvatar,emojiStatusSize:22,noRtl:!0,onEmojiStatusClick:Ie}):Tt.ZP.createElement(Wo.Z,{key:a,chatId:a,threadId:U?void 0:t,typingStatus:h,status:_e||s,withDots:Boolean(_e),withMediaViewer:t===r._f,withFullInfo:t===r._f,withUpdatingStatus:!0,withStory:!0,isSavedDialog:U,storyViewerOrigin:c.ze.MiddleHeaderAvatar,emojiStatusSize:22,onEmojiStatusClick:we,noRtl:!0})))}():Tt.ZP.createElement(Tt.ZP.Fragment,null,Fe(),Tt.ZP.createElement("h3",null,void 0!==y?"thread"===s?y?K(P?"Comments":"Replies",y,"i"):K(P?"CommentsTitle":"RepliesTitle"):"pinned"===s?K("PinnedMessagesCount",y,"i"):"scheduled"===s?Z?K("Reminders"):K("messages",y,"i"):void 0:K("Loading")))),t===r._f&&!b?.isForum&&Tt.ZP.createElement(Jo.Z,{hasPinnedOffset:ke&&Boolean(Ne)||Me&&Boolean(Re),chatId:e}),ke&&Ne&&Tt.ZP.createElement(dr,{key:e,message:Ne,count:Ae||0,index:Y,customTitle:xe,className:Te,onUnpinMessage:Be?he:void 0,onClick:pe,onAllPinnedClick:ge,isLoading:void 0!==X,isFullWidth:je}),Ze&&Tt.ZP.createElement(Qo,{key:e,chatId:e,settings:Ce,className:Se}),Tt.ZP.createElement("div",{className:"header-tools"},De&&Tt.ZP.createElement(Ra,{key:(0,p.T)(Re),message:Re,className:Ee}),Tt.ZP.createElement(er.Z,{chatId:e,threadId:t,messageListType:s,isMobile:o,canExpandActions:!De})))}))),ur=e=>{const{isActive:t}=e,s=(0,Yt.Z)(Ot.gl.Extra,"MobileSearch",!t,!0);return s?Tt.ZP.createElement(s,e):void 0};var mr=s(8337);const hr=(0,Tt.X$)((0,a.c$)(((e,{userId:t})=>{const s=(0,b.dyD)(e,t);return{userName:(0,I.Vl)(s)}}))((function({userName:e}){const t=(0,Is.Z)(),{openPremiumModal:s}=(0,a.Sv)(),n=(0,qt.Z)((()=>s()));return Tt.ZP.createElement("div",null,Tt.ZP.createElement("div",null,t("Chat.MessagingRestrictedPlaceholder",e)),Tt.ZP.createElement(mr.Z,{isPrimary:!0,onClick:n},t("Chat.MessagingRestrictedPlaceholderAction")))}))),pr=e=>{const{isOpen:t}=e,s=(0,Yt.Z)(Ot.gl.Extra,"ReactorListModal",!t);return s?Tt.ZP.createElement(s,e):void 0};function gr(e){return"file"===e.kind&&e.type&&n.oGt.has(e.type)}const fr=450+n.fK3,Ir=(0,Tt.X$)((0,a.c$)(((e,{isMobile:t})=>{const s=(0,b.Puy)(e),{isBlurred:a,background:i,backgroundColor:o,patternColor:c}=e.settings.themes[s]||{},{messageLists:d,isLeftColumnShown:l,activeEmojiInteractions:u,seenByModal:m,giftPremiumModal:h,reactorModal:p,audioPlayer:g,shouldSkipHistoryAnimations:f,chatLanguageModal:w,privacySettingsNoticeModal:v}=(0,b.jUK)(e),y=(0,b.Btg)(e),{leftColumnWidth:P}=e,Z={theme:s,customBackground:i,backgroundColor:o,patternColor:c,isLeftColumnShown:l,isRightColumnShown:(0,b.Jf5)(e,t),isBackgroundBlurred:a,hasCurrentTextSearch:Boolean((0,b.n5x)(e)),isSelectModeActive:(0,b.CAb)(e),isSeenByModalOpen:Boolean(m),isPrivacySettingsNoticeModalOpen:Boolean(v),isReactorListModalOpen:Boolean(p),isGiftPremiumModalOpen:h?.isOpen,isChatLanguageModalOpen:Boolean(w),withInterfaceAnimations:(0,b.FOo)(e),currentTransitionKey:Math.max(0,d.length-1),activeEmojiInteractions:u,leftColumnWidth:P};if(!y)return Z;const{chatId:S,threadId:C,type:M}=y,E=(0,I.YC)(S),R=(0,b.Z1J)(e,S),k=(0,b.kBx)(e,S),T=(0,b.KBA)(e,S,C),{chatId:N,messageId:A}=g,B=S?(0,b.x67)(e,S):void 0,x=(0,b.tZg)(e,S,C),U=Boolean(!x?.isCommentsInfo&&x?.fromChannelId),L=R&&(0,I.Qm)(R,C,U,B),O=(0,b.pkN)(e,S),_="pinned"===M,F="thread"===M&&C===r._f,D=Boolean(R&&(0,I.eA)(R)),j=Boolean(R&&F&&(D||(0,I.ZV)(R))&&R.isNotJoined&&!R.joinRequests),q=Boolean(R?.isNotJoined&&R.isJoinToSend),G=Boolean(R?.isNotJoined&&R.isJoinRequest),H=!!E&&(0,b.s4q)(e,S),V=Boolean(k&&H),$=!V&&O,z=H&&!k,K=Boolean(R&&(0,I.Bf)(R)&&!B),J=(0,b.Mst)(e,S,C)?.replyInfo,W=!!R?.isForum&&C===r._f&&!J&&R.topics?.[n.OxA]?.isClosed,Y=N&&A?(0,b.hjO)(e,N,A):void 0,X=(0,I._o)(S,C,e.currentUserId),Q=X&&C!==n.tKb,ee=C!==r._f&&!X&&!R?.isForum,te=ee?Number(C):void 0,se=R&&(E||R?.isCreator||!D&&!(0,I.Mg)(R,"pinMessages")||(0,I.VE)(R,"pinMessages")),ae=(0,b.ccz)(e,S)?.isContactRequirePremium;return{...Z,chatId:S,threadId:C,messageListType:M,chat:R,draftReplyInfo:J,isPrivate:E,areChatSettingsLoaded:Boolean(R?.settings),isComments:U,canPost:!_&&(!R||L)&&!O&&!(q&&R?.isNotJoined)&&!W&&!X,isPinnedMessageList:_,currentUserBannedRights:R?.currentUserBannedRights,defaultBannedRights:R?.defaultBannedRights,hasPinned:ee||Boolean(!_&&T?.length),hasAudioPlayer:Boolean(Y),hasButtonInHeader:$||V||j||G,pinnedMessagesCount:T?T.length:0,shouldSkipHistoryAnimations:f,isChannel:D,canSubscribe:j,canStartBot:$,canRestartBot:V,shouldJoinToSend:q,shouldSendJoinRequest:G,shouldLoadFullChat:K,pinnedIds:T,topMessageId:te,canUnpin:se,canUnblock:z,isSavedDialog:X,canShowOpenChatButton:Q,isContactRequirePremium:ae}}))((function({leftColumnRef:e,chatId:t,threadId:s,isComments:o,messageListType:r,isMobile:c,chat:d,draftReplyInfo:l,isPrivate:u,isPinnedMessageList:h,canPost:p,currentUserBannedRights:g,defaultBannedRights:f,hasPinned:w,hasAudioPlayer:v,hasButtonInHeader:y,pinnedMessagesCount:P,customBackground:Z,theme:S,backgroundColor:N,patternColor:A,isLeftColumnShown:x,isRightColumnShown:U,isBackgroundBlurred:L,leftColumnWidth:O,hasCurrentTextSearch:_,isSelectModeActive:F,isSeenByModalOpen:D,isPrivacySettingsNoticeModalOpen:j,isReactorListModalOpen:q,isGiftPremiumModalOpen:G,isChatLanguageModalOpen:H,withInterfaceAnimations:V,shouldSkipHistoryAnimations:$,currentTransitionKey:z,isChannel:K,areChatSettingsLoaded:J,canSubscribe:W,canStartBot:Y,canRestartBot:X,activeEmojiInteractions:Q,shouldJoinToSend:ee,shouldSendJoinRequest:te,shouldLoadFullChat:se,pinnedIds:ae,topMessageId:ne,canUnpin:ie,canUnblock:oe,isSavedDialog:re,canShowOpenChatButton:ce,isContactRequirePremium:de}){const{openChat:le,openPreviousChat:ue,unpinAllMessages:me,loadUser:he,loadChatSettings:pe,closeLocalTextSearch:ge,exitMessageSelectMode:fe,joinChannel:Ie,sendBotCommand:we,restartBot:ve,showNotification:be,loadFullChat:ye,setLeftColumnWidth:Pe,resetLeftColumnWidth:Ze,unblockUser:Se}=(0,a.Sv)(),{width:Ce}=(0,Oa.Z)(),{isTablet:Me,isDesktop:Ee}=(0,B.ZP)(),Re=(0,Is.Z)(),[ke,Te]=(0,Tt.eJ)(za.t.None),[Ne,Ae]=(0,Tt.eJ)(),[Be,xe]=(0,Tt.eJ)(),[Ue,Le]=(0,Tt.eJ)(!1),{onIntersectionChanged:Oe,onFocusPinnedMessage:_e,getCurrentPinnedIndexes:Fe,getLoadingPinnedId:De,getForceNextPinnedInHeader:je}=function(e,t,s,n){const[i,o]=(0,Da.Z)({}),[r,c]=(0,Da.Z)(),d=(0,Tt.sO)(),[l,u]=(0,Da.Z)(),h=e?`${e}_${t}`:void 0;return(0,Tt.d4)((()=>{c(void 0),d.current=void 0,u(void 0)}),[e,o,c,u,t]),(0,Tt.d4)((()=>{if(!h)return;const e=i()[h],t=s?.length||0;e>=t&&o({...i(),[h]:Math.max(0,t-1)})}),[i,h,s?.length,o]),{onIntersectionChanged:(0,qt.Z)((({viewportPinnedIdsToAdd:n=[],viewportPinnedIdsToRemove:p=[],isReversed:g,hasScrolled:f,isUnmount:I})=>{if(!e||!t||!h)return;const w=(0,a.Rd)();if(!s?.length||!s)return;const v=l();if(v&&!f){const e=s.indexOf(v);o({...i(),[h]:e}),u(void 0)}f&&(c(void 0),u(void 0));const y=r(),P=d.current;if(I&&0===n.length&&1===p.length&&!P?.includes(p[0]))return;const Z=(0,m.Tw)((P?.filter((e=>!p.includes(e)))||[]).concat(n));d.current=Z;const S=(0,b.G$N)(w,e);if(!Z.length&&I&&S&&!s.includes(S)){const e=s.find((e=>e<S));if(e){const t=s.indexOf(e);o({...i(),[h]:t})}}if(y||I)return;const C=Math.max(...Z),M=s.findIndex((e=>e===C)),E=g?0:1,R=Z.length?M:P?.length?(0,Fa.uZ)(s.indexOf(P[0])+E,0,s.length-1):0;o({...i(),[h]:R})})),onFocusPinnedMessage:(0,qt.Z)((r=>{if(!e||!t||!h||l())return!1;const d=(0,a.Rd)();if(!s?.length)return n===r;const m=s.indexOf(r),p=(0,_a.Z)(s.length,m+1);c(!0);const g=(0,b.gbs)(d,e,t);return g?.includes(r)||(0,b.ofg)(d,e,t,r)?(o({...i(),[h]:p}),!0):(u(s[p]),!0)})),getCurrentPinnedIndexes:i,getLoadingPinnedId:l,getForceNextPinnedInHeader:r}}(t,s,ae,ne),qe=c&&_,Ge=c?fr:void 0,He=w&&(Ce<n.l35||v||U&&Ce>n._mX&&Ce<n.QU1||!c&&y&&Ce<n.sgm),Ve=(0,Ua.Z)(t,Ge),$e=(0,Ua.Z)(s,Ge),ze=(0,Ua.Z)(r,Ge),Ke=(0,Ua.Z)(W,Ge),Je=(0,Ua.Z)(Y,Ge),We=(0,Ua.Z)(X,Ge),Ye=(0,Ua.Z)(oe,Ge),Xe=(0,Ua.Z)(p,Ge)&&!We&&!Je&&!Ke&&!Ye&&t!==n.mzl&&!de,Qe=(0,Ua.Z)(He,Ge),et=(0,Ua.Z)(Ne,Ge)&&t!==n.mzl,tt=(0,Ua.Z)(K,Ge),st=(0,Ua.Z)(ee,Ge),at=(0,Ua.Z)(te,Ge),nt=(0,Ua.Z)(t?Oe:void 0,Ge),it=(0,La.Z)(z),ot=void 0!==it&&it<z?it:void 0,{isReady:rt,handleCssTransitionEnd:ct,handleSlideTransitionStop:dt}=function(e,t,s,a,n){const[i,o]=(0,Tt.eJ)(!n),r=(0,Dt.Z)(),c=void 0!==s&&s!==t;return c&&(e?(o(!1),setTimeout((()=>{o(!0)}),fr)):r()),(0,zt.Z)((()=>{e||o(!0)}),[e]),{isReady:i&&!c,handleCssTransitionEnd:e?function(e){"transform"===e.propertyName&&e.target===e.currentTarget&&o(Boolean(a))}:void 0,handleSlideTransitionStop:e?function(){o(!0)}:void 0}}(!$&&V,z,it,t,c);(0,Tt.d4)((()=>t?(0,cs.Z)((()=>{le({id:void 0})})):void 0),[t,le]),(0,zt.Z)((()=>{Te(za.t.None),xe(void 0)}),[t]),(0,Tt.d4)((()=>{if(!i.cj&&!i.wZ)return;const{visualViewport:e}=window;if(!e)return;const t=()=>{const t=e.height!==document.documentElement.clientHeight;(0,Bt.WM)((()=>{document.body.classList.toggle("keyboard-visible",t),(0,Bt.i$)((()=>{!t&&e.offsetTop&&(0,Bt.WM)((()=>{window.scrollTo({top:0})}))}))}))};return e.addEventListener("resize",t),()=>{e.removeEventListener("resize",t)}})),(0,Tt.d4)((()=>{u&&he({userId:t})}),[t,u,he]),(0,Tt.d4)((()=>{J||pe({chatId:t})}),[t,u,J]),(0,Tt.d4)((()=>{t&&se&&rt&&ye({chatId:t})}),[se,t,rt,ye]);const{initResize:lt,resetResize:ut,handleMouseUp:mt}=function(e,t,s,a,n){const[i,o,r]=(0,xs.Z)(),[c,d]=(0,Tt.eJ)(0),[l,u]=(0,Tt.eJ)(0),m=(0,qt.Z)((t=>{(0,Bt.WM)((()=>{if(!e.current)return;const s=t?`${t}px`:"";e.current.style.width=s,n&&e.current.style.setProperty(n,s)}))}));function h(){(0,Bt.WM)((()=>{document.body.classList.remove("cursor-ew-resize")}))}return(0,Tt.bt)((()=>{e.current&&a&&m(a)}),[n,e,a,m]),(0,Tt.d4)((()=>{if(!i)return;const s=e=>{const t=Math.ceil(l+e.clientX-c);m(t)};function a(){n(),t(e.current.offsetWidth)}function n(){h(),document.removeEventListener("mousemove",s,!1),document.removeEventListener("mouseup",a,!1),document.removeEventListener("blur",a,!1),r()}return document.addEventListener("mousemove",s,!1),document.addEventListener("mouseup",a,!1),document.addEventListener("blur",a,!1),n}),[l,c,e,t,i,r,m]),{initResize:function(t){t.preventDefault(),(0,Bt.WM)((()=>{document.body.classList.add("cursor-ew-resize")})),d(t.clientX),u(e.current.offsetWidth),o()},resetResize:function(e){e.preventDefault(),m(void 0),s()},handleMouseUp:h}}(e,(e=>Pe({leftColumnWidth:e})),Ze,O,"--left-column-width"),ht=(0,qt.Z)((e=>{const{items:t}=e.dataTransfer||{},s=t&&t.length>0&&Array.from(t).filter((e=>"text/uri-list"!==e.type)).every(gr);Te(s?za.t.QuickFile:za.t.Document)})),pt=(0,qt.Z)((()=>{Te(za.t.None)})),gt=(0,qt.Z)((()=>{Le(!0)})),ft=(0,qt.Z)((()=>{Le(!1)})),It=(0,qt.Z)((()=>{le({id:String(s)})})),wt=(0,qt.Z)((()=>{me({chatId:t,threadId:s}),ft(),ue()})),vt=(0,qt.Z)((()=>{le({id:t})})),bt=(0,qt.Z)((()=>{Ie({chatId:t}),at&&be({message:Re(K?"RequestToJoinChannelSentDescription":"RequestToJoinGroupSentDescription")})})),yt=(0,qt.Z)((()=>{we({command:"/start"})})),Pt=(0,qt.Z)((()=>{ve({chatId:t})})),Zt=(0,qt.Z)((()=>{Se({userId:t})})),St=((e,t)=>{const{setThemeSettings:s}=(0,a.Sv)(),[i,o]=(0,Tt.eJ)(t);return(0,Tt.d4)((()=>{t&&(t.startsWith("#")?o(t):Ba.fetch(n.foQ,e,Ba.Type.Blob).then((e=>{const t=URL.createObjectURL(e);(0,xa.pt)(t).then((()=>{o(`url(${t})`)}))})).catch((()=>{s({theme:e,background:void 0,backgroundColor:void 0,isBlurred:!0,patternColor:"dark"===e?n.Vvx:n.ga_})})))}),[t,e]),t?i:void 0})(S,Z),Ct=(0,xt.Z)(Qe&&"has-header-tools",i.aZ?"mask-image-disabled":"mask-image-enabled"),Mt=(0,xt.Z)("C6IaXYew","nXhZtCma",Z&&"K1xhz7U5",N&&"CwoXMwaR",Z&&L&&"JBrOVLsX",U&&"Lyw3O8XE",i.D$&&!(Ve&&$e)&&"jMpPshUt"),Et=(0,xt.Z)("messaging-disabled",!F&&"shown"),Rt=(0,I.q8)(Re,g,f),kt=(0,I.mt)(Re,d,s,Boolean(l)),Nt=Rt??kt??(de?Tt.ZP.createElement(hr,{userId:t}):void 0),{composerHiddenScale:At,toolbarHiddenScale:Ut,composerTranslateX:Lt,toolbarTranslateX:Ot,unpinHiddenScale:_t,toolbarForUnpinHiddenScale:Ft}=(0,Tt.Ye)((()=>function(e,t){const s=e<=n.l35?C.Gw:2*C.Gw,a=function(e){if(e>n._mX){const t=Math.min(Math.max(.25*e,k),R),s=Math.min(.25*e,R);return Math.min(e-t-s,E)}if(e>n.ksF){const t=Math.min(Math.max(.4*e,k),R);return Math.min(e-t,E)}return e>E?E:e}(e),i=e<=n.l35?3.375*C.Gw:4*C.Gw,o=t?a-s-i:a-s,r=e>n.l35?Math.min(a-s,M):a-s,c=r/o,d=o/r;return{composerHiddenScale:c,toolbarHiddenScale:d,composerTranslateX:t?i/2*d:0,toolbarTranslateX:t?i/2*-1*c:0,unpinHiddenScale:r/T,toolbarForUnpinHiddenScale:T/r}}(Ce,Xe)),[Xe,Ce]),jt=(0,xt.Z)("middle-column-footer",!Xe&&"no-composer",Xe&&Be&&!F&&"with-notch");(0,Ss.Z)({isActive:F,onBack:fe}),(0,Ss.Z)({isActive:qe,onBack:ge});const Gt=Boolean(!h&&!re&&!Xe&&!We&&!Je&&!Ke&&Nt),Ht=Boolean(We||Ke||at||Je||h||ce||Ye),Vt=Boolean(Gt||F||h);return Tt.ZP.createElement("div",{id:"MiddleColumn",className:Ct,onTransitionEnd:ct,style:(0,Aa.Z)(`--composer-hidden-scale: ${At}`,`--toolbar-hidden-scale: ${Ut}`,`--unpin-hidden-scale: ${_t}`,`--toolbar-unpin-hidden-scale: ${Ft},`,`--composer-translate-x: ${Lt}px`,`--toolbar-translate-x: ${Ot}px`,`--pattern-color: ${A}`,N&&`--theme-background-color: ${N}`),onClick:Me&&x?vt:void 0},Ee&&Tt.ZP.createElement("div",{className:"resize-handle",onMouseDown:lt,onMouseUp:mt,onDoubleClick:ut}),Tt.ZP.createElement("div",{className:Mt,style:St?`--custom-background: ${St}`:void 0}),Tt.ZP.createElement("div",{id:"middle-column-portals"}),Boolean(Ve&&$e)&&Tt.ZP.createElement(Tt.ZP.Fragment,null,Tt.ZP.createElement("div",{className:"messages-layout",onDragEnter:Xe?ht:void 0},Tt.ZP.createElement(lr,{chatId:Ve,threadId:$e,messageListType:ze,isComments:o,isReady:rt,isMobile:c,getCurrentPinnedIndexes:Fe,getLoadingPinnedId:De,onFocusPinnedMessage:_e}),Tt.ZP.createElement(hs.ZP,{name:$?"none":V?"slide":"fade",activeKey:z,shouldCleanup:!0,cleanupExceptionKey:ot,onStop:dt},Tt.ZP.createElement(Vo,{key:`${Ve}-${$e}-${ze}`,chatId:Ve,threadId:$e,type:ze,isComments:o,canPost:Xe,hasTools:Qe,onFabToggle:Ae,onNotchToggle:xe,isReady:rt,isContactRequirePremium:de,withBottomShift:Ht,withDefaultBg:Boolean(!Z&&!N),onPinnedIntersectionChange:nt,getForceNextPinnedInHeader:je}),Tt.ZP.createElement("div",{className:jt},Xe&&Tt.ZP.createElement(ja.Z,{type:"messageList",chatId:Ve,threadId:$e,messageListType:ze,dropAreaState:ke,onDropHide:pt,isReady:rt,isMobile:c,editableInputId:n.R2F,editableInputCssSelector:n.Edp,inputId:"message-input-text"}),h&&ie&&Tt.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:Re.isRtl?"rtl":void 0},Tt.ZP.createElement(ws.Z,{size:"tiny",fluid:!0,color:"secondary",className:"composer-button unpin-all-button",onClick:gt},Tt.ZP.createElement("i",{className:"icon icon-unpin"}),Tt.ZP.createElement("span",null,Re("Chat.Pinned.UnpinAll",P,"i")))),ce&&Tt.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:Re.isRtl?"rtl":void 0},Tt.ZP.createElement(ws.Z,{size:"tiny",fluid:!0,color:"secondary",className:"composer-button open-chat-button",onClick:It},Tt.ZP.createElement("span",null,Re("SavedOpenChat")))),Gt&&Tt.ZP.createElement("div",{className:Et},Tt.ZP.createElement("div",{className:"messaging-disabled-inner"},Tt.ZP.createElement("span",null,Nt))),c&&(Ke||st&&!at)&&Tt.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:Re.isRtl?"rtl":void 0},Tt.ZP.createElement(ws.Z,{size:"tiny",fluid:!0,ripple:!0,className:"composer-button join-subscribe-button",onClick:bt},Re(tt?"ProfileJoinChannel":"ProfileJoinGroup"))),c&&at&&Tt.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:Re.isRtl?"rtl":void 0},Tt.ZP.createElement(ws.Z,{size:"tiny",fluid:!0,ripple:!0,className:"composer-button join-subscribe-button",onClick:bt},Re("ChannelJoinRequest"))),c&&Je&&Tt.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:Re.isRtl?"rtl":void 0},Tt.ZP.createElement(ws.Z,{size:"tiny",fluid:!0,ripple:!0,className:"composer-button join-subscribe-button",onClick:yt},Re("BotStart"))),c&&We&&Tt.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:Re.isRtl?"rtl":void 0},Tt.ZP.createElement(ws.Z,{size:"tiny",fluid:!0,ripple:!0,className:"composer-button join-subscribe-button",onClick:Pt},Re("BotRestart"))),c&&Ye&&Tt.ZP.createElement("div",{className:"middle-column-footer-button-container",dir:Re.isRtl?"rtl":void 0},Tt.ZP.createElement(ws.Z,{size:"tiny",fluid:!0,ripple:!0,className:"composer-button join-subscribe-button",onClick:Zt},Re("Unblock"))),Tt.ZP.createElement($o,{messageListType:ze,isActive:F,canPost:Xe}),Tt.ZP.createElement(Ga,{isOpen:D}),Tt.ZP.createElement(qa,{isOpen:j}),Tt.ZP.createElement(pr,{isOpen:q}),i.SX&&Tt.ZP.createElement($a,{isOpen:H}))),Tt.ZP.createElement(Xa,{isShown:et,canPost:Xe,withExtraShift:Vt})),c&&Tt.ZP.createElement(ur,{isActive:Boolean(qe)})),t&&Tt.ZP.createElement(Ha,{isOpen:Ue,chatId:t,pinnedMessagesCount:P,onClose:ft,onUnpin:wt}),Tt.ZP.createElement("div",{teactFastList:!0},Q?.map(((e,t)=>Tt.ZP.createElement(Ka,{teactOrderKey:t,key:e.id,activeEmojiInteraction:e})))),Tt.ZP.createElement(Va,{isOpen:G}))}))),wr=e=>{const{bot:t}=e,s=(0,Yt.Z)(Ot.gl.Extra,"AttachBotInstallModal",!t);return s?Tt.ZP.createElement(s,e):void 0},vr=e=>{const{info:t}=e,s=(0,Yt.Z)(Ot.gl.Extra,"BoostModal",!t);return s?Tt.ZP.createElement(s,e):void 0},br=e=>{const{info:t}=e,s=(0,Yt.Z)(Ot.gl.Extra,"ChatlistModal",!t);return s?Tt.ZP.createElement(s,e):void 0},yr=e=>{const{modal:t}=e,s=(0,Yt.Z)(Ot.gl.Extra,"GiftCodeModal",!t);return s?Tt.ZP.createElement(s,e):void 0},Pr=e=>{const{geoPoint:t}=e,s=(0,Yt.Z)(Ot.gl.Extra,"MapModal",!t);return s?Tt.ZP.createElement(s,e):void 0},Zr=e=>{const{info:t}=e,s=(0,Yt.Z)(Ot.gl.Extra,"OneTimeMediaModal",!t);return s?Tt.ZP.createElement(s,e):void 0},Sr=e=>{const{urlAuth:t}=e,s=(0,Yt.Z)(Ot.gl.Extra,"UrlAuthModal",!t);return s?Tt.ZP.createElement(s,e):void 0},Cr=e=>{const{webApp:t}=e,s=(0,Yt.Z)(Ot.gl.Extra,"WebAppModal",!t);return s?Tt.ZP.createElement(s,e):void 0},Mr=e=>{const{isOpen:t}=e,s=(0,Yt.Z)(Ot.gl.Extra,"PaymentModal",!t);return s?Tt.ZP.createElement(s,e):void 0},Er=e=>{const{isOpen:t}=e,s=(0,Yt.Z)(Ot.gl.Extra,"ReceiptModal",!t);return s?Tt.ZP.createElement(s,e):void 0};var Rr=s(67263),kr=s(11820),Tr=s(41151);const Nr=(0,Tt.X$)((0,a.c$)(((e,{chatId:t})=>{const s=(0,b.Z1J)(e,t),{userIds:a}=e.contactList||{},{newChatMembersProgress:n}=(0,b.jUK)(e),{currentUserId:i}=e,o=s&&(0,I.eA)(s),{query:r,fetchingStatus:d,globalUserIds:l,localUserIds:u}=(0,b.jUK)(e).userSearch;return{isChannel:o,members:(0,b.x67)(e,t)?.members,currentUserId:i,localContactIds:a,searchQuery:r,isSearching:d,isLoading:n===c.WB.Loading,globalUserIds:l,localUserIds:u}}))((({isChannel:e,members:t,onNextStep:s,currentUserId:n,localContactIds:i,isLoading:o,searchQuery:r,isSearching:c,localUserIds:d,globalUserIds:l,onClose:u,isActive:h})=>{const{setUserSearchQuery:p}=(0,a.Sv)(),g=(0,Is.Z)(),[f,w]=(0,Tt.eJ)([]),v=(0,La.Z)(f)===f;(0,Ss.Z)({isActive:h,onBack:u});const b=(0,Tt.Ye)((()=>t?t.map((e=>e.userId)):[]),[t]),y=(0,Tt.I4)((e=>{p({query:e})}),[p]),P=(0,Tt.Ye)((()=>{const t=(0,a.Rd)().users.byId,s=i?(0,I.kK)(i,t,r):[];return(0,Rr.Z)((0,m.Tw)([...s,...d||[],...l||[]]).filter((s=>{const a=t[s];return!b.includes(s)&&s!==n&&(!a||!(0,I.cS)(a)||!e&&a.canBeInvitedToGroup)})))}),[i,r,d,l,n,b,e]),Z=(0,Tt.I4)((()=>{f.length&&(p({query:""}),s(f))}),[f,p,s]);return Tt.ZP.createElement("div",{className:"AddChatMembers"},Tt.ZP.createElement("div",{className:"AddChatMembers-inner"},Tt.ZP.createElement(kr.Z,{itemIds:P,selectedIds:f,filterValue:r,filterPlaceholder:g("lng_channel_add_users"),searchInputId:"new-members-picker-search",isLoading:c,onSelectedIdsChange:w,onFilterChange:y,isSearchable:!0,noScrollRestore:v}),Tt.ZP.createElement(Tr.Z,{isShown:Boolean(f.length),disabled:o,ariaLabel:g("lng_channel_add_users"),onClick:Z},o?Tt.ZP.createElement(js.Z,{color:"white"}):Tt.ZP.createElement("i",{className:"icon icon-arrow-right"}))))}))),Ar=e=>{const t=(0,Yt.Z)(Ot.gl.Extra,"CreateTopic");return t?Tt.ZP.createElement(t,e):Tt.ZP.createElement(ps.Z,null)},Br=e=>{const t=(0,Yt.Z)(Ot.gl.Extra,"EditTopic");return t?Tt.ZP.createElement(t,e):Tt.ZP.createElement(ps.Z,null)},xr=()=>{const e=(0,Yt.Z)(Ot.gl.Extra,"GifSearch");return e?Tt.ZP.createElement(e,null):Tt.ZP.createElement(ps.Z,null)},Ur=e=>{const t=(0,Yt.Z)(Ot.gl.Extra,"Management");return t?Tt.ZP.createElement(t,e):Tt.ZP.createElement(ps.Z,null)},Lr=()=>{const e=(0,Yt.Z)(Ot.gl.Extra,"PollResults");return e?Tt.ZP.createElement(e,null):Tt.ZP.createElement(ps.Z,null)};var Or=s(91),_r=s(13995);const Fr=(0,g.P2)((e=>e()),250,!1);let Dr=!1;function jr(e){switch(e){case"members":return c.vi.MemberList;case"stories":return c.vi.StoryList;case"dialogs":return c.vi.SavedDialogs;default:return c.vi.SharedMedia}}var qr=s(27407);function Gr(e,t){const[s,a]=(0,qr.Z)(e,t,void 0,n.Vk);return[s,a,!(!s||!t||s[0]===t[0])]}function Hr(e,t,s,a,i,o){const r=(0,Tt.sO)();(0,zt.Z)((()=>{r.current=void 0}),[o]),(0,zt.Z)((()=>{t===e&&a&&i&&(r.current=(0,I.R5)(a,i,e))}),[a,i,t,e]);const[c,d]=(0,qr.Z)(s,r.current,void 0,"media"===e?n.ENB:n.pnA);return[c,d,!(!c||!r.current||c[0]===r.current[0])]}var Vr=s(70180),$r=s(13709),zr=s(47262),Kr=s(16568),Jr=s(45418),Wr=s(12644),Yr=s(42175);const Xr=(0,Tt.X$)((function({story:e,isProtected:t,isArchive:s}){const{openStoryViewer:n,loadPeerSkippedStories:i,toggleStoryPinned:o,showNotification:r}=(0,a.Sv)(),c=(0,Is.Z)(),d=(0,Tt.sO)(null),l=(0,qt.Z)((()=>d.current)),u=(0,qt.Z)((()=>document.body)),m=(0,qt.Z)((()=>document.querySelector("#portals .story-context-menu .bubble"))),h=(0,qt.Z)((()=>({withPortal:!0,isDense:!0}))),p=e&&e.peerId,g=e&&"content"in e,f=g&&e.isOut,w=e&&"isDeleted"in e,v=g?e.content.video:void 0,b=g?(0,I.Cc)(e):void 0,y=(0,ba.Z)(b)||v?.thumbnail?.dataUri;(0,Tt.d4)((()=>{!e||g||w||i({peerId:e.peerId})}),[w,g,e]);const{isContextMenuOpen:P,contextMenuPosition:Z,handleBeforeContextMenu:S,handleContextMenu:C,handleContextMenuClose:M,handleContextMenuHide:E}=(0,Ia.Z)(d,!f),{positionX:R,positionY:k,transformOriginX:T,transformOriginY:N,style:A}=(0,Wr.Z)(Z,l,u,m,h),B=(0,Tt.I4)((()=>{n({peerId:e.peerId,storyId:e.id,isSinglePeer:!0,isPrivate:!0,isArchive:s})}),[s,e.id,e.peerId]),x=(0,qt.Z)((e=>{(0,sn.b)(e),S(e)})),U=(0,qt.Z)((t=>{(0,yn.Z)(t),o({peerId:p,storyId:e.id,isPinned:!0}),r({message:c("Story.ToastSavedToProfileText")}),M()})),L=(0,qt.Z)((t=>{(0,yn.Z)(t),o({peerId:p,storyId:e.id,isPinned:!1}),r({message:c("Story.ToastRemovedFromProfileText")}),M()}));return Tt.ZP.createElement("div",{ref:d,className:(0,xt.Z)("kxMIqtqr","scroll-item"),onMouseDown:x,onClick:B,onContextMenu:C},w&&Tt.ZP.createElement("span",null,Tt.ZP.createElement("i",{className:(0,xt.Z)("cq7jTRkg","icon icon-story-expired"),"aria-hidden":!0}),c("ExpiredStory")),Tt.ZP.createElement("div",{className:"D6Yajvjx"},y&&Tt.ZP.createElement("img",{src:y,alt:"",className:"cV_QL3N5",draggable:!1}),g&&Tt.ZP.createElement(Yr.Z,{story:e}),t&&Tt.ZP.createElement("span",{className:"protector"})),void 0!==Z&&Tt.ZP.createElement(vs.Z,{isOpen:P,transformOriginX:T,transformOriginY:N,positionX:R,positionY:k,style:A,className:(0,xt.Z)("UAfI9izT","story-context-menu"),autoClose:!0,onClose:M,onCloseAnimationEnd:E,withPortal:!0},s&&Tt.ZP.createElement(bs.Z,{icon:"pin",onClick:U},c("StoryList.SaveToProfile")),!s&&Tt.ZP.createElement(bs.Z,{icon:"unpin",onClick:L},c("Story.Context.RemoveFromProfile"))))}));var Qr=s(21273),ec=s(31876),tc=s(22275);const sc=[{type:"media",title:"SharedMediaTab2"},{type:"documents",title:"SharedFilesTab2"},{type:"links",title:"SharedLinksTab2"},{type:"audio",title:"SharedMusicTab2"}],ac=(0,Tt.X$)((0,a.c$)(((e,{chatId:t,threadId:s,isMobile:a})=>{const n=(0,b.Z1J)(e,t),i=(0,b.x67)(e,t),o=(0,b.Zwk)(e,t),{currentType:c,resultsByType:d}=(0,b.weG)(e)||{},{foundIds:l}=d&&c&&d[c]||{},u=Boolean(n?.isForum&&s&&s!==r._f),{byId:m,statusesById:h}=e.users,{byId:p}=e.chats,g=(0,I._o)(t,s,e.currentUserId),f=n&&(0,I.Bf)(n),w=n&&(0,I.eA)(n),v=!u&&!g&&(f||w&&(0,I.Nl)(n)),y=i?.members,P=i?.adminMembersById,Z=v&&n&&(n.isForbidden||i&&!i.canViewMembers),S=v&&n&&((0,I.VE)(n,"inviteUsers")||!(0,I.Mg)(n,"inviteUsers")||n.isCreator),C=v&&n&&((0,I.VE)(n,"banUsers")||n.isCreator),M=(0,b.f21)(e,t),{similarChannelIds:E}=(0,b.D2x)(e,t)||{},R=(0,b.wVz)(e);let k,T,N;(0,I.YC)(t)&&(T=t,N=(0,b.dyD)(e,T),k=N&&!N.isSelf&&!(0,I.cS)(N)&&!g);const A=N||n,B=(0,b.mZI)(e,t),x=A&&(N?.isSelf||!A.areStoriesHidden&&B?.hasPinnedStories)&&!g,U=x?(0,b.nST)(e,A.id):void 0,L=U?.pinnedIds,O=U?.byId,_=U?.archiveIds;return{theme:(0,b.Puy)(e),isChannel:w,resolvedUserId:T,messagesById:o,foundIds:l,mediaSearchType:c,hasCommonChatsTab:k,hasStoriesTab:x,hasMembersTab:v,areMembersHidden:Z,canAddMembers:S,canDeleteMembers:C,currentUserId:e.currentUserId,isRightColumnShown:(0,b.Jf5)(e,a),isRestricted:n?.isRestricted,activeDownloadIds:M?.ids,usersById:m,userStatusesById:h,chatsById:p,storyIds:L,archiveStoryIds:_,storyByIds:O,isChatProtected:n?.isProtected,nextProfileTab:(0,b.jUK)(e).nextProfileTab,forceScrollProfileTab:(0,b.jUK)(e).forceScrollProfileTab,shouldWarnAboutSvg:e.settings.byKey.shouldWarnAboutSvg,similarChannels:E,isCurrentUserPremium:R,isTopicInfo:u,isSavedDialog:g,limitSimilarChannels:(0,se.P)(e,"recommendedChannels"),...v&&y&&{members:y,adminMembersById:P},...k&&N&&{commonChatIds:N.commonChats?.ids}}}))((({chatId:e,threadId:t,profileState:s,onProfileStateChange:o,theme:d,isChannel:l,resolvedUserId:u,currentUserId:m,messagesById:h,foundIds:p,storyIds:g,archiveStoryIds:f,storyByIds:w,mediaSearchType:v,hasCommonChatsTab:b,hasStoriesTab:y,hasMembersTab:P,areMembersHidden:Z,canAddMembers:S,canDeleteMembers:C,commonChatIds:M,members:E,adminMembersById:R,usersById:k,userStatusesById:T,chatsById:N,isRightColumnShown:A,isRestricted:B,activeDownloadIds:x,isChatProtected:U,nextProfileTab:L,shouldWarnAboutSvg:O,similarChannels:_,isCurrentUserPremium:F,limitSimilarChannels:D,isTopicInfo:j,isSavedDialog:q,forceScrollProfileTab:G})=>{const{setLocalMediaSearchType:H,loadMoreMembers:V,loadCommonChats:$,openChat:z,searchMediaMessagesLocal:K,openMediaViewer:J,openAudioPlayer:W,focusMessage:Y,loadProfilePhotos:X,setNewChatMembersDialogState:Q,loadPeerPinnedStories:ee,loadStoriesArchive:te,openPremiumModal:se,fetchChannelRecommendations:ae}=(0,a.Sv)(),ne=(0,Tt.sO)(null),ie=(0,Tt.sO)(null),oe=(0,Is.Z)(),[re,ce]=(0,Tt.eJ)(),de=q?String(t):u||e,le=de===m&&!q,ue=(0,Tt.Ye)((()=>[...le&&!q?[{type:"dialogs",title:"SavedDialogsTab"}]:[],...y?[{type:"stories",title:"ProfileStories"}]:[],...y&&le?[{type:"storiesArchive",title:"ProfileStoriesArchive"}]:[],...P?[{type:"members",title:l?"ChannelSubscribers":"GroupMembers"}]:[],...sc,...j?[]:[{type:"voice",title:"SharedVoiceTab2"}],...b?[{type:"commonChats",title:"SharedGroupsTab2"}]:[],...l&&_?.length?[{type:"similarChannels",title:"SimilarChannelsTab"}]:[]]),[b,P,y,l,j,_,le,q]),me=(0,Tt.Ye)((()=>{if(!L)return 0;const e=ue.findIndex((({type:e})=>e===L));return-1===e?0:e}),[L,ue]),[he,pe]=(0,Tt.eJ)(me);(0,Tt.d4)((()=>{if(!L)return;const e=ue.findIndex((({type:e})=>e===L));-1!==e&&pe(e)}),[L,ue]),(0,Tt.d4)((()=>{l&&!_&&ae({chatId:e})}),[e,l,_]);const ge=he>ue.length-1?ue.length-1:he,fe=ue[ge].type,Ie=(0,Tt.I4)((({offsetId:t})=>{ee({peerId:e,offsetId:t})}),[e]),we=(0,Tt.I4)((({offsetId:e})=>{te({peerId:m,offsetId:e})}),[m]),[ve,be,ye,Pe]=function(e,t,s,a,n,i,o,r,c,d,l,u,m,h,p,g,f,w){const v="members"!==i&&o?o:i,b=(0,Tt.Ye)((()=>{if(r&&d&&l)return(0,I.Z0)(r.map((({userId:e})=>e)),d,l)}),[r,d,l]),y=(0,Tt.Ye)((()=>{if(c&&u)return(0,Rr.Z)(c,!0)}),[u,c]),[P,Z,S]=Gr(e,b),[C,M,E]=Hr("media",v,s,m,h,p),[R,k,T]=Hr("documents",v,s,m,h,p),[N,A,B]=Hr("links",v,s,m,h,p),[x,U,L]=Hr("audio",v,s,m,h,p),[O,_,F]=Hr("voice",v,s,m,h,p),[D,j,q]=Gr(t,y),[G,H,V]=Gr(a,g),[$,z,K]=Gr(n,f);let J,W,Y=!1;switch(v){case"members":J=P,W=Z,Y=S;break;case"commonChats":J=D,W=j,Y=q;break;case"media":J=C,W=M,Y=E;break;case"documents":J=R,W=k,Y=T;break;case"links":J=N,W=A,Y=B;break;case"audio":J=x,W=U,Y=L;break;case"voice":J=O,W=_,Y=F;break;case"stories":J=G,W=H,Y=V;break;case"storiesArchive":J=$,W=z,Y=K;break;case"similarChannels":J=w;break;case"dialogs":Y=!0}return[v,J,W,Y]}(V,$,K,Ie,we,fe,v,E,M,k,T,N,h,p,t,g,f,_),Ze=le&&"dialogs"===ve||y&&"stories"===ve||"members"===ve||!P&&"media"===ve,Se=ue.findIndex((({type:e})=>e===ve));(0,_r.Z)("members"===ve?be:void 0);const{handleScroll:Ce}=function(e,t,s,a,n=!1){(0,Js.Z)((([s])=>{if(s&&s!==t||t&&n){const s=e.current,n=s.querySelector(".TabList");s.scrollTop<n.offsetTop&&(a(jr(t)),Dr=!0,(0,Ja.ZP)(s,n,"start",void 0,void 0,void 0,300),setTimeout((()=>{Dr=!1}),350))}}),[t,a,e,n]),(0,Js.Z)((([t])=>{if(s!==c.vi.Profile||s===t)return;const a=e.current;if(!a)return;const n=a.querySelector(".TabList");!n||n.offsetTop>a.scrollTop||(Dr=!0,(0,Ja.ZP)(a,a.firstElementChild,"start",void 0,2*a.offsetHeight),setTimeout((()=>{Dr=!1}),350))}),[s,e]);const i=(0,qt.Z)((()=>{const s=e.current;if(!s)return;const n=s.querySelector(".TabList");if(!n)return;let i=c.vi.Profile;s.scrollTop>=n.offsetTop&&(i=jr(t)),a(i)}));return(0,Tt.d4)((()=>{Dr||i()}),[i,t]),{handleScroll:(0,qt.Z)((()=>{Dr||Fr(i)}))}}(ne,ve,s,o,G),{applyTransitionFix:Me,releaseTransitionFix:Ee}=function(e,t=".Transition.shared-media-transition"){return(0,Tt.d4)((()=>{function s(){const s=e.current,a=s.querySelector(t),n=s.querySelector(".TabList");if(a&&n){const e=s.offsetHeight-n.offsetHeight;(0,Bt.WM)((()=>{a.style.minHeight=`${e}px`}))}}return s(),window.addEventListener("resize",s,!1),()=>{window.removeEventListener("resize",s,!1)}}),[e,t]),{applyTransitionFix:(0,qt.Z)((()=>{(0,Bt.i$)((()=>{const t=e.current;if("hidden"===t.style.overflowY)return;const s=t.offsetWidth-t.clientWidth;(0,Bt.WM)((()=>{t.style.overflowY="hidden",t.style.paddingRight=`${s}px`}))}))})),releaseTransitionFix:(0,qt.Z)((()=>{const t=e.current;t.style.overflowY="scroll",t.style.paddingRight="0"}))}}(ne),[Re,ke]=(()=>{const[e,t]=(0,Tt.eJ)(0);return[e,(0,Tt.I4)((()=>{t((e=>e+1))}),[])]})(),{observe:Te}=(0,gn.S1)({rootRef:ne,throttleMs:500}),Ne=(0,qt.Z)((()=>{Ee(),ke()})),Ae=(0,qt.Z)((()=>{Q({newChatMembersProgress:c.WB.InProgress})}));(0,Tt.d4)((()=>{H({mediaType:fe})}),[H,fe,t]),(0,Tt.d4)((()=>{X({profileId:de})}),[de]);const Be=(0,qt.Z)((e=>{J({chatId:de,threadId:r._f,mediaId:e,origin:c.bZ.SharedMedia})})),xe=(0,qt.Z)((e=>{W({chatId:de,messageId:e})})),Ue=(0,qt.Z)((e=>{z({id:e})})),Le=(0,qt.Z)((e=>{Y({chatId:de,messageId:e})})),Oe=(0,qt.Z)((()=>{ce(void 0)}));let _e;(0,Js.Z)((([e])=>{if(void 0===e||0===he||e===P)return;const t=he+(P?1:-1);pe(Math.min(t,ue.length-1))}),[P,he,ue]),(0,Tt.d4)((()=>{if(ie.current&&i.$b)return(0,Zs.sf)(ie.current,{selectorToPreventScroll:".Profile",onSwipe:(e,t)=>t===Zs.eM.Left?(pe(Math.min(ge+1,ue.length-1)),!0):t===Zs.eM.Right&&(pe(Math.max(0,ge-1)),!0)})}),[ge,ue.length]),Ze?_e=A?0:1e3:be||(_e=n.Yan);const Fe=(0,Si.Z)([e,t,ve,ge],_e);return Tt.ZP.createElement(Qr.Z,{ref:ne,className:"Profile custom-scroll",itemSelector:`.shared-media-transition > .Transition_slide-active.${ve}-list > .scroll-item`,items:Fe?be:void 0,cacheBuster:Re,sensitiveArea:n.qUX,preloadBackwards:Fe?"members"===ve?n.Vk:n.ENB:0,noScrollRestoreOnTop:!0,noFastList:!0,onLoadMore:ye,onScroll:Ce},!Pe&&!le&&function(e,t,s){return Tt.ZP.createElement("div",{className:"profile-info"},Tt.ZP.createElement(Kr.Z,{userId:e,canPlayVideo:t}),Tt.ZP.createElement(Vr.Z,{chatOrUserId:e,isSavedDialog:s}))}(de,A&&Fe,q),!B&&Tt.ZP.createElement("div",{className:"shared-media"},Tt.ZP.createElement(hs.ZP,{ref:ie,name:oe.isRtl?"slideOptimizedRtl":"slideOptimized",activeKey:Se,renderCount:ue.length,shouldRestoreHeight:!0,className:"shared-media-transition",onStart:Me,onStop:Ne},function(){if("dialogs"===ve)return Tt.ZP.createElement(Es.Z,{className:"saved-dialogs",folderType:"saved",isActive:!0});if(!be||!Fe||!h){const e=Ze&&!Fe,t=Boolean("members"===ve&&Z);return Tt.ZP.createElement("div",{className:"content empty-list"},!e&&!t&&Tt.ZP.createElement(js.Z,null),t&&Tt.ZP.createElement(zr.Z,{text:"You have no access to group members list."}))}if(!be.length){let e;switch(ve){case"members":e=Z?"You have no access to group members list.":"No members found";break;case"commonChats":e=oe("NoGroupsInCommon");break;case"documents":e=oe("lng_media_file_empty");break;case"links":e=oe("lng_media_link_empty");break;case"audio":e=oe("lng_media_song_empty");break;case"voice":e=oe("lng_media_audio_empty");break;case"stories":e=oe("StoryList.SavedEmptyState.Title");break;case"storiesArchive":e=oe("StoryList.ArchivedEmptyState.Title");break;default:e=oe("SharedMedia.EmptyTitle")}return Tt.ZP.createElement("div",{className:"content empty-list"},Tt.ZP.createElement(zr.Z,{text:e}))}return Tt.ZP.createElement("div",{className:`content ${ve}-list`,dir:oe.isRtl&&"media"===ve?"rtl":void 0,teactFastList:!0},"media"===ve?be.map((e=>h[e]&&Tt.ZP.createElement($r.Z,{key:e,message:h[e],isProtected:U||h[e].isProtected,observeIntersection:Te,onClick:Be}))):"stories"===ve||"storiesArchive"===ve?be.map((e=>w?.[e]&&Tt.ZP.createElement(Xr,{key:`${ve}_${e}`,story:w[e],isProtected:U,isArchive:"storiesArchive"===ve}))):"documents"===ve?be.map((e=>h[e]&&Tt.ZP.createElement(Xn.Z,{key:e,message:h[e],withDate:!0,smaller:!0,className:"scroll-item",isDownloading:x?.includes(e),observeIntersection:Te,onDateClick:Le,shouldWarnAboutSvg:O}))):"links"===ve?be.map((e=>h[e]&&Tt.ZP.createElement(Jr.Z,{key:e,message:h[e],isProtected:U||h[e].isProtected,observeIntersection:Te,onMessageClick:Le}))):"audio"===ve?be.map((e=>h[e]&&Tt.ZP.createElement(Wn.ZP,{key:e,theme:d,message:h[e],origin:c.Cr.SharedMedia,date:h[e].date,className:"scroll-item",onPlay:xe,onDateClick:Le,canDownload:!U&&!h[e].isProtected,isDownloading:x?.includes(e)}))):"voice"===ve?be.map((e=>h[e]&&Tt.ZP.createElement(Wn.ZP,{key:e,theme:d,message:h[e],senderTitle:(0,Or.F)(oe,h[e],N,k),origin:c.Cr.SharedMedia,date:h[e].date,className:"scroll-item",onPlay:xe,onDateClick:Le,canDownload:!U&&!h[e].isProtected,isDownloading:x?.includes(e)}))):"members"===ve?be.map(((e,t)=>{return Tt.ZP.createElement(ec.Z,{key:e,teactOrderKey:t,className:"chat-item-clickable contact-list-item scroll-item small-icon",onClick:()=>Ue(e),contextActions:(s=e,s!==m&&C?[{title:oe("lng_context_remove_from_group"),icon:"stop",handler:()=>{ce(s)}}]:void 0)},Tt.ZP.createElement(Yo.Z,{userId:e,adminMember:R?.[e],forceShowSelf:!0,withStory:!0}));var s})):"commonChats"===ve?be.map(((e,t)=>Tt.ZP.createElement(ec.Z,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item small-icon",onClick:()=>z({id:e})},Tt.ZP.createElement(Wo.Z,{chatId:e})))):"similarChannels"===ve?Tt.ZP.createElement("div",{key:ve},be.map(((e,t)=>Tt.ZP.createElement(ec.Z,{key:e,teactOrderKey:t,className:(0,xt.Z)("chat-item-clickable search-result",!F&&t===_.length-1&&"blured"),onClick:()=>z({id:e})},Tt.ZP.createElement(Wo.Z,{avatarSize:"large",chatId:e,withFullInfo:!0})))),!F&&Tt.ZP.createElement(Tt.ZP.Fragment,null,Tt.ZP.createElement(ws.Z,{className:"show-more-channels",size:"smaller",onClick:()=>se()},oe("UnlockSimilar"),Tt.ZP.createElement("i",{className:"icon icon-unlock-badge"})),Tt.ZP.createElement("div",{className:"more-similar"},(0,ga.Z)(oe("MoreSimilarText",D),["simple_markdown"])))):void 0)}()),Tt.ZP.createElement(Ms.Z,{big:!0,activeTab:ge,tabs:ue,onSwitchTab:pe})),S&&Tt.ZP.createElement(Tr.Z,{isShown:"members"===ve,onClick:Ae,ariaLabel:oe("lng_channel_add_users")},Tt.ZP.createElement("i",{className:"icon icon-add-user-filled"})),C&&Tt.ZP.createElement(tc.Z,{isOpen:Boolean(re),userId:re,onClose:Oe}))}))),nc=450+n.fK3,ic=(0,g.Ds)((e=>e()),200,!1);var oc=function(e){return e[e.Profile=0]="Profile",e[e.MemberList=1]="MemberList",e[e.SharedMedia=2]="SharedMedia",e[e.StoryList=3]="StoryList",e[e.Search=4]="Search",e[e.Statistics=5]="Statistics",e[e.MessageStatistics=6]="MessageStatistics",e[e.StoryStatistics=7]="StoryStatistics",e[e.BoostStatistics=8]="BoostStatistics",e[e.Management=9]="Management",e[e.ManageInitial=10]="ManageInitial",e[e.ManageChannelSubscribers=11]="ManageChannelSubscribers",e[e.ManageChatAdministrators=12]="ManageChatAdministrators",e[e.ManageChatPrivacyType=13]="ManageChatPrivacyType",e[e.ManageDiscussion=14]="ManageDiscussion",e[e.ManageGroupPermissions=15]="ManageGroupPermissions",e[e.ManageGroupRemovedUsers=16]="ManageGroupRemovedUsers",e[e.ManageChannelRemovedUsers=17]="ManageChannelRemovedUsers",e[e.ManageGroupUserPermissionsCreate=18]="ManageGroupUserPermissionsCreate",e[e.ManageGroupUserPermissions=19]="ManageGroupUserPermissions",e[e.ManageGroupRecentActions=20]="ManageGroupRecentActions",e[e.ManageGroupAdminRights=21]="ManageGroupAdminRights",e[e.ManageGroupNewAdminRights=22]="ManageGroupNewAdminRights",e[e.ManageGroupMembers=23]="ManageGroupMembers",e[e.ManageGroupAddAdmins=24]="ManageGroupAddAdmins",e[e.StickerSearch=25]="StickerSearch",e[e.GifSearch=26]="GifSearch",e[e.PollResults=27]="PollResults",e[e.AddingMembers=28]="AddingMembers",e[e.ManageInvites=29]="ManageInvites",e[e.ManageEditInvite=30]="ManageEditInvite",e[e.ManageReactions=31]="ManageReactions",e[e.ManageInviteInfo=32]="ManageInviteInfo",e[e.ManageJoinRequests=33]="ManageJoinRequests",e[e.CreateTopic=34]="CreateTopic",e[e.EditTopic=35]="EditTopic",e[e.SavedDialogs=36]="SavedDialogs",e}(oc||{});const rc=(0,a.c$)(((e,{chatId:t,isProfile:s,isManagement:a,threadId:n})=>{const i=(0,b.jUK)(e),{query:o}=(0,b.n5x)(e)||{},{query:c}=(0,b.y5E)(e)||{},{query:d}=(0,b.yNS)(e)||{},l=t?(0,b.Z1J)(e,t):void 0,u=s&&t&&(0,I.YC)(t)?(0,b.dyD)(e,t):void 0,m=l&&(0,I.eA)(l),h=l?.isForum&&Boolean(n&&n!==r._f),p=h?l.topics?.[n]:void 0,g=h&&p&&(0,I.GU)(l,p),f=u&&(0,I.cS)(u),w=t?(0,b.FM1)(e,t):void 0,v=f&&u?.canEditBot,y=u&&(0,I.kw)(u),P=Boolean(!a&&s&&t&&(0,b.Yo)(e,t)),Z=Boolean(t&&i.management.byChatId[t]?.editingInvite),S=!h&&t?(0,b.x67)(e,t)?.canViewStatistics:void 0,C=t?i.management.byChatId[t]?.inviteInfo?.invite:void 0;return{canManage:P,canAddContact:y,canViewStatistics:S,isChannel:m,isBot:f,isInsideTopic:h,canEditTopic:g,userId:u?.id,isSelf:u?.isSelf,messageSearchQuery:o,stickerSearchQuery:c,gifSearchQuery:d,isEditingInvite:Z,currentInviteInfo:C,isSavedMessages:w,shouldSkipHistoryAnimations:i.shouldSkipHistoryAnimations,canEditBot:v}}))((({chatId:e,threadId:t,isColumnOpen:s,isProfile:i,isSearch:o,isManagement:r,isStatistics:d,isMessageStatistics:l,isStoryStatistics:u,isBoostStatistics:m,isStickerSearch:h,isGifSearch:p,isPollResults:g,isCreatingTopic:f,isEditingTopic:I,isAddingChatMembers:w,profileState:v,managementScreen:b,canAddContact:y,userId:P,isSelf:Z,canManage:S,isChannel:C,messageSearchQuery:M,stickerSearchQuery:E,gifSearchQuery:R,isEditingInvite:k,canViewStatistics:T,currentInviteInfo:N,shouldSkipHistoryAnimations:A,isBot:x,isInsideTopic:U,canEditTopic:L,isSavedMessages:O,onClose:_,onScreenSelect:F,canEditBot:D})=>{const{setLocalTextSearchQuery:j,setStickerSearchQuery:q,setGifSearchQuery:G,searchTextMessagesLocal:H,toggleManagement:V,openHistoryCalendar:$,openAddContactDialog:z,toggleStatistics:K,setEditingExportedInvite:J,deleteExportedChatInvite:W,openEditTopicPanel:Y}=(0,a.Sv)(),[X,Q,ee]=(0,xs.Z)(),{isMobile:te}=(0,B.ZP)(),se=(0,os.mE)(),ae=(0,qt.Z)((()=>{J({chatId:e,invite:N}),F(c.u1.EditInvite)})),ne=(0,qt.Z)((()=>{W({chatId:e,link:N.link}),F(c.u1.Invites),ee()})),ie=(0,qt.Z)((e=>{j({query:e}),e.length&&ic(H)})),oe=(0,qt.Z)((e=>{q({query:e})})),ce=(0,qt.Z)((e=>{G({query:e})})),de=(0,qt.Z)((()=>{z({userId:P})})),le=(0,qt.Z)((()=>{e&&t&&Y({chatId:e,topicId:Number(t)})})),ue=(0,qt.Z)((()=>{V()})),me=(0,qt.Z)((()=>{K()})),he=(0,qt.Z)((()=>{_(!O)})),[pe,ge]=(0,Tt.eJ)(!s);(0,Tt.d4)((()=>{setTimeout((()=>{ge(!s)}),nc)}),[s]);const fe=(0,Is.Z)(),Ie=i?v===c.vi.Profile?oc.Profile:v===c.vi.SharedMedia?oc.SharedMedia:v===c.vi.MemberList?oc.MemberList:v===c.vi.StoryList?oc.StoryList:v===c.vi.SavedDialogs?oc.SavedDialogs:-1:o?oc.Search:g?oc.PollResults:h?oc.StickerSearch:p?oc.GifSearch:w?oc.AddingMembers:r?b===c.u1.Initial?oc.ManageInitial:b===c.u1.ChatPrivacyType?oc.ManageChatPrivacyType:b===c.u1.Discussion?oc.ManageDiscussion:b===c.u1.ChannelSubscribers?oc.ManageChannelSubscribers:b===c.u1.GroupPermissions?oc.ManageGroupPermissions:b===c.u1.ChatAdministrators?oc.ManageChatAdministrators:b===c.u1.GroupRemovedUsers?oc.ManageGroupRemovedUsers:b===c.u1.ChannelRemovedUsers?oc.ManageChannelRemovedUsers:b===c.u1.GroupUserPermissionsCreate?oc.ManageGroupUserPermissionsCreate:b===c.u1.GroupUserPermissions?oc.ManageGroupUserPermissions:b===c.u1.GroupRecentActions?oc.ManageGroupRecentActions:b===c.u1.ChatAdminRights?oc.ManageGroupAdminRights:b===c.u1.ChatNewAdminRights?oc.ManageGroupNewAdminRights:b===c.u1.GroupMembers?oc.ManageGroupMembers:b===c.u1.Invites?oc.ManageInvites:b===c.u1.EditInvite?oc.ManageEditInvite:b===c.u1.GroupAddAdmins?oc.ManageGroupAddAdmins:b===c.u1.Reactions?oc.ManageReactions:b===c.u1.InviteInfo?oc.ManageInviteInfo:b===c.u1.JoinRequests?oc.ManageJoinRequests:void 0:d?oc.Statistics:l?oc.MessageStatistics:u?oc.StoryStatistics:m?oc.BoostStatistics:f?oc.CreateTopic:I?oc.EditTopic:void 0,we=(0,zo.Z)(Ie,!0)??-1,ve=te||!O&&(Ie===oc.SharedMedia||Ie===oc.MemberList||Ie===oc.StoryList||Ie===oc.AddingMembers||Ie===oc.MessageStatistics||Ie===oc.StoryStatistics||r),be=(0,xt.Z)("animated-close-icon",ve&&"state-back",(pe||A)&&"no-transition"),ye=(0,Tt.sO)(null);return(0,Bs.Z)(ye),Tt.ZP.createElement("div",{className:"RightHeader",ref:ye},Tt.ZP.createElement(ws.Z,{className:"close-button",round:!0,color:"translucent",size:"smaller",onClick:he,ariaLabel:fe(ve?"Common.Back":"Common.Close")},Tt.ZP.createElement("div",{className:be})),Tt.ZP.createElement(hs.ZP,{name:pe||A?"none":"slideFade",activeKey:we},function(){if(-1!==we)switch(we){case oc.PollResults:return Tt.ZP.createElement("h3",{className:"title"},fe("PollResults"));case oc.Search:return Tt.ZP.createElement(Tt.ZP.Fragment,null,Tt.ZP.createElement(Fs.Z,{parentContainerClassName:"RightSearch",value:M,onChange:ie}),Tt.ZP.createElement(ws.Z,{round:!0,size:"smaller",color:"translucent",onClick:()=>$({selectedAt:(0,re._F)(Date.now())}),ariaLabel:"Search messages by date"},Tt.ZP.createElement("i",{className:"icon icon-calendar"})));case oc.AddingMembers:return Tt.ZP.createElement("h3",{className:"title"},fe(C?"ChannelAddSubscribers":"GroupAddMembers"));case oc.ManageInitial:return Tt.ZP.createElement("h3",{className:"title"},fe("Edit"));case oc.ManageChatPrivacyType:return Tt.ZP.createElement("h3",{className:"title"},fe(C?"ChannelTypeHeader":"GroupTypeHeader"));case oc.ManageDiscussion:return Tt.ZP.createElement("h3",{className:"title"},fe("Discussion"));case oc.ManageChatAdministrators:return Tt.ZP.createElement("h3",{className:"title"},fe("ChannelAdministrators"));case oc.ManageGroupRecentActions:return Tt.ZP.createElement("h3",{className:"title"},fe("Group.Info.AdminLog"));case oc.ManageGroupAdminRights:return Tt.ZP.createElement("h3",{className:"title"},fe("EditAdminRights"));case oc.ManageGroupNewAdminRights:return Tt.ZP.createElement("h3",{className:"title"},fe("SetAsAdmin"));case oc.ManageGroupPermissions:return Tt.ZP.createElement("h3",{className:"title"},fe("ChannelPermissions"));case oc.ManageGroupRemovedUsers:return Tt.ZP.createElement("h3",{className:"title"},fe("BlockedUsers"));case oc.ManageChannelRemovedUsers:return Tt.ZP.createElement("h3",{className:"title"},fe("ChannelBlockedUsers"));case oc.ManageGroupUserPermissionsCreate:return Tt.ZP.createElement("h3",{className:"title"},fe("ChannelAddException"));case oc.ManageGroupUserPermissions:return Tt.ZP.createElement("h3",{className:"title"},fe("UserRestrictions"));case oc.ManageInvites:return Tt.ZP.createElement("h3",{className:"title"},fe("lng_group_invite_title"));case oc.ManageEditInvite:return Tt.ZP.createElement("h3",{className:"title"},fe(k?"EditLink":"NewLink"));case oc.ManageInviteInfo:return Tt.ZP.createElement(Tt.ZP.Fragment,null,Tt.ZP.createElement("h3",{className:"title"},fe("InviteLink")),Tt.ZP.createElement("section",{className:"tools"},N&&!N.isRevoked&&Tt.ZP.createElement(ws.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:fe("Edit"),onClick:ae},Tt.ZP.createElement("i",{className:"icon icon-edit"})),N&&N.isRevoked&&Tt.ZP.createElement(Tt.ZP.Fragment,null,Tt.ZP.createElement(ws.Z,{round:!0,color:"danger",size:"smaller",ariaLabel:fe("Delete"),onClick:Q},Tt.ZP.createElement("i",{className:"icon icon-delete"})),Tt.ZP.createElement(_i.Z,{isOpen:X,onClose:ee,title:fe("DeleteLink"),text:fe("DeleteLinkHelp"),confirmIsDestructive:!0,confirmLabel:fe("Delete"),confirmHandler:ne}))));case oc.ManageJoinRequests:return Tt.ZP.createElement("h3",{className:"title"},fe(C?"SubscribeRequests":"MemberRequests"));case oc.ManageGroupAddAdmins:return Tt.ZP.createElement("h3",{className:"title"},fe("Channel.Management.AddModerator"));case oc.StickerSearch:return Tt.ZP.createElement(Fs.Z,{value:E,placeholder:fe("SearchStickersHint"),autoFocusSearch:!0,onChange:oe});case oc.GifSearch:return Tt.ZP.createElement(Fs.Z,{value:R,placeholder:fe("SearchGifsTitle"),autoFocusSearch:!0,onChange:ce});case oc.Statistics:return Tt.ZP.createElement("h3",{className:"title"},fe(C?"ChannelStats.Title":"GroupStats.Title"));case oc.MessageStatistics:return Tt.ZP.createElement("h3",{className:"title"},fe("Stats.MessageTitle"));case oc.StoryStatistics:return Tt.ZP.createElement("h3",{className:"title"},fe("Stats.StoryTitle"));case oc.BoostStatistics:return Tt.ZP.createElement("h3",{className:"title"},fe("Boosts"));case oc.SharedMedia:return Tt.ZP.createElement("h3",{className:"title"},fe("SharedMedia"));case oc.ManageChannelSubscribers:return Tt.ZP.createElement("h3",{className:"title"},fe("ChannelSubscribers"));case oc.MemberList:case oc.ManageGroupMembers:return Tt.ZP.createElement("h3",{className:"title"},fe("GroupMembers"));case oc.StoryList:return Tt.ZP.createElement("h3",{className:"title"},fe(Z?"Settings.MyStories":"PeerInfo.PaneStories"));case oc.SavedDialogs:return Tt.ZP.createElement("div",{className:"header"},Tt.ZP.createElement("h3",{className:"title"},fe("SavedMessagesTab")),Tt.ZP.createElement("div",{className:"subtitle"},fe("Chats",se[n.aV7])));case oc.ManageReactions:return Tt.ZP.createElement("h3",{className:"title"},fe("Reactions"));case oc.CreateTopic:return Tt.ZP.createElement("h3",{className:"title"},fe("NewTopic"));case oc.EditTopic:return Tt.ZP.createElement("h3",{className:"title"},fe("EditTopic"));default:return Tt.ZP.createElement(Tt.ZP.Fragment,null,Tt.ZP.createElement("h3",{className:"title"},fe(O?"SavedMessages":U?"AccDescrTopic":C?"Channel.TitleInfo":P?x?"lng_info_bot_title":"lng_info_user_title":"GroupInfo.Title")),Tt.ZP.createElement("section",{className:"tools"},y&&Tt.ZP.createElement(ws.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:fe("AddContact"),onClick:de},Tt.ZP.createElement("i",{className:"icon icon-add-user","aria-hidden":!0})),S&&!U&&Tt.ZP.createElement(ws.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:fe("Edit"),onClick:ue},Tt.ZP.createElement("i",{className:"icon icon-edit"})),D&&Tt.ZP.createElement(ws.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:fe("Edit"),onClick:ue},Tt.ZP.createElement(si.Z,{name:"edit"})),L&&Tt.ZP.createElement(ws.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:fe("EditTopic"),onClick:le},Tt.ZP.createElement("i",{className:"icon icon-edit"})),T&&Tt.ZP.createElement(ws.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:fe("Statistics"),onClick:me},Tt.ZP.createElement("i",{className:"icon icon-stats"}))))}}()))})),cc=e=>{const t=(0,Yt.Z)(Ot.gl.Extra,"RightSearch");return t?Tt.ZP.createElement(t,e):Tt.ZP.createElement(ps.Z,null)};var dc=s(4830),lc=s(12007),uc=s(66),mc=s(16289);const hc={root:"gk6pIryJ",noResults:"WP4wRUbm","section-header":"LWcgK3OX",sectionHeader:"LWcgK3OX",section:"C8KF95yU",user:"oMy5KOFr",stats:"GOzrl0zF",down:"QuLtxDUV",loadMoreSpinner:"ln5zB7KK"},pc=(0,Tt.X$)((0,a.c$)((e=>({boostStatistics:(0,b.jUK)(e).boostStatistics})))((({boostStatistics:e})=>{const{openChat:t,loadMoreBoosters:s,closeBoostStatistics:n}=(0,a.Sv)(),i=(0,Is.Z)(),o=e?.boostStatus,r=o?e.boostStatus:void 0,{currentLevel:c,hasNextLevel:d,boosts:l,levelProgress:u,remainingBoosts:m}=(0,Tt.Ye)((()=>r?(0,dc.k)(r):{currentLevel:0,hasNextLevel:!1,boosts:0,levelProgress:0,remainingBoosts:0}),[r]),h=(0,Tt.Ye)((()=>{if(r)return{level:c,boosts:l,premiumSubscribers:r.premiumSubscribers,remainingBoosts:m}}),[r,l,c,m]),p=(0,Tt.Ye)((()=>{if(!e?.count)return;const t=e.boosterIds?.length||0;return e.count-t}),[e]),g=(0,qt.Z)((e=>{t({id:e}),n()})),f=(0,qt.Z)((()=>{s()}));return Tt.ZP.createElement("div",{className:(0,xt.Z)(hc.root,"custom-scroll")},!o&&Tt.ZP.createElement(ps.Z,null),o&&h&&Tt.ZP.createElement(Tt.ZP.Fragment,null,Tt.ZP.createElement("div",{className:hc.section},Tt.ZP.createElement(uc.Z,{leftText:i("BoostsLevel",c),rightText:d?i("BoostsLevel",c+1):void 0,progress:u,floatingBadgeText:l.toString(),floatingBadgeIcon:"boost"}),Tt.ZP.createElement(mc.Z,{className:hc.stats,statistics:h,type:"boost"})),Tt.ZP.createElement("div",{className:hc.section},Tt.ZP.createElement("h4",{className:hc.sectionHeader,dir:i.isRtl?"rtl":void 0},i("Boosters")),!e.boosterIds?.length&&Tt.ZP.createElement("div",{className:hc.noResults},i("NoBoostersHint")),e.boosterIds?.map((t=>Tt.ZP.createElement(ec.Z,{key:t,className:"chat-item-clickable",onClick:()=>g(t)},Tt.ZP.createElement(Yo.Z,{className:hc.user,forceShowSelf:!0,userId:t,status:i("BoostExpireOn",(0,re.$M)(i,1e3*e.boosters[t]))})))),Boolean(p)&&Tt.ZP.createElement(ec.Z,{key:"load-more",className:hc.showMore,disabled:e?.isLoadingBoosters,onClick:f},e?.isLoadingBoosters?Tt.ZP.createElement(js.Z,{className:hc.loadMoreSpinner}):Tt.ZP.createElement(si.Z,{name:"down",className:hc.down}),i("ShowVotes",p))),Tt.ZP.createElement(lc.Z,{className:hc.section,link:r.boostUrl,withShare:!0,title:i("LinkForBoosting")})))}))),gc=e=>{const t=(0,Yt.Z)(Ot.gl.Extra,"MessageStatistics");return t?Tt.ZP.createElement(t,e):Tt.ZP.createElement(ps.Z,null)},fc=e=>{const t=(0,Yt.Z)(Ot.gl.Extra,"Statistics");return t?Tt.ZP.createElement(t,e):Tt.ZP.createElement(ps.Z,null)},Ic=e=>{const t=(0,Yt.Z)(Ot.gl.Extra,"StoryStatistics");return t?Tt.ZP.createElement(t,e):Tt.ZP.createElement(ps.Z,null)},wc=()=>{const e=(0,Yt.Z)(Ot.gl.Extra,"StickerSearch");return e?Tt.ZP.createElement(e,null):Tt.ZP.createElement(ps.Z,null)},vc=450+n.fK3,bc=Object.keys(c.qt).length/2,yc=Object.keys(c.u1).length/2;function Pc(){const e=document.querySelector(".RightHeader .SearchInput input");e&&e.blur()}const Zc=(0,Tt.X$)((0,a.c$)(((e,{isMobile:t})=>{const{chatId:s,threadId:a}=(0,b.Btg)(e)||{},n=(0,b.g4C)(e),{management:i,shouldSkipHistoryAnimations:o,nextProfileTab:r}=(0,b.jUK)(e),c=s?i.byChatId[s]?.nextScreen:void 0,d=s?(0,b.FM1)(e,s):void 0,l=s?(0,I._o)(s,a,e.currentUserId):void 0;return{contentKey:(0,b.WqZ)(e,t),chatId:s,threadId:a,isChatSelected:Boolean(s&&n),shouldSkipHistoryAnimations:o,nextManagementScreen:c,nextProfileTab:r,isSavedMessages:d,isSavedDialog:l}}))((({contentKey:e,chatId:t,threadId:s,isMobile:i,isChatSelected:o,shouldSkipHistoryAnimations:r,nextManagementScreen:d,nextProfileTab:l,isSavedMessages:u,isSavedDialog:m})=>{const{toggleChatInfo:h,toggleManagement:p,closeLocalTextSearch:g,setStickerSearchQuery:f,setGifSearchQuery:I,closePollResults:w,addChatMembers:v,setNewChatMembersDialogState:b,setEditingExportedInvite:y,toggleStatistics:P,toggleMessageStatistics:Z,toggleStoryStatistics:S,setOpenedInviteInfo:C,requestNextManagementScreen:M,resetNextProfileTab:E,closeCreateTopicPanel:R,closeEditTopicPanel:k,closeBoostStatistics:T}=(0,a.Sv)(),{width:N}=(0,Oa.Z)(),[A,B]=(0,Tt.eJ)(u&&!m?c.vi.SavedDialogs:c.vi.Profile),[x,U]=(0,Tt.eJ)(c.u1.Initial),[L,O]=(0,Tt.eJ)(),[_,F]=(0,Tt.eJ)(),D=A!==c.vi.Profile,j=void 0!==e,q=e===c.qt.ChatInfo,G=e===c.qt.Search,H=e===c.qt.Management,V=e===c.qt.Statistics,$=e===c.qt.MessageStatistics,z=e===c.qt.StoryStatistics,K=e===c.qt.BoostStatistics,J=e===c.qt.StickerSearch,W=e===c.qt.GifSearch,Y=e===c.qt.PollResults,X=e===c.qt.AddingMembers,Q=e===c.qt.CreateTopic,ee=e===c.qt.EditTopic,te=N<=n._mX,[se,ae]=(0,Tt.eJ)(!j),ne=(0,zo.Z)(e,!0,!o)??-1,ie=(0,qt.Z)(((s=!0)=>{switch(e){case c.qt.AddingMembers:b({newChatMembersProgress:c.WB.Closed});break;case c.qt.ChatInfo:if(D&&s&&!u){B(c.vi.Profile);break}h({force:!1},{forceSyncOnIOs:!0});break;case c.qt.Management:switch(x){case c.u1.Initial:p();break;case c.u1.ChatPrivacyType:case c.u1.Discussion:case c.u1.GroupPermissions:case c.u1.GroupType:case c.u1.ChatAdministrators:case c.u1.ChannelSubscribers:case c.u1.GroupMembers:case c.u1.Invites:case c.u1.Reactions:case c.u1.JoinRequests:case c.u1.ChannelRemovedUsers:U(c.u1.Initial);break;case c.u1.GroupUserPermissionsCreate:case c.u1.GroupRemovedUsers:case c.u1.GroupUserPermissions:U(c.u1.GroupPermissions),O(void 0),F(void 0);break;case c.u1.ChatAdminRights:case c.u1.ChatNewAdminRights:case c.u1.GroupAddAdmins:case c.u1.GroupRecentActions:U(c.u1.ChatAdministrators);break;case c.u1.EditInvite:case c.u1.InviteInfo:U(c.u1.Invites),C({chatId:t,invite:void 0}),y({chatId:t,invite:void 0})}break;case c.qt.MessageStatistics:Z();break;case c.qt.StoryStatistics:S();break;case c.qt.Statistics:P();break;case c.qt.BoostStatistics:T();break;case c.qt.Search:Pc(),g();break;case c.qt.StickerSearch:Pc(),f({query:void 0});break;case c.qt.GifSearch:Pc(),I({query:void 0});break;case c.qt.PollResults:w();break;case c.qt.CreateTopic:R();break;case c.qt.EditTopic:k()}})),oe=(0,qt.Z)(((e,t)=>{O(e),F(t)})),re=(0,qt.Z)((e=>{v({chatId:t,memberIds:e})}));function ce(e){if(-1!==ne)switch(ne){case c.qt.AddingMembers:return Tt.ZP.createElement(Nr,{key:`add_chat_members_${t}`,chatId:t,isActive:j&&e,onNextStep:re,onClose:ie});case c.qt.ChatInfo:return Tt.ZP.createElement(ac,{key:`profile_${t}_${s}`,chatId:t,threadId:s,profileState:A,isMobile:i,onProfileStateChange:B});case c.qt.Search:return Tt.ZP.createElement(cc,{key:`right_search_${t}`,chatId:t,threadId:s,onClose:ie,isActive:j&&e});case c.qt.Management:return Tt.ZP.createElement(Ur,{key:`management_${t}_${x}`,chatId:t,currentScreen:x,isPromotedByCurrentUser:_,selectedChatMemberId:L,isActive:j&&e,onScreenSelect:U,onChatMemberSelect:oe,onClose:ie});case c.qt.Statistics:return Tt.ZP.createElement(fc,{chatId:t});case c.qt.BoostStatistics:return Tt.ZP.createElement(pc,null);case c.qt.MessageStatistics:return Tt.ZP.createElement(gc,{chatId:t,isActive:j&&e});case c.qt.StoryStatistics:return Tt.ZP.createElement(Ic,{chatId:t,isActive:j&&e});case c.qt.StickerSearch:return Tt.ZP.createElement(wc,{onClose:ie,isActive:j&&e});case c.qt.GifSearch:return Tt.ZP.createElement(xr,{onClose:ie,isActive:j&&e});case c.qt.PollResults:return Tt.ZP.createElement(Lr,{onClose:ie,isActive:j&&e});case c.qt.CreateTopic:return Tt.ZP.createElement(Ar,{onClose:ie,isActive:j&&e});case c.qt.EditTopic:return Tt.ZP.createElement(Br,{onClose:ie,isActive:j&&e})}}return(0,Tt.d4)((()=>j&&t?(0,cs.Z)(ie):void 0),[j,ie,t]),(0,Tt.d4)((()=>{setTimeout((()=>{ae(!j)}),vc)}),[j]),(0,Tt.d4)((()=>{d&&(U(d),M(void 0))}),[d]),(0,Tt.d4)((()=>{l&&E()}),[l]),(0,Tt.d4)((()=>{j&&te&&ie()}),[te]),(0,an.Z)((([e,a])=>{e===t&&a===s||(B(u&&!m?c.vi.SavedDialogs:c.vi.Profile),U(c.u1.Initial))}),[t,s,m,u]),(0,Ss.Z)({isActive:o&&(e===c.qt.ChatInfo||e===c.qt.Management||e===c.qt.AddingMembers||e===c.qt.CreateTopic||e===c.qt.EditTopic),onBack:()=>ie(!1)}),Tt.ZP.createElement("div",{id:"RightColumn-wrapper",className:o?void 0:"is-hidden"},te&&Tt.ZP.createElement("div",{className:"overlay-backdrop",onClick:ie}),Tt.ZP.createElement("div",{id:"RightColumn"},Tt.ZP.createElement(rc,{chatId:t,threadId:s,isColumnOpen:j,isProfile:q,isSearch:G,isManagement:H,isStatistics:V,isBoostStatistics:K,isMessageStatistics:$,isStoryStatistics:z,isStickerSearch:J,isGifSearch:W,isPollResults:Y,isCreatingTopic:Q,isEditingTopic:ee,isAddingChatMembers:X,profileState:A,managementScreen:x,onClose:ie,onScreenSelect:U}),Tt.ZP.createElement(hs.ZP,{name:se||r?"none":"zoomFade",renderCount:bc+yc,activeKey:H?bc+x:ne,shouldCleanup:!0,cleanupExceptionKey:ne===c.qt.MessageStatistics||ne===c.qt.StoryStatistics?c.qt.Statistics:void 0},ce)))}))),Sc=(0,Tt.X$)((({isOpen:e})=>{const t=(0,Yt.Z)(Ot.gl.Extra,"StoryViewer",!e);return t?Tt.ZP.createElement(t,null):void 0})),Cc=e=>{const{requestedAttachBotInChat:t}=e,s=(0,Yt.Z)(Ot.gl.Extra,"AttachBotRecipientPicker",!t);return s?Tt.ZP.createElement(s,e):void 0},Mc=e=>{const{bot:t}=e,s=(0,Yt.Z)(Ot.gl.Extra,"BotTrustModal",!t);return s?Tt.ZP.createElement(s,e):void 0},Ec={root:"e0JMk_Kh"},Rc=["#E8BC2C","#D0049E","#02CBFE","#5723FD","#FE8C27","#6CB859"],kc=(0,Tt.X$)((0,a.c$)((e=>(0,m.ei)((0,b.jUK)(e),["confetti"])))((({confetti:e})=>{const t=(0,Tt.sO)(null),s=(0,Tt.sO)([]),a=(0,Tt.sO)(!1),n=(0,Oa.Z)(),i=(0,Dt.Z)(),{isMobile:o}=(0,B.ZP)(),r=o?50:100,{lastConfettiTime:c,top:d,width:l,left:u,height:m}=e||{},h=(0,Tt.I4)(((e,t,a=r)=>{for(let n=0;n<a;n++){const a=n%2,i={x:e*(a?-.1:1.1),y:.75*t},o=Math.random()*e*1.5,r={x:a?o:-1*o,y:-t/2-Math.random()*t},c=Rc[Math.floor(Math.random()*Rc.length)],d=10;s.current.push({pos:i,size:d,color:c,velocity:r,flicker:d,flickerFrequency:.2*Math.random(),rotation:0,lastDrawnAt:Date.now(),frameCount:0})}}),[r]),p=(0,Tt.I4)((()=>{if(!t.current||!a.current)return;const e=t.current,n=e.getContext("2d");if(!n)return;const{width:i,height:o}=e;n.clearRect(0,0,i,o);const r=[];s.current.forEach(((e,t)=>{const{pos:a,velocity:i,size:c,color:d,flicker:l,flickerFrequency:u,rotation:m,lastDrawnAt:h,frameCount:p}=e,g=(Date.now()-h)/1e3,f={x:a.x+i.x*g,y:a.y+i.y*g},I={x:.98*i.x,y:i.y+=1e3*g},w=c*Math.abs(Math.sin(p*u)),v=5*p*u*(Math.PI/180),b=p+1,y=Date.now();if(f.y>o+e.size)return void r.push(e);const P={...e,pos:f,velocity:I,flicker:w,rotation:v,lastDrawnAt:y,frameCount:b};s.current[t]=P,n.fillStyle=d,n.beginPath(),n.ellipse(a.x,a.y,c,l,m,0,2*Math.PI),n.fill()})),s.current=s.current.filter((e=>!r.includes(e))),s.current.length?(0,Bt.i$)(p):a.current=!1}),[]);if((0,zt.Z)((([e])=>{let t;return e!==c&&(h(l||n.width,m||n.height),t=setTimeout(i,1e4),a.current||(a.current=!0,(0,Bt.i$)(p))),()=>{clearTimeout(t)}}),[c,i,p]),!c||Date.now()-c>1e4)return;const g=(0,Aa.Z)(Boolean(d)&&`top: ${d}px`,Boolean(u)&&`left: ${u}px`,Boolean(l)&&`width: ${l}px`,Boolean(m)&&`height: ${m}px`);return Tt.ZP.createElement("div",{id:"Confetti",className:Ec.root,style:g},Tt.ZP.createElement("canvas",{ref:t,className:Ec.canvas,width:n.width,height:n.height}))}))),Tc=e=>{const{folder:t}=e,s=(0,Yt.Z)(Ot.gl.Extra,"DeleteFolderDialog",!t);return s?Tt.ZP.createElement(s,e):void 0},Nc=({isOpen:e})=>{const t=(0,Yt.Z)(Ot.gl.Extra,"Dialogs",!e);return t?Tt.ZP.createElement(t,null):void 0};var Ac=s(6562);const Bc=new Set,xc=new Set,Uc=(0,Tt.X$)((0,a.c$)((e=>({activeDownloads:(0,b.jUK)(e).activeDownloads.byChatId})))((({activeDownloads:e})=>{const{cancelMessagesMediaDownload:t,showNotification:s}=(0,a.Sv)(),n=(0,rn.Z)(1e3,!0),o=(0,qt.Z)((e=>{xc.add(e),n((()=>{xc.size&&(t({messages:Array.from(xc)}),xc.clear())}))}));(0,Tt.d4)((()=>{const t=(0,a.Rd)().messages.byChatId,n=(0,a.Rd)().scheduledMessages.byChatId,c=Object.entries(e).map((([e,s])=>{const a=s.ids?.map((s=>t[e]?.byId[s])),i=s.scheduledIds?.map((t=>n[e]?.byId[t]));return(0,m.oA)([...a||[],...i||[]])})).flat();c.length?c.forEach((e=>{if(Bc.has(e))return;Bc.add(e);const t=(0,I.Ti)(e,"download");if(!t)return void o(e);const a=xe.UV(t);if(a)return(0,Ac.Z)(a,(0,I.w6)(e)),void o(e);const{document:n,video:c,audio:d}=e.content;if(((n||c||d)?.size||0)>i.l0&&!i.rT&&!i.Mc)return s({message:"Downloading files bigger than 2GB is not supported in your browser."}),void o(e);const l=(0,I.kG)(e,"download");xe.he(t,l,!0).then((t=>{if(l===r.IU.DownloadUrl){const a=new URL(t,window.document.baseURI),n=(0,I.w6)(e);a.searchParams.set("filename",encodeURIComponent(n));const i=window.open(a.toString());i?.addEventListener("beforeunload",(()=>{s({message:"Download started. Please, do not close the app before it is finished."})}))}else t&&(0,Ac.Z)(t,(0,I.w6)(e));o(e)}))})):Bc.clear()}),[e,t,o,s])}))),Lc=e=>{const{requestedDraft:t}=e,s=(0,Yt.Z)(Ot.gl.Extra,"DraftRecipientPicker",!t);return s?Tt.ZP.createElement(s,e):void 0},Oc=e=>{const{isOpen:t}=e,s=(0,Yt.Z)(Ot.gl.Extra,"ForwardRecipientPicker",!t);return s?Tt.ZP.createElement(s,e):void 0};var _c=s(56389),Fc=s(34563);const Dc=(0,Tt.X$)((0,a.c$)(((e,{openedGame:t})=>{const{chatId:s}=t||{},a=s&&(0,b.Z1J)(e,s),n=s?(0,b.x67)(e,s):void 0;return{canPost:Boolean(a)&&(0,I.Qm)(a,r._f,void 0,n)}}))((({openedGame:e,gameTitle:t,canPost:s})=>{const{closeGame:a,openForwardMenu:n}=(0,he.Sv)(),i=(0,Is.Z)(),{url:o,chatId:r,messageId:c}=e||{},d=Boolean(o),l=(0,_c.Z)(r);(0,_t.Z)((()=>{l({type:"playingGame"})}),d&&s?5e3:void 0);const u=(0,Tt.I4)((e=>{try{const t=JSON.parse(e.data);"share_score"===t.eventType&&(n({fromChatId:r,messageIds:[c],withMyScore:!0}),a()),"share_game"===t.eventType&&(n({fromChatId:r,messageIds:[c]}),a())}catch(e){}}),[r,a,c,n]),m=(0,Tt.I4)((e=>{e.currentTarget.focus()}),[]);return(0,Tt.d4)((()=>(window.addEventListener("message",u),()=>window.removeEventListener("message",u))),[u]),Tt.ZP.createElement(Fc.Z,{className:"GameModal",isOpen:d,onClose:a,title:t,hasCloseButton:!0},d&&Tt.ZP.createElement("iframe",{className:"game-frame",onLoad:m,src:o,title:i("AttachGame"),sandbox:"allow-scripts allow-same-origin allow-orientation-lock",allow:"fullscreen"}))}))),jc=e=>{const{isOpen:t}=e,s=(0,Yt.Z)(Ot.gl.Extra,"HistoryCalendar",!t);return s?Tt.ZP.createElement(s,e):void 0},qc=e=>{const{userIds:t,chatId:s}=e,a=(0,Yt.Z)(Ot.gl.Extra,"InviteViaLinkModal",!(t&&s));return a?Tt.ZP.createElement(a,e):void 0},Gc=e=>{const{isOpen:t}=e,s=(0,Yt.Z)(Ot.gl.Extra,"NewContactModal",!t);return s?Tt.ZP.createElement(s,e):void 0},Hc=({isOpen:e})=>{const t=(0,Yt.Z)(Ot.gl.Extra,"Notifications",!e);return t?Tt.ZP.createElement(t,null):void 0},Vc=e=>{const{limit:t}=e,s=(0,Yt.Z)(Ot.gl.Extra,"PremiumLimitReachedModal",!t);return s?Tt.ZP.createElement(s,e):void 0},$c=e=>{const{isOpen:t}=e,s=(0,Yt.Z)(Ot.gl.Extra,"PremiumMainModal",!t);return s?Tt.ZP.createElement(s,e):void 0},zc=e=>{const{url:t}=e,s=(0,Yt.Z)(Ot.gl.Extra,"SafeLinkModal",!t);return s?Tt.ZP.createElement(s,e):void 0};let Kc=!1;const Jc=(0,Tt.X$)((0,a.c$)(((e,{isMobile:t})=>{const{settings:{byKey:{language:s,wasTimeFormatSetManually:a}},currentUserId:n}=e,{botTrustRequest:i,requestedAttachBotInstall:o,requestedAttachBotInChat:r,requestedDraft:c,urlAuth:d,webApp:l,safeLinkModalUrl:u,mapModal:m,openedStickerSetShortName:h,openedCustomEmojiSetIds:p,shouldSkipHistoryAnimations:g,openedGame:f,audioPlayer:w,isLeftColumnShown:v,historyCalendarSelectedAt:y,notifications:P,dialogs:Z,newContact:S,ratingPhoneCall:C,premiumModal:M,isMasterTab:E,payment:R,limitReachedModal:k,deleteFolderDialogModal:T,chatlistModal:N,boostModal:A,giftCodeModal:B,inviteViaLinkModal:x,oneTimeMediaModal:U}=(0,b.jUK)(e),{chatId:L,messageId:O}=w,_=L&&O?(0,b.hjO)(e,L,O):void 0,F=f&&(0,b.hjO)(e,f.chatId,f.messageId),D=F?.content.game?.title,j=e.currentUserId?(0,b.dyD)(e,e.currentUserId):void 0,{chatId:q}=(0,b.Btg)(e)||{},G=!(0,b.$Yd)(e,"rightColumnAnimations")||!(0,b.FOo)(e),H=T?(0,b.MwT)(e,T):void 0;return{currentUserId:n,isLeftColumnOpen:v,isMiddleColumnOpen:Boolean(q),isRightColumnOpen:(0,b.Jf5)(e,t),isMediaViewerOpen:(0,b.zQd)(e),isStoryViewerOpen:(0,b.TuN)(e),isForwardModalOpen:(0,b.Evo)(e),isReactionPickerOpen:(0,b.Io8)(e),hasNotifications:Boolean(P.length),hasDialogs:Boolean(Z.length),audioMessage:_,safeLinkModalUrl:u,mapModalGeoPoint:m?.point,mapModalZoom:m?.zoom,isHistoryCalendarOpen:Boolean(y),shouldSkipHistoryAnimations:g,openedStickerSetShortName:h,openedCustomEmojiSetIds:p,isServiceChatReady:(0,b.UWV)(e),activeGroupCallId:E?e.groupCalls.activeGroupCallId:void 0,withInterfaceAnimations:(0,b.FOo)(e),language:s,wasTimeFormatSetManually:a,isPhoneCallActive:E?Boolean(e.phoneCall):void 0,addedSetIds:e.stickers.added.setIds,addedCustomEmojiIds:e.customEmojis.added.setIds,newContactUserId:S?.userId,newContactByPhoneNumber:S?.isByPhoneNumber,openedGame:f,gameTitle:D,isRatePhoneCallModalOpen:Boolean(C),botTrustRequest:i,botTrustRequestBot:i&&(0,b.dyD)(e,i.botId),attachBotToInstall:o?.bot,requestedAttachBotInChat:r,webApp:l,currentUserName:(0,I.Js)(j),urlAuth:d,isCurrentUserPremium:(0,b.wVz)(e),isPremiumModalOpen:M?.isOpen,limitReached:k?.limit,isPaymentModalOpen:R.isPaymentModalOpen,isReceiptModalOpen:Boolean(R.receipt),deleteFolderDialog:H,isMasterTab:E,requestedDraft:c,chatlistModal:N,boostModal:A,giftCodeModal:B,noRightColumnAnimation:G,isSynced:e.isSynced,inviteViaLinkModal:x,oneTimeMediaModal:U}}))((({isMobile:e,isLeftColumnOpen:t,isMiddleColumnOpen:s,isRightColumnOpen:o,isMediaViewerOpen:r,isStoryViewerOpen:c,isForwardModalOpen:d,hasNotifications:l,hasDialogs:u,audioMessage:m,activeGroupCallId:h,safeLinkModalUrl:p,mapModalGeoPoint:g,mapModalZoom:f,isHistoryCalendarOpen:I,shouldSkipHistoryAnimations:w,limitReached:v,openedStickerSetShortName:b,openedCustomEmojiSetIds:y,isServiceChatReady:P,withInterfaceAnimations:Z,language:S,wasTimeFormatSetManually:C,addedSetIds:M,addedCustomEmojiIds:E,isPhoneCallActive:R,newContactUserId:k,newContactByPhoneNumber:T,openedGame:N,gameTitle:A,isRatePhoneCallModalOpen:x,botTrustRequest:U,botTrustRequestBot:L,attachBotToInstall:O,requestedAttachBotInChat:_,requestedDraft:F,webApp:D,currentUserName:j,urlAuth:q,isPremiumModalOpen:G,isPaymentModalOpen:H,isReceiptModalOpen:V,isReactionPickerOpen:$,isCurrentUserPremium:z,deleteFolderDialog:K,isMasterTab:J,chatlistModal:W,giftCodeModal:Y,boostModal:X,noRightColumnAnimation:Q,isSynced:ee,inviteViaLinkModal:te,oneTimeMediaModal:se,currentUserId:ae})=>{const{initMain:ne,loadAnimatedEmojis:ie,loadNotificationSettings:oe,loadNotificationExceptions:re,updateIsOnline:ce,onTabFocusChange:de,loadTopInlineBots:le,loadEmojiKeywords:ue,loadCountryList:me,loadAvailableReactions:he,loadStickerSets:pe,loadPremiumGifts:ge,loadDefaultTopicIcons:fe,loadAddedStickers:Ie,loadFavoriteStickers:we,loadDefaultStatusIcons:ve,ensureTimeFormat:be,closeStickerSetModal:ye,closeCustomEmojiSets:Pe,checkVersionNotification:Ze,loadConfig:Se,loadAppConfig:Ce,loadAttachBots:Me,loadContactList:Ee,loadCustomEmojis:Re,loadGenericEmojiEffects:ke,closePaymentModal:Te,clearReceipt:Ne,checkAppVersion:Ae,openThread:Be,toggleLeftColumn:xe,loadRecentEmojiStatuses:Ue,updatePageTitle:Oe,loadTopReactions:_e,loadRecentReactions:Fe,loadDefaultTagReactions:De,loadFeaturedEmojiStickers:je,setIsElectronUpdateAvailable:qe,loadAuthorizations:Ge,loadPeerColors:He,loadSavedReactionTags:Ve}=(0,a.Sv)();n.eMD&&!Kc&&(Kc=!0,console.log(">>> RENDER MAIN")),(0,Ft.Z)((()=>{(0,Ot.Pb)(Ot.gl.Calls)}),5e3);const $e=(0,Tt.sO)(null),ze=(0,Tt.sO)(null),{isDesktop:Ke}=(0,B.ZP)();(0,Tt.d4)((()=>{t||s||Ke?t&&s&&e&&xe():xe()}),[Ke,t,s,e,xe]),(0,_t.Z)(Ae,J?3e5:void 0,!0),(0,Tt.d4)((()=>{if(!i.D$)return;const e=window.electron.on(At.I.UPDATE_AVAILABLE,(()=>{qe(!0)})),t=window.electron.on(At.I.UPDATE_ERROR,(()=>{qe(!1),e?.()}));return()=>{t?.(),e?.()}}),[]),(0,Tt.d4)((()=>{J&&ee&&(ce(!0),Se(),Ce(),He(),ne(),he(),ie(),ke(),oe(),re(),le(),ue({language:n.pRL}),Me(),Ee(),ge(),fe(),Ae(),_e(),Fe(),De(),je(),Ge(),Ve())}),[J,ee]),(0,Tt.d4)((()=>{J&&z&&(ve(),Ue())}),[z,J]),(0,Tt.d4)((()=>{J&&(S!==n.pRL&&ue({language:S}),me({langCode:S}))}),[S,J]),(0,Tt.d4)((()=>{J&&Re({ids:Object.keys((0,a.Rd)().customEmojis.byId),ignoreCache:!0})}),[J]),(0,Tt.d4)((()=>{J&&ee&&(M&&E||(pe(),we()),M&&E&&Ie())}),[M,E,J,ee]),(0,Tt.d4)((()=>{P&&J&&Ze()}),[P,J]),(0,Tt.d4)((()=>{C||be()}),[C]),(0,Tt.d4)((()=>{const e=(0,Le.dx)();e?.tgaddr&&(0,Lt.ou)(decodeURIComponent(e.tgaddr))}),[]),(0,Tt.d4)((()=>window.electron?.on(At.I.DEEPLINK,(e=>{(0,Lt.ou)(decodeURIComponent(e))}))),[]),(0,Tt.d4)((()=>{const e=(0,Le.VX)(ae);e&&Be({chatId:e.chatId,threadId:e.threadId,type:e.type})}),[ae]),(0,Tt.bt)((()=>{const e=$e.current;1===e.parentNode.childElementCount&&(0,Nt.D_)(e,"Transition_slide-active")}),[]);const We=(0,$t.Z)(t,void 0,!0,void 0,w,void 0,!0),Ye=(0,Tt.sO)(!1),Xe=(0,Dt.Z)();(0,zt.Z)((([e])=>{if(void 0===e||t===e||!Z)return;Ye.current=!0,i.wZ&&(0,Bt.Yq)((()=>{document.body.classList.toggle("android-left-blackout-open",!t)}));const s=(0,jt.YW)();(0,Ut.L)(document.getElementById("MiddleColumn"),(()=>{s(),Ye.current=!1,Xe()}))}),[t,Z,Xe]);const Qe=(0,$t.Z)(o,void 0,!0,void 0,w,void 0,!0),et=(0,Tt.sO)(!1),[tt,st]=(0,Tt.eJ)(o),at=(0,Wt.Ar)();(0,zt.Z)((([e,t])=>{if(void 0===t||o===t)return;if(!e||Q)return void st(o);et.current=!0;const s=(0,jt.YW)();(0,Ut.L)(document.getElementById("RightColumn"),(()=>{s(),et.current=!1,Xe(),st(o)}))}),[s,o,Q,Xe]);const nt=(0,xt.Z)(We.hasShownClass&&"left-column-shown",We.hasOpenClass&&"left-column-open",Ye.current&&"left-column-animating",Qe.hasShownClass&&"right-column-shown",Qe.hasOpenClass&&"right-column-open",et.current&&"right-column-animating",tt&&"narrow-message-list",w&&"history-animation-disabled",at&&"is-fullscreen"),it=(0,qt.Z)((()=>{de({isBlurred:!0})})),ot=(0,qt.Z)((()=>{de({isBlurred:!1}),document.title.includes(n.ouc)||Oe(),Je(!1)})),rt=(0,qt.Z)((()=>{ye()})),ct=(0,qt.Z)((()=>{Pe()}));return(0,Kt.Z)(it,ot,!!i.D$),(0,Jt.Z)(it),function(e=!1){(0,Tt.d4)((()=>{if(i.$b){if(!e)return Gt?.setAttribute("content",Ht),i.cj&&!i.fl&&document.addEventListener("gesturestart",Vt),()=>{Gt?.setAttribute("content","width=device-width, initial-scale=1, shrink-to-fit=no"),i.cj&&!i.fl&&document.removeEventListener("gesturestart",Vt)};Gt?.setAttribute("content","width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover")}}),[e])}(r||c),Tt.ZP.createElement("div",{ref:$e,id:"Main",className:nt},Tt.ZP.createElement(ua,{ref:ze}),Tt.ZP.createElement(Ir,{leftColumnRef:ze,isMobile:e}),Tt.ZP.createElement(Zc,{isMobile:e}),Tt.ZP.createElement(ma,{isOpen:r}),Tt.ZP.createElement(Sc,{isOpen:c}),Tt.ZP.createElement(Oc,{isOpen:d}),Tt.ZP.createElement(Lc,{requestedDraft:F}),Tt.ZP.createElement(Hc,{isOpen:l}),Tt.ZP.createElement(Nc,{isOpen:u}),m&&Tt.ZP.createElement(Ra,{key:m.id,message:m,noUi:!0}),Tt.ZP.createElement(zc,{url:p}),Tt.ZP.createElement(Pr,{geoPoint:g,zoom:f}),Tt.ZP.createElement(Sr,{urlAuth:q,currentUserName:j}),Tt.ZP.createElement(jc,{isOpen:I}),Tt.ZP.createElement(as,{isOpen:Boolean(b),onClose:rt,stickerSetShortName:b}),Tt.ZP.createElement(ss,{customEmojiSetIds:y,onClose:ct}),h&&Tt.ZP.createElement(Qt,{groupCallId:h}),Tt.ZP.createElement(Xt,{isActive:Boolean(h||R)}),Tt.ZP.createElement(Gc,{isOpen:Boolean(k||T),userId:k,isByPhoneNumber:T}),Tt.ZP.createElement(vr,{info:X}),Tt.ZP.createElement(yr,{modal:Y}),Tt.ZP.createElement(Zr,{info:se}),Tt.ZP.createElement(br,{info:W}),Tt.ZP.createElement(Dc,{openedGame:N,gameTitle:A}),Tt.ZP.createElement(Cr,{webApp:D}),Tt.ZP.createElement(Uc,null),Tt.ZP.createElement(kc,null),Tt.ZP.createElement(es,{isActive:R}),Tt.ZP.createElement(rs,{isForAppBadge:!0}),Tt.ZP.createElement(ts,{isOpen:x}),Tt.ZP.createElement(Mc,{bot:L,type:U?.type,shouldRequestWriteAccess:U?.shouldRequestWriteAccess}),Tt.ZP.createElement(wr,{bot:O}),Tt.ZP.createElement(Cc,{requestedAttachBotInChat:_}),Tt.ZP.createElement(Na,null),Tt.ZP.createElement($c,{isOpen:G}),Tt.ZP.createElement(Vc,{limit:v}),Tt.ZP.createElement(Mr,{isOpen:H,onClose:Te}),Tt.ZP.createElement(Er,{isOpen:V,onClose:Ne}),Tt.ZP.createElement(Tc,{folder:K}),Tt.ZP.createElement(ka,{isOpen:$}),Tt.ZP.createElement(qc,{userIds:te?.restrictedUserIds,chatId:te?.chatId}))})));var Wc=s(99364);var Yc=s(2092);const Xc=(0,Tt.X$)((0,a.c$)((e=>({passcodeSettings:e.passcode})))((({isLocked:e,passcodeSettings:t})=>{const{unlockScreen:s,signOut:n,logInvalidUnlockAttempt:i,resetInvalidUnlockAttempts:o}=(0,a.Sv)(),{invalidAttemptsCount:r,timeoutUntil:c,isLoading:d}=t,l=(0,Is.Z)(),[u,m]=(0,Tt.eJ)(""),[h,p]=(0,Tt.eJ)(!1),[g,f,I]=(0,xs.Z)(!1),{shouldRender:w}=(0,$t.Z)(e);(0,Ft.Z)(o,c?c-Date.now():void 0);const v=(0,Tt.I4)((()=>{m("")}),[]),b=(0,Tt.I4)((e=>{void 0===c?(m(""),(0,at.so)(e).then(s,(()=>{i(),m(l("lng_passcode_wrong"))}))):m(l("FloodWait"))}),[l,c]);(0,Tt.d4)((()=>{void 0!==c?m(l("FloodWait")):0===r&&m("")}),[c,l,r]);const y=(0,Tt.I4)((()=>{I(),n({forceInitApi:!0})}),[I,n]);if(w)return Tt.ZP.createElement("div",{className:"bdKGCai4"},Tt.ZP.createElement("div",{className:"BIi4Pl4Z",dir:l.isRtl?"rtl":void 0},Tt.ZP.createElement(Oi.Z,{tgsUrl:Li.l.Lock,previewUrl:Yc,size:160,className:"JwlsF2tF"}),Tt.ZP.createElement(Wc.Z,{key:"password-form",shouldShowSubmit:!0,shouldDisablePasswordManager:!0,isLoading:d,error:u,placeholder:l("Passcode.EnterPasscodePlaceholder"),submitLabel:l("Next"),clearError:v,isPasswordVisible:h,noRipple:!0,onChangePasswordVisibility:p,onSubmit:b}),Tt.ZP.createElement("div",{className:"VlXFyC_a"},Tt.ZP.createElement("p",null,Tt.ZP.createElement(mr.Z,{onClick:f},"Log out")," ","if you don't remember your passcode."),Tt.ZP.createElement("p",null,Tt.ZP.createElement(ws.Z,{color:"translucent",size:"tiny",isText:!0,onClick:f},l("AccountSettings.Logout"))))),Tt.ZP.createElement(_i.Z,{isOpen:g,onClose:I,text:l("lng_sure_logout"),confirmLabel:l("AccountSettings.Logout"),confirmHandler:y,confirmIsDestructive:!0}))})));n.eMD&&console.log(">>> FINISH LOAD MAIN BUNDLE");const{passcode:{isScreenLocked:Qc},connectionState:ed}=(0,a.Rd)();ed||Qc||i.Eo||(0,a.Sv)().initApi()},48960:(e,t,s)=>{var a=s(48764).lW;const{constructors:n}=s(57404),i=a.from("ffd8ffe000104a46494600010100000100010000ffdb004300281c1e231e19282321232d2b28303c64413c37373c7b585d4964918099968f808c8aa0b4e6c3a0aadaad8a8cc8ffcbdaeef5ffffff9bc1fffffffaffe6fdfff8ffdb0043012b2d2d3c353c76414176f8a58ca5f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8ffc00011080000000003012200021101031101ffc4001f0000010501010101010100000000000000000102030405060708090a0bffc400b5100002010303020403050504040000017d01020300041105122131410613516107227114328191a1082342b1c11552d1f02433627282090a161718191a25262728292a3435363738393a434445464748494a535455565758595a636465666768696a737475767778797a838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae1e2e3e4e5e6e7e8e9eaf1f2f3f4f5f6f7f8f9faffc4001f0100030101010101010101010000000000000102030405060708090a0bffc400b51100020102040403040705040400010277000102031104052131061241510761711322328108144291a1b1c109233352f0156272d10a162434e125f11718191a262728292a35363738393a434445464748494a535455565758595a636465666768696a737475767778797a82838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae2e3e4e5e6e7e8e9eaf2f3f4f5f6f7f8f9faffda000c03010002110311003f00","hex"),o=a.from("ffd9","hex");function r(e,t){throw new Error(`Cannot cast ${e.className} to any kind of ${t}`)}e.exports={getMessageId:function(e){if(void 0!==e){if("number"==typeof e)return e;if(2030045667===e.SUBCLASS_OF_ID)return e.id;throw new Error(`Invalid message type: ${e.constructor.name}`)}},getInputPeer:function e(t,s=!0,a=!0){if(void 0===t.SUBCLASS_OF_ID){if(s&&"inputEntity"in t)return t.inputEntity;if("entity"in t)return e(t.entity);r(t,"InputPeer")}if(3374092470===t.SUBCLASS_OF_ID)return t;if(t instanceof n.User){if(t.isSelf&&s)return new n.InputPeerSelf;if(void 0===t.accessHash&&a)throw new Error("User without accessHash or min info cannot be input");return new n.InputPeerUser({userId:t.id,accessHash:t.accessHash})}if(t instanceof n.Chat||t instanceof n.ChatEmpty||t instanceof n.ChatForbidden)return new n.InputPeerChat({chatId:t.id});if(t instanceof n.Channel){if(void 0===t.accessHash&&a)throw new TypeError("Channel without accessHash or min info cannot be input");return new n.InputPeerChannel({channelId:t.id,accessHash:t.accessHash})}return t instanceof n.ChannelForbidden?new n.InputPeerChannel({channelId:t.id,accessHash:t.accessHash}):t instanceof n.InputUser?new n.InputPeerUser({userId:t.userId,accessHash:t.accessHash}):t instanceof n.InputChannel?new n.InputPeerChannel({channelId:t.channelId,accessHash:t.accessHash}):t instanceof n.UserEmpty?new n.InputPeerEmpty:t instanceof n.UserFull?e(t.user):t instanceof n.ChatFull?new n.InputPeerChat({chatId:t.id}):t instanceof n.PeerChat?new n.InputPeerChat(t.chatId):void r(t,"InputPeer")},getDisplayName:function(e){return e instanceof n.User?e.lastName&&e.firstName?`${e.firstName} ${e.lastName}`:e.firstName?e.firstName:e.lastName?e.lastName:"":e instanceof n.Chat||e instanceof n.Channel?e.title:""},getDownloadPartSize:function(e){if(e<=65536)return 64;if(e<=104857600)return 128;if(e<=786432e3)return 256;if(e<=2097152e3)return 512;if(e<=4194304e3)return 1024;throw new Error("File size too large")},getUploadPartSize:function(e){if(e<=104857600)return 128;if(e<=786432e3)return 256;if(e<=2097152e3)return 512;if(e<=4194304e3)return 512;throw new Error("File size too large")},strippedPhotoToJpg:function(e){if(e.length<3||1!==e[0])return e;const t=a.from(i);return t[164]=e[1],t[166]=e[2],a.concat([t,e.slice(3),o])},getDC:function(e,t=!1){switch(e){case 1:return{id:1,ipAddress:`zws1${t?"-1":""}.web.telegram.org`,port:443};case 2:return{id:2,ipAddress:`zws2${t?"-1":""}.web.telegram.org`,port:443};case 3:return{id:3,ipAddress:`zws3${t?"-1":""}.web.telegram.org`,port:443};case 4:return{id:4,ipAddress:`zws4${t?"-1":""}.web.telegram.org`,port:443};case 5:return{id:5,ipAddress:`zws5${t?"-1":""}.web.telegram.org`,port:443};default:throw new Error(`Cannot find the DC with the ID of ${e}`)}}}}}]);
|
||
//# sourceMappingURL=5769.879e2238e383b95196dd.js.map
|